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

     Python 3.16.0a0, 5月 19, 2026

     Author name not set

     Copyright © 2001 Python Software Foundation

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


   Generated by Sphinx 8.2.3.


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

Python
******

     Python 3.16.0a0, 5月 19, 2026

     Author name not set

     Copyright © 2001 Python Software Foundation

* Menu:

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

* Summary: Summary --- release highlights. release highlights
* New features::
* Other language changes::
* New modules::
* Improved modules::
* Optimizations::
* Removed::
* Deprecated::
* Porting to Python 3.16: Porting to Python 3 16.
* Build changes::
* C API changes::

Improved modules

* os::

Optimizations

* module_name::

Removed

* annotationlib::
* asyncio::
* functools::
* logging::
* mimetypes::
* shutil::
* symtable::
* sys::
* sysconfig::
* tarfile::

C API changes

* New features: New features<2>.
* Porting to Python 3.16: Porting to Python 3 16<2>.
* Deprecated C APIs::
* Removed C APIs::

What's new in Python 3.15

* Summary: Summary -- Release highlights. Release highlights
* New features: New features<3>.
* Other language changes: Other language changes<2>.
* Default interactive shell::
* New modules: New modules<2>.
* Improved modules: Improved modules<2>.
* Optimizations: Optimizations<2>.
* Removed: Removed<2>.
* Deprecated: Deprecated<2>.
* C API changes: C API changes<2>.
* Build changes: Build changes<2>.
* Porting to Python 3.15: Porting to Python 3 15.

New features

* PEP 810; Explicit lazy imports: PEP 810 Explicit lazy imports.
* PEP 814; Add frozendict built-in type: PEP 814 Add frozendict built-in type.
* PEP 661; Add sentinel built-in type: PEP 661 Add sentinel built-in type.
* PEP 799; A dedicated profiling package: PEP 799 A dedicated profiling package.
* Tachyon; High frequency statistical sampling profiler: Tachyon High frequency statistical sampling profiler.
* PEP 831; Frame pointers enabled by default: PEP 831 Frame pointers enabled by default.
* PEP 798; Unpacking in comprehensions: PEP 798 Unpacking in comprehensions.
* PEP 829; Package startup configuration files: PEP 829 Package startup configuration files.
* PEP 803: PEP 803 -- Stable ABI for free-threaded builds. Stable ABI for free-threaded builds
* PEP 788; Protecting the C API from interpreter finalization: PEP 788 Protecting the C API from interpreter finalization.
* Improved error messages::

New modules

* math.integer: math integer.

Improved modules

* argparse::
* array::
* ast::
* asyncio: asyncio<2>.
* base64::
* binascii::
* calendar::
* collections::
* concurrent.futures: concurrent futures.
* contextlib::
* dataclasses::
* dbm::
* difflib::
* email::
* faulthandler::
* functools: functools<2>.
* gc::
* hashlib::
* http.client: http client.
* http.server: http server.
* inspect::
* json::
* locale::
* math::
* mimetypes: mimetypes<2>.
* mmap::
* os: os<2>.
* os.path: os path.
* pdb::
* pickle::
* pickletools::
* pprint::
* re::
* resource::
* shelve::
* socket::
* sqlite3::
* ssl::
* subprocess::
* symtable: symtable<2>.
* sys: sys<2>.
* sys.monitoring: sys monitoring.
* tarfile: tarfile<2>.
* threading::
* timeit::
* tkinter::
* tokenize::
* tomllib::
* types::
* typing::
* unicodedata::
* unittest::
* urllib.parse: urllib parse.
* venv::
* warnings::
* wave::
* webbrowser::
* xml::
* xml.parsers.expat: xml parsers expat.
* zlib::

Optimizations

* base64 & binascii::
* csv::
* Upgraded JIT compiler::

Removed

* ast: ast<2>.
* collections.abc: collections abc.
* ctypes::
* datetime::
* glob::
* http.server: http server<2>.
* importlib.resources: importlib resources.
* pathlib::
* platform::
* sre_*::
* sysconfig: sysconfig<2>.
* threading: threading<2>.
* types: types<2>.
* typing: typing<2>.
* wave: wave<2>.
* zipimport::

Deprecated

* New deprecations::
* 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 Python 3.20: Pending removal in Python 3 20.
* Pending removal in future versions::
* Soft deprecations::

C API changes

* New features: New features<4>.
* Changed C APIs::
* Removed C APIs: Removed C APIs<2>.
* Deprecated C APIs: Deprecated C APIs<2>.

What's new in Python 3.14

* 概要: 概要 -- リリースハイライト. リリースハイライト
* 新しい機能::
* Other language changes: Other language changes<3>.
* 新しいモジュール::
* Improved modules: Improved modules<3>.
* 最適化::
* 削除::
* 非推奨::
* CPython バイトコードの変更::
* C API changes: C API changes<3>.
* Build changes: Build changes<3>.
* Porting to Python 3.14: Porting to Python 3 14.
* 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: Default interactive shell<2>.

Improved modules

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

最適化

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

削除

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

非推奨

* New deprecations: New deprecations<2>.
* Pending removal in Python 3.15: Pending removal in Python 3 15.
* Pending removal in Python 3.16: Pending removal in Python 3 16<2>.
* 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<2>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<2>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<2>.
* Pending removal in future versions: Pending removal in future versions<2>.

CPython バイトコードの変更

* Pseudo-instructions::

C API changes

* Python configuration C API::
* New features in the C API::
* Limited C API changes::
* Removed C APIs: Removed C APIs<3>.
* Deprecated C APIs: Deprecated C APIs<3>.

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<3>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<3>.
* Pending removal in future versions: Pending removal in future versions<3>.

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

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

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: locale<2>.
* opcode::
* optparse::
* pathlib: pathlib<6>.
* re: re<4>.
* tkinter.tix: tkinter tix.
* turtle: turtle<2>.
* typing: typing<5>.
* unittest: unittest<3>.
* urllib: urllib<3>.
* webbrowser: webbrowser<3>.

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<4>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<3>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<4>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<3>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<3>.
* Pending removal in future versions: Pending removal in future versions<4>.

C API の変更

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

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<5>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<5>.
* Pending removal in future versions: Pending removal in future versions<5>.

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: array<2>.
* asyncio: asyncio<7>.
* calendar: calendar<3>.
* csv: csv<2>.
* dis: dis<3>.
* fractions: fractions<3>.
* importlib.resources: importlib resources<2>.
* inspect: inspect<3>.
* itertools: itertools<3>.
* math: math<4>.
* os: os<5>.
* os.path: os path<4>.
* pathlib: pathlib<7>.
* プラットフォーム: プラットフォーム<2>.
* pdb: pdb<5>.
* random: random<2>.
* shutil: shutil<3>.
* sqlite3: sqlite3<4>.
* statistics: statistics<2>.
* sys: sys<5>.
* tempfile: tempfile<2>.
* threading: threading<4>.
* tkinter: tkinter<4>.
* tokenize: tokenize<2>.
* types: types<5>.
* typing: typing<6>.
* unicodedata: unicodedata<4>.
* unittest: unittest<4>.
* 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<6>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<4>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<4>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<4>.
* Pending removal in future versions: Pending removal in future versions<6>.

削除

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

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<7>.
* Pending removal in future versions: Pending removal in future versions<7>.

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

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

データクラス

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

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

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<10>.
* macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート.

Python 3.9.2 での重要な変更点

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

Python 3.9.5での重要な変更点

* urllib.parse: urllib parse<4>.

Notable changes in 3.9.17

* tarfile: tarfile<6>.

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

Notable changes in Python 3.8.12

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

Notable changes in 3.8.17

* tarfile: tarfile<8>.

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

改良されたモジュール

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

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

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

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

非推奨

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

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

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

削除

* 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<13>.
* zipapp: zipapp<2>.

改良されたモジュール

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

改良されたモジュール

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

改良されたモジュール

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

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

* Windows::
* テスト::
* セキュリティ::
* ライブラリ::
* Core and Builtins::
* C API::
* ビルド::

Python 3.15.0 beta 1

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

Python 3.15.0 alpha 8

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

Python 3.15.0 alpha 7

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

Python 3.15.0 alpha 6

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

Python 3.15.0 alpha 5

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

Python 3.15.0 alpha 4

* テスト: テスト<7>.
* ライブラリ: ライブラリ<7>.
* Core and Builtins: Core and Builtins<7>.

Python 3.15.0 alpha 3

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

Python 3.15.0 alpha 2

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

Python 3.15.0 alpha 1

* macOS: macOS<4>.
* Windows: Windows<8>.
* Tools/Demos: Tools/Demos<5>.
* テスト: テスト<10>.
* セキュリティ: セキュリティ<8>.
* ライブラリ: ライブラリ<15>.
* IDLE: IDLE<5>.
* ドキュメント: ドキュメント<7>.
* Core and Builtins: Core and Builtins<15>.
* ライブラリ: ライブラリ<16>.
* Core and Builtins: Core and Builtins<16>.
* ライブラリ: ライブラリ<17>.
* Core and Builtins: Core and Builtins<17>.
* ライブラリ: ライブラリ<18>.
* Core and Builtins: Core and Builtins<18>.
* ライブラリ: ライブラリ<19>.
* Core and Builtins: Core and Builtins<19>.
* ライブラリ: ライブラリ<20>.
* Core and Builtins: Core and Builtins<20>.
* ライブラリ: ライブラリ<21>.
* Core and Builtins: Core and Builtins<21>.
* ライブラリ: ライブラリ<22>.
* Core and Builtins: Core and Builtins<22>.
* ライブラリ: ライブラリ<23>.
* Core and Builtins: Core and Builtins<23>.
* ライブラリ: ライブラリ<24>.
* Core and Builtins: Core and Builtins<24>.
* ライブラリ: ライブラリ<25>.
* Core and Builtins: Core and Builtins<25>.
* ライブラリ: ライブラリ<26>.
* Core and Builtins: Core and Builtins<26>.
* ライブラリ: ライブラリ<27>.
* Core and Builtins: Core and Builtins<27>.
* ライブラリ: ライブラリ<28>.
* Core and Builtins: Core and Builtins<28>.
* C API: C API<9>.
* ビルド: ビルド<8>.

Python 3.14.0 beta 1

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

Python 3.14.0 alpha 7

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

Python 3.14.0 alpha 6

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

Python 3.14.0 alpha 5

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

Python 3.14.0 alpha 4

* macOS: macOS<8>.
* Tools/Demos: Tools/Demos<10>.
* テスト: テスト<15>.
* ライブラリ: ライブラリ<42>.
* Core and Builtins: Core and Builtins<40>.
* ライブラリ: ライブラリ<43>.
* Core and Builtins: Core and Builtins<41>.
* ライブラリ: ライブラリ<44>.
* Core and Builtins: Core and Builtins<42>.
* C API: C API<14>.
* ビルド: ビルド<13>.

Python 3.14.0 alpha 3

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

Python 3.14.0 alpha 2

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

Python 3.14.0 alpha 1

* macOS: macOS<9>.
* Windows: Windows<14>.
* Tools/Demos: Tools/Demos<13>.
* テスト: テスト<18>.
* セキュリティ: セキュリティ<15>.
* ライブラリ: ライブラリ<51>.
* IDLE: IDLE<8>.
* ドキュメント: ドキュメント<14>.
* Core and Builtins: Core and Builtins<48>.
* ライブラリ: ライブラリ<52>.
* Core and Builtins: Core and Builtins<49>.
* ライブラリ: ライブラリ<53>.
* Core and Builtins: Core and Builtins<50>.
* ライブラリ: ライブラリ<54>.
* Core and Builtins: Core and Builtins<51>.
* ライブラリ: ライブラリ<55>.
* Core and Builtins: Core and Builtins<52>.
* ライブラリ: ライブラリ<56>.
* Core and Builtins: Core and Builtins<53>.
* ライブラリ: ライブラリ<57>.
* Core and Builtins: Core and Builtins<54>.
* ライブラリ: ライブラリ<58>.
* Core and Builtins: Core and Builtins<55>.
* C API: C API<17>.
* ビルド: ビルド<16>.

Python 3.13.0 beta 1

* セキュリティ: セキュリティ<16>.
* Core and Builtins: Core and Builtins<56>.
* ライブラリ: ライブラリ<59>.
* Core and Builtins: Core and Builtins<57>.
* ライブラリ: ライブラリ<60>.
* ドキュメント: ドキュメント<15>.
* ビルド: ビルド<17>.
* Windows: Windows<15>.
* macOS: macOS<10>.
* IDLE: IDLE<9>.
* C API: C API<18>.

Python 3.13.0 alpha 6

* Core and Builtins: Core and Builtins<58>.
* ライブラリ: ライブラリ<61>.
* Core and Builtins: Core and Builtins<59>.
* ライブラリ: ライブラリ<62>.
* ドキュメント: ドキュメント<16>.
* テスト: テスト<19>.
* ビルド: ビルド<18>.
* Windows: Windows<16>.
* C API: C API<19>.

Python 3.13.0 alpha 5

* セキュリティ: セキュリティ<17>.
* Core and Builtins: Core and Builtins<60>.
* ライブラリ: ライブラリ<63>.
* Core and Builtins: Core and Builtins<61>.
* ライブラリ: ライブラリ<64>.
* Core and Builtins: Core and Builtins<62>.
* ライブラリ: ライブラリ<65>.
* ドキュメント: ドキュメント<17>.
* テスト: テスト<20>.
* ビルド: ビルド<19>.
* Windows: Windows<17>.
* macOS: macOS<11>.
* IDLE: IDLE<10>.
* Tools/Demos: Tools/Demos<14>.
* C API: C API<20>.

Python 3.13.0 alpha 4

* セキュリティ: セキュリティ<18>.
* Core and Builtins: Core and Builtins<63>.
* ライブラリ: ライブラリ<66>.
* ドキュメント: ドキュメント<18>.
* テスト: テスト<21>.
* ビルド: ビルド<20>.
* Windows: Windows<18>.
* macOS: macOS<12>.
* IDLE: IDLE<11>.
* Tools/Demos: Tools/Demos<15>.
* C API: C API<21>.

Python 3.13.0 alpha 3

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

Python 3.13.0 alpha 2

* Core and Builtins: Core and Builtins<65>.
* ライブラリ: ライブラリ<68>.
* テスト: テスト<23>.
* ビルド: ビルド<22>.
* Windows: Windows<20>.
* macOS: macOS<14>.
* IDLE: IDLE<13>.
* Tools/Demos: Tools/Demos<16>.
* C API: C API<23>.

Python 3.13.0 alpha 1

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

Python 3.12.0 beta 1

* セキュリティ: セキュリティ<21>.
* ライブラリ: ライブラリ<70>.
* Core and Builtins: Core and Builtins<67>.
* ライブラリ: ライブラリ<71>.
* Core and Builtins: Core and Builtins<68>.
* ライブラリ: ライブラリ<72>.
* ドキュメント: ドキュメント<21>.
* テスト: テスト<25>.
* ビルド: ビルド<24>.
* Windows: Windows<22>.
* macOS: macOS<16>.
* IDLE: IDLE<15>.
* Tools/Demos: Tools/Demos<18>.
* C API: C API<25>.

Python 3.12.0 alpha 7

* Core and Builtins: Core and Builtins<69>.
* ライブラリ: ライブラリ<73>.
* Core and Builtins: Core and Builtins<70>.
* ビルド: ビルド<25>.
* Core and Builtins: Core and Builtins<71>.
* ライブラリ: ライブラリ<74>.
* ドキュメント: ドキュメント<22>.
* テスト: テスト<26>.
* ビルド: ビルド<26>.
* Windows: Windows<23>.
* Tools/Demos: Tools/Demos<19>.
* C API: C API<26>.

Python 3.12.0 alpha 6

* セキュリティ: セキュリティ<22>.
* Core and Builtins: Core and Builtins<72>.
* ライブラリ: ライブラリ<75>.
* ドキュメント: ドキュメント<23>.
* テスト: テスト<27>.
* ビルド: ビルド<27>.
* Windows: Windows<24>.
* macOS: macOS<17>.
* C API: C API<27>.

Python 3.12.0 alpha 5

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

Python 3.12.0 alpha 4

* Core and Builtins: Core and Builtins<74>.
* ライブラリ: ライブラリ<77>.
* Core and Builtins: Core and Builtins<75>.
* ライブラリ: ライブラリ<78>.
* Core and Builtins: Core and Builtins<76>.
* ライブラリ: ライブラリ<79>.
* ドキュメント: ドキュメント<25>.
* テスト: テスト<29>.
* ビルド: ビルド<29>.
* Windows: Windows<26>.
* macOS: macOS<18>.
* Tools/Demos: Tools/Demos<20>.
* C API: C API<28>.

Python 3.12.0 alpha 3

* セキュリティ: セキュリティ<24>.
* Core and Builtins: Core and Builtins<77>.
* ライブラリ: ライブラリ<80>.
* Core and Builtins: Core and Builtins<78>.
* ライブラリ: ライブラリ<81>.
* ドキュメント: ドキュメント<26>.
* テスト: テスト<30>.
* ビルド: ビルド<30>.
* Windows: Windows<27>.
* macOS: macOS<19>.
* Tools/Demos: Tools/Demos<21>.
* C API: C API<29>.

Python 3.12.0 alpha 2

* セキュリティ: セキュリティ<25>.
* Core and Builtins: Core and Builtins<79>.
* ビルド: ビルド<31>.
* Core and Builtins: Core and Builtins<80>.
* ライブラリ: ライブラリ<82>.
* ドキュメント: ドキュメント<27>.
* テスト: テスト<31>.
* ビルド: ビルド<32>.
* Windows: Windows<28>.
* macOS: macOS<20>.
* C API: C API<30>.

Python 3.12.0 alpha 1

* セキュリティ: セキュリティ<26>.
* Core and Builtins: Core and Builtins<81>.
* ライブラリ: ライブラリ<83>.
* Core and Builtins: Core and Builtins<82>.
* ライブラリ: ライブラリ<84>.
* Core and Builtins: Core and Builtins<83>.
* ライブラリ: ライブラリ<85>.
* Core and Builtins: Core and Builtins<84>.
* ライブラリ: ライブラリ<86>.
* Core and Builtins: Core and Builtins<85>.
* ライブラリ: ライブラリ<87>.
* Core and Builtins: Core and Builtins<86>.
* ライブラリ: ライブラリ<88>.
* Core and Builtins: Core and Builtins<87>.
* ライブラリ: ライブラリ<89>.
* Core and Builtins: Core and Builtins<88>.
* ライブラリ: ライブラリ<90>.
* Core and Builtins: Core and Builtins<89>.
* ライブラリ: ライブラリ<91>.
* Core and Builtins: Core and Builtins<90>.
* ライブラリ: ライブラリ<92>.
* ドキュメント: ドキュメント<28>.
* テスト: テスト<32>.
* ビルド: ビルド<33>.
* Windows: Windows<29>.
* macOS: macOS<21>.
* IDLE: IDLE<16>.
* Tools/Demos: Tools/Demos<22>.
* C API: C API<31>.

Python 3.11.0 beta 1

* セキュリティ: セキュリティ<27>.
* Core and Builtins: Core and Builtins<91>.
* ライブラリ: ライブラリ<93>.
* Core and Builtins: Core and Builtins<92>.
* ビルド: ビルド<34>.
* Core and Builtins: Core and Builtins<93>.
* ライブラリ: ライブラリ<94>.
* ドキュメント: ドキュメント<29>.
* テスト: テスト<33>.
* ビルド: ビルド<35>.
* Windows: Windows<30>.
* macOS: macOS<22>.
* Tools/Demos: Tools/Demos<23>.
* C API: C API<32>.

Python 3.11.0 alpha 7

* Core and Builtins: Core and Builtins<94>.
* ライブラリ: ライブラリ<95>.
* Core and Builtins: Core and Builtins<95>.
* ライブラリ: ライブラリ<96>.
* Core and Builtins: Core and Builtins<96>.
* ライブラリ: ライブラリ<97>.
* ドキュメント: ドキュメント<30>.
* テスト: テスト<34>.
* ビルド: ビルド<36>.
* Windows: Windows<31>.
* macOS: macOS<23>.
* Tools/Demos: Tools/Demos<24>.
* C API: C API<33>.

Python 3.11.0 alpha 6

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

Python 3.11.0 alpha 5

* Core and Builtins: Core and Builtins<101>.
* ライブラリ: ライブラリ<102>.
* Core and Builtins: Core and Builtins<102>.
* ライブラリ: ライブラリ<103>.
* ビルド: ビルド<38>.
* Core and Builtins: Core and Builtins<103>.
* ライブラリ: ライブラリ<104>.
* ドキュメント: ドキュメント<32>.
* テスト: テスト<36>.
* ビルド: ビルド<39>.
* Windows: Windows<33>.
* macOS: macOS<24>.
* IDLE: IDLE<18>.
* C API: C API<35>.

Python 3.11.0 alpha 4

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

Python 3.11.0 alpha 3

* Core and Builtins: Core and Builtins<108>.
* ライブラリ: ライブラリ<109>.
* Core and Builtins: Core and Builtins<109>.
* ライブラリ: ライブラリ<110>.
* ドキュメント: ドキュメント<34>.
* テスト: テスト<38>.
* ビルド: ビルド<41>.
* Windows: Windows<35>.
* macOS: macOS<26>.
* C API: C API<37>.

Python 3.11.0 alpha 2

* Core and Builtins: Core and Builtins<110>.
* ライブラリ: ライブラリ<111>.
* ドキュメント: ドキュメント<35>.
* テスト: テスト<39>.
* ビルド: ビルド<42>.
* Windows: Windows<36>.
* macOS: macOS<27>.
* IDLE: IDLE<19>.
* C API: C API<38>.

Python 3.11.0 alpha 1

* セキュリティ: セキュリティ<28>.
* Core and Builtins: Core and Builtins<111>.
* ライブラリ: ライブラリ<112>.
* Core and Builtins: Core and Builtins<112>.
* ライブラリ: ライブラリ<113>.
* Core and Builtins: Core and Builtins<113>.
* ライブラリ: ライブラリ<114>.
* Core and Builtins: Core and Builtins<114>.
* ライブラリ: ライブラリ<115>.
* Core and Builtins: Core and Builtins<115>.
* ライブラリ: ライブラリ<116>.
* Core and Builtins: Core and Builtins<116>.
* ライブラリ: ライブラリ<117>.
* Core and Builtins: Core and Builtins<117>.
* ライブラリ: ライブラリ<118>.
* Core and Builtins: Core and Builtins<118>.
* ライブラリ: ライブラリ<119>.
* Core and Builtins: Core and Builtins<119>.
* ライブラリ: ライブラリ<120>.
* Core and Builtins: Core and Builtins<120>.
* ライブラリ: ライブラリ<121>.
* ドキュメント: ドキュメント<36>.
* テスト: テスト<40>.
* ビルド: ビルド<43>.
* Windows: Windows<37>.
* macOS: macOS<28>.
* IDLE: IDLE<20>.
* Tools/Demos: Tools/Demos<25>.
* C API: C API<39>.

Python 3.10.0 beta 1

* セキュリティ: セキュリティ<29>.
* Core and Builtins: Core and Builtins<121>.
* ライブラリ: ライブラリ<122>.
* Core and Builtins: Core and Builtins<122>.
* ライブラリ: ライブラリ<123>.
* Core and Builtins: Core and Builtins<123>.
* ライブラリ: ライブラリ<124>.
* ドキュメント: ドキュメント<37>.
* テスト: テスト<41>.
* ビルド: ビルド<44>.
* Windows: Windows<38>.
* macOS: macOS<29>.
* IDLE: IDLE<21>.
* C API: C API<40>.

Python 3.10.0 alpha 7

* セキュリティ: セキュリティ<30>.
* Core and Builtins: Core and Builtins<124>.
* ライブラリ: ライブラリ<125>.
* Core and Builtins: Core and Builtins<125>.
* ライブラリ: ライブラリ<126>.
* ドキュメント: ドキュメント<38>.
* テスト: テスト<42>.
* ビルド: ビルド<45>.
* Windows: Windows<39>.
* IDLE: IDLE<22>.
* C API: C API<41>.

Python 3.10.0 alpha 6

* セキュリティ: セキュリティ<31>.
* Core and Builtins: Core and Builtins<126>.
* ライブラリ: ライブラリ<127>.
* Core and Builtins: Core and Builtins<127>.
* ライブラリ: ライブラリ<128>.
* Core and Builtins: Core and Builtins<128>.
* ライブラリ: ライブラリ<129>.
* ドキュメント: ドキュメント<39>.
* テスト: テスト<43>.
* ビルド: ビルド<46>.
* Windows: Windows<40>.
* macOS: macOS<30>.
* IDLE: IDLE<23>.
* C API: C API<42>.

Python 3.10.0 alpha 5

* セキュリティ: セキュリティ<32>.
* Core and Builtins: Core and Builtins<129>.
* ライブラリ: ライブラリ<130>.
* Core and Builtins: Core and Builtins<130>.
* ライブラリ: ライブラリ<131>.
* ドキュメント: ドキュメント<40>.
* テスト: テスト<44>.
* ビルド: ビルド<47>.
* Windows: Windows<41>.
* macOS: macOS<31>.
* IDLE: IDLE<24>.
* C API: C API<43>.

Python 3.10.0 alpha 4

* Core and Builtins: Core and Builtins<131>.
* ライブラリ: ライブラリ<132>.
* Core and Builtins: Core and Builtins<132>.
* ライブラリ: ライブラリ<133>.
* Core and Builtins: Core and Builtins<133>.
* ライブラリ: ライブラリ<134>.
* ドキュメント: ドキュメント<41>.
* テスト: テスト<45>.
* ビルド: ビルド<48>.
* macOS: macOS<32>.
* Tools/Demos: Tools/Demos<26>.
* C API: C API<44>.

Python 3.10.0 alpha 3

* セキュリティ: セキュリティ<33>.
* Core and Builtins: Core and Builtins<134>.
* ライブラリ: ライブラリ<135>.
* Core and Builtins: Core and Builtins<135>.
* ライブラリ: ライブラリ<136>.
* Core and Builtins: Core and Builtins<136>.
* ライブラリ: ライブラリ<137>.
* Core and Builtins: Core and Builtins<137>.
* ライブラリ: ライブラリ<138>.
* ドキュメント: ドキュメント<42>.
* テスト: テスト<46>.
* ビルド: ビルド<49>.
* Windows: Windows<42>.
* macOS: macOS<33>.
* IDLE: IDLE<25>.
* Tools/Demos: Tools/Demos<27>.
* C API: C API<45>.

Python 3.10.0 alpha 2

* セキュリティ: セキュリティ<34>.
* Core and Builtins: Core and Builtins<138>.
* ライブラリ: ライブラリ<139>.
* Core and Builtins: Core and Builtins<139>.
* ライブラリ: ライブラリ<140>.
* ドキュメント: ドキュメント<43>.
* テスト: テスト<47>.
* ビルド: ビルド<50>.
* Windows: Windows<43>.
* macOS: macOS<34>.
* IDLE: IDLE<26>.
* C API: C API<46>.

Python 3.10.0 alpha 1

* セキュリティ: セキュリティ<35>.
* Core and Builtins: Core and Builtins<140>.
* ライブラリ: ライブラリ<141>.
* Core and Builtins: Core and Builtins<141>.
* ライブラリ: ライブラリ<142>.
* Core and Builtins: Core and Builtins<142>.
* ライブラリ: ライブラリ<143>.
* Core and Builtins: Core and Builtins<143>.
* ライブラリ: ライブラリ<144>.
* Core and Builtins: Core and Builtins<144>.
* ライブラリ: ライブラリ<145>.
* Core and Builtins: Core and Builtins<145>.
* ライブラリ: ライブラリ<146>.
* Core and Builtins: Core and Builtins<146>.
* ライブラリ: ライブラリ<147>.
* Core and Builtins: Core and Builtins<147>.
* ライブラリ: ライブラリ<148>.
* Core and Builtins: Core and Builtins<148>.
* ライブラリ: ライブラリ<149>.
* Core and Builtins: Core and Builtins<149>.
* ライブラリ: ライブラリ<150>.
* Core and Builtins: Core and Builtins<150>.
* ライブラリ: ライブラリ<151>.
* Core and Builtins: Core and Builtins<151>.
* ライブラリ: ライブラリ<152>.
* Core and Builtins: Core and Builtins<152>.
* ライブラリ: ライブラリ<153>.
* Core and Builtins: Core and Builtins<153>.
* ライブラリ: ライブラリ<154>.
* Core and Builtins: Core and Builtins<154>.
* ライブラリ: ライブラリ<155>.
* ドキュメント: ドキュメント<44>.
* テスト: テスト<48>.
* ビルド: ビルド<51>.
* Windows: Windows<44>.
* macOS: macOS<35>.
* IDLE: IDLE<27>.
* C API: C API<47>.

Python 3.9.0 beta 1

* セキュリティ: セキュリティ<36>.
* Core and Builtins: Core and Builtins<155>.
* ライブラリ: ライブラリ<156>.
* ドキュメント: ドキュメント<45>.
* テスト: テスト<49>.
* ビルド: ビルド<52>.
* Windows: Windows<45>.
* macOS: macOS<36>.
* Tools/Demos: Tools/Demos<28>.
* C API: C API<48>.

Python 3.9.0 alpha 6

* セキュリティ: セキュリティ<37>.
* Core and Builtins: Core and Builtins<156>.
* ライブラリ: ライブラリ<157>.
* ドキュメント: ドキュメント<46>.
* テスト: テスト<50>.
* ビルド: ビルド<53>.
* Windows: Windows<46>.
* macOS: macOS<37>.
* IDLE: IDLE<28>.
* Tools/Demos: Tools/Demos<29>.
* C API: C API<49>.

Python 3.9.0 alpha 5

* セキュリティ: セキュリティ<38>.
* Core and Builtins: Core and Builtins<157>.
* ライブラリ: ライブラリ<158>.
* ドキュメント: ドキュメント<47>.
* テスト: テスト<51>.
* ビルド: ビルド<54>.
* Windows: Windows<47>.
* macOS: macOS<38>.
* IDLE: IDLE<29>.
* Tools/Demos: Tools/Demos<30>.
* C API: C API<50>.

Python 3.9.0 alpha 4

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

Python 3.9.0 alpha 3

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

Python 3.9.0 alpha 2

* セキュリティ: セキュリティ<40>.
* Core and Builtins: Core and Builtins<160>.
* ライブラリ: ライブラリ<161>.
* ドキュメント: ドキュメント<50>.
* テスト: テスト<53>.
* ビルド: ビルド<57>.
* Windows: Windows<49>.
* macOS: macOS<39>.
* IDLE: IDLE<32>.
* C API: C API<53>.

Python 3.9.0 alpha 1

* セキュリティ: セキュリティ<41>.
* Core and Builtins: Core and Builtins<161>.
* ライブラリ: ライブラリ<162>.
* ドキュメント: ドキュメント<51>.
* テスト: テスト<54>.
* ビルド: ビルド<58>.
* Windows: Windows<50>.
* macOS: macOS<40>.
* IDLE: IDLE<33>.
* Tools/Demos: Tools/Demos<31>.
* C API: C API<54>.

Python 3.8.0 beta 1

* セキュリティ: セキュリティ<42>.
* Core and Builtins: Core and Builtins<162>.
* ライブラリ: ライブラリ<163>.
* ドキュメント: ドキュメント<52>.
* テスト: テスト<55>.
* ビルド: ビルド<59>.
* Windows: Windows<51>.
* macOS: macOS<41>.
* IDLE: IDLE<34>.
* Tools/Demos: Tools/Demos<32>.
* C API: C API<55>.

Python 3.8.0 alpha 4

* セキュリティ: セキュリティ<43>.
* Core and Builtins: Core and Builtins<163>.
* ライブラリ: ライブラリ<164>.
* ドキュメント: ドキュメント<53>.
* テスト: テスト<56>.
* ビルド: ビルド<60>.
* Windows: Windows<52>.
* macOS: macOS<42>.
* IDLE: IDLE<35>.
* Tools/Demos: Tools/Demos<33>.
* C API: C API<56>.

Python 3.8.0 alpha 3

* セキュリティ: セキュリティ<44>.
* Core and Builtins: Core and Builtins<164>.
* ライブラリ: ライブラリ<165>.
* ドキュメント: ドキュメント<54>.
* テスト: テスト<57>.
* ビルド: ビルド<61>.
* Windows: Windows<53>.
* IDLE: IDLE<36>.
* Tools/Demos: Tools/Demos<34>.
* C API: C API<57>.

Python 3.8.0 alpha 2

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

Python 3.8.0 alpha 1

* セキュリティ: セキュリティ<45>.
* Core and Builtins: Core and Builtins<166>.
* ライブラリ: ライブラリ<167>.
* ドキュメント: ドキュメント<56>.
* テスト: テスト<59>.
* ビルド: ビルド<62>.
* Windows: Windows<55>.
* macOS: macOS<43>.
* IDLE: IDLE<38>.
* Tools/Demos: Tools/Demos<35>.
* C API: C API<58>.

Python 3.7.0 final

* ライブラリ: ライブラリ<168>.
* C API: C API<59>.

Python 3.7.0 release candidate 1

* Core and Builtins: Core and Builtins<167>.
* ライブラリ: ライブラリ<169>.
* ドキュメント: ドキュメント<57>.
* ビルド: ビルド<63>.
* Windows: Windows<56>.
* IDLE: IDLE<39>.

Python 3.7.0 beta 5

* Core and Builtins: Core and Builtins<168>.
* ライブラリ: ライブラリ<170>.
* ドキュメント: ドキュメント<58>.
* テスト: テスト<60>.
* ビルド: ビルド<64>.
* macOS: macOS<44>.
* IDLE: IDLE<40>.

Python 3.7.0 beta 4

* Core and Builtins: Core and Builtins<169>.
* ライブラリ: ライブラリ<171>.
* ドキュメント: ドキュメント<59>.
* テスト: テスト<61>.
* ビルド: ビルド<65>.
* Windows: Windows<57>.
* macOS: macOS<45>.
* IDLE: IDLE<41>.
* Tools/Demos: Tools/Demos<36>.

Python 3.7.0 beta 3

* セキュリティ: セキュリティ<46>.
* Core and Builtins: Core and Builtins<170>.
* ライブラリ: ライブラリ<172>.
* ドキュメント: ドキュメント<60>.
* テスト: テスト<62>.
* ビルド: ビルド<66>.
* Windows: Windows<58>.
* macOS: macOS<46>.
* IDLE: IDLE<42>.
* Tools/Demos: Tools/Demos<37>.
* C API: C API<60>.

Python 3.7.0 beta 2

* セキュリティ: セキュリティ<47>.
* Core and Builtins: Core and Builtins<171>.
* ライブラリ: ライブラリ<173>.
* ドキュメント: ドキュメント<61>.
* テスト: テスト<63>.
* ビルド: ビルド<67>.
* Windows: Windows<59>.
* macOS: macOS<47>.
* IDLE: IDLE<43>.
* Tools/Demos: Tools/Demos<38>.

Python 3.7.0 beta 1

* Core and Builtins: Core and Builtins<172>.
* ライブラリ: ライブラリ<174>.
* ドキュメント: ドキュメント<62>.
* テスト: テスト<64>.
* ビルド: ビルド<68>.
* Windows: Windows<60>.
* macOS: macOS<48>.
* C API: C API<61>.

Python 3.7.0 alpha 4

* Core and Builtins: Core and Builtins<173>.
* ライブラリ: ライブラリ<175>.
* ドキュメント: ドキュメント<63>.
* テスト: テスト<65>.
* Windows: Windows<61>.
* Tools/Demos: Tools/Demos<39>.
* C API: C API<62>.

Python 3.7.0 alpha 3

* Core and Builtins: Core and Builtins<174>.
* ライブラリ: ライブラリ<176>.
* ドキュメント: ドキュメント<64>.
* テスト: テスト<66>.
* ビルド: ビルド<69>.
* Windows: Windows<62>.
* macOS: macOS<49>.
* IDLE: IDLE<44>.
* Tools/Demos: Tools/Demos<40>.
* C API: C API<63>.

Python 3.7.0 alpha 2

* Core and Builtins: Core and Builtins<175>.
* ライブラリ: ライブラリ<177>.
* ドキュメント: ドキュメント<65>.
* ビルド: ビルド<70>.
* IDLE: IDLE<45>.
* C API: C API<64>.

Python 3.7.0 alpha 1

* セキュリティ: セキュリティ<48>.
* Core and Builtins: Core and Builtins<176>.
* ライブラリ: ライブラリ<178>.
* ドキュメント: ドキュメント<66>.
* テスト: テスト<67>.
* ビルド: ビルド<71>.
* Windows: Windows<63>.
* IDLE: IDLE<46>.
* Tools/Demos: Tools/Demos<41>.
* C API: C API<65>.

Python 3.6.6 release candidate 1

* Core and Builtins: Core and Builtins<177>.
* ライブラリ: ライブラリ<179>.
* ドキュメント: ドキュメント<67>.
* テスト: テスト<68>.
* ビルド: ビルド<72>.
* Windows: Windows<64>.
* macOS: macOS<50>.
* IDLE: IDLE<47>.
* Tools/Demos: Tools/Demos<42>.
* C API: C API<66>.

Python 3.6.5 final

* テスト: テスト<69>.
* ビルド: ビルド<73>.

Python 3.6.5 release candidate 1

* セキュリティ: セキュリティ<49>.
* Core and Builtins: Core and Builtins<178>.
* ライブラリ: ライブラリ<180>.
* ドキュメント: ドキュメント<68>.
* テスト: テスト<70>.
* ビルド: ビルド<74>.
* Windows: Windows<65>.
* macOS: macOS<51>.
* IDLE: IDLE<48>.
* Tools/Demos: Tools/Demos<43>.
* C API: C API<67>.

Python 3.6.4 release candidate 1

* Core and Builtins: Core and Builtins<179>.
* ライブラリ: ライブラリ<181>.
* ドキュメント: ドキュメント<69>.
* テスト: テスト<71>.
* ビルド: ビルド<75>.
* Windows: Windows<66>.
* macOS: macOS<52>.
* IDLE: IDLE<49>.
* Tools/Demos: Tools/Demos<44>.
* C API: C API<68>.

Python 3.6.3 final

* ライブラリ: ライブラリ<182>.
* ビルド: ビルド<76>.

Python 3.6.3 release candidate 1

* セキュリティ: セキュリティ<50>.
* Core and Builtins: Core and Builtins<180>.
* ライブラリ: ライブラリ<183>.
* ドキュメント: ドキュメント<70>.
* テスト: テスト<72>.
* ビルド: ビルド<77>.
* Windows: Windows<67>.
* IDLE: IDLE<50>.
* Tools/Demos: Tools/Demos<45>.

Python 3.6.2 release candidate 2

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

Python 3.6.2 release candidate 1

* セキュリティ: セキュリティ<52>.
* Core and Builtins: Core and Builtins<181>.
* ライブラリ: ライブラリ<184>.
* IDLE: IDLE<51>.
* C API: C API<69>.
* ビルド: ビルド<78>.
* ドキュメント: ドキュメント<71>.
* Tools/Demos: Tools/Demos<46>.
* テスト: テスト<73>.
* Windows: Windows<68>.

Python 3.6.1 final

* Core and Builtins: Core and Builtins<182>.
* ビルド: ビルド<79>.

Python 3.6.1 release candidate 1

* Core and Builtins: Core and Builtins<183>.
* ライブラリ: ライブラリ<185>.
* IDLE: IDLE<52>.
* Windows: Windows<69>.
* C API: C API<70>.
* ドキュメント: ドキュメント<72>.
* テスト: テスト<74>.
* ビルド: ビルド<80>.

Python 3.6.0 release candidate 2

* Core and Builtins: Core and Builtins<184>.
* Tools/Demos: Tools/Demos<47>.
* Windows: Windows<70>.
* ビルド: ビルド<81>.

Python 3.6.0 release candidate 1

* Core and Builtins: Core and Builtins<185>.
* ライブラリ: ライブラリ<186>.
* C API: C API<71>.
* ドキュメント: ドキュメント<73>.
* Tools/Demos: Tools/Demos<48>.

Python 3.6.0 beta 4

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

Python 3.6.0 beta 3

* Core and Builtins: Core and Builtins<187>.
* ライブラリ: ライブラリ<188>.
* Windows: Windows<71>.
* ビルド: ビルド<83>.
* テスト: テスト<76>.

Python 3.6.0 beta 2

* Core and Builtins: Core and Builtins<188>.
* ライブラリ: ライブラリ<189>.
* Windows: Windows<72>.
* C API: C API<72>.
* ビルド: ビルド<84>.
* テスト: テスト<77>.

Python 3.6.0 beta 1

* Core and Builtins: Core and Builtins<189>.
* ライブラリ: ライブラリ<190>.
* IDLE: IDLE<53>.
* C API: C API<73>.
* テスト: テスト<78>.
* ビルド: ビルド<85>.
* Tools/Demos: Tools/Demos<49>.
* Windows: Windows<73>.

Python 3.6.0 alpha 4

* Core and Builtins: Core and Builtins<190>.
* ライブラリ: ライブラリ<191>.
* IDLE: IDLE<54>.
* テスト: テスト<79>.
* Windows: Windows<74>.
* ビルド: ビルド<86>.

Python 3.6.0 alpha 3

* セキュリティ: セキュリティ<53>.
* Core and Builtins: Core and Builtins<191>.
* ライブラリ: ライブラリ<192>.
* IDLE: IDLE<55>.
* C API: C API<74>.
* ビルド: ビルド<87>.
* Tools/Demos: Tools/Demos<50>.
* ドキュメント: ドキュメント<75>.
* テスト: テスト<80>.

Python 3.6.0 alpha 2

* セキュリティ: セキュリティ<54>.
* Core and Builtins: Core and Builtins<192>.
* ライブラリ: ライブラリ<193>.
* IDLE: IDLE<56>.
* ドキュメント: ドキュメント<76>.
* テスト: テスト<81>.
* Windows: Windows<75>.
* ビルド: ビルド<88>.
* C API: C API<75>.
* Tools/Demos: Tools/Demos<51>.

Python 3.6.0 alpha 1

* セキュリティ: セキュリティ<55>.
* Core and Builtins: Core and Builtins<193>.
* ライブラリ: ライブラリ<194>.
* IDLE: IDLE<57>.
* ドキュメント: ドキュメント<77>.
* テスト: テスト<82>.
* ビルド: ビルド<89>.
* Windows: Windows<76>.
* Tools/Demos: Tools/Demos<52>.
* C API: C API<76>.

Python 3.5.5 release candidate 1

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

Python 3.5.4 final

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

Python 3.5.4 release candidate 1

* セキュリティ: セキュリティ<57>.
* Core and Builtins: Core and Builtins<195>.
* ライブラリ: ライブラリ<197>.
* ドキュメント: ドキュメント<78>.
* テスト: テスト<83>.
* ビルド: ビルド<90>.
* Windows: Windows<77>.
* C API: C API<77>.

Python 3.5.3 release candidate 1

* セキュリティ: セキュリティ<58>.
* Core and Builtins: Core and Builtins<196>.
* ライブラリ: ライブラリ<198>.
* IDLE: IDLE<58>.
* C API: C API<78>.
* ドキュメント: ドキュメント<79>.
* テスト: テスト<84>.
* Tools/Demos: Tools/Demos<53>.
* Windows: Windows<78>.
* ビルド: ビルド<91>.

Python 3.5.2 final

* Core and Builtins: Core and Builtins<197>.
* テスト: テスト<85>.
* IDLE: IDLE<59>.

Python 3.5.2 release candidate 1

* セキュリティ: セキュリティ<59>.
* Core and Builtins: Core and Builtins<198>.
* ライブラリ: ライブラリ<199>.
* IDLE: IDLE<60>.
* ドキュメント: ドキュメント<80>.
* テスト: テスト<86>.
* ビルド: ビルド<92>.
* Windows: Windows<79>.
* Tools/Demos: Tools/Demos<54>.

Python 3.5.1 final

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

Python 3.5.1 release candidate 1

* Core and Builtins: Core and Builtins<200>.
* ライブラリ: ライブラリ<200>.
* IDLE: IDLE<61>.
* ドキュメント: ドキュメント<81>.
* テスト: テスト<87>.
* ビルド: ビルド<93>.
* Windows: Windows<81>.
* Tools/Demos: Tools/Demos<55>.

Python 3.5.0 final

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

Python 3.5.0 release candidate 4

* ライブラリ: ライブラリ<201>.
* ビルド: ビルド<95>.

Python 3.5.0 release candidate 3

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

Python 3.5.0 release candidate 2

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

Python 3.5.0 release candidate 1

* Core and Builtins: Core and Builtins<203>.
* ライブラリ: ライブラリ<204>.
* IDLE: IDLE<62>.
* ドキュメント: ドキュメント<82>.
* テスト: テスト<88>.

Python 3.5.0 beta 4

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

Python 3.5.0 beta 3

* Core and Builtins: Core and Builtins<205>.
* ライブラリ: ライブラリ<206>.
* テスト: テスト<89>.
* ドキュメント: ドキュメント<83>.
* ビルド: ビルド<97>.

Python 3.5.0 beta 2

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

Python 3.5.0 beta 1

* Core and Builtins: Core and Builtins<207>.
* ライブラリ: ライブラリ<208>.
* IDLE: IDLE<63>.
* テスト: テスト<90>.
* ドキュメント: ドキュメント<84>.
* Tools/Demos: Tools/Demos<56>.

Python 3.5.0 alpha 4

* Core and Builtins: Core and Builtins<208>.
* ライブラリ: ライブラリ<209>.
* ビルド: ビルド<98>.
* テスト: テスト<91>.
* Tools/Demos: Tools/Demos<57>.
* C API: C API<79>.

Python 3.5.0 alpha 3

* Core and Builtins: Core and Builtins<209>.
* ライブラリ: ライブラリ<210>.
* ビルド: ビルド<99>.
* テスト: テスト<92>.
* Tools/Demos: Tools/Demos<58>.

Python 3.5.0 alpha 2

* Core and Builtins: Core and Builtins<210>.
* ライブラリ: ライブラリ<211>.
* ビルド: ビルド<100>.
* C API: C API<80>.
* Windows: Windows<82>.

Python 3.5.0 alpha 1

* Core and Builtins: Core and Builtins<211>.
* ライブラリ: ライブラリ<212>.
* IDLE: IDLE<64>.
* ビルド: ビルド<101>.
* C API: C API<81>.
* ドキュメント: ドキュメント<85>.
* テスト: テスト<93>.
* Tools/Demos: Tools/Demos<59>.
* Windows: Windows<83>.

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>.
* ネストしたリストの内包表記::
* Unpacking in Lists and List Comprehensions::

モジュール

* モジュールについてもうすこし::
* 標準モジュール::
* 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 form): 丸括弧形式 parenthesized form.
* リスト、集合、辞書の表示::
* リスト表示::
* 集合表示::
* 辞書表示::
* ジェネレータ式: ジェネレータ式<2>.
* Yield 式::

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

* Private name mangling::

リテラル

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

Yield 式

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

プライマリ

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

Subscriptions and slicings

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

比較

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

単純文 (simple statement)

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

代入文 (assignment statement)

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

import 文

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

Lazy imports

* Compatibility via __lazy_modules__::

複合文 (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 パターン::
* リテラルパターン::
* キャプチャパターン::
* ワイルドカードパターン::
* 値パターン::
* グループパターン::
* シーケンスパターン::
* マッピングパターン::
* クラスパターン::

クラス定義

* Multiple inheritance::

コルーチン

* コルーチン関数定義::
* 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 frozendict. dict, frozendict
* コンテキストマネージャ型::
* 型アノテーション型: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン. ジェネリックエイリアス 、 ユニオン
* その他の組み込み型::
* 特殊属性::
* 整数と文字列の変換での長さ制限::

数値型 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, frozendict

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

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

* ジェネリックエイリアス型::
* 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::
* モジュールの内容::
* Regular expression objects::
* Match objects::
* Regular expression examples::

モジュールの内容

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

Regular expression examples

* Checking for a pair::
* scanf() をシミュレートする: scanf をシミュレートする.
* search() vs. prefixmatch(): search vs prefixmatch.
* prefixmatch() vs. match(): prefixmatch 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>.

書式文字列

* バイトオーダ、サイズ、アラインメント::
* Type Codes::
* 使用例: 使用例<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 objects::
* 使用例: 使用例<6>.

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

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

enum -- 列挙型のサポート

* モジュールの内容: モジュールの内容<2>.
* データ型: データ型<2>.
* Utilities and decorators::
* 注釈::

データ型

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

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

* 例外: 例外<4>.

数値と数学モジュール

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

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

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

Notes for type implementers

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

math -- 数学関数

* Floating point arithmetic::
* Floating point manipulation functions::
* Power, exponential and logarithmic functions: Power exponential and logarithmic functions.
* Summation and product functions::
* 角度変換::
* 三角関数::
* 双曲線関数::
* 特殊関数::
* Number-theoretic 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>.
* 例外: 例外<7>.

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 オブジェクト::
* 例外: 例外<8>.
* 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

* 例外: 例外<9>.
* 圧縮ファイルへの読み書き::
* メモリ上での圧縮と展開::
* 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 オブジェクト::
* 例外: 例外<10>.

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::
* 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>.
* 構造化データ型::
* 配列とポインタ::
* 例外: 例外<11>.

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

* 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 メソッド.
* その他のユーティリティ::
* 例外: 例外<12>.

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::
* 例外: 例外<13>.

背景

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

チュートリアル

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

ヘルプの生成

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

リファレンスガイド

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

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

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

Extending optparse

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

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

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

curses.textpad -- Text input widget for curses programs

* Textbox オブジェクト::

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

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

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

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

並行実行

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

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

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

リファレンス

* 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::
* 例外: 例外<14>.
* 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 コンストラクター::
* 例外: 例外<15>.

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>.
* サブプロセス::
* キュー::
* 例外: 例外<17>.
* Call Graph Introspection::
* Event loop::
* Future::
* トランスポートとプロトコル::
* ポリシー::
* プラットフォームでのサポート::
* Extending::
* 高水準の API インデックス::
* 低水準の API インデックス::
* asyncio での開発::

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

ストリーム

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

使用例

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

同期プリミティブ

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

サブプロセス

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

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

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

キュー

* Queue::
* 優先度付きのキュー::
* LIFO キュー::
* 例外: 例外<16>.
* 使用例: 使用例<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<84>.
* macOS: macOS<53>.

Windows

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

Extending

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

高水準の API インデックス

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

低水準の 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::

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

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

モジュールの内容

* 例外: 例外<19>.
* 定数: 定数<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>.
* コンテキストの作成::
* Signature algorithms::
* 例外: 例外<20>.
* 乱数生成::
* 証明書の取り扱い::
* 定数: 定数<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 -- 非同期イベントにハンドラーを設定する

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

一般的なルール

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

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

* MADV_* 定数::
* MAP_* 定数::
* MS_* Constants::

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

* 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>.
* エンコーダとデコーダ::
* 例外: 例外<21>.
* 標準への準拠と互換性::
* コマンドライン・インターフェース: コマンドライン・インターフェース<5>.

標準への準拠と互換性

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

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

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

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

* Mailbox オブジェクト::
* Message オブジェクト::
* 例外: 例外<22>.
* 使用例: 使用例<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 オブジェクト::
* 例外: 例外<23>.

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

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

DOM 内のオブジェクト

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

適合性

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

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 ダイアログ::
* tkinter.messagebox: tkinter messagebox --- Tkinter メッセージプロンプト. Tkinter メッセージプロンプト
* tkinter.scrolledtext: tkinter scrolledtext --- スクロール可能なテキストウィジェット. スクロール可能なテキストウィジェット
* tkinter.dnd: tkinter dnd --- ドラッグアンドドロップのサポート. ドラッグアンドドロップのサポート
* tkinter.ttk: tkinter ttk --- Tk のテーマ付きウィジェット. Tk のテーマ付きウィジェット
* IDLE: IDLE --- Python のエディタとシェル<2>. Python のエディタとシェル
* turtle: turtle --- Turtle graphics. Turtle graphics

tkinter -- Tcl/Tk の Python インターフェース

* Architecture::
* Tkinter モジュール::
* Tkinter お助け手帳::
* Threading model::
* 簡単なリファレンス::
* ファイルハンドラ::

Tkinter お助け手帳

* A Hello World Program::
* Important Tk Concepts::
* Understanding How Tkinter Wraps Tcl/Tk::
* How do I...? What option does...?: How do I ? What option does ?.
* Navigating the Tcl/Tk Reference Manual::

簡単なリファレンス

* オプションの設定::
* Packer::
* Packer のオプション::
* ウィジェット変数を関連付ける::
* ウィンドウマネージャ::
* Tk オプションデータ型::
* バインドとイベント::
* index パラメータ::
* 画像::

Tkinter ダイアログ

* tkinter.simpledialog: tkinter simpledialog --- Standard Tkinter input dialogs. Standard Tkinter input dialogs
* tkinter.filedialog: tkinter filedialog --- File selection dialogs. File selection dialogs
* tkinter.commondialog: tkinter commondialog --- Dialog window templates. Dialog window templates

tkinter.filedialog -- File selection dialogs

* ネイティブの読み込み/保存ダイアログ::

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

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

ウィジェット

* 標準オプション::
* スクロール可能ウィジェットのオプション::
* ラベルオプション::
* 互換性オプション::
* ウィジェットの状態::
* ttk.Widget: ttk Widget.

コンボボックス

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

Spinbox

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

ノートブック

* オプション: オプション<3>.
* タブオプション::
* タブ識別子::
* 仮想イベント: 仮想イベント<3>.
* ttk.Notebook: ttk Notebook.

プログレスバー

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

セパレータ

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

サイズグリップ

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

ツリービュー

* オプション: オプション<6>.
* 要素オプション::
* タグオプション::
* カラム識別子::
* 仮想イベント: 仮想イベント<4>.
* ttk.Treeview: ttk Treeview.

Ttk スタイル

* レイアウト::

IDLE -- Python のエディタとシェル

* メニュー::
* Editing and Navigation::
* Startup and Code Execution::
* Help and Preferences::
* idlelib: idlelib --- implementation of IDLE application. implementation of IDLE application

メニュー

* File メニュー (Shell ウィンドウ、Editor ウィンドウ): File メニュー Shell ウィンドウ、Editor ウィンドウ.
* Edit メニュー (Shell ウィンドウ、Editor ウィンドウ): Edit メニュー Shell ウィンドウ、Editor ウィンドウ.
* Format メニュー (Shell ウィンドウ、Editor ウィンドウ): Format メニュー Shell ウィンドウ、Editor ウィンドウ.
* Run メニュー (Editor ウィンドウのみ): Run メニュー Editor ウィンドウのみ.
* Shell メニュー (Shell ウィンドウのみ): Shell メニュー Shell ウィンドウのみ.
* Debug メニュー (Shell ウィンドウのみ): Debug メニュー Shell ウィンドウのみ.
* Options メニュー (Shell ウィンドウ、Editor ウィンドウ): Options メニュー Shell ウィンドウ、Editor ウィンドウ.
* Window メニュー (Shell ウィンドウ、Editor ウィンドウ): Window メニュー Shell ウィンドウ、Editor ウィンドウ.
* Help メニュー (Shell ウィンドウ、Editor ウィンドウ): Help メニュー Shell ウィンドウ、Editor ウィンドウ.
* Context menus::

Editing and Navigation

* Editor windows::
* Key bindings::
* 自動的な字下げ::
* 検索と置換::
* 補完 (Completions): 補完 Completions.
* 呼び出しヒント (Calltips): 呼び出しヒント Calltips.
* Format block::
* Code Context::
* Shell window::
* テキストの色::

Startup and Code Execution

* コマンドラインでの使用: コマンドラインでの使用<5>.
* Startup failure::
* Running user code::
* User output in Shell::
* Developing tkinter applications::
* サブプロセスを起こさずに起動する::

Help and Preferences

* Help sources::
* Setting preferences [お好み設定]::
* IDLE on macOS::
* Extensions [拡張]::

turtle -- Turtle graphics

* はじめに: はじめに<12>.
* Get started::
* チュートリアル: チュートリアル<4>.
* How to...: How to.
* Turtle graphics reference::
* RawTurtle/Turtle のメソッドと対応する関数::
* TurtleScreen/Screen のメソッドと対応する関数::
* Public classes::
* 説明: 説明<2>.
* ヘルプと設定::
* turtledemo: turtledemo --- Demo scripts. Demo scripts
* python 2.6からの変更点: python 2 6からの変更点.
* python 3.0からの変更点: python 3 0からの変更点.

チュートリアル

* Starting a turtle environment::
* Basic drawing::
* Making algorithmic patterns::

Basic drawing

* Pen の制御::
* The turtle's position::

How to...

* Get started as quickly as possible::
* Automatically begin and end filling::
* Use the turtle module namespace::
* Use turtle graphics in a script::
* Use object-oriented turtle graphics::

Turtle graphics reference

* Turtle のメソッド::
* TurtleScreen/Screen のメソッド::

RawTurtle/Turtle のメソッドと対応する関数

* Turtle の動き::
* Turtle の状態を知る::
* 設定と計測::
* Pen の制御: Pen の制御<2>.
* タートルの状態::
* イベントを利用する::
* 特別な Turtle のメソッド::
* Compound shapes::

Pen の制御

* 描画状態::
* 色の制御: 色の制御<2>.
* 塗りつぶし::
* さらなる描画の制御::

タートルの状態

* 可視性::
* 見た目::

TurtleScreen/Screen のメソッドと対応する関数

* ウィンドウの制御::
* アニメーションの制御::
* スクリーンイベントを利用する::
* 入力メソッド::
* 設定と特殊なメソッド::
* Screen 独自のメソッド、TurtleScreen から継承したもの以外::

ヘルプと設定

* ヘルプの使い方::
* ドキュメント文字列の翻訳::
* Screen および Turtle の設定方法::

開発ツール

* typing: typing --- 型ヒントのサポート. 型ヒントのサポート
* 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 構造的部分型::
* モジュールの内容: モジュールの内容<5>.
* メジャーな機能の非推奨時系列::

モジュールの内容

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

特殊型付けプリミティブ

* 特殊型::
* 特殊形式::
* Building generic types and type aliases::
* Other special directives::

非推奨のエイリアス

* Aliases to built-in types::
* Aliases to types in collections::
* Aliases to other concrete types::
* Aliases to container ABCs in collections.abc: Aliases to container ABCs in collections abc.
* Aliases to asynchronous ABCs in collections.abc: Aliases to asynchronous ABCs in collections abc.
* Aliases to other ABCs in collections.abc: Aliases to other ABCs in collections abc.
* Aliases to contextlib ABCs::

Python 開発モード

* Python 開発モードの影響::
* ResourceWarning の例::
* Bad file descriptor error example::

doctest -- 対話型の Python の例をテストする

* 簡単な利用法; docstring 中の実行例をチェックする: 簡単な利用法 docstring 中の実行例をチェックする.
* 簡単な利用法; テキストファイル中の実行例をチェックする: 簡単な利用法 テキストファイル中の実行例をチェックする.
* コマンドラインでの使用: コマンドラインでの使用<6>.
* doctest のからくり::
* 基本 API::
* 単体テスト API::
* 拡張 API::
* デバッグ::
* アドバイス::

doctest のからくり

* どの docstring が検証されるのか?::
* docstring 内の実行例をどのように認識するのか?::
* 実行コンテキストとは何か?::
* 例外はどう扱えばよいか?::
* オプションフラグ::
* ディレクティブ (Directives): ディレクティブ Directives.
* 警告: 警告<2>.

拡張 API

* DocTest オブジェクト::
* Example オブジェクト::
* DocTestFinder オブジェクト::
* DocTestParser オブジェクト::
* TestResults objects::
* DocTestRunner オブジェクト::
* OutputChecker オブジェクト::

unittest -- ユニットテストフレームワーク

* 基本的な例: 基本的な例<2>.
* コマンドラインインターフェイス: コマンドラインインターフェイス<2>.
* テストディスカバリ::
* テストコードの構成::
* 既存テストコードの再利用::
* テストのスキップと予期された失敗::
* サブテストを利用して繰り返しテストの区別を付ける::
* クラスと関数::
* クラスとモジュールのフィクスチャ::
* シグナルハンドリング::

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

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

クラスと関数

* テストクラス::
* テストのグループ化::
* テストのロードと起動::

テストのロードと起動

* load_tests プロトコル::

クラスとモジュールのフィクスチャ

* setUpClass と tearDownClass::
* setUpModule と tearDownModule::

unittest.mock -- モックオブジェクトライブラリ

* クイックガイド::
* Mock クラス::
* patcher::
* MagicMock と magic method のサポート::
* ヘルパー::
* Order of precedence of side_effect, return_value and wraps: Order of precedence of side_effect return_value and wraps.

Mock クラス

* 呼び出し::
* 属性の削除::
* Mock の名前と name 属性::
* 属性として設定されるモック::

patcher

* patch::
* patch.object: patch object.
* patch.dict: patch dict.
* patch.multiple: patch multiple.
* patch のメソッド; start と stop: patch のメソッド start と stop.
* ビルトインをパッチする::
* TEST_PREFIX::
* patch デコレータをネストする::
* どこにパッチするか::
* デスクリプタやプロキシオブジェクトにパッチする::

MagicMock と magic method のサポート

* Magic Method をモックする::
* Magic Mock::

ヘルパー

* sentinel::
* DEFAULT::
* call::
* create_autospec::
* ANY::
* FILTER_DIR::
* mock_open::
* autospec を使う::
* Sealing mocks::

unittest.mock -- 入門

* Mock を使う::
* Patch 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
* profiling: profiling --- Python profilers. Python profilers
* pstats: pstats --- Statistics for profilers. Statistics for 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::

profiling -- Python profilers

* Introduction to profiling::
* Choosing a profiler::
* Quick start::
* Understanding profile output::
* Legacy compatibility::

Choosing a profiler

* When to use statistical sampling::
* When to use deterministic tracing::

Quick start

* Statistical profiling::
* Deterministic profiling::

Legacy compatibility

* profiling.tracing: profiling tracing --- Deterministic profiler. Deterministic profiler
* profiling.sampling: profiling sampling --- Statistical profiler. Statistical profiler

profiling.tracing -- Deterministic profiler

* What is deterministic profiling?::
* Command-line interface::
* Programmatic usage examples::
* Module reference::
* Using a custom timer::
* Limitations::

Programmatic usage examples

* Basic profiling::
* Using the Profile class::

profiling.sampling -- Statistical profiler

* What is statistical profiling?::
* Quick examples::
* Commands::
* Sampling configuration::
* Profiling modes::
* Output formats::
* Record and replay workflow::
* Live mode::
* Async-aware profiling::
* Command-line interface: Command-line interface<2>.

What is statistical profiling?

* How time is estimated::
* When to use a different approach::

Commands

* The run command::
* The attach command::
* The dump command::
* The replay command::
* Profiling in production::
* Platform requirements::
* Version compatibility::

Sampling configuration

* Sampling rate and duration::
* Thread selection::
* Blocking mode::
* Special frames::
* Opcode-aware profiling::
* Real-time statistics::
* Subprocess profiling::
* Sampling efficiency::

Profiling modes

* Wall-clock mode::
* CPU mode::
* Comparing wall-clock and CPU profiles::
* GIL mode::
* Exception mode::

Output formats

* pstats format::
* Collapsed stacks format::
* Flame graph format::
* Gecko format::
* Heatmap format::
* Binary format::

Flame graph format

* Differential flame graphs::

Live mode

* Keyboard commands::

Async-aware profiling

* Async modes::
* Task markers and stack reconstruction::
* Option restrictions::

Command-line interface

* Global options::
* Dump options::
* Sampling options::
* Mode options::
* Output options::
* pstats display options::
* Run command options::

pstats -- Statistics for profilers

* Reading and displaying profile data::
* The Stats class::
* Command-line interface: Command-line interface<3>.

Reading and displaying profile data

* Working with statistics::
* Filtering output::
* Analyzing call relationships::
* Combining multiple profiles::

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

* Basic examples::
* Python interface::
* コマンドライン・インターフェース: コマンドライン・インターフェース<9>.
* 使用例: 使用例<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 インストーラーのブートストラップ

* コマンドライン・インターフェース: コマンドライン・インターフェース<10>.
* モジュール 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 -- データクラス

* モジュールの内容: モジュールの内容<6>.
* 初期化後の処理::
* クラス変数::
* 初期化限定変数::
* 凍結されたインスタンス::
* 継承: 継承<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::
* コマンドライン・インターフェース: コマンドライン・インターフェース<11>.

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 -- サイト固有の設定フック

* Path extensions (.pth files): Path extensions pth files.
* Startup entry points (.start files): Startup entry points start files.
* Startup file examples::
* Migrating from import lines in .pth files to .start files: Migrating from import lines in pth files to start files.
* sitecustomize::
* usercustomize::
* readline の設定::
* モジュールの内容: モジュールの内容<7>.
* コマンドライン・インターフェース: コマンドライン・インターフェース<12>.

カスタム 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::
* コマンドラインでの使用: コマンドラインでの使用<9>.
* 使用例: 使用例<50>.

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

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

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

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

compileall -- Python ライブラリをバイトコンパイルする

* コマンドラインでの使用: コマンドラインでの使用<10>.
* パブリックな関数::

dis -- Python バイトコードの逆アセンブラー

* コマンドライン・インターフェース: コマンドライン・インターフェース<13>.
* バイトコード解析::
* 解析関数::
* Python バイトコード命令::
* 命令コードコレクション::

pickletools -- pickle 開発者用のツール群

* コマンドラインでの使用: コマンドラインでの使用<11>.
* Programmatic interface::

コマンドラインでの使用

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

MS Windows 固有のサービス

* msvcrt: msvcrt --- MS VC++ ランタイムの有用なルーチン群. MS VC++ ランタイムの有用なルーチン群
* winreg: winreg --- Windows レジストリへのアクセス. Windows レジストリへのアクセス
* winsound: winsound --- Windows 用の音声再生インターフェース. Windows 用の音声再生インターフェース

msvcrt -- MS VC++ ランタイムの有用なルーチン群

* ファイル操作関連::
* コンソール I/O 関連::
* その多の関数::

winreg -- Windows レジストリへのアクセス

* 関数: 関数<14>.
* 定数: 定数<11>.
* レジストリハンドルオブジェクト::

定数

* HKEY_* 定数::
* アクセス権限::
* 値の型::

アクセス権限

* 64-bit 特有のアクセス権::

winsound -- Windows 用の音声再生インターフェース

* 関数: 関数<15>.
* 定数: 定数<12>.

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
* profile: profile --- Pure Python profiler. Pure Python profiler

profile -- Pure Python profiler

* Migration::
* profile and profiling.tracing module reference: profile and profiling tracing module reference.
* Differences from profiling.tracing: Differences from profiling tracing.
* What is deterministic profiling?: What is deterministic profiling?<2>.
* 制限事項: 制限事項<2>.
* キャリブレーション (補正): キャリブレーション 補正.
* カスタムな時刻取得用関数を使う::

削除されたモジュール

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

* Your first C API extension module::
* Using the C API; Assorted topics: Using the C API Assorted topics.
* 拡張の型の定義; チュートリアル: 拡張の型の定義 チュートリアル.
* 拡張の型の定義; 雑多なトピック: 拡張の型の定義 雑多なトピック.
* C および C++ 拡張のビルド::
* Windows 上での C および C++ 拡張モジュールのビルド::
* 他のアプリケーションへの Python の埋め込み::
* おすすめのサードパーティツール::
* C API Tutorial::
* Guides for intermediate topics::
* 大規模なアプリケーションへの Python ランタイムの埋め込み::

Your first C API extension module

* What we'll do::
* Start with the headers::
* Running your build tool::
* Module export hook::
* The slot table::
* Exposing a function::
* Returning an integer::
* Accepting a string::
* The result::
* Appendix; Other build tools: Appendix Other build tools.

Exposing a function

* Method definitions::

Appendix: Other build tools

* Workaround for missing PyInit function::
* Compiling directly::

Compiling directly

* Linux: Linux<2>.

Using the C API: Assorted topics

* エラーと例外: エラーと例外<2>.
* Embedding an extension::
* C から Python 関数を呼び出す::
* 拡張モジュール関数でのパラメタ展開::
* 拡張モジュール関数のキーワードパラメタ::
* 任意の値を構築する::
* 参照カウント法::
* C++での拡張モジュール作成::
* 拡張モジュールに C API を提供する::

参照カウント法

* Python における参照カウント法::
* 所有権にまつわる規則::
* 薄氷::
* NULL ポインタ::

拡張の型の定義: チュートリアル

* 基本的なこと::
* 基本のサンプルにデータとメソッドを追加する::
* データ属性をこまかく制御する::
* 循環ガベージコレクションをサポートする::
* 他の型のサブクラスを作る::

拡張の型の定義: 雑多なトピック

* ファイナライズとメモリ解放::
* オブジェクト表現::
* 属性を管理する::
* オブジェクトの比較::
* 抽象的なプロトコルのサポート::
* 弱参照(Weak Reference)のサポート: 弱参照 Weak Reference のサポート.
* その他いろいろ::

属性を管理する

* 総称的な属性を管理する::
* 特定の型に特化した属性の管理::

C および C++ 拡張のビルド

* setuptools による C および C++ 拡張のビルド::

Windows 上での C および C++ 拡張モジュールのビルド

* 型どおりのアプローチ::
* Unix と Windows の相違点::
* DLL 使用の実際::

他のアプリケーションへの Python の埋め込み

* 高水準の埋め込み::
* 超高水準の埋め込みから踏み出す; 概要: 超高水準の埋め込みから踏み出す 概要.
* 純粋な埋め込み::
* 埋め込まれた Python の拡張::
* C++による Python の埋め込み::
* Unix 系システムにおけるコンパイルとリンク::

Python/C API reference manual

* はじめに: はじめに<14>.
* C API and ABI Stability::
* 超高水準レイヤ::
* 参照カウント::
* 例外処理::
* 拡張モジュールの定義::
* Definition slots::
* ユーティリティ: ユーティリティ<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::

はじめに

* 言語バージョン互換性::
* コーディング基準::
* インクルードファイル::
* 便利なマクロ::
* オブジェクト、型および参照カウント::
* 例外: 例外<25>.
* Python の埋め込み: Python の埋め込み<2>.
* デバッグ版ビルド (Debugging Builds): デバッグ版ビルド Debugging Builds.
* おすすめのサードパーティツール: おすすめのサードパーティツール<2>.

インクルードファイル

* System includes::

便利なマクロ

* 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 and ABI Stability

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

Stable Application Binary Interfaces

* Compiling for Stable ABI::
* Stable ABI Scope and Performance::
* Stable ABI 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::

拡張モジュールの定義

* Extension export hook::
* 多段階初期化::
* 複数のモジュールインスタンス::
* PyInit function::

PyInit function

* 従来の一段階初期化::

Definition slots

* Convenience macros::
* Common slot IDs::

ユーティリティ

* オペレーティングシステム関連のユーティリティ::
* システム関数::
* プロセス制御::
* モジュールのインポート: モジュールのインポート<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::
* Soft-deprecated API::

Creating Heap-Allocated Types

* Type slot IDs::

数値型オブジェクト (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 構造体としての複素数::

シーケンスオブジェクト (sequence object)

* バイトオブジェクト: バイトオブジェクト<2>.
* PyBytesWriter::
* bytearray オブジェクト: bytearray オブジェクト<2>.
* Unicode オブジェクトと codec::
* タプルオブジェクト (tuple object): タプルオブジェクト tuple object.
* Struct Sequence オブジェクト::
* リストオブジェクト::

PyBytesWriter

* Create, Finish, Discard: Create Finish Discard.
* 高レベルAPI::
* Getters::
* 低レベルAPI::

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

* 辞書ビューオブジェクト: 辞書ビューオブジェクト<2>.
* Frozen dictionary 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.
* イテレータオブジェクト (iterator object): イテレータオブジェクト iterator object.
* デスクリプタオブジェクト (descriptor object): デスクリプタオブジェクト descriptor object.
* スライスオブジェクト (slice object): スライスオブジェクト slice object.
* memoryview オブジェクト::
* Pickle buffer objects::
* 弱参照オブジェクト: 弱参照オブジェクト<2>.
* カプセル: カプセル<2>.
* Sentinel objects::
* フレーム (frame) オブジェクト: フレーム frame オブジェクト<2>.
* ジェネレータオブジェクト::
* コルーチンオブジェクト: コルーチンオブジェクト<2>.
* コンテキスト変数オブジェクト::
* 型ヒントのためのオブジェクト::

File objects

* Soft-deprecated API: Soft-deprecated API<2>.

モジュールオブジェクト (module object)

* Module definition::
* Module state::
* Creating extension modules dynamically::
* Module definition struct::
* サポート関数::

Module definition

* Metadata slots::
* Feature slots::
* Creation and initialization slots::

Module state

* Slots for defining module state::
* Module token::

サポート関数

* 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 interpreter finalization::
* Interpreter views::
* プロセスワイドのパラメータ::

Thread states and the global interpreter lock

* Detaching the thread state from extension code::
* Using the C API from foreign threads::
* GIL-state APIs::
* Cautions about fork(): Cautions about fork.
* 高水準 API::
* 低水準 API::

Detaching the thread state from extension code

* APIs::

Using the C API from foreign threads

* Attaching/detaching thread states::

同期プリミティブ

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

Python critical section API

* Low-level critical section API::

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.
* Multi-Phase Initialization Private Provisional API::

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::
* 関数: 関数<16>.

共通のオブジェクト構造体 (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.

循環参照ガベージコレクションをサポートする

* Traversal::
* Controlling the Garbage Collector State::
* Querying Garbage Collector State::

Traversal

* Traversal-safe functions::
* "DuringGC" functions::

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 perf map compatible profilers::
* アノテーションのベストプラクティス::
* 拡張モジュールを分離する::
* 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: Event loop<2>.
* Asynchronous functions and coroutines::
* Task: Task<2>.
* await::

await

* Awaiting tasks::
* Awaiting coroutines::

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::
* 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::
* prefixmatch() (aka match) versus search(): prefixmatch aka 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 perf map compatible profilers

* Using the samply 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::

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::
* Per-Object Locks (ob_mutex): Per-Object Locks ob_mutex.

Building Extensions for the Free-Threaded Build

* Limited C API and Stable ABI::
* Windows: Windows<85>.

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 を起こさずに整数リテラルの属性を得られますか？::
* 文字列を数に変換するにはどうしたらいいですか？::
* 数を文字列に変換するにはどうしたらいいですか？::
* 文字列をインプレースに変更するにはどうしたらいいですか？::
* 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？::
* Is there an equivalent to Perl's chomp() for removing trailing newlines from strings?: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?.
* Is there a scanf() or sscanf() equivalent?: Is there a scanf or sscanf equivalent?.
* What does UnicodeDecodeError or UnicodeEncodeError error mean?::
* raw string を奇数個のバックスラッシュで終えることはできますか？::

性能

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

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<8>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<5>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<6>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<5>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<5>.
* Pending removal in Python 3.21: Pending removal in Python 3 21.
* Pending removal in future versions: Pending removal in future versions<8>.
* Soft deprecations: Soft deprecations<2>.
* C API deprecations::

C API deprecations

* Pending removal in Python 3.15: Pending removal in Python 3 15<8>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<9>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<7>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<6>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<6>.
* Pending removal in future versions: Pending removal in future versions<9>.

このドキュメントについて

* 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<5>.
* cfuhash::
* libmpdec::
* W3C C14N test suite::
* mimalloc::
* asyncio: asyncio<17>.
* Global Unbounded Sequences (GUS): Global Unbounded Sequences GUS.
* Zstandard bindings::
* Profiling module::
* Pixi packages::



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.16: What's new in Python 3 16.
* What's new in Python 3.15: What's new in Python 3 15.
* 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 16,  Next: What's new in Python 3 15,  Up: What's New in Python

1.1 What's new in Python 3.16
=============================


Editor: TBD

This article explains the new features in Python 3.16, compared to 3.15.

For full details, see the *note changelog: 145.

     注釈: Prerelease users should be aware that this document is
     currently in draft form.  It will be updated substantially as
     Python 3.16 moves towards release, so it's worth checking back even
     after reading earlier versions.

* Menu:

* Summary: Summary --- release highlights. release highlights
* New features::
* Other language changes::
* New modules::
* Improved modules::
* Optimizations::
* Removed::
* Deprecated::
* Porting to Python 3.16: Porting to Python 3 16.
* Build changes::
* C API changes::


File: python.info,  Node: Summary --- release highlights,  Next: New features,  Up: What's new in Python 3 16

1.1.1 Summary -- release highlights
-----------------------------------


File: python.info,  Node: New features,  Next: Other language changes,  Prev: Summary --- release highlights,  Up: What's new in Python 3 16

1.1.2 New features
------------------


File: python.info,  Node: Other language changes,  Next: New modules,  Prev: New features,  Up: What's new in Python 3 16

1.1.3 Other language changes
----------------------------


File: python.info,  Node: New modules,  Next: Improved modules,  Prev: Other language changes,  Up: What's new in Python 3 16

1.1.4 New modules
-----------------

   * None yet.


File: python.info,  Node: Improved modules,  Next: Optimizations,  Prev: New modules,  Up: What's new in Python 3 16

1.1.5 Improved modules
----------------------

* Menu:

* os::


File: python.info,  Node: os,  Up: Improved modules

1.1.5.1 os
..........

   * Add *note os.pidfd_getfd(): 14c. for duplicating a file descriptor
     from another process via a pidfd.  Available on Linux 5.6+.
     (Contributed by Maurycy Pawłowski-Wieroński in gh-149464(1).)

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

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


File: python.info,  Node: Optimizations,  Next: Removed,  Prev: Improved modules,  Up: What's new in Python 3 16

1.1.6 Optimizations
-------------------

* Menu:

* module_name::


File: python.info,  Node: module_name,  Up: Optimizations

1.1.6.1 module_name
...................

   * TODO


File: python.info,  Node: Removed,  Next: Deprecated,  Prev: Optimizations,  Up: What's new in Python 3 16

1.1.7 Removed
-------------

* Menu:

* annotationlib::
* asyncio::
* functools::
* logging::
* mimetypes::
* shutil::
* symtable::
* sys::
* sysconfig::
* tarfile::


File: python.info,  Node: annotationlib,  Next: asyncio,  Up: Removed

1.1.7.1 annotationlib
.....................

   * The ‘annotationlib.ForwardRef._evaluate()’ method which has been
     deprecated since Python 3.14.  Use *note
     annotationlib.ForwardRef.evaluate(): 151. or *note
     typing.evaluate_forward_ref(): 152. instead.


File: python.info,  Node: asyncio,  Next: functools,  Prev: annotationlib,  Up: Removed

1.1.7.2 asyncio
...............

   * The ‘asyncio.iscoroutinefunction()’ which has been deprecated since
     Python 3.14.  Use *note inspect.iscoroutinefunction(): 154.
     instead.


File: python.info,  Node: functools,  Next: logging,  Prev: asyncio,  Up: Removed

1.1.7.3 functools
.................

   * Calling the Python implementation of *note functools.reduce(): 156.
     with 'function' or 'sequence' as keyword arguments has been
     deprecated since Python 3.14.


File: python.info,  Node: logging,  Next: mimetypes,  Prev: functools,  Up: Removed

1.1.7.4 logging
...............

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


File: python.info,  Node: mimetypes,  Next: shutil,  Prev: logging,  Up: Removed

1.1.7.5 mimetypes
.................

   * Valid extensions start with a '.'  or are empty for *note
     mimetypes.MimeTypes.add_type(): 159.  Undotted extensions now raise
     a *note ValueError: 15a.


File: python.info,  Node: shutil,  Next: symtable,  Prev: mimetypes,  Up: Removed

1.1.7.6 shutil
..............

   * The ‘ExecError’ exception which has been deprecated since Python
     3.14.  It has not been used by any function in ‘shutil’ since
     Python 3.4.  (Contributed by Stan Ulbrych in gh-149567(1).)

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

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


File: python.info,  Node: symtable,  Next: sys,  Prev: shutil,  Up: Removed

1.1.7.7 symtable
................

   * The ‘symtable.Class.get_methods()’ method which has been deprecated
     since Python 3.14.


File: python.info,  Node: sys,  Next: sysconfig,  Prev: symtable,  Up: Removed

1.1.7.8 sys
...........

   * The ‘_enablelegacywindowsfsencoding()’ function which has been
     deprecated since Python 3.13.  Use the *note
     PYTHONLEGACYWINDOWSFSENCODING: 15e. environment variable instead.
     (Contributed by Stan Ulbrych in gh-149595(1).)

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

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


File: python.info,  Node: sysconfig,  Next: tarfile,  Prev: sys,  Up: Removed

1.1.7.9 sysconfig
.................

   * The ‘sysconfig.expand_makefile_vars()’ function which has been
     deprecated since Python 3.14.  Use the ‘vars’ argument of *note
     sysconfig.get_paths(): 160. instead.  (Contributed by Stan Ulbrych
     in gh-149499(1).)

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

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


File: python.info,  Node: tarfile,  Prev: sysconfig,  Up: Removed

1.1.7.10 tarfile
................

   * The undocumented and unused ‘tarfile.TarFile.tarfile’ attribute has
     been deprecated since Python 3.13.


File: python.info,  Node: Deprecated,  Next: Porting to Python 3 16,  Prev: Removed,  Up: What's new in Python 3 16

1.1.8 Deprecated
----------------

   * *note ast: 9.:

        * Classes ‘slice’, ‘Index’, ‘ExtSlice’, ‘Suite’, ‘Param’,
          ‘AugLoad’ and ‘AugStore’, deprecated since Python 3.9, are no
          longer imported by ‘from ast import *’ and issue a deprecation
          warning on use.  The classes are slated for removal in Python
          3.21.  These types are not generated by the parser or accepted
          by the code generator.

        * The ‘dims’ property of ‘ast.Tuple’ objects, deprecated since
          Python 3.9, now issues a deprecation warning on use.  This
          property is slated for removal in 3.21.  Use ‘ast.Tuple.elts’
          instead.


File: python.info,  Node: Porting to Python 3 16,  Next: Build changes,  Prev: Deprecated,  Up: What's new in Python 3 16

1.1.9 Porting to Python 3.16
----------------------------

This section lists previously described changes and other bugfixes that
may require changes to your code.


File: python.info,  Node: Build changes,  Next: C API changes,  Prev: Porting to Python 3 16,  Up: What's new in Python 3 16

1.1.10 Build changes
--------------------

   * Remove the bundled copy of the libmpdec(1) decimal library from the
     CPython source tree to simplify maintenence and updates.  The *note
     decimal: 39. module will now unconditionally use the system's
     libmpdec decimal library.  Also remove the now unused
     ‘--with-system-libmpdec’ ‘configure’ flag.  This change has no
     impact on binary releases of Python, which have been built against
     a separate copy of libmpdec for the past several releases.

     (Contributed by Sergey B Kirpichev in gh-115119(2).)

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

   (1) https://www.bytereef.org/mpdecimal/

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


File: python.info,  Node: C API changes,  Prev: Build changes,  Up: What's new in Python 3 16

1.1.11 C API changes
--------------------

* Menu:

* New features: New features<2>.
* Porting to Python 3.16: Porting to Python 3 16<2>.
* Deprecated C APIs::
* Removed C APIs::


File: python.info,  Node: New features<2>,  Next: Porting to Python 3 16<2>,  Up: C API changes

1.1.11.1 New features
.....................

   * TODO


File: python.info,  Node: Porting to Python 3 16<2>,  Next: Deprecated C APIs,  Prev: New features<2>,  Up: C API changes

1.1.11.2 Porting to Python 3.16
...............................

   * TODO


File: python.info,  Node: Deprecated C APIs,  Next: Removed C APIs,  Prev: Porting to Python 3 16<2>,  Up: C API changes

1.1.11.3 Deprecated C APIs
..........................

   * TODO


File: python.info,  Node: Removed C APIs,  Prev: Deprecated C APIs,  Up: C API changes

1.1.11.4 Removed C APIs
.......................


File: python.info,  Node: What's new in Python 3 15,  Next: What's new in Python 3 14,  Prev: What's new in Python 3 16,  Up: What's New in Python

1.2 What's new in Python 3.15
=============================


Editor: Hugo van Kemenade

This article explains the new features in Python 3.15, compared to 3.14.

For full details, see the *note changelog: 145.

     注釈: Prerelease users should be aware that this document is
     currently in draft form.  It will be updated substantially as
     Python 3.15 moves towards release, so it's worth checking back even
     after reading earlier versions.

* Menu:

* Summary: Summary -- Release highlights. Release highlights
* New features: New features<3>.
* Other language changes: Other language changes<2>.
* Default interactive shell::
* New modules: New modules<2>.
* Improved modules: Improved modules<2>.
* Optimizations: Optimizations<2>.
* Removed: Removed<2>.
* Deprecated: Deprecated<2>.
* C API changes: C API changes<2>.
* Build changes: Build changes<2>.
* Porting to Python 3.15: Porting to Python 3 15.


File: python.info,  Node: Summary -- Release highlights,  Next: New features<3>,  Up: What's new in Python 3 15

1.2.1 Summary - Release highlights
----------------------------------

   * PEP 810(1): *note Explicit lazy imports for faster startup times:
     16e.

   * PEP 814(2): *note Add frozendict built-in type: 16f.

   * PEP 661(3): *note Add sentinel built-in type: 170.

   * PEP 799(4): *note A dedicated profiling package for organizing
     Python profiling tools: 171.

   * PEP 799(5): *note Tachyon; High frequency statistical sampling
     profiler: 172.

   * PEP 831(6): *note Frame pointers are enabled by default for
     improved system-level observability: 173.

   * PEP 798(7): *note Unpacking in comprehensions: 174.

   * PEP 686(8): *note Python now uses UTF-8 as the default encoding:
     175.

   * PEP 829(9): *note Package startup configuration files: 176.

   * PEP 728(10): *note TypedDict with typed extra items: 177.

   * PEP 747(11): *note Annotating type forms with TypeForm: 178.

   * PEP 800(12): Disjoint bases in the type system

   * PEP 782(13): *note A new PyBytesWriter C API to create a Python
     bytes object: 179.

   * PEP 803(14), 820(15), 793(16): *note Stable ABI for free-threaded
     builds: 17a. and related C API

   * PEP 788(17): *note Protection against finalization in the C API:
     17b.

   * *note The JIT compiler has been significantly upgraded: 17c.

   * *note The official Windows 64-bit binaries now use the tail-calling
     interpreter: 17d.

   * *note Improved error messages: 17e.

   * *note More color: 17f.

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

   (1) https://peps.python.org/pep-0810/

   (2) https://peps.python.org/pep-0814/

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

   (4) https://peps.python.org/pep-0799/

   (5) https://peps.python.org/pep-0799/

   (6) https://peps.python.org/pep-0831/

   (7) https://peps.python.org/pep-0798/

   (8) https://peps.python.org/pep-0686/

   (9) https://peps.python.org/pep-0829/

   (10) https://peps.python.org/pep-0728/

   (11) https://peps.python.org/pep-0747/

   (12) https://peps.python.org/pep-0800/

   (13) https://peps.python.org/pep-0782/

   (14) https://peps.python.org/pep-0803/

   (15) https://peps.python.org/pep-0820/

   (16) https://peps.python.org/pep-0793/

   (17) https://peps.python.org/pep-0788/


File: python.info,  Node: New features<3>,  Next: Other language changes<2>,  Prev: Summary -- Release highlights,  Up: What's new in Python 3 15

1.2.2 New features
------------------

* Menu:

* PEP 810; Explicit lazy imports: PEP 810 Explicit lazy imports.
* PEP 814; Add frozendict built-in type: PEP 814 Add frozendict built-in type.
* PEP 661; Add sentinel built-in type: PEP 661 Add sentinel built-in type.
* PEP 799; A dedicated profiling package: PEP 799 A dedicated profiling package.
* Tachyon; High frequency statistical sampling profiler: Tachyon High frequency statistical sampling profiler.
* PEP 831; Frame pointers enabled by default: PEP 831 Frame pointers enabled by default.
* PEP 798; Unpacking in comprehensions: PEP 798 Unpacking in comprehensions.
* PEP 829; Package startup configuration files: PEP 829 Package startup configuration files.
* PEP 803: PEP 803 -- Stable ABI for free-threaded builds. Stable ABI for free-threaded builds
* PEP 788; Protecting the C API from interpreter finalization: PEP 788 Protecting the C API from interpreter finalization.
* Improved error messages::


File: python.info,  Node: PEP 810 Explicit lazy imports,  Next: PEP 814 Add frozendict built-in type,  Up: New features<3>

'PEP 810': Explicit lazy imports

Large Python applications often suffer from slow startup times.  A
significant contributor to this problem is the import system: when a
module is imported, Python must locate the file, read it from disk,
compile it to bytecode, and execute all top-level code.  For
applications with deep dependency trees, this process can take seconds,
even when most of the imported code is never actually used during a
particular run.

Developers have worked around this by moving imports inside functions,
using *note importlib: 7a. to load modules on demand, or restructuring
code to avoid unnecessary dependencies.  These approaches work but make
code harder to read and maintain, scatter import statements throughout
the codebase, and require discipline to apply consistently.

Python now provides a cleaner solution through explicit *note lazy: 182.
imports using the new ‘lazy’ soft keyword.  When you mark an import as
lazy, Python defers the actual module loading until the imported name is
first used.  This gives you the organizational benefits of declaring all
imports at the top of the file while only paying the loading cost for
modules you actually use.

The ‘lazy’ keyword works with both ‘import’ and ‘from ... import’
statements.  When you write ‘lazy import heavy_module’, Python does not
immediately load the module.  Instead, it creates a lightweight proxy
object.  The actual module loading happens transparently when you first
access the name:

     lazy import json
     lazy from pathlib import Path

     print("Starting up...")  # json and pathlib not loaded yet

     data = json.loads('{"key": "value"}')  # json loads here
     p = Path(".")  # pathlib loads here

This mechanism is particularly useful for applications that import many
modules at the top level but may only use a subset of them in any given
run.  The deferred loading reduces startup latency without requiring
code restructuring or conditional imports scattered throughout the
codebase.

In the case where loading a lazily imported module fails (for example,
if the module does not exist), Python raises the exception at the point
of first use rather than at import time.  The associated traceback
includes both the location where the name was accessed and the original
import statement, making it straightforward to diagnose and debug the
failure.

For cases where you want to enable lazy loading globally without
modifying source code, Python provides the *note -X lazy_imports: 183.
command-line option and the *note PYTHON_LAZY_IMPORTS: 184. environment
variable.  Both accept three values: ‘all’ makes all imports lazy by
default, ‘none’ disables lazy imports entirely (even explicit ‘lazy’
statements become eager), and ‘normal’ (the default) respects the ‘lazy’
keyword in source code.  The *note sys.set_lazy_imports(): 185. and
*note sys.get_lazy_imports(): 186. functions allow changing and querying
this mode at runtime.

For more selective control, *note sys.set_lazy_imports_filter(): 187.
accepts a callable that determines whether a specific module should be
loaded lazily.  The filter receives three arguments: the importing
module's name (or ‘None’), the imported module's name, and the fromlist
(or ‘None’ for regular imports).  It should return ‘True’ to allow the
import to be lazy, or ‘False’ to force eager loading.  This allows
patterns like making only your own application's modules lazy while
keeping third-party dependencies eager:

     import sys

     def myapp_filter(importing, imported, fromlist):
         return imported.startswith("myapp.")
     sys.set_lazy_imports_filter(myapp_filter)
     sys.set_lazy_imports("all")

     import myapp.slow_module  # lazy (matches filter)
     import json               # eager (does not match filter)

The proxy type itself is available as *note types.LazyImportType: 188.
for code that needs to detect lazy imports programmatically.

There are some restrictions on where the ‘lazy’ keyword can be used.
Lazy imports are only permitted at module scope; using ‘lazy’ inside a
function, class body, or ‘try’/‘except’/‘finally’ block raises a *note
SyntaxError: 189.  Neither star imports nor future imports can be lazy
(‘lazy from module import *’ and ‘lazy from __future__ import ...’ both
raise ‘SyntaxError’).

For code that cannot use the ‘lazy’ keyword directly (for example, when
supporting Python versions older than 3.15 while still using lazy
imports on 3.15+), a module can define *note __lazy_modules__: 18a. as a
container of fully qualified module name strings.  Regular ‘import’
statements for those modules are then treated as lazy, with the same
semantics as the ‘lazy’ keyword:

     __lazy_modules__ = ["json", "pathlib"]

     import json     # lazy
     import os       # still eager

参考
....

PEP 810(1) for the full specification and rationale.

(Contributed by Pablo Galindo Salgado and Dino Viehland in
gh-142349(2).)

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

   (1) https://peps.python.org/pep-0810/

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


File: python.info,  Node: PEP 814 Add frozendict built-in type,  Next: PEP 661 Add sentinel built-in type,  Prev: PEP 810 Explicit lazy imports,  Up: New features<3>

'PEP 814': Add frozendict built-in type

A new *note immutable: 18c. type, *note frozendict: 18d, is added to the
*note builtins: 13. module.  It does not allow modification after
creation.  A ‘frozendict’ is not a subclass of ‘dict’; it inherits
directly from ‘object’.  A ‘frozendict’ is *note hashable: 18e. as long
as all of its keys and values are hashable.  A ‘frozendict’ preserves
insertion order, but comparison does not take order into account.

For example:

     >>> a = frozendict(x=1, y=2)
     >>> a
     frozendict({'x': 1, 'y': 2})
     >>> a['z'] = 3
     Traceback (most recent call last):
       File "<python-input-2>", line 1, in <module>
         a['z'] = 3
         ~^^^^^
     TypeError: 'frozendict' object does not support item assignment
     >>> b = frozendict(y=2, x=1)
     >>> hash(a) == hash(b)
     True
     >>> a == b
     True

The following standard library modules have been updated to accept
‘frozendict’: *note copy: 29, *note decimal: 39, *note json: 85, *note
marshal: 90, *note plistlib: b0. (only for serialization), *note pickle:
ab, *note pprint: b3. and *note xml.etree.ElementTree: 12e.

*note eval(): 18f. and *note exec(): 190. accept ‘frozendict’ for
'globals', and *note type(): 191. and *note str.maketrans(): 192. accept
‘frozendict’ for 'dict'.

Code checking for *note dict: 193. type using ‘isinstance(arg, dict)’
can be updated to ‘isinstance(arg, (dict, frozendict))’ to accept also
the ‘frozendict’ type, or to ‘isinstance(arg, collections.abc.Mapping)’
to accept also other mapping types such as *note MappingProxyType: 194.

参考
....

PEP 814(1) for the full specification and rationale.

(Contributed by Victor Stinner and Donghee Na in gh-141510(2).)

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

   (1) https://peps.python.org/pep-0814/

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


File: python.info,  Node: PEP 661 Add sentinel built-in type,  Next: PEP 799 A dedicated profiling package,  Prev: PEP 814 Add frozendict built-in type,  Up: New features<3>

'PEP 661': Add sentinel built-in type

A new *note sentinel: 196. type is added to the *note builtins: 13.
module for creating unique sentinel values with a concise
representation.  Sentinel objects preserve identity when copied, support
use in type expressions with the ‘|’ operator, and can be pickled when
they are importable by module and name.

(PEP by Tal Einat; contributed by Jelle Zijlstra in gh-148829(1).)

参考
....

PEP 661(2) for further details.

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

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

   (2) https://peps.python.org/pep-0661/


File: python.info,  Node: PEP 799 A dedicated profiling package,  Next: Tachyon High frequency statistical sampling profiler,  Prev: PEP 661 Add sentinel built-in type,  Up: New features<3>

'PEP 799': A dedicated profiling package

A new *note profiling: b5. module has been added to organize Python's
built-in profiling tools under a single, coherent namespace.  This
module contains:

   * *note profiling.tracing: b7.: deterministic function-call tracing
     (relocated from ‘cProfile’).

   * *note profiling.sampling: b6.: a new statistical sampling profiler
     (named Tachyon).

The ‘cProfile’ module remains as an alias for backwards compatibility.
The *note profile: b4. module is deprecated and will be removed in
Python 3.17.

参考
....

PEP 799(1) for further details.

(Contributed by Pablo Galindo and László Kiss Kollár in gh-138122(2).)

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

   (1) https://peps.python.org/pep-0799/

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


File: python.info,  Node: Tachyon High frequency statistical sampling profiler,  Next: PEP 831 Frame pointers enabled by default,  Prev: PEP 799 A dedicated profiling package,  Up: New features<3>

1.2.2.5 Tachyon: High frequency statistical sampling profiler
.............................................................

[image src="python-figures/tachyon-logo.png" alt="Tachyon profiler logo"]


A new statistical sampling profiler (Tachyon) has been added as *note
profiling.sampling: b6.  This profiler enables low-overhead performance
analysis of running Python processes without requiring code modification
or process restart.

Unlike deterministic profilers (such as *note profiling.tracing: b7.)
that instrument every function call, the sampling profiler periodically
captures stack traces from running processes.  This approach provides
virtually zero overhead while achieving sampling rates of 'up to
1,000,000 Hz', making it the fastest sampling profiler available for
Python (at the time of its contribution) and ideal for debugging
performance issues in production environments.  This capability is
particularly valuable for debugging performance issues in production
systems where traditional profiling approaches would be too intrusive.

Key features include:

   * 'Zero-overhead profiling': Attach to any running Python process
     without affecting its performance.  Ideal for production debugging
     where you can't afford to restart or slow down your application.

   * 'No code modification required': Profile existing applications
     without restart.  Simply point the profiler at a running process by
     PID and start collecting data.

   * 'Flexible target modes':

        * Profile running processes by PID (‘attach’) - attach to
          already-running applications

        * Run and profile scripts directly (‘run’) - profile from the
          very start of execution

        * Execute and profile modules (‘run -m’) - profile packages run
          as ‘python -m module’

        * Capture a one-shot snapshot of a running process (‘dump’) -
          print a traceback-style stack of every thread (or all asyncio
          tasks with ‘--async-aware’).  Useful for investigating hung
          processes.

   * 'Multiple profiling modes': Choose what to measure based on your
     performance investigation:

        * 'Wall-clock time' (‘--mode wall’, default): Measures real
          elapsed time including I/O, network waits, and blocking
          operations.  Use this to understand where your program spends
          calendar time, including when waiting for external resources.

        * 'CPU time' (‘--mode cpu’): Measures only active CPU execution
          time, excluding I/O waits and blocking.  Use this to identify
          CPU-bound bottlenecks and optimize computational work.

        * 'GIL-holding time' (‘--mode gil’): Measures time spent holding
          Python's Global Interpreter Lock.  Use this to identify which
          threads dominate GIL usage in multi-threaded applications.

        * 'Exception handling time' (‘--mode exception’): Captures
          samples only from threads with an active exception.  Use this
          to analyze exception handling overhead.

   * 'Thread-aware profiling': Option to profile all threads (‘-a’) or
     just the main thread, essential for understanding multi-threaded
     application behavior.

   * 'Multiple output formats': Choose the visualization that best fits
     your workflow:

        * ‘--pstats’: Detailed tabular statistics compatible with *note
          pstats: b8.  Shows function-level timing with direct and
          cumulative samples.  Best for detailed analysis and
          integration with existing Python profiling tools.

        * ‘--collapsed’: Generates collapsed stack traces (one line per
          stack).  This format is specifically designed for creating
          flame graphs with external tools like Brendan Gregg's
          FlameGraph scripts or speedscope.

        * ‘--flamegraph’: Generates a self-contained interactive HTML
          flame graph using D3.js.  Opens directly in your browser for
          immediate visual analysis.  Flame graphs show the call
          hierarchy where width represents time spent, making it easy to
          spot bottlenecks at a glance.

        * ‘--gecko’: Generates Gecko Profiler format compatible with
          Firefox Profiler(1).  Upload the output to Firefox Profiler
          for advanced timeline-based analysis with features like stack
          charts, markers, and network activity.

        * ‘--heatmap’: Generates an interactive HTML heatmap
          visualization with line-level sample counts.  Creates a
          directory with per-file heatmaps showing exactly where time is
          spent at the source code level.

   * 'Live interactive mode': Real-time TUI profiler with a top-like
     interface (‘--live’).  Monitor performance as your application runs
     with interactive sorting and filtering.

   * 'Async-aware profiling': Profile async/await code with task-based
     stack reconstruction (‘--async-aware’).  See which coroutines are
     consuming time, with options to show only running tasks or all
     tasks including those waiting.

   * 'Opcode-level profiling': Gather bytecode opcode information for
     instruction-level profiling (‘--opcodes’).  Shows which bytecode
     instructions are executing, including specializations from the
     adaptive interpreter.

See *note profiling.sampling: b6. for the complete documentation,
including all available output formats, profiling modes, and
configuration options.

(Contributed by Pablo Galindo and László Kiss Kollár in gh-135953(2) and
gh-138122(3).)

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

   (1) https://profiler.firefox.com

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

   (3) https://github.com/python/cpython/issues/138122


File: python.info,  Node: PEP 831 Frame pointers enabled by default,  Next: PEP 798 Unpacking in comprehensions,  Prev: Tachyon High frequency statistical sampling profiler,  Up: New features<3>

'PEP 831': Frame pointers enabled by default

CPython is now built with frame pointers by default on platforms that
support them.  This uses the compiler flags ‘-fno-omit-frame-pointer’
and ‘-mno-omit-leaf-frame-pointer’, making native stack unwinding faster
and more reliable for system profilers, debuggers, crash analysis tools,
and eBPF-based observability tools.

The flags are exposed through *note sysconfig: e4, so extension modules
built by tools that consume Python's build configuration inherit frame
pointers by default.  This propagation is intentional: mixed
Python/native profiling needs an unbroken frame-pointer chain through
the interpreter, extension modules, embedding applications, and native
libraries.

     重要: Third-party build backends and native build systems should
     preserve these flags when they consume Python's *note sysconfig:
     e4. values.  Build systems that compile C, C++, Rust, or other
     native code without inheriting Python's compiler flags should
     enable equivalent frame-pointer flags themselves.  A single native
     component built without frame pointers can break stack unwinding
     for the whole Python process.

(Contributed by Pablo Galindo Salgado and Savannah Ostrowski in
gh-149201(1); PEP 831 written by Pablo Galindo Salgado, Ken Jin,
Savannah Ostrowski, and Diego Russo.)

参考
....

PEP 831(2) for further details.

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

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

   (2) https://peps.python.org/pep-0831/


File: python.info,  Node: PEP 798 Unpacking in comprehensions,  Next: PEP 829 Package startup configuration files,  Prev: PEP 831 Frame pointers enabled by default,  Up: New features<3>

'PEP 798': Unpacking in comprehensions

List, set, and dictionary comprehensions, as well as generator
expressions, now support unpacking with ‘*’ and ‘**’.  This extends the
unpacking syntax from PEP 448(1) to comprehensions, providing a new
syntax for combining an arbitrary number of iterables or dictionaries
into a single flat structure.  This new syntax is a direct alternative
to nested comprehensions, *note itertools.chain(): 19b, and *note
itertools.chain.from_iterable(): 19c.  For example:

     >>> lists = [[1, 2], [3, 4], [5]]
     >>> [*L for L in lists]  # equivalent to [x for L in lists for x in L]
     [1, 2, 3, 4, 5]

     >>> sets = [{1, 2}, {2, 3}, {3, 4}]
     >>> {*s for s in sets}  # equivalent to {x for s in sets for x in s}
     {1, 2, 3, 4}

     >>> dicts = [{'a': 1}, {'b': 2}, {'a': 3}]
     >>> {**d for d in dicts}  # equivalent to {k: v for d in dicts for k,v in d.items()}
     {'a': 3, 'b': 2}

Generator expressions can similarly use unpacking to yield values from
multiple iterables:

     >>> gen = (*L for L in lists)  # equivalent to (x for L in lists for x in L)
     >>> list(gen)
     [1, 2, 3, 4, 5]

This change also extends to asynchronous generator expressions, such
that, for example, ‘(*a async for a in agen())’ is equivalent to ‘(x
async for a in agen() for x in a)’.

参考
....

PEP 798(2) for further details.

(Contributed by Adam Hartz in gh-143055(3).)

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

   (1) https://peps.python.org/pep-0448/

   (2) https://peps.python.org/pep-0798/

   (3) https://github.com/python/cpython/issues/143055


File: python.info,  Node: PEP 829 Package startup configuration files,  Next: PEP 803 -- Stable ABI for free-threaded builds,  Prev: PEP 798 Unpacking in comprehensions,  Up: New features<3>

'PEP 829': Package startup configuration files

Loaded by the *note site: cf. module when ‘-S’ is not given, *note .pth
files: 19e. can contain lines that both extend *note sys.path: 19f. and
execute arbitrary code when the line starts with ‘import’ (followed by a
space or tab).  The latter functionality can be problematic, since it is
difficult to know exactly what gets executed when Python starts up.

As a step towards improving the ability to audit pre-start executable
code, Python 3.15 introduces *note .start files: 1a0. which contain
entry point specifications of the form ‘pkg.mod:callable’ where
‘pkg.mod’ is the import path to the given callable.  When Python starts
up, the callable is located and called with no arguments.

‘import’ lines in ‘.pth’ files are silently deprecated.  When a matching
‘.start’ file is found, ‘import’ lines in ‘.pth’ files are ignored.
There is no change to *note sys.path: 19f. extension lines in ‘.pth’
files.

(Contributed by Barry Warsaw in gh-148641(1).)

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

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


File: python.info,  Node: PEP 803 -- Stable ABI for free-threaded builds,  Next: PEP 788 Protecting the C API from interpreter finalization,  Prev: PEP 829 Package startup configuration files,  Up: New features<3>

'PEP 803' - Stable ABI for free-threaded builds

C extensions that target the *note Stable ABI: 1a2. can now be compiled
for the new 'Stable ABI for Free-Threaded Builds' (also known as
‘abi3t’), which makes them compatible with *note free-threaded builds:
1a3. of CPython.  This usually requires some non-trivial changes to the
source code; specifically:

   - Switching to API introduced in PEP 697(1) (Python 3.12), such as
     negative *note basicsize: 1a4. and *note PyObject_GetTypeData():
     1a5, rather than making *note PyObject: 1a6. part of the instance
     struct; and

   - Switching from a ‘PyInit_’ function to a new export hook, *note
     PyModExport_*: 1a7, introduced for this purpose in PEP 793(2), with
     a new *note PySlot: 1a8. structure introduced in PEP 820(3).

The reference documentation for these features is complete, but
currently aimed at early adopters.  A migration guide is planned for an
upcoming beta release.

Note that Stable ABI does not offer all the functionality that CPython
has to offer.  Extensions that cannot switch to ‘abi3t’ should continue
to build for the existing Stable ABI (‘abi3’) and the version-specific
ABI for free-threading (‘cp315t’) separately.

Stable ABI for Free-Threaded Builds should typically be selected in a
build tool (such as, for example, Setuptools, meson-python,
scikit-build-core, or Maturin).  At the time of writing, these tools did
'not' support ‘abi3t’.  If this is the case for your tool, compile for
‘cp315t’ separately.  If not using a build tool - or when writing such a
tool - you can select ‘abi3t’ by setting the macro ‘Py_TARGET_ABI3T’ as
discussed in *note Compiling for Stable ABI: 1a9.

参考
....

PEP 803(4) for further details.

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

   (1) https://peps.python.org/pep-0697/

   (2) https://peps.python.org/pep-0793/

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

   (4) https://peps.python.org/pep-0803/


File: python.info,  Node: PEP 788 Protecting the C API from interpreter finalization,  Next: Improved error messages,  Prev: PEP 803 -- Stable ABI for free-threaded builds,  Up: New features<3>

'PEP 788': Protecting the C API from interpreter finalization

In the C API, *note interpreter finalization: 1ab. can be problematic
for many extensions, because *note attaching: 1ac. a thread state will
permanently hang the thread, resulting in deadlocks and other spurious
issues.  Additionally, it has historically been impossible to safely
check whether an interpreter is alive before using it, leading to
crashes when a thread concurrently deletes an interpreter while another
thread is trying to attach to it.

There are now several new suites of APIs to circumvent these problems:

   * *note Interpreter guards: 1ad, which prevent an interpreter from
     finalizing.

   * *note Interpreter views: 1ae, which allow thread-safe access to an
     interpreter that may be concurrently finalizing or deleted.

   * *note New APIs: 1af. to automatically attach and detach thread
     states that come with built-in protection against finalization.

In addition, APIs in the ‘PyGILState’ family (most notably *note
PyGILState_Ensure(): 1b0. and *note PyGILState_Release(): 1b1.) have
been *note soft deprecated: 1b2.  There is 'no' plan to remove them, and
existing code will continue to work, but there will be no new
‘PyGILState’ APIs in future versions of Python.

参考
....

PEP 788(1) for further details.

(Contributed by Peter Bierma in gh-149101(2).)

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

   (1) https://peps.python.org/pep-0788/

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


File: python.info,  Node: Improved error messages,  Prev: PEP 788 Protecting the C API from interpreter finalization,  Up: New features<3>

1.2.2.11 Improved error messages
................................

   * The interpreter now provides more helpful suggestions in *note
     AttributeError: 1b4. exceptions when accessing an attribute on an
     object that does not exist, but a similar attribute is available
     through one of its members.

     For example, if the object has an attribute that itself exposes the
     requested name, the error message will suggest accessing it via
     that inner attribute:

          @dataclass
          class Circle:
             radius: float

             @property
             def area(self) -> float:
                return pi * self.radius**2

          class Container:
             def __init__(self, inner: Circle) -> None:
                self.inner = inner

          circle = Circle(radius=4.0)
          container = Container(circle)
          print(container.area)

     Running this code now produces a clearer suggestion:

          Traceback (most recent call last):
            File "/home/pablogsal/github/python/main/lel.py", line 42, in <module>
              print(container.area)
                    ^^^^^^^^^^^^^^
          AttributeError: 'Container' object has no attribute 'area'. Did you mean '.inner.area' instead of '.area'?

   * When an *note AttributeError: 1b4. on a builtin type has no close
     match via Levenshtein distance, the error message now checks a
     static table of common method names from other languages
     (JavaScript, Java, Ruby, C#) and suggests the Python equivalent:

          >>> [1, 2, 3].push(4)
          Traceback (most recent call last):
          ...
          AttributeError: 'list' object has no attribute 'push'. Did you mean '.append'?

          >>> 'hello'.toUpperCase()
          Traceback (most recent call last):
          ...
          AttributeError: 'str' object has no attribute 'toUpperCase'. Did you mean '.upper'?

     When the Python equivalent is a language construct rather than a
     method, the hint describes the construct directly:

          >>> {}.put("a", 1)
          Traceback (most recent call last):
          ...
          AttributeError: 'dict' object has no attribute 'put'. Use d[k] = v.

     When a mutable method is called on an immutable type, the hint
     suggests the mutable counterpart:

          >>> (1, 2, 3).append(4)
          Traceback (most recent call last):
          ...
          AttributeError: 'tuple' object has no attribute 'append'. Did you mean to use a 'list' object?

     These hints also work for subclasses of builtin types.

     (Contributed by Matt Van Horn in gh-146406(1).)

   * The interpreter now tries to provide a suggestion when *note
     delattr(): 1b5. fails due to a missing attribute.  When an
     attribute name that closely resembles an existing attribute is
     used, the interpreter will suggest the correct attribute name in
     the error message.  For example:

          >>> class A:
          ...     pass
          >>> a = A()
          >>> a.abcde = 1
          >>> del a.abcdf
          Traceback (most recent call last):
          ...
          AttributeError: 'A' object has no attribute 'abcdf'. Did you mean: 'abcde'?

     (Contributed by Nikita Sobolev and Pranjal Prajapati in
     gh-136588(2).)

   * Several error messages incorrectly using the term "argument" have
     been corrected.  (Contributed by Stan Ulbrych in gh-133382(3).)

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

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

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

   (3) https://github.com/python/cpython/issues/133382


File: python.info,  Node: Other language changes<2>,  Next: Default interactive shell,  Prev: New features<3>,  Up: What's new in Python 3 15

1.2.3 Other language changes
----------------------------

   * Python now uses UTF-8(1) as the default encoding, independent of
     the system's environment.  This means that I/O operations without
     an explicit encoding, for example, ‘open('flying-circus.txt')’,
     will use UTF-8.  UTF-8 is a widely-supported Unicode(2) character
     encoding that has become a 'de facto' standard for representing
     text, including nearly every webpage on the internet, many common
     file formats, programming languages, and more.

     This only applies when no ‘encoding’ argument is given.  For best
     compatibility between versions of Python, ensure that an explicit
     ‘encoding’ argument is always provided.  The *note opt-in encoding
     warning: 1b7. can be used to identify code that may be affected by
     this change.  The special ‘encoding='locale'’ argument uses the
     current locale encoding, and has been supported since Python 3.10.

     To retain the previous behaviour, Python's UTF-8 mode may be
     disabled with the *note PYTHONUTF8=0: 1b8. environment variable or
     the *note -X utf8=0: 183. command-line option.

     参考
     ....

     PEP 686(3) for further details.

     (Contributed by Adam Turner in gh-133711(4); PEP 686 written by
     Inada Naoki.)
   * The interpreter help (such as ‘python --help’) is now in color.
     This can be controlled by *note environment variables: 1ba.
     (Contributed by Hugo van Kemenade in gh-148766(5).)
   * Unraisable exceptions are now highlighted with color by default.
     This can be controlled by *note environment variables: 1ba.
     (Contributed by Peter Bierma in gh-134170(6).)
   * More color in *note argparse: 1bc, *note ast: 1bd, *note calendar:
     1be, *note difflib: 1bf, *note http.server: 1c0, *note pickletools:
     1c1, *note PyREPL tab completion: 1c2, *note python -help: 1b9,
     *note sqlite3: 1c3, *note timeit: 1c4, *note tokenize: 1c5, *note
     unraisable exceptions: 1bb. and *note stdlib: 1c6. (ast,
     compileall, doctest, gzip, inspect, json.tool, pdb,
     profiling.sampling, random, regrtest, sqlite3, timeit, tokenize,
     trace, unittest, uuid, zipapp, zipfile) CLI help.

   * The *note __repr__(): 1c7. of *note ImportError: 1c8. and *note
     ModuleNotFoundError: 1c9. now shows "name" and "path" as
     ‘name=<name>’ and ‘path=<path>’ if they were given as keyword
     arguments at construction time.  (Contributed by Serhiy Storchaka,
     Oleg Iarygin, and Yoav Nir in gh-74185(7).)

   * The *note __dict__: 1ca. and ‘__weakref__’ descriptors now use a
     single descriptor instance per interpreter, shared across all types
     that need them.  This speeds up class creation, and helps avoid
     reference cycles.  (Contributed by Petr Viktorin in gh-135228(8).)

   * The *note -W: 1cb. option and the *note PYTHONWARNINGS: 1cc.
     environment variable can now specify regular expressions instead of
     literal strings to match the warning message and the module name,
     if the corresponding field starts and ends with a forward slash
     (‘/’).  (Contributed by Serhiy Storchaka in gh-134716(9).)

   * Functions that take timestamp or timeout arguments now accept any
     real numbers (such as *note Decimal: 1cd. and *note Fraction:
     1ce.), not only integers or floats, although this does not improve
     precision.  (Contributed by Serhiy Storchaka in gh-67795(10).)

   * Added *note bytearray.take_bytes(n=None, /): 1d0. to take bytes out
     of a *note bytearray: 1d1. without copying.  This enables
     optimizing code which must return *note bytes: 1d2. after working
     with a mutable buffer of bytes such as data buffering, network
     protocol parsing, encoding, decoding, and compression.  Common code
     patterns which can be optimized with *note take_bytes(): 1d0. are
     listed below.  Suggested optimizing refactors

     Description                           Old                                   New
                                                                                 
     ------------------------------------------------------------------------------------------------------------------
                                                                                 
     Return *note bytes: 1d2. after             def read() -> bytes:                  def read() -> bytes:
     working with *note bytearray: 1d1.             buffer = bytearray(1024)              buffer = bytearray(1024)
                                                    ...                                   ...
                                                    return bytes(buffer)                  return buffer.take_bytes()
                                                                                 
                                                                                 
     Empty a buffer getting the bytes           buffer = bytearray(1024)              buffer = bytearray(1024)
                                                ...                                   ...
                                                data = bytes(buffer)                  data = buffer.take_bytes()
                                                buffer.clear()                   
                                           
                                                                                 
     Split a buffer at a specific               buffer = bytearray(b'abc\ndef')       buffer = bytearray(b'abc\ndef')
     separator                                  n = buffer.find(b'\n')                n = buffer.find(b'\n')
                                                data = bytes(buffer[:n + 1])          data = buffer.take_bytes(n + 1)
                                                del buffer[:n + 1]               
                                                assert data == b'abc\n'
                                                assert buffer == bytearray(b'def')
                                           
                                                                                 
     Split a buffer at a specific               buffer = bytearray(b'abc\ndef')       buffer = bytearray(b'abc\ndef')
     separator; discard after the               n = buffer.find(b'\n')                n = buffer.find(b'\n')
     separator                                  data = bytes(buffer[:n])              buffer.resize(n)
                                                buffer.clear()                        data = buffer.take_bytes()
                                                assert data == b'abc'            
                                                assert len(buffer) == 0
                                           

     (Contributed by Cody Maloney in gh-139871(11).)

   * Many functions related to compiling or parsing Python code, such as
     *note compile(): 1d3, *note ast.parse(): 1d4, *note
     symtable.symtable(): 1d5, and *note
     importlib.abc.InspectLoader.source_to_code(): 1d6, now allow the
     module name to be passed.  It is needed to unambiguously *note
     filter: 1d7. syntax warnings by module name.  (Contributed by
     Serhiy Storchaka in gh-135801(12).)

   * Allowed defining the '__dict__' and '__weakref__' *note __slots__:
     1d8. for any class.  (Contributed by Serhiy Storchaka in
     gh-41779(13).)

   * Allowed defining any *note __slots__: 1d8. for a class derived from
     *note tuple: 1d9. (including classes created by *note
     collections.namedtuple(): 1da.).  (Contributed by Serhiy Storchaka
     in gh-41779(14).)

   * The *note slice: 1db. type now supports subscription, making it a
     *note generic type: 1dc.  (Contributed by James Hilton-Balfe in
     gh-128335(15).)

   * The class *note memoryview: 1dd. now supports the float complex and
     double complex C types: formatting characters ‘'Zf'’ and ‘'Zd'’
     respectively.  (Contributed by Victor Stinner in gh-146151(16) and
     gh-148675(17).)

   * Allow the 'count' argument of *note bytes.replace(): 1de. to be a
     keyword.  (Contributed by Stan Ulbrych in gh-147856(18).)

   * Unary plus is now accepted in *note match: 1df. literal patterns,
     mirroring the existing support for unary minus.  (Contributed by
     Bartosz Sławecki in gh-145239(19).)

   * The import system now acquires per-module locks in hierarchical
     order (parent packages before their submodules).  This fixes a
     long-standing deadlock where one thread importing ‘pkg.sub’ and
     another importing ‘pkg.sub.mod’ could each block the other when
     ‘pkg/sub/__init__.py’ imports ‘pkg.sub.mod’.  (Contributed by
     Gregory P. Smith in gh-83065(20).)

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

   (1) https://en.wikipedia.org/wiki/UTF-8

   (2) https://home.unicode.org/

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

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

   (5) https://github.com/python/cpython/issues/148766

   (6) https://github.com/python/cpython/issues/134170

   (7) https://github.com/python/cpython/issues/74185

   (8) https://github.com/python/cpython/issues/135228

   (9) https://github.com/python/cpython/issues/134716

   (10) https://github.com/python/cpython/issues/67795

   (11) https://github.com/python/cpython/issues/139871

   (12) https://github.com/python/cpython/issues/135801

   (13) https://github.com/python/cpython/issues/41779

   (14) https://github.com/python/cpython/issues/41779

   (15) https://github.com/python/cpython/issues/128335

   (16) https://github.com/python/cpython/issues/146151

   (17) https://github.com/python/cpython/issues/148675

   (18) https://github.com/python/cpython/issues/147856

   (19) https://github.com/python/cpython/issues/145239

   (20) https://github.com/python/cpython/issues/83065


File: python.info,  Node: Default interactive shell,  Next: New modules<2>,  Prev: Other language changes<2>,  Up: What's new in Python 3 15

1.2.4 Default interactive shell
-------------------------------

   * Tab completions are now colored by object kind, based on
     fancycompleter(1).  Set *note PYTHON_BASIC_COMPLETER: 1e1. to fall
     back to *note rlcompleter: c5.  Color can also be controlled by
     *note environment variables: 1ba.  (Contributed by Antonio Cuni and
     Pablo Galindo in gh-130472(2).)

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

   (1) https://pypi.org/project/fancycompleter/

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


File: python.info,  Node: New modules<2>,  Next: Improved modules<2>,  Prev: Default interactive shell,  Up: What's new in Python 3 15

1.2.5 New modules
-----------------

* Menu:

* math.integer: math integer.


File: python.info,  Node: math integer,  Up: New modules<2>

1.2.5.1 math.integer
....................

This module provides access to the mathematical functions for integer
arguments ( PEP 791(1)).  (Contributed by Serhiy Storchaka in
gh-81313(2).)

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

   (1) https://peps.python.org/pep-0791/

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


File: python.info,  Node: Improved modules<2>,  Next: Optimizations<2>,  Prev: New modules<2>,  Up: What's new in Python 3 15

1.2.6 Improved modules
----------------------

* Menu:

* argparse::
* array::
* ast::
* asyncio: asyncio<2>.
* base64::
* binascii::
* calendar::
* collections::
* concurrent.futures: concurrent futures.
* contextlib::
* dataclasses::
* dbm::
* difflib::
* email::
* faulthandler::
* functools: functools<2>.
* gc::
* hashlib::
* http.client: http client.
* http.server: http server.
* inspect::
* json::
* locale::
* math::
* mimetypes: mimetypes<2>.
* mmap::
* os: os<2>.
* os.path: os path.
* pdb::
* pickle::
* pickletools::
* pprint::
* re::
* resource::
* shelve::
* socket::
* sqlite3::
* ssl::
* subprocess::
* symtable: symtable<2>.
* sys: sys<2>.
* sys.monitoring: sys monitoring.
* tarfile: tarfile<2>.
* threading::
* timeit::
* tkinter::
* tokenize::
* tomllib::
* types::
* typing::
* unicodedata::
* unittest::
* urllib.parse: urllib parse.
* venv::
* warnings::
* wave::
* webbrowser::
* xml::
* xml.parsers.expat: xml parsers expat.
* zlib::


File: python.info,  Node: argparse,  Next: array,  Up: Improved modules<2>

1.2.6.1 argparse
................

   * The *note BooleanOptionalAction: 1e6. action now supports
     single-dash long options and alternate prefix characters.
     (Contributed by Serhiy Storchaka in gh-138525(1).)

   * Changed the 'suggest_on_error' parameter of *note
     argparse.ArgumentParser: 1e7. to default to ‘True’.  This enables
     suggestions for mistyped arguments by default.  (Contributed by
     Jakob Schluse in gh-140450(2).)
   * Added backtick markup support in *note ArgumentParser: 1e7.
     description and epilog text to highlight inline code when color
     output is enabled.  (Contributed by Savannah Ostrowski in
     gh-142390(3).)

   * Extended backtick markup to argument ‘help’ text and added support
     for double backticks (RST inline-literal style).  (Contributed by
     Hugo van Kemenade in gh-149375(4).)

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

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

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

   (3) https://github.com/python/cpython/issues/142390

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


File: python.info,  Node: array,  Next: ast,  Prev: argparse,  Up: Improved modules<2>

1.2.6.2 array
.............

   * Support the float complex and double complex C types: formatting
     characters ‘'Zf'’ and ‘'Zd'’ respectively.  (Contributed by Victor
     Stinner in gh-146151(1) and gh-148675(2).)

   * Support half-floats (16-bit IEEE 754 binary interchange format):
     formatting character ‘'e'’.  (Contributed by Sergey B Kirpichev in
     gh-146238(3).)

   * The *note array.typecodes: 1e9. type changed from *note str: 1ea.
     to *note tuple: 1d9. to support type codes longer than 1 character
     (‘Zf’ and ‘Zd’).  (Contributed by Victor Stinner in gh-148675(4).)

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

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

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

   (3) https://github.com/python/cpython/issues/146238

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


File: python.info,  Node: ast,  Next: asyncio<2>,  Prev: array,  Up: Improved modules<2>

1.2.6.3 ast
...........

   * Add 'color' parameter to *note dump(): 1ec.  If ‘True’, the
     returned string is syntax highlighted using ANSI escape sequences.
     If ‘False’ (the default), colored output is always disabled.
     (Contributed by Stan Ulbrych in gh-148981(1).)

   * The *note command-line: 1ed. output is now syntax highlighted by
     default.  This can be *note controlled using environment variables:
     1ba.  (Contributed by Stan Ulbrych in gh-148981(2).)

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

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

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


File: python.info,  Node: asyncio<2>,  Next: base64,  Prev: ast,  Up: Improved modules<2>

1.2.6.4 asyncio
...............

   * Added *note TaskGroup.cancel: 1ef. to allow early termination of a
     task group, for instance, when the goal of the tasks has been
     achieved or their services are no longer needed.  Previously this
     would involve unintuitive boilerplate such as an extra task raising
     a custom exception which is then suppressed as it exits the task
     group.  (Contributed by John Belmonte in gh-127214(1).)

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

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


File: python.info,  Node: base64,  Next: binascii,  Prev: asyncio<2>,  Up: Improved modules<2>

1.2.6.5 base64
..............

   * Added the 'pad' parameter in *note z85encode(): 1f1.  (Contributed
     by Hauke Dämpfling in gh-143103(1).)

   * Added the 'padded' parameter in *note b32encode(): 1f2, *note
     b32decode(): 1f3, *note b32hexencode(): 1f4, *note b32hexdecode():
     1f5, *note b64encode(): 1f6, *note b64decode(): 1f7, *note
     urlsafe_b64encode(): 1f8, and *note urlsafe_b64decode(): 1f9.
     (Contributed by Serhiy Storchaka in gh-73613(2).)

   * Added the 'wrapcol' parameter in *note b16encode(): 1fa, *note
     b32encode(): 1f2, *note b32hexencode(): 1f4, *note b64encode():
     1f6, *note b85encode(): 1fb, and *note z85encode(): 1f1.
     (Contributed by Serhiy Storchaka in gh-143214(3) and gh-146431(4).)

   * Added the 'ignorechars' parameter in *note b16decode(): 1fc, *note
     b32decode(): 1f3, *note b32hexdecode(): 1f5, *note b64decode():
     1f7, *note b85decode(): 1fd, and *note z85decode(): 1fe.
     (Contributed by Serhiy Storchaka in gh-144001(5) and gh-146431(6).)

   * Added the 'canonical' parameter in *note b32decode(): 1f3, *note
     b32hexdecode(): 1f5, *note b64decode(): 1f7, *note
     urlsafe_b64decode(): 1f9, *note a85decode(): 1ff, *note
     b85decode(): 1fd, and *note z85decode(): 1fe, to reject encodings
     with non-zero padding bits or other non-canonical forms.
     (Contributed by Gregory P. Smith in gh-146311(7).)

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

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

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

   (3) https://github.com/python/cpython/issues/143214

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

   (5) https://github.com/python/cpython/issues/144001

   (6) https://github.com/python/cpython/issues/146431

   (7) https://github.com/python/cpython/issues/146311


File: python.info,  Node: binascii,  Next: calendar,  Prev: base64,  Up: Improved modules<2>

1.2.6.6 binascii
................

   * Added functions for Base32 encoding:

        - *note b2a_base32(): 201. and *note a2b_base32(): 202.

     (Contributed by James Seo in gh-146192(1).)

   * Added functions for Ascii85, Base85, and Z85 encoding:

        - *note b2a_ascii85(): 203. and *note a2b_ascii85(): 204.

        - *note b2a_base85(): 205. and *note a2b_base85(): 206.

     (Contributed by James Seo and Serhiy Storchaka in gh-101178(2).)

   * Added the 'padded' parameter in *note b2a_base32(): 201, *note
     a2b_base32(): 202, *note b2a_base64(): 207, and *note a2b_base64():
     208.  (Contributed by Serhiy Storchaka in gh-73613(3).)

   * Added the 'wrapcol' parameter in *note b2a_base64(): 207.
     (Contributed by Serhiy Storchaka in gh-143214(4).)

   * Added the 'alphabet' parameter in *note b2a_base64(): 207. and
     *note a2b_base64(): 208.  (Contributed by Serhiy Storchaka in
     gh-145980(5).)

   * Added the 'ignorechars' parameter in *note a2b_hex(): 209, *note
     unhexlify(): 20a, and *note a2b_base64(): 208.  (Contributed by
     Serhiy Storchaka in gh-144001(6) and gh-146431(7).)

   * Added the 'canonical' parameter in *note a2b_base64(): 208, to
     reject encodings with non-zero padding bits.  (Contributed by
     Gregory P. Smith in gh-146311(8).)

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

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

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

   (3) https://github.com/python/cpython/issues/73613

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

   (5) https://github.com/python/cpython/issues/145980

   (6) https://github.com/python/cpython/issues/144001

   (7) https://github.com/python/cpython/issues/146431

   (8) https://github.com/python/cpython/issues/146311


File: python.info,  Node: calendar,  Next: collections,  Prev: binascii,  Up: Improved modules<2>

1.2.6.7 calendar
................

   * *note calendar: 15.'s *note command-line: 20c. text output has more
     color.  This can be controlled with *note environment variables:
     1ba.  (Contributed by Hugo van Kemenade in gh-148352(1).)

   * The *note calendar: 15.'s *note command-line: 20c. HTML output now
     accepts the year-month option: ‘python -m calendar -t html 2009
     06’.  (Contributed by Pål Grønås Drange in gh-140212(2).)

   * Calendar pages generated by the *note calendar.HTMLCalendar: 20d.
     class now support dark mode and have been migrated to the HTML5
     standard for improved accessibility.  (Contributed by Jiahao Li and
     Hugo van Kemenade in gh-137634(3).)

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

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

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

   (3) https://github.com/python/cpython/issues/137634


File: python.info,  Node: collections,  Next: concurrent futures,  Prev: calendar,  Up: Improved modules<2>

1.2.6.8 collections
...................

   * Added ‘collections.Counter.__xor__()’ and
     ‘collections.Counter.__ixor__()’ to compute the symmetric
     difference between *note Counter: 20f. objects.  (Contributed by
     Raymond Hettinger in gh-138682(1).)

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

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


File: python.info,  Node: concurrent futures,  Next: contextlib,  Prev: collections,  Up: Improved modules<2>

1.2.6.9 concurrent.futures
..........................

   * Improved error reporting when a child process in a *note
     concurrent.futures.ProcessPoolExecutor: 211. terminates abruptly.
     The resulting traceback will now tell you the PID and exit code of
     the terminated process.  (Contributed by Jonathan Berg in
     gh-139486(1).)

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

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


File: python.info,  Node: contextlib,  Next: dataclasses,  Prev: concurrent futures,  Up: Improved modules<2>

1.2.6.10 contextlib
...................

   * Added support for arbitrary descriptors ‘__enter__()’,
     ‘__exit__()’, ‘__aenter__()’, and ‘__aexit__()’ in *note ExitStack:
     213. and *note contextlib.AsyncExitStack: 214, for consistency with
     the *note with: 215. and *note async with: 216. statements.
     (Contributed by Serhiy Storchaka in gh-144386(1).)

   * *note ContextDecorator: 217. and *note AsyncContextDecorator: 218.
     (and therefore *note contextmanager(): 219. and *note
     asynccontextmanager(): 21a. used as decorators) now detect
     generator functions, coroutine functions, and asynchronous
     generator functions and keep the context manager open across
     iteration or await.  Previously the context manager exited as soon
     as the generator or coroutine object was created.  (Contributed by
     Alex Grönholm & Gregory P. Smith in gh-125862(2).)

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

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

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


File: python.info,  Node: dataclasses,  Next: dbm,  Prev: contextlib,  Up: Improved modules<2>

1.2.6.11 dataclasses
....................

   * Annotations for generated ‘__init__’ methods no longer include
     internal type names.


File: python.info,  Node: dbm,  Next: difflib,  Prev: dataclasses,  Up: Improved modules<2>

1.2.6.12 dbm
............

   * Added new ‘reorganize()’ methods to *note dbm.dumb: 35. and *note
     dbm.sqlite3: 38. to recover unused free space previously occupied
     by deleted entries.  (Contributed by Andrea Oliveri in
     gh-134004(1).)

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

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


File: python.info,  Node: difflib,  Next: email,  Prev: dbm,  Up: Improved modules<2>

1.2.6.13 difflib
................

   * Introduced the optional 'color' parameter to *note
     difflib.unified_diff(): 21e, enabling color output similar to ‘git
     diff’.  This can be controlled by *note environment variables: 1ba.
     (Contributed by Douglas Thor in gh-133725(1).)

   * Improved the styling of HTML diff pages generated by the *note
     difflib.HtmlDiff: 21f. class, and migrated the output to the HTML5
     standard.  (Contributed by Jiahao Li in gh-134580(2).)

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

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

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


File: python.info,  Node: email,  Next: faulthandler,  Prev: difflib,  Up: Improved modules<2>

1.2.6.14 email
..............

   * Email generators now raise an error when an *note EmailMessage:
     221. cannot be accurately flattened due to a non-ASCII email
     address (mailbox) in an address header.  Options for supporting
     Email Address Internationalization (EAI) are discussed in *note
     EmailPolicy.utf8: 222.  (Contributed by R David Murray and Mike
     Edmunds in gh-122540(1).)

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

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


File: python.info,  Node: faulthandler,  Next: functools<2>,  Prev: email,  Up: Improved modules<2>

1.2.6.15 faulthandler
.....................

   * Added the 'max_threads' parameter in *note faulthandler.enable():
     224, *note faulthandler.dump_traceback(): 225, *note
     faulthandler.dump_traceback_later(): 226, and *note
     faulthandler.register(): 227.  (Contributed by Eric Froemling in
     gh-149085(1).)

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

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


File: python.info,  Node: functools<2>,  Next: gc,  Prev: faulthandler,  Up: Improved modules<2>

1.2.6.16 functools
..................

   * *note singledispatchmethod(): 229. now supports non-*note
     descriptor: 22a. callables.  (Contributed by Serhiy Storchaka in
     gh-140873(1).)

   * *note singledispatchmethod(): 229. now dispatches on the second
     argument if it wraps a regular method and is called as a class
     attribute.  (Contributed by Bartosz Sławecki in gh-143535(2).)

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

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

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


File: python.info,  Node: gc,  Next: hashlib,  Prev: functools<2>,  Up: Improved modules<2>

1.2.6.17 gc
...........

   * 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 and Python 3.15.

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

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


File: python.info,  Node: hashlib,  Next: http client,  Prev: gc,  Up: Improved modules<2>

1.2.6.18 hashlib
................

   * Ensure that hash functions guaranteed to be always 'available'
     exist as attributes of *note hashlib: 6b. even if they will not
     work at runtime due to missing backend implementations.  For
     instance, ‘hashlib.md5’ will no longer raise *note AttributeError:
     1b4. if OpenSSL is not available and Python has been built without
     MD5 support.  (Contributed by Bénédikt Tran in gh-136929(1).)

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

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


File: python.info,  Node: http client,  Next: http server,  Prev: hashlib,  Up: Improved modules<2>

1.2.6.19 http.client
....................

   * A new 'max_response_headers' keyword-only parameter has been added
     to *note HTTPConnection: 22e. and *note HTTPSConnection: 22f.
     constructors.  This parameter overrides the default maximum number
     of allowed response headers.  (Contributed by Alexander Enrique
     Urieles Nieto in gh-131724(1).)

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

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


File: python.info,  Node: http server,  Next: inspect,  Prev: http client,  Up: Improved modules<2>

1.2.6.20 http.server
....................

   * The logging of *note BaseHTTPRequestHandler: 231, as used by the
     *note command-line interface: 232, is colored by default.  This can
     be controlled with *note environment variables: 1ba.  (Contributed
     by Hugo van Kemenade in gh-146292(1).)

   * Added *note default_content_type: 233. and the *note -content-type:
     234. command-line option to allow customizing the default
     ‘Content-Type’ header for files with unknown extensions.
     (Contributed by John Comeau and Hugo van Kemenade in gh-113471(2).)

   * Add a new ‘extra_response_headers’ keyword argument to *note
     SimpleHTTPRequestHandler: 235. to support custom headers in HTTP
     responses.  (Contributed by Anton I. Sipos in gh-135057(3).)

   * Add a ‘-H/--header’ option to the ‘python -m http.server’
     command-line interface to support custom headers in HTTP responses.
     (Contributed by Anton I. Sipos in gh-135057(4).)

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

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

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

   (3) https://github.com/python/cpython/issues/135057

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


File: python.info,  Node: inspect,  Next: json,  Prev: http server,  Up: Improved modules<2>

1.2.6.21 inspect
................

   * Add parameters 'inherit_class_doc' and 'fallback_to_class_doc' for
     *note getdoc(): 237.  (Contributed by Serhiy Storchaka in
     gh-132686(1).)

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

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


File: python.info,  Node: json,  Next: locale,  Prev: inspect,  Up: Improved modules<2>

1.2.6.22 json
.............

   * Add the 'array_hook' parameter to *note load(): 239. and *note
     loads(): 23a. functions: allow a callback for JSON literal array
     types to customize Python lists in the resulting decoded object.
     Passing combined *note frozendict: 18d. to 'object_pairs_hook'
     param and *note tuple: 1d9. to ‘array_hook’ will yield a deeply
     nested immutable Python structure representing the JSON data.
     (Contributed by Joao S. O. Bueno in gh-146440(1).)

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

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


File: python.info,  Node: locale,  Next: math,  Prev: json,  Up: Improved modules<2>

1.2.6.23 locale
...............

   * *note setlocale(): 23c. now supports language codes with
     ‘@’-modifiers.  ‘@’-modifiers are no longer silently removed in
     *note getlocale(): 23d, but included in the language code.
     (Contributed by Serhiy Storchaka in gh-137729(1).)

   * Undeprecate the *note locale.getdefaultlocale(): 23e. function.
     (Contributed by Victor Stinner in gh-130796(2).)

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

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

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


File: python.info,  Node: math,  Next: mimetypes<2>,  Prev: locale,  Up: Improved modules<2>

1.2.6.24 math
.............

   * Add *note math.isnormal(): 240. and *note math.issubnormal(): 241.
     functions.  (Contributed by Sergey B Kirpichev in gh-132908(1).)

   * Add *note math.fmax(): 242, *note math.fmin(): 243. and *note
     math.signbit(): 244. functions.  (Contributed by Bénédikt Tran in
     gh-135853(2).)

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

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

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


File: python.info,  Node: mimetypes<2>,  Next: mmap,  Prev: math,  Up: Improved modules<2>

1.2.6.25 mimetypes
..................

   * Add more MIME types.  (Contributed by Benedikt Johannes, Charlie
     Lin, Foolbar, Gil Forcada and John Franey in gh-144217(1),
     gh-145720(2), gh-140937(3), gh-139959(4), gh-145698(5),
     gh-145718(6), gh-145918(7), and gh-144213(8).)

   * Rename ‘application/x-texinfo’ to ‘application/texinfo’.
     (Contributed by Charlie Lin in gh-140165(9).)

   * Changed the MIME type for ‘.ai’ files to ‘application/pdf’.
     (Contributed by Stan Ulbrych in gh-141239(10).)

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

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

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

   (3) https://github.com/python/cpython/issues/140937

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

   (5) https://github.com/python/cpython/issues/145698

   (6) https://github.com/python/cpython/issues/145718

   (7) https://github.com/python/cpython/issues/145918

   (8) https://github.com/python/cpython/issues/144213

   (9) https://github.com/python/cpython/issues/140165

   (10) https://github.com/python/cpython/issues/141239


File: python.info,  Node: mmap,  Next: os<2>,  Prev: mimetypes<2>,  Up: Improved modules<2>

1.2.6.26 mmap
.............

   * *note mmap.mmap: 247. now has a 'trackfd' parameter on Windows; if
     it is ‘False’, the file handle corresponding to 'fileno' will not
     be duplicated.  (Contributed by Serhiy Storchaka in gh-78502(1).)

   * Added the *note mmap.mmap.set_name(): 248. method to annotate an
     anonymous memory mapping if Linux kernel supports
     ‘PR_SET_VMA_ANON_NAME(2)’ (Linux 5.17 or newer).  (Contributed by
     Donghee Na in gh-142419(3).)

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

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

   (2) https://manpages.debian.org/PR_SET_VMA(2const)

   (3) https://github.com/python/cpython/issues/142419


File: python.info,  Node: os<2>,  Next: os path,  Prev: mmap,  Up: Improved modules<2>

1.2.6.27 os
...........

   * Add *note os.statx(): 24a. on Linux kernel versions 4.11 and later
     with glibc versions 2.28 and later.  (Contributed by Jeffrey
     Bosboom and Victor Stinner in gh-83714(1).)

   * *note os.makedirs(): 24b. function now has a 'parent_mode'
     parameter that allows specifying the mode for intermediate
     directories.  This can be used to match the behavior from Python
     3.6 and earlier by passing ‘parent_mode=mode’.  (Contributed by
     Zackery Spytz and Gregory P. Smith in gh-86533(2).)

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

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

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


File: python.info,  Node: os path,  Next: pdb,  Prev: os<2>,  Up: Improved modules<2>

1.2.6.28 os.path
................

   * Add support of the all-but-last mode in *note realpath(): 24d.
     (Contributed by Serhiy Storchaka in gh-71189(1).)

   * The 'strict' parameter to *note os.path.realpath(): 24d. accepts a
     new value, *note os.path.ALLOW_MISSING: 24e.  If used, errors other
     than *note FileNotFoundError: 24f. 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(2).)

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

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

   (2) https://www.cve.org/CVERecord?id=CVE-2025-4517


File: python.info,  Node: pdb,  Next: pickle,  Prev: os path,  Up: Improved modules<2>

1.2.6.29 pdb
............

   * Use the new interactive shell as the default input shell for *note
     pdb: aa.  (Contributed by Tian Gao in gh-145379(1).)

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

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


File: python.info,  Node: pickle,  Next: pickletools,  Prev: pdb,  Up: Improved modules<2>

1.2.6.30 pickle
...............

   * Add support for pickling private methods and nested classes.
     (Contributed by Zackery Spytz and Serhiy Storchaka in gh-77188(1).)

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

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


File: python.info,  Node: pickletools,  Next: pprint,  Prev: pickle,  Up: Improved modules<2>

1.2.6.31 pickletools
....................

   * The output of the *note pickletools: ac. command-line interface is
     colored by default.  This can be controlled with *note environment
     variables: 1ba.  (Contributed by Hugo van Kemenade in
     gh-149026(1).)

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

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


File: python.info,  Node: pprint,  Next: re,  Prev: pickletools,  Up: Improved modules<2>

1.2.6.32 pprint
...............

   * *note pprint: b3. now uses modern defaults: ‘indent=4, width=88’,
     and the default ‘compact=False’ output is now formatted similar to
     pretty-printed *note json.dumps(): 254.  (Contributed by Stefan
     Todoran, Semyon Moroz and Hugo van Kemenade in gh-112632(1) and
     gh-149189(2).)

   * Add t-string support to *note pprint: b3.  (Contributed by Loïc
     Simon and Hugo van Kemenade in gh-134551(3).)

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

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

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

   (3) https://github.com/python/cpython/issues/134551


File: python.info,  Node: re,  Next: resource,  Prev: pprint,  Up: Improved modules<2>

1.2.6.33 re
...........

   * *note re.prefixmatch(): 256. and a corresponding *note
     re.Pattern.prefixmatch(): 257. have been added as alternate, more
     explicit names for the existing and now *note soft deprecated: 1b2.
     *note re.match(): 258. and *note re.Pattern.match(): 259. APIs.
     These are intended to be used to alleviate confusion around what
     'match' means by following the Zen of Python's '"Explicit is better
     than implicit"' mantra.  Most other language regular expression
     libraries use an API named 'match' to mean what Python has always
     called 'search'.  (Contributed by Gregory P. Smith in gh-86519(1).)

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

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


File: python.info,  Node: resource,  Next: shelve,  Prev: re,  Up: Improved modules<2>

1.2.6.34 resource
.................

   * Add new constants: *note RLIMIT_NTHR: 25b, *note RLIMIT_UMTXP: 25c,
     *note RLIMIT_THREADS: 25d, *note RLIM_SAVED_CUR: 25e, and *note
     RLIM_SAVED_MAX: 25f.  (Contributed by Serhiy Storchaka in
     gh-137512(1).)

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

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


File: python.info,  Node: shelve,  Next: socket,  Prev: resource,  Up: Improved modules<2>

1.2.6.35 shelve
...............

   * Added new ‘reorganize()’ method to *note shelve: cb. used to
     recover unused free space previously occupied by deleted entries.
     (Contributed by Andrea Oliveri in gh-134004(1).)

   * Add support for custom serialization and deserialization functions
     in the *note shelve: cb. module.  (Contributed by Furkan Onder in
     gh-99631(2).)

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

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

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


File: python.info,  Node: socket,  Next: sqlite3,  Prev: shelve,  Up: Improved modules<2>

1.2.6.36 socket
...............

   * Add constants for the ISO-TP CAN protocol.  (Contributed by Patrick
     Menschel and Stefan Tatschner in gh-86819(1).)

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

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


File: python.info,  Node: sqlite3,  Next: ssl,  Prev: socket,  Up: Improved modules<2>

1.2.6.37 sqlite3
................

   * The *note command-line interface: 263. has several new features:

        * SQL keyword completion on <tab>.  (Contributed by Long Tan in
          gh-133393(1).)

        * Prompts, error messages, and help text are now colored.  This
          is enabled by default, see *note 色の制御: 1ba. for details.
          (Contributed by Stan Ulbrych and Łukasz Langa in
          gh-133461(2).)

        * Table, index, trigger, view, column, function, and schema
          completion on <tab>.  (Contributed by Long Tan in
          gh-136101(3).)

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

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

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

   (3) https://github.com/python/cpython/issues/136101


File: python.info,  Node: ssl,  Next: subprocess,  Prev: sqlite3,  Up: Improved modules<2>

1.2.6.38 ssl
............

   * Indicate through *note ssl.HAS_PSK_TLS13: 265. whether the *note
     ssl: d8. module supports "External PSKs" in TLSv1.3, as described
     in RFC 9258(1).  (Contributed by Will Childs-Klein in
     gh-133624(2).)

   * Added new methods for managing groups used for SSL key agreement

        * *note ssl.SSLContext.set_groups(): 266. sets the groups
          allowed for doing key agreement, extending the previous *note
          ssl.SSLContext.set_ecdh_curve(): 267. method.  This new API
          provides the ability to list multiple groups and supports
          fixed-field and post-quantum groups in addition to ECDH
          curves.  This method can also be used to control what key
          shares are sent in the TLS handshake.

        * *note ssl.SSLSocket.group(): 268. returns the group selected
          for doing key agreement on the current connection after the
          TLS handshake completes.  This call requires OpenSSL 3.2 or
          later.

        * *note ssl.SSLContext.get_groups(): 269. returns a list of all
          available key agreement groups compatible with the minimum and
          maximum TLS versions currently set in the context.  This call
          requires OpenSSL 3.5 or later.

     (Contributed by Ron Frederick in gh-136306(3).)

   * Added a new method *note ssl.SSLContext.set_ciphersuites(): 26a.
     for setting TLS 1.3 ciphers.  For TLS 1.2 or earlier, *note
     ssl.SSLContext.set_ciphers(): 26b. should continue to be used.
     Both calls can be made on the same context and the selected cipher
     suite will depend on the TLS version negotiated when a connection
     is made.  (Contributed by Ron Frederick in gh-137197(4).)

   * Added new methods for managing signature algorithms:

        * *note ssl.get_sigalgs(): 26c. returns a list of all available
          TLS signature algorithms.  This call requires OpenSSL 3.4 or
          later.

        * *note ssl.SSLContext.set_client_sigalgs(): 26d. sets the
          signature algorithms allowed for certificate-based client
          authentication.

        * *note ssl.SSLContext.set_server_sigalgs(): 26e. sets the
          signature algorithms allowed for the server to complete the
          TLS handshake.

        * *note ssl.SSLSocket.client_sigalg(): 26f. returns the
          signature algorithm selected for client authentication on the
          current connection.  This call requires OpenSSL 3.5 or later.

        * *note ssl.SSLSocket.server_sigalg(): 270. returns the
          signature algorithm selected for the server to complete the
          TLS handshake on the current connection.  This call requires
          OpenSSL 3.5 or later.

     (Contributed by Ron Frederick in gh-138252(5).)

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

   (1) https://datatracker.ietf.org/doc/html/rfc9258.html

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

   (3) https://github.com/python/cpython/issues/136306

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

   (5) https://github.com/python/cpython/issues/138252


File: python.info,  Node: subprocess,  Next: symtable<2>,  Prev: ssl,  Up: Improved modules<2>

1.2.6.39 subprocess
...................

   * *note subprocess.Popen.wait(): 272.: when ‘timeout’ is not ‘None’
     and the platform supports it, an efficient event-driven mechanism
     is used to wait for process termination:

        - Linux >= 5.3 uses *note os.pidfd_open(): 273. + *note
          select.poll(): 274.

        - macOS and other BSD variants use *note select.kqueue(): 275. +
          ‘KQ_FILTER_PROC’ + ‘KQ_NOTE_EXIT’.

        - Windows keeps using ‘WaitForSingleObject’ (unchanged).

     If none of these mechanisms are available, the function falls back
     to the traditional busy loop (non-blocking call and short sleeps).
     (Contributed by Giampaolo Rodola in gh-83069(1).)

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

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


File: python.info,  Node: symtable<2>,  Next: sys<2>,  Prev: subprocess,  Up: Improved modules<2>

1.2.6.40 symtable
.................

   * Add *note symtable.Function.get_cells(): 277. and *note
     symtable.Symbol.is_cell(): 278. methods.  (Contributed by Yashp002
     in gh-143504(1).)

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

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


File: python.info,  Node: sys<2>,  Next: sys monitoring,  Prev: symtable<2>,  Up: Improved modules<2>

1.2.6.41 sys
............

   * Add *note sys.abi_info: 27a. namespace to improve access to ABI
     information.  (Contributed by Klaus Zimmermann in gh-137476(1).)

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

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


File: python.info,  Node: sys monitoring,  Next: tarfile<2>,  Prev: sys<2>,  Up: Improved modules<2>

1.2.6.42 sys.monitoring
.......................

   * The *note other events: 27c. (*note PY_THROW: 27d, *note PY_UNWIND:
     27e, *note RAISE: 27f, *note EXCEPTION_HANDLED: 280, and *note
     RERAISE: 281.) can now be turned on and disabled on a per code
     object basis.  Returning *note DISABLE: 282. from a callback for
     one of these events disables the event for the entire code object
     (for the current tool), rather than raising *note ValueError: 15a.
     as in prior versions.  (Contributed by Gabriele N. Tornetta in
     gh-146182(1).)

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

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


File: python.info,  Node: tarfile<2>,  Next: threading,  Prev: sys monitoring,  Up: Improved modules<2>

1.2.6.43 tarfile
................

   * *note data_filter(): 284. 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(): 285. 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(): 286. and *note extractall(): 285. 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: 287.  (Contributed by Petr Viktorin for CVE
     2025-4330(5) and CVE 2024-12718(6).)

   * *note extract(): 286. and *note extractall(): 285. no longer
     extract rejected members when *note errorlevel(): 288. is zero.
     (Contributed by Matt Prodani and Petr Viktorin in gh-112887(7) and
     CVE 2025-4435(8).)

   * *note extract(): 286. and *note extractall(): 285. now replace
     slashes with backslashes in symlink targets on Windows to prevent
     creation of corrupted links.  (Contributed by Christoph Walcher in
     gh-57911(9).)

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

   (9) https://github.com/python/cpython/issues/57911


File: python.info,  Node: threading,  Next: timeit,  Prev: tarfile<2>,  Up: Improved modules<2>

1.2.6.44 threading
..................

   * Added *note serialize_iterator: 28a, *note synchronized_iterator():
     28b, and *note concurrent_tee(): 28c. to support concurrent access
     to generators and iterators.  (Contributed by Raymond Hettinger in
     gh-124397(1).)

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

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


File: python.info,  Node: timeit,  Next: tkinter,  Prev: threading,  Up: Improved modules<2>

1.2.6.45 timeit
...............

   * The output of the *note timeit: f8. command-line interface is
     colored by default.  This can be controlled with *note environment
     variables: 1ba.  (Contributed by Hugo van Kemenade in
     gh-146609(1).)

   * The command-line interface now colorizes error tracebacks by
     default.  This can be controlled with *note environment variables:
     1ba.  (Contributed by Yi Hong in gh-139374(2).)

   * Make the target time of *note timeit.Timer.autorange(): 28e.
     configurable and add ‘--target-time’ option to the command-line
     interface.  (Contributed by Alessandro Cucci and Miikka Koskinen in
     gh-80642(3).)

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

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

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

   (3) https://github.com/python/cpython/issues/80642


File: python.info,  Node: tkinter,  Next: tokenize,  Prev: timeit,  Up: Improved modules<2>

1.2.6.46 tkinter
................

   * The ‘tkinter.Text.search()’ method now supports two additional
     arguments: 'nolinestop' which allows the search to continue across
     line boundaries; and 'strictlimits' which restricts the search to
     within the specified range.  (Contributed by Rihaan Meher in
     gh-130848(1).)

   * A new method ‘tkinter.Text.search_all()’ has been introduced.  This
     method allows for searching for all matches of a pattern using
     Tcl's ‘-all’ and ‘-overlap’ options.  (Contributed by Rihaan Meher
     in gh-130848(2).)

   * Added new methods ‘pack_content()’, ‘place_content()’ and
     ‘grid_content()’ which use Tk commands with new names (introduced
     in Tk 8.6) instead of ‘*_slaves()’ methods which use Tk commands
     with outdated names.  (Contributed by Serhiy Storchaka in
     gh-143754(3).)

   * Added ‘Event’ attributes ‘user_data’ for Tk virtual events and
     ‘detail’ for ‘Enter’, ‘Leave’, ‘FocusIn’, ‘FocusOut’, and
     ‘ConfigureRequest’ events.  (Contributed by Matthias Kievernagel
     and Serhiy Storchaka in gh-47655(4).)

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

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

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

   (3) https://github.com/python/cpython/issues/143754

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


File: python.info,  Node: tokenize,  Next: tomllib,  Prev: tkinter,  Up: Improved modules<2>

1.2.6.47 tokenize
.................

   * The output of the *note tokenize: 104. *note command-line
     interface: 291. is colored by default.  This can be controlled with
     *note environment variables: 1ba.  (Contributed by Hugo van
     Kemenade in gh-148991(1).)

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

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


File: python.info,  Node: tomllib,  Next: types,  Prev: tokenize,  Up: Improved modules<2>

1.2.6.48 tomllib
................

   * The *note tomllib: 105. module now supports TOML 1.1.0.  This is a
     backwards compatible update, meaning that all valid TOML 1.0.0
     documents are parsed the same way.

     The changes, according to the official TOML changelog(1), are:

        - Allow newlines and trailing commas in inline tables.

          Previously an inline table had to be on a single line and
          couldn't end with a trailing comma.  This is now relaxed so
          that the following is valid:

               tbl = {
                  key      = "a string",
                  moar-tbl =  {
                     key = 1,
                  },
               }

        - Add ‘\xHH’ notation to basic strings for codepoints under 255,
          and the ‘\e’ escape for the escape character:

               null = "null byte: \x00; letter a: \x61"
               csi = "\e["

        - Seconds in datetime and time values are now optional.  The
          following are now valid:

               dt = 2010-02-03 14:15
               t  = 14:15

     (Contributed by Taneli Hukkinen in gh-142956(2).)

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

   (1) https://github.com/toml-lang/toml/blob/main/CHANGELOG.md

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


File: python.info,  Node: types,  Next: typing,  Prev: tomllib,  Up: Improved modules<2>

1.2.6.49 types
..............

   * Expose the write-through *note locals(): 296. proxy type as *note
     types.FrameLocalsProxyType: 297.  This represents the type of the
     *note frame.f_locals: 298. attribute, as described in PEP 667(1).

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

   (1) https://peps.python.org/pep-0667/


File: python.info,  Node: typing,  Next: unicodedata,  Prev: types,  Up: Improved modules<2>

1.2.6.50 typing
...............

   * PEP 747(1): Add *note TypeForm: 29a, a new special form for
     annotating values that are themselves type expressions.
     ‘TypeForm[T]’ means "a type form object describing ‘T’ (or a type
     assignable to ‘T’)".  At runtime, ‘TypeForm(x)’ simply returns ‘x’,
     which allows explicit annotation of type-form values without
     changing behavior.

     This helps libraries that accept user-provided type expressions
     (for example ‘int’, ‘str | None’, *note TypedDict: 29b. classes, or
     ‘list[int]’) expose precise signatures:

          from typing import Any, TypeForm

          def cast[T](typ: TypeForm[T], value: Any) -> T: ...

     (Contributed by Jelle Zijlstra in gh-145033(2).)

   * PEP 728(3): Add support in *note TypedDict: 29b. for the 'closed'
     and 'extra_items' class arguments.  A closed ‘TypedDict’ does not
     allow extra keys beyond those specified in the class body, while a
     ‘TypedDict’ with ‘extra_items’ allows arbitrary extra items where
     the values are of the specified type.  (Contributed by Angela Liss
     in gh-137840(4).)

   * Code like ‘class ExtraTypeVars(P1[S], Protocol[T, T2]): ...’ now
     raises a *note TypeError: 29c, because ‘S’ is not listed in
     ‘Protocol’ parameters.  (Contributed by Nikita Sobolev in
     gh-137191(5).)

   * Code like ‘class B2(A[T2], Protocol[T1, T2]): ...’ now correctly
     handles type parameters order: it is ‘(T1, T2)’, not ‘(T2, T1)’ as
     it was incorrectly inferred at runtime before.  (Contributed by
     Nikita Sobolev in gh-137191(6).)

   * PEP 800(7): Add *note @typing.disjoint_base: 29d, a new decorator
     marking a class as a disjoint base.  This is an advanced feature
     primarily intended to allow type checkers to faithfully reflect the
     runtime semantics of types defined as builtins or in compiled
     extensions.  If a class ‘C’ is a disjoint base, then child classes
     of that class cannot inherit from other disjoint bases that are not
     parent or child classes of ‘C’.  (Contributed by Jelle Zijlstra in
     gh-148639(8).)

   * *note TypeVarTuple: 29e. now accepts ‘bound’, ‘covariant’,
     ‘contravariant’, and ‘infer_variance’ keyword arguments, matching
     the interface of *note TypeVar: 29f. and *note ParamSpec: 2a0.
     ‘bound’ semantics remain undefined in the specification.

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

   (1) https://peps.python.org/pep-0747/

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

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

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

   (5) https://github.com/python/cpython/issues/137191

   (6) https://github.com/python/cpython/issues/137191

   (7) https://peps.python.org/pep-0800/

   (8) https://github.com/python/cpython/issues/148639


File: python.info,  Node: unicodedata,  Next: unittest,  Prev: typing,  Up: Improved modules<2>

1.2.6.51 unicodedata
....................

   * The Unicode database has been updated to Unicode 17.0.0.

   * Add *note unicodedata.isxidstart(): 2a2. and *note
     unicodedata.isxidcontinue(): 2a3. functions to check whether a
     character can start or continue a Unicode Standard Annex #31(1)
     identifier.  (Contributed by Stan Ulbrych in gh-129117(2).)

   * Add the *note iter_graphemes(): 2a4. function to iterate over
     grapheme clusters according to rules defined in Unicode Standard
     Annex #29, "Unicode Text Segmentation"(3).  Add *note
     grapheme_cluster_break(): 2a5, *note indic_conjunct_break(): 2a6.
     and *note extended_pictographic(): 2a7. functions to get the
     properties of the character which are related to the above
     algorithm.  (Contributed by Serhiy Storchaka and Guillaume Sanchez
     in gh-74902(4).)

   * Add *note block(): 2a8. function to return the Unicode block(5)
     assigned to a character.  (Contributed by Stan Ulbrych in
     gh-66802(6).)

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

   (1) https://www.unicode.org/reports/tr31/

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

   (3) https://www.unicode.org/reports/tr29/

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

   (5) 
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G64189

   (6) https://github.com/python/cpython/issues/66802


File: python.info,  Node: unittest,  Next: urllib parse,  Prev: unicodedata,  Up: Improved modules<2>

1.2.6.52 unittest
.................

   * *note unittest.TestCase.assertLogs(): 2aa. will now accept a
     formatter to control how messages are formatted.  (Contributed by
     Garry Cairns in gh-134567(1).)

   * *note unittest.TestCase.assertWarns(): 2ab. and *note
     unittest.TestCase.assertWarnsRegex(): 2ac. no longer swallow
     warnings that do not match the specified category or regex.  Nested
     context managers are now supported.  (Contributed by Serhiy
     Storchaka in gh-143231(2).)

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

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

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


File: python.info,  Node: urllib parse,  Next: venv,  Prev: unittest,  Up: Improved modules<2>

1.2.6.53 urllib.parse
.....................

   * Add the 'missing_as_none' parameter to *note urlsplit(): 2ae, *note
     urlparse(): 2af. and *note urldefrag(): 2b0. functions.  Add the
     'keep_empty' parameter to *note urlunsplit(): 2b1. and *note
     urlunparse(): 2b2. functions.  This allows distinguishing between
     empty and undefined URI components and preserving empty components.
     (Contributed by Serhiy Storchaka in gh-67041(1).)

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

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


File: python.info,  Node: venv,  Next: warnings,  Prev: urllib parse,  Up: Improved modules<2>

1.2.6.54 venv
.............

   * On POSIX platforms, platlib directories will be created if needed
     when creating virtual environments, instead of using a ‘lib64 ->
     lib’ symlink.  This means purelib and platlib of virtual
     environments no longer share the same ‘lib’ directory on platforms
     where *note sys.platlibdir: 2b4. is not equal to ‘lib’.
     (Contributed by Rui Xi in gh-133951(1).)

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

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


File: python.info,  Node: warnings,  Next: wave,  Prev: venv,  Up: Improved modules<2>

1.2.6.55 warnings
.................

   * Improve filtering by module in *note warnings.warn_explicit(): 2b6.
     if no 'module' argument is passed.  It now tests the module regular
     expression in the warnings filter not only against the filename
     with ‘.py’ stripped, but also against module names constructed
     starting from different parent directories of the filename (with
     ‘/__init__.py’, ‘.py’ and, on Windows, ‘.pyw’ stripped).
     (Contributed by Serhiy Storchaka in gh-135801(1).)

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

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


File: python.info,  Node: wave,  Next: webbrowser,  Prev: warnings,  Up: Improved modules<2>

1.2.6.56 wave
.............

   * Added support for IEEE floating-point WAVE audio
     (‘WAVE_FORMAT_IEEE_FLOAT’) in *note wave: 11c.

   * Added *note wave.Wave_read.getformat(): 2b8, *note
     wave.Wave_write.getformat(): 2b9, and *note
     wave.Wave_write.setformat(): 2ba. for explicit frame format
     handling.

   * *note wave.Wave_write.setparams(): 2bb. accepts both 7-item tuples
     including ‘format’ and 6-item tuples for backwards compatibility
     (defaulting to ‘WAVE_FORMAT_PCM’).

   * ‘WAVE_FORMAT_IEEE_FLOAT’ output now includes a ‘fact’ chunk, as
     required for non-PCM WAVE formats.

(Contributed by Lionel Koenig and Michiel W. Beijen in gh-60729(1).)

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

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


File: python.info,  Node: webbrowser,  Next: xml,  Prev: wave,  Up: Improved modules<2>

1.2.6.57 webbrowser
...................

   * On macOS, the new ‘webbrowser.MacOS’ class opens URLs via
     ‘/usr/bin/open’ instead of constructing and executing AppleScript
     via ‘osascript’.  The default browser is detected from the
     LaunchServices preferences file using *note plistlib: b0, with
     ‘com.apple.Safari’ as the fallback on fresh installations.  For
     non-HTTP(S) URLs, ‘open -b <bundle-id>’ is used to route the URL
     through a browser rather than the OS file handler, preventing file
     injection attacks.  (Contributed by Jeff Lyon in gh-137586(1).)

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

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


File: python.info,  Node: xml,  Next: xml parsers expat,  Prev: webbrowser,  Up: Improved modules<2>

1.2.6.58 xml
............

   * Add the *note xml.is_valid_name(): 2be. function to check whether a
     string can be used as an element or attribute name in XML.
     (Contributed by Serhiy Storchaka in gh-139489(1).)

   * Add the *note xml.is_valid_text(): 2bf. function, which allows to
     check whether a string can be used in the XML document.
     (Contributed by Serhiy Storchaka in gh-139489(2).)

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

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

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


File: python.info,  Node: xml parsers expat,  Next: zlib,  Prev: xml,  Up: Improved modules<2>

1.2.6.59 xml.parsers.expat
..........................

   * Add *note SetAllocTrackerActivationThreshold(): 2c1. and *note
     SetAllocTrackerMaximumAmplification(): 2c2. to *note xmlparser:
     2c3. objects to tune protections against disproportional amounts of
     dynamic memory usage from within an Expat parser.  (Contributed by
     Bénédikt Tran in gh-90949(1).)

   * Add *note SetBillionLaughsAttackProtectionActivationThreshold():
     2c4. and *note
     SetBillionLaughsAttackProtectionMaximumAmplification(): 2c5. to
     *note xmlparser: 2c3. objects to tune protections against billion
     laughs(2) attacks.  (Contributed by Bénédikt Tran in gh-90949(3).)

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

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

   (2) https://en.wikipedia.org/wiki/Billion_laughs_attack

   (3) https://github.com/python/cpython/issues/90949


File: python.info,  Node: zlib,  Prev: xml parsers expat,  Up: Improved modules<2>

1.2.6.60 zlib
.............

   * Allow combining two Adler-32 checksums via *note adler32_combine():
     2c7.  (Contributed by Callum Attryde and Bénédikt Tran in
     gh-134635(1).)

   * Allow combining two CRC-32 checksums via *note crc32_combine():
     2c8.  (Contributed by Bénédikt Tran in gh-134635(2).)

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

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

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


File: python.info,  Node: Optimizations<2>,  Next: Removed<2>,  Prev: Improved modules<2>,  Up: What's new in Python 3 15

1.2.7 Optimizations
-------------------

   * ‘mimalloc’ is now used as the default allocator for raw memory
     allocations such as via *note PyMem_RawMalloc(): 2ca. for better
     performance on *note free-threaded builds: 1a3.  (Contributed by
     Kumar Aditya in gh-144914(1).)

* Menu:

* base64 & binascii::
* csv::
* Upgraded JIT compiler::

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

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


File: python.info,  Node: base64 & binascii,  Next: csv,  Up: Optimizations<2>

1.2.7.1 base64 & binascii
.........................

   * CPython's underlying base64 implementation now encodes 2x faster
     and decodes 3x faster thanks to simple CPU pipelining
     optimizations.  (Contributed by Gregory P. Smith and Serhiy
     Storchaka in gh-143262(1).)

   * Implementation for Ascii85, Base85, and Z85 encoding has been
     rewritten in C. Encoding and decoding is now two orders of
     magnitude faster and consumes two orders of magnitude less memory.
     (Contributed by James Seo and Serhiy Storchaka in gh-101178(2).)

   * Implementation for Base32 has been rewritten in C. Encoding and
     decoding is now two orders of magnitude faster.  (Contributed by
     James Seo in gh-146192(3).)

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

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

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

   (3) https://github.com/python/cpython/issues/146192


File: python.info,  Node: csv,  Next: Upgraded JIT compiler,  Prev: base64 & binascii,  Up: Optimizations<2>

1.2.7.2 csv
...........

   * *note csv.Sniffer.sniff(): 2cd. delimiter detection is now up to
     1.6x faster.  (Contributed by Maurycy Pawłowski-Wieroński in
     gh-137628(1).)

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

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


File: python.info,  Node: Upgraded JIT compiler,  Prev: csv,  Up: Optimizations<2>

1.2.7.3 Upgraded JIT compiler
.............................

Results from the pyperformance(1) benchmark suite report 8-9%(2)
geometric mean performance improvement for the JIT over the standard
CPython interpreter built with all optimizations enabled on x86-64
Linux.  On AArch64 macOS, the JIT has a 12-13%(3) speedup over the *note
tail calling interpreter: 2cf. with all optimizations enabled.  The
speedups for JIT builds versus no JIT builds range from roughly 15%
slowdown to over 100% speedup (ignoring the ‘unpack_sequence’
microbenchmark) on x86-64 Linux and AArch64 macOS systems.

     注意: These results are not yet final.

The major upgrades to the JIT are:

   * LLVM 21 build-time dependency

   * New tracing frontend

   * Basic register allocation in the JIT

   * More JIT optimizations

   * GDB and GNU ‘backtrace()’ unwinding support

   * Better machine code generation

LLVM 21 build-time dependency
.............................

The JIT compiler now uses LLVM 21 for build-time stencil generation.  As
always, LLVM is only needed when building CPython with the JIT enabled;
end users running Python do not need LLVM installed.  Instructions for
installing LLVM can be found in the JIT compiler documentation(4) for
all supported platforms.  (Contributed by Savannah Ostrowski in
gh-140973(5).)

A new tracing frontend
......................

The JIT compiler now supports significantly more bytecode operations and
control flow than in Python 3.14, enabling speedups on a wider variety
of code.  For example, simple Python object creation is now understood
by the 3.15 JIT compiler.  Overloaded operations and generators are also
partially supported.  This was made possible by an overhauled JIT
tracing frontend that records actual execution paths through code,
rather than estimating them as the previous implementation did.
(Contributed by Ken Jin in gh-139109(6).  Support for Windows added by
Mark Shannon in gh-141703(7).)

Basic register allocation in the JIT
....................................

A basic form of register allocation has been added to the JIT compiler's
optimizer.  This allows the JIT compiler to avoid certain stack
operations altogether and instead operate on registers.  This allows the
JIT to produce more efficient traces by avoiding reads and writes to
memory.  (Contributed by Mark Shannon in gh-135379(8).)

More JIT optimizations
......................

More constant-propagation(9) is now performed.  This means when the JIT
compiler detects that certain user code results in constants, the code
can be simplified by the JIT. (Contributed by Ken Jin and Savannah
Ostrowski in gh-132732(10).)

*note Reference count: 2d0.s are avoided whenever it is safe to do so.
This generally reduces the cost of most operations in Python.
(Contributed by Ken Jin, Donghee Na, Zheao Li, Hai Zhu, Savannah
Ostrowski, Reiden Ong, Noam Cohen, Tomas Roun, PuQing, Cajetan
Rodrigues, and Sacul in gh-134584(11).)

By tracking unique references to objects, the JIT optimizer can now
eliminate reference count updates and perform in-place operations on
ints and floats.  (Contributed by Reiden Ong, and Pieter Eendebak in
gh-143414(12) and gh-146306(13).)

The JIT optimizer now supports significantly more operations than in
3.14.  (Contributed by Kumar Aditya, Ken Jin, Jiahao Li, and Sacul in
gh-131798(14).)

GDB and GNU ‘backtrace()’ unwinding support
...........................................

The JIT compiler now publishes unwind information for generated machine
code to the GDB interface on supported Linux ELF platforms.  When libgcc
frame registration is available, the same unwind information is also
registered for GNU ‘backtrace()’ stack walkers.  This allows native
debuggers, crash handlers, and diagnostic tools using these mechanisms
to unwind through JIT frames instead of stopping at generated code.
(Contributed by Diego Russo and Pablo Galindo Salgado in gh-146071(15)
and gh-149104(16).)

Better machine code generation
..............................

The JIT compiler's machine code generator now produces better machine
code for x86-64 and AArch64 macOS and Linux targets.  In general, users
should experience lower memory usage for generated machine code and more
efficient machine code versus 3.14.  (Contributed by Brandt Bucher in
gh-136528(17) and gh-135905(18).  Implementation for AArch64 contributed
by Mark Shannon in gh-139855(19).  Additional optimizations for AArch64
contributed by Mark Shannon and Diego Russo in gh-140683(20) and
gh-142305(21).)

Maintainability
...............

The JIT optimizer's operations have been simplified.  This was made
possible by a refactoring of JIT data structures.  (Contributed by
Zhongtian Zheng in gh-148211(22) and Hai Zhu in gh-143421(23).)

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

   (1) https://github.com/python/pyperformance

   (2) https://www.doesjitgobrrr.com/run/2026-04-29

   (3) https://www.doesjitgobrrr.com/run/2026-04-29

   (4) https://github.com/python/cpython/blob/main/Tools/jit/README.md

   (5) https://github.com/python/cpython/issues/140973

   (6) https://github.com/python/cpython/issues/139109

   (7) https://github.com/python/cpython/issues/141703

   (8) https://github.com/python/cpython/issues/135379

   (9) https://en.wikipedia.org/wiki/Constant_folding

   (10) https://github.com/python/cpython/issues/132732

   (11) https://github.com/python/cpython/issues/134584

   (12) https://github.com/python/cpython/issues/143414

   (13) https://github.com/python/cpython/issues/146306

   (14) https://github.com/python/cpython/issues/131798

   (15) https://github.com/python/cpython/issues/146071

   (16) https://github.com/python/cpython/issues/149104

   (17) https://github.com/python/cpython/issues/136528

   (18) https://github.com/python/cpython/issues/135905

   (19) https://github.com/python/cpython/issues/139855

   (20) https://github.com/python/cpython/issues/140683

   (21) https://github.com/python/cpython/issues/142305

   (22) https://github.com/python/cpython/issues/148211

   (23) https://github.com/python/cpython/issues/143421


File: python.info,  Node: Removed<2>,  Next: Deprecated<2>,  Prev: Optimizations<2>,  Up: What's new in Python 3 15

1.2.8 Removed
-------------

* Menu:

* ast: ast<2>.
* collections.abc: collections abc.
* ctypes::
* datetime::
* glob::
* http.server: http server<2>.
* importlib.resources: importlib resources.
* pathlib::
* platform::
* sre_*::
* sysconfig: sysconfig<2>.
* threading: threading<2>.
* types: types<2>.
* typing: typing<2>.
* wave: wave<2>.
* zipimport::


File: python.info,  Node: ast<2>,  Next: collections abc,  Up: Removed<2>

1.2.8.1 ast
...........

   * The constructors of *note AST nodes: 2d3. now raise a *note
     TypeError: 29c. when a required argument is omitted or when a
     keyword argument that does not map to a field on the AST node is
     passed.  These cases had previously raised a *note
     DeprecationWarning: 2d4. since Python 3.13.  (Contributed by Brian
     Schubert and Jelle Zijlstra in gh-137600(1) and gh-105858(2).)

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

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

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


File: python.info,  Node: collections abc,  Next: ctypes,  Prev: ast<2>,  Up: Removed<2>

1.2.8.2 collections.abc
.......................

   * *note collections.abc.ByteString: 2d6. has been removed from
     ‘collections.abc.__all__’.  ‘collections.abc.ByteString’ has been
     deprecated since Python 3.12, and is scheduled for removal in
     Python 3.17.


File: python.info,  Node: ctypes,  Next: datetime,  Prev: collections abc,  Up: Removed<2>

1.2.8.3 ctypes
..............

   * Removed the undocumented function ‘ctypes.SetPointerType()’, which
     has been deprecated since Python 3.13.  (Contributed by Bénédikt
     Tran in gh-133866(1).)

   * Change the *note _type_: 2d8. of *note c_float_complex: 2d9, *note
     c_double_complex: 2da. and *note c_longdouble_complex: 2db. from
     ‘F’, ‘D’ and ‘G’ to ‘Zf’, ‘Zd’ and ‘Zg’ for compatibility with
     numpy.  (Contributed by Victor Stinner in gh-148675(2).)

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

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

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


File: python.info,  Node: datetime,  Next: glob,  Prev: ctypes,  Up: Removed<2>

1.2.8.4 datetime
................

   * *note strptime(): 2dd. now raises *note ValueError: 15a. when the
     format string contains ‘%d’ (day of month) without a year
     directive.  This has been deprecated since Python 3.13.
     (Contributed by Stan Ulbrych and Gregory P. Smith in gh-70647(1).)

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

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


File: python.info,  Node: glob,  Next: http server<2>,  Prev: datetime,  Up: Removed<2>

1.2.8.5 glob
............

   * Removed the undocumented ‘glob.glob0()’ and ‘glob.glob1()’
     functions, which have been deprecated since Python 3.13.  Use *note
     glob.glob(): 2df. and pass a directory to its 'root_dir' argument
     instead.  (Contributed by Barney Gale in gh-137466(1).)

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

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


File: python.info,  Node: http server<2>,  Next: importlib resources,  Prev: glob,  Up: Removed<2>

1.2.8.6 http.server
...................

   * Removed the ‘CGIHTTPRequestHandler’ class and the ‘--cgi’ flag from
     the ‘python -m http.server’ command-line interface.  They were
     deprecated in Python 3.13.  (Contributed by Bénédikt Tran in
     gh-133810(1).)

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

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


File: python.info,  Node: importlib resources,  Next: pathlib,  Prev: http server<2>,  Up: Removed<2>

1.2.8.7 importlib.resources
...........................

   * Removed deprecated ‘package’ parameter from *note
     importlib.resources.files(): 2e2. function.  (Contributed by Semyon
     Moroz in gh-138044(1).)

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

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


File: python.info,  Node: pathlib,  Next: platform,  Prev: importlib resources,  Up: Removed<2>

1.2.8.8 pathlib
...............

   * *note pathlib.Path.mkdir(): 2e4. now has a 'parent_mode' parameter
     that allows specifying the mode for intermediate directories when
     ‘parents=True’.  (Contributed by Gregory P. Smith in gh-86533(1).)

   * Removed deprecated ‘pathlib.PurePath.is_reserved()’.  Use *note
     os.path.isreserved(): 2e5. to detect reserved paths on Windows.
     (Contributed by Nikita Sobolev in gh-133875(2).)

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

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

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


File: python.info,  Node: platform,  Next: sre_*,  Prev: pathlib,  Up: Removed<2>

1.2.8.9 platform
................

   * Removed the ‘platform.java_ver()’ function, which was deprecated
     since Python 3.13.  (Contributed by Alexey Makridenko in
     gh-133604(1).)

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

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


File: python.info,  Node: sre_*,  Next: sysconfig<2>,  Prev: platform,  Up: Removed<2>

1.2.8.10 sre_*
..............

   * Removed ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.
     (Contributed by Stan Ulbrych in gh-135994(1).)

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

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


File: python.info,  Node: sysconfig<2>,  Next: threading<2>,  Prev: sre_*,  Up: Removed<2>

1.2.8.11 sysconfig
..................

   * Removed the 'check_home' parameter of *note
     sysconfig.is_python_build(): 2e9.  (Contributed by Filipe Laíns in
     gh-92897(1).)

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

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


File: python.info,  Node: threading<2>,  Next: types<2>,  Prev: sysconfig<2>,  Up: Removed<2>

1.2.8.12 threading
..................

   * Remove support for arbitrary positional or keyword arguments in the
     C implementation of *note RLock: 2eb. objects.  This was deprecated
     in Python 3.14.  (Contributed by Bénédikt Tran in gh-134087(1).)

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

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


File: python.info,  Node: types<2>,  Next: typing<2>,  Prev: threading<2>,  Up: Removed<2>

1.2.8.13 types
..............

   * Removed deprecated in PEP 626(1) since Python 3.12
     ‘codeobject.co_lnotab’ from *note types.CodeType: 2ed.
     (Contributed by Nikita Sobolev in gh-134690(2).)

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

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

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


File: python.info,  Node: typing<2>,  Next: wave<2>,  Prev: types<2>,  Up: Removed<2>

1.2.8.14 typing
...............

   * *note typing.ByteString: 2ef. has been removed from
     ‘typing.__all__’.  ‘typing.ByteString’ has been deprecated since
     Python 3.9, and is scheduled for removal in Python 3.17.

   * The undocumented keyword argument syntax for creating *note
     NamedTuple: 2f0. classes (for example, ‘Point = NamedTuple("Point",
     x=int, y=int)’) is no longer supported.  Use the class-based syntax
     or the functional syntax instead.  (Contributed by Bénédikt Tran in
     gh-133817(1).)

   * Using ‘TD = TypedDict("TD")’ or ‘TD = TypedDict("TD", None)’ to
     construct a *note TypedDict: 29b. type with zero fields is no
     longer supported.  Use ‘class TD(TypedDict): pass’ or ‘TD =
     TypedDict("TD", {})’ instead.  (Contributed by Bénédikt Tran in
     gh-133823(2).)

   * Deprecated ‘typing.no_type_check_decorator()’ has been removed.
     (Contributed by Nikita Sobolev in gh-133601(3).)

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

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

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

   (3) https://github.com/python/cpython/issues/133601


File: python.info,  Node: wave<2>,  Next: zipimport,  Prev: typing<2>,  Up: Removed<2>

1.2.8.15 wave
.............

   * Removed the ‘getmark()’, ‘setmark()’ and ‘getmarkers()’ methods of
     the *note Wave_read: 2f2. and *note Wave_write: 2f3. classes, which
     were deprecated since Python 3.13.  (Contributed by Bénédikt Tran
     in gh-133873(1).)

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

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


File: python.info,  Node: zipimport,  Prev: wave<2>,  Up: Removed<2>

1.2.8.16 zipimport
..................

   * Remove deprecated ‘zipimport.zipimporter.load_module()’.  Use *note
     zipimport.zipimporter.exec_module(): 2f5. instead.  (Contributed by
     Jiahao Li in gh-133656(1).)

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

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


File: python.info,  Node: Deprecated<2>,  Next: C API changes<2>,  Prev: Removed<2>,  Up: What's new in Python 3 15

1.2.9 Deprecated
----------------

* Menu:

* New deprecations::
* 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 Python 3.20: Pending removal in Python 3 20.
* Pending removal in future versions::
* Soft deprecations::


File: python.info,  Node: New deprecations,  Next: Pending removal in Python 3 16,  Up: Deprecated<2>

1.2.9.1 New deprecations
........................

   * *note ast: 9.

        * Creating instances of abstract AST nodes (such as *note
          ast.AST: 2f8. or ‘ast.expr’) is deprecated and will raise an
          error in Python 3.20.

          (Contributed by Brian Schubert in gh-116021(1).)

   * *note base64: f.:

        * Accepting the ‘+’ and ‘/’ characters with an alternative
          alphabet in *note b64decode(): 1f7. and *note
          urlsafe_b64decode(): 1f9. is now deprecated.  In future Python
          versions they will be errors in the strict mode and discarded
          in the non-strict mode.  (Contributed by Serhiy Storchaka in
          gh-125346(2).)

   * CLI:

        * Deprecate *note -b: 2f9. and ‘-bb’ command-line options and
          schedule them to become no-ops in Python 3.17.  These were
          primarily helpers for the Python 2 -> 3 transition.  Starting
          with Python 3.17, no *note BytesWarning: 2fa. will be raised
          for these cases; use a type checker instead.

          (Contributed by Nikita Sobolev in gh-136355(3).)

   * *note collections.abc: 1f.

        * The following statements now cause ‘DeprecationWarning’s to be
          emitted at runtime:

             * ‘from collections.abc import ByteString’

             * ‘import collections.abc; collections.abc.ByteString’.

          ‘DeprecationWarning’s were already emitted if *note
          collections.abc.ByteString: 2d6. was subclassed or used as the
          second argument to *note isinstance(): 2fb. or *note
          issubclass(): 2fc, but warnings were not previously emitted if
          it was merely imported or accessed from the ‘collections.abc’
          module.

   * *note hashlib: 6b.:

        * In hash function constructors such as *note new(): 2fd. or the
          direct hash-named constructors such as *note md5(): 2fe. and
          *note sha256(): 2ff, the optional initial data parameter could
          also be passed as a keyword argument named ‘data=’ or
          ‘string=’ in various *note hashlib: 6b. implementations.

          Support for the ‘string’ keyword argument name is now
          deprecated and is slated for removal in Python 3.19.  Prefer
          passing the initial data as a positional argument for maximum
          backwards compatibility.

          (Contributed by Bénédikt Tran in gh-134978(4).)

   * *note http.cookies: 74.:

        * *note Morsel.js_output: 300. and *note BaseCookie.js_output:
          301. are deprecated and will be removed in Python 3.19.  Use
          *note Morsel.output: 302. or *note BaseCookie.output: 303.
          instead.  (Contributed by kishorhange111 in gh-148849(5).)

   * *note imaplib: 77.:

        * Altering *note IMAP4.file: 304. is now deprecated and slated
          for removal in Python 3.19.  This property is now unused and
          changing its value does 'not' explicitly close the current
          file.

   * *note re: c1.:

        * *note re.match(): 258. and *note re.Pattern.match(): 259. are
          now *note soft deprecated: 1b2. in favor of the new *note
          re.prefixmatch(): 256. and *note re.Pattern.prefixmatch():
          257. APIs, which have been added as alternate, more explicit
          names.  These are intended to be used to alleviate confusion
          around what 'match' means by following the Zen of Python's
          '"Explicit is better than implicit"' mantra.  Most other
          language regular expression libraries use an API named 'match'
          to mean what Python has always called 'search'.

          We 'do not' plan to remove the older ‘match()’ name, as it has
          been used in code for over 30 years.  Code supporting older
          versions of Python should continue to use ‘match()’, while new
          code should prefer ‘prefixmatch()’.  See *note prefixmatch()
          vs.  match(): 305.

          (Contributed by Gregory P. Smith in gh-86519(6) and Hugo van
          Kemenade in gh-148100(7).)

   * *note struct: de.:

        * Calling ‘Struct.__new__()’ without a required argument is now
          deprecated and will be removed in Python 3.20.  Calling the
          *note __init__(): 306. method on an initialized *note Struct:
          307. object is deprecated and will be removed in Python 3.20.

          (Contributed by Sergey B Kirpichev and Serhiy Storchaka in
          gh-143715(8).)

   * *note typing: 10d.:

        * The following statements now cause ‘DeprecationWarning’s to be
          emitted at runtime:

             * ‘from typing import ByteString’

             * ‘import typing; typing.ByteString’.

          ‘DeprecationWarning’s were already emitted if *note
          typing.ByteString: 2ef. was subclassed or used as the second
          argument to *note isinstance(): 2fb. or *note issubclass():
          2fc, but warnings were not previously emitted if it was merely
          imported or accessed from the ‘typing’ module.

   * *note webbrowser: 11e.:

        * ‘webbrowser.MacOSXOSAScript’ is deprecated in favour of
          ‘webbrowser.MacOS’ and scheduled for removal in Python 3.17.
          (Contributed by Jeff Lyon in gh-137586(9).)

   * ‘__version__’

        * The ‘__version__’, ‘version’ and ‘VERSION’ attributes have
          been deprecated in these standard library modules and will be
          removed in Python 3.20.  Use *note sys.version_info: 308.
          instead.

             - *note argparse: 7.

             - *note csv: 2c.

             - *note ctypes: 2d.

             - ‘ctypes.macholib’

             - *note decimal: 39. (use *note decimal.SPEC_VERSION: 309.
               instead)

             - *note http.server: 75.

             - *note imaplib: 77.

             - *note ipaddress: 83.

             - *note json: 85.

             - *note logging: 8a. (‘__date__’ also deprecated)

             - *note optparse: a4.

             - *note pickle: ab.

             - *note platform: af.

             - *note re: c1.

             - *note socketserver: d5.

             - *note tabnanny: e6.

             - *note tarfile: e7.

             - *note tkinter.font: fe.

             - *note tkinter.ttk: 102.

             - *note wsgiref.simple_server: 124.

             - *note xml.etree.ElementTree: 12e.

             - ‘xml.sax.expatreader’

             - *note xml.sax.handler: 133.

             - *note zlib: 13c.

          (Contributed by Hugo van Kemenade and Stan Ulbrych in
          gh-76007(10).)

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

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

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

   (3) https://github.com/python/cpython/issues/136355

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

   (5) https://github.com/python/cpython/issues/148849

   (6) https://github.com/python/cpython/issues/86519

   (7) https://github.com/python/cpython/issues/148100

   (8) https://github.com/python/cpython/issues/143715

   (9) https://github.com/python/cpython/issues/137586

   (10) https://github.com/python/cpython/issues/76007


File: python.info,  Node: Pending removal in Python 3 16,  Next: Pending removal in Python 3 17,  Prev: New deprecations,  Up: Deprecated<2>

1.2.9.2 Pending removal in Python 3.16
......................................

   * The import system:

        * Setting *note __loader__: 30b. on a module while failing to
          set *note __spec__.loader: 30c. 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: 30d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 154. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 314. or *note
          asyncio.Runner: 315. 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: 62.:

        * Calling the Python implementation of *note functools.reduce():
          156. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8a.:

        * 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(): 159.  Undotted extensions are
          deprecated and will raise a *note ValueError: 15a. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: cd.:

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

   * *note symtable: e1.:

        * The ‘symtable.Class.get_methods()’ method has been deprecated
          since Python 3.14.

   * *note sys: e2.:

        * The ‘_enablelegacywindowsfsencoding()’ function has been
          deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 15e. environment variable
          instead.

   * *note sysconfig: e4.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 160. instead.

   * *note tarfile: e7.:

        * The undocumented and unused ‘TarInfo.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: Deprecated<2>

1.2.9.3 Pending removal in Python 3.17
......................................

   * *note datetime: 33.:

        * *note strptime(): 2dd. calls using a format string containing
          ‘%e’ (day of month) without a year.  This has been deprecated
          since Python 3.15.  (Contributed by Stan Ulbrych in
          gh-70647(1).)

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 2d6. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(2) for more details.  (Contributed by Shantanu
          Jain in gh-91896(3).)

   * *note encodings: 54.:

        - Passing non-ascii 'encoding' names to *note
          encodings.normalize_encoding(): 31b. is deprecated and
          scheduled for removal in Python 3.17.  (Contributed by Stan
          Ulbrych in gh-136702(4).)

   * *note webbrowser: 11e.:

        - ‘webbrowser.MacOSXOSAScript’ is deprecated in favour of
          ‘webbrowser.MacOS’.  (gh-137586(5))

   * *note typing: 10d.:

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

        - *note typing.ByteString: 2ef, 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: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(6) for more details.  (Contributed by Shantanu
          Jain in gh-91896(7).)

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

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

   (2) https://peps.python.org/pep-0688/#current-options

   (3) https://github.com/python/cpython/issues/91896

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

   (5) https://github.com/python/cpython/issues/137586

   (6) https://peps.python.org/pep-0688/#current-options

   (7) 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: Deprecated<2>

1.2.9.4 Pending removal in Python 3.18
......................................

   * No longer accept a boolean value when a file descriptor is
     expected.  (Contributed by Serhiy Storchaka in gh-82626(1).)

   * *note decimal: 39.:

        * The non-standard and undocumented *note Decimal: 1cd. 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(2).)

   * Deprecations defined by PEP 829(3):

        * ‘import’ lines in ‘`name'.pth’ files are silently ignored.

     (Contributed by Barry Warsaw in gh-148641(4).)

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

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

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

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

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


File: python.info,  Node: Pending removal in Python 3 19,  Next: Pending removal in Python 3 20,  Prev: Pending removal in Python 3 18,  Up: Deprecated<2>

1.2.9.5 Pending removal in Python 3.19
......................................

   * *note ctypes: 2d.:

        * Implicitly switching to the MSVC-compatible struct layout by
          setting *note _pack_: 320. but not *note _layout_: 321. on
          non-Windows platforms.

   * *note hashlib: 6b.:

        - In hash function constructors such as *note new(): 2fd. or the
          direct hash-named constructors such as *note md5(): 2fe. and
          *note sha256(): 2ff, their optional initial data parameter
          could also be passed a keyword argument named ‘data=’ or
          ‘string=’ in various ‘hashlib’ implementations.

          Support for the ‘string’ keyword argument name is now
          deprecated and slated for removal in Python 3.19.

          Before Python 3.13, the ‘string’ keyword parameter was not
          correctly supported depending on the backend implementation of
          hash functions.  Prefer passing the initial data as a
          positional argument for maximum backwards compatibility.

   * *note http.cookies: 74.:

        * *note http.cookies.Morsel.js_output(): 300. is deprecated and
          will be removed in Python 3.19.

        * *note http.cookies.BaseCookie.js_output(): 301. is deprecated
          and will be removed in Python 3.19.

   * *note imaplib: 77.:

        * Altering *note IMAP4.file: 304. is now deprecated and slated
          for removal in Python 3.19.  This property is now unused and
          changing its value does not automatically close the current
          file.

          Before Python 3.14, this property was used to implement the
          corresponding ‘read()’ and ‘readline()’ methods for *note
          IMAP4: 322. but this is no longer the case since then.


File: python.info,  Node: Pending removal in Python 3 20,  Next: Pending removal in future versions,  Prev: Pending removal in Python 3 19,  Up: Deprecated<2>

1.2.9.6 Pending removal in Python 3.20
......................................

   * Calling the ‘__new__()’ method of *note struct.Struct: 307. without
     the 'format' argument is deprecated and will be removed in Python
     3.20.  Calling *note __init__(): 306. method on initialized
     ‘Struct’ objects is deprecated and will be removed in Python 3.20.

     (Contributed by Sergey B Kirpichev and Serhiy Storchaka in
     gh-143715(1).)

   * The ‘__version__’, ‘version’ and ‘VERSION’ attributes have been
     deprecated in these standard library modules and will be removed in
     Python 3.20.  Use *note sys.version_info: 308. instead.

        - *note argparse: 7.

        - *note csv: 2c.

        - *note ctypes: 2d.

        - ‘ctypes.macholib’

        - *note decimal: 39. (use *note decimal.SPEC_VERSION: 309.
          instead)

        - *note http.server: 75.

        - *note imaplib: 77.

        - *note ipaddress: 83.

        - *note json: 85.

        - *note logging: 8a. (‘__date__’ also deprecated)

        - *note optparse: a4.

        - *note pickle: ab.

        - *note platform: af.

        - *note re: c1.

        - *note socketserver: d5.

        - *note tabnanny: e6.

        - *note tarfile: e7.

        - *note tkinter.font: fe.

        - *note tkinter.ttk: 102.

        - *note wsgiref.simple_server: 124.

        - *note xml.etree.ElementTree: 12e.

        - ‘xml.sax.expatreader’

        - *note xml.sax.handler: 133.

        - *note zlib: 13c.

     (Contributed by Hugo van Kemenade and Stan Ulbrych in gh-76007(2).)

   * Deprecations defined by PEP 829(3):

        * Warnings are produced for ‘import’ lines found in ‘`name'.pth’
          files.

        * ‘`name'.pth’ files are no longer decoded in the locale
          encoding by default.  They 'MUST' be encoded in ‘utf-8-sig’.

     (Contributed by Barry Warsaw in gh-148641(4).)

   * *note ast: 9.:

        * Creating instances of abstract AST nodes (such as *note
          ast.AST: 2f8. or ‘ast.expr’) is deprecated and will raise an
          error in Python 3.20.

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

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

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

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

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


File: python.info,  Node: Pending removal in future versions,  Next: Soft deprecations,  Prev: Pending removal in Python 3 20,  Up: Deprecated<2>

1.2.9.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(): 325. is now deprecated.

        * The *note argparse.FileType: 326. 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:
          327, *note else: 328, *note for: 329, *note if: 32a, *note in:
          32b, *note is: 32c. and *note or: 32d.  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: 32e.

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

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 330.: 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(): 330. 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:
     331. and *note calendar.FEBRUARY: 332.  (Contributed by Prince
     Roshan in gh-103636(3).)

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

   * ‘codeobject.co_lnotab’: use the *note codeobject.co_lines(): 335.
     method instead.

   * *note datetime: 33.:

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

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

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

   * *note importlib: 7a.:

        * *note cache_from_source(): 338. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7d.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8a.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 339. instead.

   * *note mailbox: 8e.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 33a. in a
     multi-threaded process.

   * *note os.path: a6.: *note os.path.commonprefix(): 33b. is
     deprecated, use *note os.path.commonpath(): 33c. for path prefixes.
     The ‘os.path.commonprefix()’ function is being deprecated due to
     having a misleading name and module.  The function is not safe to
     use for path prefixes despite being included in a module about path
     manipulation, meaning it is easy to accidentally introduce path
     traversal vulnerabilities into Python programs by using this
     function.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: c1.: 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).)

   * *note shutil: cd.: *note rmtree(): 33d.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d8. options and protocols:

        * *note ssl.SSLContext: 33e. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 33e.: *note set_npn_protocols(): 33f.
          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: f6. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          340.

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

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 342.: use *note
          threading.Thread.daemon: 343. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 344.: use *note
          threading.Thread.name: 345. attribute.

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

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

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

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

   * *note urllib.parse: 113. deprecated functions: *note urlparse():
     2af. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

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

   * *note xml.etree.ElementTree: 12e.: Testing the truth value of an
     *note Element: 34b. 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(): 34c. is deprecated: use *note
     sys._clear_internal_caches(): 34d. 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: Soft deprecations,  Prev: Pending removal in future versions,  Up: Deprecated<2>

1.2.9.8 Soft deprecations
.........................

There are no plans to remove *note soft deprecated: 1b2. APIs.

   * *note re.match(): 258. and *note re.Pattern.match(): 259. are now
     *note soft deprecated: 1b2. in favor of the new *note
     re.prefixmatch(): 256. and *note re.Pattern.prefixmatch(): 257.
     APIs, which have been added as alternate, more explicit names.
     These are intended to be used to alleviate confusion around what
     'match' means by following the Zen of Python's '"Explicit is better
     than implicit"' mantra.  Most other language regular expression
     libraries use an API named 'match' to mean what Python has always
     called 'search'.

     We 'do not' plan to remove the older ‘match()’ name, as it has been
     used in code for over 30 years.  Code supporting older versions of
     Python should continue to use ‘match()’, while new code should
     prefer ‘prefixmatch()’.  See *note prefixmatch() vs.  match(): 305.

     (Contributed by Gregory P. Smith in gh-86519(1) and Hugo van
     Kemenade in gh-148100(2).)

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

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

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


File: python.info,  Node: C API changes<2>,  Next: Build changes<2>,  Prev: Deprecated<2>,  Up: What's new in Python 3 15

1.2.10 C API changes
--------------------

* Menu:

* New features: New features<4>.
* Changed C APIs::
* Removed C APIs: Removed C APIs<2>.
* Deprecated C APIs: Deprecated C APIs<2>.


File: python.info,  Node: New features<4>,  Next: Changed C APIs,  Up: C API changes<2>

1.2.10.1 New features
.....................

   * Add *note PyArg_ParseArray(): 351. and *note
     PyArg_ParseArrayAndKeywords(): 352. functions to parse arguments of
     functions using the *note METH_FASTCALL: 353. calling convention.
     (Contributed by Victor Stinner in gh-144175(1).)

   * Add the following functions for the new *note frozendict: 18d.
     type:

        * *note PyAnyDict_Check(): 354.

        * *note PyAnyDict_CheckExact(): 355.

        * *note PyFrozenDict_Check(): 356.

        * *note PyFrozenDict_CheckExact(): 357.

        * *note PyFrozenDict_New(): 358.

     (Contributed by Victor Stinner in gh-141510(2).)

   * Add *note PyObject_CallFinalizerFromDealloc(): 359. function to the
     limited C API. (Contributed by Victor Stinner in gh-146063(3).)

   * Add *note PySys_GetAttr(): 35a, *note PySys_GetAttrString(): 35b,
     *note PySys_GetOptionalAttr(): 35c, and *note
     PySys_GetOptionalAttrString(): 35d. functions as replacements for
     *note PySys_GetObject(): 35e.  (Contributed by Serhiy Storchaka in
     gh-108512(4).)

   * Add *note PyUnstable_Unicode_GET_CACHED_HASH: 35f. to get the
     cached hash of a string.  See the documentation for caveats.
     (Contributed by Petr Viktorin in gh-131510(5).)

   * Add API for checking an extension module's ABI compatibility: *note
     Py_mod_abi: 360, *note PyABIInfo_Check(): 361, and *note
     PyABIInfo_VAR: 362.  (Contributed by Petr Viktorin in
     gh-137210(6).)

   * Implement PEP 782(7), the *note PyBytesWriter API: 363.  Add
     functions:

        * *note PyBytesWriter_Create(): 364.

        * *note PyBytesWriter_Discard(): 365.

        * *note PyBytesWriter_FinishWithPointer(): 366.

        * *note PyBytesWriter_FinishWithSize(): 367.

        * *note PyBytesWriter_Finish(): 368.

        * *note PyBytesWriter_Format(): 369.

        * *note PyBytesWriter_GetData(): 36a.

        * *note PyBytesWriter_GetSize(): 36b.

        * *note PyBytesWriter_GrowAndUpdatePointer(): 36c.

        * *note PyBytesWriter_Grow(): 36d.

        * *note PyBytesWriter_Resize(): 36e.

        * *note PyBytesWriter_WriteBytes(): 36f.

     (Contributed by Victor Stinner in gh-129813(8).)

   * *note PyCriticalSection: 370. and related functions are added to
     the Stable ABI.

     (Contributed in gh-149227(9).)

   * Add a new *note PyImport_CreateModuleFromInitfunc(): 371. C-API for
     creating a module from a 'spec' and 'initfunc'.  (Contributed by
     Itamar Oren in gh-116146(10).)

   * Add *note PyTuple_FromArray(): 372. to create a *note tuple: 1d9.
     from an array.  (Contributed by Victor Stinner in gh-111489(11).)

   * Add a new module export hook, *note PyModExport_*: 1a7.

     (Contributed by Petr Viktorin in PEP 793(12) and gh-140550(13).)

   * Add functions that are guaranteed to be safe for use in *note
     tp_traverse: 373. handlers: *note PyObject_GetTypeData_DuringGC():
     374, *note PyObject_GetItemData_DuringGC(): 375, *note
     PyType_GetModuleState_DuringGC(): 376, *note
     PyModule_GetState_DuringGC(): 377, *note
     PyModule_GetToken_DuringGC(): 378, *note
     PyType_GetBaseByToken_DuringGC(): 379, *note
     PyType_GetModule_DuringGC(): 37a, *note
     PyType_GetModuleByToken_DuringGC(): 37b.  (Contributed by Petr
     Viktorin in gh-145925(14).)

   * Add *note PyObject_Dump(): 37c. to dump an object to ‘stderr’.  It
     should only be used for debugging.  (Contributed by Victor Stinner
     in gh-141070(15).)

   * Implement PEP 820(16): ‘PySlot’ - Unified slot system for the C
     API.  See *note Definition slots: 37d. for documentation.

     This adds:

        * The *note PySlot: 1a8. struct;

        * the *note PyType_FromSlots(): 37e. function;

        * new slot IDs: *note Py_slot_end: 37f, *note Py_slot_invalid:
          380.; *note Py_slot_subslots: 381, *note Py_tp_slots: 382,
          *note Py_mod_slots: 383.; *note Py_tp_name: 384, *note
          Py_tp_basicsize: 385, *note Py_tp_extra_basicsize: 386, *note
          Py_tp_itemsize: 387, *note Py_tp_flags: 388, *note
          Py_tp_metaclass: 389, *note Py_tp_module: 38a.;

        * convenience macros: *note PySlot_DATA: 38b, *note PySlot_FUNC:
          38c, *note PySlot_SIZE: 38d, *note PySlot_INT64: 38e, *note
          PySlot_UINT64: 38f, *note PySlot_STATIC_DATA: 390, *note
          PySlot_END: 391, *note PySlot_PTR: 392, *note
          PySlot_PTR_STATIC: 393.

     The *note PyModule_FromSlotsAndSpec(): 394. function and
     ‘PyModExport’ *note module export hook: 395. also use the new
     ‘PySlot’ struct.

     These following functions are *note soft deprecated: 1b2.:

        * *note PyType_FromSpec(): 396.

        * *note PyType_FromSpecWithBases(): 397.

        * *note PyType_FromModuleAndSpec(): 398.

        * *note PyType_FromMetaclass(): 399.

        * *note PyModule_FromDefAndSpec(): 39a.

        * *note PyModule_FromDefAndSpec2(): 39b.

        * *note PyModule_ExecDef(): 39c.

     (Contributed by Petr Viktorin in gh-149044(17).)

   * Add *note PyUnstable_ThreadState_SetStackProtection(): 39d. and
     *note PyUnstable_ThreadState_ResetStackProtection(): 39e. functions
     to set the stack protection base address and stack protection size
     of a Python thread state.  (Contributed by Victor Stinner in
     gh-139653(18).)

   * Add *note PyUnstable_SetImmortal(): 39f. C-API function to mark
     objects as *note immortal: 3a0.  (Contributed by Kumar Aditya in
     gh-143300(19).)

   * Restore private provisional ‘_Py_InitializeMain()’ function removed
     in Python 3.14.  (Contributed by Victor Stinner in gh-142417(20).)

   * Add *note PyUnstable_DumpTraceback(): 3a1. and *note
     PyUnstable_DumpTracebackThreads(): 3a2. functions to output Python
     stacktraces.  (Contributed by Alex Malyshev in gh-145559(21).)

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

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

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

   (3) https://github.com/python/cpython/issues/146063

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

   (5) https://github.com/python/cpython/issues/131510

   (6) https://github.com/python/cpython/issues/137210

   (7) https://peps.python.org/pep-0782/

   (8) https://github.com/python/cpython/issues/129813

   (9) https://github.com/python/cpython/issues/149227

   (10) https://github.com/python/cpython/issues/116146

   (11) https://github.com/python/cpython/issues/111489

   (12) https://peps.python.org/pep-0793/

   (13) https://github.com/python/cpython/issues/140550

   (14) https://github.com/python/cpython/issues/145925

   (15) https://github.com/python/cpython/issues/141070

   (16) https://peps.python.org/pep-0820/

   (17) https://github.com/python/cpython/issues/149044

   (18) https://github.com/python/cpython/issues/139653

   (19) https://github.com/python/cpython/issues/143300

   (20) https://github.com/python/cpython/issues/142417

   (21) https://github.com/python/cpython/issues/145559


File: python.info,  Node: Changed C APIs,  Next: Removed C APIs<2>,  Prev: New features<4>,  Up: C API changes<2>

1.2.10.2 Changed C APIs
.......................

   * If the *note Py_TPFLAGS_MANAGED_DICT: 3a4. or *note
     Py_TPFLAGS_MANAGED_WEAKREF: 3a5. flag is set then *note
     Py_TPFLAGS_HAVE_GC: 3a6. must be set too.  (Contributed by Sergey
     Miryanov in gh-134786(1).)

   * *note PyDateTime_IMPORT: 3a7. is now thread safe.  Code that
     directly checks ‘PyDateTimeAPI’ for ‘NULL’ should be updated to
     call ‘PyDateTime_IMPORT’ instead.  (Contributed by Kumar Aditya in
     gh-141563(2).)

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

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

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


File: python.info,  Node: Removed C APIs<2>,  Next: Deprecated C APIs<2>,  Prev: Changed C APIs,  Up: C API changes<2>

1.2.10.3 Removed C APIs
.......................

   * Remove deprecated ‘PyUnicode’ functions:

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

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

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

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

     (Contributed by Stan Ulbrych in gh-133612(1).)

   * ‘PyImport_ImportModuleNoBlock()’: deprecated alias of *note
     PyImport_ImportModule(): 3ab.  (Contributed by Bénédikt Tran in
     gh-133644(2).)

   * ‘PyWeakref_GetObject()’ and ‘PyWeakref_GET_OBJECT’: use *note
     PyWeakref_GetRef(): 3ac. instead.  The pythoncapi-compat project(3)
     can be used to get ‘PyWeakref_GetRef()’ on Python 3.12 and older.
     (Contributed by Bénédikt Tran in gh-133644(4).)

   * Remove deprecated ‘PySys_ResetWarnOptions()’.  Clear *note
     sys.warnoptions: 3ad. and ‘warnings.filters’ instead.

     (Contributed by Nikita Sobolev in gh-138886(5).)

The following functions are removed in favor of *note PyConfig_Get():
3ae.  The pythoncapi-compat project(6) can be used to get
‘PyConfig_Get()’ on Python 3.13 and older.

   * Python initialization functions:

        * ‘Py_GetExecPrefix()’: use *note
          PyConfig_Get("base_exec_prefix"): 3ae. (*note
          sys.base_exec_prefix: 3af.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3b0.) if
          *note virtual environments: 3b1. need to be handled.

        * ‘Py_GetPath()’: use *note PyConfig_Get("module_search_paths"):
          3ae. (*note sys.path: 19f.) instead.

        * ‘Py_GetPrefix()’: use *note PyConfig_Get("base_prefix"): 3ae.
          (*note sys.base_prefix: 3b2.) instead.  Use
          ‘PyConfig_Get("prefix")’ (*note sys.prefix: 3b3.) if *note
          virtual environments: 3b1. need to be handled.

        * ‘Py_GetProgramFullPath()’: use *note
          PyConfig_Get("executable"): 3ae. (*note sys.executable: 3b4.)
          instead.

        * ‘Py_GetProgramName()’: use *note PyConfig_Get("executable"):
          3ae. (*note sys.executable: 3b4.) instead.

        * ‘Py_GetPythonHome()’: use *note PyConfig_Get("home"): 3ae. or
          the *note PYTHONHOME: 3b5. environment variable instead.

     (Contributed by Bénédikt Tran in gh-133644(7).)

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

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

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

   (3) https://github.com/python/pythoncapi-compat

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

   (5) https://github.com/python/cpython/issues/138886

   (6) https://github.com/python/pythoncapi-compat

   (7) https://github.com/python/cpython/issues/133644


File: python.info,  Node: Deprecated C APIs<2>,  Prev: Removed C APIs<2>,  Up: C API changes<2>

1.2.10.4 Deprecated C APIs
..........................

   * Deprecate PEP 456(1) support for providing an external definition
     of the string hashing scheme.  Removal is scheduled for Python
     3.19.

     Previously, embedders could define *note Py_HASH_ALGORITHM: 3b8. to
     be ‘Py_HASH_EXTERNAL’ to indicate that the hashing scheme was
     provided externally but this feature was undocumented, untested and
     most likely unused.

     (Contributed by Bénédikt Tran in gh-141226(2).)

   * For unsigned integer formats in *note PyArg_ParseTuple(): 3b9,
     accepting Python integers with value that is larger than the
     maximal value for the C type or less than the minimal value for the
     corresponding signed integer type of the same size is now
     deprecated.  (Contributed by Serhiy Storchaka in gh-132629(3).)

   * *note PyBytes_FromStringAndSize(NULL, len): 3ba. and *note
     _PyBytes_Resize(): 3bb. are *note soft deprecated: 1b2, use the
     *note PyBytesWriter: 3bc. API instead.  (Contributed by Victor
     Stinner in gh-129813(4).)

   * ‘_PyObject_CallMethodId()’, ‘_PyObject_GetAttrId()’ and
     ‘_PyUnicode_FromId()’ are deprecated since 3.15 and will be removed
     in 3.20.  Instead, use *note PyUnicode_InternFromString(): 3bd. and
     cache the result in the module state, then call *note
     PyObject_CallMethod(): 3be. or *note PyObject_GetAttr(): 3bf.
     (Contributed by Victor Stinner in gh-141049(5).)

   * Deprecate *note cval: 3c0. field of the *note PyComplexObject: 3c1.
     type.  Use *note PyComplex_AsCComplex(): 3c2. and *note
     PyComplex_FromCComplex(): 3c3. to convert a Python complex number
     to/from the C *note Py_complex: 3c4. representation.  (Contributed
     by Sergey B Kirpichev in gh-128813(6).)

   * Functions *note _Py_c_sum(): 3c5, *note _Py_c_diff(): 3c6, *note
     _Py_c_neg(): 3c7, *note _Py_c_prod(): 3c8, *note _Py_c_quot(): 3c9,
     *note _Py_c_pow(): 3ca. and *note _Py_c_abs(): 3cb. are *note soft
     deprecated: 1b2.  (Contributed by Sergey B Kirpichev in
     gh-128813(7).)

   * *note bytes_warning: 3cc. is deprecated since 3.15 and will be
     removed in 3.17.  (Contributed by Nikita Sobolev in gh-136355(8).)

   * ‘Py_INFINITY’ macro is *note soft deprecated: 1b2, use the C11
     standard ‘<math.h>’ ‘INFINITY’ instead.  (Contributed by Sergey B
     Kirpichev in gh-141004(9).)

   * The following macros are *note soft deprecated: 1b2.:

        - *note Py_ALIGNED: 3cd.: Prefer ‘alignas’ instead.

        - *note PY_FORMAT_SIZE_T: 3ce.: Use ‘"z"’ directly.

        - *note Py_LL: 3cf. and *note Py_ULL: 3d0.: Use standard
          suffixes, ‘LL’ and ‘ULL’.

        - *note PY_LONG_LONG: 3d1, *note PY_LLONG_MIN: 3d2, *note
          PY_LLONG_MAX: 3d3, *note PY_ULLONG_MAX: 3d4, *note PY_INT32_T:
          3d5, *note PY_UINT32_T: 3d6, *note PY_INT64_T: 3d7, *note
          PY_UINT64_T: 3d8, *note PY_SIZE_MAX: 3d9.: Use C99
          types/limits.

        - *note Py_UNICODE_SIZE: 3da.: Use ‘sizeof(wchar_t)’ directly.

        - *note Py_VA_COPY: 3db.: Use ‘va_copy’ directly.

     The macro *note Py_UNICODE_WIDE: 3dc, which was scheduled for
     removal, is *note soft deprecated: 1b2. instead.

     (Contributed by Petr Viktorin in gh-146175(10).)

   * ‘Py_MATH_El’ and ‘Py_MATH_PIl’ are deprecated since 3.15 and will
     be removed in 3.20.  (Contributed by Sergey B Kirpichev in
     gh-141004(11).)

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

   (1) https://peps.python.org/pep-0456/

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

   (3) https://github.com/python/cpython/issues/132629

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

   (5) https://github.com/python/cpython/issues/141049

   (6) https://github.com/python/cpython/issues/128813

   (7) https://github.com/python/cpython/issues/128813

   (8) https://github.com/python/cpython/issues/136355

   (9) https://github.com/python/cpython/issues/141004

   (10) https://github.com/python/cpython/issues/146175

   (11) https://github.com/python/cpython/issues/141004


File: python.info,  Node: Build changes<2>,  Next: Porting to Python 3 15,  Prev: C API changes<2>,  Up: What's new in Python 3 15

1.2.11 Build changes
--------------------

   * Removed implicit fallback to the bundled copy of the ‘libmpdec’
     library.  Now this should be explicitly enabled with
     ‘--with-system-libmpdec’ set to ‘no’ or with
     ‘--without-system-libmpdec’.  (Contributed by Sergey B Kirpichev in
     gh-115119(1).)

   * The new configure option *note -with-missing-stdlib-config=FILE:
     3de. allows distributors to pass a JSON(2) configuration file
     containing custom error messages for *note standard library: 3df.
     modules that are missing or packaged separately.  (Contributed by
     Stan Ulbrych and Petr Viktorin in gh-139707(3).)

   * The new configure option *note -with-pymalloc-hugepages: 3e0.
     enables huge page support for *note pymalloc: 3e1. arenas.  When
     enabled, arena size increases to 2 MiB and allocation uses
     ‘MAP_HUGETLB’ (Linux) or ‘MEM_LARGE_PAGES’ (Windows) with automatic
     fallback to regular pages.  On Windows, use ‘build.bat
     --pymalloc-hugepages’.  At runtime, huge pages must be explicitly
     enabled by setting the *note PYTHON_PYMALLOC_HUGEPAGES: 3e2.
     environment variable to ‘1’.

   * Annotating anonymous mmap usage is now supported if Linux kernel
     supports ‘PR_SET_VMA_ANON_NAME(4)’ (Linux 5.17 or newer).
     Annotations are visible in ‘/proc/<pid>/maps’ if the kernel
     supports the feature and *note -X dev: 183. is passed to the Python
     or Python is built in *note debug mode: 3e3.  (Contributed by
     Donghee Na in gh-141770(5).)

   * CPython is now built with frame pointers enabled by default ( PEP
     831(6)).  Pass *note -without-frame-pointers: 3e4. to opt out.

     Authors of C extensions and native libraries built with custom
     build systems should ensure the unwind chain is intact.  This is
     usually done by adding ‘-fno-omit-frame-pointer’ and similar flags
     to ‘CFLAGS’.  See *note -without-frame-pointers: 3e4. documentation
     for the specific flags Python uses.

     (Contributed by Pablo Galindo Salgado and Savannah Ostrowski in
     gh-149201(7).)

   * 64-bit builds using Visual Studio 2026 (MSVC 18) may now use the
     new *note tail-calling interpreter: 2cf.  Results on Visual Studio
     18.1.1 report between 15-20%(8) speedup on the geometric mean of
     pyperformance on Windows x86-64 over the switch-case interpreter on
     an AMD Ryzen 7 5800X. We have observed speedups ranging from 14%
     for large pure-Python libraries to 40% for long-running small
     pure-Python scripts on Windows.  This was made possible by a new
     feature introduced in MSVC 18, which the official Windows 64-bit
     binaries on python.org(9) now use.  (Contributed by Chris Eibl, Ken
     Jin, and Brandt Bucher in gh-143068(10).  Special thanks to Steve
     Dower, and the MSVC team including Hulon Jenkins.)

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

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

   (2) https://www.json.org/json-en.html

   (3) https://github.com/python/cpython/issues/139707

   (4) https://manpages.debian.org/PR_SET_VMA(2const)

   (5) https://github.com/python/cpython/issues/141770

   (6) https://peps.python.org/pep-0831/

   (7) https://github.com/python/cpython/issues/149201

   (8) 
https://github.com/faster-cpython/ideas/blob/main/results/5800X-msvc.pgo2-vs-msvc.pgo.tc.svg

   (9) https://www.python.org/downloads/windows/

   (10) https://github.com/python/cpython/issues/143068


File: python.info,  Node: Porting to Python 3 15,  Prev: Build changes<2>,  Up: What's new in Python 3 15

1.2.12 Porting to Python 3.15
-----------------------------

This section lists previously described changes and other bugfixes that
may require changes to your code.

   * *note sqlite3.Connection: 3e6. APIs have been cleaned up.

        * All parameters of *note sqlite3.connect(): 3e7. except
          'database' are now keyword-only.

        * The first three parameters of methods *note create_function():
          3e8. and *note create_aggregate(): 3e9. are now
          positional-only.

        * The first parameter of methods *note set_authorizer(): 3ea,
          *note set_progress_handler(): 3eb. and *note
          set_trace_callback(): 3ec. is now positional-only.

     (Contributed by Serhiy Storchaka in gh-133595(1).)

   * *note resource.RLIM_INFINITY: 3ed. is now always positive.  Passing
     a negative integer value that corresponded to its old value (such
     as ‘-1’ or ‘-3’, depending on platform) to *note
     resource.setrlimit(): 3ee. and *note resource.prlimit(): 3ef. is
     now deprecated.  (Contributed by Serhiy Storchaka in gh-137044(2).)

   * *note mmap.mmap.resize(): 3f0. has been removed on platforms that
     don't support the underlying syscall, instead of raising a *note
     SystemError: 3f1.

   * A resource warning is now emitted for an unclosed *note
     xml.etree.ElementTree.iterparse(): 3f2. iterator if it opened a
     file.  Use its ‘close()’ method or the *note contextlib.closing():
     3f3. context manager to close it.  (Contributed by Osama Abdelkader
     and Serhiy Storchaka in gh-140601(3).)

   * If a short option and a single-dash long option are passed to *note
     argparse.ArgumentParser.add_argument(): 3f4, 'dest' is now inferred
     from the single-dash long option.  For example, in
     ‘add_argument('-f', '-foo')’, 'dest' is now ‘'foo'’ instead of
     ‘'f'’.  Pass an explicit 'dest' argument to preserve the old
     behavior.  (Contributed by Serhiy Storchaka in gh-138697(4).)

   * Padding of input no longer required in *note
     base64.urlsafe_b64decode(): 1f9.  Pass a new argument ‘padded=True’
     or use *note base64.b64decode(): 1f7. with argument
     ‘altchars=b'-_'’ (this works with older Python versions) to make
     padding required.  (Contributed by Serhiy Storchaka in
     gh-73613(5).)

   * Since *note unittest.TestCase.assertWarns(): 2ab. and *note
     unittest.TestCase.assertWarnsRegex(): 2ac. no longer swallow
     warnings that do not match the specified category or regex, your
     tests may start leaking some warnings that were previously masked.
     Use warning filters to silence them or additional ‘assertWarns*()’
     to catch and check them.  (Contributed by Serhiy Storchaka in
     gh-143231(6).)

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

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

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

   (3) https://github.com/python/cpython/issues/140601

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

   (5) https://github.com/python/cpython/issues/73613

   (6) https://github.com/python/cpython/issues/143231


File: python.info,  Node: What's new in Python 3 14,  Next: What's New In Python 3 13,  Prev: What's new in Python 3 15,  Up: What's New in Python

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

参考
....

PEP 745(1) - Python 3.14 リリーススケジュール

* Menu:

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

Python 3.14 はプログラミング言語 Python の最新のリリースです。言語自体へ
の変更や、実装、標準ライブラリのアップデートが含まれます。一番大きな変更
点は、新しい *note テンプレート文字列リテラル: 3f9.、*note
アノテーションの遅延評価: 3fa.、標準ライブラリへの *note
subinterpreters: 3fb. の追加です。

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

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

__________________________________________________________________

インタプリタの改善:

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

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

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

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

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

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

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

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

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

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

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

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

   * *note Asyncio introspection capabilities: 3fc.

   * *note Concurrent safe warnings control: 407.

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

C API の改善:

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

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

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

リリースの変更:

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

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

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

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

   ---------- 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<3>,  Prev: 概要 -- リリースハイライト,  Up: What's new in Python 3 14

1.3.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 アノテーション: 410. が先行評価されなく
なりました。代わりに、アノテーションは専用の *note annotate 関数: 411. に
格納され、必要になったときのみ評価されるようになります (‘from __future__
import annotations’ を使用している場合を除く)。

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

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

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

     >>> 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 移植: 415. セクションで説明しています。ただし、ほとんどのコードで
は修正は不要です。

(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: 417. 経由でしか利用できませんでした。

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

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

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

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

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

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

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

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

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

現状の制限事項：

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

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

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

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

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

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

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

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

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

(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: 1ea. を
返すのに対し、テンプレート文字列は、文字列の固定の部分と補間された部分を
表すオブジェクトを返します。

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

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

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

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

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

     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(): 41f. 関数
として実装されています。例えば：

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

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

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

(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.3.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:
423.

     注釈: 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.3.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(): 425.

The new *note -X context_aware_warnings: 183. flag controls if *note
concurrent safe warnings control: 407. 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: 426. flag has been added, which if
enabled means that threads created with *note threading.Thread: 427.
start with a copy of the *note Context(): 428. of the caller of *note
start(): 429.  Most significantly, this makes the warning filtering
context established by *note catch_warnings: 42a. 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: 39.
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.3.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: 42c. statements that follow an *note else: 328. 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): 42d. after *note else: 328, or one of *note pass:
     42e, *note break: 42f, or *note continue: 430. is passed before
     *note if: 32a, then the error message highlights where the *note
     expression: 431. 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: 193. or *note set: 432.
     (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: 216.
     instead of *note with: 215, 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: 8d, *note bz2: 14, *note gzip: 6a. and *note
zlib: 13c. 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: e7, *note zipfile: 13a, and *note shutil:
cd. 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.3.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.3.2.10 Concurrent safe warnings control
.........................................

The *note warnings.catch_warnings: 42a. context manager will now
optionally use a context variable for warning filters.  This is enabled
by setting the *note context_aware_warnings: 436. 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<3>,  Next: 新しいモジュール,  Prev: 新しい機能,  Up: What's new in Python 3 14

1.3.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: 438. command-line option.  This includes writes to
     ‘__debug__’, incorrect use of *note await: 439, 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: 189.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: Default interactive shell<2>.

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

1.3.3.1 Built-ins
.................

   * The *note bytes.fromhex(): 43b. and *note bytearray.fromhex(): 43c.
     methods now accept ASCII *note bytes: 1d2. and *note bytes-like
     objects: 43d.  (Contributed by Daniel Pope in gh-129349(1).)

   * Add class methods *note float.from_number(): 43e. and *note
     complex.from_number(): 43f. to convert a number to *note float:
     32f. or *note complex: 330. type correspondingly.  They raise a
     *note TypeError: 29c. 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(): 440. or *note
     f-strings: 441.).  (Contributed by Sergey B Kirpichev in
     gh-87790(3).)

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

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

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

   * Using *note NotImplemented: 447. in a boolean context will now
     raise a *note TypeError: 29c.  This has raised a *note
     DeprecationWarning: 2d4. since Python 3.9.  (Contributed by Jelle
     Zijlstra in gh-118767(7).)

   * Three-argument *note pow(): 448. now tries calling *note
     __rpow__(): 449. 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: 44a. 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<3>

1.3.3.2 コマンドラインと環境
............................

   * The import time flag can now track modules that are already loaded
     ('cached'), via the new *note -X importtime=2: 183.  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: 44c. now automatically dedents
     its code argument before execution.  (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<3>

1.3.3.3 PEP 758: Allow ‘except’ and ‘except*’ expressions without brackets
..........................................................................

The *note except: 44e. and *note except*: 44f. 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<3>

1.3.3.4 PEP 765: Control flow in ‘finally’ blocks
.................................................

The compiler now emits a *note SyntaxWarning: 451. when a *note return:
452, *note break: 42f, or *note continue: 430. statement have the effect
of leaving a *note finally: 453. 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:
1d7. 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:
11b. 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<2>,  Prev: PEP 765 Control flow in finally blocks,  Up: Other language changes<3>

1.3.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(): 456. 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<2>,  Prev: Garbage collection,  Up: Other language changes<3>

1.3.3.6 Default interactive shell
.................................

   * The default *note interactive: 458. shell now highlights Python
     syntax.  The feature is enabled by default, save if *note
     PYTHON_BASIC_REPL: 459. or any other environment variable that
     disables colour is set.  See *note 色の制御: 1ba. 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: 45a. 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: 458. 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<3>,  Prev: Other language changes<3>,  Up: What's new in Python 3 14

1.3.4 新しいモジュール
----------------------

   * *note annotationlib: 6.: For introspecting *note annotations: 410.
     See *note PEP 749: 3fa. 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: 3fd.
     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: 3fb. for
     more details.  (Contributed by Eric Snow in gh-134939(3).)

   * *note string.templatelib: dc.: Support for template string literals
     (t-strings).  See *note PEP 750: 3f9. 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<3>,  Next: 最適化,  Prev: 新しいモジュール,  Up: What's new in Python 3 14

1.3.5 Improved modules
----------------------

* Menu:

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


File: python.info,  Node: argparse<2>,  Next: ast<3>,  Up: Improved modules<3>

1.3.5.1 argparse
................

   * The default value of the *note program name: 45e. for *note
     argparse.ArgumentParser: 1e7. 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: 1e7, 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: 1e7.  This can
     also be controlled by *note environment variables: 1ba.
     (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<3>,  Next: asyncio<3>,  Prev: argparse<2>,  Up: Improved modules<3>

1.3.5.2 ast
...........

   * Add *note compare(): 460, a function for comparing two ASTs.
     (Contributed by Batuhan Taskaya and Jeremy Hylton in gh-60191(1).)

   * Add support for *note copy.replace(): 461. 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(): 462. 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(): 1d4. 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: 463, *note -optimize: 464, and *note -show-empty:
     465.  (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<3>,  Next: calendar<2>,  Prev: ast<3>,  Up: Improved modules<3>

1.3.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: 467. constructor or the custom task
     factory.  (See *note set_task_factory(): 468. 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(): 469, *note asyncio.loop.create_task(): 46a,
     *note asyncio.TaskGroup.create_task(): 46b.

     (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(): 46c. and *note
     print_call_graph(): 46d.  See *note Asyncio introspection
     capabilities: 3fc. 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<2>,  Next: concurrent futures<2>,  Prev: asyncio<3>,  Up: Improved modules<3>

1.3.5.4 calendar
................

   * By default, today's date is highlighted in color in *note calendar:
     15.'s *note command-line: 20c. text output.  This can be controlled
     by *note environment variables: 1ba.  (Contributed by Hugo van
     Kemenade in gh-128317(1).)

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

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


File: python.info,  Node: concurrent futures<2>,  Next: configparser,  Prev: calendar<2>,  Up: Improved modules<3>

1.3.5.5 concurrent.futures
..........................

   * Add a new executor class, *note InterpreterPoolExecutor: 471, 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: 3fb.  (Contributed by Eric Snow in
     gh-124548(1).)

   * On Unix platforms other than macOS, *note 'forkserver': 473. is now
     the default *note start method: 474. for *note ProcessPoolExecutor:
     211. (replacing *note 'fork': 475.).  This change does not affect
     Windows or macOS, where *note 'spawn': 476. 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: 211.

     See *note forkserver restrictions: 477. 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: 211, *note
     terminate_workers(): 478. and *note kill_workers(): 479, 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: 47a.
     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<2>,  Up: Improved modules<3>

1.3.5.6 configparser
....................

   * ‘configparser’ will no longer write config files it cannot read, to
     improve security.  Attempting to *note write(): 47c. keys
     containing delimiters or beginning with the section header pattern
     will raise an *note InvalidWriteError: 47d.  (Contributed by Jacob
     Lincoln in gh-129270(1).)

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

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


File: python.info,  Node: contextvars,  Next: ctypes<2>,  Prev: configparser,  Up: Improved modules<3>

1.3.5.7 contextvars
...................

   * Support the *note context manager: 47f. protocol for *note Token:
     480. objects.  (Contributed by Andrew Svetlov in gh-129889(1).)

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

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


File: python.info,  Node: ctypes<2>,  Next: curses,  Prev: contextvars,  Up: Improved modules<3>

1.3.5.8 ctypes
..............

   * The layout of *note bit fields: 482. in *note Structure: 483. and
     *note Union: 484. 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_: 321. 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: 483./*note Union: 484. field
     descriptors is now available as *note CField: 485, and has new
     attributes to aid debugging and introspection.  (Contributed by
     Petr Viktorin in gh-128715(3).)

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

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

   * Add *note memoryview_at(): 488, a function to create a *note
     memoryview: 1dd. object that refers to the supplied pointer and
     length.  This works like *note ctypes.string_at(): 489. 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: 2d9, *note c_double_complex:
     2da, and *note c_longdouble_complex: 2db, 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(): 48a. for listing the shared
     libraries loaded by the current process.  (Contributed by Brian
     Ward in gh-119349(8).)

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

   * ‘ctypes’ now supports *note free-threading builds: 48e.
     (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<2>,  Prev: ctypes<2>,  Up: Improved modules<3>

1.3.5.9 curses
..............

   * Add the *note assume_default_colors(): 490. function, a refinement
     of the *note use_default_colors(): 491. 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<2>,  Next: decimal,  Prev: curses,  Up: Improved modules<3>

1.3.5.10 datetime
.................

   * Add the *note strptime(): 493. method to the *note datetime.date:
     494. and *note datetime.time: 495. 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<2>,  Prev: datetime<2>,  Up: Improved modules<3>

1.3.5.11 decimal
................

   * Add *note Decimal.from_number(): 497. as an alternative constructor
     for *note Decimal: 1cd.  (Contributed by Serhiy Storchaka in
     gh-121798(1).)

   * Expose *note IEEEContext(): 498. 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<2>,  Next: dis,  Prev: decimal,  Up: Improved modules<3>

1.3.5.12 difflib
................

   * Comparison pages with highlighted changes generated by the *note
     HtmlDiff: 21f. 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<2>,  Up: Improved modules<3>

1.3.5.13 dis
............

   * Add support for rendering full source location information of *note
     instructions: 49b, rather than only the line number.  This feature
     is added to the following interfaces via the 'show_positions'
     keyword argument:

        - *note dis.Bytecode: 49c.

        - *note dis.dis(): 49d.

        - *note dis.distb(): 49e.

        - *note dis.disassemble(): 49f.

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

   * Add the *note dis -specialized: 4a1. 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<2>,  Prev: dis,  Up: Improved modules<3>

1.3.5.14 errno
..............

   * Add the *note EHWPOISON: 4a3. 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<2>,  Next: fnmatch,  Prev: errno,  Up: Improved modules<3>

1.3.5.15 faulthandler
.....................

   * Add support for printing the C stack trace on systems that *note
     support it: 4a5. via the new *note dump_c_stack(): 4a6. function or
     via the 'c_stack' argument in *note faulthandler.enable(): 224.
     (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<2>,  Up: Improved modules<3>

1.3.5.16 fnmatch
................

   * Add *note filterfalse(): 4a8, 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<3>,  Prev: fnmatch,  Up: Improved modules<3>

1.3.5.17 fractions
..................

   * A *note Fraction: 1ce. 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(): 4aa. as an alternative
     constructor for *note Fraction: 1ce.  (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<3>,  Next: getopt,  Prev: fractions,  Up: Improved modules<3>

1.3.5.18 functools
..................

   * Add the *note Placeholder: 4ac. sentinel.  This may be used with
     the *note partial(): 4ad. or *note partialmethod(): 4ae. functions
     to reserve a place for positional arguments in the returned *note
     partial object: 4af.  (Contributed by Dominykas Grigonis in
     gh-119127(1).)

   * Allow the 'initial' parameter of *note reduce(): 156. 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<3>,  Up: Improved modules<3>

1.3.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<3>

1.3.5.20 getpass
................

   * Support keyboard feedback in the *note getpass(): 4b2. 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<3>

1.3.5.21 graphlib
.................

   * Allow *note TopologicalSorter.prepare(): 4b4. 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<3>

1.3.5.22 heapq
..............

   * The ‘heapq’ module has improved support for working with max-heaps,
     via the following new functions:

        * *note heapify_max(): 4b6.

        * *note heappush_max(): 4b7.

        * *note heappop_max(): 4b8.

        * *note heapreplace_max(): 4b9.

        * *note heappushpop_max(): 4ba.


File: python.info,  Node: hmac,  Next: http,  Prev: heapq,  Up: Improved modules<3>

1.3.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<3>

1.3.5.24 http
.............

   * Directory lists and error pages generated by the *note http.server:
     75. module allow the browser to apply its default dark mode.
     (Contributed by Yorik Hansen in gh-123430(1).)

   * The *note http.server: 75. module now supports serving over HTTPS
     using the *note http.server.HTTPSServer: 4bd. class.  This
     functionality is exposed by the command-line interface (‘python -m
     http.server’) through the following options:

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

        * *note -tls-key <path>: 4bf.: Optional path to the private key
          file.

        * *note -tls-password-file <path>: 4c0.: 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<2>,  Prev: http,  Up: Improved modules<3>

1.3.5.25 imaplib
................

   * Add *note IMAP4.idle(): 4c2, 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<2>,  Next: io,  Prev: imaplib,  Up: Improved modules<3>

1.3.5.26 inspect
................

   * *note signature(): 4c4. takes a new argument 'annotation_format' to
     control the *note annotationlib.Format: 4c5. used for representing
     annotations.  (Contributed by Jelle Zijlstra in gh-101552(1).)

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

   * Add function *note ispackage(): 4c7. to determine whether an object
     is a *note package: 4c8. 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<2>,  Prev: inspect<2>,  Up: Improved modules<3>

1.3.5.27 io
...........

   * Reading text from a non-blocking stream with ‘read’ may now raise a
     *note BlockingIOError: 4ca. if the operation cannot immediately
     return bytes.  (Contributed by Giovanni Siragusa in gh-109523(1).)

   * Add the *note Reader: 4cb. and *note Writer: 4cc. protocols as
     simpler alternatives to the pseudo-protocols *note typing.IO: 4cd,
     *note typing.TextIO: 4ce, and *note typing.BinaryIO: 4cf.
     (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<2>,  Next: linecache,  Prev: io,  Up: Improved modules<3>

1.3.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: 85. module as a script using the *note
     -m: 4d1. switch: ‘python -m json’.  This is now preferred to
     ‘python -m json.tool’, which is *note soft deprecated: 1b2.  See
     the *note JSON command-line interface: 4d2. documentation.
     (Contributed by Trey Hunner in gh-122873(2).)

   * By default, the output of the *note JSON command-line interface:
     4d2. is highlighted in color.  This can be controlled by *note
     environment variables: 1ba.  (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<2>,  Up: Improved modules<3>

1.3.5.29 linecache
..................

   * *note getline(): 4d4. 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<2>,  Prev: linecache,  Up: Improved modules<3>

1.3.5.30 logging.handlers
.........................

   * *note QueueListener: 4d6. objects now support the *note context
     manager: 47f. protocol.  (Contributed by Charles Machalow in
     gh-132106(1).)

   * *note QueueListener.start: 4d7. now raises a *note RuntimeError:
     317. 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<2>,  Next: mimetypes<3>,  Prev: logging handlers,  Up: Improved modules<3>

1.3.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<3>,  Next: multiprocessing,  Prev: math<2>,  Up: Improved modules<3>

1.3.5.32 mimetypes
..................

   * Add a public *note command-line: 4da. 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<3>,  Up: Improved modules<3>

1.3.5.33 multiprocessing
........................

   * On Unix platforms other than macOS, *note 'forkserver': 473. is now
     the default *note start method: 474. (replacing *note 'fork':
     475.).  This change does not affect Windows or macOS, where *note
     'spawn': 476. 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(): 4dd.
     (preferred) or change the default via *note set_start_method():
     4de.

     See *note forkserver restrictions: 477. 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: 4df. for 'list' and 'dict'
     types gain previously overlooked missing methods:

             * ‘clear()’ and ‘copy()’ for proxies of *note list: 4e0.

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

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

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

   * Add the *note interrupt(): 4e4. to *note multiprocessing.Process:
     4e5. objects, which terminates the child process by sending *note
     SIGINT: 4e6.  This enables *note finally: 453. 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<3>,  Prev: multiprocessing,  Up: Improved modules<3>

1.3.5.34 operator
.................

   * Add *note is_none(): 4e8. and *note is_not_none(): 4e9. 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<3>,  Next: os path<2>,  Prev: operator,  Up: Improved modules<3>

1.3.5.35 os
...........

   * Add the *note reload_environ(): 4eb. function to update *note
     os.environ: 4ec. and *note os.environb: 4ed. with changes to the
     environment made by *note os.putenv(): 4ee, by *note os.unsetenv():
     4ef, or made outside Python in the same process.  (Contributed by
     Victor Stinner in gh-120057(1).)

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

   * Add the *note readinto(): 4f2. function to read into a *note buffer
     object: 319. 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<2>,  Next: pathlib<2>,  Prev: os<3>,  Up: Improved modules<3>

1.3.5.36 os.path
................

   * The 'strict' parameter to *note realpath(): 24d. accepts a new
     value, *note ALLOW_MISSING: 24e.  If used, errors other than *note
     FileNotFoundError: 24f. 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<2>,  Next: pdb<2>,  Prev: os path<2>,  Up: Improved modules<3>

1.3.5.37 pathlib
................

   * Add methods to *note pathlib.Path: 4f5. to recursively copy or move
     files and directories:

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

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

        * *note move(): 4f8. moves a file or directory tree to a
          destination.

        * *note move_into(): 4f9. moves 'into' a destination directory.

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

   * Add the *note info: 4fa. attribute, which stores an object
     implementing the new *note pathlib.types.PathInfo: 4fb. protocol.
     The object supports querying the file type and internally caching
     *note stat(): 4fc. results.  Path objects generated by *note
     iterdir(): 4fd. 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<2>,  Next: pickle<2>,  Prev: pathlib<2>,  Up: Improved modules<3>

1.3.5.38 pdb
............

   * The *note pdb: aa. module now supports remote attaching to a
     running Python process using a new *note -p PID: 4ff. 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: 403. and the new *note
     sys.remote_exec(): 41f. 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(): 500. and *note
     set_trace(): 501.) now reuse the most recent *note Pdb: 502.
     instance that calls *note set_trace(): 503, instead of creating a
     new one each time.  As a result, all the instance specific data
     like *note display: 504. and *note commands: 505. are preserved
     across hardcoded breakpoints.  (Contributed by Tian Gao in
     gh-121450(2).)

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

   * Inline breakpoints like *note breakpoint(): 500. or *note
     pdb.set_trace(): 501. 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(): 508. is added to support debugging
     asyncio coroutines.  *note await: 439. 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: 458. shell, in addition to the newly
     added ‘colorize’ argument of *note pdb.Pdb: 502.  (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<2>,  Next: プラットフォーム,  Prev: pdb<2>,  Up: Improved modules<3>

1.3.5.39 pickle
...............

   * Set the default protocol version on the *note pickle: ab. module to
     5.  For more details, see *note pickle protocols: 50a.

   * 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<2>,  Up: Improved modules<3>

1.3.5.40 プラットフォーム
.........................

   * Add *note invalidate_caches(): 50c, 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<2>,  Prev: プラットフォーム,  Up: Improved modules<3>

1.3.5.41 pydoc
..............

   * *note Annotations: 410. 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<2>,  Next: socket<2>,  Prev: pydoc,  Up: Improved modules<3>

1.3.5.42 re
...........

   * Support ‘\z’ as a synonym for ‘\Z’ in *note regular expressions:
     c1.  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: c1. 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<2>,  Next: ssl<2>,  Prev: re<2>,  Up: Improved modules<3>

1.3.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: 510. on FreeBSD.
          (Contributed by Victor Stinner in gh-111178(2).)

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

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

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

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

        * Return 'cid' in *note getsockname(): 513. for *note
          BTPROTO_L2CAP: 512.  (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<2>,  Next: struct,  Prev: socket<2>,  Up: Improved modules<3>

1.3.5.44 ssl
............

   * Indicate through the *note HAS_PHA: 515. 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<3>,  Prev: ssl<2>,  Up: Improved modules<3>

1.3.5.45 struct
...............

   * Support the float complex and double complex C types in the *note
     struct: de. 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<3>,  Next: sys<3>,  Prev: struct,  Up: Improved modules<3>

1.3.5.46 symtable
.................

   * Expose the following *note Symbol: 518. methods:

        * *note is_comp_cell(): 519.

        * *note is_comp_iter(): 51a.

        * *note is_free_class(): 51b.

     (Contributed by Bénédikt Tran in gh-120029(1).)

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

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


File: python.info,  Node: sys<3>,  Next: sys monitoring<2>,  Prev: symtable<3>,  Up: Improved modules<3>

1.3.5.47 sys
............

   * The previously undocumented special function *note
     sys.getobjects(): 51d, 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(): 51e. for determining if an object is
     *note immortal: 3a0.  (Contributed by Peter Bierma in
     gh-128509(2).)

   * On FreeBSD, *note sys.platform: 51f. 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: 2d4. for *note
     sys._clear_type_cache(): 34c.  This function was deprecated in
     Python 3.13 but it didn't raise a runtime warning.

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

   * Add the *note sys._jit: 520. 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<2>,  Next: sysconfig<3>,  Prev: sys<3>,  Up: Improved modules<3>

1.3.5.48 sys.monitoring
.......................

   * Add two new monitoring events, *note BRANCH_LEFT: 522. and *note
     BRANCH_RIGHT: 523.  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<3>,  Next: tarfile<3>,  Prev: sys monitoring<2>,  Up: Improved modules<3>

1.3.5.49 sysconfig
..................

   * Add ‘ABIFLAGS’ key to *note get_config_vars(): 525. on Windows.
     (Contributed by Xuehai Pan in gh-131799(1).)

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

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


File: python.info,  Node: tarfile<3>,  Next: threading<3>,  Prev: sysconfig<3>,  Up: Improved modules<3>

1.3.5.50 tarfile
................

   * *note data_filter(): 284. 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(): 285. 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(): 286. and *note extractall(): 285. 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: 287.  (Contributed by Petr Viktorin for CVE
     2025-4330(5) and CVE 2024-12718(6).)

   * *note extract(): 286. and *note extractall(): 285. no longer
     extract rejected members when *note errorlevel(): 288. 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<3>,  Next: tkinter<2>,  Prev: tarfile<3>,  Up: Improved modules<3>

1.3.5.51 threading
..................

   * *note threading.Thread.start(): 429. now sets the operating system
     thread name to *note threading.Thread.name: 345.  (Contributed by
     Victor Stinner in gh-59705(1).)

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

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


File: python.info,  Node: tkinter<2>,  Next: turtle,  Prev: threading<3>,  Up: Improved modules<3>

1.3.5.52 tkinter
................

   * Make *note tkinter: f9. 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<3>,  Prev: tkinter<2>,  Up: Improved modules<3>

1.3.5.53 ‘turtle’
.................

   * Add context managers for *note turtle.fill(): 52a, *note
     turtle.poly(): 52b, and *note turtle.no_animation(): 52c.
     (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<3>,  Next: typing<3>,  Prev: turtle,  Up: Improved modules<3>

1.3.5.54 types
..............

   * *note types.UnionType: 52e. is now an alias for *note typing.Union:
     349.  See *note below: 52f. 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<3>,  Next: unicodedata<2>,  Prev: types<3>,  Up: Improved modules<3>

1.3.5.55 typing
...............

   * The *note types.UnionType: 52e. and *note typing.Union: 349. 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(): 462.  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:
          52e. 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(): 31c. and *note typing.get_args(): 31d.
          instead of relying on private implementation details.

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

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

        - It is no longer possible to set any attributes on *note Union:
          349. 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: 531. 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<2>,  Next: unittest<2>,  Prev: typing<3>,  Up: Improved modules<3>

1.3.5.56 unicodedata
....................

   * The Unicode database has been updated to Unicode 16.0.0.


File: python.info,  Node: unittest<2>,  Next: urllib,  Prev: unicodedata<2>,  Up: Improved modules<3>

1.3.5.57 unittest
.................

   * *note unittest: 10f. output is now colored by default.  This can be
     controlled by *note environment variables: 1ba.  (Contributed by
     Hugo van Kemenade in gh-127221(1).)

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

        - *note assertHasAttr(): 537. and *note assertNotHasAttr(): 538.
          check whether the object has a particular attribute.

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

        - *note assertStartsWith(): 53b, *note assertNotStartsWith():
          53c, *note assertEndsWith(): 53d. and *note
          assertNotEndsWith(): 53e. 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<2>,  Up: Improved modules<3>

1.3.5.58 urllib
...............

   * Upgrade HTTP digest authentication algorithm for *note
     urllib.request: 114. 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(): 540.:

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

     In *note pathname2url(): 542.:

        - 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: 543. 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<2>,  Prev: urllib,  Up: Improved modules<3>

1.3.5.59 uuid
.............

   * Add support for UUID versions 6, 7, and 8 via *note uuid6(): 545,
     *note uuid7(): 546, and *note uuid8(): 547. respectively, as
     specified in RFC 9562(1).  (Contributed by Bénédikt Tran in
     gh-89083(2).)

   * *note NIL: 548. and *note MAX: 549. 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: 54a.  (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<2>,  Next: zipfile,  Prev: uuid,  Up: Improved modules<3>

1.3.5.60 webbrowser
...................

   * Names in the ‘BROWSER’ environment variable can now refer to
     already registered browsers for the *note webbrowser: 11e. 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<2>,  Up: Improved modules<3>

1.3.5.61 zipfile
................

   * Added *note ZipInfo._for_archive: 54d, a method to resolve suitable
     defaults for a *note ZipInfo: 54e. object as used by *note
     ZipFile.writestr: 54f.  (Contributed by Bénédikt Tran in
     gh-123424(1).)

   * *note ZipFile.writestr(): 54f. 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<3>,  Up: What's new in Python 3 14

1.3.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: 2c, *note
     gettext: 66, *note importlib.util: 80, *note locale: 89, *note
     mimetypes: 93, *note optparse: a4, *note pickle: ab, *note pprint:
     b3, *note pstats: b8, *note shlex: cc, *note socket: d4, *note
     string: db, *note subprocess: df, *note threading: f6, *note
     tomllib: 105, *note types: 10c, and *note zipfile: 13a.

     (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(): 551. and *note
     Py_REFCNT(): 552. compared to previous versions of Python.  See
     *note below: 553. for details.

* Menu:

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

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

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


File: python.info,  Node: asyncio<4>,  Next: base64<2>,  Up: 最適化

1.3.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: 467, also reducing memory usage.  This enables
     external introspection tools such as *note python -m asyncio
     pstree: 3fc. 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: 48e.  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<2>,  Next: bdb,  Prev: asyncio<4>,  Up: 最適化

1.3.6.2 base64
..............

   * *note b16decode(): 1fc. 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<3>,  Prev: base64<2>,  Up: 最適化

1.3.6.3 bdb
...........

   * The basic debugger now has a *note sys.monitoring: e3.-based
     backend, which can be selected via the passing ‘'monitoring'’ to
     the *note Bdb: 557. 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<3>,  Next: gc<2>,  Prev: bdb,  Up: 最適化

1.3.6.4 difflib
...............

   * The *note IS_LINE_JUNK(): 559. 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<2>,  Next: io<2>,  Prev: difflib<3>,  Up: 最適化

1.3.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: 406. 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(): 55b. and *note set_threshold(): 55c. have changed,
     along with *note get_count(): 55d. and *note get_stats(): 55e.

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

        - *note get_count(): 55d. and *note get_stats(): 55e. 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<3>,  Prev: gc<2>,  Up: 最適化

1.3.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<3>,  Next: pdb<3>,  Prev: io<2>,  Up: 最適化

1.3.6.7 pathlib
...............

   * *note Path.read_bytes: 561. 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<3>,  Next: textwrap,  Prev: pathlib<3>,  Up: 最適化

1.3.6.8 pdb
...........

   * *note pdb: aa. now supports two backends, based on either *note
     sys.settrace(): 563. or *note sys.monitoring: e3.  Using the *note
     pdb CLI: 564. or *note breakpoint(): 500. will always use the
     ‘sys.monitoring’ backend.  Explicitly instantiating *note pdb.Pdb:
     502. 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<3>,  Up: 最適化

1.3.6.9 textwrap
................

   * Optimize the *note dedent(): 566. 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<2>,  Prev: textwrap,  Up: 最適化

1.3.6.10 uuid
.............

   * *note uuid3(): 568. and *note uuid5(): 569. 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(): 56a. 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<2>,  Prev: uuid<2>,  Up: 最適化

1.3.6.11 zlib
.............

   * On Windows, zlib-ng(1) is now used as the implementation of the
     *note zlib: 13c. 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.3.7 削除
----------

* Menu:

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


File: python.info,  Node: argparse<3>,  Next: ast<4>,  Up: 削除

1.3.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(): 325. on an argument group now
     raises a *note ValueError: 15a.  Similarly, ‘add_argument_group()’
     or *note add_mutually_exclusive_group(): 56e. 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<4>,  Next: asyncio<5>,  Prev: argparse<3>,  Up: 削除

1.3.7.2 ast
...........

   * Remove the following classes, which have been deprecated aliases of
     *note Constant: 570. 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: 571.
     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:
     570, 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<5>,  Next: email<2>,  Prev: ast<4>,  Up: 削除

1.3.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(): 573. now raises a *note
     RuntimeError: 317. 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():
     573, most of them can be replaced with *note asyncio.run(): 314.

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

     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(): 314. and an
     *note asyncio.Event: 574.

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

     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<2>,  Next: importlib abc,  Prev: asyncio<5>,  Up: 削除

1.3.7.4 email
.............

   * Remove *note email.utils.localtime(): 576.'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<2>,  Up: 削除

1.3.7.5 importlib.abc
.....................

   * Remove deprecated *note importlib.abc: 7b. classes:

        * ‘ResourceReader’ (use *note TraversableResources: 578.)

        * ‘Traversable’ (use *note Traversable: 579.)

        * ‘TraversableResources’ (use *note TraversableResources: 578.)

     (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<4>,  Prev: importlib abc,  Up: 削除

1.3.7.6 itertools
.................

   * Remove support for copy, deepcopy, and pickle operations from *note
     itertools: 84. iterators.  These have emitted a *note
     DeprecationWarning: 2d4. 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<4>,  Next: pkgutil,  Prev: itertools,  Up: 削除

1.3.7.7 pathlib
...............

   * Remove support for passing additional keyword arguments to *note
     Path: 4f5.  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(): 57c. and *note is_relative_to(): 57d.  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<4>,  Up: 削除

1.3.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<2>,  Prev: pkgutil,  Up: 削除

1.3.7.9 pty
...........

   * Remove the ‘master_open()’ and ‘slave_open()’ functions, which have
     been deprecated since Python 3.12.  Use *note pty.openpty(): 580.
     instead.  (Contributed by Nikita Sobolev in gh-118824(1).)

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

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


File: python.info,  Node: sqlite3<2>,  Next: urllib<2>,  Prev: pty,  Up: 削除

1.3.7.10 sqlite3
................

   * Remove ‘version’ and ‘version_info’ from the *note sqlite3: d7.
     module; use *note sqlite_version: 582. and *note
     sqlite_version_info: 583. 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: 584, 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<2>,  Up: 削除

1.3.7.11 urllib
...............

   * Remove the ‘Quoter’ class from *note urllib.parse: 113, 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: 114, which have been deprecated since Python 3.3.

     ‘myopener.open()’ can be replaced with *note urlopen(): 586.
     ‘myopener.retrieve()’ can be replaced with *note urlretrieve():
     587.  Customisations to the opener classes can be replaced by
     passing customized handlers to *note build_opener(): 588.
     (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.3.8 非推奨
------------

* Menu:

* New deprecations: New deprecations<2>.
* Pending removal in Python 3.15: Pending removal in Python 3 15.
* Pending removal in Python 3.16: Pending removal in Python 3 16<2>.
* 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<2>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<2>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<2>.
* Pending removal in future versions: Pending removal in future versions<2>.


File: python.info,  Node: New deprecations<2>,  Next: Pending removal in Python 3 15,  Up: 非推奨

1.3.8.1 New deprecations
........................

   * Passing a complex number as the 'real' or 'imag' argument in the
     *note complex(): 330. 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(): 325. method is now deprecated.
          (Contributed by Savannah Ostrowski in gh-125563(2).)

        * Deprecated the *note argparse.FileType: 326. 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(): 154. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(4).)

        * The *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 314. or *note
          asyncio.Runner: 315. 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(): 334. function is now
     deprecated, and will be removed in a future version of Python.  Use
     *note open(): 333. instead.  (Contributed by Inada Naoki in
     gh-133036(6).)

   * *note ctypes: 2d.:

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

        * Calling *note ctypes.POINTER(): 48b. on a string is now
          deprecated.  Use *note incomplete types: 58b. 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: 62.: Calling the Python implementation of *note
     functools.reduce(): 156. 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: 8a.: 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(): 159.
     Undotted extensions are deprecated and will raise a *note
     ValueError: 15a. in Python 3.16.  (Contributed by Hugo van Kemenade
     in gh-75223(11).)

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

   * *note os: a5.: The *note os.popen(): 58c. and *note os.spawn*: 58d.
     functions are now *note soft deprecated: 1b2.  They should no
     longer be used to write new code.  The *note subprocess: df. 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(): 58e. 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: e1.: Deprecate ‘symtable.Class.get_methods()’ 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: f9.: 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: 113.: Accepting objects with false values (like
     ‘0’ and ‘[]’) except empty strings, bytes-like objects and ‘None’
     in *note parse_qsl(): 58f. and *note parse_qs(): 590. 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<2>,  Prev: New deprecations<2>,  Up: 非推奨

1.3.8.2 Pending removal in Python 3.15
......................................

   * The import system:

        * Setting ‘__cached__’ on a module while failing to set *note
          __spec__.cached: 592. 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__: 593. on a module while failing to
          set *note __spec__.parent: 594. 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: 2d.:

        * The undocumented ‘ctypes.SetPointerType()’ function has been
          deprecated since Python 3.13.

   * *note http.server: 75.:

        * The obsolete and rarely used ‘CGIHTTPRequestHandler’ 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: 7a.:

        * ‘load_module()’ method: use ‘exec_module()’ instead.

   * *note pathlib: a8.:

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

   * *note platform: af.:

        * ‘platform.java_ver()’ 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: e4.:

        * The 'check_home' argument of *note
          sysconfig.is_python_build(): 2e9. has been deprecated since
          Python 3.12.

   * *note threading: f6.:

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

        * *note types.CodeType: 2ed.: Accessing ‘codeobject.co_lnotab’
          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: 2d4. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(4).)

   * *note typing: 10d.:

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

   * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.

   * *note wave: 11c.:

        * The ‘getmark()’, ‘setmark()’ and ‘getmarkers()’ methods of the
          *note Wave_read: 2f2. and *note Wave_write: 2f3. classes have
          been deprecated since Python 3.13.

   * *note zipimport: 13b.:

        * ‘zipimport.zipimporter.load_module()’ has been deprecated
          since Python 3.10.  Use *note exec_module(): 2f5. instead.
          (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<2>,  Next: Pending removal in Python 3 17<2>,  Prev: Pending removal in Python 3 15,  Up: 非推奨

1.3.8.3 Pending removal in Python 3.16
......................................

   * The import system:

        * Setting *note __loader__: 30b. on a module while failing to
          set *note __spec__.loader: 30c. 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: 30d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 154. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 314. or *note
          asyncio.Runner: 315. 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: 62.:

        * Calling the Python implementation of *note functools.reduce():
          156. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8a.:

        * 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(): 159.  Undotted extensions are
          deprecated and will raise a *note ValueError: 15a. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: cd.:

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

   * *note symtable: e1.:

        * The ‘symtable.Class.get_methods()’ method has been deprecated
          since Python 3.14.

   * *note sys: e2.:

        * The ‘_enablelegacywindowsfsencoding()’ function has been
          deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 15e. environment variable
          instead.

   * *note sysconfig: e4.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 160. instead.

   * *note tarfile: e7.:

        * The undocumented and unused ‘TarInfo.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<2>,  Prev: Pending removal in Python 3 16<2>,  Up: 非推奨

1.3.8.4 Pending removal in Python 3.17
......................................

   * *note datetime: 33.:

        * *note strptime(): 2dd. calls using a format string containing
          ‘%e’ (day of month) without a year.  This has been deprecated
          since Python 3.15.  (Contributed by Stan Ulbrych in
          gh-70647(1).)

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 2d6. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(2) for more details.  (Contributed by Shantanu
          Jain in gh-91896(3).)

   * *note encodings: 54.:

        - Passing non-ascii 'encoding' names to *note
          encodings.normalize_encoding(): 31b. is deprecated and
          scheduled for removal in Python 3.17.  (Contributed by Stan
          Ulbrych in gh-136702(4).)

   * *note webbrowser: 11e.:

        - ‘webbrowser.MacOSXOSAScript’ is deprecated in favour of
          ‘webbrowser.MacOS’.  (gh-137586(5))

   * *note typing: 10d.:

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

        - *note typing.ByteString: 2ef, 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: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(6) for more details.  (Contributed by Shantanu
          Jain in gh-91896(7).)

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

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

   (2) https://peps.python.org/pep-0688/#current-options

   (3) https://github.com/python/cpython/issues/91896

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

   (5) https://github.com/python/cpython/issues/137586

   (6) https://peps.python.org/pep-0688/#current-options

   (7) https://github.com/python/cpython/issues/91896


File: python.info,  Node: Pending removal in Python 3 18<2>,  Next: Pending removal in Python 3 19<2>,  Prev: Pending removal in Python 3 17<2>,  Up: 非推奨

1.3.8.5 Pending removal in Python 3.18
......................................

   * No longer accept a boolean value when a file descriptor is
     expected.  (Contributed by Serhiy Storchaka in gh-82626(1).)

   * *note decimal: 39.:

        * The non-standard and undocumented *note Decimal: 1cd. 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(2).)

   * Deprecations defined by PEP 829(3):

        * ‘import’ lines in ‘`name'.pth’ files are silently ignored.

     (Contributed by Barry Warsaw in gh-148641(4).)

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

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

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

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

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


File: python.info,  Node: Pending removal in Python 3 19<2>,  Next: Pending removal in Python 3 20<2>,  Prev: Pending removal in Python 3 18<2>,  Up: 非推奨

1.3.8.6 Pending removal in Python 3.19
......................................

   * *note ctypes: 2d.:

        * Implicitly switching to the MSVC-compatible struct layout by
          setting *note _pack_: 320. but not *note _layout_: 321. on
          non-Windows platforms.

   * *note hashlib: 6b.:

        - In hash function constructors such as *note new(): 2fd. or the
          direct hash-named constructors such as *note md5(): 2fe. and
          *note sha256(): 2ff, their optional initial data parameter
          could also be passed a keyword argument named ‘data=’ or
          ‘string=’ in various ‘hashlib’ implementations.

          Support for the ‘string’ keyword argument name is now
          deprecated and slated for removal in Python 3.19.

          Before Python 3.13, the ‘string’ keyword parameter was not
          correctly supported depending on the backend implementation of
          hash functions.  Prefer passing the initial data as a
          positional argument for maximum backwards compatibility.

   * *note http.cookies: 74.:

        * *note http.cookies.Morsel.js_output(): 300. is deprecated and
          will be removed in Python 3.19.

        * *note http.cookies.BaseCookie.js_output(): 301. is deprecated
          and will be removed in Python 3.19.

   * *note imaplib: 77.:

        * Altering *note IMAP4.file: 304. is now deprecated and slated
          for removal in Python 3.19.  This property is now unused and
          changing its value does not automatically close the current
          file.

          Before Python 3.14, this property was used to implement the
          corresponding ‘read()’ and ‘readline()’ methods for *note
          IMAP4: 322. but this is no longer the case since then.


File: python.info,  Node: Pending removal in Python 3 20<2>,  Next: Pending removal in future versions<2>,  Prev: Pending removal in Python 3 19<2>,  Up: 非推奨

1.3.8.7 Pending removal in Python 3.20
......................................

   * Calling the ‘__new__()’ method of *note struct.Struct: 307. without
     the 'format' argument is deprecated and will be removed in Python
     3.20.  Calling *note __init__(): 306. method on initialized
     ‘Struct’ objects is deprecated and will be removed in Python 3.20.

     (Contributed by Sergey B Kirpichev and Serhiy Storchaka in
     gh-143715(1).)

   * The ‘__version__’, ‘version’ and ‘VERSION’ attributes have been
     deprecated in these standard library modules and will be removed in
     Python 3.20.  Use *note sys.version_info: 308. instead.

        - *note argparse: 7.

        - *note csv: 2c.

        - *note ctypes: 2d.

        - ‘ctypes.macholib’

        - *note decimal: 39. (use *note decimal.SPEC_VERSION: 309.
          instead)

        - *note http.server: 75.

        - *note imaplib: 77.

        - *note ipaddress: 83.

        - *note json: 85.

        - *note logging: 8a. (‘__date__’ also deprecated)

        - *note optparse: a4.

        - *note pickle: ab.

        - *note platform: af.

        - *note re: c1.

        - *note socketserver: d5.

        - *note tabnanny: e6.

        - *note tarfile: e7.

        - *note tkinter.font: fe.

        - *note tkinter.ttk: 102.

        - *note wsgiref.simple_server: 124.

        - *note xml.etree.ElementTree: 12e.

        - ‘xml.sax.expatreader’

        - *note xml.sax.handler: 133.

        - *note zlib: 13c.

     (Contributed by Hugo van Kemenade and Stan Ulbrych in gh-76007(2).)

   * Deprecations defined by PEP 829(3):

        * Warnings are produced for ‘import’ lines found in ‘`name'.pth’
          files.

        * ‘`name'.pth’ files are no longer decoded in the locale
          encoding by default.  They 'MUST' be encoded in ‘utf-8-sig’.

     (Contributed by Barry Warsaw in gh-148641(4).)

   * *note ast: 9.:

        * Creating instances of abstract AST nodes (such as *note
          ast.AST: 2f8. or ‘ast.expr’) is deprecated and will raise an
          error in Python 3.20.

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

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

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

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

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


File: python.info,  Node: Pending removal in future versions<2>,  Prev: Pending removal in Python 3 20<2>,  Up: 非推奨

1.3.8.8 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(): 325. is now deprecated.

        * The *note argparse.FileType: 326. 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:
          327, *note else: 328, *note for: 329, *note if: 32a, *note in:
          32b, *note is: 32c. and *note or: 32d.  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: 32e.

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

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 330.: 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(): 330. 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:
     331. and *note calendar.FEBRUARY: 332.  (Contributed by Prince
     Roshan in gh-103636(3).)

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

   * ‘codeobject.co_lnotab’: use the *note codeobject.co_lines(): 335.
     method instead.

   * *note datetime: 33.:

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

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

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

   * *note importlib: 7a.:

        * *note cache_from_source(): 338. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7d.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8a.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 339. instead.

   * *note mailbox: 8e.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 33a. in a
     multi-threaded process.

   * *note os.path: a6.: *note os.path.commonprefix(): 33b. is
     deprecated, use *note os.path.commonpath(): 33c. for path prefixes.
     The ‘os.path.commonprefix()’ function is being deprecated due to
     having a misleading name and module.  The function is not safe to
     use for path prefixes despite being included in a module about path
     manipulation, meaning it is easy to accidentally introduce path
     traversal vulnerabilities into Python programs by using this
     function.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: c1.: 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).)

   * *note shutil: cd.: *note rmtree(): 33d.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d8. options and protocols:

        * *note ssl.SSLContext: 33e. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 33e.: *note set_npn_protocols(): 33f.
          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: f6. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          340.

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

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 342.: use *note
          threading.Thread.daemon: 343. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 344.: use *note
          threading.Thread.name: 345. attribute.

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

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

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

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

   * *note urllib.parse: 113. deprecated functions: *note urlparse():
     2af. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

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

   * *note xml.etree.ElementTree: 12e.: Testing the truth value of an
     *note Element: 34b. 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(): 34c. is deprecated: use *note
     sys._clear_internal_caches(): 34d. 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<3>,  Prev: 非推奨,  Up: What's new in Python 3 14

1.3.9 CPython バイトコードの変更
--------------------------------

   * Replaced the opcode ‘BINARY_SUBSCR’ by the *note BINARY_OP: 59c.
     opcode with the ‘NB_SUBSCR’ oparg.  (Contributed by Irit Katriel in
     gh-100239(1).)

   * Add the *note BUILD_INTERPOLATION: 59d. and *note BUILD_TEMPLATE:
     59e. opcodes to construct new *note Interpolation: 41d. and *note
     Template: 41c. instances, respectively.  (Contributed by Lysandros
     Nikolaou and others in gh-132661(2); see also *note PEP 750;
     Template strings: 3f9.).

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

   * Replace the ‘LOAD_ASSERTION_ERROR’ opcode with *note
     LOAD_COMMON_CONSTANT: 5a0. and add support for loading *note
     NotImplementedError: 5a1.

   * Add the *note LOAD_FAST_BORROW: 5a2. and *note
     LOAD_FAST_BORROW_LOAD_FAST_BORROW: 5a3. 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: 5a4. 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: 5a5. instruction.  Generate code
     for *note with: 215. and *note async with: 216. 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: 5a6. 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.3.9.1 Pseudo-instructions
...........................

   * Add the ‘ANNOTATIONS_PLACEHOLDER’ pseudo instruction to support
     partially executed module-level annotations with *note deferred
     evaluation of annotations: 3fa.  (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: 5a8.; ‘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: 5a9. and *note JUMP_IF_FALSE: 5aa.
     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 ‘LOAD_CONST_IMMORTAL’ 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: 5ab. pseudo instruction, used by *note
     sys.monitoring: e3. to record branch events (such as *note
     BRANCH_LEFT: 522.).  (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<3>,  Next: Build changes<3>,  Prev: CPython バイトコードの変更,  Up: What's new in Python 3 14

1.3.10 C API changes
--------------------

* Menu:

* Python configuration C API::
* New features in the C API::
* Limited C API changes::
* Removed C APIs: Removed C APIs<3>.
* Deprecated C APIs: Deprecated C APIs<3>.


File: python.info,  Node: Python configuration C API,  Next: New features in the C API,  Up: C API changes<3>

1.3.10.1 Python configuration C API
...................................

Add a *note PyInitConfig C API: 5ae. 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: 5af. by adding *note
PyInitConfig_AddModule(): 5b0. which can be used to add a built-in
extension module; a feature previously referred to as the "inittab".

Add *note PyConfig_Get(): 3ae. and *note PyConfig_Set(): 5b1. 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<3>

1.3.10.2 New features in the C API
..................................

   * Add *note Py_PACK_VERSION(): 5b3. and *note Py_PACK_FULL_VERSION():
     5b4, two new macros for bit-packing Python version numbers.  This
     is useful for comparisons with *note Py_Version: 5b5. or *note
     PY_VERSION_HEX: 5b6.  (Contributed by Petr Viktorin in
     gh-128629(1).)

   * Add *note PyBytes_Join(sep, iterable): 5b7. 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: 409.):

        * *note PyConfig_Get(): 3ae.

        * *note PyConfig_GetInt(): 5b8.

        * *note PyConfig_Set(): 5b1.

        * *note PyConfig_Names(): 5b9.

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

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

        * *note Py_InitializeFromInitConfig(): 5ba.

        * *note PyInitConfig_AddModule(): 5b0.

        * *note PyInitConfig_Create(): 5bb.

        * *note PyInitConfig_Free(): 5bc.

        * *note PyInitConfig_FreeStrList(): 5bd.

        * *note PyInitConfig_GetError(): 5be.

        * *note PyInitConfig_GetExitCode(): 5bf.

        * *note PyInitConfig_GetInt(): 5c0.

        * *note PyInitConfig_GetStr(): 5c1.

        * *note PyInitConfig_GetStrList(): 5c2.

        * *note PyInitConfig_HasOption(): 5c3.

        * *note PyInitConfig_SetInt(): 5c4.

        * *note PyInitConfig_SetStr(): 5c5.

        * *note PyInitConfig_SetStrList(): 5c6.

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

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

   * Add *note Py_HashBuffer(): 5c9. 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(): 5ca. and *note
     PyImport_ImportModuleAttrString(): 5cb. 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(): 5cc. to replace *note PyIter_Next():
     5cd, which has an ambiguous return value.  (Contributed by Irit
     Katriel and Erlend Aasland in gh-105201(8).)

   * Add *note PyLong_GetSign(): 5ce. function to get the sign of *note
     int: 32e. objects.  (Contributed by Sergey B Kirpichev in
     gh-116560(9).)

   * Add *note PyLong_IsPositive(): 5cf, *note PyLong_IsNegative(): 5d0.
     and *note PyLong_IsZero(): 5d1. for checking if *note PyLongObject:
     5d2. 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: 32e. objects:

        * *note PyLong_AsInt32(): 5d3.

        * *note PyLong_AsInt64(): 5d4.

        * *note PyLong_AsUInt32(): 5d5.

        * *note PyLong_AsUInt64(): 5d6.

        * *note PyLong_FromInt32(): 5d7.

        * *note PyLong_FromInt64(): 5d8.

        * *note PyLong_FromUInt32(): 5d9.

        * *note PyLong_FromUInt64(): 5da.

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

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

        * *note PyLong_GetNativeLayout(): 5db.

        * *note PyLong_Export(): 5dc.

        * *note PyLong_FreeExport(): 5dd.

        * *note PyLongWriter_Create(): 5de.

        * *note PyLongWriter_Finish(): 5df.

        * *note PyLongWriter_Discard(): 5e0.

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

   * Add *note PyMonitoring_FireBranchLeftEvent(): 5e1. and *note
     PyMonitoring_FireBranchRightEvent(): 5e2. for generating *note
     BRANCH_LEFT: 522. and *note BRANCH_RIGHT: 523. events,
     respectively.  (Contributed by Mark Shannon in gh-122548(14).)

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

   * Add *note PyType_GetBaseByToken(): 5e4. and *note Py_tp_token: 5e5.
     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(): 5e6. 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: 5e7. API to create a Python *note
     str: 1ea. object, with the following functions:

        * *note PyUnicodeWriter_Create(): 5e8.

        * *note PyUnicodeWriter_DecodeUTF8Stateful(): 5e9.

        * *note PyUnicodeWriter_Discard(): 5ea.

        * *note PyUnicodeWriter_Finish(): 5eb.

        * *note PyUnicodeWriter_Format(): 5ec.

        * *note PyUnicodeWriter_WriteASCII(): 5ed.

        * *note PyUnicodeWriter_WriteChar(): 5ee.

        * *note PyUnicodeWriter_WriteRepr(): 5ef.

        * *note PyUnicodeWriter_WriteStr(): 5f0.

        * *note PyUnicodeWriter_WriteSubstring(): 5f1.

        * *note PyUnicodeWriter_WriteUCS4(): 5f2.

        * *note PyUnicodeWriter_WriteUTF8(): 5f3.

        * *note PyUnicodeWriter_WriteWideChar(): 5f4.

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

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

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

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

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

   * Add *note PyUnstable_Object_IsUniqueReferencedTemporary(): 5fa. 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(): 552. 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<3>,  Prev: New features in the C API,  Up: C API changes<3>

1.3.10.3 Limited C API changes
..............................

   * In the limited C API version 3.14 and newer, *note Py_TYPE(): 5fc.
     and *note Py_REFCNT(): 552. 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: 5fd, *note
     PySequence_Fast_GET_ITEM: 5fe, and *note PySequence_Fast_ITEMS:
     5ff. 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<3>,  Next: Deprecated C APIs<3>,  Prev: Limited C API changes,  Up: C API changes<3>

1.3.10.4 Removed C APIs
.......................

   * Creating *note immutable types: 602. with mutable bases was
     deprecated in Python 3.12, and now raises a *note TypeError: 29c.
     (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(): 603. API
     instead.  (Contributed by Sam Gross in gh-124296(2).)

   * Remove the private ‘_Py_InitializeMain()’ function.  It was a *note
     provisional API: 604. 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(): 605. 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<3>,  Prev: Removed C APIs<3>,  Up: C API changes<3>

1.3.10.5 Deprecated C APIs
..........................

   * The ‘Py_HUGE_VAL’ macro is now *note soft deprecated: 1b2.  Use
     ‘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: 1b2.  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(): 3b9. and other
     *note argument parsing: 608. functions if 'items' contains format
     units which store a *note borrowed buffer: 609. or a *note borrowed
     reference: 60a.  (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(): 5e1. and *note
     PyMonitoring_FireBranchRightEvent(): 5e2.

   * The previously undocumented function *note PySequence_In(): 60b. is
     now *note soft deprecated: 1b2.  Use *note PySequence_Contains():
     60c. 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<3>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<3>.
* Pending removal in future versions: Pending removal in future versions<3>.

   ---------- 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<3>,  Up: Deprecated C APIs<3>

1.3.10.6 Pending removal in Python 3.15
.......................................

   * The ‘PyImport_ImportModuleNoBlock()’: Use *note
     PyImport_ImportModule(): 3ab. instead.

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

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

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

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

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

   * Python initialization functions, deprecated in Python 3.13:

        * ‘Py_GetPath()’: Use *note PyConfig_Get("module_search_paths"):
          3ae. (*note sys.path: 19f.) instead.

        * ‘Py_GetPrefix()’: Use *note PyConfig_Get("base_prefix"): 3ae.
          (*note sys.base_prefix: 3b2.) instead.  Use
          ‘PyConfig_Get("prefix")’ (*note sys.prefix: 3b3.) if *note
          virtual environments: 3b1. need to be handled.

        * ‘Py_GetExecPrefix()’: Use *note
          PyConfig_Get("base_exec_prefix"): 3ae. (*note
          sys.base_exec_prefix: 3af.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3b0.) if
          *note virtual environments: 3b1. need to be handled.

        * ‘Py_GetProgramFullPath()’: Use *note
          PyConfig_Get("executable"): 3ae. (*note sys.executable: 3b4.)
          instead.

        * ‘Py_GetProgramName()’: Use *note PyConfig_Get("executable"):
          3ae. (*note sys.executable: 3b4.) instead.

        * ‘Py_GetPythonHome()’: Use *note PyConfig_Get("home"): 3ae. or
          the *note PYTHONHOME: 3b5. environment variable instead.

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

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

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 60e. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 60e. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 60f.
          instead.

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

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

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 613.: Use *note PyConfig.parser_debug:
          614. or *note PyConfig_Get("parser_debug"): 3ae. instead.

        * *note Py_VerboseFlag: 615.: Use *note PyConfig.verbose: 616.
          or *note PyConfig_Get("verbose"): 3ae. instead.

        * *note Py_QuietFlag: 617.: Use *note PyConfig.quiet: 618. or
          *note PyConfig_Get("quiet"): 3ae. instead.

        * *note Py_InteractiveFlag: 619.: Use *note
          PyConfig.interactive: 61a. or *note
          PyConfig_Get("interactive"): 3ae. instead.

        * *note Py_InspectFlag: 61b.: Use *note PyConfig.inspect: 61c.
          or *note PyConfig_Get("inspect"): 3ae. instead.

        * *note Py_OptimizeFlag: 61d.: Use *note
          PyConfig.optimization_level: 61e. or *note
          PyConfig_Get("optimization_level"): 3ae. instead.

        * *note Py_NoSiteFlag: 61f.: Use *note PyConfig.site_import:
          620. or *note PyConfig_Get("site_import"): 3ae. instead.

        * *note Py_BytesWarningFlag: 621.: Use *note
          PyConfig.bytes_warning: 3cc. or *note
          PyConfig_Get("bytes_warning"): 3ae. instead.

        * *note Py_FrozenFlag: 622.: Use *note
          PyConfig.pathconfig_warnings: 623. or *note
          PyConfig_Get("pathconfig_warnings"): 3ae. instead.

        * *note Py_IgnoreEnvironmentFlag: 624.: Use *note
          PyConfig.use_environment: 625. or *note
          PyConfig_Get("use_environment"): 3ae. instead.

        * *note Py_DontWriteBytecodeFlag: 626.: Use *note
          PyConfig.write_bytecode: 627. or *note
          PyConfig_Get("write_bytecode"): 3ae. instead.

        * *note Py_NoUserSiteDirectory: 628.: Use *note
          PyConfig.user_site_directory: 629. or *note
          PyConfig_Get("user_site_directory"): 3ae. instead.

        * *note Py_UnbufferedStdioFlag: 62a.: Use *note
          PyConfig.buffered_stdio: 62b. or *note
          PyConfig_Get("buffered_stdio"): 3ae. instead.

        * *note Py_HashRandomizationFlag: 62c.: Use *note
          PyConfig.use_hash_seed: 62d. and *note PyConfig.hash_seed:
          62e. or *note PyConfig_Get("hash_seed"): 3ae. instead.

        * *note Py_IsolatedFlag: 62f.: Use *note PyConfig.isolated: 630.
          or *note PyConfig_Get("isolated"): 3ae. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 631.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 632. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 3ae. instead.

        * *note Py_LegacyWindowsStdioFlag: 633.: Use *note
          PyConfig.legacy_windows_stdio: 634. or *note
          PyConfig_Get("legacy_windows_stdio"): 3ae. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 635. or *note
          PyConfig_Get("filesystem_encoding"): 3ae. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 636. or *note
          PyConfig_Get("filesystem_errors"): 3ae. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 637. or *note
          PyConfig_Get("utf8_mode"): 3ae. instead.  (see *note
          Py_PreInitialize(): 638.)

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. to set these options.  Or *note
     PyConfig_Get(): 3ae. 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<3>,  Next: Pending removal in Python 3 18<3>,  Prev: Pending removal in Python 3 15<2>,  Up: Deprecated C APIs<3>

1.3.10.7 Pending removal in Python 3.16
.......................................

   * The bundled copy of ‘libmpdec’.


File: python.info,  Node: Pending removal in Python 3 18<3>,  Next: Pending removal in future versions<3>,  Prev: Pending removal in Python 3 16<3>,  Up: Deprecated C APIs<3>

1.3.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(): 5b7.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 63b.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 63c.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 5ce.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 5de.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 63d.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 63e.

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

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 5eb.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 5ea.

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

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

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

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

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

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

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

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 63f.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 5c7.

     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<3>,  Prev: Pending removal in Python 3 18<3>,  Up: Deprecated C APIs<3>

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

   * *note PyErr_Fetch(): 642.: Use *note PyErr_GetRaisedException():
     643. instead.

   * *note PyErr_NormalizeException(): 644.: Use *note
     PyErr_GetRaisedException(): 643. instead.

   * *note PyErr_Restore(): 645.: Use *note PyErr_SetRaisedException():
     646. instead.

   * *note PyModule_GetFilename(): 647.: Use *note
     PyModule_GetFilenameObject(): 648. instead.

   * *note PyOS_AfterFork(): 649.: Use *note PyOS_AfterFork_Child():
     64a. instead.

   * *note PySlice_GetIndicesEx(): 64b.: Use *note PySlice_Unpack():
     64c. and *note PySlice_AdjustIndices(): 64d. instead.

   * *note PyUnicode_READY(): 64e.: Unneeded since Python 3.12

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

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

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

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 651.: Use *note
          PyThread_tss_alloc(): 652. instead.

        * *note PyThread_delete_key(): 653.: Use *note
          PyThread_tss_free(): 654. instead.

        * *note PyThread_set_key_value(): 655.: Use *note
          PyThread_tss_set(): 656. instead.

        * *note PyThread_get_key_value(): 657.: Use *note
          PyThread_tss_get(): 658. instead.

        * *note PyThread_delete_key_value(): 659.: Use *note
          PyThread_tss_delete(): 65a. instead.

        * *note PyThread_ReInitTLS(): 65b.: Unneeded since Python 3.7.


File: python.info,  Node: Build changes<3>,  Next: Porting to Python 3 14,  Prev: C API changes<3>,  Up: What's new in Python 3 14

1.3.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: 2d, *note termios: ea, and *note fcntl: 5c, as well
     as experimental support for the new *note default interactive
     shell: 65d.  (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: 65e.  (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: 65f.
     ‘configure’ option to disable them, or the *note
     -enable-slower-safety: 660. 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: 423. may
     be used to enable the experimental tail call interpreter.  See
     *note 新しいインタープリタ: 2cf. for further details.

   * To disable the new remote debugging support, use the *note
     -without-remote-debug: 421. ‘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<3>

1.3.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':
663. *note sysconfig: e4. 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<3>

1.3.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<3>

1.3.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<3>

1.3.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: 667. as an environment variable.  Downstream source builds
and redistributors can use the *note -enable-experimental-jit=yes-off:
668. 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: 520. namespace.  *note sys._jit.is_available(): 669. can be
used to determine if the current executable supports JIT compilation,
while *note sys._jit.is_enabled(): 66a. 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 5,  Prev: Build changes<3>,  Up: What's new in Python 3 14

1.3.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.3.12.1 Python API の変更
..........................

   * On Unix platforms other than macOS, 'forkserver' is now the default
     *note start method: 474. for *note multiprocessing: 98. and *note
     ProcessPoolExecutor: 211, instead of 'fork'.

     See *note (1): 472. and *note (2): 4dc. for details.

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

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

   * *note functools.partial: 4ad. is now a method descriptor.  Wrap it
     in *note staticmethod(): 66d. 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: 406, which means
     that the behavior of *note gc.collect(): 456. 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(): 66e. 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: 52e. is now an alias for *note typing.Union:
     349, causing changes in some behaviors.  See *note above: 52f. for
     more details.  (Contributed by Jelle Zijlstra in gh-105499(3).)

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

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.3.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.3.12.4 Implications for readers of ‘__annotations__’
......................................................

If your code reads the *note __annotations__: 672. 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(): 673. with the *note FORWARDREF:
413. format, as the *note dataclasses: 32. 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: 4c5. enum and the *note get_annotations(): 673.
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.3.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(): 675. during class
construction and *note annotationlib.get_annotations(): 673. 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.3.12.6 ‘from __future__ import annotations’
.............................................

In Python 3.7, PEP 563(1) introduced the ‘from __future__ import
annotations’ *note future statement: 677, 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.3.12.7 C API の変更
.....................

   * *note Py_Finalize(): 679. 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(): 67a.  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: 67b. C API now raises a *note
     TypeError: 29c. if its exception argument is not a *note
     UnicodeError: 67c. 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: 60a. references when possible.  This can lead to smaller
     reference count values compared to previous Python versions.  C API
     extensions that checked *note Py_REFCNT(): 552. of ‘1’ to determine
     if an function argument is not referenced by any other code should
     instead use *note PyUnstable_Object_IsUniqueReferencedTemporary():
     5fa. as a safer replacement.

   * Private functions promoted to public C APIs:

        * ‘_PyBytes_Join()’: *note PyBytes_Join(): 5b7.

        * ‘_PyLong_IsNegative()’: *note PyLong_IsNegative(): 5d0.

        * ‘_PyLong_IsPositive()’: *note PyLong_IsPositive(): 5cf.

        * ‘_PyLong_IsZero()’: *note PyLong_IsZero(): 5d1.

        * ‘_PyLong_Sign()’: *note PyLong_GetSign(): 5ce.

        * ‘_PyUnicodeWriter_Dealloc()’: *note PyUnicodeWriter_Discard():
          5ea.

        * ‘_PyUnicodeWriter_Finish()’: *note PyUnicodeWriter_Finish():
          5eb.

        * ‘_PyUnicodeWriter_Init()’: use *note PyUnicodeWriter_Create():
          5e8.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement)

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement)

        * ‘_PyUnicodeWriter_WriteChar()’: *note
          PyUnicodeWriter_WriteChar(): 5ee.

        * ‘_PyUnicodeWriter_WriteStr()’: *note
          PyUnicodeWriter_WriteStr(): 5f0.

        * ‘_PyUnicodeWriter_WriteSubstring()’: *note
          PyUnicodeWriter_WriteSubstring(): 5f1.

        * ‘_PyUnicode_EQ()’: *note PyUnicode_Equal(): 5e6.

        * ‘_PyUnicode_Equal()’: *note PyUnicode_Equal(): 5e6.

        * ‘_Py_GetConfig()’: *note PyConfig_Get(): 3ae. and *note
          PyConfig_GetInt(): 5b8.

        * ‘_Py_HashBytes()’: *note Py_HashBuffer(): 5c9.

        * ‘_Py_fopen_obj()’: *note Py_fopen(): 5c7.

        * ‘PyMutex_IsLocked()’ : *note PyMutex_IsLocked(): 67d.

     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 5,  Prev: Porting to Python 3 14,  Up: What's new in Python 3 14

1.3.13 Notable changes in 3.14.5
--------------------------------

* Menu:

* gc: gc<3>.


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

1.3.13.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: 406. 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.4 What's New In Python 3.13
=============================


エディタ: Adam Turner と Thomas Wouters

この記事では Python 3.12 と比較した Python 3.13 の新機能を解説します。
Python 3.13 は2024年10月7日にリリースされました。全詳細については *note
変更履歴: 145. をご覧ください。

参考
....

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.4.1 概要 - リリースハイライト
-------------------------------

Python 3.13 はプログラミング言語 Python の安定版のリリースです。言語自体
への変更や、実装、標準ライブラリのアップデートが含まれます。一番大きな変
更点は、新しい *note 対話型インタープリタ: 685. 、 *note
フリースレッドモード: 686. ( PEP 703(1)) 実行の実験的なサポート、 *note
Just-In-Time コンパイラ: 687. ( PEP 744(2)) です。

エラーメッセージも引き続き改善され、トレースバックがデフォルトで色付き表
示になりました。また、組み込み関数 *note locals(): 296. の戻り値のマッピ
ングに変更を加えた際の *note セマンティクスの定義: 688. が追加されました
。他にも、型引数がデフォルト値をサポートするようになりました。

ライブラリの変更点としては、非推奨 API ・モジュールの削除や、従来通り使
いやすさの改善・バグ修正も行いました。Python 3.11 の廃止に伴い、レガシー
標準ライブラリモジュールもいくつか *note 削除されました: 689. ( PEP
594(3)) 。

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

__________________________________________________________________

インタープリタの改善点:

   * *note 対話的インタープリタ: 685. の大幅改善と *note
     エラーメッセージの改善: 68b. 。

   * PEP 667(4): 組み込み関数 *note locals(): 296. の戻り値のマッピング
     に変更を加えた際の *note セマンティクスの定義: 688. が言語仕様に追
     加されました。これにより、Python デバッガーなどのツールが最適化され
     たスコープ内のローカル変数を更新する際、たとえ並行処理だとしても、
     確実に更新することができるようになります。

   * PEP 703(5): CPython 3.13 では *note global interpreter lock: 68c. を
     無効化した状態で実行する機能が実験的に追加されています。詳細は
     *note フリースレッドの CPython: 686. を参照してください。

   * PEP 744(6): 簡易的な *note JIT コンパイラ: 687. が追加されました。
     現在、デフォルトでは無効になっています (が、今後有効になる可能性が
     あります)。これによるパフォーマンスの向上は軽度ですが、以降のリリー
     スで改善される見込みです。

   * 新しい *note 対話的インタープリタ: 685. や *note トレースバック:
     68b. 、 *note doctest: 68d. の出力において色付き文字に対応しました
     。この機能は環境変数 *note PYTHON_COLORS: 68e. または NO_COLOR(7) で
     無効化できます。

Python のデータモデルの改善点:

   * クラスのボディ内の関数で ‘self.X’ という形でアクセスされる属性がす
     べて *note __static_attributes__: 68f. に格納されるようになりました
     。

   * クラス定義の最初の行の行番号が *note __firstlineno__: 690. に格納さ
     れるようになりました。

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

   * Python の *note 終了処理: 1ab. において処理がブロックされているとき
     に発生する新しい例外 *note PythonFinalizationError: 691. が追加され
     ました。

   * *note argparse: 7. モジュールでコマンドラインオプションや位置引数、
     サブコマンドを非推奨として指定する機能が追加されました。

   * Z85 data(8) のエンコード・デコードを行う関数 *note
     base64.z85encode(): 1f1. と *note base64.z85decode(): 1fe. が追加さ
     れました。

   * 多くの組み込み型や *note __replace__(): 692. メソッドを定義している
     任意のクラスに対して使用できる関数 *note copy.replace(): 461. が
     *note copy: 29. モジュールに追加されました。

   * *note dbm.sqlite3: 38. モジュールが追加され、 *note dbm: 34. のデフ
     ォルトのバックエンドがこれに変更されました。

   * Linux のタイマー通知機能をもつファイル記述子を扱うための *note
     様々な関数: 693. が *note os: a5. モジュールに追加されました。

   * *note random: c0. モジュールが *note
     コマンドラインインターフェース: 694. を持つようになりました。

セキュリティの改善点:

   * *note ssl.create_default_context(): 695. がデフォルトのフラグとして
     *note ssl.VERIFY_X509_PARTIAL_CHAIN: 696. と
     :data:‘ssl.VERIFY_X509_STRICT’ をセットするようになりました。

C API の改善点:

   * *note Py_mod_gil: 697. スロットは、拡張モジュールが *note GIL: 418.
     を無効化した状態での実行をサポート

   * *note PyTime C API: 698. が追加され、システムクロックへのアクセスが
     提供されるようになりました。

   * *note PyMutex: 699. は1バイトのみを占有する新しい軽量ミューテックス
     となりました。

   * 新しい *note 関数群: 69a. が、C API において PEP 669(9) の監視イベ
     ントを生成するために追加されました。

新しい型ヒントの機能:

   * PEP 696(10): 型引数（*note typing.TypeVar: 29f.、*note
     typing.ParamSpec: 2a0.、*note typing.TypeVarTuple: 29e.）をデフォル
     トでサポートします。

   * PEP 702(11): 新たに追加された *note warnings.deprecated(): 69b. デ
     コレータは、型システムおよび実行時における非推奨のマーク付けをサポ
     ートします。

   * PEP 705(12): *note typing.ReadOnly: 69c. は、型チェッカーに対して
     *note typing.TypedDict: 29b. の項目を読み取り専用としてマークするた
     めに使用できます。

   * PEP 742(13): *note typing.TypeIs: 69d. は、*note typing.TypeGuard:
     69e. の代替として、より直感的な型の絞り込みの挙動を提供します。

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

   * PEP 730(14): Apple の iOS が tier 3(15) として *note
     公式にサポートされるプラットフォーム: 69f. となりました。

   * PEP 738(16) : Android が tier 3(17) として *note
     公式にサポートされるプラットフォーム: 69f. となりました。

   * ‘wasm32-wasi’ tier 2(18) プラットフォームとしてサポートされるように
     なりました。

   * ‘wasm32-emscripten’ が公式にサポートされるプラットフォームではなく
     なりました。

重要な削除

   * *note PEP 594: 689.: 残っていた 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: 6a0. デスクリプタが削除されました。

リリーススケジュールの変更:

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.4.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.4.2.1 改善された対話的インタープリタ
......................................

PyPy project(1) のコードをベースに作られた新しい Python *note
interactive: 458. シェルがデフォルトで使われるようになりました。これから
は、ターミナル上で *note REPL: 6a3. を起動すると、以下の機能が使えます:

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

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

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

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

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

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

新しいインタラクティブシェルを無効化するには、環境変数 *note
PYTHON_BASIC_REPL: 459. をセットします。インタラクティブモードの詳細につ
いては *note 対話モード: 6a6. を参照してください。

（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.4.2.2 エラーメッセージの改善
..............................

   * インタープリタは、端末にトレースバックを表示する際に デフォルトでカ
     ラー表示を使用するようになりました。この機能は、新たに導入された
     *note PYTHON_COLORS: 68e. 環境変数、および標準の NO_COLOR(1) と
     FORCE_COLOR(2) 環境変数を通じて *note 制御できます: 1ba.。（この機
     能は 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.4.2.3 フリースレッドの CPython
................................

*note global interpreter lock: 68c. (GIL) を無効化するフリースレッドモー
ドで CPython を実行する機能が実験的に追加されました。これは実験的機能の
ため、デフォルトで有効にはなっていません。フリースレッドモードで実行する
には別の実行ファイルが必要で、通常 ‘python3.13t’ か ‘python3.13t.exe’ と
いう名前です。入手するには、公式の *note Windows: 6a9. 版・ *note macOS:
6aa. 版インストーラで 'フリースレッド' とラベルのついたビルド済みバイナ
リをインストールするか、もしくは CPython のソースコードを *note
-disable-gil: 6ab. オプション付きでビルドすることもできます。

フリースレッドで実行することで、CPU コアの上で並列にスレッドを実行できる
ため、使用可能な処理性能をフルに活かすことができます。フリースレッドモー
ドを使うだけでどのようなソフトウェアも恩恵を受けられるわけではないものの
、スレッドを活用するように設計されたプログラムであれば、マルチコアのハー
ドウェアでより高速に実行できることになります。ただし、 'フリースレッドモ
ードは実験的機能' であり、改善が行われている最中です。バグに遭遇したり、
シングルスレッドのパフォーマンスが大きく悪化する可能性があるので、注意し
てください。CPython のフリースレッド版ビルドでも、GIL を有効にした実行に
対応しており、環境変数 *note PYTHON_GIL: 6ac. かコマンドラインオプション
*note -X gil=1: 183. によって有効化できます。

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

C-API 拡張モジュールは、フリースレッド用に別にビルドする必要があります。
*note GIL: 418. 無効状態での実行に対応している拡張モジュールは、 *note
Py_mod_gil: 697. を使用してください。一段階初期化を使用する C 拡張は
*note PyUnstable_Module_SetGIL(): 6af. を使用することで、 GIL 無効状態で
の実行に対応しているかどうかを指定してください。このような仕組みをいずれ
も使用しないモジュールがインポートされると、環境変数 *note PYTHON_GIL:
6ac. か *note -X gil=0: 183. オプションが指定されていない限り、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.4.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: 6b1. 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.4.2.5 Defined mutation semantics for ‘locals()’
.................................................

Historically, the expected result of mutating the return value of *note
locals(): 296. 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: 6b3. (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(): 296. 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(): 190. and *note eval(): 18f.).  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(): 6b4. 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:
298. 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: 6b5. and *note C APIs: 6b6.

(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.4.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.4.3 その他の言語変更
----------------------

   * The compiler now strips common leading whitespace from every line
     in a docstring.  This reduces the size of the *note bytecode cache:
     6b9. (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: 3d.

          >>> 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: 6ba. 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: 677. 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: 6bb. declarations are now permitted in *note except:
     44e. blocks when that global is used in the *note else: 328. block.
     Previously this raised an erroneous *note SyntaxError: 189.
     (Contributed by Irit Katriel in gh-111123(5).)

   * Add *note PYTHON_FROZEN_MODULES: 6bc, a new environment variable
     that determines whether frozen modules are ignored by the import
     machinery, equivalent to the *note -X frozen_modules: 183.
     command-line option.  (Contributed by Yilei Yang in gh-111374(6).)

   * Add *note support for the perf profiler: 6bd. working without frame
     pointers(7) through the new environment variable *note
     PYTHON_PERF_JIT_SUPPORT: 6be. and command-line option *note -X
     perf_jit: 183.  (Contributed by Pablo Galindo in gh-118518(8).)

   * The location of a ‘.python_history’ file can be changed via the new
     *note PYTHON_HISTORY: 6bf. environment variable.  (Contributed by
     Levi Sabah, Zackery Spytz and Hugo van Kemenade in gh-73965(9).)

   * Classes have a new *note __static_attributes__: 68f. 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(): 190. and *note eval(): 18f. builtins now accept
     the 'globals' and 'locals' arguments as keywords.  (Contributed by
     Raphael Gaschignard in gh-105879(12))

   * The *note compile(): 1d3. 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__: 6c0. attribute on *note property: 6c1.
     objects.  (Contributed by Eugene Toder in gh-101860(14).)

   * Add *note PythonFinalizationError: 691, a new exception derived
     from *note RuntimeError: 317. and used to signal when operations
     are blocked during *note finalization: 1ab.  The following
     callables now raise ‘PythonFinalizationError’, instead of
     ‘RuntimeError’:

        * *note _thread.start_new_thread(): 6c2.

        * *note os.fork(): 6c3.

        * *note os.forkpty(): 6c4.

        * *note subprocess.Popen: 6c5.

     (Contributed by Victor Stinner in gh-114570(15).)

   * Allow the 'count' argument of *note str.replace(): 6c6. 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: 8d, *note
     tarfile: e7, and *note zipfile: 13a. 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.4.4 新たなモジュール
----------------------

   * *note dbm.sqlite3: 38.: An SQLite backend for *note dbm: 34.
     (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.4.5 改良されたモジュール
--------------------------

* Menu:

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


File: python.info,  Node: argparse<4>,  Next: 配列,  Up: 改良されたモジュール

1.4.5.1 argparse
................

   * Add the 'deprecated' parameter to the *note add_argument(): 3f4.
     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<5>,  Prev: argparse<4>,  Up: 改良されたモジュール

1.4.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: 6cb. as a *note MutableSequence: 6cc.
     by implementing the *note clear(): 6cd. 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<5>,  Next: asyncio<6>,  Prev: 配列,  Up: 改良されたモジュール

1.4.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(): 6cf.  (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: 2d4.  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: 2f8. unless the class opts in to the new behavior by
     defining the *note AST._field_types: 6d0. mapping.

     (Contributed by Jelle Zijlstra in gh-105858(1), gh-117486(2), and
     gh-118851(3).)

   * *note ast.parse(): 1d4. now accepts an optional argument 'optimize'
     which is passed on to *note compile(): 1d3.  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<6>,  Next: base64<3>,  Prev: ast<5>,  Up: 改良されたモジュール

1.4.5.4 asyncio
...............

   * *note asyncio.as_completed(): 6d2. now returns an object that is
     both an *note asynchronous iterator: 6d3. and a plain *note
     iterator: 6d4. of *note awaitables: 6d5.  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(): 6d6. will now
     automatically remove the Unix socket when the server is closed.
     (Contributed by Pierre Ossman in gh-111246(2).)

   * *note DatagramTransport.sendto(): 6d7. 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: 6d8. and *note QueueShutDown: 6d9. to
     manage queue termination.  (Contributed by Laurie Opperman and Yves
     Duprat in gh-104228(4).)

   * Add the *note Server.close_clients(): 6da. and *note
     Server.abort_clients(): 6db. 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():
     6dc, stopping when any one of them is encountered.  (Contributed by
     Bruce Merry in gh-81322(6).)

   * Improve the behavior of *note TaskGroup: 6dd. 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: 6de, it will now call the
     parent task's *note cancel(): 6df. method.  This ensures that a
     *note CancelledError: 6e0. will be raised at the next *note await:
     439, so the cancellation is not lost.

     An added benefit of these changes is that task groups now preserve
     the cancellation count (*note cancelling(): 6e1.).

     In order to handle some corner cases, *note uncancel(): 6e2. 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(): 46b. is called on an inactive
     *note TaskGroup: 6dd, the given coroutine will be closed (which
     prevents a *note RuntimeWarning: 6e3. 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: 467. and to custom task factories.

     This affects the following function and methods: *note
     asyncio.create_task(): 469, *note asyncio.loop.create_task(): 46a,
     *note asyncio.TaskGroup.create_task(): 46b.  (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<3>,  Next: compileall,  Prev: asyncio<6>,  Up: 改良されたモジュール

1.4.5.5 base64
..............

   * Add *note z85encode(): 1f1. and *note z85decode(): 1fe. functions
     for encoding *note bytes: 1d2. 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<3>,  Prev: base64<3>,  Up: 改良されたモジュール

1.4.5.6 compileall
..................

   * The default number of worker threads and processes is now selected
     using *note os.process_cpu_count(): 6e6. instead of *note
     os.cpu_count(): 6e7.  (Contributed by Victor Stinner in
     gh-109649(1).)

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

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


File: python.info,  Node: concurrent futures<3>,  Next: configparser<2>,  Prev: compileall,  Up: 改良されたモジュール

1.4.5.7 concurrent.futures
..........................

   * The default number of worker threads and processes is now selected
     using *note os.process_cpu_count(): 6e6. instead of *note
     os.cpu_count(): 6e7.  (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<3>,  Up: 改良されたモジュール

1.4.5.8 configparser
....................

   * *note ConfigParser: 6ea. 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<3>,  Prev: configparser<2>,  Up: 改良されたモジュール

1.4.5.9 copy
............

   * The new *note replace(): 461. function and the *note replace
     protocol: 692. 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(): 1da.

        * *note dataclasses.dataclass: 6ec.

        * *note datetime.datetime: 6ed, *note datetime.date: 494, *note
          datetime.time: 495.

        * *note inspect.Signature: 6ee, *note inspect.Parameter: 6ef.

        * *note types.SimpleNamespace: 6f0.

        * *note code objects: 6f1.

     Any user-defined class can also support *note copy.replace(): 461.
     by defining the *note __replace__(): 692. method.  (Contributed by
     Serhiy Storchaka in gh-108751(1).)

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

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


File: python.info,  Node: ctypes<3>,  Next: dbm<2>,  Prev: copy,  Up: 改良されたモジュール

1.4.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: 483. objects have a new *note _align_: 6f3.
     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<2>,  Next: dis<2>,  Prev: ctypes<3>,  Up: 改良されたモジュール

1.4.5.11 dbm
............

   * Add *note dbm.sqlite3: 38, 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<2>,  Up: 改良されたモジュール

1.4.5.12 dis
............

   * Change the output of *note dis: 3b. 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: 6f6.
     command-line option or the 'show_offsets' argument.  (Contributed
     by Irit Katriel in gh-112137(1).)

   * *note get_instructions(): 6f7. no longer represents cache entries
     as separate instructions.  Instead, it returns them as part of the
     *note Instruction: 49b, 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<3>,  Prev: dis<2>,  Up: 改良されたモジュール

1.4.5.13 doctest
................

   * *note doctest: 3d. output is now colored by default.  This can be
     controlled via the new *note PYTHON_COLORS: 68e. environment
     variable as well as the canonical NO_COLOR(1) and FORCE_COLOR(2)
     environment variables.  See also *note 色の制御: 1ba.  (Contributed
     by Hugo van Kemenade in gh-117225(3).)

   * The *note DocTestRunner.run(): 6f9. method now counts the number of
     skipped tests.  Add the *note DocTestRunner.skips: 6fa. and *note
     TestResults.skipped: 6fb. 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<3>,  Next: enum,  Prev: doctest,  Up: 改良されたモジュール

1.4.5.14 email
..............

   * Headers with embedded newlines are now quoted on output.  The *note
     generator: 43. 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:
     6fd.  (Contributed by Bas Bloemsaat and Petr Viktorin in
     gh-121650(1).)

   * *note getaddresses(): 6fe. and *note parseaddr(): 6ff. 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<3>,  Up: 改良されたモジュール

1.4.5.15 enum
.............

   * *note EnumDict: 701. has been made public to better support
     subclassing *note EnumType: 702.


File: python.info,  Node: fractions<2>,  Next: glob<2>,  Prev: enum,  Up: 改良されたモジュール

1.4.5.16 fractions
..................

   * *note Fraction: 1ce. objects now support the standard *note format
     specification mini-language: 704. 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<2>,  Next: importlib,  Prev: fractions<2>,  Up: 改良されたモジュール

1.4.5.17 glob
.............

   * Add *note translate(): 706, 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<2>,  Up: 改良されたモジュール

1.4.5.18 importlib
..................

   * The following functions in *note importlib.resources: 7e. 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(): 708.

        * *note open_binary(): 709.

        * *note open_text(): 70a.

        * *note path(): 70b.

        * *note read_binary(): 70c.

        * *note read_text(): 70d.

     These functions are no longer deprecated and are not scheduled for
     removal.  (Contributed by Petr Viktorin in gh-116608(1).)

   * *note contents(): 70e. remains deprecated in favor of the
     fully-featured *note Traversable: 579. 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.4.5.19 io
...........

   * The *note IOBase: 710. finalizer now logs any errors raised by the
     *note close(): 711. method with *note sys.unraisablehook: 712.
     Previously, errors were ignored silently by default, and only
     logged in *note Python Development Mode: 713. or when using a *note
     Python debug build: 3e3.  (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.4.5.20 ipaddress
..................

   * Add the *note IPv4Address.ipv6_mapped: 715. 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:
     716, *note IPv6Address: 717, *note IPv4Network: 718, and *note
     IPv6Network: 719.  (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.4.5.21 itertools
..................

   * *note batched(): 71b. has a new 'strict' parameter, which raises a
     *note ValueError: 15a. 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<3>,  Prev: itertools<2>,  Up: 改良されたモジュール

1.4.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<3>,  Next: mimetypes<4>,  Prev: marshal,  Up: 改良されたモジュール

1.4.5.23 math
.............

   * The new function *note fma(): 71e. 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<4>,  Next: mmap<2>,  Prev: math<3>,  Up: 改良されたモジュール

1.4.5.24 mimetypes
..................

   * Add the *note guess_file_type(): 720. function to guess a MIME type
     from a filesystem path.  Using paths with *note guess_type(): 721.
     is now *note soft deprecated: 1b2.  (Contributed by Serhiy
     Storchaka in gh-66543(1).)

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

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


File: python.info,  Node: mmap<2>,  Next: multiprocessing<2>,  Prev: mimetypes<4>,  Up: 改良されたモジュール

1.4.5.25 mmap
.............

   * *note mmap: 247. 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: 247. has a new *note seekable(): 723. method that can
     be used when a seekable file-like object is required.  The *note
     seek(): 724. 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: 247. 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<4>,  Prev: mmap<2>,  Up: 改良されたモジュール

1.4.5.26 multiprocessing
........................

   * The default number of worker threads and processes is now selected
     using *note os.process_cpu_count(): 6e6. instead of *note
     os.cpu_count(): 6e7.  (Contributed by Victor Stinner in
     gh-109649(1).)

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

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


File: python.info,  Node: os<4>,  Next: os path<3>,  Prev: multiprocessing<2>,  Up: 改良されたモジュール

1.4.5.27 os
...........

   * Add *note process_cpu_count(): 6e6. 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(): 6e7. and *note process_cpu_count(): 6e6. can be
     overridden through the new environment variable *note
     PYTHON_CPU_COUNT: 727. or the new command-line option *note -X
     cpu_count: 183.  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: 693. to Linux's ‘timer file
     descriptors(3)’ via *note timerfd_create(): 728, *note
     timerfd_settime(): 729, *note timerfd_settime_ns(): 72a, *note
     timerfd_gettime(): 72b, *note timerfd_gettime_ns(): 72c, *note
     TFD_NONBLOCK: 72d, *note TFD_CLOEXEC: 72e, *note TFD_TIMER_ABSTIME:
     72f, and *note TFD_TIMER_CANCEL_ON_SET: 730. (Contributed by Masaru
     Tsuchiyama in gh-108277(4).)

   * *note lchmod(): 731. and the 'follow_symlinks' argument of *note
     chmod(): 732. 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(): 733. and support for file descriptors in *note
     chmod(): 732. are both now available on Windows.  (Contributed by
     Serhiy Storchaka in gh-113191(6).)

   * On Windows, *note mkdir(): 734. and *note makedirs(): 24b. now
     support passing a 'mode' value of ‘0o700’ to apply access control
     to the new directory.  This implicitly affects *note
     tempfile.mkdtemp(): 735. 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(): 736. 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(): 736. can now use the *note
     POSIX_SPAWN_CLOSEFROM: 737. 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<3>,  Next: pathlib<5>,  Prev: os<4>,  Up: 改良されたモジュール

1.4.5.28 os.path
................

   * Add *note isreserved(): 2e5. 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(): 739. 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(): 24d. 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<5>,  Next: pdb<4>,  Prev: os path<3>,  Up: 改良されたモジュール

1.4.5.29 pathlib
................

   * Add *note UnsupportedOperation: 73b, which is raised instead of
     *note NotImplementedError: 5a1. when a path operation isn't
     supported.  (Contributed by Barney Gale in gh-89812(1).)

   * Add a new constructor for creating *note Path: 4f5. objects from
     'file' URIs (‘file:///’), *note Path.from_uri(): 73c.  (Contributed
     by Barney Gale in gh-107465(2).)

   * Add *note PurePath.full_match(): 73d. for matching paths with
     shell-style wildcards, including the recursive wildcard "‘**’".
     (Contributed by Barney Gale in gh-73435(3).)

   * Add the *note PurePath.parser: 73e. 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():
     73f. and *note rglob(): 740.  (Contributed by Barney Gale in
     gh-77609(4).)

   * *note Path.glob(): 73f. and *note rglob(): 740. 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: 741, *note Path.is_dir: 742, *note Path.owner(): 743,
     and *note Path.group(): 744.  (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<4>,  Next: queue,  Prev: pathlib<5>,  Up: 改良されたモジュール

1.4.5.30 pdb
............

   * *note breakpoint(): 500. and *note set_trace(): 501. 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: 746. is set.
     (Contributed by Tian Gao and Christian Walther in gh-111762(2).)

   * *note zipapp: 139. 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(): 747. using the new *note exceptions
     [exc_number]: 748. 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<4>,  Up: 改良されたモジュール

1.4.5.31 queue
..............

   * Add *note Queue.shutdown: 74a. and *note ShutDown: 74b. 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<3>,  Prev: queue,  Up: 改良されたモジュール

1.4.5.32 random
...............

   * Add a *note command-line interface: 694.  (Contributed by Hugo van
     Kemenade in gh-118131(1).)

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

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


File: python.info,  Node: re<3>,  Next: shutil<2>,  Prev: random,  Up: 改良されたモジュール

1.4.5.33 re
...........

   * Rename ‘re.error’ to *note PatternError: 74e. for improved clarity.
     ‘re.error’ is kept for backward compatibility.


File: python.info,  Node: shutil<2>,  Next: site,  Prev: re<3>,  Up: 改良されたモジュール

1.4.5.34 shutil
...............

   * Support the 'dir_fd' and 'follow_symlinks' keyword arguments in
     *note chown(): 750.  (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<3>,  Prev: shutil<2>,  Up: 改良されたモジュール

1.4.5.35 site
.............

   * ‘.pth’ files are now decoded using UTF-8 first, and then with the
     *note locale encoding: 752. 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<3>,  Next: ssl<3>,  Prev: site,  Up: 改良されたモジュール

1.4.5.36 sqlite3
................

   * A *note ResourceWarning: 754. is now emitted if a *note Connection:
     3e6. object is not *note closed: 755. explicitly.  (Contributed by
     Erlend E. Aasland in gh-105539(1).)

   * Add the 'filter' keyword-only parameter to *note
     Connection.iterdump(): 756. 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<3>,  Next: statistics,  Prev: sqlite3<3>,  Up: 改良されたモジュール

1.4.5.37 ssl
............

   * The *note create_default_context(): 695. API now includes *note
     VERIFY_X509_PARTIAL_CHAIN: 696. and *note VERIFY_X509_STRICT: 758.
     in its default flags.

          注釈: *note VERIFY_X509_STRICT: 758. 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<2>,  Prev: ssl<3>,  Up: 改良されたモジュール

1.4.5.38 statistics
...................

   * Add *note kde(): 75a. 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(): 75b. for sampling from an estimated
     probability density function created by *note kde(): 75a.
     (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<2>,  Next: sys<4>,  Prev: statistics,  Up: 改良されたモジュール

1.4.5.39 subprocess
...................

   * The *note subprocess: df. module now uses the *note posix_spawn():
     736. function in more situations.

     Notably, when 'close_fds' is ‘True’ (the default), *note
     posix_spawn(): 736. 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: df. to never use
     *note posix_spawn(): 736.  Please report your reason and platform
     details in the *note issue tracker: 75e. 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<4>,  Next: tempfile,  Prev: subprocess<2>,  Up: 改良されたモジュール

1.4.5.40 sys
............

   * Add the *note _is_interned(): 760. 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<4>,  Up: 改良されたモジュール

1.4.5.41 tempfile
.................

   * On Windows, the default mode ‘0o700’ used by *note
     tempfile.mkdtemp(): 735. now limits access to the new directory due
     to changes to *note os.mkdir(): 734.  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<3>,  Prev: tempfile,  Up: 改良されたモジュール

1.4.5.42 time
.............

   * On Windows, *note monotonic(): 763. 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(): 764. 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<3>,  Next: traceback,  Prev: time,  Up: 改良されたモジュール

1.4.5.43 tkinter
................

   * Add *note tkinter: f9. 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: f9. 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: 193,
     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: 32e. 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():
     766. method of *note tkinter.ttk.Style: 767.  (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<4>,  Prev: tkinter<3>,  Up: 改良されたモジュール

1.4.5.44 traceback
..................

   * Add the *note exc_type_str: 769. attribute to *note
     TracebackException: 76a, which holds a string display of the
     'exc_type'.  Deprecate the *note exc_type: 76b. 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(): 76c. to (recursively)
     format the nested exceptions of a *note BaseExceptionGroup: 76d.
     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<4>,  Next: typing<4>,  Prev: traceback,  Up: 改良されたモジュール

1.4.5.45 types
..............

   * *note SimpleNamespace: 6f0. 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<4>,  Next: unicodedata<3>,  Prev: types<4>,  Up: 改良されたモジュール

1.4.5.46 typing
...............

   * PEP 705(1): Add *note ReadOnly: 69c, a special typing construct to
     mark a *note TypedDict: 29b. item as read-only for type checkers.

   * PEP 742(2): Add *note TypeIs: 69d, a typing construct that can be
     used to instruct a type checker how to narrow a type.

   * Add *note NoDefault: 770, a sentinel object used to represent the
     defaults of some parameters in the *note typing: 10d. module.
     (Contributed by Jelle Zijlstra in gh-116126(3).)

   * Add *note get_protocol_members(): 771. to return the set of members
     defining a *note typing.Protocol: 772.  (Contributed by Jelle
     Zijlstra in gh-104873(4).)

   * Add *note is_protocol(): 773. to check whether a class is a *note
     Protocol: 772.  (Contributed by Jelle Zijlstra in gh-104873(5).)

   * *note ClassVar: 774. can now be nested in *note Final: 775, 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<3>,  Next: venv<2>,  Prev: typing<4>,  Up: 改良されたモジュール

1.4.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<2>,  Next: warnings<2>,  Prev: unicodedata<3>,  Up: 改良されたモジュール

1.4.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: 778. and *note
     create(): 779.), 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<2>,  Next: xml<2>,  Prev: venv<2>,  Up: 改良されたモジュール

1.4.5.49 warnings
.................

   * PEP 702(1): The new *note warnings.deprecated(): 69b. decorator
     provides a way to communicate deprecations to a *note static type
     checker: 77b. and to warn on usage of deprecated classes and
     functions.  A *note DeprecationWarning: 2d4. 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<2>,  Next: zipimport<2>,  Prev: warnings<2>,  Up: 改良されたモジュール

1.4.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(): 77d.

        * *note xml.etree.ElementTree.XMLPullParser.flush(): 77e.

        * *note xml.parsers.expat.xmlparser.GetReparseDeferralEnabled():
          77f.

        * *note xml.parsers.expat.xmlparser.SetReparseDeferralEnabled():
          780.

        * ‘xml.sax.expatreader.ExpatParser.flush()’

     (Contributed by Sebastian Pipping in gh-115623(2).)

   * Add the ‘close()’ method for the iterator returned by *note
     iterparse(): 3f2. 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<2>,  Prev: xml<2>,  Up: 改良されたモジュール

1.4.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.4.6 最適化
------------

   * Several standard library modules have had their import times
     significantly improved.  For example, the import time of the *note
     typing: 10d. module has been reduced by around a third by removing
     dependencies on *note re: c1. and *note contextlib: 27.  Other
     modules to enjoy import-time speedups include *note email.utils:
     53, *note enum: 59, *note functools: 62, *note importlib.metadata:
     7d, and *note threading: f6.  (Contributed by Alex Waygood,
     Shantanu Jain, Adam Turner, Daniel Hollas, and others in
     gh-109653(1).)

   * *note textwrap.indent(): 783. is now around 30% faster than before
     for large input.  (Contributed by Inada Naoki in gh-107369(2).)

   * The *note subprocess: df. module now uses the *note posix_spawn():
     736. 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: 75d. 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.4.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: locale<2>.
* opcode::
* optparse::
* pathlib: pathlib<6>.
* re: re<4>.
* tkinter.tix: tkinter tix.
* turtle: turtle<2>.
* typing: typing<5>.
* unittest: unittest<3>.
* urllib: urllib<3>.
* webbrowser: webbrowser<3>.


File: python.info,  Node: PEP 594 Remove "dead batteries" from the standard library,  Next: 2to3,  Up: Removed Modules And APIs

1.4.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(): 58f. for ‘GET’ and ‘HEAD’ requests,
          and the *note email.message: 47. module or the multipart(5)
          library for ‘POST’ and ‘PUT’ requests.

        * ‘cgi.parse()’ can be replaced by calling *note
          urllib.parse.parse_qs(): 590. 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: 3e. package, which implements the same MIME
          RFCs.  For example, with *note email.message.EmailMessage:
          221.:

               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: 3e. package, which implements the same
          MIME RFCs, or with the multipart(6) library.  For example, the
          *note email.message.EmailMessage: 221. and *note
          email.message.Message: 786. 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: 6b.
     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: 2d. 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: df. module instead.  Use *note
     shlex.quote(): 787. 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.4.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.4.7.3 builtins
................

   * Remove support for chained *note classmethod: 6a0. descriptors
     (introduced in gh-63272(1)).  These can no longer be used to wrap
     other descriptors, such as *note property: 6c1.  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: 317. when calling *note frame.clear():
     78a. 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.4.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<2>,  Prev: configparser<3>,  Up: Removed Modules And APIs

1.4.7.5 importlib.metadata
..........................

   * Remove deprecated subscript (*note __getitem__(): 78d.) access for
     *note EntryPoint: 78e. objects.  (Contributed by Jason R. Coombs in
     gh-113175(1).)

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

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


File: python.info,  Node: locale<2>,  Next: opcode,  Prev: importlib metadata,  Up: Removed Modules And APIs

1.4.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<2>,  Up: Removed Modules And APIs

1.4.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: 3b, 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<6>,  Prev: opcode,  Up: Removed Modules And APIs

1.4.7.8 optparse
................

   * This module is no longer considered *note soft deprecated: 1b2.
     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<6>,  Next: re<4>,  Prev: optparse,  Up: Removed Modules And APIs

1.4.7.9 pathlib
...............

   * Remove the ability to use *note Path: 4f5. 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<4>,  Next: tkinter tix,  Prev: pathlib<6>,  Up: Removed Modules And APIs

1.4.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<4>,  Up: Removed Modules And APIs

1.4.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<5>,  Prev: tkinter tix,  Up: Removed Modules And APIs

1.4.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<5>,  Next: unittest<3>,  Prev: turtle<2>,  Up: Removed Modules And APIs

1.4.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: 10d. module.  (Contributed by Sebastian
     Rittau in gh-92871(1).)

   * Remove the keyword-argument method of creating *note TypedDict:
     29b. 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<3>,  Next: urllib<3>,  Prev: typing<5>,  Up: Removed Modules And APIs

1.4.7.14 unittest
.................

   * Remove the following *note unittest: 10f. functions, deprecated in
     Python 3.11:

        * ‘unittest.findTestCases()’

        * ‘unittest.makeSuite()’

        * ‘unittest.getTestCaseNames()’

     Use *note TestLoader: 798. methods instead:

        * *note loadTestsFromModule(): 799.

        * *note loadTestsFromTestCase(): 79a.

        * *note getTestCaseNames(): 79b.

     (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<3>,  Prev: unittest<3>,  Up: Removed Modules And APIs

1.4.7.15 urllib
...............

   * Remove the 'cafile', 'capath', and 'cadefault' parameters of the
     *note urllib.request.urlopen(): 586. function, deprecated in Python
     3.6.  Use the 'context' parameter instead with an *note SSLContext:
     33e. instance.  The *note ssl.SSLContext.load_cert_chain(): 79d.
     function can be used to load specific certificates, or let *note
     ssl.create_default_context(): 695. 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<3>,  Prev: urllib<3>,  Up: Removed Modules And APIs

1.4.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: 79f. 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.4.8 New Deprecations
----------------------

   * *note User-defined functions: 7a1.:

        * Deprecate assignment to a function's *note __code__: 7a2.
          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: 30d.) for Unicode characters instead.
          (Contributed by Hugo van Kemenade in gh-80480(2).)

   * *note ctypes: 2d.:

        * Deprecate the undocumented ‘SetPointerType()’ function, to be
          removed in Python 3.15.  (Contributed by Victor Stinner in
          gh-105733(3).)

        * *note Soft-deprecate: 1b2. the *note ARRAY(): 7a3. function in
          favour of ‘type * length’ multiplication.  (Contributed by
          Victor Stinner in gh-105733(4).)

   * *note decimal: 39.:

        * Deprecate the non-standard and undocumented *note Decimal:
          1cd. 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: 3b.:

        * Deprecate the ‘HAVE_ARGUMENT’ separator.  Check membership in
          *note hasarg: 7a4. instead.  (Contributed by Irit Katriel in
          gh-109319(6).)

   * *note gettext: 66.:

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

        * Deprecate the undocumented ‘glob0()’ and ‘glob1()’ functions.
          Use *note glob(): 2df. and pass a *note path-like object: 7a5.
          specifying the root directory to the 'root_dir' parameter
          instead.  (Contributed by Barney Gale in gh-117337(8).)

   * *note http.server: 75.:

        * Deprecate ‘CGIHTTPRequestHandler’, 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: 1b2. file path arguments to *note
          guess_type(): 721, use *note guess_file_type(): 720. instead.
          (Contributed by Serhiy Storchaka in gh-66543(11).)

   * *note re: c1.:

        * Deprecate passing the optional 'maxsplit', 'count', or 'flags'
          arguments as positional arguments to the module-level *note
          split(): 7a6, *note sub(): 7a7, and *note subn(): 7a8.
          functions.  These parameters will become *note keyword-only:
          7a9. in a future version of Python.  (Contributed by Serhiy
          Storchaka in gh-56166(12).)

   * *note pathlib: a8.:

        * Deprecate ‘.PurePath.is_reserved()’, to be removed in Python
          3.15.  Use *note os.path.isreserved(): 2e5. to detect reserved
          paths on Windows.  (Contributed by Barney Gale in
          gh-88569(13).)

   * *note platform: af.:

        * Deprecate ‘platform.java_ver()’, 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: bd.:

        * Deprecate the undocumented ‘ispackage()’ function.
          (Contributed by Zackery Spytz in gh-64020(15).)

   * *note sqlite3: d7.:

        * Deprecate passing more than one positional argument to the
          *note connect(): 3e7. function and the *note Connection: 3e6.
          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():
          3e8. and *note Connection.create_aggregate(): 3e9. 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(): 3ea, *note set_progress_handler():
          3eb, and *note set_trace_callback(): 3ec. *note Connection:
          3e6. methods.  The callback callables will become
          positional-only in Python 3.15.  (Contributed by Erlend E.
          Aasland in gh-108278(18).)

   * *note sys: e2.:

        * Deprecate the ‘_enablelegacywindowsfsencoding()’ function, to
          be removed in Python 3.16.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 15e. environment variable
          instead.  (Contributed by Inada Naoki in gh-73427(19).)

   * *note tarfile: e7.:

        * Deprecate the undocumented and unused ‘TarInfo.tarfile’
          attribute, to be removed in Python 3.16.  (Contributed in
          gh-115256(20).)

   * *note traceback: 107.:

        * Deprecate the *note TracebackException.exc_type: 76b.
          attribute.  Use *note TracebackException.exc_type_str: 769.
          instead.  (Contributed by Irit Katriel in gh-112332(21).)

   * *note typing: 10d.:

        * Deprecate the undocumented keyword argument syntax for
          creating *note NamedTuple: 2f0. 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: 2f0. or *note typing.TypedDict: 29b. 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 ‘typing.no_type_check_decorator()’ decorator
          function, to be removed in Python 3.15.  After eight years in
          the *note typing: 10d. module, it has yet to be supported by
          any major type checker.  (Contributed by Alex Waygood in
          gh-106309(25).)

        * Deprecate *note typing.AnyStr: 7aa.  In Python 3.16, it will
          be removed from ‘typing.__all__’, and a *note
          DeprecationWarning: 2d4. 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: 7ab. instead.
          (Contributed by Michael The in gh-107116(26).)

   * *note wave: 11c.:

        * Deprecate the ‘getmark()’, ‘setmark()’ and ‘getmarkers()’
          methods of the *note Wave_read: 2f2. and *note Wave_write:
          2f3. 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<4>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<3>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<4>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<3>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<3>.
* Pending removal in future versions: Pending removal in future versions<4>.

   ---------- 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.4.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: 2d4. 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: 570. 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(): 573. method of the default event
          loop policy now emits a *note DeprecationWarning: 2d4. 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: 3e.: Deprecated the 'isdst' parameter in *note
     email.utils.localtime(): 576.  (Contributed by Alan Williams in
     gh-72346(6).)

   * *note importlib.abc: 7b. deprecated classes:

        * ‘importlib.abc.ResourceReader’

        * ‘importlib.abc.Traversable’

        * ‘importlib.abc.TraversableResources’

     Use *note importlib.resources.abc: 7f. classes instead:

        * *note importlib.resources.abc.Traversable: 579.

        * *note importlib.resources.abc.TraversableResources: 578.

     (Contributed by Jason R. Coombs and Hugo van Kemenade in
     gh-93963(7).)

   * *note itertools: 84. 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(): 4dd. or *note set_start_method(): 4de. APIs to
     explicitly specify when your code 'requires' ‘'fork'’.  See *note
     コンテキストと開始方式: 474.

   * *note pathlib: a8.: *note is_relative_to(): 57d. and *note
     relative_to(): 57c.: passing additional arguments is deprecated.

   * *note pkgutil: ae.: ‘pkgutil.find_loader()’ and
     ‘pkgutil.get_loader()’ now raise *note DeprecationWarning: 2d4.;
     use *note importlib.util.find_spec(): 7ad. instead.  (Contributed
     by Nikita Sobolev in gh-97850(10).)

   * *note pty: b9.:

        * ‘master_open()’: use *note pty.openpty(): 580.

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

   * *note sqlite3: d7.:

        * ‘version’ and ‘version_info’.

        * *note execute(): 7ae. and *note executemany(): 7af. if *note
          named placeholders: 7b0. are used and 'parameters' is a
          sequence instead of a *note dict: 193.

   * *note urllib: 111.: ‘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<4>,  Prev: Pending removal in Python 3 14,  Up: New Deprecations

1.4.8.2 Pending removal in Python 3.15
......................................

   * The import system:

        * Setting ‘__cached__’ on a module while failing to set *note
          __spec__.cached: 592. 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__: 593. on a module while failing to
          set *note __spec__.parent: 594. 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: 2d.:

        * The undocumented ‘ctypes.SetPointerType()’ function has been
          deprecated since Python 3.13.

   * *note http.server: 75.:

        * The obsolete and rarely used ‘CGIHTTPRequestHandler’ 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: 7a.:

        * ‘load_module()’ method: use ‘exec_module()’ instead.

   * *note pathlib: a8.:

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

   * *note platform: af.:

        * ‘platform.java_ver()’ 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: e4.:

        * The 'check_home' argument of *note
          sysconfig.is_python_build(): 2e9. has been deprecated since
          Python 3.12.

   * *note threading: f6.:

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

        * *note types.CodeType: 2ed.: Accessing ‘codeobject.co_lnotab’
          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: 2d4. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(4).)

   * *note typing: 10d.:

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

   * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.

   * *note wave: 11c.:

        * The ‘getmark()’, ‘setmark()’ and ‘getmarkers()’ methods of the
          *note Wave_read: 2f2. and *note Wave_write: 2f3. classes have
          been deprecated since Python 3.13.

   * *note zipimport: 13b.:

        * ‘zipimport.zipimporter.load_module()’ has been deprecated
          since Python 3.10.  Use *note exec_module(): 2f5. instead.
          (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<4>,  Next: Pending removal in Python 3 17<3>,  Prev: Pending removal in Python 3 15<3>,  Up: New Deprecations

1.4.8.3 Pending removal in Python 3.16
......................................

   * The import system:

        * Setting *note __loader__: 30b. on a module while failing to
          set *note __spec__.loader: 30c. 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: 30d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 154. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 314. or *note
          asyncio.Runner: 315. 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: 62.:

        * Calling the Python implementation of *note functools.reduce():
          156. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8a.:

        * 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(): 159.  Undotted extensions are
          deprecated and will raise a *note ValueError: 15a. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: cd.:

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

   * *note symtable: e1.:

        * The ‘symtable.Class.get_methods()’ method has been deprecated
          since Python 3.14.

   * *note sys: e2.:

        * The ‘_enablelegacywindowsfsencoding()’ function has been
          deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 15e. environment variable
          instead.

   * *note sysconfig: e4.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 160. instead.

   * *note tarfile: e7.:

        * The undocumented and unused ‘TarInfo.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 Python 3 18<4>,  Prev: Pending removal in Python 3 16<4>,  Up: New Deprecations

1.4.8.4 Pending removal in Python 3.17
......................................

   * *note datetime: 33.:

        * *note strptime(): 2dd. calls using a format string containing
          ‘%e’ (day of month) without a year.  This has been deprecated
          since Python 3.15.  (Contributed by Stan Ulbrych in
          gh-70647(1).)

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 2d6. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(2) for more details.  (Contributed by Shantanu
          Jain in gh-91896(3).)

   * *note encodings: 54.:

        - Passing non-ascii 'encoding' names to *note
          encodings.normalize_encoding(): 31b. is deprecated and
          scheduled for removal in Python 3.17.  (Contributed by Stan
          Ulbrych in gh-136702(4).)

   * *note webbrowser: 11e.:

        - ‘webbrowser.MacOSXOSAScript’ is deprecated in favour of
          ‘webbrowser.MacOS’.  (gh-137586(5))

   * *note typing: 10d.:

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

        - *note typing.ByteString: 2ef, 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: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(6) for more details.  (Contributed by Shantanu
          Jain in gh-91896(7).)

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

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

   (2) https://peps.python.org/pep-0688/#current-options

   (3) https://github.com/python/cpython/issues/91896

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

   (5) https://github.com/python/cpython/issues/137586

   (6) https://peps.python.org/pep-0688/#current-options

   (7) https://github.com/python/cpython/issues/91896


File: python.info,  Node: Pending removal in Python 3 18<4>,  Next: Pending removal in Python 3 19<3>,  Prev: Pending removal in Python 3 17<3>,  Up: New Deprecations

1.4.8.5 Pending removal in Python 3.18
......................................

   * No longer accept a boolean value when a file descriptor is
     expected.  (Contributed by Serhiy Storchaka in gh-82626(1).)

   * *note decimal: 39.:

        * The non-standard and undocumented *note Decimal: 1cd. 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(2).)

   * Deprecations defined by PEP 829(3):

        * ‘import’ lines in ‘`name'.pth’ files are silently ignored.

     (Contributed by Barry Warsaw in gh-148641(4).)

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

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

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

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

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


File: python.info,  Node: Pending removal in Python 3 19<3>,  Next: Pending removal in Python 3 20<3>,  Prev: Pending removal in Python 3 18<4>,  Up: New Deprecations

1.4.8.6 Pending removal in Python 3.19
......................................

   * *note ctypes: 2d.:

        * Implicitly switching to the MSVC-compatible struct layout by
          setting *note _pack_: 320. but not *note _layout_: 321. on
          non-Windows platforms.

   * *note hashlib: 6b.:

        - In hash function constructors such as *note new(): 2fd. or the
          direct hash-named constructors such as *note md5(): 2fe. and
          *note sha256(): 2ff, their optional initial data parameter
          could also be passed a keyword argument named ‘data=’ or
          ‘string=’ in various ‘hashlib’ implementations.

          Support for the ‘string’ keyword argument name is now
          deprecated and slated for removal in Python 3.19.

          Before Python 3.13, the ‘string’ keyword parameter was not
          correctly supported depending on the backend implementation of
          hash functions.  Prefer passing the initial data as a
          positional argument for maximum backwards compatibility.

   * *note http.cookies: 74.:

        * *note http.cookies.Morsel.js_output(): 300. is deprecated and
          will be removed in Python 3.19.

        * *note http.cookies.BaseCookie.js_output(): 301. is deprecated
          and will be removed in Python 3.19.

   * *note imaplib: 77.:

        * Altering *note IMAP4.file: 304. is now deprecated and slated
          for removal in Python 3.19.  This property is now unused and
          changing its value does not automatically close the current
          file.

          Before Python 3.14, this property was used to implement the
          corresponding ‘read()’ and ‘readline()’ methods for *note
          IMAP4: 322. but this is no longer the case since then.


File: python.info,  Node: Pending removal in Python 3 20<3>,  Next: Pending removal in future versions<4>,  Prev: Pending removal in Python 3 19<3>,  Up: New Deprecations

1.4.8.7 Pending removal in Python 3.20
......................................

   * Calling the ‘__new__()’ method of *note struct.Struct: 307. without
     the 'format' argument is deprecated and will be removed in Python
     3.20.  Calling *note __init__(): 306. method on initialized
     ‘Struct’ objects is deprecated and will be removed in Python 3.20.

     (Contributed by Sergey B Kirpichev and Serhiy Storchaka in
     gh-143715(1).)

   * The ‘__version__’, ‘version’ and ‘VERSION’ attributes have been
     deprecated in these standard library modules and will be removed in
     Python 3.20.  Use *note sys.version_info: 308. instead.

        - *note argparse: 7.

        - *note csv: 2c.

        - *note ctypes: 2d.

        - ‘ctypes.macholib’

        - *note decimal: 39. (use *note decimal.SPEC_VERSION: 309.
          instead)

        - *note http.server: 75.

        - *note imaplib: 77.

        - *note ipaddress: 83.

        - *note json: 85.

        - *note logging: 8a. (‘__date__’ also deprecated)

        - *note optparse: a4.

        - *note pickle: ab.

        - *note platform: af.

        - *note re: c1.

        - *note socketserver: d5.

        - *note tabnanny: e6.

        - *note tarfile: e7.

        - *note tkinter.font: fe.

        - *note tkinter.ttk: 102.

        - *note wsgiref.simple_server: 124.

        - *note xml.etree.ElementTree: 12e.

        - ‘xml.sax.expatreader’

        - *note xml.sax.handler: 133.

        - *note zlib: 13c.

     (Contributed by Hugo van Kemenade and Stan Ulbrych in gh-76007(2).)

   * Deprecations defined by PEP 829(3):

        * Warnings are produced for ‘import’ lines found in ‘`name'.pth’
          files.

        * ‘`name'.pth’ files are no longer decoded in the locale
          encoding by default.  They 'MUST' be encoded in ‘utf-8-sig’.

     (Contributed by Barry Warsaw in gh-148641(4).)

   * *note ast: 9.:

        * Creating instances of abstract AST nodes (such as *note
          ast.AST: 2f8. or ‘ast.expr’) is deprecated and will raise an
          error in Python 3.20.

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

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

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

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

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


File: python.info,  Node: Pending removal in future versions<4>,  Prev: Pending removal in Python 3 20<3>,  Up: New Deprecations

1.4.8.8 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(): 325. is now deprecated.

        * The *note argparse.FileType: 326. 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:
          327, *note else: 328, *note for: 329, *note if: 32a, *note in:
          32b, *note is: 32c. and *note or: 32d.  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: 32e.

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

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 330.: 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(): 330. 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:
     331. and *note calendar.FEBRUARY: 332.  (Contributed by Prince
     Roshan in gh-103636(3).)

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

   * ‘codeobject.co_lnotab’: use the *note codeobject.co_lines(): 335.
     method instead.

   * *note datetime: 33.:

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

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

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

   * *note importlib: 7a.:

        * *note cache_from_source(): 338. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7d.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8a.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 339. instead.

   * *note mailbox: 8e.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 33a. in a
     multi-threaded process.

   * *note os.path: a6.: *note os.path.commonprefix(): 33b. is
     deprecated, use *note os.path.commonpath(): 33c. for path prefixes.
     The ‘os.path.commonprefix()’ function is being deprecated due to
     having a misleading name and module.  The function is not safe to
     use for path prefixes despite being included in a module about path
     manipulation, meaning it is easy to accidentally introduce path
     traversal vulnerabilities into Python programs by using this
     function.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: c1.: 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).)

   * *note shutil: cd.: *note rmtree(): 33d.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d8. options and protocols:

        * *note ssl.SSLContext: 33e. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 33e.: *note set_npn_protocols(): 33f.
          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: f6. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          340.

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

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 342.: use *note
          threading.Thread.daemon: 343. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 344.: use *note
          threading.Thread.name: 345. attribute.

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

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

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

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

   * *note urllib.parse: 113. deprecated functions: *note urlparse():
     2af. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

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

   * *note xml.etree.ElementTree: 12e.: Testing the truth value of an
     *note Element: 34b. 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(): 34c. is deprecated: use *note
     sys._clear_internal_caches(): 34d. 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.4.9 CPython Bytecode Changes
------------------------------

   * The oparg of *note YIELD_VALUE: 7b9. is now ‘1’ if the yield is
     part of a yield-from or await, and ‘0’ otherwise.  The oparg of
     *note RESUME: 7ba. 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.4.10 C API の変更
-------------------

* Menu:

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


File: python.info,  Node: 新しい機能<3>,  Next: Changed C APIs<2>,  Up: C API の変更<2>

1.4.10.1 新しい機能
...................

   * Add the *note PyMonitoring C API: 69a. for generating PEP 669(1)
     monitoring events:

        * *note PyMonitoringState: 7bd.

        * *note PyMonitoring_FirePyStartEvent(): 7be.

        * *note PyMonitoring_FirePyResumeEvent(): 7bf.

        * *note PyMonitoring_FirePyReturnEvent(): 7c0.

        * *note PyMonitoring_FirePyYieldEvent(): 7c1.

        * *note PyMonitoring_FireCallEvent(): 7c2.

        * *note PyMonitoring_FireLineEvent(): 7c3.

        * *note PyMonitoring_FireJumpEvent(): 7c4.

        * ‘PyMonitoring_FireBranchEvent’

        * *note PyMonitoring_FireCReturnEvent(): 7c5.

        * *note PyMonitoring_FirePyThrowEvent(): 7c6.

        * *note PyMonitoring_FireRaiseEvent(): 7c7.

        * *note PyMonitoring_FireCRaiseEvent(): 7c8.

        * *note PyMonitoring_FireReraiseEvent(): 7c9.

        * *note PyMonitoring_FireExceptionHandledEvent(): 7ca.

        * *note PyMonitoring_FirePyUnwindEvent(): 7cb.

        * *note PyMonitoring_FireStopIterationEvent(): 7cc.

        * *note PyMonitoring_EnterScope(): 7cd.

        * *note PyMonitoring_ExitScope(): 7ce.

     (Contributed by Irit Katriel in gh-111997(2)).

   * Add *note PyMutex: 699, a lightweight mutex that occupies a single
     byte, and the new *note PyMutex_Lock(): 7cf. and *note
     PyMutex_Unlock(): 7d0. functions.  ‘PyMutex_Lock()’ will release
     the *note GIL: 418. (if currently held) if the operation needs to
     block.  (Contributed by Sam Gross in gh-108724(3).)

   * Add the *note PyTime C API: 7d1. to provide access to system
     clocks:

        * *note PyTime_t: 7d2.

        * *note PyTime_MIN: 7d3. and *note PyTime_MAX: 7d4.

        * *note PyTime_AsSecondsDouble(): 7d5.

        * *note PyTime_Monotonic(): 7d6.

        * *note PyTime_MonotonicRaw(): 7d7.

        * *note PyTime_PerfCounter(): 7d8.

        * *note PyTime_PerfCounterRaw(): 7d9.

        * *note PyTime_Time(): 7da.

        * *note PyTime_TimeRaw(): 7db.

     (Contributed by Victor Stinner and Petr Viktorin in gh-110850(4).)

   * Add the *note PyDict_ContainsString(): 7dc. function with the same
     behavior as *note PyDict_Contains(): 7dd, but 'key' is specified as
     a const char* UTF-8 encoded bytes string, rather than a *note
     PyObject: 1a6.*.  (Contributed by Victor Stinner in gh-108314(5).)

   * Add the *note PyDict_GetItemRef(): 7de. and *note
     PyDict_GetItemStringRef(): 63b. functions, which behave similarly
     to *note PyDict_GetItemWithError(): 7df, but return a *note strong
     reference: 7e0. instead of a *note borrowed reference: 60a.
     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(): 7e1. function, which behaves
     similarly to *note PyDict_SetDefault(): 7e2, but returns a *note
     strong reference: 7e0. instead of a *note borrowed reference: 60a.
     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(): 63c. and *note PyDict_PopString(): 7e3.
     functions to remove a key from a dictionary and optionally return
     the removed value.  This is similar to *note dict.pop(): 7e4,
     though there is no default value, and *note KeyError: 7e5. is not
     raised for missing keys.  (Contributed by Stefan Behnel and Victor
     Stinner in gh-111262(8).)

   * Add the *note PyMapping_GetOptionalItem(): 7e6. and *note
     PyMapping_GetOptionalItemString(): 7e7. functions as alternatives
     to *note PyObject_GetItem(): 7e8. and *note
     PyMapping_GetItemString(): 7e9. respectively.  The new functions do
     not raise *note KeyError: 7e5. 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(): 7ea. and *note
     PyObject_GetOptionalAttrString(): 7eb. functions as alternatives to
     *note PyObject_GetAttr(): 3bf. and *note PyObject_GetAttrString():
     7ec. respectively.  The new functions do not raise *note
     AttributeError: 1b4. 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(): 7ed. function as an
     extension to *note PyErr_WriteUnraisable(): 7ee. that allows
     customizing the warning message.  (Contributed by Serhiy Storchaka
     in gh-108082(11).)

   * Add new functions that return a *note strong reference: 7e0.
     instead of a *note borrowed reference: 60a. for frame locals,
     globals, and builtins, as part of *note PEP 667: 688.:

        * *note PyEval_GetFrameBuiltins(): 7ef. replaces *note
          PyEval_GetBuiltins(): 7f0.

        * *note PyEval_GetFrameGlobals(): 7f1. replaces *note
          PyEval_GetGlobals(): 7f2.

        * *note PyEval_GetFrameLocals(): 7f3. replaces *note
          PyEval_GetLocals(): 7f4.

     (Contributed by Mark Shannon and Tian Gao in gh-74929(12).)

   * Add the *note Py_GetConstant(): 7f5. and *note
     Py_GetConstantBorrowed(): 7f6. functions to get *note strong: 7e0.
     or *note borrowed: 60a. 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(): 7f7. function as a
     replacement for *note PyImport_AddModule(): 7f8. that returns a
     *note strong reference: 7e0. instead of a *note borrowed reference:
     60a.  (Contributed by Victor Stinner in gh-105922(14).)

   * Add the *note Py_IsFinalizing(): 7f9. function to check whether the
     main Python interpreter is *note shutting down: 1ab.  (Contributed
     by Victor Stinner in gh-108014(15).)

   * Add the *note PyList_GetItemRef(): 7fa. function as a replacement
     for *note PyList_GetItem(): 7fb. that returns a *note strong
     reference: 7e0. instead of a *note borrowed reference: 60a.
     (Contributed by Sam Gross in gh-114329(16).)

   * Add the *note PyList_Extend(): 7fc. and *note PyList_Clear(): 7fd.
     functions, mirroring the Python *note list.extend(): 7fe. and *note
     list.clear(): 7ff. methods.  (Contributed by Victor Stinner in
     gh-111138(17).)

   * Add the *note PyLong_AsInt(): 800. function.  It behaves similarly
     to *note PyLong_AsLong(): 801, 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(): 802, *note
     PyLong_FromNativeBytes(): 803, and *note
     PyLong_FromUnsignedNativeBytes(): 804. functions to simplify
     converting between native integer types and Python *note int: 32e.
     objects.  (Contributed by Steve Dower in gh-111140(19).)

   * Add *note PyModule_Add(): 805. function, which is similar to *note
     PyModule_AddObjectRef(): 806. and *note PyModule_AddObject(): 807,
     but always steals a reference to the value.  (Contributed by Serhiy
     Storchaka in gh-86493(20).)

   * Add the *note PyObject_GenericHash(): 808. function that implements
     the default hashing function of a Python object.  (Contributed by
     Serhiy Storchaka in gh-113024(21).)

   * Add the *note Py_HashPointer(): 63f. function to hash a raw
     pointer.  (Contributed by Victor Stinner in gh-111545(22).)

   * Add the *note PyObject_VisitManagedDict(): 809. and *note
     PyObject_ClearManagedDict(): 80a. functions.  which must be called
     by the traverse and clear functions of a type using the *note
     Py_TPFLAGS_MANAGED_DICT: 3a4. 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(): 80b. and *note
     PyRefTracer_GetTracer(): 80c. functions, which enable tracking
     object creation and destruction in the same way that the *note
     tracemalloc: 108. module does.  (Contributed by Pablo Galindo in
     gh-93502(25).)

   * Add the *note PySys_AuditTuple(): 80d. function as an alternative
     to *note PySys_Audit(): 80e. that takes event arguments as a Python
     *note tuple: 1d9. object.  (Contributed by Victor Stinner in
     gh-85283(26).)

   * Add the *note PyThreadState_GetUnchecked(): 63d. function as an
     alternative to *note PyThreadState_Get(): 80f. 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(): 810. function to get
     the type's fully qualified name.  The module name is prepended if
     *note type.__module__: 811. 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(): 812. function to get the
     type's module name.  This is equivalent to getting the *note
     type.__module__: 811. attribute.  (Contributed by Eric Snow and
     Victor Stinner in gh-111696(29).)

   * Add the *note PyUnicode_EqualToUTF8AndSize(): 813. and *note
     PyUnicode_EqualToUTF8(): 814. 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(): 3ac. function as an alternative
     to ‘PyWeakref_GetObject()’ that returns a *note strong reference:
     7e0. 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(): 815. replaces *note
          PyObject_HasAttr(): 816.

        * *note PyObject_HasAttrStringWithError(): 817. replaces *note
          PyObject_HasAttrString(): 818.

        * *note PyMapping_HasKeyWithError(): 819. replaces *note
          PyMapping_HasKey(): 81a.

        * *note PyMapping_HasKeyStringWithError(): 81b. replaces *note
          PyMapping_HasKeyString(): 81c.

     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<2>,  Next: Limited C API Changes,  Prev: 新しい機能<3>,  Up: C API の変更<2>

1.4.10.2 Changed C APIs
.......................

   * The 'keywords' parameter of *note PyArg_ParseTupleAndKeywords():
     81e. and *note PyArg_VaParseTupleAndKeywords(): 81f. 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: 820. macro.  (Contributed by Serhiy Storchaka in
     gh-65210(1).)

   * *note PyArg_ParseTupleAndKeywords(): 81e. 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(): 821.  (Contributed by
     Bogdan Romanyuk in gh-115781(3).)

   * The *note PyDict_GetItem(): 822, *note PyDict_GetItemString(): 823,
     *note PyMapping_HasKey(): 81a, *note PyMapping_HasKeyString(): 81c,
     *note PyObject_HasAttr(): 816, *note PyObject_HasAttrString(): 818,
     and *note PySys_GetObject(): 35e. functions, each of which clears
     all errors which occurred when calling them now reports these
     errors using *note sys.unraisablehook(): 712.  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(): 824.:

        * ‘%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:
     825.  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: 3e3. or *note with
     assertions: 826, *note PyTuple_SET_ITEM(): 827. and *note
     PyList_SET_ITEM(): 828. 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<4>,  Prev: Changed C APIs<2>,  Up: C API の変更<2>

1.4.10.3 Limited C API Changes
..............................

   * The following functions are now included in the Limited C API:

        * *note PyMem_RawMalloc(): 2ca.

        * *note PyMem_RawCalloc(): 82a.

        * *note PyMem_RawRealloc(): 82b.

        * *note PyMem_RawFree(): 82c.

        * *note PySys_Audit(): 80e.

        * *note PySys_AuditTuple(): 80d.

        * *note PyType_GetModuleByDef(): 82d.

     (Contributed by Victor Stinner in gh-85283(1) and gh-116936(2).)

   * Python built with *note -with-trace-refs: 82e. (tracing references)
     now supports the *note Limited API: 82f.  (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<4>,  Next: Deprecated C APIs<4>,  Prev: Limited C API Changes,  Up: C API の変更<2>

1.4.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: 75e. 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): 319. instead.

        * ‘PyObject_CheckReadBuffer()’: Use *note
          PyObject_CheckBuffer(): 831. to test whether the object
          supports the buffer protocol.  Note that
          ‘PyObject_CheckBuffer()’ doesn't guarantee that *note
          PyObject_GetBuffer(): 832. 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(): 832. and *note PyBuffer_Release():
          833. 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():
          832. and *note PyBuffer_Release(): 833. 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(): 834. or *note PyObject_Call():
          835. instead.

               警告: In *note PyObject_Call(): 835, positional arguments
               must be a *note tuple: 1d9. and must not be ‘NULL’, and
               keyword arguments must be a *note dict: 193. 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): 836.

        * ‘PyEval_CallFunction()’: Use *note PyObject_CallFunction():
          837. instead.

        * ‘PyEval_CallMethod()’: Use *note PyObject_CallMethod(): 3be.
          instead.

        * ‘PyCFunction_Call()’: Use *note PyObject_Call(): 835. 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: 838. instead.

        * ‘PySys_AddWarnOption()’: Use *note PyConfig.warnoptions: 838.
          instead.

        * ‘PySys_AddXOption()’: Use *note PyConfig.xoptions: 839.
          instead.

        * ‘PySys_HasWarnOptions()’: Use *note PyConfig.xoptions: 839.
          instead.

        * ‘PySys_SetPath()’: Set *note PyConfig.module_search_paths:
          83a. instead.

        * ‘Py_SetPath()’: Set *note PyConfig.module_search_paths: 83a.
          instead.

        * ‘Py_SetStandardStreamEncoding()’: Set *note
          PyConfig.stdio_encoding: 83b. instead, and set also maybe
          *note PyConfig.legacy_windows_stdio: 634. (on Windows).

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

     Use the new *note PyConfig: 612. API of the *note Python
     Initialization Configuration: 83d. 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(): 83e. and *note
          PyEval_RestoreThread(): 83f.;

        * low-level *note PyEval_AcquireThread(): 840. and *note
          PyEval_RestoreThread(): 83f.;

        * or *note PyGILState_Ensure(): 1b0. and *note
          PyGILState_Release(): 1b1.

     (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(): 841. 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<4>,  Prev: Removed C APIs<4>,  Up: C API の変更<2>

1.4.10.5 Deprecated C APIs
..........................

   * Deprecate old Python initialization functions:

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

        * ‘Py_GetExecPrefix()’: Get *note sys.exec_prefix: 3b0. instead.

        * ‘Py_GetPath()’: Get *note sys.path: 19f. instead.

        * ‘Py_GetPrefix()’: Get *note sys.prefix: 3b3. instead.

        * ‘Py_GetProgramFullPath()’: Get *note sys.executable: 3b4.
          instead.

        * ‘Py_GetProgramName()’: Get *note sys.executable: 3b4. instead.

        * ‘Py_GetPythonHome()’: Get *note PyConfig.home: 610. or the
          *note PYTHONHOME: 3b5. environment variable instead.

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

   * *note Soft deprecate: 1b2. the *note PyEval_GetBuiltins(): 7f0,
     *note PyEval_GetGlobals(): 7f2, and *note PyEval_GetLocals(): 7f4.
     functions, which return a *note borrowed reference: 60a.  (Soft
     deprecated as part of PEP 667(2).)

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

   * *note Soft deprecate: 1b2. the *note PyModule_AddObject(): 807.
     function.  It should be replaced with *note PyModule_Add(): 805. or
     *note PyModule_AddObjectRef(): 806.  (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 ‘PyWeakref_GetObject()’ and ‘PyWeakref_GET_OBJECT()’
     functions, which return a *note borrowed reference: 60a.  Replace
     them with the new *note PyWeakref_GetRef(): 3ac. function, which
     returns a *note strong reference: 7e0.  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<5>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<5>.
* Pending removal in future versions: Pending removal in future versions<5>.

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

1.4.10.6 Pending removal in Python 3.14
.......................................

   * The ‘ma_version_tag’ field in *note PyDictObject: 844. for
     extension modules ( PEP 699(1); gh-101193(2)).

   * Creating *note immutable types: 602. 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<5>,  Prev: Pending removal in Python 3 14<2>,  Up: Deprecated C APIs<4>

1.4.10.7 Pending removal in Python 3.15
.......................................

   * The ‘PyImport_ImportModuleNoBlock()’: Use *note
     PyImport_ImportModule(): 3ab. instead.

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

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

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

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

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

   * Python initialization functions, deprecated in Python 3.13:

        * ‘Py_GetPath()’: Use *note PyConfig_Get("module_search_paths"):
          3ae. (*note sys.path: 19f.) instead.

        * ‘Py_GetPrefix()’: Use *note PyConfig_Get("base_prefix"): 3ae.
          (*note sys.base_prefix: 3b2.) instead.  Use
          ‘PyConfig_Get("prefix")’ (*note sys.prefix: 3b3.) if *note
          virtual environments: 3b1. need to be handled.

        * ‘Py_GetExecPrefix()’: Use *note
          PyConfig_Get("base_exec_prefix"): 3ae. (*note
          sys.base_exec_prefix: 3af.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3b0.) if
          *note virtual environments: 3b1. need to be handled.

        * ‘Py_GetProgramFullPath()’: Use *note
          PyConfig_Get("executable"): 3ae. (*note sys.executable: 3b4.)
          instead.

        * ‘Py_GetProgramName()’: Use *note PyConfig_Get("executable"):
          3ae. (*note sys.executable: 3b4.) instead.

        * ‘Py_GetPythonHome()’: Use *note PyConfig_Get("home"): 3ae. or
          the *note PYTHONHOME: 3b5. environment variable instead.

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

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

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 60e. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 60e. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 60f.
          instead.

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

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

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 613.: Use *note PyConfig.parser_debug:
          614. or *note PyConfig_Get("parser_debug"): 3ae. instead.

        * *note Py_VerboseFlag: 615.: Use *note PyConfig.verbose: 616.
          or *note PyConfig_Get("verbose"): 3ae. instead.

        * *note Py_QuietFlag: 617.: Use *note PyConfig.quiet: 618. or
          *note PyConfig_Get("quiet"): 3ae. instead.

        * *note Py_InteractiveFlag: 619.: Use *note
          PyConfig.interactive: 61a. or *note
          PyConfig_Get("interactive"): 3ae. instead.

        * *note Py_InspectFlag: 61b.: Use *note PyConfig.inspect: 61c.
          or *note PyConfig_Get("inspect"): 3ae. instead.

        * *note Py_OptimizeFlag: 61d.: Use *note
          PyConfig.optimization_level: 61e. or *note
          PyConfig_Get("optimization_level"): 3ae. instead.

        * *note Py_NoSiteFlag: 61f.: Use *note PyConfig.site_import:
          620. or *note PyConfig_Get("site_import"): 3ae. instead.

        * *note Py_BytesWarningFlag: 621.: Use *note
          PyConfig.bytes_warning: 3cc. or *note
          PyConfig_Get("bytes_warning"): 3ae. instead.

        * *note Py_FrozenFlag: 622.: Use *note
          PyConfig.pathconfig_warnings: 623. or *note
          PyConfig_Get("pathconfig_warnings"): 3ae. instead.

        * *note Py_IgnoreEnvironmentFlag: 624.: Use *note
          PyConfig.use_environment: 625. or *note
          PyConfig_Get("use_environment"): 3ae. instead.

        * *note Py_DontWriteBytecodeFlag: 626.: Use *note
          PyConfig.write_bytecode: 627. or *note
          PyConfig_Get("write_bytecode"): 3ae. instead.

        * *note Py_NoUserSiteDirectory: 628.: Use *note
          PyConfig.user_site_directory: 629. or *note
          PyConfig_Get("user_site_directory"): 3ae. instead.

        * *note Py_UnbufferedStdioFlag: 62a.: Use *note
          PyConfig.buffered_stdio: 62b. or *note
          PyConfig_Get("buffered_stdio"): 3ae. instead.

        * *note Py_HashRandomizationFlag: 62c.: Use *note
          PyConfig.use_hash_seed: 62d. and *note PyConfig.hash_seed:
          62e. or *note PyConfig_Get("hash_seed"): 3ae. instead.

        * *note Py_IsolatedFlag: 62f.: Use *note PyConfig.isolated: 630.
          or *note PyConfig_Get("isolated"): 3ae. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 631.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 632. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 3ae. instead.

        * *note Py_LegacyWindowsStdioFlag: 633.: Use *note
          PyConfig.legacy_windows_stdio: 634. or *note
          PyConfig_Get("legacy_windows_stdio"): 3ae. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 635. or *note
          PyConfig_Get("filesystem_encoding"): 3ae. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 636. or *note
          PyConfig_Get("filesystem_errors"): 3ae. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 637. or *note
          PyConfig_Get("utf8_mode"): 3ae. instead.  (see *note
          Py_PreInitialize(): 638.)

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. to set these options.  Or *note
     PyConfig_Get(): 3ae. 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<5>,  Next: Pending removal in Python 3 18<5>,  Prev: Pending removal in Python 3 15<4>,  Up: Deprecated C APIs<4>

1.4.10.8 Pending removal in Python 3.16
.......................................

   * The bundled copy of ‘libmpdec’.


File: python.info,  Node: Pending removal in Python 3 18<5>,  Next: Pending removal in future versions<5>,  Prev: Pending removal in Python 3 16<5>,  Up: Deprecated C APIs<4>

1.4.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(): 5b7.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 63b.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 63c.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 5ce.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 5de.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 63d.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 63e.

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

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 5eb.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 5ea.

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

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

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

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

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

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

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

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 63f.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 5c7.

     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<5>,  Prev: Pending removal in Python 3 18<5>,  Up: Deprecated C APIs<4>

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

   * *note PyErr_Fetch(): 642.: Use *note PyErr_GetRaisedException():
     643. instead.

   * *note PyErr_NormalizeException(): 644.: Use *note
     PyErr_GetRaisedException(): 643. instead.

   * *note PyErr_Restore(): 645.: Use *note PyErr_SetRaisedException():
     646. instead.

   * *note PyModule_GetFilename(): 647.: Use *note
     PyModule_GetFilenameObject(): 648. instead.

   * *note PyOS_AfterFork(): 649.: Use *note PyOS_AfterFork_Child():
     64a. instead.

   * *note PySlice_GetIndicesEx(): 64b.: Use *note PySlice_Unpack():
     64c. and *note PySlice_AdjustIndices(): 64d. instead.

   * *note PyUnicode_READY(): 64e.: Unneeded since Python 3.12

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

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

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

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 651.: Use *note
          PyThread_tss_alloc(): 652. instead.

        * *note PyThread_delete_key(): 653.: Use *note
          PyThread_tss_free(): 654. instead.

        * *note PyThread_set_key_value(): 655.: Use *note
          PyThread_tss_set(): 656. instead.

        * *note PyThread_get_key_value(): 657.: Use *note
          PyThread_tss_get(): 658. instead.

        * *note PyThread_delete_key_value(): 659.: Use *note
          PyThread_tss_delete(): 65a. instead.

        * *note PyThread_ReInitTLS(): 65b.: 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.4.11 Build Changes
--------------------

   * ‘arm64-apple-ios’ and ‘arm64-apple-ios-simulator’ are both now PEP
     11(1) tier 3 platforms.  (*note PEP 730: 69f. 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: 69f. 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: d7.
     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: 84b.
     The bundled mimalloc has custom changes, see gh-113141(13) for
     details.  (Contributed by Dino Viehland in gh-109914(14).)

   * The ‘configure’ option ‘--with-system-libmpdec’ now defaults to
     ‘yes’.  The bundled copy of ‘libmpdec’ will be removed in Python
     3.16.

   * Python built with ‘configure’ *note -with-trace-refs: 82e. (tracing
     references) is now ABI compatible with the Python release build and
     *note debug build: 3e3.  (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: 82f.  (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.4.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.4.12.1 Python API の変更
..........................

   * *note PEP 667: 688. introduces several changes to the semantics of
     *note locals(): 296. and *note f_locals: 298.:

        * Calling *note locals(): 296. in an *note optimized scope: 6b3.
          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(): 296. 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: 298. in an *note optimized
          scope: 6b3. 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: 4ad. now emits a *note FutureWarning: 84d.
     when used as a method.  The behavior will change in future Python
     versions.  Wrap it in *note staticmethod(): 66d. if you want to
     preserve the old behavior.  (Contributed by Serhiy Storchaka in
     gh-121027(5).)

   * An *note OSError: 543. is now raised by *note getpass.getuser():
     84e. for any failure to retrieve a username, instead of *note
     ImportError: 1c8. on non-Unix platforms or *note KeyError: 7e5. on
     Unix platforms where the password database is empty.

   * The value of the ‘mode’ attribute of *note gzip.GzipFile: 84f. 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(): 850. is now ‘'rb'’
     instead of ‘'r'’.  (Contributed by Serhiy Storchaka in
     gh-115961(6).)

   * *note mailbox.Maildir: 851. now ignores files with a leading dot
     (‘.’).  (Contributed by Zackery Spytz in gh-65559(7).)

   * *note pathlib.Path.glob(): 73f. and *note rglob(): 740. 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: f6. 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.4.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: 853. 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: 688. introduces several changes to frame-related
     functions:

        * The effects of mutating the dictionary returned from *note
          PyEval_GetLocals(): 7f4. in an *note optimized scope: 6b3.
          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(): 854, *note locals(): 296,
          and *note FrameType.f_locals: 298. 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(): 854. in an *note optimized
          scope: 6b3. 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(): 855.), or by calling the new *note
          PyEval_GetFrameLocals(): 7f3. 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():
          854. was first introduced.

        * ‘PyFrame_LocalsToFast()’ no longer has any effect.  Calling
          this function is redundant now that *note PyFrame_GetLocals():
          854. returns a write-through proxy for *note optimized scopes:
          6b3.

   * Python 3.13 removed many private functions.  Some of them can be
     replaced using these alternatives:

        * ‘_PyDict_Pop()’: *note PyDict_Pop(): 63c. or *note
          PyDict_PopString(): 7e3.;

        * ‘_PyDict_GetItemWithError()’: *note PyDict_GetItemRef(): 7de.;

        * ‘_PyErr_WriteUnraisableMsg()’: *note PyErr_FormatUnraisable():
          7ed.;

        * ‘_PyEval_SetTrace()’: *note PyEval_SetTrace(): 856. or *note
          PyEval_SetTraceAllThreads(): 857.;

        * ‘_PyList_Extend()’: *note PyList_Extend(): 7fc.;

        * ‘_PyLong_AsInt()’: *note PyLong_AsInt(): 800.;

        * ‘_PyMem_RawStrdup()’: ‘strdup()’;

        * ‘_PyMem_Strdup()’: ‘strdup()’;

        * ‘_PyObject_ClearManagedDict()’: *note
          PyObject_ClearManagedDict(): 80a.;

        * ‘_PyObject_VisitManagedDict()’: *note
          PyObject_VisitManagedDict(): 809.;

        * ‘_PyThreadState_UncheckedGet()’: *note
          PyThreadState_GetUnchecked(): 63d.;

        * ‘_PyTime_AsSecondsDouble()’: *note PyTime_AsSecondsDouble():
          7d5.;

        * ‘_PyTime_GetMonotonicClock()’: *note PyTime_Monotonic(): 7d6.
          or *note PyTime_MonotonicRaw(): 7d7.;

        * ‘_PyTime_GetPerfCounter()’: *note PyTime_PerfCounter(): 7d8.
          or *note PyTime_PerfCounterRaw(): 7d9.;

        * ‘_PyTime_GetSystemClock()’: *note PyTime_Time(): 7da. or *note
          PyTime_TimeRaw(): 7db.;

        * ‘_PyTime_MAX’: *note PyTime_MAX: 7d4.;

        * ‘_PyTime_MIN’: *note PyTime_MIN: 7d3.;

        * ‘_PyTime_t’: *note PyTime_t: 7d2.;

        * ‘_Py_HashPointer()’: *note Py_HashPointer(): 63f.;

        * ‘_Py_IsFinalizing()’: *note Py_IsFinalizing(): 7f9.

     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.4.13 Regression Test Changes
------------------------------

   * Python built with ‘configure’ *note -with-pydebug: 859. now
     supports a *note -X presite=package.module: 183. 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.5 What's New In Python 3.12
=============================


編集者: Adam Turner

この記事では Python 3.11 と比較した Python 3.12 の新機能を解説します。
Python 3.12 は2023年10月2日にリリースされました。全詳細については *note
変更履歴: 145. をご覧ください。

参考
....

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.5.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: 85e. は多くの制限が取り除かれ、 'Did you mean ...'  サ
ジェストも改善され続けています。新しい *note 型パラメータの構文: 85f. と
*note type: 860. 文は、 *note ジェネリック: 1dc. と *note 型エイリアス:
861. を静的型チェッカーで使用する際の人間工学を改善します。

この記事は全ての新機能の完全な仕様を提供しようとするものではなく、便利な
概要について説明をするものです。 全詳細については、 *note
ライブラリリファレンス: 3fe. や *note 言語リファレンス: 3ff. などのドキ
ュメントを参照してください。 変更の実装や設計原理について完全に理解した
い場合は、特定の新機能の PEP を参照してください。 しかし、一旦機能が完全
に実装されると、普通 PEP は最新の状態に保たれないことに注意してください
。

__________________________________________________________________

新たな構文機能:

   * *note PEP 695: 85f, 型パラメータの構文と *note type: 860. 文

新たな文法機能:

   * *note PEP 701: 862, 文法の中の *note f-strings: 85e.

インタープリタの改善:

   * *note PEP 684: 863, インタープリタごとのユニークな *note GIL: 68c.

   * *note PEP 669: 864, 低影響なモニタリング

   * *note NameError: 66c, *note ImportError: 1c8, *note SyntaxError:
     189. 例外に対する *note 'Did you mean ...'  サジェストを改善: 865.
     しました

Python のデータモデルの改善:

   * *note PEP 688: 866, Python の *note バッファプロトコル: 319. を使用
     します

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

   * *note pathlib.Path: 4f5. クラスがサブクラス化をサポートするようにな
     りました

   * *note os: a5. モジュールは Windows サポートのためにいくつかの改良が
     加えられました

   * *note sqlite3: d7. モジュールに *note
     コマンドライン・インターフェース: 263. が追加されました

   * *note runtime-checkable プロトコル: 867. に対する *note
     isinstance(): 2fb. のチェックは、2倍～20倍のスピードアップを実現し
     ます

   * *note asyncio: b. パッケージは多くのパフォーマンスを向上させ、いく
     つかのベンチマークでは75%のスピードアップを示しました。

   * *note uuid: 119. モジュールに *note
     コマンドライン・インターフェース: 868. が追加されました

   * *note PEP 701: 862. の変更により、 *note tokenize: 104. モジュール
     によるトークンの生成は最大で64%速くなりました。

セキュリティの改善:

   * 組み込みの *note hashlib: 6b. による SHA1, SHA3, SHA2-384,
     SHA2-512, MD5 の実装を、 HACL*(1) プロジェクトから正式に検証された
     コードに置き換えます。これらの組み込み実装は、 OpenSSL がそれらを提
     供しない場合にのみ使用されるフォールバックとして残ります。

C API の改善:

   * *note PEP 697: 869, 不安定な C API 層

   * *note PEP 683: 86a, 不変オブジェクト

CPython の実装の改善:

   * *note PEP 709: 86b, 内包表記のインライン化

   * Linux ‘perf’ プロファイラの *note CPython サポート: 6bd.

   * サポートされているプラットフォームでスタック・オーバーフロー保護を
     実装します

新しい型ヒントの機能:

   * *note PEP 692: 86c, *note TypedDict: 29b. を使用して *note
     **kwargs: 86d. をアノテートします

   * *note PEP 698: 86e, *note typing.override(): 86f. デコレータ

重要な非推奨化、削除または制限:

   * PEP 623(2): Python の C API の Unicode オブジェクトから ‘wstr’ を削
     除し、全ての *note str: 1ea. オブジェクトのサイズを少なくとも 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: 11a. で作成された仮想環境には ‘setuptools’
     をプリインストールしません。これは ‘distutils’, ‘setuptools’,
     ‘pkg_resources’, ‘easy_install’ がデフォルトでは利用できなることを
     意味します。これらを利用するには、 *note 有効化された: 870. 仮想環
     境で ‘pip install setuptools’ を実行してください。

   * ‘asynchat’, ‘asyncore’, ‘imp’ モジュールが、いくつかの *note
     unittest.TestCase: 536. *note メソッドのエイリアス: 871. と共に削除
     されました。

   ---------- 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.5.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.5.2.1 PEP 695: 型パラメータの構文
...................................

PEP 484(1) のジェネリッククラスと関数は、型パラメータのスコープが不明確
なまま冗長な構文を使用して宣言されており、差異の明示的な宣言が必要でした
。

PEP 695(2) は ジェネリッククラス と *note 関数: 874. を作成するための、
よりコンパクトで明示的な新しい方法を紹介します:

     def max[T](args: Iterable[T]) -> T:
         ...

     class list[T]:
         def __getitem__(self, index: int, /) -> T:
             ...

         def append(self, element: T) -> None:
             ...

さらに、 PEP では *note 型エイリアス: 875. を宣言する新しい方法が導入さ
れました。 *note type: 860. 文を使用し、 *note TypeAliasType: 531. のイ
ンスタンスを作成します:

     type Point = tuple[float, float]

型エイリアスは *note ジェネリック: 876. とすることもできます:

     type Point[T] = tuple[T, T]

新しい構文では、 *note TypeVarTuple: 29e. と *note ParamSpec: 2a0. パラ
メータ、および *note TypeVar: 29f. パラメータに境界や制約を宣言すること
ができます:

     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 遅延評価: 877. を参照してください)。つまり、型エイリ
アスはファイルの後半で定義された他の型を参照することができます。

型パラメータリストを通して宣言された型パラメータは、宣言のスコープと入れ
子になったスコープ内では表示されますが、外側のスコープでは表示されません
。例えば、ジェネリッククラスのメソッドの型アノテーションやクラス本体で使
用することができます。しかし、クラス定義後にモジュールスコープ内で使用す
ることはできません。型パラメータの実行時の解釈の問題に関する詳細な説明は
*note Type parameter lists: 7ab. を参照してください。

このようなスコープの解釈の問題をサポートするために、 *note
アノテーションスコープ: 6ba. という新しいスコープが導入されました。アノ
テーションスコープはほとんどの場合関数スコープと同じように動作しますが、
外側のクラススコープとは異なる方法で対話します。 Python 3.13 では、
*note アノテーション: 410. もアノテーションスコープで評価されます。

より詳しくは 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.5.2.2 PEP 701: f-strings の構文的な形式化
...........................................

PEP 701(1) は *note f-strings: 85e. の使い方の制限をいくつか解除しました
。 f-string 内の式コンポーネントは有効な Python 式であれば何でも使用でき
るようになりました。これには、 f-string を含む文字列と同じ引用符を再利用
する文字列、複数行の式、コメント、バックスラッシュ、 Unicode エスケープ
シーケンスなどが含まれます。これらについて詳しく説明します:

   * クォートの再利用: Python 3.11 では、 f-string を囲むクォートと同じ
     クォートを再利用すると *note SyntaxError: 189. が発生し、ユーザーは
     他の利用可能なクォート( 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
     エスケープシーケンス: 879. ( ‘\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: 189. を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.5.2.3 PEP 684: インタープリタごとの GIL
.........................................

PEP 684(1) ではインタープリタごとの *note GIL: 68c. が導入され、インター
プリタごとの固有の GIL を使用してサブインタープリタを作成できるようにな
りました。これにより、 Python プログラムは複数の CPU コアを最大限に活用
できるようになります。これは現在 C-API を通じてのみ利用できますが、
Python API は 3.13(2) で利用可能になる予定です。

独自の GIL を持つインタープリタを作成するには、新しい *note
Py_NewInterpreterFromConfig(): 87b. 関数を使います:

     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.5.2.4 PEP 669: CPython の低影響モニタリング
.............................................

PEP 669(1) は、 CPython でイベントを監視するためのプロファイラ、デバッガ
ー、およびその他のツール用の新しい *note API: e3. を定義します。呼び出し
、戻り値、行、例外、ジャンプなどを含む幅広いイベントをカバーします。つま
り、使用した分だけ料金を支払い、オーバーヘッドがほぼゼロのデバッガーとカ
バレッジツールのサポートを提供します。詳細については ‘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.5.2.5 PEP 688: バッファプロトコルを Python で利用可能にする
.............................................................

PEP 688(1) は Python のコードから *note バッファプロトコル: 319. を利用
する方法を導入します。 *note __buffer__(): 87e. メソッドを実装するクラス
は今やバッファ型として利用可能です。

新規追加された *note collections.abc.Buffer: 31a. ABC は、例えば型注釈で
、バッファオブジェクトを表現する標準的な方法を提供します。新規追加された
*note inspect.BufferFlags: 87f. 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.5.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: e1. 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(): 296. 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.5.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: 66c. 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: 66c. 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: 189. 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: 1c8. 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.5.3 型ヒントに関連する新しい機能
----------------------------------

This section covers major changes affecting type hints(1) and the *note
typing: 10d. 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.5.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.5.3.2 PEP 698: Override Decorator for Static Typing
.....................................................

A new decorator *note typing.override(): 86f. has been added to the
*note typing: 10d. 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.5.4 その他の言語変更
----------------------

   * The parser now raises *note SyntaxError: 189. 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: 451, instead of *note
     DeprecationWarning: 2d4.  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: 189. 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: 451,
     instead of *note DeprecationWarning: 2d4.  In a future Python
     version they will be eventually a *note SyntaxError: 189.
     (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: 317.  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: 6de. 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():
     885. 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: 5f6.
     and *note int: 32e.  (Contributed by Serhiy Storchaka in
     gh-60203(10).)

   * *note memoryview: 1dd. now supports the half-float type (the "e"
     format code).  (Contributed by Donghee Na and Antoine Pitrou in
     gh-90751(11).)

   * *note slice: 1db. 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(): 886. 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(): 1d4. now raises *note SyntaxError: 189. instead
     of *note ValueError: 15a. when parsing source code containing null
     bytes.  (Contributed by Pablo Galindo in gh-96670(14).)

   * The extraction methods in *note tarfile: e7, and *note
     shutil.unpack_archive(): 887, 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: 888. for details.  In Python
     3.14, the default will switch to ‘'data'’.  (Contributed by Petr
     Viktorin in PEP 706(15).)

   * *note types.MappingProxyType: 194. 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: 6bd. through the new
     environment variable *note PYTHONPERFSUPPORT: 889. and command-line
     option *note -X perf: 183, as well as the new *note
     sys.activate_stack_trampoline(): 88a, *note
     sys.deactivate_stack_trampoline(): 88b, and *note
     sys.is_stack_trampoline_active(): 88c. 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.5.5 新たなモジュール
----------------------

   * None.


File: python.info,  Node: 改良されたモジュール<2>,  Next: 最適化<3>,  Prev: 新たなモジュール<2>,  Up: What's New In Python 3 12

1.5.6 改良されたモジュール
--------------------------

* Menu:

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


File: python.info,  Node: array<2>,  Next: asyncio<7>,  Up: 改良されたモジュール<2>

1.5.6.1 array
.............

   * The *note array.array: 6cb. class now supports subscripting, making
     it a *note generic type: 1dc.  (Contributed by Jelle Zijlstra in
     gh-98658(1).)

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

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


File: python.info,  Node: asyncio<7>,  Next: calendar<3>,  Prev: array<2>,  Up: 改良されたモジュール<2>

1.5.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(): 891. if the
     platform supports it.  (Contributed by Kumar Aditya in
     gh-91166(1).)

   * Add *note asyncio.eager_task_factory(): 892. and *note
     asyncio.create_eager_task_factory(): 893. 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(): 273. 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(): 314. to allow
     specifying a custom event loop factory.  (Contributed by Kumar
     Aditya in gh-99388(7).)

   * Add C implementation of *note asyncio.current_task(): 894. for
     4x-6x speedup.  (Contributed by Itamar Oren and Pranav Thulasiram
     Bhat in gh-100344(8).)

   * *note asyncio.iscoroutine(): 895. 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(): 896. and *note asyncio.as_completed(): 6d2.
     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<3>,  Next: csv<2>,  Prev: asyncio<7>,  Up: 改良されたモジュール<2>

1.5.6.3 calendar
................

   * Add enums *note calendar.Month: 898. and *note calendar.Day: 899.
     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<2>,  Next: dis<3>,  Prev: calendar<3>,  Up: 改良されたモジュール<2>

1.5.6.4 csv
...........

   * Add *note csv.QUOTE_NOTNULL: 89b. and *note csv.QUOTE_STRINGS: 89c.
     flags to provide finer grained control of ‘None’ and empty strings
     by *note reader: 89d. and *note writer: 89e. objects.


File: python.info,  Node: dis<3>,  Next: fractions<3>,  Prev: csv<2>,  Up: 改良されたモジュール<2>

1.5.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: 3b. module.  *note HAVE_ARGUMENT: 8a0. is still relevant to
     real opcodes, but it is not useful for pseudo instructions.  Use
     the new *note dis.hasarg: 7a4. collection instead.  (Contributed by
     Irit Katriel in gh-94216(1).)

   * Add the *note dis.hasexc: 8a1. 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<2>,  Prev: dis<3>,  Up: 改良されたモジュール<2>

1.5.6.6 fractions
.................

   * Objects of type *note fractions.Fraction: 1ce. 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<2>,  Next: inspect<3>,  Prev: fractions<3>,  Up: 改良されたモジュール<2>

1.5.6.7 importlib.resources
...........................

   * *note importlib.resources.as_file(): 8a4. now supports resource
     directories.  (Contributed by Jason R. Coombs in gh-97930(1).)

   * Rename first parameter of *note importlib.resources.files(): 2e2.
     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<3>,  Next: itertools<3>,  Prev: importlib resources<2>,  Up: 改良されたモジュール<2>

1.5.6.8 inspect
...............

   * Add *note inspect.markcoroutinefunction(): 8a6. to mark sync
     functions that return a *note coroutine: 8a7. for use with *note
     inspect.iscoroutinefunction(): 154.  (Contributed by Carlton Gibson
     in gh-99247(1).)

   * Add *note inspect.getasyncgenstate(): 8a8. and *note
     inspect.getasyncgenlocals(): 8a9. for determining the current state
     of asynchronous generators.  (Contributed by Thomas Krennwallner in
     gh-79940(2).)

   * The performance of *note inspect.getattr_static(): 8aa. 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<4>,  Prev: inspect<3>,  Up: 改良されたモジュール<2>

1.5.6.9 itertools
.................

   * Add *note itertools.batched(): 71b. 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<4>,  Next: os<5>,  Prev: itertools<3>,  Up: 改良されたモジュール<2>

1.5.6.10 math
.............

   * Add *note math.sumprod(): 8ad. for computing a sum of products.
     (Contributed by Raymond Hettinger in gh-100485(1).)

   * Extend *note math.nextafter(): 8ae. 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<5>,  Next: os path<4>,  Prev: math<4>,  Up: 改良されたモジュール<2>

1.5.6.11 os
...........

   * Add *note os.PIDFD_NONBLOCK: 8b0. to open a file descriptor for a
     process with *note os.pidfd_open(): 273. in non-blocking mode.
     (Contributed by Kumar Aditya in gh-93312(1).)

   * *note os.DirEntry: 8b1. now includes an *note
     os.DirEntry.is_junction(): 8b2. method to check if the entry is a
     junction.  (Contributed by Charles Machalow in gh-99547(2).)

   * Add *note os.listdrives(): 8b3, *note os.listvolumes(): 8b4. and
     *note os.listmounts(): 8b5. functions on Windows for enumerating
     drives, volumes and mount points.  (Contributed by Steve Dower in
     gh-102519(3).)

   * *note os.stat(): 4fc. and *note os.lstat(): 8b6. 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<4>,  Next: pathlib<7>,  Prev: os<5>,  Up: 改良されたモジュール<2>

1.5.6.12 os.path
................

   * Add *note os.path.isjunction(): 8b8. to check if a given path is a
     junction.  (Contributed by Charles Machalow in gh-99547(1).)

   * Add *note os.path.splitroot(): 8b9. 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<7>,  Next: プラットフォーム<2>,  Prev: os path<4>,  Up: 改良されたモジュール<2>

1.5.6.13 pathlib
................

   * Add support for subclassing *note pathlib.PurePath: 8bb. and *note
     pathlib.Path: 4f5, plus their Posix- and Windows-specific variants.
     Subclasses may override the *note pathlib.PurePath.with_segments():
     8bc. method to pass information between path instances.

   * Add *note pathlib.Path.walk(): 8bd. for walking the directory trees
     and generating all file or directory names within them, similar to
     *note os.walk(): 8be.  (Contributed by Stanislav Zmiev in
     gh-90385(1).)

   * Add 'walk_up' optional parameter to *note
     pathlib.PurePath.relative_to(): 57c. to allow the insertion of ‘..’
     entries in the result; this behavior is more consistent with *note
     os.path.relpath(): 8bf.  (Contributed by Domenico Ragusa in
     gh-84538(2).)

   * Add *note pathlib.Path.is_junction(): 8c0. as a proxy to *note
     os.path.isjunction(): 8b8.  (Contributed by Charles Machalow in
     gh-99547(3).)

   * Add 'case_sensitive' optional parameter to *note
     pathlib.Path.glob(): 73f, *note pathlib.Path.rglob(): 740. and
     *note pathlib.PurePath.match(): 8c1. 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<5>,  Prev: pathlib<7>,  Up: 改良されたモジュール<2>

1.5.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<5>,  Next: random<2>,  Prev: プラットフォーム<2>,  Up: 改良されたモジュール<2>

1.5.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<3>,  Prev: pdb<5>,  Up: 改良されたモジュール<2>

1.5.6.16 random
...............

   * Add *note random.binomialvariate(): 8c5.  (Contributed by Raymond
     Hettinger in gh-81620(1).)

   * Add a default of ‘lambd=1.0’ to *note random.expovariate(): 8c6.
     (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<3>,  Next: sqlite3<4>,  Prev: random<2>,  Up: 改良されたモジュール<2>

1.5.6.17 shutil
...............

   * *note shutil.make_archive(): 8c8. 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(): 33d. 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(): 8c9. 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(): 8c9. 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(): 8c9. 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<4>,  Next: statistics<2>,  Prev: shutil<3>,  Up: 改良されたモジュール<2>

1.5.6.18 sqlite3
................

   * Add a *note command-line interface: 263.  (Contributed by Erlend E.
     Aasland in gh-77617(1).)

   * Add the *note sqlite3.Connection.autocommit: 8cb. attribute to
     *note sqlite3.Connection: 3e6. and the 'autocommit' parameter to
     *note sqlite3.connect(): 3e7. to control PEP 249(2)-compliant *note
     transaction handling: 8cc.  (Contributed by Erlend E. Aasland in
     gh-83638(3).)

   * Add 'entrypoint' keyword-only parameter to *note
     sqlite3.Connection.load_extension(): 8cd, for overriding the SQLite
     extension entry point.  (Contributed by Erlend E. Aasland in
     gh-103015(4).)

   * Add *note sqlite3.Connection.getconfig(): 8ce. and *note
     sqlite3.Connection.setconfig(): 8cf. to *note sqlite3.Connection:
     3e6. 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<5>,  Prev: sqlite3<4>,  Up: 改良されたモジュール<2>

1.5.6.19 statistics
...................

   * Extend *note statistics.correlation(): 8d1. 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<5>,  Next: tempfile<2>,  Prev: statistics<2>,  Up: 改良されたモジュール<2>

1.5.6.20 sys
............

   * Add the *note sys.monitoring: e3. namespace to expose the new *note
     PEP 669: 864. monitoring API. (Contributed by Mark Shannon in
     gh-103082(1).)

   * Add *note sys.activate_stack_trampoline(): 88a. and *note
     sys.deactivate_stack_trampoline(): 88b. for activating and
     deactivating stack profiler trampolines, and *note
     sys.is_stack_trampoline_active(): 88c. 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: 8d3. 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: 8d4, *note sys.last_value: 8d5.
     and *note sys.last_traceback: 8d6.  (Contributed by Irit Katriel in
     gh-102778(3).)

   * *note sys._current_exceptions(): 8d7. 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(): 8d8. and *note
     sys.getrecursionlimit(): 8d9.  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<4>,  Prev: sys<5>,  Up: 改良されたモジュール<2>

1.5.6.21 tempfile
.................

   * The *note tempfile.NamedTemporaryFile: 8db. function has a new
     optional parameter 'delete_on_close' (Contributed by Evgeny Zorin
     in gh-58451(1).)

   * *note tempfile.mkdtemp(): 735. 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<4>,  Next: tkinter<4>,  Prev: tempfile<2>,  Up: 改良されたモジュール<2>

1.5.6.22 threading
..................

   * Add *note threading.settrace_all_threads(): 8dd. and *note
     threading.setprofile_all_threads(): 8de. 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<4>,  Next: tokenize<2>,  Prev: threading<4>,  Up: 改良されたモジュール<2>

1.5.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<2>,  Next: types<5>,  Prev: tkinter<4>,  Up: 改良されたモジュール<2>

1.5.6.24 tokenize
.................

   * The *note tokenize: 104. 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 への移植: 8e1. 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<5>,  Next: typing<6>,  Prev: tokenize<2>,  Up: 改良されたモジュール<2>

1.5.6.25 types
..............

   * Add *note types.get_original_bases(): 8e3. to allow for further
     introspection of *note ユーザー定義のジェネリック型: 8e4. 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<6>,  Next: unicodedata<4>,  Prev: types<5>,  Up: 改良されたモジュール<2>

1.5.6.26 typing
...............

   * *note isinstance(): 2fb. checks against *note runtime-checkable
     protocols: 867. now use *note inspect.getattr_static(): 8aa. rather
     than *note hasattr(): 8e7. to lookup whether attributes exist.
     This means that descriptors and *note __getattr__(): 8e8. 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(): 2fb.
     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(): 2fb. checks against
     *note runtime-checkable protocols: 867. 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: 29b. and *note typing.NamedTuple: 2f0.
     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(): 8e9.  (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<4>,  Next: unittest<4>,  Prev: typing<6>,  Up: 改良されたモジュール<2>

1.5.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<4>,  Next: uuid<3>,  Prev: unicodedata<4>,  Up: 改良されたモジュール<2>

1.5.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<4>,  Up: 改良されたモジュール<2>

1.5.6.29 uuid
.............

   * Add a *note command-line interface: 868.  (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.5.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(): 7a7. and *note re.subn(): 7a8. 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: 467. creation by deferring expensive
     string formatting.  (Contributed by Itamar Oren in gh-103793(6).)

   * The *note tokenize.tokenize(): 8ee. and *note
     tokenize.generate_tokens(): 8ef. functions are up to 64% faster as
     a side effect of the changes required to cover PEP 701(7) in the
     *note tokenize: 104. module.  (Contributed by Marta Gómez Macías
     and Pablo Galindo in gh-102856(8).)

   * Speed up *note super(): 44a. method calls and attribute loads via
     the new *note LOAD_SUPER_ATTR: 8f0. 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.5.8 CPython バイトコードの変更
--------------------------------

   * Remove the ‘LOAD_METHOD’ instruction.  It has been merged into
     *note LOAD_ATTR: 8f2.  ‘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: 8f3. and *note STORE_SLICE: 8f4.
     instructions.  (Contributed by Mark Shannon in gh-94163(4).)

   * Add the *note CALL_INTRINSIC_1: 8f5. instructions.  (Contributed by
     Mark Shannon in gh-99005(5).)

   * Add the *note CALL_INTRINSIC_2: 8f6. instruction.  (Contributed by
     Irit Katriel in gh-101799(6).)

   * Add the *note CLEANUP_THROW: 8f7. 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: 8f8. instruction as part of the
     implementation of PEP 709(9).  (Contributed by Carl Meyer in
     gh-101441(10).)

   * Add the *note LOAD_FAST_CHECK: 8f9. instruction.  (Contributed by
     Dennis Sweeney in gh-93143(11).)

   * Add the *note LOAD_FROM_DICT_OR_DEREF: 8fa, *note
     LOAD_FROM_DICT_OR_GLOBALS: 8fb, and *note LOAD_LOCALS: 8fc. 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: 8f0. 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.5.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.5.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: 2d4. 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: 570. 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(): 573. method of the default event
          loop policy now emits a *note DeprecationWarning: 2d4. 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:
     331. and *note calendar.FEBRUARY: 332.  (Contributed by Prince
     Roshan in gh-103636(6).)

   * *note collections.abc: 1f.: Deprecated *note
     collections.abc.ByteString: 2d6.

     Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
     implements the *note buffer protocol: 319. at runtime.  For use in
     type annotations, either use *note Buffer: 31a. 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: 1d2. and *note
     bytearray: 1d1.  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: 1dd. 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: 33.: *note datetime.datetime: 6ed.'s *note
     utcnow(): 336. and *note utcfromtimestamp(): 337. are deprecated
     and will be removed in a future version.  Instead, use
     timezone-aware objects to represent datetimes in UTC: respectively,
     call *note now(): 8ff. and *note fromtimestamp(): 900. with the
     'tz' parameter set to *note datetime.UTC: 901.  (Contributed by
     Paul Ganssle in gh-103857(9).)

   * *note email: 3e.: Deprecate the 'isdst' parameter in *note
     email.utils.localtime(): 576.  (Contributed by Alan Williams in
     gh-72346(10).)

   * *note importlib.abc: 7b.: 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: 7f. classes instead:

        * *note importlib.resources.abc.Traversable: 579.

        * *note importlib.resources.abc.TraversableResources: 578.

     (Contributed by Jason R. Coombs and Hugo van Kemenade in
     gh-93963(11).)

   * *note itertools: 84.: 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(): 4dd. or *note
     set_start_method(): 4de. APIs to explicitly specify when your code
     'requires' ‘'fork'’.  See *note contexts and start methods: 474.

   * *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(): 7ad. instead.
     (Contributed by Nikita Sobolev in gh-97850(14).)

   * *note pty: b9.: 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: 2d4. 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(): 4fc. and
          *note os.lstat(): 8b6. 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(): 6c3. can now raise a
          *note DeprecationWarning: 2d4. 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: cd.: The 'onerror' argument of *note shutil.rmtree():
     33d. is deprecated; use 'onexc' instead.  (Contributed by Irit
     Katriel in gh-102828(18).)

   * *note sqlite3: d7.:

        * *note default adapters and converters: 902. are now
          deprecated.  Instead, use the *note
          適合関数と変換関数のレシピ集: 903. and tailor them to your
          needs.  (Contributed by Erlend E. Aasland in gh-90016(19).)

        * In *note execute(): 7ae, *note DeprecationWarning: 2d4. is now
          emitted when *note named placeholders: 7b0. are used together
          with parameters supplied as a *note sequence: 904. instead of
          as a *note dict: 193.  Starting from Python 3.14, using named
          placeholders with parameters supplied as a sequence will raise
          a *note ProgrammingError: 584.  (Contributed by Erlend E.
          Aasland in gh-101698(20).)

   * *note sys: e2.: The *note sys.last_type: 8d4, *note sys.last_value:
     8d5. and *note sys.last_traceback: 8d6. fields are deprecated.  Use
     *note sys.last_exc: 8d3. instead.  (Contributed by Irit Katriel in
     gh-102778(21).)

   * *note tarfile: e7.: Extracting tar archives without specifying
     'filter' is deprecated until Python 3.14, when ‘'data'’ filter will
     become the default.  See *note Extraction filters: 888. for
     details.

   * *note typing: 10d.:

        * *note typing.Hashable: 905. and *note typing.Sized: 906,
          aliases for *note collections.abc.Hashable: 907. and *note
          collections.abc.Sized: 908. respectively, are deprecated.
          (gh-94309(22).)

        * *note typing.ByteString: 2ef, deprecated since Python 3.9, now
          causes a *note DeprecationWarning: 2d4. to be emitted when it
          is used.  (Contributed by Alex Waygood in gh-91896(23).)

   * *note xml.etree.ElementTree: 12e.: The module now emits *note
     DeprecationWarning: 2d4. when testing the truth value of an *note
     xml.etree.ElementTree.Element: 34b.  Before, the Python
     implementation emitted *note FutureWarning: 84d, 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(): 909, *note generator throw(): 90a. and *note async
     generator throw(): 90b. 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: 2d4. is now raised when *note
     __package__: 593. on a module differs from *note __spec__.parent:
     594. (previously it was *note ImportWarning: 90c.).  (Contributed
     by Brett Cannon in gh-65961(26).)

   * Setting *note __package__: 593. or ‘__cached__’ 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 ‘codeobject.co_lnotab’ on code objects was deprecated in
     Python 3.10 via PEP 626(29), but it only got a proper *note
     DeprecationWarning: 2d4. 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<6>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<4>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<4>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<4>.
* Pending removal in future versions: Pending removal in future versions<6>.

   ---------- 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.5.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: 6a0. 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.5.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: 2d4. 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: 570. 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(): 573. method of the default event
          loop policy now emits a *note DeprecationWarning: 2d4. 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: 3e.: Deprecated the 'isdst' parameter in *note
     email.utils.localtime(): 576.  (Contributed by Alan Williams in
     gh-72346(6).)

   * *note importlib.abc: 7b. deprecated classes:

        * ‘importlib.abc.ResourceReader’

        * ‘importlib.abc.Traversable’

        * ‘importlib.abc.TraversableResources’

     Use *note importlib.resources.abc: 7f. classes instead:

        * *note importlib.resources.abc.Traversable: 579.

        * *note importlib.resources.abc.TraversableResources: 578.

     (Contributed by Jason R. Coombs and Hugo van Kemenade in
     gh-93963(7).)

   * *note itertools: 84. 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(): 4dd. or *note set_start_method(): 4de. APIs to
     explicitly specify when your code 'requires' ‘'fork'’.  See *note
     コンテキストと開始方式: 474.

   * *note pathlib: a8.: *note is_relative_to(): 57d. and *note
     relative_to(): 57c.: passing additional arguments is deprecated.

   * *note pkgutil: ae.: ‘pkgutil.find_loader()’ and
     ‘pkgutil.get_loader()’ now raise *note DeprecationWarning: 2d4.;
     use *note importlib.util.find_spec(): 7ad. instead.  (Contributed
     by Nikita Sobolev in gh-97850(10).)

   * *note pty: b9.:

        * ‘master_open()’: use *note pty.openpty(): 580.

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

   * *note sqlite3: d7.:

        * ‘version’ and ‘version_info’.

        * *note execute(): 7ae. and *note executemany(): 7af. if *note
          named placeholders: 7b0. are used and 'parameters' is a
          sequence instead of a *note dict: 193.

   * *note urllib: 111.: ‘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<6>,  Prev: Pending removal in Python 3 14<3>,  Up: 非推奨<2>

1.5.10.3 Pending removal in Python 3.15
.......................................

   * The import system:

        * Setting ‘__cached__’ on a module while failing to set *note
          __spec__.cached: 592. 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__: 593. on a module while failing to
          set *note __spec__.parent: 594. 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: 2d.:

        * The undocumented ‘ctypes.SetPointerType()’ function has been
          deprecated since Python 3.13.

   * *note http.server: 75.:

        * The obsolete and rarely used ‘CGIHTTPRequestHandler’ 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: 7a.:

        * ‘load_module()’ method: use ‘exec_module()’ instead.

   * *note pathlib: a8.:

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

   * *note platform: af.:

        * ‘platform.java_ver()’ 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: e4.:

        * The 'check_home' argument of *note
          sysconfig.is_python_build(): 2e9. has been deprecated since
          Python 3.12.

   * *note threading: f6.:

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

        * *note types.CodeType: 2ed.: Accessing ‘codeobject.co_lnotab’
          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: 2d4. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(4).)

   * *note typing: 10d.:

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

   * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.

   * *note wave: 11c.:

        * The ‘getmark()’, ‘setmark()’ and ‘getmarkers()’ methods of the
          *note Wave_read: 2f2. and *note Wave_write: 2f3. classes have
          been deprecated since Python 3.13.

   * *note zipimport: 13b.:

        * ‘zipimport.zipimporter.load_module()’ has been deprecated
          since Python 3.10.  Use *note exec_module(): 2f5. instead.
          (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<6>,  Next: Pending removal in Python 3 17<4>,  Prev: Pending removal in Python 3 15<5>,  Up: 非推奨<2>

1.5.10.4 Pending removal in Python 3.16
.......................................

   * The import system:

        * Setting *note __loader__: 30b. on a module while failing to
          set *note __spec__.loader: 30c. 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: 30d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 154. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 314. or *note
          asyncio.Runner: 315. 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: 62.:

        * Calling the Python implementation of *note functools.reduce():
          156. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8a.:

        * 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(): 159.  Undotted extensions are
          deprecated and will raise a *note ValueError: 15a. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: cd.:

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

   * *note symtable: e1.:

        * The ‘symtable.Class.get_methods()’ method has been deprecated
          since Python 3.14.

   * *note sys: e2.:

        * The ‘_enablelegacywindowsfsencoding()’ function has been
          deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 15e. environment variable
          instead.

   * *note sysconfig: e4.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 160. instead.

   * *note tarfile: e7.:

        * The undocumented and unused ‘TarInfo.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 19<4>,  Prev: Pending removal in Python 3 16<6>,  Up: 非推奨<2>

1.5.10.5 Pending removal in Python 3.17
.......................................

   * *note datetime: 33.:

        * *note strptime(): 2dd. calls using a format string containing
          ‘%e’ (day of month) without a year.  This has been deprecated
          since Python 3.15.  (Contributed by Stan Ulbrych in
          gh-70647(1).)

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 2d6. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(2) for more details.  (Contributed by Shantanu
          Jain in gh-91896(3).)

   * *note encodings: 54.:

        - Passing non-ascii 'encoding' names to *note
          encodings.normalize_encoding(): 31b. is deprecated and
          scheduled for removal in Python 3.17.  (Contributed by Stan
          Ulbrych in gh-136702(4).)

   * *note webbrowser: 11e.:

        - ‘webbrowser.MacOSXOSAScript’ is deprecated in favour of
          ‘webbrowser.MacOS’.  (gh-137586(5))

   * *note typing: 10d.:

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

        - *note typing.ByteString: 2ef, 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: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(6) for more details.  (Contributed by Shantanu
          Jain in gh-91896(7).)

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

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

   (2) https://peps.python.org/pep-0688/#current-options

   (3) https://github.com/python/cpython/issues/91896

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

   (5) https://github.com/python/cpython/issues/137586

   (6) https://peps.python.org/pep-0688/#current-options

   (7) https://github.com/python/cpython/issues/91896


File: python.info,  Node: Pending removal in Python 3 19<4>,  Next: Pending removal in Python 3 20<4>,  Prev: Pending removal in Python 3 17<4>,  Up: 非推奨<2>

1.5.10.6 Pending removal in Python 3.19
.......................................

   * *note ctypes: 2d.:

        * Implicitly switching to the MSVC-compatible struct layout by
          setting *note _pack_: 320. but not *note _layout_: 321. on
          non-Windows platforms.

   * *note hashlib: 6b.:

        - In hash function constructors such as *note new(): 2fd. or the
          direct hash-named constructors such as *note md5(): 2fe. and
          *note sha256(): 2ff, their optional initial data parameter
          could also be passed a keyword argument named ‘data=’ or
          ‘string=’ in various ‘hashlib’ implementations.

          Support for the ‘string’ keyword argument name is now
          deprecated and slated for removal in Python 3.19.

          Before Python 3.13, the ‘string’ keyword parameter was not
          correctly supported depending on the backend implementation of
          hash functions.  Prefer passing the initial data as a
          positional argument for maximum backwards compatibility.

   * *note http.cookies: 74.:

        * *note http.cookies.Morsel.js_output(): 300. is deprecated and
          will be removed in Python 3.19.

        * *note http.cookies.BaseCookie.js_output(): 301. is deprecated
          and will be removed in Python 3.19.

   * *note imaplib: 77.:

        * Altering *note IMAP4.file: 304. is now deprecated and slated
          for removal in Python 3.19.  This property is now unused and
          changing its value does not automatically close the current
          file.

          Before Python 3.14, this property was used to implement the
          corresponding ‘read()’ and ‘readline()’ methods for *note
          IMAP4: 322. but this is no longer the case since then.


File: python.info,  Node: Pending removal in Python 3 20<4>,  Next: Pending removal in future versions<6>,  Prev: Pending removal in Python 3 19<4>,  Up: 非推奨<2>

1.5.10.7 Pending removal in Python 3.20
.......................................

   * Calling the ‘__new__()’ method of *note struct.Struct: 307. without
     the 'format' argument is deprecated and will be removed in Python
     3.20.  Calling *note __init__(): 306. method on initialized
     ‘Struct’ objects is deprecated and will be removed in Python 3.20.

     (Contributed by Sergey B Kirpichev and Serhiy Storchaka in
     gh-143715(1).)

   * The ‘__version__’, ‘version’ and ‘VERSION’ attributes have been
     deprecated in these standard library modules and will be removed in
     Python 3.20.  Use *note sys.version_info: 308. instead.

        - *note argparse: 7.

        - *note csv: 2c.

        - *note ctypes: 2d.

        - ‘ctypes.macholib’

        - *note decimal: 39. (use *note decimal.SPEC_VERSION: 309.
          instead)

        - *note http.server: 75.

        - *note imaplib: 77.

        - *note ipaddress: 83.

        - *note json: 85.

        - *note logging: 8a. (‘__date__’ also deprecated)

        - *note optparse: a4.

        - *note pickle: ab.

        - *note platform: af.

        - *note re: c1.

        - *note socketserver: d5.

        - *note tabnanny: e6.

        - *note tarfile: e7.

        - *note tkinter.font: fe.

        - *note tkinter.ttk: 102.

        - *note wsgiref.simple_server: 124.

        - *note xml.etree.ElementTree: 12e.

        - ‘xml.sax.expatreader’

        - *note xml.sax.handler: 133.

        - *note zlib: 13c.

     (Contributed by Hugo van Kemenade and Stan Ulbrych in gh-76007(2).)

   * Deprecations defined by PEP 829(3):

        * Warnings are produced for ‘import’ lines found in ‘`name'.pth’
          files.

        * ‘`name'.pth’ files are no longer decoded in the locale
          encoding by default.  They 'MUST' be encoded in ‘utf-8-sig’.

     (Contributed by Barry Warsaw in gh-148641(4).)

   * *note ast: 9.:

        * Creating instances of abstract AST nodes (such as *note
          ast.AST: 2f8. or ‘ast.expr’) is deprecated and will raise an
          error in Python 3.20.

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

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

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

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

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


File: python.info,  Node: Pending removal in future versions<6>,  Prev: Pending removal in Python 3 20<4>,  Up: 非推奨<2>

1.5.10.8 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(): 325. is now deprecated.

        * The *note argparse.FileType: 326. 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:
          327, *note else: 328, *note for: 329, *note if: 32a, *note in:
          32b, *note is: 32c. and *note or: 32d.  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: 32e.

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

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 330.: 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(): 330. 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:
     331. and *note calendar.FEBRUARY: 332.  (Contributed by Prince
     Roshan in gh-103636(3).)

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

   * ‘codeobject.co_lnotab’: use the *note codeobject.co_lines(): 335.
     method instead.

   * *note datetime: 33.:

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

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

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

   * *note importlib: 7a.:

        * *note cache_from_source(): 338. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7d.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8a.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 339. instead.

   * *note mailbox: 8e.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 33a. in a
     multi-threaded process.

   * *note os.path: a6.: *note os.path.commonprefix(): 33b. is
     deprecated, use *note os.path.commonpath(): 33c. for path prefixes.
     The ‘os.path.commonprefix()’ function is being deprecated due to
     having a misleading name and module.  The function is not safe to
     use for path prefixes despite being included in a module about path
     manipulation, meaning it is easy to accidentally introduce path
     traversal vulnerabilities into Python programs by using this
     function.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: c1.: 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).)

   * *note shutil: cd.: *note rmtree(): 33d.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d8. options and protocols:

        * *note ssl.SSLContext: 33e. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 33e.: *note set_npn_protocols(): 33f.
          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: f6. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          340.

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

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 342.: use *note
          threading.Thread.daemon: 343. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 344.: use *note
          threading.Thread.name: 345. attribute.

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

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

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

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

   * *note urllib.parse: 113. deprecated functions: *note urlparse():
     2af. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

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

   * *note xml.etree.ElementTree: 12e.: Testing the truth value of an
     *note Element: 34b. 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(): 34c. is deprecated: use *note
     sys._clear_internal_caches(): 34d. 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.5.11 削除
-----------

* Menu:

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


File: python.info,  Node: asynchat and asyncore,  Next: configparser<4>,  Up: 削除<2>

1.5.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.5.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: 919. 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: 6ea. name instead.

        * *note configparser.ConfigParser: 6ea. no longer has a ‘readfp’
          method.  Use *note read_file(): 91a. instead.

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

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


File: python.info,  Node: distutils,  Next: ensurepip,  Prev: configparser<4>,  Up: 削除<2>

1.5.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.5.11.4 ensurepip
..................

   * Remove the bundled setuptools wheel from *note ensurepip: 58, and
     stop installing setuptools in environments created by *note venv:
     11a.

     ‘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.5.11.5 enum
.............

   * Remove *note enum: 59.'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.5.11.6 ftplib
...............

   * Remove *note ftplib: 61.'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<2>,  Prev: ftplib,  Up: 削除<2>

1.5.11.7 gzip
.............

   * Remove the ‘filename’ attribute of *note gzip: 6a.'s *note
     gzip.GzipFile: 84f, deprecated since Python 2.6, use the *note
     name: 921. 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<2>,  Next: importlib<2>,  Prev: gzip,  Up: 削除<2>

1.5.11.8 hashlib
................

   * Remove the pure Python implementation of *note hashlib: 6b.'s *note
     hashlib.pbkdf2_hmac(): 923, 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<2>,  Up: 削除<2>

1.5.11.9 importlib
..................

   * Many previously deprecated cleanups in *note importlib: 7a. 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.5.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(): 338.
                                                
                                                
          ‘imp.find_module()’                   *note importlib.util.find_spec(): 7ad.
                                                
                                                
          ‘imp.get_magic()’                     *note importlib.util.MAGIC_NUMBER: 927.
                                                
                                                
          ‘imp.get_suffixes()’                  *note importlib.machinery.SOURCE_SUFFIXES: 928, *note importlib.machinery.EXTENSION_SUFFIXES: 929, and
                                                *note importlib.machinery.BYTECODE_SUFFIXES: 92a.
                                                
                                                
          ‘imp.get_tag()’                       *note sys.implementation.cache_tag: 92b.
                                                
                                                
          ‘imp.load_module()’                   *note importlib.import_module(): 92c.
                                                
                                                
          ‘imp.new_module(name)’                ‘types.ModuleType(name)’
                                                
                                                
          ‘imp.reload()’                        *note importlib.reload(): 92d.
                                                
                                                
          ‘imp.source_from_cache()’             *note importlib.util.source_from_cache(): 92e.
                                                
                                                
          ‘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<3>,  Prev: imp,  Up: 削除<2>

1.5.11.11 io
............

   * Remove *note io: 82.'s ‘io.OpenWrapper’ and ‘_pyio.OpenWrapper’,
     deprecated in Python 3.10: just use *note open(): 333. instead.
     The ‘open()’ (*note io.open(): 930.) 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<3>,  Next: smtpd,  Prev: io<4>,  Up: 削除<2>

1.5.11.12 locale
................

   * Remove *note locale: 89.'s ‘locale.format()’ function, deprecated
     in Python 3.7: use *note locale.format_string(): 932. 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<5>,  Prev: locale<3>,  Up: 削除<2>

1.5.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<5>,  Next: ssl<4>,  Prev: smtpd,  Up: 削除<2>

1.5.11.14 sqlite3
.................

   * The following undocumented *note sqlite3: d7. 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: 1ea. 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<4>,  Next: unittest<5>,  Prev: sqlite3<5>,  Up: 削除<2>

1.5.11.15 ssl
.............

   * Remove *note ssl: d8.'s ‘ssl.RAND_pseudo_bytes()’ function,
     deprecated in Python 3.6: use *note os.urandom(): 936. or *note
     ssl.RAND_bytes(): 937. 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: 33e. object and call its
     *note ssl.SSLContext.wrap_socket: 938. 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<5>,  Next: webbrowser<4>,  Prev: ssl<4>,  Up: 削除<2>

1.5.11.16 unittest
..................

   * Remove many long-deprecated *note unittest: 10f. features:

        * A number of *note TestCase: 536. method aliases:

          非推奨のエイリアス               メソッド名                          非推奨となるバー
                                                                               ジョン
                                                                               
          -----------------------------------------------------------------------------------------
                                                                               
          ‘failUnless’                     *note assertTrue(): 93a.            3.1
                                                                               
                                                                               
          ‘failIf’                         *note assertFalse(): 93b.           3.1
                                                                               
                                                                               
          ‘failUnlessEqual’                *note assertEqual(): 93c.           3.1
                                                                               
                                                                               
          ‘failIfEqual’                    *note assertNotEqual(): 93d.        3.1
                                                                               
                                                                               
          ‘failUnlessAlmostEqual’          *note assertAlmostEqual(): 93e.     3.1
                                                                               
                                                                               
          ‘failIfAlmostEqual’              *note assertNotAlmostEqual(): 93f.  3.1
                                                                               
                                                                               
          ‘failUnlessRaises’               *note assertRaises(): 940.          3.1
                                                                               
                                                                               
          ‘assert_’                        *note assertTrue(): 93a.            3.2
                                                                               
                                                                               
          ‘assertEquals’                   *note assertEqual(): 93c.           3.2
                                                                               
                                                                               
          ‘assertNotEquals’                *note assertNotEqual(): 93d.        3.2
                                                                               
                                                                               
          ‘assertAlmostEquals’             *note assertAlmostEqual(): 93e.     3.2
                                                                               
                                                                               
          ‘assertNotAlmostEquals’          *note assertNotAlmostEqual(): 93f.  3.2
                                                                               
                                                                               
          ‘assertRegexpMatches’            *note assertRegex(): 941.           3.2
                                                                               
                                                                               
          ‘assertRaisesRegexp’             *note assertRaisesRegex(): 942.     3.2
                                                                               
                                                                               
          ‘assertNotRegexpMatches’         *note assertNotRegex(): 943.        3.5
                                                                               

          You can use ‘https://github.com/isidentical/teyit’ to
          automatically modernise your unit tests.

        * Undocumented and broken *note TestCase: 536. method
          ‘assertDictContainsSubset’ (deprecated in Python 3.2).

        * Undocumented *note TestLoader.loadTestsFromModule: 799.
          parameter 'use_load_tests' (deprecated and ignored since
          Python 3.5).

        * An alias of the *note TextTestResult: 944. 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<4>,  Next: xml etree ElementTree,  Prev: unittest<5>,  Up: 削除<2>

1.5.11.17 webbrowser
....................

   * Remove support for obsolete browsers from *note webbrowser: 11e.
     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<3>,  Prev: webbrowser<4>,  Up: 削除<2>

1.5.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(): 947. function instead.  The C implementation of *note
     xml.etree.ElementTree: 12e. 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<3>,  Next: その他,  Prev: xml etree ElementTree,  Up: 削除<2>

1.5.11.19 zipimport
...................

   * Remove *note zipimport: 13b.'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<3>,  Up: 削除<2>

1.5.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: 61, *note imaplib: 77, *note poplib: b1. and *note smtplib:
     d2. modules, and the 'key_file', 'cert_file' and 'check_hostname'
     parameters from the *note http.client: 72. 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: 2d. 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.5.12 Python 3.12 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

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


File: python.info,  Node: Python API の変更<3>,  Up: Python 3 12 への移植

1.5.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: 29c.  Also, the
     exception raised for non-integer values such as ‘randrange(10.5)’
     or ‘randrange('10')’ has been changed from *note ValueError: 15a.
     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: 1e7. 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): 94c.) to *note filesystem
     encoding and error handler: 94d.  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(): 94e.: Passing ‘None’ for 's' argument now
     raises an exception, rather than reading *note sys.stdin: 94f.  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: 1d1. and *note memoryview: 1dd. types: only the
     exact *note bytes: 1d2. type is accepted for bytes strings.
     (Contributed by Victor Stinner in gh-98393(5).)

   * *note syslog.openlog(): 950. and *note syslog.closelog(): 951. now
     fail if used in subinterpreters.  *note syslog.syslog(): 952. 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: e5.
     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(): 953.
     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(): 8d7. 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: e7. or *note
     shutil.unpack_archive(): 887, pass the 'filter' argument to limit
     features that may be surprising or dangerous.  See *note Extraction
     filters: 888. for details.

   * The output of the *note tokenize.tokenize(): 8ee. and *note
     tokenize.generate_tokens(): 8ef. 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: 954. as incomplete multiline strings do.

        * Some incomplete or invalid Python code now raises *note
          tokenize.TokenError: 954. 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: 955.

   * The *note threading: f6. 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.5.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.5.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.5.14.1 新しい機能
...................

   * PEP 697(1): Introduce the *note Unstable C API tier: 959, 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: 1a4. can be zero or negative to
          specify inheriting or extending the base class size.

        - *note PyObject_GetTypeData(): 1a5. and *note
          PyType_GetTypeDataSize(): 95a. added to allow access to
          subclass-specific instance data.

        - *note Py_TPFLAGS_ITEMS_AT_END: 95b. and *note
          PyObject_GetItemData(): 95c. added to allow safely extending
          certain variable-sized types, including *note PyType_Type:
          95d.

        - *note Py_RELATIVE_OFFSET: 95e. added to allow defining *note
          members: 95f. in terms of a subclass-specific struct.

     (Contributed by Petr Viktorin in gh-103509(5).)

   * Add the new *note limited C API: 82f. function *note
     PyType_FromMetaclass(): 399, which generalizes the existing *note
     PyType_FromModuleAndSpec(): 398. 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: 960. was added to the *note Limited API: 961.:

        * *note Py_TPFLAGS_HAVE_VECTORCALL: 962.

        * *note PyVectorcall_NARGS(): 963.

        * *note PyVectorcall_Call(): 964.

        * *note vectorcallfunc: 965.

     The *note Py_TPFLAGS_HAVE_VECTORCALL: 962. flag is now removed from
     a class when the class's *note __call__(): 966. method is
     reassigned.  This makes vectorcall safe to use with mutable types
     (i.e.  heap types without the immutable flag, *note
     Py_TPFLAGS_IMMUTABLETYPE: 602.).  Mutable types that do not
     override *note tp_call: 967. now inherit the
     ‘Py_TPFLAGS_HAVE_VECTORCALL’ flag.  (Contributed by Petr Viktorin
     in gh-93274(7).)

     The *note Py_TPFLAGS_MANAGED_DICT: 3a4. and *note
     Py_TPFLAGS_MANAGED_WEAKREF: 3a5. flags have been added.  This
     allows extensions classes to support object *note __dict__: 1ca.
     and weakrefs with less bookkeeping, using less memory and with
     faster access.

   * API for performing calls using *note the vectorcall protocol: 960.
     was added to the *note Limited API: 961.:

        * *note PyObject_Vectorcall(): 968.

        * *note PyObject_VectorcallMethod(): 969.

        * *note PY_VECTORCALL_ARGUMENTS_OFFSET: 96a.

     This means that both the incoming and outgoing ends of the vector
     call protocol are now available in the *note Limited API: 961.
     (Contributed by Wenzel Jakob in gh-98586(8).)

   * Add two new public functions, *note PyEval_SetProfileAllThreads():
     96b. and *note PyEval_SetTraceAllThreads(): 857, 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(): 96c. to the C
     API which sets the vectorcall field of a given *note
     PyFunctionObject: 96d.  (Contributed by Andrew Frost in
     gh-92257(10).)

   * The C API now permits registering callbacks via *note
     PyDict_AddWatcher(): 603, *note PyDict_Watch(): 96e. 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(): 96f. and *note PyType_Watch(): 970.
     API to register callbacks to receive notification on changes to a
     type.  (Contributed by Carl Meyer in gh-91051(12).)

   * Add *note PyCode_AddWatcher(): 971. and *note
     PyCode_ClearWatcher(): 972. 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(): 973. and *note PyFrame_GetVarString():
     974. functions to get a frame variable by its name.  (Contributed
     by Victor Stinner in gh-91248(14).)

   * Add *note PyErr_GetRaisedException(): 643. and *note
     PyErr_SetRaisedException(): 646. 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(): 642. and *note PyErr_Restore():
     645.  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(): 975. and *note
     PyException_SetArgs(): 976. as convenience functions for retrieving
     and modifying the *note args: 977. passed to the exception's
     constructor.  (Contributed by Mark Shannon in gh-101578(17).)

   * Add *note PyErr_DisplayException(): 64f, 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(): 87b.
     function and *note PyInterpreterConfig: 978, which may be used to
     create sub-interpreters with their own GILs.  (See *note PEP 684;
     インタープリタごとの GIL: 863. for more info.)  (Contributed by
     Eric Snow in gh-104110(22).)

   * In the limited C API version 3.12, *note Py_INCREF(): 979. and
     *note Py_DECREF(): 97a. 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.5.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(): 3b9.
     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: 97c. 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__(): 97d. (using *note PyObject_CallMethod(): 3be, 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(): 824. and *note PyUnicode_FromFormatV():
     97e.  (Contributed by Serhiy Storchaka in gh-98836(1).)

   * An unrecognized format character in *note PyUnicode_FromFormat():
     824. and *note PyUnicode_FromFormatV(): 97e. now sets a *note
     SystemError: 3f1.  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(): 824. and
     *note PyUnicode_FromFormatV(): 97e.  (Contributed by Philip Georgi
     in gh-95504(3).)

   * Extension classes wanting to add a *note __dict__: 1ca. or weak
     reference slot should use *note Py_TPFLAGS_MANAGED_DICT: 3a4. and
     *note Py_TPFLAGS_MANAGED_WEAKREF: 3a5. 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(): 97f, as before.

   * The *note PyUnicode_FSDecoder(): 980. function no longer accepts
     bytes-like paths, like *note bytearray: 1d1. and *note memoryview:
     1dd. types: only the exact *note bytes: 1d2. type is accepted for
     bytes strings.  (Contributed by Victor Stinner in gh-98393(5).)

   * The *note Py_CLEAR: 981, *note Py_SETREF: 982. and *note
     Py_XSETREF: 983. 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(): 984, *note PyErr_SetString():
     985. 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(): 396.

        * *note PyType_FromSpecWithBases(): 397.

        * *note PyType_FromModuleAndSpec(): 398.

     Creating classes whose metaclass overrides *note tp_new: 986. 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(): 399. (added in Python 3.12)
     already disallows creating classes whose metaclass overrides
     ‘tp_new’ (*note __new__(): 987. 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: 988. 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: 989. 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: 98a. the metaclass.

        - If you 'know' the ‘tp_new’ can be skipped safely, filter the
          deprecation warning out using *note warnings.catch_warnings():
          42a. from Python.

   * *note PyOS_InputHook: 98b. and *note PyOS_ReadlineFunctionPointer:
     98c. are no longer called in *note subinterpreters: 417.  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: 5d2. 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(): 98d.

        * *note PyUnstable_Long_CompactValue(): 98e.

   * Custom allocators, set via *note PyMem_SetAllocator(): 98f, 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.5.14.3 非推奨
...............

   * In accordance with PEP 699(1), the ‘ma_version_tag’ field in *note
     PyDictObject: 844. 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: 613.: use *note PyConfig.parser_debug:
          614.

        * *note Py_VerboseFlag: 615.: use *note PyConfig.verbose: 616.

        * *note Py_QuietFlag: 617.: use *note PyConfig.quiet: 618.

        * *note Py_InteractiveFlag: 619.: use *note
          PyConfig.interactive: 61a.

        * *note Py_InspectFlag: 61b.: use *note PyConfig.inspect: 61c.

        * *note Py_OptimizeFlag: 61d.: use *note
          PyConfig.optimization_level: 61e.

        * *note Py_NoSiteFlag: 61f.: use *note PyConfig.site_import:
          620.

        * *note Py_BytesWarningFlag: 621.: use *note
          PyConfig.bytes_warning: 3cc.

        * *note Py_FrozenFlag: 622.: use *note
          PyConfig.pathconfig_warnings: 623.

        * *note Py_IgnoreEnvironmentFlag: 624.: use *note
          PyConfig.use_environment: 625.

        * *note Py_DontWriteBytecodeFlag: 626.: use *note
          PyConfig.write_bytecode: 627.

        * *note Py_NoUserSiteDirectory: 628.: use *note
          PyConfig.user_site_directory: 629.

        * *note Py_UnbufferedStdioFlag: 62a.: use *note
          PyConfig.buffered_stdio: 62b.

        * *note Py_HashRandomizationFlag: 62c.: use *note
          PyConfig.use_hash_seed: 62d. and *note PyConfig.hash_seed:
          62e.

        * *note Py_IsolatedFlag: 62f.: use *note PyConfig.isolated: 630.

        * *note Py_LegacyWindowsFSEncodingFlag: 631.: use *note
          PyPreConfig.legacy_windows_fs_encoding: 632.

        * *note Py_LegacyWindowsStdioFlag: 633.: use *note
          PyConfig.legacy_windows_stdio: 634.

        * ‘Py_FileSystemDefaultEncoding’: use *note
          PyConfig.filesystem_encoding: 635.

        * ‘Py_HasFileSystemDefaultEncoding’: use *note
          PyConfig.filesystem_encoding: 635.

        * ‘Py_FileSystemDefaultEncodeErrors’: use *note
          PyConfig.filesystem_errors: 636.

        * ‘Py_UTF8Mode’: use *note PyPreConfig.utf8_mode: 637. (see
          *note Py_PreInitialize(): 638.)

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. instead.  (Contributed by Victor Stinner in
     gh-77782(3).)

   * Creating *note immutable types: 602. 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: 95f, *note PyMember_GetOne(): 991. and
          *note PyMember_SetOne(): 992.

        - Type macros like *note Py_T_INT: 993, *note Py_T_DOUBLE: 994,
          etc.  (previously ‘T_INT’, ‘T_DOUBLE’, etc.)

        - The flags *note Py_READONLY: 995. (previously ‘READONLY’) and
          *note Py_AUDIT_READ: 996. (previously all uppercase)

     Several items are not exposed from ‘Python.h’:

        - *note T_OBJECT: 997. (use *note Py_T_OBJECT_EX: 998.)

        - *note T_NONE: 999. (previously undocumented, and pretty
          quirky)

        - The macro ‘WRITE_RESTRICTED’ which does nothing.

        - The macros ‘RESTRICTED’ and ‘READ_RESTRICTED’, equivalents of
          *note Py_AUDIT_READ: 996.

        - 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(): 642. and *note PyErr_Restore(): 645. are
     deprecated.  Use *note PyErr_GetRaisedException(): 643. and *note
     PyErr_SetRaisedException(): 646. instead.  (Contributed by Mark
     Shannon in gh-101578(6).)

   * ‘PyErr_Display()’ is deprecated.  Use *note
     PyErr_DisplayException(): 64f. 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(): 396, *note
     PyType_FromSpecWithBases(): 397. or *note
     PyType_FromModuleAndSpec(): 398. to create a class whose metaclass
     overrides *note tp_new: 986. 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<7>.
* Pending removal in future versions: Pending removal in future versions<7>.

   ---------- 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.5.14.4 Pending removal in Python 3.14
.......................................

   * The ‘ma_version_tag’ field in *note PyDictObject: 844. for
     extension modules ( PEP 699(1); gh-101193(2)).

   * Creating *note immutable types: 602. 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<7>,  Prev: Pending removal in Python 3 14<4>,  Up: 非推奨<3>

1.5.14.5 Pending removal in Python 3.15
.......................................

   * The ‘PyImport_ImportModuleNoBlock()’: Use *note
     PyImport_ImportModule(): 3ab. instead.

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

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

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

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

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

   * Python initialization functions, deprecated in Python 3.13:

        * ‘Py_GetPath()’: Use *note PyConfig_Get("module_search_paths"):
          3ae. (*note sys.path: 19f.) instead.

        * ‘Py_GetPrefix()’: Use *note PyConfig_Get("base_prefix"): 3ae.
          (*note sys.base_prefix: 3b2.) instead.  Use
          ‘PyConfig_Get("prefix")’ (*note sys.prefix: 3b3.) if *note
          virtual environments: 3b1. need to be handled.

        * ‘Py_GetExecPrefix()’: Use *note
          PyConfig_Get("base_exec_prefix"): 3ae. (*note
          sys.base_exec_prefix: 3af.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3b0.) if
          *note virtual environments: 3b1. need to be handled.

        * ‘Py_GetProgramFullPath()’: Use *note
          PyConfig_Get("executable"): 3ae. (*note sys.executable: 3b4.)
          instead.

        * ‘Py_GetProgramName()’: Use *note PyConfig_Get("executable"):
          3ae. (*note sys.executable: 3b4.) instead.

        * ‘Py_GetPythonHome()’: Use *note PyConfig_Get("home"): 3ae. or
          the *note PYTHONHOME: 3b5. environment variable instead.

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

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

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 60e. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 60e. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 60f.
          instead.

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

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

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 613.: Use *note PyConfig.parser_debug:
          614. or *note PyConfig_Get("parser_debug"): 3ae. instead.

        * *note Py_VerboseFlag: 615.: Use *note PyConfig.verbose: 616.
          or *note PyConfig_Get("verbose"): 3ae. instead.

        * *note Py_QuietFlag: 617.: Use *note PyConfig.quiet: 618. or
          *note PyConfig_Get("quiet"): 3ae. instead.

        * *note Py_InteractiveFlag: 619.: Use *note
          PyConfig.interactive: 61a. or *note
          PyConfig_Get("interactive"): 3ae. instead.

        * *note Py_InspectFlag: 61b.: Use *note PyConfig.inspect: 61c.
          or *note PyConfig_Get("inspect"): 3ae. instead.

        * *note Py_OptimizeFlag: 61d.: Use *note
          PyConfig.optimization_level: 61e. or *note
          PyConfig_Get("optimization_level"): 3ae. instead.

        * *note Py_NoSiteFlag: 61f.: Use *note PyConfig.site_import:
          620. or *note PyConfig_Get("site_import"): 3ae. instead.

        * *note Py_BytesWarningFlag: 621.: Use *note
          PyConfig.bytes_warning: 3cc. or *note
          PyConfig_Get("bytes_warning"): 3ae. instead.

        * *note Py_FrozenFlag: 622.: Use *note
          PyConfig.pathconfig_warnings: 623. or *note
          PyConfig_Get("pathconfig_warnings"): 3ae. instead.

        * *note Py_IgnoreEnvironmentFlag: 624.: Use *note
          PyConfig.use_environment: 625. or *note
          PyConfig_Get("use_environment"): 3ae. instead.

        * *note Py_DontWriteBytecodeFlag: 626.: Use *note
          PyConfig.write_bytecode: 627. or *note
          PyConfig_Get("write_bytecode"): 3ae. instead.

        * *note Py_NoUserSiteDirectory: 628.: Use *note
          PyConfig.user_site_directory: 629. or *note
          PyConfig_Get("user_site_directory"): 3ae. instead.

        * *note Py_UnbufferedStdioFlag: 62a.: Use *note
          PyConfig.buffered_stdio: 62b. or *note
          PyConfig_Get("buffered_stdio"): 3ae. instead.

        * *note Py_HashRandomizationFlag: 62c.: Use *note
          PyConfig.use_hash_seed: 62d. and *note PyConfig.hash_seed:
          62e. or *note PyConfig_Get("hash_seed"): 3ae. instead.

        * *note Py_IsolatedFlag: 62f.: Use *note PyConfig.isolated: 630.
          or *note PyConfig_Get("isolated"): 3ae. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 631.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 632. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 3ae. instead.

        * *note Py_LegacyWindowsStdioFlag: 633.: Use *note
          PyConfig.legacy_windows_stdio: 634. or *note
          PyConfig_Get("legacy_windows_stdio"): 3ae. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 635. or *note
          PyConfig_Get("filesystem_encoding"): 3ae. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 636. or *note
          PyConfig_Get("filesystem_errors"): 3ae. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 637. or *note
          PyConfig_Get("utf8_mode"): 3ae. instead.  (see *note
          Py_PreInitialize(): 638.)

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. to set these options.  Or *note
     PyConfig_Get(): 3ae. 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<7>,  Next: Pending removal in future versions<7>,  Prev: Pending removal in Python 3 15<6>,  Up: 非推奨<3>

1.5.14.6 Pending removal in Python 3.16
.......................................

   * The bundled copy of ‘libmpdec’.


File: python.info,  Node: Pending removal in future versions<7>,  Prev: Pending removal in Python 3 16<7>,  Up: 非推奨<3>

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

   * *note PyErr_Fetch(): 642.: Use *note PyErr_GetRaisedException():
     643. instead.

   * *note PyErr_NormalizeException(): 644.: Use *note
     PyErr_GetRaisedException(): 643. instead.

   * *note PyErr_Restore(): 645.: Use *note PyErr_SetRaisedException():
     646. instead.

   * *note PyModule_GetFilename(): 647.: Use *note
     PyModule_GetFilenameObject(): 648. instead.

   * *note PyOS_AfterFork(): 649.: Use *note PyOS_AfterFork_Child():
     64a. instead.

   * *note PySlice_GetIndicesEx(): 64b.: Use *note PySlice_Unpack():
     64c. and *note PySlice_AdjustIndices(): 64d. instead.

   * *note PyUnicode_READY(): 64e.: Unneeded since Python 3.12

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

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

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

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 651.: Use *note
          PyThread_tss_alloc(): 652. instead.

        * *note PyThread_delete_key(): 653.: Use *note
          PyThread_tss_free(): 654. instead.

        * *note PyThread_set_key_value(): 655.: Use *note
          PyThread_tss_set(): 656. instead.

        * *note PyThread_get_key_value(): 657.: Use *note
          PyThread_tss_get(): 658. instead.

        * *note PyThread_delete_key_value(): 659.: Use *note
          PyThread_tss_delete(): 65a. instead.

        * *note PyThread_ReInitTLS(): 65b.: Unneeded since Python 3.7.


File: python.info,  Node: 削除<3>,  Prev: 非推奨<3>,  Up: C API の変更<4>

1.5.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.6 What's New In Python 3.11
=============================


編集者: Pablo Galindo Salgado

この記事では Python 3.10 と比較した Python 3.11 の新機能を解説します。
Python 3.11 は2022年10月24日にリリースされました。全詳細については *note
変更履歴: 145. をご覧ください。

* 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.6.1 概要 - リリースハイライト
-------------------------------

   * Python 3.11 は Python 3.10 とくらべて 10-60% 高速です。平均的には、
     標準ベンチマークスイートでは 1.25倍の高速化を計測しました。詳細につ
     いては *note Faster CPython: 9a4. を見てください。

新たな文法機能:

   * *note PEP 654; 例外グループと except*: 9a5.

新たな組み込み機能:

   * *note PEP 678; ノートによって例外を充実させる: 9a6.

新しい標準ライブラリのモジュール：

   * PEP 680(1): *note tomllib: 105. — TOML(2) のパースを標準ライブラリ
     でサポート

インタープリタの改善:

   * *note PEP 657; トレースバックのエラー位置の詳細化: 9a7.

   * 新しい *note -P: 9a8. コマンドライン引数と *note PYTHONSAFEPATH:
     9a9. 環境変数により、 *note 安全でない可能性のあるパス: 9aa. を
     *note sys.path: 19f. に自動的に先頭に付加しないようにします。

新しい型ヒントの機能:

   * *note PEP 646; Variadic generics: 9ab.

   * *note PEP 655; Marking individual TypedDict items as required or
     not-required: 9ac.

   * *note PEP 673; Self 型: 9ad.

   * *note PEP 675; Arbitrary literal string type: 9ae.

   * *note PEP 681; Data class transforms: 9af.

重要な非推奨化、削除と制限：

   * PEP 594(3): *note
     たくさんのレガシーの標準ライブラリのモジュールが非推奨になり: 9b0.
     Python 3.13 で削除されます

   * PEP 624(4): *note Py_UNICODE エンコーダー API は削除されました:
     9b1.

   * PEP 670(5): *note 静的インライン関数に変換されたマクロ: 9b2.

   ---------- 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.6.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.6.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: 193. オブジェクトや複数の関数呼び出しを処理すると
きにも役立ちます:

     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: 6b9. *note 命令: 9b6. とソースコ
ードの場所を関連付けるために使用できます。この情報は次を使用して取得でき
ます:

   - Python の *note codeobject.co_positions(): 9b7. メソッド。

   - C API の *note PyCode_Addr2Location(): 9b8. 関数。

詳細は PEP 657(1) を参照してください。(Pablo Galindo, Batuhan Taskaya,
Ammar Askar の貢献による bpo-43950(2))

     注釈: この機能は *note コードオブジェクト: 9b9. に列の位置を保存す
     る必要があり、その結果コンパイルされた Pthon ファイルのインタープリ
     タのメモリ使用量とディスク使用量がわずかに増加する可能性があります
     。余分な情報を保存せず、余分なトレースバック情報を表示しないように
     するには *note -X no_debug_ranges: 183. コマンドライン引数または
     *note PYTHONNODEBUGRANGES: 9ba. 環境変数を使用してください。

   ---------- 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.6.2.2 PEP 654: 例外グループと ‘except*’
.........................................

PEP 654(1) では、プログラムが無関係な複数の例外を同時に送出させて処理で
きるようにする言語機能が導入されています。組み込み型 *note
ExceptionGroup: 6de. と *note BaseExceptionGroup: 76d. を使用すると、例
外をグループ化して一緒に送出することができます。また、新しい *note
except*: 44f. 構文は、 *note except: 44e. を例外グループのサブグループに
マッチするように一般化したものです。

より詳しくは 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.6.2.3 PEP 678: ノートによって例外を充実させる
...............................................

*note BaseException: 9bd. に *note add_note(): 9be. メソッドが追加されま
した。これは例外が送出された時点では利用できないコンテキスト情報を例外に
付与するために使用できます。追加された注釈はデフォルトのトレースバックに
表示されます。

より詳しくは 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.6.2.4 Windows ‘py.exe’ ランチャーの改善
.........................................

Python 3.11 に含まれる *note Python install manager: 9c1. のコピーが大幅
に更新されました。 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.6.3 型ヒントに関連する新しい機能
----------------------------------

This section covers major changes affecting PEP 484(1) type hints and
the *note typing: 10d. 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.6.3.1 PEP 646: Variadic generics
..................................

PEP 484(1) previously introduced *note TypeVar: 29f, enabling creation
of generics parameterised with a single type.  PEP 646(2) adds *note
TypeVarTuple: 29e, 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.6.3.2 PEP 655: Marking individual ‘TypedDict’ items as required or not-required
.................................................................................

*note Required: 9c7. and *note NotRequired: 9c8. provide a
straightforward way to mark whether individual items in a *note
TypedDict: 29b. 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.6.3.3 PEP 673: ‘Self’ 型
..........................

The new *note Self: 9ca. 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: 29f.-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: 6a0.s, and *note __enter__(): 9cb. 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: 9ca. 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.6.3.4 PEP 675: Arbitrary literal string type
..............................................

The new *note LiteralString: 9cd. 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.6.3.5 PEP 681: Data class transforms
......................................

*note dataclass_transform: 8e9. 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: 6ec.-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.6.3.6 PEP 563 may not be the future
.....................................

PEP 563(1) Postponed Evaluation of Annotations (the ‘from __future__
import annotations’ *note future statement: 677.) 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.6.4 その他の言語変更
----------------------

   * Starred unpacking expressions can now be used in *note for: 329.
     statements.  (See bpo-46725(1) for more details.)

   * Asynchronous *note comprehensions: 9d3. are now allowed inside
     comprehensions in *note asynchronous functions: 9d4.  Outer
     comprehensions implicitly become asynchronous in this case.
     (Contributed by Serhiy Storchaka in bpo-33346(2).)

   * A *note TypeError: 29c. is now raised instead of an *note
     AttributeError: 1b4. in *note with: 215. statements and *note
     contextlib.ExitStack.enter_context(): 9d5. for objects that do not
     support the *note context manager: 47f. protocol, and in *note
     async with: 216. statements and *note
     contextlib.AsyncExitStack.enter_async_context(): 9d6. for objects
     not supporting the *note asynchronous context manager: 9d7.
     protocol.  (Contributed by Serhiy Storchaka in bpo-12022(3) and
     bpo-44471(4).)

   * Added *note object.__getstate__(): 9d8, 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: 1d1, *note set: 432, *note frozenset: 9d9, *note
     collections.OrderedDict: 9da, *note collections.deque: 9db, *note
     weakref.WeakSet: 9dc, and *note datetime.tzinfo: 9dd. now copies
     and pickles instance attributes implemented as *note slots: 9de.
     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: 9a8. command line option and a *note
     PYTHONSAFEPATH: 9a9. environment variable, which disable the
     automatic prepending to *note sys.path: 19f. of the script's
     directory when running a script, or the current directory when
     using *note -c: 44c. and *note -m: 4d1.  This ensures only stdlib
     and installed modules are picked up by *note import: 9df, 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: 704. 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: 19f.  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:
     2f9. and *note sys.path_importer_cache: 9e0. when there is a
     mixture of *note str: 1ea. and *note bytes: 1d2. 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.6.5 その他の CPython の実装の変更
-----------------------------------

   * The special methods *note __complex__(): 9e3. for *note complex:
     330. and *note __bytes__(): 9e4. for *note bytes: 1d2. are
     implemented to support the *note typing.SupportsComplex: 9e5. and
     *note typing.SupportsBytes: 9e6. 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: 1ea, *note bytes: 1d2, and some
     other types now use it as the default algorithm for *note hash():
     9e7.  PEP 552(2) *note hash-based .pyc files: 9e8. now use
     ‘siphash13’ too.  (Contributed by Inada Naoki in bpo-29410(3).)

   * When an active exception is re-raised by a *note raise: 9e9.
     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: 44e. 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: 9ea, ‘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: 9eb. field must now be
     set to ‘1’ for initialization to use *note
     PyConfig.module_search_paths: 83a. to initialize *note sys.path:
     19f.  Otherwise, initialization will recalculate the path and
     replace any values added to ‘module_search_paths’.

   * The output of the *note -help: 9ec. option now fits in 50 lines/80
     columns.  Information about *note Python environment variables:
     9ed. and *note -X: 183. options is now available using the
     respective *note -help-env: 9ee. and *note -help-xoptions: 9ef.
     flags, and with the new *note -help-all: 9f0.  (Contributed by Éric
     Araujo in bpo-46142(7).)

   * Converting between *note int: 32e. and *note str: 1ea. in bases
     other than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such
     as base 10 (decimal) now raises a *note ValueError: 15a. 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: e2. APIs.  See the *note integer string conversion
     length limitation: 9f1. 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.6.6 新たなモジュール
----------------------

   * *note tomllib: 105.: For parsing TOML(1). See PEP 680(2) for more
     details.  (Contributed by Taneli Hukkinen in bpo-40059(3).)

   * *note wsgiref.types: 125.: 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.6.7 改良されたモジュール
--------------------------

* Menu:

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


File: python.info,  Node: asyncio<8>,  Next: contextlib<2>,  Up: 改良されたモジュール<3>

1.6.7.1 asyncio
...............

   * Added the *note TaskGroup: 6dd. class, an *note asynchronous
     context manager: 9f8. 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(): 469. and *note gather(): 9f9. directly.
     (Contributed by Yury Selivanov and others in gh-90908(1).)

   * Added *note timeout(): 9fa, an asynchronous context manager for
     setting a timeout on asynchronous operations.  For new code this is
     recommended over using *note wait_for(): 9fb. directly.
     (Contributed by Andrew Svetlov in gh-90927(2).)

   * Added the *note Runner: 315. class, which exposes the machinery
     used by *note run(): 314.  (Contributed by Andrew Svetlov in
     gh-91218(3).)

   * Added the *note Barrier: 9fc. class to the synchronization
     primitives in the asyncio library, and the related *note
     BrokenBarrierError: 9fd. exception.  (Contributed by Yves Duprat
     and Andrew Svetlov in gh-87518(4).)

   * Added keyword argument 'all_errors' to *note
     asyncio.loop.create_connection(): 9fe. so that multiple connection
     errors can be raised as an *note ExceptionGroup: 6de.

   * Added the *note asyncio.StreamWriter.start_tls(): 9ff. 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(): a00, *note sock_recvfrom(): a01. and *note
     sock_recvfrom_into(): a02.  These have implementations in *note
     SelectorEventLoop: 316. and *note ProactorEventLoop: a03.
     (Contributed by Alex Grönholm in bpo-46805(6).)

   * Added *note cancelling(): 6e1. and *note uncancel(): 6e2. methods
     to *note Task: 467.  These are primarily intended for internal use,
     notably by *note TaskGroup: 6dd.

   ---------- 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<2>,  Next: データクラス,  Prev: asyncio<8>,  Up: 改良されたモジュール<3>

1.6.7.2 contextlib
..................

   * Added non parallel-safe *note chdir(): a06. context manager to
     change the current working directory and then restore it on exit.
     Simple wrapper around *note chdir(): a07.  (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<3>,  Prev: contextlib<2>,  Up: 改良されたモジュール<3>

1.6.7.3 データクラス
....................

   * Change field default mutability check, allowing only defaults which
     are *note hashable: 18e. instead of any object which is not an
     instance of *note dict: 193, *note list: 4e0. or *note set: 432.
     (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<3>,  Next: enum<3>,  Prev: データクラス,  Up: 改良されたモジュール<3>

1.6.7.4 datetime
................

   * Add *note datetime.UTC: 901, a convenience alias for *note
     datetime.timezone.utc: a0c.  (Contributed by Kabir Kwatra in
     gh-91973(1).)

   * *note datetime.date.fromisoformat(): a0d, *note
     datetime.time.fromisoformat(): a0e. and *note
     datetime.datetime.fromisoformat(): a0f. 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<3>,  Up: 改良されたモジュール<3>

1.6.7.5 enum
............

   * Renamed ‘EnumMeta’ to *note EnumType: 702. (‘EnumMeta’ kept as an
     alias).

   * Added *note StrEnum: a12, with members that can be used as (and
     must be) strings.

   * Added *note ReprEnum: a13, which only modifies the *note
     __repr__(): 1c7. of members while returning their literal values
     (rather than names) for *note __str__(): a14. and *note
     __format__(): a15. (used by *note str(): 1ea, *note format(): 440.
     and *note f-string: 85e.s).

   * Changed *note Enum.__format__(): a16. (the default for *note
     format(): 440, *note str.format(): a17. and *note f-string: 85e.s)
     to always produce the same result as *note Enum.__str__(): a18.:
     for enums inheriting from *note ReprEnum: a13. 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: a19. enums
     and the *note FlagBoundary: a1a. enum with its options, to control
     how to handle out-of-range flag values.

   * Added the *note verify(): a1b. enum decorator and the *note
     EnumCheck: a1c. enum with its options, to check enum classes
     against several specific constraints.

   * Added the *note member(): a1d. and *note nonmember(): a1e.
     decorators, to ensure the decorated object is/is not converted to
     an enum member.

   * Added the *note property(): a1f. decorator, which works like *note
     property(): 6c1. except for enums.  Use this instead of *note
     types.DynamicClassAttribute(): a20.

   * Added the *note global_enum(): a21. enum decorator, which adjusts
     *note __repr__(): 1c7. and *note __str__(): a14. to show values as
     members of their module rather than the enum class.  For example,
     ‘'re.ASCII'’ for the *note ASCII: a22. member of *note
     re.RegexFlag: a23. rather than ‘'RegexFlag.ASCII'’.

   * Enhanced *note Flag: a19. to support *note len(): a24, iteration
     and *note in: 32b./*note not in: a25. on its members.  For example,
     the following now works: ‘len(AFlag(3)) == 2 and list(AFlag(3)) ==
     (AFlag.ONE, AFlag.TWO)’

   * Changed *note Enum: a26. and *note Flag: a19. so that members are
     now defined before *note __init_subclass__(): a27. is called; *note
     dir(): a28. now includes methods, etc., from mixed-in data types.

   * Changed *note Flag: a19. 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.6.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<4>,  Prev: fcntl,  Up: 改良されたモジュール<3>

1.6.7.7 fractions
.................

   * Support PEP 515(1)-style initialization of *note Fraction: 1ce.
     from string.  (Contributed by Sergey B Kirpichev in bpo-44258(2).)

   * *note Fraction: 1ce. 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<4>,  Next: gzip<2>,  Prev: fractions<4>,  Up: 改良されたモジュール<3>

1.6.7.8 functools
.................

   * *note functools.singledispatch(): a2f. now supports *note
     types.UnionType: 52e. and *note typing.Union: 349. 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<3>,  Prev: functools<4>,  Up: 改良されたモジュール<3>

1.6.7.9 gzip
............

   * The *note gzip.compress(): a32. function is now faster when used
     with the 'mtime=0' argument as it delegates the compression
     entirely to a single *note zlib.compress(): a33. 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: 6a. 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<3>,  Next: IDLE と idelelib,  Prev: gzip<2>,  Up: 改良されたモジュール<3>

1.6.7.10 hashlib
................

   * *note hashlib.blake2b(): a36. and *note hashlib.blake2s(): a37. 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: 6b. 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(): a38, 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<4>,  Prev: hashlib<3>,  Up: 改良されたモジュール<3>

1.6.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<4>,  Next: locale<4>,  Prev: IDLE と idelelib,  Up: 改良されたモジュール<3>

1.6.7.12 inspect
................

   * Add *note getmembers_static(): a3d. to return all members without
     triggering dynamic lookup via the descriptor protocol.
     (Contributed by Weipeng Hong in bpo-30533(1).)

   * Add *note ismethodwrapper(): a3e. for checking if the type of an
     object is a *note MethodWrapperType: a3f.  (Contributed by Hakan
     Çelik in bpo-29418(2).)

   * Change the frame-related functions in the *note inspect: 81. module
     to return new *note FrameInfo: a40. and *note Traceback: a41. class
     instances (backwards compatible with the previous *note named
     tuple: a42.-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(): a43.

        * *note inspect.getouterframes(): a44.

        * *note inspect.getinnerframes(): a45,

        * *note inspect.stack(): a46.

        * *note inspect.trace(): a47.

     (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<4>,  Next: logging<2>,  Prev: inspect<4>,  Up: 改良されたモジュール<3>

1.6.7.13 locale
...............

   * Add *note locale.getencoding(): a4a. to get the current locale
     encoding.  It is similar to ‘locale.getpreferredencoding(False)’
     but ignores the *note Python UTF-8 Mode: a4b.


File: python.info,  Node: logging<2>,  Next: math<5>,  Prev: locale<4>,  Up: 改良されたモジュール<3>

1.6.7.14 logging
................

   * Added *note getLevelNamesMapping(): a4e. to return a mapping from
     logging level names (e.g.  ‘'CRITICAL'’) to the values of their
     corresponding *note ロギングレベル: a4f. (e.g.  ‘50’, by default).
     (Contributed by Andrei Kulakovin in gh-88024(1).)

   * Added a *note createSocket(): a50. method to *note SysLogHandler:
     a51, to match *note SocketHandler.createSocket(): a52.  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<5>,  Next: operator<2>,  Prev: logging<2>,  Up: 改良されたモジュール<3>

1.6.7.15 math
.............

   * Add *note math.exp2(): a55.: return 2 raised to the power of x.
     (Contributed by Gideon Mitchell in bpo-45917(1).)

   * Add *note math.cbrt(): a56.: return the cube root of x.
     (Contributed by Ajith Ramachandran in bpo-44357(2).)

   * The behaviour of two *note math.pow(): a57. 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: 15a.  (Contributed by Mark Dickinson in bpo-44339(3).)

   * The *note math.nan: a58. 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<6>,  Prev: math<5>,  Up: 改良されたモジュール<3>

1.6.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<6>,  Next: pathlib<8>,  Prev: operator<2>,  Up: 改良されたモジュール<3>

1.6.7.17 os
...........

   * On Windows, *note os.urandom(): 936. 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<8>,  Next: re<5>,  Prev: os<6>,  Up: 改良されたモジュール<3>

1.6.7.18 pathlib
................

   * *note glob(): 73f. and *note rglob(): 740. return only directories
     if 'pattern' ends with a pathname components separator: *note sep:
     a5f. or *note altsep: a60.  (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<5>,  Next: shutil<4>,  Prev: pathlib<8>,  Up: 改良されたモジュール<3>

1.6.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<4>,  Next: socket<3>,  Prev: re<5>,  Up: 改良されたモジュール<3>

1.6.7.20 shutil
...............

   * Add optional parameter 'dir_fd' in *note shutil.rmtree(): 33d.
     (Contributed by Serhiy Storchaka in bpo-46245(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46245


File: python.info,  Node: socket<3>,  Next: sqlite3<6>,  Prev: shutil<4>,  Up: 改良されたモジュール<3>

1.6.7.21 socket
...............

   * Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner
     in bpo-30512(1).)

   * *note create_connection(): a67. has an option to raise, in case of
     failure to connect, an *note ExceptionGroup: 6de. 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<6>,  Next: string,  Prev: socket<3>,  Up: 改良されたモジュール<3>

1.6.7.22 sqlite3
................

   * You can now disable the authorizer by passing *note None: a6a. to
     *note set_authorizer(): 3ea.  (Contributed by Erlend E. Aasland in
     bpo-44491(1).)

   * Collation name *note create_collation(): a6b. can now contain any
     Unicode character.  Collation names with invalid characters now
     raise *note UnicodeEncodeError: a6c. instead of *note
     sqlite3.ProgrammingError: 584.  (Contributed by Erlend E. Aasland
     in bpo-44688(2).)

   * *note sqlite3: d7. exceptions now include the SQLite extended error
     code as *note sqlite_errorcode: a6d. and the SQLite error name as
     *note sqlite_errorname: a6e.  (Contributed by Aviv Palivoda, Daniel
     Shahaf, and Erlend E. Aasland in bpo-16379(3) and bpo-24139(4).)

   * Add *note setlimit(): a6f. and *note getlimit(): a70. to *note
     sqlite3.Connection: 3e6. for setting and getting SQLite limits by
     connection basis.  (Contributed by Erlend E. Aasland in
     bpo-45243(5).)

   * *note sqlite3: d7. now sets *note sqlite3.threadsafety: a71. 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: d7. C callbacks now use unraisable exceptions if
     callback tracebacks are enabled.  Users can now register an *note
     unraisable hook handler: 712. to improve their debug experience.
     (Contributed by Erlend E. Aasland in bpo-45828(7).)

   * Fetch across rollback no longer raises *note InterfaceError: a72.
     Instead we leave it to the SQLite library to handle these cases.
     (Contributed by Erlend E. Aasland in bpo-44092(8).)

   * Add *note serialize(): a73. and *note deserialize(): a74. to *note
     sqlite3.Connection: 3e6. for serializing and deserializing
     databases.  (Contributed by Erlend E. Aasland in bpo-41930(9).)

   * Add *note create_window_function(): a75. to *note
     sqlite3.Connection: 3e6. for creating aggregate window functions.
     (Contributed by Erlend E. Aasland in bpo-34916(10).)

   * Add *note blobopen(): a76. to *note sqlite3.Connection: 3e6.  *note
     sqlite3.Blob: a77. 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<6>,  Prev: sqlite3<6>,  Up: 改良されたモジュール<3>

1.6.7.23 string
...............

   * Add *note get_identifiers(): a7a. and *note is_valid(): a7b. to
     *note string.Template: a7c, 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<6>,  Next: sysconfig<4>,  Prev: string,  Up: 改良されたモジュール<3>

1.6.7.24 sys
............

   * *note sys.exc_info(): a7f. 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(): a80. 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: a81. 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<4>,  Next: tempfile<3>,  Prev: sys<6>,  Up: 改良されたモジュール<3>

1.6.7.25 sysconfig
..................

   * Three new *note installation schemes: 663. ('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(): a84.  Third party code that
     creates new virtual environments should use the new 'venv'
     installation scheme to determine the paths, as does *note venv:
     11a.  (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<5>,  Prev: sysconfig<4>,  Up: 改良されたモジュール<3>

1.6.7.26 tempfile
.................

   * *note SpooledTemporaryFile: a87. objects now fully implement the
     methods of *note io.BufferedIOBase: a88. or *note io.TextIOBase:
     a89. (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<5>,  Next: time<2>,  Prev: tempfile<3>,  Up: 改良されたモジュール<3>

1.6.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():
     a8c. method now uses the monotonic clock (*note
     time.CLOCK_MONOTONIC: a8d.) for the timeout, rather than using the
     system clock (*note time.CLOCK_REALTIME: a8e.), 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<5>,  Prev: threading<5>,  Up: 改良されたモジュール<3>

1.6.7.28 time
.............

   * On Unix, *note time.sleep(): a91. 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(): a91. 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<5>,  Next: traceback<2>,  Prev: time<2>,  Up: 改良されたモジュール<3>

1.6.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:
     308.  (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<7>,  Prev: tkinter<5>,  Up: 改良されたモジュール<3>

1.6.7.30 traceback
..................

   * Add *note traceback.StackSummary.format_frame_summary(): a96. 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(): a97, which prints
     the formatted *note TracebackException: 76a. 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<7>,  Next: unicodedata<5>,  Prev: traceback<2>,  Up: 改良されたモジュール<3>

1.6.7.31 typing
...............

For major changes, see *note 型ヒントに関連する新しい機能: 9c2.

   * Add *note typing.assert_never(): a9a. and *note typing.Never: a9b.
     ‘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: a9c.  (Contributed by Jelle
     Zijlstra in gh-90633(1).)

   * Add *note typing.reveal_type(): a9d.  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(): a9e.  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: 29b. types can now be generic.
     (Contributed by Samodya Abeysiriwardane in gh-89026(4).)

   * *note NamedTuple: 2f0. types can now be generic.  (Contributed by
     Serhiy Storchaka in bpo-43923(5).)

   * Allow subclassing of *note typing.Any: a9f.  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(): aa0. decorator now sets the ‘__final__’
     attributed on the decorated object.  (Contributed by Jelle Zijlstra
     in gh-90500(7).)

   * The *note typing.get_overloads(): aa1. function can be used for
     introspecting the overloads of a function.  *note
     typing.clear_overloads(): aa2. can be used to clear all registered
     overloads of a function.  (Contributed by Jelle Zijlstra in
     gh-89263(8).)

   * The *note __init__(): 306. method of *note Protocol: 772.
     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(): aa3. now supports evaluating strings
     as forward references in *note PEP 585 generic aliases: aa4.
     (Contributed by Niklas Rosenstein in gh-85542(12).)

   * *note typing.get_type_hints(): aa3. no longer adds *note Optional:
     aa5. to parameters with ‘None’ as a default.  (Contributed by
     Nikita Sobolev in gh-90353(13).)

   * *note typing.get_type_hints(): aa3. now supports evaluating bare
     stringified *note ClassVar: 774. annotations.  (Contributed by
     Gregory Beauregard in gh-90711(14).)

   * *note typing.no_type_check(): aa6. 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<5>,  Next: unittest<6>,  Prev: typing<7>,  Up: 改良されたモジュール<3>

1.6.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<6>,  Next: venv<3>,  Prev: unicodedata<5>,  Up: 改良されたモジュール<3>

1.6.7.33 unittest
.................

   * Added methods *note enterContext(): aab. and *note
     enterClassContext(): aac. of class *note TestCase: 536, method
     *note enterAsyncContext(): aad. of class *note
     IsolatedAsyncioTestCase: 34a. and function *note
     unittest.enterModuleContext(): aae.  (Contributed by Serhiy
     Storchaka in bpo-45046(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45046


File: python.info,  Node: venv<3>,  Next: warnings<3>,  Prev: unittest<6>,  Up: 改良されたモジュール<3>

1.6.7.34 venv
.............

   * When new Python virtual environments are created, the 'venv' *note
     sysconfig installation scheme: 663. 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<3>,  Next: zipfile<2>,  Prev: venv<3>,  Up: 改良されたモジュール<3>

1.6.7.35 warnings
.................

   * *note warnings.catch_warnings(): 42a. now accepts arguments for
     *note warnings.simplefilter(): ab3, 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<3>,  Up: 改良されたモジュール<3>

1.6.7.36 zipfile
................

   * Added support for specifying member name encoding for reading
     metadata in a *note ZipFile: ab6.'s directory and file headers.
     (Contributed by Stephen J. Turnbull and Serhiy Storchaka in
     bpo-28080(1).)

   * Added *note ZipFile.mkdir(): ab7. for creating new directories
     inside ZIP archives.  (Contributed by Sam Ezeh in gh-49083(2).)

   * Added *note stem: ab8, *note suffix: ab9. and *note suffixes: aba.
     to *note zipfile.Path: abb.  (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.6.8 最適化
------------

This section covers specific optimizations independent of the *note
Faster CPython: 9a4. project, which is covered in its own section.

   * The compiler now optimizes simple *note printf-style % formatting:
     abe. on string literals containing only the format codes ‘%s’, ‘%r’
     and ‘%a’ and makes it as fast as a corresponding *note f-string:
     85e. 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: 32e. by a value smaller than ‘2**30’.  (Contributed by
     Gregory P. Smith and Tim Peters in gh-90564(2).)

   * *note sum(): 886. 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(): abf. by ≈15% and simple *note list
     comprehension: ac0.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: 193. 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: ac1. 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: 91. functions *note comb(): ac2. and *note perm(): ac3.
     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: da. functions *note mean(): ac4, *note
     variance(): ac5. and *note stdev(): ac6. now consume iterators in
     one pass rather than converting them to a *note list: 4e0. first.
     This is twice as fast and can save substantial memory.
     (Contributed by Raymond Hettinger in gh-90415(8).)

   * *note unicodedata.normalize(): ac7. 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.6.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:
ac9. and *note Faster Runtime: aca.  Optimizations not covered by this
project are listed separately under *note 最適化: abd.

* 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.6.9.1 Faster Startup
......................

* Menu:

* Frozen imports / Static code objects::


File: python.info,  Node: Frozen imports / Static code objects,  Up: Faster Startup

1.6.9.2 Frozen imports / Static code objects
............................................

Python caches *note bytecode: 6b9. in the *note __pycache__: ace.
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 コードオブジェクト: 9b9. (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.6.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.6.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: ad2. are now created only when requested
by debuggers or by Python introspection functions such as *note
sys._getframe(): ad3. and *note inspect.currentframe(): ad4.  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.6.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(): 8d8.).  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.6.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: 6b9.

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: 32e, *note float: 32f. and *note str: 1ea.                            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: 4e0,       10-25%                  Irit Katriel, Mark
                                             *note tuple: 1d9. and *note dict: 193. directly index the                           Shannon
                                             underlying data structures.                                                         
                                             
                                             Subscripting custom *note __getitem__(): 78d. is also
                                             inlined similar to
                                             *note Inlined Python function calls: ad5.
                                             
                                                                                                                                 
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(): a24. and *note str: 1ea. 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: 4e0. and *note tuple: 1d9.  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.6.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: adb. 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: c1.'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.6.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.6.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.6.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.6.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.6.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.6.9.13 About
..............

Faster CPython explores optimizations for *note CPython: ae8.  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.6.10 CPython バイトコードの変更
---------------------------------

The bytecode now contains inline cache entries, which take the form of
the newly-added *note CACHE: aeb. 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.6.10.1 New opcodes
....................

   * ‘ASYNC_GEN_WRAP’, *note RETURN_GENERATOR: aee. and *note SEND: aef,
     used in generators and co-routines.

   * *note COPY_FREE_VARS: af0, which avoids needing special caller-side
     code for closures.

   * *note JUMP_BACKWARD_NO_INTERRUPT: af1, for use in certain loops
     where handling interrupts is undesirable.

   * *note MAKE_CELL: af2, to create *note セルオブジェクト (cell
     object): af3.

   * *note CHECK_EG_MATCH: af4. and ‘PREP_RERAISE_STAR’, to handle the
     *note new exception groups and except*: 9a5. added in PEP 654(1).

   * *note PUSH_EXC_INFO: af5, for use in exception handlers.

   * *note RESUME: 7ba, 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.6.10.2 Replaced opcodes
.........................

Replaced Opcode(s)                       New Opcode(s)                            注釈
                                                                                  
--------------------------------------------------------------------------------------------------------------------------------
                                                                                  
     ‘BINARY_*’                          *note BINARY_OP: 59c.                    Replaced all numeric binary/in-place
     ‘INPLACE_*’                                                                  opcodes with a single opcode
                                                                                  
                                                                                  
     ‘CALL_FUNCTION’                          *note CALL: af8.                    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: af9.               
                                         
                                                                                  
     ‘DUP_TOP’                                *note COPY: afa.                    Stack manipulation instructions
     ‘DUP_TOP_TWO’                            *note SWAP: afb.                    
     ‘ROT_TWO’                           
     ‘ROT_THREE’
     ‘ROT_FOUR’
     ‘ROT_N’

     ‘JUMP_IF_NOT_EXC_MATCH’                  *note CHECK_EXC_MATCH: afc.         Now performs check but doesn't jump
                                                                                  
                                                                                  
     ‘JUMP_ABSOLUTE’                          *note JUMP_BACKWARD: afd.           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: 215. 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.6.10.3 Changed/removed opcodes
................................

   * Changed *note MATCH_CLASS: b02. and *note MATCH_KEYS: b03. 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.6.11 非推奨
-------------

This section lists Python APIs that have been deprecated in Python 3.11.

Deprecated C APIs are *note listed separately: b07.
* Menu:

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


File: python.info,  Node: Language/Builtins,  Next: モジュール,  Up: 非推奨<4>

1.6.11.1 Language/Builtins
..........................

   * Chaining *note classmethod: 6a0. descriptors (introduced in
     bpo-19072(1)) is now deprecated.  It can no longer be used to wrap
     other descriptors such as *note property: 6c1.  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:
     2d4.  In a future Python version, they will raise a *note
     SyntaxWarning: 451. and eventually a *note SyntaxError: 189.
     (Contributed by Serhiy Storchaka in gh-81548(3).)

   * The delegation of *note int(): 32e. to *note __trunc__(): 442. is
     now deprecated.  Calling ‘int(a)’ when ‘type(a)’ implements
     ‘__trunc__()’ but not *note __int__(): 443. or *note __index__():
     444. now raises a *note DeprecationWarning: 2d4.  (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.6.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.6.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: 2d4. and will be removed in Python 3.13.  Use
     *note configparser.BasicInterpolation: b0f. or *note
     configparser.ExtendedInterpolation: b10. instead.  (Contributed by
     Hugo van Kemenade in bpo-46607(2).)

   * The older set of *note importlib.resources: 7e. 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(): 23e. function is deprecated
     and will be removed in Python 3.15.  Use *note locale.setlocale():
     23c, *note locale.getpreferredencoding(False): 94c. and *note
     locale.getlocale(): 23d. 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: b11.  Only sequences
     of ASCII digits will now be accepted as a numerical reference, and
     the group name in *note bytes: 1d2. 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: c1. 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(): b12. 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: 348, 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: 1ea. instead wherever possible.
     (Contributed by Alex Waygood in gh-92332(8).)

   * The keyword argument syntax for constructing *note
     typing.TypedDict: 29b. 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: 11e. itself.  (Contributed by Donghee Na in
     bpo-42255(10).)

   * The behavior of returning a value from a *note TestCase: 536. and
     *note IsolatedAsyncioTestCase: 34a. test methods (other than the
     default ‘None’ value) is now deprecated.

   * Deprecated the following not-formally-documented *note unittest:
     10f. functions, scheduled for removal in Python 3.13:

        * ‘unittest.findTestCases()’

        * ‘unittest.makeSuite()’

        * ‘unittest.getTestCaseNames()’

     Use *note TestLoader: 798. methods instead:

        * *note unittest.TestLoader.loadTestsFromModule(): 799.

        * *note unittest.TestLoader.loadTestsFromTestCase(): 79a.

        * *note unittest.TestLoader.getTestCaseNames(): 79b.

     (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.6.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: b16.

   * The ‘asynchat’ module

   * The ‘asyncore’ module

   * The *note entire distutils package: b17.

   * The ‘imp’ module

   * The *note typing.io: 4cd. namespace

   * The *note typing.re: b18. 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: 10f.:

          非推奨のエイリアス               メソッド名                          非推奨となるバー
                                                                               ジョン
                                                                               
          -----------------------------------------------------------------------------------------
                                                                               
          ‘failUnless’                     *note assertTrue(): 93a.            3.1
                                                                               
                                                                               
          ‘failIf’                         *note assertFalse(): 93b.           3.1
                                                                               
                                                                               
          ‘failUnlessEqual’                *note assertEqual(): 93c.           3.1
                                                                               
                                                                               
          ‘failIfEqual’                    *note assertNotEqual(): 93d.        3.1
                                                                               
                                                                               
          ‘failUnlessAlmostEqual’          *note assertAlmostEqual(): 93e.     3.1
                                                                               
                                                                               
          ‘failIfAlmostEqual’              *note assertNotAlmostEqual(): 93f.  3.1
                                                                               
                                                                               
          ‘failUnlessRaises’               *note assertRaises(): 940.          3.1
                                                                               
                                                                               
          ‘assert_’                        *note assertTrue(): 93a.            3.2
                                                                               
                                                                               
          ‘assertEquals’                   *note assertEqual(): 93c.           3.2
                                                                               
                                                                               
          ‘assertNotEquals’                *note assertNotEqual(): 93d.        3.2
                                                                               
                                                                               
          ‘assertAlmostEquals’             *note assertAlmostEqual(): 93e.     3.2
                                                                               
                                                                               
          ‘assertNotAlmostEquals’          *note assertNotAlmostEqual(): 93f.  3.2
                                                                               
                                                                               
          ‘assertRegexpMatches’            *note assertRegex(): 941.           3.2
                                                                               
                                                                               
          ‘assertRaisesRegexp’             *note assertRaisesRegex(): 942.     3.2
                                                                               
                                                                               
          ‘assertNotRegexpMatches’         *note assertNotRegex(): 943.        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.6.13 削除
-----------

This section lists Python APIs that have been removed in Python 3.11.

Removed C APIs are *note listed separately: b1c.

   * Removed the ‘@asyncio.coroutine()’ *note decorator: b1d. enabling
     legacy generator-based coroutines to be compatible with *note
     async: b1e. / *note await: 439. code.  The function has been
     deprecated since Python 3.8 and the removal was initially scheduled
     for Python 3.10.  Use *note async def: 9d4. 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(): b1f, 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(): b20. 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__(): 78d. methods of *note
     xml.dom.pulldom.DOMEventStream: b21, *note
     wsgiref.util.FileWrapper: b22. and *note fileinput.FileInput: b23,
     deprecated since Python 3.9.  (Contributed by Hugo van Kemenade in
     bpo-45132(6).)

   * Removed the deprecated *note gettext: 66. 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: 81. module:

        * The ‘getargspec()’ function, deprecated since Python 3.0; use
          *note inspect.signature(): 4c4. or *note
          inspect.getfullargspec(): b24. instead.

        * The ‘formatargspec()’ function, deprecated since Python 3.5;
          use the *note inspect.signature(): 4c4. function or the *note
          inspect.Signature: 6ee. object directly.

        * The undocumented ‘Signature.from_builtin()’ and
          ‘Signature.from_function()’ methods, deprecated since Python
          3.5; use the *note Signature.from_callable(): b25. method
          instead.

     (Contributed by Hugo van Kemenade in bpo-45320(8).)

   * Removed the *note __class_getitem__(): b26. method from *note
     pathlib.PurePath: 8bb, 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: 10f.
     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.6.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: b2a.

   * *note open(): 333, *note io.open(): 930, *note codecs.open(): 334.
     and *note fileinput.FileInput: b23. 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: b2b. to these functions controls how
     universal newlines work.  (Contributed by Victor Stinner in
     bpo-37330(1).)

   * *note ast.AST: 2f8. node positions are now validated when provided
     to *note compile(): 1d3. and other related functions.  If invalid
     positions are detected, a *note ValueError: 15a. will be raised.
     (Contributed by Pablo Galindo in gh-93351(2))

   * Prohibited passing non-*note concurrent.futures.ThreadPoolExecutor:
     b2c. executors to *note asyncio.loop.set_default_executor(): b2d.
     following a deprecation in Python 3.8.  (Contributed by Illia
     Volochii in bpo-43234(3).)

   * *note calendar: 15.: The *note calendar.LocaleTextCalendar: b2e.
     and *note calendar.LocaleHTMLCalendar: b2f. classes now use *note
     locale.getlocale(): 23d, instead of using *note
     locale.getdefaultlocale(): 23e, 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(): b30. must be a
     sequence, and automatic conversion of *note set: 432.s to *note
     list: 4e0.s is no longer supported.  Also, if the sample size is
     larger than the population size, a *note ValueError: 15a. is
     raised.  (Contributed by Raymond Hettinger in bpo-40465(6).)

   * The 'random' optional parameter of *note random.shuffle(): b31. was
     removed.  It was previously an arbitrary random function to use for
     the shuffle; now, *note random.random(): b32. (its previous
     default) will always be used.

   * In *note re: c1. *note Regular expression syntax: b11, 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: c1. 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.6.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: f9. 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: f9. 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: b35, 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: 32e. 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: b36. 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.6.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.6.16.1 新しい機能
...................

   * Add a new *note PyType_GetName(): b3b. function to get type's short
     name.  (Contributed by Hai Shi in bpo-42035(1).)

   * Add a new *note PyType_GetQualName(): b3c. function to get type's
     qualified name.  (Contributed by Hai Shi in bpo-42035(2).)

   * Add new *note PyThreadState_EnterTracing(): b3d. and *note
     PyThreadState_LeaveTracing(): b3e. 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: 5b5. constant which bears the same
     value as *note PY_VERSION_HEX: 5b6.  (Contributed by Gabriele N.
     Tornetta in bpo-43931(4).)

   * *note Py_buffer: b3f. and APIs are now part of the limited API and
     the stable ABI:

        * *note PyObject_CheckBuffer(): 831.

        * *note PyObject_GetBuffer(): 832.

        * *note PyBuffer_GetPointer(): b40.

        * *note PyBuffer_SizeFromFormat(): b41.

        * *note PyBuffer_ToContiguous(): b42.

        * *note PyBuffer_FromContiguous(): b43.

        * *note PyObject_CopyData(): b44.

        * *note PyBuffer_IsContiguous(): b45.

        * *note PyBuffer_FillContiguousStrides(): b46.

        * *note PyBuffer_FillInfo(): b47.

        * *note PyBuffer_Release(): 833.

        * *note PyMemoryView_FromBuffer(): b48.

        * *note bf_getbuffer: b49. and *note bf_releasebuffer: b4a. type
          slots

     (Contributed by Christian Heimes in bpo-45459(5).)

   * Added the *note PyType_GetModuleByDef(): 82d. function, used to get
     the module in which a method was defined, in cases where this
     information is not available directly (via *note PyCMethod: b4b.).
     (Contributed by Petr Viktorin in bpo-46613(6).)

   * Add new functions to pack and unpack C double (serialize and
     deserialize): *note PyFloat_Pack2(): b4c, *note PyFloat_Pack4():
     b4d, *note PyFloat_Pack8(): b4e, *note PyFloat_Unpack2(): b4f,
     *note PyFloat_Unpack4(): b50. and *note PyFloat_Unpack8(): b51.
     (Contributed by Victor Stinner in bpo-46906(7).)

   * Add new functions to get frame object attributes: *note
     PyFrame_GetBuiltins(): b52, *note PyFrame_GetGenerator(): b53,
     *note PyFrame_GetGlobals(): b54, *note PyFrame_GetLasti(): b55.

   * Added two new functions to get and set the active exception
     instance: *note PyErr_GetHandledException(): b56. and *note
     PyErr_SetHandledException(): b57.  These are alternatives to *note
     PyErr_SetExcInfo(): b58. and *note PyErr_GetExcInfo(): b59. which
     work with the legacy 3-tuple representation of exceptions.
     (Contributed by Irit Katriel in bpo-46343(8).)

   * Added the *note PyConfig.safe_path: b5a. 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.6.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(): b58. 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(): b59. 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: b5c. 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(): b5d. 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: b5e. no longer has the ‘co_code’,
     ‘co_varnames’, ‘co_cellvars’ and ‘co_freevars’ fields.  Instead,
     use *note PyCode_GetCode(): b5f, *note PyCode_GetVarnames(): b60,
     *note PyCode_GetCellvars(): b61. and *note PyCode_GetFreevars():
     b62. 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(): b63. function now raises an error if a
     type is defined with the *note Py_TPFLAGS_HAVE_GC: 3a6. flag set
     but has no traverse function (*note PyTypeObject.tp_traverse:
     373.).  (Contributed by Victor Stinner in bpo-44263(11).)

   * Heap types with the *note Py_TPFLAGS_IMMUTABLETYPE: 602. flag can
     now inherit the PEP 590(12) vectorcall protocol.  Previously, this
     was only possible for *note static types: b64.  (Contributed by
     Erlend E. Aasland in bpo-43908(13))

   * Since *note Py_TYPE(): 5fc. 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(): b65. 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(): b66. 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(): b67. 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: b68.  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(): b69.

        * *note PyFrame_GetBack(): b6a.

        * *note PyFrame_GetBuiltins(): b52.

        * *note PyFrame_GetGenerator(): b53.

        * *note PyFrame_GetGlobals(): b54.

        * *note PyFrame_GetLasti(): b55.

        * *note PyFrame_GetLocals(): 854.

        * *note PyFrame_Type: b6b.

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

   * The *note PyFrameObject: b6d. structure members have been removed
     from the public C API.

     While the documentation notes that the *note PyFrameObject: b6d.
     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: b6d. fields:

        * ‘f_back’: use *note PyFrame_GetBack(): b6a.

        * ‘f_blockstack’: removed.

        * ‘f_builtins’: use *note PyFrame_GetBuiltins(): b52.

        * ‘f_code’: use *note PyFrame_GetCode(): b6e.

        * ‘f_gen’: use *note PyFrame_GetGenerator(): b53.

        * ‘f_globals’: use *note PyFrame_GetGlobals(): b54.

        * ‘f_iblock’: removed.

        * ‘f_lasti’: use *note PyFrame_GetLasti(): b55.  Code using
          ‘f_lasti’ with ‘PyCode_Addr2Line()’ should use *note
          PyFrame_GetLineNumber(): b6f. instead; it may be faster.

        * ‘f_lineno’: use *note PyFrame_GetLineNumber(): b6f.

        * ‘f_locals’: use *note PyFrame_GetLocals(): 854.

        * ‘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: b70. member must not be accessed directly,
     since its value is now also computed lazily.  The *note
     PyFrame_GetBack(): b6a. function must be called instead.

     Debuggers that accessed the *note f_locals: 298. directly 'must'
     call *note PyFrame_GetLocals(): 854. 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: b71. structure members:

        * ‘frame’: removed, use *note PyThreadState_GetFrame(): b72.
          (function added to Python 3.9 by bpo-40429(21)).  Warning: the
          function returns a *note strong reference: 7e0, need to call
          *note Py_XDECREF(): b73.

        * ‘tracing’: changed, use *note PyThreadState_EnterTracing():
          b3d. and *note PyThreadState_LeaveTracing(): b3e. (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: 9eb. field must now be
     set to 1 for initialization to use *note
     PyConfig.module_search_paths: 83a. to initialize *note sys.path:
     19f.  Otherwise, initialization will recalculate the path and
     replace any values added to ‘module_search_paths’.

   * *note PyConfig_Read(): b74. no longer calculates the initial search
     path, and will not fill any values into *note
     PyConfig.module_search_paths: 83a.  To calculate default paths and
     then modify them, finish initialization and use *note
     PySys_GetObject(): 35e. to retrieve *note sys.path: 19f. 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.6.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: 612. API of the *note Python
     Initialization Configuration: 83d. instead ( PEP 587(1)).
     (Contributed by Victor Stinner in gh-88279(2).)

   * Deprecate the ‘ob_shash’ member of the *note PyBytesObject: b76.
     Use *note PyObject_Hash(): 650. 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.6.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(): 64e.

   * ‘PyUnicode_WSTR_LENGTH()’

   * ‘_PyUnicode_AsUnicode()’

   * ‘PyUnicode_WCHAR_KIND’

   * *note PyUnicodeObject: b78.

   * ‘PyUnicode_InternImmortal()’


File: python.info,  Node: 削除<5>,  Prev: Pending Removal in Python 3 12<2>,  Up: C API の変更<5>

1.6.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: 853. is defined:

        * *note PyMarshal_WriteLongToFile(): b7a.

        * *note PyMarshal_WriteObjectToFile(): b7b.

        * *note PyMarshal_ReadObjectFromString(): b7c.

        * *note PyMarshal_WriteObjectToString(): b7d.

        * ‘Py_MARSHAL_VERSION’ マクロ

     These are not part of the *note limited API: b7e.

     (Contributed by Victor Stinner in bpo-45474(6).)

   * Exclude ‘PyWeakref_GET_OBJECT()’ 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: b7f. 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.6.17 Python 3.11.4での重要な変更点
------------------------------------

* Menu:

* tarfile: tarfile<4>.


File: python.info,  Node: tarfile<4>,  Up: Python 3 11 4での重要な変更点

1.6.17.1 tarfile
................

   * The extraction methods in *note tarfile: e7, and *note
     shutil.unpack_archive(): 887, 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: 888. for details.  In Python 3.12, use
     without the 'filter' argument will show a *note DeprecationWarning:
     2d4.  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.6.18 Python 3.11.5での重要な変更点
------------------------------------

* Menu:

* OpenSSL::


File: python.info,  Node: OpenSSL,  Up: Python 3 11 5での重要な変更点

1.6.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.7 What's New In Python 3.10
=============================


編集者: Pablo Galindo Salgado

この記事では Python 3.9 と比較した Python 3.10 の新機能を解説します。
Python 3.10 は2021年10月4日にリリースされました。全詳細については *note
変更履歴: 145. をご覧ください。

* 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.7.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.7.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.7.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.7.2.2 エラーメッセージの改善
..............................

* Menu:

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


File: python.info,  Node: SyntaxErrors,  Next: IndentationErrors,  Up: エラーメッセージの改善<4>

1.7.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.7.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.7.2.5 AttributeErrors
.......................

When printing *note AttributeError: 1b4, ‘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.7.2.6 NameErrors
..................

When printing *note NameError: 66c. 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.7.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: b91. attribute of frame objects will always contain
the expected line number.

The ‘codeobject.co_lnotab’ attribute of *note code objects: 6f1. 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(): 335. method
instead.


File: python.info,  Node: PEP 634 構造的パターンマッチ,  Next: Optional EncodingWarning and encoding="locale" option,  Prev: PEP 626 デバッグおよびその他のツール用の正確な行番号。,  Up: 新しい機能<8>

1.7.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.7.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.7.2.10 宣言的なアプローチ
...........................

読者の中には、C、Java、JavaScript（およびその他多くの言語）における
switch 文を通じて、対象（データオブジェクト）をリテラル（パターン）と照
合する単純な例として、パターンマッチングに馴染みがある方もいるでしょう。
多くの場合、 switch 文はオブジェクトや式を、リテラルを含む複数の case 文
と比較するために使用されます。

より強力なパターンマッチングの例は、Scala や Elixir のような言語で見られ
ます。構造的パターンマッチングでは、アプローチは「宣言的」であり、データ
が一致するための条件（パターン）を明示的に記述します。

これに対して、「命令的」なアプローチでは、入れ子になった if 文を用いて構
造的パターンマッチングと同様の処理を実現することも可能ですが、「宣言的」
な方法ほど明確ではありません。宣言的アプローチでは、一致のために満たすべ
き条件を明示的なパターンとして記述するため、より読みやすくなります。構造
的パターンマッチングは、最も単純な形では case 文で変数とリテラルを比較す
るものとして使用できますが、 Python における真の価値は、対象の型や構造を
扱える点にあります。


File: python.info,  Node: 単純パターン リテラルとのマッチ,  Next: リテラルと変数を組み合わせたパターン,  Prev: 宣言的なアプローチ,  Up: PEP 634 構造的パターンマッチ

1.7.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.7.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.7.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.7.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.7.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.7.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.7.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.7.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.7.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.7.2.20 Optional ‘EncodingWarning’ and ‘encoding="locale"’ option
..................................................................

The default encoding of *note TextIOWrapper: ba0. and *note open(): 333.
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: a81. is true and
locale-specific default encoding is used.

‘-X warn_default_encoding’ option and *note PYTHONWARNDEFAULTENCODING:
ba1. are added to enable the warning.

See *note Text Encoding: ba2. for more information.


File: python.info,  Node: 型ヒントに関連する新しい機能<3>,  Next: その他の言語変更<4>,  Prev: 新しい機能<8>,  Up: What's New In Python 3 10

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

This section covers major changes affecting PEP 484(1) type hints and
the *note typing: 10d. 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.7.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: 349, especially in type hints.

In previous versions of Python, to apply a type hint for functions
accepting arguments of multiple types, *note typing.Union: 349. 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(): 2fb. and *note issubclass(): 2fc.:

     >>> isinstance(1, int | str)
     True

See *note Union 型: ba6. 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.7.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: 10d. 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: 2a0.
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:
ba8.

See *note typing.Callable: ba9, *note typing.ParamSpec: 2a0, *note
typing.Concatenate: ba8, *note typing.ParamSpecArgs: baa, *note
typing.ParamSpecKwargs: bab, 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.7.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: 10d. module has a special value *note TypeAlias:
bad. 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.7.3.4 PEP 647: User-Defined Type Guards
.........................................

*note TypeGuard: 69e. has been added to the *note typing: 10d. 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.7.4 その他の言語変更
----------------------

   * The *note int: 32e. type has a new method *note int.bit_count():
     bb0, 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(): bb1, *note dict.values():
     bb2. and *note dict.items(): bb3. now all have a ‘mapping’
     attribute that gives a *note types.MappingProxyType: 194. object
     wrapping the original dictionary.  (Contributed by Dennis Sweeney
     in bpo-40890(2).)

   * PEP 618(3): The *note zip(): 446. 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: 1cd.s, *note Fraction: 1ce.s and other
     objects that can be converted to integers only with a loss (e.g.
     that have the *note __int__(): 443. method but do not have the
     *note __index__(): 444. method).  (Contributed by Serhiy Storchaka
     in bpo-37999(4).)

   * If *note object.__ipow__(): bb4. returns *note NotImplemented: 447,
     the operator will correctly fall back to *note object.__pow__():
     bb5. and *note object.__rpow__(): 449. 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(): bb6. and *note anext():
     bb7. have been added to provide asynchronous counterparts to *note
     iter(): bb8. and *note next(): bb9, respectively.  (Contributed by
     Joshua Bronson, Daniel Pope, and Justin Wang in bpo-31861(7).)

   * Static methods (*note @staticmethod: 66d.) and class methods (*note
     @classmethod: 6a0.) 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 アノテーションのベストプラクティス: bba.
     (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: 32f. type and *note
     decimal.Decimal: 1cd. 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: 189. (instead of a *note NameError: 66c.) will
     be raised when deleting the *note __debug__: bbb. constant.
     (Contributed by Donghee Na in bpo-45000(15).)

   * *note SyntaxError: 189. 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.7.5 新たなモジュール
----------------------

   * None.


File: python.info,  Node: 改良されたモジュール<4>,  Next: 最適化<5>,  Prev: 新たなモジュール<4>,  Up: What's New In Python 3 10

1.7.6 改良されたモジュール
--------------------------

* Menu:

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


File: python.info,  Node: asyncio<9>,  Next: argparse<5>,  Up: 改良されたモジュール<4>

1.7.6.1 asyncio
...............

Add missing *note connect_accepted_socket(): bbf. 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<5>,  Next: array<3>,  Prev: asyncio<9>,  Up: 改良されたモジュール<4>

1.7.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<3>,  Next: asynchat asyncore smtpd,  Prev: argparse<5>,  Up: 改良されたモジュール<4>

1.7.6.3 array
.............

The *note index(): bc2. method of *note array.array: 6cb. 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<4>,  Prev: array<3>,  Up: 改良されたモジュール<4>

1.7.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: 2d4. has now been added to all three of these
modules.


File: python.info,  Node: base64<4>,  Next: bdb<2>,  Prev: asynchat asyncore smtpd,  Up: 改良されたモジュール<4>

1.7.6.5 base64
..............

Add *note base64.b32hexencode(): 1f4. and *note base64.b32hexdecode():
1f5. to support the Base32 Encoding with Extended Hex Alphabet.


File: python.info,  Node: bdb<2>,  Next: bisect,  Prev: base64<4>,  Up: 改良されたモジュール<4>

1.7.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.7.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<2>,  Prev: bisect,  Up: 改良されたモジュール<4>

1.7.6.8 codecs
..............

Add a *note codecs.unregister(): bc8. 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<2>,  Next: contextlib<3>,  Prev: codecs,  Up: 改良されたモジュール<4>

1.7.6.9 collections.abc
.......................

The ‘__args__’ of the *note parameterized generic: aa4. for *note
collections.abc.Callable: bca. are now consistent with *note
typing.Callable: ba9.  ‘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: bcb. can now be
subclassed, and a subclass will be returned when subscripting the
‘collections.abc.Callable’ type.  Note that a *note TypeError: 29c. 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<3>,  Next: curses<2>,  Prev: collections abc<2>,  Up: 改良されたモジュール<4>

1.7.6.10 contextlib
...................

Add a *note contextlib.aclosing(): bcd. 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(): bce.  (Contributed by Tom Gringauz in
bpo-41543(2).)

Add *note AsyncContextDecorator: 218, 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<3>,  Up: 改良されたモジュール<4>

1.7.6.11 curses
...............

The extended color functions added in ncurses 6.1 will be used
transparently by *note curses.color_content(): bd0, *note
curses.init_color(): bd1, *note curses.init_pair(): bd2, and *note
curses.pair_content(): bd3.  A new function, *note
curses.has_extended_color_support(): bd4, 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: 2e.
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.7.6.12 データクラス
.....................

* Menu:

* __slots__::
* Keyword-only fields::


File: python.info,  Node: __slots__,  Next: Keyword-only fields,  Up: データクラス<2>

1.7.6.13 __slots__
..................

Added ‘slots’ parameter in *note dataclasses.dataclass(): 6ec.
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.7.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.7.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: cd,
*note subprocess: df. or *note sysconfig: e4.).  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.7.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.7.6.17 エンコーディング
.........................

*note encodings.normalize_encoding(): 31b. 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.7.6.18 enum
.............

*note Enum: a26. *note __repr__(): 1c7. now returns
‘enum_name.member_name’ and *note __str__(): a14. now returns
‘member_name’.  Stdlib enums available as module constants have a *note
repr(): 462. of ‘module_name.member_name’.  (Contributed by Ethan Furman
in bpo-40066(1).)

Add *note enum.StrEnum: a12. 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<3>,  Prev: enum<4>,  Up: 改良されたモジュール<4>

1.7.6.19 fileinput
..................

Add 'encoding' and 'errors' parameters in *note fileinput.input(): bdd.
and *note fileinput.FileInput: b23.  (Contributed by Inada Naoki in
bpo-43712(1).)

*note fileinput.hook_compressed(): bde. now returns *note TextIOWrapper:
ba0. 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<3>,  Next: gc<4>,  Prev: fileinput,  Up: 改良されたモジュール<4>

1.7.6.20 faulthandler
.....................

The *note faulthandler: 5b. 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<4>,  Next: glob<3>,  Prev: faulthandler<3>,  Up: 改良されたモジュール<4>

1.7.6.21 gc
...........

Add audit hooks for *note gc.get_objects(): be1, *note
gc.get_referrers(): be2. and *note gc.get_referents(): be3.
(Contributed by Pablo Galindo in bpo-43439(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43439


File: python.info,  Node: glob<3>,  Next: hashlib<4>,  Prev: gc<4>,  Up: 改良されたモジュール<4>

1.7.6.22 glob
.............

Add the 'root_dir' and 'dir_fd' parameters in *note glob(): 2df. and
*note iglob(): be5. 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<4>,  Next: hmac<2>,  Prev: glob<3>,  Up: 改良されたモジュール<4>

1.7.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(): 923. 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<4>,  Up: 改良されたモジュール<4>

1.7.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.7.6.25 IDLE と idelelib
.........................

Make IDLE invoke *note sys.excepthook(): be9. (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: bea. *note match: 1df, ‘case’,
and *note _: beb. 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<5>,  Prev: IDLE と idelelib<2>,  Up: 改良されたモジュール<4>

1.7.6.26 importlib.metadata
...........................

Feature parity with ‘importlib_metadata’ 4.6 (history(1)).

*note importlib.metadata entry points: 78e. now provide a nicer
experience for selecting entry points by group and name through a new
*note importlib.metadata.EntryPoints: 78e. class.  See the Compatibility
Note in the docs for more info on the deprecation and usage.

Added *note importlib.metadata.packages_distributions(): bed. for
resolving top-level Python modules and packages to their *note
importlib.metadata.Distribution: bee.

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

   (1) https://importlib-metadata.readthedocs.io/en/latest/history.html


File: python.info,  Node: inspect<5>,  Next: itertools<4>,  Prev: importlib metadata<2>,  Up: 改良されたモジュール<4>

1.7.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(): bf0, 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 アノテーションのベストプラクティス: bba.
Relatedly, *note inspect.signature(): 4c4, *note
inspect.Signature.from_callable(): b25, 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<5>,  Up: 改良されたモジュール<4>

1.7.6.28 itertools
..................

Add *note itertools.pairwise(): bf2.  (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<7>,  Prev: itertools<4>,  Up: 改良されたモジュール<4>

1.7.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<7>,  Next: os path<5>,  Prev: linecache<2>,  Up: 改良されたモジュール<4>

1.7.6.30 os
...........

Add *note os.cpu_count(): 6e7. support for VxWorks RTOS. (Contributed by
Peixing Xin in bpo-41440(1).)

Add a new function *note os.eventfd(): bf5. and related helpers to wrap
the ‘eventfd2’ syscall on Linux.  (Contributed by Christian Heimes in
bpo-41001(2).)

Add *note os.splice(): bf6. 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: bf7, *note O_FSYNC: bf8, *note O_SYMLINK: bf9. and
*note O_NOFOLLOW_ANY: bfa. 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<5>,  Next: pathlib<9>,  Prev: os<7>,  Up: 改良されたモジュール<4>

1.7.6.31 os.path
................

*note os.path.realpath(): 24d. now accepts a 'strict' keyword-only
argument.  When set to ‘True’, *note OSError: 543. 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<9>,  Next: プラットフォーム<3>,  Prev: os path<5>,  Up: 改良されたモジュール<4>

1.7.6.32 pathlib
................

Add slice support to *note PurePath.parents: bfd.  (Contributed by
Joshua Cannon in bpo-35498(1).)

Add negative indexing support to *note PurePath.parents: bfd.
(Contributed by Yaroslav Pankovych in bpo-21041(2).)

Add *note Path.hardlink_to: bfe. method that supersedes ‘link_to()’.
The new method has the same argument order as *note symlink_to(): bff.
(Contributed by Barney Gale in bpo-39950(3).)

*note pathlib.Path.stat(): c00. and *note chmod(): c01. 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<2>,  Prev: pathlib<9>,  Up: 改良されたモジュール<4>

1.7.6.33 プラットフォーム
.........................

Add *note platform.freedesktop_os_release(): c03. 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<2>,  Next: py_compile,  Prev: プラットフォーム<3>,  Up: 改良されたモジュール<4>

1.7.6.34 pprint
...............

*note pprint.pprint(): c05. 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: 6ec.
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<2>,  Up: 改良されたモジュール<4>

1.7.6.35 py_compile
...................

Add ‘--quiet’ option to command-line interface of *note py_compile: bb.
(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<2>,  Prev: py_compile,  Up: 改良されたモジュール<4>

1.7.6.36 pyclbr
...............

Add an ‘end_lineno’ attribute to the ‘Function’ and ‘Class’ objects in
the tree returned by *note pyclbr.readmodule(): c08. and *note
pyclbr.readmodule_ex(): c09.  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<2>,  Next: statistics<3>,  Prev: pyclbr,  Up: 改良されたモジュール<4>

1.7.6.37 shelve
...............

The *note shelve: cb. module now uses *note pickle.DEFAULT_PROTOCOL:
c0b. 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<2>,  Up: 改良されたモジュール<4>

1.7.6.38 statistics
...................

Add *note covariance(): c0d, Pearson's *note correlation(): 8d1, and
simple *note linear_regression(): c0e. 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<4>,  Prev: statistics<3>,  Up: 改良されたモジュール<4>

1.7.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<4>,  Next: ssl<5>,  Prev: site<2>,  Up: 改良されたモジュール<4>

1.7.6.40 socket
...............

The exception *note socket.timeout: c11. is now an alias of *note
TimeoutError: c12.  (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<5>,  Next: sqlite3<7>,  Prev: socket<4>,  Up: 改良されたモジュール<4>

1.7.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: c14.  (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: 2d4.  *note ssl.SSLContext.options: c15. has
*note OP_NO_SSLv2: c16. and *note OP_NO_SSLv3: c17. set by default and
therefore cannot warn about setting the flag again.  The *note
deprecation section: c18. 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: 33e. 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():
c19. 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: 696. 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<7>,  Next: sys<7>,  Prev: ssl<5>,  Up: 改良されたモジュール<4>

1.7.6.42 sqlite3
................

Add audit events for *note connect(): 3e7, *note
enable_load_extension(): c1b, and *note load_extension(): 8cd.
(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<7>,  Next: _thread,  Prev: sqlite3<7>,  Up: 改良されたモジュール<4>

1.7.6.43 sys
............

Add *note sys.orig_argv: c1d. 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: c1e, 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<6>,  Prev: sys<7>,  Up: 改良されたモジュール<4>

1.7.6.44 _thread
................

*note _thread.interrupt_main(): c20. now takes an optional signal number
to simulate (the default is still *note signal.SIGINT: 4e6.).
(Contributed by Antoine Pitrou in bpo-43356(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43356


File: python.info,  Node: threading<6>,  Next: traceback<3>,  Prev: _thread,  Up: 改良されたモジュール<4>

1.7.6.45 threading
..................

Add *note threading.gettrace(): c22. and *note threading.getprofile():
c23. to retrieve the functions set by *note threading.settrace(): c24.
and *note threading.setprofile(): c25. respectively.  (Contributed by
Mario Corchero in bpo-42251(1).)

Add *note threading.__excepthook__: c26. to allow retrieving the
original value of *note threading.excepthook(): c27. 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<6>,  Prev: threading<6>,  Up: 改良されたモジュール<4>

1.7.6.46 traceback
..................

The *note format_exception(): c29, *note format_exception_only(): c2a,
and *note print_exception(): c2b. 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<6>,  Next: typing<8>,  Prev: traceback<3>,  Up: 改良されたモジュール<4>

1.7.6.47 types
..............

Reintroduce the *note types.EllipsisType: c2d, *note types.NoneType:
c2e. and *note types.NotImplementedType: c2f. 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<8>,  Next: unittest<7>,  Prev: types<6>,  Up: 改良されたモジュール<4>

1.7.6.48 typing
...............

For major changes, see *note 型ヒントに関連する新しい機能: ba3.

The behavior of *note typing.Literal: c31. 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: 29c. exception
     during equality comparisons if any of their parameters are not
     *note hashable: 18e.  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(): c32. to introspect if an
annotation is a *note typing.TypedDict: 29b.  (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(): 867.  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: 2d4.  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: 10d. 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<7>,  Next: urllib parse<2>,  Prev: typing<8>,  Up: 改良されたモジュール<4>

1.7.6.49 unittest
.................

Add new method *note assertNoLogs(): c34. to complement the existing
*note assertLogs(): 2aa.  (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<2>,  Next: xml<3>,  Prev: unittest<7>,  Up: 改良されたモジュール<4>

1.7.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(): 590. and
*note urllib.parse.parse_qsl(): 58f.  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: 113.
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<3>,  Next: zipimport<4>,  Prev: urllib parse<2>,  Up: 改良されたモジュール<4>

1.7.6.51 xml
............

Add a *note LexicalHandler: c37. class to the *note xml.sax.handler:
133. 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<4>,  Prev: xml<3>,  Up: 改良されたモジュール<4>

1.7.6.52 zipimport
..................

Add methods related to PEP 451(1): *note find_spec(): c39, *note
zipimport.zipimporter.create_module(): c3a, and *note
zipimport.zipimporter.exec_module(): 2f5.  (Contributed by Brett Cannon
in bpo-42131(2).)

Add *note invalidate_caches(): c3b. 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.7.7 最適化
------------

   * Constructors *note str(): 1ea, *note bytes(): 1d2. and *note
     bytearray(): 1d1. are now faster (around 30-40% for small objects).
     (Contributed by Serhiy Storchaka in bpo-41334(1).)

   * The *note runpy: c6. 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: c3d. 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: c3e. 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: 8d. / *note zlib: 13c. 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(): 445, *note filter():
     c3f, *note reversed(): c40, *note bool(): 5f6. and *note float():
     32f.  (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: c41. 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: 6a. and *note lzma: 8d. 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.7.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: 327, *note else: 328, *note for: 329, *note if: 32a, *note in:
     32b, *note is: 32c. and *note or: 32d.  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(): c43.),
     ‘importlib.abc.Loader.load_module’ (superseded by *note
     exec_module(): c44.), ‘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: 7a.).  *note ImportWarning: 90c.
     and/or *note DeprecationWarning: 2d4. 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: b17. section for
     more information.

   * Non-integer arguments to *note random.randrange(): c45. are
     deprecated.  The *note ValueError: 15a. is deprecated in favor of a
     *note TypeError: 29c.  (Contributed by Serhiy Storchaka and Raymond
     Hettinger in bpo-37319(2).)

   * The various ‘load_module()’ methods of *note importlib: 7a. have
     been documented as deprecated since Python 3.6, but will now also
     trigger a *note DeprecationWarning: 2d4.  Use *note exec_module():
     c44. instead.  (Contributed by Brett Cannon in bpo-26131(3).)

   * ‘zimport.zipimporter.load_module()’ has been deprecated in
     preference for *note exec_module(): 2f5.  (Contributed by Brett
     Cannon in bpo-26131(4).)

   * The use of ‘importlib.abc.Loader.load_module’ by the import system
     now triggers an *note ImportWarning: 90c. as *note exec_module():
     c44. 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: 90c. as *note
     importlib.abc.MetaPathFinder.find_spec(): c43. and *note
     importlib.abc.PathEntryFinder.find_spec(): c46. are preferred,
     respectively.  You can use *note importlib.util.spec_from_loader():
     c47. 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: 90c. as *note
     importlib.abc.PathEntryFinder.find_spec(): c46. is preferred.  You
     can use *note importlib.util.spec_from_loader(): c47. 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: 2d4. 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: c48.
     and *note importlib.abc.PathEntryFinder: c49. 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: 2d4. 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: 1ea.  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():
          346.

        * ‘threading.activeCount’ => *note threading.active_count():
          347.

        * ‘threading.Condition.notifyAll’ => *note
          threading.Condition.notify_all(): 340.

        * ‘threading.Event.isSet’ => *note threading.Event.is_set():
          341.

        * ‘threading.Thread.setName’ => *note threading.Thread.name:
          345.

        * ‘threading.thread.getName’ => *note threading.Thread.name:
          345.

        * ‘threading.Thread.isDaemon’ => *note threading.Thread.daemon:
          343.

        * ‘threading.Thread.setDaemon’ => *note threading.Thread.daemon:
          343.

     (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(): bfe. 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: d8. 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: c4a. and *note maximum_version: c4b.

        * ‘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: c4c. and *note PROTOCOL_TLS_SERVER: c4d.

        * ‘wrap_socket()’ is replaced by *note
          ssl.SSLContext.wrap_socket(): 938.

        * ‘match_hostname()’

        * ‘RAND_pseudo_bytes()’, ‘RAND_egd()’

        * NPN features like *note ssl.SSLSocket.selected_npn_protocol():
          c4e. and *note ssl.SSLContext.set_npn_protocols(): 33f. 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: 3e3.  (Contributed
     by Victor Stinner in bpo-44584(19).)

   * Importing from the ‘typing.io’ and ‘typing.re’ submodules will now
     emit *note DeprecationWarning: 2d4.  These submodules will be
     removed in a future version of Python.  Anything belonging to these
     submodules should be imported directly from *note typing: 10d.
     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.7.9 削除
----------

   * Removed special methods ‘__int__’, ‘__float__’, ‘__floordiv__’,
     ‘__mod__’, ‘__divmod__’, ‘__rfloordiv__’, ‘__rmod__’ and
     ‘__rdivmod__’ of the *note complex: 330. class.  They always raised
     a *note TypeError: 29c.  (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: c51. 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 コレクション抽象基底クラス: c52.
     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: c53. 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 の変更: c54. 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.7.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.7.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.7.10.2 Python API の変更
..........................

   * The 'etype' parameters of the *note format_exception(): c29, *note
     format_exception_only(): c2a, and *note print_exception(): c2b.
     functions in the *note traceback: 107. 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(): c58. 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: bca. generic now flattens type
     parameters, similar to what *note typing.Callable: ba9. 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(): 31d. or ‘__args__’ need to account for this
     change.  Furthermore, *note TypeError: 29c. 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(): c59. and *note socket.ntohs(): c5a. now raise
     *note OverflowError: c5b. instead of *note DeprecationWarning: 2d4.
     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: c53. 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(): c5c. instead.

     (Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and
     Kyle Stanley in bpo-42392(5).)

   * The *note types.FunctionType: c5d. 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(): 18f. and *note exec():
     190. 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.7.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(): c5f.  The resulting code
     object can then be evaluated using, for example, *note
     PyEval_EvalCode(): c60.

     Specifically:

        * A call to ‘PyParser_SimpleParseStringFlags’ followed by
          ‘PyNode_Compile’ can be replaced by calling *note
          Py_CompileString(): c5f.

        * 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(): c5f.

        * 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: 82. module with *note
          PyImport_ImportModule(): 3ab, *note PyObject_CallMethod():
          3be, *note PyBytes_AsString(): c61. and *note
          Py_CompileString(): c5f, 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: c62. 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(): c63. for example).
          Notice as well that the ‘f_lasti’ member of ‘FrameObject’
          objects is not considered stable: please use *note
          PyFrame_GetLineNumber(): b6f. 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.7.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.7.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: d7. 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: c66. 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: c67. to the
     ‘./configure’ script.  If specified, the *note ensurepip: 58.
     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: c68. 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: c69. 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.7.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.7.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 and ABI
Stability: 961. 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.7.13.2 新しい機能
...................

   * The result of *note PyNumber_Index(): c6d. now always has exact
     type *note int: 32e.  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: c6e. member to the *note PyConfig: 612.
     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(): c6f. and *note
     PyDateTime_TIME_GET_TZINFO(): c70. macros have been added for
     accessing the ‘tzinfo’ attributes of *note datetime.datetime: 6ed.
     and *note datetime.time: 495. objects.  (Contributed by Zackery
     Spytz in bpo-30155(3).)

   * Add a *note PyCodec_Unregister(): c71. function to unregister a
     codec search function.  (Contributed by Hai Shi in bpo-41842(4).)

   * The *note PyIter_Send(): c72. 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(): c73. to the limited C API.
     (Contributed by Alex Gaynor in bpo-41784(6).)

   * Add *note PyModule_AddObjectRef(): 806. function: similar to *note
     PyModule_AddObject(): 807. but don't steal a reference to the value
     on success.  (Contributed by Victor Stinner in bpo-1635741(7).)

   * Add *note Py_NewRef(): c74. and *note Py_XNewRef(): c75. 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(): 397. and *note
     PyType_FromModuleAndSpec(): 398. functions now accept a single
     class as the 'bases' argument.  (Contributed by Serhiy Storchaka in
     bpo-42423(9).)

   * The *note PyType_FromModuleAndSpec(): 398. function now accepts
     NULL ‘tp_doc’ slot.  (Contributed by Hai Shi in bpo-41832(10).)

   * The *note PyType_GetSlot(): c76. function can accept *note static
     types: b64.  (Contributed by Hai Shi and Petr Viktorin in
     bpo-41073(11).)

   * Add a new *note PySet_CheckExact(): c77. function to the C-API to
     check if an object is an instance of *note set: 432. but not an
     instance of a subtype.  (Contributed by Pablo Galindo in
     bpo-43277(12).)

   * Add *note PyErr_SetInterruptEx(): c78. 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: 3e3. (if the ‘Py_DEBUG’ macro is defined).  In the
     limited C API, the *note Py_INCREF(): 979. and *note Py_DECREF():
     97a. functions are now implemented as opaque function calls, rather
     than accessing directly the *note PyObject.ob_refcnt: c79. 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: 1a6.
     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: 82e. special build (‘Py_TRACE_REFS’ macro).
     (Contributed by Victor Stinner in bpo-43688(15).)

   * Add the *note Py_Is(x, y): c7a. 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(): c7b, *note Py_IsTrue(): c7c, *note Py_IsFalse():
     c7d. 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(): c7e, *note PyGC_Disable(): c7f, *note
     PyGC_IsEnabled(): c80.  These functions allow to activate,
     deactivate and query the state of the garbage collector from C code
     without having to import the *note gc: 63. module.

   * Add a new *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 989. type flag
     to disallow creating type instances.  (Contributed by Victor
     Stinner in bpo-43916(17).)

   * Add a new *note Py_TPFLAGS_IMMUTABLETYPE: 602. 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.7.13.3 Porting to Python 3.10
...............................

   * The ‘PY_SSIZE_T_CLEAN’ macro must now be defined to use *note
     PyArg_ParseTuple(): 3b9. and *note Py_BuildValue(): 5f5. formats
     which use ‘#’: ‘es#’, ‘et#’, ‘s#’, ‘u#’, ‘y#’, ‘z#’, ‘U#’ and ‘Z#’.
     See *note 引数の解釈と値の構築: 608. and PEP 353(1).  (Contributed
     by Victor Stinner in bpo-40943(2).)

   * Since *note Py_REFCNT(): 552. 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(): c82.
     (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(): 822. without *note GIL: 418. 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(): c83. 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).)

   * ‘Py_GetPath()’, ‘Py_GetPrefix()’, ‘Py_GetExecPrefix()’,
     ‘Py_GetProgramFullPath()’, ‘Py_GetPythonHome()’ and
     ‘Py_GetProgramName()’ functions now return ‘NULL’ if called before
     *note Py_Initialize(): 67a. (before Python is initialized).  Use
     the new *note Python 初期化設定: 83d. API to get the *note Python
     Path Configuration: c84.  (Contributed by Victor Stinner in
     bpo-42260(7).)

   * *note PyList_SET_ITEM(): 828, *note PyTuple_SET_ITEM(): 827. and
     *note PyCell_SET(): c85. 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 インクルードファイル:
     b68.  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: 602. type flag to create
     immutable type objects.  Do not rely on *note Py_TPFLAGS_HEAPTYPE:
     c86. 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.7.13.4 非推奨
...............

   * The ‘PyUnicode_InternImmortal()’ function is now deprecated and
     will be removed in Python 3.12: use *note
     PyUnicode_InternInPlace(): c88. 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.7.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(): c8a. or
          *note PyUnicode_GET_LENGTH: c8b.

        * ‘Py_UNICODE_strcat’: use *note PyUnicode_CopyCharacters():
          c8c. or *note PyUnicode_FromFormat(): 824.

        * ‘Py_UNICODE_strcpy’, ‘Py_UNICODE_strncpy’: use *note
          PyUnicode_CopyCharacters(): c8c. or *note
          PyUnicode_Substring(): c8d.

        * ‘Py_UNICODE_strcmp’: use *note PyUnicode_Compare(): c8e.

        * ‘Py_UNICODE_strncmp’: use *note PyUnicode_Tailmatch(): c8f.

        * ‘Py_UNICODE_strchr’, ‘Py_UNICODE_strrchr’: use *note
          PyUnicode_FindChar(): c90.

   * 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(): c91.  (Contributed by Inada Naoki in
     bpo-41103(4).)

   * Removed ‘PyUnicode_AsUnicodeCopy()’.  Please use *note
     PyUnicode_AsUCS4Copy(): c92. or *note PyUnicode_AsWideCharString():
     c93. (Contributed by Inada Naoki in bpo-41103(5).)

   * Removed ‘_Py_CheckRecursionLimit’ variable: it has been replaced by
     ‘ceval.recursion_limit’ of the *note PyInterpreterState: c94.
     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: c94. 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: c95.  (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: e1. module instead.  (Contributed by
     Victor Stinner in bpo-43244(11).)

   * Remove *note PyOS_ReadlineFunctionPointer(): 98c. 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.7.14 Notable security feature in 3.10.7
-----------------------------------------

Converting between *note int: 32e. and *note str: 1ea. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 15a. 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: e2. APIs.  See the *note
integer string conversion length limitation: 9f1. 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.7.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.7.16 Notable changes in 3.10.12
---------------------------------

* Menu:

* tarfile: tarfile<5>.


File: python.info,  Node: tarfile<5>,  Up: Notable changes in 3 10 12

1.7.16.1 tarfile
................

   * The extraction methods in *note tarfile: e7, and *note
     shutil.unpack_archive(): 887, 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: 888. for details.  In Python 3.12, use
     without the 'filter' argument will show a *note DeprecationWarning:
     2d4.  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.8 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: 145.

参考
....

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.8.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(): 273. が追加され、レースやシグナルを使わずに
     プロセス管理ができるようになりました。

インタプリタの改善:

   * 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: 91, *note operator: a3, *note resource: c4, *note time: f7,
     ‘_weakref’) now use multiphase initialization as defined by PEP
     489;

   * a number of standard library modules (‘audioop’, *note ast: 9,
     *note grp: 69, ‘_hashlib’, *note pwd: ba, ‘_posixsubprocess’, *note
     random: c0, *note select: c9, *note struct: de, *note termios: ea,
     *note zlib: 13c.) are now using the stable ABI defined by PEP 384.

新たなライブラリモジュール:

   * PEP 615(9)、IANAのTime Zone Databaseが標準ライブラリの *note
     zoneinfo: 13d. モジュールで提供されるようになりました。

   * an implementation of a topological sort of a graph is now provided
     in the new *note graphlib: 68. 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.8.2 コード中の非推奨警告(DeprecationWarning)をチェックして下さい
------------------------------------------------------------------

Python 2.7がまだサポートされていた期間、Python 3の多くの機能はPython
2.7との後方互換性を保っていました。Python 2サポートの終了とともに、この
後方互換性レイヤは除去されたか、間もなく除去されます。ここ数年で、それら
の多くは警告 *note DeprecationWarning: 2d4. を出すようになりました。例え
ば、2012年にリリースされたPython 3.3以降、‘collections.abc.Mapping’ の代
りに ‘collections.Mapping’ を使うと、警告 ‘DeprecationWarning’ が出ます
。

警告 *note DeprecationWarning: 2d4. および *note
PendingDeprecationWarning: c9f. を確認するために、 *note -W: 1cb.
‘default’ コマンドラインオプションを付けて、あなたのアプリケーションをテ
ストして下さい。あるいは、‘-W’ ‘error’ で警告をエラーとして扱うこともで
きます。サードパーティによるコードの警告を無視するには、*note Warnings
Filter: 1d7. を使うことができます。

Python 3.9は、Python 2後方互換性レイヤを提供する最後のバージョンです。こ
のレイヤは、Pythonプロジェクトの保守管理者に、Python 2サポートを止めて
Python 3.9サポートを追加する時間的な余裕を与えるためのものです。

Aliases to *note Abstract Base Classes: c52. in the *note collections:
1e. module, like ‘collections.Mapping’ alias to *note
collections.abc.Mapping: ca0, are kept for one last release for backward
compatibility.  They will be removed from Python 3.10.

より一般的には、あなたのコードが次のバージョンのPythonと互換性を保てるよ
う、*note Python Development Mode: 713. でテストするようにしてください。

注釈: Pythonのこのバージョンで、既存の多くの非推奨機能が削除されました。
詳しくは *note 削除: ca1. を見て下さい。


File: python.info,  Node: 新しい機能<10>,  Next: その他の言語変更<5>,  Prev: コード中の非推奨警告 DeprecationWarning をチェックして下さい,  Up: What's New In Python 3 9

1.8.3 新しい機能
----------------

* Menu:

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


File: python.info,  Node: 辞書のマージと更新演算子,  Next: prefixとsuffixを削除する新しい文字列メソッド,  Up: 新しい機能<10>

1.8.3.1 辞書のマージと更新演算子
................................

組み込みの *note dict: 193. クラスにマージ(‘|’)と更新(‘|=’)演算子が追加
されました。この演算子は、辞書をマージする既存の方法 ‘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.8.3.2 prefixとsuffixを削除する新しい文字列メソッド
....................................................

文字列から不要な prefix や suffix を簡単に削除する *note
str.removeprefix(prefix): ca5. と *note str.removesuffix(suffix): ca6. が
追加されました。 ‘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.8.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.8.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.8.4 その他の言語変更
----------------------

   * *note __import__(): caa. now raises *note ImportError: 1c8. instead
     of *note ValueError: 15a, 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(): a07.  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: 713. and in *note debug
     build: 3e3, the 'encoding' and 'errors' arguments are now checked
     for string encoding and decoding operations.  Examples: *note
     open(): 333, *note str.encode(): cab. and *note bytes.decode():
     cac.

     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: 1d2. and *note
     bytearray: 1d1. objects.  (Contributed by Serhiy Storchaka in
     bpo-28029(4).)

   * Any valid expression can now be used as a *note decorator: b1d.
     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: 10d. module.  Docstrings are
     now shown for all special forms and special generic aliases (like
     ‘Union’ and ‘List’).  Using *note help(): cad. 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(): cae. / *note asend(): caf. /
     *note athrow(): 90b. 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: 32b. operator and functions
     *note contains(): cb0, *note indexOf(): cb1. and *note countOf():
     cb2. 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.8.5 新たなモジュール
----------------------

* Menu:

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


File: python.info,  Node: zoneinfo,  Next: graphlib<2>,  Up: 新たなモジュール<5>

1.8.5.1 zoneinfo
................

*note zoneinfo: 13d. モジュールにより標準ライブラリにIANAのタイムゾーン
データベースへのサポートを導入されます。*note zoneinfo.ZoneInfo: cb5. と
いう、システムのタイムゾーンデータを背景とした具体的な *note
datetime.tzinfo: 9dd. の実装が追加されます。

以下はプログラム例です:

     >>> 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.8.5.2 graphlib
................

A new module, *note graphlib: 68, was added that contains the *note
graphlib.TopologicalSorter: cb7. 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.8.6 改良されたモジュール
--------------------------

* Menu:

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


File: python.info,  Node: ast<6>,  Next: asyncio<10>,  Up: 改良されたモジュール<5>

1.8.6.1 ast
...........

Added the 'indent' option to *note dump(): 1ec. which allows it to
produce a multiline indented output.  (Contributed by Serhiy Storchaka
in bpo-37995(1).)

Added *note ast.unparse(): cba. as a function in the *note ast: 9.
module that can be used to unparse an *note ast.AST: 2f8. 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<10>,  Next: compileall<2>,  Prev: ast<6>,  Up: 改良されたモジュール<5>

1.8.6.2 asyncio
...............

セキュリティ上の重大な懸念により、*note
asyncio.loop.create_datagram_endpoint(): b1f. での 'reuse_address' 引数
は無効になりました。これはソケットオプション ‘SO_REUSEADDR'’ のUDP にお
ける挙動が原因です。詳しくは、‘loop.create_datagram_endpoint()’ のドキュ
メントを参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov
による貢献 bpo-37228(1))

Added a new *note coroutine: 8a7. *note shutdown_default_executor():
cbc. that schedules a shutdown for the default executor that waits on
the *note ThreadPoolExecutor: b2c. to finish closing.  Also, *note
asyncio.run(): 314. 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: 8a7. *note asyncio.to_thread(): cbd.  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(): cbe. 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():
9fb. 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: 29c. when calling
incompatible methods with an *note ssl.SSLSocket: cbf. 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<4>,  Prev: asyncio<10>,  Up: 改良されたモジュール<5>

1.8.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<4>,  Next: curses<3>,  Prev: compileall<2>,  Up: 改良されたモジュール<5>

1.8.6.4 concurrent.futures
..........................

Added a new 'cancel_futures' parameter to *note
concurrent.futures.Executor.shutdown(): cc2. 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: b2c. and *note
ProcessPoolExecutor: 211.  This improves compatibility with
subinterpreters and predictability in their shutdown processes.
(Contributed by Kyle Stanley in bpo-39812(2).)

Workers in *note ProcessPoolExecutor: 211. 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<4>,  Prev: concurrent futures<4>,  Up: 改良されたモジュール<5>

1.8.6.5 curses
..............

*note curses.get_escdelay(): cc4, *note curses.set_escdelay(): cc5,
*note curses.get_tabsize(): cc6, *note curses.set_tabsize(): cc7. の関数
が追加されました。(Anthony Sottileによる bpo-38312(1) でのコントリビュー
ト。)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38312


File: python.info,  Node: datetime<4>,  Next: distutils<3>,  Prev: curses<3>,  Up: 改良されたモジュール<5>

1.8.6.6 datetime
................

The *note isocalendar(): cc9. of *note datetime.date: 494. and *note
isocalendar(): cca. of *note datetime.datetime: 6ed. methods now returns
a *note namedtuple(): 1da. instead of a *note tuple: 1d9.  (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<4>,  Up: 改良されたモジュール<5>

1.8.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.8.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<5>,  Prev: fcntl<2>,  Up: 改良されたモジュール<5>

1.8.6.9 ftplib
..............

*note FTP: cce. and *note FTP_TLS: ccf. now raise a *note ValueError:
15a. 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<5>,  Next: hashlib<5>,  Prev: ftplib<2>,  Up: 改良されたモジュール<5>

1.8.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(): cd1. 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<5>,  Next: http<2>,  Prev: gc<5>,  Up: 改良されたモジュール<5>

1.8.6.11 hashlib
................

The *note hashlib: 6b. 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<5>,  Up: 改良されたモジュール<5>

1.8.6.12 http
.............

HTTP status codes ‘103 EARLY_HINTS’, ‘418 IM_A_TEAPOT’ and ‘425
TOO_EARLY’ are added to *note http.HTTPStatus: cd4.  (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.8.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(): be9. (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.8.6.14 imaplib
................

*note IMAP4: 322. and *note IMAP4_SSL: cd7. now have an optional
'timeout' parameter for their constructors.  Also, the *note open():
cd8. method now has an optional 'timeout' parameter with this change.
The overridden methods of ‘IMAP4_SSL’ and *note IMAP4_stream: cd9. were
applied to this change.  (Contributed by Donghee Na in bpo-38615(1).)

*note imaplib.IMAP4.unselect(): cda. 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():
cdb, 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<6>,  Prev: imaplib<2>,  Up: 改良されたモジュール<5>

1.8.6.15 importlib
..................

To improve consistency with import statements, *note
importlib.util.resolve_name(): cdd. now raises *note ImportError: 1c8.
instead of *note ValueError: 15a. 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(): 2e2. 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<6>,  Next: ipaddress<2>,  Prev: importlib<3>,  Up: 改良されたモジュール<5>

1.8.6.16 inspect
................

*note inspect.BoundArguments.arguments: cdf. は ‘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<6>,  Prev: inspect<6>,  Up: 改良されたモジュール<5>

1.8.6.17 ipaddress
..................

*note ipaddress: 83. now supports IPv6 Scoped Addresses (IPv6 address
with suffix ‘%<scope_id>’).

Scoped IPv6 addresses can be parsed using *note ipaddress.IPv6Address:
717.  If present, scope zone ID is available through the *note scope_id:
ce1. attribute.  (Contributed by Oleksandr Pavliuk in bpo-34788(1).)

Starting with Python 3.9.5 the *note ipaddress: 83. 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<6>,  Next: multiprocessing<3>,  Prev: ipaddress<2>,  Up: 改良されたモジュール<5>

1.8.6.18 math
.............

Expanded the *note math.gcd(): ce3. function to handle multiple
arguments.  Formerly, it only supported two arguments.  (Contributed by
Serhiy Storchaka in bpo-39648(1).)

Added *note math.lcm(): ce4.: 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(): 8ae.: return the next floating-point value
after 'x' towards 'y'.  (Contributed by Victor Stinner in bpo-39288(4).)

Added *note math.ulp(): ce5.: 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<6>,  Up: 改良されたモジュール<5>

1.8.6.19 multiprocessing
........................

The *note multiprocessing.SimpleQueue: ce7. class has a new *note
close(): ce8. 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<8>,  Prev: multiprocessing<3>,  Up: 改良されたモジュール<5>

1.8.6.20 nntplib
................

‘NNTP’ and ‘NNTP_SSL’ now raise a *note ValueError: 15a. 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<8>,  Next: pathlib<10>,  Prev: nntplib,  Up: 改良されたモジュール<5>

1.8.6.21 os
...........

Added *note CLD_KILLED: ceb. and *note CLD_STOPPED: cec. for ‘si_code’.
(Contributed by Donghee Na in bpo-38493(1).)

Exposed the Linux-specific *note os.pidfd_open(): 273. (bpo-38692(2))
and *note os.P_PIDFD: ced. (bpo-38713(3)) for process management with
file descriptors.

*note os.unsetenv(): 4ef. 関数が、Windowsでも使えるようになりました。
(bpo-39413(4) におけるVictor Stinnerの貢献による)

*note os.putenv(): 4ee. と *note os.unsetenv(): 4ef. 関数が、常に利用で
きるようになりました。(bpo-39395(5) におけるVictor Stinnerの貢献による)

Added *note os.waitstatus_to_exitcode(): cee. 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<10>,  Next: pdb<6>,  Prev: os<8>,  Up: 改良されたモジュール<5>

1.8.6.22 pathlib
................

Added *note pathlib.Path.readlink(): cf0. which acts similarly to *note
os.readlink(): cf1.  (Contributed by Girts Folkmanis in bpo-30618(1))

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30618


File: python.info,  Node: pdb<6>,  Next: poplib,  Prev: pathlib<10>,  Up: 改良されたモジュール<5>

1.8.6.23 pdb
............

On Windows now *note Pdb: 502. 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<3>,  Prev: pdb<6>,  Up: 改良されたモジュール<5>

1.8.6.24 poplib
...............

*note POP3: cf4. and *note POP3_SSL: cf5. now raise a *note ValueError:
15a. 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<3>,  Next: pydoc<2>,  Prev: poplib,  Up: 改良されたモジュール<5>

1.8.6.25 pprint
...............

*note pprint: b3. can now pretty-print *note types.SimpleNamespace: 6f0.
(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<3>,  Up: 改良されたモジュール<5>

1.8.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__: cf8.
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.8.6.27 random
...............

Added a new *note random.Random.randbytes(): cfa. 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.8.6.28 signal
...............

Exposed the Linux-specific *note signal.pidfd_send_signal(): cfc. 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<5>,  Prev: signal,  Up: 改良されたモジュール<5>

1.8.6.29 smtplib
................

*note SMTP: cfe. and *note SMTP_SSL: cff. now raise a *note ValueError:
15a. 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: d00. 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<5>,  Next: time<3>,  Prev: smtplib,  Up: 改良されたモジュール<5>

1.8.6.30 socket
...............

The *note socket: d4. module now exports the *note CAN_RAW_JOIN_FILTERS:
d02. 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: d03. protocol on
platforms that support it.  (Contributed by Karl Ding in bpo-40291(2).)

The socket module now has the *note socket.send_fds(): d04. and *note
socket.recv_fds(): d05. 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<8>,  Prev: socket<5>,  Up: 改良されたモジュール<5>

1.8.6.31 time
.............

On AIX, *note thread_time(): d07. 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<8>,  Next: tracemalloc,  Prev: time<3>,  Up: 改良されたモジュール<5>

1.8.6.32 sys
............

Added a new *note sys.platlibdir: 2b4. 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: d09. 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<9>,  Prev: sys<8>,  Up: 改良されたモジュール<5>

1.8.6.33 tracemalloc
....................

Added *note tracemalloc.reset_peak(): d0b. 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<9>,  Next: unicodedata<6>,  Prev: tracemalloc,  Up: 改良されたモジュール<5>

1.8.6.34 typing
...............

PEP 593(1) introduced an *note typing.Annotated: d0d. type to decorate
existing types with context-specific metadata and new ‘include_extras’
parameter to *note typing.get_type_hints(): aa3. 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<6>,  Next: venv<4>,  Prev: typing<9>,  Up: 改良されたモジュール<5>

1.8.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<4>,  Next: xml<4>,  Prev: unicodedata<6>,  Up: 改良されたモジュール<5>

1.8.6.36 venv
.............

The activation scripts provided by *note venv: 11a. 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<4>,  Prev: venv<4>,  Up: 改良されたモジュール<5>

1.8.6.37 xml
............

White space characters within attributes are now preserved when
serializing *note xml.etree.ElementTree: 12e. 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.8.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: df. 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(): d12. 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: d13, *note tuple: 1d9,
     *note set: 432, *note frozenset: 9d9, *note list: 4e0, *note dict:
     193.) 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: d14. of float operation now has a better
     performance.  Also the message of *note ZeroDivisionError: d15. 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.8.8 非推奨
------------

   * distutilsの ‘bdist_msi’ コマンドは、現在非推奨です。代わりに、
     ‘bdist_wheel’ (wheelパッケージ)を使って下さい。 ( bpo-39586(1) での
     Hugo van Kemenadeによる貢献による)

   * Currently *note math.factorial(): d17. accepts *note float: 32f.
     instances with non-negative integer values (like ‘5.0’).  It raises
     a *note ValueError: 15a. for non-integral and negative floats.  It
     is now deprecated.  In future Python versions it will raise a *note
     TypeError: 29c. 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: 447. 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: 29c. in a future version of Python.  (Contributed by
     Josh Rosenberg in bpo-35712(3).)

   * The *note random: c0. 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: a6a, *note int:
     32e, *note float: 32f, *note str: 1ea, *note bytes: 1d2, and *note
     bytearray: 1d1.

   * Opening the *note GzipFile: 84f. 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():
     896. 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:
     418. is initialized by *note Py_Initialize(): 67a. since Python
     3.7.  (Contributed by Victor Stinner in bpo-39877(12).)

   * Passing ‘None’ as the first argument to the *note shlex.split():
     94e. 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:
     c9f.  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(): b31. の*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.8.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: 6cb.: ‘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:
     a6a.  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(): d19. and *note
     sys.setswitchinterval(): d1a. 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():
     d1b. 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: 427. has been
     removed.  It was deprecated since Python 3.8.  Use *note
     is_alive(): d1c. instead.  (Contributed by Donghee Na in
     bpo-37804(8).)

   * Methods ‘getchildren()’ and ‘getiterator()’ of classes *note
     ElementTree: d1d. and *note Element: 34b. in the *note ElementTree:
     12e. 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(): d1e, *note loads(): d1f,
     *note dump(): d20, and *note dumps(): d21. functions.
     Additionally, the 'use_builtin_types' parameter was removed,
     standard *note bytes: 1d2. 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(): d22. and *note base64.decodebytes(): d23.
     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(): ce3.
     instead.  (Contributed by Victor Stinner in bpo-39350(15).)

   * The 'buffering' parameter of *note bz2.BZ2File: c41. has been
     removed.  Since Python 3.0, it was ignored and using it emitted a
     *note DeprecationWarning: 2d4.  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(): 23a. has been
     removed.  As of Python 3.1, it was deprecated and ignored; using it
     has emitted a *note DeprecationWarning: 2d4. 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: 612. 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: 2f0.
     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(): 894. and *note
     asyncio.all_tasks(): d24. instead.  (Contributed by Rémi Lapeyre in
     bpo-40967(22))

   * The ‘unescape()’ method in the *note html.parser.HTMLParser: c51.
     class has been removed (it was deprecated since Python 3.4).  *note
     html.unescape(): d25. 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.8.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.8.10.1 Python API の変更
..........................

   * *note __import__(): caa. and *note importlib.util.resolve_name():
     cdd. now raise *note ImportError: 1c8. where it previously raised
     *note ValueError: 15a.  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: 11a. activation scripts no longer special-case when
     ‘__VENV_PROMPT__’ is set to ‘""’.

   * The *note select.epoll.unregister(): d28. method no longer ignores
     the *note EBADF: d29. error.  (Contributed by Victor Stinner in
     bpo-39239(1).)

   * The 'compresslevel' parameter of *note bz2.BZ2File: c41. 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: 7a. module now ignores the *note PYTHONCASEOK:
     d2a. environment variable when the *note -E: d2b. or *note -I: d2c.
     command line options are being used.

   * The 'encoding' parameter has been added to the classes *note
     ftplib.FTP: cce. and *note ftplib.FTP_TLS: ccf. 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(): cbc. has been added
     to *note AbstractEventLoop: d2d, 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(): d2e. 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: 8bb. now returns *note
     NotImplemented: 447. instead of raising a *note TypeError: 29c.
     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: 83. 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(): d2f. treats leading zeros as octal notatation.
     glibc implementation of modern *note inet_pton(): d30. does not
     accept any leading zeros.  (Contributed by Christian Heimes in
     bpo-36384(10)).

   * *note codecs.lookup(): d31. now normalizes the encoding name the
     same way as *note encodings.normalize_encoding(): 31b, 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.8.10.2 C API の変更
.....................

   * Instances of *note heap-allocated types: d33. (such as those
     created with *note PyType_FromSpec(): 396. 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: 373. 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: d33. 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(): 835. 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.8.10.3 CPython バイトコードの変更
...................................

   * The ‘LOAD_ASSERTION_ERROR’ opcode was added for handling the *note
     assert: d35. statement.  Previously, the assert statement would not
     work correctly if the *note AssertionError: a9c. exception was
     being shadowed.  (Contributed by Zackery Spytz in bpo-34880(1).)

   * The *note COMPARE_OP: d36. 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.8.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: 2b4. 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: d38. 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.8.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.8.12.1 新しい機能
...................

   * PEP 573(1): Added *note PyType_FromModuleAndSpec(): 398. to
     associate a module with a class; *note PyType_GetModule(): d3b. and
     *note PyType_GetModuleState(): d3c. to retrieve the module and its
     state; and *note PyCMethod: b4b. and *note METH_METHOD: d3d. 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(): b6e. function: get a frame code.
     Added *note PyFrame_GetBack(): b6a. function: get the frame next
     outer frame.  (Contributed by Victor Stinner in bpo-40421(3).)

   * Added *note PyFrame_GetLineNumber(): b6f. to the limited C API.
     (Contributed by Victor Stinner in bpo-40421(4).)

   * Added *note PyThreadState_GetInterpreter(): d3e. and *note
     PyInterpreterState_Get(): 841. functions to get the interpreter.
     Added *note PyThreadState_GetFrame(): b72. function to get the
     current frame of a Python thread state.  Added *note
     PyThreadState_GetID(): d3f. 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(): 834. 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(): 605. and *note
          Py_LeaveRecursiveCall(): d40. 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(): d41. 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(): d42. and *note
     PyObject_GC_IsFinalized(): d43. 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(): d44. 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.8.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: d46, *note m_clear: d47. and
     *note m_free: d48. functions of *note PyModuleDef: d49. 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: d4a.
     function).  More precisely, these functions are not called if *note
     m_size: d4b. is greater than 0 and the module state (as returned by
     *note PyModule_GetState(): d4c.) is ‘NULL’.

     Extension modules without module state (‘m_size <= 0’) are not
     affected.

   * If *note Py_AddPendingCall(): d4d. 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: 19f. when the ‘-E’ option is used (if *note
     PyConfig.use_environment: 625. 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: d4e. 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(): d4f. 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(): d50. macro was converted to a
          function.

        * The ‘PyObject_NEW()’ macro becomes an alias to the *note
          PyObject_New: d51. macro, and the ‘PyObject_NEW_VAR()’ macro
          becomes an alias to the *note PyObject_NewVar: d52. macro.
          They no longer access directly the *note
          PyTypeObject.tp_basicsize: d53. member.

        * ‘PyObject_GET_WEAKREFS_LISTPTR()’ macro was converted to a
          function: the macro accessed directly the *note
          PyTypeObject.tp_weaklistoffset: d54. member.

        * *note PyObject_CheckBuffer(): 831. macro was converted to a
          function: the macro accessed directly the *note
          PyTypeObject.tp_as_buffer: d55. member.

        * *note PyIndex_Check(): d56. 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: d57. 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.8.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: d59. 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(): d5a. 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(): c8f.
     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.8.13 Python 3.9.1 での重要な変更点
------------------------------------

* Menu:

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


File: python.info,  Node: typing<10>,  Next: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート,  Up: Python 3 9 1 での重要な変更点

1.8.13.1 typing
...............

The behavior of *note typing.Literal: c31. 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: 29c. exception
     during equality comparisons if any of their parameters are not
     *note hashable: 18e.  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<10>,  Up: Python 3 9 1 での重要な変更点

1.8.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.8.14 Python 3.9.2 での重要な変更点
------------------------------------

* Menu:

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


File: python.info,  Node: collections abc<3>,  Next: urllib parse<3>,  Up: Python 3 9 2 での重要な変更点

1.8.14.1 collections.abc
........................

*note collections.abc.Callable: bca. generic now flattens type
parameters, similar to what *note typing.Callable: ba9. 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: bcb. 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(): 31d. or ‘__args__’ need to account for this
change.  A *note DeprecationWarning: 2d4. 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: 29c. 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<3>,  Prev: collections abc<3>,  Up: Python 3 9 2 での重要な変更点

1.8.14.2 urllib.parse
.....................

Earlier Python versions allowed using both ‘;’ and ‘&’ as query
parameter separators in *note urllib.parse.parse_qs(): 590. and *note
urllib.parse.parse_qsl(): 58f.  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.8.15 Python 3.9.3 での重要な変更点
------------------------------------

A security fix alters the *note ftplib.FTP: cce. 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.8.16 Python 3.9.5での重要な変更点
-----------------------------------

* Menu:

* urllib.parse: urllib parse<4>.


File: python.info,  Node: urllib parse<4>,  Up: Python 3 9 5での重要な変更点

1.8.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: 113.
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.8.17 Notable security feature in 3.9.14
-----------------------------------------

Converting between *note int: 32e. and *note str: 1ea. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 15a. 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: e2. APIs.  See the *note
integer string conversion length limitation: 9f1. 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.8.18 Notable changes in 3.9.17
--------------------------------

* Menu:

* tarfile: tarfile<6>.


File: python.info,  Node: tarfile<6>,  Up: Notable changes in 3 9 17

1.8.18.1 tarfile
................

   * The extraction methods in *note tarfile: e7, and *note
     shutil.unpack_archive(): 887, 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: 888. for details.  In Python 3.12, use
     without the 'filter' argument will show a *note DeprecationWarning:
     2d4.  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.9 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: 145.

* 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.9.1 概要 - リリースハイライト
-------------------------------


File: python.info,  Node: 新しい機能<12>,  Next: その他の言語変更<6>,  Prev: 概要 -- リリースハイライト<7>,  Up: What's New In Python 3 8

1.9.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.9.2.1 代入式
..............

大きな構文の一部として、変数に値を割り当てる新しい構文 ‘:=’ が追加されま
した。 この構文は セイウチの目と牙(1) に似ているため、「セイウチ演算子」
の愛称で知られています。

以下の例では、代入式により *note len(): a24. 関数を二重に呼びだすことを
回避しています:

     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.9.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(): d6e. function does not accept keyword
arguments:

     def divmod(a, b, /):
         "Emulate the built in divmod() function"
         return (a // b, a % b)

もう一つのユースケースは、引数名が有用ではない場合にキーワード引数として
の利用を排除することです。例えば組み込み関数 *note len(): a24. は
‘len(obj, /)’ というシグニチャです。これにより、以下のようなぎこちない呼
び出しが排除されます:

     len(obj='hello')  # The "obj" keyword argument impairs readability

引数を位置専用とすることは、のちに引数名を変更する際に呼び出し側のコード
を壊してしまう心配がないという利点があります。例えば、*note statistics:
da. モジュールでは、'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.9.2.3 コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム
....................................................................................

暗黙のバイトコードキャッシュは、デフォルトでは各ソースコードのディレクト
リ内の ‘__pycache__’ サブディレクトリを使用しますが、新たに追加された環
境変数 *note PYTHONPYCACHEPREFIX: d70. （またはコマンドラインオプション
*note -X: 183. ‘pycache_prefix’) を指定すると、ソースコードと分離された
ディレクトリツリーに格納されるようになります。

キャッシュの場所は *note sys.pycache_prefix: d71. で参照できます（
‘__pycache__’ を使用する場合は *note None: a6a. になります）。

（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.9.2.4 デバッグビルドとリリースビルドのABI 共通化
..................................................

The ABI of Python *note debug builds: 3e3. 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(): 51d.
function and the *note PYTHONDUMPREFS: d73. environment variable, can be
set using the new *note ./configure -with-trace-refs: 82e. 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.9.2.5 'f-string' での ‘=’ を用いたオブジェクトの表現
......................................................

フォーマット済み文字列リテラル(*note f-string: 85e.) において ‘=’ 指定子
が有効になりました。‘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 書式指定子: 441. を用いると、より柔軟に式の結果の
表示方法を変えられます:

     >>> 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.9.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.9.2.7 PEP 587: Python 初期化設定
..................................

PEP 587(1) による C API の改善により、Python 初期化時に、すべての初期化
設定に対するより良い制御と改善されたエラー報告が得られます。

新たな構造体:

   * *note PyConfig: 612.

   * *note PyPreConfig: d78.

   * *note PyStatus: d79.

   * *note PyWideStringList: d7a.

新たな関数:

   * *note PyConfig_Clear(): d7b.

   * *note PyConfig_InitIsolatedConfig(): d7c.

   * *note PyConfig_InitPythonConfig(): d7d.

   * *note PyConfig_Read(): b74.

   * *note PyConfig_SetArgv(): d7e.

   * *note PyConfig_SetBytesArgv(): d7f.

   * *note PyConfig_SetBytesString(): d80.

   * *note PyConfig_SetString(): d81.

   * *note PyPreConfig_InitIsolatedConfig(): d82.

   * *note PyPreConfig_InitPythonConfig(): d83.

   * *note PyStatus_Error(): d84.

   * *note PyStatus_Exception(): d85.

   * *note PyStatus_Exit(): d86.

   * *note PyStatus_IsError(): d87.

   * *note PyStatus_IsExit(): d88.

   * *note PyStatus_NoMemory(): d89.

   * *note PyStatus_Ok(): d8a.

   * *note PyWideStringList_Append(): d8b.

   * *note PyWideStringList_Insert(): d8c.

   * *note Py_BytesMain(): d8d.

   * *note Py_ExitStatusException(): d8e.

   * *note Py_InitializeFromConfig(): 611.

   * *note Py_PreInitialize(): 638.

   * *note Py_PreInitializeFromArgs(): d8f.

   * *note Py_PreInitializeFromBytesArgs(): d90.

   * *note Py_RunMain(): d91.

このPEP は、‘_PyRuntimeState.preconfig’ (*note PyPreConfig: d78. 型) と
‘PyInterpreterState.config’ (*note PyConfig: 612. 型) を内部構造体に加え
ます。‘PyInterpreterState.config’ は新たな参照設定となり、グローバル設定
や他の内部変数を置き換えます。

*note Python 初期化設定: 83d. も参照してください。

詳細は 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.9.2.8 PEP 590: Vectorcall: a fast calling protocol for CPython
................................................................

*note The Vectorcall Protocol: 960. 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: b64. 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.9.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.9.3 その他の言語変更
----------------------

   * 実装上の問題により、*note finally: 453. 節での *note continue: 430.
     文は不正でした。Python3.8 では、この制限は取り除かれています。
     (Serhiy Storchaka の貢献による bpo-32489(1))

   * *note bool: 5f6, *note int: 32e, *note fractions.Fraction: 1ce. タ
     イプは、*note float: 32f. や *note decimal.Decimal: 1cd. と同様の
     *note as_integer_ratio(): d95. メソッドを持つようになりました。この
     API の拡張によって、‘numerator, denominator = x.as_integer_ratio()’
     のようなコードがより多くの数値型で動作します。 (Lisa Roach の貢献に
     よる bpo-33073(2) および Raymond Hettinger の貢献による
     bpo-37819(3))

   * *note int: 32e, *note float: 32f, *note complex: 330. のコンストラ
     クタは、可能ならば *note __index__(): 444. 特殊メソッドを利用し、そ
     の場合は対応する *note __int__(): 443, *note __float__(): d96. や
     *note __complex__(): 9e3. は使用できません。(Serhiy Storchaka の貢
     献による bpo-20092(4))

   * Added support of ‘\N{NAME}’ escapes in *note regular expressions:
     c1.:

          >>> 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(): c40. を使って逆順でイテレー
     トすることが可能になりました。(Rémi Lapeyre の貢献による
     bpo-33462(6))

   * 関数内でのキーワード名に関する構文の制限が強化されました。具体的に
     は、‘f((keyword)=arg)’ の表現が許容されなくなりました。キーワード引
     数への代入の際、左側にキーワードそのまま以外の表現を許可する意図は
     、以前からありませんでした。 (Benjamin Peterson の貢献による
     bpo-34641(7))

   * *note yield: d97. 文と *note return: 452. 文における一般化されたイ
     テラブルへの展開のために、全体を覆うかっこが不要になりました。これ
     は '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: 451. を、分かりやすい形式で表示します。これ
     で、最初のタプルが呼び出し可能ではないことを *note TypeError: 29c.
     で表示するよりもわかりやすくなります。(Serhiy Storchaka の貢献によ
     る bpo-15248(9))

   * *note datetime.date: 494, *note datetime.datetime: 6ed, *note
     datetime.timedelta: d98. オブジェクトのサブクラス間の算術演算は、基
     底クラスではなくサブクラスのインスタンスを返すようになりました。こ
     の変更は、*note astimezone(): d99. のような、‘datetime.timedelta’ に
     対する算術演算を直接ないし間接的に使用する実装の戻り値の型に影響し
     ます。(Paul Ganssle の貢献による bpo-32417(10))

   * Python インタープリタがCtrl-C (SIGINT) によって中断され、*note
     KeyboardInterrupt: d9a. 例外の結果が捕捉されなかった場合、Python プ
     ロセスはSIGINT シグナルか、呼び出したプロセスが、Ctrl-C によって終
     了したことを判別できるような適切な終了コードで終了するようになりま
     した。　POSIX とWindows 上のシェルは、非対話セッション内でスクリプ
     トの終了処理を適切に行うために、これを利用できます。(Gregory P.
     Smith を通してGoogle の貢献による bpo-1054041(11))

   * 先進的なプログラミングにおいて、既存の関数の *note types.CodeType:
     2ed. オブジェクトを更新する必要が生じます。code オブジェクトはイミ
     ュータブルなので、既存のオブジェクトがあるにもかかわらず、新しい
     code オブジェクトを生成する必要がありました。パラメータが19もあるの
     で、一から作成するのは非合理的です。新しい ‘replace()’ メソッドを使
     えば、更新すべきパラメータを書くだけで、新しいクローンを作成するこ
     とができます。

     ここでは、*note statistics.mean(): ac4. 関数がキーワード引数として
     '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(): 448.
     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__(): d9b. 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__(): d9c. 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.9.4 新たなモジュール
----------------------

   * 新しい *note importlib.metadata: 7d. モジュールは、サードパーティパ
     ッケージからのメタデータ読み込みをサポートします。これは暫定版です
     。例えば、インストールされたパッケージのバージョンを得たり、エント
     リーポイントの一覧を得たりできます:

          >>> # 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.9.5 改良されたモジュール
--------------------------

* Menu:

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


File: python.info,  Node: ast<7>,  Next: asyncio<11>,  Up: 改良されたモジュール<6>

1.9.5.1 ast
...........

AST ノードは ‘end_lineno’ と ‘end_col_offset’ の属性を持つようになりまし
た。これは、正確なノードの終端位置を提供します。(これは、‘lineno’ と
‘col_offset’ の属性を持つノードにのみ有効です)

新しい *note ast.get_source_segment(): da0. 関数は、特定の AST ノードの
ソースコードを返します。

(Ivan Levkivskyi の貢献による bpo-33416(1))

*note ast.parse(): 1d4. 関数の新しいフラグが有効になりました:

   * ‘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:
     b1e. と *note await: 439. キーワードは、予約語ではないとして扱われ
     ます。

(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<11>,  Next: builtins<2>,  Prev: ast<7>,  Up: 改良されたモジュール<6>

1.9.5.2 asyncio
...............

*note asyncio.run(): 314. は暫定から安定API に移動しました。この関数は
*note coroutine: 8a7. の実行と、イベントループを管理しながら自動的に結果
を返すことに使用できます。例えば:

     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(): 314. は非同期IOプログラムを動かす際にまず選ぶべき選択肢で
す。

(Yury Selivanov の貢献による bpo-32314(1))

‘python -m asyncio’ を実行すると、ネイティブ async 対話型インタプリタが
起動します。高水準キーワード *note await: 439. を使うコードの試験を簡単
に行えます。すべての呼び出しに対して新しいイベントループを作る
‘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: 6e0. now inherits from *note
BaseException: 9bd. rather than *note Exception: da2. and no longer
inherits from *note concurrent.futures.CancelledError: da3.
(Contributed by Yury Selivanov in bpo-32528(3).)

Windows では、イベントループのデフォルトが *note ProactorEventLoop: a03.
になりました。(Victor Stinner の貢献による bpo-34687(4))

*note ProactorEventLoop: a03. はUDP もサポートするようになりました。
(Adam Meily, Andrew Svetlov の貢献による bpo-29883(5))

*note ProactorEventLoop: a03. は *note KeyboardInterrupt: d9a.
("CTRL+C") によって中断できるようになりました。(Vladimir Matveev の貢献
による bpo-23057(6))

*note asyncio.Task: 467. 内で、内包されたコルーチンを得られる *note
asyncio.Task.get_coro(): da4. メソッドが追加されました。(Alex Grönholm の
貢献による bpo-36999(7))

*note asyncio.create_task(): 469. 関数か *note create_task(): 46a. の
‘name’ 引数を指定するか、もしくはタスクに対して *note set_name(): da5. メ
ソッドを呼ぶことによって、asyncio タスクに名前をつけることができます。タ
スクの名前は、*note asyncio.Task: 467. の ‘repr()’ 出力で、または *note
get_name(): da6. メソッドで確認することができます。(Alex Grönholm の貢献
による bpo-34270(8))

*note asyncio.loop.create_connection(): 9fe. は、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<2>,  Prev: asyncio<11>,  Up: 改良されたモジュール<6>

1.9.5.3 builtins
................

組み込み関数 *note compile(): 1d3. が、‘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<2>,  Next: cProfile,  Prev: builtins<2>,  Up: 改良されたモジュール<6>

1.9.5.4 collections
...................

*note collections.namedtuple(): 1da. の *note _asdict(): da9. メソッドは
、*note collections.OrderedDict: 9da. ではなく *note dict: 193. を返すよ
うになりました。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<3>,  Prev: collections<2>,  Up: 改良されたモジュール<6>

1.9.5.5 cProfile
................

*note cProfile.Profile: dab. クラスは、コンテキストマネージャとして使用
できるようになりました。このようにしてコードブロックをプロファイルします
:

     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<3>,  Next: curses<4>,  Prev: cProfile,  Up: 改良されたモジュール<6>

1.9.5.6 csv
...........

*note csv.DictReader: dad. は、*note collections.OrderedDict: 9da. では
なく *note dict: 193. のインスタンスを返すようになりました。この変更によ
って、順序を保ちながら、より高速にかつメモリの使用量を減らして実行できま
す。(Michael Selik の貢献による bpo-34003(1))

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34003


File: python.info,  Node: curses<4>,  Next: ctypes<4>,  Prev: csv<3>,  Up: 改良されたモジュール<6>

1.9.5.7 curses
..............

ncurses ライブラリの、構造化されたバージョン情報を保持する変数を追加しま
した: *note ncurses_version: daf.　 (Serhiy Storchaka の貢献による
bpo-31680(1))

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31680


File: python.info,  Node: ctypes<4>,  Next: datetime<5>,  Prev: curses<4>,  Up: 改良されたモジュール<6>

1.9.5.8 ctypes
..............

Windows では、*note CDLL: db1. とそのサブクラスが 'winmode' 引数を受け取
り、根底の ‘LoadLibraryEx’ 呼び出しのフラグを指定できるようになりました
。デフォルトでは、フラグは (フルパスか部分パスが初期DLL を読み込むのに使
われていた場合) そのDLL が保存されている場所を含んだ信頼済みの場所と、
*note add_dll_directory(): db2. によって加えられた場所からのみ、DLL を読
み込むようになっています。(Steve Dower の貢献による bpo-36085(1))

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36085


File: python.info,  Node: datetime<5>,  Next: functools<5>,  Prev: ctypes<4>,  Up: 改良されたモジュール<6>

1.9.5.9 datetime
................

Added new alternate constructors *note datetime.date.fromisocalendar():
db4. and *note datetime.datetime.fromisocalendar(): db5, which construct
*note date: 494. and *note datetime: 6ed. 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<5>,  Next: gc<6>,  Prev: datetime<5>,  Up: 改良されたモジュール<6>

1.9.5.10 functools
..................

*note functools.lru_cache(): db7. は、デコレータを返す関数としての使い方
に加えて、デコレータそのものとしても使えるようになりました。両方の使い方
ができます:

     @lru_cache
     def f(x):
         ...

     @lru_cache(maxsize=256)
     def f(x):
         ...

(Raymond Hettinger の貢献による bpo-36772(1))

インスタンスが存在する間、計算型プロパティをキャッシュする *note
functools.cached_property(): 953. デコレータが追加されました:

     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: db8. を利用して、メソッドを *note
ジェネリック関数: db9. に変換する *note
functools.singledispatchmethod(): 229. デコレータが追加されました:

     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<6>,  Next: gettext,  Prev: functools<5>,  Up: 改良されたモジュール<6>

1.9.5.11 gc
...........

*note get_objects(): be1. は、オブジェクトを得る世代を指定するオプション
のパラメータ引数 '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<6>,  Up: 改良されたモジュール<6>

1.9.5.12 gettext
................

*note pgettext(): dbc. を含む、類似のいくつかの関数が追加されました。
(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.9.5.13 gzip
.............

出力の再現性のために、*note gzip.compress(): a32. に 'mtime' パラメータ
が追加されました。 (Guo Ci Teo の貢献による bpo-34898(1))

不正な、あるいは破損した gzip ファイルのうち、所定の種類のものについて、
*note OSError: 543. にかわって *note BadGzipFile: dbe. 例外が送出される
ようになりました。(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<7>,  Prev: gzip<3>,  Up: 改良されたモジュール<6>

1.9.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<7>,  Next: io<5>,  Prev: IDLE と idelelib<4>,  Up: 改良されたモジュール<6>

1.9.5.15 inspect
................

*note inspect.getdoc(): 237. 関数は、‘__slots__’ 属性に値が docstrings で
あるような *note dict: 193. がある場合、docstrings の内容を探索できるよ
うになりました。これは、既に *note property(): 6c1.、*note
classmethod(): 6a0.、*note staticmethod(): 66d. に現在あるような、ドキュ
メント生成の選択肢を提供します:

     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<7>,  Up: 改良されたモジュール<6>

1.9.5.16 io
...........

In development mode (*note -X: 183. ‘env’) and in *note debug build:
3e3, the *note io.IOBase: 710. 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.9.5.17 itertools
..................

*note itertools.accumulate(): dc3. 関数に、初期値を定める、オプションの
'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<3>,  Prev: itertools<5>,  Up: 改良されたモジュール<6>

1.9.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<3>,  Next: math<7>,  Prev: json tool,  Up: 改良されたモジュール<6>

1.9.5.19 logging
................

Added a 'force' keyword argument to *note logging.basicConfig(): dc6.
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<7>,  Next: mmap<3>,  Prev: logging<3>,  Up: 改良されたモジュール<6>

1.9.5.20 math
.............

二点間のユークリッド距離を計算する *note math.dist(): dc8. 関数が追加さ
れました。(Raymond Hettinger の貢献による bpo-33089(1))

*note math.hypot(): dc9. 関数は、3次元以上を扱えるように拡張されました。
以前は、二次元の場合のみに対応していました。(Raymond Hettinger の貢献に
よる bpo-33089(2))

*note sum(): 886. に類似する関数として、初期値(デフォルトは1) に対してイ
テレート可能なオブジェクトの数を掛けていく *note math.prod(): dca. 関数
が追加されました:

     >>> 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(): ac3. と *note math.comb(): ac2.
が追加されました:

     >>> 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(): dcb. が追加されました。この関数は、巨大な整数にも使用でき
ます。‘floor(sqrt(n))’ より高速ですが、*note math.sqrt(): dcc. より少し
遅いです:

     >>> r = 650320427
     >>> s = r ** 2
     >>> isqrt(s - 1)         # correct
     650320426
     >>> floor(sqrt(s - 1))   # incorrect
     650320427

(Mark Dickinson の貢献による bpo-36887(7))

*note math.factorial(): d17. 関数は、引数に 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<3>,  Next: multiprocessing<4>,  Prev: math<7>,  Up: 改良されたモジュール<6>

1.9.5.21 mmap
.............

The *note mmap.mmap: 247. class now has an *note madvise(): dce. 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<9>,  Prev: mmap<3>,  Up: 改良されたモジュール<6>

1.9.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<9>,  Next: os path<6>,  Prev: multiprocessing<4>,  Up: 改良されたモジュール<6>

1.9.5.23 os
...........

Added new function *note add_dll_directory(): db2. on Windows for
providing additional search paths for native dependencies when importing
extension modules or loading DLLs using *note ctypes: 2d.  (Contributed
by Steve Dower in bpo-36085(1).)

A new *note os.memfd_create(): dd1. 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(): 4fc. will now traverse
anything supported by the operating system, while *note os.lstat(): 8b6.
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: dd2. 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: dd3.
attribute.

On Windows, *note os.readlink(): cf1. is now able to read directory
junctions.  Note that *note islink(): dd4. 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<6>,  Next: pathlib<11>,  Prev: os<9>,  Up: 改良されたモジュール<6>

1.9.5.24 os.path
................

*note os.path: a6. functions that return a boolean result like *note
exists(): dd6, *note lexists(): dd7, *note isdir(): dd8, *note isfile():
dd9, *note islink(): dd4, and *note ismount(): dda. now return ‘False’
instead of raising *note ValueError: 15a. or its subclasses *note
UnicodeEncodeError: a6c. and *note UnicodeDecodeError: ddb. for paths
that contain characters or bytes unrepresentable at the OS level.
(Contributed by Serhiy Storchaka in bpo-33721(1).)

*note expanduser(): ddc. 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(): dd8. on Windows no longer returns ‘True’ for a link to a
non-existent directory.

*note realpath(): 24d. 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<11>,  Next: pickle<3>,  Prev: os path<6>,  Up: 改良されたモジュール<6>

1.9.5.25 pathlib
................

*note pathlib.Path: 4f5. methods that return a boolean result like *note
exists(): dde, *note is_dir(): 742, *note is_file(): 741, *note
is_mount(): ddf, *note is_symlink(): de0, *note is_block_device(): de1,
*note is_char_device(): de2, *note is_fifo(): de3, *note is_socket():
de4. now return ‘False’ instead of raising *note ValueError: 15a. or its
subclass *note UnicodeEncodeError: a6c. 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<3>,  Next: plistlib,  Prev: pathlib<11>,  Up: 改良されたモジュール<6>

1.9.5.26 pickle
...............

*note pickle: ab. extensions subclassing the C-optimized *note Pickler:
de6. can now override the pickling logic of functions and classes by
defining the special *note reducer_override(): de7. 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<4>,  Prev: pickle<3>,  Up: 改良されたモジュール<6>

1.9.5.27 plistlib
.................

Added new *note plistlib.UID: de9. 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<4>,  Next: py_compile<2>,  Prev: plistlib,  Up: 改良されたモジュール<6>

1.9.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():
deb. that is like *note pprint.pprint(): c05. 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<4>,  Up: 改良されたモジュール<6>

1.9.5.29 py_compile
...................

*note py_compile.compile(): ded. 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<5>,  Prev: py_compile<2>,  Up: 改良されたモジュール<6>

1.9.5.30 shlex
..............

The new *note shlex.join(): def. function acts as the inverse of *note
shlex.split(): 94e.  (Contributed by Bo Bayles in bpo-32102(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32102


File: python.info,  Node: shutil<5>,  Next: socket<6>,  Prev: shlex,  Up: 改良されたモジュール<6>

1.9.5.31 shutil
...............

*note shutil.copytree(): df1. now accepts a new ‘dirs_exist_ok’ keyword
argument.  (Contributed by Josh Bronson in bpo-20849(1).)

*note shutil.make_archive(): 8c8. 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: e7. module.  (Contributed by C.A.M. Gerlach in
bpo-30661(2).)

*note shutil.rmtree(): 33d. 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<6>,  Next: ssl<6>,  Prev: shutil<5>,  Up: 改良されたモジュール<6>

1.9.5.32 socket
...............

Added *note create_server(): df3. and *note has_dualstack_ipv6(): df4.
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(): df5, *note socket.if_nametoindex():
df6, and *note socket.if_indextoname(): df7. 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<6>,  Next: statistics<4>,  Prev: socket<6>,  Up: 改良されたモジュール<6>

1.9.5.33 ssl
............

Added *note post_handshake_auth: df9. to enable and *note
verify_client_post_handshake(): dfa. 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<9>,  Prev: ssl<6>,  Up: 改良されたモジュール<6>

1.9.5.34 statistics
...................

Added *note statistics.fmean(): dfc. as a faster, floating-point variant
of *note statistics.mean(): ac4.  (Contributed by Raymond Hettinger and
Steven D'Aprano in bpo-35904(1).)

Added *note statistics.geometric_mean(): dfd. (Contributed by Raymond
Hettinger in bpo-27181(2).)

Added *note statistics.multimode(): dfe. that returns a list of the most
common values.  (Contributed by Raymond Hettinger in bpo-35892(3).)

Added *note statistics.quantiles(): dff. 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: e00, 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<9>,  Next: tarfile<7>,  Prev: statistics<4>,  Up: 改良されたモジュール<6>

1.9.5.35 sys
............

Add new *note sys.unraisablehook(): 712. 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(): 456.).  (Contributed by Victor
Stinner in bpo-36829(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36829


File: python.info,  Node: tarfile<7>,  Next: threading<7>,  Prev: sys<9>,  Up: 改良されたモジュール<6>

1.9.5.36 tarfile
................

The *note tarfile: e7. 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<7>,  Next: tokenize<3>,  Prev: tarfile<7>,  Up: 改良されたモジュール<6>

1.9.5.37 threading
..................

Add a new *note threading.excepthook(): c27. function which handles
uncaught *note threading.Thread.run(): e04. 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(): e05. function and a *note
native_id: e06. attribute to the *note threading.Thread: 427. 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<3>,  Next: tkinter<6>,  Prev: threading<7>,  Up: 改良されたモジュール<6>

1.9.5.38 tokenize
.................

The *note tokenize: 104. 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<6>,  Next: time<4>,  Prev: tokenize<3>,  Up: 改良されたモジュール<6>

1.9.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<11>,  Prev: tkinter<6>,  Up: 改良されたモジュール<6>

1.9.5.40 time
.............

Added new clock *note CLOCK_UPTIME_RAW: e0a. 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<11>,  Next: unicodedata<7>,  Prev: time<4>,  Up: 改良されたモジュール<6>

1.9.5.41 typing
...............

The *note typing: 10d. module incorporates several new features:

   * A dictionary type with per-key types.  See PEP 589(1) and *note
     typing.TypedDict: 29b.  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: c31.
     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: 775. and *note typing.final(): aa0.  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: 772.
     and *note typing.runtime_checkable(): 867.  Simple ABCs like *note
     typing.SupportsInt: e0c. are now ‘Protocol’ subclasses.

   * New protocol class *note typing.SupportsIndex: e0d.

   * New functions *note typing.get_origin(): 31c. and *note
     typing.get_args(): 31d.

   ---------- 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<7>,  Next: unittest<8>,  Prev: typing<11>,  Up: 改良されたモジュール<6>

1.9.5.42 unicodedata
....................

The *note unicodedata: 10e. module has been upgraded to use the Unicode
12.1.0(1) release.

New function *note is_normalized(): e0f. 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<8>,  Next: venv<5>,  Prev: unicodedata<7>,  Up: 改良されたモジュール<6>

1.9.5.43 unittest
.................

Added *note AsyncMock: e11. to support an asynchronous version of *note
Mock: e12.  Appropriate new assert functions for testing have been added
as well.  (Contributed by Lisa Roach in bpo-26467(1)).

Added *note addModuleCleanup(): e13. and *note addClassCleanup(): e14.
to unittest to support cleanups for *note setUpModule(): e15. and *note
setUpClass(): e16.  (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: 10f. module gained support for coroutines to be used as
test cases with *note unittest.IsolatedAsyncioTestCase: 34a.
(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<5>,  Next: weakref,  Prev: unittest<8>,  Up: 改良されたモジュール<6>

1.9.5.44 venv
.............

*note venv: 11a. 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<5>,  Prev: venv<5>,  Up: 改良されたモジュール<6>

1.9.5.45 weakref
................

The proxy objects returned by *note weakref.proxy(): e19. 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<5>,  Next: xmlrpc,  Prev: weakref,  Up: 改良されたモジュール<6>

1.9.5.46 xml
............

As mitigation against DTD and external entity retrieval, the *note
xml.dom.minidom: 12b. and *note xml.sax: 132. 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: 12e. 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: 12e. module provides a new function
*note canonicalize(): e1b. that implements C14N 2.0.  (Contributed by
Stefan Behnel in bpo-13611(3).)

The target object of *note xml.etree.ElementTree.XMLParser: e1c. can
receive namespace declaration events through the new callback methods
‘start_ns()’ and ‘end_ns()’.  Additionally, the *note
xml.etree.ElementTree.TreeBuilder: e1d. 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<5>,  Up: 改良されたモジュール<6>

1.9.5.47 xmlrpc
...............

*note xmlrpc.client.ServerProxy: e1f. 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.9.6 最適化
------------

   * The *note subprocess: df. module can now use the *note
     os.posix_spawn(): 736. 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(): e21, *note shutil.copy(): e22, *note
     shutil.copy2(): e23, *note shutil.copytree(): df1. and *note
     shutil.move(): e24. 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(): 1dd.-based variant of *note shutil.copyfileobj():
     e25. 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
     プラットフォーム依存の効率的なコピー操作: e26. section.
     (Contributed by Giampaolo Rodolà in bpo-33671(2).)

   * *note shutil.copytree(): df1. uses *note os.scandir(): e27.
     function and all copy functions depending from it use cached *note
     os.stat(): 4fc. 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: e28. 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: e29. 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(): e2a. 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(): 1da.  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: 4e0. 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.9.7 ビルドならびに C API の変更
---------------------------------

   * Default *note sys.abiflags: e2c. 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(): 979, *note Py_DECREF(): 97a.

        * *note Py_XINCREF(): e2d, *note Py_XDECREF(): b73.

        * ‘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(): e2e. 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(): 801. and argument parsing functions like *note
     PyArg_ParseTuple(): 3b9. with integer converting format units like
     ‘'i'’ will now use the *note __index__(): 444. special method
     instead of *note __int__(): 443, if available.  The deprecation
     warning will be emitted for objects with the ‘__int__()’ method but
     without the ‘__index__()’ method (like *note Decimal: 1cd. and
     *note Fraction: 1ce.).  *note PyNumber_Check(): e2f. will now
     return ‘1’ for objects implementing ‘__index__()’.  *note
     PyNumber_Long(): e30, *note PyNumber_Float(): e31. and *note
     PyFloat_AsDouble(): e32. 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(): e33. (and its parallel macro
     ‘PyObject_INIT’) instead of in *note PyType_GenericAlloc(): e34.
     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: 3b4. to the program
     full path (‘Py_GetProgramFullPath()’) rather than to the program
     name (‘Py_GetProgramName()’).  (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.9.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: 12e. module now emit a *note DeprecationWarning: 2d4.
     instead of *note PendingDeprecationWarning: c9f.  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: b2c. to *note
     loop.set_default_executor(): b2d. is deprecated and will be
     prohibited in Python 3.9.  (Contributed by Elvis Pranskevichus in
     bpo-34075(3).)

   * The *note __getitem__(): 78d. methods of *note
     xml.dom.pulldom.DOMEventStream: b21, *note
     wsgiref.util.FileWrapper: b22. and *note fileinput.FileInput: b23.
     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: 2f0. 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: 570. should be used instead.
     (Contributed by Serhiy Storchaka in bpo-32892(6).)

   * *note ast.NodeVisitor: 571. 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(): e36. method to handle all constant
     nodes.  (Contributed by Serhiy Storchaka in bpo-36917(7).)

   * The ‘@asyncio.coroutine’ *note decorator: b1d. is deprecated and
     will be removed in version 3.10.  Instead of ‘@asyncio.coroutine’,
     use *note async def: 9d4. 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(): e37, *note asyncio.gather(): 9f9,
     *note asyncio.shield(): e38, *note asyncio.wait_for(): 9fb, *note
     asyncio.wait(): 896, *note asyncio.as_completed(): 6d2, *note
     asyncio.Task: 467, *note asyncio.Lock: e39, *note asyncio.Event:
     574, *note asyncio.Condition: e3a, *note asyncio.Semaphore: e3b,
     *note asyncio.BoundedSemaphore: e3c, *note asyncio.Queue: e3d,
     *note asyncio.create_subprocess_exec(): e3e, and *note
     asyncio.create_subprocess_shell(): e3f.

   * The explicit passing of coroutine objects to *note asyncio.wait():
     896. 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: 66. 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(): e40. and *note
     install(): e41. 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: 427. 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: 1cd.s, *note
     Fraction: 1ce.s and any other objects that can be converted to
     integers only with a loss (e.g.  that have the *note __int__():
     443. method but do not have the *note __index__(): 444. 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(): 4ae, *note
          weakref.finalize(): e42, *note profile.Profile.runcall(): e43,
          ‘cProfile.Profile.runcall()’, *note bdb.Bdb.runcall(): e44,
          *note trace.Trace.runfunc(): e45. and *note curses.wrapper():
          e46.

        - 'function' in *note unittest.TestCase.addCleanup(): e47.

        - 'fn' in the *note submit(): e48. method of *note
          concurrent.futures.ThreadPoolExecutor: b2c. and *note
          concurrent.futures.ProcessPoolExecutor: 211.

        - 'callback' in *note contextlib.ExitStack.callback(): e49,
          ‘contextlib.AsyncExitStack.callback()’ and *note
          contextlib.AsyncExitStack.push_async_callback(): e4a.

        - 'c' and 'typeid' in the ‘create()’ method of
          ‘multiprocessing.managers.Server’ and
          ‘multiprocessing.managers.SharedMemoryServer’.

        - 'obj' in *note weakref.finalize(): e42.

     In future releases of Python, they will be *note positional-only:
     e4b.  (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.9.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(): 58c. 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(): e4d. or
     *note time.process_time(): e4e. 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: e7. module.
     It is not documented and deprecated since Python 3.3.

   * The *note XMLParser: e1c. 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: 7a9.  (Contributed
     by Serhiy Storchaka in bpo-29209(6).)

   * Removed the ‘doctype()’ method of *note XMLParser: e1c.
     (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: d7.
     module are not exposed to the user.  (Contributed by Aviv Palivoda
     in bpo-30262(9).)

   * The ‘bufsize’ keyword argument of *note fileinput.input(): bdd. and
     *note fileinput.FileInput(): b23. 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.9.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.9.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: 451. 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:
     5f6, *note int: 32e, *note float: 32f, *note complex: 330. and few
     classes from the standard library.  They now inherit ‘__str__()’
     from *note object: e51.  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: 51f. 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(): 83f,
     *note Py_END_ALLOW_THREADS(): e52, and *note PyGILState_Ensure():
     1b0.  If this behavior is not desired, guard the call by checking
     ‘_Py_IsFinalizing()’ or *note sys.is_finalizing(): e53.
     (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.9.10.2 Python API の変更
..........................

   * The *note os.getcwdb(): e55. 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: 6c5. can now use *note os.posix_spawn():
     736. 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: e56.  (Contributed by Joannah Nanjekye and Victor
     Stinner in bpo-35537(3).)

   * The 'preexec_fn' argument of * *note subprocess.Popen: 6c5. is no
     longer compatible with subinterpreters.  The use of the parameter
     in a subinterpreter now raises *note RuntimeError: 317.
     (Contributed by Eric Snow in bpo-34651(4), modified by Christian
     Heimes in bpo-37951(5).)

   * The *note imaplib.IMAP4.logout(): e57. 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(): 58c. instead.
     (Contributed by Victor Stinner in bpo-35345(7).)

   * The *note statistics.mode(): e58. 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(): e59. method of the *note
     tkinter.ttk.Treeview: e5a. 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():
     e5b. for changing the selection.  (Contributed by Serhiy Storchaka
     in bpo-31508(9).)

   * The *note writexml(): e5c, *note toxml(): e5d. and *note
     toprettyxml(): e5e. methods of *note xml.dom.minidom: 12b. and the
     *note write(): e5f. method of *note xml.etree.ElementTree: 12e. now
     preserve the attribute order specified by the user.  (Contributed
     by Diego Rojas and Raymond Hettinger in bpo-34160(10).)

   * A *note dbm.dumb: 35. database opened with flags ‘'r'’ is now
     read-only.  *note dbm.dumb.open(): e60. 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:
     e1c. will no longer be called and will emit a *note RuntimeWarning:
     6e3. instead of a *note DeprecationWarning: 2d4.  Define the *note
     doctype(): e61. method on a target for handling an XML doctype
     declaration.  (Contributed by Serhiy Storchaka in bpo-29209(12).)

   * A *note RuntimeError: 317. is now raised when the custom metaclass
     doesn't provide the ‘__classcell__’ entry in the namespace passed
     to ‘type.__new__’.  A *note DeprecationWarning: 2d4. was emitted in
     Python 3.6-3.7.  (Contributed by Serhiy Storchaka in
     bpo-23722(13).)

   * The *note cProfile.Profile: dab. class can now be used as a context
     manager.  (Contributed by Scott Sanderson in bpo-29235(14).)

   * *note shutil.copyfile(): e21, *note shutil.copy(): e22, *note
     shutil.copy2(): e23, *note shutil.copytree(): df1. and *note
     shutil.move(): e24. use platform-specific "fast-copy" syscalls (see
     *note プラットフォーム依存の効率的なコピー操作: e26. section).

   * *note shutil.copyfile(): e21. 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: c94. 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(): e62. 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: 12b. and *note xml.sax: 132. 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: 34. database (*note
     dbm.dumb: 35, *note dbm.gnu: 36. or *note dbm.ndbm: 37.) raises
     ‘error’ (*note dbm.dumb.error: e63, *note dbm.gnu.error: e64. or
     *note dbm.ndbm.error: e65.) instead of *note KeyError: 7e5.
     (Contributed by Xiang Zhang in bpo-33106(19).)

   * Simplified AST for literals.  All constants will be represented as
     *note ast.Constant: 570. 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(): ddc. 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: 6e0. now inherits from
     *note BaseException: 9bd. rather than *note Exception: da2. and no
     longer inherits from *note concurrent.futures.CancelledError: da3.
     (Contributed by Yury Selivanov in bpo-32528(22).)

   * The function *note asyncio.wait_for(): 9fb. now correctly waits for
     cancellation when using an instance of *note asyncio.Task: 467.
     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(): e66. 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: e67. has graduated to the stable
     API.

   * DLL dependencies for extension modules and DLLs loaded with *note
     ctypes: 2d. 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(): db2. 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: 2ed. 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(): e69. 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.9.10.3 C API の変更
.....................

   * The *note PyCompilerFlags: e6b. 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(): 64a. 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(): 3b9, *note Py_BuildValue(): 5f5, *note
     PyObject_CallFunction(): 837, etc.)  without ‘PY_SSIZE_T_CLEAN’
     defined raises ‘DeprecationWarning’ now.  It will be removed in
     3.10 or 4.0.  Read *note 引数の解釈と値の構築: 608. for detail.
     (Contributed by Inada Naoki in bpo-36381(4).)

   * Instances of heap-allocated types (such as those created with *note
     PyType_FromSpec(): 396.) hold a reference to their type object.
     Increasing the reference count of these type objects has been moved
     from *note PyType_GenericAlloc(): e34. to the more low-level
     functions, *note PyObject_Init(): e33. and ‘PyObject_INIT’.  This
     makes types created through ‘PyType_FromSpec()’ behave like other
     classes in managed code.

     *note Statically allocated types: b64. 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: 979. on the type object after
          allocating an instance - if any.  This may happen after
          calling *note PyObject_New: d51, *note PyObject_NewVar: d52,
          *note PyObject_GC_New(): e6c, *note PyObject_GC_NewVar(): e6d,
          or any other custom allocator that uses *note PyObject_Init():
          e33. 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(): e6e. 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: e6f. exported by a third-party extension module is
     supposed to have all the slots expected in the current Python
     version, including *note tp_finalize: e70. (*note
     Py_TPFLAGS_HAVE_FINALIZE: 641. 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 を使う: e71. 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.9.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: 42f, *note
     continue: 430. and *note return: 452.

     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: e73. for handling exceptions
     raised when awaiting a next item in an *note async for: e74. loop.
     (Contributed by Serhiy Storchaka in bpo-33041(2).)

   * The *note MAP_ADD: e75. 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.9.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.9.11 Python3.8.1 での重要な変更点
-----------------------------------

セキュリティ上の重大な懸念により、*note
asyncio.loop.create_datagram_endpoint(): b1f. での '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.9.12 Python3.8.2 での重要な変更点
-----------------------------------

Fixed a regression with the ‘ignore’ callback of *note
shutil.copytree(): df1.  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.9.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.9.14 Python3.8.8 での重要な変更点
-----------------------------------

Earlier Python versions allowed using both ‘;’ and ‘&’ as query
parameter separators in *note urllib.parse.parse_qs(): 590. and *note
urllib.parse.parse_qsl(): 58f.  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.9.15 Notable changes in Python 3.8.9
--------------------------------------

A security fix alters the *note ftplib.FTP: cce. 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.9.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.9.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.9.17 Notable changes in Python 3.8.10
---------------------------------------

* Menu:

* urllib.parse: urllib parse<5>.


File: python.info,  Node: urllib parse<5>,  Up: Notable changes in Python 3 8 10<2>

1.9.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: 113.
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.9.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.9.18.1 Python API の変更
..........................

Starting with Python 3.8.12 the *note ipaddress: 83. 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(): d2f. treats
leading zeros as octal notation.  glibc implementation of modern *note
inet_pton(): d30. 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.9.19 Notable security feature in 3.8.14
-----------------------------------------

Converting between *note int: 32e. and *note str: 1ea. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 15a. 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: e2. APIs.  See the *note
integer string conversion length limitation: 9f1. 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.9.20 Notable changes in 3.8.17
--------------------------------

* Menu:

* tarfile: tarfile<8>.


File: python.info,  Node: tarfile<8>,  Up: Notable changes in 3 8 17

1.9.20.1 tarfile
................

   * The extraction methods in *note tarfile: e7, and *note
     shutil.unpack_archive(): 887, 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: 888. for details.  In Python 3.12, use
     without the 'filter' argument will show a *note DeprecationWarning:
     2d4.  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.10 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
変更履歴: 145. をご覧ください。

* 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.10.1 概要 - リリースハイライト
--------------------------------

新たな文法機能:

   * *note PEP 563: e89. 、型アノテーションの評価の遅延。

後方非互換な文法の変更:

   * *note async: b1e. と *note await: 439. は予約されたキーワードになり
     ました。

新たなライブラリモジュール:

   * *note contextvars: 28.: *note PEP 567 - コンテキスト変数: e8a.

   * *note dataclasses: 32.: *note PEP 557 - データクラス: e8b.

   * *note importlib.resources: e8c.

新たな組み込み機能:

   * *note PEP 553: e8d. 、新しい *note breakpoint(): 500. 関数。

Python のデータモデルの改善:

   * *note PEP 562: e8e. 、モジュール属性へのアクセスのカスタマイズ。

   * *note PEP 560: e8f. 、typing モジュールとジェネリック型に対する言語
     コアによるサポート。

   * *note dict: e90. オブジェクトの挿入順序を保存するという性質が、公式
     に Python 言語仕様の一部であると 宣言されました(1) 。

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

   * *note asyncio: b. モジュールに新しい機能が加わりました。 顕著な
     *note 使い勝手とパフォーマンスの改善: e91. です。

   * *note time: f7. モジュールが *note ナノ秒単位の分解能を持つ関数:
     e92. をサポートするようになりました。

CPython の実装の改善:

   * デフォルトのテキストエンコーディングとして ASCII を使わなくなりまし
     た:

        * *note PEP 538: e93. 、レガシーな C ロケールの抑圧

        * *note PEP 540: e94, UTF-8 実行時モードの強制

   * *note PEP 552: e95. 、決定論的な .pyc

   * *note New Python Development Mode: e96.

   * *note PEP 565: e97. 、 *note DeprecationWarning: 2d4. の取り扱いの
     改善

C API の改善:

   * *note PEP 539: e98. 、スレッドローカルなストレージのための新しい C
     API

ドキュメントの改善:

   * *note PEP 545: e99. 、 Python ドキュメント翻訳

   * 新しいドキュメント翻訳: 日本語(2) 、 フランス語(3) 、 韓国語(4) 。

このリリースの特色は、多くの領域での特筆すべきパフォーマンスの改善です。
*note 最適化: e9a. 節に詳細な一覧があります。

1つ前にリリースされた Python との互換性に影響を持つ変更の一覧については
、 *note Python 3.7 への移植: e9b. 節を参照してください。

   ---------- 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.10.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.10.2.1 PEP 563: アノテーションの遅延評価
..........................................

Python における型ヒントの到来により、 PEP 3107(1) で追加され PEP 526(2)
でさらに改善されたアノテーションの機能について、使い勝手に関する 2 つの
明白な問題が明らかになりました:

   * アノテーションには現在のスコープで既に使える状態になっている名前し
     か使えない。言い換えれば、どんな種類の前方参照もサポートしない。

   * ソースコードに注釈を付けるのは Python プログラムの起動時間に好まし
     くない影響がある。

これらの問題はどちらもアノテーションの評価を遅延することで解決します。 ア
ノテーションの定義時に、アノテーションに含まれる式を評価するコードをコン
パイルする代わりに、コンパイラは当該の式の AST と同等な文字列形式でアノ
テーションを保存します。 必要であれば、 *note typing.get_type_hints():
aa3. を使って実行時にアノテーションを解決できます。 たいていのケースでは
その必要は無く、(短い文字列はインタプリタによって格納されるので) アノテ
ーションを保存するコストはより安くなり、起動時間がより速くなります。

使い勝手の点では、アノテーションは前方参照をサポートするようになり、次の
文法が妥当なものになりました:

     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.10.2.2 PEP 538: レガシーな C ロケールの抑圧
.............................................

Python 3 シリーズにおける継続中の課題の一つは、非 Windows プラットフォー
ムではデフォルトの C ロケールつまり POSIX ロケールの使用から現在のところ
必然的に導かれてしまう "7-bit ASCII" テキストエンコーディングの仮定を取
り扱う賢明なデフォルトの方針を決定することです。

PEP 538(1) はインタープリタのデフォルトのコマンドラインインターフェース
を更新し、新しく加わった *note PYTHONCOERCECLOCALE: e9f. 環境変数のドキ
ュメントにある通り、自動的にロケールを UTF-8 に基づいた利用可能なロケー
ルへ強制します。 この方法で ‘LC_CTYPE’ を自動的に設定すると、コアのイン
タープリタと (*note readline: c2. などの) ロケールを考慮する C 拡張はデ
フォルトのテキストエンコーディングとして ASCII ではなく UTF-8 を使うこと
になります。

PEP 11(2) にあるプラットフォームのサポート定義も、適切に設定された非
ASCII に基づくロケールだけにテキスト処理の完全なサポートを制限するよう更
新されました。

この変更の一部として、強制対象として定義されたのロケール (現時点では
‘C.UTF-8’, ‘C.utf8’, ‘UTF-8’) を使っているときの *note stdin: 94f. と
*note stdout: ea0. のデフォルトのエラーハンドラは (‘strict’ ではなく)
‘surrogateescape’ になります。 *note stderr: d09. のデフォルトのエラーハ
ンドラは、ロケールに関係無く引き続き ‘backslashreplace’ です。

デフォルトではロケールの強制は暗黙に行われますが、ロケールが関係する結合
における問題のデバッグを支援するために、 ‘PYTHONCOERCECLOCALE=warn’ を設
定することで (*note stderr: d09. に直接出力される) 明示的な警告を要求で
きます。 この設定を有効にしていると、コアのインタプリタの初期化時にレガ
シーな C ロケールが有効なままの場合、 Python 実行器が警告を出力します。

PEP 538(3) のロケール強制には、(非 Python アプリケーションや古いバージョ
ンの Python で動くのも含めた) 子プロセスに加え (GNU ‘readline’ などの) 影
響を受ける拡張モジュールにも利益がある一方、適切な対象ロケールが実行する
システムに存在することを要求するという負の面もあります。 (例えば、
RHEL/CentOS 7 で起きているように) 適切な対象ロケールで利用可能なものが無
いケースにきちんと対処するために、 Python 3.7 には *note PEP 540; 強制
UTF-8 実行モード: e94. も実装されています。

参考
....

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.10.2.3 PEP 540: 強制 UTF-8 実行モード
.......................................

The new *note -X: 183. ‘utf8’ command line option and *note PYTHONUTF8:
1b8. environment variable can be used to enable the *note Python UTF-8
Mode: a4b.

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: 94f.
and *note sys.stdout: ea0. 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 実行モード: e94.).

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.10.2.4 PEP 553: 組み込みの ‘breakpoint()’
...........................................

Python 3.7 には、 Python デバッガへ入って行くための簡単で一貫した手段で
ある、新しい組み込みの *note breakpoint(): 500. 関数があります。

Built-in ‘breakpoint()’ calls *note sys.breakpointhook(): ea3.  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: ea4. 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.10.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: ea6. 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: ea7. 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: ea8. 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.10.2.6 PEP 562: モジュール属性へのアクセスのカスタマイズ
..........................................................

Python 3.7 allows defining *note __getattr__(): eaa. on modules and will
call it whenever a module attribute is otherwise not found.  Defining
*note __dir__(): eab. 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.10.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():
764. 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: f7. module:

   * *note time.clock_gettime_ns(): ead.

   * *note time.clock_settime_ns(): eae.

   * *note time.monotonic_ns(): eaf.

   * *note time.perf_counter_ns(): eb0.

   * *note time.process_time_ns(): eb1.

   * *note time.time_ns(): eb2.

新しい関数は、整数値としてナノ秒単位の数値を返します。

Measurements(2) show that on Linux and Windows the resolution of *note
time.time_ns(): eb2. is approximately 3 times better than that of *note
time.time(): 764.

参考
....

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.10.2.8 PEP 565: Show DeprecationWarning in ‘__main__’
.......................................................

The default handling of *note DeprecationWarning: 2d4. 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: 84d.: always displayed by default, recommended
     for warnings intended to be seen by application end users (e.g.
     for deprecated application configuration settings).

   * *note DeprecationWarning: 2d4.: 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: c9f.: displayed by default only
     when running tests, intended for cases where a future version
     upgrade will change the warning category to *note
     DeprecationWarning: 2d4. or *note FutureWarning: 84d.

Previously both *note DeprecationWarning: 2d4. and *note
PendingDeprecationWarning: c9f. 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.10.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: 10d. module are extensively used by the community,
so this restriction is removed.  The PEP introduces two special methods
*note __class_getitem__(): b26. and *note __mro_entries__(): eb5, 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.10.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: bb. 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 キャッシュされたバイトコードの無効化: 9e8. 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.10.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.10.2.12 Python Development Mode (-X dev)
..........................................

The new *note -X: 183. ‘dev’ command line option or the new *note
PYTHONDEVMODE: eb9. environment variable can be used to enable *note
Python Development Mode: 713.  When in development mode, Python performs
additional runtime checks that are too expensive to be enabled by
default.  See *note Python Development Mode: 713. documentation for the
full description.


File: python.info,  Node: その他の言語変更<7>,  Next: 新たなモジュール<7>,  Prev: 新しい機能<13>,  Up: What's New In Python 3 7

1.10.3 その他の言語変更
-----------------------

   * An *note await: 439. expression and comprehensions containing an
     *note async for: e74. clause were illegal in the expressions in
     *note formatted string literals: 441. 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(): 43b. and *note bytearray.fromhex(): 43c. now
     ignore all ASCII whitespace, not only spaces.  (Contributed by
     Robert Xiao in bpo-28927(3).)

   * *note str: 1ea, *note bytes: 1d2, and *note bytearray: 1d1. gained
     support for the new *note isascii(): ebb. 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: 1c8. 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: ebc. can now be instantiated from Python code,
     and the *note tb_next: ebd. attribute on *note tracebacks: ebe. is
     now writable.  (Contributed by Nathaniel J. Smith in bpo-30579(8).)

   * When using the *note -m: 4d1. 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: 183. ‘importtime’ option or the *note
     PYTHONPROFILEIMPORTTIME: ebf. 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.10.4 新たなモジュール
-----------------------

* Menu:

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


File: python.info,  Node: contextvars<2>,  Next: データクラス<3>,  Up: 新たなモジュール<7>

1.10.4.1 contextvars
....................

The new *note contextvars: 28. module and a set of *note new C APIs:
ec2. 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: 39. 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<3>,  Prev: contextvars<2>,  Up: 新たなモジュール<7>

1.10.4.2 データクラス
.....................

新しい *note dataclass(): 6ec. デコレータにより 'データクラス' を宣言す
る方法が提供されます。 データクラスは属性を記述するのに、クラス変数アノ
テーションを使います。 コンストラクタや他の *note __repr__(): 1c7, *note
__eq__(): ec4, *note __hash__(): ec5. などのマジックメソッドは自動で生成
されます。

以下はプログラム例です:

     @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<3>,  Prev: データクラス<3>,  Up: 新たなモジュール<7>

1.10.4.3 importlib.resources
............................

The new *note importlib.resources: 7e. 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.10.5 改良されたモジュール
---------------------------

* Menu:

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


File: python.info,  Node: argparse<6>,  Next: asyncio<12>,  Up: 改良されたモジュール<7>

1.10.5.1 argparse
.................

The new *note ArgumentParser.parse_intermixed_args(): ec9. 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<12>,  Next: binascii<2>,  Prev: argparse<6>,  Up: 改良されたモジュール<7>

1.10.5.2 asyncio
................

The *note asyncio: b. module has received many new features, usability
and *note performance improvements: ecb.  Notable changes include:

   * The new *note provisional: 604. *note asyncio.run(): 314. 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(): ecc, *note loop.call_soon_threadsafe(): ecd,
     *note loop.call_later(): ece, *note loop.call_at(): ecf, and *note
     Future.add_done_callback(): ed0. have a new optional keyword-only
     'context' parameter.  *note Tasks: 467. 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(): 469. 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(): ed1. 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(): ed2. 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(): 894. function returns the
     currently running *note Task: 467. instance, and the new *note
     asyncio.all_tasks(): d24. 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: e67. 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(): ed3. function returns the
     currently running loop, and raises a *note RuntimeError: 317. if no
     loop is running.  This is in contrast with *note
     asyncio.get_event_loop(): 573, 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(): ed4. coroutine method
     allows waiting until the stream writer is closed.  The new *note
     StreamWriter.is_closing(): ed5. 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(): ed6. coroutine method allows
     sending files using *note os.sendfile: ed7. when possible.
     (Contributed by Andrew Svetlov in bpo-32410(11).)

   * The new *note Future.get_loop(): ed8. and ‘Task.get_loop()’ methods
     return the instance of the loop on which a task or a future were
     created.  *note Server.get_loop(): ed9. allows doing the same for
     *note asyncio.Server: eda. 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: eda. begin serving.  Previously, the server would
     start serving immediately when created.  The new 'start_serving'
     keyword argument to *note loop.create_server(): edb. and *note
     loop.create_unix_server(): 6d6, as well as *note
     Server.start_serving(): edc, and *note Server.serve_forever(): edd.
     can be used to decouple server instantiation and serving.  The new
     *note Server.is_serving(): ede. 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(): ece. gained
     the new *note when(): edf. method which returns an absolute
     scheduled callback timestamp.  (Contributed by Andrew Svetlov in
     bpo-32741(15).)

   * The *note loop.create_datagram_endpoint(): b1f. method gained
     support for Unix sockets.  (Contributed by Quentin Dawans in
     bpo-31245(16).)

   * The *note asyncio.open_connection(): ee0, *note
     asyncio.start_server(): ee1. functions, *note
     loop.create_connection(): 9fe, *note loop.create_server(): edb,
     *note loop.create_accepted_socket(): bbf. 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(): ee2. 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:
     b1e./*note await: 439. syntax.  (Contributed by Andrew Svetlov in
     bpo-32193(19).)

   * The new *note ReadTransport.is_reading(): ee3. method can be used
     to determine the reading state of the transport.  Additionally,
     calls to *note ReadTransport.resume_reading(): ee4. and *note
     ReadTransport.pause_reading(): ee5. are now idempotent.
     (Contributed by Yury Selivanov in bpo-32356(20).)

   * Loop methods which accept socket paths now support passing *note
     path-like objects: 7a5.  (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: ee6.

   ---------- 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<2>,  Next: calendar<4>,  Prev: asyncio<12>,  Up: 改良されたモジュール<7>

1.10.5.3 binascii
.................

The *note b2a_uu(): ee8. 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<4>,  Next: collections<3>,  Prev: binascii<2>,  Up: 改良されたモジュール<7>

1.10.5.4 calendar
.................

*note HTMLCalendar: 20d. クラスに、作成された 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<3>,  Next: compileall<3>,  Prev: calendar<4>,  Up: 改良されたモジュール<7>

1.10.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<5>,  Prev: collections<3>,  Up: 改良されたモジュール<7>

1.10.5.6 compileall
...................

*note compileall.compile_dir(): eec. learned the new 'invalidation_mode'
parameter, which can be used to enable *note hash-based .pyc
invalidation: e95.  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<5>,  Next: contextlib<4>,  Prev: compileall<3>,  Up: 改良されたモジュール<7>

1.10.5.7 concurrent.futures
...........................

*note ProcessPoolExecutor: 211. と *note ThreadPoolExecutor: b2c. が新し
いコンストラクタ引数 'initializer' と 'initargs' をサポートするようにな
りました。 (Contributed by Antoine Pitrou in bpo-21423(1).)

*note ProcessPoolExecutor: 211. が新しい '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<4>,  Next: cProfile<2>,  Prev: concurrent futures<5>,  Up: 改良されたモジュール<7>

1.10.5.8 contextlib
...................

The new *note nullcontext(): bce. is a simpler and faster no-op context
manager than *note ExitStack: 213.  (Contributed by Jesse-Bakker in
bpo-10049(1).)

The new *note asynccontextmanager(): 21a, *note
AbstractAsyncContextManager: eef, and *note AsyncExitStack: 214. 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<4>,  Up: 改良されたモジュール<7>

1.10.5.9 cProfile
.................

The ‘cProfile’ 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<6>,  Prev: cProfile<2>,  Up: 改良されたモジュール<7>

1.10.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<6>,  Next: dbm<3>,  Prev: crypt,  Up: 改良されたモジュール<7>

1.10.5.11 datetime
..................

The new *note datetime.fromisoformat(): a0f. method constructs a *note
datetime: 6ed. object from a string in one of the formats output by
*note datetime.isoformat(): ef3.  (Contributed by Paul Ganssle in
bpo-15873(1).)

The *note tzinfo: 9dd. 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<3>,  Next: decimal<2>,  Prev: datetime<6>,  Up: 改良されたモジュール<7>

1.10.5.12 dbm
.............

*note dbm.dumb: 35. 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<3>,  Up: 改良されたモジュール<7>

1.10.5.13 decimal
.................

The *note decimal: 39. module now uses *note context variables: e8a. 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.10.5.14 dis
.............

The *note dis(): 49d. 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.10.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<6>,  Prev: distutils<4>,  Up: 改良されたモジュール<7>

1.10.5.16 enum
..............

The *note Enum: a26. 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:
a26. classes will raise a *note TypeError: 29c. (e.g.  ‘1 in Color’);
similarly, attempting to check for non-Flag objects in a *note Flag:
a19. member will raise ‘TypeError’ (e.g.  ‘1 in Perm.RW’); currently,
both operations return *note False: ef9. 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<6>,  Next: gc<7>,  Prev: enum<5>,  Up: 改良されたモジュール<7>

1.10.5.17 functools
...................

*note functools.singledispatch(): a2f. 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<7>,  Next: hmac<3>,  Prev: functools<6>,  Up: 改良されたモジュール<7>

1.10.5.18 gc
............

The new *note gc.freeze(): efc. 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(): efd. functions reverses this operation.  Additionally,
*note gc.get_freeze_count(): efe. 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<2>,  Prev: gc<7>,  Up: 改良されたモジュール<7>

1.10.5.19 hmac
..............

The *note hmac: 6d. module now has an optimized one-shot *note digest():
f00. function, which is up to three times faster than *note HMAC(): f01.
(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<2>,  Next: http server<3>,  Prev: hmac<3>,  Up: 改良されたモジュール<7>

1.10.5.20 http.client
.....................

*note HTTPConnection: 22e. and *note HTTPSConnection: 22f. 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<3>,  Next: idlelib と IDLE,  Prev: http client<2>,  Up: 改良されたモジュール<7>

1.10.5.21 http.server
.....................

*note SimpleHTTPRequestHandler: 235. 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: 235. 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: f04. class uses threads to handle
requests using *note ThreadingMixIn: f05.  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<3>,  Up: 改良されたモジュール<7>

1.10.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.10.5.23 importlib
...................

The ‘importlib.abc.ResourceReader’ ABC was introduced to support the
loading of resources from packages.  See also *note importlib.resources:
e8c.  (Contributed by Barry Warsaw, Brett Cannon in bpo-32248(1).)

*note importlib.reload(): 92d. now raises *note ModuleNotFoundError:
1c9. if the module lacks a spec.  (Contributed by Garvit Khatri in
bpo-29851(2).)

*note importlib.util.find_spec(): 7ad. now raises *note
ModuleNotFoundError: 1c9. instead of *note AttributeError: 1b4. 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(): f08. can be used to compute
the hash of the passed source.  A *note hash-based .pyc file: e95.
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.10.5.24 io
............

The new *note TextIOWrapper.reconfigure(): f0a. 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.10.5.25 ipaddress
...................

The new ‘subnet_of()’ and ‘supernet_of()’ methods of *note
ipaddress.IPv6Network: 719. and *note ipaddress.IPv4Network: 718. 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<5>,  Prev: ipaddress<3>,  Up: 改良されたモジュール<7>

1.10.5.26 itertools
...................

*note itertools.islice(): f0d. now accepts *note integer-like objects:
444. 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<5>,  Next: logging<4>,  Prev: itertools<6>,  Up: 改良されたモジュール<7>

1.10.5.27 locale
................

The new 'monetary' argument to *note locale.format_string(): 932. 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(): 94c. function now always
returns ‘'UTF-8'’ on Android or when in the *note forced UTF-8 mode:
e94.

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10379


File: python.info,  Node: logging<4>,  Next: math<8>,  Prev: locale<5>,  Up: 改良されたモジュール<7>

1.10.5.28 logging
.................

*note Logger: f10. インスタンスが pickle 化できるようになりました。
(Contributed by Vinay Sajip in bpo-30520(1).)

The new *note StreamHandler.setStream(): f11. 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(): f12.
(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<8>,  Next: mimetypes<5>,  Prev: logging<4>,  Up: 改良されたモジュール<7>

1.10.5.29 math
..............

新しい *note math.remainder(): f14. 関数が 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<5>,  Next: msilib,  Prev: math<8>,  Up: 改良されたモジュール<7>

1.10.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<5>,  Up: 改良されたモジュール<7>

1.10.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<10>,  Prev: msilib,  Up: 改良されたモジュール<7>

1.10.5.32 multiprocessing
.........................

The new *note Process.close(): f18. method explicitly closes the process
object and releases all resources associated with it.  *note ValueError:
15a. is raised if the underlying process is still running.  (Contributed
by Antoine Pitrou in bpo-30596(1).)

The new *note Process.kill(): f19. method can be used to terminate the
process using the *note SIGKILL: f1a. signal on Unix.  (Contributed by
Vitor Pereira in bpo-30794(2).)

Non-daemonic threads created by *note Process: 4e5. 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<10>,  Next: pathlib<12>,  Prev: multiprocessing<5>,  Up: 改良されたモジュール<7>

1.10.5.33 os
............

*note os.fwalk(): f1c. now accepts the 'path' argument as *note bytes:
1d2.  (Contributed by Serhiy Storchaka in bpo-28682(1).)

*note os.scandir(): e27. gained support for *note file descriptors: f1d.
(Contributed by Serhiy Storchaka in bpo-25996(2).)

The new *note register_at_fork(): 33a. function allows registering
Python callbacks to be executed at process fork.  (Contributed by
Antoine Pitrou in bpo-16500(3).)

Added *note os.preadv(): f1e. (combine the functionality of *note
os.readv(): f1f. and *note os.pread(): f20.) and *note os.pwritev():
f21. functions (combine the functionality of *note os.writev(): f22. and
*note os.pwrite(): f23.).  (Contributed by Pablo Galindo in
bpo-31368(4).)

The mode argument of *note os.makedirs(): 24b. no longer affects the
file permission bits of newly created intermediate-level directories.
(Contributed by Serhiy Storchaka in bpo-19930(5).)

*note os.dup2(): f24. 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(): 4fc. now contains the *note
st_fstype: f25. 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<12>,  Next: pdb<7>,  Prev: os<10>,  Up: 改良されたモジュール<7>

1.10.5.34 pathlib
.................

The new *note Path.is_mount(): ddf. 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<7>,  Next: py_compile<3>,  Prev: pathlib<12>,  Up: 改良されたモジュール<7>

1.10.5.35 pdb
.............

*note pdb.set_trace(): 501. 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<7>,  Up: 改良されたモジュール<7>

1.10.5.36 py_compile
....................

*note py_compile.compile(): ded. - 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.10.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<6>,  Prev: pydoc<3>,  Up: 改良されたモジュール<7>

1.10.5.38 queue
...............

The new *note SimpleQueue: f2b. 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<6>,  Next: signal<2>,  Prev: queue<2>,  Up: 改良されたモジュール<7>

1.10.5.39 re
............

The flags *note re.ASCII: a22, *note re.LOCALE: f2d. and *note
re.UNICODE: f2e. can be set within the scope of a group.  (Contributed
by Serhiy Storchaka in bpo-31690(1).)

*note re.split(): 7a6. 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: f2d. 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: 84d. 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(): 947. and *note copy.deepcopy(): f2f.  (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<7>,  Prev: re<6>,  Up: 改良されたモジュール<7>

1.10.5.40 signal
................

The new 'warn_on_full_buffer' argument to the *note
signal.set_wakeup_fd(): f31. 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<7>,  Next: socketserver,  Prev: signal<2>,  Up: 改良されたモジュール<7>

1.10.5.41 socket
................

The new *note socket.getblocking(): f33. 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(): f34. function closes the passed socket
file descriptor.  This function should be used instead of *note
os.close(): f35. for better compatibility across platforms.
(Contributed by Christian Heimes in bpo-32454(2).)

The *note socket: d4. module now exposes the *note
socket.TCP_CONGESTION: f36. (Linux 2.6.13), *note
socket.TCP_USER_TIMEOUT: f36. (Linux 2.6.37), and *note
socket.TCP_NOTSENT_LOWAT: f36. (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: f37. 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<8>,  Prev: socket<7>,  Up: 改良されたモジュール<7>

1.10.5.42 socketserver
......................

*note socketserver.ThreadingMixIn.server_close: f39. 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: f3a. class
attribute to *note socketserver.ForkingMixIn: f3b. and *note
socketserver.ThreadingMixIn: f05. classes.  Set the class attribute to
‘False’ to get the pre-3.7 behaviour.


File: python.info,  Node: sqlite3<8>,  Next: ssl<7>,  Prev: socketserver,  Up: 改良されたモジュール<7>

1.10.5.43 sqlite3
.................

*note sqlite3.Connection: 3e6. now exposes the *note backup(): f3d.
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(): 3e7. now accepts any
*note path-like object: 7a5, 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<7>,  Next: string<2>,  Prev: sqlite3<8>,  Up: 改良されたモジュール<7>

1.10.5.44 ssl
.............

The *note ssl: d8. 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: f3f. 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: f40.  (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
     サポート対象プラットフォームからの除外: f41. 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: f42. 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: f43.  (Contributed by Christian Heimes
in bpo-32947(7), bpo-20995(8), bpo-29136(9), bpo-30622(10) and
bpo-33618(11))

*note SSLSocket: cbf. and *note SSLObject: f44. no longer have a public
constructor.  Direct instantiation was never a documented and supported
feature.  Instances must be created with *note SSLContext: 33e. methods
*note wrap_socket(): 938. and *note wrap_bio(): f45.  (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: c4a. and
*note SSLContext.maximum_version: c4b.  Supported protocols are
indicated by several new flags, such as *note HAS_TLSv1_1: f46.
(Contributed by Christian Heimes in bpo-32609(13).)

Added *note ssl.SSLContext.post_handshake_auth: df9. to enable and *note
ssl.SSLSocket.verify_client_post_handshake(): dfa. 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<3>,  Prev: ssl<7>,  Up: 改良されたモジュール<7>

1.10.5.45 string
................

*note string.Template: a7c. 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<3>,  Next: sys<10>,  Prev: string<2>,  Up: 改良されたモジュール<7>

1.10.5.46 subprocess
....................

The *note subprocess.run(): f49. function accepts the new
'capture_output' keyword argument.  When true, stdout and stderr will be
captured.  This is equivalent to passing *note subprocess.PIPE: f4a. as
'stdout' and 'stderr' arguments.  (Contributed by Bo Bayles in
bpo-32102(1).)

The ‘subprocess.run’ function and the *note subprocess.Popen: 6c5.
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: 6c5.  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: d9a. during *note subprocess.call(): f4b, *note
subprocess.run(): f49, or in a *note Popen: 6c5. 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<10>,  Next: time<5>,  Prev: subprocess<3>,  Up: 改良されたモジュール<7>

1.10.5.47 sys
.............

The new *note sys.breakpointhook(): ea3. hook function is called by the
built-in *note breakpoint(): 500.  (Contributed by Barry Warsaw in
bpo-31353(1).)

On Android, the new *note sys.getandroidapilevel(): f4d. returns the
build-time Android API version.  (Contributed by Victor Stinner in
bpo-28740(2).)

The new *note sys.get_coroutine_origin_tracking_depth(): f4e. function
returns the current coroutine origin tracking depth, as set by the new
*note sys.set_coroutine_origin_tracking_depth(): f4f.  *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<7>,  Prev: sys<10>,  Up: 改良されたモジュール<7>

1.10.5.48 time
..............

PEP 564(1) adds six new functions with nanosecond resolution to the
*note time: f7. module:

   * *note time.clock_gettime_ns(): ead.

   * *note time.clock_settime_ns(): eae.

   * *note time.monotonic_ns(): eaf.

   * *note time.perf_counter_ns(): eb0.

   * *note time.process_time_ns(): eb1.

   * *note time.time_ns(): eb2.

New clock identifiers have been added:

   * *note time.CLOCK_BOOTTIME: f51. (Linux): Identical to *note
     time.CLOCK_MONOTONIC: a8d, except it also includes any time that
     the system is suspended.

   * *note time.CLOCK_PROF: f52. (FreeBSD, NetBSD and OpenBSD):
     High-resolution per-process CPU timer.

   * *note time.CLOCK_UPTIME: f53. (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(): d07. and *note time.thread_time_ns():
f54. 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(): f55. 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<7>,  Next: tracemalloc<2>,  Prev: time<5>,  Up: 改良されたモジュール<7>

1.10.5.49 tkinter
.................

The new *note tkinter.ttk.Spinbox: f57. 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<7>,  Prev: tkinter<7>,  Up: 改良されたモジュール<7>

1.10.5.50 tracemalloc
.....................

*note tracemalloc.Traceback: f59. behaves more like regular tracebacks,
sorting the frames from oldest to most recent.  *note
Traceback.format(): f5a. 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<7>,  Next: unicodedata<8>,  Prev: tracemalloc<2>,  Up: 改良されたモジュール<7>

1.10.5.51 types
...............

The new *note WrapperDescriptorType: f5c, *note MethodWrapperType: a3f,
*note MethodDescriptorType: f5d, and *note ClassMethodDescriptorType:
f5e. 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(): f5f. 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<8>,  Next: unittest<9>,  Prev: types<7>,  Up: 改良されたモジュール<7>

1.10.5.52 unicodedata
.....................

The internal *note unicodedata: 10e. 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<9>,  Next: unittest mock,  Prev: unicodedata<8>,  Up: 改良されたモジュール<7>

1.10.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<6>,  Prev: unittest<9>,  Up: 改良されたモジュール<7>

1.10.5.54 unittest.mock
.......................

The *note sentinel: f63. 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(): f64. function allows sealing *note Mock: e12.
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<6>,  Next: uu,  Prev: unittest mock,  Up: 改良されたモジュール<7>

1.10.5.55 urllib.parse
......................

*note urllib.parse.quote(): f66. 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<6>,  Up: 改良されたモジュール<7>

1.10.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<4>,  Prev: uu,  Up: 改良されたモジュール<7>

1.10.5.57 uuid
..............

The new *note UUID.is_safe: f69. 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(): f6a. 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(): f6b.  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<4>,  Next: xml<6>,  Prev: uuid<4>,  Up: 改良されたモジュール<7>

1.10.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: 2f9. and the new CPython-specific *note -X: 183. ‘dev’
     option) are always passed to the warnings machinery via the *note
     sys.warnoptions: 3ad. attribute.

   * warnings filters enabled via the command line or the environment
     now have the following order of precedence:

        * the ‘BytesWarning’ filter for *note -b: 2f9. (or ‘-bb’)

        * any filters specified with the *note -W: 1cb. option

        * any filters specified with the *note PYTHONWARNINGS: 1cc.
          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: 3e3, 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__: e97. 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<6>,  Next: xml etree,  Prev: warnings<4>,  Up: 改良されたモジュール<7>

1.10.5.59 xml
.............

As mitigation against DTD and external entity retrieval, the *note
xml.dom.minidom: 12b. and *note xml.sax: 132. 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<6>,  Up: 改良されたモジュール<7>

1.10.5.60 xml.etree
...................

*note ElementPath: f6f. 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.10.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.10.5.62 zipapp
................

Function *note create_archive(): f72. 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(): f72. 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.10.5.63 zipfile
.................

*note ZipFile: ab6. 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.10.6 C API の変更
-------------------

A new API for thread-local storage has been implemented.  See *note PEP
539; スレッドローカルストレージのための新しい C API: e98. for an
overview and *note Thread-specific storage API: ea7. for a complete
reference.  (Contributed by Masayuki Yamamoto in bpo-25658(1).)

The new *note context variables: e8a. functionality exposes a number of
*note new C APIs: ec2.

The new *note PyImport_GetModule(): f75. function returns the previously
imported module with the given name.  (Contributed by Eric Snow in
bpo-28411(2).)

The new *note Py_RETURN_RICHCOMPARE: f76. macro eases writing rich
comparison functions.  (Contributed by Petr Victorin in bpo-23699(3).)

The new *note Py_UNREACHABLE: f77. macro can be used to mark unreachable
code paths.  (Contributed by Barry Warsaw in bpo-31338(4).)

The *note tracemalloc: 108. now exposes a C API through the new *note
PyTraceMalloc_Track(): f78. and *note PyTraceMalloc_Untrack(): f79.
functions.  (Contributed by Victor Stinner in bpo-30054(5).)

The new *note import__find__load__start: f7a. and *note
import__find__load__done: f7a. 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: 95f, *note
PyGetSetDef: f7b, *note PyStructSequence_Field: f7c, *note
PyStructSequence_Desc: f7d, 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(): c73. and *note
PyUnicode_AsUTF8(): 63e. is now of type ‘const char *’ rather of ‘char
*’.  (Contributed by Serhiy Storchaka in bpo-28769(8).)

The result of *note PyMapping_Keys(): f7e, *note PyMapping_Values():
f7f. and *note PyMapping_Items(): f80. 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(): 64c. and *note
PySlice_AdjustIndices(): 64d.  (Contributed by Serhiy Storchaka in
bpo-27867(10).)

*note PyOS_AfterFork(): 649. is deprecated in favour of the new
functions *note PyOS_BeforeFork(): f81, *note PyOS_AfterFork_Parent():
f82. and *note PyOS_AfterFork_Child(): 64a.  (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(): f83. and *note PyTimeZone_FromOffsetAndName():
f84, and access to the UTC singleton with *note PyDateTime_TimeZone_UTC:
f85.  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(): f86. changed from long to unsigned long.
(Contributed by Serhiy Storchaka in bpo-6532(15).)

*note PyUnicode_AsWideCharString(): c93. now raises a *note ValueError:
15a. 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(): 67a. 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 への移植: e9b. section
in this document and the *note Before Python initialization: f87.
section in the C API documentation for more details.

The new *note PyInterpreterState_GetID(): f88. returns the unique ID for
a given interpreter.  (Contributed by Eric Snow in bpo-29102(17).)

*note Py_DecodeLocale(): f89, *note Py_EncodeLocale(): f8a. now use the
UTF-8 encoding when the *note UTF-8 mode: e94. is enabled.  (Contributed
by Victor Stinner in bpo-29240(18).)

*note PyUnicode_DecodeLocaleAndSize(): f8b. and *note
PyUnicode_EncodeLocale(): f8c. 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(): c90. 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.10.7 Build Changes
--------------------

Support for building ‘--without-threads’ has been removed.  The *note
threading: f6. 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: 2d. 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: d8. 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.10.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(): 573. 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: f8f. callback management has been optimized.
     (Contributed by Yury Selivanov in bpo-32348(9).)

   * *note asyncio.gather(): 9f9. is now up to 15% faster.  (Contributed
     by Yury Selivanov in bpo-32355(10).)

   * *note asyncio.sleep(): e37. 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: e8f, the import time of *note typing:
10d. 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(): f90. and *note list.sort(): f91. have been optimized for
common cases to be up to 40-75% faster.  (Contributed by Elliot
Gorokhovsky in bpo-28685(14).)

*note dict.copy(): f92. is now up to 5.5 times faster.  (Contributed by
Yury Selivanov in bpo-31179(15).)

*note hasattr(): 8e7. and *note getattr(): f93. are now about 4 times
faster when 'name' is not found and 'obj' does not override *note
object.__getattr__(): 8e8. or *note object.__getattribute__(): f94.
(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(): 1da. 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(): f95. and *note
datetime.date.fromtimestamp(): f96. are now up to 30% faster in the
common case.  (Contributed by Paul Ganssle in bpo-32403(19).)

The *note os.fwalk(): f1c. function is now up to 2 times faster thanks
to the use of *note os.scandir(): e27.  (Contributed by Serhiy Storchaka
in bpo-25996(20).)

The speed of the *note shutil.rmtree(): 33d. function has been improved
by 20-40% thanks to the use of the *note os.scandir(): e27. function.
(Contributed by Serhiy Storchaka in bpo-28564(21).)

Optimized case-insensitive matching and searching of *note regular
expressions: c1.  Searching some patterns can now be up to 20 times
faster.  (Contributed by Serhiy Storchaka in bpo-30285(22).)

*note re.compile(): f97. 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(): f98. methods of classes *note
selectors.EpollSelector: f99, *note selectors.PollSelector: f9a. and
*note selectors.DevpollSelector: f9b. 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(): 2fb. and *note issubclass(): 2fc. 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: 494. and *note datetime.datetime: 6ed. 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: 6cb. 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(): f9c. and *note math.erfc(): f9d. 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.10.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: f9f. and *note
     f_trace_opcodes: fa0. 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(): 296. 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.10.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: fa2.
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: 2d4. when
compiled, in Python 3.8 this will be a *note SyntaxError: 189.
(Contributed by Serhiy Storchaka in bpo-10544(1).)

Returning a subclass of *note complex: 330. from *note
object.__complex__(): 9e3. is deprecated and will be an error in future
Python versions.  This makes ‘__complex__()’ consistent with *note
object.__int__(): 443. and *note object.__float__(): d96.  (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.10.11 非推奨の Python モジュール、関数、メソッド
--------------------------------------------------

* Menu:

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


File: python.info,  Node: aifc,  Next: asyncio<13>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.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<13>,  Next: collections<4>,  Prev: aifc,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.11.2 asyncio
.................

Support for directly ‘await’-ing instances of *note asyncio.Lock: e39.
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<4>,  Next: dbm<4>,  Prev: asyncio<13>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.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<4>,  Next: enum<6>,  Prev: collections<4>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.11.4 dbm
.............

*note dbm.dumb: 35. 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<4>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.11.5 enum
..............

In Python 3.8, attempting to check for non-Enum objects in *note Enum:
a26. classes will raise a *note TypeError: 29c. (e.g.  ‘1 in Color’);
similarly, attempting to check for non-Flag objects in a *note Flag:
a19. member will raise ‘TypeError’ (e.g.  ‘1 in Perm.RW’); currently,
both operations return *note False: ef9. 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.10.11.6 gettext
.................

Using non-integer value for selecting a plural form in *note gettext:
66. 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<6>,  Prev: gettext<2>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.11.7 importlib
...................

Methods ‘MetaPathFinder.find_module()’ (replaced by *note
MetaPathFinder.find_spec(): c43.) and ‘PathEntryFinder.find_loader()’
(replaced by *note PathEntryFinder.find_spec(): c46.) both deprecated in
Python 3.4 now emit *note DeprecationWarning: 2d4.  (Contributed by
Matthias Bussonnier in bpo-29576(1).)

The *note importlib.abc.ResourceLoader: fab. 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<6>,  Next: macpath,  Prev: importlib<5>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.11.8 locale
................

‘locale.format()’ has been deprecated, use *note locale.format_string():
932. 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<8>,  Prev: locale<6>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.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<8>,  Next: socket<8>,  Prev: macpath,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.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: f6. 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<8>,  Next: ssl<8>,  Prev: threading<8>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.11.11 socket
.................

The silent argument value truncation in *note socket.htons(): c59. and
*note socket.ntohs(): c5a. 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<8>,  Next: sunau,  Prev: socket<8>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.11.12 ssl
..............

‘ssl.wrap_socket()’ is deprecated.  Use *note
ssl.SSLContext.wrap_socket(): 938. 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<11>,  Prev: ssl<8>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.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<11>,  Next: wave<3>,  Prev: sunau,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.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<3>,  Prev: sys<11>,  Up: 非推奨の Python モジュール、関数、メソッド

1.10.11.15 wave
...............

‘wave.openfp()’ has been deprecated and will be removed in Python 3.9.
Use *note wave.open(): d1b. 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.10.12 C API の非推奨の関数ならびに型
--------------------------------------

Function *note PySlice_GetIndicesEx(): 64b. 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(): 649. has been deprecated.  Use *note
PyOS_BeforeFork(): f81, *note PyOS_AfterFork_Parent(): f82. or *note
PyOS_AfterFork_Child(): 64a. 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.10.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/main/Tools/ssl/multissltests.py


File: python.info,  Node: API と機能の削除<2>,  Next: Module Removals,  Prev: サポート対象プラットフォームからの除外,  Up: What's New In Python 3 7

1.10.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(): 7a7. were deprecated in
     Python 3.5, and will now cause an error.

   * Removed support of the 'exclude' argument in *note
     tarfile.TarFile.add(): fb7.  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(): fb8. instead.

   * *note collections.namedtuple(): 1da. 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(): 5f6, *note float(): 32f, *note list(): 4e0.
     and *note tuple(): 1d9. no longer take keyword arguments.  The
     first argument of *note int(): 32e. 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(): fb9. 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: ca. and
     ‘_overlapped’ modules as ‘asyncio.selectors’ and
     ‘asyncio._overlapped’.  Replace ‘from asyncio import selectors’
     with ‘import selectors’.

   * Direct instantiation of *note ssl.SSLSocket: cbf. and *note
     ssl.SSLObject: f44. 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: 33e.  (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.10.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.10.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.10.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.10.17.1 Python の挙動の変更
.............................

   * *note async: b1e. and *note await: 439. names are now reserved
     keywords.  Code using these names as identifiers will now raise a
     *note SyntaxError: 189.  (Contributed by Jelle Zijlstra in
     bpo-30406(1).)

   * PEP 479(2) is enabled for all code in Python 3.7, meaning that
     *note StopIteration: fbe. exceptions raised directly or indirectly
     in coroutines and generators are transformed into *note
     RuntimeError: 317. exceptions.  (Contributed by Yury Selivanov in
     bpo-32670(3).)

   * *note object.__aiter__(): fbf. 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: 189, 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: 4d1. switch, the initial working directory
     is now added to *note sys.path: 19f, 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.10.17.2 Python API の変更
...........................

   * *note socketserver.ThreadingMixIn.server_close: f39. now waits
     until all non-daemon threads complete.  Set the new *note
     socketserver.ThreadingMixIn.block_on_close: f3a. 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: f39. now waits until
     all child processes complete.  Set the new *note
     socketserver.ForkingMixIn.block_on_close: f3a. 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(): fc1. 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(): fc2. now raises a *note ValueError:
     15a. 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(): fc3.
     is now *note positional-only: e4b.  Passing it as a keyword
     argument was deprecated in Python 3.5.  (Contributed by Serhiy
     Storchaka in bpo-29193(7).)

   * Attributes *note key: fc4, *note value: fc5. and *note coded_value:
     fc6. of class *note http.cookies.Morsel: fc7. are now read-only.
     Assigning to them was deprecated in Python 3.5.  Use the *note
     set(): fc8. method for setting them.  (Contributed by Serhiy
     Storchaka in bpo-29192(8).)

   * The 'mode' argument of *note os.makedirs(): 24b. 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: fc9. type is now *note str: 1ea.
     instead of *note bytes: 1d2.  (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: d4, calling *note
     socket.fromshare(): fca. on a socket created by *note socket.share:
     fcb. in older Python versions is not supported.

   * ‘repr’ for *note BaseException: 9bd. 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: d98. has changed to include
     the keyword arguments in the output.  (Contributed by Utkarsh
     Upadhyay in bpo-30302(13).)

   * Because *note shutil.rmtree(): 33d. is now implemented using the
     *note os.scandir(): e27. 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: 84d. 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: c1.
     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: 84d. 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(): 7a7. 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(): fcc. 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: f59. frames are now sorted from oldest
     to most recent to be more consistent with *note traceback: 107.
     (Contributed by Jesse Bakker in bpo-32121(19).)

   * On OSes that support *note socket.SOCK_NONBLOCK: fcd. or *note
     socket.SOCK_CLOEXEC: fce. bit flags, the *note socket.type: fcf. 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: 6c5. was changed from *note False: ef9. to *note
     True: fd0. 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: fd1.

   * *note importlib.machinery.PathFinder.invalidate_caches(): fd2. -
     which implicitly affects *note importlib.invalidate_caches(): fd3.
     - now deletes entries in *note sys.path_importer_cache: 9e0. which
     are set to ‘None’.  (Contributed by Brett Cannon in bpo-33169(21).)

   * In *note asyncio: b, *note loop.sock_recv(): fd4, *note
     loop.sock_sendall(): fd5, *note loop.sock_accept(): fd6, *note
     loop.getaddrinfo(): fd7, *note loop.getnameinfo(): fd8. have been
     changed to be proper coroutine methods to match their
     documentation.  Previously, these methods returned *note
     asyncio.Future: f8f. instances.  (Contributed by Yury Selivanov in
     bpo-32327(22).)

   * *note asyncio.Server.sockets: fd9. 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: fc9. is now a *note str: 1ea. instance instead
     of a *note bytes: 1d2. 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(): fda.
     (Contributed by Anthony Sottile in bpo-26510(25).)

   * *note ast.literal_eval(): fdb. is now stricter.  Addition and
     subtraction of arbitrary numbers are no longer allowed.
     (Contributed by Serhiy Storchaka in bpo-31778(26).)

   * *note Calendar.itermonthdates: fdc. 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: fdd. and
     *note Calendar.itermonthdays4: fde. can be used.  The new methods
     return tuples and are not restricted by the range supported by
     *note datetime.date: 494.  (Contributed by Alexander Belopolsky in
     bpo-28292(27).)

   * *note collections.ChainMap: fdf. now preserves the order of the
     underlying mappings.  (Contributed by Raymond Hettinger in
     bpo-32792(28).)

   * The ‘submit()’ method of *note
     concurrent.futures.ThreadPoolExecutor: b2c. and *note
     concurrent.futures.ProcessPoolExecutor: 211. now raises a *note
     RuntimeError: 317. if called during interpreter shutdown.
     (Contributed by Mark Nemec in bpo-33097(29).)

   * The *note configparser.ConfigParser: 6ea. 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.10.17.3 C API の変更
......................

The function *note PySlice_GetIndicesEx(): 64b. is considered unsafe for
resizable sequences.  If the slice indices are not instances of *note
int: 32e, 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(): 64c. and *note
PySlice_AdjustIndices(): 64d.  (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.10.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.10.17.5 Windows-only Changes
..............................

The file used to override *note sys.path: 19f. is now called
‘<python-executable>._pth’ instead of ‘'sys.path'’.  See *note
モジュールの検索: fe3. 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.10.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: 621. to a value greater than one is
no longer sufficient to both emit *note BytesWarning: 2fa. 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.10.18 Python 3.7.1 での重要な変更点
-------------------------------------

Starting in 3.7.1, *note Py_Initialize(): 67a. now consistently reads
and respects all of the same environment settings as *note Py_Main():
fe6. (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: 624. to 1 before calling ‘Py_Initialize()’.

In 3.7.1 the C API for Context Variables *note was updated: fe7. to use
*note PyObject: 1a6. pointers.  See also bpo-34762(2).

In 3.7.1 the *note tokenize: 104. 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.10.19 Python 3.7.2 での重要な変更点
-------------------------------------

In 3.7.2, *note venv: 11a. 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.10.20 Python 3.7.6 での重要な変更点
-------------------------------------

セキュリティ上の重大な懸念により、*note
asyncio.loop.create_datagram_endpoint(): b1f. での '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.10.21 Python 3.7.10 での重要な変更点
--------------------------------------

Earlier Python versions allowed using both ‘;’ and ‘&’ as query
parameter separators in *note urllib.parse.parse_qs(): 590. and *note
urllib.parse.parse_qsl(): 58f.  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.10.22 Notable changes in Python 3.7.11
----------------------------------------

A security fix alters the *note ftplib.FTP: cce. 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(): 113. 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.10.23 Notable security feature in 3.7.14
------------------------------------------

Converting between *note int: 32e. and *note str: 1ea. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 15a. 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: e2. APIs.  See the *note
integer string conversion length limitation: 9f1. 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.11 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.11.1 概要 - リリースハイライト
--------------------------------

新たな文法機能:

   * *note PEP 498: ff1.、フォーマット済み文字列リテラル。

   * *note PEP 515: ff2.、数値リテラル内のアンダースコア。

   * *note PEP 526: ff3.、変数アノテーションの文法。

   * *note PEP 525: ff4.、非同期ジェネレータ。

   * *note PEP 530: ff5.: 非同期内包表記

新たなライブラリモジュール:

   * *note secrets: c8.: *note PEP 506 - 標準ライブラリーに Secrets
     モジュールを追加: ff6.

CPython の実装の改善:

   * *note dict: e90. 型は、 Raymond Hettinger(1) の提案に基づき、 PyPy
     dict implementation(2) と同様の *note よりコンパクトな表現: ff7. を
     使うように再実装されました。 その結果、 Python 3.5 と比較して辞書が
     使うメモリ 20% から 25% 減少しました。

   * *note 新しいプロトコル: ff8. により、クラス生成のカスタマイズがより
     簡単になりました。

   * クラス属性の定義の順番が *note 保持されるようになりました: ff9.。

   * ‘**kwargs’ の要素の順序が、キーワード引数が関数に渡されたときの
     *note 順序に一致した: ffa. ものになりました。

   * DTrace と SystemTap の *note プローブのサポート: ffb. が追加されま
     した。

   * 新しい *note PYTHONMALLOC: ffc.  環境変数が、インタープリタのメモリ
     確保とメモリアクセスエラーのデバッグに使えるようになりました。

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

   * 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: ffd. has been implemented to
     support *note path-like objects: 7a5.  All standard library
     functions operating on paths have been updated to work with the new
     protocol.

   * *note datetime: 33. モジュールで *note 地域時間の曖昧さ回避: ffe. が
     サポートされました。

   * *note typing: 10d. モジュールに数多くの *note 改善: fff. がなされま
     した。

   * *note tracemalloc: 108. モジュールが大幅に書き直され、改善されたメ
     モリ割り当てエラーの診断プログラムの提供だけでなく、 *note
     ResourceWarning: 754. の出力メッセージも改善されています。 より詳し
     いことは *note PYTHONMALLOC 節: ffc. を参照してください。

セキュリティの改善:

   * The new *note secrets: c8. 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(): 936. now blocks until the system
     urandom entropy pool is initialized to increase the security.  See
     the PEP 524(3) for the rationale.

   * *note hashlib: 6b. および *note ssl: d8. モジュールは OpenSSL 1.1.0
     をサポートしました。

   * *note ssl: d8. モジュールのデフォルトの設定と機能群が改善されました
     。

   * *note hashlib: 6b. モジュールで BLAKE2, SHA-3, SHAKE ハッシュアルゴ
     リズムと *note scrypt(): 1000. キー導出関数がサポートされるようにな
     りました。

Windows の改善:

   * *note PEP 528: 1001. および *note PEP 529: 1002.、 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: 1003. 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: fe3. for more information.

   * A ‘python36.zip’ file now works as a landmark to infer *note
     PYTHONHOME: 3b5.  See *note the documentation: fe3. 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.11.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.11.2.1 PEP 498: フォーマット済み文字列リテラル
................................................

PEP 498(1) は新たな種類の文字列リテラル、すなわち 'f-strings'、 *note
フォーマット済み文字列リテラル: 441. を導入しました。

フォーマット済み文字列リテラルはプレフィックスに ‘'f'’ をとり *note
str.format(): a17. による書式文字列に似ています。これらには中括弧で囲ま
れた置換フィールドがあります。置換フィールドは実行時に評価される式で、
*note format(): 440. プロトコルによってフォーマットされます:

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

   ---------- 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.11.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.11.2.3 PEP 515: 数値リテラル内のアンダースコア
................................................

PEP 515(1) により、可読性向上のために数値リテラル内でアンダースコアを使
えるようになりました。例えば:

     >>> 1_000_000_000_000_000
     1000000000000000
     >>> 0x_FF_FF_FF_FF
     4294967295

単一のアンダースコアは数字の間と基数指定子の後で許されます。先頭、末尾、
あるいは複数のアンダースコアを列内で使用することはできません。

The *note string formatting: 704. 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.11.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.11.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.11.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(): 44a. calls to work
correctly from *note __init_subclass__(): a27. implementations, custom
metaclasses must ensure that the new ‘__classcell__’ namespace entry is
propagated to ‘type.__new__’ (as described in *note
クラスオブジェクトの作成: 100c.).

参考
....

PEP 487(1) - Simpler customization of class creation

     PEP 著と実装 Martin Teichmann.

*note Feature documentation: 100d.

   ---------- 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.11.2.7 PEP 487: 記述子プロトコルの改善
........................................

PEP 487(1) extends the descriptor protocol to include the new optional
*note __set_name__(): 1010. 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: 1011.

   ---------- 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.11.2.8 PEP 519: ファイルシステムパスプロトコルの追加
......................................................

File system paths have historically been represented as *note str: 1ea.
or *note bytes: 1d2. 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: 32e. 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:
1013. has been defined.  By implementing the *note __fspath__(): 1014.
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:
1ea. or *note bytes: 1d2. object.  This means an object is considered
*note path-like: 7a5. if it implements ‘os.PathLike’ or is a ‘str’ or
‘bytes’ object which represents a file system path.  Code can use *note
os.fspath(): 1015, *note os.fsdecode(): 1016, or *note os.fsencode():
1017. to explicitly get a ‘str’ and/or ‘bytes’ representation of a
path-like object.

The built-in *note open(): 333. function has been updated to accept
*note os.PathLike: 1013. 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: 8b1. 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: 7a5. without any code changes, or at least
very minimal ones (e.g.  calling *note os.fspath(): 1015. 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: 4f5. 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.11.2.9 PEP 495: 地域時間の曖昧さ回避
......................................

世界の大抵の場所で、地域時計が1日繰り下げられることがこれまでありました
し、これからもあるでしょう。そういった時に、同じ日に同じ時間を指す区間が
あります。そういった状況では地域時計が表示する (あるいは Python の
datetime インスタンスが格納する) 情報では、時間内の特定の瞬間を識別する
ことはできません。

PEP 495(1) は時間内の地域時間が同じ二つの瞬間を区別するために、新たな
'fold' 属性を *note datetime.datetime: 6ed. インスタンスならびに *note
datetime.time: 495. クラスに追加しました。

     >>> 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: 1019. 属性の値は、曖昧な場合に時間内の二番目の (年代的) 瞬間
を表しているものを除く全てのインスタンスで ‘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.11.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(): 101b, which now defaults
to ‘'utf-8'’.

Applications that do not use str to represent paths should use *note
os.fsencode(): 1017. and *note os.fsdecode(): 1016. to ensure their
bytes are correctly encoded.  To revert to the previous behaviour, set
*note PYTHONLEGACYWINDOWSFSENCODING: 15e. or call
‘sys._enablelegacywindowsfsencoding()’.

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.11.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: 101d.

参考
....

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.11.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__: 101f. attribute.

Also, the effective default class 'execution' namespace (returned from
*note type.__prepare__(): 1020.) 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.11.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.11.2.14 新たな dict 実装
..........................

The *note dict: e90. 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(): 193. 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.11.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.11.2.16 PYTHONMALLOC 環境変数
...............................

新たな環境変数 *note PYTHONMALLOC: 1026. により Python メモリアロケータ
の設定とデバッグフックの導入ができます。

‘PYTHONMALLOC=debug’ を使用してリリースモードでコンパイルされた Python で
、Python メモリアロケータにデバッグフックを導入できるようになりました。
デバッグフックの効果は:

   * 新たに割り当てられたメモリを ‘0xCB’ バイトで埋めます

   * 解放されたメモリを ‘0xDB’ バイトで埋めます

   * Python メモリアロケータ API の違反を検知します。例えば *note
     PyMem_Malloc(): 1027. で割り当てられたメモリブロックに *note
     PyObject_Free(): 1028. を呼ぶこと。

   * バッファ開始前の書き込み (バッファアンダーフロー) を検知します

   * バッファ終端後の書き込み (バッファオーバーフロー) を検知します

   * Check that the *note GIL: 68c. is held when allocator functions of
     *note PYMEM_DOMAIN_OBJ: 1029. (ex: *note PyObject_Malloc(): 102a.)
     and *note PYMEM_DOMAIN_MEM: 102b. (ex: *note PyMem_Malloc(): 1027.)
     domains are called.

Checking if the GIL is held is also a new feature of Python 3.6.

See the *note PyMem_SetupDebugHooks(): 102c. 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: 108. 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.11.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: 3e3. or
providing application-specific profiling/debugging code.

詳細については *note DTrace と SystemTap で CPython を測定する: 102e. を
参照してください。

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.11.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: 451.

   * It is now possible to set a *note special method: 1030. to ‘None’
     to indicate that the corresponding operation is not available.  For
     example, if a class sets *note __iter__(): 1031. 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: 1032. for an example).  (Contributed by Emanuel Barry in
     bpo-26823(2).)

   * Import now raises the new exception *note ModuleNotFoundError: 1c9.
     (subclass of *note ImportError: 1c8.) 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.11.4 新たなモジュール
-----------------------

* Menu:

* secrets::


File: python.info,  Node: secrets,  Up: 新たなモジュール<8>

1.11.4.1 secrets
................

The main purpose of the new *note secrets: c8. 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:
     c0. module should 'NOT' be used for security purposes.  Use *note
     secrets: c8. on Python 3.6+ and *note os.urandom(): 936. 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.11.5 改良されたモジュール
---------------------------

* Menu:

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


File: python.info,  Node: array<4>,  Next: ast<8>,  Up: 改良されたモジュール<8>

1.11.5.1 array
..............

Exhausted iterators of *note array.array: 6cb. 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<8>,  Next: asyncio<14>,  Prev: array<4>,  Up: 改良されたモジュール<8>

1.11.5.2 ast
............

The new *note ast.Constant: 570. 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<14>,  Next: binascii<3>,  Prev: ast<8>,  Up: 改良されたモジュール<8>

1.11.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(): 573. 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(): 1039. function and all functions that
     use it, such as *note loop.run_until_complete(): 103a, now accept
     all kinds of *note awaitable objects: 6d5.  (Contributed by Yury
     Selivanov.)

   * 他のスレッドからコルーチンをイベントループに送信するための新たな
     *note run_coroutine_threadsafe(): c5c. 関数。 (Contributed by
     Vincent Michel.)

   * New *note Transport.is_closing(): 103b. method to check if the
     transport is closing or closed.  (Contributed by Yury Selivanov.)

   * The *note loop.create_server(): edb. method can now accept a list
     of hosts.  (Contributed by Yann Sionneau.)

   * New *note loop.create_future(): 103c. method to create Future
     objects.  This allows alternative event loop implementations, such
     as uvloop(2), to provide a faster *note asyncio.Future: f8f.
     implementation.  (Contributed by Yury Selivanov in bpo-27041(3).)

   * New *note loop.get_exception_handler(): 103d. method to get the
     current exception handler.  (Contributed by Yury Selivanov in
     bpo-27040(4).)

   * 新しい *note StreamReader.readuntil(): 6dc. メソッドで、区切りとな
     るバイトの並びが出てくるまでストリームからデータを読み取れるように
     なりました。 (Contributed by Mark Korenberg.)

   * The performance of *note StreamReader.readexactly(): 103e. has been
     improved.  (Contributed by Mark Korenberg in bpo-28370(5).)

   * The *note loop.getaddrinfo(): fd7. 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(): 103f. 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: 1040. will now raise *note TypeError:
     29c. when passed an instance of the *note StopIteration: fbe.
     exception.  (Contributed by Chris Angelico in bpo-26221(7).)

   * New *note loop.connect_accepted_socket(): bbf. 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(): 1041. to properly close
     pending asynchronous generators before closing the loop.
     (Contributed by Yury Selivanov in bpo-28003(10).)

   * *note Future: f8f. and *note Task: 467. 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<3>,  Next: cmath,  Prev: asyncio<14>,  Up: 改良されたモジュール<8>

1.11.5.4 binascii
.................

The *note b2a_base64(): 207. 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<5>,  Prev: binascii<3>,  Up: 改良されたモジュール<8>

1.11.5.5 cmath
..............

The new *note cmath.tau: 1044. ('τ') constant has been added.
(Contributed by Lisa Roach in bpo-12345(1), see PEP 628(2) for details.)

新たに定数が追加されました。 *note math.inf: 1045. と *note math.nan:
a58. に対応する *note cmath.inf: 1046. と *note cmath.nan: 1047.。複素数
の repr が使用する書式に対応する *note cmath.infj: 1048. と *note
cmath.nanj: 1049.。 (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<5>,  Next: concurrent futures<6>,  Prev: cmath,  Up: 改良されたモジュール<8>

1.11.5.6 collections
....................

The new *note Collection: 104b. 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: 104c. abstract base class represents iterable
classes that also provide the *note __reversed__(): 104d. method.
(Contributed by Ivan Levkivskyi in bpo-25987(2).)

The new *note AsyncGenerator: 104e. abstract base class represents
asynchronous generators.  (Contributed by Yury Selivanov in
bpo-28720(3).)

The *note namedtuple(): 1da. function now accepts an optional keyword
argument 'module', which, when specified, is used for the *note
__module__: 811. attribute of the returned named tuple class.
(Contributed by Raymond Hettinger in bpo-17941(4).)

The 'verbose' and 'rename' arguments for *note namedtuple(): 1da. are
now keyword-only.  (Contributed by Raymond Hettinger in bpo-25628(5).)

Recursive *note collections.deque: 9db. 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<6>,  Next: contextlib<5>,  Prev: collections<5>,  Up: 改良されたモジュール<8>

1.11.5.7 concurrent.futures
...........................

The *note ThreadPoolExecutor: b2c. 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<5>,  Next: datetime<7>,  Prev: concurrent futures<6>,  Up: 改良されたモジュール<8>

1.11.5.8 contextlib
...................

The *note contextlib.AbstractContextManager: 1051. 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: 10d. module as *note typing.ContextManager:
1052.  (Contributed by Brett Cannon in bpo-25609(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25609


File: python.info,  Node: datetime<7>,  Next: decimal<3>,  Prev: contextlib<5>,  Up: 改良されたモジュール<8>

1.11.5.9 datetime
.................

The *note datetime: 6ed. and *note time: 495. classes have the new *note
fold: 1054. attribute used to disambiguate local time when necessary.
Many functions in the *note datetime: 33. have been updated to support
local time disambiguation.  See *note Local Time Disambiguation: ffe.
section for more information.  (Contributed by Alexander Belopolsky in
bpo-24773(1).)

The *note datetime.strftime(): 1055. and *note date.strftime(): 1056.
methods now support ISO 8601 date directives ‘%G’, ‘%u’ and ‘%V’.
(Contributed by Ashley Anderson in bpo-12006(2).)

The *note datetime.isoformat(): ef3. 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(): 1057. 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<7>,  Up: 改良されたモジュール<8>

1.11.5.10 decimal
.................

New *note Decimal.as_integer_ratio(): 1059. method that returns a pair
‘(n, d)’ of integers that represent the given *note Decimal: 1cd.
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<4>,  Prev: decimal<3>,  Up: 改良されたモジュール<8>

1.11.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<4>,  Next: エンコーディング<2>,  Prev: distutils<5>,  Up: 改良されたモジュール<8>

1.11.5.12 email
...............

The new email API, enabled via the 'policy' keyword to various
constructors, is no longer provisional.  The *note email: 3e.
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: 48. classes now all accept an optional 'policy'
keyword.  (Contributed by Berker Peksag in bpo-27331(2).)

The *note DecodedGenerator: 105c. now supports the 'policy' keyword.

There is a new *note policy: 52. attribute, *note message_factory: 105d,
that controls what class is used by default when the parser creates new
message objects.  For the *note email.policy.compat32: 105e. policy this
is *note Message: 786, for the new policies it is *note EmailMessage:
221.  (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<4>,  Up: 改良されたモジュール<8>

1.11.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<4>,  Prev: エンコーディング<2>,  Up: 改良されたモジュール<8>

1.11.5.14 enum
..............

Two new enumeration base classes have been added to the *note enum: 59.
module: *note Flag: a19. and *note IntFlag: 1061.  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: 1061. class for their constants.

The new *note enum.auto: 1062. 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<4>,  Next: fileinput<2>,  Prev: enum<7>,  Up: 改良されたモジュール<8>

1.11.5.15 faulthandler
......................

On Windows, the *note faulthandler: 5b. module now installs a handler
for Windows exceptions: see *note faulthandler.enable(): 224.
(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<6>,  Prev: faulthandler<4>,  Up: 改良されたモジュール<8>

1.11.5.16 fileinput
...................

*note hook_encoded(): 1065. 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<6>,  Next: http client<3>,  Prev: fileinput<2>,  Up: 改良されたモジュール<8>

1.11.5.17 hashlib
.................

*note hashlib: 6b. 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(): a36.
and *note blake2s(): a37. 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(): 1067, *note sha3_256(): 1068,
*note sha3_384(): 1069, *note sha3_512(): 106a, and SHAKE hash functions
*note shake_128(): 106b. and *note shake_256(): 106c. 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(): 1000. 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<3>,  Next: idlelib と IDLE<2>,  Prev: hashlib<6>,  Up: 改良されたモジュール<8>

1.11.5.18 http.client
.....................

*note HTTPConnection.request(): 106e. and *note endheaders(): 106f. 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<3>,  Up: 改良されたモジュール<8>

1.11.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<8>,  Prev: idlelib と IDLE<2>,  Up: 改良されたモジュール<8>

1.11.5.20 importlib
...................

Import now raises the new exception *note ModuleNotFoundError: 1c9.
(subclass of *note ImportError: 1c8.) 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: 1072. now calls *note create_module():
1073. on the wrapped loader, removing the restriction that *note
importlib.machinery.BuiltinImporter: 1074. and *note
importlib.machinery.ExtensionFileLoader: 1075. couldn't be used with
‘importlib.util.LazyLoader’.

*note importlib.util.cache_from_source(): 338, *note
importlib.util.source_from_cache(): 92e, and *note
importlib.util.spec_from_file_location(): 1076. now accept a *note
path-like object: 7a5.

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15767


File: python.info,  Node: inspect<8>,  Next: json<3>,  Prev: importlib<6>,  Up: 改良されたモジュール<8>

1.11.5.21 inspect
.................

The *note inspect.signature(): 4c4. 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(): b24. has been reversed.  While this
function is convenient for single/source Python 2/3 code bases, the
richer *note inspect.signature(): 4c4. 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<3>,  Next: logging<5>,  Prev: inspect<8>,  Up: 改良されたモジュール<8>

1.11.5.22 json
..............

*note json.load(): 239. と *note json.loads(): 23a. は、バイナリ入力をサ
ポートしました。エンコード済みの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<5>,  Next: math<9>,  Prev: json<3>,  Up: 改良されたモジュール<8>

1.11.5.23 logging
.................

新しく *note WatchedFileHandler.reopenIfNeeded(): 107a. メソッドが追加さ
れ、ログファイルを再オープンする必要があるかどうかをチェックする機能が追
加れました。(Contributed by Marian Horban in bpo-24884(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24884


File: python.info,  Node: math<9>,  Next: multiprocessing<6>,  Prev: logging<5>,  Up: 改良されたモジュール<8>

1.11.5.24 math
..............

The tau ('τ') constant has been added to the *note math: 91. 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<11>,  Prev: math<9>,  Up: 改良されたモジュール<8>

1.11.5.25 multiprocessing
.........................

*note Proxy Objects: 4df. returned by *note multiprocessing.Manager():
4e3. 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<11>,  Next: pathlib<13>,  Prev: multiprocessing<6>,  Up: 改良されたモジュール<8>

1.11.5.26 os
............

See the summary of *note PEP 519: ffd. for details on how the *note os:
a5. and *note os.path: a6. modules now support *note path-like objects:
7a5.

*note scandir(): e27. now supports *note bytes: 1d2. paths on Windows.

A new *note close(): 107e. method allows explicitly closing a *note
scandir(): e27. iterator.  The ‘scandir()’ iterator now supports the
*note context manager: 47f. protocol.  If a ‘scandir()’ iterator is
neither exhausted nor explicitly closed a *note ResourceWarning: 754.
will be emitted in its destructor.  (Contributed by Serhiy Storchaka in
bpo-25994(1).)

On Linux, *note os.urandom(): 936. 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(): 107f. 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<13>,  Next: pdb<8>,  Prev: os<11>,  Up: 改良されたモジュール<8>

1.11.5.27 pathlib
.................

*note pathlib: a8. は *note path-like objects: 7a5. をサポートしました。
(Contributed by Brett Cannon in bpo-27186(1).)

詳細は、 *note PEP 519: ffd. の要約を参照してください。

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27186


File: python.info,  Node: pdb<8>,  Next: pickle<4>,  Prev: pathlib<13>,  Up: 改良されたモジュール<8>

1.11.5.28 pdb
.............

*note Pdb: 502. クラスのコンストラクタに、新しくオプション引数 'readrc'
が増えました。この引数は、 ‘.pdbrc’ ファイルを読み込むかどうかを指定しま
す。


File: python.info,  Node: pickle<4>,  Next: pickletools<2>,  Prev: pdb<8>,  Up: 改良されたモジュール<8>

1.11.5.29 pickle
................

Objects that need ‘__new__’ called with keyword arguments can now be
pickled using *note pickle protocols: 50a. 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<2>,  Next: pydoc<4>,  Prev: pickle<4>,  Up: 改良されたモジュール<8>

1.11.5.30 pickletools
.....................

*note pickletools.dis(): 1084. 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<2>,  Up: 改良されたモジュール<8>

1.11.5.31 pydoc
...............

The *note pydoc: bd. module has learned to respect the ‘MANPAGER’
environment variable.  (Contributed by Matthias Klose in bpo-8637(1).)

*note help(): cad. and *note pydoc: bd. 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<7>,  Prev: pydoc<4>,  Up: 改良されたモジュール<8>

1.11.5.32 random
................

The new *note choices(): 1087. 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<7>,  Next: readline,  Prev: random<4>,  Up: 改良されたモジュール<8>

1.11.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: 1089. objects now support *note index-like objects: 444. 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<7>,  Up: 改良されたモジュール<8>

1.11.5.34 readline
..................

Added *note set_auto_history(): 108b. 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.11.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.11.5.36 shlex
...............

The *note shlex: 108e. has much *note improved shell compatibility:
108f. 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<9>,  Prev: shlex<2>,  Up: 改良されたモジュール<8>

1.11.5.37 site
..............

When specifying paths to add to *note sys.path: 19f. 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<9>,  Next: socket<9>,  Prev: site<3>,  Up: 改良されたモジュール<8>

1.11.5.38 sqlite3
.................

*note sqlite3.Cursor.lastrowid: 1092. は、 ‘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<9>,  Next: socketserver<2>,  Prev: sqlite3<9>,  Up: 改良されたモジュール<8>

1.11.5.39 socket
................

The *note ioctl(): 1094. function now supports the *note
SIO_LOOPBACK_FAST_PATH: 1095. control code.  (Contributed by Daniel
Stokes in bpo-26536(1).)

The *note getsockopt(): 1096. constants ‘SO_DOMAIN’, ‘SO_PROTOCOL’,
‘SO_PEERSEC’, and ‘SO_PASSSEC’ are now supported.  (Contributed by
Christian Heimes in bpo-26907(2).)

The *note setsockopt(): 1097. 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: 1098. to
interface with Linux Kernel crypto API. ‘ALG_*’, ‘SOL_ALG’ and *note
sendmsg_afalg(): 1099. 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<9>,  Prev: socket<9>,  Up: 改良されたモジュール<8>

1.11.5.40 socketserver
......................

Servers based on the *note socketserver: d5. module, including those
defined in *note http.server: 75, *note xmlrpc.server: 138. and *note
wsgiref.simple_server: 124, now support the *note context manager: 47f.
protocol.  (Contributed by Aviv Palivoda in bpo-26404(1).)

The *note wfile: 109b. attribute of *note StreamRequestHandler: 109c.
classes now implements the *note io.BufferedIOBase: a88. writable
interface.  In particular, calling *note write(): 109d. 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<9>,  Next: statistics<5>,  Prev: socketserver<2>,  Up: 改良されたモジュール<8>

1.11.5.41 ssl
.............

*note ssl: d8. 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: 33e. 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: 109f. 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(): 10a0. 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: 10a1. and
*note IntFlag: 1061.  (Contributed by Christian Heimes in bpo-28025(6).)

Server and client-side specific TLS protocols for *note SSLContext: 33e.
were added.  (Contributed by Christian Heimes in bpo-28085(7).)

Added *note ssl.SSLContext.post_handshake_auth: df9. to enable and *note
ssl.SSLSocket.verify_client_post_handshake(): dfa. 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<9>,  Up: 改良されたモジュール<8>

1.11.5.42 statistics
....................

A new *note harmonic_mean(): 10a3. 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<4>,  Prev: statistics<5>,  Up: 改良されたモジュール<8>

1.11.5.43 struct
................

*note struct: de. 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<4>,  Next: sys<12>,  Prev: struct<2>,  Up: 改良されたモジュール<8>

1.11.5.44 subprocess
....................

*note subprocess.Popen: 6c5. destructor now emits a *note
ResourceWarning: 754. warning if the child process is still running.
Use the context manager protocol (‘with proc: ...’) or explicitly call
the *note wait(): 272. method to read the exit status of the child
process.  (Contributed by Victor Stinner in bpo-26741(1).)

The *note subprocess.Popen: 6c5. 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<12>,  Next: telnetlib,  Prev: subprocess<4>,  Up: 改良されたモジュール<8>

1.11.5.45 sys
.............

The new *note getfilesystemencodeerrors(): 10a7. 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(): 10a8.
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<12>,  Up: 改良されたモジュール<8>

1.11.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<2>,  Prev: telnetlib,  Up: 改良されたモジュール<8>

1.11.5.47 time
..............

The *note struct_time: 10ab. attributes ‘tm_gmtoff’ and ‘tm_zone’ are
now available on all platforms.


File: python.info,  Node: timeit<2>,  Next: tkinter<8>,  Prev: time<6>,  Up: 改良されたモジュール<8>

1.11.5.48 timeit
................

The new *note Timer.autorange(): 28e. convenience method has been added
to call *note Timer.timeit(): 10ad. 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: f8. 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<8>,  Next: traceback<4>,  Prev: timeit<2>,  Up: 改良されたモジュール<8>

1.11.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<8>,  Up: 改良されたモジュール<8>

1.11.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<12>,  Prev: traceback<4>,  Up: 改良されたモジュール<8>

1.11.5.51 tracemalloc
.....................

The *note tracemalloc: 108. module now supports tracing memory
allocations in multiple different address spaces.

The new *note DomainFilter: 10b1. 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<12>,  Next: unicodedata<9>,  Prev: tracemalloc<3>,  Up: 改良されたモジュール<8>

1.11.5.52 typing
................

Since the *note typing: 10d. module is *note provisional: 604, all
changes introduced in Python 3.6 have also been backported to Python
3.5.x.

The *note typing: 10d. 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: 1052. class has been added for
representing *note contextlib.AbstractContextManager: 1051.
(Contributed by Brett Cannon in bpo-25609(2).)

The *note typing.Collection: 10b3. class has been added for representing
*note collections.abc.Collection: 104b.  (Contributed by Ivan Levkivskyi
in bpo-27598(3).)

The *note typing.ClassVar: 774. 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: 10b4. 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(): 10b5. 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<9>,  Next: unittest mock<2>,  Prev: typing<12>,  Up: 改良されたモジュール<8>

1.11.5.53 unicodedata
.....................

The *note unicodedata: 10e. 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<9>,  Up: 改良されたモジュール<8>

1.11.5.54 unittest.mock
.......................

*note Mock: e12. クラスは、次の改善が行われました。

   * *note Mock.assert_called(): 10b8. と *note
     Mock.assert_called_once(): 10b9. は、mockオブジェクトが呼ばれたかど
     うかを確認します。 (Contributed by Amit Saha in bpo-26323(1).)

   * The *note Mock.reset_mock(): 10ba. 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.11.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: 10bc. 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<6>,  Prev: urllib request,  Up: 改良されたモジュール<8>

1.11.5.56 urllib.robotparser
............................

*note RobotFileParser: 10be. 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<6>,  Next: warnings<5>,  Prev: urllib robotparser,  Up: 改良されたモジュール<8>

1.11.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<5>,  Next: winreg,  Prev: venv<6>,  Up: 改良されたモジュール<8>

1.11.5.58 warnings
..................

A new optional 'source' parameter has been added to the *note
warnings.warn_explicit(): 2b6. function: the destroyed object which
emitted a *note ResourceWarning: 754.  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: 754. warning is logged, the *note
tracemalloc: 108. 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: 108. is tracing Python memory allocations and if the
*note warnings: 11b. 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<5>,  Up: 改良されたモジュール<8>

1.11.5.59 winreg
................

Added the 64-bit integer type *note REG_QWORD: 10c2.  (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.11.5.60 winsound
..................

Allowed keyword arguments to be passed to *note Beep: 10c4, *note
MessageBeep: 10c5, and *note PlaySound: 10c6. (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.11.5.61 xmlrpc.client
.......................

The *note xmlrpc.client: 137. 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<3>,  Prev: xmlrpc client,  Up: 改良されたモジュール<8>

1.11.5.62 zipfile
.................

A new *note ZipInfo.from_file(): 10c9. class method allows making a
*note ZipInfo: 54e. instance from a filesystem file.  A new *note
ZipInfo.is_dir(): 10ca. 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(): 850. 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<3>,  Prev: zipfile<4>,  Up: 改良されたモジュール<8>

1.11.5.63 zlib
..............

The *note compress(): a33. and *note decompress(): 10cc. 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.11.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: f8f. class now has an optimized C
     implementation.  (Contributed by Yury Selivanov and INADA Naoki in
     bpo-26081(3).)

   * The *note asyncio.Task: 467. class now has an optimized C
     implementation.  (Contributed by Yury Selivanov in bpo-28544(4).)

   * Various implementation improvements in the *note typing: 10d.
     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(): 43b. and *note bytearray.fromhex():
     43c.: 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(): 1027. domain
     (*note PYMEM_DOMAIN_MEM: 102b.) now use the *note pymalloc memory
     allocator: 3e1. 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(): 10ce. and *note pickle.loads(): 10cf. are now
     up to 10% faster when deserializing many small objects (Contributed
     by Victor Stinner in bpo-27056(14)).

   * Passing *note keyword arguments: 10d0. to a function has an
     overhead in comparison with passing *note positional arguments:
     10d1.  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(): 2df. and *note iglob(): be5. functions in
     the *note glob: 67. 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(): e27.; it is now about 1.5-4 times faster.
     (Contributed by Serhiy Storchaka in bpo-26032(17)).

   * *note xml.etree.ElementTree: 12e. 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: 1ce. 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.11.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: 68c. must now be held when allocator functions of
     *note PYMEM_DOMAIN_OBJ: 1029. (ex: *note PyObject_Malloc(): 102a.)
     and *note PYMEM_DOMAIN_MEM: 102b. (ex: *note PyMem_Malloc(): 1027.)
     domains are called.

   * New *note Py_FinalizeEx(): 10d3. API which indicates if flushing
     buffered data failed.  (Contributed by Martin Panter in
     bpo-5319(5).)

   * *note PyArg_ParseTupleAndKeywords(): 81e. now supports *note
     positional-only parameters: e4b.  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(): 10d4. function allows
     for specifying a subclass of *note ImportError: 1c8. to raise.
     (Contributed by Eric Snow in bpo-15767(8).)

   * The new *note PyErr_ResourceWarning(): 10d5. function can be used
     to generate a *note ResourceWarning: 754. providing the source of
     the resource allocation.  (Contributed by Victor Stinner in
     bpo-26567(9).)

   * The new *note PyOS_FSPath(): 10d6. function returns the file system
     representation of a *note path-like object: 7a5.  (Contributed by
     Brett Cannon in bpo-27186(10).)

   * The *note PyUnicode_FSConverter(): 10d7. and *note
     PyUnicode_FSDecoder(): 980. functions will now accept *note
     path-like objects: 7a5.

   ---------- 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.11.8 その他の改善
-------------------

   * *note -version: 10d9. (短縮系: *note -V: 6ad.) が2回与えられた場合
     、Python は *note sys.version: 6ae. で詳細な情報を出力します。

          $ ./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.11.9 非推奨
-------------

* Menu:

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


File: python.info,  Node: 新たなキーワード,  Next: 非推奨の Python 挙動,  Up: 非推奨<10>

1.11.9.1 新たなキーワード
.........................

‘async’ および ‘await’ を変数、クラス、関数、モジュール名として使用する
ことは推奨されません。‘async’ と ‘await’ は Python 3.5 で PEP 492(1) に
より導入され、Python 3.7 で正式にキーワードとなります。Python 3.6 から
‘async’ や ‘await’ を変数名に使用すると *note DeprecationWarning: 2d4. が
出ます。

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

   (1) https://peps.python.org/pep-0492/


File: python.info,  Node: 非推奨の Python 挙動,  Next: 非推奨の Python モジュール、関数、メソッド<2>,  Prev: 新たなキーワード,  Up: 非推奨<10>

1.11.9.2 非推奨の Python 挙動
.............................

Raising the *note StopIteration: fbe. exception inside a generator will
now generate a *note DeprecationWarning: 2d4, and will trigger a *note
RuntimeError: 317. in Python 3.7.  See *note PEP 479; ジェネレータ内の
StopIteration の処理の変更: 10dd. for details.

The *note __aiter__(): fbf. 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:
2d4.  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: 2d4.  Although this will
eventually become a *note SyntaxError: 189, 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: 90c.  (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<7>,  Prev: 非推奨の Python 挙動,  Up: 非推奨<10>

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

* Menu:

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


File: python.info,  Node: asynchat,  Next: asyncore,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.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<5>,  Prev: asynchat,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.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<5>,  Next: distutils<6>,  Prev: asyncore,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.9.6 dbm
............

Unlike other *note dbm: 34. implementations, the *note dbm.dumb: 35.
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<5>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.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.11.9.8 grp
............

*note getgrgid(): 10e4. の非整数の引数のサポートは非推奨になりました。
(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<12>,  Prev: grp,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.9.9 importlib
..................

The ‘importlib.machinery.SourceFileLoader.load_module’ and
‘importlib.machinery.SourcelessFileLoader.load_module’ methods are now
deprecated.  They were the only remaining implementations of
‘importlib.abc.Loader.load_module’ in *note importlib: 7a. that had not
been deprecated in previous versions of Python in favour of *note
importlib.abc.Loader.exec_module(): c44.

The *note importlib.machinery.WindowsRegistryFinder: 10e6. class is now
deprecated.  As of 3.6.0, it is still added to *note sys.meta_path:
10e7. by default (on Windows), but this may change in future releases.


File: python.info,  Node: os<12>,  Next: re<8>,  Prev: importlib<7>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.9.10 os
............

Undocumented support of general *note bytes-like objects: 43d. as paths
in *note os: a5. functions, *note compile(): 1d3. 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<8>,  Next: ssl<10>,  Prev: os<12>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.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<10>,  Next: tkinter<9>,  Prev: re<8>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.9.12 ssl
.............

OpenSSLの0.9.8, 1.0.0 ,1.0.1 は非推奨となっており、長い間サポートされて
いません。将来的に *note ssl: d8. モジュールは、OpenSSLの1.0.2 もしくは
1.1.0が必須になります。

SSL-related arguments like ‘certfile’, ‘keyfile’ and ‘check_hostname’ in
*note ftplib: 61, *note http.client: 72, *note imaplib: 77, *note
poplib: b1, and *note smtplib: d2. 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: d8. 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<9>,  Next: venv<7>,  Prev: ssl<10>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.9.13 tkinter
.................

The ‘tkinter.tix’ module is now deprecated.  *note tkinter: f9. users
should use *note tkinter.ttk: 102. instead.


File: python.info,  Node: venv<7>,  Prev: tkinter<9>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.11.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<7>,  Next: C API の非推奨の関数ならびに型<2>,  Prev: 非推奨の Python モジュール、関数、メソッド<2>,  Up: 非推奨<10>

1.11.9.15 xml
.............

   * As mitigation against DTD and external entity retrieval, the *note
     xml.dom.minidom: 12b. and *note xml.sax: 132. 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<7>,  Up: 非推奨<10>

1.11.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: 10f0. instead.


File: python.info,  Node: 非推奨のビルドオプション,  Prev: C API の非推奨の関数ならびに型<2>,  Up: 非推奨<10>

1.11.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.11.10 削除
------------

* Menu:

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


File: python.info,  Node: API と機能の削除<3>,  Up: 削除<10>

1.11.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(): 7a7. they are still allowed, but deprecated.  The
     *note re.LOCALE: f2d. flag can now only be used with binary
     patterns.

   * ‘inspect.getmoduleinfo()’ was removed (was deprecated since CPython
     3.3).  *note inspect.getmodulename(): 10f4. 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: 107. 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: f9. widget classes were removed (corresponding Tk
     commands were obsolete since Tk 4.0).

   * The *note open(): 850. method of the *note zipfile.ZipFile: ab6.
     class no longer supports the ‘'U'’ mode (was deprecated since
     Python 3.4).  Use *note io.TextIOWrapper: ba0. for reading
     compressed text files in *note universal newlines: 10f5. 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.11.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.11.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.11.11.2 Python API の変更
...........................

   * *note open(): 333. will no longer allow combining the ‘'U'’ mode
     flag with ‘'+'’.  (Contributed by Jeff Balogh and John O'Connor in
     bpo-2091(1).)

   * *note sqlite3: d7. no longer implicitly commits an open transaction
     before DDL statements.

   * On Linux, *note os.urandom(): 936. now blocks until the system
     urandom entropy pool is initialized to increase the security.

   * When *note importlib.abc.Loader.exec_module(): c44. is defined,
     *note importlib.abc.Loader.create_module(): 1073. must also be
     defined.

   * *note PyErr_SetImportError(): 10f9. now sets *note TypeError: 29c.
     when its 'msg' argument is not set.  Previously only ‘NULL’ was
     returned.

   * The format of the ‘codeobject.co_lnotab’ 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: b91,
     ‘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(): 2ae.
     and *note urlparse(): 2af. results now raises *note ValueError:
     15a. for out-of-range values, rather than returning *note None:
     a6a.  See bpo-20059(4).

   * The ‘imp’ module now raises a *note DeprecationWarning: 2d4.
     instead of *note PendingDeprecationWarning: c9f.

   * The following modules have had missing APIs added to their *note
     __all__: 10fa. attributes to match the documented APIs: *note
     calendar: 15, ‘cgi’, *note csv: 2c, *note ElementTree: 12e, *note
     enum: 59, *note fileinput: 5e, *note ftplib: 61, *note logging: 8a,
     *note mailbox: 8e, *note mimetypes: 93, *note optparse: a4, *note
     plistlib: b0, ‘smtpd’, *note subprocess: df, *note tarfile: e7,
     *note threading: f6. and *note wave: 11c.  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: 90c.
     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: 1c8. will be raised.  Previously, *note
     SystemError: 3f1. could be raised.  (Contributed by Brett Cannon in
     bpo-18018(7).)

   * Servers based on the *note socketserver: d5. module, including
     those defined in *note http.server: 75, *note xmlrpc.server: 138.
     and *note wsgiref.simple_server: 124, now only catch exceptions
     derived from *note Exception: da2.  Therefore if a request handler
     raises an exception like *note SystemExit: 10fb. or *note
     KeyboardInterrupt: d9a, *note handle_error(): 10fc. 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: 10fd. instead
     of *note KeyError: 7e5. if the user doesn't have privileges.

   * The *note socket.socket.close(): 10fe. 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(): 10ff, *note dumps():
     254, *note load(): 239. and *note loads(): 23a. functions and *note
     JSONEncoder: 1100. and *note JSONDecoder: 1101. class constructors
     in the *note json: 85. module are now *note keyword-only: 7a9.
     (Contributed by Serhiy Storchaka in bpo-18726(10).)

   * ‘type.__new__’ をオーバーライドしていない *note type: 191. のサブク
     ラスは、オブジェクトの型を得るのに１引数形式を利用することができま
     せん。

   * As part of PEP 487(11), the handling of keyword arguments passed to
     *note type: 191. (other than the metaclass hint, ‘metaclass’) is
     now consistently delegated to *note object.__init_subclass__():
     a27.  This means that *note type.__new__: 987. and *note
     type.__init__: 306. 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: 44a.)
     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: 114. module and the *note
     http.client.HTTPConnection.request(): 106e. 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: dad. now returns rows of type *note
     OrderedDict: 9da.  (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(): 1da.
     are now keyword-only.  (Contributed by Raymond Hettinger in
     bpo-25628(15).)

   * On Linux, *note ctypes.util.find_library(): 1102. now looks in
     ‘LD_LIBRARY_PATH’ for shared libraries.  (Contributed by Vinay
     Sajip in bpo-9998(16).)

   * The *note imaplib.IMAP4: 322. 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(): 1103. 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(): 1104. and *note
     pkgutil.walk_packages(): fc2. functions now return *note
     ModuleInfo: 1105. named tuples.  (Contributed by Ramchandra Apte in
     bpo-17211(19).)

   * *note re.sub(): 7a7. 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: ab6. will now raise *note
     NotImplementedError: 5a1. for unrecognized compression values.
     Previously a plain *note RuntimeError: 317. was raised.
     Additionally, calling ‘ZipFile’ methods on a closed ZipFile or
     calling the *note write(): 1106. method on a ZipFile created with
     mode ‘'r'’ will raise a *note ValueError: 15a.  Previously, a
     ‘RuntimeError’ was raised in those scenarios.

   * when custom metaclasses are combined with zero-argument *note
     super(): 44a. 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: 2d4. in Python 3.6 and a *note RuntimeError:
     317. in Python 3.8.

   * With the introduction of *note ModuleNotFoundError: 1c9, import
     system consumers may start expecting import system replacements to
     raise that more specific exception when appropriate, rather than
     the less-specific *note ImportError: 1c8.  To provide future
     compatibility with such consumers, implementers of alternative
     import systems that completely replace *note __import__(): caa.
     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.11.11.3 C API の変更
......................

   * The *note PyMem_Malloc(): 1027. allocator family now uses the *note
     pymalloc allocator: 3e1. rather than the system ‘malloc()’.
     Applications calling ‘PyMem_Malloc()’ without holding the GIL can
     now crash.  Set the *note PYTHONMALLOC: 1026. environment variable
     to ‘debug’ to validate the usage of memory allocators in your
     application.  See bpo-26249(1).

   * *note Py_Exit(): 1108. (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.11.11.4 CPython バイトコードの変更
....................................

There have been several major changes to the *note bytecode: 6b9. 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: 110a. opcodes as
     part of the *note formatted string literal: ff1. 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:
     110b, ‘CALL_FUNCTION’, ‘CALL_FUNCTION_KW’ and
     ‘BUILD_MAP_UNPACK_WITH_CALL’ opcodes have been modified, the new
     *note CALL_FUNCTION_EX: 110c. 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: 110d. and ‘STORE_ANNOTATION’
     opcodes have been added to support the new *note variable
     annotation: 110e. 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.11.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.11.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/main/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.11.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.11.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.11.14 Notable changes in Python 3.6.5
---------------------------------------

The *note locale.localeconv(): fc1. 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.11.15 Notable changes in Python 3.6.7
---------------------------------------

*note xml.dom.minidom: 12b. and *note xml.sax: 132. modules no longer
process external entities by default.  See also gh-61441(1).

In 3.6.7 the *note tokenize: 104. 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.11.16 Notable changes in Python 3.6.10
----------------------------------------

セキュリティ上の重大な懸念により、*note
asyncio.loop.create_datagram_endpoint(): b1f. での '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.11.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(): 590. and *note
urllib.parse.parse_qsl(): 58f.  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.11.18 Notable changes in Python 3.6.14
----------------------------------------

A security fix alters the *note ftplib.FTP: cce. 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(): 113. 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.12 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.12.1 概要 - リリースハイライト
--------------------------------

新たな文法機能:

   * *note PEP 492: 111c.、コルーチン、async 構文と await 構文。

   * *note PEP 465: 111d.、新たな行列乗算演算子 ‘a @ b’。

   * *note PEP 448: 111e.、追加可能なアンパックへの一般化。

新たなライブラリモジュール:

   * *note typing: 10d.: *note PEP 484 - 型ヒント: 111f.。

   * *note zipapp: 139.: *note PEP 441 Python ZIP
     アプリケーションのサポートの改善: 1120.。

新たな組み込み機能:

   * ‘bytes % args’, ‘bytearray % args’: *note PEP 461: 1121. - bytes と
     bytearray に ‘%’ 書式化を追加。

   * 新たな *note bytes.hex(): 1122, *note bytearray.hex(): 1123. *note
     memoryview.hex(): 1124. メソッド。 (Contributed by Arnon Yaari in
     bpo-9951(1).)

   * *note memoryview: 1dd. クラスが、(複数次元の場合を含んだ) タプルの
     添字をサポートするようになりました。 (bpo-23632(2) におけるAntoine
     Pitrouによる貢献です。)

   * ジェネレータに ‘gi_yieldfrom’ 属性が新しく追加され、これは ‘yield
     from’ 式で反復処理されるオブジェクトを返します。 (Contributed by
     Benno Leslie and Yury Selivanov in bpo-24450(3).)

   * 新たな例外 *note RecursionError: 1125. が最長再帰深度に到達した際に
     送出されるようになりました。 (Contributed by Georg Brandl in
     bpo-19235(4).)

CPython の実装の改善:

   * ‘LC_TYPE’ ロケールが POSIX ロケール (‘C’ ロケール) のとき、 *note
     sys.stdin: 94f. および *note sys.stdout: ea0. は ‘strict’ エラーハ
     ンドラではなく ‘surrogateescape’ を使うようになりました。
     (Contributed by Victor Stinner in bpo-19977(5).)

   * ‘.pyo’ ファイルは使われなくなり、‘.pyc’ ファイル名に最適化レベルが
     明示される、より柔軟な仕組みに置き換えられました。(*note PEP 488
     の概要: 1126. を参照してください。)

   * 組み込みおよび拡張モジュールが多段階で初期化されるようになりました
     。これは Python モジュールのロード方法と同じです。 (*note PEP 489
     の概要: 1127. を参照してください。)

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

   * *note collections.OrderedDict: 9da. が *note C で実装されました:
     1128.。 これにより 4 倍から 100 倍高速になりました。

   * *note ssl: d8. モジュールに *note メモリ BIO サポート: 1129. が追加
     されました。これにより SSL プロトコルの処理と ネットワーク IO が分
     離されました。

   * 新たな関数 *note os.scandir(): e27. はディレクトリー走査の *note
     改良され非常に速い方法: 112a. を提供します。

   * *note functools.lru_cache(): db7. の大部分が *note C で再実装:
     112b. され、性能が大幅に向上しました。

   * 新たな関数 *note subprocess.run(): f49. は *note
     サブプロセスを実行する合理的な方法: 112c. を提供します。

   * *note traceback: 107. モジュールは性能と開発者の利便性が向上し、大
     いに *note 強化され: 112d. ました。

セキュリティの改善:

   * SSLv3 が標準ライブラリ全体を通じて無効化されました。ただし *note
     ssl.SSLContext: 33e. を手動でインスタンス化することによってなら今で
     も有効には出来ます。 (詳細に関しては bpo-22638(6) を参照してくださ
     い。この変更は CPython 3.4 と 2.7 にもバックポートされました。)

   * 潜在的なインジェクション攻撃からの防御のために、HTTP クッキーの解析
     がより厳密に行われるようになりました。 (Contributed by Antoine
     Pitrou in bpo-22796(7).)

Windows の改善:

   * Windows のインストーラが新しくなり古い MSI を置き換えました。さらに
     詳しい情報は *note Windows で Python を使う: e71. をご覧ください。

   * 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.12.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.12.2.1 PEP 492 - コルーチン、 async と await 構文
...................................................

PEP 492(1) で *note 待機可能オブジェクト: 6d5.、*note コルーチン関数:
1130.、*note 非同期イテレーション: 1131.、*note
非同期コンテキストマネージャ: 9d7. が追加され、Python における非同期プロ
グラミングを大幅に向上しました。

コルーチン関数は新たな構文 *note async def: 9d4. を用いて定義されます:

     >>> async def coro():
     ...     return 'spam'

Inside a coroutine function, the new *note await: 439. 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:
6d5. protocol by defining the *note __await__(): 1132. method.

PEP 492 により *note async for: e74. 文も追加されました。非同期イテラブ
ルを反復するのに便利です。

新たな構文を用いた初歩的な 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: e74. と *note async with: 216. は両方とも、 *note async
def: 9d4. で宣言されたコルーチン関数内でのみ使えることに注意してください
。

コルーチン関数は *note asyncio loop: 1133. のような適したイベントループ
内で実行させるためのものです。

     注釈: 
     バージョン 3.5.2 で変更: CPython 3.5.2 以降では、 ‘__aiter__’ は
     *note 非同期イテレータ: 6d3. を直接返せます。 *note awaitable: 6d5.
     オブジェクトを返すと *note PendingDeprecationWarning: c9f. が送出さ
     れます。

     より詳細なことはドキュメントの *note 非同期イテレータ (Asynchronous
     Iterator): 1134. 節を参照してください。

参考
....

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.12.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__(): 1136, *note
__rmatmul__(): 1137, and *note __imatmul__(): 1138. 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.12.2.3 PEP 448 - 追加可能なアンパックへの一般化
.................................................

PEP 448(1) によって、 ‘*’ イテラブルアンパック演算子と ‘**’ 辞書アンパッ
ク演算子の利用方法が拡張されました。 *note 関数呼び出し: 113a. で任意の
数のアンパックで使えるようになりました:

     >>> 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 式のリスト: 113b. および *note 辞書表示: 113c. を参照してください
):

     >>> *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.12.2.4 PEP 461 - bytes および bytearray のパーセント書式化サポート
....................................................................

PEP 461(1) によって、 *note bytes: 1d2. と *note bytearray: 1d1. に ‘%’
*note 補間演算子: 113e. のサポートが追加されます。

補間は通常は文字列演算だと考えられていますが、 ‘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.12.2.5 PEP 484 - 型ヒント
...........................

関数アノテーション構文はバージョン 3.0 ( PEP 3107(1)) から Python の仕様
になりましたが、アノテーションのセマンティクスは未定義のままでした。

経験的に、関数アノテーションの使用の大半は関数の引数と返り値の型ヒントを
提供するためのものです。 標準ライブラリーが型アノテーションの基本的な定
義とツールを持てば、Python ユーザに有益であることは明白となりました。

PEP 484(2) introduces a *note provisional module: 604. 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__: 672. 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: a9f. という全ての型と互
換な (すなわち代入可能) 特殊型をサポートしています。

参考
....

   * *note typing: 10d. モジュールのドキュメント

   * 
     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.12.2.6 PEP 471 - os.scandir() 関数 - より良く、速いディレクトリイテレータ
...........................................................................

PEP 471(1) により新しいディレクトリ反復関数 *note os.scandir(): e27. が
標準ライブラリへ追加されました。 さらに、 ‘scandir’ を使い *note
os.walk(): 8be. が実装され、 POSIX システムで3倍から5倍、 Windows システ
ムで7倍から20倍高速になりました。 これは主に、ディレクトリツリーを走査す
るのに必要な *note os.stat(): 4fc. の呼び出し回数をかなり減らしたことに
よるものです。

これの他にも、 ‘scandir’ ファイル名のリストではなくイテレータを返すよう
になり、非常に大きなディレクトリ群の走査をするときのメモリ効率が改善され
ました。

次の例では、 *note os.scandir(): e27. を使用して、与えられた 'path' 内の
先頭が ‘'.'’ でないすべてのファイル (ディレクトリを除く) を表示します。
*note entry.is_file(): 1141. を呼び出しても、通常は追加のシステムコール
は行われません:

     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.12.2.7 PEP 475: EINTR で失敗したシステムコールの再試行
........................................................

An *note errno.EINTR: 1144. 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: 1145. 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: 1145. を扱う負担をなくし、標準ライブラリを含む Python
プログラムをより堅牢にします。 シグナルハンドラが例外を投げない場合にの
みシステムコールを再試行することに注意してください。

下記は、シグナルで中断された際に再試行をするようになった関数のリストです
:

   * *note open(): 333. および *note io.open(): 930.;

   * *note faulthandler: 5b. モジュールの関数;

   * *note os: a5. モジュールの関数: *note fchdir(): 1146, *note
     fchmod(): 733, *note fchown(): 1147, *note fdatasync(): 1148, *note
     fstat(): 1149, *note fstatvfs(): 114a, *note fsync(): 114b, *note
     ftruncate(): 114c, *note mkfifo(): 114d, *note mknod(): 114e, *note
     open(): 114f, *note posix_fadvise(): 1150, *note posix_fallocate():
     1151, *note pread(): f20, *note pwrite(): f23, *note read(): 1152,
     *note readv(): f1f, *note sendfile(): ed7, *note wait3(): 1153,
     *note wait4(): 1154, *note wait(): 1155, *note waitid(): 1156,
     *note waitpid(): 1157, *note write(): 1158, *note writev(): f22.;

   * special cases: *note os.close(): f35. and *note os.dup2(): f24. now
     ignore *note EINTR: 1144. errors; the syscall is not retried (see
     the PEP for the rationale);

   * *note select: c9. モジュール関数: *note devpoll.poll(): 1159, *note
     epoll.poll(): 115a, *note kqueue.control(): 115b, *note
     poll.poll(): 115c, *note select(): 115d.;

   * *note socket: 115e. クラスのメソッド: *note accept(): 115f, *note
     connect(): 1160. (ノンブロッキングソケットを除く), *note recv():
     1161, *note recvfrom(): 1162, *note recvmsg(): 1163, *note send():
     1164, *note sendall(): 1165, *note sendmsg(): 891, *note sendto():
     1166.;

   * *note signal.sigtimedwait(): 1167. および *note
     signal.sigwaitinfo(): 1168.;

   * *note time.sleep(): a91.

参考
....

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.12.2.8 PEP 479: ジェネレータ内の StopIteration の処理の変更
.............................................................

Python 3.4 以前では、ジェネレータと *note StopIteration: fbe. の組み合わ
せが驚くような動作をし、分かりづらいバグを隠すことがありました。 以前は
、ジェネレータ関数内でうっかり ‘StopIteration’ が送出されると、そのジェ
ネレータの反復処理をしているループ構造が終端に達したと解釈されていました
。

PEP 479(1) によってジェネレータのこの振る舞いが変更されました: ジェネレ
ータ内部で ‘StopIteration’ 例外が送出されたときは、ジェネレータのフレー
ムを抜ける前に *note RuntimeError: 317. に置き換えられます。 この変更の
一番の目的は、保護されていない *note next(): bb9. の呼び出しが
‘StopIteration’ を送出し、ジェネレータを回している反復処理が黙って終了し
てしまうような状況で、デバッグをしやすくすることです。 これは ‘yield
from’ 構造と組み合わさったとき特に有害になります。

これは後方互換性の無い変更ですので、この新しい振る舞いを有効にするには
*note __future__: 116a. のインポートが必要です:

     >>> 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: fbe. 例外が送出されたときには *note
PendingDeprecationWarning: c9f. が送出されます。

参考
....

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.12.2.9 PEP 485: 近似的に等しいことを調べる関数
................................................

PEP 485(1) により、2値が互いに近似的に等しいか "近い" ことを調べる関数
*note math.isclose(): 116d. 及び *note cmath.isclose(): 116e. が追加され
ました。 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.12.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.12.2.11 PEP 488: PYO ファイルの廃止
.....................................

PEP 488(1) は ‘.pyo’ ファイルという概念を廃止しました。 つまり、‘.pyc’ フ
ァイルは最適化されていないバイトコードと最適化されたバイトコードの両方を
指すということです。 バイトコードファイルを何度も再生成する必要がないよ
う、バイトコードが最適化されたときは ‘.pyc’ ファイルは任意の ‘opt-’ タグ
を名前に持つようになりました。 この副作用で、*note -O: 438. と *note
-OO: 1172. のいずれかで実行した場合でも、バイトコードのファイル名が衝突
しないようになりました。 それにより、‘-O’ および ‘-OO’ で生成したバイト
コードは同時に存在できるようになりました。 *note
importlib.util.cache_from_source(): 338. にの 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.12.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.12.3 その他の言語変更
-----------------------

Python 言語コアに小さな変更がいくつか行われました:

   * ‘"namereplace"’ エラーハンドラが追加されました。
     ‘"backslashreplace"’ エラーハンドラはデコードと変換で動くようになり
     ました。 (Contributed by Serhiy Storchaka in bpo-19676(1) and
     bpo-22286(2).)

   * *note -b: 2f9. オプションが *note bytes: 1d2. と *note int: 32e. の
     比較に影響するようになりました。 (Contributed by Serhiy Storchaka
     in bpo-23681(3).)

   * 新たなカザフ語 ‘kz1048’ 及びタジク語 ‘koi8_t’ *note コーデックス:
     1175.。 (Contributed by Serhiy Storchaka in bpo-22682(4) and
     bpo-22681(5).)

   * プロパティのドキュメンテーション文字列が書き込み可能になりました。
     これは特に *note collections.namedtuple(): 1da. のドキュメンテーシ
     ョン文字列で有用です。 (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.12.4 新たなモジュール
-----------------------

* Menu:

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


File: python.info,  Node: typing<13>,  Next: zipapp<2>,  Up: 新たなモジュール<9>

1.12.4.1 typing
...............

The new *note typing: 10d. *note provisional: 604. module provides
standard definitions and tools for function type annotations.  See *note
Type Hints: 111f. for more information.


File: python.info,  Node: zipapp<2>,  Prev: typing<13>,  Up: 新たなモジュール<9>

1.12.4.2 zipapp
...............

新たな *note zipapp: 139. モジュール ( 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.12.5 改良されたモジュール
---------------------------

* Menu:

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


File: python.info,  Node: argparse<7>,  Next: asyncio<15>,  Up: 改良されたモジュール<9>

1.12.5.1 argparse
.................

*note ArgumentParser: 1e7. クラスは、*note allow_abbrev: 117b. を
‘False’ に設定することでロングオプションの *note 短縮使用: 117c. を無効
化できるようになりました。 (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<15>,  Next: bz2,  Prev: argparse<7>,  Up: 改良されたモジュール<9>

1.12.5.2 asyncio
................

Since the *note asyncio: b. module is *note provisional: 604, 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(): 117e. と *note
     loop.get_debug(): 117f. メソッド。 (Contributed by Victor Stinner.)

   * proactor イベントループが SSL をサポートしました。 (Contributed by
     Antoine Pitrou and Victor Stinner in bpo-22560(1).)

   * イベントループが閉じているかどうか調べる新たな *note
     loop.is_closed(): 1180. メソッド。 (Contributed by Victor Stinner
     in bpo-21326(2).)

   * コルーチンの新しい *note Task: 467. を便利に作成しスケジュールする
     ための新たな *note loop.create_task(): 46a.。 ‘create_task’ メソッ
     ドは コルーチンをタスクにラップする全ての asyncio 関数、たとえば
     *note asyncio.wait(): 896, *note asyncio.gather(): 9f9.、にも使われ
     ます。 (Contributed by Victor Stinner.)

   * A new *note transport.get_write_buffer_limits(): 1181. 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(): 1039.  (Contributed by Yury Selivanov.)

   * *note loop.create_task(): 46a. メソッドが使うタスクファクトリーをカ
     スタマイズするための新たな *note loop.set_task_factory(): 468. メソ
     ッドと *note loop.get_task_factory(): 1182. メソッド。 (Yury
     Selivanovによる貢献。)

   * 新たな *note Queue.join(): 1183. および *note Queue.task_done():
     1184. キューメソッド。(Contributed by Victor Stinner.)

   * ‘JoinableQueue’ クラスは *note asyncio.Queue: e3d. クラスにより削除
     されました。 (Contributed by Victor Stinner.)

3.5.1 での変更:

   * The *note ensure_future(): 1039. function and all functions that
     use it, such as *note loop.run_until_complete(): 103a, now accept
     all kinds of *note awaitable objects: 6d5.  (Contributed by Yury
     Selivanov.)

   * 他のスレッドからコルーチンをイベントループに送信するための新たな
     *note run_coroutine_threadsafe(): c5c. 関数。 (Contributed by
     Vincent Michel.)

   * New *note Transport.is_closing(): 103b. method to check if the
     transport is closing or closed.  (Contributed by Yury Selivanov.)

   * The *note loop.create_server(): edb. method can now accept a list
     of hosts.  (Contributed by Yann Sionneau.)

3.5.2 での変更:

   * New *note loop.create_future(): 103c. method to create Future
     objects.  This allows alternative event loop implementations, such
     as uvloop(3), to provide a faster *note asyncio.Future: f8f.
     implementation.  (Contributed by Yury Selivanov.)

   * New *note loop.get_exception_handler(): 103d. method to get the
     current exception handler.  (Contributed by Yury Selivanov.)

   * 新しい *note StreamReader.readuntil(): 6dc. メソッドで、区切りとな
     るバイトの並びが出てくるまでストリームからデータを読み取れるように
     なりました。 (Contributed by Mark Korenberg.)

   * The *note loop.create_connection(): 9fe. and *note
     loop.create_server(): edb. 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): 1185. 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<15>,  Up: 改良されたモジュール<9>

1.12.5.3 bz2
............

*note BZ2Decompressor.decompress: 1187. メソッドがオプション引数
'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.12.5.4 cgi
............

The ‘FieldStorage’ class now supports the *note context manager: 47f.
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.12.5.5 cmath
..............

新たな関数 *note isclose(): 116e. は近似的に等しいかどうかを判断する方法
を提供します。 (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<6>,  Prev: cmath<2>,  Up: 改良されたモジュール<9>

1.12.5.6 コード
...............

*note InteractiveInterpreter.showtraceback(): 118b. メソッドが、対話的イ
ンタープリタのように連なったスタックトレース全体を表示するようになりまし
た。 (Contributed by Claudiu Popa in bpo-17442(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17442


File: python.info,  Node: collections<6>,  Next: collections abc<4>,  Prev: コード,  Up: 改良されたモジュール<9>

1.12.5.7 collections
....................

*note collections.OrderedDict: 9da. が C で実装されました。 これにより
4倍 から 100 倍高速になりました。 (Contributed by Eric Snow in
bpo-16991(1).)

‘OrderedDict.items()’, ‘OrderedDict.keys()’, and ‘OrderedDict.values()’
views now support *note reversed(): c40. iteration.  (Contributed by
Serhiy Storchaka in bpo-19505(2).)

*note deque: 9db. クラスが *note index(): 118d.、 *note insert(): 118e.、
*note copy(): 118f. を定義し、‘+’ と ‘*’ 演算をサポートしました。 これに
より deque インスタンスは *note MutableSequence: 6cc. と認識され、list と
の代替性が向上しました。 (Contributed by Raymond Hettinger in
bpo-23704(3).)

*note namedtuple(): 1da. で生成されたドキュメンテーション文字列が更新可
能となりました:

     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: 1190. class now implements the *note
__getnewargs__(): 1191, *note __rmod__(): 1192, *note casefold(): 1193,
*note format_map(): 1194, *note isprintable(): 1195, and *note
maketrans(): 192. methods to match the corresponding methods of *note
str: 1ea.  (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<4>,  Next: compileall<4>,  Prev: collections<6>,  Up: 改良されたモジュール<9>

1.12.5.8 collections.abc
........................

The ‘Sequence.index()’ method now accepts 'start' and 'stop' arguments
to match the corresponding methods of *note tuple: 1d9, *note list: 4e0,
etc.  (Contributed by Devin Jeanpierre in bpo-23086(1).)

新たに *note Generator: 1197. 抽象基底クラスが追加されました。
(Contributed by Stefan Behnel in bpo-24018(2).)

新たに *note Awaitable: 1198, *note Coroutine: 1199, *note
AsyncIterator: 119a, *note AsyncIterable: 119b. 抽象基底クラスが追加され
ました。 (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<7>,  Prev: collections abc<4>,  Up: 改良されたモジュール<9>

1.12.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(): eec. 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(): eec, *note
compile_file(): 119d, and *note compile_path(): 119e. 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<7>,  Next: configparser<5>,  Prev: compileall<4>,  Up: 改良されたモジュール<9>

1.12.5.10 concurrent.futures
............................

The *note Executor.map(): 47a. method now accepts a 'chunksize' argument
to allow batching of tasks to improve performance when *note
ProcessPoolExecutor(): 211. is used.  (Contributed by Dan O'Reilly in
bpo-11271(1).)

The number of workers in the *note ThreadPoolExecutor: b2c. 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<6>,  Prev: concurrent futures<7>,  Up: 改良されたモジュール<9>

1.12.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: 6ea. 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<6>,  Next: csv<4>,  Prev: configparser<5>,  Up: 改良されたモジュール<9>

1.12.5.12 contextlib
....................

新規 *note context manager: 47f. の *note contextlib.redirect_stderr():
11a2. は、ユーティリティスクリプトにて、その出力を *note sys.stderr:
d09. に書き出す一方でその向き先を変えれない頑固な API の扱いを簡単にして
くれます (*note redirect_stdout(): 11a3. と対となるものです)。:

     >>> 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<4>,  Next: curses<5>,  Prev: contextlib<6>,  Up: 改良されたモジュール<9>

1.12.5.13 csv
.............

*note writerow(): 11a5. メソッドは、シーケンスだけでなく、 任意のイテラ
ブルをサポートしました。(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<6>,  Prev: csv<4>,  Up: 改良されたモジュール<9>

1.12.5.14 curses
................

The new *note update_lines_cols(): 11a7. function updates the *note
LINES: 11a8. and *note COLS: 11a9. 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<6>,  Next: difflib<4>,  Prev: curses<5>,  Up: 改良されたモジュール<9>

1.12.5.15 dbm
.............

*note dumb.open: e60. 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<4>,  Next: distutils<7>,  Prev: dbm<6>,  Up: 改良されたモジュール<9>

1.12.5.16 difflib
.................

The charset of HTML documents generated by *note HtmlDiff.make_file():
11ac. 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(): 11ad. 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<4>,  Up: 改良されたモジュール<9>

1.12.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<5>,  Prev: distutils<7>,  Up: 改良されたモジュール<9>

1.12.5.18 doctest
.................

*note DocTestSuite(): 11b0. 関数が、 'module' がドキュメンテーション文字
列(docstrings)を含まない場合に *note ValueError: 15a. を送出するのではな
く空の *note unittest.TestSuite: 11b1. を返すようになりました。
(Contributed by Glenn Jones in bpo-15916(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15916


File: python.info,  Node: email<5>,  Next: enum<8>,  Prev: doctest<3>,  Up: 改良されたモジュール<9>

1.12.5.19 email
...............

A new policy option *note Policy.mangle_from_: 11b3. 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: 105e. and ‘False’ for all other policies.  (Contributed by
Milan Oberkirch in bpo-20098(1).)

A new *note Message.get_content_disposition(): 11b4. 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: 222. 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: 11b5. constructor now accepts a *note
charset.Charset: 11b6. 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<5>,  Prev: email<5>,  Up: 改良されたモジュール<9>

1.12.5.20 enum
..............

*note Enum: a26. 呼び出し可能オブジェクトは、'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<5>,  Next: functools<7>,  Prev: enum<8>,  Up: 改良されたモジュール<9>

1.12.5.21 faulthandler
......................

関数 *note enable(): 224, *note register(): 227, *note dump_traceback():
225, *note dump_traceback_later(): 226. が、ファイル様オブジェクトだけで
なくファイル記述子を受け取るようになりました。 (Contributed by Wei Wu in
bpo-23566(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23566


File: python.info,  Node: functools<7>,  Next: glob<4>,  Prev: faulthandler<5>,  Up: 改良されたモジュール<9>

1.12.5.22 functools
...................

*note lru_cache(): db7. 機構の多くが 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<4>,  Next: gzip<4>,  Prev: functools<7>,  Up: 改良されたモジュール<9>

1.12.5.23 glob
..............

*note iglob(): be5. 関数と *note glob(): 2df. 関数は、 ‘"**"’ パターンを
使ったサブディレクトリの再帰的な検索をサポートしました。(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<4>,  Up: 改良されたモジュール<9>

1.12.5.24 gzip
..............

*note GzipFile: 84f. コンストラクタの '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.12.5.25 heapq
...............

Element comparison in *note merge(): 11bd. can now be customized by
passing a *note key function: 11be. 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<4>,  Prev: heapq<2>,  Up: 改良されたモジュール<9>

1.12.5.26 http
..............

新しい *note HTTPStatus: cd4. の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<4>,  Next: idlelib と IDLE<3>,  Prev: http<3>,  Up: 改良されたモジュール<9>

1.12.5.27 http.client
.....................

*note HTTPConnection.getresponse(): 11c1. now raises a *note
RemoteDisconnected: 11c2. exception when a remote server connection is
closed unexpectedly.  Additionally, if a *note ConnectionError: 11c3.
(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<4>,  Up: 改良されたモジュール<9>

1.12.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.12.5.29 imaplib
.................

*note IMAP4: 322. クラスが *note context manager: 47f. プロトコルをサポ
ートするようになりました。 *note with: 215. 文とともに使うと、 IMAP4
‘LOGOUT’ コマンドがブロックの終了時に自動的に呼び出されます。
(Contributed by Tarek Ziadé and Serhiy Storchaka in bpo-4972(1).)

The *note imaplib: 77. module now supports RFC 5161(2) (ENABLE
Extension) and RFC 6855(3) (UTF-8 Support) via the *note IMAP4.enable():
11c6. method.  A new *note IMAP4.utf8_enabled: 11c7. 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: 77. 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.12.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<9>,  Prev: imghdr,  Up: 改良されたモジュール<9>

1.12.5.31 importlib
...................

The *note util.LazyLoader: 1072. 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(): 1d6. 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(): 11ca. function is now the
preferred way to create a new module.  As opposed to creating a *note
types.ModuleType: 11cb. 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<9>,  Next: io<7>,  Prev: importlib<8>,  Up: 改良されたモジュール<9>

1.12.5.32 inspect
.................

Both the *note Signature: 6ee. and *note Parameter: 6ef. classes are now
picklable and hashable.  (Contributed by Yury Selivanov in bpo-20726(1)
and bpo-20334(2).)

A new *note BoundArguments.apply_defaults(): 11cd. 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(): b25. makes
subclassing of *note Signature: 6ee. easier.  (Contributed by Yury
Selivanov and Eric Snow in bpo-17373(4).)

The *note signature(): 4c4. 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: 1130. and
*note coroutine objects: 8a7. has been added: *note iscoroutine(): 11ce,
*note iscoroutinefunction(): 154, *note isawaitable(): 11cf, *note
getcoroutinelocals(): 11d0, and *note getcoroutinestate(): 11d1.
(Contributed by Yury Selivanov in bpo-24017(6) and bpo-24400(7).)

The *note stack(): a46, *note trace(): a47, *note getouterframes(): a44,
and *note getinnerframes(): a45. 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<9>,  Up: 改良されたモジュール<9>

1.12.5.33 io
............

A new *note BufferedIOBase.readinto1(): 11d3. method, that uses at most
one call to the underlying raw stream's *note RawIOBase.read(): 11d4. or
*note RawIOBase.readinto(): 11d5. 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<4>,  Prev: io<7>,  Up: 改良されたモジュール<9>

1.12.5.34 ipaddress
...................

Both the *note IPv4Network: 718. and *note IPv6Network: 719. 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: 11d7. attribute for the *note IPv4Address:
716. and *note IPv6Address: 717. 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<4>,  Next: linecache<3>,  Prev: ipaddress<4>,  Up: 改良されたモジュール<9>

1.12.5.35 json
..............

The *note json.tool: 86. 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: 11d9. instead of *note
ValueError: 15a. 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<7>,  Prev: json<4>,  Up: 改良されたモジュール<9>

1.12.5.36 linecache
...................

A new *note lazycache(): 11db. function can be used to capture
information about a non-file-based module to permit getting its lines
later via *note getline(): 4d4.  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<7>,  Next: logging<6>,  Prev: linecache<3>,  Up: 改良されたモジュール<9>

1.12.5.37 locale
................

A new *note delocalize(): 11dd. 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<6>,  Next: lzma,  Prev: locale<7>,  Up: 改良されたモジュール<9>

1.12.5.38 logging
.................

All logging methods (*note Logger: f10. *note log(): 11df, *note
exception(): 11e0, *note critical(): 11e1, *note debug(): 11e2, 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: 11e3. class now accepts an optional
*note ssl.SSLContext: 33e. instance to configure SSL settings used in an
HTTP connection.  (Contributed by Alex Gaynor in bpo-22788(2).)

The *note handlers.QueueListener: 4d6. 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<10>,  Prev: logging<6>,  Up: 改良されたモジュール<9>

1.12.5.39 lzma
..............

The *note LZMADecompressor.decompress(): 11e5. 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<10>,  Next: multiprocessing<7>,  Prev: lzma,  Up: 改良されたモジュール<9>

1.12.5.40 math
..............

*note math: 91. モジュールに定数 *note inf: 1045. および *note nan: a58.
が追加されました。 (Contributed by Mark Dickinson in bpo-23185(1).)

新たな関数 *note isclose(): 116d. は近似的に等しいことを調べる方法を提供
します。 (Contributed by Chris Barker and Tal Einat in bpo-24270(2).)

A new *note gcd(): ce3. 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<10>,  Up: 改良されたモジュール<9>

1.12.5.41 multiprocessing
.........................

*note sharedctypes.synchronized(): 11e8. オブジェクトが *note
コンテキストマネージャ: 47f. プロトコルをサポートするようになりました。
(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<13>,  Prev: multiprocessing<7>,  Up: 改良されたモジュール<9>

1.12.5.42 operator
..................

*note attrgetter(): 11ea, *note itemgetter(): e2a, and *note
methodcaller(): 11eb. objects now support pickling.  (Contributed by
Josh Rosenberg and Serhiy Storchaka in bpo-22955(1).)

行列乗算を行う *note matmul(): 11ec. 関数と *note imatmul(): 11ed. 関数
が新しく追加されました。 (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<13>,  Next: pathlib<14>,  Prev: operator<3>,  Up: 改良されたモジュール<9>

1.12.5.43 os
............

The new *note scandir(): e27. function returning an iterator of *note
DirEntry: 8b1. 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: 11ef. 属
性が利用可能です。これは Windows API の ‘GetFileInformationByHandle()’ か
ら返る ‘BY_HANDLE_FILE_INFORMATION’ 構造体のメンバ ‘dwFileAttributes’ に
対応します。 (Contributed by Ben Hoyt in bpo-21719(2).)

*note urandom(): 936. 関数が、Linux 3.17 以降ではシステムコール
‘getrandom()’ を、OpenBSD 5.6 以降ではシステムコール ‘getentropy()’ を使
うようになりました。これは ‘/dev/urandom’ を使う必要性をなくし、潜在的に
は起こり得たファイル記述子を使い果たすことによる失敗を避けることに繋がり
ます。 (Contributed by Victor Stinner in bpo-22181(3).)

New *note get_blocking(): 11f0. and *note set_blocking(): 11f1.
functions allow getting and setting a file descriptor's blocking mode
(*note O_NONBLOCK: 11f2.)  (Contributed by Victor Stinner in
bpo-22054(4).)

*note truncate(): 11f3. と *note ftruncate(): 114c. が Windows でサポー
トされるようになりました。 (Contributed by Steve Dower in bpo-23668(5).)

There is a new *note os.path.commonpath(): 33c. function returning the
longest common sub-path of each passed pathname.  Unlike the *note
os.path.commonprefix(): 33b. 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<14>,  Next: pickle<5>,  Prev: os<13>,  Up: 改良されたモジュール<9>

1.12.5.44 pathlib
.................

The new *note Path.samefile(): 11f5. method can be used to check whether
the path points to the same file as another path, which can be either
another *note Path: 4f5. 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(): 2e4. method now accepts a new optional
'exist_ok' argument to match ‘mkdir -p’ and *note os.makedirs(): 24b.
functionality.  (Contributed by Berker Peksag in bpo-21539(2).)

There is a new *note Path.expanduser(): 11f6. method to expand ‘~’ and
‘~user’ prefixes.  (Contributed by Serhiy Storchaka and Claudiu Popa in
bpo-19776(3).)

A new *note Path.home(): 11f7. class method can be used to get a *note
Path: 4f5. instance representing the user’s home directory.
(Contributed by Victor Salgado and Mayank Tripathi in bpo-19777(4).)

New *note Path.write_text(): 11f8, *note Path.read_text(): 11f9, *note
Path.write_bytes(): 11fa, *note Path.read_bytes(): 561. 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<5>,  Next: poplib<2>,  Prev: pathlib<14>,  Up: 改良されたモジュール<9>

1.12.5.45 pickle
................

Nested objects, such as unbound methods or nested classes, can now be
pickled using *note pickle protocols: 50a. 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<9>,  Prev: pickle<5>,  Up: 改良されたモジュール<9>

1.12.5.46 poplib
................

A new *note POP3.utf8(): 11fd. 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<9>,  Next: readline<2>,  Prev: poplib<2>,  Up: 改良されたモジュール<9>

1.12.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(): 7a7. and *note subn(): 7a8. 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: 74e. exceptions have new attributes, *note msg:
11ff, *note pattern: 1200, *note pos: 1201, *note lineno: 1202, and
*note colno: 1203, 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<9>,  Up: 改良されたモジュール<9>

1.12.5.48 readline
..................

A new *note append_history_file(): 1205. 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<6>,  Prev: readline<2>,  Up: 改良されたモジュール<9>

1.12.5.49 selectors
...................

The new *note DevpollSelector: f9b. 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<6>,  Next: signal<3>,  Prev: selectors,  Up: 改良されたモジュール<9>

1.12.5.50 shutil
................

The *note move(): e24. function now accepts a 'copy_function' argument,
allowing, for example, the *note copy(): e22. function to be used
instead of the default *note copy2(): e23. if there is a need to ignore
file metadata when moving.  (Contributed by Claudiu Popa in
bpo-19840(1).)

The *note make_archive(): 8c8. 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<6>,  Up: 改良されたモジュール<9>

1.12.5.51 signal
................

Windows において、 *note set_wakeup_fd(): f31. 関数がソケットハンドルも
サポートするようになりました。 (Contributed by Victor Stinner in
bpo-22018(1).)

Various ‘SIG*’ constants in the *note signal: ce. module have been
converted into *note Enums: 59.  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.12.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.12.5.53 smtplib
.................

A new *note SMTP.auth(): 120b. method provides a convenient way to
implement custom authentication mechanisms.  (Contributed by Milan
Oberkirch in bpo-15014(1).)

The *note SMTP.set_debuglevel(): 120c. 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(): 120d. and *note SMTP.send_message():
120e. 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<10>,  Prev: smtplib<2>,  Up: 改良されたモジュール<9>

1.12.5.54 sndhdr
................

The ‘what()’ and ‘whathdr()’ functions now return a *note namedtuple():
1da.  (Contributed by Claudiu Popa in bpo-18615(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18615


File: python.info,  Node: socket<10>,  Next: ssl<11>,  Prev: sndhdr,  Up: 改良されたモジュール<9>

1.12.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(): 1211. method allows sending a file over a
socket by using the high-performance *note os.sendfile(): ed7. function
on UNIX, resulting in uploads being from 2 to 3 times faster than when
using plain *note socket.send(): 1164.  (Contributed by Giampaolo
Rodola' in bpo-17552(2).)

The *note socket.sendall(): 1165. 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(): 1212. method is now
optional.  By default it is set to *note SOMAXCONN: 1213. 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<11>,  Next: sqlite3<10>,  Prev: socket<10>,  Up: 改良されたモジュール<9>

1.12.5.56 ssl
.............

* Menu:

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


File: python.info,  Node: メモリ BIO サポート,  Next: Application-Layer Protocol Negotiation Support,  Up: ssl<11>

1.12.5.57 メモリ BIO サポート
.............................

(Contributed by Geert Jansen in bpo-21965(1).)

The new *note SSLObject: f44. class has been added to provide SSL
protocol support for cases when the network I/O capabilities of *note
SSLSocket: cbf. 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: 1216. 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:
cbf.'s readiness model ("select/poll") is inefficient.

A new *note SSLContext.wrap_bio(): f45. 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<11>

1.12.5.58 Application-Layer Protocol Negotiation Support
........................................................

(Contributed by Benjamin Peterson in bpo-20188(1).)

Where OpenSSL support is present, the *note ssl: d8. module now
implements the 'Application-Layer Protocol Negotiation' TLS extension as
described in RFC 7301(2).

The new *note SSLContext.set_alpn_protocols(): 1218. can be used to
specify which protocols a socket should advertise during the TLS
handshake.

The new *note SSLSocket.selected_alpn_protocol(): 1219. returns the
protocol that was selected during the TLS handshake.  The *note
HAS_ALPN: 121a. 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<11>

1.12.5.59 その他の変更
......................

There is a new *note SSLSocket.version(): 121c. method to query the
actual protocol version in use.  (Contributed by Antoine Pitrou in
bpo-20421(1).)

The *note SSLSocket: cbf. 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: 121d. or *note ssl.SSLWantWriteError: 121e.
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(): 121f. 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: 32e.  (Contributed by Akira Li
in bpo-19940(5).)

New ‘SSLObject.shared_ciphers()’ and *note SSLSocket.shared_ciphers():
1220. 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(): 1221, *note SSLSocket.read(): 1222,
‘SSLSocket.shutdown()’, and *note SSLSocket.write(): 1223. methods of
the *note SSLSocket: cbf. 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<10>,  Next: subprocess<5>,  Prev: ssl<11>,  Up: 改良されたモジュール<9>

1.12.5.60 sqlite3
.................

The *note Row: 1225. class now fully supports the sequence protocol, in
particular *note reversed(): c40. 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<5>,  Next: sys<13>,  Prev: sqlite3<10>,  Up: 改良されたモジュール<9>

1.12.5.61 subprocess
....................

新たに *note run(): f49. 関数が追加されました。 これは指定されたコマンド
を実行し *note CompletedProcess: 1227. オブジェクトを返します。 オブジェ
クトは終了したプロセスを記述します。 新たな 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<13>,  Next: sysconfig<5>,  Prev: subprocess<5>,  Up: 改良されたモジュール<9>

1.12.5.62 sys
.............

A new ‘set_coroutine_wrapper()’ function allows setting a global hook
that will be called whenever a *note coroutine object: 8a7. is created
by an *note async def: 9d4. function.  A corresponding
‘get_coroutine_wrapper()’ can be used to obtain a currently set wrapper.
Both functions are *note provisional: 604, and are intended for
debugging purposes only.  (Contributed by Yury Selivanov in
bpo-24017(1).)

A new *note is_finalizing(): e53. function can be used to check if the
Python interpreter is *note shutting down: 1ab.  (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<5>,  Next: tarfile<9>,  Prev: sys<13>,  Up: 改良されたモジュール<9>

1.12.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<9>,  Next: threading<9>,  Prev: sysconfig<5>,  Up: 改良されたモジュール<9>

1.12.5.64 tarfile
.................

*note open(): 122b. 関数の 'mode' 引数が排他的作成を要求する ‘"x"’ を受
け取るようになりました。 (Contributed by Berker Peksag in bpo-21717(1).)

The *note TarFile.extractall(): 285. and *note TarFile.extract(): 286.
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(): 122c. now accepts an optional 'members'
keyword argument that can be set to a subset of the list returned by
*note TarFile.getmembers(): 122d.  (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<9>,  Next: time<7>,  Prev: tarfile<9>,  Up: 改良されたモジュール<9>

1.12.5.65 threading
...................

*note Lock.acquire(): a8c. と *note RLock.acquire(): 122f. の両メソッド
がタイムアウトの管理に単調時計を使用するようになりました。 (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<3>,  Prev: threading<9>,  Up: 改良されたモジュール<9>

1.12.5.66 time
..............

*note monotonic(): 763. 関数が常に利用出来るようになりました。
(Contributed by Victor Stinner in bpo-22043(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22043


File: python.info,  Node: timeit<3>,  Next: tkinter<10>,  Prev: time<7>,  Up: 改良されたモジュール<9>

1.12.5.67 timeit
................

新たなコマンドラインオプション ‘-u’ 又は ‘--unit=U’ を使用してタイマーの
出力の単位を指定できます。 サポートされたオプションは ‘usec’, ‘msec’,
‘sec’ です。 (Contributed by Julian Gindi in bpo-18983(1).)

*note timeit(): 1232. 関数に引数 '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<10>,  Next: traceback<5>,  Prev: timeit<3>,  Up: 改良されたモジュール<9>

1.12.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<8>,  Prev: tkinter<10>,  Up: 改良されたモジュール<9>

1.12.5.69 traceback
...................

New *note walk_stack(): 1235. and *note walk_tb(): 1236. functions to
conveniently traverse frame and *note traceback objects: ebe.
(Contributed by Robert Collins in bpo-17911(1).)

New lightweight classes: *note TracebackException: 76a, *note
StackSummary: 1237, and *note FrameSummary: 1238.  (Contributed by
Robert Collins in bpo-17911(2).)

Both the *note print_tb(): 1239. and *note print_stack(): 123a.
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<8>,  Next: unicodedata<10>,  Prev: traceback<5>,  Up: 改良されたモジュール<9>

1.12.5.70 types
...............

新たに *note coroutine(): 123c. 関数が追加されました。 *note
ジェネレータ: fa2. と *note ジェネレータ様: 1197. オブジェクトを *note
awaitable: 6d5. に変換します。 (Contributed by Yury Selivanov in
bpo-24017(1).)

新たに型 *note CoroutineType: 123d. が追加されました。 *note async def:
9d4. 関数で作られた *note coroutine: 8a7. オブジェクトに使われます。
(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<10>,  Next: unittest<10>,  Prev: types<8>,  Up: 改良されたモジュール<9>

1.12.5.71 unicodedata
.....................

The *note unicodedata: 10e. module now uses data from Unicode 8.0.0(1).

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

   (1) https://unicode.org/versions/Unicode8.0.0/


File: python.info,  Node: unittest<10>,  Next: unittest mock<3>,  Prev: unicodedata<10>,  Up: 改良されたモジュール<9>

1.12.5.72 unittest
..................

The *note TestLoader.loadTestsFromModule(): 799. 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: 1240. attribute of the *note TestLoader: 798.
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<10>,  Up: 改良されたモジュール<9>

1.12.5.73 unittest.mock
.......................

*note Mock: e12. クラスは、次の改善が行われました。

   * The class constructor has a new 'unsafe' parameter, which causes
     mock objects to raise *note AttributeError: 1b4. on attribute names
     starting with ‘"assert"’.  (Contributed by Kushal Das in
     bpo-21238(1).)

   * A new *note Mock.assert_not_called(): 1242. method to check if the
     mock object was called.  (Contributed by Kushal Das in
     bpo-21262(2).)

The *note MagicMock: 1243. class now supports *note __truediv__(): 1244,
*note __divmod__(): 1245. and *note __matmul__(): 1136. 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(): 1246. 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.12.5.74 urllib
................

A new *note request.HTTPPasswordMgrWithPriorAuth: 1248. 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(): 1249.
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(): 586. function accepts an *note
ssl.SSLContext: 33e. 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(): 124a. 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.12.5.75 wsgiref
.................

The 'headers' argument of the *note headers.Headers: 124c. 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.12.5.76 xmlrpc
................

*note client.ServerProxy: e1f. クラスが *note コンテキストマネージャ:
47f. プロトコルをサポートするようになりました。 (Contributed by Claudiu
Popa in bpo-20627(1).)

*note client.ServerProxy: e1f. コンストラクタは任意の *note
ssl.SSLContext: 33e. インスタンスを受け取るようになりました。
(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.12.5.77 xml.sax
.................

SAX パーサは *note xmlreader.InputSource: 124f. オブジェクトの文字ストリ
ームをサポートしました。 (Contributed by Serhiy Storchaka in
bpo-2175(1).)

*note parseString(): 1250. が *note str: 1ea. インスタンスを受け取るよう
になりました。 (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.12.5.78 zipfile
.................

ZIP output can now be written to unseekable streams.  (Contributed by
Serhiy Storchaka in bpo-23252(1).)

*note ZipFile.open(): 850. メソッドの '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.12.6 その他のモジュールレベルの変更
-------------------------------------

Many functions in the *note mmap: 94, ‘ossaudiodev’, *note socket: d4,
*note ssl: d8, and *note codecs: 1c. modules now accept writable *note
bytes-like objects: 43d.  (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.12.7 最適化
-------------

The *note os.walk(): 8be. 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(): e27. 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: 83. *note IPv4Network: 718. and
*note IPv6Network: 719. have been massively sped up, such as *note
subnets(): 1254, *note supernet(): 1255, *note
summarize_address_range(): 1256, *note collapse_addresses(): 1257.  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: 83. objects was optimized to produce
significantly smaller output.  (Contributed by Serhiy Storchaka in
bpo-23133(7).)

*note io.BytesIO: 1258. の多くの操作が 50% から 100% 速くなりました。
(Contributed by Serhiy Storchaka in bpo-15381(8) and David Wilson in
bpo-22003(9).)

The *note marshal.dumps(): 1259. 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(): 254. 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(): 125a. and *note PyObject_IsSubclass():
125b. functions have been sped up in the common case that the second
argument has *note type: 191. as its metaclass.  (Contributed Georg
Brandl by in bpo-22540(15).)

メソッドのキャッシュが少し改良されました。ベンチマークによっては性能が最
高で 5% 向上しました。 (Contributed by Antoine Pitrou in bpo-22847(16).)

*note random: c0. モジュールのオブジェクトのメモリ使用量が 64-bit ビルド
で 50% 減少しました。 (Contributed by Serhiy Storchaka in
bpo-23488(17).)

*note property(): 6c1. ゲッタの呼び出しが最高で 25% 速くなりました。
(Contributed by Joe Jevnik in bpo-23910(18).)

*note fractions.Fraction: 1ce. のインスタンス化が最高で 30% 速くなりまし
た。 (Contributed by Stefan Behnel in bpo-22464(19).)

String methods *note find(): 125c, *note rfind(): 125d, *note split():
125e, *note partition(): 125f. and the *note in: 32b. 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.12.8 ビルドならびに C API の変更
----------------------------------

新たな ‘calloc’ 関数が追加されました:

   * *note PyMem_RawCalloc(): 82a,

   * *note PyMem_Calloc(): 1261,

   * *note PyObject_Calloc(): 1262.

(Contributed by Victor Stinner in bpo-21233(1).)

新たなエンコーディング/デコーディングヘルパ関数:

   * *note Py_DecodeLocale(): f89. (‘_Py_char2wchar()’ の代わり),

   * *note Py_EncodeLocale(): f8a. (‘_Py_wchar2char()’ の代わり).

(Contributed by Victor Stinner in bpo-18395(2).)

A new *note PyCodec_NameReplaceErrors(): 1263. function to replace the
unicode encode error with ‘\N{...}’ escapes.  (Contributed by Serhiy
Storchaka in bpo-19676(3).)

A new *note PyErr_FormatV(): 1264. function similar to *note
PyErr_Format(): 1265, but accepts a ‘va_list’ argument.  (Contributed by
Antoine Pitrou in bpo-18711(4).)

A new *note PyExc_RecursionError: 1266. exception.  (Contributed by
Georg Brandl in bpo-19235(5).)

New *note PyModule_FromDefAndSpec(): 39a, *note
PyModule_FromDefAndSpec2(): 39b, and *note PyModule_ExecDef(): 39c.
functions introduced by PEP 489(6) - multi-phase extension module
initialization.  (Contributed by Petr Viktorin in bpo-24268(7).)

New *note PyNumber_MatrixMultiply(): 1267. and *note
PyNumber_InPlaceMatrixMultiply(): 1268. 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: e70. 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.12.9 非推奨
-------------

* Menu:

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


File: python.info,  Node: 新たなキーワード<2>,  Next: 非推奨の Python の挙動<2>,  Up: 非推奨<11>

1.12.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.12.9.2 非推奨の Python の挙動
...............................

ジェネレータ内で *note StopIteration: fbe. 例外を送出すると現在は静かな
*note PendingDeprecationWarning: c9f. が発生します。 これは、Python 3.6
では静かでない非推奨の警告となり、Python 3.7 では *note RuntimeError:
317. を起こします。 詳細は *note PEP 479; Change StopIteration handling
inside generators: 10dd. を参照してください。


File: python.info,  Node: サポートされないオペレーティングシステム,  Next: 非推奨の Python モジュール、関数、メソッド<3>,  Prev: 非推奨の Python の挙動<2>,  Up: 非推奨<11>

1.12.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.12.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(): 1039.

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: fc7. オブジェクトの *note key: fc4, *note
value: fc5, *note coded_value: fc6. に対して直接代入することは非推奨です
。 *note set(): fc8. メソッドを使うようにしてください。また、 ‘set()’ の
ドキュメントされていなかった 'LegalChars' パラメータは非推奨となり、無視
されます。

*note string.Formatter: 126e. クラスの *note format(): fc3. メソッドに対
し、キーワード引数 '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: 6ee. の、以前からドキュメントされていなかったメ
ソッド ‘from_function’ と ‘from_builtin’ は非推奨です。新しい *note
Signature.from_callable(): b25. を代わりに使ってください。 (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: 81. *note getfullargspec(): b24, *note getcallargs():
126f, and ‘formatargspec()’ functions are deprecated in favor of the
*note inspect.signature(): 4c4. API. (Contributed by Yury Selivanov in
bpo-20438(5).)

*note getargvalues(): 1270. and *note formatargvalues(): 1271. functions
were inadvertently marked as deprecated with the release of Python
3.5.0.

str のパターンとともに *note re.LOCALE: f2d. や *note re.ASCII: a22. フ
ラグを使用することは非推奨となりました。 (Contributed by Serhiy
Storchaka in bpo-22407(6).)

‘'\'’ と ASCII 文字からなる認識出来ない特殊シーケンスが正規表現内と置き
換えパターン内で使われた場合に、非推奨警告を出すようになりました。Python
3.6 では禁止されるようになります。 (Contributed by Serhiy Storchaka in
bpo-23622(7).)

*note unittest.TestLoader.loadTestsFromModule(): 799. メソッドのドキュメ
ントされておらず非公式の '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.12.10 削除
------------

* Menu:

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


File: python.info,  Node: API と機能の削除<4>,  Up: 削除<11>

1.12.10.1 API と機能の削除
..........................

時代遅れとなり、以前に既に非推奨となった以下の API と機能が削除されまし
た:

   * email パッケージの ‘__version__’ 属性は削除されました。email パッケ
     ージが標準ライブラリとは別々にリリースされていたのは遥か昔の話であ
     り、ここのところ何回かのリリースにいたっては ‘__version__’ 文字列が
     更新されていませんでした。

   * 3.4 で非推奨となっていた *note ftplib: 61. モジュール内の内部クラス
     ‘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.12.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.12.11.1 Python の挙動の変更
.............................

   * 以前のバージョンの Python で、誤って以下の構文を許容してしまってい
     ました:

          f(1 for x in [1], *args)
          f(1 for x in [1], **kwargs)

     Python 3.5 は正しく *note SyntaxError: 189. を投げます。ジェネレー
     タ式は関数への唯一の引数でない場合には、括弧で囲まなければならない
     のです。(--訳注: 一応。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.12.11.2 Python API の変更
...........................

   * PEP 475(1): Python シグナルハンドラが例外を送出しなければ、システム
     コールがシグナルに中断された場合に、 *note InterruptedError: 1145.
     を送出せずにシステムコールを再試行するようになりました。

   * Python 3.5 以前は、 *note time: 495. オブジェクトは UTC で深夜を表
     すときに偽とみなされていました。 この挙動は分かりにくく、エラーの元
     となると考えられ、Python 3.5 で削除されました。 全詳細については
     bpo-13936(2) を参照してください。

   * The ‘ssl.SSLSocket.send()’ method now raises either *note
     ssl.SSLWantReadError: 121d. or *note ssl.SSLWantWriteError: 121e.
     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: c51,
     ‘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: 43d. is required,
     not 'sometype'" の形になっています。 (Contributed by Ezio Melotti
     in bpo-16518(7).)

   * 既に存在していないディレクトリをカレントディレクトリとして指してい
     た場合に、 *note find_spec(): 1277. は以前は *note
     FileNotFoundError: 24f. 例外を送出していましたが、そうではなく
     ‘None’ を返却するようになりました。この際 *note
     sys.path_importer_cache: 9e0. に ‘None’ を 'キャッシュはしません' 。
     これは典型的なケースとは違います(訳注: msg231477(8))。
     (bpo-22834(9))

   * *note http.client: 72. モジュールと *note http.server: 75. モジュー
     ルに散らばっていた HTTP ステータスコードと対応するメッセージを、共
     通の *note HTTPStatus: cd4. enum としてまとめ直しました。
     ‘http.client’ 、 ‘http.server’ にあったもとの値も後方互換性のために
     残してあります。 (Contributed by Demian Brecht in bpo-21793(10).)

   * When an import loader defines *note exec_module(): c44. it is now
     expected to also define *note create_module(): 1073. (raises a
     *note DeprecationWarning: 2d4. now, will be an error in Python
     3.6).  If the loader inherits from *note importlib.abc.Loader:
     1278. 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(): 7a6. 関数は常に空のパターンマッチを無視してきまし
     た。ですからパターン ‘"x*"’ はパターン ‘"x+"’ と同じように動作し、
     パターン ‘"\b"’ は決して動作しませんでした。今後は ‘re.split()’ は
     パターンが空文字列に合致しうる場合に警告を出します。互換性のために
     は空文字列とはマッチしえないパターンを使ってください(たとえば
     ‘"x*"’ ではなく ‘"x+"’ を使ってください)。空文字列としかマッチしえ
     ないパターン(例えば ‘"\b"’)はエラーとなります。 (Contributed by
     Serhiy Storchaka in bpo-22818(12).)

   * *note http.cookies.Morsel: fc7. 辞書風インターフェイスのそれ自身で
     の一貫性を持たせるようにしました: morsel の比較に *note key: fc4. と
     *note value: fc5. を考慮するようにし、 *note copy(): 1279. は *note
     dict: 193. を返さずに ‘Morsel’ インスタンスを返すようにし、 *note
     update(): 127a. は更新する辞書内のいずれかのキーが不正(訳注: RFC
     2109(13) として不正なキーのことで、update 以外のインターフェイスで
     は変更前も拒絶される)であれば例外を投げるようにしています。加えて、
     ドキュメントされていない *note set(): fc8. の '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(): 338. 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: d4. module now exports the *note
     CAN_RAW_FD_FRAMES: 127b. constant on linux 3.6 and greater.

   * RFC 5280(16) に基づき、 *note ssl.cert_time_to_seconds(): 121f. 関
     数が入力の時刻をローカル時刻ではなく UTC として解釈するようになりま
     した。また、戻り値は常に *note int: 32e. となります。 (Contributed
     by Akira Li in bpo-19940(17).)

   * ‘pygettext.py’ ツールが POT-Creation-Date ヘッダ内のタイムゾーン形
     式として、標準の +NNNN 形式を使うようになりました。

   * The *note smtplib: d2. module now uses *note sys.stderr: d09.
     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(): 127c. と *note str.endswith(): 127d. メソッ
     ドは空文字列を見つけた場合と完全に範囲外のインデクスが渡された場合
     に ‘True’ を返すことはしなくなりました。 (Contributed by Serhiy
     Storchaka in bpo-24284(18).)

   * *note inspect.getdoc(): 237. 関数が基底クラスから継承したドキュメン
     テーション文字列を返すようになりました。その継承したドキュメンテー
     ション文字列が相応しいのであれば、もはやそれを繰り返して記述する必
     要はありません。継承されたそれを抑制するには、空の文字列を記述しな
     ければなりません(もしくは然るべきドキュメンテーションを埋めれば良い
     です)。この変更は *note pydoc: bd. モジュールと *note help(): cad.
     関数の出力に影響します。 (Contributed by Serhiy Storchaka in
     bpo-15582(19).)

   * ネストされた *note functools.partial(): 4ad. 呼び出しは平坦化される
     ようになりました。以前の振る舞いに依存していたのであれば
     ‘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.12.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: 127f. and a new ‘calloc’ field was added.

   * Removed non-documented macro ‘PyObject_REPR()’ which leaked
     references.  Use format character ‘%R’ in *note
     PyUnicode_FromFormat(): 824.-like functions to format the *note
     repr(): 462. of the object.  (Contributed by Serhiy Storchaka in
     bpo-22453(1).)

   * Because the lack of the *note __module__: 811. attribute breaks
     pickling and introspection, a deprecation warning is now raised for
     builtin types without the ‘__module__’ attribute.  This will be an
     *note AttributeError: 1b4. 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: e6f. was replaced with a *note tp_as_async:
     1280. slot.  Refer to *note コルーチンオブジェクト: 1281. 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.12.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.12.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/main/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.12.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.13 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.13.1 概要 - リリースハイライト
--------------------------------

新たな文法機能:

   * Python 3.4 に追加された新しい文法機能はありません。

その他の新しい機能:

   * *note pip が常に利用可能であることが保障されるようになりました:
     1289. ( PEP 453(1))。

   * *note 新しく作成されたファイル記述子が継承不可能 （non-inheritable）
     になりました: 128a. ( PEP 446(2))。

   * *note 隔離モード (isolated mode): 128b. の為のコマンドラインオプシ
     ョン (bpo-16499(3))。

   * 非テキストエンコーディングでの *note Codec 処理の改良: 128c. (複数
     の issue に関係).

   * インポートシステムのための *note ModuleSpec 型: 128d. ( PEP
     451(4)).  (インポーターの作者に影響します)

   * *note marshal: 90. フォーマットが *note よりコンパクトで効率的に:
     128e. なりました (bpo-16475(5))。

新たなライブラリモジュール:

   * *note asyncio: b.: *note 非同期 IO のための新たな暫定 API: 128f. (
     PEP 3156(6))。

   * *note ensurepip: 58.: *note pip インストーラのブートストラップ:
     1290. ( PEP 453(7))。

   * *note enum: 59.: *note 列挙型のサポート: 1291. ( PEP 435(8))。

   * *note pathlib: a8.: *note オブジェクト指向のファイルシステムパス:
     1292. ( PEP 428(9))。

   * *note selectors: ca.: *note 高水準で効率的な I/O の多重化: 1293.、
     *note select: c9. モジュールプリミティブを基にしています ( PEP
     3156(10) の一部)。

   * *note statistics: da.: 基礎的な *note 数値的に安定な統計ライブラリ:
     1294. ( PEP 450(11))。

   * *note tracemalloc: 108.: *note Python のメモリ割り当てのトレース:
     1295. ( PEP 454(12))。

大幅に改善されたライブラリモジュール:

   * *note functools: 62. の *note シングルディスパッチジェネリック関数:
     1296. ( PEP 443(13))。

   * *note pickle: ab. の新しい *note プロトコル 4: 1297. ( PEP
     3154(14)).

   * *note multiprocessing: 98. が *note Unix で os.fork
     の使用を避けるオプションを持つようになりました: 1298.
     (bpo-8713(15))。

   * *note email: 3e. has a new submodule, *note contentmanager: 40, and
     a new *note Message: 786. subclass (*note EmailMessage: 221.) that
     *note simplify MIME handling: 1299. (bpo-18891(16)).

   * *note inspect: 81. と *note pydoc: bd. が以前よりも遥かに幅広い種類
     の callable オブジェクトを正しくイントロスペクション出来るようにな
     り、これは Python *note help(): cad. システムを改善することになりま
     した。

   * *note ipaddress: 83. モジュール API は安定だと宣言されました。

セキュリティの改善:

   * *note 安全で取り替え可能なハッシュアルゴリズム: 129a. ( PEP
     456(17))。

   * ファイル記述子が子プロセスにリークするのを防ぐために *note
     新しく作成されたファイル記述子が継承不可になりました: 128a. ( PEP
     446(18))。

   * *note 隔離モード (isolated mode): 128b. のための新たなコマンドライ
     ンオプション (bpo-16499(19))。

   * *note multiprocessing: 98. が *note Unix で os.fork
     の使用を避けるオプション: 1298. を持つようになりました。 子プロセス
     とのデータ共有を避けるため 'spawn' と 'forkserver' はより安全です。

   * Windows での *note multiprocessing: 98. 子プロセスはもはや、必要な
     ものを除いて親の継承可能なハンドルを継承しません。

   * 新たな関数 *note hashlib.pbkdf2_hmac(): 923. は PKCS#5 パスワードベ
     ースの鍵導出関数２(20) を提供します。

   * *note ssl: d8. での *note TLSv1.1、 TLSv1.2 サポート: 129b. の追加
     。

   * *note ssl: d8. での *note Windows
     のシステム証明書ストアよりの証明書抽出サポート: 129c. の追加。

   * *note ssl: d8. での *note サーバサイド SNI (Server Name Indication)
     サポート: 129d. の追加。

   * *note ssl.SSLContext: 33e. クラスに *note 多数の改善: 129e. がなさ
     れました。

   * 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(): 129f.).

CPython の実装の改善:

   * *note オブジェクトの安全なファイナライゼーション: 12a0. ( PEP
     442(21))。

   * PEP 442(22) を活用することで、ほとんどのケースで *note
     モジュールのグローバルがファイナライゼーション中に None
     がセットされることはなくなりました: 12a0. (bpo-18214(23))。

   * *note 設定可能なメモリアロケータ: 12a1. ( PEP 445(24))。

   * *note Argument Clinic: 12a2. ( 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.13.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.13.2.1 PEP 453: Python インストール時の PIP の明示的なブートストラッピング
............................................................................

* Menu:

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


File: python.info,  Node: デフォルトでの pip のブートストラッピング,  Next: ドキュメントの変更,  Up: PEP 453 Python インストール時の PIP の明示的なブートストラッピング

1.13.2.2 デフォルトでの pip のブートストラッピング
..................................................

新しい *note ensurepip: 58. モジュール( 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: 11a. モジュールは、
仮想環境で ‘pip’ が使えるようにするために *note ensurepip: 58. モジュー
ルを使います。 コマンドラインユーティリティを使う際は ‘pip’ はデフォルト
でインストールされます。 ‘venv’ モジュールの *note API: 12a6. を使う際は
、 ‘pip’ のインストールは明示的に要求しなければなりません。

CPython の *note source builds on POSIX systems: 12a7. では ‘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.13.2.3 ドキュメントの変更
...........................

この変更の一部は、 *note Python モジュールのインストール: 12a9. と
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++ 拡張のビルド: 12aa. and *note setuptools による C および
C++ 拡張のビルド: 12ab.

参考
....

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.13.2.4 PEP 446: 新規作成されたファイル記述子は継承不可
........................................................

PEP 446(1) により、新規作成するファイル記述子は *note 継承不可
(non-inheritable): 12ad. となります。一般的にはこれこそがアプリケーショ
ンが望む振る舞いです。新たにプロセスを生成する際に、現在開いているファイ
ルを起こした子プロセスでも開くことは、検出が困難なあらゆるバグや潜在的な
セキュリティ問題を引き起こしかねません。

そうはいっても継承することが望ましい場合もあります。それらのケースをサポ
ートするために、以下の新規関数とメソッドが利用出来ます:

   * *note os.get_inheritable(): 12ae, *note os.set_inheritable(): 12af.

   * *note os.get_handle_inheritable(): 12b0, *note
     os.set_handle_inheritable(): 12b1.

   * *note socket.socket.get_inheritable(): 12b2, *note
     socket.socket.set_inheritable(): 12b3.

参考
....

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.13.2.5 Codec 処理の改良
.........................

その最初の導入からずっと、 *note codecs: 1c. モジュールとはいつなんどき
も、型に中立で動的なエンコーディング・デコーディングシステムとして働くも
のであったのです。そうなのですがその Python テキストモデルとの密接な結合
、特に組み込み型 *note str: 1ea, *note bytes: 1d2, *note bytearray: 1d1.
にある型に制限があるコンビニエンスメソッドのおかげで、歴史的にその本来の
意図を曖昧にしてきたのでした。

そんな状況を清く正しくするための重要な一歩として、今ではコンビニエンス関
数 *note codecs.encode(): 12b5, *note codecs.decode(): 12b6. が Python
2.7、3.3、3.4 で適切にドキュメントされました。これら関数は *note codecs:
1c. モジュールに Python 2.4 からずっと存在している (うえに回帰テストスイ
ートでもずっと網羅してきた) のですが、以前はドキュメントされていなかった
わけなので、実行時イントロスペクションでようやく見つけられるというものだ
ったわけです。

*note str: 1ea, *note bytes: 1d2, *note bytearray: 1d1. でのコンビニエン
スメソッドが 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): 12b7. と *note テキスト変換 (Text
Transforms): 12b8. に詳細記述されました。

(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/main/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.13.2.6 PEP 451: インポートシステムのための ModuleSpec 型
..........................................................

PEP 451(1) は、インポート機構がロードに使うモジュールに関する情報 (つま
りモジュールの仕様) のカプセル化を提供します。これはインポートの実装とイ
ンポート関連 API の両方を単純化するのに役立ちます。この変更は、 いくつか
の将来のインポート関連の改善(2) の足掛かりでもあります。

この PEP による公な側面での変化は完全に後方互換です。さらにそれらは、イ
ンポーターの作者以外にとっては透過的であるはずです。鍵となるファインダと
ローダのメソッドはまだ動作し続けますが非推奨となりました。新しいインポー
タは PEP に記述された新メソッドを使うべきです。既存のインポータは新メソ
ッドを実装するように更新すべきです。置き換えられるべきメソッドとその代わ
りとなるメソッドのリストについては *note 非推奨: 12ba. を参照してくださ
い。

   ---------- 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.13.2.7 その他の言語変更
.........................

Python 言語コアに小さな変更がいくつか行われました:

   * Unicode データベースを UCD バージョン 6.3 にアップグレードしました
     。

   * *note min(): 12bc. と *note max(): 12bd. にキーワード専用引数
     'default' が追加されました。これにはイテラブルが要素なしであると評
     価される場合に返す値を指定出来ます。 (Contributed by Julian Berman
     in bpo-18111(1).)

   * Module objects are now *note weakly referenceable: 12be.

   * モジュールの ‘__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: 1175. ‘cp273’.  (Contributed by
     Michael Bierenfeld and Andrew Kuchling in bpo-1097797(4).)

   * 新規ウクライナ語 *note codec: 1175. ‘cp1125’.  (Contributed by
     Serhiy Storchaka in bpo-19668(5).)

   * *note bytes: 1d2.join() と *note bytearray: 1d1.join() が引数として
     任意のバッファオブジェクトを受け取れるようになりました。
     (Contributed by Antoine Pitrou in bpo-15958(6).)

   * *note int: 32e. コンストラクタの 'base' 引数に、 ‘__index__’ メソッ
     ドを持つ任意のオブジェクトを渡せるようになりました。(Contributed by
     Mark Dickinson in bpo-16772(7).)  (--訳注: *note Python API の変更:
     12bf. に同じ bpo-16772(8) を発端とする変更が書かれているのでそちら
     も参照して下さい。 --)

   * フレームオブジェクトに、ローカル変数への全ての参照をフレームからク
     リアするメソッド *note clear(): 78a. が追加されました。(Contributed
     by Antoine Pitrou in bpo-17934(9).)

   * *note memoryview: 1dd. が *note Sequence: 1f. として登録され、また
     、組み込み関数 *note reversed(): c40. をサポートするようになりまし
     た。 (Contributed by Nick Coghlan and Claudiu Popa in bpo-18690(10)
     and bpo-19078(11).)

   * Argument Clinic の導入、 *note inspect: 81. と *note pydoc: bd. に
     なされた他の変更の結果、多くの場合で *note help(): cad. が報告する
     シグニチャが修正・改善されました。

   * *note __length_hint__(): 12c0. が、公式な言語仕様の一部になりました
     (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.13.3 新たなモジュール
-----------------------

* Menu:

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


File: python.info,  Node: asyncio<16>,  Next: ensurepip<2>,  Up: 新たなモジュール<10>

1.13.3.1 asyncio
................

*note asyncio: b. モジュールが追加されました ( PEP 3156(1) で定義されて
います)。これは Python のための標準的で抜き挿し可能なイベントループモデ
ルを、標準ライブラリに信頼出来る非同期 I/O サポートを追加することで提供
し、また、ほかのイベントループ実装を標準ライブラリと相互運用することを容
易にします。

Python 3.4 では、このモジュールは *note 暫定 API: 604. であるとみなされ
ています。

参考
....

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<16>,  Up: 新たなモジュール<10>

1.13.3.2 ensurepip
..................

新規の *note ensurepip: 58. モジュールは PEP 453(1) 実装のための本質的な
基盤です。通常はエンドユーザはこのモジュールを弄ぶ必要はありません。です
が、 ‘pip’ のインストレーションや仮想環境に対する自動ブートストラップを
拒否していた場合には、手動でそれをブートストラップするのに使えます。

*note ensurepip: 58. は ‘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<15>,  Prev: ensurepip<2>,  Up: 新たなモジュール<10>

1.13.3.3 enum
.............

*note enum: 59. モジュール ( PEP 435(1) にて定義) は標準の列挙型実装を提
供します。これにより (*note socket: d4. のような) ほかのモジュールが、不
透明な整数定数を後方互換を保ったまま列挙値に置き換えることによって、より
情報に富むエラーメッセージを提供したり、より良いデバッグサポートを行える
ようになります。

参考
....

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<15>,  Next: selectors<2>,  Prev: enum<9>,  Up: 新たなモジュール<10>

1.13.3.4 pathlib
................

新規モジュール *note pathlib: a8. は、異なるオペレーティングシステムごと
に適切な意味付けでファイルシステムパスを表現するクラス群を提供しています
。パスのクラス群は '純粋パス' と '具象パス' に分離されています。前者は
I/O を伴わない純粋なパス計算操作を提供するもので、後者は純粋パスを派生し
ますが I/O 操作も提供します。

Python 3.4 では、このモジュールは *note 暫定 API: 604. であるとみなされ
ています。

参考
....

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<15>,  Up: 新たなモジュール<10>

1.13.3.5 selectors
..................

新規モジュール *note selectors: ca. ( PEP 3156(1) の一部として作成されま
した)　は、高水準で効率的な I/O の多重化を行います。これは *note select:
c9. モジュールプリミティブに基いています。

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

   (1) https://peps.python.org/pep-3156/


File: python.info,  Node: statistics<6>,  Next: tracemalloc<4>,  Prev: selectors<2>,  Up: 新たなモジュール<10>

1.13.3.6 statistics
...................

新規モジュール *note statistics: da. ( 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.13.3.7 tracemalloc
....................

新たな *note tracemalloc: 108. モジュール ( 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.13.4 改良されたモジュール
---------------------------

* Menu:

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


File: python.info,  Node: abc,  Next: aifc<2>,  Up: 改良されたモジュール<10>

1.13.4.1 abc
............

新規関数 *note abc.get_cache_token(): 12cb. は、オブジェクトグラフ内での
変化の影響を受けるキャッシュをいつ無効化すれば良いかを知るために使えます
。 (Contributed by Łukasz Langa in bpo-16832(1).)

新規クラス *note ABC: 12cc. はそのメタクラスとして *note ABCMeta: 12cd.
を持ちます。この ‘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<8>,  Prev: abc,  Up: 改良されたモジュール<10>

1.13.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: 215. 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: 43d.  (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<8>,  Next: audioop,  Prev: aifc<2>,  Up: 改良されたモジュール<10>

1.13.4.3 argparse
.................

*note FileType: 326. クラスが 'encoding' 引数、 'errors' 引数を受け付け
るようになりました。これは *note open(): 333. にそのまま渡されます。
(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<5>,  Prev: argparse<8>,  Up: 改良されたモジュール<10>

1.13.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: 43d.
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<5>,  Next: collections<7>,  Prev: audioop,  Up: 改良されたモジュール<10>

1.13.4.5 base64
...............

*note base64: f. のエンコード・デコード関数が任意の *note bytes-like
object: 43d. オブジェクトを受け取れるようになりました。以前は *note
bytes: 1d2. または *note bytearray: 1d1. インスタンスである必要がありま
した。 (Contributed by Nick Coghlan in bpo-17839(1).)

新規関数 *note a85encode(): 12d2, *note a85decode(): 1ff. は ‘Ascii85’ フ
ォーマットの、 *note b85encode(): 1fb, *note b85decode(): 1fd. は
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<7>,  Next: colorsys,  Prev: base64<5>,  Up: 改良されたモジュール<10>

1.13.4.6 collections
....................

*note ChainMap.new_child(): 12d4. メソッドが、チェーンに追加する子マップ
を指定する '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<7>,  Prev: collections<7>,  Up: 改良されたモジュール<10>

1.13.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<7>,  Next: dbm<7>,  Prev: colorsys,  Up: 改良されたモジュール<10>

1.13.4.8 contextlib
...................

新規コンテキストマネージャ *note contextlib.suppress: 12d7. によって、意
図して単独ステートメントからの例外を抑制しているというコードの意図をはっ
きりと読み手に伝えることが出来ます。 (Contributed by Raymond Hettinger
in bpo-15806(1) and Zero Piraeus in bpo-19266(2).)

新規コンテキストマネージャ *note contextlib.redirect_stdout(): 11a3. は
、ユーティリティスクリプトにて、その出力を *note sys.stdout: ea0. に書き
出す一方でその向き先を変えれない頑固な API の扱いを簡単にしてくれます。
これを使うと、 ‘sys.stdout’ 出力をなにかほかのストリームに振り替えたり、
あるいは *note io.StringIO: 12d8. と組み合わせて文字列化したり出来ます。
後者などは特に便利で、たとえば元々はコマンドラインインターフェイスとして
実装された関数からの出力を取り込む、などということが出来ます。このコンテ
キストマネージャはユーティリティスクリプト以外では使わない方が肝要です。
というのもこれは ‘sys.stdout’ の大域的な状態に影響を与えてしまうからです
。 (Contributed by Raymond Hettinger in bpo-15805(3).)

*note contextlib: 27. ドキュメントにも改善が行われ、コンテキストマネージ
ャを単独で使うのと再利用したり再入可能(リエントラント)するのとの違いにつ
いての *note 議論: 12d9. が追加されました。

   ---------- 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<7>,  Next: dis<5>,  Prev: contextlib<7>,  Up: 改良されたモジュール<10>

1.13.4.9 dbm
............

*note dbm.open(): 12db. がコンテキスト管理プロトコルをサポートするように
なりました: *note with: 215. ブロックで使うとデータベースオブジェクトの
‘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<7>,  Up: 改良されたモジュール<10>

1.13.4.10 dis
.............

関数 *note show_code(): 12dd, *note dis(): 49d, *note distb(): 49e,
*note disassemble(): 49f. が新たにキーワード専用引数 'file' を受け取りま
す。これは出力先を制御します。

*note dis: 3b. モジュールはいまでは *note Instruction: 49b. クラスを中心
に据えて構築されています。これは個々のバイトコード操作の詳細に対し、オブ
ジェクト指向的なアクセスを提供するクラスです。

新規メソッド *note get_instructions(): 6f7. が、与えた Python コード片に
ついての命令 (インストラクション) ストリームを発行するイテレータを提供し
ます。これを使えば、*note dis: 3b. モジュール自身が提供しているのとは違
った方法で、バイトコードオブジェクトを調べたり加工するようなプログラムを
書くことが出来ます。例えばこのように書けます:

     >>> 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: 3b. モジュールにある色々な表示ツールが、これらの新しい構成要
素でもって書き直されました。

In addition, a new application-friendly class *note Bytecode: 49c.
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(): 6f7.
does (plus an optional 'current_offset'), and the resulting object can
be iterated to produce *note Instruction: 49b. objects.  But it also has
a *note dis: 12de. method, equivalent to calling *note dis: 49d. 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: 49c. にはクラスメソッド *note from_traceback(): 12df. も
あります。トレースバックから ‘Bytecode’ を構築します。
(‘print(Bytecode.from_traceback(tb).dis())’ は *note distb(): 49e. を使
って ‘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(): 12e0. は与えられた 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<6>,  Prev: dis<5>,  Up: 改良されたモジュール<10>

1.13.4.11 doctest
.................

A new *note option flag: 12e2, *note FAIL_FAST: 12e3, 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: 3d. コマンドラインインターフェイスは *note argparse: 7. を
使うようになりました。2 つの新オプション ‘-o’ と ‘-f’ が追加されています
。 ‘-o’ によりコマンドラインから *note doctest オプション: 12e2. を指定
することが出来ます。 ‘-f’ は ‘-o FAIL_FAST’ の速記法です (*note
unittest: 10f. CLI でサポートされる似たオプション *note
サポートされる同じオプション: 12e4. に似せるためです)。 (Contributed by
R. David Murray in bpo-11390(2).)

*note doctest: 3d. はいまや、拡張モジュールの ‘__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<6>,  Next: filecmp,  Prev: doctest<4>,  Up: 改良されたモジュール<10>

1.13.4.12 email
...............

*note as_string(): 12e6. メソッドが、その文字列表現を生成するのに使うデ
フォルトポリシーを上書き出来る 'policy' 引数を取るようになりました。つま
り *note Message: 786. を作り直したり ‘flattern’ メソッドの書式化パラメ
ータのためだけに *note generator: 43. を使うことなしに、 ‘as_string’ を
より多くの状況で使えるということになります。(Contributed by R. David
Murray in bpo-18600(1).)

*note as_bytes(): 12e7. メソッドが追加されました。これは ‘as_string’ が
文字列表現を生成するのと似たやり方で、メッセージの bytes 表現を生成しま
す。これは 'maxheaderlen' 引数を取りませんが、 'unixfrom' 引数と
'policy' 引数を取ります。 *note Message: 786. の *note __bytes__():
12e8. がこれを呼び出すようにしたので、 ‘bytes(mymsg)’ は今や直感に反しな
い結果、つまり完全にフォーマットされたメッセージを生成します。
(Contributed by R. David Murray in bpo-18600(2).)

*note Message.set_param(): 12e9. メソッドにキーワード引数 'replace' が追
加されました。真を渡すとヘッダリスト内のその位置を変更せずに関連ヘッダを
更新します。後方互換のためにデフォルトは ‘False’ です。 (Contributed by
R. David Murray in bpo-18891(3).)  サブモジュール *note contentmanager:
40. と *note policy: 52. 属性の *note content_manager: 12ea. の追加と併
せて、 *note Message: 786. の対となる二つのサブクラス (*note
EmailMessage: 221. と *note MIMEPart: 12eb.) が追加されました。 全てのド
キュメントは、 email の新規 *note 暫定 API: 604. の構成要素として追加さ
れたこの新しいモジュールにあります。 これらのクラスは、 email メッセージ
からの内容抽出や挿入を遥かに簡単に行える、数多くの新規メソッドを提供して
います。 詳細は ‘contentmanager’ のドキュメントと *note email; 使用例:
12ec. を参照してください。 これらの 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<8>,  Prev: email<6>,  Up: 改良されたモジュール<10>

1.13.4.13 filecmp
.................

*note clear_cache(): 12ee. 関数が追加されました。 *note filecmp: 5d. は
*note os.stat(): 4fc. 情報をキャッシュして最後の比較時点からのファイルの
変化をみていますが、このキャッシュをクリアします。これはたとえば、ファイ
ルシステムのタイムスタンプフィールドの解像度未満の時間差で再比較したい場
合に使えるでしょう。(Contributed by Mark Levitt in bpo-18149(1).)

New module attribute *note DEFAULT_IGNORES: 12ef. provides the list of
directories that are used as the default value for the 'ignore'
parameter of the *note dircmp(): 12f0. 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<8>,  Next: gc<8>,  Prev: filecmp,  Up: 改良されたモジュール<10>

1.13.4.14 functools
...................

新たな *note partialmethod(): 4ae. デスクリプタは、ちょうど普通の
callable に対して *note partial(): 4ad. がするように、デスクリプタへの引
数部分適用を可能にします。この新しいデスクリプタをクラス定義内で使うと、
簡単に (‘partial()’ インスタンスを含む) 任意の callable を普通のインスタ
ンスメソッドのように振舞わせることも出来ます。(Contributed by Alon Horev
and Nick Coghlan in bpo-4331(1).)  新たな *note singledispatch(): a2f. デ
コレータは、Python 標準ライブラリにシングルディスパッチのジェネリック関
数のサポートを追加します。オブジェクト指向プログラミングは共通データ集合
についての複数操作をまとめあげてクラスに押し込めようとしますが、ジェネリ
ック関数は '異なった' 種類のデータに対して動作させたい操作の複数実装をひ
とつにまとめあげる考え方です。(--訳注: ここで「ジェネリック関数」と呼ん
でいるものを他の言語との類推で理解しようとすると、「呼び出す側目線」では
同じで、「呼び出される側」目線では違うかもしれません。例えば C++ ユーザ
は「template の特殊化」もしくは「型ごとのオーバロード」との類推で理解し
てください。--)

参考
....

PEP 443(2) - シングルディスパッチのジェネリック関数

     PEP written and implemented by Łukasz Langa.

*note total_ordering(): 12f2. now supports a return value of *note
NotImplemented: 447. from the underlying comparison function.
(Contributed by Katie Miller in bpo-10042(3).)

*note partial(): 4ad. 関数のピュア 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<8>,  Next: glob<5>,  Prev: functools<8>,  Up: 改良されたモジュール<10>

1.13.4.15 gc
............

新規関数 *note get_stats(): 55e. は、インタプリタが開始してからの、世代
ごと回収統計を持つ辞書の、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<5>,  Next: hashlib<7>,  Prev: gc<8>,  Up: 改良されたモジュール<10>

1.13.4.16 glob
..............

新規関数 *note escape(): 12f5. は、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<7>,  Next: hmac<4>,  Prev: glob<5>,  Up: 改良されたモジュール<10>

1.13.4.17 hashlib
.................

新たな関数 *note hashlib.pbkdf2_hmac(): 923. は PKCS#5 パスワードベース
の鍵導出関数２(1) を提供します。 (Contributed by Christian Heimes in
bpo-18582(2).)

*note hashlib: 6b. のハッシュオブジェクトの *note name: 12f7. 属性が、公
式にサポートされるインターフェイスになりました。これは 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<7>,  Up: 改良されたモジュール<10>

1.13.4.18 hmac
..............

*note hmac: 6d. は、 *note new(): e69. の 'key' 引数として ‘bytearray’ と
‘bytes’ を許容するようになり、また、 ‘new()’ 関数と *note update():
12f9. メソッドの両方への 'msg' パラメータとして、 *note hashlib: 6b. モ
ジュールがサポートする任意の型を許容するようになりました。(Contributed
by Jonas Borgström in bpo-18240(1).)

*note hmac.new(): e69. 関数への 'digestmod' 引数には、*note hashlib: 6b.
が認識する任意のハッシュダイジェスト名を渡せるようになりました。これとと
もに、 'digestmod' のデフォルトとして ‘MD5’ を使う現在の振る舞いは非推奨
です。将来のバージョンの Python ではこれのデフォルト値はなくなり、指定が
必須になります。 (Contributed by Christian Heimes in bpo-17276(2).)

*note block_size: 12fa. 属性と *note name: 12fb. 属性 (と *note
digest_size: 12fc. 属性の公式ドキュメント) の追加をもって、 *note hmac:
6d. モジュールは完全に 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.13.4.19 html
..............

新規関数 *note unescape(): d25. は HTML5 文字参照を対応する Unicode 文字
に変換します。 (Contributed by Ezio Melotti in bpo-2927(1).)

*note HTMLParser: c51. が新規キーワード引数 'convert_charrefs' を受け取
ります。これが ‘True’ の場合に、全ての文字参照が自動的に変換されます。後
方互換性の問題から今はこのデフォルトを ‘False’ にしてありますが、将来バ
ージョンの Python でこれを ‘True’ に変えます。ですから値は明示的にセット
してこの新しい機能を使うように更新しておくと良いです。(Contributed by
Ezio Melotti in bpo-13633(2).)

*note HTMLParser: c51. の '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.13.4.20 http
..............

*note send_error(): 12ff. 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:
1300. attribute and sent as the body of the error response.
(Contributed by Karl Cow in bpo-12921(1).)

*note http.server: 75. の *note コマンドラインインターフェイス: 232. に
‘-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.13.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<10>,  Prev: idlelib と IDLE<4>,  Up: 改良されたモジュール<10>

1.13.4.22 importlib
...................

*note InspectLoader: 1303. ABC に新規メソッド *note source_to_code():
1d6. が追加されました。ソースデータとパスを受け取り、コードオブジェクト
を返します。これのデフォルト実装は ‘compile(data, path, 'exec',
dont_inherit=True)’ と同じです。 (Contributed by Eric Snow and Brett
Cannon in bpo-15627(1).)

*note InspectLoader: 1303. では *note get_code(): 1304. メソッドへのデフ
ォルト実装追加も行われました。とはいえ性能面の理由より、通常はデフォルト
実装をオーバライドすることが望ましいです。 (Contributed by Brett Cannon
in bpo-18072(2).)

The *note reload(): 92d. function has been moved from ‘imp’ to *note
importlib: 7a. as part of the ‘imp’ module deprecation.  (Contributed by
Berker Peksag in bpo-18193(3).)

*note importlib.util: 80. now has a *note MAGIC_NUMBER: 927. 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: 80. functions *note cache_from_source(): 338.
and *note source_from_cache(): 92e. replace the same-named functions in
the deprecated ‘imp’ module.  (Contributed by Brett Cannon in
bpo-18194(5).)

*note importlib: 7a. ブートストラップ *note NamespaceLoader: 1305. が
*note InspectLoader: 1303. 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: 80. に *note decode_source(): 1306. 関数が追加され
ました。 *note universal newlines: 10f5. 処理を使って bytes からソースを
デコードします。 *note InspectLoader.get_source(): 1307. メソッドを実装
するのに便利です。

*note importlib.machinery.ExtensionFileLoader: 1075. に *note
get_filename(): 1308. メソッドが追加されました。これは本来実装されるべき
ものでしたが見落とされていました。(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<10>,  Next: ipaddress<5>,  Prev: importlib<9>,  Up: 改良されたモジュール<10>

1.13.4.23 inspect
.................

*note inspect: 81. モジュールに、ソースコードおよびモジュール・クラス・
関数についてのその他情報を手早く表示するための、基礎的な *note
コマンドラインインターフェイス: 130a. が追加されました。 (Contributed by
Claudiu Popa and Nick Coghlan in bpo-18626(1).)

新規の *note unwrap(): 130b. で、 *note functools.wraps(): 130c. (やラッ
パー関数に ‘__wrapped__’ 属性をセットするその他 API) で作られたラッパー
関数のチェインを、簡単にほどくことが出来ます。 (Contributed by Daniel
Urban, Aaron Iles and Nick Coghlan in bpo-13266(2).)  (--訳注: 「簡単に
」の意味するところについて、 *note Python API の変更: 12bf. に記述されて
いる ‘functools.update_wrapper()’ と ‘functools.wraps()’ の変更も参照し
て下さい。--)

新規 *note enum: 59. モジュールが実装されたことを受け *note inspect: 81.
モジュールは、カスタム ‘__dir__’ メソッドに対する、またメタクラスを介し
て提供される動的クラス属性に対する、ずっと良いサポートを提供出来るように
なりました。 (Contributed by Ethan Furman in bpo-18929(3) and
bpo-19030(4).)

*note getfullargspec(): b24. and ‘getargspec()’ now use the *note
signature(): 4c4. 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():
4ad. 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(): 4c4. が 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<7>,  Prev: inspect<10>,  Up: 改良されたモジュール<10>

1.13.4.24 ipaddress
...................

*note ipaddress: 83. は Python 3.3 で標準ライブラリに *note 暫定 API:
604. として追加されました。Python 3.4 リリースで、この但し書きは削除され
ました: ‘ipaddress’ は今や安定 API とみなされ、今後は通常の標準ライブラ
リの後方互換性維持要件に従います。

新規のプロパティ *note is_global: 130e. は、アドレスが 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<7>,  Next: marshal<2>,  Prev: ipaddress<5>,  Up: 改良されたモジュール<10>

1.13.4.25 logging
.................

*note TimedRotatingFileHandler: 1310. に 'atTime' パラメータが追加されま
した。ロールオーバ対象となる日付での時刻を指定します。 (Contributed by
Ronald Oussoren in bpo-9556(1).)

*note SocketHandler: 1311. と *note DatagramHandler: 1312. が Unix ドメ
インソケットをサポートするようになりました ('port' に ‘None’ をセットす
ることで)。 (Contributed by Vinay Sajip in commit ce46195b56a9(2) .)

*note fileConfig(): f12. が 'fname' パラメータとして *note
configparser.RawConfigParser: 1313. のサブクラスを許容するようになりまし
た。これはロギングの設定がアプリケーション全体の設定の一部に過ぎない場合
や、 ‘fileConfig()’ に渡す前にアプリケーションが設定を修正するような場合
でも設定ファイルを使用することを容易にします。(Contributed by Vinay
Sajip in bpo-16110(3).)

*note logging.config.listen(): 1314. 関数経由でソケットから受信したロギ
ング設定データを、処理前に検証出来るようになりました。新規のキーワード引
数 '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<4>,  Prev: logging<7>,  Up: 改良されたモジュール<10>

1.13.4.26 marshal
.................

*note marshal: 90. のバージョンが 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<4>,  Next: multiprocessing<8>,  Prev: marshal<2>,  Up: 改良されたモジュール<10>

1.13.4.27 mmap
..............

mmap objects are now *note weakly referenceable: 12be.  (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<4>,  Up: 改良されたモジュール<10>

1.13.4.28 multiprocessing
.........................

*note multiprocessing: 98. を使ってプロセスを開始する *note 開始方式:
474. として、Unix において 2 つ、 ‘spawn’ と ‘forkserver’ が追加されまし
た。これらはスレッドとプロセスのミックスをより堅牢にし、また、 ‘spawn’ は
multiprocessing が以前から常に Windows で使ってきたセマンティクスと一致
します。新規関数の、 *note get_all_start_methods(): 1318. はプラットフォ
ームで利用出来るすべての開始方式を報告し、 *note get_start_method():
1319. は現在設定されている開始方式を報告し、 *note set_start_method():
4de. は開始方式を設定します。(Contributed by Richard Oudkerk in
bpo-8713(1).)

*note multiprocessing: 98. には、子プロセスがどのように作られるかを決定
する ‘context’ のコンセプトが追加されています。新規関数 *note
get_context(): 4dd. は指定した開始方式を使うコンテキストを返します。コン
テキストは ‘multiprocessing’ モジュール自身と同じ API を持っているので、
コンテキスト内で操作する *note Pool: 131a. や他のオブジェクトを、それを
使って作成することが出来ます。コンテキストによって、フレームワークとアプ
リケーションあるいは同じアプリケーションの別の部分が相互に干渉しあわない
ようにして multiprocessing を使うことが出来ます。(Contributed by Richard
Oudkerk in bpo-18999(2).)

昔からの 'fork' 開始方式を除き、子プロセスはもはや必要のないハンドル・フ
ァイル記述子をその親から継承しません。 (part of bpo-8713(3)).

*note multiprocessing: 98. が開始方式に ‘spawn’ または ‘forkserver’ を使
う場合に、子プロセスで適切に ‘__main__’ を初期化するために *note runpy:
c6. (これが ‘-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<14>,  Prev: multiprocessing<8>,  Up: 改良されたモジュール<10>

1.13.4.29 operator
..................

新規関数 *note length_hint(): 131c. は、言語仕様となった特殊メソッド
*note __length_hint__(): 12c0. の 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<14>,  Next: pdb<9>,  Prev: operator<4>,  Up: 改良されたモジュール<10>

1.13.4.30 os
............

新規関数により *note 継承可能フラグ: 12ad. を制御出来るようになりました
。ファイル記述子には *note os.get_inheritable(): 12ae, *note
os.set_inheritable(): 12af. を、Windows のハンドルには *note
os.get_handle_inheritable(): 12b0, *note os.set_handle_inheritable():
12b1. を使います。

関数 *note cpu_count(): 6e7. が追加されました。これは Python を実行して
いるプラットフォームで利用可能な CPU 数を返します (決定できない場合は
‘None’ を返します)。既存の *note multiprocessing.cpu_count(): 131e. はこ
の関数の値を返すようになりました。(Contributed by Trent Nelson, Yogesh
Chaudhari, Victor Stinner, and Charles-François Natali in bpo-17914(1).)

*note os.path.samestat(): 131f. が Windows プラットフォームでも動作する
ようになりました (また、 *note os.path.samefile(): 1320. の実装は Unix と
Windows で共有されました)。 (Contributed by Brian Curtin in
bpo-11939(2).)

*note os.path.ismount(): dda. が Windows において、ドライブルートよりも
下にあるマウントポイントを認識するようになりました。 (Contributed by Tim
Golden in bpo-9035(3).)

*note os.open(): 114f. supports two new flags on platforms that provide
them, *note O_PATH: 1321. (un-opened file descriptor), and *note
O_TMPFILE: 1322. (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<9>,  Next: pickle<6>,  Prev: os<14>,  Up: 改良されたモジュール<10>

1.13.4.31 pdb
.............

*note pdb: aa. が、ジェネレータ、 *note yield: d97. 、 ‘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(): 1324. 関数へのアクセスを取り戻しました。 Python 2
の ‘pdb’ には ‘print’ コマンドはなく ‘print’ の入力は Python 2 の
‘print’ 文を実行していました。 Python 3 で pdb の *note p: 1325. コマン
ドへのエイリアスとして ‘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<6>,  Next: plistlib<2>,  Prev: pdb<9>,  Up: 改良されたモジュール<10>

1.13.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__(): 987. 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<6>,  Up: 改良されたモジュール<10>

1.13.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(): d1e,
*note dump(): d20, *note loads(): d1f, and *note dumps(): d21.
functions.  (The older API is now deprecated.)  In addition to the
already supported XML plist format (*note FMT_XML: 1328.), it also now
supports the binary plist format (*note FMT_BINARY: 1329.).
(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<5>,  Prev: plistlib<2>,  Up: 改良されたモジュール<10>

1.13.4.34 poplib
................

*note poplib: b1. に 2 つの新規メソッドが追加されました。 *note capa():
132b. は POP サーバにより公表された機能リストを返します。 *note stls():
132c. は平文 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<5>,  Next: pty<2>,  Prev: poplib<3>,  Up: 改良されたモジュール<10>

1.13.4.35 pprint
................

*note pprint: b3. モジュールの、 *note PrettyPrinter: 132e. クラス、
*note pformat(): 132f. 関数、 *note pprint(): c05. 関数に、新規オプショ
ン '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<5>,  Up: 改良されたモジュール<10>

1.13.4.36 pty
.............

*note pty.spawn(): 1331. が ‘None’ ではなく *note os.waitpid(): 1157. か
らの戻り値から取ったステータス値を返すようになりました。 (Contributed by
Gregory P. Smith.)


File: python.info,  Node: pydoc<5>,  Next: re<10>,  Prev: pty<2>,  Up: 改良されたモジュール<10>

1.13.4.37 pydoc
...............

*note pydoc: bd. モジュールがイントロスペクション API *note
inspect.signature(): 4c4. に直接基くようになりました。これによりより幅広
く callable オブジェクトのシグニチャ情報を提供出来るようになりました。こ
の変更は、ヘルプ情報表示の際に ‘__wrapped__’ 属性も考慮に入れられること
も意味しています。(Contributed by Larry Hastings in bpo-19674(1).)

*note pydoc: bd. モジュールはもはや既に束縛済みのメソッドでは ‘self’ パ
ラメータを表示しません。それよりも、与えられた callable の正確な現在のシ
グニチャを常に表示しようとします。 (Contributed by Larry Hastings in
bpo-20710(2).)

*note pydoc: bd. に直接なされた変更に加え、背後の *note inspect: 81. モ
ジュールの改善が、カスタム ‘__dir__’ メソッドやさまざまなデスクリプタの
扱いについての振る舞いの大幅な改善に寄与しました。

組み込み *note help(): cad. は *note pydoc: bd. モジュールに基いているの
で、上記変更は ‘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<10>,  Next: resource<2>,  Prev: pydoc<5>,  Up: 改良されたモジュール<10>

1.13.4.38 re
............

New *note fullmatch(): 1334. function and *note Pattern.fullmatch():
1335. 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 正規表現オブジェクト: 1336. の repr にパターンとフラグを含めるよう
になりました。 *note match オブジェクト: 1337. の 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<2>,  Next: select,  Prev: re<10>,  Up: 改良されたモジュール<10>

1.13.4.39 resource
..................

新規関数 *note prlimit(): 3ef. は、指定プロセスのリソースリミットの問い
合わせとセットを、一度の呼び出しで行えます。カーネルバージョン 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: 1339, *note RLIMIT_NICE:
133a, *note RLIMIT_RTPRIO: 133b, *note RLIMIT_RTTIME: 133c, and *note
RLIMIT_SIGPENDING: 133d.  (Contributed by Christian Heimes in
bpo-19324(2).)

On FreeBSD version 9 and later, there some new FreeBSD specific
constants: *note RLIMIT_SBSIZE: 133e, *note RLIMIT_SWAP: 133f, and *note
RLIMIT_NPTS: 1340.  (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<3>,  Prev: resource<2>,  Up: 改良されたモジュール<10>

1.13.4.40 select
................

*note epoll: 1342. がコンテキスト管理プロトコルをサポートするようになり
ました: *note with: 215. ブロックで使うと *note close(): 1343. メソッド
がブロックの終了時に自動的に呼び出されます。 (Contributed by Serhiy
Storchaka in bpo-16488(1).)

*note devpoll: 1344. オブジェクトに、メソッド *note fileno(): 1345. とメ
ソッド *note close(): 1346. 、それに属性 *note closed: 1347. が追加され
ました。 (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<3>,  Next: shutil<7>,  Prev: select,  Up: 改良されたモジュール<10>

1.13.4.41 shelve
................

*note Shelf: 1349. がコンテキスト管理プロトコルをサポートするようになり
ました: ‘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<7>,  Next: smtpd<3>,  Prev: shelve<3>,  Up: 改良されたモジュール<10>

1.13.4.42 shutil
................

*note copyfile(): e21. が、コピー元とコピー先が同じファイルの場合に
*note Error: 134b. の限定されたサブクラスである *note SameFileError:
134c. を投げるようになりました。これにより、アプリケーションはこの特定の
エラーでそれに相応しいアクションを取れます。 (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<7>,  Up: 改良されたモジュール<10>

1.13.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<11>,  Prev: smtpd<3>,  Up: 改良されたモジュール<10>

1.13.4.44 smtplib
.................

*note SMTPException: 134f. が *note OSError: 543. のサブクラスになりまし
た。これによって、とにかくエラーが起こったのだということにしか関心がない
コードが、ソケット階層でのエラーと 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<11>,  Next: sqlite3<11>,  Prev: smtplib<3>,  Up: 改良されたモジュール<10>

1.13.4.45 socket
................

The socket module now supports the *note CAN_BCM: 1351. protocol on
platforms that support it.  (Contributed by Brian Thorne in
bpo-15359(1).)

ソケットオブジェクトで *note 継承可能フラグ: 12ad. を制御出来るようにな
りました。 *note get_inheritable(): 12b2. で取得し、 *note
set_inheritable(): 12b3. でセットします。

定数値の ‘socket.AF_*’ と ‘socket.SOCK_*’ が、新規の *note enum: 59. モ
ジュールを使った列挙値になりました。つまりデバッグなどで魑魅魍魎な整数で
はなく徳高い名前で表示されるということです。

The *note AF_LINK: 1352. constant is now available on BSD and OSX.

*note inet_pton(): d30. と *note inet_ntop(): 1353. が 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<11>,  Next: ssl<12>,  Prev: socket<11>,  Up: 改良されたモジュール<10>

1.13.4.46 sqlite3
.................

*note connect(): 3e7. 関数に新規の真偽値パラメータ '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<12>,  Next: stat,  Prev: sqlite3<11>,  Up: 改良されたモジュール<10>

1.13.4.47 ssl
.............

*note PROTOCOL_TLSv1_1: 1356. と *note PROTOCOL_TLSv1_2: 1357. (TLSv1.1
と TLSv1.2 のサポート) が追加されました。これらプロトコルのサポートは
Python が OpenSSL 1.0.1 以降とリンクしている場合にのみ利用可能です。
(Contributed by Michele Orrù and Antoine Pitrou in bpo-16692(1).)  新規
関数 *note create_default_context(): 695. は、互換性とセキュリティの間の
程よいバランスとなるよう調整された *note SSLContext: 33e. を得るための標
準手段として追加されました。それらの設定は ‘SSLContext’ コンストラクタが
与えるデフォルトよりも厳しく、そして将来的にセキュリティにおけるベストプ
ラクティスによる要請が変化すれば、事前予告なしで調整されるかもしれません
。SSL をサポートする標準ライブラリの使用においての新しいベストプラクティ
スとして、 ‘SSLContext’ を得るのには ‘create_default_context()’ を使うこ
とが推奨です。必要に応じ、対応する標準ライブラリ API の 'context' 引数に
渡すためにそれを使うよう修正してください。(Contributed by Christian
Heimes in bpo-19689(2).)

*note SSLContext: 33e. のメソッド *note load_verify_locations(): 129f. に
オプショナル引数 'cadata' が追加されました。これには PEM あるいは DER エ
ンコードの証明書を直接指定できます。前者の場合は文字列で、後者では *note
bytes-like object: 43d. で指定します。(Contributed by Christian Heimes
in bpo-18138(3).)

関数 *note get_default_verify_paths(): 1358. が追加されました。これは
*note set_default_verify_paths(): 1359. メソッドが OpenSSL デフォルトの
‘cafile’ と ‘capath’ をセットするのに使うパスと環境変数から成る名前付き
タプルを返します。デフォルトの検証にまつわる問題をデバッグするのに使える
でしょう。(Contributed by Christian Heimes in bpo-18143(4).)

*note SSLContext: 33e. の新規メソッド *note cert_store_stats(): 135a. は
ロードされた ‘X.509’ 証明書、 ‘X.509 CA’ 証明書、証明書失効リスト
(‘crl’) を報告し、また、新規メソッド *note get_ca_certs(): 135b. はロー
ドされた ‘CA’ 証明書のリストを返します。(Contributed by Christian Heimes
in bpo-18147(5).)

If OpenSSL 0.9.8 or later is available, *note SSLContext: 33e. has a new
attribute *note verify_flags: 135c. that can be used to control the
certificate verification process by setting it to some combination of
the new constants *note VERIFY_DEFAULT: 135d, *note
VERIFY_CRL_CHECK_LEAF: 135e, *note VERIFY_CRL_CHECK_CHAIN: 135f, or
*note VERIFY_X509_STRICT: 758.  OpenSSL does not do any CRL verification
by default.  (Contributed by Christien Heimes in bpo-8813(6).)

*note SSLContext: 33e. の新規メソッド *note load_default_certs(): 1360.
は、プラットフォームによって異なるデフォルトの場所から “認証局”
(CA=certification authority) 証明書ファイル一式をロードします。クライア
ントがサーバを検証するための TLS web サーバ証明の証明書をロード
(‘purpose=’*note SERVER_AUTH: 1361.) することも、サーバがクライアント証
明書を検証するのに用いる証明書をロード (‘purpose=’*note CLIENT_AUTH:
1362.) することも出来ます。(Contributed by Christian Heimes in
bpo-19292(7).)  Windows だけで利用出来る関数が 2 つ追加されました。
*note enum_certificates(): 1363. と *note enum_crls(): 1364. で Windows
のシステム証明書ストアから、証明書、証明書の情報、CRLs (certification
revocation=証明書失効リスト) を抽出出来ます。(Contributed by Christian
Heimes in bpo-17134(8).)  新規メソッド *note
ssl.SSLContext.set_servername_callback(): 1365. によるサーバサイド SNI
(Server Name Indication) サポートが追加されました。 (Contributed by
Daniel Black in bpo-8109(9).)

*note SSLSocket.getpeercert(): 1366. が返す辞書に ‘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<12>,  Up: 改良されたモジュール<10>

1.13.4.48 stat
..............

The *note stat: d9. 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: 1368. flags, *note S_IFDOOR:
1369, *note S_IFPORT: 136a, and *note S_IFWHT: 136b.  (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<6>,  Prev: stat,  Up: 改良されたモジュール<10>

1.13.4.49 struct
................

関数 *note iter_unpack: 136d. と、コンパイル済フォーマットでのメソッド
*note struct.Struct.iter_unpack(): 136e. が追加されました。これは、与え
られたデータフォーマットの繰り返しインスタンスを含むバッファを逐次的にア
ンパックします。 (Contributed by Antoine Pitrou in bpo-17804(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17804


File: python.info,  Node: subprocess<6>,  Next: sunau<2>,  Prev: struct<3>,  Up: 改良されたモジュール<10>

1.13.4.50 subprocess
....................

*note check_output(): 1370. が 'input' 引数を受け付けるようになりました
。これは実行するコマンドにとっての ‘stdin’ を供給するのに使われます (訳
注: *note run(): f49. のドキュメント参照)。 (Contributed by Zack
Weinberg in bpo-16624(1).)

*note getoutput(): 1371. and *note getstatusoutput(): 1372. 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<14>,  Prev: subprocess<6>,  Up: 改良されたモジュール<10>

1.13.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: 215. 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: 43d.  (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<14>,  Next: tarfile<10>,  Prev: sunau<2>,  Up: 改良されたモジュール<10>

1.13.4.52 sys
.............

新規関数 *note sys.getallocatedblocks(): 1375. は、現在インタプリタによ
りアロケートされているブロック数を返します (デフォルトの
‘--with-pymalloc’ 設定での CPython では、これは *note PyObject_Malloc():
102a. API によるアロケーションです)。これはメモリリークの追跡に、とりわ
けテストスイートで自動化されている場合はなおさら有用です。 (Contributed
by Antoine Pitrou in bpo-13390(1).)

Python インタプリタが *note 対話モード: 65d. で開始する際に *note sys:
e2. モジュールの属性 *note __interactivehook__: 1376. をチェックするよう
になりました。この属性があると、対話モード開始直前にその設定値が引数なし
で呼び出されます。このチェックは *note PYTHONSTARTUP: 45a. ファイルが読
み込まれたあとで行われるので、そのファイル内でセット出来ます。 *note
site: cf. モジュールは *note readline: c2. をサポートするプラットフォー
ムではタブ補完と (‘~/.python-history’ への) 履歴保存を有効にする関数を
*note __interactivehook__ にセットします: 1377. 。この (新たな) 振る舞い
がお気に召さなければ、 ‘PYTHONSTARTUP’, *note sitecustomize: d0, *note
usercustomize: 117. のいずれかで ‘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<10>,  Next: textwrap<2>,  Prev: sys<14>,  Up: 改良されたモジュール<10>

1.13.4.53 tarfile
.................

*note tarfile: e7. モジュールはスクリプトや直接 ‘-m’ で呼ばれた場合、簡
単な *note コマンドラインインターフェイス: 1379. をサポートするようにな
りました。 これにより 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<10>,  Prev: tarfile<10>,  Up: 改良されたモジュール<10>

1.13.4.54 textwrap
..................

*note TextWrapper: 137b. に 2 つ新しい制御変数が追加されていて、これらは
属性値であり、コンストラクタ引数に渡せます。それぞれ *note max_lines:
137c. が最大出力行数、 *note placeholder: 137d. が 'max_lines' により切
り詰める場合に出力の最終行に置くテキストです。これら機能を使った新規のコ
ンビニエンス関数 *note shorten(): 137e. が追加されています。これは入力に
含まれる全ての空白文字を単一の空白に置き換え、また幅 '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<10>,  Next: traceback<6>,  Prev: textwrap<2>,  Up: 改良されたモジュール<10>

1.13.4.55 threading
...................

メインスレッドを表現する *note Thread: 427. オブジェクトを、新規関数
*note main_thread(): 1380. で得られるようになりました。通常の条件であれ
ばこれは 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<9>,  Prev: threading<10>,  Up: 改良されたモジュール<10>

1.13.4.56 traceback
...................

新規関数 *note traceback.clear_frames(): 1382. は、トレースバックオブジ
ェクトを受け取って、それが参照している全てのフレーム内のローカル変数をク
リアすることで、メモリ消費量を削減します。 (Contributed by Andrew
Kuchling in bpo-1565525(1).)

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1565525


File: python.info,  Node: types<9>,  Next: urllib<5>,  Prev: traceback<6>,  Up: 改良されたモジュール<10>

1.13.4.57 types
...............

A new *note DynamicClassAttribute(): a20. 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: 59. 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<11>,  Prev: types<9>,  Up: 改良されたモジュール<10>

1.13.4.58 urllib
................

*note urllib.request: 114. が新規クラス *note DataHandler: 1385. を介し
て ‘data:’ URL をサポートするようになりました。 (Contributed by Mathias
Panzenböck in bpo-16423(1).)

*note Request: 1386. クラスで使われる HTTP メソッドを、サブクラスで
*note method: 1387. 属性をセットすることにより指定出来るようになりました
。 (Contributed by Jason R Coombs in bpo-18978(2).)  (--訳注: ‘method’ は
3.3 で追加されたが、コンストラクタに渡されたものが設定されるだけだった。
--)

*note Request: 1386. オブジェクトは今では再利用可能です: *note full_url:
1388. あるいは *note data: 1389. 属性などが変更されると、関連する全ての
内部プロパティが更新されます。このことによって今や、例えば、 ‘Request’ オ
ブジェクトを、異なる 'data' 引数での *note OpenerDirector.open(): 138a.
の複数回呼び出し内で使ったり、あるいは、まっさらから作り直すのではなく
‘Request’ の ‘url’ を書き換えて使ったり出来ます。新たに *note
remove_header(): 138b. メソッドも追加されていて、これは ‘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: 138c. オブジェクトに、エラーに関係する HTTP レスポンス
ヘッダへのアクセスを提供する *note headers: 138d. 属性が追加されました。
(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<11>,  Next: venv<8>,  Prev: urllib<5>,  Up: 改良されたモジュール<10>

1.13.4.59 unittest
..................

The *note TestCase: 536. class has a new method, *note subTest(): 138f,
that produces a context manager whose *note with: 215. 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
サブテストを利用して繰り返しテストの区別を付ける: 1390. にあります。
(Contributed by Antoine Pitrou in bpo-16997(1).)

*note unittest.main(): 1391. の 'defaultTest' に、テスト名からなるイテラ
ブルを渡せるようになりました。以前は文字列で単一のテスト名を渡せるだけで
した。 (Contributed by Jyrki Pulliainen in bpo-15132(2).)

テストディスカバリ最中に発生する *note SkipTest: 1392. (これはテストファ
イル内のモジュールレベルで起こせます) を、エラーとしてではなくスキップと
して報告するようになりました。 (Contributed by Zach Ware in
bpo-16935(3).)

*note discover(): 1393. が発見したファイルをソートするようになったので、
一貫したテスト順でテスト出来ます。 (Contributed by Martin Melin and Jeff
Ramnani in bpo-16709(4).)

*note TestSuite: 11b1. がその実行完了次第すぐに、テスト成功していれば、
テストへの参照を取り除くようになりました。ガーベージコレクションを行う
Python インタプリタ上ではこの振る舞いによって、テストへの参照を保持して
いるものが他にない場合のテストのガーベージコレクトを可能にします。この振
る舞いは *note TestSuite: 11b1. をサブクラス化して何もしない
‘_removeTestAtIndex’ を定義することで上書き出来ます。 (Contributed by
Tom Wardill, Matt McClure, and Andrew Svetlov in bpo-11798(5).)

テストアサーションの新規コンテキストマネージャ *note assertLogs(): 2aa.
が追加されました。これはコードブロックが *note logging: 8a. を使ってログ
メッセージを発行しているか確認します。デフォルトでは任意のロガーからの
‘INFO’ 以上のプライオリティを持つメッセージを取れますが、ロガー名と最小
プライオリティの両方とも指定可能です。コンテキストマネージャからの戻りオ
ブジェクトに対して、ログされた *note LogRecord: 1394. とフォーマットされ
たメッセージの両方あるいはどちらかを問い合わせることが出来ます。
(Contributed by Antoine Pitrou in bpo-18937(6).)

テストディスカバリが名前空間パッケージで動作するようになりました。
(Contributed by Claudiu Popa in bpo-17457(7).)

*note unittest.mock: 110. オブジェクトが、呼び出しが合致する際に仕様とし
てのシグニチャを検査するようになりました。これはつまり、以前は位置引数だ
けの合致だったものが、位置引数と名前の両方で合致できるようになったという
ことです。(Contributed by Antoine Pitrou in bpo-17015(8).)

*note mock_open(): 1395. 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<8>,  Next: wave<4>,  Prev: unittest<11>,  Up: 改良されたモジュール<10>

1.13.4.60 venv
..............

*note venv: 11a. に ‘csh’ と ‘fish’ シェルの有効化スクリプトが追加されま
した。 (Contributed by Andrew Svetlov in bpo-15417(1).)

*note EnvBuilder: 778. クラスとコンビニエンス関数 *note create(): 779. が
新規キーワード引数 '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<4>,  Next: weakref<2>,  Prev: venv<8>,  Up: 改良されたモジュール<10>

1.13.4.61 wave
..............

The *note getparams(): 1398. method now returns a namedtuple rather than
a plain tuple.  (Contributed by Claudiu Popa in bpo-17487(1).)

*note wave.open(): d1b. がコンテキスト管理プロトコルをサポートするように
なりました。 (Contributed by Claudiu Popa in bpo-17616(2).)

*note wave: 11c. は *note
シーク不能なファイルへの書き出しが出来るように: 1399. なりました。
(Contributed by David Jones, Guilherme Polo, and Serhiy Storchaka in
bpo-5202(3).)

*note writeframesraw(): 139a. メソッドと *note writeframes(): 139b. メソ
ッドが *note bytes-like object: 43d. を受け付けるようになりました。
(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<4>,  Up: 改良されたモジュール<10>

1.13.4.62 weakref
.................

新規 *note WeakMethod: 139d. クラスは、インスタンスメソッドへの弱参照を
シミュレートします。 (Contributed by Antoine Pitrou in bpo-14631(1).)

新規クラス *note finalize: e42. は、弱参照自身のライフサイクルを注意深く
管理する必要性なしに、オブジェクトがガーベージコレクトされる際に呼び出さ
れるコールバックを登録することを可能にします。 (Contributed by Richard
Oudkerk in bpo-15528(2).)

*note ref: 139e. に関連付いたコールバック (あれば) を、新規属性 *note
__callback__: 139f. で取得出来るようになりました。(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.13.4.63 xml.etree
...................

ノンブロッキングなアプリケーションでの XML ドキュメントの解析に、新規パ
ーサ *note XMLPullParser: 13a1. を利用出来ます。実例は *note
非ブロックパースのためのプル API: 13a2. をみてください。 (Contributed by
Antoine Pitrou in bpo-17741(1).)

*note xml.etree.ElementTree: 12e. の関数 *note tostring(): 13a3. 、*note
tostringlist(): 13a4. と、 *note ElementTree: d1d. クラスの *note
write(): e5f. メソッドに、 *note キーワード専用引数: 7a9. の
'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.13.4.64 zipfile
.................

*note PyZipFile: 13a6. クラスの *note writepy(): 13a7. メソッドに
'filterfunc' オプションが追加されました。これはアーカイブにどのディレク
トリ・ファイルを加えるのかをコントロールするのに使うことが出来ます。例え
ばテスト用ファイルをアーカイブから除外する、などということが出来ます。
(Contributed by Christian Tismer in bpo-19274(1).)

The 'allowZip64' parameter to *note ZipFile: ab6. and *note PyZipFile:
13a6. 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.13.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.13.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.13.5.2 PEP 442: オブジェクトの安全なファイナライゼーション
............................................................

PEP 442(1) removes the current limitations and quirks of object
finalization in CPython.  With it, objects with *note __del__(): 13ab.
methods, as well as generators with *note finally: 453. clauses, can be
finalized when they are part of a reference cycle.

この変更の一環で、モジュールのグローバルは、ほとんどのケースではインタプ
リタのシャットダウン中に強制的に *note None: a6a. がセットされることはな
くなり、代わりに循環ガーベージコレクタの通常のオペレーションに委ねます。
このことは、循環 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.13.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: 13ad. 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.13.5.4 PEP 436: Argument Clinic
.................................

「Argument Clinic」( PEP 436(1)) は CPython ビルドプロセスの新たな鍋の具
です。ビルトインと標準ライブラリの拡張モジュールが C で実装されるにあた
って、正確なシグニチャを定義し保守管理するプロセスを単純化するのに使えま
す。

Python 3.4 では既にいくつかの標準ライブラリ拡張モジュールが Argument
Clinic を使うように変換されていて、またこれの結果として *note pydoc: bd.
と *note inspect: 81. が更新されました。

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.13.5.5 その他のビルド並びに C API の変更
..........................................

   * *note PyType_GetSlot(): c76. 関数が、安定 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(): 824. が ‘%s’, ‘%A’, ‘%U’, ‘%V’, ‘%S’,
     ‘%R’ についての幅と精度の指定をサポートするようになりました。
     (Contributed by Ysj Ray and Victor Stinner in bpo-7330(5).)

   * 既存の *note PyStructSequence_InitType(): 13b0. 関数を補うものとし
     て、 *note PyStructSequence_InitType2(): 13b1. が追加されました。違
     いは、これは成功時に ‘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(): 131c. と等価な C API 関数 *note
     PyObject_LengthHint(): 13b2. が追加されました。 (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.13.5.6 その他の改善
.....................

   * The *note python: 13b5. command has a new *note option: 13b6, ‘-I’,
     which causes it to run in "isolated mode", which means that *note
     sys.path: 19f. 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: c2. をサポートするプラットフォームで、対話インタプ
     リタでの ‘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: 13b7.
     now also checks for memory allocation leaks, using *note
     sys.getallocatedblocks(): 1375.  (Contributed by Antoine Pitrou in
     bpo-13390(9).)

   * ‘python -m’ が名前空間パッケージで動くようになりました。

   * *note stat: d9. モジュールが 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__: 1020.  (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: 13b8. の値内で、エンコーディング名
     を省略出来るようになりました。つまり、デフォルトエンコーディングを
     変更することなしにエラーハンドラだけをセット出来ます。 (Contributed
     by Serhiy Storchaka in bpo-18818(20).)

   * *note bz2: 14.、*note lzma: 8d.、*note gzip: 6a. モジュールの
     ‘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.13.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: c1, *note
     collections: 1e, *note locale: 89. モジュール、およびそれらの依存モ
     ジュールは、デフォルトではインポートされません。 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: c41. が大半の場合 Python2 のバージョン以上に速く
     なりました。*note lzma.LZMAFile: 13ba. も最適化されました。
     (Contributed by Serhiy Storchaka and Nadeem Vawda in bpo-16034(8).)

   * *note random.getrandbits(): 13bb. が (通常使用される) 小さな整数に
     対して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: df.
     (Contributed by Richard Oudkerk in bpo-15758(11).)

   * *note html.escape(): 13bc. が10倍速くなりました。(Contributed by
     Matt Bryant in bpo-18020(12).)

   * Windows において、 ‘obmalloc’ で CRT の ‘malloc’ の代わりにネイティ
     ブの ‘VirtualAlloc’ を使うようになりました。人工的なベンチマーク結
     果は、メモリー消費が 3% 減ったことを示しています。

   * *note os.urandom(): 936. 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.13.6 非推奨
-------------

このセクションでは、Python 3.4 で非推奨となり Python 3.5 以降で削除予定
となる、様々な API とその他機能性についてをカバーします。(全てではありま
せんが) ほとんどのケースで、非推奨に対する警告を (たとえば ‘-Wd’ を使っ
て) 有効にしたインタプリタ起動時、非推奨 API を使うと *note
DeprecationWarning: 2d4. を励起します。

* Menu:

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


File: python.info,  Node: Python API の非推奨項目,  Next: 非推奨の機能,  Up: 非推奨<12>

1.13.6.1 Python API の非推奨項目
................................

   * As mentioned in *note PEP 451; インポートシステムのための
     ModuleSpec 型: 128d, a number of *note importlib: 7a. methods and
     functions are deprecated: ‘importlib.find_loader()’ is replaced by
     *note importlib.util.find_spec(): 7ad.;
     ‘importlib.machinery.PathFinder.find_module()’ is replaced by *note
     importlib.machinery.PathFinder.find_spec(): 13bf.;
     ‘importlib.abc.MetaPathFinder.find_module()’ is replaced by *note
     importlib.abc.MetaPathFinder.find_spec(): c43.;
     ‘importlib.abc.PathEntryFinder.find_loader()’ and ‘find_module()’
     are replaced by *note importlib.abc.PathEntryFinder.find_spec():
     c46.; 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(): c44, *note
     importlib.abc.InspectLoader.exec_module(): 13c0. *note
     importlib.abc.SourceLoader.exec_module(): 13c1.) 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(): e69. 関数の 'digestmod' がデフォルトで暗黙に
     ‘MD5’ を使う仕様は撤廃されます。Python 3.6 では 'digestmod' 引数に
     は明示的にダイジェスト名かコンストラクタを渡すことが求められます。

   * *note ftplib: 61. モジュール内の内部クラス ‘Netrc’ はずっと長いこと
     そのドキュメンテーション文字列内で非推奨であることを謳ってきました
     。これは今や *note DeprecationWarning: 2d4. を発行します。Python
     3.5 ではこのクラスは完全に削除されます。

   * *note subprocess.Popen.wait(): 272. の文書化されていない引数
     'endtime' は本来曝してはいけないものでしたので、使用されていないこ
     とを願っています。これは非推奨ですし、確実に Python 3.5 では削除さ
     れるのではないでしょうか。(--訳注: 3.5 では削除はされませんでしたが
     、もちろん使用しないでください。これは内部用です。--)

   * *note HTMLParser: c51. の 'strict' 引数は非推奨です。

   * The *note plistlib: b0. ‘readPlist()’, ‘writePlist()’,
     ‘readPlistFromBytes()’, and ‘writePlistToBytes()’ functions are
     deprecated in favor of the corresponding new functions *note
     load(): d1e, *note dump(): d20, *note loads(): d1f, and *note
     dumps(): d21.  ‘Data()’ is deprecated in favor of just using the
     *note bytes: 1d2. constructor.

   * *note sysconfig: e4. のキー ‘SO’ は非推奨です。これは ‘EXT_SUFFIX’
     に取って代わられました。

   * 種々の ‘open’ 関数で受け付けられていた ‘U’ モードは非推奨となりまし
     た。Python 3 ではこれは何も役に立つことはしません。 *note
     io.TextIOWrapper: ba0. (必要ならば)、 'newline' 引数を適切に使うこ
     とによって置き換えられるはずです。

   * *note xml.etree.ElementTree.iterparse(): 3f2. の 'parser' 引数と
     *note XMLParser(): e1c. の 'html' 引数が非推奨となりました。後者は
     (訳注: 第一引数のため) 削除に備えて ‘XMLParser’ への全ての引数はキ
     ーワード引数として渡すようにしてください。


File: python.info,  Node: 非推奨の機能,  Prev: Python API の非推奨項目,  Up: 非推奨<12>

1.13.6.2 非推奨の機能
.....................

   * *note IDLE -- Python のエディタとシェル: 13c3. の ‘-n’ フラグでの実
     行 (サブプロセスを起こさない) は非推奨となりました。ただし、この機
     能は bpo-18823(1) が解決するまでは削除はされません。

   * *note site: cf. モジュールは "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.13.7 削除
-----------

* Menu:

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


File: python.info,  Node: サポートされなくなったオペレーティングシステム,  Next: API と機能の削除<5>,  Up: 削除<12>

1.13.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.13.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: 7a. から削除されま
     した。 (Contributed by Taras Lyapun in bpo-15641(6).)

   * *note HTTPConnection: 22e. と *note HTTPSConnection: 22f. の
     'strict' 引数は削除されました。 HTTP 0.9 スタイルの 「Simple
     Responses」はもはやサポートされません。

   * *note urllib.request.Request: 1386. の非推奨となっていた
     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: 90. から削
     除されました。 (Contributed by Dan Riti in bpo-15480(7).)

   * *note inspect.Signature: 6ee.: 位置専用パラメータを示すのに今では正
     当な名前が必要です。

   * object 自身の *note object.__format__(): a15. はもはや空でないフォ
     ーマット文字列を受け付けず、 *note TypeError: 29c. を投げます。空で
     ない文字列を渡すことは既に 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: 13c7. 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.13.7.3 コードの整理
.....................

   * *note pydoc: bd. モジュールで、使用されておらず文書化もされていなか
     った内部的な ‘Scanner’ クラスが削除されました。

   * ひどく壊れていた OSX システムで呼ばれる可能性があるのみだった *note
     platform: af. モジュールの非公開関数 ‘_mac_ver_lookup’,
     ‘_mac_ver_gstalt’, ‘_bcd2str’ とあわせて、非公開かつ実質的に未使用
     だった ‘_gestalt’ モジュールが削除されました。 (see bpo-18393(1))

   * *note tarfile: e7. モジュールの名前空間内に *note stat: d9. 定数群
     がハードコードでコピーされていましたが、これは削除されました。

   ---------- 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.13.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.13.8.1 'python' コマンドの挙動の変更
......................................

   * POSIX シェルでは、環境変数 ‘PATH’ に空の値をセットすることは、何も
     セットしないことと同じです。ところが *note PYTHONPATH: 13cb. に空の
     値をセットすることは、何もセットしないことと 'まったく同じではあり
     ませんでした': ‘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
     その他の改善: 13b4. セクション内参照)。

   ---------- 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.13.8.2 Python API の変更
..........................

   * *note importlib.abc: 7b. 内に定義されている ABC は、無分別に *note
     NotImplementedError: 5a1. を投げるのではなく、相応しい例外を投げる
     かデフォルト値を返すかのどちらかになりました。このことは *note
     super(): 44a. を呼び出して ABC がするがままに任せているコードにのみ
     影響します。互換性のために、必要であれば ‘NotImplementedError’ とそ
     の投げられる新たな例外の両方を捕捉してください。

   * The module type now initializes the *note __package__: 593. and
     *note __loader__: 30b. 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:
     13cc, or if Python 2 compatibility is necessary you can use
     ‘imp.is_frozen()’.

   * *note py_compile.compile(): ded. が書き込み先ファイルパスがシンボリ
     ックリンクか非レギュラーファイルの場合に *note FileExistsError:
     13cd. を投げるようになりました。これは、警告の役割を果たすためです
     、インポートがファイルパスの元のファイルタイプが何かによらずに、そ
     れらファイルをレギュラーファイルで上書きすることの。

   * ソースコードをロードしようとして *note SyntaxError: 189. かもしくは
     *note UnicodeDecodeError: ddb. を引き起こした場合に、 *note
     importlib.abc.SourceLoader.get_source(): 13ce. はそれを *note
     ImportError: 1c8. に読み替えて投げることをしなくなりました。
     ‘ImportError’ はそうあるべきなのに見つからない場合にのみ投げられる
     べきなので、ソースコードが見つかったけれども正しくない構造である場
     合の意味にまで及ぶのは、手を伸ばし過ぎで過負荷です。ImportError を
     捕捉していたコードで今後とも構文エラーとデコーディングの問題を無視
     したいと望むならば、これら 3 つ全ての例外を捕捉するようにしてくださ
     い。 (訳注: changeset 84172:e353f64dfd95(4) )

   * *note functools.update_wrapper(): 13cf. と *note functools.wraps():
     130c. が、たとえその関数も ‘__wrapped__’ を持っていたとしても正しく
     その関数が包まれるように ‘__wrapped__’ 属性値をセットするようになり
     ました。つまり ‘__wrapped__’ 属性は、以前のようにチェイン内の全ての
     ‘__wrapped__’ 属性が最も内側の関数を参照するのではなく、デコレート
     された関数の積み上げを正しくリンクするようになったということです。
     以前の振る舞いが意図されたものであると思い込んでいたイントロスペク
     ションライブラリの作者は、チェインの中の最初の関数 (‘__wrapped__’ 属
     性を持たない) にアクセスするのに *note inspect.unwrap(): 130b. を使
     えます。(--訳注: bpo-17482(5).  わかりにくいので実例で。中で適切に
     @wrap を使うデコレータ @deco1、@deco2 があるとして、my_func をこの
     両方でデコレートするとします。この場合に、Python 3.3 までは
     ‘my_func.__wrapped__.__wrapped__’ が AttributeError になります。今
     回のこの修正で ‘my_func.__wrapped__.__wrapped__’ は期待通りに振舞い
     ます。 --)

   * *note inspect.getfullargspec(): b24. は、 *note
     inspect.signature(): 4c4. を前提とした再実装がなされました。これに
     より、かつて扱えていたよりも遥かに広い種類の呼び出し可能 (callable)
     を扱うようになりました (訳注: 例えば *note open(): 333. などは
     Python 3.3 までは扱えなかった)。Python 3.4 系列の経過のなかで、追加
     で組み込みや拡張モジュールの callable がシグニチャのメタデータを持
     つことが期待されています。 ‘inspect.getfullargspec()’ が非 Python
     callable で失敗することを前提としたコードは、適宜調整の必要があるか
     もしれません。

   * *note importlib.machinery.PathFinder: 13d0. は *note
     sys.path_hooks: 13d1. 内のオブジェクトに、空文字列の場合は現在作業
     ディレクトリを渡すようになりました。結果の *note
     sys.path_importer_cache: 9e0. が決して ‘''’ を含まないことになるの
     で、 *note sys.path: 19f. に基いて ‘sys.path_importer_cache’ を巡回
     しても全てのキーを見つけられません。インタプリタを ‘-m’ で起動した
     場合も含め、現在作業ディレクトリ内でインポートされた際のモジュール
     の ‘__file__’ も絶対パスで持つようになりました (ただしスクリプトが
     コマンドラインから相対パスを使って直接実行された際の
     ‘__main__.__file__’ を除きます (Contributed by Brett Cannon in
     bpo-18416(6)))。 (bpo-18416(7))

   * *note HTTPConnection: 22e. と *note HTTPSConnection: 22f. から
     'strict' 引数が削除されたことは、残りの引数をキーワード引数としてで
     はなく位置引数として使っていたなら意味が変わってしまいます。非推奨
     警告に注意を払ってきたのであれば、あなたのコードは既に全てのオプシ
     ョナル引数をキーワードで渡しているはずです。

   * ‘from __future__ import ...’ ステートメントの間に文字列が含まれる場
     合に '常に' *note SyntaxError: 189. となるようになりました。以前は
     モジュールの docstring が先頭にある場合とない場合で振る舞いが違って
     いて、ない場合にこのエラーが意図せず無視される場合がありました。こ
     の修正は CPython を言語仕様に準拠させるものです。Jython と PyPy で
     は既にこれが行われています。 (bpo-17434(8))

   * *note ssl.SSLSocket.getpeercert(): 1366. と *note
     ssl.SSLSocket.do_handshake(): 1221. は、 ‘SSLSocket’ が未接続時に以
     前は *note AttributeError: 1b4. を投げていましたが、 ‘ENOTCONN’ を
     持った *note OSError: 543. を投げるように改められました。加えて
     ‘getpeercert()’ はハンドシェイクが未実施の場合に *note ValueError:
     15a. を投げるようになりました。

   * *note base64.b32decode(): 1f3. が入力文字列が非 b32 文字を含む場合
     に *note TypeError: 29c. ではなく *note binascii.Error: 13d2. を投
     げるようになりました。今回のこの ‘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: 1b4. ではなく、役
     に立つ *note ValueError: 15a. を投げるようになりました。
     (bpo-9177(10))

   * *note slice.indices(): 13d3. が巨大な値で *note OverflowError: c5b.
     を起こすことはなくなりました。この修正からの流れで
     ‘slice.indices()’ は負の値に対して *note ValueError: 15a. を投げる
     ようになっています。以前はこれは馬鹿げた値を返していました。
     (bpo-14794(11))

   * 特殊メソッド ‘__complex__’ が複素数ではなく *note float: 32f. を返
     す実装をしているオブジェクトを渡すと *note cmath: 19. 関数ではエラ
     ーとなり、 *note complex: 330. コンストラクタでは受け容れられていま
     したが、これはいずれも *note TypeError: 29c. となるように改められま
     した。(bpo-16290(12).)

   * 3.2 と 3.3 での *note int: 32e. コンストラクタが 'base' パラメータ
     として誤って *note float: 32f. を許容してしまっていました。それをわ
     ざわざやっているとも思えないですが、そうしていたなら今後は *note
     TypeError: 29c. になります。 (bpo-16772(13))

   * キーワード専用引数へのデフォルト値が、通常のキーワード引数へのデフ
     ォルト値評価の 'あとで' 評価されるようになりました。前ではなく。望
     むらくは誰一人以前のバギーな振る舞いに頼っちゃうおバカなコードを書
     いていませんように。願います。 (bpo-16967(14))

   * 古いスレッド状態が *note fork(): 6c3. 後にクリアされるようになりま
     した。これにより、以前は不適切に永遠に生き残ってしまっていたいくつ
     かのシステムリソース (たとえば、スレッドローカル記憶内に維持された
     データベース接続) が解放されるようになります。 (bpo-17094(15).)

   * Parameter names in ‘__annotations__’ dicts are now mangled
     properly, similarly to *note __kwdefaults__: 13d4.  (Contributed by
     Yury Selivanov in bpo-20625(16).)

   * *note hashlib.hash.name: 12f7. が識別子を常に小文字で返すようになり
     ました。以前はいくつかの組み込みハッシュが大文字名を持っていました
     が、公式インターフェイスであることから、命名に一貫性を持たせるよう
     にしました。 (bpo-18532(17))

   * Because *note unittest.TestSuite: 11b1. now drops references to
     tests after they are run, test harnesses that reuse a *note
     TestSuite: 11b1. 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: 10f. 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__(): 13d5.) (bpo-11798(18)).

   * *note unittest: 10f. がコマンドライン解析に *note argparse: 7. を使
     うようになりました。このことで、以前は動作していた不当なコマンド形
     式で許されなくなったものがあります。理屈から言えばこれは後方互換性
     の問題ではないはずです。許されなくなったコマンド形式は意味をなして
     いなかったものですから、使われていたとは思えません。

   * The *note re.split(): 7a6, *note re.findall(): 13d6, and *note
     re.sub(): 7a7. functions, and the *note group(): 13d7. and *note
     groups(): 13d8. methods of ‘match’ objects now always return a
     'bytes' object when the string to be matched is a *note bytes-like
     object: 43d.  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: c51. の新規引数 'convert_charrefs' は現在は後方互
     換性維持のために ‘False’ をデフォルトとしていますが、最終的には
     ‘True’ がデフォルトになります。あなたのコードでは ‘HTMLParser’ の全
     ての呼び出しでこれをキーワード引数として明示することをお勧めします
     。 (bpo-13633(20))

   * *note hmac.new(): e69. 関数の 'digestmod' 引数からデフォルト値が消
     える予定です。ので、 ‘hmac.new()’ 呼び出しは常に 'digestmod' を明示
     するように修正すべきです。 (bpo-17276(21))

   * *note sysconfig.get_config_var(): 425. にキー ‘SO’ を渡すことと
     *note sysconfig.get_config_vars(): 525. の呼び出し結果から ‘SO’ キ
     ーを探すことは非推奨です。このキーは文脈依存の ‘EXT_SUFFIX’ または
     ‘SHLIB_SUFFIX’ で置き換えられるべきです。 (bpo-19555(22))

   * ‘open’ 系関数にモード ‘U’ を使っていたコードは修正すべきです。 ‘U’
     は Python 3 では無力であり、いずれはこれの使用は例外を投げるように
     なる予定です。使う関数に依存しますが、 'newline' 引数を使うか、ある
     いは必要であればストリームを *note TextIOWrapper: ba0. でラップして
     その 'newline' 引数を使うことで、その古い Python 2 の振る舞いと同等
     なものを実現出来ます。 (bpo-15204(23))

   * スクリプト内から ‘pyvenv’ を使っていて、pip がインストール 'されな
     い' ことを望むならば、コマンド呼び出しに ‘--without-pip’ を追加しな
     ければなりません。

   * indent を明示した場合の *note json.dump(): 10ff. と *note
     json.dumps(): 254. のデフォルトの振る舞いが変更されました。要素を区
     切るカンマが行末に来る場合の後ろに、空白を追加しなくなりました。こ
     れはその出力のテストを空白に繊細な比較をすることで行っている場合に
     だけ問題になります。 (bpo-16333(24))

   * *note doctest: 3d. が拡張モジュールの ‘__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.13.8.3 C API の変更
.....................

   * いくつかの内部 C API とともに *note PyEval_EvalFrameEx(): 13da,
     *note PyObject_Repr(): 13db, *note PyObject_Str(): 13dc. に、現在ア
     クティブな例外を黙殺する状況で使われていないことを確かにするための
     デバッグアサーションが仕込まれました。アクティブな例外を捨てること
     が期待されて望ましいケース (たとえば、既にローカルに *note
     PyErr_Fetch(): 642. で保存済みであるとか、異なる例外に置き換えるこ
     とが意図である場合) は、アサーション有効でコンパイルされている
     Python バージョンで実行して、(直接的・間接的によらず) それら操作呼
     び出しがそのアサーションを発行するのを、明示的に *note
     PyErr_Clear(): 13dd. 呼び出しをすることで潰してください。

   * *note PyErr_SetImportError(): 10f9. が 'msg' がセットされていない場
     合に *note TypeError: 29c. をセットするようになりました。以前は例外
     をセットすることなく ‘NULL’ を返すだけでした。

   * *note PyOS_ReadlineFunctionPointer: 98c. コールバックは、エラー時に
     ‘NULL’ を返すか *note PyMem_RawMalloc(): 2ca. または *note
     PyMem_RawRealloc(): 82b. でアロケートした文字列を返さなければなりま
     せん。 *note PyMem_Malloc(): 1027. や *note PyMem_Realloc(): 13de.
     でアロケートした文字列はダメです。 (bpo-16742(1))

   * *note PyThread_set_key_value(): 655. が必ず値をセットするようになり
     ました。Python 3.3 ではこの関数はキーが既存 (で現在値が ‘NULL’ ポイ
     ンタでない) の場合には何もしませんでした。

   * *note PyFrameObject: b6d. 構造体のフィールド ‘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.13.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.13.9.1 PEP 476: stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化
....................................................................................

*note http.client: 72. とこのモジュールを使っている例えば *note
urllib.request: 114. や *note xmlrpc.client: 137. が、サーバをプラットフ
ォームが持つ信頼ストアにある 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.14 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.14.1 概要 - リリースハイライト
--------------------------------

新たな文法機能:

   * *note ジェネレータの委譲: 13e6.  のための新しい ‘yield from’ 式

   * *note str: 1ea. オブジェクト向けの ‘u'unicode'’ 文法の再適用

新たなライブラリモジュール:

   * *note faulthandler: 5b. (低水準のクラッシュのデバッグを補助する)

   * *note ipaddress: 83. (IPアドレスとマスクを表す高水準オブジェクト)

   * *note lzma: 8d. (XZ / LZMA アルゴリズムを使用したデータ圧縮)

   * *note unittest.mock: 110. (テスト向けにシステムの一部をモックオブジ
     ェクトで置き換える)

   * *note venv: 11a. (人気の ‘virtualenv’ パッケージのような、Python
     *note virtual environments: 13e7.)

新たな組み込み機能:

   * *note I/O 例外階層: 13e8. の手直し

実装の改善:

   * *note インポート機構: 13e9. を、 *note importlib: 7a. を元に書き換
     え

   * よりコンパクトな *note ユニコード文字列: 13ea.

   * よりコンパクトな *note 属性辞書: 13eb.

ライブラリモジュールの大幅な改善:

   * *note decimal: 13ec. モジュールのCによる高速化

   * *note email: 13ed. モジュールでのより良いユニコード処理 (*note
     暫定版: 13ee.)

セキュリティの改善:

   * ハッシュのランダム化がデフォルトで有効になりました。

以降はユーザ向けの変更の包括的なリストになっています。


File: python.info,  Node: PEP 405 仮想環境,  Next: PEP 420 暗黙的な名前空間パッケージ,  Prev: 概要 -- リリースハイライト<12>,  Up: What's New In Python 3 3

1.14.2 PEP 405: 仮想環境
------------------------

仮想環境 (virtual environment) は隔離されたPython環境を作成する手助けを
します。 一方で保守を容易にするために、システム全体のインストールを共有
します。 仮想環境はそれ自身の site packages (つまりローカルにインストー
ルされたライブラリ) を持ちつつ、任意でシステム全体の site packages と分
離できます。 このコンセプトと実装は、人気のサードパーティパッケージであ
る ‘virtualenv’ を元にしていますが、インタプリタコアとの統合による恩恵を
受けています。

この PEP はプログラムからのアクセス用の *note venv: 11a. モジュールと、
コマンドラインからのアクセスと管理向けの ‘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.14.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.14.4 PEP 3118: 新たなメモリビューの実装とバッファプロトコルのドキュメント
---------------------------------------------------------------------------

PEP 3118(1) の実装が大幅に改善されました。

新しい memoryview 実装が、Py_buffer 構造体内にフィールドを動的にアロケー
トする際に多数のクラッシュの報告をもたらしていた全ての所有権問題、ライフ
タイム問題を包括的に解決しました。加えて、不連続もしくは多次元の入力に対
してクラッシュしたり誤った結果を返していた多数の関数が修正されました。

memoryview オブジェクトに、 PEP-3118 準拠の getbufferproc() が追加されて
います (訳注: *note バッファオブジェクト構造体 (buffer object
structure): 13f3. 参照)。これはコンシューマの要求型をチェックします。多
くの新機能が追加されており、これらのほとんどが不連続配列とサブオフセット
を持つ配列に完全な一般化をもたらすものです。

*note ドキュメント: 319. が更新され、エキスポータ(提供側)とコンシューマ
(利用側)両方についての責務をより明確に詳細化しています。 *note
バッファ要求のフラグ: 13f4. が、基本フラグと組合せフラグでグループ分けさ
れています。不連続配列と多次元の NumPy スタイル行列のメモリレイアウトに
ついて説明されています。

* Menu:

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

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

   (1) https://peps.python.org/pep-3118/


File: python.info,  Node: フィーチャー,  Next: API の変更,  Up: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント

1.14.4.1 フィーチャー
.....................

   * struct モジュールの構文の全ての native *note Type Codes: 13f6. をサ
     ポートするようになりました ('@' プレフィクスが付いていても良いです
     )。 (訳注: *note format: 13f7. 参照。)

   * いくつかの制限はありますが、 *note cast(): 13f8. メソッドでフォーマ
     ット変更と C-*note contiguous: 13f9. 配列の形状 (shape) の変更を行
     うことが出来ます。

   * 任意の配列型で多次元のリスト表現がサポートされるようになっています
     。

   * 任意の配列型で多次元の比較がサポートされるようになっています。

   * 'B', 'b', 'c' いずれかのフォーマットの *note hashable: 18e. な (読
     み出し専用の) 型の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.14.4.2 API の変更
...................

   * 最大 *note 次元: 13fb. は公式に 64 に制限されています。

   * 空の *note shape: 13fc, 空の *note strides: 13fd, 空の *note
     suboffsets: 13fe. を表現するのに以前は ‘None’ を用いていましたが今
     ではこれは空のタプルです。

   * フォーマット 'B' (unsigned bytes) での memoryview 要素へのアクセス
     は整数を返すようになりました (struct モジュールでの構文に従っていま
     す)。bytes オブジェクトが欲しければまずビューを 'c' で *note
     cast(): 13f8. しなければなりません。

   * memoryview どうしの比較は被演算対象の論理構造を使って行うようになり
     、また、全ての配列要素は値で比較されます。struct モジュールの構文の
     全てのフォーマット文字でサポートされます。認識出来ないフォーマット
     文字でのビューは今でも許されていますが、ビューの指す中身によらずこ
     れは常に等しくないとされます。

   * ほかの変更については、 *note ビルドならびに C API の変更: 13ff. と
     *note C コードの移植: 1400. を参照してください。

(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.14.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.14.5.1 機能性
...............

PEP 393(1) でなされた変更は以下の通りです:

   * Python は今や非 BMP 面の文字を含む Unicode コードポイントの完全な範
     囲 (つまり ‘U+0000’ から ‘U+10FFFF’ まで) を常にサポートします。
     narrow ビルド / wide ビルドという区別は今では存在していないため、
     Python は今ではいつでもかつての wide ビルドのように振る舞い、
     Windows でもこれは例外ではありません。

   * narrow ビルドとの決別は、それに付き物だった問題も解決しました。例え
     ば:

        * *note len(): a24. は今では非 BMP 面文字について必ず 1 を返しま
          す。つまり ‘len('\U0010FFFF') == 1’ です;

        * サロゲートペアが文字列リテラル内で再結合されることはありません
          。つまり ‘'\uDBFF\uDFFF' != '\U0010FFFF'’ です;

        * 非 BMP 面文字を指すインデクスやスライスは期待通りの値を返しま
          す。つまり ‘'\U0010FFFF'[0]’ は今では ‘'\uDBFF'’ ではなく
          ‘'\U0010FFFF'’ を返します;

        * ほかの全ての標準ライブラリ関数が今では正しく非 BMP コードポイ
          ントを処理します。

   * *note sys.maxunicode: 1403. の値は今やいつでも ‘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.14.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.14.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: 9c1.

インストーラ PATH の調整: *note Python install manager: 1407.

   ---------- 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.14.7 PEP 3151: OS および IO 例外階層の手直し
----------------------------------------------

OS エラーが送出する例外の階層が単純化され、粒度が下げられました。

You don't have to worry anymore about choosing the appropriate exception
type between *note OSError: 543, *note IOError: 1409, *note
EnvironmentError: 140a, *note WindowsError: 140b, ‘mmap.error’, *note
socket.error: 140c. or *note select.error: 140d.  All these exception
types are now only one: ‘OSError’.  The other names are kept as aliases
for compatibility reasons.

また、特定のエラー条件を捕捉するのが容易になりました。 ‘errno’ 属性 (ま
たは ‘args[0]’) の特定の定数を *note errno: 5a. モジュールから調べる代わ
りに、適切な *note OSError: 543. 派生クラスを捕捉することが出来ます。 利
用可能な派生クラスは以下の通りです:

   * *note BlockingIOError: 4ca.

   * *note ChildProcessError: 140e.

   * *note ConnectionError: 11c3.

   * *note FileExistsError: 13cd.

   * *note FileNotFoundError: 24f.

   * *note InterruptedError: 1145.

   * *note IsADirectoryError: 140f.

   * *note NotADirectoryError: 1410.

   * *note PermissionError: 10fd.

   * *note ProcessLookupError: 1411.

   * *note TimeoutError: c12.

*note ConnectionError: 11c3. 自身には細かな派生クラスがあります:

   * *note BrokenPipeError: 1412.

   * *note ConnectionAbortedError: 1413.

   * *note ConnectionRefusedError: 1414.

   * *note ConnectionResetError: 1415.

新たな例外のおかげで *note errno: 5a. の一般的な使い方を避けることが出来
ます。 例えば、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: 5a. をインポートしたり手動で例外属性を調べたりせずに書く
ことが出来ます:

     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.14.8 PEP 380: サブジェネレータへの委譲構文
--------------------------------------------

PEP 380 は ‘yield from’ 式を追加します。これは *note ジェネレータ: 1417.
に、その操作の一部をほかのジェネレータに委譲するための式です。これによっ
て *note yield: d97. を含んでいるコードのセクションをほかのジェネレータ
に移動出来るでしょう。加えてサブジェネレータは値を伴って戻ることが出来、
その戻り値は委譲した側のジェネレータで使えます。

‘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(): 1418. されたり *note throw(): 90a. された
値を直接受け取ることができ、また、外側のジェネレータに最終的な値を返せま
す:

     >>> 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.14.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.14.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.14.11 PEP 3155: クラスと関数の正規名
--------------------------------------

Functions and class objects have a new *note __qualname__: 141c.
attribute representing the "path" from the module top-level to their
definition.  For global functions and classes, this is the same as *note
__name__: 141d.  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.14.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.14.13 PEP 362: 関数シグニチャオブジェクト
-------------------------------------------

新たに追加された関数 *note inspect.signature(): 4c4. は、Python 呼び出し
可能オブジェクト (callable) を調べることを簡単で直接的なものにしてくれま
す。幅広い callable をサポートしています:デコレートされているかどうかに
よらず関数、クラス、 *note functools.partial(): 4ad. オブジェクト。新た
に追加されたクラス群 *note inspect.Signature: 6ee, *note
inspect.Parameter: 6ef, *note inspect.BoundArguments: 1420. は、アノテー
ション、デフォルト値、パラメータの種類、束縛されている引数などのような呼
び出しシグニチャについての情報を保持し、これによって、デコレータを書いた
りあるいは呼び出しシグニチャや引数を検証したり改訂したりするコードを書く
ことが、非常に単純になります。

参考
....

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.14.14 PEP 421: sys.implementation の追加
------------------------------------------

*note sys: e2. モジュールに新規属性が追加され、これは現在動作中のインタ
ープリタ実装に固有の詳細を公開します。その *note sys.implementation:
92b. 属性の手始めの集合として、 ‘name’, ‘version’, ‘hexversion’,
‘cache_tag’ が定義されています。

‘sys.implementation’ の真意は、標準ライブラリによって利用される実装固有
の情報を一つの名前空間で一元管理することにあります。このことにより異なる
Python 実装が単一の標準ライブラリのコードベースを共有することが、もっと
ずっと簡単になります。今時点での初期状態では ‘sys.implementation’ は実装
固有データのごく一部を保持しているだけです。標準ライブラリの移植性がもっ
と高くなるように、徐々にこの比率が変わっていくでしょう。

標準ライブラリの移植性を改善した一例が ‘cache_tag’ です。Python 3.3 以降
は ‘sys.implementation.cache_tag’ が PEP 3147(1) をサポートするために
*note importlib: 7a. により使われます。組み込みのインポートシステムのた
めに ‘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.14.14.1 SimpleNamespace
.........................

‘sys.implementation’ の実現に伴って Python に新たな型 *note
types.SimpleNamespace: 6f0. が導入されることとなりました。 *note dict:
193. のようなマッピングベースの名前空間とは対照的に、 ‘SimpleNamespace’
は *note object: e51. のような属性ベースです。ですが ‘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.14.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__(): caa. 関数を *note importlib.__import__(): 1424. によ
って実現するようにしました。これは PEP 302(5) の「第二段階」を完了させる
ものです。この変更には複数の恩恵があります。まず最初にこれはインポートの
機構を、C コードの奥深くで暗黙に秘密裏に行うのではなく、より透明化します
。このことで、Python 3.3 をサポートする全ての Python VM で単一の実装を用
いることが出来るようになり、インポートのセマンティクスにおける VM 固有の
逸脱と決別する助けともなります。そしてこれはインポート機構の保守をより容
易とし、将来起こりうる進化を促します。

一般のユーザにとっては、セマンティクスにおいて目に見える変化はないはずで
す。今時点でインポートを操作したりインポート呼び出しをプログラム的に行っ
ている場合は、このドキュメントの *note Python コードの移植: 1425. でカバ
ーしているコードの修正が必要になるかもしれません。

* 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.14.15.1 新たな API
....................

この変更による一番大きな恩恵の一つは、インポート文の動作に何が介在するの
かについて露になったことです。つまりかつては様々なインポータが暗黙で行っ
ていたことが、今では完全に *note importlib: 7a. パッケージの一部として公
開されています。

The abstract base classes defined in *note importlib.abc: 7b. have been
expanded to properly delineate between *note meta path finders: 1427.
and *note path entry finders: 1428. by introducing *note
importlib.abc.MetaPathFinder: c48. and *note
importlib.abc.PathEntryFinder: c49, 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: 1429. 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:
13d1.

ローダ (loader) については、新規の抽象基底クラス *note
importlib.abc.FileLoader: 142a. が、モジュールのコードを格納する機構とし
てのファイルシステムを使うローダを書く助けとなります。ソースファイルのロ
ーダ (*note importlib.machinery.SourceFileLoader: 142b.)、ソースを持たな
いバイトコードのためのローダ (*note
importlib.machinery.SourcelessFileLoader: 142c.)、そして拡張モジュールの
ためのローダ (*note importlib.machinery.ExtensionFileLoader: 1075.) が今
では直接的に利用出来ます。

*note ImportError: 1c8. には属性 ‘name’ と ‘path’ が追加されて、これには
提供すべき関連データがある場合にセットされます。インポート失敗時のメッセ
ージも、これまでのようにモジュール名の末尾だけを与えるのではなく、モジュ
ールの完全名を提供するようになりました。

The *note importlib.invalidate_caches(): fd3. function will now call the
method with the same name on all finders cached in *note
sys.path_importer_cache: 9e0. to help clean up any stored state as
necessary.


File: python.info,  Node: 目に見える変化,  Prev: 新たな API,  Up: インポート実装としての importlib の使用

1.14.15.2 目に見える変化
........................

潜在的に必要となるかもしれないコード修正については、 *note Python
コードの移植: 1425. セクションを参照してください。

*note importlib: 7a. によって公開されるものが拡がったことによる、インポ
ートについてのほかの目に見える変化があります。最大の変化は *note
sys.meta_path: 10e7. と *note sys.path_hooks: 13d1. が、インポートで使わ
れる meta path finder と path entry hook の全てを格納するようになったこ
とです。以前はファインダは直接的に公開されるのではなく、インポートの C コ
ード内に暗黙のものとして隠されていました。このことによって、今では望めば
要件に合うようファインダを取り除いたり順序を変えたりといったことが簡単に
行えるようになっています。

もう一つの変化は、モジュール生成時に使われたローダを格納する
‘__loader__’ 属性を、全てのモジュールが持つようになったことです。 PEP
302(1) はローダの実装においてこの属性をセットすることを必須とするよう更
新されました。ですので今後サードパーティのローダが更新されれば、この属性
の存在に依存出来るようになります。ですがそのときが来るまでは、インポート
処理がモジュールのロードの後処理としてセットします。

さらにローダが PEP 366(2) よりの ‘__package__’ 属性を設定することも期待
出来るようになりました。繰り返しになりますがインポート処理自身が既にこれ
を全てのローダで *note importlib: 7a. より行っていて、また、インポート処
理自身がこの属性をロードの後処理としてセットしています。

‘None’ is now inserted into *note sys.path_importer_cache: 9e0. when no
finder can be found on *note sys.path_hooks: 13d1.  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 コードの移植: 1425. セクションを読むべきです。

(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.14.16 その他の言語変更
------------------------

Python 言語コアに小さな変更がいくつか行われました:

   * Added support for Unicode name aliases and named sequences.  Both
     *note unicodedata.lookup(): 142f. 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(): d13. オブジェクトどうしの等値性比較が、それぞれの
     range オブジェクトによって生成されるシーケンスの等値性を反映して行
     われるようになりました (bpo-13201(2))。

   * *note bytes: 1d2. と *note bytearray: 1d1. オブジェクトのメソッド
     ‘count()’, ‘find()’, ‘rfind()’, ‘index()’, ‘rindex()’ が、第一引数
     に 0 から 255 の整数を受け付けるようになりました。

     (Contributed by Petri Lehtinen in bpo-12170(3).)

   * *note bytes: 1d2. と *note bytearray: 1d1. オブジェクトのメソッド
     ‘rjust()’, ‘ljust()’, ‘center()’ が、 ‘fill’ 引数として ‘bytearray’
     を受け付けるようになりました (Contributed by Petri Lehtinen in
     bpo-12380(4).)。

   * New methods have been added to *note list: 4e0. and *note
     bytearray: 1d1.: ‘copy()’ and ‘clear()’ (bpo-10516(5)).
     Consequently, *note MutableSequence: 6cc. now also defines a
     ‘clear()’ method (bpo-11388(6)).

   * raw bytes リテラルとして ‘br"..."’ だけでなく ‘rb"..."’ とも書ける
     ようになりました。

     (Contributed by Antoine Pitrou in bpo-13748(7).)

   * *note dict.setdefault(): 1430. が与えられたキーのルックアップを一度
     しか行わないようになったので、組み込み型でのこれの使用はアトミック
     になります。(訳注: 外部観察可能な変化で説明すると、以前はこの呼び出
     しが、キーの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.14.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
‘PyImport_ImportModuleNoBlock()’ 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.14.18 組み込みの関数と型
--------------------------

   * *note open(): 333. 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: 1433. for example.  The ‘'x'’ mode
     was added: open for exclusive creation, failing if the file already
     exists.

   * *note print(): 1324.: 'flush' キーワード引数が追加されました。
     'flush' キーワード引数が真の場合ストリームは強制的にフラッシュされ
     ます。

   * *note hash(): 9e7.: ハッシュのランダム化がデフォルトで有効になりま
     した。 *note object.__hash__(): ec5. と環境変数 *note
     PYTHONHASHSEED: 1434. を参照してください。

   * *note str: 1ea. 型に *note casefold(): 1193. メソッドが追加されまし
     た。文字列の 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.14.19 新たなモジュール
------------------------

* Menu:

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


File: python.info,  Node: faulthandler<6>,  Next: ipaddress<6>,  Up: 新たなモジュール<11>

1.14.19.1 faulthandler
......................

This new debug module *note faulthandler: 5b. 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(): 224. to install fault handlers for the *note
SIGSEGV: 1437, *note SIGFPE: 1438, *note SIGABRT: 1439, *note SIGBUS:
143a, and *note SIGILL: 143b. signals.  You can also enable them at
startup by setting the *note PYTHONFAULTHANDLER: 143c. environment
variable or by using *note -X: 183. ‘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<6>,  Up: 新たなモジュール<11>

1.14.19.2 ipaddress
...................

新規モジュール *note ipaddress: 83. は、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.14.19.3 lzma
..............

The newly added *note lzma: 8d. 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.14.20 改良されたモジュール
----------------------------

* Menu:

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


File: python.info,  Node: abc<2>,  Next: array<5>,  Up: 改良されたモジュール<11>

1.14.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: 1441. は非推奨となりました。代わりに
     *note abc.abstractmethod(): 1442. に *note property: 6c1. を渡して
     使ってください。

   * *note abc.abstractclassmethod: 1443. は非推奨となりました。代わりに
     *note abc.abstractmethod(): 1442. に *note classmethod: 6a0. を渡し
     て使ってください。

   * *note abc.abstractstaticmethod: 1444. は非推奨となりました。代わり
     に *note abc.abstractmethod(): 1442. に *note staticmethod: 66d. を
     渡して使ってください。

(Contributed by Darren Dale in bpo-11610(1).)

*note abc.ABCMeta.register(): 1445. が登録されたサブクラスを返すようにな
りました。つまりクラスデコレータとして使うことができるようになったという
ことです (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<5>,  Next: base64<6>,  Prev: abc<2>,  Up: 改良されたモジュール<11>

1.14.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<6>,  Next: binascii<4>,  Prev: array<5>,  Up: 改良されたモジュール<11>

1.14.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<4>,  Next: bz2<2>,  Prev: base64<6>,  Up: 改良されたモジュール<11>

1.14.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<4>,  Up: 改良されたモジュール<11>

1.14.20.5 bz2
.............

*note bz2: 14. モジュールが最初から書き直されました。その過程で新機能が
いくつか追加されました。

   * 新たな *note bz2.open(): 144a. 関数: bzip2 で圧縮されたファイルをバ
     イナリかテキストモードで開きます。

   * *note bz2.BZ2File: c41. が、コンストラクタの 'fileobj' 引数で、任意
     のファイル様オブジェクトの読み書きが出来るようになりました。

     (Contributed by Nadeem Vawda in bpo-5863(1).)

   * *note bz2.BZ2File: c41. と *note bz2.decompress(): 144b. が
     (‘pbzip2’ ツールで生成されたような) マルチストリームの入力を展開出
     来るようになりました。同時に ‘bz2.BZ2File’ は、 ‘'a'’ (追記) モード
     を使ってこのタイプの圧縮ファイルを作るのに使えるようになりました。

     (Contributed by Nir Aides in bpo-1625(2).)

   * *note bz2.BZ2File: c41. now implements all of the *note
     io.BufferedIOBase: a88. 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<8>,  Prev: bz2<2>,  Up: 改良されたモジュール<11>

1.14.20.6 codecs
................

*note mbcs: 56. コーデックが、全ての 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<8>,  Next: contextlib<8>,  Prev: codecs<2>,  Up: 改良されたモジュール<11>

1.14.20.7 collections
.....................

新たに追加されたクラス *note ChainMap: fdf. は、複数のマッピングをひとま
とまりに扱えるようにします。 (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: 20f. クラスが、単項 ‘+’ 演算子、単項 ‘-’ 演算子、インプレ
イス演算子の ‘+=’, ‘-=’, ‘|=’, ‘&=’ をサポートするようになりました。
(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<8>,  Next: crypt<2>,  Prev: collections<8>,  Up: 改良されたモジュール<11>

1.14.20.8 contextlib
....................

コンテキストマネージャをプログラム的に操作することと、これと類似のクリー
ンアップの機能性について、*note ExitStack: 213. が今後は確かな基礎を提供
します。かつての (非推奨となり削除された) ‘contextlib.nested’ API とは違
って、この新しい API は、コンテキストマネージャがリソースを (たとえばフ
ァイルオブジェクトなどを) ‘__init__’ メソッドで獲得したのか、あるいは (た
とえば *note threading: f6. モジュールからの同期オブジェクトを)
‘__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<8>,  Up: 改良されたモジュール<11>

1.14.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<8>,  Prev: crypt<2>,  Up: 改良されたモジュール<11>

1.14.20.10 curses
.................

   * If the *note curses: 2e. 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: 1451. クラスに属性 *note
     curses.window.encoding: 1452. が追加されました。

   * *note curses.window: 1451. クラスに *note get_wch(): 1453. メソッド
     が追加されました。これはワイド文字を一つ取得します。

   * *note curses: 2e. モジュールに関数 *note unget_wch(): 1454. が追加
     されました。これはワイド文字をプッシュし、次に *note get_wch():
     1453. を呼び出した時にその値が返るようにします。

(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<8>,  Next: decimal<4>,  Prev: curses<6>,  Up: 改良されたモジュール<11>

1.14.20.11 datetime
...................

   * naive な *note datetime: 6ed. インスタンスと aware な ‘datetime’ イ
     ンスタンスの等価比較で、 *note TypeError: 29c. を投げずに *note
     False: ef9. を返すようになりました。 (bpo-15006(1)).

   * 新規メソッド *note datetime.datetime.timestamp(): 1456.: *note
     datetime: 6ed. インスタンスに対応する POSIX タイムスタンプを返しま
     す。

   * *note datetime.datetime.strftime(): 1055. メソッドが 1000 年よりも
     前の書式化をサポートしました。(--訳注: What's New in Python 3.2 で
     の変更も参照してみてください。--)

   * *note datetime.datetime.astimezone(): d99. メソッドを引数なしで呼び
     出せるようになりました。これは datetime インスタンスをシステムのタ
     イムゾーンに変換します。

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

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15006


File: python.info,  Node: decimal<4>,  Next: email<7>,  Prev: datetime<8>,  Up: 改良されたモジュール<11>

1.14.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.14.20.13 フィーチャー
.......................

   * *note FloatOperation: 1459. *note シグナル: 145a. により、float と
     Decimal の混合の厳密なセマンティクスを有効に出来ます。(--訳注: 使用
     例が *note Quick-start tutorial: 145b. にあります。--)

   * 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: 145c. is set to ‘False’.


File: python.info,  Node: API の変更<2>,  Prev: フィーチャー<2>,  Up: decimal<4>

1.14.20.14 API の変更
.....................

   * C モジュールはマシンアーキテクチャに依存する以下のコンテキストの制
     限を持ちます:

                                           32-bit               64-bit
                                                                
          ------------------------------------------------------------------------------------
                                                                
          *note MAX_PREC: 145e.            ‘425000000’          ‘999999999999999999’
                                                                
                                                                
          *note MAX_EMAX: 145f.            ‘425000000’          ‘999999999999999999’
                                                                
                                                                
          *note MIN_EMIN: 1460.            ‘-425000000’         ‘-999999999999999999’
                                                                

   * In the context templates (*note DefaultContext: 1461, *note
     BasicContext: 1462. and *note ExtendedContext: 1463.) the magnitude
     of *note Emax: 1464. and *note Emin: 1465. has changed to ‘999999’.

   * decimal.py の *note Decimal: 1cd. コンストラクタは上記のコンテキス
     ト制限に無知で、任意の指数や精度で正確に変換しようとします。C 版は
     内部の制限を持っていますので、次の規則が使われます: 可能ならば値は
     正確に変換され、そうでない場合 *note InvalidOperation: 1466. が送出
     されて結果が NaN となります。後者のケースは丸めあるいは不正確な値を
     得るために *note create_decimal(): 1467. を使うことでいつでも可能で
     す。(--訳注: わかりにくい表現ですがコンテキストで 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(): 1468. and *note ln(): 1469. functions, but the final
     result is only "almost always correctly rounded".

   * C 版ではシグナルを含む辞書は *note MutableMapping: 146a. です。速度
     的な理由により *note flags: 146b. と *note traps: 146c. はコンテキ
     ストが初期化された時点での ‘MutableMapping’ を参照し続けます。新た
     なシグナル辞書を ‘flags’ に ‘traps’ 割り当てれば新しい値で更新はさ
     れるものの、コンテキストはそれら右辺の辞書を参照しません。

   * *note Context: 146d. を pickle 化するとこれまでとは異なる出力をしま
     す。これは Python 版と C 版で共通の交換フォーマットを実現するためで
     す。

   * *note Context: 146d. コンストタクタの引数順が *note repr(): 462. で
     の表示順に合うように改められました。

   * *note quantize(): 146e. メソッドの ‘watchexp’ パラメータが非推奨と
     なりました。


File: python.info,  Node: email<7>,  Next: ftplib<3>,  Prev: decimal<4>,  Up: 改良されたモジュール<11>

1.14.20.15 email
................

* Menu:

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


File: python.info,  Node: ポリシーフレームワーク,  Next: 新規ヘッダ API を伴った暫定ポリシー,  Up: email<7>

1.14.20.16 ポリシーフレームワーク
.................................

email パッケージに *note policy: 52. フレームワークが追加されました。
*note Policy: 1471. は、 email パッケージがどのように振舞うのかを制御す
るための多数のメソッドとプロパティを持つオブジェクトです。Python 3.3 の
ための最初のポリシーは *note Compat32: 1472. で、これは Python 3.2 の
email パッケージとの後方互換性を提供します。 ‘policy’ は、 *note parser:
51. によって email メッセージが解析される際、あるいは *note Message:
786. オブジェクトを生成する際、あるいは *note generator: 43. を用いて
email がシリアライズする際に指定出来ます。オーバライドしない限りは、
‘parser’ に渡されたポリシーは全ての ‘Message’ オブジェクトと ‘parser’ が
生成したサブオブジェクトに引き継がれます。デフォルトでは ‘generator’ は
、シリアライズしようとする ‘Message’ オブジェクトのポリシーを使います。
デフォルトのポリシーは *note compat32: 105e. です。

すべての ‘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(): 1473. メソッドを使って作られます。 ‘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<7>

1.14.20.17 新規ヘッダ API を伴った暫定ポリシー
..............................................

ポリシーフレームワーク単品でもまったくもって価値があるものではありますが
、その導入の主たる動機は、それを使わないコードに対しての後方互換を壊さな
いやり方で、email パッケージに新機能を実現する新しいポリシーを作れるよう
にすることでした。その新しいポリシーは新規 API を導入するものなので、私
たちはそれらを Python 3.3 での *note 暫定ポリシー: 13ee. としてリリース
しました。コア開発者が必要と判断すれば、後方互換性を破壊する (コードの破
棄さえも含む) 変更が起こりえます。

その新規ポリシーは *note EmailPolicy: 1475. のインスタンス (訳注: *note
email.policy.default: 1476. や *note email.policy.SMTP: 1477. など) です
。これには以下の制御が追加されています:

refold_source       *note parser: 51. により解析されたヘッダを、
                    *note generator: 43. が折り返しし直す (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: 44. の *note decode_header(): 1478. 関数や
*note make_header(): 1479. 関数を取り扱う必要性を取り除いてくれています
。

アドレスを部品から組み立てることも出来ます:

     >>> 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<7>

1.14.20.18 その他のAPIの変更
............................

*note BytesHeaderParser: 147b. が *note parser: 51. モジュールに追加され
ました。これは *note HeaderParser: 147c. を補足するものであり、また、
bytes API を完全にする (訳注: What's New in Python 3.2 での email の変更
内容参照) ものです。

新しいユーティリティ関数:

   * *note format_datetime(): 147d.: *note datetime: 6ed. を与えると
     email ヘッダで使われる書式でフォーマットした文字列を生成します。

   * *note parsedate_to_datetime(): 147e.: email ヘッダからの日付文字列
     を渡すと、 aware な、または naive な *note datetime: 6ed. に変換し
     ます。オフセットが ‘-0000’ の場合に naive で返します。

   * *note localtime(): 576.: 引数なしで呼び出すと、ローカル *note
     timezone: 147f. を使った aware な *note datetime: 6ed. として現在ロ
     ーカル時間を返します。aware な ‘datetime’ を渡して呼び出すと、ロー
     カル ‘timezone’ を使った aware な ‘datetime’ に変換します。


File: python.info,  Node: ftplib<3>,  Next: functools<9>,  Prev: email<7>,  Up: 改良されたモジュール<11>

1.14.20.19 ftplib
.................

   * *note ftplib.FTP: cce. に新しいキーワード引数 ‘source_address’ が追
     加されました。 ‘(host, port)’ の形で指定し、これは外に向かうソケッ
     トを作成する際に *note bind(): 1481. 呼び出し内でのソースアドレスと
     して用いられます。 (Contributed by Giampaolo Rodolà in
     bpo-8594(1).)

   * *note FTP_TLS: ccf. クラスに、制御チャネルを平文に戻すための *note
     ccc(): 1482. 関数が追加されました。これは、固定ポートで開くことなく
     非セキュア FTP で NAT を処理する方法を知っているファイアウォールを
     利用するのに有用となりえます。(Contributed by Giampaolo Rodolà in
     bpo-12139(2).)

   * 新規メソッド *note ftplib.FTP.mlsd(): 1483. は機械で読めるディレク
     トリリスティングのフォーマットを提供し、 *note ftplib.FTP.nlst():
     1484. と *note ftplib.FTP.dir(): 1485. に取って代わるものとなりまし
     た。(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<9>,  Next: gc<9>,  Prev: ftplib<3>,  Up: 改良されたモジュール<11>

1.14.20.20 functools
....................

*note functools.lru_cache(): db7. デコレータにキーワード引数 ‘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<9>,  Next: hmac<5>,  Prev: functools<9>,  Up: 改良されたモジュール<11>

1.14.20.21 gc
.............

ガーベージコレクタが回収前後に呼び出すコールバックを登録出来るようになり
ました。新規属性 *note callbacks: 1488. リストに登録します。


File: python.info,  Node: hmac<5>,  Next: http<5>,  Prev: gc<9>,  Up: 改良されたモジュール<11>

1.14.20.22 hmac
...............

タイミング解析によるダイジェストに対する サイドチャンネル攻撃(1) からの
防御のために、 *note compare_digest(): 148a. 関数が追加されました。
(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.14.20.23 http
...............

*note http.server.BaseHTTPRequestHandler: 231. がヘッダをバッファするよ
うになり、 *note end_headers(): 148c. 呼び出し時に一度に全てをまとめて書
き出すようになりました。新規のメソッド *note flush_headers(): 148d. は、
集積したヘッダを送信する場合の管理に直接使うことが出来ます。(Contributed
by Andrew Schaaf in bpo-3709(1).)

*note http.server: 75. が正当な ‘HTML 4.01 strict’ 出力を生成するように
なりました。 (Contributed by Ezio Melotti in bpo-13295(2).)

*note http.client.HTTPResponse: 148e. にメソッド *note readinto(): 148f.
が追加されました。つまりこのクラスを *note io.RawIOBase: 1490. のように
扱えるということです。 (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.14.20.24 html
...............

*note html.parser.HTMLParser: c51. 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: 6f. モジュールに、HTML5 名前付き文字参照と Unicode
文字(列) とを対応付ける *note html5: 1492. 辞書が追加されました (例:
‘html5['gt;'] == '>'’)。この辞書は既に *note HTMLParser: c51. が使ってい
ます。 (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<11>,  Prev: html<2>,  Up: 改良されたモジュール<11>

1.14.20.25 imaplib
..................

*note IMAP4_SSL: cd7. コンストラクタが 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<11>,  Next: io<8>,  Prev: imaplib<4>,  Up: 改良されたモジュール<11>

1.14.20.26 inspect
..................

*note getclosurevars(): 1495. 関数が追加されました。この関数は、指定した
関数の関数本体から参照されている現在束縛されている全ての名前と、それら名
前が解決された場所 (訳注: globals, builtins など) を報告します。これによ
り、ステートフルなクロージャに依存するコードをテストするのに、正しい内部
状態を検証するのが容易になります。

(Contributed by Meador Inge and Nick Coghlan in bpo-13062(1).)

*note getgeneratorlocals(): 1496. 関数が追加されました。この関数は、指定
したジェネレータのスタックフレーム内のローカル変数の、現在束縛されている
ものを報告します。これにより、ジェネレータをテストするのに、正しい内部状
態を検証するのが容易になります。

(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<11>,  Up: 改良されたモジュール<11>

1.14.20.27 io
.............

*note open(): 930. 関数に排他的作成に使用する新たな ‘'x'’ モードが追加さ
れました。ファイルが既に存在する場合は *note FileExistsError: 13cd. を送
出します。 C11 fopen() の 'x' モードに基づいています。

(Contributed by David Townshend in bpo-12760(1).)

The constructor of the *note TextIOWrapper: ba0. 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<8>,  Prev: io<8>,  Up: 改良されたモジュール<11>

1.14.20.28 itertools
....................

*note accumulate(): dc3. がユーザ提供二項関数を渡すためのオプショナル引
数 ‘func’ を受け付けるようになりました。


File: python.info,  Node: logging<8>,  Next: math<11>,  Prev: itertools<7>,  Up: 改良されたモジュール<11>

1.14.20.29 logging
..................

*note basicConfig(): dc6. 関数がオプショナルな ‘handlers’ 引数をサポート
するようになりました。これはルートロガーに追加するハンドラ群の *note
イテラブル: 149a. です。

A class level attribute ‘append_nul’ has been added to *note
SysLogHandler: a51. 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<11>,  Next: mmap<5>,  Prev: logging<8>,  Up: 改良されたモジュール<11>

1.14.20.30 math
...............

*note math: 91. モジュールに新たな関数 *note log2(): 149c. が追加されま
した。'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<5>,  Next: multiprocessing<9>,  Prev: math<11>,  Up: 改良されたモジュール<11>

1.14.20.31 mmap
...............

*note read(): 149e. メソッドの他のファイルライクなオブジェクトとの互換性
が増しました。引数が省略されるか ‘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<5>,  Up: 改良されたモジュール<11>

1.14.20.32 multiprocessing
..........................

関数 *note multiprocessing.connection.wait(): 14a0. が追加されました。こ
れは複数の (接続やソケット、パイプのような) オブジェクトをタイムアウト付
きでポーリングします。(Contributed by Richard Oudkerk in bpo-12328(1).)

*note multiprocessing.connection.Connection: 14a1. objects can now be
transferred over multiprocessing connections.  (Contributed by Richard
Oudkerk in bpo-4892(2).)

*note multiprocessing.Process: 4e5. がキーワード引数 ‘daemon’ を取るよう
になりました。これは親プロセスから ‘daemon’ フラグを継承するデフォルトの
振る舞いをオーバライドします (bpo-6064(3))。

属性 *note multiprocessing.Process.sentinel: 14a2. が追加されました。こ
れを用いることで、ふさわしい OS プリミティブ (例えば POSIX システムでの
*note select: c9.) を使った一括での複数 *note Process: 4e5. オブジェクト
待ちが可能です。

*note map(): 445. と *note itertools.starmap(): 14a3. との関係と同じ、既
存の *note multiprocessing.pool.Pool.map(): 14a4. と *note map_async():
14a5. に対応する *note multiprocessing.pool.Pool.starmap(): 14a6. と
*note starmap_async(): 14a7. が追加されました。 (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<15>,  Prev: multiprocessing<9>,  Up: 改良されたモジュール<11>

1.14.20.33 nntplib
..................

The ‘nntplib.NNTP’ class now supports the context management protocol to
unconditionally consume *note socket.error: 140c. 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<15>,  Next: pdb<10>,  Prev: nntplib<2>,  Up: 改良されたモジュール<11>

1.14.20.34 os
.............

   * The *note os: a5. module has a new *note pipe2(): 14aa. function
     that makes it possible to create a pipe with *note O_CLOEXEC: 1433.
     or *note O_NONBLOCK: 11f2. flags set atomically.  This is
     especially useful to avoid race conditions in multi-threaded
     programs.

   * *note os: a5. モジュールに *note sendfile(): ed7. 関数が追加されま
     した。これはあるファイル (またはソケット) 記述子からのコピーを、効
     率的な「ゼロコピー」で行います。「ゼロコピー」という言い回しは、こ
     れは二つの記述子間でのデータのコピー全てが完全にカーネルによって行
     われる、という事実について指しています。データコピーにユーザ空間の
     バッファは使われません。 ‘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(): f1c. は
          *note walk(): 8be. と似ていますが、これは訪問するディレクトリ
          を指すファイル記述子も yield します。これは特にシンボリックリ
          ンクの競合を避けるために有用です。

        - The following functions get new optional 'dir_fd' (*note paths
          relative to directory descriptors: 14ab.) and/or
          'follow_symlinks' (*note not following symlinks: 14ac.): *note
          access(): 14ad, *note chflags(): 14ae, *note chmod(): 732,
          *note chown(): 14af, *note link(): 14b0, *note lstat(): 8b6,
          *note mkdir(): 734, *note mkfifo(): 114d, *note mknod(): 114e,
          *note open(): 114f, *note readlink(): cf1, *note remove():
          14b1, *note rename(): 14b2, *note replace(): 14b3, *note
          rmdir(): 14b4, *note stat(): 4fc, *note symlink(): 14b5, *note
          unlink(): 14b6, *note utime(): 14b7.  Platform support for
          using these parameters can be checked via the sets *note
          os.supports_dir_fd: 14b8. and *note
          os.supports_follow_symlinks: 14b9.

        - 関数 *note chdir(): a07, *note chmod(): 732, *note chown():
          14af, *note execve(): 14ba, *note listdir(): 14bb, *note
          pathconf(): 14bc, *note exists(): dd6, *note stat(): 4fc,
          *note statvfs(): 14bd, *note utime(): 14b7. が、パス引数として
          ファイル記述子をサポートするようになりました。これをプラットフ
          ォームがサポートするかどうかは *note os.supports_fd: 14be. を
          調べることでわかります。

   * *note access(): 14ad. がキーワード引数 ‘effective_ids’ を受け取るよ
     うになりました。これは実 uid/gid の代わりに実効 uid/gid を使ってア
     クセスチェックを行うように振る舞いを変更します。これをプラットフォ
     ームがサポートするかどうかは *note supports_effective_ids: 14bf. を
     調べることでわかります。

   * *note os: a5. モジュールに 2 つの関数が追加されました。 *note
     getpriority(): 14c0. と *note setpriority(): 14c1. です。これらはプ
     ロセスのナイス値/優先度 (niceness/priority) を *note os.nice():
     14c2. と似た方法で取得・設定しますが、現在プロセスだけのものだけで
     はなく全てのプロセスに対して使えるよう拡張されています。

     (Patch submitted by Giampaolo Rodolà in bpo-10784(5).)

   * 新規関数 *note os.replace(): 14b3. は変更先の上書きにおいてクロスプ
     ラットフォームな方法でファイル名変更を行えます。既存の *note
     os.rename(): 14b2. では、変更先が既存のファイルの場合に POSIX では
     上書き、Windows ではエラーとなります。(Contributed by Antoine
     Pitrou in bpo-8828(6).)

   * stat 系関数 (*note stat(): 4fc, *note fstat(): 1149, *note lstat():
     8b6.) がファイルのタイムスタンプのナノ秒精度を読み取れるようになり
     ました。これと対となる *note utime(): 14b7. もファイルのタイムスタ
     ンプをナノ秒精度で書き出せるようになりました。 (Contributed by
     Larry Hastings in bpo-14127(7).)

   * 新規関数 *note os.get_terminal_size(): 14c3. はファイル記述子が接続
     しているターミナルウィンドウのサイズを取得します。 *note
     shutil.get_terminal_size(): 14c4. も参照して下さい。 (Contributed
     by Zbigniew Jędrzejewski-Szmek in bpo-13609(8).)

   * Linux 拡張属性をサポートするための新たな関数 (bpo-12720(9)): *note
     getxattr(): 14c5, *note listxattr(): 14c6, *note removexattr():
     14c7, *note setxattr(): 14c8.

   * スケジューラに対する新たなインターフェイス。これら関数はプロセスに
     対する OS による CPU 時間割り当てを制御します。新規関数: *note
     sched_get_priority_max(): 14c9, *note sched_get_priority_min():
     14ca, *note sched_getaffinity(): 14cb, *note sched_getparam():
     14cc, *note sched_getscheduler(): 14cd, *note
     sched_rr_get_interval(): 14ce, *note sched_setaffinity(): 14cf,
     *note sched_setparam(): 14d0, *note sched_setscheduler(): 14d1,
     *note sched_yield(): 14d2,

   * ファイルシステムを制御する新たな関数:

        * *note posix_fadvise(): 1150.: データへアクセスする意思を、パタ
          ーンを指定して宣言します。これによりカーネルが最適化を行えるよ
          うになります。

        * *note posix_fallocate(): 1151.: ファイルを割り当てるに十分なデ
          ィスクスペースを確保します。

        * *note sync(): 14d3.: ディスクへの全ての書き込みを強制します。

   * 追加された新たな POSIX 関数:

        * *note lockf(): 14d4.: オープンされたファイル記述子に対して、
          POSIX ロックの適用、テスト、解除を行います。

        * *note pread(): f20.: ファイル記述子の指定オフセット位置から読
          み込みます。ファイルオフセットは変化しません。

        * *note pwrite(): f23.: ファイル記述子に対し、指定オフセット位置
          から書き出します。ファイルオフセットは変化しません。

        * *note readv(): f1f.: ファイル記述子からデータを読みこんで複数
          の書き込み可能なバッファに書き込みます。

        * *note truncate(): 11f3.: 'path' に対応するファイルを、サイズが
          最大で 'length' バイトになるよう切り詰めます。

        * *note waitid(): 1156.: 一つ以上の子プロセスの完了を待ちます。

        * *note writev(): f22.: 'buffers' の内容をファイル記述子へ書き出
          します。 'buffer' は任意のバッファのシーケンスです。

        * *note getgrouplist(): 14d5. (bpo-9344(10)): 指定したユーザが属
          するグループ ID のリストを返します。

   * *note times(): 14d6. および *note uname(): 14d7.: 戻り値の型がタプ
     ルから属性名のついたタプルライクオブジェクトに変更されました。

   * いくつかのプラットフォームにおいて、 *note lseek(): 14d8. 関数で使
     う追加の定数をサポートするようになりました。 ‘os.SEEK_HOLE’ や
     ‘os.SEEK_DATA’ などです。

   * New constants *note RTLD_LAZY: 14d9, *note RTLD_NOW: 14da, *note
     RTLD_GLOBAL: 14db, *note RTLD_LOCAL: 14dc, *note RTLD_NODELETE:
     14dd, *note RTLD_NOLOAD: 14de, and *note RTLD_DEEPBIND: 14df. are
     available on platforms that support them.  These are for use with
     the *note sys.setdlopenflags(): 14e0. function, and supersede the
     similar constants defined in *note ctypes: 2d. and ‘DLFCN’.
     (Contributed by Victor Stinner in bpo-13226(11).)

   * クロスプラットフォームのサポートを簡単にするために、非 Windows 環境
     でも *note os.symlink(): 14b5. がキーワード引数
     ‘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<10>,  Next: pickle<7>,  Prev: os<15>,  Up: 改良されたモジュール<11>

1.14.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<7>,  Next: pydoc<6>,  Prev: pdb<10>,  Up: 改良されたモジュール<11>

1.14.20.36 pickle
.................

*note pickle.Pickler: de6. オブジェクトに pickler ごとのリダクション関数
を設定する、オプショナルな *note dispatch_table: 14e3. 属性が追加されま
した。

(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<11>,  Prev: pickle<7>,  Up: 改良されたモジュール<11>

1.14.20.37 pydoc
................

The Tk GUI and the ‘serve()’ function have been removed from the *note
pydoc: bd. module: ‘pydoc -g’ and ‘serve()’ have been deprecated in
Python 3.2.


File: python.info,  Node: re<11>,  Next: sched,  Prev: pydoc<6>,  Up: 改良されたモジュール<11>

1.14.20.38 re
.............

*note str: 1ea. 正規表現が ‘\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<11>,  Up: 改良されたモジュール<11>

1.14.20.39 sched
................

   * *note run(): 14e7. が 'blocking' パラメータを取るようになりました。
     これを偽にセットすると、このメソッドは既に実行予定時間になっている
     イベント (もしあれば) を実行してすぐに戻ります。 これは *note
     scheduler: 14e8. を非ブロッキングなアプリケーションで使いたい場合に
     有用です。 (Contributed by Giampaolo Rodolà in bpo-13449(1).)  (--訳
     注: 原文の表現がわかりにくいですが、これは ‘blocking=False’ 時はス
     ケジュールされた時間になっているタスクがあれば通常は 'delayfunc' を
     呼び出すところをそうせずに、一番早く次の予定時間に達するタスクの予
     定時間までの時間差を返します。--)

   * *note scheduler: 14e8. クラスをマルチスレッド環境で安全に使えるよう
     になりました。 (Contributed by Josiah Carlson and Giampaolo Rodolà
     in bpo-8684(2).)

   * *note scheduler: 14e8. クラスのコンストラクタでのパラメータ
     'timefunc' と 'delayfunc' が省略可能になりました。それぞれデフォル
     トで順に *note time.time(): 764, *note time.sleep(): a91. が使われ
     ます。 (Contributed by Chris Clark in bpo-13245(3).)

   * *note enter(): 14e9. と *note enterabs(): 14ea. の 'argument' パラ
     メータが省略可能になりました。 (Contributed by Chris Clark in
     bpo-13245(4).)

   * *note enter(): 14e9. と *note enterabs(): 14ea. が '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.14.20.40 select
.................

Solaris とその派生プラットフォームにおいて、新規クラス *note
select.devpoll: 1344. が追加されました。これはハイパフォーマンスな非同期
ソケットを ‘/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<8>,  Prev: select<2>,  Up: 改良されたモジュール<11>

1.14.20.41 shlex
................

The previously undocumented helper function ‘quote’ from the ‘pipes’
modules has been moved to the *note shlex: cc. module and documented.
*note quote(): 787. properly escapes all characters in a string that
might be otherwise given special meaning by the shell.


File: python.info,  Node: shutil<8>,  Next: signal<4>,  Prev: shlex<3>,  Up: 改良されたモジュール<11>

1.14.20.42 shutil
.................

   * 新たな関数:

        * *note disk_usage(): 14ee.: ディスクの利用状況について、トータ
          ル、使用中、空きの容量を返します。 (Contributed by Giampaolo
          Rodolà in bpo-12442(1).)

        * *note chown(): 750.: 指定された path のユーザ、グループの両方
          あるいは一方を変更します。ユーザ、グループは名前もしくは数値で
          の ID (uid, gid) で指定します。(Contributed by Sandro Tosi in
          bpo-12191(2).)

        * *note shutil.get_terminal_size(): 14c4.: インタプリタが接続し
          ているターミナルウィンドウのサイズを取得します。 (Contributed
          by Zbigniew Jędrzejewski-Szmek in bpo-13609(3).)

   * *note copy2(): e23. と *note copystat(): 14ef. がファイルのタイムス
     タンプを、それをサポートするプラットフォームではナノ秒精度も維持す
     るようになりました。また、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():
     e24. がシンボリックリンクを POSIX の ‘move’ コマンドが行うのと同じ
     やり方で扱うようになりました。つまりターゲットのファイルの中身をコ
     ピーするのではなくシンボリックリンクを再作成します。(Contributed by
     Jonathan Niehof in bpo-9993(7).)  また、 ‘move()’ は ‘dst’ 引数を戻
     り値として返すようになりました。

   * *note os.open(): 114f. と *note os.unlink(): 14b6. が新パラメータ
     ‘dir_fd’ をサポートしているプラットフォームでは、 *note rmtree():
     33d. は今では シンボリックリンク攻撃に耐性を持ちます。 (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<8>,  Up: 改良されたモジュール<11>

1.14.20.43 signal
.................

   * *note signal: ce. モジュールに新規関数が追加されました:

        * *note pthread_sigmask(): 14f1.: これを呼び出すスレッドにセット
          されているシグナルマスクを取り出したり変更したりします
          (Contributed by Jean-Paul Calderone in bpo-8407(1));

        * *note pthread_kill(): 14f2.: スレッドにシグナルを送ります;

        * *note sigpending(): 14f3.: 保留中のシグナルを調べます;

        * *note sigwait(): 14f4.: シグナルを待ちます;

        * *note sigwaitinfo(): 1168.: シグナルを待ちますが、それについて
          の詳細情報を返します;

        * *note sigtimedwait(): 1167.: *note sigwaitinfo(): 1168. と似て
          いますがタイムアウト指定できます。

   * シグナルハンドラは wakeup ファイル記述子に以前は ‘\0’ を書き込んで
     いましたが、シグナル番号を 1 バイト整数として書き込むようにしました
     。これにより、一つ以上のシグナルを待った上でどのシグナルが発生した
     のかあとから調べるといったことが出来ます。

   * *note signal.signal(): 14f5. と *note signal.siginterrupt(): 14f6.
     は RuntimeError ではなく *note OSError: 543. を投げるようになりまし
     た: 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.14.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<12>,  Prev: smtpd<4>,  Up: 改良されたモジュール<11>

1.14.20.45 smtplib
..................

クラス *note SMTP: cfe, *note SMTP_SSL: cff, *note LMTP: d00. に新しいキ
ーワード引数 ‘source_address’ が追加されました。 ‘(host, port)’ の形で指
定し、これは外に向かうソケットを作成する際に *note bind(): 1481. 呼び出
し内でのソースアドレスとして用いられます。(Contributed by Paulo Scardine
in bpo-11281(1).)

*note SMTP: cfe. がコンテキスト管理プロトコルをサポートするようになった
ので ‘SMTP’ のインスタンスを ‘with’ 文で使えます。 (Contributed by
Giampaolo Rodolà in bpo-11289(2).)

*note SMTP_SSL: cff. コンストラクタと *note starttls(): 14f9. メソッドが
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<12>,  Next: socketserver<3>,  Prev: smtplib<4>,  Up: 改良されたモジュール<11>

1.14.20.46 socket
.................

   * *note socket: 115e. クラスが、前提となるプラットフォームがサポート
     していれば従属的なデータを処理する追加のメソッドを公開しました:

        * *note sendmsg(): 891.

        * *note recvmsg(): 1163.

        * *note recvmsg_into(): 14fb.

     (Contributed by David Watson in bpo-6560(1), based on an earlier
     patch by Heiko Wundram)

   * *note socket: 115e. クラスが 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: 115e. 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: 115e. クラスが OS X で ‘PF_SYSTEM’ プロトコルファミリ
     をサポートするようになりました。 (Contributed by Michael Goderbauer
     in bpo-13777(4).)

   * New function *note sethostname(): 14fc. 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<12>,  Prev: socket<12>,  Up: 改良されたモジュール<11>

1.14.20.47 socketserver
.......................

*note BaseServer: 14fe. がオーバライド可能な *note service_actions():
14ff. メソッドを持つようになり、これは *note serve_forever(): 1500. によ
りサービスループ内で呼び出されます。 *note ForkingMixIn: f3b. がこれをゾ
ンビ化した子プロセスのクリーンアップに使っています。 (Contributed by
Justin Warkentin in bpo-11109(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11109


File: python.info,  Node: sqlite3<12>,  Next: ssl<13>,  Prev: socketserver<3>,  Up: 改良されたモジュール<11>

1.14.20.48 sqlite3
..................

*note sqlite3.Connection: 3e6. の新規のメソッド *note
set_trace_callback(): 3ec. を使うと 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<13>,  Next: stat<2>,  Prev: sqlite3<12>,  Up: 改良されたモジュール<11>

1.14.20.49 ssl
..............

   * *note ssl: d8. モジュールに新たに 2 つの乱数生成関数が追加されまし
     た:

        * *note RAND_bytes(): 937.: 暗号学的に強固な擬似乱数バイト列を生
          成します。

        * ‘RAND_pseudo_bytes()’: generate pseudo-random bytes.

     (Contributed by Victor Stinner in bpo-12049(1).)

   * *note ssl: d8. モジュールがより粒度の細かい例外階層を公開するように
     なり、これにより様々な種類のエラーを調べることが容易になります。
     (Contributed by Antoine Pitrou in bpo-11183(2).)

   * *note load_cert_chain(): 79d. が 'password' 引数を受け付けるように
     なりました。これは秘密鍵が暗号化されている場合に使われます。
     (Contributed by Adam Simpkins in bpo-12803(3).)

   * ディフィー・ヘルマン鍵共有の、通常のものと楕円曲線ベースのもの両方
     が *note load_dh_params(): 1503. メソッドと *note set_ecdh_curve():
     267. メソッドを通じてサポートされるようになりました。(Contributed
     by Antoine Pitrou in bpo-13626(4) and bpo-13627(5).)

   * SSL ソケットに新規メソッド *note get_channel_binding(): 1504. が追
     加されました。これは 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(): 1505. method.  The new
     attribute *note OP_NO_COMPRESSION: 1506. can be used to disable
     compression.  (Contributed by Antoine Pitrou in bpo-13634(8).)

   * *note ssl.SSLContext.set_npn_protocols(): 33f. による Next Protocol
     Negotiation 拡張のサポートが追加されました。 (Contributed by Colin
     Marc in bpo-14204(9).)

   * 属性 *note library: 1507. と *note reason: 1508. が追加されたので、
     SSL のエラーは以前よりもっと簡単に調べることが出来るようになりまし
     た。(Contributed by Antoine Pitrou in bpo-14837(10).)

   * *note get_server_certificate(): c19. 関数が IPv6 をサポートするよう
     になりました。 (Contributed by Charles-François Natali in
     bpo-11811(11).)

   * New attribute *note OP_CIPHER_SERVER_PREFERENCE: 1509. 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<13>,  Up: 改良されたモジュール<11>

1.14.20.50 stat
...............

ドキュメントされていなかった ‘tarfile.filemode’ 関数が *note
stat.filemode(): 150b. に移動されました。これはファイルモードを
'-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<7>,  Prev: stat<2>,  Up: 改良されたモジュール<11>

1.14.20.51 struct
.................

The *note struct: de. 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<7>,  Next: sys<15>,  Prev: struct<4>,  Up: 改良されたモジュール<11>

1.14.20.52 subprocess
.....................

POSIX プラットフォームにおいて、コマンド文字列として bytes オブジェクト
を渡せるようになりました。 (Contributed by Victor Stinner in
bpo-8513(1).)

A new constant *note DEVNULL: 150e. 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<15>,  Next: tarfile<11>,  Prev: subprocess<7>,  Up: 改良されたモジュール<11>

1.14.20.53 sys
..............

*note sys: e2. モジュールに、スレッドの実装に関する情報が格納された
*note 名前付きタプル: a42. を保持する *note thread_info: 1510. が追加さ
れました。 (bpo-11223(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11223


File: python.info,  Node: tarfile<11>,  Next: tempfile<4>,  Prev: sys<15>,  Up: 改良されたモジュール<11>

1.14.20.54 tarfile
..................

*note tarfile: e7. が *note lzma: 8d. モジュールにより ‘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<11>,  Up: 改良されたモジュール<11>

1.14.20.55 tempfile
...................

*note tempfile.SpooledTemporaryFile: a87.'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<11>,  Prev: tempfile<4>,  Up: 改良されたモジュール<11>

1.14.20.56 textwrap
...................

*note textwrap: f5. モジュールに *note indent(): 783. が追加されました。
これはテキストのブロック内の選択行に共通のプレフィクスを追加する簡単な方
法になります。(bpo-13857(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13857


File: python.info,  Node: threading<11>,  Next: time<8>,  Prev: textwrap<3>,  Up: 改良されたモジュール<11>

1.14.20.57 threading
....................

いずれもかつてインスタンスを返すファクトリ関数であった *note
threading.Condition: 1515, *note threading.Semaphore: 1516, *note
threading.BoundedSemaphore: 1517, *note threading.Event: 1518, *note
threading.Timer: 1519. がクラスになったので、サブクラス化出来るようにな
りました。 (Contributed by Éric Araujo in bpo-10968(1).)

*note threading.Thread: 427. コンストラクタがキーワード引数 ‘daemon’ を
取るようになりました。これは親スレッドから ‘daemon’ フラグを継承するデフ
ォルトの振る舞いをオーバライドします (bpo-6064(2))。

かつての非公開関数 ‘_thread.get_ident’ が公開関数 *note
threading.get_ident(): 151a. として利用可能となっています。これは標準ラ
イブラリにおいて多数の ‘_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<10>,  Prev: threading<11>,  Up: 改良されたモジュール<11>

1.14.20.58 time
...............

PEP 418(1) が *note time: f7. モジュールに新たな関数を追加しました:

   * *note get_clock_info(): 151c.: クロックの情報を取得します。

   * *note monotonic(): 763.: 単調なクロック (逆行しない)、システムクロ
     ックの更新の影響を受けません。

   * *note perf_counter(): e4d.: 短期間の計測のために利用可能な最高の解
     像度を持つパフォーマンスカウンタです。

   * *note process_time(): e4e.: 現在のプロセスの system と user CPU 時
     間の和です。

その他の新たな関数:

   * *note clock_getres(): 151d, *note clock_gettime(): 151e. and *note
     clock_settime(): 151f. functions with ‘CLOCK_XXX’ constants.
     (Contributed by Victor Stinner in bpo-10278(2).)

クロスプラットフォーム間での一貫性を改善するために、 *note sleep(): a91.
が負の値を渡すと *note ValueError: 15a. を投げるように変更されています。
以前から 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<10>,  Next: unittest<12>,  Prev: time<8>,  Up: 改良されたモジュール<11>

1.14.20.59 types
................

新規クラス *note types.MappingProxyType: 194. の追加: 読み出し専用のマッ
ピングのプロキシです。 (bpo-14386(1))

新規関数 *note types.new_class(): 1521. と *note types.prepare_class():
1522. は 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<12>,  Next: urllib<6>,  Prev: types<10>,  Up: 改良されたモジュール<11>

1.14.20.60 unittest
...................

メソッド *note assertRaises(): 940, *note assertRaisesRegex(): 942,
*note assertWarns(): 2ab, *note assertWarnsRegex(): 2ac. が、コンテキス
トマネージャとして使われる際にキーワード引数 'msg' を受け付けるようにな
りました。 (Contributed by Ezio Melotti and Winston Ewert in
bpo-10775(1).)

*note unittest.TestCase.run(): 1524. が *note TestResult: 1525. オブジェ
クトを返すようになりました。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10775


File: python.info,  Node: urllib<6>,  Next: webbrowser<5>,  Prev: unittest<12>,  Up: 改良されたモジュール<11>

1.14.20.61 urllib
.................

*note Request: 1386. クラスが *note get_method(): 1527. で使われる
'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<5>,  Next: xml etree ElementTree<2>,  Prev: urllib<6>,  Up: 改良されたモジュール<11>

1.14.20.62 webbrowser
.....................

*note webbrowser: 11e. モジュールがさらに多くの "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<4>,  Prev: webbrowser<5>,  Up: 改良されたモジュール<11>

1.14.20.63 xml.etree.ElementTree
................................

The *note xml.etree.ElementTree: 12e. 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: 34b. 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<4>,  Prev: xml etree ElementTree<2>,  Up: 改良されたモジュール<11>

1.14.20.64 zlib
...............

New attribute *note zlib.Decompress.eof: 152b. 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: 152c. 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.14.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.14.22 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * 新しい PEP 3118(1) 関連の関数:

        * *note PyMemoryView_FromMemory(): 152e.

   * PEP 393(2) により追加された新たな Unicode 型、マクロ、関数:

        * 高水準 API:

             * *note PyUnicode_CopyCharacters(): c8c.

             * *note PyUnicode_FindChar(): c90.

             * *note PyUnicode_GetLength(): c8a, *note
               PyUnicode_GET_LENGTH: c8b.

             * *note PyUnicode_New(): c83.

             * *note PyUnicode_Substring(): c8d.

             * *note PyUnicode_ReadChar(): 152f, *note
               PyUnicode_WriteChar(): 1530.

        * 低水準 API:

             * 型 *note Py_UCS1: 1531, *note Py_UCS2: 1532, *note
               Py_UCS4: 30d.

             * 構造体 *note PyASCIIObject: 1533. と *note
               PyCompactUnicodeObject: 1534.

             * *note PyUnicode_READY: 64e.

             * *note PyUnicode_FromKindAndData(): 1535.

             * *note PyUnicode_AsUCS4(): 1536, *note
               PyUnicode_AsUCS4Copy(): c92.

             * *note PyUnicode_DATA: 1537, *note PyUnicode_1BYTE_DATA:
               1538, *note PyUnicode_2BYTE_DATA: 1539, *note
               PyUnicode_4BYTE_DATA: 153a.

             * *note PyUnicode_KIND: 153b. with ‘PyUnicode_Kind’ enum:
               ‘PyUnicode_WCHAR_KIND’, *note PyUnicode_1BYTE_KIND: 153c,
               *note PyUnicode_2BYTE_KIND: 153d, *note
               PyUnicode_4BYTE_KIND: 153e.

             * *note PyUnicode_READ: 153f, *note PyUnicode_READ_CHAR:
               1540, *note PyUnicode_WRITE: 1541.

             * *note PyUnicode_MAX_CHAR_VALUE: 1542.

   * *note PyArg_ParseTuple: 3b9. が ‘c’ フォーマットとして *note
     bytearray: 1d1. を許容するようになりました (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.14.23 非推奨
--------------

* Menu:

* サポートされないオペレーティングシステム: サポートされないオペレーティングシステム<2>.
* 非推奨の Python モジュール、関数、メソッド: 非推奨の Python モジュール、関数、メソッド<4>.
* C API の非推奨の関数ならびに型: C API の非推奨の関数ならびに型<3>.
* 非推奨の機能: 非推奨の機能<2>.


File: python.info,  Node: サポートされないオペレーティングシステム<2>,  Next: 非推奨の Python モジュール、関数、メソッド<4>,  Up: 非推奨<13>

1.14.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.14.23.2 非推奨の Python モジュール、関数、メソッド
....................................................

   * object 型そのものの ‘object.__format__()’ に空でない文字列が渡すこ
     とは非推奨となりました。Python 3.4 ではこれは *note TypeError: 29c.
     となります (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(): 1484. および *note ftplib.FTP.dir():
     1485.: *note ftplib.FTP.mlsd(): 1483. を使ってください

   * ‘platform.popen()’: use the *note subprocess: df. module.  Check
     especially the *note Replacing Older Functions with the subprocess
     Module: 1546. 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(): e4d. or *note time.process_time():
     e4e. 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: 1441. は非推奨となりました。代わり
          に *note abc.abstractmethod(): 1442. に *note property: 6c1. を
          渡して使ってください。

        * *note abc.abstractclassmethod: 1443. は非推奨となりました。代
          わりに *note abc.abstractmethod(): 1442. に *note classmethod:
          6a0. を渡して使ってください。

        * *note abc.abstractstaticmethod: 1444. は非推奨となりました。代
          わりに *note abc.abstractmethod(): 1442. に *note
          staticmethod: 66d. を渡して使ってください。

   * *note importlib: 7a. パッケージ:

        * バイトコードファイルとしての *note
          importlib.abc.SourceLoader.path_stats(): 1547. によりコンパイ
          ル時点の修正時刻とソースファイルサイズの両方を格納するようにな
          ったので、 *note importlib.abc.SourceLoader.path_mtime():
          1548. は非推奨となりました。

   ---------- 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.14.23.3 C API の非推奨の関数ならびに型
........................................

PEP 393(1) で *note Py_UNICODE: b7f. は非推奨になり、Python 4 で削除され
ます。この型を使用している全ての関数は非推奨です。

Unicode functions and methods using *note Py_UNICODE: b7f. and *note
Py_UNICODE: b7f.* types:

   * ‘PyUnicode_FromUnicode’: use *note PyUnicode_FromWideChar(): 154a.
     or *note PyUnicode_FromKindAndData(): 1535.

   * ‘PyUnicode_AS_UNICODE’, ‘PyUnicode_AsUnicode()’,
     ‘PyUnicode_AsUnicodeAndSize()’: use *note
     PyUnicode_AsWideCharString(): c93.

   * ‘PyUnicode_AS_DATA’: use *note PyUnicode_DATA: 1537. with *note
     PyUnicode_READ: 153f. and *note PyUnicode_WRITE: 1541.

   * ‘PyUnicode_GET_SIZE’, ‘PyUnicode_GetSize()’: use *note
     PyUnicode_GET_LENGTH: c8b. or *note PyUnicode_GetLength(): c8a.

   * ‘PyUnicode_GET_DATA_SIZE’: use ‘PyUnicode_GET_LENGTH(str) *
     PyUnicode_KIND(str)’ (only work on ready strings)

   * ‘PyUnicode_AsUnicodeCopy()’: use *note PyUnicode_AsUCS4Copy(): c92.
     or *note PyUnicode_AsWideCharString(): c93.

   * ‘PyUnicode_GetMax()’

Py_UNICODE* 文字列を操作する関数ならびにマクロ:

   * ‘Py_UNICODE_strlen()’: use *note PyUnicode_GetLength(): c8a. or
     *note PyUnicode_GET_LENGTH: c8b.

   * ‘Py_UNICODE_strcat()’: use *note PyUnicode_CopyCharacters(): c8c.
     or *note PyUnicode_FromFormat(): 824.

   * ‘Py_UNICODE_strcpy()’, ‘Py_UNICODE_strncpy()’, ‘Py_UNICODE_COPY()’:
     use *note PyUnicode_CopyCharacters(): c8c. or *note
     PyUnicode_Substring(): c8d.

   * ‘Py_UNICODE_strcmp()’: use *note PyUnicode_Compare(): c8e.

   * ‘Py_UNICODE_strncmp()’: use *note PyUnicode_Tailmatch(): c8f.

   * ‘Py_UNICODE_strchr()’, ‘Py_UNICODE_strrchr()’: use *note
     PyUnicode_FindChar(): c90.

   * ‘Py_UNICODE_FILL()’: use *note PyUnicode_Fill(): 154b.

   * ‘Py_UNICODE_MATCH’

エンコーダ:

   * ‘PyUnicode_Encode()’: use ‘PyUnicode_AsEncodedObject()’

   * ‘PyUnicode_EncodeUTF7()’

   * ‘PyUnicode_EncodeUTF8()’: use *note PyUnicode_AsUTF8(): 63e. or
     *note PyUnicode_AsUTF8String(): 154c.

   * ‘PyUnicode_EncodeUTF32()’

   * ‘PyUnicode_EncodeUTF16()’

   * ‘PyUnicode_EncodeUnicodeEscape()’ use *note
     PyUnicode_AsUnicodeEscapeString(): 154d.

   * ‘PyUnicode_EncodeRawUnicodeEscape()’ use *note
     PyUnicode_AsRawUnicodeEscapeString(): 154e.

   * ‘PyUnicode_EncodeLatin1()’: use *note PyUnicode_AsLatin1String():
     154f.

   * ‘PyUnicode_EncodeASCII()’: use *note PyUnicode_AsASCIIString():
     1550.

   * ‘PyUnicode_EncodeCharmap()’

   * ‘PyUnicode_TranslateCharmap()’

   * ‘PyUnicode_EncodeMBCS()’: use *note PyUnicode_AsMBCSString(): 1551.
     or *note PyUnicode_EncodeCodePage(): 1552. (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.14.23.4 非推奨の機能
......................

*note array: 8. モジュールの ‘'u'’ 書式化コードは非推奨となりました。
Python 4 ではほかの (*note Py_UNICODE: b7f.) API と一緒に削除されるでし
ょう。


File: python.info,  Node: Python 3 3 への移植,  Prev: 非推奨<13>,  Up: What's New In Python 3 3

1.14.24 Python 3.3 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python コードの移植::
* C コードの移植::
* C 拡張のビルド::
* コマンドラインスイッチの変更::


File: python.info,  Node: Python コードの移植,  Next: C コードの移植,  Up: Python 3 3 への移植

1.14.24.1 Python コードの移植
.............................

   * ハッシュのランダム化がデフォルトで有効になりました。これを無効にす
     るには環境変数 *note PYTHONHASHSEED: 1434. を ‘0’ にセットして下さ
     い。 *note object.__hash__(): ec5. メソッドも参照して下さい。

   * bpo-12326(1): Linux では、 *note sys.platform: 51f. はもはやメジャ
     ーバージョン番号を含みません。 これは今では常に 'linux' です。以前
     はこれは Python のビルドに使われた Linux バージョンに依存した
     ‘'linux2'’ や ‘'linux3'’ でした。 ‘sys.platform == 'linux2'’ などと
     するのではなく、 ‘sys.platform.startswith('linux')’ とするか、古い
     Python バージョンのサポートが不要であれば直接的に ‘sys.platform ==
     'linux'’ として下さい。

   * bpo-13847(2), bpo-14180(3): *note time: f7. および *note datetime:
     33.: タイムスタンプが範囲外の場合に、 *note ValueError: 15a. ではな
     く *note OverflowError: c5b. を送出するようになりました。また、C 関
     数の ‘gmtime()’ あるいは ‘localtime()’ が失敗した場合には *note
     OSError: 543. を送出するようになりました。

   * インポートで使われるデフォルトのファインダが、特定のディレクトリに
     何が含まれるのかについてのキャッシュを利用するようになっています。
     実行中に Python ソースファイルやバイトコードファイルを作ったら、キ
     ャッシュをクリアしてファインダが新しく作られたファイルに気付けるよ
     うに、 *note importlib.invalidate_caches(): fd3. を呼ぶ必要があるこ
     とに注意してください。

   * *note ImportError: 1c8. がインポートを試みたモジュール名として完全
     名を使うようになっています。ImportError のメッセージをチェックする
     doctest は、モジュール名をその末尾の名前ではなく完全な名前を使うよ
     うに更新する必要があります。

   * *note __import__(): caa. の引数 'index' のデフォルトが -1 ではなく
     0 となり、また、もはや負の値はサポートされません。デフォルト値が -1
     で残されたのは(訳注: つまり絶対、相対インポートの両方を試みるように
     したのは) PEP 328(4) を実装した際の過失でした。絶対インポートに先立
     って相対インポートを実行する振る舞いがまだ必要なのであれば、index を
     1 にして相対インポートを実行して、その後で index 0 のインポートをす
     るようにしてください。そうなのですが、 ‘__import__()’ を直接呼び出
     すのではなく、 *note importlib.import_module(): 92c. を使うことが望
     ましいやり方です。

   * *note __import__(): caa. の index に、トップレベルモジュールに対し
     て 0 でなく 1 を与えることは今では許されません。例えば
     ‘__import__('sys', level=1)’ はエラーです。

   * Because *note sys.meta_path: 10e7. and *note sys.path_hooks: 13d1.
     now have finders on them by default, you will most likely want to
     use *note list.insert(): 1556. instead of *note list.append(): abf.
     to add to those lists.

   * Because ‘None’ is now inserted into *note sys.path_importer_cache:
     9e0, 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: 1428.

   * *note pkgutil: ae. は、内部的に *note importlib: 7a. を使うように変
     更されました。このことは、 PEP 302(5) インポートエミュレーションの
     古い振る舞いが本物のインポートシステムの振る舞いに合わせるのに失敗
     していた数多くの特殊ケースの問題を取り除きます。インポートエミュレ
     ーションそのものはまだ存在しますが、今では非推奨です。 *note
     pkgutil.iter_importers(): 1557. 関数と *note
     pkgutil.walk_packages(): fc2. 関数は標準インポートフックを特別に扱
     うので、ファインダの ‘iter_modules()’ メソッドは標準ではないにも関
     わらず、まだサポートされます。

   * *note email.header.decode_header(): 1478. によってなされる解析に長
     い間存在していた 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(): 1558. は非 ASCII の display name に
     対し正しい content transfer encoding の扱いをするようになっています
     。かつての、フォーマット後文字列内に非 ASCII Unicode を維持してしま
     う誤った振る舞いに依存するすべてのコードは、変更の必要があります。
     (bpo-1690608(7))

   * *note poplib.POP3.quit(): 1559. メソッドもほかの全ての ‘poplib’ の
     メソッドと同じく、今ではプロトコルエラーを送出し得ます。 ‘quit’ が
     *note poplib.error_proto: 155a. エラーを送出しないことをあてにして
     いたコードは、 ‘quit’ でのエラーが特定のアプリケーションにとって問
     題となるようであれば、修正の必要があるかもしれません
     (bpo-11291(8))。

   * Python 2.4 から非推奨となっていた、 *note email.parser.Parser:
     155b. への ‘strict’ 引数はついに削除されました。

   * 非推奨となっていたメソッド ‘unittest.TestCase.assertSameElements’ は
     削除されました。

   * 非推奨となっていた変数 ‘time.accept2dyear’ は削除されました。

   * 非推奨となっていた ‘Context._clamp’ 属性が *note decimal: 39. モジ
     ュールから削除されました。以前に既にこれは公開属性 *note clamp:
     155c. に置き換えられていました (bpo-8540(9) 参照)。

   * 文書化されていなかった内部ヘルパクラス ‘SSLFakeFile’ が *note
     smtplib: d2. モジュールより削除されました。この機能はずっと以前から
     *note socket.socket.makefile(): 155d. によって直接的に提供されてい
     ます。

   * Windows では *note time.sleep(): a91. に負値を与えた場合に無限に眠
     っていましたが、今ではこれは例外を送出します。POSIX ではこれは以前
     より常に例外です。

   * The ‘ast.__version__’ constant has been removed.  If you need to
     make decisions affected by the AST version, use *note
     sys.version_info: 308. to make the decision.

   * *note threading: f6. モジュールの、非公開クラスをサブクラス化するフ
     ァクトリ関数を迂回していたコードは、今では公開クラスになったので修
     正の必要があります。

   * 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.14.24.2 C コードの移植
........................

   * In the course of changes to the buffer API the undocumented
     ‘smalltable’ member of the *note Py_buffer: b3f. structure has been
     removed and the layout of the ‘PyMemoryViewObject’ has changed.

     ‘memoryobject.h’ あるいは ‘object.h’ での関係する部分に依存する全て
     の拡張は、再ビルドが必要です。

   * *note PEP 393: 13ea. により、 *note Py_UNICODE: b7f. 型とこの型を使
     う全ての関数は非推奨となりました (ただし最低 5 年は利用可能なまま保
     たれます)。Unicode オブジェクトの構築とアクセスに低水準 Unicode API
     をこれまで使っていて、 PEP 393(1) によって提供されるメモリフットプ
     リント削減の恩恵を受けたければ、新しい *note Unicode API: 155e. に
     乗り換える必要があります。

     一方で *note PyUnicode_Concat(): 155f. 、 *note PyUnicode_Join():
     1560. あるいは *note PyUnicode_FromFormat(): 824. といった高水準関
     数のみを使ってきたのであれば、あなたのコードは自動的に新しい
     Unicode 表現に便乗できます。

   * *note PyImport_GetMagicNumber(): 1561. は失敗時に ‘-1’ を返すように
     なりました。

   * *note __import__(): caa. の 'level' 引数に負値を渡すことはもはや有
     効ではないので、対応する *note PyImport_ImportModuleLevel(): 1562.
     でも同じです。このことは *note PyImport_ImportModuleEx(): 1563. に
     使われる 'level' の値が ‘-1’ ではなく ‘0’ を使うようになったことも
     意味しています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/


File: python.info,  Node: C 拡張のビルド,  Next: コマンドラインスイッチの変更,  Prev: C コードの移植,  Up: Python 3 3 への移植

1.14.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.14.24.4 コマンドラインスイッチの変更
......................................

   * ‘-Q’ コマンドラインスイッチとそれに関係するものは削除されました。
     ‘sys.flags.division_warning’ をチェックしているコードは修正する必要
     があります。

     (bpo-10998(1), contributed by Éric Araujo.)

   * *note -S: 1566. スイッチ付きで ‘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.15 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.15.1 PEP 384: 安定 ABI の定義
-------------------------------

かつて、ある Python バージョンでビルドされた拡張モジュールは、ほかの
Python バージョンでは使えないことがありました。特に Windows では、全ての
Python 公式リリースごとに、使いたい全ての拡張モジュールを再ビルドする必
要がありました。これは、拡張モジュールが Python インタプリタの内部実装に
自由にアクセス出来たことからの結果でした。

Python 3.2 より、このことに関する別のアプローチが利用可能になりました。
(*note Py_LIMITED_API: 853. を定義することで) 制限された 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.15.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: 156c. に *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.15.3 PEP 391: logging の辞書ベースの設定
------------------------------------------

The *note logging: 8a. 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(): 156e. が追加されました。これはロギングの設
定を通常の 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.15.4 PEP 3148: ‘concurrent.futures’ モジュール
------------------------------------------------

同時並行性 (concurrency) を生成・管理するコードはトップレベルの新しい名
前空間 'concurrent' に集められることになりました。その最初のメンバーが
'futures' パッケージです。これはスレッドとプロセス管理の統一的な高水準イ
ンターフェイスを提供します。

*note concurrent.futures: 24. の設計は Java の 'java.util.concurrent' パ
ッケージに触発されました。そのモデルでは、実行する呼び出しとその結果は
*note Future: 1570. オブジェクトで表現され、これはスレッド、プロセス、遠
隔手続呼び出しの共通的な側面を抽象化しています。そのオブジェクトはステー
タスのチェック (実行中あるいは完了かどうか)、タイムアウト、キャンセル、
コールバックの追加、そして結果や例外へのアクセスをサポートします。

この新モジュールで提供される最も基本となるのが、呼び出しの実行と管理のた
めの 2 つの executor クラスです。これら executor の目標は、これまでにも
あった道具立てでの並列呼び出しを、もっと簡単にすることです。リソースプー
ルをお膳立てしたり呼び出しを実行したり、結果のキューを作ったり、あるいは
タイムアウトのハンドラを追加したり、スレッドやプロセスや遠隔手続呼び出し
の総数を制限したり、といったことを、これらを使えば、その労力を小さく出来
ます。

理想的にはそれぞれのアプリケーションは、プロセスとスレッドの制限が確実に
管理されるように、複数コンポーネントをまたがって単一の executor を共有す
べきです。そうしておけば、個々のコンポーネントがリソース管理についての競
合する戦略を持つ場合に起こる設計の難題は解決出来ます。

どちらの executor クラスとも 3 つのメソッドを持つ共通インターフェイスを
持ちます。 *note submit(): e48. メソッドは呼び出し可能オブジェクトをスケ
ジュールし、 *note Future: 1570. オブジェクトを返します。 *note map():
47a. メソッドは一気に複数の非同期呼び出しをスケジュールします。 *note
shutdown(): cc2. メソッドはリソースを解放します。これらクラスは *note
context manager: 47f. なので *note with: 215. 文とともに使うことが出来、
現時点で保留中の future が実行を終えた際にリソースが自動的に解放されるこ
とを保障出来ます。

以下はファイルコピーを行う 4 つの並列スレッドを実行する、 *note
ThreadPoolExecutor: b2c. の単純な使用例です:

     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 の例: 1571. はスレッド並列でウェブページを取得
する実例コードです。

*note ProcessPoolExecutor: 211. の実例を *note
並列で素数計算するコード例: 1572. として挙げています。

   ---------- 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.15.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 ‘__cached__’ 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: bb. と *note compileall: 21. モジュールはこの新命
     名規則とターゲットディレクトリを反映するよう更新されました。
     'compileall' のコマンドラインからの起動には新しいオプションが追加さ
     れました。 ‘-i’ はコンパイルするファイルとディレクトリのリストを指
     定します。 ‘-b’ はバイトコードファイルを '__pycache__' ではなく伝統
     的な場所に書き出します。

   * The *note importlib.abc: 7b. module has been updated with new *note
     abstract base classes: 1574. 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.15.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: e4. モジュールにある関数で
アクセス出来ます:

     >>> 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.15.7 PEP 3333: Python Web Server Gateway Interface v1.0.1
-----------------------------------------------------------

この情報 PEP は、 WSGI プロトコルによってどのようにバイト列/テキストの問
題が処理されるべきかを明確化しています。HTTP プロトコルそのものはバイト
列指向であっても、Python 3 にあってほとんど *note str: 1ea. 型で便利に文
字列処理出来るようにすることが挑戦でした。

この PEP では、リクエスト/レスポンスヘッダとメタデータに使われるいわゆる
'ネイティブ文字列(native strings)' と、リクエストとレスポンスのボディに
使われる 'バイト列文字列(byte strings)' を区別します。

The 'native strings' are always of type *note str: 1ea. 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: 121. module has a
new function, *note wsgiref.handlers.read_environ(): 1577. for
transcoding CGI variables from *note os.environ: 4ec. 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.15.8 その他の言語変更
-----------------------

Python 言語コアに小さな変更がいくつか行われました:

   * *note format(): 440. と *note str.format(): a17. のフォーマット文字
     '#' が拡張されました。以前から二進、八進、十六進整数に対して順にそ
     れぞれ '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(): 1194. method that
     extends the capabilities of the existing *note str.format(): a17.
     method by accepting arbitrary *note mapping: 1579. objects.  This
     new method makes it possible to use string formatting with any of
     Python's many dictionary-like objects such as *note defaultdict:
     157a, *note Shelf: 1349, *note ConfigParser: 6ea, or *note dbm: 34.
     It is also useful with custom *note dict: 193. subclasses that
     normalize keys before look-up or that supply a *note __missing__():
     157b. 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: a81. 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(): 8e7. function works by calling *note
     getattr(): f93. and detecting whether an exception is raised.  This
     technique allows it to detect methods created dynamically by *note
     __getattr__(): 8e8. or *note __getattribute__(): f94. 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:
     1b4. 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(): 1ea. は *note repr():
     462. 表現と同じになりました。以前は ‘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: 1dd. objects now have a *note release(): 157c.
     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: 44e. 節の対象が消去されるこ
     とを思い出せば、 Python 2.6 では動き、Python 3.1 では *note
     SyntaxError: 189. を送出するこのコードは再び動きます:

          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: 157d. are now subclasses of tuple.
     This means that C structures like those returned by *note
     os.stat(): 4fc, *note time.gmtime(): 157e, and *note
     sys.version_info: 308. now work like a *note named tuple: a42. 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: 1cc. を使えば、コマンドラインで ‘-W’ を使うより簡単
     です:

          $ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'

     (Suggested by Barry Warsaw and implemented by Philip Jenvey in
     bpo-7301(9).)

   * 新たな警告カテゴリ *note ResourceWarning: 754. が追加されました。こ
     れはリソース消費やクリーンアップについての潜在的な問題が検出される
     と発行されます。これは通常のリリースビルドではデフォルトでは黙殺し
     ますが、 *note warnings: 11b. モジュールで意味付けを変更 (訳注:
     *note 警告フィルタ: 1d7. 参照) するかコマンドラインオプションで有効
     に出来ます。

     A *note ResourceWarning: 754. is issued at interpreter shutdown if
     the *note gc.garbage: 157f. list isn't empty, and if *note
     gc.DEBUG_UNCOLLECTABLE: 1580. is set, all uncollectable objects are
     printed.  This is meant to make the programmer aware that their
     code contains object finalization issues.

     *note ResourceWarning: 754. は明示的にクローズされなかった *note
     file object: 1581. が破壊される際にも発行されます。そのようなオブジ
     ェクトのデアロケータは背後の 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: d13. objects now support 'index' and 'count' methods.
     This is part of an effort to make more objects fully implement the
     *note collections.Sequence: 1582. *note abstract base class: 1574.
     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: 1583.  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(): 1584. 組み込み関数が復活しました。 こ
     の関数は ‘isinstance(x, collections.Callable)’ のように式内で *note
     抽象基底クラス: 1574. を使用するよりも、簡潔で可読性の高い手段を提
     供します:

          >>> 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.15.9 新たなモジュール、改良されたモジュール、非推奨のモジュール
-----------------------------------------------------------------

Python の標準ライブラリは保守の努力と質の向上を大きく受けています。

The biggest news for Python 3.2 is that the *note email: 3e. package,
*note mailbox: 8e. 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: 47f.
を実装し、 *note with: 215. 文を使った便利で信頼出来るリソースのクリーン
アップをサポートしています。

* Menu:

* email: email<8>.
* elementtree::
* functools: functools<10>.
* itertools: itertools<8>.
* collections: collections<9>.
* threading: threading<12>.
* datetime と time::
* math: math<12>.
* abc: abc<3>.
* io: io<9>.
* reprlib::
* logging: logging<9>.
* csv: csv<5>.
* contextlib: contextlib<9>.
* decimal と fractions::
* ftp::
* popen::
* select: select<3>.
* gzip と zipfile::
* tarfile: tarfile<12>.
* hashlib: hashlib<8>.
* ast: ast<9>.
* os: os<16>.
* shutil: shutil<9>.
* sqlite3: sqlite3<13>.
* html: html<3>.
* socket: socket<13>.
* ssl: ssl<14>.
* nntp::
* certificates::
* imaplib: imaplib<5>.
* http.client: http client<5>.
* unittest: unittest<13>.
* random: random<5>.
* poplib: poplib<4>.
* asyncore: asyncore<2>.
* tempfile: tempfile<5>.
* inspect: inspect<12>.
* pydoc: pydoc<7>.
* dis: dis<6>.
* dbm: dbm<8>.
* ctypes: ctypes<5>.
* site: site<4>.
* sysconfig: sysconfig<6>.
* pdb: pdb<11>.
* configparser: configparser<6>.
* urllib.parse: urllib parse<7>.
* mailbox::
* turtledemo::


File: python.info,  Node: email<8>,  Next: elementtree,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.1 email
..............

The usability of the *note email: 3e. 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: 1d2. rather than *note str: 1ea. 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(): 1587, *note
     message_from_binary_file(): 1588. 、それに新規クラス *note
     BytesFeedParser: 1589, *note BytesParser: 158a. が、バイナリメッセ
     ージデータをパースしてモデルオブジェクトに読み込みます。

   * bytes の入力をモデルに与えると *note get_payload(): 158b. は、デフ
     ォルトでは '8 ビット' の ‘Content-Transfer-Encoding’ MIME ヘッダを
     もったメッセージボディをそのヘッダで指定された文字セットを使い、デ
     コードして結果文字列を返します。

   * bytes の入力をモデルに与えると *note Generator: 158c. は、 '8 ビッ
     ト' の ‘Content-Transfer-Encoding’ MIME ヘッダをもったメッセージボ
     ディを、 '7 ビット' の ‘Content-Transfer-Encoding’ を持つものに変換
     します。

     エンコードされていない非 ASCII バイト列を持つヘッダは '未知の 8 ビ
     ット' 文字セットを使った RFC 2047(1) エンコードであると見做されます
     。

   * 新規クラス *note BytesGenerator: 158d. は出力としてバイト列を生成し
     ます。これはモデルを構築するのに使った入力にあった非 ASCII データを
     そのままにし、 '8ビットの' ‘Content-Transfer-Encoding’ を持つメッセ
     ージボディに含めます。

   * *note smtplib: d2. モジュールの *note SMTP: cfe. クラスが *note
     sendmail(): 120d. メソッドの 'msg' 引数としてバイト列文字列を受け付
     けるようになりました。新しく追加されたメソッド *note
     send_message(): 120e. は 'msg' 引数に *note Message: 786. オブジェ
     クトを受け付けます。このメソッドは '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<10>,  Prev: email<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.2 elementtree
....................

The *note xml.etree.ElementTree: 12e. package and its
‘xml.etree.cElementTree’ counterpart have been updated to version 1.3.

有用な関数とメソッドが幾つか新たに追加されました:

   * *note xml.etree.ElementTree.fromstringlist(): 158f.、断片のシーケン
     スから XML 文書を組み立てます

   * *note xml.etree.ElementTree.register_namespace(): 1590.、大域名前空
     間接頭辞を登録するのに使用します

   * *note xml.etree.ElementTree.tostringlist(): 13a4.、全サブリストを含
     めた文字列表記に使用します

   * *note xml.etree.ElementTree.Element.extend(): 1591.、ゼロ以上の要素
     のシークエンスを追加するのに使用します

   * *note xml.etree.ElementTree.Element.iterfind(): 1592.、要素と子要素
     を検索します

   * *note xml.etree.ElementTree.Element.itertext(): 1593.、要素と子要素
     を走るテキストイテレータを作成します

   * *note xml.etree.ElementTree.TreeBuilder.end(): 1594.、現在の要素を
     閉じます

   * *note xml.etree.ElementTree.TreeBuilder.doctype(): e61.、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<10>,  Next: itertools<8>,  Prev: elementtree,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.3 functools
..................

   * *note functools: 62. モジュールに関数呼び出しをキャッシュするデコレ
     ータが追加されています。 *note functools.lru_cache(): db7. を使うと
     、同じ結果が期待される場合の外部リソースへの問い合わせ繰り返しを防
     ぐことができます。

     たとえばデータベース問い合わせ関数をキャッシュするデコレータで修飾
     すれば、人気の検索のデータベースアクセスを省けます:

          >>> 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(): 130c. decorator now adds a
     ‘__wrapped__’ attribute pointing to the original callable function.
     This allows wrapped functions to be introspected.  It also copies
     *note __annotations__: 1596. if defined.  And now it also
     gracefully skips over missing attributes such as *note __doc__:
     1597. 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(): 12f2. が追加さ
     れました。これは既存の等式と不等式メソッドを使って残りのメソッドを
     埋めます。

     例えば '__eq__' と '__lt__' を与えると、 *note total_ordering():
     12f2. は '__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(): 1598. 関数が追加されました。これは旧式の比
     較関数をモダンな *note key function: 11be. に変換します:

          >>> # locale-aware sort order
          >>> sorted(iterable, key=cmp_to_key(locale.strcoll))

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 1599.
     を参照して下さい。

     (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<9>,  Prev: functools<10>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.4 itertools
..................

   * *note itertools: 84. モジュールに、 APL(1) の 'scan' 演算子や
     NumPy(2) の 'accumulate' 関数をモデルにした *note accumulate():
     dc3. が新しく追加されました:

          >>> 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(): dc3. の使用例が *note examples for the random
     module: 159b. にあります。

     (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<9>,  Next: threading<12>,  Prev: itertools<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.5 collections
....................

   * *note collections.Counter: 20f. クラスに 2 つの形式のインプレイス減
     算が追加されました。 saturating subtraction(1) (訳注: 結果を [min,
     max] に収める演算) を行う既存の '-=' 演算子に加え、新しく追加された
     *note subtract(): 159d. メソッドは通常の減算を行います。前者は要素
     数に正しか持たない 多重集合(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: 9da. クラスに *note move_to_end():
     159e. メソッド (訳注: 「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: 9db. クラスに 2 つのメソッド *note
     count(): 159f. と *note reverse(): 15a0. が追加されました。これでさ
     らに *note list: 4e0. との置換可能性が増しました:

          >>> 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<12>,  Next: datetime と time,  Prev: collections<9>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.6 threading
..................

*note threading: f6. モジュールに新たに同期クラス *note Barrier: 15a2. が
追加されました。これは多重のスレッドに、それら全てが共通のバリアポイント
に到達するまで待たせます。バリアは、複数の事前条件を持ったタスクを、その
前任タスクの全てが完了するまで走らせたくない場合に有用です。

バリアは任意の数のスレッドに対して使えます。これは Rendezvous(1) を一般
化したもので、それは 2 つのスレッドに対してのみに定義されていました。

二段階の周期バリアとしての実装なので、 *note Barrier: 15a2. オブジェクト
はループ内での利用に適しています。分けられた '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(): 15a3. でのそれといかに似ているか気付くと思いま
す。ですがバリアポイントを通過した後に、スレッドは生き続けて (投票を集計
する (summarizing ballots) という) 仕事を続けます。

いずれかの前任タスクがハングしたり遅延したりしうるのであれば、バリアを
'timeout' 付きで作ることができます。全ての前任タスクがバリアポイントに到
達する前にタイムアウトの期間が経過すると、全ての待機スレッドは解放されて
*note BrokenBarrierError: 15a4. 例外が発生します:

     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<12>,  Prev: threading<12>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.7 datetime と time
.........................

   * *note datetime: 33. モジュールに新たに *note timezone: 147f. 型が追
     加されています。これは *note tzinfo: 9dd. インターフェイスを実装し
     、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: d98. オブジェクトは今では *note float:
     32f. を掛けることができ、 ‘float’ や *note int: 32e. で割ることがで
     きます。また、 ‘timedelta’ オブジェクトは別の ‘timedelta’ で割るこ
     とが出来ます。

   * *note datetime.date.strftime(): 1056. メソッドにはもう 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: 2d4.  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(): 15a6.
     function will accept any year that fits in a C int, while the *note
     time.mktime(): 15a7. and *note time.strftime(): 15a8. 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<12>,  Next: abc<3>,  Prev: datetime と time,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.8 math
.............

*note math: 91. モジュールがアップデートされ、C99 標準に触発されて6つの
新たな関数が追加されました。

*note isfinite(): 15aa. 関数は特殊値を確実に、かつ高速に検出する方法を提
供します。通常の数には ‘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(): 15ab. 関数は小さな '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(): f9c. 関数は確率積分、すなわち 誤差関数(1) を返します。 相補
誤差関数 *note erfc(): f9d. は ‘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(): 15ac. 関数は階乗を連続的に拡張したものです。詳細は ガンマ
関数(2) を参照してください。ガンマ関数は階乗に関係しているため、小さな
'x' でも大きくなります。そのため、ガンマ関数の自然対数を計算する *note
lgamma(): 15ad. 関数があります。

     >>> 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<12>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.9 abc
............

*note abc: 4. モジュールは *note abstractclassmethod(): 1443. と *note
abstractstaticmethod(): 1444. をサポートしました。

これらのツールによって特定の *note classmethod(): 6a0. や *note
staticmethod(): 66d. を実装する必要のある *note 抽象基底クラス: 1574. を
定義することが出来ます。

     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.15.9.10 io
............

*note io.BytesIO: 1258. に *note memoryview(): 1dd. と同様の機能を提供す
る新たなメソッド *note getbuffer(): 15b0. が追加されました。 このメソッ
ドはコピーせずにデータの編集可能なビューを作成します。 バッファのランダ
ムアクセスとスライス記法のサポートはインプレースな編集に適しています:

     >>> 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<9>,  Prev: io<9>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.11 reprlib
.................

When writing a *note __repr__(): 1c7. 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: 4e0. and
*note set: 432. handle self-reference by displaying "..."  in the
recursive part of the representation string.

To help write such *note __repr__(): 1c7. methods, the *note reprlib:
c3. module has a new decorator, *note recursive_repr(): 15b2, 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<9>,  Next: csv<5>,  Prev: reprlib,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.12 logging
.................

上記の辞書ベースの設定に加え、*note logging: 8a. パッケージには他にも多
くの改良があります。

ロギングのドキュメントは *note 基本チュートリアル: 15b4. 、 *note
上級チュートリアル: 15b5. 、 *note クックブック: 15b6. により増強されて
きました。ロギングについて学習するにはこれらのドキュメントが最速の方法で
す。

セットアップ関数 *note logging.basicConfig(): dc6. に 'style' 引数が追加
され、これにより異なる 3 つのタイプの文字列書式化がサポートされます。デ
フォルトは伝統的な % 書式化を使う "%" で、 *note str.format(): a17. スタ
イルの "{" 、 *note string.Template: a7c. で提供されるシェルスタイルの
"$" をセット出来ます。以下の 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: 15b7. directed
to *note sys.stderr: d09. 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: 15b8.  The new default handler
is stored in *note logging.lastResort: 15b9.

フィルタの利用は単純になりました。 *note Filter: 15ba. オブジェクトを作
る代わりに、 ‘True’ か ‘False’ を返す任意の Python 呼び出し可能オブジェ
クトを述語 (predicate) として利用出来ます。

ほかにも柔軟性を高め、設定を単純化する数多くの改善がありました。Python
3.2 での全ての変更についてはモジュールのドキュメントを参照してください。


File: python.info,  Node: csv<5>,  Next: contextlib<9>,  Prev: logging<9>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.13 csv
.............

*note csv: 2c. モジュールは新たな方言 *note unix_dialect: 15bc. をサポー
トしました。 この方言は全フィールドをクォートし、行末を伝統的な Unix 形
式の ‘'\n'’ にします。 登録された方言名は ‘unix’ です。

*note csv.DictWriter: 15bd. に新たなメソッド *note writeheader(): 15be.
が追加されました。 最初の列をドキュメントのフィールド名に書き出すのに使
用します:

     >>> 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<9>,  Next: decimal と fractions,  Prev: csv<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.14 contextlib
....................

新しく追加され、そして少しばかりハートを揺さぶるツール *note
ContextDecorator: 217. は、関数デコレータとしての任務も果たす *note
context manager: 47f. を作るのに役立つものです。

利便性のためにこの新機能は *note contextmanager(): 219. で使われているの
で、両方の役割をサポートするのにことさら労力は要しません。

基本的なアイディアは、コンテキストマネージャも関数デコレータも、ともに事
前アクション・事後アクションラッパーとして使うことが出来るというものです
。コンテキストマネージャは *note with: 215. 文を使ったステートメント (文
) のグループを包みますし、関数デコレータは関数に取り囲まれたステートメン
トのグループを包みます。そうです、どちらかの役割で使える事前アクションあ
るいは事後アクションラッパーを書く必要性は、しばしば起こることです。

たとえば関数やステートメントのグループをロガーで包んで、開始時刻と終了時
刻を追跡できるようにするとしばしば便利です。このタスクをこなすために関数
デコレータとコンテキストマネージャの両方を書く代わりに、 *note
contextmanager(): 219. が単一の定義に両方の能力をもたらしてくれます:

     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(): 219.
では、これはコンテキストマネージャとして使えるだけでした:

     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: 215. 文で使える値を返せる柔
軟性を持ちますが、関数デコレータにはそれに匹敵するものはありません。

上の例の場合は、'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<9>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.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: 13ad, 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: 1cd. コンストラクタに *note float: 32f. オブ
     ジェクトを直接渡せるようになりました。これにより *note
     from_float(): 15c1. メソッドを使う必要はなくなりました
     (bpo-8257(2))。

   * 型違いの比較はいまでは完全にサポートされたので、 *note Decimal:
     1cd. オブジェクトを直接 *note float: 32f. や *note
     fractions.Fraction: 1ce. と比較出来ます (bpo-2531(3) and
     bpo-8188(4))。

Similar changes were made to *note fractions.Fraction: 1ce. so that the
*note from_float(): 15c2. and *note from_decimal(): 15c3. 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: 39. module is that the
*note Context.clamp: 155c. 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.15.9.16 ftp
.............

*note ftplib.FTP: cce. クラスがコンテキスト管理プロトコルをサポートする
ようになりました。with ブロックを抜ける際に無条件に FTP 接続をクローズし
ます (クローズ処理で発生する *note socket.error: 140c. は無視されます)。
:

     >>> 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: 247. や *note fileinput.input(): bdd. のような
ほかのファイルライクなオブジェクトも自動クローズするコンテキスト管理プロ
トコルをサポートするようになっていたりします:

     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: ccf. クラスが 'context' パラメータを受け取れるようになり
ました。これには *note ssl.SSLContext: 33e. オブジェクトを渡します。これ
は 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.15.9.17 popen
...............

*note os.popen(): 58c. ならびに *note subprocess.Popen(): 6c5. 関数が自
動的にファイル記述子を閉じる *note with: 215. 文をサポートしました。

(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.15.9.18 select
................

The *note select: c9. module now exposes a new, constant attribute,
*note PIPE_BUF: 15c7, which gives the minimum number of bytes which are
guaranteed not to block when *note select.select(): 115d. 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<12>,  Prev: select<3>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.19 gzip と zipfile
.........................

*note gzip.GzipFile: 84f. が *note io.BufferedIOBase: a88. *note
抽象基底クラス: 1574. を継承しました (‘truncate()’ をのぞく)。 *note
peek(): 15c9. メソッドが追加され、シーク不能なファイルオブジェクトならび
にゼロ埋めされたファイルオブジェクトをサポートしました。

また、*note gzip: 6a. モジュールにより簡便でインメモリな圧縮および解凍を
行う *note compress(): a32. ならびに *note decompress(): 15ca. 関数が追
加されました。 圧縮や解凍の前に *note bytes: 1d2. としてエンコードしなけ
ればならない点に注意してください:

     >>> 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: 850. 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:
15cb. 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<12>,  Next: hashlib<8>,  Prev: gzip と zipfile,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.20 tarfile
.................

*note TarFile: 15cd. クラスは今ではコンテキストマネージャとして使えます
。加えて、その *note add(): fb7. メソッドに新しいオプション 'filter' が
追加されました。これはファイルをアーカイブに追加するかどうかを制御し、ま
た、ファイルのメタデータを編集するのにも使えます。

'filter' オプションは古くて柔軟性に欠ける 'exclude' パラメータを置き換え
るものであり、 'exclude' は非推奨となりました。 'filter' を指定する場合
は *note keyword argument: 10d0. として渡さなければなりません。ユーザ指
定の filter 関数は *note TarInfo: 15ce. オブジェクトを受け取り、更新した
‘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<8>,  Next: ast<9>,  Prev: tarfile<12>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.21 hashlib
.................

*note hashlib: 6b. モジュールに、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<9>,  Next: os<16>,  Prev: hashlib<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.22 ast
.............

*note ast: 9. モジュールには、Python リテラル構文を使った式文字列を安全
に評価できる、汎用目的の素晴らしい道具が含まれています。その *note
ast.literal_eval(): fdb. 関数は、悪用されやすい組み込み関数 *note
eval(): 18f. の安全な代替品として働いてくれます。Python 3.2 はこれのサポ
ート型に *note bytes: 1d2. と *note set: 432. を加えました。結果サポート
する型は全部でこれらになりました: 文字列型、バイト列文字列型、数値型、タ
プル型、リスト型、辞書型、集合型、真偽値型、‘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<16>,  Next: shutil<9>,  Prev: ast<9>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.23 os
............

ファイル名と環境変数に使われるエンコーディングは OS ごとに様々です。
*note os: a5. モジュールは新たに 2 つの関数 *note fsencode(): 1017. と
*note fsdecode(): 1016. を追加しました。それぞれファイル名のエンコード、
デコードを行います:

     >>> 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: 15d2. constant
will be true.

エンコードされた環境変数への直接アクセス (可能な場合) には、新規関数
*note os.getenvb(): 15d3. または *note os.environb: 4ed. を使ってくださ
い。これは *note os.environ: 4ec. のバイト列バージョンです。

(Contributed by Victor Stinner.)


File: python.info,  Node: shutil<9>,  Next: sqlite3<13>,  Prev: os<16>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.24 shutil
................

*note shutil.copytree(): df1. 関数に新たに 2 つのオプションが追加されま
した:

   * 'ignore_dangling_symlinks': ‘symlinks=False’ とするとこの関数は、フ
     ァイルがシンボリックリンクだった場合にリンクそのものではなくそれが
     指しているファイルをコピーします。 'ignore_dangling_symlinks' を真
     にすると、そのファイルが存在しない場合のエラーを無視します。

   * 'copy_function': これはファイルをコピーするのに使われる呼び出し可能
     オブジェクトです。デフォルトでは *note shutil.copy2(): e23. が使わ
     れます。

(Contributed by Tarek Ziadé.)

これらに加え、 *note shutil: cd. モジュールは ZIP ファイル、未圧縮の tar
ファイル、gzip 圧縮の tar、 bzip 圧縮の tar のための *note archiving
operations: 15d5. を新たにサポートします。また、追加のアーカイブファイル
フォーマットを登録する関数もあります (例えば xz 圧縮の tar やカスタムフ
ォーマット)。

そのメインとなるのが *note make_archive(): 8c8. と *note
unpack_archive(): 887. です。デフォルトではカレントディレクトリ (*note
os.chdir(): a07. で変えれます) とそのサブディレクトリの両方を処理します
。アーカイブファイル名はフルパス名で指定しなければなりません(訳注: これ
の真偽不明。リファレンスに対応する記述なし)。アーカイブするステップは非
破壊的です (つまりオリジナルのファイルは変更されずにそのままにされます
)。

     >>> 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<13>,  Next: html<3>,  Prev: shutil<9>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.25 sqlite3
.................

*note sqlite3: d7. モジュールが 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(): c1b. メソッドと
     *note sqlite3.Connection.load_extension(): 8cd. メソッドにより
     ".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<13>,  Prev: sqlite3<13>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.26 html
..............

ただ一つの関数 *note escape(): 13bc. が提供される、新しい *note html:
6e. モジュールが導入されました。これは HTML マークアップから予約されてい
る文字をエスケープするのに使います:

     >>> import html
     >>> html.escape('x > 2 && x < 7')
     'x &gt; 2 &amp;&amp; x &lt; 7'


File: python.info,  Node: socket<13>,  Next: ssl<14>,  Prev: html<3>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.27 socket
................

*note socket: d4. モジュールに新たに二つの改善がありました。

   * Socket objects now have a *note detach(): 15d9. 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(): a67. がコンテキスト管理プロトコル
     をサポートするようになりました。with ブロックを抜ける際に無条件にソ
     ケットをクローズします (クローズ処理で発生する *note socket.error:
     140c. は無視されます)。 (Contributed by Giampaolo Rodolà;
     bpo-9794(2).)  (--訳注: リファレンスもそうなのですが、「
     ‘socket.create_connection()’ が with をサポート」というのは実態とは
     違うんじゃないかと思います(この関数のユーザからは同じにみえたとして
     も)。実際には *note socket.socket: 115e. がコンテキストマネージャを
     サポートしています。 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<14>,  Next: nntp,  Prev: socket<13>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.28 ssl
.............

*note ssl: d8. モジュールは、セキュアな (暗号化され、認証された) インタ
ーネット接続のために共通の要求を満足するための数多くの機能を追加していま
す:

   * 新規クラス *note SSLContext: 33e. は、プロトコル設定や証明書、秘密
     鍵やそのた色々なオプションのような、永続的 SSL データの容器として働
     きます。その中のメソッド *note wrap_socket(): 938. を使うと、 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(): 938. 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: d8. モジュールは
     TLS プロトコルに対する Server Name Indication 拡張 (訳注: SNI, RFC
     4366(3)) をサポートします。これは単一の IP ポートで異なった証明書を
     使った複数「バーチャルホスト」をもたらすものです。この拡張はクライ
     アントモードでのみサポートされ、 *note
     ssl.SSLContext.wrap_socket(): 938. の 'server_hostname' を渡すこと
     で活性化されます。

   * *note ssl: d8. モジュールに色々オプションが追加されました。例えば
     *note OP_NO_SSLv2: c16. は安全でなく時代遅れの SSLv2 を無効にします
     。

   * 拡張はOpenSSL の全ての暗号とメッセージダイジェストアルゴリズムをロ
     ードします。SSL 証明書の中に検証できないものがある場合、"unknown
     algorithm" エラーを報告します。

   * The version of OpenSSL being used is now accessible using the
     module attributes *note ssl.OPENSSL_VERSION: 15db. (a string),
     *note ssl.OPENSSL_VERSION_INFO: 15dc. (a 5-tuple), and *note
     ssl.OPENSSL_VERSION_NUMBER: 15dd. (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<14>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.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.15.9.30 certificates
......................

*note http.client.HTTPSConnection: 22f, *note
urllib.request.HTTPSHandler: 15e0. *note urllib.request.urlopen(): 586.
はサーバ証明書を証明書認証局 (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<5>,  Prev: certificates,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.31 imaplib
.................

標準 IMAP4 接続での明示的な TLS 使用を新規メソッド *note
imaplib.IMAP4.starttls: 15e2. で出来るようになりました。

(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<5>,  Next: unittest<13>,  Prev: imaplib<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.32 http.client
.....................

*note http.client: 72. モジュールに数多くの小さな API 改善がなされていま
す。旧式 HTTP 0.9 の単純な応答 (HTTP 0.9 simple responses) はもうサポー
トされず、また、 'strict' パラメータは全てのクラスで非推奨となりました。

*note HTTPConnection: 22e. クラスと *note HTTPSConnection: 22f. クラスが
'source_address' パラメータを取るようになりました。これには HTTP(S) 接続
の接続元を表す (host, port) のタプルを渡します。

*note HTTPSConnection: 22f. に、証明書検証と HTTPS バーチャルホストのサ
ポートが追加されました。

接続オブジェクトの *note request(): 106e. メソッドのオプショナルな
'body' 引数には、リクエストのコンテンツを与えるために *note file object:
1581. を渡すことが出来ました。便利のためにこれに *note iterable: 149a. も
渡すことが出来るようになりました。ただしこの場合は明示的に
‘Content-Length’ ヘッダを加えなければなりません。この拡張されたインター
フェイスは以前よりも遥かに柔軟です。

プロキシサーバ経由で HTTPS 接続を確立するために、新規メソッド *note
set_tunnel(): 15e4. が追加されています。これにより HTTP 接続トンネリング
のためのホストとポートをセットします。

*note http.server: 75. の振る舞いと合わせ、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<13>,  Next: random<5>,  Prev: http client<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.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: 536. class can now be instantiated without
     arguments:

          >>> from unittest import TestCase
          >>> TestCase().assertEqual(pow(2, 3), 8)

     (Contributed by Michael Foord.)

   * *note unittest: 10f. モジュールは 2 つの新メソッド *note
     assertWarns(): 2ab. と *note assertWarnsRegex(): 2ac. を持ちます。
     これらはテストのもとでコードによって所与の警告が発行されるかどうか
     を検証します:

          with self.assertWarns(DeprecationWarning):
              legacy_function('XYZ')

     (Contributed by Antoine Pitrou, bpo-9754(2).)

     もう一つの新メソッド *note assertCountEqual(): 15e6. は 2 つのイテ
     ラブルを比較して、要素の出現回数が同じか (順序に関わらず同じ要素が
     同じ数だけ出現するかどうか) をテストします:

          def test_anagram(self):
              self.assertCountEqual('algorithm', 'logarithm')

     (Contributed by Raymond Hettinger.)

   * unittest モジュールの大事な特長は、テスト失敗時の有意義な診断を生成
     するよう腐心してくれることです。可能ならば失敗は期待値と実際の出力
     との差分と一緒に記録されます。これは失敗したテスト実行の解析に特に
     役に立ちますが、差分は時々とてつもなく大きくもなりますので、新たに
     追加した属性 *note maxDiff: 15e7. に差分の最大長をセットすることで
     表示を制御できるようになりました。

   * さらにモジュールのメソッド名に数多くのクリーンアップを行いました。

     For example, *note assertRegex(): 941. is the new name for
     ‘assertRegexpMatches()’ which was misnamed because the test uses
     *note re.search(): 15e8, not *note re.match(): 258.  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: c1. module, and it has unambiguous camel-casing.

     (Contributed by Raymond Hettinger and implemented by Ezio Melotti.)

   * 一貫性を向上させるために、長年使用されたメソッドエイリアスが推奨名
     に対し非推奨になりました:

          以前の名前                          推奨名
                                              
          -----------------------------------------------------------------------
                                              
          ‘assert_()’                         *note assertTrue(): 93a.
                                              
                                              
          ‘assertEquals()’                    *note assertEqual(): 93c.
                                              
                                              
          ‘assertNotEquals()’                 *note assertNotEqual(): 93d.
                                              
                                              
          ‘assertAlmostEquals()’              *note assertAlmostEqual(): 93e.
                                              
                                              
          ‘assertNotAlmostEquals()’           *note assertNotAlmostEqual(): 93f.
                                              

     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<13>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.34 random
................

*note random: c0. モジュールの整数メソッドの一様分布の生成が改善されまし
た。 以前は ‘int(n*random())’ を計算していました。 この方法では 'n' が
2の冪乗でない限り僅かにバイアスがあります。 現在の方法では次の2の冪乗の
範囲まで複数の選択肢を作成し、‘0 <= x < n’ の範囲に入ったもののみを保持
します。 影響を受ける関数やメソッドは *note randrange(): c45.、*note
randint(): 15ea.、*note choice(): 15eb.、*note shuffle(): b31. ならびに
*note sample(): b30. です。

(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.15.9.35 poplib
................

*note POP3_SSL: cf5. クラスが 'context' パラメータを受け取れるようになり
ました。これには *note ssl.SSLContext: 33e. オブジェクトを渡します。これ
は 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.15.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<12>,  Prev: asyncore<2>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.37 tempfile
..................

*note tempfile: e9. モジュールに新たなコンテキストマネージャ *note
TemporaryDirectory: 15ef. が追加されました。一時ディレクトリの確実な後片
付けを容易に行えます:

     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<12>,  Next: pydoc<7>,  Prev: tempfile<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.38 inspect
.................

   * *note inspect: 81. モジュールに新たな関数 *note
     getgeneratorstate(): 15f1. が追加されました。これで簡単にジェネレー
     タイテレータの現在状態を識別出来ます (--訳注: generator-iterator と
     いう用語を使っている箇所は Python ドキュメント全体通して多くはない
     のですが 2.x の *note yield 文: d97. 説明中に登場します。ジェネレー
     タと同じ意味です。なお 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: 81. モジュールに *note getattr_static(): 8aa. 関数が
     追加されました。 *note hasattr(): 8e7. とは違ってこれは本当に読み出
     しのみの検索であり、検索中に状態変更しないことが保障されています:

          >>> 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<12>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.39 pydoc
...............

The *note pydoc: bd. 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<8>,  Prev: pydoc<7>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.40 dis
.............

*note dis: 3b. モジュールに、コードを調べるための 2 つの新しい関数 *note
code_info(): 15f4. と *note show_code(): 12dd. が追加されました。ともに
、与えられた関数、メソッド、ソースコード文字列、コードオブジェクトについ
ての詳細なコードオブジェクト情報を提供します。前者はそれを文字列で返し、
後者は印字します:

     >>> 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(): 49d. 関数が文字列引数を取れるようになり、これによっ
て、よくあるイディオム ‘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<8>,  Next: ctypes<5>,  Prev: dis<6>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.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<5>,  Next: site<4>,  Prev: dbm<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.42 ctypes
................

C ‘ssize_t’ データ型を表現する新たな型 *note ctypes.c_ssize_t: 15f7. が
追加されました。


File: python.info,  Node: site<4>,  Next: sysconfig<6>,  Prev: ctypes<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.43 site
..............

*note site: cf. モジュールに、Python インストレーションの詳細を報告する
のに有益な3つの新たな関数が追加されました。

   * *note getsitepackages(): 15f9. は全てのグローバルな site-packages デ
     ィレクトリを一覧します。

   * *note getuserbase(): 15fa. は、ユーザのデータを格納できるベースディ
     レクトリを報告します。

   * *note getusersitepackages(): 15fb. はユーザ固有の 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<6>,  Next: pdb<11>,  Prev: site<4>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.44 sysconfig
...................

新しい *note sysconfig: e4. モジュールは、プラットフォームやインストレー
ションごとに変わるインストールパスや環境設定変数への、直接的なアクセスを
提供します。

このモジュールはプラットフォームとバージョンの情報へのシンプルなアクセス
関数を持っています:

   * *note get_platform(): 15fd. は 'linux-i586' や 'macosx-10.6-ppc' と
     いった値を返します。

   * *note get_python_version(): 15fe. は 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(): 160. は現在のインストールスキームに関するインス
     トールパスを含むディレクトリ名を作ります。

   * *note get_config_vars(): 525. はプラットフォーム依存変数の辞書を返
     します。

便利なコマンドラインインターフェースもあります:

     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<11>,  Next: configparser<6>,  Prev: sysconfig<6>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.45 pdb
.............

*note pdb: aa. デバッガモジュールに数多くのユーザビリティの改善がなされ
ました:

   * ‘pdb.py’ は ‘-c’ オプションで指定した ‘.pdbrc’ スクリプトファイルを
     実行できるようになっています。

   * ‘.pdbrc’ スクリプトファイルにはデバッグを継続する ‘continue’ コマン
     ドと ‘next’ コマンドを含むことができます。

   * The *note Pdb: 502. 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<7>,  Prev: pdb<11>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.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: 6ea.  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: b10. が含まれています:

     >>> 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<7>,  Next: mailbox,  Prev: configparser<6>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.47 urllib.parse
......................

数多くのユーザビリティーの改善が *note urllib.parse: 113. モジュールにな
されました。

*note urlparse(): 2af. 関数が 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(): 2b0. 関数は、今や *note named tuple: a42. を返します:

     >>> 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(): 1249. 関数はさらに柔軟になり、 'query' 引数と
しては文字列とバイト列のどちらも受け付けます。文字列で渡した場合、パラメ
ータ 'safe', 'encoding', 'error' がエンコードのために *note
quote_plus(): 1602. に送られます:

     >>> urllib.parse.urlencode([
     ...      ('type', 'telenovela'),
     ...      ('name', '¿Dónde Está Elisa?')],
     ...      encoding='latin-1')
     'type=telenovela&name=%BFD%F3nde+Est%E1+Elisa%3F'

*note ASCII エンコードバイト列の解析: 1603. に詳細に書きましたが、全ての
*note urllib.parse: 113. 関数は今では 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<7>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.15.9.48 mailbox
.................

Thanks to a concerted effort by R. David Murray, the *note mailbox: 8e.
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: 1d2. because various parts of a
message may have different encodings.

解決のためには任意の email メッセージをパースするために、 *note email:
3e. パッケージのバイナリサポートが利用されました (--訳注: *note
BytesGenerator: 158d. や *note message_from_bytes(): 1587. など)。また、
API の変更も必要となりました。

*note mailbox.Mailbox: 1605. オブジェクトの *note add(): 1606. メソッド
は、今や期待通りにバイナリ入力を受け付けます。

*note StringIO: 12d8. とテキストファイルでの入力は非推奨となりました。ま
た、文字列での入力は、非 ASCII 文字が使用されていると早々に失敗します。
以前は後のほうのステップで email が処理される際にようやく失敗していまし
た。

バイナリ出力のサポートもあります。 *note get_file(): 1607. メソッドは今
ではバイナリモードのファイルを返します (これまでは不適切にテキストモード
が使われていました)。また、新しい *note get_bytes(): 1608. メソッドは、
指定した 'key' に対応するメッセージの *note bytes: 1d2. 表現を返します。

今でも古い API の *note get_string(): 1609. を使って非バイナリ出力は可能
ですが、そのアプローチはあまり役に立ちません。そうではなく *note
Message: 160a. オブジェクトからメッセージを抽出するか、それらをバイナリ
入力からロードするのが最善です。

(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.15.9.49 turtledemo
....................

The demonstration code for the *note turtle: 10a. 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: 19f, 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.15.10 マルチスレッディング
----------------------------

   * The mechanism for serializing execution of concurrently running
     Python threads (generally known as the *note GIL: 418. 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(): d1a.
     It currently defaults to 5 milliseconds.

     この実装に関するさらなる詳細は python-dev mailing-list message(1) で
     読むことが出来ます (ただしこのメッセージで言っている "priority
     requests" は含められませんでした)。

     (Contributed by Antoine Pitrou.)

   * 通常のロックと再帰的なロックが、*note acquire(): a8c. メソッドでオ
     プションで 'timeout' 引数を受け取るようになりました。 (Contributed
     by Antoine Pitrou; bpo-7316(2).)

   * 同様に、*note threading.Semaphore.acquire(): 160d. にも '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.15.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: 432. as a *note frozenset: 9d9.
     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(): f91. and *note
     sorted(): f90. now runs faster and uses less memory when called
     with a *note key function: 11be.  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(): 2eb. 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(): 125e, *note rsplit(): 160f, *note splitlines(): 1610. and
     *note replace(): 6c6. methods on *note bytes: 1d2, *note bytearray:
     1d1. and *note str: 1ea. objects.  Likewise, the algorithm is also
     used by *note rfind(): 125d, *note rindex(): 1611, ‘rsplit()’ and
     *note rpartition(): 1612.

     (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: 231. has more efficient buffering (bpo-3709(14)
by Andrew Schaaf).  The *note operator.attrgetter(): 11ea. function has
been sped-up (bpo-10160(15) by Christos Georgiou).  And *note
ConfigParser: 6ea. 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.15.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.15.13 Codecs
--------------

'cp720' アラビア DOS エンコードがサポートされました (bpo-1616979(1))。

MBCS エンコーディングはもうエラーハンドラ引数を無視することはありません
。デフォルトの strict モードでは、デコード出来ないバイト列に対して *note
UnicodeDecodeError: ddb. を、エンコードできない文字に対して *note
UnicodeEncodeError: a6c. を投げます。

MBCS コーデックはエラーハンドラとして、デコードでの ‘'strict'’ と
‘'ignore'’ 、エンコードでの ‘'strict'’ と ‘'replace'’ をサポートします。

Python 3.1 での MBCS エンコーディングを模擬したければデコードでは
‘'ignore'’ ハンドラを、エンコードでは ‘'replace'’ ハンドラを選んでくださ
い。

Mac OS X では Python は、コマンドライン引数をロケールのエンコーディング
ではなく ‘'utf-8'’ でデコードします。

*note tarfile: e7. はデフォルトで、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.15.14 ドキュメント
--------------------

ドキュメントの改善が引き続き行われています。

   * *note 組み込み関数: 1616. のような長大なセクションには先頭にクイッ
     クリンクの表が追加されました。 *note itertools: 84. のようなケース
     では cheatsheet(1) スタイルの表からリンクが張られていて、これで要約
     がわかりますし、ドキュメント全体を読む必要なく記憶を呼び覚ますこと
     が出来ます。

   * ある種のケースではピュア Python のソースコードが文書化の助手として
     便利に働いてくれますので、今では多くのモジュールがソースコードの最
     新バージョンへのクイックリンクを客演させています。例えば *note
     functools: 62. モジュールのドキュメントは先頭にこのようにクイックリ
     ンクを置いています:

          'ソースコード' Lib/functools.py(2).

     (Contributed by Raymond Hettinger; see rationale(3).)

   * ドキュメントには今ではもっと実例とレシピが含まれています。特に
     *note re: c1. モジュールのものには大掛かりなセクション *note
     Regular expression examples: 1617. があります。同じように *note
     itertools: 84. では新しい *note Itertools レシピ: 1618. で更新され
     続けます。

   * *note datetime: 33. モジュールは今ではピュア 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/main/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.15.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.15.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.15.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(): 161c. が正しい値を返し、 *note repr(): 462.
     はより多くの文字を表示可能と考えるようになりました。

     (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: 161d. を使うようになりま
     した。これはポインタと同じサイズになるように定義されています。以前
     は long 型を使っていましたが、これはいくつかの 64 ビット OS でも 32
     ビット長のままでした。この修正の結果、64 ビットポインタでビルドすれ
     ば *note set: 432. と *note dict: 193. が ‘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: 161e. without also modifying
     *note sys.path: 19f. (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(): 161f. の姉妹品の *note
     PyLong_AsLongLongAndOverflow(): 1620. 関数が追加されました。両方と
     も Python *note int: 32e. を C ネイティブの固定幅型に変換しますが、
     変換が幅に合わないことを検出します (bpo-7767(9))。

   * *note PyUnicode_CompareWithASCIIString(): 1621. 関数が、Python 文字
     列が 'NUL' 終端である場合に「 '等しくない' 」を返すようになりました
     。

   * 新しい関数 *note PyErr_NewExceptionWithDoc(): 1622. は *note
     PyErr_NewException(): 1623. と似ていますが、ドキュメンテーション文
     字列を受け付けます。これは 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.15.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(): 1625. と
          *note set(): 1626. の操作で検証されます。デフォルトの補間スキ
          ームでは、パーセント記号を使ったただ二つのトークンのみが正当で
          す: ‘%(name)s’ と ‘%%’ 、後者はエスケープされたパーセント記号
          自身。

        * *note set(): 1626. メソッドと *note add_section(): 1627. メソ
          ッドは今ではその値が実際に文字列かどうかを検証します。以前はサ
          ポートされない型が意図せず持ち込まれる可能性がありました。

        * 単一ソースからのセクションまたはオプションの複製 (重複) に対し
          、今では *note DuplicateSectionError: 1628. もしくは *note
          DuplicateOptionError: 1629. を投げます。以前は重複は黙って以前
          のエントリを上書きしていました。

        * インラインコメントは今ではデフォルトで無効なので、 ';' 文字を
          安全に値のなかで使えます。

        * コメントを字下げ出来るようになっています。このことにより、値が
          継続行となる場合の後続行の字下げ開始位置に ';' または '#' を置
          くには、補間を使う必要があります。こうすればコメントのプレフィ
          クス文字が値内に現れて誤ってコメントと解釈されるのを防げます。

        * ‘""’ は今では合法な値なので、もはや自動的に空文字列に変換され
          ることはありません。空文字列のためには行内で ‘"option ="’ と書
          いてください。

   * The ‘nntplib’ module was reworked extensively, meaning that its
     APIs are often incompatible with the 3.1 APIs.

   * *note bytearray: 1d1. オブジェクトはもうファイル名には使えません。
     代わりに *note bytes: 1d2. に変換しなければいけません。

   * The ‘array.tostring()’ and ‘array.fromstring()’ have been renamed
     to *note array.tobytes(): 162a. and *note array.frombytes(): 162b.
     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: 162c. 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(): 162d. 関数とメソッドが、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():
     162e. and *note bytearray.maketrans(): 162f.  This change solves
     the confusion around which types were supported by the *note
     string: db. module.  Now, *note str: 1ea, *note bytes: 1d2, and
     *note bytearray: 1d1. 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: 215. 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(): 1630. は、文字列パックコード ‘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: 12e. クラスが *note
     xml.etree.ElementTree.ParseError: 1631. を投げるようになりました。
     以前は *note xml.parsers.expat.ExpatError: 1632. を投げていました。

   * 浮動小数点数と複素数に対する *note str(): 1ea. が以前より長い表現を
     するようになったことで、古いフォーマットに依存する doctest は壊れる
     かもしれません。

   * *note subprocess.Popen: 6c5. の 'close_fds' のデフォルトが、Unix で
     は ‘True’ になりました。Windows では 3 つの標準ストリームに ‘None’
     がセットされている場合には ‘True’ 、以外の場合は ‘False’ になりまし
     た。以前は 'close_fds' のデフォルトはいつでも ‘False’ でした。これ
     は開いているファイル記述子が子プロセスに漏れた場合に解決が難しいバ
     グや競合状態を生み出していました。

   * レガシーな HTTP 0.9 のサポートが *note urllib.request: 114. と
     *note http.client: 72. から削除されました。このサポートはサーバサイ
     ドではまだ健在です (*note http.server: 75. 内)。

     (Contributed by Antoine Pitrou, bpo-10711(5).)

   * タイムアウトモード時の SSL ソケットでタイムアウトした場合に、汎用の
     *note SSLError: 1633. ではなく *note socket.timeout: c11. を投げる
     ようになりました。

     (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(): 83e.
     and *note PyEval_RestoreThread(): 83f.) 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: 418. implementation,
     ‘PyEval_InitThreads()’ cannot be called before *note
     Py_Initialize(): 67a. 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.16 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.16.1 PEP 372: 順序付き辞書
----------------------------

通常の Python 辞書は、 key/value ペアを不定の順序でイテレートします。何
年にもわたり、いろいろな人が key の挿入順を保存する辞書の別実装を書いて
きました。その経験に基づき、新しい *note OrderedDict: 9da. クラスが導入
されました。

OrderedDict API は通常の辞書と同じインターフェースを提供していますが、
key/value をイテレートするときに key が最初に挿入された順番になることが
保証されています。新しいエントリが既存のエントリを上書きした場合は、元の
挿入順序が保持されます。エントリを削除して再挿入すると、順序は一番最後に
移動します。

標準ライブラリのいくつかのモジュールで、順序付き辞書の利用がサポートされ
ています。*note configparser: 26. モジュールはデフォルトで順序付き辞書を
使います。設定ファイルを読み込み、編集した後、元の順序で書きなおすことが
できます。*note collections.namedtuple(): 1da. の '_asdict()' メソッドは
、タプルの順序と同じ順序の順序付き辞書を返すようになりました。*note
json: 85. モジュールのデコーダーが OrderedDict をビルドするのをサポート
するために、 *note JSONDecoder: 1101. クラスのコンストラクタに
'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.16.2 PEP 378: 1000区切りのための書式指定子
--------------------------------------------

組み込みの *note format(): 440. 関数と *note str.format(): a17. メソッド
が使うミニ言語に、単純でロケールに依存しない 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: 32e, *note float: 32f, *note complex:
330. , *note decimal.Decimal: 1cd. です。

ドットやら空白やらアポストロフィやらあるいはアンダースコアなどの他のセパ
レータをどうやって指定するかの議論は水面下にありますが、ロケールに従う必
要があるアプリケーションは、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.16.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(): 32e. 型に ‘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(): 440. 文字列のフィールドに自動的に番号が振られるよう
     になりました:

          >>> '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(): 162e. and *note
     bytearray.maketrans(): 162f.  This change solves the confusion
     around which types were supported by the *note string: db. module.
     Now, *note str: 1ea, *note bytes: 1d2, and *note bytearray: 1d1.
     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: 215. 文のシンタックスは一つの文で複数のコンテキストマネ
     ージャを使えるようになりました:

          >>> 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.16.4 新たなモジュール、改良されたモジュール、非推奨のモジュール
-----------------------------------------------------------------

   * シーケンスまたはイテラブル内にある一意な要素を数え上げるのに便利な
     *note collections.Counter: 20f. クラスが追加されました:

          >>> 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: 102. モジュールが追加されました。 ‘tkinter.ttk’ の基本
     的なアイディアは、拡張可能性のためにウィジェットの動作を実装するコ
     ードと見た目を記述するコードを分離することです。

     (Contributed by Guilherme Polo; bpo-2983(2).)

   * *note gzip.GzipFile: 84f. と *note bz2.BZ2File: c41. クラスはコンテ
     キストマネジメントプロトコルをサポートするようになりました:

          >>> # Automatically close file after writing
          >>> with gzip.GzipFile(filename, "wb") as f:
          ...     f.write(b"xxx")

     (Contributed by Antoine Pitrou.)

   * *note decimal: 39. モジュールが二進 *note float: 32f. から decimal
     オブジェクトを生成するメソッドをサポートしました。 変換は正確ですが
     時に意外なことがあります:

          >>> Decimal.from_float(1.1)
          Decimal('1.100000000000000088817841970012523233890533447265625')

     長い十進の結果が、 '1.1' を記憶するための現実の二進での端数を表して
     います。 '1.1' は二進数で正確に表現出来ないので、端数は十進表現でと
     ても多くの桁数になっています。

     (Contributed by Raymond Hettinger and Mark Dickinson.)

   * *note itertools: 84. に 2 つの関数が追加されました。 *note
     itertools.combinations_with_replacement(): 163b. 関数は、置換 (順列
     , permutation) や直積 (Cartesian product) を含む組合せ論の 4 つの生
     成関数のうちの 1 つです。 *note itertools.compress(): 163c. 関数は
     APL(3) の同名機能の模倣品です。また、既存の *note
     itertools.count(): 163d. 関数は新たにオプショナルな 'step' 引数を取
     るようになり、そして数え方に *note fractions.Fraction: 1ce. や
     *note decimal.Decimal: 1cd. を含む任意の数値型を使えるようになりま
     した。

          >>> [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(): 1da. が新たにキーワード引数
     '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(): 7a7.、*note re.subn(): 7a8. および *note
     re.split(): 7a6. 関数は flags 引数を受け取るようになりました。

     (Contributed by Gregory Smith.)

   * logging を自身では使わずとも使用ライブラリがそうしているようなアプ
     リケーションのために、 *note logging: 8a. モジュールが単純な *note
     logging.NullHandler: 163e. を実装しました。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: c6. が
     パッケージの実行をサポートするようになりました。パッケージ名が与え
     られると ‘__main__’ サブモジュールを探し出して実行します。

     (Contributed by Andi Vajda; bpo-4195(6).)

   * *note pdb: aa. モジュールが *note zipimport: 13b. (あるいはなにかほ
     かの PEP 302(7) 準拠ローダ) でロードされたモジュールのソースコード
     にアクセスでき、表示できるようになりました。

     (Contributed by Alexander Belopolsky; bpo-4201(8).)

   * *note functools.partial: 4ad. オブジェクトが pickle 化出来るように
     なりました。

     (Suggested by Antoine Pitrou and Jesse Noller.  Implemented by Jack
     Diederich; bpo-5228(9).)

   * シンボルのための *note pydoc: bd. ヘルプトピックが追加されました。
     これで対話環境で ‘help('@')’ などが期待通りの働きをします (--訳注:
     実装としては pydoc_data パッケージのこと。 ‘pydoc_data/topics.py’ に
     docstring からは生成出来ない、シンボルについてのドキュメントが収め
     られています --)。

     (Contributed by David Laban; bpo-4739(10).)

   * *note unittest: 10f. に特定のテストメソッドやテストクラス全体をスキ
     ップする仕組みのサポートが追加されました。さらに、この機能はテスト
     結果を「意図的な失敗」とすることができ、テストが失敗しても
     ‘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: 215. 文で使えるコンテキス
     トマネージャとして増強されました:

          def test_division_by_zero(self):
              with self.assertRaises(ZeroDivisionError):
                  x / 0

     In addition, several new assertion methods were added including
     *note assertSetEqual(): 163f, *note assertDictEqual(): 1640,
     ‘assertDictContainsSubset()’, *note assertListEqual(): 1641, *note
     assertTupleEqual(): 1642, *note assertSequenceEqual(): 1643, *note
     assertRaisesRegexp(): 942, *note assertIsNone(): 1644, and *note
     assertIsNotNone(): 1645.

     (Contributed by Benjamin Peterson and Antoine Pitrou.)

   * The *note io: 82. module has three new constants for the *note
     seek(): 1646. method: *note SEEK_SET: 1647, *note SEEK_CUR: 1648,
     and *note SEEK_END: 1649.

   * *note sys.version_info: 308. タプルが名前付きタプルになりました。

          >>> 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: 77. 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: 7a. が追加されました。 *note
     import: 9df. 文とその相棒の *note __import__(): caa. 関数の、完全で
     移植性が高いピュア 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.16.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: 85. 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: 1ea, not with *note bytes: 1d2.
     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.16.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.16.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: 164d. が追加されましたが、これにより数字あた
     りのビット数と各数字の格納に使われる 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(): 164e. 関数は負の 'pylong' に対し
     *note TypeError: 29c. ではなく *note OverflowError: c5b. を送出する
     ようになりました。

     (Contributed by Mark Dickinson and Lisandro Dalcrin; bpo-5175(2).)

   * ‘PyNumber_Int()’ が非推奨になりました。代わりに *note
     PyNumber_Long(): e30. を使用してください。

     (Contributed by Mark Dickinson; bpo-4910(3).)

   * 非推奨の関数 ‘PyOS_ascii_strtod()’ および ‘PyOS_ascii_atof()’ を置
     き換えるために新しく *note PyOS_string_to_double(): 164f. 関数が追
     加されました。

     (Contributed by Mark Dickinson; bpo-5914(4).)

   * ‘PyCObject’ API を置き換えるものとして、 *note PyCapsule: 162c. が
     追加されました。主な違いとしては、新しい型は、型安全に情報を渡すた
     めの良く定義されたインターフェースを持ち、また、デストラクタの呼び
     出しのシグネチャの複雑さが小さくなっています。古い型は問題のある
     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.16.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.17 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.17.1 よくある悩みの種
-----------------------

このセクションは Python 2.5 に慣れていたら躓いてしまいそうな少数の変更の
一覧です。

* Menu:

* print関数::
* リストからビューおよびイテレータへ::
* 順序比較::
* 整数::
* Unicode 対 8 ビット、ではなく、テキスト対データに::


File: python.info,  Node: print関数,  Next: リストからビューおよびイテレータへ,  Up: よくある悩みの種

1.17.1.1 print関数
..................

‘print’ 文は *note print(): 1324. 関数に置き換えられ、古い ‘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(): 1324. 関数は、古い ‘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(): 1324. 関数呼び出しに自動的に置換されるので、大きなプロジェ
     クトでもさほど問題にならないでしょう。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3105/


File: python.info,  Node: リストからビューおよびイテレータへ,  Next: 順序比較,  Prev: print関数,  Up: よくある悩みの種

1.17.1.2 リストからビューおよびイテレータへ
...........................................

いくつかの良く使われている API はもはやリストを返しません:

   * *note dict: 193. の *note dict.keys(): bb1, *note dict.items():
     bb3. そして *note dict.values(): bb2. メソッドはリストの代わりに
     "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(): 445. と *note filter(): c3f. はイテレータを返します。
     もしも本物のリストが必要で、全ての入力シーケンスが同じ長さの場合で
     あれば、簡単に直すなら ‘map()’ を *note list(): 4e0. で包みます。例
     えば ‘list(map(...))’ という具合。ですがより良いのは、大抵はリスト
     内包を使うことです (特に元々のコードが *note lambda: 1657. を使って
     いる場合)。あるいはコードを、リストを全く必要としないように書き換え
     ましょう。とりわけトリッキーなのは、関数に副作用を起こさせるために
     呼び出される ‘map()’ です; この場合確実な変換は普通に *note for:
     329. ループを使うことです (そもそもリストを作ること自体が無駄遣いで
     しょう)。

     入力シーケンスの長さが同じとは限らないならば、 *note map(): 445. は
     最も短いシーケンスが消費されつくすと処理をやめます。Python 2.x での
     ‘map()’ 用法と全く互換にするにはシーケンスを *note
     itertools.zip_longest(): 1658. で包んでください。例えば ‘map(func,
     *sequences)’ を ‘list(map(func,
     itertools.zip_longest(*sequences)))’ とします。

   * *note range(): d13. now behaves like ‘xrange()’ used to behave,
     except it works with values of arbitrary size.  The latter no
     longer exists.

   * *note zip(): 446. はイテレータを返します。


File: python.info,  Node: 順序比較,  Next: 整数,  Prev: リストからビューおよびイテレータへ,  Up: よくある悩みの種

1.17.1.3 順序比較
.................

Python 3.0 で順序比較のルールが簡単になりました。

   * 順序比較演算子 (‘<’, ‘<=’, ‘>=’, ‘>’) は、そのオペランドが自然な順
     序づけを持たない場合 TypeError 例外を送出します。 ‘1 < ''’, ‘0 >
     None’ または ‘len <= len’ のような式は無効になり、 ‘None < None’ は
     ‘False’ を返す代わりに *note TypeError: 29c. を送出します。その結果
     、 不均一なリスト（訳注：比較不能な型からなる要素が混在するリスト）
     のソートは意味がなくなりました。 - 全ての要素は互いに比較できなけれ
     ばなりません。これは ‘==’ と ‘!=’ 演算子には適用されないことに注意
     してください: 別々の比較不可能な型のオブジェクトを比較すると常に、
     互いに等しくないと評価されます。

   * *note sorted(): f90. and *note list.sort(): f91. 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__(): 165a.
     for sorting, *note __eq__(): ec4. with *note __hash__(): ec5, 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.17.1.4 整数
.............

   * PEP 237(1): Essentially, ‘long’ renamed to *note int: 32e.  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: 1583.
     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(): 462. はもはや末尾に ‘L’ を持ちません。そ
     のため、無条件に "L" を取り除くコードは代わりに最後の数字を取り除い
     てしまうでしょう。 (代わりに *note str(): 1ea. を使用してください。
     )

   * 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.17.1.5 Unicode 対 8 ビット、ではなく、テキスト対データに
..........................................................

バイナリと Unicode について知っていると思っている全てが変わりました。

   * Python 3.0 でのコンセプトは、Unicode 文字列と 8 ビット文字列、とい
     う対比ではなくて、 'テキスト' と (バイナリ) 'データ' の違いと考える
     、というものです。全てのテキストは Unicode です; 一方で 'エンコード
     された' Unicode はバイナリデータとして表現されます。テキストを保持
     するのに使われる型は *note str: 1ea. で、データには *note bytes:
     1d2. を使います。2.x での状況との最大の違いは、Python 3.0 でテキス
     トとデータを混ぜようとすれば *note TypeError: 29c. となることです。
     Python 2.x では Unicode と 8 ビット文字列を混ぜたとすれば、8 ビット
     文字列がたまたま 7 ビット (ASCII) バイトだけから出来ていれば動くし
     非 ASCII バイトがあれば *note UnicodeDecodeError: ddb. となっていた
     でしょう。この、データ値に依存した振る舞いが、何年にも渡って夥しい
     数の悲劇を生み出していました。

   * 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: 1ea. 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: 1ea. 型と *note bytes: 1d2. 型を混ぜて使うことは出来ませ
     んから、それらはいつでも明示的に変換しなければいけません。 ‘str’ か
     ら ‘bytes’ にするには *note str.encode(): cab. を使ってください。そ
     して ‘bytes’ から ‘str’ にするには *note bytes.decode(): cac. を使
     います。それぞれ ‘bytes(s, encoding=...)’ 、 ‘str(b, encoding=...)’
     を使うことも出来ます。

   * Like *note str: 1ea, the *note bytes: 1d2. type is immutable.
     There is a separate 'mutable' type to hold buffered binary data,
     *note bytearray: 1d1.  Nearly all APIs that accept ‘bytes’ also
     accept ‘bytearray’.  The mutable API is based on *note
     collections.MutableSequence: 6cc.

   * 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: 1ea. instead.  The ‘str’ and *note bytes: 1d2. 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(): 333. でのデフォルトのモード) は、 (メモリ内の) 文字列と (デ
     ィスクでの) バイト列との写像をするのに、常にエンコーディングを使い
     ます。バイナリファイル (モードに ‘b’ を付けて開いたもの) はメモリ内
     では常にバイト列を使います。このことで、もしもファイルが誤ったモー
     ドやエンコーディングで開かれようとすると、I/O はきっと口やかましく
     失敗します。こっそり正しくないデータを生み出すのではなく。それに加
     えて、ファイルを開く際には Unix ユーザでさえもこれからは、 (テキス
     トかバイナリかの) 正しいモードを選択する必要があるということです。
     プラットフォームにはそれ特有のデフォルトエンコーディングがあります
     。Unix 的プラットフォームではこれは環境変数 ‘LANG’ にセットされてい
     るかもしれません (あるいは時々ほかのプラットフォーム特有の、ロケー
     ルに関係した環境変数にもセットされています)。全てとは言いませんが多
     くの場合は、システムのデフォルトは UTF-8 です; ですが決してこのデフ
     ォルトを当てにすべきではありません。純粋な ASCII テキスト以上のもの
     を読み書きするどんなアプリケーションも、きっとエンコーディングをオ
     ーバライド出来る手段を持つべきです。 *note codecs: 1c. 内にあるエン
     コーディングを熟知したストリームを使うことは、今ではもう必要なくな
     りました。

   * *note sys.stdin: 94f, *note sys.stdout: ea0, *note sys.stderr: d09.
     の初期値はいまでは Unicode のみのテキストファイルです (つまりそれら
     は *note io.TextIOBase: a89. のインスタンスです)。バイト列データを
     それらのストリームで読み書きするには、 *note io.TextIOBase.buffer:
     165d. 属性を使う必要があります。

   * ファイル名は、API へは (Unicode) 文字列を渡し、 (Unicode) 文字列が
     返ります。これにはプラットフォーム特有の問題があるかもしれません。
     というのも、いくつかのプラットフォームではファイル名は任意のバイト
     文字列だからです。(他方では、Windows ではファイル名はネイティブに
     Unicode で格納されています。) 次善策として、ほとんどの API (たとえ
     ば *note open(): 333. と *note os: a5. モジュール内の多くの関数) は
     ファイル名として、文字列だけでなく *note bytes: 1d2. を受け付け、そ
     して少しの API は ‘bytes’ を返すかどうかを要求出来る手段を持ってい
     ます。それゆえに *note os.listdir(): 14bb. は引数が ‘bytes’ インス
     タンスであれば ‘bytes’ のリストで返し、 *note os.getcwdb(): e55. は
     カレントディレクトリを ‘bytes’ で返します。 ‘os.listdir()’ が文字列
     のリストで返す際、適切にデコード出来ないファイル名は *note
     UnicodeError: 67c. とはせずに無視されることにご注意ください。

   * *note os.environ: 4ec. や *note sys.argv: 161e. のようないくつかの
     システム API にも問題がありえます。システムにより利用可能とされるべ
     きバイト列がデフォルトエンコーディングで解釈不能な場合です。環境変
     数 ‘LANG’ をセットしてプログラムを再実行することが、おそらく最善の
     アプローチです。

   * PEP 3138(1): 文字列への *note repr(): 462. はもう非 ASCII 文字をエ
     スケープしません。ただし、制御文字、Unicode 標準で印字不可状態のコ
     ードポイントは今でもエスケープされます。

   * PEP 3120(2): ソースのエンコードのデフォルトが UTF-8 になりました。

   * PEP 3131(3): 非 ASCII 文字を識別子として使用することが出来るように
     なりました。 (そうはいっても標準ライブラリは、コメント内での貢献者
     の名前以外では ASCII だけのままです。)

   * ‘StringIO’ および ‘cStringIO’ モジュールは廃止されました。その代わ
     り *note io: 82. モジュールをインポートして、テキストやデータには
     *note io.StringIO: 12d8. や *note io.BytesIO: 1258. を使用してくだ
     さい。

   * *note Unicode HOWTO: 165e. を参照してください。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.17.2 構文の変更の概要
-----------------------

このセクションは Python 3.0 における全ての '構文の' 変更についての簡単な
概要です。

* Menu:

* 新たな構文::
* 変更された構文::
* 削除された操作::


File: python.info,  Node: 新たな構文,  Next: 変更された構文,  Up: 構文の変更の概要

1.17.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__: 672. 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: 1661. 文。 ‘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(): 1662. が導入されました。

   * ‘b’ または ‘B’ で始まるバイトリテラルと、関連する新しい組み込み関数
     *note bytes(): 1d2. が導入されました。

   ---------- 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.17.2.2 変更された構文
.......................

   * PEP 3109(1) と PEP 3134(2): 新たな *note raise: 9e9. 文のシンタック
     ス: ‘raise [EXPR [from EXPR]]’。以下を参照してください。

   * ‘as’ と *note with: 215. は予約語になりました。 (実際には 2.6 から)

   * ‘True’、‘False’、および ‘None’ が予約語になりました。(2.6 では既に
     ‘None’ が部分的に制限されていました)

   * Change from *note except: 44e. '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: e51.)

   * リスト内包表記はもう ‘[... for VAR in ITEM1, ITEM2, ...]’ という構
     文形をサポートしません。代わりに ‘[... for VAR in (ITEM1, ITEM2,
     ...)]’ を使用してください。また、リスト内包表記は異なるセマンティク
     スを持つことに注意してください。リスト内包表記は *note list(): 4e0.
     コンストラクタ内のジェネレータ式の糖衣構文に近く、特にループの制御
     変数はスコープ外ではもう使用することができません。

   * '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.17.2.3 削除された操作
.......................

   * PEP 3113(1): タプル引数のアンパックが削除されました.  ‘def foo(a,
     (b, c)): ...’ のように書くことはできません。かわりに ‘def foo(a,
     b_c): b, c = b_c’ を使用してください。

   * バッククオートが削除されました (代わりに *note repr(): 462. を使用
     してください)。

   * ‘<>’ が削除されました (代わりに ‘!=’ を使用してください)。

   * 削除されたキーワード: *note exec(): 190. はキーワードでなくなりまし
     たが、関数として残りました。 (幸運にも関数のシンタックスは 2.x でも
     許容されています。) また、 ‘exec()’ はストリーム引数を受け取らなく
     なりました。‘exec(f)’ の代わりに ‘exec(f.read())’ を使うことができ
     ます。

   * ‘l’ または ‘L’ で終わる整数リテラルはサポートされません。

   * ‘u’ or ‘U’ で始まる文字列リテラルはサポートされません。(--訳注: こ
     の ‘u"..."’ は Python 3.3 で再び使えるようになりました。 --)

   * *note from: 1665. 'module' *note import: 9df. ‘*’ はモジュールレベ
     ルでのみ許され、関数内での使用は許されません。

   * 相対インポートに許される構文は ‘from .[MODULE] import NAME’ のみで
     す。 ‘.’ で始まらない形の全ての *note import: 9df. は絶対インポート
     と解釈されます。 ( 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.17.3 Python 2.6 で既にあった変更
----------------------------------

おそらく多くのユーザが一足飛びに Python 2.5 から Python 3.0 に移行しよう
とするでしょうから、このセクションでは、もともとは Python 3.0 のためにデ
ザインされたものの Python 2.6 にバックポートされた新機能について、読者に
思い出してもらいましょう。 *note What's New in Python 2.6: 1667. 内の対
応するセクションにはもっと長い説明が書かれています。

   * *note PEP 343; "with" ステートメント: 1668.  *note with: 215. 文は
     今では標準機能となったので、 *note __future__: 0. からインポートす
     る必要はもうありません。 *note コンテキストマネージャを書く: 1669.
     と *note contextlib モジュール: 166a. も見てください。

   * *note PEP 366; メインモジュールからの明示的相対インポート: 166b.
     *note -m: 4d1. オプションの有用性を強化します。パッケージ内にあるモ
     ジュールを参照している際に関係します。

   * *note PEP 370; ユーザごとの site-packages ディレクトリ: 166c.

   * *note PEP 371; multiprocessing パッケージ: 166d.

   * *note PEP 3101; 進化版文字列フォーマッティング: 166e.  注意: 2.6 の
     記述では *note format(): 440. メソッドが 8 ビット文字列と Unicode 文
     字列両方について述べていますが、3.0 では *note str: 1ea. 型
     (Unicode サポートを持ったテキスト文字列) だけがこのメソッドをサポー
     トしています。 *note bytes: 1d2. 型にはありません。計画では最終的に
     はこれだけが唯一の文字列フォーマットの API になり、Python 3.1 では
     ‘%’ 演算子は非推奨扱いを開始する予定です。(-- 訳注: ‘%’ 演算子の撤
     廃は影響が大き過ぎるからか、現実には (ドキュメントでの軽い記述を除
     き) 実行時に特別に非推奨扱いされることは 3.5 になってさえもいまだあ
     りません。 --)

   * *note PEP 3105; print を関数にする: 166f.  これはもはや標準機能とな
     ったので、 *note __future__: 0. からインポートする必要はありません
     。詳細はこのドキュメントの上の方に書いてあります。

   * *note PEP 3110; 例外処理の変更: 1670.  The *note except: 44e. '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; バイトリテラル: 1671.  文字列リテラル ‘b"..."’ 表記
     (とそのお仲間 ‘b'...'’, ‘b"""..."""’, ‘br"..."’ など) は今では
     *note bytes: 1d2. 型です。

   * *note PEP 3116; 新しい I/O ライブラリ: 1672.  The *note io: 82.
     module is now the standard way of doing file I/O. The built-in
     *note open(): 333. function is now an alias for *note io.open():
     930. and has additional keyword arguments 'encoding', 'errors',
     'newline' and 'closefd'.  Also note that an invalid 'mode' argument
     now raises *note ValueError: 15a, not *note IOError: 1409.  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; 改訂版バッファプロトコル: 1673.  The old builtin
     ‘buffer()’ is now really gone; the new builtin *note memoryview():
     1dd. provides (mostly) similar functionality.

   * *note PEP 3119; 抽象基底クラス: 1674.  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: 193. and *note list: 4e0. conform
     to the *note collections.MutableMapping: 146a. and *note
     collections.MutableSequence: 6cc. ABCs, respectively.

   * *note PEP 3127; 整数リテラルのサポートと文法: 1675.  上述のとおり、
     新しい 8 進数リテラル表現だけが唯一の 8 進数リテラル表現となり、ま
     た、バイナリリテラルが追加されました。

   * *note PEP 3129; クラスデコレータ: 1676.

   * *note PEP 3141; 数値の型階層: 1677.  *note numbers: a2. が、もう一
     つの新しく ABC を使うモジュールで、Python の「数値塔 (numeric
     tower)」を定義しています。新しい *note fractions: 60. モジュールが
     *note numbers.Rational: 1678. を実装していることにも注目してくださ
     い。


File: python.info,  Node: ライブラリの変更,  Next: PEP 3101 文字列整形の新たなアプローチ,  Prev: Python 2 6 で既にあった変更,  Up: What's New In Python 3 0

1.17.4 ライブラリの変更
-----------------------

時間の制約により、この文書は標準ライブラリの非常に幅広い変更について徹底
的に取り上げてはいません。 ライブラリの大きな変更については PEP 3108(1)
を参照してください。 ここでは要約を示します:

   * 多くの古いモジュールは削除されました。 ‘gopherlib’ (もう使われませ
     ん) や ‘md5’ (*note hashlib: 6b. に代替されました) 等のいくつかのモ
     ジュールは 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: 82.
     module.

   * 関連のあるモジュールのいくつかはパッケージにまとめられ、ふつうサブ
     モジュール名は単純化されました。結果として以下のようなパッケージが
     出来ました:

        * *note dbm: 34. (‘anydbm’, ‘dbhash’, ‘dbm’, ‘dumbdbm’, ‘gdbm’,
          ‘whichdb’).

        * *note html: 6e. (‘HTMLParser’, ‘htmlentitydefs’).

        * *note http: 71. (‘httplib’, ‘BaseHTTPServer’, ‘CGIHTTPServer’,
          ‘SimpleHTTPServer’, ‘Cookie’, ‘cookielib’).

        * *note tkinter: f9. (all ‘Tkinter’-related modules except *note
          turtle: 10a.).  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: 111. (‘urllib’, ‘urllib2’, ‘urlparse’,
          ‘robotparse’).

        * *note xmlrpc: 136. (‘xmlrpclib’, ‘DocXMLRPCServer’,
          ‘SimpleXMLRPCServer’).

PEP 3108(6) で取り上げられていない標準ライブラリーの他の変更:

   * Killed ‘sets’.  Use the built-in *note set(): 432. class.

   * Cleanup of the *note sys: e2. module: removed ‘sys.exitfunc()’,
     ‘sys.exc_clear()’, ‘sys.exc_type’, ‘sys.exc_value’,
     ‘sys.exc_traceback’.  (Note that *note sys.last_type: 8d4. etc.
     remain.)

   * Cleanup of the *note array.array: 6cb. type: the ‘read()’ and
     ‘write()’ methods are gone; use *note fromfile(): 167a. and *note
     tofile(): 167b. 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(): a8c. and *note
     release(): 167c. instead.

   * Cleanup of the *note random: c0. 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: e9. module.

   * *note tokenize: 104. モジュールはバイトでも機能するように変更されま
     した。メインのエントリポイントは generate_tokens から *note
     tokenize.tokenize(): 8ee. になりました。

   * ‘string.letters’ and its friends (‘string.lowercase’ and
     ‘string.uppercase’) are gone.  Use *note string.ascii_letters:
     167d. 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
     で既にあった変更: 1666. での対応する記述に書いた訳注を参照。--)

   ---------- 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.17.6 例外に関する変更
-----------------------

例外の送出や捕捉を行う API は整理され、 強力な新機能が追加されました:

   * PEP 352(1): 全ての例外は (直接的にまたは間接的に) *note
     BaseException: 9bd. を継承しなければなりません。 ‘BaseException’ は
     例外階層の根です。 これは勧告としては新しくありませんが、
     ‘BaseException’ 継承の '要求' は新しいです。 (Python 2.6 は依然とし
     て昔のクラスを送出するのを許容しており、捕捉するものについての制限
     はありません。) 結果として文字列例外は終に本当の意味で、完全になく
     なりました。

   * ほとんど全ての例外は、実際は *note Exception: da2. を継承すべきです
     。 *note BaseException: 9bd. は最上位で扱われるべき例外、例えば
     *note SystemExit: 10fb. や *note KeyboardInterrupt: d9a. の基底クラ
     スとしてのみ使われるべきでしす。上記カテゴリーを除く全ての例外を処
     理するのに推奨されるイディオムは *note except: 44e. ‘Exception’ で
     す。

   * ‘StandardError’ was removed.

   * Exceptions no longer behave as sequences.  Use the *note args: 977.
     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__: 1680. attribute (see below).

   * PEP 3110(3): 例外の捕捉。 ‘except SOMEEXCEPTION, VARIABLE’ ではなく
     ‘except SOMEEXCEPTION as VARIABLE’ としなければなりません。 その上
     *note except: 44e. ブロックがある場合 '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: 44e. or *note finally: 453.
     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__: 1681. 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__: 1682. attribute of the secondary exception.  The
     traceback printed when an unhandled exception occurs walks the
     chain of ‘__cause__’ and *note __context__: 1681. 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__: 1680. 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(): a7f.
     (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.17.7 その他の変更
-------------------

* Menu:

* 演算子と特殊メソッド::
* 組み込み::


File: python.info,  Node: 演算子と特殊メソッド,  Next: 組み込み,  Up: その他の変更<2>

1.17.7.1 演算子と特殊メソッド
.............................

   * ‘!=’ は ‘==’ と逆の結果をかえします（‘==’ が *note NotImplemented:
     447. を返さなければ）。

   * 「非束縛メソッド (unbound methods)」という概念は言語から削除されま
     した。クラス属性としてのメソッドを参照しても今では普通の関数オブジ
     ェクトが得られます。

   * ‘__getslice__()’, ‘__setslice__()’ and ‘__delslice__()’ were
     killed.  The syntax ‘a[i:j]’ now translates to
     ‘a.__getitem__(slice(i, j))’ (or *note __setitem__(): 1685. or
     *note __delitem__(): 1686, when used as an assignment or deletion
     target, respectively).

   * PEP 3114(1): *note next(): bb9. 標準メソッドは *note __next__():
     1687. に改名されました。

   * The ‘__oct__()’ and ‘__hex__()’ special methods are removed - *note
     oct(): 1688. and *note hex(): 1689. use *note __index__(): 444. 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__:
     168a, *note __code__: 7a2, *note __defaults__: 168b, *note
     __dict__: 168c, *note __doc__: 1597, *note __globals__: 168d, *note
     __name__: 168e, respectively.

   * ‘__nonzero__()’ is now *note __bool__(): 168f.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3114/


File: python.info,  Node: 組み込み,  Prev: 演算子と特殊メソッド,  Up: その他の変更<2>

1.17.7.2 組み込み
.................

   * PEP 3135(1): 新しくなった *note super(): 44a. 。今では ‘super()’ は
     引数なしで呼び出せます。(これが *note class: 1691. 内で定義される通
     常のインスタンスメソッド内であると仮定して) 正しいクラスとインスタ
     ンスが自動的に選択されます。引数ありの場合の ‘super()’ の振る舞いに
     は変更はありません。

   * PEP 3111(2): ‘raw_input()’ was renamed to *note input(): 1692.
     That is, the new ‘input()’ function reads a line from *note
     sys.stdin: 94f. and returns it with the trailing newline stripped.
     It raises *note EOFError: 1693. if the input is terminated
     prematurely.  To get the old behavior of ‘input()’, use
     ‘eval(input())’.

   * 新しい組み込み関数 *note next(): bb9. が追加されました。 オブジェク
     トの *note __next__(): 1687. メソッドを呼び出します。

   * *note round(): 1694. 関数の丸めの戦略と戻り値の型が変更されました。
     ど真ん中の場合に、四捨五入ではなく最近接偶数への丸めをするようにな
     りました。(例えば ‘round(2.5)’ は今では ‘2’ を返します。 ‘3’ ではな
     く。) (--訳注: 丸めモードについては Wikipedia(3) 参照。--)
     ‘round(x[, n])’ は常に浮動小数点数の結果を返す代わりに、
     ‘x.__round__([n])’ に処理を委譲するようになりました。これは一般的に
     、単一引数で呼ばれた際に整数を返し、二つの引数で呼ばれた場合は ‘x’
     と同じ型の値として返します。

   * Moved ‘intern()’ to *note sys.intern(): 1695.

   * Removed: ‘apply()’.  Instead of ‘apply(f, args)’ use ‘f(*args)’.

   * Removed *note callable(): 1584.  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(): 333.  There are now
     several different kinds of streams that open can return in the
     *note io: 82. module.

   * Removed ‘reduce()’.  Use *note functools.reduce(): 156. if you
     really need it; however, 99 percent of the time an explicit *note
     for: 329. loop is more readable.

   * Removed ‘reload()’.  Use ‘imp.reload()’.

   * Removed.  ‘dict.has_key()’ - use the *note in: 32b. 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.17.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: 1697. を標準的な C に一致。

   * 制限付き実行 の C API サポートはこれ以上されません。

   * ‘PyNumber_Coerce()’, ‘PyNumber_CoerceEx()’, ‘PyMember_Get()’, and
     ‘PyMember_Set()’ C APIs are removed.

   * New C API ‘PyImport_ImportModuleNoBlock()’, works like *note
     PyImport_ImportModule(): 3ab. 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.17.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.17.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
への拡張モジュール移植: 169a. を参照してください。


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.18 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: 1cd. クラスでもいろい
ろな点で改良されました、標準ライブラリにいくつかの有用な追加が行われまし
た。 *note unittest: 10f. モジュールが大幅に改良され、コマンドラインオプ
ション解析の *note argparse: 7. モジュールが追加され、 *note
collections: 1e. モジュールに便利な *note OrderedDict: 9da. と *note
Counter: 20f. が追加され、他にもたくさんの改良が行われています。

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.18.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 メンテナンスリリースで追加された新機能: 16a0. セクション
     で言及されます。

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.18.2 Deprecation Warnings の扱いの変更
----------------------------------------

Python 2.7 では開発者向けの警告をデフォルトで抑止するポリシーが取られま
した。 *note DeprecationWarning: 2d4. とそれを継承した警告は、指定されな
い限りは無視され、アプリケーションのユーザーがその警告を見ないですむよう
になりました。この変更は Python 3.2 ブランチにも適用されました。
(stdlib-sig で討議され、 bpo-7319(1) になりました)

以前のリリースでは、 *note DeprecationWarning: 2d4. メッセージはデフォル
トで有効になっており、 Python 開発者に、将来のバージョンの Python でその
コードのどこが動かなくなるかを明確に知らせていました。

しかし、 Python で開発されたアプリケーションの利用者であって開発には携わ
っていない人がどんどん増えてきました。 *note DeprecationWarning: 2d4. メ
ッセージはそれらのユーザーには無関係で、彼らをアプリケーションが本当に正
しく動いているのか不安にさせ、ユーザーの質問に応えるための開発者の負担も
増やしていました。

*note DeprecationWarning: 2d4. メッセージの表示を有効にするには、 *note
-Wdefault: 1cb. (短い形式: ‘-Wd’) スイッチか、Python を実行する前に
*note PYTHONWARNINGS: 1cc. 環境変数を ‘"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.18.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: 215. 文で複数のコンテキストマネージャを扱えるよう
     に。

   * *note io: 82. ライブラリの新バージョン。パフォーマンスのためにC言語
     で描き直されています。

   * *note PEP 372; collections に順序付き辞書を追加: 16a3. で解説されて
     いる順序付き辞書

   * *note PEP 378; 1000区切りのための書式指定子: 16a4. で解説されている
     新しい ‘","’ フォーマット指定子

   * *note memoryview: 1dd. オブジェクト

   * *note importlib: 7a. モジュールの小さいサブセット。 *note
     下に説明があります: 16a5.

   * float ‘x’ の *note repr(): 462. が多くの場合に短くなりました。これ
     は ‘x’ に戻せることが保証される最小の10進文字列です。以前のバージョ
     ンの Python では、 ‘float(repr(x))’ が ‘x’ になることだけが保証され
     ていました。

   * float から文字列、文字列から float への変換が正しく丸められるように
     なりました。 *note round(): 1694. 関数も正しく丸めるようになりまし
     た。

   * 拡張モジュールが C API を提供するための、 *note PyCapsule: 162c. 型

   * *note PyLong_AsLongAndOverflow(): 161f. 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.18.4 PEP 372: collections に順序付き辞書を追加
------------------------------------------------

通常の Python 辞書は、 key/value ペアを不定の順序でイテレートします。何
年にもわたり、いろいろな人が key の挿入順を保存する辞書の別実装を書いて
きました。その経験に基づき、 2.7 は *note collections: 1e. モジュールに
新しい *note OrderedDict: 9da. クラスを追加しました。

*note OrderedDict: 9da. 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(): 16a7. メソッドは、オプションの '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: 9da. を通常の辞書と比較すると、挿入順は無視されて単に
key/value だけが比較されます。

How does the *note OrderedDict: 9da. 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(): da9. method for *note
     collections.namedtuple(): 1da. now returns an ordered dictionary
     with the values appearing in the same order as the underlying tuple
     indices.

   * The *note json: 85. module's *note JSONDecoder: 1101. 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.18.5 PEP 378: 1000区切りのための書式指定子
--------------------------------------------

大きい数値に区切り文字を追加して、18446744073709551616 の代わりに
18,446,744,073,709,551,616 と出力すると、プログラムの出力を読みやすくで
きます。

これを行う一般的な方法は *note locale: 89. モジュールを使うことで、複数
の区切り文字 (北米では "," で、ヨーロッパでは ".")  を使ったり、複数のグ
ループの大きさを使うことができます。しかし、 ‘locale’ の利用方法は複雑で
すし、スレッドごとに異なるロケールの出力を行うプログラムでは利用すること
ができません。

そのため、シンプルなカンマによるグループ化機構が *note str.format():
a17. メソッドのミニ言語に追加されました。浮動小数点数をフォーマットする
場合、シンプルにカンマを幅と精度の間に置きます。

     >>> '{: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: 89. ほど汎用
ではありませんが、手軽に使うことができます。

参考
....

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.18.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: 64, *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: 326. を指定することで、自動で
ファイルを開き、 ‘'-'’ が指定されたときに標準入出力だと判断することがで
きます。

参考
....

*note argparse: 7. のドキュメント

     argparse モジュールのドキュメント

*note Migrating optparse code to argparse: 156c.

     *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.18.7 PEP 391: logging の辞書ベースの設定
------------------------------------------

*note logging: 8a. モジュールは非常に柔軟です。アプリケーションは
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: 8a.
also supports a *note fileConfig(): f12. 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(): 156e. 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 環境設定のための関数: 16ab.

以下は、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: 8a. モジュールには Vinary Sajip によって実装され
た 3 つの改良があります。

   * *note SysLogHandler: a51. クラスは TCP 経由の syslog をサポートしま
     す。コンストラクタの 'socktype' 引数は使用するソケットの種類として
     、 UDP を使う *note socket.SOCK_DGRAM: 16ac. と TCP を使う *note
     socket.SOCK_STREAM: 16ad. のどちらかを取ります。デフォルトはUDPのま
     まです。

   * *note Logger: f10. インスタンスに *note getChild(): 16ae. メソッド
     が追加されました。これは、相対パスで下位の logger を返します。 例え
     ば、 ‘log = getLogger('app')’ として logger を取得した後、
     ‘log.getChild('network.listen')’ は
     ‘getLogger('app.network.listen')’ と同じになります。

   * The *note LoggerAdapter: 16af. class gained an *note
     isEnabledFor(): 16b0. 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.18.8 PEP 3106: 辞書 View
--------------------------

辞書の *note keys(): bb1, *note values(): bb2, *note items(): bb3. メソ
ッドは Python 3.x では動作が代わり、完全に実体化されたリストの代わりに、
'view' と呼ばれるオブジェクトを返すようになりました。

It's not possible to change the return values of *note keys(): bb1,
*note values(): bb2, and *note items(): bb3. 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(): bb1, *note values(): bb2, *note items(): bb3. メソッドに書
き換えてくれます。

参考
....

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.18.9 PEP 3137: memoryview オブジェクト
----------------------------------------

*note memoryview: 1dd. オブジェクトは、他のオブジェクトのメモリの内容に
対する *note bytes: 1d2. 型のインターフェースに合わせた 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: 1dd. オブジェクトは、対象となる背後のオブジェクトが変
更可能 (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.18.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: 215. 文が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(): 1ea. 関数の適用、 *note
     float: 32f. や *note complex: 330. コンストラクタ、数値フォーマット
     、 *note marshal: 90, *note pickle: ab, *note json: 85. モジュール
     を使ってのシリアライズとデシリアライズ、 Python コード中の float や
     imaginary リテラルの解析、 *note Decimal: 1cd. から float への変換
     などです。

     これに関連して、浮動小数点数 'x' の *note repr(): 462. は、
     (round-half-to-even 丸めモードで)正しく丸め処理をした場合に元の 'x'
     に戻せる最小の 10進文字列になりました。以前は 'x' を17桁の10進文字
     列に丸めていました。

     丸めライブラリが、この改善が Windows や gcc, icc, suncc を使った
     Unix 環境で動かす役目をおっています。このライブラリの正確な動作が保
     証できない少しの環境があるので、そういったシステムではこのライブラ
     リは利用されません。 *note sys.float_repr_style: 16b4. が ‘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(): a17. メソッドは置換フィールドに対する自動ナンバ
     リングをサポートするようになりました。これにより ‘str.format()’ を
     より ‘%s’ と同じように使えるようになりました。

          >>> '{}:{}:{}'.format(2009, 04, 'Sunday')
          '2009:4:Sunday'
          >>> '{}:{}:{day}'.format(2009, 4, day='Sunday')
          '2009:4:Sunday'

     自動ナンバリングは左のフィールドから右のフィールドへと行われるので
     、最初の ‘{...}’ 指定は *note str.format(): a17. メソッドの最初の引
     数を利用し、次の指定は次の引数を利用します。自動ナンバリングと明示
     的なナンバリングを混ぜて使うことはできず、全ての置換指定に手動でナ
     ンバリングするか、全てを自動ナンバリングに任せなければなりません。
     ただし、上の例の2つめのように、自動ナンバリングと名前フィールドを混
     ぜて使うことは可能です。 (Contributed by Eric Smith; bpo-5237(7).)

     複素数が *note format(): 440. をサポートするようになりました。デフ
     ォルトでは右寄せになります。精度やカンマ区切りの指定は、実部と虚部
     のそれぞれに対して適用されます。アラインの指定は ‘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__(): a15. method now
     triggers a *note PendingDeprecationWarning: c9f. if it's passed a
     format string, because the ‘__format__()’ method for *note object:
     e51. 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(): 32e. 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: 9df. 文が、絶対インポート (例: ‘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: 1d1. 型の *note translate(): 16b5. メソッドが第一
     引数に ‘None’ を受け入れるようになりました。 (Fixed by Georg
     Brandl; bpo-4759(15).)

   * When using *note @classmethod: 6a0. and *note @staticmethod: 66d.
     to wrap methods as class or static methods, the wrapper object now
     exposes the wrapped function as their *note __func__: 16b6.
     attribute.  (Contributed by Amaury Forgeot d'Arc, after a
     suggestion by George Sakkis; bpo-5982(16).)

   * ‘__slots__’ を利用して属性を制限した場合に、設定されていない属性を
     del したときに *note AttributeError: 1b4. にならなかったのを修正し
     ました。 (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: 1409. 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(): 1d3. 関数がどの改行コードを利用
     したコードでも受け付けるようになりました。また、コードの終端の改行
     も不要になりました。

   * 関数宣言中の余分な丸括弧は 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.18.10.1 インタプリタの変更
............................

新しい環境変数 *note PYTHONWARNINGS: 1cc. を使って警告を制御できるように
なりました。この環境変数には、 *note -W: 1cb. スイッチに使われる警告の設
定を、カンマ区切りの文字列として指定します。 (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: 74. 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.18.10.2 最適化
................

いくつかの場面でパフォーマンスが向上しています。

   * A new opcode was added to perform the initial setup for *note with:
     215. statements, looking up the *note __enter__(): 9cb. and *note
     __exit__(): 16ba. 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: 1d1. 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.18.11 新しいモジュールと改良されたモジュール
----------------------------------------------

全てのリリースに置いて、 Python の標準ライブラリはたくさんの改良とバグ修
正がされてきました。ここでは一部の注目に値する変更を、モジュール名で辞書
順ソートしてリストアップしています。もっと完全な変更リストが見たければ、
ソースツリー内の ‘Misc/NEWS’ ファイルか、全ての完全な詳細が入っている
Subversion のログを参照してください。

   * *note bdb: 10. モジュールの基底デバッガクラス *note Bdb: 557. に、
     モジュールをスキップする機能が追加されました。コンストラクタは
     ‘django.*’ のような glob スタイルのパターンをもった iterable を引数
     として受け取ります。デバッガはパターンのどれかにマッチするスタック
     フレームにステップインしません。 (Contributed by Maru Newby after a
     suggestion by Senthil Kumaran; bpo-5142(1).)

   * *note binascii: 11. モジュールが buffer API をサポートするようにな
     り、 *note memoryview: 1dd. インスタンスやその他のバッファオブジェ
     クトともに利用できるようになりました。 (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: c41. がコンテキストマネ
     ージャープロトコルをサポートするようになりました。これにより、
     ‘with bz2.BZ2File(...) as f:’ といった書き方ができます。
     (Contributed by Hagen Fürstenau; bpo-3860(5).)

   * *note collections: 1e. モジュールの新しい *note Counter: 20f. クラ
     スは、データの数え上げをするときに便利です。 ‘Counter’ インスタンス
     は辞書のように振る舞いますが、キーが存在しなかったときに *note
     KeyError: 7e5. 例外を発生させる代わりに 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: 20f. には追加の3つのメソッドがあります。 *note
     most_common(): 16bc. はカウントが最も多い N 要素とそのカウントを返
     します。 *note elements(): 16bd. はカウントしている要素を、そのカウ
     ント数だけ繰り返すイテレータを返します。 *note subtract(): 159d. は
     イテレート可能型を受け取り、その各要素を足すのではなく引いて行きま
     す。引数が辞書か他の ‘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: 9da. はすでに *note PEP 372;
     collections に順序付き辞書を追加: 16a3. で紹介しました。

     メソッドが追加されました。*note deque: 9db. データ型の *note
     count(): 159f. メソッドは、引数で指定された 'x' と等しい要素が何個
     入っているかを返します。 *note reverse(): 15a0. メソッドは deque 内
     の要素をインプレースで逆順にします。 ‘deque’ はまた、最大長を返す読
     み出し専用の属性 *note maxlen: 16be. を持ちます。 (Both features
     added by Raymond Hettinger.)

     *note namedtuple: 1da. クラスにオプションの '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: ca0. abstract base class now returns
     *note NotImplemented: 447. 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: 215.
     statement, has been deprecated, because the ‘with’ statement now
     supports multiple context managers.

   * The *note cookielib: 73. 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(): f2f. 関数が、束縛ず
     みインスタンスメソッドを正しくコピーするようになりました。
     (Implemented by Robert Collins; bpo-1515(11).)

   * *note ctypes: 2d. モジュールが、ポインタとして宣言された引数に対し
     て ‘None’ が渡された場合常に C の ‘NULL’ ポインタに変換するようにな
     りました。(Changed by Thomas Heller; bpo-4606(12).)  根底の、
     libffi ライブラリ(13) がバージョン 3.0.9 にアップデートされ、いくつ
     かのプラットフォームにおけるいろいろな問題が修正されました。
     (Updated by Matthias Klose; bpo-8142(14).)

   * 新しいメソッド: *note datetime: 33. モジュールの *note timedelta:
     d98. クラスに *note total_seconds(): 16bf. メソッドが追加されました
     。これはその期間の秒数を返します。(Contributed by Brian Quinlan;
     bpo-5788(15).)

   * New method: the *note Decimal: 1cd. class gained a *note
     from_float(): 15c1. 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: 1cd. 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: 1cd. のコンストラクタが浮動小数点数を受け入れるよう
     になりました。 (added by Raymond Hettinger; bpo-8257(18)) また、ア
     ラビア・インド数字などの、ヨーロッパ以外の Unicode 文字も受け入れる
     ようになりました。 (contributed by Mark Dickinson; bpo-6595(19)).

     *note Context: 146d. クラスのほとんどのメソッドが *note Decimal:
     1cd. インスタンスと同じく整数を受け入れるようになりました。例外は
     *note canonical(): 16c0. と *note is_canonical(): 16c1. メソッドだ
     けです。 (Patch by Juan José Conti; bpo-7633(20).)

     *note Decimal: 1cd. インスタンスを文字列の *note format(): a17. メ
     ソッドで利用した場合、デフォルトのアライメントが左揃えから、数値型
     に適した右揃えに変更されました。 (Changed by Mark Dickinson;
     bpo-6857(21).)

     signaling NaN (あるいは ‘sNAN’) との比較は、暗黙に比較演算に応じて
     真偽値を返すのではなく、 *note InvalidOperation: 1466. 例外を発生さ
     せるようになりました。 Quiet NaN (あるいは ‘NAN’) はハッシュ可能に
     なりました。 (Fixed by Mark Dickinson; bpo-7279(22).)

   * *note difflib: 3a. モジュールの出力が、ファイル名を含むヘッダのセパ
     レータにスペースではなくタブ文字を使うようになり、最近の
     ‘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: 3d. module's *note IGNORE_EXCEPTION_DETAIL:
     16c2. flag will now ignore the name of the module containing the
     exception being tested.  (Patch by Lennart Regebro; bpo-7490(25).)

   * The *note email: 3e. module's *note Message: 786. 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: 1ce. クラスが、コンストラクタの引数として、 1つの
     float 値、 *note Decimal: 1cd. インスタンス、 2つの有理数を受け入れ
     るようになりました。(Implemented by Mark Dickinson; rationals added
     in bpo-5812(27), and float/decimal in bpo-8294(28).)

     fraction と complex 数の間の順序比較演算 (‘<’, ‘<=’, ‘>’, ‘>=’)が
     *note TypeError: 29c. 例外を発生させるようになりました。これは過失
     を修正し、 *note Fraction: 1ce. を他の数値型とマッチさせます。

   * 新しいクラス: *note FTP_TLS: ccf. が *note ftplib: 61. に追加されま
     した。認証とその後の制御・データ転送をTLSカプセル化することでセキュ
     アなFTP接続を提供します。 (Contributed by Giampaolo Rodola;
     bpo-2054(29).)

     バイナリデータのアップロードを行う *note storbinary(): 16c3. に
     'rest' 引数が追加され、アップロードのリスタートができるようになりま
     した。 (patch by Pablo Mouzo; bpo-6845(30).)

   * New class decorator: *note total_ordering(): 12f2. in the *note
     functools: 62. module takes a class that defines an *note __eq__():
     ec4. method and one of *note __lt__(): 165a, *note __le__(): 16c4,
     *note __gt__(): 16c5, or *note __ge__(): 16c6, 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(): 1598. 関数は、古いスタイルの2引数を
     受け取る比較関数を受け取り、 *note sorted(): f90, *note min():
     12bc, *note max(): 12bd. などの 'key' 引数に利用できる呼び出し可能
     オブジェクトを返します。この関数の主な目的は、古いコードを Python
     3.x へ対応させるのを手助けすることです。(Added by Raymond
     Hettinger.)

   * 新しい関数: *note gc: 63. モジュールに *note is_tracked(): 16c7. 関
     数が追加されました。渡されたオブジェクトがGCに追跡されている場合に
     True を、そうでない場合に False を返します。 (Contributed by
     Antoine Pitrou; bpo-4688(32).)

   * *note gzip: 6a. モジュールの *note GzipFile: 84f. がコンテキストマ
     ネージャープロトコルをサポートしました。 ‘with gzip.GzipFile(...)
     as f:’ と書くことができます。(contributed by Hagen Fürstenau;
     bpo-3860(33) また、 *note io.BufferedIOBase: a88. ABC を実装してい
     ます。なので、より高速な処理のために *note io.BufferedReader: 15cb.
     でラップすることができます。 (contributed by Nir Aides;
     bpo-7471(34)).  さらに、コンストラクタにオプションのタイムスタンプ
     を指定することで、 gzip ファイル内の変更時間レコードをオーバーライ
     ドすることができるようになりました。 (Contributed by Jacques
     Frechet; bpo-4272(35).)

     gzip ファイルフォーマットのファイルは最後にゼロバイトによるパディン
     グができるようになりました。 *note gzip: 6a. モジュールは末尾のゼロ
     バイトを消費します。(Fixed by Tadek Pietraszek and Brian Curtin;
     bpo-2846(36).)

   * New attribute: the *note hashlib: 6b. 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: 148e. class used by the *note
     httplib: 71. 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: 22e. and *note HTTPSConnection: 22f.
     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: 77. モジュールが IPv6 アドレスをサポートするようにな
     りました。 (Contributed by Derek Morr; bpo-1655(40).)

   * *note inspect: 81. モジュールに *note getcallargs(): 126f. 関数が追
     加されました。 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: 82. 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: a89. class now
     has an *note errors: 16c8. attribute giving the error setting used
     for encoding and decoding errors (one of ‘'strict'’, ‘'replace'’,
     ‘'ignore'’).

     *note io.FileIO: 16c9. クラスは、無効なファイルディスクリプタを渡さ
     れたときに *note OSError: 543. を送出するようになりました。
     (Implemented by Benjamin Peterson; bpo-4991(42).)  *note
     truncate(): 16ca. メソッドは、ファイル位置を保存するようになりまし
     た。以前は、ファイル位置を新しいファイルの末尾に変更しました。
     (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(): 16cb. とは異なり、生成された組合せに個別の要
     素が繰り返し出現できます:

          itertools.combinations_with_replacement('abc', 2) =>
            ('a', 'a'), ('a', 'b'), ('a', 'c'),
            ('b', 'b'), ('b', 'c'), ('c', 'c')

     なお要素は、実際の値ではなく、その入力内での位置に依って一意である
     とみなされます。

     *note itertools.count(): 163d. 関数は、1 以外の値を増分できるように
     、 'step' 引数を追加しました。 ‘count()’ はまた、キーワード引数に対
     応し、さらに浮動小数点数や *note Decimal: 1cd. インスタンスのような
     、非整数の値を使えるようになりました。(Implemented by Raymond
     Hettinger; bpo-5032(44).)

     *note itertools.combinations(): 16cb. および *note
     itertools.product(): 16cc. は、以前は入力のイテレート可能オブジェク
     トより大きい 'r' に *note ValueError: 15a. を返していました。これは
     仕様エラーと認められ、空のイテレータを返すようになりました。(Fixed
     by Raymond Hettinger; bpo-4816(45).)

   * 更新されたモジュール: *note json: 85. モジュールが、エンコーディン
     グやデコーディングを高速化する C 拡張を含んだ、 simplejson パッケー
     ジのバージョン 2.0.9 にアップグレードされました。 (Contributed by
     Bob Ippolito; bpo-4136(46).)

     新しい *note collections.OrderedDict: 9da. 型をサポートするために、
     *note json.load(): 239. はオプションとして、任意のオブジェクトリテ
     ラルに対して呼び出され、ペアのリストにデコードする
     'object_pairs_hook' パラメタを追加しました。(Contributed by Raymond
     Hettinger; bpo-5381(47).)

   * *note mailbox: 8e. モジュールの *note Maildir: 851. クラスは、読み
     込むディレクトリのタイムスタンプを記録し、その後に更新時刻が変わっ
     た場合にのみ再読み込みするようになりました。これは不必要なディレク
     トリ走査を避けることでパフォーマンスを向上させます。(Fixed by A.M.
     Kuchling and Antoine Pitrou; bpo-1607951(48), bpo-6896(49).)

   * 新しい関数: *note math: 91. モジュールは、誤差関数と相補誤差関数
     *note erf(): f9c. および *note erfc(): f9d. 、 ‘e**x - 1’ を *note
     exp(): 16cd. から 1 を引くのよりも高い精度で計算する *note expm1():
     15ab. 、ガンマ関数 *note gamma(): 15ac. 、そしてガンマ関数の自然対
     数 *note lgamma(): 15ad. を追加しました。 (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: 131a. 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(): 16ce. と *note getresuid(): 16cf. 、 real,
     effective, および saved GID と UID を新しく設定する、 *note
     setresgid(): 16d0. と *note setresuid(): 16d1. 、現在のプロセスにグ
     ループアクセスリストを初期化する *note initgroups(): 16d2. 。
     (GID/UID functions contributed by Travis H.; bpo-6508(54).  Support
     for initgroups added by Jean-Paul Calderone; bpo-7333(55).)

     *note os.fork(): 6c3. 関数は、子プロセス中で import ロックを再初期
     化するようになりました。これは、Solaris における ‘fork()’ がスレッ
     ドから呼び出された時の問題を修正します。(Fixed by Zsolt Cserna;
     bpo-7242(56).)

   * *note os.path: a6. モジュールの、 *note normpath(): 16d3. および
     *note abspath(): 16d4. 関数は、Unicode を保存するようになりました。
     入力パスが Unicode なら、戻り値も Unicode 文字列になります。 (*note
     normpath(): 16d3. fixed by Matt Giuca in bpo-5827(57); *note
     abspath(): 16d4. fixed by Ezio Melotti in bpo-3426(58).)

   * *note pydoc: bd. モジュールは、Python が使う様々なシンボルのヘルプ
     を追加しました。例えば、 ‘help('<<')’ や ‘help('@')’ とできるように
     なりました。(Contributed by David Laban; bpo-4739(59).)

   * *note re: c1. モジュールの *note split(): 7a6, *note sub(): 7a7, お
     よび *note subn(): 7a8. は、モジュールの他の関数との一貫性のため、
     オプションの 'flags' 引数を受け付けるようになりました。 (Added by
     Gregory P. Smith.)

   * 新しい関数: *note runpy: c6. モジュールの *note run_path(): 6b4. は
     、与えられた '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: cd. モジュールの *note make_archive():
     8c8. は、ファイル名、アーカイブ型 (zip または tar-format)、およびデ
     ィレクトリパスを取って、そのディレクトリの内容を含むアーカイブを生
     成します。(Added by Tarek Ziadé.)

     *note shutil: cd. の *note copyfile(): e21. および *note
     copytree(): df1. 関数は、名前付きパイプのコピーを求められたときに
     *note SpecialFileError: 16d5. 例外を送出する様になりました。以前は
     、コードは、名前付きパイプを、通常のファイルのように読み込み用に開
     いて扱い、いつまでもブロックしていました。 (Fixed by Antoine
     Pitrou; bpo-3002(61).)

   * *note signal: ce. モジュールは、シグナルハンドラを本当に必要でない
     限り再インストールしなくなりました。これで、EINTR シグナルを確実に
     捕えられないバグが修正されました。(Fixed by Charles-Francois
     Natali; bpo-8354(62).)

   * 新しい関数: *note site: cf. モジュールの、新しい関数群は様々なサイ
     トおよびユーザに特有のパスを返します。 *note getsitepackages():
     15f9. は、全てのグローバル site-packages ディレクトリを含むリストを
     返します。 *note getusersitepackages(): 15fb. は、ユーザの
     site-packages ディレクトリのパスを返します。そして、 *note
     getuserbase(): 15fa. は、データの保存に使えるディレクトリへのパスを
     与える、 *note USER_BASE: 16d6. 環境変数の値を返します。
     (Contributed by Tarek Ziadé; bpo-6693(63).)

     *note site: cf. モジュールは *note sitecustomize: d0. モジュールが
     import されたときに例外を報告するようになり、 *note
     KeyboardInterrupt: d9a. 例外が捕捉されて飲み込まれることはなくなり
     ました。 (Fixed by Victor Stinner; bpo-3137(64).)

   * *note create_connection(): a67. 関数は、接続に使われるソースアドレ
     スを与える ‘(host, port)’ の 2-タプル、 'source_address' パラメタを
     追加しました。 (Contributed by Eldon Ziegler; bpo-3972(65).)

     *note recv_into(): 16d7. および *note recvfrom_into(): 16d8. メソッ
     ドは、バッファ API をサポートするオブジェクト、最も便利なのは *note
     bytearray: 1d1. や *note memoryview: 1dd. 、に書きこむようになりま
     した。 (Implemented by Antoine Pitrou; bpo-8104(66).)

   * The *note SocketServer: d5. module's *note TCPServer: 16d9. 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: 16da. 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(): 16db. will be called and *note handle_request():
     16dc. will return.  (Contributed by Kristján Valur Jónsson;
     bpo-6192(67) and bpo-6267(68).)

   * 更新されたモジュール: *note sqlite3: d7. モジュールが pysqlite パッ
     ケージ(69) のバージョン 2.6.0 にアップデートされました。バージョン
     2.6.0 はいくつかのバグ修正を含み、共有ライブラリから SQLite 拡張を
     ロードできるようになりました。拡張を有効にするには
     ‘enable_load_extension(True)’ メソッドを呼び出し、そして特定の共有
     ライブラリをロードするには *note load_extension(): 8cd. を呼び出し
     てください。 (Updated by Gerhard Häring.)

   * The *note ssl: d8. module's *note SSLSocket: cbf. 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(): 938. 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: 15db. (a string), *note
     ssl.OPENSSL_VERSION_INFO: 15dc. (a 5-tuple), and *note
     ssl.OPENSSL_VERSION_NUMBER: 15dd. (an integer).  (Added by Antoine
     Pitrou; bpo-8321(75).)

   * The *note struct: de. 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: 16dd. exception.  (Changed by Mark Dickinson;
     bpo-1523(76).)  The *note pack(): 1630. function will also attempt
     to use *note __index__(): 444. to convert and pack non-integers
     before trying the *note __int__(): 443. method or reporting an
     error.  (Changed by Mark Dickinson; bpo-8300(77).)

   * 新しい関数: *note subprocess: df. モジュールの *note
     check_output(): 1370. は、指定された引数群でコマンドを実行し、コマ
     ンドがエラーを起こさずに実行したらコマンドの出力を文字列として返し
     、そうでなければ *note CalledProcessError: 16de. 例外を送出します。

          >>> 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: df. module will now retry its internal system
     calls on receiving an *note EINTR: 1144. signal.  (Reported by
     several people; final patch by Gregory P. Smith in
     bpo-1068268(78).)

   * 新しい関数: *note symtable: e1. モジュールの *note
     is_declared_global(): 16df. は、明示的に global と宣言された引数に
     は真、暗示的に global である引数には偽を返します。(Contributed by
     Jeremy Hylton.)

   * *note syslog: e5. モジュールは、識別子として、以前デフォルトであっ
     た ‘'python'’ の値ではなく、 ‘sys.argv[0]’ の値を使うようになりまし
     た。 (Changed by Sean Reifschneider; bpo-8451(79).)

   * The *note sys.version_info: 308. 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(): 10a8. 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: e7. モジュールのデフォルトエラー処理が変更され、致命
     的なエラーを抑制しないようになりました。デフォルトのエラーレベルは
     以前は 0 で、エラーはメッセージとしてデバッグログに書き込まれるだけ
     でしたが、デバッグログはデフォルトでは活性化されていないため、エラ
     ーは顧みられませんでした。デフォルトのエラーレベルは 1 になり、エラ
     ーがあれば例外が送出されます。 (Changed by Lars Gustäbel;
     bpo-7357(82).)

     *note tarfile: e7. は、tar ファイルに追加される *note TarInfo:
     15ce. オブジェクトのフィルタリングをサポートするようになりました。
     *note add(): fb7. を呼び出したとき、オプションの呼び出し可能オブジ
     ェクトである 'filter' 引数を与えることができます。 'filter' オブジ
     ェクトには、ファイルが追加される度に ‘TarInfo’ を渡され、これを変形
     して返せます。このオブジェクトが ‘None’ を返したら、そのファイルは
     結果のアーカイブから除かれます。これは既存の 'exclude' 引数より強力
     で、それゆえこれは非推奨となります。(Added by Lars Gustäbel;
     bpo-6856(83).)  *note TarFile: 15cd. クラスはまた、コンテキストマネ
     ージャプロトコルもサポートするようになりました。(Added by Lars
     Gustäbel; bpo-7232(84).)

   * *note threading.Event: 1518. クラスの *note wait(): 16e0. メソッド
     は、終了時に内部フラグを返すようになりました。 ‘wait()’ は内部フラ
     グが真になるまでブロックすることを想定されているため、この関数は通
     常真を返すことになります。この戻り値は、タイムアウトが与えられ、オ
     ペレーションがタイムアウトした時のみ偽になります。 (Contributed by
     Tim Lesher; bpo-1674032(85).)

   * *note unicodedata: 10e. モジュールに提供される 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: 113. module's *note urlsplit(): 2ae. 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: 113. 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: 11d. モジュールの *note WeakSet: 9dc.
     クラスは、その要素の弱参照だけを保持する集合です。要素は、それを指
     す参照がなくなり次第除去されます。 (Originally implemented in
     Python 3.x by Raymond Hettinger, and backported to 2.7 by Michael
     Foord.)

   * The *note xml.etree.ElementTree: 12e. 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:
     137. and *note SimpleXMLRPCServer: 138. 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: 16e1, 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: 13a. モジュールの *note ZipFile: ab6. は、コンテキス
     トマネジメントプロトコルをサポートし、 ‘with zipfile.ZipFile(...)
     as f:’ と書けるようになりました。 (Contributed by Brian Curtin;
     bpo-5511(93).)

     *note zipfile: 13a. 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(): 16e2. and *note readline(): 16e3. now
     works correctly.  (Contributed by Nir Aides; bpo-7610(95).)

     *note is_zipfile(): 16e4. 関数は、以前受け付けられていたパス名に加
     え、ファイルオブジェクトも受け付けるようになりました。 (Contributed
     by Gabriel Genellina; bpo-4756(96).)

     *note writestr(): 54f. メソッドは、 *note ZipFile: ab6. コンストラ
     クタで指定されたデフォルトの圧縮メソッドをオーバライドする、オプシ
     ョンの '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.18.11.1 新しいモジュール: importlib
.....................................

Python 3.1 includes the *note importlib: 7a. package, a
re-implementation of the logic underlying Python's *note import: 9df.
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(): 92c.

‘import_module(name, package=None)’ はモジュールを import します。
'name' はモジュールまたはパッケージの名前を含む文字列です。
‘..utils.errors’ のように ‘.’ 文字で始まる文字列を与えることで、相対
import も可能です。相対 import では、 'package' 引数は必ず与えられなけれ
ばならず、相対 import のアンカーとして使われるパッケージの名前でなければ
なりません。 *note import_module(): 92c. は、 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: 7a. は、Brett Cannon によって実装され、 Python 3.1 に導
入されました。


File: python.info,  Node: 新しいモジュール sysconfig,  Next: ttk Tk のテーマ付きウィジェット,  Prev: 新しいモジュール importlib,  Up: 新しいモジュールと改良されたモジュール

1.18.11.2 新しいモジュール: sysconfig
.....................................

*note sysconfig: e4. モジュールが Distutils パッケージから引き抜かれ、新
しいトップレベルモジュールになりました。 ‘sysconfig’ は、Python のビルド
プロセスについての以下の情報を得るための関数群を提供しています。コンパイ
ラスイッチ、インストレーションパス、プラットフォーム名、そして Python が
ソースディレクトリから実行されているかどうかです。

モジュールの関数のいくつかを紹介すると:

   * *note get_config_var(): 425. は、Python の Makefile と ‘pyconfig.h’
     ファイルから変数を返します。

   * *note get_config_vars(): 525. は、すべての環境設定変数を含む辞書を
     返します。

   * *note get_path(): 16e7. は、特定のタイプのモジュール、つまり標準ラ
     イブラリ、サイト特有のモジュール、プラットフォーム特有のライブフラ
     リなど、への設定されたパスを返します。

   * *note is_python_build(): 2e9. は、Python ソースツリーからバイナリを
     起動していれば真を、そうでなければ偽を返します。

詳細と関数の完全な一覧は *note sysconfig: e4. ドキュメントを参照してくだ
さい。

Distutils パッケージと *note sysconfig: e4. は Tarek Ziadé によってメン
テナンスされていて、彼は Distutils の新世代版を開発するために Distutils2
パッケージ (source repository at ‘https://hg.python.org/distutils2/’) も
開始しました。


File: python.info,  Node: ttk Tk のテーマ付きウィジェット,  Next: 更新されたモジュール unittest,  Prev: 新しいモジュール sysconfig,  Up: 新しいモジュールと改良されたモジュール

1.18.11.3 ttk: Tk のテーマ付きウィジェット
..........................................

Tcl/Tk 8.5 は、基本的な Tk ウィジェットを最実装しながらより自由な外観の
カスタマイズが広がり、よりネイティブなプラットフォームのウィジェットに似
たテーマ付きウィジェット群を含みます。このウィジェット群は、元は Tile と
呼ばれていましたが、Tcl/Tck リリース 8.5 への追加の際に ("themed Tk" を
略して) Ttk に改名されました。

To learn more, read the *note ttk: 102. 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: 102. 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.18.11.4 更新されたモジュール: unittest
........................................

The *note unittest: 10f. 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: 10f. モジュールのドキュメントを参照してください
。 (Developed in bpo-6001(4).)

*note main(): 1391. 関数は、その他幾つかの新しいオプションを提供します:

   * *note -b: 16eb. や ‘--buffer’ は、標準出力や標準エラーストリームを
     それぞれのテストの間バッファに入れます。テストが通れば、結果の出力
     は全て捨てられます。失敗したら、バッファに入れられた出力が表示され
     ます。

   * *note -c: 16ec. や ‘--catch’ は、control-C による中断をより上品にし
     ます。テストプロセスを即座に中断するのではなく、現在実行中のテスト
     は完了させ、中断までの部分的な結果は報告されます。待ちきれなければ
     、control-C をもう一度押せば、即座に中断されます。

     この control-C ハンドラは、コードがテストされているときや、実行され
     ているテストが独自のシグナルハンドラを定義したとき、シグナルハンド
     ラがすでに設定されていてそして呼び出されたということを知らせること
     で、問題を起こさないようにします。これがまずいなら、 *note
     removeHandler(): 16ed. デコレータを使って、テストが control-C ハン
     ドリングを無効にするべきであると示せます。

   * *note -f: 16ee. や ‘--failfast’ は、テストが失敗したとき、他のテス
     トを続けるのではなく、テストの実行を即座に停止します。 (Suggested
     by Cliff Dyer and implemented by Michael Foord; bpo-8074(5).)

進捗メッセージは、verbose モードで実行したとき、期待された失敗に 'x' を
、期待されない成功に 'u' を表示するようになりました。(Contributed by
Benjamin Peterson.)

テストケースは、テストをスキップするために *note SkipTest: 1392. 例外を
送出します。(bpo-1034053(6)).

*note assertEqual(): 93c, *note assertTrue(): 93a, および *note
assertFalse(): 93b. 失敗のメッセージは、提供する情報量が増えました。
*note TestCase: 536. クラスの *note longMessage: 16ef. 属性を真に設定す
ると、失敗時に、標準のエラーメッセージと追加して提供したメッセージの両方
が表示されます。(Added by Michael Foord; bpo-5663(7).)

*note assertRaises(): 940. メソッドは、実行する呼び出し可能オブジェクト
を与えずに呼び出されたとき、コンテキストハンドラを返すようになりました。
例えば、こう書くことができます:

     with self.assertRaises(KeyError):
         {}['foo']

(Implemented by Antoine Pitrou; bpo-4444(8).)

モジュールレベルおよびクラスレベルの設定と、ティアダウンフィクスチャがサ
ポートされました。モジュールは、 *note setUpModule(): e15. および *note
tearDownModule(): 16f0. 関数を含むことができます。クラスは *note
setUpClass(): e16. および *note tearDownClass(): 16f1. メソッドを含むこ
とができ、これらは (‘@classmethod’ や透過なものを使って) クラスメソッド
として定義しなければなりません。これらの関数とメソッドは、テストランナー
が別のモジュールやクラスのテストケースに切り替えるときに呼び出されます。

メソッド *note addCleanup(): e47. および *note doCleanups(): 16f2. が追
加されました。 ‘addCleanup()’ で、無条件に呼び出されるクリーンアップ関数
を (*note setUp(): 16f3. が失敗したら ‘setUp()’ の後に、そうでなければ
*note tearDown(): 16f4. の後に) 追加できるようにします。これにより、テス
ト中のリソースの配置と解放が簡潔になります。(bpo-5679(9)).

より特化したテストを提供するメソッドがいくつか追加されました。これらのメ
ソッドの多くは、Google のエンジニアたちによってそのテストスイートのため
に書かれました。Gregory P. Smith, Michael Foord, and GvR が、これを
*note unittest: 10f. の Python 版にマージしました。

   * *note assertIsNone(): 1644. および *note assertIsNotNone(): 1645. は
     ひとつの式を取り、その結果が ‘None’ であるか、またはないかを確かめ
     ます。

   * *note assertIs(): 16f5. および *note assertIsNot(): 16f6. は、2 つ
     の値を取り、その評価が同一のオブジェクトであるか、またはないかを確
     かめます。 (Added by Michael Foord; bpo-2578(10).)

   * *note assertIsInstance(): 16f7. および *note assertNotIsInstance():
     16f8. は、結果のオブジェクトが特定のクラス、またはタプルにあるクラ
     スのいずれかのインスタンスであるかを調べます。(Added by Georg
     Brandl; bpo-7031(11).)

   * *note assertGreater(): 16f9, *note assertGreaterEqual(): 16fa,
     *note assertLess(): 16fb, および *note assertLessEqual(): 16fc. は
     、二つの量を比較します。

   * *note assertMultiLineEqual(): 16fd. は 2 つの文字列を比較し、等しく
     なければ、2 文字列の差分をハイライトする有益な比較を表示します。こ
     の比較は、Unicode 文字列が *note assertEqual(): 93c. で比較されると
     きのデフォルトに使われるようになりました。

   * *note assertRegexpMatches(): 941. and *note
     assertNotRegexpMatches(): 943. 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(): 942. 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(): 16fe. および *note assertNotIn(): 16ff. は、
     'first' が 'second' に属するか、または属さないかを調べます。

   * *note assertItemsEqual(): 15e6. tests whether two provided
     sequences contain the same elements.

   * *note assertSetEqual(): 163f. は、2 つの集合が等しいか比較し、エラ
     ーの場合のみ、集合間の差分を報告します。

   * 同様に、 *note assertListEqual(): 1641. および *note
     assertTupleEqual(): 1642. は、指定された型を比較し、差分を説明しま
     すが、完全な値を表示するとはかぎりません。これらのメソッドは、リス
     トやタプルを *note assertEqual(): 93c. で比較するときにデフォルトで
     使われるようになりました。より一般的には、 *note
     assertSequenceEqual(): 1643. は 2 つのシーケンスを比較し、必要なら
     両方のシーケンスが特定の型であるかを調べます。

   * *note assertDictEqual(): 1640. compares two dictionaries and
     reports the differences; it's now used by default when you compare
     two dictionaries using *note assertEqual(): 93c.
     ‘assertDictContainsSubset()’ checks whether all of the key/value
     pairs in 'first' are found in 'second'.

   * *note assertAlmostEqual(): 93e. and *note assertNotAlmostEqual():
     93f. 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(): 1700. は、 *note TestLoader: 798. の
     *note suiteClass: 1701. 属性を適切に受け入れます。(Fixed by Mark
     Roddy; bpo-6866(13).)

   * 新しいフックにより、 *note assertEqual(): 93c. メソッドを拡張して新
     しいデータ型を扱わせられます。 *note addTypeEqualityFunc(): 1702. メ
     ソッドは型オブジェクトと関数を取ります。この関数は、比較される両方
     のオブジェクトが特定の型であるときに使われます。この関数は、2 つの
     オブジェクトを比較し、マッチしなければ例外を送出するべきです。この
     関数が、新しいシーケンス比較メソッドがするように、2 つのオブジェク
     トがなぜマッチしないのかについて追加の情報を提供するのがいいアイデ
     アです。

*note unittest.main(): 1391. はオプションの ‘exit’ 引数を取るようになり
ました。偽の場合、 ‘main()’ は *note sys.exit(): 506. を呼び出さず、これ
により対話型インタプリタから ‘main()’ が使えるようになります。
(Contributed by J. Pablo Fernández; bpo-3379(14).)

*note TestResult: 1525. に、テストランの直前と直後に呼び出される *note
startTestRun(): 1703. および *note stopTestRun(): 1704. が追加されました
。 (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.18.11.5 更新されたモジュール: ElementTree 1.3
...............................................

Python に同梱される ElementTree ライブラリのバージョンが、バージョン 1.3
にアップデートされました。新機能の一部は:

   * 様々な解析関数が、使われる *note XMLParser: e1c. インスタンスを与え
     る 'parser' キーワード引数を取るようになりました。これにより、ファ
     イルの内部エンコーディングをオーバーライドできるようになりました:

          p = ET.XMLParser(encoding='utf-8')
          t = ET.XML("""<root/>""", parser=p)

     Errors in parsing XML now raise a *note ParseError: 1631.
     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(): e5f. 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: 1707. 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(): 1590.  In
     XML mode, you can use the true/false 'xml_declaration' parameter to
     suppress the XML declaration.

   * 新しい *note Element: 34b. メソッド: *note extend(): 1591. はシーケ
     ンスから項目の子に要素を追加します。要素それ自体はシーケンスのよう
     に振る舞うので、子をある要素から別の要素に移すのが簡単です:

          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: 34b. method: *note iter(): 1708. 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: 34b. method: *note itertext(): 1593. 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: 84d. を引き起こすようになりました。コードでは、明示
     するべきです。子の数に興味があるなら ‘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.18.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(): d4d. はスレッドセーフになり、ワーカスレ
     ッドがメイン Python スレッドに通知を投入することができるようになり
     ました。これは特に、非同時性の IO 処理に便利です。(Contributed by
     Kristján Valur Jónsson; bpo-4293(4).)

   * New function: *note PyCode_NewEmpty(): 170a. 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(): 1622. は、既存の
     *note PyErr_NewException(): 1623. と同じように新しい例外クラスを生
     成しますが、新しい例外クラスの docstring を含む、追加の ‘char *’ 引
     数を取ります。(Added by 'lekma' on the Python bug tracker;
     bpo-7033(5).)

   * 新しい関数: *note PyFrame_GetLineNumber(): b6f. はフレームオブジェ
     クトを取り、そのフレームが現在実行している行番号を返します。以前は
     、コードは現在実行しているバイトコード命令のインデクスを得て、それ
     からそのアドレスに対応する行番号を探索する必要がありました。(Added
     by Jeffrey Yasskin.)

   * New functions: *note PyLong_AsLongAndOverflow(): 161f. and *note
     PyLong_AsLongLongAndOverflow(): 1620. 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(): 164f. 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: 170b, *note Py_ISALPHA: 170c, *note Py_ISDIGIT:
     170d, *note Py_ISLOWER: 170e, *note Py_ISSPACE: 170f, *note
     Py_ISUPPER: 1710, *note Py_ISXDIGIT: 1711, *note Py_TOLOWER: 1712,
     および *note Py_TOUPPER: 1713. 。これらすべての関数は、文字を分類す
     る 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(): 1265. 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(): 6c3. によって生成された子プロセスは失敗し
     ていました。これは、子は動作しているスレッド 1 つだけで生成され、そ
     のスレッドが ‘os.fork()’ を処理するからです。他のスレッドが、Python
     のインポートロックのような、ロックを保持していたら、フォークが実行
     されたとき、ロックは新しいプロセスでも "held" としてマークされたま
     まです。しかし、子プロセスでは、他のスレッドは複製されないため、ロ
     ックを解放するものは何もないので、子プロセスは import の実行を続け
     ることができません。

     Python 2.7 は、 *note os.fork(): 6c3. を実行する前に import ロック
     を取得し、また *note threading: f6. モジュールを使って生成された全
     てのロックをクリーンアップします。内部ロックを持っていたり、自身で
     ‘fork()’ を呼び出したりするような C 拡張モジュールは、このクリーン
     アップの恩恵を受けません。

     (Fixed by Thomas Wouters; bpo-1590864(13).)

   * The *note Py_Finalize(): 679. 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: 95f. 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: 2d. によって定義されたグローバルシンボルには、 ‘Py’ ま
     たは ‘_ctypes’ が接頭されるようになりました。(Implemented by Thomas
     Heller; bpo-3102(15).)

   * New configure option: the ‘--with-system-expat’ switch allows
     building the *note pyexpat: 12f. 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.18.12.1 カプセル
..................

Python 3.1 は、拡張モジュールに C API を提供する新しい C データ型 *note
PyCapsule: 162c. を追加しました。カプセルは、本質的には C の ‘void *’ ポ
インタのホルダであり、モジュール属性として利用できるようになります。例え
ば、 *note socket: d4. モジュールの API は ‘socket.CAPI’ として公開され
ていて、 *note unicodedata: 10e. は ‘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(): 1716. は不適合な名前を検知し、偽を
返します。これらのオブジェクトの使用について、より詳しい情報は、 *note
拡張モジュールに C API を提供する: 1717. を参照してください。

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: c9f, 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.18.12.2 ポート特有の変更: Windows
...................................

   * The *note msvcrt: 97. module now contains some constants from the
     ‘crtassem.h’ header file: *note CRT_ASSEMBLY_VERSION: 1719, *note
     VC_ASSEMBLY_PUBLICKEYTOKEN: 171a, and *note
     LIBRARIES_ASSEMBLY_NAME_PREFIX: 171b.  (Contributed by David
     Cournapeau; bpo-4365(1).)

   * The *note _winreg: 11f. module for accessing the registry now
     implements the *note CreateKeyEx(): 171c. and *note DeleteKeyEx():
     171d. functions, extended versions of previously supported
     functions that take several extra arguments.  The *note
     DisableReflectionKey(): 171e, *note EnableReflectionKey(): 171f,
     and *note QueryReflectionKey(): 1720. 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(): 1721. function now works on Windows.  The
     signal value can be the constants *note CTRL_C_EVENT: 1722, *note
     CTRL_BREAK_EVENT: 1723, 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(): 14bb. 関数は、空のパスに対してちゃんと失敗する
     ようになりました。 (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.18.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.18.12.4 ポート特有の変更: FreeBSD
...................................

   * FreeBSD 7.1's ‘SO_SETFIB’ constant, used with the *note socket():
     115e. methods *note getsockopt(): 1096./*note setsockopt(): 1097.
     to select an alternate routing table, is now available in the *note
     socket: d4. 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.18.13 その他の変更と修正
--------------------------

   * ベンチマークスクリプトの 2 つ、 ‘iobench’ および ‘ccbench’, が
     ‘Tools’ ディレクトリに追加されました。 ‘iobench’ は、様々な演算を実
     行している間 *note open(): 333. によって返された組み込みファイル
     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: 1727. 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.18.14 Python 2.7 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

   * The *note range(): d13. function processes its arguments more
     consistently; it will now call *note __int__(): 443. on non-float,
     non-integer arguments that are supplied to it.  (Fixed by Alexander
     Belopolsky; bpo-1533(1).)

   * 文字列 *note format(): 440. メソッドは浮動小数点数および複素数に使
     われるデフォルトの精度を、 *note str(): 1ea. で使われる精度に合わせ
     、小数第 6 位から 12 位に変更しました。 (Changed by Eric Smith;
     bpo-5920(2).)

   * Because of an optimization for the *note with: 215. statement, the
     special methods *note __enter__(): 9cb. and *note __exit__(): 16ba.
     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: e51.) and C extension types.  (bpo-6101(3).)

   * Due to a bug in Python 2.6, the 'exc_value' parameter to *note
     __exit__(): 16ba. 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: 1b4. にならなかったのを修正し
     ました。 (Fixed by Benjamin Peterson; bpo-7604(5).)

標準ライブラリでは:

   * 年がサポートされている範囲外にはみ出るような *note datetime: 6ed. イ
     ンスタンスの演算が、 *note OverflowError: c5b. を送出しないことがあ
     りました。このようなエラーはより注意深く調べられ、例外を送出するよ
     うになりました。(Reported by Mark Leander, patch by Anand B. Pillai
     and Alexander Belopolsky; bpo-7150(6).)

   * *note Decimal: 1cd. インスタンスを文字列の *note format(): 440. メ
     ソッドに使うとき、デフォルトの揃えは以前は左揃えでした。これは右揃
     えに変更され、プログラムの出力が変わるかもしれません。(Changed by
     Mark Dickinson; bpo-6857(7).)

     signaling NaN (あるいは ‘sNAN’) との比較は、暗黙に比較演算に応じて
     真偽値を返すのではなく、 *note InvalidOperation: 1466. 例外を発生さ
     せるようになりました。 Quiet NaN (あるいは ‘NAN’) はハッシュ可能に
     なりました。 (Fixed by Mark Dickinson; bpo-7279(8).)

   * The *note xml.etree.ElementTree: 12e. 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: 12d8. objects now does
     nothing when a negative length is requested, as other file-like
     objects do.  (bpo-7348(10)).

   * *note syslog: e5. モジュールは、識別子として、以前デフォルトであっ
     た ‘'python'’ の値ではなく、 ‘sys.argv[0]’ の値を使うようになりまし
     た。 (Changed by Sean Reifschneider; bpo-8451(11).)

   * *note tarfile: e7. モジュールのデフォルトエラー処理が変更され、致命
     的なエラーを抑制しないようになりました。デフォルトのエラーレベルは
     以前は 0 で、エラーはメッセージとしてデバッグログに書き込まれるだけ
     でしたが、デバッグログはデフォルトでは活性化されていないため、エラ
     ーは顧みられませんでした。デフォルトのエラーレベルは 1 になり、エラ
     ーがあれば例外が送出されます。 (Changed by Lars Gustäbel;
     bpo-7357(12).)

   * The *note urlparse: 113. module's *note urlsplit(): 2ae. 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: 2d4. を引き起こすのではなく、 *note
     TypeError: 29c. 例外を送出するようになりました。(bpo-5080(14))

   * Use the new *note PyOS_string_to_double(): 164f. 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.18.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.18.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.18.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.18.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(): 148a. が 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(): 923. が 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: d8. モジュールのほとんどがバックポートされ
     ました。つまり ‘ssl’ は今や、Server Name Indication, TLS1.x 設定,
     platform certificate store へのアクセス, *note SSLContext: 33e. ク
     ラス, その他機能が使えます (Contributed by Alex Gaynor and David
     Reid; bpo-21308(10).)

     個別の詳細については、モジュールのドキュメンテーション内の "バージ
     ョン 2.7.9 で追加" の注釈を参照してください。

   * *note os.urandom(): 936. は、呼び出しのたびに ‘/dev/urandom’ を開き
     なおす代わりに ‘/dev/urandom’ のファイル記述子をキャッシュするよう
     に変更されました。(Contributed by Alex Gaynor; bpo-21305(11).)

   * *note hashlib.algorithms_guaranteed: 172d. と *note
     hashlib.algorithms_available: 172e. が 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.18.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.18.15.5 デフォルトでの pip のブートストラッピング
...................................................

新しい *note ensurepip: 58. モジュール( 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: 12a7. では ‘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.18.15.6 ドキュメントの変更
............................

この変更の一部は、 *note Python モジュールのインストール: 12a9. と
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++ 拡張のビルド: 12aa. and *note setuptools による C および
C++ 拡張のビルド: 12ab.

参考
....

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.18.15.7 PEP 476: stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化
.....................................................................................

PEP 476(1) updated *note httplib: 71. and modules which use it, such as
*note urllib2: 114. and *note xmlrpclib: 137, 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.18.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.18.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/main/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.18.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.18.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.19 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: 85. といった、いくつか重要な新
しいパッケージが標準ライブラリに追加されましたが、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.19.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():
     156. の追加。

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(): 1662. 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.19.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.19.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.19.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.19.3 PEP 343: "with" ステートメント
-------------------------------------

Python 2.5 では、 '*note with: 215.' 文が ‘from __future__ import
with_statement’ ディレクティブで有効に出来るオプションの機能として追加さ
れました。2.6 では '‘with’' 文は特別に有効化する必要なく、もういつでもそ
こにあります。このセクションの残りの部分は "What's New in Python 2.5" の
対応するセクションからの丸々コピーですので、2.5 で '‘with’' 文に馴染んで
いるなら読み飛ばしてもらって結構です。

'*note with: 215.' ステートメントは、以前なら後片付けが実行されるのを確
実にするために ‘try...finally’ ブロックを使ったであろうようなコードを、
より単純明快にします。このセクションでは、このステートメントの普通の使い
方を説明します。続くセクションでは実装の詳細を調べ、このステートメントと
ともに使うためにオブジェクトをどうやって書けば良いかをお見せします。

'*note with: 215.' ステートメントは基本構造が以下となる制御フロー構造で
す:

     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__(): 9cb. and *note __exit__(): 16ba. methods).

The object's *note __enter__(): 9cb. 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__(): 16ba. method is called, even if the block raised an
exception, and can therefore run clean-up code.

いくつかの Python 標準オブジェクトが既にコンテキスト管理プロトコルをサポ
ートしていて、 '*note with: 215.' とともに使えます。ファイルオブジェクト
がその一例です:

     with open('/etc/passwd', 'r') as f:
         for line in f:
             print line
             ... more processing code ...

このステートメントが実行し終わったあかつきには、 'f' のファイルオブジェ
クトは、たとえ *note for: 329. ループが道半ばにして例外と成り果てても、
自動的にクローズされます。

     注釈: In this case, 'f' is the same object created by *note open():
     333, because *note __enter__(): 9cb. returns 'self'.

*note threading: f6. モジュールのロック・条件変数でも '*note with: 215.'
ステートメントの恩恵にあずかれます:

     lock = threading.Lock()
     with lock:
         # Critical section of code
         ...

ブロックが実行される前にロックが獲得されて、ブロックが完了するやいなや必
ず解放されます。

The *note localcontext(): 1740. function in the *note decimal: 39.
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.19.3.1 コンテキストマネージャを書く
.....................................

中身を紐解いてみれば、 '*note with: 215.' ステートメントはけっこう入り組
んでいます。ほとんどの人にとっては、既存のオブジェクトを '‘with’' ととも
に使うだけのことでその詳細を知る必要は無いので、それで良いならこのセクシ
ョンの残りの部分は読み飛ばして結構です。新しいオブジェクトの作者は基礎と
なる実装の詳細について知る必要があるので、このまま読み進めるべきです。

コンテキスト管理プロトコルの高度な説明はこんなです:

   * The expression is evaluated and should result in an object called a
     "context manager".  The context manager must have *note
     __enter__(): 9cb. and *note __exit__(): 16ba. methods.

   * The context manager's *note __enter__(): 9cb. 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__(): 16ba. method is called with three arguments, the
     exception details (‘type, value, traceback’, the same values
     returned by *note sys.exc_info(): a7f, 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: 215.' statement will never realize
     anything went wrong.

   * If 'BLOCK' didn't raise an exception, the *note __exit__(): 16ba.
     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__(): 9cb. 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: 215.' 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__(): 16ba. 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:
452. 文を書いてもよろしいです:

     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.19.3.2 contextlib モジュール
..............................

*note contextlib: 27. モジュールは、 '*note with: 215.' ステートメントで
使えるオブジェクトを書く際に便利ないくつかの関数とデコレータを提供してい
ます。

The decorator is called *note contextmanager(): 219, 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: d97. will be executed as the *note __enter__(): 9cb. method, and
the value yielded will be the method's return value that will get bound
to the variable in the '*note with: 215.' statement's ‘as’ clause, if
any.  The code after the ‘yield’ will be executed in the *note
__exit__(): 16ba. 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: 215.' を書く必要性をなくしてくれます。この例では
、単一の '‘with’' でデータベーストランザクション開始とスレッドのロック獲
得の両方をやってのけています:

     lock = threading.Lock()
     with nested (db_transaction(db), lock) as (cursor, locked):
         ...

Finally, the *note closing(): 3f3. 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: 215.' ステートメントによって生成されるコードを見せてく
     れるので、このステートメントがどうやって動作するのかを知るのに役立
     ちます。

*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.19.4 PEP 366: メインモジュールからの明示的相対インポート
----------------------------------------------------------

Python のオプション *note -m: 4d1. で、モジュールをスクリプトとして実行
出来ます。パッケージ内のモジュールを実行する際に、相対インポートが正しく
動作していませんでした。

The fix for Python 2.6 adds a *note module.__package__: 593. attribute.
When this attribute is present, relative imports will be relative to the
value of this attribute instead of the *note __name__: 1744. attribute.

PEP 302-style importers can then set *note __package__: 593. as
necessary.  The *note runpy: c6. module that implements the *note -m:
4d1. 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.19.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: 1746. 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: 1747. オプションを付けるか、環境変
数 *note PYTHONNOUSERSITE: 1748. をセットすることで完全に無効に出来ます
。

参考
....

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.19.6 PEP 371: ‘multiprocessing’ パッケージ
--------------------------------------------

新しい *note multiprocessing: 98. により、Python プログラムが新たなプロ
セスを作成して何か計算を実行させて結果を返させることが出来ます。親と子の
プロセスはキューとパイプを使って通信し、ロックとセマフォを使って同期し、
単純なデータの配列を共有出来ます。

The *note multiprocessing: 98. module started out as an exact emulation
of the *note threading: f6. 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: 4e5, which is passed a callable object and a collection
of arguments.  The *note start(): 174a. method sets the callable running
in a subprocess, after which you can call the *note is_alive(): 174b.
method to check whether the subprocess is still running and the *note
join(): 174c. 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: 174d. が factorial の結果を通信して返すのに使われています。
‘Queue’ オブジェクトはグローバル変数に格納されています。子プロセスは、子
プロセスが作成された時点のその変数の値を使うことになります; ‘Queue’ なの
で、親子はそのオブジェクトを通信のために使うことが出来ます。(プロセス作
成後に親がグローバル変数 queue を差し替えても、子の値は左右されませんし
、逆もしかりです。)

Two other classes, *note Pool: 131a. and *note Manager: 4e3, 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(): 174e. or *note apply_async(): 174f. to add a
single request, and *note map(): 14a4. or *note map_async(): 14a5. 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: 4e3. 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(): 193. 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(): 1750, *note RLock():
1751, and *note Semaphore(): 1752. 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(): 440.  Support for the *note
str.format(): a17. 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: 1754. を調べてみてください。以下はその一部です:

‘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__(): a15. 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(): 440. builtin that will format a single
value.  It calls the type's *note __format__(): a15. method with the
provided specifier:

     >>> format(75.6564, '.2f')
     '75.66'

参考
....

*note Format string syntax: 1754.

     リファレンスドキュメント。

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.19.8 PEP 3105: ‘print’ を関数にする
-------------------------------------

‘print’ 文は Python 3.0 では *note print(): 1324. 関数になります。
‘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.19.9 PEP 3110: 例外処理の変更
-------------------------------

Python プログラマが時折やらかしてしまう誤りの一つにこんなのがあります:

     try:
         ...
     except TypeError, ValueError:  # Wrong!
         ...

このコードの作者はきっと *note TypeError: 29c. 例外と *note ValueError:
15a. 例外の両方とっつかまえてやろうと思ったのでしょうが、このコードは実
際にはちょっと違ったことをします: ‘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.19.10 PEP 3112: バイトリテラル
--------------------------------

Python 3.0 は Unicode を言語の基本文字列型として採用し、8 ビットリテラル
は異なった記法で指示します。それには ‘b'string'’ とするか、 *note bytes:
1d2. のコンストラクタを用います。前方互換のために、Python 2.6 は *note
str: 1ea. 型に対する別名として ‘bytes’ を追加のうえで、 ‘b''’ 記法もサポ
ートします。

2.6 の *note str: 1ea. 型は 3.0 の *note bytes: 1d2. 型とは色んな意味で
違います; 一番顕著なのは、コンストラクタがまったく異なることです。3.0 で
の ‘bytes([65, 66, 67])’ は 3 つのバイトで ‘ABC’ を構築しますが、2.6 で
の ‘bytes([65, 66, 67])’ は引数のリストを *note str(): 1ea. で文字列化し
た 12 バイト文字列を返します。

2.6 での *note bytes: 1d2. の主な使いみちはオブジェクトの型のテストに
‘isinstance(x, bytes)’ とすることでしょう。またこれは、 2.x コードが文字
列として ASCII 文字と 8 ビットバイトのどちらを意図しているのか知ることが
出来ない 2to3 コンバータの助けになります; あなたは今や ‘bytes’ と *note
str: 1ea. の区別を、あなたの意図を正確に表現するのに使えます。そして結果
のコードは 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: b76.
Python 2.6 uses ‘#define’ to support using the names *note
PyBytesObject(): b76, *note PyBytes_Check(): 1758, *note
PyBytes_FromStringAndSize(): 3ba, and all the other functions and macros
used with strings.

*note bytes: 1d2. 型のインスタンスは単に文字列と同じで *note immutable:
18c. です。 *note bytearray: 1d1. 型が、バイト列を *note mutable: 1759.
シーケンスとして格納するものとして新しく追加されました:

     >>> 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(): 175a./*note endswith(): 175b, *note find(): 175c./*note
rfind(): 175d, and some of the methods of lists, such as *note append():
175e, *note pop(): 175f, and *note reverse(): 1760.

     >>> b = bytearray('ABC')
     >>> b.append('d')
     >>> b.append(ord('e'))
     >>> b
     bytearray(b'ABCde')

対応する C API もあります。 *note PyByteArray_FromObject(): 1761, *note
PyByteArray_FromStringAndSize(): 1762. や色々その他関数です。

参考
....

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.19.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: 82. module that separates buffering and
text-handling features from the fundamental read and write operations.

*note io: 82. モジュールによって提供される抽象基底クラスには 3 つのレベ
ルがあります:

   * *note RawIOBase: 1490. defines raw I/O operations: *note read():
     11d4, *note readinto(): 11d5, *note write(): 1764, *note seek():
     1646, *note tell(): 1765, *note truncate(): 16ca, and *note
     close(): 711.  Most of the methods of this class will often map to
     a single system call.  There are also *note readable(): 1766, *note
     writable(): 1767, and *note seekable(): 1768. methods for
     determining what operations a given object will allow.

     Python 3.0 はこのクラスのファイルとソケットに対する具象実装を持って
     いますが、Python 2.6 はファイル、ソケットオブジェクトのこの方法での
     再構築はしていません。

   * *note BufferedIOBase: a88. 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: 1490, and adds a *note raw: 1769. attribute
     holding the underlying raw object.

     There are five concrete classes implementing this ABC. *note
     BufferedWriter: 176a. and *note BufferedReader: 15cb. are for
     objects that support write-only or read-only usage that have a
     *note seek(): 1646. method for random access.  *note
     BufferedRandom: 176b. objects support read and write access upon
     the same underlying stream, and *note BufferedRWPair: 176c. is for
     objects such as TTYs that have both read and write operations
     acting upon unconnected streams of data.  The *note BytesIO: 1258.
     class supports reading, writing, and seeking over an in-memory
     buffer.

   * *note TextIOBase: a89.: Provides functions for reading and writing
     strings (remember, strings will be Unicode in Python 3.0), and
     supporting *note universal newlines: 10f5.  ‘TextIOBase’ defines
     the *note readline(): c2. method and supports iteration upon
     objects.

     There are two concrete implementations.  *note TextIOWrapper: ba0.
     wraps a buffered I/O object, supporting all of the methods for text
     I/O and adding a *note buffer: 165d. attribute for access to the
     underlying object.  *note StringIO: 12d8. simply buffers everything
     in memory without ever writing anything to disk.

     (In Python 2.6, *note io.StringIO: 12d8. 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: 82. 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: 82. モジュールのクラスの上に組
み立てられるようには再構築されていません (訳注: 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.19.12 PEP 3118: 改訂版バッファプロトコル
------------------------------------------

バッファプロトコルは Python 型にその内部表現へのポインタをやりとりさせる
、C レベル API です。例えば、メモリマップドファイルは文字のバッファとし
て見ることが出来ます。そしてこれは *note re: c1. のようなほかのモジュー
ルが、それを文字列として扱って検索するようなことを許します。

バッファプロトコルの主なユーザは 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(): 832. への 'flags' 引数は返されるメモリについ
ての制約条件を指定します。いくつかの例として:

   * *note PyBUF_WRITABLE: 176e. indicates that the memory must be
     writable.

   * ‘PyBUF_LOCK’ requests a read-only or exclusive lock on the memory.

   * *note PyBUF_C_CONTIGUOUS: 176f. and *note PyBUF_F_CONTIGUOUS: 1770.
     requests a C-contiguous (last dimension varies the fastest) or
     Fortran-contiguous (first dimension varies the fastest) array
     layout.

*note PyArg_ParseTuple(): 3b9. のための 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.19.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: 12cd, special handling of
this metaclass by the *note isinstance(): 2fb. and *note issubclass():
2fc. 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__(): 1031, and ‘Container’ means the
class defines a *note __contains__(): 1772. 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(): 1445. method:

     import collections

     class Storage:
         ...

     collections.MutableMapping.register(Storage)

For classes that you write, deriving from the ABC is probably clearer.
The *note register(): 1445. 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: 1442. 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.19.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(): 1688. はまだ先行ゼロ形式での表現を返します。
新しいビルトイン関数 *note bin(): 1662. は数値の 2 進数表現を返します:

     >>> oct(42)
     '052'
     >>> future_builtins.oct(42)
     '0o52'
     >>> bin(173)
     '0b10101101'

ビルトイン *note int(): 32e, ‘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.19.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.19.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: 60. モジュールに追加してい
ます。(‘Rational’ ではなく ‘Fraction’ なのは、 *note numbers.Rational:
1678. と名前が衝突するのを避けるためです。)

‘Integral’ 数は ‘Rational’ からの派生で、シフト演算 ‘<<’, ‘>>’ が出来て
、 ‘&’ や ‘|’ のようなビット演算で混ぜ合わせることができて、また、配列の
インデクスとスライスの境界として使えます。

Python 3.0 では、その PEP は少し既存のビルトイン *note round(): 1694,
*note math.floor(): 1776, *note math.ceil(): 1777. を再定義していて、ま
た、Python 2.6 にバックポートされている新しい *note math.trunc(): 1778.
を追加しています。 ‘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.19.16.1 ‘fractions’ モジュール
................................

数値型階層を埋めるべく、 *note fractions: 60. モジュールが有理数クラスを
提供しています。有理数は分子(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: 60. モジュールは、ずっと長い間 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.19.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(): 8e7. 関数は ‘__getattr__()’ メソッドが例外を起こす
     と何か失敗したのだと仮定して、全て捕捉して無視して ‘False’ を返して
     いました。ですがそのロジックは *note KeyboardInterrupt: d9a. と
     *note SystemExit: 10fb. まで捕まえるべきではなかったのです。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: fbe. 例外を起こします。 (Backported in bpo-2719(5).)

   * Tuples now have *note index(): 177b. and *note count(): 177c.
     methods matching the list type's *note index(): 177d. and *note
     count(): 177e. 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(): 32f. 関
     数は文字列 ‘nan’ を IEEE 754 非数 (Not A Number) 値に変換し、
     ‘+inf’ と ‘-inf’ は正あるいは負の無限大に変換します。これは IEEE
     754 セマンティクスのあらゆるプラットフォームで動作します。
     (Contributed by Christian Heimes; bpo-1635(6).)

     ほか *note math: 91. モジュールに ‘isinf()’ と ‘isnan()’ が追加され
     ています; 浮動小数点数が、前者は無限大ならば、後者は非数ならばそれ
     ぞれ真を返します。 (bpo-1640(7))

     浮動小数点数を 16 進表記文字列に変換する変換関数が追加されています
     (bpo-3008(8))。これら関数は 10 進と 2 進との間の変換で起こる丸め誤
     差を持ち込まずに浮動小数点数と文字列表現の相互変換をします。浮動小
     数点数は文字列表現を返す *note hex(): 1689. メソッドを持ち、また、
     ‘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(): 330. コンス
     トラクタがゼロの符号を維持するようになりました。 (Fixed by Mark T.
     Dickinson; bpo-1507(9).)

   * ‘__hash__()’ メソッドを親クラスから継承するクラスは、ハッシュ出来な
     いことを示すのに ‘__hash__ = None’ をセット出来ます。これにより
     ‘hash(obj)’ は *note TypeError: 29c. を起こし、そのクラスは
     ‘Hashable’ ABC を実装していないことを示します。

     ‘__cmp__()’ か ‘__eq__()’ を定義するのにその比較にオブジェクトの身
     元ではなくその値を使ったならば、あなたはこれをすべきです。全てのオ
     ブジェクトはその値として ‘id(obj)’ を使うデフォルトのハッシュ化メソ
     ッドを持っています。親クラスから継承した ‘__hash__()’ を削除する整
     理された方法はありません。ですのでオーバライドとしての ‘None’ の代
     入が実装されました。 C API のレベルでは、拡張は ‘tp_hash’ に *note
     PyObject_HashNotImplemented(): 177f. をセット出来ます。 (Fixed by
     Nick Coghlan and Amaury Forgeot d'Arc; bpo-2235(10).)

   * *note GeneratorExit: 1780. 例外が *note Exception: da2. ではなく
     *note BaseException: 9bd. のサブクラスになっています。 ‘except
     Exception:’ をする例外ハンドラが意図せず ‘GeneratorExit’ 捕捉してし
     まうことがなくなります。 (Contributed by Chad Austin;
     bpo-1537(11).)

   * ジェネレータオブジェクトが、そのジェネレータを返すオリジナルのコー
     ドオブジェクトを参照する ‘gi_code’ 属性を持つようになりました。
     (Contributed by Collin Winter; bpo-1473257(12).)

   * ビルトイン関数 *note compile(): 1d3. が位置引数だけでなくキーワード
     引数も受け付けるようになりました。 (Contributed by Thomas Wouters;
     bpo-1444529(13).)

   * *note complex(): 330. コンストラクタが括弧で囲まれた複素数表現文字
     列を受け付けるようになっています。 ‘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(): a28. 関数が、受け取ったオブジェクトの
     ‘__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__: 1781, and ‘im_func’ is also available as *note
     __func__: 16b6.  The old names are still supported in Python 2.6,
     but are gone in 3.0.

   * 目立たない変更: *note locals(): 296. 関数を *note class: 1691. ステ
     ートメント内で使う際、結果の辞書はもはや自由変数を返しません。(この
     場合、自由変数は ‘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.19.17.1 最適化
................

   * *note warnings: 11b. モジュールが 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: 1783. を追
     加しなければなりません。(このメソッドキャッシュに対して互換であるた
     めには、拡張モジュールのコードは、それが実装するどんな型についても
     ‘tp_dict’ メンバに直接アクセスしたり修正したりしてはなりません。ほ
     とんどのモジュールはこれをしていませんが、Python インタプリタがそれ
     を検知することは出来ません。 bpo-1878(3) にいくらかの議論があります
     ので参照してください。)

   * キーワード引数を使う関数呼び出しが、素早くポインタで比較することで
     顕著に高速化しています。これは常に文字列丸ごとを比較する時間を省き
     ます。 (Contributed by Raymond Hettinger, after an initial
     implementation by Antoine Pitrou; bpo-1819(4).)

   * *note struct: de. モジュールの全ての関数が 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__(): 16ba. 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.19.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: 183. 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: 1786. スイッチを渡すか、インタプリタ実行
前に環境変数 *note PYTHONDONTWRITEBYTECODE: 1787. をセットするかのどちら
かで、 ‘.pyc’ や ‘.pyo’ が作られないようにすることが出来るようになりまし
た。この設定は Python プログラムから ‘sys.dont_write_bytecode’ 変数とし
て利用可能で、Python コードはこの変数を変更してインタプリタの振る舞いを
変えることが出来ます。 (Contributed by Neal Norwitz and Georg Brandl.)

標準入力、標準出力、標準エラー出力に使うエンコーディングを、インタプリタ
起動前に環境変数 *note PYTHONIOENCODING: 13b8. を設定することで指定出来
るようになりました。値は ‘<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.19.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: 113. module.  The
     versions still available in the ‘cgi’ module will trigger *note
     PendingDeprecationWarning: c9f. 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: 74. module's *note Morsel: fc7. objects now
     support an *note httponly: 1789. 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: 2e. モジュールの新しい 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: 31. モジュールの ‘Textbox’ クラスが上書きモー
     ドのほかに挿入モード編集をサポートするようになりました。挿入モード
     は ‘Textbox’ インスタンス構築時に 'insert_mode' パラメータを真にす
     ることで有効になります。

   * *note datetime: 33. モジュールの ‘strftime()’ メソッドが ‘%f’ 書式
     化コードをサポートするようになりました。これはオブジェクトのマイク
     ロ秒をミリ秒としてゼロ埋めで 6 桁で展開します。 (--訳注: 言葉だけだ
     とどうしても伝わりにくいですが、フィールドとしてミリ秒を持たずにマ
     イクロ秒を持っている datetime で「秒.ミリ秒」という表記をするのにマ
     イクロ秒精度まで表示するのが目的です。ですので 654 ミリ秒が「
     654000」と書式化されますし、32 ミリ秒は「032000」です。--)
     (Contributed by Skip Montanaro; bpo-1158(7).)

   * The *note decimal: 39. 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: 3a. モジュールの ‘SequenceMatcher’ クラスが、マッチ
     を ‘a’, ‘b’, ‘size’ 属性を持つ名前付きタプルで返すようになりました
     。 (Contributed by Raymond Hettinger.)

   * *note ftplib.FTP: cce. クラスのコンストラクタと ‘connect()’ メソッ
     ドに省略可能 ‘timeout’ パラメータが追加されました。タイムアウトを秒
     で指定します。(Added by Facundo Batista.)  また、 ‘FTP’ クラスの
     ‘storbinary()’ と ‘storlines()’ メソッドが 'callback' パラメータを
     新たに受け取ります。これはデータが送信されたあとでデータの各ブロッ
     クごとに呼び出されます。 (Contributed by Phil Schwartz;
     bpo-1221598(9).)

   * ビルトイン関数の ‘reduce()’ が *note functools: 62. モジュールでも
     利用可能です。Python 3.0 ではビルトイン関数は削除されて ‘functools’
     のものだけが使えます; 現在のところ 2.x シリーズでビルトイン版を削除
     する計画はありません。 (Patched by Christian Heimes;
     bpo-1739906(10).)  (--訳注: 2.7 でも削除されていません。使用を検出
     するには ‘-3’ オプションなどで警告をチェックしてください。 --)

   * 可能な場合には、 *note getpass: 65. モジュールはプロンプトメッセー
     ジ出力とパスワードの読み取りに ‘/dev/tty’ を使うようになりました。
     利用出来ない場合は標準エラー出力と標準入力が使われます。端末に入力
     パスワードがエコーされるかもしれない場合、プロンプト表示の前に警告
     が出力されます。 (Contributed by Gregory P. Smith.)

   * *note glob.glob(): 2df. 関数が、Unicode パスが使われるかディレクト
     リ内に Unicode ファイル名がマッチすると Unicode ファイル名を返すよ
     うになりました。 (bpo-1001604(11))

   * *note heapq: 6c. モジュールの新しい関数 ‘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: 6c. は以前使っていた「以下(‘<=’)」比較ではなく「より小
     さい(‘<’)」比較だけを使って実装されています。これにより ‘heapq’ に
     格納する型の要件が *note list.sort(): f91. メソッドに合致します。
     (Contributed by Raymond Hettinger.)

   * An optional ‘timeout’ parameter, specifying a timeout measured in
     seconds, was added to the *note httplib.HTTPConnection: 22e. and
     *note HTTPSConnection: 22f. class constructors.  (Added by Facundo
     Batista.)

   * ‘getmoduleinfo()’ や ‘getargs()’ のようなほとんどの *note inspect:
     81. モジュール関数が、名前付きタプルを返すようになりました。タプル
     のように振る舞うだけでなく、属性でアクセスすることも出来ます。
     (Contributed by Raymond Hettinger.)

     モジュールには ‘isgenerator()’, ‘isgeneratorfunction()’,
     ‘isabstract()’ を含むいくつかの新しい関数が追加されています。

   * *note itertools: 84. モジュールにいくつかの関数が追加されています。

     ‘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: 84. に元々いたも
     のですが、新しい構築方法が出来ました。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: 8a. モジュールの ‘FileHandler’ クラスとそのサブクラ
     スの ‘WatchedFileHandler’, ‘RotatingFileHandler’,
     ‘TimedRotatingFileHandler’ がそのコンストラクタで省略可能 'delay' パ
     ラメータを受け取るようになりました。 'delay' が真の場合、ログファイ
     ルのオープンは最初の ‘emit()’ が呼び出されるまで延期されます。
     (Contributed by Vinay Sajip.)

     ‘TimedRotatingFileHandler’ ではコンストラクタに 'utc' パラメータも
     取るようになっています。これが真の場合、 ‘when='midnight'’ などの切
     り替え時刻判定とその生成ファイル名に UTC が使われます。

   * いくつかの新しい関数が *note math: 91. モジュールに追加されました:

        * *note isinf(): 178a. と *note isnan(): 178b. は与えられた浮動
          小数点数が、順に、(正または負の) 無限大であるかどうか、非数
          (NaN=Not a Number) であるかどうかを返します。

        * *note copysign(): 178c. は IEEE 754 数の符号ビットをコピーしま
          す。 'x' の絶対値と 'y' の符号ビットを組み合わせたものを返しま
          す。例えば ‘math.copysign(1, -0.0)’ は -1.0 を返します。
          (Contributed by Christian Heimes.)

        * *note factorial(): d17. は階乗を計算します。 (Contributed by
          Raymond Hettinger; bpo-2138(12).)

        * *note fsum(): 178d. はイテラブルからの数列を、部分和の計算を通
          じて精度の損失を避けながら積み上げた合計の計算をします。
          (Contributed by Jean Brouwers, Raymond Hettinger, and Mark
          Dickinson; bpo-2819(13).)

        * *note acosh(): 178e, *note asinh(): 178f, *note atanh(): 1790.
          は逆双曲線関数を計算します。

        * *note log1p(): 1791. は '1+x' の自然対数 (底 'e' の対数) を返
          します。

        * ‘trunc()’ はゼロに向かう方向に丸めを行い、与えられた引数とゼロ
          に最も近い ‘Integral’ を返します。これは *note PEP 3141;
          数値の型階層: 1677. のバックポートの一部として追加されました。

   * *note math: 91. モジュールは、特に浮動小数点例外と IEEE 754 の特殊
     値の処理において、プラットフォーム間に渡る振る舞いの一貫性をさらに
     高めるように改善されました。

     可能な場合にはいつでもこのモジュールは 754 の特殊値について、C99 標
     準の勧告に従います。例えば、 ‘sqrt(-1.)’ は今ではほとんど全てのプラ
     ットフォームで *note ValueError: 15a. となるはずで、
     ‘sqrt(float('NaN'))’ は全ての IEEE 754 プラットフォームで NaN を返
     すはずです。C99 標準の付録 'F' で 'divide-by-zero' または 'invalid'
     を伝えることを勧告している箇所では Python は ‘ValueError’ を投げま
     す。C99 標準の付録 'F' で 'overflow' を伝えることを勧告している箇所
     では Python は *note OverflowError: c5b. を投げます。 (See
     bpo-711019(14) and bpo-1640(15).)

     (Contributed by Christian Heimes and Mark Dickinson.)

   * *note mmap: 247. オブジェクトに ‘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: d9. モジュールに定義されています; いくつ
     かの取りうる値には、ファイルが変更されるべきではないことを伝える
     ‘UF_IMMUTABLE’ 、ファイルにはデータの追記のみが可能であることを伝え
     る ‘UF_APPEND’ 、があります。 (Contributed by M. Levinson.)

     ‘os.closerange(low, high)’ は効率よく全ての 'low' から 'high' のフ
     ァイルデスクリプタをクローズします。全てのエラーは無視されます。そ
     れと 'high' はクローズ対象ではないです。この関数は既に *note
     subprocess: df. モジュールがプロセスを開始するのを高速化するために
     使われています。 (Contributed by Georg Brandl; bpo-1663329(16).)

   * ‘os.environ’ オブジェクトの ‘clear()’ メソッドが、オブジェクトのキ
     ーから取り除くだけでなく *note os.unsetenv(): 4ef. を使って環境変数
     を未設定にするようになりました。 (Contributed by Martin Horcicka;
     bpo-1181(17).)

   * *note os.walk(): 8be. 関数に ‘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(): 1792. が "%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(): 1793. が、トレースバックが与えられない場合に
     *note sys.exc_info(): a7f. からの戻り値のトレースバックを使うように
     なりました。 (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: c0. モジュールの ‘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: c1. モジュールによって実行される長い正規表現検索が届けら
     れるシグナルをチェックするようになり、これにより多大な時間を要する
     検索を中断出来るようになります。 (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: c5. module's ‘Completer.complete()’ method
     will now ignore exceptions triggered while evaluating a name.
     (Fixed by Lorenz Quack; bpo-2250(30).)

   * *note sched: c7. モジュールの ‘scheduler’ インスタンスが読み出し専
     用の *note queue: be. 属性を持つようになりました。これはスケジュー
     ラのキュー内容を名前付きタプル ‘(time, priority, action, argument)’
     で返します。 (Contributed by Raymond Hettinger; bpo-1861(31).)

   * The *note select: c9. 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(): df1. が省略可能引数 'ignore' を取るように
     なっています。呼び出し可能オブジェクトを渡します。この呼び出し可能
     オブジェクトはそれぞれのディレクトリパスとその内容リストを受け取っ
     て、コピーせずに無視したい名前のリストを返します。

     *note shutil: cd. モジュールでは同時に、この新たなパラメータのため
     に使える ‘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: ce. モジュールが、これをより効率的に行えるようにしま
     した。 ‘signal.set_wakeup_fd(fd)’ でファイルデスクリプタをセットす
     ると、イベント受信時にファイルデスクリプタにバイトが書き込まれます
     。 C レベルの関数 *note PySignal_SetWakeupFd(): 1794. もあります。
     同じくファイルデスクリプタを渡します。

     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: d2. モジュールが、 ‘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: d4. 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: d5. module now support
     calling a *note handle_timeout(): 16db. method after a span of
     inactivity specified by the server's *note timeout: 16da.
     attribute.  (Contributed by Michael Pomraning.)  The *note
     serve_forever(): 1500. 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: d7. モジュールが
     、Python 2.5 時のバージョン 2.3.2 からバージョン 2.4.1 に更新されま
     した。

   * The *note struct: de. module now supports the C99 _Bool type, using
     the format character ‘'?'’.  (Contributed by David Remahl.)

   * The *note Popen: 6c5. objects provided by the *note subprocess: df.
     module now have *note terminate(): 1795, *note kill(): 1796, and
     *note send_signal(): 1797. methods.  On Windows, ‘send_signal()’
     only supports the *note SIGTERM: 1798. signal, and all these
     methods are aliases for the Win32 API function
     ‘TerminateProcess()’.  (Contributed by Christian Heimes.)

   * *note sys: e2. モジュールに新たに追加された変数 ‘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: 1786. スイッチ付きで起動するか環境変数
     *note PYTHONDONTWRITEBYTECODE: 1787. をセットすることで初期設定され
     ます。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():
     1799. と *note sys.gettrace(): 179a. で知ることが出来るようになりま
     した。 (Contributed by Georg Brandl; bpo-1648(45).)

   * *note tarfile: e7. モジュールが、既にサポートされている
     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: 8db. クラスは普通はこれが作った
     一時ファイルを、ファイルクローズ時に削除します。この振る舞いを、コ
     ンストラクタのパラメータに ‘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: ed. module gained a number of context
     managers useful for writing tests.  *note EnvironmentVarGuard():
     179b. 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: f5. 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: f6. モジュールの 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: f6. モジュールの ‘Thread’ オブジェクトに ‘ident’ プ
     ロパティが追加されています。スレッドの識別子を非ゼロの整数で返しま
     す。 (Contributed by Gregory P. Smith; bpo-2871(50).)

   * *note timeit: f8. モジュールが、計測されるステートメントとセットア
     ップコードとして、文字列だけでなく呼び出し可能オブジェクトを渡せる
     ようになりました。 ‘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: 10a. モジュールが
     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: 586. 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: 10e. モジュールで提供される Unicode データベース
     が、バージョン 5.1.0 に更新されました。 (Updated by Martin von
     Löwis; bpo-3811(54).)

   * *note warnings: 11b. モジュールの ‘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: 138. 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: 137. module no longer automatically converts
     *note datetime.date: 494. and *note datetime.time: 495. to the
     *note xmlrpclib.DateTime: 179c. 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: 13a. モジュールの ‘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(): 333, ‘read()’, ‘extract()’ メソッドはファイル名か
     ‘ZipInfo’ オブジェクトのどちらかを受け取れるようになっています。こ
     れは誤って重複したファイル名を含んでいるアーカイブで有用でしょう。
     (Contributed by Graham Horler; bpo-1775025(62).)

     最後に、 *note zipfile: 13a. がアーカイブするファイルのファイル名と
     して 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.19.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(): 18f. を呼び出すこと
によるセキュリティリスクを許容出来ないということであれば、
‘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.19.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(): 462. と同じことをします。Python
     3.0 では ‘repr()’ は Unicode 文字列を返すようになっていて、一方
     *note ascii(): 179f. は純粋な ASCII バイト文字列を返します。

   * ‘filter(predicate, iterable)’, ‘map(func, iterable1, ...)’: 3.0 と
     同じようにイテレータを返し、これは 2.x のビルトインがリストで返すの
     とは違っています。

   * ‘hex(value)’, ‘oct(value)’: ‘__hex__()’ と ‘__oct__()’ メソッドを呼
     び出すのではなく、 ‘__index__()’ メソッドを呼び出した結果を
     hexadecimal または octal に変換します。こちらのバージョンの *note
     oct(): 1688. は新しい ‘0o’ 記法で返却します。


File: python.info,  Node: json モジュール JavaScript オブジェクト記法,  Next: plistlib モジュール プロパティリストパーサ,  Prev: The future_builtins module,  Up: 新しいモジュールと改良されたモジュール<2>

1.19.18.3 ‘json’ モジュール: JavaScript オブジェクト記法
........................................................

新しい *note json: 85. モジュールは、JSON (Javascript Object Notation) と
Python 型のエンコーディング、デコーディングをサポートします。JSON は軽量
なデータ交換フォーマットで、頻繁にウェブアプリケーションで使われます。
JSON の詳細情報は ‘http://www.json.org’ にあります。

*note json: 85. モジュールはほとんどのビルトイン型のデコーディングとエン
コーディングサポートを備えています。以下の例は辞書のエンコードとデコード
をしています:

     >>> 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: 85. (もともと simplejson と呼ばれていました) は Bob Ippolito
によって書かれました。


File: python.info,  Node: plistlib モジュール プロパティリストパーサ,  Next: ctypes の強化,  Prev: json モジュール JavaScript オブジェクト記法,  Up: 新しいモジュールと改良されたモジュール<2>

1.19.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.19.18.5 ctypes の強化
.......................

Thomas Heller は *note ctypes: 2d. モジュールの保守と拡張を続けました。

*note ctypes: 2d. は今では C99 ‘bool’ 型を表す ‘c_bool’ データ型をサポー
トします。 (Contributed by David Remahl; bpo-1649190(1).)

*note ctypes: 2d. の string, buffer, array 型が拡張スライスインデクス構
文をサポートするように改善され、 ‘(start, stop, step)’ の色々な組み合わ
せが使えます。 (Implemented by Thomas Wouters.)

全ての *note ctypes: 2d. データ型が ‘from_buffer()’,
‘from_buffer_copy()’ メソッドをサポートするようになりました。これは与え
られた buffer オブジェクトに基く ctypes インスタンスを作ります。
‘from_buffer_copy()’ はそのオブジェクトの内容をコピーし、
‘from_buffer()’ はその同じメモリ領域を共有します。

新しい呼び出しの慣例は、 *note ctypes: 2d. にそれぞれのラップされた呼び
出しの発生時に ‘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.19.18.6 SSL サポートの改善
............................

Bill Janssen は Python 2.6 の Secure Sockets Layer サポートを大掛かりに
改善しました。行われたのは新モジュール *note ssl: d8. の追加です。これは
OpenSSL(1) ライブラリの上に構築されています。この新しいモジュールはプロ
トコルのネゴシエイトのさらなる制御、X.509 証明書の使用、そして SSL サー
バ (クライアントの対語としての) を Python で書くためのより良いサポートを
提供しています。既存の *note socket: d4. モジュールにある SSL サポートは
削除されずにそのまま使えますが、Python 3.0 では削除されます。

この新たなモジュールを使うには、まず最初にいつものやり方で TCP コネクシ
ョンを作らなければなりません。そしてその上でそれを ‘ssl.wrap_socket()’ 関
数に渡します (--訳注: 2.7.9 ではさらに進化した ‘SSLContext.wrap_socket’
が使えます --)。証明書が必要かどうかを指定することが出来、証明書の情報を
‘getpeercert()’ メソッドで取得することも出来ます。

参考
....

*note ssl: d8. モジュールについてのドキュメント。

   ---------- 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.19.19 非推奨と削除
--------------------

   * 文字列を例外として送出することは出来なくなりました。これをすると
     *note TypeError: 29c. を起こします。

   * Changes to the *note Exception: da2. 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: 977. 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: 3e. package instead.

   * The ‘md5’ module has been deprecated; use the *note hashlib: 6b.
     module instead.

   * The ‘posixfile’ module has been deprecated; *note fcntl.lockf():
     17a5. provides better locking.

   * The ‘popen2’ module has been deprecated; use the *note subprocess:
     df. module.

   * The ‘rgbimg’ module has been removed.

   * The ‘sets’ module has been deprecated; it's better to use the
     built-in *note set: 432. and *note frozenset: 9d9. types.

   * The ‘sha’ module has been deprecated; use the *note hashlib: 6b.
     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.19.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 改訂版バッファプロトコル: 176d. で前述の新しいバッフ
     ァインターフェイスのために、 *note PyObject_GetBuffer(): 832. と
     *note PyBuffer_Release(): 833. とほか少しの関数が追加されました。

   * 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: 1c8.  A new API
     function, ‘PyImport_ImportModuleNoBlock()’, 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(): 17a7. returns the
     maximum representable floating-point value, and *note
     PyFloat_GetMin(): 17a8. returns the minimum positive value.  *note
     PyFloat_GetInfo(): 17a9. 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(): 3c2. を使う 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: 17aa. と *note PyModule_AddIntMacro():
     17ab. です。 (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(): b66, ‘Py_Type()’ became *note Py_TYPE(): 5fc, and
     ‘Py_Refcnt()’ became *note Py_REFCNT(): 552.  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.19.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(): 17ad.
     function reads a keypress and returns a Unicode value, as does the
     *note getwche(): 17ae. function.  The *note putwch(): 17af.
     function takes a Unicode character and writes it to the console.
     (Contributed by Christian Heimes.)

   * *note os.path.expandvars(): 1792. は "%var%" 形式を環境変数で置換し
     、 "~user" をユーザのホームディレクトリパスに置換します(--訳注: 上
     のほうの訳注参照。--)。 (Contributed by Josiah Carlson;
     bpo-957650(1).)

   * The *note socket: d4. module's socket objects now have an *note
     ioctl(): 1094. method that provides a limited interface to the
     ‘WSAIoctl()’ system interface.

   * The *note _winreg: 11f. module now has a function, *note
     ExpandEnvironmentStrings(): 17b0, 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: 215. statements.  (Contributed by
     Christian Heimes.)

     *note _winreg: 11f. also has better support for x64 systems,
     exposing the *note DisableReflectionKey(): 171e, *note
     EnableReflectionKey(): 171f, and *note QueryReflectionKey(): 1720.
     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.19.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.19.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.19.21 Python 2.6 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

   * ハッシュ化をサポートしないクラスはその定義内でその事実を示すために
     、 ‘__hash__ = None’ をセットすべきです。

   * 文字列を例外として送出することは出来なくなりました。これをすると
     *note TypeError: 29c. を起こします。

   * *note collections.deque: 9db. の ‘__init__()’ メソッドが、イテラブ
     ルから要素を追加する前に全ての deque の既存の内容をクリアするように
     なっています。この変更は ‘list.__init__()’ の振る舞いと一致します
     (--訳注: 当たり前のことにしか思えないのですが詳細がわかりません。こ
     れ以前のバージョンでは deque はシングルトンのように振舞っていたので
     しょうか。--)。

   * *note object.__init__(): 306. は以前は任意の引数とキーワード引数を
     受け取り、そして無視していました。Python 2.6 ではもうこれは許されま
     せん。 *note TypeError: 29c. を起こします。これは結果的に *note
     object: e51. の対応するメソッドを呼ぶ(おそらく *note super(): 44a.
     を介して) ‘__init__()’ メソッドに影響します。 bpo-1683368(1) の議論
     を参照して下さい。

   * ‘Decimal’ のコンストラクタは今では先頭と末尾の空白が含まれる文字列
     を許容します。以前は ‘InvalidOperation’ となっていました。他方で、
     ‘Context’ オブジェクトの ‘create_decimal()’ メソッドは余分な空白を
     明示的に拒絶するようになり、 ‘ConversionSyntax’ を投げます。

   * 実装上の誤り(事故)で、ビルトインの *note __import__(): caa. 関数に
     ファイルパスを渡すと指定したファイルをインポート出来ていました。し
     かしながらこれは決して意図した振る舞いではありませんでした。実装は
     今ではこのケースを明示的にチェックし、 *note ImportError: 1c8. を起
     こします。

   * C API: *note PyImport_Import(): 17b4. と *note
     PyImport_ImportModule(): 3ab. 関数がデフォルトで、相対インポートで
     はなく絶対インポートをするようになっています。これはほかのモジュー
     ルをインポートする C 拡張に影響します。

   * C API: ハッシュされるべきではない拡張データ型は、 ‘tp_hash’ スロッ
     トを *note PyObject_HashNotImplemented(): 177f. と定義すべきです。

   * *note socket: d4. モジュールの例外 *note socket.error: 140c. が
     *note IOError: 1409. 派生になっています。以前は ‘StandardError’ の
     サブクラスではありませんでしたが今は ‘IOError’ を通じてそれのサブク
     ラスです。 (Implemented by Gregory P. Smith; bpo-1706815(2).)

   * The *note xmlrpclib: 137. module no longer automatically converts
     *note datetime.date: 494. and *note datetime.time: 495. to the
     *note xmlrpclib.DateTime: 179c. 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: da2. クラスはスライスやインデクス
     アクセスで警告を出します; ‘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.19.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.20 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: 2d. module for calling C functions.

言語の変更の意義は、中程度のものです。いくつかの心地よい機能が入りました
が、そのほとんどの機能は毎日使うというものでもありません。条件式
(conditional expressions)がついに言語に追加されました。ちょっと変わった
文法です。 *note PEP 308; 条件式 (Conditional Expressions): 17ba. のセク
ションを参照してください。新しい '*note with: 215.' 文は後始末のコードを
書くのを簡単にします(*note PEP 343; "with" ステートメント: 17bb. セクシ
ョン)。ジェネレータに値を返すことが出来るようになりました(*note PEP 342;
ジェネレータの新機能: 17bc. セクション)。インポートが、絶対パス、相対パ
スのどちらかで可視に出来るようになりました(*note PEP 328;
絶対インポート、相対インポート: 17bd. セクション)。例外ハンドリングのい
くつかの境界のケースで、より良いハンドリングを行えるようになりました
(*note PEP 341; try/except/finally の一体化: 17be. セクション)。これらの
どの改善も価値が高いですが、それらは言語機能を限定的に改善するものであっ
て、いずれも 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.20.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.20.2 PEP 309: 関数の部分適用
------------------------------

*note functools: 62. モジュールは、関数型スタイルのプログラミングのため
のツールを含むことを意図したものです。

このモジュールには一つの有用なツールとして、 ‘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: 62. モジュールのもう一つの関数は
‘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.20.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.20.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: db. なのだとしたら?
‘pkg.string’ を無視して標準モジュールを探す綺麗な方法はありません; 一般
的に、 ‘sys.modules’ の中身から探す必要がありました。これはちょっとばか
り美しくありません。Holger Krekel の ‘py.std’ パッケージは標準ライブラリ
からモジュールをインポートするのに ‘import py; py.std.string.join()’ と
、よりこぎれいな方法を与えてくれますが、そのパッケージは全ての Python イ
ンストレーションでの利用が可能にはなっていません。

相対インポートに頼ったコードを読むことは、より不明瞭でもあります。読者は
*note string: db. と ‘pkg.string’ のどちらを使おうとしているのかについて
、混乱するだろうからです。Python ユーザはすぐに、彼らのパッケージのサブ
モジュール名が標準ライブラリモジュールの名前と被らないようにすることを学
びますが、あなたのサブモジュール名が将来のバージョンの Python に追加され
る新しいモジュールで使われる名前にならないようにすることは出来ません。

Python 2.5 では *note import: 9df. の振る舞いを、 ‘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: db. モジュールをインポ
ートしますので、 ‘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.20.5 PEP 338 - モジュールをスクリプトとして実行する
-----------------------------------------------------

Python 2.4 で追加されたモジュールをスクリプトとして実行するための *note
-m: 4d1. スイッチが、少し能力を高めました。Python インタプリタ内での C 実
装に代わり、これの実現には新しいモジュール *note runpy: c6. を使うように
なっています。

*note runpy: c6. モジュールはインポートのメカニズムをより洗練された方法
で実装しているので、今では ‘pychecker.checker’ のようにパッケージ内のモ
ジュールも実行出来ます。このモジュールは異なるインポートメカニズム、例え
ば *note zipimport: 13b. モジュールもサポートします。このことにより、
‘sys.path’ に .zip アーカイブのパスを追加して、 *note -m: 4d1. スイッチ
でアーカイブ内のコードを実行する、といったことも出来ます。

参考
....

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.20.6 PEP 341: try/except/finally の一体化
-------------------------------------------

Until Python 2.5, the *note try: adb. statement came in two flavours.
You could use a *note finally: 453. block to ensure that code is always
executed, or one or more *note except: 44e. 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: 44e. ブロックと *note finally: 453. ブロックを組み合わ
せるのと等価なものをサポートしています。そしてこの作業が、このステートメ
ントがどういう意味であるべきかを明らかにしたのです。Python 2.5 では、あ
なたは今ではこう書くことが出来ます:

     try:
         block-1 ...
     except Exception1:
         handler-1 ...
     except Exception2:
         handler-2 ...
     else:
         else-block
     finally:
         final-block

'block-1' 内のコードが実行されます。そのコードが例外を投げた場合、個々の
*note except: 44e. ブロックがテストされます: その例外が ‘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.20.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: d97. 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(): bb9. method, picking up
after the ‘yield’ statement.

In Python 2.3, *note yield: d97. 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: d97. 式の周りには括弧は付けておいた
ほうがいいと思います、この例でのように。括弧はべつに必要はないのですが、
どんな場合に必要かを憶えるよりは、いつでも付けるのが簡単でしょう。

( PEP 342(1) がその規則を正確に説明していますが、それによると *note
yield: d97. 式は、代入式で右辺のトップレベルにあるとき以外はいつも括弧を
付ける必要があります。つまり ‘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: d97.
expression returns the specified 'value'.  If the regular *note next():
bb9. method is called, the ‘yield’ returns *note None: a6a.

以下は前のと同じ例ですが、内部カウンタの値の変更を許す修正をしました:

     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: d97. が *note None: a6a. を返すことはよくあるのですから、そ
うなっていないかどうか必ずチェックしておくべきです。ジェネレータ関数を再
開するために使うメソッドが ‘send()’ しかないのだと確信してるのでない限り
、式の値をそのまま使ってはいけません。

ジェネレータには、 ‘send()’ のほかにも新しいメソッドが二つあります

   * ‘throw(type, value=None, traceback=None)’ はジェネレータ内で例外を
     投げるために使います; その例外はジェネレータの実行が停止したところ
     の *note yield: d97. 式によって投げられます。

   * ‘close()’ はジェネレータ内で *note GeneratorExit: 1780. 例外を投げ
     てイテレートを終了させます。この例外を受け取ったジェネレータのコー
     ドは ‘GeneratorExit’ か *note StopIteration: fbe. を投げなくてはい
     けません; この例外を捕捉して何かほかのことをしようとするのは規則違
     反であり、 *note RuntimeError: 317. を引き起こします; 関数が何かほ
     かの例外を投げると、その例外は呼び出し元に伝播します。 ‘close()’ は
     ジェネレータのガーベージコレクトによっても呼ばれます。

     *note GeneratorExit: 1780. が起こったときにクリーンアップ作業をする
     必要があるなら、 ‘GeneratorExit’ を捕捉するのではなく ‘try: ...
     finaly:’ するようお勧めします。

これらの変更の合わせ技で、ジェネレータは情報の一方的な生産者から、生産者
かつ消費者という存在に変貌を遂げたのです。

ジェネレータは 'コルーチン' という、より一般化された形式のサブルーチンに
もなります。サブルーチンは一カ所 (関数の冒頭) から入って別の一カ所
(*note return: 452. 文) から出るだけですが、コルーチンはいろいろな場所
(*note yield: d97. 文) から入ったり出たり再開したりできるのです。わたし
たちは 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: 453. clause will now always get a chance to run.  The syntactic
restriction that you couldn't mix *note yield: d97. 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: 215.
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.20.8 PEP 343: "with" ステートメント
-------------------------------------

'*note with: 215.' ステートメントは、以前なら後片付けが実行されるのを確
実にするために ‘try...finally’ ブロックを使ったであろうようなコードを、
より単純明快にします。このセクションでは、このステートメントの普通の使い
方を説明します。続くセクションでは実装の詳細を調べ、このステートメントと
ともに使うためにオブジェクトをどうやって書けば良いかをお見せします。

'*note with: 215.' ステートメントは基本構造が以下となる新しい制御フロー
構造です:

     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__(): 9cb. and *note __exit__(): 16ba. methods.

The object's *note __enter__(): 9cb. 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__(): 16ba. 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: 215.' とともに使えます。ファイルオブジェクト
がその一例です:

     with open('/etc/passwd', 'r') as f:
         for line in f:
             print line
             ... more processing code ...

このステートメントが実行し終わったあかつきには、 'f' のファイルオブジェ
クトは、たとえ *note for: 329. ループが道半ばにして例外と成り果てても、
自動的にクローズされます。

     注釈: In this case, 'f' is the same object created by *note open():
     333, because *note __enter__(): 9cb. returns 'self'.

*note threading: f6. モジュールのロック・条件変数でも '*note with: 215.'
ステートメントの恩恵にあずかれます:

     lock = threading.Lock()
     with lock:
         # Critical section of code
         ...

ブロックが実行される前にロックが獲得されて、ブロックが完了するやいなや必
ず解放されます。

*note decimal: 39. モジュール内の新しい ‘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.20.8.1 コンテキストマネージャを書く
.....................................

中身を紐解いてみれば、 '*note with: 215.' ステートメントはけっこう入り組
んでいます。ほとんどの人にとっては、既存のオブジェクトを '‘with’' ととも
に使うだけのことでその詳細を知る必要は無いので、それで良いならこのセクシ
ョンの残りの部分は読み飛ばして結構です。新しいオブジェクトの作者は基礎と
なる実装の詳細について知る必要があるので、このまま読み進めるべきです。

コンテキスト管理プロトコルの高度な説明はこんなです:

   * The expression is evaluated and should result in an object called a
     "context manager".  The context manager must have *note
     __enter__(): 9cb. and *note __exit__(): 16ba. methods.

   * The context manager's *note __enter__(): 9cb. 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(): a7f. が返す
     値と同じで、例外が起こらなければ ‘None’ です)。そのメソッドの戻り値
     は例外を再送出するかどうかを制御します: 全ての偽の値ではその例外が
     再送出され、 ‘True’ では揉み消します。例外を揉み消すなど滅多なこと
     では欲しいと思わないでしょう。もしそうしてしまったら、 '*note with:
     215.' ステートメントを含んだコードの作者は何か間違ったことが起こっ
     たことに決して気付かないですから。

   * If 'BLOCK' didn't raise an exception, the *note __exit__(): 16ba.
     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__(): 9cb. 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: 215.' 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__(): 16ba. 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:
452. 文を書いてもよろしいです:

     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.20.8.2 contextlib モジュール
..............................

新しい *note contextlib: 27. モジュールは、 '*note with: 215.' ステート
メントで使えるオブジェクトを書く際に便利ないくつかの関数とデコレータを提
供しています。

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: d97.
will be executed as the *note __enter__(): 9cb. method, and the value
yielded will be the method's return value that will get bound to the
variable in the '*note with: 215.' statement's ‘as’ clause, if any.  The
code after the ‘yield’ will be executed in the *note __exit__(): 16ba.
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: 215.' を書く必要性をなくしてくれます。この例では
、単一の '‘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: 215.' ステートメントによって生成されるコードを見せてく
     れるので、このステートメントがどうやって動作するのかを知るのに役立
     ちます。

*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.20.9 PEP 352: 例外の新スタイルクラス化
----------------------------------------

例外クラスは、今では旧スタイルクラスだけではなく新スタイルクラスになれま
す。組み込みの *note Exception: da2. クラスと全ての標準組み込み例外
(*note NameError: 66c, *note ValueError: 15a, など) が今では新スタイルク
ラスです。

例外の継承階層が少し再編成されました。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: d9a. と *note
SystemExit: 10fb. はエラーではありませんが、普通は ‘Control’-‘C’ をユー
ザが叩いたか、コードが *note sys.exit(): 506. を呼び出したかのような明示
的なアクションを表します。剥き出しの ‘except:’ はまさに全ての例外を捕捉
しますから、一般に、再送出のために ‘KeyboardInterrupt’ と ‘SystemExit’ は
リストする必要があります。お決まりのパターンはこんなです:

     try:
         ...
     except (KeyboardInterrupt, SystemExit):
         raise
     except:
         # Log error...
         # Continue running program...

Python 2.5 では同じ結果を得るのにもう ‘except Exception’ と書いても良い
です。これは普通はエラーを示す例外全てを捕捉しつつも *note
KeyboardInterrupt: d9a. と *note SystemExit: 10fb. は置き去りにします。
無論かつてまでのバージョン同様、剥き身の ‘except:’ は全例外を捕捉します
。

Python 3.0 での目標は、例外として raise される全てのクラスが *note
BaseException: 9bd. からの、もしくは ‘BaseException’ のある子孫であるこ
とを要求することであり、Python 2.x シリーズの将来のリリースにおいてはこ
の制約の強制を始めるかもしれません。ですからあなたの全ての例外は、今から
すぐに *note Exception: da2. 派生にするのが肝要です。捕捉例外を特定しな
い ‘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.20.10 PEP 353: 添え字型に ssize_t を使う
------------------------------------------

A wide-ranging change to Python's C API, using a new *note Py_ssize_t:
e28. 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: 1a6. に余分に必要とします。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: e28. を使うようになっています。 *note PyList_Size(): 17d2. の
ような関数は ‘Py_ssize_t’ を返します。拡張モジュール内のコードでは、です
ので、ある程度の変数の ‘Py_ssize_t’ への変更が必要でしょう。

The *note PyArg_ParseTuple(): 3b9. and *note Py_BuildValue(): 5f5.
functions have a new conversion code, ‘n’, for *note Py_ssize_t: e28.
‘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.20.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:
29c. を送出します。

A corresponding *note nb_index: 17d5. slot was added to the C-level
*note PyNumberMethods: 17d6. 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.20.12 その他の言語変更
------------------------

以下が、Python 2.5 言語コアに加えられた全ての変更点です。

   * *note dict: 193. 型に新たなフックが追加されています。サブクラスが、
     辞書に含まれないキーに対してデフォルトを提供出来るようにするもので
     す。キーが見つからない場合、辞書の ‘__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(): 12bc. と *note max(): 12bd. に、
     ‘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(): 17d9. と *note all(): 17da.
     は、イテレータがいくつか真を含むかどうかを評価します。 ‘any()’ はイ
     テレータのいずれかが返す値が真と評価される場合に *note True: fd0. を
     返し、そうでなければ *note False: ef9. を返します。 ‘all()’ はイテ
     レータが返す値の評価が真のみの場合に ‘True’ を返します。 (Suggested
     by Guido van Rossum, and implemented by Raymond Hettinger.)

   * クラスの ‘__hash__()’ メソッドが返す値として、長整数と整数のどちら
     でも良くなりました。長整数が返されれば、その値のハッシュから取られ
     ます。以前のバージョンではこれは普通の整数であることが要求されてい
     ましたが、2.5 ではビルトイン関数 *note id(): 17db. が変更されて常に
     非負数が返り、ユーザはしばしば ‘__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: 17dc. が引き起こされるようになっています。比較結果
     は偽です:

          >>> 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: ddb. を起こしていましたので
     、2.5 でのこれは辞書のアクセス時に悩ましい問題をもたらしました。キ
     ーとして使われている ‘unichr(128)’ や ‘chr(128)’ を探そうとすると
     ‘UnicodeDecodeError’ 例外が起こっていたでしょう。2.5 での、 辞書を
     実装している ‘dictobject.c’ のほかの変更により、これは揉み消すので
     はなく、引き続き例外を起こします(訳注: 原文では this exception とい
     っているので ‘UnicodeDecodeError’ が起こるように読めるのですが、2.5
     時点での振る舞いは確認出来ていませんが 2.7 では *note
     UnicodeWarning: 17dc. とともに *note KeyError: 7e5. が発生する、の
     ようになるはずです。2.6 以降の What's New でのこれに関する言及はあ
     りませんが変更があったのかもしれません)。

     この種の比較で例外を起こすのは完全に正しいことではあるものの、その
     変更はコードを破壊するかもしれないので、必要に応じて警告に出来るよ
     う導入されたのが *note UnicodeWarning: 17dc. です。

     (Implemented by Marc-André Lemburg.)

   * Python プログラマがよくしでかす間違いとして、パッケージディレクトリ
     に ‘__init__.py’ を入れ忘れる、というものがあります。この間違いのデ
     バッグはややこしく、大抵 Python を *note -v: 17dd. スイッチ付きで起
     動して、パス検索全てをログ出力するハメになります。Python 2.5 ではパ
     ッケージディレクトリに ‘__init__.py’ がないことが検出されると新たに
     *note ImportWarning: 90c. 警告を出すようになりました。デフォルトで
     はこの警告は黙って無視されます; これを出したければ、 *note -Wd:
     1cb. スイッチをつけて 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.20.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: 9ec. と *note
-version: 10d9. を受け付けるようになりました。Windows の場合はヘルプメッ
セージを出力するのに *note /?: 17e0. オプションも受け付けます。
(Implemented by Georg Brandl.)


File: python.info,  Node: 最適化<16>,  Prev: 対話的なインタプリタの変更,  Up: その他の言語変更<16>

1.20.12.2 最適化
................

この最適化のいくつかは、2006年5月21日から28日にかけてアイスランドのレイ
キャビクで開催されたイベント、NeedForSpeed sprintで開発されました。この
スプリントはCPythonの実装のスピードアップに焦点を当て、EWT LLCが資金を提
供し、CCP Gamesが現地でサポートしました。 このスプリントで追加された最適
化については、以下のリストで特別にマークしています。

   * Python 2.4 が導入されたとき、組み込みの *note set: 432. と *note
     frozenset: 9d9. 型は 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():
     c2./‘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: 15a. from the ‘read*()’ method.  (Implemented
     by Thomas Wouters.)

   * The *note struct: de. 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: c1. モジュールは、システムの ‘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.20.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: 193. のサブクラスです。この新しい型はほとんど
     辞書と同じに振る舞い、ただし、キーを要求された際にそのキーが存在し
     ていなかった場合に、自動的に辞書にデフォルト値を追加します。

     ‘defaultdict’ のコンストラクタの最初の引数は、キーが要求されて存在
     しない場合に呼び出されるファクトリ関数です。ファクトリ関数は引数を
     取りません。つまりこれに該当する *note list(): 4e0. や *note int():
     32e. のようなビルトイン型のコンストラクタも使えます。例えば、その頭
     文字を基準に語の索引をこのように作ることが出来ます:

          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: 15a. が送出されます。
     (Contributed by Raymond Hettinger.)

   * 新規モジュール: *note contextlib: 27. モジュールには '*note with:
     215.' ステートメントで使えるヘルパ関数が含まれています。詳細は
     *note contextlib モジュール: 17cc. をみてください。

   * New module: The ‘cProfile’ module is a C implementation of the
     existing ‘profile’ 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: b8.
     モジュールが、 ‘Stats’ コンストラクタの 'stream' 引数による直接ファ
     イル出力に対応しました。 (Contributed by Skip Montanaro.)

   * The *note csv: 2c. 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: 6ed. class in the *note datetime: 33. 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(): 17e5. and *note
     time.strftime(): 15a8.:

          import datetime as dt

          ts = dt.datetime.strptime('10:13:15 2006-03-07',
                                    '%H:%M:%S %Y-%m-%d')

   * *note difflib: 3a. モジュールのメソッド
     ‘SequenceMatcher.get_matching_blocks()’ が、合致するサブシーケンス
     を記述するブロックについて、最小範囲リストを返すよう保障するように
     なりました。以前は時折 2 つのリストエントリに合致要素ブロックが分割
     されることがありました。(Enhancement by Tim Peters.)

   * *note doctest: 3d. モジュールに、実行されるべきものから例を守る
     ‘SKIP’ オプションが追加されています。これは、読者のための使用例とし
     て意図しているけれども実際のテストケースとして意図していないような
     コードスニペットのために用意されました。

     ‘testfile()’ 関数と ‘DocFileSuite’ にファイルのエンコーディングを指
     定するための 'encoding' パラメータが追加されました。これにより
     docstring 内に非 ASCII 文字列を含むテストが簡単になります。
     (Contributed by Bjorn Tillenius.)

   * *note email: 3e. パッケージがバージョン 4.0 にアップデートされまし
     た (Contributed by Barry Warsaw.)

   * The *note fileinput: 5e. module was made more flexible.  Unicode
     filenames are now supported, and a 'mode' parameter that defaults
     to ‘"r"’ was added to the *note input(): 1692. function to allow
     opening files in binary or *note universal newlines: 10f5. mode.
     Another new parameter, 'openhook', lets you use a function other
     than *note open(): 333. to open the input files.  Once you're
     iterating over the set of files, the ‘FileInput’ object's new *note
     fileno(): 17e6. returns the file descriptor for the currently
     opened file.  (Contributed by Georg Brandl.)

   * *note gc: 63. モジュールに、新しい関数 ‘get_count()’ が追加されてい
     ます。これは GC 3 世代についての現在の検出を含む 3 要素タプルを返し
     ます。これはガーベージコレクタの決算情報です; これらの数が指定され
     た閾値に到達すると、ガーベージコレクトのスイープが起こります。既存
     の *note gc.collect(): 456. 関数は省略可能な 'generation' 引数を取
     るようになっていて、これはどの世代を検出するかを指定する 0、1、2 で
     す。 (Contributed by Barry Warsaw.)

   * *note heapq: 6c. モジュールの ‘nsmallest()’ 関数と ‘nlargest()’ 関
     数がキーワードパラメータ ‘key’ をサポートするようになっています。こ
     れは *note min(): 12bc./*note max(): 12bd. 関数と ‘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(): f0d. 関数が 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: 89. モジュールの *note format(): 440. 関数が更新され
     、2 つの関数 ‘format_string()’ と ‘currency()’ が追加されました。

     *note format(): 440. 関数の 'val' パラメータは以前は一つ以上の %文
     字指定子が現れる文字列が許されていました; 今はこのパラメータは正確
     に一つの %文字指定子を含む、周りに囲むテキストのない文字列でなけれ
     ばなりません。省略可能な 'monetary' パラメータも追加されています。
     これが ‘True’ の場合、通貨の書式化の 3 桁ごとに区切るセパレータに、
     ロケールのルールを使います。

     複数 %文字指定子を含む文字列をフォーマットするには、 *note
     format(): 440. のように働き、任意のテキストと %文字指定子を混ぜた文
     字列をサポートする新しい ‘format_string()’ 関数を使ってください。

     現在ロケール設定に関連した数字を書式化する ‘currency()’ 関数も追加
     されています。

     (Contributed by Georg Brandl.)

   * *note mailbox: 8e. モジュールでは、メールボックスについてそれを読む
     ことに加えて修正出来る能力を追加するための、大々的な書き換えが行わ
     れています。 ‘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(): 4fc. が時刻の値を浮動小数点数で返すということです
     。(ただし必ずしも ‘os.stat()’ が秒の端数が正確な値を返すという意味
     ではありません; 全てのシステムがそのような精度をサポートしてはいま
     せん。)

     Constants named *note os.SEEK_SET: 1647, *note os.SEEK_CUR: 1648,
     and *note os.SEEK_END: 1649. have been added; these are the
     parameters to the *note os.lseek(): 14d8. function.  Two new
     constants for locking are *note os.O_SHLOCK: 17e7. and *note
     os.O_EXLOCK: 17e8.

     2 つの新しい関数 ‘wait3()’ と ‘wait4()’ が追加されています。これら
     は ‘waitpid()’ 関数に似ています。これは子プロセスが終了するのを待っ
     てプロセス ID とその終了コードを返しますが、 ‘wait3()’ と ‘wait4()’
     は追加の情報を返します。 ‘wait3()’ はプロセス ID を入力に取りません
     ので任意の子プロセス終了を待ち、 *note resource.getrusage(): 17e9.
     関数から返る 'process-id', 'exit-status', 'resource-usage' の 3 要
     素タプルを返します。 ‘wait4(pid)’ はプロセス ID を取ります。
     (Contributed by Chad J. Schroeder.)

     FreeBSD では、 *note os.stat(): 4fc. 関数がナノ秒精度の時刻を返し、
     また、返却オブジェクトが ‘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__(): d9b. 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: 174d. 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: c5. モジュールが *note readline: c2. モジュール
     のインポートに依存しないようになりました。これにより非 Unix プラッ
     トフォームで動作するようになりました。 (Patch from Robert Kiendl.)

   * The *note SimpleXMLRPCServer: 138. 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: d4. 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: de. がより高速になって
     います。これは *note re: c1. モジュールでコンパイル済み正規表現オブ
     ジェクトを作れるのに似ています。モジュールレベルの ‘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(): 17ea. 関数を使っても
     得ることが出来ます。これはビルド情報についての文字列を返し、例えば
     ‘"trunk:45355:45356M, Apr 13 2006, 07:42:19"’ のような値です。
     (Contributed by Barry Warsaw.)

   * もう一つの新規関数 *note sys._current_frames(): 17eb. は、実行スレ
     ッドについての現在スタックフレームを、各スレッドの識別子がキーの辞
     書として返します。辞書の値は、関数が呼ばれた時点のそのスレッドで現
     在アクティブになっているスタックフレームの一番上です。(Contributed
     by Tim Peters.)

   * *note tarfile: e7. モジュールの ‘TarFile’ クラスに ‘extractall()’ メ
     ソッドが追加されました。アーカイブから全てのメンバをカレントディレ
     クトリに抽出します。抽出ターゲットとして別のディレクトリも指定でき
     ますし、アーカイブメンバのサブセットのみ解凍することも出来ます。

     ストリームモードで開く tarfile に使われる圧縮を、モード ‘'r|*'’ を
     使って自動で検出出来るようになっています。 (Contributed by Lars
     Gustäbel.)

   * *note threading: f6. モジュールで、新しいスレッドを作る際に使われる
     スタックサイズを設定出来るようになりました。 ‘stack_size([*size*])’
     関数は現在構成されているスタックサイズを返し、省略可能引数 'size' パ
     ラメータを与えると新しい値を設定します。全てのプラットフォームがス
     タックサイズ変更をサポートしているわけではなく、Windows、POSIX スレ
     ッド、OS/2 で可能です。 (Contributed by Andrew MacIntyre.)

   * The *note unicodedata: 10e. 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: 17ec.

   * 新モジュール: *note uuid: 119. モジュールは 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: 11d. モジュールの ‘WeakKeyDictionary’ 型と
     ‘WeakValueDictionary’ 型に、辞書内に含まれる弱参照を巡回する新たな
     メソッドが追加されています。 ‘iterkeyrefs()’ と ‘keyrefs()’ が
     ‘WeakKeyDictionary’ に追加され、 ‘itervaluerefs()’ と ‘valuerefs()’
     が ‘WeakValueDictionary’ に追加されました。(Contributed by Fred L.
     Drake, Jr.)

   * The *note webbrowser: 11e. 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(): 333. 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: 137. module now supports returning *note
     datetime: 6ed. objects for the XML-RPC date type.  Supply
     ‘use_datetime=True’ to the *note loads(): 17ed. function or the
     ‘Unmarshaller’ class to enable this feature.  (Contributed by Skip
     Montanaro.)

   * *note zipfile: 13a. モジュールが ZIP64 バージョンのフォーマットをサ
     ポートしました。これで 4GiB を超える zip 書庫を作れ、4GiB を超える
     ファイルを書庫に含めることが出来ます。 (Contributed by Ronald
     Oussoren.)

   * *note zlib: 13c. モジュールの ‘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.20.13.1 ctypes パッケージ
...........................

The *note ctypes: 2d. 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: 18c. である
ことを前提としているからです; この規則を犯すことは頭を掻き毟るバグを引き
起こすでしょう。更新可能なメモリ領域が必要な場合は
‘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: 2d. 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: 48d. type constructor that will create a *note PyObject:
1a6.* 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(): 48d.; if it's omitted you end up
with a segmentation fault.

*note ctypes: 2d. が周辺ライブラリとして登場してしばらく経ちますが、
‘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: 2d. モジュールについてのドキュメント。


File: python.info,  Node: ElementTree パッケージ,  Next: hashlib パッケージ,  Prev: ctypes パッケージ,  Up: 新たなモジュール、改良されたモジュール、削除されたモジュール

1.20.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.20.13.3 hashlib パッケージ
............................

A new *note hashlib: 6b. 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: 6b. モジュールについてのドキュメント。


File: python.info,  Node: sqlite3 パッケージ,  Next: wsgiref パッケージ,  Prev: hashlib パッケージ,  Up: 新たなモジュール、改良されたモジュール、削除されたモジュール

1.20.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: d7.

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: 6d4.) として扱う、一つは
カーソルの ‘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: d7. モジュールについてのドキュメント。

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.20.13.5 wsgiref パッケージ
............................

Web Server Gateway Interface (WSGI) v1.0 は、 Web サーバと Python で記述
された Web アプリケーションとの標準インターフェースであり、 PEP 333(1) で
定義されています。 *note wsgiref: 121. パッケージは 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.20.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: e28. type
     definition instead of int.  See the earlier section *note PEP 353;
     添え字型に ssize_t を使う: 17d0. 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(): 1d3. 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(): 1027, *note PyMem_Realloc(): 13de, and *note
     PyMem_Free(): 17fa. are one family that allocates raw memory, while
     *note PyObject_Malloc(): 102a, *note PyObject_Realloc(): 17fb, and
     *note PyObject_Free(): 1028. 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(): 17fc. か *note PyFrozenSet_New(): 17fd. を
     、要素の追加には *note PySet_Add(): 17fe. 、削除には *note
     PySet_Discard(): 17ff. 、 *note PySet_Contains(): 1800. と *note
     PySet_Size(): 1801. で集合オブジェクトの状態を調べます。
     (Contributed by Raymond Hettinger.)

   * C コードから Python インタプリタの正確なリビジョンについての情報を
     取得出来るようになりました。 *note Py_GetBuildInfo(): 17ea. 関数を
     呼び出すことでビルド情報についての文字列が ‘"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: 1802. declares the function as returning a
     value of the specified 'type' and uses a fast-calling qualifier.
     *note Py_LOCAL_INLINE: 1803. 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(): 1804, 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.20.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.20.15 Python 2.5 への移植
---------------------------

このセクションでは前述の変更により必要となるかもしれないコードの変更を列
挙します:

   * ASCII がモジュールのデフォルトエンコーディングになっています(訳注:
     Python 3 からはデフォルトは utf-8 (PEP 3120))。8 ビット文字を含んで
     いるのにエンコーディング宣言がないモジュールが構文エラーになるよう
     になりました。Python 2.4 では構文エラーとはならず警告でした。

   * 以前はジェネレータの ‘gi_frame’ 属性は常にフレームオブジェクトでし
     たが、 *note PEP 342; ジェネレータの新機能: 17bc. で説明した PEP
     342(1) での変更により、 ‘gi_frame’ は ‘None’ になりえます。

   * Unicode 文字列とデフォルトの ASCII エンコーディングで Unicode に変
     換出来ない 8 ビット文字列との比較を試みると、新しい警告 *note
     UnicodeWarning: 17dc. が引き起こされるようになっています。以前はそ
     のような比較では *note UnicodeDecodeError: ddb. 例外を起こしていま
     した。

   * ライブラリ: *note csv: 2c. モジュールは引用符内のマルチラインをより
     厳密に扱うようになっています。フィールド内に改行を埋め込んでいるフ
     ァイルがある場合は、その入力は改行文字を残すやり方で行分解されるは
     ずです。

   * ライブラリ: *note locale: 89. モジュールの *note format(): 440. 関
     数は、以前は %文字指定子が一つを超えてさえいなければ任意の文字列を
     受け付けていたかもしれませんが、Python 2.5 からは正確に一つの、ほか
     に周りをテキストで囲まれていない %文字指定子でなければなりません。

   * Library: The *note pickle: ab. and ‘cPickle’ modules no longer
     accept a return value of ‘None’ from the *note __reduce__(): d9b.
     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: 138. 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: e28. 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 を使う: 17d0. 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.20.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.21 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.21.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(): 9d9. 型は *note set(): 432. の *note immutable: 18c.
版です。 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.21.2 PEP 237: 長整数と整数を一体化していく
--------------------------------------------

この PEP の非常に長期に渡る移行は Python 2.2 に始まり、Python 2.4 でさら
にもう一歩前進しています。2.3 では int/long の一体化後に異なる振る舞いを
する整数演算をすると *note FutureWarning: 84d. 警告を出して、結果の値は
(プラットフォーム依存で) 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.21.3 PEP 289: ジェネレータ式
------------------------------

The iterator feature introduced in Python 2.2 and the *note itertools:
84. 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.21.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: 15a. を喰らい、問題を直すだけの
ことです。ですが、例えば Mailman のようなアプリケーションを考えてみてく
ださい。テンプレート文字列や翻訳は、Python 言語について承知していないユ
ーザが編集するのです。フォーマット文字列の構文はそのようなユーザに説明す
るには複雑で、彼らが間違いをやらかした場合には、親切なフィードバックを彼
らに与えるのは難しいのです。

PEP 292 は *note string: db. モジュールに ‘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:
7e5. を送出します。 ‘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.21.5 PEP 318: 関数とメソッドのためのデコレータ
------------------------------------------------

Python 2.2 は Python オブジェクトモデルを静的メソッド、クラスメソッドを
追加することで拡張はしましたが、それらを定義する新たな手段を提供するよう
な Python 構文の拡張はしませんでした。このため、 *note def: 1812. でメソ
ッドは普通に書いたのち、新型メソッドとしての関数へ仕立て上げる *note
staticmethod(): 66d. または *note classmethod(): 6a0. にその結果のメソッ
ドを渡す、という手順を取る必要がありました。このような具合でした:

     class C:
        def meth (cls):
            ...

        meth = classmethod(meth)   # Rebind name to wrapped-up class method

メソッドがとても長かったりすると、関数のボディの後ろの *note
classmethod(): 6a0. 呼び出しは見失ったり忘れたりしやすいものでした。

そのような定義をもっと読みやすくするために何か構文を追加する、という意図
は常にありましたが、2.2 のリリース時点では良い構文は明らかではありません
でした。本日時点でさえ 'いまだ' 明らかとは言えませんが、ユーザは静的メソ
ッドとクラスメソッドを簡単に手にする手段を注文し続けています; 新たな構文
的機能はこの要求に合うように追加されました。

この新たな機能は「関数デコレータ (function decorators)」と呼ばれます。こ
の名前は *note classmethod(): 6a0, *note staticmethod(): 66d, とその仲間
たちが関数オブジェクトに追加的な情報を保存することから着想を得たものです
; それらは関数をより多くの詳細で 'デコレート (修飾) している' というわけ
です。

記法は 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: 168e. 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.21.6 PEP 322: 逆順のイテレーション
------------------------------------

新しいビルトイン関数 ‘reversed(seq)’ は、シーケンスを受け取って、シーケ
ンスの要素を逆順にループするイテレータを返します:

     >>> for i in reversed(xrange(1,4)):
     ...    print i
     ...
     3
     2
     1

‘range(1,4)[::-1]’ のようにする拡張スライスでのやり方に比較して *note
reversed(): c40. は読みやすく、実行が高速で、大体の場合はメモリ使用が少
なく済みます。

*note reversed(): c40. は任意のイテレータは受け付けず、シーケンスのみ受
け付けることに注意してください。イテレータを逆順にしたければ、最初に
*note list(): 4e0. でリストに変換してください:

     >>> 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.21.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: df.
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: df.
contains a single class called *note subprocess.Popen: 6c5. 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(): 1815.
と同じことをします。)

'stdin', 'stdout', 'stderr' はサブプロセスの入力・出力・エラーのストリー
ムを指定します。ファイルオブジェクトかファイル記述子を渡すことが出来ます
。あるいは定数 ‘subprocess.PIPE’ を渡してサブプロセスと親とのパイプを作
成することが出来ます。

コンストラクタには多くの便利なオプションがあります:

   * 'close_fds' はサブプロセス実行前に全てのファイル記述子をクローズす
     ることを要求します。

   * 'cwd' はサブプロセスを実行する作業ディレクトリを指定します (デフォ
     ルトは親の作業ディレクトリです)。

   * 'env' は環境変数を指定する辞書です。

   * 'preexec_fn' は子が開始する前に呼び出される関数です。

   * 'universal_newlines' で、子の入出力を、Python の *note universal
     newlines: 10f5. 機能で開きます。

‘Popen’ インスタンスを作ってしまえば、あとはサブプロセスが終了するまで停
止するために ‘wait()’ メソッド呼び出すことが出来、停止することなく終了を
チェックするのに ‘poll()’ メソッドを呼び出すことが出来、あるいは
‘communicate(data)’ を呼び出して、子の標準入力に 'data' を送信することが
出来ます。 ‘communicate(data)’ はサブプロセスが送信する標準出力と標準エ
ラー出力を読み込み、タプル ‘(stdout_data, stderr_data)’ を返します。

‘call()’ は ‘Popen’ コンストラクタにその引数を流し込むショートカットで、
コマンドが終了するまで待ち、サブプロセスの終了コードを返します。これは
*note os.system(): 1815. に対する安全な置き換えとなりえます:

     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: df. を用いて 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.21.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.21.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.21.8.2 ‘Decimal’ 型
.....................

新しいモジュール *note decimal: 39. が Python 標準ライブラリに追加されま
した。これには 2 つのクラス ‘Decimal’, ‘Context’ を含みます。 ‘Decimal’
インスタンスは数値を表現し、 ‘Context’ インスタンスは、精度やデフォルト
の丸めモードなどのさまざまな設定をまとめるのに使われます。

‘Decimal’ のインスタンスは普通の Python 整数や浮動小数点数のように *note
immutable: 18c. です。 ‘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: 91, *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.21.8.3 ‘Context’ 型
.....................

‘Context’ クラスのインスタンスは decimal 演算についてのいくつかの設定を
カプセル化しています:

   * ‘prec’ は精度で、小数桁数です。

   * ‘rounding’ は丸めのモードを指定します。 *note decimal: 39. にはこの
     値に渡せる定数が定義されています: ‘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: 39. モジュールのドキュメントを読
んで下さい。これには簡単に始められるチュートリアルとリファレンスが入って
います。

参考
....

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.21.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: 9df. 文が絶対インポートであること、相
対インポートであることを示すには ‘.’ 文字で開始すること、の提案もしてい
ます。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.21.10 PEP 331: Locale に依存しない Float/String 変換
------------------------------------------------------

*note locale: 89. モジュールにより、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: 89. 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.21.11 その他の言語変更
------------------------

以下が、Python 2.4 言語コアに加えられた全ての変更点です。

   * 関数とメソッドのためのデコレータが追加されました。 ( PEP 318(1)).

   * ビルトインの *note set(): 432. 型と *note frozenset(): 9d9. 型が追
     加されました ( 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(): 181d. メソッドが *note dict: 193. コンストラク
     タと同じ形式の引数を取れるようになりました。これには任意のマッピン
     グ、キー/値ペアのイテラブルとキーワード引数を含みます。
     (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: 1657. 関数を避
     けて非束縛メソッドを使えます。例えば上記の大文字小文字によらない並
     べ替えはこのように書くのが最善です:

          >>> 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(): f91. と似た振る舞いをしますが、式内で使
     えます。違いは:

   * 入力には任意のイテラブルを取れます;

   * 新しく構築されたコピーをソートし、オリジナルは無傷のままにします; そ
     して

   * 式として新しいソート済みコピーを返します。

          >>> 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: 4d1. スイッチが加わりました。これは
     名前を取り、 ‘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(): 446. と ‘itertools.izip()’ が引数なし
     で呼ばれた場合に空リストを返すようになりました。以前は *note
     TypeError: 29c. 例外でした。これにより可変引数リストをこなしやすく
     なります:

          >>> 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: a6a. が定数になっています。 ‘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.21.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(): 7fe. was also optimized and no
     longer converts its argument into a temporary list before extending
     the base list.  (Contributed by Raymond Hettinger.)

   * *note list(): 4e0, *note tuple(): 1d9, *note map(): 445, *note
     filter(): c3f, and *note zip(): 446. 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.21.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: f6. のようないくつかのモジュールで、
     *note collections.deque: 9db. を生かして性能改善を成し遂げています
     。 (Contributed by Raymond Hettinger.)

   * The *note ConfigParser: 26. classes have been enhanced slightly.
     The *note read(): 1820. method now returns a list of the files that
     were successfully parsed, and the *note set(): 1626. method raises
     *note TypeError: 29c. if passed a 'value' argument that isn't a
     string.  (Contributed by John Belmonte and David Goodger.)

   * *note curses: 2e. モジュールが ncurses 拡張の
     ‘use_default_colors()’ をサポートするようになりました。透明性をサポ
     ートするターミナルを持つプラットフォームならば、このことで透明背景
     に出来ます。 (Contributed by Jörg Lehmann.)

   * *note difflib: 3a. モジュールに ‘HtmlDiff’ クラスが追加されています
     。これは対象テキストをサイドバイサイドで視覚化する HTML テーブルを
     作ります。 (Contributed by Dan Gass.)

   * *note email: 3e. パッケージがバージョン 3.0 に更新されています。多
     くの非推奨だった API が削除され、Python 2.3 以前のバージョンへのサ
     ポートが削除されています。パッケージのバージョン 3.0 は MIME メッセ
     ージについての漸増的な新パーサを使います。これは ‘email.FeedParser’
     モジュールで利用可能です。この新パーサはメモリ内に全てのメッセージ
     を読み込んでおく必要がなく、メッセージが不正であっても例外は投げま
     せん; 代わりにメッセージの全ての問題についてを ‘defect’ 属性に記録
     します。 (Developed by Anthony Baxter, Barry Warsaw, Thomas
     Wouters, and others.)

   * *note heapq: 6c. モジュールは C に変換されました。性能改善は 10 倍
     となり、モジュールはより大きなデータを扱うのに相応しいものになりま
     した。加えて、モジュールには新しく 2 つの関数が追加されました。それ
     は ‘nlargest()’ と ‘nsmallest()’ で、データセット内の大きいものから
     N 番目まで、小さいものから N 番目までを、高価な完全なソートを要する
     ことなく取り出すのに使います。(Contributed by Raymond Hettinger.)

   * The *note httplib: 71. 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: 77. モジュールが IMAP の THREAD コマンドをサポートす
     るようになりました。 (contributed by Yves Dionne) また、
     ‘deleteacl()’ メソッドと ‘myrights()’ メソッドが追加されました。
     (contributed by Arnaud Mazin).

   * *note itertools: 84. モジュールに ‘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: 84. には ‘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(): 4e0. を代
     わりに使うほうが良いかもしれません。イテレータたちが相互に近い場所
     を追跡する場合は ‘tee()’ は理想的です。ブックマーク、ウィンドウ処理
     、あるいは先読みイテレータといったものに適用出来るのではないでしょ
     うか。 (Contributed by Raymond Hettinger.)

   * A number of functions were added to the *note locale: 89. 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: 8a. パッケージの ‘basicConfig()’ 関数に、ログ設定を
     簡単にするいくつかのキーワード引数が追加されました。デフォルトの振
     る舞いはログメッセージを標準エラー出力に出力することですが、様々な
     キーワード引数でログを特定のファイルに書いたり、ログのフォーマット
     を変えたり、ロギングのレベルを変えたり出来ます。例えば:

          import logging
          logging.basicConfig(filename='/var/log/application.log',
              level=0,  # Log all messages
              format='%(levelname):%(process):%(thread):%(message)')

     ほかの *note logging: 8a. パッケージへの追加としては、 便利メソッド
     ‘log(level, msg)’ や、ログファイルを時間間隔でローテートするクラス
     ‘TimedRotatingFileHandler’ などがあります。モジュールには元々
     ‘RotatingFileHandler’ が含まれており、こちらはファイルが特定のサイ
     ズを超過した場合にローテートするものです。両クラスとも新しく導出さ
     れた ‘BaseRotatingHandler’ 基底クラスから派生していて、これはまた別
     のローテートするハンドラを実装するのに使えます。

     (Changes implemented by Vinay Sajip.)

   * *note marshal: 90. モジュールが、データ構造のアンパックで内部化した
     文字列を共有するようになりました。これはある種の 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(): 445. や *note
     sorted(): f90. とともに使う際の優れたデータ抽出器になります。例えば
     :

          >>> 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(): 1821. を通して 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: 3e. package.  To
     this end, the *note email.Utils.formatdate: 1822. 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: c0. モジュールに、 ‘getrandbits(N)’ 関数が追加されま
     した。 'N' ビット長の長整数を返します。既存の ‘randrange()’ メソッ
     ドは ‘getrandbits()’ を適切な場所で使うようになり、任意の大きな乱数
     値生成をより効果的にしています。 (Contributed by Raymond
     Hettinger.)

   * *note re: c1. モジュールの正規表現言語が拡張されて、単純な条件式
     ‘(?(group)A|B)’ を書けるようになっています。 'group' は数値グループ
     ID か正規表現内で ‘(?P<group>...)’ で定義したグループ名のどちらかで
     す。指定したグループが合致した場合は、正規表現パターン 'A' が文字列
     に対してテストされ、そうでなければパターン 'B' が代わりに試されます
     。(Contributed by Gustavo Niemeyer.)

   * *note re: c1. モジュールはもう再帰をすることはありません。Gustavo
     Niemeyer による膨大な量の仕事のおかげです。再帰する正規表現エンジン
     では、ある種のパターンでは大量の C スタック空間を消費し、スタックの
     オーバーフローを起こすことがありました。例えば表現 ‘(a|b)+’ が文字
     ‘a’ から成る 3 万バイトの文字列に対してマッチすると、一文字ごとに一
     つのスタックフレームを消費していました。Python 2.3 ではスタックオー
     バーフローのチェックを試みて *note RuntimeError: 317. を投げようと
     しましたが、ある種のパターンではチェックをすり抜けてしまって、運が
     悪いとセグメンテーション違反を起こしていました。Python 2.4 の正規表
     現エンジンではこのパターンと問題を起こすことなくマッチ出来ます。

   * *note signal: ce. モジュールで、 *note signal.signal(): 14f5. への
     パラメータのエラーチェックを厳しくしています。例えば ‘SIGKILL’ シグ
     ナルへのハンドラはセット出来ません。以前のバージョンの Python では
     これを黙って受け容れていましたが、2.4 では *note RuntimeError: 317.
     を投げます。

   * *note socket: d4. モジュールに 2 つ新しい関数が追加されています。
     ‘socketpair()’ 関数は接続したソケットのペアを返し、
     ‘getservbyport(port)’ は与えたポート番号からサービス名を探して返し
     ます。(Contributed by Dave Cole and Barry Warsaw.)

   * ‘sys.exitfunc()’ 関数は非推奨となりました。コードは既存の *note
     atexit: d. モジュールを使うべきです。これは複数の終了関数呼び出しを
     正しく処理出来ます。結果的には ‘sys.exitfunc()’ は純粋に ‘atexit’ の
     みから使われる内部インターフェイスとなるでしょう。

   * *note tarfile: e7. モジュールがデフォルトで GNU フォーマットを生成
     するようになっています。 (Contributed by Lars Gustäbel.)

   * *note threading: f6. モジュールで、スレッドローカルなデータのサポー
     トについて、品の良い単純な方法でサポート出来ました。モジュールは
     ‘local’ クラスを持っており、その属性値は異なるスレッドごとにローカ
     ルになります:

          import threading

          data = threading.local()
          data.number = 42
          data.url = ('www.python.org', 80)

     この場合他のスレッドは ‘number’ 属性、 ‘url’ 属性に自身の値を代入、
     抽出出来ます。 ‘local’ クラスは属性初期化であるとかメソッドの追加の
     ためにサブクラス化することも出来ます。 (Contributed by Jim Fulton.)

   * *note timeit: f8. モジュールはループを計測中は周期的なガーベージコ
     レクションを自動で無効化するようになりました。この変更により、繰り
     返しの計測の比較がやりやすくなります。 (Contributed by Raymond
     Hettinger.)

   * *note weakref: 11d. モジュールがサポートするオブジェクトが非常に幅
     広くなりました。これには Python 関数、クラスインスタンス, set,
     frozenset, deque, array と正規表現パターンオブジェクトが含まれます
     。(Contributed by Raymond Hettinger.)

   * The *note xmlrpclib: 137. 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.21.12.1 cookielib
...................

The *note cookielib: 73. library supports client-side handling for HTTP
cookies, mirroring the *note Cookie: 74. 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: 114. has been changed to interact with *note cookielib:
73.: ‘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.21.12.2 doctest
.................

Edward Loper と Tim Peters のおかげにより、 *note doctest: 3d. モジュー
ルに注目に値するリファクタリングが入りました。テストはこれまで通り単純に
*note doctest.testmod(): 1825. を実行するすることで行えますが、リファク
タリングはモジュールの操作をカスタマイズする色々な手段を提供してくれます
。

新規クラス ‘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: 1826. オプションフラグは、出力の期待値内での省略記号
(‘...’) と任意文字列を一致するとみなし、瑣末な部分が変化するような出力に
簡単に適合するように出来ます:

     def o (n):
         """>>> o(1)
     <__main__.C instance at 0x...>
     >>>
     """

もう一つの特殊文字列 ‘<BLANKLINE>’ は空行に合致します:

     def p (n):
         """>>> p(1)
     <BLANKLINE>
     >>>
     """

もう一つの新機能は出力の diff スタイル出力で、オプションフラグに *note
doctest.REPORT_UDIFF: 1827. (unified diffs), *note doctest.REPORT_CDIFF:
1828. (context diffs), *note doctest.REPORT_NDIFF: 1829. (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:
1827. 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.21.13 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * 拡張関数からの戻り値として一般的に使うための 3 つの便利なマクロが追
     加されています: *note Py_RETURN_NONE: 182b, *note Py_RETURN_TRUE:
     182c, *note Py_RETURN_FALSE: 182d. (Contributed by Brett Cannon.)

   * Another new macro, *note Py_CLEAR: 981, 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: 182e.(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(): 81f. は *note
     PyArg_ParseTupleAndKeywords(): 81e. と同じですが、たくさんの引数の
     代わりに ‘va_list’ を取ることだけが違います。(Contributed by Greg
     Chapman.)

   * A new method flag, *note METH_COEXIST: 182f, allows a function
     defined in slots to co-exist with a *note PyCFunction: 1830. 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.21.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.21.14 Python 2.4 への移植
---------------------------

このセクションでは前述の変更により必要となるかもしれないコードの変更を列
挙します:

   * 大き過ぎる値を持つ左シフトと 16 進/ 8 進定数が *note FutureWarning:
     84d. を引き起こした上で 32 ビットまたは 64 ビットに制限される、とい
     う振る舞いはもうしません。代わりに長整数を返します。

   * 整数演算はもはや ‘OverflowWarning’ は引き起こしません。
     ‘OverflowWarning’ 警告は Python 2.5 で撤廃されます。

   * ビルトイン関数の *note zip(): 446. と ‘itertools.izip()’ が引数なし
     で呼ばれた場合に、 *note TypeError: 29c. 例外を起こすのではなく空リ
     ストを返すようになりました。

   * You can no longer compare the ‘date’ and *note datetime: 6ed.
     instances provided by the *note datetime: 33. module.  Two
     instances of different classes will now always be unequal, and
     relative comparisons (‘<’, ‘>’) will raise a *note TypeError: 29c.

   * ‘dircache.listdir()’ now passes exceptions to the caller instead of
     returning empty lists.

   * ‘LexicalHandler.startDTD()’ はパブリックでシステムの ID を間違った
     順序で受け取っていました。これは修正されました; この間違った順序に
     依存したアプリケーションは修正しなければなりません。

   * *note fcntl.ioctl(): 1833. は 'mutate_flag' 引数が省略されて問題に
     関係がある場合は警告を出します。

   * *note tarfile: e7. モジュールがデフォルトで GNU フォーマットを生成
     するようになっています。

   * Encountering a failure while importing a module no longer leaves a
     partially initialized module object in ‘sys.modules’.

   * *note None: a6a. が定数になっています。 ‘None’ という名前に新しい値
     を割り当てようとするコードは、今では構文エラーになります。

   * ‘signals.signal()’ 関数は、ある種の不正な値では *note RuntimeError:
     317. を投げるようになっています。以前はこれらエラーは黙って通してい
     ました。例えばもう ‘SIGKILL’ へはハンドラは渡せません。


File: python.info,  Node: 謝辞<4>,  Prev: Python 2 4 への移植,  Up: What's New in Python 2 4

1.21.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.22 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(): 886, *note enumerate(): 1839.
のような、新たなビルトイン関数が少し追加されました。 *note in: 32b. 演算
子がサブストリングの検索に使えるようになりました (例えば ‘"ab" in "abc"’
は *note True: fd0. を返します)。

たくさんのライブラリ新機能…、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.22.1 PEP 218: 標準の集合データ型
----------------------------------

(--訳注: イキナリですが、あなたが今これを「Python の歴史を知る」もしくは
「初登場時の熱量高い紹介」を読みたくて読んでいるのでない限りは、もしくは
本当に今 2.3 を使う必要があれば別ですが、このモジュールは 2.4 で既にビル
トインで置き換えられ、2.6 では非推奨となり、3.0 では削除されています。の
で、集合型について知りたければここよりも 2.4 のビルトインの方から読んだ
方が良いです。--) -- 新しいモジュール ‘sets’ には、集合データ型の実装が
含まれています。 ‘Set’ クラスは *note mutable: 1759. の集合のためのクラ
スで、メンバの追加と削除が出来ます。 ‘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(): 183b. and *note intersection(): 183c. 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(): 183d.

     >>> 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(): 183e.

     >>> 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.22.2 PEP 255: 単純なジェネレータ
----------------------------------

Python 2.2 では、ジェネレータが ‘from __future__ import generators’ ディ
レクティブで有効に出来るオプションの機能として追加されました。2.3 ではジ
ェネレータは特別に有効化する必要なく、もうキーワード *note yield: d97. と
して、いつでもそこにあります。このセクションの残りの部分は "What's New
in Python 2.2" のジェネレータの記述からの丸々コピーですので、2.2 のとき
に読んだなら読み飛ばしてもらって結構です。

Python や C の標準的な関数コールについては、よくご存じに違いありません。
関数を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その
関数が *note return: 452. 文まで来ると、ローカル変数が破壊されてから、返
り値が呼び出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベ
ート名前空間に新規のローカル変数が作られるのです。しかし、関数を出るとき
にローカル変数を捨てなければどうなるでしょうか。その出ていったところから
関数を続行できたとしたら、どうでしょう。これこそジェネレータが提供する機
能です; すなわち、ジェネレータは続行できる関数と考えることができます。

ジェネレータ関数の最も単純な例です:

     def generate_ints(N):
         for i in range(N):
             yield i

新しいキーワード *note yield: d97. がジェネレータのために導入されました
。 ‘yield’ ステートメントを含むどんな関数もジェネレータ関数です; Python
バイトコードコンパイラはこれを検知し、関数が特別に扱われるように翻訳しま
す。 (--訳注: Python 2.5 の PEP 342 も参照して下さい。この 2.2 で導入時
点の ‘yield’ はステートメントではなく式に変更されています。--)

ジェネレータ関数を呼び出すと、単一の値の代わりにイテレータプロトコルに対
応したオブジェクトを返します。上の例で ‘yield’ を実行したとき、ジェネレ
ータは ‘return’ 文のようにして ‘i’ の値を生成します。 ‘yield’ と
‘return’ 文の大きな違いは、 ‘yield’ に到達した段階でジェネレータの実行状
態が一時停止になって、ローカル変数が保存される点です。次回そのジェネレー
タの ‘.next()’ メソッドを呼ぶと、 ‘yield’ の直後から関数が実行を再開しま
す。(複雑な理由により、 ‘yield’ は ‘try’...*note finally: 453. の ‘try’
ブロック内に含めることは許されていません; PEP 255(1) に ‘yield’ と例外の
相互作用についての詳細説明がありますので参照して下さい。) -- (--訳注:
Python 2.5 の PEP 342 で *note try: adb...‘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: 452. 文は、引数を付けずに、処理の終わ
りを知らせるためにだけ使うことができます; ‘return’ を実行したあとは、も
うそのジェネレータが値を返すことはできません。ジェネレータ関数の中では、
‘return 5’ などと値を付けた ‘return’ は構文エラーです。ジェネレータの出
力が終わったことを示すには、ほかにも、手動で *note StopIteration: fbe. を
投げてもいいですし、関数の最後まで実行するだけでも同じことになります。
(--訳注: Python 2.7 まではジェネレータ内での戻り値のある ‘return 5’ は構
文エラーになりますが、少なくとも Python 3.4 で構文エラーとはなりません。
単に無視されます。リファレンスに言及されていない振舞いなので、何かの事故
かもしれません。いずれにせよジェネレータ内では Python 3 でも ‘return’ で
値は戻せません。--)

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note next(): bb9. メ
ソッドが ‘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: 32a. 文内では ‘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.22.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:
2d4. を引き起こします; 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.22.4 PEP 273: Zip アーカイブからモジュールをインポートする
------------------------------------------------------------

新たなモジュール *note zipimport: 13b. が、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;
     新たなインポートフック: 1844. をみてください。

   ---------- 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.22.5 PEP 277: Windows NT での Unicode ファイル名サポート
----------------------------------------------------------

Windows NT, 2000, XP では、ファイルシステムはファイル名として Unicode 文
字列を使います。伝統的に Python はファイル名をバイト文字列として表現して
きましたが、それはアクセス出来ないファイル名を表してしまう場合があって、
不十分でした。

Python はいまや (ファイルシステムの制約の範囲内での) 任意の Unicode 文字
列を *note open(): 333. 組み込み関数をはじめとするファイル名が期待される
全ての関数で許容します。 *note os.listdir(): 14bb. に 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: 67c. to be raised.  Applications can test whether
arbitrary Unicode strings are supported as file names by checking *note
os.path.supports_unicode_filenames: 1846, a Boolean value.

MacOS では、 *note os.listdir(): 14bb. は 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.22.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: 10f5. モードを使っ
た読み込みとしてファイルを開きます。これで ‘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.22.7 PEP 279: enumerate()
---------------------------

新たな組み込み関数 *note enumerate(): 1839. はある種のループ処理を少し簡
潔にするものです。 '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(): 1839. を使ってこのように書き換えることが出来ま
す:

     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.22.8 PEP 282: ロギングパッケージ
----------------------------------

ログ記録のための標準パッケージ *note logging: 8a. が Python 2.3 に追加さ
れています。それはログ出力生成の強力で柔軟なメカニズムを提供し、フィルタ
と加工を色々な方法で行えます。標準フォーマットで書く設定ファイルで、プロ
グラムのロギングの振る舞いを制御出来ます。ログレコードを標準エラー出力や
ファイルやソケット、システムログへの送信、あるいは e-mail 送信するような
ハンドラが Python に含まれています。もちろん、あなた自身のハンドラクラス
を書くことも出来ます。

*note Logger: f10. が最も重要なクラスです。ほとんどのアプリケーションコ
ードは一つかそれ以上の ‘Logger’ オブジェクトを扱い、それぞれ一つはそのア
プリケーションの特定のサブシステムで使われるでしょう。それぞれの
‘Logger’ は名前で識別され、名前は ‘.’ をコンポーネントのセパレータとして
使う階層で体系化されます。例えば、 ‘server’, ‘server.auth’,
‘server.network’ といった名前の ‘Logger’ インスタンスを持つといった具合
です。この例の後ろ 2 つは階層で ‘server’ の下にあります。 ‘server’ への
冗長性を見つけた場合や ‘server’ メッセージを直接異なるハンドラに向けた場
合、変更は ‘server.auth’ と ‘server.network’ へのログ記録にも適用される
ということです。全てのほかのロガーの親となる、ルート ‘Logger’ もあります
。

単純な用法のために、 *note logging: 8a. パッケージはいくつかの便利関数を
含んでいて、これは常にルートログを使います:

     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(): 184b. method on the root logger.

Notice the *note warning(): 339. 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(): 184c. 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: f10. can prevent this by setting its *note propagate: 184d.
attribute to *note False: ef9.

There are more classes provided by the *note logging: 8a. package that
can be customized.  When a *note Logger: f10. instance is told to log a
message, it creates a *note LogRecord: 1394. instance that is sent to
any number of different *note Handler: 184e. 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: 184f. class.  All of these
classes can be replaced by your own specially written classes.

これら全ての機能で *note logging: 8a. パッケージは最も複雑なアプリケーシ
ョンでさえ、十分な柔軟性を提供しているはずです。ここではそれら機能の不完
全な概要しか示しませんでしたので、全ての詳細はパッケージのドキュメントを
参照してください。 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.22.9 PEP 285: Boolean 型
--------------------------

A Boolean type was added to Python 2.3.  Two new constants were added to
the ‘__builtin__’ module, *note True: fd0. and *note False: ef9.
(‘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: 5f6. です; これのコンス
トラクタは任意の Python 値を取り、 *note True: fd0. または *note False:
ef9. に変換します:

     >>> 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: 32a. ステートメントの式が必ず Boolean の結果に評
価されなければならないことを要求するでしょう。 Python はこの厳しさを今持
ちませんし、 PEP 285(1) が名言するように、未来永劫持つことはありません。
このことは、 ‘if’ ステートメントにこれからも任意の式を書けることを意味し
ますし、リストやらタプルやら何かほかのデタラメなオブジェクトに評価される
ものでも良いことを意味します。Boolean 型は *note int: 32e. クラスのサブ
クラスであって、Boolean の算術演算はこれからも動作します:

     >>> True + 1
     2
     >>> False + 1
     1
     >>> False * 75
     0
     >>> True * 75
     75

*note True: fd0. と *note False: ef9. はぶっちゃけて言えば…: これらは整
数値 1 と 0 の別名だけれども唯一異なるのは *note str(): 1ea. と *note
repr(): 462. が ‘'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.22.10 PEP 293: コーデックエラーを処理するコールバック
-------------------------------------------------------

Unicode 文字列をバイト文字列にエンコードする際には、エンコード出来ない文
字に出会うことがあります。いまのところ Python は、そのエラー処理として
"strict" (*note UnicodeError: 67c. を発生させる)、 "ignore" (その文字を
スキップする)、 "replace" (出力文字列ではクエッションマークに置換する)、
のいずれか一つを指定出来て、 "strict" がデフォルトの振る舞いになっていま
す。その種のエラーのために、ほかの代わりとなる処理が望ましいかもしれませ
ん。例えば XML や HTML の実体参照に置き換えるなどの。

Python は今や、異なる処理戦略を追加する柔軟なフレームワークを手にしまし
た。新しいエラーハンドラを *note codecs.register_error(): 1853. で追加出
来、コーデックは *note codecs.lookup_error(): 1854. を使ってそのエラーハ
ンドラにアクセス出来ます。等価な 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.22.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.22.12 PEP 302: 新たなインポートフック
---------------------------------------

カスタムなインポートフックを書くことは、Python 1.3 で ‘ihooks’ モジュー
ルが導入されたその日からずっと可能でした。それでも本当のところそれで幸せ
になった人は誰一人いません。それで新しいインポートフックを書くのが難しく
てとっ散らかっていたからです。 ‘imputil’ と ‘iu’ モジュール のような代わ
りとなる色々な提案がありましたが、そのいずれも多くの賛同を得ることが出来
たものはありませんし、そのいずれもが簡単に C コードから使うことが出来ま
せんでした。

PEP 302(1) はその先駆者、特に Gordon McMillan の ‘iu’ モジュールからアイ
ディアを借りています。3 つの新たなアイテムが *note sys: e2. モジュールに
追加されています:

   * ‘sys.path_hooks’ は呼び出し可能オブジェクトのリストです。ほとんどの
     場合クラスになるでしょう。それぞれの呼び出し可能オブジェクトは、パ
     スを含む文字列を受け取って、このパスからインポートを処理するインポ
     ーターオブジェクトを返すか、このパスを処理出来なければ *note
     ImportError: 1c8. を送出します。

   * ‘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.22.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:
2c. を使えば遥かに単純になります:

     import csv

     input = open('datafile', 'rb')
     reader = csv.reader(input)
     for line in reader:
         print line

The *note reader(): 89d. 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: 89e. はタプルやリストの連続から、デリミタを含む文字
列は引用符で囲みつつカンマ区切りファイルを生成します。

参考
....

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.22.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(): 185c. 関数はずっと長い間、テキストとするのかバイナリとす
るのかについてはサポートしていました。2.3 ではこのフラグは Boolean から
整数に再定義されました: 0 は旧式のテキストモード pickle フォーマット、1
が同じく旧式のバイナリフォーマット、そして 2 が今回の 2.3 から特有のフォ
ーマットです。新しく追加された定数 *note pickle.HIGHEST_PROTOCOL: 185d.
を指定すると、最も望ましいものが選択されます。

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__(): 9d8, *note __setstate__(): d9c, and *note
__getnewargs__(): 1191.  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.22.15 拡張スライス
--------------------

Python 1.4 以来ずっと、スライシングの構文は省略可能な 3 つ目の引数
"step" またの名を "stride" 、をサポートしていたのです。例えばこれらは全
て合法な Python 構文です: ‘L[1:10:2]’, ‘L[:-1:1]’, ‘L[::-1]’ 。これはこ
の 3 つ目の引数を大々的に使う Numerical Python 開発者によって要望された
ことで Python に追加されたものですが、Python ビルトインのリスト、タプル
、文字列といったシーケンス型がこの機能をサポートすることはなく、これを試
みると *note TypeError: 29c. を起こしていました。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: 1759. なシーケンスに対して、拡張スラ
イスを代入や削除に使えますが、拡張スライスと普通のスライスではいくつかの
違いがあります。普通のスライスで代入を行えば、シーケンスの長さを変更出来
ます (--訳注: 念のため。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__(): 78d.
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(): d13.  ‘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: 1db. オブジェクトが今で
は slice 型という型オブジェクトで、もう関数ではないことがわかるでしょう
。これは、Python 2.2 で *note int: 32e, *note str: 1ea. などに対して行わ
れた同じ目的の修正と一貫しています。


File: python.info,  Node: その他の言語変更<18>,  Next: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>,  Prev: 拡張スライス,  Up: What's New in Python 2 3

1.22.16 その他の言語変更
------------------------

以下が、Python 2.3 言語コアに加えられた全ての変更点です。

   * *note yield: d97. 文がこのドキュメントの *note PEP 255;
     単純なジェネレータ: 1840. で述べた通り、キーワードになっています。

   * 新たな組み込み関数 *note enumerate(): 1839. が追加されました。この
     ドキュメントの *note PEP 279; enumerate(): 1849. で述べた通りです。

   * 新たな定数 *note True: fd0, *note False: ef9. がビルトイン *note
     bool: 5f6. 型の追加に伴い追加されました。このドキュメントの *note
     PEP 285; Boolean 型: 1851. で述べた通りです。

   * *note int(): 32e. 型コンストラクタは、文字列や浮動小数点数を整数に
     収める際、それがとても大き場合に *note OverflowError: c5b. を投げる
     のではなく長整数を返すようになっています。これは
     ‘isinstance(int(expression), int)’ が偽を返すかもしれないという逆説
     的な結果をもたらし得ますが、これが実際に問題を起こすとはあまり思え
     ません。

   * ビルトイン型が拡張スライス構文をサポートするようになりました。この
     ドキュメントの *note 拡張スライス: 185f. で述べた通りです。

   * 新規組み込み関数 ‘sum(iterable, start=0)’ はイテラブル オブジェクト
     内の数値アイテムを足し込んで総和を返します。 *note sum(): 886. は数
     値しか受け付けませんので、文字列群を連結するのには使えません。
     (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: 7e5. を投げます。:

          >>> 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(): 193. コンストラクタは小さな辞書を簡単に構築出
     来るよう、キーワード引数を受け付けるようになりました:

          >>> dict(red=1, blue=2, green=3, black=4)
          {'blue': 2, 'black': 4, 'green': 3, 'red': 1}

     (Contributed by Just van Rossum.)

   * *note assert: d35. ステートメントが ‘__debug__’ フラグをチェックす
     ることはもうありません。このため、 ‘__debug__’ に代入することによっ
     てアサーションを無効にすることは出来ません。Python を *note -O:
     438. スイッチで起動により全てのアサーションが実行されない点は、以前
     と変わりません。

   * ほとんどの型オブジェクトが今では呼び出し可能であり、なので関数、ク
     ラス、モジュールのようなオブジェクトを新たに構築するのにそれを使え
     ます。 (‘new’ モジュールはこれにより将来のバージョンの Python で撤
     廃される可能性があります。 *note types: 10c. モジュール内の型オブジ
     ェクトが使えるからです。 --訳注: 2.6 で実際に撤廃されています。--)
     例えば、新規モジュールオブジェクトは以下コードで構築出来ます:

          >>> import types
          >>> m = types.ModuleType('abc','docstring')
          >>> m
          <module 'abc' (built-in)>
          >>> m.__doc__
          'docstring'

   * 新たな警告 *note PendingDeprecationWarning: c9f. が、将来廃止される
     予定のある機能であることを示すために追加されました。この警告はデフ
     ォルトで '出力されません' 。将来において廃止される予定の機能の使用
     をチェックするにはコマンドラインから *note
     -Walways;;PendingDeprecationWarning;;: 1cb. を与えるか、 *note
     warnings.filterwarnings(): 1861. を使います。

   * 文字列ベースの例外、例えば ‘raise "Error occurred"’ のようなもの、
     これは廃止のための過程を開始しています。文字列を例外として投げると
     *note PendingDeprecationWarning: c9f. が発行されます。

   * ‘None’ を変数名に使うと *note SyntaxWarning: 451. 警告を出すように
     なっています。将来バージョンの 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:
     1862, 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__:
     1863. and *note __bases__: 1864. 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__: 1865. 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.22.16.1 文字列に関する変更
............................

   * *note in: 32b. 演算子が文字列に対して違った振る舞いをするようになり
     ました。以前は 'X' と 'Y' が文字列の場合の ‘X in Y’ は、 'X' は単一
     文字でなければなりませんでした。これが 'X' はどんな長さでも良くなり
     、 ‘X in Y’ は 'X' が 'Y' のサブストリングであれば *note True: fd0.
     を返すように変更されました。 'X' が空文字列の場合は結果は常に
     ‘True’ になります。

          >>> 'ab' in 'abcd'
          True
          >>> 'ad' in 'abcd'
          False
          >>> '' in 'abcd'
          True

     これはサブストリングの開始位置を教えてくれるわけではないので、その
     情報が必要であれば *note find(): 125c. 文字列メソッドを使ってくださ
     い。

   * *note strip(): 1867, *note lstrip(): 1868, *note rstrip(): 1869. に
     、剥ぎ取る文字を指定する省略可能な引数が追加されています。デフォル
     トは従来通り全ての空白文字を削除します。:

          >>> '   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(): 127c. and *note endswith(): 127d. string
     methods now accept negative numbers for the 'start' and 'end'
     parameters.

   * Another new string method is *note zfill(): 186a, originally a
     function in the *note string: db. 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: fd0. 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.22.16.2 最適化
................

   * The creation of new-style class instances has been made much
     faster; they're now faster than classic classes!

   * The *note sort(): f91. 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 その他の変更と修正: 186c. 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.22.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: 13c. 圧縮データ
     よりも小さくなります。 (Contributed by Gustavo Niemeyer.)

   * 標準の日付時刻型が *note datetime: 33. モジュールとして追加されてい
     ます。詳細はこのドキュメントの下の方に記述してありますのでそちらを
     参照して下さい。

   * 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:
     186e, *note CFLAGS: 186f, ‘CPP’, *note LDFLAGS: 1870, and *note
     CPPFLAGS: 1871. environment variables, using them to override the
     settings in Python's configuration (contributed by Robert Weber).

   * Previously the *note doctest: 3d. 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():
     11b0. function creates a *note unittest.TestSuite: 11b1. object
     from a set of ‘doctest’ tests.

   * 新しい関数 ‘gc.get_referents(object)’ は 'object' により参照されて
     いる全てのオブジェクトのリストを返します。

   * The *note getopt: 64. module gained a new function, *note
     gnu_getopt(): 1872, that supports the same arguments as the
     existing *note getopt(): 1873. 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: 69, *note pwd: ba, *note resource: c4. では拡
     張されたタプルを返すようになりました:

          >>> import grp
          >>> g = grp.getgrnam('amk')
          >>> g.gr_name, g.gr_gid
          ('amk', 500)

   * *note gzip: 6a. モジュールが 2 GiB を超えるファイルを扱えるようにな
     っています。

   * The new *note heapq: 6c. 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: 6c. module provides *note heappush(): 1874. and
     *note heappop(): 1875. 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: 76. package.

   * *note imaplib: 77. モジュールが IMAP over SSL をサポートするように
     なりました.  (Contributed by Piers Lauder and Tino Lange.)

   * The *note itertools: 84. 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: fd0, 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: 91. module の 2 つの新規関数 ‘degrees(rads)’ と
     ‘radians(degs)’ は、ラジアンと度の間の変換を行います。 ‘math’ モジ
     ュールの *note math.sin(): 1876. や *note math.cos(): 1877. などは
     常にラジアンでの入力が必要です。 *note math.log(): 1878. 関数には底
     を指定するオプショナルの '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(): 764.

     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: 1879. 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: 12f. 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: 187a. attribute to
     *note True: fd0. will enable buffering.

   * The ‘sample(population, k)’ function was added to the *note random:
     c0. module.  'population' is a sequence or ‘xrange’ object
     containing the elements of a population, and *note sample(): b30.
     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: c0. が C で実装された新しいアルゴリズムのメルセンヌ・
     ツイスタを使うようになりました。これは以前のアルゴリズムよりも高速
     で、より広く研究されています。

     (All changes contributed by Raymond Hettinger.)

   * The *note readline: c2. module also gained a number of new
     functions: *note get_history_item(): 187b, *note
     get_current_history_length(): 187c, and *note redisplay(): 187d.

   * The ‘rexec’ and ‘Bastion’ modules have been declared dead, and
     attempts to import them will fail with a *note RuntimeError: 317.
     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: cd. モジュールに ‘move(src, dest)’ が追加されており、
     これはファイルまたはディレクトリを新しい場所へ再帰的に移動します。

   * Support for more advanced POSIX signal handling was added to the
     *note signal: ce. but then removed again as it proved impossible to
     make it work reliably across platforms.

   * *note socket: d4. モジュールがタイムアウトをサポートするようになり
     ました。ソケットオブジェクトの ‘settimeout(t)’ メソッドに 't' 秒を
     与えることで行えます。これに続くソケット操作が 't' 秒を超えて完了し
     ない場合には操作は中断し、 *note socket.timeout: c11. 例外を投げま
     す。

     オリジナルのタイムアウト実装は Tim O'Malley によりなされました。
     Michael Gilfix がこれを Python *note socket: d4. モジュールに統合し
     、長い長いレビューに導きました。コードがチェックインされたのち、
     Guido van Rossum はそれを部分的に書き換えました。(これは協調的開発
     プロセスの好例です。)

   * Windows での *note socket: d4. モジュールの 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: e7. で ‘tar’ 形式のアーカイブファイルの
     読み書きが出来ます。 (Contributed by Lars Gustäbel.)

   * The new *note textwrap: f5. 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(): 187e. is built on top of *note wrap(): 187f.  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: 137b. class that
     actually implements the text wrapping strategy.  Both the
     ‘TextWrapper’ class and the *note wrap(): 187f. and *note fill():
     187e. 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: f6. 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: f6. module.  Code can call functions and use
     classes in ‘_threading’ whether or not threads are supported,
     avoiding an *note if: 32a. 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: f7. モジュールの *note strptime(): 17e5. 関数は長いこと
     混乱の元でした。それがプラットフォームの C 関数 ‘strptime()’ を使い
     、異なったプラットフォームごとに時折おかしなバグを持っていたからで
     す。Brett Cannon は pure Python で、全てのプラットフォームで全く同
     じに振舞うように書き直した実装を寄稿しました。

   * 新規モジュール *note timeit: f8. は、Python コードの断片 (スニペッ
     ト) を実行するのにかかる時間を計測します。ファイル ‘timeit.py’ は直
     接コマンドラインから実行出来ますし、モジュールの *note Timer: 1880.
     クラスをインポートして直接使うことも出来ます。以下に、空の 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: cb. モジュー
     ル内のクラスのような、辞書に置換可能である必要があるクラスの記述を
     大幅に単純化します。

     クラスがメソッド *note __getitem__(): 78d, *note __setitem__():
     1685, *note __delitem__(): 1686, ‘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: 12b. can now
     generate XML output in a particular encoding by providing an
     optional encoding argument to the *note toxml(): e5d. and *note
     toprettyxml(): e5e. 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: d4. モジュールも、C ライブラリに渡す前に Unicode ホス
     ト名を ACE バージョンに透過的に変換するように拡張されています。
     ‘httplib’ や *note ftplib: 61. のようなホスト名を扱うモジュールも
     Unicode ホスト名をサポートしています; ‘httplib’ は HTTP ‘Host’ ヘッ
     ダをドメイン名の ACE 版を使って送信します。 *note urllib: 111. は
     URL の ‘path’ 部分が ASCII のみである限り、非 ASCII ホスト名を持つ
     Unicode URL をサポートします

     この変更の実装のために、 *note stringprep: dd. モジュール、
     ‘mkstringprep’ ツール、 ‘punycode’ エンコーディングが追加されました
     。

* Menu:

* 日付時刻型::
* optparse モジュール::

   ---------- Footnotes ----------

   (1) https://pybsddb.sourceforge.net


File: python.info,  Node: 日付時刻型,  Next: optparse モジュール,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>

1.22.17.1 日付時刻型
....................

タイムスタンプとして使うのに相応しい日付と時刻の型が *note datetime: 33.
モジュールとして追加されました。これら型は異なるカレンダであるとか多くの
洒落た機能をサポートはせずに、時刻表現の基礎だけに集中するものです。

3 つの基礎となるクラスがあり、 *note date: 494. は年・月・日を表現し、
*note time: 495. は時・分・秒を、 *note datetime: 6ed. が ‘date’ と
‘time’ の両方の属性すべてを持ちます。また、 *note timedelta: d98. は 2 つ
の時刻の差を表現し、タイムゾーンのロジックは抽象クラス *note tzinfo:
9dd. から派生したクラスにより実装されます。

You can create instances of *note date: 494. and *note time: 495. 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(): 1882. class
method returns the current local date.

構築後の日付時刻クラスのインスタンスは全て *note immutable: 18c. です。
オブジェクトから書式文字列を生成する数多くのメソッドがあります:

     >>> 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(): 1883. method allows modifying one or more fields of
a *note date: 494. or *note datetime: 6ed. 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(): ef3. メソッドのものと同じです)。 と *note datetime:
6ed. はお互いに減算演算が可能で、 *note timedelta: d98. インスタンスを加
算することも出来ます。最も大きな不足機能としては、文字列を解析して *note
date: 494. や ‘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.22.17.2 optparse モジュール
.............................

*note getopt: 64. モジュールはコマンドライン引数の単純な解析を提供してい
ます。新規に追加された *note optparse: a4. モジュール (元々 Optik と呼ば
れていたものです) は Unix の慣習に従ったもっと念入りなコマンドライン解析
を行い、自動的に ‘--help’ のための出力をし、異なったオプションに対して異
なったアクションを実行出来ます。 (--訳注: 2.7 以降は ‘optparse’ よりも新
しい *note argparse: 7. を使ってください。--)

*note OptionParser: 1885. インスタンスを作ることから始め、プログラムのオ
プションがどんなであるかそれに対して教えてやります:

     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(): 1886. メソッドを呼び出すこと
で行います

     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.22.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(): 102a. を使って獲得したメモリは ‘free()’
ではなく *note PyObject_Free(): 1028. を使って解放する必要があります。
Python に含まれるいくつかのモジュールがまさにこれに抵触し、修正の必要が
ありました。間違いなく多くのサードパーティモジュールが同じ問題を抱えてい
るでしょう。

この変更の一環として、メモリアロケーションのためのこんがらかった複数イン
ターフェイスが統合されて 2 つの API ファミリになりました。一方のファミリ
で獲得されたメモリは他方の関数で操作されることは許されません。一方のファ
ミリはメモリの塊を獲得するためのもので、もう一方は Python オブジェクトの
獲得に特殊化されたものです。

   * 何某かの区別のないメモリの塊を獲得・解放するのには「生メモリ」ファ
     ミリを使います: *note PyMem_Malloc(): 1027, *note PyMem_Realloc():
     13de, *note PyMem_Free(): 17fa.

   * 「オブジェクトメモリ」ファミリは上述の pymalloc 機構へのインターフ
     ェイスであり、多数の「小さな」獲得をするための特化がされています:
     *note PyObject_Malloc(): 102a, *note PyObject_Realloc(): 17fb,
     *note PyObject_Free(): 1028.

   * Python オブジェクトの獲得と解放には「オブジェクト」ファミリ *note
     PyObject_New: d51, *note PyObject_NewVar: d52, *note
     PyObject_Del(): 1889. を使います。

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.22.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:
     188b. を使って宣言されなければならなくなりました。

   * ‘configure’ スクリプトに ‘--without-doc-strings’ オプションを与える
     ことで、ビルトイン関数とモジュールが docstring を持たないインタプリ
     タとしてコンパイル出来るようになりました。これは Python の実行形式
     ファイルを 10% 小さくしますが、もちろん Python ビルトインのヘルプが
     取得できないことにもなります。 (Contributed by Gustavo Niemeyer.)

   * ‘PyArg_NoArgs()’ マクロが非推奨となったので、これを使っているコード
     は修正しなければなりません。Python 2.2 以降ではメソッド定義テーブル
     では引数を持たず、引数チェックを省けることを示すのに *note
     METH_NOARGS: 188c. フラグが使えます。2.2 以前の Python バージョンと
     の互換性が重要な場合には ‘PyArg_ParseTuple(args, "")’ を代わりに使
     えますが、 ‘METH_NOARGS’ を使うより遅いです。

   * *note PyArg_ParseTuple(): 3b9. に符号なし整数の色々なサイズのための
     フォーマット文字が追加されました: 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: 188d. or
     *note METH_STATIC: 188e. flags in a method's *note PyMethodDef:
     188f. 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__: 811. and *note __name__: 1863. 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.22.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(): 5c. 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.22.20 その他の変更と修正
--------------------------

いつものように、たくさんのほかの改善とバグフィックスがソースツリー全体に
渡って散らばっています。CVS 変更ログを検索すると、Python 2.2 から 2.3 に
かけて適用されたパッチは 523、バグ修正は 514 ありました。いずれも少なく
見積もって、です。

ほかの、さらに特筆すべき変更のいくつかを挙げます:

   * 環境変数 *note PYTHONINSPECT: 1892. をセットしておくと、Python イン
     タプリタが Python プログラム実行後に対話モードに入ります。これは
     Python を *note -i: 1893. で起動するのと同じです。環境変数は 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: 438. なし
     で Python を実行する際のわずかなスピードアップを別とすれば、困難か
     もしれません。

     フレームオブジェクトの *note f_lineno: b91. フィールドにアクセスし
     ている C 拡張は、代わりに ‘PyCode_Addr2Line(f->f_code, f->f_lasti)’
     を呼び出すべきです。これは以前の Python バージョンでも "python -O"
     のもとでコードが動作するのにも望ましい効果を持つでしょう。

     気の利いた新機能としては、トレース関数は、今ではフレームオブジェク
     トの *note f_lineno: b91. 属性を、次に実行される行に変更してセット
     します。 *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.22.21 Python 2.3 への移植
---------------------------

このセクションでは前述の変更により必要となるかもしれないコードの変更を列
挙します:

   * *note yield: d97. は今では常にキーワードです。変数名として使ってい
     たならば、別の名前を選ぶ必要があります。

   * 文字列 'X' と 'Y' について、 ‘X in Y’ は 'X' が一文字以上の場合でも
     動作するようになりました。

   * *note int(): 32e. 型コンストラクタは、文字列や浮動小数点数を整数に
     収める際、それがとても大き場合に *note OverflowError: c5b. を投げる
     のではなく長整数を返すようになっています。

   * 8 ビット文字を含んだ Unicode 文字列をソースコードに埋め込む場合、フ
     ァイルのエンコーディング (UTF-8, Latin-1, あるいはほか何か) を、フ
     ァイルの先頭のコメントに宣言しなければなりません。 *note PEP 263;
     ソースコードのエンコーディング: 1842. を参照してください。

   * ‘_tkinter’ を介した Tcl メソッド呼び出しは今では文字列だけを返すの
     ではありません。代わりに Tcl は対応する Python の等価なオブジェクト
     に変換されたオブジェクトを返します。Python に等価なものがなければ
     ‘_tkinter.Tcl_Obj’ で包んで返します。

   * ‘0xffffffff’ のような大きな値の 8 進、16 進リテラルで *note
     FutureWarning: 84d. が発行されます。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: 451. 警告を出すように
     なっています。

   * Python と一緒に含まれるモジュールで定義される拡張型の名前にモジュー
     ル名と ‘'.'’ が型名の頭に付くようになっています。


File: python.info,  Node: 謝辞<5>,  Prev: Python 2 3 への移植,  Up: What's New in Python 2 3

1.22.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.23 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.23.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.23.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: 189c. 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__(): 8e8. 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 関連リンク: 189d. を参照してください。

* Menu:

* 旧と新クラス::
* デスクリプタ::
* 多重継承; ダイヤモンドルール: 多重継承 ダイヤモンドルール.
* 属性アクセス::
* 関連リンク::


File: python.info,  Node: 旧と新クラス,  Next: デスクリプタ,  Up: PEP 252 と PEP 253 型とクラスについての変更

1.23.2.1 旧と新クラス
.....................

まず、 Python 2.2 は本当に 2 種類のクラスを持っているのだ、ということを
知る必要があります: クラシック、あるいは旧スタイルクラス、と、新スタイル
クラスです。旧スタイルクラスのモデルは、以前のバージョンのクラスモデルと
完全に同じものです。このセクションに記述する全ての新機能は、全て新スタイ
ルクラスだけに適用されるものです。この逸脱が未来永劫続くことは望まれてい
ません; 最終的には旧スタイルクラスは撤廃されます。たぶん Python 3.0 で。

では、新スタイルクラスは、どうやって定義すればいいのでしょう?  答えは、
既存の新スタイルクラスをサブクラス化することです。たとえば整数、リスト、
辞書やファイルでさえも、ほとんどの Python 組み込み型は今では新スタイルク
ラスです。 *note object: e51. という名の新スタイルクラスは全ての組み込み
型の基底クラスとして既に追加されていて、相応しい組み込み型がなければ単に
‘object’ をサブクラス化すれば良いです:

     class C(object):
         def __init__ (self):
             ...
         ...

This means that *note class: 1691. 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: e51.)

組み込み型(ビルトイン型)のための型オブジェクトは、クレバーなトリックを使
って名付けられた組み込み(ビルトイン)として利用可能です。Python は既に組
み込み関数 *note int(): 32e, *note float(): 32f, *note str(): 1ea. を持
っていました。2.2 にはその関数はなくなり、型オブジェクトは呼び出されると
ファクトリとして振舞います:

     >>> int
     <type 'int'>
     >>> int('123')
     123

To make the set of types complete, new type objects such as *note
dict(): 193. 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.23.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__: 1ca. 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__: 141d. は属性の名前です。

   * *note __doc__: cf8. 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__: 18a0. 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(): 66d. 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.23.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():
44a, 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(): 44a. は ‘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.23.2.4 属性アクセス
.....................

A fair number of sophisticated Python classes define hooks for attribute
access using *note __getattr__(): 8e8.; 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__(): f94. is 'always' called whenever any
attribute is accessed, while the old *note __getattr__(): 8e8. 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__: 1ca.  *note __getattr__(): 8e8. methods also end up
being called by Python when it checks for other methods such as *note
__repr__(): 1c7. 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: 6c1. 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__: 1ca.  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__: 18a3. を使うと、オブジェ
クトで参照出来る属性リストを制約することが出来ます。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__: 18a3. リストに含めなかった属性への代入を試みて *note
AttributeError: 1b4. になっていることに注目してください。


File: python.info,  Node: 関連リンク,  Prev: 属性アクセス,  Up: PEP 252 と PEP 253 型とクラスについての変更

1.23.2.5 関連リンク
...................

このセクションは新機能について、あなたがプログラミングを始める説明として
は十分な簡単な概要だけ示しました。ですが、多くの詳細は、単純化したり無視
しています。もっと完全な光景を眺めたければ、どこに行けば良いでしょうか?

The *note デスクリプタ ガイド: 18a5. 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.23.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__(): 78d. method that looks
something like this:

     def __getitem__(self, index):
         return <next item>

*note __getitem__(): 78d. 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: 329. 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__(): 78d. 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: 18a7. function in order to return an
iterator, and extension types that want to behave as iterators can
define a *note tp_iternext: 18a8. function.

それでは、結局のところイテレータは実際どんなでしょうか?  これに必要なメ
ソッドは一つ、 *note next(): bb9. です (--訳注: Python 3 で ‘__next__’ に
変更されています--)。これは引数を取らず、次の値を返します。返すべき値が
なくなったら、 ‘next()’ 呼び出しは *note StopIteration: fbe. 例外を送出
しなければなりません:

     >>> 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: 329. statement no longer expects a sequence;
it expects something for which *note iter(): bb8. 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: 18a7. 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(): bb8. を呼び出すと、キーの反復をするイテレー
タが返ります:

     >>> 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: 32b. operator now works on
dictionaries, so ‘key in dict’ is now equivalent to ‘dict.has_key(key)’.

ファイルもイテレータを提供しています。これはファイルに読むべき行がなくな
るまで *note readline(): c2. を呼び出すもので、つまりファイルを行ごとに
読み出すのにこのように書けるわけです:

     for line in file:
         # do something for each line
         ...

イテレータは前進しか出来ないことに注意してください; 前の要素を取り出す手
段もなければ、イテレータをリセットしたりコピーしたりといったことも出来ま
せん。イテレータオブジェクトにそのような追加の能力を持たせることは出来ま
すが、イテレータプロトコルが規定するのは *note next(): bb9. メソッドのみ
です。

参考
....

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.23.4 PEP 255: 単純なジェネレータ
----------------------------------

ジェネレータはもう一つの新機能で、これはイテレータの導入と連携するもので
す。

Python や C の標準的な関数コールについては、よくご存じに違いありません。
関数を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その
関数が *note return: 452. 文まで来ると、ローカル変数が破壊されてから、返
り値が呼び出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベ
ート名前空間に新規のローカル変数が作られるのです。しかし、関数を出るとき
にローカル変数を捨てなければどうなるでしょうか。その出ていったところから
関数を続行できたとしたら、どうでしょう。これこそジェネレータが提供する機
能です; すなわち、ジェネレータは続行できる関数と考えることができます。

ジェネレータ関数の最も単純な例です:

     def generate_ints(N):
         for i in range(N):
             yield i

新しいキーワード *note yield: d97. がジェネレータのために導入されました
。 ‘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: 453. の ‘try’
ブロック内に含めることは許されていません; PEP 255(1) に ‘yield’ と例外の
相互作用についての詳細説明がありますので参照して下さい。) -- (--訳注:
Python 2.5 の PEP 342 で *note try: adb...‘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: 452. 文は、引数を付けずに、処理の終わ
りを知らせるためにだけ使うことができます; ‘return’ を実行したあとは、も
うそのジェネレータが値を返すことはできません。ジェネレータ関数の中では、
‘return 5’ などと値を付けた ‘return’ は構文エラーです。ジェネレータの出
力が終わったことを示すには、ほかにも、手動で *note StopIteration: fbe. を
投げてもいいですし、関数の最後まで実行するだけでも同じことになります。
(--訳注: Python 2.7 まではジェネレータ内での戻り値のある ‘return 5’ は構
文エラーになりますが、少なくとも Python 3.4 で構文エラーとはなりません。
単に無視されます。リファレンスに言及されていない振舞いなので、何かの事故
かもしれません。いずれにせよジェネレータ内では Python 3 でも ‘return’ で
値は戻せません。--)

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note next(): bb9. メ
ソッドが ‘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: 32a. 文内では ‘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.23.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: 29c. 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: c5b. となっていたような多くの演算が
、今ではその結果として長整数を返します。例えば:

     >>> 1234567890123
     1234567890123L
     >>> 2 ** 64
     18446744073709551616L

ほとんどのケースで、今や整数と長整数は同じものとして扱われるでしょう。
*note type(): 191. ビルトインで今でも区別出来ますが、ほとんど必要ないで
しょう (-- 訳注: 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.23.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__(): 1244. and
     *note __floordiv__(): 18ac. to overload the two division operators.
     At the C level, there are also slots in the *note PyNumberMethods:
     17d6. 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.23.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: 15a.
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: 13c. モジュールでの圧縮のためのエ
ンコーディングが追加されています:

     >>> 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.23.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: 66c. 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: 1657. 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: 1812. 、 *note class: 1691. または *note
import: 9df. ステートメントの割り当てによって)、変数の参照は外側のスコー
プのローカル名前空間で検索されます。ルールや実装の詳細は PEP で参照でき
ます。

この変更は、同じ変数名がモジュールレベルと関数の定義が含まれている関数内
のローカルの両方で変数名として使用されているコードで、互換性の問題を引き
起こす可能性があります。ですがむしろ気にしなくてよいでしょう。そのような
コードはそもそも最初から相当こんがらかっているので。

この変更の副作用の一つは、 ‘from module import *’ と ‘exec’ の両ステート
メントが特定の条件下の関数スコープ内で不正となることです。 Python のリフ
ァレンスマニュアルははじめからずっと ‘from module import *’ はトップレベ
ルモジュールでのみ合法であると言ってきましたが、以前の CPython インタプ
リタはこれを一度も強制していませんでした。入れ子になったスコープ実装の一
環として、Python のソースをバイトコードに変換するコンパイラは、内包され
たスコープ内の変数にアクセスするために別のコードを生成する必要があります
。 ‘from module import *’, ‘exec’ はコンパイラにこれを理解することを不可
能にしてしまいます。なぜならそれらはコンパイル時にはわからないローカル名
前空間に名前を追加するからです。それゆえ、もし関数が関数定義を含んだり自
由な変数に *note lambda: 1657. の語句を含んだりする場合、コンパイラは
*note SyntaxError: 189. 例外を上げて知らせます。

前述した説明を少し明確にするため、例を挙げます:

     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.23.9 新しいモジュールと改良されたモジュール
---------------------------------------------

   * The *note xmlrpclib: 137. 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: 138. module makes it easy to create
     straightforward XML-RPC servers.  See
     ‘http://xmlrpc.scripting.com/’ for more information about XML-RPC.

   * 新しい *note hmac: 6d. モジュールは、 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:
     18b0.  The enhanced functions include *note stat(): 4fc, *note
     fstat(): 1149, *note statvfs(): 14bd, and *note fstatvfs(): 114a.
     in the *note os: a5. module, and *note localtime(): 18b1, *note
     gmtime(): 157e, and *note strptime(): 17e5. in the *note time: f7.
     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: d4. モジュールを IPv6 サポート付きでコンパイル可能に
     なりました。Python の ‘configure’ スクリプトに ‘--enable-ipv6’ オプ
     ションを与えてください。(Contributed by Jun-ichiro "itojun"
     Hagino.)

   * Two new format characters were added to the *note struct: de.
     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(): cad. ビルトインが追
     加されています。これは Python 2.1 で導入された *note pydoc: bd. モ
     ジュールを用いて対話的なヘルプを提供します。 ‘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: c1. module.  For example, the
     *note re.sub(): 7a7. and *note re.split(): 7a6. 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():
     18b2. 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: d2. モジュールに RFC 2487(2) 「Secure SMTP over TLS」
     のサポートが追加されました。これにより Python プログラムとメール転
     送エージェント間でのメッセージの暗号化された SMTP トラフィックが可
     能になりました。 ‘smtplib’ は SMTP 認証もサポートしています。
     (Contributed by Gerhard Häring.)

   * Piers Lauder によって保守されている *note imaplib: 77. モジュールに
     新たに多くの拡張のサポートが追加されました: 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: 3e, 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: 3a. 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: db. 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: 18b3. class, which takes a list of filenames to be
     parsed.  (Contributed by Fred L. Drake, Jr.)

   * A *note Timer: 1519. class was added to the *note threading: f6.
     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.23.10 インタプリタの変更と修正
--------------------------------

Python 拡張モジュールを書いたり、インタプリタの埋め込みをしたり、あるい
は単にインタプリタそのものをハックしたりするために C レベルでインタプリ
タを扱う人々以外には影響しないいくつかの変更があります。Python コードを
書くだけであればここに記述する変更は、あなたに関係するものは全くありませ
ん。

   * プロファイルとトレースの関数が C で実装されました。Python ベースの
     ものと比較して圧倒的に高速に操作出来、プロファイルとトレースのオー
     バヘッドを削減するはずです。これは Python の開発環境の著者に朗報で
     しょう。2 つの C 関数、 *note PyEval_SetProfile(): 18b5. と *note
     PyEval_SetTrace(): 856. が Python API に追加されました。既存の
     *note sys.setprofile(): 18b6. 関数、 *note sys.settrace(): 563. 関
     数はそのまま存在し、単純に新規 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(): 18b7. and *note
     PyInterpreterState_Next(): 18b8. let a caller walk through all the
     existing interpreter objects; *note
     PyInterpreterState_ThreadHead(): 18b9. and *note
     PyThreadState_Next(): 18ba. 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: 3a6.

   * 
     オブジェクトのアロケートには *note PyObject_GC_New(): e6c. または *note PyObject_GC_NewVar(): e6d. を使ってください。

          そしてオブジェクトのデアロケートには *note PyObject_GC_Del():
          18bb. を使ってください。

   * Rename ‘PyObject_GC_Init()’ to *note PyObject_GC_Track(): 18bc. and
     ‘PyObject_GC_Fini()’ to *note PyObject_GC_UnTrack(): 18bd.

   * Remove ‘PyGC_HEAD_SIZE’ from object size calculations.

   * Remove calls to ‘PyObject_AS_GC()’ and ‘PyObject_FROM_GC()’.

   * *note PyArg_ParseTuple(): 3b9. に新たな書式化シーケンス ‘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():
     18be, 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: 1a6.* variables that will be filled in with
     argument values.

   * Two new flags *note METH_NOARGS: 188c. and *note METH_O: 18bf. 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: 18c0.  Also, the old ‘METH_OLDARGS’
     style of writing C methods is now officially deprecated.

   * Two new wrapper functions, *note PyOS_snprintf(): 18c1. and *note
     PyOS_vsnprintf(): 18c2. 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(): 18c3. 関数の未使用パラメータを取り除いたの
     で、今後は 3 つではなく 2 つのパラメータを取ります。3 つ目の引数は
     一度も使われることはなかったため、Python 2.2 以前のコードからの移植
     時には単純に捨てることが出来ます。


File: python.info,  Node: その他の変更と修正<3>,  Next: 謝辞<6>,  Prev: インタプリタの変更と修正,  Up: What's New in Python 2 2

1.23.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:
     29c. 例外を励起するようになりました。

   * Python 2.1 で拡張モジュールとして追加された弱参照は、今では Python
     中核の一部です。これは新スタイルクラスの実装のために使われるからで
     す。このため *note weakref: 11d. モジュールにいた *note
     ReferenceError: 18c5. 例外をビルトイン例外に移動しました。

   * Tim Peters による新しいスクリプト ‘Tools/scripts/cleanfuture.py’ は
     、Python ソースコードから自動的に廃止された ‘__future__’ 文を削除し
     ます。

   * ビルトイン関数 *note compile(): 1d3. に '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: 32b. 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(): 18c6. 関数と *note sys.setdlopenflags():
     14e0. 関数でセット出来るようになりました。 (Contributed by Bram
     Stolk.)

   * The *note pow(): 448. 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: 29c. 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.23.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.24 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.24.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.24.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: 66c. 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: 1657. 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: 1812.、*note class: 1691. または *note
import: 9df. ステートメントの割り当てによって)、変数の参照は外側のスコー
プのローカル名前空間で検索されます。ルールや実装の詳細はPEPで参照できま
す。

この変更は、同じ変数名がモジュールレベルと関数の定義が含まれている関数内
のローカルの両方で変数名として使用されているコードで、互換性の問題を引き
起こす可能性があります。ですがむしろ気にしなくてよいでしょう。そのような
コードはそもそも最初から相当こんがらかっているので。

この変更の副作用の一つは、 ‘from module import *’ と ‘exec’ の両ステート
メントが特定の条件下の関数スコープ内で不正となることです。 Python のリフ
ァレンスマニュアルははじめからずっと ‘from module import *’ はトップレベ
ルモジュールでのみ合法であると言ってきましたが、以前の CPython インタプ
リタはこれを一度も強制していませんでした。入れ子になったスコープ実装の一
環として、Python のソースをバイトコードに変換するコンパイラは、内包され
たスコープ内の変数にアクセスするために別のコードを生成する必要があります
。 ‘from module import *’, ‘exec’ はコンパイラにこれを理解することを不可
能にしてしまいます。なぜならそれらはコンパイル時にはわからないローカル名
前空間に名前を追加するからです。それゆえ、もし関数が関数定義を含んだり自
由な変数に *note lambda: 1657. の語句を含んだりする場合、コンパイラは
*note SyntaxError: 189. 例外を上げて知らせます。

前述した説明を少し明確にするため、例を挙げます:

     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.24.3 PEP 236: __future__ 指示文
---------------------------------

ネストされたスコープへのこの対応は、リリース 2.1 ではコードを壊すことの
危険性について広く懸念されており、 Pythoneer 達に保守的なアプローチを選
ばせるには十分でした。このアプローチは、必須とするリリース N+1 に対する
、 リリース N でのオプション機能として有効化という序奏、というものです。

この構文は *note __future__: 0. という名の予約モジュールを使う
‘from...import’ ステートメントを使用します。ネストしたスコープは以下のス
テートメントで有効にできます。

     from __future__ import nested_scopes

普通 の *note import: 9df. ステートメントに見えますが、実は違います; こ
のような未来のステートメントが置かれる場所には厳格なルールがあります。こ
れらはモジュールの冒頭にしか置けませんし、必ず何らかの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.24.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__(): 165a.
                
                
‘<=’            *note __le__(): 16c4.
                
                
‘>’             *note __gt__(): 16c5.
                
                
‘>=’            *note __ge__(): 16c6.
                
                
‘==’            *note __eq__(): ec4.
                
                
‘!=’            *note __ne__(): 18cf.
                

(特殊メソッドは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.24.5 PEP 230: 警告フレームワーク
----------------------------------

10 年の間に、Python は途中で廃止されたモジュールと機能の特定の番号を蓄積
してきました。どれだけのコードが活用されているか知る術はないので、機能を
削除して問題ないか把握することは困難です。その機能に依存するプログラムは
一つもないかもしれませんし、たくさんあるかもしれません。より構造化された
方法で古い機能を削除できるようにするために、警告のフレームワークが追加さ
れました。Python の開発者がある機能を取り除きたいときは、まずは Python の
次のバージョンで警告を引き起こします。続く Python バージョンで開発者はそ
の機能を削除出来、ユーザは古い機能の使用を取り除くために Python リリース
サイクル一つ丸々使えます。

Python 2.1 はこのスキームで使われる警告フレームワークを追加します。また
、警告の表示機能や表示させたくない警告を除外する機能を提供する、 *note
warnings: 11b. モジュールを追加します。サードパーティーのモジュールはま
た、彼らがサポート対象外にしたい古い機能を非推奨と知らしめるのにこのフレ
ームワークを利用できます。

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(): 18d1. 関数を呼び出すことで発行できます:

     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: c1. 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: 2d4. 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.24.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.24.7 PEP 205: 弱参照
----------------------

*note weakref: 11d. モジュールを通して利用出来る弱参照(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: 11d. 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.24.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__: 1597. 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__: 168c.  Unlike the *note __dict__: 101f. 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.24.9 PEP 235: 大文字小文字を区別しないプラットフォームでのモジュールの読み込み
--------------------------------------------------------------------------------

いくつかのオペレーティングシステムは、大小文字区別に無関心なファイルシス
テムを持っています。MacOS と Windows がその代表例です。それらシステムに
おいてはファイル名 ‘FILE.PY’ と ‘file.py’ の区別が出来ません。たとえそれ
が元のファイル名を尊重して格納出来たとしてもです(それらは大小文字維持、
でもあります)。

Python 2.1 では *note import: 9df. 文が、case-insensitive (大小文字に無
関心)なプラットフォームで case-sensitivity (大小文字への繊細さ)をシミュ
レートして動作します。Python は今や、まずはデフォルトで case-sensitive な
マッチによる検索をし、それで見つからなければ *note ImportError: 1c8. を
投げます。ですから ‘import file’ は ‘FILE.PY’ をインポートしません。
case-insensitive マッチングは Python インタプリタ開始前に環境変数 *note
PYTHONCASEOK: d2a. をセットすることで要求出来ます。


File: python.info,  Node: PEP 217 対話モード用 Display Hook,  Next: PEP 208 新しい型強制モデル,  Prev: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み,  Up: What's New in Python 2 1

1.24.10 PEP 217: 対話モード用 Display Hook
------------------------------------------

Python インタプリタを対話的に使う際には、コマンドの出力結果表示にはビル
トインの *note repr(): 462. 関数が使われます。Python 2.1 ではこの
‘repr()’ の代わりに呼び出される呼び出し可能オブジェクトを、 *note
sys.displayhook(): 18d7. 変数にセット出来ます。たとえば特別な 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.24.11 PEP 208: 新しい型強制モデル
-----------------------------------

数値強制が C レベルでどのようになされるかについての修正は、とても大きな
ものでした。これは Python の C 拡張の著者にのみ影響し、数値操作をサポー
トする拡張型を書くのをより柔軟にするものです。

拡張型はその ‘PyTypeObject’ 構造体に、新しい型強制モデルをサポートするこ
とを示すために ‘Py_TPFLAGS_CHECKTYPES’ フラグをセット出来るようになりま
した。そのような拡張型内では、数値的スロット関数は 2 つの引数が同じ型で
あることを仮定しなくなります。代わりに、2 つの引数が異なる型を渡せて、内
部的に型変換を実行出来ます。スロット関数にそれが処理出来ない型が渡された
場合は、それが失敗であることを表すために ‘Py_NotImplemented’ シングルト
ン値への参照を返せます。この場合他の数値関数が試されて、おそらく操作を実
行出来ます。それでも ‘Py_NotImplemented’ を返すなら *note TypeError:
29c. が送出されます。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.24.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.24.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: 3d. 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: 3a. module contains a class, *note
     SequenceMatcher: 13c7, 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: 30. はパネルライブラリへのラッパーであり、
     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: 129.
     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(): be9. には呼び出し可能オブジェクトをセ
     ット出来ます。例外がどの *note try: adb...*note except: 44e. にも捕
     捉されない場合に、例外は ‘sys.excepthook()’ に通されて、そこで好き
     なことを何でも出来ます。9 回目の Python カンファレンスにおいて、
     Ping はこのフックを使ったアプリケーションのデモを行いました。そこで
     は、スタックフレームを列挙するだけでなくそれぞれのフレームでの関数
     の引数とローカル変数の列挙も行う拡張トレースバックの表示をしていま
     した。

   * Various functions in the *note time: f7. module, such as *note
     asctime(): 15a6. and *note localtime(): 18b1, 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: 61. モジュールがデフォルトでパッシブモードでファイル
     を取得するようになりました。これはパッシブモードがファイアウォール
     配下ではより良く動作するようだからです。この要望は Debian のバグト
     ラッキングシステムから起こりました。ほかの Debian パッケージがファ
     イル取得に ‘ftplib’ を使い、ファイアウォールの元で動作しなかったの
     です。このことが誰かの問題になるとは思えません。Netscape のデフォル
     トがパッシブモードですし、苦情を言う人々も稀でした。ですがもしもパ
     ッシブモードがあなたのアプリケーションやネットワーク構成にとって不
     適切である場合には、FTP オブジェクトの ‘set_pasv(0)’ を呼び出して、
     パッシブモードを無効にしてください。

   * *note socket: d4. モジュールに、Grant Edwards により寄稿された、生
     のソケットへのアクセスのサポートが追加されました。

   * *note pstats: b8. モジュールに、Python プログラムの時間計測プロファ
     イルを表示する単純な対話的統計ブラウザが含まれるようになり、これは
     モジュールがスクリプトとして実行された場合に呼び出されます。Eric S.
     Raymond によって寄稿されました。

   * 実装依存の関数ですが ‘sys._getframe([depth])’ が、現在の呼び出しス
     タックより、指定したフレームオブジェクトを返すものとして追加されま
     した。 *note sys._getframe(): ad3. は呼び出しスタックの一番上のフレ
     ームを返します。オプショナルな整数引数 '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.24.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:
     18dc, it has to be freed using *note PyMem_Del(): 18dd, 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(): c2.
     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(): 18de, 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: e2. や *note string: db. のように、ほかのモジュー
     ルをモジュールがインポートする場合に、 ‘from module import *’ がイ
     ンポートしているモジュールの名前空間内にそれらを追加することです。
     これをフィックスするには、 ‘__all__’ に公開名を単に列挙します:

          # List public names
          __all__ = ['Database', 'open']

     このパッチのより厳密な版が最初に示唆されて Ben Wolfson により実装さ
     れましたが、python-dev でのいくつかの議論を経てからより弱い最終版が
     チェックインされました。

   * 文字列に *note repr(): 462. を適用するとこれまでは表示出来ない文字
     について、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(): 3ab, 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.24.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.25 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.25.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.25.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.25.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.25.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: 18c. なシ
ーケンス型です。添え字でアクセス出来、スライス出来ますが、インプレイスに
変更することは出来ません。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: 10e. は、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: c1. モジュールでは 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.25.5 リストの内包表記
-----------------------

リストというのは Python の主要なデータ型で、多くのプログラムがリストをい
つかは操るものです。リストの操作での 2 つのよくある操作は、それらについ
てループし、あるいは特定の基準に合致したものを取り出すか個々の要素にある
関数を適用するかする、といったものです。例えば文字列のリストが与えられた
場合、特定の部分文字列を含む全ての文字列を引き抜いたり、あるいは各行から
末尾の空白を取り除いたりしたいでしょう。

既にあった *note map(): 445. 関数、 *note filter(): c3f. 関数がこの目的
のためには使えますが、それらにはその引数の一つに関数が必要です。何か既存
のビルトイン関数で直接渡せるものがあればよいのですが、これがない場合その
必要とされる仕事をする小さな関数を作る必要があって、また、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: 1657. 式で作っている匿名関
数にデフォルト引数を使い、これに検索対象の部分文字列を渡しています。リス
ト内包表記はこれを明快にします:

     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: 32a. 節はオプショナルです。これがあれば '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.25.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.25.7 文字列メソッド
---------------------

Until now string-manipulation functionality was in the *note string: db.
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: 18c. だということです。ですの
で文字列メソッドは新しい文字列を返し、それが操作する文字列を変更しません
。

古い *note string: db. モジュールはまだ後方互換性のために残されますが、
それはほとんど新たな文字列メソッドへのフロントエンドとして振舞います。

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: db. 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.25.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: 63. モジュールは、ガ
ーベージコレクションを実行する関数、デバッグのための統計情報を取得する関
数、コレクタのパラメータを調整する関数を提供します。

循環検出アルゴリズムの実行はいくらかの時間がかかるので、結果として多少の
追加的なオーバヘッドがかかるでしょう。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.25.9 その他の言語コアの変更
-----------------------------

Python 文法とビルトイン関数について、色々マイナーな変更がなされました。
影響が広範囲に及ぶものは一つもありませんが、手軽で便利なものです。

* Menu:

* 言語のマイナー変更::
* ビルトイン関数の変更::


File: python.info,  Node: 言語のマイナー変更,  Next: ビルトイン関数の変更,  Up: その他の言語コアの変更

1.25.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(): 462. を挿入します。これは対称性の検討からも考えられまし
た。今の場合は既存の '%s' が引数の *note str(): 1ea. を挿入することに呼
応するものです。例えば ‘'%r %s' % ('abc', 'abc')’ は文字列 ‘'abc' abc’ を
返します。

Previously there was no way to implement a class that overrode Python's
built-in *note in: 32b. 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: 18ed. 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: 66c. 例外はよく混乱するものであり、この欠点を軽減する試みがな
されました。例えば下に挙げるコードは ‘print’ 文で 1.5.2 と 2.0 の両方で
例外が発生しますが、1.5.2 は ‘NameError’ 例外が、2.0 では新規の例外
*note UnboundLocalError: 18ee. が投げられます。 ‘UnboundLocalError’ は
‘NameError’ のサブクラスですので ‘NameError’ が投げられることを想定する
既存のコードはそのまま動作するはずです。:

     def f():
         print "i=",i
         i = i + 1
     f()

2 つの新規例外 *note TabError: 955. と *note IndentationError: 18ef. が
導入されました。これらはともに *note SyntaxError: 189. のサブクラスで、
Python コードに不適切なインデントが見つかると送出されます。


File: python.info,  Node: ビルトイン関数の変更,  Prev: 言語のマイナー変更,  Up: その他の言語コアの変更

1.25.9.2 ビルトイン関数の変更
.............................

新しいビルトイン関数 ‘zip(seq1, seq2, ...)’ が追加されました。 *note
zip(): 446. はタプルのリストを返します。それぞれは、引数のシーケンスのそ
れぞれの i 番目要素たちを含むタプルです。 ‘zip()’ と ‘map(None, seq1,
seq2)’ の違いは、 *note map(): 445. はシーケンスが同じ長さを持たない場合
に ‘None’ が埋められるのに対し、 ‘zip()’ は返すリストの長さを、引数のシ
ーケンスの最も短い長さに切り詰めます。

The *note int(): 32e. 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: 29c. exception with the message "can't convert
non-string with explicit base".

*note sys: e2. モジュールに、これまでより詳細なバージョン情報を持つ変数
が追加されました。 ‘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(): 8d9. と *note sys.setrecursionlimit(): 8d8. を
使って読み取れ、修正出来ます。このデフォルトは 1000 です。また、当該プラ
ットフォームでのおよその最大値は、新たに追加されたスクリプト
‘Misc/find_recursionlimit.py’ を実行することで知ることが出来ます。


File: python.info,  Node: Python 2 0 への移植,  Next: 拡張と埋め込みについての変更,  Prev: その他の言語コアの変更,  Up: What's New in Python 2 0

1.25.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(): abf. and *note insert(): 1556.  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:
29c. 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(): 3b9, 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: d4. モジュールのいくつかの関数についてはまだこの方法が許さ
れています。例えば、 ‘socket.connect( ('hostname', 25) )’ が正しい形式な
のですが、 ‘socket.connect('hostname', 25)’ も動作します。*note
socket.connect_ex: 18f2. と *note socket.bind: 1481. も同じようにおおら
かです。2.0alpha1 がそれら関数を厳しくしたのですが、ドキュメントが実際に
は複数引数を取る形式で誤って書かれたために、多くの人々がその厳しくなった
チェックに違反してしまうコードを書いてしまいました。GvR はその変更を、市
民たちの反応を受けて元に戻し、 ‘socket’ モジュールについてはドキュメント
は修正されて、複数引数形式は非推奨としてマークするに留められました。将来
バージョンの Python においてこれはもう一度厳しく 'なります' 。 (--訳注:
What's New からは読み取れませんが少なくとも 2.7 では単一引数でしか渡せま
せん。つまり明示的にタプルにして渡す必要があります。--)

文字列リテラル内の ‘\x’ エスケープは、正確に 2 桁の 16 進表記文字になり
ました。以前は 'x' に続く 16 進表記文字全てを消費して最後の 8 ビットを使
っていたため、 ‘\x123456’ は ‘\x56’ と同じでした。

例外 *note AttributeError: 1b4. と *note NameError: 66c. がよりフレンド
リなエラーメッセージを持つようになっています。それらのテキストは ‘'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: 29c.  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(): 1ea. してももは
や末尾の 'L' 文字が付かないことです。 *note repr(): 462. では今でも付く
のにも関わらずです。 'L' は長整数を普通の整数と全く同じように印字したい
多くの人々を悩ませてきました。それを各々自分なりの手段で取り除く必要があ
ったからです。これはもう 2.0 では問題でなくなりましたが、 'L' が付くこと
をあてにして ‘str(longval)[:-1]’ とするコードが今度は数値の最後の桁を失
ってしまいます。

Taking the *note repr(): 462. of a float now uses a different formatting
precision than *note str(): 1ea.  ‘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.25.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(): 2fb. and *note issubclass(): 2fc.  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(): 807, *note PyModule_AddIntConstant(): 18f4, and
*note PyModule_AddStringConstant(): 18f5.  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(): 18f6. でシグナルハンドラを取得し、 *note PyOS_setsig():
18f7. で新しいハンドラをセットします。


File: python.info,  Node: Distutils モジュールの簡単インストール,  Next: XML モジュール,  Prev: 拡張と埋め込みについての変更,  Up: What's New in Python 2 0

1.25.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.25.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: 129. 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.25.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(): 18fb.
and *note endElement(): 18fc. methods are called for every starting and
end tag encountered by the parser, the *note characters(): 18fd. 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.25.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: 12b. 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.25.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: 129. package.

結論として、Python 2.0 の *note xml: 129. パッケージは 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.25.14 更新されたモジュール
----------------------------

Lots of improvements and bugfixes were made to Python's extensive
standard library; some of the affected modules include *note readline:
c2, *note ConfigParser: 26, ‘cgi’, *note calendar: 15, *note posix: b2,
‘readline’, ‘xmllib’, ‘aifc’, ‘chunk’, *note wave: 11c, *note random:
c0, *note shelve: cb, and ‘nntplib’.  Consult the CVS logs for the exact
patch-by-patch details.

Brian Gallew contributed OpenSSL support for the *note socket: d4.
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: 71. and *note urllib: 111. modules were also changed to
support ‘https://’ URLs, though no one has implemented FTP or SMTP over
SSL.

The *note httplib: 71. 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: 2e. モジュールが、Oliver Andrich による拡張版をもとに大規
模に拡張され、ncurses と SYSV curses からの多くの追加機能、例えば色付き
の表示、別の文字集合サポート、パッド、マウスサポートなどをサポートするよ
うになりました。このことは、モジュールが BSD curses だけしか持っていない
OS とは互換性が無いことを意味しますが、現在メンテナンスされている OS で
そういう類のものは無さそうです。

2.0 の Unicode サポートについて前述したように、 *note re: c1. モジュール
で提供される正規表現の根底となる実装が変更されました。SRE は新しい正規表
現エンジンで、Fredrik Lundh によって書かれ、部分的に Hewlett Packard 社
により寄贈されました。これは 8 ビット文字列と Unicode 文字列両方に合致す
るようサポートされています。


File: python.info,  Node: 新しいモジュール<2>,  Next: IDLE の改善,  Prev: 更新されたモジュール,  Up: What's New in Python 2 0

1.25.15 新しいモジュール
------------------------

数多くのモジュールが新しく追加されました。ここではそれらを短い説明ととも
に列挙するだけにします。特定のモジュールの詳細は 2.0 のドキュメントを調
べてください。

   * *note atexit: d.: Python インタプリタが終了する前に呼び出す関数を登
     録します。これまで ‘sys.exitfunc’ に直接セットしてきたコードは
     ‘atexit’ モジュールを代わりに用いるように修正してください。
     ‘atexit’ をインポートし、 *note atexit.register(): c58. で終了時に
     呼び出す関数を登録します。(Contributed by Skip Montanaro.)

   * *note codecs: 1c, ‘encodings’, *note unicodedata: 10e.: Added as
     part of the new Unicode support.

   * *note filecmp: 5d.: Supersedes the old ‘cmp’, ‘cmpcache’ and
     ‘dircmp’ modules, which have now become deprecated.  (Contributed
     by Gordon MacMillan and Moshe Zadka.)

   * *note gettext: 66.: このモジュールは 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: 1759. な文字列であるかのように振る舞い、これによ
     り読み書き出来ます。それらは例えば *note re: c1. モジュールのような
     普通は文字列を期待するような関数にさえも渡せます。(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: 116.: 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: e6.: Python ソースコードが曖昧なインデントになって
     いないかをチェックするモジュール/スクリプトです。 (Contributed by
     Tim Peters.)

   * ‘UserString’: A base class useful for deriving objects that behave
     like strings.

   * *note webbrowser: 11e.: 指定した URL で、プラットフォームに依存しな
     い方法でウェブブラウザを起動するモジュールです。個々のプラットフォ
     ームにおいて様々なブラウザが特定の順序で試されます。ユーザはどのブ
     ラウザを起動するかを環境変数 'BROWSER' をセットすることで変更出来ま
     す。(元々は Eric S. Raymond による *note urllib: 111. への、同じ機
     能追加をするパッチに触発されましたが、最終的なモジュールは Fred
     Drake が元々 ‘Tools/idle/BrowserControl.py’ として実装したものに由
     来し、Fred が標準ライブラリに適合させました。)

   * *note _winreg: 11f.: 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: 13a.: ZIP 形式アーカイブの読み書きのためのモジュール
     です。DOS/Windows での ‘PKZIP’ や Unix での ‘zip’ により生成される
     アーカイブで、 ‘gzip’ 形式とは混同しないで下さい (こちらは *note
     gzip: 6a. モジュールによってサポートされています)。(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.25.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.25.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.25.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/main/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.26 変更履歴
=============

* Menu:

* Python next::
* Python 3.15.0 beta 1: Python 3 15 0 beta 1.
* Python 3.15.0 alpha 8: Python 3 15 0 alpha 8.
* Python 3.15.0 alpha 7: Python 3 15 0 alpha 7.
* Python 3.15.0 alpha 6: Python 3 15 0 alpha 6.
* Python 3.15.0 alpha 5: Python 3 15 0 alpha 5.
* Python 3.15.0 alpha 4: Python 3 15 0 alpha 4.
* Python 3.15.0 alpha 3: Python 3 15 0 alpha 3.
* Python 3.15.0 alpha 2: Python 3 15 0 alpha 2.
* Python 3.15.0 alpha 1: Python 3 15 0 alpha 1.
* 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 15 0 beta 1,  Up: 変更履歴

1.26.1 Python next
------------------

'Release date: XXXX-XX-XX'

* Menu:

* Windows::
* テスト::
* セキュリティ::
* ライブラリ::
* Core and Builtins::
* C API::
* ビルド::


File: python.info,  Node: Windows,  Next: テスト,  Up: Python next

1.26.1.1 Windows
................

   - gh-149786(1): Fixes virtual environment launchers on Windows
     free-threaded builds.

   - gh-124111(2): Updated Windows builds to use Tcl/Tk 9.0.3.

   - gh-138489(3): Windows distributions now include a
     ‘build-details.json’ file (see PEP 739(4)).  The legacy installer
     does not install it, but all other distributions from python.org
     and all preset configurations in the ‘PC\layout’ script will
     include one.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149786

   (2) https://github.com/python/cpython/issues/124111

   (3) https://github.com/python/cpython/issues/138489

   (4) https://peps.python.org/pep-0739/


File: python.info,  Node: テスト,  Next: セキュリティ,  Prev: Windows,  Up: Python next

1.26.1.2 テスト
...............

   - gh-149776(1): 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/149776


File: python.info,  Node: セキュリティ,  Next: ライブラリ,  Prev: テスト,  Up: Python next

1.26.1.3 セキュリティ
.....................

   - gh-149698(1): Update bundled libexpat(2) to version 2.8.1 for the
     fix for CVE 2026-45186(3).

   - gh-87451(4): The *note ftplib: 61. 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:
     cce, 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-149474(5): Fix the binary writer in *note profiling.sampling:
     b6. not firing the audit ( PEP 578(6)) when creating the output
     file.  The writer and the reader now accept any path-like object.
     Patch by Maurycy Pawłowski-Wieroński.

   - gh-149486(7): *note tarfile.data_filter(): 284. 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-149018(8): Improved protection against XML hash-flooding attacks
     in *note xml.parsers.expat: 12f. and *note xml.etree.ElementTree:
     12e. when Python is compiled with libExpat 2.8.0 or later.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149698

   (2) https://libexpat.github.io/

   (3) https://www.cve.org/CVERecord?id=CVE-2026-45186

   (4) https://github.com/python/cpython/issues/87451

   (5) https://github.com/python/cpython/issues/149474

   (6) https://peps.python.org/pep-0578/

   (7) https://github.com/python/cpython/issues/149486

   (8) https://github.com/python/cpython/issues/149018


File: python.info,  Node: ライブラリ,  Next: Core and Builtins,  Prev: セキュリティ,  Up: Python next

1.26.1.4 ライブラリ
...................

   - gh-149980(1): Fix *note tarfile: e7. so that GNU long-name
     directory entries have all trailing slashes stripped from their
     names, matching the behavior for short-name entries.  Previously,
     only a single trailing slash was removed.

   - gh-146452(2): Fix race condition when pickling dictionaries in free
     threaded builds.  Also reduce critical section cover.

   - gh-79413(3): Update *note dataclasses.make_dataclass(): 190d. to
     add a 'qualname' parameter.  The 'qualname' parameter will be used
     to set the ‘__qualname__’ of the created ‘dataclass’.

   - gh-149921(4): Fix reference leaks in error paths of the
     ‘_interpchannels’ and ‘_interpqueues’ extension modules.

   - gh-142349(5): Add *note lazy: 182. to the list of support topic by
     *note help(): cad.

   - gh-149816(6): Fix a race condition in ‘_random.Random.__init__’
     method in free-threading mode.

   - gh-149801(7): Add IANA registered names and aliases with leading
     zeros before number (like IBM00858, CP00858, IBM01140, CP01140) for
     corresponding codecs.

   - gh-149720(8): Remove support for undotted 'ext' in *note
     mimetypes.MimeTypes.add_type(): 159.

   - gh-149718(9): Coalesce consecutive identical stack frames in
     Tachyon, so aggregating collectors (pstats, collapsed, flamegraph,
     gecko) receive one collect.  Improves sample rate 3x, error rate
     and missed rate drop by 70%.  Patch by Maurycy Pawłowski-Wieroński.

   - gh-149701(10): Fix bad return code from Lib/venv/bin/activate if
     hashing is disabled

   - gh-149504(11): Fix *note site.addsitedir(): 190e. to allow
     re-entrant calls from within startup files.  Previously, a ‘.pth’
     file containing an ‘import’ line that called ‘site.addsitedir()’
     (or a ‘.start’ entry point doing the same) could crash with
     ‘RuntimeError: dictionary changed size during iteration’ during
     site initialization, breaking tools such as ‘uv run --with’.

   - gh-149634(12): Remove deprecated and unused
     ‘tarfile.TarInfo.tarfile’ attribute.

   - gh-139489(13): Add *note xml.is_valid_text(): 2bf. to
     ‘xml.__all__’.

   - gh-149614(14): Fix a regression that broke the ability to deepcopy
     *note argparse.ArgumentParser: 1e7. instances.

   - gh-149600(15): Remove deprecated ‘asyncio.iscoroutinefunction()’
     function.

   - gh-149598(16): Remove support of deprecated 'strm' argument for
     *note logging: 8a. handlers.

   - gh-149595(17): Remove the ‘sys._enablelegacywindowsfsencoding()’
     function which has been deprecated since Python 3.13.

   - gh-149567(18): Remove the ‘shutil.ExecError’ exception which has
     been deprecated since Python 3.14.

   - 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-149436(20): Improve performance of *note
     inspect.getattr_static(): 8aa.

   - gh-149537(21): Remove kw parameters from python version of *note
     functools.reduce(): 156. function.

   - gh-149530(22): Removed ‘symtable.Class.get_methods()’ which has
     been deprecated since 3.14.

   - gh-149528(23): Remove ‘annotationlib.ForwardRef._evaludate’
     deprecated method.

   - gh-149388(24): Make ‘asyncio.windows_utils.PipeHandle’ closing
     idempotent.

   - gh-149499(25): Removed the ‘sysconfig.expand_makefile_vars()’
     function which has been deprecated since Python 3.14.  Use the
     ‘vars’ argument of *note sysconfig.get_paths(): 160. instead.

   - gh-149464(26): Add *note os.pidfd_getfd(): 14c. for duplicating a
     file descriptor from another process via a pidfd.  Available on
     Linux 5.6+.  Patch by Maurycy Pawłowski-Wieroński.

   - gh-148441(27): *note xml.parsers.expat: 12f.: prevent a crash in
     *note CharacterDataHandler(): 190f. when the character data size
     exceeds the parser's *note buffer size: 1910.

   - gh-146452(28): Fix segfault in *note pickle: ab. when pickling a
     dictionary concurrently mutated by another thread in the
     free-threaded build.

   - gh-140924(29): Add *note locale.localize(): 1911, *note
     locale.delocalize(): 11dd. and platform-specific locale constants
     from the ‘_locale’ module to ‘locale.__all__’.

   - gh-140344(30): The classes ‘ast.slice’, ‘ast.ExtSlice’,
     ‘ast.Index’, ‘ast.Suite’, ‘ast.AugLoad’, ‘ast.AugStore’, and
     ‘ast.Param’, deprecated since Python 3.9, now issue deprecation
     warnings on use.  They are now scheduled for removal in Python
     3.21.

     The ‘dims’ property of ‘ast.Tuple’ objects, deprecated since Python
     3.9, now issues a deprecation warning when accessed.  The property
     is scheduled for removal in Python 3.21.  Use the (non-deprecated)
     ‘elts’ property of ‘ast.Tuple’ objects instead.

     The deprecated global names are also no longer imported by ‘from
     ast import *’.

   - gh-86533(31): The *note os.makedirs(): 24b. function and *note
     pathlib.Path.mkdir(): 2e4. method now have a 'parent_mode'
     parameter to specify the mode for intermediate directories when
     creating parent directories.  This allows one to match the behavior
     from Python 3.6 and earlier for ‘os.makedirs()’.

   - gh-128110(32): Fix bug in the parsing of *note email: 3e. 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(33) encoded-words is now ignored, per section 6.2 (and
     consistent with existing parsing of unstructured headers like
     'Subject').

   - bpo-45509(34): Gzip headers are now checked for corrupted NAME,
     COMMENT and HCRC fields.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149980

   (2) https://github.com/python/cpython/issues/146452

   (3) https://github.com/python/cpython/issues/79413

   (4) https://github.com/python/cpython/issues/149921

   (5) https://github.com/python/cpython/issues/142349

   (6) https://github.com/python/cpython/issues/149816

   (7) https://github.com/python/cpython/issues/149801

   (8) https://github.com/python/cpython/issues/149720

   (9) https://github.com/python/cpython/issues/149718

   (10) https://github.com/python/cpython/issues/149701

   (11) https://github.com/python/cpython/issues/149504

   (12) https://github.com/python/cpython/issues/149634

   (13) https://github.com/python/cpython/issues/139489

   (14) https://github.com/python/cpython/issues/149614

   (15) https://github.com/python/cpython/issues/149600

   (16) https://github.com/python/cpython/issues/149598

   (17) https://github.com/python/cpython/issues/149595

   (18) https://github.com/python/cpython/issues/149567

   (19) https://github.com/python/cpython/issues/112821

   (20) https://github.com/python/cpython/issues/149436

   (21) https://github.com/python/cpython/issues/149537

   (22) https://github.com/python/cpython/issues/149530

   (23) https://github.com/python/cpython/issues/149528

   (24) https://github.com/python/cpython/issues/149388

   (25) https://github.com/python/cpython/issues/149499

   (26) https://github.com/python/cpython/issues/149464

   (27) https://github.com/python/cpython/issues/148441

   (28) https://github.com/python/cpython/issues/146452

   (29) https://github.com/python/cpython/issues/140924

   (30) https://github.com/python/cpython/issues/140344

   (31) https://github.com/python/cpython/issues/86533

   (32) https://github.com/python/cpython/issues/128110

   (33) https://datatracker.ietf.org/doc/html/rfc2047.html

   (34) https://bugs.python.org/issue?@action=redirect&bpo=45509


File: python.info,  Node: Core and Builtins,  Next: C API,  Prev: ライブラリ,  Up: Python next

1.26.1.5 Core and Builtins
..........................

   - gh-149590(1): Fix crash when faulthandler is imported more than
     once.

   - gh-138325(2): Speed up converting a list to a tuple in the
     ‘tuple(genexpr)’ fast path and in starred tuple displays (e.g.
     ‘(*a, *b)’) by stealing the list's items into the tuple instead of
     copying them.

   - gh-149816(3): Fix a race condition in ‘_PyBytes_FromList’ in
     free-threading mode.

   - gh-149816(4): Fix a race condition in *note memoryview: 1dd. with
     free-threading.

   - gh-139808(5): Add branch protections for AArch64 (BTI/PAC) in
     assembly code used by *note -X perf_jit: 183. (Linux perf profiler
     integration).

   - gh-149676(6): Fix ‘frozendict | frozendict’ hash.

   - gh-149642(7): Allow imports inside ‘exec()’ calls within functions
     under ‘PYTHON_LAZY_IMPORTS=all’.

   - gh-144957(8): Fix lazy ‘from’ imports of module attributes provided
     by module-level ‘__getattr__’.

   - gh-149459(9): Fix a crash in the JIT optimizer when a specialized
     ‘LOAD_SPECIAL’ guard deoptimized after inserting the synthetic
     ‘NULL’ stack entry.

   - gh-75723(10): Avoid re-executing ‘.pth’ files when *note
     site.addsitedir(): 190e. is called for a known directory.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149590

   (2) https://github.com/python/cpython/issues/138325

   (3) https://github.com/python/cpython/issues/149816

   (4) https://github.com/python/cpython/issues/149816

   (5) https://github.com/python/cpython/issues/139808

   (6) https://github.com/python/cpython/issues/149676

   (7) https://github.com/python/cpython/issues/149642

   (8) https://github.com/python/cpython/issues/144957

   (9) https://github.com/python/cpython/issues/149459

   (10) https://github.com/python/cpython/issues/75723


File: python.info,  Node: C API,  Next: ビルド,  Prev: Core and Builtins,  Up: Python next

1.26.1.6 C API
..............

   - gh-149725(1): Add *note PySentinel_CheckExact(): 1914. for exact
     *note sentinel: 196. type tests to accompany the existing *note
     PySentinel_Check(): 1915.

   - gh-145235(2): Made *note PyDict_AddWatcher(): 603, *note
     PyDict_ClearWatcher(): 1916, *note PyDict_Watch(): 96e, and *note
     PyDict_Unwatch(): 1917. thread-safe on the *note free threaded:
     48e. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149725

   (2) https://github.com/python/cpython/issues/145235


File: python.info,  Node: ビルド,  Prev: C API,  Up: Python next

1.26.1.7 ビルド
...............

   - gh-115119(1): Removed bundled copy of the libmpdec, use system
     library if it's available.  Patch by Sergey B Kirpichev.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115119


File: python.info,  Node: Python 3 15 0 beta 1,  Next: Python 3 15 0 alpha 8,  Prev: Python next,  Up: 変更履歴

1.26.2 Python 3.15.0 beta 1
---------------------------

'Release date: 2026-05-07'

* Menu:

* セキュリティ: セキュリティ<2>.
* Core and Builtins: Core and Builtins<2>.
* ライブラリ: ライブラリ<2>.
* ドキュメント: ドキュメント<2>.
* テスト: テスト<2>.
* ビルド: ビルド<2>.
* Windows: Windows<2>.
* macOS::
* IDLE: IDLE<3>.
* C API: C API<2>.


File: python.info,  Node: セキュリティ<2>,  Next: Core and Builtins<2>,  Up: Python 3 15 0 beta 1

1.26.2.1 セキュリティ
.....................

   - gh-149254(1): Update Android and iOS installer to use OpenSSL
     3.5.6.

   - gh-149017(2): Update bundled libexpat(3) to version 2.8.0.

   - gh-148252(4): Fixed string table and sample record bounds checks in
     ‘_remote_debugging’ when decoding certain ‘.pyb’ inputs on 32-bit
     builds.  Patch by Maurycy Pawłowski-Wieroński.

   - gh-90309(5): Base64-encode values when embedding cookies to
     JavaScript using the *note http.cookies.BaseCookie.js_output():
     301. method to avoid injection and escaping.

   - gh-148808(6): Added buffer boundary check when using ‘nbytes’
     parameter with ‘asyncio.AbstractEventLoop.sock_recvfrom_into()’.
     Only relevant for Windows and the *note asyncio.ProactorEventLoop:
     a03.

   - gh-148395(7): Fix a dangling input pointer in *note
     lzma.LZMADecompressor: 191b, *note bz2.BZ2Decompressor: 191c, and
     internal ‘zlib._ZlibDecompressor’ when memory allocation fails with
     *note MemoryError: 191d, which could let a subsequent
     ‘decompress()’ call read or write through a stale pointer to the
     already-released caller buffer.

   - gh-148252(8): Fixed stack depth calculation in ‘_remote_debugging’
     when decoding certain ‘.pyb’ inputs on 32-bit builds.  Issue
     originally identified and diagnosed by Tristan Madani
     (@TristanInSec on GitHub).

   - gh-148178(9): Hardened ‘_remote_debugging’ by validating remote
     debug offset tables before using them to size memory reads or
     interpret remote layouts.

   - gh-148169(10): A bypass in *note webbrowser: 11e. allowed URLs
     prefixed with ‘%action’ to pass the dash-prefix safety check.

   - gh-146581(11): Fix vulnerability in *note shutil.unpack_archive():
     887. 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-137586(12): Fix a PATH-injection vulnerability in *note
     webbrowser: 11e. on macOS where ‘osascript’ was invoked without an
     absolute path.  The new ‘MacOS’ class uses ‘/usr/bin/open’
     directly, eliminating the dependency on ‘osascript’ entirely.

   - gh-146333(13): Fix quadratic backtracking in *note
     configparser.RawConfigParser: 1313. option parsing regexes
     (‘OPTCRE’ and ‘OPTCRE_NV’).  A crafted configuration line with many
     whitespace characters could cause excessive CPU usage.

   - gh-146211(14): 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/148252

   (5) https://github.com/python/cpython/issues/90309

   (6) https://github.com/python/cpython/issues/148808

   (7) https://github.com/python/cpython/issues/148395

   (8) https://github.com/python/cpython/issues/148252

   (9) https://github.com/python/cpython/issues/148178

   (10) https://github.com/python/cpython/issues/148169

   (11) https://github.com/python/cpython/issues/146581

   (12) https://github.com/python/cpython/issues/137586

   (13) https://github.com/python/cpython/issues/146333

   (14) https://github.com/python/cpython/issues/146211


File: python.info,  Node: Core and Builtins<2>,  Next: ライブラリ<2>,  Prev: セキュリティ<2>,  Up: Python 3 15 0 beta 1

1.26.2.2 Core and Builtins
..........................

   - gh-148940(1): Revert the process size based deferral of garbage
     collection (gh-133464(2)).  The performance issue this change
     resolves is also fixed by gh-142562(3).  This approach has the
     problem that process size as seen by the OS (e.g.  the resident
     size or RSS) does not immediately decrease after cyclic garbage is
     freed since mimalloc defers returning memory of the OS. This change
     applies to the free-threaded GC only.

   - gh-149243(4): Check for recursion limits in
     ‘CALL_ALLOC_AND_ENTER_INIT’ opcode.

   - gh-126910(5): Add support for unwinding JIT frames using GNU
     backtrace.  Patch by Diego Russo and Pablo Galindo

   - gh-149171(6): Allow assignment to the ‘__module__’ attribute of
     *note typing.TypeAliasType: 531. instances.

   - gh-149122(7): Fix a crash in optimized calls to *note all(): 17da,
     *note any(): 17d9, *note tuple(): 1d9, *note list(): 4e0, and *note
     set(): 432. 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-149049(8): Fix stack underflow for ‘BINARY_OP’ in tier 2.

   - gh-83065(9): Fix a deadlock that could occur when one thread is
     importing a submodule (for example ‘import pkg.sub.mod’) while
     another thread is importing one of its parent packages (for example
     ‘import pkg.sub’) and that parent's ‘__init__.py’ itself imports
     the submodule.  The import system now acquires module locks in
     hierarchical (parent-before-child) order so the two threads
     serialise instead of raising ‘_DeadlockError’.

   - gh-113956(10): Fix a data race in *note sys.intern(): 1695. 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-148850(11): Fix the memory sanitizer false positive in *note
     os.getrandom(): 107f.

   - gh-148820(12): 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-148829(13): Add *note sentinel: 196, implementing PEP 661(14).
     PEP by Tal Einat; patch by Jelle Zijlstra.

   - gh-146270(15): Fix a sequential consistency bug in
     ‘structmember.c’.

   - gh-148766(16): The interpreter help (such as ‘python --help’) is
     now in color.  Patch by Hugo van Kemenade.

   - gh-148571(17): Fix a crash in the JIT optimizer when specialized
     opcode families inherited incompatible recorded operand layouts.

   - gh-148653(18): Forbid *note marshalling: 90. recursive code
     objects, *note slice: 1db. and *note frozendict: 18d. objects which
     cannot be correctly unmarshalled.

   - gh-142516(19): Forward-port the generational cycle garbage
     collector to the default 3.15 build, replacing the incremental
     collector while leaving the free-threaded collector unchanged.

   - gh-146462(20): Added ‘PyTypeObject.tp_basicsize’,
     ‘PyTypeObject.tp_dictoffset’, and ‘PyHeapTypeObject.ht_cached_keys’
     offsets to ‘_Py_DebugOffsets’ to support version-independent
     read-only dict introspection tools.

   - gh-145239(21): Unary plus is now accepted in *note match: 1df.
     literal patterns, mirroring the existing support for unary minus.
     Patch by Bartosz Sławecki.

   - gh-148515(22): Fix a bug in the JIT optimizer reading operands for
     uops with multiple caches.

   - gh-148390(23): Fix an undefined behavior in *note memoryview: 1dd.
     when using the native boolean format (‘?’) in *note cast(): 13f8.
     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(24): Fix a possible reference leak in a corrupted
     ‘TYPE_CODE’ marshal stream.

   - gh-148393(25): Fix data races between *note PyDict_Watch(): 96e. /
     *note PyDict_Unwatch(): 1917. and concurrent dict mutation in the
     *note free-threaded build: 1a3.

   - gh-148398(26): Fix a bug in the JIT optimizer where class attribute
     loads were not invalidated after type mutation.

   - gh-146527(27): Add a ‘GCMonitor’ class with a ‘get_gc_stats’ method
     to the ‘_remote_debugging’ module to allow reading GC statistics
     from an external Python process without requiring the full
     ‘RemoteUnwinder’ functionality.  Patch by Sergey Miryanov and Pablo
     Galindo.

   - gh-148284(28): 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(29): Remove critical section from ‘PyCode_Addr2Line()’ in
     free-threading.

   - gh-115802(30): Improve JIT code generation on Linux AArch64 by
     reducing the indirect call to external symbols.  Patch by Diego
     Russo.

   - gh-148189(31): Repaired undercount of bytes in type-specific free
     lists reported by sys._debugmallocstats().  For types that
     participate in cyclic garbage collection, it was missing two
     pointers used by GC.

   - gh-148222(32): Fix vectorcall support in *note types.GenericAlias:
     bcb. when the underlying type does not support the vectorcall
     protocol.  Fix possible leaks in ‘types.GenericAlias’ and *note
     types.UnionType: 52e. in case of memory error.

   - gh-148208(33): Fix recursion depth leak in *note PyObject_Print():
     191f.

   - gh-95004(34): The specializing interpreter now specializes for
     *note enum.Enum: a26. improving performance and scaling in
     free-threading.  Patch by Kumar Aditya.

   - gh-149202(35): Enable frame pointers by default for GCC-compatible
     CPython builds, including ‘-mno-omit-leaf-frame-pointer’, ‘-marm’
     on 32-bit ARM, and/or ‘-mbackchain’ on s390x platforms when the
     compiler supports them, so profilers and debuggers can unwind
     native interpreter frames more reliably.  Users can pass *note
     -without-frame-pointers: 3e4. to ‘./configure’ to opt out.

   - gh-148014(36): Accept a function name in *note -X presite: 183.
     command line option and *note PYTHON_PRESITE: 1920. environment
     variable.  Patch by Victor Stinner.

   - gh-147998(37): 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(38): Fix O(N²) compile-time regression in constant
     folding after it was moved from AST to CFG optimizer.

   - gh-146306(39): Specialize float true division in the tier 2
     optimizer with inplace mutation for uniquely-referenced operands.

   - gh-142186(40): Global *note sys.monitoring: e3. events can now be
     turned on and disabled on a per code object basis.  Returning
     ‘DISABLE’ from a callback disables the event for the entire code
     object (for the current tool).

   - gh-126910(41): Add support for unwinding JIT frames using GDB.
     Patch by Diego Russo and Pablo Galindo.

   - gh-146031(42): The unstable API
     _PyInterpreterState_SetEvalFrameFunc has a companion function
     _PyInterpreterState_SetEvalFrameAllowSpecialization to specify if
     specialization should be allowed.  When this option is set to 1 the
     specializer will turn Python -> Python calls into specialized
     opcodes which the replacement interpreter loop can choose to
     respect and perform inlined dispatch.

   - gh-145278(43): The *note encodings: 54. is now partially frozen,
     including the ‘aliases’ and ‘utf_8’ submodules.

     The *note linecache: 88. is now frozen.

   - gh-134584(44): Optimize and eliminate redundant ref-counting for
     ‘MAKE_FUNCTION’ in the JIT.

   - gh-143886(45): Reorder function annotations so positional-only
     arguments are returned before other arguments.  This fixes how
     *note functools.singledispatch(): a2f. registers functions with
     positional-only arguments.

   - gh-98894(46): Restore ‘function__entry’ and ‘function__return’
     DTrace/SystemTap probes that were broken since Python 3.11.

   - gh-116021(47): Support for creating instances of abstract AST nodes
     from the *note ast: 9. module is deprecated and scheduled for
     removal in Python 3.20.  Patch by Brian Schubert.

   - gh-137814(48): Fix the ‘__qualname__’ attribute of ‘__annotate__’
     functions on functions.

   - gh-137600(49): *note ast: 9.: The constructors of AST nodes now
     raise a *note TypeError: 29c. when a required argument is omitted
     or when a keyword argument that does not map to a field on the AST
     node is passed.  These cases had previously raised a *note
     DeprecationWarning: 2d4. since Python 3.13.  Patch by Brian
     Schubert.

   - gh-137293(50): Fix *note SystemError: 3f1. when searching ELF Files
     in *note sys.remote_exec(): 41f.

   - gh-135357(51): Add support for ‘socket.SO_PASSRIGHTS’ on Linux.

   - gh-134690(52): Removed deprecated in PEP 626(53) since Python 3.12
     ‘codeobject.co_lnotab’ from *note types.CodeType: 2ed.

   - gh-100239(54): Specialize ‘BINARY_OP’ for concatenation of lists
     and tuples, and propagate the result type through
     ‘_BINARY_OP_EXTEND’ in the tier 2 optimizer so that follow-up type
     guards can be eliminated.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/148940

   (2) https://github.com/python/cpython/issues/133464

   (3) https://github.com/python/cpython/issues/142562

   (4) https://github.com/python/cpython/issues/149243

   (5) https://github.com/python/cpython/issues/126910

   (6) https://github.com/python/cpython/issues/149171

   (7) https://github.com/python/cpython/issues/149122

   (8) https://github.com/python/cpython/issues/149049

   (9) https://github.com/python/cpython/issues/83065

   (10) https://github.com/python/cpython/issues/113956

   (11) https://github.com/python/cpython/issues/148850

   (12) https://github.com/python/cpython/issues/148820

   (13) https://github.com/python/cpython/issues/148829

   (14) https://peps.python.org/pep-0661/

   (15) https://github.com/python/cpython/issues/146270

   (16) https://github.com/python/cpython/issues/148766

   (17) https://github.com/python/cpython/issues/148571

   (18) https://github.com/python/cpython/issues/148653

   (19) https://github.com/python/cpython/issues/142516

   (20) https://github.com/python/cpython/issues/146462

   (21) https://github.com/python/cpython/issues/145239

   (22) https://github.com/python/cpython/issues/148515

   (23) https://github.com/python/cpython/issues/148390

   (24) https://github.com/python/cpython/issues/148418

   (25) https://github.com/python/cpython/issues/148393

   (26) https://github.com/python/cpython/issues/148398

   (27) https://github.com/python/cpython/issues/146527

   (28) https://github.com/python/cpython/issues/148284

   (29) https://github.com/python/cpython/issues/148037

   (30) https://github.com/python/cpython/issues/115802

   (31) https://github.com/python/cpython/issues/148189

   (32) https://github.com/python/cpython/issues/148222

   (33) https://github.com/python/cpython/issues/148208

   (34) https://github.com/python/cpython/issues/95004

   (35) https://github.com/python/cpython/issues/149202

   (36) https://github.com/python/cpython/issues/148014

   (37) https://github.com/python/cpython/issues/147998

   (38) https://github.com/python/cpython/issues/146455

   (39) https://github.com/python/cpython/issues/146306

   (40) https://github.com/python/cpython/issues/142186

   (41) https://github.com/python/cpython/issues/126910

   (42) https://github.com/python/cpython/issues/146031

   (43) https://github.com/python/cpython/issues/145278

   (44) https://github.com/python/cpython/issues/134584

   (45) https://github.com/python/cpython/issues/143886

   (46) https://github.com/python/cpython/issues/98894

   (47) https://github.com/python/cpython/issues/116021

   (48) https://github.com/python/cpython/issues/137814

   (49) https://github.com/python/cpython/issues/137600

   (50) https://github.com/python/cpython/issues/137293

   (51) https://github.com/python/cpython/issues/135357

   (52) https://github.com/python/cpython/issues/134690

   (53) https://peps.python.org/pep-0626/

   (54) https://github.com/python/cpython/issues/100239


File: python.info,  Node: ライブラリ<2>,  Next: ドキュメント<2>,  Prev: Core and Builtins<2>,  Up: Python 3 15 0 beta 1

1.26.2.3 ライブラリ
...................

   - gh-148823(1): Defer the import of ‘_colorize’ in ‘argparse’ until
     needed for coloring output.

   - gh-141560(2): Add an 'annotation_format' parameter to *note
     inspect.getfullargspec(): b24.

   - gh-139489(3): Add the *note xml.is_valid_text(): 2bf. function,
     which allows to check whether a string can be used in the XML
     document.

   - gh-142389(4): Add backticks to stdlib argparse help to display in
     colour.  Patch by Hugo van Kemenade.

   - gh-149377(5): Update bundled pip to 26.1.1

   - gh-142389(6): Add backtick markup support in *note argparse: 7.
     option help text to highlight inline code when color output is
     enabled.  Patch by Hugo van Kemenade.

   - gh-148675(7): Remove ‘F’ and ‘D’ formats from *note array: 8. and
     *note memoryview: 1dd.  Patch by Victor Stinner.

   - gh-149342(8): Fix ‘_remote_debugging’ binary writing so that
     sampling a thread whose Python frame stack is empty (for example
     while it is in a C call or mid-syscall) no longer raises
     ‘RuntimeError("Invalid stack encoding type")’, and so that
     ‘BinaryWriter.total_samples’ after ‘finalize()’ or context-manager
     exit includes samples flushed from the RLE buffer.  Patch by
     Maurycy Pawłowski-Wieroński.

   - gh-149010(9): The ‘inspect’ module CLI now reports as much
     information as it has available for non-source modules when
     ‘--details’ is specified, and provides an error message rather than
     a traceback when ‘--details’ is omitted.  It also reports improved
     information when the given target location is not the target's
     defining location and when the given target is a data value rather
     than a class or function definition.

   - gh-146609(10): Use *note argparse: 7. for colour help *note timeit:
     f8. CLI. Patch by Hugo van Kemenade.

   - gh-142389(11): Add backticks for colour to regrtest and pdb's help
     description.  Patch by Hugo van Kemenade.

   - gh-144384(12): Lazily import ‘_colorize’.  Patch by Hugo van
     Kemenade.

   - gh-149321(13): Fix import cycles exposed by running standard
     library modules with ‘-X lazy_imports=none’.

   - gh-145378(14): Generate consistent colors for *note pdb: aa.
     commands in ‘pdb’ REPL.

   - gh-149296(15): Add a ‘dump’ subcommand to *note profiling.sampling:
     b6. that prints a single traceback-style snapshot of a running
     process's Python stack, including per-thread status, source line
     highlighting, optional bytecode opcode names, and async-aware task
     reconstruction.  Patch by Pablo Galindo.

   - gh-143231(16): A 'module' attribute has been added to
     ‘warnings.WarningMessage’.

   - gh-148675(17): *note ctypes: 2d.: Change the *note _type_: 2d8. of
     *note c_float_complex: 2d9, *note c_double_complex: 2da. and *note
     c_longdouble_complex: 2db. from ‘F’, ‘D’ and ‘G’ to ‘Zf’, ‘Zd’ and
     ‘Zg’ for compatibility with numpy.  Patch by Victor Stinner.

   - gh-148675(18): The *note array.typecodes: 1e9. type changed from
     *note str: 1ea. to *note tuple: 1d9. to support type codes longer
     than 1 character (‘Zf’ and ‘Zd’).  Patch by Victor Stinner.

   - gh-149221(19): Catch rare math domain error for *note
     random.binomialvariate(): 8c5.

   - gh-149231(20): In *note tomllib: 105, the number of parts in TOML
     keys is now limited.

   - gh-143231(21): *note unittest.TestCase.assertWarns(): 2ab. and
     *note unittest.TestCase.assertWarnsRegex(): 2ac. no longer swallow
     warnings that do not match the specified category or regex.  Nested
     context managers are now supported.

   - gh-149214(22): Fix ‘_remote_debugging’ misreading non-ASCII Unicode
     strings (Latin-1, BMP and non-BMP) from a remote process.
     Filenames and function names that contain non-ASCII characters are
     now reported correctly in stack traces, the sampling profiler, and
     *note asyncio: b. task introspection.

   - gh-149189(23): *note pprint: b3. now uses modern defaults:
     ‘indent=4’ and ‘width=88’, and the default ‘compact=False’ output
     is now formatted similar to pretty-printed *note json.dumps(): 254,
     with opening parentheses and brackets followed by a newline and the
     contents indented by one level.  The 'expand' parameter, added in
     3.15.0a8, has been removed; ‘compact=False’ (the default) now
     produces the former ‘expand=True’ layout.  Patch by Hugo van
     Kemenade.

   - gh-149173(24): Fix inverted *note PYTHON_BASIC_REPL: 459.
     environment check in ‘pdb._pyrepl_available’.

   - gh-149117(25): Fix *note runpy.run_module(): 1922. and *note
     runpy.run_path(): 6b4. to set the *note name: 1923. attribute on
     the *note ImportError: 1c8. they raise.

   - gh-149148(26): *note ensurepip: 58.: Upgrade bundled pip to 26.1.
     This version fixes the CVE 2026-3219(27) vulnerability.  Patch by
     Victor Stinner.

   - gh-149009(28): Validate that *note profiling.sampling: b6. binary
     profiles do not contain more unique (thread, interpreter) pairs
     than declared in the header.  Patch by Maurycy Pawłowski-Wieroński.

   - gh-148292(29): *note ssl: d8.: Update *note ssl.SSLSocket: cbf. and
     *note ssl.SSLObject: f44. for OpenSSL 4.  The classes now remember
     if they get a *note ssl.SSLEOFError: 1924.  In this case, following
     *note read(): 1222, ‘sendfile()’, *note write(): 1223, and *note
     do_handshake(): 1221. calls raise ‘ssl.SSLEOFError’ without calling
     the underlying OpenSSL function.  Thanks to that, ‘ssl.SSLSocket’
     behaves the same on all OpenSSL versions on EOF. Patch by Victor
     Stinner.

   - gh-149085(30): Add a 'max_threads' keyword argument to *note
     faulthandler.dump_traceback(): 225, *note
     faulthandler.dump_traceback_later(): 226, *note
     faulthandler.enable(): 224, and *note faulthandler.register(): 227.

   - gh-148641(31): *note pkgutil.resolve_name(): 1925. gets a new
     optional, keyword-only argument called ‘strict’.  The default is
     ‘False’ for backward compatibility.

   - gh-148093(32): Fix an out-of-bounds read of one byte in *note
     binascii.a2b_uu(): 1926.  Raise *note binascii.Error: 13d2, instead
     of reading past the buffer end.

   - gh-149083(33): *note dataclasses.MISSING: 1927. and *note
     dataclasses.KW_ONLY: 1928. are now instances of *note sentinel:
     196.

   - gh-148914(34): Fix memoization of in-band *note PickleBuffer: 1929.
     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-149026(35): Add colour to *note pickletools: ac. CLI output.
     Patch by Hugo van Kemenade.

   - gh-148991(36): Add colour to *note tokenize: 104. CLI output.
     Patch by Hugo van Kemenade.

   - gh-138907(37): Support RFC 9309(38) in *note urllib.robotparser:
     116.

   - gh-148981(39): Add 'color' parameter to *note ast.dump(): 1ec.

   - gh-148849(40): Deprecate *note http.cookies.Morsel.js_output():
     300. and *note http.cookies.BaseCookie.js_output(): 301, which will
     be removed in Python 3.19.  Use *note http.cookies.Morsel.output():
     302. or *note http.cookies.BaseCookie.output(): 303. instead.

   - gh-146311(41): Add a 'canonical' keyword-only parameter to the
     base16, base32, base64, base85, ascii85, and Z85 decoders in *note
     base64: f. and *note binascii: 11.  When true, encodings with
     non-zero padding bits (base16/32/64) or non-canonical encodings
     (base85/ascii85) are rejected.  Single-character final groups in
     *note binascii.a2b_ascii85(): 204. and *note binascii.a2b_base85():
     206. are now always rejected as encoding violations, regardless of
     'canonical'; previously they were silently ignored and produced no
     output bytes.

   - gh-148947(42): Fix crash in *note @dataclasses.dataclass: 6ec. with
     ‘slots=True’ that occurred when a function found within the class
     had an empty ‘__class__’ cell.

   - gh-148680(43): ‘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-124397(44): The threading module added tooling to support
     concurrent iterator access: *note threading.serialize_iterator:
     28a, *note threading.synchronized_iterator(): 28b, and *note
     threading.concurrent_tee(): 28c.

   - gh-148801(45): *note xml.etree.ElementTree: 12e.: Fix a crash in
     *note Element.__deepcopy__: 192a. on deeply nested trees.

   - gh-148735(46): *note xml.etree.ElementTree: 12e.: Fix a
     use-after-free in *note Element.findtext: 192b. when the element
     tree is mutated concurrently during the search.

   - gh-148740(47): Fix usage for *note uuid: 119. command-line
     interface to support a custom namespace be provided for uuid3 and
     uuid5.

   - gh-148688(48): *note bz2: 14, *note compression.zstd: 23, *note
     lzma: 8d, *note zlib: 13c.: Fix a double free on memory allocation
     failure.  Patch by Victor Stinner.

   - gh-148675(49): *note array: 8, *note struct: de.: Add support for
     ‘Zd’ and ‘Zf’ formats for double complex and float complex.  Patch
     by Victor Stinner.

   - gh-148651(50): Fix reference leak in *note
     compression.zstd.ZstdDecompressor: 192c. when an invalid option key
     is passed.

   - gh-148641(51): PEP 829(52) (package startup configuration files)
     implements a new format ‘<name>.start’ parallel to ‘<name>.pth’
     files, to replace ‘import’ lines in the latter.

   - gh-148639(53): Implement PEP 800(54), adding the *note
     @typing.disjoint_base: 29d. decorator.  Patch by Jelle Zijlstra.

   - gh-148615(55): Fix *note pdb: aa. to accept standard - end of
     options separator.  Reported by haampie.  Patched by Shrey
     Naithani.

   - gh-146553(56): Fix infinite loop in *note typing.get_type_hints():
     aa3. when ‘__wrapped__’ forms a cycle.  Patch by Shamil Abdulaev.

   - gh-148599(57): Update the *note socket: d4. module's WSA error
     messages to match official documentation.

   - gh-148508(58): An intermittent timing error when running SSL tests
     on iOS has been resolved.

   - gh-144881(59): *note asyncio: b. debugging tools (‘python -m
     asyncio ps’ and ‘pstree’) now retry automatically on transient
     errors that can occur when attaching to a process under active
     thread delegation.  The number of retries can be controlled with
     the ‘--retries’ flag.  Patch by Bartosz Sławecki.

   - gh-148518(60): 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(61): Add missing ‘__ctype_le/be__’ attributes for *note
     c_float_complex: 2d9. and *note c_double_complex: 2da.  Patch by
     Sergey B Kirpichev.

   - gh-148370(62): *note configparser: 26.: prevent quadratic behavior
     when a *note ParsingError: 919. is raised after a parser fails to
     parse multiple lines.  Patch by Bénédikt Tran.

   - gh-121190(63): ‘importlib.resources.files()’ now emits a more
     meaningful error message when module spec is None (as found in some
     ‘__main__’ modules).

   - gh-127012(64): ‘importlib.abc.Traversable.read_text’ now
     allows/solicits an ‘errors’ parameter.

   - gh-137855(65): Improve import time of *note dataclasses: 32. module
     by lazy importing *note re: c1. and *note copy: 29. modules.

   - gh-148352(66): Add more color to *note calendar: 15.'s CLI output.
     Patch by Hugo van Kemenade.

   - gh-148254(67): Use singular "sec" instead of "secs" in *note
     timeit: f8. verbose output for consistency with other time units.

   - gh-130472(68): Integrate fancycompleter with import completions.

   - gh-148241(69): *note json: 85.: Fix serialization: no longer call
     ‘str(obj)’ on *note str: 1ea. subclasses.  Patch by Victor Stinner.

   - gh-148225(70): The *note profiling.sampling: b6. ‘replay’ command
     now rejects non-binary profile files with a clear error explaining
     that replay only accepts files created with ‘--binary’.

   - gh-148192(71): ‘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-148207(72): *note typing.TypeVarTuple: 29e. now accepts ‘bound’,
     ‘covariant’, ‘contravariant’, and ‘infer_variance’ parameters,
     matching the interface of *note typing.TypeVar: 29f. and *note
     typing.ParamSpec: 2a0.

   - gh-148100(73): *note Soft deprecate: 1b2. *note re.match(): 258.
     and *note re.Pattern.match(): 259. in favour of *note
     re.prefixmatch(): 256. and *note re.Pattern.prefixmatch(): 257.
     Patch by Hugo van Kemenade.

   - gh-147991(74): Improve *note tomllib: 105. import time (up to 10x
     faster).  Patch by Victor Stinner.

   - gh-147957(75): Guarantees that *note
     collections.UserDict.popitem(): 192d. will pop in the same order as
     the wrapped dictionary rather than an arbitrary order.

   - gh-146256(76): The ‘profiling.sampling’ module now supports JSONL
     output format via ‘--jsonl’.  Each run emits a newline-delimited
     JSON file that is sequentially parseable by external tools,
     scripts, and programmatic consumers.  Patch by Maurycy
     Pawłowski-Wieroński.

   - gh-146609(77): Add colour to *note timeit: f8. CLI output.  Patch
     by Hugo van Kemenade.

   - gh-146563(78): *note xml.parsers.expat: 12f.: add an exception note
     when a custom Expat handler return value cannot be properly
     interpreted.  Patch by Bénédikt Tran.

   - gh-137586(79): Add ‘MacOS’ to *note webbrowser: 11e. for macOS,
     which opens URLs via ‘/usr/bin/open’ instead of piping AppleScript
     to ‘osascript’.  Deprecate ‘MacOSXOSAScript’ in favour of ‘MacOS’.

   - gh-146406(80): Cross-language method suggestions are now shown for
     *note AttributeError: 1b4. on builtin types and their subclasses.
     For example, ‘[].push()’ suggests ‘append’, ‘(1,2).append(3)’
     suggests using a ‘list’, ‘None.keys()’ suggests expecting a ‘dict’,
     and ‘1.0.__or__’ suggests using an ‘int’.

   - gh-146313(81): Fix a deadlock in *note multiprocessing: 98.'s
     resource tracker where the parent process could hang indefinitely
     in *note os.waitpid(): 1157. during interpreter shutdown if a child
     created via *note os.fork(): 6c3. still held the resource tracker's
     pipe open.

   - gh-146292(82): Add colour to *note BaseHTTPRequestHandler: 231.
     logs, as used by the *note http.server: 75. CLI. Patch by Hugo van
     Kemenade.

   - gh-145917(83): Add MIME types for TTC and Haptics formats to *note
     mimetypes: 93.  (Contributed by Charlie Lin in gh-145918(84).)

   - gh-145846(85): Fix memory leak in ‘_lsprof’ when ‘clear()’ is
     called during active profiling with nested calls.  ‘clearEntries()’
     now walks the entire ‘currentProfilerContext’ linked list instead
     of only freeing the top context.

   - gh-145831(86): Fix ‘email.quoprimime.decode()’ leaving a stray ‘\r’
     when ‘eol='\r\n'’ by stripping the full 'eol' string instead of one
     character.

   - gh-145378(87): Use ‘PyREPL’ as the default input console for *note
     pdb: aa.

   - gh-145244(88): Fixed a use-after-free in *note json: 85. encoder
     when a ‘default’ callback mutates the dictionary being serialized.

   - gh-117716(89): Fix *note wave: 11c. writing of odd-sized ‘data’
     chunks by appending the required RIFF pad byte and correcting the
     RIFF chunk size field accordingly.

   - gh-145200(90): *note hashlib: 6b.: fix a memory leak when
     allocating or initializing an OpenSSL HMAC context fails.

   - gh-145056(91): Add support for *note frozendict: 18d. in *note
     dataclasses.asdict(): 192e. and *note dataclasses.astuple(): 192f.

   - gh-145105(92): Fix crash in *note csv: 2c. reader when iterating
     with a re-entrant iterator that calls *note next(): bb9. on the
     same reader from within ‘__next__’.

   - gh-130750(93): Restore quoting of choices in *note argparse: 7.
     error messages for improved clarity and consistency with
     documentation.

   - gh-137855(94): Reduce the import time of *note dataclasses: 32.
     module by ~20%.

   - gh-70647(95): *note strptime(): 2dd. now raises *note ValueError:
     15a. when the format string contains ‘%d’ without a year directive.
     Using ‘%e’ without a year now emits a *note DeprecationWarning:
     2d4.

   - gh-105936(96): Attempting to mutate non-field attributes of *note
     dataclasses: 32. with both 'frozen' and 'slots' being ‘True’ now
     raises *note FrozenInstanceError: 1930. instead of *note TypeError:
     29c.  Their non-dataclass subclasses can now freely mutate
     non-field attributes, and the original non-slotted class can be
     garbage collected.

   - gh-142831(97): Fix a crash in the *note json: 85. module where a
     use-after-free could occur if the object being encoded is modified
     during serialization.

   - gh-108411(98): ‘typing.IO’ and ‘typing.BinaryIO’ method arguments
     are now positional-only.

   - gh-130273(99): Fix traceback color output with Unicode characters.

   - gh-142307(100): *note imaplib: 77.: deprecate support for *note
     IMAP4.file: 304.  This attribute was never meant to be part of the
     public interface and altering its value may result in unclosed
     files or other synchronization issues with the underlying socket.
     Patch by Bénédikt Tran.

   - gh-141449(101): Improve tests and documentation for non-function
     callables as *note annotate functions: 411.

   - gh-140287(102): The *note asyncio: b. REPL now handles exceptions
     when executing *note PYTHONSTARTUP: 45a. scripts.  Patch by Bartosz
     Sławecki.

   - gh-139489(103): Add the *note xml.is_valid_name(): 2be. function,
     which allows to check whether a string can be used as an element or
     attribute name in XML.

   - gh-75707(104): Add optional ‘mtime’ argument to *note
     tarfile.open(): 122b, for setting the ‘mtime’ header field in
     ‘.tar.gz’ archives.

   - gh-125862(105): The *note contextlib.contextmanager(): 219. and
     *note contextlib.asynccontextmanager(): 21a. decorators now work
     correctly with generators, coroutine functions, and async
     generators when the wrapped callables are used as decorators.

   - gh-135528(106): *note http.cookiejar: 73.: add "tv", "or", "nom",
     "sch", and "web" to the default list of supported country code
     second-level domains.

   - gh-135056(107): Add a ‘-H’ or ‘--header’ CLI option to ‘python -m
     http.server’.  Contributed by Anton I. Sipos.

   - gh-134551(108): Add t-strings support to pprint functions

   - gh-133956(109): Fix bug where *note @dataclass: 6ec. wouldn't
     detect ‘ClassVar’ fields if ‘ClassVar’ was re-exported from a
     module other than *note typing: 10d.

   - gh-132631(110): Fix "I/O operation on closed file" when parsing
     JSON Lines file with *note JSON CLI: 86.

   - gh-108951(111): *note asyncio: b.: Add *note TaskGroup.cancel: 1ef.
     which cancels unfinished tasks and exits the group without raising
     *note asyncio.CancelledError: 6e0.

   - gh-123853(112): Update the table of Windows language code
     identifiers (LCIDs) used by *note locale.getdefaultlocale(): 23e.
     on Windows to protocol version 16.0 (2024-04-23).

   - gh-122476(113): The *note email: 3e. module no longer incorrectly
     uses RFC 2047(114) encoding for a mailbox with non-ASCII characters
     in its local-part.  Under a policy with *note utf8: 222. set
     ‘False’, attempting to serialize such a message will now raise an
     *note HeaderWriteError: 1931.  There is no valid 7-bit encoding for
     an internationalized local-part.  Use *note email.policy.SMTPUTF8:
     1932. (or another policy with ‘utf8=True’) to correctly pass
     through the local-part as Unicode characters.

   - gh-83938(115): The *note email: 3e. module no longer incorrectly
     uses RFC 2047(116) encoding for a mailbox with non-ASCII characters
     in its domain.  Under a policy with *note utf8: 222. set ‘False’,
     attempting to serialize such a message will now raise an *note
     HeaderWriteError: 1931.  Either apply an appropriate IDNA encoding
     to convert the domain to ASCII before serialization, or use *note
     email.policy.SMTPUTF8: 1932. (or another policy with ‘utf8=True’)
     to correctly pass through the internationalized domain name as
     Unicode characters.

   - gh-81074(117): The *note email: 3e. module no longer treats email
     addresses with non-ASCII characters as defects when parsing a
     Unicode string or in the ‘addr_spec’ parameter to *note
     email.headerregistry.Address: 1933.  RFC 5322(118) permits such
     addresses, and they were already supported when parsing bytes and
     in the Address ‘username’ parameter.

     The (undocumented) ‘email.errors.NonASCIILocalPartDefect’ is no
     longer used and should be considered deprecated.

   - gh-70039(119): Fixed bug where *note smtplib.SMTP.starttls(): 14f9.
     could fail if *note smtplib.SMTP.connect(): 1934. is called
     explicitly rather than implicitly.

   - gh-113471(120): Allow *note http.server: 75. to set a default
     content-type when serving files with an unknown or missing
     extension.

   - gh-83281(121): *note email: 3e.: improve handling trailing garbage
     in address lists to avoid throwing AttributeError in certain edge
     cases

   - gh-96894(122): Do not turn echo off for subsequent commands in
     batch activators (‘activate.bat’ and ‘deactivate.bat’) of *note
     venv: 11a.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/148823

   (2) https://github.com/python/cpython/issues/141560

   (3) https://github.com/python/cpython/issues/139489

   (4) https://github.com/python/cpython/issues/142389

   (5) https://github.com/python/cpython/issues/149377

   (6) https://github.com/python/cpython/issues/142389

   (7) https://github.com/python/cpython/issues/148675

   (8) https://github.com/python/cpython/issues/149342

   (9) https://github.com/python/cpython/issues/149010

   (10) https://github.com/python/cpython/issues/146609

   (11) https://github.com/python/cpython/issues/142389

   (12) https://github.com/python/cpython/issues/144384

   (13) https://github.com/python/cpython/issues/149321

   (14) https://github.com/python/cpython/issues/145378

   (15) https://github.com/python/cpython/issues/149296

   (16) https://github.com/python/cpython/issues/143231

   (17) https://github.com/python/cpython/issues/148675

   (18) https://github.com/python/cpython/issues/148675

   (19) https://github.com/python/cpython/issues/149221

   (20) https://github.com/python/cpython/issues/149231

   (21) https://github.com/python/cpython/issues/143231

   (22) https://github.com/python/cpython/issues/149214

   (23) https://github.com/python/cpython/issues/149189

   (24) https://github.com/python/cpython/issues/149173

   (25) https://github.com/python/cpython/issues/149117

   (26) https://github.com/python/cpython/issues/149148

   (27) https://www.cve.org/CVERecord?id=CVE-2026-3219

   (28) https://github.com/python/cpython/issues/149009

   (29) https://github.com/python/cpython/issues/148292

   (30) https://github.com/python/cpython/issues/149085

   (31) https://github.com/python/cpython/issues/148641

   (32) https://github.com/python/cpython/issues/148093

   (33) https://github.com/python/cpython/issues/149083

   (34) https://github.com/python/cpython/issues/148914

   (35) https://github.com/python/cpython/issues/149026

   (36) https://github.com/python/cpython/issues/148991

   (37) https://github.com/python/cpython/issues/138907

   (38) https://datatracker.ietf.org/doc/html/rfc9309.html

   (39) https://github.com/python/cpython/issues/148981

   (40) https://github.com/python/cpython/issues/148849

   (41) https://github.com/python/cpython/issues/146311

   (42) https://github.com/python/cpython/issues/148947

   (43) https://github.com/python/cpython/issues/148680

   (44) https://github.com/python/cpython/issues/124397

   (45) https://github.com/python/cpython/issues/148801

   (46) https://github.com/python/cpython/issues/148735

   (47) https://github.com/python/cpython/issues/148740

   (48) https://github.com/python/cpython/issues/148688

   (49) https://github.com/python/cpython/issues/148675

   (50) https://github.com/python/cpython/issues/148651

   (51) https://github.com/python/cpython/issues/148641

   (52) https://peps.python.org/pep-0829/

   (53) https://github.com/python/cpython/issues/148639

   (54) https://peps.python.org/pep-0800/

   (55) https://github.com/python/cpython/issues/148615

   (56) https://github.com/python/cpython/issues/146553

   (57) https://github.com/python/cpython/issues/148599

   (58) https://github.com/python/cpython/issues/148508

   (59) https://github.com/python/cpython/issues/144881

   (60) https://github.com/python/cpython/issues/148518

   (61) https://github.com/python/cpython/issues/148464

   (62) https://github.com/python/cpython/issues/148370

   (63) https://github.com/python/cpython/issues/121190

   (64) https://github.com/python/cpython/issues/127012

   (65) https://github.com/python/cpython/issues/137855

   (66) https://github.com/python/cpython/issues/148352

   (67) https://github.com/python/cpython/issues/148254

   (68) https://github.com/python/cpython/issues/130472

   (69) https://github.com/python/cpython/issues/148241

   (70) https://github.com/python/cpython/issues/148225

   (71) https://github.com/python/cpython/issues/148192

   (72) https://github.com/python/cpython/issues/148207

   (73) https://github.com/python/cpython/issues/148100

   (74) https://github.com/python/cpython/issues/147991

   (75) https://github.com/python/cpython/issues/147957

   (76) https://github.com/python/cpython/issues/146256

   (77) https://github.com/python/cpython/issues/146609

   (78) https://github.com/python/cpython/issues/146563

   (79) https://github.com/python/cpython/issues/137586

   (80) https://github.com/python/cpython/issues/146406

   (81) https://github.com/python/cpython/issues/146313

   (82) https://github.com/python/cpython/issues/146292

   (83) https://github.com/python/cpython/issues/145917

   (84) https://github.com/python/cpython/issues/145918

   (85) https://github.com/python/cpython/issues/145846

   (86) https://github.com/python/cpython/issues/145831

   (87) https://github.com/python/cpython/issues/145378

   (88) https://github.com/python/cpython/issues/145244

   (89) https://github.com/python/cpython/issues/117716

   (90) https://github.com/python/cpython/issues/145200

   (91) https://github.com/python/cpython/issues/145056

   (92) https://github.com/python/cpython/issues/145105

   (93) https://github.com/python/cpython/issues/130750

   (94) https://github.com/python/cpython/issues/137855

   (95) https://github.com/python/cpython/issues/70647

   (96) https://github.com/python/cpython/issues/105936

   (97) https://github.com/python/cpython/issues/142831

   (98) https://github.com/python/cpython/issues/108411

   (99) https://github.com/python/cpython/issues/130273

   (100) https://github.com/python/cpython/issues/142307

   (101) https://github.com/python/cpython/issues/141449

   (102) https://github.com/python/cpython/issues/140287

   (103) https://github.com/python/cpython/issues/139489

   (104) https://github.com/python/cpython/issues/75707

   (105) https://github.com/python/cpython/issues/125862

   (106) https://github.com/python/cpython/issues/135528

   (107) https://github.com/python/cpython/issues/135056

   (108) https://github.com/python/cpython/issues/134551

   (109) https://github.com/python/cpython/issues/133956

   (110) https://github.com/python/cpython/issues/132631

   (111) https://github.com/python/cpython/issues/108951

   (112) https://github.com/python/cpython/issues/123853

   (113) https://github.com/python/cpython/issues/122476

   (114) https://datatracker.ietf.org/doc/html/rfc2047.html

   (115) https://github.com/python/cpython/issues/83938

   (116) https://datatracker.ietf.org/doc/html/rfc2047.html

   (117) https://github.com/python/cpython/issues/81074

   (118) https://datatracker.ietf.org/doc/html/rfc5322.html

   (119) https://github.com/python/cpython/issues/70039

   (120) https://github.com/python/cpython/issues/113471

   (121) https://github.com/python/cpython/issues/83281

   (122) https://github.com/python/cpython/issues/96894


File: python.info,  Node: ドキュメント<2>,  Next: テスト<2>,  Prev: ライブラリ<2>,  Up: Python 3 15 0 beta 1

1.26.2.4 ドキュメント
.....................

   - gh-148663(1): Document that *note calendar.IllegalMonthError: 1936.
     is a subclass of both *note ValueError: 15a. and *note IndexError:
     18ed. since Python 3.12.

   - gh-146646(2): Document that *note glob.glob(): 2df, *note
     glob.iglob(): be5, *note pathlib.Path.glob(): 73f, and *note
     pathlib.Path.rglob(): 740. silently suppress *note OSError: 543.
     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: テスト<2>,  Next: ビルド<2>,  Prev: ドキュメント<2>,  Up: Python 3 15 0 beta 1

1.26.2.5 テスト
...............

   - gh-149425(1): Increase time delta in
     ‘test.test_zipfile.test_core.OtherTests.test_write_without_source_date_epoch’

   - gh-148600(2): Add OpenSSL 4.0.0 support to test configurations.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149425

   (2) https://github.com/python/cpython/issues/148600


File: python.info,  Node: ビルド<2>,  Next: Windows<2>,  Prev: テスト<2>,  Up: Python 3 15 0 beta 1

1.26.2.6 ビルド
...............

   - gh-149353(1): Avoid unnecessary JIT-related rebuilds during ‘make
     install’ after ‘--enable-optimizations’ builds.

   - gh-149351(2): Avoid possible broken macOS framework install names
     when DESTDIR is specified during builds.

   - gh-149252(3): Update to WASI SDK 33.

   - gh-148690(4): Windows free-threaded builds now output to a
     different default path with default filenames, for example,
     ‘PCbuild/amd64t/python.exe’ rather than
     ‘PCbuild/amd64/python3.15t.exe’.  The ‘PC/layout’ script has been
     updated to ensure compatibility of generated layouts.

   - gh-146475(5): Block Apple Clang from being used to build the JIT as
     it ships without required LLVM tools.

   - gh-148644(6): Errors during the PGO training job on Windows are no
     longer ignored, and a non-zero return code will cause the build to
     fail.

   - gh-148535(7): 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(8)) 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-148483(9): Use ‘Py_GCC_ATTRIBUTE(unused)’ for stop_tracing
     label.

   - gh-148474(10): Fixed compilation of ‘Python/pystrhex.c’ with older
     clang versions.

   - gh-146445(11): The Android build tools have been moved to the
     Platforms folder.

   - gh-146264(12): 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.

   - gh-138451(13): Allow for custom LLVM path using
     ‘LLVM_TOOLS_INSTALL_DIR’ during JIT build.

   - gh-133312(14): Add a new ‘./configure’ option *note
     -enable-static-libpython-for-interpreter: 1939. which, when used
     with *note -enable-shared: c3e, continues to build the shared
     library but does not use it for the interpreter.  Instead,
     libpython is statically linked into the interpreter, as if
     ‘--enable-shared’ had not been used.  This allows you to do a
     single build and get a Python interpreter binary that does not use
     a shared library but also get a shared library for use by other
     programs.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149353

   (2) https://github.com/python/cpython/issues/149351

   (3) https://github.com/python/cpython/issues/149252

   (4) https://github.com/python/cpython/issues/148690

   (5) https://github.com/python/cpython/issues/146475

   (6) https://github.com/python/cpython/issues/148644

   (7) https://github.com/python/cpython/issues/148535

   (8) https://github.com/python/cpython/issues/145801

   (9) https://github.com/python/cpython/issues/148483

   (10) https://github.com/python/cpython/issues/148474

   (11) https://github.com/python/cpython/issues/146445

   (12) https://github.com/python/cpython/issues/146264

   (13) https://github.com/python/cpython/issues/138451

   (14) https://github.com/python/cpython/issues/133312


File: python.info,  Node: Windows<2>,  Next: macOS,  Prev: ビルド<2>,  Up: Python 3 15 0 beta 1

1.26.2.7 Windows
................

   - gh-149254(1): Updated bundled version of OpenSSL to 3.5.6.

   - gh-148690(2): Non-freethreaded builds on Windows now support
     extensions linked to ‘python3t.dll’, and will include a copy of
     that library in normal installs that references the
     non-freethreaded runtime.

   - gh-146458(3): 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/148690

   (3) https://github.com/python/cpython/issues/146458


File: python.info,  Node: macOS,  Next: IDLE<3>,  Prev: Windows<2>,  Up: Python 3 15 0 beta 1

1.26.2.8 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-149254(2): Update macOS installer to use OpenSSL 3.5.6.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142295

   (2) https://github.com/python/cpython/issues/149254


File: python.info,  Node: IDLE<3>,  Next: C API<2>,  Prev: macOS,  Up: Python 3 15 0 beta 1

1.26.2.9 IDLE
.............

   - gh-94523(1): Detect file if modified at local disk and prompt to
     ask refresh.  Patch by Shixian Li.

   - gh-139551(2): Support rendering *note BaseExceptionGroup: 76d. in
     IDLE.

   - gh-89520(3): Make IDLE extension configuration look at user config
     files, allowing user-installed extensions to have settings and key
     bindings defined in ~/.idlerc.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94523

   (2) https://github.com/python/cpython/issues/139551

   (3) https://github.com/python/cpython/issues/89520


File: python.info,  Node: C API<2>,  Prev: IDLE<3>,  Up: Python 3 15 0 beta 1

1.26.2.10 C API
...............

   - gh-149225(1): *note PyCriticalSection: 370. and related functions
     are added to the Stable ABI.

   - gh-149216(2): *note PyType_WatchCallback: 193e. callbacks
     registered via *note PyType_AddWatcher(): 96f. are now also invoked
     when a watched heap type is deallocated.  Previously, type watchers
     were only notified of modifications, which could cause stale
     references when a type was freed and its address was reused.

   - gh-149101(3): Implement PEP 788(4).

   - gh-149044(5): Implement PEP 820(6): Unified slot system for the C
     API.

   - gh-148267(7): Using *note Py_LIMITED_API: 853. on a non-Windows
     free-threaded build no longer needs an extra *note Py_GIL_DISABLED:
     193f.

   - gh-145559(8): Rename ‘_Py_DumpTraceback’ and
     ‘_Py_DumpTracebackThreads’ to *note PyUnstable_DumpTraceback():
     3a1. and *note PyUnstable_DumpTracebackThreads(): 3a2.

   - gh-146636(9): Implement PEP 803(10) - ‘abi3t’: Stable ABI for
     Free-Threaded Builds.

   - gh-146302(11): *note Py_IsInitialized(): 1940. no longer returns
     true until initialization has fully completed, including import of
     the *note site: cf. module.  The underlying runtime flags now use
     atomic operations.

   - gh-146063(12): Add *note PyObject_CallFinalizerFromDealloc(): 359.
     function to the limited C API. Patch by Victor Stinner.

   - gh-145921(13): Add functions that are guaranteed to be safe for use
     in *note tp_traverse: 373. handlers: *note
     PyObject_GetTypeData_DuringGC(): 374, *note
     PyObject_GetItemData_DuringGC(): 375, *note
     PyType_GetModuleState_DuringGC(): 376, *note
     PyModule_GetState_DuringGC(): 377, *note
     PyModule_GetToken_DuringGC(): 378, *note
     PyType_GetBaseByToken_DuringGC(): 379, *note
     PyType_GetModule_DuringGC(): 37a, *note
     PyType_GetModuleByToken_DuringGC(): 37b.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149225

   (2) https://github.com/python/cpython/issues/149216

   (3) https://github.com/python/cpython/issues/149101

   (4) https://peps.python.org/pep-0788/

   (5) https://github.com/python/cpython/issues/149044

   (6) https://peps.python.org/pep-0820/

   (7) https://github.com/python/cpython/issues/148267

   (8) https://github.com/python/cpython/issues/145559

   (9) https://github.com/python/cpython/issues/146636

   (10) https://peps.python.org/pep-0803/

   (11) https://github.com/python/cpython/issues/146302

   (12) https://github.com/python/cpython/issues/146063

   (13) https://github.com/python/cpython/issues/145921


File: python.info,  Node: Python 3 15 0 alpha 8,  Next: Python 3 15 0 alpha 7,  Prev: Python 3 15 0 beta 1,  Up: 変更履歴

1.26.3 Python 3.15.0 alpha 8
----------------------------

'Release date: 2026-04-07'

* Menu:

* セキュリティ: セキュリティ<3>.
* Core and Builtins: Core and Builtins<3>.
* ライブラリ: ライブラリ<3>.
* ドキュメント: ドキュメント<3>.
* テスト: テスト<3>.
* ビルド: ビルド<3>.
* Windows: Windows<3>.
* macOS: macOS<2>.
* Tools/Demos::
* C API: C API<3>.


File: python.info,  Node: セキュリティ<3>,  Next: Core and Builtins<3>,  Up: Python 3 15 0 alpha 8

1.26.3.1 セキュリティ
.....................

   - gh-145986(1): *note xml.parsers.expat: 12f.: Fixed a crash caused
     by unbounded C recursion when converting deeply nested XML content
     models with *note ElementDeclHandler(): 1943.  This addresses CVE
     2026-4224(2).

   - gh-145599(3): Reject control characters in *note
     http.cookies.Morsel: fc7. *note update(): 127a. and *note
     js_output(): 301.  This addresses CVE 2026-3644(4).

   - gh-143930(5): Reject leading dashes in URLs passed to *note
     webbrowser.open(): 1944.

   ---------- 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/143930


File: python.info,  Node: Core and Builtins<3>,  Next: ライブラリ<3>,  Prev: セキュリティ<3>,  Up: Python 3 15 0 alpha 8

1.26.3.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-100239(3): Propagate result type and uniqueness information
     through ‘_BINARY_OP_EXTEND’ in the tier 2 optimizer, enabling
     elimination of downstream type guards and selection of inplace
     float operations.

   - gh-148144(4): Initialize ‘_PyInterpreterFrame.visited’ when copying
     interpreter frames so incremental GC does not read an uninitialized
     byte from generator and frame-object copies.

   - gh-148072(5): Cache ‘pickle.dumps’ and ‘pickle.loads’ per
     interpreter in the XIData framework, avoiding repeated module
     lookups on every cross-interpreter data transfer.  This speeds up
     *note InterpreterPoolExecutor: 471. for mutable types (‘list’,
     ‘dict’) by 1.7x-3.3x.

   - gh-148110(6): Fix *note sys.set_lazy_imports_filter(): 187. so
     relative lazy imports pass the resolved imported module name to the
     filter callback.  Patch by Pablo Galindo.

   - gh-148083(7): Constant-fold ‘_CONTAINS_OP_SET’ for *note frozenset:
     9d9.  Patch by Donghee Na.

   - gh-144319(8): Fix a bug that could cause applications with specific
     allocation patterns to leak memory via Huge Pages if compiled with
     Huge Page support.  Patch by Pablo Galindo

   - gh-147985(9): Make *note PySet_Contains(): 1800. attempt a
     lock-free lookup, similar to ‘set.__contains__()’.  This avoids
     acquiring the set object mutex in the normal case.

   - gh-147856(10): Allow the 'count' argument of *note bytes.replace():
     1de. to be a keyword.

   - gh-146615(11): Fix a crash in *note __get__(): 18a0. for *note
     METH_METHOD: d3d. descriptors when an invalid (non-type) object is
     passed as the second argument.  Patch by Steven Sun.

   - gh-146306(12): Optimize compact integer arithmetic in the JIT by
     mutating uniquely-referenced operands in place, avoiding allocation
     of a new int object.  Speeds up the pyperformance ‘spectral_norm’
     benchmark by ~10%.

   - gh-146587(13): Fix type slot assignment incase of multiple slots
     for same name in type object implementation.  Patch by Kumar
     Aditya.

   - gh-126910(14): Set frame pointers in ‘aarch64-unknown-linux-gnu’
     JIT code, allowing most native profilers and debuggers to unwind
     through them.  Patch by Diego Russo

   - gh-146388(15): Adds a null check to handle when the JIT optimizer
     runs out of space when dealing with contradictions in
     ‘make_bottom’.

   - gh-146369(16): Ensure ‘-X lazy_imports=none’ and
     ‘PYTHON_LAZY_IMPORTS=none’ override *note __lazy_modules__: 18a.
     Patch by Hugo van Kemenade.

   - gh-146308(17): Fixed multiple error handling issues in the
     ‘_remote_debugging’ module including a double-free in code object
     caching, memory leaks on allocation failure, missing exception
     checks in binary format varint decoding, reference leaks on error
     paths in frame chain processing, and inconsistent thread status
     error reporting across platforms.  Patch by Pablo Galindo.

   - gh-146306(18): Optimize float arithmetic in the JIT by mutating
     uniquely-referenced operands in place, avoiding allocation of a new
     float object.  Speeds up the pyperformance ‘nbody’ benchmark by
     ~19%.

   - gh-146128(19): 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(20): Fixed a memory leak in *note SyntaxError: 189. when
     re-initializing it.

   - gh-146245(21): Fixed reference leaks in *note socket: d4. when
     audit hooks raise exceptions in *note socket.getaddrinfo(): 1946.
     and ‘socket.sendto()’.

   - gh-146151(22): *note memoryview: 1dd. now supports the float
     complex and double complex C types: formatting characters ‘'F'’ and
     ‘'D'’ respectively.  Patch by Sergey B Kirpichev.

   - gh-146196(23): Fix potential Undefined Behavior in *note
     PyUnicodeWriter_WriteASCII(): 5ed. by adding a zero-length check.
     Patch by Shamil Abdulaev.

   - gh-146227(24): 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-146205(25): Fixed a bug where *note select.epoll.close(): 1343,
     *note select.kqueue.close(): 1947, and *note
     select.devpoll.close(): 1346. silently ignored errors.

   - gh-146199(26): Comparison of code objects now handles errors
     correctly.

   - gh-145667(27): Remove the ‘GET_ITER_YIELD_FROM’ instruction,
     modifying ‘SEND’ to pair with ‘GET_ITER’ when compiling ‘yield
     from’ expressions.

   - gh-146192(28): Add Base32 support to *note binascii: 11. and
     improve the performance of the Base32 converters in *note base64:
     f.  Patch by James Seo.

   - gh-135871(29): Improve multithreaded scaling of PyMutex in
     low-contention scenarios by reloading the lock's internal state,
     without slowing down high-contention scenarios.

   - gh-146096(30): Fixed segmentation fault when called repr for
     BaseExceptionGroup with empty or 1-size tuple args.

   - gh-146056(31): Fix *note repr(): 462. for lists and tuples
     containing ‘NULL’s.

   - gh-145059(32): Fixed ‘sys.lazy_modules’ to include lazy modules
     without submodules.  Patch by Bartosz Sławecki.

   - gh-146041(33): Fix free-threading scaling bottleneck in *note
     sys.intern(): 1695. and *note PyObject_SetAttr(): 1948. by avoiding
     the interpreter-wide lock when the string is already interned and
     immortalized.

   - gh-145990(34): ‘python --help-env’ sections are now sorted by
     environment variable name.

   - gh-145990(35): ‘python --help-xoptions’ is now sorted by ‘-X’
     option name.

   - gh-145876(36): *note AttributeError: 1b4.s and *note KeyError:
     7e5.s raised in ‘keys()’ or ‘__getitem__()’ during dictionary
     unpacking (‘{**mymapping}’ or ‘func(**mymapping)’) are no longer
     masked by *note TypeError: 29c.

   - gh-127958(37): Support tracing from function entrypoints in the
     JIT.  Patch by Ken Jin.

   - gh-145376(38): Fix GC tracking in ‘structseq.__replace__()’.

   - gh-145792(39): Fix out-of-bounds access when invoking faulthandler
     on a CPython build compiled without support for VLAs.

   - gh-142183(40): Avoid a pathological case where repeated calls at a
     specific stack depth could be significantly slower.

   - gh-145779(41): Improve scaling of *note classmethod(): 6a0. and
     *note staticmethod(): 66d. calls in the free-threaded build by
     avoiding the descriptor ‘__get__’ call.

   - gh-145783(42): Fix an unlikely crash in the parser when certain
     errors were erroneously not propagated.  Found by OSS Fuzz in
     #491369109(43).

   - gh-145685(44): Improve scaling of type attribute lookups in the
     *note free-threaded build: 1a3. by avoiding contention on the
     internal type lock.

   - gh-145713(45): Make *note bytearray.resize(): 1949. thread-safe in
     the free-threaded build by using a critical section and calling the
     lock-held variant of the resize function.

   - gh-145036(46): In free-threaded build, fix race condition when
     calling ‘__sizeof__()’ on a *note list: 4e0.

   - gh-134584(47): Eliminate redundant refcounting for ‘MATCH_CLASS’ in
     the JIT.

   - gh-69605(48): Add *note math.integer: 92. to *note REPL: 6a3.
     auto-completion of imports.

   - gh-131798(49): Optimize ‘_ITER_CHECK_RANGE’ and ‘_ITER_CHECK_LIST’
     in the JIT

   - gh-143414(50): Add tracking to the JIT optimizer to determine
     whether a reference is uniquely owned or shared

   - gh-143636(51): Fix a crash when calling *note
     SimpleNamespace.__replace__(): 6f0. on non-namespace instances.
     Patch by Bénédikt Tran.

   - gh-126910(52): Set frame pointers in ‘x86_64-unknown-linux-gnu’ JIT
     code, allowing most native profilers and debuggers to unwind
     through them.

   - gh-140594(53): Fix an out of bounds read when a single NUL
     character is read from the standard input.  Patch by Shamil
     Abdulaev.

   - gh-140870(54): Add support for module attributes in the *note REPL:
     6a3. auto-completion of imports.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/148157

   (2) https://issues.oss-fuzz.com/issues/492782951

   (3) https://github.com/python/cpython/issues/100239

   (4) https://github.com/python/cpython/issues/148144

   (5) https://github.com/python/cpython/issues/148072

   (6) https://github.com/python/cpython/issues/148110

   (7) https://github.com/python/cpython/issues/148083

   (8) https://github.com/python/cpython/issues/144319

   (9) https://github.com/python/cpython/issues/147985

   (10) https://github.com/python/cpython/issues/147856

   (11) https://github.com/python/cpython/issues/146615

   (12) https://github.com/python/cpython/issues/146306

   (13) https://github.com/python/cpython/issues/146587

   (14) https://github.com/python/cpython/issues/126910

   (15) https://github.com/python/cpython/issues/146388

   (16) https://github.com/python/cpython/issues/146369

   (17) https://github.com/python/cpython/issues/146308

   (18) https://github.com/python/cpython/issues/146306

   (19) https://github.com/python/cpython/issues/146128

   (20) https://github.com/python/cpython/issues/146250

   (21) https://github.com/python/cpython/issues/146245

   (22) https://github.com/python/cpython/issues/146151

   (23) https://github.com/python/cpython/issues/146196

   (24) https://github.com/python/cpython/issues/146227

   (25) https://github.com/python/cpython/issues/146205

   (26) https://github.com/python/cpython/issues/146199

   (27) https://github.com/python/cpython/issues/145667

   (28) https://github.com/python/cpython/issues/146192

   (29) https://github.com/python/cpython/issues/135871

   (30) https://github.com/python/cpython/issues/146096

   (31) https://github.com/python/cpython/issues/146056

   (32) https://github.com/python/cpython/issues/145059

   (33) https://github.com/python/cpython/issues/146041

   (34) https://github.com/python/cpython/issues/145990

   (35) https://github.com/python/cpython/issues/145990

   (36) https://github.com/python/cpython/issues/145876

   (37) https://github.com/python/cpython/issues/127958

   (38) https://github.com/python/cpython/issues/145376

   (39) https://github.com/python/cpython/issues/145792

   (40) https://github.com/python/cpython/issues/142183

   (41) https://github.com/python/cpython/issues/145779

   (42) https://github.com/python/cpython/issues/145783

   (43) https://issues.oss-fuzz.com/issues/491369109

   (44) https://github.com/python/cpython/issues/145685

   (45) https://github.com/python/cpython/issues/145713

   (46) https://github.com/python/cpython/issues/145036

   (47) https://github.com/python/cpython/issues/134584

   (48) https://github.com/python/cpython/issues/69605

   (49) https://github.com/python/cpython/issues/131798

   (50) https://github.com/python/cpython/issues/143414

   (51) https://github.com/python/cpython/issues/143636

   (52) https://github.com/python/cpython/issues/126910

   (53) https://github.com/python/cpython/issues/140594

   (54) https://github.com/python/cpython/issues/140870


File: python.info,  Node: ライブラリ<3>,  Next: ドキュメント<3>,  Prev: Core and Builtins<3>,  Up: Python 3 15 0 alpha 8

1.26.3.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: 1412. when the parent
     process had a very large *note sys.argv: 161e.  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-148153(2): *note base64.b32encode(): 1f2. now always raises
     *note ValueError: 15a. instead of *note AssertionError: a9c. for
     the value of 'map01' with invalid length.

   - gh-73613(3): Add the 'padded' parameter in functions related to
     Base32 and Base64 codecs in the *note binascii: 11. and *note
     base64: f. modules.  In the encoding functions it controls whether
     the pad character can be added in the output, in the decoding
     functions it controls whether padding is required in input.
     Padding of input no longer required in *note
     base64.urlsafe_b64decode(): 1f9. by default.

   - gh-146613(4): *note itertools: 84.: Fix a crash in *note
     itertools.groupby(): 194b. when the grouper iterator is
     concurrently mutated.

   - gh-147944(5): Accepted range for the 'bytes_per_sep' argument of
     *note bytes.hex(): 1122, *note bytearray.hex(): 1123, *note
     memoryview.hex(): 1124, and *note binascii.b2a_hex(): 194c. is now
     increased, so passing ‘sys.maxsize’ and ‘-sys.maxsize’ is now
     valid.

   - gh-146080(6): *note ssl: d8.: 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(7): Fix *note annotationlib.get_annotations(): 673.
     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(): 130b.

   - gh-146090(8): *note sqlite3: d7.: fix a crash when *note
     sqlite3.Connection.create_collation(): a6b. fails with
     SQLITE_BUSY(9).  Patch by Bénédikt Tran.

   - gh-146090(10): *note sqlite3: d7.: properly raise *note
     MemoryError: 191d. instead of *note SystemError: 3f1. when a
     context callback fails to be allocated.  Patch by Bénédikt Tran.

   - gh-146507(11): Make *note asyncio.SelectorEventLoop(): 316. stream
     transport's *note get_write_buffer_size(): 194d. O(1) by
     maintaining a running byte counter instead of iterating the buffer
     on every call.

   - gh-145056(12): Fix merging of *note collections.OrderedDict: 9da.
     and *note frozendict: 18d.

   - gh-145056(13): Add support for merging *note collections.UserDict:
     194e. and *note frozendict: 18d.

   - gh-145633(14): Fix ‘struct.pack('f', float)’: use *note
     PyFloat_Pack4(): b4d. to raise *note OverflowError: c5b.  Patch by
     Sergey B Kirpichev and Victor Stinner.

   - gh-146440(15): *note json: 85.: Add the 'array_hook' parameter to
     *note load(): 239. and *note loads(): 23a. functions: allow a
     callback for JSON literal array types to customize Python lists in
     the resulting decoded object.  Passing combined *note frozendict:
     18d. to 'object_pairs_hook' param and *note tuple: 1d9. to
     ‘array_hook’ will yield a deeply nested immutable Python structure
     representing the JSON data.

   - gh-146431(16): Add the 'wrapcol' parameter to *note base64: f.
     functions *note b16encode(): 1fa, *note b32encode(): 1f2, *note
     b32hexencode(): 1f4, *note b85encode(): 1fb. and *note z85encode():
     1f1, and *note binascii: 11. functions *note b2a_base32(): 201. and
     *note b2a_base85(): 205.  Add the 'ignorechars' parameter to
     ‘base64’ functions *note b16decode(): 1fc, *note b32decode(): 1f3,
     *note b32hexdecode(): 1f5, *note b85decode(): 1fd. and *note
     z85decode(): 1fe, and ‘binascii’ functions *note a2b_hex(): 209,
     *note unhexlify(): 20a, *note a2b_base32(): 202. and *note
     a2b_base85(): 206.

   - gh-146310(17): The *note ensurepip: 58. module no longer looks for
     ‘pip-*.whl’ wheel packages in the current directory.

   - gh-141510(18): Support *note frozendict: 18d. in *note plistlib:
     b0, for serialization only.  Patch by Hugo van Kemenade.

   - gh-146238(19): Support half-floats (type code ‘'e'’ of the *note
     struct: de. module) in the *note array: 8. module.  Patch by Sergey
     B Kirpichev.

   - gh-140947(20): Fix incorrect contextvars handling in server tasks
     created by *note asyncio: b.  Patch by Kumar Aditya.

   - gh-146151(21): Support the float complex and double complex C types
     in the *note array: 8. module: formatting characters ‘'F'’ and
     ‘'D'’ respectively.  Patch by Sergey B Kirpichev.

   - gh-143387(22): In importlib.metadata, when a distribution file is
     corrupt and there is no metadata file, calls to
     ‘Distribution.metadata()’ (including implicit calls from other
     properties like ‘.name’ and ‘.requires’) will now raise a
     ‘MetadataNotFound’ Exception.  This allows callers to distinguish
     between missing metadata and a degenerate (empty) metadata.
     Previously, if the file was missing, an empty ‘PackageMetadata’
     would be returned and would be indistinguishable from the presence
     of an empty file.

   - gh-146228(23): Cached FastPath objects in importlib.metadata are
     now cleared on fork, avoiding broken references to zip files during
     fork.

   - gh-146171(24): Nested *note AttributeError: 1b4. suggestions now
     include property-backed attributes on nested objects without
     executing the property getter.

   - gh-145410(25): On Windows, *note sysconfig.get_platform(): 15fd.
     now gets the platform from the ‘_sysconfig’ module instead of
     parsing *note sys.version: 6ae. string.  Patch by Victor Stinner.

   - gh-146091(26): Fix a bug in *note termios.tcsetwinsize(): 194f.
     where passing a sequence that raises an exception in ‘__getitem__’
     would cause a *note SystemError: 3f1. instead of propagating the
     original exception.

   - gh-146083(27): Update bundled libexpat(28) to version 2.7.5.

   - gh-146076(29): *note zoneinfo: 13d.: fix crashes when deleting
     ‘_weak_cache’ from a *note zoneinfo.ZoneInfo: cb5. subclass.

   - gh-123471(30): Make concurrent iteration over *note
     itertools.zip_longest: 1658. safe under free-threading.

   - gh-146075(31): Errors when calling *note functools.partial(): 4ad.
     with a malformed keyword will no longer crash the interpreter.

   - gh-146054(32): Limit the size of *note encodings.search_function():
     1950. cache.  Found by OSS Fuzz in #493449985(33).

   - gh-146004(34): All *note -X: 183. 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-145980(35): Added the 'alphabet' parameter in *note
     b2a_base64(): 207, *note a2b_base64(): 208, *note b2a_base85():
     205. and *note a2b_base85(): 206. and a number of ‘*_ALPHABET’
     constants in the *note binascii: 11. module.  Removed ‘b2a_z85()’
     and ‘a2b_z85()’.

   - gh-145968(36): Fix translation in *note base64.b64decode(): 1f7.
     when altchars overlaps with the standard ones.

   - gh-145966(37): Non-*note AttributeError: 1b4. exceptions raised
     during dialect attribute lookup in *note csv: 2c. are no longer
     silently suppressed.

   - gh-145883(38): *note zoneinfo: 13d.: Fix heap buffer overflow reads
     from malformed TZif data.  Found by OSS Fuzz, issues #492245058(39)
     and #492230068(40).

   - gh-145850(41): Changed some implementation details in *note
     struct.Struct: 307.: calling it with non-ASCII string format will
     now raise a *note ValueError: 15a. instead of *note
     UnicodeEncodeError: a6c, calling it with non-ASCII bytes format
     will now raise a ‘ValueError’ instead of *note struct.error: 16dd,
     getting the ‘format’ attribute of uninitialized object will now
     raise an *note AttributeError: 1b4. instead of *note RuntimeError:
     317.

   - gh-123720(42): asyncio: Fix *note asyncio.Server.serve_forever():
     edd. shutdown regression.  Since 3.12, cancelling ‘serve_forever()’
     could hang waiting for a handler blocked on a read from a client
     that never closed (effectively requiring two interrupts to stop);
     the shutdown sequence now ensures client streams are closed so
     ‘serve_forever()’ exits promptly and handlers observe EOF.

   - gh-138122(43): The ‘profiling.sampling’ module now supports
     differential flamegraph visualization via ‘--diff-flamegraph’ to
     compare two profiling runs.  Functions are colored red
     (regressions), blue (improvements), gray (neutral), or purple
     (new).  Elided stacks show code paths that disappeared between
     runs.

   - gh-145754(44): 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(45): Avoid undefined behaviour from signed integer
     overflow when parsing format strings in the *note struct: de.
     module.  Found by OSS Fuzz in #488466741(46).

   - gh-145719(47): Add ‘application/efi’ MIME type to *note mimetypes:
     93.

   - gh-145717(48): Add a few Microsoft-specific MIME types.

   - gh-145703(49): *note asyncio: b.: Make sure that *note
     loop.call_at: ecf. and *note loop.call_later: ece. trigger
     scheduled events on time when the clock resolution becomes too
     small.

   - gh-145697(50): Add ‘application/sql’ and ‘application/vnd.sqlite3’
     into ‘mimetypes’.

   - gh-145492(51): Fix infinite recursion in *note
     collections.defaultdict: 157a. ‘__repr__’ when a ‘defaultdict’
     contains itself.  Based on analysis by KowalskiThomas in
     gh-145492(52).

   - gh-145650(53): Add *note __repr__(): 1c7. support to *note
     logging.Formatter: 184f. and *note logging.Filter: 15ba, showing
     the format string and filter name respectively.

   - gh-145587(54): Resolved a performance regression in
     ‘multiprocessing.connection.wait’ on Windows that caused infinite
     busy loops when called with no objects.  The function now properly
     yields control to the OS to conserve CPU resources.  Patch By Shrey
     Naithani

   - gh-145616(55): Detect Android sysconfig ABI correctly on 32-bit ARM
     Android on 64-bit ARM kernel

   - gh-145546(56): Fix ‘unittest.util.sorted_list_difference()’ to
     deduplicate remaining elements when one input list is exhausted
     before the other.

   - gh-145446(57): Now *note functools: 62. is safer in free-threaded
     build when using keywords in *note functools.partial(): 4ad.

   - gh-145264(58): Base64 decoder (see *note binascii.a2b_base64():
     208, *note base64.b64decode(): 1f7, etc) no longer ignores excess
     data after the first padded quad in non-strict (default) mode.
     Instead, in conformance with RFC 4648(59), section 3.3, it now
     ignores the pad character, "=", if it is present before the end of
     the encoded data.

   - gh-145035(60): Allows omitting the internal library ‘_pyrepl’ with
     limited loss of functionality.  This allows complete removal of the
     modern REPL, which is an unsupported configuration, but still
     desirable for some distributions.

   - gh-144270(61): Made the 'tag' parameter of *note
     xml.etree.ElementTree.Element: 34b. and the 'parent' and 'tag'
     parameters of *note xml.etree.ElementTree.SubElement(): 1951.
     positional-only, matching the behavior of the C accelerator.

   - gh-144984(62): Fix crash in *note
     xml.parsers.expat.xmlparser.ExternalEntityParserCreate(): 1952.
     when an allocation fails.  The error paths could dereference NULL
     ‘handlers’ and double-decrement the parent parser's reference
     count.

   - gh-144975(63): *note wave.Wave_write.setframerate(): 1953. now
     validates the frame rate after rounding to an integer, preventing
     values like ‘0.5’ from being accepted and causing confusing errors
     later.  Patch by Michiel Beijen.

   - gh-140715(64): Add ‘%n’ and ‘%t’ support to *note strptime(): 2dd.

   - gh-144259(65): Fix inconsistent display of long multiline pasted
     content in the REPL.

   - gh-140814(66): *note multiprocessing.freeze_support(): 1954. no
     longer sets the default start method as a side effect, which
     previously caused a subsequent *note
     multiprocessing.set_start_method(): 4de. call to raise *note
     RuntimeError: 317.

   - gh-123471(67): Make concurrent iteration over *note
     itertools.accumulate: dc3. safe under free-threading.

   - gh-143715(68): Calling the ‘Struct.__new__()’ without required
     argument now is deprecated.  Calling *note __init__(): 306. method
     on initialized *note Struct: 307. objects is deprecated.

   - gh-142763(69): Fix a race condition between *note
     zoneinfo.ZoneInfo: cb5. creation and *note
     zoneinfo.ZoneInfo.clear_cache(): 1955. that could raise *note
     KeyError: 7e5.

   - gh-141707(70): Don't change *note tarfile.TarInfo: 15ce. type from
     ‘AREGTYPE’ to ‘DIRTYPE’ when parsing GNU long name or link headers.

   - gh-138577(71): *note getpass.getpass(): 4b2. with non-empty
     ‘echo_char’ now handles keyboard shortcuts including Ctrl+A/E
     (cursor movement), Ctrl+K/U (kill line), Ctrl+W (erase word), and
     Ctrl+V (literal next) by reading the terminal's control character
     settings and processing them appropriately in non-canonical mode.
     Patch by Sanyam Khurana.

   - gh-140049(72): *note traceback.format_exception_only(): c2a. now
     colorizes exception notes.

   - gh-139933(73): Improve *note AttributeError: 1b4. suggestions for
     classes with a custom *note __dir__(): 1956. method returning a
     list of unsortable values.  Patch by Bénédikt Tran.

   - gh-139633(74): The *note netrc: 9f. security check is now run once
     per parse rather than once per entry.

   - gh-130472(75): Add fancycompleter and enable it by default when
     using pyrepl.  This gives colored tab completion.

   - gh-112632(76): Add an 'expand' keyword argument for *note
     pprint.pprint(): c05, *note pprint.pformat(): 132f, *note
     pprint.pp(): deb. by passing on all 'kwargs' and *note
     pprint.PrettyPrinter: 132e.  Contributed by Stefan Todoran and
     Semyon Moroz.

   - gh-66419(77): Optional argument with *note nargs: 1957. equals to
     ‘argparse.REMAINDER’ now consumes all remaining arguments including
     ‘'--'’.

   - gh-60729(78): Add support for floating point audio wave files in
     *note wave: 11c.

   - bpo-36461(79): Make the target time of *note
     timeit.Timer.autorange(): 28e. configurable and add ‘--target-time’
     option to the command-line interface of *note timeit: f8.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144503

   (2) https://github.com/python/cpython/issues/148153

   (3) https://github.com/python/cpython/issues/73613

   (4) https://github.com/python/cpython/issues/146613

   (5) https://github.com/python/cpython/issues/147944

   (6) https://github.com/python/cpython/issues/146080

   (7) https://github.com/python/cpython/issues/146556

   (8) https://github.com/python/cpython/issues/146090

   (9) https://sqlite.org/rescode.html#busy

   (10) https://github.com/python/cpython/issues/146090

   (11) https://github.com/python/cpython/issues/146507

   (12) https://github.com/python/cpython/issues/145056

   (13) https://github.com/python/cpython/issues/145056

   (14) https://github.com/python/cpython/issues/145633

   (15) https://github.com/python/cpython/issues/146440

   (16) https://github.com/python/cpython/issues/146431

   (17) https://github.com/python/cpython/issues/146310

   (18) https://github.com/python/cpython/issues/141510

   (19) https://github.com/python/cpython/issues/146238

   (20) https://github.com/python/cpython/issues/140947

   (21) https://github.com/python/cpython/issues/146151

   (22) https://github.com/python/cpython/issues/143387

   (23) https://github.com/python/cpython/issues/146228

   (24) https://github.com/python/cpython/issues/146171

   (25) https://github.com/python/cpython/issues/145410

   (26) https://github.com/python/cpython/issues/146091

   (27) https://github.com/python/cpython/issues/146083

   (28) https://libexpat.github.io/

   (29) https://github.com/python/cpython/issues/146076

   (30) https://github.com/python/cpython/issues/123471

   (31) https://github.com/python/cpython/issues/146075

   (32) https://github.com/python/cpython/issues/146054

   (33) https://issues.oss-fuzz.com/issues/493449985

   (34) https://github.com/python/cpython/issues/146004

   (35) https://github.com/python/cpython/issues/145980

   (36) https://github.com/python/cpython/issues/145968

   (37) https://github.com/python/cpython/issues/145966

   (38) https://github.com/python/cpython/issues/145883

   (39) https://issues.oss-fuzz.com/issues/492245058

   (40) https://issues.oss-fuzz.com/issues/492230068

   (41) https://github.com/python/cpython/issues/145850

   (42) https://github.com/python/cpython/issues/123720

   (43) https://github.com/python/cpython/issues/138122

   (44) https://github.com/python/cpython/issues/145754

   (45) https://github.com/python/cpython/issues/145750

   (46) https://issues.oss-fuzz.com/issues/488466741

   (47) https://github.com/python/cpython/issues/145719

   (48) https://github.com/python/cpython/issues/145717

   (49) https://github.com/python/cpython/issues/145703

   (50) https://github.com/python/cpython/issues/145697

   (51) https://github.com/python/cpython/issues/145492

   (52) https://github.com/python/cpython/issues/145492

   (53) https://github.com/python/cpython/issues/145650

   (54) https://github.com/python/cpython/issues/145587

   (55) https://github.com/python/cpython/issues/145616

   (56) https://github.com/python/cpython/issues/145546

   (57) https://github.com/python/cpython/issues/145446

   (58) https://github.com/python/cpython/issues/145264

   (59) https://datatracker.ietf.org/doc/html/rfc4648.html

   (60) https://github.com/python/cpython/issues/145035

   (61) https://github.com/python/cpython/issues/144270

   (62) https://github.com/python/cpython/issues/144984

   (63) https://github.com/python/cpython/issues/144975

   (64) https://github.com/python/cpython/issues/140715

   (65) https://github.com/python/cpython/issues/144259

   (66) https://github.com/python/cpython/issues/140814

   (67) https://github.com/python/cpython/issues/123471

   (68) https://github.com/python/cpython/issues/143715

   (69) https://github.com/python/cpython/issues/142763

   (70) https://github.com/python/cpython/issues/141707

   (71) https://github.com/python/cpython/issues/138577

   (72) https://github.com/python/cpython/issues/140049

   (73) https://github.com/python/cpython/issues/139933

   (74) https://github.com/python/cpython/issues/139633

   (75) https://github.com/python/cpython/issues/130472

   (76) https://github.com/python/cpython/issues/112632

   (77) https://github.com/python/cpython/issues/66419

   (78) https://github.com/python/cpython/issues/60729

   (79) https://bugs.python.org/issue?@action=redirect&bpo=36461


File: python.info,  Node: ドキュメント<3>,  Next: テスト<3>,  Prev: ライブラリ<3>,  Up: Python 3 15 0 alpha 8

1.26.3.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.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126676

   (2) https://github.com/python/cpython/issues/145649

   (3) https://manpages.debian.org/python(1)


File: python.info,  Node: テスト<3>,  Next: ビルド<3>,  Prev: ドキュメント<3>,  Up: Python 3 15 0 alpha 8

1.26.3.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.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144418

   (2) https://github.com/python/cpython/issues/146202


File: python.info,  Node: ビルド<3>,  Next: Windows<3>,  Prev: テスト<3>,  Up: Python 3 15 0 alpha 8

1.26.3.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-146444(5): The Apple/iOS build script has been moved to the
     Platforms directory.

   - gh-146210(6): Fix building the jit stencils on Windows when the
     interpreter is built with a different clang version.  Patch by
     Chris Eibl.

   - gh-145844(7): Update to WASI SDK 32.

   - gh-145801(8): 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.

   - gh-138850(9): Add *note -disable-epoll: 195b. to ‘configure’

   - gh-145633(10): Remove support for ancient ARM platforms (ARMv4L and
     ARMv5L OABI boards), using mixed-endian representation for doubles.
     Patch by Sergey B Kirpichev.

   - gh-85277(11): Fix building without ‘stropts.h’ or empty ‘stropts.h’

   ---------- 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/146444

   (6) https://github.com/python/cpython/issues/146210

   (7) https://github.com/python/cpython/issues/145844

   (8) https://github.com/python/cpython/issues/145801

   (9) https://github.com/python/cpython/issues/138850

   (10) https://github.com/python/cpython/issues/145633

   (11) https://github.com/python/cpython/issues/85277


File: python.info,  Node: Windows<3>,  Next: macOS<2>,  Prev: ビルド<3>,  Up: Python 3 15 0 alpha 8

1.26.3.7 Windows
................

   - gh-140131(1): Fix REPL cursor position on Windows when module
     completion suggestion line hits console width.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140131


File: python.info,  Node: macOS<2>,  Next: Tools/Demos,  Prev: Windows<3>,  Up: Python 3 15 0 alpha 8

1.26.3.8 macOS
..............

   - gh-137586(1): Invoke ‘osascript’ with absolute path in *note
     webbrowser: 11e. and ‘turtledemo’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137586


File: python.info,  Node: Tools/Demos,  Next: C API<3>,  Prev: macOS<2>,  Up: Python 3 15 0 alpha 8

1.26.3.9 Tools/Demos
....................

   - gh-135953(1): Properly identify the main thread in the Gecko
     profiler collector by using a status flag from the interpreter
     state instead of relying on *note threading.main_thread(): 1380. in
     the collector process.

   - gh-145976(2): Remove ‘Misc/indent.pro’, a configuration file for
     GNU ‘indent(1)(3)’.

   - gh-145976(4): Remove ‘Misc/vgrindefs’ and ‘Misc/Porting’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135953

   (2) https://github.com/python/cpython/issues/145976

   (3) https://manpages.debian.org/indent(1)

   (4) https://github.com/python/cpython/issues/145976


File: python.info,  Node: C API<3>,  Prev: Tools/Demos,  Up: Python 3 15 0 alpha 8

1.26.3.10 C API
...............

   - gh-146636(1): The *note Py_mod_abi: 360. slot is now mandatory for
     modules created from a slots array (using *note
     PyModule_FromSlotsAndSpec(): 394. or the *note PyModExport_*: 1a7.
     export hook).

   - gh-146175(2): The following macros are *note soft deprecated: 1b2.:
     *note Py_ALIGNED: 3cd, *note PY_FORMAT_SIZE_T: 3ce, *note Py_LL:
     3cf, *note Py_ULL: 3d0, *note PY_LONG_LONG: 3d1, *note
     PY_LLONG_MIN: 3d2, *note PY_LLONG_MAX: 3d3, *note PY_ULLONG_MAX:
     3d4, *note PY_INT32_T: 3d5, *note PY_UINT32_T: 3d6, *note
     PY_INT64_T: 3d7, *note PY_UINT64_T: 3d8, *note PY_SIZE_MAX: 3d9,
     *note Py_UNICODE_SIZE: 3da, *note Py_VA_COPY: 3db.

     The macro *note Py_UNICODE_WIDE: 3dc, which was scheduled for
     removal, is *note soft deprecated: 1b2. instead.

   - gh-146143(3): *note PyUnicodeWriter_WriteUCS4(): 5f2. now accepts a
     pointer to a constant buffer of ‘Py_UCS4’.

   - gh-146056(4): *note PyUnicodeWriter_WriteRepr(): 5ef. now supports
     ‘NULL’ argument.

   - gh-145010(5): Use GCC dialect alternatives for inline assembly in
     ‘object.h’ so that the Python headers compile correctly with
     ‘-masm=intel’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/146636

   (2) https://github.com/python/cpython/issues/146175

   (3) https://github.com/python/cpython/issues/146143

   (4) https://github.com/python/cpython/issues/146056

   (5) https://github.com/python/cpython/issues/145010


File: python.info,  Node: Python 3 15 0 alpha 7,  Next: Python 3 15 0 alpha 6,  Prev: Python 3 15 0 alpha 8,  Up: 変更履歴

1.26.4 Python 3.15.0 alpha 7
----------------------------

'Release date: 2026-03-10'

* Menu:

* Windows: Windows<4>.
* テスト: テスト<4>.
* セキュリティ: セキュリティ<4>.
* ライブラリ: ライブラリ<4>.
* ドキュメント: ドキュメント<4>.
* Core and Builtins: Core and Builtins<4>.
* C API: C API<4>.
* ビルド: ビルド<4>.


File: python.info,  Node: Windows<4>,  Next: テスト<4>,  Up: Python 3 15 0 alpha 7

1.26.4.1 Windows
................

   - gh-145731(1): Fix negative timestamp during DST on Windows.  Patch
     by Hugo van Kemenade.

   - gh-145307(2): Defers loading of the ‘psapi.dll’ module until it is
     used by *note ctypes.util.dllist(): 48a.

   - gh-144551(3): Updated bundled version of OpenSSL to 3.5.5.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/145731

   (2) https://github.com/python/cpython/issues/145307

   (3) https://github.com/python/cpython/issues/144551


File: python.info,  Node: テスト<4>,  Next: セキュリティ<4>,  Prev: Windows<4>,  Up: Python 3 15 0 alpha 7

1.26.4.2 テスト
...............

   - gh-144741(1): Fix ‘test_frame_pointer_unwind’ when Python is built
     with *note -enable-shared: c3e.  Classify also libpython frames as
     ‘"python"’.  Patch by Victor Stinner.

   - gh-144739(2): 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/144741

   (2) https://github.com/python/cpython/issues/144739


File: python.info,  Node: セキュリティ<4>,  Next: ライブラリ<4>,  Prev: テスト<4>,  Up: Python 3 15 0 alpha 7

1.26.4.3 セキュリティ
.....................

   - gh-145506(1): Fixes CVE 2026-2297(2) by ensuring that
     ‘SourcelessFileLoader’ uses *note io.open_code(): 1964. when
     opening ‘.pyc’ files.

   - gh-144370(3): Disallow usage of control characters in status in
     *note wsgiref.handlers: 122. to prevent HTTP header injections.
     Patch by Benedikt Johannes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/145506

   (2) https://www.cve.org/CVERecord?id=CVE-2026-2297

   (3) https://github.com/python/cpython/issues/144370


File: python.info,  Node: ライブラリ<4>,  Next: ドキュメント<4>,  Prev: セキュリティ<4>,  Up: Python 3 15 0 alpha 7

1.26.4.4 ライブラリ
...................

   - gh-145623(1): Fix crash in *note struct: de. when calling *note
     repr(): 462. or ‘__sizeof__()’ on an uninitialized *note
     struct.Struct: 307. object created via ‘Struct.__new__()’ without
     calling ‘__init__()’.

   - gh-145551(2): Fix InvalidStateError when cancelling process created
     by *note asyncio.create_subprocess_exec(): e3e. or *note
     asyncio.create_subprocess_shell(): e3f.  Patch by Daan De Meyer.

   - gh-141510(3): *note marshal: 90. now supports *note frozendict:
     18d. objects.  The marshal format version was increased to 6.
     Patch by Victor Stinner.

   - gh-145417(4): *note venv: 11a.: 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-145335(5): ‘os.listdir(-1)’ and ‘os.scandir(-1)’ now fail with
     ‘OSError(errno.EBADF)’ rather than listing the current directory.
     ‘os.listxattr(-1)’ now fails with ‘OSError(errno.EBADF)’ rather
     than listing extended attributes of the current directory.  Patch
     by Victor Stinner.

   - gh-145376(6): Fix double free and null pointer dereference in
     unusual error scenarios in *note hashlib: 6b. and *note hmac: 6d.
     modules.

   - gh-145301(7): *note hmac: 6d.: fix a crash when the initialization
     of the underlying C extension module fails.

   - gh-145301(8): *note hashlib: 6b.: fix a crash when the
     initialization of the underlying C extension module fails.

   - gh-76007(9): The ‘version’ attribute of the *note tarfile: e7.
     module is deprecated and slated for removal in Python 3.20.

   - gh-145158(10): Avoid undefined behaviour from signed integer
     overflow when parsing format strings in the *note struct: de.
     module.

   - gh-123853(11): Removed Windows 95 compatibility for *note
     locale.getdefaultlocale(): 23e.

   - gh-66802(12): Add *note unicodedata.block(): 2a8. function to
     return the Unicode block(13) of a character.

   - gh-145033(14): Add *note typing.TypeForm: 29a, implementing PEP
     747(15).  Patch by Jelle Zijlstra.

   - gh-141510(16): *note dataclasses.field(): 1966.: if 'metadata' is
     ‘None’, use an empty *note frozendict: 18d, instead of a *note
     MappingProxyType(): 194. of an empty *note dict: 193.  Patch by
     Victor Stinner.

   - gh-145006(17): Add *note ModuleNotFoundError: 1c9. hints when a
     module for a different ABI exists.

   - gh-141510(18): ‘ParameterizedMIMEHeader.params’ of *note
     email.headerregistry: 45. is now a *note frozendict: 18d. instead
     of a *note types.MappingProxyType: 194.  Patch by Victor Stinner.

   - gh-134872(19): Add valid import name suggestions on *note
     ModuleNotFoundError: 1c9.

   - gh-88091(20): Fix *note unicodedata.decomposition(): 1967. for
     Hangul characters.

   - gh-144986(21): Fix a memory leak in *note atexit.register(): c58.
     Patch by Shamil Abdulaev.

   - gh-144777(22): Fix data races in *note
     io.IncrementalNewlineDecoder: 1968. in the *note free-threaded
     build: 1a3.

   - gh-144809(23): Make *note collections.deque: 9db. copy atomic in
     the *note free-threaded build: 1a3.

   - gh-141510(24): The *note copy: 29. module now supports the *note
     frozendict: 18d. type.  Patch by Pieter Eendebak based on work by
     Victor Stinner.

   - gh-141510(25): The *note json: 85. module now supports the *note
     frozendict: 18d. type.  Patch by Victor Stinner.

   - gh-144835(26): Added missing explanations for some parameters in
     *note glob.glob(): 2df. and *note glob.iglob(): be5.

   - gh-144833(27): Fixed a use-after-free in *note ssl: d8. when
     ‘SSL_new()’ returns NULL in ‘newPySSLSocket()’.  The error was
     reported via a dangling pointer after the object had already been
     freed.

   - gh-140715(28): Add ‘'%D'’ support to *note strptime(): 2dd.

   - gh-144782(29): Fix *note argparse.ArgumentParser: 1e7. to be *note
     pickleable: ab.

   - gh-144763(30): Fix a race condition in *note tracemalloc: 108.: it
     no longer detaches the attached thread state to acquire its
     internal lock.  Patch by Victor Stinner.

   - gh-142224(31): *note unicodedata.bidirectional(): 1969. now return
     the correct default bidi class for unassigned code points.

   - gh-117865(32): Reduce the import time of *note inspect: 81. module
     by ~20%.

   - gh-144156(33): Fix the folding of headers by the *note email: 3e.
     library when RFC 2047(34) 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(35), which mostly fixed previous failures to preserve
     whitespace.

   - gh-66305(36): Fixed a hang on Windows in the *note tempfile: e9.
     module when trying to create a temporary file or subdirectory in a
     non-writable directory.

   - gh-144615(37): Methods directly decorated with *note
     @functools.singledispatchmethod: 229. now dispatch on the second
     argument when called after being accessed as class attributes.
     Patch by Bartosz Sławecki.

   - gh-144321(38): The functional syntax for creating *note
     typing.NamedTuple: 2f0. classes now supports passing any *note
     iterable: 149a. of fields and types.  Previously, only sequences
     were supported.

   - gh-144475(39): Calling *note repr(): 462. on *note
     functools.partial(): 4ad. is now safer when the partial object's
     internal attributes are replaced while the string representation is
     being generated.

   - gh-144285(40): Attribute suggestions in *note AttributeError: 1b4.
     tracebacks are now formatted differently to make them easier to
     understand, for example: ‘Did you mean '.datetime.now' instead of
     '.now'’.  Contributed by Bartosz Sławecki.

   - gh-144316(41): Fix crash in ‘_remote_debugging’ that caused
     ‘test_external_inspection’ to intermittently fail.  Patch by
     Taegyun Kim.

   - gh-143637(42): Fixed a crash in socket.sendmsg() that could occur
     if ancillary data is mutated re-entrantly during argument parsing.

   - gh-140652(43): Fix a crash in ‘_interpchannels.list_all()’ after
     closing a channel.

   - gh-143698(44): Allow 'scheduler' and 'setpgroup' arguments to be
     explicitly *note None: a6a. when calling *note os.posix_spawn():
     736. or *note os.posix_spawnp(): 196a.  Patch by Bénédikt Tran.

   - gh-143698(45): Raise *note TypeError: 29c. instead of *note
     SystemError: 3f1. when the 'scheduler' in *note os.posix_spawn():
     736. or *note os.posix_spawnp(): 196a. is not a tuple.  Patch by
     Bénédikt Tran.

   - gh-142516(46): *note ssl: d8.: fix reference leaks in *note
     ssl.SSLContext: 33e. objects.  Patch by Bénédikt Tran.

   - gh-85809(47): Added *note path-like object: 7a5. support for *note
     shutil.make_archive(): 8c8.

   - gh-143304(48): Fix *note ctypes.CDLL: db1. to honor the ‘handle’
     parameter on POSIX systems.

   - gh-142781(49): *note zoneinfo: 13d.: fix a crash when instantiating
     *note ZoneInfo: cb5. objects for which the internal class-level
     cache is inconsistent.

   - gh-142787(50): Fix assertion failure in *note sqlite3: d7. blob
     subscript when slicing with indices that result in an empty slice.

   - gh-142352(51): Fix *note asyncio.StreamWriter.start_tls(): 9ff. to
     transfer buffered data from *note StreamReader: 196b. to the SSL
     layer, preventing data loss when upgrading a connection to TLS
     mid-stream (e.g., when implementing PROXY protocol support).

   - gh-139899(52): Introduced *note
     importlib.abc.MetaPathFinder.discover(): 196c. and *note
     importlib.abc.PathEntryFinder.discover(): 196d. to allow module and
     submodule name discovery without assuming the use of traditional
     filesystem based imports.

   - gh-137335(53): 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-135883(54): Fix *note sqlite3: d7.'s *note interactive shell:
     263. keeping part of previous commands when scrolling history.

   - gh-124748(55): Improve *note TypeError: 29c. error message when
     ‘weakref.WeakKeyDictionary.update()’ is used with keyword-only
     parameters.

   - gh-80667(56): Add support for Tangut Ideographs names in *note
     unicodedata: 10e.

   - bpo-42353(57): The *note re: c1. module gains a new *note
     re.prefixmatch(): 256. function as an explicit spelling of what has
     to date always been known as *note re.match(): 258.  *note
     re.Pattern: 196e. similary gains a *note re.Pattern.prefixmatch():
     257. method.

     Why?  Explicit is better than implicit.  Other widely used
     languages all use the term "match" to mean what Python uses the
     term "search" for.  The unadorened "match" name in Python has been
     a frequent case of confusion and coding bugs due to the
     inconsistency with the rest if the software industry.

     We do not plan to deprecate and remove the older ‘match’ name.

   - bpo-40243(58): Fix ‘unicodedata.ucd_3_2_0.numeric()’ for
     non-decimal values.

   - bpo-40212(59): Re-enable *note os.posix_fallocate(): 1151. and
     *note os.posix_fadvise(): 1150. on AIX.

   - bpo-3405(60): Add support for user data of Tk virtual events and
     detail for ‘Enter’, ‘Leave’, ‘FocusIn’, ‘FocusOut’, and
     ‘ConfigureRequest’ events to *note tkinter: f9.

   - bpo-32234(61): *note mailbox.Mailbox: 1605. instances can now be
     used as a context manager.  The Mailbox is locked on context entry
     and unlocked and closed at context exit.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/145623

   (2) https://github.com/python/cpython/issues/145551

   (3) https://github.com/python/cpython/issues/141510

   (4) https://github.com/python/cpython/issues/145417

   (5) https://github.com/python/cpython/issues/145335

   (6) https://github.com/python/cpython/issues/145376

   (7) https://github.com/python/cpython/issues/145301

   (8) https://github.com/python/cpython/issues/145301

   (9) https://github.com/python/cpython/issues/76007

   (10) https://github.com/python/cpython/issues/145158

   (11) https://github.com/python/cpython/issues/123853

   (12) https://github.com/python/cpython/issues/66802

   (13) 
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G64189

   (14) https://github.com/python/cpython/issues/145033

   (15) https://peps.python.org/pep-0747/

   (16) https://github.com/python/cpython/issues/141510

   (17) https://github.com/python/cpython/issues/145006

   (18) https://github.com/python/cpython/issues/141510

   (19) https://github.com/python/cpython/issues/134872

   (20) https://github.com/python/cpython/issues/88091

   (21) https://github.com/python/cpython/issues/144986

   (22) https://github.com/python/cpython/issues/144777

   (23) https://github.com/python/cpython/issues/144809

   (24) https://github.com/python/cpython/issues/141510

   (25) https://github.com/python/cpython/issues/141510

   (26) https://github.com/python/cpython/issues/144835

   (27) https://github.com/python/cpython/issues/144833

   (28) https://github.com/python/cpython/issues/140715

   (29) https://github.com/python/cpython/issues/144782

   (30) https://github.com/python/cpython/issues/144763

   (31) https://github.com/python/cpython/issues/142224

   (32) https://github.com/python/cpython/issues/117865

   (33) https://github.com/python/cpython/issues/144156

   (34) https://datatracker.ietf.org/doc/html/rfc2047.html

   (35) https://github.com/python/cpython/issues/92081

   (36) https://github.com/python/cpython/issues/66305

   (37) https://github.com/python/cpython/issues/144615

   (38) https://github.com/python/cpython/issues/144321

   (39) https://github.com/python/cpython/issues/144475

   (40) https://github.com/python/cpython/issues/144285

   (41) https://github.com/python/cpython/issues/144316

   (42) https://github.com/python/cpython/issues/143637

   (43) https://github.com/python/cpython/issues/140652

   (44) https://github.com/python/cpython/issues/143698

   (45) https://github.com/python/cpython/issues/143698

   (46) https://github.com/python/cpython/issues/142516

   (47) https://github.com/python/cpython/issues/85809

   (48) https://github.com/python/cpython/issues/143304

   (49) https://github.com/python/cpython/issues/142781

   (50) https://github.com/python/cpython/issues/142787

   (51) https://github.com/python/cpython/issues/142352

   (52) https://github.com/python/cpython/issues/139899

   (53) https://github.com/python/cpython/issues/137335

   (54) https://github.com/python/cpython/issues/135883

   (55) https://github.com/python/cpython/issues/124748

   (56) https://github.com/python/cpython/issues/80667

   (57) https://bugs.python.org/issue?@action=redirect&bpo=42353

   (58) https://bugs.python.org/issue?@action=redirect&bpo=40243

   (59) https://bugs.python.org/issue?@action=redirect&bpo=40212

   (60) https://bugs.python.org/issue?@action=redirect&bpo=3405

   (61) https://bugs.python.org/issue?@action=redirect&bpo=32234


File: python.info,  Node: ドキュメント<4>,  Next: Core and Builtins<4>,  Prev: ライブラリ<4>,  Up: Python 3 15 0 alpha 7

1.26.4.5 ドキュメント
.....................

   - gh-145450(1): Document missing public *note wave.Wave_write: 2f3.
     getter methods.

   - gh-110937(2): Document rest of full public *note
     importlib.metadata.Distribution: 1970. API. Also add the (already
     documented) *note PackagePath: 1971. to ‘__all__’.

   - gh-136246(3): 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/145450

   (2) https://github.com/python/cpython/issues/110937

   (3) https://github.com/python/cpython/issues/136246


File: python.info,  Node: Core and Builtins<4>,  Next: C API<4>,  Prev: ドキュメント<4>,  Up: Python 3 15 0 alpha 7

1.26.4.6 Core and Builtins
..........................

   - gh-145701(1): Fix *note SystemError: 3f1. when ‘__classdict__’ or
     ‘__conditional_annotations__’ is in a class-scope inlined
     comprehension.  Found by OSS Fuzz in #491105000(2).

   - gh-145615(3): Fixed a memory leak in the *note free-threaded build:
     1a3. where mimalloc pages could become permanently unreclaimable
     until the owning thread exited.

   - gh-116738(4): Make ‘mmap.mmap.set_name()’ thread-safe on the *note
     free threaded: 48e. build.

   - gh-145566(5): In the free threading build, skip the stop-the-world
     pause when reassigning ‘__class__’ on a newly created object.

   - gh-143055(6): Fix crash in AST unparser when unparsing dict
     comprehension unpacking.  Found by OSS Fuzz in #489790200(7).

   - gh-145335(8): Fix a crash in *note os.pathconf(): 14bc. when called
     with ‘-1’ as the path argument.

   - gh-145376(9): Fix reference leaks in various unusual error
     scenarios.

   - gh-145234(10): 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-145275(11): Added the *note -X pathconfig_warnings: 183. and
     *note PYTHON_PATHCONFIG_WARNINGS: 1973. options, allowing to
     disable warnings from *note sys.path モジュール検索パスの初期化:
     1974.

   - gh-145273(12): A warning is now shown during *note sys.path
     モジュール検索パスの初期化: 1974. if it can't find a valid standard
     library.

   - gh-145241(13): Specialized the parser error for when ‘with’ items
     are followed by a trailing comma (for example, ‘with item,:’),
     raising a clearer *note SyntaxError: 189. message.  Patch by Pablo
     Galindo and Bartosz Sławecki.

   - gh-130555(14): Fix use-after-free in *note dict.clear(): 1975. when
     the dictionary values are embedded in an object and a destructor
     causes re-entrant mutation of the dictionary.

   - gh-145197(15): Fix JIT trace crash when recording function from
     cleared generator frame.

   - gh-145187(16): Fix compiler assertion fail when a type parameter
     bound contains an invalid expression in a conditional block.

   - gh-145142(17): Fix a crash in the free-threaded build when the
     dictionary argument to *note str.maketrans(): 192. is concurrently
     modified.

   - gh-145118(18): *note str.maketrans(): 192. now accepts *note
     frozendict: 18d.

   - gh-144015(19): Speed up *note bytes.hex(): 1122, *note
     bytearray.hex(): 1123, *note binascii.hexlify(): 1976, and *note
     hashlib: 6b. ‘.hexdigest()’ operations with SIMD on x86-64, ARM64,
     and ARM32 with NEON when built with gcc (version 12 or higher) or
     clang (version 3 or higher) compilers.  Around 1.1-3x faster for
     common 16-64 byte inputs such as hashlib hex digests, and up to 8x
     faster for larger data.

   - gh-145118(20): *note type(): 191. now accepts *note frozendict:
     18d. as an argument.

   - gh-145064(21): Fix JIT optimizer assertion failure during
     ‘CALL_ALLOC_AND_ENTER_INIT’ side exit.

   - gh-145055(22): *note exec(): 190. and *note eval(): 18f. now accept
     *note frozendict: 18d. for 'globals'.  Patch by Victor Stinner.

   - gh-145058(23): Fix a crash when ‘__lazy_import__()’ is passed a
     non-string argument, by raising an *note TypeError: 29c. instead.

   - gh-144995(24): Optimize *note memoryview: 1dd. comparison: a
     ‘memoryview’ is equal to itself, there is no need to compare
     values.  Patch by Victor Stinner.

   - gh-141510(25): Update specializer to support frozendict.  Patch by
     Donghee Na.

   - gh-141510(26): Optimize ‘frozendict.fromkeys()’ to avoid
     unnecessary thread-safety operations in frozendict cases.  Patch by
     Donghee Na.

   - gh-100239(27): Speedup ‘BINARY_OP_EXTEND’ for exact floats and
     medium-size integers by up to 15%.  Patch by Chris Eibl.

   - gh-144914(28): Use ‘mimalloc’ for raw memory allocations such as
     via *note PyMem_RawMalloc(): 2ca. for better performance on *note
     free-threaded builds: 1a3.  Patch by Kumar Aditya.

   - gh-144872(29): Fix heap buffer overflow in the parser found by
     OSS-Fuzz.

   - gh-144766(30): Fix a crash in fork child process when perf support
     is enabled.

   - gh-144759(31): 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-141510(32): Add built-in *note frozendict: 18d. type.  Patch by
     Victor Stinner.

   - gh-144681(33): Fix a JIT assertion failure when a conditional
     branch jumps to the same target as the fallthrough path.

   - gh-143300(34): Add *note PyUnstable_SetImmortal(): 39f. C-API
     function to mark objects as *note immortal: 3a0.

   - gh-144702(35): Clarify the error message raised when a class
     pattern is used to match on a non-class object.

   - gh-144569(36): Optimize ‘BINARY_SLICE’ for list, tuple, and unicode
     by avoiding temporary ‘slice’ object creation.

   - gh-144438(37): Align the QSBR thread state array to a 64-byte cache
     line boundary to avoid false sharing in the *note free-threaded
     build: 1a3.

   - gh-142349(38): Implement PEP 810(39).  Patch by Pablo Galindo and
     Dino Viehland.

   - gh-141226(40): Deprecate PEP 456(41) support for providing an
     external definition of the string hashing scheme.  Removal is
     scheduled for Python 3.19.  Patch by Bénédikt Tran.

   - gh-138912(42): Improve *note MATCH_CLASS: b02. performance by up to
     52% in certain cases.  Patch by Marc Mueller.

   - gh-130327(43): Fix erroneous clearing of an object's *note
     __dict__: 1ca. if overwritten at runtime.

   - gh-80667(44): 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/145701

   (2) https://issues.oss-fuzz.com/issues/491105000

   (3) https://github.com/python/cpython/issues/145615

   (4) https://github.com/python/cpython/issues/116738

   (5) https://github.com/python/cpython/issues/145566

   (6) https://github.com/python/cpython/issues/143055

   (7) https://issues.oss-fuzz.com/issues/489790200

   (8) https://github.com/python/cpython/issues/145335

   (9) https://github.com/python/cpython/issues/145376

   (10) https://github.com/python/cpython/issues/145234

   (11) https://github.com/python/cpython/issues/145275

   (12) https://github.com/python/cpython/issues/145273

   (13) https://github.com/python/cpython/issues/145241

   (14) https://github.com/python/cpython/issues/130555

   (15) https://github.com/python/cpython/issues/145197

   (16) https://github.com/python/cpython/issues/145187

   (17) https://github.com/python/cpython/issues/145142

   (18) https://github.com/python/cpython/issues/145118

   (19) https://github.com/python/cpython/issues/144015

   (20) https://github.com/python/cpython/issues/145118

   (21) https://github.com/python/cpython/issues/145064

   (22) https://github.com/python/cpython/issues/145055

   (23) https://github.com/python/cpython/issues/145058

   (24) https://github.com/python/cpython/issues/144995

   (25) https://github.com/python/cpython/issues/141510

   (26) https://github.com/python/cpython/issues/141510

   (27) https://github.com/python/cpython/issues/100239

   (28) https://github.com/python/cpython/issues/144914

   (29) https://github.com/python/cpython/issues/144872

   (30) https://github.com/python/cpython/issues/144766

   (31) https://github.com/python/cpython/issues/144759

   (32) https://github.com/python/cpython/issues/141510

   (33) https://github.com/python/cpython/issues/144681

   (34) https://github.com/python/cpython/issues/143300

   (35) https://github.com/python/cpython/issues/144702

   (36) https://github.com/python/cpython/issues/144569

   (37) https://github.com/python/cpython/issues/144438

   (38) https://github.com/python/cpython/issues/142349

   (39) https://peps.python.org/pep-0810/

   (40) https://github.com/python/cpython/issues/141226

   (41) https://peps.python.org/pep-0456/

   (42) https://github.com/python/cpython/issues/138912

   (43) https://github.com/python/cpython/issues/130327

   (44) https://github.com/python/cpython/issues/80667


File: python.info,  Node: C API<4>,  Next: ビルド<4>,  Prev: Core and Builtins<4>,  Up: Python 3 15 0 alpha 7

1.26.4.7 C API
..............

   - gh-142417(1): Restore private provisional ‘_Py_InitializeMain()’
     function removed in Python 3.14.  Patch by Victor Stinner.

   - gh-144748(2): *note PyErr_CheckSignals(): 885. now raises the
     exception scheduled by *note PyThreadState_SetAsyncExc(): f86, if
     any.

   - gh-144981(3): Made *note PyUnstable_Code_SetExtra(): 1978, *note
     PyUnstable_Code_GetExtra(): 1979, and *note
     PyUnstable_Eval_RequestCodeExtraIndex(): 197a. thread-safe on the
     *note free threaded: 48e. build.

   - gh-141510(4): Add the following functions for the new *note
     frozendict: 18d. type:

        * *note PyAnyDict_Check(): 354.

        * *note PyAnyDict_CheckExact(): 355.

        * *note PyFrozenDict_Check(): 356.

        * *note PyFrozenDict_CheckExact(): 357.

        * *note PyFrozenDict_New(): 358.

     Patch by Victor Stinner.

   - gh-121617(5): ‘Python.h’ now also includes ‘<string.h>’ in the
     limited C API version 3.11 and newer to fix the *note Py_CLEAR:
     981. macro which uses ‘memcpy()’.  Patch by Victor Stinner.

   - gh-144175(6): Add *note PyArg_ParseArray(): 351. and *note
     PyArg_ParseArrayAndKeywords(): 352. functions to parse arguments of
     functions using the *note METH_FASTCALL: 353. calling convention.
     Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142417

   (2) https://github.com/python/cpython/issues/144748

   (3) https://github.com/python/cpython/issues/144981

   (4) https://github.com/python/cpython/issues/141510

   (5) https://github.com/python/cpython/issues/121617

   (6) https://github.com/python/cpython/issues/144175


File: python.info,  Node: ビルド<4>,  Prev: C API<4>,  Up: Python 3 15 0 alpha 7

1.26.4.8 ビルド
...............

   - gh-144533(1): Use wasmtime's ‘--argv0’ to auto-discover sysconfig
     in WASI builds

   - gh-145110(2): Fix targets "Clean" and "CLeanAll" in case of PGO
     builds on Windows.  Patch by Chris Eibl.

   - gh-144679(3): When building with Visual Studio 2026 (Version 18),
     use PlatformToolSet v145 by default.  Patch by Chris Eibl.

   - gh-144675(4): Update to WASI SDK 30.

   - gh-136677(5): Introduce executable specific linker flags to
     ‘./configure’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144533

   (2) https://github.com/python/cpython/issues/145110

   (3) https://github.com/python/cpython/issues/144679

   (4) https://github.com/python/cpython/issues/144675

   (5) https://github.com/python/cpython/issues/136677


File: python.info,  Node: Python 3 15 0 alpha 6,  Next: Python 3 15 0 alpha 5,  Prev: Python 3 15 0 alpha 7,  Up: 変更履歴

1.26.5 Python 3.15.0 alpha 6
----------------------------

'Release date: 2026-02-11'

* Menu:

* macOS: macOS<3>.
* Windows: Windows<5>.
* テスト: テスト<5>.
* セキュリティ: セキュリティ<5>.
* ライブラリ: ライブラリ<5>.
* IDLE: IDLE<4>.
* Core and Builtins: Core and Builtins<5>.
* C API: C API<5>.
* ビルド: ビルド<5>.


File: python.info,  Node: macOS<3>,  Next: Windows<5>,  Up: Python 3 15 0 alpha 6

1.26.5.1 macOS
..............

   - gh-144648(1): Allowed _remote_debugging to build on more OS
     versions by using proc_listpids() rather than proc_listallpids().

   - gh-124111(2): Update macOS installer to use Tcl/Tk 9.0.3.

   - gh-144551(3): Update macOS installer to use OpenSSL 3.5.5.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144648

   (2) https://github.com/python/cpython/issues/124111

   (3) https://github.com/python/cpython/issues/144551


File: python.info,  Node: Windows<5>,  Next: テスト<5>,  Prev: macOS<3>,  Up: Python 3 15 0 alpha 6

1.26.5.2 Windows
................

   - gh-80620(1): Support negative timestamps in *note time.gmtime():
     157e, *note time.localtime(): 18b1, and various *note datetime: 33.
     functions.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/80620


File: python.info,  Node: テスト<5>,  Next: セキュリティ<5>,  Prev: Windows<5>,  Up: Python 3 15 0 alpha 6

1.26.5.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-65784(2): 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’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144415

   (2) https://github.com/python/cpython/issues/65784


File: python.info,  Node: セキュリティ<5>,  Next: ライブラリ<5>,  Prev: テスト<5>,  Up: Python 3 15 0 alpha 6

1.26.5.4 セキュリティ
.....................

   - gh-144125(1): *note BytesGenerator: 158d. will now refuse to
     serialize (write) headers that are unsafely folded or delimited;
     see *note verify_generated_headers: 6fd.  (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-143923(5): Reject control characters in POP3 commands.

   - gh-143921(6): Reject control characters in IMAP commands.

   - gh-143919(7): Reject control characters in *note
     http.cookies.Morsel: fc7. fields and values.

   - gh-143916(8): 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/143923

   (6) https://github.com/python/cpython/issues/143921

   (7) https://github.com/python/cpython/issues/143919

   (8) https://github.com/python/cpython/issues/143916


File: python.info,  Node: ライブラリ<5>,  Next: IDLE<4>,  Prev: セキュリティ<5>,  Up: Python 3 15 0 alpha 6

1.26.5.5 ライブラリ
...................

   - gh-144538(1): Bump the version of pip bundled in ensurepip to
     version 26.0.1

   - gh-144493(2): Improve an exception error message in
     ‘_overlapped.BindLocal()’ that is raised when *note
     asyncio.loop.sock_connect(): 1185. is called on a *note
     asyncio.ProactorEventLoop: a03. with a socket that has an invalid
     address family.

   - gh-144386(3): Add support for arbitrary descriptors ‘__enter__()’,
     ‘__exit__()’, ‘__aenter__()’, and ‘__aexit__()’ in *note
     contextlib.ExitStack: 213. and *note contextlib.AsyncExitStack:
     214, for consistency with the *note with: 215. and *note async
     with: 216. statements.

   - gh-123471(4): Make concurrent iteration over *note
     itertools.combinations_with_replacement: 163b. and *note
     itertools.permutations: 1982. safe under free-threading.

   - gh-74453(5): Deprecate *note os.path.commonprefix(): 33b. in favor
     of *note os.path.commonpath(): 33c. for path segment prefixes.

     The *note os.path.commonprefix(): 33b. function is being deprecated
     due to having a misleading name and module.  The function is not
     safe to use for path prefixes despite being included in a module
     about path manipulation, meaning it is easy to accidentally
     introduce path traversal vulnerabilities into Python programs by
     using this function.

   - gh-144380(6): Improve performance of *note io.BufferedReader: 15cb.
     line iteration by ~49%.

   - gh-144363(7): Update bundled libexpat(8) to 2.7.4

   - gh-140824(9): When *note faulthandler: 5b. dumps the list of
     third-party extension modules, ignore sub-modules of stdlib
     packages.  Patch by Victor Stinner.

   - gh-144206(10): Improve error messages for buffer overflow in *note
     fcntl.fcntl(): 1983. and *note fcntl.ioctl(): 1833.

   - gh-144264(11): Speed up Base64 decoding of data containing ignored
     characters (both in non-strict mode and with an explicit
     'ignorechars' argument).  It is now up to 2 times faster for
     multiline Base64 data.

   - gh-144249(12): Add filename context to *note OSError: 543.
     exceptions raised by *note ssl.SSLContext.load_cert_chain(): 79d,
     allowing users to have more context.

   - gh-132888(13): Fix incorrect use of *note ctypes.GetLastError():
     1984. and add missing error checks for Windows API calls in
     ‘_pyrepl.windows_console’.

   - gh-142956(14): Updated *note tomllib: 105. to parse TOML 1.1.0.

   - gh-144217(15): *note mimetypes: 93.: Add support for DICOM files
     (for medical imaging) with the official MIME type
     ‘application/dicom’.  Patch by Benedikt Johannes.

   - gh-144212(16): Mime type ‘image/jxl’ is now supported by *note
     mimetypes: 93.

   - gh-143594(17): Add *note symtable.Function.get_cells(): 277. and
     *note symtable.Symbol.is_cell(): 278. methods.

   - gh-144169(18): Fix three crashes when non-string keyword arguments
     are supplied to objects in the *note ast: 9. module.

   - gh-144128(19): Fix a crash in *note array.array.fromlist(): 1985.
     when an element's *note __index__(): 444. method mutates the input
     list during conversion.

   - gh-144100(20): 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-143658(21): *note importlib.metadata: 7d.: Use *note
     str.lower(): 1986. and *note str.replace(): 6c6. to further improve
     performance of ‘importlib.metadata.Prepared.normalize()’.  Patch by
     Hugo van Kemenade and Henry Schreiner.

   - gh-144050(22): Fix *note stat.filemode(): 150b. in the pure-Python
     implementation to avoid misclassifying invalid mode values as block
     devices.

   - gh-83069(23): *note subprocess.Popen.wait(): 272.: when ‘timeout’
     is not ‘None’, an efficient event-driven mechanism now waits for
     process termination, if available.  Linux >= 5.3 uses *note
     os.pidfd_open(): 273. + *note select.poll(): 274.  macOS and other
     BSD variants use *note select.kqueue(): 275. + ‘KQ_FILTER_PROC’ +
     ‘KQ_NOTE_EXIT’.  Windows keeps using ‘WaitForSingleObject’
     (unchanged).  If none of these mechanisms are available, the
     function falls back to the traditional busy loop (non-blocking call
     and short sleeps).  Patch by Giampaolo Rodola.

   - gh-144030(24): The Python implementation of *note
     functools.lru_cache(): db7. differed from the default C
     implementation in that it did not check that its argument is
     callable.  This discrepancy is now fixed and both raise a *note
     TypeError: 29c.

   - gh-144001(25): Added the 'ignorechars' parameter in *note
     binascii.a2b_base64(): 208. and *note base64.b64decode(): 1f7.

   - gh-144023(26): Fixed validation of file descriptor 0 in posix
     functions when used with follow_symlinks parameter.

   - gh-143999(27): Fix an issue where *note
     inspect.getgeneratorstate(): 15f1. and *note
     inspect.getcoroutinestate(): 11d1. could fail for generators
     wrapped by *note types.coroutine(): 123c. in the suspended state.

   - gh-143952(28): Fixed *note asyncio: b. debugging tools to work with
     new remote debugging API. Patch by Bartosz Sławecki.

   - gh-143904(29): *note struct.pack_into(): 1987. now raises
     OverflowError instead of IndexError for too large 'offset'
     argument.

   - gh-143897(30): Remove the ‘isxidstart()’ and ‘isxidcontinue()’
     methods of *note unicodedata.ucd_3_2_0: 17ec.  They are now only
     exposed as *note unicodedata.isxidstart(): 2a2. and *note
     unicodedata.isxidcontinue(): 2a3.

   - gh-143831(31): *note annotationlib.ForwardRef: 1988. 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(32): Fixed a bug in *note pdb: aa. where expression
     results were not sent back to remote client.

   - gh-143754(33): Add new *note tkinter: f9. widget methods
     ‘pack_content()’, ‘place_content()’ and ‘grid_content()’ which are
     alternative spelling of old ‘*_slaves()’ methods.

   - gh-143756(34): Fix potential thread safety issues in *note ssl: d8.
     module.

   - gh-132604(35): Previously, *note Protocol: 772. classes that were
     not decorated with *note @~typing.runtime_checkable: 867, but that
     inherited from another ‘Protocol’ class that did have this
     decorator, could be used in *note isinstance(): 2fb. and *note
     issubclass(): 2fc. checks.  This behavior is now deprecated and
     such checks will throw a *note TypeError: 29c. in Python 3.20.
     Patch by Bartosz Sławecki.

   - gh-143543(36): Fix a crash in itertools.groupby that could occur
     when a user-defined *note __eq__(): ec4. method re-enters the
     iterator during key comparison.

   - gh-143689(37): Fix *note io.BufferedReader.read1(): 1989. state
     cleanup on buffer allocation failure.

   - gh-143602(38): Fix a inconsistency issue in *note write(): 1764.
     that leads to unexpected buffer overwrite by deduplicating the
     buffer exports.

   - gh-142434(39): Use ‘ppoll()’ if available in *note select.poll():
     274. to have a timeout resolution of 1 nanosecond, instead of a
     resolution of 1 ms.  Patch by Victor Stinner.

   - gh-140557(40): *note array.array: 6cb. buffers now have the same
     alignment when empty as when allocated.  Unaligned buffers can
     still be created by slicing.

   - gh-143423(41): Fix free-threaded build detection in the sampling
     profiler when Py_GIL_DISABLED is set to 0.

   - gh-101178(42): Add Ascii85, Base85, and Z85 support to *note
     binascii: 11. and improve the performance of the base-85 converters
     in *note base64: f.

   - gh-142966(43): Fix ‘ctypes.POINTER.set_type()’ not updating the
     format string to match the type.

   - gh-142555(44): *note array: 8.: fix a crash in ‘a[i] = v’ when
     converting 'i' to an index via *note i.__index__: 444. or *note
     i.__float__: d96. mutates the array.

   - gh-142438(45): Fix _decimal builds configured with
     EXTRA_FUNCTIONALITY by correcting the Context.apply wrapper to pass
     the right argument.

   - gh-141860(46): Add an ‘on_error’ keyword-only parameter to *note
     multiprocessing.set_forkserver_preload(): 198a. to control how
     import failures during module preloading are handled.  Accepts
     ‘'ignore'’ (default, silent), ‘'warn'’ (emit *note ImportWarning:
     90c.), or ‘'fail'’ (raise exception).  Contributed by Nick Neumann
     and Gregory P. Smith.

   - gh-125346(47): Accepting ‘+’ and ‘/’ characters with an alternative
     alphabet in *note base64.b64decode(): 1f7. and *note
     base64.urlsafe_b64decode(): 1f9. is now deprecated.  In future
     Python versions they will be errors in the strict mode and
     discarded in the non-strict mode.

   - gh-140715(48): Add ‘'%F'’ support to *note strptime(): 2dd.

   - gh-67041(49): Add the 'missing_as_none' parameter to *note
     urlparse(): 2af, *note urlsplit(): 2ae. and *note urldefrag(): 2b0.
     functions.  Add the 'keep_empty' parameter to *note urlunparse():
     2b2. and *note urlunsplit(): 2b1. functions.  This allows to
     distinguish between empty and not defined URI components and
     preserve empty components.

   - gh-77188(50): The *note pickle: ab. module now properly handles
     name-mangled private methods.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144538

   (2) https://github.com/python/cpython/issues/144493

   (3) https://github.com/python/cpython/issues/144386

   (4) https://github.com/python/cpython/issues/123471

   (5) https://github.com/python/cpython/issues/74453

   (6) https://github.com/python/cpython/issues/144380

   (7) https://github.com/python/cpython/issues/144363

   (8) https://libexpat.github.io/

   (9) https://github.com/python/cpython/issues/140824

   (10) https://github.com/python/cpython/issues/144206

   (11) https://github.com/python/cpython/issues/144264

   (12) https://github.com/python/cpython/issues/144249

   (13) https://github.com/python/cpython/issues/132888

   (14) https://github.com/python/cpython/issues/142956

   (15) https://github.com/python/cpython/issues/144217

   (16) https://github.com/python/cpython/issues/144212

   (17) https://github.com/python/cpython/issues/143594

   (18) https://github.com/python/cpython/issues/144169

   (19) https://github.com/python/cpython/issues/144128

   (20) https://github.com/python/cpython/issues/144100

   (21) https://github.com/python/cpython/issues/143658

   (22) https://github.com/python/cpython/issues/144050

   (23) https://github.com/python/cpython/issues/83069

   (24) https://github.com/python/cpython/issues/144030

   (25) https://github.com/python/cpython/issues/144001

   (26) https://github.com/python/cpython/issues/144023

   (27) https://github.com/python/cpython/issues/143999

   (28) https://github.com/python/cpython/issues/143952

   (29) https://github.com/python/cpython/issues/143904

   (30) https://github.com/python/cpython/issues/143897

   (31) https://github.com/python/cpython/issues/143831

   (32) https://github.com/python/cpython/issues/143874

   (33) https://github.com/python/cpython/issues/143754

   (34) https://github.com/python/cpython/issues/143756

   (35) https://github.com/python/cpython/issues/132604

   (36) https://github.com/python/cpython/issues/143543

   (37) https://github.com/python/cpython/issues/143689

   (38) https://github.com/python/cpython/issues/143602

   (39) https://github.com/python/cpython/issues/142434

   (40) https://github.com/python/cpython/issues/140557

   (41) https://github.com/python/cpython/issues/143423

   (42) https://github.com/python/cpython/issues/101178

   (43) https://github.com/python/cpython/issues/142966

   (44) https://github.com/python/cpython/issues/142555

   (45) https://github.com/python/cpython/issues/142438

   (46) https://github.com/python/cpython/issues/141860

   (47) https://github.com/python/cpython/issues/125346

   (48) https://github.com/python/cpython/issues/140715

   (49) https://github.com/python/cpython/issues/67041

   (50) https://github.com/python/cpython/issues/77188


File: python.info,  Node: IDLE<4>,  Next: Core and Builtins<5>,  Prev: ライブラリ<5>,  Up: Python 3 15 0 alpha 6

1.26.5.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: Core and Builtins<5>,  Next: C API<5>,  Prev: IDLE<4>,  Up: Python 3 15 0 alpha 6

1.26.5.7 Core and Builtins
..........................

   - gh-134584(1): Optimize and eliminate ref-counting in
     ‘_BINARY_OP_SUBSCR_LIST_SLICE’

   - gh-144563(2): Fix interaction of the Tachyon profiler and *note
     ctypes: 2d. 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(3): Fix crash when importing a module whose ‘PyInit’
     function raises an exception from a subinterpreter.

   - gh-144549(4): Fix building the tail calling interpreter on Visual
     Studio 2026 with free-threading.

   - gh-144513(5): Fix potential deadlock when using critical sections
     during stop-the-world pauses in the free-threaded build.

   - gh-131798(6): Optimise ‘_GUARD_TOS_SLICE’ in the JIT.

   - gh-144330(7): Move ‘classmethod’ and ‘staticmethod’ initialization
     from ‘__init__()’ to ‘__new__()’.  Patch by Victor Stinner.

   - gh-144446(8): Fix data races in the free-threaded build when
     reading frame object attributes while another thread is executing
     the frame.

   - gh-120321(9): Add ‘gi_state’, ‘cr_state’, and ‘ag_state’ attributes
     to generators, coroutines, and async generators that return the
     current state as a string (e.g., ‘GEN_RUNNING’).  The *note
     inspect: 81. module functions *note getgeneratorstate(): 15f1,
     *note getcoroutinestate(): 11d1, and *note getasyncgenstate(): 8a8.
     now return these attributes directly.

   - gh-141563(10): Fix thread safety of ‘ PyDateTime_IMPORT’.

   - gh-144280(11): Fix a bug in JIT where the predicate symbol had no
     truthiness

   - gh-140550(12): In *note PyModuleDef.m_slots: 198d, allow slots that
     repeat information present in *note PyModuleDef: d49.

   - gh-139103(13): Improve scaling of *note namedtuple(): 1da.
     instantiation in the free-threaded build.

   - gh-144307(14): Prevent a reference leak in module teardown at
     interpreter finalization.

   - gh-144319(15): Add huge pages support for the pymalloc allocator.
     Patch by Pablo Galindo

   - gh-120321(16): Made ‘gi_yieldfrom’ thread-safe in the
     free-threading build by using a lightweight lock on the frame
     state.

   - gh-144194(17): Fix error handling in perf jitdump initialization on
     memory allocation failure.

   - gh-143962(18): Name suggestion for not normalized name suggests now
     the normalized name or the closest name to the normalized name.  If
     the suggested name is not ASCII, include also its ASCII
     representation.

   - gh-144157(19): *note bytes.translate(): 198e. now allows the
     compiler to unroll its loop more usefully for a 2x speedup in the
     common no-deletions specified case.

   - gh-144068(20): Fix JIT tracer memory leak, ensure the JIT tracer
     state is freed when daemon threads are cleaned up during
     interpreter shutdown.

   - gh-144012(21): Check if the result is ‘NULL’ in ‘BINARY_OP_EXTENT’
     opcode.

   - gh-144007(22): Eliminate redundant refcounting in the JIT for
     ‘BINARY_OP’.

   - gh-144005(23): Eliminate redundant refcounting from
     ‘BINARY_OP_EXTEND’.

   - gh-143939(24): Fix erroneous "cannot reuse already awaited
     coroutine" error that could occur when a generator was run during
     the process of clearing a coroutine's frame.

   - gh-141805(25): Fix crash in *note set: 432. 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(26): Fixes a crash in ‘ga_repr_items_list’ function.

   - gh-143650(27): Fix race condition in *note importlib: 7a. where a
     thread could receive a stale module reference when another thread's
     import fails.

   - gh-143569(28): Generator expressions in 3.15 now conform to the
     documented behavior when the iterable does not support iteration.
     This matches the behavior in 3.14 and earlier

   - gh-143192(29): Improve performance of bitwise operations on
     multi-digit ints.

   - gh-132657(30): If we are specializing to ‘LOAD_GLOBAL_MODULE’ or
     ‘LOAD_ATTR_MODULE’, try to enable deferred reference counting for
     the value, if the object is owned by a different thread.  This
     applies to the free-threaded build only and should improve scaling
     of multi-threaded programs.  Note that when deferred reference
     counting is enabled, the object will be deallocated by the GC,
     rather than by *note Py_DECREF(): 97a.

   - gh-143055(31): Implement PEP 798(32) (Unpacking in Comprehensions).
     Patch by Adam Hartz.

   - gh-142037(33): Improve error messages for printf-style formatting.
     For errors in the format string, always include the position of the
     start of the format unit.  For errors related to the formatted
     arguments, always include the number or the name of the argument.
     Raise more specific errors and include more information (type and
     number of arguments, most probable causes of error).

   - gh-140557(34): *note bytearray: 1d1. buffers now have the same
     alignment when empty as when allocated.  Unaligned buffers can
     still be created by slicing.

   - gh-140232(35): Frozenset objects with immutable elements are no
     longer tracked by the garbage collector.

   - gh-115231(36): Setup ‘__module__’ attribute for built-in static
     methods.  Patch by Sergey B Kirpichev.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134584

   (2) https://github.com/python/cpython/issues/144563

   (3) https://github.com/python/cpython/issues/144601

   (4) https://github.com/python/cpython/issues/144549

   (5) https://github.com/python/cpython/issues/144513

   (6) https://github.com/python/cpython/issues/131798

   (7) https://github.com/python/cpython/issues/144330

   (8) https://github.com/python/cpython/issues/144446

   (9) https://github.com/python/cpython/issues/120321

   (10) https://github.com/python/cpython/issues/141563

   (11) https://github.com/python/cpython/issues/144280

   (12) https://github.com/python/cpython/issues/140550

   (13) https://github.com/python/cpython/issues/139103

   (14) https://github.com/python/cpython/issues/144307

   (15) https://github.com/python/cpython/issues/144319

   (16) https://github.com/python/cpython/issues/120321

   (17) https://github.com/python/cpython/issues/144194

   (18) https://github.com/python/cpython/issues/143962

   (19) https://github.com/python/cpython/issues/144157

   (20) https://github.com/python/cpython/issues/144068

   (21) https://github.com/python/cpython/issues/144012

   (22) https://github.com/python/cpython/issues/144007

   (23) https://github.com/python/cpython/issues/144005

   (24) https://github.com/python/cpython/issues/143939

   (25) https://github.com/python/cpython/issues/141805

   (26) https://github.com/python/cpython/issues/143670

   (27) https://github.com/python/cpython/issues/143650

   (28) https://github.com/python/cpython/issues/143569

   (29) https://github.com/python/cpython/issues/143192

   (30) https://github.com/python/cpython/issues/132657

   (31) https://github.com/python/cpython/issues/143055

   (32) https://peps.python.org/pep-0798/

   (33) https://github.com/python/cpython/issues/142037

   (34) https://github.com/python/cpython/issues/140557

   (35) https://github.com/python/cpython/issues/140232

   (36) https://github.com/python/cpython/issues/115231


File: python.info,  Node: C API<5>,  Next: ビルド<5>,  Prev: Core and Builtins<5>,  Up: Python 3 15 0 alpha 6

1.26.5.8 C API
..............

   - gh-143869(1): Added *note PyLong_GetNativeLayout(): 5db, *note
     PyLongLayout: 1990, *note PyLongExport: 1991, *note
     PyLong_Export(): 5dc, *note PyLong_FreeExport(): 5dd, *note
     PyLongWriter: 1992, *note PyLongWriter_Create(): 5de, *note
     PyLongWriter_Finish(): 5df. and *note PyLongWriter_Discard(): 5e0.
     to the limited API.

   - gh-141070(2): Renamed ‘PyUnstable_Object_Dump()’ to *note
     PyObject_Dump(): 37c.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/143869

   (2) https://github.com/python/cpython/issues/141070


File: python.info,  Node: ビルド<5>,  Prev: C API<5>,  Up: Python 3 15 0 alpha 6

1.26.5.9 ビルド
...............

   - gh-140421(1): Disable the perf trampoline on older macOS versions
     where it cannot be built.

   - gh-144309(2): Build Python with POSIX 2024, instead of POSIX 2008.
     Patch by Victor Stinner.

   - gh-144278(3): Enables defining the ‘_PY_IMPL_NAME’ and
     ‘_PY_IMPL_CACHE_TAG’ preprocessor definitions to override *note
     sys.implementation: 92b. at build time.  Definitions need to
     include quotes when setting to a string literal.  Setting the cache
     tag to ‘NULL’ has the effect of completely disabling automatic
     creation and use of ‘.pyc’ files.

   - gh-143960(4): Add support for OpenSSL 3.6, drop EOL 3.2.  Patch by
     Hugo van Kemenade.

   - gh-143941(5): Move WASI-related files to ‘Platforms/WASI’.  Along
     the way, leave a deprecated ‘Tools/wasm/wasi/__main__.py’ behind
     for backwards-compatibility.

   - gh-143842(6): Prevent static builds from clashing with curses by
     making the optimizer COLORS table static.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140421

   (2) https://github.com/python/cpython/issues/144309

   (3) https://github.com/python/cpython/issues/144278

   (4) https://github.com/python/cpython/issues/143960

   (5) https://github.com/python/cpython/issues/143941

   (6) https://github.com/python/cpython/issues/143842


File: python.info,  Node: Python 3 15 0 alpha 5,  Next: Python 3 15 0 alpha 4,  Prev: Python 3 15 0 alpha 6,  Up: 変更履歴

1.26.6 Python 3.15.0 alpha 5
----------------------------

'Release date: 2026-01-14'

* Menu:

* Windows: Windows<6>.
* Tools/Demos: Tools/Demos<2>.
* テスト: テスト<6>.
* ライブラリ: ライブラリ<6>.
* ドキュメント: ドキュメント<5>.
* Core and Builtins: Core and Builtins<6>.
* C API: C API<6>.


File: python.info,  Node: Windows<6>,  Next: Tools/Demos<2>,  Up: Python 3 15 0 alpha 5

1.26.6.1 Windows
................

   - gh-143082(1): Fix *note pdb: aa. arrow key history not working when
     ‘stdin’ is ‘sys.stdin’.

   - gh-128067(2): 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/143082

   (2) https://github.com/python/cpython/issues/128067


File: python.info,  Node: Tools/Demos<2>,  Next: テスト<6>,  Prev: Windows<6>,  Up: Python 3 15 0 alpha 5

1.26.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: テスト<6>,  Next: ライブラリ<6>,  Prev: Tools/Demos<2>,  Up: Python 3 15 0 alpha 5

1.26.6.3 テスト
...............

   - gh-143460(1): Skip tests relying on infinite recusion if stack size
     is unlimited.

   - gh-143553(2): Add support for parametrized resources, such as ‘-u
     xpickle=2.7’.

   - bpo-31391(3): 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/143460

   (2) https://github.com/python/cpython/issues/143553

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31391


File: python.info,  Node: ライブラリ<6>,  Next: ドキュメント<5>,  Prev: テスト<6>,  Up: Python 3 15 0 alpha 5

1.26.6.4 ライブラリ
...................

   - gh-143706(1): Fix *note multiprocessing: 98. forkserver so that
     *note sys.argv: 161e. 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(2): Forbid reentrant calls of the *note pickle.Pickler:
     de6. and *note pickle.Unpickler: 1999. 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: 317.

   - gh-143658(3): *note importlib.metadata: 7d.: Use *note
     str.translate(): 199a. to improve performance of
     ‘importlib.metadata.Prepared.normalize()’.  Patch by Hugo van
     Kemenade and Henry Schreiner.

   - gh-78724(4): Raise *note RuntimeError: 317.'s when user attempts to
     call methods on half-initialized *note Struct: 307. objects, For
     example, created by ‘Struct.__new__(Struct)’.  Patch by Sergey B
     Kirpichev.

   - gh-143196(5): 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(6): *note _thread.stack_size(): 199b. now raises *note
     ValueError: 15a. if the stack size is too small.  Patch by Victor
     Stinner.

   - gh-143547(7): Fix *note sys.unraisablehook(): 712. when the hook
     raises an exception and changes ‘sys.unraisablehook()’: hold a
     strong reference to the old hook.  Patch by Victor Stinner.

   - gh-139686(8): Revert 0a97941245f1dda6d838f9aaf0512104e5253929 and
     57db12514ac686f0a752ec8fe1c08b6daa0c6219 which made
     importlib.reload a no-op for lazy modules; caused Buildbot
     failures.

   - gh-143517(9): *note annotationlib.get_annotations(): 673. no longer
     raises a *note SyntaxError: 189. when evaluating a stringified
     starred annotation that starts with one or more whitespace
     characters followed by a ‘*’.  Patch by Bartosz Sławecki.

   - gh-143474(10): Add *note os.RWF_ATOMIC: 199c. constant for Linux
     6.11+.

   - gh-143445(11): Speed up *note copy.deepcopy(): f2f. by 1.04x.

   - gh-143378(12): Fix use-after-free crashes when a *note BytesIO:
     1258. object is concurrently mutated during *note write(): 1764. or
     *note writelines(): 199d.

   - gh-143368(13): Fix endless retry loop in *note profiling.sampling:
     b6. blocking mode when threads cannot be seized due to ‘EPERM’.
     Such threads are now skipped instead of causing repeated error
     messages.  Patch by Pablo Galindo.

   - gh-143346(14): Fix incorrect wrapping of the Base64 data in
     ‘plistlib._PlistWriter’ when the indent contains a mix of tabs and
     spaces.

   - gh-140025(15): *note queue: be.: Fix ‘SimpleQueue.__sizeof__()’
     computation.

   - gh-143310(16): *note tkinter: f9.: fix a crash when a Python *note
     list: 4e0. is mutated during the conversion to a Tcl object (e.g.,
     when setting a Tcl variable).  Patch by Bénédikt Tran.

   - gh-143309(17): Fix a crash in *note os.execve(): 14ba. on
     non-Windows platforms when given a custom environment mapping which
     is then mutated during parsing.  Patch by Bénédikt Tran.

   - gh-143308(18): *note pickle: ab.: fix use-after-free crashes when a
     *note PickleBuffer: 1929. is concurrently mutated by a custom
     buffer callback during pickling.  Patch by Bénédikt Tran and Aaron
     Wieczorek.

   - gh-142939(19): Performance optimisations for *note
     difflib.get_close_matches(): 199e.

   - gh-124951(20): The base64 implementation behind the *note binascii:
     11, *note base64: f, and related codec has been optimized for
     modern pipelined CPU architectures and now performs 2-3x faster
     across all platforms.

   - gh-143237(21): Fix support of named pipes in the rotating *note
     logging: 8a. handlers.

   - gh-143249(22): Fix possible buffer leaks in Windows overlapped I/O
     on error handling.

   - gh-143241(23): *note zoneinfo: 13d.: fix infinite loop in *note
     ZoneInfo.from_file: 199f. when parsing a malformed TZif file.
     Patch by Fatih Celik.

   - gh-142830(24): *note sqlite3: d7.: fix use-after-free crashes when
     the connection's callbacks are mutated during a callback execution.
     Patch by Bénédikt Tran.

   - gh-143200(25): *note xml.etree.ElementTree: 12e.: fix
     use-after-free crashes in *note __getitem__(): 78d. and *note
     __setitem__(): 1685. methods of *note Element: 34b. when the
     element is concurrently mutated.  Patch by Bénédikt Tran.

   - gh-143214(26): Add the 'wrapcol' parameter in *note
     binascii.b2a_base64(): 207. and *note base64.b64encode(): 1f6.

   - gh-142195(27): Updated timeout evaluation logic in *note
     subprocess: df. to be compatible with deterministic environments
     like Shadow where time moves exactly as requested.

   - gh-140739(28): Fix several crashes due to reading invalid memory in
     the new Tachyon sampling profiler.  Patch by Pablo Galindo.

   - 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-143103(31): Add padding support to *note base64.z85encode():
     1f1. via the ‘pad’ parameter.

   - gh-130796(32): Undeprecate the *note locale.getdefaultlocale():
     23e. function.  Patch by Victor Stinner.

   - gh-74902(33): Add the *note iter_graphemes(): 2a4. function in the
     *note unicodedata: 10e. module to iterate over grapheme clusters
     according to rules defined in Unicode Standard Annex #29, "Unicode
     Text Segmentation"(34).  Add *note grapheme_cluster_break(): 2a5,
     *note indic_conjunct_break(): 2a6. and *note
     extended_pictographic(): 2a7. functions to get the properties of
     the character which are related to the above algorithm.

   - gh-143004(35): Fix a potential use-after-free in *note
     collections.Counter.update(): 19a0. when user code mutates the
     Counter during an update.

   - gh-140648(36): The *note asyncio: b. REPL now respects the *note
     -I: d2c. flag (isolated mode).  Previously, it would load and
     execute *note PYTHONSTARTUP: 45a. even if the flag was set.
     Contributed by Bartosz Sławecki.

   - gh-142991(37): Fixed socket operations such as recvfrom() and
     sendto() for FreeBSD divert(4) socket.

   - gh-116738(38): Make the attributes in *note lzma: 8d. thread-safe
     on the *note free threaded: 48e. build.

   - gh-142950(39): Fix regression in *note argparse: 7. where format
     specifiers in help strings raised *note ValueError: 15a.

   - gh-142881(40): Fix concurrent and reentrant call of *note
     atexit.unregister(): 19a1.

   - gh-142615(41): Fix possible crashes when initializing *note
     asyncio.Task: 467. or *note asyncio.Future: f8f. multiple times.
     These classes can now be initialized only once and any subsequent
     initialization attempt will raise a RuntimeError.  Patch by Kumar
     Aditya.

   - gh-142517(42): The non-‘compat32’ *note email: 3e. 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-138122(43): The Tachyon profiler's live TUI now integrates with
     the experimental ‘_colorize’ theming system.  Users can customize
     colors via ‘_colorize.set_theme()’ (experimental API, subject to
     change).  A ‘LiveProfilerLight’ theme is provided for light
     terminal backgrounds.  Patch by Pablo Galindo.

   - gh-142306(44): Improve errors for *note Element.remove: 19a2.

   - gh-63016(45): Add a ‘flags’ parameter to *note mmap.mmap.flush():
     e62. to control synchronization behavior.

   - gh-139262(46): 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(47): Improved *note license: 19a3./*note copyright:
     19a4./*note credits: 19a5. display in the *note REPL: 6a3.: now
     uses a pager.

   - gh-135852(48): Add ‘_winapi.RegisterEventSource()’,
     ‘_winapi.DeregisterEventSource()’ and ‘_winapi.ReportEvent()’.
     Using these functions in *note NTEventLogHandler: 19a6. to replace
     ‘pywin32’.

   - gh-109263(49): Starting a process from spawn context in *note
     multiprocessing: 98. no longer sets the start method globally.

   - gh-132715(50): Skip writing objects during marshalling once a
     failure has occurred.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/143706

   (2) https://github.com/python/cpython/issues/143638

   (3) https://github.com/python/cpython/issues/143658

   (4) https://github.com/python/cpython/issues/78724

   (5) https://github.com/python/cpython/issues/143196

   (6) https://github.com/python/cpython/issues/143191

   (7) https://github.com/python/cpython/issues/143547

   (8) https://github.com/python/cpython/issues/139686

   (9) https://github.com/python/cpython/issues/143517

   (10) https://github.com/python/cpython/issues/143474

   (11) https://github.com/python/cpython/issues/143445

   (12) https://github.com/python/cpython/issues/143378

   (13) https://github.com/python/cpython/issues/143368

   (14) https://github.com/python/cpython/issues/143346

   (15) https://github.com/python/cpython/issues/140025

   (16) https://github.com/python/cpython/issues/143310

   (17) https://github.com/python/cpython/issues/143309

   (18) https://github.com/python/cpython/issues/143308

   (19) https://github.com/python/cpython/issues/142939

   (20) https://github.com/python/cpython/issues/124951

   (21) https://github.com/python/cpython/issues/143237

   (22) https://github.com/python/cpython/issues/143249

   (23) https://github.com/python/cpython/issues/143241

   (24) https://github.com/python/cpython/issues/142830

   (25) https://github.com/python/cpython/issues/143200

   (26) https://github.com/python/cpython/issues/143214

   (27) https://github.com/python/cpython/issues/142195

   (28) https://github.com/python/cpython/issues/140739

   (29) https://github.com/python/cpython/issues/142164

   (30) https://github.com/python/cpython/issues/143145

   (31) https://github.com/python/cpython/issues/143103

   (32) https://github.com/python/cpython/issues/130796

   (33) https://github.com/python/cpython/issues/74902

   (34) https://www.unicode.org/reports/tr29/

   (35) https://github.com/python/cpython/issues/143004

   (36) https://github.com/python/cpython/issues/140648

   (37) https://github.com/python/cpython/issues/142991

   (38) https://github.com/python/cpython/issues/116738

   (39) https://github.com/python/cpython/issues/142950

   (40) https://github.com/python/cpython/issues/142881

   (41) https://github.com/python/cpython/issues/142615

   (42) https://github.com/python/cpython/issues/142517

   (43) https://github.com/python/cpython/issues/138122

   (44) https://github.com/python/cpython/issues/142306

   (45) https://github.com/python/cpython/issues/63016

   (46) https://github.com/python/cpython/issues/139262

   (47) https://github.com/python/cpython/issues/138897

   (48) https://github.com/python/cpython/issues/135852

   (49) https://github.com/python/cpython/issues/109263

   (50) https://github.com/python/cpython/issues/132715


File: python.info,  Node: ドキュメント<5>,  Next: Core and Builtins<6>,  Prev: ライブラリ<6>,  Up: Python 3 15 0 alpha 5

1.26.6.5 ドキュメント
.....................

   - gh-140806(1): Add documentation for *note enum.bin(): 19a8.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140806


File: python.info,  Node: Core and Builtins<6>,  Next: C API<6>,  Prev: ドキュメント<5>,  Up: Python 3 15 0 alpha 5

1.26.6.6 Core and Builtins
..........................

   - gh-134584(1): Eliminate redundant refcounting from ‘_CONTAINS_OP’,
     ‘_CONTAINS_OP_SET’ and ‘_CONTAINS_OP_DICT’.

   - gh-143604(2): Fix a reference counting issue in the JIT tracer
     where the current executor could be prematurely freed during
     tracing.

   - gh-143469(3): Enable ‘LOAD_ATTR_MODULE’ specialization even if
     ‘__getattr__()’ is defined in module.

   - gh-134584(4): Eliminate redundant refcounting from ‘TO_BOOL_STR’.

   - gh-143377(5): Fix a crash in ‘_interpreters.capture_exception()’
     when the exception is incorrectly formatted.  Patch by Bénédikt
     Tran.

   - gh-139757(6): Add ‘BINARY_OP_SUBSCR_USTR_INT’ to specialize reading
     an ASCII character from any string.  Patch by Chris Eibl.

   - gh-141504(7): Factor out tracing and optimization heuristics into a
     single object.  Patch by Donghee Na.

   - gh-142982(8): Specialize *note CALL_FUNCTION_EX: 110c. for Python
     and non-Python callables.

   - gh-136924(9): The interactive help mode in the *note REPL: 6a3. no
     longer incorrectly syntax highlights text input as Python code.
     Contributed by Olga Matoula.

   - gh-139757(10): Fix unintended bytecode specialization for non-ascii
     string.  Patch by Donghee Na, Ken Jin and Chris Eibl.

   - gh-143361(11): Add ‘PY_VECTORCALL_ARGUMENTS_OFFSET’ to
     ‘_Py_CallBuiltinClass_StackRefSteal’ to avoid redundant allocations

   - gh-131798(12): The JIT optimizer now understands more generator
     instructions.

   - gh-134584(13): Eliminate redundant refcounting from
     ‘_LOAD_ATTR_SLOT’.

   - gh-143189(14): Fix crash when inserting a non-*note str: 1ea. 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(15): 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(16): Fix a use-after-free crash in *note
     memoryview.__hash__: ec5. when the ‘__hash__’ method of the
     referenced object mutates that object or the view.  Patch by
     Bénédikt Tran.

   - gh-142557(17): Fix a use-after-free crash in *note
     bytearray.__mod__: 113e. when the ‘bytearray’ is mutated while
     formatting the ‘%’-style arguments.  Patch by Bénédikt Tran.

   - gh-143195(18): Fix use-after-free crashes in *note bytearray.hex():
     1123. and *note memoryview.hex(): 1124. when the separator's *note
     __len__(): 19aa. mutates the original object.  Patch by Bénédikt
     Tran.

   - gh-143183(19): Fix a bug in the JIT when dealing with unsupported
     control-flow or operations.

   - gh-142975(20): Fix crash after unfreezing all objects tracked by
     the garbage collector on the *note free threaded: 48e. build.

   - gh-143135(21): Set *note sys.flags.inspect: 19ab. to ‘1’ when *note
     PYTHONINSPECT: 1892. is ‘0’.  Previously, it was set to ‘0’ in this
     case.

   - gh-143123(22): Protect the JIT against recursive tracing.

   - gh-143092(23): Fix a crash in the JIT when dealing with
     ‘list.append(x)’ style code.

   - gh-143003(24): Fix an overflow of the shared empty buffer in *note
     bytearray.extend(): 19ac. when ‘__length_hint__()’ returns 0 for
     non-empty iterator.

   - gh-143006(25): Fix a possible assertion error when comparing
     negative non-integer ‘float’ and ‘int’ with the same number of bits
     in the integer part.

   - gh-116738(26): Fix thread safety of *note
     contextvars.Context.run(): 19ad.

   - gh-142829(27): Fix a use-after-free crash in *note
     contextvars.Context: 428. comparison when a custom ‘__eq__’ method
     modifies the context via *note set(): 19ae.

   - gh-142863(28): Generate optimized bytecode when calling *note list:
     4e0. or *note set: 432. with generator expression.

   - gh-41779(29): Allowed defining any *note __slots__: 1d8. for a
     class derived from *note tuple: 1d9. (including classes created by
     *note collections.namedtuple(): 1da.).

   - gh-69605(30): Fix edge-cases around already imported modules in the
     *note REPL: 6a3. auto-completion of imports.

   - gh-138568(31): Adjusted the built-in *note help(): cad. function so
     that empty inputs are ignored in interactive mode.

   - gh-131798(32): Remove bounds check when indexing into tuples with a
     constant index.

   - gh-134584(33): Eliminate redundant refcounting from ‘_CALL_TYPE_1’.
     Patch by Tomas Roun

   - gh-132108(34): Speed up *note int.from_bytes(): 19af. when passed
     object supports *note buffer protocol: 319, like *note bytearray:
     1d1. by ~1.2x.

   - gh-128334(35): Make the *note slice: 1db. class subscriptable at
     runtime to be consistent with typing implementation.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134584

   (2) https://github.com/python/cpython/issues/143604

   (3) https://github.com/python/cpython/issues/143469

   (4) https://github.com/python/cpython/issues/134584

   (5) https://github.com/python/cpython/issues/143377

   (6) https://github.com/python/cpython/issues/139757

   (7) https://github.com/python/cpython/issues/141504

   (8) https://github.com/python/cpython/issues/142982

   (9) https://github.com/python/cpython/issues/136924

   (10) https://github.com/python/cpython/issues/139757

   (11) https://github.com/python/cpython/issues/143361

   (12) https://github.com/python/cpython/issues/131798

   (13) https://github.com/python/cpython/issues/134584

   (14) https://github.com/python/cpython/issues/143189

   (15) https://github.com/python/cpython/issues/143228

   (16) https://github.com/python/cpython/issues/142664

   (17) https://github.com/python/cpython/issues/142557

   (18) https://github.com/python/cpython/issues/143195

   (19) https://github.com/python/cpython/issues/143183

   (20) https://github.com/python/cpython/issues/142975

   (21) https://github.com/python/cpython/issues/143135

   (22) https://github.com/python/cpython/issues/143123

   (23) https://github.com/python/cpython/issues/143092

   (24) https://github.com/python/cpython/issues/143003

   (25) https://github.com/python/cpython/issues/143006

   (26) https://github.com/python/cpython/issues/116738

   (27) https://github.com/python/cpython/issues/142829

   (28) https://github.com/python/cpython/issues/142863

   (29) https://github.com/python/cpython/issues/41779

   (30) https://github.com/python/cpython/issues/69605

   (31) https://github.com/python/cpython/issues/138568

   (32) https://github.com/python/cpython/issues/131798

   (33) https://github.com/python/cpython/issues/134584

   (34) https://github.com/python/cpython/issues/132108

   (35) https://github.com/python/cpython/issues/128334


File: python.info,  Node: C API<6>,  Prev: Core and Builtins<6>,  Up: Python 3 15 0 alpha 5

1.26.6.7 C API
..............

   - gh-141671(1): *note PyMODINIT_FUNC: 188b. (and the new *note
     PyMODEXPORT_FUNC: 19b1.) now adds a linkage declaration
     (‘__declspec(dllexport)’) on Windows.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141671


File: python.info,  Node: Python 3 15 0 alpha 4,  Next: Python 3 15 0 alpha 3,  Prev: Python 3 15 0 alpha 5,  Up: 変更履歴

1.26.7 Python 3.15.0 alpha 4
----------------------------

'Release date: 2026-01-13'

* Menu:

* テスト: テスト<7>.
* ライブラリ: ライブラリ<7>.
* Core and Builtins: Core and Builtins<7>.


File: python.info,  Node: テスト<7>,  Next: ライブラリ<7>,  Up: Python 3 15 0 alpha 4

1.26.7.1 テスト
...............

   - gh-142836(1): Accommodated Solaris in
     ‘test_pdb.test_script_target_anonymous_pipe’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142836


File: python.info,  Node: ライブラリ<7>,  Next: Core and Builtins<7>,  Prev: テスト<7>,  Up: Python 3 15 0 alpha 4

1.26.7.2 ライブラリ
...................

   - gh-122431(1): Corrected the error message in *note
     readline.append_history_file(): 1205. to state that ‘nelements’
     must be non-negative instead of positive.

   - gh-143046(2): The *note asyncio: b. REPL no longer prints copyright
     and version messages in the quiet mode (*note -q: 19b5.).  Patch by
     Bartosz Sławecki.

   - gh-80744(3): Fix issue where ‘pdb’ would read a ‘.pdbrc’ twice if
     launched from the home directory

   - gh-138122(4): Add blocking mode to Tachyon for accurate stack
     traces in applications with many generators or fast-changing call
     stacks.  Patch by Pablo Galindo.

   - gh-143010(5): Fixed a bug in *note mailbox: 8e. 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-112127(6): Fix possible use-after-free in *note
     atexit.unregister(): 19a1. when the callback is unregistered during
     comparison.

   - gh-138122(7): Fix incomplete stack traces in the Tachyon profiler's
     frame cache when profiling code with deeply nested generators.  The
     frame cache now validates that stack traces reach the base frame
     before caching, preventing broken flamegraphs.  Patch by Pablo
     Galindo.

   - gh-142834(8): Change the *note pdb: aa. ‘commands’ command to use
     the last available breakpoint instead of failing when the most
     recently created breakpoint was deleted.

   - gh-142783(9): 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-76007(10): Deprecate ‘VERSION’ from *note xml.etree.ElementTree:
     12e. and ‘version’ from ‘xml.sax.expatreader’ and *note
     xml.sax.handler: 133.  Patch by Hugo van Kemenade.

   - gh-142784(11): 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-138122(12): Add binary output format to *note
     profiling.sampling: b6. for compact storage of profiling data.  The
     new ‘--binary’ option captures samples to a file that can be
     converted to other formats using the ‘replay’ command.  Patch by
     Pablo Galindo

   - gh-142495(13): *note collections.defaultdict: 157a. now prioritizes
     *note __setitem__(): 1685. 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-142654(14): Show the clearer error message when using
     ‘profiling.sampling’ on an unknown PID.

   - gh-142560(15): Fix use-after-free in *note bytearray: 1d1.
     search-like methods (*note find(): 175c, *note count(): 19b6, *note
     index(): 19b7, *note rindex(): 19b8, and *note rfind(): 175d.) by
     marking the storage as exported which causes reallocation attempts
     to raise *note BufferError: 19b9.  For *note contains(): cb0, *note
     split(): 19ba, and *note rsplit(): 19bb. the *note buffer protocol:
     319. is used for this.

   - gh-142419(16): *note mmap.mmap.set_name(): 248. method added to
     annotate an anonymous memory map if Linux kernel supports
     ‘PR_SET_VMA_ANON_NAME’ (Linux 5.17 or newer).  Patch by Donghee Na.

   - gh-139971(17): *note pydoc: bd.: Ensure that the link to the online
     documentation of a *note stdlib: 1c6. module is correct.

   - gh-124098(18): Fix issue where methods in handlers that lacked the
     protocol name but matched a valid base handler method (e.g.,
     ‘_open()’ or ‘error()’) were incorrectly added to *note
     urllib.request.OpenerDirector: 19bc.'s handlers.  Contributed by
     Andrea Mattei.

   - gh-136282(19): Add support for *note UNNAMED_SECTION: 19bd. when
     creating a section via the mapping protocol access

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122431

   (2) https://github.com/python/cpython/issues/143046

   (3) https://github.com/python/cpython/issues/80744

   (4) https://github.com/python/cpython/issues/138122

   (5) https://github.com/python/cpython/issues/143010

   (6) https://github.com/python/cpython/issues/112127

   (7) https://github.com/python/cpython/issues/138122

   (8) https://github.com/python/cpython/issues/142834

   (9) https://github.com/python/cpython/issues/142783

   (10) https://github.com/python/cpython/issues/76007

   (11) https://github.com/python/cpython/issues/142784

   (12) https://github.com/python/cpython/issues/138122

   (13) https://github.com/python/cpython/issues/142495

   (14) https://github.com/python/cpython/issues/142654

   (15) https://github.com/python/cpython/issues/142560

   (16) https://github.com/python/cpython/issues/142419

   (17) https://github.com/python/cpython/issues/139971

   (18) https://github.com/python/cpython/issues/124098

   (19) https://github.com/python/cpython/issues/136282


File: python.info,  Node: Core and Builtins<7>,  Prev: ライブラリ<7>,  Up: Python 3 15 0 alpha 4

1.26.7.3 Core and Builtins
..........................

   - gh-143057(1): Avoid locking in *note PyTraceMalloc_Track(): f78.
     and *note PyTraceMalloc_Untrack(): f79. when *note tracemalloc:
     108. is not enabled.

   - gh-139109(2): Add missing terminator in certain cases when tracing
     in the new JIT compiler.

   - gh-142961(3): Fix a segfault in the JIT when constant folding
     ‘len(tuple)’.

   - gh-142776(4): Fix a file descriptor leak in import.c

   - gh-139757(5): Fix building JIT stencils on free-threaded builds.

   - gh-129068(6): Make concurrent iteration over the same range
     iterator thread-safe in the free threading build.

   - gh-142543(7): Fix a stack overflow on Clang JIT build
     configurations with full LTO.

   - gh-142448(8): Fix a bug when using monitoring with the JIT.

   - gh-142766(9): Clear the frame of a generator when *note
     generator.close(): 19bf. is called.

   - gh-134584(10): Eliminate redundant refcounting from
     ‘_LOAD_ATTR_INSTANCE_VALUE’.

   - gh-134584(11): Eliminate redundant refcounting from
     ‘_STORE_ATTR_WITH_HINT’.

   - gh-142476(12): Fix a memory leak in the experimental Tier 2
     optimizer when creating executors.  Patched by Shamil Abdulaev.

   - gh-100964(13): Fix reference cycle in exhausted generator frames.
     Patch by Savannah Ostrowski.

   - gh-139922(14): Allow building CPython with the tail calling
     interpreter on Visual Studio 2026 MSVC. This provides a performance
     gain over the prior interpreter for MSVC. Patch by Ken Jin, Brandt
     Bucher, and Chris Eibl.  With help from the MSVC team including
     Hulon Jenkins.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/143057

   (2) https://github.com/python/cpython/issues/139109

   (3) https://github.com/python/cpython/issues/142961

   (4) https://github.com/python/cpython/issues/142776

   (5) https://github.com/python/cpython/issues/139757

   (6) https://github.com/python/cpython/issues/129068

   (7) https://github.com/python/cpython/issues/142543

   (8) https://github.com/python/cpython/issues/142448

   (9) https://github.com/python/cpython/issues/142766

   (10) https://github.com/python/cpython/issues/134584

   (11) https://github.com/python/cpython/issues/134584

   (12) https://github.com/python/cpython/issues/142476

   (13) https://github.com/python/cpython/issues/100964

   (14) https://github.com/python/cpython/issues/139922


File: python.info,  Node: Python 3 15 0 alpha 3,  Next: Python 3 15 0 alpha 2,  Prev: Python 3 15 0 alpha 4,  Up: 変更履歴

1.26.8 Python 3.15.0 alpha 3
----------------------------

'Release date: 2025-12-16'

* Menu:

* Tools/Demos: Tools/Demos<3>.
* テスト: テスト<8>.
* セキュリティ: セキュリティ<6>.
* ライブラリ: ライブラリ<8>.
* ドキュメント: ドキュメント<6>.
* Core and Builtins: Core and Builtins<8>.
* C API: C API<7>.
* ビルド: ビルド<6>.


File: python.info,  Node: Tools/Demos<3>,  Next: テスト<8>,  Up: Python 3 15 0 alpha 3

1.26.8.1 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.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141692


File: python.info,  Node: テスト<8>,  Next: セキュリティ<6>,  Prev: Tools/Demos<3>,  Up: Python 3 15 0 alpha 3

1.26.8.2 テスト
...............

   - gh-140381(1): Fix flaky test_profiling tests on i686 and s390x
     architectures by increasing slow_fibonacci call frequency from
     every 5th iteration to every 2nd iteration.

   - gh-140210(2): Make
     ‘test_sysconfig.test_parse_makefile_renamed_vars’ less fragile by
     clearing the environment variables before parsing the Makefile.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140381

   (2) https://github.com/python/cpython/issues/140210


File: python.info,  Node: セキュリティ<6>,  Next: ライブラリ<8>,  Prev: テスト<8>,  Up: Python 3 15 0 alpha 3

1.26.8.3 セキュリティ
.....................

   - gh-142145(1): Remove quadratic behavior in ‘xml.minidom’ node ID
     cache clearing.

   - gh-42400(2): Fix buffer overflow in ‘_Py_wrealpath()’ for paths
     exceeding ‘MAXPATHLEN’ bytes by using dynamic memory allocation
     instead of fixed-size buffer.  Patch by Shamil Abdulaev.

   - gh-119451(3): Fix a potential memory denial of service in the *note
     http.client: 72. 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: 191d,
     swapping, out of memory (OOM) killed processes or containers, or
     even system crashes.

   - gh-119342(4): 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: 191d, 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/42400

   (3) https://github.com/python/cpython/issues/119451

   (4) https://github.com/python/cpython/issues/119342


File: python.info,  Node: ライブラリ<8>,  Next: ドキュメント<6>,  Prev: セキュリティ<6>,  Up: Python 3 15 0 alpha 3

1.26.8.4 ライブラリ
...................

   - gh-142754(1): Add the 'ownerDocument' attribute to *note
     xml.dom.minidom: 12b. 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(): 19c5. should be used instead.

   - gh-142594(2): Fix crash in ‘TextIOWrapper.close()’ when the
     underlying buffer's ‘closed’ property calls *note detach(): 19c6.

   - gh-76007(3): Deprecate ‘__version__’ from *note ctypes: 2d.  Patch
     by Hugo van Kemenade.

   - gh-76007(4): Deprecate ‘__version__’ from *note
     wsgiref.simple_server: 124.  Patch by Hugo van Kemenade.

   - gh-142651(5): *note unittest.mock: 110.: fix a thread safety issue
     where *note Mock.call_count: 19c7. may return inaccurate values
     when the mock is called concurrently from multiple threads.

   - gh-76007(6): Deprecate ‘__version__’ from *note http.server: 75.
     Patch by Hugo van Kemenade.

   - gh-138122(7): Add ‘--subprocesses’ flag to *note
     profiling.sampling: b6. CLI to automatically profile subprocesses
     spawned by the target.  When enabled, the profiler monitors for new
     Python subprocesses and profiles each one separately, writing
     results to individual output files.  This is useful for profiling
     applications that use *note multiprocessing: 98, *note
     ProcessPoolExecutor: 211, or other subprocess-based parallelism.
     Patch by Pablo Galindo.

   - gh-142595(8): Added type check during initialization of the *note
     decimal: 39. module to prevent a crash in case of broken stdlib.
     Patch by Sergey B Kirpichev.

   - gh-142556(9): Fix crash when a task gets re-registered during
     finalization in *note asyncio: b.  Patch by Kumar Aditya.

   - gh-138122(10): Add ‘--mode=exception’ to the sampling profiler to
     capture samples only from threads with an active exception, useful
     for analyzing exception handling overhead.  Patch by Pablo Galindo.

   - gh-142539(11): *note traceback: 107.: Fix location of carets in
     *note SyntaxError: 189.s when the source contains wide characters.

   - gh-123241(12): Avoid reference count operations in garbage
     collection of *note ctypes: 2d. objects.

   - gh-142451(13): *note hmac: 6d.: correctly copy *note HMAC: f01.
     attributes for objects copied through *note HMAC.copy(): 19c8.
     Patch by Bénédikt Tran.

   - gh-138122(14): The ‘profiling.sampling’ flamegraph profiler now
     supports inverted flamegraph view that aggregates all leaf nodes.
     In a standard flamegraph, if a hot function is called from multiple
     locations, it appears multiple times as separate leaf nodes.  In
     the inverted flamegraph, all occurrences of the same leaf function
     are merged into a single aggregated node at the root, showing the
     total hotness of that function in one place.  The children of each
     aggregated node represent its callers, making it easier to identify
     which functions consume the most CPU time and where they are called
     from.

   - gh-112527(15): The help text for required options in *note
     argparse: 7. no longer extended with " (default: None)".

   - gh-142438(16): Fixed a possible leaked GIL in
     _PySSL_keylog_callback.

   - gh-138122(17): Add bytecode-level instruction profiling to the
     sampling profiler via the new ‘--opcodes’ flag.  When enabled, the
     profiler captures which bytecode opcode is executing at each
     sample, including Python 3.11+ adaptive specializations, and
     visualizes this data in the heatmap, flamegraph, gecko, and live
     output formats.  Patch by Pablo Galindo

   - gh-142389(18): Add backtick markup support in *note argparse: 7.
     description and epilog text to highlight inline code when color
     output is enabled.

   - gh-142346(19): 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-142374(20): Fix cumulative percentage calculation for recursive
     functions in the new sampling profiler.  When profiling recursive
     functions, cumulative statistics (cumul%, cumtime) could exceed
     100% because each recursive frame in a stack was counted
     separately.  For example, a function recursing 500 times in every
     sample would show 50000% cumulative presence.  The fix deduplicates
     locations within each sample so cumulative stats correctly
     represent "percentage of samples where this function was on the
     stack".  Patch by Pablo Galindo.

   - gh-142315(21): Pdb can now run scripts from anonymous pipes used in
     process substitution.  Patch by Bartosz Sławecki.

   - gh-64532(22): Subparser help now includes required optional
     arguments from the parent parser in the usage, making it clearer
     what arguments are needed to run a subcommand.  Patch by Savannah
     Ostrowski.

   - gh-142207(23): Fix: profiling.sampling may cause assertion
     ‘!(has_gil && gil_requested)’

   - gh-142332(24): Fix usage formatting for positional arguments in
     mutually exclusive groups in *note argparse: 7.  in ‘argparse’.

   - gh-142282(25): Fix *note winreg.QueryValueEx(): 19c9. to not
     accidentally read garbage buffer under race condition.

   - gh-142318(26): Fix typing ‘'q'’ at the help of the interactive
     tachyon profiler exiting the profiler.

   - gh-75949(27): Fix *note argparse: 7. to preserve ‘|’ separators in
     mutually exclusive groups when the usage line wraps due to length.

   - gh-142267(28): Improve *note argparse: 7. performance by caching
     the formatter used for argument validation.

   - gh-139862(29): Remove ‘color’ parameter from
     ‘argparse.HelpFormatter’ constructor.  Color is controlled by *note
     ArgumentParser: 1e7.

   - gh-68552(30): ‘MisplacedEnvelopeHeaderDefect’ and ‘Missing header
     name’ defects are now correctly passed to the ‘handle_defect’
     method of ‘policy’ in *note FeedParser: 19ca.

   - gh-142206(31): The resource tracker in the *note multiprocessing:
     98. module can now understand messages from older versions of
     itself.  This avoids issues with upgrading Python while it is
     running.  (Note that such 'in-place' upgrades are not tested.)

   - gh-142214(32): Fix two regressions in *note dataclasses: 32. 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.

   - gh-142203(33): Remove the 'debug_override' parameter from *note
     importlib.util.cache_from_source(): 338. which has been deprecated
     since Python 3.5.

   - gh-138122(34): The ‘_remote_debugging’ module now implements frame
     caching in the ‘RemoteUnwinder’ class to reduce memory reads when
     profiling remote processes.  When ‘cache_frames=True’, unchanged
     portions of the call stack are reused from previous samples,
     significantly improving profiling performance for deep call stacks.

   - gh-116738(35): Fix *note cmath: 19. data race when initializing
     trigonometric tables with subinterpreters.

   - gh-141982(36): Allow *note pdb: aa. to set breakpoints on async
     functions with function names.

   - gh-74389(37): When the stdin being used by a *note
     subprocess.Popen: 6c5. instance is closed, this is now ignored in
     *note subprocess.Popen.communicate(): 19cb. instead of leaving the
     class in an inconsistent state.

   - gh-87512(38): Fix *note subprocess.Popen.communicate(): 19cb.
     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-141939(39): Add color to all interpolated values in *note
     argparse: 7. help, like ‘%(default)s’ or ‘%(choices)s’.  Patch by
     Alex Prengère.

   - gh-141473(40): When *note subprocess.Popen.communicate(): 19cb. was
     called with 'input' and a 'timeout' and is called for a second time
     after a *note TimeoutExpired: 19cc. exception before the process
     has died, it should no longer hang.

   - gh-141999(41): Correctly allow *note KeyboardInterrupt: d9a. to
     stop the process when using ‘profiling.sampling’.

   - gh-142006(42): Fix a bug in the *note email.policy.default: 1476.
     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-141968(43): Remove data copy from *note re: c1. compilation of
     regexes with large charsets by using *note bytearray.take_bytes():
     1d0.

   - gh-141968(44): Remove data copy from *note encodings.idna: 55.
     *note encode(): 19cd. and *note encode(): 19ce. by using *note
     bytearray.take_bytes(): 1d0.

   - gh-141968(45): Remove data copy from *note codecs: 1c. ‘punycode’
     encoding by using *note bytearray.take_bytes(): 1d0.

   - gh-141968(46): Remove data copy from *note
     wave.Wave_read.readframes(): 19cf. and *note
     wave.Wave_write.writeframes(): 139b. by using *note
     bytearray.take_bytes(): 1d0.

   - gh-141968(47): Remove a data copy from *note base64.b32decode():
     1f3. and *note base64.b32encode(): 1f2. by using *note
     bytearray.take_bytes(): 1d0.

   - gh-59000(48): Fix *note pdb: aa. breakpoint resolution for class
     methods when the module defining the class is not imported.

   - gh-116738(49): Fix thread safety issue with *note re: c1. scanner
     objects in free-threaded builds.

   - gh-138122(50): The ‘profiling.sampling’ flamegraph profiler now
     displays thread status statistics showing the percentage of time
     threads spend holding the GIL, running without the GIL, waiting for
     the GIL, and performing garbage collection.  These statistics help
     identify GIL contention and thread behavior patterns.  When
     filtering by thread, the display shows per-thread metrics.

   - gh-141781(51): Fixed an issue where pdb.line_prefix assignment was
     ignored if assigned after the module was imported.

   - gh-141863(52): Update *note ストリーム: 19d0. to use *note
     bytearray.take_bytes(): 1d0. for a over 10% performance improvement
     on pyperformance asyncio_tcp benchmark.

   - gh-141817(53): Add ‘socket.IPV6_HDRINCL’ constant.

   - gh-105836(54): Fix *note asyncio.run_coroutine_threadsafe(): c5c.
     leaving underlying cancelled asyncio task running.

   - gh-141570(55): Support *note file-like object: 19d1. raising *note
     OSError: 543. from *note fileno(): 19d2. in color detection
     (‘_colorize.can_colorize()’).  This can occur when ‘sys.stdout’ is
     redirected.

   - gh-141679(56): Add colour to defaults in *note argparse: 7. help.
     Patch by Hugo van Kemenade.

   - gh-141686(57): Break reference cycles created by each call to *note
     json.dump(): 10ff. or *note json.JSONEncoder.iterencode(): 19d3.

   - gh-141659(58): Fix bad file descriptor errors from
     ‘_posixsubprocess’ on AIX.

   - gh-141645(59): Add a new ‘--live’ mode to the tachyon profiler in
     ‘profiling.sampling’ module.  This mode consist of a live TUI that
     displays real-time profiling statistics as the target application
     runs, similar to ‘top’.  Patch by Pablo Galindo

   - gh-141615(60): Check ‘stdin’ instead of ‘stdout’ for ‘use_rawinput’
     in *note pdb: aa.

   - gh-69113(61): Fix *note doctest: 3d. to correctly report line
     numbers for doctests in ‘__test__’ dictionary when formatted as
     triple-quoted strings by finding unique lines in the string and
     matching them in the source file.

   - gh-141600(62): Fix musl version detection on Void Linux.

   - gh-48752(63): Add *note readline.get_pre_input_hook(): 19d4.
     function to retrieve the current pre-input hook.  This allows
     applications to save and restore the hook without overwriting user
     settings.  Patch by Sanyam Khurana.

   - gh-141565(64): Add async-aware profiling to the Tachyon sampling
     profiler.  The profiler now reconstructs and displays async task
     hierarchies in flamegraphs, making the output more actionable for
     users.  Patch by Savannah Ostrowski and Pablo Galindo Salgado.

   - gh-60107(65): Remove a copy from *note io.RawIOBase.read(): 11d4.
     If the underlying I/O class keeps a reference to the mutable
     memory, raise a *note BufferError: 19b9.

   - gh-116738(66): Make csv module thread-safe on the *note free
     threaded: 48e. build.

   - gh-140911(67): *note collections: 1e.: Ensure that the methods
     ‘UserString.rindex()’ and ‘UserString.index()’ accept *note
     collections.UserString: 1190. instances as the sub argument.

   - gh-140875(68): Fix handling of unclosed character references (named
     and numerical) followed by the end of file in *note
     html.parser.HTMLParser: c51. with ‘convert_charrefs=False’.

   - gh-140677(69): Add heatmap visualization mode to the Tachyon
     sampling profiler.  The new ‘--heatmap’ output format provides a
     line-by-line view showing execution intensity with color-coded
     samples, inline statistics, and interactive call graph navigation
     between callers and callees.

   - gh-139946(70): Distinguish stdout and stderr when colorizing output
     in argparse module.

   - gh-76007(71): *note pydoc: bd.: Fix *note DeprecationWarning: 2d4.
     being raised when generating doc for *note stdlib: 1c6. modules.

   - gh-138697(72): Fix inferring 'dest' from a single-dash long option
     in *note argparse: 7.  If a short option and a single-dash long
     option are passed to ‘add_argument()’, 'dest' is now inferred from
     the single-dash long option.

   - gh-138525(73): Add support for single-dash long options and
     alternate prefix characters in *note
     argparse.BooleanOptionalAction: 1e6.

   - gh-79986(74): Add parsing for ‘References’ and ‘In-Reply-To’
     headers to the *note email: 3e. library that parses the header
     content as lists of message id tokens.  This prevents them from
     being folded incorrectly.

   - gh-135559(75): Flag: a ‘dir()’ on a ‘Flag’ enumeration now shows
     non-canonical members.  (i.e.  aliases).

   - gh-134453(76): Fixed *note subprocess.Popen.communicate(): 19cb.
     ‘input=’ handling of *note memoryview: 1dd. 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-127930(77): Add ‘__all__’ to *note tkinter.simpledialog: 101.

   - gh-115952(78): Fix a potential memory denial of service in the
     *note pickle: ab. module.  When reading a pickled data received
     from untrusted source, it could cause an arbitrary amount of memory
     to be allocated, even if the code that is allowed to execute is
     restricted by overriding the *note find_class(): 19d5. method.
     This could have led to symptoms including a *note MemoryError:
     191d, swapping, out of memory (OOM) killed processes or containers,
     or even system crashes.

   - bpo-40350(79): Fix support for namespace packages in *note
     modulefinder: 95.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142754

   (2) https://github.com/python/cpython/issues/142594

   (3) https://github.com/python/cpython/issues/76007

   (4) https://github.com/python/cpython/issues/76007

   (5) https://github.com/python/cpython/issues/142651

   (6) https://github.com/python/cpython/issues/76007

   (7) https://github.com/python/cpython/issues/138122

   (8) https://github.com/python/cpython/issues/142595

   (9) https://github.com/python/cpython/issues/142556

   (10) https://github.com/python/cpython/issues/138122

   (11) https://github.com/python/cpython/issues/142539

   (12) https://github.com/python/cpython/issues/123241

   (13) https://github.com/python/cpython/issues/142451

   (14) https://github.com/python/cpython/issues/138122

   (15) https://github.com/python/cpython/issues/112527

   (16) https://github.com/python/cpython/issues/142438

   (17) https://github.com/python/cpython/issues/138122

   (18) https://github.com/python/cpython/issues/142389

   (19) https://github.com/python/cpython/issues/142346

   (20) https://github.com/python/cpython/issues/142374

   (21) https://github.com/python/cpython/issues/142315

   (22) https://github.com/python/cpython/issues/64532

   (23) https://github.com/python/cpython/issues/142207

   (24) https://github.com/python/cpython/issues/142332

   (25) https://github.com/python/cpython/issues/142282

   (26) https://github.com/python/cpython/issues/142318

   (27) https://github.com/python/cpython/issues/75949

   (28) https://github.com/python/cpython/issues/142267

   (29) https://github.com/python/cpython/issues/139862

   (30) https://github.com/python/cpython/issues/68552

   (31) https://github.com/python/cpython/issues/142206

   (32) https://github.com/python/cpython/issues/142214

   (33) https://github.com/python/cpython/issues/142203

   (34) https://github.com/python/cpython/issues/138122

   (35) https://github.com/python/cpython/issues/116738

   (36) https://github.com/python/cpython/issues/141982

   (37) https://github.com/python/cpython/issues/74389

   (38) https://github.com/python/cpython/issues/87512

   (39) https://github.com/python/cpython/issues/141939

   (40) https://github.com/python/cpython/issues/141473

   (41) https://github.com/python/cpython/issues/141999

   (42) https://github.com/python/cpython/issues/142006

   (43) https://github.com/python/cpython/issues/141968

   (44) https://github.com/python/cpython/issues/141968

   (45) https://github.com/python/cpython/issues/141968

   (46) https://github.com/python/cpython/issues/141968

   (47) https://github.com/python/cpython/issues/141968

   (48) https://github.com/python/cpython/issues/59000

   (49) https://github.com/python/cpython/issues/116738

   (50) https://github.com/python/cpython/issues/138122

   (51) https://github.com/python/cpython/issues/141781

   (52) https://github.com/python/cpython/issues/141863

   (53) https://github.com/python/cpython/issues/141817

   (54) https://github.com/python/cpython/issues/105836

   (55) https://github.com/python/cpython/issues/141570

   (56) https://github.com/python/cpython/issues/141679

   (57) https://github.com/python/cpython/issues/141686

   (58) https://github.com/python/cpython/issues/141659

   (59) https://github.com/python/cpython/issues/141645

   (60) https://github.com/python/cpython/issues/141615

   (61) https://github.com/python/cpython/issues/69113

   (62) https://github.com/python/cpython/issues/141600

   (63) https://github.com/python/cpython/issues/48752

   (64) https://github.com/python/cpython/issues/141565

   (65) https://github.com/python/cpython/issues/60107

   (66) https://github.com/python/cpython/issues/116738

   (67) https://github.com/python/cpython/issues/140911

   (68) https://github.com/python/cpython/issues/140875

   (69) https://github.com/python/cpython/issues/140677

   (70) https://github.com/python/cpython/issues/139946

   (71) https://github.com/python/cpython/issues/76007

   (72) https://github.com/python/cpython/issues/138697

   (73) https://github.com/python/cpython/issues/138525

   (74) https://github.com/python/cpython/issues/79986

   (75) https://github.com/python/cpython/issues/135559

   (76) https://github.com/python/cpython/issues/134453

   (77) https://github.com/python/cpython/issues/127930

   (78) https://github.com/python/cpython/issues/115952

   (79) https://bugs.python.org/issue?@action=redirect&bpo=40350


File: python.info,  Node: ドキュメント<6>,  Next: Core and Builtins<8>,  Prev: ライブラリ<8>,  Up: Python 3 15 0 alpha 3

1.26.8.5 ドキュメント
.....................

   - gh-141994(1): *note xml.sax.handler: 133.: Make Documentation of
     *note xml.sax.handler.feature_external_ges: 19d7. warn of opening
     up to external entity attacks(2).  Patch by Sebastian Pipping.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141994

   (2) https://en.wikipedia.org/wiki/XML_external_entity_attack


File: python.info,  Node: Core and Builtins<8>,  Next: C API<7>,  Prev: ドキュメント<6>,  Up: Python 3 15 0 alpha 3

1.26.8.6 Core and Builtins
..........................

   - gh-134584(1): Eliminate redundant refcounting from
     ‘_STORE_ATTR_INSTANCE_VALUE’.

   - gh-142718(2): JIT: Fix segfault caused by not flushing the stack to
     memory at side exits.

   - gh-142737(3): Tracebacks will be displayed in fallback mode even if
     *note io.open(): 930. is lost.  Previously, this would crash the
     interpreter.  Patch by Bartosz Sławecki.

   - gh-116738(4): Make the attributes in *note bz2: 14. thread-safe on
     the *note free threaded: 48e. build.

   - gh-134584(5): Eliminate redundant refcounting from
     ‘_CALL_LIST_APPEND’.

   - gh-142554(6): Fix a crash in *note divmod(): d6e. when
     ‘_pylong.int_divmod()’ does not return a tuple of length two
     exactly.  Patch by Bénédikt Tran.

   - gh-142531(7): 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(8): Fix reference counting when adjacent literal parts
     are merged while constructing *note string.templatelib.Template:
     41c, preventing the displaced string object from leaking.

   - gh-116738(9): Make the attributes in *note zlib: 13c. thread-safe
     on the *note free threaded: 48e. build.

   - gh-142343(10): Fix SIGILL crash on m68k due to incorrect assembly
     constraint.

   - gh-142236(11): Improve the "Perhaps you forgot a comma?"  syntax
     error for multi-line string concatenations to point to the last
     string instead of the first, making it easier to locate where the
     comma is missing.  Patch by Pablo Galindo.

   - gh-142236(12): Fix incorrect keyword suggestions for syntax errors
     in *note traceback: 107.  The keyword typo suggestion mechanism
     would incorrectly suggest replacements when the extracted source
     code was incomplete rather than containing an actual typo.  Patch
     by Pablo Galindo.

   - gh-142305(13): Decrease the size of the generated stencils and the
     runtime JIT code.  Patch by Diego Russo.

   - gh-135379(14): Implement a limited form of register allocation
     known as "top of stack caching" in the JIT. It works by keeping 0-3
     of the top items in the stack in registers.  The code generator
     generates multiple versions of those uops that do not escape and
     are relatively small.  During JIT compilation, the copy that
     produces the least memory traffic is selected, spilling or
     reloading values when needed.

   - gh-142276(15): Fix missing type watcher when promoting attribute
     loads to constants in the JIT. Patch by Ken Jin.  Reproducer by
     Yuancheng Jiang.

   - gh-142218(16): Fix crash when inserting into a split table
     dictionary with a non *note str: 1ea. key that matches an existing
     key.

   - gh-141976(17): Check against abstract stack overflow in the JIT
     optimizer.

   - gh-97850(18): Remove all ‘*.load_module()’ usage and definitions
     from the import system and importlib.  The method has been
     deprecated in favor of ‘importlib.abc.Loader.exec_module()’ since
     Python 3.4.

   - gh-142048(19): Fix quadratically increasing garbage collection
     delays in free-threaded build.

   - gh-65961(20): Stop setting ‘__cached__’ on modules.

   - gh-141770(21): Annotate anonymous mmap usage only when supported by
     the Linux kernel and if ‘-X dev’ is used or Python is built in
     debug mode.  Patch by Donghee Na.

   - gh-142029(22): Raise *note ModuleNotFoundError: 1c9. instead of
     crashing when a nonexistent module is used as a name in
     ‘_imp.create_builtin()’.

   - gh-142029(23): Raise *note ValueError: 15a. instead of crashing
     when empty string is used as a name in ‘_imp.create_builtin()’.

   - gh-141976(24): Protect against specialization failures in the
     tracing JIT compiler for performance reasons.

   - gh-141861(25): Fix invalid memory read in the ‘ENTER_EXECUTOR’
     instruction.

   - gh-141930(26): 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-138122(27): Add incomplete sample detection to prevent corrupted
     profiling data.  Each thread state now contains an embedded base
     frame (sentinel at the bottom of the frame stack) with owner type
     ‘FRAME_OWNED_BY_INTERPRETER’.  The profiler validates that stack
     unwinding terminates at this sentinel frame.  Samples that fail to
     reach the base frame (due to race conditions, memory corruption, or
     other errors) are now rejected rather than being included as
     spurious data.

   - gh-120158(28): Fix inconsistent state when enabling or disabling
     monitoring events too many times.

   - gh-140638(29): Expose a ‘"candidates"’ stat in *note
     gc.get_stats(): 55e. and *note gc.callbacks: 1488.

   - gh-141780(30): Fix *note Py_mod_gil: 697. with API added in PEP
     793(31): ‘PyModule_FromSlotsAndSpec()’ and ‘PyModExport’ hooks

   - gh-141732(32): Ensure the *note __repr__(): 1c7. for *note
     ExceptionGroup: 6de. and *note BaseExceptionGroup: 76d. does not
     change when the exception sequence that was original passed in to
     its constructor is subsequently mutated.

   - gh-140638(33): Expose a ‘"duration"’ stat in *note gc.get_stats():
     55e. and *note gc.callbacks: 1488.

   - gh-139653(34): 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-41779(35): Allowed defining the '__dict__' and '__weakref__'
     *note __slots__: 1d8. for any class.

   - gh-139103(36): Improve multithreaded scaling of dataclasses on the
     free-threaded build.

   - gh-141589(37): Change ‘backoff counter’ to use prime numbers
     instead of powers of 2.  Use only 3 bits for ‘counter’ and 13 bits
     for ‘value’.  This allows to support values up to 8191.  Patch by
     Mikhail Efimov.

   - gh-137007(38): Fix a bug during JIT compilation failure which
     caused garbage collection debug assertions to fail.

   - gh-132657(39): For the free-threaded build, avoid locking the *note
     set: 432. object for the ‘__contains__’ method.

   - gh-134584(40): Eliminate redundant refcounting from ‘_CALL_STR_1’.

   - gh-134584(41): Eliminate redundant refcounting from
     ‘_CALL_BUILTIN_O’.

   - gh-134584(42): Eliminate redundant refcounting from
     ‘_CALL_TUPLE_1’.  Patch by Noam Cohen

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134584

   (2) https://github.com/python/cpython/issues/142718

   (3) https://github.com/python/cpython/issues/142737

   (4) https://github.com/python/cpython/issues/116738

   (5) https://github.com/python/cpython/issues/134584

   (6) https://github.com/python/cpython/issues/142554

   (7) https://github.com/python/cpython/issues/142531

   (8) https://github.com/python/cpython/issues/142402

   (9) https://github.com/python/cpython/issues/116738

   (10) https://github.com/python/cpython/issues/142343

   (11) https://github.com/python/cpython/issues/142236

   (12) https://github.com/python/cpython/issues/142236

   (13) https://github.com/python/cpython/issues/142305

   (14) https://github.com/python/cpython/issues/135379

   (15) https://github.com/python/cpython/issues/142276

   (16) https://github.com/python/cpython/issues/142218

   (17) https://github.com/python/cpython/issues/141976

   (18) https://github.com/python/cpython/issues/97850

   (19) https://github.com/python/cpython/issues/142048

   (20) https://github.com/python/cpython/issues/65961

   (21) https://github.com/python/cpython/issues/141770

   (22) https://github.com/python/cpython/issues/142029

   (23) https://github.com/python/cpython/issues/142029

   (24) https://github.com/python/cpython/issues/141976

   (25) https://github.com/python/cpython/issues/141861

   (26) https://github.com/python/cpython/issues/141930

   (27) https://github.com/python/cpython/issues/138122

   (28) https://github.com/python/cpython/issues/120158

   (29) https://github.com/python/cpython/issues/140638

   (30) https://github.com/python/cpython/issues/141780

   (31) https://peps.python.org/pep-0793/

   (32) https://github.com/python/cpython/issues/141732

   (33) https://github.com/python/cpython/issues/140638

   (34) https://github.com/python/cpython/issues/139653

   (35) https://github.com/python/cpython/issues/41779

   (36) https://github.com/python/cpython/issues/139103

   (37) https://github.com/python/cpython/issues/141589

   (38) https://github.com/python/cpython/issues/137007

   (39) https://github.com/python/cpython/issues/132657

   (40) https://github.com/python/cpython/issues/134584

   (41) https://github.com/python/cpython/issues/134584

   (42) https://github.com/python/cpython/issues/134584


File: python.info,  Node: C API<7>,  Next: ビルド<6>,  Prev: Core and Builtins<8>,  Up: Python 3 15 0 alpha 3

1.26.8.7 C API
..............

   - gh-142589(1): Fix *note
     PyUnstable_Object_IsUniqueReferencedTemporary(): 5fa. handling of
     tagged ints on the interpreter stack.

   - gh-142571(2): ‘PyUnstable_CopyPerfMapFile()’ now checks that
     opening the file succeeded before flushing.

   - gh-142225(3): Fixed the *note PyABIInfo_VAR: 362. macro.

   - gh-141049(4): ‘_PyObject_CallMethodId()’, ‘_PyObject_GetAttrId()’
     and ‘_PyUnicode_FromId()’ are deprecated since 3.15 and will be
     removed in 3.20.  Instead, use *note PyUnicode_InternFromString():
     3bd. and cache the result in the module state, then call *note
     PyObject_CallMethod(): 3be. or *note PyObject_GetAttr(): 3bf.
     Patch by Victor Stinner.

   - gh-142163(5): Fix the ‘HAVE_THREAD_LOCAL’ macro being defined
     without the ‘Py_BUILD_CORE’ macro set after including ‘Python.h’.

   - gh-137422(6): Fix *note free threading: 48e. race condition in
     *note PyImport_AddModuleRef(): 7f7.  It was previously possible for
     two calls to the function return two different objects, only one of
     which was stored in *note sys.modules: 19da.

   - gh-141726(7): Add *note PyDict_SetDefaultRef(): 7e1. to the Stable
     ABI.

   - gh-140042(8): Removed the sqlite3_shutdown call that could cause
     closing connections for sqlite when used with multiple sub
     interpreters.

   - gh-141070(9): Add ‘PyUnstable_Object_Dump()’ to dump an object to
     ‘stderr’.  It should only be used for debugging.  Patch by Victor
     Stinner.

   - gh-139165(10): Expose the functions *note Py_SIZE(): b66, *note
     Py_IS_TYPE(): 19db. and *note Py_SET_SIZE(): b67. in the Stable
     ABI.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142589

   (2) https://github.com/python/cpython/issues/142571

   (3) https://github.com/python/cpython/issues/142225

   (4) https://github.com/python/cpython/issues/141049

   (5) https://github.com/python/cpython/issues/142163

   (6) https://github.com/python/cpython/issues/137422

   (7) https://github.com/python/cpython/issues/141726

   (8) https://github.com/python/cpython/issues/140042

   (9) https://github.com/python/cpython/issues/141070

   (10) https://github.com/python/cpython/issues/139165


File: python.info,  Node: ビルド<6>,  Prev: C API<7>,  Up: Python 3 15 0 alpha 3

1.26.8.8 ビルド
...............

   - gh-131372(1): Add ‘LDVERSION’ and ‘EXE’ to the ‘base_interpreter’
     value of ‘build-details.json’.

   - gh-142454(2): 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-131372(3): ‘build-details.py’ will only be installed as part of
     the main install (‘make install’).  ‘make altinstall’ will no
     longer include it.

   - gh-142234(4): Allow ‘--enable-wasm-dynamic-linking’ for WASI. While
     CPython doesn't directly support it so external/downstream users do
     not have to patch in support for the flag.

   - gh-142050(5): Fixed a bug where JIT stencils produced on Windows
     contained debug data.  Patch by Chris Eibl.

   - gh-141808(6): Do not generate the jit stencils twice in case of PGO
     builds on Windows.

   - gh-141926(7): ‘RUNSHARED’ is no longer cleared when
     cross-compiling.  Previously, ‘RUNSHARED’ was cleared when
     cross-compiling, which breaks PGO when using ‘--enabled-shared’ on
     systems where the cross-compiled CPython is otherwise executable
     (e.g., via transparent emulation).

   - gh-141808(8): 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-141784(9): 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-141172(10): Update to WASI SDK 29.

   - gh-139707(11): Add configure option *note
     -with-missing-stdlib-config=FILE: 3de. allows which distributors to
     pass a JSON(12) configuration file containing custom error messages
     for missing *note standard library: 3df. modules.

   - gh-108819(13): Honor *note -with-platlibdir: 19dd. in the
     pure-Python standard library installation path, if ‘PLATLIBDIR’
     doesn't match the value used in ‘LIBDIR’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131372

   (2) https://github.com/python/cpython/issues/142454

   (3) https://github.com/python/cpython/issues/131372

   (4) https://github.com/python/cpython/issues/142234

   (5) https://github.com/python/cpython/issues/142050

   (6) https://github.com/python/cpython/issues/141808

   (7) https://github.com/python/cpython/issues/141926

   (8) https://github.com/python/cpython/issues/141808

   (9) https://github.com/python/cpython/issues/141784

   (10) https://github.com/python/cpython/issues/141172

   (11) https://github.com/python/cpython/issues/139707

   (12) https://www.json.org/json-en.html

   (13) https://github.com/python/cpython/issues/108819


File: python.info,  Node: Python 3 15 0 alpha 2,  Next: Python 3 15 0 alpha 1,  Prev: Python 3 15 0 alpha 3,  Up: 変更履歴

1.26.9 Python 3.15.0 alpha 2
----------------------------

'Release date: 2025-11-18'

* Menu:

* Windows: Windows<7>.
* Tools/Demos: Tools/Demos<4>.
* テスト: テスト<9>.
* セキュリティ: セキュリティ<7>.
* ライブラリ: ライブラリ<9>.
* Core and Builtins: Core and Builtins<9>.
* ライブラリ: ライブラリ<10>.
* Core and Builtins: Core and Builtins<10>.
* ライブラリ: ライブラリ<11>.
* Core and Builtins: Core and Builtins<11>.
* ライブラリ: ライブラリ<12>.
* Core and Builtins: Core and Builtins<12>.
* ライブラリ: ライブラリ<13>.
* Core and Builtins: Core and Builtins<13>.
* ライブラリ: ライブラリ<14>.
* Core and Builtins: Core and Builtins<14>.
* C API: C API<8>.
* ビルド: ビルド<7>.


File: python.info,  Node: Windows<7>,  Next: Tools/Demos<4>,  Up: Python 3 15 0 alpha 2

1.26.9.1 Windows
................

   - gh-140849(1): Update bundled liblzma to version 5.8.1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140849


File: python.info,  Node: Tools/Demos<4>,  Next: テスト<9>,  Prev: Windows<7>,  Up: Python 3 15 0 alpha 2

1.26.9.2 Tools/Demos
....................

   - gh-141442(1): The iOS testbed now correctly handles test arguments
     that contain spaces.

   - gh-140702(2): The iOS testbed app will now expose the
     ‘GITHUB_ACTIONS’ environment variable to iOS apps being tested.

   - gh-139198(3): Remove ‘Tools/scripts/checkpip.py’ script.

   - gh-139188(4): Remove ‘Tools/tz/zdump.py’ script.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141442

   (2) https://github.com/python/cpython/issues/140702

   (3) https://github.com/python/cpython/issues/139198

   (4) https://github.com/python/cpython/issues/139188


File: python.info,  Node: テスト<9>,  Next: セキュリティ<7>,  Prev: Tools/Demos<4>,  Up: Python 3 15 0 alpha 2

1.26.9.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: 10f. which is
     run by it with redirected output will output in color.

   - gh-136442(3): Use exitcode ‘1’ instead of ‘5’ if *note
     unittest.TestCase.setUpClass(): e16. 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/136442


File: python.info,  Node: セキュリティ<7>,  Next: ライブラリ<9>,  Prev: テスト<9>,  Up: Python 3 15 0 alpha 2

1.26.9.4 セキュリティ
.....................

   - gh-137836(1): Add support of the "plaintext" element, RAWTEXT
     elements "xmp", "iframe", "noembed" and "noframes", and optionally
     RAWTEXT element "noscript" in *note html.parser.HTMLParser: c51.

   - gh-136063(2): *note email.message: 47.: ensure linear complexity
     for legacy HTTP parameters parsing.  Patch by Bénédikt Tran.

   - gh-136065(3): Fix quadratic complexity in *note
     os.path.expandvars(): 1792.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137836

   (2) https://github.com/python/cpython/issues/136063

   (3) https://github.com/python/cpython/issues/136065


File: python.info,  Node: ライブラリ<9>,  Next: Core and Builtins<9>,  Prev: セキュリティ<7>,  Up: Python 3 15 0 alpha 2

1.26.9.5 ライブラリ
...................

   - gh-141497(1): *note ipaddress: 83.: ensure that the methods *note
     IPv4Network.hosts(): 19e4. and *note IPv6Network.hosts(): 19e5.
     always return an iterator.

   - gh-140938(2): The *note statistics.stdev(): ac6. and *note
     statistics.pstdev(): 19e6. functions now raise a *note ValueError:
     15a. when the input contains an infinity or a NaN.

   - gh-124111(3): Updated Tcl threading configuration in *note
     _tkinter: 3. to assume that threads are always available in Tcl 9
     and later.

   - gh-137109(4): The *note os.fork: 6c3. 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(): 33a.
     ‘after_in_parent=’ callback (re)starts a thread.

   - gh-141314(5): Fix assertion failure in *note
     io.TextIOWrapper.tell(): 19e7. when reading files with standalone
     carriage return (‘\r’) line endings.

   - gh-141311(6): Fix assertion failure in ‘io.BytesIO.readinto()’ and
     undefined behavior arising when read position is above capcity in
     *note io.BytesIO: 1258.

   - gh-87710(7): *note mimetypes: 93.: Update mime type for ‘.ai’ files
     to ‘application/pdf’.

   - gh-85524(8): Update ‘io.FileIO.readall’, an implementation of *note
     io.RawIOBase.readall(): 19e8, to follow *note io.IOBase: 710.
     guidelines and raise *note io.UnsupportedOperation: 19e9. when a
     file is in "w" mode rather than *note OSError: 543.

   - gh-141141(9): Fix a thread safety issue with *note
     base64.b85decode(): 1fd.  Contributed by Benel Tayar.

   - gh-141018(10): *note mimetypes: 93.: Update ‘.exe’, ‘.dll’, ‘.rtf’
     and (when ‘strict=False’) ‘.jpg’ to their correct IANA mime type.

   - gh-137969(11): Fix *note annotationlib.ForwardRef.evaluate(): 151.
     returning *note ForwardRef: 1988. objects which don't update with
     new globals.

   - gh-75593(12): Add support of *note path-like objects: 7a5. and
     *note bytes-like objects: 43d. in *note wave.open(): d1b.

   - gh-140797(13): 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(14): Refactor the *note pdb: aa. parsing issue so
     positional arguments can pass through intuitively.

   - gh-140815(15): *note faulthandler: 5b. now detects if a frame or a
     code object is invalid or freed.  Patch by Victor Stinner.

   - gh-100218(16): Correctly set *note errno: 19ea. when *note
     socket.if_nametoindex(): df6. or *note socket.if_indextoname():
     df7. raise an *note OSError: 543.  Patch by Bénédikt Tran.

   - gh-140734(17): *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-140873(18): Add support of non-*note descriptor: 22a. callables
     in *note functools.singledispatchmethod(): 229.

   - gh-140874(19): Bump the version of pip bundled in ensurepip to
     version 25.3

   - gh-140826(20): Now ‘winreg.HKEYType’ objects are compared by their
     underlying Windows registry handle value instead of their object
     identity.

   - gh-140808(21): The internal class ‘mailbox._ProxyFile’ is no longer
     a parameterized generic.

   - gh-140691(22): In *note urllib.request: 114, 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:
     754.

   - gh-103847(23): Fix hang when cancelling process created by *note
     asyncio.create_subprocess_exec(): e3e. or *note
     asyncio.create_subprocess_shell(): e3f.  Patch by Kumar Aditya.

   - gh-137821(24): Convert ‘_json’ module to use Argument Clinic.
     Patched by Yoonho Hann.

   - gh-140790(25): Initialize all Pdb's instance variables in
     ‘__init__’, remove some hasattr/getattr

   - gh-140766(26): Add *note enum.show_flag_values(): 19eb. and
     ‘enum.bin’ to ‘enum.__all__’.

   - gh-120057(27): Add *note os.reload_environ(): 4eb. to ‘os.__all__’.

   - gh-140741(28): Fix ‘profiling.sampling.sample()’ incorrectly
     handling a *note FileNotFoundError: 24f. or *note PermissionError:
     10fd.

   - gh-140228(29): Avoid making unnecessary filesystem calls for frozen
     modules in *note linecache: 88. when the global module cache is not
     present.

   - gh-139946(30): Error and warning keywords in
     ‘argparse.ArgumentParser’ messages are now colorized when color
     output is enabled, fixing a visual inconsistency in which they
     remained plain text while other output was colorized.

   - gh-140590(31): Fix arguments checking for the
     ‘functools.partial.__setstate__()’ that may lead to internal state
     corruption and crash.  Patch by Sergey Miryanov.

   - gh-125434(32): Display thread name in *note faulthandler: 5b. on
     Windows.  Patch by Victor Stinner.

   - gh-140634(33): Fix a reference counting bug in
     ‘os.sched_param.__reduce__()’.

   - gh-140650(34): Fix an issue where closing *note io.BufferedWriter:
     176a. could crash if the closed attribute raised an exception on
     access or could not be converted to a boolean.

   - gh-140633(35): Ignore *note AttributeError: 1b4. when setting a
     module's ‘__file__’ attribute when loading an extension module
     packaged as Apple Framework.

   - gh-140601(36): *note xml.etree.ElementTree.iterparse(): 3f2. now
     emits a *note ResourceWarning: 754. when the iterator is not
     explicitly closed and was opened with a filename.  This helps
     developers identify and fix resource leaks.  Patch by Osama
     Abdelkader.

   - gh-140593(37): *note xml.parsers.expat: 12f.: Fix a memory leak
     that could affect users with *note ElementDeclHandler(): 1943. set
     to a custom element declaration handler.  Patch by Sebastian
     Pipping.

   - gh-140607(38): Inside *note io.RawIOBase.read(): 11d4, validate
     that the count of bytes returned by *note io.RawIOBase.readinto():
     11d5. is valid (inside the provided buffer).

   - gh-138162(39): Fix *note logging.LoggerAdapter: 16af. with
     ‘merge_extra=True’ and without the 'extra' argument.

   - gh-140481(40): Improve error message when trying to iterate a Tk
     widget, image or font.

   - gh-138774(41): *note ast.unparse(): cba. now generates full source
     code when handling *note ast.Interpolation: 19ec. nodes that do not
     have a specified source.

   - gh-140474(42): Fix memory leak in *note array.array: 6cb. when
     creating arrays from an empty *note str: 1ea. and the ‘u’ type
     code.

   - gh-140448(43): Change the default of ‘suggest_on_error’ to ‘True’
     in ‘argparse.ArgumentParser’.

   - gh-137530(44): *note dataclasses: 32. 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(45): Fix regression in Python 3.14.0 where using the ‘|’
     operator on a *note typing.Union: 349. object combined with an
     object that is not a type would raise an error.

   - gh-76007(46): *note decimal: 39.: Deprecate ‘__version__’ and
     replace with *note decimal.SPEC_VERSION: 309.

   - gh-76007(47): Deprecate ‘__version__’ from *note imaplib: 77.
     Patch by Hugo van Kemenade.

   - gh-140272(48): Fix memory leak in the ‘clear()’ method of the *note
     dbm.gnu: 36. database.

   - gh-129117(49): *note unicodedata: 10e.: Add *note isxidstart():
     2a2. and *note isxidcontinue(): 2a3. functions to check whether a
     character can start or continue a Unicode Standard Annex #31(50)
     identifier.

   - gh-140251(51): Colorize the default import statement ‘import
     asyncio’ in asyncio REPL.

   - gh-140212(52): Calendar's HTML formatting now accepts year and
     month as options.  Previously, running ‘python -m calendar -t html
     2025 10’ would result in an error message.  It now generates an
     HTML document displaying the calendar for the specified month.
     Contributed by Pål Grønås Drange.

   - gh-135801(53): Improve filtering by module in *note
     warnings.warn_explicit(): 2b6. if no 'module' argument is passed.
     It now tests the module regular expression in the warnings filter
     not only against the filename with ‘.py’ stripped, but also against
     module names constructed starting from different parent directories
     of the filename (with ‘/__init__.py’, ‘.py’ and, on Windows, ‘.pyw’
     stripped).

   - gh-139707(54): Improve *note ModuleNotFoundError: 1c9. error
     message when a *note standard library: 3df. module is missing.

   - gh-140041(55): Fix import of *note ctypes: 2d. on Android and
     Cygwin when ABI flags are present.

   - gh-140120(56): Fixed a memory leak in *note hmac: 6d. when it was
     using the hacl-star backend.  Discovered by ‘@ashm-dev’ using
     AddressSanitizer.

   - gh-140141(57): The *note importlib.metadata.PackageNotFoundError:
     19ed. traceback raised when
     ‘importlib.metadata.Distribution.from_name’ cannot discover a
     distribution no longer includes a transient *note StopIteration:
     fbe. exception trace.

     Contributed by Bartosz Sławecki in gh-140142(58).

   - gh-140166(59): *note mimetypes: 93.: Per the IANA assignment(60),
     update the MIME type for the ‘.texi’ and ‘.texinfo’ file formats to
     ‘application/texinfo’, instead of ‘application/x-texinfo’.

   - gh-140135(61): Speed up *note io.RawIOBase.readall(): 19e8. by
     using PyBytesWriter API (about 4x faster)

   - gh-76007(62): *note zlib: 13c.: Deprecate ‘__version__’ and
     schedule for removal in Python 3.20.

   - gh-136702(63): *note encodings: 54.: Deprecate passing a non-ascii
     'encoding' name to *note encodings.normalize_encoding(): 31b. and
     schedule removal of support for Python 3.17.

   - gh-139940(64): Print clearer error message when using ‘pdb’ to
     attach to a non-existing process.

   - gh-139462(65): When a child process in a *note
     concurrent.futures.ProcessPoolExecutor: 211. terminates abruptly,
     the resulting traceback will now tell you the PID and exit code of
     the terminated process.  Contributed by Jonathan Berg.

   - gh-63161(66): Fix *note tokenize.detect_encoding(): 19ee.  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-101828(67): 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-139246(68): fix: paste zero-width in default repl width is
     wrong.

   - gh-83714(69): Implement *note os.statx(): 24a. on Linux kernel
     versions 4.11 and later with glibc versions 2.28 and later.
     Contributed by Jeffrey Bosboom and Victor Stinner.

   - gh-138891(70): Fix ‘SyntaxError’ when ‘inspect.get_annotations(f,
     eval_str=True)’ is called on a function annotated with a PEP
     646(71) ‘star_expression’

   - gh-138859(72): Fix generic type parameterization raising a *note
     TypeError: 29c. when omitting a ‘ParamSpec’ that has a default
     which is not a list of types.

   - gh-138764(73): Prevent *note
     annotationlib.call_annotate_function(): 19ef. 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(74): Use of ‘python -m’ with *note base64: f. has been
     fixed to detect input from a terminal so that it properly notices
     EOF.

   - gh-98896(75): Fix a failure in multiprocessing resource_tracker
     when SharedMemory names contain colons.  Patch by Rani Pinchuk.

   - gh-138425(76): Fix partial evaluation of *note
     annotationlib.ForwardRef: 1988. objects which rely on names defined
     as globals.

   - gh-138151(77): In *note annotationlib: 6, improve evaluation of
     forward references to nonlocal variables that are not yet defined
     when the annotations are initially evaluated.

   - gh-69528(78): The *note mode: 19f0. attribute of files opened in
     the ‘'wb+'’ mode is now ‘'wb+'’ instead of ‘'rb+'’.

   - gh-137627(79): Speed up *note csv.Sniffer.sniff(): 2cd. delimiter
     detection by up to 1.6x.

   - gh-55531(80): *note encodings: 54.: Improve *note
     normalize_encoding(): 31b. performance by implementing the function
     in C using the private ‘_Py_normalize_encoding’ which has been
     modified to make lowercase conversion optional.

   - gh-136057(81): 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-133390(82): Support table, index, trigger, view, column,
     function, and schema completion for *note sqlite3: d7.'s *note
     command-line interface: 263.

   - gh-135307(83): *note email: 3e.: Fix exception in ‘set_content()’
     when encoding text and max_line_length is set to ‘0’ or ‘None’
     (unlimited).

   - gh-133789(84): Fix unpickling of *note pathlib: a8. objects that
     were pickled in Python 3.13.

   - gh-133601(85): Remove deprecated
     ‘typing.no_type_check_decorator()’.

   - gh-132686(86): Add parameters 'inherit_class_doc' and
     'fallback_to_class_doc' for *note inspect.getdoc(): 237.

   - gh-131116(87): *note inspect.getdoc(): 237. now correctly returns
     an inherited docstring on *note cached_property: 953. objects if
     none is given in a subclass.

   - gh-130693(88): Add support for ‘-nolinestop’, and ‘-strictlimits’
     options to ‘tkinter.Text.search()’.  Also add the
     ‘tkinter.Text.search_all()’ method for ‘-all’ and ‘-overlap’
     options.

   - gh-122255(89): In the *note linecache: 88. module and in the Python
     implementation of the *note warnings: 11b. module, a
     ‘DeprecationWarning’ is issued when ‘mod.__loader__’ differs from
     ‘mod.__spec__.loader’ (like in the C implementation of the
     ‘warnings’ module).

   - gh-121011(90): *note math.log(): 1878. now supports arbitrary large
     integer-like arguments in the same way as arbitrary large integer
     arguments.

   - gh-119668(91): Publicly expose and document *note
     importlib.machinery.NamespacePath: 19f1.

   - gh-102431(92): Clarify constraints for "logical" arguments in
     methods of *note decimal.Context: 146d.

   - gh-81313(93): Add the *note math.integer: 92. module ( PEP
     791(94)).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141497

   (2) https://github.com/python/cpython/issues/140938

   (3) https://github.com/python/cpython/issues/124111

   (4) https://github.com/python/cpython/issues/137109

   (5) https://github.com/python/cpython/issues/141314

   (6) https://github.com/python/cpython/issues/141311

   (7) https://github.com/python/cpython/issues/87710

   (8) https://github.com/python/cpython/issues/85524

   (9) https://github.com/python/cpython/issues/141141

   (10) https://github.com/python/cpython/issues/141018

   (11) https://github.com/python/cpython/issues/137969

   (12) https://github.com/python/cpython/issues/75593

   (13) https://github.com/python/cpython/issues/140797

   (14) https://github.com/python/cpython/issues/125115

   (15) https://github.com/python/cpython/issues/140815

   (16) https://github.com/python/cpython/issues/100218

   (17) https://github.com/python/cpython/issues/140734

   (18) https://github.com/python/cpython/issues/140873

   (19) https://github.com/python/cpython/issues/140874

   (20) https://github.com/python/cpython/issues/140826

   (21) https://github.com/python/cpython/issues/140808

   (22) https://github.com/python/cpython/issues/140691

   (23) https://github.com/python/cpython/issues/103847

   (24) https://github.com/python/cpython/issues/137821

   (25) https://github.com/python/cpython/issues/140790

   (26) https://github.com/python/cpython/issues/140766

   (27) https://github.com/python/cpython/issues/120057

   (28) https://github.com/python/cpython/issues/140741

   (29) https://github.com/python/cpython/issues/140228

   (30) https://github.com/python/cpython/issues/139946

   (31) https://github.com/python/cpython/issues/140590

   (32) https://github.com/python/cpython/issues/125434

   (33) https://github.com/python/cpython/issues/140634

   (34) https://github.com/python/cpython/issues/140650

   (35) https://github.com/python/cpython/issues/140633

   (36) https://github.com/python/cpython/issues/140601

   (37) https://github.com/python/cpython/issues/140593

   (38) https://github.com/python/cpython/issues/140607

   (39) https://github.com/python/cpython/issues/138162

   (40) https://github.com/python/cpython/issues/140481

   (41) https://github.com/python/cpython/issues/138774

   (42) https://github.com/python/cpython/issues/140474

   (43) https://github.com/python/cpython/issues/140448

   (44) https://github.com/python/cpython/issues/137530

   (45) https://github.com/python/cpython/issues/140348

   (46) https://github.com/python/cpython/issues/76007

   (47) https://github.com/python/cpython/issues/76007

   (48) https://github.com/python/cpython/issues/140272

   (49) https://github.com/python/cpython/issues/129117

   (50) https://www.unicode.org/reports/tr31/

   (51) https://github.com/python/cpython/issues/140251

   (52) https://github.com/python/cpython/issues/140212

   (53) https://github.com/python/cpython/issues/135801

   (54) https://github.com/python/cpython/issues/139707

   (55) https://github.com/python/cpython/issues/140041

   (56) https://github.com/python/cpython/issues/140120

   (57) https://github.com/python/cpython/issues/140141

   (58) https://github.com/python/cpython/issues/140142

   (59) https://github.com/python/cpython/issues/140166

   (60) https://www.iana.org/assignments/media-types/application/texinfo

   (61) https://github.com/python/cpython/issues/140135

   (62) https://github.com/python/cpython/issues/76007

   (63) https://github.com/python/cpython/issues/136702

   (64) https://github.com/python/cpython/issues/139940

   (65) https://github.com/python/cpython/issues/139462

   (66) https://github.com/python/cpython/issues/63161

   (67) https://github.com/python/cpython/issues/101828

   (68) https://github.com/python/cpython/issues/139246

   (69) https://github.com/python/cpython/issues/83714

   (70) https://github.com/python/cpython/issues/138891

   (71) https://peps.python.org/pep-0646/

   (72) https://github.com/python/cpython/issues/138859

   (73) https://github.com/python/cpython/issues/138764

   (74) https://github.com/python/cpython/issues/138775

   (75) https://github.com/python/cpython/issues/98896

   (76) https://github.com/python/cpython/issues/138425

   (77) https://github.com/python/cpython/issues/138151

   (78) https://github.com/python/cpython/issues/69528

   (79) https://github.com/python/cpython/issues/137627

   (80) https://github.com/python/cpython/issues/55531

   (81) https://github.com/python/cpython/issues/136057

   (82) https://github.com/python/cpython/issues/133390

   (83) https://github.com/python/cpython/issues/135307

   (84) https://github.com/python/cpython/issues/133789

   (85) https://github.com/python/cpython/issues/133601

   (86) https://github.com/python/cpython/issues/132686

   (87) https://github.com/python/cpython/issues/131116

   (88) https://github.com/python/cpython/issues/130693

   (89) https://github.com/python/cpython/issues/122255

   (90) https://github.com/python/cpython/issues/121011

   (91) https://github.com/python/cpython/issues/119668

   (92) https://github.com/python/cpython/issues/102431

   (93) https://github.com/python/cpython/issues/81313

   (94) https://peps.python.org/pep-0791/


File: python.info,  Node: Core and Builtins<9>,  Next: ライブラリ<10>,  Prev: ライブラリ<9>,  Up: Python 3 15 0 alpha 2

1.26.9.6 Core and Builtins
..........................

   - gh-141579(1): Fix *note sys.activate_stack_trampoline(): 88a. to
     properly support the ‘perf_jit’ backend.  Patch by Pablo Galindo.

   - gh-114203(2): Skip locking if object is already locked by two-mutex
     critical section.

   - gh-141528(3): Suggest using *note
     concurrent.interpreters.Interpreter.close(): 19f3. instead of the
     private ‘_interpreters.destroy’ function when warning about
     remaining subinterpreters.  Patch by Sergey Miryanov.

   - gh-141367(4): Specialize ‘CALL_LIST_APPEND’ instruction only for
     lists, not for list subclasses, to avoid unnecessary deopt.  Patch
     by Mikhail Efimov.

   - gh-141312(5): Fix the assertion failure in the ‘__setstate__’
     method of the range iterator when a non-integer argument is passed.
     Patch by Sergey Miryanov.

   - gh-140643(6): Add support for ‘<GC>’ and ‘<native>’ frames to
     ‘profiling.sampling’ output to denote active garbage collection and
     calls to native code.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141579

   (2) https://github.com/python/cpython/issues/114203

   (3) https://github.com/python/cpython/issues/141528

   (4) https://github.com/python/cpython/issues/141367

   (5) https://github.com/python/cpython/issues/141312

   (6) https://github.com/python/cpython/issues/140643


File: python.info,  Node: ライブラリ<10>,  Next: Core and Builtins<10>,  Prev: Core and Builtins<9>,  Up: Python 3 15 0 alpha 2

1.26.9.7 ライブラリ
...................

   - gh-140942(1): Add ‘.cjs’ to *note mimetypes: 93. to give CommonJS
     modules a MIME type of ‘application/node’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140942


File: python.info,  Node: Core and Builtins<10>,  Next: ライブラリ<11>,  Prev: ライブラリ<10>,  Up: Python 3 15 0 alpha 2

1.26.9.8 Core and Builtins
..........................

   - gh-140479(1): Update JIT compilation to use LLVM 21 at build time.

   - gh-140939(2): Fix memory leak when *note bytearray: 1d1. or *note
     bytes: 1d2. is formated with the ‘%*b’ format with a large width
     that results in a *note MemoryError: 191d.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140479

   (2) https://github.com/python/cpython/issues/140939


File: python.info,  Node: ライブラリ<11>,  Next: Core and Builtins<11>,  Prev: Core and Builtins<10>,  Up: Python 3 15 0 alpha 2

1.26.9.9 ライブラリ
...................

   - gh-140260(1): Fix *note struct: de. 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: ライブラリ<12>,  Prev: ライブラリ<11>,  Up: Python 3 15 0 alpha 2

1.26.9.10 Core and Builtins
...........................

   - gh-140530(1): Fix a reference leak when ‘raise exc from cause’
     fails.  Patch by Bénédikt Tran.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140530


File: python.info,  Node: ライブラリ<12>,  Next: Core and Builtins<12>,  Prev: Core and Builtins<11>,  Up: Python 3 15 0 alpha 2

1.26.9.11 ライブラリ
....................

   - gh-90344(1): Replace *note io.IncrementalNewlineDecoder: 1968. with
     non incremental newline decoders in codebase where
     ‘io.IncrementalNewlineDecoder.decode()’ was being called once.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/90344


File: python.info,  Node: Core and Builtins<12>,  Next: ライブラリ<13>,  Prev: ライブラリ<12>,  Up: Python 3 15 0 alpha 2

1.26.9.12 Core and Builtins
...........................

   - gh-140373(1): Correctly emit ‘PY_UNWIND’ event when generator
     object is closed.  Patch by Mikhail Efimov.

   - gh-140729(2): Fix pickling error in the sampling profiler when
     using ‘concurrent.futures.ProcessPoolExecutor’ script can not be
     properly pickled and executed in worker processes.

   - gh-131527(3): Dynamic borrow checking for stackrefs is added to
     ‘Py_STACKREF_DEBUG’ mode.  Patch by Mikhail Efimov.

   - gh-140576(4): Fixed crash in *note tokenize.generate_tokens(): 8ef.
     in case of specific incorrect input.  Patch by Mikhail Efimov.

   - gh-140544(5): Speed up accessing interpreter state by caching it in
     a thread local variable.  Patch by Kumar Aditya.

   - gh-140551(6): Fixed crash in *note dict: 193. if *note
     dict.clear(): 1975. is called at the lookup stage.  Patch by
     Mikhail Efimov and Inada Naoki.

   - gh-140517(7): Fixed a reference leak when iterating over the result
     of *note map(): 445. with ‘strict=True’ when the input iterables
     have different lengths.  Patch by Mikhail Efimov.

   - gh-133467(8): Fix race when updating ‘type.__bases__’ that could
     allow a read of ‘type.__base__’ to observe an inconsistent value on
     the free threaded build.

   - gh-140471(9): Fix potential buffer overflow in *note ast.AST: 2f8.
     node initialization when encountering malformed *note _fields:
     19fa. containing non-*note str: 1ea.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140373

   (2) https://github.com/python/cpython/issues/140729

   (3) https://github.com/python/cpython/issues/131527

   (4) https://github.com/python/cpython/issues/140576

   (5) https://github.com/python/cpython/issues/140544

   (6) https://github.com/python/cpython/issues/140551

   (7) https://github.com/python/cpython/issues/140517

   (8) https://github.com/python/cpython/issues/133467

   (9) https://github.com/python/cpython/issues/140471


File: python.info,  Node: ライブラリ<13>,  Next: Core and Builtins<13>,  Prev: Core and Builtins<12>,  Up: Python 3 15 0 alpha 2

1.26.9.13 ライブラリ
....................

   - gh-140443(1): The logarithm functions (such as *note math.log10():
     19fc. and *note math.log(): 1878.) may now produce slightly
     different results for extremely large integers that cannot be
     converted to floats without overflow.  These results are generally
     more accurate, with reduced worst-case error and a tighter overall
     error distribution.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140443


File: python.info,  Node: Core and Builtins<13>,  Next: ライブラリ<14>,  Prev: ライブラリ<13>,  Up: Python 3 15 0 alpha 2

1.26.9.14 Core and Builtins
...........................

   - gh-140431(1): Fix a crash in Python's *note garbage collector:
     19fe. due to partially initialized *note coroutine: 8a7. objects
     when coroutine origin tracking depth is enabled (*note
     sys.set_coroutine_origin_tracking_depth(): f4f.).

   - gh-140476(2): Optimize *note PySet_Add(): 17fe. for *note
     frozenset: 9d9. in *note free threaded: 48e. build.

   - gh-135904(3): Add special labels to the assembly created during
     stencil creation to support relocations that the native object file
     format does not support.  Specifically, 19 bit branches for AArch64
     in Mach-O object files.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140431

   (2) https://github.com/python/cpython/issues/140476

   (3) https://github.com/python/cpython/issues/135904


File: python.info,  Node: ライブラリ<14>,  Next: Core and Builtins<14>,  Prev: Core and Builtins<13>,  Up: Python 3 15 0 alpha 2

1.26.9.15 ライブラリ
....................

   - gh-140398(1): Fix memory leaks in *note readline: c2. functions
     *note read_init_file(): 1a00, *note read_history_file(): 1a01,
     *note write_history_file(): 1a02, and *note append_history_file():
     1205. when *note PySys_Audit(): 80e. fails.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140398


File: python.info,  Node: Core and Builtins<14>,  Next: C API<8>,  Prev: ライブラリ<14>,  Up: Python 3 15 0 alpha 2

1.26.9.16 Core and Builtins
...........................

   - gh-140406(1): Fix memory leak when an object's *note __hash__():
     ec5. method returns an object that isn't an *note int: 32e.

   - 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-136895(3): Update JIT compilation to use LLVM 20 at build time.

   - gh-139109(4): A new tracing frontend for the JIT compiler has been
     implemented.  Patch by Ken Jin.  Design for CPython by Ken Jin,
     Mark Shannon and Brandt Bucher.

   - gh-140306(5): Fix memory leaks in cross-interpreter channel
     operations and shared namespace handling.

   - gh-116738(6): Make _suggestions module thread-safe on the *note
     free threaded: 48e. build.

   - gh-140301(7): Fix memory leak of ‘PyConfig’ in subinterpreters.

   - gh-140257(8): Fix data race between interpreter_clear() and
     take_gil() on eval_breaker during finalization with daemon threads.

   - gh-139951(9): 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-140253(10): Wrong placement of a double-star pattern inside a
     mapping pattern now throws a specialized syntax error.  Contributed
     by Bartosz Sławecki in gh-140253(11).

   - gh-140104(12): Fix a bug with exception handling in the JIT. Patch
     by Ken Jin.  Bug reported by Daniel Diniz.

   - gh-140149(13): Speed up parsing bytes literals concatenation by
     using PyBytesWriter API and a single memory allocation (about 3x
     faster).

   - gh-140061(14): Fixing the checking of whether an object is uniquely
     referenced to ensure free-threaded compatibility.  Patch by Sergey
     Miryanov.

   - gh-140080(15): Fix hang during finalization when attempting to call
     *note atexit: d. handlers under no memory.

   - gh-139871(16): Update *note bytearray: 1d1. to use a *note bytes:
     1d2. under the hood as its buffer and add *note
     bytearray.take_bytes(): 1d0. to take it out.

   - gh-140067(17): Fix memory leak in sub-interpreter creation.

   - gh-139914(18): Restore support for HP PA-RISC, which has an
     upwards-growing stack.

   - gh-139817(19): Attribute ‘__qualname__’ is added to *note
     typing.TypeAliasType: 531.  Patch by Mikhail Efimov.

   - gh-135801(20): Many functions related to compiling or parsing
     Python code, such as *note compile(): 1d3, *note ast.parse(): 1d4,
     *note symtable.symtable(): 1d5, and *note
     importlib.abc.InspectLoader.source_to_code(): 1d6. now allow to
     specify the module name.  It is needed to unambiguous *note filter:
     1d7. syntax warnings by module name.

   - gh-139640(21): *note ast.parse(): 1d4. no longer emits syntax
     warnings for ‘return’/‘break’/‘continue’ in ‘finally’ (see PEP
     765(22)) - they are only emitted during compilation.

   - gh-139640(23): 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-139475(24): Changes in stackref debugging mode when
     ‘Py_STACKREF_DEBUG’ is set.  We use the same pattern of refcounting
     for stackrefs as in production build.

   - gh-139269(25): Fix undefined behavior when using unaligned store in
     JIT's ‘patch_*’ functions.

   - gh-138944(26): Fix *note SyntaxError: 189. message when invalid
     syntax appears on the same line as a valid ‘import ... as ...’ or
     ‘from ... import ... as ...’ statement.  Patch by Brian Schubert.

   - gh-138857(27): Improve *note SyntaxError: 189. message for ‘case’
     keyword placed outside *note match: 1df. body.

   - gh-131253(28): Support the ‘--enable-pystats’ build option for the
     free-threaded build.

   - gh-136327(29): Errors when calling functions with invalid values
     after ‘*’ and ‘**’ now do not include the function name.  Patch by
     Ilia Solin.

   - gh-134786(30): If *note Py_TPFLAGS_MANAGED_DICT: 3a4. and *note
     Py_TPFLAGS_MANAGED_WEAKREF: 3a5. are used, then *note
     Py_TPFLAGS_HAVE_GC: 3a6. must be used as well.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140406

   (2) https://github.com/python/cpython/issues/140358

   (3) https://github.com/python/cpython/issues/136895

   (4) https://github.com/python/cpython/issues/139109

   (5) https://github.com/python/cpython/issues/140306

   (6) https://github.com/python/cpython/issues/116738

   (7) https://github.com/python/cpython/issues/140301

   (8) https://github.com/python/cpython/issues/140257

   (9) https://github.com/python/cpython/issues/139951

   (10) https://github.com/python/cpython/issues/140253

   (11) https://github.com/python/cpython/issues/140253

   (12) https://github.com/python/cpython/issues/140104

   (13) https://github.com/python/cpython/issues/140149

   (14) https://github.com/python/cpython/issues/140061

   (15) https://github.com/python/cpython/issues/140080

   (16) https://github.com/python/cpython/issues/139871

   (17) https://github.com/python/cpython/issues/140067

   (18) https://github.com/python/cpython/issues/139914

   (19) https://github.com/python/cpython/issues/139817

   (20) https://github.com/python/cpython/issues/135801

   (21) https://github.com/python/cpython/issues/139640

   (22) https://peps.python.org/pep-0765/

   (23) https://github.com/python/cpython/issues/139640

   (24) https://github.com/python/cpython/issues/139475

   (25) https://github.com/python/cpython/issues/139269

   (26) https://github.com/python/cpython/issues/138944

   (27) https://github.com/python/cpython/issues/138857

   (28) https://github.com/python/cpython/issues/131253

   (29) https://github.com/python/cpython/issues/136327

   (30) https://github.com/python/cpython/issues/134786


File: python.info,  Node: C API<8>,  Next: ビルド<7>,  Prev: Core and Builtins<14>,  Up: Python 3 15 0 alpha 2

1.26.9.17 C API
...............

   - gh-141341(1): On Windows, rename the ‘COMPILER’ macro to
     ‘_Py_COMPILER’ to avoid name conflicts.  Patch by Victor Stinner.

   - gh-116146(2): Add a new *note PyImport_CreateModuleFromInitfunc():
     371. C-API for creating a module from a 'spec' and 'initfunc'.
     Patch by Itamar Oren.

   - gh-141042(3): Make qNaN in *note PyFloat_Pack2(): b4c. and *note
     PyFloat_Pack4(): b4d, if while conversion to a narrower precision
     floating-point format -- the remaining after truncation payload
     will be zero.  Patch by Sergey B Kirpichev.

   - gh-141004(4): ‘Py_MATH_El’ and ‘Py_MATH_PIl’ are deprecated.

   - gh-141004(5): The ‘Py_INFINITY’ macro is *note soft deprecated:
     1b2.

   - gh-140556(6): PEP 793(7): Add a new entry point for C extension
     modules, ‘PyModExport_<modulename>’.

   - gh-140487(8): Fix *note Py_RETURN_NOTIMPLEMENTED: 1a05. in limited
     C API 3.11 and older: don't treat ‘Py_NotImplemented’ as immortal.
     Patch by Victor Stinner.

   - gh-140153(9): Fix *note Py_REFCNT(): 552. definition on limited C
     API 3.11-3.13.  Patch by Victor Stinner.

   - gh-139653(10): Add *note
     PyUnstable_ThreadState_SetStackProtection(): 39d. and *note
     PyUnstable_ThreadState_ResetStackProtection(): 39e. 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/141341

   (2) https://github.com/python/cpython/issues/116146

   (3) https://github.com/python/cpython/issues/141042

   (4) https://github.com/python/cpython/issues/141004

   (5) https://github.com/python/cpython/issues/141004

   (6) https://github.com/python/cpython/issues/140556

   (7) https://peps.python.org/pep-0793/

   (8) https://github.com/python/cpython/issues/140487

   (9) https://github.com/python/cpython/issues/140153

   (10) https://github.com/python/cpython/issues/139653


File: python.info,  Node: ビルド<7>,  Prev: C API<8>,  Up: Python 3 15 0 alpha 2

1.26.9.18 ビルド
................

   - gh-140454(1): When building the JIT, match the jit_stencils
     filename expectations in Makefile with the generator script.  This
     avoid needless JIT recompilation during ‘make install’.

   - gh-140768(2): Warn when the WASI SDK version doesn't match what's
     supported.

   - gh-140513(3): Generate a clear compilation error when
     ‘_Py_TAIL_CALL_INTERP’ is enabled but either ‘preserve_none’ or
     ‘musttail’ is not supported.

   - gh-140475(4): Support WASI SDK 25.

   - gh-140239(5): Check ‘statx’ availability only on Linux (including
     Android).

   - gh-140189(6): iOS builds were added to CI.

   - gh-137618(7): ‘PYTHON_FOR_REGEN’ now requires Python 3.10 to Python
     3.15.  Patch by Adam Turner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140454

   (2) https://github.com/python/cpython/issues/140768

   (3) https://github.com/python/cpython/issues/140513

   (4) https://github.com/python/cpython/issues/140475

   (5) https://github.com/python/cpython/issues/140239

   (6) https://github.com/python/cpython/issues/140189

   (7) https://github.com/python/cpython/issues/137618


File: python.info,  Node: Python 3 15 0 alpha 1,  Next: Python 3 14 0 beta 1,  Prev: Python 3 15 0 alpha 2,  Up: 変更履歴

1.26.10 Python 3.15.0 alpha 1
-----------------------------

'Release date: 2025-10-14'

* Menu:

* macOS: macOS<4>.
* Windows: Windows<8>.
* Tools/Demos: Tools/Demos<5>.
* テスト: テスト<10>.
* セキュリティ: セキュリティ<8>.
* ライブラリ: ライブラリ<15>.
* IDLE: IDLE<5>.
* ドキュメント: ドキュメント<7>.
* Core and Builtins: Core and Builtins<15>.
* ライブラリ: ライブラリ<16>.
* Core and Builtins: Core and Builtins<16>.
* ライブラリ: ライブラリ<17>.
* Core and Builtins: Core and Builtins<17>.
* ライブラリ: ライブラリ<18>.
* Core and Builtins: Core and Builtins<18>.
* ライブラリ: ライブラリ<19>.
* Core and Builtins: Core and Builtins<19>.
* ライブラリ: ライブラリ<20>.
* Core and Builtins: Core and Builtins<20>.
* ライブラリ: ライブラリ<21>.
* Core and Builtins: Core and Builtins<21>.
* ライブラリ: ライブラリ<22>.
* Core and Builtins: Core and Builtins<22>.
* ライブラリ: ライブラリ<23>.
* Core and Builtins: Core and Builtins<23>.
* ライブラリ: ライブラリ<24>.
* Core and Builtins: Core and Builtins<24>.
* ライブラリ: ライブラリ<25>.
* Core and Builtins: Core and Builtins<25>.
* ライブラリ: ライブラリ<26>.
* Core and Builtins: Core and Builtins<26>.
* ライブラリ: ライブラリ<27>.
* Core and Builtins: Core and Builtins<27>.
* ライブラリ: ライブラリ<28>.
* Core and Builtins: Core and Builtins<28>.
* C API: C API<9>.
* ビルド: ビルド<8>.


File: python.info,  Node: macOS<4>,  Next: Windows<8>,  Up: Python 3 15 0 alpha 1

1.26.10.1 macOS
...............

   - gh-115119(1): Update macOS installer to use libmpdecimal 4.0.1.

   - gh-124111(2): Update macOS installer to use Tcl/Tk 9.0.2.

   - gh-132339(3): Update macOS installer version of OpenSSL to 3.5.4.

   - gh-137450(4): 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(5): Update macOS installer to ship with SQLite version
     3.50.4.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115119

   (2) https://github.com/python/cpython/issues/124111

   (3) https://github.com/python/cpython/issues/132339

   (4) https://github.com/python/cpython/issues/137450

   (5) https://github.com/python/cpython/issues/137134


File: python.info,  Node: Windows<8>,  Next: Tools/Demos<5>,  Prev: macOS<4>,  Up: Python 3 15 0 alpha 1

1.26.10.2 Windows
.................

   - gh-139810(1): Installing with ‘py install 3[.x]-dev’ will now
     select final versions as well as prereleases.

   - gh-139573(2): Updated bundled version of OpenSSL to 3.0.18.

   - gh-138896(3): Fix error installing C runtime on non-updated Windows
     machines

   - gh-138314(4): Add *note winreg.DeleteTree(): 1a0a.

   - gh-137136(5): Suppress build warnings when build on Windows with
     ‘--experimental-jit-interpreter’.

   - gh-137134(6): Update Windows installer to ship with SQLite 3.50.4.

   - gh-135099(7): Fix a crash that could occur on Windows when a
     background thread waits on a *note PyMutex: 699. while the main
     thread is shutting down the interpreter.

   - gh-130727(8): 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(9): Make *note os.path.realpath(): 24d. ignore Windows
     error 1005 when in non-strict mode.

   - gh-133779(10): 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(): 425. function can
     be used to determine whether the current runtime was compiled with
     that flag or not.

   - gh-133626(11): Ensures packages are not accidentally bundled into
     the traditional installer.

   - gh-133580(12): Fix *note sys.getwindowsversion(): 10a8. failing
     without setting an exception when called on some WinAPI partitions.

   - gh-133572(13): Avoid LsaNtStatus to WinError conversion on
     unsupported WinAPI partitions.

   - gh-133568(14): Fix compile error when using a WinAPI partition that
     doesn't support the RPC runtime library.

   - gh-133562(15): Disable handling of security descriptors by *note
     os.mkdir(): 734. with mode ‘0o700’ on WinAPI partitions that do not
     support it.  This only affects custom builds for specialized
     targets.

   - gh-133537(16): Avoid using console I/O in WinAPI partitions that
     don’t support it

   - gh-131942(17): Use the Python-specific *note Py_DEBUG: 1a0b. macro
     rather than ‘_DEBUG’ in Windows-related C code.  Patch by Xuehai
     Pan.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139810

   (2) https://github.com/python/cpython/issues/139573

   (3) https://github.com/python/cpython/issues/138896

   (4) https://github.com/python/cpython/issues/138314

   (5) https://github.com/python/cpython/issues/137136

   (6) https://github.com/python/cpython/issues/137134

   (7) https://github.com/python/cpython/issues/135099

   (8) https://github.com/python/cpython/issues/130727

   (9) https://github.com/python/cpython/issues/76023

   (10) https://github.com/python/cpython/issues/133779

   (11) https://github.com/python/cpython/issues/133626

   (12) https://github.com/python/cpython/issues/133580

   (13) https://github.com/python/cpython/issues/133572

   (14) https://github.com/python/cpython/issues/133568

   (15) https://github.com/python/cpython/issues/133562

   (16) https://github.com/python/cpython/issues/133537

   (17) https://github.com/python/cpython/issues/131942


File: python.info,  Node: Tools/Demos<5>,  Next: テスト<10>,  Prev: Windows<8>,  Up: Python 3 15 0 alpha 1

1.26.10.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.

   - gh-137873(4): 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.

   - gh-137484(5): Have ‘Tools/wasm/wasi’ put the build Python into a
     directory named after the build triple instead of "build".

   - gh-137025(6): The ‘wasm_build.py’ script has been removed.
     ‘Tools/wasm/emscripten’ and ‘Tools/wasm/wasi’ should be used
     instead, as described in the Dev Guide(7).

   - gh-137248(8): Add a ‘--logdir’ option to ‘Tools/wasm/wasi’ for
     specifying where to write log files.

   - gh-137243(9): Have Tools/wasm/wasi detect a WASI SDK install in
     /opt when it was directly extracted from a release tarball.

   - gh-136251(10): Fixes and usability improvements for
     ‘Tools/wasm/emscripten/web_example’

   - gh-135968(11): Stubs for ‘strip’ are now provided as part of an iOS
     install.

   - gh-135379(12): The cases generator no longer accepts type
     annotations on stack items.  Conversions to non-default types are
     now done explicitly in bytecodes.c and optimizer_bytecodes.c.  This
     will simplify code generation for top-of-stack caching and other
     future features.

   - gh-134215(13): *note REPL: 6a3. import autocomplete only suggests
     private modules when explicitly specified.

   ---------- 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

   (4) https://github.com/python/cpython/issues/137873

   (5) https://github.com/python/cpython/issues/137484

   (6) https://github.com/python/cpython/issues/137025

   (7) https://devguide.python.org/contrib/workflows/compile/

   (8) https://github.com/python/cpython/issues/137248

   (9) https://github.com/python/cpython/issues/137243

   (10) https://github.com/python/cpython/issues/136251

   (11) https://github.com/python/cpython/issues/135968

   (12) https://github.com/python/cpython/issues/135379

   (13) https://github.com/python/cpython/issues/134215


File: python.info,  Node: テスト<10>,  Next: セキュリティ<8>,  Prev: Tools/Demos<5>,  Up: Python 3 15 0 alpha 1

1.26.10.4 テスト
................

   - gh-139208(1): Fix regrtest ‘--fast-ci --verbose’: don't ignore the
     ‘--verbose’ option anymore.  Patch by Victor Stinner.

   - gh-138313(2): Restore skipped test and add janky workaround to
     prevent select buildbots from failing with a ResourceWarning.

   - gh-135966(3): The iOS testbed now handles the ‘app_packages’ folder
     as a site directory.

   - gh-135494(4): Fix regrtest to support excluding tests from ‘--pgo’
     tests.  Patch by Victor Stinner.

   - gh-132815(5): Fix test__opcode: add ‘JUMP_BACKWARD’ to
     specialization stats.

   - gh-135489(6): Show verbose output for failing tests during PGO
     profiling step with -enable-optimizations.

   - gh-135401(7): Add a new GitHub CI job to test the *note ssl: d8.
     module with AWS-LC(8) as the backing cryptography and TLS library.

   - gh-135120(9): Add ‘test.support.subTests()’.

   - gh-134567(10): Expose log formatter to users in
     TestCase.assertLogs.  *note unittest.TestCase.assertLogs(): 2aa.
     will now optionally accept a formatter that will be used to format
     the strings in output if provided.

   - gh-133744(11): 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(12): 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(13): Fix
     ‘TestPyReplAutoindent.test_auto_indent_default()’ doesn't run
     ‘input_code’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139208

   (2) https://github.com/python/cpython/issues/138313

   (3) https://github.com/python/cpython/issues/135966

   (4) https://github.com/python/cpython/issues/135494

   (5) https://github.com/python/cpython/issues/132815

   (6) https://github.com/python/cpython/issues/135489

   (7) https://github.com/python/cpython/issues/135401

   (8) https://github.com/aws/aws-lc

   (9) https://github.com/python/cpython/issues/135120

   (10) https://github.com/python/cpython/issues/134567

   (11) https://github.com/python/cpython/issues/133744

   (12) https://github.com/python/cpython/issues/133682

   (13) https://github.com/python/cpython/issues/133639


File: python.info,  Node: セキュリティ<8>,  Next: ライブラリ<15>,  Prev: テスト<10>,  Up: Python 3 15 0 alpha 1

1.26.10.5 セキュリティ
......................

   - 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-139400(2): *note xml.parsers.expat: 12f.: Make sure that parent
     Expat parsers are only garbage-collected once they are no longer
     referenced by subparsers created by *note
     ExternalEntityParserCreate(): 1952.  Patch by Sebastian Pipping.

   - gh-139283(3): *note sqlite3: d7.: correctly handle maximum number
     of rows to fetch in *note Cursor.fetchmany: 1a0f. and reject
     negative values for *note Cursor.arraysize: 1a10.  Patch by
     Bénédikt Tran.

   - gh-136053(4): *note marshal: 90.: fix a possible crash when
     deserializing *note slice: 1db. objects.

   - gh-135661(5): Fix parsing start and end tags in *note
     html.parser.HTMLParser: c51. 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".

   - gh-135661(6): Fix CDATA section parsing in *note
     html.parser.HTMLParser: c51. 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.

   - gh-102555(7): Fix comment parsing in *note html.parser.HTMLParser:
     c51. according to the HTML5 standard.  ‘--!>’ now ends the comment.
     ‘-- >’ no longer ends the comment.  Support abnormally ended empty
     comments ‘<-->’ and ‘<--->’.

   - gh-135462(8): Fix quadratic complexity in processing specially
     crafted input in *note html.parser.HTMLParser: c51.  End-of-file
     errors are now handled according to the HTML5 specs - comments and
     declarations are automatically closed, tags are ignored.

   - gh-118350(9): Fix support of escapable raw text mode (elements
     "textarea" and "title") in *note html.parser.HTMLParser: c51.

   - gh-135034(10): 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(11), CVE 2025-4138(12), CVE 2025-4330(13),
     and CVE 2025-4517(14).

   - gh-133767(15): Fix use-after-free in the "unicode-escape" decoder
     with a non-"strict" error handler.

   - gh-133623(16): Indicate through *note ssl.HAS_PSK_TLS13: 265.
     whether the *note ssl: d8. module supports "External PSKs" in
     TLSv1.3, as described in RFC 9258.  Patch by Will Childs-Klein.

   - gh-128840(17): Short-circuit the processing of long IPv6 addresses
     early in *note ipaddress: 83. to prevent excessive memory
     consumption and a minor denial-of-service.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139700

   (2) https://github.com/python/cpython/issues/139400

   (3) https://github.com/python/cpython/issues/139283

   (4) https://github.com/python/cpython/issues/136053

   (5) https://github.com/python/cpython/issues/135661

   (6) https://github.com/python/cpython/issues/135661

   (7) https://github.com/python/cpython/issues/102555

   (8) https://github.com/python/cpython/issues/135462

   (9) https://github.com/python/cpython/issues/118350

   (10) https://github.com/python/cpython/issues/135034

   (11) https://www.cve.org/CVERecord?id=CVE-2024-12718

   (12) https://www.cve.org/CVERecord?id=CVE-2025-4138

   (13) https://www.cve.org/CVERecord?id=CVE-2025-4330

   (14) https://www.cve.org/CVERecord?id=CVE-2025-4517

   (15) https://github.com/python/cpython/issues/133767

   (16) https://github.com/python/cpython/issues/133623

   (17) https://github.com/python/cpython/issues/128840


File: python.info,  Node: ライブラリ<15>,  Next: IDLE<5>,  Prev: セキュリティ<8>,  Up: Python 3 15 0 alpha 1

1.26.10.6 ライブラリ
....................

   - gh-139482(1): Optimize *note os.environ.clear(): 4ec. by calling
     ‘clearenv(3)(2)’ when this function is available.  Patch by Victor
     Stinner.

   - gh-139958(3): The ‘application/toml’ mime type is now supported by
     *note mimetypes: 93.  Patch by Gil Forcada.

   - gh-139823(4): *note ensurepip: 58. now fails with a nicer error
     message when the *note zlib: 13c. module is not available.

   - gh-139905(5): Add suggestion to error message for *note
     typing.Generic: 1a12. subclasses when ‘cls.__parameters__’ is
     missing due to a parent class failing to call *note
     super().__init_subclass__(): a27. in its ‘__init_subclass__’.

   - gh-139894(6): Fix incorrect sharing of current task with the child
     process while forking in *note asyncio: b.  Patch by Kumar Aditya.

   - gh-139845(7): Fix to not print KeyboardInterrupt twice in default
     asyncio REPL.

   - gh-139783(8): Fix *note inspect.getsourcelines(): 1a13. for the
     case when a decorator is followed by a comment or an empty line.

   - gh-139809(9): Prevent premature colorization of subparser ‘prog’ in
     *note argparse.ArgumentParser.add_subparsers(): fda. to respect
     color environment variable changes after parser creation.

   - gh-139736(10): Fix excessive indentation in the default *note
     argparse: 7. ‘HelpFormatter’.  Patch by Alexander Edland.

   - gh-70765(11): *note http.server: 75.: fix default handling of
     HTTP/0.9 requests in *note BaseHTTPRequestHandler: 231.
     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-139322(12): Fix *note os.getlogin(): 1a14. error handling: fix
     the error number.  Patch by Victor Stinner.

   - gh-135953(13): Add a Gecko format output to the tachyon profiler
     via ‘--gecko’.

   - gh-139184(14): *note os.forkpty(): 6c4. does now make the returned
     file descriptor non-inheritable.

   - gh-139391(15): 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(16)’ other than with
     ‘kill(17)’.

   - gh-139374(18): *note timeit: f8.: Add color to error tracebacks.

   - gh-90949(19): Add *note
     SetBillionLaughsAttackProtectionActivationThreshold(): 2c4. and
     *note SetBillionLaughsAttackProtectionMaximumAmplification(): 2c5.
     to *note xmlparser: 2c3. objects to tune protections against
     billion laughs(20) attacks.  Patch by Bénédikt Tran.

   - gh-139312(21): Upgrade bundled libexpat to 2.7.3

   - gh-139289(22): Do a real lazy-import on *note rlcompleter: c5. in
     *note pdb: aa. and restore the existing completer after importing
     ‘rlcompleter’.

   - gh-90949(23): Add *note SetAllocTrackerActivationThreshold(): 2c1.
     and *note SetAllocTrackerMaximumAmplification(): 2c2. to *note
     xmlparser: 2c3. objects to tune protections against disproportional
     amounts of dynamic memory usage from within an Expat parser.  Patch
     by Bénédikt Tran.

   - gh-67795(24): Functions that take timestamp or timeout arguments
     now accept any real numbers (such as *note Decimal: 1cd. and *note
     Fraction: 1ce.), not only integers or floats, although this does
     not improve precision.

   - gh-95953(25): A CSS class, ‘diff_changed’, was added to the changed
     lines in the ‘make_table’ output of *note difflib.HtmlDiff: 21f.
     Patch by Katie Gardner.

   - gh-139210(26): Fix use-after-free when reporting unknown event in
     *note xml.etree.ElementTree.iterparse(): 3f2.  Patch by Ken Jin.

   - gh-138860(27): Lazy import *note rlcompleter: c5. in *note pdb: aa.
     to avoid deadlock in subprocess.

   - gh-112729(28): Fix crash when calling *note
     concurrent.interpreters.create(): 1a15. when the process is out of
     memory.

   - gh-126016(29): Fix an assertion failure when sending *note
     KeyboardInterrupt: d9a. to a Python process running a
     subinterpreter in a separate thread.

   - gh-118803(30): *note collections.abc.ByteString: 2d6. has been
     removed from ‘collections.abc.__all__’, and *note
     typing.ByteString: 2ef. has been removed from ‘typing.__all__’.
     The former has been deprecated since Python 3.12, and the latter
     has been deprecated since Python 3.9.  Both classes are scheduled
     for removal in Python 3.17.

     Additionally, the following statements now cause
     ‘DeprecationWarning’s to be emitted at runtime: ‘from
     collections.abc import ByteString’, ‘from typing import
     ByteString’, ‘import collections.abc; collections.abc.ByteString’
     and ‘import typing; typing.ByteString’.  Both classes already
     caused ‘DeprecationWarning’s to be emitted if they were subclassed
     or used as the second argument to ‘isinstance()’ or ‘issubclass()’,
     but they did not previously lead to ‘DeprecationWarning’s if they
     were merely imported or accessed from their respective modules.

   - gh-135729(31): Fix unraisable exception during finalization when
     using *note concurrent.interpreters: 25. in the REPL.

   - gh-139076(32): Fix a bug in the *note pydoc: bd. 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-139090(33): Add *note os.RWF_DONTCACHE: 1a16. constant for Linux
     6.14+.

   - gh-139065(34): Fix trailing space before a wrapped long word if the
     line length is exactly 'width' in *note textwrap: f5.

   - gh-139001(35): Fix race condition in *note pathlib.Path: 4f5. on
     the internal ‘_raw_paths’ field.

   - gh-138813(36): ‘multiprocessing.BaseProcess’ defaults ‘kwargs’ to
     ‘None’ instead of a shared dictionary.

   - gh-138998(37): Update bundled libexpat to 2.7.2

   - gh-138993(38): Dedent *note credits: 19a5. text.

   - gh-118803(39): Add back *note collections.abc.ByteString: 2d6. and
     *note typing.ByteString: 2ef.  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-130567(40): Fix possible crash in *note locale.strxfrm(): 1a17.
     due to a platform bug on macOS.

   - gh-137226(41): Fix *note typing.get_type_hints(): aa3. calls on
     generic *note typing.TypedDict: 29b. classes defined with string
     annotations.

   - gh-138899(42): Executing ‘quit’ command in *note pdb: aa. will
     raise *note bdb.BdbQuit: 507. when ‘pdb’ is started from an asyncio
     console using *note breakpoint(): 500. or *note pdb.set_trace():
     501.

   - gh-138804(43): Raise *note TypeError: 29c. instead of *note
     AttributeError: 1b4. when an argument of incorrect type is passed
     to *note shlex.quote(): 787.  This restores the behavior of the
     function prior to 3.14.

   - gh-138779(44): Support device numbers larger than ‘2**63-1’ for the
     *note st_rdev: 1a18. field of the *note os.stat_result: 1879.
     structure.

   - gh-138682(45): Added symmetric difference support to *note
     collections.Counter: 20f. objects.

   - gh-138712(46): Add *note os.NODEV: 1a19.

   - gh-128636(47): Fix crash in PyREPL when os.environ is overwritten
     with an invalid value for mac

   - gh-138720(48): Fix an issue where *note io.BufferedWriter: 176a.
     and *note io.BufferedRandom: 176b. had different definitions of
     "closed" for *note close(): 711. and *note flush(): 1a1a. which
     resulted in an exception when close called flush but flush thought
     the file was already closed.

   - gh-138706(49): Update *note unicodedata: 10e. database to Unicode
     17.0.0.

   - gh-76007(50): Deprecate ‘__version__’ from a number of standard
     library modules.  Patch by Hugo van Kemenade.

   - gh-138535(51): Speed up *note os.stat(): 4fc. for files with
     reasonable timestamps.  Contributed by Jeffrey Bosboom.

   - gh-116946(52): *note curses.panel: 30.: the type of *note
     curses.panel.new_panel(): 1a1b. is now immutable.  Patch by
     Bénédikt Tran.

   - gh-116946(53): *note zlib: 13c.: the types of *note
     zlib.compressobj(): 1a1c. and *note zlib.decompressobj(): 1a1d. are
     now immutable.  Patch by Bénédikt Tran.

   - gh-116946(54): *note os: a5.: the *note os.DirEntry: 8b1. type and
     the type of *note os.scandir(): e27. are now immutable.  Patch by
     Bénédikt Tran.

   - gh-116946(55): *note tkinter: f9.: the types ‘_tkinter.Tcl_Obj’
     (wrapper for Tcl objects), ‘_tkinter.tktimertoken’ (obtained by
     calling ‘createtimerhandler()’ on a *note Tk: 1a1e. application)
     and ‘_tkinter.tkapp’ (the runtime type of Tk applications) are now
     immutable.  Patch by Bénédikt Tran.

   - gh-138514(56): Raise *note ValueError: 15a. when a multi-character
     string is passed to the 'echo_char' parameter of *note
     getpass.getpass(): 4b2.  Patch by Benjamin Johnson.

   - gh-137706(57): Fix the partial evaluation of annotations that use
     ‘typing.Annotated[T, x]’ where ‘T’ is a forward reference.

   - gh-88375(58): Fix normalization of the ‘robots.txt’ rules and URLs
     in the *note urllib.robotparser: 116. module.  No longer ignore
     trailing ‘?’.  Distinguish raw special characters ‘?’, ‘=’ and ‘&’
     from the percent-encoded ones.

   - gh-138515(59): *note email: 3e. is added to Emscripten build.

   - gh-99948(60): *note ctypes.util.find_library(): 1102. now works in
     Emscripten build.

   - gh-111788(61): Fix parsing errors in the *note urllib.robotparser:
     116. module.  Don't fail trying to parse weird paths.  Don't fail
     trying to decode non-UTF-8 ‘robots.txt’ files.

   - gh-138432(62): *note zoneinfo.reset_tzpath(): 1a1f. will now
     convert any *note os.PathLike: 1013. 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-132657(63): Improve the scaling of *note copy.copy(): 947. and
     *note copy.deepcopy(): f2f. in the free-threading build.

   - gh-116946(64): The types of *note select.poll(): 274. and *note
     select.epoll(): 1342. objects are now immutable.  Patch by Bénédikt
     Tran.

   - gh-116946(65): The ‘_random.Random’ C type is now immutable.  Patch
     by Bénédikt Tran.

   - gh-57911(66): When extracting tar files on Windows, slashes in
     symlink targets will be replaced by backslashes to prevent
     corrupted links.

   - gh-138205(67): Removed the *note resize(): 3f0. method on platforms
     that don't support the underlying syscall, instead of raising a
     *note SystemError: 3f1.

   - gh-138008(68): Fix segmentation faults in the *note ctypes: 2d.
     module due to invalid *note argtypes: 1a20.  Patch by Dung Nguyen.

   - gh-138252(69): *note ssl: d8.: *note SSLContext: 33e. objects can
     now set client and server TLS signature algorithms.  If Python has
     been built with OpenSSL 3.5 or later, *note SSLSocket: cbf. objects
     can return the signature algorithms selected on a connection.

   - gh-138253(70): Add the 'block' parameter in the ‘put()’ and ‘get()’
     methods of the *note concurrent.interpreters: 25. queues for
     compatibility with the *note queue.Queue: 174d. interface.

   - gh-60462(71): Fix *note locale.strxfrm(): 1a17. on Solaris (and
     possibly other platforms).

   - gh-138239(72): The REPL now highlights *note type: 860. as a soft
     keyword in *note type statements: 860.

   - gh-78502(73): *note mmap.mmap: 247. now has a 'trackfd' parameter
     on Windows; if it is ‘False’, the file handle corresponding to
     'fileno' will not be duplicated.

   - gh-138204(74): Forbid expansion of shared anonymous *note memory
     maps: 94. on Linux, which caused a bus error.

   - gh-138010(75): Fix an issue where defining a class with a *note
     @warnings.deprecated: 69b.-decorated base class may not invoke the
     correct *note __init_subclass__(): a27. method in cases involving
     multiple inheritance.  Patch by Brian Schubert.

   - gh-134716(76): Add support of regular expressions in the *note -W:
     1cb. option and the *note PYTHONWARNINGS: 1cc. environment
     variable.

   - gh-138133(77): Prevent infinite traceback loop when sending CTRL^C
     to Python through ‘strace’.

   - gh-138122(78): Implement PEP 799(79) - A dedicated profiling
     package for organizing Python profiling tools.  Patch by Pablo
     Galindo.

   - gh-138092(80): Fixed a bug in *note mmap.mmap.flush(): e62. where
     calling with only an offset parameter would fail.

   - gh-138044(81): Remove compatibility shim for deprecated parameter
     'package' in *note importlib.resources.files(): 2e2.  Patch by
     Semyon Moroz.

   - gh-86819(82): *note socket: d4.: Add missing constants for ISO-TP
     sockets.

   - gh-137884(83): Add *note threading.get_native_id(): e05. support
     for Illumos/Solaris.  Patch by Yüce Tekol.

   - gh-134869(84): Fix an issue where pressing Ctrl+C during tab
     completion in the REPL would leave the autocompletion menu in a
     corrupted state.

   - gh-137840(85): *note typing.TypedDict: 29b. now supports the
     ‘closed’ and ‘extra_items’ keyword arguments (as described in PEP
     728(86)) to control whether additional non-required keys are
     allowed and to specify their value type.

   - gh-132947(87): Applied changes to ‘importlib.metadata’ from
     importlib_metadata 8.7(88), including ‘dist’ now disallowed for
     ‘EntryPoints.select’; deferred imports for faster import times;
     added support for metadata with newlines (python/cpython#119650);
     and ‘metadata()’ function now returns ‘None’ when a metadata
     directory is present but no metadata is present.

   - gh-90548(89): Fix ‘musl’ detection for *note platform.libc_ver():
     1a21. on Alpine Linux if compiled with -strip-all.

   - gh-137317(90): *note inspect.signature(): 4c4. now correctly
     handles classes that use a descriptor on a wrapped ‘__init__()’ or
     ‘__new__()’ method.  Contributed by Yongyu Yan.

   - gh-137754(91): Fix import of the *note zoneinfo: 13d. module if the
     C implementation of the *note datetime: 33. module is not
     available.

   - gh-125854(92): Improve error messages for invalid category in *note
     warnings.warn(): 18d1.

   - gh-137729(93): *note locale.setlocale(): 23c. now supports language
     codes with ‘@’-modifiers.  ‘@’-modifier are no longer silently
     removed in *note locale.getlocale(): 23d, but included in the
     language code.

   - gh-73487(94): Speedup processing arguments (up to 1.5x) in the
     *note decimal: 39. module methods, that now using *note
     METH_FASTCALL: 353. calling convention.  Patch by Sergey B
     Kirpichev.

   - gh-137634(95): Calendar pages generated by the *note
     calendar.HTMLCalendar: 20d. class now support dark mode and have
     been migrated to the HTML5 standard for improved accessibility.

   - gh-137630(96): The ‘_interpreters’ module now uses Argument Clinic
     to parse arguments.  Patch by Adam Turner.

   - gh-137583(97): Fix a deadlock introduced in 3.13.6 when a call to
     *note ssl.SSLSocket.recv: 1161. was blocked in one thread, and then
     another method on the object (such as *note ssl.SSLSocket.send:
     1164.) was subsequently called in another thread.

   - gh-92936(98): Update regex used by ‘http.cookies.SimpleCookie’ to
     handle values containing double quotes.

   - gh-137426(99): 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-137490(100): Handle *note ECANCELED: 1a22. in the same way as
     *note EINTR: 1144. in *note signal.sigwaitinfo(): 1168. on NetBSD.

   - gh-137512(101): Add new constants in the *note resource: c4.
     module: *note RLIMIT_NTHR: 25b, *note RLIMIT_UMTXP: 25c, *note
     RLIMIT_PIPEBUF: 1a23, *note RLIMIT_THREADS: 25d, *note
     RLIM_SAVED_CUR: 25e, and *note RLIM_SAVED_MAX: 25f.

   - gh-137044(102): *note resource.RLIM_INFINITY: 3ed. is now always a
     positive integer.  On all supported platforms, it is larger than
     any limited resource value, which simplifies comparison of the
     resource values.  Previously, it could be negative, such as -1 or
     -3, depending on platform.

   - gh-137477(103): Fix ‘inspect.getblock()’, *note
     inspect.getsourcelines(): 1a13. and *note inspect.getsource():
     1a24. for generator expressions.

   - gh-137481(104): Calendar uses the lengths of the locale's weekdays
     to decide if the width requires abbreviation.

   - gh-137466(105): Remove undocumented ‘glob.glob0()’ and
     ‘glob.glob1()’ functions, which have been deprecated since Python
     3.13.  Use *note glob.glob(): 2df. and pass a directory to its
     'root_dir' argument instead.

   - gh-137044(106): Return large limit values as positive integers
     instead of negative integers in *note resource.getrlimit(): 1a25.
     Accept large values and reject negative values (except *note
     RLIM_INFINITY: 3ed.) for limits in *note resource.setrlimit(): 3ee.

   - gh-115766(107): Fix ‘ipaddress.IPv4Interface.is_unspecified’.

   - gh-75989(108): *note tarfile.TarFile.extractall(): 285. and *note
     tarfile.TarFile.extract(): 286. now overwrite symlinks when
     extracting hardlinks.  (Contributed by Alexander Enrique Urieles
     Nieto in gh-75989(109).)

   - gh-137017(110): Fix *note threading.Thread.is_alive: d1c. 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(111): Fix debug assertion failure in *note
     locale.setlocale(): 23c. on Windows.

   - gh-137191(112): Fix how type parameters are collected, when *note
     typing.Protocol: 772. are specified with explicit parameters.  Now,
     *note typing.Generic: 1a12. and ‘typing.Protocol’ always dictate
     the parameter number and parameter ordering of types.  Previous
     behavior was a bug.

   - gh-137282(113): Fix tab completion and *note dir(): a28. on *note
     concurrent.futures: 24.

   - gh-137257(114): Bump the version of pip bundled in ensurepip to
     version 25.2

   - gh-137239(115): *note heapq: 6c.: Update ‘heapq.__all__’ with
     ‘*_max’ functions.

   - gh-124503(116): *note ast.literal_eval(): fdb. is 10-20% faster for
     small inputs.

   - gh-137226(117): Fix behavior of *note
     annotationlib.ForwardRef.evaluate(): 151. when the 'type_params'
     parameter is passed and the name of a type param is also present in
     an enclosing scope.

   - gh-137197(118): *note SSLContext: 33e. objects can now set TLS 1.3
     cipher suites via *note set_ciphersuites(): 26a.

   - gh-81325(119): *note tarfile.TarFile: 15cd. now accepts a *note
     path-like: 7a5. when working on a tar archive.  (Contributed by
     Alexander Enrique Urieles Nieto in gh-81325(120).)

   - gh-137185(121): Fix a potential async-signal-safety issue in *note
     faulthandler: 5b. when printing C stack traces.

   - gh-133951(122): Remove lib64-lib symlink creation when creating new
     virtual environments in *note venv: 11a. module

   - gh-130522(123): Fix unraisable *note TypeError: 29c. raised during
     *note interpreter shutdown: 1ab. in the *note threading: f6.
     module.

   - gh-137059(124): Fix handling of file URLs with a Windows drive
     letter in the URL authority by *note urllib.request.url2pathname():
     540.  This fixes a regression in earlier pre-releases of Python
     3.14.

   - gh-136980(125): Remove unused C tracing code in bdb for event type
     ‘c_call’, ‘c_return’ and ‘c_exception’

   - gh-130577(126): *note tarfile: e7. now validates archives to ensure
     member offsets are non-negative.  (Contributed by Alexander Enrique
     Urieles Nieto in gh-130577(127).)

   - gh-136170(128): 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-121237(129): Support ‘%:z’ directive for *note
     datetime.datetime.strptime(): 2dd, *note datetime.time.strptime():
     1a26. and *note time.strptime(): 17e5.  Patch by Lucas Esposito and
     Semyon Moroz.

   - gh-136929(130): Ensure that hash functions guaranteed to be always
     'available' exist as attributes of *note hashlib: 6b. even if they
     will not work at runtime due to missing backend implementations.
     For instance, ‘hashlib.md5’ will no longer raise *note
     AttributeError: 1b4. if OpenSSL is not available and Python has
     been built without MD5 support.  Patch by Bénédikt Tran.

   - gh-124621(131): pyrepl now works in Emscripten.

   - gh-136914(132): Fix retrieval of *note doctest.DocTest.lineno:
     1a27. for objects decorated with *note functools.cache(): 1a28. or
     *note functools.cached_property: 953.

   - gh-136912(133): *note hmac.digest(): f00. 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(134): Allows creating a *note ctypes.CDLL: db1. without
     name when passing a handle as an argument.

   - gh-135228(135): When *note dataclasses: 32. 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’.

   - gh-136874(136): Discard URL query and fragment in *note
     urllib.request.url2pathname(): 540.

   - gh-136787(137): *note hashlib: 6b.: improve exception messages when
     a hash algorithm is not recognized, blocked by the current security
     policy or incompatible with the desired operation (for instance,
     using HMAC with SHAKE). Patch by Bénédikt Tran.

   - gh-130645(138): Enable color help by default in *note argparse: 7.

   - gh-131724(139): In *note http.client: 72, a new
     'max_response_headers' keyword-only parameter has been added to
     *note HTTPConnection: 22e. and *note HTTPSConnection: 22f.
     constructors.  This parameter sets the maximum number of allowed
     response headers, helping to prevent denial-of-service attacks.

   - gh-135427(140): With *note -Werror: 1cb, the DeprecationWarning
     emitted by *note os.fork(): 6c3. and *note os.forkpty(): 6c4. in
     mutli-threaded processes is now raised as an exception.  Previously
     it was silently ignored.  Patch by Rani Pinchuk.

   - gh-136234(141): Fix *note asyncio.WriteTransport.writelines():
     1a29. to be robust to connection failure, by using the same
     behavior as *note write(): 1a2a.

   - gh-53144(142): ‘encodings.aliases’: Add ‘latin_N’ aliases

   - gh-136669(143): ‘_asyncio’ is now statically linked for improved
     performance.

   - gh-136134(144): ‘SMTP.auth_cram_md5()’ now raises an *note
     SMTPException: 134f. instead of a *note ValueError: 15a. if Python
     has been built without MD5 support.  In particular, *note SMTP:
     cfe. 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(145): *note IMAP4.login_cram_md5: 1a2b. now raises an
     *note IMAP4.error: 1a2c. if CRAM-MD5 authentication is not
     supported.  Patch by Bénédikt Tran.

   - gh-136591(146): ‘_hashlib’: avoid using deprecated functions
     ‘ERR_func_error_string(147)’ and ‘EVP_MD_CTX_md(148)’ when using
     OpenSSL 3.0 and later.  Patch by Bénédikt Tran.

   - gh-136571(149): *note datetime.date.fromisocalendar(): db4. can now
     raise OverflowError for out of range arguments.

   - gh-136549(150): Fix signature of *note threading.excepthook(): c27.

   - gh-136492(151): Expose PEP 667(152)'s *note FrameLocalsProxyType:
     297. in the *note types: 10c. module.

   - gh-83336(153): ‘utf8_sig’ is now aliased to *note
     encodings.utf_8_sig: 57.

   - gh-136523(154): Fix *note wave.Wave_write: 2f3. emitting an
     unraisable when open raises.

   - gh-136507(155): Fix mimetypes CLI to handle multiple file
     parameters.

   - gh-52876(156): Add missing ‘keepends’ (default ‘True’) parameter to
     ‘codecs.StreamReaderWriter.readline()’ and
     ‘codecs.StreamReaderWriter.readlines()’.

   - gh-136470(157): Correct *note
     concurrent.futures.InterpreterPoolExecutor: 471.'s default thread
     name.

   - gh-136476(158): Fix a bug that was causing the
     ‘get_async_stack_trace’ function to miss some frames in the stack
     trace.

   - gh-136434(159): Fix docs generation of ‘UnboundItem’ in *note
     concurrent.interpreters: 25. when running with *note -OO: 1172.

   - gh-136380(160): Raises *note AttributeError: 1b4. when accessing
     *note concurrent.futures.InterpreterPoolExecutor: 471. and
     subinterpreters are not available.

   - gh-72327(161): Suggest using the system command prompt when ‘pip
     install’ is typed into the REPL. Patch by Tom Viner, Richard Si,
     and Brian Schubert.

   - gh-135953(162): Implement a new high-frequency runtime profiler
     that leverages the existing remote debugging functionality to
     collect detailed execution statistics from running Python
     processes.  This tool is exposed in the ‘profile.sample’ module and
     enables non-intrusive observation of production applications by
     attaching to already-running processes without requiring any code
     modifications, restarts, or special startup flags.  The observer
     can perform extremely high-frequency sampling of stack traces and
     interpreter state, providing detailed runtime execution analysis of
     live applications.

   - gh-136021(163): Make ‘type_params’ parameter required in
     ‘typing._eval_type()’ after a deprecation period for not providing
     this parameter.  Also remove the *note DeprecationWarning: 2d4. for
     the old behavior.

   - gh-136286(164): Fix pickling failures for protocols 0 and 1 for
     many objects related to subinterpreters.

   - gh-136047(165): Fix issues with *note typing: 10d. when the C
     implementation of *note abc: 4. is not available.

   - gh-136316(166): Improve support for evaluating nested forward
     references in *note typing.evaluate_forward_ref(): 152.

   - gh-136306(167): *note ssl: d8. can now get and set groups used for
     key agreement.

   - gh-136156(168): *note tempfile.TemporaryFile(): 1a2d. no longer
     uses *note os.O_EXCL: 1a2e. with *note os.O_TMPFILE: 1322, so it's
     possible to use ‘linkat()’ on the file descriptor.  Patch by Victor
     Stinner.

   - gh-133982(169): Update Python implementation of *note io.BytesIO:
     1258. to be thread safe.

   - gh-136193(170): Improve *note TypeError: 29c. error message, when
     richcomparing two *note types.SimpleNamespace: 6f0. objects.

   - gh-136097(171): Fix potential infinite recursion and KeyError in
     ‘sysconfig --generate-posix-vars’.

   - gh-85702(172): If ‘zoneinfo._common.load_tzdata’ is given a package
     without a resource a *note zoneinfo.ZoneInfoNotFoundError: 1a2f. is
     raised rather than a *note PermissionError: 10fd.  Patch by Victor
     Stinner.

   - gh-90733(173): Improve error messages when reporting invalid
     parameters in *note hashlib.scrypt(): 1000.  Patch by Bénédikt
     Tran.

   - gh-134759(174): Fix *note UnboundLocalError: 18ee. in *note
     email.message.Message.get_payload(): 158b. when the payload to
     decode is a *note bytes: 1d2. object.  Patch by Kliment Lamonov.

   - gh-136028(175): Fix parsing month names containing "İ" (U+0130,
     LATIN CAPITAL LETTER I WITH DOT ABOVE) in *note time.strptime():
     17e5.  This affects locales az_AZ, ber_DZ, ber_MA and crh_UA.

   - gh-87135(176): Acquiring a *note threading.Lock: 1a30. or *note
     threading.RLock: 2eb. at interpreter shutdown will raise *note
     PythonFinalizationError: 691. if Python can determine that it would
     otherwise deadlock.

   - gh-135995(177): In the palmos encoding, make byte ‘0x9b’ decode to
     ‘›’ (U+203A - SINGLE RIGHT-POINTING ANGLE QUOTATION MARK).

   - gh-105456(178): Removed ‘sre_compile’, ‘sre_constants’ and
     ‘sre_parse’ modules.

   - gh-53203(179): Fix *note time.strptime(): 17e5. 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-135878(180): Fixes a crash of *note types.SimpleNamespace: 6f0.
     on *note free threading: 48e. builds, when several threads were
     calling its *note __repr__(): 1c7. method at the same time.

   - gh-135853(181): Add *note math.fmax(): 242. and *note math.fmin():
     243. to get the larger and smaller of two floating-point values.
     Patch by Bénédikt Tran.

   - gh-135836(182): Fix *note IndexError: 18ed. in *note
     asyncio.loop.create_connection(): 9fe. that could occur when
     non-*note OSError: 543. exception is raised during connection and
     socket's ‘close()’ raises ‘OSError’.

   - gh-135853(183): *note math: 91.: expose C99 *note signbit(): 244.
     function to determine whether the sign bit of a floating-point
     value is set.  Patch by Bénédikt Tran.

   - gh-134531(184): *note hmac: 6d.: use the ‘EVP_MAC(3ssl)(185)’
     interface for HMAC when Python is built with OpenSSL 3.0 and later
     instead of the deprecated ‘HMAC_CTX(3ssl)(186)’ interface.  Patch
     by Bénédikt Tran.

   - gh-135836(187): Fix *note IndexError: 18ed. in *note
     asyncio.loop.create_connection(): 9fe. that could occur when the
     Happy Eyeballs algorithm resulted in an empty exceptions list
     during connection attempts.

   - gh-135855(188): Raise *note TypeError: 29c. instead of *note
     SystemError: 3f1. when ‘_interpreters.set___main___attrs()’ is
     passed a non-dict object.  Patch by Brian Schubert.

   - gh-135823(189): *note netrc: 9f.: improve the error message when
     the security check for the ownership of the default configuration
     file ‘~/.netrc’ fails.  Patch by Bénédikt Tran.

   - gh-135815(190): *note netrc: 9f.: skip security checks if *note
     os.getuid(): 1a31. is missing.  Patch by Bénédikt Tran.

   - gh-135640(191): Address bug where it was possible to call *note
     xml.etree.ElementTree.ElementTree.write(): e5f. on an ElementTree
     object with an invalid root element.  This behavior blanked the
     file passed to ‘write’ if it already existed.

   - gh-90117(192): Speed up *note pprint: b3. for *note list: 4e0. and
     *note tuple: 1d9.

   - gh-135759(193): *note hashlib: 6b.: reject negative digest lengths
     in OpenSSL-based SHAKE objects by raising a *note ValueError: 15a.
     Previously, negative lengths were implicitly rejected by raising a
     *note MemoryError: 191d. or a *note SystemError: 3f1.  Patch by
     Bénédikt Tran.

   - gh-123471(194): Make concurrent iterations over *note
     itertools.chain: 19b. safe under *note free threading: 48e.

   - gh-135645(195): Added ‘supports_isolated_interpreters’ field to
     *note sys.implementation: 92b.

   - gh-135646(196): Raise consistent *note NameError: 66c. exceptions
     in *note annotationlib.ForwardRef.evaluate(): 151.

   - gh-135557(197): Fix races on *note heapq: 6c. updates and *note
     list: 4e0. reads on the *note free threaded: 48e. build.

   - gh-119180(198): Only fetch globals and locals if necessary in *note
     annotationlib.get_annotations(): 673.

   - gh-135561(199): Fix a crash on DEBUG builds when an HACL* HMAC
     routine fails.  Patch by Bénédikt Tran.

   - gh-135386(200): Fix opening a *note dbm.sqlite3: 38. database for
     reading from read-only file or directory.

   - gh-135444(201): Fix *note asyncio.DatagramTransport.sendto(): 6d7.
     to account for datagram header size when data cannot be sent.

   - gh-65697(202): *note configparser: 26.'s error message when
     attempting to write an invalid key is now more helpful.

   - gh-135497(203): Fix *note os.getlogin(): 1a14. failing for longer
     usernames on BSD-based platforms.

   - gh-135487(204): Fix ‘reprlib.Repr.repr_int()’ when given integers
     with more than *note sys.get_int_max_str_digits(): 1a32. digits.
     Patch by Bénédikt Tran.

   - gh-135429(205): Fix the argument mismatch in ‘_lsprof’ for
     ‘PY_THROW’ event.

   - gh-135368(206): Fix *note unittest.mock.Mock: e12. generation on
     *note dataclasses.dataclass(): 6ec. objects.  Now all special
     attributes are set as it was before gh-124429(207).

   - gh-135336(208): *note json: 85. now encodes strings up to 2.2x
     faster if they consist solely of characters that don’t require
     escaping.

   - gh-135335(209): *note multiprocessing: 98.: Flush ‘stdout’ and
     ‘stderr’ after preloading modules in the ‘forkserver’.

   - gh-126631(210): Fix *note multiprocessing: 98. ‘forkserver’ bug
     which prevented ‘__main__’ from being preloaded.

   - gh-133967(211): Do not normalize *note locale: 89. name 'C.UTF-8'
     to 'en_US.UTF-8'.

   - gh-130870(212): Preserve *note types.GenericAlias: bcb. subclasses
     in *note typing.get_type_hints(): aa3.

   - gh-135321(213): Raise a correct exception for values greater than
     0x7fffffff for the ‘BINSTRING’ opcode in the C implementation of
     *note pickle: ab.

   - gh-121914(214): Changed the names of the symbol tables for lambda
     expressions and generator expressions to "<lambda>" and "<genexpr>"
     respectively to avoid conflicts with user-defined names.

   - gh-135276(215): Synchronized zipfile.Path with zipp 3.23, including
     improved performance of *note zipfile.Path.open(): 1a33. for
     non-reading modes, rely on *note functools.cached_property(): 953.
     to cache values on the instance.  Rely on ‘save_method_args’ to
     save the initialization method arguments.  Fixed ‘.name’, ‘.stem’
     and other basename-based properties on Windows when working with a
     zipfile on disk.

   - gh-135234(216): *note hashlib: 6b.: improve exception messages when
     an OpenSSL function failed.  When memory allocation fails on
     OpenSSL's side, a *note MemoryError: 191d. is raised instead of a
     *note ValueError: 15a.  Patch by Bénédikt Tran.

   - gh-135244(217): *note uuid: 119.: 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(218).  This affects *note uuid1(): f6b. and
     *note uuid6(): 545.

   - gh-135241(219): The ‘INT’ opcode of the C accelerator ‘_pickle’
     module was updated to look only for "00" and "01" to push booleans
     onto the stack, aligning with the Python *note pickle: ab. module.

   - gh-133934(220): Improve *note sqlite3: d7. CLI's ‘.help’ message.

   - gh-135069(221): Fix the "Invalid error handling" exception in
     ‘encodings.idna.IncrementalDecoder’ to correctly replace the
     'errors' parameter.

   - gh-130662(222): +Accept leading zeros in precision and width fields
     for +:class:*note Decimal: 1cd. formatting, for example
     ‘format(Decimal(1.25), '.016f')’.

   - gh-130662(223): Accept leading zeros in precision and width fields
     for *note Fraction: 1ce. formatting, for example
     ‘format(Fraction(1, 3), '.016f')’.

   - gh-135004(224): Rewrite and cleanup the internal ‘_blake2’ module.
     Some exception messages were changed but their types were left
     untouched.  Patch by Bénédikt Tran.

   - gh-134953(225): Expand ‘_colorize’ theme with ‘keyword_constant’
     and implement in *note repl: 6a3.

   - gh-134978(226): *note hashlib: 6b.: Supporting the ‘string’ keyword
     parameter in hash function constructors such as *note new(): 2fd.
     or the direct hash-named constructors such as *note md5(): 2fe. and
     *note sha256(): 2ff. is now deprecated and slated for removal in
     Python 3.19.  Prefer passing the initial data as a positional
     argument for maximum backwards compatibility.  Patch by Bénédikt
     Tran.

   - gh-134970(227): Fix the "unknown action" exception in *note
     argparse.ArgumentParser.add_argument_group(): 325. to correctly
     replace the action class.

   - gh-134718(228): By default, omit optional ‘Load()’ values in *note
     ast.dump(): 1ec.

   - gh-134718(229): *note ast.dump(): 1ec. now only omits ‘None’ and
     ‘[]’ values if they are default values.

   - gh-134939(230): Add the *note concurrent.interpreters: 25. module.
     See PEP 734(231).

   - gh-108885(232): Run each example as a subtest in unit tests
     synthesized by *note doctest.DocFileSuite(): 1a34. and *note
     doctest.DocTestSuite(): 11b0.  Add the *note
     doctest.DocTestRunner.report_skip(): 1a35. method.

   - gh-134885(233): Fix possible crash in the *note compression.zstd:
     23. module related to setting parameter types.  Patch by Jelle
     Zijlstra.

   - gh-134857(234): Improve error report for *note doctest: 3d.s run
     with *note unittest: 10f.  Remove ‘doctest’ module frames from
     tracebacks and redundant newline character from a failure message.

   - gh-128840(235): Fix parsing long IPv6 addresses with embedded IPv4
     address.

   - gh-133579(236): *note curses: 2e.: Consistently report failures of
     curses C API calls in module-level methods by raising a *note
     curses.error: 1a36.  This affects *note assume_default_colors():
     490, *note baudrate(): 1a37, *note cbreak(): 1a38, *note echo():
     1a39, *note longname(): 1a3a, *note initscr(): 1a3b, *note nl():
     1a3c, *note raw(): 1a3d, *note termattrs(): 1a3e, *note termname():
     1a3f. and *note unctrl(): 1a40.  Patch by Bénédikt Tran.

   - gh-133579(237): *note curses.window.refresh(): 1a41. and *note
     curses.window.noutrefresh(): 1a42. now raise a *note TypeError:
     29c. instead of *note curses.error: 1a36. when called with an
     incorrect number of arguments for *note pads: 1a43.  Patch by
     Bénédikt Tran.

   - gh-133579(238): *note curses.window: 1a44.: Consistently report
     failures of curses C API calls in Window methods by raising a *note
     curses.error: 1a36.  This affects *note addch(): 1a45, *note
     addnstr(): 1a46, *note addstr(): 1a47, *note border(): 1a48, *note
     box(): 1a49, *note chgat(): 1a4a, *note getbkgd(): 1a4b, *note
     inch(): 1a4c, *note insstr(): 1a4d. and *note insnstr(): 1a4e.
     Patch by Bénédikt Tran.

   - gh-134771(239): The ‘time_clockid_converter()’ function now selects
     correct type for ‘clockid_t’ on Cygwin which fixes a build error.

   - gh-134637(240): Fix performance regression in calling a *note
     ctypes: 2d. function pointer in *note free threading: 48e.

   - gh-134696(241): Built-in HACL* and OpenSSL implementations of hash
     function constructors now correctly accept the same 'documented'
     named arguments.  For instance, *note md5(): 2fe. 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-132710(242): If possible, ensure that *note uuid.getnode(): f6a.
     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-134531(243): ‘_hashlib’: Rename internal C functions for
     ‘_hashlib.HASH’ and ‘_hashlib.HASHXOF’ objects.  Patch by Bénédikt
     Tran.

   - gh-134698(244): Fix a crash when calling methods of *note
     ssl.SSLContext: 33e. or *note ssl.SSLSocket: cbf. across multiple
     threads.

   - gh-134151(245): *note email: 3e.: Fix *note TypeError: 29c. in
     *note email.utils.decode_params(): 1a4f. when sorting RFC 2231(246)
     continuations that contain an unnumbered section.

   - gh-134635(247): *note zlib: 13c.: Allow to combine Adler-32 and
     CRC-32 checksums via *note adler32_combine(): 2c7. and *note
     crc32_combine(): 2c8.  Patch by Callum Attryde and Bénédikt Tran.

   - gh-134657(248): *note asyncio: b.: Remove some private names from
     ‘asyncio.__all__’.

   - gh-134210(249): *note curses.window.getch(): 1a50. now correctly
     handles signals.  Patch by Bénédikt Tran.

   - gh-80334(250): *note multiprocessing.freeze_support(): 1954. now
     checks for work on any "spawn" start method platform rather than
     only on Windows.

   - gh-134582(251): Fix tokenize.untokenize() round-trip errors related
     to t-strings braces escaping

   - gh-134580(252): Improved the styling of HTML diff pages generated
     by the *note difflib.HtmlDiff: 21f. class, and migrated the output
     to the HTML5 standard.

   - gh-134565(253): *note unittest.doModuleCleanups(): 1a51. no longer
     swallows all but first exception raised in the cleanup code, but
     raises a *note ExceptionGroup: 6de. if multiple errors occurred.

   - gh-134546(254): Ensure *note pdb: aa. remote debugging script is
     readable by remote Python process.

   - gh-134451(255): Converted ‘asyncio.tools.CycleFoundException’ from
     dataclass to a regular exception type.

   - gh-114177(256): Fix *note asyncio: b. to not close subprocess pipes
     which would otherwise error out when the event loop is already
     closed.

   - gh-90871(257): Fixed an off by one error concerning the backlog
     parameter in *note create_unix_server(): 6d6.  Contributed by
     Christian Harries.

   - gh-134323(258): Fix the *note threading.RLock.locked(): 1a52.
     method.

   - gh-86802(259): 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-71189(260): Add support of the all-but-last mode in *note
     os.path.realpath(): 24d.

   - gh-72902(261): Improve speed (x1.1-1.8) of the *note Fraction: 1ce.
     constructor for typical inputs (*note float: 32f.'s, *note Decimal:
     1cd.'s or strings).

   - gh-134209(262): *note curses: 2e.: The *note curses.window.instr():
     1a53. and *note curses.window.getstr(): 1a54. 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-88994(263): Change *note datetime.datetime.now(): 8ff. to
     half-even rounding for consistency with *note
     datetime.datetime.fromtimestamp(): 900.  Patch by John Keith Hohm.

   - gh-80184(264): The default queue size is now ‘socket.SOMAXCONN’ for
     *note socketserver.TCPServer: 16d9.

   - gh-132983(265): Add ‘compression.zstd’ version information to
     ‘test.pythoninfo’.

   - gh-134235(266): Updated tab completion on REPL to include builtin
     modules.  Contributed by Tom Wang, Hunter Young

   - gh-134152(267): Fixed *note UnboundLocalError: 18ee. that could
     occur during *note email: 3e. header parsing if an expected
     trailing delimiter is missing in some contexts.

   - gh-134152(268): *note email: 3e.: Fix parsing of email message ID
     with invalid domain.

   - gh-134168(269): *note http.server: 75.: Fix IPv6 address binding
     and *note -directory: 1a55. handling when using HTTPS.

   - gh-62184(270): Remove import of C implementation of *note
     io.FileIO: 16c9. from Python implementation which has its own
     implementation

   - gh-134087(271): Remove support for arbitrary positional or keyword
     arguments in the C implementation of *note threading.RLock: 2eb.
     objects.  This was deprecated since Python 3.14.  Patch by Bénédikt
     Tran.

   - gh-134173(272): Speed up *note asyncio: b. performance of
     transferring state from thread pool *note
     concurrent.futures.Future: 1570. by up to 4.4x.  Patch by J. Nick
     Koston.

   - gh-133982(273): Emit *note RuntimeWarning: 6e3. in the Python
     implementation of *note io: 82. when the *note file-like object:
     1581. is not closed explicitly in the presence of multiple I/O
     layers.

   - gh-133890(274): The *note tarfile: e7. module now handles *note
     UnicodeEncodeError: a6c. in the same way as *note OSError: 543.
     when cannot extract a member.

   - gh-134097(275): Fix interaction of the new *note REPL: 6a3. and
     *note -X showrefcount: 183. command line option.

   - gh-133889(276): The generated directory listing page in *note
     http.server.SimpleHTTPRequestHandler: 235. now only shows the
     decoded path component of the requested URL, and not the query and
     fragment.

   - gh-134098(277): Fix handling paths that end with a percent-encoded
     slash (‘%2f’ or ‘%2F’) in *note
     http.server.SimpleHTTPRequestHandler: 235.

   - gh-132124(278): 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: 473. start method.  Patch by Bénédikt
     Tran.

   - gh-134062(279): *note ipaddress: 83.: fix collisions in *note
     __hash__(): ec5. for *note IPv4Network: 718. and *note IPv6Network:
     719. objects.

   - gh-134004(280): *note shelve: cb. as well as underlying ‘dbm.dumb’
     and ‘dbm.sqlite’ now have ‘reorganize()’ methods to recover unused
     free space previously occupied by deleted entries.

   - gh-133970(281): Make ‘string.templatelib.Template’ and
     ‘string.templatelib.Interpolation’ generic.

   - gh-71253(282): Raise *note ValueError: 15a. in *note open(): 333.
     if 'opener' returns a negative file-descriptor in the Python
     implementation of *note io: 82. to match the C implementation.

   - gh-133960(283): Simplify and improve *note
     typing.evaluate_forward_ref(): 152.  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(284): Make the private class ‘typing._UnionGenericAlias’
     hashable.

   - gh-133604(285): Remove ‘platform.java_ver()’ which was deprecated
     since Python 3.13.

   - gh-133875(286): Removed deprecated
     ‘pathlib.PurePath.is_reserved()’.  Use *note os.path.isreserved():
     2e5. to detect reserved paths on Windows.

   - gh-133873(287): Remove the deprecated ‘getmark()’, ‘setmark()’ and
     ‘getmarkers()’ methods of the *note Wave_read: 2f2. and *note
     Wave_write: 2f3. classes, which were deprecated since Python 3.13.
     Patch by Bénédikt Tran.

   - gh-133866(288): Remove the undocumented function
     ‘ctypes.SetPointerType()’, which has been deprecated since Python
     3.13.  Patch by Bénédikt Tran.

   - gh-133823(289): Remove support for ‘TD = TypedDict("TD")’ and ‘TD =
     TypedDict("TD", None)’ calls for constructing *note
     typing.TypedDict: 29b. objects with zero field.  Patch by Bénédikt
     Tran.

   - gh-125996(290): Fix thread safety of *note collections.OrderedDict:
     9da.  Patch by Kumar Aditya.

   - gh-133817(291): Remove support for creating *note NamedTuple: 2f0.
     classes via the undocumented keyword argument syntax.  Patch by
     Bénédikt Tran.

   - gh-133653(292): Fix *note argparse.ArgumentParser: 1e7. 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-133810(293): Remove ‘http.server.CGIHTTPRequestHandler’ and
     ‘--cgi’ flag from the ‘python -m http.server’ command-line
     interface.  They were deprecated in Python 3.13.  Patch by Bénédikt
     Tran.

   - gh-132641(294): Fixed a race in *note functools.lru_cache(): db7.
     under free-threading.

   - gh-133783(295): Fix bug with applying *note copy.replace(): 461. to
     *note ast: 9. objects.  Attributes that default to ‘None’ were
     incorrectly treated as required for manually created AST nodes.

   - gh-133684(296): Fix bug where *note
     annotationlib.get_annotations(): 673. would return the wrong result
     for certain classes that are part of a class hierarchy where ‘from
     __future__ import annotations’ is used.

   - gh-77057(297): Fix handling of invalid markup declarations in *note
     html.parser.HTMLParser: c51.

   - gh-130328(298): Speedup pasting in ‘PyREPL’ on Windows in a legacy
     console.  Patch by Chris Eibl.

   - gh-133701(299): Fix bug where *note typing.TypedDict: 29b. classes
     defined under ‘from __future__ import annotations’ and inheriting
     from another ‘TypedDict’ had an incorrect ‘__annotations__’
     attribute.

   - gh-133656(300): Remove deprecated
     ‘zipimport.zipimporter.load_module()’.  Use *note
     zipimport.zipimporter.exec_module(): 2f5. instead.

   - gh-133722(301): Added a 'color' option to *note
     difflib.unified_diff(): 21e. that colors output similar to ‘git
     diff’.

   - gh-133489(302): *note random.getrandbits(): 13bb. can now generate
     more that 2^31 bits.  *note random.randbytes(): 1a56. can now
     generate more that 256 MiB.

   - gh-133595(303): Clean up *note sqlite3.Connection: 3e6. APIs.  All
     parameters of *note sqlite3.connect(): 3e7. except 'database' are
     now keyword-only.  The first three parameters of methods *note
     create_function(): 3e8. and *note create_aggregate(): 3e9. are now
     positional-only.  The first parameter of methods *note
     set_authorizer(): 3ea, *note set_progress_handler(): 3eb. and *note
     set_trace_callback(): 3ec. is now positional-only.

   - gh-133581(304): Improve unparsing of t-strings in *note
     ast.unparse(): cba. and ‘from __future__ import annotations’.
     Empty t-strings now round-trip correctly and formatting in
     interpolations is preserved.  Patch by Jelle Zijlstra.

   - gh-133577(305): Add parameter ‘formatter’ to *note
     logging.basicConfig(): dc6.

   - gh-92897(306): Removed the ‘check_home’ parameter from *note
     sysconfig.is_python_build(): 2e9, deprecated since Python 3.12.

   - gh-133551(307): Support t-strings ( PEP 750(308)) in *note
     annotationlib: 6.  Patch by Jelle Zijlstra.

   - gh-133517(309): Remove *note os.listdrives(): 8b3, *note
     os.listvolumes(): 8b4. and *note os.listmounts(): 8b5. in non
     Windows desktop builds since the underlying functionality is
     missing.

   - gh-133439(310): Fix dot commands with trailing spaces are mistaken
     for multi-line SQL statements in the sqlite3 command-line
     interface.

   - gh-133447(311): Add basic color to *note sqlite3: d7. CLI
     interface.

   - gh-133253(312): Fix thread-safety issues in *note linecache: 88.

   - gh-133390(313): Support keyword completion in the *note sqlite3:
     d7. command-line interface and add *note sqlite3.SQLITE_KEYWORDS:
     1a57. constant.

   - gh-132493(314): Avoid accessing ‘__annotations__’ unnecessarily in
     *note inspect.signature(): 4c4.

   - gh-133017(315): Improve the error message of *note
     multiprocessing.sharedctypes.Array(): 1a58, *note
     multiprocessing.sharedctypes.RawArray(): 1a59, *note
     multiprocessing.sharedctypes.Value(): 1a5a. and *note
     multiprocessing.sharedctypes.RawValue(): 1a5b. when an invalid
     typecode is passed.  Patch by Tomas Roun

   - gh-132813(316): Improve error messages for incorrect types and
     values of *note csv.Dialect: 1a5c. attributes.

   - gh-132969(317): Prevent the *note ProcessPoolExecutor: 211.
     executor thread, which remains running when *note
     shutdown(wait=False): cc2, 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-132876(318): ‘ldexp()’ on Windows doesn't round subnormal
     results before Windows 11, but should.  Python's *note
     math.ldexp(): 1a5d. wrapper now does round them, so results may
     change slightly, in rare cases of very small results, on Windows
     versions before 11.

   - gh-133009(319): *note xml.etree.ElementTree: 12e.: Fix a crash in
     *note Element.__deepcopy__: 192a. when the element is concurrently
     mutated.  Patch by Bénédikt Tran.

   - gh-132908(320): Add *note math.isnormal(): 240. and *note
     math.issubnormal(): 241. functions.  Patch by Sergey B Kirpichev.

   - gh-95380(321): *note fcntl.fcntl(): 1983. and *note fcntl.ioctl():
     1833.: Remove the 1024 bytes limit on the size of not mutated
     bytes-like argument.

   - gh-122781(322): Fix ‘%z’ directive in *note
     datetime.datetime.strptime(): 2dd. to allow for no provided offset
     as was documented.

   - gh-123471(323): Make concurrent iterations over *note
     itertools.combinations: 16cb. and *note itertools.product: 16cc.
     safe under free-threading.

   - gh-127081(324): Fix libc thread safety issues with *note dbm: 34.
     by performing stateful operations in critical sections.

   - gh-127081(325): Fix libc thread safety issues with *note os: a5. by
     replacing ‘getlogin’ with ‘getlogin_r’ re-entrant version.

   - gh-127081(326): Fix libc thread safety issues with *note pwd: ba.
     by locking access to ‘getpwall’.

   - gh-132551(327): Make *note io.BytesIO: 1258. safe in *note
     free-threaded: 48e. build.

   - gh-107583(328): Fix ‘Flag’ inversion when flag set has missing
     values (‘IntFlag’ still flips all bits); fix negative assigned
     values during flag creation (both ‘Flag’ and ‘IntFlag’ ignore
     missing values).

   - gh-87790(329): Support underscore and comma as thousands separators
     in the fractional part for *note Fraction: 1ce.'s formatting.
     Patch by Sergey B Kirpichev.

   - gh-87790(330): Support underscore and comma as thousands separators
     in the fractional part for *note Decimal: 1cd.'s formatting.  Patch
     by Sergey B Kirpichev.

   - gh-131884(331): Fix formatting issues in *note json.dump(): 10ff.
     when both 'indent' and 'skipkeys' are used.

   - gh-131788(332): Make ‘ResourceTracker.send’ from *note
     multiprocessing: 98. re-entrant safe

   - gh-91349(333): Adjust default ‘compressionlevel=’ to 6 (down from
     9) in *note gzip: 6a. and *note tarfile: e7.  It is the default
     level used by most compression tools and a better tradeoff between
     speed and performance.

   - gh-131146(334): Fix *note calendar.TextCalendar: 1a5e, *note
     calendar.HTMLCalendar: 20d, and the *note calendar: 15. CLI to
     display month names in the nominative case by adding *note
     calendar.standalone_month_name: 1a5f. and *note
     calendar.standalone_month_abbr: 1a60, which provide month names and
     abbreviations in the grammatical form used when a month name stands
     by itself, if the locale supports it.

   - gh-123471(335): Make concurrent iterations over *note
     itertools.cycle: 1a61. safe under free-threading.

   - gh-130664(336): Handle corner-case for *note Fraction: 1ce.'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:
     32f.'s.

   - gh-130999(337): Avoid exiting the new REPL and offer suggestions
     even if there are non-string candidates when errors occur.

   - gh-88473(338): Implement a fast path for *note datetime.date: 494.
     objects in *note datetime.date.today(): 1882. which results in a 5x
     performance gain while proper subclasses retain their previous
     performance.

   - gh-126883(339): Add check that timezone fields are in range for
     *note datetime.datetime.fromisoformat(): a0f. and *note
     datetime.time.fromisoformat(): a0e.  Patch by Semyon Moroz.

   - gh-125028(340): *note functools.Placeholder: 4ac. cannot be passed
     to *note functools.partial(): 4ad. as a keyword argument.

   - gh-125843(341): If possible, indicate which *note curses: 2e. C
     function or macro is responsible for raising a *note curses.error:
     1a36. exception.  Patch by Bénédikt Tran.

   - gh-119109(342): *note functools.partial(): 4ad. calls are now
     faster when keyword arguments are used.

   - gh-124033(343): ‘SimplePath’ is now presented in
     ‘importlib.metadata.__all__’.

   - gh-91216(344): ‘importlib.metadata’ now raises a ‘KeyError’ instead
     of returning ‘None’ when a key is missing from the metadata.

   - gh-120492(345): ‘importlib.metadata’ now prioritizes valid dists to
     invalid dists when retrieving by name.

   - gh-99631(346): The *note shelve: cb. module now accepts custom
     serialization and deserialization functions.

   - gh-119186(347): Slightly speed up *note os.walk(): 8be. by calling
     *note os.path.join(): 1a62. less often.

   - gh-120170(348): Fix an issue in the ‘_pickle’ extension module in
     which importing *note multiprocessing: 98. could change how pickle
     identifies which module an object belongs to, potentially breaking
     the unpickling of those objects.

   - gh-118981(349): 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-105497(350): Fix flag mask inversion when unnamed flags exist.

   - gh-99813(351): *note ssl: d8. now uses ‘SSL_sendfile’ internally
     when it is possible (see *note OP_ENABLE_KTLS: 1a63.).  The
     function sends a file more efficiently because it performs TLS
     encryption in the kernel to avoid additional context switches.
     Patch by Illia Volochii.

   - gh-62824(352): Fix aliases for ‘iso8859_8’ encoding.  Patch by Dave
     Goncalves.

   - gh-86155(353): *note html.parser.HTMLParser.close(): 1a64. no
     longer loses data when the ‘<script>’ tag is not closed.  Patch by
     Waylan Limberg.

   - gh-78319(354): UTF8 support for the IMAP APPEND command has been
     made RFC compliant.

   - gh-93334(355): Reraise *note KeyError: 7e5. as *note
     ModuleNotFoundError: 1c9. when *note
     importlib.machinery.PathFinder.find_spec(): 13bf. is called on a
     submodule without importing the parent (and without a ‘path’
     argument).

   - gh-69426(356): Fix *note html.parser.HTMLParser: c51. to not
     unescape character entities in attribute values if they are
     followed by an ASCII alphanumeric or an equals sign.

   - bpo-38735(357): Fix failure when importing a module from the root
     directory on unix-like platforms with sys.pycache_prefix set.

   - bpo-45959(358): *note pprint: b3. can now pretty-print dict views.

   - gh-84683(359): *note zoneinfo: 13d.: Check in
     ‘<prefix>/share/zoneinfo’ for data files on Windows

   - bpo-43429(360): The *note size(): 1a65. method of the *note
     mmap.mmap: 247. class now returns the size of an anonymous mapping
     on both Unix and Windows.  Previously, the size would be returned
     on Windows and an *note OSError: 543. would be raised on Unix.
     *note ValueError: 15a. is now raised instead of ‘OSError’ when
     ‘trackfd=False’.

   - bpo-41839(361): Allow negative priority values from *note
     os.sched_get_priority_min(): 14ca. and *note
     os.sched_get_priority_max(): 14c9. functions.

   - bpo-28494(362): Improve Zip file validation false positive rate in
     *note zipfile.is_zipfile(): 16e4.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139482

   (2) https://manpages.debian.org/clearenv(3)

   (3) https://github.com/python/cpython/issues/139958

   (4) https://github.com/python/cpython/issues/139823

   (5) https://github.com/python/cpython/issues/139905

   (6) https://github.com/python/cpython/issues/139894

   (7) https://github.com/python/cpython/issues/139845

   (8) https://github.com/python/cpython/issues/139783

   (9) https://github.com/python/cpython/issues/139809

   (10) https://github.com/python/cpython/issues/139736

   (11) https://github.com/python/cpython/issues/70765

   (12) https://github.com/python/cpython/issues/139322

   (13) https://github.com/python/cpython/issues/135953

   (14) https://github.com/python/cpython/issues/139184

   (15) https://github.com/python/cpython/issues/139391

   (16) https://manpages.debian.org/fg

   (17) https://manpages.debian.org/kill

   (18) https://github.com/python/cpython/issues/139374

   (19) https://github.com/python/cpython/issues/90949

   (20) https://en.wikipedia.org/wiki/Billion_laughs_attack

   (21) https://github.com/python/cpython/issues/139312

   (22) https://github.com/python/cpython/issues/139289

   (23) https://github.com/python/cpython/issues/90949

   (24) https://github.com/python/cpython/issues/67795

   (25) https://github.com/python/cpython/issues/95953

   (26) https://github.com/python/cpython/issues/139210

   (27) https://github.com/python/cpython/issues/138860

   (28) https://github.com/python/cpython/issues/112729

   (29) https://github.com/python/cpython/issues/126016

   (30) https://github.com/python/cpython/issues/118803

   (31) https://github.com/python/cpython/issues/135729

   (32) https://github.com/python/cpython/issues/139076

   (33) https://github.com/python/cpython/issues/139090

   (34) https://github.com/python/cpython/issues/139065

   (35) https://github.com/python/cpython/issues/139001

   (36) https://github.com/python/cpython/issues/138813

   (37) https://github.com/python/cpython/issues/138998

   (38) https://github.com/python/cpython/issues/138993

   (39) https://github.com/python/cpython/issues/118803

   (40) https://github.com/python/cpython/issues/130567

   (41) https://github.com/python/cpython/issues/137226

   (42) https://github.com/python/cpython/issues/138899

   (43) https://github.com/python/cpython/issues/138804

   (44) https://github.com/python/cpython/issues/138779

   (45) https://github.com/python/cpython/issues/138682

   (46) https://github.com/python/cpython/issues/138712

   (47) https://github.com/python/cpython/issues/128636

   (48) https://github.com/python/cpython/issues/138720

   (49) https://github.com/python/cpython/issues/138706

   (50) https://github.com/python/cpython/issues/76007

   (51) https://github.com/python/cpython/issues/138535

   (52) https://github.com/python/cpython/issues/116946

   (53) https://github.com/python/cpython/issues/116946

   (54) https://github.com/python/cpython/issues/116946

   (55) https://github.com/python/cpython/issues/116946

   (56) https://github.com/python/cpython/issues/138514

   (57) https://github.com/python/cpython/issues/137706

   (58) https://github.com/python/cpython/issues/88375

   (59) https://github.com/python/cpython/issues/138515

   (60) https://github.com/python/cpython/issues/99948

   (61) https://github.com/python/cpython/issues/111788

   (62) https://github.com/python/cpython/issues/138432

   (63) https://github.com/python/cpython/issues/132657

   (64) https://github.com/python/cpython/issues/116946

   (65) https://github.com/python/cpython/issues/116946

   (66) https://github.com/python/cpython/issues/57911

   (67) https://github.com/python/cpython/issues/138205

   (68) https://github.com/python/cpython/issues/138008

   (69) https://github.com/python/cpython/issues/138252

   (70) https://github.com/python/cpython/issues/138253

   (71) https://github.com/python/cpython/issues/60462

   (72) https://github.com/python/cpython/issues/138239

   (73) https://github.com/python/cpython/issues/78502

   (74) https://github.com/python/cpython/issues/138204

   (75) https://github.com/python/cpython/issues/138010

   (76) https://github.com/python/cpython/issues/134716

   (77) https://github.com/python/cpython/issues/138133

   (78) https://github.com/python/cpython/issues/138122

   (79) https://peps.python.org/pep-0799/

   (80) https://github.com/python/cpython/issues/138092

   (81) https://github.com/python/cpython/issues/138044

   (82) https://github.com/python/cpython/issues/86819

   (83) https://github.com/python/cpython/issues/137884

   (84) https://github.com/python/cpython/issues/134869

   (85) https://github.com/python/cpython/issues/137840

   (86) https://peps.python.org/pep-0728/

   (87) https://github.com/python/cpython/issues/132947

   (88) 
https://importlib-metadata.readthedocs.io/en/latest/history.html#v8-7-0

   (89) https://github.com/python/cpython/issues/90548

   (90) https://github.com/python/cpython/issues/137317

   (91) https://github.com/python/cpython/issues/137754

   (92) https://github.com/python/cpython/issues/125854

   (93) https://github.com/python/cpython/issues/137729

   (94) https://github.com/python/cpython/issues/73487

   (95) https://github.com/python/cpython/issues/137634

   (96) https://github.com/python/cpython/issues/137630

   (97) https://github.com/python/cpython/issues/137583

   (98) https://github.com/python/cpython/issues/92936

   (99) https://github.com/python/cpython/issues/137426

   (100) https://github.com/python/cpython/issues/137490

   (101) https://github.com/python/cpython/issues/137512

   (102) https://github.com/python/cpython/issues/137044

   (103) https://github.com/python/cpython/issues/137477

   (104) https://github.com/python/cpython/issues/137481

   (105) https://github.com/python/cpython/issues/137466

   (106) https://github.com/python/cpython/issues/137044

   (107) https://github.com/python/cpython/issues/115766

   (108) https://github.com/python/cpython/issues/75989

   (109) https://github.com/python/cpython/issues/75989

   (110) https://github.com/python/cpython/issues/137017

   (111) https://github.com/python/cpython/issues/137273

   (112) https://github.com/python/cpython/issues/137191

   (113) https://github.com/python/cpython/issues/137282

   (114) https://github.com/python/cpython/issues/137257

   (115) https://github.com/python/cpython/issues/137239

   (116) https://github.com/python/cpython/issues/124503

   (117) https://github.com/python/cpython/issues/137226

   (118) https://github.com/python/cpython/issues/137197

   (119) https://github.com/python/cpython/issues/81325

   (120) https://github.com/python/cpython/issues/81325

   (121) https://github.com/python/cpython/issues/137185

   (122) https://github.com/python/cpython/issues/133951

   (123) https://github.com/python/cpython/issues/130522

   (124) https://github.com/python/cpython/issues/137059

   (125) https://github.com/python/cpython/issues/136980

   (126) https://github.com/python/cpython/issues/130577

   (127) https://github.com/python/cpython/issues/130577

   (128) https://github.com/python/cpython/issues/136170

   (129) https://github.com/python/cpython/issues/121237

   (130) https://github.com/python/cpython/issues/136929

   (131) https://github.com/python/cpython/issues/124621

   (132) https://github.com/python/cpython/issues/136914

   (133) https://github.com/python/cpython/issues/136912

   (134) https://github.com/python/cpython/issues/83424

   (135) https://github.com/python/cpython/issues/135228

   (136) https://github.com/python/cpython/issues/136874

   (137) https://github.com/python/cpython/issues/136787

   (138) https://github.com/python/cpython/issues/130645

   (139) https://github.com/python/cpython/issues/131724

   (140) https://github.com/python/cpython/issues/135427

   (141) https://github.com/python/cpython/issues/136234

   (142) https://github.com/python/cpython/issues/53144

   (143) https://github.com/python/cpython/issues/136669

   (144) https://github.com/python/cpython/issues/136134

   (145) https://github.com/python/cpython/issues/136134

   (146) https://github.com/python/cpython/issues/136591

   (147) https://manpages.debian.org/ERR_func_error_string

   (148) https://manpages.debian.org/EVP_MD_CTX_md

   (149) https://github.com/python/cpython/issues/136571

   (150) https://github.com/python/cpython/issues/136549

   (151) https://github.com/python/cpython/issues/136492

   (152) https://peps.python.org/pep-0667/

   (153) https://github.com/python/cpython/issues/83336

   (154) https://github.com/python/cpython/issues/136523

   (155) https://github.com/python/cpython/issues/136507

   (156) https://github.com/python/cpython/issues/52876

   (157) https://github.com/python/cpython/issues/136470

   (158) https://github.com/python/cpython/issues/136476

   (159) https://github.com/python/cpython/issues/136434

   (160) https://github.com/python/cpython/issues/136380

   (161) https://github.com/python/cpython/issues/72327

   (162) https://github.com/python/cpython/issues/135953

   (163) https://github.com/python/cpython/issues/136021

   (164) https://github.com/python/cpython/issues/136286

   (165) https://github.com/python/cpython/issues/136047

   (166) https://github.com/python/cpython/issues/136316

   (167) https://github.com/python/cpython/issues/136306

   (168) https://github.com/python/cpython/issues/136156

   (169) https://github.com/python/cpython/issues/133982

   (170) https://github.com/python/cpython/issues/136193

   (171) https://github.com/python/cpython/issues/136097

   (172) https://github.com/python/cpython/issues/85702

   (173) https://github.com/python/cpython/issues/90733

   (174) https://github.com/python/cpython/issues/134759

   (175) https://github.com/python/cpython/issues/136028

   (176) https://github.com/python/cpython/issues/87135

   (177) https://github.com/python/cpython/issues/135995

   (178) https://github.com/python/cpython/issues/105456

   (179) https://github.com/python/cpython/issues/53203

   (180) https://github.com/python/cpython/issues/135878

   (181) https://github.com/python/cpython/issues/135853

   (182) https://github.com/python/cpython/issues/135836

   (183) https://github.com/python/cpython/issues/135853

   (184) https://github.com/python/cpython/issues/134531

   (185) https://manpages.debian.org/EVP_MAC(3ssl)

   (186) https://manpages.debian.org/hmac(3)

   (187) https://github.com/python/cpython/issues/135836

   (188) https://github.com/python/cpython/issues/135855

   (189) https://github.com/python/cpython/issues/135823

   (190) https://github.com/python/cpython/issues/135815

   (191) https://github.com/python/cpython/issues/135640

   (192) https://github.com/python/cpython/issues/90117

   (193) https://github.com/python/cpython/issues/135759

   (194) https://github.com/python/cpython/issues/123471

   (195) https://github.com/python/cpython/issues/135645

   (196) https://github.com/python/cpython/issues/135646

   (197) https://github.com/python/cpython/issues/135557

   (198) https://github.com/python/cpython/issues/119180

   (199) https://github.com/python/cpython/issues/135561

   (200) https://github.com/python/cpython/issues/135386

   (201) https://github.com/python/cpython/issues/135444

   (202) https://github.com/python/cpython/issues/65697

   (203) https://github.com/python/cpython/issues/135497

   (204) https://github.com/python/cpython/issues/135487

   (205) https://github.com/python/cpython/issues/135429

   (206) https://github.com/python/cpython/issues/135368

   (207) https://github.com/python/cpython/issues/124429

   (208) https://github.com/python/cpython/issues/135336

   (209) https://github.com/python/cpython/issues/135335

   (210) https://github.com/python/cpython/issues/126631

   (211) https://github.com/python/cpython/issues/133967

   (212) https://github.com/python/cpython/issues/130870

   (213) https://github.com/python/cpython/issues/135321

   (214) https://github.com/python/cpython/issues/121914

   (215) https://github.com/python/cpython/issues/135276

   (216) https://github.com/python/cpython/issues/135234

   (217) https://github.com/python/cpython/issues/135244

   (218) 
https://datatracker.ietf.org/doc/html/rfc9562.html#section-6.10-3

   (219) https://github.com/python/cpython/issues/135241

   (220) https://github.com/python/cpython/issues/133934

   (221) https://github.com/python/cpython/issues/135069

   (222) https://github.com/python/cpython/issues/130662

   (223) https://github.com/python/cpython/issues/130662

   (224) https://github.com/python/cpython/issues/135004

   (225) https://github.com/python/cpython/issues/134953

   (226) https://github.com/python/cpython/issues/134978

   (227) https://github.com/python/cpython/issues/134970

   (228) https://github.com/python/cpython/issues/134718

   (229) https://github.com/python/cpython/issues/134718

   (230) https://github.com/python/cpython/issues/134939

   (231) https://peps.python.org/pep-0734/

   (232) https://github.com/python/cpython/issues/108885

   (233) https://github.com/python/cpython/issues/134885

   (234) https://github.com/python/cpython/issues/134857

   (235) https://github.com/python/cpython/issues/128840

   (236) https://github.com/python/cpython/issues/133579

   (237) https://github.com/python/cpython/issues/133579

   (238) https://github.com/python/cpython/issues/133579

   (239) https://github.com/python/cpython/issues/134771

   (240) https://github.com/python/cpython/issues/134637

   (241) https://github.com/python/cpython/issues/134696

   (242) https://github.com/python/cpython/issues/132710

   (243) https://github.com/python/cpython/issues/134531

   (244) https://github.com/python/cpython/issues/134698

   (245) https://github.com/python/cpython/issues/134151

   (246) https://datatracker.ietf.org/doc/html/rfc2231.html

   (247) https://github.com/python/cpython/issues/134635

   (248) https://github.com/python/cpython/issues/134657

   (249) https://github.com/python/cpython/issues/134210

   (250) https://github.com/python/cpython/issues/80334

   (251) https://github.com/python/cpython/issues/134582

   (252) https://github.com/python/cpython/issues/134580

   (253) https://github.com/python/cpython/issues/134565

   (254) https://github.com/python/cpython/issues/134546

   (255) https://github.com/python/cpython/issues/134451

   (256) https://github.com/python/cpython/issues/114177

   (257) https://github.com/python/cpython/issues/90871

   (258) https://github.com/python/cpython/issues/134323

   (259) https://github.com/python/cpython/issues/86802

   (260) https://github.com/python/cpython/issues/71189

   (261) https://github.com/python/cpython/issues/72902

   (262) https://github.com/python/cpython/issues/134209

   (263) https://github.com/python/cpython/issues/88994

   (264) https://github.com/python/cpython/issues/80184

   (265) https://github.com/python/cpython/issues/132983

   (266) https://github.com/python/cpython/issues/134235

   (267) https://github.com/python/cpython/issues/134152

   (268) https://github.com/python/cpython/issues/134152

   (269) https://github.com/python/cpython/issues/134168

   (270) https://github.com/python/cpython/issues/62184

   (271) https://github.com/python/cpython/issues/134087

   (272) https://github.com/python/cpython/issues/134173

   (273) https://github.com/python/cpython/issues/133982

   (274) https://github.com/python/cpython/issues/133890

   (275) https://github.com/python/cpython/issues/134097

   (276) https://github.com/python/cpython/issues/133889

   (277) https://github.com/python/cpython/issues/134098

   (278) https://github.com/python/cpython/issues/132124

   (279) https://github.com/python/cpython/issues/134062

   (280) https://github.com/python/cpython/issues/134004

   (281) https://github.com/python/cpython/issues/133970

   (282) https://github.com/python/cpython/issues/71253

   (283) https://github.com/python/cpython/issues/133960

   (284) https://github.com/python/cpython/issues/133925

   (285) https://github.com/python/cpython/issues/133604

   (286) https://github.com/python/cpython/issues/133875

   (287) https://github.com/python/cpython/issues/133873

   (288) https://github.com/python/cpython/issues/133866

   (289) https://github.com/python/cpython/issues/133823

   (290) https://github.com/python/cpython/issues/125996

   (291) https://github.com/python/cpython/issues/133817

   (292) https://github.com/python/cpython/issues/133653

   (293) https://github.com/python/cpython/issues/133810

   (294) https://github.com/python/cpython/issues/132641

   (295) https://github.com/python/cpython/issues/133783

   (296) https://github.com/python/cpython/issues/133684

   (297) https://github.com/python/cpython/issues/77057

   (298) https://github.com/python/cpython/issues/130328

   (299) https://github.com/python/cpython/issues/133701

   (300) https://github.com/python/cpython/issues/133656

   (301) https://github.com/python/cpython/issues/133722

   (302) https://github.com/python/cpython/issues/133489

   (303) https://github.com/python/cpython/issues/133595

   (304) https://github.com/python/cpython/issues/133581

   (305) https://github.com/python/cpython/issues/133577

   (306) https://github.com/python/cpython/issues/92897

   (307) https://github.com/python/cpython/issues/133551

   (308) https://peps.python.org/pep-0750/

   (309) https://github.com/python/cpython/issues/133517

   (310) https://github.com/python/cpython/issues/133439

   (311) https://github.com/python/cpython/issues/133447

   (312) https://github.com/python/cpython/issues/133253

   (313) https://github.com/python/cpython/issues/133390

   (314) https://github.com/python/cpython/issues/132493

   (315) https://github.com/python/cpython/issues/133017

   (316) https://github.com/python/cpython/issues/132813

   (317) https://github.com/python/cpython/issues/132969

   (318) https://github.com/python/cpython/issues/132876

   (319) https://github.com/python/cpython/issues/133009

   (320) https://github.com/python/cpython/issues/132908

   (321) https://github.com/python/cpython/issues/95380

   (322) https://github.com/python/cpython/issues/122781

   (323) https://github.com/python/cpython/issues/123471

   (324) https://github.com/python/cpython/issues/127081

   (325) https://github.com/python/cpython/issues/127081

   (326) https://github.com/python/cpython/issues/127081

   (327) https://github.com/python/cpython/issues/132551

   (328) https://github.com/python/cpython/issues/107583

   (329) https://github.com/python/cpython/issues/87790

   (330) https://github.com/python/cpython/issues/87790

   (331) https://github.com/python/cpython/issues/131884

   (332) https://github.com/python/cpython/issues/131788

   (333) https://github.com/python/cpython/issues/91349

   (334) https://github.com/python/cpython/issues/131146

   (335) https://github.com/python/cpython/issues/123471

   (336) https://github.com/python/cpython/issues/130664

   (337) https://github.com/python/cpython/issues/130999

   (338) https://github.com/python/cpython/issues/88473

   (339) https://github.com/python/cpython/issues/126883

   (340) https://github.com/python/cpython/issues/125028

   (341) https://github.com/python/cpython/issues/125843

   (342) https://github.com/python/cpython/issues/119109

   (343) https://github.com/python/cpython/issues/124033

   (344) https://github.com/python/cpython/issues/91216

   (345) https://github.com/python/cpython/issues/120492

   (346) https://github.com/python/cpython/issues/99631

   (347) https://github.com/python/cpython/issues/119186

   (348) https://github.com/python/cpython/issues/120170

   (349) https://github.com/python/cpython/issues/118981

   (350) https://github.com/python/cpython/issues/105497

   (351) https://github.com/python/cpython/issues/99813

   (352) https://github.com/python/cpython/issues/62824

   (353) https://github.com/python/cpython/issues/86155

   (354) https://github.com/python/cpython/issues/78319

   (355) https://github.com/python/cpython/issues/93334

   (356) https://github.com/python/cpython/issues/69426

   (357) https://bugs.python.org/issue?@action=redirect&bpo=38735

   (358) https://bugs.python.org/issue?@action=redirect&bpo=45959

   (359) https://github.com/python/cpython/issues/84683

   (360) https://bugs.python.org/issue?@action=redirect&bpo=43429

   (361) https://bugs.python.org/issue?@action=redirect&bpo=41839

   (362) https://bugs.python.org/issue?@action=redirect&bpo=28494


File: python.info,  Node: IDLE<5>,  Next: ドキュメント<7>,  Prev: ライブラリ<15>,  Up: Python 3 15 0 alpha 1

1.26.10.7 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<15>,  Prev: IDLE<5>,  Up: Python 3 15 0 alpha 1

1.26.10.8 ドキュメント
......................

   - gh-136155(1): We are now checking for fatal errors in EPUB builds
     in CI.

   - gh-135171(2): Document that the *note iterator: 6d4. for the
     leftmost ‘for’ clause in the generator expression is created
     immediately.

   - bpo-45210(3): Document that error indicator may be set in
     tp_dealloc, and how to avoid clobbering it.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136155

   (2) https://github.com/python/cpython/issues/135171

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45210


File: python.info,  Node: Core and Builtins<15>,  Next: ライブラリ<16>,  Prev: ドキュメント<7>,  Up: Python 3 15 0 alpha 1

1.26.10.9 Core and Builtins
...........................

   - gh-140000(1): Fix potential memory leak when a reference cycle
     exists between an instance of *note typing.TypeAliasType: 531,
     *note typing.TypeVar: 29f, *note typing.ParamSpec: 2a0, or *note
     typing.TypeVarTuple: 29e. and its ‘__name__’ attribute.  Patch by
     Mikhail Efimov.

   - gh-140009(2): Improve performance of list extension by dictionary
     items.

   - gh-139988(3): Fix a memory leak when failing to create a *note
     Union: 349. type.  Patch by Bénédikt Tran.

   - gh-139748(4): Fix reference leaks in error branches of functions
     accepting path strings or bytes such as *note compile(): 1d3. and
     *note os.system(): 1815.  Patch by Bénédikt Tran.

   - gh-139516(5): Fix lambda colon erroneously start format spec in
     f-string in tokenizer.

   - gh-63161(6): 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.

   - gh-139116(7): Prevent a deadlock when multiple threads start, stop
     and use *note tracemalloc: 108. simultaneously.

   - gh-139275(8): Fix compilation problems in
     ‘_remote_debugging_module.c’ when the system doesn't have
     ‘process_vm_readv’.  Patch by Pablo Galindo

   - gh-133059(9): Increased the number of cached small positive
     integers from 256 to 1024.

   - gh-74857(10): PEP 538(11): Coerce the POSIX locale to a UTF-8 based
     locale.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140000

   (2) https://github.com/python/cpython/issues/140009

   (3) https://github.com/python/cpython/issues/139988

   (4) https://github.com/python/cpython/issues/139748

   (5) https://github.com/python/cpython/issues/139516

   (6) https://github.com/python/cpython/issues/63161

   (7) https://github.com/python/cpython/issues/139116

   (8) https://github.com/python/cpython/issues/139275

   (9) https://github.com/python/cpython/issues/133059

   (10) https://github.com/python/cpython/issues/74857

   (11) https://peps.python.org/pep-0538/


File: python.info,  Node: ライブラリ<16>,  Next: Core and Builtins<16>,  Prev: Core and Builtins<15>,  Up: Python 3 15 0 alpha 1

1.26.10.10 ライブラリ
.....................

   - gh-116738(1): Make *note mmap: 94. thread-safe on the *note free
     threaded: 48e. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<16>,  Next: ライブラリ<17>,  Prev: ライブラリ<16>,  Up: Python 3 15 0 alpha 1

1.26.10.11 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-138794(3): When a new tracing function is registered with *note
     PyRefTracer_SetTracer(): 80b, replacing the current a call to the
     trace function will be made with the object set to 'NULL' and
     'event' set to *note PyRefTracer_TRACKER_REMOVED: 1a6b.  This will
     happen just before the new function is registered.  Patch by Pablo
     Galindo

   - gh-71810(4): Raise *note OverflowError: c5b. for ‘(-1).to_bytes()’
     for signed conversions when bytes count is zero.  Patch by Sergey B
     Kirpichev.

   - gh-138716(5): Improve *note SyntaxError: 189. message for *note
     assert: d35. in cases like ‘assert a := b’.

   - gh-105487(6): Remove non-existent *note __copy__(): 1a6c, *note
     __deepcopy__(): 192a, and *note __bases__: 1864. from the *note
     __dir__(): 1956. entries of *note types.GenericAlias: bcb.

   - gh-138192(7): Fix *note contextvars: 28. initialization so that all
     subinterpreters are assigned the *note MISSING: 1a6d. value.

   - gh-138479(8): Fix a crash when a generic object's
     ‘__typing_subst__’ returns an object that isn't a *note tuple: 1d9.

   - gh-138431(9): Fix a bug in the JIT optimizer when round-tripping
     strings and tuples.

   - gh-138378(10): Move the globals-to-const JIT optimizer pass into to
     the main JIT optimizer pass

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/138558

   (2) https://github.com/python/cpython/issues/134466

   (3) https://github.com/python/cpython/issues/138794

   (4) https://github.com/python/cpython/issues/71810

   (5) https://github.com/python/cpython/issues/138716

   (6) https://github.com/python/cpython/issues/105487

   (7) https://github.com/python/cpython/issues/138192

   (8) https://github.com/python/cpython/issues/138479

   (9) https://github.com/python/cpython/issues/138431

   (10) https://github.com/python/cpython/issues/138378


File: python.info,  Node: ライブラリ<17>,  Next: Core and Builtins<17>,  Prev: Core and Builtins<16>,  Up: Python 3 15 0 alpha 1

1.26.10.12 ライブラリ
.....................

   - gh-138401(1): Add missing validation of argument ‘count’ in *note
     os.sendfile(): ed7. to be non-negative.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/138401


File: python.info,  Node: Core and Builtins<17>,  Next: ライブラリ<18>,  Prev: ライブラリ<17>,  Up: Python 3 15 0 alpha 1

1.26.10.13 Core and Builtins
............................

   - gh-138372(1): Fix *note SyntaxWarning: 451. emitted for erroneous
     subscript expressions involving *note template string literals:
     1a70.  Patch by Brian Schubert.

   - gh-138302(2): ‘BINARY_OP’ now specializes to ‘BINARY_OP_ADD_INT’,
     ‘BINARY_OP_SUBTRACT_INT’ or ‘BINARY_OP_MULTIPLY_INT’ if operands
     are compact ints.

   - gh-138318(3): The default REPL now avoids highlighting built-in
     names (for instance *note set: 432. or *note format(): 440.) when
     they are used as attribute names (for instance in ‘value.set’ or
     ‘text.format’).

   - gh-138349(4): Fix crash in certain cases where a module contains
     both a module-level annotation and a comprehension.

   - gh-69605(5): Fix some standard library submodules missing from the
     *note REPL: 6a3. auto-completion of imports.

   - gh-61206(6): *note zipimport: 13b. now supports zstandard
     compressed zip file entries.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/138372

   (2) https://github.com/python/cpython/issues/138302

   (3) https://github.com/python/cpython/issues/138318

   (4) https://github.com/python/cpython/issues/138349

   (5) https://github.com/python/cpython/issues/69605

   (6) https://github.com/python/cpython/issues/61206


File: python.info,  Node: ライブラリ<18>,  Next: Core and Builtins<18>,  Prev: Core and Builtins<17>,  Up: Python 3 15 0 alpha 1

1.26.10.14 ライブラリ
.....................

   - gh-116738(1): Make ‘cProfile’ thread-safe on the *note free
     threaded: 48e. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<18>,  Next: ライブラリ<19>,  Prev: ライブラリ<18>,  Up: Python 3 15 0 alpha 1

1.26.10.15 Core and Builtins
............................

   - gh-137838(1): Fix JIT trace buffer overrun by increasing possible
     exit stubs.  Patch by Donghee Na.

   - gh-71679(2): Use the same quoting algorithm for the repr of
     bytearrays as for bytes objects and strings - use double quotes for
     quoting if the bytearray contains single quotes and does not
     contain double quotes.

   - gh-137384(3): Fix a crash when using the *note warnings: 11b.
     module in a finalizer at shutdown.  Patch by Kumar Aditya.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137838

   (2) https://github.com/python/cpython/issues/71679

   (3) https://github.com/python/cpython/issues/137384


File: python.info,  Node: ライブラリ<19>,  Next: Core and Builtins<19>,  Prev: Core and Builtins<18>,  Up: Python 3 15 0 alpha 1

1.26.10.16 ライブラリ
.....................

   - gh-138004(1): 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.

   - gh-137976(2): Removed ‘localtime’ from the list of reported system
     timezones.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/138004

   (2) https://github.com/python/cpython/issues/137976


File: python.info,  Node: Core and Builtins<19>,  Next: ライブラリ<20>,  Prev: ライブラリ<19>,  Up: Python 3 15 0 alpha 1

1.26.10.17 Core and Builtins
............................

   - gh-137992(1): Ensure that *note PyRefTracer_SetTracer(): 80b. sync
     with all existing threads when called to avoid races in the free
     threaded build.  Patch by Pablo Galindo

   - gh-137967(2): Show error suggestions on nested attribute access.
     Patch by Pablo Galindo

   - gh-137959(3): Replace the shim code added to every piece of jitted
     code with a single trampoline function.

   - gh-137883(4): Fix runaway recursion when calling a function with
     keyword arguments.

   - gh-137079(5): Fix keyword typo recognition when parsing files.
     Patch by Pablo Galindo.

   - gh-137728(6): Fix the JIT's handling of many local variables.  This
     previously caused a segfault.

   - gh-137716(7): Fix double period in *note AttributeError: 1b4.
     message for invalid mock assertions

   - gh-137433(8): Fix a potential deadlock in the *note free threading:
     48e. build when daemon threads enable or disable profiling or
     tracing while the main thread is shutting down the interpreter.

   - gh-137576(9): Fix for incorrect source code being shown in
     tracebacks from the Basic REPL when *note PYTHONSTARTUP: 45a. is
     given.  Patch by Adam Hartz.

   - gh-37817(10): Allow assignment to *note __bases__: 1864. of direct
     subclasses of builtin classes.

   - gh-132732(11): Optimize ‘_COMPARE_OP’, ‘_CONTAINS_OP’,
     ‘_UNARY_NEGATIVE’, ‘_UNARY_NOT’, and ‘_UNARY_INVERT’ in JIT builds
     with constant-loading uops (‘_POP_TWO_LOAD_CONST_INLINE_BORROW’ and
     ‘_POP_TOP_LOAD_CONST_INLINE_BORROW’), and then remove both to
     reduce instruction count.

   - gh-137400(12): Fix a crash in the *note free threading: 48e. build
     when disabling profiling or tracing across all threads with *note
     PyEval_SetProfileAllThreads(): 96b. or *note
     PyEval_SetTraceAllThreads(): 857. or their Python equivalents *note
     threading.settrace_all_threads(): 8dd. and *note
     threading.setprofile_all_threads(): 8de.

   - gh-133143(13): Add *note sys.abi_info: 27a. object to make ABI
     information more easily accessible.

   - gh-137400(14): Fix a crash in the *note free threading: 48e. build
     when disabling profiling or tracing across all threads with *note
     PyEval_SetProfileAllThreads(): 96b. or *note
     PyEval_SetTraceAllThreads(): 857. or their Python equivalents *note
     threading.settrace_all_threads(): 8dd. and *note
     threading.setprofile_all_threads(): 8de.

   - gh-120037(15): Disable user site packages directory when a ‘._pth’
     file is used, even if it contains ‘import site’.

   - gh-58124(16): 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-136966(17): The *note object.__dict__: 1ca. and ‘__weakref__’
     descriptors now use a single descriptor instance per interpreter,
     shared across all types that need them.  This speeds up class
     creation, and helps avoid reference cycles.

   - gh-137314(18): 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(19): A standalone docstring in a node body is optimized
     as a *note pass: 42e. statement to ensure that the node's body is
     never empty.  There was a *note ValueError: 15a. in *note
     compile(): 1d3. otherwise.

   - gh-137288(20): Fix bug where some bytecode instructions of a
     boolean expression are not associated with the correct exception
     handler.

   - gh-137291(21): The perf profiler can now be used if a previous
     frame evaluation API has been provided.

   - gh-134291(22): Remove some newer macOS API usage from the JIT
     compiler in order to restore compatibility with older OSX 10.15
     deployment targets.

   - gh-88886(23): The codecs lookup function now again performs only
     minimal normalization of the encoding name before passing it to the
     search functions: all ASCII letters are converted to lower case,
     spaces are replaced with hyphens.  This restores the pre-Python 3.9
     behavior.

   - gh-131338(24): Disable computed stack limit checks on non-glibc
     linux platforms to fix crashes on deep recursion.

   - gh-136870(25): Fix data races while de-instrumenting bytecode of
     code objects running concurrently in threads.

   - gh-132732(26): Optimize constant comparison for ‘_COMPARE_OP_INT’,
     ‘_COMPARE_OP_FLOAT’ and ‘_COMPARE_OP_STR’ in JIT builds

   - gh-127598(27): Improve *note ModuleNotFoundError: 1c9. by adding
     flavour text to the exception when the *note -S: 1566. option is
     passed.  Patch by Andrea Mattei.

   - gh-136801(28): Fix PyREPL syntax highlighting on match cases after
     multi-line case.  Contributed by Olga Matoula.

   - gh-74185(29): The *note __repr__(): 1c7. of *note ImportError: 1c8.
     and *note ModuleNotFoundError: 1c9. now shows "name" and "path" as
     ‘name=<name>’ and ‘path=<path>’ if they were given as keyword
     arguments at construction time.  Patch by Serhiy Storchaka, Oleg
     Iarygin, and Yoav Nir

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137992

   (2) https://github.com/python/cpython/issues/137967

   (3) https://github.com/python/cpython/issues/137959

   (4) https://github.com/python/cpython/issues/137883

   (5) https://github.com/python/cpython/issues/137079

   (6) https://github.com/python/cpython/issues/137728

   (7) https://github.com/python/cpython/issues/137716

   (8) https://github.com/python/cpython/issues/137433

   (9) https://github.com/python/cpython/issues/137576

   (10) https://github.com/python/cpython/issues/37817

   (11) https://github.com/python/cpython/issues/132732

   (12) https://github.com/python/cpython/issues/137400

   (13) https://github.com/python/cpython/issues/133143

   (14) https://github.com/python/cpython/issues/137400

   (15) https://github.com/python/cpython/issues/120037

   (16) https://github.com/python/cpython/issues/58124

   (17) https://github.com/python/cpython/issues/136966

   (18) https://github.com/python/cpython/issues/137314

   (19) https://github.com/python/cpython/issues/137308

   (20) https://github.com/python/cpython/issues/137288

   (21) https://github.com/python/cpython/issues/137291

   (22) https://github.com/python/cpython/issues/134291

   (23) https://github.com/python/cpython/issues/88886

   (24) https://github.com/python/cpython/issues/131338

   (25) https://github.com/python/cpython/issues/136870

   (26) https://github.com/python/cpython/issues/132732

   (27) https://github.com/python/cpython/issues/127598

   (28) https://github.com/python/cpython/issues/136801

   (29) https://github.com/python/cpython/issues/74185


File: python.info,  Node: ライブラリ<20>,  Next: Core and Builtins<20>,  Prev: Core and Builtins<19>,  Up: Python 3 15 0 alpha 1

1.26.10.18 ライブラリ
.....................

   - gh-116738(1): Make functions in *note syslog: e5. thread-safe on
     the *note free threaded: 48e. build.

   - gh-116738(2): Make functions in *note pwd: ba. thread-safe on the
     *note free threaded: 48e. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738

   (2) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<20>,  Next: ライブラリ<21>,  Prev: ライブラリ<20>,  Up: Python 3 15 0 alpha 1

1.26.10.19 Core and Builtins
............................

   - gh-136616(1): Improve *note SyntaxError: 189. error messages for
     invalid *note assert: d35. usages.

   - gh-136599(2): Improve performance of *note int: 32e. hash
     calculations.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136616

   (2) https://github.com/python/cpython/issues/136599


File: python.info,  Node: ライブラリ<21>,  Next: Core and Builtins<21>,  Prev: Core and Builtins<20>,  Up: Python 3 15 0 alpha 1

1.26.10.20 ライブラリ
.....................

   - gh-136421(1): Fix crash when initializing *note datetime: 33.
     concurrently.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136421


File: python.info,  Node: Core and Builtins<21>,  Next: ライブラリ<22>,  Prev: ライブラリ<21>,  Up: Python 3 15 0 alpha 1

1.26.10.21 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.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136541


File: python.info,  Node: ライブラリ<22>,  Next: Core and Builtins<22>,  Prev: Core and Builtins<21>,  Up: Python 3 15 0 alpha 1

1.26.10.22 ライブラリ
.....................

   - gh-107545(1): Improve the error messages that may be raised by
     *note setsockopt(): 1097.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/107545


File: python.info,  Node: Core and Builtins<22>,  Next: ライブラリ<23>,  Prev: ライブラリ<22>,  Up: Python 3 15 0 alpha 1

1.26.10.23 Core and Builtins
............................

   - gh-136517(1): Fixed a typo that prevented printing of uncollectable
     objects when the *note gc.DEBUG_UNCOLLECTABLE: 1580. mode was set.

   - gh-136525(2): Fix issue where per-thread bytecode was not
     instrumented for newly created threads.

   - gh-132657(3): Improve performance of *note frozenset: 9d9. by
     removing locks in the free-threading build.

   - gh-136459(4): Add support for perf trampoline on macOS, to allow
     profilers wit JIT map support to read Python calls.  While
     profiling, ‘PYTHONPERFSUPPORT=1’ can be appended to enable the
     trampoline.

   - gh-132661(5): ‘Interpolation.expression’ now has a default, the
     empty string.

   - gh-132661(6): Reflect recent PEP 750(7) change.

     Disallow concatenation of ‘string.templatelib.Template’ and *note
     str: 1ea.  Also, disallow implicit concatenation of t-string
     literals with string or f-string literals.

   - gh-91636(8): 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-136355(9): Deprecate *note -b: 2f9. and ‘-bb’ command line
     options and schedule them to become no-op in Python 3.17.

   - gh-109700(10): Fix memory error handling in *note
     PyDict_SetDefault(): 7e2.

   - gh-135552(11): Fix a bug caused by the garbage collector clearing
     weakrefs too early.  The weakrefs in the ‘tp_subclasses’ dictionary
     are needed in order to correctly invalidate type caches (for
     example, by calling ‘PyType_Modified()’).  Clearing weakrefs before
     calling finalizers causes the caches to not be correctly
     invalidated.  That can cause crashes since the caches can refer to
     invalid objects.  Defer the clearing of weakrefs without callbacks
     until after finalizers are executed.

   - gh-136203(12): Improve *note TypeError: 29c. error message, when
     richcomparing two *note types.MappingProxyType: 194. objects.

   - gh-136003(13): Fix *note threading.Thread: 427. objects becoming
     incorrectly daemon when created from an *note atexit: d. callback
     or a pending call (*note Py_AddPendingCall(): d4d.).

   - gh-78465(14): Fix error message for ‘cls.__new__(cls, ...)’ where
     ‘cls’ is not instantiable builtin or extension type (with ‘tp_new’
     set to ‘NULL’).

   - gh-135904(15): Perform more aggressive control-flow optimizations
     on the machine code templates emitted by the experimental JIT
     compiler.

   - gh-129958(16): Differentiate between t-strings and f-strings in
     syntax error for newlines in format specifiers of single-quoted
     interpolated strings.

   - gh-135871(17): Non-blocking mutex lock attempts now return
     immediately when the lock is busy instead of briefly spinning in
     the *note free threading: 48e. build.

   - gh-134584(18): Specialize *note POP_TOP: 1a7b. in the JIT compiler
     by specializing for reference lifetime and type.  This will also
     enable easier top of stack caching in the JIT compiler.

   - gh-135106(19): Restrict the trashcan mechanism to GC'ed objects and
     untrack them while in the trashcan to prevent the GC and trashcan
     mechanisms conflicting.

   - gh-135379(20): Changes specialization of ‘BINARY_OP’ for ints to
     only specialize for "compact" ints.  This streamlines the fast path
     at the cost of fewer specializations when very large integers are
     used.

   - gh-135607(21): Fix potential *note weakref: 11d. races in an
     object's destructor on the *note free threaded: 48e. build.

   - gh-135608(22): Fix a crash in the JIT involving attributes of
     modules.

   - gh-82088(23): Improve performance of ‘PyLongObject’ conversion
     functions ‘PyLong_AsLongAndOverflow()’, ‘PyLong_AsSsize_t()’,
     ‘PyLong_AsUnsignedLong()’, ‘PyLong_AsSize_t()’,
     ‘PyLong_AsUnsignedLongMask()’, ‘PyLong_AsUnsignedLongLongMask()’,
     ‘PyLong_AsLongLongAndOverflow()’ for integers larger than 2**30 up
     to 30%.

   - gh-135551(24): Sorting randomly ordered lists will often run a bit
     faster, thanks to a new scheme for picking minimum run lengths from
     Stefan Pochmann, which arranges for the merge tree to be as evenly
     balanced as is possible.

   - gh-135543(25): Emit ‘sys.remote_exec’ audit event when *note
     sys.remote_exec(): 41f. is called and migrate
     ‘remote_debugger_script’ to ‘cpython.remote_debugger_script’.

   - gh-135496(26): Fix typo in the f-string conversion type error
     ("exclamanation" -> "exclamation").

   - gh-135474(27): Specialize integer operations only on compact
     integers.  This is a CPython internal change.

   - gh-135371(28): 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.

   - gh-135422(29): Fix regression in *note SyntaxError: 189. messages
     after gh-134036(30).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136517

   (2) https://github.com/python/cpython/issues/136525

   (3) https://github.com/python/cpython/issues/132657

   (4) https://github.com/python/cpython/issues/136459

   (5) https://github.com/python/cpython/issues/132661

   (6) https://github.com/python/cpython/issues/132661

   (7) https://peps.python.org/pep-0750/

   (8) https://github.com/python/cpython/issues/91636

   (9) https://github.com/python/cpython/issues/136355

   (10) https://github.com/python/cpython/issues/109700

   (11) https://github.com/python/cpython/issues/135552

   (12) https://github.com/python/cpython/issues/136203

   (13) https://github.com/python/cpython/issues/136003

   (14) https://github.com/python/cpython/issues/78465

   (15) https://github.com/python/cpython/issues/135904

   (16) https://github.com/python/cpython/issues/129958

   (17) https://github.com/python/cpython/issues/135871

   (18) https://github.com/python/cpython/issues/134584

   (19) https://github.com/python/cpython/issues/135106

   (20) https://github.com/python/cpython/issues/135379

   (21) https://github.com/python/cpython/issues/135607

   (22) https://github.com/python/cpython/issues/135608

   (23) https://github.com/python/cpython/issues/82088

   (24) https://github.com/python/cpython/issues/135551

   (25) https://github.com/python/cpython/issues/135543

   (26) https://github.com/python/cpython/issues/135496

   (27) https://github.com/python/cpython/issues/135474

   (28) https://github.com/python/cpython/issues/135371

   (29) https://github.com/python/cpython/issues/135422

   (30) https://github.com/python/cpython/issues/134036


File: python.info,  Node: ライブラリ<23>,  Next: Core and Builtins<23>,  Prev: Core and Builtins<22>,  Up: Python 3 15 0 alpha 1

1.26.10.24 ライブラリ
.....................

   - gh-116738(1): Make functions in *note grp: 69. thread-safe on the
     *note free threaded: 48e. build.

   - gh-127319(2): 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/116738

   (2) https://github.com/python/cpython/issues/127319


File: python.info,  Node: Core and Builtins<23>,  Next: ライブラリ<24>,  Prev: ライブラリ<23>,  Up: Python 3 15 0 alpha 1

1.26.10.25 Core and Builtins
............................

   - gh-130077(1): Properly raise custom syntax errors when incorrect
     syntax containing names that are prefixes of soft keywords is
     encountered.  Patch by Pablo Galindo.

   - gh-131798(2): Optimize _CALL_LEN in the JIT when the length is
     known.  Patch by Tomas Roun

   - gh-131798(3): Optimize ‘_UNARY_NEGATIVE’ in JIT-compiled code.

   - gh-135148(4): 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-131798(5): Optimize ‘_UNARY_INVERT’ in JIT-compiled code.

   - gh-131798(6): Optimize away ‘_CALL_TYPE_1’ in the JIT when the
     return type is known.  Patch by Tomas Roun

   - gh-133136(7): Limit excess memory usage in the *note free
     threading: 48e. build when a large dictionary or list is resized
     and accessed by multiple threads.

   - gh-131798(8): Optimize ‘_CHECK_METHOD_VERSION’ into
     ‘_CHECK_FUNCTION_VERSION_INLINE’ in JIT-compiled code.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130077

   (2) https://github.com/python/cpython/issues/131798

   (3) https://github.com/python/cpython/issues/131798

   (4) https://github.com/python/cpython/issues/135148

   (5) https://github.com/python/cpython/issues/131798

   (6) https://github.com/python/cpython/issues/131798

   (7) https://github.com/python/cpython/issues/133136

   (8) https://github.com/python/cpython/issues/131798


File: python.info,  Node: ライブラリ<24>,  Next: Core and Builtins<24>,  Prev: Core and Builtins<23>,  Up: Python 3 15 0 alpha 1

1.26.10.26 ライブラリ
.....................

   - gh-116738(1): Make methods in *note heapq: 6c. thread-safe on the
     *note free threaded: 48e. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<24>,  Next: ライブラリ<25>,  Prev: ライブラリ<24>,  Up: Python 3 15 0 alpha 1

1.26.10.27 Core and Builtins
............................

   - gh-134280(1): Disable constant folding for ‘~’ with a boolean
     argument.  This moves the deprecation warning from compile time to
     runtime.

   - gh-134876(2): Add support to PEP 768(3) remote debugging for Linux
     kernels which don't have CONFIG_CROSS_MEMORY_ATTACH configured.

   - gh-134889(4): Fix handling of a few opcodes that leave operands on
     the stack when optimizing ‘LOAD_FAST’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134280

   (2) https://github.com/python/cpython/issues/134876

   (3) https://peps.python.org/pep-0768/

   (4) https://github.com/python/cpython/issues/134889


File: python.info,  Node: ライブラリ<25>,  Next: Core and Builtins<25>,  Prev: Core and Builtins<24>,  Up: Python 3 15 0 alpha 1

1.26.10.28 ライブラリ
.....................

   - gh-134908(1): Fix crash when iterating over lines in a text file on
     the *note free threaded: 48e. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134908


File: python.info,  Node: Core and Builtins<25>,  Next: ライブラリ<26>,  Prev: ライブラリ<25>,  Up: Python 3 15 0 alpha 1

1.26.10.29 Core and Builtins
............................

   - gh-117852(1): Fix argument checking of *note athrow(): 90b.

   - gh-132617(2): Fix *note dict.update(): 181d. 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-131798(3): Allow the JIT to remove unnecessary
     ‘_ITER_CHECK_TUPLE’ ops.

   - gh-134679(4): Fix crash in the *note free threading: 48e. build's
     QSBR code that could occur when changing an object's ‘__dict__’
     attribute.

   - gh-133912(5): Fix the C API function ‘PyObject_GenericSetDict’ to
     handle extension classes with inline values.

   - gh-131798(6): Make the JIT optimizer understand that slicing a
     string/list/tuple returns the same type.

   - gh-134584(7): Add a reference count elimination pass to the JIT
     compiler.  Patch by Ken Jin.

   - gh-131798(8): Optimize ‘_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117852

   (2) https://github.com/python/cpython/issues/132617

   (3) https://github.com/python/cpython/issues/131798

   (4) https://github.com/python/cpython/issues/134679

   (5) https://github.com/python/cpython/issues/133912

   (6) https://github.com/python/cpython/issues/131798

   (7) https://github.com/python/cpython/issues/134584

   (8) https://github.com/python/cpython/issues/131798


File: python.info,  Node: ライブラリ<26>,  Next: Core and Builtins<26>,  Prev: Core and Builtins<25>,  Up: Python 3 15 0 alpha 1

1.26.10.30 ライブラリ
.....................

   - gh-134381(1): Fix *note RuntimeError: 317. when using a not-started
     *note threading.Thread: 427. after calling *note os.fork(): 6c3.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134381


File: python.info,  Node: Core and Builtins<26>,  Next: ライブラリ<27>,  Prev: ライブラリ<26>,  Up: Python 3 15 0 alpha 1

1.26.10.31 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-131798(3): JIT: replace ‘_LOAD_SMALL_INT’ with
     ‘_LOAD_CONST_INLINE_BORROW’

   - gh-131798(4): Improve the JIT's ability to optimize away cached
     class attribute and method loads.

   - gh-128066(5): 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-131798(6): Improve the JIT's ability to narrow unknown classes
     to constant values.

   - gh-134268(7): Add ‘_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW’ and use
     it to further optimize ‘CALL_ISINSTANCE’.

   - gh-131798(8): Split ‘CALL_LIST_APPEND’ into several uops.  Patch by
     Diego Russo.

   - gh-69605(9): When auto-completing an import in the *note REPL: 6a3,
     finding no candidates now issues no suggestion, rather than
     suggestions from the current namespace.

   - gh-134170(10): Add colorization to *note sys.unraisablehook(): 712.
     by default.

   - gh-91153(11): Fix a crash when a *note bytearray: 1d1. is
     concurrently mutated during item assignment.

   - gh-134158(12): Fix coloring of double braces in f-strings and
     t-strings in the *note REPL: 6a3.

   - gh-134119(13): Fix crash when calling *note next(): bb9. on an
     exhausted template string iterator.  Patch by Jelle Zijlstra.

   - gh-134100(14): Fix a use-after-free bug that occurs when an
     imported module isn't in *note sys.modules: 19da. after its initial
     import.  Patch by Nico-Posada.

   - gh-134036(15): Improve *note SyntaxError: 189. message when using
     invalid *note raise: 9e9. statements.

   - gh-133999(16): Fix *note SyntaxError: 189. regression in *note
     except: 44e. parsing after gh-123440(17).

   - gh-133886(18): Fix *note sys.remote_exec(): 41f. for non-ASCII
     paths in non-UTF-8 locales and non-UTF-8 paths in UTF-8 locales.

   - gh-133400(19): Fixed Ctrl+D (^D) behavior in _pyrepl module to
     match old pre-3.13 REPL behavior.

   - gh-133703(20): Fix hashtable in dict can be bigger than intended in
     some situations.

   - gh-133778(21): Fix bug where assigning to the *note
     __annotations__: 1a84. attributes of classes defined under ‘from
     __future__ import annotations’ had no effect.

   - gh-133711(22): Implement PEP 686(23): Enable *note Python UTF-8
     Mode: a4b. by default.  Patch by Adam Turner.

   - gh-132762(24): *note fromkeys(): 4e1. no longer loops forever when
     adding a small set of keys to a large base dict.  Patch by Angela
     Liss.

   - gh-133541(25): Inconsistent indentation in user input crashed the
     new REPL when syntax highlighting was active.  This is now fixed.

   - gh-133516(26): Raise *note ValueError: 15a. when constants ‘True’,
     ‘False’ or ‘None’ are used as an identifier after NFKC
     normalization.

   - gh-131798(27): Allow the JIT to remove int guards after ‘_GET_LEN’
     by setting the return type to int.

   - gh-131798(28): Split ‘CALL_ISINSTANCE’ into several uops, allowing
     the JIT to remove some of them.

   - gh-132554(29): Change iteration to use "virtual iterators" for
     sequences.  Instead of creating an iterator, a tagged integer
     representing the next index is pushed to the stack above the
     iterable.  For non-sequence iterators, ‘NULL’ is pushed.

   - gh-130821(30): Enhance wrong type error messages and make them more
     consistent.  Patch by Semyon Moroz.

   - gh-131798(31): Narrow the return type and constant-evaluate
     ‘CALL_ISINSTANCE’ for a subset of known values in the JIT. Patch by
     Tomas Roun

   - gh-132542(32): Update *note Thread.native_id: e06. after
     ‘fork(2)(33)’ 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/131798

   (4) https://github.com/python/cpython/issues/131798

   (5) https://github.com/python/cpython/issues/128066

   (6) https://github.com/python/cpython/issues/131798

   (7) https://github.com/python/cpython/issues/134268

   (8) https://github.com/python/cpython/issues/131798

   (9) https://github.com/python/cpython/issues/69605

   (10) https://github.com/python/cpython/issues/134170

   (11) https://github.com/python/cpython/issues/91153

   (12) https://github.com/python/cpython/issues/134158

   (13) https://github.com/python/cpython/issues/134119

   (14) https://github.com/python/cpython/issues/134100

   (15) https://github.com/python/cpython/issues/134036

   (16) https://github.com/python/cpython/issues/133999

   (17) https://github.com/python/cpython/issues/123440

   (18) https://github.com/python/cpython/issues/133886

   (19) https://github.com/python/cpython/issues/133400

   (20) https://github.com/python/cpython/issues/133703

   (21) https://github.com/python/cpython/issues/133778

   (22) https://github.com/python/cpython/issues/133711

   (23) https://peps.python.org/pep-0686/

   (24) https://github.com/python/cpython/issues/132762

   (25) https://github.com/python/cpython/issues/133541

   (26) https://github.com/python/cpython/issues/133516

   (27) https://github.com/python/cpython/issues/131798

   (28) https://github.com/python/cpython/issues/131798

   (29) https://github.com/python/cpython/issues/132554

   (30) https://github.com/python/cpython/issues/130821

   (31) https://github.com/python/cpython/issues/131798

   (32) https://github.com/python/cpython/issues/132542

   (33) https://manpages.debian.org/fork(2)


File: python.info,  Node: ライブラリ<27>,  Next: Core and Builtins<27>,  Prev: Core and Builtins<26>,  Up: Python 3 15 0 alpha 1

1.26.10.32 ライブラリ
.....................

   - gh-132732(1): Automatically constant evaluate bytecode operations
     marked as pure in the JIT optimizer.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132732


File: python.info,  Node: Core and Builtins<27>,  Next: ライブラリ<28>,  Prev: ライブラリ<27>,  Up: Python 3 15 0 alpha 1

1.26.10.33 Core and Builtins
............................

   - gh-127971(1): Fix off-by-one read beyond the end of a string in
     string search.

   - gh-132042(2): Improve class creation times by up to 12% by
     pre-computing type slots just once.  Patch by Sergey Miryanov.

   - gh-133379(3): Correct usage of 'arguments' in error messages.

   - gh-127266(4): In the free-threaded build, avoid data races caused
     by updating type slots or type flags after the type was initially
     created.  For those (typically rare) cases, use the stop-the-world
     mechanism.  Remove the use of atomics when reading or writing type
     flags.  The use of atomics is not sufficient to avoid races (since
     flags are sometimes read without a lock and without atomics) and
     are no longer required.

   - gh-130425(5): Add ‘"Did you mean: 'attr'?"’ suggestion when using
     ‘del obj.attr’ if ‘attr’ does not exist.

   - gh-128640(6): Fix a crash when using threads inside of a
     subinterpreter.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127971

   (2) https://github.com/python/cpython/issues/132042

   (3) https://github.com/python/cpython/issues/133379

   (4) https://github.com/python/cpython/issues/127266

   (5) https://github.com/python/cpython/issues/130425

   (6) https://github.com/python/cpython/issues/128640


File: python.info,  Node: ライブラリ<28>,  Next: Core and Builtins<28>,  Prev: Core and Builtins<27>,  Up: Python 3 15 0 alpha 1

1.26.10.34 ライブラリ
.....................

   - gh-116738(1): Make the module *note json: 85. safe to use under the
     free-threading build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<28>,  Next: C API<9>,  Prev: ライブラリ<28>,  Up: Python 3 15 0 alpha 1

1.26.10.35 Core and Builtins
............................

   - gh-119494(1): Exception text when trying to delete attributes of
     types was clarified.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/119494


File: python.info,  Node: C API<9>,  Next: ビルド<8>,  Prev: Core and Builtins<28>,  Up: Python 3 15 0 alpha 1

1.26.10.36 C API
................

   - gh-139924(1): Function watchers can now receive a
     PyFunction_PYFUNC_EVENT_MODIFY_QUALNAME event when a watched
     functions qualname is changed.

   - gh-111489(2): Add *note PyTuple_FromArray(): 372. to create a *note
     tuple: 1d9. from an array.  Patch by Victor Stinner.

   - gh-136355(3): Deprecate *note PyConfig.bytes_warning: 3cc. field
     and schedule its removal in 3.17.

   - gh-138886(4): Remove deprecated ‘PySys_ResetWarnOptions()’ C-API
     function.

   - gh-129813(5): Implement PEP 782(6), the *note PyBytesWriter: 3bc.
     API. Add functions:

        * *note PyBytesWriter_Create(): 364.

        * *note PyBytesWriter_Discard(): 365.

        * *note PyBytesWriter_FinishWithPointer(): 366.

        * *note PyBytesWriter_FinishWithSize(): 367.

        * *note PyBytesWriter_Finish(): 368.

        * *note PyBytesWriter_Format(): 369.

        * *note PyBytesWriter_GetData(): 36a.

        * *note PyBytesWriter_GetSize(): 36b.

        * *note PyBytesWriter_GrowAndUpdatePointer(): 36c.

        * *note PyBytesWriter_Grow(): 36d.

        * *note PyBytesWriter_Resize(): 36e.

        * *note PyBytesWriter_WriteBytes(): 36f.

     Patch by Victor Stinner.

   - gh-137956(7): Display and raise an exception if an extension
     compiled for non-free-threaded Python is loaded in a free-threaded
     interpreter.

   - gh-137573(8): Mark ‘_PyOptimizer_Optimize’ as *note Py_NO_INLINE:
     1a8a. to prevent stack overflow crashes on macOS.

   - gh-128813(9): Functions *note _Py_c_sum(): 3c5, *note _Py_c_diff():
     3c6, *note _Py_c_neg(): 3c7, *note _Py_c_prod(): 3c8, *note
     _Py_c_quot(): 3c9, *note _Py_c_pow(): 3ca. and previously
     undocumented *note _Py_c_abs(): 3cb. are *note soft deprecated:
     1b2.  Deprecate also *note cval: 3c0. field of the *note
     PyComplexObject: 3c1. type.  Patch by Sergey B Kirpichev.

   - gh-137210(10): Add API for checking an extension module's ABI
     compatibility: *note Py_mod_abi: 360, *note PyABIInfo_Check(): 361,
     *note PyABIInfo_VAR: 362. and ‘Py_mod_abi’.

   - gh-136759(11): Rename ‘lock.h’ to ‘pylock.h’ to avoid potential
     include conflicts.

   - gh-112068(12): Revert support of nullable arguments in *note
     PyArg_Parse(): 1a8b.

   - gh-136006(13): On Solaris, the ‘Py_NAN’ macro now expands to a
     ‘double’ instead of a function address.  Patch by Bénédikt Tran.

   - gh-135075(14): Make *note PyObject_SetAttr(): 1948. and *note
     PyObject_SetAttrString(): 1a8c. fail if called with ‘NULL’ value
     and an exception set.  Patch by Victor Stinner.

   - gh-135906(15): Fix compilation errors when compiling the internal
     headers with a C++ compiler.

   - gh-133296(16): New variants for the critical section API that
     accept one or two *note PyMutex: 699. pointers rather than *note
     PyObject: 1a6. instances are now public in the non-limited C API.

   - gh-133157(17): Remove the private, undocumented macro
     ‘_Py_NO_SANITIZE_UNDEFINED’.

   - gh-134989(18): 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(19): Implement *note PyObject_DelAttr(): 1a8d. and *note
     PyObject_DelAttrString(): 1a8e. as macros in the limited C API 3.12
     and older.  Patch by Victor Stinner.

   - gh-134745(20): Change ‘PyThread_allocate_lock()’ implementation to
     ‘PyMutex’.  On Windows, ‘PyThread_acquire_lock_timed()’ now
     supports the 'intr_flag' parameter: it can be interrupted.  Patch
     by Victor Stinner.

   - gh-134891(21): Add *note PyUnstable_Unicode_GET_CACHED_HASH: 35f.
     to get the cached hash of a string.

   - gh-134009(22): Expose *note PyMutex_IsLocked(): 67d. as part of the
     public C API.

   - gh-134144(23): Fix crash when calling *note Py_EndInterpreter():
     1a8f. with a *note thread state: 1a90. that isn't the initial
     thread for the interpreter.

   - gh-133968(24): Add *note PyUnicodeWriter_WriteASCII(): 5ed.
     function to write an ASCII string into a *note PyUnicodeWriter:
     5e7.  The function is faster than *note
     PyUnicodeWriter_WriteUTF8(): 5f3, but has an undefined behavior if
     the input string contains non-ASCII characters.  Patch by Victor
     Stinner.

   - gh-133644(25): Remove deprecated Python initialization getter
     functions ‘Py_Get*’.  Patch by Bénédikt Tran.

   - gh-133644(26): Remove deprecated function ‘PyWeakref_GetObject()’
     and macro ‘PyWeakref_GET_OBJECT’.  Use *note PyWeakref_GetRef():
     3ac. instead.  Patch by Bénédikt Tran.

   - gh-133644(27): Remove deprecated alias
     ‘PyImport_ImportModuleNoBlock()’ of *note PyImport_ImportModule():
     3ab.  Patch by Bénédikt Tran.

   - gh-133610(28): Remove deprecated functions
     ‘PyUnicode_AsDecodedObject()’, ‘PyUnicode_AsDecodedUnicode()’,
     ‘PyUnicode_AsEncodedObject()’, and ‘PyUnicode_AsEncodedUnicode()’.

   - gh-132629(29): For unsigned integer formats in *note
     PyArg_ParseTuple(): 3b9, accepting Python integers with value that
     is larger than the maximal value for the C type or less than the
     minimal value for the corresponding signed integer type of the same
     size is now deprecated.

   - gh-131185(30): *note PyGILState_Ensure(): 1b0. no longer crashes
     when called after interpreter finalization.

   - gh-108512(31): Add functions *note PySys_GetAttr(): 35a, *note
     PySys_GetAttrString(): 35b, *note PySys_GetOptionalAttr(): 35c. and
     *note PySys_GetOptionalAttrString(): 35d.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139924

   (2) https://github.com/python/cpython/issues/111489

   (3) https://github.com/python/cpython/issues/136355

   (4) https://github.com/python/cpython/issues/138886

   (5) https://github.com/python/cpython/issues/129813

   (6) https://peps.python.org/pep-0782/

   (7) https://github.com/python/cpython/issues/137956

   (8) https://github.com/python/cpython/issues/137573

   (9) https://github.com/python/cpython/issues/128813

   (10) https://github.com/python/cpython/issues/137210

   (11) https://github.com/python/cpython/issues/136759

   (12) https://github.com/python/cpython/issues/112068

   (13) https://github.com/python/cpython/issues/136006

   (14) https://github.com/python/cpython/issues/135075

   (15) https://github.com/python/cpython/issues/135906

   (16) https://github.com/python/cpython/issues/133296

   (17) https://github.com/python/cpython/issues/133157

   (18) https://github.com/python/cpython/issues/134989

   (19) https://github.com/python/cpython/issues/134989

   (20) https://github.com/python/cpython/issues/134745

   (21) https://github.com/python/cpython/issues/134891

   (22) https://github.com/python/cpython/issues/134009

   (23) https://github.com/python/cpython/issues/134144

   (24) https://github.com/python/cpython/issues/133968

   (25) https://github.com/python/cpython/issues/133644

   (26) https://github.com/python/cpython/issues/133644

   (27) https://github.com/python/cpython/issues/133644

   (28) https://github.com/python/cpython/issues/133610

   (29) https://github.com/python/cpython/issues/132629

   (30) https://github.com/python/cpython/issues/131185

   (31) https://github.com/python/cpython/issues/108512


File: python.info,  Node: ビルド<8>,  Prev: C API<9>,  Up: Python 3 15 0 alpha 1

1.26.10.37 ビルド
.................

   - gh-138489(1): 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-138497(2): The LLVM version used by the JIT at build time can
     now be modified using the ‘LLVM_VERSION’ environment variable.  Use
     this at your own risk, as there is only one officially supported
     LLVM version.  For more information, please check
     ‘Tools/jit/README.md’.

   - gh-95952(3): When cross-compiling for WASI, require that the
     HOSTRUNNER environment variable be explicitly set.

     This was needed as macOS lacks the appropriate CLI tools to set a
     reasonable default.

   - gh-138061(4): Ensure reproducible builds by making JIT stencil
     header generation deterministic.

   - gh-128042(5): ‘./configure’ now warns when ‘--enable-optimizations’
     and ‘CFLAGS=-O0’ are both set, suggesting removing ‘-O0’ from
     ‘CFLAGS’ for optimal performance.  Patch by Taegyun Kim.

   - gh-132339(6): Add support for OpenSSL 3.5.

   - gh-135621(7): PyREPL no longer depends on the *note curses: 2e.
     standard library.  Contributed by Łukasz Langa.

   - gh-135927(8): Fix building with MSVC when passing option
     ‘/std:clatest’.

   - gh-119132(9): Remove "experimental" tag from the CPython
     free-threading build.

   - gh-135497(10): Fix the detection of ‘MAXLOGNAME’ in the
     ‘configure.ac’ script.

   - gh-134923(11): Windows builds with profile-guided optimization
     enabled now use ‘/GENPROFILE’ and ‘/USEPROFILE’ instead of
     deprecated ‘/LTCG:’ options.

   - gh-134632(12): 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(13), instead of the
     top-level include directory.

   - gh-134486(14): The *note ctypes: 2d. module now performs a more
     portable test for the definition of ‘alloca(3)(15)’, fixing a
     compilation failure on NetBSD.

   - gh-134455(16): Fixed ‘build-details.json’ generation to use the
     correct ‘c_api.headers’ as defined in PEP 739(17), instead of
     ‘c_api.include’.

   - gh-134273(18): Add support for configuring compiler flags for the
     JIT with ‘CFLAGS_JIT’

   - gh-115119(19): Removed implicit fallback to the bundled copy of the
     ‘libmpdec’ library.  Now this should be explicitly enabled via
     ‘--with-system-libmpdec’ set to ‘no’ or
     ‘--without-system-libmpdec’.  Patch by Sergey B Kirpichev.

   - gh-131769(20): Fix detecting when the build Python in a cross-build
     is a pydebug build.

   - gh-117088(21): AIX linker don't support -h option, so avoid it
     through platform check

   - gh-123681(22): Check the ‘strftime()’ behavior at runtime instead
     of at the compile time to support cross-compiling.  Remove the
     internal macro ‘_Py_NORMALIZE_CENTURY’.

   - gh-127545(23): Fix crash when building on Linux/m68k.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/138489

   (2) https://github.com/python/cpython/issues/138497

   (3) https://github.com/python/cpython/issues/95952

   (4) https://github.com/python/cpython/issues/138061

   (5) https://github.com/python/cpython/issues/128042

   (6) https://github.com/python/cpython/issues/132339

   (7) https://github.com/python/cpython/issues/135621

   (8) https://github.com/python/cpython/issues/135927

   (9) https://github.com/python/cpython/issues/119132

   (10) https://github.com/python/cpython/issues/135497

   (11) https://github.com/python/cpython/issues/134923

   (12) https://github.com/python/cpython/issues/134632

   (13) https://peps.python.org/pep-0739/

   (14) https://github.com/python/cpython/issues/134486

   (15) https://manpages.debian.org/alloca(3)

   (16) https://github.com/python/cpython/issues/134455

   (17) https://peps.python.org/pep-0739/

   (18) https://github.com/python/cpython/issues/134273

   (19) https://github.com/python/cpython/issues/115119

   (20) https://github.com/python/cpython/issues/131769

   (21) https://github.com/python/cpython/issues/117088

   (22) https://github.com/python/cpython/issues/123681

   (23) https://github.com/python/cpython/issues/127545


File: python.info,  Node: Python 3 14 0 beta 1,  Next: Python 3 14 0 alpha 7,  Prev: Python 3 15 0 alpha 1,  Up: 変更履歴

1.26.11 Python 3.14.0 beta 1
----------------------------

'Release date: 2025-05-06'

* Menu:

* Windows: Windows<9>.
* Tools/Demos: Tools/Demos<6>.
* テスト: テスト<11>.
* セキュリティ: セキュリティ<9>.
* ライブラリ: ライブラリ<29>.
* IDLE: IDLE<6>.
* ドキュメント: ドキュメント<8>.
* Core and Builtins: Core and Builtins<29>.
* ライブラリ: ライブラリ<30>.
* Core and Builtins: Core and Builtins<30>.
* ライブラリ: ライブラリ<31>.
* Core and Builtins: Core and Builtins<31>.
* ライブラリ: ライブラリ<32>.
* C API: C API<10>.
* ビルド: ビルド<9>.


File: python.info,  Node: Windows<9>,  Next: Tools/Demos<6>,  Up: Python 3 14 0 beta 1

1.26.11.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():
     525. 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<6>,  Next: テスト<11>,  Prev: Windows<9>,  Up: Python 3 14 0 beta 1

1.26.11.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: テスト<11>,  Next: セキュリティ<9>,  Prev: Tools/Demos<6>,  Up: Python 3 14 0 beta 1

1.26.11.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: セキュリティ<9>,  Next: ライブラリ<29>,  Prev: テスト<11>,  Up: Python 3 14 0 beta 1

1.26.11.4 セキュリティ
......................

   - gh-115322(1): The underlying extension modules behind *note
     readline: c2.:, *note subprocess: df, and *note ctypes: 2d. 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: ライブラリ<29>,  Next: IDLE<6>,  Prev: セキュリティ<9>,  Up: Python 3 14 0 beta 1

1.26.11.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(): 15b2.

   - gh-130645(3): Add color to stdlib argparse CLIs.  Patch by Hugo van
     Kemenade.

   - gh-119180(4): Make *note annotationlib.get_annotations(): 673.
     succeed with the ‘FORWARDREF’ format if evaluating the annotations
     throws an exception other than *note NameError: 66c. or *note
     AttributeError: 1b4.

   - 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: 1a98. 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(): 1a99. and *note glob.translate(): 706.

   - gh-133306(11): Support ‘\z’ as a synonym for ‘\Z’ in *note regular
     expressions: c1.

   - gh-133300(12): Make *note argparse.ArgumentParser: 1e7.'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_: 1a9a. 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(): 490.
     function, a refinement of the *note curses.use_default_colors():
     491. function which allows to change the color pair ‘0’.

   - gh-133089(17): Use original timeout value for *note
     subprocess.TimeoutExpired: 19cc. when the func *note
     subprocess.run(): f49. 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(): 334. is now deprecated.  Use
     *note open(): 333. instead.  Contributed by Inada Naoki.

   - gh-132987(19): Many builtin and extension functions which accept an
     unsigned integer argument, now use *note __index__(): 444. 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(): 122b. 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: de. module.  Patch by Sergey B
     Kirpichev.

   - gh-132915(27): *note fcntl.fcntl(): 1983. and *note fcntl.ioctl():
     1833. can now detect a buffer overflow and raise *note SystemError:
     3f1.  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(): 1a9b.
     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: 349. 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(): 1983. now supports arbitrary
     *note bytes-like objects: 43d, not only *note bytes: 1d2.  *note
     fcntl.ioctl(): 1833. 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(): 151.  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: d4.

   - gh-132673(39): Fix *note AssertionError: a9c. raised on *note
     ctypes.Structure: 483. 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: 1a9c. and *note
     multiprocessing.RLock: 1a9d. classes.

   - gh-121468(42): Add *note pdb.set_trace_async(): 508. function to
     support *note await: 439. statements in *note pdb: aa.

   - gh-132493(43): *note typing.Protocol: 772. now uses *note
     annotationlib.get_annotations(): 673. when checking whether or not
     an instance implements the protocol with *note isinstance(): 2fb.
     This enables support for ‘isinstance’ checks against classes with
     deferred annotations.

   - gh-132536(44): Do not disable *note PY_THROW: 27d. 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: 6cb.

   - gh-132099(46): The Bluetooth socket with the *note BTPROTO_HCI:
     510. 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(): 14b0. 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: 772.
     classes with annotations that cannot be resolved at class creation
     time.

   - gh-132491(49): Rename ‘annotationlib.value_to_string’ to *note
     annotationlib.type_repr(): 1a9e. and provide better handling for
     function objects.

   - gh-132426(50): Add *note
     annotationlib.get_annotate_from_class_namespace(): 675. 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: 510.).

   - gh-131913(52): Add a shortcut function *note
     multiprocessing.Process.interrupt(): 4e4. alongside the existing
     *note multiprocessing.Process.terminate(): 1a9f. and *note
     multiprocessing.Process.kill(): f19. 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: 4d7. now raises a *note
     RuntimeError: 317. if the listener is already started.

   - gh-132417(56): Fix a ‘NULL’ pointer dereference when a C function
     called using *note ctypes: 2d. with ‘restype’ *note py_object: 48d.
     returns ‘NULL’.

   - gh-132385(57): Fix instance error suggestions trigger potential
     exceptions in *note object.__getattr__(): 8e8. in *note traceback:
     107.

   - gh-125866(58): Add optional 'add_scheme' argument to *note
     urllib.request.pathname2url(): 542.; when set to true, a complete
     URL is returned.  Likewise add optional 'require_scheme' argument
     to *note url2pathname(): 540.; when set to true, a complete URL is
     accepted.

   - gh-132308(59): A *note traceback.TracebackException: 76a. now
     correctly renders the ‘__context__’ and ‘__cause__’ attributes from
     *note falsey: 1aa0. *note Exception: da2, and the ‘exceptions’
     attribute from falsey *note ExceptionGroup: 6de.

   - 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: 1988.
     objects no longer uses the internal ‘__code__’ and ‘__ast_node__’
     attributes, which are used as caches.

   - gh-132250(63): Fixed the *note SystemError: 3f1. in ‘cProfile’ when
     locating the actual C function of a method raises an exception.

   - gh-132064(64): *note annotationlib.get_annotations(): 673. now uses
     the ‘__annotate__’ attribute if it is present, even if
     ‘__annotations__’ is not present.  Additionally, the function now
     raises a *note TypeError: 29c. 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: 1cd.'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: 211. and *note
     concurrent.futures.ThreadPoolExecutor: b2c.

   - gh-132106(68): *note logging.handlers.QueueListener: 4d6. now
     implements the context manager protocol, allowing it to be used in
     a *note with: 215. 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(): 4c4.  Preserve class signature
     after wrapping with *note warnings.deprecated(): 69b.  Patch by
     Xuehai Pan.

   - gh-118761(72): Improve import times by up to 33x for the *note
     shlex: cc. module, and improve the performance of *note
     shlex.quote(): 787. by up to 12x.  Patch by Adam Turner.

   - gh-85302(73): Add support for *note BTPROTO_SCO: 511. in sockets on
     FreeBSD.

   - gh-131757(74): Make *note functools.lru_cache(): db7. call the
     cached function unlocked to allow concurrency.

   - gh-131423(75): *note ssl: d8. 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(): 17e5.

   - gh-131524(77): Add help message to *note platform: af. command-line
     interface.  Contributed by Harry Lees.

   - gh-100926(78): Move *note ctypes.POINTER(): 48b. types cache from a
     global internal cache (‘_pointer_type_cache’) to the *note
     ctypes._CData.__pointer_type__: 48c. attribute of the corresponding
     *note ctypes: 2d. 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: 140f.

   - gh-123471(80): Make concurrent iterations over *note
     itertools.repeat: 1aa1. 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(): a0d, only accept ASCII strings for
     consistency with the C implementation.

   - gh-130941(83): Fix *note configparser.ConfigParser: 6ea. parsing
     empty interpolation with ‘allow_no_value’ set to ‘True’.

   - gh-110067(84): Make *note heapq: 6c. max-heap functions *note
     heapq.heapify_max(): 4b6, *note heapq.heappush_max(): 4b7, *note
     heapq.heappop_max(): 4b8, and *note heapq.heapreplace_max(): 4b9.
     public.  Previous underscored naming is kept for backwards
     compatibility.  Additionally, the missing function *note
     heapq.heappushpop_max(): 4ba. has been added to both the C and
     Python implementations.

   - gh-129098(85): Fix REPL traceback reporting when using *note
     compile(): 1d3. 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(): 4b2. for optional visual keyboard feedback
     support.  Patch by Semyon Moroz.

   - gh-130317(89): Fix *note PyFloat_Pack2(): b4c. and *note
     PyFloat_Unpack2(): b4f. for NaN's with payload.  This corrects
     round-trip for *note struct.unpack(): 1aa2. and *note
     struct.pack(): 1630. 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: 691.

   - gh-130167(91): Improve speed of *note difflib.IS_LINE_JUNK(): 559.
     Patch by Semyon Moroz.

   - gh-101410(92): Added more detailed messages for domain errors in
     the *note math: 91. module.

   - gh-128384(93): Make *note warnings.catch_warnings: 42a. use a
     context variable for holding the warning filtering state if the
     *note sys.flags.context_aware_warnings: 436. 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
     *note -X context_aware_warnings: 183. command-line option or by the
     *note PYTHON_CONTEXT_AWARE_WARNINGS: 1aa3. 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: 2d4. for *note
     sys._clear_type_cache(): 34c.  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(): 46a.

   - gh-127604(97): Add support for printing the C stack trace on
     systems that support it via *note faulthandler.dump_c_stack(): 4a6.
     or via the 'c_stack' argument in *note faulthandler.enable(): 224.

   - gh-127385(98): Add the ‘F_DUPFD_QUERY’ constant to the *note fcntl:
     5c. module.

   - gh-126838(99): Add 'resolve_host' keyword-only parameter to *note
     urllib.request.url2pathname(): 540, and fix handling of file URLs
     with authorities.

   - gh-82129(100): Fix *note NameError: 66c. when calling *note
     typing.get_type_hints(): aa3. on a *note dataclasses.dataclass():
     6ec. created by *note dataclasses.make_dataclass(): 190d. with
     un-annotated fields.

   - gh-122559(101): Remove ‘__reduce__()’ and ‘__reduce_ex__()’ methods
     that always raise *note TypeError: 29c. in the C implementation of
     *note io.FileIO: 16c9, *note io.BufferedReader: 15cb, *note
     io.BufferedWriter: 176a. and *note io.BufferedRandom: 176b. 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(): a38. now raises *note
     BlockingIOError: 4ca. 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(): 498. 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: 11e.: 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: 2e.
     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(): 159.  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: ドキュメント<8>,  Prev: ライブラリ<29>,  Up: Python 3 14 0 beta 1

1.26.11.6 IDLE
..............

   - gh-112936(1): fix IDLE: no Shell menu item in single-process mode.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112936


File: python.info,  Node: ドキュメント<8>,  Next: Core and Builtins<29>,  Prev: IDLE<6>,  Up: Python 3 14 0 beta 1

1.26.11.7 ドキュメント
......................

   - gh-107006(1): Move documentation and example code for *note
     threading.local: 1aa6. 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<29>,  Next: ライブラリ<30>,  Prev: ドキュメント<8>,  Up: Python 3 14 0 beta 1

1.26.11.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(): b4d. and *note PyFloat_Unpack4(): b50. on RISC-V.

   - gh-133197(7): Improve *note SyntaxError: 189. error messages for
     incompatible string / bytes prefixes.

   - gh-133231(8): Add new utilities of observing JIT compilation: *note
     sys._jit.is_available(): 669, *note sys._jit.is_enabled(): 66a, and
     *note sys._jit.is_active(): 1aa8.

   ---------- 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: ライブラリ<30>,  Next: Core and Builtins<30>,  Prev: Core and Builtins<29>,  Up: Python 3 14 0 beta 1

1.26.11.9 ライブラリ
....................

   - gh-133194(1): *note ast.parse(): 1d4. 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<30>,  Next: ライブラリ<31>,  Prev: ライブラリ<30>,  Up: Python 3 14 0 beta 1

1.26.11.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: 82.  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: 193. and *note set: 432.  Patch by Victor Stinner.

   - gh-131591(10): Reset any PEP 768(11) remote debugging pending call
     in children after *note os.fork(): 6c3. 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__(): 18a0. of a
     *note method: 1aab. with a *note None: a6a. 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: ライブラリ<31>,  Next: Core and Builtins<31>,  Prev: Core and Builtins<30>,  Up: Python 3 14 0 beta 1

1.26.11.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<31>,  Next: ライブラリ<32>,  Prev: ライブラリ<31>,  Up: Python 3 14 0 beta 1

1.26.11.12 Core and Builtins
............................

   - gh-132639(1): Added *note PyLong_AsNativeBytes(): 802, *note
     PyLong_FromNativeBytes(): 803. and *note
     PyLong_FromUnsignedNativeBytes(): 804. 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: 11b. filters.

   - gh-132457(6): Make *note staticmethod(): 66d. and *note
     classmethod(): 6a0. 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(): 190.

   - 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__: 1aae. was not
     deleted, when *note type.__annotations__: 1a84. 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(): 97a.  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: 216. (resp.  *note with: 215.)
     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(): 448. now try calling
     *note __rpow__(): 449. 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(): 190.
     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: 426.
     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: 427. will, by default,
          use a copy of the *note contextvars.Context: 428. from the
          caller of *note threading.Thread.start(): 429. rather than
          using an empty context.

        * Add the *note -X thread_inherit_context: 183. command-line
          option and *note PYTHON_THREAD_INHERIT_CONTEXT: 1aaf.
          environment variable, which set the *note
          thread_inherit_context: 426. flag.

        * Add the ‘context’ keyword parameter to *note Thread: 427.  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: 189. message for using
     ‘import ... as’ and ‘from ... import ... as’ with not a name.

   - gh-102567(34): *note -X importtime: 183. 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: 29c.
     occurs during *note dict.update(): 181d.

   - gh-103997(36): String arguments passed to "-c" are now
     automatically dedented.  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: ライブラリ<32>,  Next: C API<10>,  Prev: Core and Builtins<31>,  Up: Python 3 14 0 beta 1

1.26.11.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<10>,  Next: ビルド<9>,  Prev: ライブラリ<32>,  Up: Python 3 14 0 beta 1

1.26.11.14 C API
................

   - gh-133166(1): Fix regression where *note PyType_GetModuleByDef():
     82d. returns NULL without setting *note TypeError: 29c. when a
     static type is passed.

   - gh-133164(2): Add *note
     PyUnstable_Object_IsUniqueReferencedTemporary(): 5fa. 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(): 552. 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():
     5f9. as a replacement for ‘Py_REFNCT(op) == 1’ on *note free
     threaded: 48e. builds of Python.

   - gh-131747(4): On non-Windows platforms, deprecate using *note
     ctypes.Structure._pack_: 320. to use a Windows-compatible layout on
     non-Windows platforms.  The layout should be specified explicitly
     by setting *note ctypes.Structure._layout_: 321. to ‘'ms'’.

   - gh-128972(5): For non-free-threaded builds, the memory layout of
     *note PyASCIIObject: 1533. 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(): 1a8b.
     now support the *note __index__(): 444. special method, like all
     other integer formats.

   - gh-132909(8): Fix an overflow when handling the *note K: 1ab2.
     format in *note Py_BuildValue(): 5f5.  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: 485. with a
     'byte_size' that does not match the actual type size now raises a
     *note ValueError: 15a. instead of crashing the interpreter.

   - gh-112068(11): [Reverted in gh-136991(12)] Add support of nullable
     arguments in *note PyArg_Parse(): 1a8b. 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(): 3b9. and
     other *note argument parsing: 608. functions if 'items' contains
     format units which store a *note borrowed buffer: 609. or a *note
     borrowed reference: 60a.

   ---------- 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: ビルド<9>,  Prev: C API<10>,  Up: Python 3 14 0 beta 1

1.26.11.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.26.12 Python 3.14.0 alpha 7
-----------------------------

'リリース日: 2025-04-08'

* Menu:

* macOS: macOS<5>.
* Windows: Windows<10>.
* Tools/Demos: Tools/Demos<7>.
* テスト: テスト<12>.
* セキュリティ: セキュリティ<10>.
* ライブラリ: ライブラリ<33>.
* ドキュメント: ドキュメント<9>.
* Core and Builtins: Core and Builtins<32>.
* ライブラリ: ライブラリ<34>.
* Core and Builtins: Core and Builtins<33>.
* C API: C API<11>.
* ビルド: ビルド<10>.


File: python.info,  Node: macOS<5>,  Next: Windows<10>,  Up: Python 3 14 0 alpha 7

1.26.12.1 macOS
...............

   - gh-124111(1): Update macOS installer to use Tcl/Tk 8.6.16.

   - gh-131423(2): Update macOS installer to use OpenSSL 3.0.16.  Patch
     by Bénédikt Tran.

   - gh-131025(3): Update macOS installer to ship with SQLite 3.49.1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124111

   (2) https://github.com/python/cpython/issues/131423

   (3) https://github.com/python/cpython/issues/131025


File: python.info,  Node: Windows<10>,  Next: Tools/Demos<7>,  Prev: macOS<5>,  Up: Python 3 14 0 alpha 7

1.26.12.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: 120.

   - gh-91349(3): Replaces our copy of ‘zlib’ with ‘zlib-ng’, for
     performance improvements in *note zlib: 13c.

   - 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<7>,  Next: テスト<12>,  Prev: Windows<10>,  Up: Python 3 14 0 alpha 7

1.26.12.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: テスト<12>,  Next: セキュリティ<10>,  Prev: Tools/Demos<7>,  Up: Python 3 14 0 alpha 7

1.26.12.4 テスト
................

   - gh-131277(1): Allow to unset one or more environment variables at
     once via *note EnvironmentVarGuard.unset(): 1ab9.  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: セキュリティ<10>,  Next: ライブラリ<33>,  Prev: テスト<12>,  Up: Python 3 14 0 alpha 7

1.26.12.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: ライブラリ<33>,  Next: ドキュメント<9>,  Prev: セキュリティ<10>,  Up: Python 3 14 0 alpha 7

1.26.12.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: df. to control the
     use of *note os.posix_spawn(): 736.

   - gh-132159(4): Do not shadow user arguments in generated ‘__new__()’
     by decorator *note warnings.deprecated: 69b.  Patch by Xuehai Pan.

   - gh-132168(5): The *note ctypes.py_object: 48d. type now supports
     subscription, making it a *note generic type: 1dc.

   - 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: ab6. 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: d4. 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: db. module.  Patch by Adam Turner.

   - gh-125434(9): Display thread name in *note faulthandler: 5b.  Patch
     by Victor Stinner.

   - gh-132002(10): Fix crash when deallocating *note
     contextvars.ContextVar: 1abc. with weird unahashable string names.

   - gh-131938(11): *note xml.etree.ElementTree: 12e.: update the error
     message when an element to remove via *note Element.remove: 19a2.
     is not found.  Patch by Bénédikt Tran.

   - gh-115942(12): Add *note threading.RLock.locked(): 1a52, *note
     multiprocessing.Lock.locked(): 1abd, *note
     multiprocessing.RLock.locked(): 1abe, and allow *note
     multiprocessing.managers.SyncManager.Lock(): 1750. and *note
     multiprocessing.managers.SyncManager.RLock(): 1751. to proxy
     ‘locked()’ call.

   - gh-131974(13): Fix several thread-safety issues in *note ctypes:
     2d. on the *note free threaded: 48e. build.

   - gh-118761(14): Improve the import time of the *note ast: 9. module
     by extracting the *note unparse(): cba. function to a helper
     module.

   - gh-107369(15): Improved performance of *note textwrap.indent():
     783. by an average of ~1.3x.  Patch by Adam Turner.

   - gh-131792(16): Improved performance of *note textwrap.dedent():
     566. 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: d4.: Fix code parsing AF_BLUETOOTH
     socket addresses.

   - gh-60115(18): Support frozen modules for *note linecache.getline():
     4d4.

   - gh-131492(19): Fix a resource leak when constructing a *note
     gzip.GzipFile: 84f. with a filename fails, for example when passing
     an invalid ‘compresslevel’.

   - gh-131435(20): 10-20% performance improvement of *note
     random.randint(): 15ea.

   - gh-131461(21): Fix *note ResourceWarning: 754. when constructing a
     *note gzip.GzipFile: 84f. in write mode with a broken file object.

   - gh-125866(22): Deprecate the ‘nturl2path’ module.  Call *note
     urllib.request.url2pathname(): 540. and *note pathname2url(): 542.
     instead.

   - gh-126367(23): Fix issue where *note urllib.request.url2pathname():
     540. raised *note OSError: 543. 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(): 1a21. can now detect and
     report the version of ‘musl’ on Alpine Linux.

   - gh-129843(28): Fix incorrect argument passing in *note
     warnings.warn_explicit(): 2b6.

   - gh-70647(29): When creating a *note datetime: 33. object with an
     out of range date a more informative error is raised.

   - gh-130914(30): Allow *note graphlib.TopologicalSorter.prepare():
     4b4. 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: 54a.

   - gh-126895(32): Fix *note readline: c2. in *note free-threaded: 48e.
     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: 89. using lazy
     import ‘re’.  Patch by Semyon Moroz.

   - gh-129598(35): Fix *note ast.unparse(): cba. when *note
     ast.Interactive: 1abf. contains multiple statements.

   - gh-85162(36): The *note http.server: 75. module now includes
     built-in support for HTTPS servers exposed by *note
     http.server.HTTPSServer: 4bd.  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: 1988. now use all attributes on the
     object.  Two ‘ForwardRef’ objects are equal only if all attributes
     are equal.

   - gh-128593(38): *note annotationlib.ForwardRef: 1988. objects no
     longer cache their value when they are successfully evaluated.
     Successive calls to *note annotationlib.ForwardRef.evaluate(): 151.
     may return different values.

   - gh-117779(39): Fix reading duplicated entries in *note zipfile:
     13a. 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: 483./*note Union: 484.
     field descriptors is now available as *note CField: 485, 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: 12e.: Fix a crash in
     *note Element.find: 1ac0, *note Element.findtext: 192b. and *note
     Element.findall: 1ac1. when the tag to find implements an *note
     __eq__(): ec4. method mutating the element being queried.  Patch by
     Bénédikt Tran.

   - gh-127794(43): When headers are added to *note
     email.message.Message: 786. objects, either through *note
     email.message.Message.__setitem__(): 1ac2. or *note
     email.message.Message.add_header(): 1ac3, the field name is now
     validated according to RFC 5322, Section 2.2(44) and a *note
     ValueError: 15a. is raised if the field name contains any invalid
     characters.

   - gh-123599(45): Deprecate ‘pathlib.PurePath.as_uri()’; use *note
     pathlib.Path.as_uri(): 58e. instead.

   - gh-126033(46): *note xml.etree.ElementTree: 12e.: Fix a crash in
     *note Element.remove: 19a2. 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(): 4a8. for excluding
     names matching a pattern.  Patch by Bénédikt Tran.

   - gh-114917(49): Add support for AI_NUMERICSERV in getaddrinfo
     emulation

   - bpo-17254(50): Added aliases for Thai Language using Microsoft Code
     Pages.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132174

   (2) https://github.com/python/cpython/issues/132171

   (3) https://github.com/python/cpython/issues/129204

   (4) https://github.com/python/cpython/issues/132159

   (5) https://github.com/python/cpython/issues/132168

   (6) https://github.com/python/cpython/issues/84481

   (7) https://github.com/python/cpython/issues/132075

   (8) https://github.com/python/cpython/issues/118761

   (9) https://github.com/python/cpython/issues/125434

   (10) https://github.com/python/cpython/issues/132002

   (11) https://github.com/python/cpython/issues/131938

   (12) https://github.com/python/cpython/issues/115942

   (13) https://github.com/python/cpython/issues/131974

   (14) https://github.com/python/cpython/issues/118761

   (15) https://github.com/python/cpython/issues/107369

   (16) https://github.com/python/cpython/issues/131792

   (17) https://github.com/python/cpython/issues/131668

   (18) https://github.com/python/cpython/issues/60115

   (19) https://github.com/python/cpython/issues/131492

   (20) https://github.com/python/cpython/issues/131435

   (21) https://github.com/python/cpython/issues/131461

   (22) https://github.com/python/cpython/issues/125866

   (23) https://github.com/python/cpython/issues/126367

   (24) https://github.com/python/cpython/issues/120144

   (25) https://github.com/python/cpython/issues/131358

   (26) https://github.com/python/cpython/issues/131325

   (27) https://github.com/python/cpython/issues/90548

   (28) https://github.com/python/cpython/issues/129843

   (29) https://github.com/python/cpython/issues/70647

   (30) https://github.com/python/cpython/issues/130914

   (31) https://github.com/python/cpython/issues/131236

   (32) https://github.com/python/cpython/issues/126895

   (33) https://github.com/python/cpython/issues/121468

   (34) https://github.com/python/cpython/issues/118761

   (35) https://github.com/python/cpython/issues/129598

   (36) https://github.com/python/cpython/issues/85162

   (37) https://github.com/python/cpython/issues/129463

   (38) https://github.com/python/cpython/issues/128593

   (39) https://github.com/python/cpython/issues/117779

   (40) https://github.com/python/cpython/issues/128715

   (41) https://github.com/python/cpython/issues/128055

   (42) https://github.com/python/cpython/issues/126037

   (43) https://github.com/python/cpython/issues/127794

   (44) https://datatracker.ietf.org/doc/html/rfc5322.html#section-2.2

   (45) https://github.com/python/cpython/issues/123599

   (46) https://github.com/python/cpython/issues/126033

   (47) https://github.com/python/cpython/issues/120144

   (48) https://github.com/python/cpython/issues/74598

   (49) https://github.com/python/cpython/issues/114917

   (50) https://bugs.python.org/issue?@action=redirect&bpo=17254


File: python.info,  Node: ドキュメント<9>,  Next: Core and Builtins<32>,  Prev: ライブラリ<33>,  Up: Python 3 14 0 alpha 7

1.26.12.7 ドキュメント
......................

   - gh-131417(1): Mention *note asyncio.Future: f8f. and *note
     asyncio.Task: 467. in generic classes list.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131417


File: python.info,  Node: Core and Builtins<32>,  Next: ライブラリ<34>,  Prev: ドキュメント<9>,  Up: Python 3 14 0 alpha 7

1.26.12.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(): abf. as
     an unbound method.

   - gh-131998(3): Fix a crash when using an unbound method *note
     descriptor: 22a. 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(): 41f.
     function to the *note sys: e2. 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: 48e. build.

   - gh-131670(13): Fix *note anext(): bb7. failing on sync *note
     __anext__(): 1ac6. 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(): 5d7, *note PyLong_FromUInt32(): 5d9,
     *note PyLong_FromInt64(): 5d8. and *note PyLong_FromUInt64(): 5da.
     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: ライブラリ<34>,  Next: Core and Builtins<33>,  Prev: Core and Builtins<32>,  Up: Python 3 14 0 alpha 7

1.26.12.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<33>,  Next: C API<11>,  Prev: ライブラリ<34>,  Up: Python 3 14 0 alpha 7

1.26.12.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: 10fb. 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: d13. 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<11>,  Next: ビルド<10>,  Prev: Core and Builtins<33>,  Up: Python 3 14 0 alpha 7

1.26.12.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: ビルド<10>,  Prev: C API<11>,  Up: Python 3 14 0 alpha 7

1.26.12.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.26.13 Python 3.14.0 alpha 6
-----------------------------

'Release date: 2025-03-14'

* Menu:

* macOS: macOS<6>.
* Windows: Windows<11>.
* Tools/Demos: Tools/Demos<8>.
* テスト: テスト<13>.
* セキュリティ: セキュリティ<11>.
* ライブラリ: ライブラリ<35>.
* ドキュメント: ドキュメント<10>.
* Core and Builtins: Core and Builtins<34>.
* ライブラリ: ライブラリ<36>.
* Core and Builtins: Core and Builtins<35>.
* ライブラリ: ライブラリ<37>.
* Core and Builtins: Core and Builtins<36>.
* C API: C API<12>.
* ビルド: ビルド<11>.


File: python.info,  Node: macOS<6>,  Next: Windows<11>,  Up: Python 3 14 0 alpha 6

1.26.13.1 macOS
...............

   - gh-128540(1): Ensure web browser is launched by *note
     webbrowser.open(): 1944. on macOS, even for ‘file://’ URLs.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128540


File: python.info,  Node: Windows<11>,  Next: Tools/Demos<8>,  Prev: macOS<6>,  Up: Python 3 14 0 alpha 6

1.26.13.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/main/PC/launcher2.c


File: python.info,  Node: Tools/Demos<8>,  Next: テスト<13>,  Prev: Windows<11>,  Up: Python 3 14 0 alpha 6

1.26.13.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: テスト<13>,  Next: セキュリティ<11>,  Prev: Tools/Demos<8>,  Up: Python 3 14 0 alpha 6

1.26.13.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: 1a9d.

   - 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: セキュリティ<11>,  Next: ライブラリ<35>,  Prev: テスト<13>,  Up: Python 3 14 0 alpha 6

1.26.13.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: ライブラリ<35>,  Next: ドキュメント<10>,  Prev: セキュリティ<11>,  Up: Python 3 14 0 alpha 6

1.26.13.6 ライブラリ
....................

   - gh-131204(1): Use monospace font from System Font Stack for
     cross-platform support in *note difflib.HtmlDiff: 21f.

   - gh-131196(2): Improve performance of *note uuid.UUID.hex: 1ad2. and
     *note uuid.UUID.__str__: a14.

   - 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(): a91. 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: a19.

   - gh-130959(10): Fix pure-Python implementation of *note
     datetime.time.fromisoformat(): a0e. 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: 84f. before it is
     closed now emits a *note ResourceWarning: 754.

   - gh-130637(12): Add validation for numeric response data in
     poplib.POP3.stat() method

   - gh-130665(13): Only apply locale to *note calendar CLI: 20c. 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(): 1ad3. call.

   - gh-130608(15): Remove 'dirs_exist_ok' argument from *note
     pathlib.Path.copy(): 4f6. and *note copy_into(): 4f7.  These
     methods are new in Python 3.14.

   - gh-130461(16): Remove ‘.. index::’ directives from the *note uuid:
     119. module documentation.  These directives previously created
     entries in the general index for *note getnode(): f6a. as well as
     the *note uuid1(): f6b, *note uuid3(): 568, *note uuid4(): 56a,
     *note uuid5(): 569, and *note uuid8(): 547. 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(): 500. or
     *note pdb.set_trace(): 501. 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(): 4f6. or *note move(): 4f8. has fresh *note
     info: 4fa.

   - 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: 4f6. by making better use
     of *note info: 4fa. internally.

   - gh-130285(23): Fix corner case for *note random.sample(): b30.
     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: 507. when ‘pdb’ is started from an
     interactive console using *note breakpoint(): 500. or *note
     pdb.set_trace(): 501.

   - gh-107773(25): Make *note datetime: 33. subclass *note __repr__():
     1c7. 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: 71b. safe under free-threading.

   - gh-57537(28): Support breakpoints for *note zipimport: 13b. modules
     on *note pdb: aa.

   - gh-130230(29): Fix crash in *note pow(): 448. with only *note
     Decimal: 1cd. 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: 229. methods and descriptors.

   - gh-128520(32): Apply type conversion consistently in *note
     pathlib.PurePath: 8bb. and *note Path: 4f5. methods can accept a
     path object as an argument, such as *note match(): 8c1. and *note
     rename(): 1ad4.  The argument is now converted to path object if it
     lacks a *note with_segments(): 8bc. 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: df.
     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: 29c. in
     *note inspect.Signature.bind(): 1ad5. 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(): 1d4. 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(): a0e. and *note
     datetime.datetime.fromisoformat(): a0f.  Patch by Semyon Moroz.

   - gh-85795(39): Using *note super(): 44a. and ‘__class__’ *note
     closure variable: 1ad6. in user-defined methods of *note
     typing.NamedTuple: 2f0. 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: 81. and removing *note string: db.  Patch
     by Semyon Moroz.

   - gh-129726(42): Fix *note gzip.GzipFile: 84f. raising an unraisable
     exception during garbage collection when referring to a temporary
     object by breaking the reference loop with *note weakref: 11d.

   - gh-127750(43): Remove broken *note
     functools.singledispatchmethod(): 229. caching introduced in
     gh-85160(44).  Achieve the same performance using different
     optimization.

   - gh-129948(45): Add support for shared *note set: 432. to *note
     multiprocessing.managers.SyncManager: 1ad7. via *note
     SyncManager.set(): 4e2.

   - 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: 480.  Patch by Andrew Svetlov.

   - gh-97850(48): Update the deprecation warning of
     ‘importlib.abc.Loader.load_module’.

   - gh-129678(49): *note configparser.ConfigParser: 6ea.: do not write
     an empty unnamed section

   - gh-128641(50): Restore *note configparser.ConfigParser.read():
     1820. performance.

   - gh-129569(51): Fix *note unicodedata.normalize(): ac7. to always
     return a built-in *note str: 1ea. 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(): 1235. 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: d4. ‘BTPROTO_L2CAP’ sockaddr tuple.

   - gh-128703(55): Fix *note mimetypes.guess_type(): 721. to use
     default mapping for empty ‘Content-Type’ in registry.

   - gh-128647(56): Eagerly write to buffers passed to *note
     gzip.GzipFile: 84f.'s *note readinto(): 1ad8. and *note
     readinto1(): 11d3. implementations, avoiding unnecessary
     allocations.  Patch by Chris Markiewicz.

   - gh-128184(57): Improve display of *note annotationlib.ForwardRef:
     1988. object within *note inspect.Signature: 6ee. representations.
     This also fixes a *note NameError: 66c. that was raised when using
     *note dataclasses.dataclass(): 6ec. on classes with unresolvable
     forward references.

   - gh-128041(58): Add *note
     concurrent.futures.ProcessPoolExecutor.terminate_workers(): 478.
     and *note concurrent.futures.ProcessPoolExecutor.kill_workers():
     479. 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: 4cb. and *note
     io.Writer: 4cc. as alternatives to *note typing.IO: 4cd, *note
     typing.TextIO: 4ce, and *note typing.BinaryIO: 4cf.

   - gh-109798(61): Added additional information into error messages in
     *note datetime: 33, and made the messages more consistent between
     the C and Python implementations.  Patch by Semyon Moroz.

   - gh-125746(62): Delay deprecated
     ‘zipimport.zipimporter.load_module()’ removal time to 3.15.  Use
     *note zipimport.zipimporter.exec_module(): 2f5. instead.

   - gh-74028(63): Add the optional ‘buffersize’ parameter to *note
     concurrent.futures.Executor.map(): 47a. 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(): 546. for generating UUIDv7
     objects as specified in RFC 9562(67).  Patch by Bénédikt Tran.

   - gh-89083(68): Add *note uuid.uuid6(): 545. 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(): 333. on platforms where *note os.fstat():
     1149. 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: 52e. an alias for *note
     typing.Union: 349.  Both ‘int | str’ and ‘Union[int, str]’ now
     create instances of the same type.  Patch by Jelle Zijlstra.

   - gh-93096(72): Document the command-line for *note mimetypes: 93.
     It now exits with ‘1’ on failure instead of ‘0’ and ‘2’ on
     incorrect command-line parameters instead of ‘1’.  Also, errors are
     printed to stderr instead of stdout and their text is made tighter.
     Patch by Oleg Iarygin and Hugo van Kemenade.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131204

   (2) https://github.com/python/cpython/issues/131196

   (3) https://github.com/python/cpython/issues/130940

   (4) https://github.com/python/cpython/issues/131123

   (5) https://github.com/python/cpython/issues/93096

   (6) https://github.com/python/cpython/issues/93096

   (7) https://github.com/python/cpython/issues/81267

   (8) https://github.com/python/cpython/issues/93096

   (9) https://github.com/python/cpython/issues/131045

   (10) https://github.com/python/cpython/issues/130959

   (11) https://github.com/python/cpython/issues/130806

   (12) https://github.com/python/cpython/issues/130637

   (13) https://github.com/python/cpython/issues/130665

   (14) https://github.com/python/cpython/issues/130660

   (15) https://github.com/python/cpython/issues/130608

   (16) https://github.com/python/cpython/issues/130461

   (17) https://github.com/python/cpython/issues/130379

   (18) https://github.com/python/cpython/issues/82987

   (19) https://github.com/python/cpython/issues/125377

   (20) https://github.com/python/cpython/issues/125413

   (21) https://github.com/python/cpython/issues/65697

   (22) https://github.com/python/cpython/issues/125413

   (23) https://github.com/python/cpython/issues/130285

   (24) https://github.com/python/cpython/issues/124703

   (25) https://github.com/python/cpython/issues/107773

   (26) https://github.com/python/cpython/issues/130250

   (27) https://github.com/python/cpython/issues/123471

   (28) https://github.com/python/cpython/issues/57537

   (29) https://github.com/python/cpython/issues/130230

   (30) https://github.com/python/cpython/issues/126944

   (31) https://github.com/python/cpython/issues/127750

   (32) https://github.com/python/cpython/issues/128520

   (33) https://github.com/python/cpython/issues/118761

   (34) https://github.com/python/cpython/issues/130164

   (35) https://github.com/python/cpython/issues/130151

   (36) https://github.com/python/cpython/issues/130145

   (37) https://github.com/python/cpython/issues/130139

   (38) https://github.com/python/cpython/issues/127260

   (39) https://github.com/python/cpython/issues/85795

   (40) https://github.com/python/cpython/issues/130082

   (41) https://github.com/python/cpython/issues/118761

   (42) https://github.com/python/cpython/issues/129726

   (43) https://github.com/python/cpython/issues/127750

   (44) https://github.com/python/cpython/issues/85160

   (45) https://github.com/python/cpython/issues/129948

   (46) https://github.com/python/cpython/issues/129965

   (47) https://github.com/python/cpython/issues/129889

   (48) https://github.com/python/cpython/issues/97850

   (49) https://github.com/python/cpython/issues/129678

   (50) https://github.com/python/cpython/issues/128641

   (51) https://github.com/python/cpython/issues/129569

   (52) https://github.com/python/cpython/issues/128231

   (53) https://github.com/python/cpython/issues/96092

   (54) https://github.com/python/cpython/issues/129288

   (55) https://github.com/python/cpython/issues/128703

   (56) https://github.com/python/cpython/issues/128647

   (57) https://github.com/python/cpython/issues/128184

   (58) https://github.com/python/cpython/issues/128041

   (59) https://github.com/python/cpython/issues/130849

   (60) https://github.com/python/cpython/issues/127647

   (61) https://github.com/python/cpython/issues/109798

   (62) https://github.com/python/cpython/issues/125746

   (63) https://github.com/python/cpython/issues/74028

   (64) https://github.com/python/cpython/issues/124927

   (65) https://github.com/python/cpython/issues/124096

   (66) https://github.com/python/cpython/issues/89083

   (67) https://datatracker.ietf.org/doc/html/rfc9562.html

   (68) https://github.com/python/cpython/issues/89083

   (69) https://datatracker.ietf.org/doc/html/rfc9562.html

   (70) https://github.com/python/cpython/issues/117151

   (71) https://github.com/python/cpython/issues/105499

   (72) https://github.com/python/cpython/issues/93096


File: python.info,  Node: ドキュメント<10>,  Next: Core and Builtins<34>,  Prev: ライブラリ<35>,  Up: Python 3 14 0 alpha 6

1.26.13.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(): 1ada, *note
     PyUnicode_Partition(): 1adb. and *note PyUnicode_RPartition():
     1adc.

   ---------- 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<34>,  Next: ライブラリ<36>,  Prev: ドキュメント<10>,  Up: Python 3 14 0 alpha 6

1.26.13.8 Core and Builtins
...........................

   - gh-131141(1): Fix data race in *note sys.monitoring: e3.
     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(): 18b6. and *note
     sys.settrace(): 563. 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: 48e. build
     when constructing a *note code: 1b. object with *note co_consts:
     1ade. 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: 48e.
     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: 7ba. 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: e2. 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():
     296. 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: 1d1. functions for
     *note free threading: 48e.

   - 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: 1c9.

   - gh-129107(26): Make *note bytearray: 1d1. iterator safe under *note
     free threading: 48e.

   - 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: ライブラリ<36>,  Next: Core and Builtins<35>,  Prev: Core and Builtins<34>,  Up: Python 3 14 0 alpha 6

1.26.13.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<35>,  Next: ライブラリ<37>,  Prev: ライブラリ<36>,  Up: Python 3 14 0 alpha 6

1.26.13.10 Core and Builtins
............................

   - gh-129967(1): Fix a race condition in the *note free threading:
     48e. 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: 32a.
     or after an *note else: 328. keyword.

   - gh-129349(4): *note bytes.fromhex(): 43b. and *note
     bytearray.fromhex(): 43c. now accepts ASCII *note bytes: 1d2. and
     *note bytes-like objects: 43d.

   - gh-129149(5): Add fast path for medium-size integers in *note
     PyLong_FromSsize_t(): 1ae1.  Patch by Chris Eibl.

   - gh-129107(6): Make the *note bytearray: 1d1. safe under *note free
     threading: 48e.

   - gh-128974(7): Fix a crash in *note UnicodeError.__str__: a14. when
     custom attributes implement ‘__str__()’ with side-effects.  Patch
     by Bénédikt Tran.

   - gh-126085(8): *note typing.TypeAliasType: 531. 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(): 1d3.  Patch by Pablo Galindo.

   - gh-121464(10): Make concurrent iterations over the same *note
     enumerate(): 1839. 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(): 440. or *note
     f-strings: 441.).  Patch by Sergey B Kirpichev.

   - gh-124445(13): Fix specialization of generic aliases that are
     generic over a *note typing.ParamSpec: 2a0. and have been
     specialized with a nested type variable.

   - gh-120608(14): Adapt *note reversed(): c40. 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: ライブラリ<37>,  Next: Core and Builtins<36>,  Prev: Core and Builtins<35>,  Up: Python 3 14 0 alpha 6

1.26.13.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<36>,  Next: C API<12>,  Prev: ライブラリ<37>,  Up: Python 3 14 0 alpha 6

1.26.13.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<12>,  Next: ビルド<11>,  Prev: Core and Builtins<36>,  Up: Python 3 14 0 alpha 6

1.26.13.13 C API
................

   - gh-111178(1): Fix *note PyCMethod: b4b. API: replace ‘size_t nargs’
     with ‘Py_ssize_t nargs’ in ‘PyCMethod’.  Patch by Victor Stinner.

   - gh-130947(2): Add again *note PySequence_Fast(): 1ae5. 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): 5e8.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 5eb.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 5ea.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 5ee.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 5f0.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 5f1.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 5f3.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 5f3.

        * ‘_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(): 5f5. that allows to take a C integer and produce a
     Python *note bool: 5f6. 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: ビルド<11>,  Prev: C API<12>,  Up: Python 3 14 0 alpha 6

1.26.13.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: 65e.  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.26.14 Python 3.14.0 alpha 5
-----------------------------

'Release date: 2025-02-11'

* Menu:

* macOS: macOS<7>.
* Tools/Demos: Tools/Demos<9>.
* テスト: テスト<14>.
* セキュリティ: セキュリティ<12>.
* ライブラリ: ライブラリ<38>.
* IDLE: IDLE<7>.
* ドキュメント: ドキュメント<11>.
* Core and Builtins: Core and Builtins<37>.
* ライブラリ: ライブラリ<39>.
* Core and Builtins: Core and Builtins<38>.
* ライブラリ: ライブラリ<40>.
* Core and Builtins: Core and Builtins<39>.
* ライブラリ: ライブラリ<41>.
* C API: C API<13>.
* ビルド: ビルド<12>.


File: python.info,  Node: macOS<7>,  Next: Tools/Demos<9>,  Up: Python 3 14 0 alpha 5

1.26.14.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<9>,  Next: テスト<14>,  Prev: macOS<7>,  Up: Python 3 14 0 alpha 5

1.26.14.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: テスト<14>,  Next: セキュリティ<12>,  Prev: Tools/Demos<9>,  Up: Python 3 14 0 alpha 5

1.26.14.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: セキュリティ<12>,  Next: ライブラリ<38>,  Prev: テスト<14>,  Up: Python 3 14 0 alpha 5

1.26.14.4 セキュリティ
......................

   - gh-105704(1): When using *note urllib.parse.urlsplit(): 2ae. and
     *note urllib.parse.urlparse(): 2af. 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: 77. 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: 191d. 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: ライブラリ<38>,  Next: IDLE<7>,  Prev: セキュリティ<12>,  Up: Python 3 14 0 alpha 5

1.26.14.5 ライブラリ
....................

   - gh-129939(1): Comparison pages with highlighted changes generated
     by the *note difflib.HtmlDiff: 21f. class now support dark mode.

   - gh-129928(2): Raise *note sqlite3.ProgrammingError: 584. 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: 11b, 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:
     89. 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:
     1a5e. API. Patch by Hugo van Kemenade.

   - gh-129603(8): Fix bugs where *note sqlite3.Row: 1225. objects could
     segfault if their inherited *note description: 1aed. was set to
     ‘None’.  Patch by Erlend Aasland.

   - gh-129559(9): Add *note bytearray.resize(): 1949. method so *note
     bytearray: 1d1. can be efficiently resized in place.

   - gh-129502(10): Unlikely errors in preparing arguments for *note
     ctypes: 2d. 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(): 712. instead of *note
     sys.excepthook(): be9. and not setting *note sys.last_exc: 8d3. and
     other variables.

   - gh-129403(11): Corrected *note ValueError: 15a. message for *note
     asyncio.Barrier: 9fc. and *note threading.Barrier: 15a2.

   - gh-129409(12): Fix an integer overflow in the *note csv: 2c. module
     when writing a data field larger than 2GB.

   - gh-126400(13): Add a socket 'timeout' keyword argument to *note
     logging.handlers.SysLogHandler: a51.

   - gh-118761(14): Always lazy import ‘warnings’ in *note threading:
     f6.  Patch by Taneli Hukkinen.

   - gh-118761(15): Improve import time of *note subprocess: df. by lazy
     importing ‘locale’ and ‘signal’.  Patch by Taneli Hukkinen.

   - gh-129346(16): In *note sqlite3: d7, 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(): 4f2.

   - gh-129195(18): Support reporting call graph information from
     ‘asyncio.staggered.staggered_race()’.

   - gh-129205(19): Add *note os.readinto(): 4f2. to read into a *note
     buffer object: 319. from a file descriptor.

   - gh-128772(20): Fix *note pydoc: bd. 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(): 2e9. to Python 3.15.

   - gh-129064(23): Deprecate ‘sysconfig.expand_makefile_vars()’, in
     favor of using *note sysconfig.get_paths(): 160. with the ‘vars’
     argument.

   - gh-128550(24): Removed an incorrect optimization relating to eager
     tasks in *note asyncio.TaskGroup: 6dd. 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: b8. and *note
     zipfile: 13a. by up to 20%, by removing unnecessary imports to
     *note typing: 10d.  Patch by Bénédikt Tran.

   - gh-128978(27): Fix a *note NameError: 66c. 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: 6cb. 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: 105. by
     removing ‘typing’, ‘string’, and ‘tomllib._types’ imports.  Patch
     by Taneli Hukkinen.

   - gh-128679(32): *note tracemalloc: 108.: Fix race conditions when
     *note tracemalloc.stop(): 1aee. 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: 66. by up to
     ten times, by importing *note re: c1. 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(): 2ff. under *note free
     threading: 48e.

   - gh-118761(37): Reduce the import time of *note csv: 2c. by up to
     five times, by importing *note re: c1. 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(): 46a, *note
     asyncio.create_task(): 469. and *note
     asyncio.TaskGroup.create_task(): 46b, by passing on all 'kwargs' to
     the task factory set by *note asyncio.loop.set_task_factory(): 468.

   - gh-118761(39): Improve the performance of *note base64.b16decode():
     1fc. 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: c1.  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: 2d. 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: 4ec. 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: 11b. 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(): 51e. for identifying
     *note immortal: 3a0. objects at runtime.

   - gh-128479(45): Fix ‘asyncio.staggered.staggered_race()’ leaking
     tasks and issuing an unhandled exception.

   - gh-128427(46): *note uuid.NIL: 548. and *note uuid.MAX: 549. are
     now available to represent the Nil and Max UUID formats as defined
     by RFC 9562(47).

   - gh-91279(48): *note zipfile.ZipFile.writestr(): 54f. 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: 1aef.  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:
     850.

   - gh-127975(52): Avoid reusing quote types in *note ast.unparse():
     cba. 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: 1af0, *note
     importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES: 1af1, *note
     importlib.machinery.WindowsRegistryFinder: 10e6, *note
     importlib.abc.ResourceLoader: fab, *note
     importlib.abc.SourceLoader.path_mtime(): 1548.

   - 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: 4fa. attribute, which
     stores an object implementing the *note pathlib.types.PathInfo:
     4fb. protocol (also new).  The object supports querying the file
     type and internally caching *note stat(): 4fc. results.  Path
     objects generated by *note iterdir(): 4fd. 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: 1af2.

   - gh-127096(58): Do not recreate unnamed section on every read in
     *note configparser.ConfigParser: 6ea.  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(): 1af3.

   - gh-91048(62): Add *note asyncio.capture_call_graph(): 46c. and
     *note asyncio.print_call_graph(): 46d. 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(): 48a. function to
     list the loaded shared libraries for the current process.

   - gh-55454(66): Add IMAP4 ‘IDLE’ support to the *note imaplib: 77.
     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: 91. module (*note math.sqrt(): dcc, *note math.log():
     1878. and *note math.atanh(): 1790. were modified as examples).
     Patch by Charlie Zhao and Sergey B Kirpichev.

   - gh-81340(69): Use *note os.copy_file_range(): 1af4. in *note
     shutil.copy(): e22, *note shutil.copy2(): e23, and *note
     shutil.copyfile(): e21. 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: 126e. 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: ドキュメント<11>,  Prev: ライブラリ<38>,  Up: Python 3 14 0 alpha 5

1.26.14.6 IDLE
..............

   - gh-129873(1): Simplify displaying the IDLE doc by only copying the
     text section of idle.html to idlelib/help.html.  Patch by Stan
     Ulbrych.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129873


File: python.info,  Node: ドキュメント<11>,  Next: Core and Builtins<37>,  Prev: IDLE<7>,  Up: Python 3 14 0 alpha 5

1.26.14.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: 1af7. is not
     printable in the POSIX sense.  In particular, *note
     string.printable.isprintable(): 1195. returns *note False: ef9.
     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<37>,  Next: ライブラリ<39>,  Prev: ドキュメント<11>,  Up: Python 3 14 0 alpha 5

1.26.14.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: 1a0b. instead).

   - gh-129715(4): Improve JIT performance for generators.

   - gh-129643(5): Fix thread safety of *note PyList_Insert(): 1af9. in
     free-threading builds.

   - gh-129668(6): Fix race condition when raising *note MemoryError:
     191d. in the free threaded build.

   - gh-129643(7): Fix thread safety of *note PyList_SetItem(): 1afa. 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: 51f. 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: ライブラリ<39>,  Next: Core and Builtins<38>,  Prev: Core and Builtins<37>,  Up: Python 3 14 0 alpha 5

1.26.14.9 ライブラリ
....................

   - gh-129345(1): Fix null pointer dereference in *note
     syslog.openlog(): 950. when an audit hook raises an exception.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129345


File: python.info,  Node: Core and Builtins<38>,  Next: ライブラリ<40>,  Prev: ライブラリ<39>,  Up: Python 3 14 0 alpha 5

1.26.14.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(): 1afd, *note
     PyLong_FromUnsignedLongLong(): 1afe. and *note PyLong_FromSize_t():
     1aff.

   - 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: e2.  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: 1b00. and
     *note UnicodeError.end: 1b01. values in the *note
     codecs.replace_errors(): 1b02. error handler.  Patch by Bénédikt
     Tran.

   - gh-126004(20): Fix handling of *note UnicodeError.start: 1b00. and
     *note UnicodeError.end: 1b01. values in the *note
     codecs.backslashreplace_errors(): 1b03. error handler.  Patch by
     Bénédikt Tran.

   - gh-126004(21): Fix handling of *note UnicodeError.start: 1b00. and
     *note UnicodeError.end: 1b01. values in the *note
     codecs.xmlcharrefreplace_errors(): 1b04. error handler.  Patch by
     Bénédikt Tran.

   - gh-127119(22): Slightly optimize the *note int: 32e. 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: ライブラリ<40>,  Next: Core and Builtins<39>,  Prev: Core and Builtins<38>,  Up: Python 3 14 0 alpha 5

1.26.14.11 ライブラリ
.....................

   - gh-126349(1): Add *note turtle.fill(): 52a, *note turtle.poly():
     52b. and *note turtle.no_animation(): 52c. 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<39>,  Next: ライブラリ<41>,  Prev: ライブラリ<40>,  Up: Python 3 14 0 alpha 5

1.26.14.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: 10fd.  Patch by Alex Willmer.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115911


File: python.info,  Node: ライブラリ<41>,  Next: C API<13>,  Prev: Core and Builtins<39>,  Up: Python 3 14 0 alpha 5

1.26.14.13 ライブラリ
.....................

   - gh-112713(1): Added support for the ‘Partitioned’ cookie flag in
     *note http.cookies: 74.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112713


File: python.info,  Node: C API<13>,  Next: ビルド<12>,  Prev: ライブラリ<41>,  Up: Python 3 14 0 alpha 5

1.26.14.14 C API
................

   - gh-129533(1): Update *note PyGC_Enable(): c7e, *note
     PyGC_Disable(): c7f, *note PyGC_IsEnabled(): c80. to use atomic
     operation for thread-safety at free-threading build.  Patch by
     Donghee Na.

   - gh-89188(2): Implement *note PyUnicode_KIND(): 153b. and *note
     PyUnicode_DATA(): 1537. 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(): 1ae5. from the limited
     C API, since this function has to be used with *note
     PySequence_Fast_GET_ITEM: 5fe. which never worked in the limited C
     API. Patch by Victor Stinner.

   - gh-128509(4): Add *note PyUnstable_IsImmortal(): 5f7. for
     determining whether an object is *note immortal: 3a0.

   - gh-129033(5): Remove ‘_PyInterpreterState_GetConfigCopy()’ and
     ‘_PyInterpreterState_SetConfig()’ private functions.  Use instead
     *note PyConfig_Get(): 3ae. and *note PyConfig_Set(): 5b1, 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: 604. added to Python 3.8 by PEP
     587(8).  Patch by Victor Stinner.

   - gh-128844(9): Add *note PyUnstable_TryIncRef(): 1b09. and *note
     PyUnstable_EnableTryIncRef(): 1b0a. 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(): 5ca. and
     *note PyImport_ImportModuleAttrString(): 5cb. 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(): 5b7.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 63b.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 63c.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 5ce.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 5de.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 63d.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 63e.

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 63f.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 5c7.

     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: 39. module to use PEP
     757(15) C API (export-import integers), offering some speed-up if
     the integer part of the *note Decimal: 1cd. 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: ビルド<12>,  Prev: C API<13>,  Up: Python 3 14 0 alpha 5

1.26.14.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.26.15 Python 3.14.0 alpha 4
-----------------------------

'Release date: 2025-01-14'

* Menu:

* macOS: macOS<8>.
* Tools/Demos: Tools/Demos<10>.
* テスト: テスト<15>.
* ライブラリ: ライブラリ<42>.
* Core and Builtins: Core and Builtins<40>.
* ライブラリ: ライブラリ<43>.
* Core and Builtins: Core and Builtins<41>.
* ライブラリ: ライブラリ<44>.
* Core and Builtins: Core and Builtins<42>.
* C API: C API<14>.
* ビルド: ビルド<13>.


File: python.info,  Node: macOS<8>,  Next: Tools/Demos<10>,  Up: Python 3 14 0 alpha 4

1.26.15.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<10>,  Next: テスト<15>,  Prev: macOS<8>,  Up: Python 3 14 0 alpha 4

1.26.15.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: テスト<15>,  Next: ライブラリ<42>,  Prev: Tools/Demos<10>,  Up: Python 3 14 0 alpha 4

1.26.15.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: ライブラリ<42>,  Next: Core and Builtins<40>,  Prev: テスト<15>,  Up: Python 3 14 0 alpha 4

1.26.15.4 ライブラリ
....................

   - gh-128731(1): Fix *note ResourceWarning: 754. in *note
     urllib.robotparser.RobotFileParser.read(): 1b11.

   - gh-71339(2): Add new assertion methods for *note unittest: 10f.:
     *note assertHasAttr(): 537, *note assertNotHasAttr(): 538, *note
     assertIsSubclass(): 539, *note assertNotIsSubclass(): 53a. *note
     assertStartsWith(): 53b, *note assertNotStartsWith(): 53c, *note
     assertEndsWith(): 53d. and *note assertNotEndsWith(): 53e.

   - gh-118761(3): Improve import time of *note pickle: ab. by 25% by
     removing an unnecessary regular expression.  As such, *note re: c1.
     is no more implicitly available as ‘pickle.re’.  Patch by Bénédikt
     Tran.

   - gh-128661(4): Fixes *note typing.evaluate_forward_ref(): 152. not
     showing deprecation when ‘type_params’ arg is not passed.

   - gh-128562(5): Fix possible conflicts in generated *note tkinter:
     f9. 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(): 46a. and *note
     asyncio.TaskGroup.create_task(): 46b. 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(): ecd. for thread safe
     cancellation.

   - gh-128182(9): Fix crash when using *note ctypes: 2d. pointers
     concurrently on the *note free threaded: 48e. build.

   - gh-128400(10): Only show the current thread in *note faulthandler:
     5b. on the *note free threaded: 48e. build to prevent races.

   - gh-128400(11): Fix crash when using *note
     faulthandler.dump_traceback(): 225. while other threads are active
     on the *note free threaded: 48e. 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: 349.
     and *note types.UnionType: 52e.: ‘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: e29. 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(): 947. by
     30% via a fast path for atomic types and container types.

   - gh-127946(19): Fix crash when modifying *note ctypes._CFuncPtr:
     1b12. objects concurrently on the *note free threaded: 48e. build.

   - gh-128062(20): Revert the font of *note turtledemo: 10b.'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: f9. method ‘wm_iconbitmap()’.

   - gh-41872(22): Fix quick extraction of module docstrings from a file
     in *note pydoc: bd.  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: 2d. and
     *note dbm.gnu: 36. 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(): 850.

   - gh-127688(29): Add the *note SCHED_DEADLINE: 4f0. and *note
     SCHED_NORMAL: 4f1. constants to the *note os: a5. module.

   - gh-83662(30): Add missing ‘__class_getitem__’ method to the Python
     implementation of *note functools.partial(): 4ad, 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: 131a. 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(): 158b. 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: 1413. in a loop.  This
     improves performance on OpenBSD.

   - gh-127360(34): When a descriptive error message cannot be provided
     for an *note ssl.SSLError: 1633, 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: 8db. will now
     issue a *note ResourceWarning: 754. when it is finalized by the
     garbage collector without being explicitly closed.

   - gh-126624(38): Expose error code *note XML_ERROR_NOT_STARTED: 1b13.
     of Expat >=2.6.4 in *note xml.parsers.expat.errors: 130.

   - gh-126225(39): *note getopt: 64. 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: 1b14. constant to *note
     socket: d4. for FreeBSD.

   - gh-121720(41): *note enum.EnumDict: 701. can now be used without
     resorting to private API.

   - gh-123424(42): Add *note zipfile.ZipInfo._for_archive(): 54d.
     setting default properties on *note ZipInfo: 54e. objects.  Patch
     by Bénédikt Tran and Jason R. Coombs.

   - gh-121676(43): Deprecate calling the Python implementation of *note
     functools.reduce(): 156. with a ‘function’ or ‘sequence’ as a *note
     keyword argument: 10d0.  This will be forbidden in Python 3.16 in
     order to match the C implementation.

   - gh-112015(44): *note ctypes.memoryview_at(): 488. now exists to
     create a *note memoryview: 1dd. object that refers to the supplied
     pointer and length.  This works like *note ctypes.string_at(): 489.
     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<40>,  Next: ライブラリ<43>,  Prev: ライブラリ<42>,  Up: Python 3 14 0 alpha 4

1.26.15.5 Core and Builtins
...........................

   - gh-128078(1): Fix a *note SystemError: 3f1. when using *note
     anext(): bb7. 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: 48e. 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: 1533. 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: ライブラリ<43>,  Next: Core and Builtins<41>,  Prev: Core and Builtins<40>,  Up: Python 3 14 0 alpha 4

1.26.15.6 ライブラリ
....................

   - gh-128192(1): Upgrade HTTP digest authentication algorithm for
     *note urllib.request: 114. 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<41>,  Next: ライブラリ<44>,  Prev: ライブラリ<43>,  Up: Python 3 14 0 alpha 4

1.26.15.7 Core and Builtins
...........................

   - gh-126868(1): Increase usage of freelist for *note int: 32e.
     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*: 44f. does not properly
     check the return value of an *note ExceptionGroup: 6de.'s *note
     split(): 1b18. function, leading to a crash in some cases.  Now
     when ‘split()’ returns an invalid object, ‘except*’ raises a *note
     TypeError: 29c. 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: ライブラリ<44>,  Next: Core and Builtins<42>,  Prev: Core and Builtins<41>,  Up: Python 3 14 0 alpha 4

1.26.15.8 ライブラリ
....................

   - gh-128035(1): Indicate through *note ssl.HAS_PHA: 515. whether the
     *note ssl: d8. 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<42>,  Next: C API<14>,  Prev: ライブラリ<44>,  Up: Python 3 14 0 alpha 4

1.26.15.9 Core and Builtins
...........................

   - gh-127274(1): Add a new flag, ‘CO_METHOD’, to *note co_flags: 1b1b.
     that indicates whether the code object belongs to a function
     defined in class scope.

   - gh-66409(2): During the *note path initialization: 1974, 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: 3b2. 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: 1b1c.

   - 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<14>,  Next: ビルド<13>,  Prev: Core and Builtins<42>,  Up: Python 3 14 0 alpha 4

1.26.15.10 C API
................

   - gh-128400(1): *note Py_FatalError(): d4f. no longer shows all
     threads on the *note free threaded: 48e. build to prevent crashes.

   - gh-128629(2): Add macros *note Py_PACK_VERSION(): 5b3. and *note
     Py_PACK_FULL_VERSION(): 5b4. for bit-packing Python version
     numbers.

   - gh-128008(3): Add *note PyWeakref_IsDead(): 1b1e. function, which
     tests if a weak reference is dead.

   - gh-127350(4): Add *note Py_fopen(): 5c7. 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(): 5c8. 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: ビルド<13>,  Prev: C API<14>,  Up: Python 3 14 0 alpha 4

1.26.15.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: 2e. 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: d7. 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.26.16 Python 3.14.0 alpha 3
-----------------------------

'Release date: 2024-12-17'

* Menu:

* Windows: Windows<12>.
* Tools/Demos: Tools/Demos<11>.
* テスト: テスト<16>.
* セキュリティ: セキュリティ<13>.
* ライブラリ: ライブラリ<45>.
* ドキュメント: ドキュメント<12>.
* Core and Builtins: Core and Builtins<43>.
* ライブラリ: ライブラリ<46>.
* Core and Builtins: Core and Builtins<44>.
* C API: C API<15>.
* ビルド: ビルド<14>.


File: python.info,  Node: Windows<12>,  Next: Tools/Demos<11>,  Up: Python 3 14 0 alpha 3

1.26.16.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: 10a. 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<11>,  Next: テスト<16>,  Prev: Windows<12>,  Up: Python 3 14 0 alpha 3

1.26.16.2 Tools/Demos
.....................

   - gh-126700(1): Add support for multi-argument *note gettext: 66.
     functions in ‘pygettext.py’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126700


File: python.info,  Node: テスト<16>,  Next: セキュリティ<13>,  Prev: Tools/Demos<11>,  Up: Python 3 14 0 alpha 3

1.26.16.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: 3b. 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: 82.
     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: セキュリティ<13>,  Next: ライブラリ<45>,  Prev: テスト<16>,  Up: Python 3 14 0 alpha 3

1.26.16.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():
     1a29.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127655


File: python.info,  Node: ライブラリ<45>,  Next: ドキュメント<12>,  Prev: セキュリティ<13>,  Up: Python 3 14 0 alpha 3

1.26.16.5 ライブラリ
....................

   - gh-126907(1): Fix crash when using *note atexit: d. concurrently on
     the *note free-threaded: 48e. 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(): 525, *note
     sysconfig.get_paths(): 160, and siblings, returning outdated cached
     data if the value of *note sys.prefix: 3b3. or *note
     sys.exec_prefix: 3b0. 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: ec. 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: 6ee.  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:
     c9. module.

   - gh-127065(11): Make *note operator.methodcaller(): 11eb.
     thread-safe and re-entrant safe.

   - gh-127321(12): *note pdb.set_trace(): 501. 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: e4. 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: 4a1. 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(): 4fd.

   - gh-127257(16): In *note ssl: d8, system call failures that OpenSSL
     reports using ‘ERR_LIB_SYS’ are now raised as *note OSError: 543.

   - gh-59705(17): On Linux, *note threading.Thread: 427. now sets the
     thread name to the operating system.  Patch by Victor Stinner.

   - gh-127303(18): Publicly expose *note EXACT_TOKEN_TYPES: 1b26. in
     ‘token.__all__’.

   - gh-127331(19): *note ssl: d8. 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(): 525. 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(): 487. function is now
     public.  Previously, this was private and only available in
     ‘_ctypes’.

   - gh-127182(24): Fix ‘io.StringIO.__setstate__()’ crash, when *note
     None: a6a. was passed as the first value.

   - gh-127217(25): Fix *note urllib.request.pathname2url(): 542. for
     paths starting with multiple slashes on Posix.

   - gh-125866(26): *note urllib.request.pathname2url(): 542. 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: 10f. output.  Patch by
     Hugo van Kemenade.

   - gh-127035(28): Fix *note shutil.which: 8c9. 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(): 542. and *note
     url2pathname(): 540. no longer convert Windows drive letters to
     uppercase.

   - gh-127078(31): Fix issue where *note urllib.request.url2pathname():
     540. 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():
     540. failed to discard any 'localhost' authority present in the
     URL.

   - gh-127065(33): Fix crash when calling a *note
     operator.methodcaller(): 11eb. instance from multiple threads in
     the free threading build.

   - gh-127090(34): Fix value of *note urllib.response.addinfourl.url:
     1b27. for ‘file:’ URLs that express relative paths and absolute
     Windows paths.  The canonical URL generated by *note
     urllib.request.pathname2url(): 542. 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(): 1084. now outputs non-ASCII bytes in STRING,
     BINSTRING and SHORT_BINSTRING arguments as escaped (‘\xXX’).

   - gh-126316(37): *note grp: 69.: Make *note grp.getgrall(): 1b28.
     thread-safe by adding a mutex.  Patch by Victor Stinner.

   - gh-126618(38): Fix the representation of *note itertools.count:
     163d. objects when the count value is *note sys.maxsize: 1583.

   - gh-126615(39): The *note COMError: 486. 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: cf. disabled (see *note -S: 1566.), *note sys.prefix:
     3b3. and *note sys.base_prefix: 3b2. will now point to the virtual
     environment, instead of the base installation.

   - gh-112192(41): In the *note trace: 106. 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: 29c. in
     ‘_pydatetime.timedelta.__new__()’ if the passed arguments are not
     *note int: 32e. or *note float: 32f, so that the Python
     implementation is in line with the C implementation.

   - gh-126946(44): Improve the *note GetoptError: 1b29. error message
     when a long option prefix matches multiple accepted options in
     *note getopt.getopt(): 1873. and *note getopt.gnu_getopt(): 1872.

   - 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():
     540. and *note pathname2url(): 542. always used UTF-8 when quoting
     and unquoting file URIs.  They now use the *note filesystem
     encoding and error handler: 94d.

   - gh-126780(47): Fix *note os.path.normpath(): 16d3. for
     drive-relative paths on Windows.

   - gh-126775(48): Make *note linecache.checkcache(): 1b2a. thread safe
     and GC re-entrancy safe.

   - gh-126601(49): Fix issue where *note urllib.request.pathname2url():
     542. raised *note OSError: 543. 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: 4a3. error code to *note errno:
     5a.

   - gh-118201(52): Fixed intermittent failures of *note os.confstr:
     1b2b, *note os.pathconf: 14bc. and *note os.sysconf: 1b2c. on iOS
     and Android.

   - gh-86463(53): The ‘usage’ parameter of *note
     argparse.ArgumentParser: 1e7. 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: 74. 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(): 1205. now
     raises a *note ValueError: 15a. when given a negative value.

   - gh-122356(59): Guarantee that the position of a file-like object
     passed to *note zipfile.is_zipfile(): 16e4. is left untouched after
     the call.  Patch by Bénédikt Tran.

   - gh-122288(60): Improve the performances of *note
     fnmatch.translate(): 1a99. by a factor 1.7.  Patch by Bénédikt
     Tran.

   - gh-88110(61): Fixed *note multiprocessing.Process: 4e5. reporting a
     ‘.exitcode’ of 1 even on success when using the ‘"fork"’ start
     method while using a *note concurrent.futures.ThreadPoolExecutor:
     b2c.

   - gh-97514(62): Authentication was added to the *note
     multiprocessing: 98. forkserver start method control socket so that
     only processes with the authentication key generated by the process
     that spawned the forkserver can control it.  This is an enhancement
     over the other gh-97514(63) fixes so that access is no longer
     limited only by filesystem permissions.

     The file descriptor exchange of control pipes with the forked
     worker process now requires an explicit acknowledgement byte to be
     sent over the socket after the exchange on all forkserver
     supporting platforms.  That makes testing the above much easier.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126907

   (2) https://github.com/python/cpython/issues/127870

   (3) https://github.com/python/cpython/issues/127732

   (4) https://github.com/python/cpython/issues/126789

   (5) https://github.com/python/cpython/issues/127718

   (6) https://github.com/python/cpython/issues/127610

   (7) https://github.com/python/cpython/issues/127627

   (8) https://github.com/python/cpython/issues/126821

   (9) https://github.com/python/cpython/issues/93312

   (10) https://github.com/python/cpython/issues/127481

   (11) https://github.com/python/cpython/issues/127065

   (12) https://github.com/python/cpython/issues/127321

   (13) https://github.com/python/cpython/issues/127429

   (14) https://github.com/python/cpython/issues/127413

   (15) https://github.com/python/cpython/issues/125413

   (16) https://github.com/python/cpython/issues/127257

   (17) https://github.com/python/cpython/issues/59705

   (18) https://github.com/python/cpython/issues/127303

   (19) https://github.com/python/cpython/issues/127331

   (20) https://github.com/python/cpython/issues/123967

   (21) https://github.com/python/cpython/issues/127178

   (22) https://github.com/python/cpython/issues/127072

   (23) https://github.com/python/cpython/issues/127255

   (24) https://github.com/python/cpython/issues/127182

   (25) https://github.com/python/cpython/issues/127217

   (26) https://github.com/python/cpython/issues/125866

   (27) https://github.com/python/cpython/issues/127221

   (28) https://github.com/python/cpython/issues/127035

   (29) https://github.com/python/cpython/issues/122273

   (30) https://github.com/python/cpython/issues/125866

   (31) https://github.com/python/cpython/issues/127078

   (32) https://github.com/python/cpython/issues/126766

   (33) https://github.com/python/cpython/issues/127065

   (34) https://github.com/python/cpython/issues/127090

   (35) https://github.com/python/cpython/issues/126992

   (36) https://github.com/python/cpython/issues/126997

   (37) https://github.com/python/cpython/issues/126316

   (38) https://github.com/python/cpython/issues/126618

   (39) https://github.com/python/cpython/issues/126615

   (40) https://github.com/python/cpython/issues/126985

   (41) https://github.com/python/cpython/issues/112192

   (42) https://github.com/python/cpython/issues/118761

   (43) https://github.com/python/cpython/issues/126947

   (44) https://github.com/python/cpython/issues/126946

   (45) https://github.com/python/cpython/issues/126899

   (46) https://github.com/python/cpython/issues/85168

   (47) https://github.com/python/cpython/issues/126780

   (48) https://github.com/python/cpython/issues/126775

   (49) https://github.com/python/cpython/issues/126601

   (50) https://github.com/python/cpython/issues/126727

   (51) https://github.com/python/cpython/issues/85046

   (52) https://github.com/python/cpython/issues/118201

   (53) https://github.com/python/cpython/issues/86463

   (54) https://github.com/python/cpython/issues/124008

   (55) https://github.com/python/cpython/issues/123401

   (56) https://datatracker.ietf.org/doc/html/rfc850.html

   (57) https://datatracker.ietf.org/doc/html/rfc9110.html

   (58) https://github.com/python/cpython/issues/122431

   (59) https://github.com/python/cpython/issues/122356

   (60) https://github.com/python/cpython/issues/122288

   (61) https://github.com/python/cpython/issues/88110

   (62) https://github.com/python/cpython/issues/97514

   (63) https://github.com/python/cpython/issues/97514


File: python.info,  Node: ドキュメント<12>,  Next: Core and Builtins<43>,  Prev: ライブラリ<45>,  Up: Python 3 14 0 alpha 3

1.26.16.6 ドキュメント
......................

   - gh-127347(1): Publicly expose *note traceback.print_list(): 1b2e.
     in ‘traceback.__all__’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127347


File: python.info,  Node: Core and Builtins<43>,  Next: ライブラリ<46>,  Prev: ドキュメント<12>,  Up: Python 3 14 0 alpha 3

1.26.16.7 Core and Builtins
...........................

   - gh-127740(1): Fix error message in *note bytes.fromhex(): 43b. 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: 1c8. 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: 1dd. object on the *note free-threaded: 48e. build.

   - gh-127238(9): Correct error message for *note
     sys.set_int_max_str_digits(): 1b30.

   - gh-113841(10): Fix possible undefined behavior division by zero in
     *note complex: 330.'s *note _Py_c_pow(): 3ca.

   ---------- 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: ライブラリ<46>,  Next: Core and Builtins<44>,  Prev: Core and Builtins<43>,  Up: Python 3 14 0 alpha 3

1.26.16.8 ライブラリ
....................

   - gh-127133(1): Calling *note
     argparse.ArgumentParser.add_argument_group(): 325. on an argument
     group, and calling ‘argparse.ArgumentParser.add_argument_group()’
     or *note argparse.ArgumentParser.add_mutually_exclusive_group():
     56e. 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<44>,  Next: C API<15>,  Prev: ライブラリ<46>,  Up: Python 3 14 0 alpha 3

1.26.16.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(): b5f, *note PyCode_GetVarnames(): b60, *note
     PyCode_GetCellvars(): b61, or *note PyCode_GetFreevars(): b62. 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__(): 87e. of *note bytearray: 1d1.
     crashing when *note READ: 1b33. or *note WRITE: 1b34. are passed as
     flags.

   - gh-126937(5): Fix *note TypeError: 29c. when a *note
     ctypes.Structure: 483. has a field size that doesn't fit into an
     unsigned 16-bit integer.  Instead, the maximum number of 'bits' is
     *note sys.maxsize: 1583.

   - gh-126868(6): Increase performance of *note int: 32e. 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(): 1b35. to *note
     memoryview: 1dd. objects.  Patch by Bénédikt Tran.

   - gh-125420(12): Add *note memoryview.count(): 1b36. to *note
     memoryview: 1dd. 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<15>,  Next: ビルド<14>,  Prev: Core and Builtins<44>,  Up: Python 3 14 0 alpha 3

1.26.16.10 C API
................

   - gh-127896(1): The previously undocumented function *note
     PySequence_In(): 60b. is *note soft deprecated: 1b2.  Use *note
     PySequence_Contains(): 60c. instead.

   - gh-127791(2): Fix loss of callbacks after more than one call to
     *note PyUnstable_AtExit(): 1b38.

   - gh-127691(3): The *note Unicode Exception Objects: 67b. C API now
     raises a *note TypeError: 29c. if its exception argument is not a
     *note UnicodeError: 67c. object.  Patch by Bénédikt Tran.

   - gh-123378(4): Ensure that the value of *note
     UnicodeEncodeError.end: 1b01. retrieved by *note
     PyUnicodeEncodeError_GetEnd(): 1b39. lies in ‘[min(1, objlen),
     max(min(1, objlen), objlen)]’ where 'objlen' is the length of *note
     UnicodeEncodeError.object: 1b3a.  Similar arguments apply to *note
     UnicodeDecodeError: ddb. and *note UnicodeTranslateError: 1b3b. 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: 48e. build.

   - gh-123378(6): Ensure that the value of *note
     UnicodeEncodeError.start: 1b00. retrieved by *note
     PyUnicodeEncodeError_GetStart(): 1b3c. lies in ‘[0, max(0, objlen -
     1)]’ where 'objlen' is the length of *note
     UnicodeEncodeError.object: 1b3a.  Similar arguments apply to *note
     UnicodeDecodeError: ddb. and *note UnicodeTranslateError: 1b3b. 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: 4ca. if the operation cannot
     immediately return bytes.

   - gh-102471(8): Add a new import and export API for Python *note int:
     32e. objects ( PEP 757(9)):

        * *note PyLong_GetNativeLayout(): 5db.;

        * *note PyLong_Export(): 5dc.;

        * *note PyLong_FreeExport(): 5dd.;

        * *note PyLongWriter_Create(): 5de.;

        * *note PyLongWriter_Finish(): 5df.;

        * *note PyLongWriter_Discard(): 5e0.

     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: ビルド<14>,  Prev: C API<15>,  Up: Python 3 14 0 alpha 3

1.26.16.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.26.17 Python 3.14.0 alpha 2
-----------------------------

'Release date: 2024-11-19'

* Menu:

* Windows: Windows<13>.
* Tools/Demos: Tools/Demos<12>.
* テスト: テスト<17>.
* セキュリティ: セキュリティ<14>.
* ライブラリ: ライブラリ<47>.
* ドキュメント: ドキュメント<13>.
* Core and Builtins: Core and Builtins<45>.
* ライブラリ: ライブラリ<48>.
* Core and Builtins: Core and Builtins<46>.
* ライブラリ: ライブラリ<49>.
* Core and Builtins: Core and Builtins<47>.
* ライブラリ: ライブラリ<50>.
* C API: C API<16>.
* ビルド: ビルド<15>.


File: python.info,  Node: Windows<13>,  Next: Tools/Demos<12>,  Up: Python 3 14 0 alpha 2

1.26.17.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: 3f1. when *note sys.exit():
     506. is called with ‘0xffffffff’ on Windows.

   - gh-125550(8): Enable the *note Python install manager: 9c1. 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<12>,  Next: テスト<17>,  Prev: Windows<13>,  Up: Python 3 14 0 alpha 2

1.26.17.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: テスト<17>,  Next: セキュリティ<14>,  Prev: Tools/Demos<12>,  Up: Python 3 14 0 alpha 2

1.26.17.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: セキュリティ<14>,  Next: ライブラリ<47>,  Prev: テスト<17>,  Up: Python 3 14 0 alpha 2

1.26.17.4 セキュリティ
......................

   - gh-126623(1): Upgrade libexpat to 2.6.4

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126623


File: python.info,  Node: ライブラリ<47>,  Next: ドキュメント<13>,  Prev: セキュリティ<14>,  Up: Python 3 14 0 alpha 2

1.26.17.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(): 525. incorrectly having the same value
     as *note sys.base_prefix: 3b2. and *note sys.base_exec_prefix: 3af,
     respectively, inside virtual environments.  They now accurately
     reflect *note sys.prefix: 3b3. and *note sys.exec_prefix: 3b0.

   - gh-67877(3): Fix memory leaks when *note regular expression: c1.
     matching terminates abruptly, either because of a signal or because
     memory allocation fails.

   - gh-125063(4): *note marshal: 90. now supports *note slice: 1db.
     objects.  The marshal format version was increased to 5.

   - gh-126789(5): Fixed the values of *note
     sysconfig.get_config_vars(): 525, *note sysconfig.get_paths(): 160,
     and their siblings when the *note site: cf. initialization happens
     after *note sysconfig: e4. 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():
     540. failed to discard two leading slashes introducing an empty
     authority section.

   - gh-126705(8): Allow *note os.PathLike: 1013. to be a base for
     Protocols.

   - gh-126699(9): Allow *note collections.abc.AsyncIterator: 119a. 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(): 1246. or *note unittest.mock.patch.object():
     1b44.) more than once without stopping it

   - gh-126595(12): Fix a crash when instantiating *note
     itertools.count: 163d. with an initial count of *note sys.maxsize:
     1583. on debug builds.  Patch by Bénédikt Tran.

   - gh-120423(13): Fix issue where *note urllib.request.pathname2url():
     542. mishandled Windows paths with embedded forward slashes.

   - gh-126565(14): Improve performances of *note zipfile.Path.open():
     1a33. for non-reading modes.

   - gh-126505(15): Fix bugs in compiling case-insensitive *note regular
     expressions: c1. 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: 19f. during the importing of *note
     multiprocessing.set_forkserver_preload(): 198a. 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: 19f. during forkserver preload imports instead of the
     absolute path from *note os.getcwd(): 1b45. 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: 1a9c. and *note
     multiprocessing.RLock: 1a9d. ‘repr’ values no longer say "unknown"
     on macOS.

   - gh-126476(18): Raise *note calendar.IllegalMonthError: 1936. (now a
     subclass of *note IndexError: 18ed.) for *note calendar.month():
     1b46. 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(): 1b47. for the
     result of ‘persistent_id()’.

   - gh-126451(20): Register the *note contextvars.Context: 428. type to
     *note collections.abc.Mapping: ca0.

   - gh-126175(21): Add ‘msg’, ‘doc’, ‘pos’, ‘lineno’ and ‘colno’
     attributes to *note tomllib.TOMLDecodeError: 1b48.  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: 146a. and *note
     collections.abc.MutableSequence: 6cc, respectively.

   - gh-126390(25): Add support for returning intermixed options and
     non-option arguments in order in *note getopt.gnu_getopt(): 1872.

   - gh-126374(26): Add support for options with optional arguments in
     the *note getopt: 64. module.

   - gh-126363(27): Speed up pattern parsing in *note
     pathlib.Path.glob(): 73f. by skipping creation of a *note
     pathlib.Path: 4f5. object for the pattern.

   - gh-126353(28): *note asyncio.get_event_loop(): 573. now does not
     implicitly creates an event loop.  It now raises a *note
     RuntimeError: 317. if there is no set event loop.  Patch by Kumar
     Aditya.

   - gh-126313(29): Fix an issue in *note curses.napms(): 1b49. when
     *note curses.initscr(): 1a3b. has not yet been called.  Patch by
     Bénédikt Tran.

   - gh-126303(30): Fix pickling and copying of *note os.sched_param:
     1b4a. objects.

   - gh-126138(31): Fix a use-after-free crash on *note asyncio.Task:
     467. objects whose underlying coroutine yields an object that
     implements an evil *note __getattribute__(): f94.  Patch by Nico
     Posada.

   - gh-120057(32): Replace the ‘os.environ.refresh()’ method with a new
     *note os.reload_environ(): 4eb. 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():
     542. and *note url2pathname(): 540. removed slashes from Windows
     DOS drive paths and URLs.

   - gh-126223(35): Raise a *note UnicodeEncodeError: a6c. instead of a
     *note SystemError: 3f1. upon calling ‘_interpreters.create()’ with
     an invalid Unicode character.

   - gh-126205(36): Fix issue where *note urllib.request.pathname2url():
     542. generated URLs beginning with four slashes (rather than two)
     when given a Windows UNC path.

   - gh-126156(37): Improved performances of creating *note Morsel: fc7.
     objects by a factor of 3.8x.

   - gh-126105(38): Fix a crash in *note ast: 9. when the *note
     ast.AST._fields: 19fa. attribute is deleted.

   - gh-126106(39): Fixes a possible ‘NULL’ pointer dereference in *note
     ssl: d8.

   - gh-126080(40): Fix a use-after-free crash on *note asyncio.Task:
     467. objects for which the underlying event loop implements an evil
     *note __getattribute__(): f94.  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: 467.
     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(): e27.

   - gh-125984(45): Fix use-after-free crashes on *note asyncio.Future:
     f8f. objects for which the underlying event loop implements an evil
     *note __getattribute__(): f94.  Reported by Nico-Posada.  Patch by
     Bénédikt Tran.

   - gh-125926(46): Fix *note urllib.parse.urljoin(): 124a. 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(): ecc. 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(): 1b4b.  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(): 156. 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(): 1b4c. and *note
     email.policy.Compat32.header_source_parse(): 1b4d. 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(): ec9.

        * 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: 44a. 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: 114.  They had previously raised *note
     DeprecationWarning: 2d4. 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: 1b47.
     and *note persistent_load: 1b4e. 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(): 23a. conforming to the JSON specification.

   - gh-125660(64): Reject invalid unicode escapes for Python
     implementation of *note json.loads(): 23a.

   - gh-52551(65): Use ‘wcsftime()’ to implement *note time.strftime():
     15a8. on Windows.

   - gh-125259(66): Fix the notes removal logic for errors thrown in
     enum initialization.

   - gh-125633(67): Add function *note inspect.ispackage(): 4c7. to
     determine whether an object is a *note package: 4c8. or not.

   - gh-125614(68): In the *note FORWARDREF: 413. format of *note
     annotationlib: 6, fix bug where nested expressions were not
     returned as *note annotationlib.ForwardRef: 1988. 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():
     325.

   - gh-125541(72): Pressing ‘Ctrl’-‘C’ while blocked in *note
     threading.Lock.acquire(): a8c, *note threading.RLock.acquire():
     122f, and *note threading.Thread.join(): 15a3. now interrupts the
     function call and raises a *note KeyboardInterrupt: d9a. exception
     on Windows, similar to how those functions behave on macOS and
     Linux.

   - gh-125519(73): Improve traceback if *note importlib.reload(): 92d.
     is called with an object that is not a module.  Patch by Alex
     Waygood.

   - gh-125451(74): Fix deadlock when *note
     concurrent.futures.ProcessPoolExecutor: 211. 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: 11a. 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(): 15a8,
     the *note strftime(): 1055. method of the *note datetime: 33.
     classes *note datetime: 6ed, *note date: 494. and *note time: 495.
     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: d8. 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: 11a.
     activation scripts.

   - gh-124694(81): We've added *note
     concurrent.futures.InterpreterPoolExecutor: 471, 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: 326. 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(): 547. for generating UUIDv8
     objects as specified in RFC 9562(90).  Patch by Bénédikt Tran

   - gh-122549(91): Add *note platform.invalidate_caches(): 50c. to
     invalidate cached results.

   - gh-120754(92): Update unbounded ‘read’ calls in *note zipfile: 13a.
     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: e7. when
     writing files, by caching user names and group names.

   - gh-70764(94): Fixed an issue where *note inspect.getclosurevars():
     1495. 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: 1410. 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(): 16d4. 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: 113. functions *note parse_qsl(): 58f. and *note
     parse_qs(): 590. 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: 131a.

   - bpo-46128(102): Strip *note unittest.IsolatedAsyncioTestCase: 34a.
     stack frames from reported stacktraces.

   - gh-84852(103): Add MIME types for MS Embedded OpenType, OpenType
     Layout, TrueType, WOFF 1.0 and 2.0 fonts.  Patch by Sahil Prajapati
     and Hugo van Kemenade.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/85957

   (2) https://github.com/python/cpython/issues/126920

   (3) https://github.com/python/cpython/issues/67877

   (4) https://github.com/python/cpython/issues/125063

   (5) https://github.com/python/cpython/issues/126789

   (6) https://github.com/python/cpython/issues/126188

   (7) https://github.com/python/cpython/issues/126766

   (8) https://github.com/python/cpython/issues/126705

   (9) https://github.com/python/cpython/issues/126699

   (10) https://github.com/python/cpython/issues/126654

   (11) https://github.com/python/cpython/issues/104745

   (12) https://github.com/python/cpython/issues/126595

   (13) https://github.com/python/cpython/issues/120423

   (14) https://github.com/python/cpython/issues/126565

   (15) https://github.com/python/cpython/issues/126505

   (16) https://github.com/python/cpython/issues/117378

   (17) https://github.com/python/cpython/issues/125679

   (18) https://github.com/python/cpython/issues/126476

   (19) https://github.com/python/cpython/issues/126489

   (20) https://github.com/python/cpython/issues/126451

   (21) https://github.com/python/cpython/issues/126175

   (22) https://github.com/python/cpython/issues/89416

   (23) https://datatracker.ietf.org/doc/html/rfc9559.html

   (24) https://github.com/python/cpython/issues/126417

   (25) https://github.com/python/cpython/issues/126390

   (26) https://github.com/python/cpython/issues/126374

   (27) https://github.com/python/cpython/issues/126363

   (28) https://github.com/python/cpython/issues/126353

   (29) https://github.com/python/cpython/issues/126313

   (30) https://github.com/python/cpython/issues/126303

   (31) https://github.com/python/cpython/issues/126138

   (32) https://github.com/python/cpython/issues/120057

   (33) https://github.com/python/cpython/issues/126220

   (34) https://github.com/python/cpython/issues/126212

   (35) https://github.com/python/cpython/issues/126223

   (36) https://github.com/python/cpython/issues/126205

   (37) https://github.com/python/cpython/issues/126156

   (38) https://github.com/python/cpython/issues/126105

   (39) https://github.com/python/cpython/issues/126106

   (40) https://github.com/python/cpython/issues/126080

   (41) https://github.com/python/cpython/issues/125322

   (42) https://github.com/python/cpython/issues/126083

   (43) https://github.com/python/cpython/issues/126068

   (44) https://github.com/python/cpython/issues/125413

   (45) https://github.com/python/cpython/issues/125984

   (46) https://github.com/python/cpython/issues/125926

   (47) https://datatracker.ietf.org/doc/html/rfc3986.html

   (48) https://github.com/python/cpython/issues/125969

   (49) https://github.com/python/cpython/issues/125966

   (50) https://github.com/python/cpython/issues/125789

   (51) https://github.com/python/cpython/issues/126916

   (52) https://github.com/python/cpython/issues/124452

   (53) https://github.com/python/cpython/issues/117941

   (54) https://github.com/python/cpython/issues/125884

   (55) https://github.com/python/cpython/issues/125355

   (56) https://github.com/python/cpython/issues/125767

   (57) https://github.com/python/cpython/issues/124969

   (58) https://github.com/python/cpython/issues/84850

   (59) https://github.com/python/cpython/issues/125666

   (60) https://github.com/python/cpython/issues/125710

   (61) https://github.com/python/cpython/issues/125631

   (62) https://github.com/python/cpython/issues/125378

   (63) https://github.com/python/cpython/issues/125682

   (64) https://github.com/python/cpython/issues/125660

   (65) https://github.com/python/cpython/issues/52551

   (66) https://github.com/python/cpython/issues/125259

   (67) https://github.com/python/cpython/issues/125633

   (68) https://github.com/python/cpython/issues/125614

   (69) https://github.com/python/cpython/issues/125590

   (70) https://github.com/python/cpython/issues/125600

   (71) https://github.com/python/cpython/issues/125542

   (72) https://github.com/python/cpython/issues/125541

   (73) https://github.com/python/cpython/issues/125519

   (74) https://github.com/python/cpython/issues/125451

   (75) https://github.com/python/cpython/issues/125115

   (76) https://github.com/python/cpython/issues/125398

   (77) https://github.com/python/cpython/issues/125245

   (78) https://github.com/python/cpython/issues/52551

   (79) https://github.com/python/cpython/issues/124984

   (80) https://github.com/python/cpython/issues/124651

   (81) https://github.com/python/cpython/issues/124694

   (82) https://peps.python.org/pep-0734/

   (83) https://github.com/python/cpython/issues/58032

   (84) https://github.com/python/cpython/issues/99749

   (85) https://github.com/python/cpython/issues/58956

   (86) https://github.com/python/cpython/issues/124111

   (87) https://github.com/python/cpython/issues/80958

   (88) https://github.com/python/cpython/issues/123370

   (89) https://github.com/python/cpython/issues/89083

   (90) https://datatracker.ietf.org/doc/html/rfc9562.html

   (91) https://github.com/python/cpython/issues/122549

   (92) https://github.com/python/cpython/issues/120754

   (93) https://github.com/python/cpython/issues/121267

   (94) https://github.com/python/cpython/issues/70764

   (95) https://github.com/python/cpython/issues/118289

   (96) https://github.com/python/cpython/issues/119826

   (97) https://github.com/python/cpython/issues/97850

   (98) https://github.com/python/cpython/issues/118986

   (99) https://github.com/python/cpython/issues/116897

   (100) https://github.com/python/cpython/issues/101955

   (101) https://github.com/python/cpython/issues/71936

   (102) https://bugs.python.org/issue?@action=redirect&bpo=46128

   (103) https://github.com/python/cpython/issues/84852


File: python.info,  Node: ドキュメント<13>,  Next: Core and Builtins<45>,  Prev: ライブラリ<47>,  Up: Python 3 14 0 alpha 2

1.26.17.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: e51. 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<45>,  Next: ライブラリ<48>,  Prev: ドキュメント<13>,  Up: Python 3 14 0 alpha 2

1.26.17.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: 15a. is raised instead of *note
     SystemError: 3f1. when trying to iterate over a released *note
     memoryview: 1dd. object.

   - gh-126688(3): Fix a crash when calling *note os.fork(): 6c3. 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: ライブラリ<48>,  Next: Core and Builtins<46>,  Prev: Core and Builtins<45>,  Up: Python 3 14 0 alpha 2

1.26.17.8 ライブラリ
....................

   - gh-126066(1): Fix *note importlib: 7a. 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<46>,  Next: ライブラリ<49>,  Prev: ライブラリ<48>,  Up: Python 3 14 0 alpha 2

1.26.17.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: ライブラリ<49>,  Next: Core and Builtins<47>,  Prev: Core and Builtins<46>,  Up: Python 3 14 0 alpha 2

1.26.17.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(): 18d1.  Patch by
     Daehee Kim.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126209


File: python.info,  Node: Core and Builtins<47>,  Next: ライブラリ<50>,  Prev: ライブラリ<49>,  Up: Python 3 14 0 alpha 2

1.26.17.11 Core and Builtins
............................

   - gh-126312(1): Fix crash during garbage collection on an object
     frozen by *note gc.freeze(): efc. 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 コードオブジェクト:
     9b9. like lambda, annotation and type alias, we no longer add
     ‘None’ to its *note co_consts: 1ade.

   - 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: 116a. with an unknown future feature.

   - gh-126072(7): Add a new attribute in *note co_flags: 1b1b. to
     indicate whether the first item in *note co_consts: 1ade. 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: 108. 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(): 1b55. when passing
     a non-string as first argument and Python was compiled in debug
     mode.

   - gh-126012(11): The *note memoryview: 1dd. type now supports
     subscription, making it a *note generic type: 1dc.

   - gh-125837(12): Adds *note LOAD_SMALL_INT: 5a4. and
     ‘LOAD_CONST_IMMORTAL’ 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: ea0. was changed from ‘surrogateescape’ to
     ‘backslashreplace’.

   - gh-125859(14): Fix a crash in the free threading build when *note
     gc.get_objects(): be1. or *note gc.get_referrers(): be2. 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: 108. 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: 66d. and *note
     classmethod: 6a0. 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: 1c8. 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(): 445. built-in now has an optional
     keyword-only 'strict' flag like *note zip(): 446. 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: ライブラリ<50>,  Next: C API<16>,  Prev: Core and Builtins<47>,  Up: Python 3 14 0 alpha 2

1.26.17.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<16>,  Next: ビルド<15>,  Prev: ライブラリ<50>,  Up: Python 3 14 0 alpha 2

1.26.17.13 C API
................

   - gh-126554(1): Fix error handling in *note ctypes.CDLL: db1. objects
     which could result in a crash in rare situations.

   - gh-126061(2): Add *note PyLong_IsPositive(): 5cf, *note
     PyLong_IsNegative(): 5d0. and *note PyLong_IsZero(): 5d1. for
     checking if a *note PyLongObject: 5d2. is positive, negative, or
     zero, respectively.

   - gh-125608(3): Fix a bug where dictionary watchers (e.g., *note
     PyDict_Watch(): 96e.) on an object's attribute dictionary (*note
     __dict__: 1ca.) were not triggered when the object's attributes
     were modified.

   - gh-123619(4): Added the *note
     PyUnstable_Object_EnableDeferredRefcount(): 5f8. function for
     enabling PEP 703(5) deferred reference counting.

   - gh-121654(6): Add *note PyType_Freeze(): 5e3. function to make a
     type immutable.  Patch by Victor Stinner.

   - gh-120026(7): The ‘Py_HUGE_VAL’ macro is *note soft deprecated:
     1b2.

   ---------- 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: ビルド<15>,  Prev: C API<16>,  Up: Python 3 14 0 alpha 2

1.26.17.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.26.18 Python 3.14.0 alpha 1
-----------------------------

'Release date: 2024-10-15'

* Menu:

* macOS: macOS<9>.
* Windows: Windows<14>.
* Tools/Demos: Tools/Demos<13>.
* テスト: テスト<18>.
* セキュリティ: セキュリティ<15>.
* ライブラリ: ライブラリ<51>.
* IDLE: IDLE<8>.
* ドキュメント: ドキュメント<14>.
* Core and Builtins: Core and Builtins<48>.
* ライブラリ: ライブラリ<52>.
* Core and Builtins: Core and Builtins<49>.
* ライブラリ: ライブラリ<53>.
* Core and Builtins: Core and Builtins<50>.
* ライブラリ: ライブラリ<54>.
* Core and Builtins: Core and Builtins<51>.
* ライブラリ: ライブラリ<55>.
* Core and Builtins: Core and Builtins<52>.
* ライブラリ: ライブラリ<56>.
* Core and Builtins: Core and Builtins<53>.
* ライブラリ: ライブラリ<57>.
* Core and Builtins: Core and Builtins<54>.
* ライブラリ: ライブラリ<58>.
* Core and Builtins: Core and Builtins<55>.
* C API: C API<17>.
* ビルド: ビルド<16>.


File: python.info,  Node: macOS<9>,  Next: Windows<14>,  Up: Python 3 14 0 alpha 1

1.26.18.1 macOS
...............

   - gh-124448(1): Update bundled Tcl/Tk in macOS installer to 8.6.15.

   - gh-123797(2): Check for runtime availability of ‘ptsname_r’
     function on macos.

   - gh-123418(3): Updated macOS installer build to use OpenSSL 3.0.15.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124448

   (2) https://github.com/python/cpython/issues/123797

   (3) https://github.com/python/cpython/issues/123418


File: python.info,  Node: Windows<14>,  Next: Tools/Demos<13>,  Prev: macOS<9>,  Up: Python 3 14 0 alpha 1

1.26.18.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<13>,  Next: テスト<18>,  Prev: Windows<14>,  Up: Python 3 14 0 alpha 1

1.26.18.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: テスト<18>,  Next: セキュリティ<15>,  Prev: Tools/Demos<13>,  Up: Python 3 14 0 alpha 1

1.26.18.4 テスト
................

   - gh-125041(1): Re-enable skipped tests for *note zlib: 13c. 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(): 1b5e.
     Patch by Andreas Stocker.

   - gh-99242(8): *note os.getloadavg(): 1b5f. may throw *note OSError:
     543. 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():
     1b60.  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: セキュリティ<15>,  Next: ライブラリ<51>,  Prev: テスト<18>,  Up: Python 3 14 0 alpha 1

1.26.18.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(): 734. on
     Windows to work correctly on non-English machines.

   - gh-118486(13): *note os.mkdir(): 734. 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(): 735. 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: ライブラリ<51>,  Next: IDLE<8>,  Prev: セキュリティ<15>,  Up: Python 3 14 0 alpha 1

1.26.18.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(): 17e5. 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: 1b63. and *note
     WeakValueDictionary: 1b64. safe against concurrent mutations from
     other threads.  Patch by Kumar Aditya.

   - gh-125260(6): The *note gzip.compress(): a32. '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:
     cb5. 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: f9. 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: 1e7.
     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: de. module.

   - gh-125069(12): Fix an issue where providing a *note
     pathlib.PurePath: 8bb. object as an initializer argument to a
     second ‘PurePath’ object with a different *note parser: 73e.
     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: 459. environment
     variable is set, the *note site: cf. module no longer imports the
     ‘_pyrepl’ module.  Moreover, the ‘site’ module now respects *note
     -E: d2b. and *note -I: d2c. 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(): 66e. 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: 6dd. and the python implementation of *note
     asyncio.Future: f8f.

   - gh-53203(18): Fix *note time.strptime(): 17e5. 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: 2e. 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: d4.
     module.

   - gh-117151(22): The default buffer size used by *note
     shutil.copyfileobj(): e25. 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(): dd6. and *note
     os.path.lexists(): dd7. 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(): 3f4, *note
     add_subparsers(): fda. and ‘add_parser()’.

   - gh-124653(26): Fix detection of the minimal Queue API needed by the
     *note logging: 8a. module.  Patch by Bénédikt Tran.

   - gh-91818(27): The CLI of many modules (*note ast: 9, *note
     ensurepip: 58, *note json: 85, *note pdb: aa, *note sqlite3: d7,
     *note tokenize: 104, *note venv: 11a.) 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(): ee0. when used with
     ‘happy_eyeballs_delay’

   - gh-124390(29): Fixed *note AssertionError: a9c. when using
     ‘asyncio.staggered.staggered_race()’ with *note
     asyncio.eager_task_factory: 892.

   - gh-85935(30): *note argparse.ArgumentParser.add_argument(): 3f4.
     now raises an exception if an *note action: 1b65. 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(): 1b66. raise *note
     TypeError: 29c. not *note AttributeError: 1b4. on bad input types
     that do not have the ‘replace’ attribute.  Improve error message
     when *note bytes: 1d2. 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: 531. with incorrect
     ‘type_params’ argument.  Now it raises a *note TypeError: 29c. 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: 45e. default value for *note
     argparse.ArgumentParser: 1e7.  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(): 4c4.  Add an 'quote_annotation_strings'
     parameter to *note inspect.Signature.format(): 4c6.  Use the new
     functionality to improve the display of annotations in signatures
     in *note pydoc: bd.  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: 428.  Contributed by Bartosz Sławecki.

   - gh-61181(39): Fix support of *note choices: 1b67. 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(): 1b68.
     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():
     be3. 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(): 1b69. and *note curses.resize_term(): 1b6a.

   - gh-124498(45): Fix *note typing.TypeAliasType: 531. not to be
     generic, when ‘type_params’ is an empty tuple.

   - gh-53834(46): Fix support of arguments with *note choices: 1b67. in
     *note argparse: 7.  Positional arguments with *note nargs: 1957.
     equal to ‘'?'’ or ‘'*'’ no longer check *note default: 1b6b.
     against ‘choices’.  Optional arguments with ‘nargs’ equal to ‘'?'’
     no longer check *note const: 1b6c. 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(): 15a8. no longer accepts negative years on Android.

   - gh-123014(49): *note os.pidfd_open(): 273. and *note
     signal.pidfd_send_signal(): cfc. 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(): 6ec.
     in *note unittest.mock.create_autospec(): 1b6d.  Now
     ‘create_autospec’ will check for potential dataclasses and use
     *note dataclasses.fields(): 1b6e. 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: 1957. 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:
     1957. equal to ‘'?'’ or ‘'*'’ if it is preceded by an option and
     another positional argument.

   - gh-100980(58): The *note _fields_: 1b6f. attribute of *note
     ctypes.Structure: 483. and *note Union: 484. 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: 83. module.

   - gh-111513(61): Improve the error message that may be raised by
     *note datetime.date.fromtimestamp(): f96.

   - gh-124248(62): Fixed potential crash when using *note struct: de.
     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: 11a. 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(): d07. and
     *note time.thread_time_ns(): f54. on NetBSD.

   - gh-123934(69): Fix *note unittest.mock.MagicMock: 1243. resetting
     magic methods return values after ‘.reset_mock(return_value=True)’
     was called.

   - gh-124016(70): Update *note unicodedata: 10e. database to Unicode
     16.0.0.

   - gh-123968(71): Fix the command-line interface for the *note random:
     c0. 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: c1e.
     Patch by Victor Stinner.

   - gh-84808(75): Fix error handling in *note socket: 115e. method
     *note connect_ex(): 18f2. on platforms where ‘errno’ can be
     negative.

   - gh-123756(76): Added a new argument ‘mode’ to *note pdb.Pdb: 502.
     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: 11a. was sourced with a custom prompt
     containing unpaired quotes or newlines.

   - gh-123657(78): Fix crash and memory leak in *note
     decimal.getcontext(): 1b70.  It crashed when using a thread-local
     context by ‘--with-decimal-contextvar=no’.

   - gh-123339(79): Fix *note inspect.getsource(): 1a24. for classes in
     *note collections.abc: 1f. and *note decimal: 39. (for pure Python
     implementation) modules.  *note inspect.getcomments(): 1b71. 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(): 1084.

   - gh-123504(81): Fixed reference leak in the finalization of *note
     tkinter: f9.

   - gh-123430(82): Pages generated by the *note http.server: 75. module
     allow the browser to apply its default dark mode.

   - gh-123446(83): Fix empty function name in *note TypeError: 29c.
     when *note csv.reader(): 89d, *note csv.writer(): 89e, or *note
     csv.register_dialect(): 1b72. are used without the required args.

   - gh-123448(84): Fixed memory leak of *note typing.NoDefault: 770. by
     moving it to the static types array.

   - gh-123409(85): Fix *note ipaddress.IPv6Address.reverse_pointer:
     1b73. output according to RFC 3596, §2.5(86).  Patch by Bénédikt
     Tran.

   - gh-123089(87): Make *note weakref.WeakSet: 9dc. safe against
     concurrent mutations while it is being iterated.  Patch by Kumar
     Aditya.

   - gh-123363(88): Show string value of *note CONTAINS_OP: 1b74. oparg
     in *note dis: 3b. output.  Patch by Alexandr153.

   - gh-123341(89): Add *note __class_getitem__(): b26. to
     ‘tkinter.Event’ for type subscript support at runtime.  Patch by
     Adonis Rakateli.

   - gh-123340(90): Show string value of *note IS_OP: 1b75. oparg in
     *note dis: 3b. output.

   - gh-119518(91): Speed up normalization of *note pathlib.PurePath:
     8bb. and *note Path: 4f5. objects by not interning string parts.

   - gh-123270(92): Applied a more surgical fix for malformed payloads
     in *note zipfile.Path: abb. causing infinite loops (gh-122905(93))
     without breaking contents using legitimate characters.

   - gh-73991(94): Add *note pathlib.Path.copy_into(): 4f7. and *note
     move_into(): 4f9, 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(): 1ea.  Patch by Sergey B Kirpichev.

   - gh-123240(96): Raise audit events for the *note input(): 1692. in
     the new REPL.

   - gh-76960(97): Fix *note urllib.parse.urljoin(): 124a. and *note
     urllib.parse.urldefrag(): 2b0. 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: d8. when the *note ssl.SSLSocket.session: 1b76. 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(): 1591.
     and *note Element: 34b. 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(): 2b1. and *note
     urllib.parse.urlunparse(): 2b2.

   - gh-123165(103): Add support for rendering *note Positions: 1b77. in
     *note dis: 3b.

   - 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: cd. function since Python 3.4.  It's
     now an alias for *note RuntimeError: 317.

   - gh-123085(106): In a bare call to *note
     importlib.resources.files(): 2e2, 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: 74.

   - gh-123049(108): Add support for *note UNNAMED_SECTION: 19bd. in
     *note configparser.ConfigParser.add_section(): 1627.

   - 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(): 1a24. 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: abb. objects now sanitize names
     from the zipfile.

   - gh-122873(113): Enable *note json: 85. module to work as a script
     using the *note -m: 4d1. switch: ‘python -m json’.  See the *note
     JSON command-line interface: 4d2. documentation.  Patch by Trey
     Hunner.

   - gh-122858(114): Deprecate ‘asyncio.iscoroutinefunction()’ in favor
     of *note inspect.iscoroutinefunction(): 154.

   - gh-116263(115): *note logging.handlers.RotatingFileHandler: 1b78.
     no longer rolls over empty log files.

   - gh-105376(116): Restore the deprecated *note logging: 8a. ‘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: 1b79. is now raised more often instead of
     *note UnicodeEncodeError: a6c, *note ValueError: 15a. and *note
     AttributeError: 1b4, 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(): 190d. to customize the functional
     creation of dataclasses.

   - gh-118814(121): Fix the *note typing.TypeVar: 29f. 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: 1b7a. with non-default *note
     sys.excepthook(): be9.  Save correct tracebacks in *note
     sys.last_traceback: 8d6. and update ‘__traceback__’ attribute of
     *note sys.last_value: 8d5. and *note sys.last_exc: 8d3.

   - gh-116622(124): On Android, the ‘FICLONE’ and ‘FICLONERANGE’
     constants are no longer exposed by *note fcntl: 5c, as these ioctls
     are blocked by SELinux.

   - gh-82378(125): Make sure that the new *note REPL: 6a3. interprets
     *note sys.tracebacklimit: 1b7b. in the same way that the classic
     REPL did.

   - gh-122334(126): Fix crash when importing *note ssl: d8. 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: 1b7a, handle
     exceptions caused by calling a non-default *note sys.excepthook():
     be9.  Before, the exception bubbled up to the caller, ending the
     *note REPL: 6a3.

   - gh-122272(129): On some platforms such as Linux, year with century
     was not 0-padded when formatted by *note strftime(): 1055. 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: 15a.s raised by *note
     os.stat(): 4fc. in *note filecmp.dircmp: 12f0. and *note
     filecmp.cmpfiles(): 1b7c.  Patch by Bénédikt Tran.

   - gh-122311(131): Fix some error messages in *note pickle: ab.

   - gh-121650(132): *note email: 3e. headers with embedded newlines are
     now quoted on output.  The *note generator: 43. will now refuse to
     serialize (write) headers that are unsafely folded or delimited;
     see *note verify_generated_headers: 6fd.  (Contributed by Bas
     Bloemsaat and Petr Viktorin in gh-121650(133).)

   - gh-122332(134): Fixed segfault with *note asyncio.Task.get_coro():
     da4. when using an eager task factory.

   - gh-105733(135): *note ctypes.ARRAY(): 7a3. is now *note soft
     deprecated: 1b2.: 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: 531.

        * ‘evaluate_bound’, ‘evaluate_constraints’, and
          ‘evaluate_default’ on *note typing.TypeVar: 29f.

        * ‘evaluate_default’ on *note typing.ParamSpec: 2a0.

        * ‘evaluate_default’ on *note typing.TypeVarTuple: 29e.

   - gh-119180(139): Fix handling of classes with custom metaclasses in
     ‘annotationlib.get_annotations’.

   - gh-122170(140): Handle *note ValueError: 15a.s raised by *note
     os.stat(): 4fc. in *note linecache: 88.  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(): 156e.
     accept any object implementing the Queue public API. See the *note
     queue configuration: 1b7d. 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: 2c. now correctly parses numeric fields
     (when used with *note csv.QUOTE_NONNUMERIC: 1b7e. or *note
     csv.QUOTE_STRINGS: 89c.) which start with an escape character.

   - gh-122088(148): *note @warnings.deprecated: 69b. now copies the
     coroutine status of functions and methods so that *note
     inspect.iscoroutinefunction(): 154. 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(): 4f8, 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
     ‘symtable.Class.get_methods()’, 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: 189. raised in new repl.  Patch by Sergey B Kirpichev.

   - gh-121797(155): Add alternative *note Fraction: 1ce. constructor
     *note Fraction.from_number(): 4aa.

   - gh-121798(156): Add alternative *note Decimal: 1cd. constructor
     *note Decimal.from_number(): 497.

   - 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:
     12f0. (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: de. module if the compiler has C11
     complex arithmetic.  Patch by Sergey B Kirpichev.

   - gh-121486(162): *note math: 91. functions *note isqrt(): dcb, *note
     log(): 1878, *note log2(): 149c. and *note log10(): 19fc. 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: 15a2. constructor.  Patch by Clinton Christian
     (pygeek).

   - gh-121450(164): Hard-coded breakpoints (*note breakpoint(): 500.
     and *note pdb.set_trace(): 501.) 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(): 8be. by
     simplifying exception handling.

   - gh-121423(166): Improve import time of *note socket: d4. by lazy
     importing modules and writing ‘socket.errorTab’ as a constant.

   - gh-59110(167): *note zipimport: 13b. supports now namespace
     packages when no directory entry exists.

   - gh-119004(168): Fix a crash in *note OrderedDict.__eq__: 1b7f. 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: 14a1. 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: 2d4.  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: 6a3. 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(): 460.  Patch by Bénédikt Tran.

   - gh-121163(173): Add support for ‘all’ as an valid ‘action’ for
     *note warnings.simplefilter(): ab3. and *note
     warnings.filterwarnings(): 1861.

   - 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(): 461. to AST
     nodes.  Patch by Bénédikt Tran.

   - gh-87744(176): Fix waitpid race while calling *note send_signal():
     1b80. in asyncio.  Patch by Kumar Aditya.

   - gh-121027(177): Add a future warning in
     ‘functools.partial.__get__()’.  In future Python versions *note
     functools.partial: 4ad. will be a method descriptor.

   - gh-121027(178): Make the *note functools.partial: 4ad. 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__(): 1c7. of *note
     functools.partialmethod: 4ae.  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: f9.

   - 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: 2d. as *note
     c_float_complex: 2d9, *note c_double_complex: 2da. and *note
     c_longdouble_complex: 2db. 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: f9. 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(): 19ad.

   - gh-120782(189): Fix wrong references of the *note datetime: 33.
     types after reloading the module.

   - gh-120713(190): *note datetime.datetime.strftime(): 1055. 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: 3b. output.

   - gh-41431(193): Add *note datetime.time.strptime(): 1a26. and *note
     datetime.date.strptime(): 493.  Contributed by Wannes Boeykens.

   - gh-120743(194): *note Soft deprecate: 1b2. *note os.popen(): 58c.
     and *note os.spawn*: 58d. functions.  They should no longer be used
     to write new code.  The *note subprocess: df. module is recommended
     instead.  Patch by Victor Stinner.

   - gh-120732(195): Fix ‘name’ passing to *note unittest.mock.Mock:
     e12. object when using *note unittest.mock.create_autospec(): 1b6d.

   - gh-111259(196): *note re: c1. 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: 1394, 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: 716. and *note
     ipaddress.IPv6Address: 717. 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(): 1b81. to accept
     *note awaitable: 6d5. objects instead of simply *note coroutine:
     8a7.s.

   - gh-120541(202): Improve the prompt in the "less" pager when *note
     help(): cad. 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: 10f. returns something other than ‘None’.  Now we
     show the returned object type and optional asyncio-related tip.

   - gh-120381(205): Correct *note inspect.ismethoddescriptor(): 1b82.
     to check also for the lack of *note __delete__(): 1b83.  Patch by
     Jan Kaliszewski.

   - gh-90425(206): The OS byte in gzip headers is now always set to 255
     when using *note gzip.compress(): a32.

   - gh-120343(207): Fix column offset reporting for tokens that come
     after multiline f-strings in the *note tokenize: 104. 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:
     32, *note typing.TypedDict: 29b, and *note typing.NamedTuple: 2f0.

   - gh-119600(211): Fix *note unittest.mock.patch(): 1246. 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 ‘cProfile’ 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: 1ce.

   - gh-114053(214): Fix edge-case bug where *note
     typing.get_type_hints(): aa3. 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: 66c. when calling
     *note inspect.get_annotations(): bf0. 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(): f96. to achieve consistency with
     C-extension implementation.

   - gh-120244(218): Fix memory leak in *note re.sub(): 7a7. when the
     replacement string contains backreferences.

   - gh-120254(219): Added ‘commands’ argument to *note pdb.set_trace():
     501. which allows users to send debugger commands from the source
     file.

   - gh-120211(220): Fix *note tkinter.ttk: 102. with Tcl/Tk 9.0.

   - gh-71587(221): Fix crash in C version of *note
     datetime.datetime.strptime(): 2dd. 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: 33. no longer crashes in certain
     complex reference cycle situations.

   - gh-119698(225): Fix ‘symtable.Class.get_methods()’ and document its
     behaviour.  Patch by Bénédikt Tran.

   - gh-120121(226): Add *note concurrent.futures.InvalidStateError:
     1b84. to module's ‘__all__’.

   - gh-119933(227): Add the *note symtable.SymbolTableType: 1b85.
     enumeration to represent the possible outputs of the *note
     symtable.SymbolTable.get_type: 1b86. method.  Patch by Bénédikt
     Tran.

   - gh-120029(228): Expose *note symtable.Symbol: 518. methods *note
     is_free_class(): 51b, *note is_comp_iter(): 51a. and *note
     is_comp_cell(): 519.  Patch by Bénédikt Tran.

   - gh-120108(229): Fix calling *note copy.deepcopy(): f2f. 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: f9. with Tcl 9.0.

   - gh-120057(232): Added the *note os.environ.refresh(): 4ec. method
     to update ‘os.environ’ with changes to the environment made by
     *note os.putenv(): 4ee, by *note os.unsetenv(): 4ef, or made
     outside Python in the same process.  Patch by Victor Stinner.

   - gh-120029(233): Expose *note symtable.Symbol.is_type_parameter():
     1b87. in the *note symtable: e1. 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(): 1b88. no
     longer triggers a call to a ‘PropertyMock’ being attached.

   - gh-117142(236): The *note ctypes: 2d. 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: 33.) 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:
     1ce. and complex, the fraction is now converted to *note float:
     32f. instead of *note complex: 330.

   - gh-119770(242): Make *note termios: ea. ‘ioctl()’ constants
     positive.  Patch by Victor Stinner.

   - gh-89727(243): Fix issue with *note shutil.rmtree(): 33d. where a
     *note RecursionError: 1125. is raised on deep directory trees.

   - gh-119577(244): The *note DeprecationWarning: 2d4. emitted when
     testing the truth value of an *note xml.etree.ElementTree.Element:
     34b. 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(): 33d.
     where a *note RecursionError: 1125. 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:
     104. module by caching the ‘line’ token attribute and calculating
     the column offset more efficiently.

   - gh-89727(248): Fix issue with *note os.fwalk(): f1c. where a *note
     RecursionError: 1125. 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: 189. from *note compile():
     1d3. 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: c1.  Patch by Jelle Zijlstra.

   - gh-119127(255): Positional arguments of *note functools.partial():
     4ad. objects now support placeholders via *note
     functools.Placeholder: 4ac.

   - gh-113892(256): Now, the method ‘sock_connect’ of *note
     asyncio.ProactorEventLoop: a03. raises a *note ValueError: 15a. 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(): 1833. 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(): a0e. that were previously parsed
     incorrectly.

   - gh-111201(267): Remove dependency to *note readline: c2. from the
     new Python REPL.

   - gh-119189(268): When using the ‘**’ operator or *note pow(): 448.
     with *note Fraction: 1ce. 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(): 1b89. didn't raise *note TypeError:
     29c. when given ‘None’ as a suffix.

   - gh-118643(273): Fix an AttributeError in the *note email: 3e.
     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(): 4f6, 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: 1b8a. and related attributes and methods.
     For example, the *note suffixes: 1b8b. of ‘PurePath('foo.bar.')’
     are now ‘['.bar', '.']’ rather than ‘[]’.  This brings file
     extension splitting in line with *note os.path.splitext(): 1b8c.

   - gh-118924(277): Remove ‘version’ and ‘version_info’ from *note
     sqlite3: d7.  Patch by Hugo van Kemenade.

   - gh-118928(278): Disallow using a sequence of parameters with named
     placeholders in *note sqlite3: d7. queries.  Patch by Erlend E.
     Aasland.

   - gh-118895(279): Setting attributes on *note typing.NoDefault: 770.
     now raises *note AttributeError: 1b4. instead of *note TypeError:
     29c.

   - 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: 113.  It had previously raised a *note
     DeprecationWarning: 2d4. since Python 3.11.  Patch by Nikita
     Sobolev.

   - gh-118824(282): Remove deprecated ‘pty.master_open()’ and
     ‘pty.slave_open()’.  Use *note pty.openpty(): 580. 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(): 6cf.  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: 2d4. since Python 3.12.

   - gh-118798(287): The 'isdst' parameter has been removed from *note
     email.utils.localtime(): 576.  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: 4f5.

   - gh-101357(291): Suppress all *note OSError: 543. exceptions from
     *note pathlib.Path.exists(): dde. and ‘is_*()’ methods, rather than
     a selection of more common errors.  The new behaviour is consistent
     with *note os.path.exists(): dd6, *note os.path.isdir(): dd8, etc.
     Use *note pathlib.Path.stat(): c00. to retrieve the file status
     without suppressing exceptions.

   - gh-78707(292): Drop support for passing additional positional
     arguments to *note pathlib.PurePath.relative_to(): 57c. and *note
     is_relative_to(): 57d.

   - gh-118507(293): Fix *note os.path.isfile(): dd9. on Windows for
     pipes.  Speedup *note os.path.isjunction(): 8b8. and *note
     os.path.lexists(): dd7. on Windows with a native implementation.

   - gh-118772(294): Allow *note typing.TypeVar: 29f. 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(): 24d. now suppresses any
     *note OSError: 543. from *note os.readlink(): cf1. when 'strict'
     mode is disabled (the default).

   - gh-118263(298): Speed up *note os.path.splitroot(): 8b9. & *note
     os.path.normpath(): 16d3. 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(): 6ec. not
     creating a ‘__weakref__’ slot when subclassing *note
     typing.Generic: 1a12.

   - gh-117766(301): Always use *note str(): 1ea. to print ‘choices’ in
     *note argparse: 7.

   - gh-106531(302): In *note importlib.resources: 7e, 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:
     6ee. instance.  Patch by Sergey B Kirpichev.

   - gh-115808(305): Add *note operator.is_none(): 4e8. and *note
     operator.is_not_none(): 4e9. functions.

   - gh-114264(306): Improve performance of *note copy.deepcopy(): f2f.
     by adding a fast path for atomic types.

   - gh-113878(307): Add 'doc' parameter to *note dataclasses.field():
     1966, 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__: 18a3. dict.  Otherwise, the
     supplied string is only available in the corresponding *note
     dataclasses.Field: 1b8d. object.

     In order to support this feature we are changing the ‘__slots__’
     format in dataclasses from *note tuple: 1d9. to *note dict: 193.
     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(): 1b8e.
     and *note ssl.SSLSocket.get_unverified_chain(): 1b8f. methods.

     Contributed by Mateusz Nowak.

   - gh-105623(312): Fix performance degradation in *note
     logging.handlers.RotatingFileHandler: 1b78.  Patch by Craig Robson.

   - gh-102450(313): Add missing ISO-8601 24:00 alternative to midnight
     of next day to *note datetime.datetime.fromisoformat(): a0f. and
     *note datetime.time.fromisoformat(): a0e.  Patch by Izan
     "TizzySaurus" Robinson (<tizzysaurus@gmail.com>)

   - gh-103956(314): Fix lack of newline characters in *note trace: 106.
     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: 5f6, *note str: 1ea, *note bytearray: 1d1, or *note
     int: 32e.

   - gh-87106(317): Fixed handling in *note inspect.Signature.bind():
     1ad5. 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: 4df.
     in the ‘multiprocessing’ module:

        * ‘clear()’ and ‘copy()’ for proxies of *note list: 4e0.

        * *note fromkeys(): 4e1, ‘reversed(d)’, ‘d | {}’, ‘{} | d’, ‘d
          |= {'b': 2}’ for proxies of *note dict: 193.

   - bpo-45767(319): Fix integer conversion in *note os.major(): 1b90,
     *note os.minor(): 1b91, and *note os.makedev(): 1b92.  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: 1e7.

   - bpo-41843(321): Solaris now uses *note os.sendfile(): ed7.
     fast-copy syscall for more efficient *note shutil: cd. file copy
     related functions.

   - bpo-15987(322): Implemented *note ast.compare(): 460. for comparing
     two ASTs.  Patch by Batuhan Taskaya with some help from Jeremy
     Hylton.

   - gh-67693(323): Fix *note urllib.parse.urlunparse(): 2b2. and *note
     urllib.parse.urlunsplit(): 2b1. 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: ドキュメント<14>,  Prev: ライブラリ<51>,  Up: Python 3 14 0 alpha 1

1.26.18.7 IDLE
..............

   - gh-122392(1): Increase currently inadequate vertical spacing for
     the IDLE browsers (path, module, and stack) on high-resolution
     monitors.

   - gh-112938(2): Fix uninteruptable hang when Shell gets rapid
     continuous output.

   - gh-122482(3): Change About IDLE to direct users to
     discuss.python.org instead of the now unused idle-dev email and
     mailing list.

   - gh-78889(4): Stop Shell freezes by blocking user access to
     non-method sys.stdout.shell attributes, which are all private.

   - gh-120083(5): Add explicit black IDLE Hovertip foreground color
     needed for recent macOS. Fixes Sonoma showing unreadable white on
     pale yellow.  Patch by John Riggles.

   - gh-120104(6): Fix padding in config and search dialog windows in
     IDLE.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122392

   (2) https://github.com/python/cpython/issues/112938

   (3) https://github.com/python/cpython/issues/122482

   (4) https://github.com/python/cpython/issues/78889

   (5) https://github.com/python/cpython/issues/120083

   (6) https://github.com/python/cpython/issues/120104


File: python.info,  Node: ドキュメント<14>,  Next: Core and Builtins<48>,  Prev: IDLE<8>,  Up: Python 3 14 0 alpha 1

1.26.18.8 ドキュメント
......................

   - gh-124872(1): Added definitions for *note context: 1b95, *note
     current context: 1b96, and *note context management protocol: 1b97,
     updated related definitions to be consistent, and expanded the
     documentation for *note contextvars.Context: 428.

   - gh-125018(2): The *note importlib.metadata: 7d. documentation now
     includes semantic cross-reference targets for the significant
     documented APIs.  This means intersphinx references like *note
     importlib.metadata.version(): 1b98. 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(): 1b99.

   - gh-121749(10): Fix documentation for *note PyModule_AddObjectRef():
     806.

   - gh-120012(11): Clarify the behaviours of *note
     multiprocessing.Queue.empty(): 1b9a. and *note
     multiprocessing.SimpleQueue.empty(): 1b9b. on closed queues.  Patch
     by Bénédikt Tran.

   - gh-119574(12): Added some missing environment variables to the
     output of *note -help-env: 9ee.

   - bpo-34008(13): The *note Py_Main(): fe6. 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<48>,  Next: ライブラリ<52>,  Prev: ドキュメント<14>,  Up: Python 3 14 0 alpha 1

1.26.18.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__(): 1b9d. 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: ライブラリ<52>,  Next: Core and Builtins<49>,  Prev: Core and Builtins<48>,  Up: Python 3 14 0 alpha 1

1.26.18.10 ライブラリ
.....................

   - gh-125008(1): Fix *note tokenize.untokenize(): 1af3. 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<49>,  Next: ライブラリ<53>,  Prev: ライブラリ<52>,  Up: Python 3 14 0 alpha 1

1.26.18.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__(): a14. method of
     *note UnicodeError: 67c. objects when the *note UnicodeError.start:
     1b00. and *note UnicodeError.end: 1b01. 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__: 68f.  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: 1ba0. struct now uses a tagged pointer.
     Profilers and debuggers that uses this field should clear the least
     significant bit to recover the *note PyObject: 1a6.* pointer.

   - gh-77894(21): Fix possible crash in the garbage collector when it
     tries to break a reference loop containing a *note memoryview: 1dd.
     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: ライブラリ<53>,  Next: Core and Builtins<50>,  Prev: Core and Builtins<49>,  Up: Python 3 14 0 alpha 1

1.26.18.12 ライブラリ
.....................

   - gh-123614(1): Add *note turtle.save(): 1ba2. 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<50>,  Next: ライブラリ<54>,  Prev: ライブラリ<53>,  Up: Python 3 14 0 alpha 1

1.26.18.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: 189. 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: 29c. when
     builtin magic methods are used without the required args.

   - gh-123440(7): Improve *note SyntaxError: 189. 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(): 446. iterator safe under free-threading.

   - gh-123275(14): Support *note -X gil=1: 183. and *note PYTHON_GIL=1:
     6ac. 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: 189. 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: 1ba4. 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: 189. 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(): 67a. from a non-main thread.

   - gh-118093(26): Add three specializations for *note CALL_KW: 5a8.:

        * ‘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: 1ba5.
     statements have consistent offsets for *note sys.monitoring: e3.
     ‘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: 183.

   - 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: d53. now accounts for non-sequence
     fields that aren't included in the *note Py_SIZE: b66. of the
     sequence.

   - gh-122445(34): Add only fields which are modified via self.* to
     *note __static_attributes__: 68f.

   - 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: 329. loops from correctly firing *note RAISE: 27f. 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: 298. now supports arbitrary
     hashable objects as keys.

   - gh-122239(39): When a *note list: 4e0, *note tuple: 1d9. or *note
     dict: 193. 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: 438. command line
     option).

   - gh-122234(41): Specializations for sums with float and complex
     inputs in *note sum(): 886. now always use compensated summation.
     Also, for integer items in above specializations: *note
     PyLong_AsDouble(): 1ba6. is used, instead of *note
     PyLong_AsLongAndOverflow(): 161f.  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: 59f. instead.

   - gh-122029(44): Emit ‘c_call’ events in *note sys.setprofile():
     18b6. 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: ライブラリ<54>,  Next: Core and Builtins<51>,  Prev: Core and Builtins<50>,  Up: Python 3 14 0 alpha 1

1.26.18.14 ライブラリ
.....................

   - gh-121999(1): The default extraction filter for the *note tarfile:
     e7. module is now set to *note 'data': 284.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121999


File: python.info,  Node: Core and Builtins<51>,  Next: ライブラリ<55>,  Prev: ライブラリ<54>,  Up: Python 3 14 0 alpha 1

1.26.18.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(): 856.
     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: 189. message if the
     user tries to use *note yield from: d97. 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: 439. or
     asynchronous comprehensions in code removed by the *note -O: 438.
     option was not flagged by the Python compiler.  Now, such code
     raises *note SyntaxError: 189.  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: 15a. messages for *note
     list.index(): 177d, *note range.index(): 1ba9, ‘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(): 1baa. and
     *note remove(): 1bab. 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(): 886. 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: ライブラリ<55>,  Next: Core and Builtins<52>,  Prev: Core and Builtins<51>,  Up: Python 3 14 0 alpha 1

1.26.18.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<52>,  Next: ライブラリ<56>,  Prev: ライブラリ<55>,  Up: Python 3 14 0 alpha 1

1.26.18.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(): 802. no longer uses
     *note __index__(): 444. methods by default.  The
     ‘Py_ASNATIVEBYTES_ALLOW_INDEX’ flag has been added to allow it.

   - gh-120838(3): *note Py_Finalize(): 679. and *note Py_FinalizeEx():
     10d3. 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: 5a5. instruction.
     Generate code for ‘with’ and ‘async with’ statements using the new
     instruction.

   - gh-113993(15): Strings interned with *note sys.intern(): 1695. are
     again garbage-collected when no longer used, as per the
     documentation.  Strings interned with the C function *note
     PyUnicode_InternInPlace(): c88. are still immortal.  Internals of
     the string interning mechanism have been changed.  This may affect
     performance and identities of *note str: 1ea. 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: ライブラリ<56>,  Next: Core and Builtins<53>,  Prev: Core and Builtins<52>,  Up: Python 3 14 0 alpha 1

1.26.18.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<53>,  Next: ライブラリ<57>,  Prev: ライブラリ<56>,  Up: Python 3 14 0 alpha 1

1.26.18.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: ライブラリ<57>,  Next: Core and Builtins<54>,  Prev: Core and Builtins<53>,  Up: Python 3 14 0 alpha 1

1.26.18.20 ライブラリ
.....................

   - gh-120380(1): Fix Python implementation of *note pickle.Pickler:
     de6. for *note bytes: 1d2. and *note bytearray: 1d1. 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<54>,  Next: ライブラリ<58>,  Prev: ライブラリ<57>,  Up: Python 3 14 0 alpha 1

1.26.18.21 Core and Builtins
............................

   - gh-120397(1): Improve the throughput by up to two times for the
     *note str.count(): 1bb2, *note bytes.count(): 1bb3. and *note
     bytearray.count(): 19b6. 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: 459. 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: 189. 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(): 98b. in the new REPL.
     Patch by Pablo Galindo

   - gh-119180(17): *note classmethod(): 6a0. and *note staticmethod():
     66d. now wrap the *note __annotations__: 672. and *note
     __annotate__: 1bb4. attributes of their underlying callable lazily.
     See PEP 649(18).  Patch by Jelle Zijlstra.

   - gh-119821(19): Fix execution of *note annotation scopes: 6ba.
     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(): 32e. to *note __trunc__(): 442.

   - gh-119689(22): Generate stack effect metadata for pseudo
     instructions from bytecodes.c.

   - gh-109218(23): *note complex(): 330. 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(): 1194.

   - 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: 5a0. and add support for *note
     NotImplementedError: 5a1.

   - 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: fbe.
     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: 11b. module had not yet been
     imported.

   - gh-119057(42): Improve *note ZeroDivisionError: d15. 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: 447. in a boolean
     context now raises *note TypeError: 29c.  Contributed by Jelle
     Zijlstra.

   - gh-118561(48): Fix race condition in free-threaded build where
     *note list.extend(): 7fe. 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: ライブラリ<58>,  Next: Core and Builtins<55>,  Prev: Core and Builtins<54>,  Up: Python 3 14 0 alpha 1

1.26.18.22 ライブラリ
.....................

   - gh-115801(1): Raise ‘TypeError’ when passing a string to *note
     difflib.unified_diff(): 21e. and *note difflib.context_diff():
     1bb6.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115801


File: python.info,  Node: Core and Builtins<55>,  Next: C API<17>,  Prev: ライブラリ<58>,  Up: Python 3 14 0 alpha 1

1.26.18.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__(): 1c7. output of *note
     AST: 2f8. 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(): 679. now deletes all interned
     strings.

   - gh-84978(6): Add class methods *note float.from_number(): 43e. and
     *note complex.from_number(): 43f.

   - 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<17>,  Next: ビルド<16>,  Prev: Core and Builtins<55>,  Up: Python 3 14 0 alpha 1

1.26.18.24 C API
................

   - gh-123961(1): Convert the *note curses.window: 1a44. static type
     exposed by the ‘PyCursesWindow_Type’ macro in ‘Include/py_curses.h’
     to a *note heap type: d33.  Patch by Bénédikt Tran.

   - gh-124502(2): Add *note PyUnicode_Equal(): 5e6. function to the
     limited C API: test if two strings are equal.  Patch by Victor
     Stinner.

   - gh-124296(3): *note PyDictObject: 844. 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(): 5e4. and *note
     Py_tp_token: 5e5. 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(): 552. 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(): 396, *note
     PyType_FromSpecWithBases(): 397. and *note
     PyType_FromModuleAndSpec(): 398. will now fail if the metaclass of
     the new type has custom *note tp_new: 986.

   - gh-107954(13): Add functions to configure the Python initialization
     ( PEP 741(14)):

        * *note PyInitConfig_Create(): 5bb.

        * *note PyInitConfig_Free(): 5bc.

        * *note PyInitConfig_GetError(): 5be.

        * *note PyInitConfig_GetExitCode(): 5bf.

        * *note PyInitConfig_HasOption(): 5c3.

        * *note PyInitConfig_GetInt(): 5c0.

        * *note PyInitConfig_GetStr(): 5c1.

        * *note PyInitConfig_GetStrList(): 5c2.

        * *note PyInitConfig_FreeStrList(): 5bd.

        * *note PyInitConfig_SetInt(): 5c4.

        * *note PyInitConfig_SetStr(): 5c5.

        * *note PyInitConfig_SetStrList(): 5c6.

        * *note PyInitConfig_AddModule(): 5b0.

        * *note Py_InitializeFromInitConfig(): 5ba.

     Patch by Victor Stinner.

   - gh-107954(15): Add functions to get and set the current runtime
     Python configuration:

        * *note PyConfig_Get(): 3ae.

        * *note PyConfig_GetInt(): 5b8.

        * *note PyConfig_Set(): 5b1.

        * *note PyConfig_Names(): 5b9.

     Patch by Victor Stinner.

   - gh-123465(16): *note Py_RELATIVE_OFFSET: 95e. is now allowed in
     *note PyMemberDef: 95f. 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: 1bb9. via the *note PyType_FromSpec(): 396. 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(): 5c9. to compute and
     return the hash value of a buffer.  Patch by Antoine Pitrou and
     Victor Stinner.

   - gh-122728(19): Fix *note PyEval_GetLocals(): 7f4. to avoid *note
     SystemError: 3f1. ("bad argument to internal function").  Patch by
     Victor Stinner.

   - gh-116622(20): Make *note PyObject_Print: 191f. 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(): 5cc. to replace *note
     PyIter_Next(): 5cd, 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): 5b7.
     function, similar to ‘sep.join(iterable)’ in Python.  Patch by
     Victor Stinner.

   - gh-89364(24): Export the *note PySignal_SetWakeupFd(): 1794.
     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(): c88. 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(): 3bd, *note PyDict_SetItemString():
     1bba, *note PyObject_SetAttrString(): 1a8c, *note
     PyObject_DelAttrString(): 1a8e, ‘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(): 1bbb. 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: 32e.:

        * *note PyLong_FromInt32(): 5d7.

        * *note PyLong_FromUInt32(): 5d9.

        * *note PyLong_FromInt64(): 5d8.

        * *note PyLong_FromUInt64(): 5da.

        * *note PyLong_AsInt32(): 5d3.

        * *note PyLong_AsUInt32(): 5d5.

        * *note PyLong_AsInt64(): 5d4.

        * *note PyLong_AsUInt64(): 5d6.

     Patch by Victor Stinner.

   - gh-120600(32): In the limited C API 3.14 and newer, *note
     Py_TYPE(): 5fc. is now implemented as an opaque function call to
     hide implementation details.  Patch by Victor Stinner.

   - gh-70278(33): *note PyUnicode_FromFormat(): 824. 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: 5a. in *note _Py_c_pow(): 3ca. on
     overflows.  Patch by Sergey B Kirpichev.

   - gh-119182(35): Add a new *note PyUnicodeWriter: 5e7. API to create
     a Python *note str: 1ea. object:

        * *note PyUnicodeWriter_Create(): 5e8.

        * *note PyUnicodeWriter_Discard(): 5ea.

        * *note PyUnicodeWriter_Finish(): 5eb.

        * *note PyUnicodeWriter_WriteChar(): 5ee.

        * *note PyUnicodeWriter_WriteUTF8(): 5f3.

        * *note PyUnicodeWriter_WriteUCS4(): 5f2.

        * *note PyUnicodeWriter_WriteWideChar(): 5f4.

        * *note PyUnicodeWriter_WriteStr(): 5f0.

        * *note PyUnicodeWriter_WriteRepr(): 5ef.

        * *note PyUnicodeWriter_WriteSubstring(): 5f1.

        * *note PyUnicodeWriter_Format(): 5ec.

        * *note PyUnicodeWriter_DecodeUTF8Stateful(): 5e9.

     Patch by Victor Stinner.

   - gh-119613(36): Soft deprecate the *note Py_MEMCPY: 1bbc. macro: use
     directly ‘memcpy()’ instead.  Patch by Victor Stinner.

   - gh-119775(37): Creating *note immutable types: 602. with mutable
     bases was deprecated since 3.12 and now raises a *note TypeError:
     29c.

   - gh-119585(38): Fix crash when a thread state that was created by
     *note PyGILState_Ensure(): 1b0. calls a destructor that during
     *note PyThreadState_Clear(): 1bbd. that calls back into
     ‘PyGILState_Ensure()’ and *note PyGILState_Release(): 1b1.  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: 1b2.

   - 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(): 1bbe. and *note
     PyContext_ClearWatcher(): 1bbf. 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: 1bc0. 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(): 1bc1, 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: 699. public in the
     non-limited C API.

   - gh-116560(50): Add *note PyLong_GetSign(): 5ce. function.  Patch by
     Sergey B Kirpichev.

   - gh-97588(51): Fix creating bitfields in *note ctypes: 2d.
     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: ビルド<16>,  Prev: C API<17>,  Up: Python 3 14 0 alpha 1

1.26.18.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: 82e. 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: e4.  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: 1bc3.
     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: 24f. 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: 2e. and *note curses.panel:
     30. 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: 6ae. 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.26.19 Python 3.13.0 beta 1
----------------------------

'Release date: 2024-05-08'

* Menu:

* セキュリティ: セキュリティ<16>.
* Core and Builtins: Core and Builtins<56>.
* ライブラリ: ライブラリ<59>.
* Core and Builtins: Core and Builtins<57>.
* ライブラリ: ライブラリ<60>.
* ドキュメント: ドキュメント<15>.
* ビルド: ビルド<17>.
* Windows: Windows<15>.
* macOS: macOS<10>.
* IDLE: IDLE<9>.
* C API: C API<18>.


File: python.info,  Node: セキュリティ<16>,  Next: Core and Builtins<56>,  Up: Python 3 13 0 beta 1

1.26.19.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: 6b. 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<56>,  Next: ライブラリ<59>,  Prev: セキュリティ<16>,  Up: Python 3 13 0 beta 1

1.26.19.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: ライブラリ<59>,  Next: Core and Builtins<57>,  Prev: Core and Builtins<56>,  Up: Python 3 13 0 beta 1

1.26.19.3 ライブラリ
....................

   - gh-95382(1): Improve performance of *note json.dumps(): 254. and
     *note json.dump(): 10ff. 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<57>,  Next: ライブラリ<60>,  Prev: ライブラリ<59>,  Up: Python 3 13 0 beta 1

1.26.19.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: 18ee. 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: 39. 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(): 1bc9. not to be
     partially set when raising *note TypeError: 29c.

   - 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: 458. 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: 298. and *note PyFrame_GetLocals(): 854. 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: 6ba. 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: 189. message for imports
     without names, like in ‘from x import’ and ‘import’ cases.  It now
     points out to users that *note import: 9df. expects at least one
     name after it.

   - gh-118090(21): Improve *note SyntaxError: 189. 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: 6ba. 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: 6e3. 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: 1d2. and *note bytearray: 1d1. methods by adapting them to
     the *note METH_FASTCALL: 353. calling convention:

        * ‘count()’

        * ‘find()’

        * ‘index()’

        * ‘rfind()’

        * ‘rindex()’

   - gh-117709(32): Speed up calls to *note str(): 1ea. 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(): 563.

   - 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(): 80b. and *note PyRefTracer_GetTracer():
     80c, that allows to track object creation and destruction the same
     way the *note tracemalloc: 108. module does.  Patch by Pablo
     Galindo

   - gh-107674(41): Improved the performance of *note sys.settrace():
     563. significantly

   - gh-95754(42): Improve the error message when a script shadowing a
     module from the standard library causes *note AttributeError: 1b4.
     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(): 190. and *note eval(): 18f. 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: ライブラリ<60>,  Next: ドキュメント<15>,  Prev: Core and Builtins<57>,  Up: Python 3 13 0 beta 1

1.26.19.5 ライブラリ
....................

   - gh-118418(1): A *note DeprecationWarning: 2d4. 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: 1052. and *note typing.AsyncContextManager:
     1bcb, representing the return types of *note __exit__(): 16ba. and
     *note __aexit__(): 1bcc. 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: 1bcd. and *note typing.AsyncGenerator: 1bce.

   - 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: 3e6.
     objects.

   - gh-101732(10): Use a Y2038 compatible openssl time function when
     available.

   - gh-118404(11): Fix *note inspect.signature(): 4c4. for
     non-comparable callables.

   - gh-118402(12): Fix *note inspect.signature(): 4c4. for the result
     of the *note functools.cmp_to_key(): 1598. call.

   - gh-116622(13): On Android, *note sysconfig.get_platform: 15fd. 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: 11ea, *note
     operator.itemgetter: e2a, and *note operator.methodcaller: 11eb.
     instances.

   - gh-118314(16): Fix an edge case in *note binascii.a2b_base64():
     208. 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():
     756. could fail if a custom *note row factory: 1bcf. was used.
     Patch by Erlend Aasland.

   - gh-118013(20): Fix regression introduced in gh-103193(21) that
     meant that calling *note inspect.getattr_static(): 8aa. on an
     instance would cause a strong reference to that instance's class to
     persist in an internal cache in the *note inspect: 81. 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(): bf2. in the
     common case by up to 1.8x.

   - gh-117486(23): Improve the behavior of user-defined subclasses of
     *note ast.AST: 2f8.  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(): 1b6d. to
     configure parent mock with keyword arguments.

   - gh-118168(25): Fix incorrect argument substitution when *note
     typing.Unpack: 1bd0. is used with the builtin *note tuple: 1d9.
     ‘typing.Unpack’ now raises *note TypeError: 29c. when used with
     certain invalid types.  Patch by Jelle Zijlstra.

   - gh-118131(26): Add command-line interface for the *note random: c0.
     module.  Patch by Hugo van Kemenade.

   - gh-118107(27): Fix *note zipimport: 13b. reading of ZIP64 files
     with file entries that are too big or offset too far.

   - gh-102511(28): Fix *note os.path.normpath(): 16d3. for UNC paths on
     Windows.  Speed up *note os.path.splitroot(): 8b9. with a native
     implementation.

   - gh-117535(29): Change the unknown filename of *note warnings: 11b.
     from ‘sys’ to ‘<sys>’ to clarify that it's not a real filename.

   - gh-114053(30): Fix erroneous *note NameError: 66c. when calling
     *note typing.get_type_hints(): aa3. 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(): 1bd1.

   - gh-117995(33): Don't raise *note DeprecationWarning: 2d4. when a
     *note sequence: 904. 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(): 158b. 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:
     e7. 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(): 73f. by omitting
     an initial *note is_dir(): 742. call.  As a result of this change,
     ‘glob()’ can no longer raise *note OSError: 543.

   - gh-77102(41): *note site: cf. module now parses ‘.pth’ file with
     UTF-8 first, and *note locale encoding: 752. 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(): 73f. by not
     scanning directories for non-wildcard pattern segments.

   - gh-117727(45): Speed up *note pathlib.Path.iterdir(): 4fd. by using
     *note os.scandir(): e27. internally.

   - gh-117586(46): Speed up *note pathlib.Path.walk(): 8bd. by working
     with strings internally.

   - gh-117722(47): Change the new multi-separator support in *note
     asyncio.StreamReader.readuntil(): 6dc. to only accept tuples of
     separators rather than arbitrary iterables.

   - gh-117692(48): Fixes a bug when *note doctest.DocTestFinder: 1bd2.
     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(): 33c. 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(): 1a62.

   - 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(): 8bf.

   - gh-117586(56): Speed up *note pathlib.Path.glob(): 73f. 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(): 1bd3.
     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(): 24d.
     stopped resolving symlinks after encountering a symlink loop on
     POSIX.

   - gh-116720(60): Improved behavior of *note asyncio.TaskGroup: 6dd.
     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: 6de, it will now call the
     parent task's *note cancel(): 6df. method.  This ensures that a
     *note asyncio.CancelledError: 6e0. will be raised at the next *note
     await: 439, 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(): 6e1.).

     In order to handle some corner cases, *note
     asyncio.Task.uncancel(): 6e2. may now reset the undocumented
     ‘_must_cancel’ flag when the cancellation count reaches zero.

   - gh-117516(61): Add *note typing.TypeIs: 69d, 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(): ddc. on Posix.

   - gh-117394(64): *note os.path.ismount(): dda. 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: 3e. 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(): 720.
     function which works with file path.  Passing file path instead of
     URL in *note guess_type(): 721. is *note soft deprecated: 1b2.

   - 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: 1b4. and
     *note ImportError: 1c8. 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(): 1ec. 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: 8d, *note tarfile: e7. and *note zipfile: 13a.  The value of
     the ‘mode’ attribute of *note gzip.GzipFile: 84f. 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(): 850. was changed from ‘'r'’ to
     ‘'rb'’.

   - gh-82062(73): Fix *note inspect.signature(): 4c4. 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: 8bb.
     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__(): b26. to *note
     types.GeneratorType: 1bd4. and *note types.CoroutineType: 123d. for
     type hinting purposes.  Patch by James Hilton-Balfe.

   - gh-108191(81): The *note types.SimpleNamespace: 6f0. 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: 1bd5. object or call the
     ‘wantobjects()’ method of the ‘Tk’ object with argument ‘2’ makes
     now arguments to callbacks registered in the *note tkinter: f9.
     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(): 750. now supports 'dir_fd' and
     'follow_symlinks' keyword arguments.

   - bpo-30988(90): Fix parsing of emails with invalid address headers
     having a leading or trailing dot.  Patch by tsufeki.

   - bpo-32839(91): Add the ‘after_info()’ method for Tkinter widgets.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118418

   (2) https://github.com/python/cpython/issues/118660

   (3) https://github.com/python/cpython/issues/118650

   (4) https://github.com/python/cpython/issues/118648

   (5) https://github.com/python/cpython/issues/101137

   (6) https://github.com/python/cpython/issues/118164

   (7) https://github.com/python/cpython/issues/111744

   (8) https://github.com/python/cpython/issues/118500

   (9) https://github.com/python/cpython/issues/118406

   (10) https://github.com/python/cpython/issues/101732

   (11) https://github.com/python/cpython/issues/118404

   (12) https://github.com/python/cpython/issues/118402

   (13) https://github.com/python/cpython/issues/116622

   (14) https://peps.python.org/pep-0738/

   (15) https://github.com/python/cpython/issues/118285

   (16) https://github.com/python/cpython/issues/118314

   (17) https://github.com/python/cpython/issues/118271

   (18) https://github.com/python/cpython/issues/118225

   (19) https://github.com/python/cpython/issues/118221

   (20) https://github.com/python/cpython/issues/118013

   (21) https://github.com/python/cpython/issues/103193

   (22) https://github.com/python/cpython/issues/118218

   (23) https://github.com/python/cpython/issues/117486

   (24) https://github.com/python/cpython/issues/90848

   (25) https://github.com/python/cpython/issues/118168

   (26) https://github.com/python/cpython/issues/118131

   (27) https://github.com/python/cpython/issues/118107

   (28) https://github.com/python/cpython/issues/102511

   (29) https://github.com/python/cpython/issues/117535

   (30) https://github.com/python/cpython/issues/114053

   (31) https://peps.python.org/pep-0695/

   (32) https://github.com/python/cpython/issues/116931

   (33) https://github.com/python/cpython/issues/117995

   (34) https://github.com/python/cpython/issues/100668

   (35) https://github.com/python/cpython/issues/80361

   (36) https://datatracker.ietf.org/doc/html/rfc2231.html

   (37) https://github.com/python/cpython/issues/86650

   (38) https://github.com/python/cpython/issues/117691

   (39) https://github.com/python/cpython/issues/115874

   (40) https://github.com/python/cpython/issues/115060

   (41) https://github.com/python/cpython/issues/77102

   (42) https://github.com/python/cpython/issues/76785

   (43) https://peps.python.org/pep-0734/

   (44) https://github.com/python/cpython/issues/115060

   (45) https://github.com/python/cpython/issues/117727

   (46) https://github.com/python/cpython/issues/117586

   (47) https://github.com/python/cpython/issues/117722

   (48) https://github.com/python/cpython/issues/117692

   (49) https://github.com/python/cpython/issues/117348

   (50) https://github.com/python/cpython/issues/117641

   (51) https://github.com/python/cpython/issues/117663

   (52) https://github.com/python/cpython/issues/117636

   (53) https://github.com/python/cpython/issues/117618

   (54) https://github.com/python/cpython/issues/102247

   (55) https://github.com/python/cpython/issues/117607

   (56) https://github.com/python/cpython/issues/117586

   (57) https://github.com/python/cpython/issues/117225

   (58) https://github.com/python/cpython/issues/117566

   (59) https://github.com/python/cpython/issues/117546

   (60) https://github.com/python/cpython/issues/116720

   (61) https://github.com/python/cpython/issues/117516

   (62) https://peps.python.org/pep-0742/

   (63) https://github.com/python/cpython/issues/117503

   (64) https://github.com/python/cpython/issues/117394

   (65) https://github.com/python/cpython/issues/117313

   (66) https://github.com/python/cpython/issues/117142

   (67) https://peps.python.org/pep-0489/

   (68) https://github.com/python/cpython/issues/66543

   (69) https://github.com/python/cpython/issues/68583

   (70) https://github.com/python/cpython/issues/116871

   (71) https://github.com/python/cpython/issues/116023

   (72) https://github.com/python/cpython/issues/115961

   (73) https://github.com/python/cpython/issues/82062

   (74) https://github.com/python/cpython/issues/83856

   (75) https://github.com/python/cpython/issues/113081

   (76) https://github.com/python/cpython/issues/112855

   (77) https://github.com/python/cpython/issues/111744

   (78) https://github.com/python/cpython/issues/109617

   (79) https://github.com/python/cpython/issues/83151

   (80) https://github.com/python/cpython/issues/110209

   (81) https://github.com/python/cpython/issues/108191

   (82) https://github.com/python/cpython/issues/62090

   (83) https://github.com/python/cpython/issues/102402

   (84) https://github.com/python/cpython/issues/100242

   (85) https://github.com/python/cpython/issues/99730

   (86) https://github.com/python/cpython/issues/66410

   (87) https://bugs.python.org/issue?@action=redirect&bpo=40943

   (88) https://bugs.python.org/issue?@action=redirect&bpo=39324

   (89) https://bugs.python.org/issue?@action=redirect&bpo=18108

   (90) https://bugs.python.org/issue?@action=redirect&bpo=30988

   (91) https://bugs.python.org/issue?@action=redirect&bpo=32839


File: python.info,  Node: ドキュメント<15>,  Next: ビルド<17>,  Prev: ライブラリ<60>,  Up: Python 3 13 0 beta 1

1.26.19.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: ビルド<17>,  Next: Windows<15>,  Prev: ドキュメント<15>,  Up: Python 3 13 0 beta 1

1.26.19.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 ‘--with-system-libmpdec’ 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: 39. dependencies if the ‘--with-system-libmpdec’ option is
     given.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118734

   (2) https://github.com/python/cpython/issues/115119

   (3) https://github.com/python/cpython/issues/117845

   (4) https://github.com/python/cpython/issues/116622

   (5) https://github.com/python/cpython/issues/117645

   (6) https://github.com/python/cpython/issues/115119


File: python.info,  Node: Windows<15>,  Next: macOS<10>,  Prev: ビルド<17>,  Up: Python 3 13 0 beta 1

1.26.19.8 Windows
.................

   - gh-115119(1): Update Windows installer to use libmpdecimal 4.0.0.

   - gh-118486(2): *note os.mkdir(): 734. 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<10>,  Next: IDLE<9>,  Prev: Windows<15>,  Up: Python 3 13 0 beta 1

1.26.19.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<18>,  Prev: macOS<10>,  Up: Python 3 13 0 beta 1

1.26.19.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<18>,  Prev: IDLE<9>,  Up: Python 3 13 0 beta 1

1.26.19.11 C API
................

   - gh-118124(1): Fix *note Py_BUILD_ASSERT: 1bdc. and *note
     Py_BUILD_ASSERT_EXPR: 1bdd. 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(): 7d7.

        * *note PyTime_PerfCounterRaw(): 7d9.

        * *note PyTime_TimeRaw(): 7db.

     Patch by Victor Stinner.

   - gh-117987(3): Restore functions removed in Python 3.13 alpha 1:

        * *note Py_SetPythonHome(): 1bde.

        * *note Py_SetProgramName(): 1bdf.

        * *note PySys_SetArgvEx(): 1be0.

        * *note PySys_SetArgv(): 1be1.

     Patch by Victor Stinner.

   - gh-117929(4): Restore removed *note PyEval_InitThreads(): 1be2.
     function.  Patch by Victor Stinner.

   - gh-117534(5): Improve validation logic in the C implementation of
     *note datetime.datetime.fromisoformat(): a0f. 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.26.20 Python 3.13.0 alpha 6
-----------------------------

'Release date: 2024-04-09'

* Menu:

* Core and Builtins: Core and Builtins<58>.
* ライブラリ: ライブラリ<61>.
* Core and Builtins: Core and Builtins<59>.
* ライブラリ: ライブラリ<62>.
* ドキュメント: ドキュメント<16>.
* テスト: テスト<19>.
* ビルド: ビルド<18>.
* Windows: Windows<16>.
* C API: C API<19>.


File: python.info,  Node: Core and Builtins<58>,  Next: ライブラリ<61>,  Up: Python 3 13 0 alpha 6

1.26.20.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:
     1d2. and *note bytearray: 1d1. methods by adapting them to the
     *note METH_FASTCALL: 353. calling convention:

        * ‘endswith()’

        * ‘startswith()’

   - gh-117431(4): Improve the performance of the following *note str:
     1ea. methods by adapting them to the *note METH_FASTCALL: 353.
     calling convention:

        * *note count(): 1bb2.

        * *note endswith(): 127d.

        * *note find(): 125c.

        * *note index(): 1be5.

        * *note rfind(): 125d.

        * *note rindex(): 1611.

        * *note startswith(): 127c.

   - 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: 2f8.  Such classes are now expected to set the
     ‘_field_types’ attribute.

   - gh-99108(8): Updated the *note hashlib: 6b. 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: 1be6.
     event.

   - gh-113964(13): Starting new threads and process creation through
     *note os.fork(): 6c3. are now only prevented once all non-daemon
     threads exit.

   - gh-116626(14): Ensure ‘INSTRUMENTED_CALL_FUNCTION_EX’ always emits
     *note CALL: 1be6.

   - 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: ライブラリ<61>,  Next: Core and Builtins<59>,  Prev: Core and Builtins<58>,  Up: Python 3 13 0 alpha 6

1.26.20.2 ライブラリ
....................

   - gh-109870(1): Dataclasses now calls *note exec(): 190. 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<59>,  Next: ライブラリ<62>,  Prev: ライブラリ<61>,  Up: Python 3 13 0 alpha 6

1.26.20.3 Core and Builtins
...........................

   - bpo-24612(1): Improve the *note SyntaxError: 189. 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: ライブラリ<62>,  Next: ドキュメント<16>,  Prev: Core and Builtins<59>,  Up: Python 3 13 0 alpha 6

1.26.20.4 ライブラリ
....................

   - gh-117648(1): Improve performance of *note os.path.join(): 1a62.
     and *note os.path.expanduser(): ddc.

   - gh-117584(2): Raise *note TypeError: 29c. for non-paths in *note
     posixpath.relpath: 8bf.

   - gh-117467(3): Preserve mailbox ownership when rewriting in *note
     mailbox.mbox.flush: 1bea.  Patch by Tony Mountifield.

   - gh-114848(4): Raise *note FileNotFoundError: 24f. 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: c12.
     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(): 2df. 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: 6ea. now accepts
     unnamed sections before named ones, if configured to do so.

   - gh-88014(12): In documentation of *note gzip.GzipFile: 84f. 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: d8. 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: df, 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(): eec. 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: 3b. 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: 11cb.

   - gh-117084(22): Fix *note zipfile: 13a. extraction for directory
     entries with the name containing backslashes on Windows.

   - gh-117114(23): Make *note os.path.isdevdrive(): 1beb. 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: a9f. 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(): 2dd. and *note
     time.strptime(): 17e5. which always fails to parse a date string
     with a *note ValueError: 15a. 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(): 272. 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(): 764. 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: 113. functions *note parse_qs(): 590. and *note
     parse_qsl(): 58f.  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: 1bec. (see these docs
          for details)

        * *note ipaddress.IPv4Address.is_global: 130e.

        * *note ipaddress.IPv6Address.is_private: 1bed.

        * *note ipaddress.IPv6Address.is_global: 1bee.

     Also in the corresponding *note ipaddress.IPv4Network: 718. and
     *note ipaddress.IPv6Network: 719. attributes.

   - gh-63283(40): In *note encodings.idna: 55, 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(): 1bef, which
     provides device and OS information on Android.

   - gh-73468(42): Added new *note math.fma(): 71e. function, wrapping
     C99's ‘fma()’ operation: fused multiply-add function.  Patch by
     Mark Dickinson and Victor Stinner.

   - gh-116608(43): The *note importlib.resources: 7e. functions *note
     is_resource(): 708, *note open_binary(): 709, *note open_text():
     70a, *note path(): 70b, *note read_binary(): 70c, and *note
     read_text(): 70d. are un-deprecated, and support subdirectories via
     multiple positional arguments.  The *note contents(): 70e. function
     also allows subdirectories, but remains deprecated.

   - gh-116484(44): Change automatically generated ‘tkinter.Checkbutton’
     widget names to avoid collisions with automatically generated
     ‘tkinter.ttk.Checkbutton’ widget names within the same parent
     widget.

   - gh-114314(45): In *note ctypes: 2d, 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(): f1c. and *note
     shutil.rmtree(): 33d. on opening named pipe.

   - gh-71052(47): Implement *note ctypes.util.find_library(): 1102. 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: 119.: ‘_has_uuid_generate_time_safe’, ‘_netbios_getnode’,
     ‘_ipconfig_getnode’, and ‘_load_system_functions’.  They were
     unused.

   - gh-115627(50): Fix the *note ssl: d8. 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(): 24d. 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(): 6da. and
     *note asyncio.Server.abort_clients(): 6db. 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: e3d. termination with *note
     shutdown(): 6d8. method.

   - gh-89739(59): The *note zipimport: 13b. module can now read ZIP64
     files.

   - bpo-33533(60): *note asyncio.as_completed(): 6d2. 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():
     1bf0.'s iteration pattern.  Patch by Justin Arthur.

   - bpo-27578(61): *note inspect.getsource(): 1a24. (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(): 6dc, stopping when one of them is
     encountered.

   - gh-66543(63): Make *note mimetypes.guess_type(): 721. 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(): 1393. now
     saves the original value of ‘unittest.TestLoader._top_level_dir’
     and restores it at the end of the call.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117648

   (2) https://github.com/python/cpython/issues/117584

   (3) https://github.com/python/cpython/issues/117467

   (4) https://github.com/python/cpython/issues/114848

   (5) https://github.com/python/cpython/issues/117459

   (6) https://github.com/python/cpython/issues/117381

   (7) https://github.com/python/cpython/issues/117337

   (8) https://github.com/python/cpython/issues/117349

   (9) https://github.com/python/cpython/issues/117348

   (10) https://github.com/python/cpython/issues/117335

   (11) https://github.com/python/cpython/issues/66449

   (12) https://github.com/python/cpython/issues/88014

   (13) https://github.com/python/cpython/issues/117310

   (14) https://github.com/python/cpython/issues/117294

   (15) https://github.com/python/cpython/issues/98966

   (16) https://github.com/python/cpython/issues/117225

   (17) https://github.com/python/cpython/issues/117205

   (18) https://github.com/python/cpython/issues/117178

   (19) https://github.com/python/cpython/issues/114781

   (20) https://github.com/python/cpython/issues/112383

   (21) https://github.com/python/cpython/issues/117182

   (22) https://github.com/python/cpython/issues/117084

   (23) https://github.com/python/cpython/issues/117114

   (24) https://github.com/python/cpython/issues/117110

   (25) https://github.com/python/cpython/issues/109653

   (26) https://github.com/python/cpython/issues/70647

   (27) https://github.com/python/cpython/issues/116987

   (28) https://github.com/python/cpython/issues/114099

   (29) https://github.com/python/cpython/issues/90872

   (30) https://github.com/python/cpython/issues/116957

   (31) https://github.com/python/cpython/issues/115538

   (32) https://github.com/python/cpython/issues/90095

   (33) https://github.com/python/cpython/issues/106531

   (34) https://zipp.readthedocs.io/en/latest/history.html#v3-18-0

   (35) https://github.com/python/cpython/issues/63207

   (36) https://github.com/python/cpython/issues/116764

   (37) https://github.com/python/cpython/issues/116811

   (38) https://github.com/python/cpython/issues/116647

   (39) https://github.com/python/cpython/issues/113171

   (40) https://github.com/python/cpython/issues/63283

   (41) https://github.com/python/cpython/issues/71042

   (42) https://github.com/python/cpython/issues/73468

   (43) https://github.com/python/cpython/issues/116608

   (44) https://github.com/python/cpython/issues/116484

   (45) https://github.com/python/cpython/issues/114314

   (46) https://github.com/python/cpython/issues/116401

   (47) https://github.com/python/cpython/issues/71052

   (48) https://github.com/python/cpython/issues/90535

   (49) https://github.com/python/cpython/issues/113308

   (50) https://github.com/python/cpython/issues/115627

   (51) https://github.com/python/cpython/issues/114847

   (52) https://github.com/python/cpython/issues/114271

   (53) https://github.com/python/cpython/issues/113538

   (54) https://github.com/python/cpython/issues/85287

   (55) https://github.com/python/cpython/issues/113548

   (56) https://github.com/python/cpython/issues/112948

   (57) https://github.com/python/cpython/issues/105866

   (58) https://github.com/python/cpython/issues/96471

   (59) https://github.com/python/cpython/issues/89739

   (60) https://bugs.python.org/issue?@action=redirect&bpo=33533

   (61) https://bugs.python.org/issue?@action=redirect&bpo=27578

   (62) https://bugs.python.org/issue?@action=redirect&bpo=37141

   (63) https://github.com/python/cpython/issues/66543

   (64) https://bugs.python.org/issue?@action=redirect&bpo=15010


File: python.info,  Node: ドキュメント<16>,  Next: テスト<19>,  Prev: ライブラリ<62>,  Up: Python 3 13 0 alpha 6

1.26.20.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: テスト<19>,  Next: ビルド<18>,  Prev: ドキュメント<16>,  Up: Python 3 13 0 alpha 6

1.26.20.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: ビルド<18>,  Next: Windows<16>,  Prev: テスト<19>,  Up: Python 3 13 0 alpha 6

1.26.20.7 ビルド
................

   - gh-114736(1): Have WASI builds use WASI SDK 21.

   - gh-115983(2): Skip building test modules that must be built as
     shared under WASI.

   - gh-71052(3): Add Android build script and instructions.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114736

   (2) https://github.com/python/cpython/issues/115983

   (3) https://github.com/python/cpython/issues/71052


File: python.info,  Node: Windows<16>,  Next: C API<19>,  Prev: ビルド<18>,  Up: Python 3 13 0 alpha 6

1.26.20.8 Windows
.................

   - gh-117267(1): Ensure ‘DirEntry.stat().st_ctime’ behaves
     consistently with *note os.stat(): 4fc. 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(): 1bf5. by
     using an alternate system API when available.  Contributed by
     vxiiduu.

   - gh-88494(3): On Windows, *note time.monotonic(): 763. 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<19>,  Prev: Windows<16>,  Up: Python 3 13 0 alpha 6

1.26.20.9 C API
...............

   - gh-117642(1): Fix PEP 737(2) implementation for ‘%#T’ and ‘%#N’.

   - gh-87193(3): *note _PyBytes_Resize(): 3bb. 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(): 1bf7.
     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(): 821.
     (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(): 82d. 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(): 7f5. and *note
     Py_GetConstantBorrowed(): 7f6. functions to get constants.  For
     example, ‘Py_GetConstant(Py_CONSTANT_ZERO)’ returns a *note strong
     reference: 7e0. to the constant zero.  Patch by Victor Stinner.

   - gh-111696(13): Add support for ‘%T’, ‘%T#’, ‘%N’ and ‘%N#’ formats
     to *note PyUnicode_FromFormat(): 824.: format the fully qualified
     name of an object type and of a type: call *note
     PyType_GetModuleName(): 812.  See PEP 737(14) for more information.
     Patch by Victor Stinner.

   - gh-111696(15): Add *note PyType_GetModuleName(): 812. 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(): 810.
     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: 82f.  Patch by Victor Stinner.

   - gh-111140(18): Add additional flags to *note
     PyLong_AsNativeBytes(): 802. and *note PyLong_FromNativeBytes():
     803. 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(): 808. 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.26.21 Python 3.13.0 alpha 5
-----------------------------

'Release date: 2024-03-12'

* Menu:

* セキュリティ: セキュリティ<17>.
* Core and Builtins: Core and Builtins<60>.
* ライブラリ: ライブラリ<63>.
* Core and Builtins: Core and Builtins<61>.
* ライブラリ: ライブラリ<64>.
* Core and Builtins: Core and Builtins<62>.
* ライブラリ: ライブラリ<65>.
* ドキュメント: ドキュメント<17>.
* テスト: テスト<20>.
* ビルド: ビルド<19>.
* Windows: Windows<17>.
* macOS: macOS<11>.
* IDLE: IDLE<10>.
* Tools/Demos: Tools/Demos<14>.
* C API: C API<20>.


File: python.info,  Node: セキュリティ<17>,  Next: Core and Builtins<60>,  Up: Python 3 13 0 alpha 5

1.26.21.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(): 77d.

        * *note xml.etree.ElementTree.XMLPullParser.flush(): 77e.

        * *note xml.parsers.expat.xmlparser.GetReparseDeferralEnabled():
          77f.

        * *note xml.parsers.expat.xmlparser.SetReparseDeferralEnabled():
          780.

        * ‘xml.sax.expatreader.ExpatParser.flush()’

   - gh-114572(3): *note ssl.SSLContext.cert_store_stats(): 135a. and
     *note ssl.SSLContext.get_ca_certs(): 135b. now correctly lock
     access to the certificate store, when the *note ssl.SSLContext:
     33e. 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<60>,  Next: ライブラリ<63>,  Prev: セキュリティ<17>,  Up: Python 3 13 0 alpha 5

1.26.21.2 Core and Builtins
...........................

   - gh-116604(1): Respect the status of the garbage collector when
     indirect calls are made via *note PyErr_CheckSignals(): 885. and
     the evaluation breaker.  Patch by Pablo Galindo

   - gh-112087(2): *note list: 4e0. 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: 189. 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(): 19ac. is called with a *note str: 1ea. 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: ライブラリ<63>,  Next: Core and Builtins<61>,  Prev: Core and Builtins<60>,  Up: Python 3 13 0 alpha 5

1.26.21.3 ライブラリ
....................

   - gh-115154(1): Fix a bug that was causing the *note
     tokenize.untokenize(): 1af3. 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<61>,  Next: ライブラリ<64>,  Prev: ライブラリ<63>,  Up: Python 3 13 0 alpha 5

1.26.21.4 Core and Builtins
...........................

   - gh-112433(1): Add ability to force alignment of *note
     ctypes.Structure: 483. by way of the new ‘_align_’ attribute on the
     class.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112433


File: python.info,  Node: ライブラリ<64>,  Next: Core and Builtins<62>,  Prev: Core and Builtins<61>,  Up: Python 3 13 0 alpha 5

1.26.21.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<62>,  Next: ライブラリ<65>,  Prev: ライブラリ<64>,  Up: Python 3 13 0 alpha 5

1.26.21.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: ライブラリ<65>,  Next: ドキュメント<17>,  Prev: Core and Builtins<62>,  Up: Python 3 13 0 alpha 5

1.26.21.7 ライブラリ
....................

   - gh-116600(1): Fix *note repr(): 462. for global *note Flag: a19.
     members.

   - gh-116349(2): ‘platform.java_ver()’ 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: 10d.: implement PEP 705(5) which adds
     *note typing.ReadOnly: 69c. support to *note typing.TypedDict: 29b.

   - gh-116325(6): *note typing: 10d.: raise *note SyntaxError: 189.
     instead of *note AttributeError: 1b4. 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: bd.

   - 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: 11e. to check desktop.  Prefer it to the
     deprecated ‘GNOME_DESKTOP_SESSION_ID’ for GNOME detection.

   - gh-75988(17): Fixed *note unittest.mock.create_autospec(): 1b6d. to
     pass the call through to the wrapped object to return the real
     result.

   - gh-115881(18): Fix issue where *note ast.parse(): 1d4. 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:
     1c00.

   - gh-115532(21): Add kernel density estimation to the statistics
     module.

   - gh-115714(22): On WASI, the *note time: f7. 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: 113. functions *note parse_qs():
     590. and *note parse_qsl(): 58f. now support bytes arguments
     containing raw and percent-encoded non-ASCII data.

   - gh-67044(25): *note csv.writer(): 89e. 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: 2c.  *note csv.writer(): 89e.
     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(): cba. 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: 6c1. methods *note getter():
     1c01, *note setter(): 1c02. and *note deleter(): 1c03.

   - 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(): 130b. for types with the
     ‘__wrapper__’ data descriptor.  Fix *note
     inspect.Signature.from_callable(): b25. for builtins *note
     classmethod(): 6a0. and *note staticmethod(): 66d.

   - 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(): b25.

   - gh-103092(35): Isolate ‘_lsprof’ (apply PEP 687(36)).

   - gh-113942(37): *note pydoc: bd. 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: 1072. 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: 15a. exception when passed an empty iterable.
     Previously, *note IndexError: 18ed. was raised.

     ‘posixpath.commonpath()’ now raises a *note TypeError: 29c.
     exception when passed ‘None’.  Previously, *note ValueError: 15a.
     was raised.

   - gh-114610(43): Fix bug where *note pathlib.PurePath.with_stem():
     1c04. converted a non-empty path suffix to a stem when given an
     empty 'stem' argument.  It now raises *note ValueError: 15a, just
     like *note pathlib.PurePath.with_suffix(): 1b89. 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: 696. and
     ‘VERIFY_X509_STRICT’ to the default SSL context created with *note
     ssl.create_default_context(): 695.

   - gh-112281(45): Allow creating *note union of types: ba6. for *note
     typing.Annotated: d0d. 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: 919. from
     *note read(): 1820. and *note read_file(): 91a. methods of *note
     configparser.ConfigParser: 6ea. 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: 1657. function, which has an ‘__annotations__’
     dictionary attribute with a ‘"return"’ key.

   - gh-57141(50): Add option for 'non-shallow' comparisons to *note
     filecmp.dircmp: 12f0. like *note filecmp.cmp(): 1c05.  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: 1c06. name in the
     *note repr(): 462. of *note functools.partial(): 4ad. 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: 1310. 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(): 1c07. 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(): 229. now throws a TypeError
     instead of hitting an index out of bounds internally.

   - bpo-40818(66): The asyncio REPL now runs *note
     sys.__interactivehook__: 1376. 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: ドキュメント<17>,  Next: テスト<20>,  Prev: ライブラリ<65>,  Up: Python 3 13 0 alpha 5

1.26.21.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: 119. 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: テスト<20>,  Next: ビルド<19>,  Prev: ドキュメント<17>,  Up: Python 3 13 0 alpha 5

1.26.21.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: ビルド<19>,  Next: Windows<17>,  Prev: テスト<20>,  Up: Python 3 13 0 alpha 5

1.26.21.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: 51f. from
     ‘"linux"’ to ‘"android"’.

   - gh-116117(3): Backport ‘libb2’'s PR #42 to fix compiling CPython on
     32-bit Windows with ‘clang-cl’.

   - gh-71052(4): Fix several Android build issues

   - gh-114099(5): A testbed project was added to run the test suite on
     iOS.

   - gh-115350(6): Fix building ctypes module with -DWIN32_LEAN_AND_MEAN
     defined

   - gh-111225(7): Link extension modules against libpython on Android.

   - gh-115737(8): The install name for libPython is now correctly set
     for non-framework macOS builds.

   - gh-114099(9): Makefile targets were added to support compiling an
     iOS-compatible framework build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116313

   (2) https://github.com/python/cpython/issues/71052

   (3) https://github.com/python/cpython/issues/116117

   (4) https://github.com/python/cpython/issues/71052

   (5) https://github.com/python/cpython/issues/114099

   (6) https://github.com/python/cpython/issues/115350

   (7) https://github.com/python/cpython/issues/111225

   (8) https://github.com/python/cpython/issues/115737

   (9) https://github.com/python/cpython/issues/114099


File: python.info,  Node: Windows<17>,  Next: macOS<11>,  Prev: ビルド<19>,  Up: Python 3 13 0 alpha 5

1.26.21.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: 9c1.  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: 9c1. 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<11>,  Next: IDLE<10>,  Prev: Windows<17>,  Up: Python 3 13 0 alpha 5

1.26.21.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<14>,  Prev: macOS<11>,  Up: Python 3 13 0 alpha 5

1.26.21.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<14>,  Next: C API<20>,  Prev: IDLE<10>,  Up: Python 3 13 0 alpha 5

1.26.21.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<20>,  Prev: Tools/Demos<14>,  Up: Python 3 13 0 alpha 5

1.26.21.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: 1c10, *note PyHASH_BITS:
     1c11, *note PyHASH_INF: 1c12. and *note PyHASH_IMAG: 1c13. 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.26.22 Python 3.13.0 alpha 4
-----------------------------

'Release date: 2024-02-15'

* Menu:

* セキュリティ: セキュリティ<18>.
* Core and Builtins: Core and Builtins<63>.
* ライブラリ: ライブラリ<66>.
* ドキュメント: ドキュメント<18>.
* テスト: テスト<21>.
* ビルド: ビルド<20>.
* Windows: Windows<18>.
* macOS: macOS<12>.
* IDLE: IDLE<11>.
* Tools/Demos: Tools/Demos<15>.
* C API: C API<21>.


File: python.info,  Node: セキュリティ<18>,  Next: Core and Builtins<63>,  Up: Python 3 13 0 alpha 4

1.26.22.1 セキュリティ
......................

   - gh-115399(1): Update bundled libexpat to 2.6.0

   - gh-115243(2): Fix possible crashes in *note
     collections.deque.index(): 118d. 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<63>,  Next: ライブラリ<66>,  Prev: セキュリティ<18>,  Up: Python 3 13 0 alpha 4

1.26.22.2 Core and Builtins
...........................

   - gh-112087(1): For an empty reverse iterator for list will be
     reduced to *note reversed(): c40.  Patch by Donghee Na

   - gh-114570(2): Add *note PythonFinalizationError: 691. exception.
     This exception derived from *note RuntimeError: 317. is raised when
     an operation is blocked during the *note Python finalization: 1ab.
     Patch by Victor Stinner.

   - gh-114695(3): Add *note sys._clear_internal_caches(): 34d, which
     clears all internal performance-related caches (and deprecate the
     less-general *note sys._clear_type_cache(): 34c. function).

   - gh-114828(4): Fix compilation crashes in uncommon code examples
     using *note super(): 44a. inside a comprehension in a class body.

   - gh-112069(5): Adapt *note set: 432. and *note frozenset: 9d9.
     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__(): 444. method as for *note int: 32e.

   - gh-114887(7): Changed socket type validation in *note
     create_datagram_endpoint(): b1f. 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(): 1c17. builtin function now always
     raises *note ValueError: 15a. for values outside the valid range.
     Previously it raised *note OverflowError: c5b. 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: 6e3. emitted when assign
     an integer-like value that is not an instance of *note int: 32e. to
     an attribute that corresponds to a C struct member of *note type:
     1c18. 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: f2b. 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: 9db. to use
     Argument Clinic.

   - gh-112050(25): Make methods on *note collections.deque: 9db.
     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: 191. 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: ライブラリ<66>,  Next: ドキュメント<18>,  Prev: Core and Builtins<63>,  Up: Python 3 13 0 alpha 4

1.26.22.3 ライブラリ
....................

   - gh-115392(1): Fix a bug in *note doctest: 3d. where incorrect line
     numbers would be reported for decorated functions.

   - gh-114563(2): Fix several *note format(): 440. bugs when using the
     C implementation of *note Decimal: 1cd.: * 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:
     1ce. and *note complex: 330.

   - gh-115165(4): Most exceptions are now ignored when attempting to
     set the ‘__orig_class__’ attribute on objects returned when calling
     *note typing: 10d. generic aliases (including generic aliases
     created using *note typing.Annotated: d0d.).  Previously only *note
     AttributeError: 1b4. 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: 13a1. 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(): 2df.

   - gh-67837(9): Avoid race conditions in the creation of directories
     during concurrent extraction in *note tarfile: e7. and *note
     zipfile: 13a.

   - gh-115060(10): Speed up *note pathlib.Path.glob(): 73f. by removing
     redundant regex matching.

   - gh-97928(11): Partially revert the behavior of
     ‘tkinter.Text.count()’.  By default it preserves the behavior of
     older Python versions, except that setting ‘wantobjects’ to 0 no
     longer has effect.  Add a new parameter 'return_ints': specifying
     ‘return_ints=True’ makes ‘Text.count()’ always returning the single
     count as an integer instead of a 1-tuple or ‘None’.

   - gh-114628(12): When csv.Error is raised when handling TypeError, do
     not print the TypeError traceback.

   - gh-85984(13): Added ‘_POSIX_VDISABLE’ from C's ‘<unistd.h>’ to
     *note termios: ea.

   - gh-114965(14): Update bundled pip to 24.0

   - gh-114959(15): *note tarfile: e7. no longer ignores errors when
     trying to extract a directory on top of a file.

   - gh-114894(16): Add *note array.array.clear(): 6cd.

   - 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: 494.-*note datetime: 6ed. comparison.
     Now the special comparison methods like ‘__eq__’ and ‘__lt__’
     return *note NotImplemented: 447. 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: 29c.  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: 1cd. 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(): 73f. if a pattern ends with "‘**’".
     Previously only directories were returned.

   - gh-109653(23): Improve import time of *note importlib.metadata: 7d.
     and *note email.utils: 53.

   - gh-113280(24): Fix a leak of open socket in rare cases when error
     occurred in *note ssl.SSLSocket: cbf. creation.

   - gh-77749(25): *note email.policy.EmailPolicy.fold(): 1c1a. now
     always encodes non-ASCII characters in headers if *note utf8: 222.
     is false.

   - gh-83383(26): Synchronization of the *note dbm.dumb: 35. 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(): 756. for filtering database objects
     to dump.  Patch by Mariusz Felisiak.

   - gh-112451(28): Prohibit subclassing pure-Python *note
     datetime.timezone: 147f.  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(): 3f2.

   - gh-109653(30): Reduce the import time of *note threading: f6.
     module by ~50%.  Patch by Daniel Hollas.

   - gh-114492(31): Make the result of *note termios.tcgetattr(): 1c1b.
     reproducible on Alpine Linux.  Previously it could leave a random
     garbage in some fields.

   - gh-114315(32): Make *note threading.Lock: 1a30. a real class, not a
     factory function.  Add ‘__new__’ to ‘_thread.lock’ type.

   - gh-100414(33): Add *note dbm.sqlite3: 38. as a backend to *note
     dbm: 34, 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: 543. 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(): 1102. and just return ‘None’ on Linux.

   - gh-114321(39): Expose more platform specific constants in the *note
     fcntl: 5c. module on Linux, macOS, FreeBSD and NetBSD.

   - gh-114328(40): The *note tty.setcbreak(): 1c1c. and new *note
     tty.cfmakecbreak(): 1c1d. 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: 32. now has the first argument named ‘self’, rather
     than ‘obj’.

   - gh-104522(45): *note OSError: 543. 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: 7a5. as patterns in
     *note pathlib.Path.glob(): 73f. and *note rglob(): 740.

   - gh-112202(51): Ensure that a *note asyncio.Condition.notify():
     1c1e. call does not get lost if the awakened ‘Task’ is
     simultaneously cancelled or encounters any other error.

   - gh-113951(52): Fix the behavior of ‘tag_unbind()’ methods of
     ‘tkinter.Text’ and ‘tkinter.Canvas’ classes with three arguments.
     Previously, ‘widget.tag_unbind(tag, sequence, funcid)’ destroyed
     the current binding for 'sequence', leaving 'sequence' unbound, and
     deleted the 'funcid' command.  Now it removes only 'funcid' from
     the binding for 'sequence', keeping other commands, and deletes the
     'funcid' command.  It leaves 'sequence' unbound only if 'funcid'
     was the last bound command.

   - gh-97959(53): Fix rendering class methods, bound methods, method
     and function aliases in *note pydoc: bd.  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:
     1a5c. constructor.  *note ValueError: 15a. is now raised if the
     same character is used in different roles.

   - gh-113732(55): Fix support of *note QUOTE_NOTNULL: 89b. and *note
     QUOTE_STRINGS: 89c. in *note csv.reader(): 89d.

   - gh-113225(56): Speed up *note pathlib.Path.walk(): 8bd. by using
     *note os.DirEntry.path: 1c1f. 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(): 1883,
     *note datetime.date.replace(): 1c20. and *note
     datetime.time.replace(): 1c21.

   - 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: f9. 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: 106.  Instead of
     checking if a directory exists and creating it, directly call *note
     os.makedirs(): 24b. with the kwarg ‘exist_ok=True’.

   - gh-75705(68): Set unixfrom envelope in *note mailbox.mbox: 1c22.
     and *note mailbox.MMDF: 1c23.

   - gh-106233(69): Fix stacklevel in ‘InvalidTZPathWarning’ during
     *note zoneinfo: 13d. module import.

   - gh-105102(70): Allow *note ctypes.Union: 484. to be nested in *note
     ctypes.Structure: 483. 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: 174d. termination with *note
     shutdown(): 74a.

   - gh-101599(73): Changed argparse flag options formatting to remove
     redundancy.

   - gh-85984(74): Add POSIX pseudo-terminal functions *note
     os.posix_openpt(): 1c24, *note os.grantpt(): 1c25, *note
     os.unlockpt(): 1c26, and *note os.ptsname(): 1c27.

   - gh-102512(75): When *note os.fork(): 6c3. 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(): 2e5, which identifies
     reserved pathnames such as "NUL", "AUX" and "CON". This function is
     only available on Windows.

     Deprecate ‘pathlib.PurePath.is_reserved()’.

   - bpo-38364(77): The ‘inspect’ functions ‘isgeneratorfunction’,
     ‘iscoroutinefunction’, ‘isasyncgenfunction’ now support
     ‘functools.partialmethod’ wrapped functions the same way they
     support ‘functools.partial’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115392

   (2) https://github.com/python/cpython/issues/114563

   (3) https://github.com/python/cpython/issues/102840

   (4) https://github.com/python/cpython/issues/115165

   (5) https://github.com/python/cpython/issues/112903

   (6) https://github.com/python/cpython/issues/115133

   (7) https://github.com/python/cpython/issues/115059

   (8) https://github.com/python/cpython/issues/79382

   (9) https://github.com/python/cpython/issues/67837

   (10) https://github.com/python/cpython/issues/115060

   (11) https://github.com/python/cpython/issues/97928

   (12) https://github.com/python/cpython/issues/114628

   (13) https://github.com/python/cpython/issues/85984

   (14) https://github.com/python/cpython/issues/114965

   (15) https://github.com/python/cpython/issues/114959

   (16) https://github.com/python/cpython/issues/114894

   (17) https://github.com/python/cpython/issues/114071

   (18) https://github.com/python/cpython/issues/109475

   (19) https://github.com/python/cpython/issues/49766

   (20) https://github.com/python/cpython/issues/110190

   (21) https://github.com/python/cpython/issues/114678

   (22) https://github.com/python/cpython/issues/70303

   (23) https://github.com/python/cpython/issues/109653

   (24) https://github.com/python/cpython/issues/113280

   (25) https://github.com/python/cpython/issues/77749

   (26) https://github.com/python/cpython/issues/83383

   (27) https://github.com/python/cpython/issues/91602

   (28) https://github.com/python/cpython/issues/112451

   (29) https://github.com/python/cpython/issues/69893

   (30) https://github.com/python/cpython/issues/109653

   (31) https://github.com/python/cpython/issues/114492

   (32) https://github.com/python/cpython/issues/114315

   (33) https://github.com/python/cpython/issues/100414

   (34) https://github.com/python/cpython/issues/113267

   (35) https://github.com/python/cpython/issues/106584

   (36) https://github.com/python/cpython/issues/75128

   (37) https://github.com/python/cpython/issues/114423

   (38) https://github.com/python/cpython/issues/114257

   (39) https://github.com/python/cpython/issues/114321

   (40) https://github.com/python/cpython/issues/114328

   (41) https://github.com/python/cpython/issues/114281

   (42) https://github.com/python/typeshed

   (43) https://github.com/python/cpython/issues/101438

   (44) https://github.com/python/cpython/issues/114198

   (45) https://github.com/python/cpython/issues/104522

   (46) https://github.com/python/cpython/issues/114149

   (47) https://github.com/python/cpython/issues/83648

   (48) https://github.com/python/cpython/issues/114087

   (49) https://github.com/python/cpython/issues/109534

   (50) https://github.com/python/cpython/issues/79634

   (51) https://github.com/python/cpython/issues/112202

   (52) https://github.com/python/cpython/issues/113951

   (53) https://github.com/python/cpython/issues/97959

   (54) https://github.com/python/cpython/issues/113796

   (55) https://github.com/python/cpython/issues/113732

   (56) https://github.com/python/cpython/issues/113225

   (57) https://github.com/python/cpython/issues/89039

   (58) https://github.com/python/cpython/issues/112919

   (59) https://github.com/python/cpython/issues/59013

   (60) https://github.com/python/cpython/issues/112343

   (61) https://github.com/python/cpython/issues/112240

   (62) https://github.com/python/cpython/issues/111741

   (63) https://github.com/python/cpython/issues/43457

   (64) https://github.com/python/cpython/issues/82626

   (65) https://github.com/python/cpython/issues/111051

   (66) https://github.com/python/cpython/issues/110345

   (67) https://github.com/python/cpython/issues/38807

   (68) https://github.com/python/cpython/issues/75705

   (69) https://github.com/python/cpython/issues/106233

   (70) https://github.com/python/cpython/issues/105102

   (71) https://github.com/python/cpython/issues/104282

   (72) https://github.com/python/cpython/issues/96471

   (73) https://github.com/python/cpython/issues/101599

   (74) https://github.com/python/cpython/issues/85984

   (75) https://github.com/python/cpython/issues/102512

   (76) https://github.com/python/cpython/issues/88569

   (77) https://bugs.python.org/issue?@action=redirect&bpo=38364


File: python.info,  Node: ドキュメント<18>,  Next: テスト<21>,  Prev: ライブラリ<66>,  Up: Python 3 13 0 alpha 4

1.26.22.4 ドキュメント
......................

   - gh-115233(1): Fix an example for *note LoggerAdapter: 16af. in the
     Logging Cookbook.

   - gh-114123(2): Move the *note csv: 2c. 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: テスト<21>,  Next: ビルド<20>,  Prev: ドキュメント<18>,  Up: Python 3 13 0 alpha 4

1.26.22.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: ビルド<20>,  Next: Windows<18>,  Prev: テスト<21>,  Up: Python 3 13 0 alpha 4

1.26.22.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: 69. module.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115167

   (2) https://github.com/python/cpython/issues/113632

   (3) https://github.com/python/cpython/issues/114099

   (4) https://github.com/python/cpython/issues/114875


File: python.info,  Node: Windows<18>,  Next: macOS<12>,  Prev: ビルド<20>,  Up: Python 3 13 0 alpha 4

1.26.22.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<12>,  Next: IDLE<11>,  Prev: Windows<18>,  Up: Python 3 13 0 alpha 4

1.26.22.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(): 1c2d.

   - 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<15>,  Prev: macOS<12>,  Up: Python 3 13 0 alpha 4

1.26.22.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<15>,  Next: C API<21>,  Prev: IDLE<11>,  Up: Python 3 13 0 alpha 4

1.26.22.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: 1c30. 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<21>,  Prev: Tools/Demos<15>,  Up: Python 3 13 0 alpha 4

1.26.22.11 C API
................

   - gh-111140(1): Adds *note PyLong_AsNativeBytes(): 802, *note
     PyLong_FromNativeBytes(): 803. and *note
     PyLong_FromUnsignedNativeBytes(): 804. functions.

   - gh-114685(2): *note PyBuffer_FillInfo(): b47. now raises a *note
     SystemError: 3f1. if called with *note PyBUF_READ: 1c32. or *note
     PyBUF_WRITE: 1c33. as flags.  These flags should only be used with
     the ‘PyMemoryView_*’ C API.

   - gh-114685(3): *note PyObject_GetBuffer(): 832. now raises a *note
     SystemError: 3f1. if called with *note PyBUF_READ: 1c32. or *note
     PyBUF_WRITE: 1c33. 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(): 7fa, which is similar
     to *note PyList_GetItem(): 7fb. but returns a *note strong
     reference: 7e0. instead of a *note borrowed reference: 60a.

   - gh-110850(6): Add PyTime C API:

        * *note PyTime_t: 7d2. type.

        * *note PyTime_MIN: 7d3. and *note PyTime_MAX: 7d4. constants.

        * *note PyTime_AsSecondsDouble(): 7d5, *note PyTime_Monotonic():
          7d6, *note PyTime_PerfCounter(): 7d8, and *note PyTime_Time():
          7da. functions.

     Patch by Victor Stinner.

   - gh-112066(7): Add *note PyDict_SetDefaultRef(): 7e1.: insert a key
     and value into a dictionary if the key is not already present.
     This is similar to *note dict.setdefault(): 1430, but returns an
     integer value indicating if the key was already present.  It is
     also similar to *note PyDict_SetDefault(): 7e2, 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.26.23 Python 3.13.0 alpha 3
-----------------------------

'Release date: 2024-01-17'

* Menu:

* セキュリティ: セキュリティ<19>.
* Core and Builtins: Core and Builtins<64>.
* ライブラリ: ライブラリ<67>.
* ドキュメント: ドキュメント<19>.
* テスト: テスト<22>.
* ビルド: ビルド<21>.
* Windows: Windows<19>.
* macOS: macOS<13>.
* IDLE: IDLE<12>.
* C API: C API<22>.


File: python.info,  Node: セキュリティ<19>,  Next: Core and Builtins<64>,  Up: Python 3 13 0 alpha 3

1.26.23.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<64>,  Next: ライブラリ<67>,  Prev: セキュリティ<19>,  Up: Python 3 13 0 alpha 3

1.26.23.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: 44a. 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(): 1d4.  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(): 12bc. and
     *note max(): 12bd.

   - gh-112943(25): Correctly compute end column offsets for multiline
     tokens in the *note tokenize: 104. module.  Patch by Pablo Galindo

   - gh-112125(26): Fix ‘None.__ne__(None)’ returning ‘NotImplemented’
     instead of ‘False’.

   - gh-74616(27): *note input(): 1692. 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(): 1c37. and *note binascii.crc32():
     1c38. could produce incorrect results on multi-gigabyte inputs.
     Including when using *note zipfile: 13a. 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(): 11d1. and *note
     getgeneratorstate(): 15f1. 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(): 1c39./*note
     PyComplex_ImagAsDouble(): 1c3a. now tries to convert an object to a
     *note complex: 330. 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(): 760.

   ---------- 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: ライブラリ<67>,  Next: ドキュメント<19>,  Prev: Core and Builtins<64>,  Up: Python 3 13 0 alpha 3

1.26.23.3 ライブラリ
....................

   - gh-114077(1): Fix possible *note OverflowError: c5b. in *note
     socket.socket.sendfile(): 1211. 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: 1ce. 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(): 756. 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: 54e. 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: f9. method ‘winfo_pathname()’ on
     64-bit Windows.

   - gh-113868(7): Added *note mmap.MAP_NORESERVE: 1c3c, *note
     mmap.MAP_NOEXTEND: 1c3d, *note mmap.MAP_HASSEMAPHORE: 1c3e, *note
     mmap.MAP_NOCACHE: 1c3f, *note mmap.MAP_JIT: 1c40, *note
     mmap.MAP_RESILIENT_CODESIGN: 1c41, *note mmap.MAP_RESILIENT_MEDIA:
     1c42, *note mmap.MAP_32BIT: 1c43, *note
     mmap.MAP_TRANSLATED_ALLOW_EXECUTE: 1c44, *note mmap.MAP_UNIX03:
     1c45. and *note mmap.MAP_TPRO: 1c46.  All of them are ‘mmap(2)’
     flags on macOS.

   - gh-113848(8): *note asyncio.TaskGroup(): 6dd. and *note
     asyncio.timeout(): 9fa. context managers now handle *note
     CancelledError: 6e0. 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: c12. in the context of the
     exception that was raised during exiting an expired *note
     asyncio.timeout(): 9fa. 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(): 1c47. now re-raises
     the same ‘CancelledError’ instance that may have caused it to be
     interrupted.  Fixed race condition in *note
     asyncio.Semaphore.acquire(): 1c48. when interrupted with a
     ‘CancelledError’.

   - gh-113791(14): Add ‘CLOCK_MONOTONIC_RAW_APPROX’ and
     ‘CLOCK_UPTIME_RAW_APPROX’ to *note time: f7. on macOS. These are
     clocks available on macOS 10.12 or later.

   - gh-112932(15): Restore the ability for *note zipfile: 13a. 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: 8bb. and not its private base class
     ‘PurePathBase’.

   - gh-113594(17): Fix *note UnicodeEncodeError: a6c. in *note email:
     3e. 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: 90. 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(): d1f.

   - gh-89850(22): Add default implementations of *note
     pickle.Pickler.persistent_id(): 1b47. and *note
     pickle.Unpickler.persistent_load(): 1b4e. methods in the C
     implementation.  Calling ‘super().persistent_id()’ and
     ‘super().persistent_load()’ in subclasses of the C implementation
     of *note pickle.Pickler: de6. and *note pickle.Unpickler: 1999.
     classes no longer causes infinite recursion.

   - gh-113569(23): Indicate if there were no actual calls in unittest
     *note assert_has_calls(): 1c49. failure.

   - gh-101225(24): Increase the backlog for *note
     multiprocessing.connection.Listener: 1c4a. 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: 14a1.
     to them.

   - gh-113568(25): Raise audit events from *note pathlib.Path: 4f5. 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: 110. when CPython
     is built without docstrings.

   - gh-113320(31): Fix regression in Python 3.12 where *note Protocol:
     772. classes that were not marked as *note runtime-checkable: 867.
     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: fbe. into *note RuntimeError: 317.
     instead of hanging or other misbehavior.  Patch contributed by
     Jamie Phan.

   - gh-113225(38): Speed up *note pathlib.Path.glob(): 73f. by using
     *note os.DirEntry.path: 1c1f. 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: df. module can now use the
     *note os.posix_spawn(): 736. 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(): 733. and a file
     descriptor in *note os.chmod(): 732. on Windows.

   - gh-113188(43): Fix *note shutil.copymode(): 1c4b. and *note
     shutil.copystat(): 14ef. 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(): 736. 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(): 731. and the
     'follow_symlinks' argument in *note os.chmod(): 732. on Windows.
     Note that the default value of 'follow_symlinks' in ‘os.lchmod()’
     is ‘False’ on Windows.

   - gh-112559(49): *note signal.signal(): 14f5. and *note
     signal.getsignal(): 1c4c. no longer call ‘repr’ on callable
     handlers.  *note asyncio.run(): 314. and *note
     asyncio.Runner.run(): 1b81. no longer call ‘repr’ on the task
     results.  Patch by Yilei Yang.

   - gh-112962(50): *note dis: 3b. module functions add cache
     information to the *note Instruction: 49b. 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:
     e5. 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: ea.
     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(): 15ef. cleanup on Windows.

   - gh-94692(59): *note shutil.rmtree(): 33d. 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(): 1c4d.  Patch
     by Barney Gale.

   - gh-74690(62): Speedup *note issubclass(): 2fc. checks against
     simple *note runtime-checkable protocols: 867. by around 6%.  Patch
     by Alex Waygood.

   - gh-74690(63): Speedup *note isinstance(): 2fb. checks by roughly
     20% for *note runtime-checkable protocols: 867. that only have one
     callable member.  Speedup *note issubclass(): 2fc. checks for these
     protocols by roughly 10%.  Patch by Alex Waygood.

   - gh-112645(64): Remove deprecation error on passing ‘onerror’ to
     *note shutil.rmtree(): 33d.

   - gh-112640(65): Add ‘kwdefaults’ parameter to *note
     types.FunctionType: c5d. to set default keyword argument values.

   - gh-112622(66): Ensure ‘name’ parameter is passed to event loop in
     *note asyncio.create_task(): 469.

   - gh-112618(67): Fix a caching bug relating to *note
     typing.Annotated: d0d.  ‘Annotated[str, True]’ is no longer
     identical to ‘Annotated[str, 1]’.

   - gh-112334(68): Fixed a performance regression in 3.12's *note
     subprocess: df. 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: 6c5. 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(): df7.
     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: 6e3. when
     executing the *note zipfile: 13a. module.

   - gh-112516(72): Update the bundled copy of pip to version 23.3.1.

   - gh-112510(73): Add *note readline.backend: 1c4e. 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: 29b.  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: d8. module.

   - gh-112414(78): Fix regression in Python 3.12 where calling *note
     repr(): 462. on a module that had been imported using a custom
     *note loader: 1c4f. could fail with *note AttributeError: 1b4.
     Patch by Alex Waygood.

   - gh-112358(79): Revert change to *note struct.Struct: 307.
     initialization that broke some cases of subclassing.

   - gh-112405(80): Optimize *note pathlib.PurePath.relative_to(): 57c.
     Patch by Alex Waygood.

   - gh-94722(81): Fix bug where comparison between instances of *note
     DocTest: 1c50. 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(): 2fc. against a *note typing.Protocol: 772. that has
     non-method members.  Patch by Randolf Scholz.

   - gh-112137(84): Change *note dis: 3b. output to display no-lineno as
     "-" instead of "None".

   - gh-112332(85): Deprecate the ‘exc_type’ field of *note
     traceback.TracebackException: 76a.  Add ‘exc_type_str’ to replace
     it.

   - gh-81620(86): Add extra tests for *note random.binomialvariate():
     8c5.

   - gh-112292(87): Fix a crash in *note readline: c2. 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: 3b. 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: bd. to
     render more readable signatures that have new lines between
     parameters.

   - gh-112105(91): Make *note readline.set_completer_delims(): 1c51.
     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: 2f0. class,
     ensure *note __set_name__(): 1010. 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(): 766.

   - 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: f9. 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: 1ce.

   - gh-111049(101): Fix crash during garbage collection of the *note
     io.BytesIO: 1258. 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(): 6fe. and *note
     email.utils.parseaddr(): 6ff. 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(): 1c52. now cleans docstrings
     with *note inspect.cleandoc(): 1c53. before writing them.  Patch by
     Filip Łapkiewicz.

   - gh-82300(106): Add ‘track’ parameter to *note
     multiprocessing.shared_memory.SharedMemory: 1c00. 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: 8bb. that omits certain magic
     methods.  It may be made public (along with ‘_PathBase’) in future.

   - gh-109858(108): Protect *note zipfile: 13a. 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: bf2.

   - 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(): 743. and *note group(): 744, defaulting
     to ‘True’.

   - gh-102130(112): Support tab completion in *note cmd: 1a. for
     ‘editline’.

   - gh-99437(113): *note runpy.run_path(): 6b4. 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(): 69b, 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: 1c54. 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:
     15ef. 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(): 84e. now raises *note
     OSError: 543. for all failures rather than *note ImportError: 1c8.
     on systems lacking the *note pwd: ba. module or *note KeyError:
     7e5. if the password database is empty.

   - bpo-34321(122): *note mmap.mmap: 247. 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(): 33d. function now
     ignores errors when calling *note os.close(): f35. when
     'ignore_errors' is ‘True’, and ‘os.close()’ no longer retried after
     error.

   - bpo-35928(124): *note io.TextIOWrapper: ba0. now correctly handles
     the decoding buffer after ‘read()’ and ‘write()’.

   - bpo-26791(125): *note shutil.move(): e24. 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: de6.
     and *note pickle.Unpickler: 1999. 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(): 1861. and *note
     warnings.simplefilter(): ab3. now raise appropriate exceptions
     instead of ‘AssertionError’.  Patch contributed by Rémi Lapeyre.

   - bpo-37260(130): Fixed a race condition in *note shutil.rmtree():
     33d. 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: 6bf. environment
     variable to set the location of a ‘.python_history’ file.

   - bpo-21360(134): *note mailbox.Maildir: 851. now ignores files with
     a leading dot.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114077

   (2) https://github.com/python/cpython/issues/111803

   (3) https://github.com/python/cpython/issues/114014

   (4) https://github.com/python/cpython/issues/108364

   (5) https://github.com/python/cpython/issues/113971

   (6) https://github.com/python/cpython/issues/113877

   (7) https://github.com/python/cpython/issues/113868

   (8) https://github.com/python/cpython/issues/113848

   (9) https://github.com/python/cpython/issues/113661

   (10) https://github.com/python/cpython/issues/96037

   (11) https://github.com/python/cpython/issues/113781

   (12) https://github.com/python/cpython/issues/113238

   (13) https://github.com/python/cpython/issues/111693

   (14) https://github.com/python/cpython/issues/113791

   (15) https://github.com/python/cpython/issues/112932

   (16) https://github.com/python/cpython/issues/113568

   (17) https://github.com/python/cpython/issues/113594

   (18) https://github.com/python/cpython/issues/113538

   (19) https://github.com/python/cpython/issues/113626

   (20) https://github.com/python/cpython/issues/85567

   (21) https://github.com/python/cpython/issues/113537

   (22) https://github.com/python/cpython/issues/89850

   (23) https://github.com/python/cpython/issues/113569

   (24) https://github.com/python/cpython/issues/101225

   (25) https://github.com/python/cpython/issues/113568

   (26) https://github.com/python/cpython/issues/113543

   (27) https://github.com/python/cpython/issues/113028

   (28) https://github.com/python/cpython/issues/113421

   (29) https://github.com/python/cpython/issues/111784

   (30) https://github.com/python/cpython/issues/113407

   (31) https://github.com/python/cpython/issues/113320

   (32) https://github.com/python/cpython/issues/53502

   (33) https://github.com/python/cpython/issues/113358

   (34) https://github.com/python/cpython/issues/113214

   (35) https://github.com/python/cpython/issues/113246

   (36) https://github.com/python/cpython/issues/87264

   (37) https://github.com/python/cpython/issues/112182

   (38) https://github.com/python/cpython/issues/113225

   (39) https://github.com/python/cpython/issues/113149

   (40) https://github.com/python/cpython/issues/113117

   (41) https://github.com/python/cpython/issues/113199

   (42) https://github.com/python/cpython/issues/113191

   (43) https://github.com/python/cpython/issues/113188

   (44) https://github.com/python/cpython/issues/113119

   (45) https://github.com/python/cpython/issues/113202

   (46) https://github.com/python/cpython/issues/61648

   (47) https://github.com/python/cpython/issues/113175

   (48) https://github.com/python/cpython/issues/59616

   (49) https://github.com/python/cpython/issues/112559

   (50) https://github.com/python/cpython/issues/112962

   (51) https://github.com/python/cpython/issues/112989

   (52) https://github.com/python/cpython/issues/112970

   (53) https://github.com/python/cpython/issues/110190

   (54) https://github.com/python/cpython/issues/112540

   (55) https://github.com/python/cpython/issues/87286

   (56) https://github.com/python/cpython/issues/112800

   (57) https://github.com/python/cpython/issues/51944

   (58) https://github.com/python/cpython/issues/79325

   (59) https://github.com/python/cpython/issues/94692

   (60) https://github.com/python/cpython/issues/112736

   (61) https://github.com/python/cpython/issues/112727

   (62) https://github.com/python/cpython/issues/74690

   (63) https://github.com/python/cpython/issues/74690

   (64) https://github.com/python/cpython/issues/112645

   (65) https://github.com/python/cpython/issues/112640

   (66) https://github.com/python/cpython/issues/112622

   (67) https://github.com/python/cpython/issues/112618

   (68) https://github.com/python/cpython/issues/112334

   (69) https://github.com/python/cpython/issues/110190

   (70) https://github.com/python/cpython/issues/81194

   (71) https://github.com/python/cpython/issues/112578

   (72) https://github.com/python/cpython/issues/112516

   (73) https://github.com/python/cpython/issues/112510

   (74) https://github.com/python/cpython/issues/112328

   (75) https://github.com/python/cpython/issues/112509

   (76) https://github.com/python/cpython/issues/101336

   (77) https://github.com/python/cpython/issues/63284

   (78) https://github.com/python/cpython/issues/112414

   (79) https://github.com/python/cpython/issues/112358

   (80) https://github.com/python/cpython/issues/112405

   (81) https://github.com/python/cpython/issues/94722

   (82) https://github.com/python/cpython/issues/112361

   (83) https://github.com/python/cpython/issues/112345

   (84) https://github.com/python/cpython/issues/112137

   (85) https://github.com/python/cpython/issues/112332

   (86) https://github.com/python/cpython/issues/81620

   (87) https://github.com/python/cpython/issues/112292

   (88) https://github.com/python/cpython/issues/77621

   (89) https://github.com/python/cpython/issues/112137

   (90) https://github.com/python/cpython/issues/112139

   (91) https://github.com/python/cpython/issues/112105

   (92) https://github.com/python/cpython/issues/106922

   (93) https://github.com/python/cpython/issues/111874

   (94) https://github.com/python/cpython/issues/68166

   (95) https://github.com/python/cpython/issues/110275

   (96) https://github.com/python/cpython/issues/99367

   (97) https://github.com/python/cpython/issues/111615

   (98) https://github.com/python/cpython/issues/93162

   (99) https://github.com/python/cpython/issues/75666

   (100) https://github.com/python/cpython/issues/67790

   (101) https://github.com/python/cpython/issues/111049

   (102) https://github.com/python/cpython/issues/102980

   (103) https://github.com/python/cpython/issues/102988

   (104) https://www.cve.org/CVERecord?id=CVE-2023-27043

   (105) https://github.com/python/cpython/issues/52161

   (106) https://github.com/python/cpython/issues/82300

   (107) https://github.com/python/cpython/issues/110109

   (108) https://github.com/python/cpython/issues/109858

   (109) https://github.com/python/cpython/issues/109786

   (110) https://github.com/python/cpython/issues/91539

   (111) https://github.com/python/cpython/issues/103363

   (112) https://github.com/python/cpython/issues/102130

   (113) https://github.com/python/cpython/issues/99437

   (114) https://github.com/python/cpython/issues/104003

   (115) https://peps.python.org/pep-0702/

   (116) https://github.com/python/cpython/issues/103708

   (117) https://github.com/python/cpython/issues/66515

   (118) https://github.com/python/cpython/issues/83162

   (119) https://github.com/python/cpython/issues/91133

   (120) https://bugs.python.org/issue?@action=redirect&bpo=43153

   (121) https://bugs.python.org/issue?@action=redirect&bpo=32731

   (122) https://bugs.python.org/issue?@action=redirect&bpo=34321

   (123) https://bugs.python.org/issue?@action=redirect&bpo=35332

   (124) https://bugs.python.org/issue?@action=redirect&bpo=35928

   (125) https://bugs.python.org/issue?@action=redirect&bpo=26791

   (126) https://bugs.python.org/issue?@action=redirect&bpo=41422

   (127) https://bugs.python.org/issue?@action=redirect&bpo=19821

   (128) https://bugs.python.org/issue?@action=redirect&bpo=40262

   (129) https://bugs.python.org/issue?@action=redirect&bpo=39912

   (130) https://bugs.python.org/issue?@action=redirect&bpo=37260

   (131) https://bugs.python.org/issue?@action=redirect&bpo=36959

   (132) https://bugs.python.org/issue?@action=redirect&bpo=18060

   (133) https://bugs.python.org/issue?@action=redirect&bpo=29779

   (134) https://bugs.python.org/issue?@action=redirect&bpo=21360


File: python.info,  Node: ドキュメント<19>,  Next: テスト<22>,  Prev: ライブラリ<67>,  Up: Python 3 13 0 alpha 3

1.26.23.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: テスト<22>,  Next: ビルド<21>,  Prev: ドキュメント<19>,  Up: Python 3 13 0 alpha 3

1.26.23.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(): 739. 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: 8c8.

   - gh-112769(7): The tests now correctly compare zlib version when
     *note zlib.ZLIB_RUNTIME_VERSION: 152c. 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: df. 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: ビルド<21>,  Next: Windows<19>,  Prev: テスト<22>,  Up: Python 3 13 0 alpha 3

1.26.23.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(): 1b90, *note os.makedev(): 1b92,
     and *note os.minor(): 1b91. functions are now available on HP-UX
     v3.

   - bpo-36351(8): Do not set ipv6type when cross-compiling.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114013

   (2) https://github.com/python/cpython/issues/113258

   (3) https://github.com/python/cpython/issues/112305

   (4) https://github.com/python/cpython/issues/112536

   (5) https://github.com/python/cpython/issues/112867

   (6) https://github.com/python/cpython/issues/103065

   (7) https://bugs.python.org/issue?@action=redirect&bpo=11102

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36351


File: python.info,  Node: Windows<19>,  Next: macOS<13>,  Prev: ビルド<21>,  Up: Python 3 13 0 alpha 3

1.26.23.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(): 4fc. 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 ‘sys._enablelegacywindowsfsencoding()’.  Use
     *note PYTHONLEGACYWINDOWSFSENCODING: 15e. 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: 247. 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<13>,  Next: IDLE<12>,  Prev: Windows<19>,  Up: Python 3 13 0 alpha 3

1.26.23.8 macOS
...............

   - gh-113666(1): Add the following constants to module *note stat:
     d9.: ‘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(): 1156. 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: 37. 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<22>,  Prev: macOS<13>,  Up: Python 3 13 0 alpha 3

1.26.23.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<22>,  Prev: IDLE<12>,  Up: Python 3 13 0 alpha 3

1.26.23.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(): 3b9.-like
     functions.

   - gh-111545(3): Add *note Py_HashPointer(): 63f. function to hash a
     pointer.  Patch by Victor Stinner.

   - gh-65210(4): Change the declaration of the 'keywords' parameter of
     *note PyArg_ParseTupleAndKeywords(): 81e. and *note
     PyArg_VaParseTupleAndKeywords(): 81f. 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.26.24 Python 3.13.0 alpha 2
-----------------------------

'Release date: 2023-11-22'

* Menu:

* Core and Builtins: Core and Builtins<65>.
* ライブラリ: ライブラリ<68>.
* テスト: テスト<23>.
* ビルド: ビルド<22>.
* Windows: Windows<20>.
* macOS: macOS<14>.
* IDLE: IDLE<13>.
* Tools/Demos: Tools/Demos<16>.
* C API: C API<23>.


File: python.info,  Node: Core and Builtins<65>,  Next: ライブラリ<68>,  Up: Python 3 13 0 alpha 2

1.26.24.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__: 1ca. 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(): 78a. 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(): 1c5e,
     *note BaseExceptionGroup.subgroup(): 1c5f, and *note
     BaseExceptionGroup.split(): 1b18. 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: 7b9. 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: 189. 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: 451.
     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: 6bc.  It determines whether or not frozen
     modules are ignored by the import machinery, equivalent of the
     *note -X frozen_modules: 183. command-line option.

   - gh-111354(28): Remove ‘oparg’ from *note YIELD_VALUE: 7b9.  Change
     ‘oparg’ of *note RESUME: 7ba. 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: 6bb. declaration in
     an *note except: 44e. block is rejected when the global is used in
     the *note else: 328. 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: 191d. exceptions using the *note traceback: 107.
     module.  Patch by Pablo Galindo

   - gh-109894(35): Fixed crash due to improperly initialized static
     *note MemoryError: 191d. 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: 3e3. 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: 6a0. descriptors
     (introduced in bpo-19072(44)).  This can no longer be used to wrap
     other descriptors such as *note property: 6c1.  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: ライブラリ<68>,  Next: テスト<23>,  Prev: Core and Builtins<65>,  Up: Python 3 13 0 alpha 2

1.26.24.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: d4.
     module when present in C at build time for use with *note
     socket.getnameinfo(): 1c61.

   - gh-109538(3): Issue warning message instead of having *note
     RuntimeError: 317. be displayed when event loop has already been
     closed at ‘StreamWriter.__del__()’.

   - gh-111942(4): Fix crashes in *note io.TextIOWrapper.reconfigure():
     f0a. when pass invalid arguments, e.g.  non-string encoding.

   - gh-111460(5): *note curses: 2e.: restore wide character support
     (including *note curses.unget_wch(): 1454. and *note get_wch():
     1453.) on macOS, which was unavailable due to a regression in
     Python 3.12.

   - gh-103791(6): *note contextlib.suppress: 12d7. now supports
     suppressing exceptions raised as part of a *note
     BaseExceptionGroup: 76d, in addition to the recent support for
     *note ExceptionGroup: 6de.

   - gh-111835(7): The *note mmap.mmap: 247. class now has an *note
     seekable(): 723. method that can be used when a seekable file-like
     object is required.  The *note seek(): 724. 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(): 4ee. and *note os.unsetenv(): 4ef.
     on Windows.

   - gh-111768(10): *note wsgiref.util.is_hop_by_hop(): 1c62. is now
     exposed correctly in ‘__all__’.

   - gh-80731(11): Avoid executing the default function in *note
     cmd.Cmd: 1a98. in an except block

   - gh-111541(12): Fix *note doctest: 3d. for *note SyntaxError: 189.
     not-builtin subclasses.

   - gh-111719(13): Add extra argument validation for ‘alias’ command in
     *note pdb: aa.

   - gh-111482(14): *note time: f7.: Make *note time.clock_gettime():
     151e. and *note time.clock_gettime_ns(): ead. 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(): ee1. 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: f9. widgets.

   - gh-111246(17): *note asyncio.loop.create_unix_server(): 6d6. will
     now automatically remove the Unix socket when the server is closed.

   - gh-111356(18): Added *note io.text_encoding(): 1c63, *note
     io.DEFAULT_BUFFER_SIZE: 1c64, and *note
     io.IncrementalNewlineDecoder: 1968. 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(): 57c.
     and *note is_relative_to(): 57d.

   - gh-111342(21): Fixed typo in *note math.sumprod(): 8ad.

   - gh-68166(22): Remove mention of not supported "vsapi" element type
     in *note tkinter.ttk.Style.element_create(): 766.  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(): c2a, which allows to format
     *note ExceptionGroup: 6de. instances.

   - gh-79033(24): Another attempt at fixing *note
     asyncio.Server.wait_closed(): 1c65.  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: f7. 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: c9. not checking for errors when
     initializing.

   - gh-111230(30): Fix *note ssl: d8. not checking for errors when
     initializing.

   - gh-111174(31): Fix crash in *note io.BytesIO.getbuffer(): 15b0.
     called repeatedly for empty BytesIO.

   - gh-111187(32): Postpone removal version for
     locale.getdefaultlocale() to Python 3.15.

   - gh-111159(33): Fix *note doctest: 3d. output comparison for
     exceptions with notes.

   - gh-110910(34): Fix invalid state handling in *note
     asyncio.TaskGroup: 6dd. and *note asyncio.Timeout: 1c66.  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(): 11f9.  Patch by Junya Okabe.

   - gh-84583(38): Make *note pdb: aa. enter post-mortem mode even for
     *note SyntaxError: 189.

   - gh-80675(39): Set ‘f_trace_lines = True’ on all frames upon *note
     pdb.set_trace(): 501.

   - 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: 315.
     loop_factory kwarg in *note unittest.IsolatedAsyncioTestCase: 34a.

   - gh-110392(42): Fix *note tty.setraw(): 1c67. and *note
     tty.setcbreak(): 1c1c.: previously they returned partially modified
     list of the original tty attributes.  *note tty.cfmakeraw(): 1c68.
     and *note tty.cfmakecbreak(): 1c1d. 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: 66. functions and methods that consider plural forms
     even if the translation was not found.

   - gh-110395(45): Ensure that *note select.kqueue(): 275. 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:
     715. property, which returns the IPv4-mapped IPv6 address.

   - gh-85098(49): Implement the CLI of the *note symtable: e1. module
     and improve the repr of *note Symbol: 518.

   - 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: aa4. for
     ‘[]’ use in typing contexts.

   - gh-72904(53): Add *note glob.translate(): 706.  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(): 1c69,
     *note mailbox.Maildir.set_info(): 1c6a, *note
     mailbox.Maildir.get_flags(): 1c6b, *note
     mailbox.Maildir.set_flags(): 1c6c, *note
     mailbox.Maildir.add_flag(): 1c6d, *note
     mailbox.Maildir.remove_flag(): 1c6e.  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(): 1ad3. to prevent ‘exit()’ and ‘quit’ from closing
     ‘sys.stdin’ and raise ‘SystemExit’.

   - gh-97928(58): Change the behavior of ‘tkinter.Text.count()’.  It
     now always returns an integer if one or less counting options are
     specified.  Previously it could return a single count as a 1-tuple,
     an integer (only if option ‘"update"’ was specified) or ‘None’ if
     no items found.  The result is now the same if ‘wantobjects’ is set
     to ‘0’.

   - gh-96954(59): Switch the storage of the unicode codepoint names to
     use a different data-structure, a directed acyclic word graph(60).
     This makes the unicodedata shared library about 440 KiB smaller.
     Contributed by Carl Friedrich Bolz-Tereick using code from the PyPy
     project.

   - gh-73561(61): Omit the interface scope from an IPv6 address when
     used as Host header by *note http.client: 72.

   - 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: テスト<23>,  Next: ビルド<22>,  Prev: ライブラリ<68>,  Up: Python 3 13 0 alpha 2

1.26.24.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: ed. 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: cf.

   ---------- 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: ビルド<22>,  Next: Windows<20>,  Prev: テスト<23>,  Up: Python 3 13 0 alpha 2

1.26.24.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: 82f.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96954

   (2) https://github.com/python/cpython/issues/112088

   (3) https://github.com/tiran/cpython_autoconf

   (4) https://github.com/python/cpython/issues/111046

   (5) https://github.com/python/cpython/issues/110828

   (6) https://github.com/python/cpython/issues/85283


File: python.info,  Node: Windows<20>,  Next: macOS<14>,  Prev: ビルド<22>,  Up: Python 3 13 0 alpha 2

1.26.24.5 Windows
.................

   - gh-111856(1): Fixes *note fstat(): 1149. on file systems that do
     not support file ID requests.  This includes FAT32 and exFAT.

   - gh-111293(2): Fix *note os.DirEntry.inode: 1c72. 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<14>,  Next: IDLE<13>,  Prev: Windows<20>,  Up: Python 3 13 0 alpha 2

1.26.24.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(): 1bd5. 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<16>,  Prev: macOS<14>,  Up: Python 3 13 0 alpha 2

1.26.24.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<16>,  Next: C API<23>,  Prev: IDLE<13>,  Up: Python 3 13 0 alpha 2

1.26.24.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<23>,  Prev: Tools/Demos<16>,  Up: Python 3 13 0 alpha 2

1.26.24.9 C API
...............

   - gh-112026(1): Add again the private ‘_PyThreadState_UncheckedGet()’
     function as an alias to the new public *note
     PyThreadState_GetUnchecked(): 63d. 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(): 63c. and *note
     PyDict_PopString(): 7e3. functions: remove a key from a dictionary
     and optionally return the removed value.  This is similar to *note
     dict.pop(): 7e4, but without the default value and not raising
     *note KeyError: 7e5. 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(): 7fc. and *note
     PyList_Clear(): 7fd. 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(): c82. function is now implemented as an opaque
     function call.  Patch by Victor Stinner.

   - gh-108082(13): Add *note PyErr_FormatUnraisable(): 7ed. 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(): 81e.

   - 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(): 80e. function to the
     limited C API. Patch by Victor Stinner.

   - gh-85283(18): Add *note PyMem_RawMalloc(): 2ca, *note
     PyMem_RawCalloc(): 82a, *note PyMem_RawRealloc(): 82b. and *note
     PyMem_RawFree(): 82c. to the limited C API. Patch by Victor
     Stinner.

   - gh-106672(19): Functions *note PyDict_GetItem(): 822, *note
     PyDict_GetItemString(): 823, *note PyMapping_HasKey(): 81a, *note
     PyMapping_HasKeyString(): 81c, *note PyObject_HasAttr(): 816, *note
     PyObject_HasAttrString(): 818, and *note PySys_GetObject(): 35e,
     which clear all errors occurred during calling the function, report
     now them using *note sys.unraisablehook(): 712.

   - gh-67565(20): Remove redundant C-contiguity check in ‘getargs.c’,
     *note binascii: 11, *note ssl: d8. 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.26.25 Python 3.13.0 alpha 1
-----------------------------

'Release date: 2023-10-13'

* Menu:

* セキュリティ: セキュリティ<20>.
* Core and Builtins: Core and Builtins<66>.
* ライブラリ: ライブラリ<69>.
* ドキュメント: ドキュメント<20>.
* テスト: テスト<24>.
* ビルド: ビルド<23>.
* Windows: Windows<21>.
* macOS: macOS<15>.
* IDLE: IDLE<14>.
* Tools/Demos: Tools/Demos<17>.
* C API: C API<24>.


File: python.info,  Node: セキュリティ<20>,  Next: Core and Builtins<66>,  Up: Python 3 13 0 alpha 1

1.26.25.1 セキュリティ
......................

   - gh-108310(1): Fixed an issue where instances of *note
     ssl.SSLSocket: cbf. 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: 53. security
     improvement change released in 3.12beta4 that unintentionally
     caused *note email.utils.getaddresses: 6fe. 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: 6b. 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: 5d2. 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<66>,  Next: ライブラリ<69>,  Prev: セキュリティ<20>,  Up: Python 3 13 0 alpha 1

1.26.25.2 Core and Builtins
...........................

   - gh-110782(1): Fix crash when *note typing.TypeVar: 29f. 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: 107. 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: 432, 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: 183. enabled.

   - gh-110514(8): Add ‘PY_THROW’ to *note sys.setprofile(): 18b6.
     events

   - gh-110489(9): Optimise *note math.ceil(): 1777. 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 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: 183. command line option to
     override return results of *note os.cpu_count(): 6e7. and *note
     os.process_cpu_count(): 6e6.  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():
     97a. 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: 1c7a.

   - 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: 59f.

   - 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: 189.

   - 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: 5a8. 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: 183. 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: afd.
     at the end of a for loop.

   - gh-108113(59): The *note compile(): 1d3. 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(): 1d4. now accepts an optional argument ‘optimize’
     which is passed on to the *note compile(): 1d3. 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: 183. 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: 188c.
     and *note METH_O: 18bf. 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(): 1c7b. and
     *note ctypes.POINTER(): 48b.

   - gh-105848(70): Modify the bytecode so that the actual callable for
     a *note CALL: af8. 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: 1ea. objects by
     *note int: 32e. 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: 1c7c, *note
     ctypes.c_wchar_p: 1c7d. and *note ctypes.c_void_p: 1c7e.

   - 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: 183.
     enabled.

   - gh-104432(82): Fix potential unaligned memory access on C APIs
     involving returned sequences of ‘char *’ pointers within the *note
     grp: 69. and *note socket: d4. 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: 37.
     Patch By Donghee Na.

   - gh-107122(92): Add ‘dbm.gnu.gdbm.clear()’ to *note dbm.gnu: 36.
     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(): 1d4.

   - gh-106917(94): Fix classmethod-style *note super(): 44a. 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: 183. 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: 1c7f. 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():
     6c6. to be a keyword.  Patch by Hugo van Kemenade.

   - gh-96844(106): Improve error message of *note list.remove(): 1c80.
     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: 1c81. node for it instead of an one-element
     ‘ast.JoinedStr’ with an empty string *note ast.Constant: 570.

   - gh-100288(109): Specialize *note LOAD_ATTR: 8f2. 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: a6a. 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(): 101b. and *note
     sys.getfilesystemencodeerrors: 10a7. 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: 1c82. is now a pseudo-op.

   - gh-105730(117): Allow any callable other than type objects as the
     condition predicate in *note BaseExceptionGroup.split(): 1b18. and
     *note BaseExceptionGroup.subgroup(): 1c5f.

   - gh-105979(118): Fix crash in ‘_imp.get_frozen_object()’ due to
     improper exception handling.

   - gh-106003(119): Add a new *note TO_BOOL: 1c83. instruction, which
     performs boolean conversions for *note POP_JUMP_IF_TRUE: 1c84,
     *note POP_JUMP_IF_FALSE: 1c85, and *note UNARY_NOT: 1c86. (which
     all expect exact *note bool: 5f6. values now).  Also, modify the
     oparg of *note COMPARE_OP: d36. to include an optional "boolean
     conversion" flag.

   - gh-98931(120): Ensure custom *note SyntaxError: 189. 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: 451. 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: 15a. if the ‘delay’
     argument to *note asyncio.sleep(): e37. is a NaN (matching *note
     time.sleep(): a91.).

   - 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: 104. 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(): 1c87. 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: 954.
     exceptions instead of *note SyntaxError: 189. 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: 104. module.  Patch
     by Pablo Galindo

   - gh-104635(142): Eliminate redundant *note STORE_FAST: 1c88.
     instructions in the compiler.  Patch by Donghee Na and Carl Meyer.

   - gh-105324(143): Fix the main function of the *note tokenize: 104.
     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: 6c1. 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: 1b4.
     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: 1df. 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: 29c. 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(): 44a. calls on types with custom
     *note tp_getattro: 1c89. 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(): 1a24.  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: 104. 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: 104. module are
     always correct.  Patch by Pablo Galindo

   - gh-104955(162): Fix signature for the new *note
     __release_buffer__(): 1c8a. slot.  Patch by Jelle Zijlstra.

   - gh-104690(163): Starting new threads and process creation through
     *note os.fork(): 6c3. 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: f6. 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: 104. 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(): 19bf.

   - gh-89091(167): Raise *note RuntimeWarning: 6e3. for unawaited async
     generator methods like *note asend(): caf, *note athrow(): 90b. and
     *note aclose(): cae.  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__(): 1b9d. or
     *note __reduce__(): d9b. to ‘None’, pickling will result in a *note
     TypeError: 29c.

   - gh-101006(170): Improve error handling when read *note marshal: 90.
     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: ライブラリ<69>,  Next: ドキュメント<20>,  Prev: Core and Builtins<66>,  Up: Python 3 13 0 alpha 1

1.26.25.3 ライブラリ
....................

   - gh-110786(1): *note sysconfig: e4.'s CLI now ignores *note
     BrokenPipeError: 1412, making it exit normally if its output is
     being piped and the pipe closes.

   - gh-103480(2): The *note sysconfig: e4. 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: 1c8c. for use with the
     *note asyncio.run(): 314. 'loop_factory' kwarg to avoid calling the
     asyncio policy system.

   - gh-110682(5): *note runtime-checkable protocols: 867. 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(): 1c8d.: 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:
     29c. would be overwritten by *note OverflowError: c5b. 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: 66. 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: 1cd.  It was not documented and only supported in
     the C implementation.

   - gh-110378(11): *note contextmanager(): 219. and *note
     asynccontextmanager(): 21a. 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(): 1c8e. 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:
     11b. within those modules.  Patch by Alex Waygood.

   - gh-110273(15): *note dataclasses.replace(): 1c8f. 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: c0.  Patch by Alex Waygood.

   - gh-110222(18): Add support of struct sequence objects in *note
     copy.replace(): 461.  Patched by Xuehai Pan.

   - gh-109649(19): *note multiprocessing: 98, *note concurrent.futures:
     24, *note compileall: 21.: Replace *note os.cpu_count(): 6e7. with
     *note os.process_cpu_count(): 6e6. 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: 10fd. 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: e1. module to support the
     new scopes introduced by PEP 695(24).

   - gh-88402(25): Add new variables to *note
     sysconfig.get_config_vars(): 525. on Windows: ‘LIBRARY’,
     ‘LDLIBRARY’, ‘LIBDIR’, ‘SOABI’, and ‘Py_NOGIL’.

   - gh-109631(26): *note re: c1. functions such as *note re.findall():
     13d6, *note re.split(): 7a6, *note re.search(): 15e8. and *note
     re.sub(): 7a7. which perform short repeated matches can now be
     interrupted by user.

   - gh-109653(27): Reduce the import time of *note email.utils: 53. by
     around 43%.  This results in the import time of *note
     email.message: 47. falling by around 18%, which in turn reduces the
     import time of *note importlib.metadata: 7d. by around 6%.  Patch
     by Alex Waygood.

   - gh-109818(28): Fix *note reprlib.recursive_repr(): 15b2. 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: 317.  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(): dd8.
     is identical on all platforms.  Patch by Amin Alaee.

   - gh-109653(31): Improve import time of *note functools: 62. by
     around 13%.  Patch by Alex Waygood.

   - gh-109590(32): *note shutil.which(): 8c9. 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: 59. 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: 10d. by
     around a third.  Patch by Alex Waygood.

   - gh-109649(36): Add *note os.process_cpu_count(): 6e6. 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(): 4fc. and *note
     os.DirEntry.stat(): 1c90.: 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(): 1b8e.
     and *note ssl.SSLSocket.get_unverified_chain(): 1b8f. methods.

     Contributed by Mateusz Nowak.

   - gh-109559(41): Update *note unicodedata: 10e. database to Unicode
     15.1.0.

   - gh-109543(42): Remove unnecessary *note hasattr(): 8e7. check
     during *note typing.TypedDict: 29b. creation.

   - gh-109495(43): Remove unnecessary extra ‘__slots__’ in *note
     datetime: 6ed.'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: 8a.: Use a context manager for lock
     acquisition.

   - gh-109096(45): ‘http.server.CGIHTTPRequestHandler’ 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: 1c91. object has been
     made copyable and pickleable.  Patched by Robert Lehmann and Furkan
     Onder.

   - gh-109187(51): *note pathlib.Path.resolve(): 1c92. now treats
     symlink loops like other errors: in strict mode, *note OSError:
     543. 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: 6f0. in
     *note copy.replace(): 461.

   - gh-109164(54): *note pdb: aa.: Replace *note getopt: 64. with *note
     argparse: 7. for parsing command line arguments.

   - gh-109151(55): Enable ‘readline’ editing features in the *note
     sqlite3 command-line interface: 263. (‘python -m sqlite3’).

   - gh-108987(56): Fix *note _thread.start_new_thread(): 6c2. 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(): cba. when
     unparsing f-strings containing many quote types.

   - gh-108469(60): *note ast.unparse(): cba. now supports new *note
     f-string: 85e. 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(): 461. 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: 29c. 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: 3e6. APIs:

        * *note set_authorizer(): 3ea.

        * *note set_progress_handler(): 3eb.

        * *note set_trace_callback(): 3ec.

     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: 29f.

   - gh-108463(66): Make expressions/statements work as expected in pdb

   - gh-108277(67): Add *note os.timerfd_create(): 728, *note
     os.timerfd_settime(): 729, *note os.timerfd_gettime(): 72b, *note
     os.timerfd_settime_ns(): 72a, and *note os.timerfd_gettime_ns():
     72c. to provide a low level interface for Linux's timer
     notification file descriptor.

   - gh-107811(68): *note tarfile: e7.: 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(): 756.  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(): a91. 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: 3e6. APIs:

        * *note create_function(): 3e8.

        * *note create_aggregate(): 3e9.

     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: 9da. 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: 3e6. and *note sqlite3.Connection.close(): 755.
     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: d7. now emits an *note
     ResourceWarning: 754. if a *note sqlite3.Connection: 3e6. object is
     not ‘closed’ explicitly.  Patch by Erlend E. Aasland.

   - gh-107995(80): The ‘__module__’ attribute on instances of *note
     functools.cached_property: 953. 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: 3d.
     module.  Patch by Tyler Smart.

   - gh-107963(81): Fix *note multiprocessing.set_forkserver_preload():
     198a. to check the given list of modules names.  Patch by Donghee
     Na.

   - gh-106242(82): Fixes *note os.path.normpath(): 16d3. to handle
     embedded null characters without truncating the path.

   - gh-81555(83): *note xml.dom.minidom: 12b. now only quotes ‘"’ in
     attributes.

   - gh-50002(84): *note xml.dom.minidom: 12b. now preserves whitespaces
     in attributes.

   - gh-93057(85): Passing more than one positional argument to *note
     sqlite3.connect(): 3e7. and the *note sqlite3.Connection: 3e6.
     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: 16af.

   - gh-107913(87): Fix possible losses of ‘errno’ and ‘winerror’ values
     in *note OSError: 543. exceptions if they were cleared or modified
     by the cleanup code before creating the exception object.

   - gh-107845(88): *note tarfile.data_filter(): 284. 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: 10a.

   - gh-107782(91): *note pydoc: bd. 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():
     7a6, *note re.sub(): 7a7. and *note re.subn(): 7a8. as positional.
     They should only be passed by keyword.

   - gh-107710(93): Speed up *note logging.getHandlerNames(): 1c93.

   - gh-107715(94): Fix *note doctest.DocTestFinder.find(): 1c94. 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: f9. 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: 754. when *note
     asyncio.StreamWriter: 1c95. is not closed leading to memory leaks.
     Patch by Kumar Aditya.

   - gh-107465(98): Add *note pathlib.Path.from_uri(): 73c. 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(): 8e3. 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(): 15b2.

   - gh-107406(105): Implement new ‘__repr__()’ method for *note
     struct.Struct: 307.  Now it returns ‘Struct(<format repr>)’.

   - gh-107369(106): Optimize *note textwrap.indent(): 783.  It is ~30%
     faster for large input.  Patch by Inada Naoki.

   - gh-78722(107): Fix issue where *note pathlib.Path.iterdir(): 4fd.
     did not raise *note OSError: 543. until iterated.

   - gh-105578(108): Deprecate *note typing.AnyStr: 7aa. in favor of the
     new Type Parameter syntax.  See PEP 695.

   - gh-62519(109): Make *note gettext.pgettext(): dbc. search plural
     definitions when translation is not found.

   - gh-107089(110): Shelves opened with *note shelve.open(): 1c96. 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(): ed7. implementation.

   - gh-83006(112): Document behavior of *note shutil.disk_usage():
     14ee. 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: 155b. 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: 15a. 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: 3b.
     module are now generated from bytecodes.c instead of explicitly
     constructed in opcode.py.

   - gh-106727(122): Make *note inspect.getsource(): 1a24. smarter for
     class for same name definitions

   - gh-106789(123): Remove import of *note pprint: b3. from *note
     sysconfig: e4.

   - gh-105726(124): Added ‘__slots__’ to *note
     contextlib.AbstractContextManager: 1051. and *note
     contextlib.AbstractAsyncContextManager: eef. 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: ca.: 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: d8. 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: 59.

   - gh-106664(133): *note selectors: ca.: 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: 11a. activation, even when ‘VIRTUAL_ENV_DISABLE_PROMPT’
     is set.

   - gh-106530(136): Revert a change to *note colorsys.rgb_to_hls():
     1c97. 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: ca.: 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: c1. 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: 29f, *note
     typing.ParamSpec: 2a0, *note typing.ParamSpecArgs: baa, *note
     typing.ParamSpecKwargs: bab, and *note typing.TypeVarTuple: 29e.
     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(): 953.  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(): 8c1.  This bug was introduced in Python
     3.12.0 beta 1.

   - gh-106309(155): Deprecate ‘typing.no_type_check_decorator()’.  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: 1c8. 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: f6, 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 ‘cProfile’ 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():
     1015. 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: 772. class
     that had one or more non-callable members would raise *note
     TypeError: 29c. when *note issubclass(): 2fc. 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: 73b, which
     is raised instead of *note NotImplementedError: 5a1. 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(): 12e0. 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(): cba. 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(): 742. and *note is_file(): 741,
     defaulting to ‘True’.

   - gh-105570(174): Deprecate two methods of creating *note
     typing.TypedDict: 29b. 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: 2d.: 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(): da5. 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(): 1c98. to
     be ‘None’ and not ‘{}’.

   - gh-105375(181): Fix bugs in *note sys: e2. 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: 39. 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: 6cb. 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: 13d. where exceptions
     could be overwritten.

   - gh-105375(191): Fix bugs in *note errno: 5a. where exceptions could
     be overwritten.

   - gh-105566(192): Deprecate creating a *note typing.NamedTuple: 2f0.
     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: d0d. 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:
     10d. module public API.

   - gh-105375(196): Fix bugs in *note pickle: ab. where exceptions
     could be overwritten.

   - gh-70303(197): Emit *note FutureWarning: 84d. from *note
     pathlib.Path.glob(): 73f. and *note rglob(): 740. 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: d7. where an exception
     could be overwritten in the *note collation: a6b. callback.

   - gh-105382(199): Remove 'cafile', 'capath' and 'cadefault'
     parameters of the *note urllib.request.urlopen(): 586. function,
     deprecated in Python 3.6.  Patch by Victor Stinner.

   - gh-105376(200): *note logging: 8a.: 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(): 1c99. method,
     ‘logging.LoggerAdapter.warning()’ method and *note
     logging.warning(): 339. 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(): c2a. to recurse into the nested
     exception of a *note BaseExceptionGroup: 76d.

   - 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: 772. 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(): 4c4.

   - gh-105144(209): Fix a recent regression in the *note typing: 10d.
     module.  The regression meant that doing ‘class Foo(X,
     typing.Protocol)’, where ‘X’ was a class that had *note
     abc.ABCMeta: 12cd. as its metaclass, would then cause subsequent
     ‘isinstance(1, X)’ calls to erroneously raise *note TypeError: 29c.
     Patch by Alex Waygood.

   - gh-62948(210): The *note io.IOBase: 710. finalizer now logs the
     ‘close()’ method errors with *note sys.unraisablehook: 712.
     Previously, errors were ignored silently by default, and only
     logged in *note Python Development Mode: 713. or on *note Python
     built on debug mode: 3e3.  Patch by Victor Stinner.

   - gh-105096(211): *note wave: 11c.: Deprecate the ‘getmark()’,
     ‘setmark()’ and ‘getmarkers()’ methods of the *note wave.Wave_read:
     2f2. and *note wave.Wave_write: 2f3. 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: 8bb.
     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: 1c9a. 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(): 867. and *note typing.Generic: 1a12.
     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__: 18a3. to *note
     os.PathLike: 1013.

   - 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: 29b.
     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(): 771. to
     return the set of members defining a *note typing.Protocol: 772.
     Add *note typing.is_protocol(): 773. 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: 10b5.  Patch by Jelle Zijlstra.

   - gh-104835(255): Removed the following *note unittest: 10f.
     functions, deprecated in Python 3.11:

        * ‘unittest.findTestCases()’

        * ‘unittest.makeSuite()’

        * ‘unittest.getTestCaseNames()’

     Use *note TestLoader: 798. methods instead:

        * *note unittest.TestLoader.loadTestsFromModule(): 799.

        * *note unittest.TestLoader.loadTestsFromTestCase(): 79a.

        * *note unittest.TestLoader.getTestCaseNames(): 79b.

     Patch by Hugo van Kemenade.

   - gh-104804(256): Remove the untested and undocumented *note
     webbrowser: 11e. ‘MacOSX’ class, deprecated in Python 3.11.  Patch
     by Hugo van Kemenade.

   - gh-83863(257): Support for using *note pathlib.Path: 4f5. 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: 1c9b, *note
     ast.AsyncFunctionDef: 1c9c, and *note ast.FunctionDef: 1c9d. to
     better preserve backward compatibility.  Patch by Jelle Zijlstra

   - gh-104797(260): Allow *note typing.Protocol: 772. classes to
     inherit from *note collections.abc.Buffer: 31a.  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: df. 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: 6b. 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():
     73f. when expanding a pattern with a non-terminal "‘**’" component
     by filtering walked paths through a regular expression, rather than
     calling *note os.scandir(): e27. 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: 49b.

   - 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: bcb. 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(): 73f. and *note rglob(): 740, defaulting to
     false.

   - gh-102541(284): Hide traceback in *note help(): cad. 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(): 2eb.

   - 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(): 8c1.

   - gh-84867(290): *note unittest.TestLoader: 798. no longer loads test
     cases from exact *note unittest.TestCase: 536. and *note
     unittest.FunctionTestCase: 1c9e. classes.

   - gh-99203(291): Restore following CPython <= 3.10.5 behavior of
     *note shutil.make_archive(): 8c8.: do not create an empty archive
     if ‘root_dir’ is not a directory, and, in that case, raise *note
     FileNotFoundError: 24f. or *note NotADirectoryError: 1410.
     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: 2d4. for *note array:
     8.'s ‘'u'’ type code, deprecated in docs since Python 3.3.

   - gh-94924(293): *note unittest.mock.create_autospec(): 1b6d. now
     properly returns coroutine functions compatible with *note
     inspect.iscoroutinefunction(): 154.

   - 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: 10d. 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: 83.  Patch by Oleksandr Pavliuk.

   - bpo-44850(298): Improve performance of *note
     operator.methodcaller(): 11eb. using the PEP 590(299) ‘vectorcall’
     convention.  Patch by Anthony Lee and Pieter Eendebak.

   - bpo-44185(300): *note unittest.mock.mock_open(): 1395. 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: 229. by caching the generated
     dispatch wrapper.  Optimization suggested by frederico.  Patch by
     @mental32, Alex Waygood and Pieter Eendebak.

   - bpo-41768(302): *note unittest.mock: 110. 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: 110.
     that can be used to create Mock objects that can wait until they
     are called.  Patch by Karthikeyan Singaravelan and Mario Corchero.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/110786

   (2) https://github.com/python/cpython/issues/103480

   (3) https://github.com/python/cpython/issues/110733

   (4) https://github.com/python/cpython/issues/94597

   (5) https://github.com/python/cpython/issues/110682

   (6) https://github.com/python/cpython/issues/110488

   (7) https://github.com/python/cpython/issues/110590

   (8) https://github.com/python/cpython/issues/65052

   (9) https://github.com/python/cpython/issues/110519

   (10) https://github.com/python/cpython/issues/89902

   (11) https://github.com/python/cpython/issues/110378

   (12) https://github.com/python/cpython/issues/106670

   (13) https://github.com/python/cpython/issues/110365

   (14) https://github.com/python/cpython/issues/109653

   (15) https://github.com/python/cpython/issues/110273

   (16) https://github.com/python/cpython/issues/110249

   (17) https://github.com/python/cpython/issues/109653

   (18) https://github.com/python/cpython/issues/110222

   (19) https://github.com/python/cpython/issues/109649

   (20) https://github.com/python/cpython/issues/110150

   (21) https://github.com/python/cpython/issues/110036

   (22) https://github.com/python/cpython/issues/110038

   (23) https://github.com/python/cpython/issues/110045

   (24) https://peps.python.org/pep-0695/

   (25) https://github.com/python/cpython/issues/88402

   (26) https://github.com/python/cpython/issues/109631

   (27) https://github.com/python/cpython/issues/109653

   (28) https://github.com/python/cpython/issues/109818

   (29) https://github.com/python/cpython/issues/109047

   (30) https://github.com/python/cpython/issues/109782

   (31) https://github.com/python/cpython/issues/109653

   (32) https://github.com/python/cpython/issues/109590

   (33) https://github.com/python/cpython/issues/109653

   (34) https://github.com/python/cpython/issues/109593

   (35) https://github.com/python/cpython/issues/109653

   (36) https://github.com/python/cpython/issues/109649

   (37) https://github.com/python/cpython/issues/74481

   (38) https://github.com/python/cpython/issues/109613

   (39) https://github.com/python/cpython/issues/109599

   (40) https://github.com/python/cpython/issues/109109

   (41) https://github.com/python/cpython/issues/109559

   (42) https://github.com/python/cpython/issues/109543

   (43) https://github.com/python/cpython/issues/109495

   (44) https://github.com/python/cpython/issues/109461

   (45) https://github.com/python/cpython/issues/109096

   (46) https://github.com/python/cpython/issues/109409

   (47) https://github.com/python/cpython/issues/109375

   (48) https://github.com/python/cpython/issues/109319

   (49) https://github.com/python/cpython/issues/107219

   (50) https://github.com/python/cpython/issues/66143

   (51) https://github.com/python/cpython/issues/109187

   (52) https://github.com/python/cpython/issues/50644

   (53) https://github.com/python/cpython/issues/109174

   (54) https://github.com/python/cpython/issues/109164

   (55) https://github.com/python/cpython/issues/109151

   (56) https://github.com/python/cpython/issues/108987

   (57) https://github.com/python/cpython/issues/108682

   (58) https://github.com/python/cpython/issues/109033

   (59) https://github.com/python/cpython/issues/108843

   (60) https://github.com/python/cpython/issues/108469

   (61) https://github.com/python/cpython/issues/108751

   (62) https://github.com/python/cpython/issues/108682

   (63) https://github.com/python/cpython/issues/108278

   (64) https://github.com/python/cpython/issues/105829

   (65) https://github.com/python/cpython/issues/108295

   (66) https://github.com/python/cpython/issues/108463

   (67) https://github.com/python/cpython/issues/108277

   (68) https://github.com/python/cpython/issues/107811

   (69) https://github.com/python/cpython/issues/64662

   (70) https://github.com/python/cpython/issues/108111

   (71) https://github.com/python/cpython/issues/101251

   (72) https://github.com/python/cpython/issues/108294

   (73) https://github.com/python/cpython/issues/108278

   (74) https://github.com/python/cpython/issues/108322

   (75) https://github.com/python/cpython/issues/83417

   (76) https://github.com/python/cpython/issues/105736

   (77) https://github.com/python/cpython/issues/108083

   (78) https://github.com/python/cpython/issues/107932

   (79) https://github.com/python/cpython/issues/105539

   (80) https://github.com/python/cpython/issues/107995

   (81) https://github.com/python/cpython/issues/107963

   (82) https://github.com/python/cpython/issues/106242

   (83) https://github.com/python/cpython/issues/81555

   (84) https://github.com/python/cpython/issues/50002

   (85) https://github.com/python/cpython/issues/93057

   (86) https://github.com/python/cpython/issues/76913

   (87) https://github.com/python/cpython/issues/107913

   (88) https://github.com/python/cpython/issues/107845

   (89) https://github.com/python/cpython/issues/107812

   (90) https://github.com/python/cpython/issues/107805

   (91) https://github.com/python/cpython/issues/107782

   (92) https://github.com/python/cpython/issues/56166

   (93) https://github.com/python/cpython/issues/107710

   (94) https://github.com/python/cpython/issues/107715

   (95) https://github.com/python/cpython/issues/100814

   (96) https://github.com/python/cpython/issues/72684

   (97) https://github.com/python/cpython/issues/106684

   (98) https://github.com/python/cpython/issues/107465

   (99) https://github.com/python/cpython/issues/107077

   (100) https://github.com/python/cpython/issues/107576

   (101) https://github.com/python/cpython/issues/105481

   (102) https://github.com/python/cpython/issues/105481

   (103) https://github.com/python/cpython/issues/107396

   (104) https://github.com/python/cpython/issues/107409

   (105) https://github.com/python/cpython/issues/107406

   (106) https://github.com/python/cpython/issues/107369

   (107) https://github.com/python/cpython/issues/78722

   (108) https://github.com/python/cpython/issues/105578

   (109) https://github.com/python/cpython/issues/62519

   (110) https://github.com/python/cpython/issues/107089

   (111) https://github.com/python/cpython/issues/82500

   (112) https://github.com/python/cpython/issues/83006

   (113) https://github.com/python/cpython/issues/65495

   (114) https://github.com/python/cpython/issues/106186

   (115) https://github.com/python/cpython/issues/105002

   (116) https://github.com/python/cpython/issues/106739

   (117) https://github.com/python/cpython/issues/106751

   (118) https://github.com/python/cpython/issues/106751

   (119) https://github.com/python/cpython/issues/106751

   (120) https://github.com/python/cpython/issues/106831

   (121) https://github.com/python/cpython/issues/105481

   (122) https://github.com/python/cpython/issues/106727

   (123) https://github.com/python/cpython/issues/106789

   (124) https://github.com/python/cpython/issues/105726

   (125) https://github.com/python/cpython/issues/106774

   (126) https://github.com/python/cpython/issues/106751

   (127) https://github.com/python/cpython/issues/106752

   (128) https://github.com/python/cpython/issues/105293

   (129) https://github.com/python/cpython/issues/106734

   (130) https://github.com/python/cpython/issues/105481

   (131) https://github.com/python/cpython/issues/106670

   (132) https://github.com/python/cpython/issues/106602

   (133) https://github.com/python/cpython/issues/106664

   (134) https://github.com/python/cpython/issues/106628

   (135) https://github.com/python/cpython/issues/89427

   (136) https://github.com/python/cpython/issues/106530

   (137) https://github.com/python/cpython/issues/106584

   (138) https://github.com/python/cpython/issues/106566

   (139) https://github.com/python/cpython/issues/106554

   (140) https://github.com/python/cpython/issues/106558

   (141) https://github.com/python/cpython/issues/100502

   (142) https://github.com/python/cpython/issues/106527

   (143) https://github.com/python/cpython/issues/106524

   (144) https://github.com/python/cpython/issues/106531

   (145) https://github.com/python/cpython/issues/106052

   (146) https://github.com/python/cpython/issues/106510

   (147) https://github.com/python/cpython/issues/106503

   (148) https://github.com/python/cpython/issues/105497

   (149) https://github.com/python/cpython/issues/90876

   (150) https://github.com/python/cpython/issues/106403

   (151) https://github.com/python/cpython/issues/89812

   (152) https://github.com/python/cpython/issues/106292

   (153) https://github.com/python/cpython/issues/106350

   (154) https://github.com/python/cpython/issues/106330

   (155) https://github.com/python/cpython/issues/106309

   (156) https://github.com/python/cpython/issues/102541

   (157) https://github.com/python/cpython/issues/106263

   (158) https://github.com/python/cpython/issues/106236

   (159) https://github.com/python/cpython/issues/106238

   (160) https://github.com/python/cpython/issues/106152

   (161) https://github.com/python/cpython/issues/106075

   (162) https://github.com/python/cpython/issues/104527

   (163) https://github.com/python/cpython/issues/106046

   (164) https://github.com/python/cpython/issues/105987

   (165) https://github.com/python/cpython/issues/105974

   (166) https://github.com/python/cpython/issues/96145

   (167) https://github.com/python/cpython/issues/89812

   (168) https://github.com/python/cpython/issues/105808

   (169) https://github.com/python/cpython/issues/101251

   (170) https://github.com/python/cpython/issues/105481

   (171) https://github.com/python/cpython/issues/104799

   (172) https://peps.python.org/pep-0695/

   (173) https://github.com/python/cpython/issues/105793

   (174) https://github.com/python/cpython/issues/105570

   (175) https://github.com/python/cpython/issues/105745

   (176) https://github.com/python/cpython/issues/105733

   (177) https://github.com/python/cpython/issues/105687

   (178) https://github.com/python/cpython/issues/105684

   (179) https://github.com/python/cpython/issues/105375

   (180) https://github.com/python/cpython/issues/105626

   (181) https://github.com/python/cpython/issues/105375

   (182) https://github.com/python/cpython/issues/105605

   (183) https://github.com/python/cpython/issues/105375

   (184) https://github.com/python/cpython/issues/105375

   (185) https://github.com/python/cpython/issues/105375

   (186) https://github.com/python/cpython/issues/105375

   (187) https://github.com/python/cpython/issues/105375

   (188) https://github.com/python/cpython/issues/105375

   (189) https://github.com/python/cpython/issues/105375

   (190) https://github.com/python/cpython/issues/105375

   (191) https://github.com/python/cpython/issues/105375

   (192) https://github.com/python/cpython/issues/105566

   (193) https://github.com/python/cpython/issues/105545

   (194) https://github.com/python/cpython/issues/105497

   (195) https://github.com/python/cpython/issues/105509

   (196) https://github.com/python/cpython/issues/105375

   (197) https://github.com/python/cpython/issues/70303

   (198) https://github.com/python/cpython/issues/105375

   (199) https://github.com/python/cpython/issues/105382

   (200) https://github.com/python/cpython/issues/105376

   (201) https://github.com/python/cpython/issues/105332

   (202) https://github.com/python/cpython/issues/104554

   (203) https://github.com/python/cpython/issues/105292

   (204) https://github.com/python/cpython/issues/105280

   (205) https://github.com/python/cpython/issues/80480

   (206) https://github.com/python/cpython/issues/105239

   (207) https://github.com/python/cpython/issues/104310

   (208) https://github.com/python/cpython/issues/105080

   (209) https://github.com/python/cpython/issues/105144

   (210) https://github.com/python/cpython/issues/62948

   (211) https://github.com/python/cpython/issues/105096

   (212) https://github.com/python/cpython/issues/104992

   (213) https://github.com/python/cpython/issues/104996

   (214) https://github.com/python/cpython/issues/101588

   (215) https://github.com/python/cpython/issues/103631

   (216) https://github.com/python/cpython/issues/104947

   (217) https://github.com/python/cpython/issues/104773

   (218) https://peps.python.org/pep-0594/

   (219) https://github.com/python/cpython/issues/104773

   (220) https://peps.python.org/pep-0594/

   (221) https://github.com/python/cpython/issues/104773

   (222) https://peps.python.org/pep-0594/

   (223) https://github.com/python/cpython/issues/104935

   (224) https://peps.python.org/pep-0695/

   (225) https://github.com/python/cpython/issues/104773

   (226) https://peps.python.org/pep-0594/

   (227) https://github.com/python/cpython/issues/104773

   (228) https://peps.python.org/pep-0594/

   (229) https://github.com/python/cpython/issues/104898

   (230) https://github.com/python/cpython/issues/104773

   (231) https://peps.python.org/pep-0594/

   (232) https://github.com/python/cpython/issues/104773

   (233) https://peps.python.org/pep-0594/

   (234) https://github.com/python/cpython/issues/104886

   (235) https://github.com/python/cpython/issues/104786

   (236) https://github.com/python/cpython/issues/104876

   (237) https://github.com/python/cpython/issues/104773

   (238) https://peps.python.org/pep-0594/

   (239) https://github.com/python/cpython/issues/104773

   (240) https://peps.python.org/pep-0594/

   (241) https://pypi.org/project/python-pam/

   (242) https://github.com/python/cpython/issues/75552

   (243) https://github.com/python/cpython/issues/104773

   (244) https://peps.python.org/pep-0594/

   (245) https://github.com/python/cpython/issues/104773

   (246) https://peps.python.org/pep-0594/

   (247) https://github.com/python/cpython/issues/104773

   (248) https://peps.python.org/pep-0594/

   (249) https://github.com/python/cpython/issues/104780

   (250) https://peps.python.org/pep-0594/

   (251) https://github.com/python/cpython/issues/104773

   (252) https://peps.python.org/pep-0594/

   (253) https://github.com/python/cpython/issues/104873

   (254) https://github.com/python/cpython/issues/104874

   (255) https://github.com/python/cpython/issues/104835

   (256) https://github.com/python/cpython/issues/104804

   (257) https://github.com/python/cpython/issues/83863

   (258) https://github.com/python/cpython/issues/104799

   (259) https://peps.python.org/pep-0695/

   (260) https://github.com/python/cpython/issues/104797

   (261) https://github.com/python/cpython/issues/104783

   (262) https://github.com/python/cpython/issues/104780

   (263) https://github.com/python/cpython/issues/104773

   (264) https://peps.python.org/pep-0594/

   (265) https://github.com/python/cpython/issues/104773

   (266) https://peps.python.org/pep-0594/

   (267) https://github.com/python/cpython/issues/104773

   (268) https://peps.python.org/pep-0594/

   (269) https://github.com/python/cpython/issues/104773

   (270) https://peps.python.org/pep-0594/

   (271) https://github.com/python/cpython/issues/104372

   (272) https://github.com/python/cpython/issues/99108

   (273) https://github.com/python/cpython/issues/102613

   (274) https://github.com/python/cpython/issues/104399

   (275) https://github.com/python/cpython/issues/102676

   (276) https://github.com/python/cpython/issues/103558

   (277) https://github.com/python/cpython/issues/103464

   (278) https://github.com/python/cpython/issues/103384

   (279) https://github.com/python/cpython/issues/103124

   (280) https://github.com/python/cpython/issues/101162

   (281) https://github.com/python/cpython/issues/103200

   (282) https://github.com/python/cpython/issues/100061

   (283) https://github.com/python/cpython/issues/77609

   (284) https://github.com/python/cpython/issues/102541

   (285) https://github.com/python/cpython/issues/102120

   (286) https://github.com/python/cpython/issues/102029

   (287) https://github.com/python/cpython/issues/88233

   (288) https://github.com/python/cpython/issues/102024

   (289) https://github.com/python/cpython/issues/73435

   (290) https://github.com/python/cpython/issues/84867

   (291) https://github.com/python/cpython/issues/99203

   (292) https://github.com/python/cpython/issues/80480

   (293) https://github.com/python/cpython/issues/94924

   (294) https://github.com/python/cpython/issues/94777

   (295) https://github.com/python/cpython/issues/92871

   (296) https://bugs.python.org/issue?@action=redirect&bpo=43633

   (297) https://datatracker.ietf.org/doc/html/rfc4291.html

   (298) https://bugs.python.org/issue?@action=redirect&bpo=44850

   (299) https://peps.python.org/pep-0590/

   (300) https://bugs.python.org/issue?@action=redirect&bpo=44185

   (301) https://bugs.python.org/issue?@action=redirect&bpo=40988

   (302) https://bugs.python.org/issue?@action=redirect&bpo=41768

   (303) https://bugs.python.org/issue?@action=redirect&bpo=18319

   (304) https://bugs.python.org/issue?@action=redirect&bpo=17013


File: python.info,  Node: ドキュメント<20>,  Next: テスト<24>,  Prev: ライブラリ<69>,  Up: Python 3 13 0 alpha 1

1.26.25.4 ドキュメント
......................

   - gh-109209(1): The minimum Sphinx version required for the
     documentation is now 4.2.

   - gh-108826(2): *note dis: 3b. module command-line interface is now
     mentioned in documentation.

   - gh-107305(3): Add documentation for *note PyInterpreterConfig: 978.
     and *note Py_NewInterpreterFromConfig(): 87b.  Also clarify some of
     the nearby docs relative to per-interpreter GIL.

   - gh-107008(4): Document the *note curses: 2e. module variables *note
     LINES: 11a8. and *note COLS: 11a9.

   - 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(): db7. 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: 76a. class.

   - gh-89412(10): Add missing documentation for the ‘end_lineno’ and
     ‘end_offset’ attributes of the *note traceback.TracebackException:
     76a. class.

   - gh-104943(11): Remove mentions of old Python versions in *note
     typing.NamedTuple: 2f0.

   - 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: 32f.

   - 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: テスト<24>,  Next: ビルド<23>,  Prev: ドキュメント<20>,  Up: Python 3 13 0 alpha 1

1.26.25.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: 109.

   - gh-81002(5): Add tests for *note termios: ea.

   - 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():
     a91. 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(): 162d.
     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: ed.
     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(): 6f9. method
     now counts the number of skipped tests.  Add *note
     doctest.DocTestRunner.skips: 6fa. and *note
     doctest.TestResults.skipped: 6fb. 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(): 1ca1.

   - 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: ビルド<23>,  Next: Windows<21>,  Prev: テスト<24>,  Up: Python 3 13 0 alpha 1

1.26.25.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: 1ca3. 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:
     82e. (tracing references) is now ABI compatible with Python release
     build and *note debug build: 3e3.  Patch by Victor Stinner.

   - gh-85283(10): The ‘_stat’ C extension is now built with the *note
     limited C API: 82f.  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: d7. extension module.  Patch by Erlend Aasland.

   - gh-90005(20): Fix a regression in ‘configure’ where we could end up
     unintentionally linking with ‘libbsd’.

   - gh-102404(21): Document how to perform a WASI build on Linux.  Also
     add Tools/wasm/build_wasi.sh as a reference implementation of the
     docs.

   - gh-89886(22): Autoconf 2.71 and aclocal 1.16.4 is now required to
     regenerate ‘configure’.

   - gh-104692(23): Include ‘commoninstall’ as a prerequisite for
     ‘bininstall’

     This ensures that ‘commoninstall’ is completed before ‘bininstall’
     is started when parallel builds are used (‘make -j install’), and
     so the ‘python3’ symlink is only installed after all standard
     library modules are installed.

   - gh-101538(24): Add experimental wasi-threads support.  Patch by
     Takashi Yamamoto.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103053

   (2) https://github.com/python/cpython/issues/109191

   (3) https://github.com/python/cpython/issues/110276

   (4) https://github.com/python/cpython/issues/109566

   (5) https://github.com/python/cpython/issues/109740

   (6) https://github.com/python/cpython/issues/109054

   (7) https://github.com/python/cpython/issues/63760

   (8) https://github.com/python/cpython/issues/108740

   (9) https://github.com/python/cpython/issues/108634

   (10) https://github.com/python/cpython/issues/85283

   (11) https://github.com/python/cpython/issues/108447

   (12) https://github.com/python/cpython/issues/107814

   (13) https://github.com/python/cpython/issues/105481

   (14) https://github.com/python/cpython/issues/106881

   (15) https://github.com/python/cpython/issues/95855

   (16) https://github.com/python/cpython/issues/106962

   (17) https://github.com/python/cpython/issues/106118

   (18) https://github.com/python/cpython/issues/103295

   (19) https://github.com/python/cpython/issues/105875

   (20) https://github.com/python/cpython/issues/90005

   (21) https://github.com/python/cpython/issues/102404

   (22) https://github.com/python/cpython/issues/89886

   (23) https://github.com/python/cpython/issues/104692

   (24) https://github.com/python/cpython/issues/101538


File: python.info,  Node: Windows<21>,  Next: macOS<15>,  Prev: ビルド<23>,  Up: Python 3 13 0 alpha 1

1.26.25.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(): 24d. 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(): 24d. to behave consistently
     when passed a path containing an embedded null character on
     Windows.  In strict mode, it now raises *note OSError: 543. instead
     of the unexpected *note ValueError: 15a, and in non-strict mode
     will make the path absolute.

   - gh-83180(6): Changes the *note Python install manager: 9c1. 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(): e23. 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(): 4fc. 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(): 1beb. 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<15>,  Next: IDLE<14>,  Prev: Windows<21>,  Up: Python 3 13 0 alpha 1

1.26.25.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<17>,  Prev: macOS<15>,  Up: Python 3 13 0 alpha 1

1.26.25.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<17>,  Next: C API<24>,  Prev: IDLE<14>,  Up: Python 3 13 0 alpha 1

1.26.25.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: 82f.: 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<24>,  Prev: Tools/Demos<17>,  Up: Python 3 13 0 alpha 1

1.26.25.11 C API
................

   - gh-85283(1): If the *note Py_LIMITED_API: 853. 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(): 813. and
     *note PyUnicode_EqualToUTF8(): 814. functions.

   - gh-110235(3): Raise *note TypeError: 29c. 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(): 1ca9. now sets
     RuntimeError if it fails to get *note sys.path_hooks: 13d1. or
     *note sys.path_importer_cache: 9e0. 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: 699. internal-only lightweight
     locking API.

   - gh-85283(7): Add *note PySys_AuditTuple(): 80d. function: similar
     to *note PySys_Audit(): 80e, but pass event arguments as a Python
     *note tuple: 1d9. object.  Patch by Victor Stinner.

   - gh-108867(8): Add *note PyThreadState_GetUnchecked(): 63d.
     function: similar to *note PyThreadState_Get(): 80f, 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():
     815, *note PyObject_HasAttrStringWithError(): 817, *note
     PyMapping_HasKeyWithError(): 819. and *note
     PyMapping_HasKeyStringWithError(): 81b.

   - gh-107073(14): Add *note PyObject_VisitManagedDict(): 809. and
     *note PyObject_ClearManagedDict(): 80a. functions which must be
     called by the traverse and clear functions of a type using *note
     Py_TPFLAGS_MANAGED_DICT: 3a4. flag.  Patch by Victor Stinner.

   - gh-108634(15): Python built with ‘configure’ *note
     -with-trace-refs: 82e. (tracing references) now supports the *note
     Limited API: 82f.  Patch by Victor Stinner.

   - gh-108014(16): Add *note PyLong_AsInt(): 800. function: similar to
     *note PyLong_AsLong(): 801, 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(): 7dc. function:
     same as *note PyDict_Contains(): 7dd, but 'key' is specified as a
     const char* UTF-8 encoded bytes string, rather than a *note
     PyObject: 1a6.*.  Patch by Victor Stinner.

   - gh-108337(18): Add atomic operations on additional data types in
     pyatomic.h.

   - gh-108014(19): Add *note Py_IsFinalizing(): 7f9. function: check if
     the main Python interpreter is *note shutting down: 1ab.  Patch by
     Victor Stinner.

   - gh-107916(20): C API functions *note
     PyErr_SetFromErrnoWithFilename(): 1caa, *note
     PyErr_SetExcFromWindowsErrWithFilename(): 1cab. and *note
     PyErr_SetFromWindowsErrWithFilename(): 1cac. save now the error
     code before calling *note PyUnicode_DecodeFSDefault(): 1cad.

   - 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: 2d4. for uses of
     *note PyType_Spec: 1cae. with metaclasses that have custom
     ‘tp_new’.

   - gh-107249(23): Implement the *note Py_UNUSED: 1caf. macro for
     Windows MSVC compiler.  Patch by Victor Stinner.

   - gh-107226(24): *note PyModule_AddObjectRef(): 806. 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(): 63e.  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():
     154c. function can be used to keep compatibility with Python 3.2
     and older.  Patch by Victor Stinner.

   - gh-106572(26): Convert *note PyObject_DelAttr(): 1a8d. and *note
     PyObject_DelAttrString(): 1a8e. macros to functions.  Patch by
     Victor Stinner.

   - gh-106307(27): Add *note PyMapping_GetOptionalItem(): 7e6.
     function.

   - gh-106521(28): Add *note PyObject_GetOptionalAttr(): 7ea. and *note
     PyObject_GetOptionalAttrString(): 7eb. functions.

   - gh-106320(29): Remove ‘_PyInterpreterState_Get()’ alias to *note
     PyInterpreterState_Get(): 841. 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: 3e3. or
     *note with assertions: 826, *note PyTuple_SET_ITEM(): 827. and
     *note PyList_SET_ITEM(): 828. 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(): 7de. and *note
     PyDict_GetItemStringRef(): 63b. functions: similar to *note
     PyDict_GetItemWithError(): 7df. but returning a *note strong
     reference: 7e0. instead of a *note borrowed reference: 60a.  Patch
     by Victor Stinner.

   - gh-105927(36): Deprecate the ‘PyWeakref_GetObject()’ and
     ‘PyWeakref_GET_OBJECT()’ functions: use the new *note
     PyWeakref_GetRef(): 3ac. function instead.  Patch by Victor
     Stinner.

   - gh-105927(37): Add *note PyWeakref_GetRef(): 3ac. function: similar
     to ‘PyWeakref_GetObject()’ but returns a *note strong reference:
     7e0, or ‘NULL’ if the referent is no longer live.  Patch by Victor
     Stinner.

   - gh-105922(38): Add *note PyImport_AddModuleRef(): 7f7.: similar to
     *note PyImport_AddModule(): 7f8, but return a *note strong
     reference: 7e0. instead of a *note borrowed reference: 60a.  Patch
     by Victor Stinner.

   - gh-105227(39): The new *note PyType_GetDict(): 1cb0. provides the
     dictionary for the given type object that is normally exposed by
     ‘cls.__dict__’.  Normally it's sufficient to use *note tp_dict:
     1cb1, 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(): 1cb2. 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(): 979. and *note Py_DECREF(): 97a. functions are now
     implemented as opaque function calls to hide implementation
     details.  Patch by Victor Stinner.

   - gh-105396(43): Deprecate the ‘PyImport_ImportModuleNoBlock()’
     function which is just an alias to *note PyImport_ImportModule():
     3ab. since Python 3.3.  Patch by Victor Stinner.

   - gh-103968(44): *note PyType_FromMetaclass(): 399. 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:

        * ‘PySys_ResetWarnOptions()’

        * ‘Py_GetExecPrefix()’

        * ‘Py_GetPath()’

        * ‘Py_GetPrefix()’

        * ‘Py_GetProgramFullPath()’

        * ‘Py_GetProgramName()’

        * ‘Py_GetPythonHome()’

     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(): 832. and *note PyBuffer_Release(): 833.

   - 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(): 834. and *note PyObject_Call():
          835. (positional arguments must not be 'NULL') instead.

        * ‘PyEval_CallFunction()’: use *note PyObject_CallFunction():
          837. instead.

        * ‘PyEval_CallMethod()’: use *note PyObject_CallMethod(): 3be.
          instead.

        * ‘PyCFunction_Call()’: use *note PyObject_Call(): 835. 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*: 44f.

   - gh-104922(55): ‘PY_SSIZE_T_CLEAN’ is no longer required to use
     ‘'#'’ formats in APIs like *note PyArg_ParseTuple(): 3b9. and *note
     Py_BuildValue(): 5f5.  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: 98b. or *note
     PyOS_ReadlineFunctionPointer: 98c. 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(): 805. function: similar to
     *note PyModule_AddObjectRef(): 806. and *note PyModule_AddObject():
     807, but always steals a reference to the value.

   - bpo-40309(59): Properly handle trailing spaces before closing
     parenthesis in *note Py_BuildValue(): 5f5. 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.26.26 Python 3.12.0 beta 1
----------------------------

'Release date: 2023-05-22'

* Menu:

* セキュリティ: セキュリティ<21>.
* ライブラリ: ライブラリ<70>.
* Core and Builtins: Core and Builtins<67>.
* ライブラリ: ライブラリ<71>.
* Core and Builtins: Core and Builtins<68>.
* ライブラリ: ライブラリ<72>.
* ドキュメント: ドキュメント<21>.
* テスト: テスト<25>.
* ビルド: ビルド<24>.
* Windows: Windows<22>.
* macOS: macOS<16>.
* IDLE: IDLE<15>.
* Tools/Demos: Tools/Demos<18>.
* C API: C API<25>.


File: python.info,  Node: セキュリティ<21>,  Next: ライブラリ<70>,  Up: Python 3 12 0 beta 1

1.26.26.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: 6b. 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(): 2ae. 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: ライブラリ<70>,  Next: Core and Builtins<67>,  Prev: セキュリティ<21>,  Up: Python 3 12 0 beta 1

1.26.26.2 ライブラリ
....................

   - gh-102856(1): Implement PEP 701 changes in the *note tokenize: 104.
     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<67>,  Next: ライブラリ<71>,  Prev: ライブラリ<70>,  Up: Python 3 12 0 beta 1

1.26.26.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: 6b9.
     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: 4e0. or *note tuple:
     1d9. repetition could fail to respect PEP 683(14).

   - gh-104078(15): Improve the performance of *note
     PyObject_HasAttrString(): 818.

   - gh-104066(16): Improve the performance of *note hasattr(): 8e7. 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: fd0, *note False: ef9, and *note None: a6a.) in the
     main interpreter loop.

   - gh-103899(22): Provide a helpful hint in the *note TypeError: 29c.
     message when accidentally calling a *note module: 1c06. object that
     has a callable attribute of the same name (such as *note dis.dis():
     49d. or *note datetime.datetime: 6ed.).

   - 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: ライブラリ<71>,  Next: Core and Builtins<68>,  Prev: Core and Builtins<67>,  Up: Python 3 12 0 beta 1

1.26.26.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<68>,  Next: ライブラリ<72>,  Prev: ライブラリ<71>,  Up: Python 3 12 0 beta 1

1.26.26.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: 6de.

   - 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*: 44f.

   - gh-103492(7): Clarify *note SyntaxWarning: 451. 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: 8f0. (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: 317.  Context
     information is added to the exception as a PEP 678(12) note.

   - gh-103333(13): *note AttributeError: 1b4. now retains the ‘name’
     attribute when pickled and unpickled.

   - gh-103242(14): Migrate *note set_ecdh_curve(): 267. 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: aeb. entries
     for *note CALL: af8.

   - 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: 139e.

   - gh-98003(26): Complex function calls are now faster and consume no
     C stack space.

   - bpo-39610(27): ‘len()’ for 0-dimensional *note memoryview: 1dd.
     objects (such as ‘memoryview(ctypes.c_uint8(42))’) now raises a
     *note TypeError: 29c.  Previously this returned ‘1’, which was not
     consistent with ‘mem_0d[0]’ raising an *note IndexError: 18ed.

   ---------- 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: ライブラリ<72>,  Next: ドキュメント<21>,  Prev: Core and Builtins<68>,  Up: Python 3 12 0 beta 1

1.26.26.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(): 13cf. 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(): 2fc. check
     comparing a class ‘X’ against a *note runtime-checkable protocol:
     867. ‘Y’ with non-callable members would not cause *note TypeError:
     29c. to be raised if an *note isinstance(): 2fb. 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(): 8c1.

   - gh-75367(8): Fix data descriptor detection in *note
     inspect.getattr_static(): 8aa.

   - 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: 10d.

   - gh-102613(13): Fix issue where *note pathlib.Path.glob(): 73f.
     raised *note RecursionError: 1125. when walking deep directory
     trees.

   - gh-103000(14): Improve performance of *note dataclasses.asdict():
     192e. 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(): 1c61. 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(): 73f.
     raised *note OSError: 543. 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():
     73f. 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(): 73f.
     returned incomplete results when it encountered a *note
     PermissionError: 10fd.  This method now suppresses all *note
     OSError: 543. exceptions, except those raised from calling *note
     is_dir(): 742. on the top-level path.

   - gh-104144(26): Optimize *note asyncio.TaskGroup: 6dd. when using
     *note asyncio.eager_task_factory(): 892.  Skip scheduling a done
     callback if a TaskGroup task completes eagerly.

   - gh-104144(27): Optimize *note asyncio.gather(): 9f9. when using
     *note asyncio.eager_task_factory(): 892. 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(): 73f.
     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():
     73f. by using *note re.IGNORECASE: 1cba. to implement
     case-insensitive matching.

   - gh-104102(30): Improve performance of *note pathlib.Path.glob():
     73f. 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: 1bd0.
     according to PEP 692(33).

   - gh-103963(34): Make *note dis: 3b. 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(): 1cbb. to the *note
     turtle: 10a. 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(): 1964. for files to be
     executed instead of raw *note open(): 333.

   - gh-68968(40): Fixed garbled output of *note assertEqual(): 93c.
     when an input lacks final newline.

   - gh-100370(41): Fix potential *note OverflowError: c5b. in *note
     sqlite3.Connection.blobopen(): a76. for 32-bit builds.  Patch by
     Erlend E. Aasland.

   - gh-102628(42): Substitute CTRL-D with CTRL-Z in *note sqlite3: d7.
     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(): 2ae. 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: 3b. 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(): 336.
     and *note datetime.datetime.utcfromtimestamp(): 337.  (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: 12d7. now supports
     suppressing exceptions raised as part of an *note ExceptionGroup:
     6de.  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(): db5.
     in the implementation of *note datetime.datetime.strptime(): 2dd,
     which should now accept only valid ISO dates.  (Patch by Paul
     Ganssle)

   - gh-103685(54): Prepare ‘tkinter.Menu.index()’ for Tk 8.7 so that it
     does not raise ‘TclError: expected integer but got ""’ when it
     should return ‘None’.

   - gh-81403(55): *note urllib.request.CacheFTPHandler: 1cbc. 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: d4. constants for source-specific
     multicast.  Patch by Reese Hyde.

   - gh-103673(60): *note socketserver: d5. 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(): 930. with *note io.open_code(): 1964.  The new method
     would also call into the hook set by *note
     PyFile_SetOpenCodeHook(): 1cbd.

   - gh-103556(66): Now creating *note inspect.Signature: 6ee. 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(): 1c4d. and *note cwd(): 1cbe. by joining
     paths only when necessary.  Also improve performance of *note
     pathlib.PurePath.is_absolute(): 1cbf. 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 ‘cProfile’ to use PEP 669 API

   - gh-103525(71): Fix misleading exception message when mixed ‘str’
     and ‘bytes’ arguments are supplied to *note pathlib.PurePath: 8bb.
     and *note Path: 4f5.

   - gh-103489(72): Add *note getconfig(): 8ce. and *note setconfig():
     8cf. to *note Connection: 3e6. 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: 754. in
     *note http.client.HTTPConnection: 22e. by closing the proxy /
     tunnel's CONNECT response explicitly.

   - gh-103462(75): Fixed an issue with using *note writelines(): 1a29.
     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(): 1164. or *note socket.socket.sendmsg(): 891,
     resulting in the remaining buffer being left unwritten.

   - gh-103449(76): Fix a bug in doc string generation in *note
     dataclasses.dataclass(): 6ec.

   - gh-103092(77): Isolate ‘_collections’ (apply PEP 687(78)).  Patch
     by Erlend E. Aasland.

   - gh-103357(79): Added support for *note logging.Formatter: 184f.
     ‘defaults’ parameter to *note logging.config.dictConfig(): 156e.
     and *note logging.config.fileConfig(): f12.  Patch by Bar Harel.

   - gh-103092(80): Adapt the *note winreg: 11f. extension module to PEP
     687(81).

   - gh-74690(82): The performance of *note isinstance(): 2fb. checks
     against *note runtime-checkable protocols: 867. has been
     considerably improved for protocols that only have a few members.
     To achieve this improvement, several internal implementation
     details of the *note typing: 10d. 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": 8e6. for more
     details.

   - gh-103256(84): Fixed a bug that caused *note hmac: 6d. 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: 76.

   - gh-103285(86): Improve performance of *note
     ast.get_source_segment(): da0.

   - 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: 120. extension module to
     PEP 687(91).

   - gh-93910(92): Remove deprecation of enum ‘member.member’ access.

   - gh-102978(93): Fixes *note unittest.mock.patch(): 1246. 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(): 8bc,
     which creates a path object from arguments.  This method is called
     whenever a derivative path is created, such as from *note
     pathlib.PurePath.parent: 1cc0.  Subclasses may override this method
     to share information between path objects.

   - gh-103220(97): Fix issue where *note os.path.join(): 1a62. added a
     slash when joining onto an incomplete UNC drive with a trailing
     slash on Windows.

   - gh-103204(98): Fixes *note http.server: 75. 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(): 8aa.  Patch by Alex Waygood.

   - gh-103176(101): *note sys._current_exceptions(): 8d7. 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(): 8cd, for overriding the SQLite
     extension entry point.  Patch by Erlend E. Aasland.

   - gh-103000(104): Improve performance of *note dataclasses.astuple():
     192f. and *note dataclasses.asdict(): 192e. in cases where the
     contents are common Python types.

   - gh-102953(105): The extraction methods in *note tarfile: e7, and
     *note shutil.unpack_archive(): 887, 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: 888. 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(): 73f. and *note rglob(): 740.

   - gh-101819(108): Isolate the *note io: 82. 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: 2d6.

   - gh-101362(111): Speed up *note pathlib.Path: 4f5. construction by
     omitting the path anchor from the internal list of path parts.

   - gh-102114(112): Functions in the *note dis: 3b. 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: 10f. 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:
     8bb.  Pathlib no longer appends a trailing slash to such paths.

   - gh-85984(115): Add *note tty.cfmakeraw(): 1c68. and *note
     tty.cfmakecbreak(): 1c1d. to *note tty: 109. and modernize, the
     behavior of *note tty.setraw(): 1c67. and *note tty.setcbreak():
     1c1c. to use POSIX.1-2017 Chapter 11 "General Terminal Interface"
     flag masks by default.

   - gh-101688(116): Implement *note types.get_original_bases(): 8e3. to
     provide further introspection for types.

   - gh-101640(117): *note argparse.ArgumentParser: 1e7. now catches
     errors when writing messages, such as when *note sys.stderr: d09.
     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: 6a. 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: 22e.
     ‘.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(): 7ad.

   - gh-94473(124): Flatten arguments in ‘tkinter.Canvas.coords()’.  It
     now accepts not only ‘x1, y1, x2, y2, ...’ and ‘[x1, y1, x2, y2,
     ...]’, but also ‘(x1, y1), (x2, y2), ...’ and ‘[(x1, y1), (x2, y2),
     ...]’.

   - gh-98040(125): Remove more deprecated importlib APIs:
     ‘find_loader()’, ‘find_module()’, ‘importlib.abc.Finder’,
     ‘pkgutil.ImpImporter’, ‘pkgutil.ImpLoader’.

   - gh-96522(126): Fix potential deadlock in pty.spawn()

   - gh-96534(127): Support divert(4) added in FreeBSD 14.

   - gh-87474(128): Fix potential file descriptor leaks in *note
     subprocess.Popen: 6c5.

   - gh-94906(129): Support multiple steps in *note math.nextafter():
     8ae.  Patch by Shantanu Jain and Matthias Gorgens.

   - gh-51574(130): Make *note tempfile.mkdtemp(): 735. 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: 13a,
     ‘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: 11e. to detect and launch
     Microsoft Edge browser.

   - bpo-45606(135): Fixed the bug in *note pathlib.Path.glob(): 73f. -
     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: 89c. and *note
     QUOTE_NOTNULL: 89b. to the suite of *note csv: 2c. module quoting
     styles.

   - bpo-24964(137): Added *note
     http.client.HTTPConnection.get_proxy_response_headers(): 1c98. 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(): 1cc1. close the
     subprocess's stdin even when called with ‘input=None’.

   - bpo-22708(140): http.client CONNECT method tunnel improvements: Use
     HTTP 1.1 protocol; send a matching Host: header with CONNECT, if
     one is not provided; convert IDN domain names to Punycode.  Patch
     by Michael Handler.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31821

   (2) https://github.com/python/cpython/issues/104600

   (3) https://peps.python.org/pep-0695/

   (4) https://github.com/python/cpython/issues/104340

   (5) https://github.com/python/cpython/issues/104555

   (6) https://github.com/python/cpython/issues/104372

   (7) https://github.com/python/cpython/issues/104484

   (8) https://github.com/python/cpython/issues/75367

   (9) https://github.com/python/cpython/issues/104536

   (10) https://github.com/python/cpython/issues/103857

   (11) https://github.com/python/cpython/issues/101520

   (12) https://github.com/python/cpython/issues/104392

   (13) https://github.com/python/cpython/issues/102613

   (14) https://github.com/python/cpython/issues/103000

   (15) https://github.com/python/cpython/issues/104301

   (16) https://github.com/python/cpython/issues/104139

   (17) 
https://support.apple.com/en-gb/guide/deployment/depce7cefc4d/web

   (18) https://github.com/python/cpython/issues/104307

   (19) https://github.com/python/cpython/issues/104310

   (20) https://github.com/python/cpython/issues/87695

   (21) https://github.com/python/cpython/issues/104265

   (22) https://bugs.python.org/issue?@action=redirect&bpo=14935

   (23) https://github.com/python/cpython/issues/102613

   (24) https://github.com/python/cpython/issues/65772

   (25) https://github.com/python/cpython/issues/90208

   (26) https://github.com/python/cpython/issues/104144

   (27) https://github.com/python/cpython/issues/104144

   (28) https://github.com/python/cpython/issues/104114

   (29) https://github.com/python/cpython/issues/104104

   (30) https://github.com/python/cpython/issues/104102

   (31) https://github.com/python/cpython/issues/103822

   (32) https://github.com/python/cpython/issues/103629

   (33) https://peps.python.org/pep-0692/

   (34) https://github.com/python/cpython/issues/103963

   (35) https://github.com/python/cpython/issues/104035

   (36) https://github.com/python/cpython/issues/103987

   (37) https://github.com/python/cpython/issues/103977

   (38) https://github.com/python/cpython/issues/88773

   (39) https://github.com/python/cpython/issues/103935

   (40) https://github.com/python/cpython/issues/68968

   (41) https://github.com/python/cpython/issues/100370

   (42) https://github.com/python/cpython/issues/102628

   (43) https://github.com/python/cpython/issues/103636

   (44) https://github.com/python/cpython/issues/103583

   (45) https://github.com/python/cpython/issues/103848

   (46) https://github.com/python/cpython/issues/103872

   (47) https://github.com/python/cpython/issues/99944

   (48) https://github.com/python/cpython/issues/74940

   (49) https://github.com/python/cpython/issues/103861

   (50) https://github.com/python/cpython/issues/103857

   (51) https://github.com/python/cpython/issues/103839

   (52) https://github.com/python/cpython/issues/103791

   (53) https://github.com/python/cpython/issues/90750

   (54) https://github.com/python/cpython/issues/103685

   (55) https://github.com/python/cpython/issues/81403

   (56) https://github.com/python/cpython/issues/103699

   (57) https://github.com/python/cpython/issues/103693

   (58) https://github.com/python/cpython/issues/92248

   (59) https://github.com/python/cpython/issues/89415

   (60) https://github.com/python/cpython/issues/103673

   (61) https://github.com/python/cpython/issues/103636

   (62) https://github.com/python/cpython/issues/84976

   (63) https://github.com/python/cpython/issues/103596

   (64) https://github.com/python/cpython/issues/103584

   (65) https://github.com/python/cpython/issues/103578

   (66) https://github.com/python/cpython/issues/103556

   (67) https://github.com/python/cpython/issues/103559

   (68) https://github.com/python/cpython/issues/103548

   (69) https://github.com/python/cpython/issues/103538

   (70) https://github.com/python/cpython/issues/103533

   (71) https://github.com/python/cpython/issues/103525

   (72) https://github.com/python/cpython/issues/103489

   (73) https://github.com/python/cpython/issues/103365

   (74) https://github.com/python/cpython/issues/103472

   (75) https://github.com/python/cpython/issues/103462

   (76) https://github.com/python/cpython/issues/103449

   (77) https://github.com/python/cpython/issues/103092

   (78) https://peps.python.org/pep-0687/

   (79) https://github.com/python/cpython/issues/103357

   (80) https://github.com/python/cpython/issues/103092

   (81) https://peps.python.org/pep-0687/

   (82) https://github.com/python/cpython/issues/74690

   (83) https://github.com/python/cpython/issues/74690

   (84) https://github.com/python/cpython/issues/103256

   (85) https://github.com/python/cpython/issues/102778

   (86) https://github.com/python/cpython/issues/103285

   (87) https://github.com/python/cpython/issues/103225

   (88) https://github.com/python/cpython/issues/103092

   (89) https://peps.python.org/pep-0687/

   (90) https://github.com/python/cpython/issues/103092

   (91) https://peps.python.org/pep-0687/

   (92) https://github.com/python/cpython/issues/93910

   (93) https://github.com/python/cpython/issues/102978

   (94) https://github.com/python/cpython/issues/103092

   (95) https://peps.python.org/pep-0687/

   (96) https://github.com/python/cpython/issues/100479

   (97) https://github.com/python/cpython/issues/103220

   (98) https://github.com/python/cpython/issues/103204

   (99) https://github.com/python/cpython/issues/75586

   (100) https://github.com/python/cpython/issues/103193

   (101) https://github.com/python/cpython/issues/103176

   (102) https://github.com/python/cpython/issues/103143

   (103) https://github.com/python/cpython/issues/103015

   (104) https://github.com/python/cpython/issues/103000

   (105) https://github.com/python/cpython/issues/102953

   (106) https://github.com/python/cpython/issues/97696

   (107) https://github.com/python/cpython/issues/81079

   (108) https://github.com/python/cpython/issues/101819

   (109) https://peps.python.org/pep-0687/

   (110) https://github.com/python/cpython/issues/91896

   (111) https://github.com/python/cpython/issues/101362

   (112) https://github.com/python/cpython/issues/102114

   (113) https://github.com/python/cpython/issues/62432

   (114) https://github.com/python/cpython/issues/78079

   (115) https://github.com/python/cpython/issues/85984

   (116) https://github.com/python/cpython/issues/101688

   (117) https://github.com/python/cpython/issues/101640

   (118) https://github.com/python/cpython/issues/83861

   (119) https://github.com/python/cpython/issues/89550

   (120) https://github.com/python/cpython/issues/95299

   (121) https://github.com/python/cpython/issues/99353

   (122) https://github.com/python/cpython/issues/98040

   (123) https://github.com/python/cpython/issues/97850

   (124) https://github.com/python/cpython/issues/94473

   (125) https://github.com/python/cpython/issues/98040

   (126) https://github.com/python/cpython/issues/96522

   (127) https://github.com/python/cpython/issues/96534

   (128) https://github.com/python/cpython/issues/87474

   (129) https://github.com/python/cpython/issues/94906

   (130) https://github.com/python/cpython/issues/51574

   (131) https://github.com/python/cpython/issues/94518

   (132) https://github.com/python/cpython/issues/92184

   (133) https://bugs.python.org/issue?@action=redirect&bpo=46797

   (134) https://bugs.python.org/issue?@action=redirect&bpo=44844

   (135) https://bugs.python.org/issue?@action=redirect&bpo=45606

   (136) https://bugs.python.org/issue?@action=redirect&bpo=23041

   (137) https://bugs.python.org/issue?@action=redirect&bpo=24964

   (138) https://bugs.python.org/issue?@action=redirect&bpo=17258

   (139) https://bugs.python.org/issue?@action=redirect&bpo=39744

   (140) https://bugs.python.org/issue?@action=redirect&bpo=22708


File: python.info,  Node: ドキュメント<21>,  Next: テスト<25>,  Prev: ライブラリ<72>,  Up: Python 3 12 0 beta 1

1.26.26.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: テスト<25>,  Next: ビルド<24>,  Prev: ドキュメント<21>,  Up: Python 3 12 0 beta 1

1.26.26.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: 13d.
     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*: 58d. 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: ビルド<24>,  Next: Windows<22>,  Prev: テスト<25>,  Up: Python 3 12 0 beta 1

1.26.26.9 ビルド
................

   - gh-101282(1): BOLT optimization is now applied to the libpython
     shared library if building a shared library.  BOLT instrumentation
     and application settings can now be influenced via the
     ‘BOLT_INSTRUMENT_FLAGS’ and ‘BOLT_APPLY_FLAGS’ configure variables.

   - gh-99017(2): ‘PYTHON_FOR_REGEN’ now require Python 3.10 or newer.

   - gh-104490(3): Define ‘.PHONY’ / virtual make targets consistently
     and properly.

   - gh-104106(4): Add gcc fallback of mkfifoat/mknodat for macOS. Patch
     by Donghee Na.

   - gh-103532(5): The ‘TKINTER_PROTECT_LOADTK’ macro is no longer
     defined or used in the ‘_tkinter’ module.  It was previously only
     defined when building against Tk 8.4.13 and older, but Tk older
     than 8.5.12 has been unsupported since gh-91152(6).

   - gh-99069(7): Extended workaround defining ‘static_assert’ when
     missing from the libc headers to all clang and gcc builds.  In
     particular, this fixes building on macOS <= 10.10.

   - gh-100220(8): Changed the default value of the ‘SHELL’ Makefile
     variable from ‘/bin/sh’ to ‘/bin/sh -e’ to ensure that complex
     recipes correctly fail after an error.  Previously, ‘make install’
     could fail to install some files and yet return a successful
     result.

   - gh-90656(9): Add platform triplets for 64-bit LoongArch:

        * loongarch64-linux-gnusf

        * loongarch64-linux-gnuf32

        * loongarch64-linux-gnu

     Patch by Zhang Na.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101282

   (2) https://github.com/python/cpython/issues/99017

   (3) https://github.com/python/cpython/issues/104490

   (4) https://github.com/python/cpython/issues/104106

   (5) https://github.com/python/cpython/issues/103532

   (6) https://github.com/python/cpython/issues/91152

   (7) https://github.com/python/cpython/issues/99069

   (8) https://github.com/python/cpython/issues/100220

   (9) https://github.com/python/cpython/issues/90656


File: python.info,  Node: Windows<22>,  Next: macOS<16>,  Prev: ビルド<24>,  Up: Python 3 12 0 beta 1

1.26.26.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(): 14ef. 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: 29c. 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<16>,  Next: IDLE<15>,  Prev: Windows<22>,  Up: Python 3 12 0 beta 1

1.26.26.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<18>,  Prev: macOS<16>,  Up: Python 3 12 0 beta 1

1.26.26.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<18>,  Next: C API<25>,  Prev: IDLE<15>,  Up: Python 3 12 0 beta 1

1.26.26.13 Tools/Demos
......................

   - gh-104389(1): Argument Clinic C converters now accept the ‘unused’
     keyword, for wrapping a parameter with *note Py_UNUSED: 1caf.
     Patch by Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104389


File: python.info,  Node: C API<25>,  Prev: Tools/Demos<18>,  Up: Python 3 12 0 beta 1

1.26.26.14 C API
................

   - gh-101291(1): Added unstable C API for extracting the value of
     "compact" integers: *note PyUnstable_Long_IsCompact(): 98d. and
     *note PyUnstable_Long_CompactValue(): 98e.

   - 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(): 396. and its variants now
     allow creating classes whose metaclass overrides *note tp_new: 986.
     The ‘tp_new’ is ignored.  This behavior is deprecated and will be
     disallowed in 3.14+.  The new *note PyType_FromMetaclass(): 399.
     already disallows it.

   - gh-103743(4): Add *note PyUnstable_Object_GC_NewWithExtraData():
     1cca. 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():
     1ccb, *note PyUnstable_PerfMapState_Init(): 1ccc. and *note
     PyUnstable_PerfMapState_Fini(): 1ccd.  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 perf map
     compatible profilers: 1cce. 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: 1a4. can now be zero
     or negative, *note PyObject_GetTypeData(): 1a5. can be used to get
     subclass-specific data, and *note Py_TPFLAGS_ITEMS_AT_END: 95b. 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: 1ccf. 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(): 824. and *note PyUnicode_FromFormatV():
     97e.

   - 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.26.27 Python 3.12.0 alpha 7
-----------------------------

'Release date: 2023-04-04'

* Menu:

* Core and Builtins: Core and Builtins<69>.
* ライブラリ: ライブラリ<73>.
* Core and Builtins: Core and Builtins<70>.
* ビルド: ビルド<25>.
* Core and Builtins: Core and Builtins<71>.
* ライブラリ: ライブラリ<74>.
* ドキュメント: ドキュメント<22>.
* テスト: テスト<26>.
* ビルド: ビルド<26>.
* Windows: Windows<23>.
* Tools/Demos: Tools/Demos<19>.
* C API: C API<26>.


File: python.info,  Node: Core and Builtins<69>,  Next: ライブラリ<73>,  Up: Python 3 12 0 alpha 7

1.26.27.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: aeb. 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: 8d3. and deprecate *note
     sys.last_type: 8d4, *note sys.last_value: 8d5. and *note
     sys.last_traceback: 8d6, which hold the same information in its
     legacy form.

   - gh-100982(6): Replace all occurrences of ‘COMPARE_AND_BRANCH’ with
     *note COMPARE_OP: d36.

   - gh-102701(7): Fix overflow when creating very large dict.

   - gh-102755(8): Add *note PyErr_DisplayException(): 64f. 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: aeb. entries
     used by *note LOAD_GLOBAL: 1c7f.

   ---------- 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: ライブラリ<73>,  Next: Core and Builtins<70>,  Prev: Core and Builtins<69>,  Up: Python 3 12 0 alpha 7

1.26.27.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<70>,  Next: ビルド<25>,  Prev: ライブラリ<73>,  Up: Python 3 12 0 alpha 7

1.26.27.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: ビルド<25>,  Next: Core and Builtins<71>,  Prev: Core and Builtins<70>,  Up: Python 3 12 0 alpha 7

1.26.27.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<71>,  Next: ライブラリ<74>,  Prev: ビルド<25>,  Up: Python 3 12 0 alpha 7

1.26.27.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: ライブラリ<74>,  Next: ドキュメント<22>,  Prev: Core and Builtins<71>,  Up: Python 3 12 0 alpha 7

1.26.27.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(): a4a. will not
     warn deprecation.

   - gh-103068(4): It's no longer possible to register conditional
     breakpoints in *note Pdb: 502. that raise *note SyntaxError: 189.
     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:
     3b. when ‘show_caches’ is False and ‘lasti’ points to a CACHE
     entry.

   - gh-102433(8): *note isinstance(): 2fb. checks against *note
     runtime-checkable protocols: 867. now use *note
     inspect.getattr_static(): 8aa. rather than *note hasattr(): 8e7. to
     lookup whether attributes exist.  This means that descriptors and
     *note __getattr__(): 8e8. 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: 502. that raise *note SyntaxError: 189.
     Patch by Tian Gao.

   - gh-102947(10): Improve traceback when *note dataclasses.fields():
     1b6e. is called on a non-dataclass.  Patch by Alex Waygood

   - gh-102780(11): The *note asyncio.Timeout: 1c66. context manager now
     works reliably even when performing cleanup due to task
     cancellation.  Previously it could raise a *note CancelledError:
     6e0. instead of an *note TimeoutError: 1cd7. in such cases.

   - gh-102871(12): Remove support for obsolete browsers from *note
     webbrowser: 11e.  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(): 1878.
     arguments handling by removing the argument clinic.

   - gh-102828(14): Add the ‘onexc’ arg to *note shutil.rmtree(): 33d,
     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: 2a0.  Previously, if the
     ‘ParamSpec’ was substituted with a parameters list that itself
     contained a *note TypeVar: 29f, 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: 8bb. and *note Path: 4f5. subclasses
     were not called in some circumstances.

   - gh-78530(17): *note asyncio.wait(): 896. now accepts generators
     yielding tasks.  Patch by Kumar Aditya.

   - gh-102748(18): *note asyncio.iscoroutine(): 895. 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: 2a0.  (Use square brackets
     to represent a parameter list.)

   - gh-100112(21): *note asyncio.Task.get_coro(): da4. 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(): 8b3, *note
     os.listvolumes(): 8b4. and *note os.listmounts(): 8b5. functions on
     Windows for enumerating drives, volumes and mount points

   - gh-74468(24): Attribute name of the extracted *note tarfile: e7.
     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(): 8a8. and *note
     inspect.getasyncgenlocals(): 8a9.  Patch by Thomas Krennwallner.

   - gh-102103(27): Add ‘module’ argument to *note
     dataclasses.make_dataclass(): 190d. 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: cf. 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: 32.

   - 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(): 129f.
     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: 15ef.

   - gh-48330(36): Added ‘--durations’ command line option, showing the
     N slowest test cases.  *note unittest.TextTestRunner: 1cd8. and
     *note unittest.TextTestResult: 944. constructors accept a new
     'durations' keyword argument.  Subclasses should take this into
     account or accept ‘**kwargs’.  Added *note
     unittest.TestResult.addDuration(): 1cd9. method and *note
     unittest.TestResult.collectedDurations: 1ca1. attribute.

     (Contributed by Giampaolo Rodola)

   - gh-98169(37): Fix *note dataclasses.astuple(): 192f. crash when
     *note collections.defaultdict: 157a. is present in the attributes.

   - gh-96931(38): Fix incorrect results from *note
     ssl.SSLSocket.shared_ciphers(): 1220.

   - gh-95495(39): When built against OpenSSL 3.0, the *note ssl: d8.
     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: 1924, matching the behavior in previous versions of
     OpenSSL. The *note options: c15. attribute on *note SSLContext:
     33e. also no longer includes *note OP_IGNORE_UNEXPECTED_EOF: c14.
     by default.  This option may be set to specify the previous OpenSSL
     3.0 behavior.

   - gh-94684(40): Now *note uuid.uuid3(): 568. and *note uuid.uuid5():
     569. functions support *note bytes: 1d2. 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(): 576.

   - bpo-36305(43): Fix handling of Windows filenames that resemble
     drives, such as ‘./a:b’, in *note pathlib: a8.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0687/

   (3) https://github.com/python/cpython/issues/103085

   (4) https://github.com/python/cpython/issues/103068

   (5) https://github.com/python/cpython/issues/102549

   (6) https://github.com/python/cpython/issues/103056

   (7) https://github.com/python/cpython/issues/103046

   (8) https://github.com/python/cpython/issues/102433

   (9) https://github.com/python/cpython/issues/103023

   (10) https://github.com/python/cpython/issues/102947

   (11) https://github.com/python/cpython/issues/102780

   (12) https://github.com/python/cpython/issues/102871

   (13) https://github.com/python/cpython/issues/102839

   (14) https://github.com/python/cpython/issues/102828

   (15) https://github.com/python/cpython/issues/88965

   (16) https://github.com/python/cpython/issues/76846

   (17) https://github.com/python/cpython/issues/78530

   (18) https://github.com/python/cpython/issues/102748

   (19) https://github.com/python/cpython/issues/102670

   (20) https://github.com/python/cpython/issues/102615

   (21) https://github.com/python/cpython/issues/100112

   (22) https://github.com/python/cpython/issues/102578

   (23) https://github.com/python/cpython/issues/102519

   (24) https://github.com/python/cpython/issues/74468

   (25) https://github.com/python/cpython/issues/102378

   (26) https://github.com/python/cpython/issues/79940

   (27) https://github.com/python/cpython/issues/102103

   (28) https://github.com/python/cpython/issues/102069

   (29) https://github.com/python/cpython/issues/102038

   (30) https://github.com/python/cpython/issues/98886

   (31) https://github.com/python/cpython/issues/101673

   (32) https://github.com/python/cpython/issues/101313

   (33) https://github.com/python/cpython/issues/100372

   (34) https://github.com/python/cpython/issues/89727

   (35) https://github.com/python/cpython/issues/100131

   (36) https://github.com/python/cpython/issues/48330

   (37) https://github.com/python/cpython/issues/98169

   (38) https://github.com/python/cpython/issues/96931

   (39) https://github.com/python/cpython/issues/95495

   (40) https://github.com/python/cpython/issues/94684

   (41) https://github.com/python/cpython/issues/94440

   (42) https://github.com/python/cpython/issues/72346

   (43) https://bugs.python.org/issue?@action=redirect&bpo=36305


File: python.info,  Node: ドキュメント<22>,  Next: テスト<26>,  Prev: ライブラリ<74>,  Up: Python 3 12 0 alpha 7

1.26.27.7 ドキュメント
......................

   - gh-103112(1): Add docstring to *note
     http.client.HTTPResponse.read(): 1aef. to fix ‘pydoc’ output.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103112


File: python.info,  Node: テスト<26>,  Next: ビルド<26>,  Prev: ドキュメント<22>,  Up: Python 3 12 0 alpha 7

1.26.27.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: ビルド<26>,  Next: Windows<23>,  Prev: テスト<26>,  Up: Python 3 12 0 alpha 7

1.26.27.9 ビルド
................

   - gh-102973(1): Add a dev container (along with accompanying
     Dockerfile) for development purposes.

   - gh-102711(2): Fix ‘-Wstrict-prototypes’ compiler warnings.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102973

   (2) https://github.com/python/cpython/issues/102711


File: python.info,  Node: Windows<23>,  Next: Tools/Demos<19>,  Prev: ビルド<26>,  Up: Python 3 12 0 alpha 7

1.26.27.10 Windows
..................

   - gh-102690(1): Update *note webbrowser: 11e. 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<19>,  Next: C API<26>,  Prev: Windows<23>,  Up: Python 3 12 0 alpha 7

1.26.27.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<26>,  Prev: Tools/Demos<19>,  Up: Python 3 12 0 alpha 7

1.26.27.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.26.28 Python 3.12.0 alpha 6
-----------------------------

'Release date: 2023-03-07'

* Menu:

* セキュリティ: セキュリティ<22>.
* Core and Builtins: Core and Builtins<72>.
* ライブラリ: ライブラリ<75>.
* ドキュメント: ドキュメント<23>.
* テスト: テスト<27>.
* ビルド: ビルド<27>.
* Windows: Windows<24>.
* macOS: macOS<17>.
* C API: C API<27>.


File: python.info,  Node: セキュリティ<22>,  Next: Core and Builtins<72>,  Up: Python 3 12 0 alpha 6

1.26.28.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: 6b. 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: 6c5. 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<72>,  Next: ライブラリ<75>,  Prev: セキュリティ<22>,  Up: Python 3 12 0 alpha 6

1.26.28.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: 1ce3.
     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: 1946. no longer raises
     *note OverflowError: c5b. for *note int: 32e. '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: 1ce4. ‘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: 8f6. 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: 108. 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: ライブラリ<75>,  Next: ドキュメント<23>,  Prev: Core and Builtins<72>,  Up: Python 3 12 0 alpha 6

1.26.28.3 ライブラリ
....................

   - gh-102302(1): Micro-optimise hashing of *note inspect.Parameter:
     6ef, 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(): 3f4. were dropped.
     Patch by Yeojin Kim.

   - gh-91038(3): *note platform.platform(): 1ce6. now has boolean
     default arguments.

   - gh-81652(4): Add *note mmap.MAP_ALIGNED_SUPER: 1ce7. FreeBSD and
     *note mmap.MAP_CONCEAL: 1ce8. OpenBSD constants to *note mmap: 94.
     Patch by Yeojin Kim.

   - gh-102179(5): Fix *note os.dup2(): f24. 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:
     1258. if *note HTTPError: 138c. 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: 6b.
     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: 3f1. when the callable object exhausts the iterator
     but forgets to either return a sentinel value or raise *note
     StopIteration: fbe.

   - gh-87634(15): Remove locking behavior from *note
     functools.cached_property(): 953.

   - 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: 88. with a ‘lineno=None’, which causes
     it to fail with an unhandled exception.

   - gh-101773(18): Optimize *note fractions.Fraction: 1ce. for small
     components.  The private argument ‘_normalize’ of the
     ‘fractions.Fraction’ constructor has been removed.

   - gh-101693(19): In *note sqlite3.Cursor.execute(): 7ae, *note
     DeprecationWarning: 2d4. is now emitted when *note named
     placeholders: 7b0. are used together with parameters supplied as a
     *note sequence: 904. instead of as a *note dict: 193.  Starting
     from Python 3.14, using named placeholders with parameters supplied
     as a sequence will raise a *note ProgrammingError: 584.  Patch by
     Erlend E. Aasland.

   - gh-101446(20): Change repr of *note collections.OrderedDict: 9da.
     to use regular dictionary formatting instead of pairs of keys and
     values.

   - gh-101362(21): Speed up *note pathlib.PurePath: 8bb. construction
     by handling arguments more uniformly.  When a *note pathlib.Path:
     4f5. argument is supplied, we use its string representation rather
     than joining its parts with *note os.path.join(): 1a62.

   - gh-101362(22): Speed up *note pathlib.PurePath: 8bb. construction
     by calling *note os.path.join(): 1a62. only when two or more
     arguments are given.

   - gh-101362(23): Speed up *note pathlib.Path: 4f5. construction by
     running the path flavour compatibility check only when pathlib is
     imported.

   - gh-85984(24): Refactored the implementation of *note pty.fork():
     1ce9. to use *note os.login_tty(): 1cea.

     A *note DeprecationWarning: 2d4. 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(): 580.

   - gh-101561(25): Add a new decorator *note typing.override(): 86f.
     See PEP 698(26) for details.  Patch by Steven Troxler.

   - gh-63301(27): Set exit code when *note tabnanny: e6. CLI exits on
     error.

   - gh-101360(28): Fix anchor matching in
     ‘pathlib.PureWindowsPath.match()’.  Path and pattern anchors are
     now matched with *note fnmatch: 5f, just like other path parts.
     This allows patterns such as ‘"*:/Users/*"’ to be matched.

   - gh-101277(29): Remove global state from *note itertools: 84. 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(): 1c4d.  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: 13d.  Patch by
     Erlend E. Aasland.

   - gh-96764(34): *note asyncio.wait_for(): 9fb. now uses *note
     asyncio.timeout(): 9fa. 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: 191b. and *note bz2.BZ2Decompressor: 191c.
     objects without calling ‘__init__()’, and fix leakage of locks and
     internal buffers when calling the ‘__init__()’ methods of
     ‘lzma.LZMADecompressor’, *note lzma.LZMACompressor: 1ceb, *note
     bz2.BZ2Compressor: 1cec, 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: ドキュメント<23>,  Next: テスト<27>,  Prev: ライブラリ<75>,  Up: Python 3 12 0 alpha 6

1.26.28.4 ドキュメント
......................

   - gh-85417(1): Update *note cmath: 19. documentation to clarify
     behaviour on branch cuts.

   - gh-97725(2): Fix *note asyncio.Task.print_stack(): 1cee.
     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: テスト<27>,  Next: ビルド<27>,  Prev: ドキュメント<23>,  Up: Python 3 12 0 alpha 6

1.26.28.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: ビルド<27>,  Next: Windows<24>,  Prev: テスト<27>,  Up: Python 3 12 0 alpha 6

1.26.28.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: 1cf1.  Patch by Matthias Görgens and
     Shantanu Jain.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99942

   (2) https://github.com/python/cpython/issues/99942

   (3) https://github.com/python/cpython/issues/100221

   (4) https://github.com/python/cpython/issues/96821


File: python.info,  Node: Windows<24>,  Next: macOS<17>,  Prev: ビルド<27>,  Up: Python 3 12 0 alpha 6

1.26.28.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<17>,  Next: C API<27>,  Prev: Windows<24>,  Up: Python 3 12 0 alpha 6

1.26.28.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<27>,  Prev: macOS<17>,  Up: Python 3 12 0 alpha 6

1.26.28.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(): 643. and *note
     PyErr_SetRaisedException(): 646. 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(): 642. and *note PyErr_Restore():
     645.  This is less error prone and a bit more efficient.

     Add *note PyException_GetArgs(): 975. and *note
     PyException_SetArgs(): 976. as convenience functions for retrieving
     and modifying the *note args: 977. 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.26.29 Python 3.12.0 alpha 5
-----------------------------

'Release date: 2023-02-07'

* Menu:

* セキュリティ: セキュリティ<23>.
* Core and Builtins: Core and Builtins<73>.
* ライブラリ: ライブラリ<76>.
* ドキュメント: ドキュメント<24>.
* テスト: テスト<28>.
* ビルド: ビルド<28>.
* Windows: Windows<25>.


File: python.info,  Node: セキュリティ<23>,  Next: Core and Builtins<73>,  Up: Python 3 12 0 alpha 5

1.26.29.1 セキュリティ
......................

   - gh-99108(1): Replace the builtin *note hashlib: 6b. 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<73>,  Next: ライブラリ<76>,  Prev: セキュリティ<23>,  Up: Python 3 12 0 alpha 5

1.26.29.2 Core and Builtins
...........................

   - gh-92173(1): Fix the ‘defs’ and ‘kwdefs’ arguments to *note
     PyEval_EvalCodeEx(): 1cf8. 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: 430. or *note break: 42f. which are not in a loop.  Patch
     by Donghee Na.

   - gh-101372(4): Fix *note is_normalized(): e0f. to properly handle
     the UCD 3.2.0 cases.  Patch by Donghee Na.

   - gh-101266(5): Fix *note sys.getsizeof(): 1cf9. reporting for *note
     int: 32e. 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: 191d.  Patch by Pablo Galindo

   - gh-101037(8): Fix potential memory underallocation issue for
     instances of *note int: 32e. subclasses with value zero.

   - gh-100762(9): Record the (virtual) exception block depth in the
     oparg of *note YIELD_VALUE: 7b9.  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: d36. instruction and embed the mask into the oparg.

   - gh-100892(13): Fix race while iterating over thread states in
     clearing *note threading.local: 1aa6.  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: 7e5. 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: ライブラリ<76>,  Next: ドキュメント<24>,  Prev: Core and Builtins<73>,  Up: Python 3 12 0 alpha 5

1.26.29.3 ライブラリ
....................

   - bpo-32780(1): Inter-field padding is now inserted into the PEP3118
     format strings obtained from *note ctypes.Structure: 483. 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(): 9ff.

   - 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: d4. 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: 1cfb.
     in ‘asyncio.base_events.BaseEventLoop._add_callback’.

   - gh-101144(11): Make *note zipfile.Path.open(): 1a33. and *note
     zipfile.Path.read_text(): 1cfc. 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: 29c.

   - 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(): aa3. on
     ‘'*tuple[...]'’ and ‘*tuple[...]’.  It must not drop the ‘Unpack’
     part.

   - gh-101000(14): Add *note os.path.splitroot(): 8b9, 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(): 18d1. 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: 483. with ‘from_param()’ results larger than a C
     pointer.

   - gh-67790(21): Add float-style formatting support for *note
     fractions.Fraction: 1ce. instances.

   - gh-99266(22): Preserve more detailed error messages in *note
     ctypes: 2d.

   - gh-86682(23): Ensure runtime-created collections have the correct
     module name using the newly added (internal) *note
     sys._getframemodulename(): 1cfd.

   - gh-88597(24): *note uuid: 119. now has a command line interface.
     Try ‘python -m uuid -h’.

   - gh-60580(25): ‘ctypes.wintypes.BYTE’ definition changed from *note
     c_byte: 1cfe. to *note c_ubyte: 1cff. 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: 12e. module now
     emits *note DeprecationWarning: 2d4. when testing the truth value
     of an *note xml.etree.ElementTree.Element: 34b.  Before, the Python
     implementation emitted *note FutureWarning: 84d, 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: 4f5. accepted
     and ignored keyword arguments.  Patch provided by Yurii Karabas.

   - gh-77772(30): *note ctypes.CDLL: db1, *note ctypes.OleDLL: 1d00,
     *note ctypes.WinDLL: 1d01, and *note ctypes.PyDLL: 1d02. now accept
     *note path-like objects: 7a5. as their ‘name’ argument.  Patch by
     Robert Hoelzl.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32780

   (2) https://github.com/python/cpython/issues/101541

   (3) https://github.com/python/cpython/issues/101570

   (4) https://github.com/python/cpython/issues/101323

   (5) https://github.com/python/cpython/issues/101317

   (6) https://github.com/python/cpython/issues/101326

   (7) https://github.com/python/cpython/issues/92123

   (8) https://peps.python.org/pep-0489/

   (9) https://github.com/python/cpython/issues/100795

   (10) https://github.com/python/cpython/issues/101143

   (11) https://github.com/python/cpython/issues/101144

   (12) https://github.com/python/cpython/issues/94518

   (13) https://github.com/python/cpython/issues/101015

   (14) https://github.com/python/cpython/issues/101000

   (15) https://github.com/python/cpython/issues/100573

   (16) https://github.com/python/cpython/issues/39615

   (17) https://github.com/python/cpython/issues/100750

   (18) https://github.com/python/cpython/issues/100160

   (19) https://github.com/python/cpython/issues/96290

   (20) https://github.com/python/cpython/issues/99952

   (21) https://github.com/python/cpython/issues/67790

   (22) https://github.com/python/cpython/issues/99266

   (23) https://github.com/python/cpython/issues/86682

   (24) https://github.com/python/cpython/issues/88597

   (25) https://github.com/python/cpython/issues/60580

   (26) https://github.com/python/cpython/issues/94518

   (27) https://bugs.python.org/issue?@action=redirect&bpo=38941

   (28) https://bugs.python.org/issue?@action=redirect&bpo=40077

   (29) https://bugs.python.org/issue?@action=redirect&bpo=29847

   (30) https://github.com/python/cpython/issues/77772


File: python.info,  Node: ドキュメント<24>,  Next: テスト<28>,  Prev: ライブラリ<76>,  Up: Python 3 12 0 alpha 5

1.26.29.4 ドキュメント
......................

   - gh-88324(1): Reword *note subprocess: df. 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: テスト<28>,  Next: ビルド<28>,  Prev: ドキュメント<24>,  Up: Python 3 12 0 alpha 5

1.26.29.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: ビルド<28>,  Next: Windows<25>,  Prev: テスト<28>,  Up: Python 3 12 0 alpha 5

1.26.29.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: 844. is deprecated for extension
     modules.  Accessing this field will generate a compiler warning at
     compile time.  This field will be removed in Python 3.14.

   - gh-100340(6): Allows -Wno-int-conversion for wasm-sdk 17 and
     onwards, thus enables building WASI builds once against the latest
     sdk.

   - gh-101060(7): Conditionally add ‘-fno-reorder-blocks-and-partition’
     in configure.  Effectively fixes ‘--enable-bolt’ when using Clang,
     as this appears to be a GCC-only flag.

   - gh-98705(8): ‘__bool__’ is defined in AIX system header files which
     breaks the build in AIX, so undefine it.

   - gh-98636(9): Fix a regression in detecting ‘gdbm_compat’ library
     for the ‘_gdbm’ module build.

   - gh-96305(10): ‘_aix_support’ now uses a simple code to get platform
     details rather than the now non-existent ‘_bootsubprocess’ during
     bootstrap.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101282

   (2) https://github.com/python/cpython/issues/101522

   (3) https://github.com/python/cpython/issues/77532

   (4) https://github.com/python/cpython/issues/101152

   (5) https://peps.python.org/pep-0699/

   (6) https://github.com/python/cpython/issues/100340

   (7) https://github.com/python/cpython/issues/101060

   (8) https://github.com/python/cpython/issues/98705

   (9) https://github.com/python/cpython/issues/98636

   (10) https://github.com/python/cpython/issues/96305


File: python.info,  Node: Windows<25>,  Prev: ビルド<28>,  Up: Python 3 12 0 alpha 5

1.26.29.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.26.30 Python 3.12.0 alpha 4
-----------------------------

'Release date: 2023-01-10'

* Menu:

* Core and Builtins: Core and Builtins<74>.
* ライブラリ: ライブラリ<77>.
* Core and Builtins: Core and Builtins<75>.
* ライブラリ: ライブラリ<78>.
* Core and Builtins: Core and Builtins<76>.
* ライブラリ: ライブラリ<79>.
* ドキュメント: ドキュメント<25>.
* テスト: テスト<29>.
* ビルド: ビルド<29>.
* Windows: Windows<26>.
* macOS: macOS<18>.
* Tools/Demos: Tools/Demos<20>.
* C API: C API<28>.


File: python.info,  Node: Core and Builtins<74>,  Next: ライブラリ<77>,  Up: Python 3 12 0 alpha 4

1.26.30.1 Core and Builtins
...........................

   - gh-100776(1): Fix misleading default value in *note input():
     1692.'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: 8f5. 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: 189. 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(): 1d09. to improve duck
     type compatibility between *note int: 32e. and *note float: 32f.

   - 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: ライブラリ<77>,  Next: Core and Builtins<75>,  Prev: Core and Builtins<74>,  Up: Python 3 12 0 alpha 4

1.26.30.2 ライブラリ
....................

   - gh-100374(1): Fix incorrect result and delay in *note
     socket.getfqdn(): 1d0b.  Patch by Dominic Socular.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100374


File: python.info,  Node: Core and Builtins<75>,  Next: ライブラリ<78>,  Prev: ライブラリ<77>,  Up: Python 3 12 0 alpha 4

1.26.30.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():
     335. by emitting only one entry for each line range.

   - gh-90043(3): Handle NaNs when specializing *note COMPARE_OP: d36.
     for *note float: 32f. 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(): 1d0d.

   - 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(): 8e7. for
     type objects with a missing attribute.

   - gh-99582(15): Freeze *note zipimport: 13b. 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: ライブラリ<78>,  Next: Core and Builtins<76>,  Prev: Core and Builtins<75>,  Up: Python 3 12 0 alpha 4

1.26.30.4 ライブラリ
....................

   - gh-89051(1): Add *note ssl.OP_LEGACY_SERVER_CONNECT: 1d0f.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89051


File: python.info,  Node: Core and Builtins<76>,  Next: ライブラリ<79>,  Prev: ライブラリ<78>,  Up: Python 3 12 0 alpha 4

1.26.30.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: ライブラリ<79>,  Next: ドキュメント<25>,  Prev: Core and Builtins<76>,  Up: Python 3 12 0 alpha 4

1.26.30.6 ライブラリ
....................

   - gh-100833(1): Speed up *note math.fsum(): 178d. by removing
     defensive ‘volatile’ qualifiers.

   - gh-100805(2): Modify *note random.choice(): 15eb. 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__():
     1d12. twice as fast.

   - gh-91851(5): Microoptimizations for *note
     fractions.Fraction.__round__(): 1d13, *note
     fractions.Fraction.__ceil__(): 1d14. and *note
     fractions.Fraction.__floor__(): 1d15.

   - 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(): 8be. by using
     *note isinstance(): 2fb. 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(): ee0. 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(): 1c4d. by nearly 2x.  This comes at the
     cost of a performance regression in *note pathlib.Path.cwd(): 1cbe,
     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():
     f64. with *note unittest.mock.AsyncMock: e11.

   - gh-100488(19): Add ‘Fraction.is_integer()’ to check whether a *note
     fractions.Fraction: 1ce. is an integer.  This improves duck type
     compatibility with *note float: 32f. and *note int: 32e.

   - gh-100474(20): *note http.server: 75. 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(): ed3. 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(): 894. 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: 2d4. may be raised when
     *note os.fork(): 6c3. or *note os.forkpty(): 6c4. 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: 15bd.

   - 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(): 1d16. to
     'format'.  Rename the 't' parameter of *note
     datetime.datetime.fromtimestamp(): 900. 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: 138c. 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(): 8be. where a *note
     RecursionError: 1125. would occur on deep directory structures by
     adjusting the implementation of ‘os.walk()’ to be iterative instead
     of recursive.

   - gh-94943(37): Add *note データクラスのサポート: 1d17. to the *note
     Enum: a26. *note __repr__(): 1d18.  When inheriting from a *note
     dataclass: 6ec, only show the field names in the value section of
     the member *note repr(): 462, and not the dataclass' class name.

   - gh-83035(38): Fix *note inspect.getsource(): 1a24. 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(): 8a6.
     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: 3d. failure on *note
     types.MethodWrapperType: a3f. in modules.

   - gh-85267(45): Several improvements to *note inspect.signature():
     4c4.'s handling of ‘__text_signature’.  - Fixes a case where
     ‘inspect.signature()’ dropped parameters - Fixes a case where
     ‘inspect.signature()’ raised *note tokenize.TokenError: 954. -
     Allows ‘inspect.signature()’ to understand defaults involving
     binary operations of constants - ‘inspect.signature()’ is
     documented as only raising *note TypeError: 29c. or *note
     ValueError: 15a, but sometimes raised *note RuntimeError: 317.
     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(): 891. 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(): 1d19. and *note
     urllib.parse.unquote_to_bytes(): 1d1a. 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():
     21a, which caused it to propagate exceptions with incorrect
     tracebacks and fix a 3.11 regression in *note contextmanager():
     219, which caused it to propagate exceptions with incorrect
     tracebacks for *note StopIteration: fbe.

   - gh-78707(51): Deprecate passing more than one positional argument
     to *note pathlib.PurePath.relative_to(): 57c. and *note
     is_relative_to(): 57d.

   - gh-92122(52): Fix reStructuredText syntax errors in docstrings in
     the *note enum: 59. module.

   - gh-91851(53): Optimize the *note Fraction: 1ce. arithmetics for
     small components.

   - bpo-24132(54): Make *note pathlib.PurePath: 8bb. and *note Path:
     4f5. subclassable (private to start).  Previously, attempting to
     instantiate a subclass resulted in an *note AttributeError: 1b4.
     being raised.  Patch by Barney Gale.

   - bpo-40447(55): Accept *note os.PathLike: 1013. (such as *note
     pathlib.Path: 4f5.) in the ‘stripdir’ arguments of *note
     compileall.compile_file(): 119d. and *note
     compileall.compile_dir(): eec.

   - bpo-36880(56): Fix a reference counting issue when a *note ctypes:
     2d. callback with return type *note py_object: 48d. returns ‘None’,
     which could cause crashes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100833

   (2) https://github.com/python/cpython/issues/100805

   (3) https://github.com/python/cpython/issues/100813

   (4) https://github.com/python/cpython/issues/100792

   (5) https://github.com/python/cpython/issues/91851

   (6) https://github.com/python/cpython/issues/90104

   (7) https://github.com/python/cpython/issues/100689

   (8) https://github.com/python/cpython/issues/100740

   (9) https://github.com/python/cpython/issues/91219

   (10) https://github.com/python/cpython/issues/100690

   (11) https://github.com/python/cpython/issues/89727

   (12) https://github.com/python/cpython/issues/100485

   (13) https://github.com/python/cpython/issues/86508

   (14) https://github.com/python/cpython/issues/97930

   (15) https://github.com/python/cpython/issues/100585

   (16) https://github.com/python/cpython/issues/100562

   (17) https://github.com/python/cpython/issues/100519

   (18) https://github.com/python/cpython/issues/100287

   (19) https://github.com/python/cpython/issues/100488

   (20) https://github.com/python/cpython/issues/100474

   (21) https://github.com/python/cpython/issues/100363

   (22) https://github.com/python/cpython/issues/78878

   (23) https://github.com/python/cpython/issues/100348

   (24) https://github.com/python/cpython/issues/100344

   (25) https://github.com/python/cpython/issues/100272

   (26) https://github.com/python/cpython/issues/83076

   (27) https://github.com/python/cpython/issues/100234

   (28) https://github.com/python/cpython/issues/100228

   (29) https://github.com/python/cpython/issues/100039

   (30) https://github.com/python/cpython/issues/100133

   (31) https://bugs.python.org/issue?@action=redirect&bpo=44592

   (32) https://github.com/python/cpython/issues/100098

   (33) https://github.com/python/cpython/issues/85432

   (34) https://github.com/python/cpython/issues/98778

   (35) https://github.com/python/cpython/issues/99925

   (36) https://github.com/python/cpython/issues/89727

   (37) https://github.com/python/cpython/issues/94943

   (38) https://github.com/python/cpython/issues/83035

   (39) https://github.com/python/cpython/issues/99576

   (40) https://github.com/python/cpython/issues/94912

   (41) https://github.com/python/cpython/issues/99509

   (42) https://peps.python.org/pep-0585/

   (43) https://github.com/python/cpython/issues/99482

   (44) https://github.com/python/cpython/issues/99433

   (45) https://github.com/python/cpython/issues/85267

   (46) https://github.com/python/cpython/issues/91166

   (47) https://github.com/python/cpython/issues/98030

   (48) https://github.com/python/cpython/issues/88500

   (49) https://github.com/python/cpython/issues/96127

   (50) https://github.com/python/cpython/issues/95882

   (51) https://github.com/python/cpython/issues/78707

   (52) https://github.com/python/cpython/issues/92122

   (53) https://github.com/python/cpython/issues/91851

   (54) https://bugs.python.org/issue?@action=redirect&bpo=24132

   (55) https://bugs.python.org/issue?@action=redirect&bpo=40447

   (56) https://bugs.python.org/issue?@action=redirect&bpo=36880


File: python.info,  Node: ドキュメント<25>,  Next: テスト<29>,  Prev: ライブラリ<79>,  Up: Python 3 12 0 alpha 4

1.26.30.7 ドキュメント
......................

   - gh-100616(1): Document existing ‘attr’ parameter to *note
     curses.window.vline(): 1d1c. function in *note curses: 2e.

   - gh-100472(2): Remove claim in documentation that the ‘stripdir’,
     ‘prependdir’ and ‘limit_sl_dest’ parameters of *note
     compileall.compile_dir(): eec. and *note compileall.compile_file():
     119d. could be *note bytes: 1d2.

   - 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: テスト<29>,  Next: ビルド<29>,  Prev: ドキュメント<25>,  Up: Python 3 12 0 alpha 4

1.26.30.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: ビルド<29>,  Next: Windows<26>,  Prev: テスト<29>,  Up: Python 3 12 0 alpha 4

1.26.30.9 ビルド
................

   - gh-100540(1): Removed the ‘--with-system-ffi’ ‘configure’ option;
     ‘libffi’ must now always be supplied by the system on all
     non-Windows platforms.  The option has had no effect on non-Darwin
     platforms for several releases, and in 3.11 only had the
     non-obvious effect of invoking ‘pkg-config’ to find ‘libffi’ and
     never setting ‘-DUSING_APPLE_OS_LIBFFI’.  Now on Darwin platforms
     ‘configure’ will first check for the OS ‘libffi’ and then fall back
     to the same processing as other platforms if it is not found.

   - gh-88267(2): Avoid exporting Python symbols in linked Windows
     applications when the core is built as static.

   - bpo-41916(3): Allow override of ac_cv_cxx_thread so that cross
     compiled python can set -pthread for CXX.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100540

   (2) https://github.com/python/cpython/issues/88267

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41916


File: python.info,  Node: Windows<26>,  Next: macOS<18>,  Prev: ビルド<29>,  Up: Python 3 12 0 alpha 4

1.26.30.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():
     1d20. receives an immutable *note bytes: 1d2. object (as
     documented), instead of *note bytearray: 1d1.

   - bpo-43984(5): *note winreg.SetValueEx(): 1d21. 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: 543.

   ---------- 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<18>,  Next: Tools/Demos<20>,  Prev: Windows<26>,  Up: Python 3 12 0 alpha 4

1.26.30.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<20>,  Next: C API<28>,  Prev: macOS<18>,  Up: Python 3 12 0 alpha 4

1.26.30.12 Tools/Demos
......................

   - bpo-45256(1): Fix a bug that caused an *note AttributeError: 1b4.
     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<28>,  Prev: Tools/Demos<20>,  Up: Python 3 12 0 alpha 4

1.26.30.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: 981, *note Py_SETREF: 982. and
     *note Py_XSETREF: 983. 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.26.31 Python 3.12.0 alpha 3
-----------------------------

'リリース日: 2022-12-06'

* Menu:

* セキュリティ: セキュリティ<24>.
* Core and Builtins: Core and Builtins<77>.
* ライブラリ: ライブラリ<80>.
* Core and Builtins: Core and Builtins<78>.
* ライブラリ: ライブラリ<81>.
* ドキュメント: ドキュメント<26>.
* テスト: テスト<30>.
* ビルド: ビルド<30>.
* Windows: Windows<27>.
* macOS: macOS<19>.
* Tools/Demos: Tools/Demos<21>.
* C API: C API<29>.


File: python.info,  Node: セキュリティ<24>,  Next: Core and Builtins<77>,  Up: Python 3 12 0 alpha 3

1.26.31.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: 75.
     ‘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: 63. 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<77>,  Next: ライブラリ<80>,  Prev: セキュリティ<24>,  Up: Python 3 12 0 alpha 3

1.26.31.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(): 971. and *note
     PyCode_ClearWatcher(): 972. 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: 6de. subclass
     can wrap a *note BaseException: 9bd.

   ---------- 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: ライブラリ<80>,  Next: Core and Builtins<78>,  Prev: Core and Builtins<77>,  Up: Python 3 12 0 alpha 3

1.26.31.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<78>,  Next: ライブラリ<81>,  Prev: ライブラリ<80>,  Up: Python 3 12 0 alpha 3

1.26.31.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(): b63. called on them
     yet.

   - gh-99127(4): Allow some features of *note syslog: e5. 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: d13. object iterator.  It
     is now smaller, faster iteration of ranges containing large
     numbers.  Smaller pickles, faster unpickling.

   - bpo-31718(8): Raise *note ValueError: 15a. instead of *note
     SystemError: 3f1. when methods of uninitialized *note
     io.IncrementalNewlineDecoder: 1968. objects are called.  Patch by
     Oren Milman.

   - bpo-38031(9): Fix a possible assertion failure in *note io.FileIO:
     16c9. 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: ライブラリ<81>,  Next: ドキュメント<26>,  Prev: Core and Builtins<78>,  Up: Python 3 12 0 alpha 3

1.26.31.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(): 8e9.

   - gh-79033(3): Fix *note asyncio.Server.wait_closed(): 1c65. 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: 536.  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():
     314. to allow specifying a custom event loop factory.  Patch by
     Kumar Aditya.

   - gh-99341(11): Fix *note ast.increment_lineno(): 1d2b. to also cover
     *note ast.TypeIgnore: 1d2c. when changing line numbers.

   - gh-99382(12): Check the number of arguments in substitution in user
     generics containing a *note TypeVarTuple: 29e. and one or more
     *note TypeVar: 29f.

   - gh-99379(13): Fix substitution of *note ParamSpec: 2a0. followed by
     *note TypeVarTuple: 29e. in generic aliases.

   - gh-99344(14): Fix substitution of *note TypeVarTuple: 29e. and
     *note ParamSpec: 2a0. together in user generics.

   - gh-99284(15): Remove ‘_use_broken_old_ctypes_structure_semantics_’
     old untested and undocumented hack from *note ctypes: 2d.

   - gh-99201(16): Fix *note IndexError: 18ed. 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(): 57c. 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(): 573. and many other
     *note asyncio: b. functions like *note asyncio.ensure_future():
     1039, *note asyncio.shield(): e38. or *note asyncio.gather(): 9f9,
     and also the ‘get_event_loop()’ method of
     ‘asyncio.BaseDefaultEventLoopPolicy’ now raise a *note
     RuntimeError: 317. 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: 2d4. is no longer emitted if there is no
     running event loop but the current event loop was set.

   - gh-97966(23): On ‘uname_result’, restored expectation that
     ‘_fields’ and ‘_asdict’ would include all six properties including
     ‘processor’.

   - gh-98248(24): Provide informative error messages in *note
     struct.pack(): 1630. 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: 1bec. properties in the *note
     ipaddress: 83. 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: 1a63. 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(): ee0. 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(): 1056. to
     'format'.

   - bpo-15999(34): All built-in functions now accept arguments of any
     type instead of just ‘bool’ and ‘int’ for boolean parameters.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100001

   (2) https://github.com/python/cpython/issues/99957

   (3) https://github.com/python/cpython/issues/79033

   (4) https://github.com/python/cpython/issues/51524

   (5) https://github.com/python/cpython/issues/99645

   (6) https://github.com/python/cpython/issues/99508

   (7) https://github.com/python/cpython/issues/66285

   (8) https://github.com/python/cpython/issues/97001

   (9) https://github.com/python/cpython/issues/92647

   (10) https://github.com/python/cpython/issues/99388

   (11) https://github.com/python/cpython/issues/99341

   (12) https://github.com/python/cpython/issues/99382

   (13) https://github.com/python/cpython/issues/99379

   (14) https://github.com/python/cpython/issues/99344

   (15) https://github.com/python/cpython/issues/99284

   (16) https://github.com/python/cpython/issues/99201

   (17) https://github.com/python/cpython/issues/99240

   (18) https://github.com/python/cpython/issues/64490

   (19) https://github.com/python/cpython/issues/99029

   (20) https://github.com/python/cpython/issues/98253

   (21) https://github.com/python/cpython/issues/98458

   (22) https://github.com/python/cpython/issues/93453

   (23) https://github.com/python/cpython/issues/97966

   (24) https://github.com/python/cpython/issues/98248

   (25) https://github.com/python/cpython/issues/98108

   (26) https://github.com/python/cpython/issues/98098

   (27) https://github.com/python/cpython/issues/82836

   (28) https://github.com/python/cpython/issues/96828

   (29) https://github.com/python/cpython/issues/88863

   (30) https://github.com/python/cpython/issues/91078

   (31) https://bugs.python.org/issue?@action=redirect&bpo=47220

   (32) https://bugs.python.org/issue?@action=redirect&bpo=44817

   (33) https://bugs.python.org/issue?@action=redirect&bpo=41260

   (34) https://bugs.python.org/issue?@action=redirect&bpo=15999


File: python.info,  Node: ドキュメント<26>,  Next: テスト<30>,  Prev: ライブラリ<81>,  Up: Python 3 12 0 alpha 3

1.26.31.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: 5f6.

   - 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*: 1155. family of functions, and improved the docs for
     *note os.waitid(): 1156. 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: テスト<30>,  Next: ビルド<30>,  Prev: ドキュメント<26>,  Up: Python 3 12 0 alpha 3

1.26.31.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: ビルド<30>,  Next: Windows<27>,  Prev: テスト<30>,  Up: Python 3 12 0 alpha 3

1.26.31.8 ビルド
................

   - gh-99086(1): Fix ‘-Wimplicit-int’, ‘-Wstrict-prototypes’, and
     ‘-Wimplicit-function-declaration’ compiler warnings in ‘configure’
     checks.

   - gh-99337(2): Fix a compilation issue with GCC 12 on macOS.

   - gh-99289(3): Add a ‘COMPILEALL_OPTS’ variable in Makefile to
     override *note compileall: 21. options (default: ‘-j0’) in ‘make
     install’.  Also merged the ‘compileall’ commands into a single
     command building .pyc files for the all optimization levels (0, 1,
     2) at once.  Patch by Victor Stinner.

   - gh-98872(4): Fix a possible fd leak in ‘Programs/_freeze_module.c’
     introduced in Python 3.11.

   - gh-88226(5): Always define ‘TARGET_*’ labels in ‘Python/ceval.c’,
     even if ‘USE_COMPUTED_GOTOS’ is disabled.  This allows breakpoints
     to be set at those labels in (for instance) ‘gdb’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99086

   (2) https://github.com/python/cpython/issues/99337

   (3) https://github.com/python/cpython/issues/99289

   (4) https://github.com/python/cpython/issues/98872

   (5) https://github.com/python/cpython/issues/88226


File: python.info,  Node: Windows<27>,  Next: macOS<19>,  Prev: ビルド<30>,  Up: Python 3 12 0 alpha 3

1.26.31.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: 6ae. and
     ‘sys._git’ on Windows

   - gh-99442(3): Fix handling in *note Python install manager: 9c1.
     when ‘argv[0]’ does not include a file extension.

   - bpo-40882(4): Fix a memory leak in *note
     multiprocessing.shared_memory.SharedMemory: 1c00. 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<19>,  Next: Tools/Demos<21>,  Prev: Windows<27>,  Up: Python 3 12 0 alpha 3

1.26.31.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<21>,  Next: C API<29>,  Prev: macOS<19>,  Up: Python 3 12 0 alpha 3

1.26.31.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<29>,  Prev: Tools/Demos<21>,  Up: Python 3 12 0 alpha 3

1.26.31.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: 853. defined for 3.11, and are necessary to use the
     buffer API.

   - gh-99612(2): Fix *note PyUnicode_DecodeUTF8Stateful(): 1d34. 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: 997, *note T_NONE: 999,
     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.26.32 Python 3.12.0 alpha 2
-----------------------------

'Release date: 2022-11-14'

* Menu:

* セキュリティ: セキュリティ<25>.
* Core and Builtins: Core and Builtins<79>.
* ビルド: ビルド<31>.
* Core and Builtins: Core and Builtins<80>.
* ライブラリ: ライブラリ<82>.
* ドキュメント: ドキュメント<27>.
* テスト: テスト<31>.
* ビルド: ビルド<32>.
* Windows: Windows<28>.
* macOS: macOS<20>.
* C API: C API<30>.


File: python.info,  Node: セキュリティ<25>,  Next: Core and Builtins<79>,  Up: Python 3 12 0 alpha 2

1.26.32.1 セキュリティ
......................

   - gh-98433(1): The IDNA codec decoder used on DNS hostnames by *note
     socket: d4. 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: 111. 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<79>,  Next: ビルド<31>,  Prev: セキュリティ<25>,  Up: Python 3 12 0 alpha 2

1.26.32.2 Core and Builtins
...........................

   - gh-81057(1): The docs clearly say that *note PyImport_Inittab:
     1d38, *note PyImport_AppendInittab(): 1d39, and *note
     PyImport_ExtendInittab(): 1d3a. should not be used after *note
     Py_Initialize(): 67a. 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: b71.
     and *note PyInterpreterState: c94. 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*: 44f. 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: 5b. to emit an error
     message with the proper unexpected signal number.  Patch by Donghee
     Na.

   - gh-99153(9): Fix location of *note SyntaxError: 189. for a *note
     try: adb. block with both *note except: 44e. and *note except*:
     44f.

   - 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: 1d3b.  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:
     66c. 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: 451, instead of *note DeprecationWarning: 2d4.  In a
     future Python version they will be eventually a *note SyntaxError:
     189.  Patch by Victor Stinner.

   - gh-98401(14): A backslash-character pair that is not a valid escape
     sequence now generates a *note SyntaxWarning: 451, instead of *note
     DeprecationWarning: 2d4.  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: 189. 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: 189. 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: 29f.: 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: 1ce3. for
     generators.  Saves multiple layers of dispatch and checking to get
     from the ‘FOR_ITER’ instruction in the caller to the *note RESUME:
     7ba. in the generator.

   - gh-98762(22): Fix source locations of *note match: 1df.
     sub-patterns.

   - gh-98586(23): Added the methods *note PyObject_Vectorcall(): 968.
     and *note PyObject_VectorcallMethod(): 969. to the *note Limited
     API: 961. along with the auxiliary macro constant *note
     PY_VECTORCALL_ARGUMENTS_OFFSET: 96a.

     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__: 18a3.) could behave incorrectly or crash
     instead of raising a *note TypeError: 29c. 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: 6e3. and assign *note None:
     a6a. to any fast locals that are left unbound after jumps or *note
     del: 1d3c. statements executed while tracing.

   - gh-96421(27): When calling into Python code from C code, through
     *note PyEval_EvalFrameEx(): 13da. 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: 1d3d, *note YIELD_VALUE: 7b9, and *note
     RETURN_GENERATOR: aee, 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: ビルド<31>,  Next: Core and Builtins<80>,  Prev: Core and Builtins<79>,  Up: Python 3 12 0 alpha 2

1.26.32.3 ビルド
................

   - gh-98415(1): Fix detection of MAC addresses for *note uuid: 119. on
     certain OSs.  Patch by Chaim Sanders

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98415


File: python.info,  Node: Core and Builtins<80>,  Next: ライブラリ<82>,  Prev: ビルド<31>,  Up: Python 3 12 0 alpha 2

1.26.32.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: 2d. calls.

   - gh-91058(3): *note ImportError: 1c8. 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: 1ce3. 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: 1d40. and some of the *note
     ETHERTYPE_* constants: 1d41. in *note socket: d4.  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: ライブラリ<82>,  Next: ドキュメント<27>,  Prev: Core and Builtins<80>,  Up: Python 3 12 0 alpha 2

1.26.32.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(): 2af. 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():
     1d43.

   - gh-74044(5): Fixed bug where *note inspect.signature(): 4c4.
     reported incorrect arguments for decorated methods.

   - gh-99275(6): Fix ‘SystemError’ in *note ctypes: 2d. 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: e00. 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(): dc8. 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: 107. 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: 1d44. 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: 107. when
     retrieving the byte-offset for some source files that contain
     certain unicode characters.

   - gh-98740(24): Fix internal error in the *note re: c1. module which
     in very rare circumstances prevented compilation of a regular
     expression containing a *note conditional expression: 1d45. without
     the "else" branch.

   - gh-98703(25): Fix *note asyncio.StreamWriter.drain(): 1d46. 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: 6cb. class now supports
     subscripting, making it a *note generic type: 1dc.

   - gh-98284(28): Improved *note TypeError: 29c. message for undefined
     abstract methods of a *note abc.ABC: 12cc. 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: 7a5.
     in ‘os.ismount()’.

   - gh-94172(34): *note ftplib: 61.: 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: 61, *note imaplib: 77, *note poplib: b1. and
     *note smtplib: d2. modules, and the 'key_file', 'cert_file' and
     'check_hostname' parameters from the *note http.client: 72. 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: 8cb. attribute to *note
     sqlite3.Connection: 3e6. and the 'autocommit' parameter to *note
     sqlite3.connect(): 3e7. to control PEP 249(37)-compliant *note
     transaction handling: 8cc.  Patch by Erlend E. Aasland.

   - gh-92452(38): Fixed a race condition that could cause *note
     sysconfig.get_config_var(): 425. to incorrectly return *note None:
     a6a. in multi-threaded programs.

   - gh-91803(39): Fix an error when using a method of objects mocked
     with *note unittest.mock.create_autospec(): 1b6d. after it was
     sealed with *note unittest.mock.seal(): f64. function.

   - bpo-38523(40): *note shutil.copytree(): df1. now applies the
     'ignore_dangling_symlinks' argument recursively.

   - bpo-40358(41): Add walk_up argument in *note
     pathlib.PurePath.relative_to(): 57c.

   - bpo-36267(42): Fix IndexError in *note argparse.ArgumentParser:
     1e7. when a ‘store_true’ action is given an explicit argument.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93696

   (2) https://github.com/python/cpython/issues/99418

   (3) https://github.com/python/cpython/issues/94597

   (4) https://github.com/python/cpython/issues/99305

   (5) https://github.com/python/cpython/issues/74044

   (6) https://github.com/python/cpython/issues/99275

   (7) https://github.com/python/cpython/issues/99277

   (8) https://github.com/python/cpython/issues/99248

   (9) https://github.com/python/cpython/issues/99155

   (10) https://github.com/python/cpython/issues/93464

   (11) https://github.com/python/cpython/issues/99134

   (12) https://github.com/python/cpython/issues/92584

   (13) https://peps.python.org/pep-0632/

   (14) https://github.com/python/cpython/issues/98999

   (15) https://github.com/python/cpython/issues/83004

   (16) https://github.com/python/cpython/issues/83004

   (17) https://github.com/python/cpython/issues/83004

   (18) https://github.com/python/cpython/issues/98897

   (19) https://github.com/python/cpython/issues/98878

   (20) https://github.com/python/cpython/issues/98139

   (21) https://github.com/python/cpython/issues/90352

   (22) https://github.com/python/cpython/issues/98793

   (23) https://github.com/python/cpython/issues/98744

   (24) https://github.com/python/cpython/issues/98740

   (25) https://github.com/python/cpython/issues/98703

   (26) https://github.com/python/cpython/issues/98624

   (27) https://github.com/python/cpython/issues/98658

   (28) https://github.com/python/cpython/issues/98284

   (29) https://github.com/python/cpython/issues/96151

   (30) https://github.com/python/cpython/issues/98086

   (31) https://github.com/python/cpython/issues/72719

   (32) https://peps.python.org/pep-0594/

   (33) https://github.com/python/cpython/issues/96192

   (34) https://github.com/python/cpython/issues/94172

   (35) https://github.com/python/cpython/issues/94172

   (36) https://github.com/python/cpython/issues/83638

   (37) https://peps.python.org/pep-0249/

   (38) https://github.com/python/cpython/issues/92452

   (39) https://github.com/python/cpython/issues/91803

   (40) https://bugs.python.org/issue?@action=redirect&bpo=38523

   (41) https://bugs.python.org/issue?@action=redirect&bpo=40358

   (42) https://bugs.python.org/issue?@action=redirect&bpo=36267


File: python.info,  Node: ドキュメント<27>,  Next: テスト<31>,  Prev: ライブラリ<82>,  Up: Python 3 12 0 alpha 2

1.26.32.6 ドキュメント
......................

   - gh-98832(1): Changes wording of docstring for *note
     pathlib.Path.iterdir(): 4fd.

   - 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: テスト<31>,  Next: ビルド<32>,  Prev: ドキュメント<27>,  Up: Python 3 12 0 alpha 2

1.26.32.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: 10d. 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: ビルド<32>,  Next: Windows<28>,  Prev: テスト<31>,  Up: Python 3 12 0 alpha 2

1.26.32.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
     ‘--with-system-libmpdec’ is passed to ‘configure’.  Don't use
     vendored ‘libexpat’ headers if *note -with-system-expat: 1d4a. is
     passed to ‘configure’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99086

   (2) https://github.com/python/cpython/issues/99016

   (3) https://github.com/python/cpython/issues/97731

   (4) https://github.com/python/cpython/issues/98949

   (5) https://github.com/python/cpython/issues/98989

   (6) https://github.com/python/cpython/issues/98831

   (7) 
https://github.com/faster-cpython/ideas/blob/main/3.12/interpreter_definition.md

   (8) https://github.com/python/cpython/issues/98817

   (9) https://github.com/python/cpython/issues/98776

   (10) https://github.com/python/cpython/issues/98707


File: python.info,  Node: Windows<28>,  Next: macOS<20>,  Prev: ビルド<32>,  Up: Python 3 12 0 alpha 2

1.26.32.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: 9c1. 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<20>,  Next: C API<30>,  Prev: Windows<28>,  Up: Python 3 12 0 alpha 2

1.26.32.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<30>,  Prev: macOS<20>,  Up: Python 3 12 0 alpha 2

1.26.32.11 C API
................

   - gh-98724(1): The *note Py_CLEAR: 981, *note Py_SETREF: 982. and
     *note Py_XSETREF: 983. 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:
     df.) 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(): 1d4e.

   - 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(): 973. and *note
     PyFrame_GetVarString(): 974. 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.26.33 Python 3.12.0 alpha 1
-----------------------------

'Release date: 2022-10-25'

* Menu:

* セキュリティ: セキュリティ<26>.
* Core and Builtins: Core and Builtins<81>.
* ライブラリ: ライブラリ<83>.
* Core and Builtins: Core and Builtins<82>.
* ライブラリ: ライブラリ<84>.
* Core and Builtins: Core and Builtins<83>.
* ライブラリ: ライブラリ<85>.
* Core and Builtins: Core and Builtins<84>.
* ライブラリ: ライブラリ<86>.
* Core and Builtins: Core and Builtins<85>.
* ライブラリ: ライブラリ<87>.
* Core and Builtins: Core and Builtins<86>.
* ライブラリ: ライブラリ<88>.
* Core and Builtins: Core and Builtins<87>.
* ライブラリ: ライブラリ<89>.
* Core and Builtins: Core and Builtins<88>.
* ライブラリ: ライブラリ<90>.
* Core and Builtins: Core and Builtins<89>.
* ライブラリ: ライブラリ<91>.
* Core and Builtins: Core and Builtins<90>.
* ライブラリ: ライブラリ<92>.
* ドキュメント: ドキュメント<28>.
* テスト: テスト<32>.
* ビルド: ビルド<33>.
* Windows: Windows<29>.
* macOS: macOS<21>.
* IDLE: IDLE<16>.
* Tools/Demos: Tools/Demos<22>.
* C API: C API<31>.


File: python.info,  Node: セキュリティ<26>,  Next: Core and Builtins<81>,  Up: Python 3 12 0 alpha 1

1.26.33.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: 474. 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: 75.: 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<81>,  Next: ライブラリ<83>,  Prev: セキュリティ<26>,  Up: Python 3 12 0 alpha 1

1.26.33.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: 66c. 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: ライブラリ<83>,  Next: Core and Builtins<82>,  Prev: Core and Builtins<81>,  Up: Python 3 12 0 alpha 1

1.26.33.3 ライブラリ
....................

   - gh-96078(1): *note os.sched_yield(): 14d2. now release the GIL
     while calling sched_yield(2).  Patch by Donghee Na.

   - gh-97955(2): Migrate *note zoneinfo: 13d. 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<82>,  Next: ライブラリ<84>,  Prev: ライブラリ<83>,  Up: Python 3 12 0 alpha 1

1.26.33.4 Core and Builtins
...........................

   - gh-97912(1): The compiler now avoids quadratic behavior when
     finding which instructions should use the *note LOAD_FAST_CHECK:
     8f9. 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(): 1d54.
     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(): 885. 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:
     1d55. to gather statistics on Python opcodes.  Patch by Victor
     Stinner.

   - gh-94526(13): Fix the Python path configuration used to initialized
     *note sys.path: 19f. 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: 189. when
     parsing source code containing null bytes.  Patch by Pablo Galindo

   - gh-96975(15): Fix a crash occurring when *note PyEval_GetFrame():
     1d56. 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: 183. option with no value (invalid) when the
     *note PYTHONINTMAXSTRDIGITS: 1d57. 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: ライブラリ<84>,  Next: Core and Builtins<83>,  Prev: Core and Builtins<82>,  Up: Python 3 12 0 alpha 1

1.26.33.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<83>,  Next: ライブラリ<85>,  Prev: ライブラリ<84>,  Up: Python 3 12 0 alpha 1

1.26.33.6 Core and Builtins
...........................

   - gh-96821(1): Fix undefined behaviour in ‘_testcapimodule.c’.

   - gh-95778(2): When *note ValueError: 15a. is raised if an integer is
     larger than the limit, mention the *note
     sys.set_int_max_str_digits(): 1b30. 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: 3f1. 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: 1dd. 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: ライブラリ<85>,  Next: Core and Builtins<84>,  Prev: Core and Builtins<83>,  Up: Python 3 12 0 alpha 1

1.26.33.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<84>,  Next: ライブラリ<86>,  Prev: ライブラリ<85>,  Up: Python 3 12 0 alpha 1

1.26.33.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: 8f2.
     from specializing properly when accessing properties.

   - gh-96348(12): Emit a DeprecationWarning when *note throw(): 90a,
     *note throw(): 909. or *note athrow(): 90b. 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: 1b4. missing ‘name’ and
     ‘obj’ attributes in *note object.__getattribute__(): f94.  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(): 88a. and *note
     sys.deactivate_stack_trampoline(): 88b. function in the *note sys:
     e2. 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(): 88c. 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(): 1b0.
     when allocating new thread state.  Patch by Kumar Aditya.

   - gh-96046(22): *note PyType_Ready(): b63. 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: 1d5c. is now mapped to
     *note PermissionError: 10fd.  The *note errno: 5a. 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: adb./*note except: 44e.
     blocks to handle exceptions raised during *note close(): 19bf. or
     *note throw(): 90a. calls through a suspended frame.

   - gh-95977(27): Optimized calling *note __get__(): 18a0. 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(): b72.

   - 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: 32f.

   - 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: 4e0. from *note
     str.split(): 125e. and *note str.rsplit(): 160f.  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(): 18bd. 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: 1125. is now raised instead.  Patch by Pablo
     Galindo

   - gh-93351(42): *note ast.AST: 2f8. node positions are now validated
     when provided to *note compile(): 1d3. and other related functions.
     If invalid positions are detected, a *note ValueError: 15a. 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: 1d3b. 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: ライブラリ<86>,  Next: Core and Builtins<85>,  Prev: Core and Builtins<84>,  Up: Python 3 12 0 alpha 1

1.26.33.9 ライブラリ
....................

   - gh-95023(1): Implement *note os.setns(): 1d5e. and *note
     os.unshare(): 1d5f. for Linux.  Patch by Noam Cohen.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/95023


File: python.info,  Node: Core and Builtins<85>,  Next: ライブラリ<87>,  Prev: ライブラリ<86>,  Up: Python 3 12 0 alpha 1

1.26.33.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: ライブラリ<87>,  Next: Core and Builtins<86>,  Prev: Core and Builtins<85>,  Up: Python 3 12 0 alpha 1

1.26.33.11 ライブラリ
.....................

   - gh-94996(1): *note ast.parse(): 1d4. 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<86>,  Next: ライブラリ<88>,  Prev: ライブラリ<87>,  Up: Python 3 12 0 alpha 1

1.26.33.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: ライブラリ<88>,  Next: Core and Builtins<87>,  Prev: Core and Builtins<86>,  Up: Python 3 12 0 alpha 1

1.26.33.13 ライブラリ
.....................

   - gh-94949(1): *note ast.parse(): 1d4. 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(): 1d4. 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<87>,  Next: ライブラリ<89>,  Prev: ライブラリ<88>,  Up: Python 3 12 0 alpha 1

1.26.33.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: 1d1. 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: 194. 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: 8f3. and *note STORE_SLICE:
     8f4. 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: bcb. 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: ライブラリ<89>,  Next: Core and Builtins<88>,  Prev: Core and Builtins<87>,  Up: Python 3 12 0 alpha 1

1.26.33.15 ライブラリ
.....................

   - gh-93461(1): *note importlib.invalidate_caches(): fd3. now drops
     entries from *note sys.path_importer_cache: 9e0. 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<88>,  Next: ライブラリ<90>,  Prev: ライブラリ<89>,  Up: Python 3 12 0 alpha 1

1.26.33.16 Core and Builtins
............................

   - gh-93621(1): Change order of bytecode instructions emitted for
     *note with: 215. and *note async with: 216. 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(): b5f.
     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():
     399, which generalizes the existing *note
     PyType_FromModuleAndSpec(): 398. 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(): 399. 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: ライブラリ<90>,  Next: Core and Builtins<89>,  Prev: Core and Builtins<88>,  Up: Python 3 12 0 alpha 1

1.26.33.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<89>,  Next: ライブラリ<91>,  Prev: ライブラリ<90>,  Up: Python 3 12 0 alpha 1

1.26.33.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: ライブラリ<91>,  Next: Core and Builtins<90>,  Prev: Core and Builtins<89>,  Up: Python 3 12 0 alpha 1

1.26.33.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<90>,  Next: ライブラリ<92>,  Prev: ライブラリ<91>,  Up: Python 3 12 0 alpha 1

1.26.33.20 Core and Builtins
............................

   - gh-91432(1): Specialized the *note FOR_ITER: 1ce3. 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: 4e0.
     and *note tuple: 1d9. 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: ライブラリ<92>,  Next: ドキュメント<28>,  Prev: Core and Builtins<90>,  Up: Python 3 12 0 alpha 1

1.26.33.21 ライブラリ
.....................

   - gh-89237(1): Fix hang on Windows in ‘subprocess.wait_closed()’ in
     *note asyncio: b. with *note ProactorEventLoop: a03.  Patch by
     Kumar Aditya.

   - gh-97928(2): ‘tkinter.Text.count()’ raises now an exception for
     options starting with "-" instead of silently ignoring them.

   - gh-98393(3): The *note os: a5. module no longer accepts bytes-like
     paths, like *note bytearray: 1d1. and *note memoryview: 1dd. types:
     only the exact *note bytes: 1d2. 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(): a50. method was added to *note
     SysLogHandler: a51.

   - gh-96035(7): Fix bug in *note urllib.parse.urlparse(): 2af. 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(): 18b6. and *note
     sys.settrace(): 563. 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: 11a. 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(): 952.
     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: 247.
     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: 80.

   - gh-97837(22): Change deprecate warning message in *note unittest:
     10f. 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: 1b4. when *note
     subprocess.check_output(): 1370. is used with argument ‘input=None’
     and either of the arguments 'encoding' or 'errors' are used.

   - gh-97008(24): *note NameError: 66c. and *note AttributeError: 1b4.
     spelling suggestions provided since gh-82711(25) are now also
     emitted by the pure Python *note traceback: 107. 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():
     bf0. 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(): 1b4b. when an evil argument
     is passed.

   - gh-97639(31): Remove ‘tokenize.NL’ check from *note tabnanny: e6.

   - gh-97545(32): Make Semaphore run faster.

   - gh-73588(33): Fix generation of the default name of
     ‘tkinter.Checkbutton’.  Previously, checkbuttons in different
     parent widgets could have the same short name and share the same
     state if arguments "name" and "variable" are not specified.  Now
     they are globally unique.

   - gh-96865(34): fix Flag to use boundary CONFORM

     This restores previous Flag behavior of allowing flags with
     non-sequential values to be combined; e.g.

     class Skip(Flag): TWO = 2 EIGHT = 8

     Skip.TWO | Skip.EIGHT -> <Skip.TWO|EIGHT: 10>

   - gh-97005(35): Update bundled libexpat to 2.4.9

   - gh-85760(36): Fix race condition in *note asyncio: b. where *note
     process_exited(): 1d6c. called before the *note
     pipe_data_received(): 1d6d. 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(): 1d6e.
     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: 10e. database to Unicode
     15.0.0.

   - gh-96735(42): Fix undefined behaviour in *note struct.unpack():
     1aa2.

   - 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: 1678.'s
     to *note float: 32f.

   - 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: 10d, 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:
     115e.'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: 81, fix overeager replacement of
     "‘typing.’" in formatting annotations.

   - gh-89258(55): Added a *note getChildren(): 1d6f. method to *note
     logging.Logger: f10, 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: 12b.

   - 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(): 1d70. 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: 1d71.

   - gh-95899(69): Fix *note asyncio.Runner: 315. to call *note
     asyncio.set_event_loop(): 1d72. only once to avoid calling
     ‘attach_loop()’ multiple times on child watchers.  Patch by Kumar
     Aditya.

   - gh-95736(70): Fix *note unittest.IsolatedAsyncioTestCase: 34a. to
     set event loop before calling setup functions.  Patch by Kumar
     Aditya.

   - gh-95865(71): Speed up *note urllib.parse.quote_from_bytes(): 1d6e.
     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:
     6e0. and raises some other error, the other error should generally
     not silently be suppressed.

   - gh-95149(75): The *note HTTPStatus: cd4. 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: 6dd. to propagate
     exception when *note asyncio.CancelledError: 6e0. 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: 8bb. initializer.

   - gh-95385(79): Faster ‘json.dumps()’ when sorting of keys is not
     requested (default).

   - gh-83901(80): Improve *note Signature.bind: 1ad5. 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: 1d73. or *note
     ENOSYS: 1d74. 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(): 314. for *note asyncio.Task:
     467. implementations without *note uncancel(): 6e2. method.  Patch
     by Kumar Aditya.

   - gh-95087(85): Fix IndexError in parsing invalid date in the *note
     email: 3e. 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:
     1d75, *note os.EFD_NONBLOCK: 1d76. and *note os.EFD_SEMAPHORE:
     1d77. flags on older kernel versions where these flags are not
     present.  Patch by Kumar Aditya.

   - gh-95166(89): Fix *note concurrent.futures.Executor.map(): 47a. to
     cancel the currently waiting on future on an error - e.g.
     TimeoutError or KeyboardInterrupt.

   - gh-95132(90): Fix a *note sqlite3: d7. regression where ‘*args’ and
     ‘**kwds’ were incorrectly relayed from *note connect(): 3e7. to the
     *note Connection: 3e6. 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: 5e. 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: 1c66. 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():
     1d4, when ‘feature_version’ has an invalid major version.  Patch by
     Shantanu Jain.

   - gh-77617(98): Add *note sqlite3: d7. *note command-line interface:
     263.  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: f8.  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(): 1d46. to
     be awaited concurrently by multiple tasks.  Patch by Kumar Aditya.

   - gh-87822(106): When called with ‘capture_locals=True’, the *note
     traceback: 107. 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: 905. and
     *note typing.Sized: 906.

   - 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: 10d.  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: 7a.

   - 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(): 314. and *note
     unittest.IsolatedAsyncioTestCase: 34a. 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: 307. when it was
     not completely initialized by initializing it in *note __new__():
     987.  Patch by Kumar Aditya.

   - gh-94510(118): Re-entrant calls to *note sys.setprofile(): 18b6.
     and *note sys.settrace(): 563. now raise *note RuntimeError: 317.
     Patch by Pablo Galindo.

   - gh-92336(119): Fix bug where *note linecache.getline(): 4d4. fails
     on bad files with *note UnicodeDecodeError: ddb. or *note
     SyntaxError: 189.  It now returns an empty string as per the
     documentation.

   - gh-94398(120): Once a *note asyncio.TaskGroup: 6dd. 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(): 947. 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: 13b.: 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(): 94e.: Passing ‘None’ for 's'
     argument now raises an exception, rather than reading *note
     sys.stdin: 94f.  The feature was deprecated in Python 3.9.  Patch
     by Victor Stinner.

   - gh-94318(125): Strip trailing spaces in *note pydoc: bd. text
     output.

   - gh-89988(126): Fix memory leak in *note pickle.Pickler: de6. when
     looking up ‘dispatch_table’.  Patch by Kumar Aditya.

   - gh-90016(127): Deprecate *note sqlite3: d7. *note default adapters
     and converters: 902.  Patch by Erlend E. Aasland.

   - gh-94254(128): Fixed types of *note struct: de. 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(): 8c8. now passes the
     'root_dir' argument to custom archivers which support it.

   - gh-94216(131): The *note dis: 3b. 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(): 932. 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: 33e. object
     and call its *note ssl.SSLContext.wrap_socket: 938. 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(): 936. or *note
     ssl.RAND_bytes(): 937. instead.  Patch by Victor Stinner.

   - gh-94199(141): *note hashlib: 6b.: Remove the pure Python
     implementation of *note hashlib.pbkdf2_hmac(): 923, 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: 6a.: Remove the ‘filename’ attribute of
     *note gzip.GzipFile: 84f, deprecated since Python 2.6, use the
     *note name: 921. 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(): 333. instead.
     The ‘open()’ (*note io.open(): 930.) 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: 109f.
     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(): 154, *note
     inspect.isgeneratorfunction(): 1d78, and *note
     inspect.isasyncgenfunction(): 1d79. now properly return ‘True’ for
     duck-typed function-like objects like instances of *note
     unittest.mock.AsyncMock: e11.

     This makes *note inspect.iscoroutinefunction(): 154. consistent
     with the behavior of ‘asyncio.iscoroutinefunction()’.  Patch by
     Mehdi ABAAKOUK.

   - gh-94028(149): Fix a regression in the *note sqlite3: d7. 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: a19. by name.

   - gh-93847(154): Fix repr of enum of generic aliases.

   - gh-91404(155): Revert the *note re: c1. 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: e9.

   - gh-93820(157): Fixed a regression when *note copy.copy(): 947.-ing
     *note enum.Flag: a19. with multiple flag members.

   - gh-79512(158): Fixed names and ‘__module__’ value of *note weakref:
     11d. classes *note ReferenceType: 1d7a, *note ProxyType: 1d7b,
     *note CallableProxyType: 1d7c.  It makes them pickleable.

   - gh-91389(159): Fix an issue where *note dis: 3b. 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(): 947. and *note copy.deepcopy():
     f2f. 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: d7. now correctly detects DML queries
     with leading comments.  Patch by Erlend E. Aasland.

   - gh-93421(167): Update *note sqlite3.Cursor.rowcount: 1d7d. 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: 5c.  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(): 8a4.
     context manager to remove the temporary file if destroyed late
     during Python finalization: keep a local reference to the *note
     os.remove(): 14b1. 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: 8b0. flag to open a
     file descriptor for a process with *note os.pidfd_open(): 273. 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: 29c.

   - gh-93297(176): Make asyncio task groups prevent child tasks from
     being GCed

   - gh-85308(177): Changed *note argparse.ArgumentParser: 1e7. to use
     *note filesystem encoding and error handler: 94d. 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: bfd.
     sequence of an absolute path using negative index values produced
     incorrect results.

   - gh-93162(179): Add the ability for *note
     logging.config.dictConfig(): 156e. to usefully configure *note
     QueueHandler: 1d7e. and *note QueueListener: 4d6. as a pair, and
     add *note logging.getHandlerByName(): 1d7f. and *note
     logging.getHandlerNames(): 1c93. 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: e3b. 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: 8a.
     module for use with *note asyncio: b. tasks.

   - gh-74696(186): *note shutil.make_archive(): 8c8. 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: 5f. 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(): 3e7. 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(): cba. when
     ‘ImportFrom.level’ is ‘None’

   - gh-92932(193): Now *note dis(): 49d. and *note get_instructions():
     6f7. 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: 4f5. arguments in addition to *note str: 1ea. paths.
     Patch by David Foster.

   - gh-87901(195): Removed the ‘encoding’ argument from *note
     os.popen(): 58c. 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: 1d80. to *note ctypes: 2d,
     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: df. now fails early on Emscripten
     and WASI platforms to work around missing *note os.pipe(): 1d81. on
     WASI.

   - gh-89325(200): Removed many old deprecated *note unittest: 10f.
     features: *note TestCase: 536. method aliases, undocumented and
     broken ‘TestCase’ method ‘assertDictContainsSubset’, undocumented
     *note TestLoader.loadTestsFromModule: 799. parameter
     'use_load_tests', and an underscored alias of the *note
     TextTestResult: 944. class.

   - gh-92734(201): Allow multi-element reprs emitted by *note reprlib:
     c3. to be pretty-printed using configurable indentation.

   - gh-92671(202): Fixed *note ast.unparse(): cba. for empty tuples in
     the assignment target context.

   - gh-91581(203): *note utcfromtimestamp(): 337. 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: 1d82.  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(): 8bd. as an
     alternative to *note os.walk(): 8be.

   - gh-92550(206): Fix *note pathlib.Path.rglob(): 740. for empty
     pattern.

   - gh-92591(207): Allow *note logging: 8a. filters to return a *note
     logging.LogRecord: 1394. instance so that filters attached to *note
     logging.Handler: 184e.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: d7. 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(): 1d83.

   - 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: 4f5. deprecated method
     ‘link_to’ has been removed.  Use 3.10's *note hardlink_to(): bfe.
     method instead as its semantics are consistent with that of *note
     symlink_to(): bff.

   - 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__(): b26. to *note
     csv.DictReader: dad. and *note csv.DictWriter: 15bd, 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: d4.

   - gh-91810(216): *note ElementTree: d1d. method *note write(): e5f.
     and function *note tostring(): 13a3. 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(): fb8. 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: 211. 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: 900. 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(): 7a7. and *note re.subn(): 7a8. and
     corresponding *note re.Pattern: 196e. 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: ab6. now raises *note
     zipfile.BadZipFile: 1d84. 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(): 6c1.

   - gh-90005(229): *note ctypes: 2d. dependency ‘libffi’ is now
     detected with ‘pkg-config’.

   - bpo-32547(230): The constructors for *note DictWriter: 15bd. and
     *note DictReader: dad. now coerce the ‘fieldnames’ argument to a
     *note list: 4e0. if it is an iterator.

   - bpo-35540(231): Fix *note dataclasses.asdict(): 192e. crash when
     *note collections.defaultdict: 157a. 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: 1d2. on *note
     sys.path: 19f.

   - bpo-46951(234): Order the contents of zipapp archives, to make
     builds more reproducible.

   - bpo-42777(235): Implement *note pathlib.Path.is_mount(): ddf. 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(): cad. system.

   - bpo-46642(238): Improve error message when trying to subclass an
     instance of *note typing.TypeVar: 29f, *note typing.ParamSpec: 2a0,
     *note typing.TypeVarTuple: 29e, 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: 1a27. to ‘None’
     when an object does not have *note __doc__: cf8.

   - bpo-46197(241): Fix *note ensurepip: 58. 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:
     10f.: methods *note enterContext(): aab. and *note
     enterClassContext(): aac. of class *note TestCase: 536, method
     *note enterAsyncContext(): aad. of class *note
     IsolatedAsyncioTestCase: 34a. and function *note
     unittest.enterModuleContext(): aae.

   - 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(): e05. support
     for DragonFly BSD. Patch by David Carlier.

   - bpo-14243(247): The *note tempfile.NamedTemporaryFile: 8db.
     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__(): 157b. when a value is not found.  This matches
     the behavior of *note dict: 193.  Patch by Bar Harel.

   - bpo-38693(250): *note importlib: 7a. now uses f-strings internally
     instead of ‘str.format’.

   - bpo-38267(251): Add 'timeout' parameter to *note
     asyncio.loop.shutdown_default_executor(): cbc.  The default value
     is ‘None’, which means the executor will be given an unlimited
     amount of time.  When called from *note asyncio.Runner: 315. or
     *note asyncio.run(): 314, the default timeout is 5 minutes.

   - bpo-34828(252): *note sqlite3.Connection.iterdump(): 756. 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: 11c. module.

   - bpo-26253(254): Allow adjustable compression level for tarfile
     streams in *note tarfile.open(): 122b.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89237

   (2) https://github.com/python/cpython/issues/97928

   (3) https://github.com/python/cpython/issues/98393

   (4) https://github.com/python/cpython/issues/98363

   (5) https://github.com/python/cpython/issues/98331

   (6) https://github.com/python/cpython/issues/98307

   (7) https://github.com/python/cpython/issues/96035

   (8) https://github.com/python/cpython/issues/98257

   (9) https://github.com/python/cpython/issues/98251

   (10) https://github.com/python/cpython/issues/94597

   (11) https://github.com/python/cpython/issues/98178

   (12) https://github.com/python/cpython/issues/44098

   (13) https://github.com/python/cpython/issues/87730

   (14) https://github.com/python/cpython/issues/94597

   (15) https://github.com/python/cpython/issues/98023

   (16) https://github.com/python/cpython/issues/90985

   (17) https://github.com/python/cpython/issues/65961

   (18) https://github.com/python/cpython/issues/97646

   (19) https://datatracker.ietf.org/doc/html/rfc9239.html

   (20) https://github.com/python/cpython/issues/97930

   (21) https://github.com/python/cpython/issues/97850

   (22) https://github.com/python/cpython/issues/97837

   (23) https://github.com/python/cpython/issues/97825

   (24) https://github.com/python/cpython/issues/97008

   (25) https://github.com/python/cpython/issues/82711

   (26) https://github.com/python/cpython/issues/97799

   (27) https://github.com/python/cpython/issues/97781

   (28) https://github.com/python/cpython/issues/96827

   (29) https://github.com/python/cpython/issues/95534

   (30) https://github.com/python/cpython/issues/97592

   (31) https://github.com/python/cpython/issues/97639

   (32) https://github.com/python/cpython/issues/97545

   (33) https://github.com/python/cpython/issues/73588

   (34) https://github.com/python/cpython/issues/96865

   (35) https://github.com/python/cpython/issues/97005

   (36) https://github.com/python/cpython/issues/85760

   (37) https://github.com/python/cpython/issues/96704

   (38) https://github.com/python/cpython/issues/96819

   (39) https://github.com/python/cpython/issues/95865

   (40) https://github.com/python/cpython/issues/96741

   (41) https://github.com/python/cpython/issues/96734

   (42) https://github.com/python/cpython/issues/96735

   (43) https://github.com/python/cpython/issues/46412

   (44) https://github.com/python/cpython/issues/96652

   (45) https://github.com/python/cpython/issues/68163

   (46) https://github.com/python/cpython/issues/96538

   (47) https://github.com/python/cpython/issues/96465

   (48) https://github.com/python/cpython/issues/96079

   (49) https://github.com/python/cpython/issues/96415

   (50) https://github.com/python/cpython/issues/95987

   (51) https://github.com/python/cpython/issues/96388

   (52) https://github.com/python/cpython/issues/96385

   (53) https://github.com/python/cpython/issues/96142

   (54) https://github.com/python/cpython/issues/96073

   (55) https://github.com/python/cpython/issues/89258

   (56) https://github.com/python/cpython/issues/96346

   (57) https://github.com/python/cpython/issues/96349

   (58) https://github.com/python/cpython/issues/90467

   (59) https://github.com/python/cpython/issues/96172

   (60) https://github.com/python/cpython/issues/96159

   (61) https://github.com/python/cpython/issues/96175

   (62) https://github.com/python/cpython/issues/96145

   (63) https://github.com/python/cpython/issues/96052

   (64) https://github.com/python/cpython/issues/96125

   (65) https://github.com/python/cpython/issues/96019

   (66) https://github.com/python/cpython/issues/95463

   (67) https://bugs.python.org/issue?@action=redirect&bpo=28080

   (68) https://github.com/python/cpython/issues/69142

   (69) https://github.com/python/cpython/issues/95899

   (70) https://github.com/python/cpython/issues/95736

   (71) https://github.com/python/cpython/issues/95865

   (72) https://github.com/python/cpython/issues/95861

   (73) https://github.com/python/cpython/issues/95804

   (74) https://github.com/python/cpython/issues/95704

   (75) https://github.com/python/cpython/issues/95149

   (76) https://github.com/python/cpython/issues/95609

   (77) https://github.com/python/cpython/issues/95289

   (78) https://github.com/python/cpython/issues/94909

   (79) https://github.com/python/cpython/issues/95385

   (80) https://github.com/python/cpython/issues/83901

   (81) https://github.com/python/cpython/issues/95339

   (82) https://github.com/python/cpython/issues/95045

   (83) https://github.com/python/cpython/issues/95231

   (84) https://github.com/python/cpython/issues/95097

   (85) https://github.com/python/cpython/issues/95087

   (86) https://github.com/python/cpython/issues/95199

   (87) https://github.com/python/cpython/issues/95194

   (88) https://github.com/python/cpython/issues/93899

   (89) https://github.com/python/cpython/issues/95166

   (90) https://github.com/python/cpython/issues/95132

   (91) https://github.com/python/cpython/issues/85128

   (92) https://github.com/python/cpython/issues/93157

   (93) https://github.com/python/cpython/issues/91212

   (94) https://github.com/python/cpython/issues/95077

   (95) https://github.com/python/cpython/issues/95109

   (96) https://github.com/python/cpython/issues/95105

   (97) https://github.com/python/cpython/issues/95066

   (98) https://github.com/python/cpython/issues/77617

   (99) https://github.com/python/cpython/issues/95005

   (100) https://github.com/python/cpython/issues/90085

   (101) https://github.com/python/cpython/issues/94857

   (102) https://github.com/python/cpython/issues/94821

   (103) https://github.com/python/cpython/issues/94736

   (104) https://github.com/python/cpython/issues/81620

   (105) https://github.com/python/cpython/issues/74116

   (106) https://github.com/python/cpython/issues/87822

   (107) https://github.com/python/cpython/issues/88050

   (108) https://github.com/python/cpython/issues/94637

   (109) https://github.com/python/cpython/issues/94309

   (110) https://github.com/python/cpython/issues/92546

   (111) https://github.com/python/cpython/issues/94607

   (112) https://github.com/python/cpython/issues/94619

   (113) https://github.com/python/cpython/issues/93910

   (114) https://github.com/python/cpython/issues/93896

   (115) https://github.com/python/cpython/issues/94343

   (116) https://github.com/python/cpython/issues/94382

   (117) https://github.com/python/cpython/issues/78724

   (118) https://github.com/python/cpython/issues/94510

   (119) https://github.com/python/cpython/issues/92336

   (120) https://github.com/python/cpython/issues/94398

   (121) https://github.com/python/cpython/issues/94383

   (122) https://github.com/python/cpython/issues/94379

   (123) https://peps.python.org/pep-0451/

   (124) https://github.com/python/cpython/issues/94352

   (125) https://github.com/python/cpython/issues/94318

   (126) https://github.com/python/cpython/issues/89988

   (127) https://github.com/python/cpython/issues/90016

   (128) https://github.com/python/cpython/issues/94254

   (129) https://github.com/python/cpython/issues/93259

   (130) https://github.com/python/cpython/issues/74696

   (131) https://github.com/python/cpython/issues/94216

   (132) https://github.com/python/cpython/issues/93096

   (133) https://github.com/python/cpython/issues/94207

   (134) https://github.com/python/cpython/issues/93096

   (135) https://github.com/python/cpython/issues/94226

   (136) https://github.com/python/cpython/issues/94199

   (137) https://github.com/python/cpython/issues/94214

   (138) https://github.com/python/cpython/issues/94199

   (139) https://cwe.mitre.org/data/definitions/295.html

   (140) https://github.com/python/cpython/issues/94199

   (141) https://github.com/python/cpython/issues/94199

   (142) https://peps.python.org/pep-0644/

   (143) https://github.com/python/cpython/issues/94196

   (144) https://github.com/python/cpython/issues/94182

   (145) https://github.com/python/cpython/issues/94169

   (146) https://github.com/python/cpython/issues/91742

   (147) https://github.com/python/cpython/issues/94101

   (148) https://github.com/python/cpython/issues/84753

   (149) https://github.com/python/cpython/issues/94028

   (150) https://github.com/python/cpython/issues/93973

   (151) https://github.com/python/cpython/issues/93963

   (152) https://github.com/python/cpython/issues/93858

   (153) https://github.com/python/cpython/issues/93820

   (154) https://github.com/python/cpython/issues/93847

   (155) https://github.com/python/cpython/issues/91404

   (156) https://github.com/python/cpython/issues/83499

   (157) https://github.com/python/cpython/issues/93820

   (158) https://github.com/python/cpython/issues/79512

   (159) https://github.com/python/cpython/issues/91389

   (160) https://github.com/python/cpython/issues/93626

   (161) https://github.com/python/cpython/issues/90473

   (162) https://peps.python.org/pep-0370/

   (163) https://github.com/python/cpython/issues/90494

   (164) https://github.com/python/cpython/issues/90549

   (165) https://github.com/python/cpython/issues/93521

   (166) https://github.com/python/cpython/issues/79579

   (167) https://github.com/python/cpython/issues/93421

   (168) https://github.com/python/cpython/issues/93475

   (169) https://github.com/python/cpython/issues/93370

   (170) https://github.com/python/cpython/issues/91810

   (171) https://github.com/python/cpython/issues/91162

   (172) https://github.com/python/cpython/issues/93353

   (173) https://github.com/python/cpython/issues/83658

   (174) https://github.com/python/cpython/issues/93312

   (175) https://github.com/python/cpython/issues/88123

   (176) https://github.com/python/cpython/issues/93297

   (177) https://github.com/python/cpython/issues/85308

   (178) https://github.com/python/cpython/issues/93156

   (179) https://github.com/python/cpython/issues/93162

   (180) https://github.com/python/cpython/issues/93243

   (181) https://peps.python.org/pep-0594/

   (182) https://github.com/python/cpython/issues/92886

   (183) https://github.com/python/cpython/issues/90155

   (184) https://github.com/python/cpython/issues/90817

   (185) https://github.com/python/cpython/issues/91513

   (186) https://github.com/python/cpython/issues/74696

   (187) https://github.com/python/cpython/issues/92728

   (188) https://github.com/python/cpython/issues/93033

   (189) https://github.com/python/cpython/issues/89973

   (190) https://github.com/python/cpython/issues/93044

   (191) https://github.com/python/cpython/issues/93010

   (192) https://github.com/python/cpython/issues/92986

   (193) https://github.com/python/cpython/issues/92932

   (194) https://github.com/python/cpython/issues/92675

   (195) https://github.com/python/cpython/issues/87901

   (196) https://github.com/python/cpython/issues/91922

   (197) https://github.com/python/cpython/issues/92869

   (198) https://github.com/python/cpython/issues/92839

   (199) https://github.com/python/cpython/issues/90473

   (200) https://github.com/python/cpython/issues/89325

   (201) https://github.com/python/cpython/issues/92734

   (202) https://github.com/python/cpython/issues/92671

   (203) https://github.com/python/cpython/issues/91581

   (204) https://github.com/python/cpython/issues/86388

   (205) https://github.com/python/cpython/issues/90385

   (206) https://github.com/python/cpython/issues/92550

   (207) https://github.com/python/cpython/issues/92591

   (208) https://github.com/python/cpython/issues/92445

   (209) https://github.com/python/cpython/issues/92547

   (210) https://github.com/python/cpython/issues/92530

   (211) https://github.com/python/cpython/issues/92531

   (212) https://github.com/python/cpython/issues/84131

   (213) https://github.com/python/cpython/issues/89336

   (214) https://github.com/python/cpython/issues/92391

   (215) https://github.com/python/cpython/issues/91968

   (216) https://github.com/python/cpython/issues/91810

   (217) https://github.com/python/cpython/issues/81790

   (218) https://github.com/python/cpython/issues/91760

   (219) https://github.com/python/cpython/issues/90622

   (220) https://github.com/python/cpython/issues/91577

   (221) https://github.com/python/cpython/issues/91581

   (222) https://github.com/python/cpython/issues/91539

   (223) https://github.com/python/cpython/issues/91524

   (224) https://github.com/python/cpython/issues/91447

   (225) https://github.com/python/cpython/issues/91456

   (226) https://bugs.python.org/issue?@action=redirect&bpo=47231

   (227) https://bugs.python.org/issue?@action=redirect&bpo=39064

   (228) https://bugs.python.org/issue?@action=redirect&bpo=41287

   (229) https://github.com/python/cpython/issues/90005

   (230) https://bugs.python.org/issue?@action=redirect&bpo=32547

   (231) https://bugs.python.org/issue?@action=redirect&bpo=35540

   (232) https://bugs.python.org/issue?@action=redirect&bpo=47063

   (233) https://bugs.python.org/issue?@action=redirect&bpo=47025

   (234) https://bugs.python.org/issue?@action=redirect&bpo=46951

   (235) https://bugs.python.org/issue?@action=redirect&bpo=42777

   (236) https://bugs.python.org/issue?@action=redirect&bpo=46755

   (237) https://bugs.python.org/issue?@action=redirect&bpo=45393

   (238) https://bugs.python.org/issue?@action=redirect&bpo=46642

   (239) https://bugs.python.org/issue?@action=redirect&bpo=46364

   (240) https://bugs.python.org/issue?@action=redirect&bpo=28249

   (241) https://bugs.python.org/issue?@action=redirect&bpo=46197

   (242) https://bugs.python.org/issue?@action=redirect&bpo=45924

   (243) https://bugs.python.org/issue?@action=redirect&bpo=45046

   (244) https://bugs.python.org/issue?@action=redirect&bpo=44173

   (245) https://bugs.python.org/issue?@action=redirect&bpo=42627

   (246) https://bugs.python.org/issue?@action=redirect&bpo=42047

   (247) https://bugs.python.org/issue?@action=redirect&bpo=14243

   (248) https://bugs.python.org/issue?@action=redirect&bpo=41246

   (249) https://bugs.python.org/issue?@action=redirect&bpo=39264

   (250) https://bugs.python.org/issue?@action=redirect&bpo=38693

   (251) https://bugs.python.org/issue?@action=redirect&bpo=38267

   (252) https://bugs.python.org/issue?@action=redirect&bpo=34828

   (253) https://bugs.python.org/issue?@action=redirect&bpo=32990

   (254) https://bugs.python.org/issue?@action=redirect&bpo=26253


File: python.info,  Node: ドキュメント<28>,  Next: テスト<32>,  Prev: ライブラリ<92>,  Up: Python 3 12 0 alpha 1

1.26.33.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(): fdb. 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: 1d86. 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: 1d87.

   - 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: d7. behavior when *note
     接続(connection)コンテキストマネージャの使い方: 1d88.

   - gh-87260(17): Align *note sqlite3: d7. 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: 1cb. and *note PYTHONWARNINGS:
     1cc. are matched literally and case-insensitively, rather than as
     regular expressions, in *note warnings: 11b.

   - 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: 8bb. does not
     collapse initial double slashes because they denote UNC paths.

   - bpo-40838(24): Document that *note inspect.getdoc(): 237, *note
     inspect.getmodule(): 1d89, and *note inspect.getsourcefile(): 1d8a.
     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 エラーハンドラ: 1d8b.
     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: テスト<32>,  Next: ビルド<33>,  Prev: ドキュメント<28>,  Up: Python 3 12 0 alpha 1

1.26.33.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: 1d8d. ("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: c1. exponentional
     slowdown when using rjsmin.

   - gh-91330(11): Added more tests for *note dataclasses: 32. 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(): 1d8e.

   - 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(): 1d8f.
     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(): 1cf9. may return
     different size when string has UTF-8 memory.

   - gh-90473(24): WASI does not have a ‘chmod(2)’ syscall.  *note
     os.chmod(): 732. 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/main/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: ビルド<33>,  Next: Windows<29>,  Prev: テスト<32>,  Up: Python 3 12 0 alpha 1

1.26.33.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: 110.

   - 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: c4. module, *note getresuid(): 16cf, *note getresgid():
     16ce, 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: 5a, *note select: c9, and
     *note socket: d4. constants.

   - gh-95174(14): Python now skips missing *note socket: d4. 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(): 1028. 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: c2. and *note curses:
     2e. module are now detected in ‘configure’ script with
     ‘pkg-config’.  Only ‘ncurses’ / ‘ncursesw’ are detected
     automatically.  The old ‘curses’ library is not configured
     automatically.  Workaround for missing ‘termcap’ or ‘tinfo’ library
     has been removed.

   - gh-90005(23): Fix building ‘_ctypes’ extension without
     ‘pkg-config’.

   - gh-90005(24): ‘_dbm’ module dependencies are now detected by
     configure.

   - gh-94404(25): ‘makesetup’ now works around an issue with sed on
     macOS and uses correct CFLAGS for object files that end up in a
     shared extension.  Module CFLAGS are used before
     PY_STDMODULE_CFLAGS to avoid clashes with system headers.

   - gh-93939(26): C extension modules are now built by ‘configure’ and
     ‘make’ instead of ‘distutils’ and ‘setup.py’.

   - gh-93939(27): The ‘2to3’, ‘idle’, and ‘pydoc’ scripts are now
     generated and installed by ‘Makefile’ instead of ‘setup.py’.

   - gh-94280(28): Updated pegen regeneration script on Windows to find
     and use Python 3.9 or higher.  Prior to this, pegen regeneration
     already required 3.9 or higher, but the script may have used lower
     versions of Python.

   - gh-93584(29): Address race condition in ‘Makefile’ when installing
     a PGO build.  All ‘test’ and ‘install’ targets now depend on ‘all’
     target.

   - gh-93491(30): ‘configure’ now detects and reports PEP 11(31)
     support tiers.

   - gh-69093(32): Fix ‘Modules/Setup.stdlib.in’ rule for ‘_sqlite3’
     extension.

   - gh-93207(33): ‘va_start()’ with two parameters, like
     ‘va_start(args, format),’ is now required to build Python.
     ‘va_start()’ is no longer called with a single parameter.  Patch by
     Kumar Aditya.

   - gh-93202(34): Python now always use the ‘%zu’ and ‘%zd’ printf
     formats to format a ‘size_t’ or ‘Py_ssize_t’ number.  Building
     Python 3.12 requires a C11 compiler, so these printf formats are
     now always supported.  Patch by Victor Stinner.

   - gh-90473(35): Disable pymalloc and increase stack size on
     ‘wasm32-wasi’.

   - bpo-34449(36): Drop invalid compiler switch ‘-fPIC’ for HP aCC on
     HP-UX. Patch by Michael Osipov.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96761

   (2) https://github.com/python/cpython/issues/96883

   (3) https://github.com/python/cpython/issues/85936

   (4) https://github.com/python/cpython/issues/96729

   (5) https://github.com/python/cpython/issues/96269

   (6) https://github.com/python/cpython/issues/84461

   (7) https://github.com/python/cpython/issues/95973

   (8) https://github.com/python/cpython/issues/90536

   (9) https://github.com/python/cpython/issues/93744

   (10) https://github.com/python/cpython/issues/94801

   (11) https://github.com/python/cpython/issues/94802

   (12) https://github.com/python/cpython/issues/95145

   (13) https://github.com/python/cpython/issues/95174

   (14) https://github.com/python/cpython/issues/95174

   (15) https://github.com/python/cpython/issues/95085

   (16) https://peps.python.org/pep-0011/

   (17) https://github.com/python/cpython/issues/94847

   (18) https://github.com/python/cpython/issues/94841

   (19) https://github.com/python/cpython/issues/94801

   (20) https://github.com/python/cpython/issues/94773

   (21) https://github.com/python/cpython/issues/94682

   (22) https://github.com/python/cpython/issues/90005

   (23) https://github.com/python/cpython/issues/90005

   (24) https://github.com/python/cpython/issues/90005

   (25) https://github.com/python/cpython/issues/94404

   (26) https://github.com/python/cpython/issues/93939

   (27) https://github.com/python/cpython/issues/93939

   (28) https://github.com/python/cpython/issues/94280

   (29) https://github.com/python/cpython/issues/93584

   (30) https://github.com/python/cpython/issues/93491

   (31) https://peps.python.org/pep-0011/

   (32) https://github.com/python/cpython/issues/69093

   (33) https://github.com/python/cpython/issues/93207

   (34) https://github.com/python/cpython/issues/93202

   (35) https://github.com/python/cpython/issues/90473

   (36) https://bugs.python.org/issue?@action=redirect&bpo=34449


File: python.info,  Node: Windows<29>,  Next: macOS<21>,  Prev: ビルド<33>,  Up: Python 3 12 0 alpha 1

1.26.33.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(): 1815. on Windows and in Windows-specific modules (like
     ‘winreg’).

   - gh-90989(4): Made *note Python install manager: 9c1. 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(): c1b. *note
     sqlite3: d7. 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: 9c1. 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: 9c1. 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: 9c1. 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: 13a. 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(): 14c3. 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():
     1986. 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<21>,  Next: IDLE<16>,  Prev: Windows<29>,  Up: Python 3 12 0 alpha 1

1.26.33.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(): 114d. or *note os.mknod(): 114e. 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<22>,  Prev: macOS<21>,  Up: Python 3 12 0 alpha 1

1.26.33.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<22>,  Next: C API<31>,  Prev: IDLE<16>,  Up: Python 3 12 0 alpha 1

1.26.33.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<31>,  Prev: Tools/Demos<22>,  Up: Python 3 12 0 alpha 1

1.26.33.29 C API
................

   - gh-98393(1): The *note PyUnicode_FSDecoder(): 980. function no
     longer accepts bytes-like paths, like *note bytearray: 1d1. and
     *note memoryview: 1dd. types: only the exact *note bytes: 1d2. type
     is accepted for bytes strings.  Patch by Victor Stinner.

   - gh-91051(2): Add *note PyType_Watch(): 970. and related APIs to
     allow callbacks on *note PyType_Modified(): 1d96.

   - 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: 9f1. 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: 3a4. and *note Py_TPFLAGS_MANAGED_WEAKREF:
     3a5. instead.

   - gh-95781(6): An unrecognized format character in *note
     PyUnicode_FromFormat(): 824. and *note PyUnicode_FromFormatV():
     97e. now sets a *note SystemError: 3f1.  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: 962, *note PyVectorcall_NARGS(): 963.
     and *note PyVectorcall_Call(): 964.) was added to the limited API
     and stable ABI.

   - gh-95504(10): Fix sign placement when specifying width or precision
     in *note PyUnicode_FromFormat(): 824. and *note
     PyUnicode_FromFormatV(): 97e.  Patch by Philip Georgi.

   - gh-93012(11): The *note Py_TPFLAGS_HAVE_VECTORCALL: 962. flag is
     now removed from a class when the class's *note __call__(): 966.
     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: 967. now inherit
     the ‘Py_TPFLAGS_HAVE_VECTORCALL’ flag.

   - gh-95388(12): Creating *note immutable types: 602. 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(): b60, *note
     PyCode_GetCellvars(): b61. and *note PyCode_GetFreevars(): b62. for
     accessing ‘co_varnames’, ‘co_cellvars’ and ‘co_freevars’
     respectively via the C API.

   - gh-94930(15): Fix ‘SystemError’ raised when *note
     PyArg_ParseTupleAndKeywords(): 81e. 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(): b69.

        * *note PyFrame_GetBack(): b6a.

        * *note PyFrame_GetBuiltins(): b52.

        * *note PyFrame_GetGenerator(): b53.

        * *note PyFrame_GetGlobals(): b54.

        * *note PyFrame_GetLasti(): b55.

        * *note PyFrame_GetLocals(): 854.

        * *note PyFrame_Type: b6b.

     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(): 399. (and other
     ‘PyType_From*’ functions) now check that offsets and the base
     class's *note tp_basicsize: d53. fit in the new class's
     ‘tp_basicsize’.

   - gh-93503(21): Add two new public functions to the public C-API,
     *note PyEval_SetProfileAllThreads(): 96b. and *note
     PyEval_SetTraceAllThreads(): 857, 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:
     f6. module (*note threading.setprofile_all_threads(): 8de. and
     *note threading.settrace_all_threads(): 8dd.) 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: 624, in the documentation: the *note
     Py_InitializeFromConfig(): 611. API should be instead.  Patch by
     Victor Stinner.

   - gh-77782(26): Deprecate global configuration variable like *note
     Py_IgnoreEnvironmentFlag: 624.: the *note
     Py_InitializeFromConfig(): 611. API should be instead.  Patch by
     Victor Stinner.

   - gh-92913(27): Ensures changes to *note
     PyConfig.module_search_paths: 83a. are ignored unless *note
     PyConfig.module_search_paths_set: 9eb. 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():
     96c. to the C API which sets the vectorcall field of a given *note
     PyFunctionObject: 96d.

     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(): 396. 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.26.34 Python 3.11.0 beta 1
----------------------------

'Release date: 2022-05-06'

* Menu:

* セキュリティ: セキュリティ<27>.
* Core and Builtins: Core and Builtins<91>.
* ライブラリ: ライブラリ<93>.
* Core and Builtins: Core and Builtins<92>.
* ビルド: ビルド<34>.
* Core and Builtins: Core and Builtins<93>.
* ライブラリ: ライブラリ<94>.
* ドキュメント: ドキュメント<29>.
* テスト: テスト<33>.
* ビルド: ビルド<35>.
* Windows: Windows<30>.
* macOS: macOS<22>.
* Tools/Demos: Tools/Demos<23>.
* C API: C API<32>.


File: python.info,  Node: セキュリティ<27>,  Next: Core and Builtins<91>,  Up: Python 3 11 0 beta 1

1.26.34.1 セキュリティ
......................

   - gh-57684(1): Add the *note -P: 9a8. command line option and the
     *note PYTHONSAFEPATH: 9a9. environment variable to not prepend a
     potentially unsafe path to *note sys.path: 19f.  Patch by Victor
     Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/57684


File: python.info,  Node: Core and Builtins<91>,  Next: ライブラリ<93>,  Prev: セキュリティ<27>,  Up: Python 3 11 0 beta 1

1.26.34.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: 1b4. 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():
     190.  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: 52e. 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: 2d4.  In a future Python
     version they will be a *note SyntaxWarning: 451. and eventually a
     *note SyntaxError: 189.

   - 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(): 2fb. and *note
     issubclass(): 2fc. checks for *note types.UnionType: 52e.  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: b6d. 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:
     9bd. (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: 1c84, *note
     POP_JUMP_IF_FALSE: 1c85, *note POP_JUMP_IF_NONE: 1d9a. and *note
     POP_JUMP_IF_NOT_NONE: 1d9b. 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: ライブラリ<93>,  Next: Core and Builtins<92>,  Prev: Core and Builtins<91>,  Up: Python 3 11 0 beta 1

1.26.34.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<92>,  Next: ビルド<34>,  Prev: ライブラリ<93>,  Up: Python 3 11 0 beta 1

1.26.34.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(): 448, 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: 1929, ‘testcapi.RecursingInfinitelyError’, and
     *note types.GenericAlias: bcb.

     The functions affected are 24 methods in *note ctypes: 2d.

     Patch by Oleg Iarygin.

   - bpo-46942(5): Use Argument Clinic for the *note types.MethodType:
     1d9e. constructor.  Patch by Oleg Iarygin.

   - bpo-46764(6): Fix wrapping bound methods with @classmethod

   - bpo-43464(7): Optimize *note set.intersection(): 1d9f. for non-set
     arguments.

   - bpo-46721(8): Optimize *note set.issuperset(): 1da0. 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: ビルド<34>,  Next: Core and Builtins<93>,  Prev: Core and Builtins<92>,  Up: Python 3 11 0 beta 1

1.26.34.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<93>,  Next: ライブラリ<94>,  Prev: ビルド<34>,  Up: Python 3 11 0 beta 1

1.26.34.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: ライブラリ<94>,  Next: ドキュメント<29>,  Prev: Core and Builtins<93>,  Up: Python 3 11 0 beta 1

1.26.34.7 ライブラリ
....................

   - gh-87901(1): Add the 'encoding' parameter to *note os.popen(): 58c.

   - gh-90997(2): Fix an issue where *note dis: 3b. utilities may
     interpret populated inline cache entries as valid instructions.

   - gh-92332(3): Deprecate *note typing.Text: 348. (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: 3b. utilities.

   - gh-92301(7): Prefer ‘close_range()’ to iterating over procfs for
     file descriptor closing in *note subprocess: df. 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(): a0f, *note
     datetime.date.fromisoformat(): a0d. and *note
     datetime.time.fromisoformat(): a0e.  Patch by Paul Ganssle.

   - gh-92118(11): Fix a 3.11 regression in *note contextmanager(): 219,
     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: 6ec, 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__(): b26. to *note
     logging.LoggerAdapter: 16af. and *note logging.StreamHandler: 15b7,
     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: 6ef. now raises *note
     ValueError: 15a. 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: bcb.  Patch by Jelle Zijlstra.

   - gh-88089(19): Add support for generic *note typing.NamedTuple: 2f0.

   - 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(): 1371. and *note
     subprocess.getstatusoutput(): 1372.

   - bpo-47029(24): Always close the read end of the pipe used by *note
     multiprocessing.Queue: 1da4. 'after' the last write of buffered
     data to the write end of the pipe to avoid *note BrokenPipeError:
     1412. at garbage collection and at *note
     multiprocessing.Queue.close(): 1da5. 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: df. 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: 1da6. 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(): 8e9,
     implementing PEP 681(32).  Patch by Jelle Zijlstra.

   - gh-91832(33): Add ‘required’ attribute to *note argparse.Action:
     1da7. repr output.

   - gh-91827(34): In the *note tkinter: f9. module add method
     ‘info_patchlevel()’ which returns the exact version of the Tcl
     library as a named tuple similar to *note sys.version_info: 308.

   - gh-84461(35): Add *note -enable-wasm-pthreads: 1da8. 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: 1da9.
     named tuple with build-time and run-time information about
     Emscripten platform.

   - gh-90623(41): *note signal.raise_signal(): 1daa. and *note
     os.kill(): 1721. 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(): a9a.  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(): aa3. for *note
     collections.abc.Callable: bca.  Patch by Shantanu Jain.

   - gh-90568(47): Parsing ‘\N’ escapes of Unicode Named Character
     Sequences in a *note regular expression: c1. raises now ‘re.error’
     instead of ‘TypeError’.

   - gh-91670(48): Remove deprecated ‘SO’ config variable in *note
     sysconfig: e4.

   - 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: c1. module, fix *note fullmatch(): 1335.
     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: c1. 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(): a67. in an *note ExceptionGroup: 6de. 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: c1.
     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: d7, ‘SQLITE_MISUSE’ result codes
     are now mapped to *note InterfaceError: a72. instead of *note
     ProgrammingError: 584.  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: 81. 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(): a43, *note inspect.getouterframes(): a44,
     *note inspect.getinnerframes(): a45, *note inspect.stack(): a46.
     and *note inspect.trace(): a47.  Patch by Pablo Galindo.

   - gh-69093(67): Add indexing and slicing support to *note
     sqlite3.Blob: a77.  Patch by Aviv Palivoda and Erlend E. Aasland.

   - gh-69093(68): Add *note context manager: 47f. support to *note
     sqlite3.Blob: a77.  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: c1. 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: 3b.
     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(): 42a. now accepts
     arguments for *note warnings.simplefilter(): ab3, 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: d4.

   - 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(): a4a. to get the
     current locale encoding.  It is similar to
     ‘locale.getpreferredencoding(False)’ but ignores the *note Python
     UTF-8 Mode: a4b.

   - bpo-42012(85): Add *note wsgiref.types: 125, containing
     WSGI-specific types for static type checking.

   - bpo-47227(86): Suppress expression chaining for more *note re: c1.
     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(): 1740. now accepts
     context attributes via keyword arguments

   - bpo-43323(89): Fix errors in the *note email: 3e. 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(): aa1. and *note
     typing.clear_overloads(): aa2.  Patch by Jelle Zijlstra.

   - bpo-44807(93): *note typing.Protocol: 772. no longer silently
     replaces ‘__init__()’ methods defined on subclasses.  Patch by
     Adrian Garcia Badaracco.

   - bpo-46787(94): Fix *note concurrent.futures.ProcessPoolExecutor:
     211. exception memory leak

   - bpo-46720(95): Add support for path-like objects to *note
     multiprocessing.set_executable(): 1dab. 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: d4.

   - 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: 75. 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: ba8.

   - 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: a88.
     or *note io.TextIOBase: a89. interface for *note
     tempfile.SpooledTemporaryFile: a87. 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: d7. 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: 29b. subclasses to also
     include *note Generic: 1a12. 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: 6c5. 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(): a75. to *note
     sqlite3.Connection: 3e6. for creating aggregate window functions.
     Patch by Erlend E. Aasland.

   - bpo-40676(115): Convert *note csv: 2c. to use Argument Clinic for
     *note csv.field_size_limit(): 1dac, *note csv.get_dialect(): 1dad,
     *note csv.unregister_dialect(): 1dae. and *note
     csv.list_dialects(): 1daf.

   - 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: 584. instead of
     segfaulting on recursive usage of cursors in *note sqlite3: d7.
     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: 33e.

   - bpo-22276(119): *note Path: 4f5. methods *note glob(): 73f. and
     *note rglob(): 740. return only directories if 'pattern' ends with
     a pathname components separator (‘/’ or *note sep: a5f.).  Patch by
     Eisuke Kawashima.

   - bpo-24905(120): Add *note blobopen(): a76. to *note
     sqlite3.Connection: 3e6.  *note sqlite3.Blob: a77. allows
     incremental I/O operations on blobs.  Patch by Aviv Palivoda and
     Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87901

   (2) https://github.com/python/cpython/issues/90997

   (3) https://github.com/python/cpython/issues/92332

   (4) https://github.com/python/cpython/issues/78157

   (5) https://github.com/python/cpython/issues/92356

   (6) https://github.com/python/cpython/issues/90997

   (7) https://github.com/python/cpython/issues/92301

   (8) https://github.com/python/cpython/issues/67248

   (9) https://github.com/python/cpython/issues/92210

   (10) https://github.com/python/cpython/issues/80010

   (11) https://github.com/python/cpython/issues/92118

   (12) https://github.com/python/cpython/issues/90887

   (13) https://github.com/python/cpython/issues/91215

   (14) https://github.com/python/cpython/issues/85984

   (15) https://github.com/python/cpython/issues/92128

   (16) https://github.com/python/cpython/issues/92049

   (17) https://github.com/python/cpython/issues/92062

   (18) https://github.com/python/cpython/issues/87390

   (19) https://github.com/python/cpython/issues/88089

   (20) https://github.com/python/cpython/issues/91996

   (21) https://github.com/python/cpython/issues/91984

   (22) https://github.com/python/cpython/issues/91952

   (23) https://github.com/python/cpython/issues/91954

   (24) https://bugs.python.org/issue?@action=redirect&bpo=47029

   (25) https://github.com/python/cpython/issues/91928

   (26) https://github.com/python/cpython/issues/68966

   (27) https://peps.python.org/pep-0594/

   (28) https://github.com/python/cpython/issues/91401

   (29) https://github.com/python/cpython/issues/64783

   (30) https://github.com/python/cpython/issues/91910

   (31) https://github.com/python/cpython/issues/91860

   (32) https://peps.python.org/pep-0681/

   (33) https://github.com/python/cpython/issues/91832

   (34) https://github.com/python/cpython/issues/91827

   (35) https://github.com/python/cpython/issues/84461

   (36) https://github.com/python/cpython/issues/91821

   (37) https://github.com/python/cpython/issues/91217

   (38) https://github.com/python/cpython/issues/91217

   (39) https://github.com/python/cpython/issues/91760

   (40) https://github.com/python/cpython/issues/84461

   (41) https://github.com/python/cpython/issues/90623

   (42) https://github.com/python/cpython/issues/91734

   (43) https://github.com/python/cpython/issues/90633

   (44) https://github.com/python/cpython/issues/91700

   (45) https://github.com/python/cpython/issues/91231

   (46) https://github.com/python/cpython/issues/91621

   (47) https://github.com/python/cpython/issues/90568

   (48) https://github.com/python/cpython/issues/91670

   (49) https://github.com/python/cpython/issues/91217

   (50) https://github.com/python/cpython/issues/91217

   (51) https://github.com/python/cpython/issues/91217

   (52) https://github.com/python/cpython/issues/91217

   (53) https://github.com/python/cpython/issues/91616

   (54) https://github.com/python/cpython/issues/91217

   (55) https://github.com/python/cpython/issues/91217

   (56) https://bugs.python.org/issue?@action=redirect&bpo=47256

   (57) https://github.com/python/cpython/issues/91217

   (58) https://github.com/python/cpython/issues/91595

   (59) https://github.com/python/cpython/issues/74166

   (60) https://github.com/python/cpython/issues/91487

   (61) https://github.com/python/cpython/issues/91575

   (62) https://github.com/python/cpython/issues/90622

   (63) https://github.com/python/cpython/issues/89022

   (64) https://github.com/python/cpython/issues/91526

   (65) https://github.com/python/cpython/issues/88116

   (66) https://peps.python.org/pep-0657/

   (67) https://github.com/python/cpython/issues/69093

   (68) https://github.com/python/cpython/issues/69093

   (69) https://github.com/python/cpython/issues/91217

   (70) https://github.com/python/cpython/issues/91217

   (71) https://github.com/python/cpython/issues/91404

   (72) https://github.com/python/cpython/issues/91217

   (73) https://github.com/python/cpython/issues/91217

   (74) https://github.com/python/cpython/issues/91276

   (75) https://bugs.python.org/issue?@action=redirect&bpo=47000

   (76) https://github.com/python/cpython/issues/91230

   (77) https://github.com/python/cpython/issues/91217

   (78) https://github.com/python/cpython/issues/91498

   (79) https://bugs.python.org/issue?@action=redirect&bpo=47260

   (80) https://bugs.python.org/issue?@action=redirect&bpo=47087

   (81) https://peps.python.org/pep-0655/

   (82) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (83) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (84) https://bugs.python.org/issue?@action=redirect&bpo=47000

   (85) https://bugs.python.org/issue?@action=redirect&bpo=42012

   (86) https://bugs.python.org/issue?@action=redirect&bpo=47227

   (87) https://bugs.python.org/issue?@action=redirect&bpo=47211

   (88) https://bugs.python.org/issue?@action=redirect&bpo=47135

   (89) https://bugs.python.org/issue?@action=redirect&bpo=43323

   (90) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (91) https://bugs.python.org/issue?@action=redirect&bpo=46681

   (92) https://bugs.python.org/issue?@action=redirect&bpo=45100

   (93) https://bugs.python.org/issue?@action=redirect&bpo=44807

   (94) https://bugs.python.org/issue?@action=redirect&bpo=46787

   (95) https://bugs.python.org/issue?@action=redirect&bpo=46720

   (96) https://bugs.python.org/issue?@action=redirect&bpo=46696

   (97) https://bugs.python.org/issue?@action=redirect&bpo=46053

   (98) https://bugs.python.org/issue?@action=redirect&bpo=45639

   (99) https://bugs.python.org/issue?@action=redirect&bpo=46285

   (100) https://bugs.python.org/issue?@action=redirect&bpo=44791

   (101) https://bugs.python.org/issue?@action=redirect&bpo=46547

   (102) https://bugs.python.org/issue?@action=redirect&bpo=46415

   (103) https://bugs.python.org/issue?@action=redirect&bpo=46075

   (104) https://bugs.python.org/issue?@action=redirect&bpo=45995

   (105) https://bugs.python.org/issue?@action=redirect&bpo=26175

   (106) https://bugs.python.org/issue?@action=redirect&bpo=45138

   (107) https://bugs.python.org/issue?@action=redirect&bpo=40318

   (108) https://bugs.python.org/issue?@action=redirect&bpo=44863

   (109) https://bugs.python.org/issue?@action=redirect&bpo=44587

   (110) https://bugs.python.org/issue?@action=redirect&bpo=43827

   (111) https://bugs.python.org/issue?@action=redirect&bpo=43218

   (112) https://bugs.python.org/issue?@action=redirect&bpo=38435

   (113) https://bugs.python.org/issue?@action=redirect&bpo=42066

   (114) https://bugs.python.org/issue?@action=redirect&bpo=40617

   (115) https://bugs.python.org/issue?@action=redirect&bpo=40676

   (116) https://bugs.python.org/issue?@action=redirect&bpo=39716

   (117) https://bugs.python.org/issue?@action=redirect&bpo=36073

   (118) https://bugs.python.org/issue?@action=redirect&bpo=34975

   (119) https://bugs.python.org/issue?@action=redirect&bpo=22276

   (120) https://bugs.python.org/issue?@action=redirect&bpo=24905


File: python.info,  Node: ドキュメント<29>,  Next: テスト<33>,  Prev: ライブラリ<94>,  Up: Python 3 11 0 beta 1

1.26.34.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(): 887.

   - 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(): df1.

   - 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: 961.

   - bpo-46962(12): All docstrings in code snippets are now wrapped into
     *note PyDoc_STR: 1db1. 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():
     1922. and *note runpy.run_path(): 6b4.  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: テスト<33>,  Next: ビルド<35>,  Prev: ドキュメント<29>,  Up: Python 3 11 0 beta 1

1.26.34.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: 10f. times to ‘ctypes.test’
     location and structure.  Patch by Oleg Iarygin.

   - bpo-29890(8): Add tests for *note ipaddress.IPv4Interface: 1db3.
     and *note ipaddress.IPv6Interface: 1db4. 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: ビルド<35>,  Next: Windows<30>,  Prev: テスト<33>,  Up: Python 3 11 0 beta 1

1.26.34.10 ビルド
.................

   - gh-89452(1): gdbm-compat is now preferred over ndbm if both are
     available on the system.  This allows avoiding the problematic
     ndbm.h on macOS.

   - gh-91731(2): Python is now built with ‘-std=c11’ compiler option,
     rather than ‘-std=c99’.  Patch by Victor Stinner.

   - bpo-47152(3): Add script and make target for generating
     ‘sre_constants.h’.

   - bpo-47103(4): Windows ‘PGInstrument’ builds now copy a required DLL
     into the output directory, making it easier to run the profile
     stage of a PGO build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89452

   (2) https://github.com/python/cpython/issues/91731

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47152

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47103


File: python.info,  Node: Windows<30>,  Next: macOS<22>,  Prev: ビルド<35>,  Up: Python 3 11 0 beta 1

1.26.34.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: 9c1. 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(): 4fc. 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<22>,  Next: Tools/Demos<23>,  Prev: Windows<30>,  Up: Python 3 11 0 beta 1

1.26.34.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<23>,  Next: C API<32>,  Prev: macOS<22>,  Up: Python 3 11 0 beta 1

1.26.34.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<32>,  Prev: Tools/Demos<23>,  Up: Python 3 11 0 beta 1

1.26.34.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(): b5f. 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(): 1cf8.

   - 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(): 552, *note Py_TYPE(): 5fc, *note
     Py_SIZE(): b66. and *note Py_IS_TYPE(): 19db. 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(): 1dba. is now exported in
     the Stable ABI on Windows.

   - bpo-47169(12): *note PyThread_get_thread_native_id(): 1dbb. is
     excluded from the stable ABI on platforms where it doesn't exist
     (like Solaris).

   - bpo-46343(13): Added *note PyErr_GetHandledException(): b56. and
     *note PyErr_SetHandledException(): b57. as simpler alternatives to
     *note PyErr_GetExcInfo(): b59. and *note PyErr_SetExcInfo(): b58.

     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.26.35 Python 3.11.0 alpha 7
-----------------------------

'Release date: 2022-04-05'

* Menu:

* Core and Builtins: Core and Builtins<94>.
* ライブラリ: ライブラリ<95>.
* Core and Builtins: Core and Builtins<95>.
* ライブラリ: ライブラリ<96>.
* Core and Builtins: Core and Builtins<96>.
* ライブラリ: ライブラリ<97>.
* ドキュメント: ドキュメント<30>.
* テスト: テスト<34>.
* ビルド: ビルド<36>.
* Windows: Windows<31>.
* macOS: macOS<23>.
* Tools/Demos: Tools/Demos<24>.
* C API: C API<33>.


File: python.info,  Node: Core and Builtins<94>,  Next: ライブラリ<95>,  Up: Python 3 11 0 alpha 7

1.26.35.1 Core and Builtins
...........................

   - bpo-47212(1): Raise *note IndentationError: 18ef. instead of *note
     SyntaxError: 189. 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: af4. + 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: afc. + jump.

   - bpo-47120(5): Replace the absolute jump opcode *note
     JUMP_NO_INTERRUPT: 1dbe. by the relative *note
     JUMP_BACKWARD_NO_INTERRUPT: af1.

   - 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: 543.  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: afd.

   - 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: b6d. by calling *note PyFrame_GetLocals(): 854.

   - 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: ライブラリ<95>,  Next: Core and Builtins<95>,  Prev: Core and Builtins<94>,  Up: Python 3 11 0 alpha 7

1.26.35.2 ライブラリ
....................

   - bpo-46968(1): Check for the existence of the "sys/auxv.h" header in
     *note faulthandler: 5b. 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<95>,  Next: ライブラリ<96>,  Prev: ライブラリ<95>,  Up: Python 3 11 0 alpha 7

1.26.35.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: 1d2. and *note
     bytearray: 1d1. by 30%.  Patch by Kumar Aditya.

   - bpo-47009(4): Improved the performance of *note list.append(): abf.
     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: ライブラリ<96>,  Next: Core and Builtins<96>,  Prev: Core and Builtins<95>,  Up: Python 3 11 0 alpha 7

1.26.35.4 ライブラリ
....................

   - bpo-46829(1): Deprecate passing a message into *note
     asyncio.Future.cancel(): 1dc2. and *note asyncio.Task.cancel():
     6df.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46829


File: python.info,  Node: Core and Builtins<96>,  Next: ライブラリ<97>,  Prev: ライブラリ<96>,  Up: Python 3 11 0 alpha 7

1.26.35.5 Core and Builtins
...........................

   - bpo-46993(1): Speed up *note bytearray: 1d1. creation from *note
     list: 4e0. and *note tuple: 1d9. 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: 353. calling convention.  Patch by Kumar Aditya.

   - bpo-46841(4): Modify *note STORE_SUBSCR: 1dc4. 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: af8,
     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: 1c01, *note setter:
     1c02, and *note deleter: 1c03. 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: ライブラリ<97>,  Next: ドキュメント<30>,  Prev: Core and Builtins<96>,  Up: Python 3 11 0 alpha 7

1.26.35.6 ライブラリ
....................

   - bpo-47208(1): Allow vendors to override ‘CTYPES_MAX_ARGCOUNT’.

   - bpo-23689(2): *note re: c1. 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: 467.

   - 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: c1. 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(): 1185. to only
     resolve names for *note socket.AF_INET: 1dc6. or *note
     socket.AF_INET6: 1dc7. families.  Resolution may not make sense for
     other families, like *note socket.AF_BLUETOOTH: 1dc8. and *note
     socket.AF_UNIX: 1dc9.

   - 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: 172e. 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(): a7f. to PEP
     3134(14).  Patch by Oleg Iarygin.

   - bpo-47095(15): *note hashlib: 6b.'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: 6b.'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: 9cd, part of
     PEP 675(18).  Patch by Jelle Zijlstra.

   - bpo-42885(19): Optimize *note re.search(): 15e8, *note re.split():
     7a6, *note re.findall(): 13d6, *note re.finditer(): 18b2. and *note
     re.sub(): 7a7. for regular expressions starting with ‘\A’ or ‘^’.

   - bpo-23691(20): Protect the *note re.finditer(): 18b2. 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: ab6. constructor and the ‘--metadata-encoding’
     option in the *note zipfile: 13a. CLI to allow reading zipfiles
     using non-standard codecs to encode the filenames within the
     archive.

   - bpo-47000(24): Make *note io.text_encoding(): 1c63. 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(): 1c38. 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(): 1c38. release the GIL when
     computing on larger inputs as *note zlib.crc32(): 1c37. and *note
     hashlib: 6b. do.

     This also boosts performance on Windows as it now uses the zlib
     crc32 implementation for *note binascii.crc32(): 1c38. 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: c1.

   - bpo-47062(30): Implement *note asyncio.Runner: 315. context
     manager.

   - bpo-46382(31): *note dataclass(): 6ec. ‘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(): 896.

   - 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(): a38. 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: e3b. 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(): 115d. 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: a9f.  Patch
     by Shantanu Jain.

   - bpo-46995(47): Deprecate missing *note asyncio.Task.set_name():
     da5. 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(): 469. and *note asyncio.loop.create_task():
     46a.

   - 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: 5b.: 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: a58. value is now always
     available.  Patch by Victor Stinner.

   - bpo-46955(54): Expose ‘asyncio.base_events.Server’ as *note
     asyncio.Server: eda.  Patch by Stefan Zabka.

   - bpo-23325(55): The *note signal: ce. module no longer assumes that
     *note SIG_IGN: 1dca. and *note SIG_DFL: 1dcb. are small int
     singletons.

   - bpo-46932(56): Update bundled libexpat to 2.4.7

   - bpo-46933(57): The *note pwd: ba. module is now optional.  *note
     os.path.expanduser(): ddc. returns the path when the ‘pwd’ module
     is not available.

   - bpo-40059(58): PEP 680(59), the *note tomllib: 105. module.  Adds
     support for parsing TOML.

   - bpo-464471(60): *note asyncio.timeout(): 9fa. and *note
     asyncio.timeout_at(): 1dcc. 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: d0d. to wrap *note
     typing.ParamSpecArgs: baa. and *note dataclasses.InitVar: 1dcd.
     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: 663. 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: 11a. 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(): 1dce. and *note
     sysconfig.get_preferred_scheme(): a84. 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(): aa3. now supports
     evaluating strings as forward references in *note PEP 585 generic
     aliases: aa4.

   - bpo-46607(69): Add *note DeprecationWarning: 2d4. 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: bd. now excludes __future__ imports
     from the module's data items.

   - bpo-46480(71): Add *note typing.assert_type(): a9e.  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(): 33d.

   - 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: 10b5.

   - bpo-40296(76): Fix supporting generic aliases in *note pydoc: bd.

   - 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: 8a. module so that it is consistent
     across all logging functions and, as advertised, similar to the
     ‘stacklevel’ argument used in *note warn(): 18d1.

   - bpo-24959(81): Fix bug where *note unittest: 10f. 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: d7.

        * Raise *note InterfaceError: a72. instead of *note
          ProgrammingError: 584. for ‘SQLITE_MISUSE’ errors.

        * Don't overwrite *note BufferError: 19b9. with *note
          ValueError: 15a. when conversion to BLOB fails.

        * Raise *note ProgrammingError: 584. instead of *note Warning:
          1dcf. if user tries to *note execute(): 7ae. more than one SQL
          statement.

        * Raise *note ProgrammingError: 584. instead of *note
          ValueError: 15a. 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(): a73. and *note deserialize():
     a74. support to *note sqlite3: d7.  Patch by Erlend E. Aasland.

   - bpo-33178(86): Added *note ctypes.BigEndianUnion: 1dd0. and *note
     ctypes.LittleEndianUnion: 1dd1. 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: c1. module, fix a few bugs about capturing
     group.  In rare cases, capturing group gets an incorrect string.
     Patch by Ma Lin.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=47208

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23689

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47167

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47151

   (5) https://bugs.python.org/issue?@action=redirect&bpo=47152

   (6) https://bugs.python.org/issue?@action=redirect&bpo=4833

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27929

   (8) https://bugs.python.org/issue?@action=redirect&bpo=14265

   (9) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39622

   (11) https://bugs.python.org/issue?@action=redirect&bpo=47101

   (12) https://bugs.python.org/issue?@action=redirect&bpo=47099

   (13) https://bugs.python.org/issue?@action=redirect&bpo=47099

   (14) https://peps.python.org/pep-3134/

   (15) https://bugs.python.org/issue?@action=redirect&bpo=47095

   (16) https://bugs.python.org/issue?@action=redirect&bpo=47098

   (17) https://bugs.python.org/issue?@action=redirect&bpo=47088

   (18) https://peps.python.org/pep-0675/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42885

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23691

   (21) https://bugs.python.org/issue?@action=redirect&bpo=47067

   (22) https://peps.python.org/pep-0590/

   (23) https://bugs.python.org/issue?@action=redirect&bpo=28080

   (24) https://bugs.python.org/issue?@action=redirect&bpo=47000

   (25) https://bugs.python.org/issue?@action=redirect&bpo=42369

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38256

   (27) https://bugs.python.org/issue?@action=redirect&bpo=47066

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39394

   (29) https://bugs.python.org/issue?@action=redirect&bpo=433030

   (30) https://bugs.python.org/issue?@action=redirect&bpo=47062

   (31) https://bugs.python.org/issue?@action=redirect&bpo=46382

   (32) https://bugs.python.org/issue?@action=redirect&bpo=47057

   (33) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (34) https://peps.python.org/pep-0594/

   (35) https://bugs.python.org/issue?@action=redirect&bpo=34790

   (36) https://bugs.python.org/issue?@action=redirect&bpo=47039

   (37) https://bugs.python.org/issue?@action=redirect&bpo=2604

   (38) https://bugs.python.org/issue?@action=redirect&bpo=45150

   (39) https://bugs.python.org/issue?@action=redirect&bpo=34861

   (40) https://bugs.python.org/issue?@action=redirect&bpo=45997

   (41) https://bugs.python.org/issue?@action=redirect&bpo=47022

   (42) https://peps.python.org/pep-0594/

   (43) https://bugs.python.org/issue?@action=redirect&bpo=43253

   (44) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (45) https://bugs.python.org/issue?@action=redirect&bpo=47004

   (46) https://bugs.python.org/issue?@action=redirect&bpo=46998

   (47) https://bugs.python.org/issue?@action=redirect&bpo=46995

   (48) https://bugs.python.org/issue?@action=redirect&bpo=46994

   (49) https://bugs.python.org/issue?@action=redirect&bpo=46981

   (50) https://bugs.python.org/issue?@action=redirect&bpo=46968

   (51) https://bugs.python.org/issue?@action=redirect&bpo=46985

   (52) https://bugs.python.org/issue?@action=redirect&bpo=46968

   (53) https://bugs.python.org/issue?@action=redirect&bpo=46917

   (54) https://bugs.python.org/issue?@action=redirect&bpo=46955

   (55) https://bugs.python.org/issue?@action=redirect&bpo=23325

   (56) https://bugs.python.org/issue?@action=redirect&bpo=46932

   (57) https://bugs.python.org/issue?@action=redirect&bpo=46933

   (58) https://bugs.python.org/issue?@action=redirect&bpo=40059

   (59) https://peps.python.org/pep-0680/

   (60) https://bugs.python.org/issue?@action=redirect&bpo=464471

   (61) https://bugs.python.org/issue?@action=redirect&bpo=46805

   (62) https://bugs.python.org/issue?@action=redirect&bpo=46644

   (63) https://bugs.python.org/issue?@action=redirect&bpo=46581

   (64) https://bugs.python.org/issue?@action=redirect&bpo=45413

   (65) https://bugs.python.org/issue?@action=redirect&bpo=43224

   (66) https://bugs.python.org/issue?@action=redirect&bpo=43224

   (67) https://bugs.python.org/issue?@action=redirect&bpo=46557

   (68) https://bugs.python.org/issue?@action=redirect&bpo=41370

   (69) https://bugs.python.org/issue?@action=redirect&bpo=46607

   (70) https://bugs.python.org/issue?@action=redirect&bpo=26120

   (71) https://bugs.python.org/issue?@action=redirect&bpo=46480

   (72) https://bugs.python.org/issue?@action=redirect&bpo=46421

   (73) https://bugs.python.org/issue?@action=redirect&bpo=46245

   (74) https://bugs.python.org/issue?@action=redirect&bpo=22859

   (75) https://bugs.python.org/issue?@action=redirect&bpo=46170

   (76) https://bugs.python.org/issue?@action=redirect&bpo=40296

   (77) https://bugs.python.org/issue?@action=redirect&bpo=20392

   (78) https://bugs.python.org/issue?@action=redirect&bpo=46030

   (79) https://bugs.python.org/issue?@action=redirect&bpo=44439

   (80) https://bugs.python.org/issue?@action=redirect&bpo=45171

   (81) https://bugs.python.org/issue?@action=redirect&bpo=24959

   (82) https://bugs.python.org/issue?@action=redirect&bpo=44859

   (83) https://peps.python.org/pep-0249/

   (84) https://bugs.python.org/issue?@action=redirect&bpo=44493

   (85) https://bugs.python.org/issue?@action=redirect&bpo=41930

   (86) https://bugs.python.org/issue?@action=redirect&bpo=33178

   (87) https://bugs.python.org/issue?@action=redirect&bpo=43352

   (88) https://bugs.python.org/issue?@action=redirect&bpo=35859


File: python.info,  Node: ドキュメント<30>,  Next: テスト<34>,  Prev: ライブラリ<97>,  Up: Python 3 11 0 alpha 7

1.26.35.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(): 1c38. / *note zlib.adler32(): 1dd3. /
     *note zlib.crc32(): 1c37. functions.

   - bpo-46033(5): Clarify ‘for’ statement execution in its doc.

   - bpo-45790(6): Adjust inaccurate phrasing in *note 拡張の型の定義;
     チュートリアル: 1dd4. about the ‘ob_base’ field and the macros used
     to access its contents.

   - bpo-42340(7): Document that in some circumstances *note
     KeyboardInterrupt: d9a. 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: テスト<34>,  Next: ビルド<36>,  Prev: ドキュメント<30>,  Up: Python 3 11 0 alpha 7

1.26.35.8 テスト
................

   - bpo-47205(1): Skip test for *note sched_getaffinity(): 14cb. and
     *note sched_setaffinity(): 14cf. error case on FreeBSD.

   - bpo-46126(2): Restore 'descriptions' when running tests internally.

   - bpo-47104(3): Rewrite *note asyncio.to_thread(): cbd. tests to use
     *note unittest.IsolatedAsyncioTestCase: 34a.

   - 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(): ed7. 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: ビルド<36>,  Next: Windows<31>,  Prev: テスト<34>,  Up: Python 3 11 0 alpha 7

1.26.35.9 ビルド
................

   - bpo-40280(1): Add configure option *note
     -enable-wasm-dynamic-linking: 1dd7. 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: f9. 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: d7. extension module are found.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46023

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47032

   (5) https://bugs.python.org/issue?@action=redirect&bpo=47024

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46996

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46973

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46917

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45774


File: python.info,  Node: Windows<31>,  Next: macOS<23>,  Prev: ビルド<36>,  Up: Python 3 11 0 alpha 7

1.26.35.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: 9c1. 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<23>,  Next: Tools/Demos<24>,  Prev: Windows<31>,  Up: Python 3 11 0 alpha 7

1.26.35.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: 11a. 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<24>,  Next: C API<33>,  Prev: macOS<23>,  Up: Python 3 11 0 alpha 7

1.26.35.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<33>,  Prev: Tools/Demos<24>,  Up: Python 3 11 0 alpha 7

1.26.35.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(): 1ddc. 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(): f4e.
     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(): 1ddd. and *note
     sys.set_asyncgen_hooks(): 1bc9. 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(): b4c, *note
     PyFloat_Pack4(): b4d, *note PyFloat_Pack8(): b4e, *note
     PyFloat_Unpack2(): b4f, *note PyFloat_Unpack4(): b50. and *note
     PyFloat_Unpack8(): b51.  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.26.36 Python 3.11.0 alpha 6
-----------------------------

'Release date: 2022-03-07'

* Menu:

* Core and Builtins: Core and Builtins<97>.
* ライブラリ: ライブラリ<98>.
* Core and Builtins: Core and Builtins<98>.
* ライブラリ: ライブラリ<99>.
* Core and Builtins: Core and Builtins<99>.
* ライブラリ: ライブラリ<100>.
* Core and Builtins: Core and Builtins<100>.
* ライブラリ: ライブラリ<101>.
* ドキュメント: ドキュメント<31>.
* テスト: テスト<35>.
* ビルド: ビルド<37>.
* Windows: Windows<32>.
* IDLE: IDLE<17>.
* C API: C API<34>.


File: python.info,  Node: Core and Builtins<97>,  Next: ライブラリ<98>,  Up: Python 3 11 0 alpha 6

1.26.36.1 Core and Builtins
...........................

   - bpo-46940(1): Avoid overriding *note AttributeError: 1b4. 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: 59c.

   - bpo-46841(5): Use an oparg to simplify the construction of helpful
     error messages in *note GET_AWAITABLE: 1de0.

   - 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: d36. followed by *note EXTENDED_ARG: 1d3b.

   - 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: 8f2,
     ‘LOAD_METHOD’, and *note STORE_ATTR: 1de1.

   - bpo-46841(10): Use inline cache for ‘BINARY_SUBSCR’.

   - bpo-46841(11): Use inline caching for *note COMPARE_OP: d36.

   - 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: 1de2.

   - 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: 1c7f.

   - 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: 59c. caches inline using a
     new *note CACHE: aeb. instruction.

   - bpo-45107(22): Specialize ‘LOAD_METHOD’ for instances with a dict.

   - bpo-44337(23): Reduce the memory usage of specialized *note
     LOAD_ATTR: 8f2. and *note STORE_ATTR: 1de1. instructions.

   - bpo-46729(24): Add number of sub-exceptions to
     ‘BaseException.__str__()’.

   - bpo-45885(25): Don't un-adapt *note COMPARE_OP: d36. 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: ライブラリ<98>,  Next: Core and Builtins<98>,  Prev: Core and Builtins<97>,  Up: Python 3 11 0 alpha 6

1.26.36.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<98>,  Next: ライブラリ<99>,  Prev: ライブラリ<98>,  Up: Python 3 11 0 alpha 6

1.26.36.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__(): 168f.
     method.  Patch by Jelle Zijlstra.

   - bpo-46072(10): Add more detailed specialization failure statistics
     for *note BINARY_OP: 59c.

   - 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: ライブラリ<99>,  Next: Core and Builtins<99>,  Prev: Core and Builtins<98>,  Up: Python 3 11 0 alpha 6

1.26.36.4 ライブラリ
....................

   - bpo-46323(1): *note ctypes: 2d. 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<99>,  Next: ライブラリ<100>,  Prev: ライブラリ<99>,  Up: Python 3 11 0 alpha 6

1.26.36.5 Core and Builtins
...........................

   - bpo-45923(1): Add a quickened form of *note RESUME: 7ba. that skips
     quickening checks.

   - bpo-46702(2): Specialize *note UNPACK_SEQUENCE: 1de2. for *note
     tuple: 1d9. and *note list: 4e0. 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: ライブラリ<100>,  Next: Core and Builtins<100>,  Prev: Core and Builtins<99>,  Up: Python 3 11 0 alpha 6

1.26.36.6 ライブラリ
....................

   - bpo-40479(1): Add a missing call to ‘va_end()’ in
     ‘Modules/_hashopenssl.c’.

   - bpo-46323(2): Use *note PyObject_Vectorcall(): 968. 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<100>,  Next: ライブラリ<101>,  Prev: ライブラリ<100>,  Up: Python 3 11 0 alpha 6

1.26.36.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(): 1de9, and added a fast path for
     single-digit integers to *note PyLong_FromLongLong(): 1dea.

   ---------- 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: ライブラリ<101>,  Next: ドキュメント<31>,  Prev: Core and Builtins<100>,  Up: Python 3 11 0 alpha 6

1.26.36.8 ライブラリ
....................

   - bpo-25707(1): Fixed a file leak in *note
     xml.etree.ElementTree.iterparse(): 3f2. when the iterator is not
     exhausted.  Patch by Jacob Walls.

   - bpo-46877(2): Export *note unittest.doModuleCleanups(): 1a51. in
     *note unittest: 10f.  Patch by Kumar Aditya.

   - bpo-46848(3): For performance, use the optimized string-searching
     implementations from *note find(): 1dec. and *note rfind(): 1ded.
     for ‘find()’ and ‘rfind()’.

   - bpo-46736(4): *note SimpleHTTPRequestHandler: 235. now uses HTML5
     grammar.  Patch by Donghee Na.

   - bpo-44886(5): Inherit asyncio proactor datagram transport from
     *note asyncio.DatagramTransport: 1d44.

   - bpo-46827(6): Support UDP sockets in *note
     asyncio.loop.sock_connect(): 1185. 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: 29c. if *note ssl.SSLSocket:
     cbf. 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(): 33d. can now work with
     VirtualBox shared folders when running from the guest
     operating-system.

   - bpo-45390(12): Propagate *note asyncio.CancelledError: 6e0. message
     from inner task to outer awaiter.

   - bpo-46756(13): Fix a bug in *note
     urllib.request.HTTPPasswordMgr.find_user_password(): 1dee. and
     *note
     urllib.request.HTTPPasswordMgrWithPriorAuth.is_authenticated():
     1def. 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(): 1df0. and *note
     random.normalvariate(): 1df1. 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: 3b. behavior on negative jump
     offsets.

   - bpo-46333(17): The ‘__repr__()’ method of *note typing.ForwardRef:
     1df2. now includes the ‘module’ parameter of ‘typing.ForwardRef’
     when it is set.

   - bpo-46643(18): In *note typing.get_type_hints(): aa3, support
     evaluating stringified ‘ParamSpecArgs’ and ‘ParamSpecKwargs’
     annotations.  Patch by Gregory Beauregard.

   - bpo-45863(19): When the *note tarfile: e7. 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: 29b. definitions.  It had confusing semantics
     when specifying totality, and was largely unused.  Patch by
     Jingchen Ye.

   - bpo-46676(21): Make *note typing.ParamSpec: 2a0. 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(): 9f9. when
     initial type check fails.

   - bpo-46659(24): The *note calendar.LocaleTextCalendar: b2e. and
     *note calendar.LocaleHTMLCalendar: b2f. classes now use *note
     locale.getlocale(): 23d, instead of using *note
     locale.getdefaultlocale(): 23e, if no locale is specified.  Patch
     by Victor Stinner.

   - bpo-46659(25): The *note locale.getdefaultlocale(): 23e. function
     is deprecated and will be removed in Python 3.13.  Use *note
     locale.setlocale(): 23c, *note locale.getpreferredencoding(False):
     94c. and *note locale.getlocale(): 23d. functions instead.  Patch
     by Victor Stinner.

   - bpo-46655(26): In *note typing.get_type_hints(): aa3, 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: 12e. module.  Now, instantiating an
     *note xml.etree.ElementTree.XMLParser: e1c. with a ‘target=None’
     keyword provides a default *note xml.etree.ElementTree.TreeBuilder:
     e1d. target as the Python implementation does.

   - bpo-46626(28): Expose Linux's ‘IP_BIND_ADDRESS_NO_PORT’ option in
     *note socket: d4.

   - 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(): aa6.

     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: 4f5. object as a context manager.

   - bpo-46534(33): Implement PEP 673(34) *note typing.Self: 9ca.  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: a9b. and *note
     typing.assert_never(): a9a.  Patch by Jelle Zijlstra.

   - bpo-46333(37): The ‘__eq__()’ and ‘__hash__()’ methods of *note
     typing.ForwardRef: 1df2. 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: d8. module now handles certificates
     with bit strings in DN correctly.

   - bpo-46195(40): *note typing.get_type_hints(): aa3. 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: a23. to ‘re.__all__’ and
     documented it.  Add ‘NOFLAG’ to indicate no flags being set.

   - bpo-45898(42): *note ctypes: 2d. 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(): 1df3. method
     when using 'fileobj' argument: position in the 'fileobj' was
     advanced forward which made it unreadable with *note
     tarfile.TarFile.open(): 1df4.

   - bpo-44011(45): Reimplement SSL/TLS support in asyncio, borrow the
     implementation from uvloop library.

   - bpo-41086(46): Make the *note configparser.ConfigParser: 6ea.
     constructor raise *note TypeError: 29c. if the ‘interpolation’
     parameter is not of type ‘configparser.Interpolation’

   - bpo-29418(47): Implement *note inspect.ismethodwrapper(): a3e. and
     fix *note inspect.isroutine(): 1df5. for cases where methodwrapper
     is given.  Patch by Hakan Çelik.

   - bpo-14156(48): argparse.FileType now supports an argument of '-' in
     binary mode, returning the .buffer attribute of
     sys.stdin/sys.stdout as appropriate.  Modes including 'x' and 'a'
     are treated equivalently to 'w' when argument is '-'.  Patch
     contributed by Josh Rosenberg

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25707

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46877

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46848

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46736

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44886

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46827

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46811

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46252

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46784

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46786

   (11) https://bugs.python.org/issue?@action=redirect&bpo=39327

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45390

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46756

   (14) https://bugs.python.org/issue?@action=redirect&bpo=46737

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46752

   (16) https://bugs.python.org/issue?@action=redirect&bpo=46724

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46333

   (18) https://bugs.python.org/issue?@action=redirect&bpo=46643

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45863

   (20) https://bugs.python.org/issue?@action=redirect&bpo=46066

   (21) https://bugs.python.org/issue?@action=redirect&bpo=46676

   (22) https://bugs.python.org/issue?@action=redirect&bpo=46323

   (23) https://bugs.python.org/issue?@action=redirect&bpo=46672

   (24) https://bugs.python.org/issue?@action=redirect&bpo=46659

   (25) https://bugs.python.org/issue?@action=redirect&bpo=46659

   (26) https://bugs.python.org/issue?@action=redirect&bpo=46655

   (27) https://bugs.python.org/issue?@action=redirect&bpo=45948

   (28) https://bugs.python.org/issue?@action=redirect&bpo=46626

   (29) https://bugs.python.org/issue?@action=redirect&bpo=46521

   (30) https://bugs.python.org/issue?@action=redirect&bpo=46571

   (31) https://bugs.python.org/issue?@action=redirect&bpo=46400

   (32) https://bugs.python.org/issue?@action=redirect&bpo=46556

   (33) https://bugs.python.org/issue?@action=redirect&bpo=46534

   (34) https://peps.python.org/pep-0673/

   (35) https://bugs.python.org/issue?@action=redirect&bpo=46522

   (36) https://bugs.python.org/issue?@action=redirect&bpo=46475

   (37) https://bugs.python.org/issue?@action=redirect&bpo=46333

   (38) https://bugs.python.org/issue?@action=redirect&bpo=46246

   (39) https://bugs.python.org/issue?@action=redirect&bpo=46232

   (40) https://bugs.python.org/issue?@action=redirect&bpo=46195

   (41) https://bugs.python.org/issue?@action=redirect&bpo=31369

   (42) https://bugs.python.org/issue?@action=redirect&bpo=45898

   (43) https://bugs.python.org/issue?@action=redirect&bpo=44953

   (44) https://bugs.python.org/issue?@action=redirect&bpo=44289

   (45) https://bugs.python.org/issue?@action=redirect&bpo=44011

   (46) https://bugs.python.org/issue?@action=redirect&bpo=41086

   (47) https://bugs.python.org/issue?@action=redirect&bpo=29418

   (48) https://bugs.python.org/issue?@action=redirect&bpo=14156


File: python.info,  Node: ドキュメント<31>,  Next: テスト<35>,  Prev: ライブラリ<101>,  Up: Python 3 11 0 alpha 6

1.26.36.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: テスト<35>,  Next: ビルド<37>,  Prev: ドキュメント<31>,  Up: Python 3 11 0 alpha 6

1.26.36.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: ビルド<37>,  Next: Windows<32>,  Prev: テスト<35>,  Up: Python 3 11 0 alpha 6

1.26.36.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: b5c.  Patch by Kumar Aditya.

   - bpo-40280(6): Fix wasm32-emscripten test failures and platform
     issues.  - Disable syscalls that are not supported or don't work,
     e.g.  wait, getrusage, prlimit, mkfifo, mknod, setres[gu]id,
     setgroups.  - Use fd_count to count open fds.  - Add more checks
     for subprocess and fork.  - Add workarounds for missing
     _multiprocessing and failing socket.accept().  - Enable bzip2.  -
     Disable large file support.  - Disable signal.alarm.

   - bpo-46430(7): Intern strings in deep-frozen modules.  Patch by
     Kumar Aditya.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46860

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46656

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46656

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46640

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46608

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46430


File: python.info,  Node: Windows<32>,  Next: IDLE<17>,  Prev: ビルド<37>,  Up: Python 3 11 0 alpha 6

1.26.36.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<34>,  Prev: Windows<32>,  Up: Python 3 11 0 alpha 6

1.26.36.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<34>,  Prev: IDLE<17>,  Up: Python 3 11 0 alpha 6

1.26.36.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: b6d. 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(): 82d,
     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.26.37 Python 3.11.0 alpha 5
-----------------------------

'Release date: 2022-02-03'

* Menu:

* Core and Builtins: Core and Builtins<101>.
* ライブラリ: ライブラリ<102>.
* Core and Builtins: Core and Builtins<102>.
* ライブラリ: ライブラリ<103>.
* ビルド: ビルド<38>.
* Core and Builtins: Core and Builtins<103>.
* ライブラリ: ライブラリ<104>.
* ドキュメント: ドキュメント<32>.
* テスト: テスト<36>.
* ビルド: ビルド<39>.
* Windows: Windows<33>.
* macOS: macOS<24>.
* IDLE: IDLE<18>.
* C API: C API<35>.


File: python.info,  Node: Core and Builtins<101>,  Next: ライブラリ<102>,  Up: Python 3 11 0 alpha 5

1.26.37.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: 44a. 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(): 32e. to ‘__trunc__()’
     is now deprecated.  Calling ‘int(a)’ when ‘type(a)’ implements
     ‘__trunc__()’ but not ‘__int__()’ or ‘__index__()’ now raises a
     *note DeprecationWarning: 2d4.

   - bpo-46458(5): Reorder code emitted by the compiler for a *note try:
     adb.-*note except: 44e. block so that the *note else: 328. 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(): 1839. 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: afa. and *note SWAP: afb.
     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(): 1dfe. 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: ライブラリ<102>,  Next: Core and Builtins<102>,  Prev: Core and Builtins<101>,  Up: Python 3 11 0 alpha 5

1.26.37.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<102>,  Next: ライブラリ<103>,  Prev: ライブラリ<102>,  Up: Python 3 11 0 alpha 5

1.26.37.3 Core and Builtins
...........................

   - bpo-46361(1): Ensure that "small" integers created by *note
     int.from_bytes(): 19af. and *note decimal.Decimal: 1cd. 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: ライブラリ<103>,  Next: ビルド<38>,  Prev: Core and Builtins<102>,  Up: Python 3 11 0 alpha 5

1.26.37.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: ビルド<38>,  Next: Core and Builtins<103>,  Prev: ライブラリ<103>,  Up: Python 3 11 0 alpha 5

1.26.37.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<103>,  Next: ライブラリ<104>,  Prev: ビルド<38>,  Up: Python 3 11 0 alpha 5

1.26.37.6 Core and Builtins
...........................

   - bpo-44024(1): Improve the *note TypeError: 29c. message for
     non-string second arguments passed to the built-in functions *note
     getattr(): f93. and *note hasattr(): 8e7.  Patch by Géry Ogam.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44024


File: python.info,  Node: ライブラリ<104>,  Next: ドキュメント<32>,  Prev: Core and Builtins<103>,  Up: Python 3 11 0 alpha 5

1.26.37.7 ライブラリ
....................

   - bpo-46624(1): Restore support for non-integer arguments of *note
     random.randrange(): c45. and *note random.randint(): 15ea.

   - 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(): aa3, support
     evaluating bare stringified ‘ClassVar’ annotations.  Patch by
     Gregory Beauregard.

   - bpo-46544(5): Don't leak ‘x’ & ‘uspace’ intermediate vars in *note
     textwrap.TextWrapper: 137b.

   - 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: 10f. 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(): aa3, support
     evaluating stringified ‘ClassVar’ and ‘Final’ annotations inside
     ‘Annotated’.  Patch by Gregory Beauregard.

   - bpo-46510(10): Add missing test for *note types.TracebackType: ebc.
     and *note types.FrameType: 1e05.  Calculate them directly from the
     caught exception without calling *note sys.exc_info(): a7f.

   - bpo-46491(11): Allow *note typing.Annotated: d0d. to wrap *note
     typing.Final: 775. and *note typing.ClassVar: 774.  Patch by
     Gregory Beauregard.

   - bpo-46483(12): Remove *note __class_getitem__(): b26. from *note
     pathlib.PurePath: 8bb. as this class was not supposed to be
     generic.

   - bpo-46436(13): Fix command-line option ‘-d’/‘--directory’ in module
     *note http.server: 75. 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: 29c.
     with a relevant error message on invalid arg.  Previously it
     allowed a cryptic *note AttributeError: 1b4. 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: bcb. 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(): 156e.

   - 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__: 1e06. 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(): a9d.  Patch by Jelle
     Zijlstra.

   - bpo-40280(24): *note subprocess: df. 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(): 4fd. by
     removing an unnecessary check for special entries.

   - bpo-29688(27): Document *note pathlib.Path.absolute(): 1c4d. (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(): dcb. 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: a26. type subclassing an existing ‘Enum’ with
     ‘_member_names_’ using ‘enum.Enum.__call__()’.

   - bpo-43118(31): Fix a bug in *note inspect.signature(): 4c4. 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(): 1039. did not close the coroutine.  Patch
     by Kumar Aditya.

   - bpo-21987(33): Fix an issue with *note tarfile.TarFile.getmember():
     1e07. getting a directory name with a trailing slash.

   - bpo-46124(34): Update *note zoneinfo: 13d. to rely on
     importlib.resources traversable API.

   - bpo-46103(35): Now *note inspect.getmembers(): 1e08. 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: 1e6. argument's default is
     ‘argparse.SUPPRESS’ and it has ‘help’ specified.  Patch by Felix
     Fontein.

   - bpo-44791(37): Fix substitution of *note ParamSpec: 2a0. in *note
     Concatenate: ba8. with different parameter expressions.
     Substitution with a list of types returns now a tuple of types.
     Substitution with ‘Concatenate’ returns now a ‘Concatenate’ with
     concatenated lists of arguments.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46624

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46591

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46565

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46553

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46544

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46487

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45173

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45162

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46539

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46510

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46491

   (12) https://bugs.python.org/issue?@action=redirect&bpo=46483

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46436

   (14) https://bugs.python.org/issue?@action=redirect&bpo=41403

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46474

   (16) https://bugs.python.org/issue?@action=redirect&bpo=46474

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46470

   (18) https://bugs.python.org/issue?@action=redirect&bpo=46469

   (19) https://bugs.python.org/issue?@action=redirect&bpo=41906

   (20) https://bugs.python.org/issue?@action=redirect&bpo=46422

   (21) https://bugs.python.org/issue?@action=redirect&bpo=46434

   (22) https://bugs.python.org/issue?@action=redirect&bpo=43869

   (23) https://bugs.python.org/issue?@action=redirect&bpo=46414

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (25) https://bugs.python.org/issue?@action=redirect&bpo=40066

   (26) https://bugs.python.org/issue?@action=redirect&bpo=46316

   (27) https://bugs.python.org/issue?@action=redirect&bpo=29688

   (28) https://bugs.python.org/issue?@action=redirect&bpo=43012

   (29) https://bugs.python.org/issue?@action=redirect&bpo=46258

   (30) https://bugs.python.org/issue?@action=redirect&bpo=46242

   (31) https://bugs.python.org/issue?@action=redirect&bpo=43118

   (32) https://bugs.python.org/issue?@action=redirect&bpo=26552

   (33) https://bugs.python.org/issue?@action=redirect&bpo=21987

   (34) https://bugs.python.org/issue?@action=redirect&bpo=46124

   (35) https://bugs.python.org/issue?@action=redirect&bpo=46103

   (36) https://bugs.python.org/issue?@action=redirect&bpo=46080

   (37) https://bugs.python.org/issue?@action=redirect&bpo=44791


File: python.info,  Node: ドキュメント<32>,  Next: テスト<36>,  Prev: ライブラリ<104>,  Up: Python 3 11 0 alpha 5

1.26.37.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: テスト<36>,  Next: ビルド<39>,  Prev: ドキュメント<32>,  Up: Python 3 11 0 alpha 5

1.26.37.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: 1125.: 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(): 6c3.

   - bpo-40280(10): Add ‘test.support.requires_subprocess()’ decorator
     to mark tests which require working *note subprocess: df. 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: ビルド<39>,  Next: Windows<33>,  Prev: テスト<36>,  Up: Python 3 11 0 alpha 5

1.26.37.10 ビルド
.................

   - bpo-46602(1): Tidied up configure.ac so that conftest.c is
     truncated rather than appended.  This assists in the case where the
     'rm' of conftest.c fails to happen between tests.  Downstream
     issues such as a clobbered SOABI can result.

   - bpo-46600(2): Fix the test checking if the C compiler supports
     ‘-Og’ option in the ‘./configure’ script to also use ‘-Og’ on clang
     which supports it.  Patch by Victor Stinner.

   - bpo-38472(3): Fix GCC detection in setup.py when cross-compiling.
     The C compiler is now run with LC_ALL=C. Previously, the detection
     failed with a German locale.

   - bpo-46513(4): ‘configure’ no longer uses ‘AC_C_CHAR_UNSIGNED’ macro
     and ‘pyconfig.h’ no longer defines reserved symbol
     ‘__CHAR_UNSIGNED__’.

   - bpo-46471(5): Use global singletons for single byte bytes objects
     in deepfreeze.

   - bpo-46443(6): Deepfreeze now uses cached small integers as it saves
     some space for common small integers.

   - bpo-46429(7): Merge all deep-frozen files into one for space
     savings.  Patch by Kumar Aditya.

   - bpo-45569(8): The build now defaults to using 30-bit digits for
     Python integers.  Previously either 15-bit or 30-bit digits would
     be selected, depending on the platform.  15-bit digits may still be
     selected using the ‘--enable-big-digits=15’ option to the
     ‘configure’ script, or by defining ‘PYLONG_BITS_IN_DIGIT’ in
     ‘pyconfig.h’.

   - bpo-45925(9): Update Windows installer to use SQLite 3.37.2.

   - bpo-43112(10): Detect musl libc as a separate SOABI (tagged as
     ‘linux-musl’).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46602

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46600

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38472

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46513

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46471

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46443

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46429

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45569

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45925

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43112


File: python.info,  Node: Windows<33>,  Next: macOS<24>,  Prev: ビルド<39>,  Up: Python 3 11 0 alpha 5

1.26.37.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<24>,  Next: IDLE<18>,  Prev: Windows<33>,  Up: Python 3 11 0 alpha 5

1.26.37.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<35>,  Prev: macOS<24>,  Up: Python 3 11 0 alpha 5

1.26.37.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<35>,  Prev: IDLE<18>,  Up: Python 3 11 0 alpha 5

1.26.37.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: b3f. 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.26.38 Python 3.11.0 alpha 4
-----------------------------

'リリース日: 2022-01-13'

* Menu:

* Core and Builtins: Core and Builtins<104>.
* ライブラリ: ライブラリ<105>.
* Core and Builtins: Core and Builtins<105>.
* ライブラリ: ライブラリ<106>.
* Core and Builtins: Core and Builtins<106>.
* ライブラリ: ライブラリ<107>.
* Core and Builtins: Core and Builtins<107>.
* ライブラリ: ライブラリ<108>.
* ドキュメント: ドキュメント<33>.
* テスト: テスト<37>.
* ビルド: ビルド<40>.
* Windows: Windows<34>.
* macOS: macOS<25>.
* C API: C API<36>.


File: python.info,  Node: Core and Builtins<104>,  Next: ライブラリ<105>,  Up: Python 3 11 0 alpha 4

1.26.38.1 Core and Builtins
...........................

   - bpo-46070(1): *note Py_EndInterpreter(): 1a8f. 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(): 18bd. 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: ライブラリ<105>,  Next: Core and Builtins<105>,  Prev: Core and Builtins<104>,  Up: Python 3 11 0 alpha 4

1.26.38.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<105>,  Next: ライブラリ<106>,  Prev: ライブラリ<105>,  Up: Python 3 11 0 alpha 4

1.26.38.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: ライブラリ<106>,  Next: Core and Builtins<106>,  Prev: Core and Builtins<105>,  Up: Python 3 11 0 alpha 4

1.26.38.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<106>,  Next: ライブラリ<107>,  Prev: ライブラリ<106>,  Up: Python 3 11 0 alpha 4

1.26.38.5 Core and Builtins
...........................

   - bpo-46055(1): Speed up shifting operation involving integers less
     than *note PyLong_BASE: 1e16.  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: 189. 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: 1d9b. and *note
     POP_JUMP_IF_NONE: 1d9a. opcodes to speed up conditional jumps.

   - bpo-45654(14): Deepfreeze *note runpy: c6, 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: ライブラリ<107>,  Next: Core and Builtins<107>,  Prev: Core and Builtins<106>,  Up: Python 3 11 0 alpha 4

1.26.38.6 ライブラリ
....................

   - bpo-46000(1): Improve compatibility of the *note curses: 2e. module
     with NetBSD curses.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46000


File: python.info,  Node: Core and Builtins<107>,  Next: ライブラリ<108>,  Prev: ライブラリ<107>,  Up: Python 3 11 0 alpha 4

1.26.38.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(): 1d3.
     function did not always raise a *note SyntaxError: 189. 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: 432. needs to define a ‘__init__()’ method if it defines a
     ‘__new__()’ method with additional keyword parameters.

   - bpo-43931(7): Added the *note Py_Version: 5b5. constant which bears
     the same value as *note PY_VERSION_HEX: 5b6.  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: ライブラリ<108>,  Next: ドキュメント<33>,  Prev: Core and Builtins<107>,  Up: Python 3 11 0 alpha 4

1.26.38.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(): a80. method which
     returns the active exception instance.

   - bpo-46307(3): Add *note string.Template.is_valid(): a7b. and *note
     string.Template.get_identifiers(): a7a. methods.

   - bpo-46306(4): Assume that *note types.CodeType: 2ed. always has
     ‘types.CodeType.co_firstlineno’ in *note doctest: 3d.

   - bpo-40479(5): Fix *note hashlib: 6b. '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: 2a0.
     and *note typing.TypeVar: 29f.  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__(): 1e1a.

   - 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: 11a. 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(): ac2.

   - 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(): 2df.
     and *note iglob(): be5. to match hidden files and directories when
     using special characters like ‘*’, ‘**’, ‘?’ and ‘[]’.

   - bpo-20369(23): *note concurrent.futures.wait(): 1e1b. 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: 944.

   - 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: 15a.
     with clear message when trying to render usage for an empty
     mutually exclusive group.  Previously it raised a cryptic *note
     IndexError: 18ed.

   - bpo-45615(29): Functions in the *note traceback: 107. module raise
     *note TypeError: 29c. rather than *note AttributeError: 1b4. when
     an exception argument is not of type *note BaseException: 9bd.

   - bpo-16594(30): Add allow allow_reuse_port flag in socketserver.

   - bpo-27718(31): Fix help for the *note signal: ce. module.  Some
     functions (e.g.  ‘signal()’ and ‘getsignal()’) were omitted.

   - bpo-46032(32): The ‘registry()’ method of *note
     functools.singledispatch(): a2f. 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: 81, patch by Kumar
     Aditya.

   - bpo-46018(35): Ensure that *note math.expm1(): 15ab. does not raise
     on underflow.

   - bpo-46016(36): Adding ‘F_DUP2FD’ and ‘F_DUP2FD_CLOEXEC’ constants
     from FreeBSD into the *note fcntl: 5c. module.

   - bpo-45755(37): *note typing: 10d. 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: 1e1c. objects, patch by Kumar Aditya.

   - bpo-45643(42): Added *note signal.SIGSTKFLT: 1e1d. on platforms
     where this signal is defined.

   - bpo-44092(43): Fetch across rollback no longer raises *note
     InterfaceError: a72.  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: c12, keep
     these names as deprecated aliases.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46342

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46328

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46307

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46306

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40479

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46070

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46244

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46278

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46269

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46266

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46257

   (12) https://bugs.python.org/issue?@action=redirect&bpo=41011

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46239

   (14) https://bugs.python.org/issue?@action=redirect&bpo=46238

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46222

   (16) https://bugs.python.org/issue?@action=redirect&bpo=37295

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46176

   (18) https://bugs.python.org/issue?@action=redirect&bpo=43424

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45321

   (20) https://bugs.python.org/issue?@action=redirect&bpo=46125

   (21) https://bugs.python.org/issue?@action=redirect&bpo=46118

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37578

   (23) https://bugs.python.org/issue?@action=redirect&bpo=20369

   (24) https://bugs.python.org/issue?@action=redirect&bpo=46105

   (25) https://bugs.python.org/issue?@action=redirect&bpo=44893

   (26) https://bugs.python.org/issue?@action=redirect&bpo=22815

   (27) https://bugs.python.org/issue?@action=redirect&bpo=22047

   (28) https://bugs.python.org/issue?@action=redirect&bpo=26952

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45615

   (30) https://bugs.python.org/issue?@action=redirect&bpo=16594

   (31) https://bugs.python.org/issue?@action=redirect&bpo=27718

   (32) https://bugs.python.org/issue?@action=redirect&bpo=46032

   (33) https://bugs.python.org/issue?@action=redirect&bpo=46014

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27062

   (35) https://bugs.python.org/issue?@action=redirect&bpo=46018

   (36) https://bugs.python.org/issue?@action=redirect&bpo=46016

   (37) https://bugs.python.org/issue?@action=redirect&bpo=45755

   (38) https://bugs.python.org/issue?@action=redirect&bpo=45874

   (39) https://bugs.python.org/issue?@action=redirect&bpo=44674

   (40) https://bugs.python.org/issue?@action=redirect&bpo=23882

   (41) https://bugs.python.org/issue?@action=redirect&bpo=25066

   (42) https://bugs.python.org/issue?@action=redirect&bpo=45643

   (43) https://bugs.python.org/issue?@action=redirect&bpo=44092

   (44) https://bugs.python.org/issue?@action=redirect&bpo=42413


File: python.info,  Node: ドキュメント<33>,  Next: テスト<37>,  Prev: ライブラリ<108>,  Up: Python 3 11 0 alpha 4

1.26.38.9 ドキュメント
......................

   - bpo-46196(1): Document method *note cmd.Cmd.columnize(): 1e1f.

   - bpo-46120(2): State that ‘|’ is preferred for readability over
     ‘Union’ in the *note typing: 10d. 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():
     1e20. 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: テスト<37>,  Next: ビルド<40>,  Prev: ドキュメント<33>,  Up: Python 3 11 0 alpha 4

1.26.38.10 テスト
.................

   - bpo-46296(1): Add a test case for *note enum: 59. 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: 34a. 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: ビルド<40>,  Next: Windows<34>,  Prev: テスト<37>,  Up: Python 3 11 0 alpha 4

1.26.38.11 ビルド
.................

   - bpo-44133(1): When Python is configured with *note
     -without-static-libpython: c68, 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:
     c3e, 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(): 1342.

   - bpo-46263(6): ‘configure’ no longer sets ‘MULTIARCH’ on FreeBSD
     platforms.

   - bpo-46106(7): Updated OpenSSL to 1.1.1m in Windows builds, macOS
     installer builds, and CI. Patch by Kumar Aditya.

   - bpo-46088(8): Automatically detect or install bootstrap Python
     runtime when building from Visual Studio.

   - bpo-46072(9): Add a -with-pystats configure option to turn on
     internal statistics gathering.

   - bpo-40280(10): A new directory ‘Tools/wasm’ contains
     WebAssembly-related helpers like ‘config.site’ override for
     wasm32-emscripten, wasm assets generator to bundle the stdlib, and
     a README.

   - bpo-46023(11): ‘makesetup’ no longer builds extensions that have
     been marked as 'disabled'.  This allows users to disable modules in
     ‘Modules/Setup.local’.

   - bpo-45949(12): Use pure Python ‘freeze_module’ for all but
     importlib bootstrap files.  ‘--with-freeze-module’ ‘configure’
     option is no longer needed for cross builds.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44133

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44133

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46315

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46263

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46106

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46088

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46072

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46023

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45949


File: python.info,  Node: Windows<34>,  Next: macOS<25>,  Prev: ビルド<40>,  Up: Python 3 11 0 alpha 4

1.26.38.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<25>,  Next: C API<36>,  Prev: Windows<34>,  Up: Python 3 11 0 alpha 4

1.26.38.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<36>,  Prev: macOS<25>,  Up: Python 3 11 0 alpha 4

1.26.38.14 C API
................

   - bpo-46236(1): Fix a bug in *note PyFunction_GetAnnotations(): 1d54.
     that caused it to return a ‘tuple’ instead of a ‘dict’.

   - bpo-46140(2): *note PyBuffer_GetPointer(): b40, *note
     PyBuffer_FromContiguous(): b43, *note PyBuffer_ToContiguous(): b42.
     and *note PyMemoryView_FromBuffer(): b48. 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(): 1e26. is a no-op now.

   - bpo-45855(4): Replaced deprecated usage of
     ‘PyImport_ImportModuleNoBlock()’ with *note
     PyImport_ImportModule(): 3ab. 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.26.39 Python 3.11.0 alpha 3
-----------------------------

'Release date: 2021-12-08'

* Menu:

* Core and Builtins: Core and Builtins<108>.
* ライブラリ: ライブラリ<109>.
* Core and Builtins: Core and Builtins<109>.
* ライブラリ: ライブラリ<110>.
* ドキュメント: ドキュメント<34>.
* テスト: テスト<38>.
* ビルド: ビルド<41>.
* Windows: Windows<35>.
* macOS: macOS<26>.
* C API: C API<37>.


File: python.info,  Node: Core and Builtins<108>,  Next: ライブラリ<109>,  Up: Python 3 11 0 alpha 3

1.26.39.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: 189. 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: 9bd.  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: 1e29. 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(): a7f. and
     *note PyErr_GetExcInfo(): b59. if the exception instance is
     modified while the exception is handled, as well as *note
     PyErr_SetExcInfo(): b58, 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: ライブラリ<109>,  Next: Core and Builtins<109>,  Prev: Core and Builtins<108>,  Up: Python 3 11 0 alpha 3

1.26.39.2 ライブラリ
....................

   - bpo-45614(1): Fix *note traceback: 107. 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<109>,  Next: ライブラリ<110>,  Prev: ライブラリ<109>,  Up: Python 3 11 0 alpha 3

1.26.39.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: af0. 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: 59c.
     by indexing into an array of function pointers (rather than
     switching on the oparg).

   - bpo-42540(12): Fix crash when *note os.fork(): 6c3. 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: 59c. 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: e2. and *note sysconfig: e4.

   - 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: ライブラリ<110>,  Next: ドキュメント<34>,  Prev: Core and Builtins<109>,  Up: Python 3 11 0 alpha 3

1.26.39.4 ライブラリ
....................

   - bpo-27946(1): Fix possible crash when getting an attribute of *note
     xml.etree.ElementTree.Element: 34b. 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(): 642, 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: 944. and *note
     unittest.TextTestRunner: 1cd8. flush now the output stream more
     often.

   - bpo-45917(5): Added *note math.exp2(): a55.:, 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: 5b. 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: d7. 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(): c0e.

   - bpo-45765(17): In importlib.metadata, fix distribution discovery
     for an empty path.

   - bpo-45757(18): Fix bug where *note dis: 3b. produced an incorrect
     oparg when *note EXTENDED_ARG: 1d3b. 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: 19f. location while the program is running, calling
     the *note importlib.invalidate_caches(): fd3. 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(): f5f. and *note
     types.new_class(): 1521. for *note types.GenericAlias: bcb.
     instance as a base.

   - bpo-45663(23): Fix *note dataclasses.is_dataclass(): 1e2d. for
     dataclasses which are subclasses of *note types.GenericAlias: bcb.

   - bpo-45662(24): Fix the repr of *note dataclasses.InitVar: 1dcd.
     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(): a91. now uses a
     waitable timer which supports high-resolution timers.  Patch by
     Donghee Na and Eryk Sun.

   - bpo-37295(27): Optimize *note math.comb(): ac2. and *note
     math.perm(): ac3.

   - bpo-45514(28): Deprecated legacy functions in *note
     importlib.resources: 7e.

   - bpo-45507(29): Add tests for truncated/missing trailers in
     gzip.decompress implementation.

   - bpo-45359(30): Implement PEP 585(31) for *note
     graphlib.TopologicalSorter: cb7.

   - bpo-44733(32): Add ‘max_tasks_per_child’ to *note
     concurrent.futures.ProcessPoolExecutor: 211.  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(): a3d. , it
     return all members without triggering dynamic lookup via the
     descriptor protocol.  Patch by Weipeng Hong.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27946

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23819

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13236

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45917

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37658

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45876

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44649

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45803

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45837

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45831

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45828

   (13) https://bugs.python.org/issue?@action=redirect&bpo=41735

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45235

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45754

   (16) https://bugs.python.org/issue?@action=redirect&bpo=45766

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45765

   (18) https://bugs.python.org/issue?@action=redirect&bpo=45757

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45644

   (20) https://bugs.python.org/issue?@action=redirect&bpo=45703

   (21) https://bugs.python.org/issue?@action=redirect&bpo=45535

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45664

   (23) https://bugs.python.org/issue?@action=redirect&bpo=45663

   (24) https://bugs.python.org/issue?@action=redirect&bpo=45662

   (25) https://bugs.python.org/issue?@action=redirect&bpo=43137

   (26) https://bugs.python.org/issue?@action=redirect&bpo=45429

   (27) https://bugs.python.org/issue?@action=redirect&bpo=37295

   (28) https://bugs.python.org/issue?@action=redirect&bpo=45514

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45507

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45359

   (31) https://peps.python.org/pep-0585/

   (32) https://bugs.python.org/issue?@action=redirect&bpo=44733

   (33) https://bugs.python.org/issue?@action=redirect&bpo=28806

   (34) https://bugs.python.org/issue?@action=redirect&bpo=43498

   (35) https://bugs.python.org/issue?@action=redirect&bpo=42158

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30533


File: python.info,  Node: ドキュメント<34>,  Next: テスト<38>,  Prev: ライブラリ<110>,  Up: Python 3 11 0 alpha 3

1.26.39.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: 191. 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(): 192f. and *note asdict():
     192e. 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: テスト<38>,  Next: ビルド<41>,  Prev: ドキュメント<34>,  Up: Python 3 11 0 alpha 3

1.26.39.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(): db7. 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: ビルド<41>,  Next: Windows<35>,  Prev: テスト<38>,  Up: Python 3 11 0 alpha 3

1.26.39.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: ce. 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: 39. 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: d7. are
     now detected by ‘configure’ and ‘pkg-config’.  Patch by Erlend E.
     Aasland.

   - bpo-45763(25): The build dependencies for *note zlib: 13c, *note
     bz2: 14, and *note lzma: 8d. are now detected by ‘configure’.

   - bpo-45747(26): gdbm and dbm build dependencies are now detected by
     ‘configure’.

   - bpo-45743(27): On macOS, the build system no longer passes
     ‘search_paths_first’ to the linker.  The flag has been the default
     since Xcode 4 / macOS 10.6.

   - bpo-45723(28): ‘configure.ac’ is now compatible with autoconf 2.71.
     Deprecated checks ‘STDC_HEADERS’ and ‘AC_HEADER_TIME’ have been
     removed.

   - bpo-45723(29): ‘configure’ now prints a warning when pkg-config is
     missing.

   - bpo-45731(30): ‘configure --enable-loadable-sqlite-extensions’ is
     now handled by new ‘PY_SQLITE_ENABLE_LOAD_EXTENSION’ macro instead
     of logic in setup.py.

   - bpo-45723(31): configure.ac now uses custom helper macros and
     ‘AC_CACHE_CHECK’ to simplify and speed up configure runs.

   - bpo-45696(32): Skip the marshal step for frozen modules by
     generating C code that produces a set of ready-to-use code objects.
     This speeds up startup time by another 10% or more.

   - bpo-45561(33): Run smelly.py tool from $(srcdir).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44035

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45950

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45881

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33393

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45866

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41498

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45881

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45886

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45873

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45847

   (16) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45573

   (18) https://bugs.python.org/issue?@action=redirect&bpo=45573

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45573

   (20) https://bugs.python.org/issue?@action=redirect&bpo=45816

   (21) https://bugs.python.org/issue?@action=redirect&bpo=45800

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45798

   (23) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (24) https://bugs.python.org/issue?@action=redirect&bpo=45774

   (25) https://bugs.python.org/issue?@action=redirect&bpo=45763

   (26) https://bugs.python.org/issue?@action=redirect&bpo=45747

   (27) https://bugs.python.org/issue?@action=redirect&bpo=45743

   (28) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45731

   (31) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (32) https://bugs.python.org/issue?@action=redirect&bpo=45696

   (33) https://bugs.python.org/issue?@action=redirect&bpo=45561


File: python.info,  Node: Windows<35>,  Next: macOS<26>,  Prev: ビルド<41>,  Up: Python 3 11 0 alpha 3

1.26.39.8 Windows
.................

   - bpo-46105(1): Fixed calculation of *note sys.path: 19f. 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<26>,  Next: C API<37>,  Prev: Windows<35>,  Up: Python 3 11 0 alpha 3

1.26.39.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<37>,  Prev: macOS<26>,  Up: Python 3 11 0 alpha 3

1.26.39.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.26.40 Python 3.11.0 alpha 2
-----------------------------

'リリース日: 2021-11-05'

* Menu:

* Core and Builtins: Core and Builtins<110>.
* ライブラリ: ライブラリ<111>.
* ドキュメント: ドキュメント<35>.
* テスト: テスト<39>.
* ビルド: ビルド<42>.
* Windows: Windows<36>.
* macOS: macOS<27>.
* IDLE: IDLE<19>.
* C API: C API<38>.


File: python.info,  Node: Core and Builtins<110>,  Next: ライブラリ<111>,  Up: Python 3 11 0 alpha 2

1.26.40.1 Core and Builtins
...........................

   - bpo-45716(1): Improve the *note SyntaxError: 189. 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: c1e. now contains the
     macOS-specific module ‘_scproxy’.

   - bpo-45379(3): Clarify *note ImportError: 1c8. 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 値の比較:
     1e36. 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: 183. 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:
     6de. and *note BaseExceptionGroup: 76d.  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: ライブラリ<111>,  Next: ドキュメント<35>,  Prev: Core and Builtins<110>,  Up: Python 3 11 0 alpha 2

1.26.40.2 ライブラリ
....................

   - bpo-45679(1): Fix caching of multi-value *note typing.Literal: c31.
     ‘Literal[True, 2]’ is no longer equal to ‘Literal[1, 2]’.

   - bpo-42064(2): Convert *note sqlite3: d7. 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: d7. now sets *note
     sqlite3.threadsafety: a71. 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(): 3e7. now correctly raises
     *note MemoryError: 191d. if the underlying SQLite API signals
     memory error.  Patch by Erlend E. Aasland.

   - bpo-45557(7): *note pprint.pprint(): c05. now handles
     'underscore_numbers' correctly.  Previously it was always setting
     it to ‘False’.

   - bpo-44019(8): Add *note operator.call(): 1e38. to
     ‘operator.__all__’.  Patch by Kreusada.

   - bpo-42174(9): *note shutil.get_terminal_size(): 14c4. 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: 1305. is now public, and
     implements the *note importlib.abc.InspectLoader: 1303. interface.
     ‘_NamespaceLoader’ is kept for backward compatibility.

   - bpo-45515(11): Add references to *note zoneinfo: 13d. in the *note
     datetime: 33. documentation, mostly replacing outdated references
     to ‘dateutil.tz’.  Change by Paul Ganssle.

   - bpo-45475(12): Reverted optimization of iterating *note
     gzip.GzipFile: 84f, *note bz2.BZ2File: c41, and *note
     lzma.LZMAFile: 13ba. (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: 1df2. 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(): 1e39.
     crashing with *note UnboundLocalError: 18ee. 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():
     1e3a. 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: e3a. with
     explicit *note asyncio.Lock: e39. 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: 1a5c.  Patch by Vajrasky Kok and
     Donghee Na.

   - bpo-44904(24): Fix bug in the *note doctest: 3d. 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(): 1d89. 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: 2c.

   - 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: 137. 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: 1a5c.
     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: 22e. to work
     properly in OSs that don't support the ‘TCP_NODELAY’ socket option.

   - bpo-45243(34): Add *note setlimit(): a6f. and *note getlimit():
     a70. to *note sqlite3.Connection: 3e6. for setting and getting
     SQLite limits by connection basis.  Patch by Erlend E. Aasland.

   - bpo-45320(35): Removed from the *note inspect: 81. module:

        * 
          the ‘getargspec’ function, deprecated since Python 3.0;

               use *note inspect.signature(): 4c4. or *note
               inspect.getfullargspec(): b24. instead.

        * the ‘formatargspec’ function, deprecated since Python 3.5; use
          the *note inspect.signature(): 4c4. 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(): b25. 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: e9. 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(): a06. context
     manager to change the current working directory and then restore it
     on exit.  Simple wrapper around *note chdir(): a07.

   - bpo-24139(39): Add support for SQLite extended result codes in
     *note sqlite3.Error: 1e3b.  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: 1ce. instance ‘f’ passes an ‘isinstance(f,
     typing.SupportsInt)’ check.

   - bpo-40321(42): Adds support for HTTP 308 redirects to *note urllib:
     111.  See RFC 7538(43) for details.  Patch by Jochem
     Schulenklopper.

   - bpo-41374(44): Ensure that ‘socket.TCP_*’ constants are exposed on
     Cygwin 3.1.6 and greater.

   - bpo-35970(45): Add help flag to the base64 module's command line
     interface.  Patch contributed by Robert Kuska.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45679

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42064

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45438

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45613

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45574

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45581

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45557

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44019

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42174

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35673

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45515

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45475

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43787

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45489

   (15) https://bugs.python.org/issue?@action=redirect&bpo=42222

   (16) https://bugs.python.org/issue?@action=redirect&bpo=45428

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45467

   (18) https://bugs.python.org/issue?@action=redirect&bpo=45461

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45239

   (20) https://bugs.python.org/issue?@action=redirect&bpo=45417

   (21) https://bugs.python.org/issue?@action=redirect&bpo=45249

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45416

   (23) https://bugs.python.org/issue?@action=redirect&bpo=20028

   (24) https://bugs.python.org/issue?@action=redirect&bpo=44904

   (25) https://bugs.python.org/issue?@action=redirect&bpo=45406

   (26) https://bugs.python.org/issue?@action=redirect&bpo=45411

   (27) https://bugs.python.org/issue?@action=redirect&bpo=10716

   (28) https://bugs.python.org/issue?@action=redirect&bpo=27580

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45262

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45386

   (31) https://bugs.python.org/issue?@action=redirect&bpo=20028

   (32) https://bugs.python.org/issue?@action=redirect&bpo=45343

   (33) https://bugs.python.org/issue?@action=redirect&bpo=45328

   (34) https://bugs.python.org/issue?@action=redirect&bpo=45243

   (35) https://bugs.python.org/issue?@action=redirect&bpo=45320

   (36) https://bugs.python.org/issue?@action=redirect&bpo=45192

   (37) https://bugs.python.org/issue?@action=redirect&bpo=45160

   (38) https://bugs.python.org/issue?@action=redirect&bpo=25625

   (39) https://bugs.python.org/issue?@action=redirect&bpo=24139

   (40) https://bugs.python.org/issue?@action=redirect&bpo=24444

   (41) https://bugs.python.org/issue?@action=redirect&bpo=44547

   (42) https://bugs.python.org/issue?@action=redirect&bpo=40321

   (43) https://datatracker.ietf.org/doc/html/rfc7538.html

   (44) https://bugs.python.org/issue?@action=redirect&bpo=41374

   (45) https://bugs.python.org/issue?@action=redirect&bpo=35970


File: python.info,  Node: ドキュメント<35>,  Next: テスト<39>,  Prev: ライブラリ<111>,  Up: Python 3 11 0 alpha 2

1.26.40.3 ドキュメント
......................

   - bpo-45726(1): Improve documentation for *note
     functools.singledispatch(): a2f. and *note
     functools.singledispatchmethod: 229.

   - 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: 1e3d. 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: テスト<39>,  Next: ビルド<42>,  Prev: ドキュメント<35>,  Up: Python 3 11 0 alpha 2

1.26.40.4 テスト
................

   - bpo-45678(1): Add tests for scenarios in which *note
     functools.singledispatchmethod: 229. 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(): 49e.

   - 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: d7. 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: ビルド<42>,  Next: Windows<36>,  Prev: テスト<39>,  Up: Python 3 11 0 alpha 2

1.26.40.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: 91. 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: 6ae. to use ‘main’ as
     fallback information.  Patch by Jeong YunWon.

   - bpo-45536(11): The ‘configure’ script now checks whether OpenSSL
     headers and libraries provide required APIs.  Most common APIs are
     verified.  The check detects outdated or missing OpenSSL. Failures
     do not stop configure.

   - bpo-45221(12): Fixed regression in handling of ‘LDFLAGS’ and
     ‘CPPFLAGS’ options where ‘argparse.parse_known_args()’ could
     interpret an option as one of the built-in command line argument,
     for example ‘-h’ for help.

   - bpo-45440(13): Building Python now requires a C99 ‘<math.h>’ header
     file providing the following functions: ‘copysign()’, ‘hypot()’,
     ‘isfinite()’, ‘isinf()’, ‘isnan()’, ‘round()’.  Patch by Victor
     Stinner.

   - bpo-45405(14): Prevent ‘internal configure error’ when running
     ‘configure’ with recent versions of non-Apple clang.  Patch by
     David Bohman.

   - bpo-45433(15): Avoid linking libpython with libcrypt.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43158

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45666

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45548

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45548

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45595

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45571

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45570

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43974

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45548

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45532

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45536

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45221

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45440

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45405

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45433


File: python.info,  Node: Windows<36>,  Next: macOS<27>,  Prev: ビルド<42>,  Up: Python 3 11 0 alpha 2

1.26.40.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<27>,  Next: IDLE<19>,  Prev: Windows<36>,  Up: Python 3 11 0 alpha 2

1.26.40.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<38>,  Prev: macOS<27>,  Up: Python 3 11 0 alpha 2

1.26.40.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<38>,  Prev: IDLE<19>,  Up: Python 3 11 0 alpha 2

1.26.40.9 C API
...............

   - bpo-29103(1): *note PyType_FromSpec*: 398. 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 ‘PyWeakref_GET_OBJECT()’ 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: b68.  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(): b7a.

        * *note PyMarshal_WriteObjectToFile(): b7b.

        * *note PyMarshal_ReadObjectFromString(): b7c.

        * *note PyMarshal_WriteObjectToString(): b7d.

        * ‘Py_MARSHAL_VERSION’ マクロ

     These are not part of the *note limited API: b7e.

     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(): b3d, and
     *note PyThreadState_LeaveTracing(): b3e. functions to the limited C
     API to suspend and resume tracing and profiling.  Patch by Victor
     Stinner.

   - bpo-44220(14): *note PyStructSequence_UnnamedField: d4e. 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.26.41 Python 3.11.0 alpha 1
-----------------------------

'Release date: 2021-10-05'

* Menu:

* セキュリティ: セキュリティ<28>.
* Core and Builtins: Core and Builtins<111>.
* ライブラリ: ライブラリ<112>.
* Core and Builtins: Core and Builtins<112>.
* ライブラリ: ライブラリ<113>.
* Core and Builtins: Core and Builtins<113>.
* ライブラリ: ライブラリ<114>.
* Core and Builtins: Core and Builtins<114>.
* ライブラリ: ライブラリ<115>.
* Core and Builtins: Core and Builtins<115>.
* ライブラリ: ライブラリ<116>.
* Core and Builtins: Core and Builtins<116>.
* ライブラリ: ライブラリ<117>.
* Core and Builtins: Core and Builtins<117>.
* ライブラリ: ライブラリ<118>.
* Core and Builtins: Core and Builtins<118>.
* ライブラリ: ライブラリ<119>.
* Core and Builtins: Core and Builtins<119>.
* ライブラリ: ライブラリ<120>.
* Core and Builtins: Core and Builtins<120>.
* ライブラリ: ライブラリ<121>.
* ドキュメント: ドキュメント<36>.
* テスト: テスト<40>.
* ビルド: ビルド<43>.
* Windows: Windows<37>.
* macOS: macOS<28>.
* IDLE: IDLE<20>.
* Tools/Demos: Tools/Demos<25>.
* C API: C API<39>.


File: python.info,  Node: セキュリティ<28>,  Next: Core and Builtins<111>,  Up: Python 3 11 0 alpha 1

1.26.41.1 セキュリティ
......................

   - bpo-42278(1): Replaced usage of *note tempfile.mktemp(): 1e46. with
     *note TemporaryDirectory: 15ef. to avoid a potential race
     condition.

   - bpo-44600(2): Fix incorrect line numbers while tracing some failed
     patterns in *note match: 1df. statements.  Patch by Charles
     Burkland.

   - bpo-41180(3): Add auditing events to the *note marshal: 90. 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:
     d2. sanitize input for presence of ‘\r’ and ‘\n’ characters to
     avoid (unlikely) command injection.

   - bpo-44022(7): *note http.client: 72. 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<111>,  Next: ライブラリ<112>,  Prev: セキュリティ<28>,  Up: Python 3 11 0 alpha 1

1.26.41.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: bcb.
     objects.

   - bpo-45155(6): *note int.to_bytes(): 1e48. and *note
     int.from_bytes(): 19af. 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: ライブラリ<112>,  Next: Core and Builtins<112>,  Prev: Core and Builtins<111>,  Up: Python 3 11 0 alpha 1

1.26.41.3 ライブラリ
....................

   - bpo-44219(1): Release the GIL while performing ‘isatty’ system
     calls on arbitrary file descriptors.  In particular, this affects
     *note os.isatty(): 1e4a, *note os.device_encoding(): 1e4b. and
     *note io.TextIOWrapper: ba0.  By extension, *note io.open(): 930.
     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<112>,  Next: ライブラリ<113>,  Prev: ライブラリ<112>,  Up: Python 3 11 0 alpha 1

1.26.41.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: ライブラリ<113>,  Next: Core and Builtins<113>,  Prev: Core and Builtins<112>,  Up: Python 3 11 0 alpha 1

1.26.41.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<113>,  Next: ライブラリ<114>,  Prev: ライブラリ<113>,  Up: Python 3 11 0 alpha 1

1.26.41.6 Core and Builtins
...........................

   - bpo-44348(1): The deallocator function of the *note BaseException:
     9bd. type now uses the trashcan mechanism to prevent stack
     overflow.  For example, when a *note RecursionError: 1125. 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(): 333, *note io.open(): 930, *note
     codecs.open(): 334. and *note fileinput.FileInput: b23. 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: 107. 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: ライブラリ<114>,  Next: Core and Builtins<114>,  Prev: Core and Builtins<113>,  Up: Python 3 11 0 alpha 1

1.26.41.7 ライブラリ
....................

   - bpo-45012(1): In *note posix: b2, release GIL during ‘stat()’,
     ‘lstat()’, and ‘fstatat()’ syscalls made by *note
     os.DirEntry.stat(): 1c90.  Patch by Stanisław Skonieczny.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45012


File: python.info,  Node: Core and Builtins<114>,  Next: ライブラリ<115>,  Prev: ライブラリ<114>,  Up: Python 3 11 0 alpha 1

1.26.41.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: 189. is now raised when trying
     to delete *note __debug__: bbb.  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: ライブラリ<115>,  Next: Core and Builtins<115>,  Prev: Core and Builtins<114>,  Up: Python 3 11 0 alpha 1

1.26.41.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<115>,  Next: ライブラリ<116>,  Prev: ライブラリ<115>,  Up: Python 3 11 0 alpha 1

1.26.41.10 Core and Builtins
............................

   - bpo-24234(1): Implement the ‘__bytes__()’ special method on the
     *note bytes: 1d2. 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: 330. 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: ライブラリ<116>,  Next: Core and Builtins<116>,  Prev: Core and Builtins<115>,  Up: Python 3 11 0 alpha 1

1.26.41.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<116>,  Next: ライブラリ<117>,  Prev: ライブラリ<116>,  Up: Python 3 11 0 alpha 1

1.26.41.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: 32f. or *note complex:
     330.

   - bpo-44895(3): A debug variable *note PYTHONDUMPREFSFILE: 1e55. is
     added for creating a dump file which is generated by *note
     -with-trace-refs: 82e.  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: 189. 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: 10d. 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: 447.

   - 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: ライブラリ<117>,  Next: Core and Builtins<117>,  Prev: Core and Builtins<116>,  Up: Python 3 11 0 alpha 1

1.26.41.13 ライブラリ
.....................

   - bpo-44611(1): On Windows, *note os.urandom(): 936.: 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<117>,  Next: ライブラリ<118>,  Prev: ライブラリ<117>,  Up: Python 3 11 0 alpha 1

1.26.41.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: 189. 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: ライブラリ<118>,  Next: Core and Builtins<118>,  Prev: Core and Builtins<117>,  Up: Python 3 11 0 alpha 1

1.26.41.15 ライブラリ
.....................

   - bpo-44490(1): *note typing: 10d. 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<118>,  Next: ライブラリ<119>,  Prev: ライブラリ<118>,  Up: Python 3 11 0 alpha 1

1.26.41.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(): 18bb. in
     error path when initializing *note types.GenericAlias: bcb.

   ---------- 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: ライブラリ<119>,  Next: Core and Builtins<119>,  Prev: Core and Builtins<118>,  Up: Python 3 11 0 alpha 1

1.26.41.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<119>,  Next: ライブラリ<120>,  Prev: ライブラリ<119>,  Up: Python 3 11 0 alpha 1

1.26.41.18 Core and Builtins
............................

   - bpo-43908(1): Heap types with the *note Py_TPFLAGS_IMMUTABLETYPE:
     602. flag can now inherit the PEP 590(2) vectorcall protocol.
     Previously, this was only possible for *note static types: b64.
     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(): 9e7. of
     *note weakref.proxy: e19. 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: 29c. is now raised instead of an
     *note AttributeError: 1b4. in *note with: 215. and *note async
     with: 216. statements for objects which do not support the *note
     context manager: 47f. or *note asynchronous context manager: 9d7.
     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: ライブラリ<120>,  Next: Core and Builtins<120>,  Prev: Core and Builtins<119>,  Up: Python 3 11 0 alpha 1

1.26.41.19 ライブラリ
.....................

   - bpo-44304(1): Fix a crash in the *note sqlite3: d7. 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<120>,  Next: ライブラリ<121>,  Prev: ライブラリ<120>,  Up: Python 3 11 0 alpha 1

1.26.41.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: 1d9, *note list: 4e0, *note frozenset: 9d9.) no
     longer accept arbitrary keyword arguments.  [reverted in 3.11a4]
     Subclass of *note set: 432. 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(): 191. 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():
     a17.

   - bpo-11105(28): When compiling *note ast.AST: 2f8. objects with
     recursive references through *note compile(): 1d3, the interpreter
     doesn't crash anymore instead it raises a *note RecursionError:
     1125.

   - 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: ライブラリ<121>,  Next: ドキュメント<36>,  Prev: Core and Builtins<120>,  Up: Python 3 11 0 alpha 1

1.26.41.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(): a8c. method now uses the monotonic clock
     (*note time.CLOCK_MONOTONIC: a8d.) for the timeout, rather than
     using the system clock (*note time.CLOCK_REALTIME: a8e.), to not be
     affected by system clock changes.  Patch by Victor Stinner.

   - bpo-1596321(4): Fix the ‘threading._shutdown()’ function when the
     *note threading: f6. 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():
     15a3. method of the *note threading: f6. 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(): a91.
     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(): a91. 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(): 1e5f. raises now a
     *note unittest.SkipTest: 1392. 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(): e21, *note
     copy(): e22, *note copy2(): e23. raising *note FileNotFoundError:
     24f. when source is a directory, which should raise *note
     IsADirectoryError: 140f.

   - 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(): 49d. 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(): a91.
     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: 919. class, the ‘readfp()’ method of the *note
     ConfigParser: 6ea. 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(): ac7.  Patch by Donghee Na.

   - bpo-35474(21): Calling *note mimetypes.guess_all_extensions():
     1e60. 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(): aa3. now works with
     *note Final: 775. wrapped in *note ForwardRef: 1df2.

   - bpo-45162(23): Remove many old deprecated *note unittest: 10f.
     features:

        * "‘fail*’" and "‘assert*’" aliases of *note TestCase: 536.
          methods.

        * Broken from start *note TestCase: 536. method
          ‘assertDictContainsSubset()’.

        * Ignored ‘<unittest.TestLoader.loadTestsFromModule>
          TestLoader.loadTestsFromModule()’ parameter 'use_load_tests'.

        * Old alias ‘_TextTestResult’ of *note TextTestResult: 944.

   - 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__(): 78d. methods of *note
     xml.dom.pulldom.DOMEventStream: b21, *note
     wsgiref.util.FileWrapper: b22. and *note fileinput.FileInput: b23,
     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(): b1f, 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: 1525. methods *note
     addFailure(): 1e61, *note addError(): 1e62, *note addSkip(): 1e63.
     and *note addSubTest(): 1e64. 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: 10f. 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(): b20. 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(): a96.  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(): 1524. now always return a *note
     TestResult: 1525. 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: 10f.:

        * Functions registered with *note addModuleCleanup(): e13. were
          not called unless the user defines ‘tearDownModule()’ in their
          test module.

        * Functions registered with *note addClassCleanup(): e14. were
          not called if ‘tearDownClass’ is set to ‘None’.

        * Buffering in *note TestResult: 1525. 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: 110.  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(): a32. and
     *note gzip.decompress(): 15ca. by compressing and decompressing at
     once in memory instead of in a streamed fashion.

   - bpo-37596(46): Ensure that *note set: 432. and *note frozenset:
     9d9. objects are always *note marshalled: 90. 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: 11e. itself.  Patch by Donghee Na.

   - bpo-44955(49): Method *note stopTestRun(): 1704. is now always
     called in pair with method *note startTestRun(): 1703. for *note
     TestResult: 1525. objects implicitly created in *note run(): 1524.
     Previously it was not called for test methods and classes decorated
     with a skipping decorator.

   - bpo-39039(50): tarfile.open raises *note ReadError: 1e65. when a
     zlib error occurs during file extraction.

   - bpo-44935(51): *note subprocess: df. on Solaris now also uses *note
     os.posix_spawn(): 736. for better performance.

   - bpo-44911(52): *note IsolatedAsyncioTestCase: 34a. 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: 1e6.'s default
     value is no longer printed twice when used with *note
     argparse.ArgumentDefaultsHelpFormatter: 1e66.

   - bpo-44860(56): Fix the ‘posix_user’ scheme in *note sysconfig: e4.
     to not depend on *note sys.platlibdir: 2b4.

   - bpo-44859(57): Improve error handling in *note sqlite3: d7. and
     raise more accurate exceptions.

        * *note MemoryError: 191d. is now raised instead of *note
          sqlite3.Warning: 1dcf. 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: 1dcf. when the statement contains surrogate
          characters in ‘Connection.__call__()’ and ‘Cursor.execute()’.

        * *note TypeError: 29c. is now raised instead of *note
          ValueError: 15a. for non-string script argument in
          ‘Cursor.executescript()’.

        * *note ValueError: 15a. 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(): 12af. function
     on FreeBSD 14 for file descriptor opened with the *note O_PATH:
     1321. flag: ignore the *note EBADF: d29. 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: 191d. raised in user-defined
     functions will now produce a ‘MemoryError’ in *note sqlite3: d7.
     *note OverflowError: c5b. will now be converted to *note DataError:
     1e67.  Previously *note OperationalError: 1e68. was produced in
     these cases.

   - bpo-44822(63): *note sqlite3: d7. user-defined functions and
     aggregators returning *note strings: 1ea. with embedded NUL
     characters are no longer truncated.  Patch by Erlend E. Aasland.

   - bpo-44801(64): Ensure that the *note ParamSpec: 2a0. 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:
     772. ignore now the ‘__init__’ method inherited from protocol base
     classes.

   - bpo-27275(66): *note collections.OrderedDict.popitem(): 16a7. 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(): 8ee. 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(): f93. on
     *note property: 6c1. 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: 1e69. 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():
     119d. when ‘sys.stdout’ is redirected.  Patch by Stefan Hölzl.

   - bpo-44688(77): *note sqlite3.Connection.create_collation(): a6b.
     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: c5b. 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(): 4c4.  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(): 1a24. when examining a class in the
     interactive session.  Instead of *note TypeError: 29c, it should be
     *note OSError: 543. 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: 5f, the cache size for compiled
     regex patterns (*note functools.lru_cache(): db7.) was bumped up
     from 256 to 32768, affecting functions: *note fnmatch.fnmatch():
     1e6a, *note fnmatch.fnmatchcase(): 1e6b, *note fnmatch.filter():
     1e6c.

   - bpo-41928(92): Update *note shutil.copyfile(): e21. to raise *note
     FileNotFoundError: 24f. instead of confusing *note
     IsADirectoryError: 140f. when a path ending with a ‘os.path.sep’
     does not exist; *note shutil.copy(): e22. and *note shutil.copy2():
     e23. are also affected.

   - bpo-44569(93): Added the ‘StackSummary.format_frame()’ function in
     *note traceback: 107.  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(): cb1. 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:
     132e. 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(): 1e6d. 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: 221.

   - bpo-44468(104): *note typing.get_type_hints(): aa3. 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: d7. authorizer
     callback by passing *note None: a6a. to *note set_authorizer():
     3ea.  Patch by Erlend E. Aasland.

   - bpo-43977(106): Set the proper *note Py_TPFLAGS_MAPPING: 1e6e. and
     *note Py_TPFLAGS_SEQUENCE: 1e6f. flags for subclasses created
     before a parent has been registered as a *note
     collections.abc.Mapping: ca0. or *note collections.abc.Sequence:
     1582.

   - bpo-44482(107): Fix very unlikely resource leak in *note glob: 67.
     in alternate Python implementations.

   - bpo-44466(108): The *note faulthandler: 5b. module now detects if a
     fatal error occurs during a garbage collector collection.  Patch by
     Victor Stinner.

   - bpo-44471(109): A *note TypeError: 29c. is now raised instead of an
     *note AttributeError: 1b4. in *note
     contextlib.ExitStack.enter_context(): 9d5. and *note
     contextlib.AsyncExitStack.enter_async_context(): 9d6. for objects
     which do not support the *note context manager: 47f. or *note
     asynchronous context manager: 9d7. protocols correspondingly.

   - bpo-44404(110): *note tkinter: f9.'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: 1238.

   - 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:
     3a6. flag.  Patch by Victor Stinner.

   - bpo-44422(118): The *note threading.enumerate(): 1e70. 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: 29c.

   - bpo-44389(121): Fix deprecation of *note ssl.OP_NO_TLSv1_3: 1e71.

   - 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: d8. 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: e4.

   - 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(): a56.

   - 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(): a4e.

   - bpo-44260(136): The *note random.Random: 1e72. 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:
     66.  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:
     b1d. 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: d7. 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: 1ce. 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: 1bed.
     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(): cba. will now drop the
     redundant parentheses when tuples used as assignment targets (e.g
     in for loops).

   - bpo-44145(153): *note hmac: 6d. 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: 6b. algorithms support.

   - bpo-44095(154): *note zipfile.Path: abb. now supports *note
     zipfile.Path.stem: ab8, *note zipfile.Path.suffixes: aba, and *note
     zipfile.Path.suffix: ab9. 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: 10d. 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(): cba. 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(): 1104. with a list of *note
     pathlib.Path: 4f5. objects

   - bpo-44059(163): Register the SerenityOS Browser in the *note
     webbrowser: 11e. module.

   - bpo-36515(164): The *note hashlib: 6b. 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: 113. 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: 113. ‘Quoted’ class
     API is now deprecated, for removal in 3.14.

   - bpo-43972(169): When *note http.server.SimpleHTTPRequestHandler:
     235. 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: 1b4. if it is called after ‘reset()’.

   - bpo-43853(171): Improved string handling for *note sqlite3: d7.
     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:
          191d.

     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: 191d. in *note
     shutil.unpack_archive(): 887. which fails inside
     ‘shutil._unpack_zipfile()’ on large files.  Patch by Igor
     Bolshakov.

   - bpo-43612(174): *note zlib.compress(): a33. 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(): 92c. and *note
     importlib.__import__(): 1424.

   - 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: b2c. 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(): c2b, *note
     traceback.format_exception(): c29. and *note
     traceback.format_exception_only(): c2a.

   - bpo-33809(183): Add the *note traceback.TracebackException.print():
     a97. method which prints the formatted exception information.

   - bpo-42862(184): *note sqlite3: d7. now utilizes *note
     functools.lru_cache(): db7. 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(): 1370. now raises
     *note ValueError: 15a. when the invalid keyword argument 'check' is
     passed by user code.  Previously such use would fail later with a
     *note TypeError: 29c.  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: d7.  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: 81. - by Anthony Sottile.

   - bpo-41402(191): Fix *note email.message.EmailMessage.set_content():
     1e73. when called with binary data and ‘7bit’ content transfer
     encoding.

   - bpo-32695(192): The 'compresslevel' and 'preset' keyword arguments
     of *note tarfile.open(): 122b. 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: f6.
     synchronization objects: *note Semaphore: 1516, *note
     BoundedSemaphore: 1517, *note Event: 1518. and *note Barrier: 15a2.

   - bpo-5846(195): Deprecated the following *note unittest: 10f.
     functions, scheduled for removal in Python 3.13:

        * ‘findTestCases()’

        * ‘makeSuite()’

        * ‘getTestCaseNames()’

     Use *note TestLoader: 798. methods instead:

        * *note unittest.TestLoader.loadTestsFromModule(): 799.

        * *note unittest.TestLoader.loadTestsFromTestCase(): 79a.

        * *note unittest.TestLoader.getTestCaseNames(): 79b.

     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(): 21a. to match *note
     contextlib.contextmanager(): 219. 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(): 6fe. now accepts
     *note email.header.Header: 1e74. objects along with string values.
     Patch by Zackery Spytz.

   - bpo-16379(206): Add SQLite error code and name to *note sqlite3:
     d7. exceptions.  Patch by Aviv Palivoda, Daniel Shahaf, and Erlend
     E. Aasland.

   - bpo-26228(207): pty.spawn no longer hangs on FreeBSD, macOS, and
     Solaris.

   - bpo-33349(208): lib2to3 now recognizes async generators everywhere.

   - bpo-29298(209): Fix ‘TypeError’ when required subparsers without
     ‘dest’ do not receive arguments.  Patch by Anthony Sottile.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45371

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45329

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41710

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1596321

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45274

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21302

   (7) https://bugs.python.org/issue?@action=redirect&bpo=21302

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45238

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36674

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45235

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45183

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45234

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45228

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45225

   (15) https://bugs.python.org/issue?@action=redirect&bpo=42135

   (16) https://bugs.python.org/issue?@action=redirect&bpo=20524

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45168

   (18) https://bugs.python.org/issue?@action=redirect&bpo=21302

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45173

   (20) https://bugs.python.org/issue?@action=redirect&bpo=44987

   (21) https://bugs.python.org/issue?@action=redirect&bpo=35474

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45166

   (23) https://bugs.python.org/issue?@action=redirect&bpo=45162

   (24) https://bugs.python.org/issue?@action=redirect&bpo=38371

   (25) https://bugs.python.org/issue?@action=redirect&bpo=20499

   (26) https://bugs.python.org/issue?@action=redirect&bpo=45132

   (27) https://bugs.python.org/issue?@action=redirect&bpo=45129

   (28) https://bugs.python.org/issue?@action=redirect&bpo=45124

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30856

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45034

   (31) https://bugs.python.org/issue?@action=redirect&bpo=25894

   (32) https://bugs.python.org/issue?@action=redirect&bpo=45081

   (33) https://bugs.python.org/issue?@action=redirect&bpo=45085

   (34) https://bugs.python.org/issue?@action=redirect&bpo=40360

   (35) https://peps.python.org/pep-0617/

   (36) https://bugs.python.org/issue?@action=redirect&bpo=45075

   (37) https://bugs.python.org/issue?@action=redirect&bpo=31299

   (38) https://bugs.python.org/issue?@action=redirect&bpo=41620

   (39) https://bugs.python.org/issue?@action=redirect&bpo=45021

   (40) https://bugs.python.org/issue?@action=redirect&bpo=43913

   (41) https://bugs.python.org/issue?@action=redirect&bpo=45030

   (42) https://bugs.python.org/issue?@action=redirect&bpo=45001

   (43) https://bugs.python.org/issue?@action=redirect&bpo=45010

   (44) https://bugs.python.org/issue?@action=redirect&bpo=39218

   (45) https://bugs.python.org/issue?@action=redirect&bpo=43613

   (46) https://bugs.python.org/issue?@action=redirect&bpo=37596

   (47) https://bugs.python.org/issue?@action=redirect&bpo=44019

   (48) https://bugs.python.org/issue?@action=redirect&bpo=42255

   (49) https://bugs.python.org/issue?@action=redirect&bpo=44955

   (50) https://bugs.python.org/issue?@action=redirect&bpo=39039

   (51) https://bugs.python.org/issue?@action=redirect&bpo=44935

   (52) https://bugs.python.org/issue?@action=redirect&bpo=44911

   (53) https://bugs.python.org/issue?@action=redirect&bpo=41322

   (54) https://bugs.python.org/issue?@action=redirect&bpo=44524

   (55) https://bugs.python.org/issue?@action=redirect&bpo=38956

   (56) https://bugs.python.org/issue?@action=redirect&bpo=44860

   (57) https://bugs.python.org/issue?@action=redirect&bpo=44859

   (58) https://bugs.python.org/issue?@action=redirect&bpo=44581

   (59) https://bugs.python.org/issue?@action=redirect&bpo=44849

   (60) https://bugs.python.org/issue?@action=redirect&bpo=44605

   (61) https://bugs.python.org/issue?@action=redirect&bpo=44524

   (62) https://bugs.python.org/issue?@action=redirect&bpo=44839

   (63) https://bugs.python.org/issue?@action=redirect&bpo=44822

   (64) https://bugs.python.org/issue?@action=redirect&bpo=44801

   (65) https://bugs.python.org/issue?@action=redirect&bpo=44806

   (66) https://bugs.python.org/issue?@action=redirect&bpo=27275

   (67) https://bugs.python.org/issue?@action=redirect&bpo=44793

   (68) https://bugs.python.org/issue?@action=redirect&bpo=44784

   (69) https://bugs.python.org/issue?@action=redirect&bpo=44667

   (70) https://bugs.python.org/issue?@action=redirect&bpo=44771

   (71) https://bugs.python.org/issue?@action=redirect&bpo=44752

   (72) https://bugs.python.org/issue?@action=redirect&bpo=44747

   (73) https://bugs.python.org/issue?@action=redirect&bpo=42378

   (74) https://bugs.python.org/issue?@action=redirect&bpo=44720

   (75) https://bugs.python.org/issue?@action=redirect&bpo=44704

   (76) https://bugs.python.org/issue?@action=redirect&bpo=44666

   (77) https://bugs.python.org/issue?@action=redirect&bpo=44688

   (78) https://bugs.python.org/issue?@action=redirect&bpo=44690

   (79) https://bugs.python.org/issue?@action=redirect&bpo=42854

   (80) https://bugs.python.org/issue?@action=redirect&bpo=44686

   (81) https://bugs.python.org/issue?@action=redirect&bpo=44353

   (82) https://bugs.python.org/issue?@action=redirect&bpo=44682

   (83) https://bugs.python.org/issue?@action=redirect&bpo=44353

   (84) https://bugs.python.org/issue?@action=redirect&bpo=44678

   (85) https://bugs.python.org/issue?@action=redirect&bpo=44524

   (86) https://bugs.python.org/issue?@action=redirect&bpo=40897

   (87) https://bugs.python.org/issue?@action=redirect&bpo=44638

   (88) https://bugs.python.org/issue?@action=redirect&bpo=44648

   (89) https://bugs.python.org/issue?@action=redirect&bpo=44608

   (90) https://bugs.python.org/issue?@action=redirect&bpo=44594

   (91) https://bugs.python.org/issue?@action=redirect&bpo=42799

   (92) https://bugs.python.org/issue?@action=redirect&bpo=41928

   (93) https://bugs.python.org/issue?@action=redirect&bpo=44569

   (94) https://bugs.python.org/issue?@action=redirect&bpo=44566

   (95) https://bugs.python.org/issue?@action=redirect&bpo=44558

   (96) https://bugs.python.org/issue?@action=redirect&bpo=41249

   (97) https://bugs.python.org/issue?@action=redirect&bpo=44554

   (98) https://bugs.python.org/issue?@action=redirect&bpo=34798

   (99) https://bugs.python.org/issue?@action=redirect&bpo=44539

   (100) https://bugs.python.org/issue?@action=redirect&bpo=44461

   (101) https://bugs.python.org/issue?@action=redirect&bpo=43625

   (102) https://bugs.python.org/issue?@action=redirect&bpo=44516

   (103) https://bugs.python.org/issue?@action=redirect&bpo=42892

   (104) https://bugs.python.org/issue?@action=redirect&bpo=44468

   (105) https://bugs.python.org/issue?@action=redirect&bpo=44491

   (106) https://bugs.python.org/issue?@action=redirect&bpo=43977

   (107) https://bugs.python.org/issue?@action=redirect&bpo=44482

   (108) https://bugs.python.org/issue?@action=redirect&bpo=44466

   (109) https://bugs.python.org/issue?@action=redirect&bpo=44471

   (110) https://bugs.python.org/issue?@action=redirect&bpo=44404

   (111) https://bugs.python.org/issue?@action=redirect&bpo=41546

   (112) https://bugs.python.org/issue?@action=redirect&bpo=44458

   (113) https://bugs.python.org/issue?@action=redirect&bpo=44464

   (114) https://bugs.python.org/issue?@action=redirect&bpo=44446

   (115) https://bugs.python.org/issue?@action=redirect&bpo=44439

   (116) https://bugs.python.org/issue?@action=redirect&bpo=44434

   (117) https://bugs.python.org/issue?@action=redirect&bpo=42972

   (118) https://bugs.python.org/issue?@action=redirect&bpo=44422

   (119) https://bugs.python.org/issue?@action=redirect&bpo=38291

   (120) https://bugs.python.org/issue?@action=redirect&bpo=37880

   (121) https://bugs.python.org/issue?@action=redirect&bpo=44389

   (122) https://bugs.python.org/issue?@action=redirect&bpo=27827

   (123) https://bugs.python.org/issue?@action=redirect&bpo=44395

   (124) https://bugs.python.org/issue?@action=redirect&bpo=34266

   (125) https://bugs.python.org/issue?@action=redirect&bpo=44362

   (126) https://bugs.python.org/issue?@action=redirect&bpo=44342

   (127) https://bugs.python.org/issue?@action=redirect&bpo=44356

   (128) https://bugs.python.org/issue?@action=redirect&bpo=44351

   (129) https://bugs.python.org/issue?@action=redirect&bpo=35800

   (130) https://bugs.python.org/issue?@action=redirect&bpo=44357

   (131) https://bugs.python.org/issue?@action=redirect&bpo=44339

   (132) https://bugs.python.org/issue?@action=redirect&bpo=44242

   (133) https://bugs.python.org/issue?@action=redirect&bpo=44246

   (134) https://bugs.python.org/issue?@action=redirect&bpo=44246

   (135) https://bugs.python.org/issue?@action=redirect&bpo=43858

   (136) https://bugs.python.org/issue?@action=redirect&bpo=44260

   (137) https://bugs.python.org/issue?@action=redirect&bpo=44254

   (138) https://bugs.python.org/issue?@action=redirect&bpo=44258

   (139) https://bugs.python.org/issue?@action=redirect&bpo=44235

   (140) https://bugs.python.org/issue?@action=redirect&bpo=38693

   (141) https://bugs.python.org/issue?@action=redirect&bpo=33693

   (142) https://bugs.python.org/issue?@action=redirect&bpo=44241

   (143) https://bugs.python.org/issue?@action=redirect&bpo=43216

   (144) https://bugs.python.org/issue?@action=redirect&bpo=44210

   (145) https://bugs.python.org/issue?@action=redirect&bpo=43643

   (146) https://bugs.python.org/issue?@action=redirect&bpo=27334

   (147) https://bugs.python.org/issue?@action=redirect&bpo=4928

   (148) https://bugs.python.org/issue?@action=redirect&bpo=44154

   (149) https://bugs.python.org/issue?@action=redirect&bpo=33433

   (150) https://datatracker.ietf.org/doc/html/rfc4291.html

   (151) https://bugs.python.org/issue?@action=redirect&bpo=44150

   (152) https://bugs.python.org/issue?@action=redirect&bpo=44142

   (153) https://bugs.python.org/issue?@action=redirect&bpo=44145

   (154) https://bugs.python.org/issue?@action=redirect&bpo=44095

   (155) https://bugs.python.org/issue?@action=redirect&bpo=44077

   (156) https://bugs.python.org/issue?@action=redirect&bpo=37788

   (157) https://bugs.python.org/issue?@action=redirect&bpo=38908

   (158) https://bugs.python.org/issue?@action=redirect&bpo=44098

   (159) https://peps.python.org/pep-0612/

   (160) https://bugs.python.org/issue?@action=redirect&bpo=44089

   (161) https://bugs.python.org/issue?@action=redirect&bpo=44081

   (162) https://bugs.python.org/issue?@action=redirect&bpo=44061

   (163) https://bugs.python.org/issue?@action=redirect&bpo=44059

   (164) https://bugs.python.org/issue?@action=redirect&bpo=36515

   (165) https://bugs.python.org/issue?@action=redirect&bpo=40465

   (166) https://bugs.python.org/issue?@action=redirect&bpo=44018

   (167) https://bugs.python.org/issue?@action=redirect&bpo=38352

   (168) https://bugs.python.org/issue?@action=redirect&bpo=44002

   (169) https://bugs.python.org/issue?@action=redirect&bpo=43972

   (170) https://bugs.python.org/issue?@action=redirect&bpo=28528

   (171) https://bugs.python.org/issue?@action=redirect&bpo=43853

   (172) https://bugs.python.org/issue?@action=redirect&bpo=43666

   (173) https://bugs.python.org/issue?@action=redirect&bpo=43650

   (174) https://bugs.python.org/issue?@action=redirect&bpo=43612

   (175) https://bugs.python.org/issue?@action=redirect&bpo=43392

   (176) https://bugs.python.org/issue?@action=redirect&bpo=43318

   (177) https://bugs.python.org/issue?@action=redirect&bpo=43234

   (178) https://bugs.python.org/issue?@action=redirect&bpo=43232

   (179) https://bugs.python.org/issue?@action=redirect&bpo=30077

   (180) https://bugs.python.org/issue?@action=redirect&bpo=42971

   (181) https://bugs.python.org/issue?@action=redirect&bpo=43086

   (182) https://bugs.python.org/issue?@action=redirect&bpo=43024

   (183) https://bugs.python.org/issue?@action=redirect&bpo=33809

   (184) https://bugs.python.org/issue?@action=redirect&bpo=42862

   (185) https://bugs.python.org/issue?@action=redirect&bpo=41818

   (186) https://bugs.python.org/issue?@action=redirect&bpo=40497

   (187) https://bugs.python.org/issue?@action=redirect&bpo=37449

   (188) https://bugs.python.org/issue?@action=redirect&bpo=40956

   (189) https://bugs.python.org/issue?@action=redirect&bpo=41730

   (190) https://bugs.python.org/issue?@action=redirect&bpo=20684

   (191) https://bugs.python.org/issue?@action=redirect&bpo=41402

   (192) https://bugs.python.org/issue?@action=redirect&bpo=32695

   (193) https://bugs.python.org/issue?@action=redirect&bpo=41137

   (194) https://bugs.python.org/issue?@action=redirect&bpo=24391

   (195) https://bugs.python.org/issue?@action=redirect&bpo=5846

   (196) https://bugs.python.org/issue?@action=redirect&bpo=40563

   (197) https://bugs.python.org/issue?@action=redirect&bpo=34990

   (198) https://bugs.python.org/issue?@action=redirect&bpo=39549

   (199) https://bugs.python.org/issue?@action=redirect&bpo=37022

   (200) https://bugs.python.org/issue?@action=redirect&bpo=38840

   (201) https://bugs.python.org/issue?@action=redirect&bpo=39359

   (202) https://bugs.python.org/issue?@action=redirect&bpo=38741

   (203) https://bugs.python.org/issue?@action=redirect&bpo=38415

   (204) https://bugs.python.org/issue?@action=redirect&bpo=30256

   (205) https://bugs.python.org/issue?@action=redirect&bpo=27513

   (206) https://bugs.python.org/issue?@action=redirect&bpo=16379

   (207) https://bugs.python.org/issue?@action=redirect&bpo=26228

   (208) https://bugs.python.org/issue?@action=redirect&bpo=33349

   (209) https://bugs.python.org/issue?@action=redirect&bpo=29298


File: python.info,  Node: ドキュメント<36>,  Next: テスト<40>,  Prev: ライブラリ<121>,  Up: Python 3 11 0 alpha 1

1.26.41.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: 1e76.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():
     1e48. and *note int.from_bytes(): 19af. 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(): 8c8. 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(): 1c05. 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(): cb2. to the behavior of its c implementation.

   - bpo-44544(20): List all kwargs for *note textwrap.wrap(): 187f,
     *note textwrap.fill(): 187e, and *note textwrap.shorten(): 137e.
     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: 13a. 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(): 16e7.

   - 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: 32.
     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: 157a.
     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: テスト<40>,  Next: ビルド<43>,  Prev: ドキュメント<36>,  Up: Python 3 11 0 alpha 1

1.26.41.23 テスト
.................

   - bpo-40173(1): Fix *note
     test.support.import_helper.import_fresh_module(): 1e78.

   - bpo-45280(2): Add a test case for empty *note typing.NamedTuple:
     2f0.

   - 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():
     f64. 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: 2b4.
     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(): 456. 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(): 17db. is
     preserved when ‘obj * 1’ is used on *note str: 1ea. and *note
     bytes: 1d2. 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: 1e79. 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(): dcc.
     function.

   - bpo-43921(29): Fix test_ssl.test_wrong_cert_tls13(): use
     ‘suppress_ragged_eofs=False’, since ‘read()’ can raise *note
     ssl.SSLEOFError: 1924. 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: ビルド<43>,  Next: Windows<37>,  Prev: テスト<40>,  Up: Python 3 11 0 alpha 1

1.26.41.24 ビルド
.................

   - bpo-45220(1): Avoid building with the Windows 11 SDK previews
     automatically.  This may be overridden by setting the
     ‘DefaultWindowsSDKVersion’ environment variable before building.

   - bpo-45020(2): Freeze stdlib modules that are imported during
     startup.  This provides significant performance improvements to
     startup.  If necessary, use the previously added "-X
     frozen_modules=off" commandline option to force importing the
     source modules.

   - bpo-45188(3): Windows builds now regenerate frozen modules as the
     first part of the build.  Previously the regeneration was later in
     the build, which would require it to be restarted if any modules
     had changed.

   - bpo-45163(4): Fixes Haiku platform build.

   - bpo-45067(5): The ncurses function extended_color_content was
     introduced in 2017

     (‘https://invisible-island.net/ncurses/NEWS.html#index-t20170401’).
     The

     ncurses-devel package in CentOS 7 had a older version ncurses
     resulted in compilation error.  For compiling ncurses with extended
     color support, we verify the version of the ncurses library >=
     20170401.

   - bpo-45019(6): Generate lines in relevant files for frozen modules.
     Up until now each of the files had to be edited manually.  This
     change makes it easier to add to and modify the frozen modules.

   - bpo-44340(7): Add support for building with clang thin lto via
     -with-lto=thin/full.  Patch by Donghee Na and Brett Holman.

   - bpo-44535(8): Enable building using a Visual Studio 2022 install on
     Windows.

   - bpo-43298(9): Improved error message when building without a
     Windows SDK installed.

   - bpo-44381(10): The Windows build now accepts
     ‘EnableControlFlowGuard’ set to ‘guard’ to enable CFG.

   - bpo-41282(11): Fix broken ‘make install’ that caused standard
     library extension modules to be unnecessarily and incorrectly
     rebuilt during the install phase of cpython.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45220

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45020

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45188

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45163

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45067

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45019

   (7) https://bugs.python.org/issue?@action=redirect&bpo=44340

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44535

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43298

   (10) https://bugs.python.org/issue?@action=redirect&bpo=44381

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41282


File: python.info,  Node: Windows<37>,  Next: macOS<28>,  Prev: ビルド<43>,  Up: Python 3 11 0 alpha 1

1.26.41.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: f6, such as with *note threading.Lock.acquire():
     a8c. or *note threading.Condition.wait(): 1e7c.

   - bpo-42686(8): Build *note sqlite3: d7. 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<28>,  Next: IDLE<20>,  Prev: Windows<37>,  Up: Python 3 11 0 alpha 1

1.26.41.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(): 1102. 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<25>,  Prev: macOS<28>,  Up: Python 3 11 0 alpha 1

1.26.41.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: 1df. statement's *note
     soft keywords: bea.: *note match: 1df, ‘case’, and *note _: beb.
     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<25>,  Next: C API<39>,  Prev: IDLE<20>,  Up: Python 3 11 0 alpha 1

1.26.41.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<39>,  Prev: Tools/Demos<25>,  Up: Python 3 11 0 alpha 1

1.26.41.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: 15a. when the entire file has already been buffered.

   - bpo-45116(3): Add the *note Py_ALWAYS_INLINE: 1e81. 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: 1a8a. macro to disable
     inlining on a function.  Patch by Victor Stinner.

   - bpo-45061(5): Add a deallocator to the *note bool: 5f6. 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(): b3c. 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(): d91. now resets *note
     PyImport_Inittab: 1d38. to its initial value at exit.  It must be
     possible to call *note PyImport_AppendInittab(): 1d39. or *note
     PyImport_ExtendInittab(): 1d3a. 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: b71.
     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の内容: b7e. now shows
     the public name *note PyFrameObject: b6d. rather than ‘_frame’.
     The non-existing entry ‘_node’ no longer appears in the list.

   - bpo-44378(15): *note Py_IS_TYPE(): 19db. no longer uses *note
     Py_TYPE(): 5fc. to avoid a compiler warning: no longer cast ‘const
     PyObject*’ to ‘PyObject*’.  Patch by Victor Stinner.

   - bpo-39573(16): Convert the *note Py_TYPE(): 5fc. and *note
     Py_SIZE(): b66. macros to static inline functions.  The *note
     Py_SET_TYPE(): b65. and *note Py_SET_SIZE(): b67. functions must
     now be used to set an object type and size.  Patch by Victor
     Stinner.

   - bpo-44263(17): The *note PyType_Ready(): b63. function now raises
     an error if a type is defined with the *note Py_TPFLAGS_HAVE_GC:
     3a6. flag set but has no traverse function (*note
     PyTypeObject.tp_traverse: 373.).  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: 612. API of the *note Python
     Initialization Configuration: 83d. 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(): c71. 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(): b3b. 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.26.42 Python 3.10.0 beta 1
----------------------------

'リリース日: 2021-05-03'

* Menu:

* セキュリティ: セキュリティ<29>.
* Core and Builtins: Core and Builtins<121>.
* ライブラリ: ライブラリ<122>.
* Core and Builtins: Core and Builtins<122>.
* ライブラリ: ライブラリ<123>.
* Core and Builtins: Core and Builtins<123>.
* ライブラリ: ライブラリ<124>.
* ドキュメント: ドキュメント<37>.
* テスト: テスト<41>.
* ビルド: ビルド<44>.
* Windows: Windows<38>.
* macOS: macOS<29>.
* IDLE: IDLE<21>.
* C API: C API<40>.


File: python.info,  Node: セキュリティ<29>,  Next: Core and Builtins<121>,  Up: Python 3 10 0 beta 1

1.26.42.1 セキュリティ
......................

   - bpo-43434(1): Creating *note sqlite3.Connection: 3e6. objects now
     also produces ‘sqlite3.connect’ and ‘sqlite3.connect/handle’ *note
     auditing events: 1e84.  Previously these events were only produced
     by *note sqlite3.connect(): 3e7. calls.  Patch by Erlend E.
     Aasland.

   - bpo-43998(2): The *note ssl: d8. 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: 33e. 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(): 113. 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(): c1b, and *note
     sqlite3.Connection.load_extension(): 8cd.  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():
     2df. and *note glob.iglob(): be5.

   - bpo-36384(8): *note ipaddress: 83. 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(): d2f. treats leading
     zeros as octal notation.  glibc implementation of modern *note
     inet_pton(): d30. 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:
     1e85.  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: 72.
     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<121>,  Next: ライブラリ<122>,  Prev: セキュリティ<29>,  Up: Python 3 10 0 beta 1

1.26.42.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: 1e87. 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: ライブラリ<122>,  Next: Core and Builtins<122>,  Prev: Core and Builtins<121>,  Up: Python 3 10 0 beta 1

1.26.42.3 ライブラリ
....................

   - bpo-43908(1): Make *note re: c1. types immutable.  Patch by Erlend
     E. Aasland.

   - bpo-43908(2): Make the *note array.array: 6cb. 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<122>,  Next: ライブラリ<123>,  Prev: ライブラリ<122>,  Up: Python 3 10 0 beta 1

1.26.42.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: 189. 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: 18ef. 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: 66c. 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: 1e8a. 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: 66d.) and class
     methods (*note @classmethod: 6a0.) 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__: 1e8b. 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: ライブラリ<123>,  Next: Core and Builtins<123>,  Prev: Core and Builtins<122>,  Up: Python 3 10 0 beta 1

1.26.42.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<123>,  Next: ライブラリ<124>,  Prev: ライブラリ<123>,  Up: Python 3 10 0 beta 1

1.26.42.6 Core and Builtins
...........................

   - bpo-43682(1): Static methods (*note @staticmethod: 66d.) 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: 1125. is now raised instead.

   - bpo-38530(3): When printing *note AttributeError: 1b4,
     ‘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: ライブラリ<124>,  Next: ドキュメント<37>,  Prev: Core and Builtins<123>,  Up: Python 3 10 0 beta 1

1.26.42.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: 1e8f. 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(): 58f.  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(): aa3. 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: 10a. 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(): 129f.
     now returns a consistent error message when cadata contains no
     valid certificate.

   - bpo-43607(15): *note urllib: 111. can now convert Windows paths
     with ‘\\?\’ prefixes into URL paths.

   - bpo-43817(16): Add *note inspect.get_annotations(): bf0, 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(): 4c4, ‘inspect.from_callable()’, and
     ‘inspect.from_function()’ now call *note inspect.get_annotations():
     bf0. 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: d8. 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: d8. 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: 10fb. 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: c41,
     *note gzip.GzipFile: 84f, and *note lzma.LZMAFile: 13ba.  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(): 930. 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: 7e5. raised in *note
     typing.get_type_hints(): aa3. due to synthetic modules that don't
     appear in ‘sys.modules’.

   - bpo-43776(30): When *note subprocess.Popen: 6c5. args are provided
     as a string or as *note pathlib.Path: 4f5, 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(): 2fb.) and builtin assert functions (e.g.
     assert_called_once_with) will unconditionally pass.

   - bpo-43794(37): Add *note ssl.OP_IGNORE_UNEXPECTED_EOF: c14.
     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: 6a. and *note lzma: 8d. 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: d8. 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: 10d.
     module by adding ‘TypeGuard’.

   - bpo-25264(43): *note os.path.realpath(): 24d. now accepts a
     'strict' keyword-only argument.  When set to ‘True’, *note OSError:
     543. 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: 2a0. are now instances of the new classes *note
     typing.ParamSpecArgs: baa. and *note typing.ParamSpecKwargs: bab,
     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(): bdd. and *note fileinput.FileInput: b23.

   - 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__: 1e8b.
     generation could fail for some *note dataclasses: 32.

   - bpo-43752(50): Fix *note sqlite3: d7. 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: f9. 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(): 346.

        - ‘activeCount’ => *note threading.active_count(): 347.

        - ‘Condition.notifyAll’ => *note
          threading.Condition.notify_all(): 340.

        - ‘Event.isSet’ => *note threading.Event.is_set(): 341.

        - ‘Thread.setName’ => *note threading.Thread.name: 345.

        - ‘thread.getName’ => *note threading.Thread.name: 345.

        - ‘Thread.isDaemon’ => *note threading.Thread.daemon: 343.

        - ‘Thread.setDaemon’ => *note threading.Thread.daemon: 343.

     Patch by Jelle Zijlstra.

   - bpo-2135(53): Deprecate find_module() and find_loader()
     implementations in importlib and zipimport.

   - bpo-43534(54): *note turtle.textinput(): 1e90. and *note
     turtle.numinput(): 1e91. 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:
     f40.  OpenSSL does not copy hostflags from 'struct SSL_CTX' to
     'struct SSL'.

   - bpo-8978(57): Improve error message for *note tarfile.open(): 122b.
     when *note lzma: 8d. / *note bz2: 14. are unavailable.  Patch by
     Anthony Sottile.

   - bpo-42967(58): Allow *note bytes: 1d2. ‘separator’ argument in
     ‘urllib.parse.parse_qs’ and ‘urllib.parse.parse_qsl’ when parsing
     *note str: 1ea. query strings.  Previously, this raised a
     ‘TypeError’.

   - bpo-43296(59): Improve *note sqlite3: d7. error handling:
     ‘sqlite3_value_blob()’ errors that set ‘SQLITE_NOMEM’ now raise
     *note MemoryError: 191d.  Patch by Erlend E. Aasland.

   - bpo-43312(60): New functions *note
     sysconfig.get_preferred_scheme(): a84. and *note
     sysconfig.get_default_scheme(): 1dce. are added to query a platform
     for its preferred "user", "home", and "prefix" (default) scheme
     names.

   - bpo-43265(61): Improve *note sqlite3.Connection.backup(): f3d.
     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: e4.

   - bpo-41282(63): ‘distutils.sysconfig’ has been merged to *note
     sysconfig: e4.

   - 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: 6ec.  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(): aa3. 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():
     573. without running event loop.  Emit deprecation warning for
     *note asyncio: b. functions which implicitly create a *note Future:
     f8f. or *note Task: 467. objects if there is no running event loop
     and no explicit 'loop' argument is passed: *note ensure_future():
     1039, *note wrap_future(): 1e92, *note gather(): 9f9, *note
     shield(): e38, *note as_completed(): 6d2. and constructors of
     ‘Future’, ‘Task’, *note StreamReader: 196b, ‘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: 8d. / *note zlib: 13c. 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(): c19.
     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():
     1c8f.  Patch by Claudiu Popa.

   - bpo-40849(76): Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag

   - bpo-35114(77): *note ssl.RAND_status(): 1e93. now returns a boolean
     value (as documented) instead of ‘1’ or ‘0’.

   - bpo-39906(78): *note pathlib.Path.stat(): c00. and *note chmod():
     c01. 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(): ddc. 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(): 11f6. and *note home(): 11f7. now
     consistently raise *note RuntimeError: 317. exception when a home
     directory cannot be resolved.  Previously a *note KeyError: 7e5.
     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(): c19.

   - 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: 1c7d. type: embedded null characters would cause
     a *note ValueError: 15a. to be raised.  Patch by Zackery Spytz.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44015

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25478

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43733

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43979

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43993

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43957

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42904

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43945

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41139

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43937

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43930

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43907

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43926

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43920

   (15) https://bugs.python.org/issue?@action=redirect&bpo=43607

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43817

   (17) https://bugs.python.org/issue?@action=redirect&bpo=43284

   (18) https://bugs.python.org/issue?@action=redirect&bpo=42854

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42333

   (20) https://bugs.python.org/issue?@action=redirect&bpo=43880

   (21) https://bugs.python.org/issue?@action=redirect&bpo=41559

   (22) https://peps.python.org/pep-0612/

   (23) https://bugs.python.org/issue?@action=redirect&bpo=43867

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40443

   (25) https://bugs.python.org/issue?@action=redirect&bpo=43820

   (26) https://bugs.python.org/issue?@action=redirect&bpo=43787

   (27) https://bugs.python.org/issue?@action=redirect&bpo=43680

   (28) https://bugs.python.org/issue?@action=redirect&bpo=43680

   (29) https://bugs.python.org/issue?@action=redirect&bpo=41515

   (30) https://bugs.python.org/issue?@action=redirect&bpo=43776

   (31) https://bugs.python.org/issue?@action=redirect&bpo=42248

   (32) https://bugs.python.org/issue?@action=redirect&bpo=43744

   (33) https://bugs.python.org/issue?@action=redirect&bpo=43772

   (34) https://bugs.python.org/issue?@action=redirect&bpo=43764

   (35) https://bugs.python.org/issue?@action=redirect&bpo=43799

   (36) https://bugs.python.org/issue?@action=redirect&bpo=43478

   (37) https://bugs.python.org/issue?@action=redirect&bpo=43794

   (38) https://bugs.python.org/issue?@action=redirect&bpo=43785

   (39) https://bugs.python.org/issue?@action=redirect&bpo=43789

   (40) https://bugs.python.org/issue?@action=redirect&bpo=43788

   (41) https://bugs.python.org/issue?@action=redirect&bpo=43766

   (42) https://peps.python.org/pep-0647/

   (43) https://bugs.python.org/issue?@action=redirect&bpo=25264

   (44) https://bugs.python.org/issue?@action=redirect&bpo=43780

   (45) https://github.com/python/cpython/issues/47383

   (46) https://bugs.python.org/issue?@action=redirect&bpo=43731

   (47) https://bugs.python.org/issue?@action=redirect&bpo=43712

   (48) https://bugs.python.org/issue?@action=redirect&bpo=38659

   (49) https://bugs.python.org/issue?@action=redirect&bpo=43764

   (50) https://bugs.python.org/issue?@action=redirect&bpo=43752

   (51) https://bugs.python.org/issue?@action=redirect&bpo=43655

   (52) https://bugs.python.org/issue?@action=redirect&bpo=43723

   (53) https://bugs.python.org/issue?@action=redirect&bpo=2135

   (54) https://bugs.python.org/issue?@action=redirect&bpo=43534

   (55) https://bugs.python.org/issue?@action=redirect&bpo=43532

   (56) https://bugs.python.org/issue?@action=redirect&bpo=43522

   (57) https://bugs.python.org/issue?@action=redirect&bpo=8978

   (58) https://bugs.python.org/issue?@action=redirect&bpo=42967

   (59) https://bugs.python.org/issue?@action=redirect&bpo=43296

   (60) https://bugs.python.org/issue?@action=redirect&bpo=43312

   (61) https://bugs.python.org/issue?@action=redirect&bpo=43265

   (62) https://bugs.python.org/issue?@action=redirect&bpo=41282

   (63) https://bugs.python.org/issue?@action=redirect&bpo=41282

   (64) https://bugs.python.org/issue?@action=redirect&bpo=43176

   (65) https://bugs.python.org/issue?@action=redirect&bpo=43080

   (66) https://bugs.python.org/issue?@action=redirect&bpo=39950

   (67) https://bugs.python.org/issue?@action=redirect&bpo=42904

   (68) https://peps.python.org/pep-0563/

   (69) https://bugs.python.org/issue?@action=redirect&bpo=42269

   (70) https://bugs.python.org/issue?@action=redirect&bpo=39529

   (71) https://bugs.python.org/issue?@action=redirect&bpo=18369

   (72) https://bugs.python.org/issue?@action=redirect&bpo=41486

   (73) https://bugs.python.org/issue?@action=redirect&bpo=31870

   (74) https://bugs.python.org/issue?@action=redirect&bpo=41735

   (75) https://bugs.python.org/issue?@action=redirect&bpo=36470

   (76) https://bugs.python.org/issue?@action=redirect&bpo=40849

   (77) https://bugs.python.org/issue?@action=redirect&bpo=35114

   (78) https://bugs.python.org/issue?@action=redirect&bpo=39906

   (79) https://bugs.python.org/issue?@action=redirect&bpo=39899

   (80) https://bugs.python.org/issue?@action=redirect&bpo=36076

   (81) https://bugs.python.org/issue?@action=redirect&bpo=38490

   (82) https://bugs.python.org/issue?@action=redirect&bpo=33731

   (83) https://bugs.python.org/issue?@action=redirect&bpo=32745


File: python.info,  Node: ドキュメント<37>,  Next: テスト<41>,  Prev: ライブラリ<124>,  Up: Python 3 10 0 beta 1

1.26.42.8 ドキュメント
......................

   - bpo-43987(1): Add "Annotations Best Practices" document as a new
     HOWTO.

   - bpo-43977(2): Document the new *note Py_TPFLAGS_MAPPING: 1e6e. and
     *note Py_TPFLAGS_SEQUENCE: 1e6f. 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: テスト<41>,  Next: ビルド<44>,  Prev: ドキュメント<37>,  Up: Python 3 10 0 beta 1

1.26.42.9 テスト
................

   - bpo-43961(1): Fix test_logging.test_namer_rotator_inheritance() on
     Windows: use *note os.replace(): 14b3. rather than *note
     os.rename(): 14b2.  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(): c27.  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: ビルド<44>,  Next: Windows<38>,  Prev: テスト<41>,  Up: Python 3 10 0 beta 1

1.26.42.10 ビルド
.................

   - bpo-43567(1): Improved generated code refresh
     (AST/tokens/opcodes/keywords) on Windows.

   - bpo-43669(2): Implement PEP 644(3).  Python now requires OpenSSL
     1.1.1 or newer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43567

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43669

   (3) https://peps.python.org/pep-0644/


File: python.info,  Node: Windows<38>,  Next: macOS<29>,  Prev: ビルド<44>,  Up: Python 3 10 0 beta 1

1.26.42.11 Windows
..................

   - bpo-35306(1): Adds additional arguments to *note os.startfile():
     1e98. function.

   - bpo-43538(2): Avoid raising errors from *note
     pathlib.Path.exists(): dde. when passed an invalid filename.

   - bpo-38822(3): Fixed *note os.stat(): 4fc. 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(): dd6. and *note os.path.isdir(): dd8.

   - bpo-26227(4): Fixed decoding of host names in *note
     socket.gethostbyaddr(): 1e99. and *note socket.gethostbyname_ex():
     1e9a.

   - 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<29>,  Next: IDLE<21>,  Prev: Windows<38>,  Up: Python 3 10 0 beta 1

1.26.42.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<40>,  Prev: macOS<29>,  Up: Python 3 10 0 beta 1

1.26.42.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<40>,  Prev: IDLE<21>,  Up: Python 3 10 0 beta 1

1.26.42.14 C API
................

   - bpo-43916(1): Add a new *note Py_TPFLAGS_DISALLOW_INSTANTIATION:
     989. 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(): c7e, *note PyGC_Disable():
     c7f, *note PyGC_IsEnabled(): c80, corresponding to the functions in
     the *note gc: 63. module.

   - bpo-43908(5): Introduce *note Py_TPFLAGS_IMMUTABLETYPE: 602. flag
     for immutable type objects, and modify *note PyType_Ready(): b63.
     to set it for static types.  Patch by Erlend E. Aasland.

   - bpo-43795(6): *note PyMem_Calloc(): 1261. is now available in the
     limited C API (‘Py_LIMITED_API’).

   - bpo-43868(7): *note PyOS_ReadlineFunctionPointer(): 98c. 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): c7a. 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(): c7b, *note Py_IsTrue(): c7c, *note
     Py_IsFalse(): c7d. 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.26.43 Python 3.10.0 alpha 7
-----------------------------

'Release date: 2021-04-05'

* Menu:

* セキュリティ: セキュリティ<30>.
* Core and Builtins: Core and Builtins<124>.
* ライブラリ: ライブラリ<125>.
* Core and Builtins: Core and Builtins<125>.
* ライブラリ: ライブラリ<126>.
* ドキュメント: ドキュメント<38>.
* テスト: テスト<42>.
* ビルド: ビルド<45>.
* Windows: Windows<39>.
* IDLE: IDLE<22>.
* C API: C API<41>.


File: python.info,  Node: セキュリティ<30>,  Next: Core and Builtins<124>,  Up: Python 3 10 0 alpha 7

1.26.43.1 セキュリティ
......................

   - bpo-42988(1): CVE 2021-3426(2): Remove the ‘getfile’ feature of the
     *note pydoc: bd. 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: 61. 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: cce. instances to ‘True’ to re-enable it.

   - bpo-43439(4): Add audit hooks for *note gc.get_objects(): be1,
     *note gc.get_referrers(): be2. and *note gc.get_referents(): be3.
     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<124>,  Next: ライブラリ<125>,  Prev: セキュリティ<30>,  Up: Python 3 10 0 alpha 7

1.26.43.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: ライブラリ<125>,  Next: Core and Builtins<125>,  Prev: Core and Builtins<124>,  Up: Python 3 10 0 alpha 7

1.26.43.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<125>,  Next: ライブラリ<126>,  Prev: ライブラリ<125>,  Up: Python 3 10 0 alpha 7

1.26.43.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: 189.
     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(): f89. 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: 157d.  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__(): 16ba. 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: ライブラリ<126>,  Next: ドキュメント<38>,  Prev: Core and Builtins<125>,  Up: Python 3 10 0 alpha 7

1.26.43.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: e1f. no longer
     ignores query and fragment in the URL of the server.

   - bpo-31956(3): The *note index(): bc2. method of *note array.array:
     6cb. 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: 33e.
     debug callback with *note ssl.SSLContext.sni_callback(): 1ea4.

   - 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: 6d. 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: ba1. 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(): c05. 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(): 1ea5. 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:
     c1e.  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(): 15ef. 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: 72. 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:
     1ce. 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: d7. error handling: If
     ‘sqlite3_column_text()’ and ‘sqlite3_column_blob()’ set
     ‘SQLITE_NOMEM’, *note MemoryError: 191d. 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: d7.  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(): 2dd. 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(): 1ea6. 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(): e24. 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: 1ea7. 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():
     1ea8. and *note tempfile.gettempdirb(): 1ea9. functions 'always'
     return ‘str’ and ‘bytes’ respectively.

   - bpo-39342(44): Expose ‘X509_V_FLAG_ALLOW_PROXY_CERTS’ as *note
     VERIFY_ALLOW_PROXY_CERTS: 1eaa. to allow proxy certificate
     validation as explained in
     ‘https://docs.openssl.org/1.1.1/man7/proxy-certificates/’.

   - bpo-31861(45): Add builtins.aiter and builtins.anext.  Patch by
     Joshua Bronson (@jab), Daniel Pope (@lordmauve), and Justin Wang
     (@justin39).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43720

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43433

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31956

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40066

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42136

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35930

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41369

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43422

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41324

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43577

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43571

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43542

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40645

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43510

   (15) https://peps.python.org/pep-0597/

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43521

   (17) https://bugs.python.org/issue?@action=redirect&bpo=42914

   (18) https://bugs.python.org/issue?@action=redirect&bpo=41361

   (19) https://bugs.python.org/issue?@action=redirect&bpo=43423

   (20) https://bugs.python.org/issue?@action=redirect&bpo=27820

   (21) https://bugs.python.org/issue?@action=redirect&bpo=43445

   (22) https://bugs.python.org/issue?@action=redirect&bpo=43245

   (23) https://bugs.python.org/issue?@action=redirect&bpo=29982

   (24) https://bugs.python.org/issue?@action=redirect&bpo=43428

   (25) 
https://importlib-metadata.readthedocs.io/en/latest/history.html#v3-7-0

   (26) https://bugs.python.org/issue?@action=redirect&bpo=43332

   (27) https://bugs.python.org/issue?@action=redirect&bpo=43420

   (28) https://bugs.python.org/issue?@action=redirect&bpo=43356

   (29) https://bugs.python.org/issue?@action=redirect&bpo=43399

   (30) https://bugs.python.org/issue?@action=redirect&bpo=43369

   (31) https://bugs.python.org/issue?@action=redirect&bpo=43368

   (32) https://bugs.python.org/issue?@action=redirect&bpo=41282

   (33) https://bugs.python.org/issue?@action=redirect&bpo=42129

   (34) https://bugs.python.org/issue?@action=redirect&bpo=43295

   (35) https://bugs.python.org/issue?@action=redirect&bpo=43125

   (36) https://bugs.python.org/issue?@action=redirect&bpo=43084

   (37) https://bugs.python.org/issue?@action=redirect&bpo=42994

   (38) https://bugs.python.org/issue?@action=redirect&bpo=14678

   (39) https://bugs.python.org/issue?@action=redirect&bpo=42782

   (40) https://bugs.python.org/issue?@action=redirect&bpo=40066

   (41) https://bugs.python.org/issue?@action=redirect&bpo=26053

   (42) https://bugs.python.org/issue?@action=redirect&bpo=24160

   (43) https://bugs.python.org/issue?@action=redirect&bpo=40701

   (44) https://bugs.python.org/issue?@action=redirect&bpo=39342

   (45) https://bugs.python.org/issue?@action=redirect&bpo=31861


File: python.info,  Node: ドキュメント<38>,  Next: テスト<42>,  Prev: ライブラリ<126>,  Up: Python 3 10 0 alpha 7

1.26.43.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():
     763, *note time.perf_counter(): e4d, *note time.process_time():
     e4e, or *note time.thread_time(): d07. 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: テスト<42>,  Next: ビルド<45>,  Prev: ドキュメント<38>,  Up: Python 3 10 0 alpha 7

1.26.43.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: ビルド<45>,  Next: Windows<39>,  Prev: テスト<42>,  Up: Python 3 10 0 alpha 7

1.26.43.8 ビルド
................

   - bpo-43179(1): Introduce and correctly use ALIGNOF_X in place of
     SIZEOF_X for alignment-related code in optimized string routines.
     Patch by Jessica Clarke.

   - bpo-43631(2): Update macOS, Windows, and CI to OpenSSL 1.1.1k.

   - bpo-43617(3): Improve configure.ac: Check for presence of
     autoconf-archive package and remove our copies of M4 macros.

   - bpo-43466(4): The ‘configure’ script now supports
     ‘--with-openssl-rpath’ option.

   - bpo-43372(5): Use ‘_freeze_importlib’ to generate code for the
     ‘__hello__’ module.  This approach ensures the code matches the
     interpreter version.  Previously, PYTHON_FOR_REGEN was used to
     generate the code, which might be wrong.  The marshal format for
     code objects has changed with bpo-42246(6), commit 877df851.
     Update the code and the expected code sizes in ctypes
     test_frozentable.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43179

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43631

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43617

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43466

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43372

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42246


File: python.info,  Node: Windows<39>,  Next: IDLE<22>,  Prev: ビルド<45>,  Up: Python 3 10 0 alpha 7

1.26.43.9 Windows
.................

   - bpo-43440(1): Build *note sqlite3: d7. 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<41>,  Prev: Windows<39>,  Up: Python 3 10 0 alpha 7

1.26.43.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<41>,  Prev: IDLE<22>,  Up: Python 3 10 0 alpha 7

1.26.43.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(): 979. and *note Py_DECREF(): 97a.
     functions are now implemented as opaque function calls, rather than
     accessing directly the *note PyObject.ob_refcnt: c79. 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: 1a6.
     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: e1. 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.26.44 Python 3.10.0 alpha 6
-----------------------------

'Release date: 2021-03-01'

* Menu:

* セキュリティ: セキュリティ<31>.
* Core and Builtins: Core and Builtins<126>.
* ライブラリ: ライブラリ<127>.
* Core and Builtins: Core and Builtins<127>.
* ライブラリ: ライブラリ<128>.
* Core and Builtins: Core and Builtins<128>.
* ライブラリ: ライブラリ<129>.
* ドキュメント: ドキュメント<39>.
* テスト: テスト<43>.
* ビルド: ビルド<46>.
* Windows: Windows<40>.
* macOS: macOS<30>.
* IDLE: IDLE<23>.
* C API: C API<42>.


File: python.info,  Node: セキュリティ<31>,  Next: Core and Builtins<126>,  Up: Python 3 10 0 alpha 6

1.26.44.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<126>,  Next: ライブラリ<127>,  Prev: セキュリティ<31>,  Up: Python 3 10 0 alpha 6

1.26.44.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(): c77. function to
     the C-API to check if an object is an instance of *note set: 432.
     but not an instance of a subtype.  Patch by Pablo Galindo.

   - bpo-42990(5): The *note types.FunctionType: c5d. 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(): 18f. and *note exec():
     190. 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: 189. 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: ライブラリ<127>,  Next: Core and Builtins<127>,  Prev: Core and Builtins<126>,  Up: Python 3 10 0 alpha 6

1.26.44.3 ライブラリ
....................

   - bpo-42819(1): *note readline: c2.: 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<127>,  Next: ライブラリ<128>,  Prev: ライブラリ<127>,  Up: Python 3 10 0 alpha 6

1.26.44.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: ライブラリ<128>,  Next: Core and Builtins<128>,  Prev: Core and Builtins<127>,  Up: Python 3 10 0 alpha 6

1.26.44.5 ライブラリ
....................

   - bpo-40692(1): In the *note concurrent.futures.ProcessPoolExecutor:
     211, 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<128>,  Next: ライブラリ<129>,  Prev: ライブラリ<128>,  Up: Python 3 10 0 alpha 6

1.26.44.6 Core and Builtins
...........................

   - bpo-38302(1): If *note object.__ipow__(): bb4. returns *note
     NotImplemented: 447, the operator will correctly fall back to *note
     object.__pow__(): bb5. and *note object.__rpow__(): 449. as
     expected.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38302


File: python.info,  Node: ライブラリ<129>,  Next: ドキュメント<39>,  Prev: Core and Builtins<128>,  Up: Python 3 10 0 alpha 6

1.26.44.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(): c2b. and *note format_exception(): c29.

   - 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: d7.
     aggregate function context when no rows match an aggregate query.
     Patch by Erlend E. Aasland.

   - bpo-43251(6): Improve *note sqlite3: d7. error handling:
     ‘sqlite3_column_name()’ failures now result in *note MemoryError:
     191d.  Patch by Erlend E. Aasland.

   - bpo-40956(7): Fix segfault in *note sqlite3.Connection.backup():
     f3d. 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(): 1eb9. and *note
     readline.get_endidx(): 1eba. 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: 107. 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: bf7, *note O_FSYNC: bf8,
     *note O_SYMLINK: bf9. and *note O_NOFOLLOW_ANY: bfa. for macOS.
     Patch by Donghee Na.

   - bpo-42960(14): Adds *note resource.RLIMIT_KQUEUES: 1ebb. constant
     from FreeBSD to the *note resource: c4. module.

   - bpo-42151(15): Make the pure Python implementation of *note
     xml.etree.ElementTree: 12e. behave the same as the C implementation
     (‘_elementree’) regarding default attribute values (by not setting
     ‘specified_attributes=1’).

   - bpo-29753(16): In ctypes, now packed bitfields are calculated
     properly and the first item of packed bitfields is now shrank
     correctly.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43316

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43317

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43146

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43260

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43258

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43251

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40956

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43172

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43163

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43162

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43146

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43102

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43106

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42960

   (15) https://bugs.python.org/issue?@action=redirect&bpo=42151

   (16) https://bugs.python.org/issue?@action=redirect&bpo=29753


File: python.info,  Node: ドキュメント<39>,  Next: テスト<43>,  Prev: ライブラリ<129>,  Up: Python 3 10 0 alpha 6

1.26.44.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: テスト<43>,  Next: ビルド<46>,  Prev: ドキュメント<39>,  Up: Python 3 10 0 alpha 6

1.26.44.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: ビルド<46>,  Next: Windows<40>,  Prev: テスト<43>,  Up: Python 3 10 0 alpha 6

1.26.44.10 ビルド
.................

   - bpo-43174(1): Windows build now uses ‘/utf-8’ compiler option.

   - bpo-43103(2): Add a new configure ‘--without-static-libpython’
     option to not build the ‘libpythonMAJOR.MINOR.a’ static library and
     not install the ‘python.o’ object file.

   - bpo-13501(3): The configure script can now use 'libedit' instead of
     'readline' with the command line option ‘--with-readline=editline’.

   - bpo-42603(4): Make configure script use pkg-config to detect the
     location of Tcl/Tk headers and libraries, used to build tkinter.

     On macOS, a Tcl/Tk configuration provided by pkg-config will be
     preferred over Tcl/Tk frameworks installed in
     ‘/{System/,}Library/Frameworks’.  If both exist and the latter is
     preferred, the appropriate ‘--with-tcltk-*’ configuration options
     need to be explicitly set.

   - bpo-39448(5): Add the "regen-frozen" makefile target that
     regenerates the code for the frozen ‘__hello__’ module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43174

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43103

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13501

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42603

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39448


File: python.info,  Node: Windows<40>,  Next: macOS<30>,  Prev: ビルド<46>,  Up: Python 3 10 0 alpha 6

1.26.44.11 Windows
..................

   - bpo-43155(1): *note PyCMethod_New(): 1ec0. is now present in
     ‘python3.lib’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43155


File: python.info,  Node: macOS<30>,  Next: IDLE<23>,  Prev: Windows<40>,  Up: Python 3 10 0 alpha 6

1.26.44.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<42>,  Prev: macOS<30>,  Up: Python 3 10 0 alpha 6

1.26.44.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<42>,  Prev: IDLE<23>,  Up: Python 3 10 0 alpha 6

1.26.44.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(): 1ec4. 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: b68.

   - 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: b68.

   - bpo-40170(5): *note PyExceptionClass_Name(): e2e. is now always
     declared as a function, in order to hide implementation details.
     The macro accessed *note PyTypeObject.tp_name: 1ec5. directly.
     Patch by Erlend E. Aasland.

   - bpo-43239(6): The *note PyCFunction_New(): 1ec6. function is now
     exported in the ABI when compiled with ‘-fvisibility=hidden’.

   - bpo-40170(7): *note PyIter_Check(): 1ec7. is now always declared as
     a function, in order to hide implementation details.  The macro
     accessed *note PyTypeObject.tp_iternext: 18a8. directly.  Patch by
     Erlend E. Aasland.

   - bpo-40170(8): Convert *note PyDescr_IsData(): 1ec8. macro to a
     function to hide implementation details: The macro accessed *note
     PyTypeObject.tp_descr_set: 1ec9. directly.  Patch by Erlend E.
     Aasland.

   - bpo-43181(9): Convert *note PyObject_TypeCheck(): 1eca. 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.26.45 Python 3.10.0 alpha 5
-----------------------------

'Release date: 2021-02-02'

* Menu:

* セキュリティ: セキュリティ<32>.
* Core and Builtins: Core and Builtins<129>.
* ライブラリ: ライブラリ<130>.
* Core and Builtins: Core and Builtins<130>.
* ライブラリ: ライブラリ<131>.
* ドキュメント: ドキュメント<40>.
* テスト: テスト<44>.
* ビルド: ビルド<47>.
* Windows: Windows<41>.
* macOS: macOS<31>.
* IDLE: IDLE<24>.
* C API: C API<43>.


File: python.info,  Node: セキュリティ<32>,  Next: Core and Builtins<129>,  Up: Python 3 10 0 alpha 5

1.26.45.1 セキュリティ
......................

   - bpo-42938(1): Avoid static buffers when computing the repr of *note
     ctypes.c_double: 1ecd. and *note ctypes.c_longdouble: 1ece. values.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42938


File: python.info,  Node: Core and Builtins<129>,  Next: ライブラリ<130>,  Prev: セキュリティ<32>,  Up: Python 3 10 0 alpha 5

1.26.45.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(): d4f. calls in the
     compiler with regular *note SystemError: 3f1. 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(): 67a. / *note
     Py_Finalize(): 679. 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: 189. 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: ライブラリ<130>,  Next: Core and Builtins<130>,  Prev: Core and Builtins<129>,  Up: Python 3 10 0 alpha 5

1.26.45.3 ライブラリ
....................

   - bpo-37324(1): Remove deprecated aliases to *note
     コレクション抽象基底クラス: c52. from the *note collections: 1e.
     module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37324


File: python.info,  Node: Core and Builtins<130>,  Next: ライブラリ<131>,  Prev: ライブラリ<130>,  Up: Python 3 10 0 alpha 5

1.26.45.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: ライブラリ<131>,  Next: ドキュメント<40>,  Prev: Core and Builtins<130>,  Up: Python 3 10 0 alpha 5

1.26.45.5 ライブラリ
....................

   - bpo-43108(1): Fixed a reference leak in the *note curses: 2e.
     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: 104. by
     20-30%.  Patch by Anthony Sottile.

   - bpo-42323(5): Fix *note math.nextafter(): 8ae. for NaN on AIX.

   - bpo-42955(6): Add *note sys.stdlib_module_names: c1e, 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: 76a.'s new ‘compact’
     param in *note TestResult: 1525. 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: 76a. 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(): d4f. function and the
     *note faulthandler: 5b. module now dump the list of extension
     modules on a fatal error.

   - bpo-42848(13): Removed recursion from *note TracebackException:
     76a. 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 ‘cProfile’ and ‘profile’ to catch *note
     BrokenPipeError: 1412.

   - 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: 2e. module if available.

   - bpo-33289(34): Correct call to *note tkinter.colorchooser: fa. to
     return RGB triplet of ints instead of floats.  Patch by Cheryl
     Sabella.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43108

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43077

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41282

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43014

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42323

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42955

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42944

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42934

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42931

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38250

   (11) https://bugs.python.org/issue?@action=redirect&bpo=42877

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42923

   (13) https://bugs.python.org/issue?@action=redirect&bpo=42848

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42901

   (15) https://bugs.python.org/issue?@action=redirect&bpo=42780

   (16) https://bugs.python.org/issue?@action=redirect&bpo=42866

   (17) https://bugs.python.org/issue?@action=redirect&bpo=42846

   (18) https://peps.python.org/pep-0489/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42851

   (20) https://bugs.python.org/issue?@action=redirect&bpo=42834

   (21) https://bugs.python.org/issue?@action=redirect&bpo=41748

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40810

   (23) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (24) https://peps.python.org/pep-0489/

   (25) https://bugs.python.org/issue?@action=redirect&bpo=42802

   (26) https://bugs.python.org/issue?@action=redirect&bpo=24464

   (27) https://bugs.python.org/issue?@action=redirect&bpo=42384

   (28) https://bugs.python.org/issue?@action=redirect&bpo=42383

   (29) https://bugs.python.org/issue?@action=redirect&bpo=42005

   (30) https://bugs.python.org/issue?@action=redirect&bpo=41604

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41149

   (32) https://bugs.python.org/issue?@action=redirect&bpo=38307

   (33) https://bugs.python.org/issue?@action=redirect&bpo=39273

   (34) https://bugs.python.org/issue?@action=redirect&bpo=33289


File: python.info,  Node: ドキュメント<40>,  Next: テスト<44>,  Prev: ライブラリ<131>,  Up: Python 3 10 0 alpha 5

1.26.45.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: テスト<44>,  Next: ビルド<47>,  Prev: ドキュメント<40>,  Up: Python 3 10 0 alpha 5

1.26.45.7 テスト
................

   - bpo-40823(1): Use ‘unittest.TestLoader().loadTestsFromTestCase()’
     instead of ‘unittest.makeSuite()’ in *note sqlite3: d7. tests.
     Patch by Erlend E. Aasland.

   - bpo-40810(2): In *note sqlite3: d7, 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: ビルド<47>,  Next: Windows<41>,  Prev: テスト<44>,  Up: Python 3 10 0 alpha 5

1.26.45.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: 58.
     module looks for ‘setuptools’ and ‘pip’ wheel packages in this
     directory: if both are present, these wheel packages are used
     instead of ensurepip bundled wheel packages.

     Some Linux distribution packaging policies recommend against
     bundling dependencies.  For example, Fedora installs wheel packages
     in the ‘/usr/share/python-wheels/’ directory and don't install the
     ‘ensurepip._bundled’ package.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43031

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36143

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42874

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42856


File: python.info,  Node: Windows<41>,  Next: macOS<31>,  Prev: ビルド<47>,  Up: Python 3 10 0 alpha 5

1.26.45.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<31>,  Next: IDLE<24>,  Prev: Windows<41>,  Up: Python 3 10 0 alpha 5

1.26.45.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<43>,  Prev: macOS<31>,  Up: Python 3 10 0 alpha 5

1.26.45.11 IDLE
...............

   - bpo-43008(1): Make IDLE invoke *note sys.excepthook(): be9. 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<43>,  Prev: IDLE<24>,  Up: Python 3 10 0 alpha 5

1.26.45.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(): 1eda. 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.26.46 Python 3.10.0 alpha 4
-----------------------------

'Release date: 2021-01-04'

* Menu:

* Core and Builtins: Core and Builtins<131>.
* ライブラリ: ライブラリ<132>.
* Core and Builtins: Core and Builtins<132>.
* ライブラリ: ライブラリ<133>.
* Core and Builtins: Core and Builtins<133>.
* ライブラリ: ライブラリ<134>.
* ドキュメント: ドキュメント<41>.
* テスト: テスト<45>.
* ビルド: ビルド<48>.
* macOS: macOS<32>.
* Tools/Demos: Tools/Demos<26>.
* C API: C API<44>.


File: python.info,  Node: Core and Builtins<131>,  Next: ライブラリ<132>,  Up: Python 3 10 0 alpha 4

1.26.46.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: 44c. 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: ライブラリ<132>,  Next: Core and Builtins<132>,  Prev: Core and Builtins<131>,  Up: Python 3 10 0 alpha 4

1.26.46.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<132>,  Next: ライブラリ<133>,  Prev: ライブラリ<132>,  Up: Python 3 10 0 alpha 4

1.26.46.3 Core and Builtins
...........................

   - bpo-32381(1): Fix encoding name when running a ‘.pyc’ file on
     Windows: *note PyRun_SimpleFileExFlags(): 1edf. now uses the
     correct encoding to decode the filename.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32381


File: python.info,  Node: ライブラリ<133>,  Next: Core and Builtins<133>,  Prev: Core and Builtins<132>,  Up: Python 3 10 0 alpha 4

1.26.46.4 ライブラリ
....................

   - bpo-42195(1): The ‘__args__’ of the parameterized generics for
     *note typing.Callable: ba9. and *note collections.abc.Callable:
     bca. 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: bcb. 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(): 398.

   - 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<133>,  Next: ライブラリ<134>,  Prev: ライブラリ<133>,  Up: Python 3 10 0 alpha 4

1.26.46.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: ライブラリ<134>,  Next: ドキュメント<41>,  Prev: Core and Builtins<133>,  Up: Python 3 10 0 alpha 4

1.26.46.6 ライブラリ
....................

   - bpo-42257(1): Handle empty string in variable executable in
     platform.libc_ver()

   - bpo-42772(2): randrange() now raises a TypeError when step is
     specified without a stop argument.  Formerly, it silently ignored
     the step argument.

   - bpo-42759(3): Fixed equality comparison of ‘tkinter.Variable’ and
     *note tkinter.font.Font: 1ee3.  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(): 31d. and *note
     typing.get_origin(): 31c. now support PEP 604(7) union types and
     PEP 612(8) additions to ‘Callable’.

   - bpo-42655(9): *note subprocess: df. '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: 101.), message boxes (*note
     tkinter.messagebox: ff.) or color choose dialog (*note
     tkinter.colorchooser: fa.) are created without arguments 'master'
     and 'parent', and the default root window is not yet created, and
     ‘NoDefaultRoot()’ was not called, a new temporal hidden root window
     will be created automatically.  It will not be set as the default
     root window and will be destroyed right after closing the dialog
     window.  It will help to use these simple dialog windows in
     programs which do not need other GUI.

   - bpo-25246(13): Optimized *note collections.deque.remove(): 1ee4.

   - bpo-35728(14): Added a root parameter to *note
     tkinter.font.nametofont(): 1ee5.

   - bpo-15303(15): *note tkinter: f9. supports now widgets with boolean
     value False.

   - bpo-42681(16): Fixed range checks for color and pair numbers in
     *note curses: 2e.

   - bpo-42685(17): Improved placing of simple query windows in Tkinter
     (such as *note tkinter.simpledialog.askinteger(): 1ee6.).  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: f9. functions and constructors which
     need a default root window raise now *note RuntimeError: 317. with
     descriptive message instead of obscure *note AttributeError: 1b4.
     or *note NameError: 66c. 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: 712, rather than logging
     them directly into *note sys.stderr: d09. 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(): c58. 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: 10d.  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(): fdb. adds line number
     information (if available) in error message for malformed nodes.

   - bpo-42470(39): *note random.sample(): b30. 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: 107. and
     the interpreter in formatting of SyntaxError with lineno not set
     (‘traceback’ was changed to match interpreter).

   - bpo-42393(43): Raise *note OverflowError: c5b. instead of silent
     truncation in *note socket.ntohs(): c5a. and *note socket.htons():
     c59.  Silent truncation was deprecated in Python 3.7.  Patch by
     Erlend E. Aasland

   - bpo-42222(44): Harmonized *note random.randrange(): c45. argument
     handling to match *note range(): d13.

        * The integer test and conversion in ‘randrange()’ now uses
          *note operator.index(): 1ee7.

        * Non-integer arguments to ‘randrange()’ are deprecated.

        * The ‘ValueError’ is deprecated in favor of a ‘TypeError’.

        * It now runs a little faster than before.

     (Contributed by Raymond Hettinger and Serhiy Storchaka.)

   - bpo-42163(45): Restore compatibility for ‘uname_result’ around
     deepcopy and _replace.

   - bpo-42090(46): ‘zipfile.Path.joinpath’ now accepts arbitrary
     arguments, same as ‘pathlib.Path.joinpath’.

   - bpo-1635741(47): Port the _csv module to the multi-phase
     initialization API ( PEP 489(48)).

   - bpo-42059(49): *note typing.TypedDict: 29b. 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(): 4c4. and *note
     inspect.Signature.from_callable(): b25.

   - 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(): 11f1. support for
     VxWorks RTOS.

   - bpo-40219(56): Lowered ‘tkinter.ttk.LabeledScale’ dummy widget to
     prevent hiding part of the content label.

   - bpo-37193(57): Fixed memory leak in ‘socketserver.ThreadingMixIn’
     introduced in Python 3.7.

   - bpo-39068(58): Fix initialization race condition in ‘a85encode()’
     and ‘b85encode()’ in *note base64: f.  Patch by Brandon Stansbury.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42257

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42772

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42759

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42756

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23328

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42740

   (7) https://peps.python.org/pep-0604/

   (8) https://peps.python.org/pep-0612/

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42655

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42727

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38308

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42721

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25246

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35728

   (15) https://bugs.python.org/issue?@action=redirect&bpo=15303

   (16) https://bugs.python.org/issue?@action=redirect&bpo=42681

   (17) https://bugs.python.org/issue?@action=redirect&bpo=42685

   (18) https://bugs.python.org/issue?@action=redirect&bpo=9694

   (19) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (20) https://peps.python.org/pep-0489/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37961

   (22) https://bugs.python.org/issue?@action=redirect&bpo=42630

   (23) https://bugs.python.org/issue?@action=redirect&bpo=42639

   (24) https://bugs.python.org/issue?@action=redirect&bpo=42644

   (25) https://bugs.python.org/issue?@action=redirect&bpo=42639

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36541

   (27) https://bugs.python.org/issue?@action=redirect&bpo=42382

   (28) https://bugs.python.org/issue?@action=redirect&bpo=41877

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39717

   (30) https://bugs.python.org/issue?@action=redirect&bpo=41877

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41559

   (32) https://peps.python.org/pep-0612/

   (33) https://bugs.python.org/issue?@action=redirect&bpo=42385

   (34) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (35) https://bugs.python.org/issue?@action=redirect&bpo=34750

   (36) https://bugs.python.org/issue?@action=redirect&bpo=42517

   (37) https://bugs.python.org/issue?@action=redirect&bpo=42678

   (38) https://bugs.python.org/issue?@action=redirect&bpo=28964

   (39) https://bugs.python.org/issue?@action=redirect&bpo=42470

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (41) https://bugs.python.org/issue?@action=redirect&bpo=42388

   (42) https://bugs.python.org/issue?@action=redirect&bpo=34463

   (43) https://bugs.python.org/issue?@action=redirect&bpo=42393

   (44) https://bugs.python.org/issue?@action=redirect&bpo=42222

   (45) https://bugs.python.org/issue?@action=redirect&bpo=42163

   (46) https://bugs.python.org/issue?@action=redirect&bpo=42090

   (47) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (48) https://peps.python.org/pep-0489/

   (49) https://bugs.python.org/issue?@action=redirect&bpo=42059

   (50) https://bugs.python.org/issue?@action=redirect&bpo=41960

   (51) https://bugs.python.org/issue?@action=redirect&bpo=41907

   (52) https://bugs.python.org/issue?@action=redirect&bpo=41891

   (53) https://bugs.python.org/issue?@action=redirect&bpo=24792

   (54) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (55) https://bugs.python.org/issue?@action=redirect&bpo=41462

   (56) https://bugs.python.org/issue?@action=redirect&bpo=40219

   (57) https://bugs.python.org/issue?@action=redirect&bpo=37193

   (58) https://bugs.python.org/issue?@action=redirect&bpo=39068


File: python.info,  Node: ドキュメント<41>,  Next: テスト<45>,  Prev: ライブラリ<134>,  Up: Python 3 10 0 alpha 4

1.26.46.7 ドキュメント
......................

   - bpo-17140(1): Add documentation for the *note
     multiprocessing.pool.ThreadPool: 1ee9. 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: テスト<45>,  Next: ビルド<48>,  Prev: ドキュメント<41>,  Up: Python 3 10 0 alpha 4

1.26.46.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: ビルド<48>,  Next: macOS<32>,  Prev: テスト<45>,  Up: Python 3 10 0 alpha 4

1.26.46.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<32>,  Next: Tools/Demos<26>,  Prev: ビルド<48>,  Up: Python 3 10 0 alpha 4

1.26.46.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<26>,  Next: C API<44>,  Prev: macOS<32>,  Up: Python 3 10 0 alpha 4

1.26.46.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<44>,  Prev: Tools/Demos<26>,  Up: Python 3 10 0 alpha 4

1.26.46.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: c4. 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.26.47 Python 3.10.0 alpha 3
-----------------------------

'リリース日: 2020-12-07'

* Menu:

* セキュリティ: セキュリティ<33>.
* Core and Builtins: Core and Builtins<134>.
* ライブラリ: ライブラリ<135>.
* Core and Builtins: Core and Builtins<135>.
* ライブラリ: ライブラリ<136>.
* Core and Builtins: Core and Builtins<136>.
* ライブラリ: ライブラリ<137>.
* Core and Builtins: Core and Builtins<137>.
* ライブラリ: ライブラリ<138>.
* ドキュメント: ドキュメント<42>.
* テスト: テスト<46>.
* ビルド: ビルド<49>.
* Windows: Windows<42>.
* macOS: macOS<33>.
* IDLE: IDLE<25>.
* Tools/Demos: Tools/Demos<27>.
* C API: C API<45>.


File: python.info,  Node: セキュリティ<33>,  Next: Core and Builtins<134>,  Up: Python 3 10 0 alpha 3

1.26.47.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<134>,  Next: ライブラリ<135>,  Prev: セキュリティ<33>,  Up: Python 3 10 0 alpha 3

1.26.47.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: 19fe.:

        - *note collections.OrderedDict.items(): 9da.

        - *note dict.items(): bb3.

        - *note enumerate(): 1839.

        - *note functools.reduce(): 156.

        - *note itertools.combinations(): 16cb.

        - *note itertools.combinations_with_replacement(): 163b.

        - *note itertools.permutations(): 1982.

        - *note itertools.product(): 16cc.

        - *note itertools.zip_longest(): 1658.

        - *note zip(): 446.

     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: 2f9. 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: ライブラリ<135>,  Next: Core and Builtins<135>,  Prev: Core and Builtins<134>,  Up: Python 3 10 0 alpha 3

1.26.47.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<135>,  Next: ライブラリ<136>,  Prev: ライブラリ<135>,  Up: Python 3 10 0 alpha 3

1.26.47.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: c95. 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: bcb. 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: ライブラリ<136>,  Next: Core and Builtins<136>,  Prev: Core and Builtins<135>,  Up: Python 3 10 0 alpha 3

1.26.47.5 ライブラリ
....................

   - bpo-40077(1): Convert *note queue: be. to use heap types.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40077


File: python.info,  Node: Core and Builtins<136>,  Next: ライブラリ<137>,  Prev: ライブラリ<136>,  Up: Python 3 10 0 alpha 3

1.26.47.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: ライブラリ<137>,  Next: Core and Builtins<137>,  Prev: Core and Builtins<136>,  Up: Python 3 10 0 alpha 3

1.26.47.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<137>,  Next: ライブラリ<138>,  Prev: ライブラリ<137>,  Up: Python 3 10 0 alpha 3

1.26.47.8 Core and Builtins
...........................

   - bpo-42233(1): Allow ‘GenericAlias’ objects to use *note union type
     expressions: ba6.  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: ライブラリ<138>,  Next: ドキュメント<42>,  Prev: Core and Builtins<137>,  Up: Python 3 10 0 alpha 3

1.26.47.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: 543.
     instead of *note IndexError: 18ed. 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(): 1a24.

   - 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: 76a. 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(): c03.
     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 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: 12f0. respect
     subclassing.  Now the *note filecmp.dircmp.subdirs: 1ef9. behaves
     as expected when subclassing dircmp.

   - bpo-42413(19): The exception *note socket.timeout: c11. is now an
     alias of *note TimeoutError: c12.

   - 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: 7a. external bootstrap
     code: ‘importlib._bootstrap_external’ now uses regular imports to
     import builtin modules.  When it is imported, the builtin *note
     __import__(): caa. function is already fully working and so can be
     used to import builtin modules like *note sys: e2.  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(): 764, *note time.perf_counter():
     e4d. and *note time.monotonic(): 763. 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(): 1efa.  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(): e4d. on Windows and *note
     time.monotonic(): 763. 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():
     eb0. and *note time.monotonic_ns(): eaf. added in Python 3.7 to
     avoid this precision loss.

   - bpo-42318(31): Fixed support of non-BMP characters in *note
     tkinter: f9. on macOS.

   - bpo-42350(32): Fix the *note threading.Thread: 427. 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__: c26. to allow
     retrieving the original value of *note threading.excepthook(): c27.
     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:
     1ea.  It is now deprecated, scheduled for removal in Python 3.12.

   - bpo-42251(40): Added *note threading.gettrace(): c22. and *note
     threading.getprofile(): c23. to retrieve the functions set by *note
     threading.settrace(): c24. and *note threading.setprofile(): c25.
     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(): 1e4b.
     function now returns ‘'UTF-8'’ rather than the device encoding if
     the *note Python UTF-8 Mode: a4b. 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(): c29, *note
     traceback.format_exception_only(): c2a, and *note
     traceback.print_exception(): c2b. 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: d7. 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(): 1efb.
     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(): bf6. in
     the *note os: a5. module.  Patch by Pablo Galindo

   - bpo-34215(55): Clarify the error message for *note
     asyncio.IncompleteReadError: 1efc. when ‘expected’ is ‘None’.

   - bpo-41543(56): Add async context manager support for
     contextlib.nullcontext.

   - bpo-21041(57): *note pathlib.PurePath.parents: bfd. 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: 114. and *note http.client:
     72. now send ‘http/1.1’ ALPN extension during TLS handshake when no
     custom context is supplied.

   - bpo-41001(61): Add *note os.eventfd(): bf5. 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: bc.'s
     ‘Function’ objects.  Patch by Batuhan Taskaya

   - bpo-35498(65): Add slice support to *note pathlib.PurePath.parents:
     bfd.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5054

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42562

   (3) https://bugs.python.org/issue?@action=redirect&bpo=17735

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42116

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42532

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38200

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41818

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42487

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42482

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41818

   (11) https://bugs.python.org/issue?@action=redirect&bpo=42392

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42392

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28468

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42299

   (15) https://bugs.python.org/issue?@action=redirect&bpo=26131

   (16) https://bugs.python.org/issue?@action=redirect&bpo=41818

   (17) https://bugs.python.org/issue?@action=redirect&bpo=42392

   (18) https://bugs.python.org/issue?@action=redirect&bpo=15450

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42413

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (21) https://bugs.python.org/issue?@action=redirect&bpo=42406

   (22) https://bugs.python.org/issue?@action=redirect&bpo=42403

   (23) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (24) https://bugs.python.org/issue?@action=redirect&bpo=42375

   (25) https://bugs.python.org/issue?@action=redirect&bpo=41713

   (26) https://peps.python.org/pep-0489/

   (27) https://bugs.python.org/issue?@action=redirect&bpo=37205

   (28) https://bugs.python.org/issue?@action=redirect&bpo=42328

   (29) https://bugs.python.org/issue?@action=redirect&bpo=42345

   (30) https://bugs.python.org/issue?@action=redirect&bpo=37205

   (31) https://bugs.python.org/issue?@action=redirect&bpo=42318

   (32) https://bugs.python.org/issue?@action=redirect&bpo=42350

   (33) https://bugs.python.org/issue?@action=redirect&bpo=42333

   (34) https://bugs.python.org/issue?@action=redirect&bpo=42014

   (35) https://bugs.python.org/issue?@action=redirect&bpo=42237

   (36) https://bugs.python.org/issue?@action=redirect&bpo=42308

   (37) https://bugs.python.org/issue?@action=redirect&bpo=42131

   (38) https://bugs.python.org/issue?@action=redirect&bpo=41877

   (39) https://bugs.python.org/issue?@action=redirect&bpo=42264

   (40) https://bugs.python.org/issue?@action=redirect&bpo=42251

   (41) https://bugs.python.org/issue?@action=redirect&bpo=42249

   (42) https://bugs.python.org/issue?@action=redirect&bpo=42236

   (43) https://bugs.python.org/issue?@action=redirect&bpo=41754

   (44) https://bugs.python.org/issue?@action=redirect&bpo=42183

   (45) https://bugs.python.org/issue?@action=redirect&bpo=42140

   (46) https://bugs.python.org/issue?@action=redirect&bpo=42133

   (47) https://bugs.python.org/issue?@action=redirect&bpo=26131

   (48) https://bugs.python.org/issue?@action=redirect&bpo=39825

   (49) https://bugs.python.org/issue?@action=redirect&bpo=26389

   (50) https://bugs.python.org/issue?@action=redirect&bpo=41889

   (51) https://bugs.python.org/issue?@action=redirect&bpo=41861

   (52) https://bugs.python.org/issue?@action=redirect&bpo=40624

   (53) https://bugs.python.org/issue?@action=redirect&bpo=28850

   (54) https://bugs.python.org/issue?@action=redirect&bpo=41625

   (55) https://bugs.python.org/issue?@action=redirect&bpo=34215

   (56) https://bugs.python.org/issue?@action=redirect&bpo=41543

   (57) https://bugs.python.org/issue?@action=redirect&bpo=21041

   (58) https://bugs.python.org/issue?@action=redirect&bpo=41332

   (59) https://bugs.python.org/issue?@action=redirect&bpo=12800

   (60) https://bugs.python.org/issue?@action=redirect&bpo=40968

   (61) https://bugs.python.org/issue?@action=redirect&bpo=41001

   (62) https://bugs.python.org/issue?@action=redirect&bpo=40816

   (63) https://bugs.python.org/issue?@action=redirect&bpo=40550

   (64) https://bugs.python.org/issue?@action=redirect&bpo=39411

   (65) https://bugs.python.org/issue?@action=redirect&bpo=35498


File: python.info,  Node: ドキュメント<42>,  Next: テスト<46>,  Prev: ライブラリ<138>,  Up: Python 3 10 0 alpha 3

1.26.47.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: テスト<46>,  Next: ビルド<49>,  Prev: ドキュメント<42>,  Up: Python 3 10 0 alpha 3

1.26.47.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: ビルド<49>,  Next: Windows<42>,  Prev: テスト<46>,  Up: Python 3 10 0 alpha 3

1.26.47.12 ビルド
.................

   - bpo-31904(1): remove libnet dependency from detect_socket() for
     VxWorks

   - bpo-42398(2): Fix a race condition in "make regen-all" when make
     -jN option is used to run jobs in parallel.  The clinic.py script
     now only use atomic write to write files.  Moveover, generated
     files are now left unchanged if the content does not change, to not
     change the file modification time.

   - bpo-41617(3): Fix building ‘pycore_bitutils.h’ internal header on
     old clang version without ‘__builtin_bswap16()’ (ex: Xcode 4.6.3 on
     Mac OS X 10.7).  Patch by Joshua Root and Victor Stinner.

   - bpo-38823(4): It is no longer possible to build the ‘_ctypes’
     extension module without ‘wchar_t’ type: remove ‘CTYPES_UNICODE’
     macro.  Anyway, the ‘wchar_t’ type is required to build Python.
     Patch by Victor Stinner.

   - bpo-42087(5): Support was removed for AIX 5.3 and below.  See
     bpo-40680(6).

   - bpo-40998(7): Addressed three compiler warnings found by undefined
     behavior sanitizer (ubsan).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42398

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41617

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38823

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42087

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40680

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40998


File: python.info,  Node: Windows<42>,  Next: macOS<33>,  Prev: ビルド<49>,  Up: Python 3 10 0 alpha 3

1.26.47.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<33>,  Next: IDLE<25>,  Prev: Windows<42>,  Up: Python 3 10 0 alpha 3

1.26.47.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<27>,  Prev: macOS<33>,  Up: Python 3 10 0 alpha 3

1.26.47.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<27>,  Next: C API<45>,  Prev: IDLE<25>,  Up: Python 3 10 0 alpha 3

1.26.47.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<45>,  Prev: Tools/Demos<27>,  Up: Python 3 10 0 alpha 3

1.26.47.17 C API
................

   - bpo-42423(1): The *note PyType_FromSpecWithBases(): 397. and *note
     PyType_FromModuleAndSpec(): 398. functions now accept a single
     class as the 'bases' argument.

   - bpo-1635741(2): Port *note select: c9. 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: 63. 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(): 5fc. and *note Py_SIZE():
     b66. 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: e1. extension module to
     multiphase initialization ( PEP 489(18))

   - bpo-1635741(19): Port *note grp: 69. and *note pwd: ba. 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: c95.  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): ‘Py_GetPath()’, ‘Py_GetPrefix()’,
     ‘Py_GetExecPrefix()’, ‘Py_GetProgramFullPath()’,
     ‘Py_GetPythonHome()’ and ‘Py_GetProgramName()’ functions now return
     ‘NULL’ if called before *note Py_Initialize(): 67a. (before Python
     is initialized).  Use the new *note Python Initialization
     Configuration API: 83d. to get the *note Python Path
     Configuration.: c84.  Patch by Victor Stinner.

   - bpo-42260(28): The *note PyConfig_Read(): b74. function now only
     parses *note PyConfig.argv: 60e. arguments once: *note
     PyConfig.parse_argv: 1f05. 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(): c74. and *note
     Py_XNewRef(): c75. functions to increment the reference count of an
     object and return the object.  Patch by Victor Stinner.

   - bpo-42260(30): When *note Py_Initialize(): 67a. is called twice,
     the second call now updates more *note sys: e2. attributes for the
     configuration, rather than only *note sys.argv: 161e.  Patch by
     Victor Stinner.

   - bpo-41832(31): The *note PyType_FromModuleAndSpec(): 398. function
     now accepts NULL ‘tp_doc’ slot.

   - bpo-1635741(32): Added *note PyModule_AddObjectRef(): 806.
     function: similar to *note PyModule_AddObject(): 807. but don't
     steal a reference to the value on success.  Patch by Victor
     Stinner.

   - bpo-42171(33): The *note METH_FASTCALL: 353. calling convention is
     added to the limited API. The functions *note PyModule_AddType():
     d41, *note PyType_FromModuleAndSpec(): 398, *note
     PyType_GetModule(): d3b. and *note PyType_GetModuleState(): d3c.
     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(): c76. can now accept static
     types.

   - bpo-30459(36): *note PyList_SET_ITEM(): 828, *note
     PyTuple_SET_ITEM(): 827. and *note PyCell_SET(): c85. 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.26.48 Python 3.10.0 alpha 2
-----------------------------

'Release date: 2020-11-03'

* Menu:

* セキュリティ: セキュリティ<34>.
* Core and Builtins: Core and Builtins<138>.
* ライブラリ: ライブラリ<139>.
* Core and Builtins: Core and Builtins<139>.
* ライブラリ: ライブラリ<140>.
* ドキュメント: ドキュメント<43>.
* テスト: テスト<47>.
* ビルド: ビルド<50>.
* Windows: Windows<43>.
* macOS: macOS<34>.
* IDLE: IDLE<26>.
* C API: C API<46>.


File: python.info,  Node: セキュリティ<34>,  Next: Core and Builtins<138>,  Up: Python 3 10 0 alpha 2

1.26.48.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<138>,  Next: ライブラリ<139>,  Prev: セキュリティ<34>,  Up: Python 3 10 0 alpha 2

1.26.48.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: 189. 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: 330. class.
     They always raised a *note TypeError: 29c.

   - bpo-41902(16): Micro optimization when compute *note sq_item: 1f09.
     and *note mp_subscript: 1f0a. of *note range: d13.  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: ライブラリ<139>,  Next: Core and Builtins<139>,  Prev: Core and Builtins<138>,  Up: Python 3 10 0 alpha 2

1.26.48.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<139>,  Next: ライブラリ<140>,  Prev: ライブラリ<139>,  Up: Python 3 10 0 alpha 2

1.26.48.4 Core and Builtins
...........................

   - bpo-38605(1): Enable ‘from __future__ import annotations’ ( PEP
     563(2)) by default.  The values found in *note __annotations__:
     672. 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: ライブラリ<140>,  Next: ドキュメント<43>,  Prev: Core and Builtins<139>,  Up: Python 3 10 0 alpha 2

1.26.48.5 ライブラリ
....................

   - bpo-35455(1): On Solaris, *note thread_time(): d07. 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(): 462. of *note typing: 10d. types
     containing *note Generic Alias Types: aa4. 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: 1e69. class now keeps
     a reference to the builtin *note open(): 333. 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: 10e. 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(): 6c5. in
     case an uid (gid) specified in ‘user’ (‘group’, ‘extra_groups’)
     overflows ‘uid_t’ (‘gid_t’).

   - bpo-42103(9): *note InvalidFileException: 1f0e. and *note
     RecursionError: 1125. 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: 495.
     subclasses.  Patch by Dean Inwood.

   - bpo-19270(16): *note sched.scheduler.cancel(): 1f0f. 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(): 187f. 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(): 6c5. 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: d7. 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(): 1102. 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: bad. 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(): 31b. now
     ignores non-ASCII characters.

   - bpo-41747(31): Ensure all methods that generated from *note
     dataclasses.dataclass(): 6ec. 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(): 8c9. now ignores empty entries
     in ‘PATHEXT’ instead of treating them as a match.

   - bpo-40492(38): Fix ‘--outfile’ for ‘cProfile’ / ‘profile’ 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: cb. module now uses *note
     pickle.DEFAULT_PROTOCOL: c0b. 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: 73. module now supports
     the parsing of cookies in CURL-style cookiejar files through
     MozillaCookieJar on all platforms.  Previously, such cookie entries
     would be silently ignored when loading a cookiejar with such
     entries.

     Additionally, the HTTP Only attribute is persisted in the object,
     and will be correctly written to file if the MozillaCookieJar
     object is subsequently dumped.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35455

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42233

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29566

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26789

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42157

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42157

   (7) https://peps.python.org/pep-0489/

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42146

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42103

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41490

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41052

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42089

   (13) https://bugs.python.org/issue?@action=redirect&bpo=41491

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42065

   (15) https://bugs.python.org/issue?@action=redirect&bpo=41966

   (16) https://bugs.python.org/issue?@action=redirect&bpo=19270

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28660

   (18) https://bugs.python.org/issue?@action=redirect&bpo=35823

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42043

   (20) https://bugs.python.org/issue?@action=redirect&bpo=42021

   (21) https://bugs.python.org/issue?@action=redirect&bpo=39101

   (22) https://bugs.python.org/issue?@action=redirect&bpo=41976

   (23) https://bugs.python.org/issue?@action=redirect&bpo=41943

   (24) https://bugs.python.org/issue?@action=redirect&bpo=41923

   (25) https://peps.python.org/pep-0613/

   (26) https://bugs.python.org/issue?@action=redirect&bpo=41905

   (27) https://bugs.python.org/issue?@action=redirect&bpo=23706

   (28) https://bugs.python.org/issue?@action=redirect&bpo=41876

   (29) https://bugs.python.org/issue?@action=redirect&bpo=41831

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39337

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41747

   (32) https://bugs.python.org/issue?@action=redirect&bpo=30681

   (33) https://bugs.python.org/issue?@action=redirect&bpo=41586

   (34) https://bugs.python.org/issue?@action=redirect&bpo=41229

   (35) https://bugs.python.org/issue?@action=redirect&bpo=16396

   (36) https://bugs.python.org/issue?@action=redirect&bpo=4356

   (37) https://bugs.python.org/issue?@action=redirect&bpo=40592

   (38) https://bugs.python.org/issue?@action=redirect&bpo=40492

   (39) https://bugs.python.org/issue?@action=redirect&bpo=34204

   (40) https://bugs.python.org/issue?@action=redirect&bpo=27321

   (41) https://bugs.python.org/issue?@action=redirect&bpo=38976


File: python.info,  Node: ドキュメント<43>,  Next: テスト<47>,  Prev: ライブラリ<140>,  Up: Python 3 10 0 alpha 2

1.26.48.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: 1f11. and *note types: 1f12. 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: aa4. and *note
     types.GenericAlias: bcb.  Also added an entry in glossary for *note
     generic types: 1dc.

   - 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: テスト<47>,  Next: ビルド<50>,  Prev: ドキュメント<43>,  Up: Python 3 10 0 alpha 2

1.26.48.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: ビルド<50>,  Next: Windows<43>,  Prev: テスト<47>,  Up: Python 3 10 0 alpha 2

1.26.48.8 ビルド
................

   - bpo-38980(1): Add ‘-fno-semantic-interposition’ to both the compile
     and link line when building with ‘--enable-optimizations’.  Patch
     by Victor Stinner and Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38980


File: python.info,  Node: Windows<43>,  Next: macOS<34>,  Prev: ビルド<50>,  Up: Python 3 10 0 alpha 2

1.26.48.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<34>,  Next: IDLE<26>,  Prev: Windows<43>,  Up: Python 3 10 0 alpha 2

1.26.48.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<46>,  Prev: macOS<34>,  Up: Python 3 10 0 alpha 2

1.26.48.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<46>,  Prev: IDLE<26>,  Up: Python 3 10 0 alpha 2

1.26.48.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: 188f.'s lifetime is
     managed through the ‘self’ argument of a *note PyCFunction: 1830.

   - bpo-40423(3): The *note subprocess: df. 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(): 1f19. 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.26.49 Python 3.10.0 alpha 1
-----------------------------

'Release date: 2020-10-05'

* Menu:

* セキュリティ: セキュリティ<35>.
* Core and Builtins: Core and Builtins<140>.
* ライブラリ: ライブラリ<141>.
* Core and Builtins: Core and Builtins<141>.
* ライブラリ: ライブラリ<142>.
* Core and Builtins: Core and Builtins<142>.
* ライブラリ: ライブラリ<143>.
* Core and Builtins: Core and Builtins<143>.
* ライブラリ: ライブラリ<144>.
* Core and Builtins: Core and Builtins<144>.
* ライブラリ: ライブラリ<145>.
* Core and Builtins: Core and Builtins<145>.
* ライブラリ: ライブラリ<146>.
* Core and Builtins: Core and Builtins<146>.
* ライブラリ: ライブラリ<147>.
* Core and Builtins: Core and Builtins<147>.
* ライブラリ: ライブラリ<148>.
* Core and Builtins: Core and Builtins<148>.
* ライブラリ: ライブラリ<149>.
* Core and Builtins: Core and Builtins<149>.
* ライブラリ: ライブラリ<150>.
* Core and Builtins: Core and Builtins<150>.
* ライブラリ: ライブラリ<151>.
* Core and Builtins: Core and Builtins<151>.
* ライブラリ: ライブラリ<152>.
* Core and Builtins: Core and Builtins<152>.
* ライブラリ: ライブラリ<153>.
* Core and Builtins: Core and Builtins<153>.
* ライブラリ: ライブラリ<154>.
* Core and Builtins: Core and Builtins<154>.
* ライブラリ: ライブラリ<155>.
* ドキュメント: ドキュメント<44>.
* テスト: テスト<48>.
* ビルド: ビルド<51>.
* Windows: Windows<44>.
* macOS: macOS<35>.
* IDLE: IDLE<27>.
* C API: C API<47>.


File: python.info,  Node: セキュリティ<35>,  Next: Core and Builtins<140>,  Up: Python 3 10 0 alpha 1

1.26.49.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<140>,  Next: ライブラリ<141>,  Prev: セキュリティ<35>,  Up: Python 3 10 0 alpha 1

1.26.49.2 Core and Builtins
...........................

   - bpo-41909(1): Fixed stack overflow in *note issubclass(): 2fc. and
     *note isinstance(): 2fb. 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: ライブラリ<141>,  Next: Core and Builtins<141>,  Prev: Core and Builtins<140>,  Up: Python 3 10 0 alpha 1

1.26.49.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<141>,  Next: ライブラリ<142>,  Prev: ライブラリ<141>,  Up: Python 3 10 0 alpha 1

1.26.49.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: bcb.
     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: ライブラリ<142>,  Next: Core and Builtins<142>,  Prev: Core and Builtins<141>,  Up: Python 3 10 0 alpha 1

1.26.49.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: ea. 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<142>,  Next: ライブラリ<143>,  Prev: ライブラリ<142>,  Up: Python 3 10 0 alpha 1

1.26.49.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: ライブラリ<143>,  Next: Core and Builtins<143>,  Prev: Core and Builtins<142>,  Up: Python 3 10 0 alpha 1

1.26.49.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<143>,  Next: ライブラリ<144>,  Prev: ライブラリ<143>,  Up: Python 3 10 0 alpha 1

1.26.49.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():
     a17.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41681


File: python.info,  Node: ライブラリ<144>,  Next: Core and Builtins<144>,  Prev: Core and Builtins<143>,  Up: Python 3 10 0 alpha 1

1.26.49.9 ライブラリ
....................

   - bpo-41675(1): The implementation of *note signal.siginterrupt():
     14f6. 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<144>,  Next: ライブラリ<145>,  Prev: ライブラリ<144>,  Up: Python 3 10 0 alpha 1

1.26.49.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: 191d.  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: ライブラリ<145>,  Next: Core and Builtins<145>,  Prev: Core and Builtins<144>,  Up: Python 3 10 0 alpha 1

1.26.49.11 ライブラリ
.....................

   - bpo-1635741(1): Port the *note zlib: 13c. 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<145>,  Next: ライブラリ<146>,  Prev: ライブラリ<145>,  Up: Python 3 10 0 alpha 1

1.26.49.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: ライブラリ<146>,  Next: Core and Builtins<146>,  Prev: Core and Builtins<145>,  Up: Python 3 10 0 alpha 1

1.26.49.13 ライブラリ
.....................

   - bpo-40077(1): Convert ‘_operator’ to use *note PyType_FromSpec():
     396.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40077


File: python.info,  Node: Core and Builtins<146>,  Next: ライブラリ<147>,  Prev: ライブラリ<146>,  Up: Python 3 10 0 alpha 1

1.26.49.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: ライブラリ<147>,  Next: Core and Builtins<147>,  Prev: Core and Builtins<146>,  Up: Python 3 10 0 alpha 1

1.26.49.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<147>,  Next: ライブラリ<148>,  Prev: ライブラリ<147>,  Up: Python 3 10 0 alpha 1

1.26.49.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: ライブラリ<148>,  Next: Core and Builtins<148>,  Prev: Core and Builtins<147>,  Up: Python 3 10 0 alpha 1

1.26.49.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<148>,  Next: ライブラリ<149>,  Prev: ライブラリ<148>,  Up: Python 3 10 0 alpha 1

1.26.49.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(): 1694. with integer argument is now
     faster (9-60%).

   - bpo-41334(6): Constructors *note str(): 1ea, *note bytes(): 1d2.
     and *note bytearray(): 1d1. 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: ライブラリ<149>,  Next: Core and Builtins<149>,  Prev: Core and Builtins<148>,  Up: Python 3 10 0 alpha 1

1.26.49.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<149>,  Next: ライブラリ<150>,  Prev: ライブラリ<149>,  Up: Python 3 10 0 alpha 1

1.26.49.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: ライブラリ<150>,  Next: Core and Builtins<150>,  Prev: Core and Builtins<149>,  Up: Python 3 10 0 alpha 1

1.26.49.21 ライブラリ
.....................

   - bpo-1635741(1): Port *note faulthandler: 5b. 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<150>,  Next: ライブラリ<151>,  Prev: ライブラリ<150>,  Up: Python 3 10 0 alpha 1

1.26.49.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:
     189.

   - 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: ライブラリ<151>,  Next: Core and Builtins<151>,  Prev: Core and Builtins<150>,  Up: Python 3 10 0 alpha 1

1.26.49.23 ライブラリ
.....................

   - bpo-40077(1): Convert ‘_bz2’ to use *note PyType_FromSpec(): 396.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40077


File: python.info,  Node: Core and Builtins<151>,  Next: ライブラリ<152>,  Prev: ライブラリ<151>,  Up: Python 3 10 0 alpha 1

1.26.49.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(): 446. now supports PEP 618(3)'s ‘strict’
     parameter, which raises a *note ValueError: 15a. 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: 189.
     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: ライブラリ<152>,  Next: Core and Builtins<152>,  Prev: Core and Builtins<151>,  Up: Python 3 10 0 alpha 1

1.26.49.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<152>,  Next: ライブラリ<153>,  Prev: ライブラリ<152>,  Up: Python 3 10 0 alpha 1

1.26.49.26 Core and Builtins
............................

   - bpo-40947(1): The Python *note Path Configuration: c84. now takes
     *note PyConfig.platlibdir: 1f35. 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: 189. 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: 194. 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: 15a. when validating custom
     AST's where the constants ‘True’, ‘False’ and ‘None’ are used
     within a *note ast.Name: 1f36. node.

   - bpo-40854(11): Allow overriding *note sys.platlibdir: 2b4. via a
     new *note PYTHONPLATLIBDIR: 1f37. 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: 5c. 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: 32b. operator
     and functions *note contains(): cb0, *note indexOf(): cb1. and
     *note countOf(): cb2. of the *note operator: a3. module.

   - bpo-40792(16): Attributes ‘start’, ‘stop’ and ‘step’ of the *note
     range: d13. object now always has exact type *note int: 32e.
     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: 189. 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(): 397. 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(): 5fc. is changed to the inline
     static function.  Patch by Donghee Na.

   - bpo-40696(22): Fix a hang that can arise after *note
     generator.throw(): 90a. 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: 29c. messages about missing
     or extra arguments now include the function's *note qualified name:
     1f38.  Patch by Dennis Sweeney.

   - bpo-29590(25): Make the stack trace correct after calling *note
     generator.throw(): 90a. 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: ライブラリ<153>,  Next: Core and Builtins<153>,  Prev: Core and Builtins<152>,  Up: Python 3 10 0 alpha 1

1.26.49.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<153>,  Next: ライブラリ<154>,  Prev: ライブラリ<153>,  Up: Python 3 10 0 alpha 1

1.26.49.28 Core and Builtins
............................

   - bpo-37999(1): Builtin and extension functions that take integer
     arguments no longer accept *note Decimal: 1cd.s, *note Fraction:
     1ce.s and other objects that can be converted to integers only with
     a loss (e.g.  that have the *note __int__(): 443. method but do not
     have the *note __index__(): 444. method).

   - bpo-29882(2): Add *note int.bit_count(): bb0, 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: ライブラリ<154>,  Next: Core and Builtins<154>,  Prev: Core and Builtins<153>,  Up: Python 3 10 0 alpha 1

1.26.49.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(): bd4. 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<154>,  Next: ライブラリ<155>,  Prev: ライブラリ<154>,  Up: Python 3 10 0 alpha 1

1.26.49.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: ライブラリ<155>,  Next: ドキュメント<44>,  Prev: Core and Builtins<154>,  Up: Python 3 10 0 alpha 1

1.26.49.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(): fdb.  Also document stripping of spaces and
     tabs for *note eval(): 18f.

   - bpo-41773(3): Note in documentation that *note random.choices():
     1087. doesn't support non-finite weights, raise *note ValueError:
     15a. when given non-finite weights.

   - bpo-41840(4): Fix a bug in the *note symtable: e1. 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(): bc8. 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: 1880.  It now accepts "empty" statements (only
     whitespaces and comments) and rejects misindentent statements.

   - bpo-41833(8): The *note threading.Thread: 427. 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: c2d, *note
     types.NotImplementedType: c2f. and *note types.NoneType: c2e. 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: 6d4. to *note memoryview:
     1dd.

   - 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():
     314.  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: d7. with *note
     ProgrammingError: 584.

   - bpo-39010(29): Restarting a ‘ProactorEventLoop’ on Windows no
     longer logs spurious ‘ConnectionResetErrors’.

   - bpo-41638(30): *note ProgrammingError: 584. message for absent
     parameter in *note sqlite3: d7. 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: d7.

   - 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(): 9fb. 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(): 9fb. 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: 1412.):
     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(): 6e7. support for VxWorks
     RTOS.

   - bpo-41316(47): Fix the *note tarfile: e7. 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: 119.

   - bpo-35328(51): Set the environment variable ‘VIRTUAL_ENV_PROMPT’ at
     *note venv: 11a. 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(): 1503.

   - 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: 6cb. as a *note
     MutableSequence: 6cc.  Patch by Pablo Galindo.

   - bpo-39168(62): Remove the ‘__new__’ method of *note typing.Generic:
     1a12.

   - 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: 543. to ignore
     error if the filesystem is read-only, instead of only ignoring
     *note FileNotFoundError: 24f. and *note PermissionError: 10fd.

   - 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: 106. 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(): 156.

   - bpo-40521(71): Remove freelist from collections.deque().

   - bpo-31938(72): Fix default-value signatures of several functions in
     the *note select: c9. 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(): 1f3e. 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(): 2df. 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: cb5. from being subclassed.

   - bpo-35018(81): Add the *note xml.sax.handler.LexicalHandler: c37.
     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: 58. 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: df.
     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: 87. module.

   - bpo-23427(89): Add *note sys.orig_argv: c1d. 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: 184f, 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: 2c. 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: c9. 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: 1f3f. 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: 62. module has been
     moved to a new *note graphlib: 68. 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(): 89d,
     ‘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: d7. 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(): 1ee7. now
     always has exact type *note int: 32e.  Previously, the result could
     have been an instance of a subclass of ‘int’.

   - bpo-40767(107): *note webbrowser: 11e. 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: 2d. 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(): 1f40.

   - bpo-16995(110): Add *note base64.b32hexencode(): 1f4. and *note
     base64.b32hexdecode(): 1f5. to support the Base32 Encoding with
     Extended Hex Alphabet.

   - bpo-30008(111): Fix *note ssl: d8. 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: 1f41. flag for *note
     os.pwritev(): f21.

   - bpo-40737(116): Fix possible reference leak for *note sqlite3: d7.
     initialization.

   - bpo-40726(117): Handle cases where the ‘end_lineno’ is ‘None’ on
     *note ast.increment_lineno(): 1d2b.

   - 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: 6b. 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(): 2fd. passed ‘usedforsecurity’
     to OpenSSL EVP constructor ‘_hashlib.new()’.  test_hashlib and
     test_smtplib handle strict security policy better.

   - bpo-40614(121): *note ast.parse(): 1d4. 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(): 1946. 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(): d41.

   - bpo-32309(126): Added a new *note coroutine: 8a7. *note
     asyncio.to_thread(): cbd.  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(): cbe. that can directly take keyword arguments.

   - bpo-36543(127): Restored the deprecated ‘xml.etree.cElementTree’
     module.

   - bpo-40611(128): *note MAP_POPULATE: 1f42. 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: bb.  Patch by Gregory Schevchenko.

   - bpo-35714(141): *note struct.error: 16dd. is now raised if there is
     a null character in a *note struct: de. format string.

   - bpo-38144(142): Added the 'root_dir' and 'dir_fd' parameters in
     *note glob.glob(): 2df.

   - bpo-26543(143): Fix ‘IMAP4.noop()’ when debug mode is enabled (ex:
     ‘imaplib.Debug = 3’).

   - bpo-12178(144): *note csv.writer(): 89e. 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: 29c. 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(): 2ab. 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: c51. is the only subclass of ‘ParserBase’
     and its ‘error()’ implementation was deprecated in Python 3.4 and
     removed in Python 3.5.

   - bpo-34226(150): Fix ‘cgi.parse_multipart’ without content_length.
     Patch by Roger Duran

   - bpo-33660(151): Fix pathlib.PosixPath to resolve a relative path
     located on the root directory properly.

   - bpo-28557(152): Improve the error message for a misbehaving
     ‘rawio.readinto’

   - bpo-26680(153): The d.is_integer() method is added to the Decimal
     type, for compatibility with other number types.

   - bpo-26680(154): The x.is_integer() method is incorporated into the
     abstract types of the numeric tower, Real, Rational and Integral,
     with appropriate default implementations.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41900

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41887

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41773

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41840

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41842

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40564

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40670

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41833

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41817

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41810

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41815

   (12) https://bugs.python.org/issue?@action=redirect&bpo=41816

   (13) https://bugs.python.org/issue?@action=redirect&bpo=41517

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39587

   (15) https://bugs.python.org/issue?@action=redirect&bpo=41792

   (16) https://github.com/python/typing/issues/751

   (17) https://bugs.python.org/issue?@action=redirect&bpo=41789

   (18) https://bugs.python.org/issue?@action=redirect&bpo=32218

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39651

   (20) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (21) https://peps.python.org/pep-0489/

   (22) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (23) https://peps.python.org/pep-0489/

   (24) https://bugs.python.org/issue?@action=redirect&bpo=41732

   (25) https://bugs.python.org/issue?@action=redirect&bpo=41720

   (26) https://bugs.python.org/issue?@action=redirect&bpo=41696

   (27) https://bugs.python.org/issue?@action=redirect&bpo=41687

   (28) https://bugs.python.org/issue?@action=redirect&bpo=41662

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39010

   (30) https://bugs.python.org/issue?@action=redirect&bpo=41638

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41662

   (32) https://bugs.python.org/issue?@action=redirect&bpo=41513

   (33) https://bugs.python.org/issue?@action=redirect&bpo=41609

   (34) https://bugs.python.org/issue?@action=redirect&bpo=39994

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32751

   (36) https://bugs.python.org/issue?@action=redirect&bpo=37658

   (37) https://bugs.python.org/issue?@action=redirect&bpo=40782

   (38) https://bugs.python.org/issue?@action=redirect&bpo=41520

   (39) https://bugs.python.org/issue?@action=redirect&bpo=41528

   (40) https://bugs.python.org/issue?@action=redirect&bpo=41513

   (41) https://bugs.python.org/issue?@action=redirect&bpo=41503

   (42) https://bugs.python.org/issue?@action=redirect&bpo=41497

   (43) https://bugs.python.org/issue?@action=redirect&bpo=41467

   (44) https://bugs.python.org/issue?@action=redirect&bpo=41425

   (45) https://bugs.python.org/issue?@action=redirect&bpo=41421

   (46) https://bugs.python.org/issue?@action=redirect&bpo=41440

   (47) https://bugs.python.org/issue?@action=redirect&bpo=41316

   (48) https://bugs.python.org/issue?@action=redirect&bpo=41384

   (49) https://bugs.python.org/issue?@action=redirect&bpo=41317

   (50) https://bugs.python.org/issue?@action=redirect&bpo=41364

   (51) https://bugs.python.org/issue?@action=redirect&bpo=35328

   (52) https://bugs.python.org/issue?@action=redirect&bpo=41341

   (53) https://bugs.python.org/issue?@action=redirect&bpo=41344

   (54) https://bugs.python.org/issue?@action=redirect&bpo=41333

   (55) https://bugs.python.org/issue?@action=redirect&bpo=41288

   (56) https://bugs.python.org/issue?@action=redirect&bpo=39017

   (57) https://www.cve.org/CVERecord?id=CVE-2019-20907

   (58) https://bugs.python.org/issue?@action=redirect&bpo=41273

   (59) https://bugs.python.org/issue?@action=redirect&bpo=41235

   (60) https://bugs.python.org/issue?@action=redirect&bpo=41207

   (61) https://bugs.python.org/issue?@action=redirect&bpo=29727

   (62) https://bugs.python.org/issue?@action=redirect&bpo=39168

   (63) https://bugs.python.org/issue?@action=redirect&bpo=41194

   (64) https://bugs.python.org/issue?@action=redirect&bpo=41195

   (65) https://bugs.python.org/issue?@action=redirect&bpo=41193

   (66) https://bugs.python.org/issue?@action=redirect&bpo=41182

   (67) https://bugs.python.org/issue?@action=redirect&bpo=41161

   (68) https://bugs.python.org/issue?@action=redirect&bpo=40874

   (69) https://bugs.python.org/issue?@action=redirect&bpo=41138

   (70) https://bugs.python.org/issue?@action=redirect&bpo=31082

   (71) https://bugs.python.org/issue?@action=redirect&bpo=40521

   (72) https://bugs.python.org/issue?@action=redirect&bpo=31938

   (73) https://bugs.python.org/issue?@action=redirect&bpo=41068

   (74) https://bugs.python.org/issue?@action=redirect&bpo=41058

   (75) https://bugs.python.org/issue?@action=redirect&bpo=41056

   (76) https://bugs.python.org/issue?@action=redirect&bpo=41056

   (77) https://bugs.python.org/issue?@action=redirect&bpo=41056

   (78) https://bugs.python.org/issue?@action=redirect&bpo=41048

   (79) https://bugs.python.org/issue?@action=redirect&bpo=41043

   (80) https://bugs.python.org/issue?@action=redirect&bpo=41025

   (81) https://bugs.python.org/issue?@action=redirect&bpo=35018

   (82) https://bugs.python.org/issue?@action=redirect&bpo=41002

   (83) https://bugs.python.org/issue?@action=redirect&bpo=40448

   (84) https://bugs.python.org/issue?@action=redirect&bpo=40967

   (85) https://bugs.python.org/issue?@action=redirect&bpo=40924

   (86) https://bugs.python.org/issue?@action=redirect&bpo=40955

   (87) https://bugs.python.org/issue?@action=redirect&bpo=40855

   (88) https://bugs.python.org/issue?@action=redirect&bpo=40939

   (89) https://bugs.python.org/issue?@action=redirect&bpo=23427

   (90) https://bugs.python.org/issue?@action=redirect&bpo=33689

   (91) https://bugs.python.org/issue?@action=redirect&bpo=40884

   (92) https://bugs.python.org/issue?@action=redirect&bpo=40876

   (93) https://bugs.python.org/issue?@action=redirect&bpo=39791

   (94) https://bugs.python.org/issue?@action=redirect&bpo=40807

   (95) https://bugs.python.org/issue?@action=redirect&bpo=32604

   (96) https://bugs.python.org/issue?@action=redirect&bpo=39791

   (97) https://bugs.python.org/issue?@action=redirect&bpo=39314

   (98) https://bugs.python.org/issue?@action=redirect&bpo=17005

   (99) https://bugs.python.org/issue?@action=redirect&bpo=40834

   (100) https://bugs.python.org/issue?@action=redirect&bpo=40755

   (101) https://bugs.python.org/issue?@action=redirect&bpo=26407

   (102) https://bugs.python.org/issue?@action=redirect&bpo=39384

   (103) https://bugs.python.org/issue?@action=redirect&bpo=40744

   (104) https://bugs.python.org/issue?@action=redirect&bpo=40777

   (105) https://bugs.python.org/issue?@action=redirect&bpo=38488

   (106) https://bugs.python.org/issue?@action=redirect&bpo=40792

   (107) https://bugs.python.org/issue?@action=redirect&bpo=40767

   (108) https://bugs.python.org/issue?@action=redirect&bpo=40791

   (109) https://bugs.python.org/issue?@action=redirect&bpo=40795

   (110) https://bugs.python.org/issue?@action=redirect&bpo=16995

   (111) https://bugs.python.org/issue?@action=redirect&bpo=30008

   (112) https://bugs.python.org/issue?@action=redirect&bpo=30064

   (113) https://bugs.python.org/issue?@action=redirect&bpo=40759

   (114) https://bugs.python.org/issue?@action=redirect&bpo=40756

   (115) https://bugs.python.org/issue?@action=redirect&bpo=37129

   (116) https://bugs.python.org/issue?@action=redirect&bpo=40737

   (117) https://bugs.python.org/issue?@action=redirect&bpo=40726

   (118) https://bugs.python.org/issue?@action=redirect&bpo=40698

   (119) https://bugs.python.org/issue?@action=redirect&bpo=40695

   (120) https://bugs.python.org/issue?@action=redirect&bpo=9216

   (121) https://bugs.python.org/issue?@action=redirect&bpo=40614

   (122) https://bugs.python.org/issue?@action=redirect&bpo=40626

   (123) https://bugs.python.org/issue?@action=redirect&bpo=25920

   (124) https://bugs.python.org/issue?@action=redirect&bpo=40671

   (125) https://peps.python.org/pep-0489/

   (126) https://bugs.python.org/issue?@action=redirect&bpo=32309

   (127) https://bugs.python.org/issue?@action=redirect&bpo=36543

   (128) https://bugs.python.org/issue?@action=redirect&bpo=40611

   (129) https://bugs.python.org/issue?@action=redirect&bpo=39881

   (130) https://bugs.python.org/issue?@action=redirect&bpo=13097

   (131) https://bugs.python.org/issue?@action=redirect&bpo=39385

   (132) https://bugs.python.org/issue?@action=redirect&bpo=23082

   (133) https://bugs.python.org/issue?@action=redirect&bpo=40318

   (134) https://bugs.python.org/issue?@action=redirect&bpo=40105

   (135) https://bugs.python.org/issue?@action=redirect&bpo=40084

   (136) https://bugs.python.org/issue?@action=redirect&bpo=31122

   (137) https://bugs.python.org/issue?@action=redirect&bpo=39728

   (138) https://bugs.python.org/issue?@action=redirect&bpo=39244

   (139) https://bugs.python.org/issue?@action=redirect&bpo=39040

   (140) https://bugs.python.org/issue?@action=redirect&bpo=38731

   (141) https://bugs.python.org/issue?@action=redirect&bpo=35714

   (142) https://bugs.python.org/issue?@action=redirect&bpo=38144

   (143) https://bugs.python.org/issue?@action=redirect&bpo=26543

   (144) https://bugs.python.org/issue?@action=redirect&bpo=12178

   (145) https://bugs.python.org/issue?@action=redirect&bpo=36290

   (146) https://bugs.python.org/issue?@action=redirect&bpo=33944

   (147) https://bugs.python.org/issue?@action=redirect&bpo=35078

   (148) https://bugs.python.org/issue?@action=redirect&bpo=29620

   (149) https://bugs.python.org/issue?@action=redirect&bpo=31844

   (150) https://bugs.python.org/issue?@action=redirect&bpo=34226

   (151) https://bugs.python.org/issue?@action=redirect&bpo=33660

   (152) https://bugs.python.org/issue?@action=redirect&bpo=28557

   (153) https://bugs.python.org/issue?@action=redirect&bpo=26680

   (154) https://bugs.python.org/issue?@action=redirect&bpo=26680


File: python.info,  Node: ドキュメント<44>,  Next: テスト<48>,  Prev: ライブラリ<155>,  Up: Python 3 10 0 alpha 1

1.26.49.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: 1f44.

   - 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: テスト<48>,  Next: ビルド<51>,  Prev: ドキュメント<44>,  Up: Python 3 10 0 alpha 1

1.26.49.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: ed.: Rename ‘blacklist’ parameter
     of *note check__all__(): 1f46. to ‘not_exported’.

   - bpo-41477(5): Make ctypes optional in test_genericalias.

   - bpo-41085(6): Fix integer overflow in the *note
     array.array.index(): bc2. 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(): 1f47.
     function to the *note test.support: ed. 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: 77. 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: ビルド<51>,  Next: Windows<44>,  Prev: テスト<48>,  Up: Python 3 10 0 alpha 1

1.26.49.34 ビルド
.................

   - bpo-38249(1): Update *note Py_UNREACHABLE: f77. 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: 13d. module
     and its tests were not included when Python is installed with
     ‘make’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38249

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41617

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40204

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36020

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40684

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40683


File: python.info,  Node: Windows<44>,  Next: macOS<35>,  Prev: ビルド<51>,  Up: Python 3 10 0 alpha 1

1.26.49.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<35>,  Next: IDLE<27>,  Prev: Windows<44>,  Up: Python 3 10 0 alpha 1

1.26.49.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<47>,  Prev: macOS<35>,  Up: Python 3 10 0 alpha 1

1.26.49.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<47>,  Prev: IDLE<27>,  Up: Python 3 10 0 alpha 1

1.26.49.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: c94. structure.

   - bpo-41692(2): The ‘PyUnicode_InternImmortal()’ function is now
     deprecated and will be removed in Python 3.12: use *note
     PyUnicode_InternInPlace(): c88. instead.  Patch by Victor Stinner.

   - bpo-41842(3): Add *note PyCodec_Unregister(): c71. 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: c94. structure.  Patch by Victor Stinner.

   - bpo-41689(5): Types created with *note PyType_FromSpec(): 396. now
     make any signature in their ‘tp_doc’ slot accessible from
     ‘__text_signature__’.

   - bpo-41524(6): Fix bug in *note PyOS_mystrnicmp(): 1f4d. and *note
     PyOS_mystricmp(): 1f4e. 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(): c6f. and
     *note PyDateTime_TIME_GET_TZINFO(): c70. macros for accessing the
     ‘tzinfo’ attributes of *note datetime.datetime: 6ed. and *note
     datetime.time: 495. objects.

   - bpo-40170(9): Revert *note PyType_HasFeature(): 1f4f. change: it
     reads again directly the *note PyTypeObject.tp_flags: 1e87. member
     when the limited C API is not used, rather than always calling
     *note PyType_GetFlags(): 1f50. 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(): 832. and *note
     PyBuffer_Release(): 833.

   - 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(): 1f51. and *note
     PyObject_INIT_VAR(): 1f52. macros become aliases to, respectively,
     *note PyObject_Init(): e33. and *note PyObject_InitVar(): 1f53.
     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(): 3b9. and *note Py_BuildValue(): 5f5.
     formats which use ‘#’: ‘es#’, ‘et#’, ‘s#’, ‘u#’, ‘y#’, ‘z#’, ‘U#’
     and ‘Z#’.  See *note Parsing arguments and building values: 608.
     and the PEP 353(20).

   - bpo-40910(21): Export explicitly the *note Py_GetArgcArgv(): 1f54.
     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(): 822. without *note
     GIL: 418. held had been allowed for historical reason.  It is no
     longer allowed.

   - bpo-40826(25): *note PyOS_InterruptOccurred(): 1f55. now fails with
     a fatal error if it is called with the GIL released.

   - bpo-40792(26): The result of *note PyNumber_Index(): c6d. now
     always has exact type *note int: 32e.  Previously, the result could
     have been an instance of a subclass of ‘int’.

   - bpo-39573(27): Convert *note Py_REFCNT(): 552. and *note Py_SIZE():
     b66. macros to static inline functions.  They cannot be used as
     l-value anymore: use *note Py_SET_REFCNT(): c82. and *note
     Py_SET_SIZE(): b67. 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: 1a6. 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.26.50 Python 3.9.0 beta 1
---------------------------

'リリース日: 2020-05-19'

* Menu:

* セキュリティ: セキュリティ<36>.
* Core and Builtins: Core and Builtins<155>.
* ライブラリ: ライブラリ<156>.
* ドキュメント: ドキュメント<45>.
* テスト: テスト<49>.
* ビルド: ビルド<52>.
* Windows: Windows<45>.
* macOS: macOS<36>.
* Tools/Demos: Tools/Demos<28>.
* C API: C API<48>.


File: python.info,  Node: セキュリティ<36>,  Next: Core and Builtins<155>,  Up: Python 3 9 0 beta 1

1.26.50.1 セキュリティ
......................

   - bpo-40501(1): *note uuid: 119. no longer uses *note ctypes: 2d. 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<155>,  Next: ライブラリ<156>,  Prev: セキュリティ<36>,  Up: Python 3 9 0 beta 1

1.26.50.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(): 1f59. 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(): 1d70. 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: 5a. to multiphase initialization
     ( PEP 489(10)).

   - bpo-40523(11): Add pass-throughs for *note hash(): 9e7. and *note
     reversed(): c40. to *note weakref.proxy: e19. objects.  Patch by
     Pablo Galindo.

   - bpo-1635741(12): Port *note syslog: e5. 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(): 90a.

   - 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():
     d12. 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: ライブラリ<156>,  Next: ドキュメント<45>,  Prev: Core and Builtins<155>,  Up: Python 3 9 0 beta 1

1.26.50.3 ライブラリ
....................

   - bpo-40662(1): Fixed *note ast.get_source_segment(): da0. 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(): 1f5b. function
     to the *note zoneinfo: 13d. module.  Patch by Paul Ganssle.

   - bpo-40645(4): The *note hmac.HMAC: f01. 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: 6b. module can now use SHA3 hashes
     and SHAKE XOF from OpenSSL when available.

   - bpo-40479(8): The *note hashlib: 6b. now compiles with OpenSSL
     3.0.0-alpha2.

   - bpo-40257(9): Revert changes to *note inspect.getdoc(): 237.

   - bpo-40607(10): When cancelling a task due to timeout, *note
     asyncio.wait_for(): 9fb. 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: 13d. 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: d8. and *note hashlib: 6b. 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: 467. 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(): db7. objects can now be
     the targets of weakrefs.

   - bpo-40559(23): Fix possible memory leak in the C implementation of
     *note asyncio.Task: 467.

   - 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():
     fdb. in the presence of malformed *note ast.Dict: 1f5c. 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(): 1f5d. now produces
     correct 'ptype' strings instead of empty strings.

   - bpo-39435(30): The first argument of *note pickle.loads(): 10cf. 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: 36. to use gdbm_count if
     possible when calling *note len(): a24.  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(): 1f5e.

   - 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(): ce8. method to the *note
     SimpleQueue: ce7. class to explicitly close the queue.

   - bpo-39966(39): Revert bpo-25597(40).  *note
     unittest.mock.MagicMock: 1243. 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(): cda. 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: 194. is now
     reversible.

   - bpo-39075(46): The repr for *note types.SimpleNamespace: 6f0. is
     now insertion ordered rather than alphabetical.

   - bpo-40192(47): On AIX, *note thread_time(): d07. 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:
     494. and *note datetime.datetime: 6ed. now return a *note named
     tuple: a42. instead of a *note tuple: 1d9.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40662

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40665

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40536

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40645

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40645

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40637

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37630

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40479

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40257

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40607

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40612

   (12) https://bugs.python.org/issue?@action=redirect&bpo=40597

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40571

   (14) https://bugs.python.org/issue?@action=redirect&bpo=40503

   (15) https://peps.python.org/pep-0615/

   (16) https://bugs.python.org/issue?@action=redirect&bpo=40397

   (17) https://bugs.python.org/issue?@action=redirect&bpo=40549

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31033

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40541

   (20) https://bugs.python.org/issue?@action=redirect&bpo=40515

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31033

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40504

   (23) https://bugs.python.org/issue?@action=redirect&bpo=40559

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40480

   (25) https://bugs.python.org/issue?@action=redirect&bpo=40495

   (26) https://bugs.python.org/issue?@action=redirect&bpo=40457

   (27) https://bugs.python.org/issue?@action=redirect&bpo=40355

   (28) https://bugs.python.org/issue?@action=redirect&bpo=40465

   (29) https://bugs.python.org/issue?@action=redirect&bpo=40459

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39435

   (31) https://bugs.python.org/issue?@action=redirect&bpo=39305

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32494

   (33) https://bugs.python.org/issue?@action=redirect&bpo=40453

   (34) https://bugs.python.org/issue?@action=redirect&bpo=40286

   (35) https://bugs.python.org/issue?@action=redirect&bpo=40394

   (36) https://bugs.python.org/issue?@action=redirect&bpo=39995

   (37) https://bugs.python.org/issue?@action=redirect&bpo=30966

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30966

   (39) https://bugs.python.org/issue?@action=redirect&bpo=39966

   (40) https://bugs.python.org/issue?@action=redirect&bpo=25597

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39791

   (42) https://bugs.python.org/issue?@action=redirect&bpo=40375

   (43) https://bugs.python.org/issue?@action=redirect&bpo=40389

   (44) https://bugs.python.org/issue?@action=redirect&bpo=40291

   (45) https://bugs.python.org/issue?@action=redirect&bpo=40273

   (46) https://bugs.python.org/issue?@action=redirect&bpo=39075

   (47) https://bugs.python.org/issue?@action=redirect&bpo=40192

   (48) https://bugs.python.org/issue?@action=redirect&bpo=40025

   (49) https://bugs.python.org/issue?@action=redirect&bpo=39058

   (50) https://bugs.python.org/issue?@action=redirect&bpo=24416


File: python.info,  Node: ドキュメント<45>,  Next: テスト<49>,  Prev: ライブラリ<156>,  Up: Python 3 9 0 beta 1

1.26.50.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(): 896. 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():
     10cf. 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: テスト<49>,  Next: ビルド<52>,  Prev: ドキュメント<45>,  Up: Python 3 9 0 beta 1

1.26.50.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: ビルド<52>,  Next: Windows<45>,  Prev: テスト<49>,  Up: Python 3 9 0 beta 1

1.26.50.6 ビルド
................

   - bpo-40653(1): Move _dirnameW out of HAVE_SYMLINK to fix a potential
     compiling issue.

   - bpo-40514(2): Add ‘--with-experimental-isolated-subinterpreters’
     build option to ‘configure’: better isolate subinterpreters,
     experimental build mode.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40653

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40514


File: python.info,  Node: Windows<45>,  Next: macOS<36>,  Prev: ビルド<52>,  Up: Python 3 9 0 beta 1

1.26.50.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<36>,  Next: Tools/Demos<28>,  Prev: Windows<45>,  Up: Python 3 9 0 beta 1

1.26.50.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<28>,  Next: C API<48>,  Prev: macOS<36>,  Up: Python 3 9 0 beta 1

1.26.50.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<48>,  Prev: Tools/Demos<28>,  Up: Python 3 9 0 beta 1

1.26.50.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(): b72. function now
     returns a strong reference to the frame.

   - bpo-40428(6): Remove the following functions from the C API. Call
     *note PyGC_Collect(): d5a. 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(): b6a. function: get the
     frame next outer frame.

   - bpo-40421(8): New *note PyFrame_GetCode(): b6e. function: return a
     borrowed reference to the frame code.

   - bpo-40217(9): Ensure that instances of types created with *note
     PyType_FromSpecWithBases(): 397. will visit its class object when
     traversing references in the garbage collector (implemented as an
     extension of the provided *note tp_traverse: 373.).  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.26.51 Python 3.9.0 alpha 6
----------------------------

'リリース日: 2020-04-27'

* Menu:

* セキュリティ: セキュリティ<37>.
* Core and Builtins: Core and Builtins<156>.
* ライブラリ: ライブラリ<157>.
* ドキュメント: ドキュメント<46>.
* テスト: テスト<50>.
* ビルド: ビルド<53>.
* Windows: Windows<46>.
* macOS: macOS<37>.
* IDLE: IDLE<28>.
* Tools/Demos: Tools/Demos<29>.
* C API: C API<49>.


File: python.info,  Node: セキュリティ<37>,  Next: Core and Builtins<156>,  Up: Python 3 9 0 alpha 6

1.26.51.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:
     1e85. class of the *note urllib.request: 114. 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<156>,  Next: ライブラリ<157>,  Prev: セキュリティ<37>,  Up: Python 3 9 0 alpha 6

1.26.51.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: c4. to multiphase
     initialization ( PEP 489(13)).

   - bpo-1635741(14): Port *note math: 91. 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():
     396.

   - 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(): 1bbd.
     ‘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: ライブラリ<157>,  Next: ドキュメント<46>,  Prev: Core and Builtins<156>,  Up: Python 3 9 0 alpha 6

1.26.51.3 ライブラリ
....................

   - bpo-40398(1): *note typing.get_args(): 31d. now always returns an
     empty tuple for special generic aliases.

   - bpo-40396(2): Functions *note typing.get_origin(): 31c, *note
     typing.get_args(): 31d. and *note typing.get_type_hints(): aa3.
     support now generic aliases like ‘list[int]’.

   - bpo-38061(3): Optimize the *note subprocess: df. 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():
     1157. 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: 29f.  Patch by
     Weipeng Hong.

   - bpo-40275(9): The *note logging: 8a. package is now imported lazily
     in *note unittest: 10f. only when the *note assertLogs(): 2aa.
     assertion is used.

   - bpo-40275(10): The *note asyncio: b. package is now imported lazily
     in *note unittest: 10f. only when the *note
     IsolatedAsyncioTestCase: 34a. 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: 10d. 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(): 237. 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: bd. 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(): 1a56. function and
     *note random.Random.randbytes(): cfa. method to generate random
     bytes.

   - bpo-40277(20): *note collections.namedtuple(): 1da. 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(): 1964. 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: 211. 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: e1. 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: 2f0. class.

   - bpo-36517(32): Multiple inheritance with *note typing.NamedTuple:
     2f0. 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: c6. 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(): cee.
     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: 2eb. and
     *note threading.Condition: 1515. 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: 1518. to ‘_at_fork_reinit()’.

   - bpo-25780(39): Expose *note CAN_RAW_JOIN_FILTERS: d02. in the *note
     socket: d4. module.

   - bpo-39503(40): *note AbstractBasicAuthHandler: 1e85. of *note
     urllib.request: 114. 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: 19da, 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: 1f6a. 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: 1b64.

   - bpo-36144(49): Added PEP 584(50) operators to *note
     weakref.WeakKeyDictionary: 1b63.

   - bpo-38891(51): Fix linear runtime behaviour of the ‘__getitem__’
     and ‘__setitem__’ methods in *note
     multiprocessing.shared_memory.ShareableList: 1f6b.  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: fdf.

   - 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(): 1b55. failures in
     *note sys.set_asyncgen_hooks(): 1bc9.

   - 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(): 1a24. 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(): 94e.'s ‘s’ parameter.  Patch by Zackery Spytz.

   - bpo-31758(61): Prevent crashes when using an uninitialized
     ‘_elementtree.XMLParser’ object.  Patch by Oren Milman.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40398

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40396

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38061

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38061

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40360

   (6) https://peps.python.org/pep-0617/

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40138

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39942

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40275

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40275

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40330

   (12) https://bugs.python.org/issue?@action=redirect&bpo=40148

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40325

   (14) https://bugs.python.org/issue?@action=redirect&bpo=40257

   (15) https://bugs.python.org/issue?@action=redirect&bpo=40257

   (16) https://bugs.python.org/issue?@action=redirect&bpo=40287

   (17) https://bugs.python.org/issue?@action=redirect&bpo=40290

   (18) https://bugs.python.org/issue?@action=redirect&bpo=40282

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40286

   (20) https://bugs.python.org/issue?@action=redirect&bpo=40277

   (21) https://bugs.python.org/issue?@action=redirect&bpo=40270

   (22) https://bugs.python.org/issue?@action=redirect&bpo=29255

   (23) https://bugs.python.org/issue?@action=redirect&bpo=40260

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40234

   (25) https://bugs.python.org/issue?@action=redirect&bpo=39207

   (26) https://bugs.python.org/issue?@action=redirect&bpo=40091

   (27) https://bugs.python.org/issue?@action=redirect&bpo=40149

   (28) https://bugs.python.org/issue?@action=redirect&bpo=40208

   (29) https://bugs.python.org/issue?@action=redirect&bpo=40196

   (30) https://bugs.python.org/issue?@action=redirect&bpo=40190

   (31) https://bugs.python.org/issue?@action=redirect&bpo=40182

   (32) https://bugs.python.org/issue?@action=redirect&bpo=36517

   (33) https://bugs.python.org/issue?@action=redirect&bpo=40126

   (34) https://bugs.python.org/issue?@action=redirect&bpo=40094

   (35) https://bugs.python.org/issue?@action=redirect&bpo=40108

   (36) https://bugs.python.org/issue?@action=redirect&bpo=40094

   (37) https://bugs.python.org/issue?@action=redirect&bpo=40089

   (38) https://bugs.python.org/issue?@action=redirect&bpo=40089

   (39) https://bugs.python.org/issue?@action=redirect&bpo=25780

   (40) https://bugs.python.org/issue?@action=redirect&bpo=39503

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39812

   (42) https://bugs.python.org/issue?@action=redirect&bpo=40050

   (43) https://bugs.python.org/issue?@action=redirect&bpo=40014

   (44) https://bugs.python.org/issue?@action=redirect&bpo=40017

   (45) https://bugs.python.org/issue?@action=redirect&bpo=40016

   (46) https://bugs.python.org/issue?@action=redirect&bpo=39953

   (47) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (48) https://peps.python.org/pep-0584/

   (49) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (50) https://peps.python.org/pep-0584/

   (51) https://bugs.python.org/issue?@action=redirect&bpo=38891

   (52) https://bugs.python.org/issue?@action=redirect&bpo=39682

   (53) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (54) https://peps.python.org/pep-0584/

   (55) https://bugs.python.org/issue?@action=redirect&bpo=39011

   (56) https://bugs.python.org/issue?@action=redirect&bpo=38410

   (57) https://bugs.python.org/issue?@action=redirect&bpo=36541

   (58) https://bugs.python.org/issue?@action=redirect&bpo=35967

   (59) https://bugs.python.org/issue?@action=redirect&bpo=35113

   (60) https://bugs.python.org/issue?@action=redirect&bpo=33262

   (61) https://bugs.python.org/issue?@action=redirect&bpo=31758


File: python.info,  Node: ドキュメント<46>,  Next: テスト<50>,  Prev: ライブラリ<157>,  Up: Python 3 9 0 alpha 6

1.26.51.4 ドキュメント
......................

   - bpo-27635(1): The pickle documentation incorrectly claimed that
     ‘__new__’ isn't called by default when unpickling.

   - bpo-39879(2): Updated *note データモデル: 1f6d. docs to include
     *note dict(): 193. insertion order preservation.  Patch by Furkan
     Onder and Samy Lahfa.

   - bpo-38387(3): Document *note PyDoc_STRVAR: 1f6e. 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: テスト<50>,  Next: ビルド<53>,  Prev: ドキュメント<46>,  Up: Python 3 9 0 alpha 6

1.26.51.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(): 1f70.
     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: cce. and *note
     ftplib.FTP_TLS: ccf. 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: ビルド<53>,  Next: Windows<46>,  Prev: テスト<50>,  Up: Python 3 9 0 alpha 6

1.26.51.6 ビルド
................

   - bpo-38360(1): Support single-argument form of macOS -isysroot flag.

   - bpo-40158(2): Fix CPython MSBuild Properties in NuGet Package
     (build/native/python.props)

   - bpo-38527(3): Fix configure check on Solaris for "float word
     ordering": sometimes, the correct "grep" command was not being
     used.  Patch by Arnon Yaari.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38360

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40158

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38527


File: python.info,  Node: Windows<46>,  Next: macOS<37>,  Prev: ビルド<53>,  Up: Python 3 9 0 alpha 6

1.26.51.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<37>,  Next: IDLE<28>,  Prev: Windows<46>,  Up: Python 3 9 0 alpha 6

1.26.51.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<29>,  Prev: macOS<37>,  Up: Python 3 9 0 alpha 6

1.26.51.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<29>,  Next: C API<49>,  Prev: IDLE<28>,  Up: Python 3 9 0 alpha 6

1.26.51.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(): cee. to convert *note os.system():
     1815. 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<49>,  Prev: Tools/Demos<29>,  Up: Python 3 9 0 alpha 6

1.26.51.11 C API
................

   - bpo-40241(1): Move the ‘PyGC_Head’ structure to the internal C API.

   - bpo-40170(2): Convert *note PyObject_IS_GC(): d50. macro to a
     function to hide implementation details.

   - bpo-40241(3): Add the functions *note PyObject_GC_IsTracked(): d42.
     and *note PyObject_GC_IsFinalized(): d43. 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(): d51. macro, and the ‘PyObject_NEW_VAR()’
     macro becomes an alias to the *note PyObject_NewVar(): d52. macro,
     to hide implementation details.  They no longer access directly the
     *note PyTypeObject.tp_basicsize: d53. member.

   - bpo-40170(5): *note PyType_HasFeature(): 1f4f. now always calls
     *note PyType_GetFlags(): 1f50. to hide implementation details.
     Previously, it accessed directly the *note PyTypeObject.tp_flags:
     1e87. 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: d54. member.

   - bpo-40170(7): Convert *note PyObject_CheckBuffer(): 831. macro to a
     function to hide implementation details: the macro accessed
     directly the *note PyTypeObject.tp_as_buffer: d55. member.

   - bpo-40170(8): Always declare *note PyIndex_Check(): d56. as an
     opaque function to hide implementation details: remove
     ‘PyIndex_Check()’ macro.  The macro accessed directly the *note
     PyTypeObject.tp_as_number: d57. member.

   - bpo-39947(9): Add *note PyThreadState_GetID(): d3f. 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.26.52 Python 3.9.0 alpha 5
----------------------------

'リリース日: 2020-03-23'

* Menu:

* セキュリティ: セキュリティ<38>.
* Core and Builtins: Core and Builtins<157>.
* ライブラリ: ライブラリ<158>.
* ドキュメント: ドキュメント<47>.
* テスト: テスト<51>.
* ビルド: ビルド<54>.
* Windows: Windows<47>.
* macOS: macOS<38>.
* IDLE: IDLE<29>.
* Tools/Demos: Tools/Demos<30>.
* C API: C API<50>.


File: python.info,  Node: セキュリティ<38>,  Next: Core and Builtins<157>,  Up: Python 3 9 0 alpha 5

1.26.52.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<157>,  Next: ライブラリ<158>,  Prev: セキュリティ<38>,  Up: Python 3 9 0 alpha 5

1.26.52.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(): d4d.), 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(): d4d. 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(): 83f. 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(): 679.
     has been called.  Moreover, the daemon thread now exits before
     trying to take the GIL.

   - bpo-39871(28): Fix a possible *note SystemError: 3f1. in
     ‘math.{atan2,copysign,remainder}()’ when the first argument cannot
     be converted to a *note float: 32f.  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: b1d. 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(): 63e. and *note
     PyUnicode_AsUTF8AndSize(): c73. 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: 447. 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: ライブラリ<158>,  Next: ドキュメント<47>,  Prev: Core and Builtins<157>,  Up: Python 3 9 0 alpha 5

1.26.52.3 ライブラリ
....................

   - bpo-39830(1): Add *note zipfile.Path: abb. to ‘__all__’ in the
     *note zipfile: 13a. 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(): f6a. 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():
     80e. 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: 9da. 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: 1f7b. has call objects in
     the order of awaited arguments instead of using *note
     unittest.mock.Mock.call_args: 1f7c. which has the last value of the
     call.  Patch by Karthikeyan Singaravelan.

   - bpo-36144(15): Updated *note os.environ: 4ec. and *note
     os.environb: 4ed. 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(): 1f7d. method
     when a *note bool: 5f6. 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:
     1c4a. 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(): 1ec. 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(): cba. 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: 86. to catch *note
     BrokenPipeError: 1412.  Patch by Donghee Na.

   - bpo-13487(24): Avoid a possible '"RuntimeError: dictionary changed
     size during iteration"' from *note inspect.getmodule(): 1d89. when
     it tried to loop through *note sys.modules: 19da.

   - 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: df. 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: 157a. 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: 211. 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(): eec. 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: 194. objects now
     support the merge (‘|’) operator from PEP 584(39).

   - bpo-38691(40): The *note importlib: 7a. module now ignores the
     *note PYTHONCASEOK: d2a. environment variable when the *note -E:
     d2b. or *note -I: d2c. 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: 1f7e. 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: cd4.  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(): 1f7f. 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: 83.  Patch by Oleksandr Pavliuk.

   - bpo-34822(54): Simplified AST for subscription.  Simple indices are
     now represented by their value, extended slices are represented as
     tuples.  *note ast: 9. classes ‘Index’ and ‘ExtSlice’ are
     considered deprecated and will be removed in future Python
     versions.  In the meantime, ‘Index(value)’ now returns a ‘value’
     itself, ‘ExtSlice(slices)’ returns ‘Tuple(slices, Load())’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39830

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40000

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39999

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39991

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39988

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39656

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39969

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39360

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35370

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39936

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (12) https://peps.python.org/pep-0584/

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39652

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39915

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (16) https://peps.python.org/pep-0584/

   (17) https://bugs.python.org/issue?@action=redirect&bpo=38662

   (18) https://bugs.python.org/issue?@action=redirect&bpo=38075

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39916

   (20) https://bugs.python.org/issue?@action=redirect&bpo=39850

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36287

   (22) https://bugs.python.org/issue?@action=redirect&bpo=39889

   (23) https://bugs.python.org/issue?@action=redirect&bpo=39828

   (24) https://bugs.python.org/issue?@action=redirect&bpo=13487

   (25) https://bugs.python.org/issue?@action=redirect&bpo=39674

   (26) https://bugs.python.org/issue?@action=redirect&bpo=37330

   (27) https://bugs.python.org/issue?@action=redirect&bpo=28577

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39826

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39763

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39794

   (31) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (32) https://peps.python.org/pep-0584/

   (33) https://bugs.python.org/issue?@action=redirect&bpo=39517

   (34) https://bugs.python.org/issue?@action=redirect&bpo=39775

   (35) https://bugs.python.org/issue?@action=redirect&bpo=39678

   (36) https://bugs.python.org/issue?@action=redirect&bpo=39764

   (37) https://bugs.python.org/issue?@action=redirect&bpo=39769

   (38) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (39) https://peps.python.org/pep-0584/

   (40) https://bugs.python.org/issue?@action=redirect&bpo=38691

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39719

   (42) https://bugs.python.org/issue?@action=redirect&bpo=39667

   (43) https://bugs.python.org/issue?@action=redirect&bpo=39638

   (44) https://bugs.python.org/issue?@action=redirect&bpo=39639

   (45) https://bugs.python.org/issue?@action=redirect&bpo=39609

   (46) https://bugs.python.org/issue?@action=redirect&bpo=39548

   (47) https://bugs.python.org/issue?@action=redirect&bpo=39509

   (48) https://bugs.python.org/issue?@action=redirect&bpo=39507

   (49) https://bugs.python.org/issue?@action=redirect&bpo=39495

   (50) https://bugs.python.org/issue?@action=redirect&bpo=38971

   (51) https://bugs.python.org/issue?@action=redirect&bpo=38641

   (52) https://bugs.python.org/issue?@action=redirect&bpo=37534

   (53) https://bugs.python.org/issue?@action=redirect&bpo=34788

   (54) https://bugs.python.org/issue?@action=redirect&bpo=34822


File: python.info,  Node: ドキュメント<47>,  Next: テスト<51>,  Prev: ライブラリ<158>,  Up: Python 3 9 0 alpha 5

1.26.52.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: 103. 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: 3b.

   ---------- 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: テスト<51>,  Next: ビルド<54>,  Prev: ドキュメント<47>,  Up: Python 3 9 0 alpha 5

1.26.52.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: 19f. 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: ビルド<54>,  Next: Windows<47>,  Prev: テスト<51>,  Up: Python 3 9 0 alpha 5

1.26.52.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: df. 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: 2b4. attribute.  It is used to build
     the path of platform-specific extension modules and the path of the
     standard library.  It is equal to ‘"lib"’ on most platforms.  On
     Fedora and SuSE, it is equal to ‘"lib64"’ on 64-bit platforms.
     Patch by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor
     Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39761

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39763

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1294959


File: python.info,  Node: Windows<47>,  Next: macOS<38>,  Prev: ビルド<54>,  Up: Python 3 9 0 alpha 5

1.26.52.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: f6.)
     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<38>,  Next: IDLE<29>,  Prev: Windows<47>,  Up: Python 3 9 0 alpha 5

1.26.52.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<30>,  Prev: macOS<38>,  Up: Python 3 9 0 alpha 5

1.26.52.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<30>,  Next: C API<50>,  Prev: IDLE<29>,  Up: Python 3 9 0 alpha 5

1.26.52.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<50>,  Prev: Tools/Demos<30>,  Up: Python 3 9 0 alpha 5

1.26.52.11 C API
................

   - bpo-40024(1): Add *note PyModule_AddType(): d41. 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(): b72. 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(): d3e.: get
     the interpreter of a Python thread state.

   - bpo-39947(6): Add *note PyInterpreterState_Get(): 841. function to
     the limited C API.

   - bpo-35370(7): If *note PySys_Audit(): 80e. fails in *note
     PyEval_SetProfile(): 18b5. or *note PyEval_SetTrace(): 856, 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(): 1f88. and *note
     PyCFunction_NewEx(): 1f89. 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: f77. is now implemented with
     ‘__builtin_unreachable()’ and analogs in release mode.

   - bpo-38643(13): *note PyNumber_ToBase(): 1d8f. now raises a *note
     SystemError: 3f1. instead of crashing when called with invalid
     base.

   - bpo-39882(14): The *note Py_FatalError(): d4f. 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: d46, *note
     m_clear: d47. and *note m_free: d48. functions of *note
     PyModuleDef: d49. 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: d4a. function).  More precisely, these
     functions are not called if *note m_size: d4b. is greater than 0
     and the module state (as returned by *note PyModule_GetState():
     d4c.) 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(): 1f8a. and *note
     _PyInterpreterState_SetEvalFrameFunc(): 1f8b. C functions.  The
     *note _PyFrameEvalFunction: b5d. 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.26.53 Python 3.9.0 alpha 4
----------------------------

'Release date: 2020-02-25'

* Menu:

* セキュリティ: セキュリティ<39>.
* Core and Builtins: Core and Builtins<158>.
* ライブラリ: ライブラリ<159>.
* ドキュメント: ドキュメント<48>.
* テスト: テスト<52>.
* ビルド: ビルド<55>.
* Windows: Windows<48>.
* IDLE: IDLE<30>.
* C API: C API<51>.


File: python.info,  Node: セキュリティ<39>,  Next: Core and Builtins<158>,  Up: Python 3 9 0 alpha 4

1.26.53.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<158>,  Next: ライブラリ<159>,  Prev: セキュリティ<39>,  Up: Python 3 9 0 alpha 4

1.26.53.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(): 19db.
     Patch by Donghee Na.

   - bpo-39619(3): Enable use of *note os.chroot(): 1f8f. on HP-UX
     systems.

   - bpo-39573(4): Add *note Py_IS_TYPE(): 19db. 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(): 18b1. 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: d14. of float operation now
     has a better performance.  Also the message of *note
     ZeroDivisionError: d15. 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: 193. (and *note collections.UserDict:
     194e.) 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: ライブラリ<159>,  Next: ドキュメント<48>,  Prev: Core and Builtins<158>,  Up: Python 3 9 0 alpha 4

1.26.53.3 ライブラリ
....................

   - bpo-30566(1): Fix *note IndexError: 18ed. 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(): ce3. and *note math.lcm():
     ce4. 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: 19e9. in
     ‘io.BufferedReader.truncate()’ when it is called on a read-only
     *note io.BufferedReader: 15cb. instance.

   - bpo-39479(6): Add *note math.lcm(): ce4. 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: bd. and *note trace: 106. modules
     now use the *note sysconfig: e4. 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: 1ce. if
     the numerator and/or the denominator is an *note int: 32e.
     subclass.  The *note math.gcd(): ce3. 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(): 8be, *note
     os.fwalk(): f1c, *note pathlib.Path.glob(): 73f. and *note
     pathlib.Path.rglob(): 740.

   - bpo-39559(19): Remove unused, undocumented argument ‘getters’ from
     *note uuid.getnode(): f6a.

   - bpo-38149(20): *note sys.audit(): 1b55. is now called only once per
     call of *note glob.glob(): 2df. and *note glob.iglob(): be5.

   - bpo-39546(21): Fix a regression in *note ArgumentParser: 1e7. 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(): b20. function is no
     longer deprecated.

   - bpo-39493(25): Mark ‘typing.IO.closed’ as a property

   - bpo-39491(26): Add *note typing.Annotated: d0d. and
     ‘include_extras’ parameter to *note typing.get_type_hints(): aa3.
     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():
     1b6d. 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: e7. 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(): cc2. 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: 1243, it is used to calculate return
     values for the magic methods instead of using the default return
     values.  Patch by Karthikeyan Singaravelan.

   - bpo-36350(37): ‘inspect.Signature.parameters’ and
     ‘inspect.BoundArguments.arguments’ are now dicts instead of
     OrderedDicts.  Patch contributed by Rémi Lapeyre.

   - bpo-35727(38): Fix sys.exit() and sys.exit(None) exit code
     propagation when used in multiprocessing.Process.

   - bpo-32173(39): * Add ‘lazycache’ function to ‘__all__’.  * Use
     ‘dict.clear’ to clear the cache.  * Refactoring ‘getline’ function
     and ‘checkcache’ function.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30566

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39649

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39648

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39681

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35950

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39479

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39674

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25988

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39104

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39627

   (11) https://bugs.python.org/issue?@action=redirect&bpo=39474

   (12) https://bugs.python.org/issue?@action=redirect&bpo=21016

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39590

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39586

   (15) https://bugs.python.org/issue?@action=redirect&bpo=39595

   (16) 
https://importlib-metadata.readthedocs.io/en/latest/history.html#v1-5-0

   (17) https://bugs.python.org/issue?@action=redirect&bpo=39350

   (18) https://bugs.python.org/issue?@action=redirect&bpo=39567

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39559

   (20) https://bugs.python.org/issue?@action=redirect&bpo=38149

   (21) https://bugs.python.org/issue?@action=redirect&bpo=39546

   (22) https://bugs.python.org/issue?@action=redirect&bpo=39450

   (23) https://bugs.python.org/issue?@action=redirect&bpo=12915

   (24) https://bugs.python.org/issue?@action=redirect&bpo=39353

   (25) https://bugs.python.org/issue?@action=redirect&bpo=39493

   (26) https://bugs.python.org/issue?@action=redirect&bpo=39491

   (27) https://peps.python.org/pep-0593/

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39485

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38932

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39082

   (31) https://bugs.python.org/issue?@action=redirect&bpo=39432

   (32) https://bugs.python.org/issue?@action=redirect&bpo=18819

   (33) https://bugs.python.org/issue?@action=redirect&bpo=39349

   (34) https://bugs.python.org/issue?@action=redirect&bpo=39274

   (35) https://bugs.python.org/issue?@action=redirect&bpo=34793

   (36) https://bugs.python.org/issue?@action=redirect&bpo=25597

   (37) https://bugs.python.org/issue?@action=redirect&bpo=36350

   (38) https://bugs.python.org/issue?@action=redirect&bpo=35727

   (39) https://bugs.python.org/issue?@action=redirect&bpo=32173


File: python.info,  Node: ドキュメント<48>,  Next: テスト<52>,  Prev: ライブラリ<159>,  Up: Python 3 9 0 alpha 4

1.26.53.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: テスト<52>,  Next: ビルド<55>,  Prev: ドキュメント<48>,  Up: Python 3 9 0 alpha 4

1.26.53.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(): 18b1. fails with *note OverflowError: c5b.  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: ビルド<55>,  Next: Windows<48>,  Prev: テスト<52>,  Up: Python 3 9 0 alpha 4

1.26.53.6 ビルド
................

   - bpo-39489(1): Remove ‘COUNT_ALLOCS’ special build.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39489


File: python.info,  Node: Windows<48>,  Next: IDLE<30>,  Prev: ビルド<55>,  Up: Python 3 9 0 alpha 4

1.26.53.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(): 11f7. and *note expanduser(): 11f6. 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(): ddc, 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<51>,  Prev: Windows<48>,  Up: Python 3 9 0 alpha 4

1.26.53.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: d9a. 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<51>,  Prev: IDLE<30>,  Up: Python 3 9 0 alpha 4

1.26.53.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: 91. and *note cmath: 19. modules must now
     be compiled with the ‘Py_BUILD_CORE’ macro defined.

   - bpo-39573(3): Add *note Py_SET_SIZE(): b67. function to set the
     size of an object.

   - bpo-39500(4): *note PyUnicode_IsIdentifier(): 1f97. does not call
     *note Py_FatalError(): d4f. anymore if the string is not ready.

   - bpo-39573(5): Add *note Py_SET_TYPE(): b65. function to set the
     type of an object.

   - bpo-39573(6): Add a *note Py_SET_REFCNT(): c82. function to set the
     reference counter of an object.

   - bpo-39542(7): Convert *note PyType_HasFeature(): 1f4f, *note
     PyType_Check(): 1f98. and *note PyType_CheckExact(): 1f99. 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(): e33. and *note PyObject_InitVar(): 1f53. 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(): 1bbd. function now
     calls the ‘PyThreadState.on_delete’ callback.  Previously, that
     happened in *note PyThreadState_Delete(): 1f9a.

   - 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.26.54 Python 3.9.0 alpha 3
----------------------------

'Release date: 2020-01-24'

* Menu:

* Core and Builtins: Core and Builtins<159>.
* ライブラリ: ライブラリ<160>.
* ドキュメント: ドキュメント<49>.
* ビルド: ビルド<56>.
* IDLE: IDLE<31>.
* C API: C API<52>.


File: python.info,  Node: Core and Builtins<159>,  Next: ライブラリ<160>,  Up: Python 3 9 0 alpha 3

1.26.54.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: 6c. module and custom comparison
     operators.

   - bpo-39386(3): Prevent double awaiting of async iterator.

   - bpo-17005(4): Add ‘functools.TopologicalSorter’ to the *note
     functools: 62. 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(): cd1. 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(): 12bc. or *note max(): 12bd. with no arguments.  Patch by
     Donghee Na.

   - bpo-39200(16): Correct the error message when trying to construct
     *note range: d13. 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(): 1f9d.

   - 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: 1f9e. command-line
     option or setting the *note PYTHONUNBUFFERED: 1f9f. 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(): 1f9d.

   - 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: ライブラリ<160>,  Next: ドキュメント<49>,  Prev: Core and Builtins<159>,  Up: Python 3 9 0 alpha 3

1.26.54.2 ライブラリ
....................

   - bpo-39430(1): Fixed race condition in lazy imports in *note
     tarfile: e7.

   - bpo-39413(2): The *note os.unsetenv(): 4ef. function is now also
     available on Windows.

   - bpo-39390(3): Fixed a regression with the ‘ignore’ callback of
     *note shutil.copytree(): df1.  The argument types are now ‘str’ and
     ‘List[str]’ again.

   - bpo-39395(4): The *note os.putenv(): 4ee. and *note os.unsetenv():
     4ef. functions are now always available.

   - bpo-39406(5): If ‘setenv()’ C function is available, *note
     os.putenv(): 4ee. 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(): 1df3. to be used
     with file and file-like objects, like *note zipfile.is_zipfile():
     16e4.  Patch by William Woodruff.

   - bpo-39377(8): Removed ‘encoding’ option from *note json.loads():
     23a.  It has been deprecated since Python 3.1.

   - bpo-39389(9): Write accurate compression level metadata in *note
     gzip: 6a. 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: c41.  Since Python 3.0, it was ignored and using it
     was emitting *note DeprecationWarning: 2d4.  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(): b20.

   - bpo-39351(13): Remove ‘base64.encodestring()’ and
     ‘base64.decodestring()’, aliases deprecated since Python 3.1: use
     *note base64.encodebytes(): d22. and *note base64.decodebytes():
     d23. instead.

   - bpo-39350(14): Remove ‘fractions.gcd()’ function, deprecated since
     Python 3.5 (bpo-22486(15)): use *note math.gcd(): ce3. instead.

   - bpo-39329(16): *note LMTP: d00. 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: ccf. and ‘FTP_TLS’ now raise a *note
     ValueError: 15a. 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: cfe. and *note SMTP_SSL: cff. now raise
     a *note ValueError: 15a. 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(): ce5.: 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:
     15a. 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(): 8ae.: return the next
     floating-point value after 'x' towards 'y'.

   - bpo-39259(25): *note POP3: cf4. and *note POP3_SSL: cf5. now raise
     a *note ValueError: 15a. 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: 75. module is
     imported.

   - bpo-39239(28): The *note select.epoll.unregister(): d28. method no
     longer ignores the *note EBADF: d29. 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(): 1f7. 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: a87.

   - 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: 1013.
     to return a correct result upon inheritance.  Patch by Bar Harel.

   - bpo-38615(45): *note IMAP4: 322. and *note IMAP4_SSL: cd7. now have
     an optional 'timeout' parameter for their constructors.  Also, the
     *note open(): cd8. method now has an optional 'timeout' parameter
     with this change.  The overridden methods of ‘IMAP4_SSL’ and *note
     IMAP4_stream: cd9. 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(): 1797.
     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: e56. 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(): 950. was called without
     arguments.

   - bpo-38293(51): Add *note copy.copy(): 947. and *note
     copy.deepcopy(): f2f. support to *note property(): 6c1. objects.

   - bpo-37958(52): Added the pstats.Stats.get_profile_dict() method to
     return the profile data as a StatsProfile instance.

   - bpo-28367(53): Termios magic constants for the following baud
     rates: - B500000 - B576000 - B921600 - B1000000 - B1152000 -
     B1500000 - B2000000 - B2500000 - B3000000 - B3500000 - B4000000
     Patch by Andrey Smirnov

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39430

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39413

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39390

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39395

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39406

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39396

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29435

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39377

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39389

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39366

   (11) https://bugs.python.org/issue?@action=redirect&bpo=39357

   (12) https://bugs.python.org/issue?@action=redirect&bpo=39353

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39351

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39350

   (15) https://bugs.python.org/issue?@action=redirect&bpo=22486

   (16) https://bugs.python.org/issue?@action=redirect&bpo=39329

   (17) https://bugs.python.org/issue?@action=redirect&bpo=39313

   (18) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (20) https://bugs.python.org/issue?@action=redirect&bpo=39310

   (21) https://bugs.python.org/issue?@action=redirect&bpo=39297

   (22) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (23) https://bugs.python.org/issue?@action=redirect&bpo=38901

   (24) https://bugs.python.org/issue?@action=redirect&bpo=39288

   (25) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (26) https://bugs.python.org/issue?@action=redirect&bpo=39242

   (27) https://bugs.python.org/issue?@action=redirect&bpo=35292

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39239

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38907

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39152

   (31) https://bugs.python.org/issue?@action=redirect&bpo=39198

   (32) https://bugs.python.org/issue?@action=redirect&bpo=39191

   (33) https://bugs.python.org/issue?@action=redirect&bpo=38871

   (34) https://bugs.python.org/issue?@action=redirect&bpo=39142

   (35) https://bugs.python.org/issue?@action=redirect&bpo=39158

   (36) https://bugs.python.org/issue?@action=redirect&bpo=39129

   (37) https://bugs.python.org/issue?@action=redirect&bpo=39057

   (38) https://bugs.python.org/issue?@action=redirect&bpo=39056

   (39) https://bugs.python.org/issue?@action=redirect&bpo=39055

   (40) https://bugs.python.org/issue?@action=redirect&bpo=21600

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39019

   (42) https://bugs.python.org/issue?@action=redirect&bpo=39019

   (43) https://bugs.python.org/issue?@action=redirect&bpo=38914

   (44) https://bugs.python.org/issue?@action=redirect&bpo=38878

   (45) https://bugs.python.org/issue?@action=redirect&bpo=38615

   (46) https://bugs.python.org/issue?@action=redirect&bpo=35182

   (47) https://bugs.python.org/issue?@action=redirect&bpo=38630

   (48) https://bugs.python.org/issue?@action=redirect&bpo=38536

   (49) https://bugs.python.org/issue?@action=redirect&bpo=38473

   (50) https://bugs.python.org/issue?@action=redirect&bpo=38361

   (51) https://bugs.python.org/issue?@action=redirect&bpo=38293

   (52) https://bugs.python.org/issue?@action=redirect&bpo=37958

   (53) https://bugs.python.org/issue?@action=redirect&bpo=28367


File: python.info,  Node: ドキュメント<49>,  Next: ビルド<56>,  Prev: ライブラリ<160>,  Up: Python 3 9 0 alpha 3

1.26.54.3 ドキュメント
......................

   - bpo-39381(1): Mention in docs that *note asyncio.get_event_loop():
     573. 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: 81. docs' *note
     型とメンバー: 1fa2. 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: ビルド<56>,  Next: IDLE<31>,  Prev: ドキュメント<49>,  Up: Python 3 9 0 alpha 3

1.26.54.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<52>,  Prev: ビルド<56>,  Up: Python 3 9 0 alpha 3

1.26.54.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<52>,  Prev: IDLE<31>,  Up: Python 3 9 0 alpha 3

1.26.54.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.26.55 Python 3.9.0 alpha 2
----------------------------

'Release date: 2019-12-18'

* Menu:

* セキュリティ: セキュリティ<40>.
* Core and Builtins: Core and Builtins<160>.
* ライブラリ: ライブラリ<161>.
* ドキュメント: ドキュメント<50>.
* テスト: テスト<53>.
* ビルド: ビルド<57>.
* Windows: Windows<49>.
* macOS: macOS<39>.
* IDLE: IDLE<32>.
* C API: C API<53>.


File: python.info,  Node: セキュリティ<40>,  Next: Core and Builtins<160>,  Up: Python 3 9 0 alpha 2

1.26.55.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(): b1f. 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:
     73.  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<160>,  Next: ライブラリ<161>,  Prev: セキュリティ<40>,  Up: Python 3 9 0 alpha 2

1.26.55.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(): 80e. 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(): be9.
     and *note sys.unraisablehook(): 712. 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:
     4e0. and *note set: 432. displays.  Patch by Brandt Bucher.

   - bpo-38707(15): ‘MainThread.native_id’ is now correctly reset in
     child processes spawned using *note multiprocessing.Process: 4e5,
     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: ライブラリ<161>,  Next: ドキュメント<50>,  Prev: Core and Builtins<160>,  Up: Python 3 9 0 alpha 2

1.26.55.3 ライブラリ
....................

   - bpo-39033(1): Fix *note NameError: 66c. in *note zipimport: 13b.
     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: 6cb.: 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: 140e.: 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: c2. 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:
     75, 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(): aa3. properly handles
     functions decorated with *note functools.wraps(): 130c.

   - bpo-38870(24): Expose *note ast.unparse(): cba. as a function of
     the *note ast: 9. module that can be used to unparse an *note
     ast.AST: 2f8. 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: 29b. 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(): 1366. 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(): 14b0. is missing.  Patch by Toke
     Høiland-Jørgensen.

   - bpo-38686(31): Added support for multiple ‘qop’ values in *note
     urllib.request.AbstractDigestAuthHandler: 1f7e.

   - bpo-38712(32): Add the Linux-specific *note
     signal.pidfd_send_signal(): cfc. 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: 59.  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: 3d.
     Patch by Karthikeyan Singaravelan.

   - bpo-34776(38): Fix dataclasses to support forward references in
     type annotations

   - bpo-20928(39): ElementTree supports recursive XInclude processing.
     Patch by Stefan Behnel.

   - bpo-29636(40): Add whitespace options for formatting JSON with the
     ‘json.tool’ CLI. The following mutually exclusive options are now
     supported: ‘--indent’ for setting the indent level in spaces;
     ‘--tab’ for indenting with tabs; ‘--no-indent’ for suppressing
     newlines; and ‘--compact’ for suppressing all whitespace.  The
     default behavior remains the same as ‘--indent=4’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39033

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39022

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39006

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38708

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38698

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38994

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38979

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38978

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38916

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38986

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38982

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38529

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27413

   (14) https://bugs.python.org/issue?@action=redirect&bpo=38634

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33684

   (16) https://bugs.python.org/issue?@action=redirect&bpo=38698

   (17) https://bugs.python.org/issue?@action=redirect&bpo=38927

   (18) https://bugs.python.org/issue?@action=redirect&bpo=26730

   (19) https://bugs.python.org/issue?@action=redirect&bpo=38881

   (20) https://bugs.python.org/issue?@action=redirect&bpo=38876

   (21) https://bugs.python.org/issue?@action=redirect&bpo=38688

   (22) https://bugs.python.org/issue?@action=redirect&bpo=38863

   (23) https://bugs.python.org/issue?@action=redirect&bpo=37838

   (24) https://bugs.python.org/issue?@action=redirect&bpo=38870

   (25) https://bugs.python.org/issue?@action=redirect&bpo=38859

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38857

   (27) https://bugs.python.org/issue?@action=redirect&bpo=38834

   (28) https://bugs.python.org/issue?@action=redirect&bpo=38821

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38820

   (30) https://bugs.python.org/issue?@action=redirect&bpo=38811

   (31) https://bugs.python.org/issue?@action=redirect&bpo=38686

   (32) https://bugs.python.org/issue?@action=redirect&bpo=38712

   (33) https://bugs.python.org/issue?@action=redirect&bpo=38348

   (34) https://bugs.python.org/issue?@action=redirect&bpo=37523

   (35) https://bugs.python.org/issue?@action=redirect&bpo=38045

   (36) https://bugs.python.org/issue?@action=redirect&bpo=36820

   (37) https://bugs.python.org/issue?@action=redirect&bpo=36406

   (38) https://bugs.python.org/issue?@action=redirect&bpo=34776

   (39) https://bugs.python.org/issue?@action=redirect&bpo=20928

   (40) https://bugs.python.org/issue?@action=redirect&bpo=29636


File: python.info,  Node: ドキュメント<50>,  Next: テスト<53>,  Prev: ライブラリ<161>,  Up: Python 3 9 0 alpha 2

1.26.55.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(): 2dd. 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: テスト<53>,  Next: ビルド<57>,  Prev: ドキュメント<50>,  Up: Python 3 9 0 alpha 2

1.26.55.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: ed. constants: *note LOOPBACK_TIMEOUT: 1fac,
     *note INTERNET_TIMEOUT: 1fad, *note SHORT_TIMEOUT: 1e79. and *note
     LONG_TIMEOUT: 1fae.  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(): 178d. that was
     failing due to constant folding.

   - bpo-38991(6): *note test.support: ed.: ‘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: 10fd.  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: 29c. when passing target as a
     string with *note unittest.mock.patch.object(): 1b44.

   - 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: ビルド<57>,  Next: Windows<49>,  Prev: テスト<53>,  Up: Python 3 9 0 alpha 2

1.26.55.6 ビルド
................

   - bpo-37404(1): *note asyncio: b. now raises *note TypeError: 29c.
     when calling incompatible methods with an *note ssl.SSLSocket: cbf.
     socket.  Patch by Ido Michael.

   - bpo-36500(2): Added an optional "regen" project to the Visual
     Studio solution that will regenerate all grammar, tokens, and
     opcodes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37404

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36500


File: python.info,  Node: Windows<49>,  Next: macOS<39>,  Prev: ビルド<57>,  Up: Python 3 9 0 alpha 2

1.26.55.7 Windows
.................

   - bpo-39007(1): Add auditing events to functions in *note winreg:
     11f.

   - 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<39>,  Next: IDLE<32>,  Prev: Windows<49>,  Up: Python 3 9 0 alpha 2

1.26.55.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<53>,  Prev: macOS<39>,  Up: Python 3 9 0 alpha 2

1.26.55.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<53>,  Prev: IDLE<32>,  Up: Python 3 9 0 alpha 2

1.26.55.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.26.56 Python 3.9.0 alpha 1
----------------------------

'Release date: 2019-11-19'

* Menu:

* セキュリティ: セキュリティ<41>.
* Core and Builtins: Core and Builtins<161>.
* ライブラリ: ライブラリ<162>.
* ドキュメント: ドキュメント<51>.
* テスト: テスト<54>.
* ビルド: ビルド<58>.
* Windows: Windows<50>.
* macOS: macOS<40>.
* IDLE: IDLE<33>.
* Tools/Demos: Tools/Demos<31>.
* C API: C API<54>.


File: python.info,  Node: セキュリティ<41>,  Next: Core and Builtins<161>,  Up: Python 3 9 0 alpha 1

1.26.56.1 セキュリティ
......................

   - bpo-38722(1): *note runpy: c6. now uses *note io.open_code(): 1964.
     to open code files.  Patch by Jason Killen.

   - bpo-38622(2): Add additional audit events for the *note ctypes: 2d.
     module.

   - bpo-38418(3): Fixes audit event for *note os.system(): 1815. to be
     named ‘os.system’.

   - bpo-38243(4): Escape the server title of *note
     xmlrpc.server.DocXMLRPCServer: 1fb6. 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 コマンドラインと環境: 1fb7.).

   - 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: 58, *note
     ftplib: 61, *note glob: 67, *note imaplib: 77, ‘nntplib’, *note
     pdb: aa, *note poplib: b1, *note shutil: cd, *note smtplib: d2,
     *note sqlite3: d7, *note subprocess: df, ‘telnetlib’, *note
     tempfile: e9. and *note webbrowser: 11e, as well as *note
     os.listdir(): 14bb, *note os.scandir(): e27. and *note
     breakpoint(): 500.

   - bpo-37364(13): *note io.open_code(): 1964. 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<161>,  Next: ライブラリ<162>,  Prev: セキュリティ<41>,  Up: Python 3 9 0 alpha 1

1.26.56.2 Core and Builtins
...........................

   - bpo-38631(1): Replace ‘Py_FatalError()’ call with a regular *note
     RuntimeError: 317. exception in ‘float.__getformat__()’.

   - bpo-38639(2): Optimized *note math.floor(): 1776, *note
     math.ceil(): 1777. and *note math.trunc(): 1778. 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: 1d2. and *note bytearray: 1d1. 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: 1d1, *note array: 6cb. and *note
     mmap: 247. 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(): 18bc. 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: 193. constructor and the
     *note update(): 181d. 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(): 314. 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(): e0f.
     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(): d31. to normalize the
     encoding name the same way than *note
     encodings.normalize_encoding(): 31b, except that ‘codecs.lookup()’
     also converts the name to lower case.

   - bpo-37830(45): Fixed compilation of *note break: 42f. and *note
     continue: 430. in the *note finally: 453. block when the
     corresponding *note try: adb. block contains *note return: 452.
     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:
     1f09. of *note bytearray: 1d1.  Patch by Sergey Fedoseev.

   - bpo-37802(48): Slightly improve performance of *note
     PyLong_FromUnsignedLong(): 1afd, *note
     PyLong_FromUnsignedLongLong(): 1afe. and *note PyLong_FromSize_t():
     1aff.  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: 451. instead of *note DeprecationWarning: 2d4. 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: 189. 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(): 1153.

   - 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: d35. statement now works properly
     if the *note AssertionError: a9c. 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__(): 1424.

   - 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(): be9. 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(): 19ac. 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(): d19. and *note
     sys.setswitchinterval(): d1a. 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(): 333, *note
     str.encode(): cab. and *note bytes.decode(): cac.

     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(): 333, *note io.open(): 930, *note
     codecs.open(): 334. and *note fileinput.FileInput: b23. 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(): 80e. call in *note
     mmap.mmap: 247.

   - 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(): b41.
     function (previously documented but not implemented): call *note
     struct.calcsize(): 1fb9.  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(): e05. now also
     supports NetBSD.

   - bpo-37077(87): Add *note threading.get_native_id(): e05. support
     for AIX. Patch by M. Felt

   - bpo-36781(88): *note sum(): 886. 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: 6a0. 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: ライブラリ<162>,  Next: ドキュメント<51>,  Prev: Core and Builtins<161>,  Up: Python 3 9 0 alpha 1

1.26.56.3 ライブラリ
....................

   - bpo-36589(1): The *note curses.update_lines_cols(): 11a7. function
     now returns ‘None’ instead of ‘1’ on success.

   - bpo-38807(2): Update *note TypeError: 29c. messages for *note
     os.path.join(): 1a62. to include *note os.PathLike: 1013. 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(): 1964.
     to trigger auditing events.

   - bpo-27805(7): Allow opening pipes and other non-seekable files in
     append mode with *note open(): 333.

   - 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: ced. constant, which may be
     passed to *note os.waitid(): 1156. 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(): 273.

   - bpo-38602(14): Added constants ‘F_OFD_GETLK’, ‘F_OFD_SETLK’ and
     ‘F_OFD_SETLKW’ to the *note fcntl: 5c. module.  Patch by Donghee
     Na.

   - bpo-38334(15): Fixed seeking backward on an encrypted
     ‘zipfile.ZipExtFile’.

   - bpo-38312(16): Add *note curses.get_escdelay(): cc4, *note
     curses.set_escdelay(): cc5, *note curses.get_tabsize(): cc6, and
     *note curses.set_tabsize(): cc7. functions - by Anthony Sottile.

   - bpo-38586(17): Now *note fileConfig(): f12. 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: ceb. and *note CLD_STOPPED:
     cec. 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():
     ed7. 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(): 721. due to improper handling of
     filenames as urls.

   - bpo-38431(29): Fix ‘__repr__’ method for *note dataclasses.InitVar:
     1dcd. to support typing objects, patch by Samuel Colvin.

   - bpo-38109(30): Add missing *note stat.S_IFDOOR: 1369, *note
     stat.S_IFPORT: 136a, *note stat.S_IFWHT: 136b, *note
     stat.S_ISDOOR(): 1fbb, *note stat.S_ISPORT(): 1fbc, and *note
     stat.S_ISWHT(): 1fbd. values to the Python implementation of *note
     stat: d9.

   - bpo-38422(31): Clarify docstrings of pathlib suffix(es)

   - bpo-38405(32): Nested subclasses of *note typing.NamedTuple: 2f0.
     are now pickleable.

   - bpo-38332(33): Prevent *note KeyError: 7e5. 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: 1fbe. to
     the *note smtplib: d2. 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: 84f. 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():
     f20. to accept *note Py_ssize_t: e28. 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: 2f0. and *note
     TypedDict: 29b. types now accept arbitrary keyword argument names,
     including "cls", "self", "typename", "_typename", "fields" and
     "_fields".

   - bpo-38155(52): Add ‘__all__’ to *note datetime: 33.  Patch by Tahia
     Khan.

   - bpo-38185(53): Fixed case-insensitive string comparison in *note
     sqlite3.Row: 1225. 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(): 10b8. exceptions.  Patch by
     Abraham Toriz Cruz.

   - bpo-38175(56): Fix a memory leak in comparison of *note
     sqlite3.Row: 1225. 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(): 314. 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: 7a5. as
     ‘directory’ argument to the *note
     http.server.SimpleHTTPRequestHandler: 235. 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: ce.
     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: 10d, improved the ‘__hash__’ and
     ‘__eq__’ methods for ‘ForwardReferences’.

   - bpo-38026(83): Fixed *note inspect.getattr_static(): 8aa. used
     ‘isinstance’ while it should avoid dynamic lookup.

   - bpo-35923(84): Update *note importlib.machinery.BuiltinImporter:
     1074. 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(): 1ec.
     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: 5c.

   - 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(): 1ec. 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(): e36. 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: 5b. 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(): 1934. 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: 3a. ‘?’ 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: 1258. 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(): f75. now
     ensures any module it returns is fully initialized.  Patch by
     Joannah Nanjekye.

   - bpo-32178(131): Fix IndexError in *note email: 3e. 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: d4.

   - bpo-37685(134): Fixed comparisons of *note datetime.timedelta: d98.
     and *note datetime.timezone: 147f.

   - 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(): 1454. 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():
     1fbf. 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: 447. for
     unsupported type of the other operand.  This allows the other
     operand to play role (for example the equality comparison with
     *note ANY: 1fc0. 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: 147f. 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: 59. 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: 447. in Python
     implementation of ‘__eq__’ for *note timedelta: d98. and *note
     time: 495. 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: 1fc1. 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(): 14cf. now correctly
     handles errors that arise during iteration over its ‘mask’
     argument.  Patch by Brandt Bucher.

   - bpo-37412(171): The *note os.getcwdb(): e55. 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: be.
     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: 6f0.  Patch by Carl Bordum Hansen.

   - bpo-26967(178): An *note ArgumentParser: 1e7. 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(): 1fc2. 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(): 3e9,
     *note sqlite3.Connection.create_function(): 3e8, *note
     sqlite3.Connection.set_authorizer(): 3ea, *note
     sqlite3.Connection.set_progress_handler(): 3eb. *note
     sqlite3.Connection.set_trace_callback(): 3ec. 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():
     1c8f. 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(): d17.

   - 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(): 1fc3. 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: 8d.: 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: 1b4. 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: 317. raised by *note
     asyncio.all_tasks(): d24. 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(): f49. 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:
     9db. in *note asyncio.Lock: e39.

   - 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(): d04. 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: 1fc4. now
     lowercases the keys of the passed dictionary.

   - bpo-26185(221): Fix *note repr(): 462. 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: 1fc5. 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(): 208. 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(): cf0.  Patch by Girts
     Folkmanis.

   - bpo-32498(248): Made *note urllib.parse.unquote(): 1d19. 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(): e24. function to allow
     for Path objects to be used as source argument.  Patch by Emily
     Morehouse and Maxwell "5.13b" McKinnon.

   - bpo-32820(251): Added ‘__format__’ to IPv4 and IPv6 classes.
     Always outputs a fully zero-padded string.  Supports b/x/n
     modifiers (bin/hex/native format).  Native format for IPv4 is bin,
     native format for IPv6 is hex.  Also supports '#' and '_'
     modifiers.

   - bpo-27657(252): Fix urllib.parse.urlparse() with numeric paths.  A
     string like "path:80" is no longer parsed as a path but as a scheme
     ("path") and a path ("80").

   - bpo-4963(253): Fixed non-deterministic behavior related to
     mimetypes extension mapping and module reinitialization.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36589

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38807

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38724

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38786

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38785

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38723

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27805

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38438

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38761

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38716

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38713

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38692

   (13) https://bugs.python.org/issue?@action=redirect&bpo=38692

   (14) https://bugs.python.org/issue?@action=redirect&bpo=38602

   (15) https://bugs.python.org/issue?@action=redirect&bpo=38334

   (16) https://bugs.python.org/issue?@action=redirect&bpo=38312

   (17) https://bugs.python.org/issue?@action=redirect&bpo=38586

   (18) https://bugs.python.org/issue?@action=redirect&bpo=38565

   (19) https://bugs.python.org/issue?@action=redirect&bpo=34679

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31202

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36321

   (22) https://bugs.python.org/issue?@action=redirect&bpo=38521

   (23) https://bugs.python.org/issue?@action=redirect&bpo=38493

   (24) https://bugs.python.org/issue?@action=redirect&bpo=38478

   (25) https://bugs.python.org/issue?@action=redirect&bpo=33604

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38378

   (27) https://bugs.python.org/issue?@action=redirect&bpo=38417

   (28) https://bugs.python.org/issue?@action=redirect&bpo=38449

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38431

   (30) https://bugs.python.org/issue?@action=redirect&bpo=38109

   (31) https://bugs.python.org/issue?@action=redirect&bpo=38422

   (32) https://bugs.python.org/issue?@action=redirect&bpo=38405

   (33) https://bugs.python.org/issue?@action=redirect&bpo=38332

   (34) https://bugs.python.org/issue?@action=redirect&bpo=38371

   (35) https://bugs.python.org/issue?@action=redirect&bpo=38341

   (36) https://bugs.python.org/issue?@action=redirect&bpo=38319

   (37) https://bugs.python.org/issue?@action=redirect&bpo=38242

   (38) https://bugs.python.org/issue?@action=redirect&bpo=13153

   (39) https://bugs.python.org/issue?@action=redirect&bpo=38019

   (40) https://bugs.python.org/issue?@action=redirect&bpo=38163

   (41) https://bugs.python.org/issue?@action=redirect&bpo=38161

   (42) https://bugs.python.org/issue?@action=redirect&bpo=38216

   (43) https://bugs.python.org/issue?@action=redirect&bpo=30458

   (44) https://bugs.python.org/issue?@action=redirect&bpo=28286

   (45) https://bugs.python.org/issue?@action=redirect&bpo=38108

   (46) https://bugs.python.org/issue?@action=redirect&bpo=38265

   (47) https://bugs.python.org/issue?@action=redirect&bpo=38112

   (48) https://bugs.python.org/issue?@action=redirect&bpo=38248

   (49) https://bugs.python.org/issue?@action=redirect&bpo=38237

   (50) https://bugs.python.org/issue?@action=redirect&bpo=34002

   (51) https://bugs.python.org/issue?@action=redirect&bpo=38191

   (52) https://bugs.python.org/issue?@action=redirect&bpo=38155

   (53) https://bugs.python.org/issue?@action=redirect&bpo=38185

   (54) https://bugs.python.org/issue?@action=redirect&bpo=38136

   (55) https://bugs.python.org/issue?@action=redirect&bpo=37828

   (56) https://bugs.python.org/issue?@action=redirect&bpo=38175

   (57) https://bugs.python.org/issue?@action=redirect&bpo=33936

   (58) https://bugs.python.org/issue?@action=redirect&bpo=34706

   (59) https://bugs.python.org/issue?@action=redirect&bpo=38153

   (60) https://bugs.python.org/issue?@action=redirect&bpo=38115

   (61) https://bugs.python.org/issue?@action=redirect&bpo=38148

   (62) https://bugs.python.org/issue?@action=redirect&bpo=38142

   (63) https://bugs.python.org/issue?@action=redirect&bpo=9216

   (64) https://bugs.python.org/issue?@action=redirect&bpo=36991

   (65) https://bugs.python.org/issue?@action=redirect&bpo=38134

   (66) https://bugs.python.org/issue?@action=redirect&bpo=38132

   (67) https://bugs.python.org/issue?@action=redirect&bpo=38008

   (68) https://bugs.python.org/issue?@action=redirect&bpo=34037

   (69) https://bugs.python.org/issue?@action=redirect&bpo=37405

   (70) https://bugs.python.org/issue?@action=redirect&bpo=38121

   (71) https://bugs.python.org/issue?@action=redirect&bpo=38110

   (72) https://bugs.python.org/issue?@action=redirect&bpo=38093

   (73) https://bugs.python.org/issue?@action=redirect&bpo=37488

   (74) https://bugs.python.org/issue?@action=redirect&bpo=35640

   (75) https://bugs.python.org/issue?@action=redirect&bpo=38086

   (76) 
https://gitlab.com/python-devs/importlib_metadata/blob/0.21/importlib_metadata/docs/changelog.rst

   (77) https://bugs.python.org/issue?@action=redirect&bpo=37251

   (78) https://bugs.python.org/issue?@action=redirect&bpo=38037

   (79) https://bugs.python.org/issue?@action=redirect&bpo=38066

   (80) https://bugs.python.org/issue?@action=redirect&bpo=38059

   (81) https://bugs.python.org/issue?@action=redirect&bpo=38049

   (82) https://bugs.python.org/issue?@action=redirect&bpo=37953

   (83) https://bugs.python.org/issue?@action=redirect&bpo=38026

   (84) https://bugs.python.org/issue?@action=redirect&bpo=35923

   (85) https://bugs.python.org/issue?@action=redirect&bpo=38010

   (86) https://bugs.python.org/issue?@action=redirect&bpo=38006

   (87) https://bugs.python.org/issue?@action=redirect&bpo=37995

   (88) https://bugs.python.org/issue?@action=redirect&bpo=34410

   (89) https://bugs.python.org/issue?@action=redirect&bpo=37140

   (90) https://bugs.python.org/issue?@action=redirect&bpo=37587

   (91) https://bugs.python.org/issue?@action=redirect&bpo=37834

   (92) https://bugs.python.org/issue?@action=redirect&bpo=10978

   (93) https://bugs.python.org/issue?@action=redirect&bpo=37972

   (94) https://bugs.python.org/issue?@action=redirect&bpo=37965

   (95) https://bugs.python.org/issue?@action=redirect&bpo=37964

   (96) https://bugs.python.org/issue?@action=redirect&bpo=37960

   (97) https://bugs.python.org/issue?@action=redirect&bpo=37961

   (98) https://bugs.python.org/issue?@action=redirect&bpo=37951

   (99) https://bugs.python.org/issue?@action=redirect&bpo=36205

   (100) https://bugs.python.org/issue?@action=redirect&bpo=37950

   (101) https://bugs.python.org/issue?@action=redirect&bpo=34679

   (102) https://bugs.python.org/issue?@action=redirect&bpo=36917

   (103) https://bugs.python.org/issue?@action=redirect&bpo=37798

   (104) https://bugs.python.org/issue?@action=redirect&bpo=26589

   (105) https://bugs.python.org/issue?@action=redirect&bpo=37915

   (106) https://bugs.python.org/issue?@action=redirect&bpo=32554

   (107) https://bugs.python.org/issue?@action=redirect&bpo=9938

   (108) https://bugs.python.org/issue?@action=redirect&bpo=37851

   (109) https://bugs.python.org/issue?@action=redirect&bpo=32793

   (110) https://bugs.python.org/issue?@action=redirect&bpo=37885

   (111) https://bugs.python.org/issue?@action=redirect&bpo=37868

   (112) https://bugs.python.org/issue?@action=redirect&bpo=37811

   (113) https://bugs.python.org/issue?@action=redirect&bpo=37863

   (114) https://bugs.python.org/issue?@action=redirect&bpo=21131

   (115) https://bugs.python.org/issue?@action=redirect&bpo=37798

   (116) https://bugs.python.org/issue?@action=redirect&bpo=37804

   (117) https://bugs.python.org/issue?@action=redirect&bpo=37819

   (118) https://bugs.python.org/issue?@action=redirect&bpo=14465

   (119) https://bugs.python.org/issue?@action=redirect&bpo=37810

   (120) https://bugs.python.org/issue?@action=redirect&bpo=37772

   (121) https://bugs.python.org/issue?@action=redirect&bpo=18578

   (122) https://bugs.python.org/issue?@action=redirect&bpo=37785

   (123) https://bugs.python.org/issue?@action=redirect&bpo=34488

   (124) https://bugs.python.org/issue?@action=redirect&bpo=37449

   (125) https://bugs.python.org/issue?@action=redirect&bpo=28292

   (126) https://bugs.python.org/issue?@action=redirect&bpo=18049

   (127) https://bugs.python.org/issue?@action=redirect&bpo=37742

   (128) https://bugs.python.org/issue?@action=redirect&bpo=37738

   (129) https://bugs.python.org/issue?@action=redirect&bpo=37723

   (130) https://bugs.python.org/issue?@action=redirect&bpo=35943

   (131) https://bugs.python.org/issue?@action=redirect&bpo=32178

   (132) https://bugs.python.org/issue?@action=redirect&bpo=37268

   (133) https://bugs.python.org/issue?@action=redirect&bpo=11953

   (134) https://bugs.python.org/issue?@action=redirect&bpo=37685

   (135) https://bugs.python.org/issue?@action=redirect&bpo=37697

   (136) 
https://gitlab.com/python-devs/importlib_metadata/-/milestones/20

   (137) https://bugs.python.org/issue?@action=redirect&bpo=37695

   (138) https://bugs.python.org/issue?@action=redirect&bpo=37689

   (139) https://bugs.python.org/issue?@action=redirect&bpo=29553

   (140) https://bugs.python.org/issue?@action=redirect&bpo=37691

   (141) https://bugs.python.org/issue?@action=redirect&bpo=37685

   (142) https://bugs.python.org/issue?@action=redirect&bpo=37354

   (143) https://bugs.python.org/issue?@action=redirect&bpo=37664

   (144) https://bugs.python.org/issue?@action=redirect&bpo=37663

   (145) https://bugs.python.org/issue?@action=redirect&bpo=37642

   (146) https://bugs.python.org/issue?@action=redirect&bpo=36161

   (147) https://bugs.python.org/issue?@action=redirect&bpo=36324

   (148) https://bugs.python.org/issue?@action=redirect&bpo=37555

   (149) https://bugs.python.org/issue?@action=redirect&bpo=29446

   (150) https://bugs.python.org/issue?@action=redirect&bpo=16970

   (151) https://bugs.python.org/issue?@action=redirect&bpo=34443

   (152) https://bugs.python.org/issue?@action=redirect&bpo=37491

   (153) https://bugs.python.org/issue?@action=redirect&bpo=37587

   (154) https://bugs.python.org/issue?@action=redirect&bpo=18378

   (155) https://bugs.python.org/issue?@action=redirect&bpo=37579

   (156) https://bugs.python.org/issue?@action=redirect&bpo=21478

   (157) https://bugs.python.org/issue?@action=redirect&bpo=37531

   (158) https://bugs.python.org/issue?@action=redirect&bpo=37482

   (159) https://bugs.python.org/issue?@action=redirect&bpo=36993

   (160) https://bugs.python.org/issue?@action=redirect&bpo=37502

   (161) https://bugs.python.org/issue?@action=redirect&bpo=37520

   (162) https://bugs.python.org/issue?@action=redirect&bpo=18374

   (163) https://bugs.python.org/issue?@action=redirect&bpo=37424

   (164) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (165) https://bugs.python.org/issue?@action=redirect&bpo=37481

   (166) https://bugs.python.org/issue?@action=redirect&bpo=37479

   (167) https://bugs.python.org/issue?@action=redirect&bpo=37440

   (168) https://bugs.python.org/issue?@action=redirect&bpo=37437

   (169) https://bugs.python.org/issue?@action=redirect&bpo=37428

   (170) https://bugs.python.org/issue?@action=redirect&bpo=37420

   (171) https://bugs.python.org/issue?@action=redirect&bpo=37412

   (172) https://peps.python.org/pep-0529/

   (173) https://bugs.python.org/issue?@action=redirect&bpo=37406

   (174) https://bugs.python.org/issue?@action=redirect&bpo=29412

   (175) https://bugs.python.org/issue?@action=redirect&bpo=36546

   (176) https://bugs.python.org/issue?@action=redirect&bpo=37394

   (177) https://bugs.python.org/issue?@action=redirect&bpo=37376

   (178) https://bugs.python.org/issue?@action=redirect&bpo=26967

   (179) https://bugs.python.org/issue?@action=redirect&bpo=37212

   (180) https://bugs.python.org/issue?@action=redirect&bpo=37372

   (181) https://bugs.python.org/issue?@action=redirect&bpo=37345

   (182) https://bugs.python.org/issue?@action=redirect&bpo=37358

   (183) https://bugs.python.org/issue?@action=redirect&bpo=37347

   (184) https://bugs.python.org/issue?@action=redirect&bpo=37163

   (185) https://bugs.python.org/issue?@action=redirect&bpo=37085

   (186) https://bugs.python.org/issue?@action=redirect&bpo=37328

   (187) https://bugs.python.org/issue?@action=redirect&bpo=37305

   (188) https://bugs.python.org/issue?@action=redirect&bpo=37320

   (189) https://bugs.python.org/issue?@action=redirect&bpo=37315

   (190) https://bugs.python.org/issue?@action=redirect&bpo=37312

   (191) https://bugs.python.org/issue?@action=redirect&bpo=33972

   (192) https://bugs.python.org/issue?@action=redirect&bpo=37280

   (193) https://bugs.python.org/issue?@action=redirect&bpo=37279

   (194) https://bugs.python.org/issue?@action=redirect&bpo=19865

   (195) https://bugs.python.org/issue?@action=redirect&bpo=37266

   (196) https://bugs.python.org/issue?@action=redirect&bpo=37210

   (197) https://bugs.python.org/issue?@action=redirect&bpo=21872

   (198) https://bugs.python.org/issue?@action=redirect&bpo=35922

   (199) https://bugs.python.org/issue?@action=redirect&bpo=35766

   (200) https://bugs.python.org/issue?@action=redirect&bpo=36607

   (201) https://bugs.python.org/issue?@action=redirect&bpo=18748

   (202) https://bugs.python.org/issue?@action=redirect&bpo=36402

   (203) https://bugs.python.org/issue?@action=redirect&bpo=37206

   (204) https://bugs.python.org/issue?@action=redirect&bpo=37111

   (205) https://bugs.python.org/issue?@action=redirect&bpo=12144

   (206) https://bugs.python.org/issue?@action=redirect&bpo=34886

   (207) https://bugs.python.org/issue?@action=redirect&bpo=37173

   (208) https://bugs.python.org/issue?@action=redirect&bpo=37178

   (209) https://bugs.python.org/issue?@action=redirect&bpo=37178

   (210) https://bugs.python.org/issue?@action=redirect&bpo=37165

   (211) https://bugs.python.org/issue?@action=redirect&bpo=34767

   (212) https://bugs.python.org/issue?@action=redirect&bpo=37158

   (213) https://bugs.python.org/issue?@action=redirect&bpo=34282

   (214) https://bugs.python.org/issue?@action=redirect&bpo=37150

   (215) https://bugs.python.org/issue?@action=redirect&bpo=28724

   (216) https://bugs.python.org/issue?@action=redirect&bpo=35621

   (217) https://bugs.python.org/issue?@action=redirect&bpo=36520

   (218) https://bugs.python.org/issue?@action=redirect&bpo=30835

   (219) https://bugs.python.org/issue?@action=redirect&bpo=31163

   (220) https://bugs.python.org/issue?@action=redirect&bpo=25068

   (221) https://bugs.python.org/issue?@action=redirect&bpo=26185

   (222) https://bugs.python.org/issue?@action=redirect&bpo=21315

   (223) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (224) https://bugs.python.org/issue?@action=redirect&bpo=35805

   (225) https://bugs.python.org/issue?@action=redirect&bpo=36871

   (226) https://bugs.python.org/issue?@action=redirect&bpo=35070

   (227) https://bugs.python.org/issue?@action=redirect&bpo=31783

   (228) https://bugs.python.org/issue?@action=redirect&bpo=36582

   (229) https://bugs.python.org/issue?@action=redirect&bpo=32424

   (230) https://bugs.python.org/issue?@action=redirect&bpo=36564

   (231) https://bugs.python.org/issue?@action=redirect&bpo=36543

   (232) https://bugs.python.org/issue?@action=redirect&bpo=36409

   (233) https://bugs.python.org/issue?@action=redirect&bpo=36302

   (234) https://bugs.python.org/issue?@action=redirect&bpo=36250

   (235) https://bugs.python.org/issue?@action=redirect&bpo=36046

   (236) https://bugs.python.org/issue?@action=redirect&bpo=32627

   (237) https://bugs.python.org/issue?@action=redirect&bpo=35800

   (238) https://bugs.python.org/issue?@action=redirect&bpo=35168

   (239) https://bugs.python.org/issue?@action=redirect&bpo=8538

   (240) https://bugs.python.org/issue?@action=redirect&bpo=20504

   (241) https://bugs.python.org/issue?@action=redirect&bpo=25988

   (242) https://bugs.python.org/issue?@action=redirect&bpo=11122

   (243) https://bugs.python.org/issue?@action=redirect&bpo=34775

   (244) https://bugs.python.org/issue?@action=redirect&bpo=34749

   (245) https://bugs.python.org/issue?@action=redirect&bpo=34519

   (246) https://bugs.python.org/issue?@action=redirect&bpo=28009

   (247) https://bugs.python.org/issue?@action=redirect&bpo=30618

   (248) https://bugs.python.org/issue?@action=redirect&bpo=32498

   (249) https://bugs.python.org/issue?@action=redirect&bpo=33348

   (250) https://bugs.python.org/issue?@action=redirect&bpo=32689

   (251) https://bugs.python.org/issue?@action=redirect&bpo=32820

   (252) https://bugs.python.org/issue?@action=redirect&bpo=27657

   (253) https://bugs.python.org/issue?@action=redirect&bpo=4963


File: python.info,  Node: ドキュメント<51>,  Next: テスト<54>,  Prev: ライブラリ<162>,  Up: Python 3 9 0 alpha 1

1.26.56.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: 3e. examples from %-formatting
     to f-strings.

   - bpo-38778(4): Document the fact that *note RuntimeError: 317. is
     raised if *note os.fork(): 6c3. 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(): 807.
     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():
     563. docs.

   - bpo-37878(14): Make *note PyThreadState_DeleteCurrent(): 1fc7.
     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: 114.

   - 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: 851.
     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(): 2dd, 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: 33. 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: 7a5. 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: テスト<54>,  Next: ビルド<58>,  Prev: ドキュメント<51>,  Up: Python 3 9 0 alpha 1

1.26.56.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: ed.:
     *note LOOPBACK_TIMEOUT: 1fac, *note INTERNET_TIMEOUT: 1fad, *note
     SHORT_TIMEOUT: 1e79. and *note LONG_TIMEOUT: 1fae.

   - 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(): 1fc9. and *note os.killpg():
     1fca. 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: 33. 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: 427. exception
     using *note threading.excepthook(): c27.

   - 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():
     1fcb. 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():
     1fcc.: its __exit__() method now ignores unraisable exception
     raised when clearing its ‘unraisable’ attribute.

   - bpo-37069(40): regrtest now uses *note sys.unraisablehook(): 712.
     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(): 1fcd. 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: ビルド<58>,  Next: Windows<50>,  Prev: テスト<54>,  Up: Python 3 9 0 alpha 1

1.26.56.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: 1ea. and by the *note unicodedata: 10e. 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(): 1fcf. were no longer exported in ‘libpython38.dll’
     by mistake.  Export them again to fix the ABI compatibility.

   - bpo-25361(15): Enables use of SSE2 instructions in Windows 32-bit
     build.

   - bpo-36210(16): Update optional extension module detection for AIX.
     ossaudiodev and spwd are not applicable for AIX, and are no longer
     reported as missing.  3rd-party packaging of ncurses (with ASIS
     support) conflicts with officially supported AIX curses library, so
     configure AIX to use libcurses.a.  However, skip trying to build
     _curses_panel.

     patch by M Felt

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38809

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38684

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38468

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37415

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38301

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36002

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37936

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37760

   (9) https://bugs.python.org/issue?@action=redirect&bpo=37936

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37725

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37707

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36044

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37468

   (14) https://bugs.python.org/issue?@action=redirect&bpo=37189

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25361

   (16) https://bugs.python.org/issue?@action=redirect&bpo=36210


File: python.info,  Node: Windows<50>,  Next: macOS<40>,  Prev: ビルド<58>,  Up: Python 3 9 0 alpha 1

1.26.56.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(): 6e7. 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(): 24d.
     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(): 4fc. failing for block
     devices on Windows

   - bpo-38020(20): Fixes potential crash when calling *note
     os.readlink(): cf1. (or indirectly through *note realpath(): 24d.)
     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(): 1fd1. no longer fails for standard
     streams on Windows 7.

   - bpo-1311(23): The ‘nul’ file on Windows now returns True from *note
     exists(): dd6. and a valid result from *note os.stat(): 4fc. 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(): 8b6. and other reparse points as regular files
     in *note os.stat(): 4fc.

   - 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: 1c8. 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: 3b4. 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(): 1fd1. 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: 1fd2. 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<40>,  Next: IDLE<33>,  Prev: Windows<50>,  Up: Python 3 9 0 alpha 1

1.26.56.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<31>,  Prev: macOS<40>,  Up: Python 3 9 0 alpha 1

1.26.56.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<31>,  Next: C API<54>,  Prev: IDLE<33>,  Up: Python 3 9 0 alpha 1

1.26.56.10 Tools/Demos
......................

   - bpo-38118(1): Update Valgrind suppression file to ignore a false
     alarm in *note PyUnicode_Decode(): 1fd6. 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<54>,  Prev: Tools/Demos<31>,  Up: Python 3 9 0 alpha 1

1.26.56.11 C API
................

   - bpo-37633(1): Re-export some function compatibility wrappers for
     macros in ‘pythonrun.h’.

   - bpo-38644(2): Provide *note Py_EnterRecursiveCall(): 605. and *note
     Py_LeaveRecursiveCall(): d40. 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: d4e. is now a constant and refers to
     a constant string.

   - bpo-38540(4): Fixed possible leak in *note PyArg_Parse(): 1a8b. 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: e19. 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: 3b4. to
     the program full path (‘Py_GetProgramFullPath()’) rather than to
     the program name (‘Py_GetProgramName()’).

   - 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(): f77. macro now calls
     *note Py_FatalError(): d4f.

   - 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(): 835. and its variants instead.

   - bpo-37151(20): ‘PyCFunction_Call’ is now a deprecated alias of
     *note PyObject_Call(): 835.

   - 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(): 1fd8.
     function.

   - bpo-37337(26): Add fast functions for calling methods:
     ‘_PyObject_VectorcallMethod()’, ‘_PyObject_CallMethodNoArgs()’ and
     ‘_PyObject_CallMethodOneArg()’.

   - bpo-28805(27): The *note METH_FASTCALL: 353. 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(): 834.
     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(): 1fd9.

   - 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.26.57 Python 3.8.0 beta 1
---------------------------

'Release date: 2019-06-04'

* Menu:

* セキュリティ: セキュリティ<42>.
* Core and Builtins: Core and Builtins<162>.
* ライブラリ: ライブラリ<163>.
* ドキュメント: ドキュメント<52>.
* テスト: テスト<55>.
* ビルド: ビルド<59>.
* Windows: Windows<51>.
* macOS: macOS<41>.
* IDLE: IDLE<34>.
* Tools/Demos: Tools/Demos<32>.
* C API: C API<55>.


File: python.info,  Node: セキュリティ<42>,  Next: Core and Builtins<162>,  Up: Python 3 8 0 beta 1

1.26.57.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: 114.

   - 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<162>,  Next: ライブラリ<163>,  Prev: セキュリティ<42>,  Up: Python 3 8 0 beta 1

1.26.57.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: 32e, *note float: 32f. and
     *note complex: 330. will now use the *note __index__(): 444.
     special method, if available and the corresponding method *note
     __int__(): 443, *note __float__(): d96. or *note __complex__():
     9e3. 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(): dd1.

   - bpo-37032(13): Added new ‘replace()’ method to the code type (*note
     types.CodeType: 2ed.).

   - bpo-37007(14): Implement *note socket.if_nameindex(): df5, *note
     socket.if_nametoindex(): df6, and *note socket.if_indextoname():
     df7. on Windows.

   - bpo-36829(15): *note PyErr_WriteUnraisable(): 7ee. now creates a
     traceback object if there is no current traceback.  Moreover, call
     *note PyErr_NormalizeException(): 644. and *note
     PyException_SetTraceback(): 1fdd. 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: 189. 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: 5f6, *note int: 32e, *note float: 32f, *note complex:
     330. and few classes from the standard library.  They now inherit
     ‘__str__()’ from *note object: e51.

   - 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: a81. and *note
     sys.float_info: 1fde. 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: ライブラリ<163>,  Next: ドキュメント<52>,  Prev: Core and Builtins<162>,  Up: Python 3 8 0 beta 1

1.26.57.3 ライブラリ
....................

   - bpo-37128(1): Added *note math.perm(): ac3.

   - 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(): e3e.
     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(): 6c2. now logs
     uncaught exception raised by the function using *note
     sys.unraisablehook(): 712, rather than *note sys.excepthook(): be9,
     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: e11. setup for autospeccing.  Document
     newly implemented async methods in *note unittest.mock.MagicMock:
     1243.

   - 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(): 1d5. now accepts the same
     input types for source code as the built-in *note compile(): 1d3.
     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(): c27.
     function which handles uncaught *note threading.Thread.run(): e04.
     exception.  It can be overridden to control how uncaught
     ‘threading.Thread.run()’ exceptions are handled.

   - bpo-36996(25): Handle *note unittest.mock.patch(): 1246. used as a
     decorator on async functions.

   - bpo-37008(26): Add support for calling *note next(): bb9. with the
     mock resulting from *note unittest.mock.mock_open(): 1395.

   - 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(): bdd. and *note
     fileinput.FileInput: b23. '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: 66c. 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(): 14ef. now ignores *note
     errno.EINVAL: 1fe0. on *note os.setxattr(): 14c8. 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: 196b. and *note asyncio.StreamWriter: 1c95.
     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(): e3f. and *note
     asyncio.create_subprocess_exec(): e3e. 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(): dcb. 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: d7. 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(): 712. 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(): 456.).

   - 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: 4d6. 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: dbe. exception to the *note
     gzip: 6a. 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(): ded. now supports silent
     mode.  Patch by Joannah Nanjekye

   - bpo-29183(72): Fix double exceptions in *note
     wsgiref.handlers.BaseHandler: 1fe1. 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(): 15be. 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(): 1395. results now
     respects the argument of read([size]).  Patch contributed by Rémi
     Lapeyre.

   - bpo-35431(88): Implement *note math.comb(): ac2. 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:
     15ef. 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(): 156. is
     slightly improved.  Patch by Sergey Fedoseev.

   - bpo-33361(95): Fix a bug in *note codecs.StreamRecoder: 1fe2. where
     seeking might leave old data in a buffer and break subsequent read
     calls.  Patch by Ammar Askar.

   - bpo-22454(96): The *note shlex: cc. module now exposes *note
     shlex.join(): def, the inverse of *note shlex.split(): 94e.  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(): 6c5. on Windows.  The 'args' parameter
     now accepts a *note path-like object: 7a5. 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: 1fe3. now accepts a
     'missing_ok' parameter to avoid a *note FileNotFoundError: 24f.
     from being raised.  Patch by Robert Buchholz.

   - bpo-32941(101): Allow *note mmap.mmap: 247. objects to access the
     madvise() system call (through *note mmap.mmap.madvise(): dce.).

   - 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(): 1b99. to
     return the patched dictionary when used as context manager.  Patch
     by Vadim Tsander.

   - bpo-27141(105): Added a ‘__copy__()’ to ‘collections.UserList’ and
     ‘collections.UserDict’ in order to correctly implement shallow
     copying of the objects.  Patch by Bar Harel.

   - bpo-31829(106): ‘\r’, ‘\0’ and ‘\x1a’ (end-of-file on Windows) are
     now escaped in protocol 0 pickles of Unicode strings.  This allows
     to load them without loss from files open in text mode in Python 2.

   - bpo-23395(107): ‘_thread.interrupt_main()’ now avoids setting the
     Python error status if the ‘SIGINT’ signal is ignored or not
     handled by Python.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37128

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37120

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12202

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26835

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29262

   (6) https://bugs.python.org/issue?@action=redirect&bpo=12639

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36999

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35246

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35279

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37076

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33725

   (12) https://bugs.python.org/issue?@action=redirect&bpo=37054

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37058

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36933

   (15) https://bugs.python.org/issue?@action=redirect&bpo=37047

   (16) https://bugs.python.org/issue?@action=redirect&bpo=37049

   (17) https://bugs.python.org/issue?@action=redirect&bpo=37046

   (18) https://bugs.python.org/issue?@action=redirect&bpo=37045

   (19) https://bugs.python.org/issue?@action=redirect&bpo=37035

   (20) https://bugs.python.org/issue?@action=redirect&bpo=37001

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37028

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37027

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32528

   (24) https://bugs.python.org/issue?@action=redirect&bpo=1230540

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36996

   (26) https://bugs.python.org/issue?@action=redirect&bpo=37008

   (27) https://bugs.python.org/issue?@action=redirect&bpo=27737

   (28) https://bugs.python.org/issue?@action=redirect&bpo=36969

   (29) https://bugs.python.org/issue?@action=redirect&bpo=36969

   (30) https://bugs.python.org/issue?@action=redirect&bpo=36983

   (31) https://bugs.python.org/issue?@action=redirect&bpo=36972

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32972

   (33) https://bugs.python.org/issue?@action=redirect&bpo=36952

   (34) https://bugs.python.org/issue?@action=redirect&bpo=36952

   (35) https://bugs.python.org/issue?@action=redirect&bpo=36949

   (36) https://bugs.python.org/issue?@action=redirect&bpo=36948

   (37) https://bugs.python.org/issue?@action=redirect&bpo=33524

   (38) https://bugs.python.org/issue?@action=redirect&bpo=24564

   (39) https://bugs.python.org/issue?@action=redirect&bpo=36888

   (40) https://bugs.python.org/issue?@action=redirect&bpo=36921

   (41) https://bugs.python.org/issue?@action=redirect&bpo=25652

   (42) https://bugs.python.org/issue?@action=redirect&bpo=36916

   (43) https://bugs.python.org/issue?@action=redirect&bpo=36889

   (44) https://bugs.python.org/issue?@action=redirect&bpo=36845

   (45) https://bugs.python.org/issue?@action=redirect&bpo=23378

   (46) https://bugs.python.org/issue?@action=redirect&bpo=36867

   (47) https://bugs.python.org/issue?@action=redirect&bpo=23896

   (48) https://bugs.python.org/issue?@action=redirect&bpo=36895

   (49) https://bugs.python.org/issue?@action=redirect&bpo=35545

   (50) https://bugs.python.org/issue?@action=redirect&bpo=36887

   (51) https://bugs.python.org/issue?@action=redirect&bpo=34632

   (52) https://bugs.python.org/issue?@action=redirect&bpo=36878

   (53) https://bugs.python.org/issue?@action=redirect&bpo=36778

   (54) https://bugs.python.org/issue?@action=redirect&bpo=36867

   (55) https://bugs.python.org/issue?@action=redirect&bpo=30262

   (56) https://bugs.python.org/issue?@action=redirect&bpo=24538

   (57) https://bugs.python.org/issue?@action=redirect&bpo=36829

   (58) https://bugs.python.org/issue?@action=redirect&bpo=36832

   (59) https://bugs.python.org/issue?@action=redirect&bpo=36814

   (60) https://bugs.python.org/issue?@action=redirect&bpo=33110

   (61) https://bugs.python.org/issue?@action=redirect&bpo=26903

   (62) https://bugs.python.org/issue?@action=redirect&bpo=36813

   (63) https://bugs.python.org/issue?@action=redirect&bpo=36806

   (64) https://bugs.python.org/issue?@action=redirect&bpo=36802

   (65) https://bugs.python.org/issue?@action=redirect&bpo=36801

   (66) https://bugs.python.org/issue?@action=redirect&bpo=36785

   (67) https://bugs.python.org/issue?@action=redirect&bpo=36772

   (68) https://bugs.python.org/issue?@action=redirect&bpo=6584

   (69) https://bugs.python.org/issue?@action=redirect&bpo=36748

   (70) https://bugs.python.org/issue?@action=redirect&bpo=8138

   (71) https://bugs.python.org/issue?@action=redirect&bpo=22640

   (72) https://bugs.python.org/issue?@action=redirect&bpo=29183

   (73) https://bugs.python.org/issue?@action=redirect&bpo=36548

   (74) https://bugs.python.org/issue?@action=redirect&bpo=36542

   (75) https://bugs.python.org/issue?@action=redirect&bpo=36533

   (76) https://bugs.python.org/issue?@action=redirect&bpo=35252

   (77) https://bugs.python.org/issue?@action=redirect&bpo=35900

   (78) https://bugs.python.org/issue?@action=redirect&bpo=35900

   (79) https://bugs.python.org/issue?@action=redirect&bpo=36368

   (80) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (81) https://bugs.python.org/issue?@action=redirect&bpo=27497

   (82) https://bugs.python.org/issue?@action=redirect&bpo=36239

   (83) https://bugs.python.org/issue?@action=redirect&bpo=26707

   (84) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (85) https://bugs.python.org/issue?@action=redirect&bpo=35125

   (86) https://bugs.python.org/issue?@action=redirect&bpo=35721

   (87) https://bugs.python.org/issue?@action=redirect&bpo=31855

   (88) https://bugs.python.org/issue?@action=redirect&bpo=35431

   (89) https://bugs.python.org/issue?@action=redirect&bpo=26660

   (90) https://bugs.python.org/issue?@action=redirect&bpo=34271

   (91) https://bugs.python.org/issue?@action=redirect&bpo=26467

   (92) https://bugs.python.org/issue?@action=redirect&bpo=33569

   (93) https://bugs.python.org/issue?@action=redirect&bpo=34424

   (94) https://bugs.python.org/issue?@action=redirect&bpo=34303

   (95) https://bugs.python.org/issue?@action=redirect&bpo=33361

   (96) https://bugs.python.org/issue?@action=redirect&bpo=22454

   (97) https://bugs.python.org/issue?@action=redirect&bpo=31922

   (98) https://bugs.python.org/issue?@action=redirect&bpo=24882

   (99) https://bugs.python.org/issue?@action=redirect&bpo=31961

   (100) https://bugs.python.org/issue?@action=redirect&bpo=33123

   (101) https://bugs.python.org/issue?@action=redirect&bpo=32941

   (102) https://bugs.python.org/issue?@action=redirect&bpo=22102

   (103) https://bugs.python.org/issue?@action=redirect&bpo=32515

   (104) https://bugs.python.org/issue?@action=redirect&bpo=32299

   (105) https://bugs.python.org/issue?@action=redirect&bpo=27141

   (106) https://bugs.python.org/issue?@action=redirect&bpo=31829

   (107) https://bugs.python.org/issue?@action=redirect&bpo=23395


File: python.info,  Node: ドキュメント<52>,  Next: テスト<55>,  Prev: ライブラリ<163>,  Up: Python 3 8 0 beta 1

1.26.57.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: テスト<55>,  Next: ビルド<59>,  Prev: ドキュメント<52>,  Up: Python 3 8 0 beta 1

1.26.57.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(): 1fcc. rather than
     *note test.support.captured_stderr(): 1fe6.

   - 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():
     1fcc.: context manager catching unraisable exception using *note
     sys.unraisablehook(): 712.

   - 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: 33. 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: ビルド<59>,  Next: Windows<51>,  Prev: テスト<55>,  Up: Python 3 8 0 beta 1

1.26.57.6 ビルド
................

   - bpo-36721(1): To embed Python into an application, a new ‘--embed’
     option must be passed to ‘python3-config --libs --embed’ to get
     ‘-lpython3.8’ (link the application to libpython).  To support both
     3.8 and older, try ‘python3-config --libs --embed’ first and
     fallback to ‘python3-config --libs’ (without ‘--embed’) if the
     previous command fails.

     Python をアプリケーションに組み込むために、‘python-3.8-embed’
     pkg-config モジュールが追加されました: ‘pkg-config python-3.8-embed
     --libs’ の出力は、‘-lpython3.8’ を含みます。 Python3.8 以前との互換
     性を保つためには、‘pkg-config python-X.Y-embed --libs’ をまず試みて
     から、失敗した場合 ‘pkg-config python-X.Y --libs’ (‘--embed’ なし)
     にフォールバックしてください。(‘X.Y’ を使用するPython のバージョン
     に置き換えてください)

     On the other hand, ‘pkg-config python3.8 --libs’ no longer contains
     ‘-lpython3.8’.  C extensions must not be linked to libpython
     (except on Android, case handled by the script); this change is
     backward incompatible on purpose.

   - bpo-36786(2): "make install" now runs compileall in parallel.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36721

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36786


File: python.info,  Node: Windows<51>,  Next: macOS<41>,  Prev: ビルド<59>,  Up: Python 3 8 0 beta 1

1.26.57.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(): e6e. 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<41>,  Next: IDLE<34>,  Prev: Windows<51>,  Up: Python 3 8 0 beta 1

1.26.57.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<32>,  Prev: macOS<41>,  Up: Python 3 8 0 beta 1

1.26.57.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<32>,  Next: C API<55>,  Prev: IDLE<34>,  Up: Python 3 8 0 beta 1

1.26.57.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<55>,  Prev: Tools/Demos<32>,  Up: Python 3 8 0 beta 1

1.26.57.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(): 1fed. 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(): 64a. 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.26.58 Python 3.8.0 alpha 4
----------------------------

'Release date: 2019-05-06'

* Menu:

* セキュリティ: セキュリティ<43>.
* Core and Builtins: Core and Builtins<163>.
* ライブラリ: ライブラリ<164>.
* ドキュメント: ドキュメント<53>.
* テスト: テスト<56>.
* ビルド: ビルド<60>.
* Windows: Windows<52>.
* macOS: macOS<42>.
* IDLE: IDLE<35>.
* Tools/Demos: Tools/Demos<33>.
* C API: C API<56>.


File: python.info,  Node: セキュリティ<43>,  Next: Core and Builtins<163>,  Up: Python 3 8 0 alpha 4

1.26.58.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(): 8c9. 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: df. 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<163>,  Next: ライブラリ<164>,  Prev: セキュリティ<43>,  Up: Python 3 8 0 alpha 4

1.26.58.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: 108. 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: 51f. 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(): 83f, *note Py_END_ALLOW_THREADS(): e52, and
     *note PyGILState_Ensure(): 1b0.

   - 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(): 163d.

   - bpo-36440(18): Include node names in ‘ParserError’ messages,
     instead of numeric IDs.  Patch by A. Skrobov.

   - bpo-36143(19): Regenerate *note keyword: 87. from the Grammar and
     Tokens file using pgen.  Patch by Pablo Galindo.

   - bpo-18372(20): Add missing *note PyObject_GC_Track(): 18bc. 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: ライブラリ<164>,  Next: ドキュメント<53>,  Prev: Core and Builtins<163>,  Up: Python 3 8 0 alpha 4

1.26.58.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: b23. 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:
     3b4. is ‘None’ or an empty string: use *note os.getcwd(): 1b45. 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(): 8c9. and
     ‘distutils.spawn.find_executable’ now use ‘os.confstr("CS_PATH")’
     if available instead of *note os.defpath: 1ff2, 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: 183. ‘dev’) and in
     debug build, the *note io.IOBase: 710. 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(): 15a7. 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:
     72, 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(): 1246. object will now return ‘None’ instead
     of raising *note RuntimeError: 317, 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(): db4. and *note
     datetime.datetime.fromisocalendar(): db5, 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: 79. module, and the initializer for *note
     modulefinder.ModuleFinder: 1ff3. 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(): df3. and *note
     has_dualstack_ipv6(): df4. 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(): 6a0. and *note
     staticmethod(): 66d. to *note unittest.mock.create_autospec():
     1b6d.  Initial patch by Felipe Ochoa.

   - bpo-35416(45): Fix potential resource warnings in distutils.  Patch
     by Mickaël Schoentgen.

   - bpo-25451(46): Add transparency methods to ‘tkinter.PhotoImage’.
     Patch by Zackery Spytz.

   - bpo-35082(47): Don't return deleted attributes when calling dir on
     a *note unittest.mock.Mock: e12.

   - bpo-34547(48): *note wsgiref.handlers.BaseHandler: 1fe1. now
     handles abrupt client connection terminations gracefully.  Patch by
     Petter Strandmark.

   - bpo-31658(49): *note xml.sax.parse(): 1ff4. now supports *note
     path-like: 7a5.  Patch by Mickaël Schoentgen.

   - bpo-34139(50): Remove stale unix datagram socket before binding

   - bpo-33530(51): Implemented Happy Eyeballs in
     ‘asyncio.create_connection()’.  Added two new arguments,
     'happy_eyeballs_delay' and 'interleave', to specify Happy Eyeballs
     behavior.

   - bpo-33291(52): Do not raise AttributeError when calling the inspect
     functions isgeneratorfunction, iscoroutinefunction,
     isasyncgenfunction on a method created from an arbitrary callable.
     Instead, return False.

   - bpo-31310(53): Fix the multiprocessing.semaphore_tracker so it is
     reused by child processes

   - bpo-31292(54): Fix ‘setup.py check --restructuredtext’ for files
     containing ‘include’ directives.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35952

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28238

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26978

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1613500

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36734

   (6) https://bugs.python.org/issue?@action=redirect&bpo=13611

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36669

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36676

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36673

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36650

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28552

   (12) https://bugs.python.org/issue?@action=redirect&bpo=35755

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25430

   (14) https://bugs.python.org/issue?@action=redirect&bpo=30485

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36613

   (16) https://bugs.python.org/issue?@action=redirect&bpo=36598

   (17) https://bugs.python.org/issue?@action=redirect&bpo=18748

   (18) https://bugs.python.org/issue?@action=redirect&bpo=36575

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33461

   (20) https://bugs.python.org/issue?@action=redirect&bpo=36559

   (21) https://bugs.python.org/issue?@action=redirect&bpo=17561

   (22) https://bugs.python.org/issue?@action=redirect&bpo=34373

   (23) https://bugs.python.org/issue?@action=redirect&bpo=36232

   (24) https://bugs.python.org/issue?@action=redirect&bpo=36546

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36050

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36522

   (27) https://bugs.python.org/issue?@action=redirect&bpo=36492

   (28) https://bugs.python.org/issue?@action=redirect&bpo=27181

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30427

   (30) https://bugs.python.org/issue?@action=redirect&bpo=36385

   (31) https://bugs.python.org/issue?@action=redirect&bpo=36434

   (32) https://bugs.python.org/issue?@action=redirect&bpo=36407

   (33) https://bugs.python.org/issue?@action=redirect&bpo=36326

   (34) https://bugs.python.org/issue?@action=redirect&bpo=36366

   (35) https://bugs.python.org/issue?@action=redirect&bpo=36348

   (36) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (37) https://bugs.python.org/issue?@action=redirect&bpo=36227

   (38) https://bugs.python.org/issue?@action=redirect&bpo=36004

   (39) https://bugs.python.org/issue?@action=redirect&bpo=35936

   (40) https://bugs.python.org/issue?@action=redirect&bpo=35376

   (41) https://bugs.python.org/issue?@action=redirect&bpo=17396

   (42) https://bugs.python.org/issue?@action=redirect&bpo=35934

   (43) https://bugs.python.org/issue?@action=redirect&bpo=17561

   (44) https://bugs.python.org/issue?@action=redirect&bpo=23078

   (45) https://bugs.python.org/issue?@action=redirect&bpo=35416

   (46) https://bugs.python.org/issue?@action=redirect&bpo=25451

   (47) https://bugs.python.org/issue?@action=redirect&bpo=35082

   (48) https://bugs.python.org/issue?@action=redirect&bpo=34547

   (49) https://bugs.python.org/issue?@action=redirect&bpo=31658

   (50) https://bugs.python.org/issue?@action=redirect&bpo=34139

   (51) https://bugs.python.org/issue?@action=redirect&bpo=33530

   (52) https://bugs.python.org/issue?@action=redirect&bpo=33291

   (53) https://bugs.python.org/issue?@action=redirect&bpo=31310

   (54) https://bugs.python.org/issue?@action=redirect&bpo=31292


File: python.info,  Node: ドキュメント<53>,  Next: テスト<56>,  Prev: ライブラリ<164>,  Up: Python 3 8 0 alpha 4

1.26.58.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: 121.  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: 121. 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: テスト<56>,  Next: ビルド<60>,  Prev: ドキュメント<53>,  Up: Python 3 8 0 alpha 4

1.26.58.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: 1ff7. error.

   - bpo-36611(8): Fix ‘test_sys.test_getallocatedblocks()’ when *note
     tracemalloc: 108. 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: ビルド<60>,  Next: Windows<52>,  Prev: テスト<56>,  Up: Python 3 8 0 alpha 4

1.26.58.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(): 51d. function and the *note PYTHONDUMPREFS: d73.
     environment variable, can be set using the new ‘./configure
     --with-trace-refs’ build option.

   - bpo-36577(9): setup.py now correctly reports missing OpenSSL
     headers and libraries again.

   - bpo-36544(10): Fix regression introduced in bpo-36146(11)
     refactoring setup.py

   - bpo-36508(12): ‘python-config --ldflags’ no longer includes flags
     of the ‘LINKFORSHARED’ variable.  The ‘LINKFORSHARED’ variable must
     only be used to build executables.

   - bpo-36503(13): Remove references to "aix3" and "aix4".  Patch by M.
     Felt.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36747

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21536

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36707

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36635

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36618

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36605

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36465

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36577

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36544

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36146

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36508

   (13) https://bugs.python.org/issue?@action=redirect&bpo=36503


File: python.info,  Node: Windows<52>,  Next: macOS<42>,  Prev: ビルド<60>,  Up: Python 3 8 0 alpha 4

1.26.58.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(): db2.

   - 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<42>,  Next: IDLE<35>,  Prev: Windows<52>,  Up: Python 3 8 0 alpha 4

1.26.58.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<33>,  Prev: macOS<42>,  Up: Python 3 8 0 alpha 4

1.26.58.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<33>,  Next: C API<56>,  Prev: IDLE<35>,  Up: Python 3 8 0 alpha 4

1.26.58.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<56>,  Prev: Tools/Demos<33>,  Up: Python 3 8 0 alpha 4

1.26.58.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: 1ffe.(name) and *note PyDoc_STRVAR:
     1f6e.(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(): 102c. 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():
     f89. before *note Py_Initialize(): 67a. 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(): 1fff.
     function were incorrectly interpreted as a single timestamp rather
     than an arguments tuple, which causes existing code to start
     raising *note TypeError: 29c.  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.26.59 Python 3.8.0 alpha 3
----------------------------

'Release date: 2019-03-25'

* Menu:

* セキュリティ: セキュリティ<44>.
* Core and Builtins: Core and Builtins<164>.
* ライブラリ: ライブラリ<165>.
* ドキュメント: ドキュメント<54>.
* テスト: テスト<57>.
* ビルド: ビルド<61>.
* Windows: Windows<53>.
* IDLE: IDLE<36>.
* Tools/Demos: Tools/Demos<34>.
* C API: C API<57>.


File: python.info,  Node: セキュリティ<44>,  Next: Core and Builtins<164>,  Up: Python 3 8 0 alpha 3

1.26.59.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: 2002. 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<164>,  Next: ライブラリ<165>,  Prev: セキュリティ<44>,  Up: Python 3 8 0 alpha 3

1.26.59.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: 19f. 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(): 1d3. 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(): 10ce, *note
     marshal.load(): 2004, 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__(): 444. special method will be
     used instead of *note __int__(): 443. 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: ライブラリ<165>,  Next: ドキュメント<54>,  Prev: Core and Builtins<164>,  Up: Python 3 8 0 alpha 3

1.26.59.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: e7. 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: 8a. 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: 247. 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(): 2006.
     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:
     7a5.  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(): 14a0.
     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(): 1b6d. should propagate to the
     parent.  Patch by Karthikeyan Singaravelan.

   - bpo-35198(37): Fix C++ extension compilation on AIX

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36401

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36320

   (3) https://bugs.python.org/issue?@action=redirect&bpo=34745

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36324

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36321

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36297

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36298

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36268

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36285

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36272

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36280

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35931

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36251

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36235

   (16) https://bugs.python.org/issue?@action=redirect&bpo=35807

   (17) https://bugs.python.org/issue?@action=redirect&bpo=36139

   (18) https://bugs.python.org/issue?@action=redirect&bpo=36179

   (19) https://bugs.python.org/issue?@action=redirect&bpo=36169

   (20) https://bugs.python.org/issue?@action=redirect&bpo=36103

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36130

   (22) https://bugs.python.org/issue?@action=redirect&bpo=35652

   (23) https://bugs.python.org/issue?@action=redirect&bpo=35178

   (24) https://bugs.python.org/issue?@action=redirect&bpo=36106

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36091

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36043

   (27) https://bugs.python.org/issue?@action=redirect&bpo=35899

   (28) https://bugs.python.org/issue?@action=redirect&bpo=21269

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30670

   (30) https://bugs.python.org/issue?@action=redirect&bpo=35843

   (31) https://bugs.python.org/issue?@action=redirect&bpo=35802

   (32) https://bugs.python.org/issue?@action=redirect&bpo=35715

   (33) https://bugs.python.org/issue?@action=redirect&bpo=35493

   (34) https://bugs.python.org/issue?@action=redirect&bpo=35661

   (35) https://bugs.python.org/issue?@action=redirect&bpo=35121

   (36) https://bugs.python.org/issue?@action=redirect&bpo=21478

   (37) https://bugs.python.org/issue?@action=redirect&bpo=35198


File: python.info,  Node: ドキュメント<54>,  Next: テスト<57>,  Prev: ライブラリ<165>,  Up: Python 3 8 0 alpha 3

1.26.59.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: テスト<57>,  Next: ビルド<61>,  Prev: ドキュメント<54>,  Up: Python 3 8 0 alpha 3

1.26.59.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: ビルド<61>,  Next: Windows<53>,  Prev: テスト<57>,  Up: Python 3 8 0 alpha 3

1.26.59.6 ビルド
................

   - bpo-36356(1): Fix leaks that led to build failure when configured
     with address sanitizer.

   - bpo-36146(2): Add ‘TEST_EXTENSIONS’ constant to ‘setup.py’ to allow
     to not build test extensions like ‘_testcapi’.

   - bpo-36146(3): Fix setup.py on macOS: only add ‘/usr/include/ffi’ to
     include directories of _ctypes, not for all extensions.

   - bpo-31904(4): Enable build system to cross-build for VxWorks RTOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36356

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36146

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36146

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31904


File: python.info,  Node: Windows<53>,  Next: IDLE<36>,  Prev: ビルド<61>,  Up: Python 3 8 0 alpha 3

1.26.59.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<34>,  Prev: Windows<53>,  Up: Python 3 8 0 alpha 3

1.26.59.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<34>,  Next: C API<57>,  Prev: IDLE<36>,  Up: Python 3 8 0 alpha 3

1.26.59.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<57>,  Prev: Tools/Demos<34>,  Up: Python 3 8 0 alpha 3

1.26.59.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.26.60 Python 3.8.0 alpha 2
----------------------------

'Release date: 2019-02-25'

* Menu:

* Core and Builtins: Core and Builtins<165>.
* ライブラリ: ライブラリ<166>.
* ドキュメント: ドキュメント<55>.
* テスト: テスト<58>.
* Windows: Windows<54>.
* IDLE: IDLE<37>.


File: python.info,  Node: Core and Builtins<165>,  Next: ライブラリ<166>,  Up: Python 3 8 0 alpha 2

1.26.60.1 Core and Builtins
...........................

   - bpo-36052(1): Raise a *note SyntaxError: 189. 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: 1013. 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(): f91. 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: ライブラリ<166>,  Next: ドキュメント<55>,  Prev: Core and Builtins<165>,  Up: Python 3 8 0 alpha 2

1.26.60.2 ライブラリ
....................

   - bpo-35512(1): *note unittest.mock.patch.dict(): 1b99. 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(): 8c9.

   - bpo-35960(6): Fix *note dataclasses.field(): 1966. 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(): 2011.
     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(): 15e8, *note re.findall(): 13d6, *note re.sub():
     7a7. 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: 11d.: 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(): dca. as analogous
     function to *note sum(): 886. 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: 6ed. subclasses and *note datetime.timedelta:
     d98. now returns an object of the same type as the
     ‘datetime.datetime’ subclass.  As a result, *note
     datetime.datetime.astimezone(): d99. and alternate constructors
     like *note datetime.datetime.now(): 8ff. 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: e1f, ‘xmlrpc.client.Transport’ and
     ‘xmlrpc.client.SafeTransport’.  Patch by Cédric Krier.

   - bpo-34572(17): Fix C implementation of pickle.loads to use
     importlib's locking mechanisms, and thereby avoid using partially
     loaded modules.  Patch by Tim Burgess.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35512

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36018

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35904

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35918

   (5) https://bugs.python.org/issue?@action=redirect&bpo=18283

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35960

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35500

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35931

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24209

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35321

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35378

   (12) https://bugs.python.org/issue?@action=redirect&bpo=34294

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35615

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35606

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32417

   (16) https://bugs.python.org/issue?@action=redirect&bpo=35153

   (17) https://bugs.python.org/issue?@action=redirect&bpo=34572


File: python.info,  Node: ドキュメント<55>,  Next: テスト<58>,  Prev: ライブラリ<166>,  Up: Python 3 8 0 alpha 2

1.26.60.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: テスト<58>,  Next: Windows<54>,  Prev: ドキュメント<55>,  Up: Python 3 8 0 alpha 2

1.26.60.4 テスト
................

   - bpo-27313(1): Avoid test_ttk_guionly ComboboxTest failure with
     macOS Cocoa Tk.

   - bpo-36019(2): Add test.support.TEST_HTTP_URL and replace references
     of ‘http://www.example.com’ by this new constant.  Contributed by
     Stéphane Wirtel.

   - bpo-36037(3): Fix test_ssl for strict OpenSSL configuration like
     RHEL8 strict crypto policy.  Use older TLS version for minimum TLS
     version of the server SSL context if needed, to test TLS version
     older than default minimum TLS version.

   - bpo-35798(4): Added ‘test.support.check_syntax_warning()’.

   - bpo-35505(5): Make test_imap4_host_default_value independent on
     whether the local IMAP server is running.

   - bpo-35917(6): multiprocessing: provide unit tests for SyncManager
     and SharedMemoryManager classes + all the shareable types which are
     supposed to be supported by them.  (patch by Giampaolo Rodola)

   - bpo-35704(7): Skip ‘test_shutil.test_unpack_archive_xztar’ to
     prevent a MemoryError on 32-bit AIX when MAXDATA setting is less
     than 0x20000000.

     Patch by Michael Felt (aixtools)

   - bpo-34720(8): Assert m_state != NULL to mimic GC traversal
     functions that do not correctly handle module creation when the
     module state has not been created.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27313

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36019

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36037

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35798

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35505

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35917

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35704

   (8) https://bugs.python.org/issue?@action=redirect&bpo=34720


File: python.info,  Node: Windows<54>,  Next: IDLE<37>,  Prev: テスト<58>,  Up: Python 3 8 0 alpha 2

1.26.60.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<54>,  Up: Python 3 8 0 alpha 2

1.26.60.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.26.61 Python 3.8.0 alpha 1
----------------------------

'Release date: 2019-02-03'

* Menu:

* セキュリティ: セキュリティ<45>.
* Core and Builtins: Core and Builtins<166>.
* ライブラリ: ライブラリ<167>.
* ドキュメント: ドキュメント<56>.
* テスト: テスト<59>.
* ビルド: ビルド<62>.
* Windows: Windows<55>.
* macOS: macOS<43>.
* IDLE: IDLE<38>.
* Tools/Demos: Tools/Demos<35>.
* C API: C API<58>.


File: python.info,  Node: セキュリティ<45>,  Next: Core and Builtins<166>,  Up: Python 3 8 0 alpha 1

1.26.61.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: d2c. 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: d2b. and *note -s: 1747. 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(): ed7. 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<166>,  Next: ライブラリ<167>,  Prev: セキュリティ<45>,  Up: Python 3 8 0 alpha 1

1.26.61.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(): 440. 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(): 824. and ‘%s’ in *note
     PyBytes_FromFormat(): 2019. no longer read memory past the limit if
     'precision' is specified.

   - bpo-35504(12): Fix segfaults and *note SystemError: 3f1.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(): a17, ‘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: 13b.  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: d4.: Fix off-by-one bug in length
     check for ‘AF_ALG’ name and type.

   - bpo-29743(35): Raise *note ValueError: 15a. instead of *note
     OverflowError: c5b. in case of a negative ‘_length_’ in a *note
     ctypes.Array: 201a. subclass.  Also raise *note TypeError: 29c.
     instead of *note AttributeError: 1b4. 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: 451. raised as an exception at
     code generation time will be now replaced with a *note SyntaxError:
     189. for better error reporting.

   - bpo-34983(38): Expose *note symtable.Symbol.is_nonlocal(): 201b. in
     the symtable module.  Patch by Pablo Galindo.

   - bpo-34974(39): *note bytes: 1d2. and *note bytearray: 1d1.
     constructors no longer convert unexpected exceptions (e.g.  *note
     MemoryError: 191d. and *note KeyboardInterrupt: d9a.) to *note
     TypeError: 29c.

   - 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(): 1d2. when the *note
     list: 4e0. 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: 451. is now emitted instead
     of a *note DeprecationWarning: 2d4. 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:
     451. 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(): 51d.  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(): 333. 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: 1b4. 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(): 711, ensure that the
     *note closed: 201c. 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(): 1edf. before calling *note
     PyErr_Print(): 1f40.  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(): 1ec7, *note
     PyIndex_Check(): d56. and *note PyExceptionClass_Name(): e2e. 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: 157f. list.  *note PyGC_Collect(): d5a. 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: 317. is now raised when the
     custom metaclass doesn't provide the ‘__classcell__’ entry in the
     namespace passed to ‘type.__new__’.  A *note DeprecationWarning:
     2d4. was emitted in Python 3.6-3.7.

   - bpo-33499(108): Add *note PYTHONPYCACHEPREFIX: d70. environment
     variable and *note -X: 183. ‘pycache_prefix’ command-line option to
     set an alternate root directory for writing module bytecode cache
     files.

   - bpo-25711(109): The *note zipimport: 13b. 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: e73. and
     fixes the following issues:

        * Setting global *note StopAsyncIteration: 201d. 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: 430. statement is now allowed in
     the *note finally: 453. 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: 42f, *note
     continue: 430. and *note return: 452.

     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: ライブラリ<167>,  Next: ドキュメント<56>,  Prev: Core and Builtins<166>,  Up: Python 3 8 0 alpha 1

1.26.61.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(): 736. and *note
     os.posix_spawnp(): 196a. now have a 'setsid' parameter.

   - bpo-23846(8): *note asyncio.ProactorEventLoop: a03. 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(): 196a. 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: 91. 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: e0a. 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(): cad. and *note pydoc: bd.

   - 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(): d6e. function on *note fractions.Fraction: 1ce.
     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: df. module can now use the
     *note os.posix_spawn(): 736. 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: 2d. callback workaround: no
     longer create a callback at startup.  Avoid SELinux alert on
     ‘import ctypes’ and ‘import uuid’.

   - bpo-31784(33): *note uuid.uuid1(): f6b. now calls *note
     time.time_ns(): eb2. rather than ‘int(time.time() * 1e9)’.

   - bpo-35513(34): ‘TextTestRunner’ of ‘unittest.runner’ now uses *note
     time.perf_counter(): e4d. rather than *note time.time(): 764. 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: e1d. 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(): 1c2d. 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: e12. attributes.  Patch by Pablo Galindo.

   - bpo-17185(44): Set ‘__signature__’ on mock for *note inspect: 81.
     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: 754. 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: 7e5. on calling *note pwd.getpwuid(): 201f.: 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: cf. 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(): 1a21. 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(): 115d. 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(): 2020. now redirects ‘stderr’
     to *note os.devnull: 2021. 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(): 58c.
     instead.

   - bpo-35344(61): On macOS, *note platform.platform(): 1ce6. now uses
     *note platform.mac_ver(): 2022, 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(): fc1. 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: 1fc2. 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: 1968.'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: 66. 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(): 1500.
     now exits immediately if it's *note shutdown(): 2023. 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: 1243. now supports
     the ‘__fspath__’ method (from *note os.PathLike: 1013.).

   - bpo-35008(88): Fixed references leaks when call the
     ‘__setstate__()’ method of *note xml.etree.ElementTree.Element:
     34b. 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(): 154, *note
     inspect.isgeneratorfunction(): 1d78. and *note
     inspect.isasyncgenfunction(): 1d79. work with *note
     functools.partial(): 4ad.  Patch by Pablo Galindo.

   - bpo-34521(92): Use *note socket.CMSG_SPACE(): 2024. to calculate
     ancillary data size instead of *note socket.CMSG_LEN(): 2025. 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: bd. 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(): 2026. now
     accepts *note path-like object: 7a5. 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: 12e. module
     are now able to find children which are instances of ‘Element’
     subclasses.

   - bpo-32680(102): *note smtplib.SMTP: cfe. 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(): 2027.
     and *note hexdigest(): 2028. methods for the SHAKE algorithm in the
     *note hashlib: 6b. module.

   - bpo-34925(108): 25% speedup in argument parsing for the functions
     in the bisect module.

   - bpo-34900(109): Fixed *note unittest.TestCase.debug(): 1e5f. 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(): ded, 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(): 2029. 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: 13b.

   - bpo-32892(126): The parser now represents all constants as *note
     ast.Constant: 570. 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:
     10ba. on mock instances with deleted attributes

   - bpo-34672(134): Add a workaround, so the ‘'Z'’ *note
     time.strftime(): 15a8. 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(): 731. 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(): e13. and *note
     addClassCleanup(): e14. to unittest to support cleanups for *note
     setUpModule(): e15. and *note setUpClass(): e16.  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:
     df. 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: df. 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: 1ff2. 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: 15a. is
     now raised by *note multiprocessing.Queue.put(): 202a. and *note
     multiprocessing.Queue.get(): 202b. instead of *note AssertionError:
     a9c. and *note OSError: 543, 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: 13a.  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: 106. 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(): 2fc.  Patch by Alexey Izbyshev.

   - bpo-34427(168): Fix infinite loop in ‘a.extend(a)’ for
     ‘MutableSequence’ subclasses.

   - bpo-34412(169): Make *note signal.strsignal(): 202c. 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(): cf1. now accepts *note
     path-like: 7a5. and *note bytes: 1d2. objects on Windows.

   - bpo-22602(173): The UTF-7 decoder now raises *note
     UnicodeDecodeError: ddb. for ill-formed sequences starting with "+"
     (as specified in RFC 2152).  Patch by Zackery Spytz.

   - bpo-2122(174): The *note mmap.flush(): e62. 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(): 1b89. when formatting an error
     message.

   - bpo-18540(177): The *note imaplib.IMAP4: 322. and *note
     imaplib.IMAP4_SSL: cd7. 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(): 940, *note
     assertRaisesRegex(): 942, *note assertWarns(): 2ab. and *note
     assertWarnsRegex(): 2ac. 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__(): 78d. methods of *note
     xml.dom.pulldom.DOMEventStream: b21, *note
     wsgiref.util.FileWrapper: b22. and *note fileinput.FileInput: b23.

   - 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(): 202d. and
     *note dbm.ndbm.open(): 202e. 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(): 120e. 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(): da6. and *note set_name(): da5.) and is visible in the
     *note repr(): 462. output.  An initial name can also be set using
     the new ‘name’ keyword argument to *note asyncio.create_task():
     469. 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: d7.
     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(): 14c4. 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(): 3e9,
     *note sqlite3.Connection.create_function(): 3e8, *note
     sqlite3.Connection.set_authorizer(): 3ea, *note
     sqlite3.Connection.set_progress_handler(): 3eb. 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: 2c. reader
     are now *note bool: 5f6. instances instead of integers 0 or 1.

   - bpo-32788(200): Errors other than *note TypeError: 29c. raised in
     methods ‘__adapt__()’ and ‘__conform__()’ in the *note sqlite3: d7.
     module are now propagated to the user.

   - bpo-21446(201): The ‘reload’ fixer now uses *note
     importlib.reload(): 92d. 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(): 1f3. 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: 6b.

   - 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(): 3e8. 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(): 763. instead of the system clock
     *note time.time(): 764. 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: 102. 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(): f1f,
     *note os.writev(): f22, *note os.preadv(): f1e. and *note
     os.pwritev(): f21. and in *note os.sendfile(): ed7. with 'headers'
     or 'trailers' arguments (on BSD-based OSes and macOS).

   - bpo-25007(226): Add *note copy.copy(): 947. and *note
     copy.deepcopy(): f2f. 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(): df1. uses *note
     os.scandir(): e27. function and all copy functions depending from
     it use cached *note os.stat(): 4fc. 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(): dd6, *note lexists(): dd7, *note
     isdir(): dd8, *note isfile(): dd9, *note islink(): dd4, and *note
     ismount(): dda, and *note pathlib.Path: 4f5. methods that return a
     boolean result like *note exists(): dde, *note is_dir(): 742, *note
     is_file(): 741, *note is_mount(): ddf, *note is_symlink(): de0,
     *note is_block_device(): de1, *note is_char_device(): de2, *note
     is_fifo(): de3, *note is_socket(): de4. now return ‘False’ instead
     of raising *note ValueError: 15a. or its subclasses *note
     UnicodeEncodeError: a6c. and *note UnicodeDecodeError: ddb. for
     paths that contain characters or bytes unrepresentable at the OS
     level.

   - bpo-26544(237): Fixed implementation of *note platform.libc_ver():
     1a21.  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: 29c. instead of
     *note SystemError: 3f1. when performed on *note mmap.mmap: 247.
     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:
     11e. 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(): 9fb. 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(): e21, *note shutil.copy():
     e22, *note shutil.copy2(): e23, *note shutil.copytree(): df1. and
     *note shutil.move(): e24. 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(): 1dd.-based variant
     of *note shutil.copyfileobj(): e25. 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(): f6b. 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(): 8ef. 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:
     d5.

   - 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: 1243. now supports
     the ‘__round__’ magic method.

   - bpo-28612(298): Added support for Site Maps to urllib's
     ‘RobotFileParser’ as *note RobotFileParser.site_maps(): 202f.
     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: 9da. to
     the standard *note dict: 193. 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: e1c.  The
     ‘doctype()’ method defined in a subclass will no longer be called.
     Deprecated methods ‘getchildren()’ and ‘getiterator()’ in the *note
     ElementTree: 12e. module emit now a *note DeprecationWarning: 2d4.
     instead of *note PendingDeprecationWarning: c9f.

   - 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: 72.  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(): 1395. now supports
     iteration over the file contents.  Patch by Tony Flury.

   - bpo-33217(317): Raise *note TypeError: 29c. 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: 37. 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():
     12e0.

   - bpo-27485(323): Rename and deprecate undocumented functions in
     *note urllib.parse(): 113.

   - 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(): 2030. are not included in the
     resulting output.

   - bpo-33329(326): Fix multiprocessing regression on newer glibcs

   - bpo-33334(327): *note dis.stack_effect(): 12e0. now supports all
     defined opcodes including NOP and EXTENDED_ARG.

   - bpo-991266(328): Fix quoting of the ‘Comment’ attribute of *note
     http.cookies.SimpleCookie: 2031.

   - 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(): 70e. and
     ‘importlib.abc.ResourceReader.contents()’ return an *note iterable:
     149a. instead of an *note iterator: 6d4.

   - 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: 4d1. 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:
     19f. 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: 9e0. 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(): 2032.

   - 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(): 736.

   - 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: 83. 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: 11c. 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: f9, ‘after_cancel(None)’ now
     raises a *note ValueError: 15a. 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(): 1a99. 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: 35. database opened with flags
     'r' is now read-only.  *note dbm.dumb.open(): e60. 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: 102.
     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(): 20a. 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: daf.

   - 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:
     6ed, *note date: 494. and *note time: 495. pickled by Python 2.
     ‘encoding='latin1'’ should be used for successful decoding.

   - bpo-27645(434): *note sqlite3.Connection: 3e6. now exposes a *note
     backup: f3d. 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: 2d.  Patch
     by Segev Finer.

   - bpo-31508(436): Removed support of arguments in
     ‘tkinter.ttk.Treeview.selection’.  It was deprecated in 3.6.  Use
     specialized methods like ‘selection_set’ for changing the
     selection.

   - bpo-29456(437): Fix bugs in hangul normalization: u1176, u11a7 and
     u11c3

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35845

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35864

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35537

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35847

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35813

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35780

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35537

   (8) https://bugs.python.org/issue?@action=redirect&bpo=23846

   (9) https://bugs.python.org/issue?@action=redirect&bpo=34323

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35674

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35733

   (12) https://bugs.python.org/issue?@action=redirect&bpo=35726

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35719

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35717

   (15) https://bugs.python.org/issue?@action=redirect&bpo=35699

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32710

   (17) https://bugs.python.org/issue?@action=redirect&bpo=35702

   (18) https://bugs.python.org/issue?@action=redirect&bpo=32710

   (19) https://bugs.python.org/issue?@action=redirect&bpo=35682

   (20) https://bugs.python.org/issue?@action=redirect&bpo=35283

   (21) https://bugs.python.org/issue?@action=redirect&bpo=35664

   (22) https://bugs.python.org/issue?@action=redirect&bpo=35643

   (23) https://bugs.python.org/issue?@action=redirect&bpo=35619

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28503

   (25) https://bugs.python.org/issue?@action=redirect&bpo=35614

   (26) https://bugs.python.org/issue?@action=redirect&bpo=35568

   (27) https://bugs.python.org/issue?@action=redirect&bpo=35588

   (28) https://bugs.python.org/issue?@action=redirect&bpo=35585

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30561

   (30) https://bugs.python.org/issue?@action=redirect&bpo=35537

   (31) https://bugs.python.org/issue?@action=redirect&bpo=35526

   (32) https://bugs.python.org/issue?@action=redirect&bpo=35523

   (33) https://bugs.python.org/issue?@action=redirect&bpo=31784

   (34) https://bugs.python.org/issue?@action=redirect&bpo=35513

   (35) https://bugs.python.org/issue?@action=redirect&bpo=35502

   (36) https://bugs.python.org/issue?@action=redirect&bpo=35348

   (37) https://bugs.python.org/issue?@action=redirect&bpo=35491

   (38) https://bugs.python.org/issue?@action=redirect&bpo=35477

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31446

   (40) https://bugs.python.org/issue?@action=redirect&bpo=35471

   (41) https://bugs.python.org/issue?@action=redirect&bpo=23057

   (42) https://bugs.python.org/issue?@action=redirect&bpo=35052

   (43) https://bugs.python.org/issue?@action=redirect&bpo=20239

   (44) https://bugs.python.org/issue?@action=redirect&bpo=17185

   (45) https://bugs.python.org/issue?@action=redirect&bpo=35445

   (46) https://bugs.python.org/issue?@action=redirect&bpo=35415

   (47) https://bugs.python.org/issue?@action=redirect&bpo=35424

   (48) https://bugs.python.org/issue?@action=redirect&bpo=35330

   (49) https://bugs.python.org/issue?@action=redirect&bpo=35346

   (50) https://bugs.python.org/issue?@action=redirect&bpo=10496

   (51) https://bugs.python.org/issue?@action=redirect&bpo=10496

   (52) https://bugs.python.org/issue?@action=redirect&bpo=35389

   (53) https://bugs.python.org/issue?@action=redirect&bpo=35394

   (54) https://bugs.python.org/issue?@action=redirect&bpo=35310

   (55) https://bugs.python.org/issue?@action=redirect&bpo=35380

   (56) https://bugs.python.org/issue?@action=redirect&bpo=35341

   (57) https://bugs.python.org/issue?@action=redirect&bpo=35371

   (58) https://bugs.python.org/issue?@action=redirect&bpo=35346

   (59) https://bugs.python.org/issue?@action=redirect&bpo=35066

   (60) https://bugs.python.org/issue?@action=redirect&bpo=35345

   (61) https://bugs.python.org/issue?@action=redirect&bpo=35344

   (62) https://bugs.python.org/issue?@action=redirect&bpo=35312

   (63) https://bugs.python.org/issue?@action=redirect&bpo=35308

   (64) https://bugs.python.org/issue?@action=redirect&bpo=24746

   (65) https://bugs.python.org/issue?@action=redirect&bpo=28604

   (66) https://bugs.python.org/issue?@action=redirect&bpo=35277

   (67) https://bugs.python.org/issue?@action=redirect&bpo=24209

   (68) https://bugs.python.org/issue?@action=redirect&bpo=35226

   (69) https://bugs.python.org/issue?@action=redirect&bpo=29564

   (70) https://bugs.python.org/issue?@action=redirect&bpo=35189

   (71) https://bugs.python.org/issue?@action=redirect&bpo=30064

   (72) https://bugs.python.org/issue?@action=redirect&bpo=35186

   (73) https://bugs.python.org/issue?@action=redirect&bpo=35152

   (74) https://bugs.python.org/issue?@action=redirect&bpo=35062

   (75) https://bugs.python.org/issue?@action=redirect&bpo=35065

   (76) https://bugs.python.org/issue?@action=redirect&bpo=34160

   (77) https://bugs.python.org/issue?@action=redirect&bpo=35079

   (78) https://bugs.python.org/issue?@action=redirect&bpo=33710

   (79) https://bugs.python.org/issue?@action=redirect&bpo=35017

   (80) https://bugs.python.org/issue?@action=redirect&bpo=35024

   (81) https://bugs.python.org/issue?@action=redirect&bpo=35047

   (82) https://bugs.python.org/issue?@action=redirect&bpo=31047

   (83) https://bugs.python.org/issue?@action=redirect&bpo=35053

   (84) https://bugs.python.org/issue?@action=redirect&bpo=31553

   (85) https://bugs.python.org/issue?@action=redirect&bpo=34794

   (86) https://bugs.python.org/issue?@action=redirect&bpo=34909

   (87) https://bugs.python.org/issue?@action=redirect&bpo=35022

   (88) https://bugs.python.org/issue?@action=redirect&bpo=35008

   (89) https://bugs.python.org/issue?@action=redirect&bpo=23420

   (90) https://bugs.python.org/issue?@action=redirect&bpo=33947

   (91) https://bugs.python.org/issue?@action=redirect&bpo=34890

   (92) https://bugs.python.org/issue?@action=redirect&bpo=34521

   (93) https://datatracker.ietf.org/doc/html/rfc3542.html

   (94) https://bugs.python.org/issue?@action=redirect&bpo=31522

   (95) https://bugs.python.org/issue?@action=redirect&bpo=34970

   (96) https://bugs.python.org/issue?@action=redirect&bpo=34969

   (97) https://bugs.python.org/issue?@action=redirect&bpo=16965

   (98) https://bugs.python.org/issue?@action=redirect&bpo=34966

   (99) https://bugs.python.org/issue?@action=redirect&bpo=34926

   (100) https://bugs.python.org/issue?@action=redirect&bpo=23831

   (101) https://bugs.python.org/issue?@action=redirect&bpo=34941

   (102) https://bugs.python.org/issue?@action=redirect&bpo=32680

   (103) https://bugs.python.org/issue?@action=redirect&bpo=34769

   (104) https://bugs.python.org/issue?@action=redirect&bpo=34936

   (105) https://bugs.python.org/issue?@action=redirect&bpo=34829

   (106) https://bugs.python.org/issue?@action=redirect&bpo=34911

   (107) https://bugs.python.org/issue?@action=redirect&bpo=34922

   (108) https://bugs.python.org/issue?@action=redirect&bpo=34925

   (109) https://bugs.python.org/issue?@action=redirect&bpo=34900

   (110) https://bugs.python.org/issue?@action=redirect&bpo=34844

   (111) https://bugs.python.org/issue?@action=redirect&bpo=34897

   (112) https://bugs.python.org/issue?@action=redirect&bpo=34871

   (113) https://bugs.python.org/issue?@action=redirect&bpo=34898

   (114) https://bugs.python.org/issue?@action=redirect&bpo=28441

   (115) https://bugs.python.org/issue?@action=redirect&bpo=34866

   (116) https://bugs.python.org/issue?@action=redirect&bpo=34711

   (117) https://bugs.python.org/issue?@action=redirect&bpo=34872

   (118) https://bugs.python.org/issue?@action=redirect&bpo=34849

   (119) https://bugs.python.org/issue?@action=redirect&bpo=34022

   (120) https://bugs.python.org/issue?@action=redirect&bpo=34819

   (121) https://bugs.python.org/issue?@action=redirect&bpo=34758

   (122) https://bugs.python.org/issue?@action=redirect&bpo=34789

   (123) https://bugs.python.org/issue?@action=redirect&bpo=34334

   (124) https://bugs.python.org/issue?@action=redirect&bpo=34687

   (125) https://bugs.python.org/issue?@action=redirect&bpo=5950

   (126) https://bugs.python.org/issue?@action=redirect&bpo=32892

   (127) https://bugs.python.org/issue?@action=redirect&bpo=34728

   (128) https://bugs.python.org/issue?@action=redirect&bpo=34738

   (129) https://bugs.python.org/issue?@action=redirect&bpo=34659

   (130) https://bugs.python.org/issue?@action=redirect&bpo=29577

   (131) https://bugs.python.org/issue?@action=redirect&bpo=34670

   (132) https://bugs.python.org/issue?@action=redirect&bpo=32718

   (133) https://bugs.python.org/issue?@action=redirect&bpo=31177

   (134) https://bugs.python.org/issue?@action=redirect&bpo=34672

   (135) https://bugs.python.org/issue?@action=redirect&bpo=34666

   (136) https://bugs.python.org/issue?@action=redirect&bpo=6721

   (137) https://bugs.python.org/issue?@action=redirect&bpo=34658

   (138) https://bugs.python.org/issue?@action=redirect&bpo=34652

   (139) https://bugs.python.org/issue?@action=redirect&bpo=34638

   (140) https://bugs.python.org/issue?@action=redirect&bpo=34536

   (141) https://bugs.python.org/issue?@action=redirect&bpo=34636

   (142) https://bugs.python.org/issue?@action=redirect&bpo=24412

   (143) https://bugs.python.org/issue?@action=redirect&bpo=34630

   (144) https://bugs.python.org/issue?@action=redirect&bpo=32490

   (145) https://bugs.python.org/issue?@action=redirect&bpo=34363

   (146) https://bugs.python.org/issue?@action=redirect&bpo=34625

   (147) https://bugs.python.org/issue?@action=redirect&bpo=32270

   (148) https://bugs.python.org/issue?@action=redirect&bpo=34622

   (149) https://bugs.python.org/issue?@action=redirect&bpo=34610

   (150) https://bugs.python.org/issue?@action=redirect&bpo=34421

   (151) https://bugs.python.org/issue?@action=redirect&bpo=34604

   (152) https://bugs.python.org/issue?@action=redirect&bpo=30977

   (153) https://bugs.python.org/issue?@action=redirect&bpo=34574

   (154) https://bugs.python.org/issue?@action=redirect&bpo=8110

   (155) https://bugs.python.org/issue?@action=redirect&bpo=34530

   (156) https://bugs.python.org/issue?@action=redirect&bpo=34563

   (157) https://bugs.python.org/issue?@action=redirect&bpo=34558

   (158) https://bugs.python.org/issue?@action=redirect&bpo=34282

   (159) https://bugs.python.org/issue?@action=redirect&bpo=22872

   (160) https://bugs.python.org/issue?@action=redirect&bpo=34515

   (161) https://peps.python.org/pep-3131/

   (162) https://bugs.python.org/issue?@action=redirect&bpo=13312

   (163) https://bugs.python.org/issue?@action=redirect&bpo=34472

   (164) https://bugs.python.org/issue?@action=redirect&bpo=34454

   (165) https://bugs.python.org/issue?@action=redirect&bpo=6700

   (166) https://bugs.python.org/issue?@action=redirect&bpo=34171

   (167) https://bugs.python.org/issue?@action=redirect&bpo=34441

   (168) https://bugs.python.org/issue?@action=redirect&bpo=34427

   (169) https://bugs.python.org/issue?@action=redirect&bpo=34412

   (170) https://bugs.python.org/issue?@action=redirect&bpo=20849

   (171) https://bugs.python.org/issue?@action=redirect&bpo=31715

   (172) https://bugs.python.org/issue?@action=redirect&bpo=34384

   (173) https://bugs.python.org/issue?@action=redirect&bpo=22602

   (174) https://bugs.python.org/issue?@action=redirect&bpo=2122

   (175) https://bugs.python.org/issue?@action=redirect&bpo=34341

   (176) https://bugs.python.org/issue?@action=redirect&bpo=34333

   (177) https://bugs.python.org/issue?@action=redirect&bpo=18540

   (178) https://bugs.python.org/issue?@action=redirect&bpo=26502

   (179) https://bugs.python.org/issue?@action=redirect&bpo=34318

   (180) https://bugs.python.org/issue?@action=redirect&bpo=9372

   (181) https://bugs.python.org/issue?@action=redirect&bpo=33613

   (182) https://bugs.python.org/issue?@action=redirect&bpo=34248

   (183) https://bugs.python.org/issue?@action=redirect&bpo=33089

   (184) https://bugs.python.org/issue?@action=redirect&bpo=34246

   (185) https://bugs.python.org/issue?@action=redirect&bpo=31047

   (186) https://bugs.python.org/issue?@action=redirect&bpo=32321

   (187) https://bugs.python.org/issue?@action=redirect&bpo=34270

   (188) https://bugs.python.org/issue?@action=redirect&bpo=34263

   (189) https://bugs.python.org/issue?@action=redirect&bpo=34035

   (190) https://bugs.python.org/issue?@action=redirect&bpo=32215

   (191) https://bugs.python.org/issue?@action=redirect&bpo=34075

   (192) https://bugs.python.org/issue?@action=redirect&bpo=34251

   (193) https://bugs.python.org/issue?@action=redirect&bpo=19891

   (194) https://bugs.python.org/issue?@action=redirect&bpo=33089

   (195) https://bugs.python.org/issue?@action=redirect&bpo=34228

   (196) https://bugs.python.org/issue?@action=redirect&bpo=13041

   (197) https://bugs.python.org/issue?@action=redirect&bpo=34213

   (198) https://bugs.python.org/issue?@action=redirect&bpo=34052

   (199) https://bugs.python.org/issue?@action=redirect&bpo=34197

   (200) https://bugs.python.org/issue?@action=redirect&bpo=32788

   (201) https://bugs.python.org/issue?@action=redirect&bpo=21446

   (202) https://bugs.python.org/issue?@action=redirect&bpo=940286

   (203) https://bugs.python.org/issue?@action=redirect&bpo=34164

   (204) https://bugs.python.org/issue?@action=redirect&bpo=33729

   (205) https://bugs.python.org/issue?@action=redirect&bpo=34097

   (206) https://bugs.python.org/issue?@action=redirect&bpo=34108

   (207) https://bugs.python.org/issue?@action=redirect&bpo=34070

   (208) https://bugs.python.org/issue?@action=redirect&bpo=27494

   (209) https://bugs.python.org/issue?@action=redirect&bpo=27494

   (210) https://bugs.python.org/issue?@action=redirect&bpo=33967

   (211) https://bugs.python.org/issue?@action=redirect&bpo=34041

   (212) https://bugs.python.org/issue?@action=redirect&bpo=34056

   (213) https://peps.python.org/pep-0552/

   (214) https://bugs.python.org/issue?@action=redirect&bpo=34054

   (215) https://bugs.python.org/issue?@action=redirect&bpo=34043

   (216) https://bugs.python.org/issue?@action=redirect&bpo=34044

   (217) https://bugs.python.org/issue?@action=redirect&bpo=34010

   (218) https://bugs.python.org/issue?@action=redirect&bpo=34019

   (219) https://bugs.python.org/issue?@action=redirect&bpo=34003

   (220) https://bugs.python.org/issue?@action=redirect&bpo=33978

   (221) https://bugs.python.org/issue?@action=redirect&bpo=14117

   (222) https://bugs.python.org/issue?@action=redirect&bpo=33974

   (223) https://bugs.python.org/issue?@action=redirect&bpo=27500

   (224) https://bugs.python.org/issue?@action=redirect&bpo=24567

   (225) https://bugs.python.org/issue?@action=redirect&bpo=33871

   (226) https://bugs.python.org/issue?@action=redirect&bpo=25007

   (227) https://bugs.python.org/issue?@action=redirect&bpo=33929

   (228) https://bugs.python.org/issue?@action=redirect&bpo=33899

   (229) https://bugs.python.org/issue?@action=redirect&bpo=33897

   (230) https://bugs.python.org/issue?@action=redirect&bpo=33695

   (231) https://bugs.python.org/issue?@action=redirect&bpo=33695

   (232) https://bugs.python.org/issue?@action=redirect&bpo=33916

   (233) https://bugs.python.org/issue?@action=redirect&bpo=32568

   (234) https://bugs.python.org/issue?@action=redirect&bpo=33833

   (235) https://bugs.python.org/issue?@action=redirect&bpo=33663

   (236) https://bugs.python.org/issue?@action=redirect&bpo=33721

   (237) https://bugs.python.org/issue?@action=redirect&bpo=26544

   (238) https://bugs.python.org/issue?@action=redirect&bpo=33843

   (239) https://bugs.python.org/issue?@action=redirect&bpo=33842

   (240) https://bugs.python.org/issue?@action=redirect&bpo=30167

   (241) https://bugs.python.org/issue?@action=redirect&bpo=33805

   (242) https://bugs.python.org/issue?@action=redirect&bpo=33687

   (243) https://bugs.python.org/issue?@action=redirect&bpo=33812

   (244) https://bugs.python.org/issue?@action=redirect&bpo=32108

   (245) https://bugs.python.org/issue?@action=redirect&bpo=27397

   (246) https://bugs.python.org/issue?@action=redirect&bpo=33578

   (247) https://bugs.python.org/issue?@action=redirect&bpo=30805

   (248) https://bugs.python.org/issue?@action=redirect&bpo=33476

   (249) https://bugs.python.org/issue?@action=redirect&bpo=33694

   (250) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (251) https://bugs.python.org/issue?@action=redirect&bpo=33792

   (252) https://bugs.python.org/issue?@action=redirect&bpo=33274

   (253) https://bugs.python.org/issue?@action=redirect&bpo=33778

   (254) https://bugs.python.org/issue?@action=redirect&bpo=33165

   (255) https://bugs.python.org/issue?@action=redirect&bpo=33770

   (256) https://bugs.python.org/issue?@action=redirect&bpo=33769

   (257) https://bugs.python.org/issue?@action=redirect&bpo=33767

   (258) https://bugs.python.org/issue?@action=redirect&bpo=33734

   (259) https://bugs.python.org/issue?@action=redirect&bpo=31014

   (260) https://bugs.python.org/issue?@action=redirect&bpo=2504

   (261) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (262) https://bugs.python.org/issue?@action=redirect&bpo=32751

   (263) https://bugs.python.org/issue?@action=redirect&bpo=32684

   (264) https://bugs.python.org/issue?@action=redirect&bpo=33654

   (265) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (266) https://bugs.python.org/issue?@action=redirect&bpo=33671

   (267) https://bugs.python.org/issue?@action=redirect&bpo=25427

   (268) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (269) https://bugs.python.org/issue?@action=redirect&bpo=31647

   (270) https://bugs.python.org/issue?@action=redirect&bpo=32610

   (271) https://bugs.python.org/issue?@action=redirect&bpo=32410

   (272) https://bugs.python.org/issue?@action=redirect&bpo=33469

   (273) https://bugs.python.org/issue?@action=redirect&bpo=33672

   (274) https://bugs.python.org/issue?@action=redirect&bpo=33654

   (275) https://bugs.python.org/issue?@action=redirect&bpo=33652

   (276) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (277) https://bugs.python.org/issue?@action=redirect&bpo=33238

   (278) https://bugs.python.org/issue?@action=redirect&bpo=33618

   (279) https://bugs.python.org/issue?@action=redirect&bpo=33625

   (280) https://bugs.python.org/issue?@action=redirect&bpo=33623

   (281) https://bugs.python.org/issue?@action=redirect&bpo=11874

   (282) https://bugs.python.org/issue?@action=redirect&bpo=30877

   (283) https://bugs.python.org/issue?@action=redirect&bpo=33604

   (284) https://bugs.python.org/issue?@action=redirect&bpo=33582

   (285) https://bugs.python.org/issue?@action=redirect&bpo=21145

   (286) https://bugs.python.org/issue?@action=redirect&bpo=33570

   (287) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (288) https://bugs.python.org/issue?@action=redirect&bpo=12486

   (289) https://bugs.python.org/issue?@action=redirect&bpo=33540

   (290) https://bugs.python.org/issue?@action=redirect&bpo=33548

   (291) https://bugs.python.org/issue?@action=redirect&bpo=33109

   (292) https://bugs.python.org/issue?@action=redirect&bpo=26510

   (293) https://bugs.python.org/issue?@action=redirect&bpo=33541

   (294) https://bugs.python.org/issue?@action=redirect&bpo=33536

   (295) https://bugs.python.org/issue?@action=redirect&bpo=33542

   (296) https://bugs.python.org/issue?@action=redirect&bpo=26819

   (297) https://bugs.python.org/issue?@action=redirect&bpo=33516

   (298) https://bugs.python.org/issue?@action=redirect&bpo=28612

   (299) https://bugs.python.org/issue?@action=redirect&bpo=28167

   (300) https://bugs.python.org/issue?@action=redirect&bpo=33504

   (301) https://bugs.python.org/issue?@action=redirect&bpo=33505

   (302) https://bugs.python.org/issue?@action=redirect&bpo=33497

   (303) https://bugs.python.org/issue?@action=redirect&bpo=29235

   (304) https://bugs.python.org/issue?@action=redirect&bpo=33495

   (305) https://bugs.python.org/issue?@action=redirect&bpo=26103

   (306) https://bugs.python.org/issue?@action=redirect&bpo=29209

   (307) https://bugs.python.org/issue?@action=redirect&bpo=33453

   (308) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (309) https://bugs.python.org/issue?@action=redirect&bpo=33365

   (310) https://bugs.python.org/issue?@action=redirect&bpo=20087

   (311) https://bugs.python.org/issue?@action=redirect&bpo=33422

   (312) https://bugs.python.org/issue?@action=redirect&bpo=28167

   (313) https://bugs.python.org/issue?@action=redirect&bpo=33281

   (314) https://bugs.python.org/issue?@action=redirect&bpo=33311

   (315) https://bugs.python.org/issue?@action=redirect&bpo=27300

   (316) https://bugs.python.org/issue?@action=redirect&bpo=32933

   (317) https://bugs.python.org/issue?@action=redirect&bpo=33217

   (318) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (319) https://bugs.python.org/issue?@action=redirect&bpo=33383

   (320) https://bugs.python.org/issue?@action=redirect&bpo=33375

   (321) https://bugs.python.org/issue?@action=redirect&bpo=33336

   (322) https://bugs.python.org/issue?@action=redirect&bpo=32455

   (323) https://bugs.python.org/issue?@action=redirect&bpo=27485

   (324) https://bugs.python.org/issue?@action=redirect&bpo=33332

   (325) https://bugs.python.org/issue?@action=redirect&bpo=33251

   (326) https://bugs.python.org/issue?@action=redirect&bpo=33329

   (327) https://bugs.python.org/issue?@action=redirect&bpo=33334

   (328) https://bugs.python.org/issue?@action=redirect&bpo=991266

   (329) https://bugs.python.org/issue?@action=redirect&bpo=33131

   (330) https://bugs.python.org/issue?@action=redirect&bpo=33308

   (331) https://bugs.python.org/issue?@action=redirect&bpo=23403

   (332) https://bugs.python.org/issue?@action=redirect&bpo=33266

   (333) https://bugs.python.org/issue?@action=redirect&bpo=11594

   (334) https://bugs.python.org/issue?@action=redirect&bpo=33254

   (335) https://bugs.python.org/issue?@action=redirect&bpo=33265

   (336) https://bugs.python.org/issue?@action=redirect&bpo=33263

   (337) https://bugs.python.org/issue?@action=redirect&bpo=33256

   (338) https://bugs.python.org/issue?@action=redirect&bpo=33144

   (339) https://bugs.python.org/issue?@action=redirect&bpo=33185

   (340) https://bugs.python.org/issue?@action=redirect&bpo=33053

   (341) https://bugs.python.org/issue?@action=redirect&bpo=29613

   (342) https://bugs.python.org/issue?@action=redirect&bpo=33169

   (343) https://bugs.python.org/issue?@action=redirect&bpo=33203

   (344) https://bugs.python.org/issue?@action=redirect&bpo=33224

   (345) https://peps.python.org/pep-0479/

   (346) https://bugs.python.org/issue?@action=redirect&bpo=33209

   (347) https://bugs.python.org/issue?@action=redirect&bpo=32861

   (348) https://bugs.python.org/issue?@action=redirect&bpo=23403

   (349) https://peps.python.org/pep-3154/

   (350) https://bugs.python.org/issue?@action=redirect&bpo=20104

   (351) https://bugs.python.org/issue?@action=redirect&bpo=33106

   (352) https://bugs.python.org/issue?@action=redirect&bpo=33175

   (353) https://bugs.python.org/issue?@action=redirect&bpo=32380

   (354) https://bugs.python.org/issue?@action=redirect&bpo=33141

   (355) https://bugs.python.org/issue?@action=redirect&bpo=33096

   (356) https://bugs.python.org/issue?@action=redirect&bpo=32873

   (357) https://bugs.python.org/issue?@action=redirect&bpo=33134

   (358) https://bugs.python.org/issue?@action=redirect&bpo=33127

   (359) https://bugs.python.org/issue?@action=redirect&bpo=32505

   (360) https://bugs.python.org/issue?@action=redirect&bpo=33078

   (361) https://bugs.python.org/issue?@action=redirect&bpo=33116

   (362) https://bugs.python.org/issue?@action=redirect&bpo=32896

   (363) https://bugs.python.org/issue?@action=redirect&bpo=33100

   (364) https://bugs.python.org/issue?@action=redirect&bpo=32953

   (365) https://bugs.python.org/issue?@action=redirect&bpo=33097

   (366) https://bugs.python.org/issue?@action=redirect&bpo=32968

   (367) https://bugs.python.org/issue?@action=redirect&bpo=33061

   (368) https://bugs.python.org/issue?@action=redirect&bpo=33078

   (369) https://bugs.python.org/issue?@action=redirect&bpo=33064

   (370) https://bugs.python.org/issue?@action=redirect&bpo=33056

   (371) https://bugs.python.org/issue?@action=redirect&bpo=33021

   (372) https://bugs.python.org/issue?@action=redirect&bpo=31804

   (373) https://bugs.python.org/issue?@action=redirect&bpo=33034

   (374) https://bugs.python.org/issue?@action=redirect&bpo=30249

   (375) https://bugs.python.org/issue?@action=redirect&bpo=33037

   (376) https://bugs.python.org/issue?@action=redirect&bpo=27683

   (377) https://bugs.python.org/issue?@action=redirect&bpo=22674

   (378) https://bugs.python.org/issue?@action=redirect&bpo=32999

   (379) https://bugs.python.org/issue?@action=redirect&bpo=33009

   (380) https://bugs.python.org/issue?@action=redirect&bpo=32969

   (381) https://bugs.python.org/issue?@action=redirect&bpo=32056

   (382) https://bugs.python.org/issue?@action=redirect&bpo=32970

   (383) https://bugs.python.org/issue?@action=redirect&bpo=32844

   (384) https://bugs.python.org/issue?@action=redirect&bpo=32960

   (385) https://bugs.python.org/issue?@action=redirect&bpo=32713

   (386) https://bugs.python.org/issue?@action=redirect&bpo=32257

   (387) https://bugs.python.org/issue?@action=redirect&bpo=32951

   (388) https://bugs.python.org/issue?@action=redirect&bpo=32929

   (389) https://bugs.python.org/issue?@action=redirect&bpo=32947

   (390) https://bugs.python.org/issue?@action=redirect&bpo=32146

   (391) https://bugs.python.org/issue?@action=redirect&bpo=30622

   (392) https://bugs.python.org/issue?@action=redirect&bpo=32922

   (393) https://bugs.python.org/issue?@action=redirect&bpo=32759

   (394) https://bugs.python.org/issue?@action=redirect&bpo=32859

   (395) https://bugs.python.org/issue?@action=redirect&bpo=32556

   (396) https://bugs.python.org/issue?@action=redirect&bpo=21060

   (397) https://bugs.python.org/issue?@action=redirect&bpo=32857

   (398) https://bugs.python.org/issue?@action=redirect&bpo=32852

   (399) https://bugs.python.org/issue?@action=redirect&bpo=31333

   (400) https://bugs.python.org/issue?@action=redirect&bpo=32841

   (401) https://bugs.python.org/issue?@action=redirect&bpo=32819

   (402) https://bugs.python.org/issue?@action=redirect&bpo=19675

   (403) https://bugs.python.org/issue?@action=redirect&bpo=32394

   (404) https://bugs.python.org/issue?@action=redirect&bpo=31787

   (405) https://bugs.python.org/issue?@action=redirect&bpo=30157

   (406) https://bugs.python.org/issue?@action=redirect&bpo=30688

   (407) https://bugs.python.org/issue?@action=redirect&bpo=32792

   (408) https://bugs.python.org/issue?@action=redirect&bpo=32775

   (409) https://bugs.python.org/issue?@action=redirect&bpo=32622

   (410) https://bugs.python.org/issue?@action=redirect&bpo=32777

   (411) https://bugs.python.org/issue?@action=redirect&bpo=32647

   (412) https://bugs.python.org/issue?@action=redirect&bpo=32749

   (413) https://bugs.python.org/issue?@action=redirect&bpo=32741

   (414) https://bugs.python.org/issue?@action=redirect&bpo=32691

   (415) https://bugs.python.org/issue?@action=redirect&bpo=32734

   (416) https://bugs.python.org/issue?@action=redirect&bpo=32727

   (417) https://bugs.python.org/issue?@action=redirect&bpo=31453

   (418) https://bugs.python.org/issue?@action=redirect&bpo=24334

   (419) https://bugs.python.org/issue?@action=redirect&bpo=31848

   (420) https://bugs.python.org/issue?@action=redirect&bpo=32585

   (421) https://bugs.python.org/issue?@action=redirect&bpo=32512

   (422) https://bugs.python.org/issue?@action=redirect&bpo=8525

   (423) https://bugs.python.org/issue?@action=redirect&bpo=31639

   (424) https://bugs.python.org/issue?@action=redirect&bpo=29877

   (425) https://bugs.python.org/issue?@action=redirect&bpo=32221

   (426) https://bugs.python.org/issue?@action=redirect&bpo=32147

   (427) https://bugs.python.org/issue?@action=redirect&bpo=30693

   (428) https://bugs.python.org/issue?@action=redirect&bpo=30693

   (429) https://bugs.python.org/issue?@action=redirect&bpo=31680

   (430) https://bugs.python.org/issue?@action=redirect&bpo=31908

   (431) https://bugs.python.org/issue?@action=redirect&bpo=31608

   (432) https://bugs.python.org/issue?@action=redirect&bpo=31425

   (433) https://bugs.python.org/issue?@action=redirect&bpo=22005

   (434) https://bugs.python.org/issue?@action=redirect&bpo=27645

   (435) https://bugs.python.org/issue?@action=redirect&bpo=16865

   (436) https://bugs.python.org/issue?@action=redirect&bpo=31508

   (437) https://bugs.python.org/issue?@action=redirect&bpo=29456


File: python.info,  Node: ドキュメント<56>,  Next: テスト<59>,  Prev: ライブラリ<167>,  Up: Python 3 8 0 alpha 1

1.26.61.4 ドキュメント
......................

   - bpo-21257(1): Document *note http.client.parse_headers(): 2034.

   - 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: 53. 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(): ee0, *note asyncio.start_server(): ee1.
     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: 139. 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: ed. 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: 1b4.

   - bpo-32614(51): Modify RE examples in documentation to use raw
     strings to prevent *note DeprecationWarning: 2d4. 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: d4.
     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: テスト<59>,  Next: ビルド<62>,  Prev: ドキュメント<56>,  Up: Python 3 8 0 alpha 1

1.26.61.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(): 764. with *note
     time.monotonic(): 763. 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: ビルド<62>,  Next: Windows<55>,  Prev: テスト<59>,  Up: Python 3 8 0 alpha 1

1.26.61.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(): 2037.: add a
     function wrapper to always return ‘NULL’.

   - bpo-34245(19): The Python shared library is now installed with
     write permission (mode 0755), which is the standard way of
     installing such libraries.

   - bpo-34121(20): Fix detection of C11 atomic support on clang.

   - bpo-32430(21): Rename Modules/Setup.dist to Modules/Setup, and
     remove the necessity to copy the former manually to the latter when
     updating the local source tree.

   - bpo-30345(22): Add -g to LDFLAGS when compiling with LTO to get
     debug symbols.

   - bpo-5755(23): Move ‘-Wstrict-prototypes’ option to ‘CFLAGS_NODIST’
     from ‘OPT’.  This option emitted annoying warnings when building
     extension modules written in C++.

   - bpo-33614(24): Ensures module definition files for the stable ABI
     on Windows are correctly regenerated.

   - bpo-33648(25): The -with-c-locale-warning configuration flag has
     been removed.  It has had no effect for about a year.

   - bpo-33522(26): Enable CI builds on Visual Studio Team Services at
     ‘https://python.visualstudio.com/cpython’

   - bpo-33512(27): configure's check for "long double" has been
     simplified

   - bpo-33483(28): C compiler is now correctly detected from the
     standard environment variables.  -without-gcc and -with-icc options
     have been removed.

   - bpo-33394(29): Enable the verbose build for extension modules, when
     GNU make is passed macros on the command line.

   - bpo-33393(30): Update config.guess and config.sub files.

   - bpo-33377(31): Add new triplets for mips r6 and riscv variants
     (used in extension suffixes).

   - bpo-32232(32): By default, modules configured in ‘Modules/Setup’
     are no longer built with ‘-DPy_BUILD_CORE’.  Instead, modules that
     specifically need that preprocessor definition include it in their
     individual entries.

   - bpo-33182(33): The embedding tests can once again be built with
     clang 6.0

   - bpo-33163(34): Upgrade pip to 9.0.3 and setuptools to v39.0.1.

   - bpo-33012(35): gcc 8 has added a new warning heuristic to detect
     invalid function casts and a stock python build seems to hit that
     warning quite often.  The most common is the cast of a METH_NOARGS
     function (that uses just one argument) to a PyCFunction.  Fix this
     by adding a dummy argument to all functions that implement
     METH_NOARGS.

   - bpo-32898(36): Fix the python debug build when using COUNT_ALLOCS.

   - bpo-29442(37): Replace optparse with argparse in setup.py

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34691

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35683

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35642

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35550

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35499

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35257

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35351

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35139

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35059

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35011

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28015

   (12) https://bugs.python.org/issue?@action=redirect&bpo=34765

   (13) https://bugs.python.org/issue?@action=redirect&bpo=34585

   (14) https://bugs.python.org/issue?@action=redirect&bpo=34710

   (15) https://bugs.python.org/issue?@action=redirect&bpo=34582

   (16) https://bugs.python.org/issue?@action=redirect&bpo=34081

   (17) https://bugs.python.org/issue?@action=redirect&bpo=34555

   (18) https://bugs.python.org/issue?@action=redirect&bpo=33015

   (19) https://bugs.python.org/issue?@action=redirect&bpo=34245

   (20) https://bugs.python.org/issue?@action=redirect&bpo=34121

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32430

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30345

   (23) https://bugs.python.org/issue?@action=redirect&bpo=5755

   (24) https://bugs.python.org/issue?@action=redirect&bpo=33614

   (25) https://bugs.python.org/issue?@action=redirect&bpo=33648

   (26) https://bugs.python.org/issue?@action=redirect&bpo=33522

   (27) https://bugs.python.org/issue?@action=redirect&bpo=33512

   (28) https://bugs.python.org/issue?@action=redirect&bpo=33483

   (29) https://bugs.python.org/issue?@action=redirect&bpo=33394

   (30) https://bugs.python.org/issue?@action=redirect&bpo=33393

   (31) https://bugs.python.org/issue?@action=redirect&bpo=33377

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32232

   (33) https://bugs.python.org/issue?@action=redirect&bpo=33182

   (34) https://bugs.python.org/issue?@action=redirect&bpo=33163

   (35) https://bugs.python.org/issue?@action=redirect&bpo=33012

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32898

   (37) https://bugs.python.org/issue?@action=redirect&bpo=29442


File: python.info,  Node: Windows<55>,  Next: macOS<43>,  Prev: ビルド<62>,  Up: Python 3 8 0 alpha 1

1.26.61.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: 543. 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(): cf1. 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<43>,  Next: IDLE<38>,  Prev: Windows<55>,  Up: Python 3 8 0 alpha 1

1.26.61.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<35>,  Prev: macOS<43>,  Up: Python 3 8 0 alpha 1

1.26.61.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: 45a.; ‘-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<35>,  Next: C API<58>,  Prev: IDLE<38>,  Up: Python 3 8 0 alpha 1

1.26.61.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<58>,  Prev: Tools/Demos<35>,  Up: Python 3 8 0 alpha 1

1.26.61.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(): 3bb. for empty bytes
     objects.

   - bpo-35322(3): Fix memory leak in *note PyUnicode_EncodeLocale():
     f8c. and *note PyUnicode_EncodeFSDefault(): 203d. on error
     handling.

   - bpo-35059(4): The following C macros have been converted to static
     inline functions: *note Py_INCREF(): 979, *note Py_DECREF(): 97a,
     *note Py_XINCREF(): e2d, *note Py_XDECREF(): b73, *note
     PyObject_INIT(): 1f51, *note PyObject_INIT_VAR(): 1f52.

   - 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(): 10d3.
     (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(): 191f. 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: 3f1. in *note
     PyArg_ParseTupleAndKeywords(): 81e. when the ‘w*’ format unit is
     used for optional parameter.

   - bpo-32455(16): Added *note PyCompile_OpcodeStackEffectWithJump():
     203e.

   - 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():
     203f, *note PySequence_GetItem(): 2040, *note PySequence_SetItem():
     2041. and *note PySequence_DelItem(): 2042. called with a mapping
     and *note PyMapping_Size(): 2043. called with a sequence.

   - bpo-33818(19): *note PyExceptionClass_Name(): e2e. 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(): 2044. and *note
     PyUnicode_AsWideCharString(): c93. 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.26.62 Python 3.7.0 final
--------------------------

'Release date: 2018-06-27'

* Menu:

* ライブラリ: ライブラリ<168>.
* C API: C API<59>.


File: python.info,  Node: ライブラリ<168>,  Next: C API<59>,  Up: Python 3 7 0 final

1.26.62.1 ライブラリ
....................

   - bpo-33851(1): Fix *note ast.get_docstring(): 2047. for a node that
     lacks a docstring.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33851


File: python.info,  Node: C API<59>,  Prev: ライブラリ<168>,  Up: Python 3 7 0 final

1.26.62.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.26.63 Python 3.7.0 release candidate 1
----------------------------------------

'Release date: 2018-06-12'

* Menu:

* Core and Builtins: Core and Builtins<167>.
* ライブラリ: ライブラリ<169>.
* ドキュメント: ドキュメント<57>.
* ビルド: ビルド<63>.
* Windows: Windows<56>.
* IDLE: IDLE<39>.


File: python.info,  Node: Core and Builtins<167>,  Next: ライブラリ<169>,  Up: Python 3 7 0 release candidate 1

1.26.63.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: ライブラリ<169>,  Next: ドキュメント<57>,  Prev: Core and Builtins<167>,  Up: Python 3 7 0 release candidate 1

1.26.63.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: 29c. instead of
     *note SystemError: 3f1. when performed on *note mmap.mmap: 247.
     objects.  Patch by Zackery Spytz.

   - bpo-33734(11): asyncio/ssl: Fix AttributeError, increase default
     handshake timeout

   - bpo-11874(12): Use a better regex when breaking usage into
     wrappable parts.  Avoids bogus assertion errors from custom metavar
     strings.

   - bpo-33582(13): Emit a deprecation warning for inspect.formatargspec

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30167

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33812

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30805

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33694

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33792

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33778

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33770

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33769

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33767

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33734

   (12) https://bugs.python.org/issue?@action=redirect&bpo=11874

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33582


File: python.info,  Node: ドキュメント<57>,  Next: ビルド<63>,  Prev: ライブラリ<169>,  Up: Python 3 7 0 release candidate 1

1.26.63.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(): ee0, *note asyncio.start_server(): ee1.
     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: ビルド<63>,  Next: Windows<56>,  Prev: ドキュメント<57>,  Up: Python 3 7 0 release candidate 1

1.26.63.4 ビルド
................

   - bpo-5755(1): Move ‘-Wstrict-prototypes’ option to ‘CFLAGS_NODIST’
     from ‘OPT’.  This option emitted annoying warnings when building
     extension modules written in C++.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5755


File: python.info,  Node: Windows<56>,  Next: IDLE<39>,  Prev: ビルド<63>,  Up: Python 3 7 0 release candidate 1

1.26.63.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<56>,  Up: Python 3 7 0 release candidate 1

1.26.63.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.26.64 Python 3.7.0 beta 5
---------------------------

'Release date: 2018-05-30'

* Menu:

* Core and Builtins: Core and Builtins<168>.
* ライブラリ: ライブラリ<170>.
* ドキュメント: ドキュメント<58>.
* テスト: テスト<60>.
* ビルド: ビルド<64>.
* macOS: macOS<44>.
* IDLE: IDLE<40>.


File: python.info,  Node: Core and Builtins<168>,  Next: ライブラリ<170>,  Up: Python 3 7 0 beta 5

1.26.64.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: 157f. list.  *note PyGC_Collect(): d5a. 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: ライブラリ<170>,  Next: ドキュメント<58>,  Prev: Core and Builtins<168>,  Up: Python 3 7 0 beta 5

1.26.64.2 ライブラリ
....................

   - bpo-32751(1): When cancelling the task due to a timeout, *note
     asyncio.wait_for(): 9fb. 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(): f6b. 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:
     d5.

   - 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: 2d.  Patch by
     Segev Finer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32751

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32684

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33654

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31647

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32610

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32410

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33469

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33672

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33654

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33652

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (14) https://bugs.python.org/issue?@action=redirect&bpo=33618

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33623

   (16) https://bugs.python.org/issue?@action=redirect&bpo=30877

   (17) https://bugs.python.org/issue?@action=redirect&bpo=33570

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33540

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33548

   (21) https://bugs.python.org/issue?@action=redirect&bpo=33109

   (22) https://bugs.python.org/issue?@action=redirect&bpo=26510

   (23) https://bugs.python.org/issue?@action=redirect&bpo=33536

   (24) https://bugs.python.org/issue?@action=redirect&bpo=33542

   (25) https://bugs.python.org/issue?@action=redirect&bpo=26819

   (26) https://bugs.python.org/issue?@action=redirect&bpo=33505

   (27) https://bugs.python.org/issue?@action=redirect&bpo=33497

   (28) https://bugs.python.org/issue?@action=redirect&bpo=33495

   (29) https://bugs.python.org/issue?@action=redirect&bpo=33453

   (30) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (31) https://bugs.python.org/issue?@action=redirect&bpo=20087

   (32) https://bugs.python.org/issue?@action=redirect&bpo=33422

   (33) https://bugs.python.org/issue?@action=redirect&bpo=28167

   (34) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (35) https://bugs.python.org/issue?@action=redirect&bpo=33263

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32861

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32257

   (38) https://bugs.python.org/issue?@action=redirect&bpo=16865


File: python.info,  Node: ドキュメント<58>,  Next: テスト<60>,  Prev: ライブラリ<170>,  Up: Python 3 7 0 beta 5

1.26.64.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: テスト<60>,  Next: ビルド<64>,  Prev: ドキュメント<58>,  Up: Python 3 7 0 beta 5

1.26.64.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: ビルド<64>,  Next: macOS<44>,  Prev: テスト<60>,  Up: Python 3 7 0 beta 5

1.26.64.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<44>,  Next: IDLE<40>,  Prev: ビルド<64>,  Up: Python 3 7 0 beta 5

1.26.64.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<44>,  Up: Python 3 7 0 beta 5

1.26.64.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.26.65 Python 3.7.0 beta 4
---------------------------

'Release date: 2018-05-02'

* Menu:

* Core and Builtins: Core and Builtins<169>.
* ライブラリ: ライブラリ<171>.
* ドキュメント: ドキュメント<59>.
* テスト: テスト<61>.
* ビルド: ビルド<65>.
* Windows: Windows<57>.
* macOS: macOS<45>.
* IDLE: IDLE<41>.
* Tools/Demos: Tools/Demos<36>.


File: python.info,  Node: Core and Builtins<169>,  Next: ライブラリ<171>,  Up: Python 3 7 0 beta 4

1.26.65.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: ライブラリ<171>,  Next: ドキュメント<59>,  Prev: Core and Builtins<169>,  Up: Python 3 7 0 beta 4

1.26.65.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: 37. 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: 2031.

   - 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(): 70e. and
     ‘importlib.abc.ResourceReader.contents()’ return an *note iterable:
     149a. instead of an *note iterator: 6d4.

   - 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: 4d1. 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: 19f. when necessary, rather than
     adding ‘"."’.

   - bpo-33169(13): Delete entries of ‘None’ in *note
     sys.path_importer_cache: 9e0. 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: 29c. 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(): 2032.

   - bpo-20104(19): Improved error handling and fixed a reference leak
     in *note os.posix_spawn(): 736.

   - bpo-33175(20): In dataclasses, Field.__set_name__ now looks up the
     __set_name__ special method on the class, not the instance, of the
     default value.

   - bpo-33097(21): Raise RuntimeError when ‘executor.submit’ is called
     during interpreter shutdown.

   - bpo-31908(22): Fix output of cover files for ‘trace’ module
     command-line tool.  Previously emitted cover files only when
     ‘--missing’ option was used.  Patch by Michael Selik.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33281

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33383

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33329

   (4) https://bugs.python.org/issue?@action=redirect&bpo=991266

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33131

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33308

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33266

   (8) https://bugs.python.org/issue?@action=redirect&bpo=11594

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33254

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33256

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33185

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33053

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33169

   (14) https://bugs.python.org/issue?@action=redirect&bpo=33217

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33203

   (16) https://bugs.python.org/issue?@action=redirect&bpo=33224

   (17) https://peps.python.org/pep-0479/

   (18) https://bugs.python.org/issue?@action=redirect&bpo=33209

   (19) https://bugs.python.org/issue?@action=redirect&bpo=20104

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33175

   (21) https://bugs.python.org/issue?@action=redirect&bpo=33097

   (22) https://bugs.python.org/issue?@action=redirect&bpo=31908


File: python.info,  Node: ドキュメント<59>,  Next: テスト<61>,  Prev: ライブラリ<171>,  Up: Python 3 7 0 beta 4

1.26.65.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: テスト<61>,  Next: ビルド<65>,  Prev: ドキュメント<59>,  Up: Python 3 7 0 beta 4

1.26.65.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: ビルド<65>,  Next: Windows<57>,  Prev: テスト<61>,  Up: Python 3 7 0 beta 4

1.26.65.5 ビルド
................

   - bpo-33394(1): Enable the verbose build for extension modules, when
     GNU make is passed macros on the command line.

   - bpo-33393(2): Update config.guess and config.sub files.

   - bpo-33377(3): Add new triplets for mips r6 and riscv variants (used
     in extension suffixes).

   - bpo-32232(4): By default, modules configured in ‘Modules/Setup’ are
     no longer built with ‘-DPy_BUILD_CORE’.  Instead, modules that
     specifically need that preprocessor definition include it in their
     individual entries.

   - bpo-33182(5): The embedding tests can once again be built with
     clang 6.0

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33394

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33393

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33377

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32232

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33182


File: python.info,  Node: Windows<57>,  Next: macOS<45>,  Prev: ビルド<65>,  Up: Python 3 7 0 beta 4

1.26.65.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<45>,  Next: IDLE<41>,  Prev: Windows<57>,  Up: Python 3 7 0 beta 4

1.26.65.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<36>,  Prev: macOS<45>,  Up: Python 3 7 0 beta 4

1.26.65.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<36>,  Prev: IDLE<41>,  Up: Python 3 7 0 beta 4

1.26.65.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.26.66 Python 3.7.0 beta 3
---------------------------

'Release date: 2018-03-29'

* Menu:

* セキュリティ: セキュリティ<46>.
* Core and Builtins: Core and Builtins<170>.
* ライブラリ: ライブラリ<172>.
* ドキュメント: ドキュメント<60>.
* テスト: テスト<62>.
* ビルド: ビルド<66>.
* Windows: Windows<58>.
* macOS: macOS<46>.
* IDLE: IDLE<42>.
* Tools/Demos: Tools/Demos<37>.
* C API: C API<60>.


File: python.info,  Node: セキュリティ<46>,  Next: Core and Builtins<170>,  Up: Python 3 7 0 beta 3

1.26.66.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<170>,  Next: ライブラリ<172>,  Prev: セキュリティ<46>,  Up: Python 3 7 0 beta 3

1.26.66.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: ライブラリ<172>,  Next: ドキュメント<60>,  Prev: Core and Builtins<170>,  Up: Python 3 7 0 beta 3

1.26.66.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: 83. 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: 11c. 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: f9, ‘after_cancel(None)’ now
     raises a *note ValueError: 15a. 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: 3e6. now exposes a *note
     backup: f3d. method, if the underlying SQLite library is at version
     3.6.11 or higher.  Patch by Lele Gaifax.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33141

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33096

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32873

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33134

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33127

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32505

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33078

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33116

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32896

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33100

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32953

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33061

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33078

   (14) https://bugs.python.org/issue?@action=redirect&bpo=33064

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33056

   (16) https://bugs.python.org/issue?@action=redirect&bpo=33021

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31804

   (18) https://bugs.python.org/issue?@action=redirect&bpo=33037

   (19) https://bugs.python.org/issue?@action=redirect&bpo=27683

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32999

   (21) https://bugs.python.org/issue?@action=redirect&bpo=33009

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32969

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32056

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32844

   (25) https://bugs.python.org/issue?@action=redirect&bpo=32857

   (26) https://bugs.python.org/issue?@action=redirect&bpo=31639

   (27) https://bugs.python.org/issue?@action=redirect&bpo=27645


File: python.info,  Node: ドキュメント<60>,  Next: テスト<62>,  Prev: ライブラリ<172>,  Up: Python 3 7 0 beta 3

1.26.66.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: 139. 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: テスト<62>,  Next: ビルド<66>,  Prev: ドキュメント<60>,  Up: Python 3 7 0 beta 3

1.26.66.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: ビルド<66>,  Next: Windows<58>,  Prev: テスト<62>,  Up: Python 3 7 0 beta 3

1.26.66.6 ビルド
................

   - bpo-33163(1): Upgrade pip to 9.0.3 and setuptools to v39.0.1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33163


File: python.info,  Node: Windows<58>,  Next: macOS<46>,  Prev: ビルド<66>,  Up: Python 3 7 0 beta 3

1.26.66.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<46>,  Next: IDLE<42>,  Prev: Windows<58>,  Up: Python 3 7 0 beta 3

1.26.66.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<37>,  Prev: macOS<46>,  Up: Python 3 7 0 beta 3

1.26.66.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: 45a.; ‘-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<37>,  Next: C API<60>,  Prev: IDLE<42>,  Up: Python 3 7 0 beta 3

1.26.66.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<60>,  Prev: Tools/Demos<37>,  Up: Python 3 7 0 beta 3

1.26.66.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.26.67 Python 3.7.0 beta 2
---------------------------

'Release date: 2018-02-27'

* Menu:

* セキュリティ: セキュリティ<47>.
* Core and Builtins: Core and Builtins<171>.
* ライブラリ: ライブラリ<173>.
* ドキュメント: ドキュメント<61>.
* テスト: テスト<63>.
* ビルド: ビルド<67>.
* Windows: Windows<59>.
* macOS: macOS<47>.
* IDLE: IDLE<43>.
* Tools/Demos: Tools/Demos<38>.


File: python.info,  Node: セキュリティ<47>,  Next: Core and Builtins<171>,  Up: Python 3 7 0 beta 2

1.26.67.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<171>,  Next: ライブラリ<173>,  Prev: セキュリティ<47>,  Up: Python 3 7 0 beta 2

1.26.67.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: ライブラリ<173>,  Next: ドキュメント<61>,  Prev: Core and Builtins<171>,  Up: Python 3 7 0 beta 2

1.26.67.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: 2d4. 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(): 1a99. 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: 102.
     Patch by Alan D Moore.

   - bpo-32221(32): Various functions returning tuple containing IPv6
     addresses now omit ‘%scope’ part since the same information is
     already encoded in 'scopeid' tuple item.  Especially this speeds up
     ‘socket.recvfrom()’ when it receives multicast packet since useless
     resolving of network interface name is omitted.

   - bpo-30693(33): The TarFile class now recurses directories in a
     reproducible way.

   - bpo-30693(34): The ZipFile class now recurses directories in a
     reproducible way.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32960

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32713

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32951

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32929

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32947

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30622

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32922

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32859

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32556

   (10) https://bugs.python.org/issue?@action=redirect&bpo=25988

   (11) https://bugs.python.org/issue?@action=redirect&bpo=21060

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32852

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31333

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32841

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32819

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32394

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31787

   (18) https://bugs.python.org/issue?@action=redirect&bpo=30157

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32792

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32775

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32622

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32777

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32647

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32741

   (25) https://bugs.python.org/issue?@action=redirect&bpo=32691

   (26) https://bugs.python.org/issue?@action=redirect&bpo=32734

   (27) https://bugs.python.org/issue?@action=redirect&bpo=32727

   (28) https://bugs.python.org/issue?@action=redirect&bpo=31453

   (29) https://bugs.python.org/issue?@action=redirect&bpo=24334

   (30) https://bugs.python.org/issue?@action=redirect&bpo=31848

   (31) https://bugs.python.org/issue?@action=redirect&bpo=32585

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32221

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30693

   (34) https://bugs.python.org/issue?@action=redirect&bpo=30693


File: python.info,  Node: ドキュメント<61>,  Next: テスト<63>,  Prev: ライブラリ<173>,  Up: Python 3 7 0 beta 2

1.26.67.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: ed. documentation.

   - bpo-8722(6): Document ‘__getattr__()’ behavior when property
     ‘get()’ method raises *note AttributeError: 1b4.

   - bpo-32614(7): Modify RE examples in documentation to use raw
     strings to prevent *note DeprecationWarning: 2d4. 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: テスト<63>,  Next: ビルド<67>,  Prev: ドキュメント<61>,  Up: Python 3 7 0 beta 2

1.26.67.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: ビルド<67>,  Next: Windows<59>,  Prev: テスト<63>,  Up: Python 3 7 0 beta 2

1.26.67.6 ビルド
................

   - bpo-32898(1): Fix the python debug build when using COUNT_ALLOCS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32898


File: python.info,  Node: Windows<59>,  Next: macOS<47>,  Prev: ビルド<67>,  Up: Python 3 7 0 beta 2

1.26.67.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(): cf1. 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<47>,  Next: IDLE<43>,  Prev: Windows<59>,  Up: Python 3 7 0 beta 2

1.26.67.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<38>,  Prev: macOS<47>,  Up: Python 3 7 0 beta 2

1.26.67.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<38>,  Prev: IDLE<43>,  Up: Python 3 7 0 beta 2

1.26.67.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.26.68 Python 3.7.0 beta 1
---------------------------

'Release date: 2018-01-30'

* Menu:

* Core and Builtins: Core and Builtins<172>.
* ライブラリ: ライブラリ<174>.
* ドキュメント: ドキュメント<62>.
* テスト: テスト<64>.
* ビルド: ビルド<68>.
* Windows: Windows<60>.
* macOS: macOS<48>.
* C API: C API<61>.


File: python.info,  Node: Core and Builtins<172>,  Next: ライブラリ<174>,  Up: Python 3 7 0 beta 1

1.26.68.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: ライブラリ<174>,  Next: ドキュメント<62>,  Prev: Core and Builtins<172>,  Up: Python 3 7 0 beta 1

1.26.68.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: ea. 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:
     1879. 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():
     ed4. and *note asyncio.StreamWriter.is_closing(): ed5. 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(): 900. did not call __new__ in
     *note datetime.datetime: 6ed. subclasses.

   - bpo-32403(35): Improved speed of *note datetime.date: 494. and
     *note datetime.datetime: 6ed. 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: 7e. 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: fab. 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: 7a5.  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(): fc1. 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():
     a17. method when formatting a number (*note int: 32e, *note float:
     32f, ‘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: ドキュメント<62>,  Next: テスト<64>,  Prev: ライブラリ<174>,  Up: Python 3 7 0 beta 1

1.26.68.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: テスト<64>,  Next: ビルド<68>,  Prev: ドキュメント<62>,  Up: Python 3 7 0 beta 1

1.26.68.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: ビルド<68>,  Next: Windows<60>,  Prev: テスト<64>,  Up: Python 3 7 0 beta 1

1.26.68.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: bb. will always create hash-based ‘.pyc’
     files.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32635

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32598

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32593

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29708


File: python.info,  Node: Windows<60>,  Next: macOS<48>,  Prev: ビルド<68>,  Up: Python 3 7 0 beta 1

1.26.68.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<48>,  Next: C API<61>,  Prev: Windows<60>,  Up: Python 3 7 0 beta 1

1.26.68.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<61>,  Prev: macOS<48>,  Up: Python 3 7 0 beta 1

1.26.68.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.26.69 Python 3.7.0 alpha 4
----------------------------

'Release date: 2018-01-08'

* Menu:

* Core and Builtins: Core and Builtins<173>.
* ライブラリ: ライブラリ<175>.
* ドキュメント: ドキュメント<63>.
* テスト: テスト<65>.
* Windows: Windows<61>.
* Tools/Demos: Tools/Demos<39>.
* C API: C API<62>.


File: python.info,  Node: Core and Builtins<173>,  Next: ライブラリ<175>,  Up: Python 3 7 0 alpha 4

1.26.69.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: 2084. option now turns on hash
     randomization when the *note PYTHONHASHSEED: 1434. 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: ライブラリ<175>,  Next: ドキュメント<63>,  Prev: Core and Builtins<173>,  Up: Python 3 7 0 alpha 4

1.26.69.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: 7e. 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(): 2ae. 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(): 7a7. 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(): a0f, *note
     datetime.time.fromisoformat(): a0e. and *note
     datetime.date.fromisoformat(): a0d. 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: 211. when task arguments or
     results cause pickling or unpickling errors.  This should make sure
     that calls to the ‘ProcessPoolExecutor’ API always eventually
     return.

   - bpo-15216(54): ‘TextIOWrapper.reconfigure()’ supports changing
     'encoding', 'errors', and 'newline'.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32506

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32279

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32278

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32499

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32468

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23749

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32441

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32422

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31721

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32415

   (11) https://bugs.python.org/issue?@action=redirect&bpo=26133

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32363

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32357

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32356

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32355

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32351

   (17) https://bugs.python.org/issue?@action=redirect&bpo=32348

   (18) https://bugs.python.org/issue?@action=redirect&bpo=32331

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32248

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32311

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32327

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32323

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32302

   (24) https://bugs.python.org/issue?@action=redirect&bpo=29711

   (25) https://bugs.python.org/issue?@action=redirect&bpo=32308

   (26) https://bugs.python.org/issue?@action=redirect&bpo=29970

   (27) https://bugs.python.org/issue?@action=redirect&bpo=32314

   (28) https://bugs.python.org/issue?@action=redirect&bpo=17852

   (29) https://bugs.python.org/issue?@action=redirect&bpo=32296

   (30) https://bugs.python.org/issue?@action=redirect&bpo=32250

   (31) https://bugs.python.org/issue?@action=redirect&bpo=32255

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32277

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30050

   (34) https://bugs.python.org/issue?@action=redirect&bpo=29137

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32273

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32272

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32269

   (38) https://bugs.python.org/issue?@action=redirect&bpo=32265

   (39) https://bugs.python.org/issue?@action=redirect&bpo=32253

   (40) https://bugs.python.org/issue?@action=redirect&bpo=22589

   (41) https://bugs.python.org/issue?@action=redirect&bpo=32193

   (42) https://bugs.python.org/issue?@action=redirect&bpo=32206

   (43) https://bugs.python.org/issue?@action=redirect&bpo=32227

   (44) https://bugs.python.org/issue?@action=redirect&bpo=15873

   (45) https://bugs.python.org/issue?@action=redirect&bpo=32199

   (46) https://bugs.python.org/issue?@action=redirect&bpo=32143

   (47) https://bugs.python.org/issue?@action=redirect&bpo=26439

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31993

   (49) https://bugs.python.org/issue?@action=redirect&bpo=27456

   (50) https://bugs.python.org/issue?@action=redirect&bpo=31778

   (51) https://bugs.python.org/issue?@action=redirect&bpo=31802

   (52) https://bugs.python.org/issue?@action=redirect&bpo=30241

   (53) https://bugs.python.org/issue?@action=redirect&bpo=31699

   (54) https://bugs.python.org/issue?@action=redirect&bpo=15216


File: python.info,  Node: ドキュメント<63>,  Next: テスト<65>,  Prev: ライブラリ<175>,  Up: Python 3 7 0 alpha 4

1.26.69.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: テスト<65>,  Next: Windows<61>,  Prev: ドキュメント<63>,  Up: Python 3 7 0 alpha 4

1.26.69.4 テスト
................

   - bpo-32252(1): Fix faulthandler_suppress_crash_report() used to
     prevent core dump files when testing crashes.  getrlimit() returns
     zero on success.

   - bpo-32002(2): Adjust C locale coercion testing for the empty locale
     and POSIX locale cases to more readily adjust to platform dependent
     behaviour.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32252

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32002


File: python.info,  Node: Windows<61>,  Next: Tools/Demos<39>,  Prev: テスト<65>,  Up: Python 3 7 0 alpha 4

1.26.69.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<39>,  Next: C API<62>,  Prev: Windows<61>,  Up: Python 3 7 0 alpha 4

1.26.69.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<62>,  Prev: Tools/Demos<39>,  Up: Python 3 7 0 alpha 4

1.26.69.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.26.70 Python 3.7.0 alpha 3
----------------------------

'Release date: 2017-12-05'

* Menu:

* Core and Builtins: Core and Builtins<174>.
* ライブラリ: ライブラリ<176>.
* ドキュメント: ドキュメント<64>.
* テスト: テスト<66>.
* ビルド: ビルド<69>.
* Windows: Windows<62>.
* macOS: macOS<49>.
* IDLE: IDLE<44>.
* Tools/Demos: Tools/Demos<40>.
* C API: C API<63>.


File: python.info,  Node: Core and Builtins<174>,  Next: ライブラリ<176>,  Up: Python 3 7 0 alpha 3

1.26.70.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: ライブラリ<176>,  Next: ドキュメント<64>,  Prev: Core and Builtins<174>,  Up: Python 3 7 0 alpha 3

1.26.70.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: 208e. flag

   - bpo-32154(9): The ‘asyncio.windows_utils.socketpair()’ function has
     been removed: use directly *note socket.socketpair(): fb9. 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(): ddc. to find the
     ‘~/.netrc’ file in *note netrc.netrc: 1e8f.  If it does not exist,
     *note FileNotFoundError: 24f. 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():
     1da. in the *note RobotFileParser.parse(): 208f. 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: 2d4, *note
     PendingDeprecationWarning: c9f. and *note ImportWarning: 90c.
     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: 7a5, 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:
     2090.  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: f51, *note time.CLOCK_PROF: f52. and *note
     time.CLOCK_UPTIME: f53.

   - 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(): 2091. 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: 719. and *note
     ipaddress.IPv4Network: 718.  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: f7. module: *note
     clock_gettime_ns(): ead, *note clock_settime_ns(): eae, *note
     monotonic_ns(): eaf, *note perf_counter_ns(): eb0, *note
     process_time_ns(): eb1, *note time_ns(): eb2.

   - 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(): 1820.  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: cd4.  Patch by Vitor Pereira.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32214

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27240

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30788

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31831

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32182

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32186

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32101

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32154

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32089

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32107

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23033

   (13) https://bugs.python.org/issue?@action=redirect&bpo=12239

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28334

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32121

   (16) https://bugs.python.org/issue?@action=redirect&bpo=31325

   (17) https://bugs.python.org/issue?@action=redirect&bpo=12382

   (18) https://bugs.python.org/issue?@action=redirect&bpo=19610

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32071

   (20) https://bugs.python.org/issue?@action=redirect&bpo=10049

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28684

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32110

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27535

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32088

   (25) https://bugs.python.org/issue?@action=redirect&bpo=1647489

   (26) https://bugs.python.org/issue?@action=redirect&bpo=25054

   (27) https://bugs.python.org/issue?@action=redirect&bpo=32072

   (28) https://bugs.python.org/issue?@action=redirect&bpo=32069

   (29) https://bugs.python.org/issue?@action=redirect&bpo=32066

   (30) https://bugs.python.org/issue?@action=redirect&bpo=32046

   (31) https://bugs.python.org/issue?@action=redirect&bpo=32018

   (32) https://peps.python.org/pep-0008/

   (33) https://bugs.python.org/issue?@action=redirect&bpo=32025

   (34) https://bugs.python.org/issue?@action=redirect&bpo=32037

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32034

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32015

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32011

   (38) https://bugs.python.org/issue?@action=redirect&bpo=28369

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31976

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31985

   (41) https://bugs.python.org/issue?@action=redirect&bpo=21862

   (42) https://bugs.python.org/issue?@action=redirect&bpo=31970

   (43) https://bugs.python.org/issue?@action=redirect&bpo=31843

   (44) https://bugs.python.org/issue?@action=redirect&bpo=31945

   (45) https://bugs.python.org/issue?@action=redirect&bpo=31943

   (46) https://bugs.python.org/issue?@action=redirect&bpo=9678

   (47) https://bugs.python.org/issue?@action=redirect&bpo=30057

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31933

   (49) https://bugs.python.org/issue?@action=redirect&bpo=21423

   (50) https://bugs.python.org/issue?@action=redirect&bpo=31927

   (51) https://bugs.python.org/issue?@action=redirect&bpo=27666

   (52) https://bugs.python.org/issue?@action=redirect&bpo=31917

   (53) https://bugs.python.org/issue?@action=redirect&bpo=31897

   (54) https://bugs.python.org/issue?@action=redirect&bpo=25720

   (55) https://bugs.python.org/issue?@action=redirect&bpo=31893

   (56) https://bugs.python.org/issue?@action=redirect&bpo=31891

   (57) https://bugs.python.org/issue?@action=redirect&bpo=31884

   (58) https://bugs.python.org/issue?@action=redirect&bpo=28281

   (59) https://bugs.python.org/issue?@action=redirect&bpo=31702

   (60) https://bugs.python.org/issue?@action=redirect&bpo=30639

   (61) https://bugs.python.org/issue?@action=redirect&bpo=30768

   (62) https://peps.python.org/pep-0475/

   (63) https://bugs.python.org/issue?@action=redirect&bpo=31854

   (64) https://bugs.python.org/issue?@action=redirect&bpo=31834

   (65) https://bugs.python.org/issue?@action=redirect&bpo=28292

   (66) https://bugs.python.org/issue?@action=redirect&bpo=28564

   (67) https://bugs.python.org/issue?@action=redirect&bpo=28416

   (68) https://bugs.python.org/issue?@action=redirect&bpo=31653

   (69) https://bugs.python.org/issue?@action=redirect&bpo=28326

   (70) https://bugs.python.org/issue?@action=redirect&bpo=20825

   (71) https://bugs.python.org/issue?@action=redirect&bpo=31827

   (72) https://bugs.python.org/issue?@action=redirect&bpo=31756

   (73) https://bugs.python.org/issue?@action=redirect&bpo=31819

   (74) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (75) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (76) https://bugs.python.org/issue?@action=redirect&bpo=31806

   (77) https://bugs.python.org/issue?@action=redirect&bpo=31803

   (78) https://bugs.python.org/issue?@action=redirect&bpo=31800

   (79) https://bugs.python.org/issue?@action=redirect&bpo=28603

   (80) https://bugs.python.org/issue?@action=redirect&bpo=30541

   (81) https://bugs.python.org/issue?@action=redirect&bpo=31784

   (82) https://peps.python.org/pep-0564/

   (83) https://bugs.python.org/issue?@action=redirect&bpo=30143

   (84) https://bugs.python.org/issue?@action=redirect&bpo=31770

   (85) https://bugs.python.org/issue?@action=redirect&bpo=31764

   (86) https://bugs.python.org/issue?@action=redirect&bpo=31752

   (87) https://bugs.python.org/issue?@action=redirect&bpo=31620

   (88) https://bugs.python.org/issue?@action=redirect&bpo=31690

   (89) https://bugs.python.org/issue?@action=redirect&bpo=30349

   (90) https://bugs.python.org/issue?@action=redirect&bpo=31664

   (91) https://bugs.python.org/issue?@action=redirect&bpo=31632

   (92) https://bugs.python.org/issue?@action=redirect&bpo=15037

   (93) https://bugs.python.org/issue?@action=redirect&bpo=31307

   (94) https://bugs.python.org/issue?@action=redirect&bpo=31334

   (95) https://bugs.python.org/issue?@action=redirect&bpo=31310

   (96) https://bugs.python.org/issue?@action=redirect&bpo=31308

   (97) https://bugs.python.org/issue?@action=redirect&bpo=31245

   (98) https://bugs.python.org/issue?@action=redirect&bpo=30553


File: python.info,  Node: ドキュメント<64>,  Next: テスト<66>,  Prev: ライブラリ<176>,  Up: Python 3 7 0 alpha 3

1.26.70.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: テスト<66>,  Next: ビルド<69>,  Prev: ドキュメント<64>,  Up: Python 3 7 0 alpha 3

1.26.70.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: ビルド<69>,  Next: Windows<62>,  Prev: テスト<66>,  Up: Python 3 7 0 alpha 3

1.26.70.5 ビルド
................

   - bpo-28538(1): Revert the previous changes, the if_nameindex
     structure is defined by Unified Headers.

   - bpo-28762(2): Revert the last commit, the F_LOCK macro is defined
     by Android Unified Headers.

   - bpo-29040(3): Support building Android with Unified Headers.  The
     first NDK release to support Unified Headers is android-ndk-r14.

   - bpo-32059(4): ‘detect_modules()’ in ‘setup.py’ now also searches
     the sysroot paths when cross-compiling.

   - bpo-31957(5): Fixes Windows SDK version detection when building for
     Windows.

   - bpo-31609(6): Fixes quotes in PCbuild/clean.bat

   - bpo-31934(7): Abort the build when building out of a not clean
     source tree.

   - bpo-31926(8): Fixed Argument Clinic sometimes causing compilation
     errors when there was more than one function and/or method in a .c
     file with the same name.

   - bpo-28791(9): Update Windows builds to use SQLite 3.21.0.

   - bpo-28791(10): Update OS X installer to use SQLite 3.21.0.

   - bpo-28643(11): Record profile-opt build progress with stamp files.

   - bpo-31866(12): Finish removing support for AtheOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28538

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28762

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29040

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32059

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31957

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31609

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31934

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31926

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28791

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28791

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28643

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31866


File: python.info,  Node: Windows<62>,  Next: macOS<49>,  Prev: ビルド<69>,  Up: Python 3 7 0 alpha 3

1.26.70.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<49>,  Next: IDLE<44>,  Prev: Windows<62>,  Up: Python 3 7 0 alpha 3

1.26.70.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<40>,  Prev: macOS<49>,  Up: Python 3 7 0 alpha 3

1.26.70.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<40>,  Next: C API<63>,  Prev: IDLE<44>,  Up: Python 3 7 0 alpha 3

1.26.70.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<63>,  Prev: Tools/Demos<40>,  Up: Python 3 7 0 alpha 3

1.26.70.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.26.71 Python 3.7.0 alpha 2
----------------------------

'Release date: 2017-10-16'

* Menu:

* Core and Builtins: Core and Builtins<175>.
* ライブラリ: ライブラリ<177>.
* ドキュメント: ドキュメント<65>.
* ビルド: ビルド<70>.
* IDLE: IDLE<45>.
* C API: C API<64>.


File: python.info,  Node: Core and Builtins<175>,  Next: ライブラリ<177>,  Up: Python 3 7 0 alpha 2

1.26.71.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: ebf. 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: ライブラリ<177>,  Next: ドキュメント<65>,  Prev: Core and Builtins<175>,  Up: Python 3 7 0 alpha 2

1.26.71.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: 211. 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: ドキュメント<65>,  Next: ビルド<70>,  Prev: ライブラリ<177>,  Up: Python 3 7 0 alpha 2

1.26.71.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: ビルド<70>,  Next: IDLE<45>,  Prev: ドキュメント<65>,  Up: Python 3 7 0 alpha 2

1.26.71.4 ビルド
................

   - bpo-31696(1): Improve compiler version information in *note
     sys.version: 6ae. 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<64>,  Prev: ビルド<70>,  Up: Python 3 7 0 alpha 2

1.26.71.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<64>,  Prev: IDLE<45>,  Up: Python 3 7 0 alpha 2

1.26.71.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.26.72 Python 3.7.0 alpha 1
----------------------------

'Release date: 2017-09-19'

* Menu:

* セキュリティ: セキュリティ<48>.
* Core and Builtins: Core and Builtins<176>.
* ライブラリ: ライブラリ<178>.
* ドキュメント: ドキュメント<66>.
* テスト: テスト<67>.
* ビルド: ビルド<71>.
* Windows: Windows<63>.
* IDLE: IDLE<46>.
* Tools/Demos: Tools/Demos<41>.
* C API: C API<65>.


File: python.info,  Node: セキュリティ<48>,  Next: Core and Builtins<176>,  Up: Python 3 7 0 alpha 1

1.26.72.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<176>,  Next: ライブラリ<178>,  Prev: セキュリティ<48>,  Up: Python 3 7 0 alpha 1

1.26.72.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: c5b.

   - 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(): 18b6. function, ‘cProfile’ or ‘profile’ 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: ライブラリ<178>,  Next: ドキュメント<66>,  Prev: Core and Builtins<176>,  Up: Python 3 7 0 alpha 1

1.26.72.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: 1ea.
     instead of *note bytes: 1d2.

   - bpo-29212(79): Fix concurrent.futures.thread.ThreadPoolExecutor
     threads to have a non repr() based thread name by default when no
     thread_name_prefix is supplied.  They will now identify themselves
     as "ThreadPoolExecutor-y_n".

   - bpo-29755(80): Fixed the lgettext() family of functions in the
     gettext module.  They now always return bytes.

   - bpo-30616(81): Functional API of enum allows to create empty enums.
     Patched by Donghee Na

   - bpo-30038(82): Fix race condition between signal delivery and
     wakeup file descriptor.  Patch by Nathaniel Smith.

   - bpo-23894(83): lib2to3 now recognizes ‘rb'...'’ and ‘f'...'’
     strings.

   - bpo-24744(84): pkgutil.walk_packages function now raises ValueError
     if 'path' is a string.  Patch by Sanyam Khurana.

   - bpo-24484(85): Avoid race condition in multiprocessing cleanup.

   - bpo-30589(86): Fix multiprocessing.Process.exitcode to return the
     opposite of the signal number when the process is killed by a
     signal (instead of 255) when using the "forkserver" method.

   - bpo-28994(87): The traceback no longer displayed for SystemExit
     raised in a callback registered by atexit.

   - bpo-30508(88): Don't log exceptions if Task/Future "cancel()"
     method was called.

   - bpo-30645(89): Fix path calculation in ‘imp.load_package()’, fixing
     it for cases when a package is only shipped with bytecodes.  Patch
     by Alexandru Ardelean.

   - bpo-11822(90): The dis.dis() function now is able to disassemble
     nested code objects.

   - bpo-30624(91): selectors does not take KeyboardInterrupt and
     SystemExit into account, leaving a fd in a bad state in case of
     error.  Patch by Giampaolo Rodola'.

   - bpo-30595(92): multiprocessing.Queue.get() with a timeout now polls
     its reader in non-blocking mode if it succeeded to acquire the lock
     but the acquire took longer than the timeout.

   - bpo-28556(93): Updates to typing module: Add generic
     AsyncContextManager, add support for ContextManager on all
     versions.  Original PRs by Jelle Zijlstra and Ivan Levkivskyi

   - bpo-30605(94): re.compile() no longer raises a BytesWarning when
     compiling a bytes instance with misplaced inline modifier.  Patch
     by Roy Williams.

   - bpo-29870(95): Fix ssl sockets leaks when connection is aborted in
     asyncio/ssl implementation.  Patch by Michaël Sghaïer.

   - bpo-29743(96): Closing transport during handshake process leaks
     open socket.  Patch by Nikolay Kim

   - bpo-27585(97): Fix waiter cancellation in asyncio.Lock.  Patch by
     Mathieu Sornay.

   - bpo-30014(98): modify() method of poll(), epoll() and devpoll()
     based classes of selectors module is around 10% faster.  Patch by
     Giampaolo Rodola'.

   - bpo-30418(99): On Windows, subprocess.Popen.communicate() now also
     ignore EINVAL on stdin.write() if the child process is still
     running but closed the pipe.

   - bpo-30463(100): Added empty __slots__ to abc.ABC. This allows
     subclassers to deny __dict__ and __weakref__ creation.  Patch by
     Aaron Hall.

   - bpo-30520(101): Loggers are now pickleable.

   - bpo-30557(102): faulthandler now correctly filters and displays
     exception codes on Windows

   - bpo-30526(103): Add TextIOWrapper.reconfigure() and a
     TextIOWrapper.write_through attribute.

   - bpo-30245(104): Fix possible overflow when organize
     struct.pack_into error message.  Patch by Yuan Liu.

   - bpo-30378(105): Fix the problem that logging.handlers.SysLogHandler
     cannot handle IPv6 addresses.

   - bpo-16500(106): Allow registering at-fork handlers.

   - bpo-30470(107): Deprecate invalid ctypes call protection on
     Windows.  Patch by Mariatta Wijaya.

   - bpo-30414(108): multiprocessing.Queue._feed background running
     thread do not break from main loop on exception.

   - bpo-30003(109): Fix handling escape characters in HZ codec.  Based
     on patch by Ma Lin.

   - bpo-30149(110): inspect.signature() now supports callables with
     variable-argument parameters wrapped with partialmethod.  Patch by
     Donghee Na.

   - bpo-30436(111): importlib.find_spec() raises ModuleNotFoundError
     instead of AttributeError if the specified parent module is not a
     package (i.e.  lacks a __path__ attribute).

   - bpo-30301(112): Fix AttributeError when using SimpleQueue.empty()
     under 'spawn' and 'forkserver' start methods.

   - bpo-30375(113): Warnings emitted when compile a regular expression
     now always point to the line in the user code.  Previously they
     could point into inners of the re module if emitted from inside of
     groups or conditionals.

   - bpo-30329(114): imaplib and poplib now catch the Windows socket
     WSAEINVAL error (code 10022) on shutdown(SHUT_RDWR): An invalid
     operation was attempted.  This error occurs sometimes on SSL
     connections.

   - bpo-29196(115): Removed previously deprecated in Python 2.4 classes
     Plist, Dict and _InternalDict in the plistlib module.  Dict values
     in the result of functions readPlist() and readPlistFromBytes() are
     now normal dicts.  You no longer can use attribute access to access
     items of these dictionaries.

   - bpo-9850(116): The ‘macpath’ is now deprecated and will be removed
     in Python 3.8.

   - bpo-30299(117): Compiling regular expression in debug mode on
     CPython now displays the compiled bytecode in human readable form.

   - bpo-30048(118): Fixed ‘Task.cancel()’ can be ignored when the task
     is running coroutine and the coroutine returned without any more
     ‘await’.

   - bpo-30266(119): contextlib.AbstractContextManager now supports
     anti-registration by setting __enter__ = None or __exit__ = None,
     following the pattern introduced in bpo-25958(120).  Patch by Jelle
     Zijlstra.

   - bpo-30340(121): Enhanced regular expressions optimization.  This
     increased the performance of matching some patterns up to 25 times.

   - bpo-30298(122): Weaken the condition of deprecation warnings for
     inline modifiers.  Now allowed several subsequential inline
     modifiers at the start of the pattern (e.g.  ‘'(?i)(?s)...'’).  In
     verbose mode whitespaces and comments now are allowed before and
     between inline modifiers (e.g.  ‘'(?x) (?i) (?s)...'’).

   - bpo-30285(123): Optimized case-insensitive matching and searching
     of regular expressions.

   - bpo-29990(124): Fix range checking in GB18030 decoder.  Original
     patch by Ma Lin.

   - bpo-29979(125): rewrite cgi.parse_multipart, reusing the
     FieldStorage class and making its results consistent with those of
     FieldStorage for multipart/form-data requests.  Patch by Pierre
     Quentel.

   - bpo-30243(126): Removed the __init__ methods of _json's scanner and
     encoder.  Misusing them could cause memory leaks or crashes.  Now
     scanner and encoder objects are completely initialized in the
     __new__ methods.

   - bpo-30215(127): Compiled regular expression objects with the
     re.LOCALE flag no longer depend on the locale at compile time.
     Only the locale at matching time affects the result of matching.

   - bpo-30185(128): Avoid KeyboardInterrupt tracebacks in forkserver
     helper process when Ctrl-C is received.

   - bpo-30103(129): binascii.b2a_uu() and uu.encode() now support using
     ‘'`'’ as zero instead of space.

   - bpo-28556(130): Various updates to typing module: add
     typing.NoReturn type, use WrapperDescriptorType, minor bug-fixes.
     Original PRs by Jim Fasarakis-Hilliard and Ivan Levkivskyi.

   - bpo-30205(131): Fix getsockname() for unbound AF_UNIX sockets on
     Linux.

   - bpo-30228(132): The seek() and tell() methods of io.FileIO now set
     the internal seekable attribute to avoid one syscall on open() (in
     buffered or text mode).

   - bpo-30190(133): unittest's assertAlmostEqual and
     assertNotAlmostEqual provide a better message in case of failure
     which includes the difference between left and right arguments.
     (patch by Giampaolo Rodola')

   - bpo-30101(134): Add support for curses.A_ITALIC.

   - bpo-29822(135): inspect.isabstract() now works during
     __init_subclass__.  Patch by Nate Soares.

   - bpo-29960(136): Preserve generator state when
     _random.Random.setstate() raises an exception.  Patch by Bryan
     Olson.

   - bpo-30070(137): Fixed leaks and crashes in errors handling in the
     parser module.

   - bpo-22352(138): Column widths in the output of dis.dis() are now
     adjusted for large line numbers and instruction offsets.

   - bpo-30061(139): Fixed crashes in IOBase methods __next__() and
     readlines() when readline() or __next__() respectively return
     non-sizeable object.  Fixed possible other errors caused by not
     checking results of PyObject_Size(), PySequence_Size(), or
     PyMapping_Size().

   - bpo-30218(140): Fix PathLike support for shutil.unpack_archive.
     Patch by Jelle Zijlstra.

   - bpo-10076(141): Compiled regular expression and match objects in
     the re module now support copy.copy() and copy.deepcopy() (they are
     considered atomic).

   - bpo-30068(142): _io._IOBase.readlines will check if it's closed
     first when hint is present.

   - bpo-29694(143): Fixed race condition in pathlib mkdir with flags
     parents=True.  Patch by Armin Rigo.

   - bpo-29692(144): Fixed arbitrary unchaining of RuntimeError
     exceptions in contextlib.contextmanager.  Patch by Siddharth
     Velankar.

   - bpo-26187(145): Test that sqlite3 trace callback is not called
     multiple times when schema is changing.  Indirectly fixed by
     switching to use sqlite3_prepare_v2() in bpo-9303(146).  Patch by
     Aviv Palivoda.

   - bpo-30017(147): Allowed calling the close() method of the zip entry
     writer object multiple times.  Writing to a closed writer now
     always produces a ValueError.

   - bpo-29998(148): Pickling and copying ImportError now preserves name
     and path attributes.

   - bpo-29995(149): re.escape() now escapes only regex special
     characters.

   - bpo-29962(150): Add math.remainder operation, implementing
     remainder as specified in IEEE 754.

   - bpo-29649(151): Improve struct.pack_into() exception messages for
     problems with the buffer size and offset.  Patch by Andrew Nester.

   - bpo-29654(152): Support If-Modified-Since HTTP header (browser
     cache).  Patch by Pierre Quentel.

   - bpo-29931(153): Fixed comparison check for ipaddress.ip_interface
     objects.  Patch by Sanjay Sundaresan.

   - bpo-29953(154): Fixed memory leaks in the replace() method of
     datetime and time objects when pass out of bound fold argument.

   - bpo-29942(155): Fix a crash in itertools.chain.from_iterable when
     encountering long runs of empty iterables.

   - bpo-10030(156): Sped up reading encrypted ZIP files by 2 times.

   - bpo-29204(157): Element.getiterator() and the html parameter of
     XMLParser() were deprecated only in the documentation (since Python
     3.2 and 3.4 correspondingly).  Now using them emits a deprecation
     warning.

   - bpo-27863(158): Fixed multiple crashes in ElementTree caused by
     race conditions and wrong types.

   - bpo-25996(159): Added support of file descriptors in os.scandir()
     on Unix.  os.fwalk() is sped up by 2 times by using os.scandir().

   - bpo-28699(160): Fixed a bug in pools in multiprocessing.pool that
     raising an exception at the very first of an iterable may swallow
     the exception or make the program hang.  Patch by Davin Potts and
     Xiang Zhang.

   - bpo-23890(161): unittest.TestCase.assertRaises() now manually
     breaks a reference cycle to not keep objects alive longer than
     expected.

   - bpo-29901(162): The zipapp module now supports general path-like
     objects, not just pathlib.Path.

   - bpo-25803(163): Avoid incorrect errors raised by
     Path.mkdir(exist_ok=True) when the OS gives priority to errors such
     as EACCES over EEXIST.

   - bpo-29861(164): Release references to tasks, their arguments and
     their results as soon as they are finished in multiprocessing.Pool.

   - bpo-19930(165): The mode argument of os.makedirs() no longer
     affects the file permission bits of newly created
     intermediate-level directories.

   - bpo-29884(166): faulthandler: Restore the old sigaltstack during
     teardown.  Patch by Christophe Zeitouny.

   - bpo-25455(167): Fixed crashes in repr of recursive buffered
     file-like objects.

   - bpo-29800(168): Fix crashes in partial.__repr__ if the keys of
     partial.keywords are not strings.  Patch by Michael Seifert.

   - bpo-8256(169): Fixed possible failing or crashing input() if
     attributes "encoding" or "errors" of sys.stdin or sys.stdout are
     not set or are not strings.

   - bpo-28692(170): Using non-integer value for selecting a plural form
     in gettext is now deprecated.

   - bpo-26121(171): Use C library implementation for math functions
     erf() and erfc().

   - bpo-29619(172): os.stat() and os.DirEntry.inode() now convert inode
     (st_ino) using unsigned integers.

   - bpo-28298(173): Fix a bug that prevented array 'Q', 'L' and 'I'
     from accepting big intables (objects that have __int__) as
     elements.

   - bpo-29645(174): Speed up importing the webbrowser module.
     webbrowser.register() is now thread-safe.

   - bpo-28231(175): The zipfile module now accepts path-like objects
     for external paths.

   - bpo-26915(176): index() and count() methods of
     collections.abc.Sequence now check identity before checking
     equality when do comparisons.

   - bpo-28682(177): Added support for bytes paths in os.fwalk().

   - bpo-29728(178): Add new ‘socket.TCP_NOTSENT_LOWAT’ (Linux 3.12)
     constant.  Patch by Nathaniel J. Smith.

   - bpo-29623(179): Allow use of path-like object as a single argument
     in ConfigParser.read().  Patch by David Ellis.

   - bpo-9303(180): Migrate sqlite3 module to _v2 API. Patch by Aviv
     Palivoda.

   - bpo-28963(181): Fix out of bound iteration in
     asyncio.Future.remove_done_callback implemented in C.

   - bpo-29704(182): asyncio.subprocess.SubprocessStreamProtocol no
     longer closes before all pipes are closed.

   - bpo-29271(183): Fix Task.current_task and Task.all_tasks
     implemented in C to accept None argument as their pure Python
     implementation.

   - bpo-29703(184): Fix asyncio to support instantiation of new event
     loops in child processes.

   - bpo-29615(185): SimpleXMLRPCDispatcher no longer chains KeyError
     (or any other exception) to exception(s) raised in the dispatched
     methods.  Patch by Petr Motejlek.

   - bpo-7769(186): Method register_function() of
     xmlrpc.server.SimpleXMLRPCDispatcher and its subclasses can now be
     used as a decorator.

   - bpo-29376(187): Fix assertion error in
     threading._DummyThread.is_alive().

   - bpo-28624(188): Add a test that checks that cwd parameter of
     Popen() accepts PathLike objects.  Patch by Sayan Chowdhury.

   - bpo-28518(189): Start a transaction implicitly before a DML
     statement.  Patch by Aviv Palivoda.

   - bpo-29742(190): get_extra_info() raises exception if get called on
     closed ssl transport.  Patch by Nikolay Kim.

   - bpo-16285(191): urllib.parse.quote is now based on RFC 3986 and
     hence includes '~' in the set of characters that is not quoted by
     default.  Patch by Christian Theune and Ratnadeep Debnath.

   - bpo-29532(192): Altering a kwarg dictionary passed to
     functools.partial() no longer affects a partial object after
     creation.

   - bpo-29110(193): Fix file object leak in aifc.open() when file is
     given as a filesystem path and is not in valid AIFF format.  Patch
     by Anthony Zhang.

   - bpo-22807(194): Add uuid.SafeUUID and uuid.UUID.is_safe to relay
     information from the platform about whether generated UUIDs are
     generated with a multiprocessing safe method.

   - bpo-29576(195): Improve some deprecations in importlib.  Some
     deprecated methods now emit DeprecationWarnings and have better
     descriptive messages.

   - bpo-29534(196): Fixed different behaviour of Decimal.from_float()
     for _decimal and _pydecimal.  Thanks Andrew Nester.

   - bpo-10379(197): locale.format_string now supports the 'monetary'
     keyword argument, and locale.format is deprecated.

   - bpo-29851(198): importlib.reload() now raises ModuleNotFoundError
     if the module lacks a spec.

   - bpo-28556(199): Various updates to typing module: typing.Counter,
     typing.ChainMap, improved ABC caching, etc.  Original PRs by Jelle
     Zijlstra, Ivan Levkivskyi, Manuel Krebber, and Łukasz Langa.

   - bpo-29100(200): Fix datetime.fromtimestamp() regression introduced
     in Python 3.6.0: check minimum and maximum years.

   - bpo-29416(201): Prevent infinite loop in pathlib.Path.mkdir

   - bpo-29444(202): Fixed out-of-bounds buffer access in the group()
     method of the match object.  Based on patch by WGH.

   - bpo-29377(203): Add WrapperDescriptorType, MethodWrapperType, and
     MethodDescriptorType built-in types to types module.  Original
     patch by Manuel Krebber.

   - bpo-29218(204): Unused install_misc command is now removed.  It has
     been documented as unused since 2000.  Patch by Eric N. Vander
     Weele.

   - bpo-29368(205): The extend() method is now called instead of the
     append() method when unpickle collections.deque and other list-like
     objects.  This can speed up unpickling to 2 times.

   - bpo-29338(206): The help of a builtin or extension class now
     includes the constructor signature if __text_signature__ is
     provided for the class.

   - bpo-29335(207): Fix subprocess.Popen.wait() when the child process
     has exited to a stopped instead of terminated state (ex: when under
     ptrace).

   - bpo-29290(208): Fix a regression in argparse that help messages
     would wrap at non-breaking spaces.

   - bpo-28735(209): Fixed the comparison of mock.MagickMock with
     mock.ANY.

   - bpo-29197(210): Removed deprecated function ntpath.splitunc().

   - bpo-29210(211): Removed support of deprecated argument "exclude" in
     tarfile.TarFile.add().

   - bpo-29219(212): Fixed infinite recursion in the repr of
     uninitialized ctypes.CDLL instances.

   - bpo-29192(213): Removed deprecated features in the http.cookies
     module.

   - bpo-29193(214): A format string argument for
     string.Formatter.format() is now positional-only.

   - bpo-29195(215): Removed support of deprecated undocumented keyword
     arguments in methods of regular expression objects.

   - bpo-28969(216): Fixed race condition in C implementation of
     functools.lru_cache.  KeyError could be raised when cached function
     with full cache was simultaneously called from different threads
     with the same uncached arguments.

   - bpo-20804(217): The unittest.mock.sentinel attributes now preserve
     their identity when they are copied or pickled.

   - bpo-29142(218): In urllib.request, suffixes in no_proxy environment
     variable with leading dots could match related hostnames again
     (e.g.  .b.c matches a.b.c).  Patch by Milan Oberkirch.

   - bpo-28961(219): Fix unittest.mock._Call helper: don't ignore the
     name parameter anymore.  Patch written by Jiajun Huang.

   - bpo-15812(220): inspect.getframeinfo() now correctly shows the
     first line of a context.  Patch by Sam Breese.

   - bpo-28985(221): Update authorizer constants in sqlite3 module.
     Patch by Dingyuan Wang.

   - bpo-29079(222): Prevent infinite loop in pathlib.resolve() on
     Windows

   - bpo-13051(223): Fixed recursion errors in large or resized
     curses.textpad.Textbox.  Based on patch by Tycho Andersen.

   - bpo-9770(224): curses.ascii predicates now work correctly with
     negative integers.

   - bpo-28427(225): old keys should not remove new values from
     WeakValueDictionary when collecting from another thread.

   - bpo-28923(226): Remove editor artifacts from Tix.py.

   - bpo-28871(227): Fixed a crash when deallocate deep ElementTree.

   - bpo-19542(228): Fix bugs in WeakValueDictionary.setdefault() and
     WeakValueDictionary.pop() when a GC collection happens in another
     thread.

   - bpo-20191(229): Fixed a crash in resource.prlimit() when passing a
     sequence that doesn't own its elements as limits.

   - bpo-16255(230): subprocess.Popen uses /system/bin/sh on Android as
     the shell, instead of /bin/sh.

   - bpo-28779(231): multiprocessing.set_forkserver_preload() would
     crash the forkserver process if a preloaded module instantiated
     some multiprocessing objects such as locks.

   - bpo-26937(232): The chown() method of the tarfile.TarFile class
     does not fail now when the grp module cannot be imported, as for
     example on Android platforms.

   - bpo-28847(233): dbm.dumb now supports reading read-only files and
     no longer writes the index file when it is not changed.  A
     deprecation warning is now emitted if the index file is missed and
     recreated in the 'r' and 'w' modes (will be an error in future
     Python releases).

   - bpo-27030(234): Unknown escapes consisting of ‘'\'’ and an ASCII
     letter in re.sub() replacement templates regular expressions now
     are errors.

   - bpo-28835(235): Fix a regression introduced in
     warnings.catch_warnings(): call warnings.showwarning() if it was
     overridden inside the context manager.

   - bpo-27172(236): To assist with upgrades from 2.7, the previously
     documented deprecation of ‘inspect.getfullargspec()’ has been
     reversed.  This decision may be revisited again after the Python
     2.7 branch is no longer officially supported.

   - bpo-28740(237): Add sys.getandroidapilevel(): return the build time
     API version of Android as an integer.  Function only available on
     Android.

   - bpo-26273(238): Add new ‘socket.TCP_CONGESTION’ (Linux 2.6.13) and
     ‘socket.TCP_USER_TIMEOUT’ (Linux 2.6.37) constants.  Patch written
     by Omar Sandoval.

   - bpo-28752(239): Restored the __reduce__() methods of datetime
     objects.

   - bpo-28727(240): Regular expression patterns, _sre.SRE_Pattern
     objects created by re.compile(), become comparable (only x==y and
     x!=y operators).  This change should fix the bpo-18383(241): don't
     duplicate warning filters when the warnings module is reloaded
     (thing usually only done in unit tests).

   - bpo-20572(242): Remove the subprocess.Popen.wait endtime parameter.
     It was deprecated in 3.4 and undocumented prior to that.

   - bpo-25659(243): In ctypes, prevent a crash calling the
     from_buffer() and from_buffer_copy() methods on abstract classes
     like Array.

   - bpo-28548(244): In the "http.server" module, parse the protocol
     version if possible, to avoid using HTTP 0.9 in some error
     responses.

   - bpo-19717(245): Makes Path.resolve() succeed on paths that do not
     exist.  Patch by Vajrasky Kok

   - bpo-28563(246): Fixed possible DoS and arbitrary code execution
     when handle plural form selections in the gettext module.  The
     expression parser now supports exact syntax supported by GNU
     gettext.

   - bpo-28387(247): Fixed possible crash in _io.TextIOWrapper
     deallocator when the garbage collector is invoked in other thread.
     Based on patch by Sebastian Cufre.

   - bpo-27517(248): LZMA compressor and decompressor no longer raise
     exceptions if given empty data twice.  Patch by Benjamin Fogle.

   - bpo-28549(249): Fixed segfault in curses's addch() with ncurses6.

   - bpo-28449(250): tarfile.open() with mode "r" or "r:" now tries to
     open a tar file with compression before trying to open it without
     compression.  Otherwise it had 50% chance failed with
     ignore_zeros=True.

   - bpo-23262(251): The webbrowser module now supports Firefox 36+ and
     derived browsers.  Based on patch by Oleg Broytman.

   - bpo-24241(252): The webbrowser in an X environment now prefers
     using the default browser directly.  Also, the webbrowser
     register() function now has a documented 'preferred' argument, to
     specify browsers to be returned by get() with no arguments.  Patch
     by David Steele

   - bpo-27939(253): Fixed bugs in tkinter.ttk.LabeledScale and
     tkinter.Scale caused by representing the scale as float value
     internally in Tk.  tkinter.IntVar now works if float value is set
     to underlying Tk variable.

   - bpo-28255(254): calendar.TextCalendar.prweek() no longer prints a
     space after a weeks's calendar.  calendar.TextCalendar.pryear() no
     longer prints redundant newline after a year's calendar.  Based on
     patch by Xiang Zhang.

   - bpo-28255(255): calendar.TextCalendar.prmonth() no longer prints a
     space at the start of new line after printing a month's calendar.
     Patch by Xiang Zhang.

   - bpo-20491(256): The textwrap.TextWrapper class now honors
     non-breaking spaces.  Based on patch by Kaarle Ritvanen.

   - bpo-28353(257): os.fwalk() no longer fails on broken links.

   - bpo-28430(258): Fix iterator of C implemented asyncio.Future
     doesn't accept non-None value is passed to it.send(val).

   - bpo-27025(259): Generated names for Tkinter widgets now start by
     the "!"  prefix for readability.

   - bpo-25464(260): Fixed HList.header_exists() in tkinter.tix module
     by addin a workaround to Tix library bug.

   - bpo-28488(261): shutil.make_archive() no longer adds entry "./" to
     ZIP archive.

   - bpo-25953(262): re.sub() now raises an error for invalid numerical
     group reference in replacement template even if the pattern is not
     found in the string.  Error message for invalid group reference now
     includes the group index and the position of the reference.  Based
     on patch by SilentGhost.

   - bpo-28469(263): timeit now uses the sequence 1, 2, 5, 10, 20,
     50,...  instead of 1, 10, 100,...  for autoranging.

   - bpo-28115(264): Command-line interface of the zipfile module now
     uses argparse.  Added support of long options.

   - bpo-18219(265): Optimize csv.DictWriter for large number of
     columns.  Patch by Mariatta Wijaya.

   - bpo-28448(266): Fix C implemented asyncio.Future didn't work on
     Windows.

   - bpo-23214(267): In the "io" module, the argument to BufferedReader
     and BytesIO's read1() methods is now optional and can be -1,
     matching the BufferedIOBase specification.

   - bpo-28480(268): Fix error building socket module when
     multithreading is disabled.

   - bpo-28240(269): timeit: remove ‘-c/--clock’ and ‘-t/--time’ command
     line options which were deprecated since Python 3.3.

   - bpo-28240(270): timeit now repeats the benchmarks 5 times instead
     of only 3 to make benchmarks more reliable.

   - bpo-28240(271): timeit autorange now uses a single loop iteration
     if the benchmark takes less than 10 seconds, instead of 10
     iterations.  "python3 -m timeit -s 'import time' 'time.sleep(1)'"
     now takes 4 seconds instead of 40 seconds.

   - Distutils.sdist now looks for README and setup.py files with case
     sensitivity.  This behavior matches that found in Setuptools 6.0
     and later.  See setuptools 100(272) for rationale.

   - bpo-24452(273): Make webbrowser support Chrome on Mac OS X. Patch
     by Ned Batchelder.

   - bpo-20766(274): Fix references leaked by pdb in the handling of
     SIGINT handlers.

   - bpo-27998(275): Fixed bytes path support in os.scandir() on
     Windows.  Patch by Eryk Sun.

   - bpo-28317(276): The disassembler now decodes FORMAT_VALUE argument.

   - bpo-28380(277): unittest.mock Mock autospec functions now properly
     support assert_called, assert_not_called, and assert_called_once.

   - bpo-28229(278): lzma module now supports pathlib.

   - bpo-28321(279): Fixed writing non-BMP characters with binary format
     in plistlib.

   - bpo-28225(280): bz2 module now supports pathlib.  Initial patch by
     Ethan Furman.

   - bpo-28227(281): gzip now supports pathlib.  Patch by Ethan Furman.

   - bpo-28332(282): Deprecated silent truncations in socket.htons and
     socket.ntohs.  Original patch by Oren Milman.

   - bpo-27358(283): Optimized merging var-keyword arguments and
     improved error message when passing a non-mapping as a var-keyword
     argument.

   - bpo-28257(284): Improved error message when passing a non-iterable
     as a var-positional argument.  Added opcode
     BUILD_TUPLE_UNPACK_WITH_CALL.

   - bpo-28322(285): Fixed possible crashes when unpickle itertools
     objects from incorrect pickle data.  Based on patch by John Leitch.

   - bpo-28228(286): imghdr now supports pathlib.

   - bpo-28226(287): compileall now supports pathlib.

   - bpo-28314(288): Fix function declaration (C flags) for the
     getiterator() method of xml.etree.ElementTree.Element.

   - bpo-28148(289): Stop using localtime() and gmtime() in the time
     module.  Introduced platform independent _PyTime_localtime API that
     is similar to POSIX localtime_r, but available on all platforms.
     Patch by Ed Schouten.

   - bpo-28253(290): Fixed calendar functions for extreme months:
     0001-01 and 9999-12.  Methods itermonthdays() and itermonthdays2()
     are reimplemented so that they don't call itermonthdates() which
     can cause datetime.date under/overflow.

   - bpo-28275(291): Fixed possible use after free in the decompress()
     methods of the LZMADecompressor and BZ2Decompressor classes.
     Original patch by John Leitch.

   - bpo-27897(292): Fixed possible crash in
     sqlite3.Connection.create_collation() if pass invalid string-like
     object as a name.  Patch by Xiang Zhang.

   - bpo-18844(293): random.choices() now has k as a keyword-only
     argument to improve the readability of common cases and come into
     line with the signature used in other languages.

   - bpo-18893(294): Fix invalid exception handling in
     Lib/ctypes/macholib/dyld.py.  Patch by Madison May.

   - bpo-27611(295): Fixed support of default root window in the
     tkinter.tix module.  Added the master parameter in the DisplayStyle
     constructor.

   - bpo-27348(296): In the traceback module, restore the formatting of
     exception messages like "Exception: None".  This fixes a regression
     introduced in 3.5a2.

   - bpo-25651(297): Allow false values to be used for msg parameter of
     subTest().

   - bpo-27778(298): Fix a memory leak in os.getrandom() when the
     getrandom() is interrupted by a signal and a signal handler raises
     a Python exception.

   - bpo-28200(299): Fix memory leak on Windows in the os module (fix
     path_converter() function).

   - bpo-25400(300): RobotFileParser now correctly returns default
     values for crawl_delay and request_rate.  Initial patch by Peter
     Wirtz.

   - bpo-27932(301): Prevent memory leak in win32_ver().

   - Fix UnboundLocalError in socket._sendfile_use_sendfile.

   - bpo-28075(302): Check for ERROR_ACCESS_DENIED in Windows
     implementation of os.stat().  Patch by Eryk Sun.

   - bpo-22493(303): Warning message emitted by using inline flags in
     the middle of regular expression now contains a (truncated) regex
     pattern.  Patch by Tim Graham.

   - bpo-25270(304): Prevent codecs.escape_encode() from raising
     SystemError when an empty bytestring is passed.

   - bpo-28181(305): Get antigravity over HTTPS. Patch by Kaartic
     Sivaraam.

   - bpo-25895(306): Enable WebSocket URL schemes in
     urllib.parse.urljoin.  Patch by Gergely Imreh and Markus
     Holtermann.

   - bpo-28114(307): Fix a crash in parse_envlist() when env contains
     byte strings.  Patch by Eryk Sun.

   - bpo-27599(308): Fixed buffer overrun in binascii.b2a_qp() and
     binascii.a2b_qp().

   - bpo-27906(309): Fix socket accept exhaustion during high TCP
     traffic.  Patch by Kevin Conway.

   - bpo-28174(310): Handle when SO_REUSEPORT isn't properly supported.
     Patch by Seth Michael Larson.

   - bpo-26654(311): Inspect functools.partial in
     asyncio.Handle.__repr__.  Patch by iceboy.

   - bpo-26909(312): Fix slow pipes IO in asyncio.  Patch by INADA
     Naoki.

   - bpo-28176(313): Fix callbacks race in
     asyncio.SelectorLoop.sock_connect.

   - bpo-27759(314): Fix selectors incorrectly retain invalid file
     descriptors.  Patch by Mark Williams.

   - bpo-28325(315): Remove vestigial MacOS 9 macurl2path module and its
     tests.

   - bpo-28368(316): Refuse monitoring processes if the child watcher
     has no loop attached.  Patch by Vincent Michel.

   - bpo-28369(317): Raise RuntimeError when transport's FD is used with
     add_reader, add_writer, etc.

   - bpo-28370(318): Speedup asyncio.StreamReader.readexactly.  Patch by
     Коренберг Марк.

   - bpo-28371(319): Deprecate passing asyncio.Handles to
     run_in_executor.

   - bpo-28372(320): Fix asyncio to support formatting of non-python
     coroutines.

   - bpo-28399(321): Remove UNIX socket from FS before binding.  Patch
     by Коренберг Марк.

   - bpo-27972(322): Prohibit Tasks to await on themselves.

   - bpo-24142(323): Reading a corrupt config file left configparser in
     an invalid state.  Original patch by Florian Höch.

   - bpo-29581(324): ABCMeta.__new__ now accepts ‘**kwargs’, allowing
     abstract base classes to use keyword parameters in
     __init_subclass__.  Patch by Nate Soares.

   - bpo-25532(325): inspect.unwrap() will now only try to unwrap an
     object sys.getrecursionlimit() times, to protect against objects
     which create a new object on every attribute access.

   - bpo-30177(326): path.resolve(strict=False) no longer cuts the path
     after the first element not present in the filesystem.  Patch by
     Antoine Pietri.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31499

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31482

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31544

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31234

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31431

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31233

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28638

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31400

   (12) https://bugs.python.org/issue?@action=redirect&bpo=27629

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28958

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28182

   (15) https://bugs.python.org/issue?@action=redirect&bpo=27340

   (16) https://bugs.python.org/issue?@action=redirect&bpo=14191

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31178

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31350

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31170

   (20) https://bugs.python.org/issue?@action=redirect&bpo=29136

   (21) https://bugs.python.org/issue?@action=redirect&bpo=1198569

   (22) https://bugs.python.org/issue?@action=redirect&bpo=31326

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27144

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31281

   (25) https://bugs.python.org/issue?@action=redirect&bpo=10746

   (26) https://peps.python.org/pep-3118/

   (27) https://bugs.python.org/issue?@action=redirect&bpo=27584

   (28) https://bugs.python.org/issue?@action=redirect&bpo=22536

   (29) https://bugs.python.org/issue?@action=redirect&bpo=29741

   (30) https://bugs.python.org/issue?@action=redirect&bpo=31249

   (31) https://bugs.python.org/issue?@action=redirect&bpo=31247

   (32) https://bugs.python.org/issue?@action=redirect&bpo=23835

   (33) https://bugs.python.org/issue?@action=redirect&bpo=31238

   (34) https://bugs.python.org/issue?@action=redirect&bpo=5001

   (35) https://bugs.python.org/issue?@action=redirect&bpo=31109

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30102

   (37) https://bugs.python.org/issue?@action=redirect&bpo=18966

   (38) https://bugs.python.org/issue?@action=redirect&bpo=31183

   (39) https://bugs.python.org/issue?@action=redirect&bpo=5001

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31185

   (41) https://bugs.python.org/issue?@action=redirect&bpo=31151

   (42) https://bugs.python.org/issue?@action=redirect&bpo=31072

   (43) https://bugs.python.org/issue?@action=redirect&bpo=24700

   (44) https://bugs.python.org/issue?@action=redirect&bpo=31135

   (45) https://bugs.python.org/issue?@action=redirect&bpo=31107

   (46) https://bugs.python.org/issue?@action=redirect&bpo=31080

   (47) https://bugs.python.org/issue?@action=redirect&bpo=30897

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31061

   (49) https://bugs.python.org/issue?@action=redirect&bpo=30987

   (50) https://bugs.python.org/issue?@action=redirect&bpo=30522

   (51) https://bugs.python.org/issue?@action=redirect&bpo=30502

   (52) https://bugs.python.org/issue?@action=redirect&bpo=5288

   (53) https://bugs.python.org/issue?@action=redirect&bpo=30919

   (54) https://bugs.python.org/issue?@action=redirect&bpo=26732

   (55) https://bugs.python.org/issue?@action=redirect&bpo=29403

   (56) https://bugs.python.org/issue?@action=redirect&bpo=30961

   (57) https://bugs.python.org/issue?@action=redirect&bpo=19896

   (58) https://bugs.python.org/issue?@action=redirect&bpo=30946

   (59) https://bugs.python.org/issue?@action=redirect&bpo=25684

   (60) https://bugs.python.org/issue?@action=redirect&bpo=30886

   (61) https://bugs.python.org/issue?@action=redirect&bpo=29854

   (62) https://bugs.python.org/issue?@action=redirect&bpo=30794

   (63) https://bugs.python.org/issue?@action=redirect&bpo=30319

   (64) https://bugs.python.org/issue?@action=redirect&bpo=30828

   (65) https://bugs.python.org/issue?@action=redirect&bpo=30302

   (66) https://bugs.python.org/issue?@action=redirect&bpo=30807

   (67) https://bugs.python.org/issue?@action=redirect&bpo=30441

   (68) https://bugs.python.org/issue?@action=redirect&bpo=29585

   (69) https://bugs.python.org/issue?@action=redirect&bpo=29293

   (70) https://bugs.python.org/issue?@action=redirect&bpo=30532

   (71) https://bugs.python.org/issue?@action=redirect&bpo=30596

   (72) https://bugs.python.org/issue?@action=redirect&bpo=9146

   (73) https://bugs.python.org/issue?@action=redirect&bpo=29169

   (74) https://bugs.python.org/issue?@action=redirect&bpo=30119

   (75) https://bugs.python.org/issue?@action=redirect&bpo=30879

   (76) https://bugs.python.org/issue?@action=redirect&bpo=30746

   (77) https://bugs.python.org/issue?@action=redirect&bpo=30664

   (78) https://bugs.python.org/issue?@action=redirect&bpo=21071

   (79) https://bugs.python.org/issue?@action=redirect&bpo=29212

   (80) https://bugs.python.org/issue?@action=redirect&bpo=29755

   (81) https://bugs.python.org/issue?@action=redirect&bpo=30616

   (82) https://bugs.python.org/issue?@action=redirect&bpo=30038

   (83) https://bugs.python.org/issue?@action=redirect&bpo=23894

   (84) https://bugs.python.org/issue?@action=redirect&bpo=24744

   (85) https://bugs.python.org/issue?@action=redirect&bpo=24484

   (86) https://bugs.python.org/issue?@action=redirect&bpo=30589

   (87) https://bugs.python.org/issue?@action=redirect&bpo=28994

   (88) https://bugs.python.org/issue?@action=redirect&bpo=30508

   (89) https://bugs.python.org/issue?@action=redirect&bpo=30645

   (90) https://bugs.python.org/issue?@action=redirect&bpo=11822

   (91) https://bugs.python.org/issue?@action=redirect&bpo=30624

   (92) https://bugs.python.org/issue?@action=redirect&bpo=30595

   (93) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (94) https://bugs.python.org/issue?@action=redirect&bpo=30605

   (95) https://bugs.python.org/issue?@action=redirect&bpo=29870

   (96) https://bugs.python.org/issue?@action=redirect&bpo=29743

   (97) https://bugs.python.org/issue?@action=redirect&bpo=27585

   (98) https://bugs.python.org/issue?@action=redirect&bpo=30014

   (99) https://bugs.python.org/issue?@action=redirect&bpo=30418

   (100) https://bugs.python.org/issue?@action=redirect&bpo=30463

   (101) https://bugs.python.org/issue?@action=redirect&bpo=30520

   (102) https://bugs.python.org/issue?@action=redirect&bpo=30557

   (103) https://bugs.python.org/issue?@action=redirect&bpo=30526

   (104) https://bugs.python.org/issue?@action=redirect&bpo=30245

   (105) https://bugs.python.org/issue?@action=redirect&bpo=30378

   (106) https://bugs.python.org/issue?@action=redirect&bpo=16500

   (107) https://bugs.python.org/issue?@action=redirect&bpo=30470

   (108) https://bugs.python.org/issue?@action=redirect&bpo=30414

   (109) https://bugs.python.org/issue?@action=redirect&bpo=30003

   (110) https://bugs.python.org/issue?@action=redirect&bpo=30149

   (111) https://bugs.python.org/issue?@action=redirect&bpo=30436

   (112) https://bugs.python.org/issue?@action=redirect&bpo=30301

   (113) https://bugs.python.org/issue?@action=redirect&bpo=30375

   (114) https://bugs.python.org/issue?@action=redirect&bpo=30329

   (115) https://bugs.python.org/issue?@action=redirect&bpo=29196

   (116) https://bugs.python.org/issue?@action=redirect&bpo=9850

   (117) https://bugs.python.org/issue?@action=redirect&bpo=30299

   (118) https://bugs.python.org/issue?@action=redirect&bpo=30048

   (119) https://bugs.python.org/issue?@action=redirect&bpo=30266

   (120) https://bugs.python.org/issue?@action=redirect&bpo=25958

   (121) https://bugs.python.org/issue?@action=redirect&bpo=30340

   (122) https://bugs.python.org/issue?@action=redirect&bpo=30298

   (123) https://bugs.python.org/issue?@action=redirect&bpo=30285

   (124) https://bugs.python.org/issue?@action=redirect&bpo=29990

   (125) https://bugs.python.org/issue?@action=redirect&bpo=29979

   (126) https://bugs.python.org/issue?@action=redirect&bpo=30243

   (127) https://bugs.python.org/issue?@action=redirect&bpo=30215

   (128) https://bugs.python.org/issue?@action=redirect&bpo=30185

   (129) https://bugs.python.org/issue?@action=redirect&bpo=30103

   (130) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (131) https://bugs.python.org/issue?@action=redirect&bpo=30205

   (132) https://bugs.python.org/issue?@action=redirect&bpo=30228

   (133) https://bugs.python.org/issue?@action=redirect&bpo=30190

   (134) https://bugs.python.org/issue?@action=redirect&bpo=30101

   (135) https://bugs.python.org/issue?@action=redirect&bpo=29822

   (136) https://bugs.python.org/issue?@action=redirect&bpo=29960

   (137) https://bugs.python.org/issue?@action=redirect&bpo=30070

   (138) https://bugs.python.org/issue?@action=redirect&bpo=22352

   (139) https://bugs.python.org/issue?@action=redirect&bpo=30061

   (140) https://bugs.python.org/issue?@action=redirect&bpo=30218

   (141) https://bugs.python.org/issue?@action=redirect&bpo=10076

   (142) https://bugs.python.org/issue?@action=redirect&bpo=30068

   (143) https://bugs.python.org/issue?@action=redirect&bpo=29694

   (144) https://bugs.python.org/issue?@action=redirect&bpo=29692

   (145) https://bugs.python.org/issue?@action=redirect&bpo=26187

   (146) https://bugs.python.org/issue?@action=redirect&bpo=9303

   (147) https://bugs.python.org/issue?@action=redirect&bpo=30017

   (148) https://bugs.python.org/issue?@action=redirect&bpo=29998

   (149) https://bugs.python.org/issue?@action=redirect&bpo=29995

   (150) https://bugs.python.org/issue?@action=redirect&bpo=29962

   (151) https://bugs.python.org/issue?@action=redirect&bpo=29649

   (152) https://bugs.python.org/issue?@action=redirect&bpo=29654

   (153) https://bugs.python.org/issue?@action=redirect&bpo=29931

   (154) https://bugs.python.org/issue?@action=redirect&bpo=29953

   (155) https://bugs.python.org/issue?@action=redirect&bpo=29942

   (156) https://bugs.python.org/issue?@action=redirect&bpo=10030

   (157) https://bugs.python.org/issue?@action=redirect&bpo=29204

   (158) https://bugs.python.org/issue?@action=redirect&bpo=27863

   (159) https://bugs.python.org/issue?@action=redirect&bpo=25996

   (160) https://bugs.python.org/issue?@action=redirect&bpo=28699

   (161) https://bugs.python.org/issue?@action=redirect&bpo=23890

   (162) https://bugs.python.org/issue?@action=redirect&bpo=29901

   (163) https://bugs.python.org/issue?@action=redirect&bpo=25803

   (164) https://bugs.python.org/issue?@action=redirect&bpo=29861

   (165) https://bugs.python.org/issue?@action=redirect&bpo=19930

   (166) https://bugs.python.org/issue?@action=redirect&bpo=29884

   (167) https://bugs.python.org/issue?@action=redirect&bpo=25455

   (168) https://bugs.python.org/issue?@action=redirect&bpo=29800

   (169) https://bugs.python.org/issue?@action=redirect&bpo=8256

   (170) https://bugs.python.org/issue?@action=redirect&bpo=28692

   (171) https://bugs.python.org/issue?@action=redirect&bpo=26121

   (172) https://bugs.python.org/issue?@action=redirect&bpo=29619

   (173) https://bugs.python.org/issue?@action=redirect&bpo=28298

   (174) https://bugs.python.org/issue?@action=redirect&bpo=29645

   (175) https://bugs.python.org/issue?@action=redirect&bpo=28231

   (176) https://bugs.python.org/issue?@action=redirect&bpo=26915

   (177) https://bugs.python.org/issue?@action=redirect&bpo=28682

   (178) https://bugs.python.org/issue?@action=redirect&bpo=29728

   (179) https://bugs.python.org/issue?@action=redirect&bpo=29623

   (180) https://bugs.python.org/issue?@action=redirect&bpo=9303

   (181) https://bugs.python.org/issue?@action=redirect&bpo=28963

   (182) https://bugs.python.org/issue?@action=redirect&bpo=29704

   (183) https://bugs.python.org/issue?@action=redirect&bpo=29271

   (184) https://bugs.python.org/issue?@action=redirect&bpo=29703

   (185) https://bugs.python.org/issue?@action=redirect&bpo=29615

   (186) https://bugs.python.org/issue?@action=redirect&bpo=7769

   (187) https://bugs.python.org/issue?@action=redirect&bpo=29376

   (188) https://bugs.python.org/issue?@action=redirect&bpo=28624

   (189) https://bugs.python.org/issue?@action=redirect&bpo=28518

   (190) https://bugs.python.org/issue?@action=redirect&bpo=29742

   (191) https://bugs.python.org/issue?@action=redirect&bpo=16285

   (192) https://bugs.python.org/issue?@action=redirect&bpo=29532

   (193) https://bugs.python.org/issue?@action=redirect&bpo=29110

   (194) https://bugs.python.org/issue?@action=redirect&bpo=22807

   (195) https://bugs.python.org/issue?@action=redirect&bpo=29576

   (196) https://bugs.python.org/issue?@action=redirect&bpo=29534

   (197) https://bugs.python.org/issue?@action=redirect&bpo=10379

   (198) https://bugs.python.org/issue?@action=redirect&bpo=29851

   (199) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (200) https://bugs.python.org/issue?@action=redirect&bpo=29100

   (201) https://bugs.python.org/issue?@action=redirect&bpo=29416

   (202) https://bugs.python.org/issue?@action=redirect&bpo=29444

   (203) https://bugs.python.org/issue?@action=redirect&bpo=29377

   (204) https://bugs.python.org/issue?@action=redirect&bpo=29218

   (205) https://bugs.python.org/issue?@action=redirect&bpo=29368

   (206) https://bugs.python.org/issue?@action=redirect&bpo=29338

   (207) https://bugs.python.org/issue?@action=redirect&bpo=29335

   (208) https://bugs.python.org/issue?@action=redirect&bpo=29290

   (209) https://bugs.python.org/issue?@action=redirect&bpo=28735

   (210) https://bugs.python.org/issue?@action=redirect&bpo=29197

   (211) https://bugs.python.org/issue?@action=redirect&bpo=29210

   (212) https://bugs.python.org/issue?@action=redirect&bpo=29219

   (213) https://bugs.python.org/issue?@action=redirect&bpo=29192

   (214) https://bugs.python.org/issue?@action=redirect&bpo=29193

   (215) https://bugs.python.org/issue?@action=redirect&bpo=29195

   (216) https://bugs.python.org/issue?@action=redirect&bpo=28969

   (217) https://bugs.python.org/issue?@action=redirect&bpo=20804

   (218) https://bugs.python.org/issue?@action=redirect&bpo=29142

   (219) https://bugs.python.org/issue?@action=redirect&bpo=28961

   (220) https://bugs.python.org/issue?@action=redirect&bpo=15812

   (221) https://bugs.python.org/issue?@action=redirect&bpo=28985

   (222) https://bugs.python.org/issue?@action=redirect&bpo=29079

   (223) https://bugs.python.org/issue?@action=redirect&bpo=13051

   (224) https://bugs.python.org/issue?@action=redirect&bpo=9770

   (225) https://bugs.python.org/issue?@action=redirect&bpo=28427

   (226) https://bugs.python.org/issue?@action=redirect&bpo=28923

   (227) https://bugs.python.org/issue?@action=redirect&bpo=28871

   (228) https://bugs.python.org/issue?@action=redirect&bpo=19542

   (229) https://bugs.python.org/issue?@action=redirect&bpo=20191

   (230) https://bugs.python.org/issue?@action=redirect&bpo=16255

   (231) https://bugs.python.org/issue?@action=redirect&bpo=28779

   (232) https://bugs.python.org/issue?@action=redirect&bpo=26937

   (233) https://bugs.python.org/issue?@action=redirect&bpo=28847

   (234) https://bugs.python.org/issue?@action=redirect&bpo=27030

   (235) https://bugs.python.org/issue?@action=redirect&bpo=28835

   (236) https://bugs.python.org/issue?@action=redirect&bpo=27172

   (237) https://bugs.python.org/issue?@action=redirect&bpo=28740

   (238) https://bugs.python.org/issue?@action=redirect&bpo=26273

   (239) https://bugs.python.org/issue?@action=redirect&bpo=28752

   (240) https://bugs.python.org/issue?@action=redirect&bpo=28727

   (241) https://bugs.python.org/issue?@action=redirect&bpo=18383

   (242) https://bugs.python.org/issue?@action=redirect&bpo=20572

   (243) https://bugs.python.org/issue?@action=redirect&bpo=25659

   (244) https://bugs.python.org/issue?@action=redirect&bpo=28548

   (245) https://bugs.python.org/issue?@action=redirect&bpo=19717

   (246) https://bugs.python.org/issue?@action=redirect&bpo=28563

   (247) https://bugs.python.org/issue?@action=redirect&bpo=28387

   (248) https://bugs.python.org/issue?@action=redirect&bpo=27517

   (249) https://bugs.python.org/issue?@action=redirect&bpo=28549

   (250) https://bugs.python.org/issue?@action=redirect&bpo=28449

   (251) https://bugs.python.org/issue?@action=redirect&bpo=23262

   (252) https://bugs.python.org/issue?@action=redirect&bpo=24241

   (253) https://bugs.python.org/issue?@action=redirect&bpo=27939

   (254) https://bugs.python.org/issue?@action=redirect&bpo=28255

   (255) https://bugs.python.org/issue?@action=redirect&bpo=28255

   (256) https://bugs.python.org/issue?@action=redirect&bpo=20491

   (257) https://bugs.python.org/issue?@action=redirect&bpo=28353

   (258) https://bugs.python.org/issue?@action=redirect&bpo=28430

   (259) https://bugs.python.org/issue?@action=redirect&bpo=27025

   (260) https://bugs.python.org/issue?@action=redirect&bpo=25464

   (261) https://bugs.python.org/issue?@action=redirect&bpo=28488

   (262) https://bugs.python.org/issue?@action=redirect&bpo=25953

   (263) https://bugs.python.org/issue?@action=redirect&bpo=28469

   (264) https://bugs.python.org/issue?@action=redirect&bpo=28115

   (265) https://bugs.python.org/issue?@action=redirect&bpo=18219

   (266) https://bugs.python.org/issue?@action=redirect&bpo=28448

   (267) https://bugs.python.org/issue?@action=redirect&bpo=23214

   (268) https://bugs.python.org/issue?@action=redirect&bpo=28480

   (269) https://bugs.python.org/issue?@action=redirect&bpo=28240

   (270) https://bugs.python.org/issue?@action=redirect&bpo=28240

   (271) https://bugs.python.org/issue?@action=redirect&bpo=28240

   (272) https://github.com/pypa/setuptools/issues/100

   (273) https://bugs.python.org/issue?@action=redirect&bpo=24452

   (274) https://bugs.python.org/issue?@action=redirect&bpo=20766

   (275) https://bugs.python.org/issue?@action=redirect&bpo=27998

   (276) https://bugs.python.org/issue?@action=redirect&bpo=28317

   (277) https://bugs.python.org/issue?@action=redirect&bpo=28380

   (278) https://bugs.python.org/issue?@action=redirect&bpo=28229

   (279) https://bugs.python.org/issue?@action=redirect&bpo=28321

   (280) https://bugs.python.org/issue?@action=redirect&bpo=28225

   (281) https://bugs.python.org/issue?@action=redirect&bpo=28227

   (282) https://bugs.python.org/issue?@action=redirect&bpo=28332

   (283) https://bugs.python.org/issue?@action=redirect&bpo=27358

   (284) https://bugs.python.org/issue?@action=redirect&bpo=28257

   (285) https://bugs.python.org/issue?@action=redirect&bpo=28322

   (286) https://bugs.python.org/issue?@action=redirect&bpo=28228

   (287) https://bugs.python.org/issue?@action=redirect&bpo=28226

   (288) https://bugs.python.org/issue?@action=redirect&bpo=28314

   (289) https://bugs.python.org/issue?@action=redirect&bpo=28148

   (290) https://bugs.python.org/issue?@action=redirect&bpo=28253

   (291) https://bugs.python.org/issue?@action=redirect&bpo=28275

   (292) https://bugs.python.org/issue?@action=redirect&bpo=27897

   (293) https://bugs.python.org/issue?@action=redirect&bpo=18844

   (294) https://bugs.python.org/issue?@action=redirect&bpo=18893

   (295) https://bugs.python.org/issue?@action=redirect&bpo=27611

   (296) https://bugs.python.org/issue?@action=redirect&bpo=27348

   (297) https://bugs.python.org/issue?@action=redirect&bpo=25651

   (298) https://bugs.python.org/issue?@action=redirect&bpo=27778

   (299) https://bugs.python.org/issue?@action=redirect&bpo=28200

   (300) https://bugs.python.org/issue?@action=redirect&bpo=25400

   (301) https://bugs.python.org/issue?@action=redirect&bpo=27932

   (302) https://bugs.python.org/issue?@action=redirect&bpo=28075

   (303) https://bugs.python.org/issue?@action=redirect&bpo=22493

   (304) https://bugs.python.org/issue?@action=redirect&bpo=25270

   (305) https://bugs.python.org/issue?@action=redirect&bpo=28181

   (306) https://bugs.python.org/issue?@action=redirect&bpo=25895

   (307) https://bugs.python.org/issue?@action=redirect&bpo=28114

   (308) https://bugs.python.org/issue?@action=redirect&bpo=27599

   (309) https://bugs.python.org/issue?@action=redirect&bpo=27906

   (310) https://bugs.python.org/issue?@action=redirect&bpo=28174

   (311) https://bugs.python.org/issue?@action=redirect&bpo=26654

   (312) https://bugs.python.org/issue?@action=redirect&bpo=26909

   (313) https://bugs.python.org/issue?@action=redirect&bpo=28176

   (314) https://bugs.python.org/issue?@action=redirect&bpo=27759

   (315) https://bugs.python.org/issue?@action=redirect&bpo=28325

   (316) https://bugs.python.org/issue?@action=redirect&bpo=28368

   (317) https://bugs.python.org/issue?@action=redirect&bpo=28369

   (318) https://bugs.python.org/issue?@action=redirect&bpo=28370

   (319) https://bugs.python.org/issue?@action=redirect&bpo=28371

   (320) https://bugs.python.org/issue?@action=redirect&bpo=28372

   (321) https://bugs.python.org/issue?@action=redirect&bpo=28399

   (322) https://bugs.python.org/issue?@action=redirect&bpo=27972

   (323) https://bugs.python.org/issue?@action=redirect&bpo=24142

   (324) https://bugs.python.org/issue?@action=redirect&bpo=29581

   (325) https://bugs.python.org/issue?@action=redirect&bpo=25532

   (326) https://bugs.python.org/issue?@action=redirect&bpo=30177


File: python.info,  Node: ドキュメント<66>,  Next: テスト<67>,  Prev: ライブラリ<178>,  Up: Python 3 7 0 alpha 1

1.26.72.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(): 1d2. and *note
     bytearray(): 1d1. are now their respective type definitions, rather
     than the corresponding builtin function entries.  Use *note bytes:
     20a6. and *note bytearray: 20a7. 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: テスト<67>,  Next: ビルド<71>,  Prev: ドキュメント<66>,  Up: Python 3 7 0 alpha 1

1.26.72.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: ビルド<71>,  Next: Windows<63>,  Prev: テスト<67>,  Up: Python 3 7 0 alpha 1

1.26.72.6 ビルド
................

   - bpo-31354(1): Allow ‘--with-lto’ to be used on all builds, not just
     ‘make profile-opt’.

   - bpo-31370(2): Remove support for building -without-threads.  This
     option is not really useful anymore in the 21st century.  Removing
     lots of conditional paths allows us to simplify the code base,
     including in difficult to maintain low-level internal code.

   - bpo-31341(3): Per PEP 11(4), support for the IRIX operating system
     was removed.

   - bpo-30854(5): Fix compile error when compiling -without-threads.
     Patch by Masayuki Yamamoto.

   - bpo-30687(6): Locate msbuild.exe on Windows when building rather
     than vcvarsall.bat

   - bpo-20210(7): Support the 'disabled' marker in Setup files.
     Extension modules listed after this marker are not built at all,
     neither by the Makefile nor by setup.py.

   - bpo-29941(8): Add ‘--with-assertions’ configure flag to explicitly
     enable C ‘assert()’ checks.  Defaults to off.  ‘--with-pydebug’
     implies ‘--with-assertions’.

   - bpo-28787(9): Fix out-of-tree builds of Python when configured with
     ‘--with--dtrace’.

   - bpo-29243(10): Prevent unnecessary rebuilding of Python during
     ‘make test’, ‘make install’ and some other make targets when
     configured with ‘--enable-optimizations’.

   - bpo-23404(11): Don't regenerate generated files based on file
     modification time anymore: the action is now explicit.  Replace
     ‘make touch’ with ‘make regen-all’.

   - bpo-29643(12): Fix ‘--enable-optimization’ didn't work.

   - bpo-27593(13): sys.version and the platform module python_build(),
     python_branch(), and python_revision() functions now use git
     information rather than hg when building from a repo.

   - bpo-29572(14): Update Windows build and OS X installers to use
     OpenSSL 1.0.2k.

   - bpo-27659(15): Prohibit implicit C function declarations: use
     ‘-Werror=implicit-function-declaration’ when possible (GCC and
     Clang, but it depends on the compiler version).  Patch written by
     Chi Hsuan Yen.

   - bpo-29384(16): Remove old Be OS helper scripts.

   - bpo-26851(17): Set Android compilation and link flags.

   - bpo-28768(18): Fix implicit declaration of function _setmode.
     Patch by Masayuki Yamamoto

   - bpo-29080(19): Removes hard dependency on hg.exe from
     PCBuild/build.bat

   - bpo-23903(20): Added missed names to PC/python3.def.

   - bpo-28762(21): lockf() is available on Android API level 24, but
     the F_LOCK macro is not defined in android-ndk-r13.

   - bpo-28538(22): Fix the compilation error that occurs because
     if_nameindex() is available on Android API level 24, but the
     if_nameindex structure is not defined.

   - bpo-20211(23): Do not add the directory for installing C header
     files and the directory for installing object code libraries to the
     cross compilation search paths.  Original patch by Thomas
     Petazzoni.

   - bpo-28849(24): Do not define sys.implementation._multiarch on
     Android.

   - bpo-10656(25): Fix out-of-tree building on AIX. Patch by Tristan
     Carel and Michael Haubenwallner.

   - bpo-26359(26): Rename -with-optimiations to -enable-optimizations.

   - bpo-28444(27): Fix missing extensions modules when cross compiling.

   - bpo-28208(28): Update Windows build and OS X installers to use
     SQLite 3.14.2.

   - bpo-28248(29): Update Windows build and OS X installers to use
     OpenSSL 1.0.2j.

   - bpo-21124(30): Fix building the _struct module on Cygwin by passing
     ‘NULL’ instead of ‘&PyType_Type’ to PyVarObject_HEAD_INIT. Patch by
     Masayuki Yamamoto.

   - bpo-13756(31): Fix building extensions modules on Cygwin.  Patch by
     Roumen Petrov, based on original patch by Jason Tishler.

   - bpo-21085(32): Add configure check for siginfo_t.si_band, which
     Cygwin does not provide.  Patch by Masayuki Yamamoto with review
     and rebase by Erik Bray.

   - bpo-28258(33): Fixed build with Estonian locale (python-config and
     distclean targets in Makefile).  Patch by Arfrever Frehtes
     Taifersar Arahesis.

   - bpo-26661(34): setup.py now detects system libffi with multiarch
     wrapper.

   - bpo-27979(35): A full copy of libffi is no longer bundled for use
     when building _ctypes on non-OSX UNIX platforms.  An installed copy
     of libffi is now required when building _ctypes on such platforms.

   - bpo-15819(36): Remove redundant include search directory option for
     building outside the source tree.

   - bpo-28676(37): Prevent missing 'getentropy' declaration warning on
     macOS. Patch by Gareth Rees.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31354

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31370

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31341

   (4) https://peps.python.org/pep-0011/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30854

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30687

   (7) https://bugs.python.org/issue?@action=redirect&bpo=20210

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29941

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28787

   (10) https://bugs.python.org/issue?@action=redirect&bpo=29243

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23404

   (12) https://bugs.python.org/issue?@action=redirect&bpo=29643

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27593

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29572

   (15) https://bugs.python.org/issue?@action=redirect&bpo=27659

   (16) https://bugs.python.org/issue?@action=redirect&bpo=29384

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26851

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28768

   (19) https://bugs.python.org/issue?@action=redirect&bpo=29080

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23903

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28762

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28538

   (23) https://bugs.python.org/issue?@action=redirect&bpo=20211

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28849

   (25) https://bugs.python.org/issue?@action=redirect&bpo=10656

   (26) https://bugs.python.org/issue?@action=redirect&bpo=26359

   (27) https://bugs.python.org/issue?@action=redirect&bpo=28444

   (28) https://bugs.python.org/issue?@action=redirect&bpo=28208

   (29) https://bugs.python.org/issue?@action=redirect&bpo=28248

   (30) https://bugs.python.org/issue?@action=redirect&bpo=21124

   (31) https://bugs.python.org/issue?@action=redirect&bpo=13756

   (32) https://bugs.python.org/issue?@action=redirect&bpo=21085

   (33) https://bugs.python.org/issue?@action=redirect&bpo=28258

   (34) https://bugs.python.org/issue?@action=redirect&bpo=26661

   (35) https://bugs.python.org/issue?@action=redirect&bpo=27979

   (36) https://bugs.python.org/issue?@action=redirect&bpo=15819

   (37) https://bugs.python.org/issue?@action=redirect&bpo=28676


File: python.info,  Node: Windows<63>,  Next: IDLE<46>,  Prev: ビルド<71>,  Up: Python 3 7 0 alpha 1

1.26.72.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<41>,  Prev: Windows<63>,  Up: Python 3 7 0 alpha 1

1.26.72.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<41>,  Next: C API<65>,  Prev: IDLE<46>,  Up: Python 3 7 0 alpha 1

1.26.72.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<65>,  Prev: Tools/Demos<41>,  Up: Python 3 7 0 alpha 1

1.26.72.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.26.73 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.26.74 Python 3.6.6 release candidate 1
----------------------------------------

'Release date: 2018-06-11'

* Menu:

* Core and Builtins: Core and Builtins<177>.
* ライブラリ: ライブラリ<179>.
* ドキュメント: ドキュメント<67>.
* テスト: テスト<68>.
* ビルド: ビルド<72>.
* Windows: Windows<64>.
* macOS: macOS<50>.
* IDLE: IDLE<47>.
* Tools/Demos: Tools/Demos<42>.
* C API: C API<66>.


File: python.info,  Node: Core and Builtins<177>,  Next: ライブラリ<179>,  Up: Python 3 6 6 release candidate 1

1.26.74.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: 157f. list.  *note PyGC_Collect(): d5a. 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: ライブラリ<179>,  Next: ドキュメント<67>,  Prev: Core and Builtins<177>,  Up: Python 3 6 6 release candidate 1

1.26.74.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: 29c. instead of *note
     SystemError: 3f1. when performed on *note mmap.mmap: 247. 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: 37. 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: 2031.

   - 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(): 2032.

   - 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: 83. 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: 2d.  Patch by
     Segev Finer.

   - bpo-31238(39): pydoc: the stop() method of the private ServerThread
     class now waits until DocServer.serve_until_quit() completes and
     then explicitly sets its docserver attribute to None to break a
     reference cycle.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30167

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33812

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30805

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33767

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32684

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31647

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33672

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33469

   (10) https://bugs.python.org/issue?@action=redirect&bpo=11874

   (11) https://bugs.python.org/issue?@action=redirect&bpo=30877

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33548

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33542

   (14) https://bugs.python.org/issue?@action=redirect&bpo=26819

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (16) https://bugs.python.org/issue?@action=redirect&bpo=20087

   (17) https://bugs.python.org/issue?@action=redirect&bpo=33422

   (18) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33383

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33329

   (21) https://bugs.python.org/issue?@action=redirect&bpo=991266

   (22) https://bugs.python.org/issue?@action=redirect&bpo=33131

   (23) https://bugs.python.org/issue?@action=redirect&bpo=33308

   (24) https://bugs.python.org/issue?@action=redirect&bpo=33263

   (25) https://bugs.python.org/issue?@action=redirect&bpo=33256

   (26) https://bugs.python.org/issue?@action=redirect&bpo=33203

   (27) https://bugs.python.org/issue?@action=redirect&bpo=33224

   (28) https://peps.python.org/pep-0479/

   (29) https://bugs.python.org/issue?@action=redirect&bpo=33209

   (30) https://bugs.python.org/issue?@action=redirect&bpo=32861

   (31) https://bugs.python.org/issue?@action=redirect&bpo=33096

   (32) https://bugs.python.org/issue?@action=redirect&bpo=33127

   (33) https://bugs.python.org/issue?@action=redirect&bpo=33021

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27683

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32844

   (36) https://bugs.python.org/issue?@action=redirect&bpo=31908

   (37) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (38) https://bugs.python.org/issue?@action=redirect&bpo=16865

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31238


File: python.info,  Node: ドキュメント<67>,  Next: テスト<68>,  Prev: ライブラリ<179>,  Up: Python 3 6 6 release candidate 1

1.26.74.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: 139. 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: テスト<68>,  Next: ビルド<72>,  Prev: ドキュメント<67>,  Up: Python 3 6 6 release candidate 1

1.26.74.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: ビルド<72>,  Next: Windows<64>,  Prev: テスト<68>,  Up: Python 3 6 6 release candidate 1

1.26.74.5 ビルド
................

   - bpo-5755(1): Move ‘-Wstrict-prototypes’ option to ‘CFLAGS_NODIST’
     from ‘OPT’.  This option emitted annoying warnings when building
     extension modules written in C++.

   - bpo-33614(2): Ensures module definition files for the stable ABI on
     Windows are correctly regenerated.

   - bpo-33522(3): Enable CI builds on Visual Studio Team Services at
     ‘https://python.visualstudio.com/cpython’

   - bpo-33012(4): Add ‘-Wno-cast-function-type’ for gcc 8 for silencing
     warnings about function casts like casting to PyCFunction in method
     definition lists.

   - bpo-33394(5): Enable the verbose build for extension modules, when
     GNU make is passed macros on the command line.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5755

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33614

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33522

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33012

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33394


File: python.info,  Node: Windows<64>,  Next: macOS<50>,  Prev: ビルド<72>,  Up: Python 3 6 6 release candidate 1

1.26.74.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<50>,  Next: IDLE<47>,  Prev: Windows<64>,  Up: Python 3 6 6 release candidate 1

1.26.74.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<42>,  Prev: macOS<50>,  Up: Python 3 6 6 release candidate 1

1.26.74.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<42>,  Next: C API<66>,  Prev: IDLE<47>,  Up: Python 3 6 6 release candidate 1

1.26.74.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<66>,  Prev: Tools/Demos<42>,  Up: Python 3 6 6 release candidate 1

1.26.74.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.26.75 Python 3.6.5 final
--------------------------

'Release date: 2018-03-28'

* Menu:

* テスト: テスト<69>.
* ビルド: ビルド<73>.


File: python.info,  Node: テスト<69>,  Next: ビルド<73>,  Up: Python 3 6 5 final

1.26.75.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: ビルド<73>,  Prev: テスト<69>,  Up: Python 3 6 5 final

1.26.75.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.26.76 Python 3.6.5 release candidate 1
----------------------------------------

'Release date: 2018-03-13'

* Menu:

* セキュリティ: セキュリティ<49>.
* Core and Builtins: Core and Builtins<178>.
* ライブラリ: ライブラリ<180>.
* ドキュメント: ドキュメント<68>.
* テスト: テスト<70>.
* ビルド: ビルド<74>.
* Windows: Windows<65>.
* macOS: macOS<51>.
* IDLE: IDLE<48>.
* Tools/Demos: Tools/Demos<43>.
* C API: C API<67>.


File: python.info,  Node: セキュリティ<49>,  Next: Core and Builtins<178>,  Up: Python 3 6 5 release candidate 1

1.26.76.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<178>,  Next: ライブラリ<180>,  Prev: セキュリティ<49>,  Up: Python 3 6 5 release candidate 1

1.26.76.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: ライブラリ<180>,  Next: ドキュメント<68>,  Prev: Core and Builtins<178>,  Up: Python 3 6 5 release candidate 1

1.26.76.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: f9, ‘after_cancel(None)’ now
     raises a *note ValueError: 15a. 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(): 2ae. 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(): fc1. 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():
     a17. method when formatting a number (*note int: 32e, *note float:
     32f, ‘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: ドキュメント<68>,  Next: テスト<70>,  Prev: ライブラリ<180>,  Up: Python 3 6 5 release candidate 1

1.26.76.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: 1b4.

   - bpo-32614(4): Modify RE examples in documentation to use raw
     strings to prevent *note DeprecationWarning: 2d4. 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: テスト<70>,  Next: ビルド<74>,  Prev: ドキュメント<68>,  Up: Python 3 6 5 release candidate 1

1.26.76.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: ビルド<74>,  Next: Windows<65>,  Prev: テスト<70>,  Up: Python 3 6 5 release candidate 1

1.26.76.6 ビルド
................

   - bpo-32635(1): Fix segfault of the crypt module when libxcrypt is
     provided instead of libcrypt at the system.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32635


File: python.info,  Node: Windows<65>,  Next: macOS<51>,  Prev: ビルド<74>,  Up: Python 3 6 5 release candidate 1

1.26.76.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(): cf1. 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<51>,  Next: IDLE<48>,  Prev: Windows<65>,  Up: Python 3 6 5 release candidate 1

1.26.76.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<43>,  Prev: macOS<51>,  Up: Python 3 6 5 release candidate 1

1.26.76.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: 45a.; ‘-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<43>,  Next: C API<67>,  Prev: IDLE<48>,  Up: Python 3 6 5 release candidate 1

1.26.76.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<67>,  Prev: Tools/Demos<43>,  Up: Python 3 6 5 release candidate 1

1.26.76.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.26.77 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.26.78 Python 3.6.4 release candidate 1
----------------------------------------

'Release date: 2017-12-05'

* Menu:

* Core and Builtins: Core and Builtins<179>.
* ライブラリ: ライブラリ<181>.
* ドキュメント: ドキュメント<69>.
* テスト: テスト<71>.
* ビルド: ビルド<75>.
* Windows: Windows<66>.
* macOS: macOS<52>.
* IDLE: IDLE<49>.
* Tools/Demos: Tools/Demos<44>.
* C API: C API<68>.


File: python.info,  Node: Core and Builtins<179>,  Next: ライブラリ<181>,  Up: Python 3 6 4 release candidate 1

1.26.78.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: ライブラリ<181>,  Next: ドキュメント<69>,  Prev: Core and Builtins<179>,  Up: Python 3 6 4 release candidate 1

1.26.78.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():
     1da. in the *note RobotFileParser.parse(): 208f. method.  Initial
     patch by Robin Wellner.

   - bpo-12382(9): ‘msilib.OpenDatabase()’ now raises a better exception
     message when it couldn't open or create an MSI file.  Initial patch
     by William Tisäter.

   - bpo-32110(10): ‘codecs.StreamReader.read(n)’ now returns not more
     than 'n' characters/bytes for non-negative 'n'.  This makes it
     compatible with ‘read()’ methods of other file-like objects.

   - bpo-32072(11): Fixed issues with binary plists: Fixed saving
     bytearrays.  Identical objects will be saved only once.  Equal
     references will be load as identical objects.  Added support for
     saving and loading recursive data structures.

   - bpo-32034(12): Make asyncio.IncompleteReadError and
     LimitOverrunError pickleable.

   - bpo-32015(13): Fixed the looping of asyncio in the case of
     reconnection the socket during waiting async read/write from/to the
     socket.

   - bpo-32011(14): Restored support of loading marshal files with the
     TYPE_INT64 code.  These files can be produced in Python 2.7.

   - bpo-31970(15): Reduce performance overhead of asyncio debug mode.

   - bpo-9678(16): Fixed determining the MAC address in the uuid module:
     Using ifconfig on NetBSD and OpenBSD. Using arp on Linux, FreeBSD,
     NetBSD and OpenBSD. Based on patch by Takayuki Shimizukawa.

   - bpo-30057(17): Fix potential missed signal in signal.signal().

   - bpo-31933(18): Fix Blake2 params leaf_size and node_offset on big
     endian platforms.  Patch by Jack O'Connor.

   - bpo-31927(19): Fixed compilation of the socket module on NetBSD 8.
     Fixed assertion failure or reading arbitrary data when parse a
     AF_BLUETOOTH address on NetBSD and DragonFly BSD.

   - bpo-27666(20): Fixed stack corruption in curses.box() and
     curses.ungetmouse() when the size of types chtype or mmask_t is
     less than the size of C long.  curses.box() now accepts characters
     as arguments.  Based on patch by Steve Fink.

   - bpo-31897(21): plistlib now catches more errors when read binary
     plists and raises InvalidFileException instead of unexpected
     exceptions.

   - bpo-25720(22): Fix the method for checking pad state of curses
     WINDOW. Patch by Masayuki Yamamoto.

   - bpo-31893(23): Fixed the layout of the kqueue_event structure on
     OpenBSD and NetBSD. Fixed the comparison of the kqueue_event
     objects.

   - bpo-31891(24): Fixed building the curses module on NetBSD.

   - bpo-28416(25): Instances of pickle.Pickler subclass with the
     persistent_id() method and pickle.Unpickler subclass with the
     persistent_load() method no longer create reference cycles.

   - bpo-28326(26): Fix multiprocessing.Process when stdout and/or
     stderr is closed or None.

   - bpo-31457(27): If nested log adapters are used, the inner
     ‘process()’ methods are no longer omitted.

   - bpo-31457(28): The ‘manager’ property on LoggerAdapter objects is
     now properly settable.

   - bpo-31806(29): Fix timeout rounding in time.sleep(),
     threading.Lock.acquire() and socket.socket.settimeout() to round
     correctly negative timeouts between -1.0 and 0.0.  The functions
     now block waiting for events as expected.  Previously, the call was
     incorrectly non-blocking.  Patch by Pablo Galindo.

   - bpo-28603(30): traceback: Fix a TypeError that occurred during
     printing of exception tracebacks when either the current exception
     or an exception in its context/cause chain is unhashable.  Patch by
     Zane Bitter.

   - bpo-30058(31): Fixed buffer overflow in select.kqueue.control().

   - bpo-31770(32): Prevent a crash when calling the ‘__init__()’ method
     of a ‘sqlite3.Cursor’ object more than once.  Patch by Oren Milman.

   - bpo-31672(33): ‘idpattern’ in ‘string.Template’ matched some
     non-ASCII characters.  Now it uses ‘-i’ regular expression local
     flag to avoid non-ASCII characters.

   - bpo-31764(34): Prevent a crash in ‘sqlite3.Cursor.close()’ in case
     the ‘Cursor’ object is uninitialized.  Patch by Oren Milman.

   - bpo-31752(35): Fix possible crash in timedelta constructor called
     with custom integers.

   - bpo-31701(36): On Windows, faulthandler.enable() now ignores MSC
     and COM exceptions.

   - bpo-31728(37): Prevent crashes in ‘_elementtree’ due to unsafe
     cleanup of ‘Element.text’ and ‘Element.tail’.  Patch by Oren
     Milman.

   - bpo-31620(38): an empty asyncio.Queue now doesn't leak memory when
     queue.get pollers timeout

   - bpo-31632(39): Fix method set_protocol() of class
     _SSLProtocolTransport in asyncio module.  This method was
     previously modifying a wrong reference to the protocol.

   - bpo-31675(40): Fixed memory leaks in Tkinter's methods splitlist()
     and split() when pass a string larger than 2 GiB.

   - bpo-31673(41): Fixed typo in the name of Tkinter's method
     adderrorinfo().

   - bpo-30806(42): Fix the string representation of a netrc object.

   - bpo-15037(43): Added a workaround for getkey() in curses for
     ncurses 5.7 and earlier.

   - bpo-25351(44): Avoid venv activate failures with undefined
     variables

   - bpo-25532(45): inspect.unwrap() will now only try to unwrap an
     object sys.getrecursionlimit() times, to protect against objects
     which create a new object on every attribute access.

   - bpo-30347(46): Stop crashes when concurrently iterate over
     itertools.groupby() iterators.

   - bpo-31516(47): ‘threading.current_thread()’ should not return a
     dummy thread at shutdown.

   - bpo-31351(48): python -m ensurepip now exits with non-zero exit
     code if pip bootstrapping has failed.

   - bpo-31482(49): ‘random.seed()’ now works with bytes in version=1

   - bpo-31334(50): Fix ‘poll.poll([timeout])’ in the ‘select’ module
     for arbitrary negative timeouts on all OSes where it can only be a
     non-negative integer or -1.  Patch by Riccardo Coccioli.

   - bpo-31310(51): multiprocessing's semaphore tracker should be
     launched again if crashed.

   - bpo-31308(52): Make multiprocessing's forkserver process immune to
     Ctrl-C and other user interruptions.  If it crashes, restart it
     when necessary.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27240

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30788

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31831

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32182

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32186

   (7) https://bugs.python.org/issue?@action=redirect&bpo=12239

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31325

   (9) https://bugs.python.org/issue?@action=redirect&bpo=12382

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32110

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32072

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32034

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32015

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32011

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31970

   (16) https://bugs.python.org/issue?@action=redirect&bpo=9678

   (17) https://bugs.python.org/issue?@action=redirect&bpo=30057

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31933

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31927

   (20) https://bugs.python.org/issue?@action=redirect&bpo=27666

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31897

   (22) https://bugs.python.org/issue?@action=redirect&bpo=25720

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31893

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31891

   (25) https://bugs.python.org/issue?@action=redirect&bpo=28416

   (26) https://bugs.python.org/issue?@action=redirect&bpo=28326

   (27) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (28) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (29) https://bugs.python.org/issue?@action=redirect&bpo=31806

   (30) https://bugs.python.org/issue?@action=redirect&bpo=28603

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30058

   (32) https://bugs.python.org/issue?@action=redirect&bpo=31770

   (33) https://bugs.python.org/issue?@action=redirect&bpo=31672

   (34) https://bugs.python.org/issue?@action=redirect&bpo=31764

   (35) https://bugs.python.org/issue?@action=redirect&bpo=31752

   (36) https://bugs.python.org/issue?@action=redirect&bpo=31701

   (37) https://bugs.python.org/issue?@action=redirect&bpo=31728

   (38) https://bugs.python.org/issue?@action=redirect&bpo=31620

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31632

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31675

   (41) https://bugs.python.org/issue?@action=redirect&bpo=31673

   (42) https://bugs.python.org/issue?@action=redirect&bpo=30806

   (43) https://bugs.python.org/issue?@action=redirect&bpo=15037

   (44) https://bugs.python.org/issue?@action=redirect&bpo=25351

   (45) https://bugs.python.org/issue?@action=redirect&bpo=25532

   (46) https://bugs.python.org/issue?@action=redirect&bpo=30347

   (47) https://bugs.python.org/issue?@action=redirect&bpo=31516

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31351

   (49) https://bugs.python.org/issue?@action=redirect&bpo=31482

   (50) https://bugs.python.org/issue?@action=redirect&bpo=31334

   (51) https://bugs.python.org/issue?@action=redirect&bpo=31310

   (52) https://bugs.python.org/issue?@action=redirect&bpo=31308


File: python.info,  Node: ドキュメント<69>,  Next: テスト<71>,  Prev: ライブラリ<181>,  Up: Python 3 6 4 release candidate 1

1.26.78.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: テスト<71>,  Next: ビルド<75>,  Prev: ドキュメント<69>,  Up: Python 3 6 4 release candidate 1

1.26.78.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: ビルド<75>,  Next: Windows<66>,  Prev: テスト<71>,  Up: Python 3 6 4 release candidate 1

1.26.78.5 ビルド
................

   - bpo-32059(1): ‘detect_modules()’ in ‘setup.py’ now also searches
     the sysroot paths when cross-compiling.

   - bpo-31957(2): Fixes Windows SDK version detection when building for
     Windows.

   - bpo-31609(3): Fixes quotes in PCbuild/clean.bat

   - bpo-31934(4): Abort the build when building out of a not clean
     source tree.

   - bpo-31926(5): Fixed Argument Clinic sometimes causing compilation
     errors when there was more than one function and/or method in a .c
     file with the same name.

   - bpo-28791(6): Update Windows builds to use SQLite 3.21.0.

   - bpo-28791(7): Update OS X installer to use SQLite 3.21.0.

   - bpo-22140(8): Prevent double substitution of prefix in
     python-config.sh.

   - bpo-31536(9): Avoid wholesale rebuild after ‘make regen-all’ if
     nothing changed.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32059

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31957

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31609

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31934

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31926

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28791

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28791

   (8) https://bugs.python.org/issue?@action=redirect&bpo=22140

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31536


File: python.info,  Node: Windows<66>,  Next: macOS<52>,  Prev: ビルド<75>,  Up: Python 3 6 4 release candidate 1

1.26.78.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<52>,  Next: IDLE<49>,  Prev: Windows<66>,  Up: Python 3 6 4 release candidate 1

1.26.78.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<44>,  Prev: macOS<52>,  Up: Python 3 6 4 release candidate 1

1.26.78.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<44>,  Next: C API<68>,  Prev: IDLE<49>,  Up: Python 3 6 4 release candidate 1

1.26.78.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<68>,  Prev: Tools/Demos<44>,  Up: Python 3 6 4 release candidate 1

1.26.78.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.26.79 Python 3.6.3 final
--------------------------

'Release date: 2017-10-03'

* Menu:

* ライブラリ: ライブラリ<182>.
* ビルド: ビルド<76>.


File: python.info,  Node: ライブラリ<182>,  Next: ビルド<76>,  Up: Python 3 6 3 final

1.26.79.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: ビルド<76>,  Prev: ライブラリ<182>,  Up: Python 3 6 3 final

1.26.79.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.26.80 Python 3.6.3 release candidate 1
----------------------------------------

'Release date: 2017-09-18'

* Menu:

* セキュリティ: セキュリティ<50>.
* Core and Builtins: Core and Builtins<180>.
* ライブラリ: ライブラリ<183>.
* ドキュメント: ドキュメント<70>.
* テスト: テスト<72>.
* ビルド: ビルド<77>.
* Windows: Windows<67>.
* IDLE: IDLE<50>.
* Tools/Demos: Tools/Demos<45>.


File: python.info,  Node: セキュリティ<50>,  Next: Core and Builtins<180>,  Up: Python 3 6 3 release candidate 1

1.26.80.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<180>,  Next: ライブラリ<183>,  Prev: セキュリティ<50>,  Up: Python 3 6 3 release candidate 1

1.26.80.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: ライブラリ<183>,  Next: ドキュメント<70>,  Prev: Core and Builtins<180>,  Up: Python 3 6 3 release candidate 1

1.26.80.3 ライブラリ
....................

   - bpo-31499(1): xml.etree: Fix a crash when a parser is part of a
     reference cycle.

   - bpo-28556(2): typing.get_type_hints now finds the right globalns
     for classes and modules by default (when no ‘globalns’ was
     specified by the caller).

   - bpo-28556(3): Speed improvements to the ‘typing’ module.  Original
     PRs by Ivan Levkivskyi and Mitar.

   - bpo-31544(4): The C accelerator module of ElementTree ignored
     exceptions raised when looking up TreeBuilder target methods in
     XMLParser().

   - bpo-31234(5): socket.create_connection() now fixes manually a
     reference cycle: clear the variable storing the last exception on
     success.

   - bpo-31457(6): LoggerAdapter objects can now be nested.

   - bpo-31400(7): Improves SSL error handling to avoid losing error
     numbers.

   - bpo-28958(8): ssl.SSLContext() now uses OpenSSL error information
     when a context cannot be instantiated.

   - bpo-27340(9): SSLSocket.sendall() now uses memoryview to create
     slices of data.  This fixes support for all bytes-like object.  It
     is also more efficient and avoids costly copies.

   - bpo-31178(10): Fix string concatenation bug in rare error path in
     the subprocess module

   - bpo-31350(11): Micro-optimize ‘asyncio._get_running_loop()’ to
     become up to 10% faster.

   - bpo-31170(12): expat: Update libexpat from 2.2.3 to 2.2.4.  Fix
     copying of partial characters for UTF-8 input (libexpat bug 115):
     ‘https://github.com/libexpat/libexpat/issues/115’

   - bpo-29136(13): Add TLS 1.3 cipher suites and OP_NO_TLSv1_3.

   - bpo-29212(14): Fix concurrent.futures.thread.ThreadPoolExecutor
     threads to have a non repr() based thread name by default when no
     thread_name_prefix is supplied.  They will now identify themselves
     as "ThreadPoolExecutor-y_n".

   - bpo-9146(15): Fix a segmentation fault in _hashopenssl when
     standard hash functions such as md5 are not available in the linked
     OpenSSL library.  As in some special FIPS-140 build environments.

   - bpo-27144(16): The ‘map()’ and ‘as_completed()’ iterators in
     ‘concurrent.futures’ now avoid keeping a reference to yielded
     objects.

   - bpo-10746(17): Fix ctypes producing wrong PEP 3118(18) type codes
     for integer types.

   - bpo-22536(19): The subprocess module now sets the filename when
     FileNotFoundError is raised on POSIX systems due to the executable
     or cwd not being found.

   - bpo-31249(20): concurrent.futures: WorkItem.run() used by
     ThreadPoolExecutor now breaks a reference cycle between an
     exception object and the WorkItem object.

   - bpo-31247(21): xmlrpc.server now explicitly breaks reference cycles
     when using sys.exc_info() in code handling exceptions.

   - bpo-30102(22): The ssl and hashlib modules now call
     OPENSSL_add_all_algorithms_noconf() on OpenSSL < 1.1.0.  The
     function detects CPU features and enables optimizations on some CPU
     architectures such as POWER8.  Patch is based on research from
     Gustavo Serra Scalet.

   - bpo-31185(23): Fixed miscellaneous errors in asyncio speedup
     module.

   - bpo-31135(24): ttk: fix the destroy() method of LabeledScale and
     OptionMenu classes.  Call the parent destroy() method even if the
     used attribute doesn't exist.  The LabeledScale.destroy() method
     now also explicitly clears label and scale attributes to help the
     garbage collector to destroy all widgets.

   - bpo-31107(25): Fix ‘copyreg._slotnames()’ mangled attribute
     calculation for classes whose name begins with an underscore.
     Patch by Shane Harvey.

   - bpo-31061(26): Fixed a crash when using asyncio and threads.

   - bpo-30502(27): Fix handling of long oids in ssl.  Based on patch by
     Christian Heimes.

   - bpo-30119(28): ftplib.FTP.putline() now throws ValueError on
     commands that contains CR or LF. Patch by Donghee Na.

   - bpo-30595(29): multiprocessing.Queue.get() with a timeout now polls
     its reader in non-blocking mode if it succeeded to acquire the lock
     but the acquire took longer than the timeout.

   - bpo-29403(30): Fix ‘unittest.mock’'s autospec to not fail on
     method-bound builtin functions.  Patch by Aaron Gallagher.

   - bpo-30961(31): Fix decrementing a borrowed reference in
     tracemalloc.

   - bpo-25684(32): Change ‘ttk.OptionMenu’ radiobuttons to be unique
     across instances of ‘OptionMenu’.

   - bpo-30886(33): Fix multiprocessing.Queue.join_thread(): it now
     waits until the thread completes, even if the thread was started by
     the same process which created the queue.

   - bpo-29854(34): Fix segfault in readline when using readline's
     history-size option.  Patch by Nir Soffer.

   - bpo-30319(35): socket.close() now ignores ECONNRESET error.

   - bpo-30828(36): Fix out of bounds write in
     ‘asyncio.CFuture.remove_done_callback()’.

   - bpo-30807(37): signal.setitimer() may disable the timer when passed
     a tiny value.  Tiny values (such as 1e-6) are valid non-zero values
     for setitimer(), which is specified as taking
     microsecond-resolution intervals.  However, on some platform, our
     conversion routine could convert 1e-6 into a zero interval,
     therefore disabling the timer instead of (re-)scheduling it.

   - bpo-30441(38): Fix bug when modifying os.environ while iterating
     over it

   - bpo-30532(39): Fix email header value parser dropping folding white
     space in certain cases.

   - bpo-30879(40): os.listdir() and os.scandir() now emit bytes names
     when called with bytes-like argument.

   - bpo-30746(41): Prohibited the '=' character in environment variable
     names in ‘os.putenv()’ and ‘os.spawn*()’.

   - bpo-29755(42): Fixed the lgettext() family of functions in the
     gettext module.  They now always return bytes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31499

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31544

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31234

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31400

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28958

   (9) https://bugs.python.org/issue?@action=redirect&bpo=27340

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31178

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31350

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31170

   (13) https://bugs.python.org/issue?@action=redirect&bpo=29136

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29212

   (15) https://bugs.python.org/issue?@action=redirect&bpo=9146

   (16) https://bugs.python.org/issue?@action=redirect&bpo=27144

   (17) https://bugs.python.org/issue?@action=redirect&bpo=10746

   (18) https://peps.python.org/pep-3118/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=22536

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31249

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31247

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30102

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31185

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31135

   (25) https://bugs.python.org/issue?@action=redirect&bpo=31107

   (26) https://bugs.python.org/issue?@action=redirect&bpo=31061

   (27) https://bugs.python.org/issue?@action=redirect&bpo=30502

   (28) https://bugs.python.org/issue?@action=redirect&bpo=30119

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30595

   (30) https://bugs.python.org/issue?@action=redirect&bpo=29403

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30961

   (32) https://bugs.python.org/issue?@action=redirect&bpo=25684

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30886

   (34) https://bugs.python.org/issue?@action=redirect&bpo=29854

   (35) https://bugs.python.org/issue?@action=redirect&bpo=30319

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30828

   (37) https://bugs.python.org/issue?@action=redirect&bpo=30807

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30441

   (39) https://bugs.python.org/issue?@action=redirect&bpo=30532

   (40) https://bugs.python.org/issue?@action=redirect&bpo=30879

   (41) https://bugs.python.org/issue?@action=redirect&bpo=30746

   (42) https://bugs.python.org/issue?@action=redirect&bpo=29755


File: python.info,  Node: ドキュメント<70>,  Next: テスト<72>,  Prev: ライブラリ<183>,  Up: Python 3 6 3 release candidate 1

1.26.80.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: テスト<72>,  Next: ビルド<77>,  Prev: ドキュメント<70>,  Up: Python 3 6 3 release candidate 1

1.26.80.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: ビルド<77>,  Next: Windows<67>,  Prev: テスト<72>,  Up: Python 3 6 3 release candidate 1

1.26.80.6 ビルド
................

   - bpo-30854(1): Fix compile error when compiling -without-threads.
     Patch by Masayuki Yamamoto.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30854


File: python.info,  Node: Windows<67>,  Next: IDLE<50>,  Prev: ビルド<77>,  Up: Python 3 6 3 release candidate 1

1.26.80.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<45>,  Prev: Windows<67>,  Up: Python 3 6 3 release candidate 1

1.26.80.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<45>,  Prev: IDLE<50>,  Up: Python 3 6 3 release candidate 1

1.26.80.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.26.81 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.26.82 Python 3.6.2 release candidate 2
----------------------------------------

'Release date: 2017-07-07'

* Menu:

* セキュリティ: セキュリティ<51>.


File: python.info,  Node: セキュリティ<51>,  Up: Python 3 6 2 release candidate 2

1.26.82.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.26.83 Python 3.6.2 release candidate 1
----------------------------------------

'Release date: 2017-06-17'

* Menu:

* セキュリティ: セキュリティ<52>.
* Core and Builtins: Core and Builtins<181>.
* ライブラリ: ライブラリ<184>.
* IDLE: IDLE<51>.
* C API: C API<69>.
* ビルド: ビルド<78>.
* ドキュメント: ドキュメント<71>.
* Tools/Demos: Tools/Demos<46>.
* テスト: テスト<73>.
* Windows: Windows<68>.


File: python.info,  Node: セキュリティ<52>,  Next: Core and Builtins<181>,  Up: Python 3 6 2 release candidate 1

1.26.83.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<181>,  Next: ライブラリ<184>,  Prev: セキュリティ<52>,  Up: Python 3 6 2 release candidate 1

1.26.83.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: c5b.

   - 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: ライブラリ<184>,  Next: IDLE<51>,  Prev: Core and Builtins<181>,  Up: Python 3 6 2 release candidate 1

1.26.83.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<69>,  Prev: ライブラリ<184>,  Up: Python 3 6 2 release candidate 1

1.26.83.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<69>,  Next: ビルド<78>,  Prev: IDLE<51>,  Up: Python 3 6 2 release candidate 1

1.26.83.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: ビルド<78>,  Next: ドキュメント<71>,  Prev: C API<69>,  Up: Python 3 6 2 release candidate 1

1.26.83.6 ビルド
................

   - bpo-29941(1): Add ‘--with-assertions’ configure flag to explicitly
     enable C ‘assert()’ checks.  Defaults to off.  ‘--with-pydebug’
     implies ‘--with-assertions’.

   - bpo-28787(2): Fix out-of-tree builds of Python when configured with
     ‘--with--dtrace’.

   - bpo-29243(3): Prevent unnecessary rebuilding of Python during ‘make
     test’, ‘make install’ and some other make targets when configured
     with ‘--enable-optimizations’.

   - bpo-23404(4): Don't regenerate generated files based on file
     modification time anymore: the action is now explicit.  Replace
     ‘make touch’ with ‘make regen-all’.

   - bpo-29643(5): Fix ‘--enable-optimization’ didn't work.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29941

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28787

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29243

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23404

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29643


File: python.info,  Node: ドキュメント<71>,  Next: Tools/Demos<46>,  Prev: ビルド<78>,  Up: Python 3 6 2 release candidate 1

1.26.83.7 ドキュメント
......................

   - bpo-30176(1): Add missing attribute related constants in curses
     documentation.

   - bpo-30052(2): the link targets for *note bytes(): 1d2. and *note
     bytearray(): 1d1. are now their respective type definitions, rather
     than the corresponding builtin function entries.  Use *note bytes:
     20a6. and *note bytearray: 20a7. 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<46>,  Next: テスト<73>,  Prev: ドキュメント<71>,  Up: Python 3 6 2 release candidate 1

1.26.83.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: テスト<73>,  Next: Windows<68>,  Prev: Tools/Demos<46>,  Up: Python 3 6 2 release candidate 1

1.26.83.9 テスト
................

   - bpo-30357(1): test_thread: setUp() now uses
     support.threading_setup() and support.threading_cleanup() to wait
     until threads complete to avoid random side effects on following
     tests.  Initial patch written by Grzegorz Grzywacz.

   - bpo-30197(2): Enhanced functions swap_attr() and swap_item() in the
     test.support module.  They now work when delete replaced attribute
     or item inside the with statement.  The old value of the attribute
     or item (or None if it doesn't exist) now will be assigned to the
     target of the "as" clause, if there is one.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30357

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30197


File: python.info,  Node: Windows<68>,  Prev: テスト<73>,  Up: Python 3 6 2 release candidate 1

1.26.83.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.26.84 Python 3.6.1 final
--------------------------

'Release date: 2017-03-21'

* Menu:

* Core and Builtins: Core and Builtins<182>.
* ビルド: ビルド<79>.


File: python.info,  Node: Core and Builtins<182>,  Next: ビルド<79>,  Up: Python 3 6 1 final

1.26.84.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: ビルド<79>,  Prev: Core and Builtins<182>,  Up: Python 3 6 1 final

1.26.84.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.26.85 Python 3.6.1 release candidate 1
----------------------------------------

'Release date: 2017-03-04'

* Menu:

* Core and Builtins: Core and Builtins<183>.
* ライブラリ: ライブラリ<185>.
* IDLE: IDLE<52>.
* Windows: Windows<69>.
* C API: C API<70>.
* ドキュメント: ドキュメント<72>.
* テスト: テスト<74>.
* ビルド: ビルド<80>.


File: python.info,  Node: Core and Builtins<183>,  Next: ライブラリ<185>,  Up: Python 3 6 1 release candidate 1

1.26.85.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: ライブラリ<185>,  Next: IDLE<52>,  Prev: Core and Builtins<183>,  Up: Python 3 6 1 release candidate 1

1.26.85.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<69>,  Prev: ライブラリ<185>,  Up: Python 3 6 1 release candidate 1

1.26.85.3 IDLE
..............

   - bpo-29071(1): IDLE colors f-string prefixes (but not invalid ur
     prefixes).

   - bpo-28572(2): Add 10% to coverage of IDLE's test_configdialog.
     Update and augment description of the configuration system.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29071

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28572


File: python.info,  Node: Windows<69>,  Next: C API<70>,  Prev: IDLE<52>,  Up: Python 3 6 1 release candidate 1

1.26.85.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<70>,  Next: ドキュメント<72>,  Prev: Windows<69>,  Up: Python 3 6 1 release candidate 1

1.26.85.5 C API
...............

   - bpo-27867(1): Function PySlice_GetIndicesEx() is replaced with a
     macro if Py_LIMITED_API is not set or set to the value between
     0x03050400 and 0x03060000 (not including) or 0x03060100 or higher.

   - bpo-29083(2): Fixed the declaration of some public API functions.
     PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not
     available in limited API. PyArg_ValidateKeywordArguments(),
     PyArg_UnpackTuple() and Py_BuildValue() were not available in
     limited API of version < 3.3 when PY_SSIZE_T_CLEAN is defined.

   - bpo-29058(3): All stable API extensions added after Python 3.2 are
     now available only when Py_LIMITED_API is set to the PY_VERSION_HEX
     value of the minimum Python version supporting this API.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27867

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29083

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29058


File: python.info,  Node: ドキュメント<72>,  Next: テスト<74>,  Prev: C API<70>,  Up: Python 3 6 1 release candidate 1

1.26.85.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: テスト<74>,  Next: ビルド<80>,  Prev: ドキュメント<72>,  Up: Python 3 6 1 release candidate 1

1.26.85.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: ビルド<80>,  Prev: テスト<74>,  Up: Python 3 6 1 release candidate 1

1.26.85.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.26.86 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.26.87 Python 3.6.0 release candidate 2
----------------------------------------

'Release date: 2016-12-16'

* Menu:

* Core and Builtins: Core and Builtins<184>.
* Tools/Demos: Tools/Demos<47>.
* Windows: Windows<70>.
* ビルド: ビルド<81>.


File: python.info,  Node: Core and Builtins<184>,  Next: Tools/Demos<47>,  Up: Python 3 6 0 release candidate 2

1.26.87.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<47>,  Next: Windows<70>,  Prev: Core and Builtins<184>,  Up: Python 3 6 0 release candidate 2

1.26.87.2 Tools/Demos
.....................

   - bpo-28770(1): Fix python-gdb.py for fastcalls.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28770


File: python.info,  Node: Windows<70>,  Next: ビルド<81>,  Prev: Tools/Demos<47>,  Up: Python 3 6 0 release candidate 2

1.26.87.3 Windows
.................

   - bpo-28896(1): Deprecate WindowsRegistryFinder.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28896


File: python.info,  Node: ビルド<81>,  Prev: Windows<70>,  Up: Python 3 6 0 release candidate 2

1.26.87.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.26.88 Python 3.6.0 release candidate 1
----------------------------------------

'Release date: 2016-12-06'

* Menu:

* Core and Builtins: Core and Builtins<185>.
* ライブラリ: ライブラリ<186>.
* C API: C API<71>.
* ドキュメント: ドキュメント<73>.
* Tools/Demos: Tools/Demos<48>.


File: python.info,  Node: Core and Builtins<185>,  Next: ライブラリ<186>,  Up: Python 3 6 0 release candidate 1

1.26.88.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: ライブラリ<186>,  Next: C API<71>,  Prev: Core and Builtins<185>,  Up: Python 3 6 0 release candidate 1

1.26.88.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<71>,  Next: ドキュメント<73>,  Prev: ライブラリ<186>,  Up: Python 3 6 0 release candidate 1

1.26.88.3 C API
...............

   - bpo-28808(1): PyUnicode_CompareWithASCIIString() now never raises
     exceptions.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28808


File: python.info,  Node: ドキュメント<73>,  Next: Tools/Demos<48>,  Prev: C API<71>,  Up: Python 3 6 0 release candidate 1

1.26.88.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<48>,  Prev: ドキュメント<73>,  Up: Python 3 6 0 release candidate 1

1.26.88.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.26.89 Python 3.6.0 beta 4
---------------------------

'Release date: 2016-11-21'

* Menu:

* Core and Builtins: Core and Builtins<186>.
* ライブラリ: ライブラリ<187>.
* ドキュメント: ドキュメント<74>.
* テスト: テスト<75>.
* ビルド: ビルド<82>.


File: python.info,  Node: Core and Builtins<186>,  Next: ライブラリ<187>,  Up: Python 3 6 0 beta 4

1.26.89.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: ライブラリ<187>,  Next: ドキュメント<74>,  Prev: Core and Builtins<186>,  Up: Python 3 6 0 beta 4

1.26.89.2 ライブラリ
....................

   - bpo-28752(1): Restored the __reduce__() methods of datetime
     objects.

   - bpo-28727(2): Regular expression patterns, _sre.SRE_Pattern objects
     created by re.compile(), become comparable (only x==y and x!=y
     operators).  This change should fix the bpo-18383(3): don't
     duplicate warning filters when the warnings module is reloaded
     (thing usually only done in unit tests).

   - bpo-20572(4): The subprocess.Popen.wait method's undocumented
     endtime parameter now raises a DeprecationWarning.

   - bpo-25659(5): In ctypes, prevent a crash calling the from_buffer()
     and from_buffer_copy() methods on abstract classes like Array.

   - bpo-19717(6): Makes Path.resolve() succeed on paths that do not
     exist.  Patch by Vajrasky Kok

   - bpo-28563(7): Fixed possible DoS and arbitrary code execution when
     handle plural form selections in the gettext module.  The
     expression parser now supports exact syntax supported by GNU
     gettext.

   - bpo-28387(8): Fixed possible crash in _io.TextIOWrapper deallocator
     when the garbage collector is invoked in other thread.  Based on
     patch by Sebastian Cufre.

   - bpo-28600(9): Optimize loop.call_soon.

   - bpo-28613(10): Fix get_event_loop() return the current loop if
     called from coroutines/callbacks.

   - bpo-28634(11): Fix asyncio.isfuture() to support unittest.Mock.

   - bpo-26081(12): Fix refleak in _asyncio.Future.__iter__().throw.

   - bpo-28639(13): Fix inspect.isawaitable to always return bool Patch
     by Justin Mayfield.

   - bpo-28652(14): Make loop methods reject socket kinds they do not
     support.

   - bpo-28653(15): Fix a refleak in functools.lru_cache.

   - bpo-28703(16): Fix asyncio.iscoroutinefunction to handle Mock
     objects.

   - bpo-28704(17): Fix create_unix_server to support Path-like objects
     (PEP 519).

   - bpo-28720(18): Add collections.abc.AsyncGenerator.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28752

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28727

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18383

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20572

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25659

   (6) https://bugs.python.org/issue?@action=redirect&bpo=19717

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28563

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28387

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28600

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28613

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28634

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26081

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28639

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28652

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28653

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28703

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28704

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28720


File: python.info,  Node: ドキュメント<74>,  Next: テスト<75>,  Prev: ライブラリ<187>,  Up: Python 3 6 0 beta 4

1.26.89.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: テスト<75>,  Next: ビルド<82>,  Prev: ドキュメント<74>,  Up: Python 3 6 0 beta 4

1.26.89.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: ビルド<82>,  Prev: テスト<75>,  Up: Python 3 6 0 beta 4

1.26.89.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.26.90 Python 3.6.0 beta 3
---------------------------

'Release date: 2016-10-31'

* Menu:

* Core and Builtins: Core and Builtins<187>.
* ライブラリ: ライブラリ<188>.
* Windows: Windows<71>.
* ビルド: ビルド<83>.
* テスト: テスト<76>.


File: python.info,  Node: Core and Builtins<187>,  Next: ライブラリ<188>,  Up: Python 3 6 0 beta 3

1.26.90.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: ライブラリ<188>,  Next: Windows<71>,  Prev: Core and Builtins<187>,  Up: Python 3 6 0 beta 3

1.26.90.2 ライブラリ
....................

   - bpo-27517(1): LZMA compressor and decompressor no longer raise
     exceptions if given empty data twice.  Patch by Benjamin Fogle.

   - bpo-28549(2): Fixed segfault in curses's addch() with ncurses6.

   - bpo-28449(3): tarfile.open() with mode "r" or "r:" now tries to
     open a tar file with compression before trying to open it without
     compression.  Otherwise it had 50% chance failed with
     ignore_zeros=True.

   - bpo-23262(4): The webbrowser module now supports Firefox 36+ and
     derived browsers.  Based on patch by Oleg Broytman.

   - bpo-27939(5): Fixed bugs in tkinter.ttk.LabeledScale and
     tkinter.Scale caused by representing the scale as float value
     internally in Tk.  tkinter.IntVar now works if float value is set
     to underlying Tk variable.

   - bpo-18844(6): The various ways of specifying weights for
     random.choices() now produce the same result sequences.

   - bpo-28255(7): calendar.TextCalendar().prmonth() no longer prints a
     space at the start of new line after printing a month's calendar.
     Patch by Xiang Zhang.

   - bpo-20491(8): The textwrap.TextWrapper class now honors
     non-breaking spaces.  Based on patch by Kaarle Ritvanen.

   - bpo-28353(9): os.fwalk() no longer fails on broken links.

   - bpo-28430(10): Fix iterator of C implemented asyncio.Future doesn't
     accept non-None value is passed to it.send(val).

   - bpo-27025(11): Generated names for Tkinter widgets now start by the
     "!"  prefix for readability.

   - bpo-25464(12): Fixed HList.header_exists() in tkinter.tix module by
     addin a workaround to Tix library bug.

   - bpo-28488(13): shutil.make_archive() no longer adds entry "./" to
     ZIP archive.

   - bpo-25953(14): re.sub() now raises an error for invalid numerical
     group reference in replacement template even if the pattern is not
     found in the string.  Error message for invalid group reference now
     includes the group index and the position of the reference.  Based
     on patch by SilentGhost.

   - bpo-18219(15): Optimize csv.DictWriter for large number of columns.
     Patch by Mariatta Wijaya.

   - bpo-28448(16): Fix C implemented asyncio.Future didn't work on
     Windows.

   - bpo-28480(17): Fix error building socket module when multithreading
     is disabled.

   - bpo-24452(18): Make webbrowser support Chrome on Mac OS X.

   - bpo-20766(19): Fix references leaked by pdb in the handling of
     SIGINT handlers.

   - bpo-28492(20): Fix how StopIteration exception is raised in
     _asyncio.Future.

   - bpo-28500(21): Fix asyncio to handle async gens GC from another
     thread.

   - bpo-26923(22): Fix asyncio.Gather to refuse being cancelled once
     all children are done.  Patch by Johannes Ebke.

   - bpo-26796(23): Don't configure the number of workers for default
     threadpool executor.  Initial patch by Hans Lawrenz.

   - bpo-28544(24): Implement asyncio.Task in C.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27517

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28549

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28449

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23262

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27939

   (6) https://bugs.python.org/issue?@action=redirect&bpo=18844

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28255

   (8) https://bugs.python.org/issue?@action=redirect&bpo=20491

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28353

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28430

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27025

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25464

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28488

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25953

   (15) https://bugs.python.org/issue?@action=redirect&bpo=18219

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28448

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28480

   (18) https://bugs.python.org/issue?@action=redirect&bpo=24452

   (19) https://bugs.python.org/issue?@action=redirect&bpo=20766

   (20) https://bugs.python.org/issue?@action=redirect&bpo=28492

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28500

   (22) https://bugs.python.org/issue?@action=redirect&bpo=26923

   (23) https://bugs.python.org/issue?@action=redirect&bpo=26796

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28544


File: python.info,  Node: Windows<71>,  Next: ビルド<83>,  Prev: ライブラリ<188>,  Up: Python 3 6 0 beta 3

1.26.90.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: ビルド<83>,  Next: テスト<76>,  Prev: Windows<71>,  Up: Python 3 6 0 beta 3

1.26.90.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: テスト<76>,  Prev: ビルド<83>,  Up: Python 3 6 0 beta 3

1.26.90.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.26.91 Python 3.6.0 beta 2
---------------------------

'Release date: 2016-10-10'

* Menu:

* Core and Builtins: Core and Builtins<188>.
* ライブラリ: ライブラリ<189>.
* Windows: Windows<72>.
* C API: C API<72>.
* ビルド: ビルド<84>.
* テスト: テスト<77>.


File: python.info,  Node: Core and Builtins<188>,  Next: ライブラリ<189>,  Up: Python 3 6 0 beta 2

1.26.91.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: ライブラリ<189>,  Next: Windows<72>,  Prev: Core and Builtins<188>,  Up: Python 3 6 0 beta 2

1.26.91.2 ライブラリ
....................

   - bpo-27998(1): Fixed bytes path support in os.scandir() on Windows.
     Patch by Eryk Sun.

   - bpo-28317(2): The disassembler now decodes FORMAT_VALUE argument.

   - bpo-26293(3): Fixed writing ZIP files that starts not from the
     start of the file.  Offsets in ZIP file now are relative to the
     start of the archive in conforming to the specification.

   - bpo-28380(4): unittest.mock Mock autospec functions now properly
     support assert_called, assert_not_called, and assert_called_once.

   - bpo-27181(5): remove statistics.geometric_mean and defer until 3.7.

   - bpo-28229(6): lzma module now supports pathlib.

   - bpo-28321(7): Fixed writing non-BMP characters with binary format
     in plistlib.

   - bpo-28225(8): bz2 module now supports pathlib.  Initial patch by
     Ethan Furman.

   - bpo-28227(9): gzip now supports pathlib.  Patch by Ethan Furman.

   - bpo-27358(10): Optimized merging var-keyword arguments and improved
     error message when passing a non-mapping as a var-keyword argument.

   - bpo-28257(11): Improved error message when passing a non-iterable
     as a var-positional argument.  Added opcode
     BUILD_TUPLE_UNPACK_WITH_CALL.

   - bpo-28322(12): Fixed possible crashes when unpickle itertools
     objects from incorrect pickle data.  Based on patch by John Leitch.

   - bpo-28228(13): imghdr now supports pathlib.

   - bpo-28226(14): compileall now supports pathlib.

   - bpo-28314(15): Fix function declaration (C flags) for the
     getiterator() method of xml.etree.ElementTree.Element.

   - bpo-28148(16): Stop using localtime() and gmtime() in the time
     module.  Introduced platform independent _PyTime_localtime API that
     is similar to POSIX localtime_r, but available on all platforms.
     Patch by Ed Schouten.

   - bpo-28253(17): Fixed calendar functions for extreme months: 0001-01
     and 9999-12.  Methods itermonthdays() and itermonthdays2() are
     reimplemented so that they don't call itermonthdates() which can
     cause datetime.date under/overflow.

   - bpo-28275(18): Fixed possible use after free in the decompress()
     methods of the LZMADecompressor and BZ2Decompressor classes.
     Original patch by John Leitch.

   - bpo-27897(19): Fixed possible crash in
     sqlite3.Connection.create_collation() if pass invalid string-like
     object as a name.  Patch by Xiang Zhang.

   - bpo-18844(20): random.choices() now has k as a keyword-only
     argument to improve the readability of common cases and come into
     line with the signature used in other languages.

   - bpo-18893(21): Fix invalid exception handling in
     Lib/ctypes/macholib/dyld.py.  Patch by Madison May.

   - bpo-27611(22): Fixed support of default root window in the
     tkinter.tix module.  Added the master parameter in the DisplayStyle
     constructor.

   - bpo-27348(23): In the traceback module, restore the formatting of
     exception messages like "Exception: None".  This fixes a regression
     introduced in 3.5a2.

   - bpo-25651(24): Allow false values to be used for msg parameter of
     subTest().

   - bpo-27778(25): Fix a memory leak in os.getrandom() when the
     getrandom() is interrupted by a signal and a signal handler raises
     a Python exception.

   - bpo-28200(26): Fix memory leak on Windows in the os module (fix
     path_converter() function).

   - bpo-25400(27): RobotFileParser now correctly returns default values
     for crawl_delay and request_rate.  Initial patch by Peter Wirtz.

   - bpo-27932(28): Prevent memory leak in win32_ver().

   - Fix UnboundLocalError in socket._sendfile_use_sendfile.

   - bpo-28075(29): Check for ERROR_ACCESS_DENIED in Windows
     implementation of os.stat().  Patch by Eryk Sun.

   - bpo-22493(30): Warning message emitted by using inline flags in the
     middle of regular expression now contains a (truncated) regex
     pattern.  Patch by Tim Graham.

   - bpo-25270(31): Prevent codecs.escape_encode() from raising
     SystemError when an empty bytestring is passed.

   - bpo-28181(32): Get antigravity over HTTPS. Patch by Kaartic
     Sivaraam.

   - bpo-25895(33): Enable WebSocket URL schemes in
     urllib.parse.urljoin.  Patch by Gergely Imreh and Markus
     Holtermann.

   - bpo-28114(34): Fix a crash in parse_envlist() when env contains
     byte strings.  Patch by Eryk Sun.

   - bpo-27599(35): Fixed buffer overrun in binascii.b2a_qp() and
     binascii.a2b_qp().

   - bpo-27906(36): Fix socket accept exhaustion during high TCP
     traffic.  Patch by Kevin Conway.

   - bpo-28174(37): Handle when SO_REUSEPORT isn't properly supported.
     Patch by Seth Michael Larson.

   - bpo-26654(38): Inspect functools.partial in
     asyncio.Handle.__repr__.  Patch by iceboy.

   - bpo-26909(39): Fix slow pipes IO in asyncio.  Patch by INADA Naoki.

   - bpo-28176(40): Fix callbacks race in
     asyncio.SelectorLoop.sock_connect.

   - bpo-27759(41): Fix selectors incorrectly retain invalid file
     descriptors.  Patch by Mark Williams.

   - bpo-28368(42): Refuse monitoring processes if the child watcher has
     no loop attached.  Patch by Vincent Michel.

   - bpo-28369(43): Raise RuntimeError when transport's FD is used with
     add_reader, add_writer, etc.

   - bpo-28370(44): Speedup asyncio.StreamReader.readexactly.  Patch by
     Коренберг Марк.

   - bpo-28371(45): Deprecate passing asyncio.Handles to
     run_in_executor.

   - bpo-28372(46): Fix asyncio to support formatting of non-python
     coroutines.

   - bpo-28399(47): Remove UNIX socket from FS before binding.  Patch by
     Коренберг Марк.

   - bpo-27972(48): Prohibit Tasks to await on themselves.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27998

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28317

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26293

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28380

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27181

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28229

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28321

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28225

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28227

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27358

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28257

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28322

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28228

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28226

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28314

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28148

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28253

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28275

   (19) https://bugs.python.org/issue?@action=redirect&bpo=27897

   (20) https://bugs.python.org/issue?@action=redirect&bpo=18844

   (21) https://bugs.python.org/issue?@action=redirect&bpo=18893

   (22) https://bugs.python.org/issue?@action=redirect&bpo=27611

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27348

   (24) https://bugs.python.org/issue?@action=redirect&bpo=25651

   (25) https://bugs.python.org/issue?@action=redirect&bpo=27778

   (26) https://bugs.python.org/issue?@action=redirect&bpo=28200

   (27) https://bugs.python.org/issue?@action=redirect&bpo=25400

   (28) https://bugs.python.org/issue?@action=redirect&bpo=27932

   (29) https://bugs.python.org/issue?@action=redirect&bpo=28075

   (30) https://bugs.python.org/issue?@action=redirect&bpo=22493

   (31) https://bugs.python.org/issue?@action=redirect&bpo=25270

   (32) https://bugs.python.org/issue?@action=redirect&bpo=28181

   (33) https://bugs.python.org/issue?@action=redirect&bpo=25895

   (34) https://bugs.python.org/issue?@action=redirect&bpo=28114

   (35) https://bugs.python.org/issue?@action=redirect&bpo=27599

   (36) https://bugs.python.org/issue?@action=redirect&bpo=27906

   (37) https://bugs.python.org/issue?@action=redirect&bpo=28174

   (38) https://bugs.python.org/issue?@action=redirect&bpo=26654

   (39) https://bugs.python.org/issue?@action=redirect&bpo=26909

   (40) https://bugs.python.org/issue?@action=redirect&bpo=28176

   (41) https://bugs.python.org/issue?@action=redirect&bpo=27759

   (42) https://bugs.python.org/issue?@action=redirect&bpo=28368

   (43) https://bugs.python.org/issue?@action=redirect&bpo=28369

   (44) https://bugs.python.org/issue?@action=redirect&bpo=28370

   (45) https://bugs.python.org/issue?@action=redirect&bpo=28371

   (46) https://bugs.python.org/issue?@action=redirect&bpo=28372

   (47) https://bugs.python.org/issue?@action=redirect&bpo=28399

   (48) https://bugs.python.org/issue?@action=redirect&bpo=27972


File: python.info,  Node: Windows<72>,  Next: C API<72>,  Prev: ライブラリ<189>,  Up: Python 3 6 0 beta 2

1.26.91.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<72>,  Next: ビルド<84>,  Prev: Windows<72>,  Up: Python 3 6 0 beta 2

1.26.91.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: ビルド<84>,  Next: テスト<77>,  Prev: C API<72>,  Up: Python 3 6 0 beta 2

1.26.91.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: テスト<77>,  Prev: ビルド<84>,  Up: Python 3 6 0 beta 2

1.26.91.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.26.92 Python 3.6.0 beta 1
---------------------------

'Release date: 2016-09-12'

* Menu:

* Core and Builtins: Core and Builtins<189>.
* ライブラリ: ライブラリ<190>.
* IDLE: IDLE<53>.
* C API: C API<73>.
* テスト: テスト<78>.
* ビルド: ビルド<85>.
* Tools/Demos: Tools/Demos<49>.
* Windows: Windows<73>.


File: python.info,  Node: Core and Builtins<189>,  Next: ライブラリ<190>,  Up: Python 3 6 0 beta 1

1.26.92.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: ライブラリ<190>,  Next: IDLE<53>,  Prev: Core and Builtins<189>,  Up: Python 3 6 0 beta 1

1.26.92.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(): 936. 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(): 107f. 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<73>,  Prev: ライブラリ<190>,  Up: Python 3 6 0 beta 1

1.26.92.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<73>,  Next: テスト<78>,  Prev: IDLE<53>,  Up: Python 3 6 0 beta 1

1.26.92.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: テスト<78>,  Next: ビルド<85>,  Prev: C API<73>,  Up: Python 3 6 0 beta 1

1.26.92.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: ビルド<85>,  Next: Tools/Demos<49>,  Prev: テスト<78>,  Up: Python 3 6 0 beta 1

1.26.92.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<49>,  Next: Windows<73>,  Prev: ビルド<85>,  Up: Python 3 6 0 beta 1

1.26.92.7 Tools/Demos
.....................

   - bpo-27952(1): Get Tools/scripts/fixcid.py working with Python 3 and
     the current "re" module, avoid invalid Python backslash escapes,
     and fix a bug parsing escaped C quote signs.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27952


File: python.info,  Node: Windows<73>,  Prev: Tools/Demos<49>,  Up: Python 3 6 0 beta 1

1.26.92.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.26.93 Python 3.6.0 alpha 4
----------------------------

'Release date: 2016-08-15'

* Menu:

* Core and Builtins: Core and Builtins<190>.
* ライブラリ: ライブラリ<191>.
* IDLE: IDLE<54>.
* テスト: テスト<79>.
* Windows: Windows<74>.
* ビルド: ビルド<86>.


File: python.info,  Node: Core and Builtins<190>,  Next: ライブラリ<191>,  Up: Python 3 6 0 alpha 4

1.26.93.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: ライブラリ<191>,  Next: IDLE<54>,  Prev: Core and Builtins<190>,  Up: Python 3 6 0 alpha 4

1.26.93.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: テスト<79>,  Prev: ライブラリ<191>,  Up: Python 3 6 0 alpha 4

1.26.93.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: テスト<79>,  Next: Windows<74>,  Prev: IDLE<54>,  Up: Python 3 6 0 alpha 4

1.26.93.4 テスト
................

   - bpo-25805(1): Skip a test in test_pkgutil as needed that doesn't
     work when ‘__name__ == __main__’.  Patch by SilentGhost.

   - bpo-27472(2): Add test.support.unix_shell as the path to the
     default shell.

   - bpo-27369(3): In test_pyexpat, avoid testing an error message
     detail that changed in Expat 2.2.0.

   - bpo-27594(4): Prevent assertion error when running test_ast with
     coverage enabled: ensure code object has a valid first line number.
     Patch suggested by Ivan Levkivskyi.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25805

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27472

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27369

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27594


File: python.info,  Node: Windows<74>,  Next: ビルド<86>,  Prev: テスト<79>,  Up: Python 3 6 0 alpha 4

1.26.93.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: ビルド<86>,  Prev: Windows<74>,  Up: Python 3 6 0 alpha 4

1.26.93.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.26.94 Python 3.6.0 alpha 3
----------------------------

'Release date: 2016-07-11'

* Menu:

* セキュリティ: セキュリティ<53>.
* Core and Builtins: Core and Builtins<191>.
* ライブラリ: ライブラリ<192>.
* IDLE: IDLE<55>.
* C API: C API<74>.
* ビルド: ビルド<87>.
* Tools/Demos: Tools/Demos<50>.
* ドキュメント: ドキュメント<75>.
* テスト: テスト<80>.


File: python.info,  Node: セキュリティ<53>,  Next: Core and Builtins<191>,  Up: Python 3 6 0 alpha 3

1.26.94.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<191>,  Next: ライブラリ<192>,  Prev: セキュリティ<53>,  Up: Python 3 6 0 alpha 3

1.26.94.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: ライブラリ<192>,  Next: IDLE<55>,  Prev: Core and Builtins<191>,  Up: Python 3 6 0 alpha 3

1.26.94.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<74>,  Prev: ライブラリ<192>,  Up: Python 3 6 0 alpha 3

1.26.94.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<74>,  Next: ビルド<87>,  Prev: IDLE<55>,  Up: Python 3 6 0 alpha 3

1.26.94.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: ビルド<87>,  Next: Tools/Demos<50>,  Prev: C API<74>,  Up: Python 3 6 0 alpha 3

1.26.94.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<50>,  Next: ドキュメント<75>,  Prev: ビルド<87>,  Up: Python 3 6 0 alpha 3

1.26.94.7 Tools/Demos
.....................

   - bpo-27332(1): Fixed the type of the first argument of module-level
     functions generated by Argument Clinic.  Patch by Petr Viktorin.

   - bpo-27418(2): Fixed Tools/importbench/importbench.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27332

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27418


File: python.info,  Node: ドキュメント<75>,  Next: テスト<80>,  Prev: Tools/Demos<50>,  Up: Python 3 6 0 alpha 3

1.26.94.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: テスト<80>,  Prev: ドキュメント<75>,  Up: Python 3 6 0 alpha 3

1.26.94.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.26.95 Python 3.6.0 alpha 2
----------------------------

'Release date: 2016-06-13'

* Menu:

* セキュリティ: セキュリティ<54>.
* Core and Builtins: Core and Builtins<192>.
* ライブラリ: ライブラリ<193>.
* IDLE: IDLE<56>.
* ドキュメント: ドキュメント<76>.
* テスト: テスト<81>.
* Windows: Windows<75>.
* ビルド: ビルド<88>.
* C API: C API<75>.
* Tools/Demos: Tools/Demos<51>.


File: python.info,  Node: セキュリティ<54>,  Next: Core and Builtins<192>,  Up: Python 3 6 0 alpha 2

1.26.95.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(): 936. 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<192>,  Next: ライブラリ<193>,  Prev: セキュリティ<54>,  Up: Python 3 6 0 alpha 2

1.26.95.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: ライブラリ<193>,  Next: IDLE<56>,  Prev: Core and Builtins<192>,  Up: Python 3 6 0 alpha 2

1.26.95.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: 81. 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: db.  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: ドキュメント<76>,  Prev: ライブラリ<193>,  Up: Python 3 6 0 alpha 2

1.26.95.4 IDLE
..............

   - bpo-5124(1): Paste with text selected now replaces the selection on
     X11.  This matches how paste works on Windows, Mac, most modern
     Linux apps, and ttk widgets.  Original patch by Serhiy Storchaka.

   - bpo-24750(2): Switch all scrollbars in IDLE to ttk versions.  Where
     needed, minimal tests are added to cover changes.

   - bpo-24759(3): IDLE requires tk 8.5 and availability ttk widgets.
     Delete now unneeded tk version tests and code for older versions.
     Add test for IDLE syntax colorizer.

   - bpo-27239(4): idlelib.macosx.isXyzTk functions initialize as
     needed.

   - bpo-27262(5): move Aqua unbinding code, which enable context menus,
     to macosx.

   - bpo-24759(6): Make clear in idlelib.idle_test.__init__ that the
     directory is a private implementation of test.test_idle and tool
     for maintainers.

   - bpo-27196(7): Stop 'ThemeChanged' warnings when running IDLE tests.
     These persisted after other warnings were suppressed in #20567.
     Apply Serhiy Storchaka's update_idletasks solution to four test
     files.  Record this additional advice in idle_test/README.txt

   - bpo-20567(8): Revise idle_test/README.txt with advice about
     avoiding tk warning messages from tests.  Apply advice to several
     IDLE tests.

   - bpo-24225(9): Update idlelib/README.txt with new file names and
     event handlers.

   - bpo-27156(10): Remove obsolete code not used by IDLE.

   - bpo-27117(11): Make colorizer htest and turtledemo work with dark
     themes.  Move code for configuring text widget colors to a new
     function.

   - bpo-24225(12): Rename many ‘idlelib/*.py’ and ‘idle_test/test_*.py’
     files.  Edit files to replace old names with new names when the old
     name referred to the module rather than the class it contained.
     See the issue and IDLE section in What's New in 3.6 for more.

   - bpo-26673(13): When tk reports font size as 0, change to size 10.
     Such fonts on Linux prevented the configuration dialog from
     opening.

   - bpo-21939(14): Add test for IDLE's percolator.  Original patch by
     Saimadhav Heblikar.

   - bpo-21676(15): Add test for IDLE's replace dialog.  Original patch
     by Saimadhav Heblikar.

   - bpo-18410(16): Add test for IDLE's search dialog.  Original patch
     by Westley Martínez.

   - bpo-21703(17): Add test for undo delegator.  Patch mostly by
     Saimadhav Heblikar .

   - bpo-27044(18): Add ConfigDialog.remove_var_callbacks to stop memory
     leaks.

   - bpo-23977(19): Add more asserts to test_delegator.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5124

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24750

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24759

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27239

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27262

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24759

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27196

   (8) https://bugs.python.org/issue?@action=redirect&bpo=20567

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24225

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27156

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27117

   (12) https://bugs.python.org/issue?@action=redirect&bpo=24225

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26673

   (14) https://bugs.python.org/issue?@action=redirect&bpo=21939

   (15) https://bugs.python.org/issue?@action=redirect&bpo=21676

   (16) https://bugs.python.org/issue?@action=redirect&bpo=18410

   (17) https://bugs.python.org/issue?@action=redirect&bpo=21703

   (18) https://bugs.python.org/issue?@action=redirect&bpo=27044

   (19) https://bugs.python.org/issue?@action=redirect&bpo=23977


File: python.info,  Node: ドキュメント<76>,  Next: テスト<81>,  Prev: IDLE<56>,  Up: Python 3 6 0 alpha 2

1.26.95.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: テスト<81>,  Next: Windows<75>,  Prev: ドキュメント<76>,  Up: Python 3 6 0 alpha 2

1.26.95.6 テスト
................

   - bpo-25285(1): regrtest now uses subprocesses when the -j1 command
     line option is used: each test file runs in a fresh child process.
     Before, the -j1 option was ignored.

   - bpo-25285(2): Tools/buildbot/test.bat script now uses -j1 by
     default to run each test file in fresh child process.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25285

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25285


File: python.info,  Node: Windows<75>,  Next: ビルド<88>,  Prev: テスト<81>,  Up: Python 3 6 0 alpha 2

1.26.95.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: ビルド<88>,  Next: C API<75>,  Prev: Windows<75>,  Up: Python 3 6 0 alpha 2

1.26.95.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<75>,  Next: Tools/Demos<51>,  Prev: ビルド<88>,  Up: Python 3 6 0 alpha 2

1.26.95.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<51>,  Prev: C API<75>,  Up: Python 3 6 0 alpha 2

1.26.95.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.26.96 Python 3.6.0 alpha 1
----------------------------

'Release date: 2016-05-16'

* Menu:

* セキュリティ: セキュリティ<55>.
* Core and Builtins: Core and Builtins<193>.
* ライブラリ: ライブラリ<194>.
* IDLE: IDLE<57>.
* ドキュメント: ドキュメント<77>.
* テスト: テスト<82>.
* ビルド: ビルド<89>.
* Windows: Windows<76>.
* Tools/Demos: Tools/Demos<52>.
* C API: C API<76>.


File: python.info,  Node: セキュリティ<55>,  Next: Core and Builtins<193>,  Up: Python 3 6 0 alpha 1

1.26.96.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<193>,  Next: ライブラリ<194>,  Prev: セキュリティ<55>,  Up: Python 3 6 0 alpha 1

1.26.96.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(): 1027.
     domain (*note PYMEM_DOMAIN_MEM: 102b.) now use the *note pymalloc
     allocator: 3e1. 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(): 1027. family
     are called without holding the GIL.

   - bpo-26564(25): On error, the debug hooks on Python memory
     allocators now use the *note tracemalloc: 108. module to get the
     traceback where a memory block was allocated.

   - bpo-26558(26): The debug hooks on Python memory allocator *note
     PyObject_Malloc(): 102a. now detect when functions are called
     without holding the GIL.

   - bpo-26516(27): Add *note PYTHONMALLOC: 1026. environment variable
     to set the Python memory allocators and/or install debug hooks.

   - bpo-26516(28): The *note PyMem_SetupDebugHooks(): 102c. function
     can now also be used on Python compiled in release mode.

   - bpo-26516(29): The *note PYTHONMALLOCSTATS: 2143. 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: ライブラリ<194>,  Next: IDLE<57>,  Prev: Core and Builtins<193>,  Up: Python 3 6 0 alpha 1

1.26.96.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(): 14c4, catch *note AttributeError: 1b4.
     instead of *note NameError: 66c.  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(): 936. 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: 7a. module now emits an *note
     ImportError: 1c8. rather than a *note TypeError: 29c. if *note
     __import__(): caa. is tried during the Python shutdown process but
     *note sys.path: 19f. is already cleared (set to ‘None’).

   - bpo-21925(60): *note warnings.formatwarning(): 2006. now catches
     exceptions when calling *note linecache.getline(): 4d4. and *note
     tracemalloc.get_object_traceback(): 2145. to be able to log *note
     ResourceWarning: 754. 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: 108. 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():
     10d5. 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(): c08. and *note
     pyclbr.readmodule_ex(): c09. 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: ドキュメント<77>,  Prev: ライブラリ<194>,  Up: Python 3 6 0 alpha 1

1.26.96.4 IDLE
..............

   - bpo-20640(1): Add tests for idlelib.configHelpSourceEdit.  Patch by
     Saimadhav Heblikar.

   - In the 'IDLE-console differences' section of the IDLE doc, clarify
     how running with IDLE affects sys.modules and the standard streams.

   - bpo-25507(2): fix incorrect change in IOBinding that prevented
     printing.  Augment IOBinding htest to include all major IOBinding
     functions.

   - bpo-25905(3): Revert unwanted conversion of ' to ’ RIGHT SINGLE
     QUOTATION MARK in README.txt and open this and NEWS.txt with
     'ascii'.  Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'.

   - bpo-15348(4): Stop the debugger engine (normally in a user process)
     before closing the debugger window (running in the IDLE process).
     This prevents the RuntimeErrors that were being caught and ignored.

   - bpo-24455(5): Prevent IDLE from hanging when a) closing the shell
     while the debugger is active (15347); b) closing the debugger with
     the [X] button (15348); and c) activating the debugger when already
     active (24455).  The patch by Mark Roseman does this by making two
     changes.  1.  Suspend and resume the gui.interaction method with
     the tcl vwait mechanism intended for this purpose (instead of
     root.mainloop & .quit).  2.  In gui.run, allow any existing
     interaction to terminate first.

   - Change 'The program' to 'Your program' in an IDLE 'kill program?'
     message to make it clearer that the program referred to is the
     currently running user program, not IDLE itself.

   - bpo-24750(6): Improve the appearance of the IDLE editor window
     status bar.  Patch by Mark Roseman.

   - bpo-25313(7): Change the handling of new built-in text color themes
     to better address the compatibility problem introduced by the
     addition of IDLE Dark.  Consistently use the revised
     idleConf.CurrentTheme everywhere in idlelib.

   - bpo-24782(8): Extension configuration is now a tab in the IDLE
     Preferences dialog rather than a separate dialog.  The former tabs
     are now a sorted list.  Patch by Mark Roseman.

   - bpo-22726(9): Re-activate the config dialog help button with some
     content about the other buttons and the new IDLE Dark theme.

   - bpo-24820(10): IDLE now has an 'IDLE Dark' built-in text color
     theme.  It is more or less IDLE Classic inverted, with a cobalt
     blue background.  Strings, comments, keywords, ...  are still
     green, red, orange, ...  .  To use it with IDLEs released before
     November 2015, hit the 'Save as New Custom Theme' button and enter
     a new name, such as 'Custom Dark'.  The custom theme will work with
     any IDLE release, and can be modified.

   - bpo-25224(11): README.txt is now an idlelib index for IDLE
     developers and curious users.  The previous user content is now in
     the IDLE doc chapter.  'IDLE' now means 'Integrated Development and
     Learning Environment'.

   - bpo-24820(12): Users can now set breakpoint colors in Settings ->
     Custom Highlighting.  Original patch by Mark Roseman.

   - bpo-24972(13): Inactive selection background now matches active
     selection background, as configured by users, on all systems.
     Found items are now always highlighted on Windows.  Initial patch
     by Mark Roseman.

   - bpo-24570(14): Idle: make calltip and completion boxes appear on
     Macs affected by a tk regression.  Initial patch by Mark Roseman.

   - bpo-24988(15): Idle ScrolledList context menus (used in debugger)
     now work on Mac Aqua.  Patch by Mark Roseman.

   - bpo-24801(16): Make right-click for context menu work on Mac Aqua.
     Patch by Mark Roseman.

   - bpo-25173(17): Associate tkinter messageboxes with a specific
     widget.  For Mac OSX, make them a 'sheet'.  Patch by Mark Roseman.

   - bpo-25198(18): Enhance the initial html viewer now used for Idle
     Help.  Properly indent fixed-pitch text (patch by Mark Roseman).
     Give code snippet a very Sphinx-like light blueish-gray background.
     Re-use initial width and height set by users for shell and editor.
     When the Table of Contents (TOC) menu is used, put the section
     header at the top of the screen.

   - bpo-25225(19): Condense and rewrite Idle doc section on text
     colors.

   - bpo-21995(20): Explain some differences between IDLE and console
     Python.

   - bpo-22820(21): Explain need for 'print' when running file from Idle
     editor.

   - bpo-25224(22): Doc: augment Idle feature list and no-subprocess
     section.

   - bpo-25219(23): Update doc for Idle command line options.  Some were
     missing and notes were not correct.

   - bpo-24861(24): Most of idlelib is private and subject to change.
     Use idleib.idle.* to start Idle.  See idlelib.__init__.__doc__.

   - bpo-25199(25): Idle: add synchronization comments for future
     maintainers.

   - bpo-16893(26): Replace help.txt with help.html for Idle doc
     display.  The new idlelib/help.html is rstripped
     Doc/build/html/library/idle.html.  It looks better than help.txt
     and will better document Idle as released.  The tkinter html viewer
     that works for this file was written by Rose Roseman.  The now
     unused EditorWindow.HelpDialog class and helt.txt file are
     deprecated.

   - bpo-24199(27): Deprecate unused idlelib.idlever with possible
     removal in 3.6.

   - bpo-24790(28): Remove extraneous code (which also create 2 & 3
     conflicts).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20640

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25507

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25905

   (4) https://bugs.python.org/issue?@action=redirect&bpo=15348

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24455

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24750

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25313

   (8) https://bugs.python.org/issue?@action=redirect&bpo=24782

   (9) https://bugs.python.org/issue?@action=redirect&bpo=22726

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24820

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25224

   (12) https://bugs.python.org/issue?@action=redirect&bpo=24820

   (13) https://bugs.python.org/issue?@action=redirect&bpo=24972

   (14) https://bugs.python.org/issue?@action=redirect&bpo=24570

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24988

   (16) https://bugs.python.org/issue?@action=redirect&bpo=24801

   (17) https://bugs.python.org/issue?@action=redirect&bpo=25173

   (18) https://bugs.python.org/issue?@action=redirect&bpo=25198

   (19) https://bugs.python.org/issue?@action=redirect&bpo=25225

   (20) https://bugs.python.org/issue?@action=redirect&bpo=21995

   (21) https://bugs.python.org/issue?@action=redirect&bpo=22820

   (22) https://bugs.python.org/issue?@action=redirect&bpo=25224

   (23) https://bugs.python.org/issue?@action=redirect&bpo=25219

   (24) https://bugs.python.org/issue?@action=redirect&bpo=24861

   (25) https://bugs.python.org/issue?@action=redirect&bpo=25199

   (26) https://bugs.python.org/issue?@action=redirect&bpo=16893

   (27) https://bugs.python.org/issue?@action=redirect&bpo=24199

   (28) https://bugs.python.org/issue?@action=redirect&bpo=24790


File: python.info,  Node: ドキュメント<77>,  Next: テスト<82>,  Prev: IDLE<57>,  Up: Python 3 6 0 alpha 1

1.26.96.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: テスト<82>,  Next: ビルド<89>,  Prev: ドキュメント<77>,  Up: Python 3 6 0 alpha 1

1.26.96.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: ビルド<89>,  Next: Windows<76>,  Prev: テスト<82>,  Up: Python 3 6 0 alpha 1

1.26.96.7 ビルド
................

   - bpo-21277(1): Don't try to link _ctypes with a ffi_convenience
     library.

   - bpo-26884(2): Fix linking extension modules for cross builds.
     Patch by Xavier de Gaye.

   - bpo-26932(3): Fixed support of RTLD_* constants defined as enum
     values, not via macros (in particular on Android).  Patch by Chi
     Hsuan Yen.

   - bpo-22359(4): Disable the rules for running _freeze_importlib and
     pgen when cross-compiling.  The output of these programs is
     normally saved with the source code anyway, and is still
     regenerated when doing a native build.  Patch by Xavier de Gaye.

   - bpo-21668(5): Link audioop, _datetime, _ctypes_test modules to
     libm, except on Mac OS X. Patch written by Chi Hsuan Yen.

   - bpo-25702(6): A -with-lto configure option has been added that will
     enable link time optimizations at build time during a make
     profile-opt.  Some compilers and toolchains are known to not
     produce stable code when using LTO, be sure to test things
     thoroughly before relying on it.  It can provide a few % speed up
     over profile-opt alone.

   - bpo-26624(7): Adds validation of ucrtbase[d].dll version with
     warning for old versions.

   - bpo-17603(8): Avoid error about nonexistent fileblocks.o file by
     using a lower-level check for st_blocks in struct stat.

   - bpo-26079(9): Fixing the build output folder for tix-8.4.3.6.
     Patch by Bjoern Thiel.

   - bpo-26465(10): Update Windows builds to use OpenSSL 1.0.2g.

   - bpo-25348(11): Added ‘--pgo’ and ‘--pgo-job’ arguments to
     ‘PCbuild\build.bat’ for building with Profile-Guided Optimization.
     The old ‘PCbuild\build_pgo.bat’ script is removed.

   - bpo-25827(12): Add support for building with ICC to ‘configure’,
     including a new ‘--with-icc’ flag.

   - bpo-25696(13): Fix installation of Python on UNIX with make -j9.

   - bpo-24986(14): It is now possible to build Python on Windows
     without errors when external libraries are not available.

   - bpo-24421(15): Compile Modules/_math.c once, before building
     extensions.  Previously it could fail to compile properly if the
     math and cmath builds were concurrent.

   - bpo-26465(16): Update OS X 10.5+ 32-bit-only installer to build and
     link with OpenSSL 1.0.2g.

   - bpo-26268(17): Update Windows builds to use OpenSSL 1.0.2f.

   - bpo-25136(18): Support Apple Xcode 7's new textual SDK stub
     libraries.

   - bpo-24324(19): Do not enable unreachable code warnings when using
     gcc as the option does not work correctly in older versions of gcc
     and has been silently removed as of gcc-4.5.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21277

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26884

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26932

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22359

   (5) https://bugs.python.org/issue?@action=redirect&bpo=21668

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25702

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26624

   (8) https://bugs.python.org/issue?@action=redirect&bpo=17603

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26079

   (10) https://bugs.python.org/issue?@action=redirect&bpo=26465

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25348

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25827

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25696

   (14) https://bugs.python.org/issue?@action=redirect&bpo=24986

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24421

   (16) https://bugs.python.org/issue?@action=redirect&bpo=26465

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26268

   (18) https://bugs.python.org/issue?@action=redirect&bpo=25136

   (19) https://bugs.python.org/issue?@action=redirect&bpo=24324


File: python.info,  Node: Windows<76>,  Next: Tools/Demos<52>,  Prev: ビルド<89>,  Up: Python 3 6 0 alpha 1

1.26.96.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<52>,  Next: C API<76>,  Prev: Windows<76>,  Up: Python 3 6 0 alpha 1

1.26.96.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<76>,  Prev: Tools/Demos<52>,  Up: Python 3 6 0 alpha 1

1.26.96.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.26.97 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.26.98 Python 3.5.5 release candidate 1
----------------------------------------

'Release date: 2018-01-23'

* Menu:

* セキュリティ: セキュリティ<56>.
* Core and Builtins: Core and Builtins<194>.
* ライブラリ: ライブラリ<195>.


File: python.info,  Node: セキュリティ<56>,  Next: Core and Builtins<194>,  Up: Python 3 5 5 release candidate 1

1.26.98.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<194>,  Next: ライブラリ<195>,  Prev: セキュリティ<56>,  Up: Python 3 5 5 release candidate 1

1.26.98.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: ライブラリ<195>,  Prev: Core and Builtins<194>,  Up: Python 3 5 5 release candidate 1

1.26.98.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.26.99 Python 3.5.4 final
--------------------------

'Release date: 2017-08-07'

* Menu:

* ライブラリ: ライブラリ<196>.


File: python.info,  Node: ライブラリ<196>,  Up: Python 3 5 4 final

1.26.99.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.26.100 Python 3.5.4 release candidate 1
-----------------------------------------

'Release date: 2017-07-23'

* Menu:

* セキュリティ: セキュリティ<57>.
* Core and Builtins: Core and Builtins<195>.
* ライブラリ: ライブラリ<197>.
* ドキュメント: ドキュメント<78>.
* テスト: テスト<83>.
* ビルド: ビルド<90>.
* Windows: Windows<77>.
* C API: C API<77>.


File: python.info,  Node: セキュリティ<57>,  Next: Core and Builtins<195>,  Up: Python 3 5 4 release candidate 1

1.26.100.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<195>,  Next: ライブラリ<197>,  Prev: セキュリティ<57>,  Up: Python 3 5 4 release candidate 1

1.26.100.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: c5b.

   - 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: ライブラリ<197>,  Next: ドキュメント<78>,  Prev: Core and Builtins<195>,  Up: Python 3 5 4 release candidate 1

1.26.100.3 ライブラリ
.....................

   - bpo-29403(1): Fix ‘unittest.mock’'s autospec to not fail on
     method-bound builtin functions.  Patch by Aaron Gallagher.

   - bpo-30961(2): Fix decrementing a borrowed reference in tracemalloc.

   - bpo-30886(3): Fix multiprocessing.Queue.join_thread(): it now waits
     until the thread completes, even if the thread was started by the
     same process which created the queue.

   - bpo-29854(4): Fix segfault in readline when using readline's
     history-size option.  Patch by Nir Soffer.

   - bpo-30807(5): signal.setitimer() may disable the timer when passed
     a tiny value.  Tiny values (such as 1e-6) are valid non-zero values
     for setitimer(), which is specified as taking
     microsecond-resolution intervals.  However, on some platform, our
     conversion routine could convert 1e-6 into a zero interval,
     therefore disabling the timer instead of (re-)scheduling it.

   - bpo-30441(6): Fix bug when modifying os.environ while iterating
     over it

   - bpo-30532(7): Fix email header value parser dropping folding white
     space in certain cases.

   - bpo-29169(8): Update zlib to 1.2.11.

   - bpo-30879(9): os.listdir() and os.scandir() now emit bytes names
     when called with bytes-like argument.

   - bpo-30746(10): Prohibited the '=' character in environment variable
     names in ‘os.putenv()’ and ‘os.spawn*()’.

   - bpo-29755(11): Fixed the lgettext() family of functions in the
     gettext module.  They now always return bytes.

   - bpo-30645(12): Fix path calculation in imp.load_package(), fixing
     it for cases when a package is only shipped with bytecodes.  Patch
     by Alexandru Ardelean.

   - bpo-23890(13): unittest.TestCase.assertRaises() now manually breaks
     a reference cycle to not keep objects alive longer than expected.

   - bpo-30149(14): inspect.signature() now supports callables with
     variable-argument parameters wrapped with partialmethod.  Patch by
     Donghee Na.

   - bpo-29931(15): Fixed comparison check for ipaddress.ip_interface
     objects.  Patch by Sanjay Sundaresan.

   - bpo-24484(16): Avoid race condition in multiprocessing cleanup.

   - bpo-28994(17): The traceback no longer displayed for SystemExit
     raised in a callback registered by atexit.

   - bpo-30508(18): Don't log exceptions if Task/Future "cancel()"
     method was called.

   - bpo-28556(19): Updates to typing module: Add generic
     AsyncContextManager, add support for ContextManager on all
     versions.  Original PRs by Jelle Zijlstra and Ivan Levkivskyi

   - bpo-29870(20): Fix ssl sockets leaks when connection is aborted in
     asyncio/ssl implementation.  Patch by Michaël Sghaïer.

   - bpo-29743(21): Closing transport during handshake process leaks
     open socket.  Patch by Nikolay Kim

   - bpo-27585(22): Fix waiter cancellation in asyncio.Lock.  Patch by
     Mathieu Sornay.

   - bpo-30418(23): On Windows, subprocess.Popen.communicate() now also
     ignore EINVAL on stdin.write() if the child process is still
     running but closed the pipe.

   - bpo-30378(24): Fix the problem that logging.handlers.SysLogHandler
     cannot handle IPv6 addresses.

   - bpo-29960(25): Preserve generator state when
     _random.Random.setstate() raises an exception.  Patch by Bryan
     Olson.

   - bpo-30414(26): multiprocessing.Queue._feed background running
     thread do not break from main loop on exception.

   - bpo-30003(27): Fix handling escape characters in HZ codec.  Based
     on patch by Ma Lin.

   - bpo-30301(28): Fix AttributeError when using SimpleQueue.empty()
     under 'spawn' and 'forkserver' start methods.

   - bpo-30329(29): imaplib and poplib now catch the Windows socket
     WSAEINVAL error (code 10022) on shutdown(SHUT_RDWR): An invalid
     operation was attempted.  This error occurs sometimes on SSL
     connections.

   - bpo-30375(30): Warnings emitted when compile a regular expression
     now always point to the line in the user code.  Previously they
     could point into inners of the re module if emitted from inside of
     groups or conditionals.

   - bpo-30048(31): Fixed ‘Task.cancel()’ can be ignored when the task
     is running coroutine and the coroutine returned without any more
     ‘await’.

   - bpo-29990(32): Fix range checking in GB18030 decoder.  Original
     patch by Ma Lin.

   - bpo-26293(33): Change resulted because of zipfile breakage.  (See
     also: bpo-29094(34))

   - bpo-30243(35): Removed the __init__ methods of _json's scanner and
     encoder.  Misusing them could cause memory leaks or crashes.  Now
     scanner and encoder objects are completely initialized in the
     __new__ methods.

   - bpo-30185(36): Avoid KeyboardInterrupt tracebacks in forkserver
     helper process when Ctrl-C is received.

   - bpo-28556(37): Various updates to typing module: add
     typing.NoReturn type, use WrapperDescriptorType, minor bug-fixes.
     Original PRs by Jim Fasarakis-Hilliard and Ivan Levkivskyi.

   - bpo-30205(38): Fix getsockname() for unbound AF_UNIX sockets on
     Linux.

   - bpo-30070(39): Fixed leaks and crashes in errors handling in the
     parser module.

   - bpo-30061(40): Fixed crashes in IOBase methods __next__() and
     readlines() when readline() or __next__() respectively return
     non-sizeable object.  Fixed possible other errors caused by not
     checking results of PyObject_Size(), PySequence_Size(), or
     PyMapping_Size().

   - bpo-30068(41): _io._IOBase.readlines will check if it's closed
     first when hint is present.

   - bpo-29694(42): Fixed race condition in pathlib mkdir with flags
     parents=True.  Patch by Armin Rigo.

   - bpo-29692(43): Fixed arbitrary unchaining of RuntimeError
     exceptions in contextlib.contextmanager.  Patch by Siddharth
     Velankar.

   - bpo-29998(44): Pickling and copying ImportError now preserves name
     and path attributes.

   - bpo-29942(45): Fix a crash in itertools.chain.from_iterable when
     encountering long runs of empty iterables.

   - bpo-27863(46): Fixed multiple crashes in ElementTree caused by race
     conditions and wrong types.

   - bpo-28699(47): Fixed a bug in pools in multiprocessing.pool that
     raising an exception at the very first of an iterable may swallow
     the exception or make the program hang.  Patch by Davin Potts and
     Xiang Zhang.

   - bpo-25803(48): Avoid incorrect errors raised by
     Path.mkdir(exist_ok=True) when the OS gives priority to errors such
     as EACCES over EEXIST.

   - bpo-29861(49): Release references to tasks, their arguments and
     their results as soon as they are finished in multiprocessing.Pool.

   - bpo-29884(50): faulthandler: Restore the old sigaltstack during
     teardown.  Patch by Christophe Zeitouny.

   - bpo-25455(51): Fixed crashes in repr of recursive buffered
     file-like objects.

   - bpo-29800(52): Fix crashes in partial.__repr__ if the keys of
     partial.keywords are not strings.  Patch by Michael Seifert.

   - bpo-29742(53): get_extra_info() raises exception if get called on
     closed ssl transport.  Patch by Nikolay Kim.

   - bpo-8256(54): Fixed possible failing or crashing input() if
     attributes "encoding" or "errors" of sys.stdin or sys.stdout are
     not set or are not strings.

   - bpo-28298(55): Fix a bug that prevented array 'Q', 'L' and 'I' from
     accepting big intables (objects that have __int__) as elements.
     Patch by Oren Milman.

   - bpo-29615(56): SimpleXMLRPCDispatcher no longer chains KeyError (or
     any other exception) to exception(s) raised in the dispatched
     methods.  Patch by Petr Motejlek.

   - bpo-29704(57): asyncio.subprocess.SubprocessStreamProtocol no
     longer closes before all pipes are closed.

   - bpo-29703(58): Fix asyncio to support instantiation of new event
     loops in child processes.

   - bpo-29376(59): Fix assertion error in
     threading._DummyThread.is_alive().

   - bpo-29110(60): Fix file object leak in aifc.open() when file is
     given as a filesystem path and is not in valid AIFF format.  Patch
     by Anthony Zhang.

   - bpo-28961(61): Fix unittest.mock._Call helper: don't ignore the
     name parameter anymore.  Patch written by Jiajun Huang.

   - bpo-29532(62): Altering a kwarg dictionary passed to
     functools.partial() no longer affects a partial object after
     creation.

   - bpo-28556(63): Various updates to typing module: typing.Counter,
     typing.ChainMap, improved ABC caching, etc.  Original PRs by Jelle
     Zijlstra, Ivan Levkivskyi, Manuel Krebber, and Łukasz Langa.

   - bpo-29100(64): Fix datetime.fromtimestamp() regression introduced
     in Python 3.6.0: check minimum and maximum years.

   - bpo-29519(65): Fix weakref spewing exceptions during interpreter
     shutdown when used with a rare combination of multiprocessing and
     custom codecs.

   - bpo-29416(66): Prevent infinite loop in pathlib.Path.mkdir

   - bpo-29444(67): Fixed out-of-bounds buffer access in the group()
     method of the match object.  Based on patch by WGH.

   - bpo-29335(68): Fix subprocess.Popen.wait() when the child process
     has exited to a stopped instead of terminated state (ex: when under
     ptrace).

   - bpo-29290(69): Fix a regression in argparse that help messages
     would wrap at non-breaking spaces.

   - bpo-28735(70): Fixed the comparison of mock.MagickMock with
     mock.ANY.

   - bpo-29011(71): Fix an important omission by adding Deque to the
     typing module.

   - bpo-29219(72): Fixed infinite recursion in the repr of
     uninitialized ctypes.CDLL instances.

   - bpo-28969(73): Fixed race condition in C implementation of
     functools.lru_cache.  KeyError could be raised when cached function
     with full cache was simultaneously called from different threads
     with the same uncached arguments.

   - bpo-29142(74): In urllib.request, suffixes in no_proxy environment
     variable with leading dots could match related hostnames again
     (e.g.  .b.c matches a.b.c).  Patch by Milan Oberkirch.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29403

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30961

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30886

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29854

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30807

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30441

   (7) https://bugs.python.org/issue?@action=redirect&bpo=30532

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29169

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30879

   (10) https://bugs.python.org/issue?@action=redirect&bpo=30746

   (11) https://bugs.python.org/issue?@action=redirect&bpo=29755

   (12) https://bugs.python.org/issue?@action=redirect&bpo=30645

   (13) https://bugs.python.org/issue?@action=redirect&bpo=23890

   (14) https://bugs.python.org/issue?@action=redirect&bpo=30149

   (15) https://bugs.python.org/issue?@action=redirect&bpo=29931

   (16) https://bugs.python.org/issue?@action=redirect&bpo=24484

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28994

   (18) https://bugs.python.org/issue?@action=redirect&bpo=30508

   (19) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (20) https://bugs.python.org/issue?@action=redirect&bpo=29870

   (21) https://bugs.python.org/issue?@action=redirect&bpo=29743

   (22) https://bugs.python.org/issue?@action=redirect&bpo=27585

   (23) https://bugs.python.org/issue?@action=redirect&bpo=30418

   (24) https://bugs.python.org/issue?@action=redirect&bpo=30378

   (25) https://bugs.python.org/issue?@action=redirect&bpo=29960

   (26) https://bugs.python.org/issue?@action=redirect&bpo=30414

   (27) https://bugs.python.org/issue?@action=redirect&bpo=30003

   (28) https://bugs.python.org/issue?@action=redirect&bpo=30301

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30329

   (30) https://bugs.python.org/issue?@action=redirect&bpo=30375

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30048

   (32) https://bugs.python.org/issue?@action=redirect&bpo=29990

   (33) https://bugs.python.org/issue?@action=redirect&bpo=26293

   (34) https://bugs.python.org/issue?@action=redirect&bpo=29094

   (35) https://bugs.python.org/issue?@action=redirect&bpo=30243

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30185

   (37) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30205

   (39) https://bugs.python.org/issue?@action=redirect&bpo=30070

   (40) https://bugs.python.org/issue?@action=redirect&bpo=30061

   (41) https://bugs.python.org/issue?@action=redirect&bpo=30068

   (42) https://bugs.python.org/issue?@action=redirect&bpo=29694

   (43) https://bugs.python.org/issue?@action=redirect&bpo=29692

   (44) https://bugs.python.org/issue?@action=redirect&bpo=29998

   (45) https://bugs.python.org/issue?@action=redirect&bpo=29942

   (46) https://bugs.python.org/issue?@action=redirect&bpo=27863

   (47) https://bugs.python.org/issue?@action=redirect&bpo=28699

   (48) https://bugs.python.org/issue?@action=redirect&bpo=25803

   (49) https://bugs.python.org/issue?@action=redirect&bpo=29861

   (50) https://bugs.python.org/issue?@action=redirect&bpo=29884

   (51) https://bugs.python.org/issue?@action=redirect&bpo=25455

   (52) https://bugs.python.org/issue?@action=redirect&bpo=29800

   (53) https://bugs.python.org/issue?@action=redirect&bpo=29742

   (54) https://bugs.python.org/issue?@action=redirect&bpo=8256

   (55) https://bugs.python.org/issue?@action=redirect&bpo=28298

   (56) https://bugs.python.org/issue?@action=redirect&bpo=29615

   (57) https://bugs.python.org/issue?@action=redirect&bpo=29704

   (58) https://bugs.python.org/issue?@action=redirect&bpo=29703

   (59) https://bugs.python.org/issue?@action=redirect&bpo=29376

   (60) https://bugs.python.org/issue?@action=redirect&bpo=29110

   (61) https://bugs.python.org/issue?@action=redirect&bpo=28961

   (62) https://bugs.python.org/issue?@action=redirect&bpo=29532

   (63) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (64) https://bugs.python.org/issue?@action=redirect&bpo=29100

   (65) https://bugs.python.org/issue?@action=redirect&bpo=29519

   (66) https://bugs.python.org/issue?@action=redirect&bpo=29416

   (67) https://bugs.python.org/issue?@action=redirect&bpo=29444

   (68) https://bugs.python.org/issue?@action=redirect&bpo=29335

   (69) https://bugs.python.org/issue?@action=redirect&bpo=29290

   (70) https://bugs.python.org/issue?@action=redirect&bpo=28735

   (71) https://bugs.python.org/issue?@action=redirect&bpo=29011

   (72) https://bugs.python.org/issue?@action=redirect&bpo=29219

   (73) https://bugs.python.org/issue?@action=redirect&bpo=28969

   (74) https://bugs.python.org/issue?@action=redirect&bpo=29142


File: python.info,  Node: ドキュメント<78>,  Next: テスト<83>,  Prev: ライブラリ<197>,  Up: Python 3 5 4 release candidate 1

1.26.100.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: テスト<83>,  Next: ビルド<90>,  Prev: ドキュメント<78>,  Up: Python 3 5 4 release candidate 1

1.26.100.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: ビルド<90>,  Next: Windows<77>,  Prev: テスト<83>,  Up: Python 3 5 4 release candidate 1

1.26.100.6 ビルド
.................

   - bpo-29243(1): Prevent unnecessary rebuilding of Python during ‘make
     test’, ‘make install’ and some other make targets when configured
     with ‘--enable-optimizations’.

   - bpo-23404(2): Don't regenerate generated files based on file
     modification time anymore: the action is now explicit.  Replace
     ‘make touch’ with ‘make regen-all’.

   - bpo-29643(3): Fix ‘--enable-optimization’ didn't work.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29243

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23404

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29643


File: python.info,  Node: Windows<77>,  Next: C API<77>,  Prev: ビルド<90>,  Up: Python 3 5 4 release candidate 1

1.26.100.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<77>,  Prev: Windows<77>,  Up: Python 3 5 4 release candidate 1

1.26.100.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.26.101 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.26.102 Python 3.5.3 release candidate 1
-----------------------------------------

'Release date: 2017-01-02'

* Menu:

* セキュリティ: セキュリティ<58>.
* Core and Builtins: Core and Builtins<196>.
* ライブラリ: ライブラリ<198>.
* IDLE: IDLE<58>.
* C API: C API<78>.
* ドキュメント: ドキュメント<79>.
* テスト: テスト<84>.
* Tools/Demos: Tools/Demos<53>.
* Windows: Windows<78>.
* ビルド: ビルド<91>.


File: python.info,  Node: セキュリティ<58>,  Next: Core and Builtins<196>,  Up: Python 3 5 3 release candidate 1

1.26.102.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<196>,  Next: ライブラリ<198>,  Prev: セキュリティ<58>,  Up: Python 3 5 3 release candidate 1

1.26.102.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: ライブラリ<198>,  Next: IDLE<58>,  Prev: Core and Builtins<196>,  Up: Python 3 5 3 release candidate 1

1.26.102.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<78>,  Prev: ライブラリ<198>,  Up: Python 3 5 3 release candidate 1

1.26.102.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<78>,  Next: ドキュメント<79>,  Prev: IDLE<58>,  Up: Python 3 5 3 release candidate 1

1.26.102.5 C API
................

   - bpo-28808(1): PyUnicode_CompareWithASCIIString() now never raises
     exceptions.

   - bpo-26754(2): PyUnicode_FSDecoder() accepted a filename argument
     encoded as an iterable of integers.  Now only strings and
     bytes-like objects are accepted.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28808

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26754


File: python.info,  Node: ドキュメント<79>,  Next: テスト<84>,  Prev: C API<78>,  Up: Python 3 5 3 release candidate 1

1.26.102.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: テスト<84>,  Next: Tools/Demos<53>,  Prev: ドキュメント<79>,  Up: Python 3 5 3 release candidate 1

1.26.102.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<53>,  Next: Windows<78>,  Prev: テスト<84>,  Up: Python 3 5 3 release candidate 1

1.26.102.8 Tools/Demos
......................

   - bpo-27952(1): Get Tools/scripts/fixcid.py working with Python 3 and
     the current "re" module, avoid invalid Python backslash escapes,
     and fix a bug parsing escaped C quote signs.

   - bpo-27332(2): Fixed the type of the first argument of module-level
     functions generated by Argument Clinic.  Patch by Petr Viktorin.

   - bpo-27418(3): Fixed Tools/importbench/importbench.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27952

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27332

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27418


File: python.info,  Node: Windows<78>,  Next: ビルド<91>,  Prev: Tools/Demos<53>,  Up: Python 3 5 3 release candidate 1

1.26.102.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: ビルド<91>,  Prev: Windows<78>,  Up: Python 3 5 3 release candidate 1

1.26.102.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.26.103 Python 3.5.2 final
---------------------------

'Release date: 2016-06-26'

* Menu:

* Core and Builtins: Core and Builtins<197>.
* テスト: テスト<85>.
* IDLE: IDLE<59>.


File: python.info,  Node: Core and Builtins<197>,  Next: テスト<85>,  Up: Python 3 5 2 final

1.26.103.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: テスト<85>,  Next: IDLE<59>,  Prev: Core and Builtins<197>,  Up: Python 3 5 2 final

1.26.103.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: テスト<85>,  Up: Python 3 5 2 final

1.26.103.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.26.104 Python 3.5.2 release candidate 1
-----------------------------------------

'Release date: 2016-06-12'

* Menu:

* セキュリティ: セキュリティ<59>.
* Core and Builtins: Core and Builtins<198>.
* ライブラリ: ライブラリ<199>.
* IDLE: IDLE<60>.
* ドキュメント: ドキュメント<80>.
* テスト: テスト<86>.
* ビルド: ビルド<92>.
* Windows: Windows<79>.
* Tools/Demos: Tools/Demos<54>.


File: python.info,  Node: セキュリティ<59>,  Next: Core and Builtins<198>,  Up: Python 3 5 2 release candidate 1

1.26.104.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(): 936. 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<198>,  Next: ライブラリ<199>,  Prev: セキュリティ<59>,  Up: Python 3 5 2 release candidate 1

1.26.104.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: ライブラリ<199>,  Next: IDLE<60>,  Prev: Core and Builtins<198>,  Up: Python 3 5 2 release candidate 1

1.26.104.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: db.  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(): 14c4, catch *note AttributeError: 1b4.
     instead of *note NameError: 66c.  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(): 936. 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(): 2006. now catches
     exceptions on ‘linecache.getline(...)’ to be able to log *note
     ResourceWarning: 754. 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(): c08. and *note
     pyclbr.readmodule_ex(): c09. 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: ドキュメント<80>,  Prev: ライブラリ<199>,  Up: Python 3 5 2 release candidate 1

1.26.104.4 IDLE
...............

   - bpo-5124(1): Paste with text selected now replaces the selection on
     X11.  This matches how paste works on Windows, Mac, most modern
     Linux apps, and ttk widgets.  Original patch by Serhiy Storchaka.

   - bpo-24759(2): Make clear in idlelib.idle_test.__init__ that the
     directory is a private implementation of test.test_idle and tool
     for maintainers.

   - bpo-27196(3): Stop 'ThemeChanged' warnings when running IDLE tests.
     These persisted after other warnings were suppressed in #20567.
     Apply Serhiy Storchaka's update_idletasks solution to four test
     files.  Record this additional advice in idle_test/README.txt

   - bpo-20567(4): Revise idle_test/README.txt with advice about
     avoiding tk warning messages from tests.  Apply advice to several
     IDLE tests.

   - bpo-27117(5): Make colorizer htest and turtledemo work with dark
     themes.  Move code for configuring text widget colors to a new
     function.

   - bpo-26673(6): When tk reports font size as 0, change to size 10.
     Such fonts on Linux prevented the configuration dialog from
     opening.

   - bpo-21939(7): Add test for IDLE's percolator.  Original patch by
     Saimadhav Heblikar.

   - bpo-21676(8): Add test for IDLE's replace dialog.  Original patch
     by Saimadhav Heblikar.

   - bpo-18410(9): Add test for IDLE's search dialog.  Original patch by
     Westley Martínez.

   - bpo-21703(10): Add test for IDLE's undo delegator.  Original patch
     by Saimadhav Heblikar .

   - bpo-27044(11): Add ConfigDialog.remove_var_callbacks to stop memory
     leaks.

   - bpo-23977(12): Add more asserts to test_delegator.

   - bpo-20640(13): Add tests for idlelib.configHelpSourceEdit.  Patch
     by Saimadhav Heblikar.

   - In the 'IDLE-console differences' section of the IDLE doc, clarify
     how running with IDLE affects sys.modules and the standard streams.

   - bpo-25507(14): fix incorrect change in IOBinding that prevented
     printing.  Augment IOBinding htest to include all major IOBinding
     functions.

   - bpo-25905(15): Revert unwanted conversion of ' to ’ RIGHT SINGLE
     QUOTATION MARK in README.txt and open this and NEWS.txt with
     'ascii'.  Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5124

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24759

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27196

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20567

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27117

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26673

   (7) https://bugs.python.org/issue?@action=redirect&bpo=21939

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21676

   (9) https://bugs.python.org/issue?@action=redirect&bpo=18410

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21703

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27044

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23977

   (13) https://bugs.python.org/issue?@action=redirect&bpo=20640

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25507

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25905


File: python.info,  Node: ドキュメント<80>,  Next: テスト<86>,  Prev: IDLE<60>,  Up: Python 3 5 2 release candidate 1

1.26.104.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: テスト<86>,  Next: ビルド<92>,  Prev: ドキュメント<80>,  Up: Python 3 5 2 release candidate 1

1.26.104.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: ビルド<92>,  Next: Windows<79>,  Prev: テスト<86>,  Up: Python 3 5 2 release candidate 1

1.26.104.7 ビルド
.................

   - bpo-26884(1): Fix linking extension modules for cross builds.
     Patch by Xavier de Gaye.

   - bpo-22359(2): Disable the rules for running _freeze_importlib and
     pgen when cross-compiling.  The output of these programs is
     normally saved with the source code anyway, and is still
     regenerated when doing a native build.  Patch by Xavier de Gaye.

   - bpo-27229(3): Fix the cross-compiling pgen rule for in-tree builds.
     Patch by Xavier de Gaye.

   - bpo-21668(4): Link audioop, _datetime, _ctypes_test modules to
     libm, except on Mac OS X. Patch written by Xavier de Gaye.

   - bpo-25702(5): A -with-lto configure option has been added that will
     enable link time optimizations at build time during a make
     profile-opt.  Some compilers and toolchains are known to not
     produce stable code when using LTO, be sure to test things
     thoroughly before relying on it.  It can provide a few % speed up
     over profile-opt alone.

   - bpo-26624(6): Adds validation of ucrtbase[d].dll version with
     warning for old versions.

   - bpo-17603(7): Avoid error about nonexistent fileblocks.o file by
     using a lower-level check for st_blocks in struct stat.

   - bpo-26079(8): Fixing the build output folder for tix-8.4.3.6.
     Patch by Bjoern Thiel.

   - bpo-26465(9): Update Windows builds to use OpenSSL 1.0.2g.

   - bpo-24421(10): Compile Modules/_math.c once, before building
     extensions.  Previously it could fail to compile properly if the
     math and cmath builds were concurrent.

   - bpo-25348(11): Added ‘--pgo’ and ‘--pgo-job’ arguments to
     ‘PCbuild\build.bat’ for building with Profile-Guided Optimization.
     The old ‘PCbuild\build_pgo.bat’ script is now deprecated, and
     simply calls ‘PCbuild\build.bat --pgo %*’.

   - bpo-25827(12): Add support for building with ICC to ‘configure’,
     including a new ‘--with-icc’ flag.

   - bpo-25696(13): Fix installation of Python on UNIX with make -j9.

   - bpo-26930(14): Update OS X 10.5+ 32-bit-only installer to build and
     link with OpenSSL 1.0.2h.

   - bpo-26268(15): Update Windows builds to use OpenSSL 1.0.2f.

   - bpo-25136(16): Support Apple Xcode 7's new textual SDK stub
     libraries.

   - bpo-24324(17): Do not enable unreachable code warnings when using
     gcc as the option does not work correctly in older versions of gcc
     and has been silently removed as of gcc-4.5.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26884

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22359

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27229

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21668

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25702

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26624

   (7) https://bugs.python.org/issue?@action=redirect&bpo=17603

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26079

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26465

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24421

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25348

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25827

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25696

   (14) https://bugs.python.org/issue?@action=redirect&bpo=26930

   (15) https://bugs.python.org/issue?@action=redirect&bpo=26268

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25136

   (17) https://bugs.python.org/issue?@action=redirect&bpo=24324


File: python.info,  Node: Windows<79>,  Next: Tools/Demos<54>,  Prev: ビルド<92>,  Up: Python 3 5 2 release candidate 1

1.26.104.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<54>,  Prev: Windows<79>,  Up: Python 3 5 2 release candidate 1

1.26.104.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.26.105 Python 3.5.1 final
---------------------------

'Release date: 2015-12-06'

* Menu:

* Core and Builtins: Core and Builtins<199>.
* Windows: Windows<80>.


File: python.info,  Node: Core and Builtins<199>,  Next: Windows<80>,  Up: Python 3 5 1 final

1.26.105.1 Core and Builtins
............................

   - bpo-25709(1): Fixed problem with in-place string concatenation and
     utf-8 cache.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25709


File: python.info,  Node: Windows<80>,  Prev: Core and Builtins<199>,  Up: Python 3 5 1 final

1.26.105.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.26.106 Python 3.5.1 release candidate 1
-----------------------------------------

'Release date: 2015-11-22'

* Menu:

* Core and Builtins: Core and Builtins<200>.
* ライブラリ: ライブラリ<200>.
* IDLE: IDLE<61>.
* ドキュメント: ドキュメント<81>.
* テスト: テスト<87>.
* ビルド: ビルド<93>.
* Windows: Windows<81>.
* Tools/Demos: Tools/Demos<55>.


File: python.info,  Node: Core and Builtins<200>,  Next: ライブラリ<200>,  Up: Python 3 5 1 release candidate 1

1.26.106.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: ライブラリ<200>,  Next: IDLE<61>,  Prev: Core and Builtins<200>,  Up: Python 3 5 1 release candidate 1

1.26.106.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: ドキュメント<81>,  Prev: ライブラリ<200>,  Up: Python 3 5 1 release candidate 1

1.26.106.3 IDLE
...............

   - bpo-15348(1): Stop the debugger engine (normally in a user process)
     before closing the debugger window (running in the IDLE process).
     This prevents the RuntimeErrors that were being caught and ignored.

   - bpo-24455(2): Prevent IDLE from hanging when a) closing the shell
     while the debugger is active (15347); b) closing the debugger with
     the [X] button (15348); and c) activating the debugger when already
     active (24455).  The patch by Mark Roseman does this by making two
     changes.  1.  Suspend and resume the gui.interaction method with
     the tcl vwait mechanism intended for this purpose (instead of
     root.mainloop & .quit).  2.  In gui.run, allow any existing
     interaction to terminate first.

   - Change 'The program' to 'Your program' in an IDLE 'kill program?'
     message to make it clearer that the program referred to is the
     currently running user program, not IDLE itself.

   - bpo-24750(3): Improve the appearance of the IDLE editor window
     status bar.  Patch by Mark Roseman.

   - bpo-25313(4): Change the handling of new built-in text color themes
     to better address the compatibility problem introduced by the
     addition of IDLE Dark.  Consistently use the revised
     idleConf.CurrentTheme everywhere in idlelib.

   - bpo-24782(5): Extension configuration is now a tab in the IDLE
     Preferences dialog rather than a separate dialog.  The former tabs
     are now a sorted list.  Patch by Mark Roseman.

   - bpo-22726(6): Re-activate the config dialog help button with some
     content about the other buttons and the new IDLE Dark theme.

   - bpo-24820(7): IDLE now has an 'IDLE Dark' built-in text color
     theme.  It is more or less IDLE Classic inverted, with a cobalt
     blue background.  Strings, comments, keywords, ...  are still
     green, red, orange, ...  .  To use it with IDLEs released before
     November 2015, hit the 'Save as New Custom Theme' button and enter
     a new name, such as 'Custom Dark'.  The custom theme will work with
     any IDLE release, and can be modified.

   - bpo-25224(8): README.txt is now an idlelib index for IDLE
     developers and curious users.  The previous user content is now in
     the IDLE doc chapter.  'IDLE' now means 'Integrated Development and
     Learning Environment'.

   - bpo-24820(9): Users can now set breakpoint colors in Settings ->
     Custom Highlighting.  Original patch by Mark Roseman.

   - bpo-24972(10): Inactive selection background now matches active
     selection background, as configured by users, on all systems.
     Found items are now always highlighted on Windows.  Initial patch
     by Mark Roseman.

   - bpo-24570(11): Idle: make calltip and completion boxes appear on
     Macs affected by a tk regression.  Initial patch by Mark Roseman.

   - bpo-24988(12): Idle ScrolledList context menus (used in debugger)
     now work on Mac Aqua.  Patch by Mark Roseman.

   - bpo-24801(13): Make right-click for context menu work on Mac Aqua.
     Patch by Mark Roseman.

   - bpo-25173(14): Associate tkinter messageboxes with a specific
     widget.  For Mac OSX, make them a 'sheet'.  Patch by Mark Roseman.

   - bpo-25198(15): Enhance the initial html viewer now used for Idle
     Help.  Properly indent fixed-pitch text (patch by Mark Roseman).
     Give code snippet a very Sphinx-like light blueish-gray background.
     Re-use initial width and height set by users for shell and editor.
     When the Table of Contents (TOC) menu is used, put the section
     header at the top of the screen.

   - bpo-25225(16): Condense and rewrite Idle doc section on text
     colors.

   - bpo-21995(17): Explain some differences between IDLE and console
     Python.

   - bpo-22820(18): Explain need for 'print' when running file from Idle
     editor.

   - bpo-25224(19): Doc: augment Idle feature list and no-subprocess
     section.

   - bpo-25219(20): Update doc for Idle command line options.  Some were
     missing and notes were not correct.

   - bpo-24861(21): Most of idlelib is private and subject to change.
     Use idleib.idle.* to start Idle.  See idlelib.__init__.__doc__.

   - bpo-25199(22): Idle: add synchronization comments for future
     maintainers.

   - bpo-16893(23): Replace help.txt with help.html for Idle doc
     display.  The new idlelib/help.html is rstripped
     Doc/build/html/library/idle.html.  It looks better than help.txt
     and will better document Idle as released.  The tkinter html viewer
     that works for this file was written by Mark Roseman.  The now
     unused EditorWindow.HelpDialog class and helt.txt file are
     deprecated.

   - bpo-24199(24): Deprecate unused idlelib.idlever with possible
     removal in 3.6.

   - bpo-24790(25): Remove extraneous code (which also create 2 & 3
     conflicts).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15348

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24455

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24750

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25313

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24782

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22726

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24820

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25224

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24820

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24972

   (11) https://bugs.python.org/issue?@action=redirect&bpo=24570

   (12) https://bugs.python.org/issue?@action=redirect&bpo=24988

   (13) https://bugs.python.org/issue?@action=redirect&bpo=24801

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25173

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25198

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25225

   (17) https://bugs.python.org/issue?@action=redirect&bpo=21995

   (18) https://bugs.python.org/issue?@action=redirect&bpo=22820

   (19) https://bugs.python.org/issue?@action=redirect&bpo=25224

   (20) https://bugs.python.org/issue?@action=redirect&bpo=25219

   (21) https://bugs.python.org/issue?@action=redirect&bpo=24861

   (22) https://bugs.python.org/issue?@action=redirect&bpo=25199

   (23) https://bugs.python.org/issue?@action=redirect&bpo=16893

   (24) https://bugs.python.org/issue?@action=redirect&bpo=24199

   (25) https://bugs.python.org/issue?@action=redirect&bpo=24790


File: python.info,  Node: ドキュメント<81>,  Next: テスト<87>,  Prev: IDLE<61>,  Up: Python 3 5 1 release candidate 1

1.26.106.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: テスト<87>,  Next: ビルド<93>,  Prev: ドキュメント<81>,  Up: Python 3 5 1 release candidate 1

1.26.106.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: ビルド<93>,  Next: Windows<81>,  Prev: テスト<87>,  Up: Python 3 5 1 release candidate 1

1.26.106.6 ビルド
.................

   - bpo-24915(1): Add LLVM support for PGO builds and use the test
     suite to generate the profile data.  Initial patch by Alecsandru
     Patrascu of Intel.

   - bpo-24910(2): Windows MSIs now have unique display names.

   - bpo-24986(3): It is now possible to build Python on Windows without
     errors when external libraries are not available.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24915

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24910

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24986


File: python.info,  Node: Windows<81>,  Next: Tools/Demos<55>,  Prev: ビルド<93>,  Up: Python 3 5 1 release candidate 1

1.26.106.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<55>,  Prev: Windows<81>,  Up: Python 3 5 1 release candidate 1

1.26.106.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.26.107 Python 3.5.0 final
---------------------------

'Release date: 2015-09-13'

* Menu:

* ビルド: ビルド<94>.


File: python.info,  Node: ビルド<94>,  Up: Python 3 5 0 final

1.26.107.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.26.108 Python 3.5.0 release candidate 4
-----------------------------------------

'Release date: 2015-09-09'

* Menu:

* ライブラリ: ライブラリ<201>.
* ビルド: ビルド<95>.


File: python.info,  Node: ライブラリ<201>,  Next: ビルド<95>,  Up: Python 3 5 0 release candidate 4

1.26.108.1 ライブラリ
.....................

   - bpo-25029(1): Fixes MemoryError in test_strptime.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25029


File: python.info,  Node: ビルド<95>,  Prev: ライブラリ<201>,  Up: Python 3 5 0 release candidate 4

1.26.108.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.26.109 Python 3.5.0 release candidate 3
-----------------------------------------

'Release date: 2015-09-07'

* Menu:

* Core and Builtins: Core and Builtins<201>.
* ライブラリ: ライブラリ<202>.


File: python.info,  Node: Core and Builtins<201>,  Next: ライブラリ<202>,  Up: Python 3 5 0 release candidate 3

1.26.109.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: ライブラリ<202>,  Prev: Core and Builtins<201>,  Up: Python 3 5 0 release candidate 3

1.26.109.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.26.110 Python 3.5.0 release candidate 2
-----------------------------------------

'Release date: 2015-08-25'

* Menu:

* Core and Builtins: Core and Builtins<202>.
* ライブラリ: ライブラリ<203>.


File: python.info,  Node: Core and Builtins<202>,  Next: ライブラリ<203>,  Up: Python 3 5 0 release candidate 2

1.26.110.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: ライブラリ<203>,  Prev: Core and Builtins<202>,  Up: Python 3 5 0 release candidate 2

1.26.110.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.26.111 Python 3.5.0 release candidate 1
-----------------------------------------

'Release date: 2015-08-09'

* Menu:

* Core and Builtins: Core and Builtins<203>.
* ライブラリ: ライブラリ<204>.
* IDLE: IDLE<62>.
* ドキュメント: ドキュメント<82>.
* テスト: テスト<88>.


File: python.info,  Node: Core and Builtins<203>,  Next: ライブラリ<204>,  Up: Python 3 5 0 release candidate 1

1.26.111.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: ライブラリ<204>,  Next: IDLE<62>,  Prev: Core and Builtins<203>,  Up: Python 3 5 0 release candidate 1

1.26.111.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: ドキュメント<82>,  Prev: ライブラリ<204>,  Up: Python 3 5 0 release candidate 1

1.26.111.3 IDLE
...............

   - bpo-23672(1): Allow Idle to edit and run files with astral chars in
     name.  Patch by Mohd Sanad Zaki Rizvi.

   - bpo-24745(2): Idle editor default font.  Switch from Courier to
     platform-sensitive TkFixedFont.  This should not affect current
     customized font selections.  If there is a problem, edit
     $HOME/.idlerc/config-main.cfg and remove '‘fontXXX’' entries from
     [Editor Window].  Patch by Mark Roseman.

   - bpo-21192(3): Idle editor.  When a file is run, put its name in the
     restart bar.  Do not print false prompts.  Original patch by Adnan
     Umer.

   - bpo-13884(4): Idle menus.  Remove tearoff lines.  Patch by Roger
     Serwy.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23672

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24745

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21192

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13884


File: python.info,  Node: ドキュメント<82>,  Next: テスト<88>,  Prev: IDLE<62>,  Up: Python 3 5 0 release candidate 1

1.26.111.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: テスト<88>,  Prev: ドキュメント<82>,  Up: Python 3 5 0 release candidate 1

1.26.111.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.26.112 Python 3.5.0 beta 4
----------------------------

'Release date: 2015-07-26'

* Menu:

* Core and Builtins: Core and Builtins<204>.
* ライブラリ: ライブラリ<205>.
* ビルド: ビルド<96>.


File: python.info,  Node: Core and Builtins<204>,  Next: ライブラリ<205>,  Up: Python 3 5 0 beta 4

1.26.112.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: ライブラリ<205>,  Next: ビルド<96>,  Prev: Core and Builtins<204>,  Up: Python 3 5 0 beta 4

1.26.112.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: ビルド<96>,  Prev: ライブラリ<205>,  Up: Python 3 5 0 beta 4

1.26.112.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.26.113 Python 3.5.0 beta 3
----------------------------

'Release date: 2015-07-05'

* Menu:

* Core and Builtins: Core and Builtins<205>.
* ライブラリ: ライブラリ<206>.
* テスト: テスト<89>.
* ドキュメント: ドキュメント<83>.
* ビルド: ビルド<97>.


File: python.info,  Node: Core and Builtins<205>,  Next: ライブラリ<206>,  Up: Python 3 5 0 beta 3

1.26.113.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: ライブラリ<206>,  Next: テスト<89>,  Prev: Core and Builtins<205>,  Up: Python 3 5 0 beta 3

1.26.113.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: テスト<89>,  Next: ドキュメント<83>,  Prev: ライブラリ<206>,  Up: Python 3 5 0 beta 3

1.26.113.3 テスト
.................

   - bpo-24373(1): _testmultiphase and xxlimited now use tp_traverse and
     tp_finalize to avoid reference leaks encountered when combining
     tp_dealloc with PyType_FromSpec (see bpo-16690(2) for details)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24373

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16690


File: python.info,  Node: ドキュメント<83>,  Next: ビルド<97>,  Prev: テスト<89>,  Up: Python 3 5 0 beta 3

1.26.113.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: ビルド<97>,  Prev: ドキュメント<83>,  Up: Python 3 5 0 beta 3

1.26.113.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.26.114 Python 3.5.0 beta 2
----------------------------

'Release date: 2015-05-31'

* Menu:

* Core and Builtins: Core and Builtins<206>.
* ライブラリ: ライブラリ<207>.


File: python.info,  Node: Core and Builtins<206>,  Next: ライブラリ<207>,  Up: Python 3 5 0 beta 2

1.26.114.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: ライブラリ<207>,  Prev: Core and Builtins<206>,  Up: Python 3 5 0 beta 2

1.26.114.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.26.115 Python 3.5.0 beta 1
----------------------------

'Release date: 2015-05-24'

* Menu:

* Core and Builtins: Core and Builtins<207>.
* ライブラリ: ライブラリ<208>.
* IDLE: IDLE<63>.
* テスト: テスト<90>.
* ドキュメント: ドキュメント<84>.
* Tools/Demos: Tools/Demos<56>.


File: python.info,  Node: Core and Builtins<207>,  Next: ライブラリ<208>,  Up: Python 3 5 0 beta 1

1.26.115.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: ライブラリ<208>,  Next: IDLE<63>,  Prev: Core and Builtins<207>,  Up: Python 3 5 0 beta 1

1.26.115.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: テスト<90>,  Prev: ライブラリ<208>,  Up: Python 3 5 0 beta 1

1.26.115.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: テスト<90>,  Next: ドキュメント<84>,  Prev: IDLE<63>,  Up: Python 3 5 0 beta 1

1.26.115.4 テスト
.................

   - bpo-21520(1): test_zipfile no longer fails if the word 'bad'
     appears anywhere in the name of the current directory.

   - bpo-9517(2): Move script_helper into the support package.  Patch by
     Christie Wilson.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21520

   (2) https://bugs.python.org/issue?@action=redirect&bpo=9517


File: python.info,  Node: ドキュメント<84>,  Next: Tools/Demos<56>,  Prev: テスト<90>,  Up: Python 3 5 0 beta 1

1.26.115.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<56>,  Prev: ドキュメント<84>,  Up: Python 3 5 0 beta 1

1.26.115.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.26.116 Python 3.5.0 alpha 4
-----------------------------

'Release date: 2015-04-19'

* Menu:

* Core and Builtins: Core and Builtins<208>.
* ライブラリ: ライブラリ<209>.
* ビルド: ビルド<98>.
* テスト: テスト<91>.
* Tools/Demos: Tools/Demos<57>.
* C API: C API<79>.


File: python.info,  Node: Core and Builtins<208>,  Next: ライブラリ<209>,  Up: Python 3 5 0 alpha 4

1.26.116.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: ライブラリ<209>,  Next: ビルド<98>,  Prev: Core and Builtins<208>,  Up: Python 3 5 0 alpha 4

1.26.116.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(): 1165. 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(): 1160. now waits until
     the connection completes instead of raising *note InterruptedError:
     1145. 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: ビルド<98>,  Next: テスト<91>,  Prev: ライブラリ<209>,  Up: Python 3 5 0 alpha 4

1.26.116.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: テスト<91>,  Next: Tools/Demos<57>,  Prev: ビルド<98>,  Up: Python 3 5 0 alpha 4

1.26.116.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<57>,  Next: C API<79>,  Prev: テスト<91>,  Up: Python 3 5 0 alpha 4

1.26.116.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<79>,  Prev: Tools/Demos<57>,  Up: Python 3 5 0 alpha 4

1.26.116.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.26.117 Python 3.5.0 alpha 3
-----------------------------

'Release date: 2015-03-28'

* Menu:

* Core and Builtins: Core and Builtins<209>.
* ライブラリ: ライブラリ<210>.
* ビルド: ビルド<99>.
* テスト: テスト<92>.
* Tools/Demos: Tools/Demos<58>.


File: python.info,  Node: Core and Builtins<209>,  Next: ライブラリ<210>,  Up: Python 3 5 0 alpha 3

1.26.117.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: ライブラリ<210>,  Next: ビルド<99>,  Prev: Core and Builtins<209>,  Up: Python 3 5 0 alpha 3

1.26.117.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(): 1168. and *note
     signal.sigtimedwait(): 1167. 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: ビルド<99>,  Next: テスト<92>,  Prev: ライブラリ<210>,  Up: Python 3 5 0 alpha 3

1.26.117.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: テスト<92>,  Next: Tools/Demos<58>,  Prev: ビルド<99>,  Up: Python 3 5 0 alpha 3

1.26.117.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<58>,  Prev: テスト<92>,  Up: Python 3 5 0 alpha 3

1.26.117.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.26.118 Python 3.5.0 alpha 2
-----------------------------

'Release date: 2015-03-09'

* Menu:

* Core and Builtins: Core and Builtins<210>.
* ライブラリ: ライブラリ<211>.
* ビルド: ビルド<100>.
* C API: C API<80>.
* Windows: Windows<82>.


File: python.info,  Node: Core and Builtins<210>,  Next: ライブラリ<211>,  Up: Python 3 5 0 alpha 2

1.26.118.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: ライブラリ<211>,  Next: ビルド<100>,  Prev: Core and Builtins<210>,  Up: Python 3 5 0 alpha 2

1.26.118.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: ビルド<100>,  Next: C API<80>,  Prev: ライブラリ<211>,  Up: Python 3 5 0 alpha 2

1.26.118.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<80>,  Next: Windows<82>,  Prev: ビルド<100>,  Up: Python 3 5 0 alpha 2

1.26.118.4 C API
................

   - bpo-20204(1): Deprecation warning is now raised for builtin types
     without the __module__ attribute.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20204


File: python.info,  Node: Windows<82>,  Prev: C API<80>,  Up: Python 3 5 0 alpha 2

1.26.118.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.26.119 Python 3.5.0 alpha 1
-----------------------------

'Release date: 2015-02-08'

* Menu:

* Core and Builtins: Core and Builtins<211>.
* ライブラリ: ライブラリ<212>.
* IDLE: IDLE<64>.
* ビルド: ビルド<101>.
* C API: C API<81>.
* ドキュメント: ドキュメント<85>.
* テスト: テスト<93>.
* Tools/Demos: Tools/Demos<59>.
* Windows: Windows<83>.


File: python.info,  Node: Core and Builtins<211>,  Next: ライブラリ<212>,  Up: Python 3 5 0 alpha 1

1.26.119.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: ライブラリ<212>,  Next: IDLE<64>,  Prev: Core and Builtins<211>,  Up: Python 3 5 0 alpha 1

1.26.119.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(): e53. 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(): e28. 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(): 8db, close the file descriptor if
     *note io.open(): 930. 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: 94f. and *note sys.stdout: ea0. 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: ビルド<101>,  Prev: ライブラリ<212>,  Up: Python 3 5 0 alpha 1

1.26.119.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: ビルド<101>,  Next: C API<81>,  Prev: IDLE<64>,  Up: Python 3 5 0 alpha 1

1.26.119.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<81>,  Next: ドキュメント<85>,  Prev: ビルド<101>,  Up: Python 3 5 0 alpha 1

1.26.119.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():
     f89, rename ‘_Py_wchar2char()’ to *note Py_EncodeLocale(): f8a, and
     document these functions.

   - bpo-21233(6): Add new C functions: PyMem_RawCalloc(),
     PyMem_Calloc(), PyObject_Calloc(), _PyObject_GC_Calloc().
     bytes(int) is now using ‘calloc()’ instead of ‘malloc()’ for large
     objects which is faster and use less memory.

   - bpo-20942(7): PyImport_ImportFrozenModuleObject() no longer sets
     __file__ to match what importlib does; this affects
     _frozen_importlib as well as any module loaded using
     imp.init_frozen().

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14203

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22445

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22079

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22453

   (5) https://bugs.python.org/issue?@action=redirect&bpo=18395

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21233

   (7) https://bugs.python.org/issue?@action=redirect&bpo=20942


File: python.info,  Node: ドキュメント<85>,  Next: テスト<93>,  Prev: C API<81>,  Up: Python 3 5 0 alpha 1

1.26.119.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: テスト<93>,  Next: Tools/Demos<59>,  Prev: ドキュメント<85>,  Up: Python 3 5 0 alpha 1

1.26.119.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<59>,  Next: Windows<83>,  Prev: テスト<93>,  Up: Python 3 5 0 alpha 1

1.26.119.8 Tools/Demos
......................

   - bpo-22314(1): pydoc now works when the LINES environment variable
     is set.

   - bpo-22615(2): Argument Clinic now supports the "type" argument for
     the int converter.  This permits using the int converter with enums
     and typedefs.

   - bpo-20076(3): The makelocalealias.py script no longer ignores UTF-8
     mapping.

   - bpo-20079(4): The makelocalealias.py script now can parse the
     SUPPORTED file from glibc sources and supports command line options
     for source paths.

   - bpo-22201(5): Command-line interface of the zipfile module now
     correctly extracts ZIP files with directory entries.  Patch by Ryan
     Wilson.

   - bpo-22120(6): For functions using an unsigned integer return
     converter, Argument Clinic now generates a cast to that type for
     the comparison to -1 in the generated code.  (This suppresses a
     compilation warning.)

   - bpo-18974(7): Tools/scripts/diff.py now uses argparse instead of
     optparse.

   - bpo-21906(8): Make Tools/scripts/md5sum.py work in Python 3.  Patch
     by Zachary Ware.

   - bpo-21629(9): Fix Argument Clinic's "-converters" feature.

   - Add support for ‘yield from’ to 2to3.

   - Add support for the PEP 465(10) matrix multiplication operator to
     2to3.

   - bpo-16047(11): Fix module exception list and __file__ handling in
     freeze.  Patch by Meador Inge.

   - bpo-11824(12): Consider ABI tags in freeze.  Patch by Meador Inge.

   - bpo-20535(13): PYTHONWARNING no longer affects the run_tests.py
     script.  Patch by Arfrever Frehtes Taifersar Arahesis.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22314

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22615

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20076

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20079

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22201

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22120

   (7) https://bugs.python.org/issue?@action=redirect&bpo=18974

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21906

   (9) https://bugs.python.org/issue?@action=redirect&bpo=21629

   (10) https://peps.python.org/pep-0465/

   (11) https://bugs.python.org/issue?@action=redirect&bpo=16047

   (12) https://bugs.python.org/issue?@action=redirect&bpo=11824

   (13) https://bugs.python.org/issue?@action=redirect&bpo=20535


File: python.info,  Node: Windows<83>,  Prev: Tools/Demos<59>,  Up: Python 3 5 0 alpha 1

1.26.119.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 標準ライブラリ: 3fe.
を参照してください。 また、正式な言語定義は、 *note Python
言語リファレンス: 3ff. にあります。 C 言語や C++ 言語で拡張モジュールを
書くなら、 *note Python インタプリタの拡張と埋め込み: 21c9. や *note
Python/C API reference manual: 21ca. を参照してください。Python の解説書
も販売されています。

このチュートリアルは、Python全体を対象とした、包括的な解説書ではありませ
ん。よく使われる機能に限っても、全ては紹介していません。その代わり、この
チュートリアルでは、Pythonのもっとも特徴的な機能を中心に紹介して、この言
語の持ち味や、スタイルを感じられるようにしています。このチュートリアルを
読み終えると、Python のモジュールやプログラムを読み書きできるようになっ
ているでしょう。また、*note Python 標準ライブラリ: 3fe. のさまざまな
Python ライブラリモジュールを、詳しく調べられるようになっているはずです
。

*note 用語集: 21cb. にも目を通しておくと良いでしょう。

* 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.16’ にインストールされています。使用している
Unix シェルの検索パスに ‘/usr/local/bin’ を追加すると、次のコマンドでイ
ンタプリタを開始できます:

     python3.16

(1) どのディレクトリに Python インタプリタをインストールするかはインスト
ール時に選択できるので、インタプリタは他のディレクトリにあるかもしれませ
ん; 身近な Python に詳しい人か、システム管理者に聞いてみてください。 (例
えば、その他の場所としては ‘/usr/local/python’ が一般的です。)

*note Microsoft ストア: 21d5. からPythonのインストールを行った Windows マ
シンでは、 ‘python3.16’ コマンドが利用できます。 *note py.exe ランチャ:
9c1. をインストールした場合、 ‘py’ コマンドが使えます。 Python を起動す
る他の方法については *note Python install manager: 21d6. を参照してくだ
さい。

ファイル終端文字 (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 対話入力編集と履歴置換: 21d7. 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: 44c. オプションと同じように、
'command' に指定した文を実行します。 Python 文には、スペースなどのシェル
にとって特殊な意味をもつ文字がしばしば含まれるので、 'command' 全体をク
ォート(訳注: ‘'’)で囲っておいたほうが良いでしょう。

Python のモジュールには、スクリプトとしても便利に使えるものがあります。
‘python -m module [arg] ...’ のように起動すると、 'module' のソースファ
イルを、フルパスを指定して起動したかのように実行できます。

スクリプトファイルを使用する場合、スクリプトの実行が完了した後、そのまま
対話モードに入れると便利なことがあります。これには *note -i: 1893. をス
クリプト名の前に追加します。

全てのコマンドラインオプションは *note コマンドラインと環境: 1fb7. で説
明されています。

* 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: 44c. 'command' を使うと、
‘sys.argv[0]’ は ‘'-c'’ になります。 *note -m: 4d1. '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.16
     Python 3.16 (default, May 7 2026, 19:03:04)
     [GCC 10.2.0] on linux
     Type "help", "copyright", "credits" or "license" for more information.
     >>>

継続行は、複数行の構文を入力するときに使います。例えば、 *note if: 32a.
文は継続行を使用します

     >>> the_world_is_flat = True
     >>> if the_world_is_flat:
     ...     print("Be careful not to fall off!")
     ...
     Be careful not to fall off!

対話モードについての詳細は *note 対話モード: 6a6. を参照してください。


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" 行: 21df. で始まる場合には、'先頭行'
のルールは当てはまりません。 この場合には、エンコーディングの宣言はファ
イルの2行目に追加します。 例えば以下のようになります:

     #!/usr/bin/env python3
     # -*- coding: cp1252 -*-

脚注
....


File: python.info,  Node: 形式ばらない Python の紹介,  Next: その他の制御フローツール,  Prev: Python インタプリタを使う,  Up: Python チュートリアル

2.3 形式ばらない Python の紹介
==============================

以下のサンプルでは、入力と出力はプロンプト (*note >>>: 6a4. や *note
...: 6a5.) の有無で区別します: 例を実際に試す場合は、プロンプトが表示さ
れているときに、サンプル中のプロンプトから後ろの内容全てを入力します。

このマニュアルにあるサンプルの多くは、対話プロンプトで入力されるものでも
コメントを含んでいます。 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: 32e. 型であり、小数部を
持つ数 (例えば、 ‘5.0’ 、 ‘1.6’) は *note float: 32f. 型です。数値型につ
いては後のチュートリアルでさらに見ていきます。

除算 (‘/’) は常に浮動小数点数を返します。 ‘//’ 演算子は *note 整数除算:
d14. を行い、整数値を返します; 剰余は、‘%’ で求めます。:

     >>> 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: 32e. と *note float: 32f. に加え、 Python は *note Decimal:
1cd. や *note Fraction: 1ce. などの他の数値型もサポートしています。
*note 複素数: 21e8. も組み込み型としてサポートしており、 ‘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:
1ea. 型によって表現されます) を扱うことができます。 ‘!’ のような文字や
‘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(): 1324. 関数を使うと、両端のクォ
ートがなくなり、エスケープされた文字や特殊文字が表示されるため、より読み
やすい形で出力できます。

     >>> 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: 21eb. を参照して
ください。

文字列リテラルは複数行にまたがって書けます。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 不変: 18c. です。従って、
文字列のインデックスで指定したある場所に代入を行うとエラーが発生します:

     >>> 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(): a24. は文字列の長さ (length) を返します:

     >>> s = 'supercalifragilisticexpialidocious'
     >>> len(s)
     34

参考
....

*note テキストシーケンス型 -- str: 21ec.

     文字列は代表的な 'シーケンス型' で、シーケンス型でサポートされてい
     る共通の操作をサポートしています。

*note 文字列メソッド: 21ed.

     文字列は、基本的な変換や検索を行うための数多くのメソッドをサポート
     しています。

*note f-strings: 441.

     式の埋め込みをサポートした文字列リテラル

*note Format string syntax: 1754.

     *note str.format(): a17. を使った文字列のフォーマットについての情報
     があります。

*note printf 形式の文字列書式化: abe.

     文字列が ‘%’ 演算子の左オペランドである場合に呼び出される古いフォー
     マット操作について、詳しく記述されています。

   ---------- 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 シーケンス: 904. 型) のように、リス
トはインデックスやスライスができます:

     >>> 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 不変: 18c. な文字列とは違って、リストは *note 可変: 1759. 型ですの
で、要素を入れ替えられます:

     >>> 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(): abf. 'メソッド' を使って、リストの末尾に新しい要素
を追加できます (メソッドについては後で詳しく見ていきます):

     >>> 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 浅いコピー: 21f0. を返します。:

     >>> 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(): a24. はリストにも使えます:

     >>> 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: 1ba5. は、条件 (ここでは '' a < 10'') が真である限り実
     行を繰り返し (ループし) ます。Python では、C 言語と同様に、ゼロでな
     い整数値は真となり、ゼロは偽です。条件式には、文字列値やリスト値な
     ども使えます。それ以外のシーケンスも、条件式として使用できます。長
     さが 1 以上のシーケンスは真で、空のシーケンスは偽になります。サンプ
     ルで使われている条件テストはシンプルな比較です。標準的な比較演算子
     は C 言語と同様です: すなわち、 ‘<’ (より小さい)、 ‘>’ (より大きい
     )、 ‘==’ (等しい)、 ‘<=’ (より小さいか等しい)、 ‘>=’ (より大きいか
     等しい)、および ‘!=’ (等しくない)、です。

   * ループの '本体 (body)' は、 'インデント (indent, 字下げ)' されてい
     ます: インデントは Python において、実行文をグループにまとめる方法
     です。対話的プロンプトでは、インデントされた各行を入力するにはタブ
     や (複数個の) スペースを使わなければなりません。実用的には、もっと
     複雑な処理を入力する場合はテキストエディタを使うことになるでしょう
     。 ほとんどのテキストエディタは、自動インデント機能を持っています。
     複合文を対話的に入力するときには、入力完了のしるしとして最後に空行
     を入力します。これは、パーザはどれが最後の行を入力なのか、判断でき
     ないためです。基本的なブロック内では、全ての行は同じだけインデント
     されていなければならないので注意してください。

   * *note print(): 1324. 関数は、与えられた引数の値を書き出します。これ
     は (前に電卓の例でやったような) 単に出力したい式を書くのとは、複数
     の引数や浮動小数点量や文字列に対する扱い方が違います。‘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: 1ba5. 文の他にも、 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: 32a. 文でしょう。例えば:

     >>> 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: 42c. 部を使うことができ、 *note else: 328. 部を
付けることもできます。キーワード '‘elif’' は 'else if' を短くしたもので
、過剰なインデントを避けるのに役立ちます。一連の ‘if’ ...  ‘elif’ ...
‘elif’ ...  は、他の言語における ‘switch’ 文や ‘case’ 文の代用となります
。

いくつかの定数と同じ値かを比較する場合や、特定の型や属性かを確認する場合
には、‘match’ 文が便利です。詳細は *note match 文: 21f9. を参照してくだ
さい。


File: python.info,  Node: for 文,  Next: range 関数,  Prev: if 文,  Up: その他の制御フローツール

2.4.2 ‘for’ 文
--------------

Python の *note for: 329. 文は、読者が 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(): d13.
が便利です。この関数は算術型の数列を生成します:

     >>> 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(): d13.
と *note len(): a24. を次のように組み合わせられます:

     >>> 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(): 1839. 関数を使う方が便利です。
*note ループのテクニック: 21fe. を参照してください。

range を直接出力すると変なことになります:

     >>> range(10)
     range(0, 10)

*note range(): d13. が返すオブジェクトは、いろいろな点でリストであるかの
ように振る舞いますが、本当はリストではありません。これは、イテレートした
時に望んだ数列の連続した要素を返すオブジェクトです。しかし実際にリストを
作るわけではないので、スペースの節約になります。

このようなオブジェクトは *note イテラブル: 149a. と呼ばれます。 これらは
関数や構成物のターゲットとして、あるだけの項目を逐次与えるのに適していま
す。 *note for: 329. 文がそのような構成物であることはすでに見てきており
、イテラブルを受け取る関数の例には *note sum(): 886. があります:

     >>> 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 データ構造: 21ff, we will
discuss *note list(): 4e0. in more detail.


File: python.info,  Node: break 文と continue 文,  Next: ループの else 節,  Prev: range 関数,  Up: その他の制御フローツール

2.4.4 ‘break’ 文と ‘continue’ 文
--------------------------------

*note break: 42f. 文は、その ‘break’ 文を内包している最も内側にある
*note for: 329. 文または *note while: 1ba5. 文から抜け出すことができます
:

     >>> 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: 430. 文はループの次のイテレーションを実行します:

     >>> 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: 329. 文の場合、 ‘else’ 節はループ処理の最後のイテレーションが
実行されたあと、つまりbreakが発生しなかった場合に実行されます。

*note while: 1ba5. 文の場合は、ループ条件が偽となったあとに実行されます
。

どちらのループでも、ループが *note break: 42f. によって終了した場合は
‘else’ 句は '実行されません'。当然、 *note return: 452. や例外の発生によ
ってループが途中で終了した場合にも、*note else: 328. 節の実行はスキップ
されます。

その例として、素数を探索する ‘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: adb. 文の
‘else’ に似ています。 文の ‘else’ 句は例外が発生しなかった時に実行され、
ループの ‘else’ 句は ‘break’ されなかった場合に実行されます。 ‘try’ 文と
例外についての詳細は *note 例外を処理する: 2205. を参照してください。


File: python.info,  Node: pass 文,  Next: match 文,  Prev: ループの else 節,  Up: その他の制御フローツール

2.4.6 ‘pass’ 文
---------------

*note pass: 42e. 文は何もしません。 ‘pass’ は、文を書くことが構文上要求
されているが、プログラム上何の動作もする必要がない時に使われます:

     >>> while True:
     ...     pass  # キーボード割り込み(Ctrl+C)のためのビジーウェイト
     ...

これは最小のクラスを作るときによく使われる方法です:

     >>> class MyEmptyClass:
     ...     pass
     ...

*note pass: 42e. のもう 1 つの使い道は、新しいコードを書いているときの関
数や条件文の仮置きの本体としてです。こうすることで、より抽象的なレベルで
考え続けられます。 ‘pass’ は何事も無く無視されます

     >>> def initlog(*args):
     ...     pass   # ここを忘れずに実装すること!
     ...

この最後の例で、多くの人は ‘pass’ ではなく省略記号リテラル ‘...’ を使い
ます。 この使い方は Python に対して特別な意味はなく、言語定義の一部でも
ありません（ここにはどんな定数式でも使えます）が、 ‘...’ は慣例的にプレ
ースホルダ本体としても使われています。 *note Ellipsis オブジェクト:
2208. を参照してください。


File: python.info,  Node: match 文,  Next: 関数を定義する,  Prev: pass 文,  Up: その他の制御フローツール

2.4.7 ‘match’ 文
----------------

*note match: 1df. 文は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: 1812. は関数の '定義 (definition)' を導くキーワードです。
‘def’ の後には、関数名と仮引数を丸括弧で囲んだリストを続けなければなりま
せん。関数の実体を構成する実行文は次の行から始め、インデントされていなけ
ればなりません。

関数の本体の記述する文の最初の行は文字列リテラルにすることもできます。そ
の場合、この文字列は関数のドキュメンテーション文字列 (documentation
string)、または 'docstring' と呼ばれます。 (docstring については *note
ドキュメンテーション文字列: 220c. でさらに扱っています。) ドキュメンテー
ション文字列を使ったツールには、オンライン文書や印刷文書を自動的に生成し
たり、ユーザが対話的にコードから直接閲覧できるようにするものがあります。
自分が書くコードにドキュメンテーション文字列を入れるのはよい習慣です。書
く癖をつけてください。

関数を '実行 (execution)' するとき、関数のローカル変数のために使われる新
たなシンボルテーブル (symbol table) が用意されます。 もっと正確にいうと
、関数内で変数への代入を行うと、その値はすべてこのローカルなシンボルテー
ブルに記憶されます。 一方、変数の参照を行うと、まずローカルなシンボルテ
ーブルが検索され、次にさらに外側の関数のローカルなシンボルテーブルを検索
し、その後グローバルなシンボルテーブルを調べ、最後に組み込みの名前テーブ
ルを調べます。 従って、関数の中では (グローバル変数が *note global: 6bb.
文で指定されていたり、外側の関数の変数が *note nonlocal: 1661. 文で指定
されていない限り) グローバル変数や外側の関数の変数に直接値を代入できませ
んが、参照することはできます。

関数を呼び出す際の実際の引数 (実引数) は、関数が呼び出されるときに関数の
ローカルなシンボルテーブル内に取り込まれます。そうすることで、実引数は
'値渡し (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: 452. 文を持たない関数もややつまらない値ですが値を返してい
ます。この値は ‘None’ と呼ばれます (これは組み込みの名前です)。 ‘None’ だ
けを書き出そうとすると、インタプリタは通常出力を抑制します。本当に出力し
たいのなら、以下のように *note print(): 1324. を使うと見ることができます
:

     >>> 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: 452. 文では、関数から一つ値を返します。 ‘return’ の引
     数となる式がない場合、 ‘None’ が返ります。関数が終了したときにも
     ‘None’ が返ります。

   * 文 ‘result.append(a)’ では、リストオブジェクト ‘result’ の 'メソッ
     ド (method)' を呼び出しています。メソッドとは、オブジェクトに '属し
     ている' 関数のことで、 ‘obj’ を何らかのオブジェクト (式であっても構
     いません)、 ‘methodname’ をそのオブジェクトで定義されているメソッド
     名とすると、 ‘obj.methodname’ と書き表されます。異なる型は異なるメ
     ソッドを定義しています。異なる型のメソッドで同じ名前のメソッドを持
     つことができ、あいまいさを生じることはありません。 ('クラス
     (class)' を使うことで、自前のオブジェクト型とメソッドを定義すること
     もできます。 *note クラス: 220d. 参照) 例で示されているメソッド
     ‘append()’ は、リストオブジェクトで定義されています; このメソッドは
     リストの末尾に新たな要素を追加します。この例での *note append():
     abf. は ‘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: 32b. キーワードが導入されています。このキーワードは
シーケンスが特定の値を含んでいるかどうか調べるのに使われます。

デフォルト値は、関数が定義された時点で、関数を '定義している' 側のスコー
プ (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 キーワード引数: 10d0. を使って呼
び出すこともできます。例えば、以下の関数:

     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, frozendict: e90. を参照) を受け取ります。 ‘**name’ は ‘*name’ の形
式をとる、仮引数のリストを超えた位置引数の入った *note タプル: 2214. を
受け取る引数 (次の小節で述べます) と組み合わせられます。 (‘*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
タプルとシーケンス: 2214. を参照) に格納されます。可変個の引数の前に、ゼ
ロ個かそれ以上の引数があっても構いません。

     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(): d13. は引数 '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: 1657. を使うと、名前のない小さな関数を生成でき
ます。例えば ‘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():
f91. はソートキー関数 '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 関数アノテーション: 2224. はユーザ定義関数で使用される型についての
完全にオプションなメタデータ情報です (詳細は PEP 3107(1) と PEP 484(2) を
参照してください)。

*note アノテーション: 2225. は関数の *note __annotations__: 672. 属性に
辞書として格納され、関数の他の部分には何も影響を与えません。パラメータア
ノテーションは、パラメータ名の後にコロンを続けることによって定義され、そ
の後にアノテーションの値として評価される式が置かれます。戻り値アノテーシ
ョンは、パラメータリストと *note def: 1812. 文の終わりを表すコロンの間に
置かれたリテラル ‘->’ によって定義され、その後に式が続きます。次の例は必
須の引数とオプション引数、そして戻り値のアノテーションを持っています:

     >>> 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 クラス初見: 2228. を見よ) とし
     て使うこと。

   * あなたのコードを世界中で使ってもらうつもりなら、風変りなエンコーデ
     ィングは使わないこと。どんな場合でも、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: 222e. 型には、他にもいくつかメソッドがあります。リストオブジ
ェクトのすべてのメソッドを以下に示します:

 -- メソッド: 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: 15a. if there is no such
     item.

 -- メソッド: list.pop (index=-1, /)

     指定された位置の要素をリストから取り除き、それを返します。インデッ
     クスが指定されていない場合、 ‘a.pop()’ はリスト末尾の要素を取り除い
     て返します。リストが空であるか、インデックスがリストの範囲外の場合
     は、*note IndexError: 18ed. を送出します。

 -- メソッド: 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: 15a. 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(): f90. の説明を参照してください。

 -- メソッド: 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>.
* ネストしたリストの内包表記::
* Unpacking in Lists and List Comprehensions::

   ---------- Footnotes ----------

   (1) 他の言語では変更可能なオブジェクトを返して、
‘d->insert("a")->remove("b")->sort();’ のようなメソッドチェインを許して
いる場合もあります。


File: python.info,  Node: リストをスタックとして使う,  Next: リストをキューとして使う,  Up: リスト型についてもう少し

2.5.1.1 リストをスタックとして使う
..................................

リスト型のメソッドのおかげで、簡単にリストをスタックとして使えます。スタ
ックでは、最後に追加された要素が最初に取り出されます ("last-in,
first-out")。スタックの一番上に要素を追加するには *note append(): abf. を
使います。スタックの一番上から要素を取り出すには *note pop(): 2231. をイ
ンデックスを指定せずに使います。例えば以下のようにします:

     >>> 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: 9db. を使うと良いでしょう。
このクラスは良く設計されていて、高速な追加（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: 329. と *note if: 32a. 文が両方のコードで同じ順序になっている
ことに注目してください。

式がタプルの場合 (例: 上の例で式が ‘(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: ネストしたリストの内包表記,  Next: Unpacking in Lists and List Comprehensions,  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: 329. のコン
テキストの中で評価されます。そのため、この例は次のコードと等価です:

     >>> 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(): 446. 関数が良い仕事をしてくれるでしょう:

     >>> list(zip(*matrix))
     [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]

この行にあるアスタリスクの詳細については *note 引数リストのアンパック:
221d. を参照してください。


File: python.info,  Node: Unpacking in Lists and List Comprehensions,  Prev: ネストしたリストの内包表記,  Up: リスト型についてもう少し

2.5.1.5 Unpacking in Lists and List Comprehensions
..................................................

The section on *note 引数リストのアンパック: 221d. describes the use of
‘*’ to "unpack" the elements of an iterable object, providing each one
separately as an argument to a function.  Unpacking can also be used in
other contexts, for example, when creating lists.  When specifying
elements of a list, prefixing an expression by a ‘*’ will unpack the
result of that expression, adding each of its elements to the list we're
creating:

     >>> x = [1, 2, 3]
     >>> [0, *x, 4, 5, 6]
     [0, 1, 2, 3, 4, 5, 6]

This only works if the expression following the ‘*’ evaluates to an
iterable object; trying to unpack a non-iterable object will raise an
exception:

     >>> x = 1
     >>> [0, *x, 2, 3, 4]
     Traceback (most recent call last):
       File "<python-input-1>", line 1, in <module>
         [0, *x, 2, 3, 4]
     TypeError: Value after * must be an iterable, not int

Unpacking can also be used in list comprehensions, as a way to build a
new list representing the concatenation of an arbitrary number of
iterables:

     >>> x = [[1, 2, 3], [4, 5, 6], [], [7], [8, 9]]
     >>> [*element for element in x]
     [1, 2, 3, 4, 5, 6, 7, 8, 9]

Note that the effect is that each element from ‘x’ is unpacked.  This
works for arbitrary iterable objects, not just lists:

     >>> x = [[1, 2, 3], 'cat', {'spam': 'eggs'}]
     >>> [*element for element in x]
     [1, 2, 3, 'c', 'a', 't', 'spam']

But if the objects in ‘x’ are not iterable, this expression would again
raise an exception.


File: python.info,  Node: del 文,  Next: タプルとシーケンス,  Prev: リスト型についてもう少し,  Up: データ構造

2.5.2 ‘del’ 文
--------------

リストから要素を削除する際、値を指定する代わりにインデックスを指定する方
法があります。それが *note del: 1d3c. 文です。これは *note pop(): 2231.
メソッドと違い、値を返しません。 ‘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: 1d3c. は変数全体の削除にも使えます:

     >>> del a

この文の後で名前 ‘a’ を参照すると、(別の値を ‘a’ に代入するまで) エラー
になります。 *note del: 1d3c. の別の用途についてはまた後で取り上げます。


File: python.info,  Node: タプルとシーケンス,  Next: 集合型,  Prev: del 文,  Up: データ構造

2.5.3 タプルとシーケンス
------------------------

リストや文字列には、インデクスやスライスを使った演算のように、数多くの共
通の性質があることを見てきました。これらは 'シーケンス (sequence)' デー
タ型 (*note シーケンス型 -- list, tuple, range: 223b. を参照) の二つの例
です。 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])
     >>> # they support unpacking just like lists:
     >>> x = [1, 2, 3]
     >>> 0, *x, 4
     (0, 1, 2, 3, 4)

ご覧のとおり、タプルの表示には常に丸括弧がついていて、タプルのネストが正
しく解釈されるようになっています。タプルを書くときは必ずしも丸括弧で囲ま
なくてもいいですが、(タプルが大きな式の一部だった場合は) 丸括弧が必要な
場合もあります。タプルの要素を代入することはできません。しかし、タプルに
リストのような変更可能型を含めることはできます。

タプルはリストと似ていますが、たいてい異なる場面と異なる目的で利用されま
す。タプルは *note 不変: 18c. で、複数の型の要素からなることもあり、要素
はアンパック(この節の後半に出てきます)操作やインデックス (あるいは *note
namedtuples: 1da. の場合は属性)でアクセスすることが多いです。一方、リス
トは *note 可変: 1759. で、要素はたいてい同じ型のオブジェクトであり、た
いていイテレートによってアクセスします。

問題は 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: 223e. を扱うためのデータ型もあります。集合とは
、重複する要素をもたない、順序づけられていない要素の集まりです。 Set オ
ブジェクトは、和 (union)、積 (intersection)、差 (difference)、対称差
(symmetric difference)といった数学的な演算もサポートしています。

中括弧、または *note set(): 432. 関数は 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: 2235, set comprehensions are
also supported, including comprehensions with unpacking:

     >>> a = {x for x in 'abracadabra' if x not in 'abc'}
     >>> a
     {'r', 'd'}

     >>> fruits = [{'apple', 'avocado', 'apricot'}, {'banana', 'blueberry'}]
     >>> {*fruit for fruit in fruits}
     {'blueberry', 'banana', 'avocado', 'apple', 'apricot'}


File: python.info,  Node: 辞書型 dictionary,  Next: ループのテクニック,  Prev: 集合型,  Up: データ構造

2.5.5 辞書型 (dictionary)
-------------------------

もう一つ、有用な型が Python に組み込まれています。それは '辞書
(dictionary)' (*note Mapping types -- dict, frozendict: e90. を参照)です
。辞書は他の言語にも "連想記憶 (associated memory)" や "連想配列
(associative array)" という名前で存在することがあります。ある範囲の数で
インデックス化されているシーケンスと異なり、辞書は 'キー (key)' でインデ
ックス化されています。このキーは何らかの変更不能な型になります。文字列、
数値は常にキーにすることができます。タプルは、文字列、数値、その他のタプ
ルのみを含む場合はキーにすることができます。直接、あるいは間接的に変更可
能なオブジェクトを含むタプルはキーにできません。リストをキーとして使うこ
とはできません。これは、リストにスライスやインデックス指定の代入を行った
り、 *note append(): abf. や *note extend(): 7fe. のようなメソッドを使う
と、インプレースで変更することができるためです。

辞書は 'キー(key): 値(value)' のペアの集合であり、キーが (辞書の中で)一
意でなければならない、と考えるとよいでしょう。波括弧 (brace) のペア:
‘{}’ は空の辞書を生成します。カンマで区切られた key: value のペアを波括
弧ペアの間に入れると、辞書の初期値となる key: value が追加されます; この
表現方法は出力時に辞書が書き出されるのと同じ方法です。

辞書での主な操作は、ある値を何らかのキーを付けて記憶することと、キーを指
定して値を取り出すことです。 ‘del’ で key: value のペアを削除することも
できます。すでに使われているキーを使って値を記憶すると、以前そのキーに関
連づけられていた値は忘れ去られてしまいます。

存在しないキーの値をインデックス指定(‘d[key]’)で取り出すと *note
KeyError: 7e5. が発生します。存在しない可能性のあるキーへのアクセス時に
このエラーを回避するには、代わりに *note get(): 2241. メソッドを使用しま
す。このメソッドは辞書にキーが存在しない場合に ‘None’ (または指定された
デフォルト値)を返します。

辞書オブジェクトに対し ‘list(d)’ を実行すると、辞書で使われている全ての
キーからなるリストをキーが挿入された順番で返します (ソートされたリストが
欲しい場合は、代わりに ‘sorted(d)’ を使ってください)。ある単一のキーが辞
書にあるかどうか調べるには、 *note in: 32b. キーワードを使います。

以下に、辞書を使った簡単な例を示します:

     >>> 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(): 193. コンストラクタは、キーと値のペアのタプルを含むリスト
から辞書を生成します:

     >>> 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}

And dictionary unpacking (via ‘**’) can be used to merge multiple
dictionaries:

     >>> odds = {i: i**2 for i in (1, 3, 5)}
     >>> evens = {i: i**2 for i in (2, 4, 6)}
     >>> {**odds, **evens}
     {1: 1, 3: 9, 5: 25, 2: 4, 4: 16, 6: 36}

     >>> all_values = [odds, evens, {0: 0}]
     >>> {**i for i in all_values}
     {1: 1, 3: 9, 5: 25, 2: 4, 4: 16, 6: 36, 0: 0}

キーが単純な文字列の場合、キーワード引数を使って定義する方が単純な場合も
あります:

     >>> 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(): bb3. メソッドを使うと、キー
とそれに対応する値を同時に取り出せます。

     >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
     >>> for k, v in knights.items():
     ...     print(k, v)
     ...
     gallahad the pure
     robin the brave

シーケンスにわたるループを行う際、 *note enumerate(): 1839. 関数を使うと
、要素のインデックスと要素を同時に取り出すことができます。

     >>> for i, v in enumerate(['tic', 'tac', 'toe']):
     ...     print(i, v)
     ...
     0 tic
     1 tac
     2 toe

二つまたはそれ以上のシーケンス型を同時にループするために、関数 *note
zip(): 446. を使って各要素をひと組みにすることができます。

     >>> 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(): c40. を呼び出します。

     >>> for i in reversed(range(1, 10, 2)):
     ...     print(i)
     ...
     9
     7
     5
     3
     1

シーケンスをソートされた順序でループするには、 *note sorted(): f90. 関数
を使います。この関数は元の配列を変更せず、ソート済みの新たな配列を返しま
す。

     >>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
     >>> for i in sorted(basket):
     ...     print(i)
     ...
     apple
     apple
     banana
     orange
     orange
     pear

シーケンスに *note set(): 432. を使うと、重複要素が除去されます。 シーケ
ンスに ‘set()’ を使った上で、 *note sorted(): f90. を使うという組み合わ
せ方は、順番が整列されているシーケンスで、同一要素に 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 セイウチ演算子: 2245.
‘:=’ を使用して明示的に行う必要があることに注意してください。これにより
、 ‘==’ が意図されていたところに ‘=’ を入力してしまうという、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: 29c. 例外を発生させます。

脚注
....


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:
224c. (詳細は *note Python のスコープと名前空間: 224d. を参照してくださ
い)に追加することはありません。単にモジュール名 ‘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: 9df. 文は
モジュール（さらに言えばスクリプトでも）の先頭に置きますが、これは慣習で
あって必須ではありません。インポートされたモジュール名は、モジュールのト
ップレベル（関数やクラスの外）に書いてあれば、モジュールのグローバルな名
前空間に置かれます。

*note import: 9df. 文には、あるモジュール内の名前を、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: 1665. が付いていても使え、同じ効果が得
られます:

     >>> 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(): 92d. を使ってください。

* 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: 2254. にあります。見つからなかった場合は、
‘spam.py’ という名前のファイルを *note sys.path: 19f. にあるディレクトリ
のリストから探します。 ‘sys.path’ は以下の場所に初期化されます:

   * 入力されたスクリプトのあるディレクトリ (あるいはファイルが指定され
     なかったときはカレントディレクトリ)。

   * *note PYTHONPATH: 13cb. (ディレクトリ名のリスト。シェル変数の
     ‘PATH’ と同じ構文)。

   * インストール方法に依存したデフォルト（慣例として ‘site-packages’ デ
     ィレクトリーが含まれ、*note site: cf. モジュールによって処理される
     ）。

詳細は *note sys.path モジュール検索パスの初期化: 1974. を参照してくださ
い。

     注釈: シンボリックリンクをサポートするファイルシステム上では、入力
     されたスクリプトのあるディレクトリはシンボリックリンクをたどった後
     に計算されます。言い換えるとシンボリックリンクを含むディレクトリは
     モジュール検索パスに追加 'されません'。

初期化された後、 Python プログラムは *note sys.path: 19f. を修正すること
ができます。スクリプトファイルを含むディレクトリが検索パスの先頭、標準ラ
イブラリパスよりも前に追加されます。なので、ライブラリのディレクトリにあ
るファイルよりも、そのディレクトリにある同じ名前のスクリプトが優先してイ
ンポートされます。これは、標準ライブラリを意図して置き換えているのでない
限りは間違いのもとです。より詳しい情報は *note 標準モジュール: 2255. を
参照してください。


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: 438. または *note -OO: 1172. スイッチを使うことができ
     ます。‘-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: 11f. モジュールは Windows システムでのみ提供されています。
1つ注目に値するモジュールとして、 *note sys: e2. モジュールは、全ての
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:
13cb. から得たデフォルトパスに、 ‘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(): a28. は、あるモジュールがどんな名前を定義してい
るか調べるために使われます。 ‘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(): a28. は現在定義している名前を列挙します:

     >>> a = [1, 2, 3, 4, 5]
     >>> import fibo
     >>> fib = fibo.fib
     >>> dir()
     ['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys']

変数、モジュール、関数、その他の、すべての種類の名前をリストすることに注
意してください。

*note dir(): a28. は、組込みの関数や変数の名前はリストしません。これらの
名前からなるリストが必要なら、標準モジュール *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:
535. を使う場合を除く)。 これにより、 ‘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: 1c8. が送出されます。

反対に、 ‘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: 9df. 文の使う規約は、パッケージの
‘__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: 9df. 文で明示的にロードされたものも含みます
。以下のコードを考えてください:

     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__: 2261. をサポートし
ています。この属性は、パッケージの ‘__init__.py’ 中のコードが実行される
よりも前に、 ‘__init__.py’ の収められているディレクトリ名の文字列を含ん
だ 入った *note sequence: 904. になるよう初期化されます。この変数は変更
することができます。変更を加えると、以降そのパッケージに入っているモジュ
ールやサブパッケージの検索に影響します。

この機能はほとんど必要にはならないのですが、パッケージ内存在するモジュー
ル群を拡張するために使うことができます。

脚注
....


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(): 1324. 関数が出てきました。 (第三はファイルオブジェクトの
*note write(): 2268. メソッドを使う方法です。標準出力を表すファイルは
‘sys.stdout’ で参照できます。詳細はライブラリリファレンスを参照してくだ
さい。)

単に空白区切りで値を並べただけの出力よりも、フォーマットを制御したいと思
うことはよくあることでしょう。 出力をフォーマットする方法はいくつかあり
ます。

   * *note フォーマット済み文字列リテラル: 2269. を使うには、開き引用符
     や三重の開き引用符の前に ‘f’ あるいは ‘F’ を付けて文字列を始めます
     。 この文字列の内側では、文字 ‘{’ と文字 ‘}’ の間に Python の式が書
     け、その式から変数やリテラル値が参照できます。

          >>> year = 2016
          >>> event = '国民投票'
          >>> f'{year}年の{event}の結果'
          '2016年の国民投票の結果'

   * 文字列の *note str.format(): a17. メソッドは、もう少し手間がかかり
     ます。 ここでも ‘{’ と ‘}’ を使って変数に代入する場所の印を付けて、
     細かいフォーマットの指示を出せますが、フォーマットされる対象の情報
     を与える必要があります。次のコードには、変数をフォーマットする方法
     の例が二つあります:

          >>> 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: 704. を参照してください。
     )

   * 最後に、文字列のスライス操作や結合操作を使い、全ての文字列を自分で
     処理し、思い通りのレイアウトを作成できます。 文字列型には、文字列の
     間隔を調整して指定されたカラム幅に揃えるのに便利な操作を行うメソッ
     ドがいくつかあります。

凝った出力である必要は無いけれど、デバッグ目的で変数をすばやく表示したい
ときは、 *note repr(): 462. 関数か *note str(): 1ea. 関数でどんな値も文
字列に変換できます。

*note str(): 1ea. 関数は値の人間に読める表現を返すためのもので、 *note
repr(): 462. 関数はインタープリタに読める (あるいは同値となる構文がない
場合は必ず *note SyntaxError: 189. になるような) 表現を返すためのもので
す。人間が読むのに適した特定の表現を持たないオブジェクトにおいては、
‘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: db. module contains support for a simple templating
approach based upon regular expressions, via *note string.Template: a7c.
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 フォーマット済み文字リテラル: 441. (短くして 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(): 179f. を、 ‘'!s'’ は *note str(): 1ea. を、 ‘'!r'’ は
*note repr(): 462. を適用します:

     >>> 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: d74. を参
照してください。 フォーマットについての仕様は *note Format specification
mini-language: 704. のリファレンスガイドを参照してください。


File: python.info,  Node: 文字列の format メソッド,  Next: 文字列の手作業でのフォーマット,  Prev: フォーマット済み文字列リテラル,  Up: 出力を見やすくフォーマットする

2.7.1.2 文字列の format() メソッド
..................................

*note str.format(): a17. メソッドの基本的な使い方は次のようなものです:

     >>> print('We are the {} who say "{}!"'.format('knights', 'Ni'))
     We are the knights who say "Ni!"

括弧とその中の文字(これをフォーマットフィールドと呼びます)は、 *note
str.format(): a17. メソッドに渡されたオブジェクトに置換されます。括弧の
中の数字は ‘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(): a17. メソッドにキーワード引数が渡された場合、その値
はキーワード引数の名前によって参照されます。

     >>> 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(): 2030. と
組み合わせると特に便利です。

     >>> 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(): a17. による文字列書式設定の完全な解説は、 *note
Format string syntax: 1754. を参照してください。


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(): 1324. の動作で追加されて
いることに注意してください。 ‘print()’ は常に引数間に空白を追加します。)

文字列オブジェクトの *note str.rjust(): 226e. メソッドは、指定された幅の
フィールド内に文字列が右寄せで入るように左側に空白を追加します。 同様の
メソッドとして、 *note str.ljust(): 226f. と *note str.center(): 2270. が
あります。 これらのメソッドは何か出力を行うわけではなく、ただ新しい文字
列を返します。 入力文字列が長すぎる場合、文字列を切り詰めることはせず、
値をそのまま返します。この仕様のためにカラムのレイアウトが滅茶苦茶になる
かもしれませんが、嘘の値が代わりに書き出されるよりはましです。 (本当に切
り詰めを行いたいのなら、全てのカラムに ‘x.ljust(n)[:n]’ のようにスライス
表記を加えることもできます。)

もう一つのメソッド、 *note str.zfill(): 186a. は、数値文字列の左側をゼロ
詰めします。このメソッドは正と負の符号を正しく扱います:

     >>> '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 形式の文字列書式化: abe. にあります。


File: python.info,  Node: ファイルを読み書きする,  Prev: 出力を見やすくフォーマットする,  Up: 入力と出力

2.7.2 ファイルを読み書きする
----------------------------

*note open(): 333. は *note file object: 1581. を返します。大抵、
‘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(): 333. を参照してください)。UTF-8は現在の事実上の標準のため
、異なるエンコーディングを指定したい場合以外は ‘encoding="utf-8"’ の指定
がおすすめです。モードに ‘'b'’ をつけるとファイルを 'binary mode' で開き
ます。バイナリーモードでのデータは *note bytes: 1d2. オブジェクトで読み
書きします。ファイルをバイナリーモードで開くときは 'エンコーディング' は
指定できません。

テキストモードの読み取りでは、プラットフォーム固有の行末記号 (Unix では
‘\n’ 、Windows では ‘\r\n’) をただの ‘\n’ に変換するのがデフォルトの動作
です。テキストモードの書き込みでは、 ‘\n’ が出てくる箇所をプラットフォー
ム固有の行末記号に戻すのがデフォルトの動作です。この裏で行われるファイル
データの変換はテキストファイルには上手く働きますが、 ‘JPEG’ ファイルや
‘EXE’ ファイルのようなバイナリデータを破壊する恐れがあります。そのような
ファイルを読み書きする場合には注意して、バイナリモードを使うようにしてく
ださい。

ファイルオブジェクトを扱うときに *note with: 215. キーワードを使うのは良
い習慣です。 その利点は、処理中に例外が発生しても必ず最後にファイルをち
ゃんと閉じることです。 ‘with’ を使うと、同じことを *note try: adb.-*note
finally: 453. ブロックを使って書くよりずっと簡潔に書けます:

     >>> with open('workfile', encoding="utf-8") as f:
     ...     read_data = f.read()

     >>> # ファイルが自動でクローズされたことが確認できる
     >>> f.closed
     True

もし *note with: 215. キーワードを使用しない場合は、ファイルを閉じ、この
ファイルのために利用されたシステムのリソースを直ちに解放するために
‘f.close()’ を呼び出してください。

     警告: ‘f.write()’ を ‘with’ キーワードや ‘f.close()’ を使わずに呼び
     出した場合、プログラムが正常に終了した場合でも、 ‘f.write()’ の実引
     数がディスクに完全に '書き込まれないことがあります' 。

*note with: 215. 文や ‘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(): 2276. や *note
truncate(): 16ca. といった、あまり使われないメソッドがあります。ファイル
オブジェクトについての完全なガイドは、ライブラリリファレンスを参照してく
ださい。


File: python.info,  Node: json による構造化されたデータの保存,  Prev: ファイルオブジェクトのメソッド,  Up: ファイルを読み書きする

2.7.2.2 ‘json’ による構造化されたデータの保存
.............................................

文字列は簡単にファイルに読み書きできます。数値の場合には少し努力が必要で
す。というのも、 *note read(): 2279. メソッドは文字列しか返さないため、
*note int(): 32e. のような関数にその文字列を渡して、たとえば文字列
‘'123'’ のような文字列を、数値 123 に変換しなくてはならないからです。も
っと複雑なデータ型、例えば入れ子になったリストや辞書の場合、手作業でのパ
ースやシリアライズは困難になります。

ユーザが毎回コードを書いたりデバッグしたりして複雑なデータ型をファイルに
保存するかわりに、Python では一般的なデータ交換形式である JSON
(JavaScript Object Notation)(1) を使うことができます。この標準モジュール
*note json: 85. は、Python のデータ 階層を取り、文字列表現に変換します。
この処理は 'シリアライズ (serializing)' と呼ばれます。文字列表現からデー
タを再構築することは、'デシリアライズ (deserializing)' と呼ばれます。シ
リアライズされてからデシリアライズされるまでの間に、オブジェクトの文字列
表現はファイルやデータの形で保存したり、ネットワークを通じて離れたマシン
に送ったりすることができます。

     注釈: JSON 形式は現代的なアプリケーションでデータをやりとりする際に
     よく使われます。多くのプログラマーが既に JSON に詳しいため、JSON は
     データの相互交換をする場合の良い選択肢です。

オブジェクト ‘x’ があり、その JSON 形式の文字列表現を見るには、単純な1行
のコードを書くだけです:

     >>> import json
     >>> x = [1, 'simple', 'list']
     >>> json.dumps(x)
     '[1, "simple", "list"]'

*note dumps(): 254. に似た関数に、*note dump(): 10ff. があり、こちらは単
純にオブジェクトを *note text file: 227a. にシリアライズします。‘f’ が書
き込み用に開かれた text file だとすると、次のように書くことができます:

     json.dump(x, f)

逆にデシリアライズするには、‘f’ が読み込み用に開かれた *note binary
file: 227b. か *note text file: 227a. だとすると、次のようになります:

     x = json.load(f)

     注釈: JSONファイルは必ずUTF-8でエンコードします。JSONファイルを
     *note text file: 227a. として読み込み、書き込みで開くときには、
     ‘encoding="utf-8"’ を指定します。

このような単純なシリアライズをする手法は、リストや辞書を扱うことはできま
すが、任意のクラス・インスタンスを JSON にシリアライズするにはもう少し努
力しなくてはなりません。*note json: 85. モジュールのリファレンスにこれに
ついての解説があります。

参考
....

*note pickle: ab. - pickle モジュール

*note JSON: 2278. とは対照的に、 '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(): 1324. のところで検出されており、これはその前にコロン (‘':'’) が
抜けているためです。

ファイルに書かれたコードの場合、ファイル名 (上の例では ‘<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: d15, *note NameError: 66c, *note
TypeError: 29c. です。例外型として出力される文字列は、発生した例外の組み
込み名です。これは全ての組み込み例外について成り立ちますが、ユーザ定義の
例外では (成り立つようにするのは有意義な慣習ですが) 必ずしも成り立ちませ
ん。標準例外の名前は組み込みの識別子です (予約語ではありません)。

残りの行は例外の詳細で、その例外の型と何が起きたかに依存します。

エラーメッセージの先頭部分では、例外が発生した実行コンテキスト (context)
を、スタックのトレースバック (stack traceback) の形式で示しています。一
般には、この部分にはソースコード行をリストしたトレースバックが表示されま
す。しかし、標準入力から読み取られたコードは表示されません。

*note 組み込み例外: 1e3d. には、組み込み例外とその意味がリストされていま
す。


File: python.info,  Node: 例外を処理する,  Next: 例外を送出する,  Prev: 例外,  Up: エラーと例外

2.8.3 例外を処理する
--------------------

例外を選別して処理するようなプログラムを書くことができます。以下の例を見
てください。この例では、有効な文字列が入力されるまでユーザに入力を促しま
すが、ユーザがプログラムに (‘Control’-‘C’ か、またはオペレーティングシス
テムがサポートしている何らかのキーを使って) 割り込みをかけてプログラムを
中断させることができるようにしています。ユーザが生成した割り込みは、
*note KeyboardInterrupt: d9a. 例外が送出されることで通知されるということ
に注意してください。

     >>> while True:
     ...     try:
     ...         x = int(input("数字を入力してください: "))
     ...         break
     ...     except ValueError:
     ...         print("おっと!それは数字ではないようです。もう一度入力してください...")
     ...

*note try: adb. 文は下記のように動作します。

   * まず、 'try 節 (try clause)' (キーワード *note try: adb. と *note
     except: 44e. の間の文) が実行されます。

   * 何も例外が発生しなければ、 'except 節' をスキップして *note try:
     adb. 文の実行を終えます。

   * *note try: adb. 節内の実行中に例外が発生すると、その節の残りは飛ば
     されます。次に、例外型が *note except: 44e. キーワードの後に指定さ
     れている例外に一致する場合、except 節が実行された後、 try/except ブ
     ロックの後ろへ実行が継続されます。

   * もしも 'except 節' で指定された例外と一致しない例外が発生すると、そ
     の例外は *note try: adb. 文の外側に渡されます。例外に対するハンドラ
     (handler、処理部) がどこにもなければ、 '処理されない例外 (unhandled
     exception)' となり、エラーメッセージを出して実行を停止します。

A *note try: adb. 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: 44e. 節 内のクラスは、そのクラスや派生クラスのインスタンス
である例外とマッチします（その逆はありません -- 派生クラスが書かれた
'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__(): a14. が定義されており、明示的に
‘.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__(): a14. 出力は、処理されない例外のメッセージ末尾
('詳細') として表示されます。

*note BaseException: 9bd. はすべての例外に共通する基底クラスです。そのサ
ブクラスの一つである *note Exception: da2. は、致命的でない例外すべての
基底クラスです。 ‘Exception’ のサブクラスではない例外は、一般的にプログ
ラムが終了することを示すために使われているため処理されません。例えば、
*note sys.exit(): 506. によって送出される *note SystemExit: 10fb. や、ユ
ーザーがプログラムを中断させたいときに送出される *note
KeyboardInterrupt: d9a. があります。

*note Exception: da2. はほぼすべての例外を捕捉するワイルドカードとして使
えます。しかし良い例外処理の手法とは、処理対象の例外の型をできる限り詳細
に書き、予期しない例外はそのまま伝わるようにすることです。

*note Exception: da2. に対する最も一般的な例外処理のパターンでは、例外を
表示あるいはログ出力してから再度送出します(呼び出し側でも例外を処理でき
るようにします):

     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: adb. ...  *note except: 44e. 文には、オプションで 'else 節
(else clause)' を設けることができます。 *note else: 328. 節を設ける場合
、全ての ‘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: adb. 節よりも ‘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: 9e9. 文を使って、特定の例外を発生させることができます。例え
ば:

     >>> raise NameError('HiThere')
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
         raise NameError('HiThere')
     NameError: HiThere

*note raise: 9e9. の唯一の引数は送出される例外を指し示します。 これは例
外インスタンスか例外クラス(*note BaseException: 9bd. を継承したクラス、
たとえば *note Exception: da2. やそのサブクラス)でなければなりません。 例
外クラスが渡された場合は、引数無しのコンストラクタが呼び出され、暗黙的に
インスタンス化されます:

     raise ValueError  # 'raise ValueError()' の省略記法

例外が発生したかどうかを判定したいだけで、その例外を処理するつもりがなけ
れば、単純な形式の *note raise: 9e9. 文を使って例外を再送出させることが
できます:

     >>> 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: 44e. 節の中で未処理の例外が発生した場合、その未処理の例外
は処理された例外のエラーメッセージに含まれます:

     >>> 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:
9e9. 文にオプションの ‘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 組み込み例外: 1e3d. を参照し
てください。


File: python.info,  Node: ユーザー定義例外,  Next: クリーンアップ動作を定義する,  Prev: 例外の連鎖,  Up: エラーと例外

2.8.6 ユーザー定義例外
----------------------

プログラム上で新しい例外クラスを作成することで、独自の例外を指定すること
ができます (Python のクラスについては *note クラス: 220d. 参照)。例外は
、典型的に *note Exception: da2. クラスから、直接または間接的に派生した
ものです。

例外クラスでは、普通のクラスができることなら何でも定義することができます
が、通常は単純なものにしておきます。大抵は、いくつかの属性だけを提供し、
例外が発生したときにハンドラがエラーに関する情報を取り出せるようにする程
度にとどめます。

ほとんどの例外は、標準の例外の名前付けと同様に、"Error" で終わる名前で定
義されています。

多くの標準モジュールでは、モジュールで定義されている関数内で発生する可能
性のあるエラーを報告させるために、独自の例外を定義しています。


File: python.info,  Node: クリーンアップ動作を定義する,  Next: 定義済みクリーンアップ処理,  Prev: ユーザー定義例外,  Up: エラーと例外

2.8.7 クリーンアップ動作を定義する
----------------------------------

*note try: adb. 文にはもう一つオプションの節があります。この節はクリーン
アップ動作を定義するためのもので、どんな状況でも必ず実行されます。例を示
します:

     >>> 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: 453. 節がある場合、 *note try: adb. 文が終わる前の最
後の処理を、 ‘finally’ 節が実行します。 ‘try’ 文が例外を発生させるか否か
に関わらず、 ‘finally’ 節は実行されます。以下では、例外が発生するという
更に複雑なケースを議論します:

   * もし ‘try’ 文の実行中に例外が発生したら、その例外は *note except:
     44e. 節によって処理されるでしょう。もしその例外が ‘except’ 節によっ
     て処理されなければ、 ‘finally’ 節が実行された後に、その例外が再送出
     されます。

   * ‘except’ 節または ‘else’ 節の実行中に例外が発生することがあり得ます
     。その場合も、 ‘finally’ 節が実行された後に例外が再送出されます。

   * If the ‘finally’ clause executes a *note break: 42f, *note
     continue: 430. or *note return: 452. statement, exceptions are not
     re-raised.  This can be confusing and is therefore discouraged.
     From version 3.14 the compiler emits a *note SyntaxWarning: 451.
     for it (see PEP 765(1)).

   * もし ‘try’ 文が *note break: 42f. 文、 *note continue: 430. 文また
     は *note return: 452. 文のいずれかに達すると、その ‘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: 451.
     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: 453. 節はどの場合にも実行されています
。 文字列で割り算をすることで発生した *note TypeError: 29c. は *note
except: 44e. 節で処理されていないので、 ‘finally’ 節実行後に再度送出され
ています。

実世界のアプリケーションでは、 *note finally: 453. 節は(ファイルやネット
ワーク接続などの)外部リソースを、利用が成功したかどうかにかかわらず解放
するために便利です。

   ---------- 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: 215. 文はファイルの
ようなオブジェクトが常に、即座に正しくクリーンアップされることを保証しま
す。

     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: 6de. は例外インスタンスのリストをまとめ
、同時に送出できるようにします。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
プライベート変数: 2296. に書かれている例外を除いて) '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():
229a. 等の関数や組込み例外名)、モジュール内のグローバルな名前、関数を呼
び出したときのローカルな名前があります。オブジェクトの属性からなる集合も
また、ある意味では名前空間です。名前空間について知っておくべき重要なこと
は、異なった名前空間にある名前の間には全く関係がないということです。例え
ば、二つの別々のモジュールの両方で関数 ‘maximize’ という関数を定義するこ
とができ、定義自体は混同されることはありません -- モジュールのユーザは名
前の前にモジュール名をつけなければなりません。

ところで、 '属性' という言葉は、ドットに続く名前すべてに対して使っていま
す -- 例えば式 ‘z.real’ で、 ‘real’ はオブジェクト ‘z’ の属性です。厳密
にいえば、モジュール内の名前に対する参照は属性の参照です。式
‘modname.funcname’ では、 ‘modname’ はあるモジュールオブジェクトで、
‘funcname’ はその属性です。この場合には、モジュールの属性とモジュールの
中で定義されているグローバル名の間には、直接的な対応付けがされます。これ
らの名前は同じ名前空間を共有しているのです！ (1)

属性は読取り専用にも、書込み可能にもできます。書込み可能であれば、属性に
代入することができます。モジュール属性は書込み可能で、
‘modname.the_answer = 42’ と書くことができます。書込み可能な属性は、
*note del: 1d3c. 文で削除することもできます。例えば、 ‘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:
1661. 文が使えます。nonlocal と宣言されなかった変数は、全て読み出し専用
となります (そのような変数に対する書き込みは、単に '新しい' ローカル変数
をもっとも内側のスコープで作成し、外部のスコープの値は変化しません)。

通常、ローカルスコープは (プログラムテキスト上の) 現在の関数のローカルな
名前を参照します。関数の外側では、ローカルスコープはグローバルな名前空間
と同じ名前空間、モジュールの名前空間を参照します。クラス定義では、ローカ
ルスコープの中にもう一つ名前空間が置かれます。

スコープはテキスト上で決定されていると理解することが重要です。モジュール
内で定義される関数のグローバルなスコープは、関数がどこから呼び出されても
、どんな別名をつけて呼び出されても、そのモジュールの名前空間になります。
反対に、実際の名前の検索は実行時に動的に行われます -- とはいえ、言語の定
義は、"コンパイル" 時の静的な名前解決の方向に進化しているので、動的な名
前解決に頼ってはいけません！ (事実、ローカルな変数は既に静的に決定されて
います。)

Python の特徴として、*note global: 6bb. や *note nonlocal: 1661. 文が有
効でない場合は、名前に対する参照は常に最も内側のスコープに対して有効にな
ります。 代入はデータをコピーしません。オブジェクトを名前に束縛するだけ
です。削除も同様で、‘del x’ は、ローカルスコープの名前空間から ‘x’ に対
する拘束を取り除きます。 つまるところ、新しい名前を与えるようなすべての
操作は、ローカルスコープを使って行われます。 *note import: 9df. 文、関数
の定義は、モジュールや関数名をローカルスコープの名前に拘束します。

*note global: 6bb. 文を使うと、特定の変数がグローバルスコープに存在し、
そこで再束縛されることを指示できます。 *note nonlocal: 1661. 文は、特定
の変数が外側のスコープに存在し、そこで再束縛されることを指示します。

* Menu:

* スコープと名前空間の例::

   ---------- Footnotes ----------

   (1) 例外が一つあります。モジュールオブジェクトには、秘密の読取り専用
の属性 *note __dict__: 1ca. があり、モジュールの名前空間を実装するために
使われている辞書を返します; ‘__dict__’ という名前は属性ですが、グローバ
ルな名前ではありません。この属性を利用すると名前空間の実装に対する抽象化
を侵すことになるので、プログラムを検死するデバッガのような用途に限るべき
です。


File: python.info,  Node: スコープと名前空間の例,  Up: Python のスコープと名前空間

2.9.2.1 スコープと名前空間の例
..............................

異なるスコープと名前空間がどのように参照されるか、また *note global:
6bb. および *note nonlocal: 1661. が変数の束縛にどう影響するか、この例で
実演します:

     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: 1661. 代入は 'scope_test'
上の 'spam' への束縛を変更し、 *note global: 6bb. 代入はモジュールレベル
の束縛を変更しました。

またここから、 *note global: 6bb. 代入の前には '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: 1812. 文) と同様、クラス定義が効果をもつにはまず実
行しなければなりません。 (クラス定義を *note if: 32a. 文の分岐先や関数内
部に置くことも、考え方としてはありえます。)

実際には、クラス定義の内側にある文は、通常は関数定義になりますが、他の文
を書くこともでき、それが役に立つこともあります -- これについては後で述べ
ます。クラス内の関数定義は通常、メソッドの呼び出し規約で決められた独特の
形式の引数リストを持ちます -- これについても後で述べます。

クラス定義に入ると、新たな名前空間が作成され、ローカルな名前空間として使
われます -- 従って、ローカルな変数に対する全ての代入はこの新たな名前空間
に入ります。特に、関数定義を行うと、新たな関数の名前はこの名前空間に結び
付けられます。

クラス定義から普通に (定義の終端に到達して) 抜けると、 'クラスオブジェク
ト (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__: 22a2. も有効な属性で、そのクラスに属
しているドキュメンテーション文字列(docstring) 、この場合は ‘"A simple
example class"’ を返します。

クラスの 'インスタンス化 (instantiation)' には関数記法を使います。クラス
オブジェクトのことを、クラスの新しいインスタンスを返す、引数のない関数の
ように扱ってください。上記クラスで例示すると:

     x = MyClass()

は、クラスの新しい 'インスタンス (instance)' を生成し、そのオブジェクト
をローカル変数 ‘x’ へ代入します。

インスタンス化操作 (クラスオブジェクトの "呼出し") では、空のオブジェク
トが作られます。多くのクラスでは、特定の初期状態にカスタマイズされたオブ
ジェクトを作りたいです。そのために、クラスには *note __init__(): 306. と
いう名前の特殊メソッドを定義できます。例えば次のようにします:

     def __init__(self):
         self.data = []

クラスが *note __init__(): 306. メソッドを定義している場合、クラスをイン
スタンス化すると、新しく作られたクラスインスタンスに対して自動的に
‘__init__()’ を呼び出します。 従って この例では、新たな初期済みインスタ
ンスを次のようにして得られます:

     x = MyClass()

もちろん、より大きな柔軟性を持たせるために、 *note __init__(): 306. メソ
ッドに複数の引数をもたせることができます。その場合、次の例のように、クラ
スのインスタンス化操作に渡された引数は ‘__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 名前とオブジェクトについて: 2298, shared data can
have possibly surprising effects involving *note mutable: 1759. 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(): 2fb. を使うとインスタンスの型が調べられます。
     ‘isinstance(obj, int)’ は ‘obj.__class__’ が *note int: 32e. や
     ‘int’ の派生クラスの場合に限り ‘True’ になります。

   * *note issubclass(): 2fc. を使うとクラスの継承関係が調べられます。
     *note bool: 5f6. は *note int: 32e. のサブクラスなので
     ‘issubclass(bool, int)’ は ‘True’ です。しかし、 *note float: 32f.
     は ‘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(): 44a. の
呼び出しのためにメソッドの解決順序は動的に変更されます。このアプローチは
他の多重継承のある言語で call-next-method として知られており、単一継承し
かない言語の super 呼び出しよりも強力です。

動的順序付けが必要なのは、すべての多重継承で１つ以上のダイヤモンド継承
(少なくとも 1 つの祖先クラスに対して最下位クラスから到達する経路が複数あ
る状態) が見られるためです。例えば、全ての新形式のクラスは *note object:
e51. を継承しているので、どの多重継承でも ‘object’ への到達経路が複数あ
ります。基底クラスが複数回アクセスされないようにするために、動的アルゴリ
ズムで検索順序を線形化します。それは、各クラスで指定されている左から右へ
の順序は崩さず、各々の祖先クラスを一度だけ呼び出し、かつ単調になる (つま
り祖先クラスの検索順序に影響を与えずにクラスをサブクラス化できる) ように
行います。まとめると、これらの特徴のおかげで信頼性と拡張性のある多重継承
したクラスを設計することができるのです。詳細は、 *note The Python 2.3
Method Resolution Order: 1862. を見てください。

In some cases multiple inheritance is not allowed; see *note Multiple
inheritance: 22af. for details.


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: 22b1. 。

名前マングリングは、サブクラスが内部のメソッド呼び出しを壊さずにメソッド
をオーバーライドするのに便利です。例えば:

     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: 32. を使用しま
す。

     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(): 2279. と *note readline(): 22b4. を持つクラスを定義して、ファイ
ルではなく文字列バッファからデータを取得するようにしておき、引数として渡
すことができます。

*note Instance method objects: 22b5. にも属性があります。 *note
m.__self__: 1781. はメソッド ‘m()’ の属しているインスタンスオブジェクト
で、*note m.__func__: 16b6. はそのメソッドに対応する *note function
object: 7a1. です。


File: python.info,  Node: イテレータ iterator,  Next: ジェネレータ generator,  Prev: 残りのはしばし,  Up: クラス

2.9.8 イテレータ (iterator)
---------------------------

すでに気づいているでしょうが、 *note for: 329. 文を使うとほとんどのコン
テナオブジェクトにわたってループを行うことができます:

     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(): bb8. 関数を呼んでいます。関数
は、コンテナの中の要素に1つずつアクセスする *note __next__(): 1687. メソ
ッドが定義されているイテレータオブジェクトを返します。これ以上要素が無い
場合は、 ‘__next__()’ メソッドは *note StopIteration: fbe. 例外を送出し
、その通知を受け *note for: 329. ループは終了します。組み込みの *note
next(): bb9. 関数を使って ‘__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__(): 1687. メ
ソッドを持つオブジェクトを返す *note __iter__(): 22b8. メソッドを定義す
るのです。クラスが ‘__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 ジェネレータ: 1417. は、イテレータを作成するための簡潔で強力なツー
ルです。ジェネレータは通常の関数のように書かれますが、何らかのデータを返
すときには *note yield: d97. 文を使います。そのジェネレータに対して
*note next(): bb9. が呼び出されるたびに、ジェネレータは以前に中断した処
理を再開します (ジェネレータは、全てのデータ値と最後にどの文が実行された
かを記憶しています)。以下の例を見れば、ジェネレータがとても簡単に作成で
きることがわかります:

     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__():
22bb. メソッドと *note __next__(): 22bc. メソッドが自動で作成されるから
です。

ジェネレータのもう一つの重要な機能は、呼び出しごとにローカル変数と実行状
態が自動的に保存されるということです。これにより、 ‘self.index’ や
‘self.data’ といったインスタンス変数を使ったアプローチよりも簡単に関数を
書くことができるようになります。

メソッドを自動生成したりプログラムの実行状態を自動保存するほかに、ジェネ
レータは終了時に自動的に *note StopIteration: fbe. を送出します。これら
の機能を組み合わせると、通常の関数を書くのと同じ労力で、簡単にイテレータ
を生成できます。


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']

     >>> x = [[1,2,3], [], [4, 5]]
     >>> g = (*i for i in x)
     >>> list(g)
     [1, 2, 3, 4, 5]

In most cases, generator expressions must be wrapped in parentheses.  As
a special case, however, when provided as the sole argument to a
function (as in the examples involving ‘sum’, ‘set’, ‘max’, and ‘list’
above), the generator expression does not need to be wrapped in an
additional set of parentheses.  That is to say, the following two pieces
of code are semantically equivalent:

     >>> f(x for x in y)
     >>> f((x for x in y))

as are the following:

     >>> f(*x for x in y)
     >>> f((*x for x in y))

脚注
....


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:\\Python316'
     >>> 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(): 333. が
*note os.open(): 114f. で遮蔽されるのを避けられます。

組み込み関数 *note dir(): a28. および *note help(): cad. は、 *note os:
a5. のような大規模なモジュールで作業をするときに、対話的な操作上の助けに
なります:

     >>> import os
     >>> dir(os)
     <OSモジュールの関数すべてのリストを返す>
     >>> help(os)
     <モジュールの docstring から生成された詳細なマニュアルを返す>

ファイルやディレクトリの日常的な管理作業のために、より簡単に使える高水準
のインターフェースが *note shutil: cd. モジュールで提供されています:

     >>> 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: 67. モジュールでは、ディレクトリのワイルドカード検索からファ
イルのリストを生成するための関数を提供しています:

     >>> 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: e2. モジュールには、 '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: c1. モジュールでは、より高度な文字列処理のための正規表現を提供
しています。正規表現は複雑な一致検索や操作に対して簡潔で最適化された解決
策を提供します:

     >>> 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: 91. モジュールは、浮動小数点演算のための C 言語ライブラリ関
数にアクセスする手段を提供しています:

     >>> import math
     >>> math.cos(math.pi / 4)
     0.70710678118654757
     >>> math.log(1024, 2)
     10.0

*note random: c0. モジュールは、乱数に基づいた要素選択のためのツールを提
供しています:

     >>> 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: da. モジュールは数値データの基礎的な統計的特性（平均、
中央値、分散等）を計算します:

     >>> 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: 114. と、メールを送るための
*note smtplib: d2. です:

     >>> 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: 33. モジュールは、日付や時刻を操作するためのクラスを、単
純な方法と複雑な方法の両方で提供しています。日付や時刻に対する算術がサポ
ートされている一方、実装では出力のフォーマットや操作のための効率的なデー
タメンバ抽出に重点を置いています。このモジュールでは、タイムゾーンに対応
したオブジェクトもサポートしています。

     >>> # 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: 13c, *note gzip: 6a, *note bz2: 14,
*note lzma: 8d, *note zipfile: 13a, *note tarfile: e7.。

     >>> 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: f8.
モジュールを使えば、パフォーマンスがほんの少し良いことがすぐに分かります
:

     >>> 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: f8. では小さい粒度を提供しているのに対し、 *note profile:
b4. や *note pstats: b8. モジュールではより大きなコードブロックにおいて
律速となる部分を判定するためのツールを提供しています。


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: 3d. モジュールでは、モジュールを検索してプログラムの
docstring に埋め込まれたテストの評価を行うためのツールを提供しています。
テストの作り方は単純で、典型的な呼び出し例とその結果を docstring にカッ
ト&ペーストするだけです。この作業は、ユーザに使用例を与えるという意味で
ドキュメントの情報を増やすと同時に、ドキュメントに書かれているコードが正
しい事を確認できるようになります:

     def average(values):
         """数値のリストの算術平均を計算する。

         >>> print(average([20, 30, 70]))
         40.0
         """
         return sum(values) / len(values)

     import doctest
     doctest.testmod()   # docstring に埋め込まれたテストを自動的に評価

*note unittest: 10f. モジュールは *note doctest: 3d. モジュールほど気楽
に使えるものではありませんが、より網羅的なテストセットを別のファイルで管
理することができます:

     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: 137. および *note xmlrpc.server: 138. モジュー
     ルは、遠隔手続き呼び出し (remote procedure call) を全く大したことの
     ない作業に変えてしまいます。モジュール名とは違い、XML を扱うための
     直接的な知識は必要ありません。

   * *note email: 3e. パッケージは、MIME やその他の RFC 5322(1) に基づく
     メッセージ文書を含む電子メールメッセージを管理するためのライブラリ
     です。実際にメッセージを送信したり受信したりする *note smtplib: d2.
     や *note poplib: b1. と違って、email パッケージには (添付文書を含む
     ) 複雑なメッセージ構造の構築やデコードを行ったり、インターネット標
     準のエンコードやヘッダプロトコルの実装を行ったりするための完全なツ
     ールセットを備えています。

   * *note json: 85. パッケージはこの一般的なデータ交換形式のパースをロ
     バストにサポートしています。*note csv: 2c. モジュールはデータベース
     や表計算で一般的にサポートされている CSV ファイルを直接読み書きする
     のをサポートしています。*note xml.etree.ElementTree: 12e.、*note
     xml.dom: 12a. ならびに *note xml.sax: 132. パッケージは XML の処理
     をサポートしています。総合すると、これらのモジュールによって Python
     アプリケーションと他のツールの間でとても簡単にデータを受け渡すこと
     が出来ます。

   * *note sqlite3: d7. モジュールは SQLite データベースライブラリのラッ
     パーです。若干非標準の SQL シンタックスを用いて更新や接続出来る永続
     的なデータベースを提供します。

   * 国際化に関する機能は、 *note gettext: 66, *note locale: 89, *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: c3. モジュールは、大きなコンテナや、深くネストしたコンテ
ナを省略して表示するバージョンの *note repr(): 462. を提供しています:

     >>> 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: f5. モジュールは、段落で構成された文章を、指定したスクリ
ーン幅にぴったり収まるように調整します:

     >>> 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: 89. モジュールは、文化により異なるデータ表現形式のデータベ
ースにアクセスします。 ‘locale’ の *note format(): 440. 関数の 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: db. モジュールには、柔軟で、エンドユーザが簡単に編集できる
簡単な構文を備えた *note Template: a7c. クラスが入っています。このクラス
を使うと、ユーザがアプリケーションを修正することなしにアプリケーションの
出力をカスタマイズできるようになります。

テンプレートでは、‘$’ と有効な 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(): 22e3. メソッドは、プレースホルダに相当する値が辞書や
キーワード引数にない場合に *note KeyError: 7e5. を送出します。メールマー
ジ機能のようなアプリケーションの場合、ユーザが入力するデータは不完全なこ
とがあるので、欠落したデータがあるとプレースホルダをそのままにして出力す
る *note safe_substitute(): 22e4. メソッドを使う方が適切かもしれません:

     >>> 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: a7c. のサブクラスを
派生すると変更することができます。例えば、画像ブラウザ用に一括で名前を変
更するユーティリティを作っていたとして、現在の日付や画像のシーケンス番号
、ファイル形式といったプレースホルダにパーセント記号を使うことにしたら、
次のようになります:

     >>> 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: de. モジュールでは、様々な長さのバイナリレコード形式を操作
する *note pack(): 1630. や *note unpack(): 1aa2. といった関数を提供して
います。 以下の例では、 *note zipfile: 13a. モジュールを使わずに、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: f6. でメインのプロ
グラムを動かしながら背後で別のタスクを動作させられるようにする方法を示し
ています:

     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: f6. モジュールではロックやイベント、状態変数、セマフ
ォといった数々の同期プリミティブを提供しています。

こうしたツールは強力な一方、ちょっとした設計上の欠陥で再現困難な問題を引
き起こすことがあります。したがって、タスク間調整では *note queue: be. モ
ジュールを使って他の複数のスレッドからのリクエストを一つのスレッドに送り
込み、一つのリソースへのアクセスをできるだけ一つのスレッドに集中させるほ
うが良いでしょう。スレッド間の通信や調整に *note Queue: 174d. オブジェク
トを使うと、設計が容易になり、可読性が高まり、信頼性が増します。


File: python.info,  Node: ログ記録,  Next: Weak references,  Prev: マルチスレッディング<2>,  Up: Brief tour of the standard library --- part II

2.11.5 ログ記録
---------------

*note logging: 8a. モジュールでは、数多くの機能をそなえた柔軟性のあるロ
グ記録システムを提供しています。最も簡単な使い方では、ログメッセージをフ
ァイルや ‘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(): 22eb. と *note debug(): 11e2. による出力は
抑制され、出力は標準エラーに送信されます。選択可能な送信先には、email、
データグラム、ソケット、HTTP サーバへの送信などがあります。新たにフィル
タを作成すると、*note DEBUG: 22ec.、*note INFO: 22ed.、*note WARNING:
22ee.、*note ERROR: 22ef.、*note CRITICAL: 22f0. といったメッセージのプ
ライオリティによって異なる送信先を選択することができます。

ログ記録システムは 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 ガベージコレクション: 19fe. で循環参照を除去しま
す)。オブジェクトに対する最後の参照がなくなってしばらくするとメモリは解
放されます。

このようなアプローチはほとんどのアプリケーションでうまく動作しますが、中
にはオブジェクトをどこか別の場所で利用している間だけ追跡しておきたい場合
もあります。残念ながら、オブジェクトを追跡するだけでオブジェクトに対する
恒久的な参照を作ることになってしまいます。 *note weakref: 11d. モジュー
ルでは、オブジェクトへの参照を作らずに追跡するためのツールを提供していま
す。弱参照オブジェクトが不要になると、弱参照 (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:/python316/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: 6cb. オブジェクトを
提供しています。配列はリストに似ていますが、同種のデータのみを よりコン
パクトに格納します。 以下の例に示すのは、通常 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: 9db. オブジェクトを
提供しています。リスト型に似ていますが、データの追加と左端からの取り出し
が速く、その一方で中間にある値の参照は遅くなります。こうしたオブジェクト
はキューや木構造の幅優先探索の実装に向いています:

     >>> 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: 6c. モジュールは、通常のリストでヒープを実装するための関数
を提供しています。ヒープでは、最も低い値をもつエントリがつねにゼロの位置
に配置されます。ヒープは、毎回リストをソートすることなく、最小の値をもつ
要素に繰り返しアクセスするようなアプリケーションで便利です:

     >>> 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: 39. モジュールでは、 10 進浮動小数の算術演算をサポートす
る *note Decimal: 1cd. データ型を提供しています。組み込みの 2 進浮動小数
の実装である *note float: 32f. に比べて、このクラスがとりわけ便利なのは
、以下の場合です

   * 財務アプリケーションやその他の正確な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: 1cd. を使った計算では、末尾桁のゼロが保存されて
おり、有効数字2桁の被乗数から自動的に有効数字を 4 桁と判断しています。
‘Decimal’ は手計算と 同じ方法で計算を行い、2 進浮動小数が 10 進小数成分
を正確に表現できないことに よって起きる問題を回避しています。

*note Decimal: 1cd. クラスは厳密な値を表現できるため、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: 39. モジュールを使うと、必要なだけの精度で算術演算を行え
ます:

     >>> 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 仮想環境: 22fc. を作ることです。仮想環境とは、
特定のバージョンの 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: 11a. と呼ばれま
す。 ‘venv’ は、コマンドが実行された Python のバージョン (*note
-version: 10d9. オプションで表示される) をインストールします。例えば、
‘python3.12’ でコマンドを実行すると、バージョン 3.12 がインストールされ
ます。

仮想環境を作るには、仮想環境を置くディレクトリを決めて、 そのディレクト
リのパスを指定して、 *note venv: 11a. をスクリプトとして実行します:

     python -m venv tutorial-env

これは ‘tutorial-env’ ディレクトリがなければ作成して、その中に Python イ
ンタプリタ、その他関連するファイルのコピーを含むサブディレクトリを作りま
す。

仮想環境の一般的なディレクトリの場所は ‘.venv’ です。この名前は、通常は
シェルで隠されているため、ディレクトリが存在する理由を説明する名前を付け
ても、邪魔にはなりません。また、一部のツールでサポートされている ‘.env’
環境変数定義ファイルによるクラッシュも防止します。

仮想環境を作ったら、それを有効化する必要があります。

Windows の場合:

     tutorial-env\Scripts\activate

Unix や Mac OS の場合:

     source tutorial-env/bin/activate

(このスクリプトは bash shell で書かれています。 ‘csh’ や ‘fish’ を利用し
ている場合、代わりに利用できる ‘activate.csh’ と ‘activate.fish’ スクリ
プトがあります。)

仮想環境を有効化すると、シェルのプロンプトに利用中の仮想環境が表示される
ようになり、‘python’ を実行するとその仮想環境の Python を実行するように
なります:

     $ source ~/envs/tutorial-env/bin/activate
     (tutorial-env) $ python
     Python 3.5.1 (default, May  6 2016, 10:59:36)
       ...
     >>> import sys
     >>> sys.path
     ['', '/usr/local/lib/python35.zip', ...,
     '~/envs/tutorial-env/lib/python3.5/site-packages']
     >>>

仮想環境を無効化するには、ターミナルに:

     deactivate

と入力します。


File: python.info,  Node: pip を使ったパッケージ管理,  Prev: 仮想環境の作成,  Up: 仮想環境とパッケージ

2.12.3 pip を使ったパッケージ管理
---------------------------------

　‘pip’ と呼ばれるプログラムでパッケージをインストール、アップグレード、
削除することができます。デフォルトでは ‘pip’ は Python Package Index(1)
からパッケージをインストールします。ブラウザを使って Python Package
Index を閲覧することができます。

‘pip’ は "install" 、 "uninstall" 、 "freeze" など、いくつかのサブコマン
ドを持っています。 (‘pip’ の完全なドキュメントは *note Python
モジュールのインストール: 12a9. ガイドを参照してください。)

パッケージ名を指定してそのパッケージの最新版をインストールすることができ
ます:

     (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 モジュールのインストール: 12a9. を参照してください。パッケ
ージを作成してそれを 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 標準ライブラリ: 3fe.:

     このマニュアルをざっと眺めておくと便利です。このマニュアルは型、関
     数、標準ライブラリのモジュールについての完全なリファレンスです。標
     準的なPython配布物は 'たくさんの' 追加コードを含んでいます。Unix メ
     ールボックスの読み込み、HTTPによるドキュメント取得、乱数の生成、コ
     マンドラインオプションの構文解析、データ圧縮やその他たくさんのタス
     クのためのモジュールがあります。ライブラリリファレンスをざっと見る
     ことで、何が利用できるかのイメージをつかむことができます。

   * *note Python モジュールのインストール: 12a9. は、他のPythonユーザに
     よって書かれた追加モジュールをどうやってインストールするかを説明し
     ています。

   * *note Python 言語リファレンス: 3ff.: 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 よくある質問: 2303. (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
自動的に有効化されます: 1377. 。 従って ‘Tab’ キーは補完機能を呼び出し、
Python の文の名前、現在のローカル変数、および利用可能なモジュール名を検
索します。 ‘string.a’ のようなドットで区切られた式については、最後の
‘'.'’ までの式を評価し、結果として得られたオブジェクトの属性から補完候補
を示します。 *note __getattr__(): 8e8. メソッドを持ったオブジェクトが式
に含まれている場合、 ‘__getattr__()’ がアプリケーション定義のコードを実
行するかもしれないので注意してください。デフォルトの設定ではあなたのユー
ザーディレクトリの ‘.python_history’ という名前のファイルに履歴を保存し
ます。 履歴は次回の対話的なインタプリタのセッションで再び利用することが
できます。


File: python.info,  Node: 対話的インタープリタの代替,  Prev: タブ補完と履歴編集,  Up: 対話入力編集と履歴置換

2.14.2 対話的インタープリタの代替
---------------------------------

この機能は、初期の版のインタープリタに比べれば大きな進歩です。とはいえ、
まだいくつかの要望が残されています。例えば、行を継続するときに正しいイン
デントが提示されたら快適でしょう (パーサは次の行で *note INDENT: 230b. ト
ークンが必要かどうかを知っています)。補完機構がインタープリタのシンボル
テーブルを使ってもよいかもしれません。括弧やクォートなどの対応をチェック
する (あるいは指示する) コマンドも有用でしょう。

より優れた対話的インタープリタの代替の一つに 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(): 462. ビルトイン関数は 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(): 1694. 関数を使って計算前に丸めを行なって
も意味がありません:

     >>> round(0.1, 1) + round(0.1, 1) + round(0.1, 1) == round(0.3, 1)
     False

数値を意図した正確な値に近づけることはできませんが、 *note
math.isclose(): 116d. 関数は不正確な値を比べるのに便利です:

     >>> math.isclose(0.1 + 0.1 + 0.1, 0.3)
     True

あるいは、 *note round(): 1694. 関数を粗い近似値比較に使うこともできます
:

     >>> 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(): 1ea. で十分ですが
、きめ細かな制御をしたければ、 *note Format string syntax: 1754. にある
*note str.format(): a17. メソッドのフォーマット仕様を参照してください。

正確な10進数表現が必要となるような場合には、 *note decimal: 39. モジュー
ルを利用してみてください。このモジュールは会計アプリケーションや高精度の
計算が求められるアプリケーションに適した、10進数の計算を実装しています。

別の正確な計算方法として、 *note fractions: 60. モジュールが有理数に基づ
く計算を実装しています (1/3 のような数を正確に表すことができます)。

あなたが浮動小数点演算のヘビーユーザーなら、SciPy プロジェクトが提供して
いる NumPy パッケージやその他の数学用パッケージを調べてみるべきです。
<‘https://scipy.org’> を参照してください。

Python は '本当に' float の正確な値が必要なレアケースに対応するためのツ
ールを提供しています。 *note float.as_integer_ratio(): 2310. メソッドは
float の値を有理数として表現します:

     >>> x = 3.14159
     >>> x.as_integer_ratio()
     (3537115888337719, 1125899906842624)

この分数は正確なので、元の値を完全に復元することができます:

     >>> x == 3537115888337719 / 1125899906842624
     True

*note float.hex(): 2311. メソッドは float の値を16進数で表現します。この
値もコンピューターが持っている正確な値を表現できます:

     >>> x.hex()
     '0x1.921f9f01b866ep+1'

この正確な16進数表現はもとの float 値を正確に復元するために使うことがで
きます:

     >>> x == float.fromhex('0x1.921f9f01b866ep+1')
     True

この16進数表現は正確なので、値を (プラットフォームにも依存せず) バージョ
ンの異なるPython 間でやり取りしたり、他のこのフォーマットをサポートした
言語 (Java や C99 など) と正確にやり取りするのに利用することができます。

別の便利なツールとして、合計処理における精度のロスを緩和してくれる *note
sum(): 886. 関数があります。これは累計加算中の丸めに拡張精度を使います。
これにより、誤差が最終的な合計値に影響を与えるまで蓄積されなくなり、結果
が改善されます:

     >>> 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(): 178d. 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(): 886. 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: 60. モジュールと *note decimal: 39. モジュールを使うと
これらの計算を簡単に行えます:

     >>> 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: 6a3. は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 色の制御: 1ba. for details.  Function keys
provide some additional functionality.  ‘F1’ enters the interactive help
browser *note pydoc: bd.  ‘F2’ allows for browsing command-line history
with neither output nor the *note >>>: 6a4. and *note ...: 6a5. 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:
459. で無効にできます。

* Menu:

* エラー処理::
* 実行可能な Python スクリプト::
* 対話モード用の起動時実行ファイル::
* カスタマイズ用モジュール::


File: python.info,  Node: エラー処理,  Next: 実行可能な Python スクリプト,  Up: 対話モード<2>

2.16.1.1 エラー処理
...................

エラーが発生すると、インタープリタはエラーメッセージとスタックトレースを
表示します。対話モードでは、それから元のプロンプトに戻ります; ファイルか
ら実行した場合は、スタックトレースを表示してゼロ以外の終了ステータスで終
了します（*note try: adb. 文の *note except: 44e. 節で処理された例外は、
ここでいうエラーにはあたりません。）一部のエラーは無条件に致命的であり、
ゼロ以外の終了ステータスで終了します; これは内部の不整合やある種のメモリ
不足の場合に適用されます。エラーメッセージは全て標準エラー出力に書き込ま
れます; これに対して、通常は実行した命令から出力される内容は標準出力に書
き込まれます。

割り込み文字 (interrupt character、普通は ‘Control’-‘C’ か ‘Delete’) を
一次または二次プロンプトに対してタイプすると、入力が取り消されて一次プロ
ンプトに戻ります。 (1) コマンドの実行中に割り込み文字をタイプすると
*note KeyboardInterrupt: d9a. 例外が送出されます。この例外は *note try:
adb. 文で処理できます。

   ---------- 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: 45a. と呼ばれる環境変数を、インタプリタ起動時に実行
されるコマンドが入ったファイル名に設定します。この機能は 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: 1747. オプションを使わない限り、全ての Python の起動時に実行されます
。

sitecustomize モジュールも同じように動作しますが、一般的にコンピューター
の管理者によって、グローバルの site-packages ディレクトリに作成され、
usercustomize より先にインポートされます。詳細は *note site: cf. モジュ
ールのドキュメントを参照してください。

脚注
....


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の実装: 2326. を参照してください。

* 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 対話モード: 6a6.

   * ファイル名引数か、標準入力としてファイルを渡された場合、そのファイ
     ルからスクリプトを読み込んで実行します。

   * ディレクトリ名を引数に受け取った場合、そのディレクトリから適切な名
     前のスクリプトファイルを読み込んで実行します。

   * When called with ‘-c command’, it executes the Python statement(s)
     given as 'command'.  Here 'command' may contain multiple statements
     separated by newlines.

   * ‘-m モジュール名’ として Python モジュールパスにあるモジュールを指
     定された場合、そのモジュールをスクリプトとして実行します。

非インタラクティブモードでは、入力の全体が実行前にパースされます。

インタプリタによって消費されるオプションリストが終了したあと、継続する全
ての引数は *note sys.argv: 161e. に渡ります。 - ただし、添字 0 の先頭要
素(‘sys.argv[0]’) はプログラムのソース自体を示す文字列です。

 -- Option: -c <command>

     'command' 内の Python コードを実行します。 'command' は改行によって
     区切られた1行以上の文です。通常のモジュールのコードと同じく、行頭の
     空白文字は意味を持ちます。

     このオプションが指定された場合、 *note sys.argv: 161e. の最初の要素
     は ‘"-c"’ になり、カレントディレクトリが *note sys.path: 19f. の先
     頭に追加されます (そのディレクトリにあるモジュールをトップレベルモ
     ジュールとして import 出来るようになります)。

     引数 ‘command’ を指定して *note 監査イベント: 1e84.
     ‘cpython.run_command’ を送出します。

     バージョン 3.14 で変更: 'command' is automatically dedented before
     execution.

 -- Option: -m <module-name>

     *note sys.path: 19f. から指定されたモジュール名のモジュールを探し、
     その内容を *note __main__: 1. モジュールとして実行します。

     引数は 'module' 名なので、拡張子 (‘.py’) を含めてはいけません。モジ
     ュール名は有効な Python の絶対モジュール名 (absolute module name) で
     あるべきですが、実装がそれを強制しているとは限りません (例えば、ハ
     イフンを名前に含める事を許可するかもしれません)。

     パッケージ名 (名前空間パッケージも含む) でも構いません。通常のモジ
     ュールの代わりにパッケージ名が与えられた場合、インタプリタは
     ‘<pkg>.__main__’ を main モジュールとして実行します。この挙動はスク
     リプト引数として渡されたディレクトリや zip ファイルをインタプリタが
     処理するのと意図的に同じにしています。

          注釈: このオプションは組み込みモジュールや C で書かれた拡張モ
          ジュールには利用できません。 Python モジュールファイルを持って
          いないからです。しかし、コンパイル済みのモジュールは、たとえ元
          のソースファイルがなくても利用可能です。

     このオプションが指定された場合、 *note sys.argv: 161e. の最初の要素
     はモジュールファイルのフルパスになります (モジュールファイルを検索
     している間、最初の要素は ‘"-m"’ に設定されます)。 *note -c: 44c. オ
     プションと同様に、カレントディレクトリが *note sys.path: 19f. の先
     頭に追加されます。

     *note -I: d2c. option can be used to run the script in isolated
     mode where *note sys.path: 19f. contains neither the current
     directory nor the user's site-packages directory.  All ‘PYTHON*’
     environment variables are ignored, too.

     多くの標準ライブラリモジュールにはスクリプトとして実行された時のた
     めのコードがあります。例えば、 *note timeit: f8. モジュールは次のよ
     うに実行可能です:

          python -m timeit -s "setup here" "benchmarked code here"
          python -m timeit -h # for details

     引数 ‘module-name’ を指定して *note 監査イベント: 1e84.
     ‘cpython.run_module’ を送出します。

     参考
     ....

     *note runpy.run_module(): 1922.

          Python コードで直接使える等価な機能

     PEP 338(1) - モジュールをスクリプトとして実行する

     バージョン 3.1 で変更: ‘__main__’ サブモジュールを実行するパッケー
     ジ名が提供されました。

     バージョン 3.4 で変更: 名前空間パッケージもサポートされました

 -- Describe: -

     標準入力 (*note sys.stdin: 94f.) からコマンドを読み込みます。標準入
     力がターミナルだった場合、暗黙的に *note -i: 1893. オプションが指定
     されます。

     このオプションが指定された場合、 *note sys.argv: 161e. の最初の要素
     は ‘"-"’ で、カレントディレクトリが *note sys.path: 19f. の先頭に追
     加されます。

     引数無しで *note 監査イベント: 1e84. ‘cpython.run_stdin’ を送出しま
     す。

 -- Describe: <script>

     'script' 内の Python コードを実行します。 'script' は、Python ファ
     イル、 ‘__main__.py’ ファイルがあるディレクトリ、 ‘__main__.py’ フ
     ァイルがある zip ファイルのいずれかの、ファイルシステム上の (絶対ま
     たは相対) パスでなければなりません。

     このオプションが指定された場合、 *note sys.argv: 161e. の最初の要素
     はコマンドラインで指定されたスクリプト名になります。

     スクリプト名が Python ファイルを直接指定していた場合、そのファイル
     を含むディレクトリが *note sys.path: 19f. の先頭に追加され、そのフ
     ァイルは *note __main__: 1. モジュールとして実行されます。

     スクリプト名がディレクトリか zip ファイルを指定していた場合、スクリ
     プト名が *note sys.path: 19f. に追加され、その中の ‘__main__.py’ フ
     ァイルが *note __main__: 1. モジュールとして実行されます。

     *note -I: d2c. option can be used to run the script in isolated
     mode where *note sys.path: 19f. contains neither the script's
     directory nor the user's site-packages directory.  All ‘PYTHON*’
     environment variables are ignored, too.

     引数 ‘filename’ を指定して *note 監査イベント: 1e84.
     ‘cpython.run_file’ を送出します。

     参考
     ....

     *note runpy.run_path(): 6b4.

          Python コードで直接使える等価な機能

インターフェイスオプションが与えられなかった場合、*note -i: 1893. が暗黙
的に指定され、‘sys.argv[0]’ が空の文字列 (‘""’) になり、 現在のディレク
トリが *note sys.path: 19f. の先頭に追加されます。また、利用可能であれば
タブ補完と履歴編集が自動的に有効化されます (*note readline の設定: 1377.
を参照してください)。

参考
....

*note インタプリタを起動する: 21d4.

バージョン 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: 183.
     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: 1d2. or *note
     bytearray: 1d1. to *note str: 1ea. without specifying encoding or
     comparing ‘bytes’ or ‘bytearray’ with ‘str’ or ‘bytes’ with *note
     int: 32e.  Issue an error when the option is given twice (‘-bb’).

     バージョン 3.5 で変更: Affects also comparisons of *note bytes:
     1d2. with *note int: 32e.

     バージョン 3.15 で非推奨: Deprecate *note -b: 2f9. and ‘-bb’
     command line options and schedule them to become no-op in Python
     3.17.  These were primarily helpers for the Python 2 -> 3
     transition.  Starting with Python 3.17, no *note BytesWarning: 2fa.
     will be raised for these cases; use a type checker instead.

 -- Option: -B

     与えられた場合、Python はソースモジュールのインポート時に ‘.pyc’ フ
     ァイルの作成を試みません。 *note PYTHONDONTWRITEBYTECODE: 1787. 環
     境変数も参照してください。

 -- Option: --check-hash-based-pycs default|always|never

     Control the validation behavior of hash-based ‘.pyc’ files.  See
     *note キャッシュされたバイトコードの無効化: 9e8.  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: 2332. environment variable.

     This option requires a *note debug build of Python: 3e3, otherwise
     it's ignored.

 -- Option: -E

     Ignore all ‘PYTHON*’ environment variables, e.g.  *note PYTHONPATH:
     13cb. and *note PYTHONHOME: 3b5, that might be set.

     See also the *note -P: 9a8. and *note -I: d2c. (isolated) options.

 -- Option: -i

     Enter interactive mode after execution.

     Using the *note -i: 1893. option will enter interactive mode in any
     of the following circumstances:

        * When a script is passed as first argument

        * When the *note -c: 44c. option is used

        * When the *note -m: 4d1. option is used

     Interactive mode will start even when *note sys.stdin: 94f. does
     not appear to be a terminal.  The *note PYTHONSTARTUP: 45a. file is
     not read.

     このオプションはグローバル変数や、スクリプトが例外を発生させるとき
     にそのスタックトレースを調べるのに便利です。 *note PYTHONINSPECT:
     1892. も参照してください。

 -- Option: -I

     Python を隔離モードで実行します。*note -E: d2b.、*note -P: 9a8.、お
     よび *note -s: 1747. オプションも暗黙的に指定されます。

     In isolated mode *note sys.path: 19f. 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__: bbb.  Augment the filename for compiled (*note
     bytecode: 6b9.) files by adding ‘.opt-1’ before the ‘.pyc’
     extension (see PEP 488(1)).  See also *note PYTHONOPTIMIZE: 2333.

     バージョン 3.5 で変更: PEP 488(2) に従って ‘.pyc’ ファイル名を変更
     します。

 -- Option: -OO

     Do *note -O: 438. and also discard docstrings.  Augment the
     filename for compiled (*note bytecode: 6b9.) 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: 19f.:

        * ‘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: 9a9. environment variable, and
     *note -E: d2b. and *note -I: d2c. (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: 1434. 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__(): ec5. 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: 1434. によってハッシュシードの固定値を秘密に
     することが出来ます。

     Added in version 3.2.3.

     バージョン 3.7 で変更: このオプションが無視されなくなりました.

 -- Option: -s

     *note ユーザのサイトパッケージのディレクトリ: 2334. を *note
     sys.path: 19f. に追加しません。

     See also *note PYTHONNOUSERSITE: 1748.

     参考
     ....

     PEP 370(5) - ユーザごとの ‘site-packages’ ディレクトリ

 -- Option: -S

     *note site: cf. モジュールの import と、そのモジュールが行なってい
     た site ごとの *note sys.path: 19f. への操作を無効にします。後で
     ‘site’ を明示的に import しても、これらの操作は実行されません (実行
     したい場合は、 *note site.main(): 2335. を呼び出してください)。

 -- Option: -u

     Force the stdout and stderr streams to be unbuffered.  This option
     has no effect on the stdin stream.

     *note PYTHONUNBUFFERED: 1f9f. も参照してください。

     バージョン 3.7 で変更: The text layer of the stdout and stderr
     streams now is unbuffered.

 -- Option: -v

     モジュールが初期化されるたびにメッセージを出力し、それがどこ (ファ
     イル名やビルトインモジュール) からロードされたのかを表示します。 二
     回与えられた場合 (‘-vv’) は、モジュールを検索するときにチェックした
     ファイルごとにメッセージを出力します。また、終了時のモジュールクリ
     ーンアップに関する情報も提供します。

     バージョン 3.10 で変更: The *note site: cf. module reports the
     site-specific paths and ‘.pth’ files being processed.

     *note PYTHONVERBOSE: 2336. も参照してください。

 -- Option: -W arg

     警告制御。 Python の警告機構はデフォルトでは警告メッセージを *note
     sys.stderr: d09. に表示します。

     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 start of the warning message;
     this match is case-insensitive.  If it starts and ends with a
     forward slash (‘/’), it specifies a regular expression, otherwise
     it specifies a literal string.

     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.  If it starts and ends with a forward
     slash (‘/’), it specifies a regular expression that the start of
     the fully qualified module name must match, otherwise it specifies
     a literal string that the fully qualified module name must be equal
     to.

     The 'lineno' field matches the line number, where zero matches all
     line numbers and is thus equivalent to an omitted line number.

     複数の *note -W: 1cb. オプションを指定することができます。警告が1つ
     以上のオプションとマッチしたときは、最後にマッチしたオプションのア
     クションが有効になります。不正な ‘-W’ オプションは無視されます (最
     初の警告が発生したときに、不正なオプションに対する警告メッセージが
     表示されます)。

     Warnings can also be controlled using the *note PYTHONWARNINGS:
     1cc. environment variable and from within a Python program using
     the *note warnings: 11b. module.  For example, the *note
     warnings.filterwarnings(): 1861. function can be used to use a
     regular expression on the warning message.

     詳しくは *note 警告フィルタ: 1d7. と *note Describing Warning
     Filters: 2338. を参照してください。

     バージョン 3.15 で変更: Added regular expression support for
     'message' and 'module'.

 -- Option: -x

     Unix 以外の形式の ‘#!cmd’ を使うために、ソースの最初の行をスキップ
     します。これは、DOS専用のハックのみを目的としています。

 -- Option: -X

     様々な実装固有のオプションのために予約されています。現在のところ
     CPython は以下の値を定義しています:

        * ‘-X faulthandler’ to enable *note faulthandler: 5b.  See also
          *note PYTHONFAULTHANDLER: 143c.

          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: 3e3.

          Added in version 3.4.

        * ‘-X tracemalloc’ to start tracing Python memory allocations
          using the *note tracemalloc: 108. 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():
          233a. and *note PYTHONTRACEMALLOC: 233b. for more information.

          Added in version 3.4.

        * ‘-X int_max_str_digits’ configures the *note integer string
          conversion length limitation: 9f1.  See also *note
          PYTHONINTMAXSTRDIGITS: 1d57.

          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: ebf.

          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: 713,
          introducing additional runtime checks that are too expensive
          to be enabled by default.  See also *note PYTHONDEVMODE: eb9.

          Added in version 3.7.

        * ‘-X utf8’ enables the *note Python UTF-8 Mode: a4b.  ‘-X
          utf8=0’ explicitly disables *note Python UTF-8 Mode: a4b.
          (even when it would otherwise activate automatically).  See
          also *note PYTHONUTF8: 1b8.

          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: d70.

          Added in version 3.8.

        * ‘-X warn_default_encoding’ issues a *note EncodingWarning:
          233c. when the locale-specific default encoding is used for
          opening files.  See also *note PYTHONWARNDEFAULTENCODING: ba1.

          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: 9ba.

          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: 6bc.

          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: 889. and *note Python support for the perf
          map compatible profilers: 6bd.

          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: 6be. and *note Python support for the
          perf map compatible profilers: 6bd.

          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: 420. and PEP 768(7).

          Added in version 3.14.

        * ‘-X cpu_count=N’ overrides *note os.cpu_count(): 6e7, *note
          os.process_cpu_count(): 6e6, and *note
          multiprocessing.cpu_count(): 131e.  '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: 727.  If 'n' is ‘default’, nothing is
          overridden.

          Added in version 3.13.

        * ‘-X presite=MODULE’ or ‘-X presite=MODULE:FUNC’ specifies an
          entry point that should be executed before the *note site: cf.
          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:
          3e3. for this option to exist.  See also *note PYTHON_PRESITE:
          1920.

          バージョン 3.15 で変更: Accept also ‘module:func’ entry point
          format.

          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: 6ab.  See also *note
          PYTHON_GIL: 6ac. and *note フリースレッドの CPython: 686.

          Added in version 3.13.

        * ‘-X thread_inherit_context=0,1’ causes *note Thread: 427. 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: 1aaf.

          Added in version 3.14.

        * ‘-X context_aware_warnings=0,1’ causes the *note
          warnings.catch_warnings: 42a. context manager to use a *note
          ContextVar: 1abc. 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: 1aa3.

          Added in version 3.14.

        * ‘-X pathconfig_warnings=0,1’ if true (‘1’) then *note sys.path
          モジュール検索パスの初期化: 1974. is allowed to log warnings
          into stderr.  If false (‘0’) suppress these warnings.  Set to
          true by default.  See also *note PYTHON_PATHCONFIG_WARNINGS:
          1973.

          Added in version 3.15.

        * ‘-X tlbc=0,1’ enables (1, the default) or disables (0)
          thread-local bytecode in builds configured with *note
          -disable-gil: 6ab.  When disabled, this also disables the
          specializing interpreter.  See also *note PYTHON_TLBC: 233d.

          Added in version 3.14.

        * ‘-X lazy_imports=ALL,NONE,NORMAL’ controls lazy import
          behavior.  ‘all’ makes all imports lazy by default, ‘none’
          disables lazy imports entirely (even explicit ‘lazy’
          statements become eager), and ‘normal’ (the default) respects
          the ‘lazy’ keyword in source code.  See also *note
          PYTHON_LAZY_IMPORTS: 184.

          Added in version 3.15.

     任意の値を渡し、 *note sys._xoptions: 233e. 辞書から取り出すことも
     出来ます。

     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: 68e. 環境変数を使用できます。この変数は、 ‘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: 3b5. が1つのディレクトリに設定されている場合、そ
     の値は ‘`prefix'’ と ‘`exec_prefix'’ の両方を置き換えます。それらに
     別々の値を指定したい場合は、 ‘PYTHONHOME’ を
     ‘`prefix':`exec_prefix'’ のように指定します。

 -- 環境変数: PYTHONPATH

     モジュールファイルのデフォルトの検索パスを追加します。この環境変数
     のフォーマットはシェルの ‘PATH’ と同じで、 *note os.pathsep: 2341.
     (Unix ならコロン、 Windows ならセミコロン) で区切られた1つ以上のデ
     ィレクトリパスです。存在しないディレクトリは警告なしに無視されます
     。

     通常のディレクトリに加えて、 *note PYTHONPATH: 13cb. のエントリはピ
     ュアPython モジュール(ソース形式でもコンパイルされた形式でも) を含
     む zip ファイルを参照することもできます。拡張モジュールは zip ファ
     イルの中から import することはできません。

     デフォルトの検索パスはインストール依存ですが、通常は
     ‘`prefix'/lib/python`version'’ で始まります。 (上の *note
     PYTHONHOME: 3b5. を参照してください。) これは '常に' *note
     PYTHONPATH: 13cb. に追加されます。

     上の *note インターフェイスオプション: 2329. で説明されているように
     、追加の検索パスディレクトリが *note PYTHONPATH: 13cb. の手前に追加
     されます。検索パスは Python プログラムから *note sys.path: 19f. 変
     数として操作することができます。

 -- 環境変数: PYTHONSAFEPATH

     If this is set to a non-empty string, don't prepend a potentially
     unsafe path to *note sys.path: 19f.: see the *note -P: 9a8. option
     for details.

     Added in version 3.11.

 -- 環境変数: PYTHONPLATLIBDIR

     If this is set to a non-empty string, it overrides the *note
     sys.platlibdir: 2b4. value.

     Added in version 3.9.

 -- 環境変数: PYTHONSTARTUP

     この変数が読み込み可能なファイル名の場合、対話モードで最初のプロン
     プトが表示される前にそのファイルの Python コマンドが実行されます。
     ファイル内で定義されているオブジェクトやインポートされたオブジェク
     トを対話セッションで修飾せずに使用するために、ファイルは対話的なコ
     マンドと同じ名前空間で実行されます。 このファイルの中で、プロンプト
     *note sys.ps1: 2342. や *note sys.ps2: 2343.、ならびにフック *note
     sys.__interactivehook__: 1376. も変更できます。

     Raises an *note auditing event: 1e84. ‘cpython.run_startup’ with
     the filename as the argument when called on startup.

 -- 環境変数: PYTHONOPTIMIZE

     この変数に空でない文字列を設定するのは *note -O: 438. オプションを
     指定するのと等価です。整数を設定した場合、 ‘-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(): ea3. which itself is called by built-in *note
     breakpoint(): 500.  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: 2331. オプションを
     指定するのと等価です。整数を指定した場合、 ‘-d’ を複数回指定したの
     と同じになります。

     This environment variable requires a *note debug build of Python:
     3e3, otherwise it's ignored.

 -- 環境変数: PYTHONINSPECT

     この変数に空でない文字列を設定するのは *note -i: 1893. オプションを
     指定するのと等価です。

     この変数は Python コードから *note os.environ: 4ec. を使って変更し
     て、プログラム終了時のインスペクトモードを強制することができます。

     引数無しで *note 監査イベント: 1e84. ‘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: 45a. is also executed.  Emits audit events.

 -- 環境変数: PYTHONUNBUFFERED

     この変数に空でない文字列を設定するのは *note -u: 1f9e. オプションを
     指定するのと等価です。

 -- 環境変数: PYTHONVERBOSE

     この変数に空でない文字列を設定するのは *note -v: 17dd. オプションを
     指定するのと等価です。整数を設定した場合、 ‘-v’ を複数回指定したの
     と同じになります。

 -- 環境変数: PYTHONCASEOK

     この環境変数が設定されている場合、 Python は *note import: 9df. 文
     で大文字/小文字を区別しません。 これは Windows と macOS でのみ動作
     します。

 -- 環境変数: PYTHONDONTWRITEBYTECODE

     この変数に空でない文字列を設定した場合、 Python はソースモジュール
     のインポート時に ‘.pyc’ ファイルを作成しようとはしなくなります。
     *note -B: 1786. オプションを指定するのと等価です。

 -- 環境変数: 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: 183. ‘pycache_prefix=PATH’ option.

     Added in version 3.8.

 -- 環境変数: PYTHONHASHSEED

     この変数が設定されていない場合や ‘random’ に設定された場合、乱数値
     が str、bytes オブジェクトのハッシュのシードに使われます。

     *note PYTHONHASHSEED: 1434. が整数値に設定された場合、その値はハッ
     シュランダム化が扱う型の 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: 9f1.

     Added in version 3.11.

 -- 環境変数: PYTHONIOENCODING

     この変数がインタープリタ実行前に設定されていた場合、
     ‘encodingname:errorhandler’ という文法で標準入力/標準出力/標準エラ
     ー出力のエンコードを上書きします。 ‘encodingname’ と
     ‘:errorhandler’ の部分はどちらも任意で、*note str.encode(): cab. と
     同じ意味を持ちます。

     標準エラー出力の場合、‘:errorhandler’ の部分は無視されます; ハンド
     ラは常に ‘'backslashreplace'’ です。

     バージョン 3.4 で変更: ‘encodingname’ の部分が任意になりました。

     バージョン 3.6 で変更: On Windows, the encoding specified by this
     variable is ignored for interactive console buffers unless *note
     PYTHONLEGACYWINDOWSSTDIO: 101d. is also specified.  Files and pipes
     redirected through the standard streams are not affected.

 -- 環境変数: PYTHONNOUSERSITE

     This is equivalent to the *note -s: 1747. option.  If this is set,
     Python won't add the *note user site-packages directory: 2334. to
     *note sys.path: 19f.

     参考
     ....

     PEP 370(1) - ユーザごとの ‘site-packages’ ディレクトリ

 -- 環境変数: PYTHONUSERBASE

     Defines the *note user base directory: 16d6, which is used to
     compute the path of the *note user site-packages directory: 2334.
     and *note installation paths: 2344. for ‘python -m pip install
     --user’.

     To disable the user site-packages, see *note PYTHONNOUSERSITE:
     1748. or the *note -s: 1747. option.

     参考
     ....

     PEP 370(2) - ユーザごとの ‘site-packages’ ディレクトリ

 -- 環境変数: PYTHONEXECUTABLE

     この環境変数が設定された場合、 ‘sys.argv[0]’ に、C ランタイムから取
     得した値の代わりにこの環境変数の値が設定されます。macOS でのみ動作
     します。

 -- 環境変数: PYTHONWARNINGS

     This is equivalent to the *note -W: 1cb. 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 警告フィルタ: 1d7. と *note Describing Warning
     Filters: 2338. を参照してください。

     バージョン 3.15 で変更: Added regular expression support for
     'message' and 'module'.

 -- 環境変数: PYTHONFAULTHANDLER

     If this environment variable is set to a non-empty string, *note
     faulthandler.enable(): 224. is called at startup: install a handler
     for *note SIGSEGV: 1437, *note SIGFPE: 1438, *note SIGABRT: 1439,
     *note SIGBUS: 143a. and *note SIGILL: 143b. signals to dump the
     Python traceback.  This is equivalent to *note -X: 183.
     ‘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: 108.
     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(): 233a. function for more information.
     This is equivalent to setting the *note -X: 183. ‘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: 183. ‘importtime’ option.

     Added in version 3.7.

     バージョン 3.14 で変更: Added ‘PYTHONPROFILEIMPORTTIME=2’ to also
     trace imports of loaded modules.

 -- 環境変数: PYTHONASYNCIODEBUG

     この環境変数が空でない文字列に設定された場合、*note asyncio: b. モ
     ジュールの *note デバッグモード: 2347. が有効化されます。

     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: 2348.

        * ‘malloc’: use the ‘malloc()’ function of the C library for all
          domains (*note PYMEM_DOMAIN_RAW: 2349, *note PYMEM_DOMAIN_MEM:
          102b, *note PYMEM_DOMAIN_OBJ: 1029.).

        * ‘pymalloc’: use the *note pymalloc allocator: 3e1. for *note
          PYMEM_DOMAIN_MEM: 102b. and *note PYMEM_DOMAIN_OBJ: 1029.
          domains and use the ‘malloc()’ function for the *note
          PYMEM_DOMAIN_RAW: 2349. domain.

        * ‘mimalloc’: use the *note mimalloc allocator: 234a. for *note
          PYMEM_DOMAIN_MEM: 102b. and *note PYMEM_DOMAIN_OBJ: 1029.
          domains and use the ‘malloc()’ function for the *note
          PYMEM_DOMAIN_RAW: 2349. domain.

     Install *note debug hooks: 234b.:

        * ‘debug’: install debug hooks on top of the *note default
          memory allocators: 2348.

        * ‘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: 48e. 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: 3e1. or the *note mimalloc memory
     allocator: 234a. (whichever is in use) every time a new object
     arena is created, and on shutdown.

     This variable is ignored if the *note PYTHONMALLOC: 1026.
     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.

 -- 環境変数: PYTHON_PYMALLOC_HUGEPAGES

     If set to a non-zero integer, enable huge page support for *note
     pymalloc: 3e1. arenas.  Set to ‘0’ or unset to disable.  Python
     must be compiled with *note -with-pymalloc-hugepages: 3e0. for this
     variable to have any effect.

     When enabled, arena allocation uses ‘MAP_HUGETLB’ (Linux) or
     ‘MEM_LARGE_PAGES’ (Windows) with automatic fallback to regular
     pages if huge pages are not available.

          警告: On Linux, if the huge-page pool is exhausted, page
          faults — including copy-on-write faults triggered by *note
          os.fork(): 6c3. — deliver ‘SIGBUS’ and kill the process.  Only
          enable this in environments where the huge-page pool is
          properly sized and fork-safety is not a concern.

          On Windows you need a special privilege.  See the Windows
          documentation for large pages(3) for details.  Python will
          fail on startup if the required privilege
          SeLockMemoryPrivilege(4) is not held by the user.

     Added in version 3.15.

 -- 環境変数: PYTHONLEGACYWINDOWSFSENCODING

     If set to a non-empty string, the default *note filesystem encoding
     and error handler: 94d. mode will revert to their pre-3.6 values of
     'mbcs' and 'replace', respectively.  Otherwise, the new defaults
     'utf-8' and 'surrogatepass' are used.

     *note Availability: 234c.: Windows.

     Added in version 3.6: より詳しくは PEP 529(5) を参照してください。

 -- 環境変数: 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: 234c.: 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():
     23e.).

     Configuring one of these locales (either explicitly or via the
     above implicit locale coercion) automatically enables the
     ‘surrogateescape’ *note error handler: 1d8b. for *note sys.stdin:
     94f. and *note sys.stdout: ea0. (*note sys.stderr: d09. continues
     to use ‘backslashreplace’ as it does in any other locale).  This
     stream handling behavior can be overridden using *note
     PYTHONIOENCODING: 13b8. 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: 1b8. 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: 234c.: Unix.

     Added in version 3.7: より詳しくは PEP 538(6) を参照をしてください
     。

 -- 環境変数: PYTHONDEVMODE

     If this environment variable is set to a non-empty string, enable
     *note Python Development Mode: 713, introducing additional runtime
     checks that are too expensive to be enabled by default.  This is
     equivalent to setting the *note -X: 183. ‘dev’ option.

     Added in version 3.7.

 -- 環境変数: PYTHONUTF8

     If set to ‘1’, enable the *note Python UTF-8 Mode: a4b.

     If set to ‘0’, disable the *note Python UTF-8 Mode: a4b.

     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: 233c. when the locale-specific default
     encoding is used.

     詳細は *note Opt-in EncodingWarning: 1b7. を参照してください。

     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: 183. command-line option and *note
     Python support for the perf map compatible profilers: 6bd.

     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: 183. command-line option and *note
     Python support for the perf map compatible profilers: 6bd.

     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(7).  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: 183. 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(): 6e7. and *note
     os.process_cpu_count(): 6e6.

     See also the *note -X cpu_count: 183. 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: 183. 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 色の制御: 1ba.

     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: 6a3. that requires
     *note readline: c2, and will instead use the traditional
     parser-based REPL.

     Added in version 3.13.

 -- 環境変数: PYTHON_BASIC_COMPLETER

     If this variable is set to any value, PyREPL will use *note
     rlcompleter: c5. to implement tab completion, instead of the
     default one which uses colors.

     Added in version 3.15.

 -- 環境変数: 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: 6ab. build option).

     See also the *note -X gil: 183. command-line option, which takes
     precedence over this variable, and *note フリースレッドの CPython:
     686.

     Added in version 3.13.

 -- 環境変数: PYTHON_THREAD_INHERIT_CONTEXT

     If this variable is set to ‘1’ then *note Thread: 427. 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: 183.

     Added in version 3.14.

 -- 環境変数: PYTHON_CONTEXT_AWARE_WARNINGS

     If set to ‘1’ then the *note warnings.catch_warnings: 42a. context
     manager will use a *note ContextVar: 1abc. 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:
     183.

     Added in version 3.14.

 -- 環境変数: PYTHON_PATHCONFIG_WARNINGS

     If true (‘1’) then *note sys.path モジュール検索パスの初期化: 1974.
     is allowed to log warnings into stderr.  If false (‘0’) suppress
     these warnings.  Set to true by default.  See also *note -X
     pathconfig_warnings: 183.

     Added in version 3.15.

 -- 環境変数: 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: 6ab.

     See also the *note -X tlbc: 183. command-line option.

     Added in version 3.14.

 -- 環境変数: PYTHON_LAZY_IMPORTS

     Controls lazy import behavior.  Accepts three values: ‘all’ makes
     all imports lazy by default, ‘none’ disables lazy imports entirely
     (even explicit ‘lazy’ statements become eager), and ‘normal’ (the
     default) respects the ‘lazy’ keyword in source code.

     See also the *note -X lazy_imports: 183. command-line option.

     Added in version 3.15.

* Menu:

* デバッグモード変数::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0370/

   (2) https://peps.python.org/pep-0370/

   (3) 
https://learn.microsoft.com/windows/win32/memory/large-page-support

   (4) 
https://learn.microsoft.com/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/lock-pages-in-memory

   (5) https://peps.python.org/pep-0529/

   (6) https://peps.python.org/pep-0538/

   (7) 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: 82e. 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: 82e. 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: cf.
     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: 183. command-line option, which
     takes precedence over this variable.

     Needs Python configured with the *note -with-pydebug: 859. build
     option.

     バージョン 3.15 で変更: Accept also ‘module:func’ entry point
     format.

     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: 2358.

ビルド手順は通常のコマンドで行います

     ./configure
     make
     make install

*note Configure のオプション: 2359. や特定の 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/main/README.rst


File: python.info,  Node: Python に関係するパスとファイル,  Next: その他<2>,  Prev: Python のビルド,  Up: Unix プラットフォームで Python を使う

3.2.3 Python に関係するパスとファイル
-------------------------------------

これらはローカルインストールの慣例に応じて変化します; *note prefix:
235b. と *note exec_prefix: 235c. はインストール状況に依存していて、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: df. モ
ジュールを参照してください。


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: 2366. 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: 2d. 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: 2d.
                                                                            
                                                                            
liblzma(3)                                                                  *note lzma: 8d.
                                                                            
                                                                            
libmpdec(4)                           2.5.0                                 *note decimal: 39. (5)
                                                                            
                                                                            
libreadline(6) または libedit(7)                                            *note readline: c2.
(8)                                                                         

libuuid(9)                                                                  ‘_uuid’ (10)
                                                                            
                                                                            
ncurses(11) (12)                                                            *note curses: 2e.
                                                                            
                                                                            
OpenSSL(13)                                3.0.18 推奨                      *note ssl: d8, *note hashlib: 6b.
                                           (1.1.1 最小)                     (14)
                                                                            
                                                                            
SQLite(15)                            3.15.2                                *note sqlite3: d7.
                                                                            
                                                                            
Tcl/Tk(16)                            8.5.12                                *note tkinter: f9,
                                                                            *note IDLE: 13c3,
                                                                            *note turtle: 10a.
                                                                            
                                                                            
zlib(17)                              1.2.2.1                               *note zlib: 13c, *note gzip: 6a,
                                                                            *note ensurepip: 58.
                                                                            
                                                                            
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: 11f. 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: 1d4a. allows building with an external
     libexpat(20) library.

   * *note サードパーティ依存関係のオプション: 2369.

バージョン 3.1 で変更: *note tkinter: f9. には Tcl/Tk バージョン 8.3.1 が
必要となりました。

バージョン 3.5 で変更: *note tkinter: f9. には Tck/Tk バージョン 8.4 が
必要となりました。

バージョン 3.7 で変更: *note hashlib: 6b. と *note ssl: d8. には OpenSSL
1.0.2 が必要となりました。

バージョン 3.10 で変更: *note hashlib: 6b. と *note ssl: d8. には
OpenSSL 1.1.1 が必要となりました。 *note sqlite3: d7. には SQLite 3.7.15
が必要となりました。

バージョン 3.11 で変更: *note tkinter: f9. には Tcl/Tk バージョン 8.5.12
が必要となりました。

バージョン 3.13 で変更: *note sqlite3: d7. には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: 39. module
will use a pure-Python implementation.

   (6) https://tiswww.case.edu/php/chet/readline/rltop.html

   (7) https://www.thrysoee.dk/editline/

   (8) See *note -with-readline: 2367. for choosing the backend for the
*note readline: c2. module.

   (9) https://linux.die.net/man/3/libuuid

   (10) The *note uuid: 119. 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: 2e. module requires the ‘libncurses’ or
‘libncursesw’ library.  The *note curses.panel: 30. module additionally
requires the ‘libpanel’ or ‘libpanelw’ library.

   (13) https://openssl-library.org/

   (14) If OpenSSL is not available, the *note hashlib: 6b. module will
use bundled implementations of several hash functions.  See *note
-with-builtin-hashlib-hashes: 2368. 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: d7. module.

     *note sqlite3: d7. モジュールの *note
     sqlite3.Connection.enable_load_extension(): c1b. メソッドを参照して
     ください。

     Added in version 3.6.

 -- Option: --disable-ipv6

     IPv6サポートを無効にします(サポートされている場合はデフォルトで有効
     )、 *note socket: d4. モジュールを参照してください。

 -- Option: --enable-big-digits=[15|30]

     Python *note int: 32e. の桁の大きさをビット単位で定義します: 15ビッ
     トまたは30ビットです。

     デフォルトでは、桁の大きさは30です。

     ‘PYLONG_BITS_IN_DIGIT’ を ‘15’ または ‘30’ に定義します。

     *note sys.int_info.bits_per_digit: 164d. を参照してください。

 -- 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: 2372. に
     設定します。*note zoneinfo: 13d. モジュールの *note Compile-time
     configuration: 2373. を参照してください。

     デフォルト:
     ‘/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo’

     *note os.pathsep: 2341. パスセパレータを参照してください。

     Added in version 3.9.

 -- Option: --without-decimal-contextvar

     コルーチンローカルコンテキスト(デフォルト)ではなく、スレッドローカ
     ルコンテキストを使用して ‘_decimal’ 拡張モジュールをビルドします。
     *note decimal: 39. モジュールを参照してください。

     *note decimal.HAVE_CONTEXTVAR: 2375. および *note contextvars: 28.
     モジュールを参照してください。

     Added in version 3.9.

 -- Option: --with-dbmliborder=<list of backend names>

     *note dbm: 34. モジュールの DB バックエンドをチェックする順序をオー
     バーライドします。

     有効な値は、バックエンド名をコロン( ‘:’ )で区切った文字列です:

        * ‘ndbm’;

        * ‘gdbm’;

        * ‘bdb’。

 -- Option: --without-c-locale-coercion

     UTF-8 ベースのロケールへの C ロケールの強制を無効にします(デフォル
     トで有効)。

     ‘PY_COERCE_C_LOCALE’ マクロは定義しないでください。

     *note PYTHONCOERCECLOCALE: e9f. および PEP 538(1) を参照してくださ
     い。

 -- Option: --with-platlibdir=DIRNAME

     Python のライブラリディレクトリ名(デフォルトは ‘lib’ )。

     Fedora と SuSE は64ビットプラットフォームで ‘lib64’ を使用します。

     *note sys.platlibdir: 2b4. を参照してください。

     Added in version 3.9.

 -- Option: --with-wheel-pkg-dir=PATH

     *note ensurepip: 58. モジュールが使用する 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: --with-missing-stdlib-config=FILE

     Path to a JSON(2) configuration file containing custom error
     messages for missing *note standard library: 3df. modules.

     This option is intended for Python distributors who wish to provide
     distribution-specific guidance when users encounter standard
     library modules that are missing or packaged separately.

     The JSON file should map missing module names to custom error
     message strings.  For example, if your distribution packages *note
     tkinter: f9. and *note _tkinter: 3. separately and excludes ‘_gdbm’
     for legal reasons, the configuration could contain:

          {
              "_gdbm": "The '_gdbm' module is not available in this distribution",
              "tkinter": "Install the python-tk package to use tkinter",
              "_tkinter": "Install the python-tk package to use tkinter",
          }

     Added in version 3.15.

 -- 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: 183. command line option.

        * Add ‘PYTHONSTATS’ environment variable.

        * Define the ‘Py_STATS’ macro.

        * Add functions to the *note sys: e2. 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: 68c. (GIL): *note free-threaded build: 1a3.

     Defines the ‘Py_GIL_DISABLED’ macro and adds ‘"t"’ to *note
     sys.abiflags: e2c.

     See *note フリースレッドの CPython: 686. 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: 40d.

        * ‘no’: Don't build the JIT.

        * ‘yes’: Enable the JIT. To disable it at runtime, set the
          environment variable *note PYTHON_JIT=0: 667.

        * ‘yes-off’: Build the JIT, but disable it by default.  To
          enable it at runtime, set the environment variable *note
          PYTHON_JIT=1: 667.

        * ‘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: 667.

     ‘--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.

 -- Option: --disable-epoll

     Build without ‘epoll’, meaning that *note select.epoll(): 1342.
     will not be present even if the system provides an
     ‘epoll_create(3)’ function.  This may be used on systems where
     ‘epoll_create’ or ‘epoll_create1(4)’ is available but incompatible
     with Linux semantics.

     Added in version 3.15.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0538/

   (2) https://www.json.org/json-en.html

   (3) https://manpages.debian.org/epoll_create(2)

   (4) https://manpages.debian.org/epoll_create1(2)


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: 2e. 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:
     c2. module, overriding ‘pkg-config’.

 -- Option: LIBFFI_CFLAGS

 -- Option: LIBFFI_LIBS

     C compiler and linker flags for ‘libffi’, used by *note ctypes: 2d.
     module, overriding ‘pkg-config’.

 -- Option: LIBMPDEC_CFLAGS

 -- Option: LIBMPDEC_LIBS

     C compiler and linker flags for ‘libmpdec’, used by *note decimal:
     39. module, overriding ‘pkg-config’.

 -- Option: LIBLZMA_CFLAGS

 -- Option: LIBLZMA_LIBS

     C compiler and linker flags for ‘liblzma’, used by *note lzma: 8d.
     module, overriding ‘pkg-config’.

 -- Option: LIBREADLINE_CFLAGS

 -- Option: LIBREADLINE_LIBS

     C compiler and linker flags for ‘libreadline’, used by *note
     readline: c2. module, overriding ‘pkg-config’.

 -- Option: LIBSQLITE3_CFLAGS

 -- Option: LIBSQLITE3_LIBS

     C compiler and linker flags for ‘libsqlite3’, used by *note
     sqlite3: d7. module, overriding ‘pkg-config’.

 -- Option: LIBUUID_CFLAGS

 -- Option: LIBUUID_LIBS

     C compiler and linker flags for ‘libuuid’, used by *note uuid: 119.
     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: 30. 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: 6a.
     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: 3b3. を使って取得することがで
     きます。

     例として、 ‘--prefix="$HOME/.local/"’ を使用すると、 Python をその
     ホームディレクトリにインストールすることができます。

 -- Option: --exec-prefix=EPREFIX

     アーキテクチャ依存のファイルを EPREFIX にインストールします。デフォ
     ルトは *note -prefix: 235b. です。

     この値は、実行時に *note sys.exec_prefix: 3b0. を使って取得すること
     ができます。

 -- Option: --disable-test-modules

     *note test: eb. パッケージや ‘_testcapi’ 拡張モジュール(デフォルト
     でビルド、インストールされます)のようなテストモジュールをビルド、イ
     ンストールしないようにします。

     Added in version 3.10.

 -- Option: --with-ensurepip=[upgrade|install|no]

     Python のインストール時に実行される *note ensurepip: 58. コマンドを
     選択します:

        * ‘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: 1ca3. を使用して 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: 186f.

     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: c3d.) 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-frame-pointers

     Disable frame pointers, which are enabled by default (see PEP
     831(4)).

     By default, the build appends flags to generate frame or backchain
     pointers to ‘BASECFLAGS’:

        - ‘-fno-omit-frame-pointer’ and/or
          ‘-mno-omit-leaf-frame-pointer’ are added when the compiler
          supports them.

        - ‘-marm’ and/or ‘-mno-thumb’ is added on 32-bit ARM when
          supported,

        - on s390x platforms, when supported, ‘-mbackchain’ is added
          'instead'.  of the above frame pointer flags.

        - on ppc64le platforms, no compiler flags is needed since the
          power ABI requires that compilers maintain a back chain by
          default.

     Frame pointers enable profilers, debuggers, and system tracing
     tools (‘perf’, ‘eBPF’, ‘dtrace’, ‘gdb’) to walk the C call stack
     without DWARF metadata.  The flags propagate to third-party C
     extensions through *note sysconfig: e4.  On compilers that do not
     understand them, the build silently skips them.

     Downstream packagers and authors of native libraries built with
     custom build systems should set the same flags so the unwind chain
     stays unbroken across all native frames.

     Added in version 3.15.

 -- Option: --without-mimalloc

     Disable the fast *note mimalloc: 234a. allocator (enabled by
     default).

     This option cannot be used together with *note -disable-gil: 6ab.
     because the *note free-threaded: 48e. build requires mimalloc.

     See also *note PYTHONMALLOC: 1026. environment variable.

 -- Option: --without-pymalloc

     Disable the specialized Python memory allocator *note pymalloc:
     3e1. (enabled by default).

     See also *note PYTHONMALLOC: 1026. environment variable.

 -- Option: --with-pymalloc-hugepages

     Enable huge page support for *note pymalloc: 3e1. arenas (disabled
     by default).  When enabled, the arena size on 64-bit platforms is
     increased to 2 MiB and arena allocation uses ‘MAP_HUGETLB’ (Linux)
     or ‘MEM_LARGE_PAGES’ (Windows) with automatic fallback to regular
     pages.

     Even when compiled with this option, huge pages are 'not' used at
     runtime unless the *note PYTHON_PYMALLOC_HUGEPAGES: 3e2.
     environment variable is set to ‘1’.  This opt-in is required
     because huge pages

        * carry risks on Linux: if the huge-page pool is exhausted, page
          faults (including copy-on-write faults after *note os.fork():
          6c3.) deliver ‘SIGBUS’ and kill the process.

        * need a special privilege on Windows.  See the Windows
          documentation for large pages(5) for details.  Python will
          fail on startup if the required privilege
          SeLockMemoryPrivilege(6) is not held by the user.

     The configure script checks that the platform supports
     ‘MAP_HUGETLB’ and emits a warning if it is not available.

     On Windows, use the ‘--pymalloc-hugepages’ flag with ‘build.bat’ or
     set the ‘UsePymallocHugepages’ MSBuild property.

     Added in version 3.15.

 -- 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(7)
     (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(8) 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: 421.

          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-0831/

   (5) 
https://learn.microsoft.com/windows/win32/memory/large-page-support

   (6) 
https://learn.microsoft.com/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/lock-pages-in-memory

   (7) https://peps.python.org/pep-0768/

   (8) 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: 859. 構成オプション付きでビルド
された Python です。

デバッグビルドの影響:

   * Display all warnings by default: the list of default warning
     filters is empty in the *note warnings: 11b. module.

   * Add ‘d’ to *note sys.abiflags: e2c.

   * Add ‘sys.gettotalrefcount()’ function.

   * Add *note -X showrefcount: 183. command line option.

   * Add *note -d: 2331. command line option and *note PYTHONDEBUG:
     2332. 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: 2348. 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: 826. 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(): 456. 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: 713. and the *note
-with-trace-refs: 82e. 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: 82e. 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: 3e3.: 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(): 51d. function.

        * Add *note PYTHONDUMPREFS: d73. environment variable.

     The *note PYTHONDUMPREFS: d73. environment variable can be used to
     dump objects and reference counts still alive at Python exit.

     *note Statically allocated objects: b64. are not traced.

     Added in version 3.8.

     バージョン 3.13 で変更: This build is now ABI compatible with
     release build and *note debug build: 3e3.

 -- 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: 23b2.
     compiler variable.

     See also the *note -with-pydebug: 859. option (*note debug build:
     3e3.) 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: 102e.

     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: 23ac. 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.

 -- Option: --enable-static-libpython-for-interpreter

     Do not link the Python interpreter binary (‘python3’) against the
     shared Python library; instead, statically link the interpreter
     against ‘libpython’ as if ‘--enable-shared’ had not been used, but
     continue to build the shared ‘libpython’ (for use by other
     programs).

     This option does nothing if ‘--enable-shared’ is not used.

     The default (when ‘-enable-shared’ is used) is to link the Python
     interpreter against the built shared library.

     Added in version 3.15.


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-readline=readline|editline

     Designate a backend library for the *note readline: c2. 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: c2. 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: 23bf. 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: d8. 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: d38. が指定された場合のみ有効です。

     オプション:

        * ‘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: 23c5. が指定された場合のみ有効です (デフォルトで
     は ‘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/main/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/main/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: c3d. 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: 236a.


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: 188b.
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: 1c8. 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: 1871. 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: 1871. and *note LDFLAGS: 1870. 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: 23e9. is used for building the interpreter and
     stdlib C extensions.  Use it when a compiler flag should 'not' be
     part of *note CFLAGS: 186f. once Python is installed (gh-65320(1)).

     In particular, *note CFLAGS: 186f. 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: 186f. 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: 186f. variable passed to the ‘./configure’
     script.

     Added in version 3.2.

 -- 環境変数: CONFIGURE_CFLAGS_NODIST

     Value of *note CFLAGS_NODIST: 23e9. 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: c3e. 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: 1870. variable passed to the ‘./configure’
     script.

     Avoid assigning *note CFLAGS: 186f, *note LDFLAGS: 1870, 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: 23fc. is used in the same manner as *note
     CFLAGS_NODIST: 23e9.  Use it when a linker flag should 'not' be
     part of *note LDFLAGS: 1870. once Python is installed
     (gh-65320(1)).

     In particular, *note LDFLAGS: 1870. 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: 1870. would take precedence
          over user- and package-supplied ‘-L’ flags.

 -- 環境変数: CONFIGURE_LDFLAGS_NODIST

     Value of *note LDFLAGS_NODIST: 23fc. 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: 1871. and *note LDFLAGS: 1870. need to contain
     the shell's value to be able to build extension modules using the
     directories specified in the environment variables.

     Please consider using ‘EXE_LDFLAGS’ if the supplied linker flags
     are executable specific, e.g.  GCC's ‘-pie’ flag.

 -- 環境変数: 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.

 -- 環境変数: EXE_LDFLAGS

     Linker flags used for building executable targets such as the
     interpreter.  If supplied, *note PY_CORE_EXE_LDFLAGS: 2405. will be
     used in replacement of *note PY_CORE_LDFLAGS: 2403.

     Added in version 3.15.

 -- 環境変数: CONFIGURE_EXE_LDFLAGS

     Value of *note EXE_LDFLAGS: 2404. variable passed to the
     ‘./configure’ script.

     Added in version 3.15.

 -- 環境変数: PY_CORE_EXE_LDFLAGS

     Linker flags used for building the interpreter and executable
     targets.

     Default: ‘$(PY_CORE_LDFLAGS)’

     Added in version 3.15.

脚注
....

   ---------- 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:
22f9. 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: 240a. 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 パッケージ: 240b. 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 埋め込み可能なパッケージ: 240c. 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: 240a. 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:
2410. 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: 2412. environment variable, or a configuration
file.  See *note Configuration: 2413. 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: 2414. 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: 2413.
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: 2418.

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: 2419.), and is
enabled by default.  If no runtimes are available at all, all launch
commands will do an automatic install if the configuration setting
allows.  This is to ensure a good experience for new users, but should
not generally be relied on rather than using the ‘py exec’ command or
explicit install commands.


File: python.info,  Node: Offline installs,  Next: Uninstalling runtimes,  Prev: Installing runtimes,  Up: Python install manager

3.4.1.6 Offline installs
........................

To perform offline installs of Python, you will need to first create an
offline index on a machine that has network access.

     $> py install --download=<PATH> ... <TAG>...

The ‘--download=<PATH>’ option will download the packages for the listed
tags and create a directory containing them and an ‘index.json’ file
suitable for later installation.  This entire directory can be moved to
the offline machine and used to install one or more of the bundled
runtimes:

     $> py install --source="<PATH>\index.json" <TAG>...

The Python install manager can be installed by downloading its installer
and moving it to another machine before installing.

Alternatively, the ZIP files in an offline index directory can simply be
transferred to another machine and extracted.  This will not register
the install in any way, and so it must be launched by directly
referencing the executables in the extracted directory, but it is
sometimes a preferable approach in cases where installing the Python
install manager is not possible or convenient.

In this way, Python runtimes can be installed and managed on a machine
without access to the internet.


File: python.info,  Node: Uninstalling runtimes,  Next: Configuration,  Prev: Offline installs,  Up: Python install manager

3.4.1.7 Uninstalling runtimes
.............................

     $> py uninstall [-y|--yes] <TAG>...

Runtimes may be removed using the ‘py uninstall’ command.  One or more
tags must be specified.  Ranges are not supported here.

The ‘--yes’ option bypasses the confirmation prompt before uninstalling.

Instead of passing tags individually, the ‘--purge’ option may be
specified.  This will remove all runtimes managed by the Python install
manager, including cleaning up the Start menu, registry, and any
download caches.  Runtimes that were not installed by the Python install
manager will not be impacted, and neither will manually created
configuration files.

     $> py uninstall [-y|--yes] --purge

The Python install manager can be uninstalled through the Windows
"Installed apps" settings page.  This does not remove any runtimes, and
they will still be usable, though the global ‘python’ and ‘py’ commands
will be removed.  Reinstalling the Python install manager will allow you
to manage these runtimes again.  To completely clean up all Python
runtimes, run with ‘--purge’ before uninstalling the Python install
manager.


File: python.info,  Node: Configuration,  Next: Shebang lines,  Prev: Uninstalling runtimes,  Up: Python install manager

3.4.1.8 Configuration
.....................

Python install manager is configured with a hierarchy of configuration
files, environment variables, command-line options, and registry
settings.  In general, configuration files have the ability to configure
everything, including the location of other configuration files, while
registry settings are administrator-only and will override configuration
files.  Command-line options override all other settings, but not every
option is available.

This section will describe the defaults, but be aware that modified or
overridden installs may resolve settings differently.

A global configuration file may be configured by an administrator, and
would be read first.  The user configuration file is stored at
‘%AppData%\Python\pymanager.json’ (note that this location is under
‘Roaming’, not ‘Local’) and is read next, overwriting any settings from
earlier files.  An additional configuration file may be specified as the
‘PYTHON_MANAGER_CONFIG’ environment variable or the ‘--config’ command
line option (but not both).  These locations may be modified by
administrative customization options listed later.

The following settings are those that are considered likely to be
modified in normal use.  Later sections list those that are intended for
administrative customization.

Standard configuration options
..............................

Config Key                            Environment Variable                  説明
                                                                            
------------------------------------------------------------------------------------------------------------------
                                                                            
‘default_tag’                          -- 環境変数:                         The preferred default version to
                                                PYTHON_MANAGER_DEFAULT      launch or install.  By default,
                                                                            this is interpreted as the most
                                                                            recent non-prerelease version from
                                                                            the CPython team.
                                                                            
                                                                            
‘default_platform’                    ‘PYTHON_MANAGER_DEFAULT_PLATFORM’     The preferred default platform to
                                                                            launch or install.  This is treated
                                                                            as a suffix to the specified tag,
                                                                            such that ‘py -V:3.14’ would prefer
                                                                            an install for ‘3.14-64’ if it
                                                                            exists (and ‘default_platform’ is
                                                                            ‘-64’), but will use ‘3.14’ if no
                                                                            tagged install exists.
                                                                            
                                                                            
‘logs_dir’                            ‘PYTHON_MANAGER_LOGS’                 The location where log files are
                                                                            written.  By default, ‘%TEMP%’.
                                                                            
                                                                            
‘automatic_install’                    -- 環境変数:                         True to allow automatic installs
                                                PYTHON_MANAGER_AUTOMATIC_INSTALLwhen using ‘py exec’ to launch (or
                                                                            ‘py’ when no runtimes are installed
                                                                            yet).  Other commands will not
                                                                            automatically install, regardless
                                                                            of this setting.  By default, true.
                                                                            
                                                                            
‘include_unmanaged’                   ‘PYTHON_MANAGER_INCLUDE_UNMANAGED’    True to allow listing and launching
                                                                            runtimes that were not installed by
                                                                            the Python install manager, or
                                                                            false to exclude them.  By default,
                                                                            true.
                                                                            
                                                                            
‘shebang_can_run_anything’            ‘PYTHON_MANAGER_SHEBANG_CAN_RUN_ANYTHING’True to allow shebangs in ‘.py’
                                                                            files to launch applications other
                                                                            than Python runtimes, or false to
                                                                            prevent it.  By default, true.
                                                                            
                                                                            
‘log_level’                           ‘PYMANAGER_VERBOSE’,                  Set the default level of output
                                      ‘PYMANAGER_DEBUG’                     (0-50).  By default, 20.  Lower
                                                                            values produce more output.  The
                                                                            environment variables are boolean,
                                                                            and may produce additional output
                                                                            during startup that is later
                                                                            suppressed by other configuration.
                                                                            
                                                                            
‘confirm’                             ‘PYTHON_MANAGER_CONFIRM’              True to confirm certain actions
                                                                            before taking them (such as
                                                                            uninstall), or false to skip the
                                                                            confirmation.  By default, true.
                                                                            
                                                                            
‘install.source’                      ‘PYTHON_MANAGER_SOURCE_URL’           Override the index feed to obtain
                                                                            new installs from.
                                                                            
                                                                            
‘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: 2413. for information about configuration settings.

The ‘/usr/bin/env’ form of shebang line will also search the ‘PATH’
environment variable for unrecognized commands.  This corresponds to the
behaviour of the Unix ‘env’ program, which performs the same search, but
prefers launching known Python commands.  A warning may be displayed
when searching for arbitrary executables, and this search may be
disabled by the ‘shebang_can_run_anything’ configuration option.

Shebang lines that do not match any of patterns are treated as 'Windows'
executable paths that are absolute or relative to the directory
containing the script file.  This is a convenience for Windows-only
scripts, such as those generated by an installer, since the behavior is
not compatible with Unix-style shells.  These paths may be quoted, and
may include multiple arguments, after which the path to the script and
any additional arguments will be appended.  This functionality may be
disabled by the ‘shebang_can_run_anything’ configuration option.

     注釈: The behaviour of shebangs in the Python install manager is
     subtly different from the previous ‘py.exe’ launcher, and the old
     configuration options no longer apply.  If you are specifically
     reliant on the old behaviour or configuration, we recommend
     installing the legacy launcher(1).  The legacy launcher's ‘py’
     command will override PyManager's one by default, and you will need
     to use ‘pymanager’ commands for installing and uninstalling.

   ---------- Footnotes ----------

   (1) https://www.python.org/ftp/python/3.14.0/win32/launcher.msi


File: python.info,  Node: Advanced installation,  Next: Administrative configuration,  Prev: Shebang lines,  Up: Python install manager

3.4.1.10 Advanced installation
..............................

For situations where an MSIX cannot be installed, such as some older
administrative distribution platforms, there is an MSI available from
the python.org downloads page.  This MSI has no user interface, and can
only perform per-machine installs to its default location in Program
Files.  It will attempt to modify the system ‘PATH’ environment variable
to include this install location, but be sure to validate this on your
configuration.

     注釈: Windows Server 2019 is the only version of Windows that
     CPython supports that does not support MSIX. For Windows Server
     2019, you should use the MSI.

Be aware that the MSI package does not bundle any runtimes, and so is
not suitable for installs into offline environments without also
creating an offline install index.  See *note Offline installs: 2418.
and *note Administrative configuration: 241f. 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: 2421.
                                                       


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: 241f.).

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: 240d.?
                                                       
                                                       
                                                       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: 240d.?
                                                       
                                                       
                                                       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: 2412.
                                                       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: 2410.
                                                       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: 2413. 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 モジュールの検索: fe3.).  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.16 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(): 333. 関数や *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.

バージョン 3.15 で変更: Python UTF-8 mode is now enabled by default (
PEP 686(1)).

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(): a4a.).

This may cause issues because UTF-8 is widely used on the internet and
most Unix systems, including WSL (Windows Subsystem for Linux).

The *note Python UTF-8 Mode: a4b, enabled by default, can help by
changing the default text encoding to UTF-8.  When the *note UTF-8 mode:
a4b. is enabled, you can still use the system encoding (the ANSI Code
Page) via the "mbcs" codec.

You can disable the *note Python UTF-8 Mode: a4b. via the ‘-X utf8=0’
command line option, or the ‘PYTHONUTF8=0’ environment variable.  See
*note PYTHONUTF8: 1b8. for disabling UTF-8 mode, and *note Python
install manager: 21d6. for how to modify environment variables.

     ヒント: Adding ‘PYTHONUTF8={0,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(2) for
          details).

        * The *note filesystem encoding: 94d. (see PEP 529(3) for
          details).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0686/

   (2) https://peps.python.org/pep-0528/

   (3) 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
モジュール検索パスの初期化: 1974. with detailed Windows notes.

‘._pth’ ファイルが見付からなかったときは、 Windows では *note sys.path:
19f. は次のように設定されます:

   * 最初に空のエントリが追加されます。これはカレントディレクトリを指し
     ています。

   * その次に、 *note PYTHONPATH: 13cb. 環境変数が存在するとき、 *note
     環境変数: 9ed. で解説されているように追加されます。 Windows ではド
     ライブ識別子 (‘C:\’ など)と区別するために、この環境変数に含まれるパ
     スの区切り文字はセミコロンでなければならない事に注意してください。

   * 追加で "アプリケーションのパス" を ‘HKEY_CURRENT_USER’ か
     ‘HKEY_LOCAL_MACHINE’ の中の
     ‘\SOFTWARE\Python\PythonCore{version}\PythonPath’ のサブキーとして
     登録することができます。サブキーはデフォルト値としてセミコロンで区
     切られたパス文字列を持つことができ、書くパスが *note sys.path: 19f.
     に追加されます。 (既存のインストーラーはすべて HKLM しか利用しない
     ので、 HKCU は通常空です)

   * *note PYTHONHOME: 3b5. が設定されている場合、それが "Python Home" と
     して扱われます。 それ以外の場合、 "Python Home" を推定するために
     Python の実行ファイルのパスから "目印ファイル" (‘Lib\os.py’ または
     ‘pythonXY.zip’) が探されます。 Python home が見つかった場合、そこか
     らいくつかのサブディレクトリ (‘Lib’, ‘plat-win’ など) が *note
     sys.path: 19f. に追加されます。 見つからなかった場合、コアとなる
     Python path はレジストリに登録された PythonPath から構築されます。

   * Python Home が見つからず、環境変数 *note PYTHONPATH: 13cb. が指定さ
     れず、レジストリエントリが見つからなかった場合、関連するデフォルト
     のパスが利用されます (例: ‘.\Lib;.\plat-win’ など)。

メインの実行ファイルと同じ場所か一つ上のディレクトリに ‘pyvenv.cfg’ があ
る場合、以下の異なった規則が適用されます:

   * *note PYTHONHOME: 3b5. が設定されておらず、 ‘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: cf.
     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: 83a.
     before *note Py_InitializeFromConfig(): 611.

   * 自身のアプリケーションから ‘python.exe’ を起動する前に、 *note
     PYTHONPATH: 13cb. をクリアしたり上書きし、 *note PYTHONHOME: 3b5. を
     セットしてください。

   * 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: 10e6.  This finder is enabled
on Windows in 3.6.0 and earlier, but may need to be explicitly added to
*note sys.meta_path: 10e7. in the future.


File: python.info,  Node: 追加のモジュール,  Next: Windows 上で Python をコンパイルする,  Prev: モジュールの検索,  Up: Windows で Python を使う

3.4.9 追加のモジュール
----------------------

Python は全プラットフォーム互換を目指していますが、 Windows にしかないユ
ニークな機能もあります。標準ライブラリと外部のライブラリの両方で、幾つか
のモジュールと、そういった機能を使うためのスニペットがあります。

Windows 固有の標準モジュールは、 *note MS Windows 固有のサービス: 2430.
に書かれています。

* 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++
拡張モジュールのビルド: 2434. を参照してください。

   ---------- 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: 240d. 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.16 のインストーラは 4 つあります。 インタプ
リタの 32 ビット版、64 ビット版がそれぞれ 2 つずつあります。 'WEB インス
トーラ' は最初のダウンロードサイズは小さく、必要なコンポーネントはインス
トーラ実行時に必要に応じて自動的にダウンロードします。 'オフラインインス
トーラ' にはデフォルトインストールに必要なコンポーネントが含まれていて、
インターネット接続はオプショナルな機能のためにだけに必要となります。 イ
ンストール時にダウンロードを避けるほかの方法については *note Installing
without downloading: 2438. を参照して下さい。

インストーラを開始すると、2つの選択肢からひとつを選べます:

[image src="python-figures/win_installer.png"]


"Install Now" を選択した場合:

   * 管理者権限は '不要です' (ただし C ランタイムライブラリのシステム更
     新が必要であったり、 *note Python install manager: 9c1. をすべての
     ユーザ向けにインストールする場合は必要です)。

   * Python はあなたのユーザディレクトリにインストールされます。

   * *note Python install manager: 9c1. はこのインストールウィザード最初
     のページの下部のチェックボックス指定に従ってインストールされます。

   * 標準ライブラリ、テストスイート、ランチャ、pip がインストールされま
     す。

   * このインストールウィザード最初の下部のチェックボックスをチェックす
     れば、環境変数 ‘PATH’ にインストールディレクトリが追加されます。

   * ショートカットはカレントユーザだけに可視になります。

"Customize installation" を選択すると、インストール場所、その他オプショ
ンやインストール後のアクションの変更などのインストールの有りようを選べま
す。デバッグシンボルやデバッグバイナリをインストールするならこちらを選択
する必要があるでしょう。

すべてのユーザのためのインストールのためには "Customize installation" を
選んでください。この場合:

   * 管理者資格か承認が必要かもしれません。

   * Python は Program Files ディレクトリにインストールされます。

   * *note Python install manager: 9c1. は 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(): 333. 関数や *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: 9c1. をイ    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: 9c1. の例外が起こります。


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: 9c1. 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:
2438. 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: 240b.

   ---------- 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.16) がインストールされてい
る場合は、Python 3.16 が起動することになります。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: 11a. モジュールか外部ツール ‘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: 2445.  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: 2452. 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.16/’ 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) のインストール: 6aa.

[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.16/’ 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.16’ 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.16’ or ‘python3’ optionally followed by one or more command
line options (described in *note コマンドラインと環境: 1fb7.).  The
Python tutorial also has a useful section on *note using Python
interactively from a shell: 6a6.

You can also invoke the interpreter through an integrated development
environment.  *note IDLE -- Python のエディタとシェル: 13c3. 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: 2458. 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.16’ ‘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: f9, 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: 2454. installer package can
optionally install an additional build of Python 3.16 that supports PEP
703(1), the free-threading feature (running with the *note global
interpreter lock: 68c. 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: 2461, may not be ready for use in a
free-threaded build, and will re-enable the *note GIL: 418.  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.16 build to co-exist on your system with a
traditional (GIL only) Python 3.16 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.16t’,
     the free-threaded interpreter, and ‘python3.16t-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.16t’.

   - For this release, the 'Shell profile updater' package and the
     ‘Update Shell Profile.command’ in ‘/Applications/Python 3.16/’ 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.16t’.

        - To install a package using ‘pip’ without a ‘venv’:

               python3.16t -m pip install <package_name>

   - When working with multiple Python environments, it is usually
     safest and easiest to *note create and use virtual environments:
     22f9.  This can avoid possible command name conflicts and confusion
     about which Python is in use:

          python3.16t -m venv <venv_name>

     then ‘activate’.

   - To run a free-threaded version of IDLE:

          python3.16t -m idlelib

   - The interpreters in both builds respond to the same *note PYTHON
     environment variables: 9ed. which may have unexpected results, for
     example, if you have ‘PYTHONPATH’ set in a shell profile.  If
     necessary, there are *note command line options: 2329. 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.16t’ (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.16/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.16’ 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.16="/Library/Frameworks/Python.framework/Versions/3.16/bin/python3.16"
          alias py3.16t="/Library/Frameworks/PythonT.framework/Versions/3.16/bin/python3.16t"

   ---------- 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.16.0b2’ release and selecting the free-threaded interpreter option:

     RELEASE="python-3.160b2-macos11.pkg"

     # download installer pkg
     curl -O https://www.python.org/ftp/python/3.16.0/${RELEASE}

     # create installer choicechanges to customize the install:
     #    enable the PythonTFramework-3.16 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.16</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.16t -VV
     Python 3.16.0b2 free-threading build (v3.16.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.16 -VV
     Python 3.16.0b2 (v3.16.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.16t -VV
     Python 3.16.0b2 free-threading build (v3.16.0b2:3a83b172af, Jun  5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
     $ python3.16 -VV
     Python 3.16.0b2 (v3.16.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: 1bc3. 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/main/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:
246b. を使用して Python コードを呼び出すことです。 それにより、完全な
Python インタープリタ、標準ライブラリ、及び Python のコードが、アプリに
パッケージ化され、独自の私的用途に使用されます。

Python の 標準ライブラリには、 Android におけるいくつかの重要な省略や制
限があります。詳細は *note API 利用可能性ガイド: 246c. を参照してくださ
い。

* 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/main/Android/testbed

   (7) https://www.python.org/downloads/android/

   (8) https://github.com/python/cpython/tree/main/Android/README.md

   (9) 
https://github.com/python/cpython/tree/main/Android/testbed/app/build.gradle.kts

   (10) 
https://github.com/python/cpython/tree/main/Android/testbed/app/src/main/java/org/python/testbed/MainActivity.kt

   (11) 
https://github.com/python/cpython/tree/main/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: 246b.
を使用して 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: 23cf. オプションを使用して指定できます。デフォルトでは、
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(): 2476. を使用して取得できます。 *note
platform.system(): 2477. は、デバイスにより ‘iOS’ または ‘iPadOS’ を報告
します。

*note os.uname(): 14d7. は、カーネルレベルの詳細を報告します。これは
‘Darwin’ の名前を報告します。


File: python.info,  Node: 標準ライブラリの利用可能性,  Next: バイナリ拡張モジュール,  Prev: プラットフォームの識別,  Up: iOS ランタイムでの Python

3.7.1.3 標準ライブラリの利用可能性
..................................

Python の 標準ライブラリには、 iOS におけるいくつかの重要な省略や制限が
あります。詳細は *note iOS 向けの API 利用可能性ガイド: 246c. を参照して
ください。


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
を追加する: 247a. のガイドを参照してください。

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: 247b. を
インストールします。インポートされると、バイナリモジュールの ‘__file__’
属性は ‘.fwork’ ファイルの場所を返します。一方、読み込まれたモジュールの
*note ModuleSpec: 247c. はフレームワークフォルダのバイナリの場所として
‘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: 637.) が '有効' に
          なっていること

        * Buffered stdio (*note PyConfig.buffered_stdio: 62b.) が '無効'
          になっていること

        * バイトコードの書き込み (*note PyConfig.write_bytecode: 627.) が
          '無効' になっていること

        * シグナルハンドラ (*note PyConfig.install_signal_handlers:
          c95.) が '有効' になっていること

        * システムログ (*note PyConfig.use_system_logger: 2481.) が '有
          効' になっていること (オプションですが、強く推奨され、デフォル
          トで有効化されています)

        * インタープリタの *note PYTHONHOME: 3b5. がアプリバンドルの
          ‘python’ サブフォルダを指すように構成されていること

        * インタープリタの *note PYTHONPATH: 13cb. が次のものを含むこと

             - アプリのバンドルの ‘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: 13cb. 設定の一つとして追加されていることを確認
     してください。

   * サードパーティパッケージを含むフォルダが ‘.pth’ ファイルを含む場合
     、直接 *note PYTHONPATH: 13cb. や *note sys.path: 19f. に追加するの
     ではなく、そのフォルダを (*note site.addsitedir(): 190e. を使用して
     ) サイトディレクトリとして追加する必要があります。

   ---------- Footnotes ----------

   (1) https://github.com/pvieito/PythonKit

   (2) https://github.com/python/cpython/tree/main/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/main/Apple/iOS/testbed

   (2) https://github.com/python/cpython/tree/main/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/main/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: 2355.  For more
information see the *note IDLE docs: 13c3.


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 標準ライブラリ: 3fe. で述べられています。形式ばらない Python 言語
入門には、 *note Python チュートリアル: 21c8. を参照してください。 C 言
語あるいはC++プログラマ向けには、このマニュアルとは別に二つのマニュアル
があります。 *note Python インタプリタの拡張と埋め込み: 21c9. では、
Python 拡張モジュールを書くための高レベルな様式について述べています。ま
た、 *note Python/C API reference manual: 21ca. では、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 標準ライブラリ: 3fe. でドキュメン
ト化されています。いくつかの組み込みモジュールについては、言語定義と重要
なかかわりをもっているときについて触れています。

* 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: 2495. (*note letter: 2495. | *note digit: 2496. | "_")*
     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: 2497.  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: 2498.

        * ‘"case"’: A name in double quotes denotes a *note
          soft-keyword: bea.

        * ‘'@'’: A non-letter symbol in single quotes denotes an *note
          OP: 2499. token, that is, a *note delimiter: 249a. or *note
          operator: 249b.

   * ‘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: 249c.

   * ‘"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: 24a1. operates on the individual characters of
the input source, while the 'parser' (syntactic analyzer) operates on
the stream of *note tokens: 2497. 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: 24a2. all whitespace that is not converted to tokens like
*note token.INDENT: 230b. or *note NEWLINE: 24a3.  '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 字句解析:
24a4.) 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: 2497, 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: 24a8.
(UTF-8 by default), and decodes the text into *note source characters:
24a9.  If the text cannot be decoded, a *note SyntaxError: 189. 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: 24a2.
                                                       
   * タブ

   * formfeed

   * CR, LF                                               * *note New line: 24aa.
                                                       
                                                          * *note Indentation: 24ab.
                                                       
                                                       
   * backslash (‘\’)                                      * *note Explicit line joining: 24ac.
                                                       
                                                          * (Also significant in
                                                            *note string escape sequences: 879.)
                                                       
                                                       
   * hash (‘#’)                                           * *note Comment: 24ad.
                                                       
                                                       
   * quote (‘'’, ‘"’)                                     * *note String literal: 24ae.
                                                       
                                                       
   * ASCII letter (‘a’-‘z’, ‘A’-‘Z’)                      * *note Name: 24af.
                                                       
   * non-ASCII character                                  * Prefixed *note string or bytes literal: 24ae.
                                                       
                                                       
   * underscore (‘_’)                                     * *note Name: 24af.
                                                       
                                                          * (Can also be part of
                                                            *note numeric literals: 24b0.)
                                                       
                                                       
   * number (‘0’-‘9’)                                     * *note Numeric literal: 24b0.
                                                       
                                                       
   * dot (‘.’)                                            * *note Numeric literal: 24b0.
                                                       
                                                          * *note Operator: 249b.
                                                       
                                                       
   * question mark (‘?’)                                  * Error (outside string literals and comments)
                                                       
   * dollar (‘$’)

   * 
     backquote (‘​`​’)

   * control character

   * other printing character                             * *note Operator or delimiter: 249b.
                                                       
                                                       
   * end of file                                          * *note End marker: 24b1.
                                                       

* 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:
24a3.  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: 24ac. or *note implicit: 24b5.
'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: 24ae.)  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 標準エンコーディング: 1175. を参照し
てください)。宣言されたエンコーディングは、例えば文字列リテラル、コメン
ト、識別子などの、全ての字句解析に使われます。 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: 24a3. 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: 955. が送出されます。

'プラットフォーム間の互換性に関する注意:' 非 UNIX プラットフォームにおけ
るテキストエディタの性質上、一つのソースファイル内でタブとインデントを混
在させて使うのは賢明ではありません。また、プラットフォームによっては、最
大インデントレベルを明示的に制限しているかもしれません。

フォームフィード文字が行の先頭にあっても構いません; フォームフィード文字
は上のインデントレベル計算時には無視されます。フォームフィード文字が先頭
の空白中の他の場所にある場合、その影響は未定義です (例えば、スペースの数
を 0 にリセットするかもしれません)。

The indentation levels of consecutive lines are used to generate *note
INDENT: 230b. and *note DEDENT: 24c1. 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: 24c5. token.


File: python.info,  Node: その他のトークン,  Next: Names identifiers and keywords,  Prev: 行構造,  Up: 字句解析

4.2.2 その他のトークン
----------------------

Besides *note NEWLINE: 24a3, *note INDENT: 230b. and *note DEDENT: 24c1,
the following categories of tokens exist: 'identifiers' and 'keywords'
(*note NAME: 24c8.), 'literals' (such as *note NUMBER: 24c9. and *note
STRING: 24ca.), and other symbols ('operators' and 'delimiters', *note
OP: 2499.).  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: 24c8. 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: 24cc. 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: 24ce. *note name_continue: 24cf.*
     name_start:    "a"..."z" | "A"..."Z" | "_" | <non-ASCII character>
     name_continue: name_start | "0"..."9"
     identifier:    <*note NAME: 24cd, except keywords>

Note that not all names matched by this grammar are valid; see *note
Non-ASCII characters in names: 24cc. 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: 1df.
     statement.

   - ‘type’, when used in the *note type: 860. statement.

   - ‘lazy’, when used before an *note import: 9df. 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.

バージョン 3.15 で変更: ‘lazy’ 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: 1df. statement, ‘_’ is a
     *note soft keyword: bea. that denotes a *note wildcard: beb.

     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: 66. を参照してください。

          It is also commonly used for unused variables.

‘__*__’

     システムで定義された (system-defined) 名前です。非公式には
     "dunder"な名前と呼ばれます(訳注: double underscoresの略)。これらの
     名前はインタープリタと (標準ライブラリを含む) 実装上で定義されてい
     ます。 現行のシステムでの名前は *note 特殊メソッド名: 1030. などで
     話題に挙げられています。 Python の将来のバージョンではより多くの名
     前が定義されることになります。このドキュメントで明記されている用法
     に従わない、 'あらゆる' ‘__*__’ の名前は、いかなるコンテキストにお
     ける利用でも、警告無く損害を引き起こすことがあります。

‘__*’

     クラスプライベート (class-private) な名前です。このカテゴリに属する
     名前は、クラス定義のコンテキスト上で用いられた場合、基底クラスと派
     生クラスの "プライベートな" 属性間で名前衝突が起こるのを防ぐために
     書き直されます。 *note 識別子 (identifier、または名前 (name)):
     24d5. を参照してください。


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: 24af.
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(): 1e20. 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: 10e. 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/17.0.0/ucd/DerivedCoreProperties.txt

   (5) https://www.unicode.org/Public/17.0.0/ucd/PropList.txt

   (6) https://www.unicode.org/Public/17.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: 24ae. and
*note numeric: 24b0. literals.

Other "literals" are lexically denoted using *note keywords: 2498.
(‘None’, ‘True’, ‘False’) and the special *note ellipsis token: 24d9.
(‘...’).


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: 879. 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: 24dd.

   * ‘r’: *note Raw string: 24de.

   * ‘f’: *note Formatted string literal: 441. ("f-string")

   * ‘t’: *note Template string literal: 1a70. ("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": 441. and *note "t-strings":
1a70, are described by the following lexical definitions.

These definitions use *note negative lookaheads: 249d. (‘!’) to indicate
that an ending quote ends the literal.

     STRING:          [*note stringprefix: 24e1.] (*note stringcontent: 24e2.)
     stringprefix:    <("r" | "u" | "b" | "br" | "rb"), case-insensitive>
     stringcontent:
        | "'''" ( !"'''" *note longstringitem: 24e3.)* "'''"
        | '"""' ( !'"""' *note longstringitem: 24e3.)* '"""'
        | "'" ( !"'" *note stringitem: 24e4.)* "'"
        | '"' ( !'"' *note stringitem: 24e4.)* '"'
     stringitem:      *note stringchar: 24e5. | *note stringescapeseq: 24e6.
     stringchar:      <any *note source_character: 24bb, except backslash and newline>
     longstringitem:  *note stringitem: 24e4. | newline
     stringescapeseq: "\" <any *note source_character: 24bb.>

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: 24e8.
                                                       
                                                       
‘\\’                                                   *note Backslash: 24e9.
                                                       
                                                       
‘\'’                                                   *note Single quote: 24e9.
                                                       
                                                       
‘\"’                                                   *note Double quote: 24e9.
                                                       
                                                       
‘\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: 24ea.
                                                       
                                                       
‘\xHH’                                                 *note Hexadecimal character: 24eb.
                                                       
                                                       
‘\N{NAME}’                                             *note Named Unicode character: 24ec.
                                                       
                                                       
‘\uXXXX’                                               *note Hexadecimal Unicode character: 24ed.
                                                       
                                                       
‘\UXXXXXXXX’                                           *note Hexadecimal Unicode character: 24ed.
                                                       

* 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: 24ae,
or parentheses and *note string literal concatenation: 24ef.


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: 24de. 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: 2d4.

バージョン 3.12 で変更: Octal escapes with value larger than ‘0o377’
(255) produce a *note SyntaxWarning: 451.  In a future Python version
they will raise a *note SyntaxError: 189.


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: 24dd.

バージョン 3.3 で変更: Support for name aliases(1) has been added.

   ---------- Footnotes ----------

   (1) https://www.unicode.org/Public/17.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: 24dd.


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: 2d4.

バージョン 3.12 で変更: Unrecognized escape sequences produce a *note
SyntaxWarning: 451.  In a future Python version they will raise a *note
SyntaxError: 189.


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: 1d2. type instead of the *note str: 1ea.
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: 24eb. or *note Octal character:
24ea.):

     >>> 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: 879. 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: 439. and *note async for: e74.
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: 1657. 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: 24fa. for details
on how these fields are evaluated.

As that section explains, 'format specifiers' are passed as the second
argument to the *note format(): 440. 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:
704.:

     >>> 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: 704.:

     >>> 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: 24fb, 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(): a17, 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: 441.  For differences in
evaluation rules, see the *note Standard Library section on t-strings:
24fe.


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: 24a1, which
produces the tokens *note FSTRING_START: 2500, *note FSTRING_MIDDLE:
2501. and *note FSTRING_END: 2502, 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: 249c.

Whitespace is significant in these situations:

   * There may be no whitespace in *note FSTRING_START: 2500. (between
     the prefix and quote).

   * Whitespace in *note FSTRING_MIDDLE: 2501. 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: 249d.
(‘!’) to indicate special characters (backslash, newline, ‘{’, ‘}’) and
sequences (‘f_quote’).

     fstring:    *note FSTRING_START: 2504. *note fstring_middle: 2505.* *note FSTRING_END: 2506.

     FSTRING_START:      *note fstringprefix: 2507. ("'" | '"' | "'''" | '"""')
     FSTRING_END:        *note f_quote: 2508.
     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: 250a.
        | *note FSTRING_MIDDLE: 250b.
     FSTRING_MIDDLE:
        | (!"\" !*note newline: 24b8. !'{' !'}' !*note f_quote: 2508.) *note source_character: 24bb.
        | *note stringescapeseq: 24e6.
        | "{{"
        | "}}"
        | <newline, in triple-quoted f-strings only>
     fstring_replacement_field:
        | '{' *note f_expression: 250c. [*note f_debug_specifier: 2509.] [*note fstring_conversion: 250d.]
              [*note fstring_full_format_spec: 250e.] '}'
     fstring_conversion:
        | "!" ("s" | "r" | "a")
     fstring_full_format_spec:
        | ':' *note fstring_format_spec: 250f.*
     fstring_format_spec:
        | *note FSTRING_MIDDLE: 250b.
        | *note fstring_replacement_field: 250a.
     f_expression:
        | ','.(*note conditional_expression: 2510. | "*" *note or_expr: 2511.)+ [","]
        | *note yield_expression: 2512.

     注釈: 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: 24c9. tokens represent numeric literals, of which there
are three types: integers, floating-point numbers, and imaginary
numbers.

     NUMBER: *note integer: 2516. | *note floatnumber: 2517. | *note imagnumber: 2518.

The numeric value of a numeric literal is the same as if it were passed
as a string to the *note int: 32e, *note float: 32f. or *note complex:
330. 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: 251b. | *note bininteger: 251c. | *note octinteger: 251d. | *note hexinteger: 251e. | *note zerointeger: 251f.
     decinteger:   *note nonzerodigit: 2520. (["_"] *note digit: 2521.)*
     bininteger:   "0" ("b" | "B") (["_"] *note bindigit: 2522.)+
     octinteger:   "0" ("o" | "O") (["_"] *note octdigit: 2523.)+
     hexinteger:   "0" ("x" | "X") (["_"] *note hexdigit: 2524.)+
     zerointeger:  "0"+ (["_"] "0")*
     nonzerodigit: "1"..."9"
     digit:        "0"..."9"
     bindigit:     "0" | "1"
     octdigit:     "0"..."7"
     hexdigit:     *note digit: 2521. | "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: 2527.

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: 2528. "." [*note digitpart: 2528.] [*note exponent: 2529.]
        | "." *note digitpart: 2528. [*note exponent: 2529.]
        | *note digitpart: 2528. *note exponent: 2529.
     digitpart: *note digit: 2521. (["_"] *note digit: 2521.)*
     exponent:  ("e" | "E") ["+" | "-"] *note digitpart: 2528.

バージョン 3.6 で変更: グループ化を目的としたリテラル中のアンダースコア
が許されるようになりました。


File: python.info,  Node: 虚数 imaginary リテラル,  Prev: Floating-point literals,  Up: 数値リテラル

4.2.6.3 虚数 (imaginary) リテラル
.................................

Python has *note complex number: 21e8. 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: 251a. ‘3’,
the *note operator: 249b. '‘+’', and the *note imaginary literal: 252a.
‘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: 2517. | *note digitpart: 2528.) ("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: 2499. token type.  A *note list of these
tokens and their names: 252d. 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:
     2536, 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(): f93. operator and the function call
     operator(s).

     Some of Python's operators, like ‘and’, ‘or’, and ‘not in’, use
     *note keyword: 2498. tokens rather than "symbols" (operator
     tokens).

A sequence of three consecutive periods (‘...’) has a special meaning as
an *note Ellipsis: 2537. 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: 32c. 演算子は2つのオブジ
ェクトの同一性を比較します。 *note id(): 17db. 関数は同一性を表す整数を
返します。

CPython では、‘id(x)’ は ‘x’ が格納されているメモリ上のアドレスを返しま
す。

オブジェクトの型はオブジェクトがサポートする操作 (例: *note len(): a24.
をサポートするか) と、オブジェクトが取りうる値を決定します。 *note
type(): 191. 関数はオブジェクトの型 (型自体もオブジェクトです) を返しま
す。同一性と同じく、オブジェクトの型('type') も変更不可能です。 (1)

オブジェクトによっては '値' を変更することが可能です。値を変更できるオブ
ジェクトのことを 'mutable' と呼びます。生成後に値を変更できないオブジェ
クトのことを 'immutable' と呼びます。(mutable なオブジェクトへの参照を格
納している immutableなコンテナオブジェクトの値は、その格納しているオブジ
ェクトの値が変化した時に変化しますが、コンテナがどのオブジェクトを格納し
ているのかが変化しないのであれば immutable だと考えることができます。し
たがって、immutable かどうかは値が変更可能かどうかと完全に一致するわけで
はありません) オブジェクトが mutable かどうかはその型によって決まります
。例えば、数値型、文字列型とタプル型のインスタンスは immutable で、dict
や list は mutable です。

オブジェクトを明示的に破壊することはできません; しかし、オブジェクトに到
達不能 (unreachable) になると、ガベージコレクション (garbage-collection)
によって処理されるかもしれません。ガベージコレクションを遅らせたり、全く
行わない実装も許されています -- 到達可能なオブジェクトを処理してしまわな
いかぎり、ガベージコレクションをどう実装するかは実装品質の問題です。

現在の CPython 実装では参照カウント (reference-counting) 方式を使ってお
り、(オプションとして) 循環参照を行っているガベージオブジェクトを遅延検
出します。この実装ではほとんどのオブジェクトを到達不能になると同時に処理
することができますが、循環参照を含むガベージオブジェクトの収集が確実に行
われるよう保証しているわけではありません。循環参照を持つガベージオブジェ
クト収集の制御については、 *note gc: 63. モジュールを参照してください。
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: adb...*note
except: 44e. 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:
adb...*note finally: 453. statement and the *note with: 215. 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: 32e. 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:
447.  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 算術演算の実装: 2541. を参照してください。

バージョン 3.9 で変更: Evaluating *note NotImplemented: 447. in a
boolean context was deprecated.

バージョン 3.14 で変更: Evaluating *note NotImplemented: 447. in a
boolean context now raises a *note TypeError: 29c.  It previously
evaluated to *note True: fd0. and emitted a *note DeprecationWarning:
2d4. 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__(): 1c7. と *note __str__(): a14. から計算された数値クラス
の文字列表現には次のような特性があります:

   * その文字列は、クラスコンストラクタに渡したときに、元の数値の値を持
     つオブジェクトを生成する有効な数値リテラルです。

   * できるなら、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: 32e.)

     無制限の範囲の数を表現しますが、利用可能な (仮想) メモリサイズの制
     限のみを受けます。シフト演算やマスク演算のために2進数表現を持つと想
     定されます。負の数は符号ビットが左に無限に延びているような錯覚を与
     える 2 の補数表現の変型で表されます。

ブール値 (*note bool: 5f6.)

     真偽値の 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(): a24. 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: 18ed. 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: a6a, 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: 1ea.) 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(): 254a. converts a code point from
     its string form to an integer in the range ‘0’ to ‘0x10FFFF’; *note
     chr(): 1c17. converts an integer in the range ‘0’ to ‘0x10FFFF’ to
     the corresponding length ‘1’ string object.  *note str.encode():
     cab. can be used to convert a *note str: 1ea. to *note bytes: 1d2.
     using the given text encoding, and *note bytes.decode(): cac. can
     be used to achieve the opposite.

タプル型 (tuple)

     The items of a *note tuple: 1d9. 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: 1d2. 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(): 1d2.
     constructor can be used to create bytes objects.  Also, bytes
     objects can be decoded to strings via the *note decode(): cac.
     method.


File: python.info,  Node: 変更可能なシーケンス型 mutable sequence,  Prev: 変更不能なシーケンス immutable sequence,  Up: シーケンス型 sequence

4.3.2.10 変更可能なシーケンス型 (mutable sequence)
..................................................

変更可能なシーケンスは、作成した後で変更することができます。変更可能なシ
ーケンスでは、添字表記やスライス表記を使って指定された要素に代入を行うこ
とができ、 *note del: 1d3c. (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(): 1d1. コンストラクタによって作成されます。変更可能なこ
     とを除けば (つまりハッシュ化できない)、 byte array は変更不能な
     *note bytes: 1d2. オブジェクトと同じインターフェースと機能を提供し
     ます。


File: python.info,  Node: 集合型<2>,  Next: マッピング型 mapping,  Prev: シーケンス型 sequence,  Up: 標準型の階層

4.3.2.11 集合型
...............

集合型は、順序のない、ユニークで不変なオブジェクトの有限集合を表現します
。そのため、(配列の)添字を使ったインデックスアクセスはできません。ただし
、イテレートは可能で、組み込み関数 *note len(): a24. は集合の要素数を返
します。集合型の一般的な使い方は、集合に属しているかの高速なテスト、シー
ケンスからの重複の排除、共通集合・和集合・差・対称差といった数学的な演算
の計算です。

集合の要素には、辞書のキーと同じ普遍性に関するルールが適用されます。数値
型は通常の数値比較のルールに従うことに注意してください。もし2つの数値の
比較結果が同値である(例えば、 ‘1’ と ‘1.0’)なら、そのうちの1つのみを集合
に含めることができます。

現在、2つの組み込み集合型があります:

集合型

     可変な集合型です。組み込みの *note set(): 432. コンストラクタで作成
     され、後から *note add(): 254d. などのいくつかのメソッドで更新でき
     ます。

Frozen set 型

     不変な集合型です。組み込みの *note frozenset(): 9d9. コンストラクタ
     によって作成されます。 frozenset は不変で *note ハッシュ可能: 18e.
     なので、別の集合型の要素になったり、辞書のキーにすることができます
     。


File: python.info,  Node: マッピング型 mapping,  Next: 呼び出し可能型 callable type,  Prev: 集合型<2>,  Up: 標準型の階層

4.3.2.12 マッピング型 (mapping)
...............................

任意のインデクス集合でインデクス化された、オブジェクトからなる有限の集合
を表現します。添字表記 ‘a[k]’ は、 ‘k’ でインデクス指定された要素を ‘a’
から選択します; 選択された要素は式の中で使うことができ、代入や *note
del: 1d3c. 文の対象にすることができます。組み込み関数 *note len(): a24.
は、マッピング内の要素数を返します。

Python に最初から組み込まれているマッピング型は、今のところ一つだけです:

* Menu:

* 辞書型 (dictionary): 辞書型 dictionary<2>.


File: python.info,  Node: 辞書型 dictionary<2>,  Up: マッピング型 mapping

4.3.2.13 辞書型 (dictionary)
............................

ほぼ任意の値でインデクスされたオブジェクトからなる有限の集合を表します。
キー (key) として使えない値の唯一の型は、リストや辞書、そしてオブジェク
トの同一性でなく値で比較されるその他の変更可能な型です。 これは、辞書型
を効率的に実装する上で、キーのハッシュ値が不変である必要があるためです。
数値型をキーに使う場合、キー値は通常の数値比較における規則に従います: 二
つの値が等しくなる場合 (例えば ‘1’ と ‘1.0’)、互いに同じ辞書のエントリを
表すインデクスとして使うことができます。

辞書は挿入の順序を保持します。つまり、キーは辞書に追加された順番に生成さ
れていきます。既存のキーを置き換えても、キーの順序は変わりません。キーを
削除したのちに再挿入すると、元の場所ではなく辞書の最後に追加されます。

Dictionaries are mutable; they can be created by the ‘{}’ notation (see
section *note 辞書表示: 113c.).

拡張モジュール *note dbm.ndbm: 37. 、 *note dbm.gnu: 36. は、 *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): 113a. 参照) を行うことができる
型です:

* 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
関数定義: 2224. 参照)。関数は、仮引数 (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: 193. that holds
                                                       the function's builtins namespace.
                                                       
                                                       Added in version 3.10.
                                                       
                                                       
 -- の属性: function.__globals__                       A reference to the *note dictionary: 193. that holds
                                                       the function's *note global variables: 2555. - the
                                                       global namespace of the module in which the function
                                                       was defined.
                                                       
                                                       
 -- の属性: function.__closure__                       ‘None’ or a *note tuple: 1d9. of cells that contain
                                                       bindings for the names specified in the
                                                       *note co_freevars: 2556. attribute of the function's
                                                       *note code object: 7a2.
                                                       
                                                       セルオブジェクトは属性 ‘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: 141d.
                                                       
                                                       
 -- の属性: function.__qualname__                      The function's *note qualified name: 1f38.  See
                                                       also: *note __qualname__ attributes: 141c.
                                                       
                                                       Added in version 3.3.
                                                       
                                                       
 -- の属性: function.__module__                        関数が定義されているモジュールの名前です。モジュール
                                                       名がない場合は ‘None’ になります。
                                                       
                                                       
 -- の属性: function.__defaults__                      A *note tuple: 1d9. containing default
                                                       *note parameter: 255a. values for those parameters
                                                       that have defaults, or ‘None’ if no parameters have
                                                       a default value.
                                                       
                                                       
 -- の属性: function.__code__                          The *note code object: 6f1. representing the
                                                       compiled function body.
                                                       
                                                       
 -- の属性: function.__dict__                          The namespace supporting arbitrary function
                                                       attributes.  See also:
                                                       *note __dict__ attributes: 1ca.
                                                       
                                                       
 -- の属性: function.__annotations__                   A *note dictionary: 193. containing annotations of
                                                       *note parameters: 255a.  The keys of the dictionary
                                                       are the parameter names, and ‘'return'’ for the
                                                       return annotation, if provided.  See also:
                                                       *note object.__annotations__: 672.
                                                       
                                                       バージョン 3.14 で変更: Annotations are now
                                                       *note lazily evaluated: 877.  See PEP 649(1).
                                                       
                                                       
 -- の属性: function.__annotate__                      The *note annotate function: 411. for this function,
                                                       or ‘None’ if the function has no annotations.  See
                                                       *note object.__annotate__: 1bb4.
                                                       
                                                       Added in version 3.14.
                                                       
                                                       
 -- の属性: function.__kwdefaults__                    A *note dictionary: 193. containing defaults for
                                                       keyword-only *note parameters: 255a.
                                                       
                                                       
 -- の属性: function.__type_params__                   A *note tuple: 1d9. containing the
                                                       *note type parameters: 7ab. of a
                                                       *note generic function: 874.
                                                       
                                                       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: 255d. may be supported in the future.

Additional information about a function's definition can be retrieved
from its *note code object: 6f1. (accessible via the *note __code__:
7a2. 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: 255f.
                                                       
                                                       
 -- の属性: method.__func__                            Refers to the original *note function object: 7a1.
                                                       
                                                       
 -- の属性: method.__doc__                             The method's documentation (same as
                                                       *note method.__func__.__doc__: 1597.).  A
                                                       *note string: 1ea. if the original function had a
                                                       docstring, else ‘None’.
                                                       
                                                       
 -- の属性: method.__name__                            The name of the method (same as
                                                       *note method.__func__.__name__: 168e.)
                                                       
                                                       
 -- の属性: 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: 7a1.

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: 7a1. or a *note classmethod: 6a0.
object.  When an instance method object is created by retrieving a
user-defined *note function object: 7a1. from a class via one of its
instances, its *note __self__: 1781. attribute is the instance, and the
method object is said to be 'bound'.  The new method's *note __func__:
16b6. attribute is the original function object.

When an instance method object is created by retrieving a *note
classmethod: 6a0. object from a class or instance, its *note __self__:
1781. attribute is the class itself, and its *note __func__: 16b6.
attribute is the function object underlying the class method.

When an instance method object is called, the underlying function (*note
__func__: 16b6.) is called, inserting the class instance (*note
__self__: 1781.) 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: 6a0.
object, the "class instance" stored in *note __self__: 1781. 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: d97. 文 (*note yield 文: d97. の節を参照) を使う関数もしく
はメソッドは 'ジェネレータ関数' と呼ばれます。 そのような関数が呼び出さ
れたときは常に、関数の本体を実行するのに使える *note イテレータ: 6d4. オ
ブジェクトを返します: イテレータの *note iterator.__next__(): 1687. メソ
ッドを呼び出すと、 ‘yield’ 文を使って値が提供されるまで関数を実行します
。 関数の *note return: 452. 文を実行するか終端に達したときは、 *note
StopIteration: fbe. 例外が送出され、イテレータが返すべき値の最後まで到達
しています。


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: 9d4. を使用して定義された関数やメソッドを 'コルーチン関
数 (coroutine function)' と呼びます。 呼び出された時、そのような関数は
*note coroutine: 8a7. オブジェクトを返します。 コルーチン関数は *note
async with: 216. や *note async for: e74. 文だけでなく *note await: 439.
式を持つことが出来ます。 *note コルーチンオブジェクト: 2565. を参照して
ください。


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: 9d4. を使って定義され、 *note yield: d97. 文を使用して
いる関数やメソッドを 'asynchronous generator function' と呼びます。 その
ような関数は、呼び出されたとき、*note 非同期イテレータ: 6d3. オブジェク
トを返します。 このオブジェクトは *note async for: e74. 文で関数の本体を
実行するのに使えます。

非同期イテレータの *note aiterator.__anext__: 1ac6. メソッドを呼び出すと
、他の処理が待たされているときに、 *note yield: d97. 式を使い値を提供す
るところまで処理を進める *note awaitable: 6d5. を返します。 その関数が空
の *note return: 452. 文を実行する、もしくは処理の終わりに到達したときは
、 *note StopAsyncIteration: 201d. 例外が送出され、非同期イテレータは出
力すべき値の最後に到達したことになります。


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(): a24. and *note math.sin(): 1876.
(*note math: 91. 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__: 1597.

   * ‘__name__’ is the function's name.  See *note function.__name__:
     168e.

   * ‘__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__: 2559.


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: 1781.)


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__(): 987.  The arguments of the call are
passed to ‘__new__()’ and, in the typical case, to *note __init__():
306. to initialize the new instance.


File: python.info,  Node: クラスのインスタンス,  Prev: クラス<2>,  Up: 呼び出し可能型 callable type

4.3.2.25 クラスのインスタンス
.............................

任意のクラスのインスタンスは、クラスで *note __call__(): 966. メソッドを
定義することで呼び出し可能になります。


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: 256f. as invoked either by the *note import:
9df. statement, or by calling functions such as *note
importlib.import_module(): 92c. and built-in *note __import__(): caa.  A
module object has a namespace implemented by a *note dictionary: 193.
object (this is the dictionary referenced by the *note __globals__:
168d. 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: 256f.  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: 2572, before the *note loader: 1c4f.
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(): 11ca, which
will set the various import-controlled attributes to appropriate values.
It's also possible to use the *note types.ModuleType: 11cb. 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__: 1744, it is 'strongly'
     recommended that you rely on *note __spec__: 2573. 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: 2574.

 -- の属性: module.__spec__

     A record of the module's import-system-related state.

     Set to the *note module spec: 247c. that was used when importing
     the module.  See *note Module specs: 2575. for more details.

     Added in version 3.4.

 -- の属性: module.__package__

     The *note package: 4c8. 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__: 1744. if the
     module itself is a package).  See PEP 366(1) for further details.

     This attribute is used instead of *note __name__: 1744. to
     calculate explicit relative imports for main modules.  It defaults
     to ‘None’ for modules created dynamically using the *note
     types.ModuleType: 11cb. constructor; use *note
     importlib.util.module_from_spec(): 11ca. instead to ensure the
     attribute is set to a *note str: 1ea.

     It is 'strongly' recommended that you use *note
     module.__spec__.parent: 594. instead of ‘module.__package__’.
     *note __package__: 593. 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: 11cb.
     constructor.  Previously the attribute was optional.

     バージョン 3.6 で変更: The value of ‘__package__’ is expected to be
     the same as *note __spec__.parent: 594.  *note __package__: 593. is
     now only used as a fallback during import resolution if
     ‘__spec__.parent’ is not defined.

     バージョン 3.10 で変更: *note ImportWarning: 90c. is raised if an
     import resolution falls back to ‘__package__’ instead of *note
     __spec__.parent: 594.

     バージョン 3.12 で変更: Raise *note DeprecationWarning: 2d4.
     instead of *note ImportWarning: 90c. 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: 1c4f. 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: 11cb. constructor; use *note
     importlib.util.module_from_spec(): 11ca. instead to ensure the
     attribute is set to a *note loader: 1c4f. object.

     It is 'strongly' recommended that you use *note
     module.__spec__.loader: 30c. instead of ‘module.__loader__’.

     バージョン 3.4 で変更: This attribute now defaults to ‘None’ for
     modules created dynamically using the *note types.ModuleType: 11cb.
     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: 904. 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: 2576. for more details.

     It is 'strongly' recommended that you use *note
     module.__spec__.submodule_search_locations: 2577. instead of
     ‘module.__path__’.

 -- の属性: module.__file__

     ‘__file__’ is an optional attribute that may or may not be set.
     Both attributes should be a *note str: 1ea. when they are
     available.

     An optional attribute, ‘__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: 256f. may
     opt to leave it unset if it has no semantic meaning (for example, a
     module loaded from a database).

     バージョン 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.

     バージョン 3.15 で変更: ‘__cached__’ is no longer set.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0366/


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: cf8.

 -- の属性: module.__annotations__

     A dictionary containing *note variable annotations: 110e. collected
     during module body execution.  For best practices on working with
     ‘__annotations__’, see *note annotationlib: 6.

     バージョン 3.14 で変更: Annotations are now *note lazily evaluated:
     877.  See PEP 649(1).

 -- の属性: module.__annotate__

     The *note annotate function: 411. for this module, or ‘None’ if the
     module has no annotations.  See also: *note __annotate__: 1bb4.
     attributes.

     Added in version 3.14.

 -- の属性: module.__lazy_modules__

     A container (an object implementing *note __contains__(): 1772.) of
     fully qualified module name strings.  When defined at module scope,
     any regular *note import: 9df. statement in that module whose
     target module name appears in this container is treated as a *note
     lazy import: 257c, as if the *note lazy: 182. keyword had been
     used.  Imports inside functions, class bodies, or *note try:
     adb./*note except: 44e./*note finally: 453. blocks are unaffected.

     See *note Compatibility via __lazy_modules__: 257d. for details and
     examples.

     Added in version 3.15.

   ---------- 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 クラス定義: 1691.).  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: 1862.

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__: 1781. attribute is ‘C’.  When it would yield a
*note staticmethod: 66d. object, it is transformed into the object
wrapped by the static method object.  See section *note デスクリプタ
(descriptor) の実装: 1011. for another way in which attributes retrieved
from a class may differ from those actually contained in its *note
__dict__: 1ca.

クラス属性を代入すると、そのクラスの辞書だけが更新され、基底クラスの辞書
は更新しません。

クラスオブジェクトを呼び出す (上記を参照) と、クラスインスタンスを生成し
ます (下記を参照)。

* 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: 141d.
                                                       
                                                       
 -- の属性: type.__qualname__                          The class's *note qualified name: 1f38.  See also:
                                                       *note __qualname__ attributes: 141c.
                                                       
                                                       
 -- の属性: type.__module__                            クラスが定義されているモジュールの名前。
                                                       
                                                       
 -- の属性: type.__dict__                              A *note mapping proxy: 194. providing a read-only
                                                       view of the class's namespace.  See also:
                                                       *note __dict__ attributes: 1ca.
                                                       
                                                       
 -- の属性: type.__bases__                             A *note tuple: 1d9. 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: 2585. 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: 110e. collected during
                                                       class body execution.  See also:
                                                       *note __annotations__ attributes: 672.
                                                       
                                                       For best practices on working with
                                                       *note __annotations__: 672, please see
                                                       *note annotationlib: 6.  Use
                                                       *note annotationlib.get_annotations(): 673. 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: 877.  See PEP 649(2).
                                                       
                                                       
 -- メソッド: type.__annotate__ ()                     The *note annotate function: 411. for this class, or
                                                       ‘None’ if the class has no annotations.  See also:
                                                       *note __annotate__ attributes: 1bb4.
                                                       
                                                       Added in version 3.14.
                                                       
                                                       
 -- の属性: type.__type_params__                       A *note tuple: 1d9. containing the
                                                       *note type parameters: 7ab. of a
                                                       *note generic class: 2587.
                                                       
                                                       Added in version 3.12.
                                                       
                                                       
 -- の属性: type.__static_attributes__                 A *note tuple: 1d9. 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__: 811. attribute removes the
                                                       ‘__firstlineno__’ item from the type's dictionary.
                                                       
                                                       Added in version 3.13.
                                                       
                                                       
 -- の属性: type.__mro__                               The *note tuple: 1d9. 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__: 2588.

 -- メソッド: 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__: 1781.
attribute is the instance.  Static method and class method objects are
also transformed; see above under "Classes".  See section *note
デスクリプタ (descriptor) の実装: 1011. 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__: 1ca.  If no class
attribute is found, and the object's class has a *note __getattr__():
8e8. method, that is called to satisfy the lookup.

属性の代入や削除を行うと、インスタンスの辞書を更新しますが、クラスの辞書
を更新することはありません。クラスで *note __setattr__(): 258c. や *note
__delattr__(): 258d. メソッドが定義されている場合、直接インスタンスの辞
書を更新する代わりにこれらのメソッドが呼び出されます。

クラスインスタンスは、ある特定の名前のメソッドを持っている場合、数値型や
シーケンス型、あるいはマップ型のように振舞うことができます。 *note
特殊メソッド名: 1030. を参照してください。

* 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__: 1d8. 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: 1581. は開かれたファイルを表します。ファイルオブジェ
クトを作るための様々なショートカットがあります: *note open(): 333. 組み
込み関数、 *note os.popen(): 58c. 、 *note os.fdopen(): 2590. 、ソケット
オブジェクトの *note makefile(): 155d. メソッド (あるいは拡張モジュール
から提供される他の関数やメソッド) 。

File objects implement common methods, listed below, to simplify usage
in generic code.  They are expected to be *note
with文とコンテキストマネージャ: 2591.

オブジェクト ‘sys.stdin’ 、 ‘sys.stdout’ および ‘sys.stderr’ は、インタ
プリタの標準入力、標準出力、および標準エラー出力ストリームに対応するファ
イルオブジェクトに初期化されます。これらはすべてテキストモードで開かれ、
*note io.TextIOBase: a89. 抽象クラスによって定義されたインターフェースに
従います。

 -- メソッド: 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 バイトコード: 6b9. を表現します。コードオブジ
ェクトと関数オブジェクトの違いは、関数オブジェクトが関数のグローバル変数
(関数を定義しているモジュールのグローバル) に対して明示的な参照を持って
いるのに対し、コードオブジェクトにはコンテキストがないということです; ま
た、関数オブジェクトではデフォルト引数値を記憶できますが、コードオブジェ
クトではできません (実行時に計算される値を表現するため)。関数オブジェク
トと違い、コードオブジェクトは変更不可能で、変更可能なオブジェクトへの参
照を (直接、間接に関わらず) 含みません。

* 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: 255a. (including positional-only
                                                       parameters and parameters with default values) that
                                                       the function has
                                                       
                                                       
 -- の属性: codeobject.co_posonlyargcount              The number of positional-only
                                                       *note parameters: 255a. (including arguments with
                                                       default values) that the function has
                                                       
                                                       
 -- の属性: codeobject.co_kwonlyargcount               The number of keyword-only *note parameters: 255a.
                                                       (including arguments with default values) that the
                                                       function has
                                                       
                                                       
 -- の属性: codeobject.co_nlocals                      The number of *note local variables: 2555. used by
                                                       the function (including parameters)
                                                       
                                                       
 -- の属性: codeobject.co_varnames                     A *note tuple: 1d9. containing the names of the
                                                       local variables in the function (starting with the
                                                       parameter names)
                                                       
                                                       
 -- の属性: codeobject.co_cellvars                     A *note tuple: 1d9. containing the names of
                                                       *note local variables: 2555. that are referenced
                                                       from at least one *note nested scope: 25a0. inside
                                                       the function
                                                       
                                                       
 -- の属性: codeobject.co_freevars                     A *note tuple: 1d9. containing the names of
                                                       *note free (closure) variables: 1ad6. that a
                                                       *note nested scope: 25a0. references in an outer
                                                       scope.  See also *note function.__closure__: 168a.
                                                       
                                                       Note: references to global and builtin names are
                                                       'not' included.
                                                       
                                                       
 -- の属性: codeobject.co_code                         A string representing the sequence of
                                                       *note bytecode: 6b9. instructions in the function
                                                       
                                                       
 -- の属性: codeobject.co_consts                       A *note tuple: 1d9. containing the literals used by
                                                       the *note bytecode: 6b9. in the function
                                                       
                                                       
 -- の属性: codeobject.co_names                        A *note tuple: 1d9. containing the names used by the
                                                       *note bytecode: 6b9. 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_stacksize                    The required stack size of the code object
                                                       
                                                       
 -- の属性: codeobject.co_flags                        An *note integer: 32e. encoding a number of flags
                                                       for the interpreter.
                                                       

The following flag bits are defined for *note co_flags: 1b1b.: 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: 25a5. 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: 1b1b. to indicate whether a
code object was compiled with a particular feature enabled.  See *note
compiler_flag: 25a6.

Other bits in *note co_flags: 1b1b. are reserved for internal use.

If a code object represents a function and has a docstring, the *note
CO_HAS_DOCSTRING: 25a7. bit is set in *note co_flags: 1b1b. and the
first item in *note co_consts: 1ade. 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: 6b9. instruction in the code object.

     The iterator returns *note tuple: 1d9.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: 183. ‘no_debug_ranges’.

        - Loading a pyc file compiled while using *note -X: 183.
          ‘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: a6a.

     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: 183.
          ‘no_debug_ranges’ command line flag or the *note
          PYTHONNODEBUGRANGES: 9ba. environment variable can be used.

 -- メソッド: codeobject.co_lines ()

     Returns an iterator that yields information about successive ranges
     of *note bytecode: 6b9.s.  Each item yielded is a ‘(start, end,
     lineno)’ *note tuple: 1d9.:

        * ‘start’ (an *note int: 32e.) represents the offset (inclusive)
          of the start of the *note bytecode: 6b9. range

        * ‘end’ (an *note int: 32e.) represents the offset (exclusive)
          of the end of the *note bytecode: 6b9. range

        * ‘lineno’ is an *note int: 32e. representing the line number of
          the *note bytecode: 6b9. 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: 1d9.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: 1d9. yielded will have ‘end’ equal to
          the size of the *note bytecode: 6b9.

     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: 6b9. 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(): 461.

     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: ebe, 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: 6f1. being executed in this
                                                       frame.  Accessing this attribute raises an
                                                       *note auditing event: 1e84. ‘object.__getattr__’
                                                       with arguments ‘obj’ and ‘"f_code"’.
                                                       
                                                       
 -- の属性: frame.f_locals                             The mapping used by the frame to look up
                                                       *note local variables: 2555.  If the frame refers to
                                                       an *note optimized scope: 6b3, 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: 2555.
                                                       
                                                       
 -- の属性: frame.f_builtins                           The dictionary used by the frame to look up
                                                       *note built-in (intrinsic) names: 2555.
                                                       
                                                       
 -- の属性: frame.f_lasti                              The "precise instruction" of the frame object (this
                                                       is an index into the *note bytecode: 6b9. string of
                                                       the *note code object: 6f1.)
                                                       
                                                       
 -- の属性: frame.f_generator                          The *note generator: 1417. or *note coroutine: 8a7.
                                                       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: f9f.).
                                                       
                                                       
 -- の属性: frame.f_trace_lines                        Set this attribute to *note False: ef9. to disable
                                                       triggering a tracing event for each source line.
                                                       
                                                       
 -- の属性: frame.f_trace_opcodes                      Set this attribute to *note True: fd0. 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: 2555.
     held by the frame.  Also, if the frame belonged to a *note
     generator: 1417, the generator is finalized.  This helps break
     reference cycles involving frame objects (for example when catching
     an *note exception: 1e3d. and storing its *note traceback: ebe. for
     later use).

     *note RuntimeError: 317. 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: 317. (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: 227f.
A traceback object is implicitly created when an exception occurs, and
may also be explicitly created by calling *note types.TracebackType:
ebc.

バージョン 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 文: adb.)  It is accessible as the third item of
the tuple returned by *note sys.exc_info(): a7f, and as the *note
__traceback__: 1680. 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: 8d6.

For explicitly created tracebacks, it is up to the creator of the
traceback to determine how the *note tb_next: ebd. attributes should be
linked to form a full stack trace.

Special read-only attributes:

 -- の属性: traceback.tb_frame                         Points to the execution *note frame: ad2. of the
                                                       current level.
                                                       
                                                       Accessing this attribute raises an
                                                       *note auditing event: 1e84. ‘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: ad2. if the exception
occurred in a *note try: adb. statement with no matching except clause
or with a *note finally: 453. 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__(): 78d. メソッドのためのスラ
イスを表すのに使われます。スライスオブジェクトは組み込みの *note
slice(): 1db. 関数でも生成されます。

Added in version 3.15: The *note slice(): 1db. type now supports *note
subscription: 25b8.  For example, ‘slice[float]’ may be used in type
annotations to indicate a slice containing *note float: 32f. objects.

読み出し専用の特殊属性: *note start: 25b9. は下限です; *note stop: 25ba.
は上限です; *note step: 25bb. はステップの値です; それぞれ省略された場合
は ‘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(): 66d. で生成されます。


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":
22b5.  Class method objects are created by the built-in *note
classmethod(): 6a0. constructor.


File: python.info,  Node: 特殊メソッド名,  Next: コルーチン,  Prev: 標準型の階層,  Up: データモデル

4.3.3 特殊メソッド名
--------------------

クラスは、特殊な名前のメソッドを定義して、特殊な構文 (算術演算や添え字表
記、スライス表記など) による特定の演算を実装できます。これは、Python の
演算子オーバロード ('operator overloading') へのアプローチです。これによ
り、クラスは言語の演算子に対する独自の振る舞いを定義できます。例えば、あ
るクラスが *note __getitem__(): 78d. という名前のメソッドを定義しており
、 ‘x’ がこのクラスのインスタンスであるとすると、 ‘x[i]’ は
‘type(x).__getitem__(x, i)’ とほぼ等価です。特に注釈のない限り、適切なメ
ソッドが定義されていないとき、このような演算を試みると例外 (たいていは
*note AttributeError: 1b4. か *note TypeError: 29c.) が送出されます。

特殊メソッドに ‘None’ を設定することは、それに対応する演算が利用できない
ことを意味します。 例えば、クラスの *note __iter__(): 1031. を ‘None’ に
設定した場合、そのクラスはイテラブルにはならず、そのインスタンスに対し
*note iter(): bb8. を呼び出すと (*note __getitem__(): 78d. に処理が戻さ
れずに) *note TypeError: 29c. を送出します。 (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:
25bf. interface in the W3C's Document Object Model.)

* Menu:

* 基本的なカスタマイズ::
* 属性値アクセスをカスタマイズする::
* クラス生成をカスタマイズする::
* インスタンスのカスタマイズとサブクラスチェック::
* ジェネリック型をエミュレートする::
* 呼び出し可能オブジェクトをエミュレートする::
* コンテナをエミュレートする::
* 数値型をエミュレートする::
* with文とコンテキストマネージャ::
* クラスパターンマッチの位置引数のカスタマイズ::
* Emulating buffer types::
* Annotations::
* 特殊メソッド検索::

   ---------- Footnotes ----------

   (1) The *note __hash__(): ec5, *note __iter__(): 1031, *note
__reversed__(): 104d, *note __contains__(): 1772, *note
__class_getitem__(): b26. and *note __fspath__(): 1014. methods have
special handling for this.  Others will still raise a *note TypeError:
29c, 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__(): 987. は静的メソッドで (このメソッドは特別扱いされている
     ので、明示的に静的メソッドと宣言する必要はありません)、インスタンス
     を生成するよう要求されているクラスを第一引数にとります。残りの引数
     はオブジェクトのコンストラクタの式 (クラスの呼び出し文) に渡されま
     す。 ‘__new__()’ の戻り値は新しいオブジェクトのインスタンス (通常は
     'cls' のインスタンス) でなければなりません。

     典型的な実装では、クラスの新たなインスタンスを生成するときには
     ‘super().__new__(cls[, ...])’ に適切な引数を指定してスーパクラスの
     *note __new__(): 987. メソッドを呼び出し、新たに生成されたインスタ
     ンスに必要な変更を加えてから返します。

     もし *note __new__(): 987. が オブジェクトの作成中に呼び出され、
     'cls' のインスタンスを返した場合には、 ‘__init__(self[, ...])’ のよ
     うにして新しいインスタンスの *note __init__(): 306. が呼び出されま
     す。このとき、 'self' は新たに生成されたインスタンスで、残りの引数
     はオブジェクトコンストラクタに渡された引数と同じになります。

     *note __new__(): 987. が 'cls' のインスタンスを返さない場合、インス
     タンスの *note __init__(): 306. メソッドは呼び出されません。

     *note __new__(): 987. の主な目的は、変更不能な型 (int, str, tuple な
     ど) のサブクラスでインスタンス生成をカスタマイズすることにあります
     。また、クラス生成をカスタマイズするために、カスタムのメタクラスで
     よくオーバーライドされます。

 -- メソッド: object.__init__ (self[, ...])

     インスタンスが (*note __new__(): 987. によって) 生成された後、それ
     が呼び出し元に返される前に呼び出されます。引数はクラスのコンストラ
     クタ式に渡したものです。基底クラスとその派生クラスがともに *note
     __init__(): 306. メソッドを持つ場合、派生クラスの ‘__init__()’ メソ
     ッドは基底クラスの ‘__init__()’ メソッドを明示的に呼び出して、イン
     スタンスの基底クラス部分が適切に初期化されること保証しなければなり
     ません。例えば、 ‘super().__init__([args...])’ 。

     *note __new__(): 987. と *note __init__(): 306. は連携してオブジェ
     クトを構成する (‘__new__()’ が作成し、 ‘__init__()’ がそれをカスタ
     マイズする) ので、 ‘__init__()’ から非 ‘None’ 値を返してはいけませ
     ん; そうしてしまうと、実行時に *note TypeError: 29c. が送出されてし
     まいます。

 -- メソッド: object.__del__ (self)

     インスタンスが破棄されるときに呼び出されます。 これはファイナライザ
     や (適切ではありませんが) デストラクタとも呼ばれます。 基底クラスが
     *note __del__(): 13ab. メソッドを持っている場合は、派生クラスの
     ‘__del__()’ メソッドは何であれ、基底クラスの ‘__del__()’ メソッドを
     明示的に呼び出して、インスタンスの基底クラス部分をきちんと確実に削
     除しなければなりません。

     *note __del__(): 13ab. メソッドが破棄しようとしているインスタンスへ
     の新しい参照を作り、破棄を送らせることは (推奨されないものの) 可能
     です。 これはオブジェクトの '復活' と呼ばれます。 復活したオブジェ
     クトが再度破棄される直前に ‘__del__()’ が呼び出されるかどうかは実装
     依存です; 現在の *note CPython: ae8. の実装では最初の一回しか呼び出
     されません。

     It is not guaranteed that ‘__del__()’ methods are called for
     objects that still exist when the interpreter exits.  *note
     weakref.finalize: e42. 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: 19fe.  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: 63. モジュールのドキュメント。

          警告: メソッド *note __del__(): 13ab. は不安定な状況で呼び出さ
          れるため、実行中に発生した例外は無視され、代わりに
          ‘sys.stderr’ に警告が表示されます。特に:

             * *note __del__(): 13ab. は、任意のコードが実行されていると
               きに、任意のスレッドから呼び出せます。 ‘__del__()’ で、ロ
               ックを取ったり、ブロックするリソースを呼び出したりする必
               要がある場合、 ‘__del__()’ の実行により中断されたコードに
               より、そのリソースが既に取得されていて、デッドロックが起
               きるかもしれません。

             * *note __del__(): 13ab. は、インタプリタのシャットダウン中
               に実行できます。 従って、(他のモジュールも含めた) アクセ
               スする必要があるグローバル変数はすでに削除されているか、
               ‘None’ に設定されているかもしれません。 Python は、単一の
               アンダースコアで始まる名前のグローバルオブジェクトは、他
               のグローバル変数が削除される前にモジュールから削除される
               ことを保証します; そのようなグローバル変数への他からの参
               照が存在しない場合、‘__del__()’ メソッドが呼ばれた時点で
               、インポートされたモジュールがまだ利用可能であることを保
               証するのに役立つかもしれません。

 -- メソッド: object.__repr__ (self)

     *note repr(): 462. 組み込み関数によって呼び出され、オブジェクトを表
     す「公式の (official)」文字列を計算します。可能なら、これは (適切な
     環境が与えられれば) 同じ値のオブジェクトを再生成するのに使える、有
     効な Python 式のようなものであるべきです。できないなら、 ‘<...some
     useful description...>’ 形式の文字列が返されるべきです。戻り値は文
     字列オブジェクトでなければなりません。クラスが *note __repr__():
     1c7. を定義していて *note __str__(): a14. は定義していなければ、そ
     のクラスのインスタンスの「非公式の (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: e51. class itself.

 -- メソッド: object.__str__ (self)

     Called by *note str(object): 1ea, the default *note __format__():
     a15. implementation, and the built-in function *note print(): 1324,
     to compute the "informal" or nicely printable string representation
     of an object.  The return value must be a *note str: 21ec. object.

     *note __str__(): a14. が有効な Python 表現を返すことが期待されない
     という点で、このメソッドは *note object.__repr__(): 1c7. とは異なり
     ます: より便利な、または簡潔な表現を使用することができます。

     組み込み型 *note object: e51. によって定義されたデフォルト実装は、
     *note object.__repr__(): 1c7. を呼び出します。

 -- メソッド: object.__bytes__ (self)

     Called by *note bytes: 20a6. to compute a byte-string
     representation of an object.  This should return a *note bytes:
     1d2. object.  The *note object: e51. class itself does not provide
     this method.

 -- メソッド: object.__format__ (self, format_spec)

     *note format(): 440. 組み込み関数、さらには *note
     フォーマット済み文字列リテラル: 441. の評価、 *note str.format():
     a17. メソッドによって呼び出され、オブジェクトの "フォーマット化され
     た (formatted)" 文字列表現を作ります。 'format_spec' 引数は、 必要
     なフォーマット化オプションの記述を含む文字列です。 'format_spec' 引
     数の解釈は、 *note __format__(): a15. を実装する型によりますが、 ほ
     とんどのクラスは組み込み型のいずれかにフォーマット化を委譲したり、
     同じようなフォーマット化オプション構文を使います。

     標準のフォーマット構文の解説は、 *note Format specification
     mini-language: 704. を参照してください。

     戻り値は文字列オブジェクトでなければなりません。

     The default implementation by the *note object: e51. class should
     be given an empty 'format_spec' string.  It delegates to *note
     __str__(): a14.

     バージョン 3.4 で変更: 空でない文字列が渡された場合 ‘object’ 自身の
     __format__ メソッドは *note TypeError: 29c. を送出します。

     バージョン 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: 447. 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(): 5f6. on the value to determine if
     the result is true or false.

     By default, ‘object’ implements ‘__eq__()’ by using ‘is’, returning
     *note NotImplemented: 447. 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(): 12f2.

     By default, the *note object: e51. class provides implementations
     consistent with *note 値の比較: 1e36.: equality compares according
     to object identity, and order comparisons raise *note TypeError:
     29c.  Each default method may generate these results directly, but
     may also return *note NotImplemented: 447.

     カスタムの比較演算をサポートしていて、辞書のキーに使うことができる
     *note ハッシュ可能: 18e. オブジェクトを作るときの重要な注意点につい
     て、 *note __hash__(): ec5. のドキュメント内に書かれているので参照
     してください。

     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: 447, the ‘==’ and ‘!=’ operators will fall back to
     ‘is’ and ‘is not’, respectively.

 -- メソッド: object.__hash__ (self)

     組み込みの *note hash(): 9e7. 関数や、 *note set: 432, *note
     frozenset: 9d9, *note dict: 193. のようなハッシュを使ったコレクショ
     ン型の要素に対する操作から呼び出されます。 ‘__hash__()’ メソッドは
     整数を返さなければなりません。 このメソッドに必要な性質は、比較結果
     が等しいオブジェクトは同じハッシュ値を持つということです; オブジェ
     クトを比較するときでも利用される要素をタプルに詰めてハッシュ値を計
     算することで、それぞれの要素のハッシュ値を混合することをおすすめし
     ます。

          def __hash__(self):
              return hash((self.name, self.nick, self.color))

          注釈: *note hash(): 9e7. はオブジェクト独自の *note
          __hash__(): ec5. メソッドが返す値を *note Py_ssize_t: e28. の
          サイズに切り詰めます。 これは 64-bit でビルドされていると 8 バ
          イトで、 32-bit でビルドされていると 4 バイトです。 オブジェク
          トの ‘__hash__()’ が異なる bit サイズのビルドでも可搬性が必要
          である場合は、必ず全てのサポートするビルドの bit 幅をチェック
          してください。 そうする簡単な方法は ‘python -c "import sys;
          print(sys.hash_info.width)"’ を実行することです。

     クラスが *note __eq__(): ec4. メソッドを定義していないなら、 *note
     __hash__(): ec5. メソッドも定義してはなりません; クラスが
     ‘__eq__()’ を定義していても ‘__hash__()’ を定義していないなら、その
     インスタンスはハッシュ可能コレクションの要素として使えません。クラ
     スがミュータブルなオブジェクトを定義しており、 ‘__eq__()’ メソッド
     を実装しているなら、 ‘__hash__()’ を定義してはなりません。これは、
     *note ハッシュ可能: 18e. コレクションの実装においてキーのハッシュ値
     がイミュータブルであることが要求されているからです (オブジェクトの
     ハッシュ値が変化すると、誤ったハッシュバケツ: hash bucket に入って
     しまいます)。

     User-defined classes have *note __eq__(): ec4. and ‘__hash__()’
     methods by default (inherited from the *note object: e51. 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__(): ec4. をオーバーライドしていて *note __hash__():
     ec5. を定義していないクラスでは、 ‘__hash__()’ は暗黙的に ‘None’ に
     設定されます。 クラスの ‘__hash__()’ メソッドが ‘None’ の場合、その
     クラスのインスタンスのハッシュ値を取得しようとすると適切な *note
     TypeError: 29c. が送出され、 ‘isinstance(obj,
     collections.abc.Hashable)’ でチェックするとハッシュ不能なものとして
     正しく認識されます。

     *note __eq__(): ec4. をオーバーライドしたクラスが親クラスからの
     *note __hash__(): ec5. の 実装を保持したいなら、明示的に ‘__hash__
     = <ParentClass>.__hash__’ を設定することで、それをインタプリタに伝
     えなければなりません。

     *note __eq__(): ec4. をオーバーライドしていないクラスがハッシュサポ
     ートを抑制したい場合、クラス定義に ‘__hash__ = None’ を含めてくださ
     い。クラス自身で明示的に *note TypeError: 29c. を送出する *note
     __hash__(): ec5. を定義すると、 ‘isinstance(obj,
     collections.abc.Hashable)’ 呼び出しで誤ってハッシュ可能と識別される
     でしょう。

          注釈: デフォルトでは、文字列とバイト列の *note __hash__():
          ec5. 値は予測不可能なランダム値で "ソルト" されます。 ハッシュ
          値は単独の 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: 1434. も参照してください。

     バージョン 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__(): 19aa. 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: e51. 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: 1b4. (either *note __getattribute__(): f94. raises
     an ‘AttributeError’ because 'name' is not an instance attribute or
     an attribute in the class tree for ‘self’; or *note __get__():
     18a0. of a 'name' property raises ‘AttributeError’).  This method
     should either return the (computed) attribute value or raise an
     ‘AttributeError’ exception.  The *note object: e51. 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__(): 258c.)  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__(): f94. method below for a way to actually
     get total control over attribute access.

 -- メソッド: object.__getattribute__ (self, name)

     クラスのインスタンスに対する属性アクセスを実装するために、無条件に
     呼び出されます。クラスが *note __getattr__(): 8e8. も定義している場
     合、 ‘__getattr__()’ は、 *note __getattribute__(): f94. で明示的に
     呼び出すか、 *note AttributeError: 1b4. 例外を送出しない限り呼ばれ
     ません。このメソッドは (計算された) 属性値を返すか、
     ‘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: 255d.  See *note
          特殊メソッド検索: 25c5.

     セキュリティに関わるような ‘obj’ と ‘name’ を渡しての
     ‘object.__getattr__’ を使った属性アクセスは *note 監査イベント:
     1e84. を送出します。

 -- メソッド: object.__setattr__ (self, name, value)

     属性の代入が試みられた際に呼び出されます。これは通常の代入の過程 (す
     なわち、インスタンス辞書への値の代入) の代わりに呼び出されます。
     'name' は属性名で、'value' はその属性に代入する値です。

     *note __setattr__(): 258c. の中でインスタンス属性への代入が必要なら
     、基底クラスのこれと同じ名前のメソッドを呼び出さなければなりません
     。例えば、 ‘object.__setattr__(self, name, value)’ とします。

     セキュリティに関わるような ‘obj’ と ‘name’ と ‘value’ を渡しての
     ‘object.__setattr__’ を使った属性のアサインは *note 監査イベント:
     1e84. を送出します。

 -- メソッド: object.__delattr__ (self, name)

     *note __setattr__(): 258c. に似ていますが、代入ではなく値の削除を行
     います。このメソッドを実装するのは、オブジェクトにとって ‘del
     obj.name’ が意味がある場合だけにしなければなりません。

     セキュリティに関わるような ‘obj’ と ‘name’ を渡しての
     ‘object.__getattr__’ を使った属性の削除は *note 監査イベント: 1e84.
     を送出します。

 -- メソッド: object.__dir__ (self)

     Called when *note dir(): a28. 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:
1b4. を送出します。 属性がモジュールオブジェクトから、通常の検索、つまり
*note object.__getattribute__(): f94. で見付からなかった場合は、
‘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(): a28. search
on a module.

 -- の属性: module.__class__

より細かい粒度でのモジュールの動作 (属性やプロパティの設定など) のカスタ
マイズのために、モジュールオブジェクトの ‘__class__’ 属性に *note
types.ModuleType: 11cb. のサブクラスが設定できます。 例えば次のようにな
ります:

     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__: 1ca.  The
*note object: e51. class itself does not implement any of these
protocols.

 -- メソッド: object.__get__ (self, instance, owner=None)

     オーナークラス（クラス属性アクセスの場合）や、クラスのインスタンス
     （インスタンス属性アクセスの場合）の属性取得時に呼び出されます。
     'instance' を通じて属性をアクセスする時に、オプションの 'owner' 引
     数はオーナークラスです。 'owner' を通じて属性アクセスするときは
     ‘None’ です。

     このメソッドは、算出された属性値を返すか、 *note AttributeError:
     1b4. 例外を送出します。

     PEP 252(1) は *note __get__(): 18a0. は1つや2つの引数を持つ呼び出し
     可能オブジェクトであると定義しています。Pythonの組み込みのデスクリ
     プタはこの仕様をサポートしていますが、サードパーティ製のツールの中
     には両方の引数を必要とするものもあります。Pythonの *note
     __getattribute__(): f94. 実装は必要かどうかに関わらず、両方の引数を
     常に渡します。

 -- メソッド: object.__set__ (self, instance, value)

     オーナークラスのインスタンス 'instance' 上の属性を新たな値 'value'
     に設定する際に呼び出されます。

     *note __set__(): 25c9. あるいは *note __delete__(): 1b83. を追加す
     ると、デスクリプタは「データデスクリプタ」に変わります。詳細は
     *note デスクリプタの呼び出し: 25ca. を参照してください。

 -- メソッド: 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:
     81. 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__(): 18a0, *note
__set__(): 25c9, および *note __delete__(): 1b83. を使って、属性アクセス
をオーバーライドしているものです。これらのメソッドのいずれかがオブジェク
トに対して定義されている場合、オブジェクトはデスクリプタであるといいます
。

属性アクセスのデフォルトの動作は、オブジェクトの辞書から値を取り出したり
、値を設定したり、削除したりするというものです。例えば、 ‘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__(): 18a0, *note __set__(): 25c9. and *note
__delete__(): 1b83.  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: 66d.
and *note @classmethod: 6a0.) 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(): 6c1. 関数はデータデスクリプタとして実装されています。
従って、インスタンスはあるプロパティの動作をオーバーライドすることができ
ません。


File: python.info,  Node: __slots__<2>,  Prev: デスクリプタの呼び出し,  Up: 属性値アクセスをカスタマイズする

4.3.3.6 __slots__
.................

'__slots__' を使うと、(プロパティのように) データメンバを明示的に宣言し
、 (明示的に '__slots__' で宣言しているか親クラスに存在しているかでない
限り) *note __dict__: 1ca. や '__weakref__' を作成しないようにできます。

*note __dict__: 1ca. を使うのに比べて、節約できるメモリ空間はかなり大き
いです。 属性探索のスピードもかなり向上できます。

 -- データ: object.__slots__

     このクラス変数には、インスタンスが用いる変数名を表す、文字列、イテ
     ラブル、または文字列のシーケンスを代入できます。'__slots__' は、各
     インスタンスに対して宣言された変数に必要な記憶領域を確保し、*note
     __dict__: 1ca. と '__weakref__' が自動的に生成されないようにします
     。
Notes on using '__slots__':

   * '__slots__' を持たないクラスから継承するとき、インスタンスの *note
     __dict__: 1ca. 属性と '__weakref__' 属性は常に利用可能です。

   * *note __dict__: 1ca. 変数がない場合、 '__slots__' に列挙されていな
     い新たな変数をインスタンスに代入することはできません。列挙されてい
     ない変数名を使って代入しようとした場合、 *note AttributeError: 1b4.
     が送出されます。新たな変数を動的に代入したいのなら、 '__slots__' を
     宣言する際に ‘'__dict__'’ を変数名のシーケンスに追加してください。

   * '__slots__' を定義しているクラスの各インスタンスに '__weakref__' 変
     数がない場合、インスタンスに対する弱参照 (*note weak references:
     11d.) はサポートされません。弱参照のサポートが必要なら、
     '__slots__' を宣言する際に ‘'__weakref__'’ を変数名のシーケンスに追
     加してください。

   * '__slots__' は、クラスのレベルで各変数に対する *note デスクリプタ:
     1011. を使って実装されます。その結果、 '__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__: 1ca. and '__weakref__' unless the subclass also
     defines '__slots__' (which should only contain names of any
     'additional' slots).

   * あるクラスで、基底クラスですでに定義されているスロットを定義した場
     合、基底クラスのスロットで定義されているインスタンス変数は (デスク
     リプタを基底クラスから直接取得しない限り) アクセスできなくなります
     。これにより、プログラムの趣意が不定になってしまいます。将来は、こ
     の問題を避けるために何らかのチェックが追加されるかもしれません。

   * *note TypeError: 29c. will be raised if '__slots__' other than
     '__dict__' and '__weakref__' are defined for a class derived from a
     *note "variable-length" built-in type: 25cf. such as *note int:
     32e, *note bytes: 1d2, and *note type: 191, except *note tuple:
     1d9.

   * Any non-string *note iterable: 149a. may be assigned to
     '__slots__'.

   * If a *note dictionary: 193. 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(): 237. and displayed in
     the output of *note help(): cad.

   * *note __class__: 1865. assignment works only if both classes have
     the same '__slots__'.

   * *note Multiple inheritance: 22af. 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: 29c.

   * もし '__slots__' に対して *note イテレータ: 6d4. を使用すると、イテ
     レータの値ごとに *note デスクリプタ: 22a. が作られます。しかし、
     '__slots__' 属性は空のイテレータとなります。

バージョン 3.15 で変更: Allowed defining the '__dict__' and
'__weakref__' '__slots__' for any class.  Allowed defining any
'__slots__' for a class derived from *note tuple: 1d9.


File: python.info,  Node: クラス生成をカスタマイズする,  Next: インスタンスのカスタマイズとサブクラスチェック,  Prev: 属性値アクセスをカスタマイズする,  Up: 特殊メソッド名

4.3.3.7 クラス生成をカスタマイズする
....................................

クラスが他のクラスを継承するときに必ず、親クラスの *note
__init_subclass__(): a27. が呼び出されます。これを利用すると、サブクラス
の挙動を変更するクラスを書くことができます。これは、クラスデコレータとと
ても良く似ていますが、クラスデコレータが、それが適用された特定のクラスに
のみに影響するのに対して、 ‘__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__(): 1010. 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 クラスオブジェクトの作成: 100c. を参照してください。

     Added in version 3.6.

* Menu:

* メタクラス::
* MRO エントリの解決::
* 適切なメタクラスの決定::
* クラスの名前空間の準備::
* クラス本体の実行::
* クラスオブジェクトの作成::
* メタクラスの用途::


File: python.info,  Node: メタクラス,  Next: MRO エントリの解決,  Up: クラス生成をカスタマイズする

4.3.3.8 メタクラス
..................

デフォルトでは、クラスは *note type(): 191. を使って構築されます。 クラ
ス本体は新しい名前空間で実行され、クラス名が ‘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: 191, 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(): f5f.

     Dynamically resolve bases that are not instances of *note type:
     191.

*note types.get_original_bases(): 8e3.

     Retrieve a class's "original bases" prior to modifications by *note
     __mro_entries__(): eb5.

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():
     191. が使われます;

   * 明示的なメタクラスが与えられていて、それが *note type(): 191. のイ
     ンスタンス 'ではない' 場合、それをメタクラスとして直接使います;

   * 明示的なメタクラスとして *note type(): 191. のインスタンスが与えら
     れたか、基底が定義されていた場合は、最も派生した (継承関係で最も下
     の) メタクラスが使われます。

最も派生的なメタクラスは、(もしあれば) 明示的に指定されたメタクラスと、
指定されたすべてのベースクラスのメタクラスから選ばれます。最も派生的なメ
タクラスは、これらのメタクラス候補のすべてのサブタイプであるようなもので
す。メタクラス候補のどれもその基準を満たさなければ、クラス定義は
‘TypeError’ で失敗します。


File: python.info,  Node: クラスの名前空間の準備,  Next: クラス本体の実行,  Prev: 適切なメタクラスの決定,  Up: クラス生成をカスタマイズする

4.3.3.11 クラスの名前空間の準備
...............................

適切なメタクラスが指定されると、クラスの名前空間が用意されます。もしメタ
クラスが ‘__prepare__’ 属性を持っている場合、 ‘namespace =
metaclass.__prepare__(name, bases, **kwds)’ が呼ばれます。追加のキーワー
ド引数は、もしクラス定義にあれば設定されます。 ‘__prepare__’ メソッドは
*note クラスメソッド: 6a0. として実装する必要があります。 ‘__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(): 190. の重要な違いは、クラス定義
が関数内部で行われる場合、レキシカルスコープによってクラス本体 (任意のメ
ソッドを含む) が現在のスコープと外側のスコープから名前を参照できるという
点です。

しかし、クラス定義が関数内部で行われる時でさえ、クラス内部で定義されたメ
ソッドはクラススコープで定義された名前を見ることはできません。クラス変数
はインスタンスメソッドかクラスメソッドの最初のパラメータからアクセスする
か、次の節で説明する、暗黙的に静的スコープが切られている ‘__class__’ 参
照からアクセスしなければなりません。


File: python.info,  Node: クラスオブジェクトの作成,  Next: メタクラスの用途,  Prev: クラス本体の実行,  Up: クラス生成をカスタマイズする

4.3.3.13 クラスオブジェクトの作成
.................................

クラス本体の実行によってクラスの名前空間が初期化されたら、
‘metaclass(name, bases, namespace, **kwds)’ を呼び出すことでクラスオブジ
ェクトが作成されます (ここで渡される追加のキーワードは ‘__prepare__’ に
渡されるものと同じです)。

このクラスオブジェクトは、 *note super(): 44a. の無引数形式によって参照
されるものです。 ‘__class__’ は、クラス本体中のメソッドが ‘__class__’ ま
たは ‘super’ のいずれかを参照している場合に、コンパイラによって作成され
る暗黙のクロージャー参照です。これは、メソッドに渡された最初の引数に基づ
いて現在の呼び出しを行うために使用されるクラスまたはインスタンスが識別さ
れる一方、 ‘super()’ の無引数形式がレキシカルスコープに基づいて定義され
ているクラスを正確に識別することを可能にします。

CPython 3.6 以降では、 ‘__class__’ セルは、クラス名前空間にある
‘__classcell__’ エントリーとしてメタクラスに渡されます。 ‘__class__’ セ
ルが存在していた場合は、そのクラスが正しく初期化されるために、
‘type.__new__’ の呼び出しに到達するまで上に伝搬されます。 失敗した場合は
、Python 3.8 では *note RuntimeError: 317. になります。

デフォルトのメタクラス *note type: 191. や最終的には ‘type.__new__’ を呼
び出すメタクラスを使っているときは、クラスオブジェクトを作成した後に次の
カスタム化の手順が起動されます:

  1. ‘type.__new__’ メソッドが *note __set_name__(): 1010. が定義されて
     いるクラスの名前空間にある全ての属性を収集します;

  2. それらの ‘__set_name__’ メソッドが、そのメソッドが定義されているク
     ラス、およびそこに属する属性に割り当てられている名前を引数として呼
     び出されます;

  3. 新しいクラスのメソッド解決順序ですぐ上に位置する親クラスで *note
     __init_subclass__(): a27. フックが呼び出されます。

クラスオブジェクトが作成された後には、クラス定義に含まれているクラスデコ
レータ (もしあれば) にクラスオブジェクトが渡され、デコレータが返すオブジ
ェクトがここで定義されたクラスとしてローカルの名前空間に束縛されます。

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__: 101f. 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(): 2fb. と *note
issubclass(): 2fc. のデフォルトの動作を上書きするのに利用します。

特に、 *note abc.ABCMeta: 12cd. メタクラスは、抽象基底クラス (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(): 2fb.
     and *note issubclass(): 2fc. behavior through *note
     __instancecheck__(): 25db. and *note __subclasscheck__(): 25dc,
     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: 410, it is often useful to
'parameterize' a *note generic type: 1dc. using Python's square-brackets
notation.  For example, the annotation ‘list[int]’ might be used to
signify a *note list: 4e0. in which all the elements are of type *note
int: 32e.

参考
....

PEP 484(1) - 型ヒント

     Introducing Python's framework for type annotations

*note Generic Alias Types: aa4.

     Documentation for objects representing parameterized generic
     classes

*note ジェネリクス: 25de, *note user-defined generics: 8e4. and *note typing.Generic: 1a12.

     実行時にパラメータ設定が可能であり、かつ静的な型チェッカーが理解で
     きるジェネリッククラスを実装する方法のドキュメントです。

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: 6a0. 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__(): b26. is to allow runtime
parameterization of standard-library generic classes in order to more
easily apply *note type hints: 25e0. 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__(): b26, or inherit from *note typing.Generic: 1a12,
which has its own implementation of ‘__class_getitem__()’.

Custom implementations of *note __class_getitem__(): b26. 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: 25b8. of an object using square
brackets will call the *note __getitem__(): 78d. instance method defined
on the object's class.  However, if the object being subscribed is
itself a class, the class method *note __class_getitem__(): b26. may be
called instead.  ‘__class_getitem__()’ should return a *note
GenericAlias: aa4. object if it is properly defined.

Presented with the *note expression: 25e3. ‘obj[x]’, the Python
interpreter follows something like the following process to decide
whether *note __getitem__(): 78d. or *note __class_getitem__(): b26.
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: 25e4, and
most classes have the *note type: 191. class as their metaclass.  ‘type’
does not define *note __getitem__(): 78d, meaning that expressions such
as ‘list[int]’, ‘dict[str, float]’ and ‘tuple[str, bytes]’ all result in
*note __class_getitem__(): b26. 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__(): 78d, subscribing the class may result in different
behaviour.  An example of this can be found in the *note enum: 59.
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__(): b26, and outlining when a
     *note subscription: 25b8. results in ‘__class_getitem__()’ being
     called instead of *note __getitem__(): 78d.

   ---------- 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: e51. 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: e51. class itself.
Containers usually are *note sequences: 904. (such as *note lists: 4e0.
or *note tuples: 1d9.) or *note mappings: 1579. (like *note
dictionaries: 25e9.), 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: 1db. 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: 193. objects.
The *note collections.abc: 1f. module provides a *note MutableMapping:
146a. *note abstract base class: 1574. to help create those methods from
a base set of *note __getitem__(): 78d, *note __setitem__(): 1685, *note
__delitem__(): 1686, and ‘keys()’.

Mutable sequences should provide methods *note append(): 25ea, *note
clear(): 25eb, *note count(): 25ec, *note extend(): 25ed, *note index():
1baa, *note insert(): 25ee, *note pop(): 25ef, *note remove(): 1bab, and
*note reverse(): 25f0, like Python standard *note list: 4e0. objects.
Finally, sequence types should implement addition (meaning
concatenation) and multiplication (meaning repetition) by defining the
methods *note __add__(): 25f1, *note __radd__(): 25f2, *note __iadd__():
25f3, *note __mul__(): 25f4, *note __rmul__(): 25f5. and *note
__imul__(): 25f6. described below; they should not define other
numerical operators.

It is recommended that both mappings and sequences implement the *note
__contains__(): 1772. 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__(): 1031. 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(): a24.  Should
     return the length of the object, an integer ‘>=’ 0.  Also, an
     object that doesn't define a *note __bool__(): 168f. 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: 1583.  If the length is larger than
     ‘sys.maxsize’ some features (such as *note len(): a24.) may raise
     *note OverflowError: c5b.  To prevent raising ‘OverflowError’ by
     truth value testing, an object must define a *note __bool__():
     168f. method.

 -- メソッド: object.__length_hint__ (self)

     Called to implement *note operator.length_hint(): 131c.  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: 447, 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: 25b8. 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:
          25f7.) should be an integer or a *note slice: 1db. object.
          See the *note sequence documentation: 2547. for the expected
          behavior, including handling ‘slice’ objects and negative
          indices.

        - 'mappings', where 'subscript' is also called the *note key:
          25f8.  See *note mapping documentation: 254e. for the expected
          behavior.

     If 'subscript' is of an inappropriate type, ‘__getitem__()’ should
     raise *note TypeError: 29c.  If 'subscript' has an inappropriate
     value, ‘__getitem__()’ should raise an *note LookupError: 25f9. or
     one of its subclasses (*note IndexError: 18ed. for sequences; *note
     KeyError: 7e5. for mappings).

          注釈: Slicing is handled by ‘__getitem__()’, *note
          __setitem__(): 1685, and *note __delitem__(): 1686.  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: 329. loops), expects that an *note IndexError:
          18ed. will be raised for illegal indexes to allow proper
          detection of the end of a sequence.

          注釈: When *note subscripting: 25b8. a 'class', the special
          class method *note __class_getitem__(): b26. may be called
          instead of ‘__getitem__()’.  See *note __class_getitem__
          versus __getitem__: 25e2. for more details.

 -- メソッド: object.__setitem__ (self, key, value)

     ‘self[key]’ に対する代入を実装するために呼び出されます。 *note
     __getitem__(): 78d. と同じ注意事項があてはまります。このメソッドを
     実装できるのは、あるキーに対する値の変更をサポートしているか、新た
     なキーを追加できるようなマップの場合と、ある要素を置き換えることが
     できるシーケンスの場合だけです。不正な 'key' に対しては、
     ‘__getitem__()’ メソッドと同様の例外の送出を行わなければなりません
     。

 -- メソッド: object.__delitem__ (self, key)

     ‘self[key]’ の削除を実装するために呼び出されます。 *note
     __getitem__(): 78d. と同じ注意事項があてはまります。このメソッドを
     実装できるのは、キーの削除をサポートしているマップの場合と、要素を
     削除できるシーケンスの場合だけです。不正な 'key' に対しては、
     ‘__getitem__()’ メソッドと同様の例外の送出を行わなければなりません
     。

 -- メソッド: object.__missing__ (self, key)

     ‘self[key]’ の実装において辞書内にキーが存在しなかった場合に、 dict
     のサブクラスのために *note dict: 193.*note __getitem__(): 78d. によ
     って呼び出されます。

 -- メソッド: object.__iter__ (self)

     このメソッドは、コンテナに対して *note イテレータ: 6d4. が要求され
     た際に呼び出されます。このメソッドは、コンテナ内の全てのオブジェク
     トに渡って反復処理できるような、新たなイテレータオブジェクトを返さ
     なければなりません。マッピングでは、コンテナ内のキーに渡って反復処
     理しなければなりません。

 -- メソッド: object.__reversed__ (self)

     *note reversed(): c40. 組み込み関数が逆方向イテレーションを実装する
     ために、(存在すれば)呼び出します。コンテナ内の全要素を逆順にイテレ
     ートする、新しいイテレータを返すべきです。

     *note __reversed__(): 104d. メソッドが定義されていない場合、 *note
     reversed(): c40. 組込み関数は sequence プロトコル (*note __len__():
     19aa. と *note __getitem__(): 78d.) を使った方法にフォールバックし
     ます。 sequence プロトコルをサポートしたオブジェクトは、
     ‘reversed()’ よりも効率のいい実装を提供できる場合にのみ
     ‘__reversed__()’ を定義するべきです。

帰属テスト演算子 (*note in: 32b. および *note not in: a25.) は通常、コン
テナの要素に対する反復処理のように実装されます。しかし、コンテナオブジェ
クトで以下の特殊メソッドを定義して、より効率的な実装を行ったり、オブジェ
クトがイテラブルでなくてもよいようにできます。

 -- メソッド: object.__contains__ (self, item)

     帰属テスト演算を実装するために呼び出されます。 'item' が 'self' 内
     に存在する場合には真を、そうでない場合には偽を返さなければなりませ
     ん。マップオブジェクトの場合、値やキーと値の組ではなく、キーに対す
     る帰属テストを考えなければなりません。

     *note __contains__(): 1772. を定義しないオブジェクトに対しては、メ
     ンバシップテストはまず、 *note __iter__(): 1031. を使った反復を試み
     ます、次に古いシーケンス反復プロトコル *note __getitem__(): 78d. を
     使います、 *note 言語レファレンスのこの節: 25fa. を参照して下さい。


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():
     d6e, *note pow(): 448, ‘**’, ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’).  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: 447.

 -- メソッド: 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():
     d6e, *note pow(): 448, ‘**’, ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’) 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:
     447. 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(): 448. function is to be supported.

     バージョン 3.14 で変更: Three-argument *note pow(): 448. 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: 447, 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'] は例外を送出するのですか?: 2616.), 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(): 229a. および ‘~’) を
     実装します。

 -- メソッド: object.__complex__ (self)
 -- メソッド: object.__int__ (self)
 -- メソッド: object.__float__ (self)

     組み込み関数の *note complex(): 330, *note int(): 32e, *note
     float(): 32f. の実装から呼び出されます。 適切な型の値を返さなければ
     なりません。

 -- メソッド: object.__index__ (self)

     呼び出して *note operator.index(): 1ee7. を実装します。 Python が数
     値オブジェクトを整数オブジェクトに損失なく変換する必要がある場合 (た
     とえばスライシングや、組み込みの *note bin(): 1662. 、 *note hex():
     1689. 、 *note oct(): 1688. 関数) は常に呼び出されます。 このメソッ
     ドがあるとその数値オブジェクトが整数型であることが示唆されます。 整
     数を返さなければなりません。

     もし *note __int__(): 443, *note __float__(): d96, *note
     __complex__(): 9e3. が定義されていない場合、組み込み関数の *note
     int(): 32e, *note float(): 32f, *note complex(): 330. は *note
     __index__(): 444. にフォールバックします。

 -- メソッド: object.__round__ (self[, ndigits])
 -- メソッド: object.__trunc__ (self)
 -- メソッド: object.__floor__ (self)
 -- メソッド: object.__ceil__ (self)

     組み込み関数の *note round(): 1694. と *note math: 91. モジュール関
     数の *note trunc(): 1778, *note floor(): 1776, *note ceil(): 1777.
     の実装から呼び出されます。 'ndigits' が ‘__round__()’ に渡されない
     限りは、これらの全てのメソッドは *note Integral: 261e. (たいていは
     *note int: 32e.) に切り詰められたオブジェクトの値を返すべきです。

     バージョン 3.14 で変更: *note int(): 32e. 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: 447.  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__(): 25f1.) 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: 215. 文の実
行時にランタイムコンテキストを定義するオブジェクトです。コンテキストマネ
ージャは、コードブロックを実行するために必要な入り口および出口の処理を扱
います。コンテキストマネージャは通常、 ‘with’ 文（ *note with 文: 215. の
章を参照）により起動されますが、これらのメソッドを直接呼び出すことで起動
することもできます。

コンテキストマネージャの代表的な使い方としては、様々なグローバル情報の保
存および更新、リソースのロックとアンロック、ファイルのオープンとクローズ
などが挙げられます。

For more information on context managers, see *note
コンテキストマネージャ型: 2620.  The *note object: e51. class itself
does not provide the context manager methods.

 -- メソッド: object.__enter__ (self)

     コンテキストマネージャのの入り口で実行される処理です。 *note with:
     215. 文は、文の ‘as’ 節で規定された値を返すこのメソッドを呼び出しま
     す。

 -- メソッド: object.__exit__ (self, exc_type, exc_value, traceback)

     コンテキストマネージャの出口で実行される処理です。パラメータは、コ
     ンテキストが終了した原因となった例外について説明しています。コンテ
     キストが例外を送出せず終了した場合は、全ての引き数に *note None:
     a6a. が設定されます。

     もし、例外が送出され、かつメソッドが例外を抑制したい場合（すなわち
     、例外が伝播されるのを防ぎたい場合）、このメソッドは 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: 215. 文の仕様、背景、および例が記載されていま
     す。

   ---------- 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: 29c. を送出します。

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: 319. 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: 1d2. and *note
memoryview: 1dd, 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: 1dd. 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: 87f. provides a convenient way to
     interpret the flags.  The method must return a ‘memoryview’ object.

     'Thread safety:' In *note free-threaded: 48e. 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__(): 1c8a. call completes.  See *note Thread
     safety for memoryview objects: 2625. for details.

 -- メソッド: object.__release_buffer__ (self, buffer)

     Called when a buffer is no longer needed.  The 'buffer' argument is
     a *note memoryview: 1dd. object that was previously returned by
     *note __buffer__(): 87e.  The method must release any resources
     associated with the buffer.  This method should return ‘None’.

     'Thread safety:' In *note free-threaded: 48e. 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: 31a.

     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: 410,
which are a way to associate information (usually *note type hints:
25e0.) with a symbol.

 -- の属性: object.__annotations__

     This attribute contains the annotations for an object.  It is *note
     lazily evaluated: 877, 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: 411.  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: 4c5. 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: 5a1.  Annotate functions must
     always support *note VALUE: 412. format; they must not raise *note
     NotImplementedError(): 5a1. when called with this format.

     When called with *note VALUE: 412. format, an annotate function may
     raise *note NameError: 66c.; it must not raise ‘NameError’ when
     called requesting any other format.

     If an object does not have any annotations, *note __annotate__:
     1bb4. 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__(): ec5. と *note __repr__():
1c7. といった 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__(): f94. メソ
ッドもバイパスします:

     >>> 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__(): f94. 機構をバイパスすることで、特殊
メソッドの扱いに関するある程度の自由度と引き換えに (特殊メソッドはインタ
プリタから一貫して実行されるためにクラスオブジェクトに設定 'しなければな
らない')、インタープリタを高速化するための大きな余地が手に入ります。


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: 6d5. オブジェクトは一般的には *note __await__(): 1132.
メソッドが実装されています。 *note async def: 9d4. 関数が返す *note
Coroutineオブジェクト: 8a7. は待機可能です。

     注釈: *note types.coroutine(): 123c. デコレータでデコレータが付けら
     れたジェネレータから返される *note generator iterator: fa2. オブジ
     ェクトも待機可能ですが、 *note __await__(): 1132. は実装されていま
     せん。

 -- メソッド: object.__await__ (self)

     Must return an *note iterator: 6d4.  Should be used to implement
     *note awaitable: 6d5. objects.  For instance, *note asyncio.Future:
     f8f. implements this method to be compatible with the *note await:
     439. expression.  The *note object: e51. 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: 6d5. 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オブジェクト: 8a7. は *note awaitable: 6d5. オブジェクト
です。*note __await__(): 1132. を呼び出し、その返り値に対し反復処理をす
ることでコルーチンの実行を制御できます。コルーチンの実行が完了し制御を戻
したとき、イテレータは *note StopIteration: fbe. を送出し、その例外の
*note value: 262b. 属性に返り値を持たせます。コルーチンが例外を送出した
場合は、イテレータにより伝搬されます。コルーチンから ‘StopIteration’ 例
外を外に送出すべきではありません。

コルーチンには以下に挙げるメソッドもあり、これらはジェネレータのメソッド
からの類似です (*note ジェネレータ-イテレータメソッド: 262c. を参照して
ください)。 ただし、ジェネレータと違って、コルーチンは反復処理を直接はサ
ポートしていません。

バージョン 3.5.2 で変更: コルーチンで2回以上待機 (await) すると *note
RuntimeError: 317. となります。

 -- メソッド: 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__(): 1132.  If 'value' is not ‘None’, this method
     delegates to the *note send(): 1418. method of the iterator that
     caused the coroutine to suspend.  The result (return value, *note
     StopIteration: fbe, 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(): 90a. メソッドがある場合に
     処理を委任します。 そうでない場合には、中断した地点から例外が送出さ
     れます。 結果 (返り値か *note StopIteration: fbe. かその他の例外) は
     、上で解説したような *note __await__(): 1132. の返り値に対して反復
     処理を行ったときと同じです。 例外がコルーチンの中で捕捉されなかった
     場合、呼び出し元へ伝搬されます。

     バージョン 3.12 で変更: The second signature (type[, value[,
     traceback]]) is deprecated and may be removed in a future version
     of Python.

 -- メソッド: coroutine.close ()

     コルーチンが自分自身の後片付けをし終了します。 コルーチンが一時停止
     している場合は、コルーチンを一時停止させたイテレータに *note
     close(): 19bf. メソッドがあれば、まずはそれに処理を委任します。 そ
     して一時停止した地点から *note GeneratorExit: 1780. が送出され、た
     だちにコルーチンが自分自身の後片付けを行います。 最後に、実行が開始
     されていなかった場合でも、コルーチンに実行が完了した印を付けます。

     コルーチンオブジェクトが破棄されるときには、上記の手順を経て自動的
     に閉じられます。


File: python.info,  Node: 非同期イテレータ Asynchronous Iterator,  Next: 非同期コンテキストマネージャ Asynchronous Context Manager,  Prev: コルーチンオブジェクト,  Up: コルーチン

4.3.4.3 非同期イテレータ (Asynchronous Iterator)
................................................

'非同期イテレータ' の ‘__anext__’ メソッドからは非同期のコードが呼べます
。

非同期イテレータは *note async for: e74. 文の中で使えます。

The *note object: e51. class itself does not provide these methods.

 -- メソッド: object.__aiter__ (self)

     '非同期イテレータ' オブジェクトを返さなくてはなりません。

 -- メソッド: object.__anext__ (self)

     イテレータの次の値を返す '待機可能オブジェクト' を返さなければなり
     ません。 反復処理が終了したときには *note StopAsyncIteration: 201d.
     エラーを送出すべきです。

非同期イテラブルオブジェクトの例:

     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__(): fbf. は
*note 非同期イテレータ: 6d3. になる 'awaitable' を返せました。

Python 3.7 からは、 *note __aiter__(): fbf. は非同期イテレータオブジェク
トを返さなければなりません。 それ以外のものを返すと *note TypeError:
29c. になります。


File: python.info,  Node: 非同期コンテキストマネージャ Asynchronous Context Manager,  Prev: 非同期イテレータ Asynchronous Iterator,  Up: コルーチン

4.3.4.4 非同期コンテキストマネージャ (Asynchronous Context Manager)
...................................................................

'非同期コンテキストマネージャ' は、 ‘__aenter__’ メソッドと ‘__aexit__’
メソッド内部で実行を一時停止できる 'コンテキストマネージャ' です。

非同期コンテキストマネージャは *note async with: 216. 文の中で使えます。

The *note object: e51. class itself does not provide these methods.

 -- メソッド: object.__aenter__ (self)

     Semantically similar to *note __enter__(): 9cb, the only difference
     being that it must return an 'awaitable'.

 -- メソッド: object.__aexit__ (self, exc_type, exc_value, traceback)

     Semantically similar to *note __exit__(): 16ba, 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: 44c. オプションで指定されたコマンド) もコー
ドブロックです。 引数 *note -m: 4d1. を使用して、コマンドラインからトッ
プレベルスクリプト(すなわちモジュール ‘__main__’ )として実行されるモジュ
ールもまたコードブロックです。組み込み関数 *note eval(): 18f. や *note
exec(): 190. に渡された文字列引数もコードブロックです。

コードブロックは、実行フレーム ('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: 263b. that are identifiers if occurring in an
     assignment:

        + *note for: 329. loop header,

        + after ‘as’ in a *note with: 215. statement, *note except: 44e.
          clause, *note except*: 44f. clause, or in the as-pattern in
          structural pattern matching,

        + in a capture pattern in structural pattern matching

   * *note import: 9df. 文.

   * *note type: 860. statements.

   * *note type parameter lists: 7ab.

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: 1d3c. 文で指定される対象は、(‘del’ の意味付けは、実際は名前の
解放 (unbind) ですが) 文の目的上、束縛済みのものとみなされます。

代入文や import 文はいずれも、クラスや関数定義、モジュールレベル (トップ
レベルのコードブロック) 内で起こります。

If a name is bound in a block, it is a local variable of that block,
unless declared as *note nonlocal: 1661. or *note global: 6bb.  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: 263c.

プログラムテキスト中に名前が出現するたびに、その名前が使われている最も内
側の関数ブロック中で作成された '束縛 (binding)' を使って名前の参照が行わ
れます。


File: python.info,  Node: 名前解決,  Next: Annotation scopes,  Prev: 名前の束縛,  Up: 名前づけと束縛 naming and binding

4.4.2.2 名前解決
................

スコープ ('scope') は、ブロック内の名前の可視性を決めます。 ローカル変数
があるブロック内で定義されている場合、変数のスコープはそのブロックを含み
ます。 関数ブロック内で名前の定義を行った場合、その中のブロックが名前に
別の束縛を行わない限り、定義ブロック内の全てのブロックを含むようにスコー
プが拡張されます。

ある名前がコードブロック内で使われると、その名前を最も近傍から囲うような
スコープ (最内スコープ: nearest enclosing scope) を使って束縛の解決を行
います。こうしたスコープからなる、あるコードブロック内で参照できるスコー
プ全ての集合は、ブロックの環境('environment')と呼ばれます。

名前が全く見付からなかったときは、 *note NameError: 66c. 例外が送出され
ます。 現在のスコープが関数のもので、名前が使われる場所でローカル変数が
まだ値に束縛されていない場合、 *note UnboundLocalError: 18ee. 例外が送出
されます。 ‘UnboundLocalError’ は ‘NameError’ の子クラスです。

ある名前がコードブロック内のどこかで束縛操作されていたら、そのブロック内
で使われるその名前はすべて、現在のブロックへの参照として扱われます。この
ため、ある名前がそのブロック内で束縛される前に使われるとエラーにつながり
ます。この規則は敏感です。Python には宣言がなく、コードブロックのどこで
も名前束縛操作ができます。あるコードブロックにおけるローカル変数は、ブロ
ックのテキスト全体から名前束縛操作を走査することで決定されます。例は
*note UnboundLocalError についての FAQ 項目: 263f. を参照してください。

If the *note global: 6bb. 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: 6bb. 文は、同じブロックの束縛操作と同じスコープを持ちます
。ある自由変数の最内スコープに global 文がある場合、その自由変数はグロー
バル変数とみなされます。

The *note nonlocal: 1661. statement causes corresponding names to refer
to previously bound variables in the nearest enclosing function scope.
*note SyntaxError: 189. is raised at compile time if the given name does
not exist in any enclosing function scope.  *note Type parameters: 7ab.
cannot be rebound with the ‘nonlocal’ statement.

あるモジュールの名前空間は、そのモジュールが最初に import された時に自動
的に作成されます。スクリプトの主モジュール (main module) は常に *note
__main__: 1. と呼ばれます。

Class definition blocks and arguments to *note exec(): 190. and *note
eval(): 18f. 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: 6ba, 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: 410, *note type parameter lists: 7ab. and *note type:
860. 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: 2225.

   * *note Variable annotations: 110e.

   * Type parameter lists for *note generic type aliases: 876.

   * Type parameter lists for *note generic functions: 874.  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: 2587.  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: 877.).

   * The value of type aliases (*note lazily evaluated: 877.).

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: d97,
     ‘yield from’, *note await: 439, or *note ;=: 2641. expressions.
     (These expressions are allowed in other scopes contained within the
     annotation scope.)

   * Names defined in annotation scopes cannot be rebound with *note
     nonlocal: 1661. 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: 1f38. of objects defined
     within the scope.  Instead, the *note __qualname__: 141c. 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:
860. statement, and the bounds, constraints, and default values of type
variables created through the *note type parameter syntax: 7ab.  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: 6ba,
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: 9df. して、その属性を適切に変更
するべきです。

あるコードブロックの実行に関連する組み込み名前空間は、実際にはコードブロ
ックのグローバル名前空間から名前 ‘__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(): 18f. と *note exec(): 190. 関数は、名前の解決に、現在の環
境の全てを使えるわけではありません。名前は呼び出し側のローカルやグローバ
ル名前空間で解決できます。自由変数は最内名前空間ではなく、グローバル名前
空間から解決されます。 (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: 9e9. 文を使って明示
的に例外を送出することもできます。例外ハンドラ (exception handler) は、
*note try: adb. ...  *note except: 44e. 文で指定することができます。
‘try’ 文の *note finally: 453. 節を使うとクリーンアップコード (cleanup
code) を指定できます。このコードは例外は処理しませんが、先行するコードブ
ロックで例外が起きても起きなくても実行されます。

Python は、エラー処理に "プログラムの終了 (termination)" モデルを用いて
います: 例外ハンドラは、プログラムに何が発生したかを把握することができ、
ハンドラの外側のレベルに処理を継続することはできますが、(問題のあったコ
ード部分を最初から実行しなおすのでない限り) エラーの原因を修復したり、実
行に失敗した操作をやり直すことはできません。

例外が全く処理されないとき、インタプリタはプログラムの実行を終了させるか
、対話メインループに処理を戻します。 どちらの場合も、例外が *note
SystemExit: 10fb. でなければ、スタックのトレースバックを出力します。

例外は、クラスインスタンスによって識別されます。 *note except: 44e. 節は
インスタンスのクラスにもとづいて選択されます: これはインスタンスのクラス
か、その *note 非仮想基底クラス: 1574. を参照します。このインスタンスは
ハンドラによって受け取られ、例外条件に関する追加情報を伝えることができま
す。

     注釈: 例外のメッセージは、Python API 仕様には含まれていません。メッ
     セージの内容は、ある Python のバージョンと次のバージョンの間で警告
     なしに変更される可能性があるので、複数バージョンのインタプリタで動
     作するようなコードは、例外メッセージの内容に依存させるべきではあり
     ません。

*note try: adb. 文については、 *note try 文: adb. 節、 *note raise: 9e9.
文については *note raise 文: 9e9. 節も参照してください。


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: f6. 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: 19da.  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: 19da.

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: f6. 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: f6. module (on platforms and Python implementations
that support threads).  Additional processes can be created using the
*note os: a5, *note subprocess: df, 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: 1c06. にある Python コードから他のモジュールを
*note インポート: 2650. することで、そこにあるコードへアクセスできるよう
になります。 *note import: 9df. 文はインポート機構を動かす最も一般的な方
法ですが、それが唯一の方法ではありません。 *note
importlib.import_module(): 92c. や組み込みの *note __import__(): caa. と
いった関数を使っても、インポート機構を動かすことができます。

*note import: 9df. 文は 2 つの処理を連続して行っています; ある名前のモジ
ュールを探し、その検索結果をローカルスコープの名前に束縛します。
‘import’ 文の検索処理は、適切な引数で *note __import__(): caa. 関数を呼
び出すこととして定義されています。 ‘__import__()’ の戻り値は ‘import’ 文
の名前束縛処理の実行で使われます。名前束縛処理の厳密な詳細は ‘import’ 文
を参照してください。

*note __import__(): caa. を直接呼び出すとモジュールの検索のみが行われ、
見つかった場合、モジュールの作成処理が行われます。親パッケージのインポー
トや (*note sys.modules: 19da. を含む) 様々なキャッシュの更新などの副作
用は起きるかもしれませんが、 *note import: 9df. 文のみが名前束縛処理を行
います。

*note import: 9df. 文が実行されるときには、標準の組み込み関数 *note
__import__(): caa. が呼ばれます。インポートシステムを呼び出すその他の
(*note importlib.import_module(): 92c. 関数のような) メカニズムは、
‘__import__()’ の呼び出しをバイパスして独自のインポート・セマンティクス
を実装している可能性があります。

モジュールが初めてインポートされるとき、 Python はそのモジュールを検索し
、見付かった場合、モジュールオブジェクトを作成し、初期化します (1) 。そ
の名前のモジュールが見付からなかった場合、 *note ModuleNotFoundError:
1c9. が送出されます。 Python には、インポート機構が実行されたときに名前
からモジュールを検索する様々な戦略が実装されています。これらの戦略は、こ
れ以降の節で解説される様々なフックを使って、修正したり拡張したりできます
。

バージョン 3.3 で変更: インポートシステムが PEP 302(2) の第 2 フェーズの
完全な実装へ更新されました。もはや暗黙的なインポート機構はありません - イ
ンポート機構全体は *note sys.meta_path: 10e7. を通して公開されています。
加えて、ネイティブの名前空間パッケージのサポートは実装されています ( PEP
420(3) を参照) 。

* Menu:

* importlib: importlib<10>.
* パッケージ: パッケージ<2>.
* 検索::
* ロード::
* パスベース・ファインダー::
* 標準のインポートシステムを置き換える::
* Package Relative Imports::
* __main__ に対する特別な考慮::
* 参考資料::

   ---------- Footnotes ----------

   (1) *note types.ModuleType: 11cb. を参照してください。

   (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: 7a. モジュールはインポート機構とやり取りするための便利
な API を提供します。例えば *note importlib.import_module(): 92c. は、イ
ンポート機構を実行するための組み込みの *note __import__(): caa. よりもシ
ンプルで推奨される API を提供します。より詳細なことは ‘importlib’ ライブ
ラリのドキュメントを参照してください。


File: python.info,  Node: パッケージ<2>,  Next: 検索,  Prev: importlib<10>,  Up: インポートシステム

4.5.2 パッケージ
----------------

Python にはモジュールオブジェクトの種類は 1 種類しかなく、 Python 、 C 、
それ以外のもののどれで実装されているかに関係なく、すべてのモジュールはこ
の種類になります。モジュールの組織化を助け、名前階層を提供するために、
Python には *note パッケージ: 4c8. という概念があります。

パッケージはファイルシステムのディレクトリ、モジュールはディレクトリにあ
るファイルと考えることができますが、パッケージやモジュールはファイルシス
テムから生まれる必要はないので、この比喩を額面通りに受け取ってはいけませ
ん。この文書の目的のために、ディレクトリとファイルという便利な比喩を使う
ことにします。ファイルシステムのディレクトリのように、パッケージは階層構
造を成し、通常のモジュールだけでなく、サブパッケージを含むこともあります
。

すべてのパッケージはモジュールですが、すべてのモジュールがパッケージとは
限らないことを心に留めておくのが重要です。もしくは他の言い方をすると、パ
ッケージは単なる特別な種類のモジュールであると言えます。特に、‘__path__’
属性を持つ任意のモジュールはパッケージと見なされます。

すべてのモジュールは名前を持ちます。Python の属性アクセスの文法と同様に
、サブパッケージの名前は親パッケージ名とドット記号で区切られます。したが
って、*note email: 3e. という名前のパッケージや、それが含む *note
email.mime: 48. という名前のサブパッケージ、さらにそれに含まれる *note
email.mime.text: 50. と言う名前のモジュールを考えることができます。

* Menu:

* 通常のパッケージ::
* 名前空間パッケージ::


File: python.info,  Node: 通常のパッケージ,  Next: 名前空間パッケージ,  Up: パッケージ<2>

4.5.2.1 通常のパッケージ
........................

Python では、 *note 通常のパッケージ: 2654. と *note 名前空間パッケージ:
535. の 2 種類のパッケージが定義されています。通常のパッケージは Python
3.2 以前から存在する伝統的なパッケージです。典型的な通常のパッケージは
‘__init__.py’ ファイルを含むディレクトリとして実装されます。通常のパッケ
ージがインポートされたとき、この ‘__init__.py’ ファイルが暗黙的に実行さ
れ、それで定義しているオブジェクトがパッケージ名前空間にある名前に束縛さ
れます。 ‘__init__.py’ ファイルは、他のモジュールに書ける Python コード
と同じものを含むことができ、モジュールがインポートされたときに Python は
モジュールに属性を追加したりします。

例えば、以下のようなファイルシステム配置は、3 つのサブパッケージを持つ最
上位の ‘parent’ パッケージを定義します:

     parent/
         __init__.py
         one/
             __init__.py
         two/
             __init__.py
         three/
             __init__.py

‘parent.one’ をインポートすると暗黙的に ‘parent/__init__.py’ と
‘parent/one/__init__.py’ が実行されます。その後に ‘parent.two’ もしくは
‘parent.three’ をインポートすると、それぞれ ‘parent/two/__init__.py’ や
‘parent/three/__init__.py’ が実行されます。


File: python.info,  Node: 名前空間パッケージ,  Prev: 通常のパッケージ,  Up: パッケージ<2>

4.5.2.2 名前空間パッケージ
..........................

名前空間パッケージは様々な *note ポーション: 2657. を寄せ集めたもので、
それぞれのポーションはサブパッケージを親パッケージに提供します。ポーショ
ンはファイルシステムの別々の場所にあることもあります。ポーションは、 zip
ファイルの中やネットワーク上や、それ以外のインポート時に Python が探すど
こかの場所で見つかることもあります。名前空間パッケージはファイルシステム
上のオブジェクトに対応することもあるし、そうでないこともあります; それら
は実際の実体のない仮想モジュールです。

名前空間パッケージは、 ‘__path__’ 属性に普通のリストは使いません。その代
わりに独自の iterable 型を使っていて、ポーションの親パッケージのパス (も
しくは最上位パッケージのための *note sys.path: 19f.) が変わった場合、そ
のパッケージでの次のインポートの際に、新たに自動でパッケージポーションを
検索します。

名前空間パッケージには ‘parent/__init__.py’ ファイルはありません。それど
ころか、異なるポーションがそれぞれ提供する複数の ‘parent’ ディレクトリが
インポート検索の際に見つかることもあります。したがって ‘parent/one’ は物
理的に ‘parent/two’ の隣りにあるとは限りません。その場合、そのパッケージ
かサブパッケージのうち 1 つがインポートされたとき、Python は最上位の
‘parent’ パッケージのための名前空間パッケージを作成します。

名前空間パッケージの仕様については PEP 420(1) も参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0420/


File: python.info,  Node: 検索,  Next: ロード,  Prev: パッケージ<2>,  Up: インポートシステム

4.5.3 検索
----------

検索を始めるためには、 Python はインポートされるモジュール (もしくはパッ
ケージですが、ここでの議論の目的においてはささいな違いです) の *note
完全修飾: 1f38. 名を必要とします。この名前は、 *note import: 9df. 文の様
々な引数や *note importlib.import_module(): 92c. および *note
__import__(): caa. 関数のパラメータから得られます。

この名前はインポート検索の様々なフェーズで使われ、これは例えば
‘foo.bar.baz’ のようなドットで区切られたサブモジュールへのパスだったりし
ます。この場合、 Python は最初に ‘foo’ を、次に ‘foo.bar’ 、そして最後に
‘foo.bar.baz’ をインポートしようとします。中間のいずれかのインポートに失
敗した場合は、 *note ModuleNotFoundError: 1c9. が送出されます。

* Menu:

* モジュールキャッシュ::
* ファインダーとローダー::
* インポートフック::
* メタパス::


File: python.info,  Node: モジュールキャッシュ,  Next: ファインダーとローダー,  Up: 検索

4.5.3.1 モジュールキャッシュ
............................

インポート検索で最初に調べる場所は *note sys.modules: 19da. です。このマ
ッピングは、中間のパスを含む、これまでにインポートされたすべてのモジュー
ルのキャッシュを提供します。なので ‘foo.bar.baz’ がインポート済みの場合
、 ‘sys.modules’ は ‘foo’ 、 ‘foo.bar’ 、 ‘foo.bar.baz’ のエントリーを含
みます。それぞれのキーはその値として対応するモジュールオブジェクトを持ち
ます。

インポートではモジュール名は *note sys.modules: 19da. から探され、存在し
た場合は、対応する値がインポートされるべきモジュールであり、この処理は完
了します。しかし値が ‘None’ だった場合、 *note ModuleNotFoundError: 1c9.
が送出されます。モジュール名が見付からなかった場合は、 Python はモジュー
ルの検索を続けます。

*note sys.modules: 19da. は書き込み可能です。キーの削除は対応するモジュ
ールを破壊しない (他のモジュールがそのモジュールへの参照を持っている) か
もしれませんが、指定されたモジュールのキャッシュされたエントリーを無効に
し、それが次にインポートされたとき Python にそのモジュールを改めて検索さ
せることになります。キーを ‘None’ に対応付けることもできますが、次にその
モジュールがインポートされるときに *note ModuleNotFoundError: 1c9. とな
ってしまいます。

たとえモジュールオブジェクトへの参照を保持しておいて、 *note
sys.modules: 19da. にキャッシュされたエントリーを無効にし、その指定した
モジュールを再インポートしたとしても、 2 つのモジュールオブジェクトは同
じでは 'ない' ことに注意してください。それとは対照的に、 *note
importlib.reload(): 92d. は '同じ' モジュールオブジェクトを再利用し、モ
ジュールのコードを再実行することで単にモジュールの内容を再初期化するだけ
です。


File: python.info,  Node: ファインダーとローダー,  Next: インポートフック,  Prev: モジュールキャッシュ,  Up: 検索

4.5.3.2 ファインダーとローダー
..............................

*note sys.modules: 19da. に指定されたモジュールが見つからなかった場合は
、 Python のインポートプロトコルが起動され、モジュールを見つけロードしま
す。このプロトコルは 2 つの概念的なオブジェクト、 *note ファインダー:
265c. と *note ローダー: 1c4f. から成ります。ファインダーの仕事は、知っ
ている戦略を使って指定されたモジュールを見つけられるかどうか判断すること
です。両方のインターフェースを実装しているオブジェクトは *note
インポーター: 265d. と呼ばれます - インポーターは要求されたモジュールが
ロードできると分かったとき、自分自身を返します。

Python にはデフォルトのファインダーとインポーターがいくつかあります。 1
つ目のものは組み込みモジュールの見つけ方を知っていて、 2 つ目のものは凍
結されたモジュール (訳注: freeze ツールで処理されたモジュールのこと。
*note プログラミング FAQ: 265e. の「どうしたら Python スクリプトからスタ
ンドアロンバイナリを作れますか？」の項目を参照) の見つけ方を知っています
。 3 つ目のものは *note インポートパス: 265f. からモジュールを探します。
インポートパス はファイルシステムのパスや zip ファイルの位置を示すリスト
です。このリストは、 URL で特定できるもののような、位置を示すことのでき
る任意のリソースの検索にまで拡張することもできます。

インポート機構は拡張可能なので、モジュール検索の範囲とスコープを拡張する
ために新しいファインダーを付け加えることができます。

ファインダーは実際にはモジュールをロードしません。指定されたモジュールが
見つかった場合、ファインダーは 'module spec' (モジュール仕様)、すなわち
モジュールのインポート関連の情報をカプセル化したものを返します。モジュー
ルのロード時にインポート機構はそれを利用します。

次の節では、インポート機構を拡張するための新しいファインダーやローダーの
作成と登録を含め、ファインダーとローダーのプロトコルについてより詳しく解
説します。

バージョン 3.4 で変更: Python の以前のバージョンでは、ファインダーは直接
*note ローダー: 1c4f. を返していましたが、現在はローダーを '含む' モジュ
ール仕様を返します。ローダーはインポート中はまだ使われていますが、責任は
減りました。


File: python.info,  Node: インポートフック,  Next: メタパス,  Prev: ファインダーとローダー,  Up: 検索

4.5.3.3 インポートフック
........................

インポート機構は拡張可能なように設計されています; その主となる仕組みは
'インポートフック' です。インポートフックには 2 種類あります: 'メタフッ
ク' と 'インポートパスフック' です。

メタフックはインポート処理の最初、 *note sys.modules: 19da. キャッシュの
検索以外のインポート処理より前に呼び出されます。これにより、 *note
sys.path: 19f. の処理や凍結されたモジュールや組み込みのモジュールでさえ
も、メタフックで上書きすることができます。メタフックは以下で解説するよう
に、 *note sys.meta_path: 10e7. に新しいファインダーオブジェクトを追加す
ることで登録されます。

インポートパスフックは、 *note sys.path: 19f. (もしくは
‘package.__path__’) の処理の一部として、対応するパス要素を取り扱うところ
で呼び出されます。インポートパスフックは以下で解説するように、新しい呼び
出し可能オブジェクトを *note sys.path_hooks: 13d1. に追加することで登録
されます。


File: python.info,  Node: メタパス,  Prev: インポートフック,  Up: 検索

4.5.3.4 メタパス
................

When the named module is not found in *note sys.modules: 19da, Python
next searches *note sys.meta_path: 10e7, 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(): c43. 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: 10e7. に対する処理が spec を
返さずにリストの末尾に到達してしまった場合は、 *note
ModuleNotFoundError: 1c9. を送出します。その他の送出された例外はそのまま
呼び出し元に伝播され、インポート処理を異常終了させます。

The *note find_spec(): c43. 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: 1c9. 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: 10e7. は 3 つのパスファインダ
ーを持っています。組み込みモジュールのインポートの方法を知っているもの、
凍結されたモジュールのインポートの方法を知っているもの、 *note
インポートパス: 265f. からのモジュールのインポートの方法を知っているもの
(つまり *note パスベース・ファインダー: 2662.) があります。

バージョン 3.4 で変更: The *note find_spec(): c43. 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: 90c.

バージョン 3.12 で変更: ‘find_module()’ has been removed.  Use *note
find_spec(): c43. 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

     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: 19da. の中に与えられた名前を持つ既存のモジュール
     オブジェクトがあるなら、 import は既にそれを返しているでしょう。

   * モジュールは、ローダーがモジュールコードを実行する前に *note
     sys.modules: 19da. に存在しています。 モジュールコードが (直接的ま
     たは間接的に) 自分自身をインポートする可能性があるので、これは重要
     です; モジュールを ‘sys.modules’ に追加することで、最悪のケースでは
     無限の再帰が、そして最良のケースでは複数回のロードが、前もって防止
     されます。

   * ロード処理に失敗した場合、その失敗したモジュールは - そして、そのモ
     ジュールだけが - *note sys.modules: 19da. から取り除かれます。
     ‘sys.modules’ キャッシュに既に含まれていたすべてのモジュールと、副
     作用としてロードに成功したすべてのモジュールは、常にキャッシュに残
     されます。これはリロードとは対照的で、リロードの場合は失敗したモジ
     ュールも ‘sys.modules’ に残されます。

   * *note 後のセクション: 2570. で要約されるように、モジュールが作られ
     てから実行されるまでの間にインポート機構はインポート関連のモジュー
     ル属性を設定します (上記擬似コード例の "_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
‘importlib.abc.Loader.load_module’ method.

バージョン 3.15 で変更: The ‘load_module’ method is no longer used.

* Menu:

* ローダー::
* サブモジュール::
* Module specs::
* __path__ attributes on modules::
* モジュールの repr::
* キャッシュされたバイトコードの無効化::

   ---------- Footnotes ----------

   (1) importlib の実装は、戻り値を直接使うことは避けています。その代わ
りに、モジュール名を調べて *note sys.modules: 19da. からモジュールオブジ
ェクトを得ます。こうすることの間接的な効果は、インポートされたモジュール
が ‘sys.modules’ にいる自分自身を置き換えることがあるということです。こ
れは実装依存の動作であり、他の Python 実装では保証されていない動作です。


File: python.info,  Node: ローダー,  Next: サブモジュール,  Up: ロード

4.5.4.1 ローダー
................

モジュールローダーは、ロードの重要な機能であるモジュール実行機能を提供し
ます。インポート機構は、実行しようとするモジュールオブジェクトを単一の引
数として *note importlib.abc.Loader.exec_module(): c44. メソッドを呼び出
します。 ‘importlib.abc.Loader.exec_module()’ から返された任意の値は無視
されます。

ローダーは以下の仕様を満たしていなければいけません:

   * モジュールが (組み込みモジュールや動的に読み込まれる拡張モジュール
     ではなくて) Python モジュールだった場合、ローダーはモジュールのグロ
     ーバル名前空間 (‘module.__dict__’) で、モジュールのコードを実行すべ
     きです。

   * *note exec_module(): c44. の呼び出し中に *note ImportError: 1c8. 以
     外の例外が送出され、伝播されてきたとしても、モジュールをロードでき
     ない場合は ‘ImportError’ を送出すべきです。

多くの場合、ファインダーとローダーは同じオブジェクトで構いません; そのよ
うな場合では *note find_spec(): c43. メソッドは単に ‘self’ (訳注: オブジ
ェクト自身) を返すだけです。

モジュールローダーは、 *note create_module(): 1073. メソッドを実装するこ
とでロード中にモジュールオブジェクトを作成することを選択できます。このメ
ソッドは、モジュール仕様を引数に取って、ロード中に使う新しいモジュールオ
ブジェクトを返します。 ‘create_module()’ はモジュールオブジェクトに属性
を設定する必要はありません。もしこのメソッドが ‘None’ を返すなら、インポ
ート機構は新しいモジュールを自身で作成します。

Added in version 3.4: ローダーの *note create_module(): 1073. メソッド。

バージョン 3.4 で変更: The ‘importlib.abc.Loader.load_module’ method was
replaced by *note exec_module(): c44. 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: 19da. に与えられた名前のモジュールが存在している
     場合、ローダーはその既存のモジュールを使わなければいけません。 (そ
     うしないと *note importlib.reload(): 92d. は正しく動かないでしょう
     。) 指定されたモジュールが ‘sys.modules’ に存在しない場合、ローダー
     は新しいモジュールオブジェクトを作成し、 ‘sys.modules’ に追加しなけ
     ればいけません。

   * 無限の再帰または複数回のロードを防止するために、ローダーがモジュー
     ルコードを実行する前にモジュールは *note sys.modules: 19da. に存在
     しなければなりません ('must')。

   * ロード処理に失敗した場合、ローダーは *note sys.modules: 19da. に追
     加したモジュールを取り除かなければいけませんが、それはロードに失敗
     したモジュール 'のみ' を、そのモジュールがローダー自身に明示的にロ
     ードされた場合に限り、除去しなければなりません。

バージョン 3.5 で変更: ‘exec_module()’ が定義されていて
‘create_module()’ が定義されていない場合、 *note DeprecationWarning:
2d4. が送出されるようになりました。

バージョン 3.6 で変更: ‘exec_module()’ が定義されていて
‘create_module()’ が定義されていない場合、 *note ImportError: 1c8. が送
出されるようになりました。

バージョン 3.10 で変更: ‘load_module()’ を使用すると *note
ImportWarning: 90c. が発生します。


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__: 2573.  Setting
‘__spec__’ appropriately applies equally to *note modules initialized
during interpreter startup: 2667.  The one exception is ‘__main__’,
where ‘__spec__’ is *note set to None in some cases: 2668.

See *note ModuleSpec: 247c. 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__: 2261. attribute should be a (possibly empty) *note
sequence: 904. 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: 4c8.

A package's *note __path__: 2261. attribute is used during imports of
its subpackages.  Within the import machinery, it functions much the
same as *note sys.path: 19f, 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: 19f. also apply to a package's
‘__path__’.  *note sys.path_hooks: 13d1. (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__: 2261. 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: 2330. 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 パスベース・ファインダー:
2662. (*note PathFinder: 13d0.) と呼ばれ、 *note パスエントリ: 266d. の
リストである *note インポートパス: 265f. を検索します。それぞれのパスエ
ントリは、モジュールを探す場所を指しています。

パスベース・ファインダー自体は何かのインポート方法を知っているわけではあ
りません。その代わりに、個々のパスエントリを走査し、それぞれに特定の種類
のパスの扱いを知っているパスエントリ・ファインダーを関連付けます。

デフォルトのパスエントリ・ファインダーは、ファイルシステム上のモジュール
を見つけるためのすべてのセマンティクスを実装しています。それは Python ソ
ースコード (‘.py’ ファイル) 、Python バイトコード (‘.pyc’ ファイル) 、共
有ライブラリ (例えば ‘.so’ ファイル) などの特別なファイルタイプを処理し
ます。標準ライブラリの *note zipimport: 13b. モジュールによってサポート
される場合は、デフォルトのパスエントリ・ファインダーは (共有ライブラリ以
外の) すべてのファイルタイプの zip ファイルからのロードも扱います。

パスエントリはファイルシステム上の場所に限定される必要はありません。URL
やデータベースクエリやその他文字列で指定できる場所を参照することも可能で
す。

パスベース・ファインダーにはフックやプロトコルを追加することができ、それ
によって検索可能なパスエントリの種類を拡張し、カスタマイズすることができ
ます。例えば、ネットワーク上の URL をパスエントリとしてサポートしたい場
合、 web 上のモジュールを見つけるために HTTP の取り扱い方を実装したフッ
クを書くことができます。この (呼び出し可能オブジェクトである) フックは、
下で解説するプロトコルをサポートする *note パスエントリ・ファインダー:
1428. を返します。このプロトコルは web からモジュールのローダーを取得す
るのに使われます。

警告の言葉: この節と前の節の両方で 'ファインダー' という言葉が、 *note
メタパス・ファインダー: 1427. と *note パスエントリ・ファインダー: 1428.
という用語で区別されて使われています。これら 2 種類のファインダーは非常
に似ており、似たプロトコルをサポートし、インポート処理で同じように機能し
ますが、微妙に異なっているのを心に留めておくのは重要です。特に、メタパス
・ファインダーはインポート処理の開始時、 *note sys.meta_path: 10e7. の走
査が動くときに動作します。

それとは対照的に、パスエントリ・ファインダーはある意味でパスベース・ファ
インダーの実装詳細であり、実際 *note sys.meta_path: 10e7. からパスベース
・ファインダーが取り除かれた場合、パスエントリ・ファインダーの実装は何も
実行されないでしょう。

* Menu:

* パスエントリ・ファインダー::
* パスエントリ・ファインダー・プロトコル::


File: python.info,  Node: パスエントリ・ファインダー,  Next: パスエントリ・ファインダー・プロトコル,  Up: パスベース・ファインダー

4.5.5.1 パスエントリ・ファインダー
..................................

*note パスベース・ファインダー: 2662. には、文字列 *note パスエントリ:
266d. で指定された場所の Python モジュールや Python パッケージを見つけ、
ロードする責任があります。ほとんどのパスエントリはファイルシステム上の場
所を指定していますが、そこに制限される必要はありません。

メタパス・ファインダーとして、 *note パスベース・ファインダー: 2662. に
は前に解説した *note find_spec(): c43. プロトコルが実装されていますが、
これに加えて *note インポートパス: 265f. からモジュールを見つけ、ロード
する方法をカスタマイズするために使えるフックを提供しています。

*note パスベース・ファインダー: 2662. は *note sys.path: 19f. 、 *note
sys.path_hooks: 13d1. 、 *note sys.path_importer_cache: 9e0. という 3 つ
の変数を使います。さらにパッケージオブジェクトの ‘__path__’ 属性も使いま
す。これらによって、インポート処理をカスタマイズする方法が提供されます。

*note sys.path: 19f. contains a list of strings providing search
locations for modules and packages.  It is initialized from the *note
PYTHONPATH: 13cb. 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: cf. 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 パスベース・ファインダー: 2662. は *note メタパス・ファインダー:
1427. なので、インポート機構は、前で解説したパスベース・ファインダーの
*note find_spec(): 13bf. メソッドを呼び出すことで *note インポートパス:
265f. の検索を始めます。 ‘path’ 引数が ‘find_spec()’ に渡されたときは、
それは走査するパス文字列のリスト - 典型的にはそのパッケージの中でインポ
ートしているパッケージの ‘__path__’ 属性になります。 ‘path’ 引数が
‘None’ だった場合、それは最上位のインポートであることを示していて、
*note sys.path: 19f. が使われます。

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:
1428. (*note PathEntryFinder: c49.) 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: 9e0. (despite the name, this cache
actually stores finder objects rather than being limited to *note
importer: 265d. objects).  In this way, the expensive search for a
particular *note path entry: 266d. 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: 13d1. の中の呼び出し可能オブジェクトを全て辿ります。 こ
のリストのそれぞれの *note path entry フック: 266f. は、検索する path
entry という引数 1 つを渡して呼び出されます。 その呼び出し可能オブジェク
トは path entry を扱える *note path entry finder: 1428. を返すか、 *note
ImportError: 1c8. を送出します。 ‘ImportError’ は、フックが *note path
entry: 266d. のための path entry finder を探せないことを報せるために
path based finder が使います。 この例外は処理されず、 *note import path:
265f. を辿っていく処理が続けられます。 フックは引数として文字列またはバ
イト列オブジェクトを期待します; バイト列オブジェクトのエンコーディングは
フックに任されていて (例えば、ファイルシステムのエンコーディングの UTF-8
やそれ以外などです) 、フックが引数をデコードできなかった場合は
‘ImportError’ を送出すべきです。

*note sys.path_hooks: 13d1. を辿る処理が *note
パスエントリ・ファインダー: 1428. を何も返さずに終わった場合、パスベース
・ファインダーの *note find_spec(): 13bf. メソッドは、 *note
sys.path_importer_cache: 9e0. に (このパスエントリに対するファインダーが
存在しないことを示すために) ‘None’ を保存し、 *note
メタパス・ファインダー: 1427. はモジュールが見つからなかったことを伝える
ために ‘None’ を返します。

*note sys.path_hooks: 13d1. 上の *note パスエントリフック: 266f. 呼び出
し可能オブジェクトの戻り値のいずれかが *note パスエントリ・ファインダー:
1428. 'であった' 場合、後で出てくるモジュール仕様を探すためのプロトコル
が使われ、それがモジュールをロードするために使われます。

The current working directory - denoted by an empty string - is handled
slightly differently from other entries on *note sys.path: 19f.  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: 9e0.
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(): 13bf. 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(): c46. メソッドを実装しなければいけません。

*note find_spec(): c46. は 2 つの引数を取ります。インポートしようとして
いるモジュールの完全修飾名と、 (オプションの) 対象モジュールです。
‘find_spec()’ はモジュールに対応する完全に初期化 (populated) された仕様
を返します。この仕様は (1つの例外を除いて) 常に "loader" セットを持って
います。

To indicate to the import machinery that the spec represents a namespace
*note portion: 2657, the path entry finder sets
‘submodule_search_locations’ to a list containing the portion.

バージョン 3.4 で変更: *note find_spec(): c46. 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: 2657.

他のインポート機構の実装に対する後方互換性のために、多くのパスエントリ・
ファインダーは、メタパス・ファインダーがサポートするのと同じ伝統的な
‘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: 90c.

バージョン 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: 10e7. のデフォルトの内容を削除し、全部をカスタムのメタパ
スフックで置き換えるものです。

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__(): caa. function may be
sufficient.

(標準のインポートシステム全体を停止するのではなく) すでにメタパスにいる
フックからあるモジュールのインポートを選択的に防ぐためには、 *note
find_spec(): c43. から ‘None’ を返す代わりに、直接 *note
ModuleNotFoundError: 1c9. を送出するだけで十分です。 ‘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 他の場所: 2667. で言及されているように、
‘__main__’ モジュールは *note sys: e2. や *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: 4d1. オプションを付けて実行された場合には、
‘__spec__’ は対応するモジュールまたはパッケージのモジュール仕様に設定さ
れます。また、ディレクトリや zip ファイル、または他の *note sys.path:
19f. エントリを実行する処理の一部として ‘__main__’ モジュールがロードさ
れる場合にも ‘__spec__’ が生成 (populate) されます。

*note それ以外のケース: 2329. では、 ‘__main__.__spec__’ は ‘None’ に設
定されます。これは、 *note __main__: 1. を生成 (populate) するために使わ
れたコードがインポート可能なモジュールと直接一致していないためです:

   - 対話プロンプト

   - *note -c: 44c. オプション

   - stdin から起動された場合

   - ソースファイルやバイトコードファイルから直接起動された場合

最後のケースでは、たとえ技術的にはファイルがモジュールとして直接インポー
トできた 'としても' ‘__main__.__spec__’ は常に ‘None’ になることに注意し
てください。もし *note __main__: 1. において有効なモジュールメタデータが
必要なら *note -m: 4d1. スイッチを使ってください。

‘__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: 10e7. の仕様は PEP 302(2) で、その後継
となる拡張が PEP 420(3) です。

PEP 420(4) introduced *note namespace packages: 535. 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: 2493. 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: 267e. 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: 24af. 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: 24d0.
        | *note literal: 2682.
        | *note enclosure: 2683.
     enclosure:
        | *note parenth_form: 2684.
        | *note list_display: 2685.
        | *note dict_display: 2686.
        | *note set_display: 2687.
        | *note generator_expression: 2688.
        | *note yield_atom: 2689.

* Menu:

* Built-in constants::
* 識別子 (identifier、または名前 (name)): 識別子 identifier、または名前 name.
* リテラル: リテラル<2>.
* 丸括弧形式 (parenthesized form): 丸括弧形式 parenthesized form.
* リスト、集合、辞書の表示::
* リスト表示::
* 集合表示::
* 辞書表示::
* ジェネレータ式: ジェネレータ式<2>.
* Yield 式::


File: python.info,  Node: Built-in constants,  Next: 識別子 identifier、または名前 name,  Up: アトム、原子的要素 atom

4.6.2.1 Built-in constants
..........................

The keywords ‘True’, ‘False’, and ‘None’ name *note built-in constants:
268c.  The token ‘...’ names the *note Ellipsis: 2537. 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:
     2498.  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): 24af. 節を、名前付けや
束縛については *note 名前づけと束縛 (naming and binding): 2555. 節を参照
してください。

名前があるオブジェクトに束縛されている場合、名前 atom を評価するとそのオ
ブジェクトになります。名前が束縛されていない場合、 atom を評価しようとす
ると *note NameError: 66c. 例外を送出します。

* 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: 1691.

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__: 141d. attribute of nested functions, classes,
     and type aliases is however not mangled.

   - The name of imported modules, e.g., ‘__spam’ in ‘import __spam’.
     If the module is part of a package (i.e., its name contains a dot),
     the name is 'not' mangled, e.g., the ‘__foo’ in ‘import __foo.bar’
     is not mangled.

   - The name of an imported member, e.g., ‘__f’ in ‘from spam import
     __f’.

The transformation rule is defined as follows:

   - The class name, with leading underscores removed and a single
     leading underscore inserted, is inserted in front of the
     identifier, e.g., the identifier ‘__spam’ occurring in a class
     named ‘Foo’, ‘_Foo’ or ‘__Foo’ is transformed to ‘_Foo__spam’.

   - If the class name consists only of underscores, the transformation
     is the identity, e.g., the identifier ‘__spam’ occurring in a class
     named ‘_’ or ‘__’ is left as is.


File: python.info,  Node: リテラル<2>,  Next: 丸括弧形式 parenthesized form,  Prev: 識別子 identifier、または名前 name,  Up: アトム、原子的要素 atom

4.6.2.4 リテラル
................

A 'literal' is a textual representation of a value.  Python supports
numeric, string and bytes literals.  *note Format strings: 441. and
*note template strings: 1a70. are treated as string literals.

Numeric literals consist of a single *note NUMBER: 2515. token, which
names an integer, floating-point number, or an imaginary number.  See
the *note 数値リテラル: 24b0. section in Lexical analysis documentation
for details.

String and bytes literals may consist of several tokens.  See section
*note 文字列リテラルの結合 (concatenation): 24ef. for details.

Note that negative and complex numbers, like ‘-3’ or ‘3+4.2j’, are
syntactically not literals, but *note unary: 2691. or *note binary:
2692. arithmetic operations involving the ‘-’ or ‘+’ operator.

Evaluation of a literal yields an object of the given type (*note int:
32e, *note float: 32f, *note complex: 330, *note str: 1ea, *note bytes:
1d2, or *note Template: 41c.) 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: 2693. | *note NUMBER: 2515.

* 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: 451. 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 演算子での同一性テストが頼れますか？: 2695. for
     more information.

*note Template strings: 1a70. are immutable but may reference mutable
objects as *note Interpolation: 41d. 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: 24e0. | *note fstring: 2503.)+ | *note tstring: 2513.+


File: python.info,  Node: 丸括弧形式 parenthesized form,  Next: リスト、集合、辞書の表示,  Prev: リテラル<2>,  Up: アトム、原子的要素 atom

4.6.2.7 丸括弧形式 (parenthesized form)
.......................................

丸括弧形式とは、式リストの一形態で、丸括弧で囲ったものです:

     parenth_form: "(" [*note starred_expression: 2699.] ")"

丸括弧で囲われた式のリストは、個々の式が表現するものになります: リスト内
に少なくとも一つのカンマが入っていた場合、タプルになります; そうでない場
合、式のリストを構成している単一の式自体の値になります。

中身が空の丸括弧のペアは、空のタプルオブジェクトを表します。 タプルは変
更不能なので、リテラルと同じ規則が適用されます (すなわち、空のタプルが二
箇所で使われると、それらは同じオブジェクトになることもあるし、ならないこ
ともあります)。

タプルは丸括弧で作成されるのではなく、カンマによって作成されることに注意
してください。例外は空のタプルで、この場合には丸括弧が '必要です' -- 丸
括弧のつかない "何も記述しない式 (nothing)" を使えるようにしてしまうと、
文法があいまいなものになってしまい、よくあるタイプミスが検出されなくなっ
てしまいます。


File: python.info,  Node: リスト、集合、辞書の表示,  Next: リスト表示,  Prev: 丸括弧形式 parenthesized form,  Up: アトム、原子的要素 atom

4.6.2.8 リスト、集合、辞書の表示
................................

リスト、集合、辞書を構築するために、 Python は "表示 (display)" と呼ばれ
る特別な構文を提供していて、次の二種類ずつがあります:

   * コンテナの内容を明示的に列挙する

   * '内包表記 (comprehension)' と呼ばれる、ループ処理とフィルター処理の
     組み合わせを用いた計算結果

内包表記の共通の構文要素は次の通りです:

     comprehension: *note flexible_expression: 269c. *note comp_for: 269d.
     comp_for:      ["async"] "for" *note target_list: 269e. "in" *note or_test: 269f. [*note comp_iter: 26a0.]
     comp_iter:     *note comp_for: 269d. | *note comp_if: 26a1.
     comp_if:       "if" *note or_test: 269f. [*note comp_iter: 26a0.]

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.  If the expression is starred, the
result will instead be unpacked to produce zero or more elements.

ただし、最も左にある ‘for’ 節のイテラブル式を除いて、内包表記は暗黙的に
ネストされた個別のスコープで実行されます。 この仕組みのおかげで、対象の
リスト内で代入された名前が外側のスコープに "漏れる" ことはありません。

最も左にある ‘for’ 節のイテラブル式は、それを直接囲んでいるスコープでそ
のまま評価され、暗黙的な入れ子のスコープに引数として渡されます。 後に続
く ‘for’ 節と、最も左にある ‘for’ 節のフィルター条件はイテラブル式を直接
囲んでいるスコープでは評価できません。というのは、それらは最も左のイテラ
ブルから得られる値に依存しているかもしれないからです。 例えば次の通りで
す: ‘[x*y for x in range(10) for y in range(x, x+10)]’ 。

内包表記が常に適切な型のコンテナになるのを保証するために、 ‘yield’ 式や
‘yield from’ 式は暗黙的な入れ子のスコープでは禁止されています。

Since Python 3.6, in an *note async def: 9d4. function, an ‘async for’
clause may be used to iterate over a *note asynchronous iterator: 6d3.
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:
439. expressions.

If a comprehension contains ‘async for’ clauses, or if it contains
‘await’ expressions or other asynchronous comprehensions anywhere except
the iterable expression in the leftmost ‘for’ clause, it is called an
'asynchronous comprehension'.  An asynchronous comprehension may suspend
the execution of the coroutine function in which it appears.  See also
PEP 530(1).

Added in version 3.6: 非同期内包表記が導入されました。

バージョン 3.8 で変更: ‘yield’ および ‘yield from’ は暗黙的な入れ子のス
コープでは禁止となりました。

バージョン 3.11 で変更: Asynchronous comprehensions are now allowed
inside comprehensions in asynchronous functions.  Outer comprehensions
implicitly become asynchronous.

バージョン 3.15 で変更: Unpacking with the ‘*’ operator is now allowed
in the expression.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0530/


File: python.info,  Node: リスト表示,  Next: 集合表示,  Prev: リスト、集合、辞書の表示,  Up: アトム、原子的要素 atom

4.6.2.9 リスト表示
..................

リスト表示は、角括弧で囲われた式の系列です。系列は空の系列であってもかま
いません:

     list_display: "[" [*note flexible_expression_list: 26a4. | *note comprehension: 269b.] "]"

リスト表示は、新しいリストオブジェクトを与えます。リストの内容は、式のリ
ストまたはリスト内包表記 (list comprehension) で指定されます。 カンマで
区切られた式のリストが与えられたときは、それらの各要素は左から右へと順に
評価され、その順にリスト内に配置されます。 内包表記が与えられたときは、
内包表記の結果の要素でリストが構成されます。


File: python.info,  Node: 集合表示,  Next: 辞書表示,  Prev: リスト表示,  Up: アトム、原子的要素 atom

4.6.2.10 集合表示
.................

集合表示は波括弧で表され、キーと値を分けるコロンがないことで辞書表現と区
別されます:

     set_display: "{" (*note flexible_expression_list: 26a4. | *note comprehension: 269b.) "}"

集合表示は、新しいミュータブルな集合オブジェクトを与えます。集合の内容は
、式の並びまたは内包表記によって指定されます。 カンマ区切りの式のリスト
が与えられたときは、その要素は左から右へ順に評価され、集合オブジェクトに
加えられます。 内包表記が与えられたときは、内包表記の結果の要素で集合が
構成されます。

空集合は ‘{}’ で構成できません。このリテラルは空の辞書を構成します。


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: 26a8. | *note dict_comprehension: 26a9.] "}"
     dict_item_list:     *note dict_item: 26aa. ("," *note dict_item: 26aa.)* [","]
     dict_comprehension: *note dict_item: 26aa. *note comp_for: 269d.
     dict_item:          *note expression: 431. ":" *note expression: 431. | "**" *note or_expr: 2511.

辞書表示は、新たな辞書オブジェクトを表します。

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: 1579.  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 may take one of two forms:

   - The first form uses 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.

   - The second form uses a single expression prefixed by the ‘**’
     dictionary unpacking operator followed by the usual "for" and "if"
     clauses.  When the comprehension is evaluated, the expression is
     evaluated and then unpacked, inserting zero or more key/value pairs
     into the new dictionary.

Both forms of dictionary comprehension retain the property that if the
same key is specified multiple times, the associated value in the
resulting dictionary will be the last one specified.

Restrictions on the types of the key values are listed earlier in
section *note 標準型の階層: 253e.  (To summarize, the key type should be
*note hashable: 18e, 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) で提案
されているように、キーが値より先に評価されます。

バージョン 3.15 で変更: Unpacking with the ‘**’ operator is now allowed
in dictionary comprehensions.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0448/

   (2) https://peps.python.org/pep-0572/


File: python.info,  Node: ジェネレータ式<2>,  Next: Yield 式,  Prev: 辞書表示,  Up: アトム、原子的要素 atom

4.6.2.12 ジェネレータ式
.......................

ジェネレータ式 (generator expression) とは、丸括弧を使ったコンパクトなジ
ェネレータ表記法です:

     generator_expression: "(" *note flexible_expression: 269c. *note comp_for: 269d. ")"

ジェネレータ式は新たなジェネレータオブジェクトを与えます。この構文は内包
表記とほぼ同じですが、角括弧や波括弧ではなく、丸括弧で囲まれます。

Variables used in the generator expression are evaluated lazily when the
*note __next__(): 22bc. method is called for the generator object (in
the same fashion as normal generators).  However, the iterable
expression in the leftmost ‘for’ clause is immediately evaluated, and
the *note iterator: 6d4. is immediately created for that iterable, so
that an error produced while creating the iterator will be emitted at
the point where the generator expression is defined, rather than at the
point where the first value is retrieved.  Subsequent ‘for’ clauses and
any filter condition in the leftmost ‘for’ clause cannot be evaluated in
the enclosing scope as they may depend on the values obtained from the
leftmost iterable.  For example: ‘(x*y for x in range(10) for y in
range(x, x+10))’.

関数の唯一の引数として渡す場合には、丸括弧を省略できます。詳しくは *note
呼び出し (call): 113a. 節を参照してください。

ジェネレータ式自身の期待される動作を妨げないために、 ‘yield’ 式や ‘yield
from’ 式は暗黙的に定義されたジェネレータでは禁止されています。

ジェネレータ式が ‘async for’ 節あるいは *note await: 439. 式を含んでいる
場合、それは '非同期ジェネレータ式' と呼ばれます。 非同期ジェネレータ式
は、非同期イテレータである新しい非同期ジェネレータオブジェクトを返します
(*note 非同期イテレータ (Asynchronous Iterator): 1134. を参照してくださ
い)。

Added in version 3.6: 非同期ジェネレータ式が導入されました。

バージョン 3.7 で変更: Python 3.7 より前では、非同期ジェネレータ式は
*note async def: 9d4. コルーチンでしか使えませんでした。 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: 2512. ")"
     yield_from:       "yield" "from" *note expression: 431.
     yield_expression: "yield" *note yield_list: 26b0. | *note yield_from: 26af.

yield 式は *note ジェネレータ: 1417. 関数や *note 非同期ジェネレータ:
26b1. 関数を定義するときに使われます。従って、関数定義の本体でのみ使えま
す。 関数の本体で yield 式 を使用するとその関数はジェネレータ関数になり
、 *note async def: 9d4. 関数の本体で使用するとそのコルーチン関数は非同
期ジェネレータ関数になります。 例えば次のようになります:

     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):
26b2. 節に分けて説明されています。

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: 26b0. 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__(): 22bc. is used (typically via either a
*note for: 329. or the *note next(): bb9. builtin) then the result is
*note None: a6a.  Otherwise, if *note send(): 1418. is used, then the
result will be the value passed in to that method.

これまで説明した内容から、ジェネレータ関数はコルーチンにとてもよく似てい
ます。ジェネレータ関数は何度も生成し、1つ以上のエントリポイントを持ち、
その実行は一時停止されます。ジェネレータ関数は yield した後で実行の継続
を制御できないことが唯一の違いです。その制御は常にジェネレータの呼び出し
元へ移されます。

yield 式は *note try: adb. 構造内で使用できます。ジェネレータの (参照カ
ウントがゼロに達するか、ガベージコレクションによる) 完了前に再開されない
場合、ジェネレータ-イテレータの *note close(): 19bf. メソッドが呼ばれ、
*note finally: 453. 節が実行されます。

‘yield from <expr>’ を使用した場合、与えられた式はイテラブルでなければな
りません。そのイテラブルをイテレートすることで生成された値は現在のジェネ
レータのメソッドの呼び出し元へ直接渡されます。*note send(): 1418. で渡さ
れたあらゆる値と *note throw(): 90a. で渡されたあらゆる例外は根底のイテ
レータに適切なメソッドがあれば渡されます。適切なメソッドがない場合、
‘send()’ は *note AttributeError: 1b4. か *note TypeError: 29c. を、
‘throw()’ は渡された例外を即座に送出します。

根底のイテレータの完了時、引き起こされた *note StopIteration: fbe. イン
スタンスの *note value: 262b. 属性はその yield 式の値となります。
‘StopIteration’ を起こす際に明示的にセットされるか、サブイテレータがジェ
ネレータであれば (サブイテレータからかえる値で) 自動的にセットされるかの
どちらかです。

バージョン 3.3 で変更: サブイテレータに制御フローを委譲するために ‘yield
from <expr>’ が追加されました。

yield 式が代入文の単独の右辺式であるとき、括弧は省略できます。

参考
....

PEP 255(1) - 単純なジェネレータ

     Python へのジェネレータと *note yield: d97. 文の導入提案。

PEP 342(2) - 拡張されたジェネレータを用いたコルーチン

     シンプルなコルーチンとして利用できるように、ジェネレータの構文と
     API を拡張する提案。

PEP 380(3) - サブジェネレータへの委譲構文

     サブジェネレータの委譲を簡単にするための、 *note yield_from: 26af.
     構文の導入提案。

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: 15a. 例外を送出する点に注意してください。

 -- メソッド: 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__(): 22bc. method, the current yield
     expression always evaluates to *note None: a6a.  The execution then
     continues to the next yield expression, where the generator is
     suspended again, and the value of the *note yield_list: 26b0. is
     returned to *note __next__(): 22bc.'s caller.  If the generator
     exits without yielding another value, a *note StopIteration: fbe.
     exception is raised.

     このメソッドは通常、例えば *note for: 329. ループや組み込みの *note
     next(): bb9. 関数によって暗黙に呼び出されます。

 -- メソッド: generator.send (value)

     ジェネレータ関数の内部へ値を "送り"、実行を再開します。引数の
     'value' はその時点の yield 式の結果になります。 *note send(): 1418.
     メソッドは次にジェネレータが生成した値を返し、ジェネレータが次の値
     を生成することなく終了すると *note StopIteration: fbe. を送出します
     。 ‘send()’ が呼び出されてジェネレータが開始するときは、値を受け取
     る yield 式が存在しないので、 *note None: a6a. を引数として呼び出さ
     なければなりません。

 -- メソッド: generator.throw (value)

 -- メソッド: generator.throw (type[, value[, traceback]])

     ジェネレータが中断した位置で例外を発生させて、そのジェネレータ関数
     が生成する次の値を返します。ジェネレータが値を生成することなく終了
     すると *note StopIteration: fbe. が発生します。ジェネレータ関数が渡
     された例外を捕捉しない、もしくは違う例外を発生させるなら、その例外
     は呼び出し元へ伝搬されます。

     In typical use, this is called with a single exception instance
     similar to the way the *note raise: 9e9. 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__: 1680. 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: 1780. 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: a6a.  If the generator yields a
     value, a *note RuntimeError: 317. 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;
サブジェネレータへの委譲構文: 13e6. を参照してください。


File: python.info,  Node: 非同期ジェネレータ関数 asynchronous generator function<2>,  Next: 非同期ジェネレータイテレータメソッド,  Prev: 使用例,  Up: Yield 式

4.6.2.16 非同期ジェネレータ関数 (asynchronous generator function)
.................................................................

*note async def: 9d4. を使用して定義された関数やメソッドに yield 式があ
ると、その関数は *note 非同期ジェネレータ: 26b1. 関数として定義されます
。

非同期ジェネレータ関数が呼び出されると、非同期ジェネレータオブジェクトと
呼ばれる非同期イテレータが返されます。 そして、そのオブジェクトはジェネ
レータ関数の実行を制御します。 通常、非同期ジェネレータオブジェクトは、
コルーチン関数内の *note async for: e74. 文で使われ、これはジェネレータ
オブジェクトが *note for: 329. 文で使われる様子に類似します。

Calling one of the asynchronous generator's methods returns an *note
awaitable: 6d5. 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: 26b0. 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__(): 26b6. is used then the result is *note
None: a6a.  Otherwise, if *note asend(): caf. 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: 42f,
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(): cae. method to finalize the generator and ultimately detach it
from the event loop.

非同期ジェネレータ関数では、 *note try: adb. 構造内の任意の場所で yield
式が使用できます。 ただし、非同期ジェネレータが、(参照カウントがゼロに達
するか、ガベージコレクションによる) 終了処理より前に再開されない場合、
‘try’ 構造内の yield 式は失敗となり、実行待ちだった *note finally: 453.
節が実行されます。 このケースでは、非同期ジェネレータが作動しているイベ
ントループやスケジューラの責務は、非同期ジェネレータの *note aclose():
cae. メソッドを呼び出し、残りのコルーチンオブジェクトを実行し、それによ
って実行待ちだった ‘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(): cae. and
executes the coroutine.  This 'finalizer' may be registered by calling
*note sys.set_asyncgen_hooks(): 1bc9.  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/main/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__(): 26b6. method, the current yield
     expression always evaluates to *note None: a6a. in the returned
     awaitable, which when run will continue to the next yield
     expression.  The value of the *note yield_list: 26b0. of the yield
     expression is the value of the *note StopIteration: fbe. exception
     raised by the completing coroutine.  If the asynchronous generator
     exits without yielding another value, the awaitable instead raises
     a *note StopAsyncIteration: 201d. exception, signalling that the
     asynchronous iteration has completed.

     このメソッドは通常、 *note for: 329. ループによって暗黙に呼び出され
     ます。

 -- メソッド: async agen.asend (value)

     Returns an awaitable which when run resumes the execution of the
     asynchronous generator.  As with the *note send(): 1418. 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: fbe, or raises *note
     StopAsyncIteration: 201d. 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: a6a.
     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: fbe. exception.  If the asynchronous
     generator exits without yielding another value, a *note
     StopAsyncIteration: 201d. 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: 1780. 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: fbe. exception.  Any
     further awaitables returned by subsequent calls to the asynchronous
     generator will raise a *note StopAsyncIteration: 201d. exception.
     If the asynchronous generator yields a value, a *note RuntimeError:
     317. 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: 2681. | *note attributeref: 26bc. | *note subscription: 26bd. | *note call: 26be.

* Menu:

* 属性参照::
* Subscriptions and slicings::
* 呼び出し (call): 呼び出し call.


File: python.info,  Node: 属性参照,  Next: Subscriptions and slicings,  Up: プライマリ

4.6.3.1 属性参照
................

属性参照は、プライマリの後ろにピリオドと名前を連ねたものです:

     attributeref: *note primary: 26bb. "." *note identifier: 24d0.

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__(): f94. method or the *note __getattr__(): 8e8. method.
The ‘__getattribute__()’ method is called first and either returns a
value or raises *note AttributeError: 1b4. if the attribute is not
available.

If an *note AttributeError: 1b4. 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: 25e8. - for example, to get a value from a *note
dict: 193.:

     >>> 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: 26ba. - 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: 25f8. (for mappings), *note index: 25f7.
(for sequences), or 'type argument' (for *note generic types: 1dc.).
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__(): 78d. or *note
__class_getitem__(): b26. *note special method: 1e76. with the subscript
as argument.  For more details on which of these methods is called, see
*note __class_getitem__ versus __getitem__: 25e2.

To show how subscription works, we can define a custom object that
implements *note __getitem__(): 78d. 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__(): 78d. documentation for how built-in types
handle subscription.

Subscriptions may also be used as targets in *note assignment: 263b. or
*note deletion: 1d3c. statements.  In these cases, the interpreter will
call the subscripted object's *note __setitem__(): 1685. or *note
__delitem__(): 1686. *note special method: 1e76, respectively, instead
of *note __getitem__(): 78d.

     >>> 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: 2547.  In this form, the
subscript is a *note slice: 26c4.: 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:
1db. object whose *note start: 25b9, *note stop: 25ba. and *note step:
25bb. attributes, respectively, are the results of the expressions
between the colons.  Any missing expression evaluates to *note None:
a6a.  This ‘slice’ object is then passed to the *note __getitem__():
78d. or *note __class_getitem__(): b26. *note special method: 1e76, 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: 1d9. of the results of the expressions or slices, and
passes this tuple to the *note __getitem__(): 78d. or *note
__class_getitem__(): b26. *note special method: 1e76, 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__(): 78d. or *note __class_getitem__(): b26.:

     # 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: 26bb. '[' *note subscript: 26c8. ']'
     subscript:        *note single_subscript: 26c9. | *note tuple_subscript: 26ca.
     single_subscript: *note proper_slice: 26cb. | *note assignment_expression: 2641.
     proper_slice:     [*note expression: 431.] ":" [*note expression: 431.] [ ":" [*note expression: 431.] ]
     tuple_subscript:  ','.(*note single_subscript: 26c9. | *note starred_expression: 2699.)+ [',']

Recall that the ‘|’ operator *note denotes ordered choice: 2493.
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: 26cd.) を
*note arguments: 86d. の系列とともに呼び出します。系列は空の系列であって
もかまいません:

     call:                 *note primary: 26bb. "(" [*note argument_list: 26ce. [","] | *note comprehension: 269b.] ")"
     argument_list:        *note positional_arguments: 26cf. ["," *note starred_and_keywords: 26d0.]
                             ["," *note keywords_arguments: 26d1.]
                           | *note starred_and_keywords: 26d0. ["," *note keywords_arguments: 26d1.]
                           | *note keywords_arguments: 26d1.
     positional_arguments: *note positional_item: 26d2. ("," *note positional_item: 26d2.)*
     positional_item:      *note assignment_expression: 2641. | "*" *note expression: 431.
     starred_and_keywords: ("*" *note expression: 431. | *note keyword_item: 26d3.)
                           ("," "*" *note expression: 431. | "," *note keyword_item: 26d3.)*
     keywords_arguments:   (*note keyword_item: 26d3. | "**" *note expression: 431.)
                           ("," *note keyword_item: 26d3. | "," "**" *note expression: 431.)*
     keyword_item:         *note identifier: 24d0. "=" *note expression: 431.

最後の位置引数やキーワード引数の後にカンマをつけてもかまいません。構文の
意味付けに影響を及ぼすことはありません。

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__(): 966.
method are callable).  All argument expressions are evaluated before the
call is attempted.  Please refer to section *note 関数定義: 2224. for
the syntax of formal *note parameter: 255a. lists.

キーワード引数が存在する場合、以下のようにして最初に位置引数 (positional
argument) に変換されます。まず、値の入っていないスロットが仮引数に対して
生成されます。N 個の位置引数がある場合、位置引数は先頭の N スロットに配
置されます。次に、各キーワード引数について、識別子を使って対応するスロッ
トを決定します (識別子が最初の仮引数名と同じなら、最初のスロットを使う、
といった具合です)。スロットがすでにすべて埋まっていたなら *note
TypeError: 29c. 例外が送出されます。それ以外の場合、引数をスロットに埋め
ていきます。 (式が ‘None’ であっても、その式でスロットを埋めます)。全て
の引数が処理されたら、まだ埋められていないスロットをそれぞれに対応する関
数定義時のデフォルト値で埋めます。(デフォルト値は、関数が定義されたとき
に一度だけ計算されます; 従って、リストや辞書のような変更可能なオブジェク
トがデフォルト値として使われると、対応するスロットに引数を指定しない限り
、このオブジェクトが全ての呼び出しから共有されます; このような状況は通常
避けるべきです。) デフォルト値が指定されていない、値の埋められていないス
ロットが残っている場合 ‘TypeError’ 例外が送出されます。そうでない場合、
値の埋められたスロットからなるリストが呼び出しの引数として使われます。

実装では、名前を持たない位置引数を受け取る組み込み関数を提供されるかもし
れません。そういった引数がドキュメント化のために '名付けられて' いたとし
ても、実際には名付けられていないのでキーワードでは提供されません。
CPython では、C 言語で実装された関数の、名前を持たない位置引数をパースす
るために *note PyArg_ParseTuple(): 3b9. を使用します。

仮引数スロットの数よりも多くの位置引数がある場合、構文 ‘*identifier’ を
使って指定された仮引数がないかぎり、 *note TypeError: 29c. 例外が送出さ
れます; 仮引数 ‘*identifier’ がある場合、この仮引数は余分な位置引数が入
ったタプル (もしくは、余分な位置引数がない場合には空のタプル) を受け取り
ます。

キーワード引数のいずれかが仮引数名に対応しない場合、構文 ‘**identifier’
を使って指定された仮引数がない限り、 *note TypeError: 29c. 例外が送出さ
れます; 仮引数 ‘**identifier’ がある場合、この仮引数は余分なキーワード引
数が入った (キーワードをキーとし、引数値をキーに対応する値とした) 辞書を
受け取ります。余分なキーワード引数がない場合には、空の (新たな) 辞書を受
け取ります。

関数呼び出しに ‘*expression’ という構文が現れる場合は、 ‘expression’ の
評価結果は *note イテラブル: 149a. でなければなりません。 そのイテラブル
の要素は、追加の位置引数であるかのように扱われます。 ‘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 マッピング: 1579. でなければなりません。その内容は追加のキー
ワード引数として扱われます。 キーにマッチする引数が (明示的なキーワード
引数によって、あるいは他のアンパックの中で) 既に値を与えられていたなら、
*note TypeError: 29c. 例外が送出されます。

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: 29c. 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 関数定義: 2224.  When the code block executes a *note return:
     452. 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 組み込み関数: 1616. を参照してください。

クラスオブジェクト:

     そのクラスの新しいインスタンスが返されます。

クラスインスタンスメソッド:

     対応するユーザ定義の関数が呼び出されます。このとき、呼び出し時の引
     数リストより一つ長い引数リストで呼び出されます: インスタンスが引数
     リストの先頭に追加されます。

クラスインスタンス:

     The class must define a *note __call__(): 966. 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: 6d5. オブジェクトでの *note coroutine: 8a7. 実行を一時
停止します。 *note coroutine function: 1130. 内でのみ使用できます。

     await_expr: "await" *note primary: 26bb.

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: 26d5. | *note primary: 26bb.) ["**" *note u_expr: 26d9.]

従って、べき乗演算子と単項演算子からなる演算列が丸括弧で囲われていない場
合、演算子は右から左へと評価されます (この場合は演算子の評価順序を強制し
ません。つまり ‘-1**2’ は ‘-1’ になります)。

The power operator has the same semantics as the built-in *note pow():
448. 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: 267e, and the result is of
that type.

整数の被演算子では、第二引数が負でない限り、結果は被演算子と同じ型になり
ます; 第二引数が負の場合、全ての引数は浮動小数点型に変換され、浮動小数点
型が返されます。例えば ‘10**2’ は ‘100’ を返しますが、‘10**-2’ は ‘0.01’
を返します。

‘0.0’ を負の数でべき乗すると *note ZeroDivisionError: d15. を送出します
。負の数を小数でべき乗した結果は複素数 (*note complex: 330. number) にな
ります。 (以前のバージョンでは *note ValueError: 15a. を送出していました
)

This operation can be customized using the special *note __pow__(): bb5.
and *note __rpow__(): 449. 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: 26d8. | "-" *note u_expr: 26d9. | "+" *note u_expr: 26d9. | "~" *note u_expr: 26d9.

The unary ‘-’ (minus) operator yields the negation of its numeric
argument; the operation can be overridden with the *note __neg__():
2617. special method.

The unary ‘+’ (plus) operator yields its numeric argument unchanged; the
operation can be overridden with the *note __pos__(): 2618. 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__(): 261a. special method.

上記の三つはいずれも、引数が正しい型でない場合には *note TypeError: 29c.
例外が送出されます。


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: 26d9. | *note m_expr: 26dc. "*" *note u_expr: 26d9. | *note m_expr: 26dc. "@" *note m_expr: 26dc. |
             *note m_expr: 26dc. "//" *note u_expr: 26d9. | *note m_expr: 26dc. "/" *note u_expr: 26d9. |
             *note m_expr: 26dc. "%" *note u_expr: 26d9.
     a_expr: *note m_expr: 26dc. | *note a_expr: 26dd. "+" *note m_expr: 26dc. | *note a_expr: 26dd. "-" *note m_expr: 26dc.

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: 267e. 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__():
25f4. and *note __rmul__(): 25f5. 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__():
1136. and *note __rmatmul__(): 1137. 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: 267e.  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: d15.
exception.

The division operation can be customized using the special *note
__truediv__(): 1244. and *note __rtruediv__(): 2605. methods.  The floor
division operation can be customized using the special *note
__floordiv__(): 18ac. and *note __rfloordiv__(): 2606. 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: 267e.  A zero right argument raises the
*note ZeroDivisionError: d15. 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(): d6e.:
‘divmod(x, y) == (x//y, x%y)’ とも関係しています。 (2) 。

‘%’ 演算子は、数値に対する剰余演算を行うのに加えて、文字列 (string) オブ
ジェクトにオーバーロードされ、旧式の文字列の書式化 (いわゆる補間) を行い
ます。文字列の書式化の構文は Python ライブラリリファレンス *note printf
形式の文字列書式化: abe. 節を参照してください。

The 'modulo' operation can be customized using the special *note
__mod__(): 25fe. and *note __rmod__(): 1192. methods.

The floor division operator, the modulo operator, and the *note
divmod(): d6e. function are not defined for complex numbers.  Instead,
convert to a floating-point number using the *note abs(): 229a. 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: 267e. and then added together.  In the latter case, the
sequences are concatenated.

This operation can be customized using the special *note __add__():
25f1. and *note __radd__(): 25f2. 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:
267e.

This operation can be customized using the special *note __sub__():
25fd. and *note __rsub__(): 2604. 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(): 26de. は、最
初の引数と符号が一致するような値を返すので、上記の場合には ‘-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: 26dd. | *note shift_expr: 26e1. ("<<" | ">>") *note a_expr: 26dd.

これらは整数を引数にとります。引数は共通の型に変換されます。シフト演算は
第一引数を、第二引数で与えられたビット数だけ、左または右にビットシフトし
ます。

The left shift operation can be customized using the special *note
__lshift__(): 25ff. and *note __rlshift__(): 2608. methods.  The right
shift operation can be customized using the special *note __rshift__():
2600. and *note __rrshift__(): 2609. 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: 26e1. | *note and_expr: 26e4. "&" *note shift_expr: 26e1.
     xor_expr: *note and_expr: 26e4. | *note xor_expr: 26e5. "^" *note and_expr: 26e4.
     or_expr:  *note xor_expr: 26e5. | *note or_expr: 2511. "|" *note xor_expr: 26e5.

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__(): 2601. or *note __rand__(): 260a. 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__(): 2602. or *note __rxor__(): 260b. 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__(): 2603. or *note __ror__(): 260c. 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: 2511. (*note comp_operator: 26e9. *note or_expr: 2511.)*
     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(): 5f6. 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 オブジェクト、値、および型: 253b. の章では、オブジェクトは (型や
id に加えて) 値を持つことを述べています。 オブジェクトの値は Python では
やや抽象的な概念です: 例えば、オブジェクトの値にアクセスする正統な方法は
ありません。 また、その全てのデータ属性から構成されるなどの特定の方法で
、オブジェクトの値を構築する必要性もありません。 比較演算子は、オブジェ
クトの値とは何かについての特定の概念を実装しています。 この比較の実装に
よって、間接的にオブジェクトの値を定義していると考えることもできます。

Because all types are (direct or indirect) subtypes of *note object:
e51, they inherit the default comparison behavior from ‘object’.  Types
can customize their comparison behavior by implementing 'rich comparison
methods' like *note __lt__(): 165a, described in *note
基本的なカスタマイズ: 25c1.

等価比較 (‘==’ および ‘!=’) のデフォルトの振る舞いは、オブジェクトの同一
性に基づいています。 従って、同一のインスタンスの等価比較の結果は等しい
となり、同一でないインスタンスの等価比較の結果は等しくないとなります。 デ
フォルトの振る舞いをこのようにしたのは、全てのオブジェクトを反射的
(reflexive つまり ‘x is y’ ならば ‘x == y’) なものにしたかったからです。

デフォルトの順序比較 (‘<’, ‘>’, ‘<=’, ‘>=’) は提供されません; 比較しよう
とすると *note TypeError: 29c. が送出されます。 この振る舞いをデフォルト
の振る舞いにした動機は、等価性と同じような不変性が欠けているからです。

同一でないインスタンスは常に等価でないとする等価比較のデフォルトの振る舞
いは、型が必要とするオブジェクトの値や値に基づいた等価性の実用的な定義と
は対照的に思えるでしょう。 そのような型では比較の振る舞いをカスタマイズ
する必要が出てきて、実際にたくさんの組み込み型でそれが行われています。

次のリストでは、最重要の組み込み型の比較の振る舞いを解説しています。

   * いくつかの組み込みの数値型 (*note 数値型 int, float, complex:
     21e8.) と標準ライブラリの型 *note fractions.Fraction: 1ce. および
     *note decimal.Decimal: 1cd. は、これらの型の範囲で異なる型とも比較
     できますが、複素数では順序比較がサポートされていないという制限があ
     ります。 関わる型の制限の範囲内では、精度のロス無しに数学的に (アル
     ゴリズム的に) 正しい比較が行われます。

     非数値である ‘float('NaN')’ と ‘decimal.Decimal('NaN')’ は特別です
     。 数と非数値との任意の順序比較は偽です。 直観に反する帰結として、
     非数値は自分自身と等価ではないことになります。 例えば ‘x =
     float('NaN')’ ならば、 ‘3 < x’, ‘x < 3’, ‘x == x’ は全て偽で、‘x !=
     x’ は真です。 この振る舞いは IEEE 754 に従ったものです。

   * ‘None’ and *note NotImplemented: 447. 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: 1d2. または *note bytearray: 1d1.
     のインスタンス) は、これらの型の範囲で異なる型とも比較できます。 比
     較は要素の数としての値を使った辞書式順序で行われます。

   * 文字列 (*note str: 1ea. のインスタンス) の比較は、文字の Unicode の
     コードポイントの数としての値 (組み込み関数 *note ord(): 254a. の返
     り値) を使った辞書式順序で行われます。 (2)

     文字列とバイナリシーケンスは直接には比較できません。

   * シーケンス (*note tuple: 1d9, *note list: 4e0, or *note range: d13.
     のインスタンス) の比較は、同じ型どうしでしか行えず、 range は順序比
     較をサポートしていません。 異なる型どうしの等価比較の結果は等価でな
     いとなり、異なる型どうしの順序比較は *note TypeError: 29c. を送出し
     ます。

     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: 193. のインスタンス) の比較の結果が等価とな
     るのは、同じ ‘(key, value)’ を持っているときかつそのときに限ります
     。 キーと値の等価比較では反射性が強制されます。

     順序比較 (‘<’, ‘>’, ‘<=’, ‘>=’) は *note TypeError: 29c. を送出しま
     す。

   * 集合 (*note set: 432. または *note frozenset: 9d9. のインスタンス)
     の比較は、これらの型の範囲で異なる型とも行えます。

     集合には、部分集合あるいは上位集合かどうかを基準とする順序比較が定
     義されています。 この関係は全順序を定義しません (例えば、 ‘{1,2}’ と
     ‘{2,3}’ という2つの集合は片方がもう一方の部分集合でもなく上位集合で
     もありません)。 従って、集合は全順序性に依存する関数の引数として適
     切ではありません (例えば、 *note min(): 12bc, *note max(): 12bd,
     *note sorted(): f90. は集合のリストを入力として与えると未定義な結果
     となります)。

     集合の比較では、その要素の反射性が強制されます。

   * 他の組み込み型のほとんどは比較メソッドが実装されておらず、デフォル
     トの比較の振る舞いを継承します。

比較の振る舞いをカスタマイズしたユーザ定義クラスは、可能なら次の一貫性の
規則に従う必要があります:

   * 等価比較は反射的でなければなりません。 つまり、同一のオブジェクトは
     等しくなければなりません:

          ‘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(): 12f2. デコレータも参照してください。

   * *note hash(): 9e7. の結果は等価性と一貫している必要があります。 等
     価なオブジェクトどうしは同じハッシュ値を持つか、ハッシュ値が計算で
     きないものとされる必要があります。

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(): ac7. を使ってください。


File: python.info,  Node: 所属検査演算,  Next: 同一性の比較,  Prev: 値の比較,  Up: 比較

4.6.10.2 所属検査演算
.....................

演算子 *note in: 32b. および *note not in: a25. は所属関係を調べます。
‘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__(): 1772.
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__(): 1772.
but do define *note __iter__(): 1031, ‘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: 32b. raised that exception.

Lastly, the old-style iteration protocol is tried: if a class defines
*note __getitem__(): 78d, ‘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: 18ed. exception.
(If any other exception is raised, it is as if *note in: 32b. raised
that exception).

演算子 *note not in: a25. は *note in: 32b. の真理値を反転した値として定
義されています。


File: python.info,  Node: 同一性の比較,  Prev: 所属検査演算,  Up: 比較

4.6.10.3 同一性の比較
.....................

演算子 *note is: 32c. および *note is not: 26ed. は、オブジェクトの同一
性に対するテストを行います: ‘x is y’ は、 'x' と 'y' が同じオブジェクト
を指すとき、かつそのときに限り真になります。 オブジェクトの同一性は
*note id(): 17db. 関数を使って判定されます。 ‘x is not y’ は ‘is’ の真値
を反転したものになります。 (1)

   ---------- Footnotes ----------

   (1) 自動的なガベージコレクション、フリーリスト、ディスクリプタの動的
特性のために、インスタンスメソッドや定数の比較を行うようなときに *note
is: 32c. 演算子の利用は、一見すると普通ではない振る舞いだと気付くかもし
れません。詳細はそれぞれのドキュメントを確認してください。


File: python.info,  Node: ブール演算 boolean operation,  Next: 代入式<2>,  Prev: 比較,  Up: 式 expression

4.6.11 ブール演算 (boolean operation)
-------------------------------------

     or_test:  *note and_test: 26f1. | *note or_test: 269f. "or" *note and_test: 26f1.
     and_test: *note not_test: 26f2. | *note and_test: 26f1. "and" *note not_test: 26f2.
     not_test: *note comparison: 26e8. | "not" *note not_test: 26f2.

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__():
168f. method.

演算子 *note not: 26f0. は、引数が偽である場合には ‘True’ を、それ以外の
場合には ‘False’ になります。

式 ‘x and y’ は、まず 'x' を評価します; 'x' が偽なら 'x' の値を返します;
それ以外の場合には、 'y' を評価した結果値を返します。

式 ‘x or y’ は、まず 'x' を評価します; 'x' が真なら 'x' の値を返します;
それ以外の場合には、 'y' を評価した結果値を返します。

なお、 *note and: 327. も *note or: 32d. も、返す値を ‘True’ や ‘False’
に制限せず、最後に評価した引数を返します。 この仕様が便利なときもありま
す。例えば ‘s’ が文字列で、空文字列ならデフォルトの値に置き換えたいとき
、式 ‘s or 'foo'’ は望んだ値を与えます。 *note not: 26f0. は必ず新しい値
を作成するので、引数の型に関係なくブール値を返します (例えば、 ‘not
'foo'’ は ‘''’ ではなく ‘False’ になります)。


File: python.info,  Node: 代入式<2>,  Next: 条件式 Conditional Expressions,  Prev: ブール演算 boolean operation,  Up: 式 expression

4.6.12 代入式
-------------

     assignment_expression: [*note identifier: 24d0. ":="] *note expression: 431.

An assignment expression (sometimes also called a "named expression" or
"walrus") assigns an *note expression: 431. to an *note identifier:
24d0, 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: 269f. ["if" *note or_test: 269f. "else" *note expression: 431.]
     expression:             *note conditional_expression: 2510. | *note lambda_expr: 26f6.

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: 26f9.] ":" *note expression: 431.

ラムダ式 (ラムダ形式とも呼ばれます) は無名関数を作成するのに使います。 式
‘lambda parameters: expression’ は関数オブジェクトになります。 この無名
オブジェクトは以下に定義されている関数オブジェクト同様に動作します:

     def <lambda>(parameters):
         return expression

引数の一覧の構文は *note 関数定義: 2224. を参照してください。ラムダ式で
作成された関数は文やアノテーションを含むことができない点に注意してくださ
い。


File: python.info,  Node: 式のリスト,  Next: 評価順序,  Prev: ラムダ lambda,  Up: 式 expression

4.6.15 式のリスト
-----------------

     starred_expression:       "*" *note or_expr: 2511. | *note expression: 431.
     flexible_expression:      *note assignment_expression: 2641. | *note starred_expression: 2699.
     flexible_expression_list: *note flexible_expression: 269c. ("," *note flexible_expression: 269c.)* [","]
     starred_expression_list:  *note starred_expression: 2699. ("," *note starred_expression: 2699.)* [","]
     expression_list:          *note expression: 431. ("," *note expression: 431.)* [","]
     yield_list:               *note expression_list: 26fc. | *note starred_expression: 2699. "," [*note starred_expression_list: 26fb.]

リスト表示や辞書表示の一部になっているものを除き、少なくとも一つのカンマ
を含む式のリストはタプルになります。 タプルの長さは、リストにある式の数
に等しくなります。 式は左から右へ評価されます。

アスタリスク ‘*’ は 'イテラブルのアンパック' を意味します。 この被演算子
は *note イテラブル: 149a. でなければなりません。 このイテラブルはアンパ
ックされた位置で要素のシーケンスに展開され、新しいタプル、リスト、集合に
入れ込まれます。

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 比較: 26e6. 節で述べられているように、比較、所属、同一性のテストは
全てが同じ優先順位を持っていて、左から右に連鎖するという特徴を持っている
ことに注意してください。

演算子                                              説明
                                                    
----------------------------------------------------------------------------------------------
                                                    
‘(expressions...)’,                                 結合式または括弧式、リスト表示、辞書表
                                                    示、集合表示
‘[expressions...]’, ‘{key: value...}’,              
‘{expressions...}’

‘x[index]’, ‘x[index:index]’ ‘x(arguments...)’,     Subscription (including slicing), call,
‘x.attribute’                                       attribute reference
                                                    
                                                    
*note await x: 439.                                 Await 式
                                                    
                                                    
‘**’                                                べき乗 (1)
                                                    
                                                    
‘+x’, ‘-x’, ‘~x’                                    正数、負数、ビット単位 NOT
                                                    
                                                    
‘*’, ‘@’, ‘/’, ‘//’, ‘%’                            乗算、行列乗算、除算、切り捨て除算、剰
                                                    余 (2)
                                                    
                                                    
‘+’, ‘-’                                            加算および減算
                                                    
                                                    
‘<<’, ‘>>’                                          シフト演算
                                                    
                                                    
‘&’                                                 ビット単位 AND
                                                    
                                                    
‘^’                                                 ビット単位 XOR
                                                    
                                                    
‘|’                                                 ビット単位 OR
                                                    
                                                    
*note in: 32b, *note not in: a25, *note is: 32c,    所属や同一性のテストを含む比較
*note is not: 26ed, ‘<’, ‘<=’, ‘>’, ‘>=’, ‘!=’,     
‘==’

*note not x: 26f0.                                  ブール演算 NOT
                                                    
                                                    
*note and: 327.                                     ブール演算 AND
                                                    
                                                    
*note or: 32d.                                      ブール演算 OR
                                                    
                                                    
*note if: 42d. - ‘else’                             条件式
                                                    
                                                    
*note lambda: 1657.                                 ラムダ式
                                                    
                                                    
‘:=’                                                代入式
                                                    

脚注
....

   ---------- 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: 2706.
                  | *note assert_stmt: 2707.
                  | *note assignment_stmt: 2708.
                  | *note augmented_assignment_stmt: 2709.
                  | *note annotated_assignment_stmt: 270a.
                  | *note pass_stmt: 270b.
                  | *note del_stmt: 270c.
                  | *note return_stmt: 270d.
                  | *note yield_stmt: 270e.
                  | *note raise_stmt: 270f.
                  | *note break_stmt: 2710.
                  | *note continue_stmt: 2711.
                  | *note import_stmt: 2712.
                  | *note future_stmt: 2713.
                  | *note global_stmt: 2714.
                  | *note nonlocal_stmt: 2715.
                  | *note type_stmt: 2716.

* 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: 2699.

式文は式のリスト (単一の式のこともあります) を値評価します。

対話モードでは、値が ‘None’ でなければ、値を組み込み関数 *note repr():
462. で文字列に変換して、その結果の文字列を標準出力に一行使って書き出し
ます。 (‘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: 269e. "=")+ (*note starred_expression: 2699. | *note yield_expression: 2512.)
     target_list:     *note target: 271a. ("," *note target: 271a.)* [","]
     target:          *note identifier: 24d0.
                      | "(" [*note target_list: 269e.] ")"
                      | "[" [*note target_list: 269e.] "]"
                      | *note attributeref: 26bc.
                      | *note subscription: 26bd.
                      | "*" *note target: 271a.

(See section *note プライマリ: 26ba. 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 標準型の階層: 253e.).

ターゲットリストは、丸括弧や角括弧で囲まれていてもよく、それに対するオブ
ジェクトの代入は、以下のように再帰的に定義されています。

   * ターゲットリストのターゲットが1つだけでコンマが続いておらず、任意に
     丸括弧で囲われている場合、オブジェクトはそのターゲットに代入されま
     す。

   * その他:

        * "星付き"のターゲットと呼ばれる、頭にアスタリスクが一つ付いたタ
          ーゲットがターゲットリストに一つだけ含まれている場合: オブジェ
          クトはイテラブルで、少なくともターゲットリストのターゲットの数
          よりも一つ少ない要素を持たなければなりません。 星付きのターゲ
          ットより前のターゲットに、イテラブルの先頭の要素が左から右へ代
          入されます。 星付きのターゲットより後ろのターゲットに、イテラ
          ブルの末尾の要素が代入されます。 星付きのターゲットに、イテラ
          ブルの残った要素のリストが代入されます (リスト空でもかまいませ
          ん)。

        * そうでない場合: オブジェクトは、ターゲットリストのターゲットと
          同じ数の要素を持つイテラブルでなければならず、要素は左から右へ
          対応するターゲットに代入されます。

単一のターゲットへの単一のオブジェクトの代入は、以下のようにして再帰的に
定義されています。

   * ターゲットが識別子 (名前) の場合:

        * 名前が現在のコードブロック内の *note global: 6bb. や *note
          nonlocal: 1661. 文に書かれていないければ: 名前は現在のローカル
          名前空間内のオブジェクトに束縛されます。

        * そうでなければ: 名前はそれぞれグローバル名前空間内か、 *note
          nonlocal: 1661. で決められた外側の名前空間内のオブジェクトに束
          縛されます。

     名前がすでに束縛済みの場合、再束縛 (rebind) がおこなわれます。再束
     縛によって、以前その名前に束縛されていたオブジェクトの参照カウント
     (reference count) がゼロになった場合、オブジェクトは解放
     (deallocate) され、デストラクタ (destructor) が (存在すれば) 呼び出
     されます。

   * ターゲットが属性参照の場合: 参照されている一次語の式が値評価されま
     す。値は代入可能な属性を伴うオブジェクトでなければなりません; そう
     でなければ、 *note TypeError: 29c. が送出されます。次に、このオブジ
     ェクトに対して、被代入オブジェクトを指定した属性に代入してよいか問
     い合わせます; 代入を実行できない場合、例外 (通常は *note
     AttributeError: 1b4. ですが、必然ではありません) を送出します。 注
     意: オブジェクトがクラスインスタンスで、代入演算子の両辺に属性参照
     があるとき、右辺式の ‘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(): 6c1. で作成されたプロパティのような
     デスクリプタ属性に対しては、必ずしもあてはまるとは限りません。

   * 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__(): 1685. method
     is called with two arguments: the subscript and the assigned
     object.

     Typically, *note __setitem__(): 1685. is defined on mutable
     sequence objects (such as lists) and mapping objects (such as
     dictionaries), and behaves as follows.

     一次語が (リストのような) ミュータブルなシーケンスオブジェクトであ
     れば、添字表記は整数を与えなければなりません。整数が負なら、シーケ
     ンスの長さが加算されます。整数は最終的に、シーケンスの長さよりも小
     さな非負の整数でなくてはならず、シーケンスは、そのインデクスに持つ
     要素に被代入オブジェクトを代入してよいか問い合わせられます。インデ
     クスが範囲外なら、 *note IndexError: 18ed. が送出されます (添字指定
     されたシーケンスに代入を行っても、リスト要素の新たな追加はできませ
     ん)。

     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: 149a.  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: 271e. *note augop: 271f. (*note expression_list: 26fc. | *note yield_expression: 2512.)
     augtarget:                 *note identifier: 24d0. | *note attributeref: 26bc. | *note subscription: 26bd.
     augop:                     "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="
                                | ">>=" | "<<=" | "&=" | "^=" | "|="

(最後の3つの構文定義については *note プライマリ: 26ba. を参照してくださ
い。)

累算代入文は、ターゲット (通常の代入文と違って、アンパックは起こりません
) と式リストを評価し、それら二つの被演算子間で特定の累算代入型の二項演算
を行い、結果をもとのターゲットに代入します。ターゲットは一度しか評価され
ません。

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
クラス属性とインスタンス属性についての注意: 271b. と同様に通常の代入が適
用されます。


File: python.info,  Node: 注釈付き代入文 annotated assignment statements,  Prev: 累算代入文 augmented assignment statement,  Up: 代入文 assignment statement

4.7.2.2 注釈付き代入文 (annotated assignment statements)
........................................................

*note 注釈: 110e. 代入は、1 つの文の中で変数や属性のアノテーションとオプ
ションの代入文を組み合わせたものです:

     annotated_assignment_stmt: *note augtarget: 271e. ":" *note expression: 431.
                                ["=" (*note starred_expression: 2699. | *note yield_expression: 2512.)]

通常の *note 代入文 (assignment statement): 263b. との違いは、代入先が 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: 6ba.  The annotations can be
evaluated using the *note __annotations__: 672. 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__(): 1685. or
*note __setattr__(): 258c. call.

参考
....

PEP 526(1) - Syntax for Variable Annotations

     (クラス変数やインスタンス変数を含んだ) 変数の型注釈を付ける、コメン
     トで表現するのではない文法の追加提案。

PEP 484(2) - Type hints

     *note typing: 10d. モジュールを追加し、静的解析ツールや 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: 6ba.  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: 431. ["," *note expression: 431.]

単純な形式 ‘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__: bbb. and *note
AssertionError: a9c. 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: 438.).  The current code
generator emits no code for an *note assert: d35. 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__: bbb. への代入は不正な操作です。組み込み変数の値は、イン
タプリタが開始するときに決定されます。


File: python.info,  Node: pass 文<2>,  Next: del 文<2>,  Prev: assert 文,  Up: 単純文 simple statement

4.7.4 ‘pass’ 文
---------------

     pass_stmt: "pass"

*note pass: 42e. はヌル操作 (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: 269e.

オブジェクトの削除 (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: 6bb. statement in the same code block.  Trying to delete an
unbound name raises a *note NameError: 66c. 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: 26fc.]

*note return: 452. は、関数定義内で構文法的にネストして現れますが、ネス
トしたクラス定義内には現れません。

式リストがある場合、リストが値評価されます。それ以外の場合は ‘None’ で置
き換えられます。

*note return: 452. を使うと、式リスト (または ‘None’) を戻り値として、現
在の関数呼び出しから抜け出します。

*note return: 452. によって、 *note finally: 453. 節をともなう *note
try: adb. 文の外に処理が引き渡されると、実際に関数から抜ける前に
‘finally’ 節が実行されます。

ジェネレータ関数では、 *note return: 452. 文はジェネレータの終わりを示し
、 *note StopIteration: fbe. 例外を送出させます。返された値は (あれば)、
‘StopIteration’ を構成する引数に使われ、 *note StopIteration.value:
262b. 属性になります。

非同期ジェネレータ関数では、引数無しの *note return: 452. 文は非同期ジェ
ネレータの終わりを示し、 *note StopAsyncIteration: 201d. を送出させます
。 引数ありの ‘return’ 文は、非同期ジェネレータ関数では文法エラーです。


File: python.info,  Node: yield 文,  Next: raise 文,  Prev: return 文,  Up: 単純文 simple statement

4.7.7 ‘yield’ 文
----------------

     yield_stmt: *note yield_expression: 2512.

A *note yield: d97. statement is semantically equivalent to a *note
yield expression: 26ae.  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: 1417. function, and are only used in the body of the
generator function.  Using *note yield: d97. in a function definition is
sufficient to cause that definition to create a generator function
instead of a normal function.

*note yield: d97. の意味の完全な説明は、 *note Yield 式: 26ae. 節を参照
してください。


File: python.info,  Node: raise 文,  Next: break 文,  Prev: yield 文,  Up: 単純文 simple statement

4.7.8 ‘raise’ 文
----------------

     raise_stmt: "raise" [*note expression: 431. ["from" *note expression: 431.]]

If no expressions are present, *note raise: 9e9. 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: 317. exception is raised indicating that this is an error.

そうでなければ、 *note raise: 9e9. は最初の式を、例外オブジェクトとして
評価します。これは、 *note BaseException: 9bd. のサブクラスまたはインス
タンスでなければなりません。クラスなら、例外インスタンスが必要なとき、ク
ラスを無引数でインスタンス化することで得られます。

例外の '型' は例外インスタンスのクラスで、 '値' はインスタンスそのもので
す。

A traceback object is normally created automatically when an exception
is raised and attached to it as the *note __traceback__: 1680.
attribute.  You can create an exception and set your own traceback in
one step using the *note with_traceback(): 2728. 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__: 1682. 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: 44e. or *note finally: 453. clause, or a *note with:
215. statement, is used.  The previous exception is then attached as the
new exception's *note __context__: 1681. 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: a6a. 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 例外: 2647. 節にあります。また、例外処理に
関する情報は *note try 文: adb. 節にあります。

バージョン 3.3 で変更: *note None: a6a. が ‘raise X from Y’ の ‘Y’ とし
て使えるようになりました。

Added the *note __suppress_context__: 2729. attribute to suppress
automatic display of the exception context.

バージョン 3.11 で変更: If the traceback of the active exception is
modified in an *note except: 44e. 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: 42f. 文は、構文としては *note for: 329. ループや *note
while: 1ba5. ループの内側でのみ出現することができますが、ループ内の関数
定義やクラス定義の内側には出現できません。

*note break: 42f. 文は、文を囲う最も内側のループを終了させ、ループにオプ
ションの ‘else’ 節がある場合にはそれをスキップします。

*note for: 329. ループを *note break: 42f. によって終了すると、ループ制
御ターゲットはその時の値を保持します。

*note break: 42f. が *note finally: 453. 節を伴う *note try: adb. 文の外
側に処理を渡す際には、ループを実際に抜ける前にその ‘finally’ 節が実行さ
れます。


File: python.info,  Node: continue 文,  Next: import 文,  Prev: break 文,  Up: 単純文 simple statement

4.7.10 ‘continue’ 文
--------------------

     continue_stmt: "continue"

*note continue: 430. 文は *note for: 329. ループや *note while: 1ba5. ル
ープ内のネストで構文法的にのみ現れますが、ループ内の関数定義やクラス定義
の中には現れません。 ‘continue’ 文は、文を囲う最も内側のループの次の周期
に処理を継続します。

*note continue: 430. が *note finally: 453. 句を持った *note try: adb. 文
を抜けるとき、その ‘finally’ 句が次のループサイクルを始める前に実行され
ます。


File: python.info,  Node: import 文,  Next: global 文,  Prev: continue 文,  Up: 単純文 simple statement

4.7.11 ‘import’ 文
------------------

     import_stmt:     ["lazy"] "import" *note module: 272d. ["as" *note identifier: 24d0.] ("," *note module: 272d. ["as" *note identifier: 24d0.])*
                      | ["lazy"] "from" *note relative_module: 272e. "import" *note identifier: 24d0. ["as" *note identifier: 24d0.]
                      ("," *note identifier: 24d0. ["as" *note identifier: 24d0.])*
                      | ["lazy"] "from" *note relative_module: 272e. "import" "(" *note identifier: 24d0. ["as" *note identifier: 24d0.]
                      ("," *note identifier: 24d0. ["as" *note identifier: 24d0.])* [","] ")"
                      | "from" *note relative_module: 272e. "import" "*"
     module:          (*note identifier: 24d0. ".")* *note identifier: 24d0.
     relative_module: "."* *note module: 272d. | "."+

(*note from: 1665. 節が無い) 基本の import 文は 2 つのステップで実行され
ます:

  1. モジュールを見付け出し、必要であればロードし初期化する

  2. define a name or names in the current namespace for the scope where
     the *note import: 9df. statement occurs, just as an assignment
     statement would (including *note global: 6bb. and *note nonlocal:
     1661. semantics).

文が (カンマで区切られた) 複数の節を含んでいるときは、ちょうどその節が個
別の import 文に分割されたかのように、2つのステップが節ごとに個別に実行
されます。

モジュールを見付け、ロードする 1 つ目のステップの詳細については、 *note
インポートシステム: 256f. の節により詳しく書かれています。そこでは、イン
ポートシステムの動作をカスタマイズするのに使える全てのフックの仕組みだけ
でなく、様々な種類のインポートできるパッケージとモジュールについても解説
されています。このステップが失敗するということは、おそらくモジュールが見
付からないか、 'あるいは' モジュールにあるコードの実行を含め、モジュール
の初期化の途中でエラーが起きるかのどちらかが起きていることに注意してくだ
さい。

要求したモジュールが無事に取得できた場合、次の 3 つのうちの 1 つの方法で
ローカル名前空間で使えるようになります:

   * モジュール名の後に ‘as’ が続いていた場合は、 ‘as’ の後ろの名前を直
     接、インポートされたモジュールが束縛します。

   * 他の名前が指定されておらず、インポートされているモジュールが最上位
     のモジュールだった場合、そのモジュール名がインポートされたモジュー
     ルへの参照として、ローカル名前空間で束縛されます

   * インポートされているモジュールが最上位のモジュール 'でない' 場合、
     モジュールを含む最上位のパッケージ名が、そのパッケージへの参照とし
     て、ローカル名前空間で束縛されます。インポートされたモジュールには
     、直接ではなく完全修飾名を使ってアクセスしなければなりません

*note from: 1665. 形式ではもう少し複雑な手順を踏みます:

  1. *note from: 1665. 節で指定されたモジュールを見付け出し、必要であれ
     ばロードし初期化する;

  2. *note import: 9df. 節で指定されたそれぞれの識別子に対し以下の処理を
     行う:

       1. インポートされたモジュールがその識別子名の属性を持っているかを
          確認する

       2. その識別子名の属性を持っていなかった場合は、その識別子名でサブ
          モジュールのインポートを試み、インポートされたモジュールにその
          属性があるか再度確認する

       3. 属性が見付からない場合は、 *note ImportError: 1c8. を送出する
          。

       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: 9df. 文がいるスコープのロ
ーカル名前空間に束縛されます。

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:
24cc. 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: 189. が送出されます。

インポートするモジュールを指定するとき、そのモジュールの絶対名 (absolute
name) を指定する必要はありません。モジュールやパッケージが他のパッケージ
に含まれている場合、共通のトップパッケージからそのパッケージ名を記述する
ことなく相対インポートすることができます。 *note from: 1665. の後に指定
されるモジュールやパッケージの先頭に複数個のドットを付けることで、正確な
名前を指定することなしに現在のパッケージ階層からいくつ上の階層へ行くかを
指定することができます。先頭のドットが 1 つの場合、 import をおこなって
いるモジュールが存在する現在のパッケージを示します。 3 つのドットは 2 つ
上のレベルを示します。なので、 ‘pkg’ パッケージの中のモジュールで ‘from
. import mod’ を実行すると、 ‘pkg.mod’ をインポートすることになります。
‘pkg.subpkg1’ の中から ‘from ..subpkg2 import mod’ を実行すると、
‘pkg.subpkg2.mod’ をインポートします。相対インポートの仕様は *note
Package Relative Imports: 2673. の節に含まれています。

どのモジュールがロードされるべきかを動的に決めたいアプリケーションのため
に、組み込み関数 *note importlib.import_module(): 92c. が提供されていま
す。

Raises an *note auditing event: 1e84. ‘import’ with arguments ‘module’,
‘filename’, ‘sys.path’, ‘sys.meta_path’, ‘sys.path_hooks’.
* Menu:

* Lazy imports::
* future 文 (future statement): future 文 future statement.

   ---------- Footnotes ----------

   (1) https://www.unicode.org/reports/tr15/#Norm_Forms


File: python.info,  Node: Lazy imports,  Next: future 文 future statement,  Up: import 文

4.7.11.1 Lazy imports
.....................

The *note lazy: 182. keyword is a *note soft keyword: bea. that only has
special meaning when it appears immediately before an *note import: 9df.
or *note from: 1665. statement.  When an import statement is preceded by
the ‘lazy’ keyword, the import becomes 'lazy': the module is not loaded
immediately at the import statement.  Instead, a lazy proxy object is
created and bound to the name.  The actual module is loaded on first use
of that name.

Lazy imports are only permitted at module scope.  Using *note lazy: 182.
inside a function, class body, or *note try: adb./*note except:
44e./*note finally: 453. block raises a *note SyntaxError: 189.  Star
imports cannot be lazy (‘lazy from module import *’ is a syntax error),
and *note future statements: 677. cannot be lazy.

When using ‘lazy from ... import’, each imported name is bound to a lazy
proxy object.  The first access to any of these names triggers loading
of the entire module and resolves only that specific name to its actual
value.  Other names remain as lazy proxies until they are accessed.

以下はプログラム例です:

     lazy import json
     import sys

     print('json' in sys.modules)  # False - json module not yet loaded

     # First use triggers loading
     result = json.dumps({"hello": "world"})

     print('json' in sys.modules)  # True - now loaded

If an error occurs during module loading (such as *note ImportError:
1c8. or *note SyntaxError: 189.), it is raised at the point where the
lazy import is first used, not at the import statement itself.

See PEP 810(1) for the full specification of lazy imports.

Added in version 3.15.

* Menu:

* Compatibility via __lazy_modules__::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0810/


File: python.info,  Node: Compatibility via __lazy_modules__,  Up: Lazy imports

4.7.11.2 Compatibility via ‘__lazy_modules__’
.............................................

As an alternative to using the *note lazy: 182. keyword, a module can
opt into lazy loading for specific imports by defining a module-level
*note __lazy_modules__: 18a. variable.  When present, it must be a
container of fully qualified module name strings.  Any regular
(non-‘lazy’) *note import: 9df. statement at module scope whose target
appears in ‘__lazy_modules__’ is treated as a lazy import, exactly as if
the ‘lazy’ keyword had been used.

This provides a way to enable lazy loading for specific dependencies
without changing individual ‘import’ statements.  This is useful when
supporting Python versions older than 3.15 while using lazy imports in
3.15+:

     __lazy_modules__ = ["json", "pathlib"]

     import json     # loaded lazily (name is in __lazy_modules__)
     import os       # loaded eagerly (name not in __lazy_modules__)

     import pathlib  # loaded lazily

Relative imports are resolved to their absolute name before the lookup,
so ‘__lazy_modules__’ must always contain fully qualified module names.

For ‘from’-style imports, the relevant name is the module following
‘from’, not the names of its members:

     # In mypackage/mymodule.py
     __lazy_modules__ = ["mypackage", "mypackage.sub.utils"]

     from . import helper         # loaded lazily: . resolves to mypackage
     from .sub.utils import func  # loaded lazily: .sub.utils resolves to mypackage.sub.utils
     import json                  # loaded eagerly (not in __lazy_modules__)

Imports inside functions, class bodies, or *note try: adb./*note except:
44e./*note finally: 453. blocks are always eager, regardless of
‘__lazy_modules__’.

Setting ‘-X lazy_imports=none’ (or the *note PYTHON_LAZY_IMPORTS: 184.
environment variable to ‘none’) overrides ‘__lazy_modules__’ and forces
all imports to be eager.

Added in version 3.15.


File: python.info,  Node: future 文 future statement,  Prev: Lazy imports,  Up: import 文

4.7.11.3 future 文 (future statement)
.....................................

'future 文' は、将来の特定の新たな機能が標準化された Python のリリースで
利用可能になるような構文や意味付けを使って、特定のモジュールをコンパイル
させるための、コンパイラに対する指示句 (directive) です。

future 文は互換性のない変更がされた将来の Python のバージョンに容易に移
行するためのものです。future 文によって新機能が標準となるリリースの前に
それをモジュール単位で使用することが出来ます。

     future_stmt: "from" "__future__" "import" *note feature: 2732. ["as" *note identifier: 24d0.]
                  ("," *note feature: 2732. ["as" *note identifier: 24d0.])*
                  | "from" "__future__" "import" "(" *note feature: 2732. ["as" *note identifier: 24d0.]
                  ("," *note feature: 2732. ["as" *note identifier: 24d0.])* [","] ")"
     feature:     *note identifier: 24d0.

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(): 190. and
*note compile(): 1d3. 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: 1893. オ
プションで起動して実行すべきスクリプト名を渡し、スクリプト中に 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: 24d0. ("," *note identifier: 24d0.)*

The *note global: 6bb. 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: 189. 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: 6a3.).

'プログラマのための注意点:' *note global: 6bb. はパーザに対する指示句
(directive) です。この指示句は、 ‘global’ 文と同時に読み込まれたコードに
対してのみ適用されます。特に、組み込みの *note exec(): 190. 関数内に入っ
ている ‘global’ 文は、関数の呼び出しを '含んでいる' コードブロック内に効
果を及ぼすことはなく、そのような文字列に含まれているコードは、関数の呼び
出しを含むコード内の ‘global’ 文に影響を受けません。同様のことが、関数
*note eval(): 18f. および *note compile(): 1d3. にも当てはまります。


File: python.info,  Node: nonlocal 文,  Next: The type statement,  Prev: global 文,  Up: 単純文 simple statement

4.7.13 ‘nonlocal’ 文
--------------------

     nonlocal_stmt: "nonlocal" *note identifier: 24d0. ("," *note identifier: 24d0.)*

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: 1661. 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: 189. is raised.

The *note nonlocal: 1661. statement applies to the entire scope of a
function or class body.  A *note SyntaxError: 189. 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: 1661. 文の詳細。

'Programmer's note:' *note nonlocal: 1661. is a directive to the parser
and applies only to code parsed along with it.  See the note for the
*note global: 6bb. 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: 24d0. [*note type_params: 2736.] "=" *note expression: 431.

The ‘type’ statement declares a type alias, which is an instance of
*note typing.TypeAliasType: 531.

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: 6ba, 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: 877.).  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:
7ab. after the name.  See *note Generic type aliases: 876. for more.

‘type’ is a *note soft keyword: bea.

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: 32a. 、 *note while: 1ba5. 、および *note for: 329. 文は、伝統
的な制御フロー構成を実現します。 *note try: adb. は例外処理および/または
一連の文に対するクリーンアップコードを指定します。それに対して、 *note
with: 215. 文はコードのかたまりの前後でコードの初期化と終了処理を実行で
きるようにします。関数とクラス定義もまた、構文的には複合文です。

複合文は、一つ以上の '節 (clause)' からなります。節は、ヘッダと 'スイー
ト (suite)' からなります。一つの複合文を成す各節のヘッダは、全て同じイン
デントレベルに置かれます。各節のヘッダは一意に識別するキーワードで始まり
、コロンで終わります。スイートは、節によって制御される文の集まりです。ス
イートは、ヘッダがある行のコロンの後にセミコロンで区切って置かれた一つ以
上の単純文、または、ヘッダに続く行で一つ多くインデントされた文の集まりで
す。後者の形式のスイートに限り、さらに複合文をネストできます; 以下の文は
、 *note else: 328. 節がどちらの *note if: 32a. 節に属するかがはっきりし
ないなどの理由から不正になります:

     if test1: if test2: print(x)

また、このコンテキスト中では、セミコロンによる結合はコロンより強いです。
従って、以下の例では、 *note print(): 1324. の呼び出しはは全て実行される
か、全く実行されないかのどちらかです:

     if x < y < z: print(x); print(y); print(z)

まとめると、以下のようになります:

     compound_stmt: *note if_stmt: 273c.
                    | *note while_stmt: 273d.
                    | *note for_stmt: 273e.
                    | *note try_stmt: 273f.
                    | *note with_stmt: 2740.
                    | *note match_stmt: 2741.
                    | *note funcdef: 2742.
                    | *note classdef: 2743.
                    | *note async_with_stmt: 2744.
                    | *note async_for_stmt: 2745.
                    | *note async_funcdef: 2746.
     suite:         *note stmt_list: 2748. NEWLINE | NEWLINE INDENT *note statement: 2749.+ DEDENT
     statement:     *note stmt_list: 2748. NEWLINE | *note compound_stmt: 273b.
     stmt_list:     *note simple_stmt: 2705. (";" *note simple_stmt: 2705.)* [";"]

なお、文は常に ‘NEWLINE’ か、その後に ‘DEDENT’ が続いたもので終了します
。また、オプションの継続節は必ず、文を開始できない予約語で始まるので、曖
昧さは存在しません。 (Python では、 'ぶら下がり (dangling) *note else:
328.' 問題は、ネストされた *note if: 32a. 文をインデントさせることで解決
されます)。

以下の節における文法規則の記述方式は、明確さのために、各節を別々の行に書
くようにしています。
* 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: 32a. 文は、条件分岐を実行するために使われます:

     if_stmt: "if" *note assignment_expression: 2641. ":" *note suite: 2747.
              ("elif" *note assignment_expression: 2641. ":" *note suite: 2747.)*
              ["else" ":" *note suite: 2747.]

*note if: 32a. 文は、式を一つ一つ評価してゆき、真になるまで続けて、真に
なった節のスイートだけを選択します (真: true と偽: false の定義について
は、 *note ブール演算 (boolean operation): 26ee. 節を参照してください);
次に、選択したスイートを実行します (そして、 ‘if’ 文の他の部分は、実行や
評価をされません)。全ての式が偽になった場合、 *note else: 328. 節があれ
ば、そのスイートが実行されます。


File: python.info,  Node: while 文,  Next: for 文<2>,  Prev: if 文<2>,  Up: 複合文 compound statement

4.8.2 ‘while’ 文
----------------

*note while: 1ba5. 文は、式の値が真である間、実行を繰り返すために使われ
ます:

     while_stmt: "while" *note assignment_expression: 2641. ":" *note suite: 2747.
                 ["else" ":" *note suite: 2747.]

*note while: 1ba5. 文は式を繰り返し真偽評価し、真であれば最初のスイート
を実行します。式が偽であれば (最初から偽になっていることもありえます)、
‘else’ 節がある場合にはそれを実行し、ループを終了します。

最初のスイート内で *note break: 42f. 文が実行されると、 ‘else’ 節のスイ
ートを実行することなくループを終了します。 *note continue: 430. 文が最初
のスイート内で実行されると、スイート内にある残りの文の実行をスキップして
、式の真偽評価に戻ります。


File: python.info,  Node: for 文<2>,  Next: try 文,  Prev: while 文,  Up: 複合文 compound statement

4.8.3 ‘for’ 文
--------------

*note for: 329. 文は、シーケンス (文字列、タプルまたはリスト) や、その他
の反復可能なオブジェクト (iterable object) 内の要素に渡って反復処理を行
うために使われます:

     for_stmt: "for" *note target_list: 269e. "in" *note starred_expression_list: 26fb. ":" *note suite: 2747.
               ["else" ":" *note suite: 2747.]

The *note starred_expression_list: 26fb. expression is evaluated once;
it should yield an *note iterable: 149a. object.  An *note iterator:
6d4. 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): 263b.), 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: 42f. 文が実行されると、 ‘else’ 節のス
イートを実行することなくループを終了します。 *note continue: 430. 文が最
初のスイート内で実行されると、スイート内にある残りの文の実行をスキップし
て、次の要素の処理に移るか、これ以上次の要素が無い場合は ‘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(): d13. は、 整数の不変算術列を表します。例えば、 ‘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: 274e. | *note try2_stmt: 274f. | *note try3_stmt: 2750.
     try1_stmt: "try" ":" *note suite: 2747.
                ("except" [*note expression: 431. ["as" *note identifier: 24d0.]] ":" *note suite: 2747.)+
                ["else" ":" *note suite: 2747.]
                ["finally" ":" *note suite: 2747.]
     try2_stmt: "try" ":" *note suite: 2747.
                ("except" "*" *note expression: 431. ["as" *note identifier: 24d0.] ":" *note suite: 2747.)+
                ["else" ":" *note suite: 2747.]
                ["finally" ":" *note suite: 2747.]
     try3_stmt: "try" ":" *note suite: 2747.
                "finally" ":" *note suite: 2747.

例外に関するその他の情報は *note 例外: 2647. 節にあります。また、 *note
raise: 9e9. 文の使用による例外の生成に関する情報は、 *note raise 文:
9e9. 節にあります。

バージョン 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: adb. 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:
1574. of the exception object, or to a tuple that contains such a class.

例外がどの ‘except’ 節にも合致しなかった場合、現在のコードを囲うさらに外
側、そして呼び出しスタックへと検索を続けます。 (1)

‘except’ 節のヘッダにある式を値評価するときに例外が発生すると、元々のハ
ンドラ検索はキャンセルされ、新たな例外に対する例外ハンドラの検索を現在の
*note except: 44e. 節の外側のコードや呼び出しスタックに対して行います
(*note try: adb. 文全体が例外を発行したかのように扱われます)。

対応する ‘except’ 節が見つかると、‘except’ 節のスイートが実行されます。
その際、 ‘as’ キーワードが ‘except’ 節に存在すれば、その後で指定されてい
るターゲットに例外が代入されます。全ての ‘except’ 節は実行可能なブロック
を持っていなければなりません。このブロックの末尾に到達すると、通常は
*note try: adb. 文全体の直後から実行を継続します。(このことは、ネストさ
れた二つの例外ハンドラが同じ例外に対して存在し、内側のハンドラ内の ‘try’
節で例外が発生した場合、外側のハンドラはその例外を処理しないことを意味し
ます。)

例外が ‘as target’ を使って代入されたとき、それは ‘except’ 節の終わりに
消去されます。これはちょうど、以下のコード:

     except E as N:
         foo

が、以下のコードに翻訳されたかのようなものです:

     except E as N:
         try:
             foo
         finally:
             del N

よって、例外を ‘except’ 節以降で参照できるようにするためには、別の名前に
代入されなければなりません。例外が削除されるのは、トレースバックが付与さ
れると、そのスタックフレームと循環参照を形作り、次のガベージ収集までその
フレーム内のすべての局所変数を生存させてしまうからです。

‘except’ 節のスイートが実行される前に、例外が *note sys: e2. モジュール
に格納されます。 ‘except’ 節の中では、 *note sys.exception(): a80. を呼
び出す事によってこの例外にアクセスすることができます。 例外ハンドラを抜
けると、 ‘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: 453. 節が無い場合
にのみ呼び出しスタックへ伝わります。新しい例外によって、古い例外は失われ
ます。


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: 76d. instances).  A *note try:
adb. statement can have either *note except: 44e. 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: 29c.
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(): 1b18.) 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(): a80.) 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: adb. 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: 76d.:

     >>> try:
     ...     raise BlockingIOError
     ... except* BlockingIOError as e:
     ...     print(repr(e))
     ...
     ExceptionGroup('', (BlockingIOError(),))

*note break: 42f, *note continue: 430. and *note return: 452. 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: adb. スイート
を抜け、例外が送出されず、 *note return: 452. 文、 *note continue: 430.
文、 *note break: 42f. 文のいずれもが実行されなかった場合に実行されます
。 ‘else’ 節で起きた例外は、手前にある *note except: 44e. 節では処理され
ません。


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: adb. clause is executed, including any *note except: 44e. and *note
else: 2754. 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: 452, *note
break: 42f. or *note continue: 430. statement, the saved exception is
discarded.  For example, this function returns 42.

     def f():
         try:
             1/0
         finally:
             return 42

‘finally’ 節を実行している間は、プログラムからは例外情報は利用できません
。

*note try: adb...‘finally’ 文の ‘try’ スイート内で *note return: 452. 、
*note break: 42f. 、または *note continue: 430. 文が実行された場合、
‘finally’ 節も、この文を '抜け出る途中に' 実行されます。

The return value of a function is determined by the last *note return:
452. 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: 430. 文は不正でした。

バージョン 3.14 で変更: The compiler emits a *note SyntaxWarning: 451.
when a *note return: 452, *note break: 42f. or *note continue: 430.
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: 215. 文は、ブロックの実行を、コンテキストマネージャによって
定義されたメソッドでラップするために使われます (*note
with文とコンテキストマネージャ: 2591. セクションを参照してください)。こ
れにより、よくある *note try: adb...*note except: 44e...*note finally:
453. 利用パターンをカプセル化して便利に再利用することができます。

     with_stmt:          "with" ( "(" *note with_stmt_contents: 2758. ","? ")" | *note with_stmt_contents: 2758. ) ":" *note suite: 2747.
     with_stmt_contents: *note with_item: 2759. ("," *note with_item: 2759.)*
     with_item:          *note expression: 431. ["as" *note target: 271a.]

一つの "要素" を持つ *note with: 215. 文の実行は以下のように進行します:

  1. コンテキスト式 (*note with_item: 2759. で与えられた式) を評価するこ
     とで、コンテキストマネージャを取得します。

  2. コンテキストマネージャの *note __enter__(): 9cb. メソッドが、後で使
     うためにロードされます。

  3. コンテキストマネージャの *note __exit__(): 16ba. メソッドが、後で使
     うためにロードされます。

  4. コンテキストマネージャの *note __enter__(): 9cb. メソッドが呼ばれま
     す。

  5. *note with: 215. 文にターゲットが含まれていたら、それに *note
     __enter__(): 9cb. からの戻り値が代入されます。

          注釈: *note with: 215. 文は、 *note __enter__(): 9cb. メソッド
          がエラーなく終了した場合には *note __exit__(): 16ba. が常に呼
          ばれることを保証します。ですので、もしターゲットリストへの代入
          中にエラーが発生した場合には、これはそのスイートの中で発生した
          エラーと同じように扱われます。以下のステップ 7 を参照してくだ
          さい。

  6. スイートが実行されます。

  7. コンテキストマネージャの *note __exit__(): 16ba. メソッドが呼ばれま
     す。スイートが例外によって終了されたのなら、その例外の型、値、トレ
     ースバックが ‘__exit__()’ に引数として渡されます。そうでなければ、
     3 つの *note None: a6a. 引数が与えられます。

     スイートが例外により終了され、 *note __exit__(): 16ba. メソッドから
     の戻り値が偽（false）ならば、例外が再送出されます。この戻り値が真（
     true）ならば例外は抑制され、実行は *note with: 215. 文の次の文から
     続きます。

     もしそのスイートが例外でない何らかの理由で終了した場合、その *note
     __exit__(): 16ba. からの戻り値は無視されて、実行は発生した終了の種
     類に応じた通常の位置から継続します。

以下のコード:

     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: 25c5. is used for
*note __enter__(): 9cb. and *note __exit__(): 16ba.

複数の要素があるとき、コンテキストマネージャは複数の *note with: 215. 文
がネストされたかのように進行します:

     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: 215. 文の仕様、背景、および例が記載されていま
     す。

   ---------- 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: 275c. ":" NEWLINE INDENT *note case_block: 275d.+ DEDENT
     subject_expr: *note flexible_expression: 269c. "," [*note flexible_expression_list: 26a4. [',']]
                   | *note assignment_expression: 2641.
     case_block:   'case' *note patterns: 275e. [*note guard: 275f.] ":" `!block`

     注釈: このセクションでは、一重引用符で囲まれているものは *note
     ソフトキーワード: bea. を表します。

パターンマッチングは、パターン (‘case’ の後ろ) とマッチング対象の値
(‘match’ の後ろ)を入力とします。 パターン (サブパターンを含みうる) は、
マッチング対象の値に対して、マッチするかどうかの判定が行われます。結果と
して次のことが起こります:

   * マッチ成功、もしくはマッチ失敗 (パターン成功・失敗とも呼ばれます)。

   * マッチした値の名前への束縛。必要な条件は後述します。

‘match’ と ‘case’ キーワードは *note ソフトキーワード: bea. です。

参考
....

   * 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 通常のルール: 2761. に
     従ってタプルが作成されます。

  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: 2641.

‘guard’ (‘case’ 一部として現れる) が成功してはじめて、その ‘case’ ブロッ
クのコードが実行されます。 ガードは *note if: 32a. の後に式を書く形で表
記されます。

‘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 パターン: 2765.

   * 含まれるパターンのうち少なくとも一つが論駁不可能である *note OR
     パターン: 2766.

   * *note キャプチャパターン: 2767.

   * *note ワイルドカードパターン: beb.

   * 括弧で囲われた、論駁不可能なパターン


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: 2769. | *note pattern: 276a.
     pattern:        *note as_pattern: 276b. | *note or_pattern: 276c.
     closed_pattern: | *note literal_pattern: 276e.
                     | *note capture_pattern: 276f.
                     | *note wildcard_pattern: 2770.
                     | *note value_pattern: 2771.
                     | *note group_pattern: 2772.
                     | *note sequence_pattern: 2773.
                     | *note mapping_pattern: 2774.
                     | *note class_pattern: 2775.

以下の説明では分かりやすさのため、パターンの振る舞いを簡単に言い表した場
合の説明を「簡単に言うと」の後に書いています (そのほとんどは、Raymond
Hettinger 氏のドキュメントに影響を受けてのものです)。 ただし、これはあく
まで理解を助けるためのであり、内部的な実装を必ずしも反映したものでは 'あ
りません' 。 また、使用可能なすべてのパターン構造を網羅しているわけでは
ありません。

* Menu:

* OR パターン::
* AS パターン::
* リテラルパターン::
* キャプチャパターン::
* ワイルドカードパターン::
* 値パターン::
* グループパターン::
* シーケンスパターン::
* マッピングパターン::
* クラスパターン::


File: python.info,  Node: OR パターン,  Next: AS パターン,  Up: パターン

4.8.6.5 OR パターン
...................

OR パターンは、縦線 ‘|’ で区切られた複数のパターンからなります。 構文:

     or_pattern: "|".*note closed_pattern: 276d.+

最後のサブパターン以外、 *note 論駁不可能: 2763. であってはいけません。
また、曖昧さ回避のため、各サブパターンが束縛する名前の組み合わせは、すべ
て同じである必要があります。

OR パターンでは、サブジェクト値に対して順に各サブパターンのマッチングが
行われます。 マッチが成功するとそこで終了し、この OR パターンは成功した
とみなされます。 一方、どのサブパターンも成功しなければ、この OR パター
ンは失敗したことになります。

簡単に言うと、 ‘P1 | P2 | ...’ というパターンは ‘P1’ をマッチしようとし
、失敗すれば ‘P2’ を試します。 いずれかのパターンがマッチが成功すれば直
ちに成功となり、それ以外の場合は失敗となります。


File: python.info,  Node: AS パターン,  Next: リテラルパターン,  Prev: OR パターン,  Up: パターン

4.8.6.6 AS パターン
...................

AS パターンはサブジェクト値に対して、 *note as: 2756. キーワードの左側に
ある OR パターンをマッチさせます。 構文:

     as_pattern: *note or_pattern: 276c. "as" *note capture_pattern: 276f.

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 リテラル: 24d8. に対応し
ます。 構文:

     literal_pattern: *note signed_number: 277a.
                      | *note signed_number: 277a. "+" NUMBER
                      | *note signed_number: 277a. "-" NUMBER
                      | *note strings: 2693.
                      | "None"
                      | "True"
                      | "False"
     signed_number:   ["+" | "-"] NUMBER

The rule ‘strings’ and the token ‘NUMBER’ are defined in the *note
standard Python grammar: 277b.  Triple-quoted strings are supported.
Raw strings and byte strings are supported.  *note f-strings: 441. and
*note t-strings: 1a70. are not supported.

‘signed_number '+' NUMBER’ と ‘signed_number '-' NUMBER’ という構文は
*note 複素数: 252a. を表現するためのものです。 そのため、左側には実数、
右側には虚数を書く必要があります。 例: ‘3 + 4j’ 。

簡単に言うと、 ‘LITERAL’ は ‘<subject> == LITERAL’ であるときのみ成功す
るパターンです。 シングルトンである ‘None’ と ‘True’ 、 ‘False’ は *note
is: 32c. 演算子を使って比較されます。


File: python.info,  Node: キャプチャパターン,  Next: ワイルドカードパターン,  Prev: リテラルパターン,  Up: パターン

4.8.6.8 キャプチャパターン
..........................

キャプチャパターンは、サブジェクト値を名前に束縛します。 構文:

     capture_pattern: !'_' NAME

アンダースコア一文字の ‘_’ はキャプチャパターンではありません (‘!'_'’ が
表しているのはこの条件です) 。 *note wildcard_pattern: 2770. として扱わ
れます。

パターン一つの中で、一つの名前は一度しか束縛することができません。 例え
ば、 ‘case x, x: ...’ は間違いですが、 ‘case [x] | x: ...’ は正しいです
。

キャプチャパターンは常に成功します。 束縛された名前のスコープは、 PEP
572(1) で確立された代入式演算子のスコープルールと同じです。 すなわち、当
てはまる *note global: 6bb. 文 か *note nonlocal: 1661. 文がない限り、そ
の局所変数のスコープは、該当の 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 ソフトキーワード: bea.
です。 しかし、パターンの中でない場合はソフトキーワードではありません。
たとえサブジェクト式や ‘guard’ 、 ‘case’ ブロックの中でも、通常の変数と
なります。

簡単に言うと、 ‘_’ は常に成功します。


File: python.info,  Node: 値パターン,  Next: グループパターン,  Prev: ワイルドカードパターン,  Up: パターン

4.8.6.10 値パターン
...................

値パターンは Python で名前の付けられた値を表します。 構文:

     value_pattern: *note attr: 2780.
     attr:          *note name_or_attr: 2781. "." NAME
     name_or_attr:  *note attr: 2780. | NAME

ドットがついたこの名前は、Python 標準の *note 名前解決ルール: 263e. によ
って解決されます。 このパターンは、解決された値がサブジェクト値と等しい
(比較演算子 ‘==’ に基づく) ときに成功となります。

簡単に言うと、 ‘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: 276a. ")"

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: 2786.] "]"
                             | "(" [*note open_sequence_pattern: 2769.] ")"
     open_sequence_pattern:  *note maybe_star_pattern: 2787. "," [*note maybe_sequence_pattern: 2786.]
     maybe_sequence_pattern: ",".*note maybe_star_pattern: 2787.+ ","?
     maybe_star_pattern:     *note star_pattern: 2788. | *note pattern: 276a.
     star_pattern:           "*" (*note capture_pattern: 276f. | *note wildcard_pattern: 2770.)

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: 2782.  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(): a24. (i.e.  via the *note __len__(): 19aa. protocol).
          This length may be cached by the interpreter in a similar
          manner as *note value patterns: 277f.

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: 1582. を継承したクラス。

   * *note collections.abc.Sequence: 1582. として登録されたPythonクラス
     。

   * a builtin class that has its (CPython) *note Py_TPFLAGS_SEQUENCE:
     1e6f. bit set

   * a class that inherits from any of the above

The following standard library classes are sequences:

   * *note array.array: 6cb.

   * *note collections.deque: 9db.

   * *note list: 4e0.

   * *note memoryview: 1dd.

   * *note range: d13.

   * *note tuple: 1d9.

     注釈: 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: 278b.] "}"
     items_pattern:       ",".*note key_value_pattern: 278c.+ ","?
     key_value_pattern:   (*note literal_pattern: 276e. | *note value_pattern: 2771.) ":" *note pattern: 276a.
                          | *note double_star_pattern: 278d.
     double_star_pattern: "**" *note capture_pattern: 276f.

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: 189.  Two keys that otherwise have
the same value will raise a *note ValueError: 15a. 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: 189. is raised for
     duplicate literal values; or a *note ValueError: 15a. 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__(): 157b. or *note __getitem__(): 78d.

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: ca0.

   * a Python class that has been registered as *note
     collections.abc.Mapping: ca0.

   * a builtin class that has its (CPython) *note Py_TPFLAGS_MAPPING:
     1e6e. bit set

   * a class that inherits from any of the above

The standard library classes *note dict: 193. and *note
types.MappingProxyType: 194. 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: 2781. "(" [*note pattern_arguments: 2790. ","?] ")"
     pattern_arguments:   *note positional_patterns: 2791. ["," *note keyword_patterns: 2792.]
                          | *note keyword_patterns: 2792.
     positional_patterns: ",".*note pattern: 276a.+
     keyword_patterns:    ",".*note keyword_pattern: 2793.+
     keyword_pattern:     NAME "=" *note pattern: 276a.

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:
     191. , raise *note TypeError: 29c.

  2. If the subject value is not an instance of ‘name_or_attr’ (tested
     via *note isinstance(): 2fb.), 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: 1b4, the exception bubbles up.

             * If this raises *note AttributeError: 1b4, 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__: 1e8b. 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: 29c. is raised.

             * If there are more positional patterns than
               ‘len(cls.__match_args__)’, *note TypeError: 29c. 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: 29c. is raised.

             * If there are duplicate keywords, *note TypeError: 29c. is
               raised.

          参考
          ....

          *note クラスパターンマッチの位置引数のカスタマイズ: 2621.

       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: 5f6.

        * *note bytearray: 1d1.

        * *note bytes: 1d2.

        * *note dict: 193.

        * *note float: 32f.

        * *note frozenset: 9d9.

        * *note int: 32e.

        * *note list: 4e0.

        * *note set: 432.

        * *note str: 1ea.

        * *note tuple: 1d9.

     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 標準型の階層:
253e. 節参照):

     funcdef:                   [*note decorators: 2795.] "def" *note funcname: 2796. [*note type_params: 2736.] "(" [*note parameter_list: 26f9.] ")"
                                ["->" *note expression: 431.] ":" *note suite: 2747.
     decorators:                *note decorator: 2797.+
     decorator:                 "@" *note assignment_expression: 2641. NEWLINE
     parameter_list:            *note defparameter: 2798. ("," *note defparameter: 2798.)* "," "/" ["," [*note parameter_list_no_posonly: 2799.]]
                                  | *note parameter_list_no_posonly: 2799.
     parameter_list_no_posonly: *note defparameter: 2798. ("," *note defparameter: 2798.)* ["," [*note parameter_list_starargs: 279a.]]
                                | *note parameter_list_starargs: 279a.
     parameter_list_starargs:   "*" [*note star_parameter: 279b.] ("," *note defparameter: 2798.)* ["," [*note parameter_star_kwargs: 279c.]]
                                | "*" ("," *note defparameter: 2798.)+ ["," [*note parameter_star_kwargs: 279c.]]
                                | *note parameter_star_kwargs: 279c.
     parameter_star_kwargs:     "**" *note parameter: 279d. [","]
     parameter:                 *note identifier: 24d0. [":" *note expression: 431.]
     star_parameter:            *note identifier: 24d0. [":" ["*"] *note expression: 431.]
     defparameter:              *note parameter: 279d. ["=" *note expression: 431.]
     funcname:                  *note identifier: 24d0.

関数定義は実行可能な文です。関数定義を実行すると、現在のローカルな名前空
間内で関数名を関数オブジェクト (関数の実行可能コードをくるむラッパー) に
束縛します。この関数オブジェクトには、関数が呼び出された際に使われるグロ
ーバルな名前空間として、現在のグローバルな名前空間への参照が入っています
。

関数定義は関数本体を実行しません; 関数本体は関数が呼び出された時にのみ実
行されます。 (1)

関数定義は一つ以上の *note デコレータ: b1d. 式でラップできます。デコレー
タ式は関数を定義するとき、関数定義の入っているスコープで評価されます。そ
の結果は、関数オブジェクトを唯一の引数にとる呼び出し可能オブジェクトでな
ければなりません。関数オブジェクトの代わりに、返された値が関数名に束縛さ
れます。複数のデコレータはネストして適用されます。例えば、以下のようなコ
ード:

     @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: 2641.  Previously, the grammar was much more
restrictive; see PEP 614(2) for details.

A list of *note type parameters: 7ab. 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__: 255c. attribute.  See *note
Generic functions: 874. for more.

バージョン 3.12 で変更: Type parameter lists are new in Python 3.12.

1 つ以上の *note 仮引数: 255a. が 'parameter' ‘=’ 'expression' の形を取
っているとき、関数は "デフォルト引数値" を持つと言います。デフォルト値を
持つ仮引数では、呼び出し時にそれに対応する *note 実引数: 86d. は省略でき
、その場合は仮引数のデフォルト値が使われます。ある引数がデフォルト値を持
っている場合、それ以降 "‘*’" が出てくるまでの引数は全てデフォルト値を持
っていなければなりません - これは文法定義では表現されていない構文的制限
です。

'デフォルト引数値は関数定義が実行されるときに左から右へ評価されます。' こ
れは、デフォルト引数の式は関数が定義されるときにただ一度だけ評価され、同
じ "計算済みの" 値が呼び出しのたびに使用されることを意味します。この仕様
を理解しておくことは特に、デフォルト引数値がリストや辞書のようなミュータ
ブルなオブジェクトであるときに重要です: 関数がこのオブジェクトを変更 (例
えばリストに要素を追加) すると、このデフォルト引数値が変更の影響を受けて
しまします。一般には、これは意図しない動作です。このような動作を避けるに
は、デフォルト値として ‘None’ を使い、この値を関数本体の中で明示的にテス
トします。例えば以下のようにします:

     def whats_on_the_telly(penguin=None):
         if penguin is None:
             penguin = []
         penguin.append("property of the zoo")
         return penguin

関数呼び出しの意味付けに関する詳細は、 *note 呼び出し (call): 113a. 節で
述べられています。 関数呼び出しを行うと、パラメタリストに記述された全て
のパラメタに、位置引数、キーワード引数、デフォルト値のいずれかから値が代
入されます。 "‘*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: 2225. 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: 279e. for more information on annotations.

バージョン 3.11 で変更: Parameters of the form "‘*identifier’" may have
an annotation "‘: *expression’".  See PEP 646(4).

式を即時に使用するために、無名関数 (名前に束縛されていない関数) を作成す
ることもできます。 これは *note ラムダ (lambda): 1657. の節で解説されて
いるラムダ式を使います。 ラムダ式は簡略化された関数定義の簡略表現に過ぎ
ないことに注意してください; "*note def: 1812." 文で定義された関数もラム
ダ式で作成された関数のように、引数として渡せたり、他の名前に割り当てるこ
とができます。 複数の式とアノテーションが実行できるので、 "‘def’" 形式の
方がより強力です。

'プログラマへのメモ:' 関数は第一級オブジェクトです。関数定義内で実行され
た "‘def’" 文は、返り値や引数として渡せるローカル関数を定義します。ネス
トした関数内で使われる自由変数は、 def を含んでいる関数のローカル変数に
アクセスできます。詳細は *note 名前づけと束縛 (naming and binding):
2555. 節を参照してください。

参考
....

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__: 1597. attribute
and therefore the function's *note docstring: 24fb.

   (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 標準型の階層: 253e.
節参照):

     classdef:    [*note decorators: 2795.] "class" *note classname: 27a0. [*note type_params: 2736.] [*note inheritance: 27a1.] ":" *note suite: 2747.
     inheritance: "(" [*note argument_list: 26ce.] ")"
     classname:   *note identifier: 24d0.

クラス定義は実行可能な文です。継承リストは通常、基底クラスリストを与えま
す (より高度な使い方は、 *note メタクラス: 25d2. を参照してください)。で
すから、リストのそれぞれの要素の評価はサブクラス化しても良いクラスである
べきです。継承リストのないクラスは、デフォルトで、基底クラス *note
object: e51. を継承するので:

     class Foo:
         pass

は、以下と同等です

     class Foo(object):
         pass

There may be one or more base classes; see *note Multiple inheritance:
22af. below for more information.

次にクラスのスイートが、新たな実行フレーム (*note 名前づけと束縛 (naming
and binding): 2555. を参照してください) 内で、新たに作られたローカル名前
空間と元々のグローバル名前空間を使って実行されます (通常、このスイートに
は主に関数定義が含まれます)。クラスのスイートが実行し終えると、実行フレ
ームは破棄されますが、ローカルな名前空間は保存されます。(1) 次に、継承リ
ストを基底クラスに、保存されたローカル名前空間を属性値辞書に、それぞれ使
ってクラスオブジェクトが生成されます。最後に、もとのローカル名前空間にお
いて、クラス名がこのクラスオブジェクトに束縛されます。

The order in which attributes are defined in the class body is preserved
in the new class's *note __dict__: 101f.  Note that this is reliable
only right after the class is created and only for classes that were
defined using the definition syntax.

クラス作成は、 *note メタクラス: 25d2. を利用して大幅にカスタマイズでき
ます。

関数をデコレートするのと同じように、クラスもデコレートすることが出来ます
、

     @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: 2641.  Previously, the grammar was much more
restrictive; see PEP 614(2) for details.

A list of *note type parameters: 7ab. 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__: 2586. attribute.
See *note Generic classes: 2587. for more.

バージョン 3.12 で変更: Type parameter lists are new in Python 3.12.

'プログラマのための注釈:' クラス定義内で定義された変数はクラス属性であり
、全てのインスタンス間で共有されます。インスタンス属性は、メソッドの中で
‘self.name = value’ とすることで設定できます。クラス属性もインスタンス属
性も "‘self.name’" 表記でアクセスでき、この表記でアクセスしたとき、イン
スタンス属性は同名のクラス属性を隠蔽します。クラス属性は、インスタンス属
性のデフォルト値として使えますが、そこにミュータブルな値を使うと予期せぬ
結果につながります。 *note 記述子: 1011. を使うと、詳細な実装が異なるイ
ンスタンス変数を作成できます。

参考
....

PEP 3115(3) - Metaclasses in Python 3000

     メタクラスの宣言を現在の文法と、メタクラス付きのクラスがどのように
     構築されるかの意味論を変更した提案

PEP 3129(4) - クラスデコレータ

     クラスデコレータを追加した提案。 関数デコレータとメソッドデコレータ
     は PEP 318(5) で導入されました。

* Menu:

* Multiple inheritance::

   ---------- Footnotes ----------

   (1) A string literal appearing as the first statement in the class
body is transformed into the namespace's *note __doc__: 22a2. item and
therefore the class's *note docstring: 24fb.

   (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: Multiple inheritance,  Up: クラス定義

4.8.8.1 Multiple inheritance
............................

Python classes may have multiple base classes, a technique known as
'multiple inheritance'.  The base classes are specified in the class
definition by listing them in parentheses after the class name,
separated by commas.  For example, the following class definition:

     >>> class A: pass
     >>> class B: pass
     >>> class C(A, B): pass

defines a class ‘C’ that inherits from classes ‘A’ and ‘B’.

The *note method resolution order: 27a3. (MRO) is the order in which
base classes are searched when looking up an attribute on a class.  See
*note The Python 2.3 Method Resolution Order: 1862. for a description of
how Python determines the MRO for a class.

Multiple inheritance is not always allowed.  Attempting to define a
class with multiple inheritance will raise an error if one of the bases
does not allow subclassing, if a consistent MRO cannot be created, if no
valid metaclass can be determined, or if there is an instance layout
conflict.  We'll discuss each of these in turn.

First, all base classes must allow subclassing.  While most classes
allow subclassing, some built-in classes do not, such as *note bool:
5f6.:

     >>> class SubBool(bool):  # TypeError
     ...    pass
     Traceback (most recent call last):
        ...
     TypeError: type 'bool' is not an acceptable base type

In the resolved MRO of a class, the class's bases appear in the order
they were specified in the class's bases list.  Additionally, the MRO
always lists a child class before any of its bases.  A class definition
will fail if it is impossible to resolve a consistent MRO that satisfies
these rules from the list of bases provided:

     >>> class Base: pass
     >>> class Child(Base): pass
     >>> class Grandchild(Base, Child): pass  # TypeError
     Traceback (most recent call last):
        ...
     TypeError: Cannot create a consistent method resolution order (MRO) for bases Base, Child

In the MRO of ‘Grandchild’, ‘Base’ must appear before ‘Child’ because it
is first in the base class list, but it must also appear after ‘Child’
because it is a parent of ‘Child’.  This is a contradiction, so the
class cannot be defined.

If some of the bases have a custom *note metaclass: 25e4, the metaclass
of the resulting class is chosen among the metaclasses of the bases and
the explicitly specified metaclass of the child class.  It must be a
metaclass that is a subclass of all other candidate metaclasses.  If no
such metaclass exists among the candidates, the class cannot be created,
as explained in *note 適切なメタクラスの決定: 25d5.

Finally, the instance layouts of the bases must be compatible.  This
means that it must be possible to compute a 'solid base' for the class.
Exactly which classes are solid bases depends on the Python
implementation.

'CPython 実装の詳細:' In CPython, a class is a solid base if it has a
nonempty *note __slots__: 18a3. definition.  Many but not all classes
defined in C are also solid bases, including most builtins (such as
*note int: 32e. or *note BaseException: 9bd.) but excluding most
concrete *note Exception: da2. classes.  Generally, a C class is a solid
base if its underlying struct is different in size from its base class.

Every class has a solid base.  *note object: e51, the base class, has
itself as its solid base.  If there is a single base, the child class's
solid base is that class if it is a solid base, or else the base class's
solid base.  If there are multiple bases, we first find the solid base
for each base class to produce a list of candidate solid bases.  If
there is a unique solid base that is a subclass of all others, then that
class is the solid base.  Otherwise, class creation fails.

例:

     >>> class Solid1:
     ...    __slots__ = ("solid1",)
     >>>
     >>> class Solid2:
     ...    __slots__ = ("solid2",)
     >>>
     >>> class SolidChild(Solid1):
     ...    __slots__ = ("solid_child",)
     >>>
     >>> class C1:  # solid base is `object`
     ...    pass
     >>>
     >>> # OK: solid bases are `Solid1` and `object`, and `Solid1` is a subclass of `object`.
     >>> class C2(Solid1, C1):  # solid base is `Solid1`
     ...    pass
     >>>
     >>> # OK: solid bases are `SolidChild` and `Solid1`, and `SolidChild` is a subclass of `Solid1`.
     >>> class C3(SolidChild, Solid1):  # solid base is `SolidChild`
     ...    pass
     >>>
     >>> # Error: solid bases are `Solid1` and `Solid2`, but neither is a subclass of the other.
     >>> class C4(Solid1, Solid2):  # error: no single solid base
     ...    pass
     Traceback (most recent call last):
       ...
     TypeError: multiple bases have instance lay-out conflict


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: 2795.] "async" "def" *note funcname: 2796. "(" [*note parameter_list: 26f9.] ")"
                    ["->" *note expression: 431.] ":" *note suite: 2747.

Python で実行しているコルーチンは多くの時点で一時停止と再開ができます
(*note coroutine: 8a7. を参照)。*note await: 439. 式である *note async
for: e74. と *note async with: 216. はコルーチン関数の本体でしか使えませ
ん。

Functions defined with ‘async def’ syntax are always coroutine
functions, even if they do not contain ‘await’ or ‘async’ keywords.

コルーチン関数の本体の中で ‘yield from’ 式を使用すると *note
SyntaxError: 189. になります。

コルーチン関数の例:

     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: 273e.

*note asynchronous iterable: 1131. は、その ‘__anext__’ メソッドで非同期
なコードを実行可能な、*note asynchronous iterator: 6d3. を直接返す
‘__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: 25c5. is used for
*note __aiter__(): fbf. and *note __anext__(): 1ac6.

コルーチン関数の本体の外で ‘async for’ 文を使用すると *note SyntaxError:
189. になります。


File: python.info,  Node: async with 文,  Prev: async for 文,  Up: コルーチン<2>

4.8.9.3 ‘async with’ 文
.......................

     async_with_stmt: "async" *note with_stmt: 2740.

*note asynchronous context manager: 9d7. は、 'enter' メソッドと 'exit'
メソッド内部で実行を一時停止できる *note context manager: 47f. です。

以下のコード:

     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: 25c5. is used for
*note __aenter__(): 2631. and *note __aexit__(): 1bcc.

コルーチン関数の本体の外で ‘async with’ 文を使用すると *note
SyntaxError: 189. になります。

参考
....

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: 27a9. ("," *note type_param: 27a9.)* "]"
     type_param:   *note typevar: 27aa. | *note typevartuple: 27ab. | *note paramspec: 27ac.
     typevar:      *note identifier: 24d0. (":" *note expression: 431.)? ("=" *note expression: 431.)?
     typevartuple: "*" *note identifier: 24d0. ("=" *note expression: 431.)?
     paramspec:    "**" *note identifier: 24d0. ("=" *note expression: 431.)?

*note Functions: 1812. (including *note coroutines: 9d4.), *note
classes: 1691. and *note type aliases: 860. 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:
6ba.) that wraps the creation of the generic object.

Generic functions, classes, and type aliases have a *note
__type_params__: 27ad. attribute listing their type parameters.

Type parameters come in three kinds:

   * *note typing.TypeVar: 29f, introduced by a plain name (e.g., ‘T’).
     Semantically, this represents a single type to a type checker.

   * *note typing.TypeVarTuple: 29e, 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: 2a0, introduced by a name prefixed with two
     asterisks (e.g., ‘**P’).  Semantically, this stands for the
     parameters of a callable.

*note typing.TypeVar: 29f. 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: 6ba.

*note typing.TypeVarTuple: 29e.s and *note typing.ParamSpec: 2a0.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:
6ba.  If no default value is specified for a type parameter, the
‘__default__’ attribute is set to the special sentinel object *note
typing.NoDefault: 770.

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: 6ba, 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: 10d. module, but creates an instance of *note
typing.TypeVar: 29f. 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: 877. of the *note TypeVar: 29f.
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: 6ba, and the name ‘TYPE_PARAMS_OF_Bag’ is not actually
bound at runtime.

Generic classes implicitly inherit from *note typing.Generic: 1a12.  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: 860. statement can also be used to create a generic type
alias:

     type ListOrSet[T] = list[T] | set[T]

Except for the *note lazy evaluation: 877. 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: 6ba.  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: 410,
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: 25e0, 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: 32. or
*note functools.singledispatch(): a2f.).

By default, annotations are lazily evaluated in an *note annotation
scope: 6ba.  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: 677. ‘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(): 673. and *note typing.get_type_hints():
aa3. 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: e2. (様
々なシステムサービス)、 *note builtins: 13. (組み込み関数、例外、および
‘None’)、 *note __main__: 1. の 3 つを除く全てのモジュールが初期化されて
いない状態で動作します。 ‘__main__’ は、完全なプログラムを実行する際に、
ローカルおよびグローバルな名前空間を提供するために用いられます。

完全な Python プログラムの構文は、下の節で述べるファイル入力のためのもの
です。

インタプリタは、対話的モード (interactive mode) で起動されることもありま
す; この場合、インタプリタは完全なプログラムを読んで実行するのではなく、
一度に単一の実行文 (複合文のときもあります) を読み込んで実行します。初期
状態の環境は、完全なプログラムを実行するときの環境と同じです; 各実行文は
、 *note __main__: 1. の名前空間内で実行されます。

完全なプログラムは3つの形式でインタープリタに渡せます: *note -c: 44c.
'string' コマンドラインオプションで、コマンドラインの第 1 引数で渡される
ファイル、あるいは標準入力として渡します。 ファイルや標準入力が tty デバ
イスだった場合、インタープリタは対話モードに入ります。 それ以外の場合は
、ファイルを完全なプログラムとして実行します。


File: python.info,  Node: ファイル入力,  Next: 対話的入力,  Prev: 完全な Python プログラム,  Up: トップレベル要素

4.9.2 ファイル入力
------------------

非対話的なファイルから読み出された入力は、全て同じ形式:

     file_input: (NEWLINE | *note statement: 2749.)* ENDMARKER

をとります。この構文法は、以下の状況で用いられます:

   * (ファイルや文字列内の) 完全な Python プログラムを構文解析するとき;

   * モジュールを構文解析するとき;

   * *note exec(): 190. で渡された文字列を構文解析するとき;


File: python.info,  Node: 対話的入力,  Next: 式入力,  Prev: ファイル入力,  Up: トップレベル要素

4.9.3 対話的入力
----------------

対話モードでの入力は、以下の文法の下に構文解析されます:

     interactive_input: [*note stmt_list: 2748.] NEWLINE | *note compound_stmt: 273b. NEWLINE | ENDMARKER

対話モードでは、(トップレベルの) 複合文の最後に空白行を入れなくてはなら
ないことに注意してください; これは、複合文の終端をパーザが検出するための
手がかりとして必要です。


File: python.info,  Node: 式入力,  Prev: 対話的入力,  Up: トップレベル要素

4.9.4 式入力
------------

式入力には *note eval(): 18f. が使われます。これは先頭の空白を無視します
。 ‘eval()’ に対する文字列引数は、以下の形式をとらなければなりません:

     eval_input: *note expression_list: 26fc. 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: 2493. 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
         | &('import' | 'from' | "lazy") import_stmt
         | e=star_expressions { _PyAST_Expr(e, EXTRA) }
         | &'return' return_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 'from' b=expression { _PyAST_Raise(a, b, EXTRA) }
         | invalid_raise_stmt
         | 'raise' a=expression { _PyAST_Raise(a, NULL, 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]:
         | invalid_assert_stmt
         | 'assert' a=expression b=[',' z=expression { z }] { _PyAST_Assert(a, b, EXTRA) }

     import_stmt[stmt_ty](memo):
         | invalid_import
         | import_name
         | import_from

     # Import statements
     # -----------------

     import_name[stmt_ty]:
         | lazy="lazy"? 'import' a=dotted_as_names { _PyAST_Import(a, lazy ? 1 : 0, EXTRA) }

     # note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
     import_from[stmt_ty]:
         | lazy="lazy"? '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), lazy, EXTRA) }
         | lazy="lazy"? 'from' a=('.' | '...')+ 'import' b=import_from_targets {
             _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), lazy ? 1 : 0, 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 { number }
         | '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) }

     signed_real_number[expr_ty]:
         | real_number
         | '+' real=real_number { real }
         | '-' 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) }
         | '+' 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) }
         | invalid_mapping_pattern

     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_if_expression
         | invalid_expression
         | invalid_legacy_expression
         | if_expression
         | disjunction
         | lambdef

     if_expression[expr_ty]:
         | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) }

     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_expressions_sequence[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_named_expression_sequence+ [','] { a }

     star_named_expression[expr_ty]:
         | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }
         | named_expression

     star_named_expression_sequence[expr_ty]:
         | invalid_starred_expression_unpacking_sequence
         | star_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
         | &'(' (genexp | tuple | group)
         | &'[' (listcomp | list)
         | &'{' (dictcomp | setcomp | dict | set)
         | '...' { _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_sequence] ']' { _PyAST_List(a, Load, EXTRA) }

     tuple[expr_ty]:
         | '(' a=[y=star_named_expression_sequence ',' z=[star_named_expressions_sequence] { _PyPegen_seq_insert_in_front(p, y, z) } ] ')' {
             _PyAST_Tuple(a, Load, EXTRA) }

     set[expr_ty]: '{' a=star_named_expressions_sequence '}' { _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=star_named_expression b=for_if_clauses ']' { _PyAST_ListComp(a, b, EXTRA) }
         | invalid_comprehension

     setcomp[expr_ty]:
         | '{' a=star_named_expression b=for_if_clauses '}' { _PyAST_SetComp(a, b, EXTRA) }
         | invalid_comprehension

     genexp[expr_ty]:
         | '(' a=( assignment_expression | expression !':=' | starred_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) }
         | '{' '**' a=expression b=for_if_clauses '}' { _PyAST_DictComp(a, NULL, b, EXTRA) }

     # 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_raise_error_for_missing_comma(p, a, b) }
        | 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_if_expression:
        | disjunction 'if' b=disjunction 'else' a='*' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot unpack only part of a conditional expression") }
        | disjunction 'if' b=disjunction 'else' a='**' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use dict unpacking on only part of a conditional expression") }

     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_raise_stmt:
         | a='raise' b='from' {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "did you forget an expression between 'raise' and 'from'?") }
         | 'raise' expression a='from' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "did you forget an expression after 'from'?") }
     invalid_del_stmt:
         | 'del' a=star_expressions {
             RAISE_SYNTAX_ERROR_INVALID_TARGET(DEL_TARGETS, a) }
     invalid_assert_stmt:
         | 'assert' a=expression '=' b=expression {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(
                 a, b,
                 "cannot assign to %s here. Maybe you meant '==' instead of '='?",
                 _PyPegen_get_expr_name(a)) }
         | 'assert' expression ',' a=expression '=' b=expression {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(
                 a, b,
                 "cannot assign to %s here. Maybe you meant '==' instead of '='?",
                 _PyPegen_get_expr_name(a)) }
         | 'assert' a=expression ':=' b=expression {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(
                 a, b,
                 "cannot use named expression without parentheses here") }
         | 'assert' expression ',' a=expression ':=' b=expression {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(
                 a, b,
                 "cannot use named expression without parentheses here") }
     invalid_block:
         | NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block") }
     invalid_comprehension:
         | '[' a='**' b=expression for_if_clauses {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot use dict unpacking in list comprehension") }
         | '(' a='**' b=expression for_if_clauses {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot use dict unpacking in generator expression") }
         | ('[' | '{') 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_parameters:
         | a="/" ',' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "at least one parameter 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 parameters must follow bare *") }
         | '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR("bare * has associated type comment") }
         | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional parameter cannot have default value") }
         | '*' (param_no_default | ',') param_maybe_default* a='*' (param_no_default | ',') {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* may appear only once") }
     invalid_kwds:
         | '**' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-keyword parameter cannot have default value") }
         | '**' param ',' a=param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameters cannot follow var-keyword parameter") }
         | '**' param ',' a[Token*]=('*'|'**'|'/') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameters cannot follow var-keyword parameter") }
     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 parameter 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 parameters must follow bare *") }
         | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional parameter cannot have default value") }
         | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* a='*' (lambda_param_no_default | ',') {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* may appear only once") }
     invalid_lambda_kwds:
         | '**' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-keyword parameter cannot have default value") }
         | '**' lambda_param ',' a=lambda_param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameters cannot follow var-keyword parameter") }
         | '**' lambda_param ',' a[Token*]=('*'|'**'|'/') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameters cannot follow var-keyword parameter") }
     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])+ trailing=',' ':' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(trailing, "the last 'with' item has a trailing comma") }
         | ['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) }
         | a="case" patterns guard? b=':' block {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(
                 a, b,
                 "case statement must be inside match statement") }
     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_mapping_pattern:
         | '{' (items_pattern ',')? rest=double_star_pattern ',' items_pattern ','? '}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
             rest,
             "double star pattern must be the last (right-most) subpattern in the mapping pattern") }
     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:
         | invalid_kvpair_unpacking [',']
         | ','.double_starred_kvpair+ ',' (invalid_kvpair | invalid_kvpair_unpacking)
         | expression a=':' &('}'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }
     invalid_kvpair_unpacking:
         | a='**' b=if_expression {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid double starred expression. Did you forget to wrap the conditional expression in parentheses?") }
         | a='*' b=bitwise_or ':' expression { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot use a starred expression in a dictionary key") }
         | a='**' b=bitwise_or ':' expression { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot use dict unpacking in a dictionary key") }
         | expression ':' a='*' b=bitwise_or { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot use a starred expression in a dictionary value") }
         | expression ':' a='**' b=bitwise_or { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot use dict unpacking in a dictionary value") }
     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='**' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "cannot use dict unpacking in a dictionary value") }
         | expression a=':' &('}'|',') {RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }
     invalid_starred_expression_unpacking:
         | a='*' b=if_expression {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid starred expression. Did you forget to wrap the conditional expression in parentheses?") }
         | a='*' expression '=' b=expression { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot assign to iterable argument unpacking") }
     invalid_starred_expression_unpacking_sequence:
         | a='**' bitwise_or {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use dict unpacking here") }
         | invalid_starred_expression_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/main/Grammar/python.gram


File: python.info,  Node: Python 標準ライブラリ,  Next: Python インタプリタの拡張と埋め込み,  Prev: Python 言語リファレンス,  Up: Top

5 Python 標準ライブラリ
***********************

*note Python 言語リファレンス: 3ff. ではプログラミング言語 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:
9df. 文を使わずに使うことができるオブジェクトです。これらの組み込み要素
のうちいくつかは言語のコア部分で定義されていますが、大半は言語コアの意味
づけ上不可欠なものではないのでここでしか記述されていません。

とはいえ、このライブラリの大部分に収録されているのはモジュールのコレクシ
ョンです。このコレクションを細分化する方法はいろいろあります。あるモジュ
ールは C 言語で書かれ、Python インタプリタに組み込まれています; 一方別の
モジュールは Python で書かれ、ソースコードの形式で取り込まれます。またあ
るモジュールは、例えば実行スタックの追跡結果を出力するといった、Python に
非常に特化したインターフェースを提供し、一方他のモジュールでは、特定のハ
ードウェアにアクセスするといった、特定のオペレーティングシステムに特化し
たインターフェースを提供し、さらに別のモジュールでは WWW (ワールドワイド
ウェブ) のような特定のアプリケーション分野に特化したインターフェースを提
供しています。モジュールによっては全てのバージョン、全ての移植版の
Python で利用することができたり、背後にあるシステムがサポートしている場
合にのみ使えたり、Python をコンパイルしてインストールする際に特定の設定
オプションを選んだときにのみ利用できたりします。

このマニュアルは "内部から外部へ" と構成されています。つまり、最初に組み
込みの関数を記述し、組み込みのデータ型、例外、そして最後に各モジュールと
続きます。モジュールは関係のあるものでグループ化して一つの章にしています
。

つまり、このマニュアルを最初から読み始め、読み飽きたところで次の章に進め
ば、 Python ライブラリで利用できるモジュールやサポートしているアプリケー
ション領域の概要をそこそこ理解できるということです。もちろん、このマニュ
アルを小説のように読む必要は 'ありません' -- (マニュアルの先頭部分にある
) 目次にざっと目を通したり、 (最後尾にある) 索引でお目当ての関数やモジュ
ール、用語を探すことだってできます。もしランダムな項目について勉強してみ
たいのなら、ランダムにページを選び (*note random: c0. 参照)、そこから 1,
2 節読むこともできます。このマニュアルの各節をどんな順番で読むかに関わら
ず、 *note 組み込み関数: 1616. の章から始めるとよいでしょう。マニュアル
の他の部分は、この節の内容について知っているものとして書かれているからで
す。

それでは、ショーの始まりです！

* 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(): a91. のような他のブロッキング操作は、ブラウザーのイベ
ントループをブロックします。

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(): 6c3. や *note execve():
     14ba.) 、プロセスを待機 (*note waitpid(): 1157.) 、シグナルを送信
     (*note kill(): 1721.) 、もしくはプロセスと通信する API が含まれます
     。 *note subprocess: df. はインポート可能ですが、機能しません。

   * The *note socket: d4. 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: 246b.  For more details, see
     *note Android で Python を使う: 2469. and *note iOS で Python
     を使う: 2471.

   * サブプロセス:

        * 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: 2e. and *note readline: c2.) 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(): 229a.            *note enumerate(): 1839.     *note len(): a24.          *note range(): 27d4.
     *note aiter(): bb6.           *note eval(): 18f.          *note list(): 27d2.         *note repr(): 462.
     *note all(): 17da.            *note exec(): 190.          *note locals(): 296.        *note reversed(): c40.
     *note anext(): bb7.                                                                   *note round(): 1694.
     *note any(): 17d9.            'F'                         'M'                         
     *note ascii(): 179f.          *note filter(): c3f.        *note map(): 445.           'S'
                                   *note float(): 32f.         *note max(): 12bd.          *note set(): 27d5.
     'B'                           *note format(): 440.        *note memoryview(): 27d3.     *note setattr(): 27d6.
     *note bin(): 1662.            *note frozenset(): 27d1.     *note min(): 12bc.         *note sentinel(): 196.
     *note bool(): 5f6.                                                                    *note slice(): 1db.
     *note breakpoint(): 500.      'G'                         'N'                         *note sorted(): f90.
     *note bytearray(): 20a7.      *note getattr(): f93.       *note next(): bb9.          *note staticmethod(): 66d.
     *note bytes(): 20a6.          *note globals(): 1e20.                                  *note str(): 27d7.
                                                               'O'                         *note sum(): 886.
     'C'                           'H'                         *note object(): e51.        *note super(): 44a.
     *note callable(): 1584.       *note hasattr(): 8e7.       *note oct(): 1688.          'T'
     *note chr(): 1c17.            *note hash(): 9e7.          *note open(): 333.          *note tuple(): 27d8.
     *note classmethod(): 6a0.     *note help(): cad.          *note ord(): 254a.          *note type(): 191.
     *note compile(): 1d3.         *note hex(): 1689.                                      
     *note complex(): 330.                                     'P'                         'V'
                                   'I'                         *note pow(): 448.           *note vars(): 2030.
     'D'                           *note id(): 17db.           *note print(): 1324.        
     *note delattr(): 1b5.         *note input(): 1692.        *note property(): 6c1.      'Z'
     *note dict(): 27d0.           *note int(): 32e.                                       *note zip(): 446.
     *note dir(): a28.             *note isinstance(): 2fb.                                
     *note divmod(): d6e.          *note issubclass(): 2fc.                                '_'
                                   *note iter(): bb8.                                      *note __import__(): caa.
                                                                                      

 -- の関数: abs (number, /)

     数の絶対値を返します。引数は整数、浮動小数点数または *note
     __abs__(): 2619. が実装されたオブジェクトです。引数が複素数なら、そ
     の絶対値 (magnitude) が返されます。

 -- の関数: aiter (async_iterable, /)

     *note asynchronous iterable: 1131. から *note asynchronous
     iterator: 6d3. を返します。 ‘x.__aiter__()’ を呼び出すのと等価です
     。

     なお、 *note iter(): bb8. とは異なり、 *note aiter(): bb6. は第二引
     数を持ちません。

     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: 6d3.) を返します。イテレータが枯渇した場合、 'default' が
     与えられていれば 'default' を返します。

     これは組み込みの *note next(): bb9. 関数の非同期版であり、同じよう
     に動作します。

     これは 'async_iterator' の *note __anext__(): 1ac6. メソッドを呼び
     出し、待ち受け可能オブジェクト (*note awaitable: 6d5.) を返します。
     待ち受けることによりイテレータの次の値を返します。 'default' が与え
     られた場合、イテレータが枯渇したときにその値が返されます。
     'default' が与えられない場合は *note StopAsyncIteration: 201d. が送
     出されます。

     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(): 462. と同様、オブジェクトの印字可能な表現を含む文字列
     を返しますが、‘repr()’ によって返された文字列中の非 ASCII 文字は
     ‘\x’ 、 ‘\u’ 、 ‘\U’ エスケープを使ってエスケープされます。これは
     Python 2 の ‘repr()’ によって返されるのと同じ文字列を作ります。

 -- の関数: bin (integer, /)

     整数を先頭に "0b" が付いた 2 進文字列に変換します。 結果は Python の
     式としても使える形式になります。 'integer' が Python の *note int:
     32e. オブジェクトでない場合、整数を返す *note __index__(): 444. メ
     ソッドが定義されていなければなりません。 いくつかの例を示します:

          >>> 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(): 19a8. も
     参照してください。

     より詳しいことは *note format(): 440. も参照してください。

 -- クラス: bool (object=False, /)

     真偽値、すなわち ‘True’ か ‘False’ のいずれかを返します。引数は標準
     の *note 真偽値判定手続き: 1aa0. を用いて変換されます。引数が偽かま
     たは省略された場合、この関数は ‘False’ を返します。それ以外の場合は
     ‘True’ を返します。 *note bool: 5f6. クラスは *note int: 32e. クラ
     スの派生クラスです (*note 数値型 int, float, complex: 21e8. を参照
     してください)。このクラスからさらに派生することはできません。このク
     ラスのインスタンスは ‘False’ と ‘True’ のみです (*note ブーリアン型
     - bool: 27d9. を参照してください)。

     バージョン 3.7 で変更: 引数は位置専用になりました。

 -- の関数: breakpoint (*args, **kws)

     この関数は、呼び出された箇所にて処理をデバッガに移行します。具体的
     には、 *note sys.breakpointhook(): ea3. を呼び出し、 ‘args’ と
     ‘kws’ をそのまま渡します。デフォルトでは、 ‘sys.breakpointhook()’ は
     引数なしで *note pdb.set_trace(): 501. を呼び出すだけです。その場合
     、これは単なる便利関数でデバッガに入るために *note pdb: aa. を明示
     的にインポートしたり多くのコードを書いたりせずに済むだけです。です
     が、 ‘sys.breakpointhook()’ は別の関数に設定でき、 *note
     breakpoint(): 500. はそれを自動で呼び出すため、自分好みのデバッガに
     処理を移行させることができます。 ‘sys.breakpointhook()’ にアクセス
     できない場合、この関数は *note RuntimeError: 317. を送出します。

     デフォルトでは、環境変数 *note PYTHONBREAKPOINT: ea4. をセットする
     ことで *note breakpoint(): 500. の動作を変えることができます。 使い
     方の詳細は *note sys.breakpointhook(): ea3. を参照してください。

     ただし、 *note sys.breakpointhook(): ea3. が別の関数で置き換えられ
     ている場合、上記の環境変数によって必ずしも動作を変えることができな
     いことに注意してください。

     引数 ‘breakpointhook’ 付きで *note 監査イベント: 1e84.
     ‘builtins.breakpoint’ を送出します。

     Added in version 3.7.

 -- クラス: bytearray (source=b'')

 -- クラス: bytearray (source, encoding, errors='strict')

     新しいバイト配列を返します。*note bytearray: 1d1. クラスは0 <= x <
     256の範囲の整数からなる変更可能な配列です。*note
     ミュータブルなシーケンス型: 27da. に記述されている変更可能な配列に
     対する普通のメソッドの大半を備えています。また、*note bytes: 1d2. 型
     が持つメソッドの大半も備えています（see *note bytes と bytearray
     の操作: 27db.)。

     オプションの 'source' 引数は、配列を異なる方法で初期化するのに使わ
     れます:

        * '文字列' の場合、 'encoding' (と、オプションの 'errors') 引数
          も与えなければなりません。このとき *note bytearray(): 1d1. は
          文字列を *note str.encode(): cab. でバイトに変換して返します。

        * '整数' の場合、配列はそのサイズになり、null バイトで初期化され
          ます。

        * *note バッファインターフェース: 319. に適合するオブジェクトの
          場合、そのオブジェクトの読み出し専用バッファがバイト配列の初期
          化に使われます。

        * 'イテラブル' の場合、範囲 ‘0 <= x < 256’ 内の整数のイテラブル
          でなければならず、それらが配列の初期の内容として使われます。

     引数がなければ、長さ 0 の配列が生成されます。

     *note バイナリシーケンス型 -- bytes, bytearray, memoryview: 27dc. と
     *note bytearray オブジェクト: 27dd. も参照してください。

 -- クラス: bytes (source=b'')

 -- クラス: bytes (source, encoding, errors='strict')

     範囲 ‘0 <= x < 256’ の整数のイミュータブルなシーケンスである
     "bytes" オブジェクトを返します。 *note bytes: 1d2. は *note
     bytearray: 1d1. のイミュータブル版であり、オブジェクトを変化させな
     いメソッドや、インデックス指定、オブジェクトのスライスについてのふ
     るまいは同じです。

     従って、コンストラクタ引数は *note bytearray(): 1d1. のものと同様に
     解釈されます。

     バイト列オブジェクトはリテラルでも生成できます。 *note
     文字列およびバイト列リテラル: 24ae. を参照してください。

     *note バイナリシーケンス型 -- bytes, bytearray, memoryview: 27dc,
     *note バイトオブジェクト: 27de, *note bytes と bytearray の操作:
     27db. も参照してください。

 -- の関数: callable (object, /)

     'object' 引数が呼び出し可能オブジェクトであれば *note True: fd0. を
     、そうでなければ *note False: ef9. を返します。この関数が ‘True’ を
     返しても、呼び出しは失敗する可能性がありますが、‘False’ であれば、
     'object' の呼び出しは決して成功しません。なお、クラスは呼び出し可能
     (クラスを呼び出すと新しいインスタンスを返します) です。また、インス
     タンスはクラスが *note __call__(): 966. メソッドを持つなら呼び出し
     可能です。

     Added in version 3.2: この関数は Python 3.0 で一度取り除かれました
     が、Python 3.2 で復活しました。

 -- の関数: chr (codepoint, /)

     指定されたUnicode コードポイントが文字を表す文字列を返します。例え
     ば ‘chr(97)’ は文字列 ‘'a'’ を、 ‘chr(8364)’ は文字列 ‘'€'’ を返し
     ます。 *note ord(): 254a. の逆です。

     引数の有効な範囲は 0 から 1,114,111 (16 進数で 0x10FFFF) です。引数
     が範囲外の場合 *note ValueError: 15a. が送出されます。

 -- の関数: @classmethod

     メソッドをクラスメソッドへ変換します。

     クラスメソッドは、インスタンスメソッドが暗黙の第一引数としてインス
     タンスをとるように、第一引数としてクラスをとります。クラスメソッド
     を宣言するには、以下のイディオムを使います:

          class C:
              @classmethod
              def f(cls, arg1, arg2): ...

     ‘@classmethod’ 形式は関数 *note デコレータ: b1d. です。詳しくは
     *note 関数定義: 2224. を参照してください。

     クラスメソッドは、(‘C.f()’ のように) クラスから呼び出すことも、
     (‘C().f()’ のように) インスタンスから呼び出すこともできます。 イン
     スタンスはそのクラスが何であるかを除いて無視されます。 クラスメソッ
     ドが派生クラスから呼び出される場合は、その派生クラスオブジェクトが
     暗黙の第一引数として渡されます。

     クラスメソッドは C++ や Java の静的メソッドとは異なります。静的メソ
     ッドは、この節の *note staticmethod(): 66d. を参照してください。ク
     ラスメソッドについてより詳しいことは *note 標準型の階層: 253e. を参
     照してください。

     バージョン 3.9 で変更: クラスメソッドは *note property(): 6c1. など
     、他の *note デスクリプタ: 22a. をラップすることができるようになり
     ました。

     バージョン 3.10 で変更: クラスメソッドはメソッド属性 (*note
     __module__: 2559, *note __name__: 168e, *note __qualname__: 2558,
     *note __doc__: 1597. と *note __annotations__: 1596.) を継承するよ
     うになりました。また、新たに ‘__wrapped__’ 属性を持つようになりまし
     た。

     バージョン 3.11 で非推奨、バージョン 3.13 で削除: クラスメソッドは
     *note property(): 6c1. など、他の *note デスクリプタ: 22a. をラップ
     することができなくなりました。

 -- の関数: compile (source, filename, mode, flags=0,
          dont_inherit=False, optimize=-1, *, module=None)

     'source' をコードオブジェクト、もしくは、 AST オブジェクトにコンパ
     イルします。 コードオブジェクトは *note exec(): 190. 文で実行したり
     、 *note eval(): 18f. 呼び出しで評価できます。 'source' は通常の文
     字列、 バイト列、 AST オブジェクトのいずれでもかまいません。 AST オ
     ブジェクトへの、また、 AST オブジェクトからのコンパイルの方法は、
     *note ast: 9. モジュールのドキュメントを参照してください。

     'filename' 引数には、コードの読み出し元のファイルを与えなければなり
     ません; ファイルから読み出されるのでなければ、認識可能な値を渡して
     下さい (‘'<string>'’ が一般的に使われます)。

     'mode' 引数は、コンパイルされるコードの種類を指定します; 'source' が
     一連の文から成るなら ‘'exec'’ 、単一の式から成るなら ‘'eval'’ 、単
     一の対話的文の場合 ‘'single'’ です。(後者の場合、評価が ‘None’ 以外
     である式文が印字されます)。

     オプション引数 'flags' と 'dont_inherit' は、どの *note
     コンパイラオプション: 27df. を有効化するか、 *note 将来の機能: 677.
     のどれを許可するかを制御します。どちらの引数も存在しない (またはど
     ちらもゼロである) 場合は、 *note compile(): 1d3. の呼び出し元のコー
     ドに作用したものと同じフラグでコンパイルされます。 'flags' 引数が与
     えられて 'dont_inherit' が与えられない (またはゼロ) の場合、上記に
     加えて 'flags' 引数で与えられたコンパイラオプションと future 文が使
     われます。 'dont_inherit' がゼロでない整数の場合、 'flags' 引数で指
     定されたオプションだけが有効です - 呼び出し元コードに適用されたフラ
     グ (将来の機能とコンパイラオプション) は無視されます。

     有効化するコンパイラオプションと future 文はビットフィールドで指定
     可能で、ビット単位の OR をとることで複数のオプションを一緒に指定す
     ることができます。特定の future 機能を指定するために必要なビットフ
     ィールドの情報は、 *note __future__: 0. モジュールにおける *note
     _Feature: 27e0. インスタンスの *note compiler_flag: 25a6. 属性で得
     ることができます。 *note コンパイラフラグ: 27df. の情報は *note
     ast: 9. モジュールの ‘PyCF_’ で始まるフラグで得ることができます。

     引数 'optimize' は、コンパイラの最適化レベルを指定します; デフォル
     トの値 ‘-1’ は、インタプリタの *note -O: 438. オプションで与えられ
     るのと同じ最適化レベルを選びます。明示的なレベルは、 ‘0’ (最適化な
     し、 ‘__debug__’ は真)、 ‘1’ (assert は取り除かれ、 ‘__debug__’ は
     偽)、 ‘2’ (docstring も取り除かれる) です。

     The optional argument 'module' specifies the module name.  It is
     needed to unambiguous *note filter: 1d7. syntax warnings by module
     name.

     この関数は、コンパイルされたソースが不正である場合 *note
     SyntaxError: 189. または *note ValueError: 15a. を送出します。

     Python コードをパースしてその AST 表現を得たいのであれば、 *note
     ast.parse(): 1d4. を参照してください。

     引数 ‘source’ と ‘filename’ を指定して *note 監査イベント: 1e84.
     ‘compile’ を送出します。これは、暗黙に行われるコンパイルでも送出さ
     れる可能性があります。

          注釈: 複数行に渡るコードの文字列を ‘'single'’ や ‘'eval'’ モー
          ドでコンパイルするとき、入力は一つ以上の改行文字で終端されなけ
          ればなりません。これは、 *note code: 1b. モジュールで不完全な
          文と完全な文を検知しやすくするためです。

          警告: AST オブジェクトにコンパイルしているときに、十分に大きい
          文字列や複雑な文字列によって Python の抽象構文木コンパイラのス
          タックが深さの限界を越えることで、 Python インタプリタをクラッ
          シュさせられます。

     バージョン 3.2 で変更: Windows や Mac の改行も受け付けます。また
     ‘'exec'’ モードでの入力が改行で終わっている必要もありません。
     'optimize' 引数が追加されました。

     バージョン 3.5 で変更: 以前は 'source' にヌルバイトがあったときに
     *note TypeError: 29c. を送出していました。

     Added in version 3.8: ‘ast.PyCF_ALLOW_TOP_LEVEL_AWAIT’ フラグを渡し
     てトップレベルの ‘await’, ‘async for’, および ‘async with’ のサポー
     トを有効化することができるようになりました。

     Added in version 3.15: 'module' 引数が追加されました。

 -- クラス: 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(): 32f. と同じ形式）、虚数
     部（同様の形式で ‘'j'’ または ‘'J'’ 接尾辞）どちらか、あるいは両方
     （この場合、虚数部の符号は必須）を含まなければなりません。文字列 は
     空白や括弧 ‘'('’ と''')''' で囲むこともできますが、無視されます。文
     字列は、 ‘'+'’ 、‘'-'’ 、 ‘'j'’ または ‘'J'’ 接尾辞 、そして10進数
     の間に空白を含んではなりません。たとえば ‘complex('1+2j')’ はよいで
     すが、 ‘complex('1 + 2j')’ は *note ValueError: 15a. を送出します。
     より正確には、入力は括弧および先頭と末尾の空白文字を除去した後、以
     下の文法における *note complexvalue: 27e1. の生成規則を満たす必要が
     あります:

          complexvalue: *note floatvalue: 27e2. |
                        *note floatvalue: 27e2. ("j" | "J") |
                        *note floatvalue: 27e2. *note sign: 27e3. *note absfloatvalue: 27e4. ("j" | "J")

     引数が数値の場合、コンストラクタは *note int: 32e. や *note float:
     32f. のように数値変換します。一般的な Python オブジェクト ‘x’ では
     、 ‘complex(x)’ は ‘x.__complex__()’ に委譲します。 *note
     __complex__(): 9e3. が定義されていない場合は *note __float__():
     d96. にフォールバックします。 ‘__float__()’ も定義されていない場合
     には、 *note __index__(): 444. にフォールバックします。

     ２引数が指定されるかキーワード引数が使われている場合、各引数は任意
     の数値型（複素数を含む）となります。両方の引数が実数の場合には、実
     数成分 'real' と虚数成分 'imag' を持つ複素数を返します。引数が両方
     とも複素数の場合、実数成分 ‘real.real-imag.imag’ と虚数成分
     ‘real.imag+imag.real’ を持つ複素数を返します。引数の片方が実数の場
     合、前述の式ではその実数成分のみ使われます。

     数値を一つだけ引数にとる *note complex.from_number(): 43f. も参照し
     てください。

     引数がすべて省略された場合は、 ‘0j’ を返します。

     複素数型については *note 数値型 int, float, complex: 21e8. に説明が
     あります。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.8 で変更: *note __complex__(): 9e3. と *note
     __float__(): d96. が定義されていない場合、 *note __index__(): 444.
     へフォールバックします。

     バージョン 3.14 で非推奨: 複素数を 'real' 引数または 'imag' 引数と
     して渡せる機能は非推奨となりました。単一の位置引数として渡してくだ
     さい。

 -- の関数: delattr (object, name, /)

     *note setattr(): 27d6. の親戚です。引数はオブジェクトと文字列です。
     文字列はオブジェクトの属性名のいずれかでなければなりません。対象の
     オブジェクトが許可する場合に限り、この関数は指定された名前の属性を
     削除します。たとえば、 ‘delattr(x, 'foobar')’ は ‘del x.foobar’ と
     等価です。 'name' は Python の識別子である必要はありません
     (‘setattr()’ を参照してください)。

 -- クラス: dict (**kwargs)

 -- クラス: dict (mapping, /, **kwargs)

 -- クラス: dict (iterable, /, **kwargs)

     新しい辞書を作成します。 *note dict: 193. オブジェクトは辞書クラス
     です。このクラスに関するドキュメンテーションは ‘dict’ と *note
     Mapping types -- dict, frozendict: e90. を参照してください。

     他のコンテナについては、 ビルトインの *note list: 4e0, *note set:
     432, *note tuple: 1d9. クラスおよび *note collections: 1e. モジュー
     ルを参照してください。

 -- の関数: dir ()

 -- の関数: dir (object, /)

     引数がない場合、現在のローカルスコープにある名前のリストを返します
     。引数がある場合、そのオブジェクトの有効な属性のリストを返そうと試
     みます。

     オブジェクトが *note __dir__(): 1956. という名のメソッドを持つなら
     、そのメソッドが呼び出され、属性のリストを返さなければなりません。
     これにより、カスタムの *note __getattr__(): 8e8. や *note
     __getattribute__(): f94. 関数を実装するオブジェクトは、*note dir():
     a28. が属性を報告するやり方をカスタマイズできます。

     オブジェクトが *note __dir__(): 1956. を提供しない場合、その型オブ
     ジェクトと、定義されていればオブジェクトの *note __dict__: 1ca. 属
     性から、できるだけ情報を集めようとします。結果のリストは必ずしも完
     全ではなく、カスタムの *note __getattr__(): 8e8. を持つ場合は不正確
     かもしれません。

     デフォルトの *note dir(): a28. メカニズムは、完全というより最重要な
     情報を作成しようとするため、異なる型のオブジェクトでは異なって振る
     舞います:

        * オブジェクトがモジュールオブジェクトの場合、リストにはモジュー
          ルの属性の名前が含まれます。

        * オブジェクトが型オブジェクトやクラスオブジェクトの場合、リスト
          にはその属性の名前と、再帰的にたどったその基底クラスの属性が含
          まれます。

        * それ以外の場合には、リストにはオブジェクトの属性名、クラス属性
          名、再帰的にたどった基底クラスの属性名が含まれます。

     返されるリストはアルファベット順に並べられています。例えば:

          >>> 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__', '__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(): a28. は主に対話プロンプトでの使用に便利なよ
          うに提供されているので、厳密性や一貫性を重視して定義された名前
          のセットというよりも、むしろ興味を引くような名前のセットを返そ
          うとします。また、この関数の細かい動作はリリース間で変わる可能
          性があります。例えば、引数がクラスであるとき、メタクラス属性は
          結果のリストに含まれません。

 -- の関数: 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: 6d4. か、あるいはイテレーションをサポートするその他
     のオブジェクトでなければなりません。 *note enumerate(): 1839. によ
     って返されたイテレータの *note __next__(): 1687. メソッドは、 (デフ
     ォルトでは 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: 1ea. | *note code object: 6f1.) - Python
          式。

        * ‘globals’ (*note dict: 193. | *note frozendict: 18d. | ‘None’)
          - グローバル名前空間 (default: ‘None’) 。

        * ‘locals’ (*note mapping: 1579. | ‘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
     ‘eval()’ is called.  Note, 'eval()' will only have access to the
     *note nested scopes: 25a0. (non-locals) in the enclosing
     environment if they are already referenced in the scope that is
     calling ‘eval()’ (e.g.  via a *note nonlocal: 1661. statement).

     例:

          >>> x = 1
          >>> eval('x+1')
          2

     この関数は (*note compile(): 1d3. で生成されるような) 任意のコード
     オブジェクトを実行するのにも利用できます。この場合、文字列の代わり
     にコードオブジェクトを渡してください。このコードオブジェクトが、引
     数 'mode' を ‘'exec'’ としてコンパイルされている場合、 *note
     eval(): 18f. の戻り値は ‘None’ になります。

     ヒント: *note exec(): 190. 関数により文の動的な実行がサポートされて
     います。*note globals(): 1e20. および *note locals(): 296. 関数は、
     それぞれ現在のグローバルおよびローカルな辞書を返すので、それらを
     *note eval(): 18f. や ‘exec()’ に渡して使うことができます。

     ソースコードとして文字列が与えられた場合、先頭と末尾の空白文字およ
     びタブは取り去られます。

     See *note ast.literal_eval(): fdb. for a function to evaluate
     strings with expressions containing only literals.

     コードオブジェクトを引数として *note 監査イベント: 1e84. ‘exec’ を
     送出します。コードコンパイルのイベントも送出されることがあります。

     バージョン 3.13 で変更: 'globals' と 'locals' 引数 はキーワードとし
     て渡せるようになった。

     バージョン 3.13 で変更: デフォルトの 'locals' 名前空間のセマンティ
     クスは、 組み込み *note locals(): 296. の説明のように調整された。

     バージョン 3.15 で変更: 'globals' can now be a *note frozendict:
     18d.

 -- の関数: 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
     ファイル入力: 27b7. 節を参照してください)。 *note nonlocal: 1661,
     *note yield: d97, および *note return: 452. 文は、 *note exec():
     190. 関数に渡されたコードの文脈中でさえ、関数定義の外側で使うことは
     できません。戻り値は ‘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: 1ad6.  The length of the tuple must
     exactly match the length of the code object's *note co_freevars:
     2556. attribute.

     コードオブジェクトを引数として *note 監査イベント: 1e84. ‘exec’ を
     送出します。コードコンパイルのイベントも送出されることがあります。

          注釈: 組み込み関数 *note globals(): 1e20. および *note
          locals(): 296. は、それぞれ現在のグローバルおよびローカルの名
          前空間を返すので、それらを *note exec(): 190. の第二、第三引数
          にそのまま渡して使うと便利なことがあります。

          注釈: 標準では 'locals' は後に述べる関数 *note locals(): 296.
          のように動作します。 *note exec(): 190. の呼び出しが返る時にコ
          ードが 'locals' に与える影響を知りたいなら、明示的に 'locals'
          辞書を渡してください。

     バージョン 3.11 で変更: 'closure' パラメータが追加されました。

     バージョン 3.13 で変更: 'globals' と 'locals' 引数 はキーワードとし
     て渡せるようになった。

     バージョン 3.13 で変更: デフォルトの 'locals' 名前空間のセマンティ
     クスは、 組み込み *note locals(): 296. の説明のように調整された。

     バージョン 3.15 で変更: 'globals' can now be a *note frozendict:
     18d.

 -- の関数: 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(): 27e6.
     を参照してください。 '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: 27e2. の生成規則に従う必要があります:

          sign:          "+" | "-"
          infinity:      "Infinity" | "inf"
          nan:           "nan"
          digit:         <a Unicode decimal digit, i.e. characters in Unicode general category Nd>
          digitpart:     *note digit: 27e9. (["_"] *note digit: 27e9.)*
          number:        [*note digitpart: 27ea.] "." *note digitpart: 27ea. | *note digitpart: 27ea. ["."]
          exponent:      ("e" | "E") [*note sign: 27e3.] *note digitpart: 27ea.
          floatnumber:   *note number: 27eb. [*note exponent: 27ec.]
          absfloatvalue: *note floatnumber: 27ed. | *note infinity: 27e7. | *note nan: 27e8.
          floatvalue:    [*note sign: 27e3.] *note absfloatvalue: 27e4.

     大文字と小文字は重要ではないので、例えば、 "inf", "Inf",
     "INFINITY", "iNfINity" はすべて正の無限大を表す綴りとして受け入れら
     れます。

     また、引数が整数または浮動小数点数なら、 (Python の浮動小数点数の精
     度で) 同じ値の浮動小数点数が返されます。 引数が Python の浮動小数点
     数の範囲外なら、 *note OverflowError: c5b. が送出されます。

     一般の Python オブジェクト ‘x’ に対して、‘float(x)’ は
     ‘x.__float__()’ に委譲します。 *note __float__(): d96. が定義されて
     いない場合、*note __index__(): 444. へフォールバックします。

     数値型の値のみ引数にとる *note float.from_number(): 43e. も参照して
     ください。

     引数が与えられなければ、‘0.0’ が返されます。

     浮動小数点数型については、 *note 数値型 int, float, complex: 21e8.
     も参照してください。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.7 で変更: 引数は位置専用になりました。

     バージョン 3.8 で変更: *note __float__(): d96. が定義されていない場
     合、 *note __index__(): 444. へフォールバックします。

 -- の関数: format (value, format_spec='', /)

     'value' を 'format_spec' で指示された通りに "整形" した文字列表現に
     変換します。 'format_spec' の解釈は 'value' 引数の型に依存しますが
     、ほとんどの組み込み型で使われる標準的な構文が存在します: *note
     Format specification mini-language: 704.。

     デフォルトの 'format_spec' は空の文字列です。それは通常 *note
     str(value): 1ea. の呼び出しと同じ結果になります。

     ‘format(value, format_spec)’ の呼び出しは、
     ‘type(value).__format__(value, format_spec)’ に翻訳され、これは
     value の *note __format__(): a15. メソッドの検索をするとき、インス
     タンス辞書を回避します。このメソッドの探索が *note object: e51. に
     到達しても 'format_spec' が空にならなかったり、 'format_spec' や返
     り値が文字列でなかったりした場合、 *note TypeError: 29c. が送出され
     ます。

     バージョン 3.4 で変更: 'format_spec' が空の文字列でない場合
     ‘object().__format__(format_spec)’ は *note TypeError: 29c. を送出
     します。

 -- クラス: frozenset (iterable=(), /)

     新しい *note frozenset: 9d9. オブジェクトを返します。オプションで
     'iterable' から得られた要素を含みます。 ‘frozenset’ はビルトインク
     ラスです。このクラスに関するドキュメントは ‘frozenset’ と *note
     set（集合）型 -- set, frozenset: 223e. を参照してください。

     他のコンテナについては、ビルトインクラス *note set: 432, *note
     list: 4e0, *note tuple: 1d9, *note dict: 193. や *note collections:
     1e. モジュールを見てください。

 -- の関数: getattr (object, name, /)

 -- の関数: getattr (object, name, default, /)

     'object' の指定された属性の値を返します。 'name' は文字列でなければ
     なりません。与えられた文字列がオブジェクトの属性名のうちいずれかに
     一致すれば、戻り値はその属性の値になります。たとえば、 ‘getattr(x,
     'foobar')’ は ‘x.foobar’ と等価です。もし指定された属性が存在しない
     場合、 'default' が指定されていればその値が返されます。そうでない場
     合は *note AttributeError: 1b4. が送出されます。 'name' は Python 識
     別子である必要はありません (*note setattr(): 27d6. を参照してくださ
     い)。

          注釈: *note プライベートな名前のマングリング: 22b1. はコンパイ
          ル時に行われます。そのため、プライベートな属性 (先頭に2つのア
          ンダースコアを伴う名前を持つ属性) の値を *note getattr(): f93.
          で取り出すためには、属性名を手動でマングリングする必要がありま
          す。

 -- の関数: globals ()

     現在のモジュールの名前空間を実装した辞書を返します。関数内のコード
     に対しては、関数が定義されるときに辞書が設定され、その関数がどこか
     ら呼ばれたかにかかわらず同じ内容になります。

 -- の関数: hasattr (object, name, /)

     引数はオブジェクトと文字列です。文字列がオブジェクトの属性名の一つ
     であった場合 ‘True’ を、そうでない場合 ‘False’ を返します。 (この関
     数は、 ‘getattr(object, name)’ を呼び出して *note AttributeError:
     1b4. を送出するかどうかを見ることで実装されています。)

 -- の関数: hash (object, /)

     オブジェクトのハッシュ値を (存在すれば) 返します。ハッシュ値は整数
     です。これらは辞書を検索する際に辞書のキーを高速に比較するために使
     われます。等しい値となる数値は等しいハッシュ値を持ちます (1 と 1.0
     のように型が異なっていてもです)。

          注釈: 独自の *note __hash__(): ec5. メソッドを実装したオブジェ
          クトを使う場合、*note hash(): 9e7. が実行するマシンのビット幅
          に合わせて戻り値を切り捨てることに注意してください。

 -- の関数: help ()

 -- の関数: help (request)

     組み込みヘルプシステムを起動します。(この関数は対話的な使用のための
     ものです。) 引数が与えられていない場合、対話的ヘルプシステムはイン
     タプリタコンソール上で起動します。引数が文字列の場合、文字列はモジ
     ュール、関数、クラス、メソッド、キーワード、またはドキュメントの項
     目名として検索され、ヘルプページがコンソール上に印字されます。引数
     がその他のオブジェクトの場合、そのオブジェクトに関するヘルプページ
     が生成されます。

     *note help(): cad. を呼び出したときに関数の引数リストにスラッシュ
     (/) が現れた場合は、スラッシュより前の引数が位置専用引数だという意
     味であることに注意してください。より詳しい情報は、 *note
     位置専用引数についての FAQ の項目: 27ee. を参照してください。

     この関数は、 *note site: cf. モジュールから、組み込みの名前空間に移
     されました。

     バージョン 3.4 で変更: *note pydoc: bd. と *note inspect: 81. への
     変更により、呼び出し可能オブジェクトの報告されたシグニチャがより包
     括的で一貫性のあるものになりました。

 -- の関数: hex (integer, /)

     整数を先頭に "0x" が付いた小文字の 16 進文字列に変換します。
     'integer' が Python の *note int: 32e. オブジェクトでない場合、整数
     を返す *note __index__(): 444. メソッドが定義されていなければなりま
     せん。 いくつかの例を示します:

          >>> 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(): 440. も参照してください。

     16を底として16進数文字列を整数に変換するには *note int(): 32e. も参
     照してください。

          注釈: 浮動小数点数の16進文字列表記を得たい場合には、 *note
          float.hex(): 2311. メソッドを使って下さい。

 -- の関数: id (object, /)

     オブジェクトの "識別値" を返します。この値は整数で、このオブジェク
     トの有効期間中は一意かつ定数であることが保証されています。有効期間
     が重ならない 2 つのオブジェクトは同じ *note id(): 17db. 値を持つか
     もしれません。

     これはオブジェクトのメモリアドレスです。

     引数 ‘id’ を指定して *note 監査イベント: 1e84. ‘builtins.id’ を送出
     します。

 -- の関数: input ()

 -- の関数: input (prompt, /)

     引数 'prompt' が存在すれば、それが末尾の改行を除いて標準出力に書き
     出されます。次に、この関数は入力から 1 行を読み込み、文字列に変換し
     て (末尾の改行を除いて) 返します。 EOF が読み込まれたとき、 *note
     EOFError: 1693. が送出されます。例:

          >>> s = input('--> ')
          --> Monty Python's Flying Circus
          >>> s
          "Monty Python's Flying Circus"

     *note readline: c2. モジュールが読み込まれていれば、 *note input():
     1692. はそれを使って精緻な行編集やヒストリ機能を提供します。

     入力を読み込む前に、引数 ‘prompt’ 付きで *note 監査イベント: 1e84.
     ‘builtins.input’ を送出します。

     入力の読み込みに成功した後に、その結果付きで *note 監査イベント:
     1e84. ‘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__(): 443. が定義されている場合は、 ‘int(x)’ は
     ‘x.__int__()’ を返します。引数に *note __index__(): 444. が定義され
     ている場合は、 ‘x.__index__()’ を返します。浮動小数点数については、
     これは 0 に近い側へ切り捨てます。

     引数が数値でないか、または 'base' が与えられた場合、引数は 'base' を
     基数とした整数を表現する文字列、 *note bytes: 1d2. インスタンス、ま
     たは *note bytearray: 1d1. インスタンスのいずれかでなければなりませ
     ん。文字列は先頭に ‘+’ または ‘-’ を伴ったり (符号と数値の間に空白
     文字を入れてはいけません)、数値の先頭に任意の数のゼロを付けたり、前
     後に空白文字を付けたり、各桁を単一の下線で区切ったりしても有効です
     。

     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
     コードにおける整数リテラル: 251a. と同じように解釈されます。すなわ
     ち、プレフィックスによって基数が2, 8, 10, または 16 のどれになるか
     が決まります。基数を0にした場合先頭にゼロを追加することはできません
     : すなわち ‘int('010', 0)’ は基数を0に指定しているため不正ですが、
     ‘int('010')’ や ‘int('010', 8)’ は有効です。

     整数型については、 *note 数値型 int, float, complex: 21e8. も参照し
     てください。

     バージョン 3.4 で変更: 'base' が *note int: 32e. のインスタンスでな
     く、'base' オブジェクトが *note base.__index__: 444. メソッドを持っ
     ている場合、そのメソッドを呼んで底に対する整数を得ることができます
     。以前のバージョンでは ‘base.__index__’ ではなく *note
     base.__int__: 443. を使用していました。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.7 で変更: 第1引数は位置専用になりました。

     バージョン 3.8 で変更: *note __int__(): 443. が定義されていない場合
     、 *note __index__(): 444. へフォールバックします。

     バージョン 3.11 で変更: *note int: 32e. への文字列入力やその文字列
     表現は、サービス拒否攻撃 (DoS 攻撃) を避けるために制限されることが
     あります。文字列を ‘int’ に変換したり ‘int’ を文字列に変換したりす
     る際にその制限を超えた場合、 *note ValueError: 15a. が送出されます
     。詳しくは *note 整数文字列の変換における長さ制限: 9f1. を参照して
     ください。

     バージョン 3.14 で変更: *note int(): 32e. no longer delegates to
     the *note __trunc__(): 442. method.

 -- の関数: isinstance (object, classinfo, /)

     'object' 引数が 'classinfo' 引数に指定した型、またはその (直接、間
     接、または *note 仮想: 1574. の) サブクラスのインスタンスである場合
     に ‘True’ を返します。 'object' が与えられた型のオブジェクトでない
     場合、この関数は常に ‘False’ を返します。 'classinfo' が型オブジェ
     クトのタプル (または再帰的にそのようなタプルを含むタプル) や複数の
     型の *note Union 型: ba6. である場合、 'object' がそれらの型のいず
     れかのインスタンスであれば ‘True’ を返します。 'classinfo' が型や型
     からなるタプルまたは再帰的タプルのいずれでもない場合、 *note
     TypeError: 29c. 例外が送出されます。タプルの中で先行する型に対する
     チェックが成功した場合、後続の不正な型に対して ‘TypeError’ が送出さ
     れないことがあります。

     バージョン 3.10 で変更: 'classinfo' に *note Union 型: ba6. を指定
     できるようになりました。

 -- の関数: issubclass (cls, classinfo, /)

     Return ‘True’ if 'cls' is a subclass (direct, indirect, or *note
     virtual: 1574.) 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 型: ba6, in which
     case return ‘True’ if 'cls' is a subclass of any entry in
     'classinfo'.  In any other case, a *note TypeError: 29c. exception
     is raised.

     バージョン 3.10 で変更: 'classinfo' に *note Union 型: ba6. を指定
     できるようになりました。

 -- の関数: iter (iterable, /)

 -- の関数: iter (callable, sentinel, /)

     *note iterator: 6d4. オブジェクトを返します。第二引数があるかどうか
     によって第一引数の解釈は大きく異なります。第二引数がない場合、単一
     の引数は *note iterable: 149a. プロトコル (*note __iter__(): 1031.
     メソッド) をサポートするコレクションオブジェクトか、またはシーケン
     スプロトコル (‘0’ から始まる整数を引数にとる *note __getitem__():
     78d. メソッド) をサポートするオブジェクトでなければなりません。第一
     引数がどちらのプロトコルもサポートしない場合は *note TypeError:
     29c. 例外が送出されます。第二引数 'sentinel' が与えられた場合、第一
     引数は呼び出し可能オブジェクトでなければなりません。この場合に生成
     されるイテレータは *note __next__(): 1687. メソッドを呼び出すごとに
     引数なしで 'callable' を呼び出します; 戻り値が 'sentinel' と等しけ
     れば、 *note StopIteration: fbe. が送出されます。それ以外の場合は戻
     り値がそのまま返されます。

     *note イテレータ型: 27ef. も見てください。

     2引数形式の *note iter(): bb8. の便利な利用方法の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): d13. のような、 *note
     sys.maxsize: 1583. を超える長さに対して *note OverflowError: c5b. を
     送出します。

 -- クラス: list (iterable=(), /)

     *note list: 4e0. は、実際には関数ではなくミュータブルなシーケンス型
     で、 *note リスト型 (list): 222e. と *note シーケンス型 -- list,
     tuple, range: 223b. にドキュメント化されています。

 -- の関数: locals ()

     現在のローカル シンボル テーブルを表すマッピング オブジェクトを返し
     ます。これは変数名をキーとし、現在バインドされている参照を値としま
     す。

     モジュール スコープでは、単一の名前空間で *note exec(): 190. や
     *note eval(): 18f. を使う場合と同じく、この関数は *note globals():
     1e20. と同じ名前空間を返します。

     クラス スコープでは、メタクラス コンストラクタに渡された名前空間を
     返します。

     ‘exec()’ や ‘eval()’ が引数 local と global が分けて使われてる場合
     では、関数の呼び出しで渡されたローカル名前空間を返します。

     上記どの場合でも、特定の実行フレーム内での各 ‘locals()’ は '同じ' マ
     ッピング オブジェクトを返します。 ‘locals()’ から返されたマッピング
     オブジェクトを通じて行われた変更は、代入、再代入、または削除された
     ローカル変数として可視化されます。そしてローカル変数の代入、再代入
     、または削除は、返されたマッピング オブジェクトの内容へ直ちに反映さ
     れます。

     *note optimized scope: 6b3. （関数、ジェネレーター、コルーチンを含
     む）では、 ‘locals()’ を呼び出すと、代わりに関数のローカル変数と非
     ローカル セル参照の現在のバインディングを含んだ新しい辞書を返します
     。この場合、返された辞書を使って行われた変更は、対応するローカル変
     数や非ローカル セル参照には '書き戻されません' 。また、ローカル変数
     や非ローカル セル参照へ代入、再代入、削除を行っても、以前に返された
     辞書の内容には '影響しません' 。

     ‘locals()’ 呼び出しが関数、ジェネレータ、コルーチン内の内包表記内に
     あれば、これはそれを含むスコープから呼び出すことと同等です。ただし
     内包表記の初期化された反復変数が含まれます。他のスコープでは、内包
     表記がネストされた関数として実行されているかのように振舞います。

     ‘locals()’ 呼び出しがジェネレータ式の一部であれば、ネストされたジェ
     ネレータ関数内の呼び出しと同等です。

     バージョン 3.12 で変更: 内包表記における ‘locals()’ の振る舞い は、
     PEP 709(2) で説明されているように更新されました。

     バージョン 3.13 で変更: PEP 667(3) の一部として、この関数から返され
     るマッピングオブジェクトを変更するセマンティクスが定義されました。
     *note optimized scopes: 6b3. の振る舞いは上記のようになりました。定
     義されただけで、その他のスコープの振る舞いは以前のバージョンのまま
     です。

 -- の関数: map (function, iterable, /, *iterables, strict=False)

     'function' を 'iterable' の全ての要素に適用した結果を返していくイテ
     レータを返します。追加で 'iterables' 引数が渡された場合、
     'function' はその数だけの引数を取らなければならず、全てのイテラブル
     から並行して取り出された要素に適用されます。複数のイテラブルがある
     とき、このイテレータはその中の最短のイテラブルが尽きた時点で止まり
     ます。 'strict' が ‘True’ の場合は、ある iterable が他の iterable よ
     り先に尽きると *note ValueError: 15a. 例外が発生します。関数の入力
     がすでに引数のタプルの形で渡される場合は、 *note
     itertools.starmap(): 14a3. を使用してください。

     バージョン 3.14 で変更: 'strict' パラメータが追加されました。

 -- の関数: max (iterable, /, *, key=None)

 -- の関数: max (iterable, /, *, default, key=None)

 -- の関数: max (arg1, arg2, /, *args, key=None)

     iterable の中で最大の要素、または2つ以上の引数の中で最大のものを返
     します。

     位置引数が1つだけ与えられた場合、それは空でない *note iterable:
     149a. でなくてはいけません。その iterable の最大の要素が返されます
     。2 つ以上のキーワード無しの位置引数が与えられた場合、その位置引数
     の中で最大のものが返されます。

     任意のキーワード専用引数が 2 つあります。 'key' 引数は引数を 1 つ取
     る順序関数 (*note list.sort(): f91. のもののように) を指定します。
     'default' 引数は与えられたイテラブルが空の場合に返すオブジェクトを
     指定します。 イテラブルが空で 'default' が与えられていない場合
     *note ValueError: 15a. が送出されます。

     最大の要素が複数あるとき、この関数はそのうち最初に現れたものを返し
     ます。これは、‘sorted(iterable, key=keyfunc, reverse=True)[0]’ や
     ‘heapq.nlargest(1, iterable, key=keyfunc)’ のような、他のソート安定
     性を維持するツールと両立します。

     バージョン 3.4 で変更: キーワード専用引数 'default' が追加されまし
     た。

     バージョン 3.8 で変更: 'key' 引数が ‘None’ であることを許容します。

 -- クラス: memoryview (object)

     与えられたオブジェクトから作られた "メモリビュー" オブジェクトを返
     します。詳しくは *note メモリビュー: 27f0. を参照してください。

 -- の関数: min (iterable, /, *, key=None)

 -- の関数: min (iterable, /, *, default, key=None)

 -- の関数: min (arg1, arg2, /, *args, key=None)

     iterable の中で最小の要素、または2つ以上の引数の中で最小のものを返
     します。

     位置引数が1つだけ与えられた場合、それは空でない *note iterable:
     149a. でなくてはいけません。その iterable の最小の要素が返されます
     。2 つ以上のキーワード無しの位置引数が与えられた場合、その位置引数
     の中で最小のものが返されます。

     任意のキーワード専用引数が 2 つあります。 'key' 引数は引数を 1 つ取
     る順序関数 (*note list.sort(): f91. のもののように) を指定します。
     'default' 引数は与えられたイテラブルが空の場合に返すオブジェクトを
     指定します。 イテラブルが空で 'default' が与えられていない場合
     *note ValueError: 15a. が送出されます。

     最小の要素が複数あるとき、この関数はそのうち最初に現れたものを返し
     ます。これは、‘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: 6d4. の *note __next__(): 1687. メソッドを呼び出す
     ことにより、次の要素を取得します。イテレータが使い尽くされた場合、
     'default' が与えられていればその値が返されます。そうでない場合は
     *note StopIteration: fbe. が送出されます。

 -- クラス: object

     これが、あらゆるクラスに継承される大本のベースクラスです。このクラ
     スが持つメソッドは、どの Python クラスのインスタンスにもあります。
     コンストラクタを呼び出すと、まっさらなオブジェクトが返ります。コン
     ストラクタに引数は指定できません。

          注釈: *note object: e51. インスタンスは *note __dict__: 1ca. 属
          性を '持たない' ので、 ‘object’ クラスのインスタンスに任意の属
          性を代入することはできません。

 -- の関数: oct (integer, /)

     整数を先頭に "0o" が付いた 8 進文字列に変換します。 結果は Python の
     式としても使える形式になります。 'integer' が Python の *note int:
     32e. オブジェクトでない場合、整数を返す *note __index__(): 444. メ
     ソッドが定義されていなければなりません。 例えば、次のようになります
     :

          >>> 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(): 440. も参照してください。

 -- の関数: open (file, mode='r', buffering=-1, encoding=None,
          errors=None, newline=None, closefd=True, opener=None)

     'file' を開き、対応する *note ファイルオブジェクト: 1581. を返しま
     す。ファイルを開くことができなければ、*note OSError: 543. が送出さ
     れます。 この関数の利用例について、 *note ファイルを読み書きする:
     2273. を参照してください。

     'file' は *note path-like object: 7a5. で、開くファイルのパス名 (絶
     対パスまたは現在の作業ディレクトリからの相対パス) あるいはラップす
     るファイルの整数のファイルデスクリプタを与えます。 (ファイルデスク
     リプタが与えられた場合、 'closefd' が ‘False’ に設定されていないか
     ぎり、この関数が返す I/O オブジェクトがクローズされるときにファイル
     デスクリプタもクローズされます。)

     'mode' オプション文字列はファイルが開かれる際のモードを指定します。
     デフォルトは ‘'r'’ で、読み込み用にテキストモードで開くという意味で
     す。その他によく使われるモードとして、書き込み用の ‘'w'’ (ファイル
     が既に存在する場合は上書きします) 、排他的な生成をあらわす ‘'x'’ 、
     そして追記用の ‘'a'’ ( 'いくつかの' Unix システムでは、 'すべての'
     書き込みは現在のシーク位置にかかわらずファイルの末尾に追記する、と
     いう意味です) です。テキストモードで 'encoding' が指定されない場合
     に使われるエンコーディングは、プラットフォーム依存です: 現在のロケ
     ールエンコーディングを取得するために *note locale.getencoding():
     a4a. が呼ばれます。 (生のバイトデータを読み書きする際にはバイナリモ
     ードを使い、 'encoding' は指定しません。) 指定できるモードは以下の
     通りです:

     文字          意味
                   
     ----------------------------------------------------------------------------------
                   
     ‘'r'’         読み込み用に開く (デフォルト)
                   
                   
     ‘'w'’         書き込み用に開き、まずファイルを切り詰める
                   
                   
     ‘'x'’         排他的な生成に開き、ファイルが存在する場合は失敗する
                   
                   
     ‘'a'’         書き込み用に開き、ファイルが存在する場合には末尾に追記する
                   
                   
     ‘'b'’         バイナリモード
                   
                   
     ‘'t'’         テキストモード (デフォルト)
                   
                   
     ‘'+'’         更新用に開く (読み込み・書き込み用)
                   

     デフォルトのモードは ‘'r'’ (テキストの読み込み用に開く、 ‘'rt'’ と
     同義) です。 ‘'w+'’ と ‘'w+b'’ はファイルを開いて上書きします。
     ‘'r+'’ と ‘'r+b'’ はファイルを上書きせずに開きます。

     *note 概要: 27f2. で触れられているように、Python はバイナリとテキス
     トの I/O を区別します。('mode' 引数に ‘'b'’ を含めて) バイナリモー
     ドで開かれたファイルは、内容をいかなるデコーディングもせずに *note
     bytes: 1d2. オブジェクトとして返します。(デフォルトや、 'mode' 引数
     に ‘'t'’ が含まれたときの) テキストモードでは、ファイルの内容は
     *note str: 1ea. として返され、バイト列はまず、プラットフォーム依存
     のエンコーディングか、'encoding' が指定された場合は指定されたエンコ
     ーディングを使ってデコードされます。

          注釈: Python は、下層のオペレーティングシステムがテキストファ
          イルをどう認識するかには依存しません; すべての処理は Python 自
          身で行われ、よってプラットフォーム非依存です。

     'buffering' はオプションの整数で、バッファリングのポリシーを設定す
     るために使われます。 バッファリングを無効化するためには0を渡してく
     ださい (バイナリモードでのみ設定可能です)。また行単位でのバッファリ
     ングには1を設定してください (テキストモードでの書き込み時のみ有効で
     す)。固定サイズのチャンクバッファに対するサイズをバイト単位で指定し
     たい場合は、1より大きい整数を渡してください。この形式でバッファサイ
     ズを指定した場合、バイナリ形式でバッファリングをサポートする I/O
     (buffered I/O) にはそのまま適用されますが、 ‘TextIOWrapper’ (すなわ
     ち ‘mode='r+'’ のモードでオープンされたファイル) では別のバッファリ
     ングを行うかもしれません。 ‘TextIOWrapper’ でバッファリングを無効化
     するには、 *note io.TextIOWrapper.reconfigure(): f0a. で
     ‘write_through’ フラグを使うことを検討してください。 'buffering' 引
     数が与えられなかった場合、デフォルトのバッファリングポリシーは以下
     のように動作します:

        * バイナリモードでは、固定サイズのチャンクバッファが使われます。
          バッファのサイズは、デバイスのブロックサイズが取得できる場合は
          ‘max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)’ です。ほとん
          どの環境では、このバッファは通常 128 キロバイトです。

        * 「対話的な」テキストファイル (*note isatty(): 2276. が ‘True’
          を返すファイル) は行バッファリングを使用します。 その他のテキ
          ストファイルは、上で説明したバイナリファイル用の方針を使用しま
          す。

     'encoding' はファイルのエンコードやデコードに使われる *note text
     encoding: 27f3. の名前です。このオプションはテキストモードでのみ使
     用してください。デフォルトエンコーディングはプラットフォーム依存
     (*note locale.getencoding(): a4a. が返すもの) ですが、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, though
     any error handling name that has been registered with *note
     codecs.register_error(): 1853. is also valid.  The standard names
     can be found in *note エラーハンドラ: 1d8b.

     'newline' はストリームから受け取った改行文字をどのようにパースする
     かを決定します。 ‘None’, ‘''’, ‘'\n'’, ‘'\r'’, または ‘'\r\n'’ のい
     ずれかを指定できます。これは以下のように動作します:

        * ストリームからの入力の読み込み時、'newline' が ‘None’ の場合、
          ユニバーサル改行モードが有効になります。入力中の行は ‘'\n'’,
          ‘'\r'’, または ‘'\r\n'’ で終わり、呼び出し元に返される前に
          ‘'\n'’ に変換されます。 ‘''’ の場合、ユニバーサル改行モードは
          有効になりますが、行末は変換されずに呼び出し元に返されます。そ
          の他の正当な値の場合、入力行は与えられた文字列でのみ終わり、行
          末は変換されずに呼び出し元に返されます。

        * ストリームへの出力の書き込み時、'newline' が ‘None’ の場合、全
          ての ‘'\n'’ 文字はシステムのデフォルトの行セパレータ *note
          os.linesep: 27f4. に変換されます。 'newline' が ‘''’ または
          ‘'\n'’ の場合は変換されません。'newline' がその他の正当な値の
          場合、全ての ‘'\n'’ 文字は与えられた文字列に変換されます。

     'closefd' が ‘False’ で、ファイル名ではなくてファイル記述子が与えら
     れた場合、下層のファイル記述子はファイルが閉じられた後も開いたまま
     となります。 ファイル名が与えられた場合、'closefd' は ‘True’ (デフ
     ォルト値) でなければなりません。 そうでない場合エラーが送出されます
     。

     呼び出し可能オブジェクトを 'opener' として与えることで、カスタムの
     オープナーが使えます。そしてファイルオブジェクトの下層のファイル記
     述子は、'opener' を ('file', 'flags') で呼び出して得られます。
     'opener' は開いたファイル記述子を返さなければなりません。 (*note
     os.open: 114f. を 'opener' として渡すと、‘None’ を渡したのと同様の
     機能になります)。

     新たに作成されたファイルは *note 継承不可: 12ad. です。

     次の例は *note os.open(): 114f. 関数の *note dir_fd: 14ab. 引数を使
     い、与えられたディレクトリからの相対パスで指定されたファイルを開き
     ます:

          >>> 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(): 333. 関数が返す *note file object: 1581. の型はモード
     に依存します。 ‘open()’ をファイルをテキストモード (‘'w'’, ‘'r'’,
     ‘'wt'’, ‘'rt'’, など) で開くのに使ったときは *note io.TextIOBase:
     a89. (特に *note io.TextIOWrapper: ba0.) のサブクラスを返します。 フ
     ァイルをバッファリング付きのバイナリモードで開くのに使ったときは
     *note io.BufferedIOBase: a88. のサブクラスを返します。 実際のクラス
     は様々です。 読み込みバイナリモードでは *note io.BufferedReader:
     15cb. を返します。 書き込みバイナリモードや追記バイナリモードでは
     *note io.BufferedWriter: 176a. を返します。 読み書きモードでは
     *note io.BufferedRandom: 176b. を返します。 バッファリングが無効な
     ときはrawストリーム、すなわち *note io.RawIOBase: 1490. のサブクラ
     スである *note io.FileIO: 16c9. を返します。

     *note fileinput: 5e. 、(*note open(): 333. が宣言された場所である)
     *note io: 82. 、 *note os: a5. 、 *note os.path: a6. 、 *note
     tempfile: e9. 、 *note shutil: cd. などの、ファイル操作モジュールも
     参照してください。

     引数 ‘path’, ‘mode’, ‘flags’ を指定して *note 監査イベント: 1e84.
     ‘open’ を送出します。

     ‘mode’ と ‘flags’ の2つの引数は呼び出し時の値から修正されたり、推量
     により設定されたりする可能性があります。

     バージョン 3.3 で変更:

        * 'opener' 引数を追加しました。

        * ‘'x'’ モードを追加しました。

        * 以前は *note IOError: 1409. が送出されました; それは現在 *note
          OSError: 543. のエイリアスです。

        * 既存のファイルを 排他的生成モード(‘'x'’)で開いた場合、 *note
          FileExistsError: 13cd. を送出するようになりました。

     バージョン 3.4 で変更:

        * ファイルが継承不可になりました。

     バージョン 3.5 で変更:

        * システムコールが中断されシグナルハンドラが例外を送出しなかった
          場合、この関数は *note InterruptedError: 1145. 例外を送出する
          代わりにシステムコールを再試行するようになりました (論拠につい
          ては PEP 475(4) を参照してください)。

        * ‘'namereplace'’ エラーハンドラが追加されました。

     バージョン 3.6 で変更:

        * *note os.PathLike: 1013. を実装したオブジェクトを受け入れるよ
          うになりました。

        * Windowsでは、コンソールバッファのオープンは、*note io.FileIO:
          16c9. ではなく、*note io.RawIOBase: 1490. のサブクラスを返すで
          しょう。

     バージョン 3.11 で変更: ‘'U'’ モードは削除されました。

 -- の関数: ord (character, /)

     文字の番号を返します。

     引数が１文字の文字列の場合は、その文字の Unicode コードポイントを返
     します。例えば ‘ord('a')’ は ‘97’ 、 ‘ord('€')’ (ユーロ) は ‘8364’
     になります。 *note chr(): 1c17. と反対の操作です。

     引数が 長さ１の *note bytes: 1d2. または *note bytearray: 1d1. であ
     る場合は、そのバイト値を返します。例えば、 ‘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: 32e. 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: 32f. 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: 32e. オペランドで '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: 32e. オペランドに対して、三引数形
     式の ‘pow’ で第二引数に負の値を取ることができるようになりました。こ
     れによりモジュラ逆数の計算が可能になります。

     バージョン 3.8 で変更: キーワード引数を取ることができるようになりま
     した。以前は位置引数だけがサポートされていました。

 -- の関数: print (*objects, sep=' ', end='\n', file=None, flush=False)

     'objects' を 'sep' で区切りながらテキストストリーム 'file' に表示し
     、最後に 'end' を表示します。'sep' 、 'end' 、 'file' 、 'flush' を
     与える場合、キーワード引数として与える必要があります。

     キーワードなしの引数はすべて、 *note str(): 1ea. がするように文字列
     に変換され、 'sep' で区切られながらストリームに書き出され、最後に
     'end' が続きます。 'sep' と 'end' の両方とも、文字列でなければなり
     ません。これらを ‘None’ にすると、デフォルトの値が使われます。
     'objects' が与えられなければ、 *note print(): 1324. は 'end' だけを
     書き出します。

     'file' 引数は、 ‘write(string)’ メソッドを持つオブジェクトでなけれ
     ばなりません。指定されないか、 ‘None’ である場合、 *note
     sys.stdout: ea0. が使われます。表示される引数は全てテキスト文字列に
     変換されますから、 *note print(): 1324. はバイナリモードファイルオ
     ブジェクトには使用できません。代わりに ‘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(): 6c1. を *note
     デコレータ: b1d. として使えば、読み出し専用 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: d13. は、実際には関数ではなくイミュータブルなシーケン
     ス型で、 *note range: 27f5. と *note シーケンス型 -- list, tuple,
     range: 223b. にドキュメント化されています。

 -- の関数: repr (object, /)

     オブジェクトの印字可能な表現を含む文字列を返します。この関数は多く
     の型について、 *note eval(): 18f. に渡されたときと同じ値を持つよう
     なオブジェクトを表す文字列を生成しようとします。そうでない場合は、
     山括弧に囲まれたオブジェクトの型の名前と追加の情報 (大抵の場合はオ
     ブジェクトの名前とアドレスを含みます) を返します。クラスは、 *note
     __repr__(): 1c7. メソッドを定義することで、この関数によりそのクラス
     のインスタンスが返すものを制御することができます。*note
     sys.displayhook(): 18d7. にアクセスできない場合、この関数は *note
     RuntimeError: 317. を送出します。

     このクラスは、eval 評価可能な独自の representation を持ちます:

          class Person:
             def __init__(self, name, age):
                self.name = name
                self.age = age

             def __repr__(self):
                return f"Person({self.name!r}, {self.age!r})"

 -- の関数: reversed (object, /)

     要素を逆順に取り出すイテレータ (reverse *note iterator: 6d4.) を返
     します。引数は *note __reversed__(): 104d. メソッドを持つか、シーケ
     ンス型プロトコル ( *note __len__(): 19aa. メソッド、および、 ‘0’ 以
     上の整数を引数とする *note __getitem__(): 78d. メソッド) をサポート
     するオブジェクトでなければなりません。

 -- の関数: round (number, ndigits=None)

     'number' を小数点以下 'ndigits' 桁の精度で丸めた値を返します。
     'ndigits' が省略されたり、‘None’ だった場合、入力値に最も近い整数を
     返します。

     *note round(): 1694. をサポートする組み込み型では、値は 10 のマイナ
     ス 'ndigits' 乗の倍数の中で最も近いものに丸められます; 二つの倍数が
     同じだけ近いなら、偶数を選ぶ方に (そのため、例えば ‘round(0.5)’ と
     ‘round(-0.5)’ は両方とも ‘0’ に、 ‘round(1.5)’ は ‘2’ に) 丸められ
     ます。 'ndigits' には任意の整数値が有効となります (正の整数、ゼロ、
     負の整数)。 返り値は 'ndigits' が指定されていないか ‘None’ の場合は
     整数、そうでなければ返り値は 'number' と同じ型です。

     一般的な Python オブジェクト ‘number’ に対して、‘round’ は処理を
     ‘number.__round__’ に移譲します。

          注釈: 浮動小数点数に対する *note round(): 1694. の振る舞いは意
          外なものかもしれません: 例えば、 ‘round(2.675, 2)’ は予想通り
          の ‘2.68’ ではなく ‘2.67’ を与えます。これはバグではありません
          : これはほとんどの小数が浮動小数点数で正確に表せないことの結果
          です。詳しくは *note 浮動小数点演算、その問題と制限: 230f. を
          参照してください。

 -- クラス: set (iterable=(), /)

     オプションで 'iterable' の要素を持つ、新しい *note set: 432. オブジ
     ェクトを返します。 ‘set’ は組み込みクラスです。このクラスについて詳
     しい情報は ‘set’ や *note set（集合）型 -- set, frozenset: 223e. を
     参照してください。

     他のコンテナについては *note collections: 1e. モジュールや組み込み
     の *note frozenset: 9d9. 、 *note list: 4e0. 、 *note tuple: 1d9. 、
     *note dict: 193. クラスを参照してください。

 -- の関数: setattr (object, name, value, /)

     *note getattr(): f93. の相方です。引数はオブジェクト、文字列、それ
     から任意の値です。文字列は既存の属性または新たな属性の名前にできま
     す。この関数は指定したオブジェクトが許せば、値を属性に関連付けます
     。例えば、 ‘setattr(x, 'foobar', 123)’ は ‘x.foobar = 123’ と等価で
     す。

     *note __getattribute__(): f94. のカスタマイズや *note __slots__:
     18a3. を通じてオブジェクトが強制していない限り、 'name' は *note
     Names (identifiers and keywords): 24af. で定義されている Python 識
     別子である必要はありません。属性名が識別子でない場合、ドットを使っ
     た属性へのアクセスはできませんが、 *note getattr(): f93. などを通じ
     てアクセス可能です。

          注釈: *note プライベートな名前のマングリング: 22b1. はコンパイ
          ル時に行われます。そのため、プライベートな属性 (先頭に2つのア
          ンダースコアを伴う名前を持つ属性) の値を *note setattr():
          27d6. でセットするためには、属性名を手動でマングリングする必要
          があります。

 -- クラス: sentinel (name, /)

     Return a new unique sentinel object.  'name' must be a *note str:
     1ea, and is used as the returned object's representation:

          >>> MISSING = sentinel("MISSING")
          >>> MISSING
          MISSING

     Sentinel objects are truthy and compare equal only to themselves.
     They are intended to be compared with the *note is: 32c. operator.

     ‘sentinel’ does not support subclassing.

     Shallow and deep copies of a sentinel object return the object
     itself.

     Sentinels are conventionally assigned to a variable with a matching
     name.  Sentinels defined in this way can be used in *note type
     hints: 25e0.:

          MISSING = sentinel("MISSING")

          def next_value(default: int | MISSING = MISSING):
              ...

     Sentinel objects support the *note |: 26e3. operator for use in
     type expressions.

     *note Pickling: ab. is supported for sentinel objects that are
     placed in the global scope of a module under a name matching the
     sentinel's name, and for sentinels placed in class scopes with a
     name matching the *note qualified name: 1f38. of the sentinel.
     Other sentinels, such as those defined in a function scope, are not
     picklable.  The identity of the sentinel is preserved after
     pickling:

          import pickle

          PICKLABLE = sentinel("PICKLABLE")

          assert pickle.loads(pickle.dumps(PICKLABLE)) is PICKLABLE

          class Cls:
              PICKLABLE = sentinel("Cls.PICKLABLE")

          assert pickle.loads(pickle.dumps(Cls.PICKLABLE)) is Cls.PICKLABLE

     Sentinel objects have the following attributes:

      -- の属性: __name__

          The sentinel's name.

      -- の属性: __module__

          The name of the module where the sentinel was created.

     Added in version 3.15.

 -- クラス: slice (stop, /)

 -- クラス: slice (start, stop, step=None, /)

     ‘range(start, stop, step)’ で指定されたインデックスのセットを表す
     *note slice: 26c4. オブジェクトを返します。 引数 'start' と 'step'
     のデフォルトは ‘None’ です。

     slice オブジェクトは *note スライス表記: 26c3. を使用したときにも作
     られます。例えば ‘a[start:stop:step]’ や ‘a[start:stop, i]’ です。

     *note iterator: 6d4. 版として *note itertools.islice(): f0d. 関数が
     あります。

      -- の属性: start
      -- の属性: stop
      -- の属性: step

          これらの属性は読み取り専用で、引数として渡された値 (またはデフ
          ォルト値) にセットされます。値を格納する以外に他に直接的な機能
          はありません。ただし、Numpy などのサードパーティパッケージが使
          用します。

     バージョン 3.12 で変更: スライスオブジェクトが *note hashable: 18e.
     (ハッシュ可能) となりました (ただし、属性 *note start: 25b9. 、
     *note stop: 25ba. 、 *note step: 25bb. がすべてハッシュ可能である場
     合に限ります)。

 -- の関数: sorted (iterable, /, *, key=None, reverse=False)

     'iterable' の要素を並べ替えた新たなリストを返します。

     2 つのオプション引数があり、これらはキーワード引数として指定されな
     ければなりません。

     'key' には 1 引数関数を指定します。これは 'iterable' の各要素から比
     較キーを展開するのに使われます (例えば、 ‘key=str.lower’ のように指
     定します)。 デフォルト値は ‘None’ です (要素を直接比較します)。

     'reverse' は真偽値です。 ‘True’ がセットされた場合、リストの要素は
     個々の比較が反転したものとして並び替えられます。

     旧式の 'cmp' 関数を 'key' 関数に変換するには *note
     functools.cmp_to_key(): 1598. を使用してください。

     組み込みの *note sorted(): f90. 関数は安定なことが保証されています
     。同等な要素の相対順序を変更しないことが保証されていれば、ソートは
     安定です。これは複数のパスでソートを行なうのに役立ちます（例えば部
     署でソートしてから給与の等級でソートする場合）。

     ソートアルゴリズムは、要素間の比較に ‘<’ 演算子だけを使います。した
     がってソートのためには *note __lt__(): 165a. メソッドを定義すれば十
     分なはずですが、 PEP 8(5) は6つの *note 比較演算子: 26e6. を全て実
     装することを推奨しています。これにより、異なるメソッドを必要とする
     *note max(): 12bd. のような他のソートツールを、同じデータに対して適
     用することによって起こりうるバグを避ける助けになります。6つの比較演
     算子を全て実装することは、リフレクションによって *note __gt__():
     16c5. メソッドを呼び出す可能性のある型混合の比較での混乱を避けるこ
     とにも役立ちます。

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 1599.
     を参照して下さい。

 -- の関数: @staticmethod

     メソッドを静的メソッドへ変換します。

     静的メソッドは暗黙の第一引数を受け取りません。静的メソッドを宣言す
     るには、このイディオムを使ってください:

          class C:
              @staticmethod
              def f(arg1, arg2, argN): ...

     ‘@staticmethod’ 形式は関数 *note デコレータ: b1d. です。詳しくは
     *note 関数定義: 2224. を参照してください。

     静的メソッドは (‘C.f()’ のように) クラスに対して呼び出すことも、
     (‘C().f()’ のように) インスタンスに対して呼び出すこともできます。さ
     らに、静的メソッド *note descriptor: 22a. は呼び出し可能でもあるた
     め、(‘f()’ のように) クラス定義の中でも使用できます。

     Python における静的メソッドは Java や C++ における静的メソッドと類
     似しています。クラスコンストラクタの代替を生成するのに役立つ変種、
     *note classmethod(): 6a0. も参照してください。

     あらゆるデコレータと同じく、 ‘staticmethod’ は普通の関数のように呼
     べ、その返り値で処理が行えます。 この機能は、クラス本体から関数を参
     照する必要があり、かつ、インスタンスメソッドに自動変換されるのを避
     けたいケースで必要になります。 そのようなケースでは、このイディオム
     が使えます:

          def regular_function():
              ...

          class C:
              method = staticmethod(regular_function)

     静的メソッドについて詳しい情報は *note 標準型の階層: 253e. を参照し
     てください。

     バージョン 3.10 で変更: Static methods now inherit the method
     attributes (*note __module__: 2559, *note __name__: 168e, *note
     __qualname__: 2558, *note __doc__: 1597. and *note __annotations__:
     1596.), 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: 1ea. 版を返します。詳細は *note str(): 1ea.
     を参照してください。

     ‘str’ は組み込みの文字列 *note クラス: 1f11. です。文字列に関する一
     般的な情報は、*note テキストシーケンス型 -- str: 21ec. を参照してく
     ださい。

 -- の関数: sum (iterable, /, start=0)

     'start' と 'iterable' の要素を左から右へ合計し、総和を返します。
     'iterable' の要素は通常は数値で、start の値は文字列であってはなりま
     せん。

     使う場面によっては、 *note sum(): 886. よりもいい選択肢があります。
     文字列からなるシーケンスを結合する高速かつ望ましい方法は
     ‘''.join(sequence)’ を呼ぶことです。浮動小数点数値を拡張された精度
     で加算するには、 *note math.fsum(): 178d. を参照してください。一連
     のイテラブルを連結するには、 *note itertools.chain(): 19b. の使用を
     考えてください。

     バージョン 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: 27a3. (メソッド解決順序) を決定します。検索は 'type' 直後の
     クラスから開始します。

     例えば 'object_or_type' の *note __mro__: 2588. 属性が ‘D -> B -> C
     -> A -> object’ であり、 'type' の値が ‘B’ だとすると、 *note
     super(): 44a. は ‘C -> A -> object’ の順番でメソッドを検索します。

     The *note __mro__: 2588. attribute of the class corresponding to
     'object_or_type' lists the method resolution search order used by
     both *note getattr(): f93. and *note super(): 44a.  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(): 44a. は属性のルック
     アップに対しても同様に動作します。考えうる用途のひとつは親クラスや
     兄弟クラスの *note descriptors: 22a. (デスクリプタ) を呼び出すこと
     です。

     なお、*note super(): 44a. は ‘super().__getitem__(name)’ のような明
     示的なドット表記属性探索の束縛処理の一部として実装されています。こ
     れは、 *note __getattribute__(): f94. メソッドを予測可能な順序でク
     ラスを検索するように実装し、協調的な多重継承をサポートすることで実
     現されています。従って、 ‘super()’ は文や ‘super()[name]’ のような
     演算子を使った暗黙の探索向けには定義されていません。

     また、 *note super(): 44a. の使用は引数無しの形式を除きメソッド内部
     に限定されないことにも注目して下さい。2引数の形式は、必要な要素を正
     確に指定するので、適当な参照を作ることができます。クラス定義中にお
     ける引数無しの形式は、定義されているクラスを取り出すのに必要な詳細
     を、通常の方法で現在のインスタンスにアクセスするようにコンパイラが
     埋めるのではたらきます。

     *note super(): 44a. を用いて協調的なクラスを設計する方法の実践的な
     提案は、 guide to using super()(6) を参照してください。

     バージョン 3.14 で変更: *note super: 44a. オブジェクトは pickle 可
     能 かつ コピー可能 になりました。

 -- クラス: tuple (iterable=(), /)

     *note tuple: 1d9. は、実際は関数ではなくイミュータブルなシーケンス
     型で、*note タプル型 (tuple): 2761. と *note シーケンス型 -- list,
     tuple, range: 223b. にドキュメント化されています。

 -- クラス: type (object, /)

 -- クラス: type (name, bases, dict, /, **kwargs)

     引数が1つだけの場合、'object' の型を返します。返り値は型オブジェク
     トで、一般に *note object.__class__: 1865. によって返されるのと同じ
     オブジェクトです。

     オブジェクトの型の判定には、 *note isinstance(): 2fb. 組み込み関数
     を使うことが推奨されます。これはサブクラスを考慮するからです。

     引数が3つの場合、新しい型オブジェクトを返します。これは本質的には
     *note class: 1691. 文の動的な書式です。 'name' 文字列はクラス名で、
     *note __name__: 1863. 属性になります。 'bases' 基底クラスのタプルで
     、 *note __bases__: 1864. 属性になります; 空の場合は全てのクラスの
     基底クラスである *note object: e51. が追加されます。 'dict' は、ク
     ラス本体の属性とメソッドの定義を含む辞書です; 辞書は *note
     __dict__: 101f. 属性になる前にコピーされたり、ラップされることがあ
     ります。以下の2つの文は同じ ‘type’ オブジェクトを生成します:

          >>> class X:
          ...     a = 1
          ...
          >>> X = type('X', (), dict(a=1))

     下記を参照してください。

        * *note Documentation on attributes and methods on classes:
          2580.

        * *note 型オブジェクト: 27f8.

     三引数形式の呼び出しに与えられたキーワード引数は、('metaclass' を除
     く) クラス定義におけるキーワード引数と同様に、適切なメタクラスの機
     構 (通常は *note __init_subclass__(): a27.) に渡されます。

     *note クラス生成をカスタマイズする: 100d. も参照してください。

     バージョン 3.6 で変更: ‘type.__new__’ をオーバーライドしていない
     ‘type’ のサブクラスは、オブジェクトの型を得るのに１引数形式を利用す
     ることができません。

     バージョン 3.15 で変更: 'dict' can now be a *note frozendict: 18d.

 -- の関数: vars ()

 -- の関数: vars (object, /)

     モジュール、クラス、インスタンス、あるいはそれ以外の ‘__dict__’ 属
     性を持つオブジェクトの、 *note __dict__: 1ca. 属性を返します。

     モジュールやインスタンスのようなオブジェクトは、更新可能な *note
     __dict__: 1ca. 属性を持っています。ただし、それ以外のオブジェクトで
     は ‘__dict__’ 属性への書き込みが制限されている場合があります。書き
     込みに制限がある例としては、辞書を直接更新されることを防ぐために
     *note types.MappingProxyType: 194. を使っているクラスがあります。

     引数がない場合 *note vars(): 2030. は *note locals(): 296. のように
     動作します。

     指定されたオブジェクトに *note __dict__: 1ca. 属性がない場合 (たと
     えばそのクラスが *note __slots__: 18a3. 属性を定義している場合)、
     *note TypeError: 29c. 例外が送出されます。

     バージョン 3.13 で変更: この関数を引数なしで呼び出したときの返り値
     は、 *note locals(): 296. 組み込み関数での説明に更新されました。

 -- の関数: 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(): 446. は、 'i' 番目のタプルが 引数に与
     えた各イテラブルの 'i' 番目の要素を含むような、タプルのイテレータを
     返します。

     *note zip(): 446. に対する別の考え方は、この関数は行を列に、また列
     を行に変換するということです。これは 行列の転置(7) とよく似ています
     。

     *note zip(): 446. は遅延評価です: イテラブルが ‘for’ ループに渡され
     たり、 *note list: 4e0. でラップされたりするなどして反復処理される
     まで、要素が実際に処理されることはありません。

     ここで考慮すべきことは、 *note zip(): 446. に渡されるイテラブルが異
     なる長さを持つことがあるという点です; ときには意図的な場合もあり、
     またときにはイテラブルを準備するコードにおけるバグのこともあるでし
     ょう。 Python はこの問題に対して3つの異なるアプローチを提供します:

        * デフォルトでは、 *note zip(): 446. は最も短いイテラブルが消費
          しきった時点で停止します。より繰り返し数の長いイテラブルの残り
          の要素は無視して、結果を最も短いイテラブルの長さに切り詰めます
          :

               >>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))
               [(0, 'fee'), (1, 'fi'), (2, 'fo')]

        * *note zip(): 446. は、しばしば受け取ったイテラブルが全て同じ長
          さであるという想定の下で使われます。そのような場合、
          ‘strict=True’ オプションの利用が推奨されます。その出力は通常の
          ‘zip()’ と同じです:

               >>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))
               [('a', 1), ('b', 2), ('c', 3)]

          しかし、デフォルトの動作と異なり、あるイテラブルが他のイテラブ
          ルよりも先に消費しきった場合に *note ValueError: 15a. 例外を送
          出します:

               >>> 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(): 1658. で提供されます。

     エッジケース: 引数としてイテラブルをひとつだけ渡した場合、 *note
     zip(): 446. は 1 タプルのイテレータを返します。引数なしの場合は空の
     イテレータを返します。

     ヒントとコツ:

        * イテラブルの左から右への評価順序は保証されています。そのため
          ‘zip(*[iter(s)]*n, strict=True)’ を使ってデータ系列を長さ n の
          グループにクラスタリングするイディオムが使えます。これは、各出
          力タプルがイテレータを ‘n’ 回呼び出した結果となるよう、 '同じ'
          イテレータを ‘n’ 回繰り返します。これは入力を長さ n のチャンク
          に分割する効果があります。

        * *note zip(): 446. に続けて ‘*’ 演算子を使うと、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(): 92c. とは違い、
          日常の Python プログラミングでは必要ない高等な関数です。

     この関数は *note import: 9df. 文により呼び出されます。 (*note
     builtins: 13. モジュールをインポートして ‘builtins.__import__’ に代
     入することで) この関数を置き換えて ‘import’ 文のセマンティクスを変
     更することができますが、同様のことをするのに通常はインポートフック
     ( PEP 302(8) 参照) を利用する方が簡単で、かつデフォルトのインポート
     実装が使用されていることを仮定するコードとの間で問題が起きないので
     、このやり方は '強く' 推奨されません。 *note __import__(): caa. を
     直接使用することも推奨されず、 *note importlib.import_module():
     92c. の方が好まれます。

     この関数は、モジュール 'name' をインポートし、 'globals' と
     'locals' が与えられれば、パッケージのコンテキストで名前をどう解釈す
     るか決定するのに使います。 'fromlist' は 'name' で与えられるモジュ
     ールからインポートされるべきオブジェクトまたはサブモジュールの名前
     を与ます。標準の実装では 'locals' 引数はまったく使われず、
     'globals' は *note import: 9df. 文のパッケージコンテキストを決定す
     るためにのみ使われます。

     'level' は絶対と相対どちらのインポートを使うかを指定します。 ‘0’ (デ
     フォルト) は絶対インポートのみ実行します。正の 'level' の値は、
     *note __import__(): caa. を呼び出したディレクトリから検索対象となる
     親ディレクトリの数を示します (詳細は 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__(): caa. がどのように最上位モジュールを返し
     ているかに注意して下さい。 *note import: 9df. 文により名前が束縛さ
     れたオブジェクトになっています。

     一方で、文 ‘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__(): caa. から ‘spam.ham’ モジュールが返され
     ます。このオブジェクトから、インポートされる名前が取り出され、それ
     ぞれの名前として代入されます。

     単純に名前からモジュール (パッケージの範囲内であるかも知れません) を
     インポートしたいなら、 *note importlib.import_module(): 92c. を使っ
     てください。

     バージョン 3.3 で変更: 負の 'level' の値はサポートされなくなりまし
     た (デフォルト値の 0 に変更されます)。

     バージョン 3.9 で変更: コマンドラインオプション *note -E: d2b. or
     *note -I: d2c. が指定された場合、環境変数 *note PYTHONCASEOK: d2a.
     は無視されるようになりました。

脚注
....

   ---------- 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: 5f6. 型の偽値です。‘False’ への代入は不正で、*note
     SyntaxError: 189. を送出します。

 -- データ: True

     *note bool: 5f6. 型の真値です。‘True’ への代入は不正で、*note
     SyntaxError: 189. を送出します。

 -- データ: None

     関数にデフォルト引数が渡されなかったときなどに、値の非存在を表すの
     に頻繁に用いられるオブジェクトです。‘None’ への代入は不正で、*note
     SyntaxError: 189. を送出します。‘None’ が *note NoneType: c2e. 型の
     唯一のインスタンスです。

 -- データ: NotImplemented

     特殊な二項演算のメソッド (e.g.  *note __eq__(): ec4, *note
     __lt__(): 165a, *note __add__(): 25f1, *note __rsub__(): 2604,
     etc.)  が、他の型に対して演算が実装されていないことを示すために返す
     特殊値です。インプレースの特殊な二項演算のメソッド (e.g.  *note
     __imul__(): 25f6, *note __iand__(): 2613, etc.)  も同じ理由でこの値
     を返すことがあります。この処理では真偽値コンテキストでの評価はして
     はいけません。‘NotImplemented’ が *note types.NotImplementedType:
     c2f. 型の唯一のインスタンスです。

          注釈: 二項演算の (あるいはインプレースの) メソッドが
          ‘NotImplemented’ を返した場合、インタープリタはもう一方の型で
          定義された対の演算で代用を試みます (あるいは演算によっては他の
          代替手段も試みます)。試行された演算全てが ‘NotImplemented’ を
          返した場合、インタープリタは適切な例外を送出します。
          ‘NotImplemented’ を正しく返さないと、誤解を招きかねないエラー
          メッセージになったり、 ‘NotImplemented’ が Python コードに返さ
          れるようなことになります。

          例として *note 算術演算の実装: 2541. を参照してください。

          注意: ‘NotImplemented’ and ‘NotImplementedError’ are not
          interchangeable.  This constant should only be used as
          described above; see *note NotImplementedError: 5a1. 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: 29c.  It previously evaluated
     to *note True: fd0. and emitted a *note DeprecationWarning: 2d4.
     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: 189.
     ‘Ellipsis’ is the sole instance of the *note types.EllipsisType:
     c2d. type.

 -- データ: __debug__

     この定数は、Python が *note -O: 438. オプションを有効にして開始され
     たのでなければ真です。 *note assert: d35. 文も参照して下さい。

     注釈: 名前 *note None: a6a. 、 *note False: ef9. 、 *note True:
     fd0. 、 *note __debug__: bbb. は再代入できない (これらに対する代入
     は、たとえ属性名としてであっても *note SyntaxError: 189. が送出され
     ます) ので、これらは「真の」定数であると考えられます。

* Menu:

* site モジュールで追加される定数::


File: python.info,  Node: site モジュールで追加される定数,  Up: 組み込み定数

5.3.1 ‘site’ モジュールで追加される定数
---------------------------------------

*note site: cf. モジュール (*note -S: 1566. コマンドラインオプションが指
定されない限り、スタートアップ時に自動的にインポートされます) は組み込み
名前空間にいくつかの定数を追加します。それらは対話的インタープリタシェル
で有用ですが、プログラム中では使うべきではありません。

 -- データ: 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: 10fb. 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(): cad.).

 -- データ: 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(): 462. 関数
や、わずかに異なる *note str(): 1ea. 関数によって) 文字列に変換できます
。オブジェクトが *note print(): 1324. 関数で印字されるとき、文字列に変換
する関数が暗黙に使われます。

* 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 frozendict. dict, frozendict
* コンテキストマネージャ型::
* 型アノテーション型: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン. ジェネリックエイリアス 、 ユニオン
* その他の組み込み型::
* 特殊属性::
* 整数と文字列の変換での長さ制限::


File: python.info,  Node: 真理値判定,  Next: ブール演算 --- and or not,  Up: 組み込み型

5.4.1 真理値判定
----------------

どのようなオブジェクトでも真理値として判定でき、 *note if: 32a. や *note
while: 1ba5. の条件あるいは以下のブール演算の被演算子として使えます。

By default, an object is considered true unless its class defines either
a *note __bool__(): 168f. method that returns ‘False’ or a *note
__len__(): 19aa. 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: 447.).  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 基本的なカスタマイズ: 25c1.) を参照してください。


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: 32c. と同等になります。 ‘<’,
‘<=’, ‘>’ および ‘>=’ 演算子は、それらの意味が明快である場合に限って定義
されます; たとえば、オペランドのいずれかが複素数である場合、これらの演算
子は *note TypeError: 29c. 例外を送出します。

あるクラスの同一でないインスタンスは、通常等価でないとされますが、そのク
ラスが *note __eq__(): ec4. メソッドを定義している場合は除きます。

クラスのインスタンスは、そのクラスがメソッド *note __lt__(): 165a. 、
*note __le__(): 16c4. 、 *note __gt__(): 16c5. 、 *note __ge__(): 16c6.
のうち十分なものを定義していない限り、同じクラスの別のインスタンスや他の
型のオブジェクトとは順序付けできません (一般に、比較演算子の通常の意味を
求めるなら、 ‘__lt__()’ と *note __eq__(): ec4. だけで十分です)。

*note is: 32c. および *note is not: 26ed. 演算子の振る舞いはカスタマイズ
できません。また、これらはいかなる 2 つのオブジェクトにも適用でき、決し
て例外を送出しません。

*note in: 32b. と *note not in: a25. という構文上で同じ優先度を持つ演算
子がさらに 2 つあり、 *note iterable: 149a. または *note __contains__():
1772. を実装した型でサポートされています。


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: 1fde. から入手可能です。複素数は実部と虚部を持ち、それぞ
れが浮動小数点数です。複素数 'z' から実部および虚部を取り出すには、
‘z.real’ および ‘z.imag’ を使ってください。 (標準ライブラリには、さらに
分数のための数値型 *note fractions.Fraction: 1ce. や、ユーザによる精度の
定義が可能な浮動小数点数のための *note decimal.Decimal: 1cd. があります
。)

数値は、数値リテラルによって、あるいは組み込み関数や演算子の戻り値として
生成されます。 (十六進、八進、二進数を含む) 修飾のない整数リテラルは、整
数を生成します。小数点または指数表記を含む数値リテラルは浮動小数点数を生
成します。数値リテラルに ‘'j'’ または ‘'J'’ をつけると純虚数 (実部がゼロ
の複素数) を生成し、それに整数や浮動小数点数を加えることにより実部と虚部
を持つ複素数を得ることができます。

コンストラクタ *note int(): 32e. 、 *note float(): 32f. 、 *note
complex(): 330. で、特定の型の数を生成できます。

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 演算子の優先順位: 2700. を参照してください):

演算                      結果                                  注釈          完全なドキュメント
                                                                              
-------------------------------------------------------------------------------------------------------
                                                                              
‘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(): 229a.
                                                                              
                                                                              
‘int(x)’                  'x' の整数への変換                    (3)(6)        *note int(): 32e.
                                                                              
                                                                              
‘float(x)’                'x' の浮動小数点数への変換            (4)(6)        *note float(): 32f.
                                                                              
                                                                              
‘complex(re, im)’         実部 're', 虚部 'im' の複素数。       (6)           *note complex(): 330.
                          'im' の既定値はゼロ。                               
                          
                                                                              
‘c.conjugate()’           複素数 'c' の共役複素数
                          
                                                                              
‘divmod(x, y)’            ‘(x // y, x % y)’ からなるペア        (2)           *note divmod(): d6e.
                                                                              
                                                                              
‘pow(x, y)’               'x' の 'y' 乗                         (5)           *note pow(): 448.
                                                                              
                                                                              
‘x ** y’                  'x' の 'y' 乗                         (5)
                                                                

注釈:

  1. 整数の除算とも呼ばれます。 *note int: 32e. 型のオペランドに対しては
     、結果は ‘int’ 型になります。 *note float: 32f. 型のオペランドに対
     しては、結果は ‘float’ 型になります。一般に結果の型は必ずしも ‘int’
     型ではありませんが、結果は常に整数です。結果は常に負の無限大の方向
     に丸められます: ‘1//2’ は ‘0’ 、 ‘(-1)//2’ は ‘-1’ 、 ‘1//(-2)’ は
     ‘-1’ 、そして ‘(-1)//(-2)’ は ‘0’ です。

  2. 複素数型には使えません。適用可能な場合には代わりに *note abs():
     229a. で浮動小数点型に変換してください。

  3. 
     *note float: 32f. から *note int: 32e. への変換は小数点以下を切り捨
     てます。別の変換方法については関数 *note math.floor(): 1776. や
     *note math.ceil(): 1777. を参照してください。

  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: 280a. 型 (*note int: 32e. 、 *note float:
32f.) は以下の演算も含みます:

演算                     結果
                         
---------------------------------------------------------------------------
                         
*note math.trunc(x): 1778.'x' を *note Integral: 261e. (整数) に切り捨て
                         ます
                         
                         
*note round(x[, n]): 1694.'x' を 'n' 桁に丸めます。丸め方は偶数丸めです。
                         'n' が省略されれば 0 がデフォルトとなります。
                         
                         
*note math.floor(x): 1776.'x' 以下の最大の *note Integral: 261e. (整数) を
                         返します
                         
                         
*note math.ceil(x): 1777.'x' 以上の最小の *note Integral: 261e. (整数) を
                         返します
                         

その他の数値演算は、 *note math: 91. や *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: 15a. が送出されます
     。

  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: 261e. *note 抽象基底クラス: 1574. を実
装します。さらに、追加のメソッドをいくつか提供します:

 -- メソッド: 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: c5b. が送出
     されます。

     'byteorder' 引数は、整数を表すのに使われるバイトオーダーを決定しま
     す。デフォルト値は ‘"big"’ です。 'byteorder' が ‘"big"’ なら、最上
     位のバイトがバイト配列の最初に来ます。 'byteorder' が ‘"little"’ な
     ら、最上位のバイトがバイト配列の最後に来ます。

     'signed' 引数は、整数を表すのに 2 の補数を使うかどうかを決定します
     。 'signed' が ‘False’ で、負の整数が与えられたなら、 *note
     OverflowError: c5b. が送出されます。 'signed' のデフォルト値は
     ‘False’ です。

     上記のデフォルト値は整数を 1 バイトのオブジェクトに適切に変換するの
     に使うことができます:

          >>> (65).to_bytes()
          b'A'

     ただし、デフォルト引数で 255 より大きな整数を変換しないでください。
     そうでなければ *note OverflowError: c5b. 例外を引き起こします。

     次と等価です:

          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: 43d. か、または bytes を生
     成する iterable でなければなりません。

     'byteorder' 引数は、整数を表すのに使われるバイトオーダーを決定しま
     す。デフォルト値は ‘"big"’ です。 'byteorder' が ‘"big"’ なら、最上
     位のバイトがバイト配列の最初に来ます。 'byteorder' が ‘"little"’ な
     ら、最上位のバイトがバイト配列の最後に来ます。ホストシステムにネイ
     ティブのバイトオーダーを要求するには、 *note sys.byteorder: 280f. を
     バイトオーダーの値として使ってください。

     '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(): 2810. に対するダ
     ックタイピングの互換性のために存在しています。

     Added in version 3.12.


File: python.info,  Node: 浮動小数点数に対する追加のメソッド,  Next: 複素数に対する追加のメソッド,  Prev: 整数型における追加のメソッド,  Up: 数値型 int float complex

5.4.4.3 浮動小数点数に対する追加のメソッド
..........................................

浮動小数点数型は、 *note numbers.Real: 280a. *note 抽象基底クラス: 1574.
を実装しています。浮動小数点型はまた、以下の追加のメソッドを持ちます。

 -- メソッド: classmethod float.from_number (x)

     数 'x' から生成された浮動小数点数を返すクラスメソッドです。

     引数が整数または浮動小数点数の場合、(Python の浮動小数点数の精度で)
     同じ値の浮動小数点数が返されます。 引数が Python の浮動小数点数の範
     囲外なら、 *note OverflowError: c5b. が送出されます。

     一般の Python オブジェクト ‘x’ に対して、‘float.from_number(x)’ は
     ‘x.__float__()’ に委譲します。 *note __float__(): d96. が定義されて
     いない場合、*note __index__(): 444. へフォールバックします。

     Added in version 3.14.

 -- メソッド: float.as_integer_ratio ()

     比が厳密に元の浮動小数点数であるような一対の整数を返します。比は既
     約分数として与えられ、分母は正の値です。無限大に対しては *note
     OverflowError: c5b. を、非数 (NaN) に対しては *note ValueError:
     15a. を送出します。

 -- メソッド: 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(): 2812. はクラスメソッドですが、 *note float.hex():
2311. はインスタンスメソッドであることに注意して下さい。

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(): 2311. の出力は C や Java コード中で、浮動小数点数の 16 進表
記として役に立つでしょう。また、 C の ‘%a’ 書式や、 Java の
‘Double.toHexString’ で書きだされた文字列は *note float.fromhex(): 2812.
で受け付けられます。

なお、指数部は 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: 2814. *note 抽象基底クラス:
1574. を実装しています。‘complex’ 型はまた、以下の追加のメソッドを持ちま
す。

 -- メソッド: classmethod complex.from_number (x)

     数値を複素数に変換するクラスメソッドです。

     一般的な Python オブジェクト ‘x’ に対して、
     ‘complex.from_number(x)’ は ‘x.__complex__()’ に処理を委譲します。
     *note __complex__(): 9e3. が定義されていない場合は *note
     __float__(): d96. にフォールバックします。 ‘__float__()’ も定義され
     ていない場合は *note __index__(): 444. にフォールバックします。

     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__():
ec5. メソッドドキュメントを参照してください)。実装の簡単さと 複数の数値
型 (*note int: 32e. 、 *note float: 32f. 、 *note decimal.Decimal: 1cd.
、 *note fractions.Fraction: 1ce. を含みます) 間の効率のため、Python の
数値型に対するハッシュ値はある単一の数学的関数に基づいていて、 その関数
はすべての有理数に対し定義されているため、 ‘int’ と ‘fractions.Fraction’
のすべてのインスタンスと、 ‘float’ と ‘decimal.Decimal’ のすべての有限な
インスタンスに 対して適用されます。本質的には、この関数は定数の素数 ‘P’
に対して ‘P’ を法とする還元で与えられます。 値 ‘P’ は、 *note
sys.hash_info: 13ad. の *note modulus: 2817. 属性として 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: 330.) 数 ‘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: 32f. や、 *note
complex: 330. のハッシュを計算する組み込みのハッシュと等価な 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: 5f6. 型はただ2つの定数イ
ンスタンス ‘True’ と ‘False’ を持ちます。

組み込み関数 *note bool(): 5f6. は、もしその値が真理値として解釈可能なら
ば、任意の値を真偽値に変換します (上記 *note 真理値判定: 1aa0. 節を参照
してください)。

論理演算には *note ブーリアン演算子: 2805. ‘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: 5f6. は *note int: 32e. のサブクラスです (*note 数値型 int,
float, complex: 21e8. を参照してください)。多くの数値的なコンテキストに
おいて、 ‘False’ と ‘True’ はそれぞれ整数 0 と 1 であるかのように振る舞
います。しかし、そのような振る舞いを信頼することは推奨されません; *note
int(): 32e. を使って明示的に整数値に変換してください。


File: python.info,  Node: イテレータ型,  Next: シーケンス型 --- list tuple range,  Prev: ブーリアン型 - bool,  Up: 組み込み型

5.4.6 イテレータ型
------------------

Python はコンテナでの反復処理の概念をサポートしています。この概念は 2 つ
の別々のメソッドを使って実装されています; これらのメソッドを使ってユーザ
定義のクラスで反復を行えるようにできます。後に詳しく述べるシーケンスは、
必ず反復処理メソッドをサポートしています。

コンテナオブジェクトが *note イテラブル: 149a. のサポートを提供するため
には、一つのメソッドが定義されていなければなりません:

 -- メソッド: container.__iter__ ()

     *note iterator: 6d4. オブジェクトを返します。オブジェクトは後述する
     イテレータプロトコルをサポートする必要があります。もしコンテナが異
     なる種類の反復処理をサポートするなら、それぞれの反復処理のためのイ
     テレータを要求するメソッドをそれぞれ提供しても構いません 。(複数の
     形式の反復処理を提供するオブジェクトの例として、幅優先探索と深さ優
     先探索をサポートする木構造が挙げられます。)このメソッドは Python/C
     API での Python オブジェクトの型構造体の *note tp_iter: 18a7. スロ
     ットに対応します。

イテレータオブジェクト自体は以下の 2 つのメソッドをサポートする必要があ
ります。これらのメソッドは 2 つ合わせて 'iterator protocol': (イテレータ
プロトコル) を成します:

 -- メソッド: iterator.__iter__ ()

     *note iterator: 6d4. オブジェクト自体を返します。このメソッドはコン
     テナとイテレータの両方を *note for: 329. および *note in: 32b. 文で
     使えるようにするために必要です。このメソッドは Python/C API におい
     て Python オブジェクトを表す型構造体の *note tp_iter: 18a7. スロッ
     トに対応します。

 -- メソッド: iterator.__next__ ()

     *note iterator: 6d4. の次のアイテムを返します。もしそれ以上アイテム
     が無ければ *note StopIteration: fbe. 例外を送出します。 このメソッ
     ドは Python/C APIでのPythonオブジェクトの型構造体の *note
     tp_iternext: 18a8. スロットに対応します。

Python では、いくつかのイテレータオブジェクトを定義して、一般のシーケン
ス型、特殊なシーケンス型、辞書型、その他の特殊な形式に渡って反復をサポー
トしています。特殊型は、イテレータプロトコルの実装以外では重要ではありま
せん。

イテレータの *note __next__(): 1687. メソッドが一旦 *note StopIteration:
fbe. を送出したなら、以降の呼び出しでも例外を送出し続けなければなりませ
ん。この特性に従わない実装は壊れているとみなされます。

* Menu:

* ジェネレータ型::


File: python.info,  Node: ジェネレータ型,  Up: イテレータ型

5.4.6.1 ジェネレータ型
......................

Python における *note generator: 1417. (ジェネレータ) は、イテレータプロ
トコルを実装する便利な方法を提供します。コンテナオブジェクトの *note
__iter__(): 1031. メソッドがジェネレータとして実装されていれば、そのメソ
ッドは *note __iter__(): 22bb. および *note __next__(): 22bc. メソッドを
提供するイテレータオブジェクト (厳密にはジェネレータオブジェクト) を自動
的に返します。ジェネレータに関する詳細な情報は、 *note yield
式のドキュメント: 26ae. にあります。


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 バイナリデータ: 27dc. や *note テキスト文字列: 21ec. を処理
するように仕立てられたシーケンス型は、セクションを割いて解説します。

* Menu:

* 共通のシーケンス演算::
* イミュータブルなシーケンス型::
* ミュータブルなシーケンス型::
* リスト型 (list): リスト型 list<2>.
* タプル型 (tuple): タプル型 tuple.
* range::


File: python.info,  Node: 共通のシーケンス演算,  Next: イミュータブルなシーケンス型,  Up: シーケンス型 --- list tuple range

5.4.7.1 共通のシーケンス演算
............................

以下の表にある演算は、ほとんどのミュータブル、イミュータブル両方のシーケ
ンスでサポートされています。カスタムのシーケンス型にこれらの演算を完全に
実装するのが簡単になるように、 *note collections.abc.Sequence: 1582. 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 比較: 26e6. を参照してく
ださい。)

ミュータブルなシーケンスに対する前方および逆方向イテレータはインデックス
を使って要素にアクセスします。インデックスは、仮に参照するシーケンスが変
化したとしても前方 (または後方) に進み続けます。イテレータは *note
IndexError: 18ed. または *note StopIteration: fbe. に出会った場合 (また
はインデックスがゼロより小さくなった場合) にのみ終了します。

注釈:

  1. ‘in’ および ‘not in’ 演算は、一般に単純な包含判定にのみ使われますが
     、(*note str: 1ea, *note bytes: 1d2, *note bytearray: 1d1. のような
     ) 特殊なシーケンスでは部分シーケンス判定にも使われます:

          >>> "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
     多次元のリストを作るにはどうしますか？: 2820. にあります。

  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: 1ea. オブジェクトを結合するには、リストを構築して最
          後に *note str.join(): 2821. を使うか、 *note io.StringIO:
          12d8. インスタンスに書き込んで完成してから値を取得してください

        * *note bytes: 1d2. オブジェクトを結合するなら、同様に *note
          bytes.join(): 2822. や *note io.BytesIO: 1258. を使うか、
          *note bytearray: 1d1. オブジェクトでインプレースに結合できます
          。 ‘bytearray’ オブジェクトはミュータブルで、効率のいい割り当
          て超過機構を備えています

        * *note tuple: 1d9. オブジェクトを結合するなら、代わりに *note
          list: 4e0. を拡張してください

        * その他の型については、関連するクラスのドキュメントを調べてくだ
          さい

  7. シーケンス型には、 (*note range: d13. のように) 特殊なパターンに従
     う項目のシーケンスのみをサポートするものがあり、それらはシーケンス
     の結合や繰り返しをサポートしません。

  8. An *note IndexError: 18ed. 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: 15a. を
     送出します。

     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(): 9e7. だ
けです。

このサポートにより、*note tuple: 1d9. インスタンスのようなイミュータブル
なシーケンスは、 *note dict: 193. のキーとして使え、 *note set: 432. や
*note frozenset: 9d9. インスタンスに保存できます。

ハッシュ不可能な値を含むイミュータブルなシーケンスをハッシュ化しようとす
ると、 *note TypeError: 29c. となります。


File: python.info,  Node: ミュータブルなシーケンス型,  Next: リスト型 list<2>,  Prev: イミュータブルなシーケンス型,  Up: シーケンス型 --- list tuple range

5.4.7.3 ミュータブルなシーケンス型
..................................

以下のテーブルにある演算は、ほとんどのミュータブルなシーケンスでサポート
されています。カスタムのシーケンス型にこれらの演算を完全に実装するのが簡
単になるように、 *note collections.abc.MutableSequence: 6cc. ABC が提供
されています。

このテーブルで、 's' はミュータブルなシーケンス型のインスタンス、 't' は
任意のイテラブルオブジェクト、 'x' は 's' に課された型と値の条件を満たす
任意のオブジェクト (例えば、 *note bytearray: 1d1. は値の制限 ‘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__(): 444. を実装したオブジェク
     トです。 'n' の値がゼロまたは負数の場合、シーケンスをクリアします。
     *note 共通のシーケンス演算: 281f. で ‘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: 6cc. *note ABC: 12cc, 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: 15a. を
     送出します。

 -- メソッド: 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(): f90. などい
     ろいろあります。

     リストは *note 共通の: 281f. および *note ミュータブルの: 27da. シ
     ーケンス演算をすべて実装します。リストは、更に以下のメソッドも提供
     します:

      -- メソッド: sort (*, key=None, reverse=False)

          このメソッドは、項目間の ‘<’ 比較のみを用いてリストをインプレ
          ースにソートします。例外は抑制されません。比較演算がどこかで失
          敗したら、ソート演算自体が失敗します (そしてリストは部分的に変
          更された状態で残されるでしょう)。

          *note sort(): f91. は、キーワードでしか渡せない 2 つの引数
          (*note キーワード専用引数: 7a9.) を受け付けます:

          'key' は一引数をとる関数を指定し、リストのそれぞれの要素から比
          較キーを取り出すのに使います (例えば、 ‘key=str.lower’)。それ
          ぞれの項目に対応するキーは一度計算され、ソート処理全体に使われ
          ます。デフォルトの値 ‘None’ は、別のキー値を計算せず、リストの
          値が直接ソートされることを意味します。

          2.x 形式の 'cmp' 関数を 'key' 関数に変換するために、*note
          functools.cmp_to_key(): 1598. ユーティリティが利用できます。

          'reverse' は真偽値です。 ‘True’ がセットされた場合、リストの要
          素は個々の比較が反転したものとして並び替えられます。

          このメソッドは、大きなシーケンスをソートするときの容量の節約の
          ため、シーケンスをインプレースに変化させます。副作用としてこの
          演算が行われることをユーザに気づかせるために、これはソートした
          シーケンスを返しません (新しいリストインスタンスを明示的に要求
          するには *note sorted(): f90. を使ってください)。

          *note sort(): f91. メソッドは安定していることが保証されていま
          す。ソートは、等しい要素の相対順序が変更されないことが保証され
          ていれば、安定しています。これは複数パスのソートを行なう (例え
          ば部署でソートして、それから給与の等級でソートする) のに役立ち
          ます。

          ソートの例と簡単なチュートリアルは *note ソートのテクニック:
          1599. を参照して下さい。

          リストがソートされている間、または変更しようとする試みの影響中
          、あるいは検査中でさえ、リストは未定義です。Python の C 実装で
          は、それらが続いている間、リストは空として出力され、リストがソ
          ート中に変更されていることを検知できたら *note ValueError:
          15a. を送出します。

参考
....

For detailed information on thread-safety guarantees for *note list:
4e0. objects, see *note Thread safety for list objects: 282c.


File: python.info,  Node: タプル型 tuple,  Next: range,  Prev: リスト型 list<2>,  Up: シーケンス型 --- list tuple range

5.4.7.5 タプル型 (tuple)
........................

タプルはイミュータブルなシーケンスで、一般的に異種のデータの集まり (組み
込みの *note enumerate(): 1839. で作られた 2-タプルなど) を格納するため
に使われます。タプルはまた、同種のデータのイミュータブルなシーケンスが必
要な場合 (*note set: 432. インスタンスや *note dict: 193. インスタンスに
保存できるようにするためなど) にも使われます。

 -- クラス: tuple (iterable=(), /)

     タプルの構成にはいくつかの方法があります:

        * 丸括弧の対を使い、空のタプルを表す: ‘()’

        * カンマを使い、単要素のタプルを表す: ‘a,’ または ‘(a,)’

        * 項目をカンマで区切る: ‘a, b, c’ または ‘(a, b, c)’

        * 組み込みの *note tuple(): 1d9. を使う: ‘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 共通の: 281f. シーケンス演算をすべて実装します。

異種のデータの集まりで、インデックスによってアクセスするよりも名前によっ
てアクセスしたほうが明確になるものには、単純なタプルオブジェクトよりも
*note collections.namedtuple(): 1da. が向いているかもしれません。


File: python.info,  Node: range,  Prev: タプル型 tuple,  Up: シーケンス型 --- list tuple range

5.4.7.6 range
.............

*note range: d13. 型は、数のイミュータブルなシーケンスを表し、一般に
*note for: 329. ループにおいて特定の回数のループに使われます。

 -- クラス: range (stop, /)

 -- クラス: range (start, stop, step=1, /)

     range コンストラクタの引数は整数 (組み込みの *note int: 32e. または
     *note __index__(): 444. 特殊メソッドを実装するオブジェクト) でなけ
     ればなりません。'step' 引数が省略された場合のデフォルト値は ‘1’ で
     す。'start' 引数が省略された場合のデフォルト値は ‘0’ です。 'step'
     が 0 の場合、*note ValueError: 15a. が送出されます。

     '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: 1583. より大きい絶対値を含むことができ
     ますが、いくつかの機能 (*note len(): a24. など) は *note
     OverflowError: c5b. を送出することがあります。

     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 共通の: 281f. シーケンス演算を、結合と繰り返し以外す
     べて実装します (range オブジェクトは厳格なパターンに従うシーケンス
     のみを表せ、繰り返しと結合はたいていそのパターンを破るという事実に
     よります)。

      -- の属性: start

          引数 'start' の値 (この引数が与えられていない場合は ‘0’)

      -- の属性: stop

          引数 'stop' の値

      -- の属性: step

          引数 'step' の値 (この引数が与えられていない場合は ‘1’)

*note range: d13. 型が通常の *note list: 4e0. や *note tuple: 1d9. にま
さる点は、‘range’ オブジェクトがサイズや表す範囲にかかわらず常に一定の
(小さな) 量のメモリを使うことです (‘start’、‘stop’、‘step’ の値のみを保
存し、後は必要に応じて個々の項目や部分 range を計算するためです)。

range オブジェクトは *note collections.abc.Sequence: 1582. ABC を実装し
、包含判定、要素インデックス検索、スライシングのような機能を提供し、負の
インデックスをサポートします (*note シーケンス型 -- list, tuple, range:
223b. を参照):

     >>> 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: 282f, *note stop: 2830. および *note
step: 2831. 属性を持つことがあります。例えば ‘range(0) == range(2, 1,
3)’ や ‘range(0, 3, 2) == range(0, 4, 2)’。)

バージョン 3.2 で変更: シーケンス ABC を実装。スライスと負のインデックス
のサポート。*note int: 32e. オブジェクトの帰属判定を、すべてのアイテムを
イテレートする代わりに、定数時間で行います。

バージョン 3.3 で変更: (オブジェクトの同一性に基づいて比較する代わりに)
range オブジェクトをそれらが定義する値のシーケンスに基づいて比較するよう
に '==' と '!=' を定義しました。

属性 *note start: 282f, *note stop: 2830. および *note step: 2831. が追
加。

参考
....

   * 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: 1ea. メソ                                        *note bytes: 1d2. また
                               ッド                                                        は
                                                                                           *note bytearray: 1d1.
                                                                                           メソッド
                                                                                           
---------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                              
Formatting                     *note str.format(): a17.
                               
                                                                                                                         
*note str.format_map(): 1194.

*note f-strings: 441.

*note printf 形式の文字列書式化: abe.                           *note printf 形式での bytes の書式化: 113e.
                                                                
                                                                                                                              
Searching and Replacing        *note str.find(): 125c.*note str.rfind(): 125d.             *note bytes.find(): 1dec.*note bytes.rfind(): 1ded.
                                                                                                                    
                                                                                                                         
*note str.index(): 1be5.       *note str.rindex(): 1611.        *note bytes.index(): 2834. *note bytes.rindex(): 2835.
                                                                                           
                                                                                                                         
*note str.startswith(): 127c.                                   *note bytes.startswith(): 2836.
                                                                
                                                                                                                         
*note str.endswith(): 127d.                                     *note bytes.endswith(): 2837.
                                                                
                                                                                                                         
*note str.count(): 1bb2.                                        *note bytes.count(): 1bb3.
                                                                
                                                                                                                         
*note str.replace(): 6c6.                                       *note bytes.replace(): 1de.
                                                                
                                                                                                                              
Splitting and Joining          *note str.split(): 125e.    *note str.rsplit(): 160f.       *note bytes.split(): 2838.    *note bytes.rsplit(): 2839.
                                                                                                                         
                                                                                                                         
*note str.splitlines(): 1610.                                   *note bytes.splitlines(): 283a.
                                                                
                                                                                                                         
*note str.partition(): 125f.                                    *note bytes.partition(): 283b.
                                                                
                                                                                                                         
*note str.rpartition(): 1612.                                   *note bytes.rpartition(): 283c.
                                                                
                                                                                                                         
*note str.join(): 2821.                                         *note bytes.join(): 2822.
                                                                
                                                                                                                              
String Classification          *note str.isalpha(): 283d.                                  *note bytes.isalpha(): 283e.
                                                                                           
                                                                                                                         
*note str.isdecimal(): 283f.

*note str.isdigit(): 2840.                                      *note bytes.isdigit(): 2841.
                                                                
                                                                                                                         
*note str.isnumeric(): 2842.

*note str.isalnum(): 2843.                                      *note bytes.isalnum(): 2844.
                                                                
                                                                                                                         
*note str.isidentifier(): 1f59.

*note str.islower(): 2845.                                      *note bytes.islower(): 2846.
                                                                
                                                                                                                         
*note str.isupper(): 2847.                                      *note bytes.isupper(): 2848.
                                                                
                                                                                                                         
*note str.istitle(): 2849.                                      *note bytes.istitle(): 284a.
                                                                
                                                                                                                         
*note str.isspace(): 284b.                                      *note bytes.isspace(): 284c.
                                                                
                                                                                                                         
*note str.isprintable(): 1195.

Case Manipulation              *note str.lower(): 1986.                                    *note bytes.lower(): 284d.
                                                                                           
                                                                                                                         
*note str.upper(): 284e.                                        *note bytes.upper(): 284f.
                                                                
                                                                                                                         
*note str.casefold(): 1193.

*note str.capitalize(): 2850.                                   *note bytes.capitalize(): 2851.
                                                                
                                                                                                                         
*note str.title(): 2852.                                        *note bytes.title(): 2853.
                                                                
                                                                                                                         
*note str.swapcase(): 2854.                                     *note bytes.swapcase(): 2855.
                                                                
                                                                                                                              
Padding and Stripping          *note str.ljust(): 226f.    *note str.rjust(): 226e.        *note bytes.ljust(): 2856.    *note bytes.rjust(): 2857.
                                                                                                                         
                                                                                                                         
*note str.center(): 2270.                                       *note bytes.center(): 2858.
                                                                
                                                                                                                         
*note str.expandtabs(): 2859.                                   *note bytes.expandtabs(): 285a.
                                                                
                                                                                                                         
*note str.strip(): 1867.                                        *note bytes.strip(): 285b.
                                                                
                                                                                                                         
*note str.lstrip(): 1868.                                  *note str.rstrip(): 1869.*note bytes.lstrip(): 285c.          *note bytes.rstrip(): 285d.
                                                                                                                         
                                                                                                                              
Translation and Encoding       *note str.translate(): 199a.                                *note bytes.translate(): 198e.
                                                                                           
                                                                                                                         
*note str.maketrans(): 192.                                     *note bytes.maketrans(): 162e.
                                                                
                                                                                                                         
*note str.encode(): cab.

                                                                *note bytes.decode(): cac.
                                                                


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: 1ea. オブジェクト、すなわち '文字列
' として扱われます。文字列は Unicode コードポイントのイミュータブルな
*note シーケンス: 223b. です。文字列リテラルには様々な記述方法があります
:

   * シングルクォート: ‘'"ダブル" クォートを埋め込むことができます'’

   * ダブルクォート: ‘"'シングル' クォートを埋め込むことができます"’。

   * 三重引用符: ‘'''三つのシングルクォート'''’, ‘"""三つのダブルクォー
     ト"""’

三重引用符文字列は、複数行に分けることができます。関連付けられる空白はす
べて文字列リテラルに含まれます。

単式の一部であり間に空白のみを含む文字列リテラルは、一つの文字列リテラル
に暗黙に変換されます。つまり、‘("spam " "eggs") == "spam eggs"’ です。

サポートされている *note エスケープシーケンス: 879. や、ほとんどのエスケ
ープシーケンスの処理を無効化する ‘r’ ("raw") 接頭辞など、文字列リテラル
のさまざまな形式についての詳細は *note 文字列およびバイト列リテラル:
24ae. を参照してください。

文字列は他のオブジェクトに *note str: 1ea. コンストラクタを使うことでも
生成できます。

"character" 型が特別に用意されているわけではないので、文字列のインデック
ス指定を行うと長さ 1 の文字列を作成します。つまり、空でない文字列 's' に
対し、‘s[0] == s[0:1]’ です。

ミュータブルな文字列型もありませんが、ミュータブルな断片から効率よく文字
列を構成するのに *note str.join(): 2821. や *note io.StringIO: 12d8. が
使えます。

バージョン 3.3 で変更: Python 2 シリーズとの後方互換性のため、文字列リテ
ラルの ‘u’ 接頭辞が改めて許可されました。それは文字列リテラルとしての意
味には影響がなく、 ‘r’ 接頭辞と結合することはできません。

 -- クラス: str (*, encoding='utf-8', errors='strict')

 -- クラス: str (object)

 -- クラス: str (object, encoding, errors='strict')

 -- クラス: str (object, *, errors)

     'object' の *note 文字列: 21ec. 版を返します。 'object' が与えられ
     なかった場合、空文字列が返されます。それ以外の場合 ‘str()’ の動作は
     、 'encoding' や 'errors' が与えられたかどうかによって次のように変
     わります。

     'encoding' も 'errors' も与えられない場合、 ‘str(object)’ は "形式
     ばらず"、 表示用にきれいに整えられた 'object' の文字列表現である
     *note type(object).__str__(object): a14. を返します。文字列オブジェ
     クトに対しては、文字列そのものです。 'object' が ‘__str__()’ メソッ
     ドを持たない場合、 *note str(): 1ea. は代わりに *note repr(object):
     462. の結果を返します。

     'encoding' か 'errors' の少なくとも一方が与えられた場合、 'object'
     は *note bytes-like object: 43d. (たとえば *note bytes: 1d2. や
     *note bytearray: 1d1.) でなくてはなりません。'object' が ‘bytes’ (も
     しくは ‘bytearray’) オブジェクトである場合は、 ‘str(bytes,
     encoding, errors)’ は *note bytes.decode(encoding, errors): cac. と
     等価です。そうでない場合は、 ‘bytes.decode()’ が呼ばれる前に buffer
     オブジェクトの下層にある bytes オブジェクトが取得されます。 buffer
     オブジェクトについて詳しい情報は、 *note バイナリシーケンス型 --
     bytes, bytearray, memoryview: 27dc. や *note バッファプロトコル
     (buffer Protocol): 319. を参照してください。

     'encoding' 引数や 'errors' 引数無しに *note bytes: 1d2. オブジェク
     トを *note str(): 1ea. に渡すと、略式の文字列表現を返す 1 つ目の場
     合に該当します。(Python のコマンドラインオプション *note -b: 2f9. も
     参照してください) 例えば:

          >>> str(b'Zoot!')
          "b'Zoot!'"

     ‘str’ クラスとそのメソッドについて詳しくは、 *note
     テキストシーケンス型 — str: 21ec. や *note 文字列メソッド: 21ed. の
     節を参照してください。フォーマットされた文字列を出力するには、
     *note f-strings: 441. と *note Custom string formatting: 285f. の節
     を参照してください。加えて、 *note テキスト処理サービス: 2860. の節
     も参照してください。

* 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 共通の: 281f. シーケンス演算全てに加え、以下に述べるメソ
ッドを実装します。

文字列は、二形式の文字列書式化をサポートします。一方は柔軟さが高くカスタ
マイズできます (*note str.format(): a17.、 *note Format string syntax:
1754. 、および *note Custom string formatting: 285f. を参照してください
)。他方は C 言語の ‘printf’ 形式の書式化に基づいてより狭い範囲と型を扱う
もので、正しく扱うのは少し難しいですが、扱える場合ではたいていこちらのほ
うが高速です (*note printf 形式の文字列書式化: abe.)。

標準ライブラリの *note テキスト処理サービス: 2862. 節は、その他テキスト
に関する様々なユーティリティ (*note re: c1. モジュールによる正規表現サポ
ートなど) を提供するいくつかのモジュールをカバーしています。

 -- メソッド: 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(): 1986. 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.3 '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: 1d2. にエンコードされた文字列を返します。

     'encoding' のデフォルト値は ‘'utf-8'’ です; 指定可能な値については
     *note 標準エンコーディング: 1175. を参照してください。

     'errors' はエンコーディングエラーをどのように取り扱うかを制御します
     。 ‘'strict'’ (デフォルト) では *note UnicodeError: 67c. 例外が送出
     されます。そのほかに指定可能な値は ‘'ignore'’, ‘'replace'’,
     ‘'xmlcharrefreplace'’, ‘'backslashreplace'’ と、そして *note
     codecs.register_error(): 1853. で登録された名前です。詳しくは *note
     エラーハンドラ: 1d8b. を参照してください。

     For performance reasons, the value of 'errors' is not checked for
     validity unless an encoding error actually occurs, *note Python
     開発モード: 713. is enabled or a *note debug build: 3e3. 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 開発モード:
     713. と *note デバッグモード: 3e3. でチェックされるようになりました
     。

 -- メソッド: 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(): 127c. and *note removesuffix(): ca6.

 -- メソッド: 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(): 125d. and *note index(): 1be5.

          注釈: *note find(): 125c. メソッドは、 'sub' の位置を知りたい
          ときにのみ使うべきです。 'sub' が部分文字列であるかどうかのみ
          を調べるには、 *note in: 32b. 演算子を使ってください:

               >>> '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: 1754. を参照してください。

          注釈: 数値 (*note int: 32e, *note float: 32f, *note complex:
          330, *note decimal.Decimal: 1cd. とサブクラス) を ‘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:
     193. にコピーされず、直接使われます。これは例えば ‘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(): 125c, but raise *note ValueError: 15a. 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(): 1611.

 -- メソッド: 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 プロパティ: 2863.

 -- メソッド: str.isascii ()

     Return ‘True’ if the string is empty or all characters in the
     string are ASCII, ‘False’ otherwise.  ASCII characters have code
     points in the range U+0000-U+007F. For example:

          >>> 'ASCII characters'.isascii()
          True
          >>> 'µ'.isascii()
          False

     Added in version 3.7.

 -- メソッド: str.isdecimal ()

     Return ‘True’ if all characters in the string are decimal
     characters and there is at least one character, ‘False’ otherwise.
     Decimal characters are those that can be used to form numbers in
     base 10, such as U+0660, ARABIC-INDIC DIGIT ZERO. Formally a
     decimal character is a character in the Unicode General Category
     "Nd".  For example:

          >>> '0123456789'.isdecimal()
          True
          >>> '٠١٢٣٤٥٦٧٨٩'.isdecimal()  # Arabic-Indic digits zero to nine
          True
          >>> 'alphabetic'.isdecimal()
          False

 -- メソッド: str.isdigit ()

     文字列中の全ての文字が数字で、かつ 1 文字以上あるなら ‘True’ を、そ
     うでなければ ‘False’ を返します。ここでの数字とは、十進数字に加えて
     、互換上付き数字のような特殊操作を必要とする数字を含みます。また 10
     を基数とした表現ができないカローシュティー数字のような体系の文字も
     含みます。正式には、数字とは、プロパティ値 Numeric_Type=Digit また
     は Numeric_Type=Decimal を持つ文字です。

 -- メソッド: str.isidentifier ()

     文字列が、 *note Names (identifiers and keywords): 24af. 節の言語定
     義における有効な識別子であれば ‘True’ を返します。

     *note keyword.iskeyword(): 2864. は、文字列 ‘s’ が *note def: 1812.
     や *note class: 1691. のような予約済みの識別子かどうかを調べるのに
     使うことができます。

     例:

          >>> from keyword import iskeyword

          >>> 'hello'.isidentifier(), iskeyword('hello')
          (True, False)
          >>> 'def'.isidentifier(), iskeyword('def')
          (True, True)

 -- メソッド: str.islower ()

     文字列中の大小文字の区別のある文字 (3) 全てが小文字で、かつ大小文字
     の区別のある文字が 1 文字以上あるなら ‘True’ を、そうでなければ
     ‘False’ を返します。

 -- メソッド: str.isnumeric ()

     Return ‘True’ if all characters in the string are numeric
     characters, and there is at least one character, ‘False’ otherwise.
     Numeric characters include digit characters, and all characters
     that have the Unicode numeric value property, e.g.  U+2155, VULGAR
     FRACTION ONE FIFTH. Formally, numeric characters are those with the
     property value Numeric_Type=Digit, Numeric_Type=Decimal or
     Numeric_Type=Numeric.  For example:

          >>> '0123456789'.isnumeric()
          True
          >>> '٠١٢٣٤٥٦٧٨٩'.isnumeric()  # Arabic-indic digit zero to nine
          True
          >>> '⅕'.isnumeric()  # Vulgar fraction one fifth
          True
          >>> '²'.isdecimal(), '²'.isdigit(),  '²'.isnumeric()
          (False, True, True)

     See also *note isdecimal(): 283f. and *note isdigit(): 2840.
     Numeric characters are a superset of decimal numbers.

 -- メソッド: str.isprintable ()

     Return ‘True’ if all characters in the string are printable,
     ‘False’ if it contains at least one non-printable character.

     Here "printable" means the character is suitable for *note repr():
     462. 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: ea0. or *note
     sys.stderr: d09.

     The printable characters are those which in the Unicode character
     database (see *note unicodedata: 10e.) 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(): 284b.

 -- メソッド: 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: 10e. を参照) で一般カ
     テゴリが ‘Zs’ ("Seperator, space") であるか、 双方向クラスが　
     ‘WS’、‘B’、 ‘S’ のいずれかである場合、その文字は '空白文字
     (whitespace)' です。

     See also *note isprintable(): 1195.

 -- メソッド: str.istitle ()

     文字列がタイトルケース文字列であり、かつ 1 文字以上ある場合、例えば
     大文字は大小文字の区別のない文字の後にのみ続き、小文字は大小文字の
     区別のある文字の後ろにのみ続く場合には ‘True’ を返します。そうでな
     い場合は ‘False’ を返します。

     例えば:

          >>> 'Spam, Spam, Spam'.istitle()
          True
          >>> 'spam, spam, spam'.istitle()
          False
          >>> 'SPAM, SPAM, SPAM'.istitle()
          False

     See also *note title(): 2852.

 -- メソッド: str.isupper ()

     文字列中の大小文字の区別のある文字 (4) 全てが大文字で、かつ大小文字
     の区別のある文字が 1 文字以上あるなら ‘True’ を、そうでなければ
     ‘False’ を返します。

          >>> 'BANANA'.isupper()
          True
          >>> 'banana'.isupper()
          False
          >>> 'baNana'.isupper()
          False
          >>> ' '.isupper()
          False

 -- メソッド: str.join (iterable, /)

     Return a string which is the concatenation of the strings in
     'iterable'.  A *note TypeError: 29c. will be raised if there are
     any non-string values in 'iterable', including *note bytes: 1d2.
     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(): 125e.

 -- メソッド: 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(): 226e.

 -- メソッド: str.lower ()

     Return a copy of the string with all the cased characters (5)
     converted to lowercase.  For example:

          >>> 'Lower Method Example'.lower()
          'lower method example'

     The lowercasing algorithm used is described in section 3.13.2
     'Default Case Conversion' of the Unicode Standard(6).

 -- メソッド: str.lstrip (chars=None, /)

     文字列の先頭の文字を除去したコピーを返します。引数 'chars' は除去さ
     れる文字の集合を指定する文字列です。 'chars' が省略されるか ‘None’
     の場合、空白文字が除去されます。 'chars' 文字列は接頭辞ではなく、そ
     の値に含まれる文字の組み合わせ全てがはぎ取られます:

          >>> '   spacious   '.lstrip()
          'spacious   '
          >>> 'www.example.com'.lstrip('cmowz.')
          'example.com'

     文字の集合全てではなく、指定した文字列そのものを接頭辞として削除す
     るメソッドについては、 *note str.removeprefix(): ca5. を参照してく
     ださい。使用例:

          >>> 'Arthur: three!'.lstrip('Arthur: ')
          'ee!'
          >>> 'Arthur: three!'.removeprefix('Arthur: ')
          'three!'

 -- メソッド: static str.maketrans (dict, /)

 -- メソッド: static str.maketrans (from, to, remove='', /)

     この静的メソッドは *note str.translate(): 199a. に使える変換テーブ
     ルを返します。

     引数を 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.

     バージョン 3.15 で変更: 'dict' can now be a *note frozendict: 18d.

 -- メソッド: 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(): 1612.

 -- メソッド: 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(): ca6. and *note startswith(): 127c.

 -- メソッド: 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(): ca5. and *note endswith(): 127d.

 -- メソッド: 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(): 125c. and *note rindex(): 1611.

 -- メソッド: str.rindex (sub[, start[, end]])

     Like *note rfind(): 125d. but raises *note ValueError: 15a. 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(): 1be5. and *note find(): 125c.

 -- メソッド: 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(): 226f. and *note zfill(): 186a.

 -- メソッド: 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(): 125f.

 -- メソッド: str.rsplit (sep=None, maxsplit=-1)

     'sep' を区切り文字とした、文字列中の単語のリストを返します。
     'maxsplit' が与えられた場合、文字列の '右端' から最大 'maxsplit' 回
     分割を行います。'sep' が指定されていない、あるいは ‘None’ のとき、
     全ての空白文字が区切り文字となります。右から分割していくことを除け
     ば、 *note rsplit(): 160f. は後ほど詳しく述べる *note split():
     125e. と同様に振る舞います。

 -- メソッド: 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(): ca6. 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(): 1867.

 -- メソッド: str.split (sep=None, maxsplit=-1)

     文字列を 'sep' をデリミタ文字列として区切った単語のリストを返します
     。'maxsplit' が与えられていれば、最大で 'maxsplit' 回分割されます
     (つまり、リストは最大 ‘maxsplit+1’ 要素になります)。 'maxsplit' が
     与えられないか ‘-1’ なら、分割の回数に制限はありません (可能なだけ
     分割されます)。

     'sep' が与えられた場合、連続した区切り文字はまとめられず、空の文字
     列を区切っていると判断されます(例えば ‘'1,,2'.split(',')’ は ‘['1',
     '', '2']’ を返します)。引数 'sep' は複数の文字を1つの区切り文字にも
     できます (複数の区切り文字で分割するには *note re.split(): 7a6. を
     使用します)。区切り文字を指定して空の文字列を分割すると、 ‘['']’ を
     返します。

     例えば:

          >>> '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(): 2821.

 -- メソッド: str.splitlines (keepends=False)

     文字列を改行部分で分解し、各行からなるリストを返します。 'keepends'
     に真が与えらない限り、返されるリストに改行は含まれません。

     このメソッドは以下の行境界で分解します。特に、以下の境界は *note
     universal newlines: 10f5. のスーパーセットです。

     表現                        説明
                                 
     --------------------------------------------------------------
                                 
     ‘\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(): 125e. とは違って、デリミタ文字列 '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(): 127d. and *note removeprefix(): ca5.

 -- メソッド: 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(): 284b.

     例えば:

          >>> '   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(): 1869.

 -- メソッド: 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(): 1986. and *note str.upper(): 284e.

 -- メソッド: 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(): 2866. 関数は単語をスペースでのみ分割するた
     め、この問題はありません。

     または、正規表現を使うことでアポストロフィに対応できます:

          >>> 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(): 2849.

 -- メソッド: str.translate (table, /)

     与えられた変換テーブルに基づいて文字列を構成する各文字をマッピング
     し、マッピング後の文字列のコピーを返します。変換テーブルは、*note
     __getitem__(): 78d. によるインデックス指定を実装するオブジェクトで
     ある必要があります。一般的には、 *note mapping: 1579. または *note
     sequence: 904. です。Unicode 序数 (整数) でインデックス指定する場合
     、変換テーブルのオブジェクトは次のいずれも行うことができます。
     Unicode 序数または文字列を返して文字を 1 文字以上の別の文字にマッピ
     ングすること、‘None’ を返して返り値の文字列から指定した文字を削除す
     ること、例外 *note LookupError: 25f9. を送出して文字をその文字自身
     にマッピングすること。

     文字から文字への異なる形式のマッピングから変換マップを作成するため
     に、 *note str.maketrans(): 192. が使えます。

     The following example uses a mapping to replace ‘'a'’ with ‘'X'’,
     ‘'b'’ with ‘'Y'’, and delete ‘'c'’:

          >>> 'abc123'.translate({ord('a'): 'X', ord('b'): 'Y', ord('c'): None})
          'XY123'

     文字のマッピングを好みに合わせてより柔軟に変更する方法については、
     *note codecs: 1c. モジュールも参照してください。

 -- メソッド: str.upper ()

     全ての大小文字の区別のある文字 (7) が大文字に変換された、文字列のコ
     ピーを返します。なお ‘s.upper().isupper()’ は、 ‘s’ が大小文字の区
     別のある文字を含まなかったり、結果の文字の Unicode カテゴリが "Lu"
     ではなく例えば "Lt" (Letter, titlecase) などであったら、 ‘False’ に
     なりえます。

     The uppercasing algorithm used is described in section 3.13.2
     'Default Case Conversion' of the Unicode Standard(8).

 -- メソッド: str.zfill (width, /)

     長さが 'width' になるよう ASCII ‘'0'’ で左詰めした文字列のコピーを
     返します。先頭が符号接頭辞 (‘'+'’/‘'-'’) だった場合、 ‘'0'’ は符号
     の前ではなく '後' に挿入されます。'width' が ‘len(s)’ 以下の場合元
     の文字列を返します。

     例えば:

          >>> "42".zfill(5)
          '00042'
          >>> "-42".zfill(5)
          '-0042'

     See also *note rjust(): 226e.

   ---------- Footnotes ----------

   (1) 
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G53253

   (2) 
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-4/#G91002

   (3) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (4) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (5) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (6) 
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G34078

   (7) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (8) 
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G34078


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: 439. and *note async for: e74.
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: 441. 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(): 1ea.:

     >>> 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(): 462.:

     >>> f'{one_third = }'
     'one_third = Fraction(1, 3)'

The conversion can be specified explicitly using one of these
specifiers:

   * ‘!s’ for *note str(): 1ea.

   * ‘!r’ for *note repr(): 462.

   * ‘!a’ for *note ascii(): 179f.

例えば:

     >>> 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():
440. 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: 24fa, with for the following differences:

   * Rather than evaluating to a ‘str’ object, template string literals
     evaluate to a *note string.templatelib.Template: 41c. object.

   * The *note format(): 440. protocol is not used.  Instead, the format
     specifier and conversions (if any) are passed to a new *note
     Interpolation: 41d. object that is created for each evaluated
     expression.  It is up to code that processes the resulting *note
     Template: 41c. 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: 41d. 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: 286c. will be set to '‘r’' (*note repr(): 462.)
     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: 441, the *note str.format():
     a17. interface, or *note string.Template: a7c. 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(): 462. で変換   (5)
                 します)。                                                 
                 
                                                                           
‘'s'’            文字列 (Python オブジェクトを *note str(): 1ea. で変換    (5)
                 します)。                                                 
                 
                                                                           
‘'a'’            文字列 (Python オブジェクトを *note ascii(): 179f. で変   (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(): 1694. 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: 1d2. および
*note bytearray: 1d1. です。これらは、別のバイナリオブジェクトのメモリに
コピーを作成すること無くアクセスするための *note バッファプロトコル:
319. を利用する *note memoryview: 1dd. でサポートされています。

*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 文字列およびバイト列リテラル: 24ae. を参照してください。

     bytesリテラルと repr 出力は ASCII テキストをベースにしたものですが
     、 bytes オブジェクトは、各値が ‘0 <= x < 256’ の範囲に収まるような
     整数 (この制限に違反しようとすると *note ValueError: 15a. が発生し
     ます) の不変なシーケンスとして振る舞います。多くのバイナリフォーマ
     ットがASCIIテキストを元にした要素を持っていたり何らかのテキスト操作
     アルゴリズムによって操作されるものの、任意のバイナリデータが一般に
     テキストになっているわけではないことを強調するためにこのように設計
     されました (何も考えずにテキスト操作アルゴリズムをASCII非互換なバイ
     ナリデータフォーマットに対して行うとデータを破壊することがあります
     )。

     リテラル以外に、幾つかの方法で bytes オブジェクトを作ることができま
     す:

        * 指定された長さの、0で埋められた bytes オブジェクト:
          ‘bytes(10)’

        * 整数の iterable から: ‘bytes(range(20))’

        * 既存のバイナリデータからバッファプロトコルでコピーする:
          ‘bytes(obj)’

     *note bytes: 20a6. ビルトイン関数も参照してください。

     16 進数で 2 桁の数は正確に 1 バイトに相当するため、16 進整はバイナ
     リデータを表現する形式として広く使われています。 従って、 bytes 型
     にはその形式でデータを読み取るための追加のクラスメソッドがあります
     。

      -- メソッド: classmethod fromhex (string, /)

          この *note bytes: 1d2. のクラスメソッドは、与えられた文字列オ
          ブジェクトをデコードして bytes オブジェクトを返します。それぞ
          れのバイトを 16 進数 2 桁で表現した文字列を指定しなければなり
          ません。ASCII 空白文字は無視されます。

               >>> bytes.fromhex('2Ef0 F1f2  ')
               b'.\xf0\xf1\xf2'

          バージョン 3.7 で変更: *note bytes.fromhex(): 43b. は文字列に
          ある空白だけでなく、 ASCII の空白文字全てをスキップするように
          なりました。

          バージョン 3.14 で変更: ‘bytes.fromhex()’ now accepts ASCII
          *note bytes: 1d2. and *note bytes-like objects: 43d. 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(): 1122. が、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: 1d1. オブジェクトは *note bytes: 1d2. オブジェクトの可
変なバージョンです。

 -- クラス: bytearray (source=b'')

 -- クラス: bytearray (source, encoding, errors='strict')

     bytearray に専用のリテラル構文はないので、コンストラクタを使って作
     成します:

        * 空のインスタンスを作る: ‘bytearray()’

        * 指定された長さの0で埋められたインスタンスを作る:
          ‘bytearray(10)’

        * 整数の iterable から: ‘bytearray(range(20))’

        * 既存のバイナリデータからバッファプロトコルを通してコピーする:
          ‘bytearray(b'Hi!')’

     bytearray オブジェクトは可変なので、 *note bytes と bytearray
     の操作: 27db. で解説されている bytes オブジェクトと共通の操作に加え
     て、 *note mutable: 27da. シーケンス操作もサポートしています。

     *note bytearray: 20a7. ビルトイン関数も参照してください。

     16 進数で 2 桁の数は正確に 1 バイトに相当するため、16 進整はバイナ
     リデータを表現する形式として広く使われています。 従って、 bytearray
     型にはその形式でデータを読み取るための追加のクラスメソッドがありま
     す。

      -- メソッド: classmethod fromhex (string, /)

          この *note bytearray: 1d1. のクラスメソッドは、与えられた文字
          列オブジェクトをデコードして bytearray オブジェクトを返します
          。それぞれのバイトを 16 進数 2 桁で表現した文字列を指定しなけ
          ればなりません。ASCII 空白文字は無視されます。

               >>> bytearray.fromhex('2Ef0 F1f2  ')
               bytearray(b'.\xf0\xf1\xf2')

          バージョン 3.7 で変更: *note bytearray.fromhex(): 43c. は文字
          列にある空白だけでなく、 ASCII の空白文字全てをスキップするよ
          うになりました。

          バージョン 3.14 で変更: ‘bytearray.fromhex()’ now accepts
          ASCII *note bytes: 1d2. and *note bytes-like objects: 43d. 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(): 1122. と同様に、
          *note bytearray.hex(): 1123. が、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.

      -- メソッド: take_bytes (n=None, /)

          Remove the first 'n' bytes from the bytearray and return them
          as an immutable *note bytes: 1d2.  By default (if 'n' is
          ‘None’), return all bytes and clear the bytearray.

          If 'n' is negative, index from the end and take the first
          *note len(): a24. plus 'n' bytes.  If 'n' is out of bounds,
          raise *note IndexError: 18ed.

          Taking less than the full length will leave remaining bytes in
          the ‘bytearray’, which requires a copy.  If the remaining
          bytes should be discarded, use *note resize(): 1949. or *note
          del: 1d3c. to truncate then *note take_bytes(): 1d0. without a
          size.

          'CPython 実装の詳細:' Taking all bytes is a zero-copy
          operation.

          Added in version 3.15: See the *note What's New: 1cf. entry
          for common code patterns which can be optimized with
          ‘bytearray.take_bytes()’.

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: 1d1. objects, see *note Thread safety for bytearray objects:
2871.


File: python.info,  Node: bytes と bytearray の操作,  Next: printf 形式での bytes の書式化,  Prev: bytearray オブジェクト,  Up: バイナリシーケンス型 --- bytes bytearray memoryview

5.4.10.3 bytes と bytearray の操作
..................................

bytes と bytearray は両方共 *note 一般のシーケンス操作: 281f. をサポート
しています。また、両方とも *note bytes-like object: 43d. をサポートして
いる任意のオブジェクトを対象に操作することもできます。この柔軟性により
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: 43d. ま
     たは 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: 43d. にできます。

          注釈: 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: 43d. にできます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

     Added in version 3.9.

 -- メソッド: bytes.decode (encoding='utf-8', errors='strict')
 -- メソッド: bytearray.decode (encoding='utf-8', errors='strict')

     *note str: 1ea. にデコードされたbytesを返します。

     'encoding' のデフォルト値は ‘'utf-8'’ です; 指定可能な値については
     *note 標準エンコーディング: 1175. を参照してください。

     'errors' はデコーディングエラーをどのように取り扱うかを制御します。
     ‘'strict'’ (デフォルト) では *note UnicodeError: 67c. 例外が送出さ
     れます。そのほかに指定可能な値は ‘'ignore'’, ‘'replace'’ と、そして
     *note codecs.register_error(): 1853. で登録された名前です。詳しくは
     *note エラーハンドラ: 1d8b. を参照してください。

     パフォーマンス上の理由から、 'errors' の値の妥当性は、デコーディン
     グエラーが実際に発生するか、 *note Python 開発モード: 713. が有効に
     なっているか、もしくは *note デバッグビルド: 3e3. が使われていない
     限りチェックされません。

          注釈: 引数 'encoding' を *note str: 1ea. に渡すと *note
          bytes-like object: 43d. を直接デコードすることができます。つま
          り、一時的な ‘bytes’ や ‘bytearray’ オブジェクトを作成する必要
          はありません。

     バージョン 3.1 で変更: キーワード引数のサポートが追加されました。

     バージョン 3.9 で変更: 'errors' 引数の値は *note Python 開発モード:
     713. と *note デバッグモード: 3e3. でチェックされるようになりました
     。

 -- メソッド: bytes.endswith (suffix[, start[, end]])
 -- メソッド: bytearray.endswith (suffix[, start[, end]])

     バイナリデータが指定された 'suffix' で終わる場合は ‘True’ を、そう
     でなければ ‘False’ を返します。 'suffix' は見つけたい複数の接尾語の
     タプルでも構いません。オプションの 'start' が指定されている場合、そ
     の位置から判定を開始します。オプションの 'end' が指定されている場合
     、その位置で比較を終了します。

     検索対象の接尾語 (複数も可) は、任意の *note bytes-like object:
     43d. にできます。

 -- メソッド: bytes.find (sub[, start[, end]])
 -- メソッド: bytearray.find (sub[, start[, end]])

     スライス ‘s[start:end]’ に部分シーケンス 'sub' が含まれる場合、デー
     タ中のその 'sub' の最小のインデックスを返します。オプション引数
     'start' および 'end' はスライス表記と同様に解釈されます。 'sub' が
     見つからなかった場合、 ‘-1’ を返します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 43d. ま
     たは 0 から 255 の範囲の整数にできます。

          注釈: *note find(): 1dec. メソッドは、 'sub' の位置を知りたい
          ときにのみ使うべきです。 'sub' が部分文字列 (訳注: おそらく原
          文の誤り、正しくは部分シーケンス) であるかどうかのみを調べるに
          は、 *note in: 32b. 演算子を使ってください:

               >>> b'Py' in b'Python'
               True

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.index (sub[, start[, end]])
 -- メソッド: bytearray.index (sub[, start[, end]])

     *note find(): 1dec. と同様ですが、部分シーケンスが見つからなかった
     場合 *note ValueError: 15a. を送出します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 43d. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.join (iterable, /)
 -- メソッド: bytearray.join (iterable, /)

     'iterable' 中のバイナリデータを結合した bytes または bytearray オブ
     ジェクトを返します。 'iterable' に *note str: 1ea. オブジェクトなど
     *note bytes-like objects: 43d. ではない値が含まれている場合、 *note
     TypeError: 29c. が送出されます。なお要素間のセパレータは、このメソ
     ッドを提供する bytes または bytearray オブジェクトとなります。

 -- メソッド: static bytes.maketrans (from, to, /)
 -- メソッド: static bytearray.maketrans (from, to, /)

     この静的メソッドは、 *note bytes.translate(): 198e. に渡すのに適し
     た変換テーブルを返します。このテーブルは、 'from' 中の各バイトを
     'to' の同じ位置にあるバイトにマッピングします。 'from' と 'to' は両
     方とも同じ長さの *note bytes-like objects: 43d. でなければなりませ
     ん。

     Added in version 3.1.

 -- メソッド: bytes.partition (sep, /)
 -- メソッド: bytearray.partition (sep, /)

     区切り 'sep' が最初に出現する位置でシーケンスを分割し、 3 要素のタ
     プルを返します。タプルの内容は、区切りの前の部分、その区切りオブジ
     ェクトまたはその bytearray 型のコピー、そして区切りの後ろの部分です
     。もし区切りが見つからなければ、タプルには元のシーケンスのコピーと
     、その後ろに二つの空の bytes または bytearray オブジェクトが入りま
     す。

     検索する区切りとしては、任意の *note bytes-like object: 43d. を指定
     できます。

 -- メソッド: 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 'count' is given, only the first
     'count' occurrences are replaced.  If 'count' is not specified or
     ‘-1’, then all occurrences are replaced.

     検索する部分シーケンスおよび置換後の部分シーケンスとしては、任意の
     *note bytes-like object: 43d. を指定できます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

     バージョン 3.15 で変更: 'count' はキーワード引数として指定可能にな
     りました。

 -- メソッド: bytes.rfind (sub[, start[, end]])
 -- メソッド: bytearray.rfind (sub[, start[, end]])

     シーケンス中の領域 ‘s[start:end]’ に 'sub' が含まれる場合、その最大
     のインデックスを返します。オプション引数 'start' および 'end' はス
     ライス表記と同様に解釈されます。 'sub' が見つからなかった場合 ‘-1’
     を返します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 43d. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.rindex (sub[, start[, end]])
 -- メソッド: bytearray.rindex (sub[, start[, end]])

     *note rfind(): 1ded. と同様ですが、部分シーケンス 'sub' が見つから
     なかった場合 *note ValueError: 15a. を送出します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 43d. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.rpartition (sep, /)
 -- メソッド: bytearray.rpartition (sep, /)

     区切り 'sep' が最後に出現する位置でシーケンスを分割し、 3 要素のタ
     プルを返します。タプルの内容は、区切りの前の部分、その区切りオブジ
     ェクトまたはその bytearray 型のコピー、そして区切りの後ろの部分です
     。もし区切れなければ、タプルには二つの空の bytes または bytearray オ
     ブジェクトと、その後ろに元のシーケンスのコピーが入ります。

     検索する区切りとしては、任意の *note bytes-like object: 43d. を指定
     できます。

 -- メソッド: bytes.startswith (prefix[, start[, end]])
 -- メソッド: bytearray.startswith (prefix[, start[, end]])

     バイナリデータが指定された 'prefix' で始まる場合は ‘True’ を、そう
     でなければ ‘False’ を返します。 'prefix' は見つけたい複数の接頭語の
     タプルでも構いません。オプションの 'start' が指定されている場合、そ
     の位置から判定を開始します。オプションの 'end' が指定されている場合
     、その位置で比較を終了します。

     検索対象の接頭語 (複数も可) は、任意の *note bytes-like object:
     43d. にできます。

 -- メソッド: bytes.translate (table, /, delete=b'')
 -- メソッド: bytearray.translate (table, /, delete=b'')

     オプション引数 'delete' に現れるすべてのバイトを除去し、残ったバイ
     トを与えられた変換テーブルに従ってマップした、バイト列やバイト配列
     オブジェクトのコピーを返します。変換テーブルは長さ 256 のバイト列オ
     ブジェクトでなければなりません。

     変換テーブルの作成に、 *note bytes.maketrans(): 162e. メソッドを使
     うこともできます。

     文字を削除するだけの変換には、 '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: 1d2. オブジェクトの場合、 'width' が
     ‘len(s)’ 以下なら元のシーケンスが返されます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.ljust (width, fillbyte=b' ', /)
 -- メソッド: bytearray.ljust (width, fillbyte=b' ', /)

     長さ 'width' の左寄せされたシーケンスのコピーを返します。パディング
     には 'fillbyte' で指定された値 (デフォルトでは ASCII スペース) が使
     われます。 *note bytes: 1d2. オブジェクトの場合、 '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: 43d. を指定することができます。バイナリシーケンスで指定した
     文字の集合全てではなく、指定した文字列そのものを接頭辞として削除す
     るメソッドについては、 *note removeprefix(): 2873. を参照してくださ
     い。使用例:

          >>> 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: 1d2. オブジェクトの場合、 'width' が
     ‘len(s)’ 以下なら元のシーケンスが返されます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.rsplit (sep=None, maxsplit=-1)
 -- メソッド: bytearray.rsplit (sep=None, maxsplit=-1)

     'sep' を区切りとして、同じ型の部分シーケンスに分割します。
     'maxsplit' が与えられた場合、シーケンスの '右端' から最大
     'maxsplit' 回だけ分割を行います。 'sep' が指定されていないか ‘None’
     のとき、 ASCII 空白文字の組み合わせで作られる部分シーケンスすべてが
     区切りとなります。右から分割していくことを除けば、 *note rsplit():
     19bb. は後ほど詳しく述べる *note split(): 19ba. と同様に振る舞いま
     す。

 -- メソッド: 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: 43d. を指定することができます。バイナリシーケンスで指定した
     文字の集合全てではなく、指定した文字列そのものを接尾辞として削除す
     るメソッドについては、 *note removesuffix(): 2875. を参照してくださ
     い。使用例:

          >>> 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: 43d. を指定できます。

     例えば:

          >>> 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: 43d. を指定できます。

          注釈: 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(): 2853. を参照してく
     ださい。

     例えば:

          >>> 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: 10f5. アプローチ
     で行を分割します。 '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(): 2838. とは違って、空シーケンスに対して区切り '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(): 2854, 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: 1d2. オブジェ
     クトの場合、 '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: 319. をサポ    (5)
                 ートするか、 *note __bytes__(): 9e4. メソッドがあるオブ   
                 ジェクト)
                 
                                                                           
‘'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: 1dd. オブジェクトは、Python コードが *note
バッファプロトコル: 319. をサポートするオブジェクトの内部データへ、コピ
ーすることなくアクセスすることを可能にします。

 -- クラス: memoryview (object)

     'object' を参照する *note memoryview: 1dd. を作成します。 'object'
     はバッファプロトコルをサポートしていなければなりません。バッファプ
     ロトコルをサポートする組み込みオブジェクトには、 *note bytes: 1d2.
     、 *note bytearray: 1d1. などがあります。

     *note memoryview: 1dd. は元となる 'object' が扱うメモリーの最小単位
     を '要素' として扱います。多くの単純なオブジェクト、例えば *note
     bytes: 1d2. や *note bytearray: 1d1. では、要素は単バイトになります
     が、他の *note array.array: 6cb. 等の型では、要素はより大きくなりえ
     ます。

     ‘len(view)’ is equal to the length of *note tolist(): 2896, 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: 29c. を返すようになりました。

     *note itemsize: 2897. 属性は各要素のバイト数を与えます。

     *note memoryview: 1dd. はスライスおよびインデックス指定で内容を取得
     できます。一次元のスライスは部分ビューになります:

          >>> v = memoryview(b'abcefg')
          >>> v[1]
          98
          >>> v[-1]
          103
          >>> v[1:4]
          <memory at 0x7f3ddc9f4350>
          >>> bytes(v[1:4])
          b'bce'

     もしメモリビューの *note format: 13f7. が *note struct: de. モジュ
     ールによって定義されているネイティブのフォーマット指定子であれば、
     整数または整数のタプルでのインデックス指定により適切な型の '要素1つ
     ' を得ることができます。一次元のメモリビューでは、整数または整数 1
     つのタプルでインデックス指定できます。多次元のメモリビューでは、そ
     の次元数を 'ndim' としたとき、ちょうど 'ndim' 個の整数からなるタプ
     ルでインデックス指定できます。ゼロ次元のメモリビューでは、空のタプ
     ルでインデックス指定できます。

     *note format: 13f7. が単バイト単位ではない例を示します:

          >>> 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 ハッシュ可能: 18e. な
     (読み出し専用の) 型の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 ハッシュ可能: 18e. になりました。

     バージョン 3.4 で変更: memoryview は自動的に *note
     collections.abc.Sequence: 1582. へ登録されるようになりました。

     バージョン 3.5 で変更: メモリビューは整数のタプルでインデックス指定
     できるようになりました。

     バージョン 3.14 で変更: memoryview is now a *note generic type:
     1dc.

     *note memoryview: 1dd. にはいくつかのメソッドがあります:

      -- メソッド: __eq__ (exporter)

          memoryview と PEP 3118(1) エクスポーターは、 shape が同じで、
          *note struct: de. のフォーマットで解釈したときの値が同じ場合に
          同値になります。

          *note tolist(): 2896. がサポートしている *note struct: de. フ
          ォーマットの一部では、 ‘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: de. モジュールにサポート
          されていなければ、 (書式文字列とバッファの内容が同一でも) オブ
          ジェクトは常に等しくないものとして比較されます:

               >>> 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: 1d2. コンストラクタを呼び出すのと同
          等です。

               >>> m = memoryview(b"abc")
               >>> m.tobytes()
               b'abc'
               >>> bytes(m)
               b'abc'

          連続でない配列については、結果はすべての要素がバイトに変換され
          たものを含むフラットなリスト表現に等しくなります。 *note
          tobytes(): 2899. は、 *note struct: de. モジュール文法にないも
          のを含むすべての書式文字列をサポートします。

          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(): 1122. と同様に、
          *note memoryview.hex(): 1124. は、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(): 2896. が *note struct:
          de. モジュール文法に含まれるすべての単一文字の 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: 1d1. は大き
          さの変更を一時的に禁止します)。ですから、release() を呼び出す
          ことは、これらの制約をできるだけ早く取り除く (そしてぶら下がっ
          たリソースをすべて解放する) のに便利です。

          After this method has been called, any further operation on
          the view raises a *note ValueError: 15a. (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: 13f9.）。

          キャスト後のフォーマットは単一要素のネイティブフォーマットに限
          定され、 *note struct: de. の文法で指定します。利用可能なフォ
          ーマットのひとつはバイトフォーマット ('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: 15a. 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: de. モジュールスタイ
          ルの) フォーマットを含む文字列。 memoryview は、任意のフォーマ
          ット文字列を使ってエクスポーターから作成することができます。し
          かし、いくつかのメソッド(例えば *note tolist(): 2896.) はネイ
          ティブの単一要素フォーマットに制限されます。

          バージョン 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:
          13fb. の整数のタプルです。

          バージョン 3.3 で変更: ndim = 0 の場合は ‘None’ ではなく空のタ
          プルとなるよう変更されました。

      -- の属性: strides

          配列のそれぞれの次元に対して、それぞれの要素にアクセスするのに
          必要なバイト数を表す、長さ *note ndim: 13fb. の整数のタプルで
          す。

          バージョン 3.3 で変更: ndim = 0 の場合は ‘None’ ではなく空のタ
          プルとなるよう変更されました。

      -- の属性: suboffsets

          PILスタイルの配列の内部で利用している値。この値はただの情報と
          して公開されています。

      -- の属性: c_contiguous

          メモリーが C 形式の順序で連続しているかどうかを示す真偽値（参
          考: *note contiguous: 13f9. ）。

          Added in version 3.3.

      -- の属性: f_contiguous

          メモリーがFortran形式の順序で連続しているかどうかを示す真偽値
          （参考: *note contiguous: 13f9. ）。

          Added in version 3.3.

      -- の属性: contiguous

          メモリーが連続しているかどうかを示す真偽値（参考: *note
          contiguous: 13f9. ）。

          Added in version 3.3.

For information on the thread safety of *note memoryview: 1dd. objects
in the *note free-threaded build: 1a3, see *note Thread safety for
memoryview objects: 2625.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/


File: python.info,  Node: set（集合）型 --- set frozenset,  Next: Mapping types --- dict frozendict,  Prev: バイナリシーケンス型 --- bytes bytearray memoryview,  Up: 組み込み型

5.4.11 set（集合）型 -- ‘set’, ‘frozenset’
------------------------------------------

'set' オブジェクトは、固有の *note hashable: 18e. オブジェクトの順序なし
コレクションです。通常の用途には、帰属テスト、シーケンスからの重複除去、
積集合、和集合、差集合、対称差 (排他的論理和) のような数学的演算の計算が
含まれます。(他のコンテナについては組み込みの *note dict: 193, *note
list: 4e0, *note tuple: 1d9. クラスや *note collections: 1e. モジュール
を参照してください。)

集合は、他のコレクションと同様、 ‘x in set’, ‘len(set)’, ‘for x in set’
をサポートします。コレクションには順序がないので、集合は挿入の順序や要素
の位置を記録しません。従って、集合はインデクシング、スライシング、その他
のシーケンス的な振舞いをサポートしません。

There are currently two built-in set types, *note set: 432. and *note
frozenset: 9d9.  The ‘set’ type is mutable -- the contents can be
changed using methods like *note add(): 254d. and *note remove(): 28a2.
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: 18e. -- 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: 432. (*note frozenset: 9d9. ではない) は、‘set’ コン
ストラクタに加え、要素を波括弧中にカンマで区切って列挙することでも生成で
きます。例: ‘{'jack', 'sjoerd'}’。

どちらのクラスのコンストラクタも同様に働きます:

 -- クラス: set (iterable=(), /)
 -- クラス: frozenset (iterable=(), /)

     'iterable' から要素を取り込んだ、新しい *note set: 432. もしくは
     *note frozenset: 9d9. オブジェクトを返します。 集合の要素は *note
     ハッシュ可能: 18e. なものでなくてはなりません。集合の集合を表現する
     ためには、内側の集合は ‘frozenset’ オブジェクトでなくてはなりません
     。'iterable' が指定されない場合、新しい空の集合が返されます。

集合はいくつかの方法で生成できます:

   * 波括弧内にカンマ区切りで要素を列挙する: ‘{'jack', 'sjoerd'}’

   * 集合内包表記を使う: ‘{c for c in 'abracadabra' if c not in 'abc'}’

   * 型コンストラクタを使う: ‘set()’, ‘set('foobar')’, ‘set(['a', 'b',
     'foo'])’

*note set: 432. および *note frozenset: 9d9. のインスタンスは以下の操作
を提供します:

 -- 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(): 183b, *note
intersection(): 183c, *note difference(): 28a9, *note
symmetric_difference(): 28ab, *note issubset(): 28a5, and *note
issuperset(): 28a7. 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: 432. と *note frozenset: 9d9. のどちらも、集合同士の比較をサ
ポートします。二つの集合は、それぞれの集合の要素全てが他方にも含まれてい
る (互いに他方の部分集合である) とき、かつそのときに限り等しいです。一方
の集合が他方の集合の真部分集合である (部分集合であるが等しくない) とき、
かつそのときに限り一方の集合は他方の集合より小さいです。一方の集合が他方
の集合の真上位集合である (上位集合であるが等しくない) とき、かつそのとき
に限り一方の集合は他方の集合より大きいです。

*note set: 432. のインスタンスは、 *note frozenset: 9d9. のインスタンス
と、要素に基づいて比較されます。例えば、 ‘set('abc') ==
frozenset('abc')’ や ‘set('abc') in set([frozenset('abc')])’ は ‘True’ を
返します。

部分集合と等価性の比較は全順序付けを行う関数へと一般化することはできませ
ん。例えば、互いに素である二つの非空集合は、等しくなく、他方の部分集合で
もありませんから、以下の 'すべて' に ‘False’ を返します: ‘a<b’, ‘a==b’,
そして ‘a>b’.

集合は半順序（部分集合関係）しか定義しないので、集合のリストにおける
*note list.sort(): f91. メソッドの出力は未定義です。

集合の要素は、辞書のキーのように、 *note ハッシュ可能: 18e. でなければな
りません。

*note set: 432. インスタンスと *note frozenset: 9d9. インスタンスを取り
混ぜての二項演算は、第一被演算子の型を返します。例えば: ‘frozenset('ab')
| set('bc')’ は ‘frozenset’ インスタンスを返します。

以下の表に挙げる演算は *note set: 432. に適用されますが、*note
frozenset: 9d9. のイミュータブルなインスタンスには適用されません:

 -- メソッド: 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: 7e5. を送出します。

 -- メソッド: set.discard (elem, /)

     要素 'elem' が set に含まれていれば、取り除きます。

 -- メソッド: set.pop ()

     's' から任意の要素を取り除き、それを返します。集合が空の場合、
     *note KeyError: 7e5. を送出します

 -- メソッド: set.clear ()

     set の全ての要素を取り除きます。

Note, the non-operator versions of the *note update(): 28af, *note
intersection_update(): 183d, *note difference_update(): 28b0, and *note
symmetric_difference_update(): 183e. methods will accept any iterable as
an argument.

Note, the 'elem' argument to the *note __contains__(): 1772, *note
remove(): 28a2, and *note discard(): 28b1. 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: 432.
objects, see *note Thread safety for set objects: 28b4.


File: python.info,  Node: Mapping types --- dict frozendict,  Next: コンテキストマネージャ型,  Prev: set（集合）型 --- set frozenset,  Up: 組み込み型

5.4.12 Mapping types -- ‘dict’, ‘frozendict’
--------------------------------------------

A *note mapping: 1579. object maps *note hashable: 18e. values to
arbitrary objects.  There are currently two standard mapping types, the
'dictionary' and *note frozendict: 18d.  (For other containers see the
built-in *note list: 4e0, *note set: 432, and *note tuple: 1d9. classes,
and the *note collections: 1e. module.)

辞書のキーには、 'ほぼ' どんな値も使うことができます。 キーとして使えな
いのは、 *note hashable: 18e. (ハッシュ可能) でない値、すなわちリストや
辞書のようなミュータブルな型 (内包する値ではなくオブジェクト自体が同一で
あるかによって比較が行われるような型)です。 比較した際に等しいとみなされ
る値 (例えば ‘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__(): 78d. on the
     argument with each returned key from the method.  Otherwise, the
     positional argument must be an *note iterable: 149a. 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: 29c.  To illustrate
     dictionary creation and equality, the following examples all return
     a dictionary equal to ‘{"one": 1, "two": 2, "three": 3}’:

          >>> a = dict(one=1, two=2, three=3)
          >>> b = {'one': 1, 'two': 2, 'three': 3}
          >>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
          >>> d = dict([('two', 2), ('one', 1), ('three', 3)])
          >>> e = dict({'three': 3, 'one': 1, 'two': 2})
          >>> f = dict({'one': 1, 'three': 3}, two=2)
          >>> a == b == c == d == e == f
          True

     最初の例のようにキーワード引数を与える方法では、キーは有効な Python
     の識別子でなければなりません。それ以外の方法では、辞書のキーとして
     有効などんなキーでも使えます。

     辞書は挿入順序を保存するようになりました。 キーの更新は順序には影響
     が無いことに注意してください。 いったん削除されてから再度追加された
     キーは末尾に挿入されます。:

          >>> d = {"one": 1, "two": 2, "three": 3, "four": 4}
          >>> d
          {'one': 1, 'two': 2, 'three': 3, 'four': 4}
          >>> list(d)
          ['one', 'two', 'three', 'four']
          >>> list(d.values())
          [1, 2, 3, 4]
          >>> d["one"] = 42
          >>> d
          {'one': 42, 'two': 2, 'three': 3, 'four': 4}
          >>> del d["two"]
          >>> d["two"] = None
          >>> d
          {'one': 42, 'three': 3, 'four': 4, 'two': None}

     バージョン 3.7 で変更: 辞書の順序が挿入順序であることが保証されるよ
     うになりました。この振る舞いは CPython 3.6 の実装詳細でした。

     以下は辞書型がサポートする操作です (それゆえ、カスタムのマップ型も
     これらの操作をサポートするべきです):

      -- Describe: list(d)

          辞書 'd' で使われている全てのキーのリストを返します。

      -- Describe: len(d)

          辞書 'd' の項目数を返します。

      -- Describe: d[key]

          'd' のキー 'key' の項目を返します。マップに 'key' が存在しなけ
          れば、 *note KeyError: 7e5. を送出します。

          If a subclass of dict defines a method *note __missing__():
          157b. 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: 7e5. 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: 20f.  A different ‘__missing__()’ method
          is used by *note collections.defaultdict: 157a.

      -- Describe: d[key] = value

          ‘d[key]’ に 'value' を設定します。

      -- Describe: del d[key]

          'd' から ‘d[key]’ を削除します。マップに 'key' が存在しなけれ
          ば、 *note KeyError: 7e5. を送出します。

      -- 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(): 4e1. は新しい辞書を返すクラスメソッドです。
          'value' はデフォルトで ‘None’ となります。 作られる辞書内のす
          べての値が同一のインスタンスを指すことになるため、'value' にミ
          ュータブルなオブジェクト (例えば空のリスト) を指定しても通常意
          味はありません。 別々の値を指すようにしたい場合は、代わりに
          *note 辞書内包表記: 113c. を使用してください。

      -- メソッド: get (key, default=None, /)

          'key' が辞書にあれば 'key' に対する値を、そうでなければ
          'default' を返します。 'default' が与えられなかった場合、デフ
          ォルトでは ‘None’ となります。そのため、このメソッドは *note
          KeyError: 7e5. を送出することはありません。

      -- メソッド: items ()

          辞書の項目 (‘(key, value)’ 対) の新しいビューを返します。*note
          ビューオブジェクトのドキュメント: 28b6. を参照してください。

      -- メソッド: keys ()

          辞書のキーの新しいビューを返します。*note
          ビューオブジェクトのドキュメント: 28b6. を参照してください。

      -- メソッド: pop (key, /)

      -- メソッド: pop (key, default, /)

          'key' が辞書に存在すればその値を辞書から消去して返し、そうでな
          ければ 'default' を返します。 'default' が与えられず、かつ
          'key' が辞書に存在しなければ *note KeyError: 7e5. を送出します
          。

      -- メソッド: popitem ()

          任意の ‘(key, value)’ 対を辞書から消去して返します。 対は LIFO
          (後入れ、先出し) の順序で返却されます。

          集合のアルゴリズムで使われるのと同じように、 *note popitem():
          18de. は辞書に繰り返し適用して消去するのに便利です。辞書が空で
          あれば、 ‘popitem()’ の呼び出しは *note KeyError: 7e5. を送出
          します。

          バージョン 3.7 で変更: LIFO 順序が保証されるようになりました。
          以前のバージョンでは、 *note popitem(): 18de. は任意の
          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__(): 78d. 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
          ビューオブジェクトのドキュメント: 28b6. を参照してください。

          ‘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
          マッピング: 1579. か、またはキーと値のペアの *note イテラブル:
          149a. です。 '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 frozendict: 18d. and *note types.MappingProxyType: 194. can
     be used to create a read-only view of a ‘dict’.

参考
....

For detailed information on thread-safety guarantees for *note dict:
193. objects, see *note Thread safety for dict objects: 28b7.

* Menu:

* 辞書ビューオブジェクト::
* Frozen dictionaries::


File: python.info,  Node: 辞書ビューオブジェクト,  Next: Frozen dictionaries,  Up: Mapping types --- dict frozendict

5.4.12.1 辞書ビューオブジェクト
...............................

*note dict.keys(): bb1, *note dict.values(): bb2, *note dict.items():
bb3. によって返されるオブジェクトは、 'ビューオブジェクト' です。これら
は、辞書の項目の動的なビューを提供し、辞書が変更された時、ビューはその変
更を反映します。

辞書ビューは、イテレートすることで対応するデータを yield できます。また
、帰属判定をサポートします:

 -- Describe: len(dictview)

     辞書の項目数を返します。

 -- Describe: iter(dictview)

     辞書のキー、値、または (‘(key, value)’ のタプルとして表される) 項目
     に渡るイテレータを返します。

     キーと値は挿入順序で反復されます。 これにより、 ‘(value, key)’ の対
     の列を ‘pairs = zip(d.values(), d.keys())’ のように *note zip():
     446. で作成できます。 同じリストを作成する他の方法は、 ‘pairs =
     [(v, k) for (k, v) in d.items()]’ です。

     辞書の項目の追加や削除中にビューをイテレートすると、 *note
     RuntimeError: 317. を送出したり、すべての項目に渡ってイテレートでき
     なかったりします。

     バージョン 3.7 で変更: 辞書の順序が挿入順序であると保証されるように
     なりました。

 -- Describe: x in dictview

     'x' が元の辞書のキー、値、または項目 (項目の場合、 'x' は ‘(key,
     value)’ タプルです) にあるとき ‘True’ を返します。

 -- Describe: reversed(dictview)

     辞書のキーもしくは値、項目の順序を逆にしたイテレーターを返します。
     戻り値のビューは、挿入された順とは逆の順でイテレートします。

     バージョン 3.8 で変更: 辞書のビューがリバース可能になりました。

 -- Describe: dictview.mapping

     ビューの参照先の辞書をラップする *note types.MappingProxyType: 194.
     オブジェクト を返します。

     Added in version 3.10.

キーのビューは要素に重複がなくハッシュ可能 (*note hashable: 18e.) である
ため、集合の特性を持ちます。項目のビューも、 キーと値の対に重複がなく、
かつキーがハッシュ可能であるため、集合的な演算を持っています。もし項目の
全ての値がハッシュ可能ならば、項目のビューは集合と相互に演算することが可
能です。 (値のビューは一般に要素に重複があるため、集合の特性を持つとはみ
なされません。) 集合の特性を持つビューに対しては、 *note
collections.abc.Set: 28b9. 抽象基底クラスで定義された全ての演算が利用可
能です (たとえば ‘==’, ‘<’ や ‘^’ など)。 集合演算に対しては、集合はオペ
ランドとして集合しか取ることができないのに対して、これら集合の特性を持つ
ビューはオペランドとして任意のイテラブルを取ることができます。

辞書ビューの使用法の例:

     >>> 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: Frozen dictionaries,  Prev: 辞書ビューオブジェクト,  Up: Mapping types --- dict frozendict

5.4.12.2 Frozen dictionaries
............................

 -- クラス: frozendict (**kwargs)

 -- クラス: frozendict (mapping, /, **kwargs)

 -- クラス: frozendict (iterable, /, **kwargs)

     Return a new frozen dictionary initialized from an optional
     positional argument and a possibly empty set of keyword arguments.

     A ‘frozendict’ has a similar API to the *note dict: 193. API, with
     the following differences:

        * ‘dict’ has more methods than ‘frozendict’:

                  * ‘__delitem__()’

                  * ‘__setitem__()’

                  * *note clear(): 1975.

                  * *note pop(): 7e4.

                  * *note popitem(): 18de.

                  * *note setdefault(): 1430.

                  * *note update(): 181d.

        * A ‘frozendict’ can be hashed with ‘hash(frozendict)’ if all
          keys and values can be hashed.

        * ‘frozendict |= other’ does not modify the ‘frozendict’
          in-place but creates a new frozen dictionary.

     ‘frozendict’ is not a ‘dict’ subclass but inherits directly from
     ‘object’.

     Added in version 3.15.


File: python.info,  Node: コンテキストマネージャ型,  Next: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン,  Prev: Mapping types --- dict frozendict,  Up: 組み込み型

5.4.13 コンテキストマネージャ型
-------------------------------

Python の *note with: 215. 文は、コンテキストマネージャによって定義され
る実行時コンテキストの概念をサポートします。これは、文の本体が実行される
前に進入し文の終わりで脱出する実行時コンテキストを、ユーザ定義クラスが定
義できるようにする一対のメソッドで実装されます:

 -- メソッド: contextmanager.__enter__ ()

     実行時コンテキストに入り、このオブジェクトまたは他の実行時コンテキ
     ストに関連したオブジェクトを返します。このメソッドが返す値はこのコ
     ンテキストマネージャを使う *note with: 215. 文の ‘as’ 節の識別子に
     束縛されます。

     自分自身を返すコンテキストマネージャの例として *note
     ファイルオブジェクト: 1581. があります。ファイルオブジェクトは
     __enter__() から自分自身を返し、 *note open(): 333. が *note with:
     215. 文のコンテキスト式として使われるようにします。

     関連オブジェクトを返すコンテキストマネージャの例としては *note
     decimal.localcontext(): 1740. が返すものがあります。このマネージャ
     はアクティブな10進数コンテキストをオリジナルのコンテキストのコピー
     にセットしてそのコピーを返します。こうすることで, *note with: 215.
     文の本体の内部で、‘with’ 文の外側のコードに影響を与えずに、 10進数
     コンテキストを変更できます。

 -- メソッド: contextmanager.__exit__ (exc_type, exc_val, exc_tb)

     実行時コンテキストから抜け、(発生していた場合) 例外を抑制するかどう
     かを示すブール値フラグを返します。 *note with: 215. 文の本体の実行
     中に例外が発生した場合、引数にはその例外の型と値とトレースバック情
     報を渡します。そうでない場合、引数は全て ‘None’ となります。

     Returning a true value from this method will cause the *note with:
     215. 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: 215. block, the new exception is
     raised, and the original exception is stored in its *note
     __context__: 1681. attribute.

     渡された例外を明示的に再送出すべきではありません。その代わりに、こ
     のメソッドが偽の値を返すことでメソッドの正常終了と送出された例外を
     抑制しないことを伝えるべきです。このようにすればコンテキストマネー
     ジャは *note __exit__(): 16ba. メソッド自体が失敗したのかどうかを簡
     単に見分けることができます。

Python は、易しいスレッド同期、ファイルなどのオブジェクトの即時クローズ
、アクティブな小数算術コンテキストの単純な操作をサポートするために、いく
つかのコンテキストマネージャを用意しています。各型はコンテキスト管理プロ
トコルを実装しているという以上の特別の取り扱いを受けるわけではありません
。例については *note contextlib: 27. モジュールを参照してください。

Python の *note ジェネレータ: 1417. と *note contextlib.contextmanager:
219. *note デコレータ: b1d. はこのプロトコルの簡便な実装方法を提供します
。ジェネレータ関数を ‘contextlib.contextmanager’ デコレータでデコレート
すると、デコレートされないジェネレータ関数が作成するイテレータの代わりに
、必要な *note __enter__(): 28bc. および *note __exit__(): 28bd. メソッ
ドを実装したコンテキストマネージャを返すようになります。

これらのメソッドのために Python/C API の中の Python オブジェクトの型構造
体に特別なスロットが作られたわけではないことに注意してください。これらの
メソッドを定義したい拡張型はこれらを通常の Python からアクセスできるメソ
ッドとして提供しなければなりません。実行時コンテキストを準備するオーバー
ヘッドに比べたら、一回のクラス辞書の探索のオーバーヘッドは無視できます。


File: python.info,  Node: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン,  Next: その他の組み込み型,  Prev: コンテキストマネージャ型,  Up: 組み込み型

5.4.14 型アノテーション型 -- ジェネリックエイリアス 、 ユニオン
---------------------------------------------------------------

*note 型アノテーション: 410. の中心となる組み込みの型は *note
ジェネリックエイリアス: aa4. と *note ユニオン: ba6. です。

* Menu:

* ジェネリックエイリアス型::
* Union 型::


File: python.info,  Node: ジェネリックエイリアス型,  Next: Union 型,  Up: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン

5.4.14.1 ジェネリックエイリアス型
.................................

‘GenericAlias’ オブジェクトは一般的に、クラスに *note 添字表記: 25b8. を
することで作られます。 *note list: 4e0. や *note dict: 193. のような
*note コンテナ系のクラス: 25e8. に対して使われることがほとんどです。 例
えば、 ‘list[int]’ は ‘list’ クラスに *note int: 32e. という引数を与えた
添字表記をすることで作られる ‘GenericAlias’ オブジェクトです。
‘GenericAlias’ オブジェクトは主に *note 型アノテーション: 410. の用途で
使われます。

     注釈: 一般に、クラスへの添字表記は、そのクラスが特殊メソッド *note
     __class_getitem__(): b26. を実装しているときに限り可能です。

‘GenericAlias’ オブジェクトは 'パラメータ付きジェネリック型' を実装した
ジェネリック型 (*note generic type: 1dc.) の代用として振る舞います。

コンテナクラスに対してクラスの *note 添字表記: 25b8. に与えられた単一ま
たは複数の引数は、そのオブジェクトが包含する要素の型をあらわします。たと
えば ‘set[bytes]’ という表記は、全ての要素が *note bytes: 1d2. であるよ
うな *note set: 432. をあらわす型アノテーションとして使うことができます
。

*note __class_getitem__(): b26. メソッドを定義しているけれどもコンテナで
ないクラスに対しては、クラスの添字表記に与えられた単一または複数の引数は
、しばしばオブジェクトに定義された単一または複数のメソッドの戻り値の型を
あらわします。たとえば、 *note 正規表現操作: c1. は *note str: 1ea. と
*note bytes: 1d2. の両方のデータ型に対して使うことができます:

   * ‘x = re.search('foo', 'foo')’ とした場合、 ‘x’ は *note re.Match:
     1337. オブジェクトとなり、 ‘x.group(0)’ と ‘x[0]’ の戻り値はどちら
     も *note str: 1ea. となります。このようなオブジェクトは、
     ‘GenericAlias’ を使った型アノテーション ‘re.Match[str]’ で表現する
     ことができます。

   * ‘y = re.search(b'bar', b'bar')’ (ここで ‘b’ は *note bytes: 1d2. 型
     をあらわします) とした場合、‘y’ もまた ‘re.Match’ のインスタンスと
     なりますが、 ‘y.group(0)’ と ‘y[0]’ の戻り値はどちらも ‘bytes’ 型に
     なります。型アノテーションでは、このような *note re.Match: 1337. オ
     ブジェクトは ‘re.Match[bytes]’ と表現することになるでしょう。

‘GenericAlias’ objects are instances of the class *note
types.GenericAlias: bcb, which can also be used to create ‘GenericAlias’
objects directly.  Specializations of user-defined *note generic
classes: 2587. may not be instances of ‘types.GenericAlias’, but they
provide similar functionality.

 -- Describe: T[X, Y, ...]

     型 "X", "Y", またはさらに多くの引数でパラメータ化される型 ‘T’ を表
     現する ‘GenericAlias’ を生成します。引数の数は ‘T’ の使われ方によっ
     て決まります。たとえば、 *note float: 32f. 型の要素を含む *note
     list: 4e0. を引数にとる関数の型アノテーションは次のようになります:

          def average(values: list[float]) -> float:
              return sum(values) / len(values)

     もうひとつの例として *note mapping: 1579. オブジェクトの場合を示し
     ます。ここではキーと値の2つの型をパラメータとするジェネリック型であ
     る *note dict: 193. を使っています。この例では、関数はキーが *note
     str: 1ea. 型、値が *note int: 32e. 型であるような ‘dict’ を引数にと
     ります:

          def send_post_request(url: str, body: dict[str, int]) -> None:
              ...

組み込み関数 *note isinstance(): 2fb. と *note issubclass(): 2fc. は第二
引数として ‘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 型アノテーション: 410. は強制されません。この性
質はジェネリック型とその型パラメータにもおよびます。 ‘GenericAlias’ から
コンテナオブジェクトを生成した場合、コンテナ内の要素は型のチェックを受け
ません。たとえば、以下のコードは推奨されませんが、エラーになることなく実
行できます:

     >>> t = list[str]
     >>> t([1, 2, 3])
     [1, 2, 3]

しかも、パラメータ付きジェネリック型は、オブジェクト生成時にパラメータの
型情報を削除します:

     >>> t = list[str]
     >>> type(t)
     <class 'types.GenericAlias'>

     >>> l = t()
     >>> type(l)
     <class 'list'>

*note repr(): 462. や *note str(): 1ea. のジェネリック型に対する呼び出し
は、パラメータ型を表示します:

     >>> repr(list[int])
     'list[int]'

     >>> str(list[int])
     'list[int]'

ジェネリックコンテナ型の *note __getitem__(): 78d. メソッドは、
‘dict[str][str]’ のようなミスを許さないように、例外を送出します:

     >>> dict[str][str]
     Traceback (most recent call last):
       ...
     TypeError: dict[str] is not a generic class

一方で、同様の式は *note 型変数: 25de. が使われた場合は有効です。添字の
数は''GenericAlias'' オブジェクトの *note __args__: 28c0. 属性における型
変数の数と同じでなければなりません:

     >>> 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: 1d9.

   * *note list: 4e0.

   * *note dict: 193.

   * *note set: 432.

   * *note frozendict: 18d.

   * *note frozenset: 9d9.

   * *note type: 191.

   * *note asyncio.Future: f8f.

   * *note asyncio.Task: 467.

   * *note collections.deque: 9db.

   * *note collections.defaultdict: 157a.

   * *note collections.OrderedDict: 9da.

   * *note collections.Counter: 20f.

   * *note collections.ChainMap: fdf.

   * ’’*note collections.abc.Awaitable: 1198.

   * *note collections.abc.Coroutine: 1199.

   * *note collections.abc.AsyncIterable: 119b.

   * *note collections.abc.AsyncIterator: 119a.

   * *note collections.abc.AsyncGenerator: 104e.

   * *note collections.abc.Iterable: 28c2.

   * *note collections.abc.Iterator: 28c3.

   * *note collections.abc.Generator: 1197.

   * *note collections.abc.Reversible: 104c.

   * *note collections.abc.Container: 28c4.

   * *note collections.abc.Collection: 104b.

   * *note collections.abc.Callable: bca.

   * *note collections.abc.Set: 28b9.

   * *note collections.abc.MutableSet: 28c5.

   * *note collections.abc.Mapping: ca0.

   * *note collections.abc.MutableMapping: 146a.

   * *note collections.abc.Sequence: 1582.

   * *note collections.abc.MutableSequence: 6cc.

   * *note collections.abc.ByteString: 2d6.

   * *note collections.abc.MappingView: 28c6.

   * *note collections.abc.KeysView: 28c7.

   * *note collections.abc.ItemsView: 28c8.

   * *note collections.abc.ValuesView: 28c9.

   * *note contextlib.AbstractContextManager: 1051.

   * *note contextlib.AbstractAsyncContextManager: eef.

   * *note dataclasses.Field: 1b8d.

   * *note functools.cached_property: 953.

   * *note functools.partialmethod: 4ae.

   * *note os.PathLike: 1013.

   * *note queue.LifoQueue: 28ca.

   * *note queue.Queue: 174d.

   * *note queue.PriorityQueue: 28cb.

   * *note queue.SimpleQueue: f2b.

   * *note re.Pattern: 1336.

   * *note re.Match: 1337.

   * *note shelve.BsdDbShelf: 28cc.

   * *note shelve.DbfilenameShelf: 28cd.

   * *note shelve.Shelf: 1349.

   * *note types.MappingProxyType: 194.

   * *note weakref.WeakKeyDictionary: 1b63.

   * *note weakref.WeakMethod: 139d.

   * *note weakref.WeakSet: 9dc.

   * *note weakref.WeakValueDictionary: 1b64.


File: python.info,  Node: GenericAlias オブジェクトの特別な属性,  Prev: 標準ジェネリッククラス,  Up: ジェネリックエイリアス型

5.4.14.3 ‘GenericAlias’ オブジェクトの特別な属性
................................................

全てのパラメータ付きジェネリック型は、下記に示す読み出し専用の属性を実装
しています。

 -- の属性: genericalias.__origin__

     この属性は、対応するパラメータ付きでないジェネリッククラスを指しま
     す:

          >>> list[int].__origin__
          <class 'list'>

 -- の属性: genericalias.__args__

     この属性は、ジェネリッククラスの元の *note __class_getitem__():
     b26. に渡された *note tuple: 1d9. です (長さが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: 2a0. パラメータを含む
          ‘GenericAlias’ オブジェクトは、代入後に正しい ‘__parameters__’
          を持たない可能性があります。これは ‘typing.ParamSpec’ が主に静
          的な型チェックを目的としているためです。

 -- の属性: genericalias.__unpacked__

     これは、型エイリアスが ‘*’ 演算子を使って取り出された場合に真となる
     真偽値です (*note TypeVarTuple: 29e. を参照してください)。

     Added in version 3.11.

参考
....

PEP 484(1) - 型ヒント

     型アノテーションのための Python のフレームワークへの導入です。

PEP 585(2) - 標準コレクション型の型ヒントにおける総称型 (generics) の使用

     特殊なクラスメソッド *note __class_getitem__(): b26. を実装している
     場合に、標準ライブラリのクラスに対してネイティブにパラメータ表記を
     可能にする機能への導入です。

*note ジェネリクス: 25de, *note ユーザー定義のジェネリック型: 8e4, および *note typing.Generic: 1a12.

     実行時にパラメータ設定が可能であり、かつ静的な型チェッカーが理解で
     きるジェネリッククラスを実装する方法のドキュメントです。

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: 27f8.  These types are intended primarily
for *note type annotations: 410.  The union type expression enables
cleaner type hinting syntax compared to subscripting *note typing.Union:
349.

 -- Describe: X | Y | ...

     'X' と 'Y' などの型を保持するUnionオブジェクトを定義すします。‘X |
     Y’ はXとYのいずれかを意味します。これは ‘typing.Union[X, Y]’ と等価
     です。たとえば、以下の関数は引数として *note int: 32e. 型または
     *note float: 32f. 型を想定しています。:

          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: 349.:

               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(): 2fb. と *note issubclass(): 2fc. の呼び出しはど
     ちらもUnionオブジェクトをサポートしています。

          >>> isinstance("", int | str)
          True

     しかし、Unionオブジェクトの中の *note parameterized generics: aa4.
     はチェックできません:

          >>> 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: 349. and used for *note isinstance(): 2fb. 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: 349.  Previously, they were instances of *note
types.UnionType: 52e, 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: 9df. 文は、厳密にいえば、モジュールオブジェクトに対する演算では
ありません; ‘import foo’ は 'foo' と名づけられたモジュールオブジェクトの
存在を必要とはせず、'foo' と名づけられたモジュールの (外部の) '定義' を
必要とします。)

全てのモジュールにある特殊属性が *note __dict__: 1ca. です。これはモジュ
ールのシンボルテーブルを含む辞書です。この辞書を書き換えると実際にモジュ
ールのシンボルテーブルを変更することができますが、‘__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 オブジェクト、値、および型: 253b. および *note
クラス定義: 1691. を参照してください。


File: python.info,  Node: 関数,  Next: メソッド,  Prev: クラスおよびクラスインスタンス,  Up: その他の組み込み型

5.4.15.3 関数
.............

関数オブジェクトは関数定義によって生成されます。関数オブジェクトに対する
唯一の操作は、それを呼び出すことです: ‘func(argument-list)’ 。

関数オブジェクトには実際には二種類あります: 組み込み関数とユーザ定義関数
です。どちらも同じ操作 (関数の呼び出し) をサポートしますが、実装は異なる
ので、オブジェクトの型も異なります。

詳細は、 *note 関数定義: 2224. を参照してください。


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: 2569. (such as *note
append(): abf. on lists) and *note class instance method: 22b5.
Built-in methods are described with the types that support them.

インスタンスを通してメソッド (クラスの名前空間内で定義された関数) にアク
セスすると、特殊なオブジェクトが得られます。それは束縛メソッド ('bound
method') オブジェクトで、インスタンスメソッド (*note instance method:
22b5.) とも呼ばれます。呼び出された時、引数リストに ‘self’ 引数が追加さ
れます。束縛メソッドには 2 つの特殊読み出し専用属性があります。 *note
m.__self__: 1781. はそのメソッドが操作するオブジェクトで、*note
m.__func__: 16b6. はそのメソッドを実装している関数です。 ‘m(arg-1,
arg-2, ..., arg-n)’ の呼び出しは、 ‘m.__func__(m.__self__, arg-1, arg-2,
..., arg-n)’ の呼び出しと完全に等価です。

*note function objects: 7a1. と同様に、メソッドオブジェクトは任意の属性
の取得をサポートしています。しかし、メソッド属性は実際には下層の関数オブ
ジェクト (*note method.__func__: 16b6.) に記憶されているので、バインドさ
れるメソッドにメソッド属性を設定することは許されていません。メソッドに属
性を設定しようとすると *note AttributeError: 1b4. が送出されます。メソッ
ドの属性を設定するためには、次のようにその下層の関数オブジェクトに明示的
に設定する必要があります:

     >>> 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 インスタンスメソッド: 22b5. を参照してください。


File: python.info,  Node: コードオブジェクト<2>,  Next: 型オブジェクト,  Prev: メソッド,  Up: その他の組み込み型

5.4.15.5 コードオブジェクト
...........................

コードオブジェクトは、関数本体のような "擬似コンパイルされた" Python の
実行可能コードを表すために実装系によって使われます。コードオブジェクトは
グローバルな実行環境への参照を持たない点で関数オブジェクトとは異なります
。コードオブジェクトは組み込み関数 *note compile(): 1d3. によって返され
、また関数オブジェクトの *note __code__: 7a2. 属性として取り出せます。
*note code: 1b. モジュールも参照してください。

*note __code__: 7a2. へのアクセスは ‘object.__getattr__’ に ‘obj’ と
‘"__code__"’ を渡して行いますが、 *note 監査イベント: 1e84. を送出します
。

コードオブジェクトは、組み込み関数 *note exec(): 190. や *note eval():
18f. に (ソース文字列の代わりに) 渡すことで、実行や評価できます。

詳細は、 *note 標準型の階層: 253e. を参照してください。


File: python.info,  Node: 型オブジェクト,  Next: ヌルオブジェクト,  Prev: コードオブジェクト<2>,  Up: その他の組み込み型

5.4.15.6 型オブジェクト
.......................

型オブジェクトは様々なオブジェクト型を表します。オブジェクトの型は組み込
み関数 *note type(): 191. でアクセスされます。型オブジェクトには特有の操
作はありません。標準モジュール *note types: 10c. には全ての組み込み型名
が定義されています。

型はこのように書き表されます: ‘<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: 2537. (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: 28e3. or
     *note tuple elements: 28e4.

   - As the body of a function instead of a *note pass statement: 2207.

   - 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: 1826, as a pattern for missing content.

   - The default Python prompt of the *note interactive: 458. 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 比較: 26e6. を参照して
ください。 *note NotImplemented: 447. オブジェクトは一つだけです。
‘type(NotImplemented)()’ はこの単一のインスタンスを作成します。

‘NotImplemented’ と書き表されます。


File: python.info,  Node: 内部オブジェクト,  Prev: NotImplemented オブジェクト,  Up: その他の組み込み型

5.4.15.10 内部オブジェクト
..........................

この情報は *note 標準型の階層: 253e. を参照してください。*note stack
frame objects: ad2.、*note traceback objects: ebe.、スライスオブジェクト
について記述されています。


File: python.info,  Node: 特殊属性,  Next: 整数と文字列の変換での長さ制限,  Prev: その他の組み込み型,  Up: 組み込み型

5.4.16 特殊属性
---------------

実装は、いくつかのオブジェクト型に対して、適切な場合には特殊な読み出し専
用の属性を追加します。そのうちいくつかは *note dir(): a28. 組込み関数で
報告されません。

 -- の属性: definition.__name__

     クラス、関数、メソッド、デスクリプタ、ジェネレータインスタンスの名
     前です。

 -- の属性: definition.__qualname__

     クラス、関数、メソッド、デスクリプタ、ジェネレータインスタンスの
     *note 修飾名: 1f38. です。

     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: 7ab. of generic classes, functions, and
     *note type aliases: 875.  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: 32e. と *note
str: 1ea. の間の変換に全体的な制限を設けました。この制限は10進数や2のべ
き乗以外の基数に 'のみ' 適用されます。16進数、8進数と2進数は制限がありま
せん。上限値は設定できます。

CPython の *note int: 32e. 型は、任意の長さの数をバイナリ形式で保存した
ものです (一般に "bignum" または多倍長整数として知られています)。基数が
2のべき乗でない限り、線形の時間で文字列をバイナリ整数に、あるいはバイナ
リ整数を文字列に変換できるアルゴリズムは存在しません。10進数に対するアル
ゴリズムでは、最もよく知られているものでさえ、2次に近い (sub-quadratic)
複雑さになります。高速な CPU でも、 ‘int('1' * 500_000)’ のような大きな
数の変換は1秒以上かかる可能性があります。

変換するサイズを制限することは、 CVE 2020-10735(1) を回避する実践的な方
法を提供します。

制限は、非線形な変換アルゴリズムが必要とされる場合に、入力または出力文字
列の桁数に対して適用されます。アンダースコアや正負の符号はカウントされま
せん。

演算の結果が制限を超えると、*note ValueError: 15a. が送出されます:

     >>> 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: 164d. で定義されています。設定可能
な最小の上限値は 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: 32e. と *note str: 1ea. または *note bytes: 1d2. の間
での変換で時間がかかる可能性があると適用されます:

   * ‘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(): 19af. と *note int.to_bytes(): 1e48. 。

   * *note hex(): 1689, *note oct(): 1688, *note bin(): 1662.

   * *note Format specification mini-language: 704. での16進数、8進数、
     2進数での表現。

   * *note str: 1ea. から *note float: 32f.。

   * *note str: 1ea. から *note decimal.Decimal: 1cd.。


File: python.info,  Node: 上限値を設定する,  Next: 推奨設定,  Prev: 影響のあるAPI,  Up: 整数と文字列の変換での長さ制限

5.4.17.2 上限値を設定する
.........................

Pythonを起動する前に環境変数またはインタープリタのコマンドラインのフラグ
で上限値を設定できます。

   * *note PYTHONINTMAXSTRDIGITS: 1d57.、たとえば
     ‘PYTHONINTMAXSTRDIGITS=640 python3’ は上限値を640に設定し、
     ‘PYTHONINTMAXSTRDIGITS=0 python3’ は制限を無効化します。

   * *note -X int_max_str_digits: 183.、たとえば ‘python3 -X
     int_max_str_digits=640’

   * *note sys.flags.int_max_str_digits: 28ef. には *note
     PYTHONINTMAXSTRDIGITS: 1d57. または *note -X int_max_str_digits:
     183. の値が設定されます。環境変数と ‘-X’ オプションの両方が指定され
     た場合は ‘-X’ オプションが優先されます。 '-1' という値はどちらも未
     設定であることを表し、その場合は *note
     sys.int_info.default_max_str_digits: 28f0. の値が初期化時に使用され
     ます。

コードでは、以下の *note sys: e2. APIを使用して現在の上限値を調べ、新し
い値を設定できます。

   * *note sys.get_int_max_str_digits(): 1a32. と *note
     sys.set_int_max_str_digits(): 1b30. はインタープリタ全体での上限値
     を取得、設定できます。サブインタープリタはそれぞれの上限値を持ちま
     す。

デフォルト値と最小値に関する情報は *note sys.int_info: 164d. で参照でき
ます:

   * *note sys.int_info.default_max_str_digits: 164d. はコンパイル時のデ
     フォルト上限値です。

   * *note sys.int_info.str_digits_check_threshold: 164d. は上限値として
     指定できる最低の値です(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: 28f0. は、ほとん
どのアプリケーションで適切な値であると期待されます。もしあなたのアプリケ
ーションが異なる制限値を必要とする場合は、メインのエントリーポイントから
、 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: 9bd. から派生したク
ラスのインスタンスでなければなりません。特定のクラスを言及する *note
except: 44e. 節を伴う *note try: adb. 文において、その節はそのクラスから
派生した例外クラスも処理しますが、そのクラスの派生 '元' の例外クラスは処
理しません。サブクラス化の関係にない 2 つの例外クラスは、それらが同じ名
前だった場合でも等しくなりえません。

この章で挙げる組み込み例外は、インタプリタや組み込み関数によって生成され
ます。特に注記しないかぎり、これらはエラーの詳しい原因を示す "関連値
(associated value)" を持ちます。この値は、複数の情報 (エラーコードや、そ
のコードを説明する文字列など) の文字列かタプルです。関連値は通常、例外ク
ラスのコンストラクタに引数として渡されます。

ユーザによるコードも組み込み例外を送出できます。これを使って、例外ハンド
ラをテストしたり、インタプリタが同じ例外を送出する状況と "ちょうど同じよ
うな" エラー条件であることを報告したりできます。しかし、ユーザのコードが
適切でないエラーを送出するのを妨げる方法はないので注意してください。

組み込み例外クラスは新たな例外を定義するためにサブクラス化することができ
ます。新しい例外は、*note Exception: da2. クラスかそのサブクラスの一つか
ら派生することをお勧めします。 *note BaseException: 9bd. からは派生しな
いで下さい。例外を定義する上での詳しい情報は、 Python チュートリアルの
*note ユーザー定義例外: 2289. の項目にあります。

* 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: 44e. or *note finally: 453. clause,
     or a *note with: 215. statement, is used.

     This implicit exception context can be supplemented with an
     explicit cause by using ‘from’ with *note raise: 9e9.:

          raise new_exc from original_exc

     *note from: 9e9. に続く式は例外か ‘None’ でなくてはなりません。 式
     は送出される例外の ‘__cause__’ として設定されます。 ‘__cause__’ を
     設定することは、 ‘__suppress_context__’ 属性を暗黙的に ‘True’ に設
     定することにもなるので、 ‘raise new_exc from None’ を使うことで効率
     的に古い例外を新しいもので置き換えて表示する (例えば、 *note
     KeyError: 7e5. を *note AttributeError: 1b4. に置き換え)、古い例外
     はデバッグ時の調査で使えるよう ‘__context__’ に残すことができます。

     デフォルトの traceback 表示コードは、例外自体の traceback に加え、
     これらの連鎖された例外を表示します。‘__cause__’ で明示的に連鎖させ
     た例外は、存在するならば常に表示されます。‘__context__’ で暗黙に連
     鎖させた例外は、‘__cause__’ が *note None: a6a. かつ
     ‘__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/main/Objects/exceptions.c


File: python.info,  Node: 基底クラス,  Next: 具象例外,  Prev: 組み込み例外から継承する,  Up: 組み込み例外

5.5.3 基底クラス
----------------

以下の例外は、主に他の例外の基底クラスとして使われます。

 -- 例外: BaseException

     全ての組み込み例外の基底クラスです。ユーザ定義の例外に直接継承され
     ることは意図されていません (継承には *note Exception: da2. を使って
     ください)。このクラスのインスタンスに *note str(): 1ea. が呼ばれた
     場合、インスタンスへの引数の表現か、引数が無い場合には空文字列が返
     されます。

      -- の属性: args

          例外コンストラクタに与えられた引数のタプルです。組み込み例外は
          普通、エラーメッセージを与える一つの文字列だけを引数として呼ば
          れますが、中には (*note OSError: 543. など) いくつかの引数を必
          要とし、このタプルの要素に特別な意味を込めるものもあります。

      -- メソッド: 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: ebe.
          associated with this exception.  See also: *note raise 文:
          9e9.

      -- メソッド: add_note (note)

          例外のノートとして文字列 ‘note’ を追加します。ノートは標準のト
          レースバックで例外文字列の後に表示されます。‘note’ が文字列以
          外の場合 *note TypeError: 29c. が送出されます。

          Added in version 3.11.

      -- の属性: __notes__

          *note add_note(): 9be. で追加された例外のノートのリスト。この
          属性は ‘add_note()’ を呼び出すと生成されます。

          Added in version 3.11.

 -- 例外: Exception

     システム終了以外の全ての組み込み例外はこのクラスから派生しています
     。全てのユーザ定義例外もこのクラスから派生させるべきです。

 -- 例外: ArithmeticError

     算術上の様々なエラーに対して送出される組み込み例外 *note
     OverflowError: c5b, *note ZeroDivisionError: d15, *note
     FloatingPointError: 28fa. の基底クラスです。

 -- 例外: BufferError

     *note バッファ: 319. に関連する操作が行えなかったときに送出されます
     。

 -- 例外: LookupError

     マッピングまたはシーケンスで使われたキーやインデクスが無効な場合に
     送出される例外 *note IndexError: 18ed. および *note KeyError: 7e5.
     の基底クラスです。 *note codecs.lookup(): d31. によって直接送出され
     ることもあります。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3134/


File: python.info,  Node: 具象例外,  Next: 警告,  Prev: 基底クラス,  Up: 組み込み例外

5.5.4 具象例外
--------------

以下の例外は、通常送出される例外です。

 -- 例外: AssertionError

     *note assert: d35. 文が失敗した場合に送出されます。

 -- 例外: AttributeError

     属性参照 (*note 属性参照: 26bf. を参照) や代入が失敗した場合に送出
     されます (オブジェクトが属性の参照や属性の代入をまったくサポートし
     ていない場合には *note TypeError: 29c. が送出されます)。

     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: 28fc. および *note obj: 28fd. 属
     性が追加されました。

 -- 例外: EOFError

     Raised when the *note input(): 1692. function hits an end-of-file
     condition (EOF) without reading any data.  (Note: the *note
     io.TextIOBase.read(): 2279. and *note io.IOBase.readline(): 16e3.
     methods return an empty string when they hit EOF.)

 -- 例外: FloatingPointError

     現在は使われていません。

 -- 例外: GeneratorExit

     *note ジェネレータ: 1417. や *note コルーチン: 8a7. が閉じられたと
     きに送出されます。 *note generator.close(): 19bf. と *note
     coroutine.close(): 262e. を参照してください。この例外は厳密に言えば
     エラーではないので、 *note Exception: da2. ではなく *note
     BaseException: 9bd. を直接継承しています。

 -- 例外: ImportError

     *note import: 9df. 文でモジュールをロードしようとして問題が発生する
     と送出されます。 ‘from ... import’ の中の"from list" (訳注：‘...’ の
     部分)の名前が見つからないときにも送出されます。

     オブションのキーワード専用引数 'name' と 'path' は、対応する属性に
     設定されます:

      -- の属性: name

          インポートを試みたモジュールの名前。

      -- の属性: path

          例外を引き起こしたファイルのパス。

     バージョン 3.3 で変更: *note name: 1923. および *note path: 28fe. 属
     性が追加されました。

 -- 例外: ModuleNotFoundError

     *note ImportError: 1c8. のサブクラスで、*note import: 9df. 文でモジ
     ュールが見つからない場合に送出されます。また、 *note sys.modules:
     19da. に ‘None’ が含まれる場合にも送出されます。

     Added in version 3.6.

 -- 例外: ImportCycleError

     A subclass of *note ImportError: 1c8. which is raised when a lazy
     import fails because it (directly or indirectly) tries to import
     itself.

     Added in version 3.15.

 -- 例外: IndexError

     シーケンスの添字が範囲外の場合に送出されます。 (スライスのインデク
     スはシーケンスの範囲に収まるように暗黙のうちに調整されます; インデ
     クスが整数でない場合、 *note TypeError: 29c. が送出されます。)

 -- 例外: KeyError

     マッピング (辞書) のキーが、既存のキーの集合内に見つからなかった場
     合に送出されます。

 -- 例外: KeyboardInterrupt

     ユーザが割り込みキー (通常は ‘Control’-‘C’ または ‘Delete’) を押し
     た場合に送出されます。実行中、割り込みは定期的に監視されます。*note
     Exception: da2. を捕捉するコードに誤って捕捉されてインタプリタの終
     了が阻害されないように、この例外は *note BaseException: 9bd. を継承
     しています。

          注釈: 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: 2900.)

 -- 例外: 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: 2901. 属性が追加されました。

 -- 例外: NotImplementedError

     この例外は *note RuntimeError: 317. から派生しています。ユーザ定義
     の基底クラスにおいて、抽象メソッドが派生クラスでオーバライドされる
     ことを要求する場合にこの例外を送出しなくてはなりません。またはクラ
     スは実装中であり本来の実装を追加する必要があることを示します。

          注釈: 演算子やメソッドがサポートされていないことを示す目的でこ
          の例外を使用するべきではありません。そのようなケースではオペレ
          ータやメソッドを未定義のままとするか、サブクラスの場合は *note
          None: a6a. を設定してください。

          注意: ‘NotImplementedError’ and ‘NotImplemented’ are not
          interchangeable.  This exception should only be used as
          described above; see *note NotImplemented: 447. 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: a6a. です。後方互換性
     のために、引数が3つ渡された場合、*note args: 977. 属性は最初の2つの
     要素のみからなるタプルを持ちます。

     コンストラクタは実際には、 *note OS exceptions: 2902. で述べられて
     いる *note OSError: 543. のサブクラスを返すことがよくあります。特定
     のサブクラスは最終的な *note errno: 19ea. 値によります。この挙動は
     ‘OSError’ を直接またはエイリアスで構築し、サブクラス化時に継承され
     なかった場合にのみ発生します。

      -- の属性: errno

          C 変数 ‘errno’ に由来する数値エラーコードです。

      -- の属性: winerror

          Windows において、ネイティブ Windows エラーコードを与えます。
          そして *note errno: 19ea. 属性は POSIX でいうネイティブエラー
          コードへのおよその翻訳です。

          Windows では、'winerror' コンストラクタ引数が整数の場合 *note
          errno: 19ea. 属性は Windows エラーコードから決定され、'errno'
          引数は無視されます。他のプラットフォームでは 'winerror' 引数は
          無視され、 *note winerror: 2903. 属性は存在しません。

      -- の属性: 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():
          333. や *note os.unlink(): 14b6.) の場合、*note filename:
          2905. は関数に渡されたファイル名です。 ファイルシステムパスが
          2つ関与する関数 (例えば *note os.rename(): 14b2.) の場合、
          *note filename2: 2906. は関数に渡された2つ目のファイル名です。

     バージョン 3.3 で変更: *note EnvironmentError: 140a, *note IOError:
     1409, *note WindowsError: 140b, *note socket.error: 140c, *note
     select.error: 140d. and ‘mmap.error’ have been merged into *note
     OSError: 543, and the constructor may return a subclass.

     バージョン 3.4 で変更: *note filename: 2905. 属性が *note
     filesystem encoding and error handler: 94d. のエンコーディングでエ
     ンコードやデコードされた名前から、関数に渡された元々のファイル名に
     なりました。 また、'filename2' コンストラクタ引数が追加されました。

 -- 例外: OverflowError

     算術演算の結果が表現できない大きな値になった場合に送出されます。こ
     れは整数では起こりません (むしろ *note MemoryError: 191d. が送出さ
     れることになるでしょう)。しかし、歴史的な理由のため、要求された範囲
     の外の整数に対して OverflowError が送出されることがあります。C の浮
     動小数点演算の例外処理は標準化されていないので、ほとんどの浮動小数
     点演算もチェックされません。

 -- 例外: PythonFinalizationError

     This exception is derived from *note RuntimeError: 317.  It is
     raised when an operation is blocked during interpreter shutdown
     also known as *note Python finalization: 1ab.

     Examples of operations which can be blocked with a
     ‘PythonFinalizationError’ during the Python finalization:

        * Creating a new Python thread.

        * *note Joining: 15a3. a running daemon thread.

        * *note os.fork(): 6c3,

        * acquiring a lock such as *note threading.Lock: 1a30, when it
          is known that the operation would otherwise deadlock.

     *note sys.is_finalizing(): e53. 関数も参照してください。

     Added in version 3.13: 以前は *note RuntimeError: 317. をそのまま送
     出していました。

     バージョン 3.14 で変更: *note threading.Thread.join(): 15a3. can
     now raise this exception.

     バージョン 3.15 で変更: This exception may be raised when acquiring
     *note threading.Lock(): 1a30. or *note threading.RLock(): 2eb.

 -- 例外: RecursionError

     この例外は *note RuntimeError: 317. を継承しています。インタープリ
     タが最大再帰深度 (*note sys.getrecursionlimit(): 8d9. を参照) の超
     過を検出すると送出されます。

     Added in version 3.5: 以前は *note RuntimeError: 317. をそのまま送
     出していました。

 -- 例外: ReferenceError

     *note weakref.proxy(): e19. によって生成された弱参照 (weak
     reference) プロキシを使って、ガーベジコレクションによって回収された
     後の参照対象オブジェクトの属性にアクセスした場合に送出されます。弱
     参照については *note weakref: 11d. モジュールを参照してください。

 -- 例外: RuntimeError

     他のカテゴリに分類できないエラーが検出された場合に送出されます。関
     連値は、何が問題だったのかをより詳細に示す文字列です。

 -- 例外: StopIteration

     組込み関数 *note next(): bb9. と *note iterator: 6d4. の *note
     __next__(): 1687. メソッドによって、そのイテレータが生成するアイテ
     ムがこれ以上ないことを伝えるために送出されます。

      -- の属性: value

          この例外オブジェクトには一つの属性 ‘value’ があり、例外を構成
          する際に引数として与えられ、デフォルトは *note None: a6a. です
          。

     *note generator: 1417. や *note coroutine: 8a7. 関数が返るとき、新
     しい *note StopIteration: fbe. インスタンスが送出されます。 関数の
     返り値は例外のコンストラクタの *note value: 262b. 引数として使われ
     ます。

     ジェネレータのコードが直接的あるいは間接的に *note StopIteration:
     fbe. を送出する場合は、 *note RuntimeError: 317. に変換されます
     (‘StopIteration’ は変換後の例外の原因として保持されます)。

     バージョン 3.3 で変更: ‘value’ 属性とジェネレータ関数が値を返すため
     にそれを使う機能が追加されました。

     バージョン 3.5 で変更: ‘from __future__ import generator_stop’ によ
     る RuntimeError への変換が導入されました。 PEP 479(1) を参照してく
     ださい。

     バージョン 3.7 で変更: PEP 479(2) が全てのコードでデフォルトで有効
     化されました: ジェネレータから送出された *note StopIteration: fbe.
     は *note RuntimeError: 317. に変換されます。

 -- 例外: StopAsyncIteration

     イテレーションを停止するために、 *note asynchronous iterator: 6d3.
     オブジェクトの *note __anext__(): 1ac6. メソッドによって返される必
     要があります。

     Added in version 3.5.

 -- 例外: SyntaxError (message, details)

     パーザが構文エラーに遭遇した場合に送出されます。この例外は *note
     import: 9df. 文、組み込み関数 *note compile(): 1d3.、*note exec():
     190. や *note eval(): 18f. 、初期化スクリプトの読み込みや標準入力で
     (対話的な実行時にも) 起こる可能性があります。

     例外インスタンスの *note str(): 1ea. はエラーメッセージのみを返しま
     す。詳細はタプルで、個々の属性としても利用できます。

      -- の属性: 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: 290b. および *note
     end_offset: 290c. 属性が追加されました。

 -- 例外: IndentationError

     正しくないインデントに関する構文エラーの基底クラスです。これは
     *note SyntaxError: 189. のサブクラスです。

 -- 例外: TabError

     タブとスペースを一貫しない方法でインデントに使っているときに送出さ
     れます。これは *note IndentationError: 18ef. のサブクラスです。

 -- 例外: 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: ae8, 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(): 506. function.
     It inherits from *note BaseException: 9bd. instead of *note
     Exception: da2. 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(): 506. は、クリーンアップのための処理 (*note try:
     adb. 文の *note finally: 453. 節) が実行されるようにするため、また
     デバッガが制御不能になるリスクを冒さずにスクリプトを実行できるよう
     にするために例外に変換されます。即座に終了することが真に強く必要で
     あるとき (例えば、*note os.fork(): 6c3. を呼んだ後の子プロセス内) に
     は *note os._exit(): 290d. 関数を使うことができます。

      -- の属性: code

          コンストラクタに渡された終了ステータス又はエラーメッセージ。
          (デフォルトは ‘None’)

 -- 例外: TypeError

     組み込み演算または関数が適切でない型のオブジェクトに対して適用され
     た際に送出されます。関連値は型の不整合に関して詳細を述べた文字列で
     す。

     この例外は、そのオブジェクトで実行しようとした操作がサポートされて
     おらず、その予定もない場合にユーザーコードから送出されるかもしれま
     せん。オブジェクトでその操作をサポートするつもりだが、まだ実装を提
     供していないのであれば、送出する適切な例外は *note
     NotImplementedError: 5a1. です。

     誤った型の引数が渡された場合は (例えば、*note int: 32e. が期待され
     るのに、*note list: 4e0. が渡された) *note TypeError: 29c. となるべ
     きです。しかし、誤った値(例えば、期待する範囲外の数)が引数として渡
     された場合は、 *note ValueError: 15a. となるべきです。

 -- 例外: UnboundLocalError

     関数やメソッド内のローカルな変数に対して参照を行ったが、その変数に
     は値が代入されていなかった場合に送出されます。 *note NameError:
     66c. のサブクラスです。

 -- 例外: UnicodeError

     Unicode に関するエンコードまたはデコードのエラーが発生した際に送出
     されます。 *note ValueError: 15a. のサブクラスです。

     *note UnicodeError: 67c. はエンコードまたはデコードのエラーの説明を
     属性として持っています。例えば、 ‘err.object[err.start:err.end]’ は
     、無効な入力のうちコーデックが処理に失敗した箇所を表します。

      -- の属性: encoding

          エラーを送出したエンコーディングの名前です。

      -- の属性: reason

          そのコーデックエラーを説明する文字列です。

      -- の属性: object

          コーデックがエンコードまたはデコードしようとしたオブジェクトで
          す。

      -- の属性: start

          *note object: e51. の最初の無効なデータのインデクスです。

          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: e51. の最後の無効なデータの次のインデクスです。

          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: 67c. のサブクラスです。

 -- 例外: UnicodeDecodeError

     Unicode 関連のエラーがデコード中に発生した際に送出されます。 *note
     UnicodeError: 67c. のサブクラスです。

 -- 例外: UnicodeTranslateError

     Unicode 関連のエラーが変換中に発生した際に送出されます。 *note
     UnicodeError: 67c. のサブクラスです。

 -- 例外: ValueError

     演算子や関数が、正しい型だが適切でない値を持つ引数を受け取ったとき
     や、 *note IndexError: 18ed. のようなより詳細な例外では記述できない
     状況で送出されます。

 -- 例外: ZeroDivisionError

     除算や剰余演算の第二引数が 0 であった場合に送出されます。関連値は文
     字列で、その演算における被演算子と演算子の型を示します。

以下の例外は、過去のバージョンとの後方互換性のために残されています;
Python 3.3 より、これらは *note OSError: 543. のエイリアスです。

 -- 例外: 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: 543. のサブクラスで、システムエラーコードに
依存して送出されます。

 -- 例外: BlockingIOError

     ある操作が、ノンブロッキング操作に設定されたオブジェクト (例えばソ
     ケット) をブロックしそうになった場合に送出されます。‘errno’ *note
     EAGAIN: 2911, *note EALREADY: 2912, *note EWOULDBLOCK: 2913. および
     *note EINPROGRESS: 2914. に対応します。

     *note BlockingIOError: 4ca. は、 *note OSError: 543. の属性に加えて
     一つの属性を持ちます:

      -- の属性: 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: 82. module.

 -- 例外: ChildProcessError

     子プロセスの操作が失敗した場合に送出されます。‘errno’ *note ECHILD:
     2916. に対応します。

 -- 例外: ConnectionError

     コネクション関係の問題の基底クラス。

     サブクラスは *note BrokenPipeError: 1412, *note
     ConnectionAbortedError: 1413, *note ConnectionRefusedError: 1414,
     *note ConnectionResetError: 1415. です。

 -- 例外: BrokenPipeError

     *note ConnectionError: 11c3. のサブクラスで、もう一方の端が閉じられ
     たパイプに書き込こもうとするか、書き込みのためにシャットダウンされ
     たソケットに書き込こもうとした場合に発生します。 ‘errno’ *note
     EPIPE: 2917. と *note ESHUTDOWN: 2918. に対応します。

 -- 例外: ConnectionAbortedError

     *note ConnectionError: 11c3. のサブクラスで、接続の試行が通信相手に
     よって中断された場合に発生します。 ‘errno’ *note ECONNABORTED:
     2919. に対応します。

 -- 例外: ConnectionRefusedError

     *note ConnectionError: 11c3. のサブクラスで、接続の試行が通信相手に
     よって拒否された場合に発生します。 ‘errno’ *note ECONNREFUSED:
     291a. に対応します。

 -- 例外: ConnectionResetError

     *note ConnectionError: 11c3. のサブクラスで、接続が通信相手によって
     リセットされた場合に発生します。 ‘errno’ *note ECONNRESET: 291b. に
     対応します。

 -- 例外: FileExistsError

     すでに存在するファイルやディレクトリを作成しようとした場合に送出さ
     れます。‘errno’ *note EEXIST: 291c. に対応します。

 -- 例外: FileNotFoundError

     要求されたファイルやディレクトリが存在しない場合に送出されます。
     ‘errno’ *note ENOENT: 291d. に対応します。

 -- 例外: InterruptedError

     システムコールが入力信号によって中断された場合に送出されます。
     ‘errno’ *note EINTR: 1144. に対応します。

     バージョン 3.5 で変更: シグナルハンドラが例外を送出せず、システムコ
     ールが信号で中断された場合 Python は *note InterruptedError: 1145.
     を送出する代わりにシステムコールを再試行するようになりました (論拠
     については PEP 475(1) を参照してください) 。

 -- 例外: IsADirectoryError

     ディレクトリに (*note os.remove(): 14b1. などの) ファイル操作が要求
     された場合に送出されます。‘errno’ *note EISDIR: 291e. に対応します
     。

 -- 例外: NotADirectoryError

     ディレクトリへの操作(たとえば *note os.listdir(): 14bb.)をディレク
     トリ以外に対して要求された場合に送出されます。多くのPOSIXプラットフ
     ォームではディレクトリではないファイルをディレクトリとして開いたり
     移動するときにも発生する場合があります。‘errno’ *note ENOTDIR:
     291f. に対応します。

 -- 例外: PermissionError

     十分なアクセス権、例えばファイルシステム権限のない操作が試みられた
     場合に送出されます。‘errno’ *note EACCES: 2920.、*note EPERM: 1d73.
     および *note ENOTCAPABLE: 1d5c. に対応します。

     バージョン 3.11.1 で変更: WASIの *note ENOTCAPABLE: 1d5c. は *note
     PermissionError: 10fd. にマップされました。

 -- 例外: ProcessLookupError

     与えられたプロセスが存在しない場合に送出されます。‘errno’ *note
     ESRCH: 2921. に対応します。

 -- 例外: TimeoutError

     システム関数がシステムレベルでタイムアウトした場合に送出されます。
     ‘errno’ *note ETIMEDOUT: 2922. に対応します。

Added in version 3.3: 上記のすべての *note OSError: 543. サブクラスが追
加されました。

参考
....

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
警告カテゴリ: 2925. のドキュメントを参照してください。

 -- 例外: Warning

     警告カテゴリの基底クラスです。

 -- 例外: UserWarning

     ユーザコードによって生成される警告の基底クラスです。

 -- 例外: DeprecationWarning

     他の Python 開発者へ向けて警告を発するときの、廃止予定の機能につい
     ての警告の基底クラスです。

     ‘__main__’ モジュールを除いて( PEP 565(1))、デフォルトの警告フィル
     ターで無効化されています。*note Python Development Mode: 713. を有
     効にするとこの警告が表示されます。

     The deprecation policy is described in PEP 387(2).

 -- 例外: PendingDeprecationWarning

     古くなって将来的に廃止される予定だが、今のところは廃止されていない
     機能についての警告の基底クラスです。

     近々起こる可能性のある機能廃止について警告を発することはまれなので
     、このクラスはめったに使われず、既に決まっている廃止については
     *note DeprecationWarning: 2d4. が望ましいです。

     デフォルトの警告フィルターで無効化されています。*note Python
     Development Mode: 713. を有効にするとこの警告が表示されます。

     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: 713. を有効にするとこの警告が表示されます。

 -- 例外: UnicodeWarning

     Unicode に関連した警告の基底クラスです。

 -- 例外: EncodingWarning

     エンコーディングに関連した警告の基底クラスです。

     詳細は *note Opt-in EncodingWarning: 1b7. を参照してください。

     Added in version 3.10.

 -- 例外: BytesWarning

     *note bytes: 1d2. や *note bytearray: 1d1. に関連した警告の基底クラ
     スです。

 -- 例外: ResourceWarning

     リソースの使用に関連した警告の基底クラスです。

     デフォルトの警告フィルターで無効化されています。*note Python
     Development Mode: 713. を有効にするとこの警告が表示されます。

     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: 44e. で処
理できます。また、*note except*: 44f. によって判別でき、例外グループに含
まれている例外の型に基づいてサブグループにマッチします。

 -- 例外: ExceptionGroup (msg, excs)

 -- 例外: BaseExceptionGroup (msg, excs)

     この2つの例外型は一連の例外 ‘excs’ を包含します。‘msg’ 引数は文字列
     の必要があります。2つのクラスの異なる点は、*note BaseException:
     9bd. は *note BaseExceptionGroup: 76d. を拡張して任意の例外を含めら
     れますが、*note ExceptionGroup: 6de. は *note Exception: da2. を拡
     張して ‘Exception’ のサブクラスのみを含められます。この設計により
     ‘except Exception’ は ‘ExceptionGroup’ をキャッチしますが、
     ‘BaseExceptionGroup’ はキャッチしません。

     *note BaseExceptionGroup: 76d. のコンストラクターは含まれる例外がす
     べて *note Exception: da2. の場合は ‘BaseExceptionGroup’ ではなく
     *note ExceptionGroup: 6de. を返すように自動的に選択されます。一方
     ‘ExceptionGroup’ コンストラクタは、‘Exception’ サブクラス以外の例外
     を含む場合は *note TypeError: 29c. を送出します。

     '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: 292a,
          *note __traceback__: 1680, *note __cause__: 1682, *note
          __context__: 1681. and *note __notes__: 28f8. 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(): 1c5f. と似てますが ‘(match, rest)’ のペアを
          返します。‘match’ は ‘subgroup(condition)’ で ‘rest’ は残りの
          マッチしない部分です。

      -- メソッド: derive (excs)

          同じ *note message: 292a. の例外グループを返しますが、‘excs’ の
          例外を含んでいます。

          This method is used by *note subgroup(): 1c5f. and *note
          split(): 1b18, 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: 6de.

          *note subgroup(): 1c5f. と *note split(): 1b18. は *note
          __traceback__: 1680.、*note __cause__: 1682.、*note
          __context__: 1681. と *note __notes__: 28f8. フィールドを元の
          例外グループから *note derive(): 1c5e. が返す例外グループにコ
          ピーするため、‘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__(): 987, so
     subclasses that need a different constructor signature need to
     override that rather than *note __init__(): 306.  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: 6de, any subclass of
     ‘BaseExceptionGroup’ which is also a subclass of *note Exception:
     da2. 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
           │    └── ImportCycleError
           │    └── 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: 418. 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: 2931.

* 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: 2938. for the duration of each call.
Without such synchronization, concurrent calls may produce *note race
conditions: 2939. or *note data races: 293a.

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: 293f. or *note critical sections: 2940.) to protect
shared mutable state, so callers do not need to supply their own
locking.

Example: *note PyList_GetItemRef(): 7fa. can be called from multiple
threads on the same *note PyListObject: 2941. - 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: 2944. 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(): 67d. 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: 4e0. is *note atomic: 2944.:

     lst[i]   # list.__getitem__

The following methods traverse the list and use *note atomic: 2944.
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:
293f.  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:
293f.

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:
2944. 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: 2944.:

     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(): 7ff. method is also *note atomic: 2944.  Other
threads cannot observe elements being removed.

The *note sort(): f91. method is not *note atomic: 2944.  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: 2946. 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(): 1c80. method may allow concurrent modifications
since element comparison may execute arbitrary Python code (via *note
__eq__(): ec4.).

*note extend(): 7fe. is safe to call from multiple threads.  However,
its guarantees depend on the iterable passed to it.  If it is a *note
list: 4e0, a *note tuple: 1d9, a *note set: 432, a *note frozenset: 9d9,
a *note dict: 193. or a *note dictionary view object: 28b6. (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: 4e0. (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: 4e0.
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: 193. constructor is atomic
when the argument to it is a ‘dict’ or a *note tuple: 1d9.  When using
the *note dict.fromkeys(): 4e1. method, dictionary creation is atomic
when the argument is a ‘dict’, ‘tuple’, *note set: 432. or *note
frozenset: 9d9.

The following operations and functions are *note lock-free: 2946. and
*note atomic: 2944.

     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: 293f.

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__(): ec4, which can
execute arbitrary Python code.  During such comparisons, the dictionary
may be modified by another thread.  For built-in types like *note str:
1ea, *note int: 32e, and *note float: 32f, 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: 293f. 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(): 1975. method holds the lock for its duration.  Other
threads cannot observe elements being removed.

The following operations lock both dictionaries.  For *note update():
181d. and ‘|=’, this applies only when the other operand is a *note
dict: 193. 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__(): ec4,
so for non-built-in types the lock may be released during comparison.

*note fromkeys(): 4e1. locks both the new dictionary and the iterable
when the iterable is exactly a *note dict: 193, *note set: 432, or *note
frozenset: 9d9. (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: 193.
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(): a24. function is lock-free and *note atomic: 2944.

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__(): ec4, which can
execute arbitrary Python code.  During such comparisons, the set may be
modified by another thread.  For built-in types like *note str: 1ea,
*note int: 32e, and *note float: 32f, ‘__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__(): ec4.
considerations as above apply.

The *note copy(): 28ae. method returns a new object and holds the
per-object lock for the duration so that it is always atomic.

The *note clear(): 28b3. method holds the lock for its duration.  Other
threads cannot observe elements being removed.

The following operations only accept *note set: 432. or *note frozenset:
9d9. 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(): 28af, *note set.union(): 28a8, *note
set.intersection(): 1d9f. and *note set.difference(): 28aa. can take
multiple iterables as arguments.  They all iterate through all the
passed iterables and do the following:

        * 
          *note set.update(): 28af. and *note set.union(): 28a8. lock both objects only when

               the other operand is a *note set: 432, *note frozenset:
               9d9, or *note dict: 193.

        * 
          *note set.intersection(): 1d9f. and *note set.difference(): 28aa. always try to lock

               all objects.

*note set.symmetric_difference(): 28ac. tries to lock both objects.

The update variants of the above methods also have some differences
between them:

        * 
          *note set.difference_update(): 28b0. and *note set.intersection_update(): 183d. try

               to lock all objects one-by-one.

        * 
          *note set.symmetric_difference_update(): 183e. only locks the arguments if it is

               of type *note set: 432, *note frozenset: 9d9, or *note
               dict: 193.

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: 432. instances
across threads.  See *note Python support for free threading: 2931. 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(): a24. function is lock-free and *note atomic: 2944.

     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: 1d1.:

          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(): 175c, *note
     replace(): 287a, *note split(): 19ba, *note decode(): 2877, 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:
     1d1. instances across threads.  See *note Python support for free
     threading: 2931. 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: 1dd. 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: 1a3.  Creating and releasing a
memoryview are thread-safe.  Attribute access (e.g., *note shape: 13fc,
*note format: 13f7.) 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: 1d2, concurrent reads
     through multiple memoryviews are safe.

   * For mutable objects like *note bytearray: 1d1, 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(): 1949.) while a memoryview is exported raises *note
BufferError: 19b9.  This is enforced regardless of threading.


File: python.info,  Node: テキスト処理サービス,  Next: バイナリデータ処理,  Prev: Thread Safety Guarantees,  Up: Python 標準ライブラリ

5.7 テキスト処理サービス
========================

この章で説明するモジュールは幅広い文字列操作や様々なテキスト処理サービス
を提供しています。

*note codecs: 1c. モジュールはテキスト処理と高い関連性を持った *note
バイナリデータ処理: 294e. のなかで説明されています。加えて Python の組み
込み文字列型の *note テキストシーケンス型 -- str: 21ec. のドキュメントも
参照して下さい。

* 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: 21ec.

*note 文字列メソッド: 21ed.

* Menu:

* 文字列定数::
* Custom string formatting::
* Format string syntax::
* Template strings ($-strings): Template strings $-strings.
* ヘルパー関数::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/string/__init__.py


File: python.info,  Node: 文字列定数,  Next: Custom string formatting,  Up: string --- 一般的な文字列操作

5.7.1.1 文字列定数
..................

このモジュールで定義されている定数は以下の通りです:

 -- データ: string.ascii_letters

     後述の *note ascii_lowercase: 2952. と *note ascii_uppercase: 2953.
     を合わせたもの。この値はロケールに依存しません。

 -- データ: 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: 2954, *note
     ascii_letters: 167d, *note punctuation: 2957, and *note whitespace:
     2958.

          注釈: By design, *note string.printable.isprintable(): 1195.
          returns *note False: ef9.  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(): a17. method
described in PEP 3101(1).  The *note Formatter: 126e. 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: 126e. クラスは、以下のメソッドを持ちます:

      -- メソッド: format (format_string, /, *args, **kwargs)

          主要な API メソッドです。書式文字列と、任意の位置引数およびキ
          ーワード引数のセットを取ります。これは、*note vformat(): 295a.
          を呼び出す単なるラッパーです。

          バージョン 3.7 で変更: 書式文字列は *note 位置専用: e4b. の引
          数となりました。

      -- メソッド: vformat (format_string, args, kwargs)

          この関数はフォーマットの実際の仕事をします。この関数は、
          ‘*args’ および ‘**kwargs’ シンタックスを使用して、辞書を個々の
          引数として unpack してから再度 pack するのではなく、引数として
          あらかじめ用意した辞書を渡したい場合のために、独立した関数とし
          て公開されます。 *note vformat(): 295a. は、書式文字列を文字デ
          ータと置換フィールドに分解する仕事をします。それは、以下に記述
          する様々なメソッドを呼び出します。

     さらに、 *note Formatter: 126e. ではサブクラスによって置き換えられ
     ることを意図した次のようないくつかのメソッドが定義されています。

      -- メソッド: parse (format_string)

          format_stringを探査し、タプル、 ('literal_text', 'field_name',
          'format_spec', 'conversion') のイテラブルを返します。これは
          *note vformat(): 295a. が文字列を文字としての文字データや置換
          フィールドに展開するために使用されます。

          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(): 295a.

      -- メソッド: 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():
          295b. is done by *note vformat(): 295a. 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(): 295d.

      -- メソッド: get_value (key, args, kwargs)

          与えられたフィールドの値を取り出します。 'key' 引数は整数でも
          文字列でも構いません。整数の場合は、位置引数 'args' のインデッ
          クス番号を示します。文字列の場合は、名前付きの引数 'kwargs' を
          意味します。

          'args' 引数は、 *note vformat(): 295a. への位置引数のリストに
          設定され、 'kwargs' 引数は、キーワード引数の辞書に設定されます
          。

          フィールド名が (ピリオドで区切られた) いくつかの要素からなって
          いる場合、最初の要素のみがこれらの関数に渡されます。残りの要素
          に関しては、通常の属性またはインデックスアクセスと同様に処理さ
          れます。

          つまり、例えば、フィールドが '0.name' と表現されるとき、 *note
          get_value(): 295d. は、 'key' 引数が 0 として呼び出されます。
          属性 ‘name’ は、組み込みの *note getattr(): f93. 関数が呼び出
          され、 ‘get_value()’ が返されたのちに検索されます。

          インデックスまたはキーワードが存在しないアイテムを参照した場合
          、 *note IndexError: 18ed. または *note KeyError: 7e5. が送出
          されます。

      -- メソッド: check_unused_args (used_args, args, kwargs)

          希望に応じて未使用の引数がないか確認する機能を実装します。この
          関数への引数は、書式指定文字列で実際に参照されるすべての引数の
          キーの set (位置引数の整数、名前付き引数の文字列) と、vformat
          に渡される 'args' と 'kwargs' への参照です。使用されない引数の
          set は、これらのパラメータから計算されます。 *note
          check_unused_args(): 295e. は、確認の結果が偽である場合に例外
          を送出するものとみなされます。

      -- メソッド: format_field (value, format_spec)

          *note format_field(): 295f. は単純に組み込みのグローバル関数
          *note format(): 440. を呼び出します。このメソッドは、サブクラ
          スをオーバーライドするために提供されます。

      -- メソッド: convert_field (value, conversion)

          (*note get_field(): 295c. が返す) 値を (*note parse(): 295b. メ
          ソッドが返すタプルの形式で) 与えられた変換タイプとして変換しま
          す。デフォルトバージョンは '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(): a17. method and the *note Formatter: 126e. 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: 441. and
*note template string literals: 1a70, but it is less sophisticated and,
in particular, does not support arbitrary expressions in interpolations.

書式指定文字列は波括弧 ‘{}’ に囲まれた "置換フィールド" を含みます。波括
弧に囲まれた部分以外は全て単純な文字として扱われ、変更を加えることなく出
力へコピーされます。波括弧を文字として扱う必要がある場合は、二重にするこ
とでエスケープすることができます: ‘{{’ および ‘}}’ 。

置換フィールドの文法は以下です:

     replacement_field: "{" [*note field_name: 2963.] ["!" *note conversion: 2964.] [":" *note format_spec: 2965.] "}"
     field_name:        *note arg_name: 2966. ("." *note attribute_name: 2967. | "[" *note element_index: 2968. "]")*
     arg_name:          [*note identifier: 24d0. | *note digit: 2521.+]
     attribute_name:    *note identifier: 24d0.
     element_index:     *note digit: 2521.+ | *note index_string: 2969.
     index_string:      <any source character except "]"> +
     conversion:        "r" | "s" | "a"
     format_spec:       *note format-spec;format_spec: 296a.

もっと簡単にいうと、置換フィールドは 'field_name' で始められます。これに
よって指定したオブジェクトの値が、置換フィールドの代わりに書式化され出力
に挿入されます。'field_name' の後に、感嘆符 ‘'!'’ を挟んで 'conversion'
フィールドを続けることができます。最後にコロン ‘':'’ を挟んで、
'format_spec' を書くことができます。これは、置換される値の非デフォルトの
書式を指定します。

*note Format specification mini-language: 704. 節も参照して下さい。

'field_name' それ自身は、数かキーワードのいずれかである 'arg_name' から
始まります。それが数である場合、位置引数を参照します。また、それがキーワ
ードである場合、指定されたキーワード引数を参照します。文字列に対して
*note str.isdecimal(): 283f. を呼び出した結果が真の場合、 'arg_name' は
数として扱われます。書式文字列中で数の arg_names が順に 0, 1, 2, ...  で
ある場合、それらはすべて (いくつかではありません) 省略することができます
。そして数 0, 1, 2, ...  は、自動的にその順で挿入されます。 'arg_name' は
引用符で区切られていないので、書式文字列内の任意の辞書キー (例えば文字列
‘'10'’ や ‘':-]'’ など) を指定することはできません。 'arg_name' の後に任
意の数のインデックス式または属性式を続けることができます。 ‘'.name'’ 形
式の式は *note getattr(): f93. を使用して指定された属性を選択します。一
方、 ‘'[index]'’ 形式の式は *note __getitem__(): 78d. を使用してインデッ
クス参照を行います。

バージョン 3.1 で変更: *note str.format(): a17. を使い、位置引数指定を省
略することができます。 ‘'{} {}'.format(a, b)’ は ‘'{0} {1}'.format(a,
b)’ と同じになります。

バージョン 3.4 で変更: *note Formatter: 126e. を使い、位置引数指定を省略
することができます。

簡単な書式指定文字列の例を挙げます:

     "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__(): a15. によって実施されます。
しかしながら、場合によっては、文字列として変換することを強制したり、書式
指定の定義をオーバーライドしたくなることもあります。 ‘__format__()’ の呼
び出し前に値を文字列に変換すると、通常の書式変換の処理は飛ばされます。

現在 3つの変換フラグがサポートされています: 値に対して *note str(): 1ea.
を呼ぶ ‘'!s'’ 、 *note repr(): 462. を呼ぶ ‘'!r'’ 、 *note ascii():
179f. を呼ぶ ‘'!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 書式指定例: 296c. のいくつかの例も参照して下さい。

* 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: 1754, *note f-strings: 441, and *note
t-strings: 1a70.).  They can also be passed directly to the built-in
*note format(): 440. function.  Each formattable type may define how the
format specification is to be interpreted.

多くの組み込み型は、書式指定に関して以下のオプションを実装します。しかし
ながら、いくつかの書式指定オプションは数値型でのみサポートされます。

一般的な取り決めとして、空の書式指定は、値に対して *note str(): 1ea. を
呼び出したときと同じ結果を与えます。通常、空でない書式指定はその結果を変
更します。

一般的な書式指定子 ('standard format specifier') の書式は以下です:

     format_spec:             [*note options: 296e.][*note width_and_precision: 296f.][*note type: 2970.]
     options:                 [[*note fill: 2971.]*note align: 2972.][*note sign: 2973.]["z"]["#"]["0"]
     fill:                    <any character>
     align:                   "<" | ">" | "=" | "^"
     sign:                    "+" | "-" | " "
     width_and_precision:     [*note width_with_grouping: 2974.][*note precision_with_grouping: 2975.]
     width_with_grouping:     [*note width: 2976.][*note grouping: 2977.]
     precision_with_grouping: "." [*note precision: 2978.][*note grouping: 2977.] | "." *note grouping: 2977.
     width:                   *note digit: 2521.+
     precision:               *note digit: 2521.+
     grouping:                "," | "_"
     type:                    "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g"
                              | "G" | "n" | "o" | "s" | "x" | "X" | "%"

有効な 'align' 値を指定する場合、その前に 'fill' 文字を付けることができ
ます。 この文字には任意の文字を指定でき、省略された場合はデフォルトの空
白文字となります。 *note formatted string literal: 441. の中や *note
str.format(): a17. メソッドを使う場合はリテラルの波括弧 ("‘{’" と "‘}’")
を 'fill' 文字として使えないことに注意してください。 ただし、波括弧を入
れ子になった置換フィールド内に挿入することはできます。 この制限は *note
format(): 440. 関数には影響しません。

様々な 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: 330.  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: 330.  This is equivalent to a 'fill'
character of ‘'0'’ with an 'alignment' type of ‘'='’.

バージョン 3.10 で変更: 'width' フィールドに ‘'0'’ を前置することは、文
字列に対するデフォルトの整列に影響を与えなくなりました。

'precision' は、表現型 ‘'f'’ または ‘'F'’ の場合小数点以下、表現型 ‘'g'’
または ‘'G'’ の場合は小数点以上と以下が何桁で表示されるべきかを示す10進
整数です。文字列の表現型の場合は最大フィールド幅、言い換えるとフィールド
の内容から何文字が使用されるかを示します。'precision' は整数の表現型には
使用できません。

The 'grouping' option after 'width' and 'precision' fields specifies a
digit group separator for the integral and fractional parts of a number
respectively.  It can be one of the following:

オプション    意味
              
-----------------------------------------------------------------------------
              
‘','’         Inserts a comma every 3 digits for integer presentation type
              ‘'d'’ and floating-point presentation types, excluding
              ‘'n'’.  For other presentation types, this option is not
              supported.
              
              
‘'_'’         Inserts an underscore every 3 digits for integer
              presentation type ‘'d'’ and floating-point presentation
              types, excluding ‘'n'’.  For integer presentation types
              ‘'b'’, ‘'o'’, ‘'x'’, and ‘'X'’, underscores are inserted
              every 4 digits.  For other presentation types, this option
              is not supported.
              

For a locale aware separator, use the ‘'n'’ presentation type instead.

バージョン 3.1 で変更: ‘','’ オプションが追加されました ( PEP 378(2) も
参照)。

バージョン 3.6 で変更: ‘'_'’ オプションが追加されました ( PEP 515(3) も
参照)。

バージョン 3.14 で変更: Support the 'grouping' option for the fractional
part.

最後に、'type' は、データがどのように表現されるかを決定します。

利用可能な文字列の表現型は以下です:

     型            意味
                   
     -----------------------------------------------------------------------------
                   
     ‘'s'’         文字列。これがデフォルトの値で、多くの場合省略されます。
                   
                   
     None          ‘'s'’ と同じです。
                   

利用可能な整数の表現型は以下です:

     型            意味
                   
     -----------------------------------------------------------------------------
                   
     ‘'b'’         2進数。出力される数値は2を基数とします。
                   
                   
     ‘'c'’         文字。数値を対応する Unicode 文字に変換します。
                   
                   
     ‘'d'’         10進数。出力される数値は10を基数とします。
                   
                   
     ‘'o'’         8進数。出力される数値は8を基数とします。
                   
                   
     ‘'x'’         16進数。出力される数値は16を基数とします。 10進で9を超える数
                   字には小文字が使われます。
                   
                   
     ‘'X'’         16進数。出力される数値は16を基数とします。10進で9を超える数
                   字には大文字が使われます。‘'#'’ が指定された場合、接頭辞
                   ‘'0x'’ も大文字 ‘'0X'’ になります
                   
                   
     ‘'n'’         Number.  This is the same as ‘'d'’, except that it uses the
                   current locale setting to insert the appropriate digit group
                   separators.
                   
                   
     None          ‘'d'’ と同じです。
                   

これらの表現型に加えて、整数は (‘'n'’ と ‘None’ を除く) 以下の浮動小数点
数の表現型で書式指定できます。 そうすることで整数は書式変換される前に
*note float(): 32f. を使って浮動小数点数に変換されます。

利用可能な *note float: 32f. と *note Decimal: 1cd. の表現型は以下です:

     型            意味
                   
     -----------------------------------------------------------------------------
                   
     ‘'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: 32f, and shows all coefficient digits
                   for *note Decimal: 1cd.  If ‘p=0’, the decimal point is
                   omitted unless the ‘#’ option is used.
                   
                   For *note float: 32f, 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: 32f, and uses a precision large enough to show
                   all coefficient digits for *note Decimal: 1cd.  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: 1cd. に対しては
                   -6 です。それ以外の場合、数値は書式 ‘'e'’ 型および精度 ‘p-1’
                   桁でフォーマットされます。どちらの場合でも、仮数部の有効でな
                   い末尾のゼロは取り除かれます。また小数点以下に表示する桁が無
                   い場合、 ‘'#'’ オプションが使われた場合をのぞき、小数点は除
                   去されます。
                   
                   精度が指定されない場合、 *note float: 32f. に対しては有効桁
                   数として ‘6’ 桁を適用します。 *note Decimal: 1cd. では、フォ
                   ーマット結果の係数部は実際の値の桁数によって決まります; 絶対
                   値が ‘1e-6’ より小さい値や、最下位桁の値が1より大きい値では
                   科学的表記が使われます。それ以外の場合は固定小数点表記が使わ
                   れます。
                   
                   正と負の無限大と 0 および NaN は精度に関係なくそれぞれ
                   ‘inf’, ‘-inf’, ‘0’, ‘-0’ および ‘nan’ となります。
                   
                   
     ‘'G'’         汎用フォーマットです。数値が大きくなったとき、 ‘'E'’ に切り
                   替わることを除き、 ‘'g'’ と同じです。無限大と NaN の表示も大
                   文字になります。
                   
                   
     ‘'n'’         Number.  This is the same as ‘'g'’, except that it uses the
                   current locale setting to insert the appropriate digit group
                   separators for the integral part of a number.
                   
                   
     ‘'%'’         パーセンテージです。数値は 100 倍され、固定小数点数フォーマ
                   ット (‘'f'’) でパーセント記号付きで表示されます。
                   
                   
     None          For *note float: 32f. 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: 1cd. に対しては、現在の decimal コンテキスト
                   における ‘context.capitals’ の値に応じて、 ‘'g'’ か ‘'G'’ の
                   どちらかと同じになります。
                   
                   全体として、他の書式修正指定によって変更された
                   *note str(): 1ea. の出力に一致するような結果になります。
                   

The result should be correctly rounded to a given precision ‘p’ of
digits after the decimal point.  The rounding mode for *note float: 32f.
matches that of the *note round(): 1694. builtin.  For *note Decimal:
1cd, the rounding mode of the current *note context: 2979. will be used.

The available presentation types for *note complex: 330. are the same as
those for *note float: 32f. (‘'%'’ 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(): 1ea. (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(): a17. 構文の例を紹介し、さらに従来の
‘%’-書式と比較します。

多くの場合、新構文に ‘{}’ を加え、 ‘%’ の代わりに ‘:’ を使うことで、古い
‘%’-書式に類似した書式になります。例えば、‘'%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(): a17, *note formatted string literals:
     441, and *note template string literals: 297d.

     It is unrelated to template string literals (t-strings), which were
     introduced in Python 3.14.  These evaluate to *note
     string.templatelib.Template: 41c. objects, found in the *note
     string.templatelib: dc. module.

テンプレート文字列では PEP 292(1) で解説されている単純な文字列置換ができ
ます。 テンプレート文字列の主な使い道は国際化 (i18n) です。というのは、
その国際化の文脈において、より簡潔な文法と機能を持つテンプレート文字列を
使うと、 Python にある他の組み込みの文字列フォーマット機能よりも翻訳がし
やすいからです。 テンプレート文字列の上に構築された国際化のためのライプ
ラリの例として、 flufl.i18n(2) を調べてみてください。

テンプレート文字列は ‘$’ に基づいた置換をサポートしていて、次の規則が使
われています:

   * ‘$$’ はエスケープ文字です; ‘$’ 一つに置換されます。

   * ‘$identifier’ は ‘"identifier"’ のマッピングキーに合致する置換プレ
     ースホルダーを指定します。デフォルトでは、 ‘"identifier"’ は大文字
     と小文字を区別しない ASCII 英数字 (アンダースコアを含む) からなら文
     字列に制限されています。文字列はアンダースコアか ASCII 文字から始ま
     るものでなければなりません。‘$’ の後に識別子に使えない文字が出現す
     ると、そこでプレースホルダ名の指定が終わります。

   * ‘${identifier}’ は ‘$identifier’ と同じです。プレースホルダ名の後ろ
     に識別子として使える文字列が続いていて、それをプレースホルダ名の一
     部として扱いたくない場合、例えば ‘"${noun}ification"’ のような場合
     に必要な書き方です。

上記以外の書き方で文字列中に ‘$’ を使うと *note ValueError: 15a. を送出
します。

The ‘string’ module provides a *note Template: a7c. 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(): 22e3. と同じですが、プレースホルダに対応す
          るものを 'mapping' や 'kwds' から見つけられなかった場合に、
          *note KeyError: 7e5. 例外を送出する代わりにもとのプレースホル
          ダがそのまま入ります。また、 ‘substitute()’ とは違い、規則外の
          書き方で ‘$’ を使った場合でも、 *note ValueError: 15a. を送出
          せず単に ‘$’ を返します。

          その他の例外も発生し得る一方で、このメソッドが「安全 (safe) 」
          と呼ばれているのは、置換操作は常に、例外を送出する代わりに利用
          可能な文字列を返そうとするからです。別の見方をすれば、 *note
          safe_substitute(): 22e4. は区切り間違いによるぶら下がり
          (dangling delimiter) や波括弧の非対応、 Python の識別子として
          無効なプレースホルダ名を含むような不正なテンプレートを何も警告
          せずに無視するため、安全とはいえないのです。

      -- メソッド: is_valid ()

          Returns ‘False’ if the template has invalid placeholders that
          will cause *note substitute(): 22e3. to raise *note
          ValueError: 15a.

          Added in version 3.11.

      -- メソッド: get_identifiers ()

          テンプレート内の有効な識別子のリストを、その識別子が最初に現れ
          る順番で返します。不正な識別子は無視されます。

          Added in version 3.11.

     *note Template: a7c. のインスタンスは、次のような 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: a7c. のサブクラスを派生して、プレー
スホルダの書式、区切り文字、テンプレート文字列の解釈に使われている正規表
現全体をカスタマイズできます。こうした作業には、以下のクラス属性をオーバ
ライドします:

   * 'delimiter' - プレースホルダの開始を示すリテラル文字列です。 デフォ
     ルトの値は ‘$’ です。 実装系はこの文字列に対して必要に応じて *note
     re.escape(): fcc. を呼び出すので、正規表現になってしまうような文字
     列にしては 'なりません' 。 さらにクラスを作成した後に 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: 15a. を送出
します。

   ---------- 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(): 125e. を使って引数を単語に分割し、 *note
     str.capitalize(): 2850. を使ってそれぞれの単語の先頭の文字を大文字
     に変換し、 *note str.join(): 2821. を使ってつなぎ合わせます。オプシ
     ョンの第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 フォーマット済み文字列リテラル: 441.

   * *note テンプレート文字列リテラル(t-string)の構文: 1a70.

   * PEP 750(2)

* Menu:

* テンプレート文字列::
* 型::
* ヘルパー関数: ヘルパー関数<2>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: 441, but return a
*note Template: 41c. 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: 1a70.  This syntax is
     identical to that of *note f-strings: 441, 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: 2985.
     and dynamic *note interpolations: 2986.  A *note values: 2987.
     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: 1d9.[*note str: 1ea, ...]

          A *note tuple: 1d9. 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: 1d9.[*note Interpolation:
               41d, ...]

          A *note tuple: 1d9. 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: 1d9.[*note object: e51, ...]

          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: 2985.
          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: 2985. 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: 41d. 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: 1df.:

          >>> from string.templatelib import Interpolation
          >>> interpolation = t'{1. + 2.:.2f}'.interpolations[0]
          >>> interpolation
          Interpolation(3.0, '1. + 2.', None, '.2f')
          >>> match interpolation:
          ...     case Interpolation(value, expression, conversion, format_spec):
          ...         print(value, expression, conversion, format_spec, sep=' | ')
          ...
          3.0 | 1. + 2. | None | .2f

     属性
     ....

      -- の属性: value: *note object: e51.

          The evaluated value of the interpolation.

               >>> t'{1 + 2}'.interpolations[0].value
               3

      -- の属性: expression: *note str: 1ea.

          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: c31.['a', 'r', 's'] | *note
               None: a6a.

          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(): 298b. function can be
               used to mimic f-string conversion semantics.

      -- の属性: format_spec: *note str: 1ea.

          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(): 440.
               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: 1754. to be used,
               one of ‘None’, ‘'a'’, ‘'r'’, or ‘'s'’.

             * ‘format_spec’ - An optional, arbitrary string used as the
               *note format specification: 704. 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: 296b. 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(): 1ea. on the value (like ‘!s’),

        * ‘'r'’ which calls *note repr(): 462. (like ‘!r’), and

        * ‘'a'’ which calls *note ascii(): 179f. (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: 1ea.) や
8 ビット文字列 (*note bytes: 1d2.) を使います。ただし、Unicode 文字列と
8 ビット文字列の混在はできません。つまり、Unicode 文字列にバイト列のパタ
ーンでマッチングしたり、その逆はできません。同様に、置換時の置換文字列は
パターンおよび検索文字列の両方と同じ型でなくてはなりません。

正規表現では、特殊な形式を表すためや、特殊文字をその特殊な意味を発動させ
ず使うために、バックスラッシュ文字 (‘'\'’) を使います。こうしたバックス
ラッシュの使い方は、 Python の文字列リテラルにおける同じ文字の使い方と衝
突します。例えば、リテラルのバックスラッシュにマッチさせるには、パターン
文字列として ‘'\\\\'’ と書かなければなりません。なぜなら、正規表現は
‘\\’ でなければならないうえ、それぞれのバックスラッシュは標準の Python 文
字列リテラルで ‘\\’ と表現せねばならないからです。 Python の文字列リテラ
ルにおいて、バックスラッシュの使用による不正なエスケープ文字がある場合は
、*note SyntaxWarning: 451. が発生し、将来的には *note SyntaxError: 189.
になることにも注意してください。この動作は、正規表現として有効な文字列に
対しても同様です。

これを解決するには、正規表現パターンに Python の raw 文字列記法を使いま
す。 ‘'r'’ を前置した文字列リテラル内ではバックスラッシュが特別扱いされ
ません。従って ‘"\n"’ が改行一文字からなる文字列であるのに対して、
‘r"\n"’ は ‘'\'’ と ‘'n'’ の二文字からなる文字列です。通常、 Python コー
ド中では、パターンをこの raw 文字列記法を使って表現します。

重要なこととして、大抵の正規表現操作は、モジュールレベルの関数としても、
*note コンパイル済み正規表現: 1336. のメソッドとしても利用できます。関数
は正規表現オブジェクトを前もってコンパイルする必要がない近道ですが、微調
整のための変数が減ります。

参考
....

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::
* モジュールの内容::
* Regular expression objects::
* Match objects::
* Regular expression examples::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/re/

   (2) https://pypi.org/project/regex/


File: python.info,  Node: Regular expression syntax,  Next: モジュールの内容,  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]: 2993. か、コンパイラの構築に関するテキスト
を参照してください。

以下で正規表現の形式を簡単に説明します。詳細な情報ややさしい説明は、
*note Regular expression HOWTO: 2994. を参照してください。

正規表現には、特殊文字と通常文字の両方を含められます。 ‘'A'’ 、 ‘'a'’ 、
または ‘'0'’ のようなほとんどの通常文字は、最も単純な正規表現です。これ
は単純に、その文字自体にマッチします。通常文字は連結できるので、 ‘last’
は文字列 ‘'last'’ にマッチします。 (この節では以降、正規表現は一般にクオ
ートを使わず ‘この特殊スタイルで’ 表記し、マッチ対象の文字列は、 ‘'シン
グルクオートで括って'’ 表記します。)

‘'|'’ や ‘'('’ といったいくつかの文字は特殊です。特殊文字は通常文字の種
別を表したり、周辺の通常文字に対する解釈方法に影響します。

繰り返しの演算子または修飾子 (‘*’、 ‘+’、 ‘?’、 ‘{m,n}’ など) は直接入れ
子にはできません。これは、非貪欲な修飾子の接尾辞 ‘?’ や他の実装での他の
修飾子との曖昧さを回避します。内側で繰り返したものをさらに繰り返すには、
丸括弧が使えます。例えば、正規表現 ‘(?:a{6})*’ は 6 の倍数個の ‘'a'’ 文
字にマッチします。

特殊文字を以下に示します:

‘.’

     (ドット) デフォルトのモードでは改行以外の任意の文字にマッチします。
     *note DOTALL: 2995. フラグが指定されていれば改行も含む全ての文字に
     マッチします。‘(?s:.)’ はフラグにかかわらず全ての文字にマッチします
     。

‘^’

     (キャレット) 文字列の先頭にマッチし、 *note MULTILINE: 2996. モード
     では各改行の直後にもマッチします。

‘$’

     文字列の末尾、あるいは文字列の末尾の改行の直前にマッチし、 *note
     MULTILINE: 2996. モードでは改行の前にもマッチします。 ‘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’ attempts 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: 84d. が送出されます。これはリテラル ‘'['’
          で始まる集合や、リテラル文字の連続 ‘'--'’ 、 ‘'&&'’ 、 ‘'~~'’
          および ‘'||'’ を含む集合を含みます。警告を避けるにはバックスラ
          ッシュでエスケープしてください。

     バージョン 3.7 で変更: 文字セットが将来意味論的に変化する構造を含む
     なら *note FutureWarning: 84d. が送出されます。

‘|’

     '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: 2997. (ASCIIのみにマッチ)

        * *note re.I: 2998. (大文字小文字を無視)

        * *note re.L: 2999. (ロケール依存)

        * *note re.M: 299a. (マルチライン)

        * *note re.S: 299b. (ドットはすべてにマッチ)

        * *note re.U: 299c. (Unicodeマッチ)

        * *note re.X: 299d. (冗長)

     (The flags are described in *note モジュールの内容: 299e.)  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(): f97. 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: 2997. (ASCIIのみにマッチ)

        * *note re.I: 2998. (大文字小文字を無視)

        * *note re.L: 2999. (ロケール依存)

        * *note re.M: 299a. (マルチライン)

        * *note re.S: 299b. (ドットはすべてにマッチ)

        * *note re.U: 299c. (Unicodeマッチ)

        * *note re.X: 299d. (冗長)

     (The flags are described in *note モジュールの内容: 299e.)

     文字 ‘'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: 1d2. パターンでは
     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: 1d2. パターンではグループの '名
     前' に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():
     258. 関数ではなく *note search(): 15e8. 関数を使う方が望ましいでし
     ょう:

          >>> 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: 1d2. パターンではグループの '名前' に
     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: a22. flag.  Word boundaries are determined by the
     current locale if the *note LOCALE: f2d. 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: a22.
     フラグを使って変更できます。 *note LOCALE: f2d. フラグが使われてい
     るなら単語の境界は現在のロケールによって決定されます。

     バージョン 3.14 で変更: ‘\B’ now matches empty input string.

‘\d’

     Unicode (str) パターンでは:

          任意の Unicode 10 進数字 (Unicode 文字カテゴリ [Nd](2))にマッ
          チします。これは ‘[0-9]’ とその他多数の数字を含みます。

          *note ASCII: a22. フラグを使用すると ‘[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: a22. フラグを使用すると ‘[^0-9]’ にマッチします。

‘\s’

     Unicode (str) パターンでは:

          Matches Unicode whitespace characters (as defined by *note
          str.isspace(): 284b.).  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: a22. フラグを使用すると ‘[ \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: a22. フラグを使用すると ‘[^ \t\n\r\f\v]’ にマッチしま
     す。

‘\w’

     Unicode (str) パターンでは:

          Matches Unicode word characters; this includes all Unicode
          alphanumeric characters (as defined by *note str.isalnum():
          2843.), as well as the underscore (‘_’).

          *note ASCII: a22. フラグを使用すると ‘[a-zA-Z0-9_]’ にマッチし
          ます。

     8 ビット (bytes) パターンでは:

          ASCII 文字セットで英数字と見なされる文字にマッチします。これは
          ‘[a-zA-Z0-9_]’ と等価です。*note LOCALE: f2d. フラグが使われて
          いるなら、現在のロケールで英数字と見なされる文字およびアンダー
          スコアにマッチします。

‘\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(): 2843. returns ‘False’.

     *note ASCII: a22. フラグを使用すると ‘[^a-zA-Z0-9_]’ にマッチします
     。

     If the *note LOCALE: f2d. 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 エスケープシーケンス:
879. のほとんども正規表現パーザで受理されます:

     \a      \b      \f      \n
     \N      \r      \t      \u
     \U      \v      \x      \\

(‘\b’ は単語の境界を表すのに使われ、文字クラス中でのみ "後退
(backspace)" 文字を意味することに注意してください。)

‘'\u'’、‘'\U'’ および ‘'\N'’ エスケープシーケンスは、Unicode (str)パター
ン内でのみ認識されます。バイト列ではエラーとなります。ASCII 文字のエスケ
ープで未知のものは将来使うために予約されていて、エラーとして扱われます。

8 進エスケープは限られた形式でのみ含まれます。その最初の桁が 0 であるか
、それが 3 桁の 8 進数であるならば、それは 8 進エスケープと見なされます
。そうでなければ、それはグループ参照です。文字列リテラルでは、8 進エスケ
ープは常にたかだか 3 桁長です。

バージョン 3.3 で変更: ‘'\u'’ と ‘'\U'’ エスケープシーケンスが追加されま
した。

バージョン 3.6 で変更: ‘'\'’ と ASCII 文字からなる未知のエスケープはエラ
ーになります。

バージョン 3.8 で変更: ‘'\N{NAME}'’ エスケープシーケンスが追加されました
。文字列リテラルでは、同名のUnicode 文字に展開されます。(‘'\N{EM DASH}'’
など)

   ---------- Footnotes ----------

   (1) https://unicode.org/reports/tr18/

   (2) https://www.unicode.org/versions/Unicode15.0.0/ch04.pdf#G134153


File: python.info,  Node: モジュールの内容,  Next: Regular expression objects,  Prev: Regular expression syntax,  Up: re --- 正規表現操作

5.7.3.2 モジュールの内容
........................

このモジュールはいくつかの関数、定数、例外を定義します。このうちいくつか
の関数は、コンパイル済み正規表現がそなえる完全な機能のメソッドを簡易にし
たものです。些細なものを除くほとんどのアプリケーションは常にコンパイル済
み形式を使います。

* Menu:

* フラグ::
* 関数: 関数<2>.
* 例外: 例外<3>.


File: python.info,  Node: フラグ,  Next: 関数<2>,  Up: モジュールの内容

5.7.3.3 フラグ
..............

バージョン 3.6 で変更: フラグ定数は、*note enum.IntFlag: 1061. のサブク
ラスである *note RegexFlag: a23. のインスタンスになりました。

 -- クラス: re.RegexFlag

     An *note enum.IntFlag: 1061. 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: 299c. 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: f2e. 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: a22. flag is used
     to disable non-ASCII matches.  The current locale does not change
     the effect of this flag unless the *note LOCALE: f2d. flag is also
     used.

     インラインフラグの ‘(?i)’ に相当します。

     Unicode パターン ‘[a-z]’ または ‘[A-Z]’ が *note IGNORECASE: 1cba.
     フラグとあわせて使われたとき、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: a22. フラグが使われているなら、文字
     '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: f2d. はバイト列パターンにのみ
     使え、*note ASCII: a22. と互換ではありません。

     バージョン 3.7 で変更: *note LOCALE: f2d. フラグがあるコンパイル済
     み正規表現オブジェクトはコンパイル時のロケールに依存しなくなりまし
     た。マッチング時のロケールのみがマッチングの結果に影響します。

 -- データ: 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(pattern, text, flag=re.NOFLAG):
              return re.search(pattern, 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: a22. to restrict matching to ASCII characters
     instead.

 -- データ: re.X
 -- データ: re.VERBOSE

     このフラグは正規表現を、パターンの論理的な節を視覚的に分割し、コメ
     ントを加えることで、見た目よく読みやすく書けるようにします。パター
     ン中の空白は、文字クラス中にあるときと、エスケープされていないバッ
     クスラッシュの後にあるときと、 ‘*?’ 、 ‘(?:’ や ‘(?P<...>’ のような
     トークン中を除いて無視されます。たとえば、 ‘(? :’ and ‘* ?’ は許さ
     れません。ある行が文字クラス中でもエスケープされていないバックスラ
     ッシュの後でもない ‘#’ を含むなら、一番左のそのような ‘#’ から行末
     までの全ての文字は無視されます。

     つまり、10 進数字にマッチする下記のふたつの正規表現オブジェクトは、
     機能的に等価です:

          a = re.compile(r"""\d +  # the integral part
                             \.    # the decimal point
                             \d *  # some fractional digits""", re.X)
          b = re.compile(r"\d+\.\d*")

     インラインフラグの ‘(?x)’ に相当します。


File: python.info,  Node: 関数<2>,  Next: 例外<3>,  Prev: フラグ,  Up: モジュールの内容

5.7.3.4 関数
............

 -- の関数: re.compile (pattern, flags=0)

     Compile a regular expression pattern into a *note regular
     expression object: 1336, which can be used for matching using its
     *note prefixmatch(): 257, *note search(): 29a6, 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: 29a1. variables,
     combined using bitwise OR (the ‘|’ operator).

     シーケンス

          prog = re.compile(pattern)
          result = prog.search(string)

     は、以下と同等です

          result = re.search(pattern, string)

     が、 *note re.compile(): f97. を使い、結果の正規表現オブジェクトを
     保存して再利用するほうが、一つのプログラムでその表現を何回も使うと
     きに効率的です。

          注釈: *note re.compile(): f97. やモジュールレベルのマッチング
          関数に渡された最新のパターンはコンパイル済みのものがキャッシュ
          されるので、一度に正規表現を少ししか使わないプログラムでは正規
          表現をコンパイルする必要はありません。

 -- の関数: re.search (pattern, string, flags=0)

     'string' 全体を走査して、正規表現 'pattern' がマッチを発生する最初
     の位置を探して、対応する *note Match: 1089. を返します。もし文字列
     内に、そのパターンとマッチする位置がないならば、 ‘None’ を返します
     ；これは、文字列内のある点で長さゼロのマッチを探すこととは異なるこ
     とに注意して下さい。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 29a1. variables,
     combined using bitwise OR (the ‘|’ operator).

 -- の関数: re.prefixmatch (pattern, string, flags=0)

     もし 'string' の先頭で 0 個以上の文字が正規表現 'pattern' とマッチ
     すれば、対応する *note Match: 1089. を返します。もし文字列がパター
     ンとマッチしなければ、 ‘None’ を返します；これは長さゼロのマッチと
     は異なることに注意して下さい。

          注釈: Even in *note MULTILINE: 2996. mode, this will only
          match at the beginning of the string and not at the beginning
          of each line.

     'string' 中のどこででもマッチさせたいなら、代わりに *note search():
     15e8. を使ってください (*note search() vs.  prefixmatch(): 29a7. も
     参照してください)。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 29a1. variables,
     combined using bitwise OR (the ‘|’ operator).

     This function now has two names and has long been known as *note
     match(): 258.  Use that name when you need to retain compatibility
     with older Python versions.

     Added in version 3.15.

 -- の関数: re.match (pattern, string, flags=0)

     *note Soft deprecated: 1b2. since version 3.15: *note match(): 258.
     has been soft deprecated in favor of the alternate *note
     prefixmatch(): 256. name of this API which is more explicitly
     descriptive.  Use it to better express intent.  The norm in other
     languages and regular expression implementations is to use the term
     'match' to refer to the behavior of what Python has always called
     *note search(): 15e8.  See *note prefixmatch() vs.  match(): 305.

 -- の関数: re.fullmatch (pattern, string, flags=0)

     'string' 全体が正規表現 'pattern' にマッチするなら、対応する *note
     Match: 1089. を返します。文字列がパターンにマッチしないなら ‘None’
     を返します。これは長さ 0 のマッチとは異なることに注意して下さい。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 29a1. 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: 29a1. 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: 7a9.

 -- の関数: 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: 29a1. variables,
     combined using bitwise OR (the ‘|’ operator).

     バージョン 3.7 で変更: 空でないマッチが前の空マッチの直後から始めら
     れるようになりました。

 -- の関数: re.finditer (pattern, string, flags=0)

     'string' 中の正規表現 'pattern' の重複しないマッチ全てに渡る *note
     Match: 1089. オブジェクトを yield する *note イテレータ: 6d4. を返
     します。 'string' は左から右へ走査され、マッチは見つかった順で返さ
     れます。空マッチは結果に含まれます。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 29a1. 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: 1089. 引数を取り
     、置換文字列を返します。例えば:

          >>> 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: 196e. でも構いません。

     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: 29a1. 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: 1d2. 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: 7a9.

 -- の関数: re.subn (pattern, repl, string, count=0, flags=0)

     *note sub(): 7a7. と同じ操作を行いますが、タプル ‘(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: 29a1. 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():
     7a7. および *note subn(): 7a8. における置換文字列に使われてはなりま
     せん。例えば:

          >>> digits_re = r'\d+'
          >>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'
          >>> print(re.sub(digits_re, digits_re.replace('\\', r'\\'), sample))
          /usr/sbin/sendmail - \d+ errors, \d+ warnings

     バージョン 3.3 で変更: ‘'_'’ 文字がエスケープされなくなりました。

     バージョン 3.7 で変更: 正規表現で特別な意味を持つ文字だけがエスケー
     プされます。結果として、 ‘'!'’、 ‘'"'’、 ‘'%'’、 ‘"'"’、 ‘','’、
     ‘'/'’、 ‘':'’、 ‘';'’、 ‘'<'’、 ‘'='’、 ‘'>'’、 ‘'@'’、 と ‘"`"’ は
     もはやエスケープされません。

 -- の関数: re.purge ()

     正規表現キャッシュをクリアします。


File: python.info,  Node: 例外<3>,  Prev: 関数<2>,  Up: モジュールの内容

5.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: モジュールの内容,  Up: re --- 正規表現操作

5.7.3.6 Regular expression objects
..................................

 -- クラス: re.Pattern

     Compiled regular expression object returned by *note re.compile():
     f97.

     バージョン 3.9 で変更: *note re.Pattern: 196e. supports ‘[]’ to
     indicate a Unicode (str) or bytes pattern.  See *note
     ジェネリックエイリアス型: aa4.

 -- メソッド: Pattern.search (string[, pos[, endpos]])

     'string' 全体を走査して、この正規表現がマッチを発生する最初の位置を
     探して、対応する *note Match: 1089. を返します。もし文字列内に、そ
     のパターンとマッチする位置がないならば、 ‘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.prefixmatch (string[, pos[, endpos]])

     もし 'string' の先頭で 0 個以上の文字がこの正規表現とマッチすれば、
     対応する *note Match: 1089. を返します。もし文字列がパターンとマッ
     チしなければ、 ‘None’ を返します；これは長さゼロのマッチとは異なる
     ことに注意して下さい。

     Note that even in *note MULTILINE: 2996. mode, this will only match
     at the beginning of the string and not at the beginning of each
     line.

     オプションの 'pos' および 'endpos' 引数は *note search(): 29a6. メ
     ソッドのものと同じ意味です。

          >>> pattern = re.compile("o")
          >>> pattern.prefixmatch("dog")     # No match as "o" is not at the start of "dog".
          >>> pattern.prefixmatch("dog", 1)  # Match as "o" is the 2nd character of "dog".
          <re.Match object; span=(1, 2), match='o'>

     'string' 中のどこででもマッチさせたいなら、代わりに *note search():
     29a6. を使ってください (*note search() vs.  prefixmatch(): 29a7. も
     参照してください)。

     This method now has two names and has long been known as *note
     match(): 259.  Use that name when you need to retain compatibility
     with older Python versions.

     Added in version 3.15.

 -- メソッド: Pattern.match (string[, pos[, endpos]])

     *note Soft deprecated: 1b2. since version 3.15: ‘match()’ has been
     soft deprecated in favor of the alternate *note prefixmatch(): 257.
     name of this API which is more explicitly descriptive.  Use it to
     better express intent.  The norm in other languages and regular
     expression implementations is to use the term 'match' to refer to
     the behavior of what Python has always called *note search(): 29a6.
     See *note prefixmatch() vs.  match(): 305.

 -- メソッド: Pattern.fullmatch (string[, pos[, endpos]])

     'string' 全体がこの正規表現にマッチするなら、対応する *note Match:
     1089. を返します。文字列がパターンにマッチしないなら ‘None’ を返し
     ます。これは長さ 0 のマッチとは異なることに注意して下さい。

     オプションの 'pos' および 'endpos' 引数は *note search(): 29a6. メ
     ソッドのものと同じ意味です。

          >>> 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(): 7a6. 関数にこのコンパイル済みパターンを使うのと同じ
     です。

 -- メソッド: Pattern.findall (string[, pos[, endpos]])

     *note findall(): 13d6. 関数にこのコンパイル済みパターンを使うのと似
     ていますが、オプションの 'pos' および 'endpos' 引数で *note
     search(): 15e8. のように検索範囲を制限できます。

 -- メソッド: Pattern.finditer (string[, pos[, endpos]])

     *note finditer(): 18b2. 関数にこのコンパイル済みパターンを使うのと
     似ていますが、オプションの 'pos' および 'endpos' 引数で *note
     search(): 15e8. のように検索範囲を制限できます。

 -- メソッド: Pattern.sub (repl, string, count=0)

     *note sub(): 7a7. 関数にこのコンパイル済みパターンを使うのと同じで
     す。

 -- メソッド: Pattern.subn (repl, string, count=0)

     *note subn(): 7a8. 関数にこのコンパイル済みパターンを使うのと同じで
     す。

 -- の属性: Pattern.flags

     正規表現のマッチングフラグです。これは *note compile(): f97. に与え
     られたフラグ、パターン中の ‘(?...)’ インラインフラグ、およびパター
     ンが Unicode 文字列だった時の *note UNICODE: f2e. のような暗黙のフ
     ラグの組み合わせです。

 -- の属性: Pattern.groups

     パターン中のキャプチャグループの数です。

 -- の属性: Pattern.groupindex

     ‘(?P<id>)’ で定義されたあらゆるシンボリックグループ名をグループ番号
     へ写像する辞書です。シンボリックグループがパターン中で全く使われて
     いなければ、この辞書は空です。

 -- の属性: Pattern.pattern

     パターンオブジェクトがコンパイルされた元のパターン文字列です。

バージョン 3.7 で変更: *note copy.copy(): 947. および *note
copy.deepcopy(): f2f. をサポートするようになりました。コンパイル済み正規
表現オブジェクトはアトミックであると見なされます。


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(): 259. お
よび *note search(): 29a6. はマッチがないとき ‘None’ を返すので、マッチ
があるか単純な ‘if’ 文で判定できます。

     if match := re.search(pattern, string):
         process(match)

 -- クラス: re.Match

     Match object returned by successful ‘match’es and ‘search’es.

     バージョン 3.9 で変更: *note re.Match: 1089. supports ‘[]’ to
     indicate a Unicode (str) or bytes match.  See *note
     ジェネリックエイリアス型: aa4.

 -- メソッド: Match.expand (template)

     Return the string obtained by doing backslash substitution on the
     template string 'template', as done by the *note sub(): 29ae.
     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: 18ed. 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.search(r"\A(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
          >>> m.group(0)       # The entire match
          'Norwegian Blue'
          >>> m.group(1)       # The first parenthesized subgroup.
          'Norwegian'
          >>> m.group(2)       # The second parenthesized subgroup.
          'Blue'
          >>> m.group(1, 2)    # Multiple arguments give us a tuple.
          ('Norwegian', 'Blue')

     正規表現が ‘(?P<name>...)’ 構文を使うなら、 'groupN' 引数はグループ
     名でグループを識別する文字列でも構いません。文字列引数がパターン中
     でグループ名として使われていなければ、 *note IndexError: 18ed. 例外
     が送出されます。

     やや複雑な例:

          >>> m = re.search(r"(?P<adjective>\w+) (?P<animal>\w+)", "killer rabbit")
          >>> m.group('adjective')
          'killer'
          >>> m.group('animal')
          'rabbit'

     名前付きグループはインデックスでも参照できます:

          >>> m.group(1)
          'killer'
          >>> m.group(2)
          'rabbit'

     あるグループが複数回マッチすると、その最後のマッチにのみアクセスで
     きます:

          >>> m = re.search(r"(..)+", "a1b2c3")  # Matches 3 times.
          >>> m.group(1)                         # Returns only the last match.
          'c3'

 -- メソッド: Match.__getitem__ (g)

     これは ‘m.group(g)’ と同等です。これでマッチの個別のグループに簡単
     にアクセスできます:

          >>> m = re.search(r"(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
          >>> m[0]       # The entire match
          'Norwegian Blue'
          >>> m[1]       # The first parenthesized subgroup.
          'Norwegian'
          >>> m[2]       # The second parenthesized subgroup.
          'Blue'

     Named groups are supported as well:

          >>> m = re.search(r"(?P<adjective>\w+) (?P<animal>\w+)", "killer rabbit")
          >>> m['adjective']
          'killer'
          >>> m['animal']
          'rabbit'

     Added in version 3.6.

 -- メソッド: Match.groups (default=None)

     このマッチの、1 からパターン中のグループ数まで、全てのサブグループ
     を含むタプルを返します。'default' 引数はマッチに関係しなかったグル
     ープに使われます。デフォルトでは ‘None’ です。

     例えば:

          >>> m = re.search(r"(\d+)\.(\d+)", "24.1632")
          >>> m.groups()
          ('24', '1632')

     少数位およびその後の全てをオプションにすると、全てのグループがマッ
     チに関係するとは限りません。そういったグループは 'default' 引数が与
     えられない限りデフォルトで ‘None’ になります。

          >>> m = re.search(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.search(r"(?P<adjective>\w+) (?P<animal>\w+)", "killer rabbit")
          >>> m.groupdict()
          {'adjective': 'killer', 'animal': 'rabbit'}

 -- メソッド: 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: 18ed. 例外を発生します。

     メールアドレスから '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 正規表現オブジェクト: 1336. の *note search(): 29a6. や *note
     match(): 259. に渡された 'pos' の値です。これは正規表現エンジンがマ
     ッチを探し始める位置の文字列のインデックスです。

 -- の属性: Match.endpos

     *note 正規表現オブジェクト: 1336. の *note search(): 29a6. や *note
     match(): 259. に渡された 'endpos' の値です。これは正規表現エンジン
     がそれ以上は進まない文字列のインデックスです。

 -- の属性: Match.lastindex

     最後にマッチしたキャプチャグループの整数インデックスです。どのグル
     ープも全くマッチしなければ ‘None’ です。例えば、表現 ‘(a)b’ 、
     ‘((a)(b))’ や ‘((ab))’ が ‘'ab'’ に適用されると ‘lastindex == 1’ と
     なり、同じ文字列に ‘(a)(b)’ が適用されると ‘lastindex == 2’ となり
     ます。

 -- の属性: Match.lastgroup

     最後にマッチしたキャプチャグループの名前です。そのグループに名前が
     ないか、どのグループも全くマッチしていなければ ‘None’ です。

 -- の属性: Match.re

     このマッチインスタンスを生じさせた *note match(): 259. または *note
     search(): 29a6. メソッドの属する *note 正規表現オブジェクト: 1336.
     です。

 -- の属性: Match.string

     *note match(): 259. や *note search(): 29a6. へ渡された文字列です。

バージョン 3.7 で変更: *note copy.copy(): 947. および *note
copy.deepcopy(): f2f. をサポートするようになりました。マッチオブジェクト
はアトミックであると見なされます。


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. prefixmatch(): search vs prefixmatch.
* prefixmatch() vs. match(): prefixmatch 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_hand_re = re.compile(r"^[a2-9tjqk]{5}$")
     >>> displaymatch(valid_hand_re.search("akt5q"))  # Valid.
     "<Match: 'akt5q', groups=()>"
     >>> displaymatch(valid_hand_re.search("akt5e"))  # Invalid.
     >>> displaymatch(valid_hand_re.search("akt"))    # Invalid.
     >>> displaymatch(valid_hand_re.search("727ak"))  # Valid.
     "<Match: '727ak', groups=()>"

最後の手札、 ‘"727ak"’ 、はペア、すなわち同じ値の 2 枚のカードを含みます
。正規表現でこれにマッチするには、このように後方参照を使えます:

     >>> pair_re = re.compile(r".*(.).*\1")
     >>> displaymatch(pair_re.prefixmatch("717ak"))     # Pair of 7s.
     "<Match: '717', groups=('7',)>"
     >>> displaymatch(pair_re.prefixmatch("718ak"))     # No pairs.
     >>> displaymatch(pair_re.prefixmatch("354aa"))     # Pair of aces.
     "<Match: '354aa', groups=('a',)>"

ペアになっているのがどのカードか調べるには、このようにマッチオブジェクト
の *note group(): 13d7. メソッドを使えます:

     >>> pair_re = re.compile(r".*(.).*\1")
     >>> pair_re.prefixmatch("717ak").group(1)
     '7'

     # Error because prefixmatch() returns None, which doesn't have a group() method:
     >>> pair_re.prefixmatch("718ak").group(1)
     Traceback (most recent call last):
       File "<pyshell#23>", line 1, in <module>
         pair_re.prefixmatch("718ak").group(1)
     AttributeError: 'NoneType' object has no attribute 'group'

     >>> pair_re.prefixmatch("354aa").group(1)
     'a'


File: python.info,  Node: scanf をシミュレートする,  Next: search vs prefixmatch,  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 prefixmatch,  Next: prefixmatch vs match,  Prev: scanf をシミュレートする,  Up: Regular expression examples

5.7.3.11 search() vs. prefixmatch()
...................................

Python offers different primitive operations based on regular
expressions:

   + *note re.prefixmatch(): 256. checks for a match only at the
     beginning of the string

   + *note re.search(): 15e8. checks for a match anywhere in the string
     (this is what Perl does by default)

   + *note re.fullmatch(): 1334. checks for entire string to be a match

例えば:

     >>> re.prefixmatch("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(): 15e8. で使って、マッチを文字列
の先頭でのみに制限できます:

     >>> re.prefixmatch("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: 2996. mode *note prefixmatch():
256. only matches at the beginning of the string, whereas using *note
search(): 15e8. with a regular expression beginning with ‘'^'’ will
match at the beginning of each line.

     >>> re.prefixmatch("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: prefixmatch vs match,  Next: Making a phonebook,  Prev: search vs prefixmatch,  Up: Regular expression examples

5.7.3.12 prefixmatch() vs. match()
..................................

Why is the *note match(): 258. function and method discouraged in favor
of the longer *note prefixmatch(): 256. spelling?

Many other languages have gained regex support libraries since regular
expressions were added to Python.  However in the most popular of those,
they use the term 'match' in their APIs to mean the unanchored behavior
provided in Python by *note search(): 15e8.  Thus use of the plain term
'match' can be unclear to those used to other languages when reading or
writing code and not familiar with the Python API's divergence from what
otherwise become the industry norm.

Quoting from the Zen Of Python (‘python3 -m this’): '"Explicit is better
than implicit"'.  Anyone reading the name ‘prefixmatch()’ is likely to
understand the intended semantics.  When reading ‘match()’ there remains
a seed of doubt about the intended behavior to anyone not already
familiar with this old Python gotcha.

We 'do not' plan to remove the older ‘match()’ name, as it has been used
in code for over 30 years.  It has been *note soft deprecated: 1b2.:
code supporting older versions of Python should continue to use
‘match()’, while new code should prefer ‘prefixmatch()’.

Added in version 3.15: ‘prefixmatch()’

*note Soft deprecated: 1b2. since version 3.15: ‘match()’


File: python.info,  Node: Making a phonebook,  Next: Text munging,  Prev: prefixmatch vs match,  Up: Regular expression examples

5.7.3.13 Making a phonebook
...........................

*note split(): 7a6. は渡されたパターンで文字列を分割してリストにします。
このメソッドは、テキストデータをデータ構造に変換して、読みやすくしたり、
以下の例で実演する電話帳作成のように 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(): 7a6. の ‘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.14 Text munging
.....................

*note sub(): 7a7. は出現する各パターンを文字列で、または関数の返り値で置
き換えます。この例ではテキストを「秘匿」する関数と合わせて ‘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.15 Finding all adverbs
............................

*note search(): 15e8. は最初のパターンにのみマッチしますが、 *note
findall(): 13d6. は出現する '全ての' パターンにマッチします。例えば、ラ
イターがあるテキストの全ての副詞を見つけたいなら、以下のように
‘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.16 Finding all adverbs and their positions
................................................

パターンの全てのマッチについて、マッチしたテキスト以上の情報が必要なら、
文字列ではなく *note Match: 1089. を返す *note finditer(): 18b2. が便利
です。先の例に続いて、ライターがあるテキストの全ての副詞 'およびその位置
' を見つけたいなら、以下のように ‘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.17 Raw string notation
............................

Raw 文字列記法 (‘r"text"’) で正規表現をまともに保てます。それがなければ
、正規表現中のバックスラッシュ (‘'\'’) を個々にバックスラッシュを前置し
てエスケープしなければなりません。例えば、以下の 2 行のコードは機能的に
等価です:

     >>> re.search(r"\W(.)\1\W", " ff ")
     <re.Match object; span=(0, 4), match=' ff '>
     >>> re.search("\\W(.)\\1\\W", " ff ")
     <re.Match object; span=(0, 4), match=' ff '>

リテラルのバックスラッシュにマッチさせたいなら、正規表現中ではエスケープ
する必要があります。Raw 文字列記法では、‘r"\\"’ になります。Raw 文字列記
法を用いないと、‘"\\\\"’ としなくてはならず、以下のコードは機能的に等価
です:

     >>> re.search(r"\\", r"\\")
     <re.Match object; span=(0, 1), match='\\'>
     >>> re.search("\\\\", 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.18 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: 5d.
モジュールも参照してください。

 -- クラス: difflib.SequenceMatcher

     柔軟性のあるクラスで、二つのシーケンスの要素が *note ハッシュ可能:
     18e. な型であれば、どの型の要素を含むシーケンスも比較可能です。基本
     的なアルゴリズムは、1980年代の後半に発表された Ratcliff と
     Obershelp による"ゲシュタルトパターンマッチング"と大げさに名づけら
     れたアルゴリズム以前から知られている、やや凝ったアルゴリズムです。
     その考え方は、"junk" 要素を含まない最も長い互いに隣接したマッチ列を
     探すことです。ここで、 "junk" 要素とは、空行や空白などの、意味を持
     たない要素のことです。 (junk を処理するのは、Ratcliff と Obershelp
     のアルゴリズムに追加された拡張です。)この考え方は、マッチ列の左右に
     隣接するシーケンスの断片に対して再帰的にあてはめられます。この方法
     では編集を最小にするシーケンスは生まれませんが、人間の目からみて「
     正しい感じ」にマッチする傾向があります。

     '実行時間:' 基本的な Ratcliff-Obershelp アルゴリズムは、最悪の場合
     3乗、期待値で2乗となります。 *note SequenceMatcher: 13c7. オブジェ
     クトでは、最悪のケースで2乗、期待値は比較されるシーケンス中に共通に
     現れる要素数に非常にややこしく依存しています。最良の場合は線形時間
     になります。

     '自動 junk ヒューリスティック:' *note SequenceMatcher: 13c7. は、シ
     ーケンスの特定の要素を自動的に junk として扱うヒューリスティックを
     サポートしています。このヒューリスティックは、各個要素がシーケンス
     内に何回現れるかを数えます。ある要素の重複数が (最初のものは除いて)
     合計でシーケンスの 1% 以上になり、そのシーケンスが 200 要素以上なら
     、その要素は "popular" であるものとしてマークされ、シーケンスのマッ
     チングの目的からは junk として扱われます。このヒューリスティックは
     、 ‘SequenceMatcher’ の作成時に ‘autojunk’ パラメタを ‘False’ に設
     定することで無効化できます。

     バージョン 3.2 で変更: Added the 'autojunk' parameter.

 -- クラス: difflib.Differ

     テキスト行からなるシーケンスを比較するクラスです。人が読むことので
     きる差分を作成します。 Differ クラスは *note SequenceMatcher: 13c7.
     クラスを利用して、行からなるシーケンスを比較したり、(ほぼ)同一の行
     内の文字を比較したりします。

     *note Differ: 29cf. クラスによる差分の各行は、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: 21f. のインスタンスを初期化します。

          'tabsize' はオプションのキーワード引数で、タブストップ幅を指定
          します。デフォルトは ‘8’ です。

          'wrapcolumn' はオプションのキーワード引数で、テキストを折り返
          すカラム幅を指定します。デフォルトは ‘None’ で折り返しを行いま
          せん。

          'linejunk' および 'charjunk' はオプションのキーワード引数で、
          *note ndiff(): 29d1. (*note HtmlDiff: 21f. はこの関数を使って
          左右のテキストの差分を 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(): 11ac. メソッドの引数
          と同じです。

 -- の関数: difflib.context_diff (a, b, fromfile='', tofile='',
          fromfiledate='', tofiledate='', n=3, lineterm='\n')

     'a' と 'b' (文字列のリスト) を比較し、差分 (差分形式の行を生成する
     *note ジェネレータ: 1417.) を、 context diff のフォーマット(以下「
     コンテキスト形式」)で返します。

     コンテキスト形式は、変更があった行に前後数行を加えてある、コンパク
     トな表現方法です。変更箇所は、変更前/変更後に分けて表します。コンテ
     キスト (変更箇所前後の行) の行数は 'n' で指定し、デフォルト値は 3 で
     す。

     デフォルトで、 diff 制御行 (‘***’ や ‘---’ を含む行) は改行付きで生
     成されます。 *note io.IOBase.readlines(): 29d3. で作られた入力が
     *note io.IOBase.writelines(): 199d. で扱うのに適した 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 のコマンドラインインターフェース:
     29d4. を参照してください。

 -- の関数: 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 ジェネレータ: 1417.) を、 *note Differ: 29cf. のスタイルで返
     します。

     オプションのキーワード引数 '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(): 559, which filters out lines without visible
     characters, except for at most one hash character (‘'#'’) - however
     the underlying *note SequenceMatcher: 13c7. 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(): 29d5. であり、これは空
     白文字類 (空白またはタブ、改行文字をこれに含めてはいけません) をフ
     ィルタして排除します。

          >>> 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(): 29d7. または *note ndiff(): 29d1. によって
     生成された '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', *,
          color=False)

     'a' と 'b' (文字列のリスト) を比較し、差分 (差分形式の行を生成する
     *note ジェネレータ: 1417.) を、 unified diff フォーマット(以下「ユ
     ニファイド形式」)で返します。

     ユニファイド形式は変更があった行にコンテキストとなる前後数行を加え
     た、コンパクトな表現方法です。変更箇所は (変更前/変更後を分離したブ
     ロックではなく) インラインスタイルで表されます。コンテキストの行数
     は、'n' で指定し、デフォルト値は 3 です。

     デフォルトで、 diff 制御行 (‘---’, ‘+++’, ‘@@’ を含む行) は改行付き
     で生成されます。 *note io.IOBase.readlines(): 29d3. で作られた入力
     が *note io.IOBase.writelines(): 199d. で扱うのに適した diff になる
     ので (なぜなら入力と出力の両方が改行付きのため) 、これは有用です。

     行末に改行文字を持たない入力に対しては、出力でも改行文字を付加しな
     いように 'lineterm' 引数に ‘""’ を渡してください。

     Set 'color' to ‘True’ to enable output in color, similar to ‘git
     diff --color’.  Even if enabled, it can be *note controlled using
     environment variables: 1ba.

     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 のコマンドラインインターフェース:
     29d4. を参照してください。

     バージョン 3.15 で変更: Added the 'color' parameter.

 -- の関数: 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(): 21e. または *note
     context_diff(): 1bb6. です。

     未知のエンコーディングまたは一貫性のないエンコーディングのデータ同
     士を比較できます。'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(): 29d1. の引数 'linejunk' にデフ
     ォルトで使用されました。

 -- の関数: difflib.IS_CHARACTER_JUNK (ch)

     無視できる文字のとき ‘True’ を返します。文字 'ch' が空白、またはタ
     ブ文字のときには無視できます。それ以外の時には無視できません。
     *note ndiff(): 29d1. の引数 '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/main/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: 13c7. クラスには、以下のようなコンストラクタがあ
ります:

 -- クラス: difflib.SequenceMatcher (isjunk=None, a='', b='',
          autojunk=True)

     オプションの引数 'isjunk' は、‘None’ (デフォルトの値です) にするか
     、単一の引数をとる関数でなければなりません。後者の場合、関数はシー
     ケンスの要素を受け取り、要素が junk であり、無視すべきである場合に
     限り真を返すようにしなければなりません。'isjunk' に ‘None’ を渡すと
     、‘lambda x: False’ を渡したのと同じになります; すなわち、いかなる
     要素も無視しなくなります。例えば以下のような引数を渡すと:

          lambda x: x in " \t"

     空白とタブ文字を無視して文字のシーケンスを比較します。

     オプションの引数 'a' と 'b' は、比較される文字列で、デフォルトでは
     空の文字列です。両方のシーケンスの要素は、 *note ハッシュ可能: 18e.
     である必要があります。

     オプションの引数 'autojunk' は、自動 junk ヒューリスティックを無効
     にするために使えます。

     バージョン 3.2 で変更: Added the 'autojunk' parameter.

     SequenceMatcher オブジェクトは3つのデータ属性を持っています:
     'bjunk' は、 'isjunk' が ‘True’ であるような 'b' の要素の集合です;
     'bpopular' は、 (無効でなければ) ヒューリスティックによって popular
     であると考えられる非ジャンク要素の集合です; 'b2j' は、 'b' の残りの
     要素をそれらが生じる位置のリストに写像する dict です。この 3 つは
     *note set_seqs(): 29da. または *note set_seq2(): 29db. で 'b' がリ
     セットされる場合は常にリセットされます。

     Added in version 3.2: 'bjunk' および 'bpopular' 属性。

     *note SequenceMatcher: 13c7. オブジェクトは以下のメソッドを持ちます
     :

      -- メソッド: set_seqs (a, b)

          比較される2つの文字列を設定します。

     *note SequenceMatcher: 13c7. オブジェクトは、2つ目のシーケンスにつ
     いての詳細な情報を計算し、キャッシュします。 1つのシーケンスをいく
     つものシーケンスと比較する場合、まず *note set_seq2(): 29db. を使っ
     て文字列を設定しておき、別の文字列を1つずつ比較するために、繰り返し
     *note set_seq1(): 29dc. を呼び出します。

      -- メソッド: 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(): 1f5e. は ‘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: a42. ‘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 ジェネレータ: 1417. を返します。

          このメソッドは、 *note get_opcodes(): 29de. で返されるグループ
          の中から、似たような差異のかたまりに分け、間に挟まっている変更
          の無い部分を省きます。

          グループは *note get_opcodes(): 29de. と同じ書式で返されます。

      -- メソッド: ratio ()

          [0, 1] の範囲の浮動小数点数で、シーケンスの類似度を測る値を返
          します。

          T が2つのシーケンスの要素数の総計だと仮定し、M をマッチした数
          とすると、この値は 2.0*M / T であらわされます。もしシーケンス
          がまったく同じ場合、値は ‘1.0’ となり、まったく異なる場合には
          ‘0.0’ となります。

          このメソッドは *note get_matching_blocks(): 29dd. または *note
          get_opcodes(): 29de. がまだ呼び出されていない場合には非常にコ
          ストが高いです。この場合、上限を素早く計算するために、 *note
          quick_ratio(): 29e1. もしくは *note real_quick_ratio(): 29e2.
          を最初に試してみる方がいいかもしれません。

               注釈: 注意: *note ratio(): 29e0. の呼び出しの結果は引数の
               順序に依存します。例えば次の通りです:

                    >>> SequenceMatcher(None, 'tide', 'diet').ratio()
                    0.25
                    >>> SequenceMatcher(None, 'diet', 'tide').ratio()
                    0.5

      -- メソッド: quick_ratio ()

          *note ratio(): 29e0. の上界を、より高速に計算します。

      -- メソッド: real_quick_ratio ()

          *note ratio(): 29e0. の上界を、非常に高速に計算します。

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(): 29e1. and *note real_quick_ratio(): 29e2.
are always at least as large as *note ratio(): 29e0.:

     >>> 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(): 29e0. 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(): 29dd. 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(): 29dd.
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(): 29de.:

     >>> 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: 13c7. を使った、シンプルで使えるコードを知る
     には、このモジュールの関数 *note get_close_matches(): 199e. を参照
     してください。

   * Simple version control recipe(1) for a small application built with
     *note SequenceMatcher: 13c7.

   ---------- 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: 29cf. オブジェクトによって生成された差分が '最小' であるな
どとは言いません。むしろ、最小の差分はしばしば直観に反しています。その理
由は、どこでもできるとなれば一致を見いだしてしまうからで、ときには思いが
けなく100ページも離れたマッチになってしまうのです。一致点を互いに隣接し
たマッチに制限することで、場合によって長めの差分を出力するというコストを
掛けることにはなっても、ある種の局所性を保つことができるのです。

*note Differ: 29cf. は、以下のようなコンストラクタを持ちます:

 -- クラス: difflib.Differ (linejunk=None, charjunk=None)

     オプションのキーワードパラメータ 'linejunk' と 'charjunk' は、フィ
     ルタ関数を渡します (使わないときは ‘None’):

     'linejunk': ひとつの文字列引数を受け取る関数です。文字列が junk の
     ときに真を返します。デフォルトでは、‘None’ であり、どんな行であって
     も junk とは見なされません。

     'charjunk': この関数は文字(長さ1の文字列)を引数として受け取り、文字
     が junk であるときに真を返します。デフォルトは ‘None’ であり、どん
     な文字も junk とは見なされません。

     これらの junk フィルター関数により、差分を発見するマッチングが高速
     化し、差分の行や文字が無視されることがなくなります。説明については
     、 *note find_longest_match(): 1f5e. メソッドの 'isjunk' 引数の説明
     をご覧ください。

     *note Differ: 29cf. オブジェクトは、以下の1つのメソッドを通して利用
     されます。（差分を生成します）:

      -- メソッド: compare (a, b)

          文字列からなる2つのシーケンスを比較し、差分（を表す文字列から
          なるシーケンス）を生成します。

          各シーケンスの要素は、改行で終わる独立した単一行からなる文字列
          でなければなりません。そのようなシーケンスは、ファイル風オブジ
          ェクトの *note readlines(): 29d3. メソッドによって得ることがで
          きます。（得られる）差分は改行文字で終了する文字列のシーケンス
          として得られ、ファイル風オブジェクトの *note writelines():
          199d. メソッドによって出力できる形になっています。


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(): 29d3. 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: 29cf. オブジェクトをインスタンス化するとき、行 junk
と文字 junk をフィルタリングする関数を渡すことができます。詳細は *note
Differ(): 29cf. コンストラクタを参照してください。

最後に、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(): 29d1.

     """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: 137b, 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:
     137b. のインスタンス属性に対応しています。

     *note wrap(): 187f. の動作についての詳細は *note
     TextWrapper.wrap(): 29ee. メソッドを参照してください。

 -- の関数: 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(): 187e. はこれの省略表現です

          "\n".join(wrap(text, ...))

     特に、 *note fill(): 187e. は *note wrap(): 187f. とまったく同じ名
     前のキーワード引数を受け取ります。

 -- の関数: 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:
     137b. インスタンスの属性に対応します。文字列が ‘TextWrapper’ の
     *note fill(): 187e. 関数に渡される前に、空白が折りたたまれます。そ
     のため、*note tabsize: 29ef.、*note expand_tabs: 29f0.、*note
     drop_whitespace: 29f1.、*note replace_whitespace: 29f2. の値を変更
     しても、意味がありません。

     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(): 187f.、*note fill(): 187e.、*note shorten(): 137e. は
*note TextWrapper: 137b. インスタンスを作成し、その一つのメソッドを呼び
出すことで機能します。そのインスタンスは再利用されません。したがって、
‘wrap()’ や ‘fill()’ を使用して多くのテキスト文字列を処理するアプリケー
ションについては、独自の ‘TextWrapper’ オブジェクトを作成する方が効率が
良い方法でしょう。

テキストはなるべく空白か、ハイフンを含む語のハイフンの直後で折り返されま
す。 *note TextWrapper.break_long_words: 29f3. が偽に設定されていなけれ
ば、必要な場合に長い語が分解されます。

 -- クラス: textwrap.TextWrapper (**kwargs)

     *note TextWrapper: 137b. コンストラクタはたくさんのオプションのキー
     ワード引数を受け取ります。それぞれのキーワード引数は一つのインスタ
     ンス属性に対応します。したがって、例えば

          wrapper = TextWrapper(initial_indent="* ")

     はこれと同じです

          wrapper = TextWrapper()
          wrapper.initial_indent = "* "

     同じ *note TextWrapper: 137b. オブジェクトは何回も再利用できます。
     また、使用中にインスタンス属性へ代入することでそのオプションのどれ
     でも変更できます。

     *note TextWrapper: 137b. インスタンス属性(とコンストラクタのキーワ
     ード引数)は以下の通りです:

      -- の属性: width

          (デフォルト: ‘70’) 折り返しが行われる行の最大の長さ。入力行に
          *note width: 29f4. より長い単一の語が無い限り、 *note
          TextWrapper: 137b. は ‘width’ 文字より長い出力行が無いことを保
          証します。

      -- の属性: expand_tabs

          (デフォルト: ‘True’) もし真ならば、そのときは 'text' 内のすべ
          てのタブ文字は 'text' の *note expandtabs(): 2859. メソッドを
          用いて空白に展開されます。

      -- の属性: tabsize

          (デフォルト: ‘8’) *note expand_tabs: 29f0. が真の場合、 'text'
          の中のすべてのTAB文字は tabsize と現在のカラムに応じて、ゼロ以
          上のスペースに展開されます。

          Added in version 3.3.

      -- の属性: replace_whitespace

          (デフォルト: ‘True’) 真の場合、 *note wrap(): 187f. メソッドは
          タブの展開の後、 wrap 処理の前に各種空白文字をスペース1文字に
          置換します。置換される空白文字は: TAB, 改行, 垂直TAB, FF, CR
          (‘'\t\n\v\f\r'’) です。

               注釈: *note expand_tabs: 29f0. が偽で *note
               replace_whitespace: 29f2. が真ならば、各タブ文字は1つの空
               白に置き換えられます。それはタブ展開と同じでは 'ありませ
               ん' 。

               注釈: *note replace_whitespace: 29f2. が偽の場合、改行が
               行の途中で現れることで出力がおかしくなることがあります。
               このため、テキストを(*note str.splitlines(): 1610. などを
               使って)段落ごとに分けて別々に wrap する必要があります。

      -- の属性: drop_whitespace

          (デフォルト: ‘True’) 真の場合、(wrap 処理のあとインデント処理
          の前に) 各行の最初と最後の空白文字を削除します。ただし、段落の
          最初の空白については、次の文字が空白文字でない場合は削除されま
          せん。削除される空白文字が行全体に及ぶ場合は、行自体を削除しま
          す。

      -- の属性: initial_indent

          (default: ‘''’) wrap の出力の最初の行の先頭に付与する文字列。
          最初の行の長さに加算されます。空文字列の場合インデントされませ
          ん。

      -- の属性: subsequent_indent

          (デフォルト: ‘''’) 一行目以外の折り返しが行われる出力のすべて
          の行の先頭に付けられる文字列。一行目以外の各行の折り返しまでの
          長さにカウントされます。

      -- の属性: fix_sentence_endings

          (デフォルト: ‘False’) もし真ならば、 *note TextWrapper: 137b.
          は文の終わりを見つけようとし、確実に文がちょうど二つの空白で常
          に区切られているようにします。これは一般的に固定スペースフォン
          トのテキストに対して望ましいです。しかし、文の検出アルゴリズム
          は完全ではありません: 文の終わりには、後ろに空白がある ‘'.'’,
          ‘'!'’ または ‘'?'’ の中の一つ、ことによると ‘'"'’ あるいは
          ‘"'"’ が付随する小文字があると仮定しています。このアルゴリズム
          に伴う一つの問題は下記の"Dr."と

               [...] Dr. Frankenstein's monster [...]

          下記の"Spot."の間の差異を検出できないことです

               [...] See Spot. See Spot run [...]

          *note fix_sentence_endings: 29f7. はデフォルトで偽です。

          文検出アルゴリズムは"小文字"の定義のために ‘string.lowercase’
          に依存し、同一行の文を区切るためにピリオドの後に二つの空白を使
          う慣習に依存しているため、英文テキストに限定されたものです。

      -- の属性: break_long_words

          (デフォルト: ‘True’) もし真ならば、そのとき *note width: 29f4.
          より長い行が確実にないようにするために、 ‘width’ より長い語は
          切られます。偽ならば、長い語は切られないでしょう。そして、
          ‘width’ より長い行があるかもしれません。 (‘width’ を超える分を
          最小にするために、長い語は単独で一行に置かれるでしょう。)

      -- の属性: break_on_hyphens

          (デフォルト: ‘True’) 真の場合、英語で一般的なように、ラップ処
          理は空白か合成語に含まれるハイフンの直後で行われます。偽の場合
          、空白だけが改行に適した位置として判断されます。ただし、本当に
          語の途中で改行が行われないようにするためには、 *note
          break_long_words: 29f3. 属性を真に設定する必要があります。過去
          のバージョンでのデフォルトの振る舞いは、常にハイフンの直後での
          改行を許していました。

      -- の属性: max_lines

          (デフォルト ‘None’) ‘None’ 以外の場合、出力は行数 'max_lines'
          を超えないようにされ、切り詰める際には出力の最後の行を
          'placeholder' に置き換えます。

          Added in version 3.4.

      -- の属性: placeholder

          (デフォルト: ‘' [...]'’) 切り詰める場合に出力の最後の行に置く
          文字列です。

          Added in version 3.4.

     *note TextWrapper: 137b. はモジュールレベルの簡易関数に類似したいく
     つかの公開メソッドも提供します:

      -- メソッド: wrap (text)

          1段落の文字列 'text' を、各行が *note width: 29f4. 文字以下に
          なるように wrap します。 wrap のすべてのオプションは *note
          TextWrapper: 137b. インスタンスの属性から取得します。結果の、
          行末に改行のない行のリストを返します。出力の内容が空になる場合
          は、返すリストも空になります。

      -- メソッド: fill (text)

          'text' 内の段落を一つだけ折り返しを行い、折り返しが行われた段
          落を含む一つの文字列を返します。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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 17.0.0(1).

このモジュールは、ユニコード標準付録 #44 「 ユニコード文字データベース
(2) 」で定義されているのと同じ名前およびシンボルを使用します。このモジュ
ールは次のような関数を定義します:

参考
....

The *note Unicode HOWTO: 165e. 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: 7e5. 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: 15a. 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: 15a. 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: 15a. 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: 15a. 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.block (chr, /)

     Returns the block(9) assigned to the character 'chr'.  For example:

          >>> unicodedata.block('S')
          'Basic Latin'

     Added in version 3.15.

 -- の関数: 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.isxidstart (chr, /)

     Return ‘True’ if 'chr' is a valid identifier start per the Unicode
     Standard Annex #31(10), that is, it has the ‘XID_Start’ property.
     Return ‘False’ otherwise.  For example:

          >>> unicodedata.isxidstart('S')
          True
          >>> unicodedata.isxidstart('0')
          False

     Added in version 3.15.

 -- の関数: unicodedata.isxidcontinue (chr, /)

     Return ‘True’ if 'chr' is a valid identifier character per the
     Unicode Standard Annex #31(11), that is, it has the ‘XID_Continue’
     property.  Return ‘False’ otherwise.  For example:

          >>> unicodedata.isxidcontinue('S')
          True
          >>> unicodedata.isxidcontinue(' ')
          False

     Added in version 3.15.

 -- の関数: 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.grapheme_cluster_break (chr, /)

     Returns the Grapheme_Cluster_Break property assigned to the
     character.

     Added in version 3.15.

 -- の関数: unicodedata.indic_conjunct_break (chr, /)

     Returns the Indic_Conjunct_Break property assigned to the
     character.

     Added in version 3.15.

 -- の関数: unicodedata.extended_pictographic (chr, /)

     Returns ‘True’ if the character has the Extended_Pictographic
     property, ‘False’ otherwise.

     Added in version 3.15.

 -- の関数: unicodedata.normalize (form, unistr, /)

     Unicode 文字列 'unistr' の正規形 'form' を返します。 'form' の有効
     な値は、'NFC'、'NFKC'、'NFD'、'NFKD' です。

     Unicode 規格は標準等価性 (canonical equivalence) と互換等価性
     (compatibility equivalence) に基づいて、様々な Unicode文字列の正規
     形を定義します。Unicode では、複数の方法で表現できる文字があります
     。たとえば、文字 U+00C7 (LATIN CAPITAL LETTER C WITH CEDILLA) は、
     U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA) というシ
     ーケンスとしても表現できます。

     各文字には2つの正規形があり、それぞれ正規形 C と正規形 D といいます
     。正規形 D (NFD) は標準分解 (canonical decomposition) としても知ら
     れており、各文字を分解された形に変換します。正規形 C (NFC) は標準分
     解を適用した後、結合済文字を再構成します。

     In addition to these two forms, there are two additional normal
     forms based on compatibility equivalence.  In Unicode, certain
     characters are supported which normally would be unified with other
     characters.  For example, U+2160 (ROMAN NUMERAL ONE) is really the
     same thing as U+0049 (LATIN CAPITAL LETTER I). However, it is
     supported in Unicode for compatibility with existing character sets
     (for example, gb2312).

     The normal form KD (NFKD) will apply the compatibility
     decomposition, that is, replace all compatibility characters with
     their equivalents.  The normal form KC (NFKC) first applies the
     compatibility decomposition, followed by the canonical composition.

     2つのunicode文字列が正規化されていて人間の目に同じに見えても、片方
     が結合文字を持っていてもう片方が持っていない場合、それらは完全に同
     じではありません。

 -- の関数: unicodedata.is_normalized (form, unistr, /)

     Unicode 文字列 'unistr' が正規形 'form' かどうかを返します。 'form'
     の有効な値は、'NFC'、'NFKC'、'NFD'、'NFKD' です。

     Added in version 3.8.

 -- の関数: unicodedata.iter_graphemes (unistr, start=0,
          end=sys.maxsize, /)

     Returns an iterator to iterate over grapheme clusters.  With
     optional 'start', iteration begins at that position.  With optional
     'end', iteration stops at that position.

     Converting an emitted item to string returns a substring
     corresponding to the grapheme cluster.  Its ‘start’ and ‘end’
     attributes denote the start and end of the grapheme cluster.

     It uses extended grapheme cluster rules defined by Unicode Standard
     Annex #29, "Unicode Text Segmentation"(12).

     Added in version 3.15.

更に、本モジュールは以下の定数を公開します:

 -- データ: unicodedata.unidata_version

     このモジュールで使われている Unicode データベースのバージョン。

 -- データ: unicodedata.ucd_3_2_0

     This is an object that has most of the methods of 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/17.0.0/ucd

   (2) https://www.unicode.org/reports/tr44/

   (3) ‘https://www.unicode.org/Public/17.0.0/ucd/NameAliases.txt’

   (4) ‘https://www.unicode.org/Public/17.0.0/ucd/NamedSequences.txt’

   (5) https://www.unicode.org/reports/tr44/#General_Category_Values

   (6) https://www.unicode.org/reports/tr44/#Bidi_Class_Values

   (7) 
https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values

   (8) https://www.unicode.org/reports/tr11/

   (9) 
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G64189

   (10) https://www.unicode.org/reports/tr31/

   (11) https://www.unicode.org/reports/tr31/

   (12) https://www.unicode.org/reports/tr29/


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/main/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: c5. 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(): 1692. function.

readline のキーバインディングは初期化ファイルで設定できます。 このファイ
ルは、たいていはホームディレクトリに ‘.inputrc’ という名前で置いてありま
す。 GNU Readline マニュアルの Readline Init File(1) を参照して、そのフ
ァイルの形式や可能な構成、 Readline ライブラリ全体の機能を知ってください
。

*note Availability: 234c.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 246c. と *note
WebAssemblyプラットフォーム: 1d86. をサポートしません。

This is an *note optional module: 2366.  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
オプションのモジュールの要件: 2364.

*note Availability: 234c.: 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: 1c4e. 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: 1e84.
     ‘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: 1e84.
     ‘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: 1e84. ‘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: 1e84.
     ‘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(): 1a02. 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():
     2a24. は履歴ファイルに書かれる最大行数を返します。)

 -- の関数: 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.

 -- の関数: readline.get_pre_input_hook ()

     Get the current pre-input hook function, or ‘None’ if no pre-input
     hook function has been set.  This function only exists if Python
     was compiled for a version of the library that supports it.

     Added in version 3.15.


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: c5. 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: 45a. 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 対話モード: 65d. で実行される時、このコードは実際には自
動的に実行されます ( *note readline の設定: 1377. を参照してください)。

次の例では上記と同じ目的を達成できますが、ここでは新規の履歴のみを追加す
ることで、並行して対話セッションがサポートされます:

     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: 2a36. クラスを拡張し、履歴の保
存・復旧をサポートします。

     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: 6a3. introduced in version 3.13 doesn't
     support readline.  However, readline can still be used by setting
     the *note PYTHON_BASIC_REPL: 459. 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(): 2a2f. in the *note readline: c2.
module.

When this module is imported on a Unix platform with the *note readline:
c2. module available, an instance of the *note Completer: 1f3f. class is
automatically created and its *note complete(): 2a3a. method is set as
the *note readline completer: 2a2e.  The method provides completion of
valid Python *note identifiers and keywords: 24af.

以下はプログラム例です:

     >>> 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: 65d.  Unless Python is run with the *note -S: 1566.
option, the module is automatically imported and configured (see *note
readline の設定: 1377.).

*note readline: c2. のないプラットフォームでも、このモジュールで定義され
る *note Completer: 1f3f. クラスは独自の目的に使えます。

 -- クラス: rlcompleter.Completer

     Completerオブジェクトは以下のメソッドを持っています:

      -- メソッド: complete (text, state)

          Return the next possible completion for 'text'.

          When called by the *note readline: c2. 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: 87. モジュールで定義されている) から補完されま
          す。

          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__(): 8e8.) up to
          the last part, and find matches for the rest via the *note
          dir(): a28. function.  Any exception raised during the
          evaluation of the expression is caught, silenced and *note
          None: a6a. is returned.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/rlcompleter.py


File: python.info,  Node: バイナリデータ処理,  Next: データ型,  Prev: テキスト処理サービス,  Up: Python 標準ライブラリ

5.8 バイナリデータ処理
======================

この章で紹介されているモジュールはバイナリデータを扱うための基本的な処理
を提供しています。ファイルフォーマットやネットワークプロトコルなど、その
他のバイナリデータ処理については、それぞれの節で解説されています。

*note テキスト処理サービス: 2862. で紹介する一部のライブラリには、 ASCII
互換のバイナリフォーマットで利用できるもの (例: *note re: c1.) や 、すべ
てのバイナリデータで利用できるもの (例: *note difflib: 3a.) があります。

加えて、 *note バイナリシーケンス型 -- bytes, bytearray, memoryview:
27dc. に書かれている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: 1d2. objects.  Compact *note format strings: 2a41.
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
     バイトオーダ、サイズ、アラインメント: 2a42. for details.

Several ‘struct’ functions (and methods of *note Struct: 307.) take a
'buffer' argument.  This refers to objects that implement the *note
バッファプロトコル (buffer Protocol): 319. and provide either a readable
or read-writable buffer.  The most common types used for that purpose
are *note bytes: 1d2. and *note bytearray: 1d1, 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/main/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(): 1fb9. の返り値である書式文字列が要求するサイズと一致し
     なければなりません。

 -- の関数: struct.unpack_from (format, /, buffer, offset=0)

     バッファ 'buffer' を、 'offset' の位置から書式文字列 'format' に従
     ってアンパックします。 値が一つしかない場合を含め、結果はタプルで返
     されます。 'offset' を始点とするバッファのバイトサイズは、少なくと
     も *note calcsize(): 1fb9. の返り値である書式文字列が要求するサイズ
     でなければなりません。

 -- の関数: struct.iter_unpack (format, buffer)

     バッファ 'buffer' を、書式文字列 'format' に従ってイテレータ形式で
     アンパックします。 この関数が返すイテレータは、すべての内容を読み終
     わるまでバッファから一定の大きさのチャンクを読み取ります。 バッファ
     のバイトサイズは、 *note calcsize(): 1fb9. の返り値である書式文字列
     が要求するサイズの倍数でなければなりません。

     イテレーション毎に書式文字列で指定されたタプルを 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 type codes: 2a46, which specify the type of
data being packed/unpacked.  In addition, special characters control the
*note byte order, size and alignment: 2a42.  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:

* バイトオーダ、サイズ、アラインメント::
* Type Codes::
* 使用例: 使用例<3>.


File: python.info,  Node: バイトオーダ、サイズ、アラインメント,  Next: Type Codes,  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: 280f. を使って調べて下さい。

ネイティブのサイズおよびアラインメントは C コンパイラの ‘sizeof’ 式で決
定されます。ネイティブのサイズおよびアラインメントはネイティブのバイトオ
ーダと同時に使われます。

Standard size depends only on the type code; see the table in the *note
Type Codes: 2a46. section.

‘'@'’ と ‘'='’ の違いに注意してください: 両方ともネイティブのバイトオー
ダですが、後者のバイトサイズとアラインメントは標準のものに合わせてありま
す。

The form ‘'!'’ represents the network byte order which is always
big-endian as defined in IETF RFC 1700(1).

バイトオーダに関して、「(強制的にバイトスワップを行う)ネイティブの逆」を
指定する方法はありません。‘'<'’ または ‘'>'’ のうちふさわしい方を選んで
ください。

注釈:

  1. パディングは構造体のメンバの並びの中にだけ自動で追加されます。最初
     や最後にパディングが追加されることはありません。

  2. ネイティブでないサイズおよびアラインメントが使われる場合にはパディ
     ングは行われません (たとえば '<', '>', '=', '!'  を使った場合です
     )。

  3. 特定の型によるアラインメント要求に従うように構造体の末端をそろえる
     には、繰り返し回数をゼロにした特定の型でフォーマットを終端します。
     *note 使用例: 2a48. を参照して下さい。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc1700


File: python.info,  Node: Type Codes,  Next: 使用例<3>,  Prev: バイトオーダ、サイズ、アラインメント,  Up: 書式文字列

5.8.1.4 Type Codes
..................

Type codes (or format codes) have the following meaning; the conversion
between C and Python values should be obvious given their types.  The
'Standard size' column refers to the size of the packed value in bytes
when using standard size; that is, when the format string starts with
one of ‘'<'’, ‘'>'’, ‘'!'’ or ‘'='’.  When using native size, the size
of the packed value is platform-dependent.

フォーマッ   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)
                                                                                          
                                                                                          
‘Zf’         float complex                  複素数                   8                    (10)
                                                                                          
                                                                                          
‘Zd’         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.

バージョン 3.15 で変更: Added support for the ‘'Zf'’ and ‘'Zd'’ formats.

参考
....

The *note array: 8. and *note ctypes: 2a4a. 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__(): 444.
     method then that method is called to convert the argument to an
     integer before packing.

     バージョン 3.2 で変更: Added use of the *note __index__(): 444.
     method for non-integers.

  3. ‘'n'’ および ‘'N'’ 変換コードは (デフォルトもしくはバイトオーダ文字
     ‘'@'’ 付きで選択される) native サイズ使用時のみ利用できます。
     standard サイズ使用時には、自身のアプリケーションに適する他の整数フ
     ォーマットを使うことができます。

  4. ‘'f'’ 、 ‘'d'’ および ‘'e'’ 変換コードについて、パックされた表現は
     IEEE 754 binary32 (‘'f'’ の場合) 、 binary64 (‘'d'’ の場合) 、また
     はbinary16(‘'e'’ の場合) フォーマットが、プラットフォームにおける浮
     動小数点数のフォーマットに関係なく使われます。

  5. The ‘'P'’ type code is only available for the native byte ordering
     (selected as the default or with the ‘'@'’ byte order character).
     The byte order character ‘'='’ chooses to use little- or big-endian
     ordering based on the host system.  The struct module does not
     interpret this as native ordering, so the ‘'P'’ format is not
     available.

  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'’ type code 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(): 1630. 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(): 1aa2, the ‘'p'’
     type code consumes ‘count’ bytes, but that the ‘bytes’ object
     returned can never contain more than 255 bytes.  When packing,
     arguments of types *note bytes: 1d2. and *note bytearray: 1d1. are
     accepted.

  9. For the ‘'s'’ type code, the count is interpreted as the length of
     the byte string, not a repeat count like for the other type codes;
     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 使用例: 2a48. 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: 1d2. and *note bytearray:
     1d1. are accepted.

  10. For the ‘'F'’ and ‘'D'’ type codes, 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’/‘Zf’ and ‘D’/‘Zd’) 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.

A type code may be preceded by an integral repeat count.  For example,
the format string ‘'4h'’ means exactly the same as ‘'hhhh'’.

フォーマット文字間の空白文字は無視されます; count とフォーマット文字の間
にはスペースを入れてはいけません。

整数フォーマット (‘'b'’, ‘'B'’, ‘'h'’, ‘'H'’, ‘'i'’, ‘'I'’, ‘'l'’,
‘'L'’, ‘'q'’, ‘'Q'’) のいずれかを使って値 ‘x’ をパックするとき ‘x’ がフ
ォーマットの適切な値の範囲に無い場合、 *note struct.error: 16dd. が送出
されます。

バージョン 3.1 で変更: 以前は、いくつかの整数フォーマットが適切な範囲に
ない値を覆い隠して、 *note struct.error: 16dd. の代わりに *note
DeprecationWarning: 2d4. を送出していました。

For the ‘'?'’ type code, the return value is either *note True: fd0. or
*note False: ef9.  When packing, the truth value of the argument object
is used.  Either 0 or 1 in the native or standard bool representation
will be packed, and any non-zero value will be ‘True’ when unpacking.

   ---------- 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: Type Codes,  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 type codes 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: 85. モジュール

     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: 2a4e.), and data
interchange between applications using agreed upon data layout (*note
standard formats: 2a4f.).  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 type 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'’ type 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(): 1630. 関数と同じ、コンパイルされたフォーマットを
          利用するメソッドです。 (‘len(result)’ は *note size: 2a55. と
          等しいでしょう)

      -- メソッド: pack_into (buffer, offset, v1, v2, ...)

          *note pack_into(): 1987. 関数と同じ、コンパイルされたフォーマ
          ットを利用するメソッドです。

      -- メソッド: unpack (buffer)

          *note unpack(): 1aa2. 関数と同じ、コンパイルされたフォーマット
          を利用するメソッドです。 (buffer のバイト数は *note size:
          2a55. と等しくなければなりません)。

      -- メソッド: unpack_from (buffer, offset=0)

          *note unpack_from(): 2a44. 関数と同じ、コンパイルされたフォー
          マットを利用するメソッドです。 ('offset' を始点とする buffer の
          バイト数は少なくとも *note size: 2a55. 以上でなければなりませ
          ん)。

      -- メソッド: iter_unpack (buffer)

          *note iter_unpack(): 136d. 関数と同じ、コンパイルされたフォー
          マットを利用するメソッドです。 (buffer のバイト数は *note
          size: 2a55. の倍数でなければなりません)。

          Added in version 3.4.

      -- の属性: format

          この Struct オブジェクトを作成する時に利用されたフォーマット文
          字列です。

          バージョン 3.7 で変更: The format string type is now *note
          str: 1ea. instead of *note bytes: 1d2.

      -- の属性: size

          *note format: 440. 属性に対応する構造体の (従って *note
          pack(): 1630. メソッドによって作成されるバイト列オブジェクトの
          ) サイズです。

     バージョン 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
テキストエンコーディング: 27f3. ですが、テキストをテキストに、またはバイ
トをバイトにエンコードする codec も提供されています。カスタムの codec は
任意の型間でエンコードとデコードを行えますが、一部のモジュール機能は テ
キストエンコーディング か *note bytes: 1d2. へのエンコードのみに制限され
ています。

このモジュールでは、任意の codec でエンコードやデコードを行うための、以
下の関数が定義されています。

 -- の関数: codecs.encode (obj, encoding='utf-8', errors='strict')

     'encoding' に記載された codec を使用して 'obj' をエンコードします。

     希望のエラー処理スキームを 'errors' に設定することができます。デフ
     ォルトのエラーハンドラ (エラー処理関数) は ‘'strict'’ です。これは
     エンコードエラーは *note ValueError: 15a. (もしくは *note
     UnicodeEncodeError: a6c. のような、より codec に固有のサブクラス) を
     送出することを意味します。codec エラー処理についてのより詳しい情報
     は *note Codec 基底クラス: 2a5c. を参照してください。

 -- の関数: codecs.decode (obj, encoding='utf-8', errors='strict')

     'encoding' に記載された codec を使用して 'obj' をデコードします。

     希望のエラー処理スキームを 'errors' に設定することができます。デフ
     ォルトのエラーハンドラは ‘'strict'’ です。これはデコードエラーは
     *note ValueError: 15a. (もしくは *note UnicodeDecodeError: ddb. の
     ような、より codec に固有のサブクラス) を送出することを意味します。
     codec エラー処理についてのより詳しい情報は *note Codec 基底クラス:
     2a5c. を参照してください。

 -- の関数: codecs.charmap_build (string)

     Return a mapping suitable for encoding with a custom single-byte
     encoding.  Given a *note str: 1ea. 'string' of up to 256 characters
     representing a decoding table, returns either a compact internal
     mapping object ‘EncodingMap’ or a *note dictionary: 193. mapping
     character ordinals to byte values.  Raises a *note TypeError: 29c.
     on invalid input.

各 codec についての詳細も、次のようにして直接調べることができます。

 -- の関数: codecs.lookup (encoding, /)

     Python codec レジストリから codec 情報を探し、以下で定義するような
     *note CodecInfo: 1c91. オブジェクトを返します。

     This function first normalizes the 'encoding': all ASCII letters
     are converted to lower case, spaces are replaced with hyphens.
     Then encoding is looked up in the registry's cache.  If not found,
     the list of registered search functions is scanned.  If no *note
     CodecInfo: 1c91. object is found, a *note LookupError: 25f9. is
     raised.  Otherwise, the ‘CodecInfo’ object is stored in the cache
     and returned to the caller.

     バージョン 3.9 で変更: Any characters except ASCII letters and
     digits and a dot are converted to underscore.

     バージョン 3.15 で変更: No characters are converted to underscore
     anymore.  Spaces are converted to hyphens.

 -- クラス: codecs.CodecInfo (encode, decode, streamreader=None,
          streamwriter=None, incrementalencoder=None,
          incrementaldecoder=None, name=None)

     codec レジストリ内を検索する場合の、codec の詳細です。コントラクタ
     引数は、次の同名の属性に保存されます。

      -- の属性: name

          エンコーディングの名前です。

      -- の属性: encode
      -- の属性: decode

          ステートレスなエンコーディングとデコーディングの関数です。これ
          らは、Codec インスタンスの *note encode(): 19cd. メソッドと
          *note decode(): 2a61. メソッドと同じインターフェースを持ってい
          る必要があります (see *note Codec のインターフェース: 2a62. を
          参照)。この関数またはメソッドは、ステートレスモードで動作する
          ことが想定されています。

      -- の属性: incrementalencoder
      -- の属性: incrementaldecoder

          インクリメンタル・エンコーダとデコーダのクラスまたはファクトリ
          関数です。これらは、基底クラスの *note IncrementalEncoder:
          2a65. と *note IncrementalDecoder: 2a66. が定義するインターフ
          ェースをそれぞれ提供する必要があります。インクリメンタルな
          codec は、ステート (内部状態) を保持することができます。

      -- の属性: streamwriter
      -- の属性: streamreader

          ストリームライターとリーダーのクラスまたはファクトリ関数です。
          これらは、基底クラスの *note StreamWriter: 2a69. と *note
          StreamReader: 2a6a. が定義するインターフェースをそれぞれ提供す
          る必要があります。ストリーム codec は、ステートを保持すること
          ができます。

さまざまな codec 構成要素へのアクセスを簡便化するために、このモジュール
は以下のような関数を提供しています。これらの関数は、 codec の検索に
*note lookup(): d31. を使います:

 -- の関数: codecs.getencoder (encoding)

     与えられたエンコーディングに対する codec を検索し、エンコーダ関数を
     返します。

     エンコーディングが見つからなければ *note LookupError: 25f9. を送出
     します。

 -- の関数: codecs.getdecoder (encoding)

     与えられたエンコーディングに対する codec を検索し、デコーダ関数を返
     します。

     エンコーディングが見つからなければ *note LookupError: 25f9. を送出
     します。

 -- の関数: codecs.getincrementalencoder (encoding)

     与えられたエンコーディングに対する codec を検索し、インクリメンタル
     ・エンコーダクラスまたはファクトリ関数を返します。

     エンコーディングが見つからないか、 codec がインクリメンタル・エンコ
     ーダをサポートしなければ *note LookupError: 25f9. を送出します。

 -- の関数: codecs.getincrementaldecoder (encoding)

     与えられたエンコーディングに対する codec を検索し、インクリメンタル
     ・デコーダクラスまたはファクトリ関数を返します。

     エンコーディングが見つからないか、 codec がインクリメンタル・デコー
     ダをサポートしなければ *note LookupError: 25f9. を送出します。

 -- の関数: codecs.getreader (encoding)

     与えられたエンコーディングに対する codec を検索し、*note
     StreamReader: 2a6a. クラスまたはファクトリ関数を返します。

     エンコーディングが見つからなければ *note LookupError: 25f9. を送出
     します。

 -- の関数: codecs.getwriter (encoding)

     与えられたエンコーディングに対する codec を検索し、*note
     StreamWriter: 2a69. クラスまたはファクトリ関数を返します。

     エンコーディングが見つからなければ *note LookupError: 25f9. を送出
     します。

次のように、適切な 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 spaces converted to hyphens, and return a *note
     CodecInfo: 1c91. object.  In case a search function cannot find a
     given encoding, it should return ‘None’.

 -- の関数: 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():
333. とそれに関連付けられた *note io: 82. モジュールの使用が推奨されてい
ますが、このモジュールは追加のユーティリティ関数とクラスを提供し、バイナ
リファイルを処理する場合に幅広い codecs を利用できるようにします。

 -- の関数: codecs.open (filename, mode='r', encoding=None,
          errors='strict', buffering=-1)

     エンコードされたファイルを 'mode' を使って開き、透過的なエンコード
     /デコードを提供する *note StreamReaderWriter: 2a72. のインスタンス
     を返します。デフォルトのファイルモードは ‘'r'’ 、つまり、読み出しモ
     ードでファイルを開きます。

          注釈: 'encoding' が ‘None’ でなければ、下層のエンコードされた
          ファイルは、常にバイナリモードで開きます。読み書き時に、
          ‘'\n'’ の自動変換は行われません。'mode' 引数は、組み込みの
          *note open(): 333. 関数が受け入れる任意のバイナリモードにする
          ことができます。‘'b'’ が自動的に付加されます。

     'encoding' は、そのファイルに対して使用されるエンコーディングを指定
     します。バイトにエンコードする、あるいはバイトからデコードするすべ
     てのエンコーディングが許可されます。ファイルメソッドがサポートする
     データ型は、使用される codec によって異なります。

     エラーハンドリングのために 'errors' を渡すことができます。これはデ
     フォルトでは ‘'strict'’ で、エンコード時にエラーがあれば *note
     ValueError: 15a. を送出します。

     '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 で非推奨: *note codecs.open(): 334. has been
     superseded by ‘open()’.

 -- の関数: codecs.EncodedFile (file, data_encoding, file_encoding=None,
          errors='strict')

     透過的なエンコード変換を行うファイルのラップされたバージョンである
     、*note StreamRecoder: 1fe2. インスタンスを返します。元のファイルは
     、ラップされたバージョンが閉じられる時に、閉じられます。

     ラップされたファイルに書き込まれたデータは、指定された
     'data_encoding' に従ってデコードされ、次に 'file_encoding' を使用し
     て元のファイルにバイトとして書き出されます。元のファイルから読み出
     されたバイトは、'file_encoding' に従ってデコードされ、結果は
     'data_encoding' を使用してエンコードされます。

     'file_encoding' が与えられなければ、'data_encoding' がデフォルトに
     なります。

     エラーハンドリングのために 'errors' を渡すことができます。これはデ
     フォルトでは ‘'strict'’ で、エンコード時にエラーがあれば *note
     ValueError: 15a. を送出します。

 -- の関数: codecs.iterencode (iterator, encoding, errors='strict',
          **kwargs)

     Uses an incremental encoder to iteratively encode the input
     provided by 'iterator'.  'iterator' must yield *note str: 1ea.
     objects.  This function is a *note generator: 1417.  The 'errors'
     argument (as well as any other keyword argument) is passed through
     to the incremental encoder.

     この関数では、コーデックはエンコードするテキストの *note str: 1ea.
     オブジェクトを受け付ける必要があります。 従って、 ‘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: 1d2.
     objects.  This function is a *note generator: 1417.  The 'errors'
     argument (as well as any other keyword argument) is passed through
     to the incremental decoder.

     この関数では、コーデックはエンコードする *note bytes: 1d2. オブジェ
     クトを受け付ける必要があります。 従って、 ‘rot_13’ のようなテキスト
     からテキストへのエンコーダが *note iterencode(): 2a74. で同等に使え
     るとしても、この関数ではサポートしていません。

 -- の関数: codecs.readbuffer_encode (buffer, errors=None, /)

     Return a *note tuple: 1d9. containing the raw bytes of 'buffer', a
     *note buffer-compatible object: 319. or *note str: 1ea. (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:
     2a7b. は、プラットフォームのネイティブバイトオーダによって *note
     BOM_UTF16_BE: 2a7c. または *note BOM_UTF16_LE: 2a7d. です。 *note
     BOM: 2a77. は ‘BOM_UTF16’ のエイリアスです。同様に、 *note BOM_LE:
     2a79. は ‘BOM_UTF16_LE’ の、 *note BOM_BE: 2a78. は ‘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/main/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
標準エンコーディング: 1175. codecs:

値                            意味
                              
----------------------------------------------------------------------------------
                              
‘'strict'’                    *note UnicodeError: 67c. (または、そのサブクラス)
                              を送出します。これがデフォルトの動作です。
                              *note strict_errors(): 2a84. で実装されています。
                              
                              
‘'ignore'’                    不正な形式のデータを無視し、何も通知することなく
                              処理を継続します。*note ignore_errors(): 2a85. で
                              実装されています。
                              
                              
‘'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(): 1b02.
                              
                              
‘'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(): 1b03.
                              
                              
‘'surrogateescape'’           デコード時には、バイト列を ‘U+DC80’ から ‘U+DCFF’
                              の範囲の個々のサロゲートコードで置き換えます。デ
                              ータのエンコード時に ‘'surrogateescape'’ エラーハ
                              ンドラが使用されると、このコードは同じバイト列に
                              戻されます。 (詳しくは PEP 383(1) を参照。)
                              

The following error handlers are only applicable to encoding (within
*note text encodings: 27f3.):

値                            意味
                              
----------------------------------------------------------------------------------
                              
‘'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(): 1b04.
                              
                              
‘'namereplace'’               Replace with ‘\N{...}’ escape sequences, what
                              appears in the braces is the Name property from
                              Unicode Character Database.  Implemented in
                              *note namereplace_errors(): 2a86.
                              

さらに、次のエラーハンドラは与えられた 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: 1ea. 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: a6c. インスタンスとともに呼び出されます。エラー
     処理関数はこの例外を送出するか、別の例外を送出するか、入力のエンコ
     ードできなかった部分の代替文字列とエンコードを再開する場所が入った
     タプルを返す必要があります。代替文字列は *note str: 1ea. または
     *note bytes: 1d2. のいずれかにすることができます。代替文字列がバイ
     ト列である場合、エンコーダは単に出力バッファにそれをコピーします。
     代替文字列が文字列である場合、エンコーダは代替文字列をエンコードし
     ます。元の入力中の指定位置からエンコードが再開されます。位置を負の
     値にすると、入力文字列の末端からの相対位置として扱われます。境界の
     外側にある位置を返した場合には *note IndexError: 18ed. が送出されま
     す。

     デコードと翻訳の動作は似ていますが、エラーハンドラに渡されるのが
     *note UnicodeDecodeError: ddb. か *note UnicodeTranslateError:
     1b3b. である点と、エラーハンドラの置換した内容が直接出力されるとい
     う点が異なります。

登録済みのエラーハンドラ (標準エラーハンドラを含む) は、次のようにその名
前で検索することができます。

 -- の関数: codecs.lookup_error (name, /)

     名前 'name' で登録済みのエラーハンドラを返します。

     エラーハンドラが見つからなければ *note LookupError: 25f9. を送出し
     ます。

以下の標準エラーハンドラも、モジュールレベルの関数として利用できます。

 -- の関数: codecs.strict_errors (exception)

     Implements the ‘'strict'’ error handling.

     Each encoding or decoding error raises a *note UnicodeError: 67c.

 -- の関数: 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: 27f3. 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: 27f3. 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: 2a88. クラスは以下のメソッドを定義します。これらのメ
ソッドは、内部状態を持たないエンコーダ／デコーダ関数のインターフェースを
定義します:

 -- クラス: codecs.Codec

      -- メソッド: encode (input, errors='strict')

          オブジェクト 'input' エンコードし、(出力オブジェクト, 消費した
          長さ) のタプルを返します。例えば、 *note
          テキストエンコーディング: 27f3. は文字列オブジェクトを特有の文
          字セット (例えば ‘cp1252’ や ‘iso-8859-1’) を用いてバイト列オ
          ブジェクトに変換します。

          'errors' 引数は適用するエラー処理を定義します。‘'strict'’ 処理
          がデフォルトです。

          このメソッドは *note Codec: 2a88. に内部状態を保存してはなりま
          せん。効率よくエンコードするために状態を保持しなければならない
          ような codecs には *note StreamWriter: 2a69. を使ってください
          。

          エンコーダは長さが 0 の入力を処理できなければなりません。この
          場合、空のオブジェクトを出力オブジェクトとして返さなければなり
          ません。

      -- メソッド: decode (input, errors='strict')

          オブジェクト 'input' をデコードし、(出力オブジェクト, 消費した
          長さ) のタプルを返します。例えば、 *note
          テキストエンコーディング: 27f3. は、特定の文字集合エンコーディ
          ングでエンコードされたバイト列オブジェクトを文字列オブジェクト
          に変換します。

          テキストエンコーディングとバイト列からバイト列への codec では
          、'input' は bytes オブジェクト、または読み出し専用のバッファ
          インターフェースを提供するオブジェクトである必要があります。例
          えば、buffer オブジェクトやメモリマップドファイルでなければな
          りません。

          'errors' 引数は適用するエラー処理を定義します。‘'strict'’ 処理
          がデフォルトです。

          このメソッドは、 *note Codec: 2a88. インスタンスに内部状態を保
          存してはなりません。効率よくエンコード／デコードするために状態
          を保持しなければならないような codecs には *note StreamReader:
          2a6a. を使ってください。

          デコーダは長さが 0 の入力を処理できなければなりません。この場
          合、空のオブジェクトを出力オブジェクトとして返さなければなりま
          せん。


File: python.info,  Node: インクリメンタルなエンコードとデコード,  Next: ストリームのエンコードとデコード,  Prev: ステートレスなエンコードとデコード,  Up: Codec 基底クラス

5.8.2.4 インクリメンタルなエンコードとデコード
..............................................

*note IncrementalEncoder: 2a65. クラスおよび *note IncrementalDecoder:
2a66. クラスはそれぞれインクリメンタル・エンコードおよびデコードのための
基本的なインターフェースを提供します。エンコード／デコードは内部状態を持
たないエンコーダ／デコーダを一度呼び出すことで行なわれるのではなく、イン
クリメンタル・エンコーダ／デコーダの *note encode(): 19ce./*note
decode(): 2a8a. メソッドを複数回呼び出すことで行なわれます。インクリメン
タル・エンコーダ／デコーダはメソッド呼び出しの間エンコード／デコード処理
の進行を管理します。

*note encode(): 19ce./*note decode(): 2a8a. メソッド呼び出しの出力結果を
まとめたものは、入力をひとまとめにして内部状態を持たないエンコーダ／デコ
ーダでエンコード／デコードしたものと同じになります。

* Menu:

* IncrementalEncoder オブジェクト::
* IncrementalDecoder オブジェクト::


File: python.info,  Node: IncrementalEncoder オブジェクト,  Next: IncrementalDecoder オブジェクト,  Up: インクリメンタルなエンコードとデコード

5.8.2.5 IncrementalEncoder オブジェクト
.......................................

*note IncrementalEncoder: 2a65. クラスは入力を複数ステップでエンコードす
るのに使われます。全てのインクリメンタル・エンコーダが Python codec レジ
ストリと互換性を持つために定義すべきメソッドとして、このクラスには以下の
メソッドが定義されています。

 -- クラス: codecs.IncrementalEncoder (errors='strict')

     *note IncrementalEncoder: 2a65. インスタンスのコンストラクタ。

     全てのインクリメンタル・エンコーダはこのコンストラクタインターフェ
     ースを提供しなければなりません。さらにキーワード引数を付け加えるの
     は構いませんが、Python codec レジストリで利用されるのはここで定義さ
     れているものだけです。

     *note IncrementalEncoder: 2a65. は、 'errors' キーワード引数を提供
     することで、様々なエラー取扱方法を実装することができます。取り得る
     値については *note エラーハンドラ: 1d8b. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note IncrementalEncoder: 2a65. オブジェクトが生きている間に、異な
     るエラー処理方法に切り替えることができるようになります。

      -- メソッド: encode (object, final=False)

          'object' を(エンコーダの現在の状態を考慮に入れて)エンコードし
          、得られたエンコードされたオブジェクトを返します。 *note
          encode(): 12b5. 呼び出しがこれで最後という時には 'final' は真
          でなければなりません(デフォルトは偽です)。

      -- メソッド: reset ()

          エンコーダを初期状態にリセットします。出力は破棄されます。
          ‘.encode(object, final=True)’ を呼び出して、必要に応じて空バイ
          ト列またはテキスト文字列を渡すことにより、エンコーダをリセット
          し、出力を取得します。

      -- メソッド: getstate ()

          エンコーダの現在の状態を返します。それは必ず整数でなければなり
          ません。実装は、‘0’ が最も一般的な状態であることを保証すべきで
          す。 (整数より複雑な状態は、状態を marshal/pickle して生じた文
          字列のバイトを整数にコード化することによって整数に変換すること
          ができます。)

      -- メソッド: setstate (state)

          エンコーダの状態を 'state' にセットします。 'state' は *note
          getstate(): 2a8e. によって返されたエンコーダ状態でなければなり
          ません。


File: python.info,  Node: IncrementalDecoder オブジェクト,  Prev: IncrementalEncoder オブジェクト,  Up: インクリメンタルなエンコードとデコード

5.8.2.6 IncrementalDecoder オブジェクト
.......................................

*note IncrementalDecoder: 2a66. クラスは入力を複数ステップでデコードする
のに使われます。全てのインクリメンタル・デコーダが Python codec レジスト
リと互換性を持つために定義すべきメソッドとして、このクラスには以下のメソ
ッドが定義されています。

 -- クラス: codecs.IncrementalDecoder (errors='strict')

     *note IncrementalDecoder: 2a66. インスタンスのコンストラクタ。

     全てのインクリメンタル・デコーダはこのコンストラクタインターフェー
     スを提供しなければなりません。さらにキーワード引数を付け加えるのは
     構いませんが、Python codec レジストリで利用されるのはここで定義され
     ているものだけです。

     *note IncrementalDecoder: 2a66. は、 'errors' キーワード引数を提供
     することで、様々なエラー取扱方法を実装することができます。取り得る
     値については *note エラーハンドラ: 1d8b. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note IncrementalDecoder: 2a66. オブジェクトが生きている間に、異な
     るエラー処理方法に切り替えることができるようになります。

      -- メソッド: decode (object, final=False)

          'object' を(デコーダの現在の状態を考慮に入れて)デコードし、得
          られたデコードされたオブジェクトを返します。 *note decode():
          12b6. 呼び出しがこれで最後という時には 'final' は真でなければ
          なりません(デフォルトは偽です)。もし 'final' が真ならばデコー
          ダは入力をデコードし切り全てのバッファをフラッシュしなければな
          りません。そうできない場合(たとえば入力の最後に不完全なバイト
          列があるから)、デコーダは内部状態を持たない場合と同じようにエ
          ラーの取り扱いを開始しなければなりません(例外を送出するかもし
          れません)。

      -- メソッド: reset ()

          デコーダを初期状態にリセットします。

      -- メソッド: getstate ()

          デコーダの現在の状態を返します。これは2要素を含むタプルでなけ
          ればなりません。1番目はまだデコードされていない入力を含むバッ
          ファです。2番目は整数で、付加的な状態情報です (実装は ‘0’ が最
          も一般的な付加的な状態情報であることを保証すべきです)。この付
          加的な状態情報が ‘0’ である場合、デコーダを入力がバッファされ
          ていない状態に戻して、付加的な状態情報を ‘0’ にセットすること
          が可能でなければなりません。その結果、以前バッファされた入力を
          デコーダに与えることで、何の出力もせずにデコーダを前の状態に戻
          します。 (整数より複雑な付加的な状態情報は、情報を
          marshal/pickle して、結果として生じる文字列のバイト列を整数に
          エンコードすることで、整数に変換することができます。)

      -- メソッド: setstate (state)

          デコーダの状態を 'state' にセットします。 'state' は *note
          getstate(): 2a93. によって返されたデコーダの状態でなければなり
          ません。


File: python.info,  Node: ストリームのエンコードとデコード,  Prev: インクリメンタルなエンコードとデコード,  Up: Codec 基底クラス

5.8.2.7 ストリームのエンコードとデコード
........................................

The *note StreamWriter: 2a69. and *note StreamReader: 2a6a. 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: 2a69. クラスは *note Codec: 2a88. のサブクラスで、以
下のメソッドを定義しています。全てのストリームライタは、 Python の codec
レジストリとの互換性を保つために、これらのメソッドを定義する必要がありま
す。

 -- クラス: codecs.StreamWriter (stream, errors='strict')

     *note StreamWriter: 2a69. インスタンスのコンストラクタです。

     全てのストリームライタはコンストラクタとしてこのインターフェースを
     提供しなければなりません。キーワード引数を追加しても構いませんが、
     Python の codec レジストリはここで定義されている引数だけを使います
     。

     'stream' 引数は、特定の codec に対応して、テキストまたはバイナリデ
     ータの書き込みが可能なファイルライクオブジェクトである必要がありま
     す。

     *note StreamWriter: 2a69. は、 'errors' キーワード引数を提供するこ
     とで、様々なエラー取扱方法を実装することができます。下層のストリー
     ム codec がサポートできる標準エラーハンドラについては *note
     エラーハンドラ: 1d8b. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note StreamWriter: 2a69. オブジェクトが生きている間に、異なるエラ
     ー処理に変更できます。

      -- メソッド: write (object)

          'object' の内容をエンコードしてストリームに書き出します。

      -- メソッド: writelines (list)

          Writes the concatenated iterable of strings to the stream
          (possibly by reusing the *note write(): 2a98. method).
          Infinite or very large iterables are not supported.  The
          standard bytes-to-bytes codecs do not support this method.

      -- メソッド: reset ()

          内部状態保持に使われた codec のバッファをリセットします。

          このメソッドが呼び出された場合、出力先データをきれいな状態にし
          、わざわざストリーム全体を再スキャンして状態を元に戻さなくても
          新しくデータを追加できるようにしなければなりません。

ここまでで挙げたメソッドの他にも、 *note StreamWriter: 2a69. では背後に
あるストリームの他の全てのメソッドや属性を継承しなければなりません。


File: python.info,  Node: StreamReader オブジェクト,  Next: StreamReaderWriter オブジェクト,  Prev: StreamWriter オブジェクト,  Up: ストリームのエンコードとデコード

5.8.2.9 StreamReader オブジェクト
.................................

*note StreamReader: 2a6a. クラスは *note Codec: 2a88. のサブクラスで、以
下のメソッドを定義しています。全てのストリームリーダは、 Python の codec
レジストリとの互換性を保つために、これらのメソッドを定義する必要がありま
す。

 -- クラス: codecs.StreamReader (stream, errors='strict')

     *note StreamReader: 2a6a. インスタンスのコンストラクタです。

     全てのストリームリーダはコンストラクタとしてこのインターフェースを
     提供しなければなりません。キーワード引数を追加しても構いませんが、
     Python の codec レジストリはここで定義されている引数だけを使います
     。

     'stream' 引数は、特定の codec に対応して、テキストまたはバイナリデ
     ータの読み出しが可能なファイルライクオブジェクトである必要がありま
     す。

     *note StreamReader: 2a6a. は、 'errors' キーワード引数を提供するこ
     とで、様々なエラー取扱方法を実装することができます。下層のストリー
     ム codec がサポートできる標準エラーハンドラについては *note
     エラーハンドラ: 1d8b. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note StreamReader: 2a6a. オブジェクトが生きている間に、異なるエラ
     ー処理に変更できます。

     'errors' 引数に許される値の集合は *note register_error(): 1853. で
     拡張できます。

      -- メソッド: read (size=-1, chars=-1, firstline=False)

          ストリームからのデータをデコードし、デコード済のオブジェクトを
          返します。

          'chars' 引数は、いくつのデコードされたコードポイントまたはバイ
          ト列を返すかを表します。 *note read(): 2a9d. メソッドは、要求
          された数以上のデータを返すことはありませんが、データがそれより
          少ない場合には要求された数未満のデータを返す場合があります。

          'size' 引数は、デコード用に読み込むエンコードされたバイト列ま
          たはコードポイントの、およその最大バイト数を表します。デコーダ
          はこの値を適切な値に変更できます。デフォルト値 -1 の場合、可能
          な限り多くのデータを読み込みます。この引数の目的は、巨大なファ
          イルの一括デコードを防ぐことにあります。

          'firstline' フラグは、1行目さえ返せばその後の行でデコードエラ
          ーがあっても無視して十分だ、ということを示します。

          このメソッドは貪欲な読み込み戦略を取るべきです。すなわち、エン
          コーディング定義と size の値が許す範囲で、できるだけ多くのデー
          タを読むべきだということです。たとえば、ストリーム上にエンコー
          ディングの終端や状態の目印があれば、それも読み込みます。

      -- メソッド: readline (size=None, keepends=True)

          入力ストリームから1行読み込み、デコード済みのデータを返します
          。

          'size' が与えられた場合、ストリームの *note read(): 2a9d. メソ
          ッドに size 引数として渡されます。

          'keepends' が偽の場合には行末の改行が削除された行が返ります。

      -- メソッド: readlines (sizehint=None, keepends=True)

          入力ストリームから全ての行を読み込み、行のリストとして返します
          。

          'keepends' が真なら、改行は、codec の *note decode(): 12b6. メ
          ソッドを使って実装され、リスト要素の中に含まれます。

          'sizehint' が与えられた場合、ストリームの *note read(): 2a9d.
          メソッドに 'size' 引数として渡されます。

      -- メソッド: reset ()

          内部状態保持に使われた codec のバッファをリセットします。

          ストリームの読み位置を再設定してはならないので注意してください
          。このメソッドはデコードの際にエラーから復帰できるようにするた
          めのものです。

ここまでで挙げたメソッドの他にも、 *note StreamReader: 2a6a. では背後に
あるストリームの他の全てのメソッドや属性を継承しなければなりません。


File: python.info,  Node: StreamReaderWriter オブジェクト,  Next: StreamRecoder オブジェクト,  Prev: StreamReader オブジェクト,  Up: ストリームのエンコードとデコード

5.8.2.10 StreamReaderWriter オブジェクト
........................................

*note StreamReaderWriter: 2a72. は、読み書き両方に使えるストリームをラッ
プできる便利なクラスです。

*note lookup(): d31. 関数が返すファクトリ関数を使って、インスタンスを生
成するという設計です。

 -- クラス: codecs.StreamReaderWriter (stream, Reader, Writer,
          errors='strict')

     *note StreamReaderWriter: 2a72. インスタンスを生成します。 'stream'
     はファイル類似のオブジェクトです。 'Reader' と 'Writer' は、それぞ
     れ *note StreamReader: 2a6a. と *note StreamWriter: 2a69. インター
     フェースを提供するファクトリ関数かファクトリクラスでなければなりま
     せん。エラー処理は、ストリームリーダとライタで定義したものと同じよ
     うに行われます。

*note StreamReaderWriter: 2a72. インスタンスは、 *note StreamReader:
2a6a. クラスと *note StreamWriter: 2a69. クラスを合わせたインターフェー
スを継承します。元になるストリームからは、他のメソッドや属性を継承します
。


File: python.info,  Node: StreamRecoder オブジェクト,  Prev: StreamReaderWriter オブジェクト,  Up: ストリームのエンコードとデコード

5.8.2.11 StreamRecoder オブジェクト
...................................

*note StreamRecoder: 1fe2. はデータをあるエンコーディングから別のエンコ
ーディングに変換します。異なるエンコーディング環境を扱うとき、便利な場合
があります。

*note lookup(): d31. 関数が返すファクトリ関数を使って、インスタンスを生
成するという設計です。

 -- クラス: 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(): 2a9d. and *note write():
     2a98, while 'Reader' and 'Writer' work on the backend — the data in
     'stream'.

     これらのオブジェクトを使って、たとえば、 Latin-1 から UTF-8 への変
     換、あるいは逆向きの変換を、透過的に行うことができます。

     'stream' 引数はファイルライクオブジェクトでなくてはなりません。

     'encode' 引数と 'decode' 引数は *note Codec: 2a88. のインターフェー
     スに忠実でなくてはなりません。'Reader' と 'Writer' は、それぞれ
     *note StreamReader: 2a6a. と *note StreamWriter: 2a69. のインターフ
     ェースを提供するオブジェクトのファクトリ関数かクラスでなくてはなり
     ません。

     エラー処理はストリーム・リーダやライタで定義されている方法と同じよ
     うに行われます。

*note StreamRecoder: 1fe2. インスタンスは、 *note StreamReader: 2a6a. と
*note StreamWriter: 2a69. クラスを合わせたインターフェースを定義します。
また、元のストリームのメソッドと属性も継承します。


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: a6c. が送出されます
(エラーメッセージの細かところは異なる場合があります。):
‘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 space or a
hyphen instead of an underscore are also valid aliases because they are
equivalent when normalized by *note normalize_encoding(): 31b.  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 guaranteed 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             utf8-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/main/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: 1ea. から *note bytes: 1d2. へのエンコードと、 *note
bytes-like object: 43d. から ‘str’ へのデコードを提供します。

Codec                    別名          意味
                                       
-----------------------------------------------------------------------
                                       
idna                                   RFC 3490(1) の実装です。
                                       *note encodings.idna: 55. も
                                       参照してください。
                                       ‘errors='strict'’ のみがサポ
                                       ートされています。
                                       
                                       
mbcs                     ansi, dbcs    Windows のみ: 被演算子を ANSI
                                       コードページ (CP_ACP) に従っ
                                       てエンコードします。
                                       
                                       
oem                                    Windows のみ: 被演算子を OEM
                                       コードページ (CP_OEMCP) に従
                                       ってエンコードします。
                                       
                                       Added in version 3.6.
                                       
                                       
palmos                                 PalmOS 3.5 のエンコーディング
                                       です。
                                       
                                       
punycode                               RFC 3492(2) の実装です。ステ
                                       ートフル codecs は、サポート
                                       されません。
                                       
                                       
raw_unicode_escape                     Latin-1 encoding with
                                       ‘\uXXXX’ and ‘\UXXXXXXXX’ for
                                       other code points.  Existing
                                       backslashes are not escaped
                                       in any way.  It is used in
                                       the Python pickle protocol.
                                       
                                       
undefined                              This Codec should only be
                                       used for testing purposes.
                                       
                                       空文字列を含む全ての変換に対
                                       して例外を送出します。エラー
                                       ハンドラは無視されます。
                                       
                                       
unicode_escape                         ASCII でエンコードされた
                                       Python ソースコード内の、
                                       Unicode リテラルに適したエン
                                       コーディングです。ただし、引
                                       用符はエスケープされません。
                                       Latin-1 ソースコードからデコ
                                       ードします。実際には、Python
                                       のソースコードはデフォルトで
                                       は UTF-8 を使用することに注意
                                       してください。
                                       

バージョン 3.8 で変更: "unicode_internal" codec is removed.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3490.html

   (2) https://datatracker.ietf.org/doc/html/rfc3492.html


File: python.info,  Node: バイナリ変換 Binary Transforms,  Next: Standalone Codec Functions,  Prev: テキストエンコーディング,  Up: Python 特有のエンコーディング

5.8.2.16 バイナリ変換 (Binary Transforms)
.........................................

以下の codec は、*note bytes-like object: 43d. から *note bytes: 1d2. マ
ッピングへのバイナリ変換を提供します。*note bytes.decode(): cac. はこの
変換をサポートしておらず、 *note str: 1ea. を出力するだけです。

Codec                      別名                   意味                               エンコーダ / デコーダ
                                                                                     
------------------------------------------------------------------------------------------------------------------------
                                                                                     
base64_codec (1)           base64, base_64        被演算子をマルチラインの MIME      *note base64.encodebytes(): d22.
                                                  base64 に変換します (結果は常に    /
                                                  末尾の ‘'\n'’ を含みます)。        *note base64.decodebytes(): d23.
                                                                                     
                                                  バージョン 3.4 で変更: 任意の
                                                  *note bytes-like object: 43d. を
                                                  エンコードとデコード用の入力とし
                                                  て受け取ります。
                                                  
                                                                                     
bz2_codec                  bz2                    被演算子をbz2を使って圧縮します    *note bz2.compress(): 2aab. /
                                                  。                                 *note bz2.decompress(): 144b.
                                                                                     
                                                                                     
hex_codec                  hex                    被演算子をバイトあたり 2 桁の 16   *note binascii.b2a_hex(): 194c.
                                                  進数の表現に変換します。           / *note binascii.a2b_hex(): 209.
                                                                                     
                                                                                     
quopri_codec               quopri,                被演算子を MIME quoted printable   ‘quotetabs=True’ を指定した
                           quotedprintable,       形式に変換します。                 *note quopri.encode(): 2aac. /
                           quoted_printable                                          *note quopri.decode(): 2aad.
                                                                                     
                                                                                     
uu_codec                   uu                     被演算子を uuencode を用いて変換
                                                  します。
                                                  
                                                                                     
zlib_codec                 zip, zlib              被演算子を gzip を用いて圧縮しま   *note zlib.compress(): a33. /
                                                  す。                               *note zlib.decompress(): 10cc.
                                                                                     

Added in version 3.2: バイナリ変換が復活しました。(訳注: 2.x にはあった
ものが 3.0 で削除されていた。)

バージョン 3.4 で変更: バイナリ変換のエイリアスが復活しました。(訳注:
2.x にはあったエイリアス。3.2 でエイリアスは復活しなかった。)

   ---------- Footnotes ----------

   (1) *note バイト様オブジェクト: 43d. に加えて、‘'base64_codec'’ も
*note str: 1ea. の 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(): 12b5. or *note codecs.decode(): 12b6.  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(): 462. on bytes produces escaped byte values.

     'input' must be a *note bytes: 1d2. object.

     Returns a tuple ‘(output, length)’ where 'output' is a *note bytes:
     1d2. 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: 43d.

     Returns a tuple ‘(output, length)’ where 'output' is a *note bytes:
     1d2. 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: 1ea. から ‘str’ マッピングへのテキスト変換を
提供します。*note str.encode(): cab. はこの変換をサポートしておらず、
*note bytes: 1d2. を出力するだけです。

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(): d31. 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(): 31b, 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: 1c91. 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: 1c91. object for it.

     *note Availability: 234c.: 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: dd. の上に構築されています。

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: d4. モ
ジュールは Unicode ホスト名を ACE に透過的に変換するため、アプリケーショ
ンはホスト名を ‘socket’ モジュールに渡す際にホスト名の変換に煩わされるこ
とがありません。その上で、ホスト名を関数パラメタとして持つ、 *note
http.client: 72. や *note ftplib: 61. のようなモジュールでは 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: 234c.: 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: 193. 、 *note list: 4e0. 、 *note set: 432. 、 *note frozenset:
9d9. 、そして *note tuple: 1d9. があります。 *note str: 1ea. クラスは
Unicode データを扱うことができ、 *note bytes: 1d2. と *note bytearray:
1d1. クラスはバイナリデータを扱うことができます。

この章では以下のモジュールが記述されています:

* 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 書式コード: 2ac2. に飛ぶ。

参考
....

*note calendar: 15. モジュール

     汎用のカレンダー関連関数。

*note time: f7. モジュール

     時刻へのアクセスと変換。

*note zoneinfo: 13d. モジュール

     IANAタイムゾーンデータベースを表す具体的なタイムゾーン。

dateutil(2) パッケージ

     拡張タイムゾーンと構文解析サポートのあるサードパーティーライブラリ
     。

DateType(3) パッケージ

     Third-party library that introduces distinct static types to for
     example, allow *note static type checkers: 77b. 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/main/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: 6ed. and *note
time: 495. 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: 9dd. objects capture information
about the offset from UTC time, the time zone name, and whether daylight
saving time is in effect.

ただ一つの具象 *note tzinfo: 9dd. クラスである *note timezone: 147f. ク
ラスが ‘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: 494. や *note datetime: 6ed. オブジェクトで許されている
     、年を表現する最小の数字です。 *note MINYEAR: 2ac6. は1です。

 -- データ: datetime.MAXYEAR

     *note date: 494. や *note datetime: 6ed. オブジェクトで許されている
     、年を表現する最大の数字です。 *note MAXYEAR: 2ac7. は9999です。

 -- データ: datetime.UTC

     UTCタイムゾーンシングルトン *note datetime.timezone.utc: a0c. の別
     名。

     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: 2ac9, *note month: 2aca,および *note day: 2acb. です。

 -- クラス: datetime.time

     理想的な時刻で、特定の日から独立しており、毎日が厳密に 24*60*60 秒
     であると仮定しています。("うるう秒: leap seconds" の概念はありませ
     ん。) 属性は *note hour: 2acc, *note minute: 2acd, *note second:
     2ace, *note microsecond: 2acf, および *note tzinfo: 2ad0. です。

 -- クラス: datetime.datetime

     日付と時刻を組み合わせたものです。 属性は *note year: 2ad1, *note
     month: 2ad2, *note day: 2ad3, *note hour: 2ad4, *note minute: 2ad5,
     *note second: 2ad6, *note microsecond: 2ad7, および *note tzinfo:
     2ad8. です。

 -- クラス: datetime.timedelta

     *note datetime: 6ed. あるいは *note date: 494. クラスの二つのインス
     タンス間の時間差をマイクロ秒精度で表す経過時間値です。

 -- クラス: datetime.tzinfo

     タイムゾーン情報オブジェクトの抽象基底クラスです。 *note datetime:
     6ed. および *note time: 495. クラスで用いられ、カスタマイズ可能な時
     刻修正の概念 (たとえばタイムゾーンや夏時間の計算) を提供します。

 -- クラス: datetime.timezone

     *note tzinfo: 9dd. 抽象基底クラスを 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: 494. 型、*note datetime: 6ed. 型、*note time: 495. 型、*note
timezone: 147f. 型には共通する特徴があります:

   - これらの型のオブジェクトは変更不可能 (immutable) です。

   - これらの型のオブジェクトは *note ハッシュ可能: 18e. であり、辞書の
     キーとして使えることになります。

   - これらの型のオブジェクトは *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: 494. 型のオブジェクトは常に naive です。

*note time: 495. 型あるいは *note datetime: 6ed. 型のオブジェクトは
aware か naive のどちらかです。

次の条件を両方とも満たす場合、 *note datetime: 6ed. オブジェクト ‘d’ は
aware です:

  1. ‘d.tzinfo’ が ‘None’ でない

  2. ‘d.tzinfo.utcoffset(d)’ が ‘None’ を返さない

どちらかを満たさない場合は、 ‘d’ は naive です。

次の条件を両方とも満たす場合、 *note time: 495. オブジェクト ‘t’ は
aware です:

  1. ‘t.tzinfo’ が ‘None’ でない

  2. ‘t.tzinfo.utcoffset(None)’ が ‘None’ を返さない

どちらかを満たさない場合は、 ‘t’ は naive です。

aware なオブジェクトと naive なオブジェクトの区別は *note timedelta:
d98. オブジェクトにはあてはまりません。


File: python.info,  Node: timedelta objects,  Next: date objects,  Prev: Available types,  Up: datetime --- 基本的な日付と時間の型

5.9.1.6 ‘timedelta’ objects
...........................

*note timedelta: d98. オブジェクトは経過時間、すなわち二つの *note
datetime: 6ed. または *note date: 494. のインスタンスの差を表します。

 -- クラス: 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: c5b. が送出されます。

     負の値を正規化すると、最初は混乱するような値になります。例えば:

          >>> 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: d98. オブジェクトで、
     ‘timedelta(-999999999)’ です。

 -- の属性: timedelta.max

     最大の値を表す *note timedelta: d98. オブジェクトで、
     ‘timedelta(days=999999999, hours=23, minutes=59, seconds=59,
     microseconds=999999)’ です。

 -- の属性: timedelta.resolution

     *note timedelta: d98. オブジェクトが等しくならない最小の時間差で、
     ‘timedelta(microseconds=1)’ です。

正規化のために、 ‘timedelta.max’ は ‘-timedelta.min’ より大きいことに注
意してください。 ‘-timedelta.max’ は *note timedelta: d98. オブジェクト
として表現することができません。

インスタンスの属性 (読み出しのみ):

 -- の属性: 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(): 16bf. 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: 32f. オブジェクトを返します。
                                     
                                     
‘t1 = t2 / f’ または ‘t1 = t2 / i’   時間差を浮動小数点や整数で除したもの。結果は最近
                                     接偶数への丸めを利用して最も近い
                                     timedelta.resolution の倍数に丸められます。
                                     
                                     
‘t1 = t2 // i’ または ‘t1 = t2 //    floor が計算され、余りは (もしあれば) 捨てられま
t3’                                  す。後者の場合、整数が返されます。(3)
                                     
                                     
‘t1 = t2 % t3’                       剰余が *note timedelta: d98. オブジェクトとして計
                                     算されます。(3)
                                     
                                     
‘q, r = divmod(t1, t2)’              商と剰余が計算されます: ‘q = t1 // t2’ (3) と ‘r
                                     = t1 % t2’ 。‘q’ は整数で ‘r’ は
                                     *note timedelta: d98. オブジェクトです。
                                     
                                     
‘+t1’                                同じ値を持つ *note timedelta: d98. オブジェクトを
                                     返します。(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: d98. オブジェクトの文字列表現を
                                     返します。その文字列は、正規の属性値を持つコンス
                                     トラクタ呼び出しのコードになっています。
                                     

注釈:

  1. この演算は正確ですが、オーバフローするかもしれません。

  2. この演算は正確であり、オーバフローし得ません。

  3. 0 による除算は *note ZeroDivisionError: d15. を送出します。

  4. ‘-timedelta.max’ は *note timedelta: d98. オブジェクトで表現するこ
     とができません。

  5. *note timedelta: d98. オブジェクトの文字列表現は内部表現に類似した
     形に正規化されます。そのため負の 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: d98. オブジェクトは *note date:
494. および *note datetime: 6ed. オブジェクトとの間で加減算をサポートし
ています (下を参照してください)。

バージョン 3.2 で変更: Floor division and true division of a *note
timedelta: d98. object by another ‘timedelta’ object are now supported,
as are remainder operations and the *note divmod(): d6e. function.  True
division and multiplication of a ‘timedelta’ object by a *note float:
32f. object are now supported.

*note timedelta: d98. オブジェクトは等価性と順序の比較をサポートします。

ブール演算コンテキストでは、 *note timedelta: d98. オブジェクトは
‘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: d98. の計算の例です:

     >>> 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: 494. オブジェクトは、両方向に無期限に拡張された現在のグレゴ
リオ暦という理想化された暦の日付 (年月日) を表します。

1 年 1 月 1 日は日番号 1、1 年 1 月 2 日は日番号 2 と呼ばれ、他も同様で
す。 (1)

 -- クラス: datetime.date (year, month, day)

     全ての引数が必須です。 引数は整数で、次の範囲に収まっていなければな
     りません:

        * ‘MINYEAR <= year <= MAXYEAR’

        * ‘1 <= month <= 12’

        * ‘1 <= day <= 指定された月と年における日数’

     範囲を超えた引数を与えた場合、 *note ValueError: 15a. が送出されま
     す。

他のコンストラクタ、および全てのクラスメソッドを以下に示します:

 -- メソッド: 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(): 764.

     timestamp がプラットフォームの C 関数 ‘localtime()’ がサポートする
     値の範囲から外れていた場合、 *note OverflowError: c5b. を送出するか
     もしれません。また ‘localtime()’ 呼び出しが失敗した場合には *note
     OSError: 543. を送出するかもしれません。この範囲は通常は 1970 年か
     ら 2038 年までに制限されています。タイムスタンプの表記にうるう秒を
     含める非 POSIX なシステムでは、うるう秒は *note fromtimestamp():
     f96. では無視されます。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘localtime()’ のサポートする値の範囲から外れていた場合、 *note
     ValueError: 15a. ではなく *note OverflowError: c5b. を送出するよう
     になりました。 ‘localtime()’ の呼び出し失敗で ‘ValueError’ ではなく
     *note OSError: 543. を送出するようになりました。

     バージョン 3.15 で変更: Accepts any real number as 'timestamp', not
     only integer or float.

 -- メソッド: 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: 15a. が送出されます。 任意の日付 ‘d’ に対し、
     ‘date.fromordinal(d.toordinal()) == d’ となります。

 -- メソッド: classmethod date.fromisoformat (date_string)

     以下の例外を除く、有効な ISO 8601 フォーマットで与えられた
     'date_string' に対応する *note date: 494. を返します :

       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: 494. corresponding to the ISO calendar date
     specified by 'year', 'week' and 'day'.  This is the inverse of the
     function *note date.isocalendar(): cc9.

     Added in version 3.8.

 -- メソッド: classmethod date.strptime (date_string, format)

     Return a *note date: 494. 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(): 17e5. で構文解析で
     きない場合や、この関数が時刻タプルを返してこない場合には *note
     ValueError: 15a. を送出します。*note strftime() and strptime()
     behavior: 1d71. および *note date.fromisoformat(): a0d. も参照して
     ください。

          注釈: If 'format' specifies a day of month (‘%d’) without a
          year, *note ValueError: 15a. is raised.  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.  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: 2ac6. から *note MAXYEAR: 2ac7. までの
     値です。

 -- の属性: 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: 2ac6. になってしまったり、 *note MAXYEAR: 2ac7. より大きく
     なってしまう場合には *note OverflowError: c5b. が送出されます。

  2. ‘timedelta.seconds’ と ‘timedelta.microseconds’ は無視されます。

  3. この演算は厳密で、オーバフローしません。‘timedelta.seconds’ および
     ‘timedelta.microseconds’ は 0 で、演算後には ‘date2 + timedelta ==
     date1’ となります。

  4. 同じ日を表す *note date: 494. オブジェクトは等しいです。

     *note datetime: 6ed. のインスタンスではない ‘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: 494. object that is not also
     a *note datetime: 6ed. instance and a ‘datetime’ object raises
     *note TypeError: 29c.

バージョン 3.13 で変更: Comparison between *note datetime: 6ed. object
and an instance of the *note date: 494. 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: 495. オブジェクトは真とみ
なされます。

インスタンスメソッド:

 -- メソッド: date.replace (year=self.year, month=self.month,
          day=self.day)

     Return a new *note date: 494. 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(): 461. also supports *note
     date: 494. objects.

 -- メソッド: date.timetuple ()

     *note time.localtime(): 18b1. が返すような *note time.struct_time:
     10ab. を返します。

     時分秒が 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: 494. オブジェクト ‘d’ について、
     ‘date.fromordinal(d.toordinal()) == d’ となります。

 -- メソッド: date.weekday ()

     月曜日を 0、日曜日を 6 として、曜日を整数で返します。例えば、
     ‘date(2002, 12, 4).weekday() == 2’ であり、水曜日を示します。 *note
     isoweekday(): 2aec. も参照してください。

 -- メソッド: date.isoweekday ()

     月曜日を 1,日曜日を 7 として、曜日を整数で返します。例えば、
     ‘date(2002, 12, 4).isoweekday() == 3’ であり、水曜日を示します。
     *note weekday(): 2aeb, *note isocalendar(): cc9. も参照してください
     。

 -- メソッド: date.isocalendar ()

     ‘year’、‘week’、‘weekday’ の3つで構成された *note named tuple: a42.
     を返します。

     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: a42. へ
     変更されました。

 -- メソッド: date.isoformat ()

     日付を ISO 8601 書式の ‘YYYY-MM-DD’ で表した文字列を返します:

          >>> import datetime as dt
          >>> dt.date(2002, 12, 4).isoformat()
          '2002-12-04'

 -- メソッド: date.__str__ ()

     *note date: 494. オブジェクト ‘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(): 2af0. に呼び出され、
     *note date.ctime(): 2aef. に呼び出されない) ネイティブの C 関数
     ‘ctime()’ が C 標準に準拠しているプラットフォーム上でです。

 -- メソッド: date.strftime (format)

     明示的な書式文字列で制御された、日付を表現する文字列を返します。 時
     間、分、秒を表す書式コードは値 0 になります。 *note strftime() and
     strptime() behavior: 1d71. および *note date.isoformat(): 2aed. も
     参照してください。

 -- メソッド: date.__format__ (format)

     *note date.strftime(): 1056. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 441. の中や *note str.format():
     a17. を使っているときに *note date: 494. オブジェクトの書式文字列を
     指定できます。 *note strftime() and strptime() behavior: 1d71. およ
     び *note date.isoformat(): 2aed. も参照してください。

* 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: 494. を使う例:

     >>> 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: 6ed. オブジェクトは *note date: 494. オブジェクトおよび
*note time: 495. オブジェクトの全ての情報が入っている単一のオブジェクト
です。

Like a *note date: 494. object, *note datetime: 6ed. assumes the current
Gregorian calendar extended in both directions; like a *note time: 495.
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: 9dd. サブクラスのインスタンスです。 残りの引数は次の
     範囲の整数でなければなりません:

        * ‘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: 15a. が送出されま
     す。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

他のコンストラクタ、および全てのクラスメソッドを以下に示します:

 -- メソッド: classmethod datetime.today ()

     *note tzinfo: 2ad8. が ‘None’ である現在のローカルの日付および時刻
     を返します。

     次と等価です:

          datetime.fromtimestamp(time.time())

     *note now(): 8ff, *note fromtimestamp(): 900. も参照してください。

     このメソッドの機能は *note now(): 8ff. と等価ですが、 ‘tz’ 引数はあ
     りません。

 -- メソッド: classmethod datetime.now (tz=None)

     現在のローカルな日時を返します。

     オプションの引数 'tz' が ‘None’ であるか指定されていない場合、この
     メソッドは *note today(): 2af5. と同様ですが、可能ならば *note
     time.time(): 764. タイムスタンプを通じて得ることができる、より高い
     精度で時刻を提供します (例えば、プラットフォームが C 関数
     ‘gettimeofday()’ をサポートする場合には可能なことがあります)。

     'tz' が ‘None’ でない場合、 'tz' は *note tzinfo: 9dd. のサブクラス
     のインスタンスでなければならず、現在の日付および時刻は 'tz' のタイ
     ムゾーンに変換されます。

     *note today(): 2af5. および *note utcnow(): 336. よりもこの関数を使
     う方が好ましいです。

          注釈: Subsequent calls to ‘datetime.now()’ may return the same
          instant depending on the precision of the underlying clock.

 -- メソッド: classmethod datetime.utcnow ()

     *note tzinfo: 2ad8. が ‘None’ である現在の UTC の日付および時刻を返
     します。

     このメソッドは *note now(): 8ff. と似ていますが、 naive な *note
     datetime: 6ed. オブジェクトとして現在の 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(): 8ff. with *note
     UTC: 901. instead.

 -- メソッド: classmethod datetime.fromtimestamp (timestamp, tz=None)

     *note time.time(): 764. が返すような、 POSIX タイムスタンプに対応す
     るローカルな日付と時刻を返します。オプションの引数 'tz' が ‘None’ で
     あるか、指定されていない場合、タイムスタンプはプラットフォームのロ
     ーカルな日付および時刻に変換され、返される *note datetime: 6ed. オ
     ブジェクトは naive なものになります。

     'tz' が ‘None’ でない場合、 'tz' は *note tzinfo: 9dd. のサブクラス
     のインスタンスでなければならず、タイムスタンプは 'tz' のタイムゾー
     ンに変換されます。

     タイムスタンプがプラットフォームの C 関数 ‘localtime()’ や
     ‘gmtime()’ でサポートされている範囲を超えた場合、 *note
     fromtimestamp(): 900. は *note OverflowError: c5b. を送出することが
     あります。この範囲はよく 1970 年から 2038 年に制限されています。 ま
     た ‘localtime()’ や ‘gmtime()’ が失敗した際は *note OSError: 543. を
     送出します。 うるう秒がタイムスタンプの概念に含まれている非 POSIX シ
     ステムでは、 ‘fromtimestamp()’ はうるう秒を無視します。 このため、
     秒の異なる二つのタイムスタンプが同一の *note datetime: 6ed. オブジ
     ェクトとなることが起こり得ます。 *note utcfromtimestamp(): 337. よ
     りも、このメソッドの方が好ましいです。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘localtime()’ もしくは ‘gmtime()’ のサポートする値の範囲から外れて
     いた場合、 *note ValueError: 15a. ではなく *note OverflowError:
     c5b. を送出するようになりました。 ‘localtime()’ もしくは ‘gmtime()’
     の呼び出し失敗で ‘ValueError’ ではなく *note OSError: 543. を送出す
     るようになりました。

     バージョン 3.6 で変更: *note fromtimestamp(): 900. は *note fold:
     1019. を1にしてインスタンスを返します。

     バージョン 3.15 で変更: Accepts any real number as 'timestamp', not
     only integer or float.

 -- メソッド: classmethod datetime.utcfromtimestamp (timestamp)

     POSIX タイムスタンプに対応する、*note tzinfo: 2ad8. が ‘None’ の
     UTC での *note datetime: 6ed. を返します。(返されるオブジェクトは
     naive です。)

     タイムスタンプがプラットフォームにおける C 関数 ‘localtime()’ でサ
     ポートされている範囲を超えている場合には *note OverflowError: c5b.
     を、‘gmtime()’ が失敗した場合には *note OSError: 543. を送出します
     。 これはたいてい 1970 年から 2038 年に制限されています。

     aware な *note datetime: 6ed. オブジェクトを得るには *note
     fromtimestamp(): 900. を呼んでください:

          datetime.fromtimestamp(timestamp, timezone.utc)

     POSIX 互換プラットフォームでは、これは以下の表現と等価です:

          datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)

     後者を除き、式は常に年の全範囲 (*note MINYEAR: 2ac6. から *note
     MAXYEAR: 2ac7. を含みます) をサポートします。

          警告: naive な ‘datetime’ オブジェクトは多くの ‘datetime’ メソ
          ッドでローカルな時間として扱われるため、 aware な datetime を
          使って UTC の時刻を表すのが好ましいです。 そのため、 UTC での
          ある特定のタイムスタンプを表すオブジェクトの作成では
          ‘datetime.fromtimestamp(timestamp, tz=timezone.utc)’ を呼び出
          す方法が推奨されます。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘gmtime()’ のサポートする値の範囲から外れていた場合、 *note
     ValueError: 15a. ではなく *note OverflowError: c5b. を送出するよう
     になりました。 ‘gmtime()’ の呼び出し失敗で ‘ValueError’ ではなく
     *note OSError: 543. を送出するようになりました。

     バージョン 3.15 で変更: Accepts any real number as 'timestamp', not
     only integer or float.

     バージョン 3.12 で非推奨: Use *note datetime.fromtimestamp(): 900.
     with *note UTC: 901. instead.

 -- メソッド: classmethod datetime.fromordinal (ordinal)

     1 年 1 月 1 日を序数 1 とする早期グレゴリオ暦序数に対応する *note
     datetime: 6ed. オブジェクトを返します。 ‘1 <= ordinal <=
     datetime.max.toordinal()’ でなければ *note ValueError: 15a. が送出
     されます。 返されるオブジェクトの時間、分、秒、およびマイクロ秒はす
     べて 0 で、 *note tzinfo: 2ad8. は ‘None’ となっています。

 -- メソッド: classmethod datetime.combine (date, time,
          tzinfo=time.tzinfo)

     Return a new *note datetime: 6ed. object whose date components are
     equal to the given *note date: 494. object's, and whose time
     components are equal to the given *note time: 495. object's.  If
     the 'tzinfo' argument is provided, its value is used to set the
     *note tzinfo: 2ad8. attribute of the result, otherwise the *note
     tzinfo: 2ad0. 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: 6ed. 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: 6ed. を返します :

       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(): 2aed. or
     *note datetime.isoformat(): ef3.

 -- メソッド: classmethod datetime.fromisocalendar (year, week, day)

     Return a *note datetime: 6ed. 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(): cca.

     Added in version 3.8.

 -- メソッド: classmethod datetime.strptime (date_string, format)

     'date_string' に対応した *note datetime: 6ed. を返します。 'format'
     にしたがって構文解析されます。

     'format' がマイクロ秒やタイムゾーン情報を含まない場合は、以下と等価
     です:

          datetime(*(time.strptime(date_string, format)[0:6]))

     date_string と format が *note time.strptime(): 17e5. で構文解析で
     きない場合や、この関数が時刻タプルを返してこない場合には *note
     ValueError: 15a. を送出します。*note strftime() and strptime()
     behavior: 1d71. および *note datetime.fromisoformat(): a0f. も参照
     してください。

     バージョン 3.15 で変更: If 'format' specifies a day of month (‘%d’)
     without a year, *note ValueError: 15a. is raised.  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.  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: 6ed. で、 ‘datetime(MINYEAR, 1,
     1, tzinfo=None)’ です。

 -- の属性: datetime.max

     表現できる最も新しい *note datetime: 6ed. で、 ‘datetime(MAXYEAR,
     12, 31, 23, 59, 59, 999999, tzinfo=None)’ です。

 -- の属性: datetime.resolution

     等しくない *note datetime: 6ed. オブジェクト間の最小の差で、
     ‘timedelta(microseconds=1)’ です。

インスタンスの属性 (読み出しのみ):

 -- の属性: datetime.year

     両端値を含む *note MINYEAR: 2ac6. から *note MAXYEAR: 2ac7. までの
     値です。

 -- の属性: 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: 6ed. コンストラクタに '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: 2ad8. 属
     性を持ち、演算後には ‘datetime2 - datetime1 == timedelta’ となりま
     す。 ‘datetime2.year’ が *note MINYEAR: 2ac6. よりも小さいか、
     *note MAXYEAR: 2ac7. より大きい場合には *note OverflowError: c5b. が
     送出されます。 入力が aware なオブジェクトの場合でもタイムゾーン修
     正は全く行われません。

  2. ‘datetime2 + timedelta == datetime1’ となるような ‘datetime2’ を計
     算します。 ちなみに、結果は入力の datetime と同じ *note tzinfo:
     2ad8. 属性を持ち、入力が aware だとしてもタイムゾーン修正は全く行わ
     れません。

  3. Subtraction of a *note datetime: 6ed. 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: 29c. is raised.

     If both are naive, or both are aware and have the same *note
     tzinfo: 2ad8. attribute, the ‘tzinfo’ attributes are ignored, and
     the result is a *note timedelta: d98. 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: 2ad8.
     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: 6ed. オブジェクトはタイムゾーンを考慮して同じ日付と
     時刻を表す場合、等しいです。

     Naive and aware *note datetime: 6ed. objects are never equal.

     If both comparands are aware, and have the same ‘tzinfo’ attribute,
     the ‘tzinfo’ and *note fold: 1019. attributes are ignored and the
     base datetimes are compared.  If both comparands are aware and have
     different *note tzinfo: 2ad8. attributes, the comparison acts as
     comparands were first converted to UTC datetimes except that the
     implementation never overflows.  *note datetime: 6ed. 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: 6ed.
     objects raises *note TypeError: 29c.

     If both comparands are aware, and have the same ‘tzinfo’ attribute,
     the ‘tzinfo’ and *note fold: 1019. attributes are ignored and the
     base datetimes are compared.  If both comparands are aware and have
     different *note tzinfo: 2ad8. attributes, the comparison acts as
     comparands were first converted to UTC datetimes except that the
     implementation never overflows.

バージョン 3.3 で変更: aware な *note datetime: 6ed. インスタンスと
naive な ‘datetime’ インスタンスの等価比較では *note TypeError: 29c. は
送出されません。

バージョン 3.13 で変更: Comparison between *note datetime: 6ed. object
and an instance of the *note date: 494. 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: 494. オブジェクトを返します。

 -- メソッド: datetime.time ()

     同じhour、minute、second、microsecond 及び foldを持つ *note time:
     495. オブジェクトを返します。 *note tzinfo: 2ad8. は ‘None’ です。
     *note timetz(): 2afb. も参照してください。

     バージョン 3.6 で変更: 値 foldは返される *note time: 495. オブジェ
     クトにコピーされます。

 -- メソッド: datetime.timetz ()

     同じhour、minute、second、microsecond、fold および tzinfo 属性を持
     つ *note time: 495. オブジェクトを返します。 *note time(): f7. メソ
     ッドも参照してください。

     バージョン 3.6 で変更: 値 foldは返される *note time: 495. オブジェ
     クトにコピーされます。

 -- メソッド: 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: 33. 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: 6ed. オブジェクトは汎用的な関数 *note
     copy.replace(): 461. にもサポートされています。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

 -- メソッド: datetime.astimezone (tz=None)

     'tz' を新たに *note tzinfo: 2ad8. 属性 として持つ *note datetime:
     6ed. オブジェクトを返します。 日付および時刻データを調整して、返り
     値が 'self' と同じ UTC 時刻を持ち、 'tz' におけるローカルな時刻を表
     すようにします。

     もし与えられた場合、 'tz' は *note tzinfo: 9dd. のサブクラスのイン
     スタンスでなければならず、 インスタンスの *note utcoffset(): 2afc.
     および *note dst(): 2afd. メソッドは ‘None’ を返してはなりません。
     もし 'self' が naive ならば、おそらくシステムのタイムゾーンで時間を
     表現します。

     引数無し (もしくは ‘tz=None’ の形 ) で呼び出された場合、システムの
     ローカルなタイムゾーンが変更先のタイムゾーンだと仮定されます。 変換
     後の datetime インスタンスの ‘.tzinfo’ 属性には、 OS から取得したゾ
     ーン名とオフセットを持つ *note timezone: 147f. インスタンスが設定さ
     れます。

     ‘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: 147f. オブジェクト 'tz' を *note datetime: 33.
     オブジェクト 'dt' に追加したいだけで、日付や時刻データへの調整を行
     わないのなら、‘dt.replace(tzinfo=tz)’ を使ってください。単に aware
     な ‘datetime’ オブジェクト 'dt' から ‘timezone’ オブジェクトを除去
     したいだけで、日付や時刻データの変換を行わないのなら、
     ‘dt.replace(tzinfo=None)’ を使ってください。

     デフォルトの *note tzinfo.fromutc(): 2afe. メソッドを *note tzinfo:
     9dd. のサブクラスで上書きして, *note astimezone(): d99. が返す結果
     に影響を及ぼすことができます。エラーの場合を無視すると、
     ‘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(): d99. メ
     ソッドを naive なインスタンスに対して呼び出せるようになりました。こ
     れは、システムのローカルな時間を表現していると想定されます。

 -- メソッド: datetime.utcoffset ()

     *note tzinfo: 2ad8. が ‘None’ の場合、 ‘None’ を返し、そうでない場
     合には ‘self.tzinfo.utcoffset(self)’ を返します。 後者の式が ‘None’
     あるいは 1 日以下の大きさを持つ *note timedelta: d98. オブジェクト
     のいずれかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: datetime.dst ()

     *note tzinfo: 2ad8. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.dst(self)’ を返します。 後者の式が ‘None’ もしく
     は、1 日未満の大きさを持つ *note timedelta: d98. オブジェクトのいず
     れかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: datetime.tzname ()

     *note tzinfo: 2ad8. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.tzname(self)’ を返します。 後者の式が ‘None’ か文
     字列オブジェクトのいずれかを返さない場合には例外を送出します。

 -- メソッド: datetime.timetuple ()

     *note time.localtime(): 18b1. が返すような *note time.struct_time:
     10ab. を返します。

     ‘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: 2b01. フラグは *note dst(): 2afd. メソッドに従っ
     て設定されます: *note tzinfo: 2ad8. が ‘None’ か ‘dst()’ が ‘None’
     を返す場合、 ‘tm_isdst’ は ‘-1’ に設定されます; そうでない場合、
     ‘dst()’ がゼロでない値を返すと ‘tm_isdst’ は1となります; それ以外の
     場合には ‘tm_isdst’ は0に設定されます。

 -- メソッド: datetime.utctimetuple ()

     If *note datetime: 6ed. instance ‘d’ is naive, this is the same as
     ‘d.timetuple()’ except that *note tm_isdst: 2b01. 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: 10ab. for the
     normalized time is returned.  ‘tm_isdst’ is forced to 0.  Note that
     an *note OverflowError: c5b. 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(): 2b02. は誤解を招きやすい返り値を返す
          かもしれません。 UTC を表す naive な ‘datetime’ があった場合、
          *note datetime.timetuple(): 2b00. が使えるところでは
          ‘datetime.replace(tzinfo=timezone.utc)’ で aware にします。

 -- メソッド: datetime.toordinal ()

     先発グレゴリオ暦における日付序数を返します。
     ‘self.date().toordinal()’ と同じです。

 -- メソッド: datetime.timestamp ()

     *note datetime: 6ed. インスタンスに対応する POSIX タイムスタンプを
     返します。 返り値は *note time.time(): 764. で返される値に近い
     *note float: 32f. です。

     Naive *note datetime: 6ed. instances are assumed to represent local
     time and this method relies on platform C functions to perform the
     conversion.  Since ‘datetime’ supports a wider range of values than
     the platform C functions on many platforms, this method may raise
     *note OverflowError: c5b. or *note OSError: 543. for times far in
     the past or far in the future.

     aware な *note datetime: 6ed. インスタンスに対しては以下のように返
     り値が計算されます:

          (dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()

          注釈: UTC 時刻を表す naive な *note datetime: 6ed. インスタン
          スから直接 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: 1019. attribute to disambiguate the times during a repeated
     interval.

     バージョン 3.6 で変更: This method no longer relies on the platform
     C ‘mktime()’ function to perform conversions.

 -- メソッド: datetime.weekday ()

     月曜日を 0、日曜日を 6 として、曜日を整数で返します。
     ‘self.date().weekday()’ と同じです。 *note isoweekday(): 2b05. も参
     照してください。

 -- メソッド: datetime.isoweekday ()

     月曜日を 1、日曜日を 7 として、曜日を整数で返します。
     ‘self.date().isoweekday()’ と等価です。 *note weekday(): 2b04. 、
     *note isocalendar(): cca. も参照してください。

 -- メソッド: datetime.isocalendar ()

     ‘year’、‘week’、‘weekday’ の3つで構成された *note named tuple: a42.
     を返します。 ‘self.date().isocalendar()’ と等価です。

 -- メソッド: datetime.isoformat (sep='T', timespec='auto')

     日時を ISO 8601 書式で表した文字列で返します:

        - *note microsecond: 2ad7. が 0 でない場合は
          ‘YYYY-MM-DDTHH:MM:SS.ffffff’

        - *note microsecond: 2ad7. が 0 の場合は ‘YYYY-MM-DDTHH:MM:SS’

     *note utcoffset(): 2afc. が ‘None’ を返さない場合は、文字列の後ろに
     UTC オフセットが追記されます:

        - *note microsecond: 2ad7. が 0 でない場合は
          ‘YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]’

        - *note microsecond: 2ad7. が 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: 2ad7. が0である場合 ‘'seconds'’ と
          等しく、そうでない場合は ‘'microseconds'’ と等しくなります。

        - ‘'hours'’: *note hour: 2ad4. を2桁の ‘HH’ 書式で含めます。

        - ‘'minutes'’: *note hour: 2ad4. および *note minute: 2ad5. を
          ‘HH:MM’ の書式で含めます。

        - ‘'seconds'’: *note hour: 2ad4. 、 *note minute: 2ad5. 、 *note
          second: 2ad6. を ‘HH:MM:SS’ の書式で含めます。

        - ‘'milliseconds'’: 全ての時刻を含みますが、小数第二位をミリ秒に
          切り捨てます。 ‘HH:MM:SS.sss’ の書式で表現します。

        - ‘'microseconds'’: 全ての時刻を ‘HH:MM:SS.mmmmmm’ の書式で含め
          ます。

          注釈: 除外された要素は丸め込みではなく、切り捨てされます。

     不正な 'timespec' 引数には *note ValueError: 15a. があげられます:

          >>> 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: 6ed. 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(): 2af0. に呼び出され、
     *note datetime.ctime(): 2b07. に呼び出されない) ネイティブの C 関数
     ‘ctime()’ が C 標準に準拠しているプラットフォーム上でです。

 -- メソッド: datetime.strftime (format)

     明示的な書式文字列で制御された、日付および時刻を表現する文字列を返
     します。*note strftime() and strptime() behavior: 1d71. および
     *note datetime.isoformat(): ef3. も参照してください。

 -- メソッド: datetime.__format__ (format)

     *note datetime.strftime(): 1055. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 441. の中や *note str.format():
     a17. を使っているときに *note datetime: 6ed. オブジェクトの書式文字
     列を指定できます。 *note strftime() and strptime() behavior: 1d71.
     および *note datetime.isoformat(): ef3. も参照してください。

* 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: 6ed. オブジェクトを使う例:

     >>> 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:
9dd. のサブクラスを定義しています:

     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: 495. オブジェクトは (ローカルの) 日中時刻を表現します。 この
時刻表現は特定の日の影響を受けず、 *note tzinfo: 9dd. オブジェクトを介し
た修正の対象となります。

 -- クラス: datetime.time (hour=0, minute=0, second=0, microsecond=0,
          tzinfo=None, *, fold=0)

     全ての引数はオプションです。 'tzinfo' は ‘None’ または *note
     tzinfo: 9dd. クラスのサブクラスのインスタンスにすることができます。
     残りの引数は整数で、以下のような範囲に入らなければなりません:

        * ‘0 <= hour < 24’,

        * ‘0 <= minute < 60’,

        * ‘0 <= second < 60’,

        * ‘0 <= microsecond < 1000000’,

        * ‘fold in [0, 1]’.

     引数がこれらの範囲外にある場合、 *note ValueError: 15a. が送出され
     ます。 'tzinfo' のデフォルト値が ‘None’ である以外のデフォルト値は
     0です。

以下にクラス属性を示します:

 -- の属性: time.min

     表現できる最も古い *note time: 495. で、 ‘time(0, 0, 0, 0)’ です。

 -- の属性: time.max

     表現できる最も新しい *note time: 495. で、 ‘time(23, 59, 59,
     999999)’ です。

 -- の属性: time.resolution

     等しくない *note time: 495. オブジェクト間の最小の差で、
     ‘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: 495. コンストラクタに 'tzinfo' 引数として与えられたオブ
     ジェクトになり、何も渡されなかった場合には ‘None’ になります。

 -- の属性: time.fold

     ‘[0, 1]’ のどちらかです。 繰り返し期間中の実時間の曖昧さ除去に使わ
     れます。 (繰り返し期間は、夏時間の終わりに時計が巻き戻るときや、現
     在のゾーンの UTC オフセットが政治的な理由で減少するときに発生します
     。) 0または1という値は、同じ実時間で表現される 2 つの時刻のうちのそ
     れぞれ早い方または遅い方を表します。

     Added in version 3.6.

*note time: 495. 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: 29c.

比較対象が両方とも aware であり、同じ *note tzinfo: 2ad0. 属性を持つ場合
、 ‘tzinfo’ と ‘fold’ 属性は無視され時間だけで比較が行われます。比較対象
が両方とも aware であり、異なる ‘tzinfo’ 属性を持つ場合、まず最初に
(‘self.utcoffset()’ で取得できる) それぞれの UTC オフセットを引く調整が
行われます。

バージョン 3.3 で変更: aware な インスタンスと naive な *note time: 495.
インスタンスの等価比較では *note TypeError: 29c. は送出されません。

ブール値の文脈では、 *note time: 495. オブジェクトは常に真とみなされます
。

バージョン 3.5 で変更: Before Python 3.5, a *note time: 495. 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: 495. を返します :

       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(): 2b0f.

 -- メソッド: classmethod time.strptime (date_string, format)

     Return a *note time: 495. corresponding to 'date_string', parsed
     according to 'format'.

     'format' がマイクロ秒やタイムゾーン情報を含まない場合は、以下と等価
     です:

          time(*(time.strptime(date_string, format)[3:6]))

     *note ValueError: 15a. is raised if the 'date_string' and 'format'
     cannot be parsed by *note time.strptime(): 17e5. or if it returns a
     value which is not a time tuple.  See also *note strftime() and
     strptime() behavior: 1d71. and *note time.fromisoformat(): a0e.

     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: 495. 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: 495. オブジェクトは汎用的な関数 *note copy.replace():
     461. にもサポートされています。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

 -- メソッド: time.isoformat (timespec='auto')

     時刻を ISO 8601 書式で表した次の文字列のうち1つを返します:

        - *note microsecond: 2acf. が 0 でない場合は ‘HH:MM:SS.ffffff’

        - *note microsecond: 2acf. が 0 の場合は ‘HH:MM:SS’

        - *note utcoffset(): 2b10. が ‘None’ を返さない場合、
          ‘HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]’

        - *note microsecond: 2acf. が 0 で *note utcoffset(): 2b10. が
          ‘None’ を返さない場合、 ‘HH:MM:SS+HH:MM[:SS[.ffffff]]’

     オプション引数 'timespec' は、含める追加の時間の要素の数を指定しま
     す(デフォルトでは ‘'auto'’ です)。以下の内一つを指定してください。

        - ‘'auto'’: *note microsecond: 2acf. が0である場合 ‘'seconds'’ と
          等しく、そうでない場合は ‘'microseconds'’ と等しくなります。

        - ‘'hours'’: *note hour: 2acc. を2桁の ‘HH’ 書式で含めます。

        - ‘'minutes'’: *note hour: 2acc. および *note minute: 2acd. を
          ‘HH:MM’ の書式で含めます。

        - ‘'seconds'’: *note hour: 2acc. 、 *note minute: 2acd. 、 *note
          second: 2ace. を ‘HH:MM:SS’ の書式で含めます。

        - ‘'milliseconds'’: 全ての時刻を含みますが、小数第二位をミリ秒に
          切り捨てます。 ‘HH:MM:SS.sss’ の書式で表現します。

        - ‘'microseconds'’: 全ての時刻を ‘HH:MM:SS.mmmmmm’ の書式で含め
          ます。

          注釈: 除外された要素は丸め込みではなく、切り捨てされます。

     不正な 'timespec' 引数には *note ValueError: 15a. があげられます。

     以下はプログラム例です:

          >>> 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: 1d71. および *note
     time.isoformat(): 2b0f. も参照してください。

 -- メソッド: time.__format__ (format)

     *note time.strftime(): 1d16. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 441. の中や *note str.format():
     a17. を使っているときに *note time: 495. オブジェクトの書式文字列を
     指定できます。 *note strftime() and strptime() behavior: 1d71. およ
     び *note time.isoformat(): 2b0f. も参照してください。

 -- メソッド: time.utcoffset ()

     *note tzinfo: 2ad0. が ‘None’ の場合、 ‘None’ を返し、そうでない場
     合には ‘self.tzinfo.utcoffset(None)’ を返します。 後者の式が ‘None’
     あるいは 1 日以下の大きさを持つ *note timedelta: d98. オブジェクト
     のいずれかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: time.dst ()

     *note tzinfo: 2ad0. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.dst(None)’ を返します。 後者の式が ‘None’ もしく
     は、1 日未満の大きさを持つ *note timedelta: d98. オブジェクトのいず
     れかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: time.tzname ()

     *note tzinfo: 2ad0. が ‘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: 495. オブジェクトを使う例:

     >>> 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: 1574, meaning that this class
     should not be instantiated directly.  Define a subclass of *note
     tzinfo: 9dd. to capture information about a particular time zone.

     An instance of (a concrete subclass of) *note tzinfo: 9dd. can be
     passed to the constructors for *note datetime: 6ed. and *note time:
     495. 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: 9dd. methods needed
     by the *note datetime: 6ed. methods you use.  The ‘datetime’ module
     provides *note timezone: 147f, 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: 9dd. のサブクラス
     は引数なしで呼び出すことのできる *note __init__(): 306. メソッドを
     持たなければなりません。そうでなければ、 pickle 化することはできま
     すがおそらく unpickle 化することはできないでしょう。これは技術的な
     側面からの要求であり、将来緩和されるかもしれません。

     *note tzinfo: 9dd. の具体的なサブクラスでは、以下のメソッドを実装す
     る必要があります。厳密にどのメソッドが必要なのかは、 aware な
     ‘datetime’ オブジェクトがこのサブクラスのインスタンスをどのように使
     うかに依存します。不確かならば、単に全てを実装してください。

 -- メソッド: tzinfo.utcoffset (dt)

     ローカル時間の UTC からのオフセットを、 UTC から東向きを正とした
     *note timedelta: d98. オブジェクトで返します。ローカル時間が UTC の
     西側にある場合、この値は負になります。

     このメソッドは UTC からのオフセットの '総計' を表しています。例えば
     、 *note tzinfo: 9dd. オブジェクトがタイムゾーンと DST 修正の両方を
     表現する場合、 *note utcoffset(): 2b18. はそれらの合計を返さなけれ
     ばなりません。 UTC オフセットが未知である場合、 ‘None’ を返します。
     そうでない場合には、返される値は ‘-timedelta(hours=24)’ から
     ‘timedelta(hours=24)’ までの *note timedelta: d98. 境界を含まないオ
     ブジェクトでなければなりません (オフセットの大きさは 1 日より短くな
     ければなりません)。 ほとんどの ‘utcoffset()’ 実装は、おそらく以下の
     二つのうちの一つに似たものになるでしょう:

          return CONSTANT                 # fixed-offset class
          return CONSTANT + self.dst(dt)  # daylight-aware class

     *note utcoffset(): 2b18. が ‘None’ を返さない場合、 *note dst():
     2b19. も ‘None’ を返してはなりません。

     *note utcoffset(): 2b18. のデフォルトの実装は *note
     NotImplementedError: 5a1. を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: tzinfo.dst (dt)

     夏時間 (DST) 修正を、 *note timedelta: d98. オブジェクトで返します
     。 DST 情報が未知の場合、 ‘None’ が返されます。

     DST が有効でない場合には ‘timedelta(0)’ を返します。 DST が有効の場
     合、オフセットは *note timedelta: d98. オブジェクトで返します (詳細
     は *note utcoffset(): 2b18. を参照してください)。 DST オフセットが
     利用可能な場合、この値は ‘utcoffset()’ が返す UTC からのオフセット
     には既に加算されているため、 DST を個別に取得する必要がない限り
     *note dst(): 2b19. を使って問い合わせる必要はないので注意してくださ
     い。 例えば、 *note datetime.timetuple(): 2b00. は *note tzinfo:
     2ad8. 属性の ‘dst()’ メソッドを呼んで *note tm_isdst: 2b01. フラグ
     がセットされているかどうか判断し、 *note tzinfo.fromutc(): 2afe. は
     ‘dst()’ タイムゾーンを移動する際に DST による変更があるかどうかを調
     べます。

     標準および夏時間の両方をモデル化している *note tzinfo: 9dd. サブク
     ラスのインスタンス 'tz' は以下の式:

     ‘tz.utcoffset(dt) - tz.dst(dt)’

     must return the same result for every *note datetime: 6ed. '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(): d99.
     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(): 2afe. to work correctly
     with ‘astimezone()’ regardless.

     ほとんどの *note dst(): 2b19. 実装は、おそらく以下の二つのうちの一
     つに似たものになるでしょう:

          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(): 2b19. 実装は *note NotImplementedError:
     5a1. を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: tzinfo.tzname (dt)

     Return the time zone name corresponding to the *note datetime: 6ed.
     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: 9dd. 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(): 2b1a. 実装は *note
     NotImplementedError: 5a1. を送出します。

These methods are called by a *note datetime: 6ed. or *note time: 495.
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: 9dd. subclass's methods should
therefore be prepared to accept a 'dt' argument of ‘None’, or of class
‘datetime’.

‘None’ が渡された場合、最良の応答方法を決めるのはクラス設計者次第です。
例えば、このクラスが *note tzinfo: 9dd. プロトコルと関係をもたないという
ことを表明させたければ、 ‘None’ が適切です。標準時のオフセットを見つける
他の手段がない場合には、標準 UTC オフセットを返すために
‘utcoffset(None)’ を使うともっと便利かもしれません。

When a *note datetime: 6ed. object is passed in response to a ‘datetime’
method, ‘dt.tzinfo’ is the same object as 'self'.  *note tzinfo: 9dd.
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: 9dd. の
メソッドがあります:

 -- メソッド: tzinfo.fromutc (dt)

     デフォルトの 実装で呼び出されます。 *note datetime.astimezone():
     d99. から呼ばれた場合、 ‘dt.tzinfo’ は 'self' であり、 'dt' の日付
     および時刻データは UTC 時刻を表しているものとして見えます。 *note
     fromutc(): 2afe. の目的は、 'self' のローカル時刻に等しい *note
     datetime: 33. オブジェクトを返すことにより日付と時刻データメンバを
     修正することにあります。

     ほとんどの *note tzinfo: 9dd. サブクラスではデフォルトの *note
     fromutc(): 2afe. 実装を問題なく継承できます。デフォルトの実装は、固
     定オフセットのタイムゾーンや、標準時と夏時間の両方について記述して
     いるタイムゾーン、そして DST 移行時刻が年によって異なる場合でさえ、
     扱えるくらい強力なものです。デフォルトの ‘fromutc()’ 実装が全ての場
     合に対して正しく扱うことができないような例は、標準時の (UTCからの)
     オフセットが引数として渡された特定の日や時刻に依存するもので、これ
     は政治的な理由によって起きることがあります。デフォルトの *note
     astimezone(): d99. や ‘fromutc()’ の実装は、結果が標準時オフセット
     の変化にまたがる何時間かの中にある場合、期待通りの結果を生成しない
     かもしれません。

     エラーの場合のためのコードを除き、デフォルトの *note fromutc():
     2afe. の実装は以下のように動作します:

          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: 9dd. クラスの例が
いくつか載っています:

     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: 9dd. のサブクラスで
は、夏時間の移行のときに、回避不能の難解な問題が年に 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(): d99. は 2 つの隣り合う UTC 時間を同じローカルの時間に対応
付けて、ローカルの時計の振る舞いを真似ます。 東部の例では、 5:MM および
6:MM という形式の UTC 時刻は両方とも東部時刻に変換された際に 1:MM に対応
付けられますが、それ以前の時間は *note fold: 1019. 属性を 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: 1019. 属性が異なるだけの *note datetime: 6ed. インスタンスは
比較において等しいとみなされることに注意してください。

Applications that can't bear wall-time ambiguities should explicitly
check the value of the *note fold: 1019. attribute or avoid using hybrid
*note tzinfo: 9dd. subclasses; there are no ambiguities when using *note
timezone: 147f, 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: 13d.

          ‘datetime’ モジュールには (UTC からの任意の固定オフセットを扱
          う) 基本的な *note timezone: 147f. クラスと、(UTC ‘timezone’ の
          インスタンスである) *note timezone.utc: a0c. 属性があります。

          ‘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: 147f. クラスは *note tzinfo: 9dd. のサブクラスで、各イン
スタンスは UTC からの固定されたオフセットで定義されたタイムゾーンを表し
ています。

このクラスのオブジェクトは、一年のうち異なる日に異なるオフセットが使われ
ていたり、常用時 (civil time) に歴史的な変化が起きた場所のタイムゾーン情
報を表すのには使えないので注意してください。

 -- クラス: datetime.timezone (offset[, name])

     ローカル時刻と UTC の差分を表す *note timedelta: d98. オブジェクト
     を 'offset' 引数に指定しなくてはいけません。これは
     ‘-timedelta(hours=24)’ から ‘timedelta(hours=24)’ までの両端を含ま
     ない範囲に収まっていなくてはなりません。そうでない場合 *note
     ValueError: 15a. が送出されます。

     'name' 引数は必須ではありません。もし指定された場合、その値は *note
     datetime.tzname(): 2aff. メソッドの返り値として使われる文字列でなけ
     ればなりません。

     Added in version 3.2.

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: timezone.utcoffset (dt)

     *note timezone: 147f. インスタンスが構築されたときに指定された固定
     値を返します。

     'dt' 引数は無視されます。 返り値は、ローカル時刻と UTC の差分に等し
     い *note timedelta: d98. インスタンスです。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: timezone.tzname (dt)

     *note timezone: 147f. インスタンスが構築されたときに指定された固定
     値を返します。

     '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: 6ed. インスタンスでなければなりません
     。

以下にクラス属性を示します:

 -- の属性: 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: 494, *note datetime: 6ed, *note time: 495. オブジェクトは全
て ‘strftime(format)’ メソッドをサポートし、時刻を表現する文字列を明示的
な書式文字列で統制して作成しています。

Conversely, the *note date.strptime(): 493, *note datetime.strptime():
2dd. and *note time.strptime(): 17e5. class methods create an object
from a string representing the time and a corresponding format string.

下の表は *note strftime(): 1055. と *note strptime(): 2dd. との高レベル
の対比を表しています。

                     ‘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 2011 C standard
requires, and these work on all supported platforms.

ディレクティ    意味                                 使用例                       注釈
ブ                                                                                

----------------------------------------------------------------------------------------------
                                                                                  
‘%a’            ロケールの曜日名を短縮形で表示しま        Sun, Mon, ..., Sat (en_US);(1)
                す。                                      So, Mo, ..., Sa (de_DE) 
                                                     
                                                                                  
‘%A’            ロケールの曜日名を表示します。            Sunday, Monday, ..., Saturday (en_US);(1)
                                                          Sonntag, Montag, ..., Samstag (de_DE)
                                                     
                                                                                  
‘%b’            ロケールの月名を短縮形で表示します        Jan, Feb, ..., Dec (en_US);(1)
                。                                        Jan, Feb, ..., Dez (de_DE)
                                                     
                                                                                  
‘%B’            ロケールの月名を表示します。              January, February, ..., December (en_US);(1)
                                                          Januar, Februar, ..., Dezember (de_DE)
                                                     
                                                                                  
‘%c’            ロケールの日時を適切な形式で表しま        Tue Aug 16 21:30:00 1988 (en_US);(1)
                す。                                      Di 16 Aug 21:30:00 1988 (de_DE)
                                                     
                                                                                  
‘%C’            The year divided by 100 and          01, 02, ..., 99              (0)
                truncated to an integer as a                                      
                zero-padded decimal number.
                
                                                                                  
‘%d’            0埋めした10進数で表記した月中の日    01, 02, ..., 31              (9), (10)
                にち。                                                            
                
                                                                                  
‘%D’            Equivalent to ‘%m/%d/%y’.            11/28/25                     (9)
                                                                                  
                                                                                  
‘%e’            The day of the month as a            ␣1, ␣2, ..., 31              (10)
                space-padded decimal number.                                      
                
                                                                                  
‘%F’            Equivalent to ‘%Y-%m-%d’, the ISO    2025-10-11, 1001-12-30
                8601 format.                         
                
                                                                                  
‘%g’            Last 2 digits of ISO 8601 year       00, 01, ..., 99              (0)
                representing the year that                                        
                contains the greater part of the
                ISO week (‘%V’).
                
                                                                                  
‘%G’            ISO week(‘%V’)の内過半数を含む西暦   0001, 0002, ..., 2013,       (8)
                表記の ISO 8601 year です。          2014, ..., 9998, 9999        
                                                     
                                                                                  
‘%h’            Equivalent to ‘%b’.                  See ‘%b’.                    (0)
                                                                                  
                                                                                  
‘%H’            0埋めした10進数で表記した時 (24時    00, 01, ..., 23              (9)
                間表記)。                                                         
                
                                                                                  
‘%I’            0埋めした10進数で表記した時 (12時    01, 02, ..., 12              (9)
                間表記)。                                                         
                
                                                                                  
‘%j’            0埋めした10進数で表記した年中の日    001, 002, ..., 366           (9)
                にち。                                                            
                
                                                                                  
‘%m’            0埋めした10進数で表記した月。        01, 02, ..., 12              (9)
                                                                                  
                                                                                  
‘%M’            0埋めした10進数で表記した分。        00, 01, ..., 59              (9)
                                                                                  
                                                                                  
‘%n’            The newline character (‘'\n'’).      ‘\n’
                For ‘strptime()’, zero or more       
                whitespace.
                
                                                                                  
‘%p’            ロケールの AM もしくは PM と等価な        AM, PM (en_US);         (1), (3)
                文字列になります。                        am, pm (de_DE)          
                                                     
                                                                                  
‘%r’            Locale's 12-hour clock time.         12:00:00 AM                  (1), (0)
                                                                                  
                                                                                  
‘%R’            Equivalent to ‘%H:%M’.               10:01
                                                     
                                                                                  
‘%S’            0埋めした10進数で表記した秒。        00, 01, ..., 59              (4), (9)
                                                                                  
                                                                                  
‘%t’            The tab character (‘'\t'’).  For     ‘\t’
                ‘strptime()’, zero or more           
                whitespace.
                
                                                                                  
‘%T’            ISO 8601 time format, equivalent     10:01:59
                to ‘%H:%M:%S’.                       
                
                                                                                  
‘%u’            1 を月曜日を表す 10進数表記の ISO    1, 2, ..., 7
                8601 weekday です。                  
                
                                                                                  
‘%U’            0埋めした10進数で表記した年中の週    00, 01, ..., 53              (7), (9)
                番号 (週の始まりは日曜日とする)。                                 
                新年の最初の日曜日に先立つ日は 0週
                に属するとします。
                
                                                                                  
‘%V’            週で最初の月曜日を始めとする ISO     01, 02, ..., 53              (8), (9)
                8601 week です。Week 01 は 1月4日                                 
                を含みます。
                
                                                                                  
‘%w’            曜日を10進表記した文字列を表示しま   0, 1, ..., 6
                す。0 が日曜日で、6 が土曜日を表し   
                ます。
                
                                                                                  
‘%W’            0埋めした10進数で表記した年中の週    00, 01, ..., 53              (7), (9)
                番号 (週の始まりは月曜日とする)。                                 
                新年の最初の月曜日に先立つ日は 0週
                に属するとします。
                
                                                                                  
‘%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)        
                                                     
                                                                                  
‘%y’            0埋めした10進数で表記した世紀無し    00, 01, ..., 99              (9)
                の年。                                                            
                
                                                                                  
‘%Y’            西暦 ( 4桁) の 10 進表記を表します   0001, 0002, ..., 2013,       (2)
                。                                   2014, ..., 9998, 9999        
                                                     
                                                                                  
‘%z’            UTCオフセットを                      (空文字列), +0000, -0400,    (6)
                ‘±HHMM[SS[.ffffff]]’ の形式で表示    +1030, +063415,              
                します (オブジェクトがnaiveであれ    -030712.345216
                ば空文字列)。                        
                
                                                                                  
‘%Z’            タイムゾーンの名前を表示します (オ   (空文字列), UTC, GMT         (6)
                ブジェクトがnaiveであれば空文字列                                 
                )。
                
                                                                                  
‘%%’            文字 ‘'%'’ を表します。              %
                                                     

The ISO 8601 year and ISO 8601 week directives are not interchangeable
with the year and week number directives above.  Calling *note
strptime(): 2dd. with incomplete or ambiguous ISO 8601 directives will
raise a *note ValueError: 15a.

Several additional directives not required by the C11 standard are
included for convenience.

ディレクティ    意味                                 使用例                       注釈
ブ                                                                                

----------------------------------------------------------------------------------------------
                                                                                  
‘%f’            10進数で表記したマイクロ秒 (6桁に    000000, 000001, ...,         (5)
                0埋めされます)。                     999999                       
                                                     
                                                                                  
‘%:z’           UTCオフセットを                      (空文字列), +00:00,          (6)
                ‘±HH:MM[:SS[.ffffff]]’ の形式で表    -04:00, +10:30, +06:34:15,   
                示します (オブジェクトがnaiveであ    -03:07:12.345216
                れば空文字列)。                      
                

Python はプラットフォームの C ライブラリの ‘strftime()’ 関数を呼び出して
いて、プラットフォームごとにその実装が異なるのはよくあることなので、サポ
ートされる書式コード全体はプラットフォームごとに様々です。 手元のプラッ
トフォームでサポートされているフォーマット記号全体を見るには、
‘strftime(3)(1)’ のドキュメントを参照してください。 サポートされていない
フォーマット指定子の扱いもプラットフォーム間で差異があります。

Added in version 3.6: ‘%G’, ‘%u’ および ‘%V’ が追加されました。

Added in version 3.12: ‘%:z’ was added for *note strftime(): 1055.

Added in version 3.15: ‘%D’, ‘%F’, ‘%n’, ‘%t’, and ‘%:z’ were added for
*note strptime(): 2dd.

   ---------- 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: f7. モジュールの
‘time.strftime(fmt, d.timetuple())’ のように動作します。ただし全てのオブ
ジェクトが *note timetuple(): 2ae9. メソッドをサポートしているわけではあ
りません。

For the *note datetime.strptime(): 2dd. and *note date.strptime(): 493.
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(): 2dd. and *note date.strptime(): 493. 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: 495. オブジェクトには、年、月、日の値がないため、それらを書
式コードを使うことができません。 無理矢理使った場合、年は1900に置き換え
られ、月と日は1に置き換えられます。

*note date: 494. オブジェクトには、時、分、秒、マイクロ秒の値がないため
、それらの書式コードを使うことができません。 無理矢理使った場合、これら
の値は0に置き換えられます。

同じ理由で、現在のロケールの文字集合で表現できない Unicode コードポイン
トを含む書式文字列の対処もプラットフォーム依存です。 あるプラットフォー
ムではそういったコードポイントはそのまま出力に出される一方、他のプラット
フォームでは ‘strftime’ が *note UnicodeError: 67c. を送出したり、その代
わりに空文字列を返したりするかもしれません。

注釈:

  0. This format code is currently unsupported by *note strptime(): 2dd.

  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(): 2dd. メソッドは [1, 9999] の範囲の年数全てを構文
     解析できますが、 year < 1000 の範囲の年数は 0 埋めされた 4 桁の数字
     でなければなりません。

     バージョン 3.2 で変更: 以前のバージョンでは、 *note strftime():
     1055. メソッドは years >= 1900 の範囲の年数しか扱えませんでした。

     バージョン 3.3 で変更: バージョン 3.2 では、 *note strftime():
     1055. メソッドは years >= 1000 の範囲の年数しか扱えませんでした。

  3. *note strptime(): 2dd. メソッドと共に使われた場合、 ‘%p’ 指定子は出
     力の時間フィールドのみに影響し、 ‘%I’ 指定子が使われたかのように振
     る舞います。

  4. *note time: f7. モジュールと違い、 ‘datetime’ モジュールはうるう秒
     をサポートしていません。

  5. *note strptime(): 2dd. メソッドと共に使われた場合、 ‘%f’ 指定子は 1
     桁から 6 桁の数字を受け付け、右側から0埋めされます。 ‘%f’ は C 標準
     規格の書式文字セットの拡張です (とは言え、 datetime モジュールのオ
     ブジェクトそれぞれに実装されているので、どれででも使えます)。

  6. naive オブジェクトでは、書式コード ‘%z’、‘%:z’ および ‘%Z’ は空文字
     列に置き換えられます。

     aware オブジェクトでは次のようになります:

     ‘%z’

          *note utcoffset(): 2afc. は ‘±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(): 2dd. method, the UTC offsets can have a colon as
     a separator between hours, minutes and seconds.  For example, both
     ‘'+010000'’ and ‘'+01:00:00'’ will be parsed as an offset of one
     hour.  In addition, providing ‘'Z'’ is identical to ‘'+00:00'’.

     ‘%:z’

          When used with *note strftime(): 1055, behaves exactly as
          ‘%z’, except that a colon separator is added between hours,
          minutes and seconds.

          When used with *note strptime(): 2dd, the UTC offset is
          'required' to have a colon as a separator between hours,
          minutes and seconds.  For example, ‘'+01:00:00'’ (but 'not'
          ‘'+010000'’) will be parsed as an offset of one hour.  In
          addition, providing ‘'Z'’ is identical to ‘'+00:00'’.

     ‘%Z’

          In *note strftime(): 1055, ‘%Z’ is replaced by an empty string
          if *note tzname(): 2aff. returns ‘None’; otherwise ‘%Z’ is
          replaced by the returned value, which must be a string.

          *note strptime(): 2dd. は ‘%Z’ に特定の値のみを受け入れます:

            1. 使用しているマシンのロケールによる ‘time.tzname’ の任意の
               値

            2. ハードコードされた値 ‘UTC’ または ‘GMT’

          つまり、日本に住んでいる場合は ‘JST’, ‘UTC’ と ‘GMT’ が有効な
          値であり、 ‘EST’ はおそらく無効な値となります。無効な値の場合
          は ‘ValueError’ を送出します。

     バージョン 3.2 で変更: ‘%z’ 指定子が *note strptime(): 2dd. メソッ
     ドに与えられた場合、 aware な *note datetime: 6ed. オブジェクトが作
     成されます。返り値の ‘tzinfo’ は *note timezone: 147f. インスタンス
     になっています。

  7. *note strptime(): 2dd. メソッドと共に使われた場合、 ‘%U’ と ‘%W’ 指
     定子は、曜日と年(‘%Y’)が指定された場合の計算でのみ使われます。

  8. ‘%U’ および ‘%W’ と同様に、 ‘%V’ は曜日と ISO 年 (‘%G’) が *note
     strptime(): 2dd. の書式文字列の中で指定された場合に計算でのみ使われ
     ます。 ‘%G’ と ‘%Y’ は互いに完全な互換性を持たないことにも注意して
     ください。

  9. *note strptime(): 2dd. メソッドと共に使われるとき、書式 ‘%d’, ‘%m’,
     ‘%H’, ‘%I’, ‘%M’, ‘%S’, ‘%j’, ‘%U’, ‘%W’, ‘%V’ では先行ゼロは任意で
     す。 書式 ‘%y’ では先行ゼロは必須です。

  10. When parsing a month and day using *note strptime(): 2dd, 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.15 で変更: Using ‘%d’ without a year now raises *note
     ValueError: 15a.

     バージョン 3.15 で非推奨、バージョン 3.17 で削除予定: *note
     strptime(): 2dd. calls using a format string containing ‘%e’
     without a year now emit a *note DeprecationWarning: 2d4.

脚注
....


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: 33.

     *note ZoneInfo: cb5. クラスを使用するように設計されたデータ型 *note
     time: 495. と *note datetime: 6ed. を提供します。

tzdata(4) パッケージ

     CPythonコアデベロッパーによってメンテナンスされているファーストパー
     ティーのパッケージ。タイムゾーンデータを供給し、PyPIで配布されてい
     る。

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

* Menu:

* ZoneInfo を使用する::
* データソース::
* ZoneInfo クラス::
* 関数: 関数<3>.
* Globals::
* 例外と警告::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: cb5. は *note datetime.tzinfo: 9dd. 抽象基底クラスの具体
的な実装であり、‘tzinfo’ に指定することを想定しています。コンストラクタ
、*note datetime.replace: 1883. メソッド、*note datetime.astimezone:
d99. メソッドのいずれかで指定します。

     >>> 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: 1019. 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: cb5. will raise *note ZoneInfoNotFoundError: 1a2f.

* 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: 2372. 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: 2372. when not otherwise specified can be
     configured at *note compile time: 2373.

  2. *note TZPATH: 2372. can be configured using *note an environment
     variable: 2b2b.

  3. At *note runtime: 2b2c, the search path can be manipulated using
     the *note reset_tzpath(): 1a1f. 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: 2372. 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: 2371.), which should be a
string delimited by *note os.pathsep: 2341.

On all platforms, the configured value is available as the ‘TZPATH’ key
in *note sysconfig.get_config_var(): 425.


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: 2372. (either at import time or whenever
*note reset_tzpath(): 1a1f. 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: 2341.-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: 2b30, 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(): 1a1f. 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: 9dd. のサブクラス。Calls to the primary
     constructor will always return objects that compare identically;
     put another way, barring cache invalidation via *note
     ZoneInfo.clear_cache(): 1955, 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: 15a. if a non-conforming key is passed.

     ‘key’ に一致するファイルが見つからない場合、コンストラクタは *note
     ZoneInfoNotFoundError: 1a2f. を送出します。

‘ZoneInfo’ クラスには2つの別のコンストラクターがあります:

 -- メソッド: classmethod ZoneInfo.from_file (file_obj, /, key=None)

     file-like オブジェクトが返すbytes（バイナリーモードで開いたファイル
     や *note io.BytesIO: 1258. オブジェクト）から ‘ZoneInfo’ オブジェク
     トを構築します。一次コンストラクタと異なり、常に新規オブジェクトを
     構築します。

     The ‘key’ parameter sets the name of the zone for the purposes of
     *note __str__(): a14. and *note __repr__(): 1c7.

     このコンストラクタで生成したオブジェクトはpickle化できません（*note
     pickling: 2b33. を参照）。

     *note ValueError: 15a. 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: 2b36. 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: 1ea. on a
*note ZoneInfo: cb5. object defaults to using the *note ZoneInfo.key:
2b35. 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(): 462.  ‘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, the ‘posixrules’ or the ‘localtime’ 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: 2b35.

 -- の関数: zoneinfo.reset_tzpath (to=None)

     Sets or resets the time zone search path (*note TZPATH: 2372.) for
     the module.  When called with no arguments, ‘TZPATH’ is set to the
     default value.

     Calling ‘reset_tzpath’ will not invalidate the *note ZoneInfo: cb5.
     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: 904. of strings or
     *note os.PathLike: 1013. and not a string, all of which must be
     absolute paths.  *note ValueError: 15a. 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(): 1a1f, 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: 2b2a.


File: python.info,  Node: 例外と警告,  Prev: Globals,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.9.2.12 例外と警告
...................

 -- 例外: zoneinfo.ZoneInfoNotFoundError

     Raised when construction of a *note ZoneInfo: cb5. object fails
     because the specified key could not be found on the system.  This
     is a subclass of *note KeyError: 7e5.

 -- 例外: zoneinfo.InvalidTZPathWarning

     Raised when *note PYTHONTZPATH: 2b2f. 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(): 2b3f. を用いることで、日
曜日(6)や他の曜日を週の始まりに設定することができます。日付を表す引数は
整数値で与えます。関連する機能として、 *note datetime: 33. と *note
time: f7. モジュールも参照してください。

このモジュールに定義された関数やクラスは理想化されたカレンダー、つまり現
在のグレゴリオ暦を過去と未来両方に無限に拡張したものを使っています。これ
はすべての計算の基礎のカレンダーとなっている、 Dershowitz と Reingold の
本 "Calendrical Calculations" 中の "proleptic Gregorian" のカレンダーの
定義に合致します。ゼロと負の年は ISO 8601 の基準に定められている通りに扱
われます。0 年は 1 BC、-1 年は 2 BC、のように続きます。

 -- クラス: calendar.Calendar (firstweekday=0)

     *note Calendar: 2b40. オブジェクトを作ります。 'firstweekday' は整
     数で週の始まりの曜日を指定するものです。*note MONDAY: 2b41. が ‘0’
     (デフォルト)、*note SUNDAY: 2b42. なら ‘6’ です。

     *note Calendar: 2b40. オブジェクトは整形されるカレンダーのデータを
     準備するために使えるいくつかのメソッドを提供しています。しかし整形
     機能そのものは提供していません。それはサブクラスの仕事なのです。

     *note Calendar: 2b40. 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(): 2b44. and *note getfirstweekday(): 2b45.
          respectively.

      -- メソッド: getfirstweekday ()

          Return an *note int: 32e. for the current first weekday (0-6).

          Identical to reading the *note firstweekday: 2b43. property.

      -- メソッド: setfirstweekday (firstweekday)

          Set the first weekday to 'firstweekday', passed as an *note
          int: 32e. (0-6).

          Identical to setting the *note firstweekday: 2b43. 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: 2b43. property.

      -- メソッド: itermonthdates (year, month)

          'year' 年 'month' (1-12) 月に対するイテレータを返します。 この
          イテレータはその月の全ての日、およびその月が始まる前の日とその
          月が終わった後の日のうち、週の欠けを埋めるために必要な日を
          (*note datetime.date: 494. オブジェクトとして) 返します。

      -- メソッド: itermonthdays (year, month)

          Return an iterator for the month 'month' in the year 'year'
          similar to *note itermonthdates(): fdc, but not restricted by
          the *note datetime.date: 494. 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(): fdc, but not restricted by
          the *note datetime.date: 494. 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(): fdc, but not restricted by
          the *note datetime.date: 494. 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(): fdc, but not restricted by
          the *note datetime.date: 494. 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: 494. オブジェクトからなるリストです。

      -- メソッド: monthdays2calendar (year, month)

          'year' 年 'month' 月の週のリストを返します。週は全て七つの日付
          の数字と曜日を表す数字のタプルからなるリストです。

      -- メソッド: monthdayscalendar (year, month)

          'year' 年 'month' 月の週のリストを返します。週は全て七つの日付
          の数字からなるリストです。

      -- メソッド: yeardatescalendar (year, width=3)

          指定された年のデータを整形に向く形で返します。返される値は月の
          並びのリストです。月の並びは最大で 'width' ヶ月(デフォルトは
          3ヶ月)分です。各月は4ないし6週からなり、各週は1ないし7日からな
          ります。各日は *note datetime.date: 494. オブジェクトです。

      -- メソッド: yeardays2calendar (year, width=3)

          指定された年のデータを整形に向く形で返します (*note
          yeardatescalendar(): 2b4c. と同様です)。週のリストの中が日付の
          数字と曜日の数字のタプルになります。月の範囲外の部分の日付はゼ
          ロです。

      -- メソッド: yeardayscalendar (year, width=3)

          指定された年のデータを整形に向く形で返します (*note
          yeardatescalendar(): 2b4c. と同様です)。週のリストの中が日付の
          数字になります。月の範囲外の日付はゼロです。

 -- クラス: calendar.TextCalendar (firstweekday=0)

     このクラスはプレインテキストのカレンダーを生成するのに使えます。

     *note TextCalendar: 1a5e. インスタンスには以下のメソッドがあります:

      -- メソッド: prweek (theweek, width)

          Print a week's calendar as returned by *note formatweek():
          2b50. and without a final newline.

      -- メソッド: 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(): 2b3f.
          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(): 2b3f. メソッドでセットされた週の最初の曜日
          に依存します。

      -- メソッド: 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(): 2b54. で返されるひと月分のカレンダーを出
          力します。

      -- メソッド: formatyear (theyear, w=2, l=1, c=6, m=3)

          'm' 列からなる一年間のカレンダーを複数行の文字列で返します。任
          意の引数 'w', 'l', 'c' はそれぞれ、日付列の表示幅、各週の行数
          及び月と月の間のスペースの数を変更するためのものです。 *note
          setfirstweekday(): 2b3f. メソッドでセットされた週の最初の曜日
          に依存します。カレンダーを出力できる最初の年はプラットフォーム
          に依存します。

      -- メソッド: pryear (theyear, w=2, l=1, c=6, m=3)

          *note formatyear(): 2b57. で返される一年間のカレンダーを出力し
          ます。

 -- クラス: 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: a6a. can be passed if no style sheet should be
          used.  'encoding' specifies the encoding to be used for the
          output (defaulting to ‘'utf-8'’).

      -- メソッド: 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: 2b5d.

          Added in version 3.7.

      -- の属性: cssclass_month_head

          The month's head CSS class (used by *note formatmonthname():
          2b5c.).  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(): 2b59.).  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(): 2b5a.).  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(): 2b5a.).  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: 1a5e. 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: 20d. 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: 2b41, *note TUESDAY: 2b64, *note WEDNESDAY: 2b65, *note
     THURSDAY: 2b66, *note FRIDAY: 2b67, *note SATURDAY: 2b68. 及び
     *note SUNDAY: 2b42. は便宜上提供されています。例えば、日曜日を週の
     開始日に設定するときは:

          import calendar
          calendar.setfirstweekday(calendar.SUNDAY)

 -- の関数: calendar.firstweekday ()

     現在設定されている週の最初の曜日を返します。

 -- の関数: calendar.isleap (year)

     'year' が閏年なら *note True: fd0. を、そうでなければ *note False:
     ef9. を返します。

 -- の関数: 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(): 2b3f. で設定をし
     ていない限り月曜日から始まります。

 -- の関数: calendar.prmonth (theyear, themonth, w=0, l=0)

     *note month(): 1b46. 関数によって返される月のカレンダーを出力します
     。

 -- の関数: calendar.month (theyear, themonth, w=0, l=0)

     Returns a month's calendar in a multi-line string using the *note
     formatmonth(): 2b54. of the *note TextCalendar: 1a5e. 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(): 2b57. of the *note
     TextCalendar: 1a5e. class.

 -- の関数: calendar.timegm (tuple)

     An unrelated but handy function that takes a time tuple such as
     returned by the *note gmtime(): 157e. function in the *note time:
     f7. 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: 2b41. through *note SUNDAY: 2b42.

     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']

          注意: In locales with alternative month names forms, the
          ‘month_name’ sequence may not be suitable when a month name
          stands by itself and not as part of a date.  For instance, in
          Greek and in many Slavic and Baltic languages, ‘month_name’
          will produce the month in genitive case.  Use *note
          standalone_month_name: 1a5f. for a form suitable for
          standalone use.

 -- データ: 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']

          注意: In locales with alternative month names forms, the
          ‘month_abbr’ sequence may not be suitable when a month name
          stands by itself and not as part of a date.  Use *note
          standalone_month_abbr: 1a60. for a form suitable for
          standalone use.

 -- データ: calendar.standalone_month_name

     A sequence that represents the months of the year in the current
     locale in the standalone form if the locale provides one.  Else it
     is equivalent to *note month_name: 2b76.

     Added in version 3.15.

 -- データ: calendar.standalone_month_abbr

     A sequence that represents the abbreviated months of the year in
     the current locale in the standalone form if the locale provides
     one.  Else it is equivalent to *note month_abbr: 2b77.

     Added in version 3.15.

 -- データ: 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: 331. through *note DECEMBER: 2b81.

     Added in version 3.12.

The ‘calendar’ module defines the following exceptions:

 -- 例外: calendar.IllegalMonthError (month)

     A subclass of *note ValueError: 15a. and *note IndexError: 18ed,
     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: 15a.  New code should avoid catching *note
     IndexError: 18ed.

      -- の属性: month

          The invalid month number.

 -- 例外: calendar.IllegalWeekdayError (weekday)

     A subclass of *note ValueError: 15a, raised when the given weekday
     number is outside of the range 0-6 (inclusive).

      -- の属性: weekday

          The invalid weekday number.

参考
....

*note datetime: 33. モジュール

     *note time: f7. モジュールと似た機能を持った日付と時間用のオブジェ
     クト指向インターフェース。

*note time: f7. モジュール

     時間に関連した低水準の関数群。

* Menu:

* コマンドラインでの使用::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 2b8a. is required
     if *note -locale: 2b88. 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: 2b90. to print the calendar
     for.  Must be a number between 1 and 12.  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: 1ba.

バージョン 3.15 で変更: By default, the month is now also highlighted in
color, and the days of the week are also in color.  This behavior can be
*note controlled using environment variables: 1ba.

'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: 193, *note
list: 4e0, *note set: 432, および *note tuple: 1d9. に代わる、特殊なコン
テナデータ型を実装しています。

*note namedtuple(): 1da.  名前付きフィールドを持つタプルのサブクラスを作成するファクトリ関数
                          
                          
*note deque: 9db.         両端における append や pop を高速に行えるリスト風のコンテナ
                          
                          
*note ChainMap: fdf.      複数のマッピングの一つのビューを作成する辞書風のクラス
                          
                          
*note Counter: 20f.       *note ハッシュ可能: 18e. なオブジェクトを数え上げる辞書のサブクラス
                          
                          
*note OrderedDict: 9da.   項目が追加された順序を記憶する辞書のサブクラス
                          
                          
*note defaultdict: 157a.  ファクトリ関数を呼び出して存在しない値を供給する辞書のサブクラス
                          
                          
*note UserDict: 194e.     辞書のサブクラス化を簡単にする辞書オブジェクトのラッパ
                          
                          
*note UserList: 189c.     リストのサブクラス化を簡単にするリストオブジェクトのラッパ
                          
                          
*note UserString: 1190.   文字列のサブクラス化を簡単にする文字列オブジェクトのラッパ
                          

* Menu:

* ChainMap オブジェクト::
* Counter オブジェクト::
* deque オブジェクト::
* defaultdict オブジェクト::
* namedtuple() 名前付きフィールドを持つタプルのファクトリ関数: namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
* OrderedDict オブジェクト::
* UserDict オブジェクト::
* UserList オブジェクト::
* UserString オブジェクト::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: fdf. クラスは、複数のマッピングを素早く連結し、一つの単
位として扱うために提供されています。これはたいてい、新しい辞書を作成して
*note update(): 181d. を繰り返すよりも早いです。

このクラスはネストされたスコープをシミュレートするのに使え、テンプレート
化に便利です。

 -- クラス: collections.ChainMap (*maps)

     *note ChainMap: fdf. は、複数の辞書やその他のマッピングをまとめて、
     一つの、更新可能なビューを作成します。 'maps' が指定されないなら、
     一つの空辞書が与えられますから、新しいチェーンは必ず一つ以上のマッ
     ピングをもちます。

     根底のマッピングはリストに保存されます。このリストはパブリックで、
     'maps' 属性を使ってアクセスや更新できます。それ以外に状態はありませ
     ん。

     探索は、根底のマッピングをキーが見つかるまで引き続き探します。対し
     て、書き込み、更新、削除は、最初のマッピングのみ操作します。

     *note ChainMap: fdf. は、根底のマッピングを参照によって組み込みます
     。ですから、根底のマッピングの一つが更新されると、その変更は
     ‘ChainMap’ に反映されます。

     通常の辞書のメソッドすべてがサポートされています。さらに、'maps' 属
     性、新しいサブコンテキストを作成するメソッド、最初のマッピング以外
     のすべてにアクセスするためのプロパティがあります:

      -- の属性: maps

          マッピングのユーザがアップデートできるリストです。このリストは
          最初に探されるものから最後に探されるものの順に並んでいます。こ
          れが唯一のソートされた状態であり、変更してマッピングが探される
          順番を変更できます。このリストは常に一つ以上のマッピングを含ん
          でいなければなりません。

      -- メソッド: new_child (m=None, **kwargs)

          新しいマッピングに現在のインスタンスが持つ全てのマッピングを追
          加したものを持つ新しい *note ChainMap: fdf. インスタンスを返し
          ます。 ‘m’ が指定された場合、新しいマッピングのリストの先頭部
          分になります; 指定されない場合は空の辞書が使われます。すなわち
          ‘d.new_child()’ は ‘ChainMap({}, *d.maps)’ と等価になります。
          キーワード引数が指定された場合、それらによって指定されたマッピ
          ングまたは空の辞書が更新されます。このメソッドは、元のマッピン
          グに変更を加えることなく値を更新できるサブコンテキストを生成す
          るのに使われます。

          バージョン 3.4 で変更: オプションの ‘m’ 引数が追加されました。

          バージョン 3.10 で変更: キーワード引数のサポートが追加されまし
          た。

      -- の属性: parents

          現在のインスタンスの最初のマッピング以外のすべてのマッピングを
          含む新しい *note ChainMap: fdf. を返すプロパティです。これは最
          初のマッピングを検索から飛ばすのに便利です。使用例は *note
          nonlocal: 1661. キーワードを *note ネストされたスコープ: 25a0.
          に使う例と似ています。この使用例はまた、組み込み *note
          super(): 44a. 関数にも似ています。 ‘d.parents’ への参照は
          ‘ChainMap(*d.maps[1:])’ と等価です。

     *note ChainMap: fdf. の反復順序は、マッピングを最後から最初へスキャ
     ンして決定されることに注意してください。

          >>> baseline = {'music': 'bach', 'art': 'rembrandt'}
          >>> adjustments = {'art': 'van gogh', 'opera': 'carmen'}
          >>> list(ChainMap(adjustments, baseline))
          ['music', 'art', 'opera']

     これは、末尾のマッピングオブジェクトから始めた一連の *note
     dict.update(): 181d. の呼び出しと同じ順序になります。

          >>> 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(): 12d4. メソッドや *note
     parents: 2ba1. プロパティに似た 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: fdf. を使ってネストされたコンテキストをシミュレートする
パターンの例:

     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: fdf. クラスは、探索はチェーン全体に対して行いますが、更
新 (書き込みと削除) は最初のマッピングに対してのみ行います。しかし、深い
書き込みと削除を望むなら、チェーンの深いところで見つかったキーを更新する
サブクラスを簡単に作れます:

     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: 20f. は *note ハッシュ可能: 18e. なオブジェクトをカ
     ウントする *note dict: 193. のサブクラスです。これは、要素を辞書の
     キーとして保存し、そのカウントを辞書の値として保存するコレクション
     です。カウントは、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: 7e5. を送出する代わりに 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: 20f. は *note dict: 193. のサ
     ブクラスとして要素の挿入順を維持する機能を継承しました。 'Counter'
     オブジェクトに対する数学演算も順序を維持します。結果の順序はまず左
     の被演算子における要素の出現順に従い、その後右の被演算子において要
     素が出現する順序になります。

     カウンタオブジェクトは全ての辞書で利用できるメソッドに加えて、以下
     に示す追加のメソッドをサポートしています。

      -- メソッド: elements ()

          それぞれの要素を、そのカウント分の回数だけ繰り返すイテレータを
          返します。要素は挿入した順番で返されます。ある要素のカウントが
          1 未満なら、 *note elements(): 16bd. はそれを無視します。

               >>> 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(): 16bc. はカウンタの 'すべての' 要素を返し
          ます。等しいカウントの要素は挿入順に並べられます:

               >>> Counter('abracadabra').most_common(3)
               [('a', 5), ('b', 2), ('r', 2)]

      -- メソッド: subtract (**kwargs)

      -- メソッド: subtract (iterable, /, **kwargs)

      -- メソッド: subtract (mapping, /, **kwargs)

          要素から 'iterable' の要素または 'mapping' の要素が引かれます
          。 *note dict.update(): 181d. に似ていますが、カウントを置き換
          えるのではなく引きます。入力も出力も、 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: 20f.
     objects except for these two which work differently for counters:

      -- メソッド: fromkeys (iterable)

          このクラスメソッドは *note Counter: 20f. オブジェクトには実装
          されていません。

      -- メソッド: update (**kwargs)

      -- メソッド: update (iterable, /, **kwargs)

      -- メソッド: update (mapping, /, **kwargs)

          要素が 'iterable' からカウントされるか、別の 'mapping' (やカウ
          ンタ) が追加されます。 *note dict.update(): 181d. に似ています
          が、カウントを置き換えるのではなく追加します。また、
          '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: 20f. オブジェクトを使ったよくあるパターン:

     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: 20f. 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.  Symmetric
difference returns the difference between the maximum and minimum of the
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 below.

     >>> 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                       # max(c[x], d[x]) - min(c[x], d[x])
     Counter({'a': 2, 'b': 1})
     >>> 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 の多重集合操作のサポ
ートが追加されました。

Added in version 3.15: Added support for the symmetric difference
multiset operation, ‘c ^ d’.

     注釈: カウンタはもともと、推移するカウントを正の整数で表すために設
     計されました。しかし、他の型や負の値を必要とするユースケースを不必
     要に排除することがないように配慮されています。このようなユースケー
     スの助けになるように、この節で最低限の範囲と型の制限について記述し
     ます。

        * *note Counter: 20f. クラス自体は辞書のサブクラスで、キーと値に
          制限はありません。値はカウントを表す数であることを意図していま
          すが、値フィールドに任意のものを保存 'できます' 。

        * *note most_common(): 16bc. メソッドが要求するのは、値が順序付
          け可能なことだけです。

        * ‘c[key] += 1’ のようなインプレース演算では、値の型に必要なのは
          足し算と引き算ができることだけです。よって分数、浮動小数点数、
          小数も使え、負の値がサポートされています。これと同じことが、 負
          や 0 の値を入力と出力に許す *note update(): 19a0. と *note
          subtract(): 159d. メソッド にも言えます。

        * 多重集合メソッドは正の値を扱うユースケースに対してのみ設計され
          ています。入力は負や 0 に出来ますが、正の値の出力のみが生成さ
          れます。型の制限はありませんが、値の型は足し算、引き算、比較を
          サポートしている必要があります。

        * *note elements(): 16bd. メソッドは整数のカウントを要求します。
          これは 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(): 163b. を参照してください
     :

          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(): 2ba7. をつかって) 左から右に初期化して返します。
     'iterable' が指定されない場合、新しい deque オブジェクトは空になり
     ます。

     Deque とは、スタックとキューを一般化したものです (この名前は「デッ
     ク」と発音され、これは「double-ended queue」の省略形です)。Deque は
     どちらの側からも append と pop が可能で、スレッドセーフでメモリ効率
     がよく、どちらの方向からもおよそ 'O'(1) のパフォーマンスで実行でき
     ます。

     *note list: 4e0. オブジェクトでも同様の操作を実現できますが、これは
     高速な固定長の操作に特化されており、基礎のデータ表現形式のサイズと
     位置を両方変えるような ‘pop(0)’ や ‘insert(0, v)’ などの操作ではメ
     モリ移動のために 'O'('n') のコストを必要とします。

     'maxlen' が指定されなかったり ‘None’ だった場合、 deque は任意のサ
     イズまで大きくなります。 そうでない場合、 deque のサイズは指定され
     た最大長に制限されます。 長さが制限された deque がいっぱいになると
     、新しい要素を追加するときに追加した要素数分だけ追加したのと反対側
     から要素が捨てられます。 長さが制限された deque は Unix における
     ‘tail’ フィルタと似た機能を提供します。 トランザクションの tracking
     や最近使った要素だけを残したいデータプール (pool of data) などにも
     便利です。

     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: 15a. if not found.

          Added in version 3.5.

      -- メソッド: insert (index, value, /)

          Insert 'value' into the deque at position 'index'.

          挿入によって、長さに制限のある deque の長さが 'maxlen' を超え
          る場合、*note IndexError: 18ed. が発生します。

          Added in version 3.5.

      -- メソッド: pop ()

          deque の右側から要素をひとつ削除し、その要素を返します。要素が
          ひとつも存在しない場合は *note IndexError: 18ed. を発生させま
          す。

      -- メソッド: popleft ()

          deque の左側から要素をひとつ削除し、その要素を返します。要素が
          ひとつも存在しない場合は *note IndexError: 18ed. を発生させま
          す。

      -- メソッド: remove (value, /)

          'value' の最初に現れるものを削除します。要素が見付からないない
          場合は *note ValueError: 15a. を送出します。

      -- メソッド: 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: 32b. 演算子による包含の検
査, ‘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:
9db. に格納することで実装できます。 値は、位置0にある選択中のイテレータ
から取り出されます。 そのイテレータが値を出し切った場合は、 *note
popleft(): 2bad. で除去できます; そうでない場合は、 *note rotate():
1ea5. メソッドで末尾に回せます:

     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(): 1ea5. メソッドは、 *note deque: 9db. のスライスや削除の
機能を提供します。 例えば、 純粋な Python 実装の ‘del d[n]’ は
‘rotate()’ メソッドを頼りに、pop される要素の位置を割り出します:

     def delete_nth(d, n):
         d.rotate(-n)
         d.popleft()
         d.rotate(n)

*note deque: 9db. のスライスの実装でも、同様のアプローチを使います。まず
対象となる要素を *note rotate(): 1ea5. によって deque の左端まで移動させ
てから、 *note popleft(): 2bad. で古い要素を削除します。そして、 *note
extend(): 2baa. で新しい要素を追加したのち、循環を逆にします。このアプロ
ーチをやや変えたものとして、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: 157a. は
     組み込みの *note dict: 193. クラスのサブクラスです。これはメソッド
     をひとつオーバーライドし、書き込み可能なインスタンス変数をひとつ追
     加しています。それ以外の機能は ‘dict’ クラスと同じですので、ここで
     は説明しません。

     1つ目の引数は *note default_factory: 2bb0. 属性の初期値です。デフォ
     ルトは ‘None’ です。残りの引数はキーワード引数も含め、 *note dict:
     193. のコンストラクタに与えられた場合と同様に扱われます。

     *note defaultdict: 157a. オブジェクトは標準の *note dict: 193. に加
     えて、以下のメソッドを実装しています:

      -- メソッド: __missing__ (key, /)

          もし *note default_factory: 2bb0. 属性が ‘None’ であれば、この
          メソッドは *note KeyError: 7e5. 例外を、 'key' を引数として発
          生させます。

          もし *note default_factory: 2bb0. 属性が ‘None’ でない場合、こ
          のメソッドは引数なしで呼び出され、与えらえた 'key' に対応する
          デフォルト値を提供します。この値は、辞書内に 'key' に対応して
          登録され、最後に返されます。

          もし *note default_factory: 2bb0. の呼出が例外を発生させた場合
          には、変更せずそのまま例外を投げます。

          このメソッドは *note dict: 193. クラスの *note __getitem__():
          78d. メソッドで、キーが存在しなかった場合によびだされます。値
          を返すか例外を発生させるのどちらにしても、 ‘__getitem__()’ か
          らもそのまま値が返るか例外が発生します。

          なお、 *note __missing__(): 2bb1. は *note __getitem__(): 78d.
          以外のいかなる演算に対しても呼び出され 'ません' 。よって *note
          get(): 2241. は、普通の辞書と同様に、 *note default_factory:
          2bb0. を使うのではなくデフォルトとして ‘None’ を返します。

     *note defaultdict: 157a. オブジェクトは以下のインスタンス変数をサポ
     ートしています:

      -- の属性: default_factory

          この属性は *note __missing__(): 2bb1. メソッドによって使われま
          す。これは存在すればコンストラクタの第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: 4e0. を *note default_factory: 2bb0. とすることで、キー=値ペ
アのシーケンスをリストの辞書へ簡単にグループ化できます。:

     >>> 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: 2bb0. 関数が返す空の *note list:
4e0. を使って自動的に作成されます。 *note list.append(): abf. 操作は新し
いリストに紐付けられます。キーが再度出現した場合には、通常の参照動作が行
われます(そのキーに対応するリストが返ります)。そして ‘list.append()’ 操
作で別の値をリストに追加します。このテクニックは *note
dict.setdefault(): 1430. を使った等価なものよりシンプルで速いです:

     >>> 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: 2bb0. を *note int: 32e. にすると、 *note
defaultdict: 157a. を(他の言語の 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: 2bb0. 関数が *note int(): 32e. を呼んでデフォルトのカウ
ント0を生成します。インクリメント操作が各文字を数え上げます。

常に0を返す *note int(): 32e. は特殊な関数でした。定数を生成するより速く
て柔軟な方法は、 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: 2bb0. を *note set: 432. に設定することで、 *note
defaultdict: 157a. をセットの辞書を作るために利用することができます:

     >>> 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__(): 1c7. も持っています。

     'field_names' は ‘['x', 'y']’ のような文字列のシーケンスです。
     'field_names' には、代わりに各属性名を空白文字 (whitespace) および
     /またはカンマ (,) で区切った文字列を渡すこともできます。例えば、
     ‘'x y'’ や ‘'x, y'’ です。

     アンダースコア (_) で始まる名前を除いて、 Python の正しい識別子
     (identifier) ならなんでも属性名として使うことができます。正しい識別
     子とはアルファベット(letters), 数字(digits), アンダースコア(_) を含
     みますが、数字やアンダースコアで始まる名前や、 'class', 'for',
     'return', 'global', 'pass', 'raise' などといった *note keyword: 87.
     は使えません。

     'rename' が真の場合、不適切なフィールド名は自動的に位置を示す名前に
     置き換えられます。例えば ‘['abc', 'def', 'ghi', 'abc']’ は、予約語
     の ‘def’ と、重複しているフィールド名の ‘abc’ が除去され、‘['abc',
     '_1', 'ghi', '_3']’ に変換されます。

     'defaults' には ‘None’ あるいはデフォルト値の *note iterable: 149a.
     が指定できます。 デフォルト値を持つフィールドはデフォルト値を持たな
     いフィールドより後ろに来なければならないので、 'defaults' は最も右
     にある変数に適用されます。 例えば、 field_names が ‘['x', 'y',
     'z']’ で defaults が ‘(1, 2)’ の場合、 ‘x’ は必須の引数、 ‘y’ は
     ‘1’ がデフォルト、 ‘z’ は ‘2’ がデフォルトとなります。

     もし 'module' が指定されていれば、名前付きタプルの *note
     __module__: 811. 属性は、指定された値に設定されます

     名前付きタプルのインスタンスはインスタンスごとの辞書を持たないので
     、軽量で、普通のタプル以上のメモリを使用しません。

     pickle 化をサポートするには、名前付きタプルのクラス定義は
     'typename' と同じ名前の変数に割り当てなければなりません。

     バージョン 3.1 で変更: 'rename' のサポートが追加されました。

     バージョン 3.6 で変更: 'verbose' と 'rename' 引数が *note
     キーワード専用引数: 7a9. になりました.

     バージョン 3.6 で変更: 'module' 引数が追加されました。

     バージョン 3.7 で変更: 'verbose' 引数と ‘_source’ 属性が削除されま
     した。

     バージョン 3.7 で変更: 'defaults' 引数と *note _field_defaults:
     2bb4. 属性が追加されました。

     >>> # 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: 2c. や *note sqlite3: d7. モジュールが返すタ
プルのフィールドに名前を付けるときにとても便利です:

     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: 193. を
     返します:

          >>> p = Point(x=11, y=22)
          >>> p._asdict()
          {'x': 11, 'y': 22}

     バージョン 3.1 で変更: 通常の *note dict: 193. の代わりに *note
     OrderedDict: 9da. を返すようになりました。

     バージョン 3.8 で変更: *note collections.OrderedDict: 9da. ではなく
     *note dict: 193. を返すようになりました。Python 3.7以降は、通常の辞
     書で順番が保証されています。 *note OrderedDict: 9da. 特有の機能を使
     いたい場合は、結果を ‘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(): 461. にもサポー
     トされています。

     バージョン 3.13 で変更: キーワード引数が無効な場合は *note
     ValueError: 15a. のかわりに *note TypeError: 29c. が発生します。

 -- の属性: 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(): f93. 関数を使います:

     >>> getattr(p, 'x')
     11

辞書を名前付きタプルに変換するには、 ‘**’ 演算子 (double-star-operator,
*note 引数リストのアンパック: 221d. で説明しています) を使います。:

     >>> 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: 2bb7. 属性を元に作成してください:

     >>> 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: 2f0. を参照してください。 *note class: 1691. キ
     ーワードを使った洗練された記法も紹介されています:

          class Component(NamedTuple):
              part_number: int
              weight: float
              description: Optional[str] = None

   * タプルではなく、辞書をもとにした変更可能な名前空間を作成するには
     *note types.SimpleNamespace(): 6f0. を参照してください。

   * *note dataclasses: 32. モジュールは、生成される特殊メソッドをユーザ
     ー定義クラスに自動的に追加するためのデコレータや関数を提供していま
     す。


File: python.info,  Node: OrderedDict オブジェクト,  Next: UserDict オブジェクト,  Prev: namedtuple 名前付きフィールドを持つタプルのファクトリ関数,  Up: collections --- コンテナデータ型

5.9.4.9 ‘OrderedDict’ オブジェクト
..................................

順序付き辞書は普通の辞書のようですが、順序操作に関係する追加の機能があり
ます。 組み込みの *note dict: 193. クラスが挿入順序を記憶しておく機能 (こ
の新しい振る舞いは Python 3.7 で保証されるようになりました) を獲得した今
となっては、順序付き辞書の重要性は薄れました。

いまだ残っている *note dict: 193. との差分:

   * 通常の *note dict: 193. は対応付けに向いているように設計されました
     。 挿入順序の追跡は二の次です。

   * *note OrderedDict: 9da. は並べ替え操作に向いているように設計されま
     した。 空間効率、反復処理の速度、更新操作のパフォーマンスは二の次で
     す。

   * *note OrderedDict: 9da. のアルゴリズムは、頻繁な並べ替え処理を
     *note dict: 193. よりもうまく扱うことができます。後述のレシピに示さ
     れている通り、この性質はさまざまな種類の LRU キャッシュの実装に適し
     ています。

   * *note OrderedDict: 9da. に対する等価演算は突き合わせ順序もチェック
     します。

     組み込みの *note dict: 193. では、順序を考慮した等価演算は ‘p == q
     and all(k1 == k2 for k1, k2 in zip(p, q))’ で実現することができます
     。

   * *note OrderedDict: 9da. の *note popitem(): 16a7. メソッドはシグネ
     チャが異なります。 どの要素を取り出すかを指定するオプション引数を受
     け付けます。

     組み込みの *note dict: 193. の場合、 OrderedDict の
     ‘od.popitem(last=True)’ と同じ機能は、最も右側の (最後の) 要素を取
     り出すことが保証されている ‘d.popitem()’ が果たします。

     組み込みの *note dict: 193. の場合、 OrderedDict の
     ‘od.popitem(last=False)’ は ‘(k := next(iter(d)), d.pop(k))’ で実現
     できます。これにより、該当する要素のうちで最も左側の (先頭の) もの
     を辞書から削除して返すことができます。

   * *note OrderedDict: 9da. には、 効率的に要素を末尾に置き直す *note
     move_to_end(): 159e. メソッドがあります。

     組み込みの *note dict: 193. の場合、キーと値のペアを最も右側 (末尾)
     に移動する OrderedDict の ‘od.move_to_end(k, last=True)’ は ‘d[k] =
     d.pop(k)’ で実現できます。

     組み込みの *note dict: 193. では、キーと値のペアを最も左側 (先頭) に
     移動する OrderedDict の ‘od.move_to_end(k, last=False)’ を実現する
     効率の良い方法はありません。

   * Python 3.8 以前は、 *note dict: 193. には *note __reversed__():
     104d. メソッドが欠けています。

 -- クラス: collections.OrderedDict (**kwargs)

 -- クラス: collections.OrderedDict (mapping, /, **kwargs)

 -- クラス: collections.OrderedDict (iterable, /, **kwargs)

     辞書の順序を並べ直すためのメソッドを持つ *note dict: 193. のサブク
     ラスのインスタンスを返します。

     Added in version 3.1.

      -- メソッド: popitem (last=True)

          順序付き辞書の *note popitem(): 16a7. メソッドは、(key, value)
          対を返して消去します。この対は 'last' が真なら LIFO で、偽なら
          FIFO (first-in, first-out, 先入先出) で返されます。

      -- メソッド: move_to_end (key, last=True)

          存在する 'key' を順序付き辞書の先頭または末尾に移動します。要
          素は 'last' が真 (デフォルト) の場合に最も右側すなわち末尾に移
          動します。また 'last' が偽の場合には先頭に移動します。指定した
          'key' が存在しない場合は *note KeyError: 7e5. を送出します。

               >>> 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(): c40.
による逆順の反復もサポートしています。 Equality tests between *note
OrderedDict: 9da. objects are order-sensitive and are roughly equivalent
to ‘list(od1.items())==list(od2.items())’.

Equality tests between *note OrderedDict: 9da. objects and other *note
Mapping: ca0. objects are order-insensitive like regular dictionaries.
This allows ‘OrderedDict’ objects to be substituted anywhere a regular
dictionary is used.

バージョン 3.5 で変更: *note OrderedDict: 9da. の項目、キー、値の *note
ビュー: 2bb9. が *note reversed(): c40. による逆順の反復をサポートするよ
うになりました。

バージョン 3.6 で変更: PEP 468(1) の受理によって、*note OrderedDict:
9da. のコンストラクタと、*note update(): 181d. メソッドに渡したキーワー
ド引数の順序は保持されます。

バージョン 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 that the keys were last updated.'

         def __setitem__(self, key, value):
             super().__setitem__(key, value)
             self.move_to_end(key)

*note OrderedDict: 9da. は *note functools.lru_cache(): db7. の変種を実
装するのにも役に立ちます:

     from collections import OrderedDict
     from time import time

     class TimeBoundedLRU:
         "LRU Cache that invalidates and refreshes old entries."

         def __init__(self, func, maxsize=128, maxage=30):
             self.cache = OrderedDict()      # { args : (timestamp, result)}
             self.func = func
             self.maxsize = maxsize
             self.maxage = maxage

         def __call__(self, *args):
             if args in self.cache:
                 self.cache.move_to_end(args)
                 timestamp, result = self.cache[args]
                 if time() - timestamp <= self.maxage:
                     return result
             result = self.func(*args)
             self.cache[args] = time(), result
             if len(self.cache) > self.maxsize:
                 self.cache.popitem(last=False)
             return result

     class MultiHitLRUCache:
         """ LRU cache that defers caching a result until
             it has been requested multiple times.

             To avoid flushing the LRU cache with one-time requests,
             we don't cache until a request has been made more than once.

         """

         def __init__(self, func, maxsize=128, maxrequests=4096, cache_after=1):
             self.requests = OrderedDict()   # { uncached_key : request_count }
             self.cache = OrderedDict()      # { cached_key : function_result }
             self.func = func
             self.maxrequests = maxrequests  # max number of uncached requests
             self.maxsize = maxsize          # max number of stored return values
             self.cache_after = cache_after

         def __call__(self, *args):
             if args in self.cache:
                 self.cache.move_to_end(args)
                 return self.cache[args]
             result = self.func(*args)
             self.requests[args] = self.requests.get(args, 0) + 1
             if self.requests[args] <= self.cache_after:
                 self.requests.move_to_end(args)
                 if len(self.requests) > self.maxrequests:
                     self.requests.popitem(last=False)
             else:
                 self.requests.pop(args, None)
                 self.cache[args] = result
                 if len(self.cache) > self.maxsize:
                     self.cache.popitem(last=False)
             return result


File: python.info,  Node: UserDict オブジェクト,  Next: UserList オブジェクト,  Prev: OrderedDict オブジェクト,  Up: collections --- コンテナデータ型

5.9.4.11 ‘UserDict’ オブジェクト
................................

クラス *note UserDict: 194e. は、辞書オブジェクトのラッパとしてはたらき
ます。このクラスの必要性は、 *note dict: 193. から直接的にサブクラス化で
きる能力に部分的に取って代わられました; しかし、根底の辞書に属性としてア
クセスできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: 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: 2bbc. 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: 194e. クラスの内容を保存するために使われる実際
          の辞書です。

     ‘UserDict’ instances also override the following method:

      -- メソッド: popitem ()

          Remove and return a ‘(key, value)’ pair from the wrapped
          dictionary.  Pairs are returned in the same order as
          ‘data.popitem()’.  (For the default *note dict.popitem():
          18de, this order is LIFO.)  If the dictionary is empty, raises
          a *note KeyError: 7e5.


File: python.info,  Node: UserList オブジェクト,  Next: UserString オブジェクト,  Prev: UserDict オブジェクト,  Up: collections --- コンテナデータ型

5.9.4.12 ‘UserList’ オブジェクト
................................

このクラスはリストオブジェクトのラッパとしてはたらきます。これは独自のリ
スト風クラスの基底クラスとして便利で、既存のメソッドをオーバーライドした
り新しいメソッドを加えたりできます。こうして、リストに新しい振る舞いを加
えられます。

このクラスの必要性は、 *note list: 4e0. から直接的にサブクラス化できる能
力に部分的に取って代わられました; しかし、根底のリストに属性としてアクセ
スできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: collections.UserList ([list])

     リストをシミュレートするクラスです。インスタンスの内容は通常のリス
     トに保存され、 *note UserList: 189c. インスタンスの *note data:
     2bbe. 属性を通してアクセスできます。インスタンスの内容は最初に
     'list' のコピーに設定されますが、デフォルトでは空リスト ‘[]’ です。
     'list' は何らかのイテラブル、例えば通常の Python リストや
     ‘UserList’ オブジェクト、です。

     ミュータブルシーケンスのメソッドと演算をサポートするのに加え、
     *note UserList: 189c. インスタンスは以下の属性を提供します:

      -- の属性: data

          *note UserList: 189c. クラスの内容を保存するために使われる実際
          の *note list: 4e0. オブジェクトです。

'サブクラス化の要件:' *note UserList: 189c. のサブクラスは引数なしか、あ
るいは一つの引数のどちらかとともに呼び出せるコンストラクタを提供すること
が期待されています。新しいシーケンスを返すリスト演算は現在の実装クラスの
インスタンスを作成しようとします。そのために、データ元として使われるシー
ケンスオブジェクトである一つのパラメータとともにコンストラクタを呼び出せ
ると想定しています。

派生クラスがこの要求に従いたくないならば、このクラスがサポートしているす
べての特殊メソッドはオーバーライドされる必要があります。その場合に提供さ
れる必要のあるメソッドについての情報は、ソースを参考にしてください。


File: python.info,  Node: UserString オブジェクト,  Prev: UserList オブジェクト,  Up: collections --- コンテナデータ型

5.9.4.13 ‘UserString’ オブジェクト
..................................

クラス *note UserString: 1190. は、文字列オブジェクトのラッパとしてはた
らきます。このクラスの必要性は、 *note str: 1ea. から直接的にサブクラス
化できる能力に部分的に取って代わられました; しかし、根底の文字列に属性と
してアクセスできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: collections.UserString (seq)

     文字列オブジェクトをシミュレートするクラスです。 インスタンスの内容
     は通常の文字列に保存され、 *note UserString: 1190. インスタンスの
     *note data: 2bc0. 属性を通してアクセスできます。 インスタンスの内容
     には最初に 'seq' のコピーが設定されます。 'seq' 引数は、組み込みの
     *note str(): 1ea. 関数で文字列に変換できる任意のオブジェクトです。

     文字列のメソッドと演算をサポートするのに加え、 *note UserString:
     1190. インスタンスは次の属性を提供します:

      -- の属性: data

          *note UserString: 1190. クラスの内容を保存するために使われる実
          際の *note str: 1ea. オブジェクトです。

     バージョン 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 抽象基底クラス: 1574. を提供します。抽象基底ク
ラスは、クラスが特定のインターフェースを提供しているか、例えば *note
ハッシュ可能: 18e. であるかや *note マッピング: 1579. であるかを判定しま
す。

*note issubclass(): 2fc. や *note isinstance(): 2fb. を使ったインターフ
ェースに対するテストは、以下の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(): 2fc. or *note
     isinstance(): 2fb. 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
     演算子: 26e6, the *note 反復: 149a. ロジック, および *note
     reversed(): c40. 関数は自動的に ‘__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: a6a.):

          class E:
              def __iter__(self): ...
              def __next__(self): ...

          >>> issubclass(E, Iterable)
          True
          >>> isinstance(E(), Iterable)
          True

     複雑なインターフェースは、単に特定のメソッドが存在すること以上の定
     義を持つため、3番目のテクニックをサポートしていません。それらのイン
     ターフェースはメソッドの意味やメソッド間の関係まで指定するので、特
     定のメソッド名の存在からだけではインターフェースの推測ができません
     。たとえば、あるクラスが ‘__getitem__’, ‘__len__’, および
     ‘__iter__’ を提供するというだけでは、 *note Sequence: 1582. と
     *note Mapping: ca0. を区別するには不十分です。

Added in version 3.9: これらの抽象クラスは ‘[]’ をサポートするようになり
ました。 *note ジェネリックエイリアス型: aa4. および PEP 585(2) を参照し
てください。

* Menu:

* コレクション抽象基底クラス::
* コレクションの抽象基底クラス: コレクションの抽象基底クラス -- 詳細な説明. 詳細な説明
* 例とレシピ::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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 (抽象基底クラス): 1574. を提供
します:

ABC                                継承しているクラス         抽象メソッド                mixin メソッド
                                                                                          
---------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                          
*note Container: 28c4. (1)                                    ‘__contains__’
                                                              
                                                                                          
*note Hashable: 907. (2)                                      ‘__hash__’
                                                              
                                                                                          
*note Iterable: 28c2. (3) (4)                                 ‘__iter__’
                                                              
                                                                                          
*note Iterator: 28c3. (5)          *note Iterable: 28c2.      ‘__next__’                  ‘__iter__’
                                                                                          
                                                                                          
*note Reversible: 104c. (6)        *note Iterable: 28c2.      ‘__reversed__’
                                                              
                                                                                          
*note Generator: 1197. (7)         *note Iterator: 28c3.      ‘send’, ‘throw’             ‘close’, ‘__iter__’, ‘__next__’
                                                                                          
                                                                                          
*note Sized: 908. (8)                                         ‘__len__’
                                                              
                                                                                          
*note Callable: bca. (9)                                      ‘__call__’
                                                              
                                                                                          
*note Collection: 104b. (10)       *note Sized: 908,          ‘__contains__’,
                                   *note Iterable: 28c2,      ‘__iter__’, ‘__len__’
                                   *note Container: 28c4.     
                                   
                                                                                          
*note Sequence: 1582.              *note Reversible: 104c,    ‘__getitem__’, ‘__len__’    ‘__contains__’, ‘__iter__’, ‘__reversed__’, ‘index’,
                                   *note Collection: 104b.                                ‘count’
                                                                                          
                                                                                          
*note MutableSequence: 6cc.        *note Sequence: 1582.      ‘__getitem__’,              *note Sequence: 1582. から継承したメソッドと、
                                                              ‘__setitem__’,              ‘append’, ‘clear’, ‘reverse’, ‘extend’, ‘pop’,
                                                              ‘__delitem__’, ‘__len__’,   ‘remove’, ‘__iadd__’
                                                              ‘insert’                    
                                                              
                                                                                          
*note ByteString: 2d6.             *note Sequence: 1582.      ‘__getitem__’, ‘__len__’    *note Sequence: 1582. から継承したメソッド
                                                                                          
                                                                                          
*note Set: 28b9.                   *note Collection: 104b.    ‘__contains__’,             ‘__le__’, ‘__lt__’, ‘__eq__’, ‘__ne__’, ‘__gt__’,
                                                              ‘__iter__’, ‘__len__’       ‘__ge__’, ‘__and__’, ‘__or__’, ‘__sub__’, ‘__rsub__’,
                                                                                          ‘__xor__’, ‘__rxor__’ and ‘isdisjoint’
                                                                                          
                                                                                          
*note MutableSet: 28c5.            *note Set: 28b9.           ‘__contains__’,             *note Set: 28b9. から継承したメソッドと、 ‘clear’,
                                                              ‘__iter__’, ‘__len__’,      ‘pop’, ‘remove’, ‘__ior__’, ‘__iand__’, ‘__ixor__’,
                                                              ‘add’, ‘discard’            ‘__isub__’
                                                                                          
                                                                                          
*note Mapping: ca0.                *note Collection: 104b.    ‘__getitem__’,              ‘__contains__’, ‘keys’, ‘items’, ‘values’, ‘get’,
                                                              ‘__iter__’, ‘__len__’       ‘__eq__’, ‘__ne__’
                                                                                          
                                                                                          
*note MutableMapping: 146a.        *note Mapping: ca0.        ‘__getitem__’,              *note Mapping: ca0. から継承したメソッドと、 ‘pop’,
                                                              ‘__setitem__’,              ‘popitem’, ‘clear’, ‘update’, ‘setdefault’
                                                              ‘__delitem__’,              
                                                              ‘__iter__’, ‘__len__’
                                                              
                                                                                          
*note MappingView: 28c6.           *note Sized: 908.                                      ‘__init__’, ‘__len__’ and ‘__repr__’
                                                                                          
                                                                                          
*note ItemsView: 28c8.             *note MappingView: 28c6,                               ‘__contains__’, ‘__iter__’
                                   *note Set: 28b9.                                       
                                   
                                                                                          
*note KeysView: 28c7.              *note MappingView: 28c6,                               ‘__contains__’, ‘__iter__’
                                   *note Set: 28b9.                                       
                                   
                                                                                          
*note ValuesView: 28c9.            *note MappingView: 28c6,                               ‘__contains__’, ‘__iter__’
                                   *note Collection: 104b.                                
                                   
                                                                                          
*note Awaitable: 1198. (11)                                   ‘__await__’
                                                              
                                                                                          
*note Coroutine: 1199. (12)        *note Awaitable: 1198.     ‘send’, ‘throw’             ‘close’
                                                                                          
                                                                                          
*note AsyncIterable: 119b. (13)                               ‘__aiter__’
                                                              
                                                                                          
*note AsyncIterator: 119a. (14)    *note AsyncIterable: 119b. ‘__anext__’                 ‘__aiter__’
                                                                                          
                                                                                          
*note AsyncGenerator: 104e. (15)   *note AsyncIterator: 119a. ‘asend’, ‘athrow’           ‘aclose’, ‘__aiter__’, ‘__anext__’
                                                                                          
                                                                                          
*note Buffer: 31a. (16)                                       ‘__buffer__’
                                                              

脚注
....

   ---------- Footnotes ----------

   (1) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (2) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (3) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (4) ‘isinstance(obj, Iterable)’ によるチェックは *note Iterable:
28c2. として登録されたクラスや *note __iter__(): 22b8. メソッドを持つク
ラスを検出しますが、 *note __getitem__(): 78d. メソッドにより反復処理を
行うクラスは検出しません。オブジェクトがイテラブル (*note iterable:
149a.) かどうかを確認する唯一の信頼できる方法は ‘iter(obj)’ を呼び出すこ
とです。

   (5) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (6) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (7) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (8) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (9) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (10) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (11) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (12) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (13) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (14) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (15) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (16) これらの抽象基底クラスは *note __subclasshook__(): 2bc5. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: a6a. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。


File: python.info,  Node: コレクションの抽象基底クラス -- 詳細な説明,  Next: 例とレシピ,  Prev: コレクション抽象基底クラス,  Up: collections abc --- コンテナの抽象基底クラス

5.9.5.2 コレクションの抽象基底クラス - 詳細な説明
.................................................

 -- クラス: collections.abc.Container

     *note __contains__(): 1772. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Hashable

     *note __hash__(): ec5. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Sized

     *note __len__(): 19aa. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Callable

     *note __call__(): 966. メソッドを提供するクラスの ABC です。

     ‘Callable’ を型アノテーションで使う方法の詳細は、 *note
     呼び出し可能オブジェクトのアノテーション: 28e3. を参照してください
     。

 -- クラス: collections.abc.Iterable

     *note __iter__(): 22b8. メソッドを提供するクラスの ABC です。

     ‘isinstance(obj, Iterable)’ によるチェックは *note Iterable: 28c2.
     として登録されたクラスや *note __iter__(): 22b8. メソッドを持つクラ
     スを検出しますが、 *note __getitem__(): 78d. メソッドにより反復処理
     を行うクラスは検出しません。オブジェクトがイテラブル (*note
     iterable: 149a.) かどうかを確認する唯一の信頼できる方法は
     ‘iter(obj)’ を呼び出すことです。

 -- クラス: collections.abc.Collection

     サイズ付きのイテラブルなコンテナクラスの ABC です。

     Added in version 3.6.

 -- クラス: collections.abc.Iterator

     *note __iter__(): 22bb. メソッドと *note __next__(): 1687. メソッド
     を提供するクラスの ABC です。 *note iterator: 6d4. の定義も参照して
     ください。

 -- クラス: collections.abc.Reversible

     *note __reversed__(): 104d. メソッドを提供するイテラブルクラスの
     ABC です。

     Added in version 3.6.

 -- クラス: collections.abc.Generator

     PEP 342(1) で定義された、*note イテレータ: 6d4. を *note send():
     1418, *note throw(): 90a, *note close(): 19bf. の各メソッドに拡張す
     るプロトコルを実装する、*note ジェネレータ: 1417. クラスの ABC です
     。

     ‘Generator’ を型アノテーションで使う方法の詳細は、 *note Annotating
     generators and coroutines: 2bc7. を参照してください。

     Added in version 3.5.

 -- クラス: collections.abc.Sequence
 -- クラス: collections.abc.MutableSequence
 -- クラス: collections.abc.ByteString

     読み出し専用の *note シーケンス: 904. およびミュータブルな シーケン
     ス の ABC です。

     Implementation note: Some of the mixin methods, such as *note
     __iter__(): 22b8, *note __reversed__(): 104d, and *note index():
     1baa. make repeated calls to the underlying *note __getitem__():
     78d. 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: 15a. if the value is not present.

          Supporting the 'start' and 'stop' arguments is optional, but
          recommended.

          バージョン 3.5 で変更: The *note index(): 1baa. 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: 319. at runtime.  For use in
     type annotations, either use *note Buffer: 31a. 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: 1d2. and *note
     bytearray: 1d1.  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: 1dd. 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 集合: 223e. の ABC です。

 -- クラス: collections.abc.Mapping
 -- クラス: collections.abc.MutableMapping

     読み出し専用の *note マッピング: 1579. およびミュータブルな マッピ
     ング の ABC です。

 -- クラス: collections.abc.MappingView
 -- クラス: collections.abc.ItemsView
 -- クラス: collections.abc.KeysView
 -- クラス: collections.abc.ValuesView

     マッピング、要素、キー、値の *note ビュー: 2bb9. の ABC です。

 -- クラス: collections.abc.Awaitable

     *note await: 439. で使用できる *note awaitable: 6d5. オブジェクトの
     ABC です。カスタムの実装は、*note __await__(): 1132. メソッドを提供
     しなければなりません。

     *note Coroutine: 1199. ABC の *note Coroutine: 8a7. オブジェクトと
     インスタンスは、すべてこの ABC のインスタンスです。

          注釈: In CPython, generator-based coroutines (*note
          generators: 1417. decorated with *note @types.coroutine:
          123c.) are 'awaitables', even though they do not have an *note
          __await__(): 1132. method.  Using ‘isinstance(gencoro,
          Awaitable)’ for them will return ‘False’.  Use *note
          inspect.isawaitable(): 11cf. to detect them.

     Added in version 3.5.

 -- クラス: collections.abc.Coroutine

     *note コルーチン: 8a7. と互換性のあるクラスの ABC です。これらは、
     *note コルーチンオブジェクト: 2565. で定義された *note send():
     262d, *note throw(): 909, *note close(): 262e. のメソッドを実装しま
     す。カスタムの実装は、*note __await__(): 1132. も実装しなければなり
     ません。*note Coroutine: 1199. のすべてのインスタンスは、 *note
     Awaitable: 1198. のインスタンスでもあります。

          注釈: In CPython, generator-based coroutines (*note
          generators: 1417. decorated with *note @types.coroutine:
          123c.) are 'awaitables', even though they do not have an *note
          __await__(): 1132. method.  Using ‘isinstance(gencoro,
          Coroutine)’ for them will return ‘False’.  Use *note
          inspect.isawaitable(): 11cf. to detect them.

     ‘Coroutine’ を型アノテーションで使う方法の詳細は、 *note Annotating
     generators and coroutines: 2bc7. を参照してください。型パラメータの
     意味と順序は *note Generator: 1197. と同様です。

     Added in version 3.5.

 -- クラス: collections.abc.AsyncIterable

     ‘__aiter__’ メソッドを提供するクラスの ABC です。*note asynchronous
     iterable: 1131. の定義も参照してください。

     Added in version 3.5.

 -- クラス: collections.abc.AsyncIterator

     ‘__aiter__’ および ‘__anext__’ メソッドを提供するクラスの ABC です
     。*note asynchronous iterator: 6d3. の定義も参照してください。

     Added in version 3.5.

 -- クラス: collections.abc.AsyncGenerator

     PEP 525(3) と PEP 492(4) に定義されているプロトコルを実装した *note
     非同期ジェネレータ: 26b1. クラスの ABC です。

     ‘AsyncGenerator’ を型アノテーションで使う方法の詳細は、 *note
     Annotating generators and coroutines: 2bc7. を参照してください。

     Added in version 3.6.

 -- クラス: collections.abc.Buffer

     *note buffer protocol: 319. を実装する *note __buffer__(): 87e. メ
     ソッドを提供するクラスの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: 28b9. API を提供するクラスを作る
場合、3つの基本になる抽象メソッド *note __contains__(): 1772, *note
__iter__(): 22b8, *note __len__(): 19aa. だけが必要です。ABC が残りの
‘__and__()’ や *note isdisjoint(): 28a3. といったメソッドを提供します:

     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: 28b9. と *note MutableSet: 28c5. を mixin 型として利用すると
きの注意点:

  1. 幾つかの set の操作は新しい set を作るので、デフォルトの mixin メソ
     ッドは *note イテラブル: 149a. から新しいインスタンスを作成する方法
     を必要とします。クラスのコンストラクタは ‘ClassName(iterable)’ の形
     のシグネチャを持つと仮定されます。内部の ‘_from_iterable()’ という
     *note classmethod: 6a0. が ‘cls(iterable)’ を呼び出して新しい set を
     作る部分でこの仮定が使われています。コンストラクタのシグネチャが異
     なるクラスで *note Set: 28b9. を使う場合は、 iterable 引数から新し
     いインスタンスを生成できるクラスメソッドあるいは仕様に沿ったメソッ
     ドで ‘_from_iterable()’ をオーバーライドする必要があります。

  2. (たぶん意味はそのままに速度を向上する目的で)比較をオーバーライドす
     る場合、 *note __le__(): 16c4. と *note __ge__(): 16c6. だけを再定
     義すれば、その他の演算は自動的に追随します。

  3. *note Set: 28b9. mixin型は set のハッシュ値を計算する ‘_hash()’ メ
     ソッドを提供しますが、すべての set が *note hashable: 18e. や
     immutable とは限らないので、 *note __hash__(): ec5. は提供しません
     。 mixin を使ってハッシュ可能な set を作る場合は、 ‘Set’ と *note
     Hashable(): 907. の両方を継承して、 ‘__hash__ = Set._hash’ と定義し
     てください。

参考
....

   * *note MutableSet: 28c5. を使った例として 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: 4e0.

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(): f91, 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():
2bcd. or *note heapify_max(): 4b6. 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: 18ed.
     is raised.  To access the smallest item without popping it, use
     ‘heap[0]’.

 -- の関数: heapq.heappushpop (heap, item)

     'item' を 'heap' に push した後、pop を行って 'heap' から最初の要素
     を返します。この一続きの動作を *note heappush(): 1874. に引き続いて
     *note heappop(): 1875. を別々に呼び出すよりも効率的に実行します。

 -- の関数: heapq.heapreplace (heap, item)

     'heap' から最小の要素を pop して返し、新たに 'item' を push します
     。ヒープのサイズは変更されません。ヒープが空の場合、 *note
     IndexError: 18ed. が送出されます。

     この一息の演算は *note heappop(): 1875. に次いで *note heappush():
     1874. を送出するよりも効率的で、固定サイズのヒープを用いている場合
     にはより適しています。 pop/push の組み合わせは必ずヒープから要素を
     一つ返し、それを 'item' と置き換えます。

     返される値は加えられた 'item' よりも大きくなるかもしれません。それ
     を望まないなら、代わりに *note heappushpop(): 2bce. を使うことを考
     えてください。この 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: 18ed. 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(): 4b7. followed by a separate call to *note
     heappop_max(): 4b8.

     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: 18ed. is raised.

     The value returned may be smaller than the 'item' added.  Refer to
     the analogous function *note heapreplace(): 2bcf. for detailed
     usage notes.

     Added in version 3.14.

このモジュールではさらに3つのヒープに基く汎用関数を提供します。

 -- の関数: heapq.merge (*iterables, key=None, reverse=False)

     複数のソートされた入力をマージ(merge)して一つのソートされた出力にし
     ます (たとえば、複数のログファイルの時刻の入ったエントリーをマージ
     します)。ソートされた値にわたる *note iterator: 6d4. を返します。

     ‘sorted(itertools.chain(*iterables))’ と似ていますが、イテレータを
     返し、一度にはデータをメモリに読み込まず、それぞれの入力ストリーム
     が予め(最小から最大へ)ソートされていることを仮定します。

     2 つのオプション引数があり、これらはキーワード引数として指定されな
     ければなりません。

     'key' は 1 つの引数からなる *note key function: 11be. を指定します
     。この関数は、入力の各要素から比較のキーを取り出すのに使われます。
     デフォルト値は ‘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(): f90. 関数の方が効率的です。さらに、 ‘n==1’ の時には
*note min(): 12bc. および *note max(): 12bd. 関数の方が効率的です。この
関数を繰り返し使うことが必要なら、iterable を実際のヒープに変えることを
考えてください。

* Menu:

* 基本的な例::
* Other Applications::
* 優先度キュー実装の注釈::
* 理論::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): f90. とは異な
り、この実装はステーブルソートではありません。

ヒープの要素はタプルに出来ます。これは、追跡される主レコードとは別に (タ
スクの優先度のような) 比較値を指定するときに便利です:

     >>> 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]’:

[image src="python-figures/heapq-binary-tree.svg" alt="Example (min-heap) binary tree."]


Figure
上の木構造では、各セル '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__(): ec4. method to determine whether a value has been found.
Instead, the functions only call the *note __lt__(): 165a. 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(): 2bd9. 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: 11be. 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(): 2bdb. と似ていますが、 '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(): 2bdb. to locate an
     insertion point.  Next, it runs the *note insert(): 25ee. 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(): 2bd9. と似ていますが、 'a' に含まれる 'x' のう
     ち、どのエントリーよりも後ろに 'x' を挿入します。

     This function first runs *note bisect_right(): 2bdc. to locate an
     insertion point.  Next, it runs the *note insert(): 25ee. 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/main/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(): 1a28. 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 関数: 2bda. は挿入点を見つけるには便利ですが、一般的
な検索タスクに使うには厄介であったり、使いにくい場合があります。 以下の
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(): 2bdd. 関数は数値テーブルの探索に役に立ちます。この例では
、 ‘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(): 2bdd. と *note insort(): 2bdf. 関数もタプルのリストで動
作します。 引数 '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,
complex numbers.  Arrays are mutable *note sequence: 904. 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'.  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
                                                                 
                                                                                             
‘'e'’           _Float16                 浮動小数点数            2                           (3)
                                                                                             
                                                                                             
‘'f'’           浮動小数点数             浮動小数点数            4
                                                                 
                                                                                             
‘'d'’           double                   浮動小数点数            8
                                                                 
                                                                                             
‘'Zf'’          float complex            複素数                  8                           (4)
                                                                                             
                                                                                             
‘'Zd'’          double complex           複素数                  16                          (4)
                                                                                             

注釈:

  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.

  3. The IEEE 754 binary16 "half precision" type was introduced in the
     2008 revision of the IEEE 754 standard(1).  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.

     Added in version 3.15.

  4. Complex types (‘Zf’ and ‘Zd’) are available unconditionally,
     regardless on support for complex types (the Annex G of the C11
     standard) by the C compiler.  As specified in the C11 standard,
     each complex type is represented by a two-element C array
     containing, respectively, the real and imaginary parts.

     Added in version 3.15.

参考
....

The *note ctypes: 2a4a. and *note struct: 2a46. modules, as well as
third-party modules like numpy(2), use similar - but slightly different
- type codes.

値の実際の表現はマシンアーキテクチャ (厳密に言うとCの実装) によって決ま
ります。値の実際のサイズは *note array.itemsize: 2be7. 属性から得られま
す。

このモジュールは以下の項目を定義しています:

 -- データ: array.typecodes

     A tuple with all available type codes.

     バージョン 3.15 で変更: The type changed from *note str: 1ea. to
     *note tuple: 1d9.

このモジュールでは次の型を定義しています:

 -- クラス: 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: 1d2. or *note bytearray: 1d1. object, a Unicode
     string, or iterable over elements of the appropriate type.

     If given a *note bytes: 1d2. or *note bytearray: 1d1. object, the
     initializer is passed to the new array's *note frombytes(): 162b.
     method; if given a Unicode string, the initializer is passed to the
     *note fromunicode(): 2be8. method; otherwise, the initializer's
     iterator is passed to the *note extend(): 2be9. method to add
     initial items to the array.

     Array objects support the ordinary *note mutable: 27da. *note
     sequence: 904. 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: 29c. is raised.  Array objects also
     implement the buffer interface, and may be used wherever *note
     bytes-like objects: 43d. are supported.

     引数 ‘typecode’, ‘initializer’ 付きで *note 監査イベント: 1e84.
     ‘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): 319. にありま
               す。

      -- メソッド: byteswap ()

          "Byteswap" all items of the array.  This is only supported for
          values which are 1, 2, 4, 8 or 16 bytes in size; for other
          types of values, *note RuntimeError: 317. is raised.  It is
          useful when reading data from a file written on a machine with
          a different byte order.  Note, that for complex types the
          order of components (the real part, followed by imaginary
          part) is preserved.

      -- メソッド: count (value, /)

          Return the number of occurrences of 'value' in the array.

      -- メソッド: extend (iterable, /)

          'iterable' から要素を取り出し、アレイの末尾に要素を追加します
          。 'iterable' が別のアレイ型である場合、二つのアレイは '全く'
          同じ型コードでなければなりません。それ以外の場合には *note
          TypeError: 29c. を送出します。 'iterable' がアレイでない場合、
          アレイに値を追加できるような正しい型の要素からなるイテレーショ
          ン可能オブジェクトでなければなりません。

      -- メソッド: frombytes (buffer, /)

          Appends items from the *note bytes-like object: 43d,
          interpreting its content as an array of machine values (as if
          it had been read from a file using the *note fromfile(): 167a.
          method).

          Added in version 3.2: 明確化のため ‘fromstring()’ の名前が
          *note frombytes(): 162b. に変更されました。

      -- メソッド: fromfile (f, n, /)

          *note ファイルオブジェクト: 1581. 'f' から (マシンのデータ形式
          そのままで) 'n' 個の要素を読み出し、アレイの末尾に要素を追加し
          ます。 'n' 個未満の要素しか読めなかった場合は *note EOFError:
          1693. を送出しますが、それまでに読み出せた値はアレイに追加され
          ます。

      -- メソッド: 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: 15a. 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: 15a. 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(): 167b. メソッドを使ってファイルに書かれるバイ
          ト列と同じです)。

          Added in version 3.2: ‘tostring()’ is renamed to ‘tobytes()’
          for clarity.

      -- メソッド: tofile (f, /)

          すべての要素を (マシンの値の形式で) *note file object: 1581.
          'f' に書き込みます。

      -- メソッド: tolist ()

          アレイを同じ要素を持つ普通のリストに変換します。

      -- メソッド: tounicode ()

          Convert the array to a Unicode string.  The array must have a
          type ‘'u'’ or ‘'w'’; otherwise a *note ValueError: 15a. 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(): 18f, so long as the *note array: 6cb.
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: de. モジュール

     異なる種類のバイナリデータのパックおよびアンパック。

NumPy(3)

     NumPy パッケージは、別の配列型を定義しています。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/IEEE_754-2008_revision

   (2) 
https://numpy.org/doc/stable/reference/arrays.interface.html#object.__array_interface__

   (3) 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: 19fe. はリファレントを自由に破棄し、メモリを別のもの
に再利用することができます。しかし、オブジェクトへの強参照がなくても、オ
ブジェクトが実際に破棄されるまでは、弱参照はオブジェクトを返す場合があり
ます。

弱参照の主な用途は、巨大なオブジェクトを保持するキャッシュやマッピングを
実装することです。ここで、キャッシュやマッピングに保持されているからとい
う理由だけで、巨大なオブジェクトが生き続けることは望ましくありません。

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: 1b63. and *note WeakValueDictionary: 1b64.
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: 1b63. と *note WeakValueDictionary: 1b64. はそ
の実装に弱参照を使用しており、キーや値がガーベジコレクションによって回収
されたことを弱参照辞書に通知するコールバック関数を設定しています。 *note
WeakSet: 9dc. は *note set: 432. インターフェースを実装していますが、
‘WeakKeyDictionary’ のように要素への弱参照を持ちます。

*note finalize: e42. は、オブジェクトのガベージコレクションの実行時にク
リーンアップ関数が呼び出されるように登録する、単純な方法を提供します。こ
れは、未加工の弱参照上にコールバック関数を設定するよりも簡単です。なぜな
ら、オブジェクトのコレクションが完了するまでファイナライザが生き続けるこ
とを、モジュールが自動的に保証するからです。

Most programs should find that using one of these weak container types
or *note finalize: e42. 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 オブジェクト: 1581. 、 *note generators: 1417. 型のオブジェク
ト、socket オブジェクト、array オジェクト、deque オブジェクト、正規表現
パターンオブジェクト、code オブジェクトです。

バージョン 3.2 で変更: thread.lock, threading.Lock, code オブジェクトの
サポートが追加されました。

*note list: 4e0. や *note dict: 193. など、いくつかの組み込み型は弱参照
を直接サポートしませんが、以下のようにサブクラス化を行えばサポートを追加
できます:

     class Dict(dict):
         pass

     obj = Dict(red=1, green=2, blue=3)   # this object is weak referenceable

*note tuple: 1d9. や *note int: 32e. など、他の組み込み型はサブクラス化
しても弱参照をサポートしません。

拡張型は、簡単に弱参照をサポートできます。詳細については、 *note
弱参照(Weak Reference)のサポート: 2bf8. を参照してください。

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: 1d8. for details.

 -- クラス: weakref.ref (object[, callback])

     'object' への弱参照を返します。リファレントがまだ生きているならば、
     元のオブジェクトは参照オブジェクトの呼び出しで取り出せす。リファレ
     ントがもはや生きていないならば、参照オブジェクトを呼び出したときに
     *note None: a6a. を返します。 '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__():
     13ab. method.

     'object' が *note ハッシュ可能: 18e. ならば、弱参照はハッシュ可能で
     す。それらは 'object' が削除された後でもそれらのハッシュ値を保持し
     ます。 'object' が削除されてから初めて *note hash(): 9e7. が呼び出
     された場合に、その呼び出しは *note TypeError: 29c. を発生させます。

     弱参照は等価性のテストをサポートしていますが、順序をサポートしてい
     ません。参照がまだ生きているならば、 'callback' に関係なく二つの参
     照はそれらのリファレントと同じ等価関係を持ちます。リファレントのど
     ちらか一方が削除された場合、参照オブジェクトが同一である場合に限り
     、その参照は等価です。

     これはサブクラス化可能な型というよりファクトリ関数です。

      -- の属性: __callback__

          この読み出し専用の属性は、現在弱参照に関連付けられているコール
          バックを返します。コールバックが存在しないか、弱参照のリファレ
          ントが生きていない場合、この属性の値は ‘None’ になります。

     バージョン 3.4 で変更: *note __callback__: 139f. 属性が追加されまし
     た。

 -- の関数: weakref.proxy (object[, callback])

     弱参照を使う 'object' へのプロキシを返します。弱参照オブジェクトを
     明示的な参照外しをしながら利用する代わりに、多くのケースでプロキシ
     を利用することができます。返されるオブジェクトは、 'object' が呼び
     出し可能かどうかによって、 ‘ProxyType’ または ‘CallableProxyType’ の
     どちらかの型を持ちます。プロキシオブジェクトはリファレントに関係な
     く *note ハッシュ可能: 18e. ではありません。これによって、それらの
     基本的な変更可能という性質による多くの問題を避けています。そして、
     辞書のキーとしての利用を妨げます。 'callback' は *note ref(): 139e.
     関数の同じ名前のパラメータと同じものです。(-- 訳注: リファレントが
     変更不能型であっても、プロキシはリファレントが消えるという状態の変
     更があるために、変更可能型です。--)

     Accessing an attribute of the proxy object after the referent is
     garbage collected raises *note ReferenceError: 18c5.

     バージョン 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: 1b63. オブジェクトは、追加のメソッドを持ちます
。このメソッドは、内部の参照を直接公開します。その参照は、利用される時に
生存しているとは限りません。なので、参照を利用する前に、その参照をチェッ
クする必要があります。これにより、必要なくなったキーの参照が残っているた
めに、ガベージコレクタがそのキーを削除できなくなる事態を避ける事ができま
す。

 -- メソッド: WeakKeyDictionary.keyrefs ()

     キーへの弱参照を持つ iterable オブジェクトを返します。

 -- クラス: weakref.WeakValueDictionary ([dict])

     値を弱参照するマッピングクラス。値への強参照が存在しなくなったとき
     に、辞書のエントリは捨てられます。

     バージョン 3.9 で変更: PEP 584(3) で規定されている ‘|’ 演算子と
     ‘|=’ 演算子のサポートを追加しました。

*note WeakValueDictionary: 1b64. objects have an additional method that
has the same issues as the *note WeakKeyDictionary.keyrefs(): 2bfb.
method.

 -- メソッド: WeakValueDictionary.valuerefs ()

     値への弱参照を持つ iterable オブジェクトを返します。

 -- クラス: weakref.WeakSet ([elements])

     要素への弱参照を持つ集合型。要素への強参照が無くなったときに、その
     要素は削除されます。

 -- クラス: weakref.WeakMethod (method[, callback])

     拡張された *note ref: 139e. のサブクラスで、束縛されたメソッドへの
     弱参照をシミュレートします (つまり、クラスで定義され、インスタンス
     にあるメソッド)。 束縛されたメソッドは短命なので、標準の弱参照では
     保持し続けられません。 *note WeakMethod: 139d. には、オブジェクトと
     元々の関数が死ぬまで束縛されたメソッドを再作成する特別なコードがあ
     ります:

          >>> 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(): 139e. function.

     Added in version 3.4.

 -- クラス: weakref.finalize (obj, func, /, *args, **kwargs)

     'obj' がガベージコレクションで回収されるときに呼び出される、呼び出
     し可能なファイナライザオブジェクトを返します。 通常の弱参照とは異な
     り、ファイナライザは参照しているオブジェクトが回収されるまで必ず生
     き残り、そのおかげでライフサイクル管理が大いに簡単になります。

     ファイナライザは (直接もしくはガベージコレクションのときに) 呼び出
     されるまで '生きている' と見なされ、呼び出された後には '死んでいま
     す' 。 生きているファイナライザを呼び出すと、 ‘func(*arg,
     **kwargs)’ を評価した結果を返します。一方、死んでいるファイナライザ
     を呼び出すと *note None: a6a. を返します。

     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__(): 13ab. 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: 1ab. when module globals are liable
     to have been replaced by *note None: a6a.

      -- メソッド: __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: a6a.

      -- メソッド: 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: a6a.

      -- メソッド: peek ()

          If 'self' is alive then return the tuple ‘(obj, func, args,
          kwargs)’.  If 'self' is dead then return *note None: a6a.

      -- の属性: 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: 2c01. 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/main/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__: 139f.  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: a6a. を返します:

     >>> 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: 139e. オブジェクトの特殊なバージョンを
作成できます。これは *note WeakValueDictionary: 1b64. の実装で使われてお
り、マップ内の各エントリによるメモリのオーバヘッドを減らしています。こう
した実装は、ある参照に追加情報を関連付けたい場合に便利ですし、リファレン
トを取り出すための呼び出し時に何らかの追加処理を行いたい場合にも使えます
。

以下の例では、 *note ref: 139e. のサブクラスを使って、あるオブジェクトに
追加情報を保存し、リファレントがアクセスされたときにその値に作用をできる
ようにするための方法を示しています:

     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: e42. 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(): 2bfe. 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: 2c01. attribute to *note False: ef9, 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__(): 13ab.
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__(): 13ab. methods no longer
prevent reference cycles from being garbage collected, and module
globals are no longer forced to *note None: a6a. during *note
interpreter shutdown: 1ab.  So this code should work without any issues
on CPython.

However, handling of *note __del__(): 13ab. 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(): c58, ‘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: 32e. や *note str: 1ea. のように組み込みとして公開されていないよう
ないくつかのオブジェクト型の名前を定義しています。

最後に、組み込みになるほど基本的でないような追加の型関連のユーティリティ
と関数をいくつか提供しています。

* Menu:

* 動的な型生成::
* 標準的なインタプリタ型::
* 追加のユーティリティクラスと関数::
* コルーチンユーティリティ関数::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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 メタクラス: 25d2.

     これらの関数によってサポートされるクラス生成プロセスの完全な詳細

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: 191, and returns a tuple where each such object that
     has an *note __mro_entries__(): eb5. 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__(): eb5. method has been called on
     any bases (following the mechanisms laid out in PEP 560(3)).  This
     is useful for introspecting *note Generics: 8e4.

     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__: 1864. 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(): 2fb. や *note issubclass():
2fc. によるチェックに使われます。

これらのタイプのいずれかをインスタンス化する場合、シグネチャは Python の
バージョンによって異なる可能性があることに注意してください。

以下の型に対して標準的な名前が定義されています:

 -- データ: types.NoneType

     *note None: a6a. の型です。

     Added in version 3.10.

 -- データ: types.FunctionType
 -- データ: types.LambdaType

     ユーザ定義の関数と *note lambda: 1657. 式によって生成された関数の型
     です。

     引数 ‘code’ を指定して *note 監査イベント: 1e84. ‘function.__new__’
     を送出します。

     この監査イベントは、関数オブジェクトを直接インスタンス化した場合に
     のみ発生し、通常のコンパイル時には発生しません。

 -- データ: types.GeneratorType

     ジェネレータ関数によって生成された *note ジェネレータ: 1417. イテレ
     ータオブジェクトの型です。

 -- データ: types.CoroutineType

     *note async def: 9d4. 関数に生成される *note コルーチン: 8a7. オブ
     ジェクトです。

     Added in version 3.5.

 -- データ: types.AsyncGeneratorType

     非同期ジェネレータ関数によって作成された *note 非同期ジェネレータ:
     26b1. イテレータオブジェクトの型です。

     Added in version 3.6.

 -- クラス: types.CodeType (**kwargs)

     The type of *note code objects: 6f1. such as returned by *note
     compile(): 1d3.

     引数 ‘code’, ‘filename’, ‘name’, ‘argcount’, ‘posonlyargcount’,
     ‘kwonlyargcount’, ‘nlocals’, ‘stacksize’, ‘flags’ を指定して *note
     監査イベント: 1e84. ‘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: 1ad6.

     Added in version 3.8.

 -- データ: types.MethodType

     ユーザー定義のクラスのインスタンスのメソッドの型です。

 -- データ: types.BuiltinFunctionType
 -- データ: types.BuiltinMethodType

     *note len(): a24. や *note sys.exit(): 506. のような組み込み関数や
     、組み込み型のメソッドの型です。 (ここでは "組み込み" という単語を
     "Cで書かれた" という意味で使っています)

 -- データ: types.WrapperDescriptorType

     The type of methods of some built-in data types and base classes
     such as *note object.__init__(): 306. or *note object.__lt__():
     165a.

     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: 447. の型です。

     Added in version 3.10.

 -- データ: types.MethodDescriptorType

     The type of methods of some built-in data types such as *note
     str.join(): 2821.

     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: 1c06. の型です。コンストラクタは生成するモジュールの
     名前と任意でその *note docstring: 24fb. を受け取ります。

     参考
     ....

     *note Documentation on module objects: 256d.

          Provides details on the special attributes that can be found
          on instances of ‘ModuleType’.

     *note importlib.util.module_from_spec(): 11ca.

          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: 2537. の型です。

     Added in version 3.10.

 -- クラス: types.GenericAlias (t_origin, t_args)

     The type of *note parameterized generics: aa4. 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: 1d9.
     (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: aa4.

          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: ba6.

     Added in version 3.10.

     バージョン 3.14 で変更: This is now an alias for *note
     typing.Union: 349.

 -- クラス: types.TracebackType (tb_next, tb_frame, tb_lasti, tb_lineno)

     ‘sys.exception().__traceback__’ に含まれるようなトレースバックオブ
     ジェクトの型です。

     See *note the language reference: ebe. for details of the available
     attributes and operations, and guidance on creating tracebacks
     dynamically.

 -- データ: types.FrameType

     The type of *note frame objects: ad2. such as found in *note
     tb.tb_frame: 25b4. if ‘tb’ is a traceback object.

 -- データ: types.FrameLocalsProxyType

     The type of frame locals proxy objects, as found on the *note
     frame.f_locals: 298. attribute.

     Added in version 3.15.

     参考
     ....

     PEP 667(2)

 -- データ: types.LazyImportType

     The type of lazy import proxy objects.  These objects are created
     when a module is lazily imported and serve as placeholders until
     the module is actually accessed.  This type can be used to detect
     lazy imports programmatically.

     Added in version 3.15.

     参考
     ....

     PEP 810(3)

 -- データ: types.GetSetDescriptorType

     The type of objects defined in extension modules with
     ‘PyGetSetDef’, such as *note FrameType.f_locals: 298. or
     ‘array.array.typecode’.  This type is used as descriptor for object
     attributes; it has the same purpose as the *note property: 6c1.
     type, but for classes defined in extension modules.

 -- データ: types.MemberDescriptorType

     ‘datetime.timedelta.days’ のような、拡張モジュールにおいて
     ‘PyMemberDef’ によって定義されたオブジェクトの型です。この型は、標
     準の変換関数を利用するような、Cのシンプルなデータメンバで利用されま
     す。 *note property: 6c1. 型と同じ目的を持った型ですが、こちらは拡
     張モジュールで定義された型のためのものです。

     In addition, when a class is defined with a *note __slots__: 18a3.
     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__: 101f.

     Pythonの他の実装では、この型は ‘GetSetDescriptorType’ と同じかもし
     れません。

 -- クラス: types.MappingProxyType (mapping)

     読み出し専用のマッピングのプロキシです。マッピングのエントリーに関
     する動的なビューを提供します。つまり、マッピングが変わった場合にビ
     ューがこれらの変更を反映するということです。

     Added in version 3.3.

     バージョン 3.9 で変更: Updated to support the new union (‘|’)
     operator from PEP 584(4), which simply delegates to the underlying
     mapping.

      -- Describe: key in proxy

          元になったマッピングが 'key' というキーを持っている場合 ‘True’
          を返します。そうでなければ ‘False’ を返します。

      -- Describe: proxy[key]

          元になったマッピングの 'key' というキーに対応するアイテムを返
          します。 'key' が存在しなければ、 *note KeyError: 7e5. が発生
          します。

      -- Describe: iter(proxy)

          元になったマッピングのキーを列挙するイテレータを返します。これ
          は ‘iter(proxy.keys())’ のショートカットです。

      -- Describe: len(proxy)

          元になったマッピングに含まれるアイテムの数を返します。

      -- メソッド: copy ()

          元になったマッピングの浅いコピーを返します。

      -- メソッド: get (key[, default])

          'key' が元になったマッピングに含まれている場合 'key' に対する
          値を返し、そうでなければ 'default' を返します。もし 'default'
          が与えられない場合は、デフォルト値の ‘None’ になります。そのた
          め、このメソッドが *note KeyError: 7e5. を発生させることはあり
          ません。

      -- メソッド: 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: 2c1c.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://peps.python.org/pep-0667/

   (3) https://peps.python.org/pep-0810/

   (4) https://peps.python.org/pep-0584/


File: python.info,  Node: 追加のユーティリティクラスと関数,  Next: コルーチンユーティリティ関数,  Prev: 標準的なインタプリタ型,  Up: types --- 動的な型生成と組み込み型の名前

5.9.10.3 追加のユーティリティクラスと関数
.........................................

 -- クラス: types.SimpleNamespace

     名前空間への属性アクセスに加えて意味のある repr を提供するための、
     単純な *note object: e51. サブクラスです。

     Unlike *note object: e51, with ‘SimpleNamespace’ you can add and
     remove attributes.

     ‘SimpleNamespace’ objects may be initialized in the same way as
     *note dict: 193.: 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: 149a.
     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(): 1da. を使用してください。

     ‘SimpleNamespace’ objects are supported by *note copy.replace():
     461.

     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:
     a26. を参照してください)。

     Added in version 3.4.


File: python.info,  Node: コルーチンユーティリティ関数,  Prev: 追加のユーティリティクラスと関数,  Up: types --- 動的な型生成と組み込み型の名前

5.9.10.4 コルーチンユーティリティ関数
.....................................

 -- の関数: types.coroutine (gen_func)

     この関数は、 *note generator: 1417. 関数を、ジェネレータベースのコ
     ルーチンを返す *note coroutine function: 1130. に変換します。返され
     るジェネレータベースのコルーチンは依然として *note generator
     iterator: fa2. ですが、同時に *note coroutine: 8a7. オブジェクトか
     つ *note awaitable: 6d5. であるとみなされます。ただし、必ずしも
     *note __await__(): 1132. メソッドを実装する必要はありません。

     'gen_func' はジェネレータ関数で、インプレースに変更されます。

     'gen_func' がジェネレータ関数でない場合、この関数はラップされます。
     この関数が *note collections.abc.Generator: 1197. のインスタンスを
     返す場合、このインスタンスは '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(): f2f. 関数では、これらの問題を以下のようにして回避して
います:

   * 現時点でのコピー過程ですでにコピーされたオブジェクトの ‘memo’ 辞書
     を保持する。

   * ユーザ定義のクラスでコピー操作やコピーされる内容の集合を上書きでき
     るようにする。

このモジュールでは、モジュール、メソッド、スタックトレース、スタックフレ
ーム、ファイル、ソケット、ウィンドウ、その他これらに類似の型をコピーしま
せん。このモジュールでは元のオブジェクトを変更せずに返すことで関数とクラ
スを (浅くまたは深く)「コピー」します。これは *note pickle: ab. モジュー
ルでの扱われかたと同じです。

辞書型の浅いコピーは *note dict.copy(): f92. で、リストの浅いコピーはリ
スト全体を指すスライス (例えば ‘copied_list = original_list[:]’) ででき
ます。

Classes can use the same interfaces to control copying that they use to
control pickling.  See the description of module *note pickle: ab. for
information on these methods.  In fact, the ‘copy’ module uses the
registered pickle functions from the *note copyreg: 2a. module.

In order for a class to define its own copy implementation, it can
define special methods *note __copy__(): 1a6c. and *note __deepcopy__():
192a.

 -- メソッド: 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(): f2f. 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(): 947. and
*note deepcopy(): f2f, and only supports named tuples created by *note
namedtuple(): 1da, *note dataclasses: 32, and other classes which define
method *note __replace__(): 692.

 -- メソッド: 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/main/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 88 characters.

バージョン 3.9 で変更: *note types.SimpleNamespace: 6f0. の pretty-print
サポートが追加されました。

バージョン 3.10 で変更: *note dataclasses.dataclass: 6ec. の
pretty-print サポートが追加されました。

* Menu:

* 関数: 関数<4>.
* PrettyPrinter objects::
* 使用例: 使用例<6>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/pprint.py


File: python.info,  Node: 関数<4>,  Next: PrettyPrinter objects,  Up: pprint --- データの整形表示

5.9.12.1 関数
.............

 -- の関数: pprint.pp (object, stream=None, indent=4, width=88,
          depth=None, *, compact=False, sort_dicts=False,
          underscore_numbers=False)

     'object' のフォーマットされた表現を出力して、その後に newline を続
     けます。この関数は、対話型インタプリタの中で値を調査するために
     *note print(): 1324. 関数の代わりに使用されることがあります。Tips：
     さらに、スコープ内で使用するために ‘print = pprint.pp’ を再代入する
     ことができます)。


     パラメータ:

        * ‘object’ - The object to be printed.

        * ‘stream’ (*note file-like object: 19d1. | None) - A file-like
          object to which the output will be written by calling its
          ‘write()’ method.  If ‘None’ (the default), *note sys.stdout:
          ea0. is used.

        * ‘indent’ (*note int: 32e.) - 入れ子レベルごとに追加されるイン
          デントの量を指定します。

        * ‘width’ (*note int: 32e.) - 出力の1行あたり最大文字数を指定し
          ます。構造が幅の制約の中で整形できない場合、最善の努力がなされ
          ます。

        * ‘depth’ (*note int: 32e.‘ | ’‘None’) - 表示される入れ子レベル
          の数を制御します。表示されるデータ構造が深すぎる場合、含まれる
          次のレベルは''...''で置き換えられます。‘None’ （デフォルト）の
          場合、フォーマットされるオブジェクトの深さに制約はありません。

        * ‘compact’ (*note bool: 5f6.) - Control the way long *note
          sequences: 904. are formatted.  If ‘False’ (the default),
          opening parentheses and brackets will be followed by a newline
          and the following content will be indented by one level,
          similar to pretty-printed JSON. If ‘True’, as many items as
          will fit within the 'width' will be formatted on each output
          line.

        * ‘sort_dicts’ (*note bool: 5f6.) - Trueの場合、辞書は辞書のキー
          順にソートされて整形されます。そうでなければ挿入順に表示されま
          す（デフォルト）。

        * ‘underscore_numbers’ (*note bool: 5f6.) - Trueの場合、整数は
          ''_''で3桁区切りされて表示されます。そうでなければアンダースコ
          アは表示されません（デフォルト）。

          >>> import pprint
          >>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
          >>> stuff.insert(0, stuff)
          >>> pprint.pp(stuff, width=100)
          [<Recursion on list with id=...>, 'spam', 'eggs', 'lumberjack', 'knights', 'ni']

     Added in version 3.8.

 -- の関数: pprint.pprint (object, stream=None, indent=4, width=88,
          depth=None, *, compact=False, sort_dicts=True,
          underscore_numbers=False)

     Alias for *note pp(): deb. 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=4, width=88, 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: 132e.
     constructor as formatting parameters and their meanings are as
     described in the documentation above.

 -- の関数: pprint.isreadable (object)

     'object' を書式化して出力できる("readable") か、あるいは *note
     eval(): 18f. を使って値を再構成できるかを返します。再帰的なオブジェ
     クトに対しては常に ‘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(): 2c2a. below and may raise an *note RecursionError:
     1125. 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: 193, *note list: 4e0. and *note tuple: 1d9. 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 objects,  Next: 使用例<6>,  Prev: 関数<4>,  Up: pprint --- データの整形表示

5.9.12.2 PrettyPrinter objects
..............................

 -- クラス: pprint.PrettyPrinter (indent=4, width=88, 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(): deb.  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()
          >>> pp.pprint(stuff)
          [
              ['spam', 'eggs', 'lumberjack', 'knights', 'ni'],
              'spam',
              'eggs',
              'lumberjack',
              'knights',
              'ni',
          ]
          >>> pp = pprint.PrettyPrinter(indent=1, width=41, compact=True)
          >>> pp.pprint(stuff)
          [['spam', 'eggs', 'lumberjack',
            'knights', 'ni'],
           'spam', 'eggs', 'lumberjack', 'knights',
           'ni']
          >>> pp = pprint.PrettyPrinter(width=41, indent=3)
          >>> 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’.

     バージョン 3.15 で変更: Changed default 'indent' from 1 to 4 and
     default 'width' from 80 to 88.  The default ‘compact=False’ layout
     is now similar to pretty-printed JSON, with opening parentheses and
     brackets followed by a newline and the contents indented by one
     level.

*note PrettyPrinter: 132e. インスタンスには以下のメソッドがあります:

 -- メソッド: PrettyPrinter.pformat (object)

     'object' の書式化した表現を返します。これは *note PrettyPrinter:
     132e. のコンストラクタに渡されたオプションを考慮して書式化されます
     。

 -- メソッド: PrettyPrinter.pprint (object)

     'object' の書式化した表現を指定したストリームに出力し、最後に改行し
     ます。

以下のメソッドは、対応する同じ名前の関数と同じ機能を持っています。以下の
メソッドをインスタンスに対して使うと、新たに *note PrettyPrinter: 132e.
オブジェクトを作る必要がないのでちょっぴり効果的です。

 -- メソッド: PrettyPrinter.isreadable (object)

     'object' を書式化して出力できる（"readable"）か、あるいは *note
     eval(): 18f. を使って値を再構成できるかを返します。これは再帰的なオ
     ブジェクトに対して ‘False’ を返すことに注意して下さい。もし *note
     PrettyPrinter: 132e. の 'depth' 引数が設定されていて、オブジェクト
     のレベルが設定よりも深かったら、 ‘False’ を返します。

 -- メソッド: PrettyPrinter.isrecursive (object)

     オブジェクトが再帰的な表現かどうかを返します。

このメソッドをフックとして、サブクラスがオブジェクトを文字列に変換する方
法を修正するのが可能になっています。デフォルトの実装では、内部で *note
saferepr(): 2c2a. を呼び出しています。

 -- メソッド: PrettyPrinter.format (object, context, maxlevels, level)

     次の3つの値を返します。'object' をフォーマット化して文字列にしたも
     の、その結果が読み込み可能かどうかを示すフラグ、再帰が含まれている
     かどうかを示すフラグ。最初の引数は表示するオブジェクトです。 2つめ
     の引数はオブジェクトの *note id(): 17db. をキーとして含むディクショ
     ナリで、オブジェクトを含んでいる現在の（直接、間接に 'object' のコ
     ンテナとして表示に影響を与える）環境です。ディクショナリ 'context'
     の中でどのオブジェクトが表示されたか表示する必要があるなら、3つめの
     返り値は ‘True’ になります。 *note format(): 1efb. メソッドの再帰呼
     び出しではこのディクショナリのコンテナに対してさらにエントリを加え
     ます。 3つめの引数 'maxlevels' で再帰呼び出しのレベルを制限します。
     制限しない場合、 ‘0’ になります。この引数は再帰呼び出しでそのまま渡
     されます。 4つめの引数 'level' で現在のレベルを設定します。再帰呼び
     出しでは、現在の呼び出しより小さい値が渡されます。


File: python.info,  Node: 使用例<6>,  Prev: PrettyPrinter objects,  Up: pprint --- データの整形表示

5.9.12.3 使用例
...............

*note pp(): deb. 関数のいくつかの用途とそのパラメータを実証するために、
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(): deb. はオブジェクト全体を表示します:

     >>> 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(): 462. に似た関数を実装するために役に立つ
     フォーマット用サービスを提供します。 過度に長い表現を作り出さないよ
     うにするための大きさの制限をオブジェクト型ごとに設定できます。

     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: 2c37. for more information about
     ‘Repr’ attributes.

     バージョン 3.12 で変更: Allow attributes to be set via keyword
     arguments.

 -- データ: reprlib.aRepr

     これは下で説明される *note repr(): 2c39. 関数を提供するために使われ
     る *note Repr: 2c36. のインスタンスです。このオブジェクトの属性を変
     更すると、 ‘repr()’ と Python デバッガが使うサイズ制限に影響します
     。

 -- の関数: reprlib.repr (obj)

     これは ‘aRepr’ の *note repr(): 2c3a. メソッドです。同じ名前の組み
     込み関数が返す文字列と似ていますが、最大サイズに制限のある文字列を
     返します。

In addition to size-limiting tools, the module also provides a decorator
for detecting recursive calls to *note __repr__(): 1c7. and substituting
a placeholder string instead.

 -- の関数: @reprlib.recursive_repr (fillvalue='...')

     Decorator for *note __repr__(): 1c7. 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/main/Lib/reprlib.py


File: python.info,  Node: Reprオブジェクト,  Next: Reprオブジェクトをサブクラス化する,  Up: reprlib --- もう一つの repr の実装

5.9.13.1 Reprオブジェクト
.........................

*note Repr: 2c36. インスタンスはオブジェクト型毎に表現する文字列のサイズ
を制限するために使えるいくつかの属性と、特定のオブジェクト型をフォーマッ
トするメソッドを提供します。

 -- の属性: 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: 2c3e. に対するデフォルトは ‘4’ で、 *note maxarray:
     2c44. は ‘5’ 、その他に対しては ‘6’ です。

 -- の属性: Repr.maxlong

     整数の表現のおける文字数の最大値。中央の数字が抜け落ちます。デフォ
     ルトは ‘40’ です。

 -- の属性: Repr.maxstring

     文字列の表現における文字数の制限。文字列の"通常の"表現は文字の「元
     」として使われることに注意してください。表現にエスケープシーケンス
     が必要とされる場合、表現が短縮されるときにこれらのエスケープシーケ
     ンスの形式は崩れます。デフォルトは ‘30’ です。

 -- の属性: Repr.maxother

     この制限は *note Repr: 2c36. オブジェクトに利用できる特定のフォーマ
     ットメソッドがないオブジェクト型のサイズをコントロールするために使
     われます。 *note maxstring: 2c46. と同じようなやり方で適用されます
     。デフォルトは ‘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(): 462.  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(): 462. と等価なもの。

 -- メソッド: Repr.repr1 (obj, level)

     *note repr(): 2c3a. が使う再帰的な実装。 'obj' の型を使ってどのフォ
     ーマットメソッドを呼び出すかを決定し、それに 'obj' と 'level' を渡
     します。 再帰呼び出しにおいて 'level' の値に対して ‘level - 1’ を与
     える再帰的なフォーマットを実行するために、型に固有のメソッドは
     *note repr1(): 2c49. を呼び出します。

 -- メソッド: Repr.repr_TYPE (obj, level)

     型名に基づく名前をもつメソッドとして、特定の型に対するフォーマット
     メソッドは実装されます。メソッド名では、 'TYPE' は
     ‘'_'.join(type(obj).__name__.split())’ に置き換えられます。これらの
     メソッドへのディスパッチは *note repr1(): 2c49. によって処理されま
     す。再帰的に値をフォーマットする必要がある型固有のメソッドは、
     ‘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(): 2c49. allows
subclasses of *note Repr: 2c36. 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 基本チュートリアル: 2c4f.

   * *note 上級チュートリアル: 2c50.

   * *note Enum クックブック: 2c51.

__________________________________________________________________

列挙型とは:

   * 一意の値に紐付けられたシンボリックな名前の集合です

   * 反復可能であり、定義順にその正規の（エイリアスでない）メンバーを返
     します

   * 値を渡してメンバーを返すために、 '呼び出し' 構文を使用します

   * 名前を受け取ってメンバーを返すために、 'インデックス' 構文を使用し
     ます

列挙型は、*note class: 1691. 構文を使用するか、関数呼び出し構文を使用し
て作成されます:

     >>> 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: 1691. 文を使用できるものの、Enum は通常の
Python クラスではありません。詳細は *note Enum はどう違うのか?: 2c52. を
参照してください。

     注釈: 用語

        - クラス ‘Color’ は '列挙型' (または 'Enum') です

        - 属性 ‘Color.RED’, ‘Color.GREEN’ などは '列挙型のメンバー' (ま
          たは 'メンバー') で、機能的には定数です。

        - 列挙型のメンバーは '名前' と '値' を持ちます (‘Color.RED’ の名
          前は ‘RED’ 、 ‘Color.BLUE’ の値は ‘3’ など。)

__________________________________________________________________

* Menu:

* モジュールの内容: モジュールの内容<2>.
* データ型: データ型<2>.
* Utilities and decorators::
* 注釈::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/enum.py


File: python.info,  Node: モジュールの内容<2>,  Next: データ型<2>,  Up: enum --- 列挙型のサポート

5.9.14.1 モジュールの内容
.........................

     *note EnumType: 702.

          Enumおよびそのサブクラスのための ‘type’ です。

     *note Enum: a26.

          列挙型定数を作成する基底クラスです。

     *note IntEnum: 10a1.

          *note int: 32e. のサブクラスでもある列挙型定数を作成する基底ク
          ラスです。(*note Notes: 2c54.)

     *note StrEnum: a12.

          *note str: 1ea. のサブクラスでもある列挙型定数を作成する基底ク
          ラスです。(*note Notes: 2c54.)

     *note Flag: a19.

          列挙型定数を作成する基底クラスで、ビット演算を使って組み合わせ
          られ、その結果も *note Flag: a19. メンバーになります。

     *note IntFlag: 1061.

          列挙型定数を作成する基底クラスで、ビット演算子を使って組み合わ
          せられ、その結果も *note IntFlag: 1061. メンバーになります。
          ‘IntFlag’ は *note int: 32e. のサブクラスでもあります。(*note
          Notes: 2c54.)

     *note ReprEnum: a13.

          *note IntEnum: 10a1.、*note StrEnum: a12.、および *note
          IntFlag: 1061. によって使用され、mix-inされた型の *note str():
          1ea. を保持します。

     *note EnumCheck: a1c.

          ‘CONTINUOUS’、‘NAMED_FLAGS’、‘UNIQUE’ の値を持つ列挙型です。
          *note verify(): a1b. と共に使用して、指定された列挙型がさまざ
          まな制約を満たしていることを確認します。

     *note FlagBoundary: a1a.

          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: 701.

          A subclass of *note dict: 193. for use when subclassing *note
          EnumType: 702.

     *note auto: 1062.

          インスタンスは列挙型のメンバーに適切な値で置き換えられます。
          *note StrEnum: a12. ではデフォルトの値がメンバー名を小文字にし
          たものですが、その他の列挙型のデフォルトは1から連番で増加する
          値となります。

     *note property(): a1f.

          メンバー名との競合を避けながら *note Enum: a26. メンバーに属性
          を持たせます。‘value’ 属性と ‘name’ 属性はこの方法で実装されま
          す。

     *note unique(): 2c55.

          一つの名前だけがひとつの値に束縛されていることを保証する Enum
          クラスのデコレーターです。

     *note verify(): a1b.

          Enum class decorator that checks user-selectable constraints
          on an enumeration.

     *note member(): a1d.

          ‘obj’ をメンバーにします。デコレータとして使用できます。

     *note nonmember(): a1e.

          ‘obj’ をメンバーにしません。デコレータとして使用できます。

     *note global_enum(): a21.

          Modify the *note str(): 1ea. and *note repr(): 462. 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(): 19eb.

          フラグに含まれる、全ての2の累乗の整数のリストを返します。

     *note enum.bin(): 19a8.

          Like built-in *note bin(): 1662, 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: モジュールの内容<2>,  Up: enum --- 列挙型のサポート

5.9.14.2 データ型
.................

 -- クラス: enum.EnumType

     'EnumType' は 'enum' 列挙型の *note メタクラス: 25e4. です。
     'EnumType' のサブクラスを作成することが可能です - 詳細は *note
     EnumTypeのサブクラスを作る: 2c57. を参照してください。

     ‘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: 1062. で使用
                    されます）。


                    boundary: bit演算での範囲外の値の扱い方（*note Flag:
                    a19. のみ）。

      -- メソッド: __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: 7e5. を送
          出します:

               >>> 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__(): 2c62.

               注釈: 列挙型のメンバー値

               メンバー値は何であっても構いません: *note int: 32e, *note
               str: 1ea. などなど。 正確な値が重要でない場合は、 *note
               auto: 1062. インスタンスを使っておくと、適切な値が選ばれ
               ます。 詳細は ‘auto’ を参照してください。

               While mutable/unhashable values, such as *note dict: 193,
               *note list: 4e0. or a mutable *note dataclass: 6ec, 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__(): 2c62.

      -- の属性: _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: 2c67. を参照
          してください。

          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: 1062.

               注釈: 標準の *note Enum: a26. クラスの場合、次の値として
               選択されるのは、定義された最大の値に1を加えたものです。

               *note Flag: a19. クラスでは、次に選ばれる値は、次の最大の
               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__(): a18. の戻り値を返しま
          すが、オーバーライドすることもできます。:

               >>> 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: a26. で *note auto: 1062. を使用すると、 ‘1’
          から始まりインクリメントする整数が値となります。

     バージョン 3.12 で変更: Added *note データクラスのサポート: 1d17.

      -- メソッド: _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: 66c. 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: 15a. if the value is already linked with a different member.
               See *note MultiValueEnum: 2c6e. for an example.

          Added in version 3.13.

 -- クラス: enum.IntEnum

     'IntEnum' is the same as *note Enum: a26, 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: 10a1. で *note auto: 1062. を使用すると、
          ‘1’ から始まりインクリメントする整数が値となります。

     バージョン 3.11 で変更: *note __str__(): a14. は、既存の定数を置き
     換えるユースケースをより良くサポートするために ‘int.__str__()’ に変
     更されました。同じ理由で、*note __format__(): a15. は既に
     ‘int.__format__()’ に変更されています。

 -- クラス: enum.StrEnum

     'StrEnum' is the same as *note Enum: a26, 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: 1ea. 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: a12. で *note auto: 1062. を使用すると、
          メンバー名を小文字に変換したものが値となります。

          注釈: *note __str__(): a14. は '既存の定数の置換' ユースケース
          をより良くサポートするために ‘str.__str__()’ となりました。
          *note __format__(): a15. も同様に、同じ理由で
          ‘str.__format__()’ となりました。

     Added in version 3.11.

 -- クラス: enum.Flag

     ‘Flag’ is the same as *note Enum: a26, 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():
          1689. and *note oct(): 1688.

          注釈: *note auto: 1062. と *note Flag: a19. を一緒に使うと、
          ‘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: a19, 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: a19. operation is performed with an 'IntFlag'
     member and:

        * 結果が有効な 'IntFlag': 'IntFlag' が返されます

        * the result is not a valid 'IntFlag': the result depends on the
          *note FlagBoundary: a1a. setting

     The *note repr(): 462. of unnamed zero-valued flags has changed.
     It is now:

          >>> Color(0)
          <Color: 0>

          注釈: *note auto: 1062. と *note IntFlag: 1061. を一緒に使うと
          、‘1’ から始まる2の累乗の整数になります。

     バージョン 3.11 で変更: *note __str__(): a14. は、既存の定数を置き
     換えるユースケースをより良くサポートするために ‘int.__str__()’ に変
     更されました。同じ理由で、*note __format__(): a15. は既に
     ‘int.__format__()’ に変更されています。

     ‘IntFlag’ の反転は、与えられたフラグ以外のすべてのフラグの結合とな
     る正の値を返すようになりました。これは既存の *note Flag: a19. の振
     る舞いに一致します。

 -- クラス: enum.ReprEnum

     ‘ReprEnum’ uses the *note repr(): 1d18. of *note Enum: a26, but the
     *note str(): 1ea. of the mixed-in data type:

        * ‘int.__str__()’ for *note IntEnum: 10a1. and *note IntFlag:
          1061.

        * ‘str.__str__()’ for *note StrEnum: a12.

     ‘ReprEnum’ を継承することで、*note Enum: a26. デフォルトの *note
     str(): a18. を使用する代わりに、mix-inされたデータ型の *note str():
     1ea. / *note format(): 440. を使用します。

     Added in version 3.11.

 -- クラス: enum.EnumCheck

     'EnumCheck' には *note verify(): a1b. デコレータやさまざまな制約を
     保証するために使用されるオプションが含まれています。制約に違反する
     と *note ValueError: 15a. が発生します。

      -- の属性: 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(): 1062. によ
          って生成される場合に便利です:

               >>> 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: a19. and its subclasses.

      -- の属性: STRICT

          範囲外の値は *note ValueError: 15a. を送出します。これは *note
          Flag: a19. のデフォルトです:

               >>> 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: a19. 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: a19. membership and
          revert to *note int: 32e.

               >>> 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: a19.
          membership is kept.  This is the default for *note IntFlag:
          1061.:

               >>> 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: 193. that is used as the
     namespace for defining enum classes (see *note
     クラスの名前空間の準備: 1020.).  It is exposed to allow subclasses
     of *note EnumType: 702. 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: 146a. interface (*note
     __setitem__(): 1685. and *note update(): 181d.) is overridden.  It
     may be possible to bypass the checks using other ‘dict’ operations
     like *note |=: 2615.

      -- の属性: 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__: 2c5e. は読み込み専用の、 ‘member_name’:‘member’ を要
素とする順序付きマッピングです。これはクラスでのみ利用可能です。

*note __new__(): 2c62, if specified, must create and return the enum
members; it is also a very good idea to set the member's *note _value_:
2c64. 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_: 2c63. - メンバー名

   - *note _value_: 2c64. - メンバーの値; ‘__new__’ で設定できます

   - *note _missing_(): 2c6b. - 値が見付からなかったときに使われる検索関
     数; オーバーライドされていることがあります

   - *note _ignore_: 2c66. - 名前のリストで、 *note list: 4e0. もしくは
     *note str: 1ea. です。この名前の要素はメンバーへの変換が行われず、
     最終的なクラスから削除されます。

   - *note _order_: 2c65. - no longer used, kept for backward
     compatibility (class attribute, removed during class creation)

   - *note _generate_next_value_(): 2c68. - 列挙型のメンバーの適切な値を
     取得するのに使われます。オーバーライドされます。

   - *note _add_alias_(): 2c6c. - adds a new name as an alias to an
     existing member.

   - *note _add_value_alias_(): 2c6d. - 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: a26. 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: a26.'s *note
     _generate_next_value_(): 2c68. to get an appropriate value.  For
     ‘Enum’ and *note IntEnum: 10a1. that appropriate value will be the
     highest value seen plus one; for *note Flag: a19. and *note
     IntFlag: 1061. it will be the first power-of-two greater than the
     highest value seen; for *note StrEnum: a12. 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’ が使用されます
          ）

        * ‘THIRD = [auto(), -3]’ will 'not' work (‘[<auto instance>,
          -3]’ is used to create the ‘THIRD’ enum member)

     バージョン 3.11.1 で変更: 以前のバージョンでは、 ‘auto()’ は、代入
     行に他のものがあると正しく動作しませんでした。

     ‘_generate_next_value_’ は、 'auto' が使用する値をカスタマイズする
     ためにオーバーライドすることができる。

          注釈: In version 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: 1691. デコレーターです。列挙型の *note
     __members__: 2c5e. に別名がないかどうか検索します; 見つかった場合、
     *note ValueError: 15a. が詳細情報とともに送出されます:

          >>> 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: 1691. デコレーターです。対象の列挙型に対
     してチェックを行う制約の指定には *note EnumCheck: a1c. のメンバーが
     使用されます。

     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(): 1ea. and *note repr(): 462.
     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:
     a23. 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: 10a1. 、 *note StrEnum: a12. 、 *note IntFlag: 1061.

     これらの3つの列挙型は、既存の整数ベースおよび文字列ベースの値の代替
     として設計されています。そのため、追加の制限があります:

        - ‘__str__’ は、列挙型のメンバーの名前ではなく値を使用します

        - ‘__format__’ は ‘__str__’ を使用するため、列挙型のメンバーの名
          前ではなく値を使用します

     もし、そのような制限が必要でない/望まない場合は、‘int’ または ‘str’
     タイプを継承して、カスタムの基底クラスを作成することができます:

          >>> from enum import Enum
          >>> class MyIntEnum(int, Enum):
          ...     pass

     または列挙型の中で適切な *note str(): 1ea. などを再代入することもで
     きます:

          >>> 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 ハッシュ可能: 18e. な頂点のグラフをトポロジカルソートする機能
     を提供します。

     トポロジカル順序はグラフの頂点の線形順序で、頂点 u から 頂点 v への
     有向辺 u-> v 全てについて、頂点 u が頂点 v よりも前にくるような順序
     です。例えば、グラフの頂点が実行するタスクを表し、その辺があるタス
     クが別のタスクよりも前に実行されなければならないという制約を表す場
     合、トポロジカル順序は制約を満たすタスクの実行順序のシーケンスにな
     ります。トポロジカル順序が得られるのは、グラフが有向閉路を持たない
     、つまり有向非巡回グラフである場合でかつその時に限ります。

     もしオプションの 'graph' 引数が与えられた場合、その値は有向非巡回グ
     ラフを表す辞書でなければならず、辞書はそのキーがノードで、その値は
     キーのノードの先行ノードのイテラブルとなります（言い換えると、辞書
     の値はそのキーのノードを指す辺を持つノードのイテラブルです） 辺
     *note add(): 2c84. メソッドを使うことで、さらにノードを追加すること
     ができます。

     一般的に、与えられたグラフのソートの実行に必要なステップは以下のよ
     うになります:

        * *note TopologicalSorter: cb7. のインスタンスをオプションの初期
          グラフで生成します。

        * さらにノードをグラフに追加します。

        * *note prepare(): 4b4. をグラフ上で呼び出します。

        * *note is_active(): 2c85. が ‘True’ の間、 *note get_ready():
          2c86. によって返されたノード群をイテレートし、それらを処理しま
          す。ノードの処理が終わる都度、*note done(): 2c87. を呼び出しま
          す。

     すぐにグラフのノードをソートした結果が必要で、並行性が不要な場合、
     便利なメソッド *note TopologicalSorter.static_order(): 2c88. を直接
     呼び出すことができます:

          >>> 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 ハッシュ可能: 18e. でな
          ければなりません。

          同じ 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(): 4b4. を呼び出した後にこのメソッドを呼び出すと
          、*note ValueError: 15a. を送出します。

      -- メソッド: prepare ()

          Mark the graph as finished and check for cycles in the graph.
          If any cycle is detected, *note CycleError: 2c89. will be
          raised, but *note get_ready(): 2c86. 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(): 2c84.

          A *note ValueError: 15a. will be raised if the sort has been
          started by *note static_order(): 2c88. or *note get_ready():
          2c86.

          バージョン 3.14 で変更: ‘prepare()’ can now be called more
          than once as long as the sort has not started.  Previously
          this raised *note ValueError: 15a.

      -- メソッド: 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():
          2c86. or the number of nodes marked *note
          TopologicalSorter.done(): 2c87. is less than the number that
          have been returned by ‘TopologicalSorter.get_ready()’.

          The *note __bool__(): 168f. method of this class defers to
          this function, so instead of:

               if ts.is_active():
                   ...

          このように簡単に記述できます:

               if ts:
                   ...

          前もって *note prepare(): 4b4. を呼び出さずにこの関数を呼び出
          すと *note ValueError: 15a. を送出します。

      -- メソッド: done (*nodes)

          Marks a set of nodes returned by *note
          TopologicalSorter.get_ready(): 2c86. 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: 15a. 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(): 2c84, if called without calling *note
          prepare(): 4b4. or if node has not yet been returned by *note
          get_ready(): 2c86.

      -- メソッド: 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(): 2c87, 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(): 4b4. を呼び出さずにこの関数を呼び出
          すと *note ValueError: 15a. を送出します。

      -- メソッド: static_order ()

          Returns an iterator object which will iterate over nodes in a
          topological order.  When using this method, *note prepare():
          4b4. and *note done(): 2c87. 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(): 2c86.) and the order between them is
          determined by the order of insertion.

          If any cycle is detected, *note CycleError: 2c89. will be
          raised.

     Added in version 3.9.

* Menu:

* 例外: 例外<4>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 15a. raised by *note
     TopologicalSorter.prepare(): 4b4. 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: 977. 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: 91. と *note cmath: 19. モジュールは、
浮動小数点数と複素数のための様々な数学関数を含んでいます。 *note
decimal: 39. モジュールは、任意精度の計算を使用して、10進数の正確な表現
をサポートします。

この章では以下のモジュールが記述されています:

* Menu:

* numbers: numbers --- 数の抽象基底クラス. 数の抽象基底クラス
* math: math --- 数学関数. 数学関数
* math.integer: math integer --- integer-specific mathematics functions. integer-specific mathematics functions
* 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: 1574. 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/main/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: 330. 型
     を受け付ける演算を含みます。それらは: ‘complex’ および *note bool:
     5f6. への変換、 *note real: 2c93, *note imag: 2c94, ‘+’, ‘-’, ‘*’,
     ‘/’, ‘**’, *note abs(): 229a, *note conjugate(): 2c95, ‘==’, ‘!=’ で
     す。 ‘-’ と ‘!=’ 以外の全てのものは抽象メソッドや抽象プロパティです
     。

      -- の属性: real

          抽象プロパティ。この数の実部を取り出します。

      -- の属性: imag

          抽象プロパティ。この数の虚部を取り出します。

      -- メソッド: abstractmethod conjugate ()

          抽象プロパティ。複素共役を返します。たとえば、
          ‘(1+3j).conjugate() == (1-3j)’ です。

 -- クラス: numbers.Real

     To *note Complex: 2814, ‘Real’ adds the operations that work on
     real numbers.

     簡潔に言うとそれらは: *note float: 32f. への変換, *note
     math.trunc(): 1778, *note round(): 1694, *note math.floor(): 1776,
     *note math.ceil(): 1777, *note divmod(): d6e, ‘//’, ‘%’, ‘<’, ‘<=’,
     ‘>’ および ‘>=’ です。

     Real はまた *note complex(): 330, *note real: 2c93, *note imag:
     2c94. および *note conjugate(): 2c95. のデフォルトを提供します。

 -- クラス: numbers.Rational

     *note Real: 280a. をサブタイプ化し *note numerator: 2c96. と *note
     denominator: 2c97. のプロパティを加えたものです。これは *note
     float(): 32f. のデフォルトも提供します。

     The *note numerator: 2c96. and *note denominator: 2c97. values
     should be instances of *note Integral: 261e. 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: 1678. をサブタイプ化し *note int: 32e. への変換が加
     わります。 *note float(): 32f, *note numerator: 2c96, *note
     denominator: 2c97. のデフォルトを提供します。法 (訳注: 割る数、除数
     のこと) を持つ *note pow(): 448. に対する抽象メソッドと、ビット列演
     算 ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’, ‘~’ を追加します。


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:
1ce. implements *note hash(): 9e7. 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: 2814. と *note
Real: 280a. の間に付け加えるには、次のようにします:

     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: 261e, this
means that *note __add__(): 25f1. and *note __radd__(): 25f2. 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: 2814. のサブクラス間の混在型の演算が
あります。上のコードの中で ‘MyIntegral’ と ‘OtherTypeIKnowAbout’ に触れ
ない部分を "ボイラープレート" と呼ぶことにしましょう。 ‘a’ を ‘Complex’
のサブタイプである ‘A’ のインスタンス (‘a : A <: Complex’)、同様に ‘b :
B <: Complex’ として、 ‘a + b’ を考えます:

  1. If ‘A’ defines an *note __add__(): 25f1. 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__(): 25f1, we'd miss the possibility that
     ‘B’ defines a more intelligent *note __radd__(): 25f2, so the
     boilerplate should return *note NotImplemented: 447. from
     ‘__add__()’.  (Or ‘A’ may not implement ‘__add__()’ at all.)

  3. Then ‘B’'s *note __radd__(): 25f2. gets a chance.  If it accepts
     ‘a’, all is well.

  4. ここでボイラープレートに落ち込むならば、もう他に試すべきメソッドは
     ありませんので、デフォルト実装の出番です。

  5. もし ‘B <: A’ ならば、Python は ‘A.__add__’ の前に ‘B.__radd__’ を
     試します。これで良い理由は、 ‘A’ についての知識を持って実装しており
     、 *note Complex: 2814. に委ねる前にこれらのインスタンスを扱えるは
     ずだからです。

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: 330, and both *note __radd__(): 25f2. s land there, so
‘a+b == b+a’.

ほとんどの演算はどのような型についても非常に良く似ていますので、与えられ
た演算子について順結合(forward)および逆結合(reverse)のメソッドを生成する
支援関数を定義することは役に立ちます。たとえば、 *note
fractions.Fraction: 1ce. では次のようなものを利用しています:

     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: math integer --- integer-specific mathematics functions,  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. モジュールにある同じ名前の関数を使ってください。
ほとんどのユーザーは複素数を理解するのに必要なだけの数学を勉強したくない
ので、複素数に対応した関数と対応していない関数の区別がされています。これ
らの関数では複素数が利用できないため、引数に複素数を渡されると、複素数の
結果が返るのではなく例外が発生します。その結果、どういった理由で例外が送
出されたかに早い段階で気づく事ができます。

このモジュールでは次の関数を提供しています。明示的な注記のない限り、戻り
値は全て浮動小数点数になります。

'Floating point arithmetic'

*note ceil(x): 1777.                                     Ceiling of 'x', the smallest integer greater than or equal to 'x'
                                                         
                                                         
*note fabs(x): 2c9e.                                     'x' の絶対値
                                                         
                                                         
*note floor(x): 1776.                                    Floor of 'x', the largest integer less than or equal to 'x'
                                                         
                                                         
*note fma(x, y, z): 71e.                                 Fused multiply-add operation: ‘(x * y) + z’
                                                         
                                                         
*note fmax(x, y): 242.                                   Maximum of two floating-point values
                                                         
                                                         
*note fmin(x, y): 243.                                   Minimum of two floating-point values
                                                         
                                                         
*note fmod(x, y): 26de.                                  ‘x / y’ の剰余
                                                         
                                                         
*note modf(x): 2c9f.                                     Fractional and integer parts of 'x'
                                                         
                                                         
*note remainder(x, y): f14.                              Remainder of 'x' with respect to 'y'
                                                         
                                                         
*note trunc(x): 1778.                                    'x' の整数部
                                                         
                                                         
'Floating point manipulation functions'

*note copysign(x, y): 178c.                              Magnitude (absolute value) of 'x' with the sign of 'y'
                                                         
                                                         
*note frexp(x): 2ca0.                                    Mantissa and exponent of 'x'
                                                         
                                                         
*note isclose(a, b, rel_tol, abs_tol): 116d.             Check if the values 'a' and 'b' are close to each other
                                                         
                                                         
*note isfinite(x): 15aa.                                 Check if 'x' is neither an infinity nor a NaN
                                                         
                                                         
*note isnormal(x): 240.                                  Check if 'x' is a normal number
                                                         
                                                         
*note issubnormal(x): 241.                               Check if 'x' is a subnormal number
                                                         
                                                         
*note isinf(x): 178a.                                    Check if 'x' is a positive or negative infinity
                                                         
                                                         
*note isnan(x): 178b.                                    Check if 'x' is a NaN (not a number)
                                                         
                                                         
*note ldexp(x, i): 1a5d.                                 ‘x * (2**i)’, inverse of function *note frexp(): 2ca0.
                                                         
                                                         
*note nextafter(x, y, steps): 8ae.                       Floating-point value 'steps' steps after 'x' towards 'y'
                                                         
                                                         
*note signbit(x): 244.                                   Check if 'x' is a negative number
                                                         
                                                         
*note ulp(x): ce5.                                       Value of the least significant bit of 'x'
                                                         
                                                         
'Power, exponential and logarithmic functions'

*note cbrt(x): a56.                                      'x' の立方根
                                                         
                                                         
*note exp(x): 16cd.                                      'e' raised to the power 'x'
                                                         
                                                         
*note exp2(x): a55.                                      '2' raised to the power 'x'
                                                         
                                                         
*note expm1(x): 15ab.                                    'e' raised to the power 'x', minus 1
                                                         
                                                         
*note log(x, base): 1878.                                Logarithm of 'x' to the given base ('e' by default)
                                                         
                                                         
*note log1p(x): 1791.                                    Natural logarithm of '1+x' (base 'e')
                                                         
                                                         
*note log2(x): 149c.                                     2を底とする 'x' の対数
                                                         
                                                         
*note log10(x): 19fc.                                    10を底とする 'x' の対数
                                                         
                                                         
*note pow(x, y): a57.                                    'x' の 'y' 乗
                                                         
                                                         
*note sqrt(x): dcc.                                      'x' の平方根
                                                         
                                                         
'Summation and product functions'

*note dist(p, q): dc8.                                   Euclidean distance between two points 'p' and 'q' given as an iterable of coordinates
                                                         
                                                         
*note fsum(iterable): 178d.                              Sum of values in the input 'iterable'
                                                         
                                                         
*note hypot(*coordinates): dc9.                          Euclidean norm of an iterable of coordinates
                                                         
                                                         
*note prod(iterable, start): dca.                        Product of elements in the input 'iterable' with a 'start' value
                                                         
                                                         
*note sumprod(p, q): 8ad.                                Sum of products from two iterables 'p' and 'q'
                                                         
                                                         
'Angular conversion'

*note degrees(x): 2ca1.                                  Convert angle 'x' from radians to degrees
                                                         
                                                         
*note radians(x): 2ca2.                                  Convert angle 'x' from degrees to radians
                                                         
                                                         
'Trigonometric functions'

*note acos(x): 2ca3.                                     'x' の逆余弦
                                                         
                                                         
*note asin(x): 2ca4.                                     'x' の逆正弦
                                                         
                                                         
*note atan(x): 2ca5.                                     'x' の逆正接
                                                         
                                                         
*note atan2(y, x): 2ca6.                                 ‘atan(y / x)’
                                                         
                                                         
*note cos(x): 1877.                                      'x' の余弦
                                                         
                                                         
*note sin(x): 1876.                                      'x' の正弦
                                                         
                                                         
*note tan(x): 2ca7.                                      'x' の正接
                                                         
                                                         
'Hyperbolic functions'

*note acosh(x): 178e.                                    Inverse hyperbolic cosine of 'x'
                                                         
                                                         
*note asinh(x): 178f.                                    Inverse hyperbolic sine of 'x'
                                                         
                                                         
*note atanh(x): 1790.                                    Inverse hyperbolic tangent of 'x'
                                                         
                                                         
*note cosh(x): 2ca8.                                     Hyperbolic cosine of 'x'
                                                         
                                                         
*note sinh(x): 2ca9.                                     Hyperbolic sine of 'x'
                                                         
                                                         
*note tanh(x): 2caa.                                     Hyperbolic tangent of 'x'
                                                         
                                                         
'Special functions'

*note erf(x): f9c.                                       Error function(1) at 'x'
                                                         
                                                         
*note erfc(x): f9d.                                      Complementary error function(2) at 'x'
                                                         
                                                         
*note gamma(x): 15ac.                                    Gamma function(3) at 'x'
                                                         
                                                         
*note lgamma(x): 15ad.                                   Natural logarithm of the absolute value of the Gamma function(4) at 'x'
                                                         
                                                         
'定数'

*note pi: 2cab.                                          'π' = 3.141592...
                                                         
                                                         
*note e: 2cac.                                           'e' = 2.718281...
                                                         
                                                         
*note tau: 2cad.                                         'τ' = 2'π' = 6.283185...
                                                         
                                                         
*note inf: 1045.                                         正の無限大
                                                         
                                                         
*note nan: a58.                                          非数 "Not a number" (NaN)
                                                         

* Menu:

* Floating point arithmetic::
* Floating point manipulation functions::
* Power, exponential and logarithmic functions: Power exponential and logarithmic functions.
* Summation and product functions::
* 角度変換::
* 三角関数::
* 双曲線関数::
* 特殊関数::
* Number-theoretic 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: Floating point arithmetic,  Next: Floating point manipulation functions,  Up: math --- 数学関数

5.10.2.1 Floating point arithmetic
..................................

 -- の関数: math.ceil (x)

     'x' の「天井」 ('x' 以上の最小の整数) を返します。 'x' が浮動小数点
     数でなければ、内部的に *note x.__ceil__: 261d. が実行され、 *note
     Integral: 261e. 値が返されます。

 -- の関数: math.fabs (x)

     'x' の絶対値を返します。

 -- の関数: math.floor (x)

     'x' の「床」 ('x' 以下の最大の整数) を返します。 'x' が浮動小数点数
     でなければ、内部的に *note x.__floor__: 261c. が実行され、 *note
     Integral: 261e. 値が返されます。

 -- の関数: 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.fmax (x, y)

     Get the larger of two floating-point values, treating NaNs as
     missing data.

     When both operands are (signed) NaNs or zeroes, return ‘nan’ and
     ‘0’ respectively and the sign of the result is
     implementation-defined, that is, ‘fmax()’ is not required to be
     sensitive to the sign of such operands (see Annex F of the C11
     standard, §F.10.0.3 and §F.10.9.2).

     Added in version 3.15.

 -- の関数: math.fmin (x, y)

     Get the smaller of two floating-point values, treating NaNs as
     missing data.

     When both operands are (signed) NaNs or zeroes, return ‘nan’ and
     ‘0’ respectively and the sign of the result is
     implementation-defined, that is, ‘fmin()’ is not required to be
     sensitive to the sign of such operands (see Annex F of the C11
     standard, §F.10.0.3 and §F.10.9.3).

     Added in version 3.15.

 -- の関数: 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:
     15a. を送出します。 剰余演算の結果がゼロの場合、そのゼロは '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(): 1776.
     に等しく、負の 'x' に対しては *note ceil(): 1777. に等しいです。'x'
     が浮動小数点数でなければ、内部的に *note x.__trunc__: 442. が実行さ
     れ、 *note Integral: 261e. 値が返されます。

*note ceil(): 1777. 、 *note floor(): 1776. 、および *note modf(): 2c9f.
関数については、非常に大きな浮動小数点数が '全て' 整数そのものになるとい
うことに注意してください。通常、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.2 Floating point manipulation functions
..............................................

 -- の関数: math.copysign (x, y)

     'x' の大きさ (絶対値) で 'y' と同じ符号の浮動小数点数を返します。符
     号付きのゼロをサポートしているプラットフォームでは、‘copysign(1.0,
     -0.0)’ は '-1.0' を返します。

 -- の関数: math.frexp (x)

     'x' の仮数と指数を ‘(m, e)’ のペアとして返します。'm' はfloat型で、
     'e' は厳密に ‘x == m * 2**e’ であるような整数型です。'x' がゼロの場
     合は、‘(0.0, 0)’ を返し、それ以外の場合は、‘0.5 <= abs(m) < 1’ です
     。これは浮動小数点型の内部表現を可搬性を保ったまま "分解 (pick
     apart)" するために使われます。

     Note that ‘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.isnormal (x)

     Return ‘True’ if 'x' is a normal number, that is a finite nonzero
     number that is not a subnormal (see *note issubnormal(): 241.).
     Return ‘False’ otherwise.

     Added in version 3.15.

 -- の関数: math.issubnormal (x)

     Return ‘True’ if 'x' is a subnormal number, that is a finite
     nonzero number with a magnitude smaller than *note
     sys.float_info.min: 2cb0.  Return ‘False’ otherwise.

     Added in version 3.15.

 -- の関数: 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(): 2ca0. の逆関
     数です。

 -- の関数: 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(): ce5. を参照してください。

     Added in version 3.9.

     バージョン 3.12 で変更: Added the 'steps' argument.

 -- の関数: math.signbit (x)

     Return ‘True’ if the sign of 'x' is negative and ‘False’ otherwise.

     This is useful to detect the sign bit of zeroes, infinities and
     NaNs.

     Added in version 3.15.

 -- の関数: math.ulp (x)

     浮動小数点数 'x' の最下位ビットの値を返します:

        * 'x' が NaN (非数) なら、'x' を返します。

        * 'x' が負なら、‘ulp(-x)’ を返します。

        * 'x' が正の無限大なら、'x' を返します。

        * 'x' が 0 に等しければ、(最小の正の '正規化' 浮動小数点数 *note
          sys.float_info.min: 1fde. よりも小さい) 最小の正の表現可能な
          '非正規化' 浮動小数点数を返します。

        * 'x' が表現可能な最大の正の浮動小数点数に等しいなら、'x' より小
          さい最初の浮動小数点数が ‘x - ulp(x)’ であるような、'x' の最下
          位ビットの値を返します。

        * それ以外 ('x' が正の有限な数) なら、'x' より大きい最初の浮動小
          数点数が ‘x + ulp(x)’ であるような、'x' の最下位ビットの値を返
          します。

     ULP は "Unit in the Last Place" の略です。

     *note math.nextafter(): 8ae. および *note sys.float_info.epsilon:
     1fde. も参照してください。

     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.3 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(): 280e. は、その整数を二進法で表すのに何ビッ
     ト必要かを返す関数です。符号と先頭のゼロは無視されます。

 -- の関数: 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: 15a.

     組み込みの ‘**’ 演算子と違って、 *note math.pow(): a57. は両方の引
     数を *note float: 32f. 型に変換します。正確な整数の冪乗を計算するに
     は ‘**’ もしくは組み込みの *note pow(): 448. 関数を使ってください。

     バージョン 3.11 で変更: IEEE 754 との一貫性のため、特殊な例である
     ‘pow(0.0, -inf)’ および ‘pow(-0.0, -inf)’ は *note ValueError: 15a.
     を送出する代わりに ‘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.4 Summation and product functions
........................................

 -- の関数: math.dist (p, q)

     それぞれ座標のシーケンス (またはイテラブル) として与えられる点 'p'
     と 'q' の間のユークリッド距離を返します。二点の次元は同じでなければ
     なりません。

     およそ次と等価です:

          sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q, strict=True)))

     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: 15a. 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.5 角度変換
.................

 -- の関数: math.degrees (x)

     角 'x' をラジアンから度に変換します。

 -- の関数: math.radians (x)

     角 'x' を度からラジアンに変換します。


File: python.info,  Node: 三角関数,  Next: 双曲線関数,  Prev: 角度変換,  Up: math --- 数学関数

5.10.2.6 三角関数
.................

 -- の関数: 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(): 2ca6. のポイン
     トは、両方の入力の符号が既知であるために、位相角の正しい象限を計算
     できることにあります。例えば、 ‘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.7 双曲線関数
...................

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: Number-theoretic functions,  Prev: 双曲線関数,  Up: math --- 数学関数

5.10.2.8 特殊関数
.................

 -- の関数: 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: Number-theoretic functions,  Next: 定数<2>,  Prev: 特殊関数,  Up: math --- 数学関数

5.10.2.9 Number-theoretic functions
...................................

For backward compatibility, the ‘math’ module provides also aliases of
the following functions from the *note math.integer: 92. module:

*note comb(n, k): 2cb8.                                Number of ways to choose 'k' items from 'n' items
                                                       without repetition and without order
                                                       
                                                       
*note factorial(n): 2cb9.                              'n' の階乗
                                                       
                                                       
*note gcd(*integers): 2cba.                            整数引数の最大公約数
                                                       
                                                       
*note isqrt(n): 2cbb.                                  Integer square root of a nonnegative integer 'n'
                                                       
                                                       
*note lcm(*integers): 2cbc.                            Least common multiple of the integer arguments
                                                       
                                                       
*note perm(n, k): 2cbd.                                Number of ways to choose 'k' items from 'n' items
                                                       without repetition and with order
                                                       

Added in version 3.5: The *note gcd(): ce3. function.

Added in version 3.8: The *note comb(): ac2, *note perm(): ac3. and
*note isqrt(): dcb. functions.

Added in version 3.9: The *note lcm(): ce4. function.

バージョン 3.9 で変更: Added support for an arbitrary number of
arguments in the *note gcd(): ce3. function.  Formerly, only two
arguments were supported.

バージョン 3.10 で変更: Floats with integral values (like ‘5.0’) are no
longer accepted in the *note factorial(): d17. function.

*note Soft deprecated: 1b2. since version 3.15: Use the *note
math.integer: 92. functions instead of these aliases.


File: python.info,  Node: 定数<2>,  Prev: Number-theoretic functions,  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(): 178b. 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: 15a. 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:
c5b. 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. モジュール

     これらの多くの関数の複素数版。

Module *note math.integer: 92.

     Integer-specific mathematics functions.

   ---------- Footnotes ----------

   (1) https://vimeo.com/147792667

   (2) https://tauday.com/

   (3) https://en.wikipedia.org/wiki/IEEE_754


File: python.info,  Node: math integer --- integer-specific mathematics functions,  Next: cmath --- 複素数用の数学関数,  Prev: math --- 数学関数,  Up: 数値と数学モジュール

5.10.3 ‘math.integer’ -- integer-specific mathematics functions
---------------------------------------------------------------

Added in version 3.15.

__________________________________________________________________

This module provides access to the mathematical functions defined for
integer arguments.  These functions accept integers and objects that
implement the *note __index__(): 444. method which is used to convert
the object to an integer number.

The following functions are provided by this module.  All return values
are computed exactly and are integers.

 -- の関数: math.integer.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 ValueError: 15a. if either of the arguments are
     negative.

 -- の関数: math.integer.factorial (n, /)

     Return factorial of the nonnegative integer 'n'.

 -- の関数: math.integer.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’.

 -- の関数: math.integer.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)’.

 -- の関数: math.integer.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’.

 -- の関数: math.integer.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 ValueError: 15a. if either of the arguments are
     negative.


File: python.info,  Node: cmath --- 複素数用の数学関数,  Next: decimal --- 10進固定小数点と浮動小数点の演算,  Prev: math integer --- integer-specific mathematics functions,  Up: 数値と数学モジュール

5.10.4 ‘cmath’ -- 複素数用の数学関数
------------------------------------

__________________________________________________________________

このモジュールは、複素数を扱う数学関数へのアクセスを提供しています。 こ
のモジュール中の関数は整数、浮動小数点数または複素数を引数にとります。 ま
た、 *note __complex__(): 9e3. または *note __float__(): d96. どちらかの
メソッドを提供している 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(): 2cc5. 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): 2cc6.                                    Return the phase of 'z'
                                                         
                                                         
*note polar(z): 2cc7.                                    Return the representation of 'z' in polar coordinates
                                                         
                                                         
*note rect(r, phi): 2cc8.                                Return the complex number 'z' with polar coordinates 'r' and 'phi'
                                                         
                                                         
'Power and logarithmic functions'

*note exp(z): 2cc9.                                      Return 'e' raised to the power 'z'
                                                         
                                                         
*note log(z[, base]): 2cca.                              Return the logarithm of 'z' to the given 'base' ('e' by default)
                                                         
                                                         
*note log10(z): 2ccb.                                    Return the base-10 logarithm of 'z'
                                                         
                                                         
*note sqrt(z): 2cc5.                                     Return the square root of 'z'
                                                         
                                                         
'Trigonometric functions'

*note acos(z): 2ccc.                                     Return the arc cosine of 'z'
                                                         
                                                         
*note asin(z): 2ccd.                                     Return the arc sine of 'z'
                                                         
                                                         
*note atan(z): 2cce.                                     Return the arc tangent of 'z'
                                                         
                                                         
*note cos(z): 2ccf.                                      Return the cosine of 'z'
                                                         
                                                         
*note sin(z): 2cd0.                                      Return the sine of 'z'
                                                         
                                                         
*note tan(z): 2cd1.                                      Return the tangent of 'z'
                                                         
                                                         
'Hyperbolic functions'

*note acosh(z): 2cd2.                                    Return the inverse hyperbolic cosine of 'z'
                                                         
                                                         
*note asinh(z): 2cd3.                                    Return the inverse hyperbolic sine of 'z'
                                                         
                                                         
*note atanh(z): 2cd4.                                    Return the inverse hyperbolic tangent of 'z'
                                                         
                                                         
*note cosh(z): 2cd5.                                     Return the hyperbolic cosine of 'z'
                                                         
                                                         
*note sinh(z): 2cd6.                                     Return the hyperbolic sine of 'z'
                                                         
                                                         
*note tanh(z): 2cd7.                                     Return the hyperbolic tangent of 'z'
                                                         
                                                         
'Classification functions'

*note isfinite(z): 2cd8.                                 Check if all components of 'z' are finite
                                                         
                                                         
*note isinf(z): 2cd9.                                    Check if any component of 'z' is infinite
                                                         
                                                         
*note isnan(z): 2cda.                                    Check if any component of 'z' is a NaN
                                                         
                                                         
*note isclose(a, b, *, rel_tol, abs_tol): 116e.          Check if the values 'a' and 'b' are close to each other
                                                         
                                                         
'定数'

*note pi: 2cdb.                                          'π' = 3.141592...
                                                         
                                                         
*note e: 2cdc.                                           'e' = 2.718281...
                                                         
                                                         
*note tau: 1044.                                         'τ' = 2'π' = 6.283185...
                                                         
                                                         
*note inf: 1046.                                         正の無限大
                                                         
                                                         
*note infj: 1048.                                        Pure imaginary infinity
                                                         
                                                         
*note nan: 1047.                                         非数 "Not a number" (NaN)
                                                         
                                                         
*note nanj: 1049.                                        Pure imaginary NaN
                                                         

* Menu:

* 極座標変換::
* 指数関数と対数関数::
* 三角関数: 三角関数<2>.
* 双曲線関数: 双曲線関数<2>.
* 類別関数::
* 定数: 定数<3>.


File: python.info,  Node: 極座標変換,  Next: 指数関数と対数関数,  Up: cmath --- 複素数用の数学関数

5.10.4.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(): 229a. 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.4.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(): 2cca.

 -- の関数: cmath.sqrt (z)

     Return the square root of 'z'.  This has the same branch cut as
     *note log(): 2cca.


File: python.info,  Node: 三角関数<2>,  Next: 双曲線関数<2>,  Prev: 指数関数と対数関数,  Up: cmath --- 複素数用の数学関数

5.10.4.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(): 2ccc.

 -- の関数: 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.4.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.4.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.4.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: a58.

     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: 91.  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.5 ‘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: 32f. 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: 2ce6, *note ROUND_DOWN: 2ce7, *note
ROUND_FLOOR: 2ce8, *note ROUND_HALF_DOWN: 2ce9, *note ROUND_HALF_EVEN:
2cea, *note ROUND_HALF_UP: 2ceb, *note ROUND_UP: 2cec, および *note
ROUND_05UP: 2ced. があります。

シグナルとは、演算の過程で生じる例外的条件です。個々のシグナルは、アプリ
ケーションそれぞれの要求に従って、無視されたり、単なる情報とみなされたり
、例外として扱われたりします。 ‘decimal’ モジュールには、 *note Clamped:
2cee, *note InvalidOperation: 1466, *note DivisionByZero: 2cef, *note
Inexact: 2cf0, *note Rounded: 2cf1, *note Subnormal: 2cf2, *note
Overflow: 2cf3, *note Underflow: 2cf4, および *note FloatOperation:
1459. といったシグナルがあります。

各シグナルには、フラグとトラップイネーブラがあります。演算上何らかのシグ
ナルに遭遇すると、フラグは 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/main/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.5.1 Quick-start tutorial
.............................

普通、 ‘decimal’ を使うときには、モジュールをインポートし、現在の演算コ
ンテキストを *note getcontext(): 1b70. で調べ、必要なら、精度、丸め、有
効なトラップを設定します:

     >>> 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: 1cd. インスタンスは、整数、文字列、浮動小数点数、またはタ
プルから構成できます。整数や浮動小数点数からの構成は、整数や浮動小数点数
の値を正確に変換します。 ‘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: 1459. シグナルがトラップされる場合、コンストラクタ
や順序比較において誤って 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: 1cd. の有効桁数は入力の桁数だけで決まります。演算
コンテキストにおける精度や値丸めの設定が影響するのは算術演算の間だけです
。

     >>> 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: 1466. を送出します:

     >>> 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(): 440. built-in or *note
f-strings: 441.) in fixed-point or scientific notation, using the same
formatting syntax (see *note Format specification mini-language: 704.)
as builtin *note float: 32f. 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(): 146e. メソッドは位を固定して数値を丸めます。このメソッ
ドは、結果を固定の桁数で丸めることがよくある、金融アプリケーションで便利
です:

     >>> 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(): 1b70. 関数を使うと現在の演算コンテキ
ストにアクセスでき、設定を変更できます。ほとんどのアプリケーションはこの
アプローチで十分です。

For more advanced work, it may be useful to create alternate contexts
using the *note Context(): 146d. constructor.  To make an alternate
active, use the *note setcontext(): 2cf6. function.

In accordance with the standard, the ‘decimal’ module provides two ready
to use standard contexts, *note BasicContext: 1462. and *note
ExtendedContext: 1463.  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(): 2cf7. メソッドでフラグをクリアしておくのがベストです。

     >>> 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: 146c. 属性に入っている辞書を使うと、個々のト
ラップをセットできます:

     >>> 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: 1cd. へ
の変換はループ内で一度だけキャストして行います。コンテキストを設定し、
‘Decimal’ オブジェクトを生成できたら、ほとんどのプログラムは他の Python
数値型と全く変わらないかのように ‘Decimal’ を操作できます。


File: python.info,  Node: Decimal オブジェクト,  Next: Context オブジェクト,  Prev: Quick-start tutorial,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.10.5.2 Decimal オブジェクト
.............................

 -- クラス: decimal.Decimal (value='0', context=None)

     'value' に基づいて新たな *note Decimal: 1cd. オブジェクトを構築しま
     す。

     'value' は整数、文字列、タプル、 *note float: 32f. および他の *note
     Decimal: 1cd. オブジェクトにできます。 '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: 1d9. にする場合、タプルは三つの要素を持ち、
     それぞれ符号 (正なら ‘0’ 、負なら ‘1’)、仮数部を表す数字の ‘tuple’
     、そして指数を表す整数でなければなりません。例えば、 ‘Decimal((0,
     (1, 4, 1, 4), -3))’ は ‘Decimal('1.414')’ を返します。

     If 'value' is a *note float: 32f, 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: 1466. をトラップするようになっていれば、例外を送
     出します。それ以外の場合には、コンストラクタは値が ‘NaN’ の *note
     Decimal: 1cd. を返します。

     一度生成すると、 *note Decimal: 1cd. オブジェクトは変更不能
     (immutable) になります。

     バージョン 3.2 で変更: コンストラクタに対する引数に *note float:
     32f. インスタンスも許されるようになりました。

     バージョン 3.3 で変更: *note FloatOperation: 1459. トラップがセット
     されていた場合 *note float: 32f. 引数は例外を送出します。デフォルト
     でトラップはオフです。

     バージョン 3.6 で変更: コード中の整数リテラルや浮動小数点リテラルと
     同様に、アンダースコアを用いて桁をグルーピングできます。

     Decimal floating-point objects share many properties with the other
     built-in numeric types such as *note float: 32f. and *note int:
     32e.  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: 1ce. オブジェクトと組み合わせることができません
     。例えば、 *note Decimal: 1cd. に *note float: 32f. を足そうとする
     と、 *note TypeError: 29c. が送出されます。ただし、Python の比較演
     算子を使って ‘Decimal’ インスタンス ‘x’ と別の数 ‘y’ を比較すること
     ができます。これにより、異なる型の数間の等価比較の際に、紛らわしい
     結果を避けます。

     バージョン 3.2 で変更: *note Decimal: 1cd. インスタンスと他の数値型
     が混在する比較が完全にサポートされるようになりました。

     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: 1cd. インスタンスを、既約分数で分母
          が正数の分数として表現した整数のペア ‘(n, d)’ を返します。

               >>> Decimal('-3.14').as_integer_ratio()
               (-157, 50)

          変換は正確に行われます。無限大に対してはOverflowErrorを、NaNに
          対してはValueError を送出します。

     Added in version 3.6.

      -- メソッド: as_tuple ()

          数値を表現するための *note 名前付きタプル: a42.:
          ‘DecimalTuple(sign, digittuple, exponent)’ を返します。

      -- メソッド: canonical ()

          引数の標準的(canonical)エンコーディングを返します。現在のとこ
          ろ、 *note Decimal: 1cd. インスタンスのエンコーディングは常に
          標準的なので、この操作は引数に手を加えずに返します。

      -- メソッド: compare (other, context=None)

          二つの Decimal インスタンスの値を比較します。 *note compare():
          2cfd. は 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(): 2cfd. とほとんど同じですが、全ての
          NaN がシグナルを送るところが異なります。すなわち、どちらの比較
          対象も発信 (signaling) NaN でないならば無言 (quiet) NaN である
          比較対象があたかも発信 NaN であるかのように扱われます。

      -- メソッド: compare_total (other, context=None)

          二つの対象を数値によらず抽象表現によって比較します。 *note
          compare(): 2cfd. に似ていますが、結果は *note Decimal: 1cd. に
          全順序を与えます。この順序づけによると、数値的に等しくても異な
          った表現を持つ二つの ‘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(): 2cff. のように数値によらず
          抽象表現によって比較しますが、両者の符号を無視します。
          ‘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: 2cea. 丸めモードで正しく丸められます。

               >>> 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: 32f. or *note int: 32e.

          なお、‘Decimal.from_float(0.1)’ は ‘Decimal('0.1')’ と同じでは
          ありません。0.1 は二進浮動小数点数で正確に表せないので、その値
          は表現できる最も近い値、‘0x1.999999999999ap-4’ として記憶され
          ます。浮動小数点数での等価な値は
          ‘0.1000000000000000055511151231257827021181583404541015625’ で
          す。

               注釈: Python 3.2 以降では、 *note Decimal: 1cd. インスタ
               ンスは *note float: 32f. から直接構成できるようになりまし
               た。

               >>> 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: 32f, *note int: 32e. 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: fd0. を返し、そうで
          なければ *note False: ef9. を返します。現在のところ、 *note
          Decimal: 1cd. のインスタンスは常に標準的なのでこのメソッドの結
          果はいつでも ‘True’ です。

      -- メソッド: is_finite ()

          引数が有限の数値ならば *note True: fd0. を、無限大か NaN なら
          ば *note False: ef9. を返します。

      -- メソッド: is_infinite ()

          引数が正または負の無限大ならば *note True: fd0. を、そうでなけ
          れば *note False: ef9. を返します。

      -- メソッド: is_nan ()

          引数が (無言か発信かは問わず) NaN であれば *note True: fd0. を
          、そうでなければ *note False: ef9. を返します。

      -- メソッド: is_normal (context=None)

          引数が '正規(normal)' の有限数値ならば *note True: fd0. を返し
          ます。引数がゼロ、非正規(subnormal)、無限大または NaN であれば
          *note False: ef9. を返します。

      -- メソッド: is_qnan ()

          引数が無言 NaN であれば *note True: fd0. を、そうでなければ
          *note False: ef9. を返します。

      -- メソッド: is_signed ()

          引数に負の符号がついていれば *note True: fd0. を、そうでなけれ
          ば *note False: ef9. を返します。注意すべきはゼロや NaN なども
          符号を持ち得ることです。

      -- メソッド: is_snan ()

          引数が発信 NaN であれば *note True: fd0. を、そうでなければ
          *note False: ef9. を返します。

      -- メソッド: is_subnormal (context=None)

          引数が非正規数(subnormal)であれば *note True: fd0. を、そうで
          なければ *note False: ef9. を返します。

      -- メソッド: is_zero ()

          引数が(正または負の)ゼロであれば *note True: fd0. を、そうでな
          ければ *note False: ef9. を返します。

      -- メソッド: ln (context=None)

          演算対象の自然対数(底 e の対数)を返します。結果は *note
          ROUND_HALF_EVEN: 2cea. 丸めモードで正しく丸められます。

      -- メソッド: log10 (context=None)

          演算対象の底 10 の対数を返します。結果は *note
          ROUND_HALF_EVEN: 2cea. 丸めモードで正しく丸められます。

      -- メソッド: logb (context=None)

          非零の数値については、 *note Decimal: 1cd. インスタンスとして
          調整された指数を返します。演算対象がゼロだった場合、
          ‘Decimal('-Infinity')’ が返され *note DivisionByZero: 2cef. フ
          ラグが送出されます。演算対象が無限大だった場合、
          ‘Decimal('Infinity')’ が返されます。

      -- メソッド: logical_and (other, context=None)

          *note logical_and(): 2d12. は二つの '論理引数' (*note
          論理引数: 2d13. 参照)を取る論理演算です。結果は二つの引数の数
          字ごとの ‘and’ です。

      -- メソッド: logical_invert (context=None)

          *note logical_invert(): 2d14. は論理演算です。結果は引数の数字
          ごとの反転です。

      -- メソッド: logical_or (other, context=None)

          *note logical_or(): 2d15. は二つの '論理引数' (*note 論理引数:
          2d13. 参照)を取る論理演算です。結果は二つの引数の数字ごとの
          ‘or’ です。

      -- メソッド: logical_xor (other, context=None)

          *note logical_xor(): 2d16. は二つの '論理引数' (*note
          論理引数: 2d13. 参照)を取る論理演算です。結果は二つの引数の数
          字ごとの排他的論理和です。

      -- メソッド: max (other, context=None)

          ‘max(self, other)’ と同じですが、値を返す前に現在のコンテキス
          トに即した丸め規則を適用します。また、 ‘NaN’ に対して、(コンテ
          キストの設定と、発信か無言どちらのタイプであるかに応じて) シグ
          ナルを発行するか無視します。

      -- メソッド: max_mag (other, context=None)

          *note max(): 2d17. メソッドに似ていますが、比較は絶対値で行わ
          れます。

      -- メソッド: min (other, context=None)

          ‘min(self, other)’ と同じですが、値を返す前に現在のコンテキス
          トに即した丸め規則を適用します。また、 ‘NaN’ に対して、(コンテ
          キストの設定と、発信か無言どちらのタイプであるかに応じて) シグ
          ナルを発行するか無視します。

      -- メソッド: min_mag (other, context=None)

          *note min(): 2d19. メソッドに似ていますが、比較は絶対値で行わ
          れます。

      -- メソッド: 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: 1466. がシグナルされま
          す。これによりエラー条件がない限り打ち切られた指数が常に右側の
          引数と同じになることが保証されます。

          同様に、他の操作と違い、quantize は Underflow を、たとえ結果が
          非正規になったり不正確になったとしても、シグナルしません。

          二つ目の演算対象の指数が一つ目のそれよりも大きければ丸めが必要
          かもしれません。この場合、丸めモードは以下のように決められます
          。‘rounding’ 引数が与えられていればそれが使われます。そうでな
          ければ ‘context’ 引数で決まります。どちらの引数も渡されなけれ
          ば現在のスレッドのコンテキストの丸めモードが使われます。

          処理結果の指数が *note Emax: 1464. よりも大きい場合や *note
          Etiny(): 2d20. よりも小さい場合にエラーが返されます。

      -- メソッド: radix ()

          ‘Decimal(10)’ つまり *note Decimal: 1cd. クラスがその全ての算
          術を実行する基数を返します。仕様との互換性のために取り入れられ
          ています。

      -- メソッド: 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(): 2d2a. メソッドと同じです。
          ‘to_integral’ の名前は古いバージョンとの互換性のために残されて
          います。

      -- メソッド: to_integral_exact (rounding=None, context=None)

          最近傍の整数に値を丸め、丸めが起こった場合には *note Inexact:
          2cf0. または *note Rounded: 2cf1. のシグナルを適切に出します。
          丸めモードは以下のように決められます。 ‘rounding’ 引数が与えら
          れていればそれが使われます。そうでなければ ‘context’ 引数で決
          まります。どちらの引数も渡されなければ現在のスレッドのコンテキ
          ストの丸めモードが使われます。

      -- メソッド: to_integral_value (rounding=None, context=None)

          *note Inexact: 2cf0. や *note Rounded: 2cf1. といったシグナル
          を出さずに最近傍の整数に値を丸めます。 'rounding' が指定されて
          いれば適用されます; それ以外の場合、値丸めの方法は 'context' の
          設定か現在のコンテキストの設定になります。

     Decimal numbers can be rounded using the *note round(): 1694.
     function:

      -- Describe: round(number)

      -- Describe: round(number, ndigits)

          If 'ndigits' is not given or ‘None’, returns the nearest *note
          int: 32e. to 'number', rounding ties to even, and ignoring the
          rounding mode of the ‘Decimal’ context.  Raises *note
          OverflowError: c5b. if 'number' is an infinity or *note
          ValueError: 15a. if it is a (quiet or signaling) NaN.

          If 'ndigits' is an *note int: 32e, 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: 1466. 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.5.3 論理引数
.................

*note logical_and(): 2d12, *note logical_invert(): 2d14, *note
logical_or(): 2d15, および *note logical_xor(): 2d16. メソッドはその引数
が '論理引数' であると想定しています。 '論理引数' とは *note Decimal:
1cd. インスタンスで指数と符号は共にゼロであり、各桁の数字が ‘0’ か ‘1’ で
あるものです。


File: python.info,  Node: Context オブジェクト,  Next: 定数<4>,  Prev: Decimal オブジェクト,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.10.5.4 Context オブジェクト
.............................

コンテキスト (context) とは、算術演算における環境設定です。コンテキスト
は計算精度を決定し、値丸めの方法を設定し、シグナルのどれが例外になるかを
決め、指数の範囲を制限しています。

多重スレッドで処理を行う場合には各スレッドごとに現在のコンテキストがあり
、 *note getcontext(): 1b70. や *note setcontext(): 2cf6. といった関数で
アクセスしたり設定変更できます:

 -- の関数: decimal.getcontext ()

     アクティブなスレッドの現在のコンテキストを返します。

 -- の関数: decimal.setcontext (c, /)

     アクティブなスレッドのコンテキストを 'c' に設定します。

*note with: 215. 文と *note localcontext(): 1740. 関数を使って実行するコ
ンテキストを一時的に変更することもできます。

 -- の関数: 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: 29c. if 'kwargs' supplies an attribute that
     *note Context: 146d. doesn't support.  Raises either ‘TypeError’ or
     *note ValueError: 15a. if 'kwargs' supplies an invalid value for an
     attribute.

     バージョン 3.11 で変更: *note localcontext(): 1740. 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: 2d2e.

     Added in version 3.14.

新たなコンテキストは、以下で説明する *note Context: 146d. コンストラクタ
を使って生成できます。その他にも、 ‘decimal’ モジュールでは作成済みのコ
ンテキストを提供しています:

 -- データ: decimal.BasicContext

     汎用十進演算仕様で定義されている標準コンテキストの一つです。精度は
     9 桁に設定されています。丸め規則は *note ROUND_HALF_UP: 2ceb. です
     。すべての演算結果フラグはクリアされています。 *note Inexact: 2cf0,
     *note Rounded: 2cf1, *note Subnormal: 2cf2. を除く全ての演算エラー
     トラップが有効 (例外として扱う) になっています。

     多くのトラップが有効になっているので、デバッグの際に便利なコンテキ
     ストです。

 -- データ: decimal.ExtendedContext

     汎用十進演算仕様で定義されている標準コンテキストの一つです。精度は
     9 桁に設定されています。丸め規則は *note ROUND_HALF_EVEN: 2cea. で
     す。すべての演算結果フラグはクリアされています。トラップは全て無効
     (演算中に一切例外を送出しない) になっています。

     トラップが無効になっているので、エラーの伴う演算結果を ‘NaN’ や
     ‘Infinity’ にし、例外を送出しないようにしたいアプリケーションに向い
     たコンテキストです。このコンテキストを使うと、他の場合にはプログラ
     ムが停止してしまうような状況があっても実行を完了させられます。

 -- データ: decimal.DefaultContext

     *note Context: 146d. コンストラクタが新たなコンテキストを作成するさ
     いに雛形にするコンテキストです。このコンテキストのフィールド (精度
     の設定など) を変更すると、 ‘Context’ コンストラクタが生成する新たな
     コンテキストに影響を及ぼします。

     このコンテキストは、主に多重スレッド環境で便利です。スレッドを開始
     する前に何らかのフィールドを変更しておくと、システム全体のデフォル
     ト設定に効果を及ぼすことができます。スレッドを開始した後にフィール
     ドを変更すると、競合条件を抑制するためにスレッドを同期化しなければ
     ならないので、推奨しません。

     単一スレッドの環境では、このコンテキストを使わないよう薦めます。下
     で述べるように明示的にコンテキストを作成してください。

     デフォルトの値は、 *note Context.prec: 2d2f.=‘28’, *note
     Context.rounding: 2d30.=*note ROUND_HALF_EVEN: 2cea. で、トラップ
     *note Overflow: 2cf3, *note InvalidOperation: 1466, および *note
     DivisionByZero: 2cef. が有効になっています。

上に挙げた三つのコンテキストに加え、 *note Context: 146d. コンストラクタ
を使って新たなコンテキストを生成できます。

 -- クラス: decimal.Context (prec=None, rounding=None, Emin=None,
          Emax=None, capitals=None, clamp=None, flags=None, traps=None)

     新たなコンテキストを生成します。あるフィールドが定義されていないか
     *note None: a6a. であれば、 *note DefaultContext: 1461. からデフォ
     ルト値をコピーします。 'flags' フィールドが設定されていいか ‘None’
     の場合には、全てのフラグがクリアされます。

      -- の属性: prec

          An integer in the range [‘1’, *note MAX_PREC: 145e.] that sets
          the precision for arithmetic operations in the context.

      -- の属性: rounding

          One of the constants listed in the section *note Rounding
          Modes: 2d31.

      -- の属性: 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: 1460, ‘0’],
          'Emax' in the range [‘0’, *note MAX_EMAX: 145f.].

      -- の属性: 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: 1cd. 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: 1464.  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: 146d. クラスでは、いくつかの汎用のメソッドの他、現在
     のコンテキストで算術演算を直接行うためのメソッドを数多く定義してい
     ます。加えて、 *note Decimal: 1cd. の各メソッドについて(*note
     adjusted(): 2cfa. および *note as_tuple(): 2cfb. メソッドを例外とし
     て)対応する ‘Context’ のメソッドが存在します。たとえば、 ‘Context’
     インスタンス ‘C’ と ‘Decimal’ インスタンス ‘x’ に対して、
     ‘C.exp(x)’ は ‘x.exp(context=C)’ と等価です。それぞれの ‘Context’ メ
     ソッドは、Decimal インスタンスが受け付けられるところならどこでも、
     Python の整数 (*note int: 32e. のインスタンス) を受け付けます。

      -- メソッド: 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: 1cd. コンストラクタと違い、数
          値を変換する際にコンテキストの精度、値丸め方法、フラグ、トラッ
          プを適用します。

          定数値はしばしばアプリケーションの要求よりも高い精度を持ってい
          るため、このメソッドが役に立ちます。また、値丸めを即座に行うた
          め、例えば以下のように、入力値に値丸めを行わないために合計値に
          ゼロの加算を追加するだけで結果が変わってしまうといった、現在の
          精度よりも細かい値の影響が紛れ込む問題を防げるという恩恵もあり
          ます。以下の例は、丸められていない入力を使うということは和にゼ
          ロを加えると結果が変わり得るという見本です:

               >>> 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(): 15c1. クラスメソッドとは違い、変換にコン
          テキストの精度、丸めメソッド、フラグ、そしてトラップが適用され
          ます。

               >>> 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: 2d20. に設定されます。

      -- メソッド: Etop ()

          ‘Emax - prec + 1’ に等しい値を返します。

     *note Decimal: 1cd. を使った処理を行う場合、通常は ‘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(): 2d62. を
          適切に丸められた *note exp(): 2d44. および *note ln(): 2d4f. 関
          数によって計算します。結果は 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.5.5 定数
.............

 -- データ: decimal.SPEC_VERSION

     The highest version of the General Decimal Arithmetic Specification
     that this implementation complies with.  See
     ‘https://speleotrove.com/decimal/decarith.html’ for the
     specification.

     Added in version 3.15.

The following constants 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: 2374, 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.5.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.5.7 シグナル
.................

シグナルは、計算中に生じた様々なエラー条件を表現します。各々のシグナルは
一つのコンテキストフラグと一つのトラップイネーブラに対応しています。

コンテキストフラグは、該当するエラー条件に遭遇するたびにセットされます。
演算後にフラグを調べれば、演算に関する情報 (例えば計算が厳密だったかどう
か) がわかります。フラグを調べたら、次の計算を始める前にフラグを全てクリ
アするようにしてください。

あるコンテキストのトラップイネーブラがあるシグナルに対してセットされてい
る場合、該当するエラー条件が生じると Python の例外を送出します。例えば、
*note DivisionByZero: 2cef. が設定されていると、エラー条件が生じた際に
*note DivisionByZero: 2cef. 例外を送出します。

 -- クラス: decimal.Clamped

     値の表現上の制限に沿わせるために指数部が変更されたことを通知します
     。

     通常、クランプ (clamp) は、指数部がコンテキストにおける指数桁の制限
     値 *note Emin: 1465. および *note Emax: 1464. を越えた場合に発生し
     ます。可能な場合には、係数部にゼロを加えた表現に合わせて指数部を減
     らします。

 -- クラス: decimal.DecimalException

     他のシグナルの基底クラスで、 *note ArithmeticError: 28f9. のサブク
     ラスです。

 -- クラス: 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:
     1464. より大きいことを示します。シグナルをトラップしない場合、演算
     結果は値丸めのモードにより、表現可能な最大の数値になるように内側へ
     引き込んで丸めを行った値か、 ‘Infinity’ になるように外側に丸めた値
     のいずれかになります。いずれの場合も、 *note Inexact: 2cf0. および
     *note Rounded: 2cf1. が同時にシグナルされます。

 -- クラス: decimal.Rounded

     情報が全く失われていない場合も含み、値丸めが起きたときのシグナルで
     す。

     このシグナルは、値丸めによって桁がなくなると常に発生します。なくな
     った桁がゼロ (例えば ‘5.00’ を丸めて ‘5.0’ になった場合) であっても
     です。このシグナルをトラップしなければ、演算結果をそのまま返します
     。このシグナルは有効桁数の減少を検出する際に使います。

 -- クラス: decimal.Subnormal

     値丸めを行う前に指数部が *note Emin: 1465. より小さかったことを示す
     シグナルです。

     演算結果が微小である場合 (指数が小さすぎる場合) に発生します。この
     シグナルをトラップしなければ、演算結果をそのまま返します。

 -- クラス: decimal.Underflow

     演算結果が値丸めによってゼロになった場合に生じる数値アンダフローで
     す。

     演算結果が微小なため、値丸めによってゼロになった場合に発生します。
     *note Inexact: 2cf0. および *note Subnormal: 2cf2. シグナルも同時に
     発生します。

 -- クラス: decimal.FloatOperation

     float と Decimal の混合の厳密なセマンティクスを有効にします。

     シグナルがトラップされなかった場合 (デフォルト)、*note Decimal:
     1cd. コンストラクタ、 *note create_decimal(): 1467. 、およびすべて
     の比較演算子において float と Decimal の混合が許されます。変換も比
     較も正確です。コンテキストフラグ内に *note FloatOperation: 1459. を
     設定することで、混合操作は現れるたびに暗黙に記録されます。 *note
     from_float(): 15c1. や *note create_decimal_from_float(): 2d36. に
     よる明示的な変換はフラグを設定しません。

     そうでなければ (シグナルがトラップされれば)、等価性比較および明示的
     な変換のみが静かにに行われ、その他の混合演算は *note
     FloatOperation: 1459. を送出します。

これらのシグナルの階層構造をまとめると、以下の表のようになります:

     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.5.8 Floating-point notes
.............................

* Menu:

* 精度を上げて丸め誤差を抑制する::
* 特殊値::


File: python.info,  Node: 精度を上げて丸め誤差を抑制する,  Next: 特殊値,  Up: Floating-point notes

5.10.5.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.5.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: 2cef. をトラップせずにゼロで除算を行った場合にも出
てきます。同様に、 *note Overflow: 2cf3. シグナルをトラップしなければ、
表現可能な最大の数値の制限を越えた値を丸めたときに出てきます。

無限大には符号があり (アフィン: affine であり)、算術演算に使用でき、非常
に巨大で不確定の(indeterminate)値として扱われます。例えば、無限大に何ら
かの定数を加算すると、演算結果は別の無限大になります。

演算によっては結果が不確定になるものがあり、 ‘NaN’ を返します。ただし、
*note InvalidOperation: 1466. シグナルをトラップするようになっていれば例
外を送出します。例えば、 ‘0/0’ は ‘NaN’ を返します。 ‘NaN’ は「非数値
(not a number)」を表します。このような ‘NaN’ は暗黙のうちに生成され、一
度生成されるとそれを他の計算にも流れてゆき、関係する個々の演算全てが個別
の ‘NaN’ を返すようになります。この挙動は、たまに入力値が欠けるような状
況で一連の計算を行う際に便利です -- 特定の計算に対しては無効な結果を示す
フラグを立てつつ計算を進められるからです。

一方、 ‘NaN’ の変種である ‘sNaN’ は関係する全ての演算で演算後にシグナル
を送出します。 ‘sNaN’ は、無効な演算結果に対して特別な処理を行うために計
算を停止する必要がある場合に便利です。

Python の比較演算は ‘NaN’ が関わってくると少し驚くようなことがあります。
等価性のテストの一方の対象が無言または発信 ‘NaN’ である場合いつでも
*note False: ef9. を返し(たとえ ‘Decimal('NaN')==Decimal('NaN')’ でも)、
一方で不等価をテストするといつでも *note True: fd0. を返します。二つの
Decimal を ‘<’, ‘<=’, ‘>’ または ‘>=’ を使って比較する試みは一方が ‘NaN’
である場合には *note InvalidOperation: 1466. シグナルを送出し、このシグ
ナルをトラップしなければ結果は ‘False’ に終わります。汎用十進演算仕様は
直接の比較の振る舞いについて定めていないことに注意しておきましょう。ここ
での ‘NaN’ が関係する比較ルールは IEEE 854 標準から持ってきました
(section 5.7 の Table 3 を見て下さい)。厳格に標準遵守を貫くなら、 *note
compare(): 2cfd. および *note compare_signal(): 2cfe. メソッドを代わりに
使いましょう。

アンダフローの起きた計算は、符号付きのゼロ (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.5.11 スレッドを使った処理
..............................

関数 *note getcontext(): 1b70. は、スレッド毎に別々の *note Context:
146d. オブジェクトにアクセスします。別のスレッドコンテキストを持つという
ことは、複数のスレッドが互いに影響を及ぼさずに (‘getcontext().prec=10’ の
ような) 変更を適用できるということです。

同様に、*note setcontext(): 2cf6. 関数は自動的に引数のコンテキストを現在
のスレッドのコンテキストに設定します。

If *note setcontext(): 2cf6. has not been called before *note
getcontext(): 1b70, 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: 1461. object.

The *note sys.flags.thread_inherit_context: 426. 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(): 1b70. 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(): 429.

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(): 1b70.
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.5.12 レシピ
................

*note Decimal: 1cd. クラスの利用を実演している例をいくつか示します。これ
らはユーティリティ関数としても利用できます:

     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.5.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(): 146e. method rounds to a fixed number of
decimal places.  If the *note Inexact: 2cf0. 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(): 146e.
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(): 146e. の
段階を扱う関数を定義しておくと便利です:

     >>> 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(): 2d1e. 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: 1cd.?

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(): 1467. を使って生成時に
丸めてしまうこともできます:

     >>> 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: 1465. and *note Emax: 1464. should always be set to the
maximum values, *note clamp: 155c. should always be 0 (the default).
Setting *note prec: 2d2f. requires some care.

The easiest approach for trying out bignum arithmetic is to use the
maximum value for *note prec: 2d2f. 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: 145e. 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: 2d2f. 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:
2cf0. 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.6 ‘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: 1678. and returns a new
     ‘Fraction’ instance with a value equal to ‘numerator/denominator’.
     If 'denominator' is zero, it raises a *note ZeroDivisionError: d15.

     The second version requires that 'number' is an instance of *note
     numbers.Rational: 1678. or has the ‘as_integer_ratio()’ method
     (this includes *note float: 32f. and *note decimal.Decimal: 1cd.).
     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
     浮動小数点演算、その問題と制限: 230f.), 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(): 2d82. 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: 32f. コンストラクタで受け付けら
     れる有限の値を表す文字列は、*note Fraction: 1ce. コンストラクタでも
     受け付けられます。どちらの形式でも、入力される文字列は前後に空白が
     あって構いません。以下に、いくつかの例を示します:

          >>> 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: 1ce. クラスは抽象基底クラス *note numbers.Rational:
     1678. を継承し、その全てのメソッドと演算を実装します。 ‘Fraction’ イ
     ンスタンスは *note ハッシュ可能: 18e. で、不変 (immutable) であるも
     のとして扱われます。加えて、 ‘Fraction’ には以下のプロパティとメソ
     ッドがあります:

     バージョン 3.2 で変更: *note Fraction: 1ce. のコンストラクタが
     *note float: 32f. および *note decimal.Decimal: 1cd. インスタンスを
     受け付けるようになりました。

     バージョン 3.9 で変更: The *note math.gcd(): ce3. function is now
     used to normalize the 'numerator' and 'denominator'.  ‘math.gcd()’
     always returns an *note int: 32e. 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: 32f. or *note numbers.Integral: 261e.  Beware that
          ‘Fraction.from_float(0.3)’ is not the same value as
          ‘Fraction(3, 10)’.

               注釈: Python 3.2 以降では、 *note float: 32f. から直接
               *note Fraction: 1ce. インスタンスを構築できるようになりま
               した。

      -- メソッド: classmethod from_decimal (dec)

          Alternative constructor which only accepts instances of *note
          decimal.Decimal: 1cd. or *note numbers.Integral: 261e.

               注釈: Python 3.2 以降では、 *note decimal.Decimal: 1cd. イ
               ンスタンスから直接 *note Fraction: 1ce. インスタンスを構
               築できるようになりました。

      -- メソッド: classmethod from_number (number)

          Alternative constructor which only accepts instances of *note
          numbers.Integral: 261e, *note numbers.Rational: 1678, *note
          float: 32f. or *note decimal.Decimal: 1cd, 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: 1ce. を見付けて返します。このメソッドは与えられた浮
          動小数点数の有理数近似を見つけるのに役立ちます:

               >>> 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: 32e. ‘<= self’ を返します。このメソッドは
          *note math.floor(): 1776. 関数からでもアクセスできます:

               >>> from math import floor
               >>> floor(Fraction(355, 113))
               3

      -- メソッド: __ceil__ ()

          最小の *note int: 32e. ‘>= self’ を返します。このメソッドは
          *note math.ceil(): 1777. 関数からでもアクセスできます。

      -- メソッド: __round__ ()

      -- メソッド: __round__ (ndigits)

          第一のバージョンは、 ‘self’ に最も近い *note int: 32e. を偶数
          丸めで返します。第二のバージョンは、このメソッドは ‘self’ に最
          も近い ‘Fraction(1, 10**ndigits)’ の倍数 (論理的に、 ‘ndigits’
          が負なら) を、これも偶数丸めで丸めます。 *note round(): 1694.
          関数からでもアクセスできます。

      -- メソッド: __format__ (format_spec, /)

          Provides support for formatting of ‘Fraction’ instances via
          the *note str.format(): a17. method, the *note format(): 440.
          built-in function, or *note Formatted string literals: 441.

          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: 704.  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: 32f. type in the *note Format specification
          mini-language: 704. 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/main/Lib/fractions.py

   (2) https://peps.python.org/pep-0515/


File: python.info,  Node: random --- 疑似乱数を生成する,  Next: statistics --- 数学的統計関数,  Prev: fractions --- 有理数,  Up: 数値と数学モジュール

5.10.7 ‘random’ -- 疑似乱数を生成する
-------------------------------------

'ソースコード:' Lib/random.py(1)

__________________________________________________________________

このモジュールでは様々な分布をもつ擬似乱数生成器を実装しています。

整数用に、ある範囲からの一様な選択があります。シーケンス用には、シーケン
スからのランダムな要素の一様な選択、リストのランダムな置換をインプレース
に生成する関数、順列を置換せずにランダムサンプリングする関数があります。

実数用としては、一様分布、正規分布 (ガウス分布)、対数正規分布、負の指数
分布、ガンマおよびベータ分布を計算する関数があります。角度の分布を生成す
るにはフォン・ミーゼス分布が利用できます。

ほとんど全てのモジュール関数は、基礎となる関数 *note random(): b32. に依
存します。この関数はランダムな浮動小数点数を半開区間 ‘0.0 <= X < 1.0’ 内
に一様に生成します。Python は中心となる乱数生成器としてメルセンヌツイス
タを使います。これは 53 ビット精度の浮動小数点を生成し、周期は
2**19937-1 です。本体は C で実装されていて、高速でスレッドセーフです。メ
ルセンヌツイスタは、現存する中で最も広範囲にテストされた乱数生成器のひと
つです。しかしながら、メルセンヌツイスタは完全に決定論的であるため、全て
の目的に合致しているわけではなく、暗号化の目的には全く向いていません。

このモジュールで提供されている関数は、実際には *note random.Random:
1e72. クラスの隠蔽されたインスタンスのメソッドに束縛されています。内部状
態を共有しない生成器を取得するため、自分で *note Random: 1e72. のインス
タンスを生成することができます。

Class *note Random: 1e72. 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: 2d8b. class
which uses the system function *note os.urandom(): 936. to generate
random numbers from sources provided by the operating system.

     警告: このモジュールの擬似乱数生成器をセキュリティ目的に使用しては
     いけません。セキュリティや暗号学的な用途については *note secrets:
     c8. モジュールを参照してください。

参考
....

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: 1e72. 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/main/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.7.1 保守 (bookkeeping) 関数
................................

 -- の関数: random.seed (a=None, version=2)

     乱数生成器を初期化します。

     'a' が省略されるか ‘None’ の場合、現在のシステム時刻が使用されます
     。乱数のソースがオペレーティングシステムによって提供される場合、シ
     ステム時刻の代わりにそれが使用されます (利用可能性についての詳細は
     *note os.urandom(): 936. 関数を参照)。

     'a' が int の場合は、その絶対値が直接使用されます。

     バージョン2 (デフォルト) では、 *note str: 1ea, *note bytes: 1d2,
     *note bytearray: 1d1. オブジェクトは *note int: 32e. に変換され、そ
     のビットがすべて使用されます。

     バージョン1 (Python の古いバージョンでの乱数列を再現するために提供
     される) では、 *note str: 1ea. と *note bytes: 1d2. に対して適用さ
     れるアルゴリズムは、より狭い範囲のシードを生成します。

     バージョン 3.2 で変更: 文字列シードのすべてのビットを使うバージョン
     2スキームに移行。

     バージョン 3.11 で変更: 'seed' は次の型の内のいずれかでなければなり
     ません: ‘None’、*note int: 32e.、*note float: 32f.、*note str:
     1ea.、*note bytes: 1d2.、*note bytearray: 1d1.。

 -- の関数: random.getstate ()

     乱数生成器の現在の内部状態を記憶したオブジェクトを返します。このオ
     ブジェクトを *note setstate(): 2d8e. に渡して内部状態を復元すること
     ができます。

 -- の関数: random.setstate (state)

     'state' は予め *note getstate(): 2d8d. を呼び出して得ておかなくては
     なりません。 *note setstate(): 2d8e. は ‘getstate()’ が呼び出された
     時の乱数生成器の内部状態を復元します。


File: python.info,  Node: バイト列用の関数,  Next: 整数用の関数,  Prev: 保守 bookkeeping 関数,  Up: random --- 疑似乱数を生成する

5.10.7.2 バイト列用の関数
.........................

 -- の関数: random.randbytes (n)

     'n' バイトのランダムなバイト列を生成します。

     セキュリティトークンを生成する目的で、このメソッドを使用しないでく
     ださい。代わりに *note secrets.token_bytes(): 2d90. を使用してくだ
     さい。

     Added in version 3.9.


File: python.info,  Node: 整数用の関数,  Next: シーケンス用の関数,  Prev: バイト列用の関数,  Up: random --- 疑似乱数を生成する

5.10.7.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(): d13. 関数の引数と一致します。

     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(): c45. がより洗練されました。以前は ‘int(random()*n)’ の
     ようなやや一様でない分布を生成するスタイルを使用していました。

     バージョン 3.12 で変更: 整数以外の型の自動変換はサポートされなくな
     りました。‘randrange(10.0)’ や ‘randrange(Fraction(10, 1))’ のよう
     な呼び出しは *note TypeError: 29c. を送出します。

 -- の関数: random.randint (a, b)

     ‘a <= N <= b’ であるようなランダムな整数 'N' を返します。
     ‘randrange(a, b+1)’ のエイリアスです。

 -- の関数: random.getrandbits (k)

     'k' 桁の乱数ビットを持つ Python の整数を生成し、返します。このメソ
     ッドはメルセンヌツイスタ生成器で提供されており、その他の乱数生成器
     でもオプションの API として提供されている場合があります。*note
     getrandbits(): 13bb. が使用可能な場合、*note randrange(): c45. は任
     意の範囲の乱数を生成できるようになります。

     バージョン 3.9 で変更: 'k' の値として 0 が許されるようになりました
     。


File: python.info,  Node: シーケンス用の関数,  Next: Discrete distributions,  Prev: 整数用の関数,  Up: random --- 疑似乱数を生成する

5.10.7.4 シーケンス用の関数
...........................

 -- の関数: random.choice (seq)

     空でないシーケンス 'seq' からランダムに要素を返します。 'seq' が空
     のときは、 *note IndexError: 18ed. が送出されます。

 -- の関数: random.choices (population, weights=None, *,
          cum_weights=None, k=1)

     'population' から重複ありで選んだ要素からなる大きさ 'k' のリストを
     返します。'population' が空の場合 *note IndexError: 18ed. を送出し
     ます。

     'weights' シーケンスが与えられた場合、相対的な重みに基づいて要素が
     選ばれます。あるいは、'cum_weights' シーケンスが与えられた場合、累
     積的な重み (*note itertools.accumulate(): dc3. を用いて計算されるか
     もしれません) で要素が選ばれます。例えば、相対的な重み ‘[10, 5, 30,
     5]’ は累積的な重み ‘[10, 15, 45, 50]’ と等価です。内部的には、相対
     的な重みは要素選択の前に累積的な重みに変換されるため、累積的な重み
     を渡すと手間を省けます。

     'weights' および 'cum_weights' が与えられなかった場合、要素は同じ確
     率で選択されます。重みのシーケンスが与えられた場合、その長さは
     'population' シーケンスと同じでなければなりません。'weights' と
     'cum_weights' を同時に与えると *note TypeError: 29c. が送出されます
     。

     'weights' や 'cum_weights' には *note random(): c0. が返す *note
     float: 32f. 値と相互に変換できるような、任意の数値型を使用できます
     (int、float、fraction を含みますが、decimal は除きます)。重みには非
     負で有限の値を指定することが規定されます。全ての重みが 0 の場合、例
     外 *note ValueError: 15a. が送出されます。

     与えられた種に対して、同じ重みを持つ *note choices(): 1087. 関数は
     、一般に *note choice(): 15eb. を繰り返し呼び出す場合とは異なるシー
     ケンスを生成します。 ‘choices()’ で使用されるアルゴリズムは、内部の
     一貫性とスピードのために浮動小数点演算を使用します。 ‘choice()’ で
     使われるアルゴリズムは、丸め誤差による小さな偏りを避けるために、デ
     フォルトでは選択を繰り返す整数演算になっています。

     Added in version 3.6.

     バージョン 3.9 で変更: 全ての重みが 0 の場合、例外 *note
     ValueError: 15a. を送出します。

 -- の関数: 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 ハッシュ可能: 18e. でなくても、ユニークでなく
     てもかまいません。母集団が繰り返しを含む場合、出現するそれぞれがサ
     ンプルに選択されえます。

     母集団に重複がある場合はその分だけ1つずつ指定するか、キーワード専用
     オプション引数 'counts' で指定することができます。例えば、
     ‘sample(['red', 'blue'], counts=[4, 2], k=5)’ は ‘sample(['red',
     'red', 'red', 'red', 'blue', 'blue'], k=5)’ と等価になります。

     ある範囲の整数からサンプルを取る場合、引数に *note range(): d13. オ
     ブジェクトを使用してください。大きな母集団の場合、これは特に速く、
     メモリ効率が良いです: ‘sample(range(10000000), k=60)’。

     サンプルの大きさが母集団の大きさより大きい場合 *note ValueError:
     15a. が送出されます。

     バージョン 3.9 で変更: 'counts' 引数が追加されました。

     バージョン 3.11 で変更: 'population' 変数はシーケンスでなければなり
     ません。 setsのリストへの暗黙の型変換はサポートされていません。


File: python.info,  Node: Discrete distributions,  Next: 実数分布,  Prev: シーケンス用の関数,  Up: random --- 疑似乱数を生成する

5.10.7.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.7.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(): 1df1. より少しだけ高速です。

     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(): 1df1. 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.7.7 他の生成器
...................

 -- クラス: random.Random ([seed])

     Class that implements the default pseudo-random number generator
     used by the ‘random’ module.

     バージョン 3.11 で変更: 以前は 'seed' は任意のハッシュ可能オブジェ
     クトが設定可能でした。現在は ‘None’, *note int: 32e, *note float:
     32f, *note str: 1ea, *note bytes: 1d2, *note bytearray: 1d1. に制限
     されています。

     Subclasses of ‘Random’ should override the following methods if
     they wish to make use of a different basic generator:

      -- メソッド: seed (a=None, version=2)

          Override this method in subclasses to customise the *note
          seed(): 162d. behaviour of ‘Random’ instances.

      -- メソッド: getstate ()

          Override this method in subclasses to customise the *note
          getstate(): 2d8d. behaviour of ‘Random’ instances.

      -- メソッド: setstate (state)

          Override this method in subclasses to customise the *note
          setstate(): 2d8e. behaviour of ‘Random’ instances.

      -- メソッド: random ()

          Override this method in subclasses to customise the *note
          random(): b32. behaviour of ‘Random’ instances.

     Optionally, a custom generator subclass can also supply the
     following method:

      -- メソッド: getrandbits (k)

          Override this method in subclasses to customise the *note
          getrandbits(): 13bb. behaviour of ‘Random’ instances.

      -- メソッド: randbytes (n)

          Override this method in subclasses to customise the *note
          randbytes(): 1a56. behaviour of ‘Random’ instances.

 -- クラス: random.SystemRandom ([seed])

     オペレーティングシステムの提供する発生源によって乱数を生成する
     *note os.urandom(): 936. 関数を使うクラスです。すべてのシステムで使
     えるメソッドではありません。ソフトウェアの状態に依存してはいけませ
     んし、一連の操作は再現不能です。従って、 *note seed(): 162d. メソッ
     ドは何の影響も及ぼさず、無視されます。 *note getstate(): 2d8d. と
     *note setstate(): 2d8e. メソッドが呼び出されると、例外 *note
     NotImplementedError: 5a1. が送出されます。


File: python.info,  Node: 再現性について,  Next: 使用例<7>,  Prev: 他の生成器,  Up: random --- 疑似乱数を生成する

5.10.7.8 再現性について
.......................

疑似乱数生成器から与えられたシーケンスを再現できると便利なことがあります
。シード値を再利用することで、複数のスレッドが実行されていない限り、実行
ごとに同じシーケンスが再現できます。

random モジュールのアルゴリズムやシード処理関数のほとんどは、Python バー
ジョン間で変更される対象となりますが、次の二点は変更されないことが保証さ
れています:

   * 新しいシード処理メソッドが追加されたら、後方互換なシード処理器が提
     供されます。

   * 生成器の *note random(): 2da1. メソッドは、互換なシード処理器に同じ
     シードが与えられた場合、引き続き同じシーケンスを生成します。


File: python.info,  Node: 使用例<7>,  Next: レシピ<2>,  Prev: 再現性について,  Up: random --- 疑似乱数を生成する

5.10.7.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.7.10 レシピ
................

These recipes show how to efficiently make random selections from the
combinatoric iterators in the *note itertools: 84. module or the
more-itertools(1) project:

     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(): b32. 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: 2d95. 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(2) a paper by Allen B.
Downey describing ways to generate more fine-grained floats than
normally generated by *note random(): b32.

   ---------- Footnotes ----------

   (1) https://pypi.org/project/more-itertools/

   (2) https://allendowney.com/research/rand/downey07randfloat.pdf


File: python.info,  Node: コマンドラインでの使用<2>,  Next: コマンドラインの例,  Prev: レシピ<2>,  Up: random --- 疑似乱数を生成する

5.10.7.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(): 15eb. を使用してランダムに選択して出力します。

 -- Option: -i <N>
 -- Option: --integer <N>

     *note randint(): 15ea. を使用して1からNの間(Nを含む)のランダムな整
     数を出力します。

 -- Option: -f <N>
 -- Option: --float <N>

     *note uniform(): 2d96. を使用して0からNの間(Nを含む)のランダムな浮
     動小数点数を出力します。

オプションが指定されない場合、出力は入力に依存します。

   * 文字列または複数: *note -choice: 2daa. と同じ。

   * 整数: *note -integer: 2dac. と同じ。

   * 浮動小数点数: *note -float: 2dae. と同じ。


File: python.info,  Node: コマンドラインの例,  Prev: コマンドラインでの使用<2>,  Up: random --- 疑似乱数を生成する

5.10.7.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.8 ‘statistics’ -- 数学的統計関数
-------------------------------------

Added in version 3.4.

'ソースコード:' Lib/statistics.py(1)

__________________________________________________________________

このモジュールは、数値 (*note Real: 280a. 型) データを数学的に統計計算す
るための関数を提供します。

このモジュールは、 NumPy(2), SciPy(3) のような third-party ライブラリや
、Minitab、SAS、Matlab のようなプロ統計家向けのフル装備なプロプライエタ
リ統計パッケージと競合することを意図していません。グラフ関数電卓のレベル
を対象としています。

特に明記しない限り、これらの関数は *note int: 32e, *note float: 32f,
*note Decimal: 1cd. そして *note Fraction: 1ce. をサポートします。他の型
(算術型及びそれ以外) は現在サポートされていません。型が混ざったコレクシ
ョンも未定義で実装依存です。入力データが複数の型からなる場合、*note
map(): 445. を使用すると正しい結果が得られるでしょう。 例: ‘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/main/Lib/statistics.py

   (2) https://numpy.org

   (3) https://scipy.org/


File: python.info,  Node: 平均及び中心位置の測度,  Next: 分散の測度,  Up: statistics --- 数学的統計関数

5.10.8.1 平均及び中心位置の測度
...............................

これらの関数は母集団または標本の平均値や標準値を計算します。

*note mean(): ac4.          データの算術平均 (いわゆる「平均」) 。
                            
                            
*note fmean(): dfc.         Fast, floating-point arithmetic mean, with optional weighting.
                            
                            
*note geometric_mean(): dfd.データの幾何平均。
                            
                            
*note harmonic_mean(): 10a3.データの調和平均。
                            
                            
*note kde(): 75a.           Estimate the probability density distribution of the data.
                            
                            
*note kde_random(): 75b.    Random sampling from the PDF generated by kde().
                            
                            
*note median(): 2db5.       データのメジアン(中央値)。
                            
                            
*note median_low(): 2db6.   データの low median。
                            
                            
*note median_high(): 2db7.  データの high median。
                            
                            
*note median_grouped(): 2db8.Median (50th percentile) of grouped data.
                            
                            
*note mode(): e58.          離散/名義尺度データの最頻値 (single mode) 。
                            
                            
*note multimode(): dfe.     離散/名義尺度データの最頻値 (list of modes) 。
                            
                            
*note quantiles(): dff.     データの等確率での分割。
                            


File: python.info,  Node: 分散の測度,  Next: 2入力間の関係の統計,  Prev: 平均及び中心位置の測度,  Up: statistics --- 数学的統計関数

5.10.8.2 分散の測度
...................

これらの関数は母集団または標本が標準値や平均値からどれくらい離れているか
について計算します。

*note pstdev(): 19e6.       データの母標準偏差。
                            
                            
*note pvariance(): 2dba.    データの母分散。
                            
                            
*note stdev(): ac6.         データの標本標準偏差。
                            
                            
*note variance(): ac5.      データの標本標準分散。
                            


File: python.info,  Node: 2入力間の関係の統計,  Next: 関数の詳細,  Prev: 分散の測度,  Up: statistics --- 数学的統計関数

5.10.8.3 2入力間の関係の統計
............................

これらの関数は、2つの入力間の関係について統計量を計算します。

*note covariance(): c0d.      2変数の標本共分散。
                              
                              
*note correlation(): 8d1.     ピアソンとスピアマンの相関係数。
                              
                              
*note linear_regression(): c0e.単回帰の傾きと切片。
                              


File: python.info,  Node: 関数の詳細,  Next: 例外<5>,  Prev: 2入力間の関係の統計,  Up: statistics --- 数学的統計関数

5.10.8.4 関数の詳細
...................

註釈: 関数の引数となるデータをソートしておく必要はありません。例の多くが
ソートされているのは見やすさのためです。

 -- の関数: statistics.mean (data)

     シーケンス型またはイテラブルになり得る 'data' の標本算術平均を返し
     ます。

     算術平均はデータの総和をデータ数で除したものです。単に「平均」と呼
     ばれることも多いですが、数学における平均の一種に過ぎません。データ
     の中心位置の測度の一つです。

     'data' が空の場合 *note StatisticsError: 2dbd. を送出します。

     使用例:

          >>> 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(): 2db5. を参照してください。

          標本平均は真の母平均の不偏推定量のため、出来る限り多くの標本か
          ら平均を求めると、‘mean(sample)’ は真の母平均に収束します (訳
          注: 大数の法則)。'data' が標本ではなく母集団全体の場合、
          ‘mean(data)’ は真の母平均 μ を計算することと等価です。

 -- の関数: statistics.fmean (data, weights=None)

     'data' を float に変換し、算術平均を計算します。

     This runs faster than the *note mean(): ac4. function and it always
     returns a *note float: 32f.  The 'data' may be a sequence or
     iterable.  If the input dataset is empty, raises a *note
     StatisticsError: 2dbd.

          >>> 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: 15a. 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: 2dbd. 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():
     ac4. の逆数です。例えば、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: 2dbd. 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: 2dbd. 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: 2dbd. will be raised if the 'data'
     sequence is empty.

     Continuing the example for *note kde(): 75a, 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: 2dbd. が送出されます。'data' はシーケンス型または
     イテラブルにもなれます。

     中央値は外れ値の影響を受けにくいため、中心位置のロバストな測度です
     。データ数が奇数の場合は中央の値を返します:

          >>> median([1, 3, 5])
          3

     データ数が偶数の場合は、中央値は中央に最も近い2値の算術平均で補間さ
     れます:

          >>> median([1, 3, 5, 7])
          4.0

     データが離散的で、中央値がデータ点にない値でも構わない場合に適して
     います。

     もしあなたのデータが（注文操作をサポートする）序数で、（追加操作を
     サポートしない）数値でないならば、代わりに *note median_low():
     2db6. または *note median_high(): 2db7. の使用を検討してください。

 -- の関数: statistics.median_low (data)

     数値データの小さい方の中央値(low median)を返します。もし 'data' が
     空の場合、*note StatisticsError: 2dbd. が送出されます。'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: 2dbd. が送出されます。 '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(): 2db5. 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: 2dbd. 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: 432,
     consider casting to *note frozenset: 9d9.  To handle type *note
     list: 4e0, consider casting to *note tuple: 1d9.  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: 2dbd. 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(): 2dba. を参照してください。

          >>> 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(): ac5. を使いましょう。

     'data' が空の場合 *note StatisticsError: 2dbd. を送出します。

     例:

          >>> 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(): ac5. を参照してください。

          >>> 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(): 2dba. を参照してください。

     'data' の値が2より少ない場合 *note StatisticsError: 2dbd. を送出し
     ます。

     例:

          >>> 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(): 2dba. の引数 '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: 2dbd. 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: 2dbd. 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 sequence 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: 2dbd. 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 sequence
     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: 2dbd. 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 sequences of the same length (no less than
     two), and the independent variable 'x' cannot be constant;
     otherwise a *note StatisticsError: 2dbd. 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(): 8d1, 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.8.5 例外
.............

例外が1つ定義されています:

 -- 例外: statistics.StatisticsError

     統計関係の例外。*note ValueError: 15a. の派生クラス。


File: python.info,  Node: NormalDist オブジェクト,  Next: 例とレシピ<2>,  Prev: 例外<5>,  Up: statistics --- 数学的統計関数

5.10.8.6 ‘NormalDist’ オブジェクト
..................................

*note NormalDist: e00. 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: 2dbd. を送出します。

      -- の属性: 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(): dfc.
          and *note stdev(): ac6.

          The 'data' can be any *note iterable: 149a. and should consist
          of values that can be converted to type *note float: 32f.  If
          'data' does not contain at least two elements, raises *note
          StatisticsError: 2dbd. 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: 4e0. of *note float: 32f.
          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(): 162d. and *note
          random.gauss(): 1df0.

      -- メソッド: 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.8.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.8.8 Classic probability problems
.....................................

*note NormalDist: e00. 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.8.9 Monte Carlo inputs for simulations
...........................................

To estimate the distribution for a model that isn't easy to solve
analytically, *note NormalDist: e00. 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.8.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.8.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: e00.:

     >>> 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 イテレータ: 6d4. を構築する部品を実装しています。
プログラム言語 APL, Haskell, SML からアイデアを得ていますが、 Python に
適した形に修正されています。

このモジュールは、高速でメモリ効率に優れ、単独でも組合せても使用すること
のできるツールを標準化したものです。同時に、このツール群は "イテレータの
代数" を構成していて、pure Python で簡潔かつ効率的なツールを作れるように
しています。

例えば、SML の作表ツール ‘tabulate(f)’ は ‘f(0), f(1), ...’ のシーケンス
を作成します。同じことを Python では *note map(): 445. と *note count():
163d. を組合せて ‘map(f, count())’ という形で実現できます。

'General iterators:'

イテレータ                       引数                             結果                                                  使用例
                                                                                                                        
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                        
*note accumulate(): dc3.         p [,func]                        p0, p0+p1, p0+p1+p2, ...                              ‘accumulate([1,2,3,4,5]) → 1 3 6 10 15’
                                                                                                                        
                                                                                                                        
*note batched(): 71b.            p, n                             (p0, p1, ..., p_n-1), ...                             ‘batched('ABCDEFG', n=3) → ABC DEF G’
                                                                                                                        
                                                                                                                        
*note chain(): 19b.              p, q, ...                        p0, p1, ...  plast, q0, q1, ...                       ‘chain('ABC', 'DEF') → A B C D E F’
                                                                                                                        
                                                                                                                        
*note chain.from_iterable(): 19c.iterable                         p0, p1, ...  plast, q0, q1, ...                       ‘chain.from_iterable(['ABC', 'DEF']) → A B C D E F’
                                                                                                                        
                                                                                                                        
*note compress(): 163c.          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(): 163d.             [start[, step]]                  start, start+step, start+2*step, ...                  ‘count(10) → 10 11 12 13 14 ...’
                                                                                                                        
                                                                                                                        
*note cycle(): 1a61.             p                                p0, p1, ...  plast, p0, p1, ...                       ‘cycle('ABCD') → A B C D A B C D ...’
                                                                                                                        
                                                                                                                        
*note dropwhile(): 2dd6.         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(): 27e6.       predicate, seq                   elements of seq where predicate(elem) fails           ‘filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8’
                                                                                                                        
                                                                                                                        
*note groupby(): 194b.           iterable[, key]                  key(v) の値でグループ化したサブイテレータ             ‘groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)’
                                                                                                                        
                                                                                                                        
*note islice(): f0d.             seq, [start,] stop [, step]      seq[start:stop:step]                                  ‘islice('ABCDEFG', 2, None) → C D E F G’
                                                                                                                        
                                                                                                                        
*note pairwise(): bf2.           iterable                         (p[0], p[1]), (p[1], p[2])                            ‘pairwise('ABCDEFG') → AB BC CD DE EF FG’
                                                                                                                        
                                                                                                                        
*note repeat(): 1aa1.            elem [,n]                        elem, elem, elem, ...  無限もしくは n 回              ‘repeat(10, 3) → 10 10 10’
                                                                                                                        
                                                                                                                        
*note starmap(): 14a3.           func, seq                        func(*seq[0]), func(*seq[1]), ...                     ‘starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000’
                                                                                                                        
                                                                                                                        
*note takewhile(): 2dd7.         predicate, seq                   seq[0], seq[1], until predicate fails                 ‘takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4’
                                                                                                                        
                                                                                                                        
*note tee(): 2dd8.               it, n                            it1, it2 , ...  itn 一つのイテレータを n 個に分ける   ‘tee('ABC', 2) → A B C, A B C’
                                                                                                                        
                                                                                                                        
*note zip_longest(): 1658.       p, q, ...                        (p[0], q[0]), (p[1], q[1]), ...                       ‘zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-’
                                                                                                                        

'組合せイテレータ:'

イテレータ                                         引数                     結果
                                                                            
----------------------------------------------------------------------------------------------------------------------------------------------
                                                                            
*note product(): 16cc.                             p, q, ...  [repeat=1]    デカルト積、ネストしたforループと等価
                                                                            
                                                                            
*note permutations(): 1982.                        p[, r]                   長さrのタプル列、重複なしのあらゆる並び
                                                                            
                                                                            
*note combinations(): 16cb.                        p, r                     長さrのタプル列、ソートされた順で重複なし
                                                                            
                                                                            
*note combinations_with_replacement(): 163b.       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(): 12bc.
     For a running maximum, set 'function' to *note max(): 12bd.  Or for
     a running product, set 'function' to *note operator.mul(): 2ddb.
     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(): 156. を見てください。

     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: 15a. 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(): 19b. のためのもう一つのコンストラクタです。遅延評価
     される 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(): 16cc. keeping only
     entries that are subsequences of the 'iterable'.  The length of the
     output is given by *note math.comb(): ac2. 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(): 16cc. 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(): 445. to generate
     consecutive data points or with *note zip(): 446. 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(): 194b. の操作は Unix の ‘uniq’ フィルターと似ていま
     す。 key 関数の値が変わるたびに休止または新しいグループを生成します
     (このために通常同じ key 関数でソートしておく必要があるのです)。この
     動作は SQL の入力順に関係なく共通の要素を集約する GROUP BY とは違い
     ます。

     返されるグループはそれ自体がイテレータで、 *note groupby(): 194b. と
     '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(): 194b. はおよそ次と等価です:

          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(): 16cc. where entries
     with repeated elements have been filtered out.  The length of the
     output is given by *note math.perm(): ac3. 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(): 16cc. は動作する前に、入力のイテラブルを完全に読み
     取り、直積を生成するためにメモリ内に値を蓄えます。したがって、入力
     が有限の場合に限り有用です。

 -- の関数: 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(): 445.
     when argument parameters have already been "pre-zipped" into
     tuples.

     The difference between *note map(): 445. 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(): 2dd8. 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: 317. may
     be raised when simultaneously using iterators returned by the same
     *note tee(): 2dd8. call, even if the original 'iterable' is
     threadsafe.

     *note tee(): 2dd8. はかなり大きなメモリ領域を使用するかもしれません
     (使用するメモリ量はiterableの大きさに依存します)。一般には、一つの
     イテレータが他のイテレータよりも先にほとんどまたは全ての要素を消費
     するような場合には、 ‘tee()’ よりも *note list(): 4e0. を使った方が
     高速です。

 -- の関数: 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(): f0d. or
     *note takewhile(): 2dd7.).

   ---------- 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: 1417.
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(): db7. 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.

     Call-once behavior is not guaranteed because locks are not held
     during the function call.  Potentially another call with the same
     arguments could occur while the first call is still running.

     Added in version 3.9.

 -- の関数: @functools.cached_property (func)

     クラスのメソッドを、値を一度だけ計算して通常の属性としてキャッシュ
     するプロパティに変換します。キャッシュはインスタンスの生存期間にわ
     たって有効です。*note property(): 6c1. に似ていて、さらにキャッシュ
     を行います。計算コストが高く、一度計算すればその後は不変であるよう
     なインスタンスのプロパティに対して有用です。

     以下はプログラム例です:

          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(): 953. のしくみは *note property(): 6c1. と
     やや異なります。通常のプロパティは、セッター (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(): 6c1. on top of *note
     lru_cache(): db7.  See *note メソッド呼び出しをキャッシュするには
     どうしたらいいですか？: 2de0. 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: 11be. に変換します。
     key 関数を受け取るツール (*note sorted(): f90, *note min(): 12bc,
     *note max(): 12bd, *note heapq.nlargest(): 2bd0, *note
     heapq.nsmallest(): 2bd1, *note itertools.groupby(): 194b. など) と
     共に使用します。この関数は、主に比較関数を使っていた Python 2 から
     プログラムの移行のための変換ツールとして使われます。

     比較関数は2つの引数を受け取り、それらを比較し、 "より小さい" 場合は
     負の数を、同値の場合には 0 を、 "より大きい" 場合には正の数を返す、
     あらゆる呼び出し可能オブジェクトです。key 関数は呼び出し可能オブジ
     ェクトで、1つの引数を受け取り、ソートキーとして使われる値を返します
     。

     以下はプログラム例です:

          sorted(iterable, key=cmp_to_key(locale.strcoll))  # locale-aware sort order

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 1599.
     を参照して下さい。

     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 ハッシュ可能: 18e. でなくてはなりません。

     引数のパターンが異なる場合は、異なる呼び出しと見なされ別々のキャッ
     シュエントリーとなります。 例えば、 ‘f(a=1, b=2)’ と ‘f(b=2, a=1)’
     はキーワード引数の順序が異なっているので、2つの別個のキャッシュエン
     トリーになります。

     'user_function' が指定された場合、それは呼び出し可能でなければなり
     ません。これにより 'lru_cache' デコレータがユーザー関数に直接適用で
     きるようになります。このとき 'maxsize' の値はデフォルトの 128 とな
     ります:

          @lru_cache
          def count_vowels(word):
              return sum(word.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: 193. 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: a42.
     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 メソッド呼び出しをキャッシュするには
     どうしたらいいですか？: 2de0.

     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__(): 165a, *note __le__():
     16c4, *note __gt__(): 16c5, or *note __ge__(): 16c6.  In addition,
     the class should supply an *note __eq__(): ec4. 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(): 4ad. and *note
     partialmethod(): 4ae.

     Added in version 3.14.

 -- の関数: functools.partial (func, /, *args, **keywords)

     新しい *note partial オブジェクト: 4af. を返します。このオブジェク
     トは呼び出されると位置引数 '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(): 32e. 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: 4ac. 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: 29c,
     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: 4ac.
     in positional arguments.

 -- クラス: functools.partialmethod (func, /, *args, **keywords)

     *note partial: 4ad. と似た動作をする新しい *note partialmethod:
     4ae. 記述子 (デスクリプタ) を返します。直接呼び出しではなく、メソッ
     ド定義としての使用が目的であることのみが、partial とは異なります。

     'func' は、*note descriptor: 22a. または呼び出し可能オブジェクトで
     ある必要があります (通常の関数など、両方の性質を持つオブジェクトは
     記述子として扱われます。)

     When 'func' is a descriptor (such as a normal Python function,
     *note classmethod(): 6a0, *note staticmethod(): 66d, *note
     abstractmethod(): 1442. or another instance of ‘partialmethod’),
     calls to ‘__get__’ are delegated to the underlying descriptor, and
     an appropriate *note partial object: 4af. returned as the result.

     'func' が記述子以外の呼び出し可能オブジェクトである場合、適切な束縛
     メソッドが動的に作成されます。この func は、メソッドとして使用され
     た場合、Python の通常の関数と同様に動作します。 *note
     partialmethod: 4ae. コンストラクタに '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 = sentinel('initial_missing')

          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(): dc3. を参照してください。

     バージョン 3.14 で変更: 'initial' is now supported as a keyword
     argument.

 -- の関数: @functools.singledispatch

     関数を *note シングルディスパッチ: db8. *note ジェネリック関数:
     db9. に変換します。

     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: 349. 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: 2de4. and pre-existing
     functions, the *note register(): 2de3. attribute can also be used
     in a functional form:

          >>> def nothing(arg, verbose=False):
          ...     print("Nothing.")
          ...
          >>> fun.register(type(None), nothing)

     The *note register(): 2de3. 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:
     e51. 型に登録されます。これは、他によりよい実装が見つからないことを
     意味します。

     抽象基底クラス (*note abstract base class: 1574.) に対して実装が登
     録されると、基底クラスの仮想サブクラスに対してもその実装がディスパ
     ッチされます:

          >>> 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(): 2de3. attribute now
     supports using type annotations.

     バージョン 3.11 で変更: The *note register(): 2de3. attribute now
     supports *note typing.Union: 349. as a type annotation.

 -- クラス: functools.singledispatchmethod (func)

     メソッドを *note シングルディスパッチ: db8. *note ジェネリック関数:
     db9. に変換します。

     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: 6a0.  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: 66d, *note @~abc.abstractmethod: 1442, and others.

     Added in version 3.8.

     バージョン 3.15 で変更: Added support of non-*note descriptor: 22a.
     callables.

 -- の関数: 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__: 2559, *note __name__:
     168e, *note __qualname__: 2558, *note __annotations__: 1596, *note
     __type_params__: 255c, and *note __doc__: 1597, the documentation
     string) and ‘WRAPPER_UPDATES’ (which updates the wrapper function's
     *note __dict__: 168c, i.e.  the instance dictionary).

     内観や別の目的 (例えば、 *note lru_cache(): db7. のようなキャッシュ
     するデコレータの回避) のために元の関数にアクセスできるように、この
     関数はラップされている関数を参照するラッパーに自動的に
     ‘__wrapped__’ 属性を追加します。

     この関数は主に関数を包んでラッパーを返す *note デコレータ: b1d. 関
     数の中で使われるよう意図されています。もしラッパー関数がアップデー
     トされないとすると、返される関数のメタデータは元の関数の定義ではな
     くラッパー関数の定義を反映してしまい、これは通常あまり有益ではあり
     ません。

     *note update_wrapper(): 13cf. は、関数以外の呼び出し可能オブジェク
     トにも使えます。 'assigned' または 'updated' で指名され、ラップされ
     るオブジェクトに存在しない属性は、すべて無視されます (すなわち、ラ
     ッパー関数にそれらの属性を設定しようとは試みられません)。しかし、
     'updated' で指名された属性がラッパー関数自身に存在しないなら *note
     AttributeError: 1b4. が送出されます。

     バージョン 3.2 で変更: The ‘__wrapped__’ attribute is now
     automatically added.  The *note __annotations__: 1596. attribute is
     now copied by default.  Missing attributes no longer trigger an
     *note AttributeError: 1b4.

     バージョン 3.4 で変更: ラップされた関数が ‘__wrapped__’ を定義して
     いない場合でも、 ‘__wrapped__’ が常にラップされた関数を参照するよう
     になりました。(bpo-17482(7) を参照)

     バージョン 3.12 で変更: The *note __type_params__: 255c. attribute
     is now copied by default.

 -- の関数: @functools.wraps (wrapped, assigned=WRAPPER_ASSIGNMENTS,
          updated=WRAPPER_UPDATES)

     これはラッパー関数を定義するときに *note update_wrapper(): 13cf. を
     関数デコレータとして呼び出す便宜関数です。これは
     ‘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/main/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: 4ad. オブジェクトは、 *note partial(): 4ad. 関数によって
作られる呼び出し可能オブジェクトです。オブジェクトには読み出し専用の属性
が三つあります:

 -- の属性: partial.func

     呼び出し可能オブジェクトまたは関数です。 *note partial: 4ad. オブジ
     ェクトの呼び出しは新しい引数とキーワードと共に *note func: 2de6. に
     転送されます。

 -- の属性: partial.args

     最左の位置引数で、 *note partial: 4ad. オブジェクトの呼び出し時にそ
     の呼び出しの際の位置引数の前に追加されます。

 -- の属性: partial.keywords

     *note partial: 4ad. オブジェクトの呼び出し時に渡されるキーワード引
     数です。

*note partial: 4ad. objects are like *note function objects: 7a1. in
that they are callable, weak referenceable, and can have attributes.
There are some important differences.  For instance, the *note __name__:
141d. and *note __doc__: cf8. 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 比較: 26e6. を参照してください。

論理演算もまた全てのオブジェクトに対して適用でき、真理値判定、同一性判定
およびブール演算をサポートします:

 -- の関数: operator.not_ (obj)
 -- の関数: operator.__not__ (obj)

     *note not: 26f0. 'obj' の結果を返します。(オブジェクトインスタンス
     には ‘__not__()’ メソッドは無いので注意してください; インタープリタ
     ーコアがこの演算を定義しているだけです。結果は *note __bool__():
     168f. および *note __len__(): 19aa. メソッドに影響されます。)

 -- の関数: operator.truth (obj)

     'obj' が真の場合 *note True: fd0. を返し、そうでない場合 *note
     False: ef9. を返します。この関数は *note bool: 5f6. のコンストラク
     タ呼び出しと同等です。

 -- の関数: operator.is_ (a, b)

     ‘a is b’ を返します。オブジェクトの同一性を判定します。

 -- の関数: operator.is_not (a, b)

     ‘a is not b’ を返します。オブジェクトの同一性を判定します。

 -- の関数: operator.is_none (a)

     Return ‘a is None’.  Tests object identity.

     Added in version 3.14.

 -- の関数: operator.is_not_none (a)

     Return ‘a is not None’.  Tests object identity.

     Added in version 3.14.

演算子で最も多いのは数学演算およびビット単位の演算です:

 -- の関数: operator.abs (obj)
 -- の関数: operator.__abs__ (obj)

     'obj' の絶対値を返します。

 -- の関数: operator.add (a, b)
 -- の関数: operator.__add__ (a, b)

     数値 'a' および 'b' について ‘a + b’ を返します。

 -- の関数: operator.and_ (a, b)
 -- の関数: operator.__and__ (a, b)

     'a' と 'b' のビット単位論理積を返します。

 -- の関数: operator.floordiv (a, b)
 -- の関数: operator.__floordiv__ (a, b)

     ‘a // b’ を返します。

 -- の関数: operator.index (a)
 -- の関数: operator.__index__ (a)

     整数に変換された 'a' を返します。‘a.__index__()’ と同等です。

     バージョン 3.10 で変更: 結果は常に厳密な *note int: 32e. 型です。 以
     前は、結果は ‘int’ のサブクラスのインスタンスのこともありました。

 -- の関数: operator.inv (obj)
 -- の関数: operator.invert (obj)
 -- の関数: operator.__inv__ (obj)
 -- の関数: operator.__invert__ (obj)

     'obj' のビット単位反転を返します。‘~obj’ と同じです。

 -- の関数: operator.lshift (a, b)
 -- の関数: operator.__lshift__ (a, b)

     'a' の 'b' ビット左シフトを返します。

 -- の関数: operator.mod (a, b)
 -- の関数: operator.__mod__ (a, b)

     ‘a % b’ を返します。

 -- の関数: operator.mul (a, b)
 -- の関数: operator.__mul__ (a, b)

     数値 'a' および 'b' について ‘a * b’ を返します。

 -- の関数: operator.matmul (a, b)
 -- の関数: operator.__matmul__ (a, b)

     ‘a @ b’ を返します。

     Added in version 3.5.

 -- の関数: operator.neg (obj)
 -- の関数: operator.__neg__ (obj)

     負の 'obj' (‘-obj’) を返します。

 -- の関数: operator.or_ (a, b)
 -- の関数: operator.__or__ (a, b)

     'a' と 'b' のビット単位論理和を返します。

 -- の関数: operator.pos (obj)
 -- の関数: operator.__pos__ (obj)

     正の 'obj' (‘+obj’) を返します。

 -- の関数: operator.pow (a, b)
 -- の関数: operator.__pow__ (a, b)

     数値 'a' および 'b' について ‘a ** b’ を返します。

 -- の関数: operator.rshift (a, b)
 -- の関数: operator.__rshift__ (a, b)

     'a' の 'b' ビット右シフトを返します。

 -- の関数: operator.sub (a, b)
 -- の関数: operator.__sub__ (a, b)

     ‘a - b’ を返します。

 -- の関数: operator.truediv (a, b)
 -- の関数: operator.__truediv__ (a, b)

     2/3 が 0 ではなく 0.66 となるような ‘a / b’ を返します。 "真の" 除
     算としても知られています。

 -- の関数: operator.xor (a, b)
 -- の関数: operator.__xor__ (a, b)

     'a' および 'b' のビット単位排他的論理和を返します。

シーケンスを扱う演算子（いくつかの演算子はマッピングも扱います）には以下
のようなものがあります:

 -- の関数: operator.concat (a, b)
 -- の関数: operator.__concat__ (a, b)

     シーケンス 'a' および 'b' について ‘a + b’ を返します。

 -- の関数: operator.contains (a, b)
 -- の関数: operator.__contains__ (a, b)

     ‘b in a’ の判定結果を返します。被演算子が左右反転しているので注意し
     てください。

 -- の関数: operator.countOf (a, b)

     'a' の中に 'b' が出現する回数を返します。

 -- の関数: operator.delitem (a, b)
 -- の関数: operator.__delitem__ (a, b)

     'a' でインデクスが 'b' の値を削除します。

 -- の関数: operator.getitem (a, b)
 -- の関数: operator.__getitem__ (a, b)

     'a' でインデクスが 'b' の値を返します。

 -- の関数: operator.indexOf (a, b)

     'a' で最初に 'b' が出現する場所のインデクスを返します。

 -- の関数: operator.setitem (a, b, c)
 -- の関数: operator.__setitem__ (a, b, c)

     'a' でインデクスが 'b' の値を 'c' に設定します。

 -- の関数: operator.length_hint (obj, default=0)

     オブジェクト 'obj' の概算の長さを返します。最初に実際の長さを、次に
     *note object.__length_hint__(): 12c0. を使って概算の長さを、そして
     最後にデフォルトの値を返そうとします。

     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(): 445, *note sorted(): f90, *note
itertools.groupby(): 194b, 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__(): 78d. メソッドを使って '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__(): 78d. メソッドが受け付ける
     どんな型でも構いません。辞書ならば任意の *note ハッシュ可能: 18e. な
     値を受け付けます。リスト、タプル、文字列などはインデックスかスライ
     スを受け付けます:

          >>> 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(): e2a. を使って特定のフィールドをタプルレコードか
     ら取り出す例:

          >>> 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/main/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)’
                                                          
                                                          
ビット単位論理積            ‘a & b’                       ‘and_(a, b)’
                                                          
                                                          
ビット単位排他的論理和      ‘a ^ b’                       ‘xor(a, b)’
                                                          
                                                          
ビット単位反転              ‘~ a’                         ‘invert(a)’
                                                          
                                                          
ビット単位論理和            ‘a | b’                       ‘or_(a, b)’
                                                          
                                                          
冪乗                        ‘a ** b’                      ‘pow(a, b)’
                                                          
                                                          
同一性                      ‘a is b’                      ‘is_(a, b)’
                                                          
                                                          
同一性                      ‘a is not b’                  ‘is_not(a, b)’
                                                          
                                                          
同一性                      ‘a is None’                   ‘is_none(a)’
                                                          
                                                          
同一性                      ‘a is not None’               ‘is_not_none(a)’
                                                          
                                                          
インデクス指定の代入        ‘obj[k] = v’                  ‘setitem(obj, k, v)’
                                                          
                                                          
インデクス指定の削除        ‘del obj[k]’                  ‘delitem(obj, k)’
                                                          
                                                          
インデクス指定              ‘obj[k]’                      ‘getitem(obj, k)’
                                                          
                                                          
左シフト                    ‘a << b’                      ‘lshift(a, b)’
                                                          
                                                          
剰余                        ‘a % b’                       ‘mod(a, b)’
                                                          
                                                          
乗算                        ‘a * b’                       ‘mul(a, b)’
                                                          
                                                          
行列の乗算                  ‘a @ b’                       ‘matmul(a, b)’
                                                          
                                                          
(算術) 負                   ‘- a’                         ‘neg(a)’
                                                          
                                                          
(論理) 否                   ‘not a’                       ‘not_(a)’
                                                          
                                                          
正                          ‘+ a’                         ‘pos(a)’
                                                          
                                                          
右シフト                    ‘a >> b’                      ‘rshift(a, b)’
                                                          
                                                          
スライス指定の代入          ‘seq[i:j] = values’           ‘setitem(seq, slice(i, j), values)’
                                                          
                                                          
スライス指定の削除          ‘del seq[i:j]’                ‘delitem(seq, slice(i, j))’
                                                          
                                                          
スライス指定                ‘seq[i:j]’                    ‘getitem(seq, slice(i, j))’
                                                          
                                                          
文字列書式化                ‘s % obj’                     ‘mod(s, obj)’
                                                          
                                                          
減算                        ‘a - b’                       ‘sub(a, b)’
                                                          
                                                          
真理値判定                  ‘obj’                         ‘truth(obj)’
                                                          
                                                          
順序付け                    ‘a < b’                       ‘lt(a, b)’
                                                          
                                                          
順序付け                    ‘a <= b’                      ‘le(a, b)’
                                                          
                                                          
等価性                      ‘a == b’                      ‘eq(a, b)’
                                                          
                                                          
不等性                      ‘a != b’                      ‘ne(a, b)’
                                                          
                                                          
順序付け                    ‘a >= b’                      ‘ge(a, b)’
                                                          
                                                          
順序付け                    ‘a > b’                       ‘gt(a, b)’
                                                          


File: python.info,  Node: インプレース in-place 演算子,  Prev: 演算子から関数への対応表,  Up: operator --- 関数形式の標準演算子

5.11.3.2 インプレース (in-place) 演算子
.......................................

多くの演算に「インプレース」版があります。 以下の関数はそうした演算子の
通常の文法に比べてより素朴な呼び出し方を提供します。たとえば、 *note 文:
2e2d. ‘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 純粋パス: 2e4f. と *note 具象パス: 2e50. か
らなります。 純粋パスは 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: 4f5. はきっとあなたに必
要なものでしょう。 ‘Path’ はコードが実行されているプラットフォーム用の
*note 具象パス: 2e50. のインスタンスを作成します。

純粋パスは、以下のようないくつかの特殊なケースで有用です:

  1. Unix マシン上で Windows のパスを扱いたいとき (またはその逆)。Unix 上
     で実行しているときに *note WindowsPath: 2e51. のインスタンスを作成
     することはできませんが、*note PureWindowsPath: 1c9a. なら可能になり
     ます。

  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/main/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: 5a1. を継承した例外です。パスオブジェク
     トがサポートしていない操作を行おうとした時に送出されます。

     Added in version 3.13.


File: python.info,  Node: 純粋パス,  Next: 具象パス,  Prev: 例外<6>,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.12.1.3 純粋パス
.................

純粋パスオブジェクトは実際にファイルシステムにアクセスしないパス操作処理
を提供します。これらのクラスにアクセスするには 3 つの方法があり、それら
を 'フレーバー' と呼んでいます:

 -- クラス: pathlib.PurePath (*pathsegments)

     システムのパスのフレーバーを表すジェネリッククラスです (インスタン
     スを作成することで *note PurePosixPath: 2e55. または *note
     PureWindowsPath: 1c9a. のどちらかが作成されます):

          >>> PurePath('setup.py')      # Running on a Unix machine
          PurePosixPath('setup.py')

     'pathsegments' の各要素は、パスの構成要素を表す文字列か、パスオブジ
     ェクトなどの、 *note os.PathLike: 1013. インターフェースを実装する
     オブジェクトである必要があります。 ‘os.PathLike’ インターフェースで
     は、 *note __fspath__(): 1014. メソッドが文字列を返します:

          >>> 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(): 1a62. と同様):

          >>> 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: 1013. インターフェースを
     実装しており、そのインターフェースを受理する箇所ならどこでも使用す
     ることができます。

     バージョン 3.6 で変更: *note os.PathLike: 1013. インターフェースが
     サポートされました。

 -- クラス: pathlib.PurePosixPath (*pathsegments)

     *note PurePath: 8bb. のサブクラスです。このパスフレーバーは非
     Windows パスを表します:

          >>> PurePosixPath('/etc/hosts')
          PurePosixPath('/etc/hosts')

     'pathsegments' の指定は *note PurePath: 8bb. と同じです。

 -- クラス: pathlib.PureWindowsPath (*pathsegments)

     *note PurePath: 8bb. のサブクラスです。このパスフレーバー 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: 8bb. と同じです。

これらクラスはあらゆるシステムコールを行わないため、起動しているシステム
にかかわらずインスタンスを作成できます。

* Menu:

* 全般的な性質::
* 演算子::
* 個別の構成要素へのアクセス::
* メソッドとプロパティ::

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Path_(computing)#UNC


File: python.info,  Node: 全般的な性質,  Next: 演算子,  Up: 純粋パス

5.12.1.4 全般的な性質
.....................

パスオブジェクトはイミュータブルで *note ハッシュ可能: 18e. です。同じフ
レーバーのパスオブジェクトは比較ならびに順序付け可能です。これらのプロパ
ティは、フレーバーのケースフォールディング (訳注: 比較のために正規化する
こと、例えば全て大文字にする) のセマンティクスに従います。

     >>> 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(): 1a62. のように子パスを
作成することができます。 スラッシュの右側が絶対パスである場合、左側のパ
スは無視されます。 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: 1013. を実装したオブジェクトが受理できる箇所ならどこ
でも、パスオブジェクトが使用できます:

     >>> 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: 1d2. で呼び出すと、Raw ファイル
システムパスを *note os.fsencode(): 1017. でエンコードされたバイト列オブ
ジェクトで返します:

     >>> bytes(p)
     b'/etc'

     注釈: *note bytes: 1d2. での呼び出しは 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: 2e55. でパスの先頭が３つ以上の連続したスラッシ
     ュである場合、 余分なスラッシュは除去されます:

          >>> 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 スライス: 26c4.
     と負のインデックスをサポートするようになりました。

 -- の属性: 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(): 1c92. を呼ぶことを推奨します。

 -- の属性: 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.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: 2e62. ドキュメント。

     他のメソッドと同様に、大文字小文字の区別はプラットフォームの設定に
     従います:

          >>> 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(): 73d, but empty
     patterns aren't allowed (*note ValueError: 15a. 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: 7a5. を受け付けるようになりました。

     バージョン 3.12 で変更: 'case_sensitive' 引数が追加されました。

 -- メソッド: PurePath.relative_to (other, walk_up=False)

     'other' で表されたパスから現在のパスへの相対パスを返します。それが
     不可能だった場合は *note ValueError: 15a. が送出されます:

          >>> 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: 15a. が送出されます。:

          >>> 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: 8bb. 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(): 1c92. first if necessary to resolve symlinks.

     バージョン 3.12 で変更: 'walk_up' 引数が追加されました（
     ‘walk_up=False’ を指定すると以前の動作と同じになります）。

     バージョン 3.12 で非推奨、バージョン 3.14 で削除: 追加の位置引数の
     指定は非推奨となりました。指定された場合は 'other' と連結されます。

 -- メソッド: PurePath.with_name (name)

     現在のパスの *note name: 2e5e. 部分を変更したパスを返します。オリジ
     ナルパスに ‘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: 2e5f. 部分を変更したパスを返します。オリジ
     ナルパスに ‘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: 1b8a. を変更した新しいパスを返します。 元のパスに
     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: 15a. 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: 1cc0. and *note
     relative_to(): 57c.  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: 8bb. のサブクラスであり、システムのパスフレーバーの
     具象パスを表します (このインスタンスの作成で *note PosixPath: 2e64.
     か *note WindowsPath: 2e51. のどちらかが作成されます):

          >>> Path('setup.py')
          PosixPath('setup.py')

     'pathsegments' の指定は *note PurePath: 8bb. と同じです。

 -- クラス: pathlib.PosixPath (*pathsegments)

     *note Path: 4f5. および *note PurePosixPath: 2e55. のサブクラスで、
     非 Windows ファイルシステムの具象パスを表します:

          >>> PosixPath('/etc/hosts')
          PosixPath('/etc/hosts')

     'pathsegments' の指定は *note PurePath: 8bb. と同じです。

     バージョン 3.13 で変更: Windows では *note UnsupportedOperation:
     73b. を送出します。以前のバージョンでは代わりに *note
     NotImplementedError: 5a1. を送出していました。

 -- クラス: pathlib.WindowsPath (*pathsegments)

     *note Path: 4f5. および *note PureWindowsPath: 1c9a. のサブクラスで
     、Windows ファイルシステムの具象パスを表します:

          >>> WindowsPath('c:/', 'Users', 'Ximénez')
          WindowsPath('c:/Users/Ximénez')

     'pathsegments' の指定は *note PurePath: 8bb. と同じです。

     バージョン 3.13 で変更: Windows 以外のプラットフォームでは *note
     UnsupportedOperation: 73b. を送出します。以前のバージョンでは代わり
     に *note NotImplementedError: 5a1. を送出していました。

インスタンスを作成できるのはシステムと一致するフレーバーのみです (互換性
のないパスフレーバーでのシステムコールの許可はバグやアプリケーションの異
常終了の原因になります):

     >>> 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: 543. 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: 2e66.

 -- メソッド: 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: 15a. 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: 15a. is raised.

 -- メソッド: Path.as_uri ()

      'file' URI で表したパスを返します。絶対パスではない場合に *note
     ValueError: 15a. を送出します。

          >>> 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: 8bb. rather than *note Path: 4f5. is
     possible but deprecated.  The method's use of *note os.fsencode():
     1017. 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(): ddc. での
     ‘~’ の返り値) を表す新しいパスオブジェクトを返します。ホームディレ
     クトリが解決できない場合は、 *note RuntimeError: 317. を送出します
     。

          >>> Path.home()
          PosixPath('/home/antoine')

     Added in version 3.5.

 -- メソッド: Path.expanduser ()

     パス要素 ‘~’ および ‘~user’ を *note os.path.expanduser(): ddc. が
     返すように展開した新しいパスオブジェクトを返します。ホームディレク
     トリが解決できない場合は、 *note RuntimeError: 317. を送出します。

          >>> p = PosixPath('~/films/Monty Python')
          >>> p.expanduser()
          PosixPath('/home/eric/films/Monty Python')

     Added in version 3.5.

 -- メソッド: classmethod Path.cwd ()

     (*note os.getcwd(): 1b45. が返す) 現在のディレクトリを表す新しいパ
     スオブジェクトを返します:

          >>> 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: 543. 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: 543. is raised in strict mode, and no
     exception is raised in non-strict mode.  In previous versions,
     *note RuntimeError: 317. is raised no matter the value of 'strict'.

 -- メソッド: Path.readlink ()

     ( *note os.readlink(): cf1. が返す) シンボリックリンクが指すパスを
     返します:

          >>> p = Path('mylink')
          >>> p.symlink_to('setup.py')
          >>> p.readlink()
          PosixPath('setup.py')

     Added in version 3.9.

     バージョン 3.13 で変更: *note os.readlink(): cf1. が利用できない場
     合 *note UnsupportedOperation: 73b. を送出します。以前のバージョン
     では *note NotImplementedError: 5a1. を送出していました。


File: python.info,  Node: ファイルの種類とステータスを問い合わせる,  Next: ファイルを読み書きする<2>,  Prev: パスの展開と解決,  Up: 具象パス

5.12.1.11 ファイルの種類とステータスを問い合わせる
..................................................

バージョン 3.8 で変更: *note exists(): dde, *note is_dir(): 742, *note
is_file(): 741, *note is_mount(): ddf, *note is_symlink(): de0, *note
is_block_device(): de1, *note is_char_device(): de2, *note is_socket():
de4. は、OSレベルで表現不能な文字を含むパスに対して、例外を送出する代わ
りに ‘False’ を返すようになりました。

バージョン 3.14 で変更: The methods given above now return ‘False’
instead of raising any *note OSError: 543. 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(): dd6, *note os.path.isdir(): dd8, etc.  Use *note
stat(): c00. to retrieve the file status without suppressing exceptions.

 -- メソッド: Path.stat (*, follow_symlinks=True)

     (*note os.stat(): 4fc. と同様の) 現在のパスについて *note
     os.stat_result: 1879. オブジェクトが含む情報を返します。値はそれぞ
     れのメソッドを呼び出した時点のものになります。

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクに対して stat したい場合は ‘follow_symlinks=False’ とするか、
     *note lstat(): 2e69. を利用してください。

          >>> p = Path('setup.py')
          >>> p.stat().st_size
          956
          >>> p.stat().st_mtime
          1327883547.852554

     バージョン 3.10 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.lstat ()

     *note Path.stat(): c00. のように振る舞いますが、パスがシンボリック
     リンクを指していた場合、リンク先ではなくシンボリックリンク自身の情
     報を返します。

 -- メソッド: 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(): c00. 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(): c00. 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():
     c00. 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(): c00. 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(): c00. 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(): c00.
     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(): c00. 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(): c00. to distinguish between these cases.

 -- メソッド: Path.samefile (other_path)

     このパスが参照するファイルが 'other_path' (Path オブジェクトか文字
     列) と同じであれば ‘True’ を、異なるファイルであれば ‘False’ を返し
     ます。意味的には *note os.path.samefile(): 1320. および *note
     os.path.samestat(): 131f. と同じです。

     なんらかの理由でどちらかのファイルにアクセスできない場合は *note
     OSError: 543. が送出されます。

          >>> p = Path('spam')
          >>> q = Path('eggs')
          >>> p.samefile(q)
          False
          >>> p.samefile('spam')
          True

     Added in version 3.5.

 -- の属性: Path.info

     A *note PathInfo: 4fb. 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(): 4fd. 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(): 742, *note is_file(): 741. and *note is_symlink():
     de0. 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(): 333. のようにパスが指しているファイルを
     開きます:

          >>> 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(): 333. と同じです。

     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'

     Return the number of characters written.

     同じ名前のファイルが存在する場合は上書きされます。オプションのパラ
     メーターの意味は *note open(): 333. と同じです。

     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'

     Return the number of bytes written.

     同じ名前のファイルがすでにあれば上書きされます。

     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:
     543. を送出します。

 -- メソッド: 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: 2e62. ドキュメント。

     デフォルトまたは 'case_sensitive' キーワード専用引数に ‘None’ を指
     定した場合、このメソッドはパスの一致判定にプラットフォームに依存し
     た大文字小文字のルールを使用します。一般的にPOSIXは大文字と小文字を
     区別し、Windowsは区別しません。'case_sensitive' を ‘True’ または
     ‘False’ に設定するとこの動作を上書きします。

     デフォルトまたは 'recurse_symlinks' キーワード専用引数が ‘False’ に
     設定された場合、このメソッドは "‘**’" ワイルドカードの展開時にシン
     ボリックリンクをたどりません。'recurse_symlinks' を ‘True’ に設定す
     ると、つねにシンボリックリンクをたどります。

          注釈: Any *note OSError: 543. exceptions raised from scanning
          the filesystem are suppressed.  This includes *note
          PermissionError: 10fd. when accessing directories without read
          permission.

     引数 ‘self’, ‘pattern’ を指定して *note 監査イベント: 1e84.
     ‘pathlib.Path.glob’ を送出します。

     バージョン 3.12 で変更: 'case_sensitive' 引数が追加されました。

     バージョン 3.13 で変更: 'recurse_symlinks' パラメータが追加されまし
     た。

     バージョン 3.13 で変更: 'pattern' パラメタが *note path-like
     object: 7a5. を受け付けるようになりました。

     バージョン 3.13 で変更: Any *note OSError: 543. 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():
     73f. で 'pattern' の前に "‘**/’" をつけ呼び出した場合と似ています。

          注釈: The paths are returned in no particular order.  If you
          need a specific order, sort the results.

          注釈: Any *note OSError: 543. exceptions raised from scanning
          the filesystem are suppressed.  This includes *note
          PermissionError: 10fd. when accessing directories without read
          permission.

     参考
     ....

     *note Pattern language: 2e62. と *note Path.glob(): 73f. のドキュメ
     ント。

     引数 ‘self’, ‘pattern’ を指定して *note 監査イベント: 1e84.
     ‘pathlib.Path.rglob’ を送出します。

     バージョン 3.12 で変更: 'case_sensitive' 引数が追加されました。

     バージョン 3.13 で変更: 'recurse_symlinks' パラメータが追加されまし
     た。

     バージョン 3.13 で変更: 'pattern' パラメタが *note path-like
     object: 7a5. を受け付けるようになりました。

 -- メソッド: 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: 4f5. 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: 1d3c. 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(): e27. 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:
     543. 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(): 8bd. はすでにたどったディ
          レクトリを管理したりはしません。

          注釈: ‘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(): 8be, ‘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(): 33d.  Walking the tree bottom-up is essential as
     *note rmdir(): 2e6d. 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: 13cd. が送出されま
     す。

     参考
     ....

     The *note open(): 2e6b, *note write_text(): 11f8. and *note
     write_bytes(): 11fa. methods are often used to create files.

 -- メソッド: Path.mkdir (mode=0o777, parents=False, exist_ok=False, *,
          parent_mode=None)

     与えられたパスに新しくディレクトリを作成します。'mode' が与えられて
     いた場合、プロセスの ‘umask’ 値と組み合わせてファイルのモードとアク
     セスフラグを決定します。パスがすでに存在していた場合 *note
     FileExistsError: 13cd. が送出されます。

     'parents' の値が真の場合、このパスの親ディレクトリを必要に応じて作
     成します; それらのアクセス制限はデフォルト値が取られ、'mode' は使用
     されません (POSIX の ‘mkdir -p’ コマンドを真似ています)。

     If 'parent_mode' is not ‘None’, it is used as the mode for any
     newly-created, intermediate-level directories when 'parents' is
     true.  Like 'mode', it is combined with the process's ‘umask’
     value.  Otherwise, intermediate directories are created with the
     default permissions (also subject to the umask).

     'parents' の値が偽の場合 (デフォルト)、親ディレクトリがないと *note
     FileNotFoundError: 24f. を送出します。

     'exist_ok' の値が (デフォルトの) 偽の場合、対象のディレクトリがすで
     に存在すると *note FileExistsError: 13cd. を送出します。

     If 'exist_ok' is true, *note FileExistsError: 13cd. 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' 引数が追加されました。

     Added in version 3.15: The 'parent_mode' parameter.

 -- メソッド: 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(): 14b5. と
          は逆です。

     バージョン 3.13 で変更: *note os.symlink(): 14b5. が利用できない場
     合 *note UnsupportedOperation: 73b. を送出します。以前のバージョン
     では *note NotImplementedError: 5a1. を送出していました。

 -- メソッド: Path.hardlink_to (target)

     このパスを 'target' と同じファイルへのハードリンクにします。

          注釈: 引数の並び (link, target) は *note os.link(): 14b0. とは
          逆です。

     Added in version 3.10.

     バージョン 3.13 で変更: *note os.link(): 14b0. が利用できない場合
     *note UnsupportedOperation: 73b. を送出します。以前のバージョンでは
     *note NotImplementedError: 5a1. を送出していました。


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(): 4f6.  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: 13cd. が送出されます。 '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(): 14b2. 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: 543. is
     raised.

     If both paths are on the same filesystem, the move is performed
     with *note os.replace(): 14b3.  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(): 2e6d. を使用してください。

     'missing_ok' の値が (デフォルトの) 偽の場合、対象のファイルが存在し
     ないと *note FileNotFoundError: 24f. を送出します。

     'missing_ok' の値が真の場合、 *note FileExistsError: 13cd. 例外を送
     出しません (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: 7e5. が送
     出されます。

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクの所有者を取得するには ‘follow_symlinks=False’ 引数を追加してく
     ださい。

     バージョン 3.13 で変更: *note pwd: ba. モジュールが利用できない場合
     *note UnsupportedOperation: 73b. を送出します。以前のバージョンでは
     *note NotImplementedError: 5a1. を送出していました。

     バージョン 3.13 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.group (*, follow_symlinks=True)

     ファイルの所有者のグループ名を返します。ファイルのグループID(GID)が
     システムのデータベースに見つからない場合 *note KeyError: 7e5. が送
     出されます。

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクのグループを取得するには ‘follow_symlinks=False’ 引数を追加して
     ください。

     バージョン 3.13 で変更: *note grp: 69. モジュールが利用できない場合
     *note UnsupportedOperation: 73b. を送出します。以前のバージョンでは
     *note NotImplementedError: 5a1. を送出していました。

     バージョン 3.13 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.chmod (mode, *, follow_symlinks=True)

     *note os.chmod(): 732. のようにファイルのモードとアクセス権限を変更
     します。

     このメソッドは通常シンボリックリンクをたどります。一部のUnixではシ
     ンボリックリンク自体のパーミッション変更をサポートしています。その
     ようなプラットフォームでは引数に''follow_symlinks=False'' を追加す
     るか、*note lchmod(): 2e73. を使用してください。

          >>> 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(): c01. のように振る舞いますが、パスがシンボリック
     リンクを指していた場合、リンク先ではなくシンボリックリンク自身のモ
     ードが変更されます。


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(): 73d, *note glob(): 73f. and *note rglob(): 740.:

‘**’ (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(): 73f. and *note rglob(): 740, 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: a5f. or *note altsep: a60.)
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(): 73f.
and *note Path.rglob(): 740. differ slightly from those by the *note
glob: 67. module:

  1. Files beginning with a dot are not special in pathlib.  This is
     like passing ‘include_hidden=True’ to *note glob.glob(): 2df.

  2. "‘**’" pattern components are always recursive in pathlib.  This is
     like passing ‘recursive=True’ to *note glob.glob(): 2df.

  3. "‘**’" pattern components do not follow symlinks by default in
     pathlib.  This behaviour has no equivalent in *note glob.glob():
     2df, but you can pass ‘recurse_symlinks=True’ to *note Path.glob():
     73f. for compatible behaviour.

  4. Like all *note PurePath: 8bb. and *note Path: 4f5. objects, the
     values returned from *note Path.glob(): 73f. and *note
     Path.rglob(): 740. 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: 8bb. and *note
Path: 4f5. 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: 14ab.  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():
16d4. eliminates "‘..’" segments from a path, which may change its
meaning if symlinks are involved, *note Path.absolute(): 1c4d. 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:
8bb. あるいは *note Path: 4f5. の同等のものとの対応表です。

*note os: a5. と *note os.path: a6.       ‘pathlib’
                                          
---------------------------------------------------------------------------------------------
                                          
*note os.path.dirname(): 2e78.            *note PurePath.parent: 1cc0.
                                          
                                          
*note os.path.basename(): 2e79.           *note PurePath.name: 2e5e.
                                          
                                          
*note os.path.splitext(): 1b8c.           *note PurePath.stem: 2e5f,
                                          *note PurePath.suffix: 1b8a.
                                          
                                          
*note os.path.join(): 1a62.               *note PurePath.joinpath(): 2e61.
                                          
                                          
*note os.path.isabs(): 739.               *note PurePath.is_absolute(): 1cbf.
                                          
                                          
*note os.path.relpath(): 8bf.             *note PurePath.relative_to(): 57c. (1)
                                          
                                          
*note os.path.expanduser(): ddc.          *note Path.expanduser(): 11f6. (2)
                                          
                                          
*note os.path.realpath(): 24d.            *note Path.resolve(): 1c92.
                                          
                                          
*note os.path.abspath(): 16d4.            *note Path.absolute(): 1c4d. (3)
                                          
                                          
*note os.path.exists(): dd6.              *note Path.exists(): dde.
                                          
                                          
*note os.path.isfile(): dd9.              *note Path.is_file(): 741.
                                          
                                          
*note os.path.isdir(): dd8.               *note Path.is_dir(): 742.
                                          
                                          
*note os.path.islink(): dd4.              *note Path.is_symlink(): de0.
                                          
                                          
*note os.path.isjunction(): 8b8.          *note Path.is_junction(): 8c0.
                                          
                                          
*note os.path.ismount(): dda.             *note Path.is_mount(): ddf.
                                          
                                          
*note os.path.samefile(): 1320.           *note Path.samefile(): 11f5.
                                          
                                          
*note os.getcwd(): 1b45.                  *note Path.cwd(): 1cbe.
                                          
                                          
*note os.stat(): 4fc.                     *note Path.stat(): c00.
                                          
                                          
*note os.lstat(): 8b6.                    *note Path.lstat(): 2e69.
                                          
                                          
*note os.listdir(): 14bb.                 *note Path.iterdir(): 4fd.
                                          
                                          
*note os.walk(): 8be.                     *note Path.walk(): 8bd. (4)
                                          
                                          
*note os.mkdir(): 734,                    *note Path.mkdir(): 2e4.
*note os.makedirs(): 24b.                 

*note os.link(): 14b0.                    *note Path.hardlink_to(): bfe.
                                          
                                          
*note os.symlink(): 14b5.                 *note Path.symlink_to(): bff.
                                          
                                          
*note os.readlink(): cf1.                 *note Path.readlink(): cf0.
                                          
                                          
*note os.rename(): 14b2.                  *note Path.rename(): 1ad4.
                                          
                                          
*note os.replace(): 14b3.                 *note Path.replace(): 2e71.
                                          
                                          
*note os.remove(): 14b1,                  *note Path.unlink(): 1fe3.
*note os.unlink(): 14b6.                  

*note os.rmdir(): 14b4.                   *note Path.rmdir(): 2e6d.
                                          
                                          
*note os.chmod(): 732.                    *note Path.chmod(): c01.
                                          
                                          
*note os.lchmod(): 731.                   *note Path.lchmod(): 2e73.
                                          

脚注
....

   ---------- Footnotes ----------

   (1) *note os.path.relpath(): 8bf. calls *note abspath(): 16d4. to
make paths absolute and remove "‘..’" parts, whereas *note
PurePath.relative_to(): 57c. is a lexical operation that raises *note
ValueError: 15a. when its inputs' anchors differ (e.g.  if one path is
absolute and the other relative.)

   (2) *note os.path.expanduser(): ddc. returns the path unchanged if
the home directory can't be resolved, whereas *note Path.expanduser():
11f6. raises *note RuntimeError: 317.

   (3) *note os.path.abspath(): 16d4. removes "‘..’" components without
resolving symlinks, which may change the meaning of the path, whereas
*note Path.absolute(): 1c4d. leaves any "‘..’" components in the path.

   (4) *note os.walk(): 8be. always follows symlinks when categorizing
paths into 'dirnames' and 'filenames', whereas *note Path.walk(): 8bd.
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: 772. describing the *note Path.info: 4fa.
     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(): 333. を、ファイルシステムにアクセスするに
は *note os: a5. モジュールをご参照ください。パスの引数は文字列、バイト
列、あるいは *note os.PathLike: 1013. プロトコルを実装するあらゆるオブジ
ェクトとして渡すことができます。

Unix シェルとは異なり、Python はあらゆるパス展開を '自動的には' 行いませ
ん。アプリケーションがシェルのようなパス展開を必要とした場合は、 *note
expanduser(): ddc. や *note expandvars(): 1792. といった関数を明示的に呼
び出すことで行えます。(*note glob: 67. モジュールも参照してください)

参考
....

*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(): dd6.、 *note lexists(): dd7.、
*note isdir(): dd8.、 *note isfile(): dd9.、 *note islink(): dd4.、およ
び *note ismount(): dda. は、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(): 1a62. and *note os.path.normpath(): 16d3.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.basename (path, /)

     パス名 'path' の末尾のファイル名部分を返します。これは関数 *note
     split(): 2e82. に 'path' を渡した時に返されるペアの 2 番めの要素で
     す。この関数が返すのは Unix の ‘basename’ とは異なります; Unix の
     ‘basename’ は ‘'/foo/bar/'’ に対して ‘'bar'’ を返しますが、関数
     *note basename(): 2e79. は空文字列 (‘''’) を返します。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.commonpath (paths)

     Return the longest common sub-path of each pathname in the iterable
     'paths'.  Raise *note ValueError: 15a. if 'paths' contain both
     absolute and relative pathnames, if 'paths' are on different
     drives, or if 'paths' is empty.  Unlike *note commonprefix(): 33b,
     this returns a valid path.

     Added in version 3.5.

     バージョン 3.6 で変更: *note path-like objects: 7a5. のシーケンスを
     受け入れるようになりました。

     バージョン 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(): 33c. 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: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.15 で非推奨: Deprecated in favor of *note
     os.path.commonpath(): 33c. for path prefixes.  The *note
     os.path.commonprefix(): 33b. function is being deprecated due to
     having a misleading name and module.  The function is not safe to
     use for path prefixes despite being included in a module about path
     manipulation, meaning it is easy to accidentally introduce path
     traversal vulnerabilities into Python programs by using this
     function.

 -- の関数: os.path.dirname (path, /)

     パス名 'path' のディレクトリ名を返します。これは関数 *note split():
     2e82. に 'path' を渡した時に返されるペアの 1 番めの要素です。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.exists (path)

     'path' が実在するパスかオープンしているファイル記述子を参照している
     場合 ‘True’ を返します。壊れたシンボリックリンクについては ‘False’
     を返します。一部のプラットフォームでは、たとえ 'path' が物理的に存
     在していたとしても、要求されたファイルに対する *note os.stat():
     4fc. の実行権がなければこの関数が ‘False’ を返すことがあります。

     バージョン 3.3 で変更: 'path' は整数でも可能になりました: それがオ
     ープンしているファイル記述子なら ‘True’ が返り、それ以外なら
     ‘False’ が返ります。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.lexists (path)

     Return ‘True’ if 'path' refers to an existing path, including
     broken symbolic links.  Equivalent to *note exists(): dd6. on
     platforms lacking *note os.lstat(): 8b6.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.expanduser (path)

     Unix および Windows では、与えられた引数の先頭のパス要素 ‘~’ 、また
     は ‘~user’ を、 'user' のホームディレクトリのパスに置き換えて返しま
     す。

     Unix では、先頭の ‘~’ は、環境変数 ‘HOME’ が設定されているならその
     値に置き換えられます。設定されていない場合は、現在のユーザのホーム
     ディレクトリをビルトインモジュール *note pwd: ba. を使ってパスワー
     ドディレクトリから探して置き換えます。先頭の ‘~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: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.8 で変更: Windowsで ‘HOME’ は参照しなくなりました。

 -- の関数: os.path.expandvars (path)

     引数のパスの環境変数を展開して返します。引数の中の ‘$name’ または
     ‘${name}’ のような形式の文字列は環境変数、 'name' の値に置き換えら
     れます。不正な変数名や存在しない変数名の場合には変換されず、そのま
     ま返します。

     Windows では、 ‘$name’ や ‘${name}’ の形式に加えて、 ‘%name%’ の形
     式もサポートされています。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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: f7. module).  Raise *note OSError: 543. 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: f7. module).  Raise *note OSError: 543.
     if the file does not exist or is inaccessible.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.getctime (path, /)

     システムの ctime、Unix系など一部のシステムでは最後にメタデータが変
     更された時刻、Windows などその他のシステムでは 'path' の作成時刻を
     返します。返り値はエポック (*note time: f7. モジュールを参照) から
     の経過時間を示す秒数になります。ファイルが存在しない、あるいはアク
     セスできなかった場合は *note OSError: 543. を送出します。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.getsize (path, /)

     'path' のサイズをバイト数で返します。ファイルが存在しない、あるいは
     アクセスできなかった場合は *note OSError: 543. を送出します。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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(): 16d4.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.13 で変更: On Windows, returns ‘False’ if the given
     path starts with exactly one (back)slash.

 -- の関数: os.path.isfile (path)

     'path' が *note 存在する: dd6. 一般ファイルなら ‘True’ を返します。
     この関数はシンボリックリンクの先を辿るので、同じパスに対して *note
     islink(): dd4. と *note isfile(): dd9. の両方が真を返すことがありま
     す。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.isdir (path, /)

     'path' が *note 存在する: dd6. ディレクトリなら ‘True’ を返します。
     この関数はシンボリックリンクの先を辿るので、同じパスに対して *note
     islink(): dd4. と *note isdir(): dd8. の両方が真を返すことがありま
     す。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.isjunction (path)

     Return ‘True’ if 'path' refers to an *note existing: dd7. 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 存在する: dd6. ディレクトリを指すシンボリックリンク
     なら ‘True’ を返します。 Python ランタイムがシンボリックリンクをサ
     ポートしていないプラットフォームでは、常に ‘False’ を返します。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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: 234c.: 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:
     7a5. を受け付けるようになりました。

 -- の関数: os.path.normcase (path, /)

     パス名の大文字・小文字を正規化します。 Windowsでは、パス名にある文
     字を全て小文字に、スラッシュをバックスラッシュに変換します。 他のオ
     ペレーティングシステムでは、パスを変更せずに返します。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.normpath (path)

     パスを正規化します。余分な区切り文字や上位レベル参照を除去し、
     ‘A//B’、‘A/B/’、‘A/./B’ や ‘A/foo/../B’ などはすべて ‘A/B’ になりま
     す。この文字列操作は、シンボリックリンクを含むパスの意味を変えてし
     まう場合があります。Windows では、スラッシュをバックスラッシュに変
     換します。大文字小文字の正規化には *note normcase(): 2e87. を使用し
     てください。

          注釈: 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: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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: 543.  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:
     24f. is raised if 'path' does not exist, or another *note OSError:
     543. if it is otherwise inaccessible.  If 'strict' is *note
     ALL_BUT_LAST: 2e88, the last component of the path is allowed to be
     missing, but all other errors are raised.

     If 'strict' is *note os.path.ALLOW_MISSING: 24e, errors other than
     *note FileNotFoundError: 24f. 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: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.8 で変更: Windows においてシンボリックリンクとジャンク
     ションが解決されるようになりました。

     バージョン 3.10 で変更: 'strict' 引数が追加されました。

     バージョン 3.15 で変更: The *note ALL_BUT_LAST: 2e88. and *note
     ALLOW_MISSING: 24e. values for the 'strict' parameter was added.

 -- データ: os.path.ALL_BUT_LAST

     Special value used for the 'strict' argument in *note realpath():
     24d.

     Added in version 3.15.

 -- データ: os.path.ALLOW_MISSING

     Special value used for the 'strict' argument in *note realpath():
     24d.

     Added in version 3.15.

 -- の関数: os.path.relpath (path, start=os.curdir)

     カレントディレクトリあるいはオプションの 'start' ディレクトリからの
     'path' への相対パスを返します。これはパス計算で行っており、ファイル
     システムにアクセスして 'path' や 'start' の存在や性質を確認すること
     はありません。Windowsでは、 'path' と 'start' が異なるドライブの場
     合、 *note ValueError: 15a. を送出します。

     'start' defaults to *note os.curdir: 2e89.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.samefile (path1, path2, /)

     引数の両パス名が同じファイルまたはディレクトリを参照している場合、
     ‘True’ を返します。これは、デバイス番号と i-node 番号で決定されます
     。どちらかのパス名への *note os.stat(): 4fc. 呼び出しが失敗した場合
     、例外が送出されます。

     バージョン 3.2 で変更: Windows サポートを追加しました。

     バージョン 3.4 で変更: Windows が他のプラットフォームと同じ実装を使
     用するようになりました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.sameopenfile (fp1, fp2)

     ファイル記述子 'fp1' と 'fp2' が同じファイルを参照していたら ‘True’
     を返します。

     バージョン 3.2 で変更: Windows サポートを追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.path.samestat (stat1, stat2, /)

     stat タプル 'stat1' と 'stat2' が同じファイルを参照していれば
     ‘True’ を返します。これらのタプルは *note os.fstat(): 1149. 、
     *note os.lstat(): 8b6. あるいは *note os.stat(): 4fc. の返り値で構
     いません。この関数は *note samefile(): 1320. と *note
     sameopenfile(): 2e8a. を使用した比較に基いて実装しています。

     バージョン 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():
     1a62, *note dirname(): 2e78. and *note basename(): 2e79.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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: 7a5. を受け入れるよ
     うになりました。

 -- データ: os.path.supports_unicode_filenames

     ファイル名に任意の Unicode 文字列を (システムの制限内で) 使用できる
     場合は ‘True’ になります。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/genericpath.py

   (2) https://github.com/python/cpython/tree/main/Lib/posixpath.py

   (3) https://github.com/python/cpython/tree/main/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(): 4fc, *note os.fstat(): 1149. and *note
os.lstat(): 8b6. (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(): 732. で設定することのできる一部のファイルモード
     -- すなわち、ファイルの許可ビット (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: 1369. 、 *note
     S_IFPORT: 136a. 、 *note S_IFWHT: 136b. をサポートしています。

以下の全ての変数は、 *note os.stat(): 4fc. 、 *note os.fstat(): 1149. 、
または *note os.lstat(): 8b6. が返す 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(): 4fc. 、 *note os.fstat(): 1149. 、あるいは *note os.lstat():
8b6. を呼び出した時点で読み出し待ちであったデータのバイト数になります; こ
の値は時に有用で、特に上記の特殊なファイルを非ブロックモードで開いた後に
ポーリングを行いたいといった場合に便利です。他のキャラクタ型およびブロッ
ク型デバイスにおけるサイズフィールドの意味はさらに異なっていて、背後のシ
ステムコールの実装によります。

以下の変数は、 *note ST_MODE: 1368. フィールドで使用されるフラグを定義し
ています。

最初に挙げる、以下のフラグを使うよりは、上記の関数を使うほうがポータブル
です:

 -- データ: 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: 1369. 、 *note S_IFPORT: 136a. 、または *note
     S_IFWHT: 136b. は、プラットフォームがこれらのファイルタイプをサポー
     トしていない場合、0 として定義されます。

以下のフラグは、 *note os.chmod(): 732. の 'mode' 引数に使うこともできま
す:

 -- データ: stat.S_ISUID

     UID ビットを設定する。

 -- データ: stat.S_ISGID

     グループIDビットを設定する。このビットには幾つかの特殊ケースがあり
     ます。ディレクトリに対して設定されていた場合、 BSD のセマンティクス
     が利用される事を示しています。すなわち、そこに作成されるファイルは
     、作成したプロセスの有効グループID (effective group ID) ではなくそ
     のディレクトリのグループIDを継承し、そこに作成されるディレクトリに
     も *note S_ISGID: 2ea8. ビットが設定されます。グループ実行ビット
     (*note S_IXGRP: 2ea9.) が設定されていないファイルに対してこのビット
     が設定されていた場合、強制ファイル/レコードロックを意味します
     (*note S_ENFMT: 2eaa. も参照してください)。

 -- データ: 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: 2ea8. と共
     有されています。グループ実行ビット (*note S_IXGRP: 2ea9.) が設定さ
     れていないファイルでは、ファイル/レコードのロックが強制されます。

 -- データ: stat.S_IREAD

     *note S_IRUSR: 2ead. の、 Unix V7 のシノニム。

 -- データ: stat.S_IWRITE

     *note S_IWUSR: 2eae. の、 Unix V7 のシノニム。

 -- データ: stat.S_IEXEC

     *note S_IXUSR: 2eaf. の、 Unix V7 のシノニム。

以下のフラグを *note os.chflags(): 14ae. の '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: 234c.: macOS

     Added in version 3.13.

 -- データ: stat.SF_SYNTHETIC

     All super-user read-only synthetic flags

     *note Availability: 234c.: 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(): 4fc. が返す ‘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(): 8b6. が返す ‘st_reparse_tag’ メンバーと
の比較に次の定数が 使えます。 これらはよく知られている定数ですが、全てを
網羅したリストではありません。

 -- データ: stat.IO_REPARSE_TAG_SYMLINK
 -- データ: stat.IO_REPARSE_TAG_MOUNT_POINT
 -- データ: stat.IO_REPARSE_TAG_APPEXECLINK

     Added in version 3.8.

On Linux, the following file attribute constants are available for use
when testing bits in the *note stx_attributes: 2ee3. and *note
stx_attributes_mask: 2ee4. members returned by *note os.statx(): 24a.
See the ‘statx(2)(4)’ man page for more detail on the meaning of these
constants.

 -- データ: stat.STATX_ATTR_COMPRESSED
 -- データ: stat.STATX_ATTR_IMMUTABLE
 -- データ: stat.STATX_ATTR_APPEND
 -- データ: stat.STATX_ATTR_NODUMP
 -- データ: stat.STATX_ATTR_ENCRYPTED
 -- データ: stat.STATX_ATTR_AUTOMOUNT
 -- データ: stat.STATX_ATTR_MOUNT_ROOT
 -- データ: stat.STATX_ATTR_VERITY
 -- データ: stat.STATX_ATTR_DAX
 -- データ: stat.STATX_ATTR_WRITE_ATOMIC

     Added in version 3.15.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/stat.py

   (2) https://manpages.debian.org/chflags(2)

   (3) 
https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117.aspx

   (4) https://manpages.debian.org/statx(2)


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: 3a. 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(): 4fc. 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(): 4fc. 情報が変更された場合、キャッシュの項目は無効
     化されます。*note clear_cache(): 12ee. を使用して全キャッシュを削除
     することが出来ます。

 -- の関数: filecmp.cmpfiles (dir1, dir2, common, shallow=True)

     'dir1' と 'dir2' ディレクトリの中の、'common' で指定されたファイル
     を比較します。

     ファイル名からなる3つのリスト: 'match', 'mismatch', 'errors' を返し
     ます。'match' には双方のディレクトリで一致したファイルのリストが含
     まれ、'mismatch' にはそうでないファイル名のリストが入ります。そして
     'errors' は比較されなかったファイルが列挙されます。'errors' になる
     のは、片方あるいは両方のディレクトリに存在しなかった、ユーザーにそ
     のファイルを読む権限がなかった、その他何らかの理由で比較を完了する
     ことができなかった場合です。

     引数 'shallow' はその意味も標準の設定も *note filecmp.cmp(): 1c05.
     と同じです。

     例えば、‘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/main/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: 12ef.  '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(): 1c05. by default using the
     'shallow' parameter.

     バージョン 3.13 で変更: Added the 'shallow' parameter.

     *note dircmp: 12f0. クラスは以下のメソッドを提供しています:

      -- メソッド: report ()

          'a' と 'b' の比較を (*note sys.stdout: ea0. に) 表示します。

      -- メソッド: report_partial_closure ()

          'a' および 'b' およびそれらの直下にある共通のサブディレクトリ
          間での比較結果を出力します。

      -- メソッド: report_full_closure ()

          'a' および 'b' およびそれらの共通のサブディレクトリ間での比較
          結果を (再帰的に比較して) 出力します。

     *note dircmp: 12f0. クラスは、比較されているディレクトリ階層に関す
     る様々な情報のビットを得るために使用することのできる、興味深い属性
     を数多く提供しています。

     Note that via *note __getattr__(): 8e8. 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(): 4fc. がエラーを報告するような名前です。

      -- の属性: same_files

          クラスのファイル比較オペレータを用いて 'a' と 'b' の両方におい
          て同一のファイルです。

      -- の属性: diff_files

          'a' と 'b' の両方に存在し、クラスのファイル比較オペレータに基
          づいて内容が異なるファイルです。

      -- の属性: funny_files

          'a' および 'b' 両方にあるが、比較されなかったファイルです。

      -- の属性: subdirs

          A dictionary mapping names in *note common_dirs: 2efe. 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: 12f0. に無視されるディレクトリのリストで
     す。

これは ‘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: 1a2d.、
*note NamedTemporaryFile: 8db.、*note TemporaryDirectory: 15ef.、 *note
SpooledTemporaryFile: a87. は自動的に後始末をし、*note context managers
コンテキストマネージャ: 47f. として使うことの出来る高水準のインターフェ
イスです。 *note mkstemp(): 2f07. と *note mkdtemp(): 735. は手動で後始
末をしなければならない低水準の関数です。

ユーザが呼び出し可能な全ての関数とコンストラクタは追加の引数を受け取りま
す。 その引数によって一時ファイルやディレクトリの場所と名前を直接操作す
ることが出来ます。 このモジュールに使用されるファイル名はランダムな文字
を含みます。そのためファイルは共有された一時ディレクトリに安全に作成され
ます。 後方互換性を保つために引数の順序は若干奇妙です。 分かりやすさのた
めにキーワード引数を使用してください。

このモジュールではユーザが呼び出し可能な以下の項目を定義しています:

 -- の関数: tempfile.TemporaryFile (mode='w+b', buffering=-1,
          encoding=None, newline=None, suffix=None, prefix=None,
          dir=None, *, errors=None)

     一時的な記憶領域として使うことの出来る *note file-like object:
     19d1. を返します。 ファイルは *note mkstemp(): 2f07. と同じルールに
     より安全に作成されます。 オブジェクトは閉じられる (オブジェクトのガ
     ベージコレクションによる暗黙的なものも含みます) とすぐに破壊されま
     す。 Unix では、そのファイルのディレクトリエントリは全く作成されな
     いか、ファイル作成後すぐに削除されます。 これは他のプラットフォーム
     ではサポートされません。 よって、この関数で作成された一時ファイルが
     ファイルシステムで可視な名前を持つかどうかをコードで当てにすべきで
     はありません。

     返されたオブジェクトを :term:コンテキストマネージャ <context
     manager>'として使うことができます （*note 使用例: 2f08. を参照して
     ください）。 コンテキストの完了やファイルオブジェクトの破壊で、一時
     ファイルはファイルシステムから削除されます。

     作成されたファイルを閉じることなく読み書きできるように、 'mode' 引
     数のデフォルトは ‘'w+b'’ です。 保存されるデータに関わらず全てのプ
     ラットフォーム上で一貫して動作するようにバイナリモードが使用されま
     す。 'buffering'、'encoding'、'errors'、'newline' は、 *note
     open(): 333. に対する引数として解釈されます。

     'dir'、'prefix'、'suffix' 引数の意味とデフォルトは *note mkstemp():
     2f07. のものと同じです。

     返されたオブジェクトは、POSIXプラットフォームでは本物のファイルオブ
     ジェクトです。 それ以外のプラットフォームでは、‘file’ 属性が下層の
     本物のファイルであるファイル様オブジェクトです。

     *note os.O_TMPFILE: 1322. フラグは、利用可能で動作する場合に用いら
     れます (Linux 固有で、Linux kernel 3.11 以降)。

     プラットフォームが Posix でも Cygwin でもない場合は、TemporaryFile
     は NamedTemporaryFile の別名です。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1e84.
     ‘tempfile.mkstemp’ を送出します。

     バージョン 3.5 で変更: 利用可能であれば *note os.O_TMPFILE: 1322. フ
     ラグが使用されます。

     バージョン 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(): 1a2d.
     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(): 1a2d. 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: 19d1. whose
     ‘file’ attribute is the underlying true file object.  This
     file-like object can be used in a *note with: 215. 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(): 1a2d, 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: 19d1. is finalized.  Deletion is not always
     guaranteed in this case (see *note object.__del__(): 13ab.).  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: 215. 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(): 114f. 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():
               333.) must be closed before exiting the context manager,
               else the *note os.unlink(): 14b6. call on context manager
               exit will fail with a *note PermissionError: 10fd.

     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(): 14b6. call on exit of the context manager will
     fail with a *note PermissionError: 10fd.  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 監査イベント: 1e84.
     ‘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(): 19d2. メソッドが呼ばれるまで、データがメモリにスプールさ
     れる点以外は *note TemporaryFile(): 1a2d. と正確に同じことを行いま
     す。 上記条件を満たすと内容はディスクに書き込まれ、操作は
     ‘TemporaryFile()’ と同様に進みます。

      -- メソッド: rollover ()

          この関数が返すファイルは、追加で1つのメソッド ‘rollover()’ を
          持っています。このメソッドが呼ばれると、(サイズに関係なく)メモ
          リからディスクへのロールオーバーが実行されます。

     返されたオブジェクトはファイル様オブジェクトで、その ‘_file’ 属性は
     (バイナリかテキスト 'mode' が指定されたかどうかに依存して) *note
     io.BytesIO: 1258. か *note io.TextIOWrapper: ba0. オブジェクト、あ
     るいは *note rollover(): 2f09. が呼ばれたかどうかに依存して本物のフ
     ァイルオブジェクトになります。 このファイル様オブジェクトは、通常の
     ファイルオブジェクトと同じように *note with: 215. 文中で使用するこ
     とが出来ます。

     バージョン 3.3 で変更: truncate メソッドが 'size' 引数を受け取るよ
     うになりました。

     バージョン 3.8 で変更: 'errors' 引数が追加されました。

     バージョン 3.11 で変更: Fully implements the *note
     io.BufferedIOBase: a88. and *note io.TextIOBase: a89. 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(): 735. と同じルールを使用して安全に一時
     ディレクトリを作成します。返されたオブジェクトは、*note
     コンテキストマネージャ: 47f. として使用することができます (*note
     使用例: 2f08. を参照)。コンテキストの完了や一時ディレクトリオブジェ
     クトを破壊すると、新規作成された一時ディレクトリとその中身はファイ
     ルシステムから削除されます。

      -- の属性: name

          ディレクトリ名は返されたオブジェクトの ‘name’ 属性から取得でき
          ます。返されたオブジェクトが *note コンテキストマネージャ:
          47f. として使用された場合、 ‘name’ は *note with: 215. 文内の
          ‘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: 10fd. 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 監査イベント: 1e84.
     ‘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(): 114f. の *note os.O_EXCL: 1a2e. フラグを正し
     く実装している限り、ファイルの作成で競合が起こることはありません。
     作成したユーザのユーザ ID からのみファイルを読み書き出来ます。 プラ
     ットフォームがファイルが実行可能かどうかを示す許可ビットを使用して
     いる場合、ファイルは誰からも実行不可です。

     このファイル記述子は *note 子プロセスに継承されません: 12ad.。

     *note TemporaryFile(): 1a2d. と違って、 *note mkstemp(): 2f07. のユ
     ーザは用済みになった時に一時ファイルを削除しなければなりません。

     'suffix' が ‘None’ でない場合、ファイル名はその接尾辞で終わります。
     そうでない場合、接尾辞はありません。 *note mkstemp(): 2f07. はファ
     イル名と接尾辞の間にドットを追加しません。 必要であれば 'suffix' の
     先頭につけてください。

     'prefix' が ‘None’ でない場合、ファイル名はその接頭辞で始まります。
     そうでない場合、デフォルトの接頭辞が使われます。 必要に応じ、デフォ
     ルトは *note gettempprefix(): 2f0c. または *note gettempprefixb():
     2f0d. の返り値です。

     'dir' が ‘None’ でない場合、ファイルはそのディレクトリ下に作成され
     ます。 ‘None’ の場合、デフォルトのディレクトリが使われます。デフォ
     ルトのディレクトリはプラットフォームに依存するリストから選ばれます
     が、アプリケーションのユーザは 'TMPDIR'、'TEMP'、または 'TMP' 環境
     変数を設定することでディレクトリの場所を管理することができます。そ
     のため、生成されるファイル名が、‘os.popen()’ で外部コマンドにクォー
     ティング無しで渡すことができるなどといった、扱いやすい性質を持つ保
     証はありません。

     'suffix'、'prefix'、'dir' のいずれかが ‘None’ でない場合、それらは
     同じ型でなければなりません。 bytes の場合、返された名前は str でな
     はく bytes です。 他の挙動はデフォルトで返り値を bytes に強制的にし
     たい場合は ‘suffix=b''’ を渡してください。

     'text' に真を指定した場合は、ファイルはテキストモードで開かれます。
     そうでない場合(デフォルト)は、ファイルはバイナリモードで開かれます
     。

     *note mkstemp(): 2f07. は開かれたファイルを扱うための OS レベルのハ
     ンドル (*note os.open(): 114f. が返すものと同じ) とファイルの絶対パ
     ス名が順番に並んだタプルを返します。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1e84.
     ‘tempfile.mkstemp’ を送出します。

     バージョン 3.5 で変更: 'suffix'、'prefix'、'dir' は bytes の返り値
     を得るために bytes で渡すことが出来ます。 それ以前は str のみ許され
     ていました。 適切なデフォルト値を使用するよう、'suffix' と 'prefix'
     は ‘None’ を受け入れ、デフォルトにするようになりました。

     バージョン 3.6 で変更: 'dir' パラメタが *note path-like object:
     7a5. を受け付けるようになりました。

 -- の関数: tempfile.mkdtemp (suffix=None, prefix=None, dir=None)

     可能な限り安全な方法で一時ディレクトリを作成します。 ディレクトリの
     生成で競合は発生しません。 ディレクトリを作成したユーザ ID だけが、
     このディレクトリに対して内容を読み出したり、書き込んだり、検索した
     りすることができます。

     *note mkdtemp(): 735. のユーザは用済みになった時に一時ディレクトリ
     とその中身を削除しなければなりません。

     'prefix', 'suffix', 'dir' 引数は *note mkstemp(): 2f07. 関数のもの
     と同じです。

     *note mkdtemp(): 735. は新たに生成されたディレクトリの絶対パス名を
     返します。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1e84.
     ‘tempfile.mkdtemp’ を送出します。

     バージョン 3.5 で変更: 'suffix'、'prefix'、'dir' は bytes の返り値
     を得るために bytes で渡すことが出来ます。 それ以前は str のみ許され
     ていました。 適切なデフォルト値を使用するよう、'suffix' と 'prefix'
     は ‘None’ を受け入れ、デフォルトにするようになりました。

     バージョン 3.6 で変更: 'dir' パラメタが *note path-like object:
     7a5. を受け付けるようになりました。

     バージョン 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: 1ea7. の
     記述を参照してください。

     バージョン 3.10 で変更: Always returns a str.  Previously it would
     return any *note tempdir: 1ea7. value regardless of type so long as
     it was not ‘None’.

 -- の関数: tempfile.gettempdirb ()

     *note gettempdir(): 1ea8. と同じですが返り値は bytesです。

     Added in version 3.5.

 -- の関数: tempfile.gettempprefix ()

     一時ファイルを生成する際に使われるファイル名の接頭辞を返します。 こ
     れにはディレクトリ部は含まれません。

 -- の関数: tempfile.gettempprefixb ()

     *note gettempprefix(): 2f0c. と同じですが返り値は 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(): 1ea8.  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: 7a5.

     ‘tempdir’ が (デフォルトの) ‘None’ の場合、 *note gettempprefix():
     2f0c. を除く上記のいずれかの関数を呼び出す際は常に *note
     gettempdir(): 1ea8. で述べられているアルゴリズムによって初期化され
     ます。

          注釈: Beware that if you set ‘tempdir’ to a bytes value, there
          is a nasty side effect: The global default return type of
          *note mkstemp(): 2f07. and *note mkdtemp(): 735. 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/main/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(): 1e46. 関数で
ファイル名を作り、その名前を使ってファイルを作成するというものでした。 残
念ながらこの方法は安全ではありません。 なぜなら、‘mktemp()’ の呼び出しと
最初のプロセスが続いてファイル作成を試みる間に、異なるプロセスがその名前
でファイルを同時に作成するかもしれないからです。 解決策は二つのステップ
を同時に行い、ファイルをすぐに作成するというものです。 この方法は *note
mkstemp(): 2f07. や上述している他の関数で使用されています。

 -- の関数: tempfile.mktemp (suffix='', prefix='tmp', dir=None)

     バージョン 2.3 で非推奨: 代わりに *note mkstemp(): 2f07. を使って下
     さい。

     呼び出し時には存在しなかった、ファイルの絶対パス名を返します。
     'prefix'、'suffix'、'dir' 引数は *note mkstemp(): 2f07. のものと似
     ていますが、bytes のファイル名、‘suffix=None’、そして ‘prefix=None’
     がサポートされていない点で異なります。

          警告: この関数を使うとプログラムのセキュリティホールになる可能
          性があります。この関数がファイル名を返した後、あなたがそのファ
          イル名を使って次に何かをしようとする段階に至る前に、誰か他の人
          間があなたを出し抜くことができてしまいます。 *note mktemp():
          1e46. の利用は、 *note NamedTemporaryFile(): 8db. に
          ‘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(): e27. and *note fnmatch.fnmatch():
1e6a. 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(): 1e6a. or *note
pathlib.Path.glob(): 73f.  For tilde and shell variable expansion, use
*note os.path.expanduser(): ddc. and *note os.path.expandvars(): 1792.

リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、
‘'[?]'’ は文字 ‘'?'’ にマッチします。

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:
     7a5. 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
     ディレクトリ記述子への相対パス: 14ab. をサポートしています。

     'recursive' が真の場合、パターン "‘**’" はあらゆるファイルや0個以上
     のディレクトリ、サブディレクトリおよびディレクトリへのシンボリック
     リンクにマッチします。パターンの末尾が *note os.sep: a5f. または
     *note os.altsep: a60. の場合、ファイルは一致しません。

     'include_hidden' が真の場合、パターン "‘**’" は隠しディレクトリにマ
     ッチします。

     引数 ‘pathname’, ‘recursive’ を指定して *note 監査イベント: 1e84.
     ‘glob.glob’ を送出します。

     引数 ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’ を指定して *note
     監査イベント: 1e84. ‘glob.glob/2’ を送出します。

          注釈: パターン "‘**’" を大きなディレクトリツリーで使用するとと
          てつもなく時間がかかるかもしれません。

          注釈: 'pathname' が複数の "‘**’" パターンを含み、かつ
          'recursive' が真の場合、この関数は同じパスを重複して返す可能性
          があります。

          注釈: Any *note OSError: 543. exceptions raised from scanning
          the filesystem are suppressed.  This includes *note
          PermissionError: 10fd. 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(): 67. と同じ値を順に
     生成する *note イテレーター: 6d4. を返します。

     引数 ‘pathname’, ‘recursive’ を指定して *note 監査イベント: 1e84.
     ‘glob.glob’ を送出します。

     引数 ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’ を指定して *note
     監査イベント: 1e84. ‘glob.glob/2’ を送出します。

          注釈: 'pathname' が複数の "‘**’" パターンを含み、かつ
          'recursive' が真の場合、この関数は同じパスを重複して返す可能性
          があります。

          注釈: Any *note OSError: 543. exceptions raised from scanning
          the filesystem are suppressed.  This includes *note
          PermissionError: 10fd. 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.prefixmatch(): 256.  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.prefixmatch('foo/bar/baz.txt')
          <re.Match object; span=(0, 15), match='foo/bar/baz.txt'>

     *note fnmatch.translate(): 1a99. と違って、この関数ではパスの要素を
     区切るセパレータとセグメントには意味があります。デフォルトでは、ワ
     イルドカードはパスのセパレータにはマッチしません。また ‘*’ パターン
     のセグメントは厳密に単一のパスのセグメントにマッチします。

     'recursive' が真の場合、パターンセグメント "‘**’" は任意の数のパス
     セグメントにマッチします。

     'include_hidden' が真の場合、ワイルドカードはドット (‘.’) で始まる
     パスセグメントにもマッチします。

     パスの要素を区切るセパレータのシーケンスを 'seps' 引数に渡すことが
     できます。渡さない場合は *note os.sep: a5f. と (もしあれば) *note
     altsep: a60. が使われます。

     参考
     ....

     *note pathlib.PurePath.full_match(): 73d. と *note
     pathlib.Path.glob(): 73f. の2つのメソッドは、それぞれパターンマッチ
     と glob 相当の操作を実装するためにこの関数を呼んでいます。

     Added in version 3.13.

* Menu:

* 使用例: 使用例<9>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 67. は以下の結果を返します。パスにおける先頭の要素がどのように保
持されるかに注意してください:

     >>> 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: 5f. モジュールは、シェル形式の (パスではなく) ファイル名
の展開機能を提供します。

参考
....

*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: c1. モジュールでドキュメント化されている) 正規表現とは
'異なります' 。シェル形式のワイルドカードで使われる特殊文字は、次のとお
りです。

Pattern          意味
                 
----------------------------------------------------------
                 
‘*’              すべてにマッチします
                 
                 
‘?’              任意の一文字にマッチします
                 
                 
‘[seq]’          'seq' にある任意の文字にマッチします
                 
                 
‘[!seq]’         'seq' にない任意の文字にマッチします
                 

リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、
‘'[?]'’ は文字 ‘'?'’ にマッチします。

ファイル名の区切り文字 (Unixでは ‘'/'’) はこのモジュールに固有なものでは
'ない' ことに注意してください。パス名展開については、 *note glob: 67. モ
ジュールを参照してください (‘glob’ はパス名の部分にマッチさせるのに
*note filter(): 1e6c. を使っています)。同様に、ピリオドで始まるファイル
名はこのモジュールに固有ではなくて、 ‘*’ と ‘?’ のパターンでマッチします
。

Unless stated otherwise, "filename string" and "pattern string" either
refer to *note str: 1ea. or ‘ISO-8859-1’ encoded *note bytes: 1d2.
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(): db7. with a 'maxsize' of
32768 is used to cache the (typed) compiled regex patterns in the
following functions: *note fnmatch(): 5f, *note fnmatchcase(): 1e6b,
*note filter(): 1e6c, *note filterfalse(): 4a8.

 -- の関数: fnmatch.fnmatch (name, pat)

     ファイルの文字列 'name' がパターン文字列 'pat' にマッチするかテスト
     して、 ‘True’ または ‘False’ のいずれかを返します。どちらの引数とも
     *note os.path.normcase(): 2e87. を使って、大文字、小文字が正規化さ
     れます。オペレーティングシステムが標準でどうなっているかに関係なく
     、大文字、小文字を区別して比較する場合には、 *note fnmatchcase():
     1e6b. が使用できます。

     次の例では、カレントディレクトリにある、拡張子が ‘.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(): 2e87. は適用しません。

 -- の関数: fnmatch.filter (names, pat)

     Construct a list from those elements of the *note iterable: 149a.
     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: 149a.
     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.prefixmatch(): 256.  The pattern
     is expected to be a *note str: 1ea.

     例:

          >>> import fnmatch, re
          >>>
          >>> regex = fnmatch.translate('*.txt')
          >>> regex
          '(?s:.*\\.txt)\\z'
          >>> reobj = re.compile(regex)
          >>> reobj.prefixmatch('foobar.txt')
          <re.Match object; span=(0, 10), match='foobar.txt'>

参考
....

*note glob: 67. モジュール

     Unix シェル形式のパス展開。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 107. module to retrieve source lines for inclusion in
the formatted traceback.

*note tokenize.open(): 2f1b. 関数は、ファイルを開くために使用されます。
この関数は、 *note tokenize.detect_encoding(): 19ee. を使用してファイル
のエンコーディングを取得します。エンコーディングトークンが存在しない場合
、デフォルトの 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(): 4d4. を使って
     読み込んだファイルの行が必要でなくなったら、この関数を使ってくださ
     い。

 -- の関数: linecache.checkcache (filename=None)

     キャッシュが有効かどうかを確認します。キャッシュしたファイルがディ
     スク上で変更された可能性があり、更新後のバージョンが必要な場合にこ
     の関数を使用します。 'filename' が与えられない場合、全てのキャッシ
     ュエントリを確認します。

 -- の関数: linecache.lazycache (filename, module_globals)

     後々の呼び出しで 'module_globals' が ‘None’ となっていても、ファイ
     ルの形式でないモジュールの行を後から *note getline(): 4d4. で取得す
     るのに十分な詳細を把握しておきます。この関数により、モジュールの
     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/main/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(): e22, *note
     shutil.copy2(): e23.) でも、ファイルのメタデータの全てをコピーする
     ことはできません。

     POSIXプラットフォームでは、これはACLやファイルのオーナー、グループ
     が失われることを意味しています。 Mac OSでは、リソースフォーク
     (resource fork)やその他のメタデータが利用されません。これは、リソー
     スが失われ、ファイルタイプや生成者コード(creator code)が正しくなく
     なることを意味しています。 Windowsでは、ファイルオーナー、ACL、代替
     データストリームがコピーされません。

* Menu:

* ディレクトリとファイルの操作::
* アーカイブ化操作::
* 出力ターミナルのサイズの取得::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 1a1a. or *note close(): 711. 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: 7a5. または文字列でパス名
     を指定します。

     'dst' は完全な対象ファイル名でなければなりません。対象としてディレ
     クトリ名を指定したい場合は *note copy(): e22. を参照してください。
     'src' と 'dst' が同じファイルだった場合、 *note SameFileError:
     134c. を送出します。

     'dst' は書き込み可能でなければなりません。そうでない場合、 *note
     OSError: 543. 例外を送出します。 'dst' がすでに存在する場合、そのフ
     ァイルは置き換えられます。キャラクタデバイスやブロックデバイスなど
     の特殊なファイルとパイプをこの関数でコピーすることはできません。

     'follow_symlinks' が偽で 'src' がシンボリックリンクの場合、 'src' の
     リンク先をコピーする代わりに新しいシンボリックリンクを作成します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1e84.
     ‘shutil.copyfile’ を送出します。

     バージョン 3.3 で変更: 以前は *note OSError: 543. の代わりに *note
     IOError: 1409. が送出されていました。 'follow_symlinks' 引数が追加
     されました。 'dst' を返すようになりました。

     バージョン 3.4 で変更: *note Error: 134b. の代わりに *note
     SameFileError: 134c. を送出します。後者は前者のサブクラスなのでこの
     変更は後方互換です。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: e26. を
     参照してください。

 -- 例外: shutil.SpecialFileError

     This exception is raised when *note copyfile(): e21. or *note
     copytree(): df1. attempt to copy a named pipe.

     Added in version 2.7.

 -- 例外: shutil.SameFileError

     *note copyfile(): e21. のコピー元と先が同じファイルの場合送出されま
     す。

     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(): 1c4b. は (リンク先では
     なく) 'dst' 自体のモードを変更します。この機能は全てのプラットフォ
     ームで使えるわけではありません。詳しくは *note copystat(): 14ef. を
     参照してください。シンボリックリンクの変更をしようとした時、
     ‘copymode()’ がローカルのプラットフォームでシンボリックリンクを変更
     できない場合は何もしません。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1e84.
     ‘shutil.copymode’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。

 -- の関数: shutil.copystat (src, dst, *, follow_symlinks=True)

     パーミッション、最終アクセス時間、最終変更時間、その他のフラグを
     'src' から 'dst' にコピーします。 Linux では、 *note copystat():
     14ef. は可能なら "拡張属性" もコピーします。ファイルの内容、オーナ
     ー、グループには影響しません。 'src' と 'dst' は *note path-like
     object: 7a5. または文字列でファイルのパス名を指定します。

     'follow_symlinks' が偽の場合、 'src' と 'dst' の両方がシンボリック
     リンクであれば、 *note copystat(): 14ef. はリンク先ではなくてシンボ
     リックリンク自体を操作します。 'src' からシンボリックリンクの情報を
     読み込み、 'dst' のシンボリックリンクにその情報を書き込みます。

          注釈: すべてのプラットフォームでシンボリックリンクの検査と変更
          ができるわけではありません。 Python はその機能が利用かどうかを
          調べる方法を用意しています。

             * ‘os.chmod in os.supports_follow_symlinks’ が ‘True’ の場
               合 *note copystat(): 14ef. はシンボリックリンクのパーミッ
               ションを変更できます。

             * ‘os.utime in os.supports_follow_symlinks’ が ‘True’ の場
               合 *note copystat(): 14ef. はシンボリックリンクの最終アク
               セス時間と最終変更時間を変更できます。

             * ‘os.chflags in os.supports_follow_symlinks’ が ‘True’ の
               場合 *note copystat(): 14ef. はシンボリックリンクのフラグ
               を変更できます。 (‘os.chflags’ がないプラットフォームもあ
               ります。)

          機能の幾つか、もしくは全てが利用できないプラットフォームでシン
          ボリックリンクを変更しようとした場合、 *note copystat(): 14ef.
          は可能な限り全てをコピーします。‘copystat()’ が失敗を返すこと
          はありません。

          より詳しい情報は *note os.supports_follow_symlinks: 14b9. を参
          照して下さい。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1e84.
     ‘shutil.copystat’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数と Linux の拡張属性が
     サポートされました。

 -- の関数: shutil.copy (src, dst, *, follow_symlinks=True)

     ファイル 'src' をファイルまたはディレクトリ 'dst' にコピーします。
     'src' と 'dst' は両方共 *note path-like object: 7a5. または文字列で
     なければなりません。 'dst' がディレクトリを指定している場合、ファイ
     ルは 'dst' の中に、 'src' のベースファイル名を使ってコピーされます
     。'dst' が既に存在するファイルを指定している場合、それは置き換えら
     れます。新しく作成したファイルのパスを返します。

     'follow_symlinks' が偽で、 'src' がシンボリックリンクの場合、 'dst'
     はシンボリックリンクとして作成されます。 'follow_symlinks' が真で
     'src' がシンボリックリンクの場合、 'dst' には 'src' のリンク先のフ
     ァイルがコピーされます。

     *note copy(): e22. はファイルのデータとパーミッションをコピーします
     。 (*note os.chmod(): 732. を参照) その他の、ファイルの作成時間や変
     更時間などのメタデータはコピーしません。 コピー元のファイルのメタデ
     ータを保存したい場合は、 ‘copy2()’ を利用してください。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1e84.
     ‘shutil.copyfile’ を送出します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1e84.
     ‘shutil.copymode’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。新し
     く作成されたファイルのパスを返すようになりました。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: e26. を
     参照してください。

 -- の関数: shutil.copy2 (src, dst, *, follow_symlinks=True)

     *note copy2(): e23. はファイルのメタデータを保持しようとすることを
     除けば *note copy(): e22. と等価です。

     'follow_symlinks' が偽でかつ 'src' がシンボリックリンクの場合、
     *note copy2(): e23. は 'src' シンボリックリンク全てのメタデータを新
     たに作成される 'dst' シンボリックリンクにコピーしようとします。しか
     し、この機能は全てのプラットフォームで利用可能なわけではありません
     。この機能の全部または一部が利用可能でないプラットフォームにおいて
     は、 ‘copy2()’ は可能な限りのメタデータを保存しようとしますが、一方
     で ‘copy2()’　はメタデータを保存できないことを理由とする例外を送出
     しません。

     *note copy2(): e23. はファイルのメタデータをコピーするために *note
     copystat(): 14ef. を利用します。シンボリックリンクのメタデータを変
     更するためのプラットフォームサポートについては ‘copystat()’ を参照
     して下さい。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1e84.
     ‘shutil.copyfile’ を送出します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1e84.
     ‘shutil.copystat’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。 拡
     張ファイルシステム属性もコピーしようと試みます (現在は Linux のみ
     )。新しく作成されたファイルへのパスを返すようになりました。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: e26. を
     参照してください。

 -- の関数: shutil.ignore_patterns (*patterns)

     このファクトリ関数は、 *note copytree(): df1. 関数の '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(): 14ef. でコピーされます。それぞれのファイルは
     *note copy2(): e23. でコピーされます。

     'symlinks' が真の場合、ソースツリー内のシンボリックリンクは新しいツ
     リーでもシンボリックになり、元のシンボリックリンクのメタデータはプ
     ラットフォームが許す限りコピーされます。偽の場合や省略された場合、
     リンク先のファイルの内容とメタデータが新しいツリーにコピーされます
     。

     'symlinks' が偽の場合、リンク先のファイルが存在しなければ、コピー処
     理終了時に送出される *note Error: 134b. 例外のエラーリストに例外が
     追加されます。オプションの 'ignore_dangling_symlinks' フラグを真に
     設定してこのエラーを送出させないこともできます。このオプションは
     *note os.symlink(): 14b5. をサポートしていないプラットフォーム上で
     は効果がないことに注意してください。

     'ignore' は *note copytree(): df1. が走査しているディレクトリと
     *note os.listdir(): 14bb. が返すその内容のリストを引数として受け取
     ることのできる呼び出し可能オブジェクトでなければなりません。
     ‘copytree()’ は再帰的に呼び出されるので、 'ignore' はコピーされる各
     ディレクトリ毎に呼び出されます。 'ignore' の戻り値はカレントディレ
     クトリに相対的なディレクトリ名およびファイル名のシーケンス（すなわ
     ち第二引数の項目のサブセット）でなければなりません。それらの名前は
     コピー中に無視されます。 *note ignore_patterns(): 2f22. を用いて
     glob 形式のパターンによって無視する呼び出し可能オブジェクトを作成す
     ることが出来ます。

     例外が発生した場合、理由のリストとともに *note Error: 134b. を送出
     します。

     'copy_function' は各ファイルをコピーするために利用される呼び出し可
     能オブジェクトでなければなりません。'copy_function' はコピー元のパ
     スとコピー先のパスを引数に呼び出されます。デフォルトでは *note
     copy2(): e23. が利用されますが、同じ特徴を持つ関数 (*note
     shutil.copy(): e22. など) ならどれでも利用可能です。

     If 'dirs_exist_ok' is false (the default) and 'dst' already exists,
     a *note FileExistsError: 13cd. 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 監査イベント: 1e84.
     ‘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 プラットフォーム依存の効率的なコピー操作: e26. を
     参照してください。

     バージョン 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 ディレクトリ記述子への相対パス: 14ab. をサポートし
     ています。

          注釈: 必要な fd ベースの関数をサポートしているプラットフォーム
          では、 シンボリックリンク攻撃に耐性のあるバージョンの *note
          rmtree(): 33d. がデフォルトで利用されます。それ以外のプラット
          フォームでは、 ‘rmtree()’ の実装はシンボリックリンク攻撃の影響
          を受けます。適当なタイミングと環境で攻撃者はファイルシステム上
          のシンボリックリンクを操作して、それ以外の方法ではアクセス不可
          能なファイルを削除することが出来ます。アプリケーションは、どち
          らのバージョンの ‘rmtree()’ が利用されているかを知るために関数
          のデータ属性 *note rmtree.avoids_symlink_attacks: 2f23. を利用
          することができます。

     '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(): a7f.

     参考
     ....

     *note rmtree の例: 2f24. for an example of handling the removal of
     a directory tree that contains read-only files.

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘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: 24f. exceptions for all but the top-level path.
     Exceptions other than *note OSError: 543. and subclasses of
     ‘OSError’ are now always propagated to the caller.

      -- の属性: rmtree.avoids_symlink_attacks

          プラットフォームと実装がシンボリックリンク攻撃に耐性のあるバー
          ジョンの *note rmtree(): 33d. を提供しているかどうかを示します
          。現在のところ、この属性は 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(): 14b2. semantics.

     If the destination is on the current filesystem, then *note
     os.rename(): 14b2. is used.  Otherwise, 'src' is copied to the
     destination using 'copy_function' and then removed.  In case of
     symlinks, a new symlink pointing to the target of 'src' will be
     created as the destination and 'src' will be removed.

     If 'copy_function' is given, it must be a callable that takes two
     arguments, 'src' and the destination, and will be used to copy
     'src' to the destination if *note os.rename(): 14b2. cannot be
     used.  If the source is a directory, *note copytree(): df1. is
     called, passing it the 'copy_function'.  The default
     'copy_function' is *note copy2(): e23.  Using *note copy(): e22. 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 監査イベント: 1e84.
     ‘shutil.move’ を送出します。

     バージョン 3.3 で変更: 異なるファイルシステムに対する明示的なシンボ
     リックリンク処理が追加されました。これにより GNU ‘mv’ の振る舞いに
     適応するようになります。 'dst' を返すようになりました。

     バージョン 3.5 で変更: キーワード引数 'copy_function' が追加されま
     した。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: e26. を
     参照してください。

     バージョン 3.9 で変更: 'src' と 'dst' が両方とも *note path-like
     object: 7a5. を受け付けるようになりました。

 -- の関数: shutil.disk_usage (path)

     指定されたパスについて、ディスクの利用状況を、名前付きタプル (*note
     named tuple: a42.) で返します。このタプルには '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: 234c.: Unix, Windows.

 -- の関数: shutil.chown (path, user=None, group=None, *, dir_fd=None,
          follow_symlinks=True)

     指定された 'path' のオーナー 'user' と/または 'group' を変更します
     。

     'user' はシステムのユーザー名か uid です。 'group' も同じです。少な
     くともどちらかの引数を指定する必要があります。

     内部で利用している *note os.chown(): 14af. も参照してください。

     引数 ‘path’, ‘user’, ‘group’ を指定して *note 監査イベント: 1e84.
     ‘shutil.chown’ を送出します。

     *note Availability: 234c.: 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(): 14ad. に渡すパーミッションマスクで、デ
     フォルトではファイルが存在して実行可能であることを確認します。

     'path' is a "‘PATH’ string" specifying the directories to look in,
     delimited by *note os.pathsep: 2341.  When no 'path' is specified,
     the ‘PATH’ environment variable is read from *note os.environ: 4ec,
     falling back to *note os.defpath: 1ff2. 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: 1d2. 型も使用できるようになりま
     した。 '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

     Subclass of *note OSError: 543. collecting exceptions raised during
     a multi-file operation.  For *note copytree(): df1, 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():
e21, *note copy(): e22, *note copy2(): e23, *note copytree(): df1, およ
び *note move(): e24.) はより効率的なファイルのコピーのためにプラットフ
ォーム特有の "高速なコピー" を行うことがあります (bpo-33671(1) を参照し
てください).  ここで "高速なコピー" とは、 "‘outfd.write(infd.read())’"
のようにPython が管理するユーザー空間のバッファを利用することを避け、コ
ピー操作がカーネル空間内で行われることを意味します。

macOS では fcopyfile(2) がファイルの内容（メタデータを除く）をコピーする
ために利用されます。

Linux では *note os.copy_file_range(): 1af4. または *note os.sendfile():
ed7. が利用されます。

Solaris では *note os.sendfile(): ed7. が利用されます。

On Windows *note shutil.copyfile(): e21. uses a bigger default buffer
size (1 MiB instead of 64 KiB) and a *note memoryview(): 1dd.-based
variant of *note shutil.copyfileobj(): e25. is used, which still reads
and writes in a loop.  *note shutil.copy2(): e23. uses the native
‘CopyFile2’ call on Windows, which is the most efficient method,
supports copy-on-write, and preserves metadata.

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(): e25. function internally.

バージョン 3.8 で変更.

バージョン 3.14 で変更: Solaris now uses *note os.sendfile(): ed7.

バージョン 3.14 で変更: Copy-on-write or server-side copy may be used
internally via *note os.copy_file_range(): 1af4. 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(): 2f22. ヘルパ関数を利用する例です:

     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: 13a. 、 *note tarfile: e7. モ
ジュールに依拠しています。

 -- の関数: shutil.make_archive (base_name, format[, root_dir[,
          base_dir[, verbose[, dry_run[, owner[, group[, logger]]]]]]])

     アーカイブファイル (zip や tar) を作成してその名前を返します。

     'base_name' is a string or *note path-like object: 7a5. specifying
     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:
     13c. 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: 8d. module is available), or "zstdtar"
     (if the *note compression.zstd: 23. module is available).

     'root_dir' is a string or *note path-like object: 7a5. specifying 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 a string or *note path-like object: 7a5. specifying a
     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 を使ったアーカイブ化の例: 2f2a. 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: f10. のインスタンスです。

     'verbose' 引数は使用されず、非推奨です。

     引数 ‘base_name’, ‘format’, ‘root_dir’, ‘base_dir’ を指定して *note
     監査イベント: 1e84. ‘shutil.make_archive’ を送出します。

          注釈: This function is not thread-safe when custom archivers
          registered with *note register_archive_format(): 2f2b. 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.

     バージョン 3.15 で変更: Accepts a *note path-like object: 7a5. for
     'base_name', 'root_dir' and 'base_dir'.

 -- の関数: shutil.get_archive_formats ()

     アーカイブ化をサポートしているフォーマットのリストを返します。返さ
     れるシーケンスのそれぞれの要素は、タプル ‘(name, description)’ です
     。

     By default ‘shutil’ provides these formats:

        - 'zip': ZIP ファイル (*note zlib: 13c. モジュールが利用可能な場
          合)。

        - 'tar': 非圧縮の tar ファイル。 POSIX.1-2001 pax 形式が使われま
          す。

        - 'gztar': gzip で圧縮された tar ファイル (*note zlib: 13c. モジ
          ュールが利用可能な場合)。

        - 'bztar': bzip2 で圧縮された tar ファイル (*note bz2: 14. モジ
          ュールが利用可能な場合)。

        - 'xztar': xz で圧縮された tar ファイル (*note lzma: 8d. モジュ
          ールが利用可能な場合)。

        - 'zstdtar': Zstandard で圧縮された tar ファイル (*note
          compression.zstd: 23. モジュールが利用可能な場合)。

     *note register_archive_format(): 2f2b. を使って、新しいフォーマット
     を登録したり、既存のフォーマットに独自のアーカイバを提供したりでき
     ます。

 -- の関数: shutil.register_archive_format (name, function[,
          extra_args[, description]])

     アーカイバをフォーマット 'name' に登録します。

     'function' はアーカイブのアンパックに使用される呼び出し可能オブジェ
     クトです。'funciton' は作成するファイルの 'base_name'、続いてアーカ
     イブを開始する元の 'base_dir' (デフォルトは *note os.curdir: 2e89.)
     を受け取ります。さらなる引数は、次のキーワード引数として渡されます:
     'owner', 'group', 'dry_run' ならびに 'logger' (*note
     make_archive(): 8c8. に渡されます)。

     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(): 8c8. is not thread-safe.

     'extra_args' は、与えられた場合、 ‘(name, value)’ の対のシーケンス
     で、アーカイバ呼び出し可能オブジェクトが使われるときに追加のキーワ
     ード引数として使われます。

     'description' は、アーカイバのリストを返す *note
     get_archive_formats(): 2f2c. で使われます。デフォルトでは空の文字列
     です。

     バージョン 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(): 2f2e. で登録したその他のフォーマットのど
     れかです。 指定されなかった場合、 *note unpack_archive(): 887. はア
     ーカイブファイル名の拡張子に対して登録されたアンパッカーを利用しま
     す。 アンパッカーが見つからなかった場合、 *note ValueError: 15a. を
     発生させます。

     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: 888. for details.)

     引数 ‘filename’, ‘extract_dir’, ‘format’ を指定して *note
     監査イベント: 1e84. ‘shutil.unpack_archive’ を送出します。

          警告: Never extract archives from untrusted sources without
          prior inspection.  It is possible that files are created
          outside of the path specified in the 'extract_dir' argument,
          e.g.  members that have absolute filenames starting with "/"
          or filenames with two dots "..".

          Since Python 3.14, the defaults for both built-in formats (zip
          and tar files) will prevent the most dangerous of such
          security issues, but will not prevent 'all' unintended
          behavior.  Read the *note Hints for further verification:
          2f2f. section for tar-specific details.

     バージョン 3.7 で変更: 'filename' と 'extract_dir' が *note
     path-like object: 7a5. を受け付けるようになりました。

     バージョン 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(): 887.;

        - additional keyword arguments, specified by 'extra_args' as a
          sequence of ‘(name, value)’ tuples.

     フォーマットの説明として 'description' を指定することができます。こ
     れは *note get_unpack_formats(): 2f30. 関数によって返されます。

 -- の関数: 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: 13c. モジ
          ュールが利用可能な場合)。

        - 'bztar': bzip2 で圧縮された tar ファイル (*note bz2: 14. モジ
          ュールが利用可能な場合)。

        - 'xztar': xz で圧縮された tar ファイル (*note lzma: 8d. モジュ
          ールが利用可能な場合)。

        - 'zstdtar': Zstandard で圧縮された tar ファイル (*note
          compression.zstd: 23. モジュールが利用可能な場合)。

     *note register_unpack_format(): 2f2e. を使って新しいフォーマットや
     既存のフォーマットに対する別のアンパッカーを登録することができます
     。

* 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 上記の例: 2f33. と同じく *note make_archive(): 8c8. の
使い方を示しますが、ここでは特に '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__: 2f36. に接続されているターミナルに *note
     os.get_terminal_size(): 14c3. を呼び出して問い合わせます。

     システムが対応していない場合やターミナルに接続していないなどの理由
     でターミナルサイズの問い合わせに失敗した場合、 ‘fallback’ 引数に与
     えられた値を利用します。 ‘fallback’ のデフォルト値は ‘(80, 24)’ で
     、これは多くのターミナルエミュレーターが利用しているデフォルトサイ
     ズです。

     戻り値は *note os.terminal_size: 2f37. 型の名前付きタプルです。

     参考: 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(): 14c3. returns zeroes.

参考
....

*note os: a5. モジュール

     オペレーティングシステムのインターフェース、Python の *note
     ファイルオブジェクト: 1581. より低レベルでのファイル操作を含みます
     。

*note io: 82. モジュール

     Python 組み込みの I/O ライブラリで、抽象クラスとファイル I/O のよう
     ないくつかの具象クラスを含みます。

*note open(): 333. 組み込み関数

     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: 90.
は多くの 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: 227b. or *note bytes-like object: 43d.) 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: 6d. に
     よる鍵付きハッシュ化を検討してください。

     信頼できないデータを処理する場合 *note json: 85. のようなより安全な
     直列化形式の方が適切でしょう。 *note json との比較: 2f3e. を参照し
     てください。

* Menu:

* 他の Python モジュールとの関係::
* データストリームの形式::
* モジュールインターフェース::
* pickle 化、非 pickle 化できるもの::
* クラスインスタンスの pickle 化::
* 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ::
* アウトオブバウンドバッファ::
* グローバル変数を制限する::
* 性能: 性能<2>.
* 使用例: 使用例<11>.
* コマンドライン・インターフェース::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/pickle.py

   (2) *note marshal: 90. モジュールと間違えないように注意してください。


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:
90, 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: 90. in several
significant ways:

   * *note marshal: 90. 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: 90. 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: 2f42. によって対応できます)。

   * pickleとは異なり、信頼できないJSONを復元するだけでは、任意のコード
     を実行できる脆弱性は発生しません。

参考
....

*note json: 85. モジュール: 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: 2f44. 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 新方式のクラス: 2f45. のより効率的な pickle 化を提供し
     ました。プロトコル 2 による改良に関する情報は PEP 307(1) を参照して
     ください。

   * プロトコルバージョン 3 は Python 3 で追加されました。 *note bytes:
     1d2. オブジェクトを明示的にサポートしており、 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: cb. 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(): 185c. 関数を呼ぶだけで
す。同様に、データストリームを復元するには、*note loads(): 10cf. 関数を
呼びます。しかし、直列化および復元に対してより多くのコントロールを行いた
い場合、それぞれ *note Pickler: de6. または *note Unpickler: 1999. オブ
ジェクトを作成することができます。

The ‘pickle’ module provides the following constants:

 -- データ: pickle.HIGHEST_PROTOCOL

     利用可能なうち最も高い *note プロトコルバージョン: 50a. (整数)。こ
     の値は 'protocol' 値として関数 *note dump(): 2f47. および *note
     dumps(): 185c. と、*note Pickler: de6. コンストラクターに渡すことが
     できます。

 -- データ: pickle.DEFAULT_PROTOCOL

     An integer, the default *note protocol version: 50a. used for
     pickling.  May be less than *note HIGHEST_PROTOCOL: 185d.
     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
     ファイルオブジェクト: 1581. 'file' に書き込みます。‘Pickler(file,
     protocol).dump(obj)’ と等価です。

     引数 'file', 'protocol', 'fix_imports' および 'buffer_callback' は
     *note Pickler: de6. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

 -- の関数: pickle.dumps (obj, protocol=None, *, fix_imports=True,
          buffer_callback=None)

     ファイルに書く代わりに、*note bytes: 1d2. オブジェクトとしてオブジ
     ェクト 'obj' の pickle 表現を返します。

     引数 'protocol', 'fix_imports' および 'buffer_callback' は *note
     Pickler: de6. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

 -- の関数: pickle.load (file, *, fix_imports=True, encoding='ASCII',
          errors='strict', buffers=None)

     あるオブジェクトの pickle 化表現を、オープンしている *note
     ファイルオブジェクト: 1581. 'file' から読み込み、その中で指定されて
     いるオブジェクト階層に再構成して返します。これは
     ‘Unpickler(file).load()’ と等価です。

     pickle のプロトコルバージョンは自動的に検出されます。したがって
     protocol 引数は必要ありません。pickle 化オブジェクト表現より後のバ
     イト列は無視されます。

     引数 'file', 'fix_imports', 'encoding', 'errors', 'strict' および
     'buffers' は *note Unpickler: 1999. のコンストラクタと同じ意味にな
     ります。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

 -- の関数: pickle.loads (data, /, *, fix_imports=True,
          encoding='ASCII', errors='strict', buffers=None)

     オブジェクトのピックル化表現 'data' から再構成されたオブジェクト階
     層を返します。 'data' は バイトライクオブジェクト (*note bytes-like
     object: 43d.) でなければなりません。

     pickle のプロトコルバージョンは自動的に検出されます。したがって
     protocol 引数は必要ありません。pickle 化オブジェクト表現より後のバ
     イト列は無視されます。

     引数 'fix_imports', 'encoding', 'errors', 'strict' および 'buffers'
     は *note Unpickler: 1999. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

The ‘pickle’ module defines three exceptions:

 -- 例外: pickle.PickleError

     他の pickle 化例外の共通基底クラス。*note Exception: da2. を継承し
     ています。

 -- 例外: pickle.PicklingError

     *note Pickler: de6. が pickle 化不可能なオブジェクトに遭遇したとき
     に送出されるエラー。*note PickleError: 2f48. を継承しています。

     どんな種類のオブジェクトが pickle 化できるのか確認するには *note
     pickle 化、非 pickle 化できるもの: 2f49. を参照してください。

 -- 例外: pickle.UnpicklingError

     データ破損やセキュリティ違反のような、オブジェクトを非 pickle 化す
     るのに問題がある場合に送出されるエラー。*note PickleError: 2f48. を
     継承します。

     非 picke 化の最中に他の例外が送出されることもあるので注意してくださ
     い。これには AttributeError, EOFError, ImportError, IndexError が含
     まれます (ただし必ずしもこれらに限定されません)。

The ‘pickle’ module exports three classes, *note Pickler: de6, *note
Unpickler: 1999. and *note PickleBuffer: 1929.:

 -- クラス: pickle.Pickler (file, protocol=None, *, fix_imports=True,
          buffer_callback=None)

     pickle 化されたオブジェクトのデータストリームを書き込むためのバイナ
     リファイルを引数にとります。

     任意の引数 'protocol' は、整数で、pickle 化で使用するプロトコルを指
     定します; サポートされているプロトコルは 0 から *note
     HIGHEST_PROTOCOL: 185d. までになります。指定されない場合、*note
     DEFAULT_PROTOCOL: c0b. が使用されます。負数が与えられた場合、
     ‘HIGHEST_PROTOCOL’ が使用されます。

     引数 'file' は、1 バイトの引数一つを受け付ける write() メソッドを持
     たなければなりません。すなわち、'file' には、バイナリの書き込み用に
     オープンされたファイルオブジェクト、*note io.BytesIO: 1258. オブジ
     ェクト、このインターフェースに適合するその他のカスタムオブジェクト
     をとることができます。

     'fix_imports' が真であり、かつ、'protocol' が 3 未満の場合、pickle
     は新しい Python 3 の名前と Python 2 で使用されていた古いモジュール
     名との対応付けを試みるので、pickle データストリームは Python 2 でも
     読み込み可能です。

     'buffer_callback' が ‘None’ (デフォルト) の場合、バッファビューはス
     トリームの一部として*file* 中に直列化されます。

     'buffer_callback' が ‘None’ でない場合、バッファビューを引数として
     何度でも呼び出すことができる関数です。コールバック関数が偽値
     (‘None’ など) を返すと、与えられたバッファは *note
     アウトオブバウンド管理 (out-of-band): 2f4b. となります; そうでない
     場合はインバンドで、すなわち pickle ストリーム内で、直列化されます
     。

     'buffer_callback' が ‘None’ でなく、かつ 'protocol' が ‘None’ また
     は 5 より小さい場合はエラーとなります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

      -- メソッド: dump (obj)

          'obj' の pickle 化表現を、コンストラクターで与えられた、すでに
          オープンしているファイルオブジェクトに書き込みます。

      -- メソッド: persistent_id (obj)

          デフォルトでは何もしません。このメソッドはサブクラスがオーバー
          ライドできるように存在します。

          *note persistent_id(): 1b47. が ‘None’ を返す場合、通常通り
          'obj' が pickle 化されます。それ以外の値を返した場合、*note
          Pickler: de6. がその値を 'obj' のために永続的な ID として出力
          するようになります。この永続的な ID の意味は *note
          Unpickler.persistent_load(): 1b4e. によって定義されています。
          ‘persistent_id()’ によって返された値自身は永続的な ID を持つこ
          とができないことに注意してください。

          詳細および使用例については *note 外部オブジェクトの永続化:
          2f4c. を参照してください。

          バージョン 3.13 で変更: Add the default implementation of this
          method in the C implementation of ‘Pickler’.

      -- の属性: dispatch_table

          pickler オブジェクトのディスパッチテーブルは *note
          copyreg.pickle(): 2f4d. を使用して宣言できる種類の 'reduction
          functions' のレジストリです。これはキーがクラスでその値が減少
          関数のマッピング型オブジェクトです。減少関数は関連するクラスの
          引数を 1 個とり、*note __reduce__(): d9b. メソッドと同じインタ
          ーフェースでなければなりません。

          デフォルトでは、pickler オブジェクトは *note dispatch_table:
          14e3. 属性を持たず、代わりに *note copyreg: 2a. モジュールによ
          って管理されるグローバルなディスパッチテーブルを使用します。し
          かし、特定の pickler オブジェクトによる pickle 化をカスタマイ
          ズするために ‘dispatch_table’ 属性に dict-like オブジェクトを
          設定することができます。あるいは、*note Pickler: de6. のサブク
          ラスが ‘dispatch_table’ 属性を持てば、そのクラスのインスタンス
          に対するデフォルトのディスパッチテーブルとして使用されます。

          使用例については *note ディスパッチテーブル: 2f4e. を参照して
          ください。

          Added in version 3.3.

      -- メソッド: reducer_override (obj)

          *note Pickler: de6. のサブクラスで定義可能な特殊なリデューサ
          (reducer) です。このメソッドは *note dispatch_table: 14e3. 内
          のいかなるリデューサよりも優先されます。このメソッドは *note
          __reduce__(): d9b. メソッドのインターフェースと適合していなけ
          ればなりません。また、メソッドが *note NotImplemented: 447. を
          返すことにより、 ‘dispatch_table’ に登録されたリデューサにフォ
          ールバックして ‘obj’ を直列化することもできます。

          詳細な例については、 *note
          型、関数、その他のオブジェクトに対するリダクションのカスタマイズ:
          2f4f. を参照してください。

          Added in version 3.8.

      -- の属性: fast

          廃止予定です。真値が設定されれば高速モードを有効にします。高速
          モードは、メモの使用を無効にします。それにより余分な PUT 命令
          コードを生成しなくなるので pickle 化処理が高速化します。自己参
          照オブジェクトに対しては使用すべきではありません。さもなければ
          *note Pickler: de6. に無限再帰を起こさせるでしょう。

          よりコンパクトな pickle 化を必要とする場合は、*note
          pickletools.optimize(): 2f51. を使用してください。

      -- メソッド: 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: a88. のインターフェースと同
     様に、整数を引数にとる read() 、バッファを引数にとる readinto() 、
     引数を取らない readline() の3つのメソッドを持たなければなりません。
     したがって、 'file' はバイナリ読み込みモードでオープンされたディス
     ク上のファイル、 *note io.BytesIO: 1258. オブジェクト、または上記イ
     ンターフェース要件を満たす任意のカスタムオブジェクトのいずれかです
     。

     オプション引数 '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: 6ed,
     *note date: 494, *note time: 495. の各インスタンスを非 pickle 化す
     るためには ‘encoding='latin1'’ を使う必要があります。

     'buffers' が ‘None’ (デフォルト値) の場合、非直列化に必要な全てのデ
     ータは pickle ストリームに含まれている必要があります。これは *note
     Pickler: de6. がインスタンス化されたとき (または *note dump():
     2f47. や *note dumps(): 185c. が呼び出されたとき) に
     'buffer_callback' 引数に ‘None’ を指定したことに相当します。

     'buffers' が ‘None’ でない場合、各イテレーションで *note
     アウトオブバウンド (out-of-band): 2f4b. のバッファビューを参照する
     pickle ストリームを消費する、バッファ対応のイテラブルでなければなり
     ません。ここに指定するバッファは Pickler オブジェクトの
     'buffer_callback' に順番に渡されたものです。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

      -- メソッド: load ()

          コンストラクターで与えられたオープンしたファイルオブジェクトか
          らオブジェクトの pickle 化表現を読み込み、その中で指定されたオ
          ブジェクト階層に再構成して返します。オブジェクトの pickle 化表
          現より後のバイト列は無視されます。

      -- メソッド: persistent_load (pid)

          デフォルトで *note UnpicklingError: 2f4a. を送出します。

          もし定義されていれば、*note persistent_load(): 1b4e. は永続的
          な ID 'pid' によって指定されたオブジェクトを返す必要があります
          。永続的な ID が無効な場合、*note UnpicklingError: 2f4a. を送
          出しなければなりません。

          詳細および使用例については *note 外部オブジェクトの永続化:
          2f4c. を参照してください。

          バージョン 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: 1ea. オブジェクトです。その名前が示唆することに反し
          て *note find_class(): 19d5. は関数を探すためにも使われること
          に注意してください。

          サブクラスは、どんな型のオブジェクトを、どのようにロードするか
          (潜在的にはセキュリティリスクの減少) に関する制御を得るために
          これをオーバーライドすることができます。詳細に関しては *note
          グローバル変数を制限する: 2f54. を参照してください。

          引数 ‘modulet’, ‘name’ を指定して *note 監査イベント: 1e84.
          ‘pickle.find_class’ を送出します。

 -- クラス: pickle.PickleBuffer (buffer)

     pickle 可能なデータをあらわすバッファのラッパーです。 'buffer' はバ
     ッファライクなオブジェクト (*note bytes-like object: 43d.) や N 次
     元配列のような *note バッファ機能を提供する: 319. オブジェクトでな
     ければなりません。

     *note PickleBuffer: 1929. はそれ自身バッファ機能を提供します。した
     がってこのクラスのインスタンスを、バッファ機能を提供するオブジェク
     トを期待する *note memoryview: 1dd. など他の API に渡すことが可能で
     す。

     *note PickleBuffer: 1929. オブジェクトはプロトコル 5 以上でのみ直列
     化可能で、 *note アウトオブバウンド (out-of-band) の直列化: 2f4b. に
     対応しています。

     Added in version 3.8.

      -- メソッド: raw ()

          このバッファの背後にあるメモリ領域への *note memoryview: 1dd.
          を返します。戻り値のオブジェクトはフォーマット ‘B’ (符号なしバ
          イト) の C-連続な1次元のメモリビューです。バッファが C-連続で
          も Fortran-連続でもない場合 *note BufferError: 19b9. 例外が送
          出されます。

      -- メソッド: 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: 447.)

   * 整数、浮動小数点数、複素数

   * 文字列、バイト列、バイト配列

   * pickle 化可能なオブジェクトからなるタプル、リスト、集合および辞書

   * モジュールのトップレベルで定義された関数 (*note def: 1812. で定義さ
     れたもののみで *note lambda: 1657. で定義されたものは含まない)

   * モジュールのトップレベルで定義されているクラス

   * instances of such classes for which the result of calling *note
     __getstate__(): 9d8. is picklable (see section *note
     クラスインスタンスの pickle 化: 2f42. for details).

pickle 化できないオブジェクトを pickle 化しようとすると、*note
PicklingError: 1b79. 例外が送出されます。この例外が起きたとき、すでに元
のファイルには未知の長さのバイト列が書き込まれている場合があります。極端
に再帰的なデータ構造を pickle 化しようとした場合には再帰の深さ制限を越え
てしまうかもしれず、この場合には *note RecursionError: 1125. が送出され
ます。この制限は、*note sys.setrecursionlimit(): 8d8. で慎重に上げていく
ことは可能です。

関数 (組込みおよびユーザー定義) は、値ではなく、完全 *note 修飾名: 1f38.
で 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__(): d9c. メソッドによって適切な変換が行われる
ようにオブジェクトのバージョン番号を入れておくとよいかもしれません。

   ---------- Footnotes ----------

   (1) なぜ *note lambda: 1657. 関数を pickle 化できないかというと、すべ
ての ‘lambda’ 関数は同じ名前: ‘<lambda>’ を共有しているからです。

   (2) 送出される例外は *note ImportError: 1c8. や *note AttributeError:
1b4. になるはずですが、他の例外も起こりえます。


File: python.info,  Node: クラスインスタンスの pickle 化,  Next: 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ,  Prev: pickle 化、非 pickle 化できるもの,  Up: pickle --- Python オブジェクトの直列化

5.13.1.7 クラスインスタンスの pickle 化
.......................................

この節では、クラスインスタンスがどのように pickle 化または非 pickle 化さ
れるのかを定義したり、カスタマイズしたり、コントロールしたりするのに利用
可能な一般的機構について説明します。

ほとんどの場合、インスタンスを pickle 化できるようにするために追加のコー
ドは必要ありません。デフォルトで、pickle はインスタンスのクラスと属性を
内省によって検索します。クラスインスタンスが非 pickle 化される場合、通常
その *note __init__(): 306. メソッドは実行 'されません' 。デフォルトの振
る舞いは、最初に初期化されていないインスタンスを作成して、次に保存された
属性を復元します。次のコードはこの振る舞いの実装を示しています:

     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__(): 2f59. method can dictate the values passed to
     the *note __new__(): 987. 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__(): 987. メソッドがキーワード専用引数を求める
     場合はこのメソッドを実装すべきです。 そうしない場合、互換性のため
     *note __getnewargs__(): 1191. メソッドの実装を推奨します。

     バージョン 3.6 で変更: *note __getnewargs_ex__(): 2f59. がプロトコ
     ル 2 と 3 でも使われるようになりました。

 -- メソッド: object.__getnewargs__ ()

     このメソッドは *note __getnewargs_ex__(): 2f59. と同じような機能を
     提供しますが、位置引数のみをサポートします。このメソッドは引数のタ
     プル ‘args’ を返さなければならず、戻り値は非 pickle 化に際して
     *note __new__(): 987. メソッドに渡されます。

     *note __getnewargs_ex__(): 2f59. が定義されていると *note
     __getnewargs__(): 1191. は呼び出しません。

     バージョン 3.6 で変更: Python 3.6以前のプロトコル 2 と 3 では、
     *note __getnewargs_ex__(): 2f59. の代わりに *note __getnewargs__():
     1191. が呼び出されていました。

 -- メソッド: 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__: 1ca. and no
          *note __slots__: 18a3, the default state is ‘None’.

        * For a class that has an instance *note __dict__: 1ca. and no
          *note __slots__: 18a3, the default state is ‘self.__dict__’.

        * For a class that has an instance *note __dict__: 1ca. and
          *note __slots__: 18a3, 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__: 18a3. and no instance
          *note __dict__: 1ca, 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: e51. class.

 -- メソッド: object.__setstate__ (state)

     非 pickle 化に際して、クラスが *note __setstate__(): d9c. を定義し
     ている場合、それは非 pickle 化された状態とともに呼び出されます。そ
     の場合、状態オブジェクトが辞書でなければならないという要求はありま
     せん。そうでなければ、 pickle された状態は辞書で、その要素は新しい
     インスタンスの辞書に割り当てられます。

          注釈: If *note __reduce__(): d9b. returns a state with value
          ‘None’ at pickling, the ‘__setstate__()’ method will not be
          called upon unpickling.

*note __getstate__(): 9d8. および *note __setstate__(): d9c. メソッドの
使い方に関する詳細な情報については *note 状態を持つオブジェクトの扱い:
2f5a. 節を参照してください。

     注釈: 非 pickle 化に際しては、 *note __getattr__(): 8e8, *note
     __getattribute__(): f94, または *note __setattr__(): 258c. といった
     メソッドがインスタンスに対して呼ばれることがあります。これらのメソ
     ッドが何らかの内部的な不変条件が成り立つことに依存する場合、その型
     は *note __new__(): 987. メソッドを実装してそのような不変条件が成り
     立つようにすべきです。なぜならばインスタンスの非 pickle 化において
     は *note __init__(): 306. メソッドは呼ばれないからです。

これらから見るように、pickle は上記のメソッドを直接使用しません。実際に
は、これらのメソッドは *note __reduce__(): d9b. 特殊メソッドを実装するコ
ピープロトコルの一部です。コピープロトコルは、pickle 化とオブジェクトの
コピーに必要な、データを取得するための統一されたインターフェースを提供し
ます。 (1)

強力ですが、クラスに *note __reduce__(): d9b. メソッドを直接実装すること
はエラーを起こしやすくなります。この理由のため、クラスの設計者は可能なか
ぎり高レベルインターフェース (*note __getnewargs_ex__(): 2f59.、*note
__getstate__(): 9d8. および *note __setstate__(): d9c.) を使用するべきで
す。公開はしているものの、‘__reduce__()’ の使用は、あくまでオプションと
して、より効果的な pickle 化につながる場合、あるいはその両方の場合のみに
してください。

 -- メソッド: object.__reduce__ ()

     このインターフェースは現在、以下のように定義されています。 *note
     __reduce__(): d9b. メソッドは引数を取らず、文字列あるいは (こちらの
     方が好まれますが) タプルのいずれかを返すべきです (返されたオブジェ
     クトは、しばしば "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__(): d9c. メソッ
          ドに渡されるオブジェクトの状態。オブジェクトがそのようなメソッ
          ドを持たない場合、値は辞書でなければならず、それはオブジェクト
          の *note __dict__: 1ca. 属性に追加されます。

        * 任意で、連続した要素を yield する (シーケンスではなく) イテレ
          ーター。これらの要素は ‘obj.append(item)’ を使用して、あるいは
          バッチでは ‘obj.extend(list_of_items)’ を使用して、オブジェク
          トに追加されます。これは主としてリストのサブクラスに対して使用
          されますが、適切なシグネチャを持つ *note append(): 25ea. およ
          び *note extend(): 25ed. メソッドがあるかぎり、他のクラスで使
          用することもできます。 (‘append()’ または ‘extend()’ のどちら
          が使用されるかは、どの pickle プロトコルバージョンが使われるか
          に加えて追加されるアイテムの数にも依存します。したがって、両方
          をサポートする必要があります)

        * 任意で、連続する key-value ペアを yield する (シーケンスでなく
          ) イテレーター。これらの要素は ‘obj[key] = value’ を使用して、
          オブジェクトに格納されます。これは主として辞書のサブクラスに対
          して使用されますが、*note __setitem__(): 1685. を実装している
          かぎり他のクラスで使用することもできます。

        * 任意で、シグネチャが ‘(obj, state)’ である呼び出し可能オブジェ
          クト。このオブジェクトは、 ‘obj’ のスタティックな *note
          __setstate__(): d9c. メソッドの代わりに、ユーザーがオブジェク
          トの状態を更新する方法をプログラム的に制御することを許します。
          ‘None’ 以外の場合、この呼び出し可能オブジェクトは ‘obj’ の
          ‘__setstate__()’ メソッドに優先します。

          Added in version 3.8: 任意の6番目のタプル要素 ‘(obj, state)’ が
          追加されました。

 -- メソッド: object.__reduce_ex__ (protocol)

     別の方法として、*note __reduce_ex__(): 1b9d. メソッドを定義すること
     もできます。唯一の違いは、このメソッドは単一の整数引数、プロトコル
     バージョンを取る必要があるということです。もし定義された場合、
     pickle は *note __reduce__(): d9b. メソッドよりもこのメソッドを優先
     します。さらに、‘__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(): 1b47. and *note
persistent_load(): 1b4e. respectively.

外部の永続的 ID を持つ pickle オブジェクトの pickler は、引数にオブジェ
クトを取り、‘None’ かオブジェクトの永続的 ID を返すカスタム *note
persistent_id(): 1b47. メソッドを持たなくてはなりません。‘None’ を返す場
合、pickler は通常通りマーカーとともにオブジェクトを pickle 化するため、
unpickler はそれを永続的 ID として認識します。

外部オブジェクトを非 pickle 化するには、unpickler は永続的 ID オブジェク
トを取り被参照オブジェクトを返すカスタム *note persistent_load(): 1b4e.
メソッドを持たなくてはなりません。

これは、外部のオブジェクトを参照によって 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: de6. のインスタンスを作成します。あるいは、
次のコード

     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: 14e3. は、ときにその柔軟性が十分でないがことありま
す。特に、オブジェクトの型以外の別の条件で pickle 化をカスタマイズしたい
場合や、関数やクラスを使って pickle 化をカスタマイズしたい場合などです。

そのような場合、 *note Pickler: de6. クラスから派生したサブクラスで
*note reducer_override(): de7. メソッドを実装することができます。このメ
ソッドは任意のリダクション用タプルを返すことができます (*note
__reduce__(): d9b. を参照してください)。もしくは、従来の振る舞いにフォー
ルバックするために *note NotImplemented: 447. を返すこともできます。

*note dispatch_table: 14e3. と *note reducer_override(): de7. の両方が定
義されている場合、 ‘reducer_override()’ メソッドが優先されます。

     注釈: パフォーマンス上の理由により、次に挙げるオブジェクトに対して
     は *note reducer_override(): de7. が呼ばれないことがあります:
     ‘None’, ‘True’, ‘False’, および *note int: 32e, *note float: 32f,
     *note bytes: 1d2, *note str: 1ea, *note dict: 193, *note set: 432,
     *note frozenset: 9d9, *note list: 4e0, *note tuple: 1d9. の厳密なイ
     ンスタンス。

以下は特定のクラスを 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__(): 1b9d. メソッドを実装しなければなりませ
ん。このメソッドは大きなデータに対して (*note bytes: 1d2. オブジェクトな
どの代わりに) *note PickleBuffer: 1929. インスタンスを返します。

A *note PickleBuffer: 1929. 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: 1929. オブジェクトのカスタマイズされた処理を有効化すること
ができます。

送信側は 'buffer_callback' 引数を *note Pickler: de6. (または *note
dump(): 2f47. や *note dumps(): 185c. 関数) に渡す必要があります。この関
数はオブジェクトグラフを pickle 化するときに生成されるそれぞれの *note
PickleBuffer: 1929. を引数として呼ばれます。 'buffer_callback' によって
蓄積されたバッファは、それが保持するデータのコピーを pickle ストリームに
送らず、軽量なマーカーが挿入されるだけです。

受信側は 'buffers' 引数を *note Unpickler: 1999. (または *note load():
10ce. や *note loads(): 10cf. 関数) に渡す必要があります。これは
'buffer_callback' に渡されたバッファのイテラブルです。このイテラブルは
'buffer_callback' に渡されたのと同じ順番でバッファを返さなければなりませ
ん。これらのバッファは、pickle 化処理によって *note PickleBuffer: 1929.
オブジェクトを生成したオブジェクトの再構築処理で期待されるデータを提供し
ます。

送信側と受信側の間で、通信システムはアウトオブバウンドバッファの独自の転
送メカニズムを自由に実装することができます。見込みのある最適化としては、
共有メモリの利用や、データタイプ依存のデータ圧縮などが考えられます。


File: python.info,  Node: 使用例<10>,  Prev: 消費者 API,  Up: アウトオブバウンドバッファ

5.13.1.15 使用例
................

以下は、アウトオブバウンドのバッファを使った pickle 処理に関与することが
できるサブクラス *note bytearray: 1d1. を実装したささいな例です:

     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: 1d1. がそれ自身メモリを割り当てるという性質
による制限があります: すなわち、他のオブジェクトのメモリを参照する
‘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(): 1815. 関数をインポートし
て、次に文字列の引数 "echo hello world" を適用しています。この例は無害で
すが、システムを破壊する例を想像するのは難しくありません。

この理由のため、*note Unpickler.find_class(): 19d5. をカスタマイズするこ
とで非 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: 137. の
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(): 2f47. および *note load(): 10ce. 関
数を使用してください。

     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: 2f69.

     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: cb. モジュール

     Indexed databases of objects; uses ‘pickle’.

*note copy: 29. モジュール

     オブジェクトの浅いコピーおよび深いコピー。

*note marshal: 90. モジュール

     組み込み型の高性能な直列化。

脚注
....


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: 29c. を発生します。

 -- の関数: copyreg.pickle (type, function, constructor_ob=None)

     'function' が型 'type' のオブジェクトに対する"リダクション"関数とし
     て使われるように宣言します。 'function' は文字列か、2要素から6要素
     を含んだタプルを返さなければなりません。 'function' のインターフェ
     ースについての詳細は *note dispatch_table: 14e3. を参照してください
     。

     'constructor_ob' は古い機能で、現在は無視されますが、値を渡す場合は
     呼び出し可能 (callable) でなければなりません。

     pickler オブジェクトまたは *note pickle.Pickler: de6. のサブクラス
     の *note dispatch_table: 14e3. 属性を、リダクション関数の宣言のため
     に使うこともできるということは覚えておいてください。

* Menu:

* 使用例: 使用例<12>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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, *, serializer=None, deserializer=None)

     永続的な辞書を開きます。指定された 'filename' は、根底にあるデータ
     ベースの基本ファイル名となります。副作用として、 'filename' には拡
     張子がつけられる場合があり、ひとつ以上のファイルが生成される可能性
     もあります。デフォルトでは、根底にあるデータベースファイルは読み書
     き可能なように開かれます。オプションの 'flag' パラメータは *note
     dbm.open(): 12db. における 'flag' パラメータと同様に解釈されます。

     By default, pickles created with *note pickle.DEFAULT_PROTOCOL:
     c0b. are used to serialize values.  The version of the pickle
     protocol can be specified with the 'protocol' parameter.

     Python の意味論により、シェルフには永続的な辞書の可変エントリがいつ
     変更されたかを知る術がありません。 デフォルトでは、変更されたオブジ
     ェクトはシェルフに代入されたとき 'だけ' 書き込まれます (*note
     使用例: 2f73. 参照)。 オプションの 'writeback' パラメータが ‘True’
     に設定されている場合は、アクセスされたすべてのエントリはメモリ上に
     キャッシュされ、 *note sync(): 2f74. および *note close(): 2f75. を
     呼び出した際に書き戻されます; この機能は永続的な辞書上の可変の要素
     に対する変更を容易にしますが、多数のエントリがアクセスされた場合、
     膨大な量のメモリがキャッシュのために消費され、アクセスされた全ての
     エントリを書き戻す (アクセスされたエントリが可変であるか、あるいは
     実際に変更されたかを決定する方法は存在しないのです) ために、ファイ
     ルを閉じる操作が非常に低速になります。

     By default, ‘shelve’ uses *note pickle.dumps(): 185c. and *note
     pickle.loads(): 10cf. for serializing and deserializing.  This can
     be changed by supplying 'serializer' and 'deserializer',
     respectively.

     The 'serializer' argument must be a callable which takes an object
     ‘obj’ and the 'protocol' as inputs and returns the representation
     ‘obj’ as a *note bytes-like object: 43d.; the 'protocol' value may
     be ignored by the serializer.

     The 'deserializer' argument must be a callable which takes a
     serialized object given as a *note bytes: 1d2. object and returns
     the corresponding object.

     A *note ShelveError: 2f76. is raised if 'serializer' is given but
     'deserializer' is not, or vice-versa.

     バージョン 3.10 で変更: *note pickle.DEFAULT_PROTOCOL: c0b. is now
     used as the default pickle protocol.

     バージョン 3.11 で変更: Accepts *note path-like object: 7a5. for
     filename.

     バージョン 3.15 で変更: Accepts custom 'serializer' and
     'deserializer' functions in place of *note pickle.dumps(): 185c.
     and *note pickle.loads(): 10cf.

          注釈: シェルフが自動的に閉じることに依存しないでください; それ
          がもう必要ない場合は常に *note close(): 2f75. を明示的に呼ぶか
          、 *note shelve.open(): 1c96. をコンテキストマネージャとして使
          用してください:

               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: fd0.  Also empty the cache and
     synchronize the persistent dictionary on disk, if feasible.  This
     is called automatically when *note reorganize(): 2f78. is called or
     the shelf is closed with *note close(): 2f75.

 -- メソッド: Shelf.reorganize ()

     Calls *note sync(): 2f74. and attempts to shrink space used on disk
     by removing empty space resulting from deletions.

     Added in version 3.15.

 -- メソッド: Shelf.close ()

     永続的な '辞書' オブジェクトを同期して閉じます。既に閉じられている
     シェルフに対して呼び出すと *note ValueError: 15a. を出し失敗します
     。

参考
....

Persistent dictionary recipe(2) with widely supported storage formats
and having the speed of native dictionaries.

* Menu:

* 制限事項::
* 使用例: 使用例<13>.
* 例外: 例外<7>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 37.
     、 *note dbm.gnu: 36.) は、どのインターフェースが利用可能かに依存し
     ます。従って、データベースを *note dbm: 34. を使って直接開く方法は
     安全ではありません。データベースはまた、 ‘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: 37. can silently corrupt the database file
     on updates, which can cause hard crashes when trying to read from
     the database.

   * *note Shelf.reorganize(): 2f78. may not be available for all
     database packages and may temporarily increase resource usage
     (especially disk space) when called.  Additionally, it will never
     run automatically and instead needs to be called explicitly.

 -- クラス: shelve.Shelf (dict, protocol=None, writeback=False,
          keyencoding='utf-8', *, serializer=None, deserializer=None)

     *note collections.abc.MutableMapping: 146a. のサブクラスで、 'dict'
     オブジェクト内にpickle化された値を保持します。

     By default, pickles created with *note pickle.DEFAULT_PROTOCOL:
     c0b. 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 に対して使われ
     る前にキーをエンコードするのに使用されるエンコーディングです。

     The 'serializer' and 'deserializer' parameters have the same
     interpretation as in *note open(): 1c96.

     *note Shelf: 1349. オブジェクトは、コンテキストマネージャとしても使
     用できます。この場合、 *note with: 215. ブロックが終了する際に、自
     動的に閉じられます。

     バージョン 3.2 で変更: 'keyencoding' パラメータを追加; 以前はキーは
     常に UTF-8 でエンコードされていました。

     バージョン 3.4 で変更: コンテキストマネージャーサポートが追加されま
     した。

     バージョン 3.10 で変更: *note pickle.DEFAULT_PROTOCOL: c0b. is now
     used as the default pickle protocol.

     バージョン 3.15 で変更: Added the 'serializer' and 'deserializer'
     parameters.

 -- クラス: shelve.BsdDbShelf (dict, protocol=None, writeback=False,
          keyencoding='utf-8', *, serializer=None, deserializer=None)

     A subclass of *note Shelf: 1349. 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',
     'keyencoding', 'serializer' and 'deserializer' parameters have the
     same interpretation as in *note open(): 1c96.

     バージョン 3.15 で変更: Added the 'serializer' and 'deserializer'
     parameters.

 -- クラス: shelve.DbfilenameShelf (filename, flag='c', protocol=None,
          writeback=False, *, serializer=None, deserializer=None)

     A subclass of *note Shelf: 1349. which accepts a 'filename' instead
     of a dict-like object.  The underlying file will be opened using
     *note dbm.open(): 12db.  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(): 1c96. function.
     The optional 'protocol', 'writeback', 'serializer' and
     'deserializer' parameters have the same interpretation as in *note
     open(): 1c96.

     バージョン 3.15 で変更: Added the 'serializer' and 'deserializer'
     parameters.

   ---------- Footnotes ----------

   (1) https://www.jcea.es/programacion/pybsddb.htm


File: python.info,  Node: 使用例<13>,  Next: 例外<7>,  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


File: python.info,  Node: 例外<7>,  Prev: 使用例<13>,  Up: shelve --- Python オブジェクトの永続化

5.13.3.3 例外
.............

 -- 例外: shelve.ShelveError

     Exception raised when one of the arguments 'deserializer' and
     'serializer' is missing in the *note open(): 1c96, *note Shelf:
     1349, *note BsdDbShelf: 28cc. and *note DbfilenameShelf: 28cd.

     The 'deserializer' and 'serializer' arguments must be given
     together.

     Added in version 3.15.

参考
....

*note dbm: 34. モジュール

     ‘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: cb.  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: 32e, *note bool: 5f6, *note float: 32f,
     *note complex: 330.

   * Strings (*note str: 1ea.) and *note bytes: 1d2.  *note Bytes-like
     objects: 43d. like *note bytearray: 1d1. are marshalled as ‘bytes’.

   * Containers: *note tuple: 1d9, *note list: 4e0, *note dict: 193,
     *note frozendict: 18d. (since *note version: 2f7f. 6), *note set:
     432, *note frozenset: 9d9, and *note slice: 1db. (since ‘version’
     5).  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: a6a, *note Ellipsis: 2537. and *note
     StopIteration: fbe.

   * *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.

バージョン 3.15 で変更: Added format version 6, which allows marshalling
*note frozendict: 18d.

このモジュールでは、以下の関数が定義されています。

 -- の関数: marshal.dump (value, file, version=version, /, *,
          allow_code=True)

     開かれたファイルに値を書き込みます。値はサポートされている型でなく
     てはなりません。file は書き込み可能な *note バイナリファイル: 227b.
     である必要があります。

     If the value has (or contains an object that has) an unsupported
     type, a *note ValueError: 15a. exception is raised -- but garbage
     data will also be written to the file.  The object will not be
     properly read back by *note load(): 2004.  *note Code objects: 6f1.
     are only supported if 'allow_code' is true.

     'version' 引数は ‘dump’ が使用するデータフォーマットを指定します (下
     記を参照してください)。

     引数 ‘value’, ‘version’ を指定して *note 監査イベント: 1e84.
     ‘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: 1693, *note
     ValueError: 15a. or *note TypeError: 29c.  *note Code objects: 6f1.
     are only supported if 'allow_code' is true.  The file must be a
     readable *note binary file: 227b.

     引数無しで *note 監査イベント: 1e84. ‘marshal.load’ を送出します。

          注釈: サポートされていない型を含むオブジェクトが *note dump():
          2f80. で整列化されている場合、 *note load(): 2004. は整列化不
          能な値を ‘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: 15a. exception if value has (or contains an
     object that has) an unsupported type.  *note Code objects: 6f1. are
     only supported if 'allow_code' is true.

     'version' 引数は ‘dumps’ が使用するデータフォーマットを指定します
     (下記を参照してください)。

     引数 ‘value’, ‘version’ を指定して *note 監査イベント: 1e84.
     ‘marshal.dumps’ を送出します。

     バージョン 3.13 で変更: Added the 'allow_code' parameter.

 -- の関数: marshal.loads (bytes, /, *, allow_code=True)

     Convert the *note bytes-like object: 43d. to a value.  If no valid
     value is found, raise *note EOFError: 1693, *note ValueError: 15a.
     or *note TypeError: 29c.  *note Code objects: 6f1. are only
     supported if 'allow_code' is true.  Extra bytes in the input are
     ignored.

     引数 ‘bytes’ を指定して *note 監査イベント: 1e84. ‘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: 1db. objects
                                     
                                     
     6           Python 3.15         Support for *note frozendict: 18d. 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: 38.

   * *note dbm.gnu: 36.

   * *note dbm.ndbm: 37.

If none of these modules are installed, the slow-but-simple
implementation in module *note dbm.dumb: 35. will be used.  There is a
third party interface(2) to the Oracle Berkeley DB.

     注釈: None of the underlying modules will automatically shrink the
     disk space used by the database file.  However, *note dbm.sqlite3:
     38, *note dbm.gnu: 36. and *note dbm.dumb: 35. provide a
     ‘reorganize()’ method that can be used for this purpose.

 -- 例外: dbm.error

     サポートされているモジュールそれぞれによって送出される可能性のある
     例外を含むタプル。これにはユニークな例外があり、最初の要素として同
     じく *note dbm.error: 2f85. という名前の例外が含まれます --
     ‘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: 38, *note dbm.gnu:
     36, *note dbm.ndbm: 37, or *note dbm.dumb: 35. -- 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: 7a5.

 -- の関数: dbm.open (file, flag='r', mode=0o666)

     Open a database and return the corresponding database object.


     パラメータ:

        * ‘file’ (*note path-like object: 7a5.) - The database file to
          open.

          If the database file already exists, the *note whichdb():
          2f86. 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: 1ea.) -

             * ‘'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: 32e.) - 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:
     7a5.

The object returned by *note open(): 12db. supports the basic
functionality of mutable *note mappings: 1579.; keys and their
corresponding values can be stored, retrieved, and deleted, and
iteration, the *note in: 32b. 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: 1d2.  This means that
when strings are used they are implicitly converted to the default
encoding before being stored.

これらのオブジェクトは、 *note with: 215. 文での使用にも対応しています。
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(): 12db.

バージョン 3.8 で変更: Deleting a key from a read-only database raises a
database module specific exception instead of *note KeyError: 7e5.

バージョン 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: cb. モジュール

     非文字列データを記録する永続化モジュール。

個々のサブモジュールは以降の節で説明されます。

* 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/main/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: d7. 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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

 -- の関数: dbm.sqlite3.open (filename, /, flag='r', mode=0o666)

     Open an SQLite database.


     パラメータ:

        * ‘filename’ (*note path-like object: 7a5.) - The path to the
          database to be opened.

        * ‘flag’ (*note str: 1ea.) -

             * ‘'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: 1579, 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: 215. keyword.

     The following methods are also provided:

      -- メソッド: sqlite3.close ()

          Close the SQLite database.

      -- メソッド: sqlite3.reorganize ()

          If you have carried out a lot of deletions and would like to
          shrink the space used on disk, this method will reorganize the
          database; otherwise, deleted file space will be kept and
          reused as new (key, value) pairs are added.

               注釈: While reorganizing, as much as two times the size
               of the original database is required in free disk space.
               However, be aware that this factor changes for each ‘dbm’
               submodule.

          Added in version 3.15.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 37. module, but with additional
functionality like crash tolerance.

     注釈: The file formats created by ‘dbm.gnu’ and *note dbm.ndbm: 37.
     are incompatible and can not be used interchangeably.

*note Availability: 234c.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 246c. と *note
WebAssemblyプラットフォーム: 1d86. をサポートしません。

*note Availability: 234c.: Unix.

 -- 例外: dbm.gnu.error

     Raised on ‘dbm.gnu’-specific errors, such as I/O errors.  *note
     KeyError: 7e5. 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(): 202d.
     supports.

 -- の関数: dbm.gnu.open (filename, flag='r', mode=0o666, /)

     Open a GDBM database and return a ‘gdbm’ object.


     パラメータ:

        * ‘filename’ (*note path-like object: 7a5.) - The database file
          to open.

        * ‘flag’ (*note str: 1ea.) -

             * ‘'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: 2f8c. member for a list of supported flag
          characters.

        * ‘mode’ (*note int: 32e.) - The Unix file access mode of the
          file (default: octal ‘0o666’), used only when the database has
          to be created.


     例外: *note error: e64. - If an invalid 'flag' argument is passed.

     バージョン 3.11 で変更: 'filename' accepts a *note path-like
     object: 7a5.

     ‘gdbm’ objects behave similar to mutable *note mappings: 1579, 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: 215. 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(): 2f8f. 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.

               注釈: While reorganizing, as much as one time the size of
               the original database is required in free disk space.
               However, be aware that this factor changes for each ‘dbm’
               submodule.

      -- メソッド: gdbm.sync ()

          データベースが高速モードで開かれていた場合、このメソッドはディ
          スクにまだ書き込まれていないデータを全て書き込ませます。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 36. 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: 234c.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 246c. と *note
WebAssemblyプラットフォーム: 1d86. をサポートしません。

*note Availability: 234c.: Unix.

 -- 例外: dbm.ndbm.error

     Raised on ‘dbm.ndbm’-specific errors, such as I/O errors.  *note
     KeyError: 7e5. 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: 7a5.) - The basename of
          the database file (without the ‘.dir’ or ‘.pag’ extensions).

        * ‘flag’ (*note str: 1ea.) -

             * ‘'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: 32e.) - 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: 7a5. for
     filename.

     ‘ndbm’ objects behave similar to mutable *note mappings: 1579, 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: 215. 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/main/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: 193.-like
interface which is written entirely in Python.  Unlike other ‘dbm’
backends, such as *note dbm.gnu: 36, 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: 7e5. 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: 1ea.) -

             * ‘'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: 32e.) - The Unix file access mode of the
          file (default: octal ‘0o666’), used only when the database has
          to be created.

          警告: 十分に大きかったり複雑だったりするエントリーのあるデータ
          ベースを読み込んでいるときに、 Python の抽象構文木コンパイラの
          スタックの深さの限界を越えるせいで、 Python インタプリタをクラ
          ッシュさせることができます。

          警告: ‘dbm.dumb’ does not support concurrent read/write
          access.  (Multiple simultaneous read accesses are safe.)  When
          a program has the database open for writing, no other program
          should have it open for reading or writing.

     バージョン 3.5 で変更: *note open(): e60. 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: 7a5.

     The returned database object behaves similar to a mutable *note
     mapping: 1579, 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: 215.
     keyword.

     The following methods are also provided:

      -- メソッド: dumbdbm.close ()

          Close the database.

      -- メソッド: dumbdbm.reorganize ()

          If you have carried out a lot of deletions and would like to
          shrink the space used on disk, this method will reorganize the
          database; otherwise, deleted file space will not be reused.

               注釈: While reorganizing, no additional free disk space
               is required.  However, be aware that this factor changes
               for each ‘dbm’ submodule.

          Added in version 3.15.

      -- メソッド: dumbdbm.sync ()

          Synchronize the on-disk directory and data files.  This method
          is called by the *note shelve.Shelf.sync(): 2f74. method.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 2366.  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
オプションのモジュールの要件: 2364.

この文書には大きく分けて 4 つの節があります:

   * *note チュートリアル: 2f9d. ‘sqlite3’ モジュールの使い方を学びます
     。

   * *note リファレンス: 2f9e. このモジュールが定義するクラスと関数につ
     いて説明します。

   * *note ハウツー・ガイド: 2f9f. 特定のタスクの処理方法について詳しく
     説明します。

   * *note 説明: 2fa0. トランザクション制御の背景をより深く掘り下げて説
     明します。

参考
....

‘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/main/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(): 3e7. を呼び出して、データベース ‘tutorial.db’ への接
続を現在の作業ディレクトリに作成します。存在しない場合は暗黙的に作成しま
す。

     import sqlite3
     con = sqlite3.connect("tutorial.db")

返された *note Connection: 3e6. オブジェクト ‘con’ は、ディスク上のデー
タベースへの接続を表します。

SQL 文を実行し、SQL クエリから結果を取得するには、データベース・カーソル
を使用する必要があります。 *note con.cursor(): 2fa2. を呼び出して *note
Cursor: 2fa3. を作成してください:

     cur = con.cursor()

さて、今やデータベース接続とカーソルを取得したので、タイトル(title)とリ
リース年(year)と、レビュー・スコア(score)の列(columns)を持つデータベース
・テーブル ‘movie’ を作成できます。 簡単にするために、テーブル宣言では列
名だけを使用できます。SQLite の 柔軟な型付け(flexible typing(3))機能のお
かげで、データ型の指定はオプションになっています。 *note
cur.execute(...): 7ae. を呼び出して ‘CREATE TABLE’ 文を実行してください:

     cur.execute("CREATE TABLE movie(title, year, score)")

SQLite に組み込みの ‘sqlite_master’ テーブルに対してクエリを実行すること
で、新しいテーブルが作成されたことを確認できます。このテーブルには、
‘movie’ テーブル定義のエントリが含まれているはずです(詳細は The Schema
Table(4) 参照)。 *note cur.execute(...): 7ae. を呼び出してクエリを実行し
て、その結果を ‘res’ に代入し、結果の行(row)を取得するために *note
res.fetchone(): 2fa4. を呼び出します:

     >>> 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: 1d9. 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(...): 7ae. を呼び出して追加します:

     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
トランザクション制御: 2fa5. 参照)。 トランザクションをコミットするために
接続オブジェクト(connection object)の *note con.commit(): 2fa6. を呼び出
して下さい:

     con.commit()

‘SELECT’ クエリを実行することで、データが正しく挿入されたことを確認でき
ます。 結果のすべての行を返すには、おなじみの *note cur.execute(...):
7ae. を使用して結果を ‘res’ に代入し、 *note res.fetchall(): 2fa7. を呼
び出して下さい:

     >>> res = cur.execute("SELECT score FROM movie")
     >>> res.fetchall()
     [(8.2,), (7.5,)]

結果は、2 つの ‘タプル’ の *note リスト: 4e0. で、 それぞれのタプルにそ
の行の ‘score’ 値が含まれています。

ここで、 *note cur.executemany(...): 7af. を呼び出して、さらに 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 文字列フォーマット: 2267. の代わりにプレースホルダを使用してくださ
い(詳細は *note プレースホルダを使用して SQL クエリに値を結び付ける方法:
7b0. 参照)。

‘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 タプル: 1d9. の ‘(year, title)’ の 2 つの項目であり、
クエリで選択された列(columns)にマッチします。

最後に、 *note con.close(): 755. を呼び出して既存の接続(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 ハウツー・ガイド: 2f9f. も参考にしてください:

        * *note プレースホルダを使用して SQL クエリに値を結び付ける方法:
          7b0.

        * *note カスタム Python 型を SQLite 値に適合させる方法: 2fa8.

        * *note SQLite 値をカスタム Python 型に変換する方法: 2fa9.

        * *note 接続(connection)コンテキストマネージャの使い方: 1d88.

        * *note 行工場(row factories)の作成方法と使用方法: 2faa.

   * *note トランザクション制御: 2fa0. トランザクション制御の背景につい
     てより深く掘り下げた説明。

   ---------- 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 オブジェクト::
* 例外: 例外<8>.
* 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: 7a5.) - 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: 32f.) - テーブルがロックされている場合
          、 *note OperationalError: 1e68. を送出する前に接続を待機する
          秒数。 別の接続がテーブルを変更するためにトランザクションを開
          くと、そのテーブルはトランザクションがコミットされるまでロック
          されます。 デフォルトは 5 秒です。

        * ‘detect_types’ (*note int: 32e.) - Control whether and how
          data types not *note natively supported by SQLite: 2faf. are
          looked up to be converted to Python types, using the
          converters registered with *note register_converter(): 2fb0.
          Set it to any combination (using ‘|’, bitwise or) of *note
          PARSE_DECLTYPES: 2fb1. and *note PARSE_COLNAMES: 2fb2. 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: 1ea.‘ | ’‘None’) - Control
          legacy transaction handling behaviour.  See *note
          Connection.isolation_level: 2fb3. and *note isolation_level
          属性に依るトランザクション制御: 2fb4. for more information.
          Can be ‘"DEFERRED"’ (default), ‘"EXCLUSIVE"’ or ‘"IMMEDIATE"’;
          or ‘None’ to disable opening transactions implicitly.  Has no
          effect unless *note Connection.autocommit: 8cb. is set to
          *note LEGACY_TRANSACTION_CONTROL: 2fb5. (the default).

        * ‘check_same_thread’ (*note bool: 5f6.) - ‘True’ (これがデフォ
          ルトです)なら、データベース接続を作成したスレッド以外のスレッ
          ドがデータベース接続を使用すると、 *note ProgrammingError:
          584. が送出されます。 ‘False’ なら、接続は複数のスレッドからア
          クセスできます。ただし、データの破損を避けるために、ユーザーに
          よる書き込み操作の直列化が必要になることがあります。詳細は
          *note threadsafety: a71. を参照してください。

        * ‘factory’ (*note Connection: 3e6.) - デフォルトの *note
          Connection: 3e6. クラスでない場合に接続(connection)を作成する
          ‘Connection’ のカスタム・サブクラスです。

        * ‘cached_statements’ (*note int: 32e.) - ‘sqlite3’ がこの接続
          (connection)のために内部的にキャッシュするSQL文(statements)の
          数で、 パース時のオーバーヘッドを回避します。 デフォルトでは、
          128 文(statements)です。

        * ‘uri’ (*note bool: 5f6.) - ‘True’ に設定すると、 'database' は
          、ファイル・パス(path)とオプションのクエリ文字列を含む URI
          (Uniform Resource Identifier) として解釈されます。 スキームの
          部分は ‘"file:"’ でなければならず、パス(path)は相対パスまたは
          絶対パスにすることができます。 クエリ文字列により、 パラメータ
          ーを SQLite に渡すことができ、さまざまな *note SQLite URI
          の操作方法: 2fb6. が有効になります。

        * ‘autocommit’ (*note bool: 5f6.) - Control PEP 249(2)
          transaction handling behaviour.  See *note
          Connection.autocommit: 8cb. and *note autocommit
          属性に依るトランザクション制御: 8cc. for more information.
          'autocommit' currently defaults to *note
          LEGACY_TRANSACTION_CONTROL: 2fb5.  The default will change to
          ‘False’ in a future Python release.


     戻り値の型: *note Connection: 3e6.

     引数 ‘database’ を指定して *note 監査イベント: 1e84.
     ‘sqlite3.connect’ を送出します。

     引数 ‘connection_handle’ を指定して *note 監査イベント: 1e84.
     ‘sqlite3.connect/handle’ を送出します。

     バージョン 3.4 で変更: ‘uri’ パラメータが追加されました。

     バージョン 3.7 で変更: 'database' は、文字列だけでなく、 *note
     path-like object: 7a5. にすることもできるようになりました。

     バージョン 3.10 で変更: Added the ‘sqlite3.connect/handle’ auditing
     event.

     バージョン 3.12 で変更: Added the 'autocommit' parameter.

     バージョン 3.15 で変更: All parameters except 'database' are now
     keyword-only.

 -- の関数: 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(): 7ae. を呼び出す前に追加の入力が必要かどうかを判断するの
     に使えます。

     実際の使用例については、 Lib/sqlite3/__main__.py(3) の
     ‘runsource()’ を参照してください。

 -- の関数: sqlite3.enable_callback_tracebacks (flag, /)

     コールバックのトレースバックを有効または無効にします。 デフォルトで
     は、ユーザー定義関数や集計関数や変換関数や authorizer コールバック
     などではトレースバックを取得しません。それらをデバッグしたい場合は
     、 'flag' を ‘True’ に設定してこの関数を呼び出し。その後、 *note
     sys.stderr: d09. のコールバックからトレースバックを取得します。 機
     能を再び無効にするには ‘False’ を使用します。

          注釈: Errors in user-defined function callbacks are logged as
          unraisable exceptions.  Use an *note unraisable hook handler:
          712. for introspection of the failed callback.

 -- の関数: sqlite3.register_adapter (type, adapter, /)

     'adapter' *note 呼び出し可能オブジェクト: 2fba. を登録して、 Python
     型の 'type' を SQLite の型に適合させます。適合関数(adapter)アダプタ
     ーは、 Python 型 'type' の Python オブジェクトを唯一の引数として使
     用して呼び出され、 *note SQLite がネイティブに理解する型: 2faf. の
     値を返す必要があります。

 -- の関数: sqlite3.register_converter (typename, converter, /)

     'converter' *note 呼び出し可能オブジェクト: 2fba. を登録して、
     'typename' 型の SQLite オブジェクトを指定の型の Python オブジェクト
     に変換します。変換関数(converter)、 'typename' 型のすべての SQLite
     値に対して呼び出されます。 変換関数には *note bytes: 1d2. オブジェ
     クトが渡され、目的の Python 型のオブジェクトを返す必要があります。
     型検出の仕組みについては、 *note connect(): 3e7. のパラメーター
     'detect_types' を参照してください。

     注釈: 'typename' とクエリ内の型の名前は、大文字小文字を区別せずにマ
     ッチングされます。

   ---------- Footnotes ----------

   (1) https://sqlite.org/inmemorydb.html

   (2) https://peps.python.org/pep-0249/

   (3) 
https://github.com/python/cpython/tree/main/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: 8cb. に、この定数を設定します。
     詳細については *note isolation_level
     属性に依るトランザクション制御: 2fb4. を参照してください。

 -- データ: sqlite3.PARSE_DECLTYPES

     このフラグ値を *note connect(): 3e7. の '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: 2fb2. と組み合わせることができます。

          注釈: Generated fields (for example ‘MAX(p)’) are returned as
          *note str: 1ea.  Use ‘PARSE_COLNAMES’ to enforce types for
          such queries.

 -- データ: sqlite3.PARSE_COLNAMES

     Pass this flag value to the 'detect_types' parameter of *note
     connect(): 3e7. 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: 2fb1. と組み合わせることができます。

 -- データ: sqlite3.SQLITE_OK
 -- データ: sqlite3.SQLITE_DENY
 -- データ: sqlite3.SQLITE_IGNORE

     *note Connection.set_authorizer(): 3ea. に渡す *note
     呼び出し可能オブジェクト: 2fba. が返す必要のあるフラグ。これらは以
     下の意味です:

        * アクセスは許可されました(‘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 文字列: 1ea. としての、ランタイム SQLite ライブラリのバージョ
     ン番号。

 -- データ: sqlite3.sqlite_version_info

     *note 整数: 32e. の *note タプル: 1d9. としての、ランタイム SQLite
     ライブラリのバージョン番号。

 -- データ: sqlite3.SQLITE_KEYWORDS

     A *note tuple: 1d9. containing all SQLite keywords.

     This constant is only available if Python was compiled with SQLite
     3.24.0 or greater.

     Added in version 3.15.

 -- データ: 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(): 8cf. メソッド や
     *note getconfig(): 8ce. メソッドで使用されます。

     これらの定数が利用できるかどうかは、 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(): 3e7.
     を使用して作成される ‘Connection’ オブジェクトによって表されます。
     ‘Connection’ オブジェクトの主な目的は *note Cursor: 2fa3. オブジェ
     クトの作成と *note トランザクション制御: 2fa5. です。

     参考
     ....

        * *note 接続(connection)ショートカット・メソッドの使い方: 2fd5.

        * *note 接続(connection)コンテキストマネージャの使い方: 1d88.

     バージョン 3.13 で変更: A *note ResourceWarning: 754. is emitted if
     *note close(): 755. is not called before a ‘Connection’ object is
     deleted.

     SQLite データベース接続(connection)には、以下の属性とメソッドがあり
     ます:

      -- メソッド: cursor (factory=Cursor)

          *note Cursor: 2fa3. オブジェクトを作成して返します。 cursor メ
          ソッドは、単一のオプション・パラメーター 'factory' を受け入れ
          ます。 'factory' を指定する場合、これは ‘Cursor’ またはそのサ
          ブクラスのインスタンスを返す *note 呼び出し可能オブジェクト:
          2fba. である必要があります。

      -- メソッド: blobopen (table, column, rowid, /, *, readonly=False,
               name='main')

          既存の BLOB (Binary Large OBject) への *note Blob: a77. ハンド
          ルを開きます。


          パラメータ:

             * ‘table’ (*note str: 1ea.) - 当該 BLOB が配置されているテ
               ーブルの名前。

             * ‘column’ (*note str: 1ea.) - 当該 BLOB が配置されている列
               (column)の名前。

             * ‘rowid’ (*note int: 32e.) - The row id where the blob is
               located.

             * ‘readonly’ (*note bool: 5f6.) - 書き込み権限なしで BLOB を
               開く必要がある場合は、 ‘True’ に設定します。 デフォルトは
               ‘False’ です。

             * ‘name’ (*note str: 1ea.) - 当該 BLOB が配置されているデー
               タベース名。 デフォルトは ‘"main"’ です。


          例外: *note OperationalError: 1e68. - ‘WITHOUT ROWID’ テーブル
          で BLOB を開こうとしたとき。


          戻り値の型: *note Blob: a77.

               注釈: *note Blob: a77. クラスを使用して BLOB のサイズを変
               更することはできません。 SQL 関数 ‘zeroblob’ を使用すると
               、固定サイズのブロブを作成します。

          Added in version 3.11.

      -- メソッド: commit ()

          保留中のトランザクションをデータベースにコミットします。 *note
          autocommit: 8cb. が ‘True’ または開いているトランザクションが
          ない場合、このメソッドは何も行いません。 ‘autocommit’ が
          ‘False’ の場合に保留中のトランザクションがこのメソッドによって
          コミットされた場合、新しいトランザクションが暗黙に開かれます。

      -- メソッド: rollback ()

          保留中のトランザクションの先頭にロールバックします。 *note
          autocommit: 8cb. が ‘True’ または開いているトランザクションが
          ない場合、このメソッドは何も行いません。 ‘autocommit’ が
          ‘False’ の場合に保留中のトランザクションがこのメソッドによって
          ロールバックされた場合、新しいトランザクションが暗黙に開かれま
          す。

      -- メソッド: close ()

          データベース接続を閉じます。 *note autocommit: 8cb. が ‘False’
          の場合、保留中のトランザクションは暗黙にロールバックされます。
          ‘autocommit’ が ‘True’ または *note
          LEGACY_TRANSACTION_CONTROL: 2fb5. の場合、暗黙のトランザクショ
          ン制御は実行されませんので、保留中の変更が失われないように、デ
          ータベース接続を閉じる前に必ず *note commit(): 2fa6. を行って
          ください。

      -- メソッド: execute (sql, parameters=(), /)

          新しい *note Cursor: 2fa3. オブジェクトを作成し、指定の 'sql'
          と 'parameters' で *note execute(): 7ae. を呼び出します。新し
          いカーソル・オブジェクトを返します。

      -- メソッド: executemany (sql, parameters, /)

          新しい *note Cursor: 2fa3. オブジェクトを作成し、与えられた
          'sql' と 'parameters' で *note executemany(): 7af. を呼び出し
          ます。新しいカーソル・オブジェクトを返します。

      -- メソッド: executescript (sql_script, /)

          新しい *note Cursor: 2fa3. オブジェクトを作成し、指定された
          'sql_script' で *note executescript(): 2fda. を呼び出します。
          新しいカーソル・オブジェクトを返します。

      -- メソッド: create_function (name, narg, func, /, *,
               deterministic=False)

          ユーザ定義 SQL 関数を作成または削除します。


          パラメータ:

             * ‘name’ (*note str: 1ea.) - SQL 関数の名前。

             * ‘narg’ (*note int: 32e.) - SQL 関数が受け入れることができ
               る引数の数。 ‘-1’ を指定すると、任意の数の引数を取ること
               ができます。

             * ‘func’ (*note callback: 2fdb. | None) - この SQL 関数が呼
               び出されたときに起動される *note
               呼び出し可能オブジェクト: 2fba. 。 この呼び出し可能オブジ
               ェクトは、 *note SQLite
               によってネイティブにサポートされる型: 2faf. を返すす必要
               があります。 既存の SQL 関数を削除するには、 ‘None’ に設
               定します。

             * ‘deterministic’ (*note bool: 5f6.) - ‘True’ の場合、作成
               された SQL 関数は決定論的(deterministic(1) : 入力が同一な
               ら常に同一の答えを返す)としてマークされ、SQLite が追加の
               最適化を実行できるようになります。

          バージョン 3.8 で変更: Added the 'deterministic' parameter.

          バージョン 3.15 で変更: The first three parameters are now
          positional-only.

          例:

               >>> 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()

      -- メソッド: create_aggregate (name, n_arg, aggregate_class, /)

          ユーザ定義集計関数を作成または削除します。


          パラメータ:

             * ‘name’ (*note str: 1ea.) - SQL 集計関数の名前。

             * ‘n_arg’ (*note int: 32e.) - SQL 集計関数が受け入れること
               ができる引数の数。 ‘-1’ を指定すると、任意の数の引数を取
               ることができます。

             * ‘aggregate_class’ (*note class: 1f11. | None) - クラスは
               以下のメソッドを実装する必要があります:

                  * ‘step()’: 集計に行(row)を足し込みます。

                  * ‘finalize()’: 集計の最終結果を *note SQLite
                    でネイティブにサポートされている型: 2faf. として返し
                    ます。

               ‘step()’ メソッドが受け入れなければならない引数の数は
               'n_arg' によって制御されます。

               既存の SQL 集計関数を削除するには、 ‘None’ に設定します。

          バージョン 3.15 で変更: All three parameters are now
          positional-only.

          例:

               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()

      -- メソッド: create_window_function (name, num_params,
               aggregate_class, /)

          ユーザー定義の集計ウインドウ関数を作成または削除します。


          パラメータ:

             * ‘name’ (*note str: 1ea.) - 作成または削除する SQL 集計ウ
               インドウ関数の名前。

             * ‘num_params’ (*note int: 32e.) - SQL 集計ウィンドウ関数が
               受け入れることができる引数の数。 ‘-1’ を指定した場合、任
               意の数の引数を取ることができます。

             * ‘aggregate_class’ (*note class: 1f11. | None) - クラスは
               以下のメソッドを実装する必要があります:

                  * ‘step()’: 現在のウィンドウに行を足し込みます。

                  * ‘value()’: 集計の現在の値を返します。

                  * ‘inverse()’: 現在のウインドウから指定の行(row)の分を
                    削除します。

                  * ‘finalize()’: 集計の最終結果を *note SQLite
                    でネイティブにサポートされている型: 2faf. として返し
                    ます。

               ‘step()’ メソッドと ‘value()’ メソッドが受け入れなければ
               ならない引数の数は 'num_params' によって制御されます。

               ‘None’ に設定すると、既存の SQL 集計ウィンドウ関数が削除
               されます。


          例外: *note NotSupportedError: 2fdc. - 集計ウィンドウ関数をサ
          ポートしていない 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 文字列: 1ea. 引数が渡され、*note 整数: 32e. を返す必要が
          あります:

             * 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: 1e68. を
          送出します。

      -- メソッド: set_authorizer (authorizer_callback, /)

          データベース内のテーブルの列(column)にアクセスしようとするたび
          に起動される *note 呼び出し可能オブジェクト: 2fba.
          'authorizer_callback' を登録します。 このコールバックは背後の
          SQLite ライブラリによって列(column)へのアクセスがどのように処
          理されるかを通知するために、 *note SQLITE_OK: 2fbd. または
          *note SQLITE_DENY: 2fbe. または *note SQLITE_IGNORE: 2fbf. の
          いずれかを返さなければなりません。

          コールバックの最初の引数は、承認(authorize)される操作の種類を
          示します。 2 番目と 3 番目の引数は、最初の引数に応じて、引数ま
          たは ‘None’ になります。 4 番目の引数は、該当する場合、データ
          ベースの名前("main" や "temp" 等)です。 5 番目の引数は、 アク
          セス試行を担当する最も内側のトリガーまたはビューの名前です。こ
          のアクセス試行が入力 SQL コードから直接行われた場合は ‘None’ で
          す。

          最初の引数に指定可能な値と、 最初の引数に応じた 2 番目と 3 番
          目の引数の意味については、 SQLite のドキュメントを参照してくだ
          さい。 必要なすべての定数は ‘sqlite3’ モジュールで利用できます
          。

          'authorizer_callback' として ‘None’ を渡すと、承認機構
          (authorizer)が無効になります。

          バージョン 3.11 で変更: ‘None’ を使用して承認機構
          (authorizer)を無効にするサポートが追加されました。

          バージョン 3.15 で変更: The only parameter is now
          positional-only.

      -- メソッド: set_progress_handler (progress_handler, /, n)

          SQLite 仮想マシンの命令を 'n' 個実行するごとに呼び出されるよう
          に、 *note 呼び出し可能オブジェクト: 2fba. 'progress_handler'
          を登録します。これは、 GUI の更新など、長時間実行される操作中
          に SQLite から呼び出されるようにしたい場合に便利です。

          以前にインストールした progress ハンドラーをクリアしたい場合は
          、 'progress_handler' に ‘None’ を指定してメソッドを呼び出しま
          す。

          ハンドラー関数からゼロ以外の値を返すと、現在実行中のクエリを終
          了(terminate)し、 *note DatabaseError: 2fde. 例外を送出します
          。

          バージョン 3.15 で変更: 第1引数は位置専用になりました。

      -- メソッド: set_trace_callback (trace_callback, /)

          SQLite バックエンドによって実際に実行される SQL 文ごとに起動さ
          れる *note 呼び出し可能オブジェクト: 2fba. 'trace_callback' を
          登録します。

          コールバックに渡される唯一の引数は、(*note str: 1ea. として渡
          される)実行中のSQL文です。 コールバックの戻り値は無視されます
          。 バックエンドは、 *note Cursor.execute(): 7ae. メソッドに渡
          されたSQL文を実行するだけではないことに注意してください。
          ‘sqlite3’ モジュールの *note トランザクション管理: 2fa5. や、
          現在のデータベース内で定義されたトリガーの実行その他も行います
          。

          'trace_callback' として ‘None’ を渡すと、トレース・コールバッ
          クが無効になります。

               注釈: トレース・コールバックで送出した例外は伝播されませ
               ん。 開発およびデバッグの補助として、 *note
               enable_callback_tracebacks(): 2fb8. を使用して、トレース
               ・コールバックで送出した例外からのトレースバックの出力を
               有効にします。

          Added in version 3.3.

          バージョン 3.15 で変更: 第1引数は位置専用になりました。

      -- メソッド: enable_load_extension (enabled, /)

          'enabled' が ‘True’ の場合、 SQLite エンジンが共有ライブラリか
          ら SQLite 拡張機能をロードできるようにします。 ‘True’ 以外の場
          合は、 SQLite 拡張機能の読み込みを許可しません。 SQLite 拡張機
          能では、新しい関数の定義、または集計の定義、またはまったく新し
          い仮想テーブルの実装を定義できます。 よく知られている拡張機能
          の 1 つは、SQLite と共に配布される全文検索拡張機能です。

               注釈: ‘sqlite3’ モジュールは、デフォルトではロード可能な
               拡張機能をサポートするようにビルドされていません。一部の
               プラットフォーム(特に macOS)には、この機能なしでコンパイ
               ルされた SQLite ライブラリがあるためです。 ロード可能な拡
               張機能のサポートを得るには、 ‘configure’ に *note
               -enable-loadable-sqlite-extensions: 236e. オプションを渡
               す必要があります。

          引数 ‘connection’, ‘enabled’ を指定して *note 監査イベント:
          1e84. ‘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(): c1b.
          で拡張機能の読み込みを有効にしてください。


          パラメータ:

             * ‘path’ (*note str: 1ea.) - SQLite 拡張機能(extension)への
               パス(path)。

             * ‘entrypoint’ (*note str: 1ea.‘ | ’‘None’) - エントリ・ポ
               イント名。 ‘None’ (デフォルト) の場合、 SQLite は自分自身
               でエントリ・ポイント名を推測します。 詳細については、
               SQLite ドキュメント Loading an Extension(2) を参照してく
               ださい。

          引数 ‘connection’, ‘path’ を指定して *note 監査イベント: 1e84.
          ‘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: 6d4. を返します。 後で復元するためにメモリ内データベ
          ースを保存する場合に便利です。 ‘sqlite3’ シェルの ‘.dump’ コマ
          ンドに似ています。


          パラメータ: ‘filter’ (*note str: 1ea.‘ | ’‘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: 2fdf.

          バージョン 3.13 で変更: 'filter' パラメータが追加されました。

      -- メソッド: backup (target, *, pages=-1, progress=None,
               name='main', sleep=0.250)

          SQLite データベースのバックアップを作成します。

          データベースが他のクライアントによってアクセスされている場合、
          または同一の接続によって並行にアクセスされている場合でも機能し
          ます。


          パラメータ:

             * ‘target’ (*note Connection: 3e6.) - バックアップ先のデー
               タベース接続(connection)。

             * ‘pages’ (*note int: 32e.) - 一度にコピーするページ数。
               ‘0’ 以下の場合、データベース全体がワンステップでコピーさ
               れます。 デフォルトは ‘-1’ です。

             * ‘progress’ (*note callback: 2fdb. | None) - *note
               呼び出し可能オブジェクト: 2fba. を設定すると、バックアッ
               プの指定ページ数単位の反復ごとに 3 つの整数引数で呼び出さ
               れます。 'status' は、最後の反復時のステータスで、
               'remaining' はまだコピーされていない残りのページ数で、
               'total' はコピーされるページの合計です。 デフォルトは
               ‘None’ です。

             * ‘name’ (*note str: 1ea.) - バックアップするデータベース名
               。 ‘"main"’ (メイン・データベース。これがデフォルトです
               )、または ‘"temp"’ (一時データベース)、 または ‘ATTACH
               DATABASE’ SQL文を使用して取り付けられたカスタム・データベ
               ース名の、いずれかです。

             * ‘sleep’ (*note float: 32f.) - バックアップの指定ページ数
               単位の反復ごとにスリープする秒数。

          例 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: 2fdf.

      -- メソッド: getlimit (category, /)

          接続(connection)の実行時制限を取得します。


          パラメータ: ‘category’ (*note int: 32e.) - 問い合わせを行う実
          行時制限カテゴリー(SQLite limit category(3))。


          戻り値の型: *note int: 32e.


          例外: *note ProgrammingError: 584. - 'category' に、 背後の
          SQLite ライブラリが認識できないカテゴリーを指定した場合に送出
          されます。

          例: *note Connection: 3e6. の ‘con’ の SQL 文の最大長を照会し
          ます (デフォルトは 1000000000 です):

               >>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)
               1000000000

          Added in version 3.11.

      -- メソッド: setlimit (category, limit, /)

          接続の実行時制限を設定します。 コンパイル時上限を超えて制限を
          増やそうとすると、 暗黙のうちにコンパイル時上限に切り捨てられ
          ます。 制限が変更されたかどうかに関係なく、 制限の以前の値が返
          されます。


          パラメータ:

             * ‘category’ (*note int: 32e.) - SQLite limit category(4) を
               設定する。

             * ‘limit’ (*note int: 32e.) - 新しい制限の値。 負数の場合、
               現在の制限は変更されません。


          戻り値の型: *note int: 32e.


          例外: *note ProgrammingError: 584. - 'category' に、 背後の
          SQLite ライブラリが認識できないカテゴリーを指定した場合に送出
          されます。

          *note Connection: 3e6. の ‘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: 32e.) - *note SQLITE_DBCONFIG
          code: 2fc2. を指定します。


          戻り値の型: *note bool: 5f6.

          Added in version 3.12.

      -- メソッド: setconfig (op, enable=True, /)

          ブール値の接続構成オプションを設定します。


          パラメータ:

             * ‘op’ (*note int: 32e.) - *note SQLITE_DBCONFIG code:
               2fc2. を指定します。

             * ‘enable’ (*note bool: 5f6.) - 設定オプションを有効にする
               必要がある場合は ‘True’ (デフォルト)。 無効にする場合は
               ‘False’ を指定します。

          Added in version 3.12.

      -- メソッド: serialize (*, name='main')

          データベースを *note bytes: 1d2. オブジェクトに直列化
          (serialize)します。 通常のディスク上のデータベース・ファイルの
          場合、 直列化はディスク・ファイルの単なるコピーです。 インメモ
          リ・データベースまたは "temp" データベースの場合、 直列化は、
          そのデータベースがディスクにバックアップされた場合にディスクに
          書き込まれるバイト・シーケンスと同じです。


          パラメータ: ‘name’ (*note str: 1ea.) - 直列化するデータベース
          名。 デフォルトは ‘"main"’ です。


          戻り値の型: *note bytes: 1d2.

               注釈: このメソッドは、 背後の SQLite ライブラリに直列化
               API がある場合にのみ使用できます。

          Added in version 3.11.

      -- メソッド: deserialize (data, /, *, name='main')

          *note 直列化: a73. されたデータベースを *note Connection: 3e6.
          に、 脱直列化(deserialize)します。 このメソッドにより、 データ
          ベース接続はデータベース 'name' から切断され、そして、 'data'
          に含まれる直列化データに基づいて、 データベース 'name' がイン
          メモリ・データベースとして再度開かれます。


          パラメータ:

             * ‘data’ (*note bytes: 1d2.) - 直列化されたデータベース。

             * ‘name’ (*note str: 1ea.) - 脱直列化(deserialize)したデー
               タを入れるデータベース名。 デフォルトは ‘"main"’ です。


          例外:

             * *note OperationalError: 1e68. - データベース接続が読み取
               りトランザクションやバックアップ操作中の場合。

             * *note DatabaseError: 2fde. - 'data' に有効な SQLite デー
               タベースが含まれていない場合。

             * *note OverflowError: c5b. - *note len(data): a24. が
               ‘2**63 - 1’ より大きい場合。

               注釈: このメソッドは、 背後の SQLite ライブラリに脱直列化
               API がある場合にのみ使用できます。

          Added in version 3.11.

      -- の属性: autocommit

          この属性は、 PEP 249(5) 対応のトランザクションの振る舞いを制御
          します。 ‘auto​​commit’ には以下の 3 つの値が指定できます:

             * ‘False’: PEP 249(6) 対応のトランザクションの振る舞いを選
               びます。 これは、 ‘sqlite3’ が、 トランザクションが常に開
               いていることを保証することを意味します。トランザクション
               を閉じるには、 *note commit(): 2fa6. や *note rollback():
               2fd6. を使用します。

               これが ‘auto​​commit’ の推奨値です。

             * ‘True’: SQLite の autocommit mode(7) を使用します。このモ
               ードでは *note commit(): 2fa6. や *note rollback(): 2fd6.
               は効果がありません。

             * *note LEGACY_TRANSACTION_CONTROL: 2fb5.: Python 3.12 より
               前( PEP 249(8) 非対応)のトランザクション制御。 詳細につい
               ては *note isolation_level: 2fb3. を参照してください。

               これが、今のところは、 ‘auto​​commit’ のデフォルト値です。

          ‘auto​​commit’ を ‘False’ に変更すると新しいトランザクションが開
          き、 ‘True’ に変更すると保留中のトランザクションがコミットされ
          ます。

          詳細は *note autocommit 属性に依るトランザクション制御: 8cc. を
          参照してください。

               注釈: *note isolation_level: 2fb3. 属性は、 *note
               autocommit: 8cb. の値が *note LEGACY_TRANSACTION_CONTROL:
               2fb5. でない限り、効果がありません。

          Added in version 3.12.

      -- の属性: in_transaction

          この読み取り専用属性は、低レベルの SQLite autocommit mode(9) に
          対応します。

          トランザクションがアクティブな場合 (コミットされていない変更が
          ある場合) は ‘True’ 、それ以外の場合は ‘False’ です。

          Added in version 3.2.

      -- の属性: isolation_level

          ‘sqlite3’ の *note 旧来のトランザクション処理モード: 2fb4. を
          制御します。 ‘None’ に設定すると、トランザクションは暗黙に開か
          れることはありません。背後の SQLite の SQLite transaction
          behaviour(10) に対応する ‘"DEFERRED"’ または ‘"IMMEDIATE"’ ま
          たは ‘"EXCLUSIVE"’ のいずれかに設定すると、 *note
          暗黙のトランザクション管理: 2fb4. が実行されます。

          *note connect(): 3e7. の 'isolation_level' パラメーターでオー
          バーライドされない場合、 デフォルトは ‘""’ で、 これは
          ‘"DEFERRED"’ の別名です。

               注釈: トランザクション処理を制御するには、
               ‘isolation_level’ を使用するよりも *note autocommit: 8cb.
               を使用することをお勧めします。 ‘autocommit’ が *note
               LEGACY_TRANSACTION_CONTROL: 2fb5. (これがデフォルトです
               )に設定されていない限り、 ‘isolation_level’ は効果があり
               ません。

      -- の属性: row_factory

          この接続から作成された *note Cursor: 2fa3. オブジェクトの初期
          *note row_factory: 2fe1. 。この属性に割り当てを行っても、 この
          接続に属する、すでに存在するカーソルの ‘row_factory’ には影響
          せず、 この属性に割り当てを行った後に作成する新しいカーソルの
          みに影響します。 デフォルトでは ‘None’ です。つまり、各行は
          *note タプル: 1d9. として返されます。

          詳細は *note 行工場(row factories)の作成方法と使用方法: 2faa.
          をご覧下さい。

      -- の属性: text_factory

          *note bytes: 1d2. のパラメータを受け取り、そのテキスト表現を返
          す *note 呼び出し可能オブジェクト: 2fba. です。呼び出し可能オ
          ブジェクトは ‘TEXT’ データ型である SQLite 値に対して呼び出され
          ます。 デフォルトでは、 この属性は *note str: 1ea. に設定され
          ています。

          See *note How to handle non-UTF-8 text encodings: 2fdf. for
          more details.

      -- の属性: total_changes

          データベース接続が開かれてから、変更または挿入または削除された
          データベース行の総数を返します。

   ---------- Footnotes ----------

   (1) https://sqlite.org/deterministic.html

   (2) https://www.sqlite.org/loadext.html#loading_an_extension

   (3) https://www.sqlite.org/c3ref/c_limit_attached.html

   (4) https://www.sqlite.org/c3ref/c_limit_attached.html

   (5) https://peps.python.org/pep-0249/

   (6) https://peps.python.org/pep-0249/

   (7) 
https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions

   (8) https://peps.python.org/pep-0249/

   (9) 
https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions

   (10) 
https://www.sqlite.org/lang_transaction.html#deferred_immediate_and_exclusive_transactions


File: python.info,  Node: Cursor オブジェクト,  Next: Row オブジェクト,  Prev: Connection オブジェクト,  Up: リファレンス

5.13.6.6 Cursor オブジェクト
............................

     ‘Cursor’ オブジェクトは、 SQL 文を実行し、 取得操作(fetch
     operation)のコンテキストを管理するために使用されるデータベース・カ
     ーソル(database cursor(1))を表します。カーソルは、 *note
     Connection.cursor(): 2fa2. または *note
     接続(connection)ショートカット・メソッド: 2fd5. の、いずれかを使用
     して作成されます。

     カーソル・オブジェクトは *note イテレータ: 6d4. です。つまり、
     ‘SELECT’ クエリに対して *note execute(): 7ae. した場合、結果の行
     (rows)を取得するためには、カーソルを単純に反復(iterate)できます:

          for row in cur.execute("SELECT t FROM data"):
              print(row)

 -- クラス: sqlite3.Cursor

     *note Cursor: 2fa3. インスタンスは以下の属性やメソッドを持ちます。

      -- メソッド: execute (sql, parameters=(), /)

          Execute a single SQL statement, optionally binding Python
          values using *note placeholders: 7b0.


          パラメータ:

             * ‘sql’ (*note str: 1ea.) - 単一の SQL 文。

             * ‘parameters’ (*note dict: 193. | *note sequence: 904.) -
               'sql' のプレースホルダに結び付け(bind)する Python 値。 名
               前付きプレースホルダが使用されている場合は ‘dict’ です。
               名前のないプレースホルダが使用されている場合は sequence で
               す。 *note プレースホルダを使用して SQL
               クエリに値を結び付ける方法: 7b0. を参照してください。


          例外: *note ProgrammingError: 584. - When 'sql' contains more
          than one SQL statement.  When *note named placeholders: 7b0.
          are used and 'parameters' is a sequence instead of a *note
          dict: 193.

          *note autocommit: 8cb. が *note LEGACY_TRANSACTION_CONTROL:
          2fb5. で、かつ、 *note isolation_level: 2fb3. が ‘None’ で無く
          、 かつ、 'sql' が ‘INSERT’ または ‘UPDATE’ または ‘DELETE’ ま
          たは ‘REPLACE’ 文で、かつ、開いているトランザクションがない場
          合、 'sql' を実行する前にトランザクションが暗黙に開かれます。

          バージョン 3.14 で変更: *note ProgrammingError: 584. is
          emitted if *note named placeholders: 7b0. are used and
          'parameters' is a sequence instead of a *note dict: 193.

          複数の SQL 文を実行するには *note executescript(): 2fda. を使
          用します。

      -- メソッド: executemany (sql, parameters, /)

          'parameters' のすべての item に対して、 *note パラメーター化:
          7b0. された DML (Data Manipulation Language) SQL 文である
          'sql' を繰り返し実行します。

          *note execute(): 7ae. と同一の暗黙のトランザクション処理を使用
          します。


          パラメータ:

             * ‘sql’ (*note str: 1ea.) - 単一の DML 文。

             * ‘parameters’ (*note iterable: 149a.) - 'sql' のプレースホ
               ルダに結び付け(bind)するためのパラメータの iterable 。
               *note プレースホルダを使用して SQL
               クエリに値を結び付ける方法: 7b0. 参照。


          例外: *note ProgrammingError: 584. - When 'sql' contains more
          than one SQL statement or is not a DML statement, When *note
          named placeholders: 7b0. are used and the items in
          'parameters' are sequences instead of *note dict: 193.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: 584. is
          emitted if *note named placeholders: 7b0. are used and the
          items in 'parameters' are sequences instead of *note dict:
          193.s.

      -- メソッド: executescript (sql_script, /)

          'sql_script' 内の複数のSQL文を実行します。 *note autocommit:
          8cb. が *note LEGACY_TRANSACTION_CONTROL: 2fb5. で、かつ、保留
          中のトランザクションがある場合、暗黙の ‘COMMIT’ 文が最初に実行
          されます。その他の暗黙のトランザクション制御は実行されませんの
          で、トランザクション制御を 'sql_script' に追加しなければなりま
          せん。

          'sql_script' は *note 文字列: 1ea. でなければなりません。

          例:

               # 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: 2fe1. が ‘None’ の場合、 次の行のクエリ結果
          セットを *note タプル: 1d9. として返します。それ以外の場合は、
          それを行工場(row factory)に渡し、 その結果を返します。 これ以
          上データが無い場合は ‘None’ を返します。

      -- メソッド: fetchmany (size=cursor.arraysize)

          クエリ結果の次の行セットを *note list: 4e0. として返します。行
          がそれ以上ない場合は、空のリストを返します。

          呼び出しごとに取得する行数は、'size' パラメーターで指定されま
          す。 'size' が指定されていない場合、 *note arraysize: 1a10. が
          取得する行数を決定します。有効な行の数が 'size' 未満の場合は、
          有効な数の行が返されます。

          'size' 引数とパフォーマンスの関係についての注意です。パフォー
          マンスを最適化するためには、大抵、 arraysize 属性を利用するの
          がベストです。 'size' 引数を利用したのであれば、次回の *note
          fetchmany(): 1a0f. の呼び出しでも 'size' 引数に同一の値を指定
          するのがのがベストです。

          バージョン 3.15 で変更: Negative 'size' values are rejected by
          raising *note ValueError: 15a.

      -- メソッド: fetchall ()

          クエリ結果の(残りの)すべての行を *note list: 4e0. として返しま
          す。 有効な行がない場合は、空のリストを返します。 *note
          arraysize: 1a10. 属性は、この操作のパフォーマンスに影響を与え
          る可能性があることに注意してください。

      -- メソッド: close ()

          (‘__del__’ が呼び出される時ではなく、) 今すぐカーソルを閉じま
          す。

          この時点から、このカーソルは使用できなくなります。今後、このカ
          ーソルで何らかの操作を試みると、 *note ProgrammingError: 584.
          例外が送出されます。

      -- メソッド: setinputsizes (sizes, /)

          DB-API で必要です。 ‘sqlite3’ では何もしません。

      -- メソッド: setoutputsize (size, column=None, /)

          DB-API で必要です。 ‘sqlite3’ では何もしません。

      -- の属性: arraysize

          *note fetchmany(): 1a0f. によって返される行(row)数を制御する、
          読み取りと書き込みが可能な属性。 デフォルト値は 1 で、これは呼
          び出しごとに 1 行が取得されることを意味します。

          バージョン 3.15 で変更: Negative values are rejected by
          raising *note ValueError: 15a.

      -- の属性: connection

          カーソルが属する SQLite データベース *note Connection: 3e6. を
          提供する読み取り専用属性。 *note con.cursor(): 2fa2. と呼び出
          して作成した *note Cursor: 2fa3. オブジェクトには、'con' を参
          照する *note connection: 2fe9. 属性があります:

               >>> 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(): 7ae. で ‘INSERT’ または ‘REPLACE’ 文が成功
          した後にのみ更新されます。他のSQL文や、 *note executemany():
          7af. の後や、 *note executescript(): 2fda. の後や、 挿入が失敗
          した場合、 ‘lastrowid’ の値は変更されません。‘lastrowid’ の初
          期値は ‘None’ です。

               注釈: ‘WITHOUT ROWID’ テーブルへの挿入(insert)は記録され
               ません。

          バージョン 3.6 で変更: ‘REPLACE’ 文のサポートが追加されました
          。

      -- の属性: rowcount

          ‘INSERT’ や ‘UPDATE’ や ‘DELETE’ や ‘REPLACE’ 文で変更された行
          数を提供する読み取り専用属性。 CTE (共通テーブル式) クエリを含
          む他のSQL文は ‘-1’ です。 *note execute(): 7ae. と *note
          executemany(): 7af. メソッドのみにおいて、 SQL文(statement)実
          行の完了後に更新されます。 なぜなら ‘rowcount’ を更新するため
          には、結果の行を取得(fetch)しなければならないからです。

      -- の属性: row_factory

          この ‘カーソル’ から取得された行の表現方法を制御します。
          ‘None’ の場合、行は *note タプル: 1d9. として表されます。
          *note sqlite3.Row: 1225. に設定することもできます。 そしてまた
          、 *note Cursor: 2fa3. オブジェクトと、 行の値の ‘タプル’ の、
          2 つの引数を受け取り、 SQLite の行(row)を表すカスタム・オブジ
          ェクトを返す、 *note 呼び出し可能オブジェクト: 2fba. に設定す
          ることもできます。

          ‘カーソル・オブジェクト’ の作成時に *note
          Connection.row_factory: 1bcf. の値をこの属性のデフォルト値とし
          て設定します。この属性に割り当てても、親接続(parent
          connection)の ‘Connection.row_factory’ には影響しません。

          詳細は *note 行工場(row factories)の作成方法と使用方法: 2faa.
          をご覧下さい。

   ---------- 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: 3e6. オブジェクトの、高度
     に最適化された *note row_factory: 1bcf. の役割をします。 反復
     (iteration)や、等しいかどうかのテスト(equality testing)や、 *note
     len(): a24. 関数や 、 列名(column name)とインデックスによる *note
     マッピング: 1579. のアクセスを、サポートします。

     列名(column names)と値(values)が全く同一である 2 つの ‘Row’ オブジ
     ェクトを比較すると、等しいと見なされます。

     詳細は *note 行工場(row factories)の作成方法と使用方法: 2faa. をご
     覧下さい。

      -- メソッド: keys ()

          列名(column names)の *note リスト: 4e0. を *note 文字列: 1ea.
          として返します。 クエリの直後であれば、それは *note
          Cursor.description: 1aed. の各タプルの最初のメンバーです。

     バージョン 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: a77. インスタンスは、 SQLite の BLOB とデータを読み書き
     できる *note file-like object: 19d1. です。 *note len(blob): a24. を
     呼び出して、 Blob のサイズ (バイト数) を取得します。 Blob データに
     直接アクセスするには、インデックスと *note スライス: 26c4. を使用し
     ます。

     *note Blob: a77. を *note コンテキストマネージャ: 47f. として使用し
     て、 使用後に 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: 1e3b. (またはそのサブクラスの)
          例外を送出します。

      -- メソッド: read (length=-1, /)

          BLOB の現在のオフセット位置から 'length' バイトのデータを読み
          取り返ます。 BLOB の現在のオフセット位置から末尾までの残りが
          'length' バイトよりも少ない場合、末尾までのデータを読み取りま
          す。 'length' が指定されていない場合、 または負数の場合、
          *note read(): 2ff1. は BLOB の現在のオフセット位置から末尾まで
          のデータを読み取ります。

      -- メソッド: write (data, /)

          BLOB の現在のオフセット位置から 'data' を書き込みます。 この関
          数では BLOB の長さを変更できません。 BLOB の末尾を超えて書き込
          もうとすると *note ValueError: 15a. を送出します。

      -- メソッド: 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: 1647.
          (absolute blob positioning).  Other values for 'origin' are
          *note os.SEEK_CUR: 1648. (seek relative to the current
          position) and *note os.SEEK_END: 1649. (seek relative to the
          blob’s end).


File: python.info,  Node: PrepareProtocol オブジェクト,  Next: 例外<8>,  Prev: Blob オブジェクト,  Up: リファレンス

5.13.6.9 PrepareProtocol オブジェクト
.....................................

 -- クラス: sqlite3.PrepareProtocol

     PrepareProtocol 型の唯一の目的は、 *note SQLite
     でネイティブにサポートされている型: 2faf. に *note
     オブジェクト自身で適合(adapt): 2ff6. できるオブジェクトの PEP
     246(1) スタイルの適合プロトコルとして機能することです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0246/


File: python.info,  Node: 例外<8>,  Next: SQLite と Python の型,  Prev: PrepareProtocol オブジェクト,  Up: リファレンス

5.13.6.10 例外
..............

例外の階層は DB-API 2.0 ( PEP 249(1)) で定義されています。

 -- 例外: sqlite3.Warning

     この例外は、現在 ‘sqlite3’ モジュールでは送出しませんが、ユーザー定
     義関数が挿入処理中にデータを切り捨てる場合など、‘sqlite3’ を使用す
     るアプリケーションによって送出されるる可能性があります。 ‘Warning’
     は *note Exception: da2. のサブクラスです。

 -- 例外: sqlite3.Error

     このモジュールの他の例外の基底となるクラス。 これを使用すると、1 つ
     の *note except: 44e. 文ですべてのエラーをキャッチできます。
     ‘Error’ は *note Exception: da2. のサブクラスです。

     例外が 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: 1e3b. のサブクラスです。

 -- 例外: sqlite3.DatabaseError

     データベースに関連するエラーに対して送出される例外。 これは、いくつ
     かの種類のデータベース・エラーの基底の例外として機能します。 これを
     特殊化(specialise)したサブクラスを介して暗黙的にのみ送出されます。
     ‘DatabaseError’ は *note Error: 1e3b. のサブクラスです。

 -- 例外: sqlite3.DataError

     範囲外の数値や長すぎる文字列など、処理されたデータの問題によって発
     生したエラーに対して送出される例外。 ‘DataError’ は *note
     DatabaseError: 2fde. のサブクラスです。

 -- 例外: sqlite3.OperationalError

     データベースの操作に関連し、必ずしもプログラマの制御下にないエラー
     に対して発生する例外。 たとえば、データベース・パスが見つからないと
     か、トランザクションを処理できませんでした等。 ‘OperationalError’ は
     *note DatabaseError: 2fde. のサブクラスです。

 -- 例外: sqlite3.IntegrityError

     データベースの参照整合性が影響を受ける場合に発生する例外。 たとえば
     外部キーのチェック(foreign key check)が失敗したとき。 *note
     DatabaseError: 2fde. のサブクラスです。

 -- 例外: sqlite3.InternalError

     SQLite が内部エラーに遭遇したときに発生する例外。 これが送出された
     場合、ランタイム SQLite ライブラリに問題があることを示している可能
     性があります。 ‘InternalError’ は *note DatabaseError: 2fde. のサブ
     クラスです。

 -- 例外: sqlite3.ProgrammingError

     ‘sqlite3’ API プログラミング・エラーに対して送出される例外。たとえ
     ば、クエリに間違った数のバインディング(結び付け)を指定したり、閉じ
     た後の *note Connection: 3e6. を操作しようとしたりしたとき。
     ‘ProgrammingError’ は *note DatabaseError: 2fde. のサブクラスです。

 -- 例外: sqlite3.NotSupportedError

     メソッドまたはデータベース API が 背後の SQLite ライブラリでサポー
     トしていない場合に送出される例外。たとえば、背後の SQLite ライブラ
     リが決定論的関数(deterministic functions)をサポートしていない場合に
     、*note create_function(): 3e8. で 'deterministic' を ‘True’ に設定
     したとき。 ‘NotSupportedError’ は *note DatabaseError: 2fde. のサブ
     クラスです。

   ---------- 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: 例外<8>,  Up: リファレンス

5.13.6.11 SQLite と Python の型
...............................

SQLite は以下の型をネイティブにサポートします: ‘NULL’, ‘INTEGER’,
‘REAL’, ‘TEXT’, ‘BLOB’。

したがって、次の Python の型は問題なく SQLite に送り込めます:

Python の型                         SQLite の型
                                    
------------------------------------------------------
                                    
‘None’                              ‘NULL’
                                    
                                    
*note int: 32e.                     ‘INTEGER’
                                    
                                    
*note float: 32f.                   ‘REAL’
                                    
                                    
*note str: 1ea.                     ‘TEXT’
                                    
                                    
*note bytes: 1d2.                   ‘BLOB’
                                    

SQLite の型から Python の型へのデフォルトでの変換は以下の通りです:

SQLite の型       Python の型
                  
---------------------------------------------------------------------
                  
‘NULL’            ‘None’
                  
                  
‘INTEGER’         *note int: 32e.
                  
                  
‘REAL’            *note float: 32f.
                  
                  
‘TEXT’            *note text_factory: 2fe2. に依存する。デフォルト
                  では *note str: 1ea. 。
                  
                  
‘BLOB’            *note bytes: 1d2.
                  

‘sqlite3’ モジュールの型システムは 2 つの方法で拡張可能です。 *note
オブジェクト適合関数(adapter): 2fa8. を介して SQLite データベースに追加
の Python 型を格納できます。 または、 *note 変換関数(converter): 2fa9. を
介して ‘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 適合関数と変換関数のレシピ集: 903. を利用して、あなたのニーズ
     に合わせて仕立てて下さい。

非推奨の、デフォルトの適合関数(adapters)とデフォルトの変換関数
(converters)は以下のもので構成されています:

   * *note datetime.date: 494. オブジェクトを ISO 8601(1) 形式の *note
     文字列: 1ea. にする適合関数(adapter)。

   * *note datetime.datetime: 6ed. オブジェクトを ISO 8601 形式の文字列
     にする適合関数(adapter)。

   * "date" と *note 宣言された: 2fa9. 型を *note datetime.date: 494. オ
     ブジェクトにする変換関数(converter)。

   * "timestamp" と宣言された型を *note datetime.datetime: 6ed. オブジェ
     クトにする変換関数(converter)。小数部分は 6 桁 (マイクロ秒の精度) に
     切り捨てられます。

     注釈: デフォルトの "timestamp" 変換関数は、データベース内の UTC オ
     フセットを無視し、常に素朴(naive)な *note datetime.datetime: 6ed. オ
     ブジェクトを返します。 timestamp で UTC オフセットを保持するには、
     変換関数を無効のままにするか、あるいは、オフセット対応の変換関数を
     *note register_converter(): 2fb0. に登録します。

バージョン 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: 4d1. スイッチを使用してスクリプトとして呼び出すことができ
ます。引数は以下のとおりです:

     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(): 7ae. メソッドの 2 番目の引数にPythonの変数を値の
*note タプル: 1d9. として指定することにより、 実際の値をクエリに割り当て
ます。

SQL 文では、疑問符 (qmark スタイル) または名前付きプレースホルダー (名前
付きスタイル) の 2 種類のプレースホルダーのいずれかを使用できます。
qmark スタイルの場合、'parameters' は、 *note シーケンス: 904. でなけれ
ばならず、シーケンスの長さがプレースホルダーの数と一致する必要があります
。そうでなければ、 *note ProgrammingError: 584. を送出します。名前付きス
タイルの場合、 'parameters' は *note dict: 193. (またはそのサブクラス) の
インスタンスである必要があり、すべての名前付きパラメーターのキーが含まれ
ている必要があります。余分な項目は無視されます。両方のスタイルの例を以下
に示します。

     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 型: 2faf. のいずれかに '適合' (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:
1d87. 型になります。

     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(): 2fb9.
を使用して登録できます。

     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: 1d2. オブジェクトで渡されます。

     def convert_point(s):
         x, y = map(float, s.split(b";"))
         return Point(x, y)

与えられた SQLite 値をどの時点で変換すべきかを ‘sqlite3’ に伝える必要が
あります。これは、 *note connect(): 3e7. の 'detect_types' パラメータを
使用して、データベースに接続する際に行います。 以下の 3 つの選択肢があり
ます:

   * 暗黙的: 'detect_types' に *note PARSE_DECLTYPES: 2fb1. と設定。

   * 明示的: 'detect_types' に *note PARSE_COLNAMES: 2fb2. と設定。

   * 両方: '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: 3e6. クラスのメソッド *note execute(): 2fd7. と *note
executemany(): 2fd8. と *note executescript(): 2fd9. を使うことで、 (し
ばしば余計な) *note Cursor: 2fa3. オブジェクトをわざわざ作り出さずに済む
ので、コードをより簡潔に書くことができます。 ‘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: 3e6. オブジェクトは、コンテキスト・マネージャーとして
使用でき、コンテキスト・マネージャーとして使用すると、 *note with: 215.
ブロックを離れるときに、開いているトランザクションを自動的にコミットまた
はロールバックします。 ‘with’ 文のブロックが例外なく終了すると、トランザ
クションはコミットされます。このコミットが失敗した、または、 ‘with’ 文の
ブロックでキャッチされなかった例外が発生した場合、トランザクションはロー
ルバックされます。 *note autocommit: 8cb. が ‘False’ の場合、コミット後
またはロールバック後に新しいトランザクションが暗黙に開かれます。

‘with’ 文のブロックを離れるときに開いているトランザクションがない、また
は、 *note autocommit: 8cb. が ‘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(): 3f3.

     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: 1e68. が送出されます:

     >>> 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 タプル: 1d9. として表しま
す。 ‘タプル’ があなたのニーズと合わない場合は、 *note sqlite3.Row:
1225. クラスまたはカスタム *note row_factory: 2fe1. を使用できます。

‘row_factory’ は *note Cursor: 2fa3. と *note Connection: 3e6. の両方に
属性として存在しますが、 その接続(connection)から作成されたすべてのカー
ソルが同一の行工場(row factory)を使用するようにするために、 *note
Connection.row_factory: 1bcf. を設定することをお勧めします。

‘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: 193. として行を返す、カスタム
*note row_factory: 2fe1. を作成することもできます:

     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 名前付きタプル: a42. を返します:

     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: 1da. の代わりに *note
dataclass: 6ec. または、その他のカスタム・クラスを使用するように適合
(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: 1ea. 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: 2fe2. 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: 3e6. instance ‘con’ connected to this database, we can
decode the Latin-2 encoded text using this *note text_factory: 2fe2.:

     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: 165e.:

     con.text_factory = lambda data: str(data, errors="surrogateescape")

     注釈: The ‘sqlite3’ module API does not support strings containing
     surrogates.

参考
....

*note Unicode HOWTO: 165e.

   ---------- 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
属性に依るトランザクション制御: 8cc. が推奨されますが、*note
isolation_level 属性に依るトランザクション制御: 2fb4. は Python 3.12 よ
り前の動作を保持します。

* Menu:

* autocommit 属性に依るトランザクション制御::
* isolation_level 属性に依るトランザクション制御::


File: python.info,  Node: autocommit 属性に依るトランザクション制御,  Next: isolation_level 属性に依るトランザクション制御,  Up: トランザクション制御

5.13.6.28 ‘autocommit’ 属性に依るトランザクション制御
.....................................................

トランザクションの動作を制御する推奨方法は、 *note
Connection.autocommit: 8cb. 属性を使用することです。 この属性は *note
connect(): 3e7. の 'autocommit' パラメータを使用して設定して頂けるとあり
がたいです。

'autocommit' を ‘False’ に設定することをお勧めします。そうすると PEP
249(1) 対応のトランザクション制御を行います。これは以下のことを意味しま
す:

   * ‘sqlite3’ はトランザクションが常に開いていることを保証します。その
     ため、 *note connect(): 3e7. や *note Connection.commit(): 2fa6. や
     *note Connection.rollback(): 2fd6. は暗黙に新しいトランザクションを
     開きます(1つ目については保留中のトランザクションを閉じた直後で、後
     の2つについてはその直後に、です)。 ‘sqlite3’ はトランザクションを開
     くときに ‘BEGIN DEFERRED’ 文を使用します。

   * トランザクションは、 ‘commit()’ を使用して明示的にコミットする必要
     があります。

   * トランザクションは、 ‘rollback()’ を使用して明示的にロールバックす
     る必要があります。

   * データベースの保留中に行った変更は *note close(): 755. された場合、
     暗黙のロールバックが実行されます。

'autocommit' を ‘True’ に設定して、SQLite の autocommit mode(2) を有効に
します。このモードでは、 *note Connection.commit(): 2fa6. と *note
Connection.rollback(): 2fd6. は効果がありません。 SQLite の自動コミット
・モード(autocommit mode)は、 PEP 249(3) 対応の *note
Connection.autocommit: 8cb. 属性とは異なることに注意してください。 *note
Connection.in_transaction: 2fe0. を使用して、低レベル SQLite 自動コミッ
ト・モードを問い合わせします。

'autocommit' を *note LEGACY_TRANSACTION_CONTROL: 2fb5. に設定して、トラ
ンザクション制御の振る舞いを *note Connection.isolation_level: 2fb3. 属
性に任せます。詳細については *note isolation_level
属性に依るトランザクション制御: 2fb4. を参照してください。

   ---------- 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: 8cb. 属
     性を使用することです。 *note autocommit
     属性に依るトランザクション制御: 8cc. を参照してください。

*note Connection.autocommit: 8cb. が *note LEGACY_TRANSACTION_CONTROL:
2fb5. (これがデフォルトです)に設定されている場合、トランザクションの振る
舞いは *note Connection.isolation_level: 2fb3. 属性を使用して制御されま
す。 ‘LEGACY_TRANSACTION_CONTROL’ 以外の場合、 ‘isolation_level’ は効果
がありません。

接続属性 *note isolation_level: 2fb3. が ‘None’ で無いのなら、 *note
execute(): 7ae. や *note executemany(): 7af. が ‘INSERT’ または ‘UPDATE’
または ‘DELETE’ または ‘REPLACE’ 文を実行する前に新しいトランザクション
が暗黙に開かれます。それ以外のSQL文では暗黙のトランザクション処理は行わ
れません。 *note commit(): 2fa6. メソッドや *note rollback(): 2fd6. メソ
ッドを使用して、 保留中のトランザクションをそれぞれコミットおよびロール
バックします。あなたは、背後にある SQLite ライブラリのトランザクションの
振る舞い(SQLite transaction behaviour(1)) — つまり、 sqlite3 が暗黙に実
行する ‘BEGIN’ 文の有無とその種類 – を、 ‘isolation_level’ 属性を介して
選択できます。

*note isolation_level: 2fb3. が ‘None’ に設定されていると、トランザクシ
ョンは暗黙に開かれません。これにより、背後にある SQLite ライブラリを自動
コミット・モード(autocommit mode(2))にしたまま、 明示的な SQL 文を使用し
て、 ユーザが独自のトランザクション処理を行えるようにします。背後にある
SQLite ライブラリの自動コミット・モードは、 *note in_transaction: 2fe0.
属性を使用して問い合わせできます。

*note executescript(): 2fda. メソッドは、 *note isolation_level: 2fb3. の
値に関係なく、与えられた SQL スクリプトの実行前に、保留中のトランザクシ
ョンを暗黙にコミットします。

バージョン 3.6 で変更: ‘sqlite3’ は、 DDL文の前に、開いているトランザク
ションを暗黙にコミットしていました。これはもはや当てはまりません。

バージョン 3.12 で変更: 推奨のトランザクションを制御方法は、 *note
autocommit: 8cb. 属性を使用することです。

   ---------- 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 アーカイブ化操作: 15d5.
provided by the *note shutil: cd. 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: 6a.

   * ‘compression.lzma’ - Re-exports *note lzma: 8d.

   * ‘compression.zlib’ - Re-exports *note zlib: 13c.

   * *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(): 301b. function and *note ZstdFile: 301c. class
     for reading and writing compressed files.

   * The *note ZstdCompressor: 301d. and *note ZstdDecompressor: 192c.
     classes for incremental (de)compression.

   * 一度に圧縮・展開を行う *note compress(): 301e. および *note
     decompress(): 301f. 関数。

   * The *note train_dict(): 3020. and *note finalize_dict(): 3021.
     functions and the *note ZstdDict: 3022. class to train and manage
     Zstandard dictionaries.

   * The *note CompressionParameter: 3023, *note DecompressionParameter:
     3024, and *note Strategy: 3025. classes for setting advanced
     (de)compression parameters.

This is an *note optional module: 2366.  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
オプションのモジュールの要件: 2364.

* Menu:

* 例外: 例外<9>.
* 圧縮ファイルへの読み書き::
* メモリ上での圧縮と展開::
* Zstandard dictionaries::
* Advanced parameter control::
* その他: その他<3>.
* 使用例: 使用例<14>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/compression/zstd/__init__.py

   (2) https://facebook.github.io/zstd/doc/api_manual_latest.html


File: python.info,  Node: 例外<9>,  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: 例外<9>,  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: 1581.

     The 'file' argument can be either a file name (given as a *note
     str: 1ea, *note bytes: 1d2. or *note path-like: 7a5. 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: 3024. for detailed information about
     supported parameters.  The 'zstd_dict' argument is a *note
     ZstdDict: 3022. 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:
     3023. 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: 3022. instance to be
     used during compression.

     In binary mode, this function is equivalent to the *note ZstdFile:
     301c. constructor: ‘ZstdFile(file, mode, ...)’.  In this case, the
     'encoding', 'errors', and 'newline' parameters must not be
     provided.

     In text mode, a *note ZstdFile: 301c. object is created, and
     wrapped in an *note io.TextIOWrapper: ba0. 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: 1581, 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: 1ea, *note bytes: 1d2. or *note path-like: 7a5.
     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: 3024. for detailed information about
     supported parameters.  The 'zstd_dict' argument is a *note
     ZstdDict: 3022. 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:
     3023. 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: 3022. instance to be
     used during compression.

     ‘ZstdFile’ supports all the members specified by *note
     io.BufferedIOBase: a88, except for *note detach(): 3029. and *note
     truncate(): 16ca.  Iteration and the *note with: 215. 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:
          302d. attribute of the underlying *note file object: 1581.


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: 43d.), returning the
     compressed data as a *note bytes: 1d2. object.

     The 'level' argument is an integer controlling the level of
     compression.  'level' is an alternative to setting *note
     CompressionParameter.compression_level: 302f. in 'options'.  Use
     *note bounds(): 3030. 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: 3023. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 3022.
     containing trained data to improve compression efficiency.  The
     function *note train_dict(): 3020. can be used to generate a
     Zstandard dictionary.

 -- の関数: compression.zstd.decompress (data, zstd_dict=None,
          options=None)

     Decompress 'data' (a *note bytes-like object: 43d.), returning the
     uncompressed data as a *note bytes: 1d2. 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: 3024. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 3022.
     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(): 301e.

     The 'level' argument is an integer controlling the level of
     compression.  'level' is an alternative to setting *note
     CompressionParameter.compression_level: 302f. in 'options'.  Use
     *note bounds(): 3030. 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: 3023. documentation.

     The 'zstd_dict' argument is an optional instance of *note ZstdDict:
     3022. containing trained data to improve compression efficiency.
     The function *note train_dict(): 3020. can be used to generate a
     Zstandard dictionary.

      -- メソッド: compress (data, mode=ZstdCompressor.CONTINUE)

          Compress 'data' (a *note bytes-like object: 43d.), returning a
          *note bytes: 1d2. 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(): 3032.  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: 3033, *note FLUSH_BLOCK: 3034, or *note
          FLUSH_FRAME: 3035.

          When all data has been provided to the compressor, call the
          *note flush(): 3032. method to finish the compression process.
          If ‘compress()’ is called with 'mode' set to *note
          FLUSH_FRAME: 3035, ‘flush()’ should not be called, as it would
          write out a new empty frame.

      -- メソッド: flush (mode=ZstdCompressor.FLUSH_FRAME)

          圧縮処理を終了し、コンプレッサの内部バッファにあるあらゆるデー
          タを格納する *note bytes: 1d2. オブジェクトを返します。

          The 'mode' argument is a ‘ZstdCompressor’ attribute, either
          *note FLUSH_BLOCK: 3034, or *note FLUSH_FRAME: 3035.

      -- メソッド: 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: 3037. 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: 3038. is not *note FLUSH_FRAME: 3035, a
          *note ValueError: 15a. 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(): 3031, future
          calls to ‘compress()’ or *note flush(): 3032. may raise *note
          ZstdError: 3027. and the last chunk of data may be lost.

          After *note flush(): 3032. or *note compress(): 3031. are
          called with mode *note FLUSH_FRAME: 3035, 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(): 3031, improving compression.

      -- の属性: FLUSH_FRAME

          Complete and write out a frame.  Future data provided to *note
          compress(): 3031. will be written into a new frame and
          'cannot' reference past data.

      -- の属性: last_mode

          The last mode passed to either *note compress(): 3031. or
          *note flush(): 3032.  The value can be one of *note CONTINUE:
          3033, *note FLUSH_BLOCK: 3034, or *note FLUSH_FRAME: 3035.
          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():
     301f.

     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: 3024. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 3022.
     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(): 301f. function and *note ZstdFile: 301c. class.
          To decompress a multi-frame input, you should use
          ‘decompress()’, ‘ZstdFile’ if working with a *note file
          object: 1581, or multiple ‘ZstdDecompressor’ instances.

      -- メソッド: decompress (data, max_length=-1)

          Decompress 'data' (a *note bytes-like object: 43d.), 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 (or EOF is
          reached), the *note needs_input: 303a. 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.  The
          full content can thus be read like:

               process_output(d.decompress(data, max_length))
               while not d.eof and not d.needs_input:
                   process_output(d.decompress(b"", max_length))

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          303a. 属性は ‘True’ になります。

          Attempting to decompress data after the end of a frame will
          raise a *note ZstdError: 3027.  Any data found after the end
          of the frame is ignored and saved in the *note unused_data:
          303b. attribute.

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          Before the end of the stream is reached, this will be ‘b''’.

      -- の属性: needs_input

          ‘False’ if the *note decompress(): 3039. 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: 3022.
     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: 1d2. 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: 3022. instance with
     the *note dict_content: 303e. containing the raw dictionary
     contents.

     The 'samples' argument (an iterable of *note bytes: 1d2. 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():
     3020. 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(): 3020. if you need to train a new dictionary from
     sample data.

     The 'dict_content' argument (a *note bytes-like object: 43d.), 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(): 3020. 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(): 3040. 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: 10a1. containing the advanced compression
     parameter keys that can be used when compressing data.

     The *note bounds(): 3030. 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: 302f.:

          lower, upper = CompressionParameter.compression_level.bounds()

     Example setting the *note window_log: 3044. 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: 302f, 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: 3045.

      -- の属性: 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:
          3047, 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: 3049. strategy.
          It's still useful when using *note dfast: 3047. 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: 3049. and *note dfast: 3047.
          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: 304c, the effective minimum
          is ‘4’; for all strategies > *note fast: 3049, 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: 3025.

          For strategies *note btopt: 304c, *note btultra: 304e. and
          *note btultra2: 304f, 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: 3049, 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: 3025.

      -- の属性: 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:
          3044. 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: 304c.
          (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(): 301e. for one-shot compression

             * Providing all of the data to be compressed in the frame
               in a single *note ZstdCompressor.compress(): 3031. call,
               with the *note ZstdCompressor.FLUSH_FRAME: 3035. mode.

             * Calling *note ZstdCompressor.set_pledged_input_size():
               3036. with the exact amount of data that will be provided
               to the compressor prior to any calls to *note
               ZstdCompressor.compress(): 3031. 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: 3027. exception is raised.

          ‘True’ or ‘1’ enable checksum generation while ‘False’ or ‘0’
          disable it.

      -- の属性: dict_id_flag

          When compressing with a *note ZstdDict: 3022, 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: 3058. >= 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:
          3058. >= 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: 10a1. 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(): 305b. method can be used on any attribute to
     get the valid values for that parameter.

     Example setting the *note window_log_max: 305c. 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: 10a1. 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: 3062. 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: 2366.  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
オプションのモジュールの要件: 2364.

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: 6a. モジュールを参照し
てください。

このモジュールで利用可能な例外と関数を以下に示します:

 -- 例外: zlib.error

     圧縮および展開時のエラーによって送出される例外です。

 -- の関数: zlib.adler32 (data[, value])

     'data' の Adler-32 チェックサムを計算します (Adler-32 チェックサム
     は、おおむね CRC32 と同等の信頼性を持ちながら、はるかに高速に計算で
     きます)。結果は、符号のない 32 ビットの整数です。 'value' が与えら
     れている場合、チェックサム計算の初期値として使われます。与えられて
     いない場合、デフォルト値の 1 が使われます。 'value' を与えることで
     、複数の入力を結合したデータ全体にわたり、通しのチェックサムを計算
     できます。このアルゴリズムは暗号論的には強力ではなく、認証やデジタ
     ル署名などに用いるべきではありません。また、チェックサムアルゴリズ
     ムとして設計されているため、汎用のハッシュアルゴリズムには向きませ
     ん。

     バージョン 3.0 で変更: The result is always unsigned.

 -- の関数: zlib.adler32_combine (adler1, adler2, len2, /)

     Combine two Adler-32 checksums into one.

     Given the Adler-32 checksum 'adler1' of a sequence ‘A’ and the
     Adler-32 checksum 'adler2' of a sequence ‘B’ of length 'len2',
     return the Adler-32 checksum of ‘A’ and ‘B’ concatenated.

     This function is typically useful to combine Adler-32 checksums
     that were concurrently computed.  To compute checksums
     sequentially, use *note adler32(): 1dd3. with the running checksum
     as the ‘value’ argument.

     Added in version 3.15.

 -- の関数: 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: 306b.
     (‘1’), *note Z_BEST_COMPRESSION: 306c. (‘9’), *note
     Z_NO_COMPRESSION: 306d. (‘0’), and the default, *note
     Z_DEFAULT_COMPRESSION: 306e. (‘-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:
     3070.):

        * +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: 306a. 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: 306b. (‘1’), *note
     Z_BEST_COMPRESSION: 306c. (‘9’), *note Z_NO_COMPRESSION: 306d.
     (‘0’), and the default, *note Z_DEFAULT_COMPRESSION: 306e. (‘-1’)
     for more information about these values.

     'method' は圧縮アルゴリズムです。現在、 *note DEFLATED: 3071. のみ
     サポートされています。

     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():
     306f.

     'memLevel' 引数は内部圧縮状態用に使用されるメモリ量を制御します。有
     効な値は ‘1’ から ‘9’ です。大きい値ほど多くのメモリを消費しますが
     、より速く、より小さな出力を作成します。

     'strategy' is used to tune the compression algorithm.  Possible
     values are *note Z_DEFAULT_STRATEGY: 3072, *note Z_FILTERED: 3073,
     *note Z_HUFFMAN_ONLY: 3074, *note Z_RLE: 3075. and *note Z_FIXED:
     3076.

     'zdict' は定義済み圧縮辞書です。これは圧縮されるデータ内で繰り返し
     現れると予想されるサブシーケンスを含む (*note bytes: 1d2. オブジェ
     クトのような) バイト列のシーケンスです。最も一般的と思われるサブシ
     ーケンスは辞書の末尾に来なければなりません。

     バージョン 3.3 で変更: 'zdict' パラメータとキーワード引数のサポート
     が追加されました。

 -- の関数: zlib.crc32 (data[, value])

     'data' の CRC (Cyclic Redundancy Check, 巡回冗長検査) チェックサム
     を計算します。結果は、符号のない 32 ビットの整数です。 'value' が与
     えられている場合、チェックサム計算の初期値として使われます。与えら
     れていない場合、デフォルト値の 0 が使われます。 'value' を与えるこ
     とで、複数の入力を結合したデータ全体にわたり、通しのチェックサムを
     計算できます。このアルゴリズムは暗号論的には強力ではなく、認証やデ
     ジタル署名などに用いるべきではありません。また、チェックサムアルゴ
     リズムとして設計されているため、汎用のハッシュアルゴリズムには向き
     ません。

     バージョン 3.0 で変更: The result is always unsigned.

 -- の関数: zlib.crc32_combine (crc1, crc2, len2, /)

     Combine two CRC-32 checksums into one.

     Given the CRC-32 checksum 'crc1' of a sequence ‘A’ and the CRC-32
     checksum 'crc2' of a sequence ‘B’ of length 'len2', return the
     CRC-32 checksum of ‘A’ and ‘B’ concatenated.

     This function is typically useful to combine CRC-32 checksums that
     were concurrently computed.  To compute checksums sequentially, use
     *note crc32(): 1c37. with the running checksum as the ‘value’
     argument.

     Added in version 3.15.

 -- の関数: 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: 306a. 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(): 1a1c, 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: 306a. 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(): 3077.

     'zdict' パラメータには定義済み圧縮辞書を指定します。このパラメータ
     を指定する場合、展開するデータを圧縮した際に使用した辞書と同じもの
     でなければなりません。

          注釈: 'zdict' が (*note bytearray: 1d1. のような) 変更可能オブ
          ジェクトの場合、*note decompressobj(): 1a1d. の呼び出しとデコ
          ンプレッサの ‘decompress()’ メソッドの最初の呼び出しの間に辞書
          の内容を変更してはいけません。

     バージョン 3.3 で変更: パラメータに 'zdict' を追加しました。

圧縮オブジェクトは以下のメソッドをサポートしています:

 -- メソッド: Compress.compress (data)

     'data' を圧縮し、圧縮されたデータを含むバイト列オブジェクトを返しま
     す。この文字列は少なくとも 'data' の一部分のデータに対する圧縮デー
     タを含みます。このデータは以前に呼んだ *note compress(): a33. が返
     した出力と結合することができます。入力の一部は以後の処理のために内
     部バッファに保存されることもあります。

 -- メソッド: 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: 307a, *note Z_PARTIAL_FLUSH:
     307b, *note Z_SYNC_FLUSH: 307c, *note Z_FULL_FLUSH: 307d, *note
     Z_BLOCK: 307e, or *note Z_FINISH: 307f, 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(): a33.
     method cannot be called again; the only realistic action is to
     delete the object.

 -- メソッド: Compress.copy ()

     圧縮オブジェクトのコピーを返します。これを使うと先頭部分が共通して
     いる複数のデータを効率的に圧縮することができます。

バージョン 3.8 で変更: Added *note copy.copy(): 947. and *note
copy.deepcopy(): f2f. support to compression objects.

展開オブジェクトは以下のメソッドと属性をサポートしています:

 -- の属性: Decompress.unused_data

     圧縮データの末尾より後のバイト列が入ったバイト列オブジェクトです。
     すなわち、この値は圧縮データの入っているバイト列の最後の文字が利用
     可能になるまでは ‘b""’ のままとなります。入力バイト文字列すべてが圧
     縮データを含んでいた場合、この属性は ‘b""’ 、すなわち空バイト列にな
     ります。

 -- の属性: Decompress.unconsumed_tail

     展開されたデータを収めるバッファの長さ制限を超えたために、直近の
     *note decompress(): 10cc. 呼び出しで処理しきれなかったデータを含む
     バイト列オブジェクトです。このデータはまだ zlib 側からは見えていな
     いので、正しい展開出力を得るには以降の ‘decompress()’ メソッド呼び
     出しに (場合によっては後続のデータが追加された) データを差し戻さな
     ければなりません。

 -- の属性: Decompress.eof

     圧縮データストリームの終了に達したかどうかを示すブール値です。

     これは、正常な形式の圧縮ストリームと、不完全あるいは切り詰められた
     ストリームとを区別することを可能にします。

     Added in version 3.3.

 -- メソッド: Decompress.decompress (data, max_length=0)

     'data' を展開し、少なくとも 'string' の一部分に対応する展開されたデ
     ータを含むバイト列オブジェクトを返します。このデータは以前に *note
     decompress(): 10cc. メソッドを呼んだ時に返された出力と結合すること
     ができます。入力データの一部分が以後の処理のために内部バッファに保
     存されることもあります。

     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: 3082.  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.  For
     example, the full content could be read like:

          process_output(d.decompress(data, max_length))
          while chunk := d.decompress(d.unconsumed_tail, max_length):
              process_output(chunk)

     バージョン 3.6 で変更: 'max_length' can be used as a keyword
     argument.

 -- メソッド: Decompress.flush ([length])

     未処理の入力データをすべて処理し、最終的に圧縮されなかった残りの出
     力バイト列オブジェクトを返します。*note flush(): 3084. を呼んだ後、
     *note decompress(): 10cc. を再度呼ぶべきではありません。このときで
     きる唯一の現実的な操作はオブジェクトの削除だけです。

     オプション引数 'length' には出力バッファの初期サイズを指定します。

 -- メソッド: Decompress.copy ()

     展開オブジェクトのコピーを返します。これを使うとデータストリームの
     途中にある展開オブジェクトの状態を保存でき、未来のある時点で行なわ
     れるストリームのランダムなシークをスピードアップするのに利用できま
     す。

バージョン 3.8 で変更: Added *note copy.copy(): 947. and *note
copy.deepcopy(): f2f. 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: 152c. で確認できる、実行時
     に使用している実際の 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: 3089. and *note ZLIB_RUNTIME_VERSION: 152c. 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: 6a. モジュール

     ‘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: 2366.  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
オプションのモジュールの要件: 2364.

データ圧縮は *note zlib: 13c. モジュールで提供されています。

The ‘gzip’ module provides the *note GzipFile: 84f. class, as well as
the *note open(): 308e, *note compress(): a32. and *note decompress():
15ca. 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: 1581.

‘compress’ や ‘pack’ 等によって作成され、‘gzip’ や ‘gunzip’ が展開できる
他のファイル形式についてはこのモジュールは対応していないので注意してくだ
さい。

このモジュールは以下の項目を定義しています:

 -- の関数: gzip.open (filename, mode='rb', compresslevel=6,
          encoding=None, errors=None, newline=None)

     gzip 圧縮ファイルをバイナリまたはテキストモードで開き、*note
     ファイルオブジェクト: 1581. を返します。

     引数 'filename' には実際のファイル名 (*note str: 1ea. または *note
     bytes: 1d2. オブジェクト) か、既存のファイルオブジェクトを指定しま
     す。

     引数 'mode' には、バイナリモード用に ‘'r'’、‘'rb'’、‘'a'’、‘'ab'’、
     ‘'w'’、‘'wb'’、‘'x'’、または ‘'xb'’、テキストモード用に ‘'rt'’、
     ‘'at'’、‘'wt'’、または ‘'xt'’ を指定できます。デフォルトは ‘'rb'’ で
     す。

     引数 'compresslevel' は *note GzipFile: 84f. コンストラクタと同様に
     0 から 9 の整数を取ります。

     バイナリモードでは、この関数は *note GzipFile: 84f. コンストラクタ
     ‘GzipFile(filename, mode, compresslevel)’ と等価です。この時、引数
     'encoding'、'errors'、および 'newline' を指定してはいけません。

     テキストモードでは、*note GzipFile: 84f. オブジェクトが作成され、指
     定されたエンコーディング、エラーハンドラの挙動、および改行文字で
     *note io.TextIOWrapper: ba0. インスタンスにラップされます。

     バージョン 3.3 で変更: 'filename' にファイルオブジェクト指定のサポ
     ート、テキストモードのサポート、および引数に 'encoding'、'errors'、
     および 'newline' を追加しました。

     バージョン 3.4 で変更: Added support for the ‘'x'’, ‘'xb'’ and
     ‘'xt'’ modes.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.15 で変更: The default compression level was reduced
     to 6 (down from 9).  It is the default level used by most
     compression tools and a better tradeoff between speed and
     performance.

 -- 例外: gzip.BadGzipFile

     An exception raised for invalid gzip files.  It inherits from *note
     OSError: 543.  *note EOFError: 1693. and *note zlib.error: 306a.
     can also be raised for invalid gzip files.

     Added in version 3.8.

 -- クラス: gzip.GzipFile (filename=None, mode=None, compresslevel=6,
          fileobj=None, mtime=None)

     *note GzipFile: 84f. クラスのコンストラクタです。‘GzipFile’ オブジ
     ェクトは *note truncate(): 16ca. メソッドを除くほとんどの *note
     ファイルオブジェクト: 1581. のメソッドをシミュレートします。少なく
     とも 'fileobj' および 'filename' は有効な値でなければなりません。

     クラスの新しいインスタンスは、 'fileobj' に基づいて作成されます。
     'fileobj' は通常のファイル、 *note io.BytesIO: 1258. オブジェクト、
     そしてその他ファイルをシミュレートできるオブジェクトでかまいません
     。 値はデフォルトでは '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(): 308e. (または
     *note GzipFile: 84f. を *note io.TextIOWrapper: ba0. でラップしたオ
     ブジェクト) を使ってください。

     引数 '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: 308f. attribute that is set when
     decompressing.

     圧縮したデータの後ろにさらに何か追加したい場合もあるので、*note
     GzipFile: 84f. オブジェクトの ‘close()’ メソッド呼び出しは
     'fileobj' を閉じません。 このため、書き込みのためにオープンした
     *note io.BytesIO: 1258. オブジェクトを 'fileobj' として渡し、
     (‘GzipFile’ を ‘close()’ した後に) ‘io.BytesIO’ オブジェクトの
     *note getvalue(): 3090. メソッドを使って書き込んだデータの入ってい
     るメモリバッファを取得することができます。

     *note GzipFile: 84f. は、イテレーションと *note with: 215. 文を含む
     *note io.BufferedIOBase: a88. インターフェイスをサポートしています
     。*note truncate(): 16ca. メソッドのみ実装されていません。

     *note GzipFile: 84f. は以下のメソッドと属性も提供しています:

      -- メソッド: peek (n)

          ファイル内の位置を移動せずに展開した 'n' バイトを読み込みます
          。返されるバイト数はほぼ要求した値になります。

               注釈: *note peek(): 15c9. の呼び出しでは *note GzipFile:
               84f. のファイル位置は変わりませんが、下層のファイルオブジ
               ェクトの位置が変わる惧れがあります。(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: 1ea. or
          *note bytes: 1d2.  Equivalent to the output of *note
          os.fspath(): 1015. on the original input path, with no other
          normalization, resolution or expansion.

     バージョン 3.1 で変更: *note with: 215. 文がサポートされました。
     'mtime' コンストラクタ引数と *note mtime: 308f. 属性が追加されまし
     た。

     バージョン 3.2 で変更: ゼロパディングされたファイルやシーク出来ない
     ファイルがサポートされました。

     バージョン 3.3 で変更: *note io.BufferedIOBase.read1(): 3092. メソ
     ッドを実装しました。

     バージョン 3.4 で変更: ‘'x'’ ならびに ‘'xb'’ モードがサポートされま
     した。

     バージョン 3.5 で変更: 任意の *note バイトライクオブジェクト: 43d.
     の書き込みがサポートされました。 *note read(): 16e2. メソッドが
     ‘None’ を引数として受け取るようになりました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.9 で非推奨: Opening ‘GzipFile’ for writing without
     specifying the 'mode' argument is deprecated.

     バージョン 3.12 で変更: Remove the ‘filename’ attribute, use the
     *note name: 921. attribute instead.

     バージョン 3.15 で変更: The default compression level was reduced
     to 6 (down from 9).  It is the default level used by most
     compression tools and a better tradeoff between speed and
     performance.

 -- の関数: gzip.compress (data, compresslevel=6, *, mtime=0)

     Compress the 'data', returning a *note bytes: 1d2. object
     containing the compressed data.  'compresslevel' and 'mtime' have
     the same meaning as in the *note GzipFile: 84f. 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(): a33. 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'.

     バージョン 3.15 で変更: The default compression level was reduced
     to 6 (down from 9).  It is the default level used by most
     compression tools and a better tradeoff between speed and
     performance.

 -- の関数: gzip.decompress (data)

     Decompress the 'data', returning a *note bytes: 1d2. 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(): 10cc. 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/main/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: 13c. モジュール

     ‘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: 94f.

 -- 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(): 144a. 関数と *note
     BZ2File: c41. クラス。

   * インクリメンタルにデータを圧縮・展開するための *note BZ2Compressor:
     1cec. および *note BZ2Decompressor: 191c. クラス。

   * 一度に圧縮・展開を行う *note compress(): 2aab. および *note
     decompress(): 144b. 関数。

This is an *note optional module: 2366.  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
オプションのモジュールの要件: 2364.

* Menu:

* ファイルの圧縮/解凍::
* 逐次圧縮および展開::
* 一括圧縮/解凍::
* 使い方の例: 使い方の例<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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 ファイルオブジェクト: 1581. を返します。

     *note BZ2File: c41. のコンストラクタと同様に、引数 'filename' には
     実際のファイル名 (*note str: 1ea. または *note bytes: 1d2. オブジェ
     クト) か、読み書きする既存のファイルオブジェクトを指定します。

     引数 'mode' には、バイナリモード用に ‘'r'’、‘'rb'’、‘'w'’、‘'wb'’、
     ‘'x'’、‘'xb'’、‘'a'’、あるいは ‘'ab'’、テキストモード用に ‘'rt'’、
     ‘'wt'’、‘'xt'’、あるいは ‘'at'’ を指定できます。デフォルトは ‘'rb'’
     です。

     引数 'compresslevel' には *note BZ2File: c41. コンストラクタと同様
     に 1 から 9 の整数を指定します。

     バイナリモードでは、この関数は *note BZ2File: c41. コンストラクタ
     ‘BZ2File(filename, mode, compresslevel=compresslevel)’ と等価です。
     この時、引数 'encoding'、'errors'、および 'newline' を指定してはい
     けません。

     テキストモードでは、*note BZ2File: c41. オブジェクトが作成され、指
     定されたエンコーディング、エラーハンドラの挙動、および改行文字で
     *note io.TextIOWrapper: ba0. にラップされます。

     Added in version 3.3.

     バージョン 3.4 で変更: ‘'x'’ (排他的作成) モードが追加されました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- クラス: bz2.BZ2File (filename, mode='r', *, compresslevel=9)

     bzip2 圧縮ファイルをバイナリモードでオープンします。

     'filename' が *note str: 1ea. あるいは *note bytes: 1d2. オブジェク
     トの場合、それを名前とするファイルを直接開きます。そうでない場合、
     'filename' は圧縮データを読み書きする *note ファイルオブジェクト:
     1581. でなくてはなりません。

     引数 'mode' は読み込みモードの ‘'r'’ (デフォルト)、上書きモードの
     ‘'w'’、排他的作成モードの ‘'x'’、あるいは追記モードの ‘'a'’ のいず
     れかを指定できます。これらはそれぞれ ‘'rb'’、‘'wb'’、‘'xb'’ および
     ‘'ab'’ と等価です。

     'filename' が (実際のファイル名でなく) ファイルオブジェクトの場合、
     ‘'w'’ はファイルを上書きせず、‘'a'’ と等価になります。

     'mode' が ‘'w'’ あるいは ‘'a'’ の場合、'compresslevel' に圧縮レベル
     を ‘1’ から ‘9’ の整数で指定できます。 圧縮率は ‘1’ が最低で、‘9’
     (デフォルト値) が最高です。

     'mode' の値が ‘'r'’ の場合、入力ファイルは複数の圧縮ストリームでも
     構いません。

     *note BZ2File: c41. には、 *note io.BufferedIOBase: a88. で規定され
     ているメソッドや属性のうち、 *note detach(): 3029. と *note
     truncate(): 16ca. を除くすべてが備わっています。イテレーションと
     *note with: 215. 文をサポートしています。

     *note BZ2File: c41. also provides the following methods and
     attributes:

      -- メソッド: peek ([n])

          ファイル上の現在位置を変更せずにバッファのデータを返します。こ
          のメソッドは少なくとも 1 バイトのデータを返します (EOF の場合
          を除く)。返される正確なバイト数は規定されていません。

               注釈: *note peek(): 30a3. の呼び出しでは *note BZ2File:
               c41. のファイル位置は変わりませんが、下層のファイルオブジ
               ェクトの位置が変わる惧れがあります(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: 302d.
          attribute of the underlying *note file object: 1581.

          Added in version 3.13.

     バージョン 3.1 で変更: *note with: 215. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'filename' が実際のファイル名でなく *note
     ファイルオブジェクト: 1581. だった場合のサポートが追加されました。

     ‘'a'’ (追記) モードが追加され、複数のストリームの読み込みがサポート
     されました。

     バージョン 3.4 で変更: ‘'x'’ (排他的作成) モードが追加されました。

     バージョン 3.5 で変更: *note read(): 16e2. メソッドが ‘None’ を引数
     として受け取るようになりました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.9 で変更: 'buffering' パラメータは削除されました。
     Python 3.0 からは無視され非推奨となっています。開かれたファイルオブ
     ジェクトを渡し、ファイルの開きかたを制御します。

     'compresslevel' パラメータはキーワード専用になりました。

     バージョン 3.10 で変更: このクラスは、複数の同時読み出しや書き込み
     においては、既存の *note gzip: 6a. や *note lzma: 8d. などの同等の
     クラスのように、スレッド安全ではありません。


File: python.info,  Node: 逐次圧縮および展開,  Next: 一括圧縮/解凍,  Prev: ファイルの圧縮/解凍,  Up: bz2 --- bzip2 圧縮のサポート

5.14.5.2 逐次圧縮および展開
...........................

 -- クラス: bz2.BZ2Compressor (compresslevel=9)

     新しくコンプレッサオブジェクトを作成します。このオブジェクトはデー
     タの逐次的な圧縮に使用できます。一度に圧縮したい場合は、*note
     compress(): 2aab. 関数を使ってください。

     引数 'compresslevel' を指定する場合は、‘1’ から ‘9’ までの整数を与
     えてください。 デフォルト値は ‘9’ です。

      -- メソッド: compress (data)

          データをコンプレッサオブジェクトに渡します。戻り値は圧縮された
          データですが、圧縮データを返すことができない場合は空のバイト文
          字列を返します。

          コンプレッサオブジェクトにデータをすべて渡し終えたら、*note
          flush(): 30ae. メソッドを呼び出し、圧縮プロセスを完了させてく
          ださい。

      -- メソッド: flush ()

          圧縮プロセスを完了させ、内部バッファに残っている圧縮済みデータ
          を返します。

          このメソッドを呼び出すと、それ以後コンプレッサオブジェクトは使
          用できなくなります。

 -- クラス: bz2.BZ2Decompressor

     新しくデコンプレッサオブジェクトを作成します。このオブジェクトは逐
     次的なデータ展開に使用できます。一度に展開したい場合は、*note
     decompress(): 144b. 関数を使ってください。

          注釈: このクラスは、*note decompress(): 144b. や *note
          BZ2File: c41. とは異なり、複数の圧縮レベルが混在しているデータ
          を透過的に扱うことができません。 *note BZ2Decompressor: 191c.
          クラスを用いて、複数のストリームからなるデータを展開する場合は
          、それぞれのストリームについてデコンプレッサオブジェクトを用意
          してください。

      -- メソッド: decompress (data, max_length=-1)

          'data' (*note bytes-like object: 43d.) を展開し、未圧縮のデー
          タを bytes で返します。 'data' の一部は、後で *note
          decompress(): 144b. の呼び出しに使用するため内部でバッファされ
          ている場合があります。 返されたデータは、以前の ‘decompress()’
          の呼び出しの出力に連結する必要があります。

          'max_length' が非負の場合、最大 'max_length' バイトの展開デー
          タを返します。この制限に達して、出力がさらに生成できる場合、
          *note needs_input: 30af. が ‘False’ に設定されます。この場合、
          *note decompress(): 1187. を次に呼び出すと、'data' を ‘b''’ と
          して提供し、出力をさらに取得することができます。

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          30af. 属性は ‘True’ になります。

          ストリームの終端に到達した後にデータを展開しようとすると *note
          EOFError: 1693. が送出されます。 ストリームの終端の後ろの全て
          のデータは無視され、その部分は *note unused_data: 30b0. 属性に
          保存されます。

          バージョン 3.5 で変更: ‘max_length’ パラメータが追加されました
          。

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

          Added in version 3.3.

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          ストリームの末尾に達する前には、この属性には ‘b''’ という値が
          収められています。

      -- の属性: needs_input

          *note decompress(): 1187. メソッドが、新しい非圧縮入力を必要と
          せずにさらに展開データを提供できる場合、 ‘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 バイト類オブジェクト: 43d. の 'data' を圧縮します。

     引数 'compresslevel' を指定する場合は、‘1’ から ‘9’ までの整数を与
     えてください。 デフォルト値は ‘9’ です。

     逐次的にデータを圧縮したい場合は、*note BZ2Compressor: 1cec. を使っ
     てください。

 -- の関数: bz2.decompress (data)

     *note バイト類オブジェクト: 43d. の 'data' を展開します。

     'data' が複数の圧縮ストリームから成る場合、そのすべてを展開します。

     逐次的に展開を行う場合は、*note BZ2Decompressor: 191c. を使ってくだ
     さい。

     バージョン 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(): 2aab. と *note decompress(): 144b. を使い、圧縮して展
開する実演をしています:

     >>> 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: 1cec. を使い、逐次圧縮をしています:

     >>> 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: 13ba. と *note bz2.BZ2File: c41. は
スレッドセーフでは 'ない' 点に注意してください。 そのため、単一の
‘LZMAFile’ インスタンスを複数スレッドから使用する場合は、ロックで保護す
る必要があります。

This is an *note optional module: 2366.  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
オプションのモジュールの要件: 2364.

 -- 例外: lzma.LZMAError

     この例外は圧縮あるいは展開中にエラーが発生した場合、または圧縮/展開
     状態の初期化中に送出されます。

* Menu:

* 圧縮ファイルへの読み書き: 圧縮ファイルへの読み書き<2>.
* メモリ上での圧縮と展開: メモリ上での圧縮と展開<2>.
* その他: その他<4>.
* カスタムフィルタチェインの指定::
* 使用例: 使用例<15>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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
     ファイルオブジェクト: 1581. を返します。

     'filename' 引数には、ファイルをオープンする際には実際のファイル名
     (*note str: 1ea.、 *note bytes: 1d2.、または *note path-like: 7a5.
     オブジェクトとして指定します)か、読み込みまたは書き込むためであれば
     、すでに存在するファイルオブジェクトを指定できます。

     引数 'mode' は、バイナリモードでは ‘"r"’、‘"rb"’、‘"w"’、‘"wb"’、
     ‘"x"’、‘"xb"’、‘"a"’、あるいは ‘"ab"’ の、テキストモードでは
     ‘"rt"’、‘"wt"’、‘"xt"’、あるいは ‘"at"’ のいずれかになります。デフ
     ォルトは ‘"rb"’ です。

     読み込み用にファイルをオープンした場合、引数 'format' および
     'filters' は *note LZMADecompressor: 191b. と同じ意味になります。こ
     の時、引数 'check' および 'preset' は使用しないでください。

     書き出し用にオープンした場合、引数 'format'、'check'、'preset'、お
     よび 'filters' は *note LZMACompressor: 1ceb. と同じ意味になります
     。

     バイナリモードでは、この関数は *note LZMAFile: 13ba. コンストラクタ
     と等価になります (‘LZMAFile(filename, mode, ...)’)。この場合、引数
     'encoding'、'errors'、および 'newline' を指定しなければなりません。

     テキストモードでは、*note LZMAFile: 13ba. オブジェクトが生成され、
     指定したエンコーディング、エラーハンドラの挙動、および改行コードで
     *note io.TextIOWrapper: ba0. にラップされます。

     バージョン 3.4 で変更: ‘"x"’, ‘"xb"’, ‘"xt"’ モードのサポートが追加
     されました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- クラス: lzma.LZMAFile (filename=None, mode='r', *, format=None,
          check=-1, preset=None, filters=None)

     LZMA 圧縮ファイルをバイナリモードで開きます。

     *note LZMAFile: 13ba. はすでにオープンしている *note file object:
     1581. をラップ、または名前付きファイルを直接操作できます。引数
     'filename' にはラップするファイルオブジェクトかオープンするファイル
     名 (*note str: 1ea. オブジェクトま、*note bytes: 1d2. オブジェクト
     、または *note path-like: 7a5. オブジェクト) を指定します。既存のフ
     ァイルオブジェクトをラップした場合、‘LZMAFile’ をクローズしてもラッ
     プしたファイルはクローズされません。

     引数 'mode' は読み込みモードの ‘"r"’ (デフォルト)、上書きモードの
     ‘"w"’、排他的生成モードの ‘"x"’、あるいは追記モードの ‘"a"’ のいず
     れかを指定できます。これらはそれぞれ ‘"rb"’、‘"wb"’、‘"xb"’、および
     ‘"ab"’ と等価です。

     'filename' が (実際のファイル名でなく) ファイルオブジェクトの場合、
     ‘"w"’ モードはファイルを上書きせず、‘"a"’ と等価になります。

     読み込みモードでファイルをオープンした時、入力ファイルは複数に分割
     された圧縮ストリームを連結したものでもかまいません。これらは透過的
     に単一論理ストリームとしてデコードされます。

     読み込み用にファイルをオープンした場合、引数 'format' および
     'filters' は *note LZMADecompressor: 191b. と同じ意味になります。こ
     の時、引数 'check' および 'preset' は使用しないでください。

     書き出し用にオープンした場合、引数 'format'、'check'、'preset'、お
     よび 'filters' は *note LZMACompressor: 1ceb. と同じ意味になります
     。

     *note LZMAFile: 13ba. には、 *note io.BufferedIOBase: a88. で規定さ
     れているメソッドや属性のうち、 *note detach(): 3029. と *note
     truncate(): 16ca. を除くすべてが備わっています。イテレーションと
     *note with: 215. 文をサポートしています。

     以下のメソッドと属性も提供されています:

      -- メソッド: peek (size=-1)

          ファイル上の現在位置を変更せずにバッファのデータを返します。
          EOF に達しない限り、少なくとも 1 バイトが返されます。返される
          正確なバイト数は規定されていません (引数 'size' は無視されます
          )。

               注釈: *note peek(): 30bb. の呼び出しでは *note LZMAFile:
               13ba. のファイル位置は変わりませんが、下層のファイルオブ
               ジェクトの位置が変わる惧れがあります。(e.g.  ‘LZMAFile’ を
               'filename' にファイルオブジェクトを渡して作成した場合)

      -- の属性: mode

          ‘'rb'’ は読み込み用、 ‘'wb'’ は書き込み用です。

          Added in version 3.13.

      -- の属性: name

          lzma ファイルの名前。基礎である *note file object: 1581. の
          *note name: 302d. 属性と同様です。

          Added in version 3.13.

     バージョン 3.4 で変更: ‘'x'’, ‘'xb'’ モードがサポートが追加されまし
     た。

     バージョン 3.5 で変更: *note read(): 16e2. メソッドが ‘None’ を引数
     として受け取るようになりました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。


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(): 30bf. を参照してください。

     引数 'format' には使用するコンテナフォーマットを指定します。以下の
     値が指定できます:

        * 
          ‘FORMAT_XZ’: The ‘.xz’ コンテナフォーマット。

               デフォルトのフォーマットです。

        * 
          ‘FORMAT_ALONE’: レガシーな ‘.lzma’ コンテナフォーマット。

               このフォーマットは ‘.xz’ より制限があります - インテグリ
               ティチェックや複数フィルタをサポートしていません。

        * 
          ‘FORMAT_RAW’: 特定のコンテナフォーマットを使わない、生のデータストリーム。

               このフォーマット指定子はインテグリティチェックをサポート
               しておらず、(圧縮および展開双方のために) 常にカスタムフィ
               ルタチェインを指定する必要があります。さらに、この方法で
               圧縮されたデータは ‘FORMAT_AUTO’ を使っても展開できません
               (*note LZMADecompressor: 191b. を参照)。

     引数 'check' には圧縮データに組み込むインテグリティチェックのタイプ
     を指定します。このチェックは展開時に使用され、データが破損していな
     いことを保証します。以下の値が指定できます:

        * ‘CHECK_NONE’: インテグリティチェックなし。‘FORMAT_ALONE’ およ
          び ‘FORMAT_RAW’ のデフォルト (かつ唯一指定可能な値) です。

        * ‘CHECK_CRC32’: 32-bit 巡回冗長検査。

        * ‘CHECK_CRC64’: 64-bit 巡回冗長検査。‘FORMAT_XZ’ のデフォルトで
          す。

        * ‘CHECK_SHA256’: 256-bit セキュアハッシュアルゴリズム (SHA)。

     指定したチェック方法がサポートされていない場合、*note LZMAError:
     30b8. が送出されます。

     圧縮設定はプリセット圧縮レベル (引数 'preset' で指定) またはカスタ
     ムフィルタチェイン (引数 'filters' で指定) のどちらかを指定します。

     引数 'preset' を指定する場合、‘0’ から ‘9’ までの整数値でなければな
     らず、オプションで定数 ‘PRESET_EXTREME’ を論理和指定できます。
     'preset' も 'filters' も指定されなかった場合、デフォルトの挙動とし
     て ‘PRESET_DEFAULT’ (プリセットレベル ‘6’) が使用されます。高いプリ
     セット値を指定すると圧縮率が上がりますが、圧縮にかかる時間が長くな
     ります。

          注釈: CPU の使用量が多いのに加えて、高いプリセットで圧縮を行う
          には、メモリをずっと多く必要とします (さらに、生成される出力も
          展開により多くのメモリを必要とします)。例えば、プリセットが
          ‘9’ の場合、*note LZMACompressor: 1ceb. オブジェクトのオーバー
          ヘッドは 800 MiB にまで高くなる場合があります。このため、通常
          はデフォルトのプリセットを使用するのがよいでしょう。

     引数 'filters' を指定する場合、フィルタチェイン指定子でなければなり
     ません。詳しくは *note カスタムフィルタチェインの指定: 30c0. を参照
     してください。

      -- メソッド: compress (data)

          'data' (*note bytes: 1d2. オブジェクト) を圧縮し、少なくともそ
          の一部が圧縮されたデータを格納する ‘bytes’ オブジェクトを返し
          ます。'data' の一部は、後で *note compress(): 30bf. および
          *note flush(): 30c2. の呼び出しに使用するため内部でバッファさ
          れている場合があります。返すデータは以前の ‘compress()’ 呼び出
          しの出力を連結したものです。

      -- メソッド: flush ()

          圧縮処理を終了し、コンプレッサの内部バッファにあるあらゆるデー
          タを格納する *note bytes: 1d2. オブジェクトを返します。

          コンプレッサはこのメソッドが呼び出された後は使用できません。

 -- クラス: lzma.LZMADecompressor (format=FORMAT_AUTO, memlimit=None,
          filters=None)

     データをインクリメンタルに展開するために使用できる展開オブジェクト
     を作成します。

     圧縮されたストリーム全体を一度に展開にする、より便利な方法について
     は、*note decompress(): 30c3. を参照してください。

     引数 'format' には使用するコンテナフォーマットを指定します。デフォ
     ルトは ‘FORMAT_AUTO’ で、‘.xz’ および ‘.lzma’ ファイルを展開できま
     す。その他に指定できる値は、‘FORMAT_XZ’、‘FORMAT_ALONE’、および
     ‘FORMAT_RAW’ です。

     引数 'memlimit' にはデコンプレッサが使用できるメモリ量をバイトで指
     定します。この引数を指定した場合、そのメモリ量で展開ができないと
     *note LZMAError: 30b8. を送出します。

     引数 'filters' には展開されるストリームの作成に使用するフィルタチェ
     インを指定します。この引数を使用する際は、引数 'format' に
     ‘FORMAT_RAW’ を指定しなければなりません。フィルタチェインについての
     詳細は *note カスタムフィルタチェインの指定: 30c0. を参照してくださ
     い。

          注釈: このクラスは *note decompress(): 30c3. および *note
          LZMAFile: 13ba. と異なり、複数の圧縮ストリームを含む入力を透過
          的に扱いません。 *note LZMADecompressor: 191b. で複数ストリー
          ム入力を展開するには、各ストリームごとに新しいデコンプレッサを
          作成しなければなりません。

      -- メソッド: decompress (data, max_length=-1)

          'data' (*note bytes-like object: 43d.) を展開し、未圧縮のデー
          タを bytes で返します。 'data' の一部は、後で *note
          decompress(): 30c3. の呼び出しに使用するため内部でバッファされ
          ている場合があります。 返されたデータは、以前の ‘decompress()’
          の呼び出しの出力に連結する必要があります。

          'max_length' が非負の場合、最大 'max_length' バイトの展開デー
          タを返します。この制限に達して、出力がさらに生成できる場合、
          *note needs_input: 30c4. が ‘False’ に設定されます。この場合、
          *note decompress(): 11e5. を次に呼び出すと、'data' を ‘b''’ と
          して提供し、出力をさらに取得することができます。

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          30c4. 属性は ‘True’ になります。

          ストリームの終端に到達した後にデータを展開しようとすると *note
          EOFError: 1693. が送出されます。 ストリームの終端の後ろの全て
          のデータは無視され、その部分は *note unused_data: 30c5. 属性に
          保存されます。

          バージョン 3.5 で変更: ‘max_length’ パラメータが追加されました
          。

      -- の属性: check

          入力ストリームに使用されるインテグリティチェックの ID です。こ
          れは何のインテグリティチェックが使用されているか決定するために
          十分な入力がデコードされるまでは ‘CHECK_UNKNOWN’ になることが
          あります。

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          ストリームの末尾に達する前は、これは ‘b""’ になります。

      -- の属性: needs_input

          *note decompress(): 11e5. メソッドが、新しい非圧縮入力を必要と
          せずにさらに展開データを提供できる場合、 ‘False’ です。

          Added in version 3.5.

 -- の関数: lzma.compress (data, format=FORMAT_XZ, check=-1,
          preset=None, filters=None)

     'data' (*note bytes: 1d2. オブジェクト) を圧縮し、圧縮データを
     ‘bytes’ オブジェクトとして返します。

     引数 'format'、'check'、'preset'、および 'filters' についての説明は
     上記の *note LZMACompressor: 1ceb. を参照してください。

 -- の関数: lzma.decompress (data, format=FORMAT_AUTO, memlimit=None,
          filters=None)

     'data' (*note bytes: 1d2. オブジェクト) を展開し、展開データを
     ‘bytes’ オブジェクトとして返します。

     'data' が複数の明確な圧縮ストリームの連結だった場合、すべてのストリ
     ームを展開し、結果の連結を返します。

     引数 'format'、'memlimit'、および 'filters' の説明は、上記 *note
     LZMADecompressor: 191b. を参照してください。


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: 2366. such
as *note zlib: 13c, *note bz2: 14, *note lzma: 8d, 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
オプションのモジュールの要件: 2364.

このモジュールは以下の項目を定義しています:

 -- 例外: zipfile.BadZipFile

     正常ではない ZIP ファイルに対して送出されるエラーです。

     Added in version 3.2.

 -- 例外: zipfile.BadZipfile

     *note BadZipFile: 1d84. の別名です。過去のバージョンの Python との
     互換性のために用意されています。

     バージョン 3.2 で非推奨.

 -- 例外: zipfile.LargeZipFile

     ZIP ファイルが ZIP64 の機能を必要としているが、その機能が有効化され
     ていない場合に送出されるエラーです。

 -- クラス: zipfile.ZipFile

     ZIP ファイルの読み書きのためのクラスです。コンストラクタの詳細につ
     いては、*note ZipFile objects: 30d1. 節を参照してください。

 -- クラス: zipfile.Path

     *note pathlib.Path: 4f5. インターフェースの一部を実装したクラスです
     。 *note importlib.resources.abc.Traversable: 579. インターフェース
     は完全に実装しています。

     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(): 30d2.
     and *note infolist(): 30d3. methods of *note ZipFile: ab6. 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: 30d4.

     バージョン 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(): 54f.

          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: 13c. モ
     ジュールが必要です。

 -- データ: zipfile.ZIP_BZIP2

     BZIP2 圧縮方法を表す数値定数です。これには *note bz2: 14. モジュー
     ルが必要です。

     Added in version 3.3.

 -- データ: zipfile.ZIP_LZMA

     LZMA 圧縮方法を表す数値定数です。これには *note lzma: 8d. モジュー
     ルが必要です。

     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/main/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: 7a5. のいずれかで
     す。

     'mode' パラメータには、既存のファイルを読み込む場合は ‘'r'’ 、内容
     を消去して新しいファイルに書き込む場合は ‘'w'’ 、既存のファイルの末
     尾に追加する場合は ‘'a'’ 、ファイルが存在しない場合にのみファイルを
     作成して書き込む場合は ‘'x'’ を指定します。 'mode' が ‘'x'’ で
     'file' が既存のファイルを指している場合、 *note FileExistsError:
     13cd. が発生します。 '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: 30d5, *note ZIP_DEFLATED:
     30d6, *note ZIP_BZIP2: 30d7, *note ZIP_LZMA: 30d8, or *note
     ZIP_ZSTANDARD: 30d9.; unrecognized values will cause *note
     NotImplementedError: 5a1. to be raised.  If ‘ZIP_DEFLATED’,
     ‘ZIP_BZIP2’, ‘ZIP_LZMA’, or ‘ZIP_ZSTANDARD’ is specified but the
     corresponding module (*note zlib: 13c, *note bz2: 14, *note lzma:
     8d, or *note compression.zstd: 23.) is not available, *note
     RuntimeError: 317. 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:
     30d5. or *note ZIP_LZMA: 30d8. it has no effect.  When using *note
     ZIP_DEFLATED: 30d6. integers ‘0’ through ‘9’ are accepted (see
     *note zlib: 1a1c. for more information).  When using *note
     ZIP_BZIP2: 30d7. integers ‘1’ through ‘9’ are accepted (see *note
     bz2: c41. for more information).  When using *note ZIP_ZSTANDARD:
     30d9. integers ‘-131072’ through ‘22’ are commonly accepted (see
     *note CompressionParameter.compression_level: 302f. 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 クローズ: 30db. された
     場合、空のアーカイブのための適切な ZIP 構造がファイルに書き込まれま
     す。

     ZipFile はコンテキストマネージャにもなっているので、*note with:
     215. 文をサポートしています。次の例では、'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: ab6. をコンテキストマネージャ
     として使用できるようになりました。

     バージョン 3.3 で変更: *note bzip2: 14. および *note lzma: 8d. 圧縮
     をサポートしました。

     バージョン 3.4 で変更: ZIP64 拡張がデフォルトで有効になりました。

     バージョン 3.5 で変更: seek 出来ないストリームのサポートが追加され
     ました。‘'x'’ モードのサポートが追加されました。

     バージョン 3.6 で変更: Previously, a plain *note RuntimeError: 317.
     was raised for unrecognized compression values.

     バージョン 3.6.2 で変更: 'file' 引数が *note path-like object: 7a5.
     を受け入れるようになりました。

     バージョン 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(): 30db. はプログラ
     ムを終了する前に必ず呼び出さなければなりません。さもないとアーカイ
     ブ上の重要なレコードが書き込まれません。

 -- メソッド: ZipFile.getinfo (name)

     アーカイブメンバ 'name' に関する情報を持つ *note ZipInfo: 54e. オブ
     ジェクトを返します。アーカイブに含まれないファイル名に対して *note
     getinfo(): 30d2. を呼び出すと、*note KeyError: 7e5. が送出されます
     。

 -- メソッド: ZipFile.infolist ()

     アーカイブに含まれる各メンバの *note ZipInfo: 54e. オブジェクトから
     なるリストを返します。既存のアーカイブファイルを開いている場合、リ
     ストの順番は実際の 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: 54e. 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: 1d2. object.

     *note open(): 850. はコンテキストマネージャでもあるので *note with:
     215. 文をサポートしています:

          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(): 16e2, *note
     readline(): 16e3, *note readlines(): 29d3, *note seek(): 1646,
     *note tell(): 1765, *note __iter__(): 22b8, *note __next__(): 1687.
     These objects can operate independently of the ZipFile.

     With ‘mode='w'’, a writable file handle is returned, which supports
     the *note write(): 109d. method.  While a writable file handle is
     open, attempting to read or write other files in the ZIP file will
     raise a *note ValueError: 15a.

     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: 54e. object with *note
     file_size: 30dd. set, and use that as the 'name' parameter.

          注釈: *note open(): 850.、*note read(): 30de.、および *note
          extract(): 30df. メソッドには、ファイル名または *note ZipInfo:
          54e. オブジェクトを指定できます。これは重複する名前のメンバを
          含む ZIP ファイルを読み込むときにそのメリットを享受できるでし
          ょう。

     バージョン 3.6 で変更: Removed support of ‘mode='U'’.  Use *note
     io.TextIOWrapper: ba0. for reading compressed text files in *note
     universal newlines: 10f5. 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: 15a.  Previously, a *note RuntimeError:
     317. 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: 54e. 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: 1d2. 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(): 30df. on a closed
     ZipFile will raise a *note ValueError: 15a.  Previously, a *note
     RuntimeError: 317. was raised.

     バージョン 3.6.2 で変更: 'path' パラメタが *note path-like object:
     7a5. を受け付けるようになりました。

 -- メソッド: 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(): 30dc.  'pwd' is the password used for encrypted
     files as a *note bytes: 1d2. object.

          警告: 信頼できないソースからきた Zip ファイルを、事前に中身を
          チェックせずに展開してはいけません。ファイルを 'path' の外側に
          作成することができるからです。例えば、 ‘"/"’ で始まる絶対パス
          を持ったメンバーや、 2 つのドット ‘".."’ を持つファイル名など
          の場合です。このモジュールはそれを避けようとします。 *note
          extract(): 30df. の注釈を参照してください。

     バージョン 3.6 で変更: Calling *note extractall(): 30e0. on a
     closed ZipFile will raise a *note ValueError: 15a.  Previously, a
     *note RuntimeError: 317. was raised.

     バージョン 3.6.2 で変更: 'path' パラメタが *note path-like object:
     7a5. を受け付けるようになりました。

 -- メソッド: ZipFile.printdir ()

     アーカイブの内容の一覧を ‘sys.stdout’ に出力します。

 -- メソッド: ZipFile.setpassword (pwd)

     Set 'pwd' (a *note bytes: 1d2. 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: 54e. object.
     The archive must be open for read or append.  'pwd' is the password
     used for encrypted files as a *note bytes: 1d2. object and, if
     specified, overrides the default password set with *note
     setpassword(): 30e2.  Calling ‘read()’ on a ZipFile that uses a
     compression method other than *note ZIP_STORED: 30d5, *note
     ZIP_DEFLATED: 30d6, *note ZIP_BZIP2: 30d7, *note ZIP_LZMA: 30d8, or
     *note ZIP_ZSTANDARD: 30d9. will raise a *note NotImplementedError:
     5a1.  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: 15a.  Previously, a *note RuntimeError:
     317. 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: 15a.  Previously, a *note RuntimeError:
     317. 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: 15a.
     Previously, a *note RuntimeError: 317. 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: 1ea. or a *note bytes: 1d2. 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: 54e. 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: 54e. instance).
     Similarly, 'compresslevel' will override the constructor if given.

          注釈: *note ZipInfo: 54e. インスタンスを引数
          'zinfo_or_arcname' として与えた場合、与えられた ‘ZipInfo’ イン
          スタンスのメンバーである 'compress_type' で指定された圧縮方法
          が使われます。デフォルトでは、‘ZipInfo’ コンストラクターが、こ
          のメンバーを *note ZIP_STORED: 30d5. に設定します。

     バージョン 3.2 で変更: 引数 'compress_type' を追加しました。

     バージョン 3.6 で変更: Calling ‘writestr()’ on a ZipFile created
     with mode ‘'r'’ or a closed ZipFile will raise a *note ValueError:
     15a.  Previously, a *note RuntimeError: 317. 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: 54e. 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: 1d2. オブジェクトとして関連付けられたコ
     メントです。モード ‘'w'’ 、 ‘'x'’ または ‘'a'’ で作成された *note
     ZipFile: ab6. インスタンスへコメントを割り当てる場合、文字列長は
     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: ab6. 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(): 30df. and
          *note ZipFile.extractall(): 30e0. methods, it is the caller's
          responsibility to validate or sanitize filenames to prevent
          path traversal vulnerabilities (e.g., filenames containing
          ".."  or absolute paths).  When handling untrusted archives,
          consider resolving filenames using *note os.path.abspath():
          16d4. and checking against the target directory with *note
          os.path.commonpath(): 33c.

Path objects expose the following features of *note pathlib.Path: 4f5.
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(): 850. 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: ba0. 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: 29c.
     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: ba0.
     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: ba0.
     (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: 29c.
     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: ba0.
     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: 13a6. コンストラクタは *note ZipFile: ab6. コンストラク
タと同じパラメータに加え、'optimize' パラメータをとります。

 -- クラス: zipfile.PyZipFile (file, mode='r', compression=ZIP_STORED,
          allowZip64=True, optimize=-1)

     バージョン 3.2 で変更: Added the 'optimize' parameter.

     バージョン 3.4 で変更: ZIP64 拡張がデフォルトで有効になりました。

     インスタンスは *note ZipFile: ab6. オブジェクトのメソッドの他に、追
     加のメソッドを 1 個持ちます:

      -- メソッド: writepy (pathname, basename='', filterfunc=None)

          ‘*.py’ ファイルを探し、一致するファイルをアーカイブに追加しま
          す。

          *note PyZipFile: 13a6. に 'optimize' 引数が与えられない場合、
          あるいは ‘-1’ が指定された場合、対応するファイルは ‘*.pyc’ フ
          ァイルで、必要に応じてコンパイルします。

          *note PyZipFile: 13a6. の 'optimize' パラメータが ‘0’、‘1’、あ
          るいは ‘2’ の場合、それを最適化レベル (*note compile(): 1d3. 参
          照) とするファイルのみが、必要に応じてコンパイルされアーカイブ
          に追加されます。

          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: 317. 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(): 13a7. メソッドは以下のようなファイル名でアー
          カイブを作成します:

               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: 7a5. を受け付けるようになりました。

          バージョン 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: 54e. クラスのインスタンスは、*note ZipFile: ab6. オブジェ
クトの *note getinfo(): 30d2. および *note infolist(): 30d3. メソッドに
よって返されます。各オブジェクトは ZIP アーカイブ内の 1 個のメンバに関す
る情報を格納します。

There is one classmethod to make a *note ZipInfo: 54e. instance for a
filesystem file:

 -- メソッド: classmethod ZipInfo.from_file (filename, arcname=None, *,
          strict_timestamps=True)

     Construct a *note ZipInfo: 54e. 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:
     7a5. を受け入れるようになりました。

     バージョン 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: 1d2.
     object.

 -- の属性: ZipInfo.extra

     拡張フィールドデータ。この *note bytes: 1d2. オブジェクトに含まれて
     いるデータの内部構成については、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: 3106. オプションの後にま
とめたいファイルを列挙してください:

     $ python -m zipfile -c monty.zip spam.txt eggs.txt

ディレクトリを渡すこともできます:

     $ python -m zipfile -c monty.zip life-of-brian_1979/

ZIP アーカイブを特定のディレクトリに展開したい場合、*note -e: 3107. オプ
ションを使用してください:

     $ python -m zipfile -e monty.zip target-dir/

ZIP アーカイブ内のファイル一覧を表示するには *note -l: 3108. を使用して
ください:

     $ 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: 3108, *note -e:
     3107. and *note -t: 310d.

     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: 13a. module to read or write ‘.zip’ files, or the higher-level
functions in *note shutil: 15d5.

いくつかの事実と形態:

   * モジュールが利用可能な場合、*note gzip: 6a.、*note bz2: 14.、*note
     compression.zstd: 23. ならびに *note lzma: 8d. で圧縮されたアーカイ
     ブを読み書きします。

     If any of these *note optional modules: 2366. 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 オプションのモジュールの要件: 2364.

   * POSIX.1-1988 (ustar) フォーマットの読み書きをサポートしています。

   * 'longname' および 'longlink' 拡張を含む GNU tar フォーマットの読み
     書きをサポートしています。スパースファイルの復元を含む 'sparse' 拡
     張は読み込みのみサポートしています。

   * POSIX.1-2001 (pax) フォーマットの読み書きをサポートしています。

   * ディレクトリ、一般ファイル、ハードリンク、シンボリックリンク、
     fifo、キャラクターデバイスおよびブロックデバイスを処理します。また
     、タイムスタンプ、アクセス許可や所有者のようなファイル情報の取得お
     よび保存が可能です。

バージョン 3.3 で変更: *note lzma: 8d. 圧縮をサポートしました。

バージョン 3.12 で変更: Archives are extracted using a *note filter:
888, 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:
284, 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: 311a.

バージョン 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: 15cd. オブジェクトを返します。
     ‘TarFile’ オブジェクトと、利用できるキーワード引数に関する詳細な情
     報については、*note TarFile オブジェクト: 311b. 節を参照してくださ
     い。

     '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: 13cd. 例外を送出します。
                            
                            
     ‘'x:gz'’               gzip 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 13cd. 例外を送
                            出します。
                            
                            
     ‘'x:bz2'’              bzip2 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 13cd. 例外を送
                            出します。
                            
                            
     ‘'x:xz'’               lzma 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 13cd. 例外を送
                            出します。
                            
                            
     ‘'x:zst'’              Zstandard 圧縮で tarfile を作成します。tarfile
                            が既存の場合 *note FileExistsError: 13cd. 例外
                            を送出します。
                            
                            
     ‘'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: 1e65. が送出されます。これを
     防ぐには 'mode' ‘'r'’ を使って下さい。もし圧縮方式がサポートされて
     いなければ、*note CompressionError: 311c. が送出されます。

     もし 'fileobj' が指定されていれば、それは 'name' でバイナリモードで
     オープンされた *note ファイルオブジェクト: 1581. の代替として使うこ
     とができます。そのファイルオブジェクトの位置が 0 であることを前提に
     動作します。

     For modes ‘'w:gz'’, ‘'x:gz'’, ‘'w|gz'’, ‘'w:bz2'’, ‘'x:bz2'’,
     ‘'w|bz2'’, *note tarfile.open(): 122b. accepts the keyword argument
     'compresslevel' (default ‘6’) to specify the compression level of
     the file.

     ‘'w:xz'’、‘'x:xz'’ および ‘'w|xz'’ モードの場合、*note
     tarfile.open(): 122b. はファイルの圧縮レベルを指定するキーワード引
     数 'preset' を受け付けます。

     For modes ‘'w:zst'’, ‘'x:zst'’ and ‘'w|zst'’, *note tarfile.open():
     122b. 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: 3023.  The keyword
     argument 'zstd_dict' can be passed to provide a *note ZstdDict:
     3022, a Zstandard dictionary used to improve compression of smaller
     amounts of data.

     For modes ‘'w:gz'’ and ‘'w|gz'’, *note tarfile.open(): 122b.
     accepts the keyword argument 'mtime' to create a gzip archive
     header with that mtime.  By default, the mtime is set to the time
     of creation of the archive.

     For special purposes, there is a second format for 'mode':
     ‘'filemode|[compression]'’.  *note tarfile.open(): 122b. will
     return a *note TarFile: 15cd. 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(): 11d4.
     or *note write(): 1764. 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: 1581. or a tape
     device.  However, such a ‘TarFile’ object is limited in that it
     does not allow random access, see *note 使用例: 311d.  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:
     7a5. を受け付けるようになりました。

     バージョン 3.12 で変更: The 'compresslevel' keyword argument also
     works for streams.

     バージョン 3.14 で変更: The 'preset' keyword argument also works
     for streams.

     バージョン 3.15 で変更: The default compression level was reduced
     to 6 (down from 9).  It is the default level used by most
     compression tools and a better tradeoff between speed and
     performance.

 -- クラス: tarfile.TarFile

     tar アーカイブを読み書きするためのクラスです。このクラスを直接使わ
     ないこと: 代わりに *note tarfile.open(): 122b. を使ってください。
     *note TarFile オブジェクト: 311b. を参照してください。

 -- の関数: tarfile.is_tarfile (name)

     Return *note True: fd0. if 'name' is a tar archive file, that the
     ‘tarfile’ module can read.  'name' may be a *note str: 1ea, 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: 15cd. オブジェクトで典型的な制限
     のために送出されます。

 -- 例外: tarfile.ExtractError

     *note TarFile.extract(): 286. を使った時に '致命的でない' エラーに
     対して送出されます。ただし *note TarFile.errorlevel: 288.‘== 2’ の
     場合に限ります。

 -- 例外: tarfile.HeaderError

     *note TarInfo.frombuf(): 3122. メソッドが取得したバッファーが不正だ
     ったときに送出されます。

 -- 例外: tarfile.FilterError

     Base class for members *note refused: 3124. by filters.

      -- の属性: tarinfo

          Information about the member that the filter refused to
          extract, as *note TarInfo: 3126.

 -- 例外: 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.15.

モジュールレベルで以下の定数が利用できます。

 -- データ: tarfile.ENCODING

     既定の文字エンコーディング。Windows では ‘'utf-8'’ 、それ以外では
     *note sys.getfilesystemencoding(): 101b. の返り値です。

 -- データ: tarfile.REGTYPE
 -- データ: tarfile.AREGTYPE

     A regular file *note type: 312f.

 -- データ: tarfile.LNKTYPE

     A link (inside tarfile) *note type: 312f.

 -- データ: tarfile.SYMTYPE

     A symbolic link *note type: 312f.

 -- データ: tarfile.CHRTYPE

     A character special device *note type: 312f.

 -- データ: tarfile.BLKTYPE

     A block special device *note type: 312f.

 -- データ: tarfile.DIRTYPE

     A directory *note type: 312f.

 -- データ: tarfile.FIFOTYPE

     A FIFO special device *note type: 312f.

 -- データ: tarfile.CONTTYPE

     A contiguous file *note type: 312f.

 -- データ: tarfile.GNUTYPE_LONGNAME

     A GNU tar longname *note type: 312f.

 -- データ: tarfile.GNUTYPE_LONGLINK

     A GNU tar longlink *note type: 312f.

 -- データ: tarfile.GNUTYPE_SPARSE

     A GNU tar sparse file *note type: 312f.

Each of the following constants defines a tar archive format that the
‘tarfile’ module is able to create.  See section *note サポートしている
tar フォーマット: 313a. 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: 313d. です。

     バージョン 3.8 で変更: 新しいアーカイブのデフォルトフォーマットが
     *note GNU_FORMAT: 313c. から *note PAX_FORMAT: 313d. に変更されまし
     た。

参考
....

*note zipfile: 13a. モジュール

     *note zipfile: 13a. 標準モジュールのドキュメント。

*note アーカイブ化操作: 15d5.

     *note shutil: cd. が提供するより高水準のアーカイブ機能についてのド
     キュメント。

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/main/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: 15cd. オブジェクトは、tar アーカイブへのインターフェース
を提供します。tar アーカイブは一連のブロックです。アーカイブメンバー (保
存されたファイル) は、ヘッダーブロックとそれに続くデータブロックで構成さ
れています。一つの tar アーカイブにファイルを何回も保存することができま
す。各アーカイブメンバーは、*note TarInfo: 15ce. オブジェクトで確認でき
ます。詳細については *note TarInfo オブジェクト: 3126. を参照してくださ
い。

*note TarFile: 15cd. オブジェクトは *note with: 215. 文のコンテキストマ
ネージャーとして利用できます。with ブロックが終了したときにオブジェクト
はクローズされます。例外が発生した時、内部で利用されているファイルオブジ
ェクトのみがクローズされ、書き込み用にオープンされたアーカイブのファイナ
ライズは行われないことに注意してください。*note 使用例: 311d. 節のユース
ケースを参照してください。

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: 7a5.  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: 15cd. をクローズした時、'fileobj' はクロ
          ーズされません。

     'format' はアーカイブの書き込みフォーマットを制御します。モジュール
     レベルで定義されている、*note USTAR_FORMAT: 313b.、*note
     GNU_FORMAT: 313c.、あるいは *note PAX_FORMAT: 313d. のいずれかであ
     る必要があります。 読み出しのときは、1 つのアーカイブに異なるフォー
     マットが混在していたとしても、フォーマットは自動的に検知されます。

     'tarinfo' 引数を利用して、デフォルトの *note TarInfo: 15ce. クラス
     を別のクラスで置き換えることができます。

     'dereference' が *note False: ef9. だった場合、シンボリックリンクや
     ハードリンクがアーカイブに追加されます。*note True: fd0. だった場合
     、リンクのターゲットとなるファイルの内容がアーカイブに追加されます
     。シンボリックリンクをサポートしていないシステムでは効果がありませ
     ん。

     'ignore_zeros' が *note False: ef9. だった場合、空ブロックをアーカ
     イブの終端として扱います。*note True: fd0. だった場合、空の (無効な
     ) ブロックをスキップして、可能な限り多くのメンバーを取得しようとし
     ます。このオプションは、連結されたり、壊れたアーカイブファイルを扱
     うときにのみ、意味があります。

     'debug' は ‘0’ (デバッグメッセージ無し) から ‘3’ (全デバッグメッセ
     ージ) まで設定できます。このメッセージは ‘sys.stderr’ に書き込まれ
     ます。

     'errorlevel' controls how extraction errors are handled, see *note
     the corresponding attribute: 288.

     引数 'encoding' および 'errors' にはアーカイブの読み書きやエラー文
     字列の変換に使用する文字エンコーディングを指定します。ほとんどのユ
     ーザーはデフォルト設定のままで動作します。詳細に関しては *note
     Unicode に関する問題: 3140. 節を参照してください。

     引数 'pax_headers' は、オプションの文字列辞書で、'format' が *note
     PAX_FORMAT: 313d. だった場合に pax グローバルヘッダーに追加されます
     。

     If 'stream' is set to *note True: fd0. 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:
     7a5. を受け付けるようになりました。

     バージョン 3.13 で変更: Add the 'stream' parameter.

 -- メソッド: classmethod TarFile.open (...)

     代替コンストラクターです。モジュールレベルでの *note
     tarfile.open(): 122b. 関数は、実際はこのクラスメソッドへのショート
     カットです。

 -- メソッド: TarFile.getmember (name)

     メンバー 'name' に対する *note TarInfo: 15ce. オブジェクトを返しま
     す。'name' がアーカイブに見つからなければ、*note KeyError: 7e5. が
     送出されます。

          注釈: アーカイブ内にメンバーが複数ある場合は、最後に出現するも
          のが最新のバージョンとみなされます。

 -- メソッド: TarFile.getmembers ()

     *note TarInfo: 15ce. アーカイブのメンバーをオブジェクトのリストとし
     て返します。このリストはアーカイブ内のメンバーと同じ順番です。

 -- メソッド: TarFile.getnames ()

     メンバーをその名前のリストを返します。これは *note getmembers():
     122d. で返されるリストと同じ順番です。

 -- メソッド: TarFile.list (verbose=True, *, members=None)

     内容の一覧を ‘sys.stdout’ に出力します。'verbose' が *note False:
     ef9. の場合、メンバー名のみ表示します。*note True: fd0. の場合、
     ‘ls -l’ に似た出力を生成します。オプションの 'members' を与える場合
     、 *note getmembers(): 122d. が返すリストのサブセットである必要があ
     ります。

     バージョン 3.5 で変更: 'members' 引数が追加されました。.

 -- メソッド: TarFile.next ()

     *note TarFile: 15cd. が読み込み用にオープンされている時、アーカイブ
     の次のメンバーを *note TarInfo: 15ce. オブジェクトとして返します。
     もしそれ以上利用可能なものがなければ、*note None: a6a. を返します。

 -- メソッド: TarFile.extractall (path='.', members=None, *,
          numeric_owner=False, filter=None)

     すべてのメンバーをアーカイブから現在の作業ディレクトリまたは 'path'
     に抽出します。オプションの 'members' が与えられるときには、*note
     getmembers(): 122d. で返されるリストの一部でなければなりません。所
     有者、変更時刻、アクセス権限のようなディレクトリ情報はすべてのメン
     バーが抽出された後にセットされます。これは二つの問題を回避するため
     です。一つはディレクトリの変更時刻はその中にファイルが作成されるた
     びにリセットされるということ、もう一つはディレクトリに書き込み許可
     がなければその中のファイル抽出は失敗してしまうということです。

     'numeric_owner' が *note True: fd0. の場合、tarfile の uid と gid 数
     値が抽出されたファイルのオーナー/グループを設定するために使用されま
     す。False の場合、tarfile の名前付きの値が使用されます。

     The 'filter' argument specifies how ‘members’ are modified or
     rejected before extraction.  See *note Extraction filters: 888. 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: 284.) will prevent
          the most dangerous security issues.  However, it will not
          prevent 'all' unintended or insecure behavior.  Read the *note
          Extraction filters: 888. section for details.

     バージョン 3.5 で変更: 'numeric_owner' 引数が追加されました。

     バージョン 3.6 で変更: 'path' パラメタが *note path-like object:
     7a5. を受け付けるようになりました。

     バージョン 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: 15ce. オブジェクトです。 'path' を
     使って別のディレクトリを指定することもできます。 'path' は　*note
     path-like object: 7a5. でも構いません。'set_attrs' が false でない
     限り、ファイルの属性 (所有者、最終更新時刻、モード) は設定されます
     。

     The 'numeric_owner' and 'filter' arguments are the same as for
     *note extractall(): 285.

          注釈: *note extract(): 286. メソッドはいくつかの展開に関する問
          題を扱いません。ほとんどの場合、*note extractall(): 285. メソ
          ッドの利用を考慮するべきです。

          警告: Never extract archives from untrusted sources without
          prior inspection.  See the warning for *note extractall():
          285. for details.

     バージョン 3.2 で変更: パラメーターに 'set_attrs' を追加しました。

     バージョン 3.5 で変更: 'numeric_owner' 引数が追加されました。

     バージョン 3.6 で変更: 'path' パラメタが *note path-like object:
     7a5. を受け付けるようになりました。

     バージョン 3.12 で変更: 'filter' パラメータが追加されました。

 -- メソッド: TarFile.extractfile (member)

     アーカイブからメンバーをファイルオブジェクトとして抽出します。
     'member' はファイル名でも *note TarInfo: 15ce. オブジェクトでも構い
     ません。'member' が一般ファイルまたはリンクの場合、*note
     io.BufferedReader: 15cb. オブジェクトが返されます。 存在するそれ以
     外のメンバーでは、 *note None: a6a. が返されます。 それ以外の場合、
     ‘None’ が返されます。 アーカイブに 'member' が存在しない場合は
     *note KeyError: 7e5. が送出されます。

     バージョン 3.3 で変更: 戻り値が *note io.BufferedReader: 15cb. オブ
     ジェクトになりました。

     バージョン 3.13 で変更: The returned *note io.BufferedReader: 15cb.
     object has the ‘mode’ attribute which is always equal to ‘'rb'’.

 -- の属性: TarFile.errorlevel: *note int: 32e.

     If 'errorlevel' is ‘0’, errors are ignored when using *note
     TarFile.extract(): 286. and *note TarFile.extractall(): 285.
     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: 543. or *note FilterError:
     3123. exceptions.  If ‘2’, all 'non-fatal' errors are raised as
     *note TarError: 311e. exceptions as well.

     Some exceptions, e.g.  ones caused by wrong argument types or data
     corruption, are always raised.

     Custom *note extraction filters: 888. should raise *note
     FilterError: 3123. for 'fatal' errors and *note ExtractError: 3120.
     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: 888. used as a default for the
     'filter' argument of *note extract(): 286. and *note extractall():
     285.

     The attribute may be ‘None’ or a callable.  String names are not
     allowed for this attribute, unlike the 'filter' argument to *note
     extract(): 286.

     If ‘extraction_filter’ is ‘None’ (the default), extraction methods
     will use the *note data: 284. 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: cf.  To set a global default this way, a
     filter function needs to be wrapped in *note staticmethod(): 66d.
     to prevent injection of a ‘self’ argument.

     バージョン 3.14 で変更: The default filter is set to *note data:
     284, 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: 311a.

 -- メソッド: TarFile.add (name, arcname=None, recursive=True, *,
          filter=None)

     ファイル 'name' をアーカイブに追加します。 'name' は、任意のファイ
     ルタイプ (ディレクトリ、fifo、シンボリックリンク等)です。 'arcname'
     が与えられている場合は、それはアーカイブ内のファイルの代替名を指定
     します。 デフォルトではディレクトリは再帰的に追加されます。 これは
     、 'recursive' を *note False: ef9. に設定すると避けられます。 再帰
     処理はソートされた順序でエントリーを追加します。 'filter' が与えら
     れた場合、それは *note TarInfo: 15ce. オブジェクトを引数として受け
     取り、操作した ‘TarInfo’ オブジェクトを返す関数でなければなりません
     。 代わりに *note None: a6a. を返した場合、 ‘TarInfo’ オブジェクト
     はアーカイブから除外されます。 *note 使用例: 311d. にある例を参照し
     てください。

     バージョン 3.2 で変更: 'filter' パラメータが追加されました。

     バージョン 3.7 で変更: 再帰処理はソートされた順序でエントリーを追加
     するようになりました。

 -- メソッド: TarFile.addfile (tarinfo, fileobj=None)

     Add the *note TarInfo: 15ce. object 'tarinfo' to the archive.  If
     'tarinfo' represents a non zero-size regular file, the 'fileobj'
     argument should be a *note binary file: 227b, and ‘tarinfo.size’
     bytes are read from it and added to the archive.  You can create
     ‘TarInfo’ objects directly, or by using *note gettarinfo(): 3145.

     バージョン 3.13 で変更: 'fileobj' must be given for non-zero-sized
     regular files.

 -- メソッド: TarFile.gettarinfo (name=None, arcname=None, fileobj=None)

     *note os.stat(): 4fc. の結果か、既存のファイルに相当するものから、
     *note TarInfo: 15ce. オブジェクトを作成します。このファイルは、
     'name' で名付けられるか、ファイル記述子を持つ *note file object:
     1581. 'fileobj' として指定されます。'name' は *note path-like
     object: 7a5. でも構いません。 'arcname' が与えられた場合、アーカイ
     ブ内のファイルに対して代替名を指定します。与えられない場合、名前は
     'fileobj' の *note name: 302d. 属性 'name' 属性から取られます。名前
     はテキスト文字列にしてください。

     *note TarInfo: 15ce. の属性の一部は、*note addfile(): 1bd1. を使用
     して追加する前に修正できます。ファイルオブジェクトが、ファイルの先
     頭にある通常のファイルオブジェクトでない場合、 *note size: 3146. な
     どの属性は修正が必要かもしれません。これは、 *note GzipFile: 84f. な
     どの属性に当てはまります。*note name: 3147. も修正できるかもしれず
     、この場合、'arcname' はダミーの文字列にすることができます。

     バージョン 3.6 で変更: 'name' パラメタが *note path-like object:
     7a5. を受け付けるようになりました。

 -- メソッド: TarFile.close ()

     *note TarFile: 15cd. をクローズします。書き込みモードでは、完了ゼロ
     ブロックが 2 個アーカイブに追加されます。

 -- の属性: TarFile.pax_headers: *note dict: 193.

     pax グローバルヘッダーに含まれる key-value ペアの辞書です。


File: python.info,  Node: TarInfo オブジェクト,  Next: Extraction filters,  Prev: TarFile オブジェクト,  Up: tarfile --- tar アーカイブファイルの読み書き

5.14.8.2 TarInfo オブジェクト
.............................

*note TarInfo: 15ce. オブジェクトは *note TarFile: 15cd. の一つのメンバ
ーを表します。ファイルに必要なすべての属性 (ファイルタイプ、ファイルサイ
ズ、時刻、アクセス権限、所有者等のような) を保存する他に、そのタイプを決
定するのに役に立ついくつかのメソッドを提供します。これにはファイルのデー
タそのものは '含まれません' 。

*note TarInfo: 15ce. objects are returned by *note TarFile: 15cd.'s
methods *note getmember(): 1e07, *note getmembers(): 122d. and *note
gettarinfo(): 3145.

Modifying the objects returned by *note getmember(): 1e07. or *note
getmembers(): 122d. 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(): 314b. 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: 15ce. methods
handle ‘None’ differently:

   - The *note extract(): 286. or *note extractall(): 285. methods will
     ignore the corresponding metadata, leaving it set to a default.

   - *note addfile(): 1bd1. will fail.

   - *note list(): 122c. will print a placeholder string.

 -- クラス: tarfile.TarInfo (name='')

     *note TarInfo: 15ce. オブジェクトを作成します。

 -- メソッド: classmethod TarInfo.frombuf (buf, encoding, errors)

     *note TarInfo: 15ce. オブジェクトを文字列バッファー 'buf' から作成
     して返します。

     バッファーが不正な場合 *note HeaderError: 3121. を送出します。

 -- メソッド: classmethod TarInfo.fromtarfile (tarfile)

     *note TarFile: 15cd. オブジェクトの 'tarfile' から、次のメンバーを
     読み込んで、それを *note TarInfo: 15ce. オブジェクトとして返します
     。

 -- メソッド: TarInfo.tobuf (format=DEFAULT_FORMAT, encoding=ENCODING,
          errors='surrogateescape')

     *note TarInfo: 15ce. オブジェクトから文字列バッファーを作成します。
     引数についての情報は、*note TarFile: 15cd. クラスのコンストラクター
     を参照してください。

     バージョン 3.2 で変更: 引数 'errors' のデフォルトが
     ‘'surrogateescape'’ になりました。

‘TarInfo’ オブジェクトには以下のデータ属性があります:

 -- の属性: TarInfo.name: *note str: 1ea.

     アーカイブメンバーの名前。

 -- の属性: TarInfo.size: *note int: 32e.

     バイト単位でのサイズ。

 -- の属性: TarInfo.mtime: *note int: 32e. | *note float: 32f.

     Time of last modification in seconds since the *note epoch: 314f,
     as in *note os.stat_result.st_mtime: 3150.

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     286. and *note extractall(): 285, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.mode: *note int: 32e.

     Permission bits, as for *note os.chmod(): 732.

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     286. and *note extractall(): 285, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.type

     ファイルタイプ。'type' は通常、定数 *note REGTYPE: 312d.、*note
     AREGTYPE: 312e.、*note LNKTYPE: 3130.、*note SYMTYPE: 3131.、*note
     DIRTYPE: 3134.、*note FIFOTYPE: 3135.、*note CONTTYPE: 3136.、*note
     CHRTYPE: 3132.、*note BLKTYPE: 3133.、あるいは *note
     GNUTYPE_SPARSE: 3139. のいずれかです。*note TarInfo: 15ce. オブジェ
     クトのタイプをもっと簡単に解決するには、下記の ‘is*()’ メソッドを使
     って下さい。

 -- の属性: TarInfo.linkname: *note str: 1ea.

     リンク先ファイルの名前。これはタイプ *note LNKTYPE: 3130. と *note
     SYMTYPE: 3131. の *note TarInfo: 15ce. オブジェクトにだけ存在します
     。

     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: 32e.

     ファイルメンバーを保存した元のユーザーのユーザー ID。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     286. and *note extractall(): 285, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.gid: *note int: 32e.

     ファイルメンバーを保存した元のユーザーのグループ ID。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     286. and *note extractall(): 285, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.uname: *note str: 1ea.

     ファイルメンバーを保存した元のユーザーのユーザー名。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     286. and *note extractall(): 285, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.gname: *note str: 1ea.

     ファイルメンバーを保存した元のユーザーのグループ名。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     286. and *note extractall(): 285, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.chksum: *note int: 32e.

     Header checksum.

 -- の属性: TarInfo.devmajor: *note int: 32e.

     Device major number.

 -- の属性: TarInfo.devminor: *note int: 32e.

     Device minor number.

 -- の属性: TarInfo.offset: *note int: 32e.

     The tar header starts here.

 -- の属性: TarInfo.offset_data: *note int: 32e.

     The file's data starts here.

 -- の属性: TarInfo.sparse

     Sparse member information.

 -- の属性: TarInfo.pax_headers: *note dict: 193.

     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: 15ce. オブジェクトは便利な照会用のメソッドもいくつか提供
しています:

 -- メソッド: TarInfo.isfile ()

     Return *note True: fd0. if the *note TarInfo: 15ce. object is a
     regular file.

 -- メソッド: TarInfo.isreg ()

     *note isfile(): 315e. と同じです。

 -- メソッド: TarInfo.isdir ()

     ディレクトリの場合に *note True: fd0. を返します。

 -- メソッド: TarInfo.issym ()

     シンボリックリンクの場合に *note True: fd0. を返します。

 -- メソッド: TarInfo.islnk ()

     ハードリンクの場合に *note True: fd0. を返します。

 -- メソッド: TarInfo.ischr ()

     キャラクターデバイスの場合に *note True: fd0. を返します。

 -- メソッド: TarInfo.isblk ()

     ブロックデバイスの場合に *note True: fd0. を返します。

 -- メソッド: TarInfo.isfifo ()

     FIFO の場合に *note True: fd0. を返します。

 -- メソッド: TarInfo.isdev ()

     キャラクターデバイス、ブロックデバイスあるいは FIFO のいずれかの場
     合に *note True: fd0. を返します。


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:
     2f2f.

参考
....

PEP 706(1)

     Contains further motivation and rationale behind the design.

The 'filter' argument to *note TarFile.extract(): 286. or *note
extractall(): 285. 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():
     3168. 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(): 284. for details.

   * ‘None’ (default): Use *note TarFile.extraction_filter: 3144.

     If that is also ‘None’ (the default), the ‘'data'’ filter will be
     used.

          バージョン 3.14 で変更: The default filter is set to *note
          data: 284.  Previously, the default was equivalent to *note
          fully_trusted: 311a.

   * A callable which will be called for each extracted member with a
     *note TarInfo: 3126. 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: 15ce. 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: 288.  Note that when extraction
          is aborted, *note extractall(): 285. 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: a5f.) from
          filenames.

        - *note Refuse: 3124. 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:
          3127.

        - *note Refuse: 3124. to extract files whose absolute path
          (after following symlinks) would end up outside the
          destination.  This raises *note OutsideDestinationError: 3128.

        - Clear high mode bits (setuid, setgid, sticky) and group/other
          write bits (*note S_IWGRP: 2eb2. | *note S_IWOTH: 2eb5.).

     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: 3152.) using
          *note os.path.normpath(): 16d3.  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: 3124. to extract links (hard or soft) that link
          to absolute paths, or ones that link outside the destination.

          This raises *note AbsoluteLinkError: 312a. or *note
          LinkOutsideDestinationError: 312b.

          Note that such files are refused even on platforms that do not
          support symbolic links.

        - *note Refuse: 3124. to extract device files (including pipes).
          This raises *note SpecialFileError: 3129.

        - For regular files, including hard links:

             - Set the owner read and write permissions (*note S_IRUSR:
               2ead. | *note S_IWUSR: 2eae.).

             - Remove the group & other executable permission (*note
               S_IXGRP: 2ea9. | *note S_IXOTH: 2eb6.) if the owner
               doesn’t have it (*note S_IXUSR: 2eaf.).

        - 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: 2f2f. for
     details.

     バージョン 3.15 で変更: 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: 3123.  This will abort the
extraction if *note TarFile.errorlevel: 288. 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: 735. 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: 316f. オプションの後にま
とめたいファイル名のリストを指定してください:

     $ python -m tarfile -c monty.tar  spam.txt eggs.txt

ディレクトリを渡すこともできます:

     $ python -m tarfile -c monty.tar life-of-brian_1979/

tar アーカイブをカレントディレクトリに展開したい場合、*note -e: 3170. オ
プションを使用してください:

     $ python -m tarfile -e monty.tar

ディレクトリ名を渡すことで tar アーカイブを別のディレクトリに取り出すこ
ともできます:

     $ python -m tarfile -e monty.tar  other-dir/

tar アーカイブ内のファイル一覧を表示するには *note -l: 3171. を使用して
ください:

     $ 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: 888. 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(): 285. で展開する方法:

     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: 215. 文を利用した同じ例:

     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: ea0. in the 'fileobj' parameter in *note
TarFile.add(): fb7.:

     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(): fb7. 関数の '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: 313b.).  ファイル名
     の長さは256文字までで、リンク名の長さは100文字までです。最大のファ
     イルサイズは8GiBです。このフォーマットは古くて制限が多いですが、広
     くサポートされています。

   * The GNU tar format (*note GNU_FORMAT: 313c.).  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: 313d.).  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: 15cd.
class.

'encoding' はアーカイブのメタデータに使用する文字エンコーディングを指定
します。デフォルト値は *note sys.getfilesystemencoding(): 101b. で、フォ
ールバックとして ‘'ascii'’ が使用されます。アーカイブの読み書き時に、メ
タデータはそれぞれデコードまたはエンコードしなければなりません。
'encoding' に適切な値が設定されていない場合、その変換は失敗することがあ
ります。

引数 'errors' は文字を変換できない時の扱いを指定します。指定できる値は
*note エラーハンドラ: 1d8b. 節を参照してください。デフォルトのスキームは
‘'surrogateescape'’ で、Python はそのファイルシステムの呼び出しも使用し
ます。*note ファイル名、コマンドライン引数、および環境変数: 3180. を参照
してください。

デフォルトの *note PAX_FORMAT: 313d. アーカイブでは、メタデータはすべて
'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: 89d. and *note writer: 89e. objects
read and write sequences.  Programmers can also read and write data in
dictionary form using the *note DictReader: dad. and *note DictWriter:
15bd. 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/main/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: 3189. 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: 1a5c. class or one of
     the strings returned by the *note list_dialects(): 1daf. 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 クラスと書式化パラメータ: 318a.

     csv ファイルから読み込まれた各行は、文字列のリストとして返されます
     。*note QUOTE_NONNUMERIC: 1b7e. フォーマットオプションが指定された
     場合を除き、データ型の変換が自動的に行われることはありません (この
     オプションが指定された場合、クォートされていないフィールドは浮動小
     数点数に変換されます)。

     短い利用例:

          >>> import csv
          >>> with open('eggs.csv', newline='') as csvfile:
          ...     spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
          ...     for row in spamreader:
          ...         print(', '.join(row))
          Spam, Spam, Spam, Spam, Spam, Baked Beans
          Spam, Lovely Spam, Wonderful Spam

 -- の関数: csv.writer (csvfile, /, dialect='excel', **fmtparams)

     ユーザが与えたデータをデリミタで区切られた文字列に変換し、与えられ
     たファイルオブジェクトに書き込むための writer オブジェクトを返しま
     す。 'csvfile' は *note write(): 2268. メソッドを持つ任意のオブジェ
     クトです。 'csvfile' がファイルオブジェクトの場合、 ‘newline=''’ と
     して開くべきです (2) 。オプションとして 'dialect' 引数を与えること
     ができ、利用するCSV表現形式(dialect)を指定することができます。
     'dialect' パラメータは *note Dialect: 1a5c. クラスのサブクラスのイ
     ンスタンスか、 *note list_dialects(): 1daf. 関数が返す文字列の1つに
     することができます。別のオプション引数である 'fmtparams' キーワード
     引数は、現在の表現形式における個々の書式パラメータを上書きするため
     に与えることができます。dialect と書式パラメータについての詳細は、
     *note Dialect クラスと書式化パラメータ: 318a. 節を参照してください
     。 DB API を実装するモジュールとのインターフェースを可能な限り容易
     にするために、 *note None: a6a. は空文字列として書き込まれます。こ
     の処理は可逆な変換ではありませんが、SQL で NULL データ値を CSV にダ
     ンプする処理を、 ‘cursor.fetch*’ 呼び出しによって返されたデータを前
     処理することなく簡単に行うことができます。他の非文字列データは、書
     き出される前に *note str(): 1ea. を使って文字列に変換されます。

     短い利用例:

          import csv
          with open('eggs.csv', 'w', newline='') as csvfile:
              spamwriter = csv.writer(csvfile, delimiter=' ',
                                      quotechar='|', quoting=csv.QUOTE_MINIMAL)
              spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])
              spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])

 -- の関数: csv.register_dialect (name, /, dialect='excel', **fmtparams)

     'dialect' を 'name' と関連付けます。 'name' は文字列でなければなり
     ません。表現形式(dialect)は *note Dialect: 1a5c. のサブクラスを渡す
     か、またはキーワード引数 'fmtparams' 、もしくは両方で指定できますが
     、キーワード引数の方が優先されます。表現形式と書式化パラメータにつ
     いての詳細は、 *note Dialect クラスと書式化パラメータ: 318a. 節を参
     照してください。

 -- の関数: csv.unregister_dialect (name)

     'name' に関連づけられた表現形式を表現形式レジストリから削除します。
     'name' が表現形式名でない場合には *note Error: 318b. を送出します。

 -- の関数: csv.get_dialect (name)

     'name' に関連づけられた表現形式を返します。 'name' が表現形式名でな
     い場合には *note Error: 318b. を送出します。この関数は不変の *note
     Dialect: 1a5c. を返します。

 -- の関数: 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:
     193. にマップするオブジェクトを生成します。マップのキーは省略可能な
     'fieldnames' パラメータで与えられます。

     The 'fieldnames' parameter is a *note sequence: 904.  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: 89d. インスタンスに渡されます。

     'fieldnames' に渡された引数がイテレータの場合、 *note list: 4e0. に
     変換されます。

     バージョン 3.6 で変更: 返される行の型は ‘OrderedDict’ になりました
     。

     バージョン 3.8 で変更: 返される行の型は *note dict: 193. になりまし
     た。

     短い利用例:

          >>> import csv
          >>> with open('names.csv', newline='') as csvfile:
          ...     reader = csv.DictReader(csvfile)
          ...     for row in reader:
          ...         print(row['first_name'], row['last_name'])
          ...
          Eric Idle
          John Cleese

          >>> print(row)
          {'first_name': 'John', 'last_name': 'Cleese'}

 -- クラス: csv.DictWriter (f, fieldnames, restval='',
          extrasaction='raise', dialect='excel', *args, **kwds)

     通常の writer のように動作しますが、辞書を出力行にマップするオブジ
     ェクトを生成します。 'fieldnames' パラメータは、*note writerow():
     11a5. メソッドに渡された辞書の値がどのような順番でファイル 'f' に書
     かれるかを指定するキーの *note sequence: 1f. です。 ‘writerow()’ メ
     ソッドに渡された辞書に 'fieldnames' には存在しないキーが含まれてい
     る場合、オプションの 'extrasaction' パラメータによってどんな動作を
     行うかが指定されます。この値がデフォルト値である ‘'raise'’ に設定さ
     れている場合、 *note ValueError: 15a. が送出されます。 ‘'ignore'’ に
     設定されている場合、辞書の余分な値は無視されます。その他のパラメー
     タはベースになっている *note writer: 89e. インスタンスに渡されます
     。

     *note DictReader: dad. クラスとは異なり、 *note DictWriter: 15bd. の
     'fieldnames' パラメータは省略可能ではありません。

     'fieldnames' に渡された引数がイテレータの場合、 *note list: 4e0. に
     変換されます。

     短い利用例:

          import csv

          with open('names.csv', 'w', newline='') as csvfile:
              fieldnames = ['first_name', 'last_name']
              writer = csv.DictWriter(csvfile, fieldnames=fieldnames)

              writer.writeheader()
              writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})
              writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})
              writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})

 -- クラス: csv.Dialect

     *note Dialect: 1a5c. クラスはコンテナクラスです。その属性に、ダブル
     クォート、空白文字、デリミタなどの扱い方に関する情報を含みます。CSV
     には厳密な規格がないため、アプリケーションによって生成される CSV デ
     ータはそれぞれ僅かに異なります。 ‘Dialect’ クラスのインスタンスは
     *note reader: 89d. と *note writer: 89e. のインスタンスの挙動を定義
     します。

     All available ‘Dialect’ names are returned by *note
     list_dialects(): 1daf, and they can be registered with specific
     *note reader: 89d. and *note writer: 89e. 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: 318c. クラスは Excel で生成される CSV ファイルの通常の
     プロパティを定義します。これは ‘'excel'’ という名前の dialect とし
     て登録されています。

 -- クラス: csv.excel_tab

     *note excel_tab: 318d. クラスは Excel で生成されるタブ分割ファイル
     の通常のプロパティを定義します。これは ‘'excel-tab'’ という名前の
     dialect として登録されています。

 -- クラス: csv.unix_dialect

     *note unix_dialect: 15bc. クラスは UNIX システムで生成される CSV フ
     ァイルの通常のプロパティ (行終端記号として ‘'\n'’ を用い全てのフィ
     ールドをクォートするもの) を定義します。これは ‘'unix'’ という名前
     の dialect として登録されています。

     Added in version 3.2.

 -- クラス: csv.Sniffer

     *note Sniffer: 318e. クラスは CSV ファイルの書式を推理するために用
     いられるクラスです。

     *note Sniffer: 318e. クラスではメソッドを二つ提供しています:

      -- メソッド: sniff (sample, delimiters=None)

          与えられた 'sample' を解析し、発見されたパラメータを反映した
          *note Dialect: 1a5c. サブクラスを返します。オプションの
          'delimiters' パラメータを与えた場合、有効なデリミタ文字を含ん
          でいるはずの文字列として解釈されます。

      -- メソッド: has_header (sample)

          Analyze the sample text (presumed to be in CSV format) and
          return *note True: fd0. 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: fd0.
          is returned.

          注釈: このメソッドは大雑把なヒューリスティックであり、結果が偽
          陽性や偽陰性である可能性があります。

*note Sniffer: 318e. の利用例:

     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: 89e. オブジェクトに対し、全てのフィールドをクオートす
     るように指示します。

 -- データ: csv.QUOTE_MINIMAL

     *note writer: 89e. オブジェクトに対し、 'delimiter' 、 'quotechar'、
     ‘'\r'’、‘'\n'’ または 'lineterminator' に含まれる任意の文字のような
     特別な文字を含むフィールドだけをクオートするように指示します。

 -- データ: csv.QUOTE_NONNUMERIC

     *note writer: 89e. オブジェクトに対し、全ての非数値フィールドをクオ
     ートするように指示します。

     *note reader: 89d. オブジェクトに、クォーテーションで囲まれていない
     すべてのフィールドを *note float: 32f. 型に変換するよう指示します。

          注釈: Some numeric types, such as *note bool: 5f6, *note
          Fraction: 1ce, or *note IntEnum: 10a1, have a string
          representation that cannot be converted to *note float: 32f.
          They cannot be read in the ‘QUOTE_NONNUMERIC’ and *note
          QUOTE_STRINGS: 89c. modes.

 -- データ: csv.QUOTE_NONE

     Instructs *note writer: 89e. 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: 318b.
     if any characters that require escaping are encountered.  Set
     'quotechar' to ‘None’ to prevent its escaping.

     *note reader: 89d. オブジェクトに、クオート文字に対する特殊処理を行
     わないよう指示します。

 -- データ: csv.QUOTE_NOTNULL

     Instructs *note writer: 89e. objects to quote all fields which are
     not ‘None’.  This is similar to *note QUOTE_ALL: 3190, except that
     if a field value is ‘None’ an empty (unquoted) string is written.

     Instructs *note reader: 89d. objects to interpret an empty
     (unquoted) field as ‘None’ and to otherwise behave as *note
     QUOTE_ALL: 3190.

     Added in version 3.12.

 -- データ: csv.QUOTE_STRINGS

     Instructs *note writer: 89e. objects to always place quotes around
     fields which are strings.  This is similar to *note
     QUOTE_NONNUMERIC: 1b7e, except that if a field value is ‘None’ an
     empty (unquoted) string is written.

     Instructs *note reader: 89d. objects to interpret an empty
     (unquoted) string as ‘None’ and to otherwise behave as *note
     QUOTE_NONNUMERIC: 1b7e.

     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: 10f5.) 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: 10f5.) 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: 1a5c. class containing
various attributes describing the format of the CSV file.  When creating
*note reader: 89d. or *note writer: 89e. 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: fd0. の場合、この文字は二重化されます。 *note
     False: ef9. の場合、 'escapechar' は 'quotechar' の前に置かれます。
     デフォルトでは ‘True’ です。

     出力においては、 'doublequote' が *note False: ef9. で 'escapechar'
     がセットされていない場合、フィールド内に 'quotechar' が現れると
     *note Error: 318b. が送出されます。

 -- の属性: 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: 3192.;

             * the 'quotechar' is escaped if 'doublequote' is *note
               False: ef9.;

             * the 'escapechar' itself.

     On reading, the 'escapechar' removes any special meaning from the
     following character.  It defaults to *note None: a6a, which
     disables escaping.

     バージョン 3.11 で変更: 空の 'escapechar' は許可されていません。

 -- の属性: Dialect.lineterminator

     *note writer: 89e. が作り出す各行を終端する際に用いられる文字列です
     。デフォルトでは ‘'\r\n'’ です。

          注釈: *note reader: 89d. は ‘'\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: 3192.

     バージョン 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: 318f. and defaults to *note QUOTE_MINIMAL: 3191. if
     'quotechar' is not ‘None’, and *note QUOTE_NONE: 3192. otherwise.

 -- の属性: Dialect.skipinitialspace

     When *note True: fd0, spaces immediately following the 'delimiter'
     are ignored.  The default is *note False: ef9.  When combining
     ‘delimiter=' '’ with ‘skipinitialspace=True’, unquoted empty fields
     are not allowed.

 -- の属性: Dialect.strict

     ‘True’ の場合、 不正な CSV 入力に対して *note Error: 318b. を送出し
     ます。デフォルトでは ‘False’ です。


File: python.info,  Node: reader オブジェクト,  Next: writer オブジェクト,  Prev: Dialect クラスと書式化パラメータ,  Up: csv --- CSV ファイルの読み書き

5.15.1.3 reader オブジェクト
............................

reader オブジェクト(*note DictReader: dad. インスタンス、および *note
reader(): 89d. 関数によって返されたオブジェクト) は、以下の public なメ
ソッドを持っています:

 -- メソッド: csvreader.__next__ ()

     reader の反復可能なオブジェクトから、現在の表現形式 (*note Dialect:
     1a5c.) に基づいて次の行を解析してリスト（オブジェクトが *note
     reader(): 89d. から返された場合）または辞書 （ *note DictReader:
     dad. のインスタンスの場合）として返します。通常は ‘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: 89e. オブジェクト(*note DictWriter: 15bd. インスタンス、お
よび *note writer(): 89e. 関数によって返されたオブジェクト) は、以下の
public なメソッドを持っています: 'row' には、 ‘writer’ オブジェクトの場
合には文字列か数値のイテラブルを指定し、 ‘DictWriter’ オブジェクトの場合
はフィールド名をキーとして対応する文字列か数値を格納した辞書オブジェクト
を指定します(数値は *note str(): 1ea. で変換されます)。複素数を出力する
場合、値をかっこで囲んで出力します。このため、CSV ファイルを読み込むアプ
リケーションで（そのアプリケーションが複素数をサポートしていたとしても）
問題が発生する場合があります。

 -- メソッド: csvwriter.writerow (row, /)

     現在の表現形式 (*note Dialect: 1a5c.)に沿ってフォーマットされた
     '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(): 11a5. call used internally.

     Added in version 3.2.

     バージョン 3.8 で変更: *note writeheader(): 15be. は内部的に利用し
     ている *note csvwriter.writerow(): 11a5. メソッドの返り値を返すよう
     になりました。


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(): 333. が CSV ファイルの読み込みに使われるため、ファイルはデ
フォルトではシステムのデフォルトエンコーディングでユニコード文字列にデコ
ードされます (*note locale.getencoding(): a4a. を参照)。他のエンコーディ
ングを用いてデコードするには、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: 6ea. クラスを提供しま
す。このクラスを使ってユーザーが簡単にカスタマイズできる Python プログラ
ムを作ることができます。

     注釈: このライブラリでは、Windowsのレジストリ用に拡張された INI 文
     法はサポート 'していません' 。

     警告: Be cautious when parsing data from untrusted sources.  A
     malicious INI file may cause the decoder to consume considerable
     CPU and memory resources.  Limiting the size of data to be parsed
     is recommended.

参考
....

モジュール *note tomllib: 105.

     TOML is a well-specified format for application configuration
     files.  It is specifically designed to be an improved version of
     INI.

*note shlex: cc. モジュール

     アプリケーション設定ファイルにも使える、Unix シェルに似たミニ言語の
     作成を支援します。

*note json: 85. モジュール

     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 オブジェクト::
* 例外: 例外<10>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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:
31aa.  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 後に: 31ab. 説明しますが、このインターフェイスは辞書
に対して期待するのととても近い動作をします。

これで設定ファイルを作成して保存できました。次はこれを読み込み直して、中
のデータを取り出してみましょう。

     >>> 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: 6ea, 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(): 1820. call
with several files passed to the 'filenames' parameter.

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 31ac.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 31ac.
セクションを参照してください。


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():
31ae. を提供しています。このメソッドは大文字小文字を区別せず、
‘'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(): 31ae. 以外に *note getint():
31af. と *note getfloat(): 31b0. メソッドも提供されています。独自のコン
バーターの登録、提供されたメソッドのカスタマイズもできます。 (2)

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 31ac.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 31ac.
セクションを参照してください。


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(): 1625. 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():
1625. 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(): 31af. 、 *note getfloat():
31b0. と *note getboolean(): 31ae. メソッドでも使えます。例えば:

     >>> '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: 31b2.

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:
19bd. 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: 31ac.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 31ac.
セクションを参照してください。

   (3) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 31ac.
セクションを参照してください。

   (4) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 31ac.
セクションを参照してください。

   (5) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 31ac.
セクションを参照してください。


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: 19bd. 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: 6ea. は補間(interpolation, 内挿と
も)をサポートします。これは ‘get()’ コールが値を返す前に、その値に対して
前処理を行えることを意味します。

 -- クラス: configparser.BasicInterpolation

     *note ConfigParser: 6ea. が使用するデフォルト実装です。値に、同じセ
     クションか特別なデフォルトセクション中 (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: 6ea. が ‘%(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: 31ac.
セクションを参照してください。


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: 146a. 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: 7e5. が発生します。

   * ‘DEFAULTSECT’ はパーサーから取り除けません:

        * 削除しようとすると *note ValueError: 15a. が発生します。

        * ‘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: 31ac.
セクションを参照してください。


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(): 31b6. before you read the actual file.

   * 'dict_type', デフォルト値: *note dict: 193.

     このオプションはマップ型プロトコルの振る舞い方や書き込まれる設定フ
     ァイルの見た目に大きく影響します。標準の辞書では、全てのセクション
     はパーサーに加えられた順に並びます。同じことがセクション内のオプシ
     ョンにも言えます。

     セクションとオプションをライトバック時にソートするためなどに、別の
     辞書型も使えます。

     注意: 一度の操作でキー-値の対を複数追加する方法もあります。そのよう
     な操作に普通の辞書を使うと、キーの並びは挿入順になります。例えば:

          >>> 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(): 47c. の '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(): 91a, *note read_string(): 31b7. or *note read_dict():
     31b6.).  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
     特化したドキュメントのセクション: 31b5. をご覧ください。 *note
     RawConfigParser: 1313. のデフォルト値は ‘None’ です。

   * 'converters', デフォルト値: 未設定

     Config parsers provide option value getters that perform type
     conversion.  By default *note getint(): 31af, *note getfloat():
     31b0, and *note getboolean(): 31ae. 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(): 31ae. を使うことで、設定パーサ
     ーは以下の値を ‘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: 6ea. を使ってください:

     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: 1628. や *note DuplicateOptionError:
     1629. を送出します。 '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
     特化したドキュメントのセクション: 31b5. を参照してください。

     補間に使われるすべてのオプション名は、他のオプション名参照と同様に
     、 *note optionxform(): 31bc. メソッドを通して渡されます。例えば、
     ‘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: 31b4.

     It is possible to read several configurations into a single *note
     ConfigParser: 6ea, 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: 9da. です。

     バージョン 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(): 31b6, 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: 193,
     since it now preserves insertion order.

     バージョン 3.13 で変更: Raise a *note MultilineContinuationError:
     31bd. 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: 1628. が送出されます。 'default
          section' 名が渡されたら、 *note ValueError: 15a. が送出されま
          す。セクションの名前は文字列でなければなりません。そうでなけれ
          ば、 *note TypeError: 29c. が送出されます。

          バージョン 3.2 で変更: 文字列でないセクション名は *note
          TypeError: 29c. を送出します。

      -- メソッド: has_section (section)

          指名された 'section' が設定中に存在するかを示します。'default
          section' は認識されません。

      -- メソッド: options (section)

          指定された 'section' 中で利用できるオプションのリストを返しま
          す。

      -- メソッド: has_option (section, option)

          与えられた 'section' が存在し、与えられた 'option' を含む場合
          、 *note True: fd0. を返します。それ以外の場合には、 *note
          False: ef9. を返します。指定された 'section' が *note None:
          a6a. または空文字列の場合、 DEFAULT が仮定されます。

      -- メソッド: read (filenames, encoding=None)

          ファイル名の iterable を読み込んでパースしようと試みます。正常
          にパースできたファイル名のリストを返します。

          もし 'filenames' が文字列か *note bytes: 1d2. オブジェクトか
          *note path-like object: 7a5. なら、この引数は1つのファイル名と
          して扱われます。 'filenames' 中に開けないファイルがある場合、
          そのファイルは無視されます。この挙動は、設定ファイルが置かれる
          可能性のある場所(例えば、 カレントディレクトリ、ホームディレク
          トリ、システム全体の設定を行うディレクトリ)のイテラブルを指定
          して、イテラブルの中で存在する全ての設定ファイルを読むことを想
          定して設計されています。

          どの設定ファイルも存在しなかった場合、 *note ConfigParser:
          6ea. のインスタンスは 空のデータセットを持ちます。初期値の設定
          ファイルを先に読み込んでおく必要があるアプリケーションでは、 オ
          プションのファイルを読み込むために *note read(): 1820. を呼ぶ
          前に 、まず *note read_file(): 91a. を用いて必要なファイルを読
          み込んでください:

               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(): 333.

          バージョン 3.6.1 で変更: 'filenames' 引数が *note path-like
          object: 7a5. を受け入れるようになりました。

          バージョン 3.7 で変更: 'filenames' 引数が *note bytes: 1d2. オ
          ブジェクトを受け入れるようになりました。

      -- メソッド: 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(): 1625. を参照してください。

      -- メソッド: 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(): 1625. 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: 15a. を送
          出します。 'raw', 'vars' および 'fallback' の説明は *note
          get(): 1625. を参照してください。

      -- メソッド: items (raw=False, vars=None)

      -- メソッド: items (section, raw=False, vars=None)

          'section' が与えられなければ、DEFAULTSECT を含めた
          'section_name', 'section_proxy' の対のリストを返します。

          与えられれば、与えられた 'section' 中のオプションの 'name',
          'value' の対のリストを返します。オプションの引数は *note
          get(): 1625. メソッドに与えるものと同じ意味を持ちます。

          バージョン 3.8 で変更: 'vars' に現れる項目は結果に表れなくなり
          ました。以前の挙動は、実際のパーサーオプションを補間のために与
          えられた変数と混合していました。

      -- メソッド: set (section, option, value)

          与えられたセクションが存在すれば、与えられたオプションを指定さ
          れた値に設定します。そうでなければ *note NoSectionError: 31c4.
          を送出します。 'option' および 'value' は文字列でなければなり
          ません。そうでなければ *note TypeError: 29c. が送出されます。

      -- メソッド: write (fileobject, space_around_delimiters=True)

          設定の表現を指定された *note file object: 1581. に書き込みます
          。 'fileobject' は (文字列を受け付ける) テキストモードで開かれ
          ていなければなりません。この表現は後で *note read(): 1820. を
          呼び出すことでパースできます。 'space_around_delimiters' が真
          なら、キーと値の間のデリミタはスペースで囲まれます。

          バージョン 3.14 で変更: Raises InvalidWriteError if this would
          write a representation which cannot be accurately parsed by a
          future *note read(): 1820. 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: 31c4. を送出
          します。オプションが存在して削除されれば、 *note True: fd0. を
          返します。そうでなければ *note False: ef9. を返します。

      -- メソッド: remove_section (section)

          指定された 'section' を設定から削除します。セクションが実際に
          存在すれば、‘True’ を返します。そうでなければ ‘False’ を返しま
          す。

      -- メソッド: optionxform (option)

          入力ファイルに現れた、またはクライアントコードで渡されたオプシ
          ョン名 'option' を内部構造で実際に使われる形式に変換します。デ
          フォルトの実装では 'option' の小文字版を返します。派生クラスで
          これを上書きするか、クライアントコードでインスタンス上のこの名
          前の属性を設定して、この動作に影響を与えることができます。

          このメソッドを使うためにパーサーを派生クラス化させる必要はなく
          、インスタンス上で、これを文字列引数をとって文字列を返す関数に
          設定できます。例えば、これを ‘str’ に設定すると、オプション名
          に大文字小文字の区別をつけられます:

               cfgparser = ConfigParser()
               cfgparser.optionxform = str

          なお、設定ファイルを読み込むとき、オプション名の周りの空白は
          *note optionxform(): 31bc. が呼び出される前に取り除かれます。

 -- データ: configparser.UNNAMED_SECTION

     A special object representing a section name used to reference the
     unnamed section (see *note Unnamed Sections: 31b4.).

 -- データ: configparser.MAX_INTERPOLATION_DEPTH

     The maximum depth for recursive interpolation for *note get():
     1625. when the 'raw' parameter is false.  This is relevant only
     when the default 'interpolation' is used.


File: python.info,  Node: RawConfigParser オブジェクト,  Next: 例外<10>,  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: 6ea.  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: 193,
     since it now preserves insertion order.

     バージョン 3.13 で変更: The 'allow_unnamed_section' argument was
     added.

          注釈: 代わりに内部に保存する値の型を検査する *note
          ConfigParser: 6ea. を使うことを検討してください。補間を望まな
          い場合、 ‘ConfigParser(interpolation=None)’ を使用できます。

      -- メソッド: add_section (section)

          Add a section named 'section' or *note UNNAMED_SECTION: 19bd.
          to the instance.

          If the given section already exists, *note
          DuplicateSectionError: 1628. is raised.  If the 'default
          section' name is passed, *note ValueError: 15a. is raised.  If
          *note UNNAMED_SECTION: 19bd. is passed and support is
          disabled, *note UnnamedSectionDisabledError: 31cb. is raised.

          'section' の型は検査されないため、ユーザーは非文字列の名前付き
          セクションを作ることができます。この振る舞いはサポートされてお
          らず、内部エラーを起こす可能性があります。

     バージョン 3.14 で変更: Added support for *note UNNAMED_SECTION:
     19bd.

      -- メソッド: set (section, option, value)

          与えられたセクションが存在していれば、オプションを指定された値
          に設定します。セクションが存在しなければ *note NoSectionError:
          31c4. を発生させます。 *note RawConfigParser: 1313. (あるいは
          'raw' パラメータをセットした *note ConfigParser: 6ea.) を文字
          列型でない値の '内部的な' 格納場所として使うことは可能ですが、
          すべての機能 (置換やファイルへの出力を含む) がサポートされるの
          は文字列を値として使った場合だけです。

          ユーザーは、このメソッドを使って非文字列の値をキーに代入できま
          す。この振る舞いはサポートされておらず、非rawモードでの値の取
          得や、ファイルへの書き出しを試みた際にエラーの原因となりえます
          。このような代入を許さない 'マッピングプロトコルAPIを使用して
          ください'。


File: python.info,  Node: 例外<10>,  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(): 1627. 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: 31c7. を超えたため
     に文字列補間が完了しなかったときに送出される例外です。 *note
     InterpolationError: 31d0. の派生クラスです。

 -- 例外: configparser.InterpolationMissingOptionError

     *note InterpolationError: 31d0. の派生クラスで、値が参照しているオ
     プションが見つからない場合に発生する例外です。

 -- 例外: configparser.InterpolationSyntaxError

     置換がなされるソーステキストが要求された文法を満たさないときに送出
     される例外です。 *note InterpolationError: 31d0. の派生クラスです。

 -- 例外: 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:
     19bd. without enabling it.

          Added in version 3.14.

 -- 例外: configparser.InvalidWriteError

     Exception raised when an attempted *note ConfigParser.write(): 47c.
     would not be parsed accurately with a future *note
     ConfigParser.read(): 1820. call.

     Ex: Writing a key beginning with the *note ConfigParser.SECTCRE:
     31b2. 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 ファイルの解析
---------------------------------------

'ソースコード:' Lib/tomllib(1)

__________________________________________________________________

This module provides an interface for parsing TOML 1.1.0 (Tom's Obvious
Minimal Language, https://toml.io(2)).  This module does not support
writing TOML.

Added in version 3.11: The module was added with support for TOML 1.0.0.

バージョン 3.15 で変更: Added TOML 1.1.0 support.  See the *note What's
New: 293. for details.

     警告: 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: 90. や *note pickle: ab. モジュ
ールなどでユーザーによく知られている書き込みAPIを提供します。

参考
....

TOML Kit パッケージ(4) は、スタイルを保持した読み書きに対応したTOMLライ
ブラリです。存在するTOMLファイルを編集するときにこのモジュールの代わりに
使用することを推奨します。

このモジュールは以下の関数を定義しています:

 -- の関数: tomllib.load (fp, /, *, parse_float=float)

     TOMLファイルを読み込みます。第1引数には読み込み可能なバイナリのファ
     イルオブジェクトを指定します。戻り値は *note dict: 193. です。
     TOMLの型は *note conversion table: 31d9. を使用してPythonのデータ型
     に変換されます。

     'parse_float' は、全てのデコードされる TOML の浮動小数点数文字列に
     対して呼ばれます。デフォルトでは、 ‘float(num_str)’ と等価です。こ
     れは TOML 浮動小数点数に対して他のデータ型やパーサ (たとえば *note
     decimal.Decimal: 1cd.) を使うのに使えます。呼び出し可能オブジェクト
     は *note dict: 193. や *note list: 4e0. 以外を返す必要があり、そう
     でない場合は *note ValueError: 15a. が送出されます。

     無効なTOMLドキュメントの場合は *note TOMLDecodeError: 1b48. が送出
     されます。

 -- の関数: tomllib.loads (s, /, *, parse_float=float)

     *note str: 1ea. からTOMLを読み込みます。戻り値は *note dict: 193. で
     す。TOMLの型は *note conversion table: 31d9. を使用してPythonのデー
     タ型に変換されます。'parse_float'  引数は *note load(): 31d8. と同
     じ意味を持ちます。

     無効なTOMLドキュメントの場合は *note TOMLDecodeError: 1b48. が送出
     されます。

次の例外がサポートされています:

 -- 例外: tomllib.TOMLDecodeError (msg, doc, pos)

     *note ValueError: 15a. のサブクラスで、以下の追加の属性を持ちます:

      -- の属性: msg

          フォーマットされていないエラーメッセージです。

      -- の属性: doc

          パース対象の TOML ドキュメントです。

      -- の属性: pos

          'doc' の解析に失敗したインデクスです。

      -- の属性: lineno

          'pos' に対応する行です。

      -- の属性: colno

          'pos' に対応する列です。

     バージョン 3.14 で変更: Added the 'msg', 'doc' and 'pos'
     parameters.  Added the *note msg: 31da, *note doc: 31db, *note pos:
     31dc, *note lineno: 31dd. and *note colno: 31de. attributes.

     バージョン 3.14 で非推奨: Passing free-form positional arguments is
     deprecated.

* Menu:

* 使用例: 使用例<18>.
* 変換表::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 1e8f. クラスは、Unix ‘ftp’ プログラムや他の FTP クライアン
トで用いられる netrc ファイル形式を解析し、カプセル化 (encapsulate) しま
す。

 -- クラス: netrc.netrc ([file])

     A *note netrc: 1e8f. 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(): ddc. - will be read.  Otherwise, a *note
     FileNotFoundError: 24f. exception will be raised.  Parse errors
     will raise *note NetrcParseError: 31e4. 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:
     31e4. 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(): 1a31.

     バージョン 3.4 で変更: POSIX パーミッションのチェックが追加されまし
     た。

     バージョン 3.7 で変更: 引数で 'file' が渡されなかったときは、
     ‘.netrc’ ファイルの場所を探すのに *note os.path.expanduser(): ddc.
     が使われるようになりました。

     バージョン 3.10 で変更: *note netrc: 9f. は、ロケール固有のエンコー
     ディングを使用する前に、 UTF-8 でのエンコーディングを試みます。
     netrc ファイルのエントリがすべてのトークンを含む必要はなくなりまし
     た。欠落したトークンのデフォルト値は空文字列です。すべてのトークン
     とその値は空白や非 ASCII 文字のような任意の文字を使用できるようにな
     りました。ログイン名が匿名の場合、セキュリティチェックはトリガーし
     ません。

 -- 例外: netrc.NetrcParseError

     ソーステキストに構文上のエラーがある場合に、 *note netrc: 1e8f. ク
     ラスで発生する例外。この例外のインスタンスは3つの興味深い属性を提供
     します:

      -- の属性: msg

          エラーのテキストによる説明。

      -- の属性: filename

          ソースファイルの名前。

      -- の属性: lineno

          エラーが見つかった行番号。

* Menu:

* netrc オブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/netrc.py


File: python.info,  Node: netrc オブジェクト,  Up: netrc --- netrc ファイルの処理

5.15.4.1 netrc オブジェクト
...........................

*note netrc: 1e8f. インスタンスは以下のメソッドを持っています:

 -- メソッド: netrc.authenticators (host)

     'host' の認証情報として、三要素のタプル ‘(login, account,
     password)’ を返します。与えられた host に対するエントリが netrc フ
     ァイルにない場合、'default' エントリに関連付けられたタプルが返され
     ます。host に対応するエントリがなく、default エントリもない場合、
     ‘None’ を返します。

 -- メソッド: netrc.__repr__ ()

     クラスの持っているデータを netrc ファイルの書式に従った文字列で出力
     します。(コメントは無視され、エントリが並べ替えられる可能性がありま
     す。)

*note netrc: 1e8f. のインスタンスは以下の 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 or a frozen
dictionary.

plist ファイルを書き出したり解析したりするには *note dump(): d20. や
*note load(): d1e. 関数を利用します。

バイトオブジェクトや文字列オブジェクトの plist データを扱うためには
*note dumps(): d21. や *note loads(): d1f. を利用します。

値は文字列、整数、浮動小数点数、ブール型、タプル、リスト、辞書 (ただし文
字列だけがキーになれます)、 *note bytes: 1d2.、*note bytearray: 1d1. ま
たは *note datetime.datetime: 6ed. のオブジェクトです。

バージョン 3.4 で変更: 新しい API となり、古い API は非推奨となりました
。バイナリ形式の plist がサポートされました。

バージョン 3.8 で変更: バイナリの plist で NSKeyedArchiver や
NSKeyedUnarchiver によって使用される *note UID: de9. トークンの読み込み
・書き込みのサポートが追加されました。

バージョン 3.9 で変更: 古い API が削除されました。

参考
....

PList マニュアルページ(2)

     このファイル形式の Apple の文書。

このモジュールは以下の関数を定義しています:

 -- の関数: plistlib.load (fp, *, fmt=None, dict_type=dict,
          aware_datetime=False)

     plist ファイルを読み込みます。'fp' は読み込み可能かつバイナリのファ
     イルオブジェクトです。展開されたルートオブジェクト (通常は辞書です)
     を返します。

     'fmt' はファイルの形式で、次の値が有効です。

        * *note None: a6a.: ファイル形式を自動検出します

        * *note FMT_XML: 1328.: XML ファイル形式です

        * *note FMT_BINARY: 1329.: バイナリの plist 形式です

     'dict_type' は、 plist ファイルから読み出された辞書に使われる型です
     。

     When 'aware_datetime' is true, fields with type ‘datetime.datetime’
     will be created as *note aware object: 2ac4, with ‘tzinfo’ as *note
     datetime.UTC: 901.

     *note FMT_XML: 1328. 形式の XML データは *note xml.parsers.expat:
     12f. にある Expat パーサーを使って解析されます。不正な形式の XML に
     対して送出される可能性のある例外については、そちらの文書を参照して
     ください。plist 解析器では、未知の要素は単純に無視されます。

     The parser raises *note InvalidFileException: 1f0e. 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(): d1e. を参照してください。

     Added in version 3.4.

     バージョン 3.13 で変更: 'fmt' が *note FMT_XML: 1328. の場合、
     '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: 1328.: XML 形式の plist ファイルです

        * *note FMT_BINARY: 1329.: バイナリ形式の plist ファイルです

     'sort_keys' が真 (デフォルト) の場合、辞書内のキーは、plist にソー
     トされた順序で書き込まれます。偽の場合、ディクショナリのイテレート
     の順序で書き込まれます。

     'skipkeys' が偽 (デフォルト) の場合、この関数は辞書のキーが文字列で
     ない場合に *note TypeError: 29c. を送出します。真の場合、そのような
     キーは読み飛ばされます。

     When 'aware_datetime' is true and any field with type
     ‘datetime.datetime’ is set as an *note aware object: 2ac4, it will
     convert to UTC timezone before writing it.

     *note TypeError: 29c. が、オブジェクトがサポート外の型のものであっ
     たりサポート外の型のオブジェクトを含むコンテナだった場合に、送出さ
     れます。

     (バイナリの) plist ファイル内で表現できない整数値に対しては、 *note
     OverflowError: c5b. が送出されます。

     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(): d20. を参照してくだ
     さい。

     Added in version 3.4.

以下のクラスが使用可能です:

 -- クラス: plistlib.UID (data)

     *note int: 32e. をラップします。これは 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/main/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: 13c. モジュールで
     提供されています。

* Menu:

* ハッシュアルゴリズム::
* 使用法::
* コンストラクタ::
* 属性::
* Hash Objects::
* SHAKE 可変長ダイジェスト::
* ファイルのハッシュ化::
* 鍵導出::
* BLAKE2::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 2ff. を使います。このオブジェ
クトには *note update: 31fb. メソッドを用いて *note bytes-like
オブジェクト: 43d. (通常 *note bytes: 1d2.) を渡すことができます。*note
digest(): 31fc. や *note hexdigest(): 31fd. メソッドを用いて、それまでに
渡したデータを連結したものの 'digest' をいつでも要求することができます。

To allow multithreading, the Python *note GIL: 418. is released while
computing a hash supplied more than 2047 bytes of data at once in its
constructor or *note .update: 31fb. method.

Constructors for hash algorithms that are always present in this module
are *note sha1(): 31fe, *note sha224(): 31ff, *note sha256(): 2ff, *note
sha384(): 3200, *note sha512(): 3201, *note sha3_224(): 1067, *note
sha3_256(): 1068, *note sha3_384(): 1069, *note sha3_512(): 106a, *note
shake_128(): 106b, *note shake_256(): 106c, *note blake2b(): a36, and
*note blake2s(): a37.  *note md5(): 2fe. 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: 172d.

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(): 2fd.
See *note algorithms_available: 172e.

     警告: Some algorithms have known hash collision weaknesses
     (including MD5 and SHA1).  Refer to Attacks on cryptographic hash
     algorithms(1) and the *note hashlib-seealso: 3202. section at the
     end of this document.

Added in version 3.6: SHA3 (Keccak) and SHAKE constructors *note
sha3_224(): 1067, *note sha3_256(): 1068, *note sha3_384(): 1069, *note
sha3_512(): 106a, *note shake_128(): 106b, *note shake_256(): 106c. were
added.  *note blake2b(): a36. and *note blake2s(): a37. 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).

バージョン 3.15 で非推奨、バージョン 3.19 で削除予定: The undocumented
‘string’ keyword parameter in ‘_hashlib.new()’ and hash-named
constructors such as ‘_md5.md5()’ is deprecated.  Prefer passing the
initial data as a positional argument for maximum backwards
compatibility.

   ---------- 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(): 2fd. 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(): 2fd.


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(): 2fd. に渡すことができます。
     *note algorithms_guaranteed: 172d. は常にサブセットです。この 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(): 2fd. の引数と
     して渡してこのタイプの別のハッシュを生成することができます。

     バージョン 3.4 で変更: name 属性は CPython には最初からありましたが
     、Python 3.4 までは正式に明記されていませんでした。そのため、プラッ
     トフォームによっては存在しないかもしれません。

ハッシュオブジェクトには次のようなメソッドがあります:

 -- メソッド: hash.update (data)

     hash オブジェクトを *note bytes-like object: 43d. で更新します。こ
     のメソッドの呼出しの繰り返しは、それらの引数を全て結合した引数で単
     一の呼び出しをした際と同じになります。すなわち ‘m.update(a);
     m.update(b)’ は ‘m.update(a + b)’ と等価です。

 -- メソッド: hash.digest ()

     これまで *note update(): 31fb. メソッドに渡されたデータのダイジェス
     ト値を返します。これは *note digest_size: 3208. と同じ長さの、0 か
     ら 255 の範囲全てを含み得るバイトの列です。

 -- メソッド: hash.hexdigest ()

     *note digest(): 31fc. と似ていますが、倍の長さの、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(): 106b. and *note shake_256(): 106c. 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(): 31fb. メソッドに渡されたデータのダイジェス
     ト値を返します。これは 'length' と同じ長さの、0 から 255 の範囲全て
     を含み得るバイトの列です。

 -- メソッド: shake.hexdigest (length)

     *note digest(): 2027. と似ていますが、倍の長さの、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(): 333,
     *note BytesIO: 1258. instances, SocketIO objects from *note
     socket.socket.makefile(): 155d, and similar.  'fileobj' must be
     opened in blocking mode, otherwise a *note BlockingIOError: 4ca.
     may be raised.

     The function may bypass Python's I/O and use the file descriptor
     from *note fileno(): 19d2. 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: 4ca. 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(): 936. のような適切なソースからの、およ
     そ 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: 43d. でなければな
     りません。アプリケーションとライブラリは、 'password' を適切な長さ
     (例えば 1024) に制限すべきです。 'salt' は *note os.urandom(): 936.
     のような適切なソースからの、およそ 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: 43d.  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: 3211. で利用でき
ます。

コンストラクタ関数は以下のツリーハッシングパラメタを受け付けます:

   * '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(): a36.
or *note blake2s(): a37.), then update it with the data by calling *note
update(): 31fb. on the object, and, finally, get the digest out of the
object by calling *note digest(): 31fc. (or *note hexdigest(): 31fd. 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(): 31fb. 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: 6d. 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: 6d. モジュール

     ハッシュを用いてメッセージ認証コードを生成するモジュールです。

*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(): 2fd.  Despite its argument
     position, it is required.

     バージョン 3.4 で変更: 引数 'key' に bytes または bytearray オブジ
     ェクトを渡せるようになりました。引数 'msg' に *note hashlib: 6b. が
     サポートする全てのタイプを渡せるようになりました。引数 '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(): e69. と同じ意味を持ちます。

     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: 6b. がサポート
     しているあらゆる型のいずれかです。

 -- メソッド: HMAC.digest ()

     これまで *note update(): 12f9. メソッドに渡されたバイト列のダイジェ
     スト値を返します。これはコンストラクタに与えられた '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(): 148a. function
          instead of the ‘==’ operator to reduce the vulnerability to
          timing attacks.

 -- メソッド: HMAC.hexdigest ()

     *note digest(): f00. と似ていますが、返される文字列は倍の長さとなり
     、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(): 148a.
          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(): 3226. が
     返したような ASCII のみの) *note str: 1ea. または *note bytes-like
     object: 43d. のどちらか一方。

          注釈: 'a' と 'b' が異なる長さであったりエラーが発生した場合に
          は、タイミング攻撃で理論上 'a' と 'b' の型と長さについての情報
          が暴露されますが、その値は明らかになりません。

     Added in version 3.3.

     バージョン 3.10 で変更: The function uses OpenSSL's
     ‘CRYPTO_memcmp()’ internally when available.

参考
....

*note hashlib: 6b. モジュール

     セキュアハッシュ関数を提供する Python モジュールです。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: c0. module, which is
designed for modelling and simulation, not security or cryptography.

参考
....

PEP 506(2)

* Menu:

* 乱数::
* トークンの生成::
* その他の関数::
* レシピとベストプラクティス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 2d8b. を参
     照してください。

 -- の関数: 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:
     3230. 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:
     3230. 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:
     3230. 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:
32e. 引数で渡すことで、トークンに使用するランダムさを明示的に指定するこ
とができます。引数はランダムさのバイト数として使用されます。

Otherwise, if no argument is provided, or if the argument is ‘None’, the
‘token_*’ functions use *note DEFAULT_ENTROPY: 3230. 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 オブジェクト: 43d. 'a' と 'b' が等し
     ければ ‘True’ を、そうでなければ ‘False’ を返します。比較は タイミ
     ング攻撃(1) のリスクを減らす "定数時間比較" の方法で行われます。詳
     細については *note hmac.compare_digest(): 148a. を参照してください
     。

   ---------- 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(): 333. を参照してくださ
い。パス操作については、 *note os.path: a6. モジュールを参照してください
。コマンドラインに与えられたすべてのファイルから行を読み込んでいくには、
*note fileinput: 5e. モジュールを参照してください。一時ファイルや一時デ
ィレクトリの作成については、 *note tempfile: e9. モジュールを参照してく
ださい。高水準のファイルとディレクトリの操作については、 *note shutil:
cd. モジュールを参照してください。

利用可能性に関する注意 :

   * 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(): 6c3, *note execve(): 14ba.) and
     resources (e.g.  *note nice(): 14c2.) are not available.  Others
     like *note getuid(): 1a31. and *note getpid(): 323c. are emulated
     or stubs.  WebAssembly platforms also lack support for signals
     (e.g.  *note kill(): 1721, *note wait(): 1155.).

     注釈: このモジュール内のすべての関数は、間違った、あるいはアクセス
     出来ないファイル名やファイルパス、その他型が合っていても OS が受理
     しない引数に対して、 *note OSError: 543. (またはそのサブクラス)を送
     出します。

 -- 例外: os.error

     組み込みの *note OSError: 543. 例外に対するエイリアスです。

 -- データ: os.name

     import されているオペレーティングシステムに依存するモジュールの名前
     です。現在次の名前が登録されています: ‘'posix'’, ‘'nt'’, ‘'java'’。

     参考
     ....

     *note sys.platform: 51f. はより細かな粒度を持っています。 *note
     os.uname(): 14d7. はシステム依存のバージョン情報を提供します。

     *note platform: af. モジュールはシステムの詳細な識別情報をチェック
     する機能を提供しています。

* Menu:

* ファイル名、コマンドライン引数、および環境変数::
* Python UTF-8 Mode::
* プロセスのパラメーター::
* ファイルオブジェクトの生成::
* ファイル記述子の操作::
* ファイルとディレクトリ::
* プロセス管理::
* スケジューラーへのインターフェイス::
* 雑多なシステム情報::
* 乱数: 乱数<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 94d. を使用します (*note sys.getfilesystemencoding(): 101b. 参
照)。

term:‘ファイルシステムのエンコーディングとエラーハンドラ <filesystem
encoding and error handler>’ は、Pythonの開始時に:c:func:‘PyConfig_Read’
関数により設定されます。 *note PyConfig: 612. のメンバー *note
filesystem_encoding: 635. と *note filesystem_errors: 636. を参照してく
ださい。

バージョン 3.1 で変更: 一部のシステムでは、ファイルシステムのエンコーデ
ィングを使用して変換すると失敗する場合があります。この場合、Python は
*note surrogateescape エンコーディングエラーハンドラー: 2a82. を使用しま
す。これは、デコード時にデコードできないバイト列は Unicode 文字 U+DC'xx'
に置き換えられ、それらはエンコード時に再び元のバイト列に変換されることを
意味します。

*note file system encoding: 94d. では、すべてが 128 バイト以下に正常にデ
コードされることが保証されなくてはなりません。ファイルシステムのエンコー
ディングでこれが保証されなかった場合は、API 関数が *note UnicodeError:
67c. を送出します。

See also the *note locale encoding: 752.


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) を参照してください。

バージョン 3.15 で変更: Python UTF-8 mode is now enabled by default (
PEP 686(2)).  It may be disabled by setting *note PYTHONUTF8=0: 1b8. as
an environment variable or by using the *note -X utf8=0: 183. command
line option.

The Python UTF-8 Mode ignores the *note locale encoding: 752. and forces
the usage of the UTF-8 encoding:

   * Use UTF-8 as the *note filesystem encoding: 94d.

   * *note sys.getfilesystemencoding(): 101b. returns ‘'utf-8'’.

   * *note locale.getpreferredencoding(): 94c. returns ‘'utf-8'’ (the
     'do_setlocale' argument has no effect).

   * *note sys.stdin: 94f, *note sys.stdout: ea0, and *note sys.stderr:
     d09. all use UTF-8 as their text encoding, with the
     ‘surrogateescape’ *note error handler: 1d8b. 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(): 1e4b. returns ‘'utf-8'’ rather
     than the device encoding.

Note that the standard stream settings in UTF-8 mode can be overridden
by *note PYTHONIOENCODING: 13b8. (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(): 1016. and *note os.fsencode(): 1017. use the
     UTF-8 encoding.

   * *note open(): 333, *note io.open(): 930, and *note codecs.open():
     334. 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: a4b. is enabled by default.  It can be
disabled using the *note -X utf8=0: 183. command line option or the
*note PYTHONUTF8=0: 1b8. environment variable.  The Python UTF-8 Mode
can only be disabled at Python startup.  Its value can be read from
*note sys.flags.utf8_mode: a81.

If the UTF-8 mode is disabled, 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:
e9f.), 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.

See also the *note UTF-8 mode on Windows: 242d. and the *note filesystem
encoding and error handler: 94d.

   ---------- 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: 234c.: Unix, not WASI.

 -- データ: os.environ

     A *note mapping: 1579. object where keys and values are strings
     that represent the process environment.  For example,
     ‘environ['HOME']’ is the pathname of your home directory (on some
     platforms), and is equivalent to ‘getenv("HOME")’ in C.

     This mapping is captured the first time the ‘os’ module is
     imported, typically during Python startup as part of processing
     ‘site.py’.  Changes to the environment made after this time are not
     reflected in *note os.environ: 4ec, except for changes made by
     modifying ‘os.environ’ directly.

     このマップ型オブジェクトは環境変数に対する変更に使うこともできます
     。 *note putenv(): 4ee. はマップ型オブジェクトが修正される時に、自
     動的に呼ばれることになります。

     Unix では、キーと値に *note sys.getfilesystemencoding(): 101b.、エ
     ラーハンドラーに ‘'surrogateescape'’ を使用します。異なるエンコーデ
     ィングを使用したい場合は *note environb: 4ed. を使用します。

     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(): 4ee. を直接呼び出しても *note
          os.environ: 4ec. の内容は変わらないので、 ‘os.environ’ を直接
          変更する方が良いです。

          注釈: FreeBSD や macOS など一部のプラットフォームでは
          ‘environ’ の値を変更するとメモリリークが発生する可能性がありま
          す。各システムのドキュメントで ‘putenv()’ の項目を参照してくだ
          さい。

     You can delete items in this mapping to unset environment
     variables.  *note unsetenv(): 4ef. will be called automatically
     when an item is deleted from *note os.environ: 4ec, and when one of
     the *note pop(): 7e4. or *note clear(): 1975. methods is called.

     参考
     ....

     The *note os.reload_environ(): 4eb. function.

     バージョン 3.9 で変更: 更新され PEP 584(1) の合成演算子 (‘|’) と更
     新演算子 (‘|=’) がサポートされました。

 -- データ: os.environb

     Bytes version of *note environ: 4ec.: a *note mapping: 1579. object
     where both keys and values are *note bytes: 1d2. objects
     representing the process environment.  ‘environ’ and ‘environb’ are
     synchronized (modifying ‘environb’ updates ‘environ’, and vice
     versa).

     *note environb: 4ed. は *note supports_bytes_environ: 15d2. が
     ‘True’ の場合のみ利用可能です。

     Added in version 3.2.

     バージョン 3.9 で変更: 更新され PEP 584(2) の合成演算子 (‘|’) と更
     新演算子 (‘|=’) がサポートされました。

 -- の関数: os.reload_environ ()

     The *note os.environ: 4ec. and *note os.environb: 4ed. 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(): 4ee. or
     *note os.unsetenv(): 4ef.  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: 4ec. or
          *note os.environb: 4ed, or calling *note os.getenv(): 3244.
          while reloading, may return an empty result.

     Added in version 3.14.

 -- の関数: os.chdir (path)

 -- の関数: os.fchdir (fd)

 -- の関数: os.getcwd ()

     これらの関数は、 *note ファイルとディレクトリ: 3245. 節で説明されて
     います。

 -- の関数: os.fsencode (filename)

     *note path-like: 7a5. な 'filename' を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. にエンコー
     ドします。未変更の *note bytes: 1d2. オブジェクトを返します。

     *note fsdecode(): 1016. はこの逆変換を行う関数です。

     Added in version 3.2.

     バージョン 3.6 で変更: *note os.PathLike: 1013. インターフェースを
     実装したオブジェクトを受け入れるようになりました。

 -- の関数: os.fsdecode (filename)

     *note path-like: 7a5. な 'filename' を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. からデコー
     ドします。未変更の *note str: 1ea. オブジェクトを返します。

     *note fsencode(): 1017. はこの逆変換を行う関数です。

     Added in version 3.2.

     バージョン 3.6 で変更: *note os.PathLike: 1013. インターフェースを
     実装したオブジェクトを受け入れるようになりました。

 -- の関数: os.fspath (path)

     path のファイルシステム表現を返します。

     もし *note str: 1ea. か ‘bytes:’ のオブジェクトが渡された場合は、変
     更せずにそのまま返します。さもなければ、 *note __fspath__(): 1014.
     が呼び出され、その戻り値が ‘str’ か *note bytes: 1d2. のオブジェク
     トであれば、その値を返します。他のすべてのケースでは *note
     TypeError: 29c. が送出されます。

     Added in version 3.6.

 -- クラス: os.PathLike

     ファイルシステムパスを表すオブジェクト(例: *note pathlib.PurePath:
     8bb.) 向けの *note abstract base class: 1574. です。

     Added in version 3.6.

      -- メソッド: abstractmethod __fspath__ ()

          このオブジェクトが表現するファイルシステムパスを返します。

          このメソッドは *note str: 1ea. か *note bytes: 1d2. のオブジェ
          クトのみを返す必要があります(‘str’ が好まれます)。

 -- の関数: os.getenv (key, default=None)

     環境変数 'key' が存在する場合はその値を文字列として返し、存在しなけ
     れば 'default' を返します。'key' は文字列です。注意すべき点として、
     *note getenv(): 3244. は内部的に *note os.environ: 4ec. を使用する
     ため、‘getenv()’ のマップ型オブジェクトはインポート時に取得されます
     。そのため、それ以降に環境変数が変更されても、この関数の値にそれが
     反映されない可能性があります。

     Unix では、キーと値は *note sys.getfilesystemencoding(): 101b.、エ
     ラーハンドラー ‘'surrogateescape'’ でデコードされます。異なるエンコ
     ーディングを使用したい場合は *note os.getenvb(): 15d3. を使用します
     。

     *note Availability: 234c.: Unix, Windows.

 -- の関数: os.getenvb (key, default=None)

     環境変数 'key' が存在する場合はその値を bytes として返し、存在しな
     ければ 'default' を返します。'key' はbytes である必要があります。注
     意すべき点として、*note getenvb(): 15d3. は内部的に *note
     os.environb: 4ed. を使用するため、‘getenvb()’ のマップ型オブジェク
     トはインポート時に取得されます。そのため、それ以降に環境変数が変更
     されても、この関数の値にそれが反映されない可能性があります。

     *note getenvb(): 15d3. は *note supports_bytes_environ: 15d2. が
     ‘True’ の場合のみ利用可能です。

     *note Availability: 234c.: Unix.

     Added in version 3.2.

 -- の関数: os.get_exec_path (env=None)

     プロセスを起動する時に名前付き実行ファイルを検索するディレクトリの
     リストを返します。 'env' が指定されると、それを環境変数の辞書とみな
     し、その辞書からキー PATH の値を探します。 デフォルトでは 'env' は
     ‘None’ であり、*note environ: 4ec. が使用されます。

     Added in version 3.2.

 -- の関数: os.getegid ()

     現在のプロセスの実効グループ id を返します。この id は現在のプロセ
     スで実行されているファイルの "set id" ビットに対応します。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.geteuid ()

     現在のプロセスの実効ユーザー id を返します。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.getgid ()

     現在のプロセスの実グループ id を返します。

     *note Availability: 234c.: Unix.

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1d86. 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: 234c.: Unix, not WASI.

     Added in version 3.3.

 -- の関数: os.getgroups ()

     現在のプロセスに関連付けられた従属グループ id のリストを返します。

     *note Availability: 234c.: 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(): 324a. 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 can be obtained
          with *note
          sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET'): 425.

 -- の関数: os.getlogin ()

     プロセスの制御端末にログインしているユーザー名を返します。ほとんど
     の場合、*note getpass.getuser(): 84e. を使う方が便利です。なぜなら
     、‘getpass.getuser()’ は、ユーザーを見つけるために、環境変数
     ‘LOGNAME’ や ‘USERNAME’ を調べ、さらには
     ‘pwd.getpwuid(os.getuid())[0]’ まで調べに行くからです。

     *note Availability: 234c.: Unix, Windows, not WASI.

 -- の関数: os.getpgid (pid)

     プロセス id 'pid' のプロセスのプロセスグループ id を返します。
     'pid' が 0 の場合、現在のプロセスのプロセスグループ id を返します。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.getpgrp ()

     現在のプロセスグループの id を返します。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.getpid ()

     現在のプロセス id を返します。

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1d86. for more information.

 -- の関数: os.getppid ()

     親プロセスのプロセス id を返します。親プロセスが終了していた場合、
     Unix では init プロセスの id (1) が返され、Windows では親のプロセス
     id だったもの (別のプロセスで再利用されているかもしれない) がそのま
     ま返されます。

     *note Availability: 234c.: Unix, Windows, not WASI.

     バージョン 3.2 で変更: Windows サポートが追加されました。

 -- の関数: os.getpriority (which, who)

     プログラムのスケジューリング優先度を取得します。'which' の値は
     *note PRIO_PROCESS: 324d.、*note PRIO_PGRP: 324e.、あるいは *note
     PRIO_USER: 324f. のいずれか一つで、'who' の値は 'which' に応じて解
     釈されます (‘PRIO_PROCESS’ であればプロセス識別子、‘PRIO_PGRP’ であ
     ればプロセスグループ識別子、そして ‘PRIO_USER’ であればユーザー
     ID)。'who' の値がゼロの場合、呼び出したプロセス、呼び出したプロセス
     のプロセスグループ、および呼び出したプロセスの実ユーザー id を (そ
     れぞれ) 意味します。

     *note Availability: 234c.: Unix, not WASI.

     Added in version 3.3.

 -- データ: os.PRIO_PROCESS
 -- データ: os.PRIO_PGRP
 -- データ: os.PRIO_USER

     *note getpriority(): 14c0. と *note setpriority(): 14c1. 用のパラメ
     ータです。

     *note Availability: 234c.: 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(): 14c0. と *note setpriority(): 14c1. 用のパラメ
     ータです。

     *note Availability: 234c.: macOS

     Added in version 3.12.

 -- の関数: os.getresuid ()

     現在のプロセスの実ユーザー id 、実効ユーザー id 、および保存ユーザ
     ー id を示す、 (ruid, euid, suid) のタプルを返します。

     *note Availability: 234c.: Unix, not WASI.

     Added in version 3.2.

 -- の関数: os.getresgid ()

     現在のプロセスの実グループ id 、実効グループ id 、および保存グルー
     プ id を示す、 (rgid, egid, sgid) のタプルを返します。

     *note Availability: 234c.: Unix, not WASI.

     Added in version 3.2.

 -- の関数: os.getuid ()

     現在のプロセスの実ユーザー id を返します。

     *note Availability: 234c.: Unix.

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1d86. 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: 234c.: Unix, not WASI, not Android.

     Added in version 3.2.

 -- の関数: os.putenv (key, value, /)

     'key' という名前の環境変数に文字列 'value' を設定します。このような
     環境変数の変更は、*note os.system(): 1815.、*note popen(): 58c.、ま
     たは *note fork(): 6c3. と *note execv(): 3254. で起動されたサブプ
     ロセスに影響を与えます。

     *note os.environ: 4ec. の要素に代入すると、それは *note putenv():
     4ee. の呼び出しに自動変換されます。 しかし、直接 ‘putenv()’ を呼び
     出しても ‘os.environ’ には反映されないため、‘os.environ’ の要素に代
     入する方がベターです。 *note getenv(): 3244. と *note getenvb():
     15d3. についても、実装上それぞれ ‘os.environ’ と *note os.environb:
     4ed. を使用するので、同様に注意が必要です。

     See also the *note os.reload_environ(): 4eb. function.

          注釈: FreeBSD や macOS など一部のプラットフォームでは
          ‘environ’ の値を変更するとメモリリークが発生する可能性がありま
          す。 各システムのドキュメントで ‘putenv()’ の項目を参照してく
          ださい。

     引数 ‘key’, ‘value’ を指定して *note 監査イベント: 1e84.
     ‘os.putenv’ を送出します。

     バージョン 3.9 で変更: 常に利用出来るようになりました。

 -- の関数: os.setegid (egid, /)

     現在のプロセスに実効グループ id をセットします。

     *note Availability: 234c.: Unix, not WASI, not Android.

 -- の関数: os.seteuid (euid, /)

     現在のプロセスに実効ユーザー id をセットします。

     *note Availability: 234c.: Unix, not WASI, not Android.

 -- の関数: os.setgid (gid, /)

     現在のプロセスにグループ id をセットします。

     *note Availability: 234c.: Unix, not WASI, not Android.

 -- の関数: os.setgroups (groups, /)

     現在のグループに関連付けられた従属グループ id のリストを 'groups' に
     設定します。 'groups' はシーケンス型でなくてはならず、各要素はグル
     ープを特定する整数でなくてはなりません。通常、この操作はスーパユー
     ザーしか利用できません。

     *note Availability: 234c.: Unix, not WASI.

          注釈: macOS では、 'groups' の長さはシステムで定義された実効グ
          ループ id の最大数 ( 通常は 16) を超えない場合があります。
          setgroups() 呼び出しで設定されたものと同じグループリストが返さ
          れないケースについては、 *note getgroups(): 3249. のドキュメン
          トを参照してください。

 -- の関数: 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:
     3258. 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(): 273.  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: 3258, 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(): 19d2. 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: 234c.: Linux >= 3.0 with glibc >= 2.14.

     Added in version 3.12.

     参考
     ....

     The *note unshare(): 1d5f. function.

 -- の関数: os.setpgrp ()

     システムコール ‘setpgrp()’ か ‘setpgrp(0, 0)’ のどちらか(実装されて
     いるもの)を呼び出します。機能については UNIX マニュアルを参照して下
     さい。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.setpgid (pid, pgrp, /)

     システムコール ‘setpgid()’ を呼び出してプロセス id 'pid' のプロセス
     のプロセスグループ id を 'pgrp' に設定します。この動作に関しては
     Unix のマニュアルを参照してください。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.setpriority (which, who, priority)

     プログラムのスケジューリング優先度を設定します。'which' は *note
     PRIO_PROCESS: 324d.、*note PRIO_PGRP: 324e.、あるいは *note
     PRIO_USER: 324f. のいずれか一つで、'who' の値は 'which' に応じて解
     釈されます (‘PRIO_PROCESS’ であればプロセス識別子、‘PRIO_PGRP’ であ
     ればプロセスグループ識別子、そして ‘PRIO_USER’ であればユーザー
     ID)。'who' の値がゼロの場合、呼び出したプロセス、呼び出したプロセス
     のプロセスグループ、および呼び出したプロセスの実ユーザー id を (そ
     れぞれ) 意味します。'priority' は -20 から 19 の整数値で、デフォル
     トの優先度は 0 です。小さい数値ほど優先されるスケジューリングとなり
     ます。

     *note Availability: 234c.: Unix, not WASI.

     Added in version 3.3.

 -- の関数: os.setregid (rgid, egid, /)

     現在のプロセスの実グループ id および実効グループ id を設定します。

     *note Availability: 234c.: Unix, not WASI, not Android.

 -- の関数: os.setresgid (rgid, egid, sgid, /)

     現在のプロセスの、実グループ id 、実効グループ id 、および保存グル
     ープ id を設定します。

     *note Availability: 234c.: Unix, not WASI, not Android.

     Added in version 3.2.

 -- の関数: os.setresuid (ruid, euid, suid, /)

     現在のプロセスの実ユーザー id 、実効ユーザー id 、および保存ユーザ
     ー id を設定します。

     *note Availability: 234c.: Unix, not WASI, not Android.

     Added in version 3.2.

 -- の関数: os.setreuid (ruid, euid, /)

     現在のプロセスの実ユーザー id および実効ユーザー id を設定します。

     *note Availability: 234c.: Unix, not WASI, not Android.

 -- の関数: os.getsid (pid, /)

     ‘getsid()’ システムコールを呼び出します。機能については Unix のマニ
     ュアルを参照してください。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.setsid ()

     ‘setsid()’ システムコールを呼び出します。機能については Unix のマニ
     ュアルを参照してください。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.setuid (uid, /)

     現在のプロセスのユーザー id を設定します。

     *note Availability: 234c.: Unix, not WASI, not Android.

 -- の関数: os.strerror (code, /)

     エラーコード 'code' に対応するエラーメッセージを返します。未知のエ
     ラーコードの対して ‘strerror()’ が ‘NULL’ を返すプラットフォームで
     は、 *note ValueError: 15a. が送出されます。

 -- データ: 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
     プラットフォーム: 1d86. for more information.

 -- の関数: os.uname ()

     現在のオペレーティングシステムを識別する情報を返します。返り値は 5
     個の属性を持つオブジェクトです:

        * ‘sysname’ - OS の名前

        * ‘nodename’ - (実装時に定義された) ネットワーク上でのマシン名

        * ‘release’ - OS のリリース

        * ‘version’ - OS のバージョン

        * ‘machine’ - ハードウェア識別子

     後方互換性のため、このオブジェクトはイテラブルでもあり、‘sysname’、
     ‘nodename’、‘release’、‘version’、および ‘machine’ の 5 個の要素を
     この順序で持つタプルのように振る舞います。

     一部のシステムでは、‘nodename’ はコンポーネントを読み込むために 8 文
     字または先頭の要素だけに切り詰められます; ホスト名を取得する方法と
     しては、*note socket.gethostname(): 3261. を使う方がよいでしょう。
     あるいは ‘socket.gethostbyaddr(socket.gethostname())’ でもかまいま
     せん。

     On macOS, iOS and Android, this returns the 'kernel' name and
     version (i.e., ‘'Darwin'’ on macOS and iOS; ‘'Linux'’ on Android).
     *note platform.uname(): 2020. can be used to get the user-facing
     operating system name and version on iOS and Android.

     *note Availability: 234c.: Unix.

     バージョン 3.3 で変更: 返り値の型が、タプルから属性名のついたタプル
     ライクオブジェクトに変更されました。

 -- の関数: os.unsetenv (key, /)

     'key' という名前の環境変数を unset (削除) します。このような環境変
     数の変更は、*note os.system(): 1815.、*note popen(): 58c.、または
     *note fork(): 6c3. と *note execv(): 3254. で起動されたサブプロセス
     に影響を与えます。

     *note os.environ: 4ec. のアイテムの削除を行うと、自動的に *note
     unsetenv(): 4ef. の対応する呼び出しに変換されます。直接
     ‘unsetenv()’ を呼び出した場合 ‘os.environ’ は更新されないため、実際
     には ‘os.environ’ のアイテムを削除する方が望ましい操作です。

     See also the *note os.reload_environ(): 4eb. function.

     引数 ‘key’ を指定して *note 監査イベント: 1e84. ‘os.unsetenv’ を送
     出します。

     バージョン 3.9 で変更: 常に関数は利用出来るようになりました。

 -- の関数: os.unshare (flags)

     Disassociate parts of the process execution context, and move them
     into a newly created namespace.  See the ‘unshare(2)(5)’ man page
     for more details.  The 'flags' argument is a bit mask, combining
     zero or more of the *note CLONE_* constants: 3258, 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: 234c.: Linux >= 2.6.16.

     Added in version 3.12.

     参考
     ....

     *note setns(): 1d5e. 関数。

Flags to the *note unshare(): 1d5f. function, if the implementation
supports them.  See ‘unshare(2)(6)’ in the Linux manual for their exact
effect and availability.

 -- データ: os.CLONE_FILES
 -- データ: os.CLONE_FS
 -- データ: os.CLONE_NEWCGROUP
 -- データ: os.CLONE_NEWIPC
 -- データ: os.CLONE_NEWNET
 -- データ: os.CLONE_NEWNS
 -- データ: os.CLONE_NEWPID
 -- データ: os.CLONE_NEWTIME
 -- データ: os.CLONE_NEWUSER
 -- データ: os.CLONE_NEWUTS
 -- データ: os.CLONE_SIGHAND
 -- データ: os.CLONE_SYSVSEM
 -- データ: os.CLONE_THREAD
 -- データ: os.CLONE_VM

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0584/

   (2) https://peps.python.org/pep-0584/

   (3) https://manpages.debian.org/setns(2)

   (4) https://manpages.debian.org/namespaces(7)

   (5) https://manpages.debian.org/unshare(2)

   (6) https://manpages.debian.org/unshare(2)


File: python.info,  Node: ファイルオブジェクトの生成,  Next: ファイル記述子の操作,  Prev: プロセスのパラメーター,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.17.1.4 ファイルオブジェクトの生成
...................................

以下の関数は新しい *note ファイルオブジェクト: 1581. を作成します。(ファ
イル記述子のオープンについては *note open(): 114f. も参照してください)

 -- の関数: os.fdopen (fd, *args, **kwargs)

     ファイル記述子 'fd' に接続し、オープンしたファイルオブジェクトを返
     します。これは組み込み関数 *note open(): 333. の別名であり、同じ引
     数を受け取ります。唯一の違いは *note fdopen(): 2590. の第一引数が常
     に整数でなければならないことです。


File: python.info,  Node: ファイル記述子の操作,  Next: ファイルとディレクトリ,  Prev: ファイルオブジェクトの生成,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.17.1.5 ファイル記述子の操作
.............................

これらの関数は、ファイル記述子を使って参照されている I/O ストリームを操
作します。

ファイル記述子とは現在のプロセスで開かれたファイルに対応する小さな整数で
す。例えば、標準入力のファイル記述子は通常 0 で、標準出力は 1 、標準エラ
ーは 2 です。プロセスから開かれたその他のファイルには 3 、 4 、 5 と割り
振られていきます。「ファイル記述子」という名称は少し誤解を与えるものかも
しれません。Unix プラットフォームでは、ソケットやパイプもファイル記述子
によって参照されます。

*note fileno(): 19d2. メソッドを使用して、必要な場合に *note file
object: 1581. に関連付けられているファイル記述子を取得することができます
。ファイル記述子を直接使用すると、ファイルオブジェクトのメソッドが使用さ
れないため、データの内部バッファなどの性質は無視されることに注意してくだ
さい。

 -- の関数: os.close (fd)

     ファイル記述子 'fd' をクローズします。

          注釈: この関数は低水準の I/O 向けのもので、 *note os.open():
          114f. や *note pipe(): 1d81. が返すファイル記述子に対して使用
          しなければなりません。 組み込み関数 *note open(): 333. や
          *note popen(): 58c. 、 *note fdopen(): 2590. が返す "ファイル
          オブジェクト" を閉じるには、オブジェクトの *note close(): 711.
          メソッドを使用してください。

 -- の関数: 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: 543. is raised with *note errno: 19ea. set to *note
     errno.EXDEV: 3275.

     This copy is done without the additional cost of transferring data
     from the kernel to user space and then back into the kernel.
     Additionally, some filesystems could implement extra optimizations,
     such as the use of reflinks (i.e., two or more inodes that share
     pointers to the same copy-on-write disk blocks; supported file
     systems include btrfs and XFS) and server-side copy (in the case of
     NFS).

     The function copies bytes between two file descriptors.  Text
     options, like the encoding and the line ending, are ignored.

     返り値はコピーされたバイトの量です。 この値は、要求した量より少なく
     なることもあります。

          注釈: On Linux, *note os.copy_file_range(): 1af4. 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: 234c.: Linux >= 4.5 with glibc >= 2.27.

     Added in version 3.8.

 -- の関数: os.device_encoding (fd)

     'fd' に関連付けられたデバイスが端末 (ターミナル) に接続されている場
     合に、そのデバイスのエンコーディングを表す文字列を返します。端末に
     接続されていない場合、 *note None: a6a. を返します。

     On Unix, if the *note Python UTF-8 Mode: a4b. 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
     継承不可: 12ad. です。

     Windows では、標準ストリーム (0: 標準入力、1: 標準出力、2: 標準エラ
     ー出力) を複製する場合、新しいファイル記述子は *note 継承可能:
     12ad. です。

     *note Availability: 234c.: not WASI.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.dup2 (fd, fd2, inheritable=True)

     ファイル記述子 'fd' を 'fd2' に複製し、必要な場合には後者を先に閉じ
     ます。 'fd2' が返ります。 新しいファイル記述子はデフォルトでは
     *note 継承可能: 12ad. で、'inheritable' が ‘False’ の場合は継承不可
     です。

     *note Availability: 234c.: not WASI.

     バージョン 3.4 で変更: オプションの 'inheritable' 引数が追加されま
     した。

     バージョン 3.7 で変更: 成功したときは 'fd2' が返ります。 以前は常に
     ‘None’ が返っていました。

 -- の関数: os.fchmod (fd, mode)

     'fd' で指定されたファイルのモードを 'mode' に変更します。'mode' に
     指定できる値については、*note chmod(): 732. のドキュメントを参照し
     てください。Python 3.3 以降では ‘os.chmod(fd, mode)’ と等価です。

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.chmod’ を送出します。

     *note Availability: 234c.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1d86. for more information.

     バージョン 3.13 で変更: Added support on Windows.

 -- の関数: os.fchown (fd, uid, gid)

     'fd' で指定されたファイルの所有者 id およびグループ id を数値 'uid'
     および 'gid' に変更します。いずれかの id を変更せずにおくにはその値
     として -1 を指定します。*note chown(): 14af. を参照してください。
     Python 3.3 以降では ‘os.chown(fd, uid, gid)’ と等価です。

     引数 ‘path’, ‘uid’, ‘gid’, ‘dir_fd’ を指定して *note 監査イベント:
     1e84. ‘os.chown’ を送出します。

     *note Availability: 234c.: Unix.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1d86. for more information.

 -- の関数: os.fdatasync (fd)

     ファイル記述子 'fd' を持つファイルのディスクへの書き込みを強制しま
     す。メタデータの更新は強制しません。

     *note Availability: 234c.: Unix.

          注釈: この関数は MacOS では利用できません。

 -- の関数: os.fpathconf (fd, name, /)

     開いているファイルに関連するシステム設定情報を返します。 'name' は
     取得する設定名を指定します。これは、いくつかの標準 (POSIX.1 、 Unix
     95 、 Unix 98 その他 ) で定義された定義済みのシステム値名の文字列で
     ある場合があります。プラットフォームによっては別の名前も定義されて
     います。ホストオペレーティングシステムの関知する名前は
     ‘pathconf_names’ 辞書で与えられています。このマップ型オブジェクトに
     含まれていない構成変数については、 'name' に整数を渡してもかまいま
     せん。

     'name' が不明の文字列である場合、 *note ValueError: 15a. を送出しま
     す。 'name' の特定の値がホストシステムでサポートされていない場合、
     ‘pathconf_names’ に含まれていたとしても、 *note errno.EINVAL: 1fe0.
     をエラー番号として *note OSError: 543. を送出します。

     Python 3.3 以降では ‘os.pathconf(fd, name)’ と等価です。

     *note Availability: 234c.: Unix.

 -- の関数: os.fstat (fd)

     ファイル記述子 'fd' の状態を取得します。*note stat_result: 1879. オ
     ブジェクトを返します。

     Python 3.3 以降では ‘os.stat(fd)’ と等価です。

     参考
     ....

     *note stat(): 4fc. 関数。

 -- の関数: os.fstatvfs (fd, /)

     *note statvfs(): 14bd. と同様に、ファイル記述子 'fd' に関連付けられ
     たファイルが格納されているファイルシステムに関する情報を返します。
     Python 3.3 以降では ‘os.statvfs(fd)’ と等価です。

     *note Availability: 234c.: Unix.

 -- の関数: os.fsync (fd)

     ファイル記述子 'fd' を持つファイルのディスクへの書き込みを強制しま
     す。 Unix では、ネイティブの ‘fsync()’ 関数を、 Windows では
     ‘_commit()’ 関数を呼び出します。

     Python の *note ファイルオブジェクト: 1581. 'f' を使う場合、'f' の
     内部バッファを確実にディスクに書き込むために、まず ‘f.flush()’ を、
     その後 ‘os.fsync(f.fileno())’ を実行してください。

     *note Availability: 234c.: Unix, Windows.

 -- の関数: os.ftruncate (fd, length, /)

     ファイル記述子 'fd' に対応するファイルを、サイズが最長で 'length' バ
     イトになるように切り詰めます。Python 3.3 以降では ‘os.truncate(fd,
     length)’ と等価です。

     引数 ‘fd’, ‘length’ を指定して *note 監査イベント: 1e84.
     ‘os.truncate’ を送出します。

     *note Availability: 234c.: Unix, Windows.

     バージョン 3.5 で変更: Windows サポートを追加しました。

 -- の関数: os.get_blocking (fd, /)

     記述子のブロッキングモードを取得します。 *note O_NONBLOCK: 11f2. フ
     ラグが設定されている場合は ‘False’ で、フラグがクリアされている場合
     は ‘True’ です。

     *note set_blocking(): 11f1. および *note
     socket.socket.setblocking(): 3277. も参照してください。

     *note Availability: 234c.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1d86. 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: 234c.: 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: 3278.、*note F_TLOCK: 3279.、*note
     F_ULOCK: 327a.、あるいは *note F_TEST: 327b. のいずれか一つ) を指定
     します。'len' にはロックするファイルのセクションを指定します。

     引数 ‘fd’, ‘cmd’, ‘len’ を指定して *note 監査イベント: 1e84.
     ‘os.lockf’ を送出します。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- データ: os.F_LOCK
 -- データ: os.F_TLOCK
 -- データ: os.F_ULOCK
 -- データ: os.F_TEST

     *note lockf(): 14d4. がとる動作を指定するフラグです。

     *note Availability: 234c.: 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: 234c.: 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: 1647. or ‘0’ - set 'pos' relative to the
          beginning of the file

        * *note SEEK_CUR: 1648. or ‘1’ - set 'pos' relative to the
          current file position

        * *note SEEK_END: 1649. or ‘2’ - set 'pos' relative to the end
          of the file

        * *note SEEK_HOLE: 327c. - set 'pos' to the next data location,
          relative to 'pos'

        * *note SEEK_DATA: 327d. - 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(): 14d8. function and the *note
     seek(): 1646. method on *note file-like objects: 1581, for whence
     to adjust the file position indicator.

     *note SEEK_SET: 1647.

          Adjust the file position relative to the beginning of the
          file.

     *note SEEK_CUR: 1648.

          Adjust the file position relative to the current file
          position.

     *note SEEK_END: 1649.

          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(): 14d8. function and the *note
     seek(): 1646. method on *note file-like objects: 1581, 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: 234c.: 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 継承不可: 12ad. です
     。

     For a description of the flag and mode values, see the C run-time
     documentation; flag constants (like *note O_RDONLY: 327e. and *note
     O_WRONLY: 327f.) are defined in the ‘os’ module.  In particular, on
     Windows adding *note O_BINARY: 3280. is needed to open files in
     binary mode.

     この関数は 'dir_fd' パラメタで *note
     ディレクトリ記述子への相対パス: 14ab. をサポートしています。

     引数 ‘path’, ‘mode’, ‘flags’ を指定して *note 監査イベント: 1e84.
     ‘open’ を送出します。

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

          注釈: This function is intended for low-level I/O. For normal
          usage, use the built-in function *note open(): 333, which
          returns a *note file object: 1581. with *note read(): 16e2.
          and *note write(): 109d. methods.  To wrap a file descriptor
          in a file object, use *note fdopen(): 2590.

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: 1145. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(1) を参照してください)。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

以下の定数は *note open(): 114f. 関数の '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: 1433. が追加されました
     。

 -- データ: 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: 1321. を、それをサポートするシ
     ステムで追加しました。また、 *note O_TMPFILE: 1322. を追加しました
     (Linux Kernel 3.11 以降でのみ利用可能です)。

 -- の関数: os.openpty ()

     新しい擬似端末のペアを開きます。pty および tty を表すファイル記述子
     のペア ‘(master, slave)’ を返します。新しいファイル記述子は *note
     継承不可: 12ad. です。(若干) 可搬性の高いアプローチには *note pty:
     b9. を使用してください。

     *note Availability: 234c.: Unix, not WASI.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.pipe ()

     パイプを作成します。読み込み、書き込みに使うことの出来るファイル記
     述子のペア ‘(r, w)’ を返します。新しいファイル記述子は *note
     継承不可: 12ad. です。

     *note Availability: 234c.: Unix, Windows.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.pipe2 (flags, /)

     'flags' を設定したパイプをアトミックに作成します。'flags' には値
     *note O_NONBLOCK: 11f2. と *note O_CLOEXEC: 1433. を一つ以上論理和
     指定できます。読み込み、書き込みに使うことの出来るファイル記述子の
     ペア ‘(r, w)’ を返します。

     *note Availability: 234c.: Unix, not WASI.

     Added in version 3.3.

 -- の関数: os.posix_fallocate (fd, offset, len, /)

     'fd' で指定されたファイルに対し、開始位置 'offset' から 'len' バイ
     ト分割り当てるに十分なディスクスペースを確保します。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- の関数: os.posix_fadvise (fd, offset, len, advice, /)

     データへアクセスする意思を、パターンを指定して宣言します。これによ
     りカーネルが最適化を行えるようになります。'advice' は 'fd' で指定さ
     れたファイルに対し、開始位置 'offset' から 'len' バイト分の領域に適
     用されます。'advice' には *note POSIX_FADV_NORMAL: 3296.、*note
     POSIX_FADV_SEQUENTIAL: 3297.、*note POSIX_FADV_RANDOM: 3298.、*note
     POSIX_FADV_NOREUSE: 3299.、*note POSIX_FADV_WILLNEED: 329a.、または
     *note POSIX_FADV_DONTNEED: 329b. のいずれか一つを指定します。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- データ: os.POSIX_FADV_NORMAL
 -- データ: os.POSIX_FADV_SEQUENTIAL
 -- データ: os.POSIX_FADV_RANDOM
 -- データ: os.POSIX_FADV_NOREUSE
 -- データ: os.POSIX_FADV_WILLNEED
 -- データ: os.POSIX_FADV_DONTNEED

     *note posix_fadvise(): 1150. において、使われるであろうアクセスパタ
     ーンを指定する 'advice' に使用できるフラグです。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- の関数: os.pread (fd, n, offset, /)

     ファイル記述子の位置 'offset' から最大で 'n' バイトを読み出します。
     ファイルオフセットは変化しません。

     読み込んだバイト分のバイト列を返します。 'fd' が参照しているファイ
     ルの終端に達した場合、空のバイト列が返されます。

     *note Availability: 234c.: 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: 12ad.  If
     the value *note O_CLOEXEC: 1433. is available on the system, it is
     added to 'oflag'.

     *note Availability: 234c.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.preadv (fd, buffers, offset, flags=0, /)

     ファイル記述子 'fd' の 'offset' の位置から、可変な *note bytes-like
     オブジェクト: 43d. 'buffers' にオフセットを変更せずに読み込みます。
     データをそれぞれのバッファがいっぱいになるまで移し、いっぱいになっ
     たらシーケンスの次のバッファに処理を移し、残りのデータを読み込ませ
     ます。

     flags 引数にはゼロあるいは次のフラグのバイトごとの OR を取った結果
     が保持されています。

        - *note RWF_HIPRI: 329c.

        - *note RWF_NOWAIT: 329d.

        - *note RWF_DONTCACHE: 1a16.

     実際に読み込んだ合計バイト数を返します。この値は、すべてのオブジェ
     クトの容量の総量よりも小さくなることがあります。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 1b2c. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note os.readv(): f1f. と *note os.pread(): f20. の機能を統合します
     。

     *note Availability: 234c.: 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: 2911.

     *note Availability: 234c.: Linux >= 4.14.

     Added in version 3.7.

 -- データ: os.RWF_HIPRI

     優先度の高い読み込み・書き込み (read/write) フラグです。ブロックス
     トレージに対して、追加のリソースを必要とする一方で低レイテンシなデ
     バイスのポーリングを使うことを許可します。

     現状、Linuxでは、ファイル記述子を *note O_DIRECT: 3291. フラグを指
     定したオープンした場合でのみ、この機能を利用できます。

     *note Availability: 234c.: Linux >= 4.6.

     Added in version 3.7.

 -- データ: os.RWF_DONTCACHE

     Use uncached buffered IO.

     *note Availability: 234c.: Linux >= 6.14

     Added in version 3.15.

 -- データ: os.RWF_ATOMIC

     Write data atomically.  Requires alignment to the device's atomic
     write unit.

     *note Availability: 234c.: Linux >= 6.11

     Added in version 3.15.

 -- の関数: 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: 234c.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.pwrite (fd, str, offset, /)

     'str' 中のバイト文字列をファイル記述子 'fd' の 'offset' の位置に書
     き込みます。ファイルオフセットを変化しません。

     実際に書き込まれたバイト数を返します。

     *note Availability: 234c.: 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: 43d.  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: 329e.

        - *note RWF_SYNC: 329f.

        - *note RWF_APPEND: 1f41.

        - *note RWF_DONTCACHE: 1a16.

        - *note RWF_ATOMIC: 199c.

     実際に書き込まれた合計バイト数を返します。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 1b2c. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note os.writev(): f22. と *note os.pwrite(): f23. の機能を統合しま
     す。

     *note Availability: 234c.: 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(): 114f. の *note O_DSYNC: 3285. と同
     等の効果を提供するフラグです。このフラグはシステムコールによって書
     き込まれたデータ範囲に対してのみ適用されます。

     *note Availability: 234c.: Linux >= 4.7.

     Added in version 3.7.

 -- データ: os.RWF_SYNC

     書き込みごとに *note os.open(): 114f. の *note O_SYNC: 3287. と同等
     の効果を提供するフラグです。このフラグはシステムコールによって書き
     込まれたデータ範囲に対してのみ適用されます。

     *note Availability: 234c.: Linux >= 4.7.

     Added in version 3.7.

 -- データ: os.RWF_APPEND

     Provide a per-write equivalent of the *note O_APPEND: 3282. *note
     os.open(): 114f. flag.  This flag is meaningful only for *note
     os.pwritev(): f21, 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: 234c.: 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():
          114f. or *note pipe(): 1d81.  To read a "file object" returned
          by the built-in function *note open(): 333. or by *note
          popen(): 58c. or *note fdopen(): 2590, or *note sys.stdin:
          94f, use its *note read(): 2279. or *note readline(): 16e3.
          methods.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: 1145. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(4) を参照してください)。

 -- の関数: os.readinto (fd, buffer, /)

     Read from a file descriptor 'fd' into a mutable *note buffer
     object: 319. 'buffer'.

     The 'buffer' should be mutable and *note bytes-like: 43d.  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():
          114f. or *note os.pipe(): 1d81.  To read a "file object"
          returned by the built-in function *note open(): 333, or *note
          sys.stdin: 94f, use its member functions, for example *note
          io.BufferedIOBase.readinto(): 1ad8, *note
          io.BufferedIOBase.read(): 16e2, or *note io.TextIOBase.read():
          2279.

     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(): ed7. が定義されているすべてのプ
     ラットフォームでサポートされています。

     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: 234c.: Unix, not WASI.

          注釈: *note sendfile(): ed7. のより高水準のラッパについては
          *note socket.socket.sendfile(): 1211. を参照してください。

     Added in version 3.3.

     バージョン 3.9 で変更: 引数 'out' と 'in' は 'out_fd' と 'in_fd' に
     名前が変更されました。

 -- データ: os.SF_NODISKIO
 -- データ: os.SF_MNOWAIT
 -- データ: os.SF_SYNC

     実装がサポートしている場合 *note sendfile(): ed7. 関数に渡すパラメ
     ーターです。

     *note Availability: 234c.: Unix, not WASI.

     Added in version 3.3.

 -- データ: os.SF_NOCACHE

     Parameter to the *note sendfile(): ed7. function, if the
     implementation supports it.  The data won't be cached in the
     virtual memory and will be freed afterwards.

     *note Availability: 234c.: Unix, not WASI.

     Added in version 3.11.

 -- の関数: os.set_blocking (fd, blocking, /)

     指定されたファイル記述子のブロッキングモードを設定します。 ブロッキ
     ングが ‘False’ の場合 *note O_NONBLOCK: 11f2. フラグを設定し、そう
     でない場合はクリアします。

     *note get_blocking(): 11f0. および *note
     socket.socket.setblocking(): 3277. も参照してください。

     *note Availability: 234c.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1d86. 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: 32a4. 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: 32a5. 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: 32a6. 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: 543. is raised with *note
     errno: 19ea. set to *note errno.EXDEV: 3275.

     このコピーは、カーネルからユーザースペースにデータを転送した後カー
     ネルに戻すという追加のコスト無しに完了します。 加えて、追加の最適化
     ができるファイルシステムもあります。 このコピーはファイルが両方とも
     バイナリファイルとして開かれたかのように行われます。

     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: 234c.: 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: 43d. '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(): 1b2c. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- の関数: os.tcgetpgrp (fd, /)

     'fd' (*note os.open(): 114f. が返すオープンしたファイル記述子 ) で
     与えられる端末に関連付けられたプロセスグループを返します。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.tcsetpgrp (fd, pg, /)

     'fd' (*note os.open(): 114f. が返すオープンしたファイル記述子 ) で
     与えられる端末に関連付けられたプロセスグループを 'pg' に設定します
     。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.ttyname (fd, /)

     ファイル記述子 'fd' に関連付けられている端末デバイスを特定する文字
     列を返します。 'fd' が端末に関連付けられていない場合、例外が送出さ
     れます。

     *note Availability: 234c.: 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: 234c.: 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():
          114f. or *note pipe(): 1d81.  To write a "file object"
          returned by the built-in function *note open(): 333. or by
          *note popen(): 58c. or *note fdopen(): 2590, or *note
          sys.stdout: ea0. or *note sys.stderr: d09, use its *note
          write(): 2268. method.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: 1145. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(6) を参照してください)。

 -- の関数: os.writev (fd, buffers, /)

     'buffers' の内容をファイル記述子 'fd' へ書き出します。 'buffers' は
     *note bytes-like オブジェクト: 43d. のシーケンスでなければなりませ
     ん。バッファは配列の順番で処理されます。最初のバッファの内容全体は
     2 番目のバッファに進む前に書き込まれ、その次も同様です。

     実際に書き込まれた合計バイト数を返します。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 1b2c. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note Availability: 234c.: 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: 2f37. 型のタプルで返します。

     オプションの引数 ‘fd’ には問い合わせるファイル記述子を指定します (デ
     フォルトは ‘STDOUT_FILENO’、または標準出力)。

     ファイル記述子が接続されていなかった場合、 *note OSError: 543. が送
     出されます。

     通常は高水準関数である *note shutil.get_terminal_size(): 14c4. を使
     用してください。‘os.get_terminal_size’ は低水準の実装です。

     *note Availability: 234c.: 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(): 6c3.

Windows の場合は、標準ストリームを除き、継承不可のハンドルと継承不可のフ
ァイル記述子は子プロセスでクローズされます。標準ストリーム (ファイル記述
子の 0, 1, 2: 標準入力, 標準出力, 標準エラー出力) は常に引き継がれます。
*note spawn*: 58d. 関数を使う場合、全ての継承可能なハンドルと全ての継承
可能なファイル記述子は引き継がれます。 *note subprocess: df. モジュール
を使う場合、標準ストリームを除く全てのファイル記述子はクローズされ、継承
可能なハンドルは '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: 234c.: Windows.

 -- の関数: os.set_handle_inheritable (handle, inheritable, /)

     指定したハンドルの「継承可能 (inheritable)」フラグをセットします。

     *note Availability: 234c.: 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: 14be. を使うことで、そのプラットフォーム上で
     'path' にファイル記述子を指定できるかどうかを確認することができます
     。この機能が利用可能でない場合、 ‘os.supports_fd’ の利用は *note
     NotImplementedError: 5a1. 例外を送出します。

     その関数が引数に '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: 14b8. で確認できます。利用で
     きない場合 *note NotImplementedError: 5a1. が送出されます。

   * '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: 14b9. で確認
     できます。利用できない場合 *note NotImplementedError: 5a1. が送出さ
     れます。

 -- の関数: 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: 32b0. にします。
     ファイルアクセス権限 ( パーミッション ) を調べるには、 *note R_OK:
     32b1, *note W_OK: 32b2, *note X_OK: 32b3. から一つまたはそれ以上の
     フラグを論理和指定でとることもできます。アクセスが許可されている場
     合 *note True: fd0. を、そうでない場合 *note False: ef9. を返します
     。詳細は ‘access(2)(1)’ の Unix マニュアルページを参照してください
     。

     この関数は *note ディレクトリ記述子への相対パス: 14ab. および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

     'effective_ids' が ‘True’ の場合、*note access(): 14ad. は実
     uid/gid ではなく実効 uid/gid を使用してアクセス権を調べます。プラッ
     トフォームによっては 'effective_ids' がサポートされていない場合があ
     ります; サポートされているかどうかは *note
     os.supports_effective_ids: 14bf. で確認できます。利用できない場合
     *note NotImplementedError: 5a1. が送出されます。

          注釈: ユーザーが、例えばファイルを開く権限を持っているかどうか
          を調べるために実際に *note open(): 333. を行う前に *note
          access(): 14ad. を使用することはセキュリティホールの原因になり
          ます。なぜなら、調べた時点とオープンした時点との時間差を利用し
          てそのユーザーがファイルを不当に操作してしまうかもしれないから
          です。その場合は *note EAFP: 32b4. テクニックを利用するのが望
          ましいやり方です。例えば

               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(): 14ad. が成功を示した時でも失
          敗することがあります。特にネットワークファイルシステムが通常の
          POSIX のパーミッションビットモデルをはみ出すアクセス権限操作を
          備える場合にはそのようなことが起こりえます。

     バージョン 3.3 で変更: 引数 'dir_fd'、'effective_ids'、および
     'follow_symlinks' が追加されました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- データ: os.F_OK
 -- データ: os.R_OK
 -- データ: os.W_OK
 -- データ: os.X_OK

     *note access(): 14ad. で 'path' をテストする時に 'mode' 引数に渡す
     値です。上からそれぞれ、ファイルの存在、読み込み許可、書き込み許可
     、および実行許可になります。

 -- の関数: os.chdir (path)

     現在の作業ディレクトリを 'path' に設定します。

     この関数は *note ファイル記述子の指定: f1d. をサポートしています。
     記述子は、オープンしているファイルではなく、オープンしているディレ
     クトリを参照していなければなりません。

     この関数は *note OSError: 543. やそのサブクラスである *note
     FileNotFoundError: 24f, *note PermissionError: 10fd, *note
     NotADirectoryError: 1410. などの例外を送出することがあります。

     引数 ‘path’ を指定して *note 監査イベント: 1e84. ‘os.chdir’ を送出
     します。

     バージョン 3.3 で変更: 一部のプラットフォームで、'path' にファイル
     記述子の指定をサポートしました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.chflags (path, flags, *, follow_symlinks=True)

     'path' のフラグを 'flags' に変更します。 'flags' は、以下の値
     (*note stat: d9. モジュールで定義されているもの ) をビット単位の論
     理和で組み合わせることができます :

        * *note stat.UF_NODUMP: 2ebb.

        * *note stat.UF_IMMUTABLE: 2ebc.

        * *note stat.UF_APPEND: 2ebd.

        * *note stat.UF_OPAQUE: 2ebe.

        * *note stat.UF_NOUNLINK: 2ebf.

        * *note stat.UF_COMPRESSED: 2ec0.

        * *note stat.UF_HIDDEN: 2ec3.

        * *note stat.SF_ARCHIVED: 2ec7.

        * *note stat.SF_IMMUTABLE: 2ec8.

        * *note stat.SF_APPEND: 2ec9.

        * *note stat.SF_NOUNLINK: 2ecb.

        * *note stat.SF_SNAPSHOT: 2ecc.

     この関数は *note シンボリックリンクをたどらない: 14ac. をサポートし
     ています。

     引数 ‘path’, ‘flags’ を指定して *note 監査イベント: 1e84.
     ‘os.chflags’ を送出します。

     *note Availability: 234c.: Unix, not WASI.

     バージョン 3.3 で変更: Added the 'follow_symlinks' parameter.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.chmod (path, mode, *, dir_fd=None, follow_symlinks=True)

     'path' のモードを数値 'mode' に変更します。 'mode' は、 (*note
     stat: d9. モジュールで定義されている ) 以下の値のいずれかまたはビッ
     ト単位の論理和で組み合わせた値を取り得ます :

        * *note stat.S_ISUID: 2ea7.

        * *note stat.S_ISGID: 2ea8.

        * *note stat.S_ENFMT: 2eaa.

        * *note stat.S_ISVTX: 2eab.

        * *note stat.S_IREAD: 2eb7.

        * *note stat.S_IWRITE: 2eb8.

        * *note stat.S_IEXEC: 2eb9.

        * *note stat.S_IRWXU: 2eac.

        * *note stat.S_IRUSR: 2ead.

        * *note stat.S_IWUSR: 2eae.

        * *note stat.S_IXUSR: 2eaf.

        * *note stat.S_IRWXG: 2eb0.

        * *note stat.S_IRGRP: 2eb1.

        * *note stat.S_IWGRP: 2eb2.

        * *note stat.S_IXGRP: 2ea9.

        * *note stat.S_IRWXO: 2eb3.

        * *note stat.S_IROTH: 2eb4.

        * *note stat.S_IWOTH: 2eb5.

        * *note stat.S_IXOTH: 2eb6.

     この関数は *note ファイル記述子の指定: f1d. 、 *note
     ディレクトリ記述子への相対パス: 14ab. 、および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

          注釈: 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
          プラットフォーム: 1d86. for more information.

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.chmod’ を送出します。

     バージョン 3.3 で変更: 'path' にオープンしているファイル記述子の指
     定のサポート、および引数 'dir_fd' と 'follow_symlinks' を追加しまし
     た。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 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 ファイル記述子の指定: f1d. 、 *note
     ディレクトリ記述子への相対パス: 14ab. 、および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

     数値 id の他に名前でも受け取る高水準関数の *note shutil.chown():
     750. を参照してください。

     引数 ‘path’, ‘uid’, ‘gid’, ‘dir_fd’ を指定して *note 監査イベント:
     1e84. ‘os.chown’ を送出します。

     *note Availability: 234c.: Unix.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1d86. for more information.

     バージョン 3.3 で変更: 'path' にオープンしているファイル記述子の指
     定のサポート、および引数 'dir_fd' と 'follow_symlinks' を追加しまし
     た。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.chroot (path)

     現在のプロセスのルートディレクトリを 'path' に変更します。

     *note Availability: 234c.: Unix, not WASI, not Android.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.fchdir (fd)

     現在の作業ディレクトリをファイル記述子 'fd' が表すディレクトリに変
     更します。記述子はオープンしているファイルではなく、オープンしたデ
     ィレクトリを参照していなければなりません。Python 3.3 以降では
     ‘os.chdir(fd)’ と等価です。

     引数 ‘path’ を指定して *note 監査イベント: 1e84. ‘os.chdir’ を送出
     します。

     *note Availability: 234c.: Unix.

 -- の関数: os.getcwd ()

     現在の作業ディレクトリを表す文字列を返します。

 -- の関数: os.getcwdb ()

     現在の作業ディレクトリを表すバイト列を返します。

     バージョン 3.8 で変更: この関数は Windows において ANSI コードペー
     ジ ではなく UTF-8 エンコーディングを使うようになりました: 変更の背
     景については PEP 529(2) をご覧ください。この関数は Windows において
     非推奨になりません。

 -- の関数: os.lchflags (path, flags)

     'path' のフラグを数値 'flags' に設定します。*note chflags(): 14ae.
     に似ていますが、シンボリックリンクをたどりません。Python 3.3 以降で
     は ‘os.chflags(path, flags, follow_symlinks=False)’ と等価です。

     引数 ‘path’, ‘flags’ を指定して *note 監査イベント: 1e84.
     ‘os.chflags’ を送出します。

     *note Availability: 234c.: Unix, not WASI.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.lchmod (path, mode)

     'path' のモードを数値 'mode' に変更します。パスがシンボリックリンク
     の場合はそのリンク先ではなくシンボリックリンクそのものに対して作用
     します。'mode' に指定できる値については *note chmod(): 732. のドキ
     ュメントを参照してください。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 監査イベント: 1e84.
     ‘os.chmod’ を送出します。

     *note Availability: 234c.: Unix, Windows, not Linux, FreeBSD >=
     1.3, NetBSD >= 1.3, not OpenBSD

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 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 監査イベント:
     1e84. ‘os.chown’ を送出します。

     *note Availability: 234c.: Unix.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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: 14ab, and *note not following symlinks: 14ac.  The
     default value of 'follow_symlinks' is ‘False’ on Windows.

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1e84. ‘os.link’ を送出します。

     *note Availability: 234c.: 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:
     7a5. を受け付けるようになりました。

 -- の関数: os.listdir (path='.')

     'path' に指定したディレクトリに含まれるエントリ名のリストを返します
     。リストの順番は不定です。特別なエントリ ‘'.'’ と ‘'..'’ はリストに
     含まれません。この関数の呼び出し中にディレクトリからファイルが削除
     されたり、ディレクトリにファイルが追加されたりした場合、それらのフ
     ァイルがリストに含まれるかどうかは不定です。

     'path' に *note path-like オブジェクト: 7a5. を指定することもできま
     す。 'path' が (直接的または間接的に *note PathLike: 1013. インター
     フェースを介した) ‘bytes’ 型の場合、戻り値のファイル名も ‘bytes’ 型
     になります; それ以外の場合、ファイル名は ‘str’ 型です。

     この関数は *note ファイル記述子の指定: f1d. もサポートしています; フ
     ァイル記述子はディレクトリを参照していなくてはなりません。

     引数 ‘path’ を指定して *note 監査イベント: 1e84. ‘os.listdir’ を送
     出します。

          注釈: ‘文字列型’ のファイル名を ‘バイト列型’ にエンコードする
          には、*note fsencode(): 1017. を使用します。

     参考
     ....

     ディレクトリエントリに加えてファイル属性情報も返す *note scandir():
     e27. 関数の方が、多くの一般的な用途では使い勝手が良くなります。

     バージョン 3.2 で変更: 引数 'path' は任意になりました。

     バージョン 3.3 で変更: 'path' へのオープン・ファイル記述子の指定を
     サポートしました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.15 で変更: ‘os.listdir(-1)’ now fails with
     ‘OSError(errno.EBADF)’ rather than listing the current directory.

 -- の関数: 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: 543. if an error occurs collecting the
     drive names.

     Raises an *note auditing event: 1e84. ‘os.listdrives’ with no
     arguments.

     *note Availability: 234c.: 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(): 8b4.  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: 543. if the volume is not recognized or if an
     error occurs collecting the paths.

     Raises an *note auditing event: 1e84. ‘os.listmounts’ with argument
     ‘volume’.

     *note Availability: 234c.: 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(): 8b5.

     May raise *note OSError: 543. if an error occurs collecting the
     volumes.

     Raises an *note auditing event: 1e84. ‘os.listvolumes’ with no
     arguments.

     *note Availability: 234c.: 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(): 4fc, but does not follow symbolic
     links.  Return a *note stat_result: 1879. object.

     シンボリックリンクをサポートしていないプラットフォームでは *note
     stat(): 4fc. の別名です。

     Python 3.3 以降では ‘os.stat(path, dir_fd=dir_fd,
     follow_symlinks=False)’ と等価です。

     この関数は *note ディレクトリ記述子への相対パス: 14ab. もサポートす
     ることができます。

     参考
     ....

     *note stat(): 4fc. 関数。

     バージョン 3.2 で変更: Windows 6.0 (Vista) のシンボリックリンクをサ
     ポートしました。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 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(): 4fc.

 -- の関数: os.mkdir (path, mode=0o777, *, dir_fd=None)

     ディレクトリ 'path' を数値モード 'mode' で作成します。

     If the directory already exists, *note FileExistsError: 13cd. is
     raised.  If a parent directory in the path does not exist, *note
     FileNotFoundError: 24f. is raised.  いくつかのシステムにおいては
     'mode' は無視されます。それが使われる時には、最初に現在の umask 値
     でマスクされます。もし最後の 9 ビット (つまり 'mode' の8進法表記の
     最後の3桁) を除いたビットが設定されていたら、それらの意味はプラット
     フォームに依存します。いくつかのプラットフォームではそれらは無視さ
     れ、それらを設定するためには明示的に *note chmod(): 732. を呼ぶ必要
     があるでしょう。

     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 ディレクトリ記述子への相対パス: 14ab. もサポートす
     ることができます。

     一時ディレクトリを作成することもできます : *note tempfile: e9. モジ
     ュールの *note tempfile.mkdtemp(): 735. 関数を参照してください。

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.mkdir’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.13 で変更: Windows now handles a 'mode' of ‘0o700’.

 -- の関数: os.makedirs (name, mode=0o777, exist_ok=False, *,
          parent_mode=None)

     再帰的にディレクトリを作成する関数です。*note mkdir(): 734. と似て
     いますが、末端ディレクトリを作成するために必要なすべての中間ディレ
     クトリも作成します。

     The 'mode' parameter is passed to *note mkdir(): 734. for creating
     the leaf directory; see *note the mkdir() description: 32b7. 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: 13cd. を送出します。

     If 'parent_mode' is not ‘None’, it is used as the mode for any
     newly-created, intermediate-level directories.  Like 'mode', it is
     combined with the process's umask value; see *note the mkdir()
     description: 32b7.  Otherwise, intermediate directories are created
     with the default mode, which is also subject to the umask.

          注釈: 作成するパス要素に *note pardir: 32b8. (UNIX では "..")
          が含まれる場合、*note makedirs(): 24b. は混乱します。

     この関数は UNC パスを正しく扱えるようになりました。

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.mkdir’ を送出します。

     バージョン 3.2 で変更: Added the 'exist_ok' parameter.

     バージョン 3.4.1 で変更: Python 3.4.1 より前、 'exist_ok' が ‘True’
     でそのディレクトリが既存の場合でも、 *note makedirs(): 24b. は
     'mode' が既存ディレクトリのモードと合わない場合にはエラーにしようと
     していました。このモードチェックの振る舞いを安全に実装することが出
     来なかったため、 Python 3.4.1 でこのチェックは削除されました。
     bpo-21082(3) を参照してください。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.7 で変更: The 'mode' argument no longer affects the
     file permission bits of newly created intermediate-level
     directories.

     Added in version 3.15: The 'parent_mode' parameter.  To match the
     behavior from Python 3.6 and earlier (where 'mode' was applied to
     all created directories), pass ‘parent_mode=mode’.

 -- の関数: os.mkfifo (path, mode=0o666, *, dir_fd=None)

     FIFO (名前付きパイプ) 'path' を数値モード 'mode' で作成します。先に
     現在の umask 値でマスクされます。

     この関数は *note ディレクトリ記述子への相対パス: 14ab. もサポートす
     ることができます。

     FIFO は通常のファイルのようにアクセスできるパイプです。 FIFO は ( 例
     えば *note os.unlink(): 14b6. を使って ) 削除されるまで存在しつづけ
     ます。一般的に、 FIFO は " クライアント " と " サーバー " 形式のプ
     ロセス間でランデブーを行うために使われます : この時、サーバーは
     FIFO を読み込み用に、クライアントは書き出し用にオープンします。
     *note mkfifo(): 114d. は FIFO をオープンしない -- 単にランデブーポ
     イントを作成するだけ -- なので注意してください。

     *note Availability: 234c.: Unix, not WASI.

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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
     *note stat.S_IFREG: 2ea2, *note stat.S_IFCHR: 2ea5, *note
     stat.S_IFBLK: 2ea3, and *note stat.S_IFIFO: 2ea6.  For
     ‘stat.S_IFCHR’ and ‘stat.S_IFBLK’, 'device' defines the newly
     created device special file (probably using *note os.makedev():
     1b92.), otherwise it is ignored.

     この関数は *note ディレクトリ記述子への相対パス: 14ab. もサポートす
     ることができます。

     *note Availability: 234c.: Unix, not WASI.

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.major (device, /)

     Extract the device major number from a raw device number (usually
     the *note st_dev: 32b9. or *note st_rdev: 1a18. field from ‘stat’).

 -- の関数: os.minor (device, /)

     Extract the device minor number from a raw device number (usually
     the *note st_dev: 32b9. or *note st_rdev: 1a18. field from ‘stat’).

 -- の関数: os.makedev (major, minor, /)

     メジャーおよびマイナーデバイス番号から、新しく RAW デバイス番号を作
     成します。

 -- データ: os.NODEV

     Non-existent device.

     Added in version 3.15.

 -- の関数: os.pathconf (path, name)

     名前付きファイルに関連するシステム設定情報を返します。 'name' には
     取得したい設定名を指定します ; これは定義済みのシステム値名の文字列
     で、多くの標準 (POSIX.1 、 Unix 95 、 Unix 98 その他 ) で定義されて
     います。プラットフォームによっては別の名前も定義しています。ホスト
     オペレーティングシステムの関知する名前は ‘pathconf_names’ 辞書で与
     えられています。このマップ型オブジェクトに入っていない設定変数につ
     いては、 'name' に整数を渡してもかまいません。

     'name' が不明の文字列である場合、 *note ValueError: 15a. を送出しま
     す。 'name' の特定の値がホストシステムでサポートされていない場合、
     ‘pathconf_names’ に含まれていたとしても、 *note errno.EINVAL: 1fe0.
     をエラー番号として *note OSError: 543. を送出します。

     この関数は *note ファイル記述子の指定: f1d. をサポートしています。

     *note Availability: 234c.: Unix.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- データ: os.pathconf_names

     *note pathconf(): 14bc. および *note fpathconf(): 3276. が受理する
     システム設定名を、ホストオペレーティングシステムで定義されている整
     数値に対応付けている辞書です。この辞書はシステムでどの設定名が定義
     されているかを知るために利用できます。

     *note Availability: 234c.: 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: 1013. 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 ディレクトリ記述子への相対パス: 14ab. もサポートす
     ることができます。

     When trying to resolve a path that may contain links, use *note
     realpath(): 24d. to properly handle recursion and platform
     differences.

     *note Availability: 234c.: Unix, Windows.

     バージョン 3.2 で変更: Windows 6.0 (Vista) のシンボリックリンクをサ
     ポートしました。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: Unixで、 *note path-like object: 7a5. を受け
     入れるようになりました。

     バージョン 3.8 で変更: Windowsで、 *note path-like object: 7a5. と
     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: 543. is raised.  Use *note rmdir(): 14b4. to remove
     directories.  If the file does not exist, a *note
     FileNotFoundError: 24f. is raised.

     この関数は *note ディレクトリ記述子への相対パス: 14ab. をサポートし
     ています。

     Windows では、使用中のファイルを削除しようとすると例外を送出します;
     Unixでは、ディレクトリエントリは削除されますが、記憶装置上に割り当
     てられたファイル領域は元のファイルが使われなくなるまで残されます。

     この関数は意味論的に *note unlink(): 14b6. と同一です。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.remove’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.removedirs (name)

     再帰的なディレクトリ削除関数です。 *note rmdir(): 14b4. と同じよう
     に動作しますが、末端ディレクトリがうまく削除できるかぎり、 *note
     removedirs(): 32bb. は 'path' に現れる親ディレクトリをエラーが送出
     されるまで ( このエラーは通常、指定したディレクトリの親ディレクトリ
     が空でないことを意味するだけなので無視されます ) 順に削除することを
     試みます。例えば、 ‘os.removedirs('foo/bar/baz')’ では最初にディレ
     クトリ ‘'foo/bar/baz'’ を削除し、次に ‘'foo/bar'’ さらに ‘'foo'’ を
     それらが空ならば削除します。末端のディレクトリが削除できなかった場
     合には *note OSError: 543. が送出されます。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.remove’ を送出します。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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: 543. subclass in a
     number of cases:

     On Windows, if 'dst' exists a *note FileExistsError: 13cd. is
     always raised.  The operation may fail if 'src' and 'dst' are on
     different filesystems.  Use *note shutil.move(): e24. 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: 140f. or a *note NotADirectoryError:
     1410. 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: 543. 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 ディレクトリ記述子への相対パス: 14ab. をサポートしています
     。

     対象の上書きがクロスプラットフォームになる場合は *note replace():
     14b3. を使用してください。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1e84. ‘os.rename’ を送出します。

     バージョン 3.3 で変更: Added the 'src_dir_fd' and 'dst_dir_fd'
     parameters.

     バージョン 3.6 で変更: 'src' と 'dst' が *note path-like object:
     7a5. を受け付けるようになりました。

 -- の関数: os.renames (old, new)

     再帰的にディレクトリやファイル名を変更する関数です。 *note
     rename(): 14b2. のように動作しますが、新たなパス名を持つファイルを
     配置するために必要な途中のディレクトリ構造をまず作成しようと試みま
     す。名前変更の後、元のファイル名のパス要素は *note removedirs():
     32bb. を使って右側から順に削除されます。

          注釈: この関数はコピー元の末端のディレクトリまたはファイルを削
          除する権限がない場合には失敗します。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1e84. ‘os.rename’ を送出します。

     バージョン 3.6 で変更: 'old' と 'new' が *note path-like object:
     7a5. を受け付けるようになりました。

 -- の関数: os.replace (src, dst, *, src_dir_fd=None, dst_dir_fd=None)

     ファイルまたはディレクトリ 'src' の名前を 'dst' へ変更します。'dst'
     が空でないディレクトリの場合 *note OSError: 543. が送出されます。
     'dst' が存在し、かつファイルの場合、ユーザーの権限がある限り暗黙の
     うちに置き換えられます。'src' と 'dst' が異なるファイルシステム上に
     あると失敗することがあります。ファイル名の変更が成功する場合はアト
     ミック操作となります (これは POSIX 要求仕様です)。

     この関数は 'src_dir_fd' と 'dst_dir_fd' のどちらかまたは両方の指定
     に *note ディレクトリ記述子への相対パス: 14ab. をサポートしています
     。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1e84. ‘os.rename’ を送出します。

     Added in version 3.3.

     バージョン 3.6 で変更: 'src' と 'dst' が *note path-like object:
     7a5. を受け付けるようになりました。

 -- の関数: os.rmdir (path, *, dir_fd=None)

     Remove (delete) the directory 'path'.  If the directory does not
     exist or is not empty, a *note FileNotFoundError: 24f. or an *note
     OSError: 543. is raised respectively.  In order to remove whole
     directory trees, *note shutil.rmtree(): 33d. can be used.

     この関数は *note ディレクトリ記述子への相対パス: 14ab. をサポートし
     ています。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.rmdir’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.scandir (path='.')

     Return an iterator of *note os.DirEntry: 8b1. 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(): 14bb. の代わりに *note scandir(): e27. を使用する
     と、ファイルタイプや属性情報も必要とするコードのパフォーマンスが大
     幅に向上します。これは、オペレーティングシステムがディレクトリのス
     キャン中にこの情報を提供した場合、*note os.DirEntry: 8b1. オブジェ
     クトがその情報を公開するからです。すべての ‘os.DirEntry’ メソッドは
     システムコールを実行する場合がありますが、*note is_dir(): 32bd. と
     *note is_file(): 1141. は、通常はシンボリックリンクにしかシステムコ
     ールを必要としません。*note os.DirEntry.stat(): 1c90. は、Unix 上で
     は常にシステムコールを必要としますが、Windows ではシンボリックリン
     ク用にシステムコールを一つ必要とするだけです。

     'path' may be a *note path-like object: 7a5.  If 'path' is of type
     ‘bytes’ (directly or indirectly through the *note PathLike: 1013.
     interface), the type of the *note name: 32be. and *note path: 1c1f.
     attributes of each *note os.DirEntry: 8b1. will be ‘bytes’; in all
     other circumstances, they will be of type ‘str’.

     この関数は *note ファイル記述子の指定: f1d. もサポートしています; フ
     ァイル記述子はディレクトリを参照していなくてはなりません。

     引数 ‘path’ を指定して *note 監査イベント: 1e84. ‘os.scandir’ を送
     出します。

     *note scandir(): e27. イテレータは、 *note コンテキストマネージャ:
     47f. プロトコルをサポートし、次のメソッドを持ちます。

      -- メソッド: scandir.close ()

          イテレータを閉じ、獲得した資源を開放します。

          この関数は、イテレータがすべて消費されるか、ガーベージコレクト
          された、もしくはイテレート中にエラーが発生した際に自動的に呼び
          出されます。しかし、 *note with: 215. 文を用いるか、明示的に呼
          び出すことを推奨します。

          Added in version 3.6.

     次の単純な例では、*note scandir(): e27. を使用して、指定した '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, ‘scandir()’ 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:
     47f. protocol and the *note close(): 107e. method.  If a
     ‘scandir()’ iterator is neither exhausted nor explicitly closed a
     *note ResourceWarning: 754. will be emitted in its destructor.

     関数が *note path-like object: 7a5. を受け入れるようになりました。

     バージョン 3.7 で変更: Unix で *note ファイル記述子の指定: f1d. の
     サポートが追加されました。

     バージョン 3.15 で変更: ‘os.scandir(-1)’ now fails with
     ‘OSError(errno.EBADF)’ rather than listing the current directory.

 -- クラス: os.DirEntry

     ディレクトリエントリのファイルパスとその他のファイル属性を公開する
     ために、*note scandir(): e27. が yield するオブジェクトです。

     *note scandir(): e27. は、追加のシステムコールを実行することなく、
     この情報をできるだけ多く提供します。‘stat()’ または ‘lstat()’ シス
     テムコールが実行された場合、‘os.DirEntry’ オブジェクトは結果をキャ
     ッシュします。

     ‘os.DirEntry’ インスタンスは、寿命の長いデータ構造に保存されること
     は想定されていません。ファイルメタデータが変更された場合や、 *note
     scandir(): e27. が呼び出されてから長時間が経過した場合は、
     ‘os.stat(entry.path)’ を呼び出して最新の情報を取得してください。

     ‘os.DirEntry’ のメソッドはオペレーティングシステムコールを実行する
     場合があるため、それらは *note OSError: 543. も送出する場合がありま
     す。エラーを細かく制御する必要がある場合、 ‘os.DirEntry’ のメソッド
     の一つの呼び出し時に ‘OSError’ を捕捉して、適切な処理を行うことがで
     きます。

     To be directly usable as a *note path-like object: 7a5,
     ‘os.DirEntry’ implements the *note PathLike: 1013. interface.

     ‘os.DirEntry’ インスタンスの属性とメソッドは以下の通りです:

      -- の属性: name

          *note scandir(): e27. の 'path' 引数に対して相対的な、エントリ
          のベースファイル名です。

          The *note name: 323e. attribute will be ‘bytes’ if the *note
          scandir(): e27. 'path' argument is of type ‘bytes’ and ‘str’
          otherwise.  Use *note fsdecode(): 1016. 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(): e27. 'path' argument.  The path is
          only absolute if the ‘scandir()’ 'path' argument was absolute.
          If the ‘scandir()’ 'path' argument was a *note file
          descriptor: f1d, the *note path: a6. attribute is the same as
          the *note name: 323e. attribute.

          The *note path: a6. attribute will be ‘bytes’ if the *note
          scandir(): e27. 'path' argument is of type ‘bytes’ and ‘str’
          otherwise.  Use *note fsdecode(): 1016. 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(): 2e8e. と共に *note os.stat(): 4fc. を呼
          び出してください。

          多くの場合、最初のキャッシュされない呼び出しでは、システムコー
          ルは必要とされません。具体的には、シンボリックリンク以外では、
          Windows も Unix もシステムコールを必要としません。ただし、
          ‘dirent.d_type == DT_UNKNOWN’ を返す、ネットワークファイルシス
          テムなどの特定の Unix ファイルシステムは例外です。項目がシンボ
          リックリンクの場合、'follow_symlinks' が ‘False’ の場合を除き
          、シンボリックリンクをたどるためにシステムコールが必要となりま
          す。

          このメソッドは *note PermissionError: 10fd. のような *note
          OSError: 543. を送出することがありますが、 *note
          FileNotFoundError: 24f. は捕捉され送出されません。

      -- メソッド: is_file (*, follow_symlinks=True)

          この項目がファイルまたはファイルへのシンボリックリンクである場
          合、 ‘True’ を返します。項目がディレクトリやファイル以外の項目
          へのシンボリックリンクである場合や、もはや存在しない場合は
          ‘False’ を返します。

          'follow_symlinks' が ‘False’ の場合、項目がファイル (シンボリ
          ックリンクはたどりません) の場合にのみ ‘True’ を返します。項目
          がディレクトリやその他のファイル以外の項目である場合や、項目が
          もはや存在しない場合は ‘False’ を返します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。キャッ
          シュ、システムコール、例外は、*note is_dir(): 32bd. と同様に行
          われます。

      -- メソッド: is_symlink ()

          この項目がシンボリックリンクの場合 (たとえ破損していても)、
          ‘True’ を返します。項目がディレクトリやあらゆる種類のファイル
          の場合、またはもはや存在しない場合は ‘False’ を返します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。 最新の
          情報をフェッチするには *note os.path.islink(): dd4. を呼び出し
          てください。

          多くの場合、最初のキャッシュされない呼び出しでは、システムコー
          ルは必要とされません。具体的には、Windows も Unix もシステムコ
          ールを必要としません。ただし、‘dirent.d_type == DT_UNKNOWN’ を
          返す、ネットワークファイルシステムなどの特定の Unix ファイルシ
          ステムは例外です。

          このメソッドは *note PermissionError: 10fd. のような *note
          OSError: 543. を送出することがありますが、 *note
          FileNotFoundError: 24f. は捕捉され送出されません。

      -- メソッド: 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(): 8b8. to fetch up-to-date information.

          Added in version 3.12.

      -- メソッド: stat (*, follow_symlinks=True)

          この項目の *note stat_result: 1879. オブジェクトを返します。こ
          のメソッドは、デフォルトでシンボリックリンクをたどります。シン
          ボリックリンクを開始するには、 ‘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: 1879. の ‘st_ino’ 、 ‘st_dev’
          、 ‘st_nlink’ 属性は常にゼロに設定されます。これらの属性を取得
          するには、 *note os.stat(): 4fc. を呼び出します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。
          'follow_symlinks' が ‘True’ の場合と ‘False’ の場合とでは、別
          のオブジェクトにキャッシュされます。最新の情報を取得するには、
          *note os.stat(): 4fc. を呼び出してください。

     Note that there is a nice correspondence between several attributes
     and methods of ‘os.DirEntry’ and of *note pathlib.Path: 4f5.  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: 1013. インターフェースをサポ
     ートしました。Windowsで *note bytes: 1d2. パスをサポートしました。

     バージョン 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: 1013. interface - or as an open file
     descriptor.  Return a *note stat_result: 1879. object.

     この関数は通常はシンボリックリンクをたどります。シンボリックリンク
     に対して stat したい場合は ‘follow_symlinks=False’ とするか、 *note
     lstat(): 8b6. を利用してください。

     この関数は *note ファイル記述子の指定: f1d. および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

     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(): 24d.
     function to resolve the path name as far as possible and call *note
     lstat(): 8b6. 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(): 1149. と *note lstat(): 8b6.。

     バージョン 3.3 で変更: Added the 'dir_fd' and 'follow_symlinks'
     parameters, specifying a file descriptor instead of a path.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 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():
     4fc, *note os.fstat(): 1149. and *note os.lstat(): 8b6.

     属性:

      -- の属性: 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: 1b4.

          バージョン 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: 1b4.

          Added in version 3.12.

          注釈: The exact meaning and resolution of the *note st_atime:
          32c5, *note st_mtime: 3150, *note st_ctime: 32c6. and *note
          st_birthtime: 32ca. 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: 32c7, *note
          st_mtime_ns: 32c8, *note st_ctime_ns: 32c9. and *note
          st_birthtime_ns: 32cb. 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: 32c5, *note st_mtime:
          3150, *note st_ctime: 32c6. and *note st_birthtime: 32ca.
          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:
          32c4./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:
          d9. module.

          Added in version 3.5.

      -- の属性: st_reparse_tag

          When *note st_file_attributes: 11ef. has the *note
          FILE_ATTRIBUTE_REPARSE_POINT: 2edb. set, this field contains
          the tag identifying the type of reparse point.  See the *note
          IO_REPARSE_TAG_*: 2ee0. constants in the *note stat: d9.
          module.

     The standard module *note stat: d9. 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: dd2, *note st_ino: 32c0, *note st_dev: 32b9,
     *note st_nlink: 32c1, *note st_uid: 32c2, *note st_gid: 32c3, *note
     st_size: 32c4, *note st_atime: 32c5, *note st_mtime: 3150, *note
     st_ctime: 32c6.  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: 32c0. when available.

     バージョン 3.7 で変更: Added the *note st_fstype: f25. member to
     Solaris/derivatives.

     バージョン 3.8 で変更: Added the *note st_reparse_tag: dd3. member
     on Windows.

     バージョン 3.8 で変更: On Windows, the *note st_mode: dd2. member
     now identifies special files as *note S_IFCHR: 2ea5, *note S_IFIFO:
     2ea6. or *note S_IFBLK: 2ea3. as appropriate.

     バージョン 3.12 で変更: On Windows, *note st_ctime: 32c6. 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: 32ca. for the
     creation time.

     On Windows, *note st_ino: 32c0. 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: 1a18. no longer returns a value.
     Previously it would contain the same as *note st_dev: 32b9, which
     was incorrect.

     Added the *note st_birthtime: 32ca. member on Windows.

 -- の関数: os.statx (path, mask, *, flags=0, dir_fd=None,
          follow_symlinks=True)

     Get the status of a file or file descriptor by performing a
     ‘statx()’ system call on the given path.

     'path' is a *note path-like object: 7a5. or an open file
     descriptor.  'mask' is a combination of the module-level *note
     STATX_*: 32d3. constants specifying the information to retrieve.
     'flags' is a combination of the module-level *note AT_STATX_*:
     32d4. constants and/or *note AT_NO_AUTOMOUNT: 32d5.  Returns a
     *note statx_result: 32d6. object whose *note stx_mask: 32d7.
     attribute specifies the information actually retrieved (which may
     differ from 'mask').

     This function supports *note specifying a file descriptor: f1d,
     *note paths relative to directory descriptors: 14ab, and *note not
     following symlinks: 14ac.

     参考
     ....

     The ‘statx(2)(9)’ man page.

     *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28.

     Added in version 3.15.

 -- クラス: os.statx_result

     Information about a file returned by *note os.statx(): 24a.

     ‘statx_result’ has the following attributes:

      -- の属性: stx_atime

          秒で表した最終アクセス時刻。

          Equal to ‘None’ if *note STATX_ATIME: 32d9. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_atime_ns

          ナノ秒 (整数) で表した最終アクセス時刻。

          Equal to ‘None’ if *note STATX_ATIME: 32d9. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_atomic_write_segments_max

          Maximum iovecs for direct I/O with torn-write protection.

          Equal to ‘None’ if *note STATX_WRITE_ATOMIC: 32dc. is missing
          from *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 6.11.

      -- の属性: stx_atomic_write_unit_max

          Maximum size for direct I/O with torn-write protection.

          Equal to ‘None’ if *note STATX_WRITE_ATOMIC: 32dc. is missing
          from *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 6.11.

      -- の属性: stx_atomic_write_unit_max_opt

          Maximum optimized size for direct I/O with torn-write
          protection.

          Equal to ‘None’ if *note STATX_WRITE_ATOMIC: 32dc. is missing
          from *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 6.16.

      -- の属性: stx_atomic_write_unit_min

          Minimum size for direct I/O with torn-write protection.

          Equal to ‘None’ if *note STATX_WRITE_ATOMIC: 32dc. is missing
          from *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 6.11.

      -- の属性: stx_attributes

          Bitmask of *note STATX_ATTR_*: 2ee5. constants specifying the
          attributes of this file.

      -- の属性: stx_attributes_mask

          A mask indicating which bits in *note stx_attributes: 2ee3.
          are supported by the VFS and the filesystem.

      -- の属性: stx_blksize

          効率的なファイルシステム I/O のための「推奨される」ブロックサ
          イズです。ファイルに、これより小さいチャンクで書き込むと、非効
          率的な読み込み、編集、再書き込みが起こる場合があります。

      -- の属性: stx_blocks

          Number of 512-byte blocks allocated for file.  This may be
          smaller than *note stx_size: 32e2./512 when the file has
          holes.

          Equal to ‘None’ if *note STATX_BLOCKS: 32e3. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_btime

          Time of file creation expressed in seconds.

          Equal to ‘None’ if *note STATX_BTIME: 32e5. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_btime_ns

          Time of file creation expressed in nanoseconds as an integer.

          Equal to ‘None’ if *note STATX_BTIME: 32e5. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_ctime

          Time of most recent metadata change expressed in seconds.

          Equal to ‘None’ if *note STATX_CTIME: 32e8. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_ctime_ns

          Time of most recent metadata change expressed in nanoseconds
          as an integer.

          Equal to ‘None’ if *note STATX_CTIME: 32e8. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_dev

          このファイルが存在するデバイスの識別子。

      -- の属性: stx_dev_major

          Major number of the device on which this file resides.

      -- の属性: stx_dev_minor

          Minor number of the device on which this file resides.

      -- の属性: stx_dio_mem_align

          Direct I/O memory buffer alignment requirement.

          Equal to ‘None’ if *note STATX_DIOALIGN: 32ee. is missing from
          *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 6.1.

      -- の属性: stx_dio_offset_align

          Direct I/O file offset alignment requirement.

          Equal to ‘None’ if *note STATX_DIOALIGN: 32ee. is missing from
          *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 6.1.

      -- の属性: stx_dio_read_offset_align

          Direct I/O file offset alignment requirement for reads.

          Equal to ‘None’ if *note STATX_DIO_READ_ALIGN: 32f1. is
          missing from *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 6.14.

      -- の属性: stx_gid

          ファイル所有者のグループ識別子。

          Equal to ‘None’ if *note STATX_GID: 32f3. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_ino

          Iノード番号。

          Equal to ‘None’ if *note STATX_INO: 32f5. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_mask

          Bitmask of *note STATX_*: 32d3. constants specifying the
          information retrieved, which may differ from what was
          requested.

      -- の属性: stx_mnt_id

          Mount identifier.

          Equal to ‘None’ if *note STATX_MNT_ID: 32f7. is missing from
          *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 5.8.

      -- の属性: stx_mode

          ファイルモード。ファイルタイプとファイルモードのビット （権限
          ）。

          Equal to ‘None’ if *note STATX_TYPE | STATX_MODE: 32d3. is
          missing from *note stx_mask: 32d7.

      -- の属性: stx_mtime

          秒で表した最終内容更新時刻。

          Equal to ‘None’ if *note STATX_MTIME: 32fa. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_mtime_ns

          ナノ秒 (整数) で表した最終内容更新時刻。

          Equal to ‘None’ if *note STATX_MTIME: 32fa. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_nlink

          ハードリンクの数。

          Equal to ‘None’ if *note STATX_NLINK: 32fd. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_rdev

          inode デバイスの場合デバイスタイプ

      -- の属性: stx_rdev_major

          Major number of the device this file represents.

      -- の属性: stx_rdev_minor

          Minor number of the device this file represents.

      -- の属性: stx_size

          ファイルが通常のファイルまたはシンボリックリンクの場合、そのフ
          ァイルのバイト単位でのサイズです。シンボリックリンクのサイズは
          、含まれるパス名の長さで、null バイトで終わることはありません
          。

          Equal to ‘None’ if *note STATX_SIZE: 3301. is missing from
          *note stx_mask: 32d7.

      -- の属性: stx_subvol

          Subvolume identifier.

          Equal to ‘None’ if *note STATX_SUBVOL: 3303. is missing from
          *note stx_mask: 32d7.

          *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28
          and build-time kernel userspace API headers >= 6.10.

      -- の属性: stx_uid

          ファイル所有者のユーザ識別子。

          Equal to ‘None’ if *note STATX_UID: 3305. is missing from
          *note stx_mask: 32d7.

     参考
     ....

     The ‘statx(2)(10)’ man page.

     *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28.

     Added in version 3.15.

 -- データ: os.STATX_TYPE
 -- データ: os.STATX_MODE
 -- データ: os.STATX_NLINK
 -- データ: os.STATX_UID
 -- データ: os.STATX_GID
 -- データ: os.STATX_ATIME
 -- データ: os.STATX_MTIME
 -- データ: os.STATX_CTIME
 -- データ: os.STATX_INO
 -- データ: os.STATX_SIZE
 -- データ: os.STATX_BLOCKS
 -- データ: os.STATX_BASIC_STATS
 -- データ: os.STATX_BTIME
 -- データ: os.STATX_MNT_ID
 -- データ: os.STATX_DIOALIGN
 -- データ: os.STATX_MNT_ID_UNIQUE
 -- データ: os.STATX_SUBVOL
 -- データ: os.STATX_WRITE_ATOMIC
 -- データ: os.STATX_DIO_READ_ALIGN

     Bitflags for use in the 'mask' parameter to *note os.statx(): 24a.
     Some of these flags may be available even when their corresponding
     members in *note statx_result: 32d6. are not available.

     *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28.

     Added in version 3.15.

 -- データ: os.AT_STATX_FORCE_SYNC

     A flag for the *note os.statx(): 24a. function.  Requests that the
     kernel return up-to-date information even when doing so is
     expensive (for example, requiring a round trip to the server for a
     file on a network filesystem).

     *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28.

     Added in version 3.15.

 -- データ: os.AT_STATX_DONT_SYNC

     A flag for the *note os.statx(): 24a. function.  Requests that the
     kernel return cached information if possible.

     *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28.

     Added in version 3.15.

 -- データ: os.AT_STATX_SYNC_AS_STAT

     A flag for the *note os.statx(): 24a. function.  This flag is
     defined as ‘0’, so it has no effect, but it can be used to
     explicitly indicate neither *note AT_STATX_FORCE_SYNC: 32d4. nor
     *note AT_STATX_DONT_SYNC: 3309. is being passed.  In the absence of
     the other two flags, the kernel will generally return information
     as fresh as *note os.stat(): 4fc. would return.

     *note Availability: 234c.: Linux >= 4.11 with glibc >= 2.28.

     Added in version 3.15.

 -- データ: os.AT_NO_AUTOMOUNT

     If the final component of a path is an automount point, operate on
     the automount point instead of performing the automount.  On Linux,
     *note os.stat(): 4fc, *note os.fstat(): 1149. and *note os.lstat():
     8b6. always behave this way.

     *note Availability: 234c.: Linux.

     Added in version 3.15.

 -- の関数: os.statvfs (path)

     Perform a ‘statvfs()’ system call on the given path.  The return
     value is an object whose attributes describe the filesystem on the
     given path, and correspond to the members of the ‘statvfs’
     structure, namely: ‘f_bsize’, ‘f_frsize’, ‘f_blocks’, ‘f_bfree’,
     ‘f_bavail’, ‘f_files’, ‘f_ffree’, ‘f_favail’, ‘f_flag’,
     ‘f_namemax’, ‘f_fsid’.

     ‘f_flag’ 属性のビットフラグ用に 2 つのモジュールレベル定数が定義さ
     れています: ‘ST_RDONLY’ が設定されるとファイルシステムは読み出し専
     用でマウントされ、‘ST_NOSUID’ が設定されると setuid/setgid ビットの
     動作は無効になるか、サポートされません。

     GNU/glibc ベースのシステム用に、追加のモジュールレベルの定数が次の
     ように定義されています。 ‘ST_NODEV’ (デバイス特殊ファイルへのアクセ
     スを許可しない) 、 ‘ST_NOEXEC’ (プログラムの実行を許可しない) 、
     ‘ST_SYNCHRONOUS’ (書き込みが一度に同期される) 、‘ST_MANDLOCK’ (ファ
     イルシステムで強制的なロックを許可する) 、 ‘ST_WRITE’ (ファイル/デ
     ィレクトリ/シンボリックリンクに書き込む) 、 ‘ST_APPEND’ (追記のみの
     ファイル) 、‘ST_IMMUTABLE’ (変更不能なファイル) 、 ‘ST_NOATIME’ (ア
     クセス時刻を更新しない) 、‘ST_NODIRATIME’ (ディレクトリアクセス時刻
     を更新しない) 、‘ST_RELATIME’ (mtime/ctimeに対して相対的に atime を
     更新する)。

     この関数は *note ファイル記述子の指定: f1d. をサポートしています。

     *note Availability: 234c.: Unix.

     バージョン 3.2 で変更: 定数 ‘ST_RDONLY’ および ‘ST_NOSUID’ が追加さ
     れました。

     バージョン 3.3 で変更: 'path' へのオープン・ファイル記述子の指定を
     サポートしました。

     バージョン 3.4 で変更: ‘ST_NODEV’, ‘ST_NOEXEC’, ‘ST_SYNCHRONOUS’,
     ‘ST_MANDLOCK’, ‘ST_WRITE’, ‘ST_APPEND’, ‘ST_IMMUTABLE’,
     ‘ST_NOATIME’, ‘ST_NODIRATIME’, ‘ST_RELATIME’ 定数が追加されました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.7 で変更: Added the ‘f_fsid’ attribute.

 -- データ: os.supports_dir_fd

     A *note set: 432. 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(): 4fc. 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: 432. object indicating whether *note os.access():
     14ad. 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(): 14ad.
     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: 432. 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(): a07. 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: 432. 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(): 4fc. 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 ディレクトリ記述子への相対パス: 14ab. をサポートし
     ています。

          注釈: 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: 543. が送出されます。

     引数 ‘src’, ‘dst’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.symlink’ を送出します。

     *note Availability: 234c.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1d86. 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:
     7a5. を受け付けるようになりました。

     バージョン 3.8 で変更: Added support for unelevated symlinks on
     Windows with Developer Mode.

 -- の関数: os.sync ()

     ディスクキャッシュのディスクへの書き出しを強制します。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- の関数: os.truncate (path, length)

     'path' に対応するファイルを、サイズが最大で 'length' バイトになるよ
     う切り詰めます。

     この関数は *note ファイル記述子の指定: f1d. をサポートしています。

     引数 ‘path’, ‘length’ を指定して *note 監査イベント: 1e84.
     ‘os.truncate’ を送出します。

     *note Availability: 234c.: Unix, Windows.

     Added in version 3.3.

     バージョン 3.5 で変更: Windows サポートを追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.unlink (path, *, dir_fd=None)

     ファイル 'path' を削除します。意味上は *note remove(): 14b1. と等価
     です。‘unlink’ の名前は伝統的な Unix の関数名です。詳細は
     ‘remove()’ のドキュメントを参照してください。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1e84.
     ‘os.remove’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.utime (path, times=None, *[, ns], dir_fd=None,
          follow_symlinks=True)

     'path' で指定されたファイルに最終アクセス時刻および最終修正時刻を設
     定します。

     *note utime(): 14b7. は 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 a real number expressing
          seconds, rounded down to nanoseconds.

        - 'times' が ‘None’ で、 'ns' が指定されていない場合、これは両方
          の時間を現在時刻として ‘ns=(atime_ns, mtime_ns)’ を指定するこ
          とと等価です。

     'times' と 'ns' の両方にタプルが指定されるとエラーになります。

     ここで設定した時刻が、後に *note stat(): 4fc. の呼び出し時正確に返
     されない場合があります。これはオペレーティングシステムが記録するア
     クセスおよび修正時刻の精度に依存しています; ‘stat()’ を参照してくだ
     さい。正確な時刻を保持する最善の方法は、*note utime(): 14b7. で
     'ns' 引数を指定し、‘os.stat()’ の返り値オブジェクトから
     'st_atime_ns' および 'st_mtime_ns' フィールドを使用することです。

     この関数は *note ファイル記述子の指定: f1d. 、 *note
     ディレクトリ記述子への相対パス: 14ab. 、および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

     引数 ‘path’, ‘times’, ‘ns’, ‘dir_fd’ を指定して *note 監査イベント:
     1e84. ‘os.utime’ を送出します。

     バージョン 3.3 で変更: 'path' にオープンしているファイル記述子の指
     定のサポート、および引数 'dir_fd', 'follow_symlinks', 'ns' を追加し
     ました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.15 で変更: Accepts any real numbers as 'times', not
     only integers or floats.

 -- の関数: 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: 1d3c. やスライスを使った代入で )
     変更でき、 *note walk(): 8be. は 'dirnames' に残っているサブディレ
     クトリ内のみを再帰します。これにより、検索を省略したり、特定の訪問
     順序を強制したり、呼び出し側が ‘walk()’ を再開する前に、呼び出し側
     が作った、または名前を変更したディレクトリを、 ‘walk()’ に知らせた
     りすることができます。 'topdown' が ‘False’ のときに 'dirnames' を
     変更しても効果はありません。ボトムアップモードでは 'dirpath' 自身が
     生成される前に 'dirnames' 内のディレクトリの情報が生成されるからで
     す。

     デフォルトでは、 *note scandir(): e27. 呼び出しからのエラーは無視さ
     れます。オプション引数の 'onerror' を指定する場合は関数でなければな
     りません ; この関数は単一の引数として *note OSError: 543. インスタ
     ンスを伴って呼び出されます。この関数でエラーを報告して走査を継続し
     たり、例外を送出して走査を中止したりできます。ファイル名は例外オブ
     ジェクトの ‘filename’ 属性として利用できます。

     デフォルトでは、 *note walk(): 8be. はディレクトリへのシンボリック
     リンクをたどりません。 'followlinks' に ‘True’ を指定すると、ディレ
     クトリへのシンボリックリンクをサポートしているシステムでは、シンボ
     リックリンクの指しているディレクトリを走査します。

          注釈: 'followlinks' に ‘True’ を指定すると、シンボリックリンク
          が親ディレクトリを指していた場合に、無限ループになることに注意
          してください。 *note walk(): 8be. はすでにたどったディレクトリ
          を管理したりはしません。

          注釈: 相対パスを渡した場合、 *note walk(): 8be. が再開されるま
          での間に現在の作業ディレクトリを変更しないでください。
          ‘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(): 33d. の単純な実装) では、ツリーをボ
     トムアップで走査することが不可欠になります; *note rmdir(): 14b4. は
     ディレクトリが空になるまで削除を許さないからです:

          # 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
     監査イベント: 1e84. ‘os.walk’ を送出します。

     バージョン 3.5 で変更: この関数は、今では *note os.listdir(): 14bb.
     ではなく *note os.scandir(): e27. を呼び出します。これにより、
     *note os.stat(): 4fc. の呼び出し回数を削減でき、動作が高速化します
     。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os.fwalk (top='.', topdown=True, onerror=None, *,
          follow_symlinks=False, dir_fd=None)

     挙動は *note walk(): 8be. と同じですが、‘dir_fd’ をサポートし、タプ
     ル ‘(dirpath, dirnames, filenames, dirfd)’ を yield します。

     'dirpath'、'dirnames'、および 'filenames' は *note walk(): 8be. の
     出力と同じで、'dirfd' は 'dirpath' を参照するファイル記述子です。

     この関数は常に *note ディレクトリ記述子への相対パス: 14ab. および
     *note シンボリックリンクをたどらない: 14ac. をサポートしています。
     ただし、他の関数と異なり、*note fwalk(): f1c. での
     'follow_symlinks' のデフォルト値は ‘False’ になることに注意してくだ
     さい。

          注釈: *note fwalk(): f1c. はファイル記述子を yield するため、
          それらが有効なのは次のイテレートステップまでです。それ以後も保
          持したい場合は *note dup(): 1fd1. などを使って複製して使用して
          ください。

     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(): 14b4. はディレクトリが空になるまで削除を許さないから
     です

          # 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 監査イベント: 1e84. ‘os.fwalk’ を送出します。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.7 で変更: Added support for *note bytes: 1d2. 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: 12ad.

     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: 234c.: 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(): dd1.

     *note Availability: 234c.: 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(): 1152. and *note write(): 1158. with a
     buffer size of 8, *note select(): 115d, *note poll(): 274. and
     similar.  See man page ‘eventfd(2)(11)’ for more information.  By
     default, the new file descriptor is *note non-inheritable: 12ad.

     '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: 1d75, *note
     EFD_NONBLOCK: 1d76, and *note EFD_SEMAPHORE: 1d77.

     If *note EFD_SEMAPHORE: 1d77. is specified and the event counter is
     non-zero, *note eventfd_read(): 331c. returns 1 and decrements the
     counter by one.

     If *note EFD_SEMAPHORE: 1d77. is not specified and the event
     counter is non-zero, *note eventfd_read(): 331c. returns the
     current event counter value and resets the counter to zero.

     If the event counter is zero and *note EFD_NONBLOCK: 1d76. is not
     specified, *note eventfd_read(): 331c. blocks.

     *note eventfd_write(): 331d. 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: 234c.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.10.

 -- の関数: os.eventfd_read (fd)

     Read value from an *note eventfd(): bf5. file descriptor and return
     a 64 bit unsigned int.  The function does not verify that 'fd' is
     an ‘eventfd()’.

     *note Availability: 234c.: Linux >= 2.6.27

     Added in version 3.10.

 -- の関数: os.eventfd_write (fd, value)

     Add value to an *note eventfd(): bf5. file descriptor.  'value'
     must be a 64 bit unsigned int.  The function does not verify that
     'fd' is an ‘eventfd()’.

     *note Availability: 234c.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_CLOEXEC

     Set close-on-exec flag for new *note eventfd(): bf5. file
     descriptor.

     *note Availability: 234c.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_NONBLOCK

     Set *note O_NONBLOCK: 11f2. status flag for new *note eventfd():
     bf5. file descriptor.

     *note Availability: 234c.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_SEMAPHORE

     Provide semaphore-like semantics for reads from an *note eventfd():
     bf5. file descriptor.  On read the internal counter is decremented
     by one.

     *note Availability: 234c.: 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/statx(2)

   (10) https://manpages.debian.org/statx(2)

   (11) 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(): 1152.

        - *note select(): 115d.

        - *note poll(): 274.

     The file descriptor's *note read(): 1152. 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: 32e. by
     ‘int.from_bytes(x, byteorder=sys.byteorder)’.

     *note select(): 115d. and *note poll(): 274. can be used to wait
     until timer expires and the file descriptor is readable.

     'clockid' must be a valid *note clock ID: 331f, as defined in the
     *note time: f7. module:

        - *note time.CLOCK_REALTIME: a8e.

        - *note time.CLOCK_MONOTONIC: a8d.

        - *note time.CLOCK_BOOTTIME: f51. (Since Linux 3.15 for
          timerfd_create)

     If 'clockid' is *note time.CLOCK_REALTIME: a8e, 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: 730.

     If 'clockid' is *note time.CLOCK_MONOTONIC: a8d, 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: f51, same as *note
     time.CLOCK_MONOTONIC: a8d. 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: 72d.

        - *note TFD_CLOEXEC: 72e.

     If *note TFD_NONBLOCK: 72d. is not set as a flag, *note read():
     1152. 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: 543.
     with ‘errno’ is set to *note errno.EAGAIN: 2911.

     *note TFD_CLOEXEC: 72e. is always set by Python automatically.

     The file descriptor must be closed with *note os.close(): f35. when
     it is no longer needed, or else the file descriptor will be leaked.

     参考
     ....

     The ‘timerfd_create(2)(1)’ man page.

     *note Availability: 234c.: 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():
     72a.

     '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: 72f.

        - *note TFD_TIMER_CANCEL_ON_SET: 730.

     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: 543.
     exception with ‘errno’ set to *note errno.EINVAL: 1fe0.

     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: 72f. flag is set, the
     timer will fire when the timer's clock (set by 'clockid' in *note
     timerfd_create(): 728.) reaches 'initial' seconds.

     The timer's interval is set by the 'interval' real number.  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: 543. with ‘errno’ set to *note errno.EINVAL: 1fe0.

     If the *note TFD_TIMER_CANCEL_ON_SET: 730. flag is set along with
     *note TFD_TIMER_ABSTIME: 72f. and the clock for this timer is *note
     time.CLOCK_REALTIME: a8e, 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: 234c.: 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(): 729, but use time as
     nanoseconds.  This function operates the same interval timer as
     ‘timerfd_settime()’.

     *note Availability: 234c.: 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: 72f. 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: 234c.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- の関数: os.timerfd_gettime_ns (fd, /)

     Similar to *note timerfd_gettime(): 72b, but return time as
     nanoseconds.

     *note Availability: 234c.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- データ: os.TFD_NONBLOCK

     A flag for the *note timerfd_create(): 728. function, which sets
     the *note O_NONBLOCK: 11f2. status flag for the new timer file
     descriptor.  If *note TFD_NONBLOCK: 72d. is not set as a flag,
     *note read(): 1152. blocks.

     *note Availability: 234c.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- データ: os.TFD_CLOEXEC

     A flag for the *note timerfd_create(): 728. function, If *note
     TFD_CLOEXEC: 72e. is set as a flag, set close-on-exec flag for new
     file descriptor.

     *note Availability: 234c.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- データ: os.TFD_TIMER_ABSTIME

     A flag for the *note timerfd_settime(): 729. and *note
     timerfd_settime_ns(): 72a. 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: 234c.: 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(): 729. and *note
     timerfd_settime_ns(): 72a. functions along with *note
     TFD_TIMER_ABSTIME: 72f.  The timer is cancelled when the time of
     the underlying clock changes discontinuously.

     *note Availability: 234c.: 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: 1013. interface).  If it is
     str, it is encoded with the filesystem encoding.

     この関数は *note ファイル記述子の指定: f1d. および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

     引数 ‘path’, ‘attribute’ を指定して *note 監査イベント: 1e84.
     ‘os.getxattr’ を送出します。

     バージョン 3.6 で変更: 'path' と 'attribute' が *note path-like
     object: 7a5. を受け付けるようになりました。

 -- の関数: os.listxattr (path=None, *, follow_symlinks=True)

     'path' の拡張ファイルシステム属性のリストを返します。リスト内の属性
     はファイルシステムのエンコーディングでデコードされた文字列で表され
     ます。'path' が ‘None’ の場合、*note listxattr(): 14c6. はカレント
     ディレクトリを調べます。

     この関数は *note ファイル記述子の指定: f1d. および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

     引数 ‘path’ を指定して *note 監査イベント: 1e84. ‘os.listxattr’ を
     送出します。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.15 で変更: ‘os.listxattr(-1)’ now fails with
     ‘OSError(errno.EBADF)’ rather than listing extended attributes of
     the current directory.

 -- の関数: 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: 1013. interface).  If it is a string, it is
     encoded with the *note filesystem encoding and error handler: 94d.

     この関数は *note ファイル記述子の指定: f1d. および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

     引数 ‘path’, ‘attribute’ を指定して *note 監査イベント: 1e84.
     ‘os.removexattr’ を送出します。

     バージョン 3.6 で変更: 'path' と 'attribute' が *note path-like
     object: 7a5. を受け付けるようになりました。

 -- の関数: 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: 1013.
     interface).  If it is a str, it is encoded with the *note
     filesystem encoding and error handler: 94d.  'flags' may be *note
     XATTR_REPLACE: 3321. or *note XATTR_CREATE: 3322.  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 ファイル記述子の指定: f1d. および *note
     シンボリックリンクをたどらない: 14ac. をサポートしています。

          注釈: Linux カーネル 2.6.39 以前では、バグのため一部のファイル
          システムで引数 flags が無視されます。

     引数 ‘path’, ‘attribute’, ‘value’, ‘flags’ を指定して *note
     監査イベント: 1e84. ‘os.setxattr’ を送出します。

     バージョン 3.6 で変更: 'path' と 'attribute' が *note path-like
     object: 7a5. を受け付けるようになりました。

 -- データ: os.XATTR_SIZE_MAX

     拡張属性の値にできる最大サイズです。現在、Linux では 64 キロバイト
     です。

 -- データ: os.XATTR_CREATE

     *note setxattr(): 14c8. の引数 flags に指定できる値です。その操作で
     属性を作成しなければならないことを意味します。

 -- データ: os.XATTR_REPLACE

     *note setxattr(): 14c8. の引数 flags に指定できる値です。その操作で
     既存の属性を置き換えなければならないことを意味します。


File: python.info,  Node: プロセス管理,  Next: スケジューラーへのインターフェイス,  Prev: ファイルとディレクトリ,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.17.1.11 プロセス管理
......................

以下の関数はプロセスの生成や管理に利用できます。

さまざまな *note exec*: 3326. 関数は、プロセス内にロードされる新しいプロ
グラムに与えるための、引数のリストを取ります。どの関数の場合でも、新しい
プログラムに渡されるリストの最初の引数は、ユーザがコマンドラインで入力す
る引数ではなく、そのプログラム自体の名前です。 C プログラマならば、プロ
グラムの ‘main()’ に渡される ‘argv[0]’ だと考えれば良いでしょう。たとえ
ば、 ‘os.execv('/bin/echo', ['foo', 'bar'])’ が標準出力に出力するのは
‘bar’ だけで、 ‘foo’ は無視されたかのように見えることになります。

 -- の関数: os.abort ()

     Generate a *note SIGABRT: 1439. 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(): 14f5.

 -- の関数: 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: 19f.), and also by *note ctypes: 2d.

     Remove the directory by calling 'close()' on the returned object or
     using it in a *note with: 215. statement.

     See the Microsoft documentation(1) for more information about how
     DLLs are loaded.

     引数 ‘path’ を指定して *note 監査イベント: 1e84.
     ‘os.add_dll_directory’ を送出します。

     *note Availability: 234c.: 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: e68. 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:
     543. 例外として報告されます。

     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(): 1a1a.
     or *note os.fsync(): 114b. before calling an *note exec*: 3326.
     function.

     The "l" and "v" variants of the *note exec*: 3326. 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():
     3329, *note execlpe(): 332a, *note execvp(): 332b, and *note
     execvpe(): 332c.) will use the ‘PATH’ environment variable to
     locate the program 'file'.  When the environment is being replaced
     (using one of the *note exec*e: 3326. variants, discussed in the
     next paragraph), the new environment is used as the source of the
     ‘PATH’ variable.  The other variants, ‘execl()’, *note execle():
     3328, *note execv(): 3254, and *note execve(): 14ba, 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(): 3328. 、 *note execlpe(): 332a. 、 *note execve():
     14ba. 、および *note execvpe(): 332c. (すべて末尾に "e" がついてい
     ます) では、 'env' 引数は新たなプロセスで利用される環境変数を定義す
     るためのマップ型でなくてはなりません ( 現在のプロセスの環境変数の代
     わりに利用されます ); *note execl(): 3326. 、 *note execlp(): 3329.
     、 *note execv(): 3254. 、および *note execvp(): 332b. では、すべて
     新たなプロセスは現在のプロセスの環境を引き継ぎます。

     一部のプラットフォームの *note execve(): 14ba. では、'path' はオー
     プンしているファイル記述子で指定することもできます。この機能をサポ
     ートしていないプラットフォームもあります; *note os.supports_fd:
     14be. を使うことで利用可能かどうか調べることができます。利用できな
     い場合、*note NotImplementedError: 5a1. が送出されます。

     引数 ‘path’, ‘args’, ‘env’ を指定して *note 監査イベント: 1e84.
     ‘os.exec’ を送出します。

     *note Availability: 234c.: Unix, Windows, not WASI, not Android,
     not iOS.

     バージョン 3.3 で変更: Added support for specifying 'path' as an
     open file descriptor for *note execve(): 14ba.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: os._exit (n)

     終了ステータス 'n' でプロセスを終了します。この時クリーンアップハン
     ドラーの呼び出しや、標準入出力バッファのフラッシュなどは行いません
     。

          注釈: The standard way to exit is *note sys.exit(n): 506.
          ‘_exit()’ should normally only be used in the child process
          after a *note fork(): 6c3.

以下の終了コードは必須ではありませんが *note _exit(): 290d. で使うことが
できます。一般に、メールサーバーの外部コマンド配送プログラムのような、
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: 234c.: Unix, Windows.

 -- データ: os.EX_USAGE

     誤った個数の引数が渡された時など、コマンドが間違って使われたことを
     表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_DATAERR

     入力データが誤っていたことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_NOINPUT

     入力ファイルが存在しなかった、または、読み込み不可だったことを表す
     終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_NOUSER

     指定されたユーザーが存在しなかったことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_NOHOST

     指定されたホストが存在しなかったことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_UNAVAILABLE

     要求されたサービスが利用できないことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_SOFTWARE

     内部ソフトウェアエラーが検出されたことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_OSERR

     fork できない、 pipe の作成ができないなど、オペレーティングシステム
     のエラーが検出されたことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_OSFILE

     システムファイルが存在しなかった、開けなかった、あるいはその他のエ
     ラーが起きたことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_CANTCREAT

     ユーザーには作成できない出力ファイルを指定したことを表す終了コード
     。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_IOERR

     ファイルの I/O を行っている途中にエラーが発生した時の終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_TEMPFAIL

     一時的な失敗が発生したことを表す終了コード。これは、再試行可能な操
     作の途中に、ネットワークに接続できないというような、実際にはエラー
     ではないかも知れないことを意味します。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_PROTOCOL

     プロトコル交換が不正、不適切、または理解不能なことを表す終了コード
     。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_NOPERM

     操作を行うために十分な許可がなかった（ファイルシステムの問題を除く
     ）ことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_CONFIG

     設定エラーが起こったことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- データ: os.EX_NOTFOUND

     "an entry was not found" のようなことを表す終了コード。

     *note Availability: 234c.: Unix, not WASI.

 -- の関数: os.fork ()

     子プロセスを fork します。子プロセスでは ‘0’ が返り、親プロセスでは
     子プロセスの id が返ります。エラーが発生した場合は、 *note OSError:
     543. を送出します。

     FreeBSD 6.3 以下、Cygwinを含む一部のプラットフォームにおいて、
     ‘fork()’ をスレッド内から利用した場合に既知の問題があることに注意し
     てください。

     引数無しで *note 監査イベント: 1e84. ‘os.fork’ を送出します。

          警告: If you use TLS sockets in an application calling
          ‘fork()’, see the warning in the *note ssl: d8. 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: 114.

     バージョン 3.8 で変更: Calling ‘fork()’ in a subinterpreter is no
     longer supported (*note RuntimeError: 317. is raised).

     バージョン 3.12 で変更: If Python is able to detect that your
     process has multiple threads, *note os.fork(): 6c3. now raises a
     *note DeprecationWarning: 2d4.

     We chose to surface this as a warning, when detectable, to better
     inform developers of a design problem that the POSIX platform
     specifically notes as not supported.  Even in code that 'appears'
     to work, it has never been safe to mix threading with *note
     os.fork(): 6c3. 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: 234c.: POSIX, not WASI, not Android, not iOS.

 -- の関数: os.forkpty ()

     子プロセスを fork します。この時新しい擬似端末を子プロセスの制御端
     末として使います。親プロセスでは ‘(pid, fd)’ からなるペアが返り、
     'fd' は擬似端末のマスター側のファイル記述子となります。可搬性のある
     アプローチを取るには、 *note pty: b9. モジュールを利用してください
     。エラーが発生した場合は、 *note OSError: 543. を送出します。

     The returned file descriptor 'fd' is *note non-inheritable: 12ad.

     引数無しで *note 監査イベント: 1e84. ‘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: 114.

     バージョン 3.8 で変更: Calling ‘forkpty()’ in a subinterpreter is
     no longer supported (*note RuntimeError: 317. is raised).

     バージョン 3.12 で変更: If Python is able to detect that your
     process has multiple threads, this now raises a *note
     DeprecationWarning: 2d4.  See the longer explanation on *note
     os.fork(): 6c3.

     バージョン 3.15 で変更: The returned file descriptor is now made
     non-inheritable.

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.kill (pid, sig, /)

     プロセス 'pid' にシグナル 'sig' を送ります。ホストプラットフォーム
     で利用可能なシグナルを特定する定数は *note signal: ce. モジュールで
     定義されています。

     Windows: The *note signal.CTRL_C_EVENT: 1722. and *note
     signal.CTRL_BREAK_EVENT: 1723. 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(): 14f2. も参照してください。

     引数 ‘pid’, ‘sig’ を指定して *note 監査イベント: 1e84. ‘os.kill’ を
     送出します。

     *note Availability: 234c.: Unix, Windows, not WASI, not iOS.

     バージョン 3.2 で変更: Windows サポートを追加しました。

 -- の関数: os.killpg (pgid, sig, /)

     プロセスグループ 'pgid' にシグナル 'sig' を送ります。

     引数 ‘pgid’, ‘sig’ を指定して *note 監査イベント: 1e84. ‘os.killpg’
     を送出します。

     *note Availability: 234c.: Unix, not WASI, not iOS.

 -- の関数: os.nice (increment, /)

     プロセスの "nice 値 " に 'increment' を加えます。新たな nice 値を返
     します。

     *note Availability: 234c.: 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: 234c.: Linux >= 5.3, Android >= *note
     build-time: f4d. 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: 2911. rather than blocking.

     *note Availability: 234c.: Linux >= 5.10

     Added in version 3.12.

 -- の関数: os.pidfd_getfd (pidfd, targetfd, *, flags=0)

     Duplicate 'targetfd' from the process referred to by the process
     file descriptor 'pidfd', into the calling process.  The returned
     file descriptor is *note non-inheritable: 12ad.

     'flags' is reserved, and currently must be ‘0’.

     See the ‘pidfd_getfd(2)(5)’ man page for more details.

     *note Availability: 234c.: Linux >= 5.6, Android >= *note
     build-time: f4d. API level 31

     Added in version 3.16.0a0 (unreleased).

 -- の関数: os.plock (op, /)

     プログラムのセグメントをメモリ内にロックします。 'op'
     (‘<sys/lock.h>’ で定義されています ) にはどのセグメントをロックする
     かを指定します。

     *note Availability: 234c.: Unix, not WASI, not iOS.

 -- の関数: os.popen (cmd, mode='r', buffering=-1)

     コマンド 'cmd' への、または 'cmd' からのパイプ入出力を開きます。戻
     り値はパイプに接続されている開かれたファイルオブジェクトで、 'mode'
     が ‘'r'’ (デフォルト) または ‘'w'’ かによって読み出しまたは書き込み
     を行うことができます。引数 'bufsize' は、組み込み関数 *note open():
     333. における対応する引数と同じ意味を持ちます。 返されるファイルオ
     ブジェクトは、バイトではなくテキスト文字列を読み書きします。

     ‘close’ メソッドは、サブプロセスが正常に終了した場合は *note None:
     a6a. を返し、エラーが発生した場合にはサブプロセスの返りコードを返し
     ます。POSIX システムでは、返りコードが正の場合、そのコードは1バイト
     左にシフトしてプロセスが終了したことを示します。返りコードが負の場
     合、プロセスは返りコードの符号を変えた信号により終了します 。 (例え
     ば、サブプロセスが kill された場合、返り値は ‘- signal.SIGKILL’ と
     なる場合があります。) Windows システムでは、返り値には子プロセスか
     らの符号のついた整数の返りコードを含まれます。

     On Unix, *note waitstatus_to_exitcode(): cee. 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: 6c5. を使用して実装されています。サ
     ブプロセスを管理し、サブプロセスと通信を行うためのより強力な方法に
     ついては、クラスのドキュメンテーションを参照してください。

     *note Availability: 234c.: not WASI, not Android, not iOS.

          注釈: The *note Python UTF-8 Mode: a4b. affects encodings used
          for 'cmd' and pipe contents.

          ‘popen()’ is a simple wrapper around *note subprocess.Popen:
          6c5.  Use ‘subprocess.Popen’ or *note subprocess.run(): f49.
          to control options like encodings.

     *note Soft deprecated: 1b2. since version 3.14: The *note
     subprocess: df. 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(): 736. ではなく、 *note
     subprocess.run(): f49. を使うべきです。

     The positional-only arguments 'path', 'args', and 'env' are similar
     to *note execve(): 14ba.  'env' is allowed to be ‘None’, in which
     case current process' environment is used.

     'path' には実行ファイルへのパスを指定します。 'path' はディレクトリ
     を含む形（実行ファイルへの絶対パスまたは相対パス）で指定する必要が
     あります。実行ファイル名のみを指定したい場合は *note
     posix_spawnp(): 196a. を使ってください。

     '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: 5a1. 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: 1b4a. 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 監査イベント: 1e84.
     ‘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: 234c.: 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(): 736. 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 監査イベント: 1e84.
     ‘os.posix_spawn’ を送出します。

     Added in version 3.8.

     *note Availability: 234c.: POSIX, not WASI, not Android, not iOS.

     See *note posix_spawn(): 736. 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(): 6c3. 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: df. 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(): f81, *note PyOS_AfterFork_Parent(): f82. and
     *note PyOS_AfterFork_Child(): 64a.

     There is no way to unregister a function.

     *note Availability: 234c.: 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: df. モジュールが、新しいプロセスを実行して結果を
     取得するための、より強力な機能を提供しています。この関数の代わりに
     ‘subprocess’ モジュールを利用することが推奨されています。
     ‘subprocess’ モジュールのドキュメントの、 *note Replacing Older
     Functions with the subprocess Module: 1546. セクションを参照してく
     ださい )

     'mode' が *note P_NOWAIT: 3349. の場合、この関数は新たなプロセスの
     プロセス ID を返します ; 'mode' が *note P_WAIT: 334a. の場合、子プ
     ロセスが正常に終了するとその終了コードが返ります。そうでない場合に
     はプロセスを kill したシグナル 'signal' に対して ‘-signal’ が返りま
     す。 Windows では、プロセス ID は実際にはプロセスハンドル値になるの
     で、 *note waitpid(): 1157. 関数で使えます。

     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(): 3343, *note spawnlpe():
     3344, *note spawnvp(): 3347, *note spawnvpe(): 3348.) は、プログラ
     ム 'file' を探すために環境変数 ‘PATH’ を利用します。環境変数が ( 次
     の段で述べる *note spawn*e: 58d. 型関数で ) 置き換えられる場合、環
     境変数は ‘PATH’ を決定する上の情報源として使われます。その他の型、
     ‘spawnl()’, *note spawnle(): 3342, *note spawnv(): 3345, および
     *note spawnve(): 3346. では、実行コードを探すために ‘PATH’ を使いま
     せん。 'path' には適切に設定された絶対パスまたは相対パスが入ってい
     なくてはなりません。

     *note spawnle(): 3342, *note spawnlpe(): 3344, *note spawnve():
     3346, および *note spawnvpe(): 3348. (すべて末尾に "e" がついていま
     す) では、 'env' 引数は新たなプロセスで利用される環境変数を定義する
     ためのマップ型でなくてはなりません ; *note spawnl(): 58d. 、 *note
     spawnlp(): 3343. 、 *note spawnv(): 3345. 、および *note spawnvp():
     3347. では、すべて新たなプロセスは現在のプロセスの環境を引き継ぎま
     す。 'env' 辞書のキーと値はすべて文字列である必要があります。不正な
     キーや値を与えると関数が失敗し、 ‘127’ を返します。

     例えば、以下の *note spawnlp(): 3343. および *note spawnvpe():
     3348. 呼び出しは等価です

          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 監査イベント:
     1e84. ‘os.spawn’ を送出します。

     *note Availability: 234c.: Unix, Windows, not WASI, not Android,
     not iOS.

     *note spawnlp(): 3343. 、 *note spawnlpe(): 3344. 、 *note
     spawnvp(): 3347. 、および *note spawnvpe(): 3348. は Windows では利
     用できません。 *note spawnle(): 3342. および *note spawnve(): 3346.
     は Windows においてスレッドセーフではありません ; 代わりに *note
     subprocess: df. モジュールの利用を推奨します。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     *note Soft deprecated: 1b2. since version 3.14: The *note
     subprocess: df. module is recommended instead.

 -- データ: os.P_NOWAIT
 -- データ: os.P_NOWAITO

     Possible values for the 'mode' parameter to the *note spawn*: 58d.
     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: 234c.: Unix, Windows.

 -- データ: os.P_WAIT

     Possible value for the 'mode' parameter to the *note spawn*: 58d.
     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: 234c.: Unix, Windows.

 -- データ: os.P_DETACH
 -- データ: os.P_OVERLAY

     *note spawn*: 58d. 関数ファミリに対する 'mode' パラメタとして取れる
     値です。これらの値は上の値よりもやや可搬性において劣っています。
     *note P_DETACH: 334c. は *note P_NOWAIT: 3349. に似ていますが、新た
     なプロセスは呼び出しプロセスのコンソールから切り離され (detach) ま
     す。 *note P_OVERLAY: 334d. が使われた場合、現在のプロセスは置き換
     えられます。したがって ‘spawn*’ は返りません。

     *note Availability: 234c.: 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(): 16d3. 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: 5a1.
     will be raised.

     引数 ‘path’, ‘operation’ を指定して *note 監査イベント: 1e84.
     ‘os.startfile’ を送出します。

     Raises an *note auditing event: 1e84. ‘os.startfile/2’ with
     arguments ‘path’, ‘operation’, ‘arguments’, ‘cwd’, ‘show_cmd’.

     *note Availability: 234c.: 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: 94f, 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(): 1155.

     Windows では、返り値は 'command' を実行した後にシステムシェルから返
     される値です。シェルは通常 ‘cmd.exe’ であり、返す値は実行したコマン
     ドの終了ステータスになります。シェルの種類は Windows の環境変数
     ‘COMSPEC’: に指定されています。ネイティブでないシェルを使用している
     場合は、そのドキュメントを参照してください。

     The *note subprocess: df. 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: 1546. section
     in the ‘subprocess’ documentation for some helpful recipes.

     On Unix, *note waitstatus_to_exitcode(): cee. can be used to
     convert the result (exit status) into an exit code.  On Windows,
     the result is directly the exit code.

     引数 ‘command’ を指定して *note 監査イベント: 1e84. ‘os.system’ を
     送出します。

     *note Availability: 234c.: 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)(6)’ and times(3)(7) manual page
     on Unix or the GetProcessTimes MSDN(8) on Windows.  On Windows,
     only ‘user’ and ‘system’ are known; the other attributes are zero.

     *note Availability: 234c.: Unix, Windows.

     バージョン 3.3 で変更: 返り値の型が、タプルから属性名のついたタプル
     ライクオブジェクトに変更されました。

 -- の関数: os.wait ()

     子プロセスの実行完了を待機し、子プロセスの pid と終了コードインジケ
     ーター -- 16 ビットの数値で、下位バイトがプロセスを kill したシグナ
     ル番号、上位バイトが終了ステータス ( シグナル番号がゼロの場合 ) --
     の入ったタプルを返します ; コアダンプファイルが生成された場合、下位
     バイトの最上桁ビットが立てられます。

     If there are no children that could be waited for, *note
     ChildProcessError: 140e. is raised.

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): cee. を使うことができます。

     *note Availability: 234c.: 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(): 1157. 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: 334e, *note P_PGID: 334f, *note P_ALL:
     3350, or (on Linux) *note P_PIDFD: ced.  The interpretation of 'id'
     depends on it; see their individual descriptions.

     'options' is an OR combination of flags.  At least one of *note
     WEXITED: 3351, *note WSTOPPED: 3352. or *note WCONTINUED: 3353. is
     required; *note WNOHANG: 3354. and *note WNOWAIT: 3355. 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: 3356.)

        * ‘si_status’ (the exit status or signal number, depending on
          ‘si_code’)

        * ‘si_code’ (see *note CLD_EXITED: 3357. for possible values)

     If *note WNOHANG: 3354. 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: 140e. is raised.

     *note Availability: 234c.: 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(): 1155. と同様にコード
     化された ) 終了ステータスインジケーターからなるタプルを返します。こ
     の関数の動作は 'options' によって変わります。通常の操作では ‘0’ に
     します。

     'pid' が ‘0’ よりも大きい場合、 *note waitpid(): 1157. は特定のプロ
     セスのステータス情報を要求します。 'pid' が ‘0’ の場合、現在のプロ
     セスグループ内の任意の子プロセスの状態に対する要求です。 'pid' が
     ‘-1’ の場合、現在のプロセスの任意の子プロセスに対する要求です。
     'pid' が ‘-1’ よりも小さい場合、プロセスグループ ‘-pid’ ( すなわち
     'pid' の絶対値 ) 内の任意のプロセスに対する要求です。

     'options' is an OR combination of flags.  If it contains *note
     WNOHANG: 3354. 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: 140e.
     is raised.  Other options that can be used are *note WUNTRACED:
     3358. and *note WCONTINUED: 3353.

     Windows では、プロセスハンドル 'pid' を指定してプロセスの終了を待っ
     て、 'pid' と、終了ステータスを 8bit 左シフトした値のタプルを返しま
     す。 ( シフトは、この関数をクロスプラットフォームで利用しやすくする
     ために行われます ) ‘0’ 以下の 'pid' は Windows では特別な意味を持っ
     ておらず、例外を発生させます。 'options' の値は効果がありません。
     'pid' は、子プロセスで無くても、プロセス ID を知っているどんなプロ
     セスでも参照することが可能です。 *note spawn*: 58d. 関数を *note
     P_NOWAIT: 3349. と共に呼び出した場合、適切なプロセスハンドルが返さ
     れます。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): cee. を使うことができます。

     *note Availability: 234c.: Unix, Windows, not WASI, not Android,
     not iOS.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: 1145. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(9) を参照してください)。

 -- の関数: os.wait3 (options)

     *note waitpid(): 1157. に似ていますが、プロセス id を引数に取らず、
     子プロセス id 、終了ステータスインジケータ、リソース使用情報の 3 要
     素からなるタプルを返します。リソース使用情報の詳しい情報は *note
     resource.getrusage(): 17e9. を参照してください。'options' 引数は
     ‘waitpid()’ および *note wait4(): 1154. に渡されるものと同じです。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): cee. を使うことができます。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.wait4 (pid, options)

     *note waitpid(): 1157. に似ていますが、子プロセス id 、終了ステータ
     スインジケータ、リソース使用情報の 3 要素からなるタプルを返します。
     リソース使用情報の詳しい情報は *note resource.getrusage(): 17e9. を
     参照してください。 *note wait4(): 1154. の引数は ‘waitpid()’ に与え
     られるものと同じです。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): cee. を使うことができます。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- データ: os.P_PID
 -- データ: os.P_PGID
 -- データ: os.P_ALL
 -- データ: os.P_PIDFD

     *note waitid(): 1156. の '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(): 273.).

     *note Availability: 234c.: 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(): 1157, *note wait3(): 1153,
     *note wait4(): 1154, and *note waitid(): 1156. causes child
     processes to be reported if they have been continued from a job
     control stop since they were last reported.

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WEXITED

     This 'options' flag for *note waitid(): 1156. 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: 234c.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

 -- データ: os.WSTOPPED

     This 'options' flag for *note waitid(): 1156. 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: 234c.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

 -- データ: os.WUNTRACED

     This 'options' flag for *note waitpid(): 1157, *note wait3(): 1153,
     and *note wait4(): 1154. 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(): 1156.

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WNOHANG

     This 'options' flag causes *note waitpid(): 1157, *note wait3():
     1153, *note wait4(): 1154, and *note waitid(): 1156. to return
     right away if no child process status is available immediately.

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WNOWAIT

     This 'options' flag causes *note waitid(): 1156. 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: 234c.: 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(): 1156. の返り値の ‘si_code’ に設定され得る値です。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

     バージョン 3.9 で変更: *note CLD_KILLED: ceb. と *note CLD_STOPPED:
     cec. が追加されました。

 -- の関数: os.waitstatus_to_exitcode (status)

     待機ステータスを終了コードに変換します。

     Unix の場合:

        * 子プロセスが正常終了した場合 (‘WIFEXITED(status)``が真の場合
          )、子プロセスの終了ステータス (``WEXITSTATUS(status)’) を返し
          ます: 戻り値は0または正の整数です。

        * 子プロセスがシグナルによって終了した場合
          (‘WIFSIGNALED(status)``が真の場合)、子プロセスを終了したシグナ
          ルの番号に負符号をつけた ``-signum’ (‘-WTERMSIG(status)’) を返
          します: 戻り値は負の整数です。

        * それ以外の場合、 *note ValueError: 15a. 例外を送出します。

     Windows の場合、 'status' を8ビット右にシフトした値を返します。

     Unix の場合、プロセスがトレースされているか *note waitpid(): 1157.
     が *note WUNTRACED: 3358. オプションをつけて実行されている場合、呼
     び出しもとは最初に ‘WIFSTOPPED(status)’ が真であるかを確認しなけれ
     ばなりません。この関数は ‘WIFSTOPPED(status)’ が真の場合呼び出して
     はいけません。

     参考
     ....

     *note WIFEXITED(): 335c, *note WEXITSTATUS(): 335d, *note
     WIFSIGNALED(): 335e, *note WTERMSIG(): 335f, *note WIFSTOPPED():
     3360, *note WSTOPSIG(): 3361. 関数。

     *note Availability: 234c.: Unix, Windows, not WASI, not Android,
     not iOS.

     Added in version 3.9.

以下の関数は *note system(): 1815. 、 *note wait(): 1155. 、あるいは
*note waitpid(): 1157. が返すプロセス状態コードを引数にとります。これら
の関数はプロセスの配置を決めるために利用できます。

 -- の関数: os.WCOREDUMP (status, /)

     プロセスに対してコアダンプが生成されていた場合には ‘True’ を、それ
     以外の場合は ‘False’ を返します。

     この関数は *note WIFSIGNALED(): 335e. が真である場合のみ使用される
     べきです。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFCONTINUED (status)

     Return ‘True’ if a stopped child has been resumed by delivery of
     *note SIGCONT: 3364. (if the process has been continued from a job
     control stop), otherwise return ‘False’.

     *note WCONTINUED: 3353. オプションを参照してください。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFSTOPPED (status)

     プロセスがシグナルの送信によって中断させられた場合に ‘True’ を返し
     ます。それ以外の場合は ‘False’ を返します。

     *note WIFSTOPPED(): 3360. は *note waitpid(): 1157. が *note
     WUNTRACED: 3358. オプションを使って実行されたか、もしくはプロセスが
     トレースされている場合 (‘ptrace(2)(10)’ を参照してください) にのみ
     ‘True’ を返します。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFSIGNALED (status)

     プロセスがシグナルによって終了させられた場合に ‘True’ を返します。
     そうでない場合は ‘False’ を返します。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFEXITED (status)

     プロセスが正常終了した場合、すなわち ‘exit()’ や ‘_exit()’ を呼び出
     したか、もしくは ‘main()’ から戻ることにより終了した場合に ‘True’ を
     返します。それ以外は ‘False’ を返します。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WEXITSTATUS (status)

     プロセスの終了ステータスを返します。

     この関数は *note WIFEXITED(): 335c. が真である場合のみ使用されるべ
     きです。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WSTOPSIG (status)

     プロセスを停止させたシグナル番号を返します。

     この関数は *note WIFSTOPPED(): 3360. が真である場合のみ使用されるべ
     きです。

     *note Availability: 234c.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WTERMSIG (status)

     プロセスを終了させたシグナルの番号を返します。

     この関数は *note WIFSIGNALED(): 335e. が真である場合のみ使用される
     べきです。

     *note Availability: 234c.: 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/pidfd_getfd(2)

   (6) https://manpages.debian.org/times(2)

   (7) https://man.freebsd.org/cgi/man.cgi?time(3)

   (8) 
https://docs.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes

   (9) https://peps.python.org/pep-0475/

   (10) 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: 3367.

     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(): 14d0.、*note
     sched_setscheduler(): 14d1.、および *note sched_getparam(): 14cc. で
     使用される、調節可能なスケジューリングパラメーターを表します。これ
     はイミュータブルです。

     現在、一つの引数のみ指定できます:

      -- の属性: 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: 1b4a. のインスタンスです。

 -- の関数: os.sched_getscheduler (pid, /)

     PID 'pid' のプロセスのスケジューリングポリシーを返します。'pid' が
     0 の場合、呼び出しプロセスを意味します。返り値は上記のスケジューリ
     ングポリシー定数の一つになります。

 -- の関数: os.sched_setparam (pid, param, /)

     PID 'pid' を持つプロセスのスケジューリングパラメータを設定します。
     'pid' を 0 とした場合呼び出しプロセスを意味します。 'param' は
     *note sched_param: 1b4a. インスタンスです。

 -- の関数: os.sched_getparam (pid, /)

     PID 'pid' のプロセスのスケジューリングパラメーターを *note
     sched_param: 1b4a. のインスタンスとして返します。'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(): 6e6. 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: 15a. を送出し
     ます。 'name' の指定値がホストシステムでサポートされておらず、
     ‘confstr_names’ にも入っていない場合、 *note errno.EINVAL: 1fe0. を
     エラー番号として *note OSError: 543. を送出します。

     *note Availability: 234c.: Unix.

 -- データ: os.confstr_names

     *note confstr(): 1b2b. が受理する名前を、ホストオペレーティングシス
     テムで定義されている整数値に対応付けている辞書です。この辞書はシス
     テムでどの設定名が定義されているかを決定するために利用できます。

     *note Availability: 234c.: Unix.

 -- の関数: os.cpu_count ()

     Return the number of logical CPUs in the 'system'.  Returns ‘None’
     if undetermined.

     The *note process_cpu_count(): 6e6. 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: 183. is given or
     *note PYTHON_CPU_COUNT: 727. is set, ‘cpu_count()’ returns the
     override value 'n'.

 -- の関数: os.getloadavg ()

     過去 1 分、 5 分、および 15 分間の、システムの実行キューの平均プロ
     セス数を返します。平均負荷が得られない場合には *note OSError: 543.
     を送出します。

     *note Availability: 234c.: 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(): 6e7. depending on the CPU affinity.

     The *note cpu_count(): 6e7. function can be used to get the number
     of logical CPUs in the 'system'.

     If *note -X cpu_count: 183. is given or *note PYTHON_CPU_COUNT:
     727. is set, ‘process_cpu_count()’ returns the override value 'n'.

     See also the *note sched_getaffinity(): 14cb. function.

     Added in version 3.13.

 -- の関数: os.sysconf (name, /)

     整数値のシステム設定値を返します。 'name' で指定された設定値が定義
     されていない場合、 ‘-1’ が返されます。 'name' に関するコメントとし
     ては、 *note confstr(): 1b2b. で述べた内容が同様に当てはまります ;
     既知の設定名についての情報を与える辞書は ‘sysconf_names’ で与えられ
     ています。

     *note Availability: 234c.: Unix.

 -- データ: os.sysconf_names

     *note sysconf(): 1b2c. が受理する名前を、ホストオペレーティングシス
     テムで定義されている整数値に対応付けている辞書です。この辞書はシス
     テムでどの設定名が定義されているかを決定するために利用できます。

     *note Availability: 234c.: 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(): 2e82. や *note os.path.join(): 1a62. を使用してく
     ださい -- が、たまに便利なこともあります。 *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*: 3326. や *note spawn*p*: 58d. において、環境変数辞書
     内に ‘'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(): 14e0. 関数と *note getdlopenflags(): 18c6.
     関数と一緒に使用するフラグ。それぞれのフラグの意味については、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: 3375. and
     *note GRND_NONBLOCK: 3376.

     Linux getrandom() manual page(1) も参照してください。

     *note Availability: 234c.: 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: 3376. フラグを
     使って) 非ブロッキングモードでランダムなバイトを取得したり、システ
     ムの urandom エントロピープールが初期化されるまでポーリングするため
     に *note getrandom(): 107f. 関数を利用することができます。

     Unix ライクなシステムでは、ランダムなバイトは ‘/dev/urandom’ デバイ
     スから読み込みます。 ‘/dev/urandom’ デバイスが利用できないか、もし
     くは読み取り不可のときは、 *note NotImplementedError: 5a1. 例外が送
     出されます。

     Windowsで、 ‘BCryptGenRandom()’ を使用します。

     参考
     ....

     *note secrets: c8. モジュールは高レベルの乱数生成機能を提供します。
     プラットフォームが提供する乱数生成器に対する簡便なインターフェース
     については、 *note random.SystemRandom: 2d8b. を参照してください。

     バージョン 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(): 107f. は ‘/dev/random’ から読み
     込んだときにランダムなバイトが存在しない場合や、 ‘/dev/urandom’ か
     ら読み込んだときにエントロピープールが初期化されていない場合に処理
     をブロックします。

     *note GRND_NONBLOCK: 3376. フラグがセットされると、 *note
     getrandom(): 107f. はこれらの場合に処理をブロックせず、ただちに
     *note BlockingIOError: 4ca. 例外を送出します。

     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/main/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:
1581.  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: 1ea. object to the ‘write()’ method of a
binary stream will raise a *note TypeError: 29c.  So will giving a *note
bytes: 1d2. object to the ‘write()’ method of a text stream.

バージョン 3.3 で変更: 以前 *note IOError: 1409. を送出していた操作が
*note OSError: 543. を送出するようになりました。 ‘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: 1ea. オブジェクトを受け取り、生成します。す
なわち、背後にあるストレージがバイト列 (例えばファイルなど) を格納すると
きは常に、透過的にデータのエンコード・デコードを行ない、オプションでプラ
ットフォーム依存の改行文字変換を行います。

テキストストリームを作る一番簡単な方法は、オプションでエンコーディングを
指定して、 *note open(): 333. を利用することです:

     f = open("myfile.txt", "r", encoding="utf-8")

*note StringIO: 12d8. オブジェクトはインメモリーのテキストストリームです
:

     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:
     4ca. if the stream cannot perform the operation immediately.

テキストストリームの API は *note TextIOBase: a89. のドキュメントで詳し
く解説します。


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
オブジェクト: 43d. を受け取り *note bytes: 1d2. オブジェクトを生成します
。エンコード、デコード、改行文字変換は一切行いません。このカテゴリのスト
リームは全ての非テキストデータや、テキストデータの扱いを手動で管理したい
場合に利用することができます。

バイナリーストリームを生成する一番簡単な方法は、 *note open(): 333. の
mode 文字列に ‘'b'’ を指定することです:

     f = open("myfile.jpg", "rb")

*note BytesIO: 1258. はインメモリーのバイナリストリームです:

     f = io.BytesIO(b"some initial binary data: \x00\x01")

バイナリーストリーム API は *note BufferedIOBase: a88. のドキュメントで
詳しく解説します。

他のライブラリモジュールが、別のテキスト・バイナリーストリームを生成する
方法を提供しています。例えば *note socket.socket.makefile(): 155d. など
です。


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: 1490. のドキュメントで詳しく解説
します。


File: python.info,  Node: Text Encoding,  Next: 高水準のモジュールインターフェイス,  Prev: 概要<2>,  Up: io --- ストリームを扱うコアツール

5.17.2.5 Text Encoding
......................

The default encoding of *note TextIOWrapper: ba0. and *note open(): 333.
is locale-specific (*note locale.getencoding(): a4a.).

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: a4b.

     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: a4b. 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: 183. command line option or set the
*note PYTHONWARNDEFAULTENCODING: ba1. environment variable, which will
emit an *note EncodingWarning: 233c. when the default encoding is used.

If you are providing an API that uses *note open(): 333. or *note
TextIOWrapper: ba0. and passes ‘encoding=None’ as a parameter, you can
use *note text_encoding(): 1c63. so that callers of the API will emit an
*note EncodingWarning: 233c. 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(): 333. は file
     の blksize (*note os.stat(): 4fc. で取得される) を利用します。

 -- の関数: io.open (file, mode='r', buffering=-1, encoding=None,
          errors=None, newline=None, closefd=True, opener=None)

     組み込みの *note open(): 333. 関数のエイリアスです。

     This function raises an *note auditing event: 1e84. ‘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: 1ea. and an absolute path.

     The behavior of this function may be overridden by an earlier call
     to the *note PyFile_SetOpenCodeHook(): 1cbd.  However, assuming
     that 'path' is a *note str: 1ea. 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(): 333.
     or *note TextIOWrapper: ba0. 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:
     a4b.

     This function emits an *note EncodingWarning: 233c. if *note
     sys.flags.warn_default_encoding: a81. 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: 233c. is emitted for the
     caller of ‘read_text()’.

     See *note Text Encoding: ba2. 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: 4ca. 例外のエイリ
     アスです。

 -- 例外: io.UnsupportedOperation

     *note OSError: 543. と *note ValueError: 15a. を継承した例外です。
     ストリームがサポートしていない操作を行おうとした時に送出されます。

参考
....

*note sys: e2.

     標準 IO ストリームを持っています: *note sys.stdin: 94f, *note
     sys.stdout: ea0, *note sys.stderr: d09.。


File: python.info,  Node: クラス階層,  Next: Static Typing,  Prev: 高水準のモジュールインターフェイス,  Up: io --- ストリームを扱うコアツール

5.17.2.8 クラス階層
...................

I/O ストリームの実装はクラス階層に分けて整理されています。まずストリーム
のカテゴリを分類するための *note 抽象基底クラス: 1574. (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: a88.
     provides unoptimized implementations of ‘readinto()’ and
     ‘readline()’.

I/O 階層の最上位には抽象基底クラスの *note IOBase: 710. があります。
‘IOBase’ ではストリームに対して基本的なインターフェースを定義しています
。 しかしながら、ストリームに対する読み込みと書き込みが分離されていない
ことに注意してください。 実装においては与えられた操作をサポートしない場
合は *note UnsupportedOperation: 19e9. を送出することが許されています。

*note RawIOBase: 1490. ABC は *note IOBase: 710. を拡張します。このクラ
スはストリームからの bytes の読み書きを扱います。 *note FileIO: 16c9. は
、 ‘RawIOBase’ を継承してマシンのファイルシステム中のファイルへのインタ
ーフェースを提供します。

The *note BufferedIOBase: a88. ABC extends *note IOBase: 710.  It deals
with buffering on a raw binary stream (*note RawIOBase: 1490.).  Its
subclasses, *note BufferedWriter: 176a, *note BufferedReader: 15cb, and
*note BufferedRWPair: 176c. buffer raw binary streams that are writable,
readable, and both readable and writable, respectively.  *note
BufferedRandom: 176b. provides a buffered interface to seekable streams.
Another ‘BufferedIOBase’ subclass, *note BytesIO: 1258, is a stream of
in-memory bytes.

*note TextIOBase: a89. ABC は *note IOBase: 710. を拡張します。このクラ
スはテキストをあらわすバイトストリームを対象とし、バイトデータと文字列の
間のエンコーディングやデコーディングを適切に行います。 *note
TextIOWrapper: ba0. は ‘TextIOBase’ を拡張し、バッファリングされた生のス
トリーム (*note BufferedIOBase: a88.) に対するバッファリングされたテキス
トのインターフェースです。最後に、 *note StringIO: 12d8. はメモリ上のテ
キストデータに対するストリームです。

引数名は規約に含まれていません。 そして *note open(): 333. の引数だけが
キーワード引数として用いられることが意図されています。

The following table summarizes the ABCs provided by the ‘io’ module:

ABC                           継承元                 スタブメソッド               Mixin するメソッドとプロパティ
                                                                                  
-----------------------------------------------------------------------------------------------------------------------------------------
                                                                                  
*note IOBase: 710.                                   ‘fileno’, ‘seek’,            ‘close’, ‘closed’, ‘__enter__’, ‘__exit__’, ‘flush’,
                                                     ‘truncate’                   ‘isatty’, ‘__iter__’, ‘__next__’, ‘readable’,
                                                                                  ‘readline’, ‘readlines’, ‘seekable’, ‘tell’,
                                                                                  ‘writable’, ‘writelines’
                                                                                  
                                                                                  
*note RawIOBase: 1490.        *note IOBase: 710.     ‘readinto’, ‘write’          *note IOBase: 710. から継承したメソッド、 ‘read’,
                                                                                  ‘readall’
                                                                                  
                                                                                  
*note BufferedIOBase: a88.    *note IOBase: 710.     ‘detach’, ‘read’, ‘read1’,   *note IOBase: 710. から継承したメソッド、
                                                     ‘write’                      ‘readinto’, ‘readinto1’
                                                                                  
                                                                                  
*note TextIOBase: a89.        *note IOBase: 710.     ‘detach’, ‘read’,            *note IOBase: 710. から継承したメソッド、
                                                     ‘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: 710. 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: 15a. (or *note
     UnsupportedOperation: 19e9.) when operations they do not support
     are called.

     ファイルへのバイナリデータの読み書きに用いられる基本型は *note
     bytes: 1d2. です。 他の *note bytes-like オブジェクト: 43d. もメソ
     ッドの引数として受け付けられます。 テキスト I/O クラスは *note str:
     1ea. データを扱います。

     閉じられたストリームに対するメソッド呼び出しは (問い合わせであって
     も) 未定義です。この場合、実装は *note ValueError: 15a. を送出する
     ことがあります。

     *note IOBase: 710. (とそのサブクラス) はイテレータプロトコルをサポ
     ートします。 ‘IOBase’ オブジェクトをイテレートすると、ストリーム内
     の行が yield されます。ストリーム内の行の定義は、そのストリームが
     (バイト列を yield する) バイナリストリームか (文字列を yield する)
     テキストストリームかによって、 少し異なります。下の *note
     readline(): 16e3. を参照してください。

     *note IOBase: 710. はコンテキストマネージャでもあります。そのため
     *note with: 215. 構文をサポートします。 次の例では、 ‘with’ 構文が
     終わった後で--たとえ例外が発生した場合でも、 'file' は閉じられます
     。

          with open('spam.txt', 'w') as file:
              file.write('Spam and eggs!')

     *note IOBase: 710. は以下のデータ属性とメソッドを提供します:

      -- メソッド: close ()

          このストリームをフラッシュして閉じます。このメソッドはファイル
          が既に閉じられていた場合は特に何の効果もありません。いったんフ
          ァイルが閉じられると、すべてのファイルに対する操作 (例えば読み
          込みや書き込み) で *note ValueError: 15a. が発生します。

          利便性のためにこのメソッドを複数回呼ぶことは許されています。し
          かし、効果があるのは最初の1回だけです。

      -- の属性: closed

          ストリームが閉じられていた場合 ‘True’ になります。

      -- メソッド: fileno ()

          ストリームが保持しているファイル記述子 (整数値) が存在する場合
          はそれを返します。もし IO オブジェクトがファイル記述子を使って
          いない場合は *note OSError: 543. が発生します。

      -- メソッド: flush ()

          適用可能であればストリームの書き込みバッファをフラッシュします
          。読み出し専用や非ブロッキングストリームでは何もしません。

      -- メソッド: isatty ()

          ストリームが対話的であれば (つまりターミナルや tty デバイスに
          つながっている場合) ‘True’ を返します。

      -- メソッド: readable ()

          Return ‘True’ if the stream can be read from.  If ‘False’,
          ‘read()’ will raise *note OSError: 543.

      -- メソッド: readline (size=-1, /)

          ストリームから 1 行読み込んで返します。もし 'size' が指定され
          た場合、最大で 'size' バイトが読み込まれます。

          バイナリファイルでは行末文字は常に ‘b'\n'’ となります。テキス
          トファイルでは、認識される行末文字を選択するために *note
          open(): 333. に対する '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: 1647. or ‘0’ - start of the stream
               (the default); 'offset' should be zero or positive

             * *note os.SEEK_CUR: 1648. or ‘1’ - current stream
               position; 'offset' may be negative

             * *note os.SEEK_END: 1649. 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: 327c. or *note
          os.SEEK_DATA: 327d.  The valid values for a file could depend
          on it being open in text or binary mode.

      -- メソッド: seekable ()

          ストリームがランダムアクセスをサポートしている場合、 ‘True’ を
          返します。 ‘False’ の場合、 *note seek(): 1646.、 *note
          tell(): 1765.、 *note truncate(): 16ca. を使用すると *note
          OSError: 543. を発生させます。

      -- メソッド: 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(): 16ca. will raise *note
          OSError: 543.

      -- メソッド: writelines (lines, /)

          ストリームに行のリストを書き込みます。行区切り文字は追加されな
          いので、書き込む各行の行末に行区切り文字を含ませるのが一般的で
          す。

      -- メソッド: __del__ ()

          オブジェクトの破壊の用意をします。このメソッドはインスタンスの
          *note close(): 711. メソッドを呼びます。 *note IOBase: 710. は
          このメソッドのデフォルトの実装を提供します

 -- クラス: io.RawIOBase

     Base class for raw binary streams.  It inherits from *note IOBase:
     710.

     生のバイナリストリームは典型的に、背後にある OS デバイスや API への
     低水準なアクセスを提供し、それらを高水準の基本要素へカプセル化しよ
     うとはしません (そのような機能は後述するバッファされたバイナリスト
     リームやテキストストリームのような高水準のクラスで行われます)。

     *note RawIOBase: 1490. は *note IOBase: 710. が提供するメソッドに加
     えて、以下のメソッドを提供します:

      -- メソッド: read (size=-1, /)

          オブジェクトを 'size' バイトまで読み込み、それを返します。 簡
          単のため、 'size' が指定されていないか -1 の場合は、 EOF まで
          の全てのバイトを返します。 そうでない場合は、システムコール呼
          び出しが一度だけ行われます。 オペレーティングシステムコールか
          ら返ってきたものが 'size' バイトより少なければ、 'size' バイト
          より少ない返り値になることがあります。

          'size' が 0 でないのに 0 バイトが返った場合、それはファイルの
          終端を表します。オブジェクトがノンブロッキングモードで、1 バイ
          トも読み込めなければ、‘None’ が返されます。

          デフォルトの実装は *note readall(): 19e8. と *note readinto():
          11d5. に従います。

      -- メソッド: readall ()

          EOF までストリームからすべてのバイトを読み込みます。必要な場合
          はストリームに対して複数の呼び出しをします。

      -- メソッド: readinto (b, /)

          あらかじめ確保された書き込み可能な *note bytes 類オブジェクト:
          43d. 'b' にバイト列を読み込み、読み込んだバイト数を返します。
          例えば、 'b' は *note bytearray: 1d1. です。 オブジェクトがノ
          ンブロッキングモードで、 1 バイトも読み込めなければ、 ‘None’ が
          返されます。

      -- メソッド: write (b, /)

          与えられた *note bytes-like オブジェクト: 43d. 'b' を生ストリ
          ームに書き込み、書き込んだバイト数を返します。これは、根底の生
          ストリームの性質や、特にノンブロッキングである場合に、 'b' の
          バイト数より小さくなることがあります。生ストリームがブロックさ
          れないように設定されていて、かつ1バイトも即座に書き込むことが
          できなければ、 ‘None’ が返されます。このメソッドから返った後で
          呼び出し元は 'b' を解放したり変更したりするかもしれないので、
          実装はメソッド呼び出しの間だけ 'b' にアクセスすべきです。

 -- クラス: io.BufferedIOBase

     Base class for binary streams that support some kind of buffering.
     It inherits from *note IOBase: 710.

     The main difference with *note RawIOBase: 1490. is that methods
     *note read(): 16e2, *note readinto(): 1ad8. and *note write():
     109d. 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(): 109d. will raise
     *note BlockingIOError: 4ca. with *note
     BlockingIOError.characters_written: 2915. and *note read(): 16e2.
     will return data read so far or ‘None’ if no data is available.

     さらに、 *note read(): 16e2. メソッドは、 *note readinto(): 1ad8. に
     従うデフォルト実装を持ちません。

     通常の *note BufferedIOBase: a88. 実装は *note RawIOBase: 1490. 実
     装を継承せずに、 *note BufferedWriter: 176a. と *note
     BufferedReader: 15cb. がするようにこれをラップすべきです。

     *note BufferedIOBase: a88. は *note IOBase: 710. から継承した属性と
     メソッドに加えて、以下のデータ属性とメソッドを提供またはオーバーラ
     イドします:

      -- の属性: raw

          *note BufferedIOBase: a88. が扱う根底の生ストリーム (*note
          RawIOBase: 1490. インスタンス) を返します。これは
          ‘BufferedIOBase’ API には含まれず、よって実装に含まれないこと
          があります。

      -- メソッド: detach ()

          根底の生ストリームをバッファから分離して返します。

          生ストリームが取り外された後、バッファは使用不能状態になります
          。

          バッファには、 *note BytesIO: 1258. など、このメソッドで返され
          る単体のストリームという概念を持たないものがあります。これらは
          *note UnsupportedOperation: 19e9. を送出します。

          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: 1d2. 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(): 1152.
          and PEP 475(1) for more details.  Less than size bytes being
          returned does not imply that EOF is imminent.

          When reading as much as possible the default implementation
          will use ‘raw.readall’ if available (which should implement
          *note RawIOBase.readall(): 19e8.), otherwise will read in a
          loop until read returns ‘None’, an empty *note bytes: 1d2, 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:
               4ca. 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():
          11d5. which may retry if *note EINTR: 1144. is encountered per
          PEP 475(2).  If 'size' is ‘-1’ or not provided, the
          implementation will choose an arbitrary value for 'size'.

               注釈: When the underlying raw stream is non-blocking,
               implementations may either raise *note BlockingIOError:
               4ca. or return ‘None’ if no data is available.  ‘io’
               implementations return ‘None’.

      -- メソッド: readinto (b, /)

          あらかじめ確保された書き込み可能な *note bytes 類オブジェクト:
          43d. 'b' にバイト列を読み込み、読み込んだバイト数を返します。
          例えば、 'b' は *note bytearray: 1d1. です。

          *note read(): 16e2. と同様に、下層の raw ストリームが対話的で
          ない限り、複数の読み込みは下層の raw ストリームに与えられるか
          もしれません。

          元になる生ストリームがノンブロッキングモードで、呼び出された時
          点でデータを持っていなければ、 *note BlockingIOError: 4ca. が
          送出されます。

      -- メソッド: readinto1 (b, /)

          根底の raw ストリームの *note read(): 11d4. (または *note
          readinto(): 11d5.) メソッドを高々 1 回呼び出し、あらかじめ確保
          された書き込み可能な *note bytes-like オブジェクト: 43d. 'b' に
          バイト列を読み込みます。読み込んだバイト数を返します。

          元になる生ストリームがノンブロッキングモードで、呼び出された時
          点でデータを持っていなければ、 *note BlockingIOError: 4ca. が
          送出されます。

          Added in version 3.5.

      -- メソッド: write (b, /)

          与えられた *note bytes-like オブジェクト: 43d. 'b' を書き込み
          、書き込んだバイト数を返します (これは常に 'b' のバイト数と等
          しくなります。なぜなら、もし書き込みに失敗した場合は *note
          OSError: 543. が発生するからです)。実際の実装に依存して、これ
          らのバイト列は根底のストリームに即座に書き込まれることもあれば
          、パフォーマンスやレイテンシの関係でバッファに保持されることも
          あります。

          ノンブロッキングモードであるとき、バッファが満杯で根底の生スト
          リームが書き込み時点でさらなるデータを受け付けられない場合
          *note BlockingIOError: 4ca. が送出されます。

          このメソッドが戻った後で、呼び出し元は 'b' を解放、または変更
          するかもしれないので、実装はメソッド呼び出しの間だけ 'b' にア
          クセスすべきです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://peps.python.org/pep-0475/


File: python.info,  Node: 生ファイルI/O,  Next: バッファ付きストリーム,  Prev: I/O 基底クラス,  Up: クラス階層

5.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: 1490.

     'name' は、次の 2 つのいずれかです。

        * 開くファイルへのパスを表す文字列または *note bytes: 1d2. オブ
          ジェクト。 この場合、closefd は ‘True’ (デフォルト) でなければ
          なりません。 ‘True’ でない場合、エラーが送出されます。

        * 結果の *note FileIO: 16c9. オブジェクトがアクセスを与える、既
          存の OS レベルファイル記述子の数を表す整数。FileIO オブジェク
          トが閉じられると、'closefd' が ‘False’ に設定されていない場合
          、この fd も閉じられます。

     'mode' は 読み込み（デフォルト）、書き込み、排他的作成、追記に対し
     ‘'r'’ 、 ‘'w'’ 、 ‘'x'’ 、 ‘'a'’ です。ファイルは書き込みや追記で開
     かれたときに存在しない場合作成されます。書き込みのときにファイルの
     内容は破棄されます。作成時に既に存在する場合は *note
     FileExistsError: 13cd. が送出されます。作成のためにファイルを開くの
     は暗黙的に書き込みなので、このモードは ‘'w'’ と同じように振る舞いま
     す。読み込みと書き込みを同時に許可するにはモードに ‘'+'’ を加えてく
     ださい。

     The *note read(): 11d4. (when called with a positive argument),
     *note readinto(): 11d5. and *note write(): 1764. methods on this
     class will only make one system call.

     呼び出し可能オブジェクトを 'opener' として与えることで、カスタムの
     オープナーが使えます。そしてファイルオブジェクトの基底のファイルデ
     ィスクリプタは、'opener' を ('name', 'flags') で呼び出して得られま
     す。'opener' は開いたファイルディスクリプタを返さなければなりません
     。 (*note os.open: 114f. を 'opener' として渡すと、‘None’ を渡した
     のと同様の機能になります。)

     新たに作成されたファイルは *note 継承不可: 12ad. です。

     'opener' 引数を使う例については *note open(): 333. 組み込み関数を参
     照してください。

     バージョン 3.3 で変更: 'opener' 引数が追加されました。‘'x'’ モード
     が追加されました。

     バージョン 3.4 で変更: ファイルが継承不可になりました。

     *note FileIO: 16c9. は *note RawIOBase: 1490. と *note IOBase: 710.
     から継承したデータ属性に加えて以下のデータ属性を提供します:

      -- の属性: 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: a88.  The buffer is discarded when the *note
     close(): 711. method is called.

     省略可能な引数 'initial_bytes' は、初期データを含んだ *note
     bytes-like オブジェクト: 43d. です。

     Methods may be used from multiple threads without external locking
     in *note free-threaded builds: 1a3.

     *note BytesIO: 1258. は *note BufferedIOBase: a88. または *note
     IOBase: 710. からのメソッドに加えて、以下のメソッドを提供もしくはオ
     ーバーライドします:

      -- メソッド: getbuffer ()

          バッファの内容をコピーすることなく、その内容の上に、読み込み及
          び書き込みが可能なビューを返します。また、このビューを変更する
          と、バッファの内容は透過的に更新されます:

               >>> b = io.BytesIO(b"abcdef")
               >>> view = b.getbuffer()
               >>> view[2:4] = b"56"
               >>> b.getvalue()
               b'ab56ef'

               注釈: ビューが存在する限り、*note BytesIO: 1258. オブジェ
               クトはリサイズやクローズされません。

          Added in version 3.2.

      -- メソッド: getvalue ()

          バッファの全内容を含む *note bytes: 1d2. を返します。

      -- メソッド: read1 (size=-1, /)

          *note BytesIO: 1258. においては、このメソッドは *note read():
          16e2. と同じです。

          バージョン 3.7 で変更: 'size' 引数が任意になりました。

      -- メソッド: readinto1 (b, /)

          *note BytesIO: 1258. においては、このメソッドは *note
          readinto(): 1ad8. と同じです。

          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: 1490. raw binary stream.
     It inherits from *note BufferedIOBase: a88.

     このオブジェクトからデータを読み出した時、背後にある生のストリーム
     からはより大きな量のデータの読み出しがリクエストされ、内部バッファ
     に読み出したデータが保持されることがあります。バッファされたデータ
     はその後の読み出し処理で直接返すことができます。

     このコンストラクタは与えられた 'raw' ストリームと 'buffer_size' に
     対し *note BufferedReader: 15cb. を生成します。 'buffer_size' が省
     略された場合、代わりに *note DEFAULT_BUFFER_SIZE: 1c64. が使われま
     す。

     *note BufferedReader: 15cb. は *note BufferedIOBase: a88. または
     *note IOBase: 710. からのメソッドに加えて、以下のメソッドを提供もし
     くはオーバーライドします:

      -- メソッド: 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(): 16e2.

      -- メソッド: read1 (size=-1, /)

          In ‘BufferedReader’ this is the same as *note
          io.BufferedIOBase.read1(): 3092.

          バージョン 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: 1490. raw binary stream.
     It inherits from *note BufferedIOBase: a88.

     このオブジェクトに対して書き込みを行なったとき、データは通常内部バ
     ッファに配置されます。バッファは以下に示すさまざまな条件で背後にあ
     る *note RawIOBase: 1490. オブジェクトに書き込まれます:

        * 保留中の全データに対してバッファが足りなくなったとき;

        * when *note flush(): 338b. is called;

        * when a *note seek(): 1646. is requested (for *note
          BufferedRandom: 176b. objects);

        * *note BufferedWriter: 176a. オブジェクトが閉じられたり破棄され
          たりしたとき。

     このコンストラクタは与えられた書き込み可能な 'raw' ストリームに対し
     *note BufferedWriter: 176a. を生成します。 'buffer_size' が省略され
     た場合、 *note DEFAULT_BUFFER_SIZE: 1c64. がデフォルトになります。

     *note BufferedWriter: 176a. は *note BufferedIOBase: a88. または
     *note IOBase: 710. からのメソッドに加えて、以下のメソッドを提供もし
     くはオーバーライドします:

      -- メソッド: flush ()

          バッファに保持されたバイト列を生ストリームに強制的に流し込みま
          す。生ストリームがブロックした場合 *note BlockingIOError: 4ca.
          が送出されます。

      -- メソッド: write (b, /)

          Write the *note bytes-like object: 43d, 'b', and return the
          number of bytes written.  When in non-blocking mode, a *note
          BlockingIOError: 4ca. with *note
          BlockingIOError.characters_written: 2915. set is raised if the
          buffer needs to be written out but the raw stream blocks.

 -- クラス: io.BufferedRandom (raw, buffer_size=DEFAULT_BUFFER_SIZE)

     A buffered binary stream providing higher-level access to a
     seekable *note RawIOBase: 1490. raw binary stream.  It inherits
     from *note BufferedReader: 15cb. and *note BufferedWriter: 176a.

     このコンストラクタは第一引数として与えられるシーク可能な生ストリー
     ムに対し、リーダーおよびライターを作成します。 'buffer_size' が省略
     された場合、 *note DEFAULT_BUFFER_SIZE: 1c64. がデフォルトになりま
     す。

     ‘BufferedRandom’ is capable of anything *note BufferedReader: 15cb.
     or *note BufferedWriter: 176a. can do.  In addition, *note seek():
     1646. and *note tell(): 1765. 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: 1490. raw binary streams--one readable,
     the other writeable.  It inherits from *note BufferedIOBase: a88.

     'reader' と 'writer' はそれぞれ読み込み可能、書き込み可能な *note
     RawIOBase: 1490. オブジェクトです。 'buffer_size' が省略された場合
     *note DEFAULT_BUFFER_SIZE: 1c64. がデフォルトになります。

     *note BufferedRWPair: 176c. は、 *note UnsupportedOperation: 19e9.
     を送出する *note detach(): 3029. を除く、 *note BufferedIOBase:
     a88. の全てのメソッドを実装します。

          警告: *note BufferedRWPair: 176c. は下層の生ストリームのアクセ
          スを同期しようとはしません。同じオブジェクトをリーダとライタと
          して渡してはいけません。その場合は代わりに *note
          BufferedRandom: 176b. を使用してください。


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:
     710.

     *note IOBase: 710. から継承した属性とメソッドに加えて、 *note
     TextIOBase: a89. は以下のデータ属性とメソッドを提供しています:

      -- の属性: encoding

          エンコーディング名で、ストリームのバイト列を文字列にデコードす
          るとき、また文字列をバイト列にエンコードするときに使われます。

      -- の属性: errors

          このエンコーダやデコーダのエラー設定です。

      -- の属性: newlines

          文字列、文字列のタプル、または ‘None’ で、改行がどのように読み
          換えられるかを指定します。実装や内部コンストラクタのフラグに依
          って、これは利用できないことがあります。

      -- の属性: buffer

          The underlying binary buffer (a *note BufferedIOBase: a88. or
          *note RawIOBase: 1490. instance) that ‘TextIOBase’ deals with.
          This is not part of the ‘TextIOBase’ API and may not exist in
          some implementations.

      -- メソッド: detach ()

          根底のバイナリバッファを *note TextIOBase: a89. から分離して返
          します。

          根底のバッファが取り外された後、 *note TextIOBase: a89. は使用
          不能状態になります。

          *note TextIOBase: a89. 実装には、 *note StringIO: 12d8. など、
          根底のバッファという概念を持たないものがあります。これらを呼び
          出すと *note UnsupportedOperation: 19e9. を送出します。

          Added in version 3.1.

      -- メソッド: read (size=-1, /)

          最大 'size' 文字をストリームから読み込み、一つの *note str:
          1ea. にして返します。 'size' が負の値または ‘None’ ならば、
          EOF まで読みます。

      -- メソッド: readline (size=-1, /)

          Read until newline or EOF and return a single *note str: 1ea.
          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(): 3391, 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: a88. buffered binary stream.  It inherits from
     *note TextIOBase: a89.

     'encoding' gives the name of the encoding that the stream will be
     decoded or encoded with.  In *note UTF-8 Mode: a4b, this defaults
     to UTF-8.  Otherwise, it defaults to *note locale.getencoding():
     a4a.  ‘encoding="locale"’ can be used to specify the current
     locale's encoding explicitly.  See *note Text Encoding: ba2. for
     more information.

     'errors' はオプションの文字列で、エンコードやデコードの際のエラーを
     どのように扱うかを指定します。エンコードエラーがあったときに *note
     ValueError: 15a. 例外を送出させるには ‘'strict'’ を渡します (デフォ
     ルトの ‘None’ でも同じです)。エラーを無視させるには ‘'ignore'’ を渡
     します。 (エンコーディングエラーを無視するとデータを喪失する可能性
     があることに注意してください。) ‘'replace'’ は不正な形式の文字の代
     わりにマーカ (たとえば ‘'?'’) を挿入させます。‘'backslashreplace'’
     を指定すると、不正な形式のデータをバックスラッシュ付きのエスケープ
     シーケンスに置換します。書き込み時には ‘'xmlcharrefreplace'’ (適切
     な XML 文字参照に置換) や ‘'namereplace'’ (‘\N{...}’ エスケープシー
     ケンスに置換) も使えます。他にも *note codecs.register_error():
     1853. で登録されたエラー処理名が有効です。

     'newline' は行末をどのように処理するかを制御します 。‘None’, ‘''’,
     ‘'\n'’, ‘'\r'’, ‘'\r\n'’ のいずれかです。これは以下のように動作しま
     す:

        * ストリームからの入力を読み込んでいるとき、もし 'newline' が
          ‘None’ ならば *note universal newlines: 10f5. モードが有効にな
          ります。入力中の行は ‘'\n'’, ‘'\r'’, または ‘'\r\n'’ のいずれ
          で終わってもよく、それらは呼び出し元に返される前に'''n''' に変
          換されます。 'newline' が ‘''’ の場合、 universal newlines モ
          ードは有効になりますが、行末のコードは変換されずに呼び出し元に
          返されます。 'newline' がその他の有効な値の場合は、入力行は与
          えられた文字列のみで終端され、行末は変換されずに呼び出し元に返
          されます。

        * ストリームへの出力の書き込み時、'newline' が ‘None’ の場合、全
          ての ‘'\n'’ 文字はシステムのデフォルトの行セパレータ *note
          os.linesep: 27f4. に変換されます。 'newline' が ‘''’ または
          ‘'\n'’ の場合は変換されません。'newline' がその他の正当な値の
          場合、全ての ‘'\n'’ 文字は与えられた文字列に変換されます。

     If 'line_buffering' is ‘True’, *note flush(): 1a1a. is implied when
     a call to write contains a newline character or a carriage return.

     If 'write_through' is ‘True’, calls to *note write(): 109d. 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(): 23c. を用いてロケールのエンコーディングを一時的
     に変更してはいけません。ユーザが望むエンコーディングではなく現在の
     ロケールのエンコーディングを使用してください。

     バージョン 3.10 で変更: The 'encoding' argument now supports the
     ‘"locale"’ dummy encoding name.

          注釈: When the underlying raw stream is non-blocking, a *note
          BlockingIOError: 4ca. may be raised if a read operation cannot
          be completed immediately.

     *note TextIOWrapper: ba0. は *note TextIOBase: a89. と *note
     IOBase: 710. から継承したものに加えて以下のデータ属性をメソッドを提
     供します:

      -- の属性: 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: 32e.

          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():
               19e7.

             * ‘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: 1647, *note os.SEEK_CUR: 1648, and *note
          os.SEEK_END: 1649.

      -- メソッド: tell ()

          Return the stream position as an opaque number.  The return
          value of ‘tell()’ can be given as input to *note seek(): 3394,
          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: a89.

     テキストバッファは *note close(): 711. メソッドが呼び出されたときに
     破棄されます。

     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(): 2268.  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: ba0. の同名の引数と同じように
     働きます。ただし、出力をストリームに書き込む時に 'newline' が
     ‘None’ の場合には、改行は全てのプラットフォームで ‘\n’ になります。

     *note TextIOBase: a89. と *note IOBase: 710. から継承したメソッドに
     加えて *note StringIO: 12d8. は以下のメソッドを提供しています:

      -- メソッド: getvalue ()

          Return a *note str: 1ea. containing the entire contents of the
          buffer.  Newlines are decoded as if by *note read(): 2279,
          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:
     10f5. mode.  It inherits from *note codecs.IncrementalDecoder:
     2a66.


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: 867.

 -- クラス: io.Reader [T]

     Generic protocol for reading from a file or other input stream.
     ‘T’ will usually be *note str: 1ea. or *note bytes: 1d2, 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: 1ea. or *note bytes: 1d2, 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: 3399. 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(): 3391. and *note seek(): 3390. are both quite
slow due to the reconstruction algorithm used.

しかし *note StringIO: 12d8. は、ネイティブなインメモリ Unicode コンテナ
で、 *note BytesIO: 1258. と同程度の速度を示します。


File: python.info,  Node: マルチスレッディング<3>,  Next: リエントラント性,  Prev: テキスト I/O<3>,  Up: 性能<3>

5.17.2.17 マルチスレッディング
..............................

*note FileIO: 16c9. 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: 15cb, *note
BufferedWriter: 176a, *note BufferedRandom: 176b. および *note
BufferedRWPair: 176c. のインスタンス) は、その内部構造をロックを使って保
護します。このため、これらを複数のスレッドから同時に呼び出しても安全です
。

*note TextIOWrapper: ba0. オブジェクトはスレッドセーフではありません。

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/read(2)


File: python.info,  Node: リエントラント性,  Prev: マルチスレッディング<3>,  Up: 性能<3>

5.17.2.18 リエントラント性
..........................

バイナリバッファ付きオブジェクト (*note BufferedReader: 15cb, *note
BufferedWriter: 176a, *note BufferedRandom: 176b. および *note
BufferedRWPair: 176c. のインスタンス) は、リエントラント (再入可能) では
ありません。リエントラントな呼び出しは普通の状況では起こりませんが、 I/O
を *note signal: ce. ハンドラで行なっているときに起こりえます。スレッド
が、すでにアクセスしているバッファ付きオブジェクトに再び入ろうとすると
*note RuntimeError: 317. が送出されます。これは、バッファ付きオブジェク
トに複数のスレッドから入ることを禁止するわけではありません。

The above implicitly extends to text files, since the *note open(): 333.
function will wrap a buffered object inside a *note TextIOWrapper: ba0.
This includes standard streams and therefore affects the built-in *note
print(): 1324. function as well.


File: python.info,  Node: time --- 時刻データへのアクセスと変換,  Next: logging --- Python 用のログ記録手段,  Prev: io --- ストリームを扱うコアツール,  Up: 汎用オペレーティングシステムサービス

5.17.3 ‘time’ -- 時刻データへのアクセスと変換
---------------------------------------------

__________________________________________________________________

このモジュールでは、時刻に関するさまざまな関数を提供します。関連した機能
について、*note datetime: 33, *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: 314f.) 以前ある
     いは遠い未来の日付や時刻を扱うことができません。将来カットオフ（関
     数が正しく日付や時刻を扱えなくなる）が起きる時点は、C ライブラリに
     よって決まります。32-bit システムではカットオフは通常 2038 年です。

   * 関数 *note strptime(): 17e5. は ‘%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(): 764. および *note sleep(): a91. は Unix の同等
     の関数よりましな精度を持っています。時刻は浮動小数点数で表され、
     ‘time()’ は可能なかぎり最も正確な時刻を (Unix の ‘gettimeofday()’ が
     あればそれを使って) 返します。また ‘sleep()’ にはゼロでない端数を与
     えることができます (Unix の ‘select()’ があれば、それを使って実装し
     ています)。

   * *note gmtime(): 157e, *note localtime(): 18b1, *note strptime():
     17e5. が返す時刻値、および *note asctime(): 15a6, *note mktime():
     15a7, *note strftime(): 15a8. がとる時刻値は 9 個の整数からなるシー
     ケンスです。‘gmtime()’, ‘localtime()’, ‘strptime()’ の戻り値は個々
     の値を属性名で取得することもできます。

     これらのオブジェクトについての解説は *note struct_time: 10ab. を参
     照してください。

     バージョン 3.3 で変更: *note struct_time: 10ab. オブジェクトは、プ
     ラットフォームが、対応する ‘struct tm’ メンバーをサポートしている場
     合、*note tm_gmtoff: 33a2. および *note tm_zone: 33a3. 属性が拡張さ
     れるようになりました。

     バージョン 3.6 で変更: *note struct_time: 10ab. の属性 *note
     tm_gmtoff: 33a2. および *note tm_zone: 33a3. が全てのプラットフォー
     ムで利用できるようになりました。

   * 時間の表現を変換するには、以下の関数を利用してください:

     対象                          変換先                        関数
                                                                 
     ------------------------------------------------------------------------------------------
                                                                 
     エポックからの秒数            UTC の                        *note gmtime(): 157e.
                                   *note struct_time: 10ab.      
                                   
                                                                 
     エポックからの秒数            ローカル時間の                *note localtime(): 18b1.
                                   *note struct_time: 10ab.      
                                   
                                                                 
     UTC の                        エポックからの秒数            *note calendar.timegm(): 2b73.
     *note struct_time: 10ab.                                    

     ローカル時間の                エポックからの秒数            *note mktime(): 15a7.
     *note struct_time: 10ab.                                    

* 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: 10ab. representing a time as
     returned by *note gmtime(): 157e. or *note localtime(): 18b1. 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(): 18b1. is used.  Locale information is not used by
     *note asctime(): 15a6.

          注釈: 同名の C の関数と違って、*note asctime(): 15a6. は末尾に
          改行文字を加えません。

 -- の関数: 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(): 151a. or the *note ident: 33a6.
     attribute of *note threading.Thread: 427. 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: 234c.: Unix

     更なる情報については ‘pthread_getcpuclockid(3)(1)’ の man を参照し
     てください。

     Added in version 3.7.

 -- の関数: time.clock_getres (clk_id)

     指定された 'clk_id' クロックの分解能(精度)を返します。 'clk_id' と
     して受け付けられる値の一覧は *note Clock ID Constants: 331f. を参照
     してください。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- の関数: time.clock_gettime (clk_id) -> float

     指定された 'clk_id' クロックの時刻を返します。 'clk_id' として受け
     付けられる値の一覧は *note Clock ID Constants: 331f. を参照してくだ
     さい。

     Use *note clock_gettime_ns(): ead. to avoid the precision loss
     caused by the *note float: 32f. type.

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- の関数: time.clock_gettime_ns (clk_id) -> int

     *note clock_gettime(): 151e. に似ていますが、ナノ秒単位の時刻を返し
     ます。

     *note Availability: 234c.: Unix.

     Added in version 3.7.

 -- の関数: time.clock_settime (clk_id, time)

     指定された 'clk_id' クロックの時刻を設定します。 現在、 *note
     CLOCK_REALTIME: a8e. は 'clk_id' が受け付ける唯一の値です。

     Use *note clock_settime_ns(): eae. to avoid the precision loss
     caused by the *note float: 32f. type.

     *note Availability: 234c.: Unix, not Android, not iOS.

     Added in version 3.3.

     バージョン 3.15 で変更: Accepts any real number as 'time', not only
     integer or float.

 -- の関数: time.clock_settime_ns (clk_id, time: int)

     *note clock_settime(): 151f. に似ていますが、ナノ秒単位の時刻を設定
     します。

     *note Availability: 234c.: Unix, not Android, not iOS.

     Added in version 3.7.

 -- の関数: time.ctime ([secs])

     Convert a time expressed in seconds since the *note epoch: 314f. 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: a6a. を指定した場合、*note
     time(): 764. が返す値を現在の時刻として使用します。‘ctime(secs)’ は
     ‘asctime(localtime(secs))’ と等価です。ローカル情報は *note
     ctime(): 2af0. には使用されません。

     バージョン 3.15 で変更: Accepts any real number, not only integer
     or float.

 -- の関数: time.get_clock_info (name)

     指定されたクロックの情報を名前空間オブジェクトとして取得します。サ
     ポートされているクロック名およびそれらの値を取得する関数は以下の通
     りです:

        * ‘'monotonic'’: *note time.monotonic(): 763.

        * ‘'perf_counter'’: *note time.perf_counter(): e4d.

        * ‘'process_time'’: *note time.process_time(): e4e.

        * ‘'thread_time'’: *note time.thread_time(): d07.

        * ‘'time'’: *note time.time(): 764.

     結果は以下の属性をもちます:

        - '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: 331f. を参照してください。

        - 'monotonic': クロック値が後戻りすることがない場合 ‘True’ が、
          そうでない場合は ‘False’ になります。

        - 'resolution': クロックの分解能を秒 (*note float: 32f.) で表し
          ます。

     Added in version 3.3.

 -- の関数: time.gmtime ([secs])

     エポック (*note epoch: 314f.) からの経過時間で表現された時刻を、UTC
     で *note struct_time: 10ab. に変換します。このとき dst フラグは常に
     ゼロとして扱われます。'secs' を指定しないか *note None: a6a. を指定
     した場合、*note time(): 764. が返す値を現在の時刻として使用します。
     秒の端数は無視されます。‘struct_time’ オブジェクトについては前述の
     説明を参照してください。*note calendar.timegm(): 2b73. はこの関数と
     逆の変換を行います。

     バージョン 3.15 で変更: Accepts any real number, not only integer
     or float.

 -- の関数: time.localtime ([secs])

     *note gmtime(): 157e. に似ていますが、ローカル時間に変換します。
     'secs' を指定しないか *note None: a6a. を指定した場合、*note
     time(): 764. が返す値を現在の時刻として使用します。DST が適用されて
     いる場合は dst フラグには ‘1’ が設定されます。

     ‘localtime()’ may raise *note OverflowError: c5b, if the timestamp
     is outside the range of values supported by the platform C
     ‘localtime()’ or ‘gmtime()’ functions, and *note OSError: 543. on
     ‘localtime()’ or ‘gmtime()’ failure.  It's common for this to be
     restricted to years between 1970 and 2038.

     バージョン 3.15 で変更: Accepts any real number, not only integer
     or float.

 -- の関数: time.mktime (t)

     *note localtime(): 18b1. の逆を行う関数です。引数は *note
     struct_time: 10ab. か 9 個の要素すべての値を持つ完全なタプル (dst フ
     ラグも必要です; 時刻に DST が適用されるか不明の場合は ‘-1’ を使用し
     てください) で、UTC ではなく 'ローカル' 時間を指定します。戻り値は
     *note time(): 764. との互換性のために浮動小数点数になります。入力し
     た値を正しい時刻として表現できない場合、例外 *note OverflowError:
     c5b. または *note ValueError: 15a. が送出されます (どちらが送出され
     るかは、無効な値を受け取ったのが 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(): eaf. to avoid the precision loss caused
     by the *note float: 32f. 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(): 763. に似ていますが、ナノ秒単位の時刻を返します
     。

     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(): 763. and is a monotonic clock, i.e.  a clock that
     cannot go backwards.

     Use *note perf_counter_ns(): eb0. to avoid the precision loss
     caused by the *note float: 32f. 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(): 763.

 -- の関数: time.perf_counter_ns () -> int

     *note perf_counter(): e4d. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     Added in version 3.7.

 -- の関数: time.process_time () -> float

     現在のプロセスのシステムおよびユーザー CPU 時間の値を (小数秒で) 返
     します。これはスリープ中の経過時間を含みません。これは定義上プロセ
     スワイドです。戻り値の基準点は定義されていないので、二回の呼び出し
     の結果の差だけが有効です。

     Use *note process_time_ns(): eb1. to avoid the precision loss
     caused by the *note float: 32f. type.

     Added in version 3.3.

 -- の関数: time.process_time_ns () -> int

     *note process_time(): e4e. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     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 non-integer 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: 42e. instead of
          ‘time.sleep(0)’.

          To voluntarily relinquish the CPU, specify a real-time *note
          scheduling policy: 3366. and use *note os.sched_yield(): 14d2.
          instead.

     引数 ‘secs’ を指定して *note 監査イベント: 1e84. ‘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.

     バージョン 3.15 で変更: Accepts any real number, not only integer
     or float.

 -- の関数: time.strftime (format[, t])

     *note gmtime(): 157e. や *note localtime(): 18b1. が返す時刻値タプ
     ルまたは *note struct_time: 10ab. を、'format' で指定した文字列形式
     に変換します。't' が与えられていない場合、‘localtime()’ が返す値を
     現在の時刻として使用します。'format' は文字列でなくてはなりません。
     't' のいずれかのフィールドが許容範囲外の数値であった場合、*note
     ValueError: 15a. を送出します。

     0 は時刻タプル内のいずれの位置の引数にも使用できます; それが一般に
     不正な値であれば、正しい値に強制的に置き換えられます。

     'format' 文字列には以下のディレクティブ (指示語) を埋め込むことがで
     きます。これらはフィールド長や精度のオプションを付けずに表され、
     *note strftime(): 15a8. の結果の対応する文字列に置き換えられます:

     ディレクティ    意味                                                 注釈
     ブ                                                                   

     ---------------------------------------------------------------------------------
                                                                          
     ‘%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():
          17e5, not to ‘strftime()’.  However, see also *note
          datetime.datetime.strptime(): 2dd. and *note
          datetime.datetime.strftime(): 1055. where the ‘%f’ format
          directive *note applies to microseconds: 2ac2.

       2. *note strptime(): 17e5. 関数で使う場合、‘%p’ ディレクティブが
          出力結果の時刻フィールドに影響を及ぼすのは、時刻を解釈するため
          に ‘%I’ を使ったときのみです。

       3. 値の幅は実際に ‘0’ から ‘61’ です; ‘60’ は うるう秒<leap
          seconds>(6) を表し、 ‘61’ は歴史的理由によりサポートされていま
          す。

       4. *note strptime(): 17e5. 関数で使う場合、‘%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(): 157e. や *note localtime(): 18b1. が返すような *note
     struct_time: 10ab. です。

     'format' パラメーターは *note strftime(): 15a8. で使うものと同じデ
     ィレクティブを使います; このパラメーターの値はデフォルトでは ‘"%a
     %b %d %H:%M:%S %Y"’ で、*note ctime(): 2af0. が返すフォーマットに一
     致します。'string' が 'format' に従って解釈できなかった場合、例外
     *note ValueError: 15a. が送出されます。解析しようとする '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(): 157e, *note localtime(): 18b1. および *note
     strptime(): 17e5. が返す時刻値シーケンスの型です。これは *note
     名前付きタプル: a42. のインターフェースをもったオブジェクトです。値
     はインデックスでも属性名でもアクセス可能です。以下の値があります:

     インデックス                          属性                                  値
                                                                                 
                                                                                 
     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): 33a7. in
                                                                                 *note strftime(): 15a8.
                                                                                 
                                                                                 
     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(): 15a7. の呼び出し時に、*note tm_isdst: 2b01. は夏時
     間が有効な場合は 1、そうでない場合は 0 に設定されることがあります。
     値が -1 の場合は夏時間について不明なことを表していて、普通
     ‘tm_isdst’ は正しい状態に設定されます。

     *note struct_time: 10ab. を引数とする関数に正しくない長さの
     ‘struct_time’ や要素の型が正しくない ‘struct_time’ を与えた場合には
     、 *note TypeError: 29c. が送出されます。

 -- の関数: time.time () -> float

     エポック (*note epoch: 314f.) からの秒数を浮動小数点数で返します。
     うるう秒 (leap seconds(10)) の扱いはプラットフォーム依存です。
     Windows とほとんどの Unix システムでは、うるう秒はエポック (*note
     epoch: 314f.) 秒の時間の勘定には入りません。 これは一般に Unix 時間
     (11) と呼ばれています。

     時刻は常に浮動小数点数で返されますが、すべてのシステムが 1 秒より高
     い精度で時刻を提供するとは限らないので注意してください。 この関数が
     返す値は通常減少していくことはありませんが、この関数を 2 回呼び出し
     、その呼び出しの間にシステムクロックの時刻を巻き戻して設定した場合
     には、以前の呼び出しよりも低い値が返ることがあります。

     *note time(): 764. が返す数値は、 *note gmtime(): 157e. 関数に渡さ
     れて UTC の、あるいは *note localtime(): 18b1. 関数に渡されて現地時
     間の、より一般的な時間のフォーマット (つまり、年、月、日、時間など)
     に変換されているかもしれません。 どちらの場合でも *note
     struct_time: 10ab. オブジェクトが返され、このオブジェクトの属性とし
     てカレンダー日付の構成要素へアクセスできます。

     Clock:

        * On Windows, call ‘GetSystemTimePreciseAsFileTime()’.

        * Call ‘clock_gettime(CLOCK_REALTIME)’ if available.

        * Otherwise, call ‘gettimeofday()’.

     Use *note time_ns(): eb2. to avoid the precision loss caused by the
     *note float: 32f. type.

バージョン 3.13 で変更: On Windows, calls
‘GetSystemTimePreciseAsFileTime()’ instead of
‘GetSystemTimeAsFileTime()’.

 -- の関数: time.time_ns () -> int

     *note time(): 764. に似ていますが、時刻を *note epoch: 314f. を基点
     としたナノ秒単位の整数で返します。

     Added in version 3.7.

 -- の関数: time.thread_time () -> float

     現在のスレッドのシステムおよびユーザー CPU 時間の値を (小数秒で) 返
     します。これはスリープ中の経過時間を含みません。これは定義上スレッ
     ド固有です。戻り値の基準点は定義されていないので、同一スレッドにお
     ける二回の呼び出しの結果の差だけが有効です。

     Use *note thread_time_ns(): f54. to avoid the precision loss caused
     by the *note float: 32f. type.

     *note Availability: 234c.: Linux, Unix, Windows.

     Unix systems supporting ‘CLOCK_THREAD_CPUTIME_ID’.

     Added in version 3.7.

 -- の関数: time.thread_time_ns () -> int

     *note thread_time(): d07. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     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: 234c.: Unix.

          注釈: 多くの場合、環境変数 ‘TZ’ を変更すると、 *note tzset():
          33af. を呼ばない限り *note localtime(): 18b1. のような関数の出
          力に影響を及ぼすため、値が信頼できなくなってしまいます。

          ‘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(): 151d.
and *note clock_gettime(): 151e.

 -- データ: time.CLOCK_BOOTTIME

     Identical to *note CLOCK_MONOTONIC: a8d, 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: a8e, which may have discontinuities if the time is
     changed using ‘settimeofday()’ or similar.

     *note Availability: 234c.: Linux >= 2.6.39.

     Added in version 3.7.

 -- データ: time.CLOCK_HIGHRES

     Solaris OS は任意のハードウェアソースの使用を試み、ナノ秒レベルの分
     解能を提供する ‘CLOCK_HIGHRES’ タイマーを具備しています。
     ‘CLOCK_HIGHRES’ は変更不可で、高分解能のクロックです。

     *note Availability: 234c.: Solaris.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC

     設定不可で、モノトニック時刻 (不特定のエポックからの単調増加な時刻)
     を表します。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC_RAW

     *note CLOCK_MONOTONIC: a8d. と似ていますが、NTP の影響を受けていな
     い、ハードウェアベースの時刻へのアクセスを提供します。

     *note Availability: 234c.: Linux >= 2.6.28, macOS >= 10.12.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC_RAW_APPROX

     Similar to *note CLOCK_MONOTONIC_RAW: 33b2, but reads a value
     cached by the system at context switch and hence has less accuracy.

     *note Availability: 234c.: macOS >= 10.12.

     Added in version 3.13.

 -- データ: time.CLOCK_PROCESS_CPUTIME_ID

     CPU による高分解能のプロセスごとのタイマーです。

     *note Availability: 234c.: Unix.

     Added in version 3.3.

 -- データ: time.CLOCK_PROF

     CPU による高分解能のプロセスごとのタイマーです。

     *note Availability: 234c.: 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: 234c.: Linux.

     Added in version 3.9.

 -- データ: time.CLOCK_THREAD_CPUTIME_ID

     スレッド固有の CPU タイムクロックです。

     *note Availability: 234c.: 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: 234c.: 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: 234c.: macOS >= 10.12.

     Added in version 3.8.

 -- データ: time.CLOCK_UPTIME_RAW_APPROX

     Like *note CLOCK_UPTIME_RAW: e0a, but the value is cached by the
     system at context switches and therefore has less accuracy.

     *note Availability: 234c.: macOS >= 10.12.

     Added in version 3.13.

The following constant is the only parameter that can be sent to *note
clock_settime(): 151f.

 -- データ: time.CLOCK_REALTIME

     Real-time clock.  Setting this clock requires appropriate
     privileges.  The clock is the same for all processes.

     *note Availability: 234c.: 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: 33b9, *note
     daylight: 33ba, *note timezone: 33bb, and *note tzname: 33bc.), the
     value is determined by the timezone rules in effect at module load
     time or the last time *note tzset(): 33af. is called and may be
     incorrect for times in the past.  It is recommended to use the
     *note tm_gmtoff: 33a2. and *note tm_zone: 33a3. results from *note
     localtime(): 18b1. to obtain timezone information.

参考
....

*note datetime: 33. モジュール

     日付と時刻に対する、よりオブジェクト指向のインターフェースです。

*note locale: 89. モジュール

     国際化サービスです。ロケールの設定は *note strftime(): 15a8. および
     *note strptime(): 17e5. の多くの書式指定子の解釈に影響を及ぼします
     。

*note calendar: 15. モジュール

     一般的なカレンダーに関する関数群です。*note timegm(): 2b73. はこの
     モジュールの *note gmtime(): 157e. の逆を行う関数です。

脚注
....


File: python.info,  Node: logging --- Python 用のログ記録手段,  Next: logging config --- ログ記録の環境設定,  Prev: time --- 時刻データへのアクセスと変換,  Up: 汎用オペレーティングシステムサービス

5.17.4 ‘logging’ -- Python 用のログ記録手段
-------------------------------------------

'ソースコード:' Lib/logging/__init__.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 15b4.

   * *note 上級チュートリアル: 15b5.

   * *note ロギングクックブック: 15b6.

__________________________________________________________________

このモジュールは、アプリケーションやライブラリのための柔軟なエラーログ記
録 (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(): dc6. は、多くのユースケースを上手に扱うことのできる簡便な
ルートロガーの構成方法を提供します。

このモジュールは、多くの機能性と柔軟性を提供します。ロギングに慣れていな
いなら、使い方を理解する最良の方法はチュートリアルを読むことです ('右上
のリンクを参照してください')。

モジュールで定義されている基本的なクラスと、その属性およびメソッドを以下
に列挙します。

   * ロガーは、アプリケーションコードが直接使うインターフェースを公開し
     ます。

   * ハンドラは、(ロガーによって生成された) ログ記録を適切な送信先に送り
     ます。

   * フィルタは、どのログ記録を出力するかを決定する、きめ細かい機能を提
     供します。

   * フォーマッタは、ログ記録が最終的に出力されるレイアウトを指定します
     。

* Menu:

* ロガーオブジェクト::
* ロギングレベル::
* ハンドラオブジェクト::
* フォーマッタオブジェクト::
* フィルタオブジェクト::
* LogRecord オブジェクト::
* LogRecord 属性::
* LoggerAdapter オブジェクト::
* スレッドセーフ性::
* モジュールレベルの関数::
* モジュールレベル属性::
* warnings モジュールとの統合::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/logging/__init__.py


File: python.info,  Node: ロガーオブジェクト,  Next: ロギングレベル,  Up: logging --- Python 用のログ記録手段

5.17.4.1 ロガーオブジェクト
...........................

ロガーには以下のような属性とメソッドがあります。 ロガーを直接インスタン
ス化することは '絶対に' してはならず、常にモジュール関数
‘logging.getLogger(name)’ を介してインスタンス化することに注意してくださ
い。 同じ name で *note getLogger(): d2e. を複数回呼び出すと、常に同じロ
ガー・オブジェクトへの参照が返されます。

‘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(): d2e. を呼び出すときに渡された値です。

               注釈: この属性は読み出し専用として扱われるべきです。

      -- の属性: level

          *note setLevel(): 184b. メソッドで設定された、このロガーのしき
          い値です。

               注釈: この属性を直接設定しないでください - *note
               setLevel(): 184b. は渡されたレベルをチェックする機能を持
               っていますので、常にこのメソッドを使うようにしてください
               。

      -- の属性: 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(): 33c6. と *note
               removeHandler(): 33c7. の2つのメソッドを介して変更されま
               す。これらのメソッドはスレッドセーフな処理を保証するため
               にロックを活用します。

      -- の属性: disabled

          この属性は、いかなるイベントの処理も作動しないようにします。イ
          ニシャライザはこの属性に ‘False’ を設定します。また、この属性
          はロギングを設定するコードによってのみ変更されます。

               注釈: この属性は読み出し専用として扱われるべきです。

      -- メソッド: setLevel (level)

          このロガーの閾値を 'level' に設定します。 'level' よりも深刻で
          ないログメッセージは無視されます; 深刻さが 'level' 以上のログ
          メッセージは、ハンドラのレベルが 'level' より上に設定されてい
          ない限り、このロガーに取り付けられているハンドラによって投げら
          れます。

          ロガーが生成された際、レベルは *note NOTSET: 33c9. (これにより
          すべてのメッセージについて、ロガーがルートロガーであれば処理さ
          れる、そうでなくてロガーが非ルートロガーの場合には親ロガーに委
          譲させる) に設定されます。 ルートロガーは *note WARNING: 22ee.
          レベルで生成されることに注意してください。

          「親ロガーに委譲」という用語の意味は、もしロガーのレベルが
          NOTSET ならば、祖先ロガーの系列の中を NOTSET 以外のレベルの祖
          先を見つけるかルートに到達するまで辿っていく、ということです。

          もし NOTSET 以外のレベルの祖先が見つかったなら、その祖先のレベ
          ルが探索を開始したロガーの実効レベルとして扱われ、ログイベント
          がどのように処理されるかを決めるのに使われます。

          ルートに到達した場合、ルートのレベルが NOTSET ならばすべてのメ
          ッセージは処理されます。そうでなければルートのレベルが実効レベ
          ルとして使われます。

          レベルの一覧については *note ロギングレベル: a4f. を参照してく
          ださい。

          バージョン 3.2 で変更: 'level' パラメータは、 *note INFO:
          22ed. のような整数定数の代わりに 'INFO' のようなレベルの文字列
          表現も受け付けるようになりました。ただし、レベルは内部で整数と
          して保存されますし、 *note getEffectiveLevel(): 33ca. や *note
          isEnabledFor(): 16b0. といったメソッドは、整数を返し、また渡さ
          れるものと期待します。

      -- メソッド: isEnabledFor (level)

          深刻度が 'lvl' のメッセージが、このロガーで処理されることにな
          っているかどうかを示します。このメソッドはまず、
          ‘logging.disable(level)’ で設定されるモジュールレベルの深刻度
          レベルを調べ、次にロガーの実効レベルを *note
          getEffectiveLevel(): 33ca. で調べます。

      -- メソッド: getEffectiveLevel ()

          このロガーの実効レベルを示します。 *note NOTSET: 33c9. 以外の
          値が *note setLevel(): 184b. で設定されていた場合、その値が返
          されます。そうでない場合、 ‘NOTSET’ 以外の値が見つかるまでロガ
          ーの階層をルートロガーの方向に追跡します。見つかった場合、その
          値が返されます。返される値は整数で、典型的には *note
          logging.DEBUG: 22ec, *note logging.INFO: 22ed. 等のうち一つで
          す。

      -- メソッド: 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: 22ec. のメッセージをこのロガーで記録します
          。 'msg' はメッセージの書式文字列で、 'args' は 'msg' に文字列
          書式化演算子を使って取り込むための引数です。 (これは、書式化文
          字列の中でキーワードを使い、引数として単一の辞書を渡すことがで
          きる、ということを意味します。) 'args' が提供されない場合は
          'msg' の%フォーマットは実行されません。

          'kwargs' のうち、 'exc_info', 'stack_info', 'stacklevel',
          'extra' という4つのキーワード引数の中身を調べます。

          'exc_info' は、この値の評価値が false でない場合、例外情報がロ
          ギングメッセージに追加されます。もし例外情報をあらわすタプル
          (*note sys.exc_info(): a7f. 関数によって戻されるフォーマットに
          おいて)、または、例外情報をあらわすインスタンスが与えられてい
          れば、それが使用されることになります。それ以外の場合には、
          ‘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:
          1394. 内で行番号と関数名を算出する時に、指定されたスタックフレ
          ームの数をスキップします。これはログヘルパー内部で使われる場合
          、関数名、ファイル名、行番号はそのヘルパーの情報ではなく、その
          ヘルパーを呼び出した呼び出し元のものになります。このパラメータ
          の名前は *note warnings: 11b. モジュールと同じものになります。

          4番目のキーワード引数は 'extra' で、ロギングイベントの際に作ら
          れる *note LogRecord: 1394. の *note __dict__: 1ca. 属性に、ユ
          ーザー定義の属性を追加するための辞書を渡すのに使うことができま
          す。これら追加の属性は、好きなように使うことができます。たとえ
          ば、それらをログメッセージに埋め込むことができます。使用例:

               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 属性: 33cb. の節を参照してください。)

          これらの属性をログメッセージに使うことにしたなら、少し注意が必
          要です。上の例では、 'clientip' と 'user' が *note LogRecord:
          1394. の属性辞書に含まれていることを期待した書式文字列で *note
          Formatter: 184f. がセットアップされています。もしこれらが欠け
          ていると、書式化例外が発生してしまうためメッセージはログに残り
          ません。したがってこの場合、常にこれらのキーを含む 'extra' 辞
          書を渡す必要があります。

          このようなことは煩わしいかもしれませんが、この機能は限定された
          場面で使われるように意図しているものなのです。たとえば同じコー
          ドがいくつものコンテキストで実行されるマルチスレッドのサーバで
          、興味のある条件が現れるのがそのコンテキストに依存している (上
          の例で言えば、リモートのクライアント IP アドレスや認証されたユ
          ーザ名など)、というような場合です。そういった場面では、それ用
          の *note Formatter: 184f. が特定の *note Handler: 184e. と共に
          使われるというのはよくあることです。

          このロガー (および *note Logger.propagate: 184d. 属性を考慮し
          た上で実効的にイベントが伝播する祖先のロガー) にハンドラが接続
          されていない場合、メッセージは *note lastResort: 15b9. に設定
          されたハンドラーに送られます。

          バージョン 3.2 で変更: 'stack_info' パラメータが追加されました
          。

          バージョン 3.5 で変更: 'exc_info' パラメータは例外インスタンス
          を受け入れることが可能です。

          バージョン 3.8 で変更: 'stacklevel' 引数が追加されました。

      -- メソッド: info (msg, *args, **kwargs)

          レベル *note INFO: 22ed. のメッセージをこのロガーで記録します
          。引数は *note debug(): 33cc. と同じように解釈されます。

      -- メソッド: warning (msg, *args, **kwargs)

          レベル *note WARNING: 22ee. のメッセージをこのロガーで記録しま
          す。引数は *note debug(): 33cc. と同じように解釈されます。

               注釈: ‘warning’ と機能的に等価な古いメソッド ‘warn’ があ
               ります。‘warn’ は廃止予定なので使わないでください - 代わ
               りに ‘warning’ を使ってください。

      -- メソッド: error (msg, *args, **kwargs)

          レベル *note ERROR: 22ef. のメッセージをこのロガーで記録します
          。引数は *note debug(): 33cc. と同じように解釈されます。

      -- メソッド: critical (msg, *args, **kwargs)

          レベル *note CRITICAL: 22f0. のメッセージをこのロガーで記録し
          ます。引数は *note debug(): 33cc. と同じように解釈されます。

      -- メソッド: log (level, msg, *args, **kwargs)

          整数で表したレベル 'level' のメッセージをこのロガーで記録しま
          す。その他の引数は *note debug(): 33cc. と同じように解釈されま
          す。

      -- メソッド: exception (msg, *args, **kwargs)

          レベル *note ERROR: 22ef. のメッセージをこのロガーで記録します
          。引数は *note debug(): 33cc. と同じように解釈されます。例外情
          報がログメッセージに追加されます。このメソッドは例外ハンドラか
          らのみ呼び出されるべきです。

      -- メソッド: 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(): 33cc. や他のAPIを呼び
          出すコードから渡されます。もしこれが1よりも大きい場合は、その
          超過分は返す値を決定する前にスタックフレームをスキップする数と
          して利用されます。これは通常、ログAPIをヘルパーやラッパー経由
          で呼び出す場合に便利です。こうすることで、イベントログに記録さ
          れる情報はヘルパーやラッパーのコードではなく、それらを呼び出し
          ているコードのものとなります。

      -- メソッド: handle (record)

          レコードを、このロガーおよびその上位ロガー (ただし 'propagate'
          の値が false になったところまで) に関連付けられているすべての
          ハンドラに渡して処理します。このメソッドは、ローカルで生成され
          たレコードだけでなく、ソケットから受信した unpickle されたレコ
          ードに対しても同様に用いられます。 *note filter(): 33d0. によ
          って、ロガーレベルでのフィルタが適用されます。

      -- メソッド: makeRecord (name, level, fn, lno, msg, args,
               exc_info, func=None, extra=None, sinfo=None)

          このメソッドは、特殊な *note LogRecord: 1394. インスタンスを生
          成するためにサブクラスでオーバライドできるファクトリメソッドで
          す。

      -- メソッド: 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:
184e. は直接インスタンス化されることはありません; このクラスはより便利な
サブクラスの基底クラスとして働きます。しかしながら、サブクラスにおける
‘__init__()’ メソッドでは、 *note Handler.__init__(): 33d8. を呼び出す必
要があります。

 -- クラス: logging.Handler

      -- メソッド: __init__ (level=NOTSET)

          レベルを設定して、 *note Handler: 184e. インスタンスを初期化し
          ます。空のリストを使ってフィルタを設定し、 I/O 機構へのアクセ
          スを直列化するために (*note createLock(): 33d9. を使って) ロッ
          クを生成します。

      -- メソッド: createLock ()

          スレッドセーフでない背後の I/O 機能に対するアクセスを直列化す
          るために用いられるスレッドロック (thread lock) を初期化します
          。

      -- メソッド: acquire ()

          *note createLock(): 33d9. で生成されたスレッドロックを獲得しま
          す。

      -- メソッド: release ()

          *note acquire(): 33da. で獲得したスレッドロックを解放します。

      -- メソッド: setLevel (level)

          このハンドラに対する閾値を 'level' に設定します。 'level' より
          も深刻でないログメッセージは無視されます。 ハンドラが生成され
          た際、レベルは *note NOTSET: 33c9. (すべてのメッセージが処理さ
          れる) に設定されます。

          レベルの一覧については *note ロギングレベル: a4f. を参照してく
          ださい。

          バージョン 3.2 で変更: 'level' パラメータは、 *note INFO:
          22ed. のような整数定数の代わりに 'INFO' のようなレベルの文字列
          表現も受け付けるようになりました。

      -- メソッド: setFormatter (fmt)

          Sets the formatter for this handler to 'fmt'.  The 'fmt'
          argument must be a *note Formatter: 184f. 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(): 33e5. の呼び出し中に例外に遭遇
          した際にハンドラから呼び出されることを想定しています。モジュー
          ルレベルの属性 *note raiseExceptions: 15b8. が ‘False’ の場合
          、例外は静かに無視されます。これは、ほとんどの場合でロギングシ
          ステムに期待される挙動です - なぜなら、ほとんどのユーザーはロ
          ギングシステムの中で起こったエラーなどに興味はなく、アプリケー
          ションエラーの方により関心があるからです。しかし、必要ならばこ
          の挙動を自作のハンドラで置き換えることができます。引数に指定さ
          れたレコードは例外発生時に処理されるものです。
          (‘raiseExceptions’ のデフォルト値は、開発中にはその方が便利な
          ので、 ‘True’ です)。

      -- メソッド: format (record)

          レコードに対する書式化を行います - フォーマッタが設定されてい
          れば、それを使います。そうでない場合、モジュールにデフォルト指
          定されたフォーマッタを使います。

      -- メソッド: emit (record)

          指定されたログ記録レコードを実際にログ記録する際のすべての処理
          を行います。このメソッドはサブクラスで実装されることを意図して
          おり、そのためこのクラスのバージョンは *note
          NotImplementedError: 5a1. を送出します。

               警告: このメソッドはハンドラレベルのロックを取得した後で
               呼び出されます。また、ロックはこのメソッドがリターンした
               後で解放されます。このメソッドをオーバーライドする場合、
               ロックを取得する可能性のある logging API の他の関数やメソ
               ッドの呼び出しに注意してください。そのような実装はデッド
               ロックを引き起こす可能性があります。特に以下の点に注意し
               てください:

                  * ロギングを構成するための API はモジュールレベルのロ
                    ックを取得し、その後ハンドラを構成する際に個々のハン
                    ドラに対してハンドラレベルのロックを取得します。

                  * 多くのロギング API はモジュールレベルのロックを取得
                    します。そのような API がこのメソッドから呼ばれた場
                    合、他のスレッドからロギングを構成するための API 呼
                    び出しが行われたときにデッドロックに陥る可能性があり
                    ます。これは他のスレッドがハンドラレベルのロックを取
                    得する '前に' モジュールレベルのロックを取得しようと
                    する一方で、 (このメソッドはハンドラレベルのロックが
                    既に取得された状態で呼び出されているため) このメソッ
                    ドを呼び出したスレッドはハンドラレベルのロックを取得
                    した '後で' モジュールレベルのロックを取得しようとす
                    るためです。

標準として含まれているハンドラについては、 *note logging.handlers: 8c. を
参照してください。


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: 1394. を、人間または外部のシステムが解釈可能な出力
     文字列に変換する責任を持ちます。


     パラメータ:

        * ‘fmt’ (*note str: 1ea.) - 'style' で指定された書式にもとづく、
          出力ログ全体に対する書式文字列です。マッピングのキーは *note
          LogRecord: 1394. オブジェクトの *note LogRecord 属性: 33cb. か
          ら取り出されます。特に指定がない場合は、ログメッセージをあらわ
          す ‘'%(message)s'’ が使われます。

        * ‘datefmt’ (*note str: 1ea.) - A format string for the
          date/time portion of the logged output.  If not specified, the
          default described in *note formatTime(): 33e9. is used.

        * ‘style’ (*note str: 1ea.) - ‘'%'’, または ‘'$'’ のいずれかで、
          書式文字列がログデータとどのようにマージされるかを決めます:
          *note printf 形式の文字列書式化: abe. (‘%’), *note
          str.format(): a17. (‘{’) または *note string.Template: a7c. ()
          のいずれかを使います。この引数は 'fmt' だけに適用されます (た
          とえば ‘'%(message)s'’ に対して ‘'{message}'’) が、ロギングメ
          ソッドに渡された実際のログメッセージには適用されません。いっぽ
          う、 ‘'{'’ や ‘$’ を使ってログメッセージをフォーマットする
          *note 他の方法: 33ea. も存在します。

        * ‘validate’ (*note bool: 5f6.) - ‘True’ が指定されると (デフォ
          ルト) 、 'fmt' と 'style' が不正な場合や、それらが不適切な組み
          合わせだった場合に *note ValueError: 15a. 例外を送出します; た
          とえば ‘logging.Formatter('%(asctime)s - %(message)s',
          style='{')’ は例外となります。

        * ‘defaults’ (*note dict: 193.‘[’*note str: 1ea.‘, ’‘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(): 33e9. が呼び出
          され、イベントの発生時刻を書式化します。例外情報が存在する場合
          、 *note formatException(): 33ec. を使って書式化され、メッセー
          ジに追加されます。ここで注意していただきたいのは、書式化された
          例外情報は 'exc_text' にキャッシュされるという点です。これが有
          用なのは例外情報がピックル化されて回線上を送ることができるから
          ですが、しかし二つ以上の *note Formatter: 184f. サブクラスで例
          外情報の書式化をカスタマイズしている場合には注意が必要になりま
          す。この場合、フォーマッタが書式化を終えるごとにキャッシュをク
          リアして（ 'ext_text' 属性に ‘None’ を設定して）、次のフォーマ
          ッタがキャッシュされた値を使わずに新鮮な状態で再計算するように
          しなければならないことになります。

          スタック情報が利用可能な場合、(必要ならば *note formatStack():
          33ed. を使って整形した上で) スタック情報が例外情報の後に追加さ
          れます。

      -- メソッド: formatTime (record, datefmt=None)

          このメソッドは、フォーマッタが書式化された時間を利用したい際に
          、 *note format(): 440. から呼び出されます。 このメソッドは特
          定の要求を提供するためにフォーマッタで上書きすることができます
          が、基本的な振る舞いは以下のようになります: 'datefmt' (文字列)
          が指定された場合、レコードが生成された時刻を書式化するために
          *note time.strftime(): 15a8. で使われます。 そうでない場合、
          '%Y-%m-%d %H:%M:%S,uuu' というフォーマットが使われます。 uuu 部
          分はミリ秒値で、それ以外の文字は ‘time.strftime()’ ドキュメン
          トに従います。 このフォーマットの時刻の例は ‘2003-01-23
          00:29:50,411’ です。 結果の文字列が返されます。

          この関数は、ユーザが設定できる関数を使って、生成時刻をタプルに
          変換します。デフォルトでは、 *note time.localtime(): 18b1. が
          使われます。特定のフォーマッタインスタンスに対してこれを変更す
          るには、 ‘converter’ 属性を ‘time.localtime()’ や *note
          time.gmtime(): 157e. と同じ署名をもつ関数に設定してください。
          すべてのフォーマッタインスタンスに対してこれを変更するには、例
          えば全てのロギング時刻を 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(): a7f. が返すような標
          準例外のタプル) を文字列として書式化します。デフォルトの実装は
          単に *note traceback.print_exception(): c2b. を使います。結果
          の文字列が返されます。

      -- メソッド: formatStack (stack_info)

          指定されたスタック情報を文字列としてフォーマットします (*note
          traceback.print_stack(): 123a. によって返される文字列ですが、
          最後の改行が取り除かれています)。このデフォルト実装は、単に入
          力値をそのまま返します。

 -- クラス: logging.BufferingFormatter (linefmt=None)

     複数のレコードをまとめてフォーマットしたい場合のクラス定義に適した
     基底クラスです。各行 (単一のレコードに相当します) をフォーマットす
     るために使う *note Formatter: 184f. インスタンスを渡すことができま
     す。特に指定がない場合はデフォルトのフォーマッタ (イベントのメッセ
     ージだけを出力するフォーマッタ) が使われます。

      -- メソッド: 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: 15ba. クラスのインスタンスを返します。 'name' が指定
     されていれば、 'name' はロガーの名前を表します。指定されたロガーと
     その子ロガーのイベントがフィルタを通過できるようになります。 'name'
     が指定されなければ、すべてのイベントを通過させます。

      -- メソッド: filter (record)

          指定されたログレコードは記録されるでしょうか？答えが「いいえ」
          なら false を、「はい」なら true を返します。フィルタは受け取
          ったログレコードそのものを編集したり、その後のイベント処理にお
          いて元のログレコードに取って代わる、まったく異なるログレコード
          インスタンスを返す可能性があります。

ハンドラに対するフィルタはハンドラがイベントを発行する前に試され、一方で
はロガーに対するフィルタは、イベントが(*note debug(): 33cc, *note
info(): 33f5. などによって)ロギングされる際には、ハンドラにイベントが送
信される前にはいつでも試されることに注意してください。そのフィルタがそれ
ら子孫ロガーにも適用されていない限り、子孫ロガーによって生成されたイベン
トはロガーのフィルタ設定によってフィルタされることはありません。

実際には、‘Filter’ をサブクラス化する必要はありません。同じ意味の
‘filter’ メソッドを持つ、すべてのインスタンスを通せます。

バージョン 3.2 で変更: 特殊な ‘Filter’ クラスを作ったり、 ‘filter’ メソ
ッドを持つ他のクラスを使う必要はありません: 関数 (あるいは他の callable)
をフィルタとして使用することができます。フィルタロジックは、フィルタオブ
ジェクトが ‘filter’ 属性を持っているかどうかチェックします: もし
‘filter’ 属性を持っていたら、それは ‘Filter’ であると仮定され、その
*note filter(): 33f4. メソッドが呼び出されます。そうでなければ、それは
callable であると仮定され、レコードを単一のパラメータとして呼び出されま
す。返される値は ‘filter()’ によって返されるものと一致すべきです。

バージョン 3.12 で変更: 受け取ったログレコード自体を編集する代わりに、元
のログレコードに取って代わる別の *note LogRecord: 1394. インスタンスを返
すことができるようになりました。これにより、 *note Handler: 184e. にアタ
ッチされたフィルタが、他のハンドラへの副作用を伴うことなく、発行前にログ
レコードを編集することが可能になります。

フィルタは本来、レコードをレベルよりも洗練された基準に基づいてフィルタす
るために使われますが、それが取り付けられたハンドラやロガーによって処理さ
れるレコードをすべて監視します。これは、特定のロガーやハンドラに処理され
たレコードの数を数えたり、処理されている *note LogRecord: 1394. の属性を
追加、変更、削除したりするときに便利です。もちろん、LogRecord を変更する
には注意が必要ですが、これにより、ログにコンテキスト情報を注入できます
(*note Filter を使ったコンテキスト情報の伝達: 33f6. を参照してください
)。


File: python.info,  Node: LogRecord オブジェクト,  Next: LogRecord 属性,  Prev: フィルタオブジェクト,  Up: logging --- Python 用のログ記録手段

5.17.4.6 LogRecord オブジェクト
...............................

*note LogRecord: 1394. インスタンスは、何かをログ記録するたびに *note
Logger: f10. によって生成されます。また、 *note makeLogRecord(): 33f9. を
通して (例えば、ワイヤを通して受け取られた pickle 化されたイベントから)
手動で生成することも出来ます。

 -- クラス: logging.LogRecord (name, level, pathname, lineno, msg, args,
          exc_info, func=None, sinfo=None)

     ロギングされているイベントに適切なすべての情報を含みます。

     もっとも重要な情報は 'msg' と 'args' に渡され、 ‘msg % args’ で結合
     されてレコードの ‘message’ 属性を生成します。


     パラメータ:

        * ‘name’ (*note str: 1ea.) - この ‘LogRecord’ であらわされるイベ
          ントを記録したロガーの名前です。 ‘LogRecord’ が持つロガーの名
          前は、たとえ異なる (祖先の) ロガーに接続されたハンドラから出力
          されたとしても、常に同じ値を持つことに注意してください。

        * ‘level’ (*note int: 32e.) - 記録されたイベントの *note
          数値であらわしたロギングレベル: a4f. (‘10’ が ‘DEBUG’, ‘20’ が
          ‘INFO’ など) です。このパラメータは LogRecord の '2つの' 属性
          に変換されることに注意してください: 数値は ‘levelno’ に、また
          対応するログレベルの名前は ‘levelname’ に保持されます。

        * ‘pathname’ (*note str: 1ea.) - ロギングの呼び出しが行われたソ
          ースファイルへの完全なパス名をあらわす文字列です。

        * ‘lineno’ (*note int: 32e.) - ロギングの呼び出しが発せられたソ
          ース行番号。

        * ‘msg’ (*note Any: a9f.) - イベントの説明メッセージ。様々なデー
          タのプレースホルダを含んだ %フォーマット文字列か、任意のオブジ
          ェクト (*note 任意のオブジェクトをメッセージに使用する: 33fa.
          を参照)。

        * ‘args’ (*note tuple: 1d9.‘ | ’*note dict: 193.‘[’*note str:
          1ea.‘, ’*note Any: a9f.‘]’) - 'msg' 引数と組み合わせてイベント
          記述を得るための変数データです。

        * ‘exc_info’ (*note tuple: 1d9.‘[’*note type: 191.‘[’*note
          BaseException: 9bd.‘]’‘, ’‘BaseException’‘, ’*note
          types.TracebackType: ebc.‘] ’‘| ’‘None’) - *note
          sys.exc_info(): a7f. によって返される現在の例外情報を含む例外
          タプルです。例外情報がない場合は ‘None’ です。

        * ‘func’ (*note str: 1ea.‘ | ’‘None’) - ロギングの呼び出しを行っ
          た関数またはメソッドの名前です。

        * ‘sinfo’ (*note str: 1ea.‘ | ’‘None’) - 現在のスレッドのスタッ
          クベースからログ呼び出しまでの間のスタック情報を表わすテキスト
          文字列。

      -- メソッド: getMessage ()

          ユーザが提供した引数をメッセージに交ぜた後、この *note
          LogRecord: 1394. インスタンスへのメッセージを返します。ユーザ
          がロギングの呼び出しに与えた引数が文字列でなければ、その引数に
          *note str(): 1ea. が呼ばれ、文字列に変換されます。これにより、
          ‘__str__’ メソッドが実際のフォーマット文字列を返せるようなユー
          ザ定義のクラスをメッセージとして使えます。

     バージョン 3.2 で変更: *note LogRecord: 1394. の生成は、レコードを
     生成するために使用されるファクトリを提供することにより、さらに設定
     可能になりました。ファクトリは *note getLogRecordFactory(): 33fc. と
     *note setLogRecordFactory(): 33fd. を使用して設定することができます
     (ファクトリのシグネチャに関しては ‘setLogRecordFactory()’ を参照)。

     この機能を使うと *note LogRecord: 1394. の生成時に独自の値を注入す
     ることができます。次のパターンが使えます:

          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(): a17.) を使用していれば、書式文字列
の中でプレースホールダーとして ‘{attrname}’ を使うことができます。 $-フ
ォーマット (*note string.Template: a7c.) を使用している場合は、
‘${attrname}’ 形式にしてください。もちろん、両方の場合で ‘attrname’ は使
用したい実際の属性名に置き換えてください。

{}-フォーマットの場合には、属性名の後にフォーマットフラグを指定すること
ができます。属性名とフォーマットフラグの間はコロンで分割します。例: プレ
ースホールダー ‘{msecs:03.0f}’ は、ミリセカンド値 ‘4’ を ‘004’ としてフ
ォーマットします。利用可能なオプション上の全詳細に関しては *note
str.format(): a17. ドキュメンテーションを参照してください。

属性名               フォーマット                  説明
                                                   
-------------------------------------------------------------------------------------------------------
                                                   
‘args’               このフォーマットを自分で使    ‘msg’ に組み合わせて ‘message’ を生成するための引
                     う必要はないでしょう。        数のタプル、または、マージに用いられる辞書(引数が
                                                   一つしかなく、かつそれが辞書の場合)。
                                                   
                                                   
asctime              ‘%(asctime)s’                 *note LogRecord: 1394. が生成された時刻を人間が読
                                                   める書式で表したもの。デフォルトでは "2003-07-08
                                                   16:49:45,896" 形式 (コンマ以降の数字は時刻のミリ
                                                   秒部分) です。
                                                   
                                                   
created              ‘%(created)f’                 *note LogRecord: 1394. が生成された時刻です
                                                   (*note time.time_ns(): eb2. / 1e9 で返される形式
                                                   で)。
                                                   
                                                   
exc_info             このフォーマットを自分で使    (‘sys.exc_info’ 風の) 例外タプルか、例外が起こっ
                     う必要はないでしょう。        ていない場合は ‘None’。
                                                   
                                                   
exc_text             このフォーマットを自分で使    Exception information formatted as a string.
                     う必要はないでしょう。        This is set when *note Formatter.format(): 33eb.
                                                   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: 22ec, *note INFO: 22ed,
                                                   *note WARNING: 22ee, *note ERROR: 22ef,
                                                   *note CRITICAL: 22f0.)。
                                                   
                                                   
lineno               ‘%(lineno)d’                  ロギングの呼び出しが発せられたソース行番号 (利用
                                                   できる場合のみ)。
                                                   
                                                   
message              ‘%(message)s’                 ‘msg % args’ として求められた、ログメッセージ。
                                                   *note Formatter.format(): 33eb. が呼び出されたと
                                                   きに設定されます。
                                                   
                                                   
module               ‘%(module)s’                  モジュール (‘filename’ の名前部分)。
                                                   
                                                   
msecs                ‘%(msecs)d’                   *note LogRecord: 1394. が生成された時刻のミリ秒部
                                                   分。
                                                   
                                                   
msg                  このフォーマットを自分で使    元のロギングの呼び出しで渡されたフォーマット文字
                     う必要はないでしょう。        列。 ‘args’ と合わせて、 ‘message’ 、または任意の
                                                   オブジェクトを生成します
                                                   (*note 任意のオブジェクトをメッセージに使用する: 33fa.
                                                   参照)。
                                                   
                                                   
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: 467. 名 (利用可能な場合のみ
                                                   )。
                                                   

バージョン 3.1 で変更: 'processName' が追加されました。

バージョン 3.12 で変更: 'taskName' が追加されました。


File: python.info,  Node: LoggerAdapter オブジェクト,  Next: スレッドセーフ性,  Prev: LogRecord 属性,  Up: logging --- Python 用のログ記録手段

5.17.4.8 LoggerAdapter オブジェクト
...................................

*note LoggerAdapter: 16af. インスタンスは文脈情報をログ記録呼び出しに渡
すのを簡単にするために使われます。使い方の例は *note
コンテキスト情報をログ記録出力に付加する: 3401. を参照してください。

 -- クラス: logging.LoggerAdapter (logger, extra=None,
          merge_extra=False)

     Returns an instance of ‘LoggerAdapter’ initialized with an
     underlying *note Logger: f10. 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: 16af. は上記に加え *note Logger: f10. のメソッ
     ド *note debug(): 11e2, *note info(): 22eb, *note warning(): 1c99,
     *note error(): 33cd, *note exception(): 11e0, *note critical():
     11e1, *note log(): 11df, *note isEnabledFor(): 16b0, *note
     getEffectiveLevel(): 33ca, *note setLevel(): 184b, *note
     hasHandlers(): 33d4. をサポートします。これらは ‘Logger’ の対応する
     メソッドと同じシグニチャを持つため、2つのインスタンスは区別せずに利
     用出来ます。

     バージョン 3.2 で変更: *note isEnabledFor(): 16b0, *note
     getEffectiveLevel(): 33ca, *note setLevel(): 184b, *note
     hasHandlers(): 33d4. が *note LoggerAdapter: 16af. に追加されました
     。これらメソッドは元のロガーに処理を委譲します。

     バージョン 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: ce. モジュールを使用して非同期シグナルハンドラを実装してい
る場合、そのようなハンドラからはログ記録を使用できないかもしれません。こ
れは、 *note threading: f6. モジュールにおけるロック実装が常にリエントラ
ントではなく、そのようなシグナルハンドラから呼び出すことができないからで
す。


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 ロガーオブジェクト: 33c0. で言及されている通り、特に理由が
     なければ ‘__name__’ を使うことが推奨されます。

     与えられた名前に対して、この関数はどの呼び出しでも同じロガーインス
     タンスを返します。したがって、ロガーインスタンスをアプリケーション
     の各部でやりとりする必要はありません。

 -- の関数: logging.getLoggerClass ()

     標準の *note Logger: f10. クラスか、最後に *note setLoggerClass():
     3408. に渡したクラスを返します。この関数は、新たなクラス定義の中で
     呼び出して、カスタマイズした ‘Logger’ クラスのインストールが既に他
     のコードで適用したカスタマイズを取り消さないことを保証するために使
     われることがあります。例えば以下のようにします:

          class MyLogger(logging.getLoggerClass()):
              # ... override behaviour here

 -- の関数: logging.getLogRecordFactory ()

     *note LogRecord: 1394. を生成するのに使われる callable を返します。

     Added in version 3.2: この関数は、ログイベントを表現する *note
     LogRecord: 1394. の構築方法に関して開発者により多くのコントロールを
     与えるため、 *note setLogRecordFactory(): 33fd. とともに提供されま
     した。

     このファクトリがどのように呼ばれるかに関する詳細は *note
     setLogRecordFactory(): 33fd. を参照してください。

 -- の関数: logging.debug (msg, *args, **kwargs)

     ルートロガーの *note Logger.debug(): 11e2. メソッドを呼び出す便利関
     数です。引数の取り扱いはあらゆる点で当該メソッドと同じです。

     唯一の違いはルートロガーがハンドラを持たない場合で、この場合はルー
     トロガーの ‘debug’ メソッドを呼び出す前に *note basicConfig(): dc6.
     が呼ばれます。

     非常に短いスクリプトや ‘logging’ の機能についての簡単なデモに対して
     は、 ‘debug’ やその他のモジュールレベル関数は便利でしょう。しかしな
     がら、ほとんどのプログラムはロギングの設定を慎重かつ明示的に制御し
     たいはずです。したがって、このドキュメントの最初に書かれているとお
     り、モジュールレベルのロガーを生成してそのロガーに対する *note
     Logger.debug(): 11e2. メソッド (または他のログレベル固有のメソッド)
     を呼び出す方を好むでしょう。

 -- の関数: logging.info (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note INFO: 22ed. でメッセージを記録
     します。引数と振る舞いは、ログレベルを除けば *note debug(): 33cc. と
     同じです。

 -- の関数: logging.warning (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note WARNING: 22ee. でメッセージを
     記録します。引数と振る舞いは、ログレベルを除けば *note debug():
     33cc. と同じです。

          注釈: ‘warning’ と機能的に等価な古い関数 ‘warn’ があります。
          ‘warn’ は廃止予定なので使わないでください - 代わりに ‘warning’
          を使ってください。

 -- の関数: logging.error (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note ERROR: 22ef. でメッセージを記
     録します。引数と振る舞いは、ログレベルを除けば *note debug(): 33cc.
     と同じです。

 -- の関数: logging.critical (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note CRITICAL: 22f0. でメッセージを
     記録します。引数と振る舞いは、ログレベルを除けば *note debug():
     33cc. と同じです。

 -- の関数: logging.exception (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note ERROR: 22ef. でメッセージを記
     録します。引数と振る舞いは、ログレベルを除けば *note debug(): 33cc.
     と同じです。例外情報がログメッセージに追加されます。この関数は例外
     ハンドラからのみ呼び出されるべきです。

 -- の関数: logging.log (level, msg, *args, **kwargs)

     ルートロガーに対して 'level' で指定したログレベルでメッセージを記録
     します。引数と振る舞いは、ログレベルを除けば *note debug(): 33cc. と
     同じです。

 -- の関数: 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: 184f. でメッセージを書式化する
     際のように、数字のレベルをテキスト表現に対応付ける際に用いられます
     。この関数は自作のレベルを定義するために使うこともできます。使われ
     るレベルに対する唯一の制限は、レベルは正の整数でなくてはならず、メ
     ッセージの深刻度が上がるに従ってレベルの数も上がらなくてはならない
     ということです。

          注釈: 独自のレベルを定義したい場合、 *note カスタムレベル:
          340e. のセクションを参照してください。

 -- の関数: logging.getLevelNamesMapping ()

     ログレベルの名前と対応するログレベルのマッピングを返します。例えば
     、文字列 "CRITICAL" は *note CRITICAL: 22f0. にマップされます。この
     関数が返すマッピングオブジェクトは、関数呼び出しのたびに内部のマッ
     ピングをコピーしたものです。

     Added in version 3.11.

 -- の関数: logging.getLevelName (level)

     テキストまたは数値表現でログレベル 'level' を返してください。

     'level' が定義済みのレベル *note CRITICAL: 22f0, *note ERROR: 22ef,
     *note WARNING: 22ee, *note INFO: 22ed, *note DEBUG: 22ec. のいずれ
     かである場合、対応する文字列が返されます。 *note addLevelName():
     340d. を使ってレベルに名前を関連付けていた場合、 'level' に関連付け
     られた名前が返されます。定義済みのレベルに対応する数値を指定した場
     合、レベルに対応した文字列表現を返します。

     'level' パラメータは、 *note INFO: 22ed. のような整数定数の代わりに
     'INFO' のようなレベルの文字列表現も受け付けます。この場合、この関数
     は関連するレベルの数値表現を返します。

     もし渡された数値や文字列がマッチしなければ、 'Level %s' % level が
     返されます。

          注釈: レベルは内部的には整数です(これはロギングのロジックが大
          小比較をする必要があるからです)。この関数は、数値のレベルを、
          書式記述子 ‘%(levelname)s’ (*note LogRecord 属性: 33cb. 参照
          )によって書式化されるログ出力の表示用レベル名に変換するなどの
          用途に使用されます。

     バージョン 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 in order 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: 1394. イン
     スタンスを生成して返します。この関数は、 pickle された ‘LogRecord’
     属性の辞書をソケットを介して送信し、受信端で ‘LogRecord’ インスタン
     スとして再構成する場合に便利です。

 -- の関数: logging.basicConfig (**kwargs)

     Does basic configuration for the logging system by either creating
     a *note StreamHandler: 15b7. with a default *note Formatter: 184f.
     or using the given 'formatter' instance, and adding it to the root
     logger.  The functions *note debug(): 33cc, *note info(): 33f5,
     *note warning(): 339, *note error(): 3409. and *note critical():
     340a. will call ‘basicConfig()’ automatically if no handlers are
     defined for the root logger.

     この関数は 'force' キーワード引数に ‘True’ が設定されない限り、ルー
     トロガーに設定されたハンドラがあれば何もしません。

          注釈: この関数は、他のスレッドが開始される前にメインスレッドか
          ら呼び出されるべきです。Python の 2.7.1 や 3.2 以前のバージョ
          ンでは、この関数が複数のスレッドから呼ばれると(珍しい状況下と
          はいえ)ハンドラがルートロガーに複数回加えられることがあり、ロ
          グ内のメッセージが重複するという予期しない結果をもたらすことが
          あります。

     以下のキーワード引数がサポートされます。

     フォーマット       説明
                        
     ---------------------------------------------------------------------
                        
     'filename'         *note StreamHandler: 15b7. ではなく指定された名
                        前で *note FileHandler: 1e69. が作られます。
                        
                        
     'filemode'         'filename' が指定された場合、この
                        *note モード: 27f1. でファイルが開かれます。 デ
                        フォルトは ‘'a'’ です。
                        
                        
     'format'           ハンドラーで指定されたフォーマット文字列を使い
                        ます。デフォルトは ‘levelname’, ‘name’,
                        ‘message’ 属性をコロン区切りにしたものです。
                        
                        
     'datefmt'          指定された日時の書式で
                        *note time.strftime(): 15a8. が受け付けるものを
                        使います。
                        
                        
     'style'            'format' が指定された場合、書式文字列にこのスタ
                        イルを仕様します。 ‘'%'’, ‘'{'’, ‘'$'’ のうち
                        1つで、それぞれ *note printf-style: abe,
                        *note str.format(): a17,
                        *note string.Template: a7c. に対応します。 デフ
                        ォルトは ‘'%'’ です。
                        
                        
     'level'            ルートロガーのレベルを指定された
                        *note レベル: a4f. に設定します。
                        
                        
     'stream'           指定されたストリームを
                        *note StreamHandler: 15b7. の初期化に使います。
                        この引数は 'filename' と同時には使えないことに
                        注意してください。 両方が指定されたときには
                        ‘ValueError’ が送出されます。
                        
                        
     'handlers'         もし指定されれば、 これは root ロガーに追加され
                        る既に作られたハンドラのイテラブルになります。
                        まだフォーマッタがセットされていないすべてのハ
                        ンドラは、この関数で作られたデフォルトフォーマ
                        ッタが割り当てられることになります。この引数は
                        'filename' や 'stream' と互換性がないことに注意
                        してください。両方が存在する場合 ‘ValueError’ が
                        上げられます。
                        
                        
     'force'            このキーワード引数が真に設定されている場合、ル
                        ートのロガーに取り付けられたハンドラは全て取り
                        除かれ、他の引数によって指定された設定が有効に
                        なる前に閉じられます。
                        
                        
     'encoding'         もしこのキーワード引数が 'filename' とともに指
                        定された場合、 *note FileHandler: 1e69. が作成
                        されるときにこの値が利用され、出力ファイルを開
                        く時に使用されます。
                        
                        
     'errors'           もしこのキーワード引数が 'filename' とともに指
                        定された場合、 *note FileHandler: 1e69. が作成
                        されるときのこの値が使用され、出力ファイルを開
                        く時に使われます。もし指定されなかった場合、
                        'backslashreplace' が使用されます。もし ‘None’
                        が指定されると *note open(): 333. のように渡さ
                        れ、'errors' を渡したのと同じように扱われます。
                        
                        
     'formatter'        If specified, set this formatter instance (see
                        *note フォーマッタオブジェクト: 33e7.) for all
                        involved handlers.  If not specified, the
                        default is to create and use an instance of
                        *note logging.Formatter: 184f. based on
                        arguments 'format', 'datefmt' and 'style'.
                        When 'formatter' is specified together with any
                        of the three arguments 'format', 'datefmt' and
                        'style', a ‘ValueError’ is raised to signal
                        that these arguments would lose meaning
                        otherwise.
                        

     バージョン 3.2 で変更: 'style' 引数が追加されました。

     バージョン 3.3 で変更: 互換性のない引数が指定された状況 (例えば
     'handlers' が 'stream' や 'filename' と一緒に指定されたり、'stream'
     が 'filename' と一緒に指定された場合) を捕捉するために、追加のチェ
     ックが加えられました。

     バージョン 3.8 で変更: 'force' 引数が追加されました。

     バージョン 3.9 で変更: 'encoding' と 'errors' 引数が追加されました
     。

     バージョン 3.15 で変更: The 'formatter' argument was added.

 -- の関数: logging.shutdown ()

     ロギングシステムに対して、バッファのフラッシュを行い、すべてのハン
     ドラを閉じることで順次シャットダウンを行うように告知します。この関
     数はアプリケーションの終了時に呼ばれるべきであり、また呼び出し以降
     はそれ以上ロギングシステムを使ってはなりません。

     loggingモジュールがインポートされると、この関数が終了ハンドラーとし
     て登録されます（ *note atexit: d. 参照）。そのため、通常はこれを手
     動で行う必要はありません。

 -- の関数: logging.setLoggerClass (klass)

     ロギングシステムに対して、ロガーをインスタンス化する際にクラス
     'klass' を使うように指示します。 指定するクラスは引数として名前だけ
     をとるようなメソッド ‘__init__()’ を定義していなければならず、
     ‘__init__()’ では ‘Logger.__init__()’ を呼び出さなければなりません
     。 この関数が呼び出されるのはたいてい、独自の振る舞いをするロガーを
     使う必要のあるアプリケーションでロガーがインスタンス化される前です
     。 呼び出された後は、いつでもそのサブクラスを使ってロガーのインスタ
     ンス化をしてはいけません: 引き続き *note logging.getLogger(): d2e.
     API を使用してロガーを取得してください。

 -- の関数: logging.setLogRecordFactory (factory)

     *note LogRecord: 1394. を生成するのに使われる callable をセットしま
     す。


     パラメータ: ‘factory’ - ログレコードを生成するファクトリとして振舞
     う callable。

     Added in version 3.2: この関数は、ログイベントを表現する *note
     LogRecord: 1394. の構築方法に関して開発者により多くのコントロールを
     与えるため、 *note getLogRecordFactory(): 33fc. とともに提供されま
     した。

     ファクトリは以下のようなシグネチャを持っています:

     ‘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(): 123a. で提供されるような
          、呼び出し階層を示すスタックトレースバック。


          ‘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: 15b7. が ‘sys.stderr’ に ‘WARNING’ レベルで書き出し
     ているのがそうですし、ロギングの設定がなにか不在のロギングイベント
     を扱う場合に使われます。最終的な結果は、メッセージを単に
     ‘sys.stderr’ に出力することです。これはかつて「logger XYZ について
     のハンドラが見つかりません」と言っていたエラーメッセージを置き換え
     ています。もしも何らかの理由でその昔の振る舞いが必要な場合は、
     ‘lastResort’ に ‘None’ をセットすれば良いです。

     Added in version 3.2.

 -- データ: logging.raiseExceptions

     ログメッセージの処理中に発生した例外を伝播させるかどうかを調べるた
     めに使われます。

     デフォルト: ‘True’.

     *note raiseExceptions: 15b8. が ‘False’ の場合、発生した例外は静か
     に無視されます。これはほとんどのログシステムにおいて望ましい動作で
     す - ほとんどのユーザーはログシステムのエラーには興味がなく、アプリ
     ケーションのエラーにより強い関心を持つでしょう。


File: python.info,  Node: warnings モジュールとの統合,  Prev: モジュールレベル属性,  Up: logging --- Python 用のログ記録手段

5.17.4.12 warnings モジュールとの統合
.....................................

The *note captureWarnings(): 3413. function can be used to integrate
‘logging’ with the *note warnings: 11b. module.

 -- の関数: logging.captureWarnings (capture)

     この関数は、logging による警告の補足を、有効にまたは無効にします。

     'capture' が ‘True’ なら、 *note warnings: 11b. モジュールに発せら
     れた警告は、ロギングシステムにリダイレクトされるようになります。具
     体的には、警告が *note warnings.formatwarning(): 2006. でフォーマッ
     ト化され、結果の文字列が ‘'py.warnings'’ という名のロガーに、 *note
     WARNING: 22ee. の重大度でロギングされるようになります。

     'capture' が ‘False’ なら、警告のロギングシステムに対するリダイレク
     トは止められ、警告は元の (すなわち、‘captureWarnings(True)’ が呼び
     出される前に有効だった) 送信先にリダイレクトされるようになります。

参考
....

*note logging.config: 8b. モジュール

     logging モジュールの環境設定 API です。

*note logging.handlers: 8c. モジュール

     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 基本チュートリアル: 15b4.

   * *note 上級チュートリアル: 15b5.

   * *note ロギングクックブック: 15b6.

__________________________________________________________________

この節は、logging モジュールを設定するための API を解説します。

* Menu:

* 環境設定のための関数::
* セキュリティで考慮すべき点::
* 環境設定辞書スキーマ::
* 環境設定ファイルの書式::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 8a. itself) and defining
handlers which are declared either in ‘logging’ or *note
logging.handlers: 8c.

 -- の関数: logging.config.dictConfig (config)

     辞書からロギング環境設定を取得します。この辞書の内容は、以下の
     *note 環境設定辞書スキーマ: 3418. で記述されています。

     環境設定中にエラーに遭遇すると、この関数は適宜メッセージを記述しつ
     つ *note ValueError: 15a, *note TypeError: 29c, *note
     AttributeError: 1b4. または *note ImportError: 1c8. を送出します。
     例外を送出する条件を (不完全かもしれませんが) 以下に列挙します:

        * 文字列でなかったり、実際のロギングレベルと関係ない文字列であっ
          たりする ‘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(): 156e. は ‘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 環境設定ファイルの書式: 3419. で
     記述されているとおりにしなければなりません。この関数はアプリケーシ
     ョンから何度も呼び出すことができ、これによって、 (設定を選択し、選
     択された設定を読み出す機構をデベロッパが提供していれば) 複数の準備
     済みの設定からエンドユーザが選択するようにできます。

     It will raise *note FileNotFoundError: 24f. if the file doesn't
     exist and *note RuntimeError: 317. if the file is invalid or empty.


     パラメータ:

        * ‘fname’ - A filename, or a file-like object, or an instance
          derived from *note RawConfigParser: 1313.  If a
          ‘RawConfigParser’-derived instance is passed, it is used as
          is.  Otherwise, a *note ConfigParser: 6ea. is instantiated,
          and the configuration read by it from the object passed in
          ‘fname’.  If that has a *note readline(): c2. method, it is
          assumed to be a file-like object and read using *note
          read_file(): 91a.; otherwise, it is assumed to be a filename
          and passed to *note read(): 1820.

        * ‘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: 1313.
     のサブクラスのインスタンスが渡せ得るようになっています。これによっ
     てこのようなことが容易になります:

             * ロギングの設定が、アプリケーション全体の設定における単な
               る一部であるような設定ファイルの使用。

             * ファイルから設定を読み込み、 ‘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(): 156e. あるいは *note fileConfig(): f12. で処理できる
     ファイルとして送信されます。 *note Thread: 427. インスタンスを返し
     、このインスタンスの *note start(): 429. を呼び出してサーバを起動し
     、適切なところで *note join(): 15a3. を呼び出すことができます。サー
     バを停止するには、 *note stopListening(): 341a. を呼び出します。

     ‘verify’ 引数を指定する場合は、これはソケットを通して受け取ったバイ
     ト文字列が妥当であるか、処理すべきであるかどうかを検査する callable
     である必要があります。ソケットを通じて、暗号化または署名あるいはそ
     の両方を受け取ることがあります。そのような場合に、 ‘verify’
     callable が署名の正当性検査または暗号化の復号あるいはその両方を実施
     することが出来ます。 ‘verify’ callable は単一引数で呼び出されます -
     ソケットを通じて受け取ったバイト文字列です - そして処理すべきバイト
     文字列、または捨て去られるべきであることを示すための ‘None’ を返す
     必要があります。返却されるバイト文字列は(たとえば正当性検査だけが行
     われて)渡されたものと同じかもしれませんし、あるいは(おそらく暗号化
     の復号が行われて)まったく異なるものかもしれません。

     ソケットに設定を送るには、まず設定ファイルを読み、それを
     ‘struct.pack('>L', n)’ を使って長さ 4 バイトのバイナリにパックした
     ものを前に付けたバイト列としてソケットに送ります。
          注釈: 設定の一部は *note eval(): 18f. を通じて渡されるため、こ
          の関数を利用することはユーザーをセキュリティ上のリスクにさらす
          可能性があります。この関数は ‘localhost’ のソケットだけにバイ
          ンドされており、リモートマシンからの接続を受け付けませんが、そ
          れでも *note listen(): 1314. を呼び出したプロセスのアカウント
          のもとで信頼できないコードが実行されうるシナリオが存在します。
          特に、 ‘listen()’ を呼び出したプロセスが複数のユーザーが利用す
          るマシン上で実行されており、ユーザー同士が互いに信頼できない場
          合、悪意あるユーザーが被害者ユーザーのプロセス上で本質的に任意
          のコードを実行するように計画する可能性があります。攻撃は、単に
          被害者ユーザーの ‘listen()’ ソケットに接続して、被害者ユーザー
          のプロセス上で攻撃者が実行したいコードが実行されるような設定を
          送り込むだけです。この攻撃はデフォルトのポートが使われている場
          合きわめて容易であり、異なるポートが使われている場合でもそれほ
          ど難しくはありません。このような事象が発生するリスクを回避する
          ためには、 ‘listen()’ の ‘verify’ 引数を使って不正な設定が適用
          されるのを防ぐようにしてください。

     バージョン 3.4 で変更: ‘verify’ 引数が追加されました。

          注釈: 既存のロガーを無効にしない構成をリスナーに送信する場合は
          、設定にはJSONフォーマットを使用する必要があります。これは、設
          定に *note dictConfig(): 156e. を使用します。 このメソッドを使
          用すると、 ‘disable_existing_loggers’ に ‘False’ を指定した設
          定を送信できます。

 -- の関数: logging.config.stopListening ()

     *note listen(): 1314. を呼び出して作成された、待ち受け中のサーバを
     停止します。通常 ‘listen()’ の戻り値に対して ‘join()’ が呼ばれる前
     に呼び出します。


File: python.info,  Node: セキュリティで考慮すべき点,  Next: 環境設定辞書スキーマ,  Prev: 環境設定のための関数,  Up: logging config --- ログ記録の環境設定

5.17.5.2 セキュリティで考慮すべき点
...................................

logging の設定機能は便利さを提供します。その便利さの一部は設定ファイル内
のテキストを logging の設定に使われる Python オブジェクトに変換する機能
を提供することによって実現されています - たとえば、 *note
ユーザ定義オブジェクト: 341d. で説明されているような機能です。しかし、ま
さにこのメカニズム (実行可能オブジェクトをユーザー定義モジュールからイン
ポートし、設定ファイルから読み込んだパラメータを使ってそれらを呼び出すこ
と) が任意のコードを呼び出すことに利用できる可能性があります。そして、こ
の理由により、信頼できない情報源から取得した設定ファイルは '細心の注意'
を払って取り扱わなければなりません。そのようなファイルをロードする場合、
そのファイルがいかなる問題も起こさないと確認した上で実際にファイルをロー
ドしてください。


File: python.info,  Node: 環境設定辞書スキーマ,  Next: 環境設定ファイルの書式,  Prev: セキュリティで考慮すべき点,  Up: logging config --- ログ記録の環境設定

5.17.5.3 環境設定辞書スキーマ
.............................

ロギング設定を記述するには、生成するさまざまなオブジェクトと、それらのつ
ながりを列挙しなければなりません。例えば、 'console' という名前のハンド
ラを生成し、'startup' という名前のロガーがメッセージを 'console' ハンド
ラに送るというようなことを記述します。これらのオブジェクトは、 *note
logging: 8a. モジュールによって提供されるものに限らず、独自のフォーマッ
タやハンドラクラスを書くことも出来ます。このクラスへのパラメータは、
‘sys.stderr’ のような外部オブジェクトを必要とすることもあります。これら
のオブジェクトとつながりを記述する構文は、以下の *note
オブジェクトの接続: 341f. で定義されています。

* Menu:

* 辞書スキーマの詳細::
* 増分設定::
* オブジェクトの接続::
* ユーザ定義オブジェクト::
* ハンドラの設定順序::
* 外部オブジェクトへのアクセス::
* 内部オブジェクトへのアクセス::
* インポート解決とカスタムインポーター::
* Configuring QueueHandler and QueueListener::


File: python.info,  Node: 辞書スキーマの詳細,  Next: 増分設定,  Up: 環境設定辞書スキーマ

5.17.5.4 辞書スキーマの詳細
...........................

*note dictConfig(): 156e. に渡される辞書は、以下のキーを含んでいなければ
なりません:

   * 'version' - スキーマのバージョンを表す整数値に設定されます。現在有
     効な値は 1 だけですが、このキーがあることで、このスキーマは後方互換
     性を保ちながら発展できます。

その他すべてのキーは省略可能ですが、与えられたなら以下に記述するように解
釈されます。以下のすべての場合において、 '環境設定辞書' と記載されている
所では、その辞書に特殊な ‘'()'’ キーがあるかを調べることで、カスタムのイ
ンスタンス化が必要であるか判断されます。その場合は、以下の *note
ユーザ定義オブジェクト: 341d. で記述されている機構がインスタンス生成に使
われます。そうでなければ、インスタンス化するべきものを決定するのにコンテ
キストが使われます。

   * 'formatters' - 対応する値は辞書で、そのそれぞれのキーがフォーマッタ
     id になり、それぞれの値が対応する *note Formatter: 184f. インスタン
     スをどのように環境設定するかを記述する辞書になります。

     設定辞書は *note Formatter: 184f. オブジェクトを作成するときの引数
     に対応する、次のようなオプションキーがないか探索されます。

        * ‘format’

        * ‘datefmt’

        * ‘style’

        * ‘validate’ (バージョン3.8以降)

        * ‘defaults’ (since version >=3.12)

     オプションの ‘class’ キーはフォーマッタークラスの名前を表します（モ
     ジュールとクラス名をドットで繋げる）。インスタンス化時の引数は
     *note Formatter: 184f. と同じであるため、このキーは ‘Formatter’ を
     カスタマイズしたサブクラスのインスタンス化に使うのがもっとも便利で
     す。例えばトレースバックにさらに情報を付加したり、情報を要約代替ク
     ラスを実装するといったことが想定されます。もし、自作のフォーマッタ
     ーが異なる引数や追加の設定引数を持つ場合は、 *note
     ユーザ定義オブジェクト: 341d. を使うべきです。

   * 'filters' - 対応する値は辞書で、そのそれぞれのキーがフィルタ id に
     なり、それぞれの値が対応する Filter インスタンスをどのように環境設
     定するかを記述する辞書になります。

     環境設定辞書は、(デフォルトが空文字列の) キー ‘name’ を検索され、そ
     れらが *note logging.Filter: 15ba. インスタンスを構成するのに使われ
     ます。

   * '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: 15b7. としてインスタンス化さ
     れます。id が ‘file’ であるハンドラが、 ‘filename='logconfig.log',
     maxBytes=1024, backupCount=3’ をキーワード引数にして、 *note
     logging.handlers.RotatingFileHandler: 1b78. としてインスタンス化さ
     れます。

   * 'loggers' - 対応する値は辞書で、そのそれぞれのキーがロガー名になり
     、それぞれの値が対応する Logger インスタンスをどのように環境設定す
     るかを記述する辞書になります。

     環境設定辞書は、以下のキーを検索されます:

        * ‘level’ (任意)。ロガーのレベルです。

        * ‘propagate’ (任意)。ロガーの伝播の設定です。

        * ‘filters’ (任意)。このロガーへのフィルタの id のリストです。

          バージョン 3.11 で変更: ‘filters’ は id に加えてフィルタのイン
          スタンスを受け取ることができるようになりました。

        * ‘handlers’ (任意)。このロガーへのハンドラの id のリストです。

     指定されたロガーは、指定されたレベル、伝播、ハンドラに従って環境設
     定されます。

   * 'root' - これは、ルートロガーへの設定になります。この環境設定の進行
     は、‘propagate’ 設定が適用されないことを除き、他のロガーと同じです
     。

   * 'incremental' - この環境設定が既存の環境設定に対する増分として解釈
     されるかどうかです。この値のデフォルトは ‘False’ で、指定された環境
     設定は、既存の *note fileConfig(): f12. API によって使われているの
     と同じ意味上で、既存の環境設定を置き換えます。

     指定された値が ‘True’ なら、環境設定は *note 増分設定: 3422. の節で
     記述されているように進行します。

   * 'disable_existing_loggers' - 既存の非ルートロガーをすべて無効にする
     べきかどうかです。この設定は、 *note fileConfig(): f12. における同
     じ名前のパラメータと同じです。設定されていなければ、このパラメータ
     のデフォルトは ‘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: 184f. インスタンスです。 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: 184f.
インスタンスが生成されます。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: 8a. モジュールには分か
らないような、より一般的な機構が必要です。例えば、 *note
logging.handlers.MemoryHandler: 342c. があって、委譲する先の別のハンドラ
である ‘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__(): caa. 組み込み関数を使用します。これを独自のインポートメカ
ニズムに置き換えたいと思うかもしれません: もしそうなら、
‘DictConfigurator’ あるいはその上位クラスである ‘BaseConfigurator’ クラ
スの ‘importer’ 属性を置換することができます。ただし、この関数はクラスか
らディスクリプタ経由でアクセスされる点に注意する必要があります。インポー
トを行うために Python callable を使用していて、それをインスタンスレベル
ではなくクラスレベルで定義したければ、 *note staticmethod(): 66d. でそれ
をラップする必要があります。例えば:

     from importlib import import_module
     from logging.config import BaseConfigurator

     BaseConfigurator.importer = staticmethod(import_module)

configurator 'インスタンス' に対してインポート callable をセットする場合
は、 *note staticmethod(): 66d. でラップする必要はありません。


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: 1d7e, noting that this is
normally used in conjunction with a *note QueueListener: 4d6, you can
configure both together.  After the configuration, the ‘QueueListener’
instance will be available as the *note listener: 3430. attribute of the
created handler, and that in turn will be available to you using *note
getHandlerByName(): 1d7f. 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: 3431. and *note
     Queue.get: 3432. public API. For instance, this may be an actual
     instance of *note queue.Queue: 174d. or a subclass thereof, or a
     proxy obtained by *note
     multiprocessing.managers.SyncManager.Queue(): 3433.

     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: 174d. 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 ユーザ定義オブジェクト: 341d.  The result of
     this construction should be a *note queue.Queue: 174d. instance.

If the ‘queue’ key is absent, a standard unbounded *note queue.Queue:
174d. 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: 4d6.  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 ユーザ定義オブジェクト: 341d.  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:
4d6. 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: 1d7e. and
*note QueueListener: 4d6.

Added in version 3.12.


File: python.info,  Node: 環境設定ファイルの書式,  Prev: 環境設定辞書スキーマ,  Up: logging config --- ログ記録の環境設定

5.17.5.13 環境設定ファイルの書式
................................

*note fileConfig(): f12. が解釈できる環境設定ファイルの形式は、 *note
configparser: 26. の機能に基づいています。ファイルには、 ‘[loggers]’,
‘[handlers]’, ‘[formatters]’ といったセクションが入っていなければならず
、各セクションではファイル中で定義されている各タイプのエンティティを名前
で指定しています。こうしたエンティティの各々について、そのエンティティを
どう設定するかを示した個別のセクションがあります。すなわち、 ‘log01’ と
いう名前の ‘[loggers]’ セクションにあるロガーに対しては、対応する詳細設
定がセクション ‘[logger_log01]’ に収められています。同様に、 ‘hand01’ と
いう名前の ‘[handlers]’ セクションにあるハンドラは ‘[handler_hand01]’ と
呼ばれるセクションに設定をもつことになり、 ‘[formatters]’ セクションにあ
る ‘form01’ は ‘[formatter_form01]’ というセクションで設定が指定されてい
ます。ルートロガーの設定は ‘[logger_root]’ と呼ばれるセクションで指定さ
れていなければなりません。

     注釈: *note fileConfig(): f12. API は *note dictConfig(): 156e. API
     よりも古く、ロギングのある種の側面についてカバーする機能に欠けてい
     ます。たとえば ‘fileConfig()’ では数値レベルを超えたメッセージを単
     に拾うフィルタリングを行う *note Filter: 15ba. オブジェクトを構成出
     来ません。 ‘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 評価:
27e5. されます。

‘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(): 18f. で決定されます) を示します。 ‘level’ はロガーの場
合と同じように解釈され、 ‘NOTSET’ は "すべてを記録する (log everything)"
と解釈されます。

‘formatter’ エントリはこのハンドラのフォーマッタに対するキー名を表します
。空文字列の場合、デフォルトのフォーマッタ (‘logging._defaultFormatter’)
が使われます。名前が指定されている場合、その名前は ‘[formatters]’ セクシ
ョンになくてはならず、対応するセクションが設定ファイル中になければなりま
せん。

‘args’ は、 ‘logging’ パッケージの名前空間のコンテキストで *note 評価:
27e5. される時点では、ハンドラークラスのコンストラクタのための引数のリス
トです。典型的なコンストラクタの引数が生成される方法については、各ハンド
ラのコンストラクタまたは下記の例を参照してください。指定されなければデフ
ォルトは ‘()’ になります。

オプションの ‘kwargs’ は、 ‘logging’ パッケージの名前空間のコンテキスト
で *note 評価: 27e5. される時点では、ハンドラークラスのコンストラクタの
ためのキーワード引数の辞書です。指定されなければデフォルトは ‘{}’ になり
ます。

     [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 フォーマッターのセクション: 3421. の辞書スキーマと同じキーを持つ、
フォーマッター設定の引数です。

The ‘defaults’ entry, when *note evaluated: 27e5. 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(): 18f. を使用していることで、上述のようにソケット
     経由で設定を送受信するために *note listen(): 1314. を使用しているこ
     とに起因する潜在的なセキュリティリスクがあります。そのリスクは、相
     互に信頼できない多数のユーザが同じマシン上でコードを実行する場合に
     制限されています; 詳細は ‘listen()’ ドキュメンテーションを参照して
     ください。

参考
....

*note logging: 8a. モジュール

     logging モジュールの API リファレンス。

*note logging.handlers: 8c. モジュール

     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 基本チュートリアル: 15b4.

   * *note 上級チュートリアル: 15b5.

   * *note ロギングクックブック: 15b6.

__________________________________________________________________

このパッケージでは、以下の便利なハンドラが提供されています。なお、これら
のハンドラのうち、3 つ (*note StreamHandler: 15b7, *note FileHandler:
1e69. および *note NullHandler: 163e.) は、実際には *note logging: 8a. モ
ジュール自身で定義されていますが、他のハンドラと一緒にここでドキュメント
化します。

* 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/main/Lib/logging/handlers.py


File: python.info,  Node: StreamHandler,  Next: FileHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.1 StreamHandler
......................

*note logging: 8a. コアパッケージに含まれる *note StreamHandler: 15b7. ク
ラスは、ログ出力を 'sys.stdout', 'sys.stderr' あるいは何らかのファイル風
(file-like) オブジェクト (あるいは、より正確に言えば ‘write()’ および
‘flush()’ メソッドをサポートする何らかのオブジェクト) といったストリーム
に送信します。

 -- クラス: logging.StreamHandler (stream=None)

     *note StreamHandler: 15b7. クラスの新たなインスタンスを返します。
     'stream' が指定された場合、インスタンスはログ出力先として指定された
     ストリームを使います; そうでない場合、 'sys.stderr' が使われます。

      -- メソッド: emit (record)

          フォーマッタが指定されていれば、フォーマッタを使ってレコードを
          書式化します。 次に、レコードが *note terminator: 343b. ととも
          にストリームに書き込まれます。 例外情報が存在する場合、 *note
          traceback.print_exception(): c2b. を使って書式化され、 ストリ
          ームの末尾につけられます。

      -- メソッド: flush ()

          ストリームの *note flush(): 343c. メソッドを呼び出してバッファ
          をフラッシュします。 ‘close()’ メソッドは *note Handler: 184e.
          から継承しているため何も出力を行わないので、 ‘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: 8a. コアパッケージに含まれる *note FileHandler: 1e69. ク
ラスは、ログ出力をディスク上のファイルに送信します。このクラスは出力機能
を *note StreamHandler: 15b7. から継承しています。

 -- クラス: logging.FileHandler (filename, mode='a', encoding=None,
          delay=False, errors=None)

     Returns a new instance of the *note FileHandler: 1e69. 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(): 343f.  By default, the file grows indefinitely.  If
     'errors' is specified, it's used to determine how encoding errors
     are handled.

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 4f5. オブジェク
     トも '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: 8a. コアパッケージに含まれる *note NullHandler: 163e. ク
ラスは、いかなる書式化も出力も行いません。これは本質的には、ライブラリ開
発者に使われる 'no-op' ハンドラです。

 -- クラス: logging.NullHandler

     *note NullHandler: 163e. クラスの新しいインスタンスを返します。

      -- メソッド: emit (record)

          このメソッドは何もしません。

      -- メソッド: handle (record)

          このメソッドは何もしません。

      -- メソッド: createLock ()

          アクセスが特殊化される必要がある I/O が下にないので、このメソ
          ッドはロックに対して ‘None’ を返します。

*note NullHandler: 163e. の使い方の詳しい情報は、 *note
ライブラリのためのロギングの設定: 3446. を参照してください。


File: python.info,  Node: WatchedFileHandler,  Next: BaseRotatingHandler,  Prev: NullHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.4 WatchedFileHandler
...........................

The *note WatchedFileHandler: 3449. 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(): 4fc. はこの値として常に 0 を返します。

 -- クラス: logging.handlers.WatchedFileHandler (filename, mode='a',
          encoding=None, delay=False, errors=None)

     Returns a new instance of the *note WatchedFileHandler: 3449.
     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(): 344a.  By default, the file grows indefinitely.
     If 'errors' is provided, it determines how encoding errors are
     handled.

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 4f5. オブジェク
     トも 'filename' 引数が受け取るようになりました。

     バージョン 3.9 で変更: 'errors' 引数が追加されました。

      -- メソッド: reopenIfNeeded ()

          ファイルが変更されていないかチェックします。 もし変更されてい
          れば、手始めにレコードをファイルに出力し、既存のストリームはフ
          ラッシュして閉じられ、ファイルが再度開かれます。

          Added in version 3.6.

      -- メソッド: emit (record)

          レコードをファイルに出力しますが、最初に *note
          reopenIfNeeded(): 107a. を呼び出して、変更があった場合はファイ
          ルを再度開きます。


File: python.info,  Node: BaseRotatingHandler,  Next: RotatingFileHandler,  Prev: WatchedFileHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.5 BaseRotatingHandler
............................

The *note BaseRotatingHandler: 344d. class, located in the
‘logging.handlers’ module, is the base class for the rotating file
handlers, *note RotatingFileHandler: 1b78. and *note
TimedRotatingFileHandler: 1310.  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(): 344f. メソッドはこの callable に委譲され
          ます。 callable に渡されるパラメータは ‘rotation_filename()’ に
          渡されたものです。

               注釈: namer 関数はロールオーバー中にかなりの回数呼ばれま
               す。そのため、できるだけ単純で、速くあるべきです。さらに
               、それは与えられた入力に対しては常に同じ出力を返すべきで
               す。そうでなければ、ロールオーバーの振る舞いは期待通りに
               動かないかもしれません。

               namer 属性にローテーションの際に使われるファイル名に埋め
               込むための特定の属性を保持しようとする場合に注意が必要な
               ことは、注意喚起しておくべきでしょう。たとえば *note
               RotatingFileHandler: 1b78. は、ローテーションが期待通りに
               動作するために、名前に連続した番号を含むようなファイル名
               のリストを持つことを期待します。また *note
               TimedRotatingFileHandler: 1310. は (ハンドラの初期化時に
               渡された ‘backupCount’ にもとづいて) 削除すべき古いファイ
               ルを決定しながら、古いログファイルを削除します。この仕組
               みが動作するためには、ファイル名は名前に含まれる日付や時
               刻でソート可能である必要があり、 namer はそれを尊重しなけ
               ればなりません (namer がこの規則を尊重したくない場合、そ
               のような namer は *note getFilesToDelete(): 3450. メソッ
               ドが特定の命名規則に適合するようにオーバーライドされた
               ‘TimedRotatingFileHandler’ の派生クラス内で使う必要がある
               でしょう)。

          Added in version 3.3.

      -- の属性: rotator

          この属性に callable がセットされた場合、 *note rotate(): 3452.
          メソッドはこの 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: 1b78. と *note TimedRotatingFileHandler:
1310. のインスタンスに対して同じ callable が使えます。もし namer や
rotator callable が例外を上げれば、 ‘emit()’ 呼び出しで発生した他の例外
と同じ方法で、つまりハンドラの ‘handleError()’ メソッドによって扱われま
す。

ローテート処理に大幅な変更を加える必要があれば、メソッドをオーバーライド
することができます。

例えば、 *note rotator と namer
を使ってログローテートをカスタマイズする: 3453. を参照してください。


File: python.info,  Node: RotatingFileHandler,  Next: TimedRotatingFileHandler,  Prev: BaseRotatingHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.6 RotatingFileHandler
............................

The *note RotatingFileHandler: 1b78. 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: 1b78. クラスの新たなインスタンスを返しま
     す。 指定されたファイルが開かれ、ログ記録のためのストリームとして使
     われます。 'mode' が指定されなかった場合、 ‘'a'’ が使われます。
     'encoding' が ‘None’ でない場合、その値はファイルを開くときのエンコ
     ーディングとして使われます。 'delay' が真ならば、ファイルを開くのは
     最初の *note emit(): 3456. 呼び出しまで遅らせられます。 デフォルト
     では、ファイルは無制限に大きくなりつづけます。 '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: 4f5. オブジェク
     トも '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: 1310. 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: 1310. クラスの新たなインスタンスを
     返します。 '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(): 345b. の最初
     の呼び出しまで延期されます。

     'atTime' が ‘None’ でない場合、それは ‘datetime.time’ インスタンス
     でなければなりません。ロールオーバーが「夜中」「特定の曜日」に設定
     されていて、ロールが発生する時刻を指定します。 'atTime' の値は '初
     期' のロールオーバーの計算に使われますが、後続のロールオーバーは通
     常の間隔の計算で算出されます。

     'errors' が指定されると、エンコーディングエラーの取り扱い方法を決定
     します。

          注釈: 最初のロールオーバーの計算はハンドラーが初期化されたとき
          に行われます。後続のロールオーバーは、ロールオーバーが発生し、
          ロールオーバーが出力した時にのみ行われます。これを念頭に置いて
          おかないと混乱する可能性があります。例えば、インターバルが '毎
          分' に設定されていて、1分ごとにログファイルが常に生成されると
          は限りません。アプリケーションが実行されている間、1分に1回以上
          のログ出力されて 'いるとすると' 毎分、分割されたログファイルが
          出力されますが、そうでなく、5分ごとに出力される場合は、出力さ
          れずにロールオーバーが実行されなかった時間分のギャップが生じま
          す。

     バージョン 3.4 で変更: 'atTime' パラメータが追加されました。

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 4f5. オブジェク
     トも '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: 1311. 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: 1311. クラスのインスタンスを生成し
     て返します。

     バージョン 3.4 で変更: ‘port’ に ‘None’ を指定すると、Unix ドメイン
     ソケットが ‘host’ 値を用いて作られます - そうでない場合は TCP ソケ
     ットが作られます。

      -- メソッド: close ()

          ソケットを閉じます。

      -- メソッド: emit ()

          レコードの属性辞書を pickle して、バイナリ形式でソケットに書き
          込みます。ソケット操作でエラーが生じた場合、暗黙のうちにパケッ
          トは捨てられます。事前に接続が失われていた場合、接続を再度確立
          します。受信端でレコードを unpickle して *note LogRecord:
          1394. にするには、 *note makeLogRecord(): 33f9. 関数を使ってく
          ださい。

      -- メソッド: handleError ()

          *note emit(): 3461. の処理中に発生したエラーを処理します。よく
          ある原因は接続の消失です。次のイベント発生時に再試行できるよう
          にソケットを閉じます。

      -- メソッド: makeSocket ()

          サブクラスで必要なソケット形式を詳細に定義できるようにするため
          のファクトリメソッドです。デフォルトの実装では、 TCP ソケット
          (*note socket.SOCK_STREAM: 16ad.) を生成します。

      -- メソッド: 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(): 3464. の
          ドキュメントで解説されています。

          この関数はネットワークがビジーの時に発生する部分的送信に対応し
          ています。

      -- メソッド: 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: 1312. class, located in the
‘logging.handlers’ module, inherits from *note SocketHandler: 1311. to
support sending logging messages over UDP sockets.

 -- クラス: logging.handlers.DatagramHandler (host, port)

     アドレスが 'host' および 'port' で与えられた遠隔のマシンと通信する
     ようにした *note DatagramHandler: 1312. クラスのインスタンスを生成
     して返します。

          注釈: UDP はストリーミングプロトコルではないため、このハンドラ
          のインスタンスと 'host' に指定したホストとの間に持続的なコネク
          ションはありません。この理由から、ネットワークソケットを使う場
          合、イベントがログされるごとに DNS のルックアップを行わなけれ
          ばならないかもしれず、それによりシステムにある程度の待ち時間を
          もたらす可能性があります。この待ち時間が問題になる場合、自身で
          ルックアップを行い、ホスト名の代わりにルックアップの結果得られ
          た IP アドレスを使ってハンドラを初期化することができます。

     バージョン 3.4 で変更: ‘port’ に ‘None’ を指定すると、Unix ドメイン
     ソケットが ‘host’ 値を用いて作られます - そうでない場合は UDP ソケ
     ットが作られます。

      -- メソッド: emit ()

          レコードの属性辞書を pickle して、バイナリ形式でソケットに書き
          込みます。ソケット操作でエラーが生じた場合、暗黙のうちにパケッ
          トは捨てられます。事前に接続が失われていた場合、接続を再度確立
          します。受信端でレコードを unpickle して *note LogRecord:
          1394. にするには、 *note makeLogRecord(): 33f9. 関数を使ってく
          ださい。

      -- メソッド: makeSocket ()

          ここで *note SocketHandler: 1311. のファクトリメソッドをオーバ
          ライドして、 UDP ソケット (*note socket.SOCK_DGRAM: 16ac.) を
          生成しています。

      -- メソッド: send (s)

          pickle したバイト文字列をソケットに送信します。 送信するバイト
          文字列のフォーマットは、 *note SocketHandler.makePickle():
          3464. のドキュメントで解説されています。


File: python.info,  Node: SysLogHandler,  Next: NTEventLogHandler,  Prev: DatagramHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.10 SysLogHandler
.......................

The *note SysLogHandler: a51. 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: 16ac. 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: 16ad.  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: a51. が正常に動作していないように見える場合がありま
     す。その場合、ドメインソケットに使うべきアドレスを調べてください。
     そのアドレスはシステムによって異なります。例えば、Linux システムで
     は通常 '/dev/log' ですが、 OS X では '/var/run/syslog' です。プラッ
     トフォームを確認し、適切なアドレスを使う必要があります (アプリケー
     ションを複数のプラットフォーム上で動作させる必要がある場合、実行時
     に確認する必要があるかもしれません)。Windows では、多くの場合、UDP
     オプションを使用する必要があります。

          注釈: macOS 12.x (Monterey) でApple社はsyslogデーモンの振る舞
          いを変更し、デーモンはドメインソケットを待ち受けなくなりました
          。したがってこのシステム上では *note SysLogHandler: a51. が動
          作することは期待できません。

          より詳細な情報は 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: a51. で定義さ
          れています。これは ‘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: 19a6. 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: 19a6. クラスの新たなインスタンスを返します
     。 '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: 1af2. 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: 1af2. クラスのインスタンスを返します。イ
     ンスタンスは email の from および to アドレス行、および subject 行
     とともに初期化されます。 'toaddrs' は文字列からなるリストでなければ
     なりません。非標準の SMTP ポートを指定するには、 'mailhost' 引数に
     (host, port) のタプル形式を指定します。文字列を使った場合、標準の
     SMTP ポートが使われます。もし SMTP サーバが認証を必要とするならば、
     (username, password) のタプル形式を 'credentials' 引数に指定するこ
     とができます。

     セキュアプロトコル (TLS) の使用を指定するには 'secure' 引数にタプル
     を渡してください。これは認証情報が渡された場合のみ使用されます。タ
     プルは、空のタプルか、キーファイルの名前を持つ1要素のタプルか、また
     はキーファイルと証明書ファイルの名前を持つ2要素のタプルのいずれかで
     なければなりません。 (このタプルは *note smtplib.SMTP.starttls():
     14f9. メソッドに渡されます。)

     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: 342c. 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: 342c. はより一般的な抽象クラス、 *note
BufferingHandler: 347e. のサブクラスです。この抽象クラスでは、ログ記録す
るレコードをメモリ上にバッファリングします。各レコードがバッファに追加さ
れる毎に、 ‘shouldFlush()’ を呼び出してバッファをフラッシュすべきかどう
か調べます。フラッシュする必要がある場合、 ‘flush()’ がフラッシュ処理を
行うものと想定されます。

 -- クラス: logging.handlers.BufferingHandler (capacity)

     容量つきのバッファーを設定してハンドラーが初期化されます。
     'capacity' はバッファ可能なログレコード数を意味します。

      -- メソッド: emit (record)

          レコードをバッファに追加します。 *note shouldFlush(): 3480. が
          true を返す場合、バッファを処理するために *note flush(): 3481.
          を呼び出します。

      -- メソッド: 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: 342c. クラスの新たなインスタンスを返します。 イ
     ンスタンスはサイズ 'capacity' （バッファされるレコード数）のバッフ
     ァとともに初期化されます。 'flushLevel' が指定されていない場合、
     ‘ERROR’ が使われます。 'target' が指定されていない場合、ハンドラが
     何らかの意味のある処理を行う前に *note setTarget(): 3482. でターゲ
     ットを指定する必要があります。 'flushOnClose' が ‘False’ に指定され
     ていた場合、ハンドラが閉じられるときにバッファはフラッシュ 'されま
     せん' 。 'flushOnClose' が指定されていないか ‘True’ に指定されてい
     た場合、ハンドラが閉じられるときのバッファのフラッシュは以前の挙動
     になります。

     バージョン 3.6 で変更: 'flushOnClose' パラメータが追加されました。

      -- メソッド: close ()

          *note flush(): 3484. を呼び出し、ターゲットを ‘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: 11e3. 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: 11e3. クラスの新たなインスタンスを返します。特別
     なポートを使う必要がある場合、'host' は ‘host:port’ の形式で使うこ
     とができます。 'method' が指定されない場合、 ‘GET’ が使われます。
     'secure' が真の場合、HTTPS 接続が使われます。 HTTPS 接続で使用する
     SSL 設定のために 'context' 引数を *note ssl.SSLContext: 33e. のイン
     スタンスに設定することができます。 'credentials' を指定する場合、
     BASIC 認証の際の HTTP 'Authorization' ヘッダに使われるユーザIDとパ
     スワードからなる 2要素タプルを渡してください。 credentials を指定す
     る場合、ユーザIDとパスワードが通信中に平文として剥き出しにならない
     よう、secure=True も指定すべきです。

     バージョン 3.5 で変更: 'context' パラメータが追加されました。

      -- メソッド: mapLogRecord (record)

          URL エンコードされて Web サーバに送信することになる、 ‘record’
          に基づく辞書を供給します。デフォルトの実装では単に
          ‘record.__dict__’ を返します。例えば *note LogRecord: 1394. の
          サブセットのみを Web サーバに送信する場合や、 サーバーに送信す
          る内容を特別にカスタマイズする必要がある場合には、このメソッド
          をオーバライドできます。

      -- メソッド: emit (record)

          レコードを URL エンコードされた辞書形式で Web サーバに送信しま
          す。レコードを送信のために辞書に変換するために *note
          mapLogRecord(): 3488. が呼び出されます。

          注釈: Web server に送信するためのレコードを準備することは一般
          的な書式化操作とは同じではありませんので、 *note
          setFormatter(): 33dd. を使って *note Formatter: 184f. を指定す
          ることは、 *note HTTPHandler: 11e3. には効果はありません。
          *note format(): 33e6. を呼び出す代わりに、このハンドラは *note
          mapLogRecord(): 3488. を呼び出し、その後その返却辞書を Web
          server に送信するのに適した様式にエンコードするために *note
          urllib.parse.urlencode(): 1249. を呼び出します。


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: 1d7e. class, located in the ‘logging.handlers’
module, supports sending logging messages to a queue, such as those
implemented in the *note queue: be. or *note multiprocessing: 98.
modules.

*note QueueListener: 4d6. クラスとともに *note QueueHandler: 1d7e. を使
うと、ロギングを行うスレッドから分離されたスレッド上でハンドラを動かすこ
とができます。これは、クライアントに対してサービスするスレッドができるだ
け速く応答する必要がある一方、別のスレッド上で (*note SMTPHandler: 1af2.
によって電子メールを送信するような) 潜在的に遅い操作が行われるような、ウ
ェブアプリケーションおよびその他のサービスアプリケーションにおいて重要で
す。

 -- クラス: logging.handlers.QueueHandler (queue)

     *note QueueHandler: 1d7e. クラスの新しいインスタンスを返します。イ
     ンスタンスは、キューにメッセージを送るように初期化されます。キュー
     は任意のキューのようなオブジェクトが可能です; それはそのまま *note
     enqueue(): 348c. メソッドによって使用されます。そのメソッドはメッセ
     ージを送る方法を知っている必要があります。もしタスクのトラッキング
     APIにキューが必要でない場合はキューとして *note SimpleQueue: f2b. の
     インスタンスが使用できます。

          注釈: *note multiprocessing: 98. を使っている場合、 *note
          SimpleQueue: f2b. を使うことは避けてください。代わりに *note
          multiprocessing.Queue: 1da4. を使ってください。

          警告: The *note multiprocessing: 98. module uses an internal
          logger created and accessed via *note get_logger(): 348d.
          *note multiprocessing.Queue: 1da4. 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(): 33e4. method is called to handle the
          error.  This can result in the record silently being dropped
          (if *note logging.raiseExceptions: 15b8. is ‘False’) or a
          message printed to ‘sys.stderr’ (if ‘logging.raiseExceptions’
          is ‘True’).

      -- メソッド: prepare (record)

          キューに追加するためレコードを準備します。このメソッドが返した
          オブジェクトがキューに追加されます。

          基底の実装はレコードがメッセージや引数と、またもし存在すれば、
          発生した例外およびスタック情報と統合されるようにフォーマットし
          ます。またこの実装では非 pickle 化不可能な要素をレコードから削
          除します。特に、この実装はレコードの ‘msg’ と ‘message’ 属性を
          (ハンドラの *note format(): 440. メソッドを呼び出すことによっ
          て得られる) 統合されたメッセージで上書きし、同時に ‘args’,
          ‘exc_info’, ‘exc_text’ の3つの属性値をすべて ‘None’ に設定しま
          す。

          レコードを dict や JSON 文字列に変換したい場合や、オリジナルの
          レコードを変更せずに修正済のコピーを送りたい場合は、このメソッ
          ドをオーバーライドすると良いでしょう。

               注釈: 基底の実装は、レコードを pickle 化可能にしつつ、さ
               らなるフォーマット処理を防ぐために、メッセージを引数でフ
               ォーマットしてフォーマットされたメッセージを ‘message’ と
               ‘msg’ 属性に設定し、同時に ‘args’ と ‘exc_text’ 属性を
               ‘None’ に設定します。このことは、 *note QueueListener:
               4d6. 側のハンドラが必要なフォーマット処理を行う、たとえば
               例外のフォーマット処理を行う、ための必要な情報が得られな
               いかもしれないことを意味します。そのため、 ‘QueueHandler’
               の派生クラスにおいてこのメソッドを、たとえば ‘exc_text’ 属
               性が ‘None’ に設定されないように、オーバーライドしたいと
               考えるかもしれません。この場合、 ‘message’ / ‘msg’ /
               ‘args’ といった属性の変更はレコードが pickle 化可能である
               ことを保証することと関係しており、元の ‘args’ の値が
               pickle 化可能かどうかによって、これらの属性の変更が避けら
               れないかもしれないということに注意してください (この点に
               ついては、自分のコードだけでなく依存するライブラリのコー
               ドも考慮しなければならないことにも注意してください)

      -- メソッド: enqueue (record)

          キューにレコードを ‘put_nowait()’ を使ってエンキューします; ブ
          ロッキングやタイムアウト、あるいはなにか特別なキューの実装を使
          いたければ、これをオーバライドしてみてください。

      -- の属性: listener

          When created via configuration using *note dictConfig(): 156e,
          this attribute will contain a *note QueueListener: 4d6.
          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: 4d6. class, located in the ‘logging.handlers’
module, supports receiving logging messages from a queue, such as those
implemented in the *note queue: be. 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: 1d7e.

*note QueueHandler: 1d7e. クラスとともに *note QueueListener: 4d6. を使
うと、ロギングを行うスレッドから分離されたスレッド上でハンドラを動かすこ
とができます。これは、クライアントに対してサービスするスレッドができるだ
け速く応答する必要がある一方、別のスレッド上で (*note SMTPHandler: 1af2.
によって電子メールを送信するような) 潜在的に遅い操作が行われるような、ウ
ェブアプリケーションおよびその他のサービスアプリケーションにおいて重要で
す。

 -- クラス: logging.handlers.QueueListener (queue, *handlers,
          respect_handler_level=False)

     *note QueueListener: 4d6. クラスの新しいインスタンスを返します。イ
     ンスタンスは、メッセージを送るためのキューと、キューに格納されたエ
     ントリーを処理するハンドラーのリストが設定されて初期化されます。キ
     ューは任意のキューのようなオブジェクトが可能です; それはそのまま
     *note dequeue(): 3492. メソッドによって使用されます。そのメソッドは
     メッセージを送る方法を知っている必要があります。もしタスクのトラッ
     キングAPIにキューが必要でない場合はキューとして *note SimpleQueue:
     f2b. のインスタンスが使用できます（トラッキングAPIが使用可能な場合
     は使用されます）。

          注釈: *note multiprocessing: 98. を使っている場合、 *note
          SimpleQueue: f2b. を使うことは避けてください。代わりに *note
          multiprocessing.Queue: 1da4. を使ってください。

     もし ‘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: 215.  When entering the context,
     the listener is started.  When exiting the context, the listener is
     stopped.  *note __enter__(): 28bc. returns the ‘QueueListener’
     object.

      -- メソッド: dequeue (block)

          キューからレコードを取り除き、それを返します。ブロッキングする
          ことがあります。

          ベース実装は ‘get()’ を使用します。タイムアウトを有効にしたい
          場合や、カスタムのキュー実装を使いたい場合は、このメソッドをオ
          ーバーライドすると良いでしょう。

      -- メソッド: prepare (record)

          レコードを扱うための準備をします。

          この実装は渡されたレコードをそのまま返します。その値をハンドラ
          に渡す前に何らかのカスタムな整列化 (marshalling) あるいはレコ
          ードに対する操作を行う必要があれば、このメソッドをオーバーライ
          ドすると良いでしょう。

      -- メソッド: handle (record)

          レコードを処理します。

          これは、ハンドラをループしてそれらに処理すべきレコードを渡しま
          す。ハンドラに渡される実際のオブジェクトは、 *note prepare():
          3493. から返されたものです。

      -- メソッド: start ()

          リスナーを開始します。

          これは、 LogRecord を処理するキューを監視するために、バックグ
          ラウンドスレッドを開始します。

          バージョン 3.14 で変更: Raises *note RuntimeError: 317. if
          called and the listener is already running.

      -- メソッド: stop ()

          リスナーを停止します。

          スレッドに終了するように依頼し、終了するまで待ちます。アプリケ
          ーションの終了前にこのメソッドを呼ばないと、いくつかのレコード
          がキューに残り、処理されなくなるかもしれないことに注意してくだ
          さい。

      -- メソッド: enqueue_sentinel ()

          リスナーに停止するように指示するためキューに番兵を書き込みます
          。この実装は ‘put_nowait()’ を使用します。タイムアウトを有効に
          したい場合や、カスタムのキュー実装を使いたい場合は、このメソッ
          ドをオーバーライドすると良いでしょう。

          Added in version 3.3.

参考
....

*note logging: 8a. モジュール

     logging モジュールの API リファレンス。

*note logging.config: 8b. モジュール

     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::
* Windows platform::
* macOS platform::
* iOS platform::
* Unix platforms::
* Linux platforms::
* Android platform::
* コマンドラインでの使用: コマンドラインでの使用<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/platform.py


File: python.info,  Node: Cross platform,  Next: Windows 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: 1583. の方が信頼できます:

               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(): 349d. で実装されています。

     'terse' が真なら、プラットフォームを特定するために最低限必要な情報
     だけを返します。

     バージョン 3.8 で変更: macOSでは、 *note mac_ver(): 2022. が空でな
     いリリース文字列を返すとき、darwin のバージョンではなく macOS のバ
     ージョンを取得するために、この関数は ‘mac_ver()’ を使うようになりま
     した。

 -- の関数: platform.processor ()

     ‘'amdk6'’ のような、（現実の）プロセッサ名を返します。

     不明な場合は空文字列を返します。NetBSDのようにこの情報を提供しない
     、または *note machine(): 349b. と同じ値しか返さないプラットフォー
     ムも多く存在しますので、注意してください。

 -- の関数: 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(): 14d7.

 -- の関数: 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(): 14d7.

 -- の関数: platform.uname ()

     極めて可搬性の高い uname インターフェースです。 *note system: 2477,
     *note node: 349c, *note release: 34a6, *note version: 34a7, *note
     machine: 349b, *note processor: 349e. の6つの属性を持った *note
     namedtuple(): 1da. を返します。

     *note processor: 349e. is resolved late, on demand.

     Note: the first two attribute names differ from the names presented
     by *note os.uname(): 14d7, where they are named ‘sysname’ and
     ‘nodename’.

     不明な項目は ‘''’ となります。

     バージョン 3.3 で変更: 結果が タプル から *note namedtuple(): 1da.
     へ変更されました。

     バージョン 3.9 で変更: *note processor: 349e. is resolved late
     instead of immediately.

 -- の関数: platform.invalidate_caches ()

     Clear out the internal cache of information, such as the *note
     uname(): 2020.  This is typically useful when the platform's *note
     node(): 349c. is changed by an external process and one needs to
     retrieve the updated value.

     Added in version 3.14.


File: python.info,  Node: Windows platform,  Next: macOS platform,  Prev: Cross platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.17.7.2 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(): 34a9. によって返された 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.3 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.4 iOS platform
.....................

 -- の関数: platform.ios_ver (system='', release='', model='',
          is_simulator=False)

     iOS のバージョン情報を取得し、次の属性付きで *note namedtuple():
     1da. として返します。

        * ‘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.5 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.6 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: 543. 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.7 Android platform
.........................

 -- の関数: platform.android_ver (release='', api_level=0,
          manufacturer='', model='', device='', is_emulator=False)

     Android のデバイス情報を取得し、次の属性付きで *note namedtuple():
     1da. として返します。決定不能な値は、引数として指定されたデフォルト
     に設定されます。

        * ‘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():
          f4d.

        * ‘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.8 コマンドラインでの使用
...............................

‘platform’ can also be invoked directly using the *note -m: 4d1. 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(): 1ce6. 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(): 1ce6. 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(): 325f. を使ってください。

以下のリストの内、現在のプラットフォームで使われていないシンボルはモジュ
ール上で定義されていません。定義されているシンボルだけを挙げたリストは
‘errno.errorcode.keys()’ として取得することができます。取得できるシンボ
ルには以下のようなものがあります:

 -- データ: errno.EPERM

     Operation not permitted.  This error is mapped to the exception
     *note PermissionError: 10fd.

 -- データ: errno.ENOENT

     No such file or directory.  This error is mapped to the exception
     *note FileNotFoundError: 24f.

 -- データ: errno.ESRCH

     No such process.  This error is mapped to the exception *note
     ProcessLookupError: 1411.

 -- データ: errno.EINTR

     Interrupted system call.  This error is mapped to the exception
     *note InterruptedError: 1145.

 -- データ: 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: 140e.

 -- データ: errno.EAGAIN

     Try again.  This error is mapped to the exception *note
     BlockingIOError: 4ca.

 -- データ: errno.ENOMEM

     空きメモリがありません (Out of memory)

 -- データ: errno.EACCES

     Permission denied.  This error is mapped to the exception *note
     PermissionError: 10fd.

 -- データ: 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: 13cd.

 -- データ: errno.EXDEV

     デバイスをまたいだリンクです (Cross-device link)

 -- データ: errno.ENODEV

     そのようなデバイスはありません (No such device)

 -- データ: errno.ENOTDIR

     Not a directory.  This error is mapped to the exception *note
     NotADirectoryError: 1410.

 -- データ: errno.EISDIR

     Is a directory.  This error is mapped to the exception *note
     IsADirectoryError: 140f.

 -- データ: 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: 1412.

 -- データ: 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: 4ca.

 -- データ: 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: 1413.

 -- データ: errno.ECONNRESET

     Connection reset by peer.  This error is mapped to the exception
     *note ConnectionResetError: 1415.

 -- データ: 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: 1412.

 -- データ: errno.ETOOMANYREFS

     参照が多すぎます: 接続できません (Too many references: cannot
     splice)

 -- データ: errno.ETIMEDOUT

     Connection timed out.  This error is mapped to the exception *note
     TimeoutError: c12.

 -- データ: errno.ECONNREFUSED

     Connection refused.  This error is mapped to the exception *note
     ConnectionRefusedError: 1414.

 -- データ: 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: 4ca.

 -- データ: errno.EINPROGRESS

     Operation now in progress.  This error is mapped to the exception
     *note BlockingIOError: 4ca.

 -- データ: 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: 10fd.

     *note Availability: 234c.: 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: 2366.  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
オプションのモジュールの要件: 2364.

* Menu:

* ctypes チュートリアル::
* ctypesリファレンス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/ctypes


File: python.info,  Node: ctypes チュートリアル,  Next: ctypesリファレンス,  Up: ctypes --- Python 用の外部関数ライブラリ

5.17.9.1 ctypes チュートリアル
..............................

注意: いくつかのコードサンプルで ctypes の *note c_int: 353c. 型を参照し
ています。 ‘sizeof(long) == sizeof(int)’ であるようなプラットフォームで
は、この型は *note c_long: 353d. のエイリアスです。そのため、 ‘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: 3540, and on Windows *note windll:
3541. and *note oledll: 3542. 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: 3542. 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: 543. exception when the function call fails.

バージョン 3.3 で変更: Windows エラーは以前は *note WindowsError: 140b.
を送出していましたが、これは現在では *note OSError: 543. の別名になって
います。

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(): 3543. method of the dll loaders should be used,
or you should load the library by creating an instance of *note CDLL:
db1. 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(): f93. を使わなければなりません。:

     >>> 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: 15a. が送出されます。逆の場合も同様です:

     >>> cdll.kernel32.GetModuleHandleA(None)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ValueError: Procedure probably called with not enough arguments (4 bytes missing)
     >>>

     >>> windll.msvcrt.printf(b"spam")
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ValueError: Procedure probably called with too many arguments (4 bytes in excess)
     >>>

正しい呼び出し規約を知るためには、呼び出したい関数についての C ヘッダフ
ァイルもしくはドキュメントを見なければなりません。

On Windows, ‘ctypes’ uses win32 structured exception handling to prevent
crashes from general protection faults when functions are called with
invalid argument values:

     >>> windll.kernel32.GetModuleHandleA(32)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     OSError: exception: access violation reading 0x00000020
     >>>

There are, however, enough ways to crash Python with ‘ctypes’, so you
should be careful anyway.  The *note faulthandler: 5b. module can be
helpful in debugging crashes (e.g.  from segmentation faults produced by
erroneous C library calls).

‘None’, integers, bytes objects and (unicode) strings are the only
native Python objects that can directly be used as parameters in these
function calls.  ‘None’ is passed as a C ‘NULL’ pointer, bytes objects
and strings are passed as pointer to the memory block that contains
their data (char* or wchar_t*).  Python integers are passed as the
platform's default C int type, their value is masked to fit into the C
type.

Before we move on calling functions with other parameter types, we have
to learn more about ‘ctypes’ data types.


File: python.info,  Node: 基本データ型,  Next: 続・関数を呼び出す,  Prev: 関数を呼び出す,  Up: ctypes チュートリアル

5.17.9.5 基本データ型
.....................

‘ctypes’ defines a number of primitive C compatible data types:

ctypes の型                   C の型                        Python の型                   *note _type_: 2d8.
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
*note c_bool: 3549.           _Bool                         *note bool: 5f6.              ‘'?'’
                                                                                          
                                                                                          
*note c_char: 354a.           char                          1-character                   ‘'c'’
                                                            *note bytes: 1d2.             
                                                            
                                                                                          
*note c_wchar: 354b.          ‘wchar_t’                     1-character *note str: 1ea.   ‘'u'’
                                                                                          
                                                                                          
*note c_byte: 1cfe.           char                          *note int: 32e.               ‘'b'’
                                                                                          
                                                                                          
*note c_ubyte: 1cff.          unsigned char                 *note int: 32e.               ‘'B'’
                                                                                          
                                                                                          
*note c_short: 354c.          short                         *note int: 32e.               ‘'h'’
                                                                                          
                                                                                          
*note c_ushort: 354d.         unsigned short                *note int: 32e.               ‘'H'’
                                                                                          
                                                                                          
*note c_int: 353c.            int                           *note int: 32e.               ‘'i'’ *
                                                                                          
                                                                                          
*note c_int8: 354e.           ‘int8_t’                      *note int: 32e.               *
                                                                                          
                                                                                          
*note c_int16: 354f.          ‘int16_t’                     *note int: 32e.               *
                                                                                          
                                                                                          
*note c_int32: 3550.          ‘int32_t’                     *note int: 32e.               *
                                                                                          
                                                                                          
*note c_int64: 3551.          ‘int64_t’                     *note int: 32e.               *
                                                                                          
                                                                                          
*note c_uint: 3552.           unsigned int                  *note int: 32e.               ‘'I'’ *
                                                                                          
                                                                                          
*note c_uint8: 3553.          ‘uint8_t’                     *note int: 32e.               *
                                                                                          
                                                                                          
*note c_uint16: 3554.         ‘uint16_t’                    *note int: 32e.               *
                                                                                          
                                                                                          
*note c_uint32: 3555.         ‘uint32_t’                    *note int: 32e.               *
                                                                                          
                                                                                          
*note c_uint64: 3556.         ‘uint64_t’                    *note int: 32e.               *
                                                                                          
                                                                                          
*note c_long: 353d.           long                          *note int: 32e.               ‘'l'’
                                                                                          
                                                                                          
*note c_ulong: 3557.          unsigned long                 *note int: 32e.               ‘'L'’
                                                                                          
                                                                                          
*note c_longlong: 3558.       long long                     *note int: 32e.               ‘'q'’ *
                                                                                          
                                                                                          
*note c_ulonglong: 3559.      unsigned long long            *note int: 32e.               ‘'Q'’ *
                                                                                          
                                                                                          
*note c_size_t: 355a.         ‘size_t’                      *note int: 32e.               *
                                                                                          
                                                                                          
*note c_ssize_t: 15f7.        *note Py_ssize_t: e28.        *note int: 32e.               *
                                                                                          
                                                                                          
*note c_time_t: 1d80.         ‘time_t’                      *note int: 32e.               *
                                                                                          
                                                                                          
*note c_float: 355b.          float                         *note float: 32f.             ‘'f'’
                                                                                          
                                                                                          
*note c_double: 1ecd.         double                        *note float: 32f.             ‘'d'’
                                                                                          
                                                                                          
*note c_longdouble: 1ece.     long double                   *note float: 32f.             ‘'g'’ *
                                                                                          
                                                                                          
*note c_char_p: 1c7c.         char* (NUL 終端)              *note bytes: 1d2. or ‘None’   ‘'z'’
                                                                                          
                                                                                          
*note c_wchar_p: 1c7d.        wchar_t* (NUL 終端)           *note str: 1ea. or ‘None’     ‘'Z'’
                                                                                          
                                                                                          
*note c_void_p: 1c7e.         void*                         *note int: 32e. or ‘None’     ‘'P'’
                                                                                          
                                                                                          
*note py_object: 48d.         *note PyObject: 1a6.*         *note object: e51.            ‘'O'’
                                                                                          
                                                                                          
*note VARIANT_BOOL: 355c.     short int                     *note bool: 5f6.              ‘'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_: 2d8.
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
*note c_float_complex: 2d9.   float complex                 *note complex: 330.           ‘'Zf'’
                                                                                          
                                                                                          
*note c_double_complex: 2da.  double complex                *note complex: 330.           ‘'Zd'’
                                                                                          
                                                                                          
*note c_longdouble_complex: 2db.long double complex         *note complex: 330.           ‘'Zg'’
                                                                                          

バージョン 3.15 で変更: The *note _type_: 2d8. types ‘F’, ‘D’ and ‘G’
have been replaced with ‘Zf’, ‘Zd’ and ‘Zg’.

これら全ての型はその型を呼び出すことによって作成でき、オプションとして型
と値が合っている初期化子を指定することができます:

     >>> 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__(): 168f, *note __index__(): 444. (for ‘int’), *note
__float__(): d96. or *note __complex__(): 9e3.  This means *note c_bool:
3549. 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:
1c7c, *note c_wchar_p: 1c7d, and *note c_void_p: 1c7e. 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(): 355d. 関数があり、いろいろ
な方法で作成することできます。現在のメモリブロックの内容は ‘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(): 355d. 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(): 1fc3. function.


File: python.info,  Node: 続・関数を呼び出す,  Next: Calling variadic functions,  Prev: 基本データ型,  Up: ctypes チュートリアル

5.17.9.6 続・関数を呼び出す
...........................

printf は *note sys.stdout: ea0. では 'なく' 、本物の標準出力チャンネル
へプリントすることに注意してください。したがって、これらの例はコンソール
プロンプトでのみ動作し、 '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: 1a20.
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: 1a20. 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: 6c1. 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: 1a20. attribute.

*note argtypes: 1a20. 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(): 3566. class method for them
to be able to use them in the *note argtypes: 1a20. 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: 3569. 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: 1a20.:

     >>> 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"): 254a. calls above, you can set
the *note argtypes: 1a20. 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: 3569. 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(): 1984. を呼び
出します。

Please note that a much more powerful error checking mechanism is
available through the *note errcheck: 356a. 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(): 356d. function which is used to pass
parameters by reference.  The same effect can be achieved with the *note
pointer(): 1c7b. 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: 483. and
*note Union: 484. base classes which are defined in the ‘ctypes’ module.
Each subclass must define a *note _fields_: 1b6f. 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: 353c, 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: 22a.s can be retrieved from the 'class', they
are useful for debugging because they can provide useful information.
See *note CField: 485.:

     >>> 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_: 321. 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_:
320. and/or *note _align_: 6f3, 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: 3572, *note LittleEndianStructure: 3573, *note
BigEndianUnion: 1dd0, and *note LittleEndianUnion: 1dd1. 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_: 1b6f. 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_: 321. 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(): 1c7b.
function on a ‘ctypes’ type:

     >>> from ctypes import *
     >>> i = c_int(42)
     >>> pi = pointer(i)
     >>>

次のように、ポインタインスタンスは、ポインタが指すオブジェクト (上の例で
は ‘i’) を返す *note contents: 3579. 属性を持ちます:

     >>> 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: 353c. インスタンスがポインタの 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(): 1c7b. function does more than
simply create pointer instances, it has to create pointer 'types' first.
This is done with the *note POINTER(): 48b. 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: 418. can be disabled on the
*note free-threaded build: 1a3.  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: 1a30. 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: 1a20. 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: 1a20, an
object of the pointed type (‘c_int’ in this case) can be passed to the
function.  ctypes will apply the required *note byref(): 356d.
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(): 357e.
function which can be used in the same way.  The ‘Bar’ structure defined
above accepts ‘POINTER(c_int)’ pointers or *note c_int: 353c. 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(): 357e. 関数が便利です。

*note cast(): 357e. 関数は ctypes インスタンスを異なる ctypes データ型を
指すポインタへキャストするために使えます。 ‘cast()’ は二つのパラメータ、
ある種のポインタかそのポインタへ変換できる ctypes オブジェクトと、
ctypes ポインタ型を取ります。そして、第二引数のインスタンスを返します。
このインスタンスは第一引数と同じメモリブロックを参照しています:

     >>> a = (c_byte * 4)()
     >>> cast(a, POINTER(c_int))
     <ctypes.LP_c_long object at ...>
     >>>

したがって、 *note cast(): 357e. を ‘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_: 1b6f. 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(): 3582. ファクトリ関数は通常の ‘cdecl’ 呼び出し規約を用
いてコールバック関数のための型を作成します。 Windows では、 *note
WINFUNCTYPE(): 3583. ファクトリ関数が ‘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(): 3582.
     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: 1aa6. で格納された値は異なるコールバックをまたいで
     生存は 'しません' 。


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: 5b5, Python runtime version number encoded in a single
constant integer.

‘ctypes’ can access values like this with the *note in_dll(): 3586.
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: 3587. ポインタにアクセスします。

この値のドキュメントから引用すると:

     このポインタは *note _frozen: b5c. のレコードからなり、終端の要素の
     メンバが ‘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: b5c. データ型を定義済みなので、このテーブルを指
すポインタを得ることができます。:

     >>> 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: 1c7c. からインスタンス化されたオブジェクトは
     、bytes または整数に設定された値しか持てません。

なぜ ‘False’ と表示されるのでしょうか?  ctypes インスタンスはメモリと、
メモリの内容にアクセスするいくつかの *note descriptor: 22a. (記述子)を含
むオブジェクトです。メモリブロックに 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(): 358c. 関数は既存の ctypes オブジェクトのメモリバッファの
サイズを変更したい場合に使えます。この関数は第一引数にオブジェクト、第二
引数に要求されたサイズをバイト単位で指定します。メモリブロックはオブジェ
クト型で指定される通常のメモリブロックより小さくすることはできません。こ
れをやろうとすると、 *note ValueError: 15a. が送出されます。:

     >>> 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>.
* 構造化データ型::
* 配列とポインタ::
* 例外: 例外<11>.


File: python.info,  Node: 共有ライブラリをロードする,  Next: 共有ライブラリを見つける,  Up: ctypesリファレンス

5.17.9.25 共有ライブラリをロードする
....................................

There are several ways to load shared libraries into the Python process.
One way is to instantiate *note CDLL: db1. 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: 68c. is released before calling any function exported by
     these libraries, and reacquired afterwards.  For different function
     behavior, use a subclass: *note OleDLL: 1d00, *note WinDLL: 1d01,
     or *note PyDLL: 1d02.

     If you have an existing *note handle: 3591. 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: 3592. attribute, but it may be
     adjusted and/or validated.

     If 'handle' is ‘None’, the underlying platform's ‘dlopen(3)(1)’ or
     LoadLibraryExW(2) 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 Windows, the ‘.DLL’ suffix may be missing.  (For details, see
     LoadLibraryExW(3) documentation.)  Other platform-specific prefixes
     and suffixes (for example, ‘lib’, ‘.so’, ‘.dylib’, or version
     numbers) must be present in 'name'; they are not added
     automatically.  See *note 共有ライブラリを見つける: 3593. for more
     information.

     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:
          3594. which works across platforms.

     'mode' パラメータを使うと、ライブラリがどうやってロードされたかを特
     定できます。 詳細は ‘dlopen(3)(4)’ マニュアルページを参考にしてくだ
     さい。 Windows では 'mode' は無視されます。 POSIX システムでは
     RTLD_NOW が常に追加され、設定変更はできません。

     The 'use_errno' parameter, when set to true, enables a ctypes
     mechanism that allows accessing the system *note errno: 5a. 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(): 3595. 関数は ctypes のプライベートコピー
     の値を返します。そして、 *note ctypes.set_errno(): 3596. 関数は
     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(): 1984. and ‘SetLastError()’ Windows API functions;
     *note ctypes.get_last_error(): 3597. and *note
     ctypes.set_last_error(): 3598. 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 LoadLibraryExW(5) 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: 543. 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(6) - A tool to find DLL dependents.

     バージョン 3.8 で変更: 'winmode' 引数が追加されました。

     バージョン 3.12 で変更: The 'name' parameter can now be a *note
     path-like object: 7a5.

     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: db1, the superclass, for common information.

     Functions in this library use the ‘stdcall’ calling convention, and
     are assumed to return the windows specific *note HRESULT: 3599.
     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:
     543. is automatically raised.

     *note Availability: 234c.: Windows

     バージョン 3.3 で変更: *note WindowsError: 140b. used to be raised,
     which is now an alias of *note OSError: 543.

 -- クラス: ctypes.WinDLL

     See *note CDLL: db1, the superclass, for common information.

     Functions in these libraries use the ‘stdcall’ calling convention,
     and are assumed to return int by default.

     *note Availability: 234c.: Windows

 -- クラス: ctypes.PyDLL

     See *note CDLL: db1, 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: 359d. class,
either by calling the *note LoadLibrary(): 3543. method, or by
retrieving the library as attribute of the loader instance.

 -- クラス: ctypes.LibraryLoader (dlltype)

     共有ライブラリをロードするクラス。 'dlltype' は *note CDLL: db1. 、
     *note PyDLL: 1d02. 、 *note WinDLL: 1d01. もしくは *note OleDLL:
     1d00. 型の一つであるべきです。

     ‘__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: db1. インスタンスを作ります。

      -- データ: ctypes.windll

          Creates *note WinDLL: 1d01. instances.

          *note Availability: 234c.: Windows

      -- データ: ctypes.oledll

          Creates *note OleDLL: 1d00. instances.

          *note Availability: 234c.: Windows

      -- データ: ctypes.pydll

          *note PyDLL: 1d02. インスタンスを作ります。

      -- データ: ctypes.pythonapi

          An instance of *note PyDLL: 1d02. 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: 1e84. ‘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://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw

   (3) 
https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw

   (4) https://manpages.debian.org/dlopen(3)

   (5) 
https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw

   (6) 
https://learn.microsoft.com/en-us/cpp/build/reference/dumpbin-reference?view=msvc-170


File: python.info,  Node: 共有ライブラリを見つける,  Next: Listing loaded shared libraries,  Prev: 共有ライブラリをロードする,  Up: ctypesリファレンス

5.17.9.26 共有ライブラリを見つける
..................................

When programming in a compiled language, shared libraries are accessed
when compiling/linking a program, and when the program is run.  The
programmer specifies a short name; the C compiler, linker, and runtime
dynamic library loader then interact in system-specific ways to find the
filename of the library to load.

While the mapping from short names to filenames is not consistently
exposed by platforms, the ‘ctypes.util’ module provides a function,
‘find_library()’, that attempts to match it.  However, as backwards
compatibility concerns make it difficult to adjust its behavior for new
platforms and configurations, the function is *note soft deprecated:
1b2.

If wrapping a shared library with ‘ctypes’, consider determining the
shared library name at development time, and hardcoding it into the
wrapper module instead of using ‘find_library()’ to locate the library
at runtime.  Also consider adding a configuration option or environment
variable to let users select a library to use, and then perhaps use
‘find_library()’ as a default or fallback.

 -- の関数: ctypes.util.find_library (name)

     Try to find a library and return a pathname.

     'name' is the "short" 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’.)  The result is in a format
     suitable for passing to *note CDLL: db1.

     If no library can be found, return ‘None’.

     The exact functionality is system dependent, and is 'not
     guaranteed' to match the behavior of the compiler, linker, and
     loader used for (or by) Python.  It is recommended to only use this
     function as a default or fallback,

     *note Soft deprecated: 1b2. since version 3.15: This function is
     kept for use in cases where it works, but not expected to be
     updated for additional platforms and configurations.

On Linux, ‘find_library()’ tries to run external programs
(‘/sbin/ldconfig’, ‘gcc’, ‘objdump’ and ‘ld’) to find the library file.
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, ‘find_library()’ 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, ‘find_library()’ 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’.

 -- の関数: 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.  Notably, this will happen for recent versions of the VC
     runtime library, which are not directly loadable.

     もし、例えば拡張モジュールにより割り付けられたメモリを ‘free(void
     *)’ で解放する必要があるなら、メモリ割り付けを行ったのと同じライブ
     ラリの関数を使うことが重要です。

     *note Availability: 234c.: Windows


File: python.info,  Node: Listing loaded shared libraries,  Next: 外部関数,  Prev: 共有ライブラリを見つける,  Up: ctypesリファレンス

5.17.9.27 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(): 48a. 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.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: 1b12. 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: 356a. attribute.

      -- の属性: argtypes

          関数が受け取る引数の型を指定するために ctypes 型のタプルを代入
          します。‘stdcall’ 呼び出し規約を使う関数はこのタプルの長さと同
          じ数の引数で呼び出されます。C 呼び出し規約を使う関数は、追加の
          不特定の引数も取ります。

          When a foreign function is called, each actual argument is
          passed to the *note from_param(): 3566. class method of the
          items in the *note argtypes: 1a20. tuple, this method allows
          adapting the actual argument to an object that the foreign
          function accepts.  For example, a *note c_char_p: 1c7c. 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():
          3566. 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 コールバック関数: 3581. を参照してく
ださい。

 -- の関数: ctypes.CFUNCTYPE (restype, *argtypes, use_errno=False,
          use_last_error=False)

     返された関数プロトタイプは標準 C 呼び出し規約をつかう関数を作成しま
     す。関数は呼び出されている間 GIL を解放します。 'use_errno' が真に
     設定されれば、呼び出しの前後で System 変数 *note errno: 5a. の
     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: 234c.: 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: 543. is raised if the
     COM method call fails.  If 'iid' is specified, a *note COMError:
     486. 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: 234c.: Windows

オプションの 'paramflags' パラメータは上述した機能より多機能な外部関数ラ
ッパーを作成します。

'paramflags' must be a tuple of the same length as *note argtypes: 1a20.

このタプルの個々の要素はパラメータについてのより詳細な情報を持ち、 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: 356a.
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: 356a. 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 監査イベント: 1e84. ‘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: 234c.: 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: 354a. の ctypes 配列です。

     If 'size' is given (and not ‘None’), it must be an *note int: 32e.
     It specifies the size of the returned array.

     If the 'init' argument is given, it must be *note bytes: 1d2.  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 監査イベント: 1e84.
     ‘ctypes.create_string_buffer’ を送出します。

 -- の関数: ctypes.create_unicode_buffer (init, size=None)

 -- の関数: ctypes.create_unicode_buffer (size)

     この関数は変更可能な Unicode 文字バッファを作成します。返されるオブ
     ジェクトは *note c_wchar: 354b. の ctypes 配列です。

     The function takes the same arguments as *note
     create_string_buffer(): 355d. except 'init' must be a string and
     'size' counts *note c_wchar: 354b.

     引数 ‘init’, ‘size’ を指定して *note 監査イベント: 1e84.
     ‘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: 234c.: 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: 234c.: 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: 543. 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: 234c.: 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(): 1984.

     *note Availability: 234c.: 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: 234c.: Windows

 -- の関数: ctypes.get_errno ()

     システムの *note errno: 5a. 変数の、スレッドローカルなプライベート
     コピーを返します。

     引数無しで *note 監査イベント: 1e84. ‘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: 234c.: Windows

     引数無しで *note 監査イベント: 1e84. ‘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: 5a. の、呼び出し元スレッドでの ctypes の
     プライベートコピーの現在値を 'value' に設定し、前の値を返します。

     引数 ‘errno’ を指定して *note 監査イベント: 1e84.
     ‘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: 234c.: Windows

     引数 ‘error’ を指定して *note 監査イベント: 1e84.
     ‘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: 1e84. ‘ctypes.string_at’ with
     arguments ‘ptr’, ‘size’.

 -- の関数: ctypes.WinError (code=None, descr=None)

     Creates an instance of *note OSError: 543.  If 'code' is not
     specified, *note GetLastError(): 1984. is called to determine the
     error code.  If 'descr' is not specified, *note FormatError():
     35ae. is called to get a textual description of the error.

     *note Availability: 234c.: Windows

     バージョン 3.3 で変更: An instance of *note WindowsError: 140b.
     used to be created, which is now an alias of *note OSError: 543.

 -- の関数: 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: 1e84. ‘ctypes.wstring_at’ with
     arguments ‘ptr’, ‘size’.

 -- の関数: ctypes.memoryview_at (ptr, size, readonly=False)

     Return a *note memoryview: 1dd. 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(): 489. 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(): 35b4. only takes integers, 'ptr' can also be given
     as a *note ctypes.POINTER: 48b. or a *note byref(): 356d. object.)

     Raises an *note auditing event: 1e84. ‘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(): 35aa. ヘルパー関数が返します。別のインス
     タンス変数が *note _objects: 35b8. として公開されます。これはメモリ
     ブロックがポインタを含む場合に存続し続ける必要のある他の Python オ
     ブジェクトを含んでいます。

     ctypes データ型の共通メソッド、すべてのクラスメソッドが存在します
     (正確には、 *note メタクラス: 25e4. のメソッドです):

      -- メソッド: from_buffer (source[, offset])

          このメソッドは 'source' オブジェクトのバッファを共有する
          ctypes のインスタンスを返します。 'source' オブジェクトは書き
          込み可能バッファインターフェースをサポートしている必要がありま
          す。オプションの 'offset' 引数では 'source' バッファのオフセッ
          トをバイト単位で指定します。デフォルトではゼロです。もし
          'source' バッファが十分に大きくなければ、 *note ValueError:
          15a. が送出されます。

          引数 ‘pointer’, ‘size’, ‘offset’ を指定して *note
          監査イベント: 1e84. ‘ctypes.cdata/buffer’ を送出します。

      -- メソッド: from_buffer_copy (source[, offset])

          このメソッドは 'source' オブジェクトの読み出し可能バッファをコ
          ピーすることで、ctypes のインスタンスを生成します。オプション
          の 'offset' 引数では 'source' バッファのオフセットをバイト単位
          で指定します。デフォルトではゼロです。もし 'source' バッファが
          十分に大きくなければ、 *note ValueError: 15a. が送出されます。

          引数 ‘pointer’, ‘size’, ‘offset’ を指定して *note
          監査イベント: 1e84. ‘ctypes.cdata/buffer’ を送出します。

      -- メソッド: from_address (address)

          このメソッドは 'address' で指定されたメモリを使って ctypes 型
          のインスタンスを返します。 'address' は整数でなければなりませ
          ん。

          This method, and others that indirectly call this method,
          raises an *note auditing event: 1e84. ‘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:
          1a20. 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():
          48b. 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_: 35bb. 読み出し専用属性は、メモリブロ
          ックを保持する 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: 35bf. は *note _CData: 35b7.
     の子クラスなので、そのメソッドと属性を継承しています。ポインタでな
     いかポインタを含まない 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
          string.  See *note 基本データ型: 2a4a. 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: 353d, *note c_longlong: 3558. and *note
          c_time_t: 1d80. all refer to a single class, ‘c_long’, whose
          *note _type_: 2d8. code is ‘'l'’.  The ‘'L'’ code will be
          unused.

          参考
          ....

          The *note array: 8. and *note struct: 2a46. 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: 3569. of *note c_char_p: 1c7c,
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:
1c7e, 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: 1ecd. の
     別名です。

 -- クラス: ctypes.c_float

     C float データ型を表します。コンストラクタはオプションの浮動小数点
     数初期化子を受け取ります。

 -- クラス: ctypes.c_double_complex

     Represents the C double complex datatype, if available.  The
     constructor accepts an optional *note complex: 330. 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: 330. 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: 330. initializer.

     Added in version 3.14.

 -- クラス: ctypes.c_int

     C signed int データ型を表します。コンストラクタはオプションの整数初
     期化子を受け取ります。オーバーフローのチェックは行われません。
     ‘sizeof(int) == sizeof(long)’ であるプラットフォームでは、 *note
     c_long: 353d. の別名です。

 -- クラス: ctypes.c_int8

     Represents the C 8-bit signed int datatype.  It is an alias for
     *note c_byte: 1cfe.

 -- クラス: ctypes.c_int16

     C 16-bit signed int データ型を表します。たいていは、 *note c_short:
     354c. の別名です。

 -- クラス: ctypes.c_int32

     C 32-bit signed int データ型を表します。たいていは、 *note c_int:
     353c. の別名です。

 -- クラス: ctypes.c_int64

     C 64-bit signed int データ型を表します。たいていは、 *note
     c_longlong: 3558. の別名です。

 -- クラス: 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: 353d.

 -- クラス: 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: e28. 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: 3557. の別名です。

 -- クラス: ctypes.c_uint8

     Represents the C 8-bit unsigned int datatype.  It is an alias for
     *note c_ubyte: 1cff.

 -- クラス: ctypes.c_uint16

     C 16-bit unsigned int データ型を表します。たいていは、 *note
     c_ushort: 354d. の別名です。

 -- クラス: ctypes.c_uint32

     C 32-bit unsigned int データ型を表します。たいていは、 *note
     c_uint: 3552. の別名です。

 -- クラス: ctypes.c_uint64

     C 64-bit unsigned int データ型を表します。たいていは、 *note
     c_ulonglong: 3559. の別名です。

 -- クラス: 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: 353d.

 -- クラス: 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: 234c.: Windows

 -- クラス: ctypes.py_object

     C *note PyObject: 1a6.* データ型を表します。引数なしでこれを呼び出
     すと ‘NULL’ PyObject* ポインタを作成します。

     バージョン 3.14 で変更: ‘py_object’ is now a *note generic type:
     1dc.

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: 483. 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_: 1b6f.
     class variable.  ‘ctypes’ will create *note descriptor: 22a.s which
     allow reading and writing the fields by direct attribute accesses.
     These are the

      -- の属性: _fields_

          構造体のフィールドを定義するシーケンス。要素は2要素タプルか3要
          素タプルでなければなりません。第一要素はフィールドの名前です。
          第二要素はフィールドの型を指定します。それはどんな ctypes デー
          タ型でも構いません。

          *note c_int: 353c. のような整数型のために、オプションの第三要
          素を与えることができます。フィールドのビット幅を定義する正の小
          整数である必要があります。

          一つの構造体と共用体の中で、フィールド名はただ一つである必要が
          あります。これはチェックされません。名前が繰り返しでてきたとき
          にアクセスできるのは一つのフィールドだけです。

          Structure サブクラスを定義するクラス文の '後で' 、 *note
          _fields_: 1b6f. クラス変数を定義することができます。これにより
          、次のように自身を直接または間接的に参照するデータ型を作成でき
          るようになります:

               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: 1b4.

          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(): 35b1. is called on it,
          and so on.  Later assignments to ‘_fields_’ will raise an
          *note AttributeError: 1b4.  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_: 1b6f. 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_: 321.).

          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_: 1b6f. 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_: 321. 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_: 1b6f.
          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_: 320. 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_: 320. is specified: ‘"ms"’.  (This is
               deprecated; see ‘_pack_’ documentation.)

             - Otherwise: ‘"gcc-sysv"’

          ‘_layout_’ must already be defined when *note _fields_: 1b6f.
          is assigned, otherwise it will have no effect.

          Added in version 3.14.

      -- の属性: _anonymous_

          無名 (匿名) フィールドの名前が並べあげられたオプションのシーケ
          ンス。 *note _fields_: 1b6f. が代入されたとき、 *note
          _anonymous_: 35c3. がすでに定義されていなければなりません。そ
          うでなければ、何ら影響はありません。

          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_: 1b6f. 変
     数がある場合は、この中で指定されたフィールドは基底クラスのフィール
     ドへ追加されます。

     構造体と共用体のコンストラクタは位置引数とキーワード引数の両方を受
     け取ります。位置引数は *note _fields_: 1b6f. の中に現れたのと同じ順
     番でメンバーフィールドを初期化するために使われます。コンストラクタ
     のキーワード引数は属性代入として解釈され、そのため、同じ名前をもつ
     ‘_fields_’ を初期化するか、 ‘_fields_’ に存在しない名前に対しては新
     しい属性を作ります。

 -- クラス: ctypes.CField (*args, **kw)

     Descriptor for fields of a *note Structure: 483. and *note Union:
     484.  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_: 1b6f.; 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: 35b5.

      -- の属性: 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: 35c8.

      -- の属性: 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: 35c9.

          For bitfields, this contains a backwards-compatible bit-packed
          value that combines *note bit_size: 35cb. and *note
          bit_offset: 35c8.  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: 35c9. bytes of memory starting at
          *note byte_offset: 35c7.

          To get the field's value, read the storage unit as an integer,
          *note shift left: 26df. 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: 例外<11>,  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_: 35d0. and *note _type_: 35d1. 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’.

      -- の属性: _length_

          配列の要素数を指定する正の整数。範囲外の添え字を指定すると、
          *note IndexError: 18ed. が送出されます。*note len(): a24. がこ
          の整数を返します。

      -- の属性: _type_

          配列内の各要素の型を指定します。

     配列のサブクラスのコンストラクタは、位置引数を受け付けて、配列を順
     番に初期化するために使用します。

 -- の関数: ctypes.ARRAY (type, length)

     Create an array.  Equivalent to ‘type * length’, where 'type' is a
     ‘ctypes’ data type and 'length' an integer.

     *note Soft deprecated: 1b2. since version 3.14: In favor of
     multiplication.

 -- クラス: ctypes._Pointer

     ポインタのためのプライベートな抽象基底クラスです。

     具象ポインタ型は、ポイント先の型を持つ *note POINTER(): 48b. を呼び
     出すことで、作成できます。これは、 *note pointer(): 1c7b. により自
     動的に行われます。

     ポインタが配列を指す場合、その配列の要素は、標準の添え字とスライス
     によるアクセスを使用して読み書きが行えます。ポインタオブジェクトに
     は、サイズがないため、 *note len(): a24. 関数は *note TypeError:
     29c. を送出します。負の添え字は、(C と同様に) ポインタの '前' のメ
     モリから読み込み、範囲外の添え字はおそらく (幸運な場合でも) アクセ
     ス違反によりクラッシュを起こします。

      -- の属性: _type_

          ポイント先の型を指定します。

      -- の属性: contents

          ポインタが指すオブジェクトを返します。この属性に割り当てると、
          ポインタが割り当てられたオブジェクトを指すようになります。


File: python.info,  Node: 例外<11>,  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: 234c.: 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:
     35df. 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
チュートリアル: 35e0. では、コマンドラインの解析についてより優しく説明し
ています。

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:
161e.  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: 1e7.  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(): 3f4. メソッドは各引数の仕様をパーサ
ーに付属させます。このメソッドは位置引数、値を受け取るオプション、機能の
オン／オフを切り替えるフラグをサポートします:

     parser.add_argument('filename')           # 位置引数
     parser.add_argument('-c', '--count')      # 値を取るオプション
     parser.add_argument('-v', '--verbose',
                         action='store_true')  # オン／オフフラグ

*note ArgumentParser.parse_args(): 35e1. メソッドはパーサーを実行し、抽
出したデータを *note argparse.Namespace: 35e2. オブジェクト内に配置しま
す:

     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: 156c.

* Menu:

* ArgumentParser オブジェクト::
* add_argument() メソッド: add_argument メソッド.
* parse_args() メソッド: parse_args メソッド.
* その他のユーティリティ::
* 例外: 例外<12>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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=True, color=True)

     新しい *note ArgumentParser: 1e7. オブジェクトを生成します。すべて
     の引数はキーワード引数として渡すべきです。各引数についてはあとで詳
     しく説明しますが、簡単に言うと:

        * *note prog: 45e. - The name of the program (default: generated
          from the ‘__main__’ module attributes and ‘sys.argv[0]’)

        * *note usage: 35e4. - プログラムの利用方法を記述する文字列 (デ
          フォルト: パーサーに追加された引数から生成されます)

        * *note description: 35e5. - 引数のヘルプの前に表示されるテキス
          ト (デフォルトはテキストなしです)

        * *note epilog: 35e6. - 引数のヘルプの後に表示されるテキスト (デ
          フォルトはテキストなしです)

        * *note parents: 35e7. - *note ArgumentParser: 1e7. オブジェクト
          のリストで、このオブジェクトの引数が追加されます

        * *note formatter_class: 35e8. - ヘルプ出力をカスタマイズするた
          めのクラス

        * *note prefix_chars: 35e9. - オプションの引数の prefix になる文
          字集合 (デフォルト: '-')

        * *note fromfile_prefix_chars: 35ea. - 追加の引数を読み込むファ
          イルの prefix になる文字集合 (デフォルト: ‘None’)

        * *note argument_default: 35eb. - 引数のグローバルなデフォルト値
          (デフォルト: ‘None’)

        * *note conflict_handler: 35ec. - 衝突するオプションを解決する方
          法 (通常は不要)

        * *note add_help: 35ed. - ‘-h/--help’ オプションをパーサーに追加
          する (デフォルト: ‘True’)

        * *note allow_abbrev: 117b. - Allows long options to be
          abbreviated if the abbreviation is unambiguous (default:
          ‘True’)

        * *note exit_on_error: 35ee. - Determines whether or not
          ‘ArgumentParser’ exits with error info when an error occurs.
          (default: ‘True’)

        * *note suggest_on_error: 35ef. - Enables suggestions for
          mistyped argument choices and subparser names (default:
          ‘True’)

        * *note color: 35f0. - 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.

     バージョン 3.15 で変更: 'suggest_on_error' default changed to
     ‘True’.

以下の節では各オプションの利用方法を説明します。

* 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: 1e7. calculates the name of the
program to display in help messages depending on the way the Python
interpreter was run:

   * The *note base name: 2e79. 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: 4d1. 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:
1e7.:

     >>> 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: 1e7. 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(): fda. or the ‘prog’ and the ‘usage’ arguments to *note
add_parser(): 35f2, 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: 1e7. 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: 35e8. 引数を参照してください。


File: python.info,  Node: epilog,  Next: parents,  Prev: description,  Up: ArgumentParser オブジェクト

5.18.1.5 epilog
...............

いくつかのプログラムは、プログラムについての追加の説明を引数の説明の後に
表示します。このテキストは *note ArgumentParser: 1e7. の ‘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: 35e5. 引数と同じく、‘epilog=’ テキストもデフォルトで
折り返され、*note ArgumentParser: 1e7. の *note formatter_class: 35e8. 引
数で動作を調整できます。


File: python.info,  Node: parents,  Next: formatter_class,  Prev: epilog,  Up: ArgumentParser オブジェクト

5.18.1.6 parents
................

ときどき、いくつかのパーサーが共通の引数セットを共有することがあります。
それらの引数を繰り返し定義する代わりに、すべての共通引数を持ったパーサー
を *note ArgumentParser: 1e7. の ‘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: 1e7. は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: 1e7. オブジェクトは代わりのフォーマットクラスを指
定することでヘルプのフォーマットをカスタマイズできます。現在、4つのフォ
ーマットクラスがあります:

 -- クラス: argparse.RawDescriptionHelpFormatter
 -- クラス: argparse.RawTextHelpFormatter
 -- クラス: argparse.ArgumentDefaultsHelpFormatter
 -- クラス: argparse.MetavarTypeHelpFormatter

*note RawDescriptionHelpFormatter: 35f5. と *note RawTextHelpFormatter:
35f6. はどのようにテキストの説明を表示するかを指定できます。デフォルトで
は *note ArgumentParser: 1e7. オブジェクトはコマンドラインヘルプの中の
*note description: 35e5. と *note epilog: 35e6. を折り返して表示します:

     >>> 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: 35f5. を渡した
場合、 *note description: 35e5. と *note epilog: 35e6. は整形済みとされ
改行されません:

     >>> 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: 35f6. 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: 1e66. は各引数のデフォルト値を自動
的にヘルプに追加します:

     >>> 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: 35f7. は、各引数の値の表示名に *note
type: 35f8. 引数の値を使用します (通常は *note dest: 35f9. の値が使用さ
れます):

     >>> 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: 1e7. 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: 1e7. のコンストラクターに ‘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(): 35fa.) and are treated as if they were
in the same place as the original file referencing argument on the
command line.  So in the example above, the expression ‘['-f', 'foo',
'@args.txt']’ is considered equivalent to the expression ‘['-f', 'foo',
'-f', 'bar']’.

     注釈: Empty lines are treated as empty strings (‘''’), which are
     allowed as values but not as arguments.  Empty lines that are read
     as arguments will result in an "unrecognized arguments" error.

*note ArgumentParser: 1e7. uses *note filesystem encoding and error
handler: 94d. to read the file containing arguments.

‘fromfile_prefix_chars=’ 引数のデフォルト値は ‘None’ で、引数がファイル
参照として扱われることがないことを意味しています。

バージョン 3.12 で変更: *note ArgumentParser: 1e7. changed encoding and
errors to read arguments files from default (e.g.  *note
locale.getpreferredencoding(False): 94c. and ‘"strict"’) to the *note
filesystem encoding and error handler: 94d.  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(): 3f4. メソッドにデ
フォルト値を渡すか、*note set_defaults(): 35fb. メソッドに名前と値のペア
を渡すことで指定します。しかしまれに、1つのパーサー全体に適用されるデフ
ォルト引数が便利なことがあります。これを行うには、 *note ArgumentParser:
1e7. に ‘argument_default=’ キーワード引数を渡します。例えば、全体で
*note parse_args(): 35e1. メソッド呼び出しの属性の生成を抑制するには、
‘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: 1e7. の *note parse_args(): 35e1. に引数のリ
ストを渡すとき、長いオプションは *note 短縮しても認識されます: 117c.。

この機能は、‘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: 1e7. オブジェクトは同じオプション文字列に対して複
数のアクションを許可していません。 デフォルトでは、‘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: 35e7. を利用する場合など)、古い引数を同
じオプション文字列で上書きするほうが便利な場合があります。この動作をする
には、*note ArgumentParser: 1e7. の ‘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: 1e7. オブジェクトは、すべてのオプション文字列が上
書きされた場合にだけアクションを削除することに注目してください。上の例で
は、 ‘--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: 1e7. 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: 1e7. の ‘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(): 35e1. method of an *note ArgumentParser: 1e7, it will
print a 'message' to *note sys.stderr: d09. 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: 1e7. will exit with error info and provide
suggestions for mistyped arguments.  The error message will list the
permissible argument choices (if specified) or subparser names, along
with a "maybe you meant" suggestion if a close match is found.  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)

You can disable suggestions by setting ‘suggest_on_error’ to ‘False’.

Added in version 3.14.

バージョン 3.15 で変更: Changed default value of ‘suggest_on_error’ from
‘False’ to ‘True’.


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: 1ba, 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.

Added in version 3.14.

To highlight inline code in your description, epilog, or argument ‘help’
text, you can use single or double backticks:

     >>> parser = argparse.ArgumentParser(
     ...     formatter_class=argparse.RawDescriptionHelpFormatter,
     ...     description='Run ``python -m myapp`` to start.',
     ...     epilog='''Examples:
     ...   `python -m myapp --verbose`
     ...   ``python -m myapp --config settings.json``
     ... ''')
     >>> parser.add_argument('--foo', help='set the `foo` value')

When colors are enabled, the text inside backticks will be displayed in
a distinct color to help examples stand out.  When colors are disabled,
backticks are preserved as-is, which is readable in plain text.

Added in version 3.15.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/ANSI_escape_code


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: 35fe. - Either a name or a list of option
          strings, e.g.  ‘'foo'’ or ‘'-f', '--foo'’.

        * *note action: 1b65. - コマンドラインにこの引数があったときのア
          クション。

        * *note nargs: 1957. - 受け取るべきコマンドライン引数の数。

        * *note const: 1b6c. - 一部の *note action: 1b65. と *note
          nargs: 1957. の組み合わせで利用される定数。

        * *note default: 1b6b. - コマンドラインに対応する引数が存在せず
          、さらに namespace オブジェクトにも存在しない場合に利用される
          値。

        * *note type: 35f8. - コマンドライン引数が変換されるべき型。

        * *note choices: 1b67. - 引数として許される値のシーケンス。

        * *note required: 35ff. - コマンドラインオプションが省略可能かど
          うか (オプション引数のみ)。

        * *note help: 3600. - 引数が何なのかを示す簡潔な説明。

        * *note metavar: 3601. - 使用法メッセージの中で使われる引数の名
          前。

        * *note dest: 35f9. - *note parse_args(): 35e1. が返すオブジェク
          トに追加される属性名。

        * *note deprecated: 3602. - Whether or not use of the argument
          is deprecated.

     The method returns an *note Action: 1da7. 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(): 3f4. メソッドは、指定されている引数が ‘-f’ や
‘--foo’ のようなオプション引数なのか、ファイル名リストなどの位置引数なの
かを知る必要があります。 そのため、 ‘add_argument()’ に初めに渡される引
数は、一連のフラグか、単一の引数名のどちらかになります。

たとえば、オプション引数は次のように作成します:

     >>> parser.add_argument('-f', '--foo')

一方、位置引数は次のように作成します:

     >>> parser.add_argument('bar')

*note parse_args(): 35e1. が呼ばれたとき、オプション引数は接頭辞 ‘-’ に
より識別され、それ以外の引数は位置引数として扱われます:

     >>> 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: 35f9. and *note metavar: 3601. parameters.  For optional
arguments, the *note dest: 35f9. parameter defaults to the argument
name, with underscores ‘_’ replacing hyphens ‘-’.  The *note metavar:
3601. 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: 1e7. オブジェクトはコマンドライン引数にアクション
を割り当てます。このアクションは、割り当てられたコマンドライン引数に関し
てどんな処理でもできますが、ほとんどのアクションは単に *note
parse_args(): 35e1. が返すオブジェクトに属性を追加するだけです。‘action’
キーワード引数は、コマンドライン引数がどう処理されるかを指定します。提供
されているアクションは:

   * ‘'store'’ - This just stores the argument's value.  This is the
     default action.

   * ‘'store_const'’ - このアクションは *note const: 1b6c. キーワード引
     数で指定された値を格納します。*note const: 1b6c. キーワード引数のデ
     フォルト値は ‘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: 1b6c. keyword argument to a list; note that the *note const:
     1b6c. 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: 1957. keyword argument value ‘'+'’ or ‘'*'’.  Note that when
     *note nargs: 1957. 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: 1e7. を参照してください。

   * ‘'version'’ - このアクションは *note add_argument(): 3f4. の呼び出
     しに ‘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:
1da7. subclass (e.g.  *note BooleanOptionalAction: 1e6.) 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:
1da7, overriding the ‘__call__()’ method and optionally the ‘__init__()’
and ‘format_usage()’ methods.  You can also register custom actions
using the *note register(): 3605. 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: 1da7. を参照してください。


File: python.info,  Node: nargs,  Next: const,  Prev: action,  Up: add_argument メソッド

5.18.1.20 nargs
...............

*note ArgumentParser: 1e7. 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 多義性のある引数の指定: 3607.  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:
     1b6b. の値が生成されます。オプション引数の場合、さらにオプション引
     数が指定され、その後にコマンドライン引数がないというケースもありえ
     ます。この場合は *note const: 1b6c. の値が生成されます。この動作の
     例です:

          >>> 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: 1b65.  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(): 3f4. の ‘const’ 引数は、コマンドライン引数から読み
込まれないけれども *note ArgumentParser: 1e7. のいくつかのアクションで必
要とされる値のために使われます。この引数のよくある2つの使用法は:

   * *note add_argument(): 3f4. が ‘action='store_const'’ か
     ‘action='append_const'’ で呼び出されたとき、これらのアクションは
     ‘const’ の値を *note parse_args(): 35e1. が返すオブジェクトの属性に
     追加します。サンプルは *note action: 1b65. の説明を参照してください
     。‘const’ が ‘add_argument()’ に与えられなければ、‘None’ のデフォル
     ト値を受け取ります。

   * When *note add_argument(): 3f4. 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: 1957. 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(): 3f4. の ‘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: 35e2. の属性を設
定する前に、*note type: 35f8. 変換引数が与えられていればそれらを適用しま
す。そうでない場合、パーサーは値をそのまま使用します:

     >>> 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: 1957. が ‘?’ か ‘*’ である位置引数では、コマンドライン引数
が指定されなかった場合 ‘default’ の値が使われます。例えば:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('foo', nargs='?', default=42)
     >>> parser.parse_args(['a'])
     Namespace(foo='a')
     >>> parser.parse_args([])
     Namespace(foo=42)

For *note required: 35ff. arguments, the ‘default’ value is ignored.
For example, this applies to positional arguments with *note nargs:
1957. 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: 32f, *note int: 32e. など別
の型として扱うべき事がよくあります。*note add_argument(): 3f4. の ‘type’
キーワード引数に指定する type converter により、必要な型チェックと型変換
を行うことができます。

もし *note type: 35f8. キーワードが *note default: 1b6b. キーワードとと
もに使用された場合、*note default: 1b6b. の値が文字列のときのみ、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(): 3605.) If the
function raises *note ArgumentTypeError: 360b, *note TypeError: 29c, or
*note ValueError: 15a, 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(): 5f6. 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: 1e6. or ‘action='store_true'’ for
common alternatives.

一般論として、‘type’ キーワードに指定するものは、せいぜい上記の3種類の例
外を発生するくらいの、お手軽な変換に限るべきです。より複雑な
(interesting) エラー処理、またはリソース管理を伴うものは、引数を解析した
あとに別個の処理として行うべきです。

たとえば、JSON または YAML からの変換は複雑なエラーケースを持つので、
‘type’ がサポートする以上のエラー表示を必要とするでしょう。(JSON デコー
ダが発生しうる) *note JSONDecodeError: 11d9. は適切に整形されて表示され
ません。また、*note FileNotFoundError: 24f. が発生しても parser は何も処
理しません。

Even *note FileType: 326. 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: 215.-statement to manage the files.

なお、引数が、あらかじめ決められた値の候補のいずれかに一致するかをチェッ
クしたいだけの場合には、代わりに *note choices: 1b67. キーワードの使用を
検討してください。


File: python.info,  Node: choices,  Next: required,  Prev: type,  Up: add_argument メソッド

5.18.1.24 choices
.................

コマンドライン引数をいくつかの選択肢の中から選ばせたい場合があります。 こ
れは *note add_argument(): 3f4. に シーケンスオブジェクトを '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:
4e0. オブジェクト、 *note tuple: 1d9. オブジェクト、カスタムシーケンスは
すべてサポートされています。

ただし、*note enum.Enum: a26. を渡すことは推奨されません。使用方法、ヘル
プ、エラーメッセージなどでどのように表示されるかを制御することが難いから
です。

Note that 'choices' are checked after any *note type: 35f8. conversions
have been performed, so objects in 'choices' should match the *note
type: 35f8. 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: 35f8. and handle
conversion in your application code.

ヘルプテキストにおいて整形された choices の値は、通常 'dest' から生成さ
れるデフォルトの 'metavar' に優先します。ユーザーは 'dest' パラメータを
目にすることがないため、この振る舞いは基本的には望ましいものです。もしこ
の表示方法が望ましくない場合 (おそらく多くの選択肢がある場合など) は、
*note metavar: 3601. を明示的に指定してください。


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(): 3f4.:

     >>> 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():
35e1. はそのフラグがコマンドラインに存在しないときにエラーを表示します。

     注釈: ユーザーは、通常 'フラグ' の指定は '任意' であると認識してい
     るため、必須にするのは一般的には悪いやり方で、できる限り避けるべき
     です。


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: 1b6b. などを繰り
返し記述するのを避けるためのフォーマット指定子を含めることができます。利
用できる指定子には、プログラム名 ‘%(prog)s’ と、 ‘%(default)s’ や
‘%(type)s’ など *note add_argument(): 3f4. のキーワード引数の多くが含ま
れます:

     >>> 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: 1e7. generates help messages, it needs some
way to refer to each expected argument.  By default, ‘ArgumentParser’
objects use the *note dest: 35f9. value as the "name" of each object.
By default, for positional argument actions, the *note dest: 35f9. value
is used directly, and for optional argument actions, the *note dest:
35f9. 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(): 35e1. の返すオブジェクトの属性名は *note dest: 35f9.
の値のままです。

‘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: 1e7. のアクションは *note parse_args():
35e1. が返すオブジェクトに対する属性として値を追加します。この属性の名前
は *note add_argument(): 3f4. の ‘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: 1e7. generates the value
of ‘dest’ by taking the first double-dash long option string and
stripping away the initial ‘-’ characters.  If no double-dash long
option strings were supplied, ‘dest’ will be derived from the first
single-dash long option string by stripping the initial ‘-’ character.
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('-q', '-quz')
     >>> parser.add_argument('-x', '-y')
     >>> parser.parse_args('-f 1 -q 2 -x 3'.split())
     Namespace(foo_bar='1', quz='2', x='3')
     >>> parser.parse_args('--foo 1 -quz 2 -y 3'.split())
     Namespace(foo_bar='1', quz='2', x='2')

‘dest’ にカスタムの属性名を与えることも可能です:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo', dest='bar')
     >>> parser.parse_args('--foo XXX'.split())
     Namespace(bar='XXX')

バージョン 3.15 で変更: Single-dash long option now takes precedence
over short options.


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(): 3f4, 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: d09. 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(): 3f4.

 -- クラス: 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: 1e7. 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(): 3f4. 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: 1e7. object which
               contains this action.

             * 'namespace' - The *note Namespace: 35e2. object that will
               be returned by *note parse_args(): 35e1.  Most actions
               add an attribute to this object using *note setattr():
               27d6.

             * 'values' - The associated command-line arguments, with
               any type conversions applied.  Type conversions are
               specified with the *note type: 35f8. keyword argument to
               *note add_argument(): 3f4.

             * '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: 1da7. 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)

     Single-dash long options are also supported.  For example, negative
     option ‘-nofoo’ is automatically added for positive option ‘-foo’.
     But no additional options are added for short options such as ‘-f’.

     Added in version 3.9.

     バージョン 3.15 で変更: Added support for single-dash options.

     Added support for alternate *note prefix_chars: 35e9.


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(): 3f4. determine exactly what
     objects are created and how they are assigned.  See the
     documentation for ‘add_argument()’ for details.

        * *note args: 3616. - 解析する文字列のリスト。デフォルトでは
          *note sys.argv: 161e. から取得されます。

        * *note namespace: 3617. - 属性を代入するオブジェクト。デフォル
          トでは、新しい空の *note Namespace: 35e2. オブジェクトです。

* Menu:

* オプション値の文法::
* 不正な引数::
* - を含む引数::
* 引数の短縮形 (先頭文字でのマッチング): 引数の短縮形 先頭文字でのマッチング.
* sys.argv 以外: sys argv 以外.
* Namespace オブジェクト::


File: python.info,  Node: オプション値の文法,  Next: 不正な引数,  Up: parse_args メソッド

5.18.1.32 オプション値の文法
............................

*note parse_args(): 35e1. メソッドは、オプションの値がある場合、そのオプ
ションの値の指定に複数の方法をサポートしています。もっとも単純な場合には
、オプションとその値は次のように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(): 35e1. は、コマンドラインの解析中に、曖昧なオプション
、不正な型、不正なオプション、位置引数の数の不一致などのエラーを検証しま
す。それらのエラーが発生した場合、エラーメッセージと使用法メッセージを表
示して終了します:

     >>> 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(): 35e1. メソッドは、ユーザーが明らかなミスをした場合は
エラーを表示しますが、いくつか本質的に曖昧な場面があります。例えば、コマ
ンドライン引数 ‘-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(): 35e1. にそれ以降のすべてが
位置引数だと教えることができます:

     >>> parser.parse_args(['--', '-f'])
     Namespace(foo='-f', one=None)

See also *note the argparse howto on ambiguous arguments: 3607. for more
details.


File: python.info,  Node: 引数の短縮形 先頭文字でのマッチング,  Next: sys argv 以外,  Prev: - を含む引数,  Up: parse_args メソッド

5.18.1.35 引数の短縮形 (先頭文字でのマッチング)
...............................................

*note parse_args(): 35e1. メソッドは、*note デフォルトで: 117b.、長いオ
プションに曖昧さがない (先頭文字列が一意である) かぎり、先頭文字列に短縮
して指定できます:

     >>> 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: 117b. に ‘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: 1e7. parse
arguments other than those of *note sys.argv: 161e.  This can be
accomplished by passing a list of strings to *note parse_args(): 35e1.
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(): 35e1. が属性を格納して返すためのオブジェクトに
     デフォルトで使用されるシンプルなクラスです。

     このクラスはシンプルに設計されており、単に読みやすい文字列表現を持
     った *note object: e51. のサブクラスです。もし属性を辞書のように扱
     える方が良ければ、標準的な Python のイディオム *note vars(): 2030.
     を利用できます:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo')
          >>> args = parser.parse_args(['--foo', 'BAR'])
          >>> vars(args)
          {'foo': 'BAR'}

     *note ArgumentParser: 1e7. が、新しい *note Namespace: 35e2. オブジ
     ェクトではなく、既存のオブジェクトに属性を設定する方が良い場合があ
     ります。これは ‘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: 例外<12>,  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:
     1e7. 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, *note add_parser(): 35f2,
     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: 1e7.)

        * *note action: 1b65. - コマンドラインにこの引数があったときの基
          本のアクション。

        * *note dest: 35f9. - name of the attribute under which
          subcommand name will be stored; by default ‘None’ and no value
          is stored

        * *note required: 35ff. - サブコマンドが必須であるかどうかを指定
          し、デフォルトは ‘False’ です。(3.7 より追加)

        * *note help: 3600. - ヘルプ出力に表示されるサブパーサーグループ
          のヘルプです。デフォルトは ‘None’ です

        * *note metavar: 3601. - 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(): 35e1. 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.

     同じように、サブパーサーにヘルプメッセージが要求された場合は、その
     パーサーに対するヘルプだけが表示されます。ヘルプメッセージには親パ
     ーサーや兄弟パーサーのヘルプメッセージを表示しません。 (ただし、各
     サブパーサーコマンドのヘルプメッセージは、上の例にもあるように
     *note add_parser(): 35f2. の ‘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

     One particularly effective way of handling subcommands is to
     combine the use of the ‘add_subparsers()’ method with calls to
     *note set_defaults(): 35fb. 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(): 35e1. 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.

 -- メソッド: _SubParsersAction.add_parser (name, *, help=None,
          aliases=None, deprecated=False, **kwargs)

     Create and return a new *note ArgumentParser: 1e7. object for the
     subcommand 'name'.

     The 'name' argument is the name of the sub-command.

     The 'help' argument provides a short description for this
     sub-command.

     The 'aliases' argument allows providing alternative names for this
     sub-command.  For example:

          >>> 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')

     The 'deprecated' argument, if ‘True’, marks the sub-command as
     deprecated and will issue a warning when used.  For example:

          >>> parser = argparse.ArgumentParser(prog='chicken.py')
          >>> subparsers = parser.add_subparsers()
          >>> fly = subparsers.add_parser('fly', deprecated=True)
          >>> args = parser.parse_args(['fly'])
          chicken.py: warning: command 'fly' is deprecated
          Namespace()

     All other keyword arguments are passed directly to the
     ‘ArgumentParser’ constructor.

     Added in version 3.13: Added the 'deprecated' parameter.


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: 326. ファクトリは *note
     ArgumentParser.add_argument(): 3f4. の type 引数に渡すことができる
     オブジェクトを生成します。 type が ‘FileType’ オブジェクトである引
     数はコマンドライン引数を、指定されたモード、バッファーサイズ、エン
     コーディング、エラー処理でファイルとして開きます (詳細は *note
     open(): 333. 関数を参照してください。):

          >>> 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: 326. であれば *note sys.stdin: 94f. を、書き込み用の
     ‘FileType’ であれば *note sys.stdout: ea0. に変換します:

          >>> 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: 215.-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: 1e7. 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(): 3f4. method just like a regular
     *note ArgumentParser: 1e7.  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: 35eb.
     and *note conflict_handler: 35ec. allow for finer-grained control
     of the behavior of the argument group.  These parameters have the
     same meaning as in the *note ArgumentParser: 1e7. 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: 35e9. 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(): 56e. メソッドの引数
     '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(): 325.  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(): 325. 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(): 35e1. が返すオブジェクトの属性
     はコマンドライン引数の内容と引数のアクションによってのみ決定されま
     す。 *note set_defaults(): 35fb. を使うと与えられたコマンドライン引
     数の内容によらず追加の属性を決定することが可能です:

          >>> 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(): 35fb. and at the argument level using *note
     add_argument(): 3f4.  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(): fda. メソッドを
     参照してください。

 -- メソッド: ArgumentParser.get_default (dest)

     *note add_argument(): 3f4. か *note set_defaults(): 35fb. によって
     指定された、 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(): 35e1. が使用
法やエラーメッセージのフォーマットと表示について面倒を見ます。しかし、い
くつかのフォーマットメソッドが利用できます:

 -- メソッド: ArgumentParser.print_usage (file=None)

     *note ArgumentParser: 1e7. がコマンドラインからどう実行されるべきか
     の短い説明を表示します。 'file' が ‘None’ の時は、 *note
     sys.stdout: ea0. に出力されます。

 -- メソッド: ArgumentParser.print_help (file=None)

     プログラムの使用法と *note ArgumentParser: 1e7. に登録された引数に
     ついての情報を含むヘルプメッセージを表示します。 'file' が ‘None’ の
     時は、 *note sys.stdout: ea0. に出力されます。

これらのメソッドの、表示する代わりにシンプルに文字列を返すバージョンもあ
ります:

 -- メソッド: ArgumentParser.format_usage ()

     *note ArgumentParser: 1e7. がコマンドラインからどう実行されるべきか
     の短い説明を格納した文字列を返します。

 -- メソッド: ArgumentParser.format_help ()

     プログラムの使用法と *note ArgumentParser: 1e7. に登録された引数に
     ついての情報を含むヘルプメッセージを格納した文字列を返します。


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(): 35e1, 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 先頭文字でのマッチング: 117c. ルールは *note
     parse_known_args(): 362a. にも適用されます。たとえ既知のオプション
     の先頭文字に過ぎない場合でも、パーサは引数リストに残さずに、オプシ
     ョンを受け取る場合があります。


File: python.info,  Node: ファイル解析のカスタマイズ,  Next: 終了メソッド,  Prev: 部分解析,  Up: その他のユーティリティ

5.18.1.46 ファイル解析のカスタマイズ
....................................

 -- メソッド: ArgumentParser.convert_arg_line_to_args (arg_line)

     ファイルから引数を読み込む場合 (*note ArgumentParser: 1e7. コンスト
     ラクターの 'fromfile_prefix_chars' キーワード引数を参照)、1行につき
     1つの引数を読み込みます。 *note convert_arg_line_to_args(): 35fa. を
     変更することでこの動作をカスタマイズできます。

     このメソッドは、引数ファイルから読まれた文字列である1つの引数
     'arg_line' を受け取ります。そしてその文字列を解析した結果の引数のリ
     ストを返します。このメソッドはファイルから1行読みこむごとに、順番に
     呼ばれます。

     このメソッドをオーバーライドすると便利なこととして、スペースで区切
     られた行の単語1つ1つを別々の引数として扱えます。次の例でその方法を
     示します:

          class MyArgumentParser(argparse.ArgumentParser):
              def convert_arg_line_to_args(self, arg_line):
                  return arg_line.split()


File: python.info,  Node: 終了メソッド,  Next: 混在した引数の解析,  Prev: ファイル解析のカスタマイズ,  Up: その他のユーティリティ

5.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:
     d09. 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: d09. 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(): ec9. と *note
     parse_known_intermixed_args(): 3630. メソッドは、このような方法での
     解析をサポートしています。

     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(): 362a. と *note
     parse_intermixed_args(): ec9. の違いを表しています: 前者は ‘['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(): 3630. は、解析した内容を含む名
     前空間と、残りの引数を含んだリストの、2つの要素を持つタプルを返しま
     す。 *note parse_intermixed_args(): ec9. は、解析されない引数が残さ
     れた場合にはエラーを送出します。

     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: 例外<12>,  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: 例外<12>

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: 64. (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(): 3f4. を追加しました。ここでは、その機能
     にあわせて引数名を ‘echo’ としました。

   * プログラムを実行すると、オプションを指定するように要求されます。

   * *note parse_args(): 35e1. メソッドは指定されたオプションを、この場
     合は ‘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:
     32a. 文による真偽テストに失敗した理由です。

   * ヘルプメッセージが少し変わりました。

   * ‘--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: 29c. 例外となる）ことを思い出してください。

こうなりました:

     $ 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(): 35e1. に
対してこれ以降は位置引数であることを伝えることができます:

     >>> 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: 1e7. インスタンスの2つ
のメソッドについて学んできました。ここで3つめのメソッドとして *note
add_mutually_exclusive_group(): 56e. を導入しましょう。このメソッドは互
いに対立する引数の指定を可能にします。また、新しい機能として理解しやすい
ように、プログラムの残りの部分を変更しましょう: 以下では ‘--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: 66. モジュールを使って訳せるように作られてい
ます。これにより、 ‘argparse’ によって生成されたメッセージを簡単にローカ
ライズできます。 *note プログラムやモジュールを国際化する: 3640. も参照
してください。

たとえば、この *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: 66. を用い
てインストールされると、 *note argparse: 7. は翻訳されたメッセージを表示
できるようになります。

*note argparse: 7. 出力内のあなたの文字列を翻訳するには、 *note gettext:
66. を使います。

   ---------- 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: 35e2.
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: 例外<12>

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: 35df,
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(): 3647. の呼び出し
     を、*note ArgumentParser.add_argument(): 3f4. の呼び出しに置き換え
     る。

   * ‘(options, args) = parser.parse_args()’ を ‘args =
     parser.parse_args()’ に置き換え、位置引数のために必要に応じて *note
     ArgumentParser.add_argument(): 3f4. の呼び出しを追加する。これまで
     ‘options’ と呼ばれていたものが、*note argparse: 7. では ‘args’ と呼
     ばれていることに留意してください。

   * *note optparse.OptionParser.disable_interspersed_args(): 3648. を、
     *note parse_args(): 35e1. ではなく *note parse_intermixed_args():
     ec9. で置き換える。

   * コールバック・アクションと ‘callback_*’ キーワード引数を ‘type’ や
     ‘action’ 引数に置き換える。

   * ‘type’ キーワード引数に渡していた文字列の名前を、それに応じたオブジ
     ェクト (例: int, float, complex, ...)  に置き換える。

   * *note optparse.Values: 3649. を *note Namespace: 35e2. に置き換え、
     *note optparse.OptionError: 364a. と *note
     optparse.OptionValueError: 364b. を *note ArgumentError: 3633. に置
     き換える。

   * ‘%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::
* 例外: 例外<13>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 64.: 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: 64. 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: 64.
module.  ‘optparse’ uses a more declarative style of command-line
parsing: you create an instance of *note OptionParser: 1885, 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(): 1886. 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: 1885. クラスを 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(): 3647. 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(): 1886. に自作の引数リストを渡してもかま
いません。とはいえ、実際にはそうした必要はほとんどないでしょう:
‘optionparser’ はデフォルトで ‘sys.argv[1:]’ を使うからです。)

*note parse_args(): 1886. は二つの値を返します:

   * 全てのオプションに対する値の入ったオブジェクト ‘options’ -- 例えば
     、‘--file’ が単一の文字列引数をとる場合、‘options.file’ はユーザが
     指定したファイル名になります。オプションを指定しなかった場合には
     ‘None’ になります

   * オプションの解析後に残った位置引数からなるリスト ‘args’

このチュートリアルの節では、最も重要な四つのオプション属性: *note
action: 365b, *note type: 365c, *note dest: 365d. (destination), *note
help: 365e. についてしか触れません。このうち最も重要なのは ‘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: 3661.  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(): 1886, ‘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: 3661.


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: 3668.

‘"append"’

     オプションの引数を指定のリストに追加します

‘"count"’

     指定のカウンタを 1 増やします

‘"callback"’

     指定の関数を呼び出します

これらのアクションについては、 *note リファレンスガイド: 3669. 節および
*note オプション処理コールバック: 366a. 節で触れます。


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: 1885. の
‘set_defaults()’ メソッドを使います。このメソッドは *note parse_args():
1886. を呼び出す前ならいつでも使えます:

     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: 365e. 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(): 1ea. 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: 1885. は、複数のオプションをま
とめたオプショングループを複数持つことができます。

オプションのグループは、 *note OptionGroup: 3670. を使って作成します:

 -- クラス: optparse.OptionGroup (parser, title, description=None)

     ここでは:

        * 'parser' は、このグループが属する *note OptionParser: 1885. の
          インスタンスです

        * 'title' はグループのタイトルです

        * 'description' はオプションで、グループの長い説明です

*note OptionGroup: 3670. は (*note OptionParser: 1885. のように)
‘OptionContainer’ を継承していて、オプションをグループに追加するために
‘add_option()’ メソッドを利用できます。

全てのオプションを定義したら、 *note OptionParser: 1885. の
‘add_option_group()’ メソッドを使ってグループを定義済みのパーサーに追加
します。

前のセクションで定義したパーサーに、続けて *note OptionGroup: 3670. を追
加します:

     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: 3670. を返しま
     す。そのような ‘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(): 3675. と同じく、
     ‘self.version’ の中の全ての ‘%prog’ が現在のプログラム名に置き換え
     られます。 ‘self.version’ が空文字列だだったり未定義だったときは何
     もしません。

 -- メソッド: OptionParser.get_version ()

     *note print_version(): 3674. と同じですが、バージョン文字列を表示す
     る代わりに返します。


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(): 3647, 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: 364a. or *note TypeError: 29c.) 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(): 3647. を使って追加してください
          。

     ‘option_class’ (デフォルト: optparse.Option)

          *note add_option(): 3647. でパーザにオプションを追加するときに
          使用されるクラス。

     ‘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 オプション間の衝突: 367e.
          節を参照して下さい。

     ‘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 チュートリアル: 3659. 節で示したような *note
OptionParser.add_option(): 3647. を使う方法です。 ‘add_option()’ は以下
の二つのうちいずれかの方法で呼び出せます:

   * (‘make_option()’ などが返す) *note Option: 3681. インスタンスを渡し
     ます

   * ‘make_option()’ に (すなわち *note Option: 3681. のコンストラクタに
     ) 位置引数とキーワード引数の組み合わせを渡して、 ‘Option’ インスタ
     ンスを生成させます

もう一つの方法は、あらかじめ作成しておいた *note Option: 3681. インスタ
ンスからなるリストを、以下のようにして *note OptionParser: 1885. のコン
ストラクタに渡すというものです:

     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: 3681. インスタンス、は ‘-f’ や ‘--file’ といった同
義のコマンドラインオプションからなる集合を表現しています。一つの
‘Option’ には任意の数のオプションを短い形式でも長い形式でも指定できます
。ただし、少なくとも一つは指定しなければなりません。

正しい方法で *note Option: 3681. インスタンスを生成するには、 *note
OptionParser: 1885. の ‘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: 365b, 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: 364a. 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: 3668.

     ‘"store_true"’

          store ‘True’

     ‘"store_false"’

          store ‘False’

     ‘"append"’

          オプションの引数を指定のリストに追加します

     ‘"append_const"’

          append a constant value to a list, pre-set via *note
          Option.const: 3668.

     ‘"count"’

          指定のカウンタを 1 増やします

     ‘"callback"’

          指定の関数を呼び出します

     ‘"help"’

          全てのオプションとそのドキュメントの入った使用法メッセージを出
          力します

     (アクションを指定しない場合、デフォルトは ‘"store"’ になります。こ
     のアクションでは、 *note type: 365c. および *note dest: 365d. オプ
     ション属性を指定できます。 *note 標準的なオプション・アクション:
     3684. を参照してください。)

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: 3649.

 -- クラス: optparse.Values

     An object holding parsed argument names and values as attributes.
     Normally created by calling when calling *note
     OptionParser.parse_args(): 1886, and can be overridden by a custom
     subclass passed to the 'values' argument of
     ‘OptionParser.parse_args()’ (as described in *note 引数を解析する:
     3685.).

Option arguments (and various other values) are stored as attributes of
this object, according to the *note dest: 365d. (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: 365c. および *note dest: 365d. オプション属性は *note
action: 365b. と同じくらい重要ですが、 '全ての' オプションで意味をなすの
は ‘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(): 3647. rather than directly, and can be
     overridden by a custom class via the 'option_class' argument to
     *note OptionParser: 1885.

The following option attributes may be passed as keyword arguments to
*note OptionParser.add_option(): 3647.  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: 364a.

 -- の属性: Option.action

     (デフォルト: ‘"store"’)

     Determines ‘optparse’'s behaviour when this option is seen on the
     command line; the available options are documented *note here:
     3684.

 -- の属性: Option.type

     (デフォルト: ‘"string"’)

     このオプションに与えられる引数の型 (たとえば ‘"string"’ や ‘"int"’)
     です。取りうるオプションについては *note こちら: 3688. を参照してく
     ださい。

 -- の属性: 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(): 368a. も参照してくださ
     い。

 -- の属性: Option.nargs

     (デフォルト: 1)

     How many arguments of type *note type: 365c. should be consumed
     when this option is seen.  If > 1, ‘optparse’ will store a tuple of
     values to *note dest: 365d.

 -- の属性: Option.const

     定数を格納する動作のための、その定数です。

 -- の属性: Option.choices

     ‘"choice"’ 型オプションに対してユーザが選べる選択肢となる文字列のリ
     ストです。

 -- の属性: Option.callback

     アクションが ‘"callback"’ であるオプションに対し、このオプションが
     あったときに呼ばれる呼び出し可能オブジェクトです。呼び出し時に渡さ
     れる引数の詳細については、 *note オプション処理コールバック: 366a.
     を参照してください。

 -- の属性: Option.callback_args
 -- の属性: Option.callback_kwargs

     ‘callback’ に渡される標準的な4つのコールバック引数の後ろに追加する
     、位置引数とキーワード引数。

 -- の属性: Option.help

     ユーザが *note help: 365e. オプション(‘--help’ のような)を指定した
     ときに表示される、使用可能な全オプションのリストの中のこのオプショ
     ンに関する説明文です。説明文を提供しておかなければ、オプションは説
     明文なしで表示されます。オプションを隠すには特殊な値
     ‘optparse.SUPPRESS_HELP’ を使います。

 -- の属性: Option.metavar

     (デフォルト: オプション文字列を使う)

     説明文を表示する際にオプションの引数の身代わりになるものです。例は
     *note チュートリアル: 3659. 節を参照してください。


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: 365c, *note dest: 365d, *note nargs:
     368b, *note choices: 368c.]

     オプションの後には必ず引数が続きます。引数は *note type: 365c. に従
     って値に変換されて *note dest: 365d. に保存されます。 *note nargs:
     368b. > 1 の場合、複数の引数をコマンドラインから取り出します。引数
     は全て ‘type’ に従って変換され、 ‘dest’ にタプルとして保存されます
     。 *note 標準のオプション型: 3688. 節を参照してください。

     *note choices: 368c. を(文字列のリストかタプルで) 指定した場合、型
     のデフォルト値は ‘"choice"’ になります。

     *note type: 365c. を指定しない場合、デフォルトの値は ‘"string"’ で
     す。

     If *note dest: 365d. 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: 3668.; 関連: *note dest: 365d.]

     値 *note const: 3668. を *note dest: 365d. に保存します。

     以下はプログラム例です:

          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: 365d.]

     A special case of ‘"store_const"’ that stores ‘True’ to *note dest:
     365d.

   * ‘"store_false"’ [関連: *note dest: 365d.]

     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: 365c, *note dest: 365d, *note nargs:
     368b, *note choices: 368c.]

     The option must be followed by an argument, which is appended to
     the list in *note dest: 365d.  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:
     368b. > 1, multiple arguments are consumed, and a tuple of length
     ‘nargs’ is appended to ‘dest’.

     *note type: 365c. および *note dest: 365d. のデフォルト値は
     ‘"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: 3668.; 関連: *note dest:
     365d.]

     ‘"store_const"’ と同様ですが、 *note const: 3668. の値は *note
     dest: 365d. に追加(append)されます。 ‘"append"’ の場合と同じように
     ‘dest’ のデフォルトは ‘None’ ですがこのオプションを最初にみつけた時
     点で空のリストを自動的に生成します。

   * ‘"count"’ [関連: *note dest: 365d.]

     *note dest: 365d. に保存されている整数値をインクリメントします。
     ‘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: 368d.; 関連: *note type: 365c,
     *note nargs: 368b, *note callback_args: 368e, *note
     callback_kwargs: 368f.]

     *note callback: 368d. に指定された関数を次のように呼び出します

          func(option, opt_str, value, parser, *args, **kwargs)

     詳細は、 *note オプション処理コールバック: 366a. 節を参照してくださ
     い。

   * ‘"help"’

     現在のオプションパーザ内の全てのオプションに対する完全なヘルプメッ
     セージを出力します。ヘルプメッセージは *note OptionParser: 1885. の
     コンストラクタに渡した ‘usage’ 文字列と、各オプションに渡した *note
     help: 365e. 文字列から生成します。

     オプションに *note help: 365e. 文字列が指定されていなくても、オプシ
     ョンはヘルプメッセージ中に列挙されます。オプションを完全に表示させ
     ないようにするには、特殊な値 ‘optparse.SUPPRESS_HELP’ を使ってくだ
     さい。

     ‘optparse’ automatically adds a *note help: 365e. 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: 365e. 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: 3661.

文字列オプションの引数はチェックや変換を一切受けません: コマンドライン上
のテキストは保存先にそのまま保存されます (またはコールバックに渡されます
)。

整数引数 (‘"int"’ 型) は次のように解析されます:

   * 数が ‘0x’ から始まるならば、16進数として読み取られます

   * 数が ‘0’ から始まるならば、8進数として読み取られます

   * 数が ‘0b’ から始まるならば、2進数として読み取られます

   * それ以外の場合、数は10進数として読み取られます

The conversion is done by calling *note int(): 32e. 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(): 32f.
や *note complex(): 330. で変換されます。エラーは同様の扱いです。

‘"choice"’ オプションは ‘"string"’ オプションのサブタイプです。 *note
choices: 368c. オプションの属性 (文字列からなるシーケンス) には、利用で
きるオプション引数のセットを指定します。 ‘optparse.check_choice()’ はユ
ーザの指定したオプション引数とマスタリストを比較して、無効な文字列が指定
された場合には *note OptionValueError: 364b. を送出します。


File: python.info,  Node: 引数を解析する,  Next: オプション解析器への問い合わせと操作,  Prev: 標準のオプション型,  Up: リファレンスガイド

5.18.2.25 引数を解析する
........................

OptionParser を作成してオプションを追加していく上で大事なポイントは、
*note parse_args(): 1886. メソッドの呼び出しです。

 -- メソッド: 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: 3649. のオブジェクト (デ
          フォルト: 新しい ‘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(): 27d6. の呼び出し (大
雑把に言うと保存される各オプション引数につき一回ずつ) で更新されていき、
*note parse_args(): 1886. で返されます。

*note parse_args(): 1886. が引数リストでエラーに遭遇した場合、
OptionParser の ‘error()’ メソッドを適切なエンドユーザ向けのエラーメッセ
ージとともに呼び出します。この呼び出しにより、最終的に終了ステータス 2
(伝統的な Unix におけるコマンドラインエラーの終了ステータス) でプロセス
を終了させることになります。


File: python.info,  Node: オプション解析器への問い合わせと操作,  Next: オプション間の衝突,  Prev: 引数を解析する,  Up: リファレンスガイド

5.18.2.26 オプション解析器への問い合わせと操作
..............................................

オプションパーザのデフォルトの振る舞いは、ある程度カスタマイズすることが
できます。また、オプションパーザの中を調べることもできます。*note
OptionParser: 1885. は幾つかのヘルパーメソッドを提供しています:

 -- メソッド: 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():
     3648. メソッドを呼び出してください。古典的な Unix システムのように
     、最初のオプションでない引数を見つけたときにオプションの解析を止め
     るようになります。

     別のコマンドを実行するコマンドをプロセッサを作成する際、別のコマン
     ドのオプションと自身のオプションが混ざるのを防ぐために利用すること
     ができます。例えば、各コマンドがそれぞれ異なるオプションのセットを
     持つ場合などに有効です。

 -- メソッド: OptionParser.enable_interspersed_args ()

     オプションで無い最初の引数を見つけてもパースを止めないように設定し
     ます。オプションとコマンド引数の順序が混ざっても良いようになります
     。これはデフォルトの動作です。

 -- メソッド: OptionParser.get_option (opt_str)

     オプション文字列 'opt_str' に対する *note Option: 3681. インスタン
     スを返します。該当するオプションがなければ ‘None’ を返します。

 -- メソッド: OptionParser.has_option (opt_str)

     *note OptionParser: 1885. に(‘-q’ や ‘--verbose’ のような) オプショ
     ン 'opt_str' がある場合、‘True’ を返します。

 -- メソッド: OptionParser.remove_option (opt_str)

     *note OptionParser: 1885. に 'opt_str' に対応するオプションがある場
     合、そのオプションを削除します。該当するオプションに他のオプション
     文字列が指定されていた場合、それらのオプション文字列は全て無効にな
     ります。 'opt_str' がこの ‘OptionParser’ オブジェクトのどのオプショ
     ンにも属さない場合、 *note ValueError: 15a. を送出します。


File: python.info,  Node: オプション間の衝突,  Next: クリーンアップ,  Prev: オプション解析器への問い合わせと操作,  Up: リファレンスガイド

5.18.2.27 オプション間の衝突
............................

注意が足りないと、衝突するオプションを定義してしまうことがあります:

     parser.add_option("-n", "--dry-run", ...)
     ...
     parser.add_option("-n", "--noisy", ...)

(とりわけ、*note OptionParser: 1885. から標準的なオプションを備えた自前
のサブクラスを定義してしまった場合にはよく起きます。)

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: 369b. を送出します

     ‘"resolve"’

          オプション間の衝突をインテリジェントに解決します (下記参照)

一例として、衝突をインテリジェントに解決する *note OptionParser: 1885. を
定義し、衝突を起こすようなオプションを追加してみましょう:

     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(): 3675. と同じですが、使用法メッセージを表示する
     代わりに文字列として返します。

 -- メソッド: OptionParser.set_defaults (dest=value, ...)

     幾つかの保存先に対してデフォルト値をまとめてセットします。 *note
     set_defaults(): 368a. を使うのは複数のオプションにデフォルト値をセ
     ットする好ましいやり方です。複数のオプションが同じ保存先を共有する
     ことがあり得るからです。たとえば幾つかの "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(): 368a. を使います:

          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(): 3647. メソッドを使います。 *note action:
365b. の他に指定しなければならない属性は ‘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: 368e. and *note callback_kwargs: 368f.  Thus, the minimal
callback function signature is:

     def my_callback(option, opt, value, parser):

コールバックの四つの引数については後で説明します。

callback オプションを定義する場合には、他にもいくつかオプション属性を指
定できます:

*note type: 365c.

     has its usual meaning: as with the ‘"store"’ or ‘"append"’ actions,
     it instructs ‘optparse’ to consume one argument and convert it to
     *note type: 365c.  Rather than storing the converted value(s)
     anywhere, though, ‘optparse’ passes it to your callback function.

*note nargs: 368b.

     also has its usual meaning: if it is supplied and > 1, ‘optparse’
     will consume *note nargs: 368b. arguments, each of which must be
     convertible to *note type: 365c.  It then passes a tuple of
     converted values to your callback.

*note callback_args: 368e.

     その他の位置引数からなるタプルで、コールバックに渡されます

*note callback_kwargs: 368f.

     その他のキーワード引数からなる辞書で、コールバックに渡されます


File: python.info,  Node: コールバック関数はどのように呼び出されるか,  Next: コールバック中で例外を送出する,  Prev: callbackオプションの定義,  Up: オプション処理コールバック

5.18.2.32 コールバック関数はどのように呼び出されるか
....................................................

コールバックは全て以下の形式で呼び出されます:

     func(option, opt_str, value, parser, *args, **kwargs)

ここでは:

‘option’

     コールバックを呼び出している *note Option: 3681. のインスタンスです

‘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: 365c. 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: 368b. > 1, ‘value’
     will be a tuple of values of the appropriate type.

‘parser’

     現在のオプション解析の全てを駆動している *note OptionParser: 1885.
     インスタンスです。この変数が有用なのは、この値を介してインスタンス
     属性としていくつかの興味深いデータにアクセスできるからです:

     ‘parser.largs’

          現在放置されている引数、すなわち、すでに消費されたものの、オプ
          ションでもオプション引数でもない引数からなるリストです。
          ‘parser.largs’ は自由に変更でき、たとえば引数を追加したりでき
          ます (このリストは ‘args’ 、すなわち *note parse_args(): 1886.
          の二つ目の戻り値になります)

     ‘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: 368e. オプション属性で与えられた任意の位置引数
     からなるタプルです。

‘kwargs’

     *note callback_kwargs: 368f. オプション属性で与えられた任意のキーワ
     ード引数からなるタプルです。


File: python.info,  Node: コールバック中で例外を送出する,  Next: コールバックの例 1 ありふれたコールバック,  Prev: コールバック関数はどのように呼び出されるか,  Up: オプション処理コールバック

5.18.2.33 コールバック中で例外を送出する
........................................

The callback function should raise *note OptionValueError: 364b. 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: 365c.
を定義していれば、そのオプションは引数を受け取ったときに該当する型に変換
できなければなりません。さらに *note nargs: 368b. を指定すれば、オプショ
ンは ‘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: 例外<13>,  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: 3681. class.  This class has a couple of attributes that
define ‘optparse’'s types: *note TYPES: 36b8. and *note TYPE_CHECKER:
36b9.

 -- の属性: Option.TYPES

     *note TYPES: 36b8. は型名のタプルです。新しく作るサブクラスでは、タ
     プル ‘TYPES’ を単純に標準のものを利用して新しく定義すると良いでしょ
     う。

 -- の属性: Option.TYPE_CHECKER

     ‘TYPE_CHECKER’ は辞書で型名を型チェック関数に対応付けるものです。型
     チェック関数は以下のようなシグネチャを持ちます:

          def check_mytype(option, opt, value)

     ここで ‘option’ は *note Option: 3681. のインスタンスであり、 ‘opt’
     はオプション文字列(たとえば ‘-f’)で、 ‘value’ は望みの型としてチェ
     ックされ変換されるべくコマンドラインで与えられる文字列です。
     ‘check_mytype()’ は想定されている型 ‘mytype’ のオブジェクトを返さな
     ければなりません。型チェック関数から返される値は *note
     OptionParser.parse_args(): 1886. で返されるOptionValues インスタン
     スに収められるか、またはコールバックに ‘value’ パラメータとして渡さ
     れます。

     型チェック関数は何か問題に遭遇したら *note OptionValueError: 364b.
     を送出しなければなりません。 ‘OptionValueError’ は文字列一つを引数
     に取り、それはそのまま *note OptionParser: 1885. の ‘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: 36b9. クラス属性の中で) 参
照されることになります:

     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:
36b9, 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: 365d. attribute to be supplied to the Option constructor.

"typed" アクション

     コマンドラインから引数を受け取り、それがある型であることが期待され
     ているアクションです。もう少しはっきり言えば、その型に変換される文
     字列を受け取るものです。この種類のオプションは Option のコンストラ
     クタに *note type: 365c. 属性を与えることが要求されます。

この分類には重複する部分があります。デフォルトの "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: 36bf.

実際に新しいアクションを実装するには、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: 36bd. と *note
     TYPED_ACTIONS: 36be. の両方に入ります。

   * to ensure that ‘optparse’ assigns the default type of ‘"string"’ to
     ‘"extend"’ actions, we put the ‘"extend"’ action in *note
     ALWAYS_TYPED_ACTIONS: 36bf. 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(): f93. です
     。次のように呼び出します

          values.ensure_value(attr, value)

     ‘values’ に ‘attr’ 属性が無いか ‘None’ だった場合に、
     ‘ensure_value()’ は最初に ‘value’ をセットし、それから ‘value’ を返
     します。この振る舞いは ‘"extend"’, ‘"append"’, ‘"count"’ のように、
     データを変数に集積し、またその変数がある型 (最初の二つはリスト、最
     後のは整数) であると期待されるアクションを作るのにとても使い易いも
     のです。 ‘ensure_value()’ を使えば、作ったアクションを使うスクリプ
     トはオプションに保存先にデフォルト値をセットすることに煩わされずに
     済みます。デフォルトを ‘None’ にしておけば ‘ensure_value()’ がそれ
     が必要になったときに適当な値を返してくれます。


File: python.info,  Node: 例外<13>,  Prev: Extending optparse,  Up: optparse --- Parser for command line options

5.18.2.43 例外
..............

 -- 例外: optparse.OptionError

     Raised if an *note Option: 3681. instance is created with invalid
     or inconsistent arguments.

 -- 例外: optparse.OptionConflictError

     Raised if conflicting options are added to an *note OptionParser:
     1885.

 -- 例外: 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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

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: 36c6. 警告を発生させます。

          注釈: IDLE から getpass を呼び出した場合、入力はIDLEのウィンド
          ウではなく、IDLE を起動したターミナルから行われます。

          注釈: On Unix systems, when 'echo_char' is set, the terminal
          will be configured to operate in ‘noncanonical mode(2)’.
          Common terminal control characters are supported:

             * ‘Ctrl’+‘A’ - Move cursor to beginning of line

             * ‘Ctrl’+‘E’ - Move cursor to end of line

             * ‘Ctrl’+‘K’ - Kill (delete) from cursor to end of line

             * ‘Ctrl’+‘U’ - Kill (delete) entire line

             * ‘Ctrl’+‘W’ - Erase previous word

             * ‘Ctrl’+‘V’ - Insert next character literally (quote)

             * ‘Backspace’/‘DEL’ - Delete character before cursor

          These shortcuts work by reading the terminal's configured
          control character mappings from termios settings.

     バージョン 3.14 で変更: Added the 'echo_char' parameter for
     keyboard feedback.

     バージョン 3.15 で変更: When using non-empty 'echo_char' on Unix,
     keyboard shortcuts (including cursor movement and line editing) are
     now properly handled using the terminal's control character
     configuration.

 -- 例外: getpass.GetPassWarning

     *note UserWarning: 2927. のサブクラスで、入力がエコーされてしまった
     場合に発生します。

 -- の関数: getpass.getuser ()

     ユーザーの "ログイン名"を返します。

     この関数は環境変数 ‘LOGNAME’ ‘USER’ ‘LNAME’ ‘USERNAME’ の順序でチェ
     ックして、最初の空ではない文字列が設定された値を返します。もし、な
     にも設定されていない場合は *note pwd: ba. モジュールが提供するシス
     テム上のパスワードデータベースから返します。それ以外の場合は、
     *note OSError: 543. が送出されます。

     In general, this function should be preferred over *note
     os.getlogin(): 1a14.

     バージョン 3.13 で変更: 以前は *note OSError: 543. だけでなく、様々
     な例外が送出されていました。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 333. を参照してください。

典型的な使い方は以下の通りです:

     import fileinput
     for line in fileinput.input(encoding="utf-8"):
         process(line)

このスクリプトは ‘sys.argv[1:]’ に列挙されている全てのファイルの行に渡っ
て反復処理を行います。もし列挙されているものがなければ、 ‘sys.stdin’ が
デフォルトとして扱われます。 ファイル名として ‘'-'’ が与えられた場合も、
‘sys.stdin’ に置き換えられ、 'mode' と 'openhook' は無視されます。 別の
ファイル名リストを使いたい時には、そのリストを *note input(): bdd. の最
初の引数に与えます。 ファイル名が 1 つでも受け付けます。

全てのファイルはデフォルトでテキストモードでオープンされます。しかし、
*note input(): bdd. や *note FileInput: b23. をコールする際に 'mode' パ
ラメータを指定すれば、これをオーバーライドすることができます。オープン中
あるいは読み込み中にI/Oエラーが発生した場合には、 *note OSError: 543. が
発生します。

バージョン 3.3 で変更: 以前は *note IOError: 1409. が送出されました; そ
れは現在 *note OSError: 543. のエイリアスです。

‘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(): bdd. or *note
FileInput(): b23.  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(): bde. to support compressed files.

以下の関数がこのモジュールの基本的なインターフェースです:

 -- の関数: fileinput.input (files=None, inplace=False, backup='', *,
          mode='r', openhook=None, encoding=None, errors=None)

     *note FileInput: b23. クラスのインスタンスを作ります。生成されたイ
     ンスタンスは、このモジュールの関数群が利用するグローバルな状態とし
     て利用されます。この関数への引数は ‘FileInput’ クラスのコンストラク
     タへ渡されます。

     *note FileInput: b23. のインスタンスは *note with: 215. 文の中でコ
     ンテキストマネージャーとして使用できます。 次の例では、仮に例外が生
     じたとしても ‘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(): bdd. 関数によって作られたグローバ
ルな状態を利用します。アクティブな状態が無い場合には、 *note
RuntimeError: 317. が発生します。

 -- の関数: 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: b23. クラスはモジュールの関数に対応するメソッド
     *note filename(): 36ca. 、 *note fileno(): 17e6. 、 *note lineno():
     36cb. 、 *note filelineno(): 36cc. 、 *note isfirstline(): 36cd. 、
     *note isstdin(): 36ce. 、 *note nextfile(): 36cf. および *note
     close(): 36d0. を実装しています。*note イテラブル: 149a. であること
     に加えて、次の入力行を返す *note readline(): 22b4. メソッドがありま
     す。シーケンスはシーケンシャルに読み込むことしかできません。つまり
     ランダムアクセスと ‘readline()’ を混在させることはできません。

     'mode' を使用すると、 *note open(): 333. に渡すファイルモードを指定
     することができます。これは ‘'r'’ および ‘'rb'’ のうちのいずれかとな
     ります。

     'openhook' を指定する場合は、ふたつの引数 'filename' と 'mode' をと
     る関数でなければなりません。この関数の返り値は、オープンしたファイ
     ルオブジェクトとなります。'inplace' と 'openhook' を同時に使うこと
     はできません。

     You can specify 'encoding' and 'errors' that is passed to *note
     open(): 333. or 'openhook'.

     *note FileInput: b23. のインスタンスは *note with: 215. 文の中でコ
     ンテキストマネージャーとして使用できます。 次の例では、仮に例外が生
     じたとしても ‘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(): bdd. か *note FileInput: b23.
クラスのコンストラクタに渡された場合には、入力ファイルはバックアップファ
イルに移動され、標準出力が入力ファイルに設定されます(バックアップファイ
ルと同じ名前のファイルが既に存在していた場合には、警告無しに置き替えられ
ます)。これによって入力ファイルをその場で書き替えるフィルタを書くことが
できます。キーワード引数 'backup' (通常は ‘backup='.<拡張子>'’ という形
で利用します)が与えられていた場合、バックアップファイルの拡張子として利
用され、バックアップファイルは削除されずに残ります。デフォルトでは、拡張
子は ‘'.bak'’ になっていて、出力先のファイルが閉じられればバックアップフ
ァイルも消されます。インプレースフィルタ機能は、標準入力を読み込んでいる
間は無効にされます。

このモジュールには、次のふたつのオープン時フックが用意されています:

 -- の関数: fileinput.hook_compressed (filename, mode, *, encoding=None,
          errors=None)

     gzip や bzip2 で圧縮された (拡張子が ‘'.gz'’ や ‘'.bz2'’ の) ファイ
     ルを、 *note gzip: 6a. モジュールや *note bz2: 14. モジュールを使っ
     て透過的にオープンします。ファイルの拡張子が ‘'.gz'’ や ‘'.bz2'’ で
     ない場合は、通常通りファイルをオープンします (つまり、 *note
     open(): 333. をコールする際に伸長を行いません)。

     The 'encoding' and 'errors' values are passed to *note
     io.TextIOWrapper: ba0. 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(): 333. でオープンするフックを返します。指
     定した '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(): bdd. and *note FileInput: b23. now have
     'encoding' and 'errors' parameters.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 234c.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 246c. と *note
WebAssemblyプラットフォーム: 1d86. をサポートしません。

This is an *note optional module: 2366.  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
オプションのモジュールの要件: 2364.

*note Availability: 234c.: 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: 2f. モジュール

     ロケール設定に関わらず ASCII 文字を扱うためのユーティリティ。

*note curses.panel: 30. モジュール

     curses ウィンドウにデプス機能を追加するパネルスタック拡張。

*note curses.textpad: 31. モジュール

     ‘Emacs’ ライクなキーバインディングをサポートする編集可能な curses 用
     テキストウィジェット。

*note Python で Curses プログラミング: 36d4.

     Andrew Kuchling および Eric Raymond によって書かれた、curses を
     Python で使うためのチュートリアルです。

* Menu:

* 関数: 関数<6>.
* Window オブジェクト::
* 定数: 定数<6>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/curses


File: python.info,  Node: 関数<6>,  Next: Window オブジェクト,  Up: curses --- 文字セル表示のターミナル処理

5.18.5.1 関数
.............

The module ‘curses’ defines the following exception:

 -- 例外: curses.error

     curses ライブラリ関数がエラーを返した際に送出される例外です。

     注釈: 関数やメソッドにおけるオプションの引数 'x' および 'y' がある
     場合、デフォルト値は常に現在のカーソルになります。オプションの
     'attr' がある場合、デフォルト値は *note A_NORMAL: 36d7. です。

The module ‘curses’ defines the following functions:

 -- の関数: curses.assume_default_colors (fg, bg, /)

     Allow use of default values for colors on terminals supporting this
     feature.  Use this to support transparency in your application.

        * Assign terminal default foreground/background colors to color
          number ‘-1’.  So ‘init_pair(x, COLOR_RED, -1)’ will initialize
          pair 'x' as red on default background and ‘init_pair(x, -1,
          COLOR_BLUE)’ will initialize pair 'x' as default foreground on
          blue.

        * Change the definition of the color-pair ‘0’ to ‘(fg, bg)’.

     Added in version 3.14.

 -- の関数: curses.baudrate ()

     端末の出力速度をビット/秒で返します。ソフトウェア端末エミュレータの
     場合、これは固定の高い値を持つことになります。この関数は歴史的な理
     由で入れられています; かつては、この関数は時間遅延を生成するための
     出力ループを書くために用いられたり、行速度に応じてインターフェース
     を切り替えたりするために用いられたりしていました。

 -- の関数: curses.beep ()

     注意を促す短い音を鳴らします。

 -- の関数: curses.can_change_color ()

     端末に表示される色をプログラマが変更できるか否かによって、‘True’ ま
     たは ‘False’ を返します。

 -- の関数: curses.cbreak ()

     cbreak モードに入ります。cbreak モード ("rare" モードと呼ばれること
     もあります) では、通常の tty 行バッファリングはオフにされ、文字を一
     文字一文字読むことができます。ただし、raw モードとは異なり、特殊文
     字 (割り込み:interrupt、終了:quit、一時停止:suspend、およびフロー制
     御) については、tty ドライバおよび呼び出し側のプログラムに対する通
     常の効果をもっています。まず *note raw(): 1a3d. を呼び出し、次いで
     *note cbreak(): 1a38. を呼び出すと、端末を cbreak モードにします。

 -- の関数: curses.color_content (color_number)

     色 'color_number' の赤、緑、および青 (RGB) 要素の強度を返します。
     'color_number' は ‘0’ から ‘COLORS - 1’ の間でなければなりません。
     与えられた色の R、G、B、の値からなる三要素のタプルが返されます。こ
     の値は ‘0’ (その成分はない) から ‘1000’ (その成分の最大強度) の範囲
     をとります。

 -- の関数: curses.color_pair (pair_number)

     Return the attribute value for displaying text in the specified
     color pair.  Only the first 256 color pairs are supported.  This
     attribute value can be combined with *note A_STANDOUT: 36db, *note
     A_REVERSE: 36dc, and the other ‘A_*’ attributes.  *note
     pair_number(): 36dd. is the counterpart to this function.

 -- の関数: curses.curs_set (visibility)

     カーソルの状態を設定します。'visibility' は ‘0’ 、 ‘1``または ``2’
     に設定され、それぞれ不可視、通常、または非常に可視、を意味します。
     要求された可視属性を端末がサポートしている場合、以前のカーソル状態
     が返されます; そうでなければ例外が送出されます。多くの端末では、"可
     視 (通常)" モードは下線カーソルで、"非常に可視" モードはブロックカ
     ーソルです。

 -- の関数: curses.def_prog_mode ()

     現在の端末属性を、稼動中のプログラムが curses を使う際のモードであ
     る "プログラム" モードとして保存します。(このモードの反対は、プログ
     ラムが curses を使わない "シェル" モードです。) その後 *note
     reset_prog_mode(): 36e0. を呼ぶとこのモードを復旧します。

 -- の関数: curses.def_shell_mode ()

     現在の端末属性を、稼動中のプログラムが curses を使っていないときの
     モードである "シェル" モードとして保存します。(このモードの反対は、
     プログラムが curses 機能を利用している "プログラム" モードです。) そ
     の後 *note reset_shell_mode(): 36e2. を呼ぶとこのモードを復旧します
     。

 -- の関数: curses.delay_output (ms)

     出力に 'ms' ミリ秒の一時停止を入れます。

 -- の関数: curses.doupdate ()

     物理スクリーンを更新します。curses ライブラリは、現在の物理スクリー
     ンの内容と、次の状態として要求されている仮想スクリーンをそれぞれ表
     す、2 つのデータ構造を保持しています。*note doupdate(): 36e4. は更
     新を適用し、物理スクリーンを仮想スクリーンに一致させます。

     仮想スクリーンは *note addstr(): 1a47. のような書き込み操作をウィン
     ドウに行った後に *note noutrefresh(): 1a42. を呼び出して更新するこ
     とができます。通常の:meth:‘~window.refresh’ 呼び出しは、単に
     ‘noutrefresh()’ を呼んだ後に ‘doupdate`を呼ぶだけです; 複数のウィン
     ドウを更新しなければならない場合、すべてのウィンドウに対して
     :meth:()’!noutrefresh' を呼び出した後、一度だけ ‘doupdate()’ を呼ぶ
     ことで、パフォーマンスを向上させることができ、おそらくスクリーンの
     ちらつきも押さえることができます。

 -- の関数: curses.echo ()

     echo モードに入ります。echo モードでは、各文字入力はスクリーン上に
     入力された通りにエコーバックされます。

 -- の関数: curses.endwin ()

     ライブラリの非初期化を行い、端末を通常の状態に戻します。

 -- の関数: curses.erasechar ()

     ユーザの現在の消去文字 (erase character) を1バイトの bytes オブジェ
     クトで返します。Unix オペレーティングシステムでは、この値は curses
     プログラムが制御している端末の属性であり、curses ライブラリ自体では
     設定されません。

 -- の関数: curses.filter ()

     *note filter(): 36e7. ルーチンを使う場合、*note initscr(): 1a3b. を
     呼ぶ前に呼び出さなくてはなりません。この手順のもたらす効果は以下の
     通りです: まず二つの関数の呼び出しの間は、 ‘LINES’ は ‘1’ に設定さ
     れます; ‘clear’, ‘cup’, ‘cud’, ‘cud1’, ‘cuu1’, ‘cuu’, ‘vpa’ は無効
     化されます; ‘home’ 文字列は ‘cr’ の値に設定されます。これにより、カ
     ーソルは現在の行に制限されるので、スクリーンの更新も同様に制限され
     ます。この関数は、スクリーンの他の部分に影響を及ぼさずに文字単位の
     行編集を行う場合に利用できます。

 -- の関数: curses.flash ()

     スクリーンを点滅します。すなわち、画面を色反転して、短時間でもとに
     もどします。人によっては、*note beep(): 36d8. で生成される注意音よ
     りも、このような "目に見えるベル" を好みます。

 -- の関数: curses.flushinp ()

     すべての入力バッファをフラッシュします。この関数は、ユーザによって
     すでに入力されているが、まだプログラムによって処理されていないすべ
     ての先行入力文字を破棄します。

 -- の関数: curses.getmouse ()

     *note getch(): 1a50. が *note KEY_MOUSE: 36eb. を返してマウスイベン
     トを通知した後、この関数を呼んで待ち行列上に置かれているマウスイベ
     ントを取得しなければなりません。イベントは ‘(id, x, y, z, bstate)’
     の 5 要素のタプルで表現されています。'id' は複数のデバイスを区別す
     るための ID 値で、'x', 'y', 'z' はイベントの座標値です。(現在 'z' は
     使われていません) 'bstate' は整数値で、その各ビットはイベントのタイ
     プを示す値に設定されています。この値は以下に示す定数のうち一つまた
     はそれ以上のビット単位 OR になっています。以下の定数の 'n' は 1 か
     ら 5 のボタン番号を示します: *note BUTTONn_PRESSED: 36ec, *note
     BUTTONn_RELEASED: 36ed, *note BUTTONn_CLICKED: 36ee, *note
     BUTTONn_DOUBLE_CLICKED: 36ef, *note BUTTONn_TRIPLE_CLICKED: 36f0,
     *note BUTTON_SHIFT: 36f1, *note BUTTON_CTRL: 36f2, *note
     BUTTON_ALT: 36f3.。

     バージョン 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(): 36f6. call.  The routine then creates and
     initializes a new window using that data, returning the new window
     object.

 -- の関数: curses.has_colors ()

     端末が色表示を行える場合には ‘True’ を返します。そうでない場合には
     ‘False’ を返します。

 -- の関数: curses.has_extended_color_support ()

     Return ‘True’ if the module supports extended colors; otherwise,
     return ‘False’.  Extended color support allows more than 256 color
     pairs for terminals that support more than 16 colors (e.g.
     xterm-256color).

     Extended color support requires ncurses version 6.1 or later.

     Added in version 3.10.

 -- の関数: curses.has_ic ()

     端末が文字の挿入/削除機能を持つ場合に ‘True’ を返します。最近の端末
     エミュレータはどれもこの機能を持っており、この関数は歴史的な理由の
     ためだけに存在しています。

 -- の関数: curses.has_il ()

     端末が行の挿入/削除機能を持つ場合に ‘True’ を返します。最近の端末エ
     ミュレータはどれもこの機能を持っていて、この関数は歴史的な理由のた
     めだけに存在しています。

 -- の関数: curses.has_key (ch)

     キー値 'ch' をとり、現在の端末タイプがその値のキーを認識できる場合
     に ‘True’ を返します。

 -- の関数: curses.halfdelay (tenths)

     半遅延モード、すなわち cbreak モードに似た、ユーザが打鍵した文字が
     すぐにプログラムで利用できるようになるモードで使われます。しかしな
     がら、何も入力されなかった場合、十分の 'tenths' 秒後に例外が送出さ
     れます。'tenths' の値は ‘1’ から ‘255’ の間でなければなりません。半
     遅延モードから抜けるには *note nocbreak(): 36fc. を使います。

 -- の関数: curses.init_color (color_number, r, g, b)

     色の定義を変更します。変更したい色番号と、その後に 3 つ組みの RGB 値
     (赤、緑、青の成分の大きさ) をとります。'color_number' の値は ‘0’ か
     ら ‘COLORS - 1’ の間でなければなりません。'r', 'g', 'b' の値は ‘0’
     から ‘1000’ の間でなければなりません。*note init_color(): bd1. を使
     うと、スクリーン上でカラーが使用されている部分はすべて新しい設定に
     即時変更されます。この関数はほとんどの端末で何も行いません; *note
     can_change_color(): 36d9. が ‘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(): 491.
     and *note assume_default_colors(): 490.).  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
     ウィンドウ: 1a44. オブジェクトを返します。

          注釈: 端末のオープン時にエラーが発生した場合、curses ライブラ
          リによってインタープリタが終了される場合があります。

 -- の関数: curses.is_term_resized (nlines, ncols)

     *note resize_term(): 1b6a. によってウィンドウ構造が変更されている場
     合に ‘True’ を、そうでない場合は ‘False’ を返します。

 -- の関数: curses.isendwin ()

     *note endwin(): 36e5. がすでに呼び出されている (すなわち、curses ラ
     イブラリが非初期化されてしまっている) 場合に ‘True’ を返します。

 -- の関数: curses.keyname (k)

     bytes オブジェクト 'k' に番号付けされているキーの名前を返します。 印
     字可能な ASCII 文字を生成するキーの名前はそのキーの文字自体になりま
     す。 コントロールキーと組み合わせたキーの名前は、キャレット
     (‘b'^'’)の後に対応する ASCII 文字が続く 2 バイトの bytes オブジェク
     トになります。 Alt キーと組み合わせたキー (128-255) の名前は、先頭
     に ‘b'M-'’ が付き、その後に対応する ASCII 文字が続く bytes オブジェ
     クトになります。

 -- の関数: curses.killchar ()

     Return the user's current line kill character as a one-byte bytes
     object.  Under Unix operating systems this is a property of the
     controlling tty of the curses program, and is not set by the curses
     library itself.

 -- の関数: curses.longname ()

     現在の端末について記述している terminfo の長形式 name フィールドが
     入った bytes オブジェクトを返します。verbose 形式記述の最大長は 128
     文字です。この値は *note initscr(): 1a3b. 呼び出しの後でのみ定義さ
     れています。

 -- の関数: curses.meta (flag)

     'flag' が ‘True’ の場合、8 ビット文字の入力を許可します。'flag' が
     ‘False’ の場合、7 ビット文字だけを許可します。

 -- の関数: curses.mouseinterval (interval)

     ボタンが押されてから離されるまでの時間をマウスクリック一回として認
     識する最大の時間間隔をミリ秒で設定します。返り値は以前の内部設定値
     になります。デフォルトは 200 ミリ秒 (5 分の 1 秒) です。

 -- の関数: curses.mousemask (mousemask)

     報告すべきマウスイベントを設定し、‘(availmask, oldmask)’ の組からな
     るタプルを返します。'availmask' はどの指定されたマウスイベントのど
     れが報告されるかを示します; どのイベント指定も完全に失敗した場合に
     は ‘0’ が返ります。'oldmask' は与えられたウィンドウの以前のマウスイ
     ベントマスクです。この関数が呼ばれない限り、マウスイベントは何も報
     告されません。

 -- の関数: curses.napms (ms)

     'ms' ミリ秒間スリープします。

 -- の関数: curses.newpad (nlines, ncols)

     与えられた行とカラム数を持つパッド (pad) データ構造を生成し、そのポ
     インタを返します。パッドはウィンドウオブジェクトとして返されます。

     パッドはウィンドウと同じようなものですが、スクリーンのサイズによる
     制限をうけず、スクリーンの特定の部分に関連付けられていなくてもかま
     いません。大きなウィンドウが必要であり、スクリーンにはそのウィンド
     ウの一部しか一度に表示しない場合に使えます。(スクロールや入力エコー
     などによる) パッドに対する再描画は起こりません。パッドに対する
     *note refresh(): 1a41. および *note noutrefresh(): 1a42. メソッドは
     、パッド中の表示する部分と表示するために利用するスクリーン上の位置
     を指定する 6 つの引数が必要です。これらの引数は 'pminrow'、
     'pmincol'、'sminrow'、'smincol'、'smaxrow'、'smaxcol' です; 'p' で
     始まる引数はパッド中の表示領域の左上位置で、's' で始まる引数はパッ
     ド領域を表示するスクリーン上のクリップ矩形を指定します。

 -- の関数: curses.newwin (nlines, ncols)

 -- の関数: curses.newwin (nlines, ncols, begin_y, begin_x)

     左上の角が ‘(begin_y, begin_x)’ で、高さ/幅が 'nlines' / 'ncols' の
     新規 *note ウィンドウ: 1a44. を返します。

     デフォルトでは、ウィンドウは指定された位置からスクリーンの右下まで
     広がります。

 -- の関数: curses.nl ()

     newlime モードに入ります。このモードはリターンキーを入力中の改行と
     して変換し、出力時に改行文字を復帰 (return) と改行 (line-feed) に変
     換します。newline モードは初期化時にはオンになっています。

 -- の関数: curses.nocbreak ()

     cbreak モードを終了します。行バッファリングを行う通常の "cooked" モ
     ードに戻ります。

 -- の関数: curses.noecho ()

     echo モードを終了します。入力のエコーバックはオフにされます。

 -- の関数: curses.nonl ()

     newline モードを終了します。入力時のリターンキーから改行への変換、
     および出力時の改行から復帰/改行への低レベル変換を無効化します (ただ
     し、‘addch('\n')’ の振る舞いは変更せず、仮想スクリーン上では常に復
     帰と改行に等しくなります)。変換をオフにすることで、curses は水平方
     向の動きを少しだけ高速化できることがあります; また、入力中のリター
     ンキーの検出ができるようになります。

 -- の関数: curses.noqiflush ()

     ‘noqiflush()’ ルーチンを使うと、通常行われている ‘INTR’ 、 ‘QUIT’ お
     よび ‘SUSP’ 文字による入力および出力キューのフラッシュが行われなく
     なります。シグナルハンドラが終了した際、割り込みが発生しなかったか
     のように出力を続たい場合、ハンドラ中で ‘noqiflush()’ を呼び出すこと
     ができます。

 -- の関数: curses.noraw ()

     raw モードから離れます。行バッファリングを行う通常の "cooked" モー
     ドに戻ります。

 -- の関数: curses.pair_content (pair_number)

     要求された色ペアの色を含むタプル ‘(fg, bg)’ を返します。
     'pair_number' は ‘0’ から ‘COLOR_PAIRS - 1’ の間でなければなりませ
     ん。

 -- の関数: curses.pair_number (attr)

     'attr' に対する色ペアセットの番号を返します。*note color_pair():
     36da. はこの関数の逆に相当します。

 -- の関数: curses.putp (str)

     ‘tputs(str, 1, putchar)’ と等価です; 現在の端末における、指定された
     terminfo 機能の値を出力します。*note putp(): 370a. の出力は常に標準
     出力に送られるので注意して下さい。

 -- の関数: curses.qiflush ([flag])

     'flag' が ‘False’ なら、*note noqiflush(): 3708. を呼ぶのとと同じ効
     果です。'flag' が ‘True’ か、引数が与えられていない場合、制御文字が
     読み出された最にキューはフラッシュされます。

 -- の関数: curses.raw ()

     raw モードに入ります。raw モードでは、通常の行バッファリングと割り
     込み (interrupt)、終了 (quit)、一時停止 (suspend)、およびフロー制御
     キーはオフになります; 文字は curses 入力関数に一文字づつ渡されます
     。

 -- の関数: curses.reset_prog_mode ()

     端末を "program" モードに復旧し、あらかじめ *note def_prog_mode():
     36df. で保存した内容に戻します。

 -- の関数: curses.reset_shell_mode ()

     端末を "shell" モードに復旧し、あらかじめ *note def_shell_mode():
     36e1. で保存した内容に戻します。

 -- の関数: curses.resetty ()

     端末モードの状態を最後に *note savetty(): 370d. を呼び出した時の状
     態に戻します。

 -- の関数: curses.resize_term (nlines, ncols)

     *note resizeterm(): 1b69. で使用されるバックエンド関数で、ウィンド
     ウサイズを変更する時、*note resize_term(): 1b6a. は拡張された領域を
     埋めます。呼び出したアプリケーションはそれらの領域を適切なデータで
     埋めなくてはなりません。‘resize_term()’ 関数はすべてのウィンドウの
     サイズ変更を試みます。ただし、パッド呼び出しの慣例により、アプリケ
     ーションとの追加のやり取りを行わないサイズ変更は行えません。

 -- の関数: curses.resizeterm (nlines, ncols)

     現在の標準ウィンドウのサイズを指定された寸法に変更し、curses ライブ
     ラリが使用する、その他のウィンドウサイズを記憶しているデータ (特に
     SIGWINCH ハンドラ) を調整します。

 -- の関数: curses.savetty ()

     *note resetty(): 370c. で使用される、バッファ内の端末モードの現在の
     状態を保存します。

 -- の関数: curses.get_escdelay ()

     Retrieves the value set by *note set_escdelay(): cc5.

     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(): cc7.

     Added in version 3.9.

 -- の関数: curses.set_tabsize (size)

     Sets the number of columns used by the curses library when
     converting a tab character to spaces as it adds the tab to a
     window.

     Added in version 3.9.

 -- の関数: curses.setsyx (y, x)

     仮想スクリーンのカーソルを 'y', 'x' に設定します。'y' および 'x' が
     どちらも ‘-1’ の場合、 ‘leaveok()’ が に''True''に設定されます。

 -- の関数: curses.setupterm (term=None, fd=-1)

     端末を初期化します。'term' は端末名となる文字列または ‘None’ です。
     省略または ‘None’ の場合、環境変数 ‘TERM’ の値が使用されます。'fd'
     は送信される初期化シーケンスへのファイル記述子です。指定されないま
     たは ‘-1’ の場合、‘sys.stdout’ のファイル記述子が使用されます。

 -- の関数: curses.start_color ()

     プログラマがカラーを利用したい場合で、かつ他の何らかのカラー操作ル
     ーチンを呼び出す前に呼び出さなくてはなりません。この関数は *note
     initscr(): 1a3b. を呼んだ直後に呼ぶようにしておくとよいでしょう。

     ‘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: 3711. and *note COLOR_PAIRS:
     3712, containing the maximum number of colors and color-pairs the
     terminal can support.  It also restores the colors on the terminal
     to the values they had when the terminal was just turned on.

 -- の関数: curses.termattrs ()

     端末がサポートするすべてのビデオ属性を論理和した値を返します。この
     情報は、curses プログラムがスクリーンの見え方を完全に制御する必要が
     ある場合に便利です。

 -- の関数: curses.termname ()

     14 文字以下になるように切り詰められた環境変数 ‘TERM’ の値を bytes オ
     ブジェクトで返します。

 -- の関数: curses.tigetflag (capname)

     terminfo 機能名 'capname' に対応する真偽値の機能値を整数で返します
     。'capname' が真偽値で表せる機能値でない場合 ‘-1’ を返し、機能がキ
     ャンセルされているか、端末記述上に見つからない場合 ‘0’ を返します。

 -- の関数: curses.tigetnum (capname)

     terminfo 機能名 'capname' に対応する数値の機能値を整数で返します。
     'capname' が数値で表せる機能値でない場合 ‘-2’ を返し、機能がキャン
     セルされているか、端末記述上に見つからない場合 ‘-1’ を返します。

 -- の関数: curses.tigetstr (capname)

     Return the value of the string capability corresponding to the
     terminfo capability name 'capname' as a bytes object.  Return
     ‘None’ if 'capname' is not a terminfo "string capability", or is
     canceled or absent from the terminal description.

 -- の関数: curses.tparm (str[, ...])

     'str' を与えられたパラメタを使って bytes オブジェクトにインスタンス
     化します。'str' は terminfo データベースから得られたパラメタを持つ
     文字列でなければなりません。例えば、‘tparm(tigetstr("cup"), 5, 3)’
     は ‘b'\033[6;4H'’ のようになります。厳密には端末の形式によって異な
     る結果となります。

 -- の関数: curses.typeahead (fd)

     先読みチェックに使うためのファイル記述子 'fd' を指定します。'fd' が
     ‘-1’ の場合、先読みチェックは行われません。

     curses ライブラリはスクリーンを更新する間、先読み文字列を定期的に検
     索することで "行はみ出し最適化 (line-breakout optimization)" を行い
     ます。入力が得られ、かつ入力は端末からのものである場合、現在行おう
     としている更新は refresh や doupdate を再度呼び出すまで先送りにしま
     す。この関数は異なるファイル記述子で先読みチェックを行うように指定
     することができます。

 -- の関数: curses.unctrl (ch)

     Return a bytes object which is a printable representation of the
     character 'ch'.  Control characters are represented as a caret
     followed by the character, for example as ‘b'^C'’.  Printing
     characters are left as they are.

 -- の関数: curses.ungetch (ch)

     'ch' をプッシュし、次に *note getch(): 1a50. を呼び出した時にその値
     が返るようにします。

          注釈: ‘getch()’ を呼び出すまでは 'ch' は一つしかプッシュできま
          せん。

 -- の関数: curses.update_lines_cols ()

     Update the *note LINES: 11a8. and *note COLS: 11a9. module
     variables.  Useful for detecting manual screen resize.

     Added in version 3.5.

 -- の関数: curses.unget_wch (ch)

     'ch' をプッシュし、次に *note get_wch(): 1453. を呼び出した時にその
     値が返るようにします。

          注釈: ‘get_wch()’ を呼び出すまでは 'ch' は一つしかプッシュでき
          ません。

     Added in version 3.3.

 -- の関数: curses.ungetmouse (id, x, y, z, bstate)

     与えられた状態データが関連付けられた *note KEY_MOUSE: 36eb. イベン
     トを入力キューにプッシュします。

 -- の関数: curses.use_env (flag)

     この関数を使う場合、*note initscr(): 1a3b. または newterm を呼ぶ前
     に呼び出さなくてはなりません。'flag' が ‘False’ の場合、環境変数
     ‘LINES’ および ‘COLUMNS’ の値 (デフォルトで使用されます) の値が設定
     されていたり、curses がウィンドウ内で動作して (この場合 ‘LINES’ や
     ‘COLUMNS’ が設定されていないとウィンドウのサイズを使います) いても
     、terminfo データベースに指定された lines および columns の値を使い
     ます。

 -- の関数: curses.use_default_colors ()

     Equivalent to ‘assume_default_colors(-1, -1)’.

 -- の関数: curses.wrapper (func, /, *args, **kwargs)

     curses を初期化し、呼び出し可能なオブジェクト 'func' (その他の
     curses を使用するアプリケーション) を呼び出します。アプリケーション
     が例外を送出した場合、この関数は端末を例外を再送出する前に正常な状
     態に戻し、トレースバックを作成します。その後、呼び出し可能オブジェ
     クト 'func' には、第一引数としてメインウィンドウ 'stdscr' が、続い
     て ‘wrapper()’ に渡されたその他の引数が渡されます。'func' を呼び出
     す前、‘wrapper()’ は cbreak モードをオンに、エコーをオフに、端末キ
     ーパッドを有効にし、端末が色表示をサポートしている場合は色を初期化
     します。終了時 (通常終了、例外による終了のどちらでも)、cooked モー
     ドに戻し、エコーをオンにし、端末キーパッドを無効にします。


File: python.info,  Node: Window オブジェクト,  Next: 定数<6>,  Prev: 関数<6>,  Up: curses --- 文字セル表示のターミナル処理

5.18.5.2 Window オブジェクト
............................

 -- クラス: curses.window

     上記の *note initscr(): 1a3b. や *note newwin(): 3705. が返すウィン
     ドウは、以下のメソッドと属性を持ちます:

 -- メソッド: 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: 1a36.  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: 1a36.  Attempting to write to the
               lower right corner of a window, subwindow, or pad will
               cause an exception to be raised after the string is
               printed.

             * A bug in ncurses(1), the backend for this Python module,
               can cause SegFaults when resizing windows.  This is fixed
               in ncurses-6.1-20190511.  If you are stuck with an
               earlier ncurses, you can avoid triggering this if you do
               not call *note addstr(): 1a47. 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: 3721.
                                               
                                               
     'rs'            右側                      *note ACS_VLINE: 3721.
                                               
                                               
     'ts'            上側                      *note ACS_HLINE: 3722.
                                               
                                               
     'bs'            下側                      *note ACS_HLINE: 3722.
                                               
                                               
     'tl'            左上の角                  *note ACS_ULCORNER: 3723.
                                               
                                               
     'tr'            右上の角                  *note ACS_URCORNER: 3724.
                                               
                                               
     'bl'            左下の角                  *note ACS_LLCORNER: 3725.
                                               
                                               
     'br'            右下の角                  *note ACS_LRCORNER: 3726.
                                               

 -- メソッド: window.box ([vertch, horch])

     *note border(): 1a48. と同様ですが、'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(): 3727. method so that the contents will be
     redisplayed by the next window refresh.

 -- メソッド: window.clear ()

     *note erase(): 3729. に似ていますが、次に *note refresh(): 1a41. が
     呼び出された際にすべてのウィンドウを再描画するようにします。

 -- メソッド: window.clearok (flag)

     'flag' が ‘True’ ならば、次の *note refresh(): 1a41. はウィンドウを
     完全に消去します。

 -- メソッド: window.clrtobot ()

     カーソルの位置からウィンドウの端までを消去します: カーソル以降のす
     べての行が削除されるため、*note clrtoeol(): 372c. と等価です。

 -- メソッド: window.clrtoeol ()

     カーソル位置から行末までを消去します。

 -- メソッド: window.cursyncup ()

     ウィンドウのすべての親ウィンドウについて、現在のカーソル位置を反映
     するよう更新します。

 -- メソッド: window.delch ([y, x])

     ‘(y, x)’ にある文字を削除します。

 -- メソッド: window.deleteln ()

     カーソルの下にある行を削除します。後続の行はすべて 1 行上に移動しま
     す。

 -- メソッド: window.derwin (begin_y, begin_x)

 -- メソッド: window.derwin (nlines, ncols, begin_y, begin_x)

     "derive window (ウィンドウを派生する)" の短縮形です。*note
     derwin(): 3730. は *note subwin(): 3731. と同じですが、'begin_y' お
     よび 'begin_x' はスクリーン全体の原点ではなく、ウィンドウの原点から
     の相対位置です。派生したウィンドウオブジェクトが返されます。

 -- メソッド: window.echochar (ch[, attr])

     文字 'ch' に属性 'attr' を付与し、即座に *note refresh(): 1a41. を
     ウィンドウに対して呼び出します。

 -- メソッド: 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(): 3731. などでサブウィ
     ンドウを生成した時、エンコーディング属性は親ウィンドウから継承しま
     す。デフォルトでは、現在のロケールのエンコーディングが使用されます
     (*note locale.getencoding(): a4a. 参照)。

     Added in version 3.3.

 -- メソッド: window.erase ()

     ウィンドウをクリアします。

 -- メソッド: window.getbegyx ()

     Return a tuple ‘(y, x)’ of coordinates of upper-left corner.

 -- メソッド: window.getbkgd ()

     与えられたウィンドウの現在の背景文字と属性のペアを返します。

 -- メソッド: window.getch ([y, x])

     文字を 1 個取得します。返される整数は ASCII の範囲の値となる 'とは
     限らない' ので注意してください。ファンクションキー、キーパッドのキ
     ー等は 256 よりも大きな数字で表されます。無遅延 (no-delay) モードで
     は、入力がない場合 -1 を返し、そうでなければキーが押されるまで待ち
     ます。

 -- メソッド: window.get_wch ([y, x])

     ワイド文字を 1 個取得します。ほとんどのキー、ファンクションキーの数
     値、キーパッドのキー、およびその他の特殊キーの文字を返します。無遅
     延モードでは、入力がない場合例外を送出します。

     Added in version 3.3.

 -- メソッド: window.getkey ([y, x])

     文字を 1 個取得し、 *note getch(): 1a50. が返すような整数ではなく文
     字列を返します。ファンクションキー、キーパッドのキー、およびその他
     特殊キーはキー名を含む複数文字を返します。無遅延モードでは、入力が
     ない場合例外を送出します。

 -- メソッド: window.getmaxyx ()

     ウィンドウの高さおよび幅を表すタプル ‘(y, x)’ を返します。

 -- メソッド: window.getparyx ()

     親ウィンドウ中におけるウィンドウの開始位置をタプル ‘(y, x)’ で返し
     ます。ウィンドウに親ウィンドウがない場合 ‘(-1, -1)’ を返します。

 -- メソッド: window.getstr ()

 -- メソッド: window.getstr (n)

 -- メソッド: window.getstr (y, x)

 -- メソッド: window.getstr (y, x, n)

     Read a bytes object from the user, with primitive line editing
     capacity.  The maximum value for 'n' is 2047.

     バージョン 3.14 で変更: The maximum value for 'n' was increased
     from 1023 to 2047.

 -- メソッド: window.getyx ()

     ウィンドウの左上角からの相対で表した現在のカーソル位置をタプル ‘(y,
     x)’ で返します。

 -- メソッド: window.hline (ch, n)

 -- メソッド: window.hline (y, x, ch, n)

     ‘(y, x)’ から始まり、'n' の長さを持つ、文字 'ch' で作られる水平線を
     表示します。

 -- メソッド: window.idcok (flag)

     'flag' が ‘False’ の場合、curses は端末のハードウェアによる文字挿入
     /削除機能を使おうとしなくなります; 'flag' が ‘True’ ならば、文字挿
     入/削除は有効にされます。curses が最初に初期化された際には文字挿入
     /削除はデフォルトで有効になっています。

 -- メソッド: window.idlok (flag)

     If 'flag' is ‘True’, ‘curses’ will try and use hardware line
     editing facilities.  Otherwise, line insertion/deletion are
     disabled.

 -- メソッド: window.immedok (flag)

     'flag' が ‘True’ ならば、ウィンドウイメージ内における何らかの変更が
     あるとウィンドウを更新するようになります; すなわち、*note
     refresh(): 1a41. を自分で呼ばなくても良くなります。とはいえ、
     wrefresh を繰り返し呼び出すことになるため、この操作はかなりパフォー
     マンスを低下させます。デフォルトでは無効になっています。

 -- メソッド: window.inch ([y, x])

     ウィンドウの指定の位置の文字を返します。下位 8 ビットが本来の文字で
     、それより上のビットは属性です。

 -- メソッド: window.insch (ch[, attr])

 -- メソッド: window.insch (y, x, ch[, attr])

     ‘(y, x)’ に文字 'ch' を属性 'attr' で描画し、行の 'x' からの内容を
     1 文字分右にずらします。

 -- メソッド: window.insdelln (nlines)

     'nlines' 行を指定されたウィンドウの現在の行の上に挿入します。その下
     にある 'nlines' 行は失われます。負の 'nlines' を指定すると、カーソ
     ルのある行以降の 'nlines' を削除し、削除された行の後ろに続く内容が
     上に来ます。その下にある 'nlines' は消去されます。現在のカーソル位
     置はそのままです。

 -- メソッド: window.insertln ()

     カーソルの下に空行を 1 行入れます。それ以降の行は 1 行づつ下に移動
     します。

 -- メソッド: window.insnstr (str, n[, attr])

 -- メソッド: window.insnstr (y, x, str, n[, attr])

     文字列をカーソルの下にある文字の前に (一行に収まるだけ) 最大 'n' 文
     字挿入します。'n' がゼロまたは負の値の場合、文字列全体が挿入されま
     す。カーソルの右にあるすべての文字は右に移動し、行の左端にある文字
     は失われます。カーソル位置は ('y', 'x' が指定されていた場合はそこに
     移動しますが、その後は) 変化しません。

 -- メソッド: window.insstr (str[, attr])

 -- メソッド: window.insstr (y, x, str[, attr])

     キャラクタ文字列を (行に収まるだけ) カーソルより前に挿入します。カ
     ーソルの右側にある文字はすべて右にシフトし、行の右端の文字は失われ
     ます。カーソル位置は ('y', 'x' が指定されていた場合はそこに移動しま
     すが、その後は) 変化しません。

 -- メソッド: window.instr ([n])

 -- メソッド: window.instr (y, x[, n])

     Return a bytes object of characters, extracted from the window
     starting at the current cursor position, or at 'y', 'x' if
     specified.  Attributes are stripped from the characters.  If 'n' is
     specified, ‘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(): 1a41. を呼んだ時から変更され
     ている場合に ‘True’ を返します; そうでない場合には ‘False’ を返しま
     す。'line' が現在のウィンドウ上の有効な行でない場合、*note
     curses.error: 1a36. 例外を送出します。

 -- メソッド: window.is_wintouched ()

     指定したウィンドウが、最後に *note refresh(): 1a41. を呼んだ時から
     変更されている場合に ‘True’ を返します; そうでない場合には ‘False’
     を返します。

 -- メソッド: window.keypad (flag)

     If 'flag' is ‘True’, escape sequences generated by some keys
     (keypad, function keys) will be interpreted by ‘curses’.  If 'flag'
     is ‘False’, escape sequences will be left as is in the input
     stream.

 -- メソッド: window.leaveok (flag)

     'flag' が ‘True’ の場合、カーソルは "カーソル位置" に移動せず現在の
     場所にとどめます。これにより、カーソルの移動を減らせる可能性があり
     ます。この場合、カーソルは不可視にされます。

     'flag' が ‘False’ の場合、カーソルは更新の際に常に "カーソル位置" に
     移動します。

 -- メソッド: window.move (new_y, new_x)

     カーソルを ‘(new_y, new_x)’ に移動します。

 -- メソッド: window.mvderwin (y, x)

     ウィンドウを親ウィンドウの中で移動します。ウィンドウのスクリーン相
     対となるパラメタ群は変化しません。このルーチンは親ウィンドウの一部
     をスクリーン上の同じ物理位置に表示する際に用いられます。

 -- メソッド: window.mvwin (new_y, new_x)

     ウィンドウの左上角が ‘(new_y, new_x)’ になるように移動します。

 -- メソッド: window.nodelay (flag)

     'flag' が ‘True’ の場合、*note getch(): 1a50. は非ブロックで動作し
     ます。

 -- メソッド: window.notimeout (flag)

     'flag' が ‘True’ の場合、エスケープシーケンスはタイムアウトしなくな
     ります。

     'flag' が ‘False’ の場合、数ミリ秒間の間エスケープシーケンスは解釈
     されず、入力ストリーム中にそのままの状態で残されます。

 -- メソッド: window.noutrefresh ()

     更新をマークはしますが待機します。この関数はウィンドウのデータ構造
     を表現したい内容を反映するように更新しますが、物理スクリーン上に反
     映させるための強制更新を行いません。更新を行うためには *note
     doupdate(): 36e4. を呼び出します。

 -- メソッド: window.overlay (destwin[, sminrow, smincol, dminrow,
          dmincol, dmaxrow, dmaxcol])

     ウィンドウを 'destwin' の上に重ね書き (overlay) します。ウィンドウ
     は同じサイズである必要はなく、重なっている領域だけが複写されます。
     この複写は非破壊的です。これは現在の背景文字が 'destwin' の内容を上
     書きしないことを意味します。

     複写領域をきめ細かく制御するために、*note overlay(): 3748. の第二形
     式を使うことができます。'sminrow' および 'smincol' は元のウィンドウ
     の左上の座標で、他の変数は 'destwin' 内の矩形を表します。

 -- メソッド: window.overwrite (destwin[, sminrow, smincol, dminrow,
          dmincol, dmaxrow, dmaxcol])

     'destwin' の上にウィンドウの内容を上書き (overwrite) します。ウィン
     ドウは同じサイズである必要はなく、重なっている領域だけが複写されま
     す。この複写は破壊的です。これは現在の背景文字が 'destwin' の内容を
     上書きすることを意味します。

     複写領域をきめ細かく制御するために、*note overwrite(): 3749. の第二
     形式を使うことができます。'sminrow' および 'smincol' は元のウィンド
     ウの左上の座標で、他の変数は 'destwin' 内の矩形を表します。

 -- メソッド: window.putwin (file)

     ウィンドウに関連付けられているすべてのデータを与えられたファイルオ
     ブジェクトに書き込みます。この情報は後に *note getwin(): 36f5. 関数
     を使って取得することができます。

 -- メソッド: window.redrawln (beg, num)

     'beg' 行から始まる 'num' スクリーン行の表示内容が壊れており、次の
     *note refresh(): 1a41. 呼び出しで完全に再描画されなければならないこ
     とを通知します。

 -- メソッド: window.redrawwin ()

     ウィンドウ全体を更新 (touch) し、次の *note refresh(): 1a41. 呼び出
     しで完全に再描画されるようにします。

 -- メソッド: window.refresh ([pminrow, pmincol, sminrow, smincol,
          smaxrow, smaxcol])

     ディスプレイを即時更新し (実際のウィンドウとこれまでの描画/削除メソ
     ッドの内容とを同期し) ます。

     6 つのオプション引数はウィンドウが *note newpad(): 3704. で生成され
     た場合にのみ指定することができます。追加の引数はパッドやスクリーン
     のどの部分が含まれるのかを示すために必要です。'pminrow' および
     'pmincol' にはパッドが表示されている矩形の左上角を指定します。
     'sminrow', 'smincol', 'smaxrow', および 'smaxcol' には、スクリーン
     上に表示される矩形の縁を指定します。パッド内に表示される矩形の右下
     角はスクリーン座標から計算されるので、矩形は同じサイズでなければな
     りません。矩形は両方とも、それぞれのウィンドウ構造内に完全に含まれ
     ていなければなりません。'pminrow', 'pmincol', 'sminrow', または
     'smincol' に負の値を指定すると、ゼロを指定したものとして扱われます
     。

 -- メソッド: window.resize (nlines, ncols)

     curses ウィンドウの記憶域を、指定値のサイズに調整するため再割当てし
     ます。サイズが現在の値より大きい場合、ウィンドウのデータは現在の背
     景設定 (*note bkgdset(): 3720. で設定) で埋められマージされます。

 -- メソッド: window.scroll ([lines=1])

     スクリーンまたはスクロール領域を上に 'lines' 行スクロールします。

 -- メソッド: window.scrollok (flag)

     ウィンドウのカーソルが、最下行で改行を行ったり最後の文字を入力した
     りした結果、ウィンドウやスクロール領域の縁からはみ出して移動した際
     の動作を制御します。'flag' が ‘False’ の場合、カーソルは最下行にそ
     のままにしておかれます。'flag' が ‘True’ の場合、ウィンドウは 1 行
     上にスクロールします。端末の物理スクロール効果を得るためには *note
     idlok(): 373a. も呼び出す必要があるので注意してください。

 -- メソッド: window.setscrreg (top, bottom)

     スクロール領域を 'top' から 'bottom' に設定します。スクロール動作は
     すべてこの領域で行われます。

 -- メソッド: window.standend ()

     'A_STANDOUT' 属性をオフにします。端末によっては、この操作ですべての
     属性をオフにする副作用が発生します。

 -- メソッド: window.standout ()

     'A_STANDOUT' 属性をオンにします。

 -- メソッド: window.subpad (begin_y, begin_x)

 -- メソッド: window.subpad (nlines, ncols, begin_y, begin_x)

     左上の角が ‘(begin_y, begin_x)’ にあり、幅/高さがそれぞれ 'ncols' /
     'nlines' であるようなサブウィンドウを返します。

 -- メソッド: window.subwin (begin_y, begin_x)

 -- メソッド: window.subwin (nlines, ncols, begin_y, begin_x)

     左上の角が ‘(begin_y, begin_x)’ にあり、幅/高さがそれぞれ 'ncols' /
     'nlines' であるようなサブウィンドウを返します。

     デフォルトでは、サブウィンドウは指定された場所からウィンドウの右下
     角まで広がります。

 -- メソッド: window.syncdown ()

     このウィンドウの上位のウィンドウのいずれかで更新(touch)された各場所
     をこのウィンドウ内でも更新します。このルーチンは *note refresh():
     1a41. から呼び出されるので、手動で呼び出す必要はほとんどないはずで
     す。

 -- メソッド: window.syncok (flag)

     'flag' が ‘True’ の場合、ウィンドウが変更された際は常に *note
     syncup(): 3755. を自動的に呼ぶようになります。

 -- メソッド: window.syncup ()

     ウィンドウ内で更新 (touch) した場所を、上位のすべてのウィンドウ内で
     も更新します。

 -- メソッド: window.timeout (delay)

     ウィンドウのブロックまたは非ブロック読み込み動作を設定します。
     'delay' が負の場合、ブロック読み出しが使われ、入力を無期限で待ち受
     けます。'delay' がゼロの場合、非ブロック読み出しが使われ、入力待ち
     の文字がない場合 *note getch(): 1a50. は ‘-1’ を返します。'delay' が
     正の値であれば、‘getch()’ は 'delay' ミリ秒間ブロックし、ブロック後
     の時点で入力がない場合には ‘-1’ を返します。

 -- メソッド: window.touchline (start, count[, changed])

     'start' から始まる 'count' 行が変更されたかのように振舞わせます。も
     し 'changed' が与えられた場合、その引数は指定された行が変更された
     ('changed'‘=True’)か、変更されていないか('changed')を指定します。

 -- メソッド: window.touchwin ()

     描画を最適化するために、すべてのウィンドウが変更されたかのように振
     舞わせます。

 -- メソッド: window.untouchwin ()

     ウィンドウ内のすべての行を、最後に *note refresh(): 1a41. を呼んだ
     際から変更されていないものとしてマークします。

 -- メソッド: window.vline (ch, n[, attr])

 -- メソッド: window.vline (y, x, ch, n[, attr])

     Display a vertical line starting at ‘(y, x)’ with length 'n'
     consisting of the character 'ch' with attributes 'attr'.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue35924


File: python.info,  Node: 定数<6>,  Prev: Window オブジェクト,  Up: curses --- 文字セル表示のターミナル処理

5.18.5.3 定数
.............

The ‘curses’ module defines the following data members:

 -- データ: curses.ERR

     *note getch(): 1a50. のような整数を返す curses ルーチンのいくつかは
     、失敗した際に *note ERR: 375a. を返します。

 -- データ: curses.OK

     *note napms(): 1b49. のような整数を返す curses ルーチンのいくつかは
     、成功した際に *note OK: 375b. を返します。

 -- データ: 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(): 3710.

 -- データ: curses.COLOR_PAIRS

     The maximum number of color pairs the terminal can support.  It is
     defined only after the call to *note start_color(): 3710.

 -- データ: curses.COLS

     The width of the screen, i.e., the number of columns.  It is
     defined only after the call to *note initscr(): 1a3b.  Updated by
     *note update_lines_cols(): 11a7, *note resizeterm(): 1b69. and
     *note resize_term(): 1b6a.

 -- データ: curses.LINES

     The height of the screen, i.e., the number of lines.  It is defined
     only after the call to *note initscr(): 1a3b.  Updated by *note
     update_lines_cols(): 11a7, *note resizeterm(): 1b69. and *note
     resize_term(): 1b6a.

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: 3777,
‘KEY_F2’, ‘KEY_F3’, ‘KEY_F4’) available, and the arrow keys mapped to
*note KEY_UP: 3771, *note KEY_DOWN: 3770, *note KEY_LEFT: 3772. and
*note KEY_RIGHT: 3773. 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(): 1a3b. が呼び出された後でしか利用で
     きません。

ACS コード                   意味
                             
----------------------------------------------------------------------------
                             
 -- データ:                  右上角の別名
          curses.ACS_BBSS    

 -- データ:                  黒四角ブロック
          curses.ACS_BLOCK   

 -- データ:                  白四角ブロック
          curses.ACS_BOARD   

 -- データ:                  水平線の別名
          curses.ACS_BSBS    

 -- データ:                  左上角の別名
          curses.ACS_BSSB    

 -- データ:                  上向き T 字罫線の別名
          curses.ACS_BSSS    

 -- データ:                  下向き T 字罫線
          curses.ACS_BTEE    

 -- データ:                  黒丸(bullet)
          curses.ACS_BULLET  

 -- データ:                  チェッカーボードパタン (点描)
          curses.ACS_CKBOARD 

 -- データ:                  下向き矢印
          curses.ACS_DARROW  

 -- データ:                  度記号
          curses.ACS_DEGREE  

 -- データ:                  ダイアモンド
          curses.ACS_DIAMOND 

 -- データ:                  大なりイコール
          curses.ACS_GEQUAL  

 -- データ:                  水平線
          curses.ACS_HLINE   

 -- データ:                  ランタン(lantern) シンボル
          curses.ACS_LANTERN 

 -- データ:                  左向き矢印
          curses.ACS_LARROW  

 -- データ:                  小なりイコール
          curses.ACS_LEQUAL  

 -- データ:                  左下角
          curses.ACS_LLCORNER

 -- データ:                  右下角
          curses.ACS_LRCORNER

 -- データ:                  左向き T 字罫線
          curses.ACS_LTEE    

 -- データ:                  不等号
          curses.ACS_NEQUAL  

 -- データ: curses.ACS_PI    パイ記号
                             
                             
 -- データ:                  プラスマイナス記号
          curses.ACS_PLMINUS 

 -- データ:                  大プラス記号
          curses.ACS_PLUS    

 -- データ:                  右向き矢印
          curses.ACS_RARROW  

 -- データ:                  右向き T 字罫線
          curses.ACS_RTEE    

 -- データ: curses.ACS_S1    スキャンライン 1
                             
                             
 -- データ: curses.ACS_S3    スキャンライン 3
                             
                             
 -- データ: curses.ACS_S7    スキャンライン 7
                             
                             
 -- データ: curses.ACS_S9    スキャンライン 9
                             
                             
 -- データ:                  右下角の別名
          curses.ACS_SBBS    

 -- データ:                  垂直線の別名
          curses.ACS_SBSB    

 -- データ:                  右向き T 字罫線の別名
          curses.ACS_SBSS    

 -- データ:                  左下角の別名
          curses.ACS_SSBB    

 -- データ:                  下向き T 字罫線の別名
          curses.ACS_SSBS    

 -- データ:                  左向き T 字罫線の別名
          curses.ACS_SSSB    

 -- データ:                  交差罫線または大プラス記号の別名
          curses.ACS_SSSS    

 -- データ:                  ポンドスターリング記号
          curses.ACS_STERLING

 -- データ:                  上向き T 字罫線
          curses.ACS_TTEE    

 -- データ:                  上向き矢印
          curses.ACS_UARROW  

 -- データ:                  左上角
          curses.ACS_ULCORNER

 -- データ:                  右上角
          curses.ACS_URCORNER

 -- データ:                  垂直線
          curses.ACS_VLINE   

The following table lists mouse button constants used by *note
getmouse(): 36ea.:

Mouse button constant                  意味
                                       
-----------------------------------------------------------------------------------------
                                       
 -- データ: curses.BUTTONn_PRESSED     Mouse button 'n' pressed
                                       
                                       
 -- データ: curses.BUTTONn_RELEASED    Mouse button 'n' released
                                       
                                       
 -- データ: curses.BUTTONn_CLICKED     Mouse button 'n' clicked
                                       
                                       
 -- データ:                            Mouse button 'n' double clicked
          curses.BUTTONn_DOUBLE_CLICKED

 -- データ:                            Mouse button 'n' triple clicked
          curses.BUTTONn_TRIPLE_CLICKED

 -- データ: curses.BUTTON_SHIFT        Shift was down during button state change
                                       
                                       
 -- データ: curses.BUTTON_CTRL         Control was down during button state change
                                       
                                       
 -- データ: curses.BUTTON_ALT          Control was down during button state change
                                       

バージョン 3.10 で変更: The ‘BUTTON5_*’ constants are now exposed if
they are provided by the underlying curses library.

以下のテーブルは定義済みの色を列挙したものです:

定数                          色
                              
---------------------------------------------------------------
                              
 -- データ:                   黒
          curses.COLOR_BLACK  

 -- データ:                   青
          curses.COLOR_BLUE   

 -- データ:                   シアン (薄く緑がかった青)
          curses.COLOR_CYAN   

 -- データ:                   緑
          curses.COLOR_GREEN  

 -- データ:                   マゼンタ (紫がかった赤)
          curses.COLOR_MAGENTA

 -- データ:                   赤
          curses.COLOR_RED    

 -- データ:                   白
          curses.COLOR_WHITE  

 -- データ:                   黄色
          curses.COLOR_YELLOW 


File: python.info,  Node: curses textpad --- Text input widget for curses programs,  Next: curses ascii --- ASCII 文字のユーティリティー,  Prev: curses --- 文字セル表示のターミナル処理,  Up: コマンドラインインターフェースライブラリ

5.18.6 ‘curses.textpad’ -- Text input widget for curses programs
----------------------------------------------------------------

The ‘curses.textpad’ module provides a *note Textbox: 37fa. class that
handles elementary text editing in a curses window, supporting a set of
keybindings resembling those of Emacs (thus, also of Netscape Navigator,
BBedit 6.x, FrameMaker, and many other programs).  The module also
provides a rectangle-drawing function useful for framing text boxes or
for other purposes.

The module ‘curses.textpad’ defines the following function:

 -- の関数: curses.textpad.rectangle (win, uly, ulx, lry, lrx)

     矩形を描画します。最初の引数はウィンドウオブジェクトでなければなり
     ません; 残りの引数はそのウィンドウからの相対座標になります。2 番目
     および 3 番目の引数は描画すべき矩形の左上角の y および x 座標です;
     4 番目および 5 番目の引数は右下角の y および x 座標です。矩形は、
     VT100/IBM PC におけるフォーム文字を利用できる端末 (xterm やその他の
     ほとんどのソフトウェア端末エミュレータを含む) ではそれを使って描画
     されます。そうでなければ ASCII 文字のダッシュ、垂直バー、およびプラ
     ス記号で描画されます。

* Menu:

* Textbox オブジェクト::


File: python.info,  Node: Textbox オブジェクト,  Up: curses textpad --- Text input widget for curses programs

5.18.6.1 Textbox オブジェクト
.............................

以下のような *note Textbox: 37fa. オブジェクトをインスタンス生成すること
ができます:

 -- クラス: curses.textpad.Textbox (win)

     テキストボックスウィジェットオブジェクトを返します。'win' 引数は、
     テキストボックスを入れるための *note ウィンドウ: 1a44. オブジェクト
     でなければなりません。テキストボックスの編集カーソルは、最初はテキ
     ストボックスが入っているウィンドウの左上角に配置され、その座標は
     ‘(0, 0)’ です。インスタンスの *note stripspaces: 37fe. フラグの初期
     値はオンに設定されます。

     *note Textbox: 37fa. オブジェクトは以下のメソッドを持ちます:

      -- メソッド: edit ([validator])

          普段使うことになるエントリポイントです。終了キーストロークの一
          つが入力されるまで編集キーストロークを受け付けます。
          'validator' を与える場合、関数でなければなりません。
          'validator' はキーストロークが入力されるたびにそのキーストロー
          クが引数となって呼び出されます; 返された値に対して、コマンドキ
          ーストロークとして解釈が行われます。このメソッドはウィンドウの
          内容を文字列として返します; ウィンドウ内の空白が含められるかど
          うかは *note stripspaces: 37fe. 属性で決められます。

      -- メソッド: do_command (ch)

          単一のコマンドキーストロークを処理します。以下にサポートされて
          いる特殊キーストロークを示します:

          キーストローク         動作
                                 
          -----------------------------------------------------------------------
                                 
          ‘Control’-‘A’          ウィンドウの左端に移動します。
                                 
                                 
          ‘Control’-‘B’          カーソルを左へ移動し、必要なら前の行に折り返
                                 します。
                                 
                                 
          ‘Control’-‘D’          カーソル下の文字を削除します。
                                 
                                 
          ‘Control’-‘E’          右端 (stripspaces がオフのとき) または行末
                                 (stripspaces がオンのとき) に移動します。
                                 
                                 
          ‘Control’-‘F’          カーソルを右に移動し、必要なら次の行に折り返
                                 します。
                                 
                                 
          ‘Control’-‘G’          ウィンドウを終了し、その内容を返します。
                                 
                                 
          ‘Control’-‘H’          逆方向に文字を削除します。
                                 
                                 
          ‘Control’-‘J’          ウィンドウが 1 行であれば終了し、そうでなけれ
                                 ば新しい行を挿入します。
                                 
                                 
          ‘Control’-‘K’          行が空白行ならその行全体を削除し、そうでなけ
                                 ればカーソル以降行末までを消去します。
                                 
                                 
          ‘Control’-‘L’          スクリーンを更新します。
                                 
                                 
          ‘Control’-‘N’          カーソルを下に移動します; 1 行下に移動します
                                 。
                                 
                                 
          ‘Control’-‘O’          カーソルの場所に空行を 1 行挿入します。
                                 
                                 
          ‘Control’-‘P’          カーソルを上に移動します; 1 行上に移動します
                                 。
                                 

          移動操作は、カーソルがウィンドウの縁にあって移動ができない場合
          には何も行いません。場合によっては、以下のような同義のキースト
          ロークがサポートされています:

          定数                                 キーストローク
                                               
          ------------------------------------------------------------
                                               
          *note KEY_LEFT: 3772.                ‘Control’-‘B’
                                               
                                               
          *note KEY_RIGHT: 3773.               ‘Control’-‘F’
                                               
                                               
          *note KEY_UP: 3771.                  ‘Control’-‘P’
                                               
                                               
          *note KEY_DOWN: 3770.                ‘Control’-‘N’
                                               
                                               
          *note KEY_BACKSPACE: 3775.           ‘Control’-‘h’
                                               

          他のキーストロークは、与えられた文字を挿入し、(行折り返し付き
          で) 右に移動するコマンドとして扱われます。

      -- メソッド: gather ()

          ウィンドウの内容を文字列として返します; ウィンドウ内の空白が含
          められるかどうかは *note stripspaces: 37fe. メンバ変数で決めら
          れます。

      -- の属性: 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: 380b. フロー制御時に使用
          curses.ascii.ENQ

 -- データ:         肯定応答
          curses.ascii.ACK

 -- データ:         ベル
          curses.ascii.BEL

 -- データ:         一文字後退
          curses.ascii.BS

 -- データ:         タブ
          curses.ascii.TAB

 -- データ:         *note TAB: 380e. の別名: "水平タブ"
          curses.ascii.HT

 -- データ:         改行
          curses.ascii.LF

 -- データ:         *note LF: 3810. の別名: "改行"
          curses.ascii.NL

 -- データ:         垂直タブ
          curses.ascii.VT

 -- データ:         改頁
          curses.ascii.FF

 -- データ:         復帰
          curses.ascii.CR

 -- データ:         シフトアウト、他の文字セットの開始
          curses.ascii.SO

 -- データ:         シフトイン、標準の文字セットに復帰
          curses.ascii.SI

 -- データ:         データリンクでのエスケープ
          curses.ascii.DLE

 -- データ:         装置制御 1、フロー制御のための XON
          curses.ascii.DC1

 -- データ:         装置制御 2、ブロックモードフロー制御
          curses.ascii.DC2

 -- データ:         装置制御 3、フロー制御のための XOFF
          curses.ascii.DC3

 -- データ:         装置制御 4
          curses.ascii.DC4

 -- データ:         否定応答
          curses.ascii.NAK

 -- データ:         同期信号
          curses.ascii.SYN

 -- データ:         ブロック転送終了
          curses.ascii.ETB

 -- データ:         キャンセル (Cancel)
          curses.ascii.CAN

 -- データ:         媒体終端
          curses.ascii.EM

 -- データ:         代入文字
          curses.ascii.SUB

 -- データ:         エスケープ文字
          curses.ascii.ESC

 -- データ:         ファイル区切り文字
          curses.ascii.FS

 -- データ:         グループ区切り文字
          curses.ascii.GS

 -- データ:         レコード区切り文字、ブロックモード終了子
          curses.ascii.RS

 -- データ:         単位区切り文字
          curses.ascii.US

 -- データ:         空白文字
          curses.ascii.SP

 -- データ:         削除
          curses.ascii.DEL

これらの大部分は、最近は実際に定数の意味通りに使われることがほとんどない
ので注意してください。これらのニーモニック符号はデジタル計算機より前のテ
レプリンタにおける慣習から付けられたものです。

このモジュールでは、標準 C ライブラリの関数を雛型とする以下の関数をサポ
ートしています:

 -- の関数: curses.ascii.isalnum (c)

     ASCII 英数文字かどうかを調べます; ‘isalpha(c) or isdigit(c)’ と等価
     です。

 -- の関数: curses.ascii.isalpha (c)

     ASCII アルファベット文字かどうかを調べます; ‘isupper(c) or
     islower(c)’ と等価です。

 -- の関数: curses.ascii.isascii (c)

     文字が 7 ビット ASCII 文字に合致するかどうかを調べます。

 -- の関数: curses.ascii.isblank (c)

     ASCII 余白文字、すなわち空白または水平タブかどうかを調べます。

 -- の関数: curses.ascii.iscntrl (c)

     ASCII 制御文字 (0x00 から 0x1f の範囲または 0x7f) かどうかを調べま
     す。

 -- の関数: curses.ascii.isdigit (c)

     ASCII 10 進数字、すなわち ‘'0'’ から ‘'9'’ までの文字かどうかを調べ
     ます。‘c in string.digits’ と等価です。

 -- の関数: curses.ascii.isgraph (c)

     空白以外の ASCII 印字可能文字かどうかを調べます。

 -- の関数: curses.ascii.islower (c)

     ASCII 小文字かどうかを調べます。

 -- の関数: curses.ascii.isprint (c)

     空白文字を含め、ASCII 印字可能文字かどうかを調べます。

 -- の関数: curses.ascii.ispunct (c)

     空白または英数字以外の ASCII 印字可能文字かどうかを調べます。

 -- の関数: curses.ascii.isspace (c)

     ASCII 余白文字、すなわち空白、改行、復帰、改頁、水平タブ、垂直タブ
     かどうかを調べます。

 -- の関数: curses.ascii.isupper (c)

     ASCII 大文字かどうかを調べます。

 -- の関数: curses.ascii.isxdigit (c)

     ASCII 16 進数字かどうかを調べます。‘c in string.hexdigits’ と等価で
     す。

 -- の関数: curses.ascii.isctrl (c)

     ASCII 制御文字 (0 から 31 までの値) かどうかを調べます。

 -- の関数: curses.ascii.ismeta (c)

     非 ASCII 文字 (0x80 またはそれ以上の値) かどうかを調べます。

これらの関数は数字も 1 文字の文字列も使えます; 引数を文字列にした場合、
組み込み関数 *note ord(): 254a. を使って変換されます。

これらの関数は全て、関数に渡した文字列の文字から得られたビット値を調べる
ので注意してください; 関数はホスト計算機で使われている文字列エンコーディ
ングについて何ら関知しません。

以下の 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/main/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 オブジェクト::


File: python.info,  Node: 関数<7>,  Next: Panel オブジェクト,  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)

     与えられたウィンドウ 'win' に関連付けられたパネルオブジェクトを返し
     ます。返されたパネルオブジェクトを参照しておく必要があることに注意
     してください。もし参照しなければ、パネルオブジェクトはガベージコレ
     クションされてパネルスタックから削除されます。

 -- の関数: curses.panel.top_panel ()

     パネルスタックの最上層のパネルを返します。

 -- の関数: curses.panel.update_panels ()

     仮想スクリーンをパネルスタック変更後の状態に更新します。この関数で
     は *note curses.doupdate(): 36e4. を呼ばないので、ユーザは自分で呼
     び出す必要があります。


File: python.info,  Node: Panel オブジェクト,  Prev: 関数<7>,  Up: curses panel --- curses のためのパネルスタック拡張

5.18.8.2 Panel オブジェクト
...........................

上記の *note new_panel(): 1a1b. が返す Panel オブジェクトはスタック順の
概念を持つウィンドウです。ウィンドウはパネルに関連付けられており、表示す
る内容を決定している一方、パネルのメソッドはパネルスタック中のウィンドウ
の深さ管理を担います。

Panel オブジェクトは以下のメソッドを持っています:

 -- メソッド: Panel.above ()

     現在のパネルの上にあるパネルを返します。

 -- メソッド: Panel.below ()

     現在のパネルの下にあるパネルを返します。

 -- メソッド: Panel.bottom ()

     パネルをスタックの最下層にプッシュします。

 -- メソッド: Panel.hidden ()

     パネルが隠れている (不可視である) 場合に ‘True’ を返し、そうでない
     場合 ‘False’ を返します。

 -- メソッド: Panel.hide ()

     パネルを隠します。この操作ではオブジェクトは消去されず、スクリーン
     上のウィンドウを不可視にするだけです。

 -- メソッド: Panel.move (y, x)

     パネルをスクリーン座標 ‘(y, x)’ に移動します。

 -- メソッド: Panel.replace (win)

     パネルに関連付けられたウィンドウを 'win' に変更します。

 -- メソッド: Panel.set_userptr (obj)

     パネルのユーザポインタを 'obj' に設定します。このメソッドは任意のデ
     ータをパネルに関連付けるために使われ、任意の Python オブジェクトに
     することができます。

 -- メソッド: Panel.show ()

     (隠れているはずの) パネルを表示します。

 -- メソッド: Panel.top ()

     パネルをスタックの最上層にプッシュします。

 -- メソッド: Panel.userptr ()

     パネルのユーザポインタを返します。任意の Python オブジェクトです。

 -- メソッド: Panel.window ()

     パネルに関連付けられているウィンドウオブジェクトを返します。


File: python.info,  Node: cmd --- 行指向のコマンドインタープリターのサポート,  Prev: curses panel --- curses のためのパネルスタック拡張,  Up: コマンドラインインターフェースライブラリ

5.18.9 ‘cmd’ -- 行指向のコマンドインタープリターのサポート
----------------------------------------------------------

'ソースコード:' Lib/cmd.py(1)

__________________________________________________________________

*note Cmd: 1a98. クラスでは、行指向のコマンドインタープリタを書くための
簡単なフレームワークを提供します。テストハーネスや管理ツール、そして、後
により洗練されたインターフェイスでラップするプロトタイプとして、こうした
インタープリタはよく役に立ちます。

 -- クラス: cmd.Cmd (completekey='tab', stdin=None, stdout=None)

     *note Cmd: 1a98. インスタンス、あるいはサブクラスのインスタンスは、
     行指向のインタープリタ・フレームワークです。 ‘Cmd’ 自身をインスタン
     ス化することはありません。むしろ、 ‘Cmd’ のメソッドを継承したり、ア
     クションメソッドをカプセル化するために、あなたが自分で定義するイン
     タープリタクラスのスーパークラスとしての便利です。

     オプション引数 'completekey' は、補完キーの *note readline: c2. 名
     です。デフォルトは ‘Tab’ です。 'completekey' が *note None: a6a. で
     なく、 ‘readline’ が利用できるならば、コマンド補完は自動的に行われ
     ます。

     The default, ‘'tab'’, is treated specially, so that it refers to
     the ‘Tab’ key on every *note readline.backend: 1c4e.  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: 94f. と *note sys.stdout: ea0. が使用さ
     れます。

     引数に渡した 'stdin' を使いたい場合は、インスタンスの *note
     use_rawinput: 3856. 属性を ‘False’ にセットしてください。そうしない
     と 'stdin' は無視されます。

     バージョン 3.13 で変更: ‘completekey='tab'’ is replaced by ‘'^I'’
     for ‘editline’.

* Menu:

* Cmdオブジェクト::
* Cmd の例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/cmd.py


File: python.info,  Node: Cmdオブジェクト,  Next: Cmd の例,  Up: cmd --- 行指向のコマンドインタープリターのサポート

5.18.9.1 Cmdオブジェクト
........................

*note Cmd: 1a98. インスタンスは、次のメソッドを持ちます:

 -- メソッド: Cmd.cmdloop (intro=None)

     プロンプトを繰り返し出力し、入力を受け取り、受け取った入力から取り
     去った先頭の語を解析し、その行の残りを引数としてアクションメソッド
     へディスパッチします。

     オプションの引数は、最初のプロンプトの前に表示されるバナーあるいは
     イントロ用の文字列です (これはクラス属性 *note intro: 385a. をオー
     バーライドします)。

     *note readline: c2. モジュールがロードされているなら、入力は自動的
     に ‘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(): 1c52.  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(): 385b. 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: 1a98. 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(): 385d. and *note postcmd(): 385b.
     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(): 385e. 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:
     1a98. 内のスタブであって、サブクラスでオーバーライドされるために存
     在します。戻り値は *note onecmd(): 385c. メソッドが実行するコマンド
     として使われます。 *note precmd(): 385d. の実装では、コマンドを書き
     換えるかもしれないし、あるいは単に変更していない 'line' を返すかも
     しれません。

 -- メソッド: Cmd.postcmd (stop, line)

     コマンドディスパッチが終わった直後に実行されるフックメソッド。この
     メソッドは *note Cmd: 1a98. 内のスタブで、サブクラスでオーバーライ
     ドされるために存在します。 'line' は実行されたコマンド行で、 'stop'
     は *note postcmd(): 385b. の呼び出しの後に実行を停止するかどうかを
     示すフラグです。これは *note onecmd(): 385c. メソッドの戻り値です。
     このメソッドの戻り値は、 'stop' に対応する内部フラグの新しい値とし
     て使われます。偽を返すと、実行を続けます。

 -- メソッド: Cmd.preloop ()

     *note cmdloop(): 3859. が呼び出されたときに一度だけ実行されるフック
     メソッド。このメソッドは *note Cmd: 1a98. 内のスタブであって、サブ
     クラスでオーバーライドされるために存在します。

 -- メソッド: Cmd.postloop ()

     *note cmdloop(): 3859. が戻る直前に一度だけ実行されるフックメソッド
     。このメソッドは *note Cmd: 1a98. 内のスタブであって、サブクラスで
     オーバーライドされるために存在します。

*note Cmd: 1a98. のサブクラスのインスタンスは、公開されたインスタンス変
数をいくつか持っています:

 -- の属性: Cmd.prompt

     入力を求めるために表示されるプロンプト。

 -- の属性: Cmd.identchars

     コマンドの先頭の語として受け入れられる文字の文字列。

 -- の属性: Cmd.lastcmd

     最後の空でないコマンド接頭辞。

 -- の属性: Cmd.cmdqueue

     キューに入れられた入力行のリスト。cmdqueue リストは新たな入力が必要
     な際に *note cmdloop(): 3859. 内でチェックされます; これが空でない
     場合、その要素は、あたかもプロンプトから入力されたかのように順に処
     理されます。

 -- の属性: Cmd.intro

     イントロあるいはバナーとして表示される文字列。 *note cmdloop():
     3859. メソッドに引数を与えるために、オーバーライドされるかもしれま
     せん。

 -- の属性: 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(): 3859. uses
     *note input(): 1692. to display a prompt and read the next command;
     if false, *note sys.stdout.write(): ea0. and *note
     sys.stdin.readline(): 94f. are used.  (This means that by importing
     *note readline: c2, 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: 10a. モジュールのいくつかのコマンドを持ったシ
ェルの作成方法の簡単な例を示します。

Basic turtle commands such as *note forward(): 386d. are added to a
*note Cmd: 1a98. 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(): 385d. 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: 3866. 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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

* Menu:

* はじめに: はじめに<8>.
* GIL and performance considerations::
* リファレンス: リファレンス<2>.
* with 文でのロック・条件変数・セマフォの使い方::
* Iterator synchronization::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 427.:

     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: b2c. 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: be. 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: 68c. のため、ある時点で Python
コードを実行できるスレッドは1つに限られます (ただし、いくつかのパフォー
マンスが強く求められるライブラリはこの制限を克服しています)。アプリケー
ションにマルチコアマシンの計算能力をより良く利用させたい場合は、 *note
multiprocessing: 98. モジュールや *note
concurrent.futures.ProcessPoolExecutor: 211. の利用をお勧めします。 ただ
し、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: 68c. (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: 48e. 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: 427. オブジェクトの数を返します。この数は
     *note enumerate(): 1e70. の返すリストの長さと同じです。

     関数''activeCount''はこの関数の非推奨エイリアスです。

 -- の関数: threading.current_thread ()

     Return the current *note Thread: 427. 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(): e04. で発生したキャッチされない例外を処理する。

     (実) 引数*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: 10fb, the exception is silently
     ignored.  Otherwise, the exception is printed out on *note
     sys.stderr: d09.

     If this function raises an exception, *note sys.excepthook(): be9.
     is called to handle it.

     *note threading.excepthook(): c27. can be overridden to control how
     uncaught exceptions raised by *note Thread.run(): e04. 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(): be9. handles uncaught exceptions.

     Added in version 3.8.

 -- データ: threading.__excepthook__

     Holds the original value of *note threading.excepthook(): c27.  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: 234c.: Windows, FreeBSD, Linux, macOS, OpenBSD,
     NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD, Solaris.

     Added in version 3.8.

     バージョン 3.13 で変更: Added support for GNU/kFreeBSD.

     バージョン 3.15 で変更: Added support for Solaris.

 -- の関数: threading.enumerate ()

     現在、アクティブな *note Thread: 427. オブジェクト全てのリストを返
     します。リストには、デーモンスレッド (daemonic thread)、 *note
     current_thread(): 346. の生成するダミースレッドオブジェクトが入りま
     す。終了したスレッドとまだ開始していないスレッドは入りません。しか
     し、主スレッドは、たとえ終了しても、常に結果に含まれます。

 -- の関数: threading.main_thread ()

     main *note Thread: 427. オブジェクトを返します。通常の条件では、メ
     インスレッドは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(): 563.
     for each thread, before its *note run(): e04. 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(): 563. for each
     thread, before its *note run(): e04. method is called.

     Added in version 3.12.

 -- の関数: threading.gettrace ()

     *note settrace(): c24. 関数で設定したトレース関数を取得します。

     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(): 18b6.
     for each thread, before its *note run(): e04. 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(): 18b6. for each
     thread, before its *note run(): e04. method is called.

     Added in version 3.12.

 -- の関数: threading.getprofile ()

     *note setprofile(): c25. 関数で設定したプロファイラ関数を取得します
     。

     Added in version 3.10.

 -- の関数: threading.stack_size ([size])

     新しいスレッドを作るときのスレッドスタックサイズを返します。オプシ
     ョンの 'size' 引数にはこれ以降に作成するスレッドのスタックサイズを
     指定し、0 (プラットフォームのデフォルト値または設定されたデフォルト
     値) か、 32,768 (32 KiB) 以上の正の整数でなければなりません。'size'
     が指定されない場合 0 が使われます。スレッドのスタックサイズの変更が
     サポートされていない場合、 *note RuntimeError: 317. を送出します。
     不正なスタックサイズが指定された場合、 *note ValueError: 15a. を送
     出して、スタックサイズは変更されません。32 KiB は現在のインタープリ
     タ自身のために十分であると保証された最小のスタックサイズです。いく
     つかのプラットフォームではスタックサイズに対して制限があることに注
     意してください。例えば最小のスタックサイズが 32 KiB より大きかった
     り、システムのメモリページサイズ の整数倍の必要があるなどです。この
     制限についてはプラットフォームのドキュメントを参照してください (一
     般的なページサイズは 4 KiB なので、プラットフォームに関する情報がな
     い場合は 4096 の整数倍のスタックサイズを選ぶといいかもしれません)。

     *note Availability: 234c.: Windows, pthreads.

     Unix platforms with POSIX threads support.

このモジュールでは以下の定数も定義しています:

 -- データ: threading.TIMEOUT_MAX

     ブロックする関数 (*note Lock.acquire(): a8c, *note RLock.acquire():
     122f, *note Condition.wait(): 1e7c. など) の 'timeout' 引数に許され
     る最大値。これ以上の値を timeout に指定すると *note OverflowError:
     c5b. が発生します。

     Added in version 3.2.

このモジュールは多くのクラスを定義しています。それらは下記のセクションで
詳しく説明されます。

このモジュールのおおまかな設計は Java のスレッドモデルに基づいています。
とはいえ、 Java がロックと条件変数を全てのオブジェクトの基本的な挙動にし
ているのに対し、 Python ではこれらを別個のオブジェクトに分けています。
Python の *note Thread: 427. クラスがサポートしているのは 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: 1aa6.
object and use its attributes:

     >>> mydata = local()
     >>> mydata.number = 42
     >>> mydata.number
     42

You can also access the *note local: 1aa6.-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: 1aa6. object, including
their *note __dict__: 1ca. 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: 1aa6. 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__(): 306.
method, it will be called each time the *note local: 1aa6. object is
used in a separate thread.  This is necessary to initialize each
thread's dictionary.

Now if we create a *note local: 1aa6. 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__: 9de, 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: 427. 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(): e04. 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(): 429.
メソッドを呼び出して活動を開始しなければなりません。 ‘start()’ メソッド
はそれぞれのスレッドの *note run(): e04. メソッドを起動します。

スレッドの活動が始まると、スレッドは '生存中 (alive)' とみなされます。 ス
レッドは、通常 *note run(): e04. メソッドが終了するまで、もしくは捕捉さ
れない例外が送出されるまで生存中となります。 *note is_alive(): d1c. メソ
ッドは、スレッドが生存中であるかどうか調べます。

スレッドは他のスレッドの *note join(): 15a3. メソッドを呼び出すことがで
きます。このメソッドは、 ‘join()’ メソッドを呼ばれたスレッドが終了するま
でメソッドの呼び出し元のスレッドをブロックします。

スレッドは名前を持っています。名前はコンストラクタに渡すことができ、
*note name: 345. 属性を通して読み出したり変更したりできます。

*note run(): e04. メソッドが例外を発生させた場合、*note
threading.excepthook(): c27. が呼び出され、例外を処理します。デフォルト
では、‘threading.excepthook()’ は *note SystemExit: 10fb. を黙殺します。

スレッドには "デーモンスレッド (daemon thread)" であるというフラグを立て
られます。 このフラグには、残っているスレッドがデーモンスレッドだけにな
った時に Python プログラム全体を終了させるという意味があります。フラグの
初期値はスレッドを生成したスレッドから継承します。フラグの値は *note
daemon: 343. プロパティまたは 'daemon' コンストラクタ引数を通して設定で
きます。

     注釈: デーモンスレッドは終了時にいきなり停止されます。デーモンスレ
     ッドで使われたリソース (開いているファイル、データベースのトランザ
     クションなど) は適切に解放されないかもしれません。きちんと
     (gracefully) スレッドを停止したい場合は、スレッドを非デーモンスレッ
     ドにして、*note Event: 1518. のような適切なシグナル送信機構を使用し
     てください。

スレッドには "主スレッド (main thread)" オブジェクトがあります。主スレッ
ドは Python プログラムを最初に制御していたスレッドです。主スレッドはデー
モンスレッドではありません。

"ダミースレッドオブジェクト (dummy thread objects)" が作成される場合があ
ります。ダミースレッドは、 "外来スレッド (alien thread)" に相当するスレ
ッドオブジェクトです。ダミースレッドは、C コードから直接生成されたスレッ
ドのような、 ‘threading’ モジュールの外で開始された処理スレッドです。ダ
ミースレッドオブジェクトには限られた機能しかなく、常に生存中、かつデーモ
ンスレッドであるとみなされ、 *note join: 387c. できません。また、外来ス
レッドの終了を検出するのは不可能なので、ダミースレッドは削除できません。

 -- クラス: threading.Thread (group=None, target=None, name=None,
          args=(), kwargs={}, *, daemon=None, context=None)

     コンストラクタは常にキーワード引数を使って呼び出さなければなりませ
     ん。各引数は以下の通りです:

     'group' should be ‘None’; reserved for future extension when a
     ‘ThreadGroup’ class is implemented.

     'target' は *note run(): e04. メソッドによって起動される呼び出し可
     能オブジェクトです。デフォルトでは何も呼び出さないことを示す ‘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: 428. value to use when starting the
     thread.  The default value is ‘None’ which indicates that the *note
     sys.flags.thread_inherit_context: 426. flag controls the behaviour.
     If the flag is true, threads will start with a copy of the context
     of the caller of *note start(): 429.  If false, they will start
     with an empty context.  To explicitly start with an empty context,
     pass a new instance of *note Context(): 428.  To explicitly start
     with a copy of the current context, pass the value from *note
     copy_context(): 387d.  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(): 429. は、オブジェクトの *note
          run(): e04. メソッドが個別の処理スレッド中で呼び出されるように
          調整します。

          同じスレッドオブジェクトに対し、このメソッドを2回以上呼び出し
          た場合、 *note RuntimeError: 317. を送出します。

          If supported, set the operating system thread name to *note
          threading.Thread.name: 345.  The name can be truncated
          depending on the operating system thread name limits.

          バージョン 3.14 で変更: Set the operating system thread name.

      -- メソッド: run ()

          スレッドの活動をもたらすメソッドです。

          このメソッドはサブクラスでオーバライドできます。標準の *note
          run(): e04. メソッドでは、オブジェクトのコンストラクタの
          'target' 引数に呼び出し可能オブジェクトを指定した場合、 'args'
          および 'kwargs' の位置引数およびキーワード引数とともに呼び出し
          ます。

          *note Thread: 427. に渡される '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(): 15a3. を呼ばれたスレッドが正常終了あるいは処理されない
          例外によって終了するか、オプションのタイムアウトが発生するまで
          、メソッドの呼び出し元のスレッドをブロックします。

          When the 'timeout' argument is present and not ‘None’, it
          should be a real number specifying a timeout for the operation
          in seconds (or fractions thereof).  As ‘join()’ always returns
          ‘None’, you must call *note is_alive(): d1c. 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(): 15a3. を呼び出そうとする
          と、デッドロックを引き起こすため *note RuntimeError: 317. が送
          出されます。 スレッドが開始される前に ‘join()’ を呼び出すこと
          も同様のエラーのため、同じ例外が送出されます。

          If an attempt is made to join a running daemonic thread in
          late stages of *note Python finalization: 1ab. ‘join()’ raises
          a *note PythonFinalizationError: 691.

          バージョン 3.14 で変更: May raise *note
          PythonFinalizationError: 691.

          バージョン 3.15 で変更: Accepts any real number as 'timeout',
          not only integer or float.

      -- の属性: 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: 345. に対する非推奨 getter/setter API; 代わりにプ
          ロパティを直接使用してください。

          バージョン 3.10 で非推奨.

      -- の属性: ident

          'スレッド識別子' 、または、スレッドが開始されていなければ
          ‘None’ です。非ゼロの整数です。 *note get_ident(): 151a. 関数
          を参照下さい。スレッド識別子は、スレッドが終了した後、新たなス
          レッドが生成された場合、再利用され得ます。スレッド識別子は、ス
          レッドが終了した後でも利用できます。

      -- の属性: 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():
          e05. 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: 234c.: Windows, FreeBSD, Linux, macOS,
          OpenBSD, NetBSD, AIX, DragonFlyBSD.

          Added in version 3.8.

      -- メソッド: is_alive ()

          スレッドが生存中かどうかを返します。

          このメソッドは、 *note run(): e04. メソッドが起動する直前から
          ‘run()’ メソッドが終了する直後までの間 ‘True’ を返します。モジ
          ュール関数 *note enumerate(): 1e70. は、全ての生存中のスレッド
          のリストを返します。

      -- の属性: daemon

          このスレッドがデーモンスレッドか (‘True’) か否か (‘False’) を
          示すブール値。この値は *note start(): 429. の呼び出し前に設定
          されなければなりません。さもなければ *note RuntimeError: 317.
          が送出されます。初期値は生成側のスレッドから継承されます; メイ
          ンスレッドはデーモンスレッドではないので、メインスレッドで作成
          されたすべてのスレッドは、デフォルトで *note daemon: 343. =
          ‘False’ になります。

          デーモンでない生存中のスレッドが全てなくなると、 Python プログ
          ラム全体が終了します。

      -- メソッド: isDaemon ()
      -- メソッド: setDaemon ()

          *note daemon: 343. に対する非推奨 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(): a8c. と *note release(): 167c. があります。ロック
の状態がアンロックである場合、 ‘acquire()’ は状態をロックに変更して即座
に処理を戻します。 状態がロックの場合、 ‘acquire()’ は他のスレッドが
‘release()’ を呼び出してロックの状態をアンロックに変更するまでブロックし
ます。その後、 ‘acquire()’ 呼び出しは状態を再度ロックに設定してから処理
を戻します。 ‘release()’ メソッドを呼び出すのはロック状態のときでなけれ
ばなりません; このメソッドはロックの状態をアンロックに変更して、即座に処
理を戻します。 アンロックの状態のロックを解放しようとすると *note
RuntimeError: 317. が送出されます。

ロックは *note コンテキストマネージメントプロトコル: 3882. もサポートし
ます。

複数のスレッドにおいて *note acquire(): a8c. がアンロック状態への遷移を
待っているためにブロックが起きている時に *note release(): 167c. を呼び出
してロックの状態をアンロックにすると、一つのスレッドだけが処理を進行でき
ます。 どのスレッドが処理を進行できるのかは定義されておらず、実装によっ
て異なるかもしれません。

全てのメソッドはアトミックに実行されます。

 -- クラス: 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 '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.

          バージョン 3.15 で変更: Accepts any real number as 'timeout',
          not only integer or float.

      -- メソッド: release ()

          ロックを解放します。これはロックを獲得したスレッドだけでなく、
          任意のスレッドから呼ぶことができます。

          ロックの状態がロックのとき、状態をアンロックにリセットして処理
          を戻します。他のスレッドがロックがアンロック状態になるのを待っ
          てブロックしている場合、ただ一つのスレッドだけが処理を継続でき
          るようにします。

          アンロック状態のロックに対して呼び出された場合、*note
          RuntimeError: 317. が送出されます。

          戻り値はありません。

      -- メソッド: 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(): 122f. method to lock it, and its
*note release(): 167c. method to unlock it.

     注釈: Reentrant locks support the *note context management
     protocol: 3882, so it is recommended to use *note with: 215.
     instead of manually calling *note acquire(): 122f. and *note
     release(): 3886. to handle acquiring and releasing the lock for a
     block of code.

RLock's *note acquire(): 122f./*note release(): 3886. call pairs may be
nested, unlike Lock's *note acquire(): a8c./*note release(): 167c.  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(): 122f./*note release(): 3886. 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: 3882.

               Recommended over manual ‘acquire()’ and *note release():
               3886. 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 value.

                  * If the same thread owns the lock, acquire the lock
                    again, and return immediately.  This is the
                    difference between *note Lock: 1a30. 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():
          3886. as many times may lead to deadlock.  Consider using
          ‘RLock’ as a context manager rather than calling
          acquire/release directly.

          バージョン 3.2 で変更: 新しい 'timeout' 引数。

          バージョン 3.15 で変更: Accepts any real number as 'timeout',
          not only integer or float.

      -- メソッド: release ()

          再帰レベルをデクリメントしてロックを解放します。デクリメント後
          に再帰レベルがゼロになった場合、ロックの状態をアンロック (いか
          なるスレッドにも所有されていない状態) にリセットし、ロックの状
          態がアンロックになるのを待ってブロックしているスレッドがある場
          合にはその中のただ一つだけが処理を進行できるようにします。デク
          リメント後も再帰レベルがゼロでない場合、ロックの状態はロックの
          ままで、呼び出し側のスレッドに所有されたままになります。

          Only call this method when the calling thread owns the lock.
          A *note RuntimeError: 317. 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 コンテキスト管理プロトコル: 3882. に従います: ‘with’ 文
を使って囲まれたブロックの間だけ関連付けられたロックを獲得することができ
ます。 *note acquire(): 3889. メソッドと *note release(): 388a. メソッド
は、さらに関連付けられたロックの対応するメソッドを呼び出します。

他のメソッドは、関連付けられたロックを保持した状態で呼び出さなければなり
ません。 *note wait(): 1e7c. メソッドはロックを解放します。そして別のス
レッドが *note notify(): 1d83. または *note notify_all(): 340. を呼ぶこ
とによってスレッドを起こすまでブロックします。一旦起こされたなら、
‘wait()’ は再びロックを得て戻ります。タイムアウトを指定することも可能で
す。

*note notify(): 1d83. メソッドは条件変数待ちのスレッドを1つ起こします。
*note notify_all(): 340. メソッドは条件変数待ちの全てのスレッドを起こし
ます。

注意: *note notify(): 1d83. と *note notify_all(): 340. はロックを解放し
ません; 従って、スレッドが起こされたとき、 *note wait(): 1e7c. の呼び出
しは即座に処理を戻すわけではなく、 ‘notify()’ または ‘notify_all()’ を呼
び出したスレッドが最終的にロックの所有権を放棄したときに初めて処理を返す
のです。

条件変数を使う典型的なプログラミングスタイルでは、何らかの共有された状態
変数へのアクセスを同期させるためにロックを使います; 状態変数が特定の状態
に変化したことを知りたいスレッドは、自分の望む状態になるまで繰り返し
*note wait(): 1e7c. を呼び出します。その一方で、状態変更を行うスレッドは
、前者のスレッドが待ち望んでいる状態であるかもしれないような状態へ変更を
行ったときに *note notify(): 1d83. や *note notify_all(): 340. を呼び出
します。例えば、以下のコードは無制限のバッファ容量のときの一般的な生産者
-消費者問題です:

     # 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(): 1e7c. が任意の長時間の後で返り、 *note notify(): 1d83.
呼び出しを促した条件がもはや真でないことがありえるからです。これはマルチ
スレッドプログラミングに固有です。条件チェックを自動化するために *note
wait_for(): 388b. メソッドを使うことができ、それはタイムアウトの計算を簡
略化します:

     # Consume an item
     with cv:
         cv.wait_for(an_item_is_available)
         get_an_available_item()

*note notify(): 1d83. と *note notify_all(): 340. のどちらを使うかは、そ
の状態の変化に興味を持っている待ちスレッドが一つだけなのか、あるいは複数
なのかで考えます。例えば、典型的な生産者-消費者問題では、バッファに1つの
要素を加えた場合には消費者スレッドを 1 つしか起こさなくてかまいません。

 -- クラス: threading.Condition (lock=None)

     このクラスは条件変数 (condition variable) オブジェクトを実装します
     。条件変数を使うと、1つ以上のスレッドを別のスレッドの通知があるまで
     待機させておけます。

     'lock' に ‘None’ でない値を指定した場合、その値は *note Lock: 1a30.
     または *note RLock: 2eb. オブジェクトでなければなりません。 この場
     合、 '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: 317. が送出されます。

          このメソッドは根底にあるロックを解放し、他のスレッドが同じ条件
          変数に対して *note notify(): 1d83. または *note notify_all():
          340. を呼び出して現在のスレッドを起こすか、オプションのタイム
          アウトが発生するまでブロックします。一度スレッドが起こされると
          、再度ロックを獲得して処理を戻します。

          When the 'timeout' argument is present and not ‘None’, it
          should be a real number specifying a timeout for the operation
          in seconds (or fractions thereof).

          根底にあるロックが *note RLock: 2eb. である場合、 *note
          release(): 388a. メソッドではロックは解放されません。というの
          も、ロックが再帰的に複数回獲得されている場合には、 ‘release()’
          によって実際にアンロックが行われないかもしれないからです。その
          代わり、ロックが再帰的に複数回獲得されていても確実にアンロック
          を行える ‘RLock’ クラスの内部インターフェースを使います。その
          後ロックを再獲得する時に、もう一つの内部インターフェースを使っ
          てロックの再帰レベルを復帰します。

          与えられた 'timeout' が過ぎていなければ返り値は ‘True’ です。
          タイムアウトした場合には ‘False’ が返ります。

          バージョン 3.2 で変更: 以前は、このメソッドは常に ‘None’ を返
          していました。

      -- メソッド: wait_for (predicate, timeout=None)

          条件が真と判定されるまで待ちます。 'predicate' は呼び出し可能
          オブジェクトでなければならず、その結果はブール値として解釈され
          ます。 最大の待ち時間を指定する 'timeout' を与えることができま
          す。

          このユーティリティメソッドは、述語が満たされるかタイムアウトが
          発生するまで *note wait(): 1e7c. を繰り返し呼び出す場合があり
          ます。戻り値は述語の最後の戻り値で、もしメソッドがタイムアウト
          すれば、 ‘False’ と評価されます。

          タイムアウト機能を無視すれば、このメソッドの呼び出しは以下のよ
          うに書くのとほぼ等価です:

               while not predicate():
                   cv.wait()

          したがって、 *note wait(): 1e7c. と同じルールが適用されます: 呼
          び出された時にロックを保持していなければならず、戻るときにロッ
          クが再度獲得されます。述語はロックを保持した状態で評価されます
          。

          Added in version 3.2.

      -- メソッド: notify (n=1)

          デフォルトで、この条件変数を待っている1つのスレッドを起こしま
          す。 呼び出し側のスレッドがロックを獲得していないときにこのメ
          ソッドを呼び出すと *note RuntimeError: 317. が送出されます。

          何らかの待機中スレッドがある場合、そのうち 'n' スレッドを起こ
          します。待機中のスレッドがなければ何もしません。

          現在の実装では、少なくとも 'n' スレッドが待機中であれば、ちょ
          うど 'n' スレッドを起こします。とはいえ、この挙動に依存するの
          は安全ではありません。将来、実装の最適化によって、複数のスレッ
          ドを起こすようになるかもしれないからです。

          注意: 起こされたスレッドは実際にロックを再獲得できるまで *note
          wait(): 1e7c. 呼び出しから戻りません。 *note notify(): 1d83. は
          ロックを解放しないので、 ‘notify()’ 呼び出し側は明示的にロック
          を解放しなければなりません。

      -- メソッド: notify_all ()

          この条件を待っているすべてのスレッドを起こします。このメソッド
          は *note notify(): 1d83. のように動作しますが、 1 つではなくす
          べての待ちスレッドを起こします。呼び出し側のスレッドがロックを
          獲得していない場合、 *note RuntimeError: 317. が送出されます。

          関数''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(): 160d. と *note release(): 388f. の代わりに ‘P()’
と ‘V()’ を使いました)。

セマフォは *note acquire(): 160d. でデクリメントされ *note release():
388f. でインクリメントされるような内部カウンタを管理します。 カウンタは
決してゼロより小さくはなりません; ‘acquire()’ は、カウンタがゼロになって
いる場合、他のスレッドが ‘release()’ を呼び出すまでブロックします。

セマフォは *note コンテキストマネージメントプロトコル: 3882. もサポート
します。

 -- クラス: threading.Semaphore (value=1)

     このクラスはセマフォ (semaphore) オブジェクトを実装します。セマフォ
     は、 *note release(): 388f. を呼び出した数から *note acquire():
     160d. を呼び出した数を引き、初期値を足した値を表す極小のカウンタを
     管理します。 ‘acquire()’ メソッドは、カウンタの値を負にせずに処理を
     戻せるまで必要ならば処理をブロックします。 'value' を指定しない場合
     、デフォルトの値は 1 になります。

     オプションの引数には、内部カウンタの初期値を指定します。デフォルト
     は ‘1’ です。与えられた 'value' が 0 より小さい場合、 *note
     ValueError: 15a. が送出されます。

     バージョン 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(): 388f.  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' 引数。

          バージョン 3.15 で変更: Accepts any real number as 'timeout',
          not only integer or float.

      -- メソッド: release (n=1)

          内部カウンタを 'n' インクリメントして、セマフォを解放します。
          ‘release()’ 処理に入ったときにカウンタがゼロであり、カウンタの
          値がゼロより大きくなるのを待っている別のスレッドがあった場合、
          それらのスレッドから 'n' 個を起こします。

          バージョン 3.9 で変更: 複数の待機中のスレッドを一度に解放する
          'n' パラメータを追加しました。

 -- クラス: threading.BoundedSemaphore (value=1)

     有限セマフォ (bounded semaphore) オブジェクトを実装しているクラスで
     す。有限セマフォは、現在の値が初期値を超過しないようチェックを行い
     ます。超過を起こした場合、 *note ValueError: 15a. を送出します。た
     いていの場合、セマフォは限られた容量のリソースを保護するために使わ
     れるものです。従って、あまりにも頻繁なセマフォの解放はバグが生じて
     いるしるしです。 '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():
3894. メソッドで値を true に、 *note clear(): 3895. メソッドで値を false
にリセットします。 *note wait(): 16e0. メソッドはフラグが true になるま
でブロックします。

 -- クラス: threading.Event

     イベントオブジェクトを実装しているクラスです。イベントは *note
     set(): 3894. メソッドを使うと *note True: fd0. に、 *note clear():
     3895. メソッドを使うと *note False: ef9. にセットされるようなフラグ
     を管理します。 *note wait(): 16e0. メソッドは、全てのフラグが true
     になるまでブロックするようになっています。フラグの初期値は false で
     す。

     バージョン 3.3 で変更: ファクトリ関数からクラスに変更されました。

      -- メソッド: is_set ()

          内部フラグが真のとき ‘True’ を返します。

          メソッド ‘isSet’ はこのメソッドの非推奨エイリアスです。

      -- メソッド: set ()

          内部フラグの値を true にセットします。フラグの値が true になる
          のを待っている全てのスレッドを起こします。一旦フラグが true に
          なると、スレッドが *note wait(): 16e0. を呼び出しても全くブロ
          ックしなくなります。

      -- メソッド: clear ()

          内部フラグの値を false にリセットします。以降は、 *note set():
          3894. を呼び出して再び内部フラグの値を true にセットするまで、
          *note wait(): 16e0. を呼び出したスレッドはブロックするようにな
          ります。

      -- メソッド: 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 real 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: 1519. は *note Thread: 427. のサブクラスであり、自作
のスレッドを構築した一例でもあります。

Timers are started, as with threads, by calling their *note Timer.start:
429. method.  The timer can be stopped (before its action has begun) by
calling the *note cancel(): 3898. 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(): 389a.
メソッドを呼ぶことによりバリアを通ろうとしてブロックします。すべてのスレ
ッドがそれぞれの ‘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(): 389a. メソッドに対して 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: 15a4. 例外を送
          出するかもしれません。

      -- メソッド: reset ()

          バリアをデフォルトの空の状態に戻します。そのバリアの上で待って
          いるすべてのスレッドは *note BrokenBarrierError: 15a4. 例外を
          受け取ります。

          状態が未知の他のスレッドがある場合、この関数を使用するのに何ら
          かの外部同期を必要とするかもしれないことに注意してください。バ
          リアが broken な場合、単にそれをそのままにして新しいものを作成
          する方がよいでしょう。

      -- メソッド: abort ()

          バリアを broken な状態にします。これによって、現在または将来の
          *note wait(): 389a. 呼び出しが *note BrokenBarrierError: 15a4.
          とともに失敗するようになります。これを使うと、例えばスレッドが
          異常終了する必要がある場合にアプリケーションがデッドロックする
          のを避けることができます。

          スレッドのうちの1つが返ってこないことに対して自動的に保護する
          ように、単純に常識的な 'timeout' 値でバリアを作成することは望
          ましいかもしれません。

      -- の属性: parties

          バリアを通るために要求されるスレッドの数。

      -- の属性: n_waiting

          現在バリアの中で待っているスレッドの数。

      -- の属性: broken

          バリアが broken な状態である場合に ‘True’ となるブール値。

 -- 例外: threading.BrokenBarrierError

     *note Barrier: 15a2. オブジェクトがリセットされるか broken な場合に
     、この例外 (*note RuntimeError: 317. のサブクラス) が送出されます。


File: python.info,  Node: with 文でのロック・条件変数・セマフォの使い方,  Next: Iterator synchronization,  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: 215.
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: 1a30. 、 *note RLock: 2eb. 、 *note
Condition: 1515. 、 *note Semaphore: 1516. 、 *note BoundedSemaphore:
1517. を *note with: 215. 文のコンテキストマネージャとして使うことができ
ます。


File: python.info,  Node: Iterator synchronization,  Prev: with 文でのロック・条件変数・セマフォの使い方,  Up: threading --- スレッドベースの並列処理

5.19.1.15 Iterator synchronization
..................................

By default, Python iterators do not support concurrent access.  Most
iterators make no guarantees when accessed simultaneously from multiple
threads.  Generator iterators, for example, raise *note ValueError: 15a.
if one of their iterator methods is called while the generator is
already executing.  The tools in this section allow reliable concurrency
support to be added to ordinary iterators and iterator-producing
callables.

The *note serialize_iterator: 28a. wrapper lets multiple threads share a
single iterator and take turns consuming from it.  While one thread is
running ‘__next__()’, the others block until the iterator becomes
available.  Each value produced by the underlying iterator is delivered
to exactly one caller.

The *note concurrent_tee(): 28c. function lets multiple threads each
receive the full stream of values from one underlying iterator.  It
creates independent iterators that all draw from the same source.
Values are buffered until consumed by all of the derived iterators.

 -- クラス: threading.serialize_iterator (iterable)

     Return an iterator wrapper that serializes concurrent calls to
     *note __next__(): 1687. using a lock.

     If the wrapped iterator also defines *note send(): 1418, *note
     throw(): 90a, or *note close(): 19bf, those calls are serialized as
     well.

     This makes it possible to share a single iterator, including a
     generator iterator, between multiple threads.  A lock ensures that
     calls are handled one at a time.  No values are duplicated or
     skipped by the wrapper itself.  Each item from the underlying
     iterator is given to exactly one caller.

     This wrapper does not copy or buffer values.  Threads that call
     *note next(): bb9. while another thread is already advancing the
     iterator will block until the active call completes.

     例:

          import threading

          def squares(n):
              for x in range(n):
                  yield x * x

          def consume(name, iterable):
              for item in iterable:
                  print(name, item)

          source = threading.serialize_iterator(squares(5))

          t1 = threading.Thread(target=consume, args=("left", source))
          t2 = threading.Thread(target=consume, args=("right", source))
          t1.start()
          t2.start()
          t1.join()
          t2.join()

     In this example, each number is printed exactly once, but the work
     is shared between the two threads.

     Added in version 3.15.

 -- の関数: threading.synchronized_iterator (func)

     Wrap an iterator-producing callable so that each iterator it
     returns is automatically passed through *note serialize_iterator:
     28a.

     This is especially useful as a *note decorator: b1d. for generator
     functions, allowing their generator-iterators to be consumed from
     multiple threads.

     例:

          import threading

          @threading.synchronized_iterator
          def squares(n):
              for x in range(n):
                  yield x * x

          def consume(name, iterable):
              for item in iterable:
                  print(name, item)

          source = squares(5)

          t1 = threading.Thread(target=consume, args=("left", source))
          t2 = threading.Thread(target=consume, args=("right", source))
          t1.start()
          t2.start()
          t1.join()
          t2.join()

     The returned wrapper preserves the metadata of 'func', such as its
     name and wrapped function reference.

     Added in version 3.15.

 -- の関数: threading.concurrent_tee (iterable, n=2)

     Return 'n' independent iterators from a single input 'iterable',
     with guaranteed behavior when the derived iterators are consumed
     concurrently.

     This function is similar to *note itertools.tee(): 2dd8, but is
     intended for cases where the source iterator may feed consumers
     running in different threads.  Each returned iterator yields every
     value from the underlying iterable, in the same order.

     Internally, values are buffered until every derived iterator has
     consumed them.

     The returned iterators share the same underlying synchronization
     lock.  Each individual derived iterator is intended to be consumed
     by one thread at a time.  If a single derived iterator must itself
     be shared by multiple threads, wrap it with *note
     serialize_iterator: 28a.

     If 'n' is ‘0’, return an empty tuple.  If 'n' is negative, raise
     *note ValueError: 15a.

     例:

          import threading

          def squares(n):
              for x in range(n):
                  yield x * x

          def consume(name, iterable):
              for item in iterable:
                  print(name, item)

          source = squares(5)
          left, right = threading.concurrent_tee(source)

          t1 = threading.Thread(target=consume, args=("left", left))
          t2 = threading.Thread(target=consume, args=("right", right))
          t1.start()
          t2.start()
          t1.join()
          t2.join()

     In this example, both consumer threads see the full sequence of
     squares from a single generator expression.

     Added in version 3.15.


File: python.info,  Node: multiprocessing --- プロセスベースの並列処理,  Next: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ,  Prev: threading --- スレッドベースの並列処理,  Up: 並行実行

5.19.2 ‘multiprocessing’ -- プロセスベースの並列処理
----------------------------------------------------

'ソースコード:' Lib/multiprocessing/(1)

__________________________________________________________________

*note Availability: 234c.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 246c. と *note
WebAssemblyプラットフォーム: 1d86. をサポートしません。

* Menu:

* はじめに: はじめに<9>.
* リファレンス: リファレンス<3>.
* プログラミングガイドライン::
* 使用例: 使用例<21>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: f6. module.  The ‘multiprocessing’
package offers both local and remote concurrency, effectively
side-stepping the *note Global Interpreter Lock: 68c. 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: 131a.
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: f6. module, like the ability to *note
terminate: 1a9f, *note interrupt: 4e4. or *note kill: f19. a running
process.

参考
....

*note concurrent.futures.ProcessPoolExecutor: 211. 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:
131a. 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:
4e5. object and then calling its *note start(): 174a. method.  ‘Process’
follows the API of *note threading.Thread: 427.  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
プログラミングガイドライン: 38a7. を参照してください。

The arguments to *note Process: 4e5. 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:
1b4. 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(): 38a9. メソッ
          ドの実行に必要なリソースのみ継承します。特に、親プロセスからの
          不要なファイル記述子とハンドルは継承されません。この方式を使用
          したプロセスの開始は 'fork' や 'forkserver' に比べ遅くなります
          。

          Available on POSIX and Windows platforms.  The default on
          Windows and macOS.

     'fork'

          親プロセスは *note os.fork(): 6c3. を使用して 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(): 4dd. or *note
          set_start_method(): 4de.

          バージョン 3.12 で変更: If Python is able to detect that your
          process has multiple threads, the *note os.fork(): 6c3.
          function that this start method calls internally will raise a
          *note DeprecationWarning: 2d4.  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(): 6c3.  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: 1c00.
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(): 4de. によって指定します。以下に例を示します:

     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(): 4de. はプログラム内で複数回使用してはいけ
ません。

もうひとつの方法として、*note get_context(): 4dd. を使用してコンテキスト
オブジェクトを取得することができます。コンテキストオブジェクトは
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: 211.
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: 1da4. クラスは *note queue.Queue: 174d. クラスとほとん
     ど同じように使うことができます。以下に例を示します:

          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(): 38ab. 関数はパイプで繋がれたコネクションオブジェクト
     のペアを返します。デフォルトでは双方向性パイプを返します。以下に例
     を示します:

          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(): 38ab. 関数から返されます。各コネクションオブジェクトには、
     ‘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: f6.  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: 38ae. クラス、も
     しくは *note Array: 38af. クラスを使用することができます。以下のサ
     ンプルコードを使って、この機能についてみていきましょう

          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(): 4e3. 関数により生成されたマネージャーオブジェクト
     はサーバープロセスを管理します。マネージャーオブジェクトは Python の
     オブジェクトを保持して、他のプロセスがプロキシ経由でその Python オ
     ブジェクトを操作することができます。

     A manager returned by *note Manager(): 4e3. will support types
     *note list: 4e0, *note dict: 193, *note set: 432, *note Namespace:
     38b0, *note Lock: 1a9c, *note RLock: 1a9d, *note Semaphore: 38b1,
     *note BoundedSemaphore: 38b2, *note Condition: 38b3, *note Event:
     1e1c, *note Barrier: 38b4, *note Queue: 1da4, *note Value: 38ae.
     and *note Array: 38af.  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: 131a. クラスは、ワーカープロセスをプールする機能を備えていま
す。このクラスには、異なる方法でワーカープロセスへタスクを割り当てるいく
つかのメソッドがあります。

例えば:

     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 プログラミングガイドライン: 38a7. で触れていますが
     、ここであらためて強調しておきます。なぜかというと、いくつかのサン
     プルコード、例えば *note multiprocessing.pool.Pool: 131a. のサンプ
     ルはインタラクティブシェル上では動作しないからです。以下に例を示し
     ます:

          >>> 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: f6. 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:
     4e5. クラスは *note threading.Thread: 427. クラスのすべてのメソッド
     と同じインターフェースを提供します。

     The constructor should always be called with keyword arguments.
     'group' should always be ‘None’; it exists solely for compatibility
     with *note threading.Thread: 427.  'target' is the callable object
     to be invoked by the *note run(): 38a9. method.  It defaults to
     ‘None’, meaning nothing is called.  'name' is the process name (see
     *note name: 38ba. 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: 38bb. 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: 211. 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: 1b4. 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 の場合: 38bc.
          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 コンテキストと開始方式: 474.  See
          also gh-132898(1).

     バージョン 3.3 で変更: Added the 'daemon' parameter.

      -- メソッド: run ()

          プロセスが実行する処理を表すメソッドです。

          このメソッドはサブクラスでオーバーライドすることができます。標
          準の *note run(): 38a9. メソッドは、コンストラクターの target
          引数として渡された呼び出し可能オブジェクトを呼び出します。もし
          コンストラクターに 'args' もしくは 'kwargs' 引数が渡されていれ
          ば、呼び出すオブジェクトにこれらの引数を渡します。

          *note Process: 4e5. に渡される '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(): 38a9.
          メソッドを呼び出す準備を行います。

      -- メソッド: join ([timeout])

          オプションの引数 'timeout' が ‘None’ (デフォルト) の場合、
          *note join(): 174c. メソッドが呼ばれたプロセスは処理が終了する
          までブロックします。 'timeout' が正の数である場合、最大
          'timeout' 秒ブロックします。 プロセスが終了あるいはタイムアウ
          トした場合、メソッドは ‘None’ を返すことに注意してください。 プ
          ロセスの *note exitcode: 38bd. を確認し終了したかどうかを判断
          してください。

          1つのプロセスは何回も join されることができます。

          プロセスは自分自身を join することはできません。それはデッドロ
          ックを引き起こすことがあるからです。プロセスが start される前
          に join しようとするとエラーが発生します。

      -- の属性: name

          プロセスの名前。名前は識別のためだけに使用される文字列です。そ
          れ自体には特別な意味はありません。複数のプロセスに同じ名前が与
          えられても構いません。

          最初の名前はコンストラクターによってセットされます。コンストラ
          クターに明示的な名前が渡されない場合、
          'Process-N[1]:N[2]:...:N[k]' 形式の名前が構築されます。ここで
          それぞれの N[k] はその親のN番目の子供です。

      -- メソッド: is_alive ()

          プロセスが実行中かを判別します。

          おおまかに言って、プロセスオブジェクトは *note start(): 174a.
          メソッドを呼び出してから子プロセス終了までの期間が実行中となり
          ます。

      -- の属性: daemon

          デーモンプロセスであるかのフラグであり、ブール値です。この属性
          は *note start(): 174a. が呼び出される前に設定されている必要が
          あります。

          初期値は作成するプロセスから継承します。

          あるプロセスが終了するとき、そのプロセスはその子プロセスである
          デーモンプロセスすべてを終了させようとします。

          デーモンプロセスは子プロセスを作成できないことに注意してくださ
          い。もし作成できてしまうと、そのデーモンプロセスの親プロセスが
          終了したときにデーモンプロセスの子プロセスが孤児になってしまう
          場合があるからです。さらに言えば、デーモンプロセスはUnix デー
          モンやサービスでは 'なく' 通常のプロセスであり、非デーモンプロ
          セスが終了すると終了されます (そして join されません)。

     *note threading.Thread: 427. クラスの API に加えて *note Process:
     4e5. クラスのオブジェクトには以下の属性およびメソッドがあります:

      -- の属性: 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(): 38a9. method returned normally,
          the exit code will be 0.  If it terminated via *note
          sys.exit(): 506. with an integer argument 'N', the exit code
          will be 'N'.

          If the child terminated due to an exception not caught within
          *note run(): 38a9, 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(): 936.

          *note Process: 4e5. クラスのオブジェクトの作成時にその親プロセ
          スから認証キーを継承します。もしくは *note authkey: 38bf. に別
          のバイト文字列を設定することもできます。

          詳細は *note 認証キー: 38c0. を参照してください。

      -- の属性: sentinel

          プロセスが終了するときに "ready" となるシステムオブジェクトの
          数値ハンドル。

          You can use this value if you want to wait on several events
          at once using *note multiprocessing.connection.wait(): 14a0.
          Otherwise calling *note join(): 174c. 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: c9. module.

          Added in version 3.3.

      -- メソッド: interrupt ()

          Terminate the process.  Works on POSIX using the *note SIGINT:
          4e6. signal.  Behavior on Windows is undefined.

          By default, this terminates the child process by raising *note
          KeyboardInterrupt: d9a.  This behavior can be altered by
          setting the respective signal handler in the child process
          *note signal.signal(): 14f5. for *note SIGINT: 4e6.

          Note: if the child process catches and discards *note
          KeyboardInterrupt: d9a, the process will not be terminated.

          Note: the default behavior will also set *note exitcode: 38bd.
          to ‘1’ as if an uncaught exception was raised in the child
          process.  To have a different ‘exitcode’ you may simply catch
          *note KeyboardInterrupt: d9a. and call ‘exit(your_code)’.

          Added in version 3.14.

      -- メソッド: terminate ()

          Terminate the process.  On POSIX this is done using the *note
          SIGTERM: 1798. signal; on Windows ‘TerminateProcess()’ is
          used.  Note that exit handlers and finally clauses, etc., will
          not be executed.

          このメソッドにより終了するプロセスの子孫プロセスは、終了 'しま
          せん' 。そういった子孫プロセスは単純に孤児になります。

               警告: このメソッドの使用時に、関連付けられたプロセスがパ
               イプやキューを使用している場合には、使用中のパイプやキュ
               ーが破損して他のプロセスから使用できなくなる可能性があり
               ます。同様に、プロセスがロックやセマフォなどを取得してい
               る場合には、このプロセスが終了してしまうと他のプロセスの
               デッドロックの原因になるでしょう。

      -- メソッド: kill ()

          Same as *note terminate(): 1a9f. but using the ‘SIGKILL’
          signal on POSIX.

          Added in version 3.7.

      -- メソッド: close ()

          *note Process: 4e5. オブジェクトを閉じ、関連付けられていたすべ
          てのリソースを開放します。中のプロセスが実行中であった場合、
          *note ValueError: 15a. を送出します。*note close(): f18. が成
          功した場合、‘Process’ オブジェクトの他のメソッドや属性は、ほと
          んどが ‘ValueError’ を送出します。

          Added in version 3.7.

     プロセスオブジェクトが作成したプロセスのみが *note start(): 174a,
     *note join(): 174c, *note is_alive(): 174b, *note terminate():
     1a9f. と *note exitcode: 38bd. のメソッドを呼び出すべきです。

     以下の例では *note Process: 4e5. のメソッドの使い方を示しています:

          >>> 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: 38c2. のインスタンスであるとすると、
     ‘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(): 38ab. (2つのプロセス間の通信
用)、もしくはキュー (複数のメッセージ生成プロセス (producer)、消費プロセ
ス (consumer) の実現用) を使うことができます。

*note Queue: 1da4, *note SimpleQueue: ce7. と *note JoinableQueue: 38c6.
型は複数プロセスから生成/消費を行う FIFO キューです。これらのキューは標
準ライブラリの *note queue.Queue: 174d. を模倣しています。 ‘Queue’ には
Python 2.5 の ‘queue.Queue’ クラスで導入された *note task_done(): 38c7.
と *note join(): 38c8. メソッドがないことが違う点です。

もし *note JoinableQueue: 38c6. を使用するなら、キューから削除される各タ
スクのために *note JoinableQueue.task_done(): 38c9. を呼び出さなければ
'なりません' 。さもないと、いつか完了していないタスクを数えるためのセマ
フォがオーバーフローし、例外を発生させるでしょう。

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 マネージャー: 38ca. を参照してください。

     注釈: ‘multiprocessing’ uses the usual *note queue.Empty: 38cb. and
     *note queue.Full: 38cc. exceptions to signal a timeout.  They are
     not available in the ‘multiprocessing’ namespace so you need to
     import them from *note queue: be.

     注釈: オブジェクトがキューに追加される際、そのオブジェクトは pickle
     化されています。そのため、バックグラウンドのスレッドが後になって下
     位層のパイプに pickle 化されたデータをフラッシュすることがあります
     。これにより、少し驚くような結果になりますが、実際に問題になること
     はないはずです。これが問題になるような状況では、かわりに *note
     manager: 38ca. を使ってキューを作成することができるからです。

       1. 空のキューの中にオブジェクトを追加した後、キューの *note
          empty(): 1b9a. メソッドが *note False: ef9. を返すまでの間にご
          くわずかな遅延が起きることがあり、*note get_nowait(): 38cd. が
          *note queue.Empty: 38cb. を発生させることなく制御が呼び出し元
          に返ってしまうことがあります。

       2. 複数のプロセスがオブジェクトをキューに詰めている場合、キューの
          反対側ではオブジェクトが詰められたのとは違う順序で取得される可
          能性があります。ただし、同一のプロセスから詰め込まれたオブジェ
          クトは、それらのオブジェクト間では、必ず期待どおりの順序になり
          ます。

     警告: *note Queue: 1da4. を利用しようとしている最中にプロセスを
     *note Process.terminate(): 1a9f. や *note os.kill(): 1721. で終了さ
     せる場合、キューにあるデータは破損し易くなります。終了した後で他の
     プロセスがキューを利用しようとすると、例外を発生させる可能性があり
     ます。

     警告: 上述したように、もし子プロセスがキューへ要素を追加するなら (か
     つ *note JoinableQueue.cancel_join_thread: 38ce. を使用しないなら)
     そのプロセスはバッファーされたすべての要素がパイプへフラッシュされ
     るまで終了しません。

     これは、そのプロセスを join しようとする場合、キューに追加されたす
     べての要素が消費されたことが確実でないかぎり、デッドロックを発生さ
     せる可能性があることを意味します。似たような現象で、子プロセスが非
     デーモンプロセスの場合、親プロセスは終了時に非デーモンのすべての子
     プロセスを join しようとしてハングアップする可能性があります。

     マネージャーを使用して作成されたキューではこの問題はありません。詳
     細は *note プログラミングガイドライン: 38a7. を参照してください。

プロセス間通信におけるキューの使用例を知りたいなら *note 使用例: 38cf. を
参照してください。

 -- の関数: multiprocessing.Pipe (duplex=True)

     パイプの両端を表す *note Connection: 14a1. オブジェクトのペア
     ‘(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: 38b7. for more details.

     標準ライブラリの *note queue: be. モジュールの通常の *note
     queue.Empty: 38cb. や *note queue.Full: 38cc. 例外がタイムアウトを
     伝えるために送出されます。

     *note Queue: 1da4. implements all the methods of *note queue.Queue:
     174d. except for *note task_done(): 38c7, *note join(): 38c8, and
     *note shutdown(): 74a.

      -- メソッド: qsize ()

          おおよそのキューのサイズを返します。マルチスレッディング/マル
          チプロセスの特性上、この数値は信用できません。

          Note that this may raise *note NotImplementedError: 5a1. on
          platforms like macOS where ‘sem_getvalue()’ is not
          implemented.

      -- メソッド: empty ()

          キューが空っぽなら ‘True’ を、そうでなければ ‘False’ を返しま
          す。マルチスレッディング/マルチプロセシングの特性上、これは信
          用できません。

          May raise an *note OSError: 543. on closed queues.  (not
          guaranteed)

      -- メソッド: full ()

          キューがいっぱいなら ‘True’ を、そうでなければ ‘False’ を返し
          ます。マルチスレッディング/マルチプロセシングの特性上、これは
          信用できません。

      -- メソッド: put (obj[, block[, timeout]])

          キューの中へ obj を追加します。オプションの引数 'block' が
          ‘True’ (デフォルト) 且つ 'timeout' が ‘None’ (デフォルト) なら
          、空きスロットが利用可能になるまで必要であればブロックします。
          'timeout' が正の数なら、最大 'timeout' 秒ブロックして、その時
          間内に空きスロットが利用できなかったら *note queue.Full: 38cc.
          例外を発生させます。それ以外 ('block' が ‘False’) で、空きスロ
          ットがすぐに利用可能な場合はキューに要素を追加します。そうでな
          ければ ‘queue.Full’ 例外が発生します(その場合 'timeout' は無視
          されます)。

          バージョン 3.8 で変更: If the queue is closed, *note
          ValueError: 15a. is raised instead of *note AssertionError:
          a9c.

      -- メソッド: put_nowait (obj)

          ‘put(obj, False)’ と等価です。

      -- メソッド: get ([block[, timeout]])

          キューから要素を取り出して削除します。オプションの引数 'block'
          が ‘True’ (デフォルト) 且つ 'timeout' が ‘None’ (デフォルト) な
          ら、要素が取り出せるまで必要であればブロックします。 'timeout'
          が正の数なら、最大 'timeout' 秒ブロックして、その時間内に要素
          が取り出せなかったら *note queue.Empty: 38cb. 例外を発生させま
          す。それ以外 ('block' が ‘False’) で、要素がすぐに取り出せる場
          合は要素を返します。そうでなければ ‘queue.Empty’ 例外が発生し
          ます(その場合 'timeout' は無視されます)。

          バージョン 3.8 で変更: If the queue is closed, *note
          ValueError: 15a. is raised instead of *note OSError: 543.

      -- メソッド: get_nowait ()

          ‘get(False)’ と等価です。

     *note multiprocessing.Queue: 1da4. は *note queue.Queue: 174d. には
     ない追加メソッドがあります。 これらのメソッドは通常、ほとんどのコー
     ドに必要ありません:

      -- メソッド: close ()

          Close the queue: release internal resources.

          A queue must not be used anymore after it is closed.  For
          example, *note get(): 202b, *note put(): 202a. and *note
          empty(): 1b9a. 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(): 1da5. が呼び出された後でのみ使用されます。バッファー
          されたすべてのデータがパイプへフラッシュされるのを保証するため
          、バックグラウンドスレッドが終了するまでブロックします。

          デフォルトでは、あるプロセスがキューを作成していない場合、終了
          時にキューのバックグラウンドスレッドを join しようとします。そ
          のプロセスは *note join_thread(): 38d3. が何もしないように
          *note cancel_join_thread(): 38ce. を呼び出すことができます。

      -- メソッド: cancel_join_thread ()

          *note join_thread(): 38d3. がブロッキングするのを防ぎます。特
          にこれはバックグラウンドスレッドがそのプロセスの終了時に自動的
          に join されるのを防ぎます。詳細は ‘join_thread()’ を参照して
          ください。

          このメソッドは ‘allow_exit_without_flush()’ という名前のほうが
          よかったかもしれません。キューに追加されたデータが失われてしま
          いがちなため、このメソッドを使う必要はほぼ確実にないでしょう。
          本当にこれが必要になるのは、キューに追加されたデータを下位層の
          パイプにフラッシュすることなくカレントプロセスを直ちに終了する
          必要があり、かつ失われるデータに関心がない場合です。

          注釈: このクラスに含まれる機能には、ホストとなるオペレーティン
          グシステム上で動作している共有セマフォ (shared semaphore) を使
          用しているものがあります。これが使用できない場合には、このクラ
          スが無効になり、 *note Queue: 1da4. をインスタンス化する時に
          *note ImportError: 1c8. が発生します。詳細は bpo-3770(1) を参
          照してください。同様のことが、以下に列挙されている特殊なキュー
          でも成り立ちます。

 -- クラス: multiprocessing.SimpleQueue

     単純化された *note Queue: 1da4. 型です。ロックされた *note Pipe:
     38ab. と非常に似ています。

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. 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(): 38d4, *note put(): 38d5. and *note
          empty(): 1b9b. methods must no longer be called.

          Added in version 3.9.

      -- メソッド: empty ()

          キューが空ならば ‘True’ を、そうでなければ ‘False’ を返します
          。

          Always raises an *note OSError: 543. if the SimpleQueue is
          closed.

      -- メソッド: get ()

          キューから要素を削除して返します。

      -- メソッド: put (item)

          'item' をキューに追加します。

 -- クラス: multiprocessing.JoinableQueue ([maxsize])

     *note JoinableQueue: 38c6. は *note Queue: 1da4. のサブクラスであり
     、 *note task_done(): 38c9. や *note join(): 38d6. メソッドが追加さ
     れているキューです。

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. for more details.

      -- メソッド: task_done ()

          以前にキューへ追加されたタスクが完了したことを表します。キュー
          のコンシューマによって使用されます。 タスクをフェッチするため
          に使用されるそれぞれの *note get(): 202b. に対して、 後続の
          *note task_done(): 38c9. 呼び出しはタスクの処理が完了したこと
          をキューへ伝えます。

          もし *note join(): 38c8. がブロッキング状態なら、 すべての要素
          が処理されたときに復帰します( *note task_done(): 38c9. 呼び出
          しが すべての要素からキュー内へ *note put(): 202a. されたと受
          け取ったことを意味します)。

          キューにある要素より多く呼び出された場合 *note ValueError:
          15a. が発生します。

      -- メソッド: join ()

          キューにあるすべてのアイテムが取り出されて処理されるまでブロッ
          クします。

          キューに要素が追加されると未完了タスク数が増えます。コンシュー
          マがキューの要素が取り出されてすべての処理が完了したことを表す
          *note task_done(): 38c9. を呼び出すと数が減ります。 未完了タス
          ク数がゼロになると *note join(): 38c8. はブロッキングを解除し
          ます。

   ---------- 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(): 6e6. (or
     ‘len(os.sched_getaffinity(0))’).

     When the number of CPUs cannot be determined a *note
     NotImplementedError: 5a1. is raised.

     参考
     ....

     *note os.cpu_count(): 6e7. *note os.process_cpu_count(): 6e6.

     バージョン 3.13 で変更: The return value can also be overridden
     using the *note -X cpu_count: 183. flag or *note PYTHON_CPU_COUNT:
     727. as this is merely a wrapper around the *note os: a5. cpu count
     APIs.

 -- の関数: multiprocessing.current_process ()

     カレントプロセスに対応する *note Process: 4e5. オブジェクトを返しま
     す。

     *note threading.current_thread(): 346. とよく似た関数です。

 -- の関数: multiprocessing.parent_process ()

     Return the *note Process: 4e5. object corresponding to the parent
     process of the *note current_process(): 38d9.  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: 317. を発生させます。

     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 コンテキストと開始方式: 474.

     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: 38b7. for more
     details.  Otherwise 'method' should be ‘'fork'’, ‘'spawn'’,
     ‘'forkserver'’.  *note ValueError: 15a. is raised if the specified
     start method is not available.  See *note コンテキストと開始方式:
     474.

     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: 38b7. for more details.

     The return value can be ‘'fork'’, ‘'spawn'’, ‘'forkserver'’ or
     ‘None’.  See *note コンテキストと開始方式: 474.

     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: 3b4. 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: 7a5. を受け入れるよ
     うになりました。

 -- の関数: multiprocessing.set_forkserver_preload (module_names, *,
          on_error='ignore')

     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.  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: 4e5.).

     The 'on_error' parameter controls how *note ImportError: 1c8.
     exceptions during module preloading are handled: ‘"ignore"’
     (default) silently ignores failures, ‘"warn"’ causes the forkserver
     subprocess to emit an *note ImportWarning: 90c. to stderr, and
     ‘"fail"’ causes the forkserver subprocess to exit with the
     exception traceback on stderr, making subsequent process creation
     fail with *note EOFError: 1693. or *note ConnectionError: 11c3.

     Only meaningful when using the ‘'forkserver'’ start method.  See
     *note コンテキストと開始方式: 474.

     Added in version 3.4.

     バージョン 3.15 で変更: Added the 'on_error' parameter.

 -- の関数: 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: 317. 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 コンテキストと開始方式: 474.

     Added in version 3.4.

     注釈: ‘multiprocessing’ contains no analogues of *note
     threading.active_count(): 347, *note threading.enumerate(): 1e70,
     *note threading.settrace(): c24, *note threading.setprofile(): c25,
     *note threading.Timer: 1519, or *note threading.local: 1aa6.

   ---------- 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: 38ab. を使用して作成されます
。 詳細は *note リスナーとクライアント: 38dc. も参照してください。

 -- クラス: multiprocessing.connection.Connection

      -- メソッド: send (obj)

          コネクションの相手側へ *note recv(): 38de. を使用して読み込む
          オブジェクトを送ります。

          オブジェクトは pickle でシリアライズ可能でなければなりません。
          pickle が極端に大きすぎる (OS にも依りますが、およそ 32 MiB+)
          と、 *note ValueError: 15a. 例外が送出されることがあります。

      -- メソッド: recv ()

          コネクションの相手側から *note send(): 38dd. を使用して送られ
          たオブジェクトを返します。 何か受け取るまでブロックします。何
          も受け取らずにコネクションの相手側でクローズされた場合 *note
          EOFError: 1693. が発生します。

      -- メソッド: fileno ()

          コネクションが使用するハンドラーか、ファイル記述子を返します。

      -- メソッド: close ()

          コネクションをクローズします。

          コネクションがガベージコレクトされるときに自動的に呼び出されま
          す。

      -- メソッド: poll ([timeout])

          読み込み可能なデータがあるかどうかを返します。

          'timeout' が指定されていなければすぐに返します。 'timeout' に
          数値を指定すると、最大指定した秒数をブロッキングします。
          'timeout' に ‘None’ を指定するとタイムアウトせずにずっとブロッ
          キングします。

          *note multiprocessing.connection.wait(): 14a0. を使って複数の
          コネクションオブジェクトを同時にポーリングできることに注意して
          ください。

      -- メソッド: send_bytes (buf[, offset[, size]])

          *note bytes-like object: 43d. から完全なメッセージとしてバイト
          データを送ります。

          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: 15a.
          exception

      -- メソッド: recv_bytes ([maxlength])

          コネクションの相手側から送られたバイトデータの完全なメッセージ
          を文字列として返します。何か受け取るまでブロックします。受け取
          るデータが何も残っておらず、相手側がコネクションを閉じていた場
          合、 *note EOFError: 1693. が送出されます。

          'maxlength' を指定していて、かつメッセージが 'maxlength' より
          長い場合、 *note OSError: 543. が発生してコネクションからそれ
          以上読めなくなります。

          バージョン 3.3 で変更: この関数は以前は *note IOError: 1409. を
          送出していました。今では *note OSError: 543. の別名です。

      -- メソッド: 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: 1693. if there is nothing left to
          receive and the other end was closed.

          'buf' must be a writable *note bytes-like object: 43d.  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(): 38dd. と *note
     Connection.recv(): 38de. を使用して Connection オブジェクト自体をプ
     ロセス間で転送できるようになりました。

     Connection objects also now support the context management protocol
     - see *note コンテキストマネージャ型: 2620.  *note __enter__():
     28bc. returns the connection object, and *note __exit__(): 28bd.
     calls *note close(): 38e0.

例えば:

     >>> 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(): 38de. メソッドは受信したデータを自動
     的に unpickle 化します。それはメッセージを送ったプロセスが信頼でき
     る場合を除いてセキュリティリスクになります。

     そのため ‘Pipe()’ を使用してコネクションオブジェクトを生成する場合
     を除いて、何らかの認証処理を実行した後で *note recv(): 38de. や
     *note send(): 38dd. メソッドのみを使用すべきです。詳細は *note
     認証キー: 38c0. を参照してください。

     警告: もしプロセスがパイプの読み込みまたは書き込み中に kill される
     と、メッセージの境界がどこなのか分からなくなってしまうので、そのパ
     イプ内のデータは破損してしまいがちです。


File: python.info,  Node: 同期プリミティブ,  Next: 共有 ctypes オブジェクト,  Prev: Connection オブジェクト<2>,  Up: リファレンス<3>

5.19.2.14 同期プリミティブ
..........................

一般的にマルチプロセスプログラムは、マルチスレッドプログラムほどは同期プ
リミティブを必要としません。詳細は *note threading: f6. モジュールのドキ
ュメントを参照してください。

マネージャーオブジェクトを使用して同期プリミティブを作成できることも覚え
ておいてください。詳細は *note マネージャー: 38ca. を参照してください。

 -- クラス: multiprocessing.Barrier (parties[, action[, timeout]])

     バリアーオブジェクト: *note threading.Barrier: 15a2. のクローンです
     。

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. for more details.

     Added in version 3.3.

 -- クラス: multiprocessing.BoundedSemaphore ([value])

     有限セマフォオブジェクト: *note threading.BoundedSemaphore: 1517. の
     類似物です。

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. for more details.

     よく似た *note threading.BoundedSemaphore: 1517. とは、次の一点だけ
     異なります。 ‘acquire’ メソッドの第一引数名は 'block' で、*note
     Lock.acquire(): 38e7. と一致しています。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

          注釈: macOS では ‘sem_getvalue()’ が実装されていないので *note
          Semaphore: 38b1. と区別がつきません。

 -- クラス: multiprocessing.Condition ([lock])

     状態変数: *note threading.Condition: 1515. の別名です。

     If 'lock' is specified then it should be a *note Lock: 1a9c. or
     *note RLock: 1a9d. object from ‘multiprocessing’.

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. for more details.

     バージョン 3.3 で変更: *note wait_for(): 388b. メソッドが追加されま
     した。

 -- クラス: multiprocessing.Event

     *note threading.Event: 1518. のクローンです。

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. for more details.

 -- クラス: multiprocessing.Lock

     再帰しないロックオブジェクトで、 *note threading.Lock: 1a30. 相当の
     ものです。プロセスやスレッドがロックをいったん獲得 (acquire) すると
     、それに続くほかのプロセスやスレッドが獲得しようとする際、それが解
     放 (release) されるまではブロックされます。解放はどのプロセス、スレ
     ッドからも行えます。スレッドに対して適用される ‘threading.Lock’ の
     コンセプトと振る舞いは、特筆すべきものがない限り、プロセスとスレッ
     ドに適用される *note multiprocessing.Lock: 1a9c. に引き継がれていま
     す。

     *note Lock: 1a9c. は実際にはファクトリ関数で、デフォルトコンテキス
     トで初期化された ‘multiprocessing.synchronize.Lock’ のインスタンス
     を返すことに注意してください。

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. for more details.

     *note Lock: 1a9c. は *note context manager: 47f. プロトコルをサポー
     トしています。つまり *note with: 215. 文で使うことができます。

      -- メソッド: acquire (block=True, timeout=None)

          ブロックあり、またはブロックなしでロックを獲得します。

          引数 'block' を ‘True’ (デフォルト) に設定して呼び出した場合、
          ロックがアンロック状態になるまでブロックします。ブロックから抜
          けるとそれをロック状態にしてから ‘True’ を返します。 *note
          threading.Lock.acquire(): a8c. の最初の引数とは名前が違ってい
          るので注意してください。

          引数 'block' の値を ‘False’ にして呼び出すとブロックしません。
          現在ロック状態であれば、直ちに ‘False’ を返します。それ以外の
          場合には、ロックをロック状態にして ‘True’ を返します。

          'timeout' として正の浮動小数点数を与えて呼び出すと、ロックが獲
          得できない限り、指定された秒数だけブロックします。 'timeout' 値
          に負数を与えると、ゼロを与えた場合と同じになります。 'timeout'
          値の ‘None’ (デフォルト) を与えると、無限にブロックします。
          'timeout' 引数の負数と ‘None’ の扱いは、 *note
          threading.Lock.acquire(): a8c. に実装された動作と異なるので注
          意してください。 'block' が ‘False’ の場合、 'timeout' は実際
          的な意味を持たなくなるので無視されます。ロックを獲得した場合は
          ‘True’ 、タイムアウトした場合は ‘False’ で戻ります。

      -- メソッド: release ()

          ロックを解放します。これはロックを獲得したプロセスやスレッドだ
          けでなく、任意のプロセスやスレッドから呼ぶことができます。

          *note threading.Lock.release(): 167c. と同じように振舞いますが
          、ロックされていない場合に呼び出すと *note ValueError: 15a. と
          なる点だけが違います。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

 -- クラス: multiprocessing.RLock

     再帰ロックオブジェクトで、 *note threading.RLock: 2eb. 相当のもので
     す。再帰ロックオブジェクトはそれを獲得 (acquire) したプロセスやスレ
     ッドが解放 (release) しなければなりません。プロセスやスレッドがロッ
     クをいったん獲得すると、同じプロセスやスレッドはブロックされずに再
     度獲得出来ます。そのプロセスやスレッドは獲得した回数ぶん解放しなけ
     ればなりません。

     *note RLock: 1a9d. は実際にはファクトリ関数で、デフォルトコンテキス
     トで初期化された ‘multiprocessing.synchronize.Lock’ のインスタンス
     を返すことに注意してください。

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. for more details.

     *note RLock: 1a9d. は *note context manager: 47f. プロトコルをサポ
     ートしています。つまり *note with: 215. 文で使うことができます。

      -- メソッド: acquire (block=True, timeout=None)

          ブロックあり、またはブロックなしでロックを獲得します。

          'block' 引数を ‘True’ にして呼び出した場合、ロックが既にカレン
          トプロセスもしくはカレントスレッドが既に所有していない限りは、
          アンロック状態 (どのプロセス、スレッドも所有していない状態) に
          なるまでブロックします。ブロックから抜けるとカレントプロセスも
          しくはカレントスレッドが (既に持っていなければ) 所有権を得て、
          再帰レベルをインクリメントし、 ‘True’ で戻ります。 *note
          threading.RLock.acquire(): 122f. の実装とはこの最初の引数の振
          る舞いが、その名前自身を始めとしていくつか違うので注意してくだ
          さい。

          'block' 引数を ‘False’ にして呼び出した場合、ブロックしません
          。ロックが他のプロセスもしくはスレッドにより獲得済み (つまり所
          有されている) であれば、カレントプロセスまたはカレントスレッド
          は所有権を得ず、再帰レベルも変更せずに、 ‘False’ で戻ります。
          ロックがアンロック状態の場合、カレントプロセスもしくはカレント
          スレッドは所有権を得て再帰レベルがインクリメントされ、 ‘True’
          で戻ります。(--訳注: 'block' の True/False 関係なくここでの説
          明では「所有権を持っている場合の2度目以降の aquire」の説明が欠
          けています。2度目以降の acquire では再帰レベルがインクリメント
          されて即座に返ります。全体読めばわかるとは思いますが一応。--)

          'timeout' 引数の使い方と振る舞いは *note Lock.acquire(): 38e7.
          と同じです。 'timeout' 引数の振る舞いがいくつかの点で *note
          threading.RLock.acquire(): 122f. と異なるので注意してください
          。

      -- メソッド: release ()

          再帰レベルをデクリメントしてロックを解放します。デクリメント後
          に再帰レベルがゼロになった場合、ロックの状態をアンロック (いか
          なるプロセス、いかなるスレッドにも所有されていない状態) にリセ
          ットし、ロックの状態がアンロックになるのを待ってブロックしてい
          るプロセスもしくはスレッドがある場合にはその中のただ一つだけが
          処理を進行できるようにします。デクリメント後も再帰レベルがゼロ
          でない場合、ロックの状態はロックのままで、呼び出し側のプロセス
          もしくはスレッドに所有されたままになります。

          このメソッドは呼び出しプロセスあるいはスレッドがロックを所有し
          ている場合に限り呼び出してください。所有者でないプロセスもしく
          はスレッドによって呼ばれるか、あるいはアンロック (未所有) 状態
          で呼ばれた場合、 *note AssertionError: a9c. が送出されます。同
          じ状況での *note threading.RLock.release(): 3886. 実装とは例外
          の型が異なるので注意してください。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

 -- クラス: multiprocessing.Semaphore ([value])

     セマフォオブジェクト: *note threading.Semaphore: 1516. のクローンで
     す。

     Instantiating this class may set the global start method.  See
     *note Global start method: 38b7. for more details.

     よく似た *note threading.BoundedSemaphore: 1517. とは、次の一点だけ
     異なります。 ‘acquire’ メソッドの第一引数名は 'block' で、*note
     Lock.acquire(): 38e7. と一致しています。

      -- メソッド: get_value ()

          Return the current value of semaphore.

          Note that this may raise *note NotImplementedError: 5a1. 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:
     1c8. が発生します。詳細は 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: 2d. オブジェクトを返しま
     す。 デフォルトでは、返り値は実際のオブジェクトの同期ラッパーです。
     オブジェクトそれ自身は、 *note Value: 38ae. の 'value' 属性によって
     アクセスできます。

     'typecode_or_type' は返されるオブジェクトの型を決めます。それは
     ctypes の型か *note array: 8. モジュールで使用されるような1文字の型
     コードかのどちらか一方です。 '*args' は型のコンストラクターへ渡され
     ます。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     に再帰的なロックオブジェクトが作成されます。 'lock' が *note Lock:
     1a9c. か *note RLock: 1a9d. なら値への同期アクセスに使用されます。
     '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: 2a4a. 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: 354a.  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: 1a9c. か
     *note RLock: 1a9d. なら値への同期アクセスに使用されます。 'lock' が
     ‘False’ なら、返されたオブジェクトへのアクセスはロックにより自動的
     に保護されません。そのため、必ずしも "プロセスセーフ" ではありませ
     ん。

     'lock' はキーワード引数としてのみ利用可能なことに注意してください。

     *note ctypes.c_char: 354a. の配列は文字列を格納して取り出せる
     'value' と 'raw' 属性を持っていることを覚えておいてください。

* 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: 2d. 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(): 1a58. を使用してください。

 -- の関数: multiprocessing.sharedctypes.RawValue (typecode_or_type,
          *args)

     共有メモリから割り当てられた ctypes オブジェクトを返します。

     'typecode_or_type' は返されるオブジェクトの型を決めます。それは
     ctypes の型か *note array: 8. モジュールで使用されるような1文字の型
     コードかのどちらか一方です。 '*args' は型のコンストラクターへ渡され
     ます。

     値を取得したり設定したりすることは潜在的に非アトミックであることに
     注意してください。ロックを使用して自動的に同期化されたアクセスを保
     証するには *note Value(): 1a5a. を使用してください。

     *note ctypes.c_char: 354a. の配列は文字列を格納して取り出せる
     ‘value’ と ‘raw’ 属性を持っていることを覚えておいてください。詳細は
     *note ctypes: 2d. を参照してください。

 -- の関数: multiprocessing.sharedctypes.Array (typecode_or_type,
          size_or_initializer, *, lock=True, ctx=None)

     *note RawArray(): 1a59. と同様ですが、 'lock' の値によっては ctypes
     配列をそのまま返す代わりに、プロセスセーフな同期ラッパーが返されま
     す。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     な ロックオブジェクトが作成されます。 'lock' が *note Lock: 1a9c. か
     *note RLock: 1a9d. なら値への同期アクセスに使用されます。 '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: 38b7. 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(): 1a5b. と同様ですが、 'lock' の値によっては ctypes
     オブジェクトをそのまま返す代わりに、プロセスセーフな同期ラッパーが
     返されます。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     な ロックオブジェクトが作成されます。 'lock' が *note Lock: 1a9c. か
     *note RLock: 1a9d. なら値への同期アクセスに使用されます。 '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: 38b7. 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: 1a9d. オブジェクトが自動
     的に作成されます。

     '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: 38b7. for more details.

     同期ラッパーがラップするオブジェクトに加えて2つのメソッドがあります
     。 ‘get_obj()’ はラップされたオブジェクトを返します。 ‘get_lock()’
     は同期のために使用されるロックオブジェクトを返します。

     ラッパー経由で ctypes オブジェクトにアクセスすることは raw ctypes オ
     ブジェクトへアクセスするよりずっと遅くなることに注意してください。

     バージョン 3.5 で変更: synchronized オブジェクトは *note
     コンテキストマネージャ: 47f. プロトコルをサポートしています。

次の表は通常の ctypes 構文で共有メモリから共有 ctypes オブジェクトを作成
するための構文を比較します。 (‘MyStruct’ テーブル内には *note
ctypes.Structure: 483. のサブクラスがあります。)

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: 1ad7. オブジェクトを返します。返されたマネージャーオブ
     ジェクトは生成される子プロセスに対応付けられ、共有オブジェクトを作
     成するメソッドや、共有オブジェクトに対応するプロキシを返すメソッド
     を持ちます。

マネージャープロセスは親プロセスが終了するか、ガベージコレクトされると停
止します。マネージャークラスは *note multiprocessing.managers: 9b. モジ
ュールで定義されています:

 -- クラス: multiprocessing.managers.BaseManager (address=None,
          authkey=None, serializer='pickle', ctx=None, *,
          shutdown_timeout=1.0)

     BaseManager オブジェクトを作成します。

     作成後、*note start(): 38f3. または ‘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: 137.
     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: 38b7. 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():
     38f4. 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: 38f6. 属性も持っています。

      -- メソッド: connect ()

          ローカルからリモートのマネージャーオブジェクトへ接続します:

               >>> from multiprocessing.managers import BaseManager
               >>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')
               >>> m.connect()

      -- メソッド: shutdown ()

          マネージャーが使用するプロセスを停止します。これはサーバープロ
          セスを開始するために *note start(): 38f3. が使用された場合のみ
          有効です。

          これは複数回呼び出すことができます。

      -- メソッド: register (typeid[, callable[, proxytype[, exposed[,
               method_to_typeid[, create_method]]]]])

          マネージャークラスで呼び出し可能オブジェクト(callable)や型を登
          録するために使用されるクラスメソッドです。

          'typeid' は特に共有オブジェクトの型を識別するために使用される
          "型識別子" です。これは文字列でなければなりません。

          'callable' はこの型識別子のオブジェクトを作成するために使用さ
          れる呼び出し可能オブジェクトです。マネージャーインスタンスが
          *note connect(): 38f7. メソッドを使ってサーバーに接続されてい
          るか、 'create_method' 引数が ‘False’ の場合は、 ‘None’ でも構
          いません。

          'proxytype' はこの 'typeid' で共有オブジェクトのプロキシを作成
          するために使用される *note BaseProxy: 38f9. のサブクラスです。
          ‘None’ の場合、プロキシクラスは自動的に作成されます。

          'exposed' は *note BaseProxy._callmethod(): 38fa. を使用したア
          クセスが許されるべき typeid をプロキシするメソッド名のシーケン
          スを指定するために使用されます ('exposed' が ‘None’ の場合
          ‘proxytype._exposed_’ が存在すればそれが代わりに使用されます
          )。'exposed' リストが指定されない場合、共有オブジェクトのすべ
          ての "パブリックメソッド" がアクセス可能になります。 (ここでい
          う "パブリックメソッド" とは *note __call__(): 966. メソッドを
          持つものと名前が ‘'_'’ で始まらないあらゆる属性を意味します。)

          'method_to_typeid' はプロキシが返す exposed メソッドの返り値の
          型を指定するために使用されるマッピングで、メソッド名を typeid
          文字列にマップします。 ('method_to_typeid' が ‘None’ の場合
          ‘proxytype._method_to_typeid_’ が存在すれば、それが代わりに使
          用されます。) メソッド名がこのマッピングのキーではないか、マッ
          ピングが ‘None’ の場合、そのメソッドによって返されるオブジェク
          トが値として (by value) コピーされます。

          'create_method' は、共有オブジェクトを作成し、それに対するプロ
          キシを返すようサーバープロセスに伝える、名前 'typeid' のメソッ
          ドを作成するかを決定します。デフォルトでは ‘True’ です。

     *note BaseManager: 38f2. インスタンスも読み出し専用属性を1つ持って
     います:

      -- の属性: address

          マネージャーが使用するアドレスです。

     バージョン 3.3 で変更: マネージャーオブジェクトはコンテキストマネー
     ジメント・プロトコルをサポートします - *note
     コンテキストマネージャ型: 2620. を参照してください。 *note
     __enter__(): 28bc. は (まだ開始していない場合) サーバープロセスを開
     始してから、マネージャーオブジェクトを返します。 *note __exit__():
     28bd. は *note shutdown(): 38f4. を呼び出します。

     旧バージョンでは、 *note __enter__(): 28bc. はマネージャーのサーバ
     ープロセスがまだ開始していなかった場合でもプロセスを開始しませんで
     した。

 -- クラス: multiprocessing.managers.SyncManager

     プロセス間の同期のために使用される *note BaseManager: 38f2. のサブ
     クラスです。 *note multiprocessing.Manager(): 4e3. はこの型のオブジ
     ェクトを返します。

     Its methods create and return *note Proxy オブジェクト: 4df. 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: 15a2. オブジェクトを作成して、そ
          のプロキシを返します。

          Added in version 3.3.

      -- メソッド: BoundedSemaphore ([value])

          共有 *note threading.BoundedSemaphore: 1517. オブジェクトを作
          成して、そのプロキシを返します。

      -- メソッド: Condition ([lock])

          共有 *note threading.Condition: 1515. オブジェクトを作成して、
          そのプロキシを返します。

          'lock' が提供される場合 *note threading.Lock: 1a30. か *note
          threading.RLock: 2eb. オブジェクトのためのプロキシになります。

          バージョン 3.3 で変更: *note wait_for(): 388b. メソッドが追加
          されました。

      -- メソッド: Event ()

          共有 *note threading.Event: 1518. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Lock ()

          共有 *note threading.Lock: 1a30. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Namespace ()

          共有 *note Namespace: 38b0. オブジェクトを作成して、そのプロキ
          シを返します。

      -- メソッド: Queue ([maxsize])

          共有 *note queue.Queue: 174d. オブジェクトを作成して、そのプロ
          キシを返します。

      -- メソッド: RLock ()

          共有 *note threading.RLock: 2eb. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Semaphore ([value])

          共有 *note threading.Semaphore: 1516. オブジェクトを作成して、
          そのプロキシを返します。

      -- メソッド: Array (typecode, sequence)

          配列を作成して、そのプロキシを返します。

      -- メソッド: Value (typecode, value)

          書き込み可能な ‘value’ 属性を作成して、そのプロキシを返します
          。

      -- メソッド: dict ()

      -- メソッド: dict (mapping)

      -- メソッド: dict (sequence)

          共有 *note dict: 193. オブジェクトを作成して、そのプロキシを返
          します。

      -- メソッド: list ()

      -- メソッド: list (sequence)

          共有 *note list: 4e0. オブジェクトを作成して、そのプロキシを返
          します。

      -- メソッド: set ()

      -- メソッド: set (sequence)

      -- メソッド: set (mapping)

          Create a shared *note set: 432. object and return a proxy for
          it.

          Added in version 3.14: *note set: 432. support was added.

     バージョン 3.6 で変更: 共有オブジェクトは入れ子もできます。 例えば
     、共有リストのような共有コンテナオブジェクトは、 *note SyncManager:
     1ad7. がまとめて管理し同期を取っている他の共有オブジェクトを保持で
     きます。

 -- クラス: multiprocessing.managers.Namespace

     *note SyncManager: 1ad7. に登録することのできる型です。

     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: 38f2. のサブクラス
を作成して、 マネージャークラスで呼び出し可能なオブジェクトか新たな型を
登録するために *note register(): 38f8. クラスメソッドを使用します。例え
ば:

     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(): 1ea. を適用すると参照対象のオブジェクト表現を返
すのに対して、 *note repr(): 462. を適用するとプロキシのオブジェクト表現
を返すことに注意してください。

プロキシオブジェクトの重要な機能は pickle 化ができることで、これによりプ
ロセス間での受け渡しができます。 そのため、参照対象が *note Proxy
オブジェクト: 4df. を持てます。 これによって管理されたリスト、辞書、その
他 *note Proxy オブジェクト: 4df. をネストできます:

     >>> 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: 4e0. オブジェクトや *note dict: 193.
オブジェクトが参照対象に含まれていた場合、それらの可変な値の変更はマネー
ジャーからは伝搬されません。 というのも、プロキシには参照対象の中に含ま
れる値がいつ変更されたかを知る術が無いのです。 しかし、コンテナプロキシ
に値を保存する (これはプロキシオブジェクトの ‘__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 オブジェクト: 4df. 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: 38f9. のサブクラスのインス
     タンスです。

      -- メソッド: _callmethod (methodname[, args[, kwds]])

          プロキシの参照対象のメソッドの実行結果を返します。

          ‘proxy’ がプロキシで、プロキシ内の参照対象が ‘obj’ ならこの式

               proxy._callmethod(methodname, args, kwds)

          はこの式を評価します

               getattr(obj, methodname)(*args, **kwds)

          (マネージャープロセス内の)。

          返される値はその呼び出し結果のコピーか、新たな共有オブジェクト
          に対するプロキシになります。詳細は *note
          BaseManager.register(): 38f8. の 'method_to_typeid' 引数のドキ
          ュメントを参照してください。

          その呼び出しによって例外が発生した場合、*note _callmethod():
          38fa. によってその例外は再送出されます。他の例外がマネージャー
          プロセスで発生したなら、‘RemoteError’ 例外に変換されたものが
          ‘_callmethod()’ によって送出されます。

          特に 'methodname' が '公開' されていない場合は例外が発生するこ
          とに注意してください。

          *note _callmethod(): 38fa. の使用例になります:

               >>> 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: 131a. クラスでタスクを実行するプロセスのプールを作成すること
ができます。

 -- クラス: 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(): 6e6. 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(): 131a. 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(): 390c. and *note terminate(): 390d. 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__(): 13ab. for more information).

     バージョン 3.2 で変更: Added the 'maxtasksperchild' parameter.

     バージョン 3.4 で変更: 'context' パラメータを追加しました。

     バージョン 3.13 で変更: 'processes' uses *note
     os.process_cpu_count(): 6e6. by default, instead of *note
     os.cpu_count(): 6e7.

          注釈: Worker processes within a *note Pool: 131a. 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(): 174f. の方が並行作業により適しています。
          加えて、 'func' は、プール内の1つのワーカーだけで実行されます
          。

      -- メソッド: apply_async (func[, args[, kwds[, callback[,
               error_callback]]]])

          *note apply(): 174e. メソッドの派生版で *note AsyncResult:
          390e. オブジェクトを返します。

          'callback' が指定された場合、それは単一の引数を受け取る呼び出
          し可能オブジェクトでなければなりません。結果を返せるようになっ
          たときに 'callback' が結果オブジェクトに対して適用されます。た
          だし呼び出しが失敗した場合は、代わりに 'error_callback' が適用
          されます。

          'error_callback' が指定された場合、それは単一の引数を受け取る
          呼び出し可能オブジェクトでなければなりません。対象の関数が失敗
          した場合、例外インスタンスを伴って 'error_callback' が呼ばれま
          す。

          コールバックは直ちに完了すべきです。なぜなら、そうしなければ、
          結果を扱うスレッドがブロックするからです。

      -- メソッド: map (func, iterable[, chunksize])

          *note map(): 445. 組み込み関数の並列版です ('iterable' な引数
          を1つだけサポートするという違いはあります。もしも複数のイテラ
          ブルを使いたいのならば *note starmap(): 14a6. を参照)。結果が
          出るまでブロックします。

          このメソッドはイテラブルをいくつものチャンクに分割し、プロセス
          プールにそれぞれ独立したタスクとして送ります。(概算の) チャン
          クサイズは 'chunksize' を正の整数に設定することで指定できます
          。

          Note that it may cause high memory usage for very long
          iterables.  Consider using *note imap(): 390f. or *note
          imap_unordered(): 3910. with explicit 'chunksize' option for
          better efficiency.

      -- メソッド: map_async (func, iterable[, chunksize[, callback[,
               error_callback]]])

          *note map(): 14a4. メソッドの派生版で *note AsyncResult: 390e.
          オブジェクトを返します。

          'callback' が指定された場合、それは単一の引数を受け取る呼び出
          し可能オブジェクトでなければなりません。結果を返せるようになっ
          たときに 'callback' が結果オブジェクトに対して適用されます。た
          だし呼び出しが失敗した場合は、代わりに 'error_callback' が適用
          されます。

          'error_callback' が指定された場合、それは単一の引数を受け取る
          呼び出し可能オブジェクトでなければなりません。対象の関数が失敗
          した場合、例外インスタンスを伴って 'error_callback' が呼ばれま
          す。

          コールバックは直ちに完了すべきです。なぜなら、そうしなければ、
          結果を扱うスレッドがブロックするからです。

      -- メソッド: imap (func, iterable[, chunksize])

          *note map(): 14a4. の遅延評価版です。

          'chunksize' 引数は *note map(): 14a4. メソッドで使用されるもの
          と同じです。 引数 iterable がとても長いなら 'chunksize' に大き
          な値を指定して使用する方がデフォルト値の ‘1’ を使用するよりも
          ジョブの完了が 'かなり' 速くなります。

          また 'chunksize' が ‘1’ の場合 *note imap(): 390f. メソッドが
          返すイテレーターの ‘next()’ メソッドはオプションで 'timeout' パ
          ラメーターを持ちます。 ‘next(timeout)’ は、その結果が
          'timeout' 秒以内に返されないときに *note
          multiprocessing.TimeoutError: 38c4. を発生させます。

      -- メソッド: imap_unordered (func, iterable[, chunksize])

          イテレーターが返す結果の順番が任意の順番で良いと見なされること
          を除けば *note imap(): 390f. と同じです。 (ワーカープロセスが
          1つしかない場合のみ "正しい" 順番になることが保証されます。)

      -- メソッド: starmap (func, iterable[, chunksize])

          'iterable' の要素が、引数として unpack されるイテレート可能オ
          ブジェクトであると期待される以外は、 *note map(): 14a4. と似て
          います。

          そのため、'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(): 14a6. と *note map_async(): 14a5. の組み合わ
          せです。 イテレート可能オブジェクトの 'iterable' をイテレート
          して、 unpack したイテレート可能オブジェクトを伴って 'func' を
          呼び出します。結果オブジェクトを返します。

          Added in version 3.3.

      -- メソッド: close ()

          これ以上プールでタスクが実行されないようにします。すべてのタス
          クが完了した後でワーカープロセスが終了します。

      -- メソッド: terminate ()

          実行中の処理を完了させずにワーカープロセスをすぐに停止します。
          プールオブジェクトがガベージコレクトされるときに *note
          terminate(): 390d. が呼び出されます。

      -- メソッド: join ()

          ワーカープロセスが終了するのを待ちます。 *note join(): 3911. を
          使用する前に *note close(): 390c. か *note terminate(): 390d.
          を呼び出さなければなりません。

     バージョン 3.3 で変更: Pool オブジェクトがコンテキストマネージメン
     ト・プロトコルをサポートするようになりました。 - *note
     コンテキストマネージャ型: 2620. を参照してください。 *note
     __enter__(): 28bc. は Pool オブジェクトを返します。また *note
     __exit__(): 28bd. は *note terminate(): 390d. を呼び出します。

 -- クラス: multiprocessing.pool.AsyncResult

     *note Pool.apply_async(): 174f. や *note Pool.map_async(): 14a5. で
     返される結果のクラスです。

      -- メソッド: get ([timeout])

          結果を受け取ったときに返します。 'timeout' が ‘None’ ではなく
          て、その結果が 'timeout' 秒以内に受け取れない場合 *note
          multiprocessing.TimeoutError: 38c4. が発生します。リモートの呼
          び出しが例外を発生させる場合、その例外は *note get(): 3912. が
          再発生させます。

      -- メソッド: wait ([timeout])

          その結果が有効になるか 'timeout' 秒経つまで待ちます。

      -- メソッド: ready ()

          その呼び出しが完了しているかどうかを返します。

      -- メソッド: successful ()

          その呼び出しが例外を発生させることなく完了したかどうかを返しま
          す。その結果が返せる状態でない場合 *note ValueError: 15a. が発
          生します。

          バージョン 3.7 で変更: If the result is not ready, *note
          ValueError: 15a. is raised instead of *note AssertionError:
          a9c.

次の例はプールの使用例を紹介します:

     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():
38ab. が返す *note Connection: 14a1. オブジェクトを使用します。

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: 6d. module, and for
polling multiple connections at the same time.

 -- の関数: multiprocessing.connection.deliver_challenge (connection,
          authkey)

     ランダム生成したメッセージをコネクションの相手側へ送信して応答を待
     ちます。

     その応答がキーとして 'authkey' を使用するメッセージのダイジェストと
     一致する場合、 コネクションの相手側へ歓迎メッセージを送信します。 そ
     うでなければ *note AuthenticationError: 38c3. を発生させます。

 -- の関数: multiprocessing.connection.answer_challenge (connection,
          authkey)

     メッセージを受信して、そのキーとして 'authkey' を使用するメッセージ
     のダイジェストを計算し、ダイジェストを送り返します。

     歓迎メッセージを受け取れない場合 *note AuthenticationError: 38c3. が
     発生します。

 -- の関数: multiprocessing.connection.Client (address[, family[,
          authkey]])

     'address' で渡したアドレスを使用するリスナーに対してコネクションを
     確立しようとして *note Connection: 14a1. を返します。

     コネクション種別は 'family' 引数で決定しますが、一般的には
     'address' のフォーマットから推測できるので、これは指定されません。
     (*note アドレスフォーマット: 391a. を参照してください)

     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: 38c3. is raised if authentication fails.
     See *note 認証キー: 38c0.

 -- クラス: 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 アドレスフォーマット: 391a. を参照し
     てください。 'family' が ‘'AF_UNIX'’ で 'address' が ‘None’ の場合
     *note tempfile.mkstemp(): 2f07. を使用して作成されたプライベートな
     一時ディレクトリにソケットが作成されます。

     リスナーオブジェクトがソケットを使用する場合、ソケットに束縛される
     ときに 'backlog' (デフォルトでは1つ) がソケットの *note listen():
     1212. メソッドに対して渡されます。

     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: 38c3. is raised if authentication fails.
     See *note 認証キー: 38c0.

      -- メソッド: accept ()

          リスナーオブジェクトの名前付きパイプか束縛されたソケット上でコ
          ネクションを 受け付けて *note Connection: 14a1. オブジェクトを
          返します。 認証が失敗した場合 *note AuthenticationError: 38c3.
          が発生します。

      -- メソッド: close ()

          リスナーオブジェクトの名前付きパイプか束縛されたソケットをクロ
          ーズします。これはリスナーがガベージコレクトされるときに自動的
          に呼ばれます。そうは言っても、明示的に close() を呼び出す方が
          望ましいです。

     リスナーオブジェクトは次の読み出し専用属性を持っています:

      -- の属性: address

          リスナーオブジェクトが使用中のアドレスです。

      -- の属性: last_accepted

          最後にコネクションを受け付けたアドレスです。有効なアドレスがな
          い場合は ‘None’ になります。

     バージョン 3.3 で変更: Listener オブジェクトがコンテキストマネージ
     メント・プロトコルをサポートするようになりました。 - *note
     コンテキストマネージャ型: 2620. を参照してください。 *note
     __enter__(): 28bc. はリスナーオブジェクトを返します。また *note
     __exit__(): 28bd. は *note close(): 391b. を呼び出します。

 -- の関数: 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: 14a1. オブジェクト;

        * 接続された読み取り可能な *note socket.socket: 115e. オブジェク
          ト; または

        * *note Process: 4e5. オブジェクトの *note sentinel: 14a2. 属性
          。

     読み取ることのできるデータがある場合、あるいは相手側の端が閉じられ
     ている場合、コネクションまたはソケットオブジェクトは準備ができてい
     ます。

     'POSIX': ‘wait(object_list, timeout)’ almost equivalent
     ‘select.select(object_list, [], [], timeout)’.  The difference is
     that, if *note select.select(): 115d. is interrupted by a signal,
     it can raise *note OSError: 543. 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(): 19d2. 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(): 14a0. を使って複数のプロセスからのメッセージ
を同時に待ちます:

     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(): 3919. を使用するには、代わりに
     ‘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: 1c4a. や *note Client():
3919. はダイジェスト認証を提供するために *note hmac: 6d. モジュールを使
用します。

認証キーはパスワードとして見なされるバイト文字列です。コネクションが確立
すると、双方の終点で正しい接続先であることを証明するために 知っているお
互いの認証キーを要求します。(双方の終点が同じキーを使用して通信しようと
しても、コネクション上でそのキーを送信することは 'できません'。)

認証が要求されているにもかかわらず認証キーが指定されていない場合
‘current_process().authkey’ の返す値が使用されます。 (詳細は *note
Process: 4e5. を参照してください。) この値はカレントプロセスを作成する
‘Process’ オブジェクトによって自動的に継承されます。 これは(デフォルトで
は)複数プロセスのプログラムの全プロセスが相互にコネクションを 確立すると
きに使用される1つの認証キーを共有することを意味します。

適当な認証キーを *note os.urandom(): 936. を使用して生成することもできま
す。

This authentication protects *note Listener: 1c4a. and *note Client():
3919. connections, which are reachable by address.  It is not applied to
the anonymous pipes created by *note Pipe(): 38ab. or used internally by
*note Queue: 1da4.  ‘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: 8a.
パッケージは、 (ハンドラー種別に依存して)違うプロセスからのメッセージが
ごちゃ混ぜになるので、プロセスの共有ロックを使用しないことに注意してくだ
さい。

 -- の関数: 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: 33c9.
     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(): 348d. に対する呼び出しを実行しますが
     、 get_logger によって作成されるロガーを返すことに加えて、
     ‘'[%(levelname)s/%(processName)s] %(message)s'’ のフォーマットを使
     用して *note sys.stderr: d09. へ出力を送るハンドラーを追加します。
     ‘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: 8a. モジュールを参照し
てください。


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: f6. module.

In particular, the ‘Pool’ function provided by ‘multiprocessing.dummy’
returns an instance of *note ThreadPool: 1ee9, which is a subclass of
*note Pool: 131a. 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: 131a. instances, and their
     resources must also be properly managed, either by using the pool
     as a context manager or by calling *note close(): 390c. and *note
     terminate(): 390d. manually.

     'processes' is the number of worker threads to use.  If 'processes'
     is ‘None’ then the number returned by *note os.process_cpu_count():
     6e6. is used.

     'initializer' が ‘None’ ではない場合、各ワーカープロセスは開始時に
     ‘initializer(*initargs)’ を呼び出します。

     Unlike *note Pool: 131a, 'maxtasksperchild' and 'context' cannot be
     provided.

          注釈: A ‘ThreadPool’ shares the same interface as *note Pool:
          131a, 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: 390e, that is not understood by any other
          libraries.

          Users should generally prefer to use *note
          concurrent.futures.ThreadPoolExecutor: b2c, which has a
          simpler interface that was designed around threads from the
          start, and which returns *note concurrent.futures.Future:
          1570. 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: f6. モジュールの低レベルな同
     期プリミティブを使うのではなく、キューやパイプを使うのが良いでしょ
     う。

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(): 38d8. is called) all
     completed processes which have not yet been joined will be joined.
     Also calling a finished process's *note Process.is_alive: 174b.
     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: 1a9f. メソッ
     ドを使用すると、そのプロセスが現在使用されている (ロック、セマフォ
     、パイプやキューのような) 共有リソースを破壊したり他のプロセスから
     利用できない状態を引き起こし易いです。

     そのため、共有リソースを使用しないプロセスでのみ *note
     Process.terminate: 1a9f. を使用することを考慮することがおそらく最善
     の方法です。

キューを使用するプロセスを join する

     キューに要素を追加するプロセスは、すべてのバッファーされた要素が
     "feeder" スレッドによって下位層のパイプに対してフィードされるまで終
     了を待つということを覚えておいてください。 (子プロセスはこの動作を
     避けるためにキューの *note Queue.cancel_join_thread: 38ce. メソッド
     を呼ぶことができます。)

     これはキューを使用するときに、キューに追加されたすべての要素が最終
     的にそのプロセスが 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: 94f. を 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():
     94f. with a "file-like object" with output buffering.  This danger
     is that if multiple processes call *note close(): 711. 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: 4e5. are picklable.
     Also, if you subclass ‘Process.__init__’, you must make sure that
     instances will be picklable when the *note Process.start: 174a.
     method is called.

グローバル変数

     子プロセスで実行されるコードがグローバル変数にアクセスしようとする
     場合、子プロセスが見るその値は *note Process.start: 174a. が呼ばれ
     たときの親プロセスの値と同じではない可能性があります。

     しかし、単にモジュールレベルの定数であるグローバル変数なら問題には
     なりません。
メインモジュールの安全なインポート

     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: 317. で失敗します:

          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: 131a. を使用する例です:

     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: 1c00. クラスを提供します。共有メモ
リのライフサイクル管理、とりわけ複数のプロセスにわたる場合のために、
*note multiprocessing.managers: 9b. モジュールでは *note BaseManager:
38f2. のサブクラス *note SharedMemoryManager: 392b. も提供されます。

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(): 392c.
     method should be called.  When a shared memory block is no longer
     needed by any process, the *note unlink(): 392d. method should be
     called to ensure proper cleanup.


     パラメータ:

        * ‘name’ (*note str: 1ea.‘ | ’‘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: 5f6.) - Control whether a new shared
          memory block is created (‘True’) or an existing shared memory
          block is attached (‘False’).

        * ‘size’ (*note int: 32e.) - 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: 5f6.) - 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: df. 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(): 392d.
          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(): 392c. 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:
1c00. 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: 1c00. 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: 38f2.
     which can be used for the management of shared memory blocks across
     processes.

     A call to *note start(): 38f3. 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(): 38f4. on the
     instance.  This triggers a *note unlink(): 392d. call on all of the
     *note SharedMemory: 3931. 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: 3931. instances and for creating a list-like object
     (*note ShareableList: 3932.) backed by shared memory.

     Refer to *note BaseManager: 38f2. 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: 3931. object with
          the specified 'size' in bytes.

      -- メソッド: ShareableList (sequence)

          Create and return a new *note ShareableList: 3932. object,
          initialized by the values from the input 'sequence'.

The following example demonstrates the basic mechanisms of a *note
SharedMemoryManager: 392b.:

     >>> 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: 392b. objects via the *note with: 215.
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: 392b. in a *note with: 215.
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: 32e. (signed 64-bit)

        * *note float: 32f.

        * *note bool: 5f6.

        * *note str: 1ea. (less than 10M bytes each when encoded as
          UTF-8)

        * *note bytes: 1d2. (less than 10M bytes each)

        * ‘None’

     It also notably differs from the built-in *note list: 4e0. 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: 1c00.  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: 1d2. and *note
          str: 1ea. 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: 15a. if 'value' is not present.

      -- の属性: format

          Read-only attribute containing the *note struct: de. packing
          format used by all currently stored values.

      -- の属性: shm

          The *note SharedMemory: 1c00. instance where the values are
          stored.

以下に *note ShareableList: 1f6b. インスタンスの利用例を示します。

     >>> 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: 1f6b. 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: 1f6b. (and
underlying *note SharedMemory: 1c00.) 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/main/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: b2c. or *note InterpreterPoolExecutor: 471, or
separate processes, using *note ProcessPoolExecutor: 211.  Each
implements the same interface, which is defined by the abstract *note
Executor: 393d. class.

*note concurrent.futures.Future: 1570. must not be confused with *note
asyncio.Future: f8f, which is designed for use with *note asyncio: b.
tasks and coroutines.  See the *note asyncio's Future: 393e.
documentation for a detailed comparison of the two.

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

* Menu:

* Executor オブジェクト::
* ThreadPoolExecutor::
* InterpreterPoolExecutor::
* ProcessPoolExecutor::
* Future オブジェクト::
* モジュール関数: モジュール関数<2>.
* 例外クラス::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/concurrent/futures/thread.py

   (2) 
https://github.com/python/cpython/tree/main/Lib/concurrent/futures/process.py

   (3) 
https://github.com/python/cpython/tree/main/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: 1570. オブジェクトを返します。

               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): 445. 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__(): 1687. が呼ばれその結果が元々の *note
          Executor.map(): 47a. の呼び出しから 'timeout' 秒経った後も利用
          できない場合、返されるイテレータは *note TimeoutError: c12. を
          送出します。'timeout' は整数または浮動小数点数です。もし
          'timeout' が指定されないか の場合、待ち時間に制限はありません
          。

          もし 'fn' の呼び出しが例外を送出した場合、その例外はイテレータ
          から値を受け取る時に送出されます。

          When using *note ProcessPoolExecutor: 211, 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: b2c.
          and *note InterpreterPoolExecutor: 471, 'chunksize' has no
          effect.

          バージョン 3.5 で変更: 'chunksize' 引数が追加されました。

          バージョン 3.14 で変更: 'buffersize' 引数が追加されました。

      -- メソッド: shutdown (wait=True, *, cancel_futures=False)

          executor に対して、現在保留中のフューチャーが実行された後で、
          使用中のすべての資源を解放するように伝えます。シャットダウンに
          より後に *note Executor.submit(): e48. と *note
          Executor.map(): 47a. を呼び出すと *note RuntimeError: 317. が
          送出されます。

          '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: 47f. via the *note
          with: 215. 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: b2c. はスレッドのプールを使用して非同期に呼び
出しを行う、 *note Executor: 393d. のサブクラスです。

*note Future: 1570. に関連づけられた呼び出し可能オブジェクトが、別の
‘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:
     393d. のサブクラスです。

     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: 3941,
     as well as any attempt to submit more jobs to the pool.

     バージョン 3.5 で変更: 'max_workers' が ‘None’ か指定されない場合の
     デフォルト値はマシンのプロセッサの数に 5 を掛けたものになります。こ
     れは、 *note ThreadPoolExecutor: b2c. は CPU の処理ではなく I/O を
     オーバーラップするのによく使用されるため、 *note
     ProcessPoolExecutor: 211. のワーカーの数よりもこのワーカーの数を増
     やすべきであるという想定に基づいています。

     バージョン 3.6 で変更: 'thread_name_prefix' 引数が追加され、デバッ
     グしやすくなるようにプールから作られたワーカスレッド *note
     threading.Thread: 427. の名前を管理できるようになりました。

     バージョン 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: 471. class uses a pool of
interpreters to execute calls asynchronously.  It is a *note
ThreadPoolExecutor: b2c. 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: 68c, 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: ea0. 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: e2, *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: d4. or *note pipe: 1d81.

 -- クラス: concurrent.futures.InterpreterPoolExecutor
          (max_workers=None, thread_name_prefix='', initializer=None,
          initargs=())

     A *note ThreadPoolExecutor: b2c. 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: 68c,
     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: 3944.

     Other caveats from parent *note ThreadPoolExecutor: b2c. apply
     here.

*note submit(): e48. and *note map(): 47a. 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: 3944. 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: 211. はプロセスプールを使って非同期呼び出しを
実施する *note Executor: 393d. のサブクラスです。‘ProcessPoolExecutor’ は
*note multiprocessing: 98. モジュールを利用します。このため *note Global
Interpreter Lock: 68c. を回避することができますが、pickle 化できるオブジ
ェクトしか実行したり返したりすることができません。

‘__main__’ モジュールはワーカサブプロセスでインポート可能でなければなり
ません。 すなわち、 *note ProcessPoolExecutor: 211. は対話的インタープリ
タでは動きません。

*note ProcessPoolExecutor: 211. に渡された呼び出し可能オブジェクトから
*note Executor: 393d. や *note Future: 1570. メソッドを呼ぶとデッドロッ
クに陥ります。

Note that the restrictions on functions and arguments needing to
picklable as per *note multiprocessing.Process: 4e5. apply when using
*note submit(): e48. and *note map(): 47a. on a *note
ProcessPoolExecutor: 211.  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: 393d. 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(): 6e6.  If 'max_workers' is less than or
     equal to ‘0’, then a *note ValueError: 15a. 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
     コンテキストと開始方式: 474.

     '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: 3946,
     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: 3946. エラーが送出されるようになりました。 以前
     は挙動は未定義でしたが、 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(): 6c3. function
     called internally to spawn workers may raise a *note
     DeprecationWarning: 2d4.  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(): 6e6. by default, instead of *note
     os.cpu_count(): 6e7.

     バージョン 3.14 で変更: The default process start method (see *note
     コンテキストと開始方式: 474.) 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: 1a9f. on each of them.
          Internally, it will also call *note Executor.shutdown(): cc2.
          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: f19. on each of them.  Internally,
          it will also call *note Executor.shutdown(): cc2. 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: 1570. クラスは呼び出し可能オブジェクトの非同期実行をカプセ
ル化します。 ‘Future’ のインスタンスは *note Executor.submit(): e48. に
よって生成されます。

 -- クラス: concurrent.futures.Future

     呼び出し可能オブジェクトの非同期実行をカプセル化します。 *note
     Future: 1570. インスタンスは *note Executor.submit(): e48. で生成さ
     れ、テストを除いて直接生成すべきではありません。

      -- メソッド: 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: c12. が送出されます。 'timeout' はintかfloatを指
          定できます。もし 'timeout' が指定されていないか、 ‘None’ であ
          れば、待機時間に制限はありません。

          future が完了する前にキャンセルされた場合 *note
          CancelledError: da3. が送出されます。

          If the call raised an exception, this method will raise the
          same exception.

      -- メソッド: exception (timeout=None)

          呼び出しによって送出された例外を返します。もし呼び出しがまだ完
          了されていなければ、このメソッドは 'timeout' 秒だけ待機します
          。もし呼び出しが 'timeout' 秒の間に完了しなければ、 *note
          TimeoutError: c12. が送出されます。 'timeout' にはintかfloatを
          指定できます。 'timeout' が指定されていないか、 ‘None’ であれ
          ば、待機時間に制限はありません。

          future が完了する前にキャンセルされた場合 *note
          CancelledError: da3. が送出されます。

          呼び出しが例外を送出することなく完了した場合、‘None’ を返しま
          す。

      -- メソッド: add_done_callback (fn)

          呼び出し可能な 'fn' オブジェクトを future にアタッチします。
          futureがキャンセルされたか、実行を終了した際に、future をその
          ただ一つの引数として 'fn' が呼び出されます。

          追加された呼び出し可能オブジェクトは、追加された順番で呼びださ
          れ、追加を行ったプロセスに属するスレッド中で呼び出されます。も
          し呼び出し可能オブジェクトが *note Exception: da2. のサブクラ
          スを送出した場合、それはログに記録され無視されます。呼び出し可
          能オブジェクトが *note BaseException: 9bd. のサブクラスを送出
          した場合の動作は未定義です。

          もしfutureがすでに完了しているか、キャンセル済みであれば、'fn'
          は即座に実行されます。

     以下の *note Future: 1570. メソッドは、ユニットテストでの使用と
     *note Executor: 393d. を実装することを意図しています。

      -- メソッド: set_running_or_notify_cancel ()

          このメソッドは、*note Future: 1570. に関連付けられたワークやユ
          ニットテストによるワークの実行前に、 *note Executor: 393d. の
          実装によってのみ呼び出してください。

          このメソッドが ‘False’ を返す場合、 *note Future: 1570. はキャ
          ンセルされています。つまり、 *note Future.cancel(): 3949. が呼
          び出されて ‘True’ が返っています。‘Future’ の完了を (*note
          as_completed(): 1bf0. または *note wait(): 1e1b. により) 待機
          するすべてのスレッドが起動します。

          このメソッドが ‘True’ を返す場合、 *note Future: 1570. はキャ
          ンセルされて、実行状態に移行されています。つまり、 *note
          Future.running(): 394b. を呼び出すと ‘True’ が返ります。

          このメソッドは、一度だけ呼び出すことができ、*note
          Future.set_result(): 3951. または *note
          Future.set_exception(): 3952. がキャンセルされた後には呼び出す
          ことができません。

      -- メソッド: set_result (result)

          *note Future: 1570. に関連付けられたワークの結果を 'result' に
          設定します。

          このメソッドは、 *note Executor: 393d. の実装またはユニットテ
          ストによってのみ使用してください。

          バージョン 3.8 で変更: This method raises *note
          concurrent.futures.InvalidStateError: 1b84. if the ‘Future’ is
          already done.

      -- メソッド: set_exception (exception)

          *note Future: 1570. に関連付けられたワークの結果を *note
          Exception: da2. 'exception' に設定します。

          このメソッドは、 *note Executor: 393d. の実装またはユニットテ
          ストによってのみ使用してください。

          バージョン 3.8 で変更: This method raises *note
          concurrent.futures.InvalidStateError: 1b84. 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: 1570. instances (possibly created by
     different *note Executor: 393d. 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: 3956.
                                                            
                                                            
      -- データ: concurrent.futures.ALL_COMPLETED           すべてのフューチャが終了したかキャンセルされたときに
                                                            返します。
                                                            

 -- の関数: concurrent.futures.as_completed (fs, timeout=None)

     Returns an iterator over the *note Future: 1570. instances
     (possibly created by different *note Executor: 393d. 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: c12. if *note __next__():
     1687. 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: c12, raised when a future
     operation exceeds the given timeout.

     バージョン 3.11 で変更: このクラスは *note TimeoutError: c12. のエ
     イリアスになりました。

 -- 例外: concurrent.futures.BrokenExecutor

     Derived from *note RuntimeError: 317, 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: 3959, this exception class is
     raised when one of the workers of a *note ThreadPoolExecutor: b2c.
     has failed initializing.

     Added in version 3.7.

 -- 例外: concurrent.futures.interpreter.BrokenInterpreterPool

     Derived from *note BrokenThreadPool: 3941, this exception class is
     raised when one of the workers of a *note InterpreterPoolExecutor:
     471. has failed initializing.

     Added in version 3.14.

 -- 例外: concurrent.futures.process.BrokenProcessPool

     Derived from *note BrokenExecutor: 3959. (formerly *note
     RuntimeError: 317.), this exception class is raised when one of the
     workers of a *note ProcessPoolExecutor: 211. 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: f6. See *note
below: 395e.

参考
....

*note InterpreterPoolExecutor: 471.

     Combines threads with interpreters in a familiar interface.

*note 拡張モジュールを分離する: 419.

     How to update an extension module to support multiple interpreters.

PEP 554(2)

PEP 734(3)

PEP 684(4)

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

* Menu:

* Key details::
* はじめに: はじめに<10>.
* リファレンス: リファレンス<4>.
* 基本的な使い方: 基本的な使い方<3>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: 3960., 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: 3960. 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: 3965.for that though.  There is another dedicated helper
for calling the builtin *note exec(): 190. in an interpreter.

When *note exec(): 190. (or *note eval(): 18f.) 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: 418, 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: 174d. implementation, available through *note
create_queue(): 3968.


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: 418.  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: a6a.

   * *note bool: 5f6. (*note True: fd0. and *note False: ef9.)

   * *note bytes: 1d2.

   * *note str: 1ea.

   * *note int: 32e.

   * *note float: 32f.

   * *note tuple: 1d9. (of similarly supported objects)

There is a small number of Python types that actually share mutable data
between interpreters:

   * *note memoryview: 1dd.

   * *note Queue: 396b.


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: 4e0. of *note Interpreter: 396e. objects, one
     for each existing interpreter.

 -- の関数: concurrent.interpreters.get_current ()

     Return an *note Interpreter: 396e. object for the currently running
     interpreter.

 -- の関数: concurrent.interpreters.get_main ()

     Return an *note Interpreter: 396e. object for the main interpreter.
     This is the interpreter the runtime created to run the *note REPL:
     6a3. 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: 396e. object for it.

 -- の関数: concurrent.interpreters.create_queue ()

     Initialize a new cross-interpreter queue and return a *note Queue:
     396b. object for it.

* Menu:

* Interpreter objects::
* 例外: 例外<14>.
* Communicating Between Interpreters::


File: python.info,  Node: Interpreter objects,  Next: 例外<14>,  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(): 1a15. 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: 3969.

      -- メソッド: 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: 例外<14>,  Next: Communicating Between Interpreters,  Prev: Interpreter objects,  Up: リファレンス<4>

5.19.6.10 例外
..............

 -- 例外: concurrent.interpreters.InterpreterError

     This exception, a subclass of *note Exception: da2, is raised when
     an interpreter-related error happens.

 -- 例外: concurrent.interpreters.InterpreterNotFoundError

     This exception, a subclass of *note InterpreterError: 397a, is
     raised when the targeted interpreter no longer exists.

 -- 例外: concurrent.interpreters.ExecutionFailed

     This exception, a subclass of *note InterpreterError: 397a, 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: 29c, is raised when
     an object cannot be sent to another interpreter.


File: python.info,  Node: Communicating Between Interpreters,  Prev: 例外<14>,  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: 174d. interface.  The underlying
     queue can only be created through *note create_queue(): 3968.

     Some objects are actually shared and some are copied efficiently,
     but most are copied via *note pickle: ab.  See *note "Sharing"
     Objects: 3969.

      -- の属性: id

          (read-only)

          The queue's ID.

 -- 例外: concurrent.interpreters.QueueEmptyError

     This exception, a subclass of *note queue.Empty: 38cb, 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: 38cc, 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: 234c.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 246c. と *note
WebAssemblyプラットフォーム: 1d86. をサポートしません。

* 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/main/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(): f49. 関数を使用することです。より高度な用法では下層の *note
Popen: 6c5. インターフェースを直接使用することもできます。

 -- の関数: 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: 1227. インスタンスを返します。

     上記の引数は、もっともよく使われるものだけ示しており、後述の *note
     よく使われる引数: 3987. で説明されています (そのためここではキーワ
     ード専用引数の表記に省略されています)。関数の完全な使用法を説明して
     も大部分が *note Popen: 6c5. コンストラクターの内容と同じになります
     - この関数のほとんどの引数は ‘Popen’ インターフェイスに渡されます。
     ('timeout'、'input' および 'check' は除く。)

     If 'capture_output' is true, stdout and stderr will be captured.
     When used, the internal *note Popen: 6c5. object is automatically
     created with 'stdout' and 'stderr' both set to *note PIPE: f4a.
     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: 3988, instead of using 'capture_output'.

     A 'timeout' may be specified in seconds, it is internally passed on
     to *note Popen.communicate(): 19cb.  If the timeout expires, the
     child process will be killed and waited for.  The *note
     TimeoutExpired: 19cc. 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(): 19cb.
     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: 6c5. object
     is automatically created with 'stdin' set to *note PIPE: f4a, and
     the 'stdin' argument may not be used as well.

     'check' に真を指定した場合、プロセスが非ゼロの終了コードで終了する
     と *note CalledProcessError: 16de. 例外が送出されます。 この例外の
     属性には、引数、終了コード、標準出力および標準エラー出力が捕捉でき
     た場合に格納されます。

     'encoding' または 'errors' 引数が指定されるか、'text' 引数が true で
     ある場合、stdin, stdout および stderr のためのファイルオブジェクト
     はテキストモードでオープンされます。 その際には指定された
     'encoding' および 'errors' が使われるか、デフォルトの *note
     io.TextIOWrapper: ba0. になります。'universal_newlines' 引数は
     'text' 引数と等価であり、後方互換性のために提供されています。そうで
     ない場合、デフォルトでこれらのファイルオブジェクトはバイナリモード
     でオープンされます。

     'env' が ‘None’ 以外の場合、これは新しいプロセスでの環境変数を定義
     します。デフォルトでは、子プロセスは現在のプロセスの環境変数を引き
     継ぎます。 *note Popen: 6c5. に直接渡されます。あらゆるプラットフォ
     ームで *note os.environ: 4ec. のように文字列から文字列へ、またPOSIX
     プラットフォームにおいては *note os.environb: 4ed. のようにバイトか
     らバイトへも、定義すること出来ます。

     例:

          >>> 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(): f49. の戻り値。プロセスが終了したことを表します。

      -- の属性: args

          プロセスを起動するときに使用された引数。1 個のリストか 1 個の
          文字列になります。

      -- の属性: returncode

          子プロセスの終了コード。一般に、終了ステータス 0 はプロセスが
          正常に終了したことを示します。

          負の値 ‘-N’ は子プロセスがシグナル ‘N’ により中止させられたこ
          とを示します (POSIX のみ)。

      -- の属性: stdout

          子プロセスから補足された標準出力です。バイト列、もしくは *note
          run(): f49. でエンコーディングが指定された場合、エラーの場合、
          text=True が指定された場合は文字列です。標準出力が補足できなか
          ったら ‘None’ になります。

          プロセスが ‘stderr=subprocess.STDOUT’ で実行された場合、標準出
          力と標準エラー出力が混合されたものがこの属性に格納され、*note
          stderr: 398c. は ‘None’ になります。

      -- の属性: stderr

          子プロセスから補足された標準エラー出力です。バイト列、もしくは
          *note run(): f49. でエンコーディングが指定された場合、エラーの
          場合、text=True が指定された場合は文字列です。標準エラー出力が
          補足できなかったら ‘None’ になります。

      -- メソッド: check_returncode ()

          *note returncode: 398a. が非ゼロの場合、*note
          CalledProcessError: 16de. が送出されます。

     Added in version 3.5.

 -- データ: subprocess.DEVNULL

     *note Popen: 6c5. の 'stdin', 'stdout', 'stderr' 引数に渡して、標準
     入出力を *note os.devnull: 2021. から入出力するように指定するための
     特殊値です。

     Added in version 3.3.

 -- データ: subprocess.PIPE

     *note Popen: 6c5. の 'stdin', 'stdout', 'stderr' 引数に渡して、標準
     ストリームに対するパイプを開くことを指定するための特殊値です。*note
     Popen.communicate(): 19cb. に非常に有用です。

 -- データ: subprocess.STDOUT

     *note Popen: 6c5. の 'stderr' 引数に渡して、標準エラー出力が標準出
     力と同じハンドルに出力されるように指定するための特殊値です。

 -- 例外: subprocess.SubprocessError

     このモジュールの他のすべての例外のための基底クラスです。

     Added in version 3.3.

 -- 例外: subprocess.TimeoutExpired

     *note SubprocessError: 398e. のサブクラスです。子プロセスの終了を待
     機している間にタイムアウトが発生した場合に送出されます。

      -- の属性: cmd

          子プロセスの生成に使用されるコマンド本文。

      -- の属性: timeout

          タイムアウト秒数。

      -- の属性: output

          *note run(): f49. にまたは *note check_output(): 1370. によっ
          て捕捉された場合は、子プロセスの出力となり、それ以外の場合は
          ‘None’ となります。‘text=True’ の設定に関係なく、出力が捕捉さ
          れた場合は常に *note bytes: 1d2. となります。出力がない場合は
          ‘b''’ の代わりに''None'' のままになることがあります。

      -- の属性: stdout

          output の別名。*note stderr: 3993. と対になります。

      -- の属性: stderr

          *note run(): f49. によって捕捉された場合、子プロセスの標準エラ
          ー出力が表示され、それ以外の場合は ‘None’ となります。
          ‘text=True’ の設定に関係なく、標準エラー出力を捕捉した場合は常
          に *note bytes: 1d2. となります。標準エラー出力がない場合は、
          ‘b''’ の代わりに ‘None’ のままになることがあります。

     Added in version 3.3.

     バージョン 3.5 で変更: 属性 'stdout' および 'stderr' が追加されまし
     た。

 -- 例外: subprocess.CalledProcessError

     *note SubprocessError: 398e. のサブクラスです。*note check_call():
     3994. または *note check_output(): 1370. 、 ‘check=True’ であるとき
     の *note run(): f49. 、によって実行されたプロセスが非ゼロの終了ステ
     ータスを返した場合に送出されます。

      -- の属性: returncode

          子プロセスの終了ステータスです。もしプロセスがシグナルによって
          終了したなら、これは負のシグナル番号になります。

      -- の属性: cmd

          子プロセスの生成に使用されるコマンド本文。

      -- の属性: output

          *note run(): f49. または *note check_output(): 1370. によって
          捕捉された子プロセスの出力。捕捉されなかったら ‘None’ になりま
          す。

      -- の属性: stdout

          output の別名。*note stderr: 3999. と対になります。

      -- の属性: stderr

          *note run(): f49. によって捕捉された子プロセスの標準エラー出力
          。捕捉されなかったら ‘None’ になります。

     バージョン 3.5 で変更: 属性 'stdout' および 'stderr' が追加されまし
     た。

* Menu:

* よく使われる引数::
* Popen コンストラクター::
* 例外: 例外<15>.


File: python.info,  Node: よく使われる引数,  Next: Popen コンストラクター,  Up: Using the subprocess Module

5.19.7.2 よく使われる引数
.........................

幅広い使用例をサポートするために、*note Popen: 6c5. コンストラクター (と
その他の簡易関数) は、多くのオプション引数を受け付けます。一般的な用法に
ついては、これらの引数の多くはデフォルト値のままで問題ありません。通常必
要とされる引数は以下の通りです:

     'args' はすべての呼び出しに必要で、文字列あるいはプログラム引数のシ
     ーケンスでなければなりません。一般に、引数のシーケンスを渡す方が望
     ましいです。なぜなら、モジュールが必要な引数のエスケープやクオート
     (例えばファイル名中のスペースを許すこと) の面倒を見ることができるた
     めです。単一の文字列を渡す場合、'shell' は *note True: fd0. でなけ
     ればなりません (以下を参照)。もしくは、その文字列は引数を指定せずに
     実行される単なるプログラムの名前でなければなりません。

     '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: f4a, *note
     DEVNULL: 150e, an existing file descriptor (a positive integer),
     and an existing *note file object: 1581. 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: 2021. will be used.  Additionally, 'stderr' can be
     *note STDOUT: 3988, 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: ba0.

     'stdin' については、入力での行末文字 ‘'\n'’ はデフォルトの行セパレ
     ーター *note os.linesep: 27f4. に変換されます。'stdout' と 'stderr'
     については、出力での行末はすべて ‘'\n'’ に変換されます。詳細は
     *note io.TextIOWrapper: ba0. クラスのドキュメントでコンストラクター
     の引数 '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: 399b.、*note
          Popen.stdout: 399c. ならびに *note Popen.stderr: 399d. の改行
          属性は *note Popen.communicate(): 19cb. メソッドで更新されませ
          ん。

     'shell' が ‘True’ なら、指定されたコマンドはシェルによって実行され
     ます。あなたが Python を主として (ほとんどのシステムシェル以上の) 強
     化された制御フローのために使用していて、さらにシェルパイプ、ファイ
     ル名ワイルドカード、環境変数展開、‘~’ のユーザーホームディレクトリ
     への展開のような他のシェル機能への簡単なアクセスを望むなら、これは
     有用かもしれません。しかしながら、Python 自身が多くのシェル的な機能
     の実装を提供していることに注意してください (特に *note glob: 67,
     *note fnmatch: 5f, *note os.walk(): 8be, *note
     os.path.expandvars(): 1792, *note os.path.expanduser(): ddc, *note
     shutil: cd.)。

     バージョン 3.3 で変更: 'universal_newlines' が ‘True’ の場合、クラ
     スはエンコーディング ‘locale.getpreferredencoding()’ の代わりに
     *note locale.getpreferredencoding(False): 94c. を使用します。この変
     更についての詳細は、 *note io.TextIOWrapper: ba0. クラスを参照して
     ください。

          注釈: ‘shell=True’ を使う前に *note
          セキュリティで考慮すべき点: 399e. を読んでください。

これらのオプションは、他のすべてのオプションとともに *note Popen: 6c5. コ
ンストラクターのドキュメントの中でより詳細に説明されています。


File: python.info,  Node: Popen コンストラクター,  Next: 例外<15>,  Prev: よく使われる引数,  Up: Using the subprocess Module

5.19.7.3 Popen コンストラクター
...............................

このモジュールの中で、根底のプロセス生成と管理は *note Popen: 6c5. クラ
スによって扱われます。簡易関数によってカバーされないあまり一般的でないケ
ースを開発者が扱えるように、‘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(): 332c.
     のような挙動を使用します。Windows においては、このクラスは Windows
     の ‘CreateProcess()’ 関数を使用します。*note Popen: 6c5. への引数は
     以下の通りです。

     'args' はプログラム引数のシーケンスか、単一の文字列または *note
     path-like object: 7a5. でなければなりません。デフォルトでは、'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(): 8c9.  On all platforms, passing
          *note sys.executable: 3b4. 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(): 332c, 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(): 94e. 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
     における引数シーケンスから文字列への変換: 39a0. に記述された方法で
     文字列に変換されます。これは根底の ‘CreateProcess()’ が文字列上で動
     作するからです。

     バージョン 3.6 で変更: 'args' parameter accepts a *note path-like
     object: 7a5. if 'shell' is ‘False’ and a sequence containing
     path-like objects on POSIX.

     バージョン 3.8 で変更: 'args' parameter accepts a *note path-like
     object: 7a5. 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: 6c5. と等価ということです:

          Popen(['/bin/sh', '-c', args[0], args[1], ...])

     Windows で ‘shell=True’ とすると、 ‘COMSPEC’ 環境変数がデフォルトシ
     ェルを指定します。Windows で ‘shell=True’ を指定する必要があるのは
     、実行したいコマンドがシェルに組み込みの場合だけです (例えば ‘dir’
     や ‘copy’)。バッチファイルやコンソールベースの実行ファイルを実行す
     るために ‘shell=True’ は必要ありません。

          注釈: ‘shell=True’ を使う前に *note
          セキュリティで考慮すべき点: 399e. を読んでください。

     'bufsize' は標準入力/標準出力/標準エラー出力パイプファイルオブジェ
     クトを生成するときに *note open(): 333. 関数の対応する引数に渡され
     ます:

        - ‘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: 7a5. を受け付けるようになりました。

     バージョン 3.8 で変更: 'executable' 引数が Windows で *note
     path-like object: 7a5. を受け付けるようになりました。

     バージョン 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: f4a, *note
     DEVNULL: 150e, an existing file descriptor (a positive integer),
     and an existing *note file object: 1581. 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: 2021. will be used.  Additionally, 'stderr' can be
     *note STDOUT: 3988, 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(): 1fc9. or *note os.setpgid(): 325a. 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: 317.  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 ファイル記述子の継承: 12ad.

     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: fd1, or
     by standard handle redirection.

     バージョン 3.2 で変更: 'close_fds' のデフォルトは、*note False:
     ef9. から上記のものに変更されました。

     バージョン 3.7 で変更: On Windows the default for 'close_fds' was
     changed from *note False: ef9. to *note True: fd0. 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: fd0. になります。(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: 7a5. 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: 7a5. を受け付けるようになりました。

     バージョン 3.7 で変更: 'cwd' 引数が Windows で *note path-like
     object: 7a5. を受け付けるようになりました。

     バージョン 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: 234c.: 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: 234c.: 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(): 39a1. and the value in ‘gr_gid’ will be used.  If
     the value is an integer, it will be passed verbatim.  (POSIX only)

     *note Availability: 234c.: 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(): 39a1. and the values in ‘gr_gid’ will be
     used.  Integer values will be passed verbatim.  (POSIX only)

     *note Availability: 234c.: 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(): 39a2. 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: 234c.: 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: 234c.: POSIX

     Added in version 3.9.

     'env' が ‘None’ 以外の場合、これは新しいプロセスでの環境変数を定義
     します。デフォルトでは、子プロセスは現在のプロセスの環境変数を引き
     継ぎます。あらゆるプラットフォームで *note os.environ: 4ec. のよう
     に文字列から文字列へ、またPOSIX プラットフォームにおいては *note
     os.environb: 4ed. のようにバイトからバイトへも、定義すること出来ま
     す。

          注釈: 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 よく使われる引数: 3987.  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: 39a3. 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: 39a4.

        * *note CREATE_NEW_PROCESS_GROUP: 39a5.

        * *note ABOVE_NORMAL_PRIORITY_CLASS: 39a6.

        * *note BELOW_NORMAL_PRIORITY_CLASS: 39a7.

        * *note HIGH_PRIORITY_CLASS: 39a8.

        * *note IDLE_PRIORITY_CLASS: 39a9.

        * *note NORMAL_PRIORITY_CLASS: 39aa.

        * *note REALTIME_PRIORITY_CLASS: 39ab.

        * *note CREATE_NO_WINDOW: 39ac.

        * *note DETACHED_PROCESS: 39ad.

        * *note CREATE_DEFAULT_ERROR_MODE: 39ae.

        * *note CREATE_BREAKAWAY_FROM_JOB: 39af.

     'pipesize' can be used to change the size of the pipe when *note
     PIPE: f4a. 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: 215. 文によってコンテキストマネー
     ジャーとしてサポートされます: 終了時には標準ファイル記述子が閉じら
     れ、プロセスを待機します:

          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: 1e84. ‘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: 754. warning if the child process is still
     running.

     バージョン 3.8 で変更: Popen can use *note os.posix_spawn(): 736.
     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: e56.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Side-by-Side_Assembly


File: python.info,  Node: 例外<15>,  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: 543.  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: 6c5. が呼ばれた場合は *note ValueError: 15a. が
発生します。

呼び出されたプロセスが非ゼロのリターンコードを返した場合 *note
check_call(): 3994. や *note check_output(): 1370. は *note
CalledProcessError: 16de. を送出します。

All of the functions and methods that accept a 'timeout' parameter, such
as *note run(): f49. and *note Popen.communicate(): 19cb. will raise
*note TimeoutExpired: 19cc. if the timeout expires before the process
exits.

このモジュールで定義されたすべての例外は *note SubprocessError: 398e. を
継承しています。

Added in version 3.3: *note SubprocessError: 398e. 基底クラスが追加され
ました。


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: 39b2, it is possible to use
*note shlex.quote(): 787. 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: 6c5. クラスのインスタンスには、以下のようなメソッドがありま
す:

 -- メソッド: Popen.poll ()

     子プロセスが終了しているかどうかを調べます。 *note returncode: e56.
     属性を設定して返します。そうでなければ ‘None’ を返します。

 -- メソッド: Popen.wait (timeout=None)

     子プロセスが終了するまで待ちます。*note returncode: e56. 属性を設定
     して返します。

     プロセスが 'timeout' 秒後に終了してない場合、*note TimeoutExpired:
     19cc. 例外を送出します。この例外を捕捉して wait を再試行するのは安
     全です。

          注釈: ‘stdout=PIPE’ や ‘stderr=PIPE’ を使っていて、より多くの
          データを受け入れるために OS のパイプバッファーをブロックしてい
          るパイプに子プロセスが十分な出力を生成した場合、デッドロックが
          発生します。これを避けるには *note Popen.communicate(): 19cb.
          を使用してください。

          注釈: When ‘timeout’ is not ‘None’ and the platform supports
          it, an efficient event-driven mechanism is used to wait for
          process termination:

             - Linux >= 5.3 uses *note os.pidfd_open(): 273. + *note
               select.poll(): 274.

             - macOS and other BSD variants use *note select.kqueue():
               275. + ‘KQ_FILTER_PROC’ + ‘KQ_NOTE_EXIT’

             - Windows uses ‘WaitForSingleObject’

          If none of these mechanisms are available, the function falls
          back to 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: e3e.

     バージョン 3.3 で変更: 'timeout' が追加されました

     バージョン 3.15 で変更: if 'timeout' is not ‘None’, use efficient
     event-driven implementation on Linux >= 5.3 and macOS / BSD.

 -- メソッド: 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: e56. 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: 19cc. 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: 19cc,
     do not call *note wait(): 272.  Use an additional ‘communicate()’
     call to finish handling pipes and populate the *note returncode:
     e56. attribute.

          注釈: 受信したデータはメモリにバッファーされます。そのため、返
          されるデータが大きいかあるいは制限がないような場合はこのメソッ
          ドを使うべきではありません。

     バージョン 3.3 で変更: 'timeout' が追加されました

 -- メソッド: Popen.send_signal (signal)

     'signal' シグナルを子プロセスに送ります。

     Do nothing if the process completed.

          注釈: Windows では、SIGTERM は *note terminate(): 1795. の別名
          です。CTRL_C_EVENT と CTRL_BREAK_EVENT を、
          ‘CREATE_NEW_PROCESS_GROUP’ を含む 'creationflags' で始まった、
          プロセスに送れます。

 -- メソッド: Popen.terminate ()

     Stop the child.  On POSIX OSs the method sends *note SIGTERM: 1798.
     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(): 1796. は *note
     terminate(): 1795. の別名です。

The following attributes are also set by the class for you to access.
Reassigning them to new values is unsupported:

 -- の属性: Popen.args

     *note Popen: 6c5. に渡された引数 'args' です - プログラム引数のシー
     ケンスまたは 1 個の文字列になります。

     Added in version 3.3.

 -- の属性: Popen.stdin

     If the 'stdin' argument was *note PIPE: f4a, this attribute is a
     writeable stream object as returned by *note open(): 333.  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: f4a, this attribute is a
     readable stream object as returned by *note open(): 333.  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: f4a, this attribute is a
     readable stream object as returned by *note open(): 333.  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: 399b, *note .stdout.read: 399c, *note
     .stderr.read: 399d. を利用すると、別のパイプの OS パイプバッファー
     がいっぱいになってデッドロックが発生する恐れがあります。これを避け
     るためには *note communicate(): 19cb. を利用してください。

 -- の属性: Popen.pid

     子プロセスのプロセス ID が入ります。

     'shell' 引数を ‘True’ に設定した場合は、生成されたシェルのプロセス
     ID になります。

 -- の属性: Popen.returncode

     The child return code.  Initially ‘None’, *note returncode: e56. is
     set by a call to the *note poll(): 39b4, *note wait(): 272, or
     *note communicate(): 19cb. 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: 39a3. クラスと以下の定数は、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: 6c5. creation.  The following attributes can be set by
     passing them as keyword-only arguments.

     バージョン 3.7 で変更: キーワード専用引数のサポートが追加されました
     。

      -- の属性: dwFlags

          特定の *note STARTUPINFO: 39a3. の属性が、プロセスがウィンドウ
          を生成するときに使われるかを決定するビットフィールドです:

               si = subprocess.STARTUPINFO()
               si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW

      -- の属性: hStdInput

          *note dwFlags: 39b8. が *note STARTF_USESTDHANDLES: 39ba. を指
          定すれば、この属性がプロセスの標準入力処理です。
          ‘STARTF_USESTDHANDLES’ が指定されなければ、標準入力のデフォル
          トはキーボードバッファーです。

      -- の属性: hStdOutput

          *note dwFlags: 39b8. が *note STARTF_USESTDHANDLES: 39ba. を指
          定すれば、この属性がプロセスの標準出力処理です。そうでなければ
          、この属性は無視され、標準出力のデフォルトはコンソールウィンド
          ウのバッファーです。

      -- の属性: hStdError

          *note dwFlags: 39b8. が *note STARTF_USESTDHANDLES: 39ba. を指
          定すれば、この属性がプロセスの標準エラー処理です。そうでなけれ
          ば、この属性は無視され、標準エラー出力のデフォルトはコンソール
          ウィンドウのバッファーです。

      -- の属性: wShowWindow

          *note dwFlags: 39b8. が *note STARTF_USESHOWWINDOW: 39be. を指
          定すれば、この属性は ShowWindow(2) 関数の ‘nCmdShow’ 引数で指
          定された値なら、 ‘SW_SHOWDEFAULT’ 以外の任意のものにできます。
          しかし、この属性は無視されます。

          この属性には *note SW_HIDE: 39bf. が提供されています。これは、
          *note Popen: 6c5. が ‘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(): 12b1. when passed to the
               *note Popen: 6c5. constructor, else *note OSError: 543.
               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(): 1815.  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: 39b9, *note
     STARTUPINFO.hStdOutput: 39bb, および *note STARTUPINFO.hStdError:
     39bc. 属性を指定します。

 -- データ: subprocess.STARTF_USESHOWWINDOW

     追加情報を保持する、 *note STARTUPINFO.wShowWindow: 39bd. 属性を指
     定します。

 -- データ: subprocess.STARTF_FORCEONFEEDBACK

     A *note STARTUPINFO.dwFlags: 39b8. 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: 39b8. 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: 6c5.
     ‘creationflags’ パラメーターです。このフラグは、サブプロセスで
     *note os.kill(): 1721. を使うのに必要です。

     *note CREATE_NEW_CONSOLE: 39a4. が指定されていたら、このフラグは無
     視されます。

 -- データ: subprocess.ABOVE_NORMAL_PRIORITY_CLASS

     A *note Popen: 6c5. ‘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: 6c5. ‘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: 6c5. ‘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: 6c5. ‘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: 6c5. ‘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: 6c5. ‘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: 6c5. ‘creationflags’ parameter to specify that a new
     process will not create a window.

     Added in version 3.7.

 -- データ: subprocess.DETACHED_PROCESS

     A *note Popen: 6c5. ‘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: 6c5. ‘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: 6c5. ‘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():
f49. の使用で済みますが、既存の多くのコードではこれらの関数が使用されて
います。

 -- の関数: subprocess.call (args, *, stdin=None, stdout=None,
          stderr=None, shell=False, cwd=None, timeout=None,
          **other_popen_kwargs)

     'args' で指定されたコマンドを実行します。コマンドの終了を待ち、
     *note returncode: e56. 属性を返します。

     Code needing to capture stdout or stderr should use *note run():
     f49. instead:

          run(...).returncode

     To suppress stdout or stderr, supply a value of *note DEVNULL:
     150e.

     上記の引数は、よく使われるものだけ示しています。関数の全使用法は
     *note Popen: 6c5. コンストラクターの内容と同じになります - この関数
     は、このインターフェースに直接指定される '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: 16de.  The ‘CalledProcessError’ object will
     have the return code in the *note returncode: 3995. 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():
     f49. instead:

          run(..., check=True)

     To suppress stdout or stderr, supply a value of *note DEVNULL:
     150e.

     上記の引数は、よく使われるものだけ示しています。関数の全使用法は
     *note Popen: 6c5. コンストラクターの内容と同じになります - この関数
     は、このインターフェースに直接指定される '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:
     16de. 例外が送出されます。‘CalledProcessError’ オブジェクトには、リ
     ターンコードが *note returncode: 3995. 属性に、コマンドからの出力が
     *note output: 3997. 属性に、それぞれ格納されています。

     これは次と等価です:

          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(): f49.
     - 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
     よく使われる引数: 3987. and *note run(): f49.

     標準エラー出力も結果に含めるには、‘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(): f49. 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: 543. 例外を送出します。

     また、要求された操作が非ゼロの終了コードを返した場合、*note
     check_output(): 1370. を使用した置き換えは *note
     CalledProcessError: 16de. で失敗します。その出力は、送出された例外
     の *note output: 3997. 属性として利用可能です。

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(): f4b. return value is encoded differently to that
     of *note os.system(): 1815.

   * The *note os.system(): 1815. 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():
     1370. and return a 2-tuple ‘(exitcode, output)’.  'encoding' and
     'errors' are used to decode output; see the notes on *note
     よく使われる引数: 3987. 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: 234c.: 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: e56.

     バージョン 3.11 で変更: 'encoding' と 'errors' が引数に追加されまし
     た。

 -- の関数: subprocess.getoutput (cmd, *, encoding=None, errors=None)

     シェル中の 'cmd' を実行して出力 (stdout と stderr) を返します。

     *note getstatusoutput(): 1372. に似ていますが、終了コードは無視され
     、コマンドの出力のみを返します。例えば:

          >>> subprocess.getoutput('ls /bin/ls')
          '/bin/ls'

     *note Availability: 234c.: 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(): f49,
*note Popen.wait(): 272, or *note Popen.communicate(): 19cb, 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: 19cc. 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: cc.

     コマンドラインを解析したりエスケープしたりする関数を提供するモジュ
     ール。


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: 14e8. クラスはイベントをスケジュールするための一般
     的なインターフェースを定義します。それは "外の世界" を実際に扱うた
     めの2つの関数を必要とします -- 'timefunc' は引数なしで呼ばれて 1 つ
     の数値を返す callable オブジェクトでなければなりません (戻り値は任
     意の単位で「時間」を表します)。 'delayfunc' は 1 つの引数を持つ
     callable オブジェクトでなければならず、その時間だけ遅延する必要があ
     ります (引数は 'timefunc' の出力と互換)。 'delayfunc' は、各々のイ
     ベントが実行された後に引数 ‘0’ で呼ばれることがあります。これは、マ
     ルチスレッドアプリケーションの中で他のスレッドが実行する機会を与え
     るためです。

     バージョン 3.3 で変更: 'timefunc' と 'delayfunc' がオプション引数に
     なりました。

     バージョン 3.3 で変更: *note scheduler: 14e8. クラスをマルチスレッ
     ド環境で安全に使用出来るようになりました。

以下はプログラム例です:

     >>> 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/main/Lib/sched.py


File: python.info,  Node: スケジューラオブジェクト,  Up: sched --- イベントスケジューラー

5.19.8.1 スケジューラオブジェクト
.................................

*note scheduler: 14e8. インスタンスは以下のメソッドと属性を持っています:

 -- メソッド: scheduler.enterabs (time, priority, action, argument=(),
          kwargs={})

     新しいイベントをスケジュールします。 引数 'time' は、コンストラクタ
     へ渡された 'timefunc' の戻り値と互換な数値型でなければいけません。
     同じ 'time' によってスケジュールされたイベントは、それらの
     'priority' によって実行されます。 数値の小さい方が高い優先度となり
     ます。

     イベントを実行することは、 ‘action(*argument, **kwargs)’ を実行する
     ことを意味します。 'argument' は 'action' のための位置引数を保持す
     るシーケンスでなければいけません。 'kwargs' は 'action' のためのキ
     ーワード引数を保持する辞書でなければいけません。

     戻り値は、後にイベントをキャンセルする時に使われる可能性のあるイベ
     ントです (*note cancel(): 1f0f. を参照)。

     バージョン 3.3 で変更: 'argument' 引数が任意になりました。

     バージョン 3.3 で変更: 'kwargs' 引数が追加されました。

 -- メソッド: scheduler.enter (delay, priority, action, argument=(),
          kwargs={})

     時間単位以上の 'delay' でイベントをスケジュールします。相対的時間以
     外の、引数、効果、戻り値は、 *note enterabs(): 14ea. に対するものと
     同じです。

     バージョン 3.3 で変更: 'argument' 引数が任意になりました。

     バージョン 3.3 で変更: 'kwargs' 引数が追加されました。

 -- メソッド: scheduler.cancel (event)

     キューからイベントを消去します。もし 'event' がキューにある現在のイ
     ベントでないならば、このメソッドは *note ValueError: 15a. を送出し
     ます。

 -- メソッド: scheduler.empty ()

     もしイベントキューが空ならば、 ‘True’ を返します。

 -- メソッド: scheduler.run (blocking=True)

     すべてのスケジュールされたイベントを実行します。このメソッドは次の
     イベントを待ち、それを実行し、スケジュールされたイベントがなくなる
     まで同じことを繰り返します。(イベントの待機は、 コンストラクタへ渡
     された関数 'delayfunc' を使うことで行います。)

     'blocking' が False の場合、最も早く期限が来るスケジュールされたイ
     ベントを (存在する場合) 実行し、スケジューラ内で次にスケジュールさ
     れた呼び出しの期限を (存在する場合) 返します。

     'action' あるいは 'delayfunc' は例外を投げることができます。いずれ
     の場合も、スケジューラは一貫した状態を維持し、例外を伝播するでしょ
     う。例外が 'action' によって投げられる場合、イベントは *note run():
     14e7. への呼出しを未来に行なわないでしょう。

     イベントのシーケンスが、次イベントの前に、利用可能時間より実行時間
     が長いと、スケジューラは単に遅れることになるでしょう。イベントが落
     ちることはありません; 呼出しコードはもはや適切でないキャンセルイベ
     ントに対して責任があります。

     バージョン 3.3 で変更: 'blocking' 引数が追加されました。

 -- の属性: scheduler.queue

     読み出し専用の属性で、これから起こるイベントが実行される順序で格納
     されたリストを返します。各イベントは、次の属性 time, priority,
     action, argument, kwargs を持った *note named tuple: a42. の形式に
     なります。


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: 174d. class
in this module implements all the required locking semantics.

このモジュールでは3種類のキューが実装されています。それらはキューから取
り出されるエントリの順番だけが違います。 FIFO キューでは、最初に追加され
たエントリが最初に取り出されます。 LIFO キューでは、最後に追加されたエン
トリが最初に取り出されます(スタックのように振る舞います)。 優先順位付き
キュー(priority queue)では、エントリは(*note heapq: 6c. モジュールを利用
して)ソートされ、 最も低い値のエントリが最初に取り出されます。

内部的には、これらの3種類のキューは競争スレッドを一時的にブロックするた
めにロックを使っています; しかし、スレッド内での再入を扱うようには設計さ
れていません。

In addition, the module implements a "simple" FIFO queue type, *note
SimpleQueue: f2b, whose specific implementation provides additional
guarantees in exchange for the smaller functionality.

The ‘queue’ module defines the following classes and exceptions:

 -- クラス: queue.Queue (maxsize=0)

     FIFO キューのコンストラクタです。 'maxsize' はキューに入れられる要
     素数の上限を設定する整数です。 いったんこの大きさに達したら、挿入処
     理はキューの要素が消費されるまでブロックされます。 'maxsize' が0以
     下の場合は、キューの大きさは無限です。

 -- クラス: queue.LifoQueue (maxsize=0)

     LIFO キューのコンストラクタです。 'maxsize' はキューに入れられる要
     素数の上限を設定する整数です。 いったんこの大きさに達したら、挿入処
     理はキューの要素が消費されるまでブロックされます。 'maxsize' が0以
     下の場合は、キューの大きさは無限です。

 -- クラス: queue.PriorityQueue (maxsize=0)

     優先順位付きキューのコンストラクタです。'maxsize' はキューに置くこ
     とのできる要素数の上限を設定する整数です。いったんこの大きさに達し
     たら、挿入はキューの要素が消費されるまでブロックされます。もし
     'maxsize' が0以下であるならば、キューの大きさは無限です。

     最小の値を持つ要素が最初に検索されます (最小の値を持つ値は、
     ‘min(entries)’ によって返されるものです)。典型的な要素のパターンは
     、‘(priority_number, data)’ 形式のタプルです。

     If the 'data' elements are not comparable, the data can be wrapped
     in a class that ignores the data item and only compares the
     priority number:

          from dataclasses import dataclass, field
          from typing import Any

          @dataclass(order=True)
          class PrioritizedItem:
              priority: int
              item: Any=field(compare=False)

 -- クラス: queue.SimpleQueue

     Constructor for an unbounded FIFO queue.  Simple queues lack
     advanced functionality such as task tracking.

     Added in version 3.7.

 -- 例外: queue.Empty

     空の *note Queue: 174d. オブジェクトで、非ブロックメソッド *note
     get(): 3432. (または *note get_nowait(): 39df.) が呼ばれたとき、送
     出される例外です。

 -- 例外: queue.Full

     満杯の *note Queue: 174d. オブジェクトで、非ブロックメソッド *note
     put(): 39e0. (または *note put_nowait(): 3431.) が呼ばれたとき、送
     出される例外です。

 -- 例外: queue.ShutDown

     Exception raised when *note put(): 39e0. or *note get(): 3432. is
     called on a *note Queue: 174d. object which has been shut down.

     Added in version 3.13.

* Menu:

* キューオブジェクト::
* SimpleQueue オブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/queue.py


File: python.info,  Node: キューオブジェクト,  Next: SimpleQueue オブジェクト,  Up: queue --- 同期キュークラス

5.19.9.1 キューオブジェクト
...........................

キューオブジェクト(*note Queue: 174d, *note LifoQueue: 28ca, *note
PriorityQueue: 28cb.)は、以下の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: 38cc. を送出します。 そうでない場
     合 ('block' が偽) は、空きスロットが直ちに利用できるならば、キュー
     にアイテムを置きます。 できないならば、例外 ‘Full’ を送出します (こ
     の場合 'timeout' は無視されます)。

     Raises *note ShutDown: 74b. 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:
     38cb. を送出します。 そうでない場合 ('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: d9a.

     Raises *note ShutDown: 74b. 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(): 3432. の後に *note task_done(): 38c7. を呼び出すと、取り出し
     たタスクに対する処理が完了した事をキューに教えます。

     *note join(): 38c8. がブロックされていた場合、全itemが処理された (キ
     ューに *note put(): 39e0. された全てのitemに対して *note
     task_done(): 38c7. が呼び出されたことを意味します) 時に復帰します。

     キューにある要素より多く呼び出された場合 *note ValueError: 15a. が
     発生します。

 -- メソッド: Queue.join ()

     キューにあるすべてのアイテムが取り出されて処理されるまでブロックし
     ます。

     未完了のタスクのカウント値はキューにアイテムが追加されるときは常に
     加算され、コンシューマースレッドが *note task_done(): 38c7. を呼び
     出してアイテムの回収とその全処理の完了が示されるときは常に減算され
     ます。未完了のタスクのカウント値がゼロになった場合、*note join():
     38c8. のブロックが解除されます。

* 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: 174d. objects can be wound down
until empty or terminated immediately with a hard shutdown.

 -- メソッド: Queue.shutdown (immediate=False)

     Put a *note Queue: 174d. instance into a shutdown mode.

     The queue can no longer grow.  Future calls to *note put(): 39e0.
     raise *note ShutDown: 74b.  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(): 3432. calls to extract tasks that have
     already been loaded.

     And if *note task_done(): 38c7. is called for each remaining task,
     a pending *note join(): 38c8. will be unblocked normally.

     Once the queue is empty, future calls to *note get(): 3432. will
     raise *note ShutDown: 74b.

     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(): 38c8. are unblocked.  Also,
     blocked callers of *note get(): 3432. are unblocked and will raise
     *note ShutDown: 74b. because the queue is empty.

     Use caution when using *note join(): 38c8. 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: f2b. オブジェクトは以下の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():
     39e0.

     '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: 11d. callbacks.

 -- メソッド: SimpleQueue.put_nowait (item)

     ‘put(item, block=False)’ と等価です。*note Queue.put_nowait():
     3431. との互換性のためのメソッドです。

 -- メソッド: SimpleQueue.get (block=True, timeout=None)

     キューからアイテムを取り除き、それを返します。 オプション引数
     'block' が真で 'timeout' が ‘None’ (デフォルト) の場合は、必要であ
     ればアイテムが取り出せるようになるまでブロックします。 もし
     'timeout' が正の数の場合は、最大で 'timeout' 秒間ブロックし、その時
     間内でアイテムが取り出せるようにならなければ、例外 *note Empty:
     38cb. を送出します。 そうでない場合 ('block' が偽) は、直ちにアイテ
     ムが取り出せるならば、それを返します。 できないならば、例外 ‘Empty’
     を送出します (この場合 'timeout' は無視されます)。

 -- メソッド: SimpleQueue.get_nowait ()

     ‘get(False)’ と等価です。

参考
....

*note multiprocessing.Queue: 1da4. クラス

     (マルチスレッドではなく) マルチプロセスの文脈で使用されるキュークラ
     ス。

*note collections.deque: 9db. is an alternative implementation of
unbounded queues with fast atomic *note append(): 2ba7. and *note
popleft(): 2bad. 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: 1abc. クラスは 'コンテキス
ト変数' を宣言し、取り扱うために使われます。 非同期フレームワークで現時
点のコンテキストを管理するのには、 *note copy_context(): 387d. 関数と
*note Context: 428. クラスを使うべきです。

Context managers that have state should use Context Variables instead of
*note threading.local(): 1aa6. 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(): 39f3. か
     ら返されます。

     '重要:' コンテキスト変数は、モジュールのトップレベルで生成する必要
     があり、クロージャの中で作成すべきではありません。*note Context:
     428. オブジェクトはコンテキスト変数への強参照を持っており、コンテキ
     スト変数がガーベジコレクトされるのを防ぎます。

      -- の属性: name

          変数の名前。読み出し専用のプロパティです。

          Added in version 3.7.1.

      -- メソッド: get ([default])

          現在のコンテキストのコンテキスト変数の値を返します。

          現在のコンテキストのコンテキスト変数に値がなければ、メソッドは
          :

             * メソッドの 'default' 引数に値が指定されていればその値を返
               します。さもなければ

             * コンテキスト変数が生成された時にデフォルト値が渡されてい
               れば、その値を返します。さもなければ

             * *note LookupError: 25f9. を送出します。

      -- メソッド: set (value)

          現在のコンテキストのコンテキスト変数に新しい値を設定する際に呼
          び出します。

          'value' は必須の引数で、コンテキスト変数の新しい値を指定します
          。

          *note Token: 480. オブジェクトを返します。このオブジェクトを
          *note ContextVar.reset(): 39f5. メソッドに渡すことで、以前の値
          に戻すことができます。

          For convenience, the token object can be used as a context
          manager to avoid calling *note ContextVar.reset(): 39f5.
          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(): 19ae. が呼び出される前の値にリセットします。

          例えば:

               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(): 19ae.
     method.  They can be passed to the *note ContextVar.reset(): 39f5.
     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: 2591. to
     automatically reset context variables.  See *note ContextVar.set():
     19ae.

     Added in version 3.14: Added support for usage as a context
     manager.

      -- の属性: var

          読み出し専用のプロパティです。トークンを生成した *note
          ContextVar: 1abc. オブジェクトを指します。

      -- の属性: old_value

          読み出し専用のプロパティです。このトークンを作成した *note
          ContextVar.set(): 19ae. メソッドの呼び出しの前に持っていた値に
          設定されています。もし呼び出しの前に値が設定されていなければ
          *note Token.MISSING: 1a6d. を指します。

      -- の属性: MISSING

          *note Token.old_value: 39f7. で利用されるマーカーオブジェクト
          です。


File: python.info,  Node: マニュアルでのコンテキスト管理,  Next: asyncio サポート,  Prev: コンテキスト変数,  Up: contextvars --- コンテキスト変数

5.19.10.2 マニュアルでのコンテキスト管理
........................................

 -- の関数: contextvars.copy_context ()

     現在の *note Context: 428. オブジェクトのコピーを返します。

     次のスニペットは、現在のコンテキストのコピーを取得し、コンテキスト
     に設定されているすべての変数とその値を表示します:

          ctx: Context = copy_context()
          print(list(ctx.items()))

     この関数の複雑性は 'O'(1) です。つまり、少数のコンテキスト変数を持
     つコンテキストと多くの変数を持つコンテキストで同程度の速度で動作し
     ます。

 -- クラス: contextvars.Context

     ‘ContextVars’ とその値の対応付け。

     ‘Context()’ は、値を持たない空のコンテキストを生成します。現在のコ
     ンテキストのコピーを得るには、*note copy_context(): 387d. 関数を利
     用します。

     Each thread has its own effective stack of ‘Context’ objects.  The
     *note current context: 1b96. 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():
     19ad. 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(): 19ad. 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:
     1abc. objects behave in a similar fashion to *note
     threading.local(): 1aa6. when values are assigned in different
     threads.

     Attempting to enter an already entered context, including contexts
     entered in other threads, raises a *note RuntimeError: 317.

     After exiting a context, it can later be re-entered (from any
     thread).

     Any changes to *note ContextVar: 1abc. values via the *note
     ContextVar.set(): 19ae. method are recorded in the current context.
     The *note ContextVar.get(): 39f3. 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: ca0. インターフェースを
     実装します。

      -- メソッド: 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: 1abc. 'var' の値を返します。コンテキストオブ
          ジェクト内で変数が設定されていない場合は、*note KeyError: 7e5.
          を送出します。

      -- メソッド: 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, it is now possible to get the
         # 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: f6. モジュールは、こ
のモジュール上で、より使い易く高級なスレッディングの API を提供します。

バージョン 3.7 で変更: このモジュールは以前はオプションでしたが、常に利
用可能なモジュールとなりました。

このモジュールでは以下の定数および関数を定義しています:

 -- 例外: _thread.error

     スレッド固有の例外です。

     バージョン 3.3 で変更: 現在は組み込みの *note RuntimeError: 317. の
     別名です。

 -- データ: _thread.LockType

     これはロックオブジェクトのタイプです。

 -- の関数: _thread.start_new_thread (function, args[, kwargs])

     新しいスレッドを開始して、そのIDを返します。スレッドは引数リスト
     'args' (タプルでなければなりません)の関数 'function' を実行します。
     オプション引数 'kwargs' はキーワード引数の辞書を指定します。

     関数が戻るとき、スレッドは静かに終了します。

     When the function terminates with an unhandled exception, *note
     sys.unraisablehook(): 712. 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: 10fb. exception, it is
     silently ignored.

     Raises an *note auditing event: 1e84. ‘_thread.start_new_thread’
     with arguments ‘function’, ‘args’, ‘kwargs’.

     バージョン 3.8 で変更: *note sys.unraisablehook(): 712. 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: 4e6. is simulated.

     If the given signal isn't handled by Python (it was set to *note
     signal.SIG_DFL: 1dcb. or *note signal.SIG_IGN: 1dca.), 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(): 1daa.

 -- の関数: _thread.exit ()

     *note SystemExit: 10fb. を送出します。それが捕えられないときは、静
     かにスレッドを終了させます。

 -- の関数: _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: 234c.: Windows, FreeBSD, Linux, macOS, OpenBSD,
     NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD, Solaris.

     Added in version 3.8.

     バージョン 3.13 で変更: Added support for GNU/kFreeBSD.

     バージョン 3.15 で変更: Added support for Solaris.

 -- の関数: _thread.stack_size ([size])

     新しいスレッドを作るときのスレッドスタックサイズを返します。オプシ
     ョンの 'size' 引数にはこれ以降に作成するスレッドのスタックサイズを
     指定し、0 (プラットフォームのデフォルト値または設定されたデフォルト
     値) か、 32,768 (32 KiB) 以上の正の整数でなければなりません。'size'
     が指定されない場合 0 が使われます。スレッドのスタックサイズの変更が
     サポートされていない場合、 *note RuntimeError: 317. を送出します。
     不正なスタックサイズが指定された場合、 *note ValueError: 15a. を送
     出して、スタックサイズは変更されません。32 KiB は現在のインタープリ
     タ自身のために十分であると保証された最小のスタックサイズです。いく
     つかのプラットフォームではスタックサイズに対して制限があることに注
     意してください。例えば最小のスタックサイズが 32 KiB より大きかった
     り、システムのメモリページサイズ の整数倍の必要があるなどです。この
     制限についてはプラットフォームのドキュメントを参照してください (一
     般的なページサイズは 4 KiB なので、プラットフォームに関する情報がな
     い場合は 4096 の整数倍のスタックサイズを選ぶといいかもしれません)。

     *note Availability: 234c.: Windows, pthreads.

     Unix platforms with POSIX threads support.

 -- データ: _thread.TIMEOUT_MAX

     The maximum value allowed for the 'timeout' parameter of *note
     Lock.acquire: a8c.  Specifying a timeout greater than this value
     will raise an *note OverflowError: c5b.

     Added in version 3.2.

ロックオブジェクトは次のようなメソッドを持っています:

 -- メソッド: lock.acquire (blocking=True, timeout=-1)

     オプションの引数なしで使用すると、このメソッドは他のスレッドがロッ
     クしているかどうかにかかわらずロックを獲得します。ただし、他のスレ
     ッドがすでにロックしている場合には解除されるまで待ってからロックを
     獲得します (同時にロックを獲得できるスレッドはひとつだけであり、こ
     れこそがロックの存在理由です)。

     If the 'blocking' argument is present, the action depends on its
     value: if it is false, the lock is only acquired if it can be
     acquired immediately without waiting, while if it is true, the lock
     is acquired unconditionally as above.

     If the floating-point 'timeout' argument is present and positive,
     it specifies the maximum wait time in seconds before returning.  A
     negative 'timeout' argument specifies an unbounded wait.  You
     cannot specify a 'timeout' if 'blocking' is false.

     なお、ロックを獲得できた場合は ‘True’、できなかった場合は ‘False’ を
     返します。

     バージョン 3.2 で変更: 新しい 'timeout' 引数。

     バージョン 3.2 で変更: POSIX ではロックの取得がシグナルに割り込まれ
     るようになりました。

     バージョン 3.14 で変更: Lock acquires can now be interrupted by
     signals on Windows.

 -- メソッド: lock.release ()

     ロックを解放します。そのロックは既に獲得されたものでなければなりま
     せんが、しかし同じスレッドによって獲得されたものである必要はありま
     せん。

 -- メソッド: lock.locked ()

     ロックの状態を返します: 同じスレッドによって獲得されたものなら
     ‘True’ 、違うのなら ‘False’ を返します。

これらのメソッドに加えて、ロックオブジェクトは *note with: 215. 文を通じ
て以下の例のように使うこともできます。

     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: d9a. exception will be received by that thread.)

   * *note sys.exit(): 506. を呼び出す、あるいは *note SystemExit: 10fb.
     例外を送出することは、 *note _thread.exit(): 3a04. を呼び出すことと
     同じです。

   * メインスレッドが終了したとき、他のスレッドが生き残るかどうかは、シ
     ステムに依存します。多くのシステムでは、 *note try: adb. ...  *note
     finally: 453. 節や、オブジェクトデストラクタを実行せずに終了されま
     す。


File: python.info,  Node: ネットワーク通信とプロセス間通信,  Next: インターネット上のデータの操作,  Prev: 並行実行,  Up: Python 標準ライブラリ

5.20 ネットワーク通信とプロセス間通信
=====================================

この章で解説しているモジュールはネットワーク通信とプロセス間通信の仕組み
を提供しています。

例えば *note signal: ce. や *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: 3a12.

     asyncio の基本が解説されています。

asyncio は次の目的で '高レベル' API を提供しています:

   * 並行に *note Python コルーチンを起動: 3a13. し、実行全体を管理する

   * *note ネットワーク IO と IPC: 19d0. を執り行う

   * *note subprocesses: 3a14. を管理する

   * *note キュー: 3a15. を使ってタスクを分散する

   * 並列処理のコードを *note 同期: 3a16. させる

これに加えて、 'ライブラリやフレームワークの開発者' が次のことをするため
の '低レベル' API があります:

   * *note ネットワーク通信: 3a17. 、 *note サブプロセス: 3a18. の実行、
     *note OS シグナル: 3a19. の取り扱いなどのための非同期 API を提供す
     る *note イベントループ: 1133. の作成と管理を行う

   * *note Transport: 3a1a. を使った効率的な protocol を実装します

   * コールバックを用いたライブラリと async/await 構文を使ったコードの
     *note 橋渡し: 3a1b.

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

asyncio REPL
............

*note REPL: 6a3. で、‘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:
459.  It is recommended that the default REPL is used for full
functionality and the latest features.

引数無しで *note 監査イベント: 1e84. ‘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: 45a. is also executed.  Emits audit events.

リファレンス
............

* Menu:

* Runners::
* Coroutines and tasks::
* ストリーム::
* 同期プリミティブ: 同期プリミティブ<2>.
* サブプロセス::
* キュー::
* 例外: 例外<17>.
* Call Graph Introspection::
* Event loop::
* Future::
* トランスポートとプロトコル::
* ポリシー::
* プラットフォームでのサポート::
* Extending::
* 高水準の API インデックス::
* 低水準の API インデックス::
* asyncio での開発::


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 イベントループ: 1133. の上に構築されており、一般的な広く
普及しているシナリオでの非同期コードの使用を簡素化することを目的としてい
ます。

* Menu:

* 非同期プログラムの実行::
* Runner context manager::
* Handling Keyboard Interruption::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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 デバッグモード: 2347. 設定を尊重するために ‘None’ が使用され
     ます。

     If 'loop_factory' is not ‘None’, it is used to create a new event
     loop; otherwise *note asyncio.new_event_loop(): 3a20. 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:
     1c8c. 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(): cbc.
     メソッドを使うように更新されました。

     バージョン 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: 1133. and *note contextvars.Context: 428.

     'debug' が ‘True’ の場合、イベントループはデバッグモードで実行され
     ます。‘False’ は明示的にデバッグモードを無効化します。 グローバルな
     *note デバッグモード: 2347. 設定を尊重するために ‘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():
     3a20. is used and set as current event loop with *note
     asyncio.set_event_loop(): 1d72. if 'loop_factory' is ‘None’.

     Basically, *note asyncio.run(): 314. 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: 428. 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: 428.

      -- メソッド: 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:
          215. body entering or the first call of *note run(): 314. or
          *note get_loop(): 3a23.


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: 4e6. is raised by ‘Ctrl’-‘C’, *note
KeyboardInterrupt: d9a. 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:
4e6. as follows:

  1. *note asyncio.Runner.run(): 1b81. installs a custom *note
     signal.SIGINT: 4e6. handler before any user code is executed and
     removes it when exiting from the function.

  2. The *note Runner: 315. creates the main task for the passed
     coroutine for its execution.

  3. When *note signal.SIGINT: 4e6. is raised by ‘Ctrl’-‘C’, the custom
     signal handler cancels the main task by calling *note
     asyncio.Task.cancel(): 6df. which raises *note
     asyncio.CancelledError: 6e0. 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(): 1b81. raises *note KeyboardInterrupt:
     d9a.

  4. A user could write a tight loop which cannot be interrupted by
     *note asyncio.Task.cancel(): 6df, in which case the second
     following ‘Ctrl’-‘C’ immediately raises the *note
     KeyboardInterrupt: d9a. 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 コルーチン: 8a7. は、 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(): 314. 関数 (上の例を参照してください。)

   * コルーチンを 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: 467. としてコルーチンを並行して走らせる
     *note asyncio.create_task(): 469. 関数。

     上のコード例を編集して、ふたつの ‘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: 6dd. class provides a more modern
     alternative to *note create_task(): 469.  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: 6dd.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: 439. 式の中で使うことができる場合、その
オブジェクトを '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: 9d4. 関数;

        * 'コルーチンオブジェクト': 'コルーチン関数' を呼び出すと返って
          くるオブジェクト.

Task
....

'Task' は、コルーチンを '並行に' スケジュールするのに使います。

*note asyncio.create_task(): 469. のような関数で、コルーチンが '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: f8f. は、非同期処理の '最終結果' を表現する特別な '低レベ
ルの' 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(): cbe. です。


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: 3a13. を *note Task: 467. でラップし、その
     実行をスケジュールします。 Task オブジェクトを返します。

     The full function signature is largely the same as that of the
     *note Task: 467. constructor (or factory) - all of the keyword
     arguments to this function are passed through to that interface.

     省略可能なキーワード引数 'context' によって、'coro' を実行するため
     のカスタムの *note contextvars.Context: 428. を指定できます。
     '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(): 468. will be used.

     その Task オブジェクトは *note get_running_loop(): ed3. から返され
     たループの中で実行されます。現在のスレッドに実行中のループが無い場
     合は、 *note RuntimeError: 317. が送出されます。

          注釈: *note asyncio.TaskGroup.create_task(): 46b. 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/main/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: 6e0. が次の機会に送出されます。

It is recommended that coroutines use ‘try/finally’ blocks to robustly
perform clean-up logic.  In case *note asyncio.CancelledError: 6e0. is
explicitly caught, it should generally be propagated when clean-up is
complete.  ‘asyncio.CancelledError’ directly subclasses *note
BaseException: 9bd. so most code will not need to be aware of it.

The asyncio components that enable structured concurrency, like *note
asyncio.TaskGroup: 6dd. and *note asyncio.timeout(): 9fa, are
implemented using cancellation internally and might misbehave if a
coroutine swallows *note asyncio.CancelledError: 6e0.  Similarly, user
code should not generally call *note uncancel: 6e2.  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: 9f8. holding a group of
     tasks.  Tasks can be added to the group using *note create_task():
     469.  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(): 469.  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(): 46a.

      -- メソッド: cancel ()

          Cancel the task group.  This is a non-exceptional, early exit
          of the task group's lifetime - useful once the group's goal
          has been met or its services no longer needed.

          *note cancel(): 6df. will be called on any tasks in the group
          that aren't yet done, as well as the parent (body) of the
          group.  The task group context manager will exit 'without'
          *note asyncio.CancelledError: 6e0. being raised.

          If ‘cancel()’ is called before entering the task group, the
          group will be cancelled upon entry.  This is useful for
          patterns where one piece of code passes an unused *note
          asyncio.TaskGroup: 6dd. instance to another in order to have
          the ability to cancel anything run within the group.

          ‘cancel()’ is idempotent and may be called after the task
          group has already exited.

          Some ways to use ‘cancel()’:

             * call it from the task group body based on some condition
               or event

             * pass the task group instance to child tasks via *note
               create_task(): 469, allowing a child task to
               conditionally cancel the entire entire group

             * pass the task group instance or bound ‘cancel()’ method
               to some other task 'before' opening the task group,
               allowing remote cancellation

          Added in version 3.15.

以下はプログラム例です:

     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).  There is also opportunity to
request termination of the entire task group with ‘tg.cancel()’, based
on some condition.  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: 6e0, 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__(): 1bcc. 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: 6e0, those exceptions are
combined in an *note ExceptionGroup: 6de. or *note BaseExceptionGroup:
76d. (as appropriate; see their documentation) which is then raised.

Two base exceptions are treated specially: If any task fails with *note
KeyboardInterrupt: d9a. or *note SystemExit: 10fb, 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: 6de. or *note BaseExceptionGroup: 76d.

If the body of the ‘async with’ statement exits with an exception (so
*note __aexit__(): 1bcc. 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: 6e0, is also
included in the exception group.  The same special case is made for
*note KeyboardInterrupt: d9a. and *note SystemExit: 10fb. as in the
previous paragraph.

Task groups are careful not to mix up the internal cancellation used to
"wake up" their *note __aexit__(): 1bcc. 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: 6de, it will call the parent task's *note
cancel(): 6df. method.  This ensures that a *note
asyncio.CancelledError: 6e0. will be raised at the next *note await:
439, so the cancellation is not lost.

Task groups preserve the cancellation count reported by *note
asyncio.Task.cancelling(): 6e1.

バージョン 3.13 で変更: Improved handling of simultaneous internal and
external cancellations and correct preservation of cancellation counts.


File: python.info,  Node: スリープ,  Next: Running tasks concurrently,  Prev: Task groups,  Up: Coroutines and tasks

5.20.1.11 スリープ
..................

 -- の関数: 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: 15a. if 'delay' is
     *note nan: a58.


File: python.info,  Node: Running tasks concurrently,  Next: Eager task factory,  Prev: スリープ,  Up: Coroutines and tasks

5.20.1.12 Running tasks concurrently
....................................

 -- の関数: awaitable asyncio.gather (*aws, return_exceptions=False)

     'aws' シーケンスにある *note awaitable オブジェクト: 3a29. を '並行
     ' 実行します。

     'aws' にある awaitable がコルーチンである場合、自動的に Task として
     スケジュールされます。

     全ての awaitable が正常終了した場合、その結果は返り値を集めたリスト
     になります。 返り値の順序は、 'aws' での awaitable の順序に相当しま
     す。

     'return_exceptions' が ‘False’ である場合(デフォルト)、‘gather()’ で
     await しているタスクに対して、最初の例外が直接伝えられます。'aws' に
     並んでいる他の awaitable は、'キャンセルされずに' 引き続いて実行さ
     れます。

     'return_exceptions' が ‘True’ だった場合、例外は成功した結果と同じ
     ように取り扱われ、結果リストに集められます。

     ‘gather()’ が 'キャンセル' された場合、起動された全ての (未完了の)
     awaitable も 'キャンセル' されます。

     'aws' シーケンスにある Task あるいは Future が 'キャンセル' された
     場合、 *note CancelledError: 6e0. を送出したかのうように扱われます
     。つまり、この場合 ‘gather()’ 呼び出しはキャンセル 'されません'。 こ
     れは、起動された 1 つの Task あるいは Future のキャンセルが、他の
     Task あるいは Future のキャンセルを引き起こすのを避けるためです。

          注釈: A new alternative to create and run tasks concurrently
          and wait for their completion is *note asyncio.TaskGroup: 6dd.
          '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.13 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): 468.),
     coroutines begin execution synchronously during *note Task: 467.
     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(): 892, using the provided
     'custom_task_constructor' when creating a new task instead of the
     default *note Task: 467.

     'custom_task_constructor' must be a 'callable' with the signature
     matching the signature of *note Task.__init__: 467.  The callable
     must return a *note asyncio.Task: 467.-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):
     468.).

     Added in version 3.12.


File: python.info,  Node: Shielding from cancellation,  Next: タイムアウト,  Prev: Eager task factory,  Up: Coroutines and tasks

5.20.1.14 Shielding from cancellation
.....................................

 -- の関数: awaitable asyncio.shield (aw)

     *note キャンセル: 6df. から *note awaitable オブジェクト: 3a29. を
     保護します。

     'aw' がコルーチンだった場合、自動的に Task としてスケジュールされま
     す。

     文:

          task = asyncio.create_task(something())
          res = await shield(task)

     は、以下と同じです

          res = await something()

     それを含むコルーチンがキャンセルされた場合を '除き'、‘something()’
     内で動作している Task はキャンセルされません。 ‘something()’ 側から
     見るとキャンセルは発生しません。 呼び出し元がキャンセルされた場合で
     も、 "await" 式は *note CancelledError: 6e0. を送出します。

     注意: ‘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.15 タイムアウト
......................

 -- の関数: asyncio.timeout (delay)

     Return an *note asynchronous context manager: 9f8. 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(): 3a37.

     以下はプログラム例です:

          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: 6e0. internally,
     transforming it into a *note TimeoutError: c12. which can be caught
     and handled.

          注釈: The *note asyncio.timeout(): 9fa. context manager is
          what transforms the *note asyncio.CancelledError: 6e0. into a
          *note TimeoutError: c12, which means the ‘TimeoutError’ can
          only be caught 'outside' of the context manager.

     Example of catching *note TimeoutError: c12.:

          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(): 9fa. can
     be rescheduled to a different deadline and inspected.

      -- クラス: asyncio.Timeout (when)

          An *note asynchronous context manager: 9f8. for cancelling
          overdue coroutines.

          Prefer using *note asyncio.timeout(): 9fa. or *note
          asyncio.timeout_at(): 1dcc. 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(): 9fa, 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: 3a29. が、完了するかタイムアウトになるのを待
     ちます。

     'aw' がコルーチンだった場合、自動的に Task としてスケジュールされま
     す。

     'timeout' には ‘None’ もしくは待つ秒数の浮動小数点数か整数を指定で
     きます。 'timeout' が ‘None’ の場合、 Future が完了するまで待ちます
     。

     If a timeout occurs, it cancels the task and raises *note
     TimeoutError: c12.

     Task の *note キャンセル: 6df. を避けるためには、 *note shield():
     e38. の中にラップしてください。

     この関数は 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: c12. immediately.

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.11 で変更: Raises *note TimeoutError: c12. instead of
     *note asyncio.TimeoutError: 1cd7.


File: python.info,  Node: Waiting primitives,  Next: Running in threads,  Prev: タイムアウト,  Up: Coroutines and tasks

5.20.1.16 Waiting primitives
............................

 -- の関数: async asyncio.wait (aws, *, timeout=None,
          return_when=ALL_COMPLETED)

     Run *note Future: f8f. and *note Task: 467. 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: c12.
     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: 3a3e.
                                                            
                                                            
      -- データ: asyncio.ALL_COMPLETED                      すべてのフューチャが終了したかキャンセルされたときに
                                                            返します。
                                                            

     *note wait_for(): 9fb. と異なり、 ‘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: 3a29. 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: 6d3. or a plain *note iterator: 6d4.  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: c12. 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: 6d3. or as a plain *note iterator:
     6d4. (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.17 Running in threads
............................

 -- の関数: async asyncio.to_thread (func, /, *args, **kwargs)

     別のスレッドで非同期的に関数 'func' を実行します。

     この関数に渡された *args と **kwargs は関数 'func' に直接渡されます
     。また、イベントループスレッドのコンテキスト変数に関数を実行するス
     レッドからアクセスできるように、現在の *note contextvars.Context:
     428. も伝播されます。

     関数 '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: 418, ‘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.18 Scheduling from other threads
.......................................

 -- の関数: asyncio.run_coroutine_threadsafe (coro, loop)

     与えられたイベントループにコルーチンを送ります。 この処理は、スレッ
     ドセーフです。

     他の OS スレッドから結果を待つための *note
     concurrent.futures.Future: 1570. を返します。

     この関数は、イベントループが動作しているスレッドとは異なる 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 並行処理とマルチスレッド処理: 3a41. 節を参
     照してください。

     他の 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.19 イントロスペクション
..............................

 -- の関数: asyncio.current_task (loop=None)

     現在実行中の *note Task: 467. インスタンスを返します。実行中の Task
     が無い場合は ‘None’ を返します。

     'loop' が ‘None’ の場合、 *note get_running_loop(): ed3. が現在のル
     ープを取得するのに使われます。

     Added in version 3.7.

 -- の関数: asyncio.all_tasks (loop=None)

     ループで実行された *note Task: 467. オブジェクトでまだ完了していな
     いものの集合を返します。

     'loop' が ‘None’ の場合、 *note get_running_loop(): ed3. は現在のル
     ープを取得するのに使われます。

     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.20 Task object
.....................

 -- クラス: asyncio.Task (coro, *, loop=None, name=None, context=None,
          eager_start=False)

     Python *note コルーチン: 3a13. を実行する *note Future 類: f8f. オ
     ブジェクトです。 スレッドセーフではありません。

     Task はイベントループのコルーチンを実行するのに使われます。 Future
     でコルーチンが待機している場合、 Task は自身のコルーチンの実行を一
     時停止させ、 Future の完了を待ちます。 Future が '完了' したら、
     Task が内包しているコルーチンの実行を再開します。

     イベントループは協調スケジューリングを使用します。つまり、イベント
     ループは同時に 1 つの Task のみ実行します。 Task が Future の完了を
     待っているときは、イベントループは他の Task やコールバックを動作さ
     せるか、 IO 処理を実行します。

     Task を作成するには高レベルの *note asyncio.create_task(): 469. 関
     数、あるいは低レベルの *note loop.create_task(): 46a. 関数や *note
     ensure_future(): 1039. 関数を使用してください。 手作業での Task の
     実装は推奨されません。

     To cancel a running Task use the *note cancel(): 6df. method.
     Calling it will cause the Task to throw a *note CancelledError:
     6e0. exception into the wrapped coroutine.  If a coroutine is
     awaiting on a future-like object during cancellation, the awaited
     object will be cancelled.

     *note cancelled(): 3a45. は、タスクがキャンセルされたかを調べるのに
     使用できます。タスクを内包するコルーチンで *note CancelledError:
     6e0. 例外が抑制されておらず、かつタスクが実際にキャンセルされている
     場合に、このメソッドは ‘True’ を変えます。

     *note asyncio.Task: 467. は、*note Future.set_result(): 3a46. と
     *note Future.set_exception(): 1040. を除いて、*note Future: f8f. の
     API をすべて継承しています。

     An optional keyword-only 'context' argument allows specifying a
     custom *note contextvars.Context: 428. 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: 467. at task
     creation time.  If set to ‘True’ and the event loop is running, the
     task will start executing the coroutine immediately, until the
     first time the coroutine blocks.  If the coroutine returns or
     raises without blocking, the task will be finished eagerly and will
     skip scheduling to the event loop.

     バージョン 3.7 で変更: *note contextvars: 28. モジュールのサポート
     を追加。

     バージョン 3.8 で変更: 'name' パラメータを追加しました。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if 'loop'
     is not specified and there is no running event loop.

     バージョン 3.11 で変更: 'context' パラメータを追加しました。

     バージョン 3.12 で変更: Added the 'eager_start' parameter.

      -- メソッド: done ()

          Task が '完了' しているなら ‘True’ を返します。

          Task がラップしているコルーチンが値を返すか、例外を送出するか
          、または Task がキャンセルされたとき、 Task は '完了' します。

      -- メソッド: result ()

          Task の結果を返します。

          Task が '完了' している場合、ラップしているコルーチンの結果が
          返されます (コルーチンが例外を送出された場合、その例外が例外が
          再送出されます)

          Task が 'キャンセル' されている場合、このメソッドは *note
          CancelledError: 6e0. 例外を送出します。

          If the Task's result isn't yet available, this method raises
          an *note InvalidStateError: 3a49. exception.

      -- メソッド: exception ()

          Task の例外を返します。

          ラップされたコルーチンが例外を送出した場合、その例外が返されま
          す。ラップされたコルーチンが正常終了した場合、このメソッドは
          ‘None’ を返します。

          Task が 'キャンセル' されている場合、このメソッドは *note
          CancelledError: 6e0. 例外を送出します。

          Task がまだ '完了' していない場合、このメソッドは *note
          InvalidStateError: 3a49. 例外を送出します。

      -- メソッド: add_done_callback (callback, *, context=None)

          Task が '完了' したときに実行されるコールバックを追加します。

          このメソッドは低水準のコールバックベースのコードでのみ使うべき
          です。

          詳細については *note Future.add_done_callback(): ed0. のドキュ
          メントを参照してください。

      -- メソッド: remove_done_callback (callback)

          コールバックリストから 'callback' を削除します。

          このメソッドは低水準のコールバックベースのコードでのみ使うべき
          です。

          詳細については *note Future.remove_done_callback(): 1b4b. のド
          キュメントを参照してください。

      -- メソッド: get_stack (*, limit=None)

          このタスクのスタックフレームのリストを返します。

          コルーチンが完了していない場合、これはサスペンドされた時点での
          スタックを返します。コルーチンが正常に処理を完了したか、キャン
          セルされていた場合は空のリストを返します。コルーチンが例外で終
          了した場合はトレースバックフレームのリストを返します。

          フレームは常に古いものから新しい物へ並んでいます。

          サスペンドされているコルーチンの場合スタックフレームが 1 個だ
          け返されます。

          オプション引数 'limit' は返すフレームの最大数を指定します; デ
          フォルトでは取得可能な全てのフレームを返します。返されるリスト
          の順番は、スタックが返されるか、トレースバックが返されるかによ
          って変わります: スタックでは新しい順に並んだリストが返されます
          が、トレースバックでは古い順に並んだリストが返されます（これは
          traceback モジュールの振る舞いと一致します）。

      -- メソッド: print_stack (*, limit=None, file=None)

          このタスクのスタックまたはトレースバックを出力します。

          このメソッドは *note get_stack(): 3a4d. によって取得されるフレ
          ームに対し、 traceback モジュールと同じような出力を生成します
          。

          引数 'limit' は *note get_stack(): 3a4d. にそのまま渡されます
          。

          The 'file' argument is an I/O stream to which the output is
          written; by default output is written to *note sys.stdout:
          ea0.

      -- メソッド: get_coro ()

          *note Task: 467. がラップしているコルーチンオブジェクトを返し
          ます。

               注釈: This will return ‘None’ for Tasks which have
               already completed eagerly.  See the *note Eager Task
               Factory: 3a33.

          Added in version 3.8.

          バージョン 3.12 で変更: Newly added eager task execution means
          result may be ‘None’.

      -- メソッド: get_context ()

          Return the *note contextvars.Context: 428. 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():
          462. メソッドの出力で確認できます。

          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: 6e0. 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: adb.
          ...  ...  ‘except CancelledError’ ...  *note finally: 453.
          block.  Therefore, unlike *note Future.cancel(): 1dc2,
          ‘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(): 6e2. in addition to catching the
          exception.

          If the Task being cancelled is currently awaiting on a
          future-like object, that awaited object will also be
          cancelled.  This cancellation propagates down the entire chain
          of awaited objects.

          バージョン 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(): 6df. メソッドによりキャンセルがリクエストされ
          、かつ Task がラップしているコルーチンが内部で送出された *note
          CancelledError: 6e0. 例外を伝達したとき、 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: 3a2e. and *note
          asyncio.timeout(): 9fa. 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: 6dd. context managers use *note uncancel():
          6e2. in a similar fashion.

          If end-user code is, for some reason, suppressing cancellation
          by catching *note CancelledError: 6e0, 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(): 6df. call had
          arranged for *note CancelledError: 6e0. 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(): 6df. less
          the number of *note uncancel(): 6e2. calls.

          Note that if this number is greater than zero but the Task is
          still executing, *note cancelled(): 3a45. will still return
          ‘False’.  This is because this number can be lowered by
          calling *note uncancel(): 6e2, 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(): 6e2. 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.21 ストリーム
....................

'ソースコード:' 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 使用例: 3a54. 節も参照してください。

ストリーム関数
..............

以下の 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: 196b.
     と *note StreamWriter: 1c95. クラスのインスタンスです。

     'limit' は戻り値の *note StreamReader: 196b. インスタンスが利用する
     バッファのサイズの上限値を設定します。デフォルトでは 'limit' は 64
     KiB に設定されます。

     残りの引数は直接 *note loop.create_connection(): 9fe. に渡されます
     。

          注釈: The 'sock' argument transfers ownership of the socket to
          the *note StreamWriter: 1c95. created.  To close the socket,
          call its *note close(): 3a55. 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: 196b. と *note StreamWriter: 1c95. クラスのインスタン
     スのペア ‘(reader, writer)’ を2つの引数として受け取ります。

     'client_connected_cb' には単純な呼び出し可能オブジェクトか、または
     *note コルーチン関数: 3a13. を指定します; コルーチン関数が指定され
     た場合、コールバックの呼び出しは自動的に *note Task: 467. としてス
     ケジュールされます。

     'limit' は戻り値の *note StreamReader: 196b. インスタンスが利用する
     バッファのサイズの上限値を設定します。デフォルトでは 'limit' は 64
     KiB に設定されます。

     残りの引数は直接 *note loop.create_server(): edb. に渡されます。

          注釈: The 'sock' argument transfers ownership of the socket to
          the server created.  To close the socket, call the server's
          *note close(): 3a56. 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(): ee0. と似ていますが Unix ソケッ
     トに対して動作します。

     *note loop.create_unix_connection(): 3a58. のドキュメントも参照して
     ください。

          注釈: The 'sock' argument transfers ownership of the socket to
          the *note StreamWriter: 1c95. created.  To close the socket,
          call its *note close(): 3a55. method.

     *note Availability: 234c.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' parameter.
     The 'path' parameter can now be a *note path-like object: 7a5.

     バージョン 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(): ee1. と似ていますが 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(): 6d6. のドキュメントも参照してくだ
     さい。

          注釈: The 'sock' argument transfers ownership of the socket to
          the server created.  To close the socket, call the server's
          *note close(): 3a56. method.

     *note Availability: 234c.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' and
     'start_serving' parameters.  The 'path' parameter can now be a
     *note path-like object: 7a5.

     バージョン 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/main/Lib/asyncio/streams.py


File: python.info,  Node: StreamReader,  Next: StreamWriter,  Up: ストリーム

5.20.1.22 StreamReader
......................

 -- クラス: asyncio.StreamReader

     Represents a reader object that provides APIs to read data from the
     IO stream.  As an *note asynchronous iterable: 1131, the object
     supports the *note async for: e74. statement.

     'StreamReader' オブジェクトを直接インスタンス化することは推奨されま
     せん; 代わりに *note open_connection(): ee0. や *note
     start_server(): ee1. を使ってください。

      -- メソッド: feed_eof ()

          EOF の肯定応答を行います。

      -- メソッド: async read (n=-1)

          ストリームから最大 'n' バイト読み込みます。

          'n' が指定されないか ‘-1’ が指定されていた場合 EOF になるまで
          読み込み、読み込まれた全ての *note bytes: 1d2. を返します。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: 1efc. を送出します。部分的に読み出したデ
          ータを取得するには *note IncompleteReadError.partial: 3a5e. 属
          性を使ってください。

      -- メソッド: async readuntil (separator=b'\n')

          'separator' が見つかるまでストリームからデータを読み出します。

          成功時には、データと区切り文字は内部バッファから削除されます
          (消費されます)。返されるデータの最後には区切り文字が含まれます
          。

          読み出したデータの量が設定したストリームの上限を超えると *note
          LimitOverrunError: 3a5f. 例外が送出されます。このときデータは
          内部バッファーに残され、再度読み出すことができます。

          完全な区切り文字が見つかる前に EOF に達すると *note
          IncompleteReadError: 1efc. 例外が送出され、内部バッファーがリ
          セットされます。このとき *note IncompleteReadError.partial:
          3a5e. 属性は区切り文字の一部を含むかもしれません。

          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: 3a5f, 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: 1d9. of separators.

      -- メソッド: at_eof ()

          バッファーが空で *note feed_eof(): 3a5b. が呼ばれていた場合
          ‘True’ を返します。


File: python.info,  Node: StreamWriter,  Next: 使用例<22>,  Prev: StreamReader,  Up: ストリーム

5.20.1.23 StreamWriter
......................

 -- クラス: asyncio.StreamWriter

     IO ストリームにデータを書き込むための API を提供するライターオブジ
     ェクトを表します。

     'StreamWriter' オブジェクトを直接インスタンス化することは推奨されま
     せん; 代わりに *note open_connection(): ee0. や *note
     start_server(): ee1. を使ってください。

      -- メソッド: 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(): 3a65. メソッドを
          サポートしている場合 ‘True’ を返し、そうでない場合は ‘False’ を
          返します。

      -- メソッド: write_eof ()

          バッファーされた書き込みデータを全て書き込んでから、ストリーム
          の書き込み側終端をクローズします。

      -- の属性: transport

          背後にある asyncio トランスポートを返します。

      -- メソッド: get_extra_info (name, default=None)

          オプションのトランスポート情報にアクセスします。詳細は *note
          BaseTransport.get_extra_info(): e66. を参照してください。

      -- メソッド: async drain ()

          ストリームへの書き込み再開に適切な状態になるまで待ちます。使用
          例:

               writer.write(data)
               await writer.drain()

          このメソッドは背後にある IO 書き込みバッファーとやりとりを行う
          フロー制御メソッドです。バッファーのサイズが最高水位点に達した
          場合、'drain()' はバッファのサイズが最低水位点を下回るまで減量
          され、書き込み再開可能になるまで書き込みをブロックします。待ち
          受けの必要がない場合、 *note drain(): 1d46. は即座にリターンし
          ます。

      -- メソッド: 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: 33e. インスタ
               ンスです。

             * '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(): 3a55. 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.24 使用例
................

* Menu:

* ストリームを使った TCP Echo クライアント::
* ストリームを使った TCP Echo サーバー::
* HTTP ヘッダーの取得::
* ストリームを使ってデータを待つオープンソケットの登録::


File: python.info,  Node: ストリームを使った TCP Echo クライアント,  Next: ストリームを使った TCP Echo サーバー,  Up: 使用例<22>

5.20.1.25 ストリームを使った TCP Echo クライアント
..................................................

*note asyncio.open_connection(): ee0. 関数を使った 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 エコークライアントプロトコル: 3a6a. の例は低水準の *note
loop.create_connection(): 9fe. メソッドを使っています。


File: python.info,  Node: ストリームを使った TCP Echo サーバー,  Next: HTTP ヘッダーの取得,  Prev: ストリームを使った TCP Echo クライアント,  Up: 使用例<22>

5.20.1.26 ストリームを使った TCP Echo サーバー
..............................................

*note asyncio.start_server(): ee1. 関数を使った 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 エコーサーバープロトコル: 3a6d. の例は *note
loop.create_server(): edb. メソッドを使っています。


File: python.info,  Node: HTTP ヘッダーの取得,  Next: ストリームを使ってデータを待つオープンソケットの登録,  Prev: ストリームを使った TCP Echo サーバー,  Up: 使用例<22>

5.20.1.27 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.28 ストリームを使ってデータを待つオープンソケットの登録
..............................................................

*note open_connection(): ee0. 関数を使ってソケットがデータを受信するまで
待つコルーチンです:

     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
プロトコルを使ってオープンしたソケットをデータ待ち受けのために登録する:
3a71. 例では、低水準のプロトコルと *note loop.create_connection(): 9fe.
メソッドを使っています。

*note ファイル記述子の読み出しイベントを監視する: 3a72. 例では、低水準の
*note loop.add_reader(): 3a73. メソッドを使ってファイル記述子を監視して
います。


File: python.info,  Node: 同期プリミティブ<2>,  Next: サブプロセス,  Prev: ストリーム,  Up: asyncio --- 非同期 I/O

5.20.1.29 同期プリミティブ
..........................

'ソースコード:' Lib/asyncio/locks.py(1)

__________________________________________________________________

asyncio の同期プリミティブは *note threading: f6. モジュールのそれと類似
するようにデザインされていますが、2つの重要な注意事項があります:

   * asyncio の同期プリミティブはスレッドセーフではありません。従って OS
     スレッドの同期に使うべきではありません (代わりに *note threading:
     f6. を使ってください);

   * 同期プリミティブのメソッドは 'timeout' 引数を受け付けません; タイム
     アウトを伴う操作を実行するには *note asyncio.wait_for(): 9fb. 関数
     を使ってください。

asyncio モジュールは以下の基本的な同期プリミティブを持っています:

   * *note Lock: e39.

   * *note Event: 574.

   * *note Condition: e3a.

   * *note Semaphore: e3b.

   * *note BoundedSemaphore: e3c.

   * *note Barrier: 9fc.

__________________________________________________________________

* Menu:

* Lock::
* Event::
* Condition::
* Semaphore::
* BoundedSemaphore::
* Barrier::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/asyncio/locks.py


File: python.info,  Node: Lock,  Next: Event,  Up: 同期プリミティブ<2>

5.20.1.30 Lock
..............

 -- クラス: asyncio.Lock

     asyncio タスクのためのミューテックスロックを実装しています。スレッ
     ドセーフではありません。

     asyncio ロックは、共有リソースに対する排他的なアクセスを保証するた
     めに使うことができます。

     Lock の望ましい使用方法は、 *note async with: 216. 文と組み合わせて
     使うことです:

          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(): 3a78. メソッドによりロック
          の解除を待ち受けている場合、最終的にただひとつのコルーチンが実
          行されます。

          ロックの獲得は '公平' です: すなわちロックを獲得して実行される
          コルーチンは、最初にロックの待ち受けを開始したコルーチンです。

      -- メソッド: release ()

          ロックを解放します。

          ロックが 'ロック状態' の場合、 ロックを '解除状態' にしてリタ
          ーンします。

          ロックが '解除状態' の場合、 *note RuntimeError: 317. 例外が送
          出されます。

      -- メソッド: locked ()

          'ロック状態' の場合に ‘True’ を返します。


File: python.info,  Node: Event,  Next: Condition,  Prev: Lock,  Up: 同期プリミティブ<2>

5.20.1.31 Event
...............

 -- クラス: asyncio.Event

     イベントオブジェクトです。スレッドセーフではありません。

     asyncio イベントは、複数の asyncio タスクに対して何らかのイベントが
     発生したことを通知するために使うことができます。

     Event オブジェクトは内部フラグを管理します。フラグの値は *note
     set(): 3a7c. メソッドにより 'true' に、また *note clear(): 3a7d. メ
     ソッドにより 'false' に設定することができます。 *note wait(): 3a7e.
     メソッドはフラグが '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(): 3a7c. メソッドを呼び出すまで
          処理をブロックします。

      -- メソッド: set ()

          イベントをセットします。

          イベントがセットされるまで待機している全てのタスクは、即座に通
          知を受けて実行を再開します。

      -- メソッド: clear ()

          イベントをクリア (アンセット) します

          Subsequent tasks awaiting on *note wait(): 3a7e. will now
          block until the *note set(): 3a7c. method is called again.

      -- メソッド: is_set ()

          イベントがセットされている場合 ‘True’ を返します。


File: python.info,  Node: Condition,  Next: Semaphore,  Prev: Event,  Up: 同期プリミティブ<2>

5.20.1.32 Condition
...................

 -- クラス: asyncio.Condition (lock=None)

     条件変数オブジェクトです。スレッドセーフではありません。

     asyncio 条件プリミティブは何らかのイベントが発生するのを待ち受け、
     そのイベントを契機として共有リソースへの排他的なアクセスを得るため
     に利用することができます。

     本質的に、 Condition オブジェクトは *note Event: 574. と a *note
     Lock: e39. の2つのクラスの機能を組み合わせたものです。複数の
     Condition オブジェクトが単一の Lock を共有することでができます。こ
     れにより、共有リソースのそれぞれの状態に関連する異なるタスクの間で
     、そのリソースへの排他的アクセスを調整することが可能になります。

     オプション引数 'lock' は *note Lock: e39. または ‘None’ でなければ
     なりません。後者の場合自動的に新しい Lock オブジェクトが生成されま
     す。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     Condition の望ましい使用方法は *note async with: 216. 文と組み合わ
     せて使うことです:

          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: 317. 例外が送出されます。

      -- メソッド: locked ()

          下層のロックを獲得していれば ‘True’ を返します。

      -- メソッド: notify_all ()

          この条件を待ち受けている全てのタスクを起動します。

          このメソッドは *note notify(): 1c1e. と同じように振る舞います
          が、待ち受けている全てのタスクを起動します。

          このメソッドが呼び出される前にロックを獲得しておかなければなり
          ません。また、メソッド呼び出し後速やかにロックを解除しなければ
          なりません。 '解除された' ロックとと共に呼び出された場合、
          *note RuntimeError: 317. 例外が送出されます。

      -- メソッド: release ()

          下層のロックを解除します。

          アンロック状態のロックに対して呼び出された場合、*note
          RuntimeError: 317. が送出されます。

      -- メソッド: async wait ()

          通知を受けるまで待機します。

          このメソッドが呼び出された時点で呼び出し元のタスクがロックを獲
          得していない場合、 *note RuntimeError: 317. 例外が送出されます
          。

          このメソッドは下層のロックを解除し、その後 *note notify():
          1c1e. または *note notify_all(): 3a84. の呼び出しによって起動
          されるまで処理をブロックします。いったん起動されると、
          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(): 3a86. 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(): 1c47. 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.33 Semaphore
...................

 -- クラス: asyncio.Semaphore (value=1)

     セマフォオブジェクトです。スレッドセーフではありません。

     セマフォは内部のカウンターを管理しています。カウンターは *note
     acquire(): 1c48. メソッドの呼び出しによって減算され、 *note
     release(): 3a88. メソッドの呼び出しによって加算されます。カウンター
     がゼロを下回ることはありません。 ‘acquire()’ メソッドが呼び出された
     時にカウンターがゼロになっていると、セマフォは処理をブロックし、他
     のタスクが ‘release()’ メソッドを呼び出すまで待機します。

     オプション引数 'value' は内部カウンターの初期値を与えます (デフォル
     トは ‘1’ です)。 指定された値が ‘0’ より小さい場合、 *note
     ValueError: 15a. 例外が送出されます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     セマフォの望ましい使用方法は、 *note async with: 216. 文と組み合わ
     せて使うことです:

          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(): 3a88. が呼び出されるまで待機してから ‘True’ を返し
          ます。

      -- メソッド: locked ()

          セマフォを直ちに獲得できない場合 ‘True’ を返します。

      -- メソッド: release ()

          セマフォを解放し、内部カウンターを1つ加算します。セマフォ待ち
          をしているタスクを起動する可能性があります。

          *note BoundedSemaphore: e3c. と異なり、 *note Semaphore: e3b.
          は ‘release()’ を ‘acquire()’ よりも多く呼び出すことを許容しま
          す。


File: python.info,  Node: BoundedSemaphore,  Next: Barrier,  Prev: Semaphore,  Up: 同期プリミティブ<2>

5.20.1.34 BoundedSemaphore
..........................

 -- クラス: asyncio.BoundedSemaphore (value=1)

     有限セマフォオブジェクトです。スレッドセーフではありません。

     有限セマフォは *note Semaphore: e3b. の一種で、 *note release():
     3a88. メソッドの呼び出しにより内部カウンターが '初期値' よりも増加
     してしまう場合は *note ValueError: 15a. 例外を送出します。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。


File: python.info,  Node: Barrier,  Prev: BoundedSemaphore,  Up: 同期プリミティブ<2>

5.20.1.35 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(): 3a8c. 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: 216. can be used as an alternative to awaiting on
     *note wait(): 3a8c.

     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: 9fd.
          exception if the barrier is broken or reset while a task is
          waiting.  It could raise a *note CancelledError: 6e0. 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: 9fd.
          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(): 3a8c. to fail with the *note
          BrokenBarrierError: 9fd.  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: 9fc. オブジェクトがリセットされるか broken な場合に
     、この例外 (*note RuntimeError: 317. のサブクラス) が送出されます。

__________________________________________________________________

バージョン 3.9 で変更: ‘await lock’ や ‘yield from lock’ およびそれらと
*note with: 215. 文との組み合わせ (すなわち ‘with await lock’ や ‘with
(yield from lock)’) によるロックの獲得は削除されました。代わりに ‘async
with lock’ を使ってください。


File: python.info,  Node: サブプロセス,  Next: キュー,  Prev: 同期プリミティブ<2>,  Up: asyncio --- 非同期 I/O

5.20.1.36 サブプロセス
......................

'ソースコード:' 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 使用例: 3a97. 節も参照してください。

* Menu:

* サブプロセスの生成::
* 定数: 定数<7>.
* サブプロセスとやりとりする::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/asyncio/subprocess.py

   (2) 
https://github.com/python/cpython/tree/main/Lib/asyncio/base_subprocess.py


File: python.info,  Node: サブプロセスの生成,  Next: 定数<7>,  Up: サブプロセス

5.20.1.37 サブプロセスの生成
............................

 -- の関数: 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:
     196b. wrappers for *note stdout: 3a99. and *note stderr: 3a9a. (if
     *note subprocess.PIPE: f4a. is passed to 'stdout' and 'stderr'
     arguments).

     *note Process: 3a9b. のインスタンスを返します。

     他のパラメータについては *note loop.subprocess_exec(): 3a9c. を参照
     してください。

     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:
     196b. wrappers for *note stdout: 3a99. and *note stderr: 3a9a. (if
     *note subprocess.PIPE: f4a. is passed to 'stdout' and 'stderr'
     arguments).

     *note Process: 3a9b. のインスタンスを返します。

     他のパラメータについては *note loop.subprocess_shell(): 3a9d. のド
     キュメントを参照してください。

     If the process object is garbage collected while the process is
     still running, the child process will be killed.

          重要: シェルインジェクション(1) の脆弱性を回避するために全ての
          空白文字および特殊文字を適切にクオートすることは、アプリケーシ
          ョン側の責任で確実に行ってください。シェルコマンドを構成する文
          字列内の空白文字と特殊文字のエスケープは、 *note
          shlex.quote(): 787. 関数を使うと適切に行うことができます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     注釈: サブプロセスは、 *note ProactorEventLoop: a03. を使えば
     Windows でも利用可能です。詳しくは *note Windows
     におけるサブプロセスのサポート: 3a9e. を参照してください。

参考
....

asyncio は以下に挙げるサブプロセスと協調するための '低水準の' API も持っ
ています: *note loop.subprocess_exec(): 3a9c, *note
loop.subprocess_shell(): 3a9d, *note loop.connect_read_pipe(): 3a9f,
*note loop.connect_write_pipe(): 3aa0. および *note Subprocess
Transports: 3aa1. と *note Subprocess Protocols: 3aa2.。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Shell_injection#Shell_injection


File: python.info,  Node: 定数<7>,  Next: サブプロセスとやりとりする,  Prev: サブプロセスの生成,  Up: サブプロセス

5.20.1.38 定数
..............

 -- データ: asyncio.subprocess.PIPE

     'stdin', 'stdout' または 'stderr' に渡すことができます。

     If 'PIPE' is passed to 'stdin' argument, the *note Process.stdin:
     3aa5. attribute will point to a *note StreamWriter: 1c95. instance.

     If 'PIPE' is passed to 'stdout' or 'stderr' arguments, the *note
     Process.stdout: 3a99. and *note Process.stderr: 3a9a. attributes
     will point to *note StreamReader: 196b. instances.

 -- データ: asyncio.subprocess.STDOUT

     'stderr' 引数に対して利用できる特殊な値で、標準エラー出力が標準出力
     にリダイレクトされることを意味します。

 -- データ: asyncio.subprocess.DEVNULL

     プロセスを生成する関数の 'stdin', 'stdout' または 'stderr' 引数に利
     用できる特殊な値です。対応するサブプロセスのストリームに特殊なファ
     イル *note os.devnull: 2021. が使われることを意味します。


File: python.info,  Node: サブプロセスとやりとりする,  Prev: 定数<7>,  Up: サブプロセス

5.20.1.39 サブプロセスとやりとりする
....................................

*note create_subprocess_exec(): e3e. と *note create_subprocess_shell():
e3f. の2つの関数はどちらも 'Process' クラスのインスタンスを返します。
'Process' クラスはサブプロセスと通信したり、サブプロセスの完了を監視した
りするための高水準のラッパーです。

 -- クラス: asyncio.subprocess.Process

     An object that wraps OS processes created by the *note
     create_subprocess_exec(): e3e. and *note create_subprocess_shell():
     e3f. functions.

     このクラスは *note subprocess.Popen: 6c5. クラスと同様の API を持つ
     ように設計されていますが、いくつかの注意すべき違いがあります:

        * Popen と異なり、 Process インスタンスは *note poll(): 39b4. メ
          ソッドに相当するメソッドを持っていません;

        * the *note communicate(): 1cc1. and *note wait(): 3aa9. methods
          don't have a 'timeout' parameter: use the *note wait_for():
          9fb. function;

        * *note subprocess.Popen.wait(): 272. メソッドが同期処理のビジー
          ループとして実装されているのに対して、 *note Process.wait():
          3aa9. メソッドは非同期処理です;

        * 'universal_newlines' パラメータはサポートされていません。

     このクラスは *note スレッド安全ではありません: 3a41.。

     *note サブプロセスとスレッド: 3aaa. 節も参照してください。

      -- メソッド: async wait ()

          子プロセスが終了するのを待ち受けます。

          *note returncode: 3aab. 属性を設定し、その値を返します。

               注釈: ‘stdout=PIPE’ または ‘stderr=PIPE’ を使っており、OS
               パイプバッファがさらなるデータを受け付けるようになるまで
               子プロセスをブロックするほど大量の出力を生成場合、このメ
               ソッドはデッドロックする可能性があります。この条件を避け
               るため、パイプを使用する場合は *note communicate(): 1cc1.
               メソッドを使ってください。

      -- メソッド: async communicate (input=None)

          プロセスとのやりとりを行います:

            1. 'stdin' にデータを送信します ('input' が ‘None’ でない場
               合);

            2. 'stdin' を閉じます;

            3. EOF に達するまで 'stdout' および 'stderr' からデータを読
               み出します;

            4. プロセスが終了するまで待ち受けます。

          'input' オプション引数は子プロセスに送信されるデータ (*note
          bytes: 1d2. オブジェクト) です。

          ‘(stdout_data, stderr_data)’ のタプルを返します。

          'input' を標準入力 'stdin' nに書き込んでいる時に *note
          BrokenPipeError: 1412. または *note ConnectionResetError:
          1415. 例外が送出された場合、例外は無視されます。このような条件
          は、全てのデータが '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: 1798. is an alias for
               *note terminate(): 3aac.  ‘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: 1798. 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: f1a. to the
          child process.

          Windows では、このメソッドは *note terminate(): 3aac. のエイリ
          アスです。

      -- の属性: stdin

          Standard input stream (*note StreamWriter: 1c95.) or ‘None’ if
          the process was created with ‘stdin=None’.

      -- の属性: stdout

          Standard output stream (*note StreamReader: 196b.) or ‘None’
          if the process was created with ‘stdout=None’.

      -- の属性: stderr

          Standard error stream (*note StreamReader: 196b.) or ‘None’ if
          the process was created with ‘stderr=None’.

          警告: Use the *note communicate(): 1cc1. method rather than
          *note process.stdin.write(): 3aa5, *note await
          process.stdout.read(): 3a99. or *note await
          process.stderr.read(): 3a9a.  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(): e3f. function, this attribute is
          the PID of the spawned shell.

      -- の属性: returncode

          プロセスが終了した時の終了ステータスを返します。

          この属性が ‘None’ であることは、プロセスがまだ終了していないこ
          とを示しています。

          For processes created with *note create_subprocess_exec():
          e3e, a negative value ‘-N’ indicates that the child was
          terminated by signal ‘N’ (POSIX only).

          For processes created with *note create_subprocess_shell():
          e3f, 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.40 サブプロセスとスレッド
................................

標準的な asyncio のイベントループは、異なるスレッドからサブプロセスを実
行するのをデフォルトでサポートしています。

Windows のサブプロセスは *note ProactorEventLoop: a03. (デフォルト) のみ
提供され、 *note SelectorEventLoop: 316. はサブプロセスをサポートしてい
ません。

標準で提供されない別のイベントループ実装の場合、固有の制限がある可能性が
あります; それぞれの実装のドキュメントを参照してください。

参考
....

*note 並行処理とマルチスレッド処理: 3a41.


File: python.info,  Node: 使用例<23>,  Prev: サブプロセスとスレッド,  Up: サブプロセスとやりとりする

5.20.1.41 使用例
................

サブプロセスの制御のために *note Process: 3a9b. クラスを使い、サブプロセ
スの標準出力を読み出すために *note StreamReader: 196b. を使う例です。 サ
ブプロセスは *note create_subprocess_exec(): e3e. 関数により生成されます
:

     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 同様の例: 3ab1. も参照してください。


File: python.info,  Node: キュー,  Next: 例外<17>,  Prev: サブプロセス,  Up: asyncio --- 非同期 I/O

5.20.1.42 キュー
................

'ソースコード:' Lib/asyncio/queues.py(1)

__________________________________________________________________

asyncio キューは *note queue: be. モジュールのクラス群と同じ形になるよう
に設計されています。 asyncio キューはスレッドセーフではありませんが、そ
れらは async/await コードから使われるために特別に設計されています。

asyncio キューのメソッドは 'timeout' パラメータを持たないことに注意して
ください; タイムアウトを伴うキューを使った処理を行うには *note
asyncio.wait_for(): 9fb. 関数を使ってください。

下記の *note 使用例: 3ab5. 節も参照してください。

* Menu:

* Queue::
* 優先度付きのキュー::
* LIFO キュー::
* 例外: 例外<16>.
* 使用例: 使用例<24>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/asyncio/queues.py


File: python.info,  Node: Queue,  Next: 優先度付きのキュー,  Up: キュー

5.20.1.43 Queue
...............

 -- クラス: asyncio.Queue (maxsize=0)

     先入れ先出し (FIFO) キューです。

     'maxsize' がゼロ以下の場合、キューは無限長になります。 ‘0’ より大き
     い整数の場合、キューが 'maxsize' に達すると ‘await put()’ は *note
     get(): 3ab7. によってキューの要素が除去されるまでブロックします。

     標準ライブラリにおけるスレッドベースの *note queue: be. モジュール
     と異なり、キューのサイズは常に既知であり、 *note qsize(): 3ab8. メ
     ソッドを呼び出すことによって取得することができます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     このクラスは *note スレッド安全ではありません: 3a41.。

      -- の属性: maxsize

          キューに追加できるアイテム数です。

      -- メソッド: empty ()

          キューが空ならば ‘True’ を、そうでなければ ‘False’ を返します
          。

      -- メソッド: full ()

          キューに要素が *note maxsize: 3ab9. 個あれば ‘True’ を返します
          。

          If the queue was initialized with ‘maxsize=0’ (the default),
          then ‘full()’ never returns ‘True’.

      -- メソッド: async get ()

          キューから要素を削除して返します。キューが空の場合項目が利用可
          能になるまで待機します。

          Raises *note QueueShutDown: 6d9. if the queue has been shut
          down and is empty, or if the queue has been shut down
          immediately.

      -- メソッド: get_nowait ()

          直ちに利用できるアイテムがあるときはそれを、そうでなければ
          *note QueueEmpty: 3abd. を返します。

      -- メソッド: async join ()

          キューにある全ての要素が取得され、処理されるまでブロックします
          。

          未完了のタスクのカウント値は、キューにアイテムが追加されるとき
          は常に加算され、キューの要素を消費するコルーチンが要素を取り出
          し、処理を完了したことを通知するために *note task_done():
          1184. を呼び出すと減算されます。未完了のタスクのカウント値がゼ
          ロになると、 *note join(): 1183. のブロックは解除されます。

      -- メソッド: async put (item)

          要素をキューに入力します。キューが満杯の場合、要素を追加する前
          に空きスロットが利用できるようになるまで待機します。

          Raises *note QueueShutDown: 6d9. if the queue has been shut
          down.

      -- メソッド: put_nowait (item)

          ブロックせずにアイテムをキューに追加します。

          直ちに利用できるスロットがない場合、*note QueueFull: 3ac0. を
          送出します。

      -- メソッド: qsize ()

          キュー内の要素数を返します。

      -- メソッド: shutdown (immediate=False)

          Put a *note Queue: e3d. instance into a shutdown mode.

          The queue can no longer grow.  Future calls to *note put():
          3abe. raise *note QueueShutDown: 6d9.  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(): 3ab7. calls to extract tasks
          that have already been loaded.

          And if *note task_done(): 1184. is called for each remaining
          task, a pending *note join(): 1183. will be unblocked
          normally.

          Once the queue is empty, future calls to *note get(): 3ab7.
          will raise *note QueueShutDown: 6d9.

          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(): 1183.
          are unblocked.  Also, blocked callers of *note get(): 3ab7.
          are unblocked and will raise *note QueueShutDown: 6d9. because
          the queue is empty.

          Use caution when using *note join(): 1183. 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(): 3ab7. used to
          fetch a work item, a subsequent call to *note task_done():
          1184. tells the queue that the processing on the work item is
          complete.

          *note join(): 1183. が現在ブロック中だった場合、全アイテムが処
          理されたとき (*note put(): 3abe. でキューに追加された全アイテ
          ムの *note task_done(): 1184. の呼び出しを受信したとき) に再開
          します。

          キューに追加されているアイテム数以上の呼び出しが行われたときに
          *note ValueError: 15a. を送出します。


File: python.info,  Node: 優先度付きのキュー,  Next: LIFO キュー,  Prev: Queue,  Up: キュー

5.20.1.44 優先度付きのキュー
............................

 -- クラス: asyncio.PriorityQueue

     *note Queue: e3d. の変種です; 優先順位にしたがって要素を取り出しま
     す (最低順位が最初に取り出されます)。

     項目は典型的には ‘(priority_number, data)’ 形式のタプルです。


File: python.info,  Node: LIFO キュー,  Next: 例外<16>,  Prev: 優先度付きのキュー,  Up: キュー

5.20.1.45 LIFO キュー
.....................

 -- クラス: asyncio.LifoQueue

     *note Queue: e3d. の変種で、最後に追加された項目を最初に取り出しま
     す (後入れ先出し、またはスタック)。


File: python.info,  Node: 例外<16>,  Next: 使用例<24>,  Prev: LIFO キュー,  Up: キュー

5.20.1.46 例外
..............

 -- 例外: asyncio.QueueEmpty

     この例外は *note get_nowait(): 3abc. メソッドが空のキューに対して呼
     ばれたときに送出されます。

 -- 例外: asyncio.QueueFull

     サイズが 'maxsize' に達したキューに対して *note put_nowait(): 3abf.
     メソッドが 呼ばれたときに送出される例外です。

 -- 例外: asyncio.QueueShutDown

     Exception raised when *note put(): 3abe. or *note get(): 3ab7. is
     called on a queue which has been shut down.

     Added in version 3.13.


File: python.info,  Node: 使用例<24>,  Prev: 例外<16>,  Up: キュー

5.20.1.47 使用例
................

キューを使って、並行処理を行う複数のタスクにワークロードを分散させること
ができます:

     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: 例外<17>,  Next: Call Graph Introspection,  Prev: キュー,  Up: asyncio --- 非同期 I/O

5.20.1.48 例外
..............

'ソースコード:' Lib/asyncio/exceptions.py(1)

__________________________________________________________________

 -- 例外: asyncio.TimeoutError

     操作が指定された期限を超えたときに送出される、非推奨な *note
     TimeoutError: c12. のエイリアス。

     バージョン 3.11 で変更: このクラスは *note TimeoutError: c12. のエ
     イリアスになりました。

 -- 例外: asyncio.CancelledError

     処理がキャンセルされました。

     asyncio タスクがキャンセルされた場合の処理をカスタマイズするために
     、この例外を一旦キャッチすることができます。 ほとんどの場合、キャッ
     チした例外は再度送出しなければなりません。

     バージョン 3.8 で変更: *note CancelledError: 6e0. は *note
     Exception: da2. ではなく *note BaseException: 9bd. のサブクラスにな
     りました。

 -- 例外: asyncio.InvalidStateError

     *note Task: 467. または *note Future: f8f. の内部状態が不正になりま
     した。

     すでに結果の値が設定されている 'Future' オブジェクトに対してさらに
     結果の値を再び設定しようとする場合などに送出されることがあります。

 -- 例外: asyncio.SendfileNotAvailableError

     与えられたソケットまたはファイルタイプに対して "sendfile" システム
     コールが利用可能ではありません。

     *note RuntimeError: 317. の派生クラスです。

 -- 例外: asyncio.IncompleteReadError

     要求された読み込み処理が完了できませんでした。

     *note asyncio ストリーム API: 19d0. から送出されます。

     この例外は *note EOFError: 1693. の派生クラスです。

      -- の属性: expected

          期待される総バイト数 (*note int: 32e.) です。

      -- の属性: partial

          ストリームの終端に達するまでに読み込んだ *note bytes: 1d2. 文
          字列です。

 -- 例外: asyncio.LimitOverrunError

     区切り文字を探している間にバッファサイズの上限に到達しました。

     *note asyncio ストリーム API: 19d0. から送出されます。

      -- の属性: consumed

          未消費のバイトの合計数です。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/asyncio/exceptions.py


File: python.info,  Node: Call Graph Introspection,  Next: Event loop,  Prev: 例外<17>,  Up: asyncio --- 非同期 I/O

5.20.1.49 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: 467. or *note Future: f8f.

     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: ea0.

     '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(): 46d, 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: 467. or *note Future: f8f.

     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: f8f. or
               a *note Task: 467. (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/main/Lib/asyncio/graph.py


File: python.info,  Node: Low level utility functions,  Up: Call Graph Introspection

5.20.1.50 Low level utility functions
.....................................

To introspect an async call graph asyncio requires cooperation from
control flow structures, such as *note shield(): e38. or *note
TaskGroup: 6dd.  Any time an intermediate *note Future: f8f. object with
low-level APIs like *note Future.add_done_callback(): ed0. 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: f8f.
     or *note Task: 467. 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(): 3ad5.
     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: f8f.
     or *note Task: 467. 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.51 Event loop
....................

'ソースコード:' Lib/asyncio/profile.py(1) と Lib/asyncio/pstats.py(2)

__________________________________________________________________

まえがき
........

イベントループは全ての asyncio アプリケーションの中核をなす存在です。イ
ベントループは非同期タスクやコールバックを実行し、ネットワーク I/O を処
理し、サブプロセスを実行します。

アプリケーション開発者は通常 *note asyncio.run(): 314. のような高水準の
ayncio 関数だけを利用し、ループオブジェクトを参照したり、ループオブジェ
クトのメソッドを呼び出したりすることはほとんどありません。この節は、イベ
ントループの振る舞いに対して細かい調整が必要な、低水準のコード、ライブラ
リ、フレームワークの開発者向けです。

イベントループの取得
....................

以下の低水準関数はイベントループの取得、設定、生成するために使います:

 -- の関数: asyncio.get_running_loop ()

     現在の OS スレッドで実行中のイベントループを取得します。

     Raise a *note RuntimeError: 317. 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(): 573. よりも *note get_running_loop(): ed3. を使う
     ほうが好ましいと考えられます。

     As noted above, consider using the higher-level *note
     asyncio.run(): 314. function, instead of using these lower level
     functions to manually create and close an event loop.

     バージョン 3.14 で変更: Raises a *note RuntimeError: 317. 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(): 1d72.

 -- の関数: asyncio.set_event_loop (loop)

     'loop' を OS スレッドの現在のイベントループに設定します。

 -- の関数: asyncio.new_event_loop ()

     新しいイベントループオブジェクトを生成して返します。

*note get_event_loop(): 573, *note set_event_loop(): 1d72, および *note
new_event_loop(): 3a20. 関数の振る舞いは、 *note
カスタムイベントループポリシーを設定する: 3ad9. ことにより変更することが
できます。

内容
....

このページは以下の節から構成されます:

   * *note イベントループのメソッド: 3ada. 節は、イベントループ API のリ
     ファレンスです。

   * *note コールバックハンドル: 3adb. 節は *note loop.call_soon(): ecc.
     や *note loop.call_later(): ece. などのスケジューリングメソッドが返
     す *note Handle: 2090. や *note TimerHandle: 1cfb. インスタンスにつ
     いて解説しています。

   * *note サーバーオブジェクト: 3adc. 節は *note loop.create_server():
     edb. のようなメソッドが返す型について解説しています。

   * *note イベントループの実装: 3add. 節は *note SelectorEventLoop:
     316. と *note ProactorEventLoop: a03. の2つのクラスについて解説して
     います。

   * *note 使用例: 3ade. 節ではイベントループ API の具体的な使い方を紹介
     しています。

* Menu:

* Event loop methods::
* Callback handles::
* Server objects::
* Event loop implementations::
* 使用例: 使用例<25>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/asyncio/profile.py

   (2) https://github.com/python/cpython/tree/main/Lib/asyncio/pstats.py


File: python.info,  Node: Event loop methods,  Next: Callback handles,  Up: Event loop

5.20.1.52 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.53 ループの開始と停止
............................

 -- メソッド: loop.run_until_complete (future)

     'フューチャー' (*note Future: f8f. インスタンス) が完了するまで実行
     します。

     引数が *note コルーチンオブジェクト: 3a13. の場合、暗黙のうちに
     *note asyncio.Task: 467. として実行されるようにスケジュールされます
     。

     Future の結果を返すか、例外を送出します。

 -- メソッド: loop.run_forever ()

     *note stop(): 103f. が呼び出されるまでイベントループを実行します。

     *note run_forever(): 3ae1. メソッドが呼ばれるより前に *note stop():
     103f. メソッドが呼ばれた場合、イベントループはタイムアウトをゼロに
     して一度だけ I/O セレクタの問い合わせ処理を行い、 I/O イベントに対
     してスケジュールされた全てのコールバック (および既にスケジュール済
     みのコールバック) を実行したのち、終了します。

     *note run_forever(): 3ae1. メソッドを実行中に *note stop(): 103f. メ
     ソッドが呼び出された場合、イベントループは現在処理されているすべて
     のコールバックを実行してから終了します。 この場合、コールバックによ
     り新たにスケジュールされるコールバックは実行されないことに注意して
     ください; これら新たにスケジュールされたコールバックは、次に
     ‘run_forever()’ または *note run_until_complete(): 103a. が呼び出さ
     れたときに実行されます。

 -- メソッド: loop.stop ()

     イベントループを停止します。

 -- メソッド: loop.is_running ()

     イベントループが現在実行中の場合 ‘True’ を返します。

 -- メソッド: loop.is_closed ()

     イベントループが閉じられていた場合 ‘True’ を返します。

 -- メソッド: loop.close ()

     イベントループをクローズします。

     この関数が呼び出される時点で、イベントループが実行中であってはいけ
     ません。保留中のコールバックはすべて破棄されます。

     このメソッドは全てのキューをクリアし、エグゼキューターが実行完了す
     るのを待たずにシャットダウンします。

     このメソッドはべき等 (何回実行しても結果は同じ) であり取り消せませ
     ん。イベントループがクローズされた後、他のいかなるメソッドも呼び出
     すべきではありません。

 -- メソッド: async loop.shutdown_asyncgens ()

     現在オープンになっているすべての *note asynchronous generator:
     26b1. (非同期ジェネレータ) オブジェクトをスケジュールし、 *note
     aclose(): cae. メソッドを呼び出すことでそれらをクローズします。 こ
     のメソッドの呼び出し後に新しい非同期ジェネレータがイテレートされる
     と、イベントループは警告を発します。このメソッドはスケジュールされ
     たすべての非同期ジェネレータの終了処理を確実に行うために使用すべき
     です。

     *note asyncio.run(): 314. を使った場合はこの関数を呼び出す必要はあ
     りません。

     以下はプログラム例です:

          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: b2c.  Once
     this method has been called, using the default executor with *note
     loop.run_in_executor(): cbe. will raise a *note RuntimeError: 317.

     The 'timeout' parameter specifies the amount of time (in *note
     float: 32f. 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: 6e3. 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():
          314, 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.54 コールバックのスケジューリング
........................................

 -- メソッド: loop.call_soon (callback, *args, context=None)

     イベントループの次のイテレーションで 'callback' に指定したコールバ
     ック (*note callback: 2fdb.) を 'args' 引数で呼び出すようにスケジュ
     ールします。

     *note asyncio.Handle: 2090. のインスタンスを返します。このインスタ
     ンスを使ってスケジュールしたコールバックをキャンセルすることができ
     ます。

     コールバックは登録された順に呼び出されます。各コールバックは厳密に
     1回だけ呼び出されます。

     The optional keyword-only 'context' argument specifies a custom
     *note contextvars.Context: 428. for the 'callback' to run in.
     Callbacks use the current context when no 'context' is provided.

     Unlike *note call_soon_threadsafe(): ecd, this method is not
     thread-safe.

 -- メソッド: loop.call_soon_threadsafe (callback, *args, context=None)

     A thread-safe variant of *note call_soon(): ecc.  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: 317. 例外を送出します。これはメインアプ
     リケーションが終了しているにもかかわらずセカンダリスレッドでメソッ
     ドが呼び出されるといった場合に起こりえます。

     このドキュメントの *note 並行処理とマルチスレッド処理: 3a41. 節を参
     照してください。

     バージョン 3.7 で変更: キーワード引数 'context' が追加されました。
     詳細は PEP 567(1) を参照してください。

     注釈: ほとんどの *note asyncio: b. モジュールのスケジューリング関数
     は、キーワード引数をコールバックに渡すことを許していません。キーワ
     ード引数を渡すためには *note functools.partial(): 4ad. を使ってくだ
     さい:

          # 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.55 遅延コールバックのスケジューリング
............................................

イベントループは、コールバック関数を未来のある時点で呼び出されるようにス
ケジュールする仕組みを提供します。イベントループは時刻が戻らない単調な時
計 (monotonic clock) を使って時刻を追跡します。

 -- メソッド: loop.call_later (delay, callback, *args, context=None)

     'delay' 秒経過後にコールバック関数 'callback' を呼び出すようにスケ
     ジュールします。 'delay' には整数または浮動小数点数を指定します。

     *note asyncio.TimerHandle: 1cfb. のインスタンスを返します。このイン
     スタンスを使ってスケジュールしたコールバックをキャンセルすることが
     できます。

     'callback' は厳密に一度だけ呼び出されます。2つのコールバックが完全
     に同じ時間にスケジュールされた場合、呼び出しの順序は未定義です。

     The optional positional 'args' will be passed to the callback when
     it is called.  Use *note functools.partial(): 4ad. *note to pass
     keyword arguments: 3ae5. to 'callback'.

     オプションのキーワード引数 'context' を使って、コールバック
     *callback* を実行する際のコンテキスト *note contextvars.Context:
     428. を設定することができます。コンテキスト '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(): 3ae8. と同じ参照時
     刻を使用します。

     このメソッドの振る舞いは *note call_later(): ece. と同じです。

     *note asyncio.TimerHandle: 1cfb. のインスタンスを返します。このイン
     スタンスを使ってスケジュールしたコールバックをキャンセルすることが
     できます。

          注釈: 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: 32f. 値で返します。時刻はイベントループが
     内部で参照している時刻が戻らない単調な時計 (monotonic clock) に従い
     ます。

     注釈: 
     バージョン 3.8 で変更: Python 3.7 またはそれ以前のバージョンでは、
     タイムアウト (相対値 'delay' もしくは絶対値 'when') は1日を超えるこ
     とができませんでした。この問題は Python 3.8 で修正されました。

参考
....

関数 *note asyncio.sleep(): e37.。

   ---------- 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.56 Creating futures and tasks
....................................

 -- メソッド: loop.create_future ()

     イベントループに接続した *note asyncio.Future: f8f. オブジェクトを
     生成します。

     asyncio でフューチャーオブジェクトを作成するために推奨される方法で
     す。このメソッドにより、サードパーティ製のイベントループがFutures ク
     ラスの(パフォーマンスや計測方法が優れた) 代替実装を提供することを可
     能にします。

     Added in version 3.5.2.

 -- メソッド: loop.create_task (coro, *, name=None, context=None,
          eager_start=None, **kwargs)

     *note コルーチン: 3a13. 'coro' の実行をスケジュールします。 *note
     Task: 467. オブジェクトを返します。

     サードパーティのイベントループは相互運用のための自身の *note Task:
     467. のサブクラスを使用できます。この場合、結果は ‘Task’ のサブクラ
     スになります。

     The full function signature is largely the same as that of the
     *note Task: 467. constructor (or factory) - all of the keyword
     arguments to this function are passed through to that interface.

     'name' 引数が指定され、値が ‘None’ でない場合、 *note
     Task.set_name(): da5. メソッドにより 'name' がタスクの名前として設
     定されます。

     省略可能なキーワード引数 'context' によって、'coro' を実行するため
     のカスタムの *note contextvars.Context: 428. を指定できます。
     '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(): 468. 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(): 46a. が使用するタスクファクトリーを設定し
     ます。

     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: 467.-compatible object.

     バージョン 3.13.3 で変更: Required that all 'kwargs' are passed on
     to *note asyncio.Task: 467.

     バージョン 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.57 ネットワーク接続の確立
................................

 -- メソッド: 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: 1dc6. か *note AF_INET6: 1dc7.
     のいずれかを指定します。

     ソケットタイプは *note SOCK_STREAM: 16ad. になります。

     'protocol_factory' は *note asyncio プロトコル: 3aeb. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     このメソッドはバックグラウンドで接続の確立を試みます。成功した場合
     、メソッドは ‘(transport, protocol)’ のペアを返します。

     時系列での下層処理の概要は以下のとおりです:

       1. 接続を確立し、その接続に対する *note トランスポート: 3aec. が
          生成されます。

       2. 'protocol_factory' が引数なしで呼び出され、ファクトリが *note
          プロトコル: 3aeb. インスタンスを返すよう要求します。

       3. プロトコルインスタンスが *note connection_made(): 3aed. メソッ
          ドを呼び出すことにより、トランスポートと紐付けられます。

       4. 成功すると ‘(transport, protocol)’ タプルが返されます。

     作成されたトランスポートは実装依存の双方向ストリームです。

     その他の引数:

        * 'ssl': 偽値以外が与えられた場合、SSL/TLS トランスポートが作成
          されます (デフォルトでは暗号化なしの TCP トランスポートが作成
          されます)。 'ssl' が *note ssl.SSLContext: 33e. オブジェクトの
          場合、このコンテキストがトランスポートを作成するために使用され
          ます; 'ssl' が *note True: fd0. の場合、 *note
          ssl.create_default_context(): 695. が返すデフォルトのコンテキ
          ストが使われます。

          参考
          ....

          *note SSL/TLS セキュリティについての考察: 3aee.

        * 'server_hostname' は対象サーバーの証明書との一致を確認するため
          のホスト名を設定または上書きします。この引数は 'ssl' が ‘None’
          でない場合のみ設定すべきです。デフォルトでは 'host' に指定した
          サーバー名が使用されます。 'host' が空の文字列の場合のデフォル
          ト値は設定されていません。その場合、 'server_hostname' を必ず
          指定してください。 'server_hostname' も空の文字列の場合は、ホ
          スト名の一致確認は行われません (これは深刻なセキュリティリスク
          であり、中間者攻撃を受ける可能性があります)。

        * 'family', 'proto', 'flags' は任意のアドレスファミリであり、
          'host' 解決のための getaddrinfo() 経由で渡されるプロトコルおよ
          びフラグになります。このオプションが与えられた場合、これらはす
          べて *note socket: d4. モジュール定数に従った整数でなければな
          りません。

        * 'happy_eyeballs_delay' が設定されると、この接続に対して Happy
          Eyeballs が有効化されます。設定する値は浮動小数点数であり、次
          の接続試行を開始する前に、現在の接続試行が完了するのを待つ時間
          を秒単位で表現します。この値は RFC 8305(1) で定義されている "接
          続試行遅延" に相当します。RFC で推奨されている実用的なデフォル
          ト値は ‘0.25’ (250 ミリ秒) です。

        * 'interleave' はホスト名が複数の IP アドレスに名前解決される場
          合のアドレスの並べ替えを制御します。 ‘0’ または未指定の場合並
          べ替えは行われず、 *note getaddrinfo(): fd7. が返す順番にした
          がってアドレスへの接続を試行します。正の整数が指定されると、ア
          ドレスはアドレスファミリに応じてインターリーブされます。このと
          き、与えられた整数は RFC 8305(2) で定義される "最初のアドレス
          ファミリカウント (First Address Family Count)" として解釈され
          ます。デフォルト値は、 'happy_eyeballs_delay' が指定されない場
          合は ‘0’ であり、指定された場合は ‘1’ です。

        * 'sock' を与える場合、トランスポートに使用される、既存の、かつ
          接続済の *note socket.socket: 115e. オブジェクトを指定します。
          '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(): 3aef. 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: a03. において
     SSL/TLS のサポートが追加されました。

     バージョン 3.6 で変更: 全ての TCP 接続に対してデフォルトでソケット
     オプション *note socket.TCP_NODELAY: f36. が設定されるようになりま
     した。

     バージョン 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(): ee0. 関数は高水準の代替 API です。この関数
     は(*note StreamReader: 196b, *note StreamWriter: 1c95.) のペアを返
     し、 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: 1dc6.、 *note AF_INET6: 1dc7.、
     *note AF_UNIX: 1dc9. のいずれかを指定します。

     ソケットタイプは *note SOCK_DGRAM: 16ac. になります。

     'protocol_factory' は *note asyncio プロトコル: 3aeb. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     成功すると ‘(transport, protocol)’ タプルが返されます。

     その他の引数:

        * 'local_addr' が指定される場合、ソケットをローカルにバインドす
          るための ‘(local_host, local_port)’ のタプルを指定します。
          'local_host' と 'local_port' は *note getaddrinfo(): fd7. メソ
          ッドを使用して検索されます。

               注釈: On Windows, when using the proactor event loop with
               ‘local_addr=None’, an *note OSError: 543. with
               ‘errno.WSAEINVAL’ will be raised when running it.

        * 'remote_addr' が指定される場合、‘(remote_host, remote_por)’ の
          タプルで、ソケットをリモートアドレスに束縛するために使用されま
          す。'remote_host' と 'remote_port' は *note getaddrinfo():
          fd7. を使用して検索されます。

        * 'family', 'proto', 'flags' は任意のアドレスファミリです。これ
          らのファミリ、プロトコル、フラグは、'host' 解決のため *note
          getaddrinfo(): fd7. 経由でオプションで渡されます。これらのオプ
          ションを指定する場合、すべて *note socket: d4. モジュール定数
          に従った整数でなければなりません。

        * 'reuse_port' は、同じポートにバインドされた既存の端点すべてが
          このフラグを設定して生成されている場合に限り、この端点を既存の
          端点と同じポートにバインドすることを許可するよう、カーネルに指
          示します（訳註: ソケットのオプション SO_REUSEPORT を使用します
          ）。このオプションは、Windows やいくつかの UNIX システムではサ
          ポートされていません。*note socket.SO_REUSEPORT: f36. 定数が定
          義されていなければ、この機能はサポートされません。

        * 'allow_broadcast' は、カーネルに、このエンドポイントがブロード
          キャストアドレスにメッセージを送信することを許可するように指示
          します。

        * オプションの 'sock' を指定することで、既存の、すでに接続されて
          いる *note socket.socket: 115e. をトランスポートで使用すること
          ができます。このオプションを使用する場合、'local_addr' と
          'remote_addr' は省略してください (*note None: a6a. でなければ
          なりません)。

               注釈: The 'sock' argument transfers ownership of the
               socket to the transport created.  To close the socket,
               call the transport's *note close(): 3aef. method.

     *note UDP echo クライアントプロトコル: 3af0. および *note UDP echo
     サーバープロトコル: 3af1. の例を参照してください。

     バージョン 3.4.4 で変更: 'family', 'proto', 'flags',
     'reuse_address', 'reuse_port', 'allow_broadcast', 'sock' パラメータ
     が追加されました。

     バージョン 3.8 で変更: Windows サポートが追加されました。

     バージョン 3.8.1 で変更: *note socket.SO_REUSEADDR: f36. の利用が
     UDP に対して重大なセキュリティ上の懸念をもたらすため、
     'reuse_address' パラメータはサポートされなくなりました。明示的に
     ‘reuse_address=True’ を設定すると例外を送出します。

     ‘SO_REUSEADDR’ を使って、同一の UDP ソケットアドレスに対して複数の
     プロセスが異なる UID でソケットを割り当てている場合、受信パケットは
     複数のソケット間にランダムに分散する可能性があります。

     サポートされているプラットフォームでは、 'reuse_port' が同様の機能
     に対する代用品として利用できます。 'reuse_port' は代替機能として
     *note socket.SO_REUSEPORT: f36. を使っており、複数のプロセスが異な
     る 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: 1dc9. になります; また、ソケッ
     トタイプは *note SOCK_STREAM: 16ad. になります。

     成功すると ‘(transport, protocol)’ タプルが返されます。

     'path' は Unix ドメインソケット名で、 'sock' パラメータが指定されな
     い場合は必須です。 抽象 Unix ソケット、 *note str: 1ea.、 *note
     bytes: 1d2.、 and *note Path: 4f5. 形式でのパスがサポートされていま
     す。

     このメソッドの引数についての詳細は *note loop.create_connection():
     9fe. メソッドのドキュメントを参照してください。

     *note Availability: 234c.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' parameter.
     The 'path' parameter can now be a *note path-like object: 7a5.

     バージョン 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.58 ネットワークサーバの生成
..................................

 -- メソッド: 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: 16ad.)
     listening on 'port' of the 'host' address.

     *note Server: eda. オブジェクトを返します。

     引数:

        * 'protocol_factory' は *note asyncio プロトコル: 3aeb. の実装を
          返す呼び出し可能オブジェクトでなければなりません。

        * '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: 1dc6. or
          *note AF_INET6: 1dc7. 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: 3af3.).

        * 'flags' は *note getaddrinfo(): fd7. のためのビットマスクにな
          ります。

        * サーバーで既存のソケットオブジェクトを使用するために、オプショ
          ンの引数 '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(): 3a56. method.

        * 'backlog' は *note listen(): 1212. に渡される、キューに入るコ
          ネクションの最大数になります (デフォルトは 100)。

        * 確立した接続の上で TLS を有効化するために、 'ssl' に *note
          SSLContext: 33e. のインスタンスを指定することができます。

        * '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(): edc. または *note
          Server.serve_forever(): edd. を待ち受け (await) る必要がありま
          す。

     バージョン 3.5 で変更: *note ProactorEventLoop: a03. において
     SSL/TLS のサポートが追加されました。

     バージョン 3.5.1 で変更: 'host' パラメータに文字列のシーケンスを指
     定できるようになりました。

     バージョン 3.6 で変更: Added 'ssl_handshake_timeout' and
     'start_serving' parameters.  The socket option *note
     socket.TCP_NODELAY: f36. is set by default for all TCP connections.

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

     参考
     ....

     *note start_server(): ee1. 関数は高水準の代替 API です。この関数は
     *note StreamReader: 196b. と *note StreamWriter: 1c95. のペアを返し
     、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(): edb. but works with the
     *note AF_UNIX: 1dc9. socket family.

     'path' は Unix ドメインソケット名で、 'sock' パラメータが指定されな
     い場合は必須です。 抽象 Unix ソケット、 *note str: 1ea.、 *note
     bytes: 1d2.、 and *note Path: 4f5. 形式でのパスがサポートされていま
     す。

     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(): edb.
     メソッドのドキュメントを参照してください。

     *note Availability: 234c.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' and
     'start_serving' parameters.  The 'path' parameter can now be a
     *note Path: 4f5. 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 プロトコル: 3aeb. の実装を
          返す呼び出し可能オブジェクトでなければなりません。

        * 'sock' は *note socket.accept: 115f. メソッドが返す既存のソケ
          ットオブジェクトです。

               注釈: The 'sock' argument transfers ownership of the
               socket to the transport created.  To close the socket,
               call the transport's *note close(): 3aef. method.

        * 'ssl' には *note SSLContext: 33e. を指定できます。指定すると、
          受け付けたコネクション上での 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.59 ファイルの転送
........................

 -- メソッド: async loop.sendfile (transport, file, offset=0,
          count=None, *, fallback=True)

     'transport' を通じて 'file' を送信します。送信したデータの総バイト
     数を返します。

     このメソッドは、もし利用可能であれば高性能な *note os.sendfile():
     ed7. を利用します。

     'file' はバイナリモードでオープンされた通常のファイルオブジェクトで
     なければなりません。

     'offset' はファイルの読み込み開始位置を指定します。 'count' が指定
     された場合、ファイルの EOF までファイルを送信する代わりに、 'count'
     で指定された総バイト数の分だけ送信します。ファイルオブジェクトが指
     し示す位置は、メソッドがエラーを送出した場合でも更新されます。この
     場合実際に送信されたバイト数は *note file.tell(): 1765. メソッドで
     取得することができます。

     'fallback' を ‘True’ に指定することで、 asyncio がプラットフォーム
     が sendfile システムコールをサポートしていない場合 (たとえば
     Windows や Unix の SSL ソケットなど) に別の方法でファイルの読み込み
     と送信を行うようにすることができます。

     システムが 'sendfile' システムコールをサポートしておらず、かつ
     'fallback' が ‘False’ の場合、 *note SendfileNotAvailableError:
     3acb. 例外を送出します。

     Added in version 3.7.


File: python.info,  Node: TLS upgrade,  Next: ファイル記述子の監視,  Prev: ファイルの転送,  Up: Event loop methods

5.20.1.60 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(): edb. や
          *note create_connection(): 9fe. が返すものと同等のインスタンス
          を指定します。

        * 'sslcontext': 構成済みの *note SSLContext: 33e. インスタンスで
          す。

        * (*note create_server(): edb. で生成されたような) サーバーサイ
          ドの接続をアップグレードする場合は '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.61 ファイル記述子の監視
..............................

 -- メソッド: 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 キーワード引数を渡す: 3ae5. 場合は
     *note functools.partial(): 4ad. を使ってください。

 -- メソッド: loop.remove_writer (fd)

     Stop monitoring the 'fd' file descriptor for write availability.
     Returns ‘True’ if 'fd' was previously being monitored for writes.

これらのメソッドに対する制限事項については *note
プラットフォームのサポート状況: 3afb. 節も参照してください。


File: python.info,  Node: ソケットオブジェクトと直接やりとりする,  Next: DNS,  Prev: ファイル記述子の監視,  Up: Event loop methods

5.20.1.62 ソケットオブジェクトと直接やりとりする
................................................

一般に、 *note loop.create_connection(): 9fe. や *note
loop.create_server(): edb. のようなトランスポートベースの API を使ったプ
ロトコルの実装はソケットと直接やり取りする実装に比べて高速です。しかしな
がら、パフォーマンスが重要でなく、直接 *note socket: 115e. オブジェクト
とやりとりした方が便利なユースケースがいくつかあります。

 -- メソッド: async loop.sock_recv (sock, nbytes)

     'nbytes' で指定したバイト数までのデータをソケット 'sock' から受信し
     ます。 このメソッドは *note socket.recv(): 1161. の非同期版です。

     受信したデータをバイトオブジェクトとして返します。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: f8f. オブジェクトを返していました。 Python 3.7 からは
     ‘async def’ メソッドになりました。

 -- メソッド: async loop.sock_recv_into (sock, buf)

     ソケット 'sock' からデータを受信してバッファ 'buf' に格納します。ブ
     ロッキングコードの *note socket.recv_into(): 16d7. メソッドをモデル
     としています。

     バッファに書き込んだデータのバイト数を返します。

     '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(): 1162.

     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(): 16d8.

     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(): 1165. メソッドの非同期版です。

     このメソッドは 'data' をすべて送信し終えるか、またはエラーが起きる
     までデータをソケットに送信し続けます。送信に成功した場合 ‘None’ を
     返します。エラーの場合は例外が送出されます。エラーとなった場合、接
     続の受信側で正しく処理されたデータの総量を特定する方法はありません
     。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: f8f. オブジェクトを返していました。 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(): 1166.

     Return the number of bytes sent.

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.11.

 -- メソッド: async loop.sock_connect (sock, address)

     ソケット 'sock' をアドレス 'address' のリモートソケットに接続します
     。

     *note socket.connect(): 1160. の非同期版です。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.5.2 で変更: ‘address’ を名前解決する必要はなくなりまし
     た。 ‘sock_connect’ は *note socket.inet_pton(): d30. を呼び出して
     'address' が解決済みかどうかを確認します。未解決の場合、 'address'
     の名前解決には *note loop.getaddrinfo(): fd7. メソッドが使われます
     。

     参考
     ....

     *note loop.create_connection(): 9fe. および *note
     asyncio.open_connection(): ee0.。

 -- メソッド: async loop.sock_accept (sock)

     接続を受け付けます。ブロッキングコールの *note socket.accept():
     115f. メソッドをモデルとしています。

     ソケットはアドレスに束縛済みで、接続を listen 中である必要がありま
     す。戻り値は ‘(conn, address)’ のペアで、'conn' は接続を通じてデー
     タの送受信を行うための '新しい' ソケットオブジェクト、'address' は
     接続先の端点でソケットに束縛されているアドレスを示します。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: f8f. オブジェクトを返していました。 Python 3.7 からは
     ‘async def’ メソッドになりました。

     参考
     ....

     *note loop.create_server(): edb. および *note start_server(): ee1.。

 -- メソッド: async loop.sock_sendfile (sock, file, offset=0,
          count=None, *, fallback=True)

     ファイルを送信します。利用可能なら高性能な *note os.sendfile: ed7.
     を使います。送信したデータの総バイト数を返します。

     *note socket.sendfile(): 1211. メソッドの非同期版です。

     'sock' は *note socket.SOCK_STREAM: 16ad. タイプのノンブロッキング
     な *note socket: 115e. でなければなりません。

     'file' はバイナリモードでオープンされた通常のファイルオブジェクトで
     なければなりません。

     'offset' はファイルの読み込み開始位置を指定します。 'count' が指定
     された場合、ファイルの EOF までファイルを送信する代わりに、 'count'
     で指定された総バイト数の分だけ送信します。ファイルオブジェクトが指
     し示す位置は、メソッドがエラーを送出した場合でも更新されます。この
     場合実際に送信されたバイト数は *note file.tell(): 1765. メソッドで
     取得することができます。

     'fallback' が ‘True’ に設定された場合、 プラットフォームが sendfile
     システムコールをサポートしていない場合 (たとえば Windows や Unix の
     SSL ソケットなど) に asyncio が別の方法でファイルの読み込みと送信を
     行うようにすることができます。

     システムが 'sendfile' システムコールをサポートしておらず、かつ
     'fallback' が ‘False’ の場合、 *note SendfileNotAvailableError:
     3acb. 例外を送出します。

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.7.


File: python.info,  Node: DNS,  Next: パイプとやりとりする,  Prev: ソケットオブジェクトと直接やりとりする,  Up: Event loop methods

5.20.1.63 DNS
.............

 -- メソッド: async loop.getaddrinfo (host, port, *, family=0, type=0,
          proto=0, flags=0)

     *note socket.getaddrinfo(): 1946. の非同期版です。

 -- メソッド: async loop.getnameinfo (sockaddr, flags=0)

     *note socket.getnameinfo(): 1c61. の非同期版です。

     注釈: 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: f8f. オ
ブジェクトを返していました。 Python 3.7 からはどちらのメソッドもコルーチ
ンになりました。


File: python.info,  Node: パイプとやりとりする,  Next: Unix シグナル,  Prev: DNS,  Up: Event loop methods

5.20.1.64 パイプとやりとりする
..............................

 -- メソッド: async loop.connect_read_pipe (protocol_factory, pipe)

     イベントループの読み込み側終端に 'pipe' を登録します。

     'protocol_factory' は *note asyncio プロトコル: 3aeb. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     'pipe' には *note file-like オブジェクト: 1581. を指定します。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note ReadTransport: 3aff. のインターフェースをサポートし、
     'protocol' は 'protocol_factory' ファクトリでインスタンス化されたオ
     ブジェクトです。

     *note SelectorEventLoop: 316. イベントループの場合、'pipe' は非ブロ
     ックモードに設定されていなければなりません。

 -- メソッド: async loop.connect_write_pipe (protocol_factory, pipe)

     'pipe' の書き込み側終端をイベントループに登録します。

     'protocol_factory' は *note asyncio プロトコル: 3aeb. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     'pipe' は *note file-like オブジェクト: 1581. です。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note WriteTransport: 3b00. のインスタンスであり、 'protocol' は
     'protocol_factory' ファクトリでインスタンス化されたオブジェクトです
     。

     *note SelectorEventLoop: 316. イベントループの場合、'pipe' は非ブロ
     ックモードに設定されていなければなりません。

     注釈: *note SelectorEventLoop: 316. は Windows 上で上記のメソッドを
     サポートしていません。 Windowsでは代わりに *note ProactorEventLoop:
     a03. を使ってください。

参考
....

*note loop.subprocess_exec(): 3a9c. および *note
loop.subprocess_shell(): 3a9d. メソッド。


File: python.info,  Node: Unix シグナル,  Next: スレッドまたはプロセスプールでコードを実行する,  Prev: パイプとやりとりする,  Up: Event loop methods

5.20.1.65 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(): 14f5. を使って登録されたシグナルハンドラと異なり、
     この関数で登録されたコールバックはイベントループと相互作用すること
     が可能です。

     シグナルナンバーが誤っているか捕捉不可能な場合 *note ValueError:
     15a. が送出されます。ハンドラーの設定に問題があった場合 *note
     RuntimeError: 317. が送出されます。

     コールバック 'callback' に *note キーワード引数を渡す: 3ae5. 場合は
     *note functools.partial(): 4ad. を使ってください。

     *note signal.signal(): 14f5. と同じく、この関数はメインスレッドから
     呼び出されなければなりません。

 -- メソッド: loop.remove_signal_handler (sig)

     シグナル 'sig' に対するハンドラを削除します。

     シグナルハンドラが削除された場合 ‘True’ を返します。シグナルに対し
     てハンドラが設定されていない場合には ‘False’ を返します。

     *note Availability: 234c.: Unix.

参考
....

*note signal: ce. モジュール。


File: python.info,  Node: スレッドまたはプロセスプールでコードを実行する,  Next: Error handling API,  Prev: Unix シグナル,  Up: Event loop methods

5.20.1.66 スレッドまたはプロセスプールでコードを実行する
........................................................

 -- メソッド: 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: 393d. instance.  The default executor
     is used if 'executor' is ‘None’.  The default executor can be set
     by *note loop.set_default_executor(): b2d, otherwise, a *note
     concurrent.futures.ThreadPoolExecutor: b2c. will be
     lazy-initialized and used by *note run_in_executor(): cbe. 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:
     211.  See *note Safe importing of main module: 3926.

     このメソッドは *note asyncio.Future: f8f. オブジェクトを返します。

     関数 'func' に *note キーワード引数を渡す: 3ae5. 場合は *note
     functools.partial(): 4ad. を使ってください。

     バージョン 3.5.3 で変更: *note loop.run_in_executor(): cbe. は内部
     で生成するスレッドプールエグゼキュータの ‘max_workers’ を設定せず、
     代わりにスレッドプールエグゼキュータ (*note ThreadPoolExecutor:
     b2c.) にデフォルト値を設定させるようになりました。

 -- メソッド: loop.set_default_executor (executor)

     Set 'executor' as the default executor used by *note
     run_in_executor(): cbe.  'executor' must be an instance of *note
     ThreadPoolExecutor: b2c, which includes *note
     InterpreterPoolExecutor: 471.

     バージョン 3.11 で変更: 'executor' must be an instance of *note
     ThreadPoolExecutor: b2c.


File: python.info,  Node: Error handling API,  Next: デバッグモードの有効化,  Prev: スレッドまたはプロセスプールでコードを実行する,  Up: Event loop methods

5.20.1.67 Error handling API
............................

イベントループ内での例外の扱い方をカスタマイズできます。

 -- メソッド: loop.set_exception_handler (handler)

     'handler' を新しいイベントループ例外ハンドラーとして設定します。

     'handler' が ‘None’ の場合、デフォルトの例外ハンドラが設定されます
     。そうでなければ、 'handler' は ‘(loop, context)’ に一致する関数シ
     グネチャを持った呼び出し可能オブジェクトでなければなりません。ここ
     で ‘loop’ はアクティブなイベントループへの参照であり、 ‘context’ は
     例外の詳細な記述からなる ‘dict’ オブジェクトです ('context' につい
     ての詳細は *note call_exception_handler(): 3b07. メソッドのドキュメ
     ントを参照してください)。

     If the handler is called on behalf of a *note Task: 467. or *note
     Handle: 2090, it is run in the *note contextvars.Context: 428. of
     that task or callback handle.

     バージョン 3.12 で変更: The handler may be called in the *note
     Context: 428. 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(): 3b07. と同
     じです。

 -- メソッド: loop.call_exception_handler (context)

     現在のイベントループ例外ハンドラーを呼び出します。

     'context' は以下のキーを含む ‘dict’ オブジェクトです (将来の Python
     バージョンで新しいキーが追加される可能性があります):

        * 'message': エラーメッセージ;

        * 'exception' (任意): 例外オブジェクト;

        * 'future' (任意): *note asyncio.Future: f8f. インスタンス;

        * 'task' (optional): *note asyncio.Task: 467. instance;

        * 'handle' (任意): *note asyncio.Handle: 2090. インスタンス;

        * 'protocol' (任意): *note プロトコル: 3aeb. インスタンス;

        * 'transport' (任意): *note トランスポート: 3aec. インスタンス;

        * 'socket' (optional): *note socket.socket: 115e. 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(): 3b06. method.


File: python.info,  Node: デバッグモードの有効化,  Next: Running subprocesses,  Prev: Error handling API,  Up: Event loop methods

5.20.1.68 デバッグモードの有効化
................................

 -- メソッド: loop.get_debug ()

     イベントループのデバッグモード (*note bool: 5f6.) を取得します。

     環境変数 *note PYTHONASYNCIODEBUG: 2346. に空でない文字列が設定され
     ている場合のデフォルト値は ‘True’、そうでない場合は ‘False’ になり
     ます。

 -- メソッド: loop.set_debug (enabled: bool)

     イベントループのデバッグモードを設定します。

     バージョン 3.7 で変更: 新しい *note Python 開発モード: 713. を使っ
     てデバッグモードを有効化することができるようになりました。

 -- の属性: 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 のデバッグモード: 2347.。


File: python.info,  Node: Running subprocesses,  Prev: デバッグモードの有効化,  Up: Event loop methods

5.20.1.69 Running subprocesses
..............................

この節で解説しているのは低水準のメソッドです。通常の async/await コード
では、高水準の関数である *note asyncio.create_subprocess_shell(): e3f. や
*note asyncio.create_subprocess_exec(): e3e. を代わりに使うことを検討し
てください。

     注釈: On Windows, the default event loop *note ProactorEventLoop:
     a03. supports subprocesses, whereas *note SelectorEventLoop: 316.
     does not.  See *note Subprocess Support on Windows: 3a9e. for
     details.

 -- メソッド: async loop.subprocess_exec (protocol_factory, *args,
          stdin=subprocess.PIPE, stdout=subprocess.PIPE,
          stderr=subprocess.PIPE, **kwargs)

     'args' で指定されたひとつの、または複数の文字列引数からサブプロセス
     を生成します。

     'args' は下記のいずれかに当てはまる文字列のリストでなければなりませ
     ん:

        * *note str: 1ea.;

        * または *note ファイルシステムのエンコーディング: 2e66. にエン
          コードされた *note bytes: 1d2.

     引数の最初の文字列はプログラムの実行ファイルを指定します。それに続
     く残りの文字列は引数を指定し、そのプログラムに対する ‘argv’ を構成
     します。

     このメソッドは標準ライブラリの *note subprocess.Popen: 6c5. クラス
     を、 ‘shell=False’ かつ最初の引数に文字列のリストを渡して呼び出した
     場合に似ています。しかし、 ‘Popen’ クラスは文字列のリストを引数とし
     てひとつだけ取るのに対して、 'subprocess_exec' は複数の文字列引数を
     とることができます。

     'protocol_factory' は *note asyncio.SubprocessProtocol: 3b0c. クラ
     スの派生クラスを返す呼び出し可能オブジェクトでなければなりません。

     その他の引数:

        * 'stdin' は下記のいずれかをとることができます:

             * a file-like object

             * an existing file descriptor (a positive integer), for
               example those created with *note os.pipe(): 1d81.

             * デフォルト値は *note subprocess.PIPE: f4a. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 150e. 定数を設定すると、特別な
               ファイル *note os.devnull: 2021. を使います。

        * 'stdout' は下記のいずれかをとることができます:

             * a file-like object

             * デフォルト値は *note subprocess.PIPE: f4a. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 150e. 定数を設定すると、特別な
               ファイル *note os.devnull: 2021. を使います。

        * 'stderr' は下記のいずれかをとることができます:

             * a file-like object

             * デフォルト値は *note subprocess.PIPE: f4a. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 150e. 定数を設定すると、特別な
               ファイル *note os.devnull: 2021. を使います。

             * *note subprocess.STDOUT: 3988. 定数を設定すると、標準エラ
               ー出力ストリームをプロセスの標準出力ストリームに接続しま
               す。

        * その他のすべてのキーワード引数は解釈されずにそのまま *note
          subprocess.Popen: 6c5. に渡されます。ただし、 'bufsize'、
          'universal_newlines'、 'shell'、 'text'、 'encoding' および
          'errors' は指定してはいけません。

          ‘asyncio’ のサブプロセス API はストリームからテキストへのデコ
          ードをサポートしていません。ストリームからテキストに変換するに
          は *note bytes.decode(): cac. 関数を使ってください。

     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(): 3aa0. or *note
     connect_read_pipe(): 3a9f. for use with the event loop.

     他の引数についての詳細は *note subprocess.Popen: 6c5. クラスのコン
     ストラクタを参照してください。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note asyncio.SubprocessTransport: 3b0d. 基底クラスに適合するオブジ
     ェクトで、 '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: 1ea. 文字列もしくは
     *note ファイルシステムのエンコーディング: 2e66. でエンコードされた
     *note bytes: 1d2. 文字列です。

     これは標準ライブラリの *note subprocess.Popen: 6c5. クラスを
     ‘shell=True’ で呼び出した場合と似ています。

     'protocol_factory' は *note SubprocessProtocol: 3b0c. の派生クラス
     を返す呼び出し可能オブジェクトでなければなりません。

     その他の引数についての詳細は *note subprocess_exec(): 3a9c. メソッ
     ドを参照してください。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note SubprocessTransport: 3b0d. 基底クラスに適合するオブジェクトで
     、 '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(): 787. 関数を使う
     と適切に行うことができます。

   ---------- 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.70 Callback handles
..........................

 -- クラス: asyncio.Handle

     *note loop.call_soon(): ecc. や *note loop.call_soon_threadsafe():
     ecd. が返すコールバックのラッパーです。

      -- メソッド: get_context ()

          Return the *note contextvars.Context: 428. 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(): ece,
     and *note loop.call_at(): ecf.

     このクラスは *note Handle: 2090. の派生クラスです。

      -- メソッド: when ()

          コールバックのスケジュール時刻を秒単位の *note float: 32f. で
          返します。

          戻り値の時刻は絶対値で、 *note loop.time(): 3ae8. と同じ参照時
          刻を使って定義されています。

          Added in version 3.7.


File: python.info,  Node: Server objects,  Next: Event loop implementations,  Prev: Callback handles,  Up: Event loop

5.20.1.71 Server objects
........................

Server オブジェクトは *note loop.create_server(): edb.、 *note
loop.create_unix_server(): 6d6.、 *note start_server(): ee1. および
*note start_unix_server(): 3a59. 関数により生成されます。

Do not instantiate the *note Server: eda. 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: fd9. 属性に ‘None’ を設定します。

          既存の受信中のクライアントとの接続を表すソケットはオープンのま
          まです。

          The server is closed asynchronously; use the *note
          wait_closed(): 1c65. 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(): 3aef. on all associated transports.

          *note close(): 3a56. 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(): 3b10. on all associated transports.

          *note close(): 3a56. 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(): edb. や *note asyncio.start_server():
          ee1. メソッドに対して使用することにより、初期に接続を受け付け
          ない Server オブジェクトを生成することができます。この場合
          ‘Server.start_serving()’ または *note Server.serve_forever():
          edd. メソッドを使ってオブジェクトが接続の受け付けを開始するよ
          うにすることができます。

          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(): 3a56. 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.72 Event loop implementations
....................................

asyncio は2つの異なるイベントループの実装、 *note SelectorEventLoop:
316. と *note ProactorEventLoop: a03.、 を提供します:

By default asyncio is configured to use *note EventLoop: 1c8c.

 -- クラス: asyncio.SelectorEventLoop

     A subclass of *note AbstractEventLoop: d2d. based on the *note
     selectors: ca. 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: 234c.: Unix, Windows.

 -- クラス: asyncio.ProactorEventLoop

     A subclass of *note AbstractEventLoop: d2d. for Windows that uses
     "I/O Completion Ports" (IOCP).

     *note Availability: 234c.: Windows.

     参考
     ....

     MSDN documentation on I/O Completion Ports(1).

 -- クラス: asyncio.EventLoop

          An alias to the most efficient available subclass of *note
          AbstractEventLoop: d2d. for the given platform.

          It is an alias to *note SelectorEventLoop: 316. on Unix and
          *note ProactorEventLoop: a03. on Windows.

     Added in version 3.13.

 -- クラス: asyncio.AbstractEventLoop

     asyncio に適合するイベントループの抽象基底クラスです。

     The *note Event loop methods: 3adf. 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.73 使用例
................

この節の全ての使用例は '意図的に' *note loop.run_forever(): 3ae1. や
*note loop.call_soon(): ecc. のような 低水準のイベントループ API の使用
法を示しています。一方で現代的な asyncio アプリケーションはここに示すよ
うな方法をほとんど必要としません。 *note asyncio.run(): 314. のような高
水準の関数の使用を検討してください。

* 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.74 call_soon() を使った Hello World
..........................................

*note loop.call_soon(): ecc. メソッドを使ってコールバックをスケジュール
する例です。コールバックは ‘"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(): 314. 関数を使用した同じような *note Hello
World: 3a13. の例。


File: python.info,  Node: call_later で現在の日時を表示する,  Next: 読み込みイベント用ファイル記述子の監視,  Prev: call_soon を使った Hello World,  Up: 使用例<25>

5.20.1.75 call_later() で現在の日時を表示する
.............................................

毎秒現在時刻を表示するコールバックの例です。コールバックは *note
loop.call_later(): ece. メソッドを使って自身を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(): 314. 関数を使用した同じような *note
現在時刻出力: 3a30. の例。


File: python.info,  Node: 読み込みイベント用ファイル記述子の監視,  Next: SIGINT および SIGTERM 用のシグナルハンドラーの設定,  Prev: call_later で現在の日時を表示する,  Up: 使用例<25>

5.20.1.76 読み込みイベント用ファイル記述子の監視
................................................

ファイル記述子が *note loop.add_reader(): 3a73. メソッドを使って何らかの
データを受信するまで待機し、その後イベントループをクローズします:

     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():
     9fe. メソッドを使用した同じような *note 例: 3a71.。

   * 高水準の *note asyncio.open_connection(): ee0. 関数とストリームを使
     用したもうひとつの *note 実装例: 3a6f.。


File: python.info,  Node: SIGINT および SIGTERM 用のシグナルハンドラーの設定,  Prev: 読み込みイベント用ファイル記述子の監視,  Up: 使用例<25>

5.20.1.77 SIGINT および SIGTERM 用のシグナルハンドラーの設定
............................................................

(This ‘signal’ example only works on Unix.)

Register handlers for signals *note SIGINT: 4e6. and *note SIGTERM:
1798. using the *note loop.add_signal_handler(): 3b02. 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.78 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/main/Lib/asyncio/futures.py

   (2) 
https://github.com/python/cpython/tree/main/Lib/asyncio/base_futures.py


File: python.info,  Node: Future の関数,  Next: Future オブジェクト<2>,  Up: Future

5.20.1.79 Future の関数
.......................

 -- の関数: asyncio.isfuture (obj)

     オブジェクト 'obj' が下記のいずれかであれば ‘True’ を返します:

        * *note asyncio.Future: f8f. クラスのインスタンス

        * *note asyncio.Task: 467. クラスのインスタンス

        * ‘_asyncio_future_blocking’ 属性を持った Future 的なオブジェク
          ト

     Added in version 3.5.

 -- の関数: asyncio.ensure_future (obj, *, loop=None)

     下記のいずれかを返します:

        * 'obj' が *note Future: f8f. オブジェクト、 *note Task: 467. オ
          ブジェクト、または Future 的なオブジェクト (*note isfuture():
          3b1d. 関数を使って検査します) である場合には 'obj' そのもの

        * 引数 'obj' がコルーチンである (*note iscoroutine(): 895. 関数
          を使って検査します) 場合には 'obj' をラップした *note Task:
          467. オブジェクト; この場合コルーチンは ‘ensure_future()’ によ
          りスケジュールされます。

        * 引数 'obj' が awaitable である (*note inspect.isawaitable():
          11cf. 関数を使って検査します) 場合には 'obj' を await する
          *note Task: 467. オブジェクト

     引数 'obj' が上記のいずれにもあてはまらない場合は *note TypeError:
     29c. 例外を送出します。

          重要: Save a reference to the result of this function, to
          avoid a task disappearing mid-execution.

          See also the *note create_task(): 469. function which is the
          preferred way for creating new tasks or use *note
          asyncio.TaskGroup: 6dd. which keeps reference to the task
          internally.

     バージョン 3.5.1 で変更: この関数はどんな *note awaitable: 6d5. な
     オブジェクトでも受け入れるようになりました。

     バージョン 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: 1570. オブジェクトを *note
     asyncio.Future: f8f. オブジェクトでラップします。

     バージョン 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.80 Future オブジェクト
.............................

 -- クラス: asyncio.Future (*, loop=None)

     Future は非同期処理の最終結果を表すクラスです。スレッドセーフではあ
     りません。

     Future is an *note awaitable: 6d5. 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: 3a1a. を使って実装されたプロトコル) が
     高水準の async/await と相互運用することを可能にするために利用されま
     す。

     経験則は Future オブジェクトをユーザー向けの API であらわに利用しな
     いことです。推奨される Future オブジェクトの生成方法は *note
     loop.create_future(): 103c. を呼び出すことです。これによりイベント
     ループの代替実装は、自身に最適化された Future オブジェクトの実装を
     合わせて提供することができます。

     バージョン 3.7 で変更: *note contextvars: 28. モジュールのサポート
     を追加。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if 'loop'
     is not specified and there is no running event loop.

      -- メソッド: result ()

          Future の結果を返します。

          Future が '完了' していて、 *note set_result(): 3a46. メソッド
          により設定された結果を持っている場合は結果の値を返します。

          Future が '完了' していて、 *note set_exception(): 1040. メソ
          ッドにより設定された例外を持っている場合はその例外を送出します
          。

          Future が 'キャンセルされた' 場合、このメソッドは *note
          CancelledError: 6e0. 例外を送出します。

          If the Future's result isn't yet available, this method raises
          an *note InvalidStateError: 3a49. exception.

      -- メソッド: set_result (result)

          Future を '完了' とマークし、結果を設定します。

          Raises an *note InvalidStateError: 3a49. error if the Future
          is already 'done'.

      -- メソッド: set_exception (exception)

          Future を '完了' とマークし、例外を設定します。

          Raises an *note InvalidStateError: 3a49. error if the Future
          is already 'done'.

      -- メソッド: done ()

          Future が '完了' しているなら ‘True’ を返します。

          Future は 'キャンセルされた' か、または *note set_result():
          3a46. メソッドや *note set_exception(): 1040. メソッドの呼び出
          しにより結果や例外が設定された場合に '完了' とみなされます。

      -- メソッド: 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(): ecc. メソッドに
          よりスケジュールされます。

          オプションのキーワード引数 'context' を使って、コールバック
          *callback* を実行する際のコンテキスト *note
          contextvars.Context: 428. を設定することができます。コンテキス
          ト 'context' が指定されない場合は現在のコンテキストが使われま
          す。

          コールバックにパラメータを渡すには、次の例のように *note
          functools.partial(): 4ad. を使うことができます:

               # 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: 6e0. exception raised when a
          cancelled Future is awaited.

          バージョン 3.9 で変更: Added the 'msg' parameter.

      -- メソッド: exception ()

          この Future オブジェクトに設定された例外を返します。

          例外 (または例外が設定されていないときは ‘None’) は Future が
          '完了' している場合のみ返されます。

          Future が 'キャンセルされた' 場合、このメソッドは *note
          CancelledError: 6e0. 例外を送出します。

          Future が '未完了' の場合、このメソッドは *note
          InvalidStateError: 3a49. 例外を送出します。

      -- メソッド: 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: 1570.
     を模倣してデザインされました。両者の重要な違いは以下の通りです:

        - asyncio の Futures と異なり、 *note concurrent.futures.Future:
          1570. インスタンスは待ち受けできません。

        - *note asyncio.Future.result(): 3b20. と *note
          asyncio.Future.exception(): 3b23. は 'timeout' 引数を取りませ
          ん。

        - *note asyncio.Future.result(): 3b20. と *note
          asyncio.Future.exception(): 3b23. は Future が '未完了' の場合
          に *note InvalidStateError: 3a49. 例外を送出します。

        - *note asyncio.Future.add_done_callback(): ed0. メソッドによっ
          て登録されたコールバックは、即座に呼び出されません。代わりにコ
          ールバックは *note loop.call_soon(): ecc. によりスケジュールさ
          れます。

        - asyncio の Future は *note concurrent.futures.wait(): 1e1b. お
          よび *note concurrent.futures.as_completed(): 1bf0. との互換性
          がありません。

        - *note asyncio.Future.cancel(): 1dc2. accepts an optional ‘msg’
          argument, but *note concurrent.futures.Future.cancel(): 3949.
          does not.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0567/


File: python.info,  Node: トランスポートとプロトコル,  Next: ポリシー,  Prev: Future,  Up: asyncio --- 非同期 I/O

5.20.1.81 トランスポートとプロトコル
....................................

まえがき
........

トランスポートとプロトコルは *note loop.create_connection(): 9fe. のよう
な '低水準の' イベントループ API から使われます。これらはコールバックに
基づくプログラミングスタイルを使うことでネットワークや IPC プロトコル
(HTTP など) の高性能な実装を可能にします。

基本的にトランスポートとプロトコルはライブラリやフレームワークからのみ使
われるべきであり、高水準の asyncio アプリケーションから使われるものでは
ありません。

このドキュメントは *note Transports: 3b28. と *note Protocols: 3b29. を
扱います。

はじめに
........

最上位の観点からは、トランスポートは 'どのように' バイトデータを送信する
かに影響を与え、いっぽうプロトコルは 'どの' バイトデータを送信するかを決
定します (また、ある程度は 'いつ' も決定します) 。

同じことを違う言い方で表現します: トランスポートはソケット (または同様の
I/O 端点) の抽象化であり、プロトコルはトランスポートから見たときのアプリ
ケーションの抽象化です。

さらにもう一つの見方として、トランスポートとプロトコルの2つのインターフ
ェースは、協調してネットワーク I/O やプロセス間 I/O の抽象インターフェー
スを定義しています。

トランスポートオブジェクトとプロトコルオブジェクトの間には常に1対1の関係
があります: プロトコルはデータを送信するためにトランスポートのメソッドを
呼び出し、トランスポートは受信したデータを渡すためにプロトコルのメソッド
を呼び出します。

ほとんどの接続に基づくイベントループメソッド (*note
loop.create_connection(): 9fe. など) は通常 'protocol_factory' 引数を受
け取り、 'Transport' オブジェクトで表現される確立した接続に対する
'Protocol' オブジェクトを生成するために使います。そのようなメソッドは通
常 ‘(transport, protocol)’ タプルを返します。

内容
....

このページは以下の節から構成されます:

   * *note Transports: 3b28. 節は asyncio の *note BaseTransport: 3b2a,
     *note ReadTransport: 3aff, *note WriteTransport: 3b00, *note
     Transport: 3b2b, *note DatagramTransport: 1d44, および *note
     SubprocessTransport: 3b0d. クラスについて記述しています。

   * *note Protocols: 3b29. 節は asyncio の *note BaseProtocol: 3b2c,
     *note Protocol: 3b2d, *note BufferedProtocol: e67, *note
     DatagramProtocol: ac1, および *note SubprocessProtocol: 3b0c. クラ
     スについて記述しています。

   * *note Examples: 3b2e. 節はトランスポート、プロトコル、および低水準
     のイベントループ API の利用方法を紹介しています。

* Menu:

* トランスポート::
* プロトコル: プロトコル<2>.
* 使用例: 使用例<26>.


File: python.info,  Node: トランスポート,  Next: プロトコル<2>,  Up: トランスポートとプロトコル

5.20.1.82 トランスポート
........................

'ソースコード:' Lib/asyncio/transports.py(1)

__________________________________________________________________

トランスポートはさまざまな通信方法を抽象化するために *note asyncio: b. が
提供するクラス群です。

トランスポートオブジェクトは常に *note asyncio イベントループ: 1133. に
よってインスタンス化されます。

asyncio は TCP, UDP, SSL, およびサブプロセスパイプのトランスポートを実装
しています。利用可能なトランスポートのメソッドはトランスポートの種類に依
存します。

トランスポートクラスは *note スレッド安全ではありません: 3a41.。

* Menu:

* トランスポートのクラス階層構造::
* 基底トランスポート::
* 読み出し専用のトランスポート::
* 書き込み専用のトランスポート::
* データグラムトランスポート::
* サブプロセス化されたトランスポート::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/asyncio/transports.py


File: python.info,  Node: トランスポートのクラス階層構造,  Next: 基底トランスポート,  Up: トランスポート

5.20.1.83 トランスポートのクラス階層構造
........................................

 -- クラス: asyncio.BaseTransport

     全てのトランスポートの基底クラスです。すべての asyncio トランスポー
     トが共有するメソッドを含んでいます。

 -- クラス: asyncio.WriteTransport (BaseTransport)

     書き込み専用の接続に対する基底トランスポートクラスです。

     'WriteTransport' クラスのインスタンスは *note
     loop.connect_write_pipe(): 3aa0. イベントループメソッドから返され、
     *note loop.subprocess_exec(): 3a9c. のようなサブプロセスに関連する
     メソッドから利用されます。

 -- クラス: asyncio.ReadTransport (BaseTransport)

     読み込み専用の接続に対する基底トランスポートクラスです。

     Instances of the 'ReadTransport' class are returned from the *note
     loop.connect_read_pipe(): 3a9f. event loop method and are also used
     by subprocess-related methods like *note loop.subprocess_exec():
     3a9c.

 -- クラス: asyncio.Transport (WriteTransport, ReadTransport)

     TCP 接続のような、読み出しと書き込みの双方向のトランスポートを表現
     するインターフェースです。

     ユーザーはトランスポートを直接インスタンス化することはありません; ユ
     ーザーは、ユーティリティ関数にプロトコルファクトリとその他トランス
     ポートとプロトコルを作成するために必要な情報を渡して呼び出します。

     'Transport' クラスのインスタンスは、*note loop.create_connection():
     9fe, *note loop.create_unix_connection(): 3a58, *note
     loop.create_server(): edb, *note loop.sendfile(): 3af5. などのイベ
     ントループメソッドから返されたり、これらのメソッドから利用されたり
     します。

 -- クラス: asyncio.DatagramTransport (BaseTransport)

     データグラム (UDP) 接続のためのトランスポートです。

     'DatagramTransport' クラスのインスタンスは *note
     loop.create_datagram_endpoint(): b1f. イベントループメソッドから返
     されます。

 -- クラス: asyncio.SubprocessTransport (BaseTransport)

     親プロセスとその子プロセスの間の接続を表現する抽象クラスです。

     'SubprocessTransport' クラスのインスタンスは *note
     loop.subprocess_shell(): 3a9d. と *note loop.subprocess_exec():
     3a9c. の2つのイベントループメソッドから返されます。


File: python.info,  Node: 基底トランスポート,  Next: 読み出し専用のトランスポート,  Prev: トランスポートのクラス階層構造,  Up: トランスポート

5.20.1.84 基底トランスポート
............................

 -- メソッド: BaseTransport.close ()

     トランスポートをクローズします。

     トランスポートが発信データのバッファーを持っていた場合、バッファー
     されたデータは非同期にフラッシュされます。それ以降データは受信され
     ません。バッファーされていたデータがすべてフラッシュされた後、その
     プロトコルの *note protocol.connection_lost(): 3b31. メソッドが引数
     *note None: a6a. で呼び出されます。一度閉じたトランスポートは、使用
     されるべきではありません。

 -- メソッド: 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(): 3b32. の結果になりま
               す (エラーのときは ‘None’)

             - ‘'socket'’: *note socket.socket: 115e. のインスタンスにな
               ります

             - ‘'sockname'’: ソケット自身のアドレスで、*note
               socket.socket.getsockname(): 513. の結果になります

        * SSL ソケット:

             - ‘'compression'’: 圧縮アルゴリズムで、*note
               ssl.SSLSocket.compression(): 1505. の結果になります。圧縮
               されていないときは ‘None’ になります

             - ‘'cipher'’: 3 個の値 (使用されている暗号アルゴリズムの名
               称、使用が定義されている SSL プロトコルのバージョン、およ
               び使用されている秘密鍵のビット数) からなるタプルで、*note
               ssl.SSLSocket.cipher(): 3b33. の結果になります

             - ‘'peercert'’: ピアの証明書で、*note
               ssl.SSLSocket.getpeercert(): 1366. の結果になります

             - ‘'sslcontext'’: *note ssl.SSLContext: 33e. のインスタンス
               になります

             - ‘'ssl_object'’: *note ssl.SSLObject: f44. または *note
               ssl.SSLSocket: cbf. インスタンス

        * パイプ:

             - ‘'pipe'’: パイプオブジェクトです

        * サブプロセス:

             - ‘'subprocess'’: *note subprocess.Popen: 6c5. のインスタン
               スになります

 -- メソッド: BaseTransport.set_protocol (protocol)

     トランスポートに新しいプロトコルを設定します。

     プロトコルの切り替えは、両方のプロトコルのドキュメントで切り替えが
     サポートされている場合にのみ行うべきです。

 -- メソッド: BaseTransport.get_protocol ()

     現在のプロトコルを返します。


File: python.info,  Node: 読み出し専用のトランスポート,  Next: 書き込み専用のトランスポート,  Prev: 基底トランスポート,  Up: トランスポート

5.20.1.85 読み出し専用のトランスポート
......................................

 -- メソッド: ReadTransport.is_reading ()

     トランスポートが新しいデータを受信中の場合 ‘True’ を返します。

     Added in version 3.7.

 -- メソッド: ReadTransport.pause_reading ()

     トランスポートの受信側を一時停止します。 *note resume_reading():
     ee4. メソッドが呼び出されるまでプロトコルの *note
     protocol.data_received(): 1d20. メソッドにデータは渡されません。

     バージョン 3.7 で変更: このメソッドはべき等です。すなわちトランスポ
     ートがすでに停止していたりクローズしていても呼び出すことができます
     。

 -- メソッド: ReadTransport.resume_reading ()

     受信を再開します。データが読み込み可能になるとプロトコルの *note
     protocol.data_received(): 1d20. メソッドが再び呼び出されるようにな
     ります。

     バージョン 3.7 で変更: このメソッドはべき等です。すなわちトランスポ
     ートがすでにデータを読み込み中であっても呼び出すことができます。


File: python.info,  Node: 書き込み専用のトランスポート,  Next: データグラムトランスポート,  Prev: 読み出し専用のトランスポート,  Up: トランスポート

5.20.1.86 書き込み専用のトランスポート
......................................

 -- メソッド: WriteTransport.abort ()

     未完了の処理が完了するのを待たず、即座にトランスポートをクローズし
     ます。バッファーされているデータは失われます。このメソッドの呼び出
     し以降データは受信されません。最終的にプロトコルの *note
     protocol.connection_lost(): 3b31. メソッドが引数 *note None: a6a. で
     呼び出されます。

 -- メソッド: WriteTransport.can_write_eof ()

     トランスポートが *note write_eof(): 3b39. メソッドをサポートしてい
     る場合 *note True: fd0. を返し、そうでない場合は *note False: ef9.
     を返します。

 -- メソッド: WriteTransport.get_write_buffer_size ()

     トランスポートで使用されている出力バッファーの現在のサイズを返しま
     す。

 -- メソッド: WriteTransport.get_write_buffer_limits ()

     書き込みフロー制御の '最高' および '最低' 水位点を取得します。
     ‘(low, high)’ タプルを返します。ここで 'low' と 'high' はバイト数を
     あらわす正の整数です。

     水位点の設定は *note set_write_buffer_limits(): 3b3a. で行います。

     Added in version 3.4.2.

 -- メソッド: WriteTransport.set_write_buffer_limits (high=None,
          low=None)

     書き込みフロー制御の '最高' および '最低' 水位点を設定します。

     (バイト数をあらわす) これら2つの値はプロトコルの *note
     protocol.pause_writing(): 3b3b. と *note protocol.resume_writing():
     3b3c. の2つのメソッドがいつ呼ばれるかを制御します。指定する場合、
     'low' は 'high' と等しいかまたは 'high' より小さくなければなりませ
     ん。また、 'high' も 'low' も負の値を指定することはできません。

     *note pause_writing(): 3b3b. はバッファーサイズが 'high' の値以上に
     なった場合に呼び出されます。書き込みが一時停止している場合、バッフ
     ァーサイズが 'low' の値以下になると *note resume_writing(): 3b3c. メ
     ソッドが呼び出されます。

     デフォルト値は実装固有になります。 'high' のみ与えられた場合、
     'low' は 'high' 以下の実装固有のデフォルト値になります。 'high' を
     ゼロに設定すると 'low' も強制的にゼロになり、バッファーが空でなくな
     るとすぐに *note pause_writing(): 3b3b. メソッドが呼び出されるよう
     になります。 'low' をゼロに設定すると、バッファーが空にな *note
     resume_writing(): 3b3c. が呼び出されるようになります。どちらかにゼ
     ロを設定することは I/O と計算を並行に実行する機会を減少させるため、
     一般に最適ではありません。

     上限値と下限値を取得するには *note get_write_buffer_limits(): 1181.
     メソッドを使ってください。

 -- メソッド: WriteTransport.write (data)

     トランスポートにバイト列 'data' を書き込みます。

     このメソッドはブロックしません; データをバッファーし、非同期に送信
     する準備を行います。

 -- メソッド: WriteTransport.writelines (list_of_data)

     バイト列のデータのリスト (またはイテラブル) をトランスポートに書き
     込みます。この振る舞いはイテラブルを yield して各要素で *note
     write(): 1a2a. を呼び出すことと等価ですが、より効率的な実装となる場
     合があります。

 -- メソッド: WriteTransport.write_eof ()

     バッファーされた全てのデータをフラッシュした後トランスポートの送信
     側をクローズします。送信側をクローズした後もデータを受信することは
     可能です。

     このメソッドはトランスポート (例えば SSL) がハーフクローズドな接続
     をサポートしていない場合 *note NotImplementedError: 5a1. を送出しま
     す。


File: python.info,  Node: データグラムトランスポート,  Next: サブプロセス化されたトランスポート,  Prev: 書き込み専用のトランスポート,  Up: トランスポート

5.20.1.87 データグラムトランスポート
....................................

 -- メソッド: DatagramTransport.sendto (data, addr=None)

     リモートピア 'addr' (トランスポート依存の対象アドレス) にバイト列
     'data' を送信します。'addr' が *note None: a6a. の場合、データはト
     ランスポートの作成時に指定された送信先に送られます。

     このメソッドはブロックしません; データをバッファーし、非同期に送信
     する準備を行います。

     バージョン 3.13 で変更: このメソッドは、長さがゼロのデータグラムを
     送信するために、空のバイトオブジェクトで呼び出すこともできます。フ
     ロー制御に使用されるバッファサイズ計算も、データグラムヘッダーを考
     慮するように更新されました。

 -- メソッド: DatagramTransport.abort ()

     未完了の処理が完了するのを待たず、即座にトランスポートをクローズし
     ます。バッファーされているデータは失われます。このメソッドの呼び出
     し以降データは受信されません。最終的にプロトコルの *note
     protocol.connection_lost(): 3b31. メソッドが引数 *note None: a6a. で
     呼び出されます。


File: python.info,  Node: サブプロセス化されたトランスポート,  Prev: データグラムトランスポート,  Up: トランスポート

5.20.1.88 サブプロセス化されたトランスポート
............................................

 -- メソッド: SubprocessTransport.get_pid ()

     サブプロセスのプロセス ID (整数) を返します。

 -- メソッド: SubprocessTransport.get_pipe_transport (fd)

     整数のファイル記述子 'fd' に該当する通信パイプのトランスポートを返
     します:

        * ‘0’: writable streaming transport of the standard input
          ('stdin'), or *note None: a6a. if the subprocess was not
          created with ‘stdin=PIPE’

        * ‘1’: readable streaming transport of the standard output
          ('stdout'), or *note None: a6a. if the subprocess was not
          created with ‘stdout=PIPE’

        * ‘2’: readable streaming transport of the standard error
          ('stderr'), or *note None: a6a. if the subprocess was not
          created with ‘stderr=PIPE’

        * その他の 'fd': *note None: a6a.

 -- メソッド: SubprocessTransport.get_returncode ()

     サブプロセスのリターンコードを整数で返します。サブプロセスがリター
     ンしなかった場合は *note None: a6a. を返します。 *note
     subprocess.Popen.returncode: e56. 属性と同じです。

 -- メソッド: SubprocessTransport.kill ()

     サブプロセスを強制終了 (kill) します。

     POSIX システムでは、この関数はサブプロセスに SIGKILL を送信します。
     Windows では、このメソッドは *note terminate(): 3b44. の別名です。

     *note subprocess.Popen.kill(): 1796. も参照してください。

 -- メソッド: SubprocessTransport.send_signal (signal)

     サブプロセスにシグナル 'signal' を送信します。*note
     subprocess.Popen.send_signal(): 1797. と同じです。

 -- メソッド: SubprocessTransport.terminate ()

     サブプロセスを停止します。

     POSIX システムでは、このメソッドはサブプロセスに *note SIGTERM:
     1798. を送信します。Windows では、Windows API 関数
     ‘TerminateProcess()’ がサブプロセスを停止するために呼び出されます。

     *note subprocess.Popen.terminate(): 1795. も参照してください。

 -- メソッド: SubprocessTransport.close ()

     *note kill(): 3b43. メソッドを呼び出すことでサブプロセスを強制終了
     します。

     サブプロセスがまだリターンしていない場合、 'stdin', 'stdout', およ
     び 'stderr' の各パイプのトランスポートをクローズします。


File: python.info,  Node: プロトコル<2>,  Next: 使用例<26>,  Prev: トランスポート,  Up: トランスポートとプロトコル

5.20.1.89 プロトコル
....................

'ソースコード:' Lib/asyncio/protocols.py(1)

__________________________________________________________________

asyncio はネットワークプロトコルを実装するために使う抽象基底クラス群を提
供します。これらのクラスは *note トランスポート: 3aec. と組み合わせて使
うことが想定されています。

抽象基底プロトコルクラスの派生クラスはメソッドの一部または全てを実装する
ことができます。これらのメソッドは全てコールバックです: それらは、データ
を受信した、などの決まったイベントに対してトランスポートから呼び出されま
す。基底プロトコルメソッドは対応するトランスポートから呼び出されるべきで
す。

* Menu:

* 基底プロトコル::
* 基底プロトコル: 基底プロトコル<2>.
* ストリーミングプロトコル::
* バッファリングされたストリーミングプロトコル::
* データグラムプロトコル::
* サブプロセスプロトコル::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/asyncio/protocols.py


File: python.info,  Node: 基底プロトコル,  Next: 基底プロトコル<2>,  Up: プロトコル<2>

5.20.1.90 基底プロトコル
........................

 -- クラス: 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.91 基底プロトコル
........................

全ての asyncio プロトコルは基底プロトコルのコールバックを実装することが
できます。

通信のコールバック
..................

コネクションコールバックは全てのプロトコルから、成功したコネクションそれ
ぞれにつきただ一度だけ呼び出されます。その他の全てのプロトコルコールバッ
クはこれら2つのメソッドの間に呼び出すことができます。

 -- メソッド: BaseProtocol.connection_made (transport)

     コネクションが作成されたときに呼び出されます。

     引数 'transport' はコネクションをあらわすトランスポートです。プロト
     コルはトランスポートへの参照を保存する責任を負います。

 -- メソッド: BaseProtocol.connection_lost (exc)

     コネクションが失われた、あるいはクローズされたときに呼び出されます
     。

     引数は例外オブジェクトまたは *note None: a6a. になります。‘None’ の
     とき、通常の EOF が受信されたか、あるいはコネクションがこちら側から
     中止またはクローズされたことを意味します。

フロー制御コールバック
......................

フロー制御コールバックは、プロトコルによって実行される書き込み処理を停止
または再開するためにトランスポートから呼び出されます。

詳しくは *note set_write_buffer_limits(): 3b3a. メソッドのドキュメントを
参照してください。

 -- メソッド: BaseProtocol.pause_writing ()

     トランスポートのバッファーサイズが最高水位点 (high watermark) を超
     えたときに呼び出されます。

 -- メソッド: BaseProtocol.resume_writing ()

     トランスポートのバッファーサイズが最低水位点 (low watermark) に達し
     たきに呼び出されます。

バッファーサイズが最高水位点と等しい場合、 *note pause_writing(): 3b3b.
は呼び出されません: バッファーサイズは必ず制限値を超えなければなりません
。

それに対して、 *note resume_writing(): 3b3c. はバッファーサイズが最低水
位点と等しいかそれよりも小さい場合に呼び出されます。これらの境界条件は、
どちらの基準値もゼロである場合の処理が期待通りとなることを保証するために
重要です。


File: python.info,  Node: ストリーミングプロトコル,  Next: バッファリングされたストリーミングプロトコル,  Prev: 基底プロトコル<2>,  Up: プロトコル<2>

5.20.1.92 ストリーミングプロトコル
..................................

*note loop.create_server(): edb, *note loop.create_unix_server(): 6d6,
*note loop.create_connection(): 9fe, *note
loop.create_unix_connection(): 3a58, *note
loop.connect_accepted_socket(): bbf, *note loop.connect_read_pipe():
3a9f, そして *note loop.connect_write_pipe(): 3aa0. などのイベントメソッ
ドはストリーミングプロトコルを返すファクトリを受け付けます。

 -- メソッド: Protocol.data_received (data)

     データを受信したときに呼び出されます。'data' は受信したデータを含む
     空ではないバイト列オブジェクトになります。

     データがバッファーされるか、チャンキングされるか、または再構築され
     るかはトランスポートに依存します。一般には、特定のセマンティクスを
     信頼するべきではなく、代わりにデータのパースを全般的かつ柔軟に行う
     べきです。ただし、データは常に正しい順序で受信されます。

     このメソッドは、コネクションがオープンである間は何度でも呼び出すこ
     とができます。

     いっぽうで、 *note protocol.eof_received(): 3b4a. メソッドは最大で
     も一度だけ呼び出されます。いったん ‘eof_received()’ が呼び出される
     と、それ以降 ‘data_received()’ は呼び出されません。

 -- メソッド: Protocol.eof_received ()

     コネクションの相手方がこれ以上データを送信しないことを伝えてきたと
     き (例えば相手方が asyncio を使用しており、 *note
     transport.write_eof(): 3b39. を呼び出した場合) に呼び出されます。

     このメソッドは (‘None’ を含む) 偽値 を返すことがあり、その場合トラ
     ンスポートは自身をクローズします。一方メソッドが真値を返す場合は、
     利用しているプロトコルがトランスポートをクローズするかどうかを決め
     ます。デフォルトの実装は ‘None’ を返すため、コネクションは暗黙のう
     ちにクローズされます。

     SSL を含む一部のトランスポートはハーフクローズ接続をサポートしませ
     ん。そのような場合このメソッドが真値を返すとコネクションはクローズ
     されます。

ステートマシン:

     start -> connection_made
         [-> data_received]*
         [-> eof_received]?
     -> connection_lost -> end


File: python.info,  Node: バッファリングされたストリーミングプロトコル,  Next: データグラムプロトコル,  Prev: ストリーミングプロトコル,  Up: プロトコル<2>

5.20.1.93 バッファリングされたストリーミングプロトコル
......................................................

Added in version 3.7.

バッファー付きプロトコルは *note ストリーミングプロトコル: 3b49. をサポ
ートするイベントループメソッドで利用することができます。

‘BufferedProtocol’ 実装は受信バッファーの手動での明示的な割り当てや制御
を可能にします。イベントループはプロトコルにより提供されるバッファを利用
することにより不要なデータのコピーを避けることができます。これにより大量
のデータを受信するプロトコルにおいて顕著なパフォーマンスの向上をもたらし
ます。精巧なプロトコル実装によりバッファー割り当ての数を劇的に減少させる
ことができます。

以下に示すコールバックは *note BufferedProtocol: e67. インスタンスに対し
て呼び出されます:

 -- メソッド: BufferedProtocol.get_buffer (sizehint)

     新しい受信バッファを割り当てるために呼び出します。

     'sizehint' は返されるバッファーの推奨される最小サイズです。
     'sizehint' によって推奨された値より小さい、または大きいサイズのバッ
     ファーを返すことは容認されています。 -1 がセットされた場合、バッフ
     ァーサイズは任意となります。サイズがゼロのバッファーを返すとエラー
     になります。

     ‘get_buffer()’ は *note バッファープロトコル: 319. を実装したオブジ
     ェクトを返さなければなりません。

 -- メソッド: BufferedProtocol.buffer_updated (nbytes)

     受信データによりバッファが更新された場合に呼び出されます。

     'nbytes' はバッファに書き込まれた総バイト数です。

 -- メソッド: BufferedProtocol.eof_received ()

     *note protocol.eof_received(): 3b4a. メソッドのドキュメントを参照し
     てください。

コネクションの間、 *note get_buffer(): 3b4c. は何度でも呼び出すことがで
きます。しかし *note protocol.eof_received(): 3b4a. が呼び出されるのは最
大でも1回で、もし呼び出されると、それ以降 ‘get_buffer()’ と *note
buffer_updated(): 3b4d. が呼び出されることはありません。

ステートマシン:

     start -> connection_made
         [-> get_buffer
             [-> buffer_updated]?
         ]*
         [-> eof_received]?
     -> connection_lost -> end


File: python.info,  Node: データグラムプロトコル,  Next: サブプロセスプロトコル,  Prev: バッファリングされたストリーミングプロトコル,  Up: プロトコル<2>

5.20.1.94 データグラムプロトコル
................................

データグラムプロトコルのインスタンスは *note
loop.create_datagram_endpoint(): b1f. メソッドに渡されたプロトコルファク
トリによって生成されるべきです。

 -- メソッド: DatagramProtocol.datagram_received (data, addr)

     データグラムを受信したときに呼び出されます。'data' は受信データを含
     むバイトオブジェクトです。'addr' はデータを送信するピアのアドレスで
     す; 正確な形式はトランスポートに依存します。

 -- メソッド: DatagramProtocol.error_received (exc)

     直前の送信あるいは受信が *note OSError: 543. を送出したときに呼び出
     されます。'exc' は ‘OSError’ のインスタンスになります。

     このメソッドが呼ばれるのは、トランスポート (UDP など) がデータグラ
     ムを受信側に配信できなかったことが検出されたなどの、まれな場合にお
     いてのみです。ほとんどの場合、データグラムが配信できなければそのま
     ま通知されることなく破棄されます。

     注釈: BSD システム (macOS, FreeBSD など) ではフロー制御はサポートさ
     れていません。これは非常に多くのパケットを書き込もうとしたことによ
     る送信の失敗を検出する信頼できる方法が存在しないためです。

     ソケットは常に '準備ができた状態' のように振る舞いますが、超過した
     パケットは破棄されます。この場合 ‘errno’ を *note errno.ENOBUFS:
     1d8d. に設定した *note OSError: 543. 例外が送出されることがあります
     。もし例外が送出された場合は *note
     DatagramProtocol.error_received(): 3b51. に通知されますが、送出され
     ない場合は単に無視されます。


File: python.info,  Node: サブプロセスプロトコル,  Prev: データグラムプロトコル,  Up: プロトコル<2>

5.20.1.95 サブプロセスプロトコル
................................

サブプロセスプロトコルのインスタンスは *note loop.subprocess_exec():
3a9c. と *note loop.subprocess_shell(): 3a9d. メソッドに渡されたプロトコ
ルファクトリにより生成されるべきです。

 -- メソッド: SubprocessProtocol.pipe_data_received (fd, data)

     子プロセスが標準出力または標準エラー出力のパイプにデータを書き込ん
     だ時に呼び出されます。

     'fd' はパイプのファイル記述子を表す整数です。

     'data' は受信データを含む空でないバイトオブジェクトです。

 -- メソッド: SubprocessProtocol.pipe_connection_lost (fd, exc)

     子プロセスと通信するパイプのいずれかがクローズされたときに呼び出さ
     れます。

     'fd' はクローズされたファイル記述子を表す整数です。

 -- メソッド: SubprocessProtocol.process_exited ()

     子プロセスが終了したときに呼び出されます。

     これは、 *note pipe_data_received(): 1d6d. と *note
     pipe_connection_lost(): 3b53. メソッドの前に呼び出すことができます
     。


File: python.info,  Node: 使用例<26>,  Prev: プロトコル<2>,  Up: トランスポートとプロトコル

5.20.1.96 使用例
................

* 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.97 TCP エコーサーバー
............................

*note loop.create_server(): edb. メソッドを使って 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 エコーサーバー: 3a6b. の例では高水準の
*note asyncio.start_server(): ee1. 関数を使っています。


File: python.info,  Node: TCP エコークライアント,  Next: UDP エコーサーバー,  Prev: TCP エコーサーバー,  Up: 使用例<26>

5.20.1.98 TCP エコークライアント
................................

*note loop.create_connection(): 9fe. メソッドを使った 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 エコークライアント: 3a68. の例では高水準の
*note asyncio.open_connection(): ee0. 関数を使っています。


File: python.info,  Node: UDP エコーサーバー,  Next: UDP エコークライアント,  Prev: TCP エコークライアント,  Up: 使用例<26>

5.20.1.99 UDP エコーサーバー
............................

*note loop.create_datagram_endpoint(): b1f. メソッドを使った 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.100 UDP エコークライアント
.................................

*note loop.create_datagram_endpoint(): b1f. メソッドを使った 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.101 既存のソケットへの接続
.................................

プロトコルを設定した *note loop.create_connection(): 9fe. メソッドを使っ
てソケットがデータを受信するまで待機します:

     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 ファイル記述子の読み込みイベントを監視する: 3a72. 例では低レベルの
*note loop.add_reader(): 3a73. メソッドを使ってファイル記述子 (FD) を登
録しています。

*note ストリームを使ってデータを待ち受けるオープンなソケットを登録する:
3a6f. 例ではコルーチン内で *note open_connection(): ee0. 関数によって生
成されたストリームを使っています。


File: python.info,  Node: loop subprocess_exec と SubprocessProtocol,  Prev: 既存のソケットへの接続,  Up: 使用例<26>

5.20.1.102 loop.subprocess_exec() と SubprocessProtocol
.......................................................

サブプロセスからの出力を受け取り、サブプロセスが終了するまで待機するため
に使われるサブプロセスプロトコルの例です。

サブプロセスは *note loop.subprocess_exec(): 3a9c. メソッドにより生成さ
れます:

     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 同様の例: 3ab0. も参照してください。


File: python.info,  Node: ポリシー,  Next: プラットフォームでのサポート,  Prev: トランスポートとプロトコル,  Up: asyncio --- 非同期 I/O

5.20.1.103 ポリシー
...................

     警告: Policies are deprecated and will be removed in Python 3.16.
     Users are encouraged to use the *note asyncio.run(): 314. function
     or the *note asyncio.Runner: 315. 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: 1133, as well as create new event loops.  The default
policy can be *note replaced: 3b5d. with *note built-in alternatives:
3b5e. to use different event loop implementations, or substituted by a
*note custom policy: 3b5f. that can override these behaviors.

The *note policy object: 3b60. 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(): 573, *note set_event_loop(): 1d72, and *note
new_event_loop(): 3a20.

ポリシーオブジェクトは *note AbstractEventLoopPolicy: 30e. 抽象基底クラ
スで定義された API を実装しなければなりません。

* Menu:

* ポリシーの取得と設定::
* ポリシーオブジェクト::
* ポリシーのカスタマイズ::


File: python.info,  Node: ポリシーの取得と設定,  Next: ポリシーオブジェクト,  Up: ポリシー

5.20.1.104 ポリシーの取得と設定
...............................

以下の関数は現在のプロセスに対するポリシーの取得や設定をするために使われ
ます:

 -- の関数: 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.105 ポリシーオブジェクト
...............................

イベントループポリシーの抽象基底クラスは以下のように定義されています:

 -- クラス: asyncio.AbstractEventLoopPolicy

     asyncio ポリシーの抽象基底クラスです。

      -- メソッド: get_event_loop ()

          現在のコンテキストのイベントループを取得します。

          *note AbstractEventLoop: d2d. のインターフェースを実装したイベ
          ントループオブジェクトを返します。

          このメソッドは ‘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:
     a03. を使います。

     デフォルトのポリシーを手動でインストールする必要はありません。
     asyncio はデフォルトポリシーを使うように自動的に構成されます。

     バージョン 3.8 で変更: Windows では *note ProactorEventLoop: a03. が
     デフォルトで使われるようになりました。

     バージョン 3.14 で変更: The *note get_event_loop(): 573. method of
     the default asyncio policy now raises a *note RuntimeError: 317. 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: 234c.: Windows.

     バージョン 3.14 で非推奨: The ‘WindowsSelectorEventLoopPolicy’
     class is deprecated and will be removed in Python 3.16.

 -- クラス: asyncio.WindowsProactorEventLoopPolicy

     *note ProactorEventLoop: a03. イベントループ実装を使った別のイベン
     トループポリシーです。

     *note Availability: 234c.: 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.106 ポリシーのカスタマイズ
.................................

新しいイベントループのポリシーを実装するためには、以下に示すように *note
DefaultEventLoopPolicy: 30f. を継承して振る舞いを変更したいメソッドをオ
ーバーライドすることが推奨されます。:

     class MyEventLoopPolicy(asyncio.DefaultEventLoopPolicy):

         def get_event_loop(self):
             """Get the event loop.

             This may be None or an instance of EventLoop.
             """
             loop = super().get_event_loop()
             # Do something with loop ...
             return loop

     asyncio.set_event_loop_policy(MyEventLoopPolicy())


File: python.info,  Node: プラットフォームでのサポート,  Next: Extending,  Prev: ポリシー,  Up: asyncio --- 非同期 I/O

5.20.1.107 プラットフォームでのサポート
.......................................

*note asyncio: b. モジュールは可搬的であるようにデザインされていますが、
いくつかのプラットフォームでは、その根底にあるアーキテクチャや性能による
微妙な動作の違いや制限があります。

* Menu:

* 全てのプラットホーム::
* Windows: Windows<84>.
* macOS: macOS<53>.


File: python.info,  Node: 全てのプラットホーム,  Next: Windows<84>,  Up: プラットフォームでのサポート

5.20.1.108 全てのプラットホーム
...............................

   * *note loop.add_reader(): 3a73. と *note loop.add_writer(): 3af9. を
     ファイル I/O を監視するためには使えません。


File: python.info,  Node: Windows<84>,  Next: macOS<53>,  Prev: 全てのプラットホーム,  Up: プラットフォームでのサポート

5.20.1.109 Windows
..................

'ソースコード:' Lib/asyncio/proactor_events.py(1),
Lib/asyncio/windows_events.py(2), Lib/asyncio/windows_utils.py(3)

__________________________________________________________________

バージョン 3.8 で変更: Windows では *note ProactorEventLoop: a03. がデフ
ォルトのイベントループになりました。

全ての Windows 上のイベントループは以下のメソッドをサポートしません:

   * *note loop.create_unix_connection(): 3a58. と *note
     loop.create_unix_server(): 6d6. はサポートされません。 *note
     socket.AF_UNIX: 1dc9. ソケットファミリーは Unix 固有です。

   * *note loop.add_signal_handler(): 3b02. と *note
     loop.remove_signal_handler(): 3b03. はサポートされていません。

*note SelectorEventLoop: 316. は以下の制限があります:

   * *note SelectSelector: 3b6c. はソケットイベントの待ち受けに使われま
     す: このクラスはソケットをサポートしますが 512 ソケットまでに制限さ
     れています。

   * *note loop.add_reader(): 3a73. と *note loop.add_writer(): 3af9. は
     ソケットハンドルのみを受け付けます (たとえばパイプファイル記述子は
     サポートされていません)。

   * パイプはサポートされていません。従って *note
     loop.connect_read_pipe(): 3a9f. と *note loop.connect_write_pipe():
     3aa0. の2つのメソッドは未実装です。

   * *note Subprocesses: 3a14. はサポートされていません。すなわち *note
     loop.subprocess_exec(): 3a9c. と *note loop.subprocess_shell():
     3a9d. の2つのメソッドは未実装です。

*note ProactorEventLoop: a03. は以下の制限があります:

   * *note loop.add_reader(): 3a73. と *note loop.add_writer(): 3af9. は
     サポートされていません。

Windows のモノトニッククロックの時間分解能は、通常約15.6ミリ秒です。最高
分解能は0.5ミリ秒です。分解能はハードウエア (HPET(4) が利用可能かどうか)
および WIndows の設定に依存します。

* Menu:

* Windows におけるサブプロセスのサポート::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/asyncio/proactor_events.py

   (2) 
https://github.com/python/cpython/tree/main/Lib/asyncio/windows_events.py

   (3) 
https://github.com/python/cpython/tree/main/Lib/asyncio/windows_utils.py

   (4) https://en.wikipedia.org/wiki/High_Precision_Event_Timer


File: python.info,  Node: Windows におけるサブプロセスのサポート,  Up: Windows<84>

5.20.1.110 Windows におけるサブプロセスのサポート
.................................................

Windows において、デフォルトのイベントループ *note ProactorEventLoop:
a03. はサブプロセスをサポートしますが、 *note SelectorEventLoop: 316. は
サポートしません。


File: python.info,  Node: macOS<53>,  Prev: Windows<84>,  Up: プラットフォームでのサポート

5.20.1.111 macOS
................

最近の macOS バージョンは完全にサポートされています。

10.8 以前の macOS
.................

macOS 10.6, 10.7 および 10.8 では、デフォルトイベントループは *note
selectors.KqueueSelector: 3b6f. をしていますが、このクラスはこれらの
macOS バージョンのキャラクターデバイスをサポートしていません。これらの
macOS バージョンでキャラクターデバイスをサポートするためには *note
SelectorEventLoop: 316. で *note SelectSelector: 3b6c. または *note
PollSelector: f9a. を使うように手動で設定します。以下はその例です:

     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.112 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.113 Writing a Custom Event Loop
......................................

*note asyncio.AbstractEventLoop: d2d. 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.114 Future and Task private constructors
...............................................

*note asyncio.Future: f8f. and *note asyncio.Task: 467. should be never
created directly, please use corresponding *note loop.create_future():
103c. and *note loop.create_task(): 46a, or *note asyncio.create_task():
469. 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(): 46a. 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.115 Task lifetime support
................................

A third party task implementation should call the following functions to
keep a task visible by *note asyncio.all_tasks(): d24. and *note
asyncio.current_task(): 894.:

 -- の関数: 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(): 262d. or *note
     coroutine.throw(): 909.).

 -- の関数: asyncio._leave_task (loop, task)

     Switch the current task back from 'task' to ‘None’.

     Call the function just after *note coroutine.send(): 262d. or *note
     coroutine.throw(): 909. execution.


File: python.info,  Node: 高水準の API インデックス,  Next: 低水準の API インデックス,  Prev: Extending,  Up: asyncio --- 非同期 I/O

5.20.1.116 高水準の API インデックス
....................................

このページには、すべての高水準の 非同期/待機 可能な asyncio API が一覧に
なっています。

* Menu:

* Task::
* キュー: キュー<2>.
* サブプロセス: サブプロセス<2>.
* ストリーム: ストリーム<2>.
* 同期::
* 例外: 例外<18>.


File: python.info,  Node: Task,  Next: キュー<2>,  Up: 高水準の API インデックス

5.20.1.117 Task
...............

ユーティリティは asyncio プログラムを実行し、タスクを作成し、タイムアウ
トのある複数の機能を待っています。

*note run(): 314.                                      イベントループを作成し、コルーチンを実行し、ループを
                                                       閉じます。
                                                       
                                                       
*note Runner: 315.                                     複数の非同期関数呼び出しをシンプルにするコンテキスト
                                                       マネージャ。
                                                       
                                                       
*note Task: 467.                                       Task オブジェクト
                                                       
                                                       
*note TaskGroup: 6dd.                                  タスクのグループを保持するコンテキストマネージャ。グ
                                                       ループに属するすべてのタスクが完了するのを待つのに便
                                                       利で信頼性のある方法を提供します。
                                                       
                                                       
*note create_task(): 469.                              asyncio タスクを開始し、それを返します。
                                                       
                                                       
*note current_task(): 894.                             現在のタスクを返します。
                                                       
                                                       
*note all_tasks(): d24.                                イベントループのまだ終了していないすべてのタスクを返
                                                       します。
                                                       
                                                       
‘await’ *note sleep(): e37.                            数秒間スリープします。
                                                       
                                                       
‘await’ *note gather(): 9f9.                           並行してスケジュールして、待ちます。
                                                       
                                                       
‘await’ *note wait_for(): 9fb.                         タイムアウトで実行します。
                                                       
                                                       
‘await’ *note shield(): e38.                           取り消しから保護します。
                                                       
                                                       
‘await’ *note wait(): 896.                             完了かどうかを監視します。
                                                       
                                                       
*note timeout(): 9fa.                                  タイムアウト付きで実行します。 ‘wait_for’ が適してい
                                                       ない場合に有用です。
                                                       
                                                       
*note to_thread(): cbd.                                別の OS スレッドで非同期的に関数を実行します。
                                                       
                                                       
*note run_coroutine_threadsafe(): c5c.                 別の OS スレッドからコルーチンの実行をスケジュールし
                                                       ます。
                                                       
                                                       
‘for in’ *note as_completed(): 6d2.                    ‘for’ ループ向けにコルーチンの完了を監視します。
                                                       

使用例
......

   * *note asyncio.gather() を使って複数の処理を並列に実行する: 3a32. 。

   * *note asyncio.wait_for() を使って強制的にタイムアウトする: 3a3a. 。

   * *note 非同期処理をキャンセルする: 3a4f. 。

   * *note asyncio.sleep() を使う: 3a30. 。

   * *note Tasks のドキュメント: 3a13. も参照してください。


File: python.info,  Node: キュー<2>,  Next: サブプロセス<2>,  Prev: Task,  Up: 高水準の API インデックス

5.20.1.118 キュー
.................

キューは複数の非同期タスクの分散処理、コネクションプールやpub/subパター
ンの実装に適しています。

*note Queue: e3d.                                      FIFO キューです。
                                                       
                                                       
*note PriorityQueue: 3ac2.                             優先度付きのキューです。
                                                       
                                                       
*note LifoQueue: 3ac4.                                 LIFO キュー (スタック) です。
                                                       

使用例
......

   * *note asyncio.Queue を使って複数のタスクを分散処理する: 3ac6.

   * *note Queue のドキュメント: 3a15. も参照してください。


File: python.info,  Node: サブプロセス<2>,  Next: ストリーム<2>,  Prev: キュー<2>,  Up: 高水準の API インデックス

5.20.1.119 サブプロセス
.......................

サブプロセスを生成したり、シェルコマンドを実行するためのユーティリティで
す。

‘await’ *note create_subprocess_exec(): e3e.           サブプロセスを作成します。
                                                       
                                                       
‘await’ *note create_subprocess_shell(): e3f.          シェルコマンドを実行します。
                                                       

使用例
......

   * *note シェルコマンドを実行する: 3a96.。

   * *note サブプロセス API: 3a14. のドキュメントも参照してください。


File: python.info,  Node: ストリーム<2>,  Next: 同期,  Prev: サブプロセス<2>,  Up: 高水準の API インデックス

5.20.1.120 ストリーム
.....................

ネットワーク IO を利用するための高水準の APIs です。

‘await’ *note open_connection(): ee0.                  TCP コネクションを確立します。
                                                       
                                                       
‘await’ *note open_unix_connection(): 3a57.            Unix のソケット接続を確立します。
                                                       
                                                       
‘await’ *note start_server(): ee1.                     TCP サーバーを起動します。
                                                       
                                                       
‘await’ *note start_unix_server(): 3a59.               Unix のソケットサーバーを起動します。
                                                       
                                                       
*note StreamReader: 196b.                              ネットワークからデータを受信するための高水準の
                                                       async/await オブジェクトです。
                                                       
                                                       
*note StreamWriter: 1c95.                              ネットワークにデータを送信するための高水準の
                                                       async/await オブジェクトです。
                                                       

使用例
......

   * *note TCPクライアントの例: 3a53.

   * *note ストリーム API: 19d0. のドキュメントも参照してください。


File: python.info,  Node: 同期,  Next: 例外<18>,  Prev: ストリーム<2>,  Up: 高水準の API インデックス

5.20.1.121 同期
...............

タスク内で利用できるスレッド並列処理に似た同期プリミティブです。

*note Lock: e39.                                       ミューテックスロックです。
                                                       
                                                       
*note Event: 574.                                      イベントオブジェクトです。
                                                       
                                                       
*note Condition: e3a.                                  条件変数オブジェクトです。
                                                       
                                                       
*note Semaphore: e3b.                                  セマフォ (semaphore) です。
                                                       
                                                       
*note BoundedSemaphore: e3c.                           有限セマフォ (bounded semaphore) です。
                                                       
                                                       
*note Barrier: 9fc.                                    バリアーオブジェクト。
                                                       

使用例
......

   * *note asyncio.Event の使用例: 3a7f. 。

   * *note asyncio.Barrier を使う: 3a8d.。

   * asyncio の *note 同期プリミティブ: 3a16. についてのドキュメントも参
     照してください。


File: python.info,  Node: 例外<18>,  Prev: 同期,  Up: 高水準の API インデックス

5.20.1.122 例外
...............

*note asyncio.CancelledError: 6e0.                     タスクがキャンセルされた場合に送出されます。
                                                       *note Task.cancel(): 6df. も参照してください。
                                                       
                                                       
*note asyncio.BrokenBarrierError: 9fd.                 バリアーが破壊された場合に送出されます。
                                                       *note Barrier.wait(): 3a8c. も参照してください。
                                                       

使用例
......

   * *note CancelledError
     を処理してキャンセル要求に対応するコードを実行する: 3a4f.

   * *note asyncio に特有な例外の完全なリスト: 3ac8. も参照してください
     。


File: python.info,  Node: 低水準の API インデックス,  Next: asyncio での開発,  Prev: 高水準の API インデックス,  Up: asyncio --- 非同期 I/O

5.20.1.123 低水準の API インデックス
....................................

このページでは低水準の asyncio API を全てリストしています。

* Menu:

* イベントループの取得::
* イベントループのメソッド::
* トランスポート: トランスポート<2>.
* プロトコル: プロトコル<3>.
* イベントループのポリシー::


File: python.info,  Node: イベントループの取得,  Next: イベントループのメソッド,  Up: 低水準の API インデックス

5.20.1.124 イベントループの取得
...............................

*note asyncio.get_running_loop(): ed3.                 実行中のイベントループを取得するために '利用が推奨さ
                                                       れる' 関数です。
                                                       
                                                       
*note asyncio.get_event_loop(): 573.                   Get an event loop instance (running or current via
                                                       the current policy).
                                                       
                                                       
*note asyncio.set_event_loop(): 1d72.                  ポリシーに基づいて引数のイベントループを "カレント"
                                                       (current event loop) に設定します。
                                                       
                                                       
*note asyncio.new_event_loop(): 3a20.                  新しいイベントループのインスタンスを生成します。
                                                       

使用例
......

   * *note asyncio.get_running_loop() を使う: 3b24.。


File: python.info,  Node: イベントループのメソッド,  Next: トランスポート<2>,  Prev: イベントループの取得,  Up: 低水準の API インデックス

5.20.1.125 イベントループのメソッド
...................................

See also the main documentation section about the *note Event loop
methods: 3adf.

ライフサイクル
..............

*note loop.run_until_complete(): 103a.                 Future/Task/awaitable が完了するまで実行します。
                                                       
                                                       
*note loop.run_forever(): 3ae1.                        イベントループを永久に実行します。
                                                       
                                                       
*note loop.stop(): 103f.                               イベントループを停止します。
                                                       
                                                       
*note loop.close(): 3ae3.                              イベントループをクローズします。
                                                       
                                                       
*note loop.is_running(): 3ae2.                         イベントループが実行中の場合 ‘True’ を返します。
                                                       
                                                       
*note loop.is_closed(): 1180.                          イベントループがクローズされている場合 ‘True’ を返し
                                                       ます。
                                                       
                                                       
‘await’ *note loop.shutdown_asyncgens(): 1041.         非同期ジェネレータをクローズします。
                                                       

デバッグ
........

*note loop.set_debug(): 117e.                          デバッグモードを有効化または無効化します。
                                                       
                                                       
*note loop.get_debug(): 117f.                          現在のデバッグモードを取得します。
                                                       

コールバックのスケジューリング
..............................

*note loop.call_soon(): ecc.                           コールバックを即座に実行します。
                                                       
                                                       
*note loop.call_soon_threadsafe(): ecd.                *note loop.call_soon(): ecc. のスレッドセーフ版です
                                                       。
                                                       
                                                       
*note loop.call_later(): ece.                          与えられた遅延時間の '経過後' にコールバックを実行し
                                                       ます。
                                                       
                                                       
*note loop.call_at(): ecf.                             '与えられた時刻に' コールバックを実行します。
                                                       

Thread/Interpreter/Process Pool
...............................

‘await’ *note loop.run_in_executor(): cbe.             CPUバウンドなブロッキング関数、またはその他のブロッ
                                                       キング関数を *note concurrent.futures: 24. 実行オブ
                                                       ジェクト (executor) 上で実行します。
                                                       
                                                       
*note loop.set_default_executor(): b2d.                *note loop.run_in_executor(): cbe. のデフォルト実行
                                                       オブジェクト (executor) を設定します。
                                                       

タスクとフューチャー
....................

*note loop.create_future(): 103c.                      *note Future: f8f. オブジェクトを生成します。
                                                       
                                                       
*note loop.create_task(): 46a.                         コルーチンを *note Task: 467. としてスケジュールしま
                                                       す。
                                                       
                                                       
*note loop.set_task_factory(): 468.                    *note loop.create_task(): 46a. が *note Tasks: 467.
                                                       を生成する際に使われるファクトリを設定します。
                                                       
                                                       
*note loop.get_task_factory(): 1182.                   *note loop.create_task(): 46a. が *note Tasks: 467.
                                                       を生成するファクトリを取得します。
                                                       

DNS
...

‘await’ *note loop.getaddrinfo(): fd7.                 *note socket.getaddrinfo(): 1946. の非同期版です。
                                                       
                                                       
‘await’ *note loop.getnameinfo(): fd8.                 *note socket.getnameinfo(): 1c61. の非同期版です。
                                                       

ネットワークとプロセス間通信 (IPC)
..................................

‘await’ *note loop.create_connection(): 9fe.           TCP接続を確立します。
                                                       
                                                       
‘await’ *note loop.create_server(): edb.               TCPサーバーを起動します。
                                                       
                                                       
‘await’ *note loop.create_unix_connection(): 3a58.     Unix のソケット接続を確立します。
                                                       
                                                       
‘await’ *note loop.create_unix_server(): 6d6.          Create a Unix socket server.
                                                       
                                                       
‘await’ *note loop.connect_accepted_socket(): bbf.     *note socket: 115e. を ‘(transport, protocol)’ のペ
                                                       アでラップします。
                                                       
                                                       
‘await’ *note loop.create_datagram_endpoint(): b1f.    データグラム (UDP) 接続を確立します。
                                                       
                                                       
‘await’ *note loop.sendfile(): 3af5.                   確立した接続 (transport) を通じてファイルを送信しま
                                                       す。
                                                       
                                                       
‘await’ *note loop.start_tls(): ed1.                   既存の接続を TLS にアップグレードします。
                                                       
                                                       
‘await’ *note loop.connect_read_pipe(): 3a9f.          パイプの読み出し側を ‘(transport, protocol)’ のペア
                                                       でラップします。
                                                       
                                                       
‘await’ *note loop.connect_write_pipe(): 3aa0.         パイプの書き込み側を ‘(transport, protocol)’ のペア
                                                       でラップします。
                                                       

ソケット
........

‘await’ *note loop.sock_recv(): fd4.                   *note socket: 115e. からデータを受信します。
                                                       
                                                       
‘await’ *note loop.sock_recv_into(): ed2.              *note socket: 115e. からデータを受信し、バッファに送
                                                       信します。
                                                       
                                                       
‘await’ *note loop.sock_recvfrom(): a01.               Receive a datagram from the *note socket: 115e.
                                                       
                                                       
‘await’ *note loop.sock_recvfrom_into(): a02.          Receive a datagram from the *note socket: 115e. into
                                                       a buffer.
                                                       
                                                       
‘await’ *note loop.sock_sendall(): fd5.                *note socket: 115e. にデータを送信します。
                                                       
                                                       
‘await’ *note loop.sock_sendto(): a00.                 Send a datagram via the *note socket: 115e. to the
                                                       given address.
                                                       
                                                       
‘await’ *note loop.sock_connect(): 1185.               *note socket: 115e. を接続します。
                                                       
                                                       
‘await’ *note loop.sock_accept(): fd6.                 *note socket: 115e. の接続を受け入れます。
                                                       
                                                       
‘await’ *note loop.sock_sendfile(): ed6.               Send a file over the *note socket: 115e.
                                                       
                                                       
*note loop.add_reader(): 3a73.                         ファイル記述子が読み込み可能かどうかの監視を開始しま
                                                       す。
                                                       
                                                       
*note loop.remove_reader(): 3af8.                      ファイル記述子が読み込み可能かどうかの監視を停止しま
                                                       す。
                                                       
                                                       
*note loop.add_writer(): 3af9.                         ファイル記述子が書き込み可能かどうかの監視を開始しま
                                                       す。
                                                       
                                                       
*note loop.remove_writer(): 3afa.                      ファイル記述子が書き込み可能かどうかの監視を停止しま
                                                       す。
                                                       

Unix シグナル
.............

*note loop.add_signal_handler(): 3b02.                 *note signal: ce. 用のハンドラーを追加します。
                                                       
                                                       
*note loop.remove_signal_handler(): 3b03.              *note signal: ce. 用のハンドラーを削除します。
                                                       

サブプロセス
............

*note loop.subprocess_exec(): 3a9c.                    サブプロセスを生成します。
                                                       
                                                       
*note loop.subprocess_shell(): 3a9d.                   シェルコマンドからサブプロセスを生成します。
                                                       

エラー処理
..........

*note loop.call_exception_handler(): 3b07.             例外ハンドラを呼び出します。
                                                       
                                                       
*note loop.set_exception_handler(): 3b06.              新しい例外ハンドラーを設定します。
                                                       
                                                       
*note loop.get_exception_handler(): 103d.              現在の例外ハンドラーを取得します。
                                                       
                                                       
*note loop.default_exception_handler(): 3b08.          デフォルトの例外ハンドラー実装です。
                                                       

使用例
......

   * *note Using asyncio.new_event_loop() and loop.run_forever(): 3b13.

   * *note loop.call_later() を使う: 3b15.。

   * ‘loop.create_connection()’ を使って *note an echo-client: 3a6a. を
     実装する。

   * ‘loop.create_connection()’ を使って *note ソケットに接続する:
     3a71.。

   * *note add_reader()
     を使ってファイルデスクリプタの読み込みイベントを監視する: 3a72.。

   * *note loop.add_signal_handler() を使う: 3b18.。

   * *note loop.subprocess_exec() を使う: 3ab1.。


File: python.info,  Node: トランスポート<2>,  Next: プロトコル<3>,  Prev: イベントループのメソッド,  Up: 低水準の API インデックス

5.20.1.126 トランスポート
.........................

全てのトランスポートは以下のメソッドを実装します:

*note transport.close(): 3aef.                         トランスポートをクローズします。
                                                       
                                                       
*note transport.is_closing(): 103b.                    トランスポートを閉じている最中か閉じていた場合
                                                       ‘True’ を返します。
                                                       
                                                       
*note transport.get_extra_info(): e66.                 トランスポートについての情報をリクエストします。
                                                       
                                                       
*note transport.set_protocol(): 3b34.                  トランスポートに新しいプロトコルを設定します。
                                                       
                                                       
*note transport.get_protocol(): 3b35.                  現在のプロトコルを返します。
                                                       

データを受信できるトランスポート (TCP 接続、 Unix 接続、パイプなど) のメ
ソッドです。該当するトランスポートは *note loop.create_connection():
9fe, *note loop.create_unix_connection(): 3a58, *note
loop.connect_read_pipe(): 3a9f. などの戻り値です:

読み込みトランスポート
......................

*note transport.is_reading(): ee3.                     トランスポートがデータを受信中の場合 ‘True’ を返しま
                                                       す。
                                                       
                                                       
*note transport.pause_reading(): ee5.                  データの受信を停止します。
                                                       
                                                       
*note transport.resume_reading(): ee4.                 データの受信を再開します。
                                                       

データを送信できるトランスポート (TCP 接続、 Unix 接続、パイプなど) のメ
ソッドです。該当するトランスポートは *note loop.create_connection():
9fe, *note loop.create_unix_connection(): 3a58, *note
loop.connect_write_pipe(): 3aa0. などの戻り値です:

トランスポートにデータを書き込みます。
......................................

*note transport.write(): 1a2a.                         トランスポートにデータを書き込みます。
                                                       
                                                       
*note transport.writelines(): 1a29.                    トランスポートにバッファの内容を書き込みます。
                                                       
                                                       
*note transport.can_write_eof(): 3b38.                 トランスポートが 終端 (EOF) の送信をサポートしている
                                                       場合 *note True: fd0. を返します。
                                                       
                                                       
*note transport.write_eof(): 3b39.                     バッファに残っているデータをフラッシュしてから終端
                                                       (EOF) を送信して、トランスポートをクローズします。
                                                       
                                                       
*note transport.abort(): 3b10.                         トランスポートを即座にクローズします。
                                                       
                                                       
*note transport.get_write_buffer_size(): 194d.         Return the current size of the output buffer.
                                                       
                                                       
*note transport.get_write_buffer_limits(): 1181.       書き込みフロー制御の高水位点と低水位点を取得します。
                                                       
                                                       
*note transport.set_write_buffer_limits(): 3b3a.       書き込みフロー制御の高水位点と低水位点を設定します。
                                                       

*note loop.create_datagram_endpoint(): b1f. が返すトランスポート:

データグラムトランスポート
..........................

*note transport.sendto(): 6d7.                         リモートピアにデータを送信します。
                                                       
                                                       
*note transport.abort(): 3b3e.                         トランスポートを即座にクローズします。
                                                       

サブプロセスに対するトランスポートの低レベルな抽象化です。 *note
loop.subprocess_exec(): 3a9c. や *note loop.subprocess_shell(): 3a9d. の
戻り値です:

サブプロセス化されたトランスポート
..................................

*note transport.get_pid(): 3b40.                       サブプロセスのプロセス ID を返します。
                                                       
                                                       
*note transport.get_pipe_transport(): 3b41.            リクエストされた通信パイプ (標準入力 'stdin', 標準出
                                                       力 'stdout', または標準エラー出力 'stderr') のための
                                                       トランスポートを返します。
                                                       
                                                       
*note transport.get_returncode(): 3b42.                サブプロセスの終了ステータスを返します。
                                                       
                                                       
*note transport.kill(): 3b43.                          サブプロセスを強制終了 (kill) します。
                                                       
                                                       
*note transport.send_signal(): 3b45.                   サブプロセスにシグナルを送信します。
                                                       
                                                       
*note transport.terminate(): 3b44.                     サブプロセスを停止します。
                                                       
                                                       
*note transport.close(): 3b46.                         サブプロセスを強制終了 (kill) し、全てのパイプをクロ
                                                       ーズします。
                                                       


File: python.info,  Node: プロトコル<3>,  Next: イベントループのポリシー,  Prev: トランスポート<2>,  Up: 低水準の API インデックス

5.20.1.127 プロトコル
.....................

プロトコルクラスは以下の 'コールバックメソッド' を実装することができます
:

‘callback’ *note connection_made(): 3aed.              コネクションが作成されたときに呼び出されます。
                                                       
                                                       
‘callback’ *note connection_lost(): 3b31.              コネクションが失われた、あるいはクローズされたときに
                                                       呼び出されます。
                                                       
                                                       
‘callback’ *note pause_writing(): 3b3b.                トランスポートのバッファーサイズが最高水位点
                                                       (High-Water Mark) を超えたときに呼び出されます。
                                                       
                                                       
‘callback’ *note resume_writing(): 3b3c.               トランスポートのバッファーサイズが最低水位点
                                                       (Low-Water Mark) に達したきに呼び出されます。
                                                       

ストリーミングプロトコル (TCP, Unix ソケット, パイプ)
.....................................................

‘callback’ *note data_received(): 1d20.                データを受信したときに呼び出されます。
                                                       
                                                       
‘callback’ *note eof_received(): 3b4a.                 終端 (EOF) を受信したときに呼び出されます。
                                                       

バッファリングされたストリーミングプロトコル
............................................

‘callback’ *note get_buffer(): 3b4c.                   新しい受信バッファを割り当てるために呼び出します。
                                                       
                                                       
‘callback’ *note buffer_updated(): 3b4d.               受信データによりバッファが更新された場合に呼び出され
                                                       ます。
                                                       
                                                       
‘callback’ *note eof_received(): 3b4e.                 終端 (EOF) を受信したときに呼び出されます。
                                                       

データグラムプロトコル
......................

‘callback’ *note datagram_received(): 3b50.            データグラムを受信したときに呼び出されます。
                                                       
                                                       
‘callback’ *note error_received(): 3b51.               直前の送信あるいは受信が *note OSError: 543. を送出
                                                       したときに呼び出されます。
                                                       

サブプロセスプロトコル
......................

‘callback’ *note pipe_data_received(): 1d6d.           子プロセスが標準出力 ('stdout') または標準エラー出力
                                                       ('stderr') のパイプにデータを書き込んだときに呼び出
                                                       されます。
                                                       
                                                       
‘callback’ *note pipe_connection_lost(): 3b53.         子プロセスと通信するパイプのいずれかがクローズされた
                                                       ときに呼び出されます。
                                                       
                                                       
‘callback’ *note process_exited(): 1d6c.               Called when the child process has exited.  It can be
                                                       called before *note pipe_data_received(): 1d6d. and
                                                       *note pipe_connection_lost(): 3b53. methods.
                                                       


File: python.info,  Node: イベントループのポリシー,  Prev: プロトコル<3>,  Up: 低水準の API インデックス

5.20.1.128 イベントループのポリシー
...................................

ポリシーは *note asyncio.get_event_loop(): 573. などの関数の振る舞いを変
更する低レベルなメカニズムです。詳細は *note
ポリシーについてのセクション: 3ad9. を参照してください。

ポリシーへのアクセス
....................

*note asyncio.get_event_loop_policy(): 312.            プロセス全体にわたる現在のポリシーを返します。
                                                       
                                                       
*note asyncio.set_event_loop_policy(): 313.            新たなプロセス全体にわたるポリシーを設定します。
                                                       
                                                       
*note AbstractEventLoopPolicy: 30e.                    ポリシーオブジェクトの基底クラスです。
                                                       


File: python.info,  Node: asyncio での開発,  Prev: 低水準の API インデックス,  Up: asyncio --- 非同期 I/O

5.20.1.129 asyncio での開発
...........................

非同期プログラミングは伝統的な "同期的" プログラミングとは異なります。

このページはよくある間違いや落とし穴を列挙し、それらを回避する方法を説明
します。

* Menu:

* デバッグモード::
* 並行処理とマルチスレッド処理::
* ブロッキングコードの実行::
* ログ記録: ログ記録<3>.
* 待ち受け処理を伴わないコルーチンの検出::
* 回収されない例外の検出::
* Asynchronous generators best practices::


File: python.info,  Node: デバッグモード,  Next: 並行処理とマルチスレッド処理,  Up: asyncio での開発

5.20.1.130 デバッグモード
.........................

asyncio はデフォルトで本運用モードで実行されます。いっぽう、開発を容易に
するために asyncio は "デバッグモード" を持っています。

asyncio のデバッグモードを有効化する方法はいくつかあります:

   * *note PYTHONASYNCIODEBUG: 2346. 環境変数の値を ‘1’ に設定する。

   * *note Python 開発モード: 713. を使う。

   * *note asyncio.run(): 314. 実行時に ‘debug=True’ を設定する。

   * *note loop.set_debug(): 117e. を呼び出す。

デバッグモードを有効化することに加え、以下も検討してください:

   * *note asyncio ロガー: 3b91. のログレベルを *note logging.DEBUG:
     22ec. に設定します。例えばアプリケーションの起動時に以下を実行しま
     す:

          logging.basicConfig(level=logging.DEBUG)

   * *note warnings: 11b. モジュールが *note ResourceWarning: 754. 警告
     を表示するように設定します。やり方のひとつは *note -W: 1cb.
     ‘default’ コマンドラインオプションを使うことです。

デバッグモードが有効化されたときの動作:

   * スレッドセーフでない asyncio APIs の多く (*note loop.call_soon():
     ecc. や *note loop.call_at(): ecf. など) は、誤ったスレッドから呼び
     出されたときに例外を送出します。

   * I/O セレクタが I/O 処理を実行する時間が長すぎる場合、その実行時間が
     記録されます。

   * 実行時間が100ミリ秒を超えるコールバックは記録されます。 "遅い" の判
     断基準となる実行時間の最小値は *note loop.slow_callback_duration:
     3b0a. 属性で設定できます。


File: python.info,  Node: 並行処理とマルチスレッド処理,  Next: ブロッキングコードの実行,  Prev: デバッグモード,  Up: asyncio での開発

5.20.1.131 並行処理とマルチスレッド処理
.......................................

イベントループはスレッド（典型的にはメインスレッド）内で動作し、すべての
コールバックとタスクをそのスレッド内で実行します。ひとつのタスクがイベン
トループ内で実行される間、他のタスクを同じスレッド内で実行することはでき
ません。タスクが ‘await’ 式を実行すると、実行中のタスクはサスペンドされ
、イベントループは次のタスクを実行します。

別の OS スレッドからのコールバック (*note callback: 2fdb.) をスケジュー
ルする場合、 *note loop.call_soon_threadsafe(): ecd. メソッドを使ってく
ださい。例:

     loop.call_soon_threadsafe(callback, *args)

ほぼ全ての非同期オブジェクトはスレッドセーフではありませんが、タスクやコ
ールバックの外側で非同期オブジェクトを使うコードが存在しない限り、それが
問題にはなることはほとんどありません。もしそのような目的で低レベルの
asyncio API を呼び出すようなコードを書く必要がある場合、 *note
loop.call_soon_threadsafe(): ecd. メソッドを使ってください。例:

     loop.call_soon_threadsafe(fut.cancel)

別の OS スレッドからコルーチンオブジェクトをスケジュールする場合は、
*note run_coroutine_threadsafe(): c5c. メソッドを使ってください。
‘run_coroutine_threadsafe()’ は結果にアクセスするための *note
concurrent.futures.Future: 1570. オブジェクトを返します:

     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(): cbe. method can be used with a *note
concurrent.futures.ThreadPoolExecutor: b2c. or *note
InterpreterPoolExecutor: 471. 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: 3adf. 節では、イベントループをブロック
することなくパイプからの読み込みやファイルデスクリプタの監視ができる API
のリストを掲載しています。さらに、 asyncio の *note サブプロセス: 3a14.
API はイベントループからプロセスを開始したりプロセスと通信したりする方法
を提供します。 最後に、前述の *note loop.run_in_executor(): cbe. メソッ
ドは *note concurrent.futures.ProcessPoolExecutor: 211. とともに使用する
ことで、別のプロセス内でコードを実行することもできます。


File: python.info,  Node: ブロッキングコードの実行,  Next: ログ記録<3>,  Prev: 並行処理とマルチスレッド処理,  Up: asyncio での開発

5.20.1.132 ブロッキングコードの実行
...................................

ブロッキングコード (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(): cbe. method for more details.


File: python.info,  Node: ログ記録<3>,  Next: 待ち受け処理を伴わないコルーチンの検出,  Prev: ブロッキングコードの実行,  Up: asyncio での開発

5.20.1.133 ログ記録
...................

asyncio は *note logging: 8a. モジュールを利用し、 全てのログ記録は
‘"asyncio"’ ロガーを通じて行われます。

デフォルトのログレベルは *note logging.INFO: 22ed. ですが、これは簡単に
調節できます:

     logging.getLogger("asyncio").setLevel(logging.WARNING)

ネットワークログ記録は、イベントループをブロックし得ます。ログ処理のスレ
ッドを分離するか、ノンブロッキング IO を使用することを推奨します。例えば
、 *note ブロックする handler を扱う: 3b96. を見てください。


File: python.info,  Node: 待ち受け処理を伴わないコルーチンの検出,  Next: 回収されない例外の検出,  Prev: ログ記録<3>,  Up: asyncio での開発

5.20.1.134 待ち受け処理を伴わないコルーチンの検出
.................................................

コルーチンが呼び出されただけで、待ち受け処理がない場合 (たとえば ‘await
coro()’ のかわりに ‘coro()’ と書いてしまった場合) 、またはコルーチンが
*note asyncio.create_task(): 469. を使わずにスケジュールされた場合、
asyncio は *note RuntimeWarning: 6e3. 警告を送出します:

     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(): 469. 関数を呼び出すことです:

     async def main():
         await test()


File: python.info,  Node: 回収されない例外の検出,  Next: Asynchronous generators best practices,  Prev: 待ち受け処理を伴わないコルーチンの検出,  Up: asyncio での開発

5.20.1.135 回収されない例外の検出
.................................

もし *note Future.set_exception(): 1040. メソッドが呼び出されても、その
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 デバッグモードを有効化して:
2347. トレースバックを取得してください:

     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.136 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.137 Close asynchronous generators explicitly
...................................................

It is recommended to manually close the *note asynchronous generator:
3b9c.  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(): cae. method, or use the *note contextlib.aclosing(): bcd.
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) # imitate 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.138 Create asynchronous generators only when the event loop is running
.............................................................................

It is recommended to create *note asynchronous generators: 3b9c. 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(): 1bc9. 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(): 1041. 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.139 Avoid concurrent iteration and closure of the same generator
.......................................................................

Async generators may be reentered while another *note __anext__(): 26b6.
/ *note athrow(): 90b. / *note aclose(): cae. 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.

     注釈: asyncio のソースコードは Lib/asyncio/(1) にあります。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

Pythonインターフェースは、Unixのソケット用システムコールとライブラリイン
ターフェースを、そのままPythonのオブジェクト指向スタイルに変換したもので
す。各種ソケット関連のシステムコールは、 *note socket(): 115e. 関数で生
成される 'socket オブジェクト' のメソッドとして実装されています。 メソッ
ドの引数は C のインターフェイスよりも多少高水準で、例えばファイルに対す
る ‘read()’ や ‘write()’ メソッドと同様に、 受信時のバッファ確保は自動的
に処理され、送信時のバッファ長は暗黙的に決まります。

参考
....

Module *note socketserver: d5.

     ネットワークサーバの開発を省力化するためのクラス群。

Module *note ssl: d8.

     ソケットオブジェクトに対する TLS/SSL ラッパー.

* Menu:

* ソケットファミリー::
* モジュールの内容: モジュールの内容<3>.
* socket オブジェクト::
* ソケットタイムアウトの注意事項::
* 使用例: 使用例<27>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/socket.py


File: python.info,  Node: ソケットファミリー,  Next: モジュールの内容<3>,  Up: socket --- 低水準ネットワークインターフェース

5.20.2.1 ソケットファミリー
...........................

どのシステムで実行するかとビルドオプションに依存しますが、このモジュール
によって多様なソケットファミリーをサポートします。

特定のソケットオブジェクトによって必要とされるアドレスフォーマットは、ソ
ケットオブジェクトが生成されたときに指定されたアドレスファミリーを元に自
動的に選択されます。ソケットアドレスは次の通りです。

   - ファイルシステム上のノードに束縛された *note AF_UNIX: 1dc9. ソケッ
     トのアドレスは、ファイルシステムエンコーディングと
     ‘'surrogateescape'’ エラーハンドラ ( PEP 383(1) を参照) を使って文
     字列として表現されます。 Linux の抽象名前空間のアドレスは、先頭が
     null バイトとなる *note bytes-like object: 43d. として返されます。
     この名前空間のソケットは通常のファイルシステム上のソケットと通信で
     きるので、 Linux 上で動作することを意図したプログラムは両方のアドレ
     スを扱う必要がある可能性があります。文字列と bytes-like オブジェク
     トはどちらのタイプのアドレスにも引数として渡すことができます。

     バージョン 3.3 で変更: これまでは *note AF_UNIX: 1dc9. ソケットパス
     は UTF-8 エンコーディングを使用するものとされていました。

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 43d.
     を使用できるようになりました。

   - *note AF_INET: 1dc6. アドレスファミリーには、 ‘(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: 1dc7. 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: 3ba5. アドレスファミリーには ‘(interface, )’ というタ
     プルを利用します。 'interface' は ‘'can0'’ のようなネットワークイン
     ターフェース名を表す文字列です。このファミリーの全てのネットワーク
     インターフェースからパケットを受信するために、ネットワークインター
     フェース名 ‘''’ を利用できます。

        - *note CAN_ISOTP: 3ba6. 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: d03. 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: 1dc8. は以下のプロトコルとアドレスフォーマット
     をサポートしています。

        - *note BTPROTO_L2CAP: 512. 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: 3ba7. (default),
               *note BDADDR_LE_PUBLIC: 3ba8, *note BDADDR_LE_RANDOM:
               3ba9.

          バージョン 3.14 で変更: Added ‘cid’ and ‘bdaddr_type’ fields.

        - *note BTPROTO_RFCOMM: 3baa. は ‘(bdaddr, channel)’ を受け取り
          ます。 ‘bdaddr’ は Bluetooth アドレスを表す文字列で、
          ‘channel’ は整数です。

        - *note BTPROTO_HCI: 510. 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: 3bab. 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: 511. accepts ‘bdaddr’ where ‘bdaddr’ is the
          Bluetooth address as a string or a *note bytes: 1d2. object.
          (ex.  ‘'12:23:34:45:56:67'’ or ‘b'12:23:34:45:56:67'’)

          バージョン 3.14 で変更: FreeBSD support added.

   - *note AF_ALG: 1098. はカーネル暗号へのソケットベースのインターフェ
     イスで、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: 234c.: Linux >= 2.6.38.

     一部のアルゴリズムタイプでは、さらに新しいカーネルが必要です。

     Added in version 3.6.

   - *note AF_VSOCK: f37. 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: 234c.: Linux >= 3.9

     See ‘vsock(7)(2)’

     Added in version 3.7.

   - *note AF_PACKET: 3bac. 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: 1d40. to capture all protocols, one of the *note
          ETHERTYPE_* constants: 1d41. 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: 234c.: Linux >= 2.2.

   - *note AF_QIPCRTR: 3bad. 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: 234c.: 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: 234c.: Linux >= 2.6.20, FreeBSD >= 10.1

     Added in version 3.9.

   - *note AF_HYPERV: 3bae. 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: 543.
またはそのサブクラスが発生します。

*note setblocking(): 3277. メソッドで、非ブロッキングモードを使用するこ
とができます。また、より汎用的に *note settimeout(): 3baf. メソッドでタ
イムアウトを指定する事ができます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0383/

   (2) https://manpages.debian.org/vsock(7)


File: python.info,  Node: モジュールの内容<3>,  Next: socket オブジェクト,  Prev: ソケットファミリー,  Up: socket --- 低水準ネットワークインターフェース

5.20.2.2 モジュールの内容
.........................

The module ‘socket’ exports the following elements.

* Menu:

* 例外: 例外<19>.
* 定数: 定数<8>.
* 関数: 関数<8>.


File: python.info,  Node: 例外<19>,  Next: 定数<8>,  Up: モジュールの内容<3>

5.20.2.3 例外
.............

 -- 例外: socket.error

     *note OSError: 543. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 543. のエイリアスになりました。

 -- 例外: socket.herror

     *note OSError: 543. のサブクラス。この例外はアドレス関連のエラー、
     つまり *note gethostbyname_ex(): 1e9a. と *note gethostbyaddr():
     1e99. などの、 POSIX C API の 'h_errno' を利用する関数のために利用
     されます。例外に付随する ‘(h_errno, string)’ ペアはライブラリの呼び
     出しによって返されたエラーを表します。 'h_errno' は数値で、
     'string' は、 ‘hstrerror()’ C関数によって返される 'h_errno' を説明
     する文字列です。

     バージョン 3.3 で変更: このクラスは *note OSError: 543. のサブクラ
     スになりました。

 -- 例外: socket.gaierror

     A subclass of *note OSError: 543, this exception is raised for
     address-related errors by *note getaddrinfo(): 1946. and *note
     getnameinfo(): 1c61.  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: 543. のサブクラ
     スになりました。

 -- 例外: socket.timeout

     *note TimeoutError: c12. の非推奨のエイリアスです。

     *note OSError: 543. のサブクラスです。この例外は、あらかじめ *note
     settimeout(): 3baf. を呼び出して (あるいは *note
     setdefaulttimeout(): 3bb3. を利用して暗黙に) タイムアウトを有効にし
     てあるソケットでタイムアウトが生じた際に送出されます。 例外に付属す
     る値は文字列で、その内容は現状では常に "timed out" となります。

     バージョン 3.3 で変更: このクラスは *note OSError: 543. のサブクラ
     スになりました。

     バージョン 3.10 で変更: このクラスは *note TimeoutError: c12. のエ
     イリアスになりました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/


File: python.info,  Node: 定数<8>,  Next: 関数<8>,  Prev: 例外<19>,  Up: モジュールの内容<3>

5.20.2.4 定数
.............

AF_* 定数と SOCK_* 定数は、 ‘AddressFamily’ と ‘SocketKind’ *note
IntEnum: 10a1. 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(): 115e.  If the *note
     AF_UNIX: 1dc9. constant is not defined then this protocol is
     unsupported.  More constants may be available depending on the
     system.

 -- データ: socket.AF_UNSPEC

     *note AF_UNSPEC: 3af3. means that *note getaddrinfo(): 1946. 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(): 115e.  More constants may be available
     depending on the system.  (Only *note SOCK_STREAM: 16ad. and *note
     SOCK_DGRAM: 16ac. appear to be generally useful.)

 -- データ: socket.SOCK_CLOEXEC
 -- データ: socket.SOCK_NONBLOCK

     この2つの定数が定義されていた場合、ソケットタイプと組み合わせていく
     つかの flags をアトミックに設定することができます (別の呼び出しを不
     要にして競合状態を避ける事ができます)。

     参考
     ....

     より完全な説明は Secure File Descriptor Handling(1) を参照してくだ
     さい。

     *note Availability: 234c.: 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(): 1097. and *note getsockopt(): 1096. 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.

     バージョン 3.15 で変更: ‘IPV6_HDRINCL’ was added.  Added support
     for ‘SO_PASSRIGHTS’ on Linux platforms when available.

 -- データ: socket.AF_CAN
 -- データ: socket.PF_CAN

 -- データ: SOL_CAN_*

 -- データ: CAN_*

     Linux ドキュメントにあるこの形式の定数は socket モジュールでも定義
     されています。

     *note Availability: 234c.: 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: 234c.: 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: 234c.: 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: 234c.: 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: 234c.: 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: 234c.: 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: 234c.: FreeBSD >= 14.0.

     Added in version 3.12.

 -- データ: socket.AF_PACKET
 -- データ: socket.PF_PACKET

 -- データ: PACKET_*

     Linux ドキュメントにあるこの形式の定数は socket モジュールでも定義
     されています。

     *note Availability: 234c.: Linux >= 2.2.

 -- データ: socket.ETH_P_ALL

     ‘ETH_P_ALL’ can be used in the *note socket: 115e. constructor as
     'proto' for the *note AF_PACKET: 3bac. family in order to capture
     every packet, regardless of protocol.

     For more information, see the ‘packet(7)(2)’ manpage.

     *note Availability: 234c.: Linux.

     Added in version 3.12.

 -- データ: socket.AF_RDS
 -- データ: socket.PF_RDS
 -- データ: socket.SOL_RDS

 -- データ: RDS_*

     Linux ドキュメントにあるこの形式の定数は socket モジュールでも定義
     されています。

     *note Availability: 234c.: 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(): 1094. メソッドに引数として渡されます。

     バージョン 3.6 で変更: ‘SIO_LOOPBACK_FAST_PATH’ が追加されました。

 -- データ: TIPC_*

     TIPC 関連の定数で、C のソケットAPIが公開しているものにマッチします
     。詳しい情報は TIPC のドキュメントを参照してください。

 -- データ: socket.AF_ALG
 -- データ: socket.SOL_ALG

 -- データ: ALG_*

     Linux カーネル暗号用の定数です。

     *note Availability: 234c.: 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: 234c.: Linux >= 4.8.

     Added in version 3.7.

 -- データ: socket.AF_LINK

     *note Availability: 234c.: 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: 3bc4. を使用すると、 *note
     BTPROTO_RFCOMM: 3baa. で束縛ソケットを指定する際に、任意のアドレス
     を指し示すことができます。

 -- データ: 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: 512. socket.

     *note Availability: 234c.: 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(): 1097. and
     *note getsockopt(): 1096. methods of Bluetooth socket objects.

     *note SOL_BLUETOOTH: 3bca. 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(): 1097. and *note getsockopt(): 1096. methods of
     Bluetooth socket objects.

     ‘BT_*’ and *note L2CAP_LM: 3bcb. 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: 510.  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: 234c.: 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: 510.
     address.

     *note Availability: 234c.: 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: 234c.: 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: 234c.: 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: 234c.: 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: 234c.: 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: 234c.: 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: 234c.: 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(): 3bec. method of
     socket objects.

     *note Availability: 234c.: 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: モジュールの内容<3>

5.20.2.5 関数
.............

* Menu:

* ソケットの作成::
* その他の関数: その他の関数<2>.


File: python.info,  Node: ソケットの作成,  Next: その他の関数<2>,  Up: 関数<8>

5.20.2.6 ソケットの作成
.......................

以下の関数は全て *note socket object: 3bef. を生成します。

 -- クラス: socket.socket (family=AF_INET, type=SOCK_STREAM, proto=0,
          fileno=None)

     アドレスファミリー、ソケットタイプ、プロトコル番号を指定してソケッ
     トを作成します。アドレスファミリーには *note AF_INET: 1dc6. (デフォ
     ルト値), *note AF_INET6: 1dc7, *note AF_UNIX: 1dc9, *note AF_CAN:
     3ba5, *note AF_PACKET: 3bac, *note AF_RDS: 3bbc. を指定することがで
     きます。ソケットタイプには *note SOCK_STREAM: 16ad. (デフォルト値),
     *note SOCK_DGRAM: 16ac, *note SOCK_RAW: 3bb5. または他の ‘SOCK_’ 定
     数の何れかを指定します。プロトコル番号は通常省略するか、または0を指
     定しますが、アドレスファミリーに ‘AF_CAN’ を指定した場合は、プロト
     コル番号には const:‘CAN_RAW’, *note CAN_BCM: 1351, *note CAN_ISOTP:
     3ba6, *note CAN_J1939: d03. のいずれかを指定すべきです。

     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(): 3b32. but not the actual OS resource.  Unlike
     *note socket.fromfd(): 3bf0, 'fileno' will return the same socket
     and not a duplicate.  This may help close a detached socket using
     *note socket.close(): f34.

     新たに作成されたソケットは *note 継承不可: 12ad. です。

     引数 ‘self’, ‘family’, ‘type’, ‘protocol’ 付きで *note
     監査イベント: 1e84. ‘socket.__new__’ を送出します。

     バージョン 3.3 で変更: AF_CAN, AF_RDS ファミリーが追加されました。

     バージョン 3.4 で変更: CAN_BCMプロトコルが追加されました。

     バージョン 3.4 で変更: 返されるソケットは継承不可になりました。

     バージョン 3.7 で変更: CAN_ISOTP プロトコルが追加されました。

     バージョン 3.7 で変更: When *note SOCK_NONBLOCK: fcd. or *note
     SOCK_CLOEXEC: fce. bit flags are applied to 'type' they are
     cleared, and *note socket.type: fcf. will not reflect them.  They
     are still passed to the underlying system ‘socket()’ call.
     Therefore,

          sock = socket.socket(
              socket.AF_INET,
              socket.SOCK_STREAM | socket.SOCK_NONBLOCK)

     will still create a non-blocking socket on OSes that support
     ‘SOCK_NONBLOCK’, but ‘sock.type’ will be set to
     ‘socket.SOCK_STREAM’.

     バージョン 3.9 で変更: CAN_J1939 プロトコルが追加されました。

     バージョン 3.10 で変更: IPPROTO_MPTCP プロトコルが追加されました。

 -- の関数: socket.socketpair ([family[, type[, proto]]])

     Build a pair of connected socket objects using the given address
     family, socket type, and protocol number.  Address family, socket
     type, and protocol number are as for the *note socket(): 115e.
     function.  The default family is *note AF_UNIX: 1dc9. if defined on
     the platform; otherwise, the default is *note AF_INET: 1dc6.

     新たに作成されたソケットは *note 継承不可: 12ad. です。

     バージョン 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(): 1160. を高級にした関数です。 'host' が数値でない
     ホスト名の場合、 *note AF_INET: 1dc6. と *note AF_INET6: 1dc7. の両
     方で名前解決を試み、得られた全てのアドレスに対して成功するまで接続
     を試みます。この関数を使って IPv4 と IPv6 に両対応したクライアント
     を簡単に書くことができます。

     オプションの 'timeout' 引数を指定すると、接続を試みる前にソケットオ
     ブジェクトのタイムアウトを設定します。 'timeout' が指定されない場合
     、 *note getdefaulttimeout(): 3bf1. が返すデフォルトのタイムアウト
     設定値を利用します。

     '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: 6de.
     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: 1dc6. or *note AF_INET6:
     1dc7.  'backlog' is the queue size passed to *note socket.listen():
     1212.; 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: 1dc7. and
     the platform supports it the socket will be able to accept both
     IPv4 and IPv6 connections, else it will raise *note ValueError:
     15a.  Most POSIX platforms and Windows are supposed to support this
     functionality.  When this functionality is enabled the address
     returned by *note socket.getpeername(): 3b32. 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(): df4.:

          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(): 19d2. method) and build a socket
     object from the result.  Address family, socket type and protocol
     number are as for the *note socket(): 115e. 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 継承不可: 12ad. です。

     バージョン 3.4 で変更: 返されるソケットは継承不可になりました。

 -- の関数: socket.fromshare (data)

     *note socket.share(): fcb. メソッドから取得した data からソケットオ
     ブジェクトを生成します。ソケットはブロッキングモードだと仮定されま
     す。

     *note Availability: 234c.: Windows.

     Added in version 3.3.

 -- データ: socket.SocketType

     ソケットオブジェクトの型を示す型オブジェクト。 ‘type(socket(...))’
     と同じです。


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():
     f35, 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:
     3af3, 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(): 115e. 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' and
     flags Python was compiled with, and is meant to be passed to the
     *note socket.connect(): 1160. method.

     'sockaddr' can be one of the following:

        * a ‘(address, port)’ 2-tuple for *note AF_INET: 1dc6.

        * a ‘(address, port, flowinfo, scope_id)’ 4-tuple for *note
          AF_INET6: 1dc7. if Python was compiled with ‘--enable-ipv6’
          (the default)

        * a 2-tuple containing raw data for *note AF_INET6: 1dc7. if
          Python was compiled with ‘--disable-ipv6’

          注釈: 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: 16ad. or *note SOCK_DGRAM: 16ac.) 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
     監査イベント: 1e84. ‘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(): 1e99. 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():
     3261. is returned.

 -- の関数: socket.gethostbyname (hostname)

     ホスト名を ‘'100.50.200.5'’ のようなIPv4形式のアドレスに変換します
     。ホスト名としてIPv4アドレスを指定した場合、その値は変換せずにその
     まま返ります。 *note gethostbyname(): 3bf4. APIへのより完全なインタ
     ーフェイスが必要であれば、 *note gethostbyname_ex(): 1e9a. を参照し
     てください。 ‘gethostbyname()’ は、IPv6名前解決をサポートしていませ
     ん。IPv4/ v6のデュアルスタックをサポートする場合は *note
     getaddrinfo(): 1946. を使用します。

     引数 ‘hostname’ を指定して *note 監査イベント: 1e84.
     ‘socket.gethostbyname’ を送出します。

     *note Availability: 234c.: 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(): 1946. should be used instead for IPv4/v6 dual
     stack support.

     引数 ‘hostname’ を指定して *note 監査イベント: 1e84.
     ‘socket.gethostbyname’ を送出します。

     *note Availability: 234c.: not WASI.

 -- の関数: socket.gethostname ()

     Pythonインタープリタを現在実行しているマシンのホスト名を含む文字列
     を返します。

     引数無しで *note 監査イベント: 1e84. ‘socket.gethostname’ を送出し
     ます。

     注意: *note gethostname(): 3261. は完全修飾ドメイン名を返すとは限り
     ません。完全修飾ドメイン名が必要であれば、*note getfqdn(): 1d0b. を
     使用してください。

     *note Availability: 234c.: 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(): 1d0b.
     ‘gethostbyaddr()’ supports both IPv4 and IPv6.

     引数 ‘ip_address’ を指定して *note 監査イベント: 1e84.
     ‘socket.gethostbyaddr’ を送出します。

     *note Availability: 234c.: 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 監査イベント: 1e84.
     ‘socket.getnameinfo’ を送出します。

     *note Availability: 234c.: 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(): 115e. function.  This is usually only needed
     for sockets opened in "raw" mode (*note SOCK_RAW: 3bb5.); for the
     normal socket modes, the correct protocol is chosen automatically
     if the protocol is omitted or zero.

     *note Availability: 234c.: not WASI.

 -- の関数: socket.getservbyname (servicename[, protocolname])

     インターネットサービス名とプロトコルから、そのサービスのポート番号
     を取得します。省略可能なプロトコル名として、 ‘'tcp'’ か ‘'udp'’ の
     どちらかを指定することができます。指定がなければどちらのプロトコル
     にもマッチします。

     引数 ‘servicename’, ‘protocolname’ を指定して *note 監査イベント:
     1e84. ‘socket.getservbyname’ を送出します。

     *note Availability: 234c.: not WASI.

 -- の関数: socket.getservbyport (port[, protocolname])

     インターネットポート番号とプロトコル名から、サービス名を取得します
     。省略可能なプロトコル名として、 ‘'tcp'’ か ‘'udp'’ のどちらかを指
     定することができます。指定がなければどちらのプロトコルにもマッチし
     ます。

     引数 ‘port’, ‘protocolname’ を指定して *note 監査イベント: 1e84.
     ‘socket.getservbyport’ を送出します。

     *note Availability: 234c.: not WASI.

 -- の関数: socket.ntohl (x)

     32ビットの正の整数のバイトオーダを、ネットワークバイトオーダからホ
     ストバイトオーダに変換します。ホストバイトオーダとネットワークバイ
     トオーダが一致するマシンでは、この関数は何もしません。それ以外の場
     合は4バイトのスワップを行います。

 -- の関数: socket.ntohs (x)

     16ビットの正の整数のバイトオーダを、ネットワークバイトオーダからホ
     ストバイトオーダに変換します。ホストバイトオーダとネットワークバイ
     トオーダが一致するマシンでは、この関数は何もしません。それ以外の場
     合は2バイトのスワップを行います。

     バージョン 3.10 で変更: Raises *note OverflowError: c5b. 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: c5b. 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(): d2f. はドットが 3 個以下の文字列も受け取ります;
     詳細については Unix のマニュアル ‘inet(3)(3)’ を参照してください。

     IPv4アドレス文字列が不正であれば、 *note OSError: 543. が発生します
     。このチェックは、この関数で使用しているCの実装 ‘inet_aton()’ で行
     われます。

     *note inet_aton(): d2f. は、IPv6をサポートしません。IPv4/v6のデュア
     ルスタックをサポートする場合は *note inet_pton(): d30. を使用します
     。

 -- の関数: socket.inet_ntoa (packed_ip)

     32 ビットにパックされた IPv4 アドレス (長さ 4 バイトの *note
     bytes-like object: 43d.) を、標準的なドット記法による 4 桁の文字列
     ('123.45.67.89' など) に変換します。この関数は、‘in_addr’ 型、つま
     りこの関数が引数として受け取る 32 ビットにパックされたバイナリデー
     タに対する C の型、を使用する標準 C ライブラリのプログラムとやりと
     りする場合に便利です。

     この関数に渡すバイトシーケンスの長さが4バイト以外であれば、 *note
     OSError: 543. が発生します。 *note inet_ntoa(): 3bfa. は、IPv6をサ
     ポートしません。IPv4/v6のデュアルスタックをサポートする場合は *note
     inet_ntop(): 1353. を使用します。

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 43d.
     を使用できるようになりました。

 -- の関数: socket.inet_pton (address_family, ip_string)

     IPアドレスを、アドレスファミリ固有の文字列からパックしたバイナリ形
     式に変換します。 *note inet_pton(): d30. は、 ‘in_addr’ 型 (*note
     inet_aton(): d2f. と同様)や ‘in6_addr’ を使用するライブラリやネット
     ワークプロトコルを呼び出す際に使用することができます。

     現在サポートされている 'address_family' は、 *note AF_INET: 1dc6. と
     *note AF_INET6: 1dc7. です。 'ip_string' に不正なIPアドレス文字列を
     指定すると、 *note OSError: 543. が発生します。有効な 'ip_string' は
     、 'address_family' と ‘inet_pton()’ の実装によって異なります。

     *note Availability: 234c.: Unix, Windows.

     バージョン 3.4 で変更: Windowsで利用可能になりました

 -- の関数: socket.inet_ntop (address_family, packed_ip)

     パックしたIPアドレス (数バイトからなる *note bytes-like
     オブジェクト: 43d. ) を、 ‘'7.10.0.5'’ や ‘'5aef:2b::8'’ などの標準
     的な、アドレスファミリ固有の文字列形式に変換します。 *note
     inet_ntop(): 1353. は (*note inet_ntoa(): 3bfa. と同様に)、
     ‘in_addr’ 型や ‘in6_addr’ 型のオブジェクトを返すライブラリやネット
     ワークプロトコル等で使用することができます。

     現在サポートされている 'address_family' の値は、 *note AF_INET:
     1dc6. と *note AF_INET6: 1dc7. です。バイトオブジェクトの
     'packed_ip' の長さが、指定したアドレスファミリで適切な長さでない場
     合、 *note ValueError: 15a. が発生します。 *note inet_ntop(): 1353.
     の呼び出しでエラーが起こると、 *note OSError: 543. が発生します。

     *note Availability: 234c.: Unix, Windows.

     バージョン 3.4 で変更: Windowsで利用可能になりました

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 43d.
     を使用できるようになりました。

 -- の関数: socket.CMSG_LEN (length)

     指定された 'length' にある制御メッセージ（CMSG）から、末尾のパディ
     ングを除いた全体の長さを返します。この値は多くの場合、 *note
     recvmsg(): 1163. が制御メッセージの一連の要素を受信するためのバッフ
     ァサイズとして使用できますが、バッファの末尾が要素である場合であっ
     てもパディングは含まれるので、バッファサイズを取得するには RFC
     3542(4) で求められているように、 *note CMSG_SPACE(): 2024. を使用し
     た移植可能なアプリケーションが必要です。通常 'length' は定数であり
     、許容範囲外の値が指定された場合は *note OverflowError: c5b. 例外が
     送出されます。

     *note Availability: 234c.: Unix, not WASI.

     Unix プラットフォーム。

     Added in version 3.3.

 -- の関数: socket.CMSG_SPACE (length)

     指定された 'length' の制御メッセージ（CMSG）の要素を *note
     recvmsg(): 1163. が受信するために必要な、パディングを含めたバッファ
     サイズを返します。複数の項目を受信するために必要なバッファスペース
     は、 *note CMSG_SPACE(): 2024. が返すそれぞれの要素の長さの合計です
     。通常 'length' は定数であり、許容範囲外の値が指定された場合は
     *note OverflowError: c5b. 例外が送出されます。

     一部のシステムではこの関数を提供せずに制御メッセージをサポートする
     可能性があることに注意してください。また、この関数の返り値を使用し
     て設定するバッファサイズは、受信する制御メッセージの量を正確に規定
     しないことがあり、その後に受信するデータがパディング領域に合う場合
     があることに注意してください。

     *note Availability: 234c.: 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 (real number) for new socket
     objects.  When the socket module is first imported, the default is
     ‘None’.  See *note settimeout(): 3baf. for possible values and
     their respective meanings.

     バージョン 3.15 で変更: Accepts any real number, not only integer
     or float.

 -- の関数: socket.sethostname (name)

     マシンのホスト名を 'name' に設定します。必要な権限がない場合は
     *note OSError: 543. を送出します。

     引数 ‘name’ を指定して *note 監査イベント: 1e84.
     ‘socket.sethostname’ を送出します。

     *note Availability: 234c.: Unix, not Android.

     Added in version 3.3.

 -- の関数: socket.if_nameindex ()

     ネットワークインターフェース情報 (index int, name string)のタプルを
     返します。システムコールが失敗した場合、 *note OSError: 543. 例外を
     送出します。

     *note Availability: 234c.: 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: 543. 例外を送出します。

     *note Availability: 234c.: Unix, Windows, not WASI.

     Added in version 3.3.

     バージョン 3.8 で変更: Windows のサポートが追加されました。

     参考
     ....

     "Interface name" is a name as documented in *note if_nameindex():
     df5.

 -- の関数: socket.if_indextoname (if_index)

     インターフェースインデックス番号 'if_index' に対応するネットワーク
     インターフェース名を返します。対応するインターフェースが存在しない
     場合は *note OSError: 543. 例外を送出します。

     *note Availability: 234c.: Unix, Windows, not WASI.

     Added in version 3.3.

     バージョン 3.8 で変更: Windows のサポートが追加されました。

     参考
     ....

     "Interface name" is a name as documented in *note if_nameindex():
     df5.

 -- の関数: socket.send_fds (sock, buffers, fds[, flags[, address]])

     Send the list of file descriptors 'fds' over an *note AF_UNIX:
     1dc9. socket 'sock'.  The 'fds' parameter is a sequence of file
     descriptors.  Consult *note sendmsg(): 891. for the documentation
     of these parameters.

     *note Availability: 234c.: Unix, not WASI.

     Unix platforms supporting *note sendmsg(): 891. 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:
     1dc9. socket 'sock'.  Return ‘(msg, list(fds), flags, addr)’.
     Consult *note recvmsg(): 1163. for the documentation of these
     parameters.

     *note Availability: 234c.: Unix, not WASI.

     Unix platforms supporting *note recvmsg(): 1163. 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: モジュールの内容<3>,  Up: socket --- 低水準ネットワークインターフェース

5.20.2.8 socket オブジェクト
............................

ソケットオブジェクトは以下のメソッドを持ちます。 *note makefile(): 155d.
以外のメソッドは、Unixのソケット用システムコールに対応しています。

バージョン 3.2 で変更: *note context manager: 47f. プロトコルのサポート
が追加されました。コンテキストマネージャを終了することは、 *note
close(): f34. を呼ぶことと同一です。

 -- メソッド: socket.accept ()

     接続を受け付けます。ソケットはアドレスにbind済みで、listen中である
     必要があります。戻り値は ‘(conn, address)’ のペアで、 'conn' は接続
     を通じてデータの送受信を行うための '新しい' ソケットオブジェクト、
     'address' は接続先でソケットにbindしているアドレスを示します。

     新たに作成されたソケットは *note 継承不可: 12ad. です。

     バージョン 3.4 で変更: ソケットが *note 継承不可: 12ad. になりまし
     た。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError:
     1145. 例外を送出する代わりにシステムコールを再試行するようになりま
     した (論拠については PEP 475(1) を参照してください)。

 -- メソッド: socket.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 ソケットファミリー: 3ba2.

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1e84.
     ‘socket.bind’ を送出します。

     *note Availability: 234c.: not WASI.

 -- メソッド: socket.close ()

     Mark the socket closed.  The underlying system resource (e.g.  a
     file descriptor) is also closed when all file objects from *note
     makefile(): 155d. 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(): f34. するか、 *note with: 215. 文の中でソ
     ケットを使うことを推奨します。

     バージョン 3.6 で変更: 下層の ‘close()’ が呼び出される時、*note
     OSError: 543. が送出されるようになりました。

          注釈: ‘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(): 3bec. before ‘close()’.

 -- メソッド: socket.connect (address)

     Connect to a remote socket at 'address'.  The format of 'address'
     depends on the address family -- see *note ソケットファミリー:
     3ba2.

     If the connection is interrupted by a signal, the method waits
     until the connection completes, or raises a *note TimeoutError:
     c12. 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: 1145.
     exception if the connection is interrupted by a signal (or the
     exception raised by the signal handler).

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1e84.
     ‘socket.connect’ を送出します。

     バージョン 3.5 で変更: このメソッドは、接続が信号によって中断され、
     信号ハンドラが例外を送出せず、ソケットがブロックであるかタイムアウ
     トが設定されている場合、*note InterruptedError: 1145. 例外を送出す
     る代わりに、接続を完了するまで待機するようになりました (論拠につい
     ては PEP 475(2) を参照してください)。

     *note Availability: 234c.: not WASI.

 -- メソッド: socket.connect_ex (address)

     ‘connect(address)’ と同様ですが、C言語の ‘connect()’ 関数の呼び出し
     でエラーが発生した場合には例外を送出せずにエラーを戻り値として返し
     ます。(これ以外の、"host not found,"等のエラーの場合には例外が発生
     します。)処理が正常に終了した場合には ‘0’ を返し、エラー時には
     ‘errno’ の値を返します。この関数は、非同期接続をサポートする場合な
     どに使用することができます。

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1e84.
     ‘socket.connect’ を送出します。

     *note Availability: 234c.: not WASI.

 -- メソッド: socket.detach ()

     実際にファイル記述子を閉じることなく、ソケットオブジェクトを閉じた
     状態にします。ファイル記述子は返却され、他の目的に再利用することが
     できます。

     Added in version 3.2.

 -- メソッド: socket.dup ()

     ソケットを複製します。

     新たに作成されたソケットは *note 継承不可: 12ad. です。

     バージョン 3.4 で変更: ソケットが *note 継承不可: 12ad. になりまし
     た。

     *note Availability: 234c.: not WASI.

 -- メソッド: socket.fileno ()

     ソケットのファイル記述子を短い整数型で返します。失敗時には、-1 を返
     します。ファイル記述子は、 *note select.select(): 115d. などで使用
     します。

     Windowsではこのメソッドで返された小整数をファイル記述子を扱う箇所
     (*note os.fdopen(): 2590. など) で利用できません。 Unix にはこの制
     限はありません。

 -- メソッド: socket.get_inheritable ()

     ソケットのファイル記述子またはソケットのハンドルの *note
     継承可能フラグ: 12ad. を取得します。ソケットが子プロセスへ継承可能
     なら ‘True’ 、継承不可なら ‘False’ を返します。

     Added in version 3.4.

 -- メソッド: socket.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 ソケットファミリー: 3ba2.  On some
     systems this function is not supported.

 -- メソッド: socket.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
     ソケットファミリー: 3ba2.

 -- メソッド: socket.getsockopt (level, optname[, buflen])

     Return the value of the given socket option (see the Unix man page
     ‘getsockopt(2)(3)’).  The needed symbolic constants (*note SO_*
     etc.: f36.) 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: de. for a way to decode C structures encoded as byte
     strings).

     *note Availability: 234c.: not WASI.

 -- メソッド: socket.getblocking ()

     Return ‘True’ if socket is in blocking mode, ‘False’ if in
     non-blocking.

     This is equivalent to checking ‘socket.gettimeout() != 0’.

     Added in version 3.7.

 -- メソッド: socket.gettimeout ()

     ソケットに指定されたタイムアウト値を取得します。タイムアウト値が設
     定されている場合には浮動小数点型で秒数が、設定されていなければ
     ‘None’ が返ります。この値は、最後に呼び出された *note
     setblocking(): 3277. または *note settimeout(): 3baf. によって設定
     されます。

 -- メソッド: socket.ioctl (control, option)

     *note ioctl(): 1094. メソッドは WSAIoctl システムインターフェースへ
     の制限されたインターフェースです。詳しい情報については、 Win32
     documentation(4) を参照してください。

     他のプラットフォームでは一般的な *note fcntl.fcntl(): 1983. と
     *note fcntl.ioctl(): 1833. が使われるでしょう; これらの関数は第 1 引
     数としてソケットオブジェクトを取ります。

     現在、以下のコントロールコードのみがサポートされています。
     ‘SIO_RCVALL’, ‘SIO_KEEPALIVE_VALS’, ‘SIO_LOOPBACK_FAST_PATH’。

     *note Availability: 234c.: Windows

     バージョン 3.6 で変更: ‘SIO_LOOPBACK_FAST_PATH’ が追加されました。

 -- メソッド: socket.listen ([backlog])

     サーバーを有効にして、接続を受け付けるようにします。'backlog' が指
     定されている場合、少なくとも 0 以上でなければなりません (それより低
     い場合、0 に設定されます)。システムが新しい接続を拒否するまでに許可
     する未受付の接続の数を指定します。指定しない場合、デフォルトの妥当
     な値が選択されます。

     *note Availability: 234c.: not WASI.

     バージョン 3.5 で変更: 'backlog' 引数が任意になりました。

 -- メソッド: socket.makefile (mode='r', buffering=None, *,
          encoding=None, errors=None, newline=None)

     Return a *note file object: 1581. associated with the socket.  The
     exact returned type depends on the arguments given to *note
     makefile(): 155d.  These arguments are interpreted the same way as
     by the built-in *note open(): 333. function, except the only
     supported 'mode' values are ‘'r'’ (default), ‘'w'’, ‘'b'’, or a
     combination of those.

     ソケットはブロッキングモードでなければなりません。タイムアウトを設
     定することはできますが、タイムアウトが発生すると、ファイルオブジェ
     クトの内部バッファが矛盾した状態になることがあります。

     *note makefile(): 155d. でファイルオブジェクトにソケットを関連づけ
     た場合、ソケットを閉じるには、関連づけられたすべてのファイルオブジ
     ェクトを閉じたあとで、元のソケットの *note socket.close(): f34. を
     呼び出さなければなりません。

          注釈: Windows では *note subprocess.Popen(): 6c5. の stream 引
          数などファイルディスクリプタつき file オブジェクトが期待されて
          いる場所では、 *note makefile(): 155d. によって作成される
          file-like オブジェクトは使用できません。

 -- メソッド: socket.recv (bufsize[, flags])

     Receive data from the socket.  The return value is a bytes object
     representing the data received.  The maximum amount of data to be
     received at once is specified by 'bufsize'.  A returned empty bytes
     object indicates that the client has disconnected.  See the Unix
     manual page ‘recv(2)(5)’ for the meaning of the optional argument
     'flags'; it defaults to zero.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError:
     1145. 例外を送出する代わりにシステムコールを再試行するようになりま
     した (論拠については PEP 475(6) を参照してください)。

 -- メソッド: socket.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
     ソケットファミリー: 3ba2.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError:
     1145. 例外を送出する代わりにシステムコールを再試行するようになりま
     した (論拠については 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(): 1c61.

 -- メソッド: socket.recvmsg (bufsize[, ancbufsize[, flags]])

     ソケットから通常のデータ (最大 'bufsize' バイト) と補助的なデータを
     受信します。'ancbufsize' 引数により、補助的なデータの受信に使用され
     る内部バッファのバイト数として、サイズが設定されます。このデフォル
     トは 0 で、補助的なデータを受信しないことを意味します。*note
     CMSG_SPACE(): 2024. または *note CMSG_LEN(): 2025. を使用して、補助
     的なデータの適切なサイズを計算することができ、バッファ内に収まらな
     いアイテムは、短縮されるか破棄されます。'flags' 引数はデフォルトで
     は 0 で、*note recv(): 1161. での意味と同じ意味を持ちます。

     戻り値は 4 要素のタプル ‘(data, ancdata, msg_flags, address)’ です
     。'data' アイテムは、受信した非付属的データを保持する *note bytes:
     1d2. オブジェクトです。'ancdata' アイテムは、ゼロ以上のタプル
     ‘(cmsg_level, cmsg_type, cmsg_data)’ からなるリストで、受信する付属
     的なデータ (制御メッセージ) を表します。'cmsg_level' と 'cmsg_type'
     はそれぞれ、プロトコルレベルとプロトコル固有のタイプを指定する整数
     で、'cmsg_data' は関連するデータを保持する ‘bytes’ オブジェクトです
     。'msg_flags' アイテムは、受信したメッセージの条件を示す様々なフラ
     グのビット OR です。詳細は、システムのドキュメントを参照してくださ
     い。受信ソケットが接続されていない場合、'address' は、送信ソケット
     が利用できる場合にはそのアドレスで、利用できない場合、その値は未指
     定になります。

     一部のシステムでは、*note sendmsg(): 891. と *note recvmsg(): 1163.
     を使用して、プロセス間で *note AF_UNIX: 1dc9. ソケットを経由してフ
     ァイル記述子を渡すことができます。この機能を使用する場合 (しばしば
     *note SOCK_STREAM: 16ad. ソケットに限定されます)、‘recvmsg()’ は、
     付属的なデータ中に、‘(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)’ と
     いう形式のアイテムを返します。ここで、'fds' は、新しいファイル記述
     子をネイティブ C の int 型のバイナリ配列として表す *note bytes:
     1d2. オブジェクトです。システムコールが返った後 ‘recvmsg()’ が例外
     を送出する場合、まずこのメカニズムを経由して受信したファイル記述子
     を全て閉じようと試みます。

     一部のシステムでは、部分的に受信した付属的なデータアイテムの短縮さ
     れた長さが示されません。アイテムがバッファの末尾を超えているようで
     ある場合、*note recvmsg(): 1163. は *note RuntimeWarning: 6e3. を送
     出し、関連するデータの開始位置より前で途切れていない場合、バッファ
     内の付属的なデータの一部を返します。

     ‘SCM_RIGHTS’ メカニズムをサポートするシステム上では、次の関数が最大
     'maxfds' のファイル記述子を受信し、メッセージデータと記述子を含むリ
     ストを返しま(無関係な制御メッセージを受信した場合など、予期しない条
     件は無視します)。 *note sendmsg(): 891. も参照してください。

          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: 234c.: Unix.

     Unix プラットフォーム。

     Added in version 3.3.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError:
     1145. 例外を送出する代わりにシステムコールを再試行するようになりま
     した (論拠については PEP 475(9) を参照してください)。

 -- メソッド: socket.recvmsg_into (buffers[, ancbufsize[, flags]])

     *note recvmsg(): 1163. と同様に動作してソケットから通常のデータと付
     属的なデータを受信しますが、非付属的データは新しいバイトオブジェク
     トとして返すのではなく、一連のバッファとして返します。'buffers' 引
     数は書き込み可能なバッファをエクスポートするオブジェクトのイテラブ
     ルでなければなりません (例: *note bytearray: 1d1. オブジェクト)。こ
     れらは、全てに書き込まれるか、残りバッファがなくなるまで、非付属的
     データの連続チャンクで埋められます。オペレーティングシステムによっ
     て、使用できるバッファの数が制限 (*note sysconf(): 1b2c. 値
     ‘SC_IOV_MAX’) されている場合があります。'ancbufsize' 引数と 'flags'
     引数は、‘recvmsg()’ での意味と同じ意味を持ちます。

     戻り値は 4 要素のタプル ‘(nbytes, ancdata, msg_flags, address)’ で
     す。ここで、'nbytes' はバッファに書き込まれた非付属的データの総数で
     、'ancdata'、'msg_flags'、'address' は *note recvmsg(): 1163. と同
     様です。

     以下はプログラム例です:

          >>> 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: 234c.: Unix.

     Unix プラットフォーム。

     Added in version 3.3.

 -- メソッド: socket.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 ソケットファミリー:
     3ba2.

 -- メソッド: socket.recv_into (buffer[, nbytes[, flags]])

     'nbytes' バイトまでのデータをソケットから受信して、そのデータを新し
     いバイト文字列にするのではなく 'buffer' に保存します。 'nbytes' が
     指定されない(あるいは0が指定された)場合、 'buffer' の利用可能なサイ
     ズまで受信します。受信したバイト数を返り値として返します。オプショ
     ン引数 'flags' (デフォルト:0) の意味については、 Unix マニュアルペ
     ージ ‘recv(2)(11)’ を参照してください。

 -- メソッド: socket.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(): 1161.  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: 3bff.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError:
     1145. 例外を送出する代わりにシステムコールを再試行するようになりま
     した (論拠については PEP 475(12) を参照してください)。

 -- メソッド: socket.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(): 1161.  Unlike *note send(): 1164, 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:
     1145. 例外を送出する代わりにシステムコールを再試行するようになりま
     した (論拠については PEP 475(13) を参照してください)。

 -- メソッド: socket.sendto (bytes, address)

 -- メソッド: socket.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(): 1161.  Return the number of bytes sent.  The
     format of 'address' depends on the address family -- see *note
     ソケットファミリー: 3ba2.

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1e84.
     ‘socket.sendto’ を送出します。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError:
     1145. 例外を送出する代わりにシステムコールを再試行するようになりま
     した (論拠については PEP 475(14) を参照してください)。

 -- メソッド: socket.sendmsg (buffers[, ancdata[, flags[, address]]])

     非付属的なデータを一連のバッファから集め、単一のメッセージにまとめ
     ることで、通常のデータと付属的なデータをソケットに送信します。
     'buffers' 引数は、非付属的なデータを *note bytes-like objects: 43d.
     (例: *note bytes: 1d2. オブジェクト) のイテラブルとして指定します。
     オペレーティングシステムによって、使用できるバッファの数が制限
     (*note sysconf(): 1b2c. 値 ‘SC_IOV_MAX’) されている場合があります。
     'ancdata' 引数は付属的なデータ (制御メッセージ) をゼロ以上のタプル
     ‘(cmsg_level, cmsg_type, cmsg_data)’ のイテラブルとして指定します。
     ここで、'cmsg_level' と 'cmsg_type' はそれぞれプロトコルレベルとプ
     ロトコル固有のタイプを指定する整数で、'cmsg_data' は関連データを保
     持するバイトライクオブジェクトです。一部のシステム (特に *note
     CMSG_SPACE(): 2024. を持たないシステム) では、一度の呼び出しで一つ
     の制御メッセージの送信しかサポートされていない場合があります。
     'flags' 引数のデフォルトは 0 であり、*note send(): 1164. での意味と
     同じ意味を持ちます。‘None’ 以外の 'address' が渡された場合、メッセ
     ージの目的地のアドレスを設定します。戻り値は、送信された非付属的デ
     ータのバイト数です。

     以下の関数は、‘SCM_RIGHTS’ メカニズムをサポートするシステムで、ファ
     イル記述子 'fds' を *note AF_UNIX: 1dc9. ソケット経由で送信します。
     *note recvmsg(): 1163. も参照してください。

          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: 234c.: Unix, not WASI.

     Unix プラットフォーム。

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1e84.
     ‘socket.sendmsg’ を送出します。

     Added in version 3.3.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError:
     1145. 例外を送出する代わりにシステムコールを再試行するようになりま
     した (論拠については PEP 475(15) を参照してください)。

 -- メソッド: socket.sendmsg_afalg ([msg], *, op[, iv[, assoclen[,
          flags]]])

     *note sendmsg(): 891. の *note AF_ALG: 1098. ソケット用に特化したバ
     ージョンです。‘AF_ALG’ ソケットの、モード、IV、AEAD に関連づけられ
     たデータ長、フラグを設定します。

     *note Availability: 234c.: Linux >= 2.6.38.

     Added in version 3.6.

 -- メソッド: socket.sendfile (file, offset=0, count=None)

     高性能の *note os.sendfile: ed7. を使用して、ファイルを EOF まで送
     信し、送信されたバイトの総数を返します。'file' は、バイナリモードで
     開かれた標準的なファイルオブジェクトです。‘os.sendfile’ が使用でき
     ない場合 (例: Windows)、または 'file' が標準的なファイルでない場合
     、代わりに *note send(): 1164. が使用されます。'offset' は、ファイ
     ルの読み出し開始位置を指定します。'count' が指定されている場合、フ
     ァイルを EOF まで送信するのではなく、転送するバイトの総数を指定しま
     す。ファイルの位置は、返る時に更新されます。あるいは、エラー時には
     *note file.tell(): 1765.  を使用して送信されたバイトの数を確認する
     ことができます。ソケットは *note SOCK_STREAM: 16ad. タイプでなけれ
     ばなりません。非ブロックソケットはサポートされていません。

     Added in version 3.5.

 -- メソッド: socket.set_inheritable (inheritable)

     ソケットのファイル記述子、またはソケットのハンドルの、 *note
     継承可能フラグ: 12ad. を立てます。

     Added in version 3.4.

 -- メソッド: socket.setblocking (flag)

     ソケットをブロッキングモード、または非ブロッキングモードに設定しま
     す。'flag' が False の場合にはソケットは非ブロッキングモードになり
     、True の場合にはブロッキングモードになります。

     このメソッドは、次の *note settimeout(): 3baf. 呼び出しの省略表記で
     す:

        * ‘sock.setblocking(True)’ は ‘sock.settimeout(None)’ と等価です

        * ‘sock.setblocking(False)’ は ‘sock.settimeout(0.0)’ と等価です

     バージョン 3.7 で変更: The method no longer applies *note
     SOCK_NONBLOCK: fcd. flag on *note socket.type: fcf.

 -- メソッド: socket.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: c11. 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 ソケットタイムアウトの注意事項: 3c00. を参照してくだ
     さい。

     バージョン 3.7 で変更: The method no longer toggles *note
     SOCK_NONBLOCK: fcd. flag on *note socket.type: fcf.

     バージョン 3.15 で変更: Accepts any real number, not only integer
     or float.

 -- メソッド: socket.setsockopt (level, optname, value: int | Buffer)

 -- メソッド: socket.setsockopt (level, optname, None, optlen: int)

     Set the value of the given socket option (see the Unix manual page
     ‘setsockopt(2)(16)’).  The needed symbolic constants are defined in
     this module (SO_* etc.  <socket-unix-constants>).  The value can be
     an integer, ‘None’ or a *note bytes-like object: 43d. 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: de. 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: 43d.
     を使用できるようになりました。

     バージョン 3.6 で変更: setsockopt(level, optname, None, optlen:
     int) の形式が追加されました。

     *note Availability: 234c.: not WASI.

 -- メソッド: socket.shutdown (how)

     接続の片方向、または両方向を切断します。 'how' が *note SHUT_RD:
     3be9. の場合、以降は受信を行えません。 'how' が *note SHUT_WR:
     3bea. の場合、以降は送信を行えません。 'how' が *note SHUT_RDWR:
     3beb. の場合、以降は送受信を行えません。

     *note Availability: 234c.: not WASI.

 -- メソッド: socket.share (process_id)

     ソケットを複製し、対象のプロセスと共有するための bytes オブジェクト
     を返します。対象のプロセスを 'process_id' で指定しなければなりませ
     ん。戻り値の bytes オブジェクトは、何らかのプロセス間通信を使って対
     象のプロセスに伝えます。対象のプロセス側では、 *note fromshare():
     fca. を使って複製されたソケットをとらえます。オペレーティング・シス
     テムは対象のプロセスに対してソケットを複製するため、このメソッドを
     呼び出した後であれば、元のソケットをクローズしても、対象のプロセス
     に渡ったソケットには影響がありません。

     *note Availability: 234c.: Windows.

     Added in version 3.3.

‘read()’ メソッドと ‘write()’ メソッドは存在しませんので注意してください
。代わりに 'flags' を省略した *note recv(): 1161. と *note send(): 1164.
を使うことができます。

ソケットオブジェクトには以下の *note socket: 115e. コンストラクタに渡さ
れた値に対応した (読み出し専用) 属性があります。

 -- の属性: socket.family

     ソケットファミリー。

 -- の属性: socket.type

     ソケットタイプ。

 -- の属性: socket.proto

     ソケットプロトコル。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://peps.python.org/pep-0475/

   (3) https://manpages.debian.org/getsockopt(2)

   (4) https://msdn.microsoft.com/en-us/library/ms741621%28VS.85%29.aspx

   (5) https://manpages.debian.org/recv(2)

   (6) https://peps.python.org/pep-0475/

   (7) https://manpages.debian.org/recv(2)

   (8) https://peps.python.org/pep-0475/

   (9) https://peps.python.org/pep-0475/

   (10) https://manpages.debian.org/recv(2)

   (11) https://manpages.debian.org/recv(2)

   (12) https://peps.python.org/pep-0475/

   (13) https://peps.python.org/pep-0475/

   (14) https://peps.python.org/pep-0475/

   (15) https://peps.python.org/pep-0475/

   (16) https://manpages.debian.org/setsockopt(2)


File: python.info,  Node: ソケットタイムアウトの注意事項,  Next: 使用例<27>,  Prev: socket オブジェクト,  Up: socket --- 低水準ネットワークインターフェース

5.20.2.9 ソケットタイムアウトの注意事項
.......................................

ソケットオブジェクトは、ブロッキングモード、非ブロッキングモード、タイム
アウトモードのうち、いずれか1つのモードをとります。デフォルトでは、ソケ
ットは常にブロッキングモードで作成されますが、 *note
setdefaulttimeout(): 3bb3. で標準のモードを変更することができます。

   * 'ブロッキングモード' での操作は、完了するか、または（接続がタイムア
     ウトするなどして）システムがエラーを返すまで、ブロックされます。

   * '非ブロッキングモード' での操作は、ただちに完了できない場合、例外を
     送出して失敗します。この場合の例外の種類は、システムに依存するため
     、ここに記すことができません。 *note select: c9. モジュールの関数を
     使って、ソケットの読み書きが利用可能かどうか、可能な場合はいつ利用
     できるかを調べることができます。

   * 'タイムアウトモード' での操作は、指定されたタイムアウトの時間内に完
     了しなければ、 *note timeout: c11. 例外を送出します。タイムアウトの
     時間内にシステムがエラーを返した場合は、そのエラーを返します。

     注釈: 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(): 3bfd. of a socket.

* Menu:

* タイムアウトと connect メソッド::
* タイムアウトと accept メソッド::


File: python.info,  Node: タイムアウトと connect メソッド,  Next: タイムアウトと accept メソッド,  Up: ソケットタイムアウトの注意事項

5.20.2.10 タイムアウトと ‘connect’ メソッド
...........................................

*note connect(): 1160. もタイムアウト設定に従います。一般的に、 *note
settimeout(): 3baf. を ‘connect()’ の前に呼ぶか、 *note
create_connection(): a67. にタイムアウト引数を渡すことが推奨されます。た
だし、システムのネットワークスタックが Python のソケットタイムアウトの設
定を無視して、自身の接続タイムアウトエラーを返すこともあります。


File: python.info,  Node: タイムアウトと accept メソッド,  Prev: タイムアウトと connect メソッド,  Up: ソケットタイムアウトの注意事項

5.20.2.11 タイムアウトと ‘accept’ メソッド
..........................................

*note getdefaulttimeout(): 3bf1. が *note None: a6a. でない場合、 *note
accept(): 115f. メソッドが返すソケットでは、そのタイムアウトが継承されま
す。 ‘None’ である場合、待機中のソケットの設定によって動作は異なります。

   * 待機中のソケットが 'ブロッキングモード' または 'タイムアウトモード'
     である場合、*note accept(): 115f. が返すソケットは、'ブロッキングモ
     ード' になります。

   * 待機中のソケットが '非ブロッキングモード' である場合、*note
     accept(): 115f. が返すソケットは、オペレーティングシステムによって
     ブロッキングモードまたは非ブロッキングモードになります。クロスプラ
     ットフォームの動作を確保したい場合、この設定を手動でオーバーライド
     することをお勧めします。


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(): 115e, *note bind(): 1481, *note listen(): 1212,
*note accept(): 115f. (possibly repeating the ‘accept()’ to service more
than one client), while a client only needs the sequence ‘socket()’,
*note connect(): 1160.  Also note that the server does not *note
sendall(): 1165./*note recv(): 1161. 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: 1351.) 接続を行ったあ
と、ソケットオブジェクトで *note socket.send(): 1164. と *note
socket.recv(): 1161. 操作 (とそのカウンターパート) を通常通りに使用する
ことができます。

最後の例では、特権が必要になるかもしれません:

     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: 2366.  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
オプションのモジュールの要件: 2364.

     注釈: 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 セキュリティで考慮すべき点: 3aee. を読まずにこのモジュ
     ールを使用しないでください。SSL のデフォルト設定はアプリケーション
     に十分ではないので、読まない場合はセキュリティに誤った意識を持って
     しまうかもしれません。

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

このセクションでは、 ‘ssl’ モジュールのオブジェクトと関数を解説します。
TLS, SSL, 証明書に関するより一般的な情報は、末尾にある "See Also" のセク
ションを参照してください。

This module provides a class, *note ssl.SSLSocket: cbf, which is derived
from the *note socket.socket: 115e. 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: 33e. クラ
スが設定と証明書の管理の助けとなるでしょう。それは *note
SSLContext.wrap_socket(): 938. メソッドを通して 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/main/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>.
* コンテキストの作成::
* Signature algorithms::
* 例外: 例外<20>.
* 乱数生成::
* 証明書の取り扱い::
* 定数: 定数<9>.


File: python.info,  Node: ソケットの作成<2>,  Next: コンテキストの作成,  Up: Functions constants and exceptions

5.20.3.2 ソケットの作成
.......................

Instances of *note SSLSocket: cbf. must be created using the *note
SSLContext.wrap_socket(): 938. method.  The helper function *note
create_default_context(): 695. 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: Signature algorithms,  Prev: ソケットの作成<2>,  Up: Functions constants and exceptions

5.20.3.3 コンテキストの作成
...........................

コンビニエンス関数が、共通の目的で使用される *note SSLContext: 33e. オブ
ジェクトを作成するのに役立ちます。

 -- の関数: ssl.create_default_context (purpose=Purpose.SERVER_AUTH, *,
          cafile=None, capath=None, cadata=None)

     Return a new *note SSLContext: 33e. 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(): 129f. のも
     のと同じです。これら 3 つすべてが *note None: a6a. であれば、この関
     数は代わりにシステムのデフォルトの CA 証明書を信用して選択すること
     ができます。

     The settings are: *note PROTOCOL_TLS_CLIENT: c4c. or *note
     PROTOCOL_TLS_SERVER: c4d, *note OP_NO_SSLv2: c16, and *note
     OP_NO_SSLv3: c17. with high encryption cipher suites without RC4
     and without unauthenticated cipher suites.  Passing *note
     SERVER_AUTH: 1361. as 'purpose' sets *note verify_mode: 3c0e. to
     *note CERT_REQUIRED: 3c0f. and either loads CA certificates (when
     at least one of 'cafile', 'capath' or 'cadata' is given) or uses
     *note SSLContext.load_default_certs(): 1360. to load default CA
     certificates.

     When *note keylog_filename: 3c10. 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: 696. and *note VERIFY_X509_STRICT: 758.
     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: 33e. を作って自分自身で設定を適用すべきです
          。

          注釈: ある種の古いクライアントやサーバが接続しようと試みてきた
          場合に、この関数で作られた *note SSLContext: 33e. が "Protocol
          or cipher suite mismatch" で始まるエラーを起こすのを目撃したら
          それは、この関数が *note OP_NO_SSLv3: c17. を使って除外してい
          る 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: 758. 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: c4c. or *note PROTOCOL_TLS_SERVER: c4d.
     protocol instead of generic *note PROTOCOL_TLS: 3c11.

     バージョン 3.13 で変更: The context now uses *note
     VERIFY_X509_PARTIAL_CHAIN: 696. and *note VERIFY_X509_STRICT: 758.
     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: Signature algorithms,  Next: 例外<20>,  Prev: コンテキストの作成,  Up: Functions constants and exceptions

5.20.3.4 Signature algorithms
.............................

 -- の関数: ssl.get_sigalgs ()

     Return a list of available TLS signature algorithm names used by
     servers to complete the TLS handshake or clients requesting
     certificate-based authentication.  For example:

          >>> ssl.get_sigalgs()
          ['ecdsa_secp256r1_sha256', 'ecdsa_secp384r1_sha384', ...]

     These names can be used when building string values to pass to the
     *note SSLContext.set_client_sigalgs(): 26d. and *note
     SSLContext.set_server_sigalgs(): 26e. methods.

     Added in version 3.15.


File: python.info,  Node: 例外<20>,  Next: 乱数生成,  Prev: Signature algorithms,  Up: Functions constants and exceptions

5.20.3.5 例外
.............

 -- 例外: ssl.SSLError

     (現在のところ OpenSSL ライブラリによって提供されている)下層の SSL 実
     装からのエラーを伝えるための例外です。このエラーは、低レベルなネッ
     トワークの上に載っている、高レベルな暗号化と認証レイヤーでの問題を
     通知します。このエラーは *note OSError: 543. のサブタイプです。
     *note SSLError: 1633. インスタンスのエラーコードとメッセージは
     OpenSSL ライブラリによるものです。

     バージョン 3.3 で変更: *note SSLError: 1633. は以前は *note
     socket.error: 140c. のサブタイプでした。

      -- の属性: 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: 1633. サブク
     ラス例外です。これは下層の転送(read TCP)が閉じたことは意味しないこ
     とに注意してください。

     Added in version 3.3.

 -- 例外: ssl.SSLWantReadError

     読み出しあるいは書き込みを試みようとした際に、リクエストが遂行され
     る前に下層の TCP 転送で受け取る必要があるデータが不足した場合に
     *note non-blocking SSL socket: 3c15. によって送出される *note
     SSLError: 1633. サブクラス例外です。

     Added in version 3.3.

 -- 例外: ssl.SSLWantWriteError

     読み出しあるいは書き込みを試みようとした際に、リクエストが遂行され
     る前に下層の TCP 転送が送信する必要があるデータが不足した場合に
     *note non-blocking SSL socket: 3c15. によって送出される *note
     SSLError: 1633. サブクラス例外です。

     Added in version 3.3.

 -- 例外: ssl.SSLSyscallError

     SSL ソケット上で操作を遂行しようとしていてシステムエラーが起こった
     場合に送出される *note SSLError: 1633. サブクラス例外です。残念なが
     ら元となった errno 番号を調べる簡単な方法はありません。

     Added in version 3.3.

 -- 例外: ssl.SSLEOFError

     SSL コネクションが唐突に打ち切られた際に送出される *note SSLError:
     1633. サブクラス例外です。一般的に、このエラーが起こったら下層の転
     送を再利用しようと試みるべきではありません。

     Added in version 3.3.

 -- 例外: ssl.SSLCertVerificationError

     A subclass of *note SSLError: 1633. 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: f3f. の別名です。

     バージョン 3.7 で変更: 例外は *note SSLCertVerificationError: f3f.
     の別名になりました。


File: python.info,  Node: 乱数生成,  Next: 証明書の取り扱い,  Prev: 例外<20>,  Up: Functions constants and exceptions

5.20.3.6 乱数生成
.................

 -- の関数: ssl.RAND_bytes (num, /)

     暗号学的に強固な擬似乱数の 'num' バイトを返します。擬似乱数生成器に
     十分なデータでシードが与えられていない場合や、現在の RANDOM メソッ
     ドに操作がサポートされていない場合は *note SSLError: 1633. を送出し
     ます。 *note RAND_status(): 1e93. を使って擬似乱数生成器の状態をチ
     ェックできます。 *note RAND_add(): 3c1b. を使って擬似乱数生成器にシ
     ードを与えることができます。

     ほとんどすべてのアプリケーションでは *note os.urandom(): 936. が望
     ましいです。

     暗号論的に強い擬似乱数生成器に要求されることについては 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.  Use *note
     ssl.RAND_add(): 3c1b. 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: 43d.
     を使用できるようになりました。

   ---------- 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.7 証明書の取り扱い
.........................

 -- の関数: 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(): 129f.  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: 3c1d. から *note
     PROTOCOL_TLS: 3c11. に変更されました。

     バージョン 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(): 1359. で
     使われるものと同じです。戻り値は *note named tuple: a42.
     ‘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: 234c.: 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: 234c.: 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.8 定数
.............

     すべての定数が *note enum.IntEnum: 10a1. コレクションまたは *note
     enum.IntFlag: 1061. コレクションになりました。

     Added in version 3.6.

 -- データ: ssl.CERT_NONE

     Possible value for *note SSLContext.verify_mode: 3c0e.  Except for
     *note PROTOCOL_TLS_CLIENT: c4c, 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 セキュリティで考慮すべき点:
     3aee. に関する議論を参照してください。

 -- データ: ssl.CERT_OPTIONAL

     Possible value for *note SSLContext.verify_mode: 3c0e.  In client
     mode, *note CERT_OPTIONAL: 3c22. has the same meaning as *note
     CERT_REQUIRED: 3c0f.  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(): 129f.

 -- データ: ssl.CERT_REQUIRED

     Possible value for *note SSLContext.verify_mode: 3c0e.  In this
     mode, certificates are required from the other side of the socket
     connection; an *note SSLError: 1633. 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: 3c23. must be enabled
     as well to verify the authenticity of a cert.  *note
     PROTOCOL_TLS_CLIENT: c4c. uses *note CERT_REQUIRED: 3c0f. 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(): 129f.

 -- クラス: ssl.VerifyMode

     CERT_* 定数の *note enum.IntEnum: 10a1. コレクションです。

     Added in version 3.6.

 -- データ: ssl.VERIFY_DEFAULT

     *note SSLContext.verify_flags: 135c. に渡せる値です。このモードでは
     、証明書失効リスト(CRLs)はチェックされません。デフォルトでは
     OpenSSL は CRLs を必要ともしませんし検証にも使いません。

     Added in version 3.4.

 -- データ: ssl.VERIFY_CRL_CHECK_LEAF

     *note SSLContext.verify_flags: 135c. に渡せる値です。このモードでは
     、接続先の証明書のみがチェックされ、仲介の CA 証明書はチェックされ
     ません。接続先証明書の発行者(その CA の直接の祖先)によって署名され
     た妥当な CRL が必要です。 *note SSLContext.load_verify_locations:
     129f. で相応しい CRL をロードしていなければ、検証は失敗します。

     Added in version 3.4.

 -- データ: ssl.VERIFY_CRL_CHECK_CHAIN

     *note SSLContext.verify_flags: 135c. に渡せる値です。このモードでは
     、接続先の証明書チェイン内のすべての証明書についての CRLs がチェッ
     クされます。

     Added in version 3.4.

 -- データ: ssl.VERIFY_X509_STRICT

     *note SSLContext.verify_flags: 135c. に渡せる値で、壊れた X.509 証
     明書に対するワークアラウンドを無効にします。

     Added in version 3.4.

 -- データ: ssl.VERIFY_ALLOW_PROXY_CERTS

     Possible value for *note SSLContext.verify_flags: 135c. to enables
     proxy certificate verification.

     Added in version 3.10.

 -- データ: ssl.VERIFY_X509_TRUSTED_FIRST

     *note SSLContext.verify_flags: 135c. に渡せる値です。OpenSSL に対し
     、証明書検証のために信頼チェインを構築する際、信頼できる証明書を選
     ぶように指示します。これはデフォルトで有効にされています。

     Added in version 3.4.4.

 -- データ: ssl.VERIFY_X509_PARTIAL_CHAIN

     Possible value for *note SSLContext.verify_flags: 135c.  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: 1061. コレクションです。

     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: c4c. and *note PROTOCOL_TLS_SERVER: c4d.

 -- データ: 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: 3c0f. and
     *note check_hostname: 3c23. 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: 3c11. のエイリアスです。

     バージョン 3.6 で非推奨: 代わりに *note PROTOCOL_TLS: 3c11. を使用
     してください。

 -- データ: 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: c4d. or *note PROTOCOL_TLS_CLIENT: c4c. with
     *note SSLContext.minimum_version: c4a. and *note
     SSLContext.maximum_version: c4b. 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: 3c11. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして SSLv2 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.6 で非推奨: SSLv2 は非推奨です

 -- データ: ssl.OP_NO_SSLv3

     SSLv3 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 3c11. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして SSLv3 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.6 で非推奨: SSLv3 は非推奨です

 -- データ: ssl.OP_NO_TLSv1

     TLSv1 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 3c11. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして TLSv1 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.7 で非推奨: The option is deprecated since OpenSSL
     1.1.0, use the new *note SSLContext.minimum_version: c4a. and *note
     SSLContext.maximum_version: c4b. instead.

 -- データ: ssl.OP_NO_TLSv1_1

     TLSv1.1 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 3c11. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして 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: 3c11. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして 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: 3c11.  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: 1061. コレクションです。

 -- データ: 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: f40. 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(): 33f. メソッドで提示することが
     できます。

     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_PSK_TLS13

     Whether the OpenSSL library has built-in support for External PSKs
     in TLS 1.3 as described in RFC 9258(4).

     Added in version 3.15.

 -- データ: 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(): 1504. の引
     数に渡せます。

     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(5) その他からのアラートの種類です。 IANA TLS Alert
     Registry(6) にはこのリストとその意味が定義された RFC へのリファレン
     スが含まれています。

     *note SSLContext.set_servername_callback(): 1365. でのコールバック
     関数の戻り値として使われます。

     Added in version 3.4.

 -- クラス: ssl.AlertDescription

     ALERT_DESCRIPTION_* 定数の *note enum.IntEnum: 10a1. コレクションで
     す。

     Added in version 3.6.

 -- データ: Purpose.SERVER_AUTH

     *note create_default_context(): 695. と *note
     SSLContext.load_default_certs(): 1360. に渡すオプションです。この値
     はコンテキストが web サーバの認証に使われることを示します (ですので
     、クライアントサイドのソケットを作るのに使うことになるでしょう)。

     Added in version 3.4.

 -- データ: Purpose.CLIENT_AUTH

     *note create_default_context(): 695. と *note
     SSLContext.load_default_certs(): 1360. に渡すオプションです。この値
     はコンテキストが web クライアントの認証に使われることを示します (で
     すので、サーバサイドのソケットを作るのに使うことになるでしょう)。

     Added in version 3.4.

 -- クラス: ssl.SSLErrorNumber

     SSL_ERROR_* 定数の *note enum.IntEnum: 10a1. コレクションです。

     Added in version 3.6.

 -- クラス: ssl.TLSVersion

     *note enum.IntEnum: 10a1. collection of SSL and TLS versions for
     *note SSLContext.maximum_version: c4b. and *note
     SSLContext.minimum_version: c4a.

     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: 3c42. members
     except *note TLSVersion.TLSv1_2: 3c48. 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/rfc9258.html

   (5) https://datatracker.ietf.org/doc/html/rfc5246.html

   (6) 
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.9 SSL sockets
....................

 -- クラス: ssl.SSLSocket (socket.socket)

     SSL ソケットは *note socket オブジェクト: 3bef. の以下のメソッドを
     提供します:

        - *note accept(): 115f.

        - *note bind(): 1481.

        - *note close(): 10fe.

        - *note connect(): 1160.

        - *note detach(): 15d9.

        - *note fileno(): 3bfd.

        - *note getpeername(): 3b32, *note getsockname(): 513.

        - *note getsockopt(): 1096, *note setsockopt(): 1097.

        - *note gettimeout(): 3bfe, *note settimeout(): 3baf, *note
          setblocking(): 3277.

        - *note listen(): 1212.

        - *note makefile(): 155d.

        - *note recv(): 1161, *note recv_into(): 16d7. (but passing a
          non-zero ‘flags’ argument is not allowed)

        - *note send(): 1164, *note sendall(): 1165. (with the same
          limitation)

        - *note sendfile(): 1211. (it may be high-performant only when
          the kernel TLS is enabled by setting *note OP_ENABLE_KTLS:
          1a63. or when a socket is plain-text, else *note send(): 1164.
          will be used)

        - *note shutdown(): 3bec.

     SSL(およびTLS)プロトコルは TCP の上に独自の枠組みを持っているので、
     SSLソケットの抽象化は、いくつかの点で通常の OSレベルのソケットの仕
     様から逸脱することがあります。特に *note
     ノンブロッキングソケットについての注釈: 3c15. を参照してください。

     *note SSLSocket: cbf. のインスタンスは *note
     SSLContext.wrap_socket(): 938. メソッドを使用して作成されなければな
     りません。

     バージョン 3.5 で変更: ‘sendfile()’ メソッドが追加されました。

     バージョン 3.5 で変更: ‘shutdown()’ は、バイトが送受信されるたびに
     ソケットのタイムアウトをリセットしません。ソケットのタイムアウトは
     、シャットダウンの最大合計時間になりました。

     バージョン 3.6 で非推奨: *note SSLSocket: cbf. インスタンスを直接作
     成することは非推奨です。ソケットをラップするために *note
     SSLContext.wrap_socket(): 938. を使用してください。

     バージョン 3.7 で変更: ‘SSLSocket’ instances must to created with
     *note wrap_socket(): 938.  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.

     バージョン 3.15 で変更: Python now uses ‘SSL_sendfile’ internally
     when possible.  The function sends a file more efficiently because
     it performs TLS encryption in the kernel to avoid additional
     context switches.

SSL ソケットには、以下に示す追加のメソッドと属性もあります:

 -- メソッド: SSLSocket.read (len=1024, buffer=None)

     SSL ソケットからデータの 'len' バイトまでを読み出し、読み出した結果
     を ‘bytes’ インスタンスで返します。 'buffer' を指定すると、結果は代
     わりに buffer に読み込まれ、読み込んだバイト数を返します。

     ソケットが *note non-blocking: 3c15. で読み出しがブロックすると、
     *note SSLWantReadError: 121d. もしくは *note SSLWantWriteError:
     121e. が送出されます。

     再ネゴシエーションがいつでも可能なので、 *note read(): 1222. の呼び
     出しは書き込み操作も引き起こしえます。

     バージョン 3.5 で変更: ソケットのタイムアウトは、バイトが送受信され
     るたびにリセットされなくなりました。ソケットのタイムアウトは、最大
     'len' バイトを読むのにかかる最大合計時間になりました。

     バージョン 3.6 で非推奨: *note read(): 1222. の代わりに ‘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: 3c15. で書き込みがブロックすると、
     *note SSLWantReadError: 121d. もしくは *note SSLWantWriteError:
     121e. が送出されます。

     再ネゴシエーションがいつでも可能なので、 *note write(): 1223. の呼
     び出しは読み出し操作も引き起こしえます。

     バージョン 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(): 1223. の代わりに ‘send()’ を
     使用してください。

     注釈: *note read(): 1222, *note write(): 1223. メソッドは下位レベル
     のメソッドであり、暗号化されていないアプリケーションレベルのデータ
     を読み書きし、それを復号/暗号化して暗号化された書き込みレベルのデー
     タにします。これらのメソッドはアクティブな SSL 接続つまり、ハンドシ
     ェイクが完了していて、 *note SSLSocket.unwrap(): 3c4b. が呼ばれてい
     ないことを必要とします。

     通常はこれらのメソッドの代わりに *note recv(): 1161. や *note
     send(): 1164. のようなソケット API メソッドを使うべきです。

 -- メソッド: SSLSocket.do_handshake (block=False)

     SSL セットアップのハンドシェイクを実行します。

     If 'block' is true and the timeout obtained by *note gettimeout():
     3bfe. 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: 3c23. attribute
     of the socket's *note context: 3c4c. 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: 15a. が送出されます。

     ‘binary_form’ が *note False: ef9. で接続先から証明書を取得した場合
     、このメソッドは *note dict: 193. のインスタンスを返します。証明書
     が認証されていない場合、辞書は空です。証明書が認証されていた場合い
     くつかのキーを持った辞書を返し、 ‘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: fd0. だった場合、証明書が渡されて
     いればこのメソッドはDERエンコードされた証明書全体をバイト列として返
     し、接続先が証明書を提示しなかった場合は *note None: a6a. を返しま
     す。接続先が証明書を提供するかどうかは SSL ソケットの役割に依存しま
     す:

        * クライアント SSL ソケットでは、認証が要求されているかどうかに
          関わらず、サーバは常に証明書を提供します。

        * サーバ SSL ソケットでは、クライアントはサーバによって認証が要
          求されている場合にのみ証明書を提供します。したがって、 (*note
          CERT_OPTIONAL: 3c22. や *note CERT_REQUIRED: 3c0f. ではなく)
          *note CERT_NONE: 3c21. を使用した場合 *note getpeercert():
          1366. は *note None: a6a. を返します。

     See also *note SSLContext.check_hostname: 3c23.

     バージョン 3.2 で変更: 返される辞書に ‘issuer’, ‘notBefore’ のよう
     な追加アイテムを含むようになりました。

     バージョン 3.4 で変更: ハンドシェイクが済んでいなければ *note
     ValueError: 15a. を投げるようになりました。返される辞書に
     ‘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(): 1b8f.

     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(): 1220. は ‘None’ を返します。

     Added in version 3.5.

 -- メソッド: SSLSocket.group ()

     Return the group used for doing key agreement on this connection.
     If no connection has been established, returns ‘None’.

     Added in version 3.15.

 -- メソッド: SSLSocket.client_sigalg ()

     Return the signature algorithm used for performing
     certificate-based client authentication on this connection, or
     ‘None’ if no connection has been established or client
     authentication didn't occur.

     Added in version 3.15.

 -- メソッド: SSLSocket.server_sigalg ()

     Return the signature algorithm used by the server to complete the
     TLS handshake on this connection, or ‘None’ if no connection has
     been established or the cipher suite has no signature.

     Added in version 3.15.

 -- メソッド: SSLSocket.compression ()

     使われている圧縮アルゴリズムを文字列で返します。接続が圧縮されてい
     なければ ‘None’ を返します。

     上位レベルのプロトコルが自身で圧縮メカニズムをサポートする場合、SSL
     レベルでの圧縮を *note OP_NO_COMPRESSION: 1506. を使って無効にでき
     ます。

     Added in version 3.3.

 -- メソッド: SSLSocket.get_channel_binding (cb_type='tls-unique')

     現在の接続におけるチャネルバインディングのデータを取得します。未接
     続あるいはハンドシェイクが完了していなければ ‘None’ を返します。

     'cb_type' パラメータにより、望みのチャネルバインディングのタイプを
     選択できます。チャネルバインディングのタイプの妥当なものは *note
     CHANNEL_BINDING_TYPES: 3c3d. でリストされています。現在のところは
     RFC 5929(2) で定義されている 'tls-unique' のみがサポートされていま
     す。未サポートのチャネルバインディングのタイプが要求された場合、
     *note ValueError: 15a. を送出します。

     Added in version 3.3.

 -- メソッド: SSLSocket.selected_alpn_protocol ()

     TLS ハンドシェイクで選択されたプロトコルを返します。 *note
     SSLContext.set_alpn_protocols(): 1218. が呼ばれていない場合、相手側
     が ALPN をサポートしていない場合、クライアントが提案したプロトコル
     のどれもソケットがサポートしない場合、あるいはハンドシェイクがまだ
     行われていない場合には、 ‘None’ が返されます。

     Added in version 3.5.

 -- メソッド: SSLSocket.selected_npn_protocol ()

     TLS/SSL ハンドシェイクで選択された上位レベルのプロトコルを返します
     。 *note SSLContext.set_npn_protocols(): 33f. が呼ばれていない場合
     、相手側が 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:
     df9.

     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: 1633. is raised.

          注釈: Only available with OpenSSL 1.1.1 and TLS 1.3 enabled.
          Without TLS 1.3 support, the method raises *note
          NotImplementedError: 5a1.

     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: 33e. 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: 1ea. 型、またはサーバサイドのソケット
     の場合とコンストラクタで 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: 109f. です。このセッション
     は、TLS ハンドシェイクの実行後、クライアントサイドとサーバサイドの
     ソケットで使用できます。クライアントソケットでは、このセッションを
     *note do_handshake(): 1221. が呼ばれる前に設定して、セッションを再
     利用できます。

     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.10 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: 3c11.; 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(): 695. 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: 1506, *note
     OP_CIPHER_SERVER_PREFERENCE: 1509, *note OP_SINGLE_DH_USE: 3c2e,
     *note OP_SINGLE_ECDH_USE: 3c2f, *note OP_NO_SSLv2: c16, and *note
     OP_NO_SSLv3: c17. (except for *note PROTOCOL_SSLv3: 3c1d.) 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: c4c. or *note PROTOCOL_TLS_SERVER: c4d.
     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: 3c11,
     *note PROTOCOL_TLS_CLIENT: c4c, and *note PROTOCOL_TLS_SERVER: c4d.
     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: 33e. オブジェクトは以下のメソッドと属性を持っています:

 -- メソッド: 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 証明書: 3c51. の議論を参照し
     てください。

     'password' 引数に、秘密鍵を復号するためのパスワードを返す関数を与え
     ることができます。その関数は秘密鍵が暗号化されていて、なおかつパス
     ワードが必要な場合にのみ呼び出されます。その関数は引数なしで呼び出
     され、string, bytes, または bytearray を返さなければなりません。戻
     り値が string の場合は鍵を復号化するのに使う前に UTF-8 でエンコード
     されます。string の代わりに bytes や bytearray を返した場合は
     'password' 引数に直接供給されます。秘密鍵が暗号化されていなかったり
     パスワードを必要としない場合は、指定は無視されます。

     'password' が与えられず、そしてパスワードが必要な場合には、OpenSSL
     組み込みのパスワード問い合わせメカニズムが、ユーザに対話的にパスワ
     ードを問い合わせます。

     秘密鍵が証明書に合致しなければ、 *note SSLError: 1633. が送出されま
     す。

     バージョン 3.3 で変更: 新しいオプション引数 'password'。

 -- メソッド: SSLContext.load_default_certs
          (purpose=Purpose.SERVER_AUTH)

     デフォルトの場所から "認証局" (CA=certification authority) 証明書フ
     ァイル一式をロードします。Windows では、CA 証明書はシステム記憶域の
     ‘CA’ と ‘ROOT’ からロードします。全てのシステムでは、この関数は
     *note SSLContext.set_default_verify_paths(): 1359. を呼び出します。
     将来的にはこのメソッドは、他の場所からも CA 証明書をロードするかも
     しれません。

     The 'purpose' flag specifies what kind of CA certificates are
     loaded.  The default settings *note Purpose.SERVER_AUTH: 1361.
     loads certificates, that are flagged and trusted for TLS web server
     authentication (client side sockets).  *note Purpose.CLIENT_AUTH:
     1362. 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: 3c0e. が *note CERT_NONE: 3c21. でない場合に接続
     先の証明書ファイルの正当性検証に使われる "認証局" (CA=certification
     authority) 証明書ファイル一式をロードします。少なくとも 'cafile' か
     'capath' のどちらかは指定しなければなりません。

     このメソッドは PEM または DER フォーマットの証明書失効リスト
     (CRLs=certification revocation lists)もロードできます。CRLs のため
     に使うには、 *note SSLContext.verify_flags: 135c. を適切に設定しな
     ければなりません。

     'cafile' を指定する場合は、PEM フォーマットで CA 証明書が結合された
     ファイルへのパスを指定してください。このファイル内で証明書をどのよ
     うに編成すれば良いのかについての詳しい情報については、 *note
     証明書: 3c51. の議論を参照してください。

     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: 43d. オブジェクトのどちらかを指定してください。PEM エンコー
     ドの証明書の周囲の余分な行は無視されますが、少なくとも一つの証明書
     が含まれている必要があります。

     バージョン 3.4 で変更: 新しいオプション引数 'cadata' 。

 -- メソッド: SSLContext.get_ca_certs (binary_form=False)

     ロードされた "認証局" (CA=certification authority) 証明書のリストを
     取得します。 ‘binary_form’ 引数が *note False: ef9. である場合、リ
     ストのそれぞれのエントリは *note SSLSocket.getpeercert(): 1366. が
     出力するような辞書になります。True である場合、このメソッドは、DER
     エンコード形式の証明書のリストを返します。返却されるリストには、
     SSL 接続によって証明書がリクエストおよびロードされない限り、
     'capath' からの証明書は含まれません。

          注釈: capath ディレクトリ内の証明書は一度でも使われない限りは
          ロードされません。

     Added in version 3.4.

 -- メソッド: SSLContext.get_ciphers ()

     有効な暗号化のリストを取得します。リストは暗号化優先度順に並びます
     。*note SSLContext.set_ciphers(): 26b. を参照してください。

     以下はプログラム例です:

          >>> 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.get_groups (*, include_aliases=False)

     Get a list of groups implemented for key agreement, taking into
     account the current TLS *note minimum_version: c4a. and *note
     maximum_version: c4b. values.  For example:

          >>> ctx = ssl.create_default_context()
          >>> ctx.minimum_version = ssl.TLSVersion.TLSv1_3
          >>> ctx.maximum_version = ssl.TLSVersion.TLSv1_3
          >>> ctx.get_groups()
          ['secp256r1', 'secp384r1', 'secp521r1', 'x25519', 'x448', ...]

     By default, this method returns only the preferred IANA names for
     the available groups.  However, if the ‘include_aliases’ parameter
     is set to *note True: fd0. this method will also return any
     associated aliases such as the ECDH curve names supported in older
     versions of OpenSSL.

     Added in version 3.15.

 -- メソッド: SSLContext.set_default_verify_paths ()

     デフォルトの "認証局" (CA=certification authority) 証明書を、
     OpenSSL ライブラリがビルドされた際に定義されたファイルシステム上の
     パスからロードします。残念ながらこのメソッドが成功したかどうかを知
     るための簡単な方法はありません: 証明書が見つからなくてもエラーは返
     りません。OpenSSL ライブラリがオペレーティングシステムの一部として
     提供されている際にはどうやら適切に構成できるようですが。

 -- メソッド: SSLContext.set_ciphers (ciphers, /)

     Set the allowed ciphers for sockets created with this context when
     connecting using TLS 1.2 and earlier.  The 'ciphers' argument
     should be a string in the OpenSSL cipher list format(8).  To set
     allowed TLS 1.3 ciphers, use *note SSLContext.set_ciphersuites():
     26a.

     If no cipher can be selected (because compile-time options or other
     configuration forbids use of all the specified ciphers), an *note
     SSLError: 1633. will be raised.

          注釈: When connected, the *note SSLSocket.cipher(): 3b33.
          method of SSL sockets will return details about the negotiated
          cipher.

 -- メソッド: SSLContext.set_ciphersuites (ciphersuites, /)

     Set the allowed ciphers for sockets created with this context when
     connecting using TLS 1.3.  The 'ciphersuites' argument should be a
     colon-separate string of TLS 1.3 cipher names.  If no cipher can be
     selected (because compile-time options or other configuration
     forbids use of all the specified ciphers), an *note SSLError: 1633.
     will be raised.

          注釈: When connected, the *note SSLSocket.cipher(): 3b33.
          method of SSL sockets will return details about the negotiated
          cipher.

     Added in version 3.15.

 -- メソッド: SSLContext.set_groups (groups, /)

     Set the groups allowed for key agreement for sockets created with
     this context.  It should be a string in the OpenSSL group list
     format(9).

          注釈: When connected, the *note SSLSocket.group(): 268. method
          of SSL sockets will return the group used for key agreement on
          that connection.

     Added in version 3.15.

 -- メソッド: SSLContext.set_client_sigalgs (sigalgs, /)

     Set the signature algorithms allowed for certificate-based client
     authentication.  It should be a string in the OpenSSL client
     sigalgs list format(10).

          注釈: When connected, the *note SSLSocket.client_sigalg():
          26f. method of SSL sockets will return the signature algorithm
          used for performing certificate-based client authentication on
          that connection.

     Added in version 3.15.

 -- メソッド: SSLContext.set_server_sigalgs (sigalgs, /)

     Set the signature algorithms allowed for the server to complete the
     TLS handshake.  It should be a string in the OpenSSL sigalgs list
     format(11).

          注釈: When connected, the *note SSLSocket.server_sigalg():
          270. method of SSL sockets will return the signature algorithm
          used by the server to complete the TLS handshake on that
          connection.

     Added in version 3.15.

 -- メソッド: SSLContext.set_alpn_protocols (alpn_protocols)

     SSL/TLS ハンドシェイク時にソケットが提示すべきプロトコルを指定しま
     す。 ‘['http/1.1', 'spdy/2']’ のような推奨順に並べた ASCII 文字列の
     リストでなければなりません。プロトコルの選択は RFC 7301(12) に従い
     ハンドシェイク中に行われます。ハンドシェイクが正常に終了した後、
     *note SSLSocket.selected_alpn_protocol(): 1219. メソッドは合意され
     たプロトコルを返します。

     このメソッドは *note HAS_ALPN: 121a. が ‘False’ の場合 *note
     NotImplementedError: 5a1. を送出します。

     Added in version 3.5.

 -- メソッド: SSLContext.set_npn_protocols (npn_protocols)

     SSL/TLS ハンドシェイク時にソケットが提示すべきプロトコルを指定しま
     す。 ‘['http/1.1', 'spdy/2']’ のような推奨順に並べた文字列のリスト
     でなければなりません。プロトコルの選択は Application Layer Protocol
     Negotiation(13) に従いハンドシェイク中に行われます。ハンドシェイク
     が正常に終了した後、 *note SSLSocket.selected_alpn_protocol():
     1219. メソッドは合意されたプロトコルを返します。

     このメソッドは *note HAS_NPN: 3c36. が ‘False’ の場合 *note
     NotImplementedError: 5a1. を送出します。

     Added in version 3.3.

     バージョン 3.10 で非推奨: NPN has been superseded by ALPN

 -- の属性: SSLContext.sni_callback

     TLS クライアントがサーバ名表示を指定した際の、SSL/TLS サーバによっ
     て TLS Client Hello ハンドシェイクメッセージが受け取られたあとで呼
     び出されるコールバック関数を登録します。サーバ名表示メカニズムは
     RFC 6066(14) セクション 3 - Server Name Indication で述べられていま
     す。

     ‘SSLContext’ ごとに一つだけコールバックをセットできます。
     'sni_callback' を ‘None’ にすればコールバックは無効になります。この
     関数を続けて呼ぶと、以前に登録されたコールバックを上書きします。

     The callback function will be called with three arguments; the
     first being the *note ssl.SSLSocket: cbf, the second is a string
     that represents the server name that the client is intending to
     communicate (or *note None: a6a. if the TLS Client Hello does not
     contain a server name) and the third argument is the original *note
     SSLContext: 33e.  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: cbf. の
     *note SSLSocket.context: 3c4c. 属性を、サーバ名に合致する証明書チェ
     インを持つ新しい *note SSLContext: 33e. オブジェクトに変更すること
     です。

     Due to the early negotiation phase of the TLS connection, only
     limited methods and attributes are usable like *note
     SSLSocket.selected_alpn_protocol(): 1219. and *note
     SSLSocket.context: 3c4c.  The *note SSLSocket.getpeercert(): 1366,
     *note SSLSocket.get_verified_chain(): 1b8e, *note
     SSLSocket.get_unverified_chain(): 1b8f. *note SSLSocket.cipher():
     3b33. and *note SSLSocket.compression(): 1505. 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_*: 3c3f. を返してください。ここ
     にない値を返すと、致命エラー ‘ALERT_DESCRIPTION_INTERNAL_ERROR’ を
     引き起こします。

     'sni_callback' 関数が例外を送出した場合、TLS 接続は TLS の致命的ア
     ラートメッセージ *note ALERT_DESCRIPTION_HANDSHAKE_FAILURE: 3c3e. と
     ともに終了します。

     このメソッドは OpenSSL ライブラリが OPENSSL_NO_TLSEXT を定義してビ
     ルドされている場合、 *note NotImplementedError: 5a1. を送出します。

     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: 1ea4. 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:
     3c3f. 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: 3c2e. オプションも利用でき
     ます。

     Added in version 3.3.

 -- メソッド: SSLContext.set_ecdh_curve (curve_name, /)

     楕円曲線ディフィー・ヘルマン(ECDH)鍵交換の曲線名を指定します。ECDH
     はもとの DH に較べて、ほぼ間違いなく同程度に安全である一方で、顕著
     に高速です。 'curve_name' パラメータは既知の楕円曲線を表す文字列で
     なければなりません。例えば ‘prime256v1’ が広くサポートされている曲
     線です。

     この設定はクライアントソケットには適用されません。さらにセキュリテ
     ィを改善するのに *note OP_SINGLE_ECDH_USE: 3c2f. オプションも利用で
     きます。

     このメソッドは *note HAS_ECDH: 3c34. が ‘False’ の場合は利用できま
     せん。

     Added in version 3.3.

     参考
     ....

     SSL/TLS & Perfect Forward Secrecy(15)

          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: 3c52. (default *note SSLSocket:
     cbf.).  The returned SSL socket is tied to the context, its
     settings and certificates.  'sock' must be a *note SOCK_STREAM:
     16ad. socket; other socket types are unsupported.

     ‘server_side’ 引数は真偽値で、このソケットがサーバサイドとクライア
     ントサイドのどちらの動作をするのかを指定します。

     クライアントサイドソケットにおいて、コンテキストの生成は遅延されま
     す。つまり、低レイヤのソケットがまだ接続されていない場合、コンテキ
     ストの生成はそのソケットの ‘connect()’ メソッドが呼ばれた後に行われ
     ます。サーバサイドソケットの場合、そのソケットに接続先が居なければ
     それは listen 用ソケットだと判断されます。 ‘accept()’ メソッドで生
     成されるクライアント接続に対してのサーバサイド SSLラップは自動的に
     行われます。メソッドは *note SSLError: 1633. を送出することがありま
     す。

     クライアントからの接続では、 'server_hostname' で接続先サービスのホ
     スト名を指定できます。これは HTTP バーチャルホストにかなり似て、シ
     ングルサーバで複数の SSL ベースのサービスを別々の証明書でホストして
     いるようなサーバに対して使えます。 'server_side' が True の場合に
     'server_hostname' を指定すると *note ValueError: 15a. を送出します
     。

     ‘do_handshake_on_connect’ 引数は、 ‘socket.connect()’ の後に自動的
     に SSLハンドシェイクを行うか、それともアプリケーションが明示的に
     *note SSLSocket.do_handshake(): 1221. メソッドを実行するかを指定し
     ます。 ‘SSLSocket.do_handshake()’ を明示的に呼びだすことで、ハンド
     シェイクによるソケットI/Oのブロッキング動作を制御できます。

     ‘suppress_ragged_eofs’ 引数は、 ‘SSLSocket.recv()’ メソッドが、接続
     先から予期しないEOF を受け取った時に通知する方法を指定します。
     *note True: fd0. (デフォルト) の場合、下位のソケットレイヤーから予
     期せぬEOFエラーが来た場合、通常のEOF (空のバイト列オブジェクト)を返
     します。 *note False: ef9. の場合、呼び出し元に例外を投げて通知しま
     す。

     'session', *note session: 1b76. を参照してください。

     To wrap an *note SSLSocket: cbf. in another ‘SSLSocket’, use *note
     SSLContext.wrap_bio(): f45.

     バージョン 3.5 で変更: OpenSSL が SNI をサポートしなくても
     server_hostname を許容するようになりました。

     バージョン 3.6 で変更: 'session' 引数が追加されました。

     バージョン 3.7 で変更: The method returns an instance of *note
     SSLContext.sslsocket_class: 3c52. instead of hard-coded *note
     SSLSocket: cbf.

 -- の属性: SSLContext.sslsocket_class

     The return type of *note SSLContext.wrap_socket(): 938, defaults to
     *note SSLSocket: cbf.  The attribute can be assigned to on
     instances of *note SSLContext: 33e. 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: 3c53. (default *note
     SSLObject: f44.).  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(): 938. での意味と同じ意味を持ちます。

     バージョン 3.6 で変更: 'session' 引数が追加されました。

     バージョン 3.7 で変更: The method returns an instance of *note
     SSLContext.sslobject_class: 3c53. instead of hard-coded *note
     SSLObject: f44.

 -- の属性: SSLContext.sslobject_class

     The return type of *note SSLContext.wrap_bio(): f45, defaults to
     *note SSLObject: f44.  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(16) 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(): 1221.  The context's *note verify_mode:
     3c0e. must be set to *note CERT_OPTIONAL: 3c22. or *note
     CERT_REQUIRED: 3c0f, and you must pass 'server_hostname' to *note
     wrap_socket(): 938. in order to match the hostname.  Enabling
     hostname checking automatically sets ‘verify_mode’ from *note
     CERT_NONE: 3c21. to ‘CERT_REQUIRED’.  It cannot be set back to
     ‘CERT_NONE’ as long as hostname checking is enabled.  The *note
     PROTOCOL_TLS_CLIENT: c4c. 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: 3c0e. is now
     automatically changed to *note CERT_REQUIRED: 3c0f. when hostname
     checking is enabled and ‘verify_mode’ is *note CERT_NONE: 3c21.
     Previously the same operation would have failed with a *note
     ValueError: 15a.

 -- の属性: 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: 3c42. enum member representing the highest
     supported TLS version.  The value defaults to *note
     TLSVersion.MAXIMUM_SUPPORTED: 3c44.  The attribute is read-only for
     protocols other than *note PROTOCOL_TLS: 3c11, *note
     PROTOCOL_TLS_CLIENT: c4c, and *note PROTOCOL_TLS_SERVER: c4d.

     The attributes ‘maximum_version’, *note minimum_version: c4a. and
     *note SSLContext.options: c15. 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: 3c2c. in ‘options’ and ‘maximum_version’ set to
     *note TLSVersion.TLSv1_2: 3c48. will not be able to establish a TLS
     1.2 connection.

     Added in version 3.7.

 -- の属性: SSLContext.minimum_version

     Like *note SSLContext.maximum_version: c4b. except it is the lowest
     supported version or *note TLSVersion.MINIMUM_SUPPORTED: 3c43.

     Added in version 3.7.

 -- の属性: SSLContext.num_tickets

     Control the number of TLS 1.3 session tickets of a *note
     PROTOCOL_TLS_SERVER: c4d. 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: 3c29. ですが、 *note OP_NO_SSLv2: c16. の
     ような他の値をビット OR 演算で指定できます。

     バージョン 3.6 で変更: *note SSLContext.options: c15. は次のように
     *note Options: 3c31. のフラグを返します。

          >>> 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: c4a. and *note
     SSLContext.maximum_version: c4b. 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:
     3c0e. must be set to *note CERT_OPTIONAL: 3c22. or *note
     CERT_REQUIRED: 3c0f, too.  The actual client cert exchange is
     delayed until *note SSLSocket.verify_client_post_handshake(): dfa.
     is called and some I/O is performed.

     Added in version 3.8.

 -- の属性: SSLContext.protocol

     コンテキストの構築時に選択されたプロトコルバージョン。この属性は読
     み出し専用です。

 -- の属性: SSLContext.hostname_checks_common_name

     Whether *note check_hostname: 3c23. 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(17) for the context.
     This attribute is read-only.

     Added in version 3.10.

 -- の属性: SSLContext.verify_flags

     証明書の検証操作のためのフラグです。 *note VERIFY_CRL_CHECK_LEAF:
     135e. などのフラグをビット OR 演算でセットできます。デフォルトでは
     OpenSSL は証明書失効リスト (CRLs) を必要としませんし検証にも使いま
     せん。

     Added in version 3.4.

     バージョン 3.6 で変更: *note SSLContext.verify_flags: 135c. は次の
     ように *note VerifyFlags: 3c26. のフラグを返します。

          >>> ssl.create_default_context().verify_flags
          <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32768>

 -- の属性: SSLContext.verify_mode

     接続先の証明書の検証を試みるかどうか、また、検証が失敗した場合にど
     のように振舞うべきかを制御します。この属性は *note CERT_NONE: 3c21,
     *note CERT_OPTIONAL: 3c22, *note CERT_REQUIRED: 3c0f. のうちどれか
     一つでなければなりません。

     バージョン 3.6 で変更: *note SSLContext.verify_mode: 3c0e. は次のよ
     うに *note VerifyMode: 3c24. 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: 43d. representing the pre-shared key.
     Return a zero length PSK to reject the connection.

     Setting ‘callback’ to *note None: a6a. removes any existing
     callback.

          注釈: When using TLS 1.3:

             - the ‘hint’ parameter is always *note None: a6a.

             - 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: 5a1. if *note
     HAS_PSK: 3c3c. 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: 43d. representing the pre-shared key.  Return a
     zero length PSK to reject the connection.

     Setting ‘callback’ to *note None: a6a. 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: 5a1. if *note
     HAS_PSK: 3c3c. is ‘False’.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) TLS 1.3 protocol will be available with *note PROTOCOL_TLS: 3c11.
in OpenSSL >= 1.1.1.  There is no dedicated PROTOCOL constant for just
TLS 1.3.

   (2) *note SSLContext: 33e. では、デフォルトで *note OP_NO_SSLv2: c16.
によりSSLv2 が無効になっています。

   (3) *note SSLContext: 33e. では、デフォルトで *note OP_NO_SSLv3: c17.
により SSLv3 が無効になっています。

   (4) TLS 1.3 protocol will be available with *note PROTOCOL_TLS: 3c11.
in OpenSSL >= 1.1.1.  There is no dedicated PROTOCOL constant for just
TLS 1.3.

   (5) *note SSLContext: 33e. では、デフォルトで *note OP_NO_SSLv2: c16.
によりSSLv2 が無効になっています。

   (6) *note SSLContext: 33e. では、デフォルトで *note OP_NO_SSLv3: c17.
により SSLv3 が無効になっています。

   (7) 
https://docs.openssl.org/master/man3/SSL_CTX_load_verify_locations/

   (8) https://docs.openssl.org/master/man1/ciphers/

   (9) https://docs.openssl.org/master/man3/SSL_CTX_set1_groups_list/

   (10) 
https://docs.openssl.org/master/man3/SSL_CTX_set1_client_sigalgs_list/

   (11) https://docs.openssl.org/master/man3/SSL_CTX_set1_sigalgs_list/

   (12) https://datatracker.ietf.org/doc/html/rfc7301.html

   (13) 
https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation

   (14) https://datatracker.ietf.org/doc/html/rfc6066.html

   (15) 
https://vincent.bernat.ch/en/blog/2011-ssl-perfect-forward-secrecy

   (16) https://docs.openssl.org/1.1.1/man3/SSL_CTX_sess_number/

   (17) 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.11 証明書
................

証明書を大まかに説明すると、公開鍵/秘密鍵システムの一種です。このシステ
ムでは、各 '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.12 証明書チェイン
........................

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.13 CA 証明書
...................

もし相手から送られてきた証明書の認証をしたい場合、信頼している各発行者の
証明書チェインが入った "CA certs" ファイルを提供する必要があります。繰り
返しますが、このファイルは単純に、各チェインを結合しただけのものです。認
証のために、Pythonはそのファイルの中の最初にマッチしたチェインを利用しま
す。*note SSLContext.load_default_certs(): 1360. を呼び出すことでプラッ
トフォームの証明書ファイルも使われますが、これは *note
create_default_context(): 695. によって自動的に行われます。


File: python.info,  Node: 秘密鍵と証明書の組み合わせ,  Next: 自己署名証明書,  Prev: CA 証明書,  Up: 証明書

5.20.3.14 秘密鍵と証明書の組み合わせ
....................................

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(): 79d. 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.15 自己署名証明書
........................

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.16 使用例
................

* Menu:

* SSLサポートをテストする::
* クライアントサイドの処理::
* サーバサイドの処理::


File: python.info,  Node: SSLサポートをテストする,  Next: クライアントサイドの処理,  Up: 使用例<28>

5.20.3.17 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.18 クライアントサイドの処理
..................................

この例では、自動的に証明書の検証を行うことを含む望ましいセキュリティ設定
でクライアントソケットの 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: c4c. protocol configures the context for
cert validation and hostname verification.  *note verify_mode: 3c0e. is
set to *note CERT_REQUIRED: 3c0f. and *note check_hostname: 3c23. 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:
3c0f. and *note check_hostname: 3c23. 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 セキュリティで考慮すべき点: 3aee. に
関する議論を参照してください。


File: python.info,  Node: サーバサイドの処理,  Prev: クライアントサイドの処理,  Up: 使用例<28>

5.20.3.19 サーバサイドの処理
............................

サーバサイドの処理では、通常、サーバー証明書と秘密鍵がそれぞれファイルに
格納された形で必要です。最初に秘密鍵と証明書が保持されたコンテキストを作
成し、クライアントがあなたの信憑性をチェックできるようにします。そののち
にソケットを開き、ポートにバインドし、そのソケットの ‘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(): 938. メソッドで作ります:

     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 ノンブロッキングモード: 3c15. にし、イベントループを使
うでしょう。)


File: python.info,  Node: ノンブロッキングソケットについての注意事項,  Next: Memory BIO support,  Prev: 使用例<28>,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.20 ノンブロッキングソケットについての注意事項
....................................................

SSL ソケットはノンブロッキングモードにおいては、普通のソケットとは少し違
った振る舞いをします。ですのでノンブロッキングソケットとともに使う場合、
いくつか気をつけなければならない事項があります:

   - ほとんどの *note SSLSocket: cbf. のメソッドは I/O 操作がブロックす
     ると *note BlockingIOError: 4ca. ではなく *note SSLWantWriteError:
     121e. か *note SSLWantReadError: 121d. のどちらかを送出します。
     ‘SSLWantReadError’ は下層のソケットで読み出しが必要な場合に送出され
     、 ‘SSLWantWriteError’ は下層のソケットで書き込みが必要な場合に送出
     されます。SSL ソケットに対して '書き込み' を試みると下層のソケット
     から最初に '読み出す' 必要があるかもしれず、SSL ソケットに対して '読
     み出し' を試みると下層のソケットに先に '書き込む' 必要があるかもし
     れないことに注意してください。

     バージョン 3.5 で変更: 以前の Python バージョンでは、
     ‘SSLSocket.send()’ メソッドは *note SSLWantWriteError: 121e. または
     *note SSLWantReadError: 121d. を送出するのではなく、ゼロを返してい
     ました。

   - *note select(): 115d. 呼び出しは OS レベルでのソケットが読み出し可
     能(または書き込み可能)になったことを教えてくれますが、上位の SSL レ
     イヤーでの十分なデータがあることを意味するわけではありません。例え
     ば、SSL フレームの一部が届いただけかもしれません。ですから、
     ‘SSLSocket.recv()’ と ‘SSLSocket.send()’ の失敗を処理することに備え
     、ほかの ‘select()’ 呼び出し後にリトライしなければなりません。

   - 反対に、SSL レイヤーは独自の枠組みを持っているため、*note select():
     115d. が気付かない読み出し可能なデータを SSL ソケットが持っている場
     合があります。したがって、入手可能な可能性のあるデータをすべて引き
     出すために最初に ‘SSLSocket.recv()’ を呼び出し、次にそれでもまだ必
     要な場合にだけ ‘select()’ 呼び出しでブロックすべきです。

     (当然のことながら、ほかのプリミティブ、例えば *note poll(): 274. や
     *note selectors: ca. モジュール内のものを使う際にも似た但し書きが付
     きます)

   - SSL ハンドシェイクそのものがノンブロッキングになります: *note
     SSLSocket.do_handshake(): 1221. メソッドは成功するまでリトライしな
     ければなりません。 *note select(): 115d. を用いてソケットの準備が整
     うのを待つためには、およそ以下のようにします:

          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:
3c15. and provides a higher level *note Streams API: 19d0.  It polls for
events using the *note selectors: ca. module and handles *note
SSLWantWriteError: 121e, *note SSLWantReadError: 121d. and *note
BlockingIOError: 4ca. 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.21 Memory BIO support
............................

Added in version 3.5.

Python 2.6 で SSL モジュールが導入されて以降、*note SSLSocket: cbf. クラ
スは、以下の互いに関連するが別々の機能を提供してきました。

   - SSL プロトコル処理

   - ネットワーク IO

ネットワーク IO API は、*note socket.socket: 115e. が提供するものと同じ
です。*note SSLSocket: cbf. も、そのクラスから継承しています。これにより
、SSL ソケットは標準のソケットをそっくりそのまま置き換えるものとして使用
できるため、既存のアプリケーションを SSL に対応させるのが非常に簡単にな
ります。

SSL プロトコルの処理とネットワーク IO を組み合わせた場合、通常は問題なく
動作しますが、問題が発生する場合があります。一例を挙げると、非同期 IO フ
レームワークが別の多重化モデルを使用する場合、これは *note
socket.socket: 115e. と内部 OpenSSL ソケット IO ルーティンが想定する「フ
ァイル記述子上の select/poll」モデル（準備状態ベース）とは異なります。こ
れは、このモデルが非効率的になる Windows などのプラットフォームに主に該
当します。そのため、スコープを限定した *note SSLSocket: cbf. の変種、
*note SSLObject: f44. が提供されています。

 -- クラス: ssl.SSLObject

     ネットワーク IO メソッドを含まない SSL プロトコルインスタンスを表す
     、スコープを限定した *note SSLSocket: cbf. の変種です。一般的にこ、
     のクラスを使用するのは、メモリバッファを通じて SSL のための非同期
     IO を実装するフレームワーク作成者です。

     このクラスは、OpenSSL が実装する低水準 SSL オブジェクトの上にインタ
     ーフェースを実装します。このオブジェクトは SSL 接続の状態をキャプチ
     ャしますが、ネットワーク IO 自体は提供しません。IO は、OpenSSL の
     IO 抽象レイヤである別の「BIO」オブジェクトを通じて実行する必要があ
     ります。

     このクラスには公開されたコンストラクタがありません。*note
     SSLObject: f44. インスタンスは、 *note wrap_bio(): f45. メソッドを
     使用して作成しなければなりません。このメソッドは、‘SSLObject’ イン
     スタンスを作成し、2 つの BIO に束縛します。'incoming' BIO は、
     Python から SSL プロトコルインスタンスにデータを渡すために使用され
     、'outgoing' BIO は、データを反対向きに渡すために使用されます。

     次のメソッドがサポートされています:

        - *note context: 3c4c.

        - *note server_side: 3c4e.

        - *note server_hostname: f42.

        - *note session: 1b76.

        - *note session_reused: 3c4f.

        - *note read(): 1222.

        - *note write(): 1223.

        - *note getpeercert(): 1366.

        - *note get_verified_chain(): 1b8e.

        - *note get_unverified_chain(): 1b8f.

        - *note selected_alpn_protocol(): 1219.

        - *note selected_npn_protocol(): c4e.

        - *note cipher(): 3b33.

        - *note shared_ciphers(): 1220.

        - *note compression(): 1505.

        - *note pending(): 3c4d.

        - *note do_handshake(): 1221.

        - *note verify_client_post_handshake(): dfa.

        - *note unwrap(): 3c4b.

        - *note get_channel_binding(): 1504.

        - *note version(): 121c.

     *note SSLSocket: cbf. と比較すると、このオブジェクトでは以下の機能
     が不足しています。

        - Any form of network IO; ‘recv()’ and ‘send()’ read and write
          only to the underlying *note MemoryBIO: 1216. buffers.

        - 'do_handshake_on_connect' 機構はありません。必ず手動で *note
          do_handshake(): 1221. を呼んで、ハンドシェイクを開始する必要が
          あります。

        - 'suppress_ragged_eofs' は処理されません。プロトコルに違反する
          ファイル末尾状態は、 *note SSLEOFError: 1924. 例外を通じて報告
          されます。

        - *note unwrap(): 3c4b. メソッドの呼び出しは、下層のソケットを返
          す SSL ソケットとは異なり、何も返しません。

        - *note SSLContext.set_servername_callback(): 1365. に渡される
          'server_name_callback' コールバックは、1 つ目の引数として
          *note SSLSocket: cbf. インスタンスではなく *note SSLObject:
          f44. インスタンスを受け取ります。

     *note SSLObject: f44. の使用に関する注意:

        - *note SSLObject: f44. 上のすべての IO は *note non-blocking:
          3c15. です。例えば、*note read(): 1222. は入力 BIO が持つデー
          タよりも多くのデータを必要とする場合、*note SSLWantReadError:
          121d. を送出します。

     バージョン 3.7 で変更: ‘SSLObject’ instances must be created with
     *note wrap_bio(): f45.  In earlier versions, it was possible to
     create instances directly.  This was never documented or officially
     supported.

SSLObject は、メモリバッファを使用して外界と通信します。*note MemoryBIO:
1216. クラスは、以下のように 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(): 3c68. を呼ぶことはできません。*note
          eof: 3c66. 属性は、バッファ内のすべてのデータが読み出された後
          に True になります。


File: python.info,  Node: SSL セッション,  Next: セキュリティで考慮すべき点<3>,  Prev: Memory BIO support,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.22 SSL セッション
........................

Added in version 3.6.

 -- クラス: ssl.SSLSession

     *note session: 1b76. が使用するセッションオブジェクトです。

      -- の属性: 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.23 セキュリティで考慮すべき点
....................................

* Menu:

* 最善のデフォルト値::
* 手動での設定::
* マルチプロセス化::


File: python.info,  Node: 最善のデフォルト値,  Next: 手動での設定,  Up: セキュリティで考慮すべき点<3>

5.20.3.24 最善のデフォルト値
............................

'クライアントでの使用' では、セキュリティポリシーによる特殊な要件がない
限りは、 *note create_default_context(): 695. 関数を使用して SSL コンテ
キストを作成することを強くお勧めします。この関数は、システムの信頼済み
CA 証明書をロードし、証明書の検証とホスト名のチェックを有効化し、十分に
セキュアなプロトコルと暗号を選択しようとします。

例として、 *note smtplib.SMTP: cfe. クラスを使用して 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(): 79d. によって追加できます。

対照的に、自分自身で *note SSLContext: 33e. クラスのコンストラクタを呼び
出すことによって SSL コンテキストを作ると、デフォルトでは証明書検証もホ
スト名チェックも有効になりません。自分で設定を行う場合は、十分なセキュリ
ティレベルを達成するために、以下のパラグラフをお読みください。


File: python.info,  Node: 手動での設定,  Next: マルチプロセス化,  Prev: 最善のデフォルト値,  Up: セキュリティで考慮すべき点<3>

5.20.3.25 手動での設定
......................

* Menu:

* 証明書の検証::
* プロトコルのバージョン::
* 暗号の選択::


File: python.info,  Node: 証明書の検証,  Next: プロトコルのバージョン,  Up: 手動での設定

5.20.3.26 証明書の検証
......................

When calling the *note SSLContext: 33e. constructor directly, *note
CERT_NONE: 3c21. 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: 3c0f.  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(): 1366, 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: 3c23. is enabled.

バージョン 3.7 で変更: Hostname matchings is now performed by OpenSSL.
Python no longer uses ‘match_hostname()’.

サーバモードにおいて、(より上位のレベルでの認証メカニズムではなく) SSL レ
イヤーを使ってあなたのクライアントを認証したいならば、 *note
CERT_REQUIRED: 3c0f. を指定して同じようにクライアントの証明書を検証すべ
きでしょう。


File: python.info,  Node: プロトコルのバージョン,  Next: 暗号の選択,  Prev: 証明書の検証,  Up: 手動での設定

5.20.3.27 プロトコルのバージョン
................................

SSL バージョン 2 と 3 は安全性に欠けると考えられており、使用するのは危険
です。クライアントとサーバ間の互換性を最大限に確保したい場合、プロトコル
バージョンとして *note PROTOCOL_TLS_CLIENT: c4c. または *note
PROTOCOL_TLS_SERVER: c4d. を使用してください。 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: c4c. 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.28 暗号の選択
....................

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(): 26b. 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(): 10a0. 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.29 マルチプロセス化
..........................

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(): 6c3.  Any successful call of *note RAND_add(): 3c1b. or *note
RAND_bytes(): 937. is sufficient.


File: python.info,  Node: TLS 1 3,  Prev: セキュリティで考慮すべき点<3>,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.30 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.  To restrict which
     TLS 1.3 ciphers are allowed, the *note
     SSLContext.set_ciphersuites(): 26a. method should be called instead
     of *note SSLContext.set_ciphers(): 26b, which only affects ciphers
     in older TLS versions.  The *note SSLContext.get_ciphers(): 10a0.
     method returns information about ciphers for both TLS 1.3 and
     earlier versions and the method *note SSLSocket.cipher(): 3b33.
     returns information about the negotiated cipher for both TLS 1.3
     and earlier versions once a connection is established.

   - Session tickets are no longer sent as part of the initial handshake
     and are handled differently.  *note SSLSocket.session: 1b76. and
     *note SSLSession: 109f. 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,
     and rekeying are not supported yet.

参考
....

*note socket.socket: 115e. クラス

     下位レイヤーの *note socket: d4. クラスのドキュメント

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: ca. 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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

このモジュールは以下を定義します:

 -- 例外: select.error

     *note OSError: 543. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 543. のエイリアスになりました。

 -- の関数: select.devpoll ()

     Returns a ‘/dev/poll’ polling object; see section *note /dev/poll
     polling objects: 3c7b. below for the methods supported by devpoll
     objects.

     ‘devpoll()’ オブジェクトはインスタンス化時に許されるファイル記述子
     の数にリンクされます。プログラムがこの値を減らす場合 ‘devpoll()’ は
     失敗します。プログラムがこの値を増やす場合 ‘devpoll()’ は有効なファ
     イル記述子の不完全なリストを返すことがあります。

     新しいファイル記述子は *note 継承不可: 12ad. です。

     Added in version 3.3.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

     *note Availability: 234c.: 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(2)(2)’ 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: 3c7c. 節を参照して
     ください。

     ‘epoll’ オブジェクトはコンテキストマネジメントプロトコルをサポート
     しています。 *note with: 215. 文内で使用された場合、新たなファイル
     記述子はブロックの最後で自動的に閉じられます。

     新しいファイル記述子は *note 継承不可: 12ad. です。

     バージョン 3.3 で変更: 'flags' 引数が追加されました。

     バージョン 3.4 で変更: *note with: 215. 文のサポートが追加されまし
     た。新しいファイル記述子が継承不可になりました。

     バージョン 3.4 で非推奨: 'flags' パラメータ。 現在ではデフォルトで
     ‘select.EPOLL_CLOEXEC’ が使われます。 ファイルディスクリプタを継承
     可能にするには *note os.set_inheritable(): 12af. を使ってください。

     バージョン 3.15 で変更: When CPython is built, this function may be
     disabled using *note -disable-epoll: 195b.

     *note Availability: 234c.: 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: 3c7d. below for the
     methods supported by polling objects.

     *note Availability: 234c.: Unix.

 -- の関数: select.kqueue ()

     Returns a kernel queue object; see section *note Kqueue objects:
     3c7e. below for the methods supported by kqueue objects.

     新しいファイル記述子は *note 継承不可: 12ad. です。

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

     *note Availability: 234c.: 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:
     3c80. below for the methods supported by kevent objects.

     *note Availability: 234c.: 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(): 19d2. 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 in seconds; it may be a non-integer to specify fractions
     of 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
     ファイルオブジェクト: 1581. (例えば ‘sys.stdin’ や、 *note open():
     333. または *note os.popen(): 58c. が返すオブジェクト)、 *note
     socket.socket(): 115e. が返すソケットオブジェクトです。 'ラッパー
     <wrapper>' クラスを自分で定義することもできます。この場合、適切な
     (まったくデタラメな数ではなく本物のファイル記述子を返す) *note
     fileno(): 19d2. メソッドを持つ必要があります。

          注釈: 
          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: 1145. を上げる代わりに再計算されたタイムア
     ウトによってリトライするようになりました。ただし、シグナルハンドラ
     が例外を起こした場合を除きます (この論理的根拠については PEP 475(3)
     を見てください)。

     バージョン 3.15 で変更: Accepts any real number as 'timeout', not
     only integer or float.

 -- データ: 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(): 115d, ‘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: 234c.: 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://manpages.debian.org/epoll_create1(2)

   (3) 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(): 274. メソッド呼び出しでは、そのファイル記述子に処理待
     ち中の I/O イベントがあるかどうかを監視します。 'fd' は整数か、整数
     値を返す *note fileno(): 19d2. メソッドを持つオブジェクトを取ります
     。ファイルオブジェクトも ‘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(): 3c84. followed by a *note
     register(): 3c82.  It is (a bit) more efficient than doing the same
     explicitly.

 -- メソッド: devpoll.unregister (fd)

     ポーリングオブジェクトによって追跡中のファイル記述子を登録解除しま
     す。 *note register(): 3c82. メソッドと同様に、 'fd' は整数か、整数
     値を返す *note fileno(): 19d2. メソッドを持つオブジェクトを取ります
     。

     登録されていないファイル記述子の削除を試みるのは安全に無視されます
     。

 -- メソッド: devpoll.poll ([timeout])

     登録されたファイル記述子に対してポーリングを行い、報告すべき I/O イ
     ベントまたはエラーの発生したファイル記述子毎に 2 要素のタプル ‘(fd,
     event)’ からなるリストを返します。リストは空になることもあります。
     'fd' はファイル記述子で、 'event' は該当するファイル記述子について
     報告されたイベントを表すビットマスクです -- 例えば ‘POLLIN’ は入力
     待ちを示し、 ‘POLLOUT’ はファイル記述子に対する書き込みが可能を示す
     、などです。空のリストは呼び出しがタイムアウトしたか、報告すべきイ
     ベントがどのファイル記述子でも発生しなかったことを示します。
     'timeout' が与えられた場合、処理を戻すまで待機する時間の長さをミリ
     秒単位で指定します。 'timeout' が省略されたり、 -1 であったり、ある
     いは *note None: a6a. の場合、そのポーリングオブジェクトが監視して
     いる何らかのイベントが発生するまでブロックします。

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: 1145. を上げる代わりに再計算されたタイムア
     ウトによってリトライするようになりました。ただし、シグナルハンドラ
     が例外を起こした場合を除きます (この論理的根拠については PEP 475(1)
     を見てください)。

     バージョン 3.15 で変更: Accepts any real number as 'timeout', not
     only integer or float.

   ---------- 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: d29. error.

 -- メソッド: epoll.poll (timeout=None, maxevents=-1)

     Wait for events.  If 'timeout' is given, it specifies the length of
     time in seconds (may be non-integer) which the system will wait for
     events before returning.

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: 1145. を上げる代わりに再計算されたタイムア
     ウトによってリトライするようになりました。ただし、シグナルハンドラ
     が例外を起こした場合を除きます (この論理的根拠については PEP 475(1)
     を見てください)。

     バージョン 3.15 で変更: Accepts any real number as 'timeout', not
     only integer or float.

   ---------- 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(): 274. メソッド呼び出しでは、そのファイル記述子に処理待
     ち中の I/O イベントがあるかどうかを監視します。 'fd' は整数か、整数
     値を返す *note fileno(): 19d2. メソッドを持つオブジェクトを取ります
     。ファイルオブジェクトも ‘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: 543. 例外が発生します。

 -- メソッド: poll.unregister (fd)

     ポーリングオブジェクトによって追跡中のファイル記述子を登録解除しま
     す。 *note register(): 3c8c. メソッドと同様に、 'fd' は整数か、整数
     値を返す *note fileno(): 19d2. メソッドを持つオブジェクトを取ります
     。

     登録されていないファイル記述子を登録解除しようとすると *note
     KeyError: 7e5. 例外が送出されます。

 -- メソッド: poll.poll ([timeout])

     登録されたファイル記述子に対してポーリングを行い、報告すべき I/O イ
     ベントまたはエラーの発生したファイル記述子毎に 2 要素のタプル ‘(fd,
     event)’ からなるリストを返します。リストは空になることもあります。
     'fd' はファイル記述子で、 'event' は該当するファイル記述子について
     報告されたイベントを表すビットマスクです -- 例えば ‘POLLIN’ は入力
     待ちを示し、 ‘POLLOUT’ はファイル記述子に対する書き込みが可能を示す
     、などです。空のリストは呼び出しがタイムアウトしたか、報告すべきイ
     ベントがどのファイル記述子でも発生しなかったことを示します。
     'timeout' が与えられた場合、処理を戻すまで待機する時間の長さをミリ
     秒単位で指定します。 'timeout' が省略されたり、負の値であったり、あ
     るいは *note None: a6a. の場合、そのポーリングオブジェクトが監視し
     ている何らかのイベントが発生するまでブロックします。

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: 1145. を上げる代わりに再計算されたタイムア
     ウトによってリトライするようになりました。ただし、シグナルハンドラ
     が例外を起こした場合を除きます (この論理的根拠については PEP 475(1)
     を見てください)。

     バージョン 3.15 で変更: Accepts any real number as 'timeout', not
     only integer or float.  If ‘ppoll()’ function is available,
     'timeout' has a resolution of ‘1’ ns (‘1e-6’ ms) instead of ‘1’ ms.

   ---------- 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 (non-integers are possible); the default is
          ‘None’, to wait forever

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: 1145. を上げる代わりに再計算されたタイムア
     ウトによってリトライするようになりました。ただし、シグナルハンドラ
     が例外を起こした場合を除きます (この論理的根拠については PEP 475(1)
     を見てください)。

     バージョン 3.15 で変更: Accepts any real number as 'timeout', not
     only integer or float.

   ---------- 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(): 19d2. メソッドを持ったオブジェクトを渡せます。
     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/main/Lib/selectors.py


File: python.info,  Node: はじめに<11>,  Next: クラス<4>,  Up: selectors --- 高水準の I/O 多重化

5.20.5.1 はじめに
.................

このモジュールにより、*note select: c9. モジュールプリミティブに基づく高
水準かつ効率的な I/O の多重化が行えます。OS 水準のプリミティブを使用した
正確な制御を求めない限り、このモジュールの使用が推奨されます。

このモジュールは *note BaseSelector: 3c9e. 抽象基底クラスと、いくつかの
具象実装 (*note KqueueSelector: 3b6f, *note EpollSelector: f99...)  を定
義しており、これらは複数のファイルオブジェクトの I/O の準備状況の通知の
待機に使用できます。以下では、 "ファイルオブジェクト" は、*note
fileno(): 19d2. メソッドを持つあらゆるオブジェクトか、あるいは Raw ファ
イル記述子を意味します。*note ファイルオブジェクト: 1581. を参照してくだ
さい。

*note DefaultSelector: 3c9f. は、現在のプラットフォームで利用できる、も
っとも効率的な実装の別名になります: これはほとんどのユーザーにとってのデ
フォルトの選択になるはずです。

     注釈: プラットフォームごとにサポートされているファイルオブジェクト
     のタイプは異なります: Windows ではソケットはサポートされますが、パ
     イプはされません。Unix では両方がサポートされます (その他の fifo や
     スペシャルファイルデバイスなどのタイプもサポートされます)。

参考
....

*note select: c9.

     低水準の I/O 多重化モジュールです。

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。


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: 3ca3. はそれの下層のファイルディスクリプタ、選択
     したイベントマスク、および付属データへのファイルオブジェクトの関連
     付けに使用される *note namedtuple: 1da. です。いくつかの *note
     BaseSelector: 3c9e. メソッドを返します。

      -- の属性: fileobj

          登録されたファイルオブジェクトです。

      -- の属性: fd

          下層のファイル記述子です。

      -- の属性: events

          このファイルオブジェクトで待機しなければならないイベントです。

      -- の属性: data

          このファイルオブジェクトに関連付けられたオプションの不透明型
          (Opaque) データです。例えば、これはクライアントごとのセッショ
          ン ID を格納するために使用できます。

 -- クラス: selectors.BaseSelector

     *note BaseSelector: 3c9e. は複数のファイルオブジェクトの I/O イベン
     トの準備状況の待機に使用されます。これはファイルストリームを登録、
     登録解除、およびこれらのストリームでの I/O イベントを待機 (オプショ
     ンでタイムアウト) するメソッドをサポートします。これは抽象基底クラ
     スであるため、インスタンスを作成できません。使用する実装を明示的に
     指定したい、そしてプラットフォームがそれをサポートしている場合は、
     代わりに *note DefaultSelector: 3c9f. を使用するか、*note
     SelectSelector: 3b6c. や *note KqueueSelector: 3b6f. などの一つを使
     用します。‘BaseSelector’ とその具象実装は *note
     コンテキストマネージャー: 47f. プロトコルをサポートしています。

      -- メソッド: abstractmethod register (fileobj, events, data=None)

          I/O イベントを監視するファイルオブジェクトをセレクションに登録
          します。

          'fileobj' は監視するファイルオブジェクトです。これは整数のファ
          イル記述子か、‘fileno()’ メソッドを持つオブジェクトのどちらか
          になります。'events' は監視するイベントのビット幅マスクになり
          ます。'data' は不透明型 (Opaque) オブジェクトです。

          これは新しい *note SelectorKey: 3ca3. インスタンスを返します。
          不正なイベントマスク化ファイル記述子のときは *note ValueError:
          15a. が、ファイルオブジェクトがすでに登録済みのときは *note
          KeyError: 7e5. が送出されます。

      -- メソッド: abstractmethod unregister (fileobj)

          ファイルオブジェクトのセレクション登録を解除し、監視対象から外
          します。ファイルオブジェクトの登録解除はそのクローズより前に行
          われます。

          'fileobj' は登録済みのファイルオブジェクトでなければなりません
          。

          関連付けられた *note SelectorKey: 3ca3. インスタンスを返します
          。'fileobj' が登録されていない場合 *note KeyError: 7e5. を送出
          します。'fileobj' が不正な場合 (例えば 'fileobj' に ‘fileno()’
          メソッドが無い場合や ‘fileno()’ メソッドの戻り値が不正な場合)
          *note ValueError: 15a. を送出します。

      -- メソッド: modify (fileobj, events, data=None)

          登録されたファイルオブジェクトの監視されたイベントや付属データ
          を変更します。

          より効率的に実装できる点を除けば、
          ‘BaseSelector.unregister(fileobj)’ に続けて
          ‘BaseSelector.register(fileobj, events, data)’ を行うのと等価
          です。

          新たな *note SelectorKey: 3ca3. インスタンスを返します。 イベ
          ントマスクやファイル記述子が不正な場合は *note ValueError:
          15a. を、ファイルオブジェクトが登録されていない場合は *note
          KeyError: 7e5. を送出します。

      -- メソッド: abstractmethod select (timeout=None)

          登録されたいくつかのファイルオブジェクトが準備できたか、タイム
          アウトするまで待機します。

          ‘timeout > 0’ の場合、最大待機時間を秒で指定します。 ‘timeout
          <= 0’ の場合、この関数の呼び出しはブロックせず、 現在準備でき
          ているファイルオブジェクトを報告します。 'timeout' が ‘None’ の
          場合、監視しているファイルオブジェクトの一つが準備できるまでブ
          ロックします。

          この関数は ‘(key, events)’ タプルのリストを返します。準備でき
          たファイルオブジェクトにつき1タプルです。

          'key' は準備状態のファイルオブジェクトに対応する *note
          SelectorKey: 3ca3. インスタンスです。 'events' はそのファイル
          オブジェクトで準備が完了したイベントのビットマスクです。

               注釈: このメソッドは、現在のプロセスで信号を受信した場合
               、どのファイルオブジェクトも準備完了にならないうちに、ま
               たはタイムアウトが経過する前に返ることがあります。その場
               合、空のリストが返されます。

          バージョン 3.5 で変更: このセレクタは、シグナルによって中断さ
          れた時に、シグナルハンドラが例外を起こさなかった場合、空のイベ
          ントリストを返すのではなく、再計算されたタイムアウトによってリ
          トライするようになりました (この論拠については PEP 475(1) を参
          照してください)。

      -- メソッド: close ()

          セレクタを閉じます。

          下層のリソースがすべて解放されたことを確かめるために呼ばれなけ
          ればなりません。一旦閉じられたセレクタは使ってはいけません。

      -- メソッド: get_key (fileobj)

          登録されたファイルオブジェクトに関連付けられたキーを返します。

          そのファイルオブジェクトに関連付けられた *note SelectorKey:
          3ca3. インスタンスを返します。そのファイルオブジェクトが登録さ
          れていない場合 *note KeyError: 7e5. を送出します。

      -- メソッド: abstractmethod get_map ()

          ファイルオブジェクトからセレクタキーへのマッピングを返します。

          これは、登録済みのファイルオブジェクトを、それらに関連づけられ
          た *note SelectorKey: 3ca3. インスタンスにマッピングする *note
          Mapping: ca0. のインスタンスを返します。

 -- クラス: selectors.DefaultSelector

     デフォルトの selector クラスで、現在のプラットフォームで利用できる
     最も効率的な実装を使用しています。大半のユーザはこれをデフォルトに
     すべきです。

 -- クラス: selectors.SelectSelector

     *note select.select(): 115d. を基底とするセレクタです。

 -- クラス: selectors.PollSelector

     *note select.poll(): 274. を基底とするセレクタです。

 -- クラス: selectors.EpollSelector

     *note select.epoll(): 1342. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.epoll(): 1342. オブジェクトが使用している
          ファイル記述子を返します。

 -- クラス: selectors.DevpollSelector

     *note select.devpoll(): 1344. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.devpoll(): 1344. オブジェクトが使用してい
          るファイル記述子を返します。

     Added in version 3.5.

 -- クラス: selectors.KqueueSelector

     *note select.kqueue(): 275. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.kqueue(): 275. オブジェクトが使用している
          ファイル記述子を返します。

   ---------- 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:

* 一般的なルール::
* モジュールの内容: モジュールの内容<4>.
* 使用例: 使用例<30>.
* Note on SIGPIPE::
* Note on Signal Handlers and Exceptions::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/signal.py


File: python.info,  Node: 一般的なルール,  Next: モジュールの内容<4>,  Up: signal --- 非同期イベントにハンドラーを設定する

5.20.6.1 一般的なルール
.......................

*note signal.signal(): 14f5. 関数を使って、シグナルを受信した時に実行さ
れるハンドラを定義することができます。 Python は標準でごく少数のシグナル
ハンドラをインストールしています: *note SIGPIPE: 3cb6. は無視され (した
がって、 pipe や socket に対する書き込みで生じたエラーは通常の Python 例
外として報告されます)、 *note SIGINT: 4e6. は *note KeyboardInterrupt:
d9a. 例外に変換されます。親プロセスが変更していない場合は、これらはどれ
も上書きすることができます。

特定のシグナルに対するハンドラが一度設定されると、明示的にリセットしない
かぎり設定されたままになります (Python は背後の実装系に関係なく BSD 形式
のインターフェースをエミュレートします)。例外は *note SIGCHLD: 3356. の
ハンドラで、この場合は背後の実装系の仕様に従います。

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: 3cb8. to execute the corresponding
Python signal handler at a later point (for example, at the next *note
bytecode: 6b9. instruction).  This has consequences:

   * It makes little sense to catch synchronous errors like *note
     SIGFPE: 1438. or *note SIGSEGV: 1437. 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: 5b. 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: 2900. for a
     discussion.


File: python.info,  Node: シグナルとスレッド,  Prev: Python のシグナルハンドラの実行,  Up: 一般的なルール

5.20.6.3 シグナルとスレッド
...........................

Python のシグナルハンドラは、もしシグナルを受け取ったのが別のスレッドだ
ったとしても、常にメインインタープリターの Python のメインスレッドで実行
されます。このためシグナルをスレッド間通信に使うことはできません。代わり
に *note threading: f6. モジュールが提供している同期プリミティブを利用で
きます。

また、メインインタープリターのメインスレッドだけが新しいシグナルハンドラ
を登録できます。

     警告: Synchronization primitives such as *note threading.Lock:
     1a30. should not be used within signal handlers.  Doing so can lead
     to unexpected deadlocks.


File: python.info,  Node: モジュールの内容<4>,  Next: 使用例<30>,  Prev: 一般的なルール,  Up: signal --- 非同期イベントにハンドラーを設定する

5.20.6.4 モジュールの内容
.........................

バージョン 3.5 で変更: signal (SIG*), handler (*note SIG_DFL: 1dcb,
*note SIG_IGN: 1dca.) and sigmask (*note SIG_BLOCK: 3cbc, *note
SIG_UNBLOCK: 3cbd, *note SIG_SETMASK: 3cbe.) related constants listed
below were turned into *note enums: 10a1. (*note Signals: 3cbf, *note
Handlers: 3cc0. and *note Sigmasks: 3cc1. respectively).  *note
getsignal(): 1c4c, *note pthread_sigmask(): 14f1, *note sigpending():
14f3. and *note sigwait(): 14f4. functions return human-readable ‘enums’
as ‘Signals’ objects.

The signal module defines three enums:

 -- クラス: signal.Signals

     *note enum.IntEnum: 10a1. collection of SIG* constants and the
     CTRL_* constants.

     Added in version 3.5.

 -- クラス: signal.Handlers

     *note enum.IntEnum: 10a1. collection of the constants *note
     SIG_DFL: 1dcb. and *note SIG_IGN: 1dca.

     Added in version 3.5.

 -- クラス: signal.Sigmasks

     *note enum.IntEnum: 10a1. collection of the constants *note
     SIG_BLOCK: 3cbc, *note SIG_UNBLOCK: 3cbd. and *note SIG_SETMASK:
     3cbe.

     *note Availability: 234c.: 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: 3cc2. に対する標準の動作はコアダンプと終了で、 *note
     SIGCHLD: 3356. に対する標準の動作は単にシグナルの無視です。

 -- データ: signal.SIG_IGN

     もう一つの標準シグナル処理オプションで、受け取ったシグナルを単に無
     視します。

 -- データ: signal.SIGABRT

     Abort signal from ‘abort(3)(3)’.

 -- データ: signal.SIGALRM

     Timer signal from ‘alarm(2)(4)’.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGBREAK

     Interrupt from keyboard (CTRL + BREAK).

     *note Availability: 234c.: Windows.

 -- データ: signal.SIGBUS

     Bus error (bad memory access).

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGCHLD

     Child process stopped or terminated.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGCLD

     *note SIGCHLD: 3356. のエイリアスです。

     *note Availability: 234c.: not macOS.

 -- データ: signal.SIGCONT

     Continue the process if it is currently stopped

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGFPE

     Floating-point exception.  For example, division by zero.

     参考
     ....

     *note ZeroDivisionError: d15. 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: 234c.: Unix.

 -- データ: signal.SIGILL

     Illegal instruction.

 -- データ: signal.SIGINT

     Interrupt from keyboard (CTRL + C).

     Default action is to raise *note KeyboardInterrupt: d9a.

 -- データ: signal.SIGKILL

     Kill signal.

     It cannot be caught, blocked, or ignored.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGPIPE

     Broken pipe: write to pipe with no readers.

     Default action is to ignore the signal.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGPROF

     Profiling timer expired.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGQUIT

     Terminal quit signal.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGSEGV

     Segmentation fault: invalid memory reference.

 -- データ: signal.SIGSTOP

     Stop executing (cannot be caught or ignored).

     *note Availability: 234c.: 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: 234c.: 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: 234c.: Unix.

 -- データ: signal.SIGUSR2

     User-defined signal 2.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGVTALRM

     Virtual timer expired.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGWINCH

     Window resize signal.

     *note Availability: 234c.: Unix.

 -- データ: signal.SIGXCPU

     CPU time limit exceeded.

     *note Availability: 234c.: Unix.

 -- データ: SIG*

     All the signal numbers are defined symbolically.  For example, the
     hangup signal is defined as *note signal.SIGHUP: 3cc6.; 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(): 1721. でだけ利用できます。

     *note Availability: 234c.: Windows.

     Added in version 3.2.

 -- データ: signal.CTRL_BREAK_EVENT

     ‘CTRL’+‘BREAK’ キーストロークに該当するシグナル。このシグナルは
     *note os.kill(): 1721. でだけ利用できます。

     *note Availability: 234c.: Windows.

     Added in version 3.2.

 -- データ: signal.NSIG

     One more than the number of the highest signal number.  Use *note
     valid_signals(): 3cce. to get valid signal numbers.

 -- データ: signal.ITIMER_REAL

     実時間でデクリメントするインターバルタイマーです。タイマーが発火し
     たときに *note SIGALRM: 3cc3. を送ります。

 -- データ: signal.ITIMER_VIRTUAL

     プロセスの実行時間だけデクリメントするインターバルタイマーです。タ
     イマーが発火したときに *note SIGVTALRM: 3ccb. を送ります。

 -- データ: signal.ITIMER_PROF

     プロセスの実行中と、システムがそのプロセスのために実行している時間
     だけデクリメントするインターバルタイマーです。ITIMER_VIRTUAL と組み
     合わせて、このタイマーはよくアプリケーションがユーザー空間とカーネ
     ル空間で消費した時間のプロファイリングに利用されます。タイマーが発
     火したときに *note SIGPROF: 3cc7. を送ります。

 -- データ: signal.SIG_BLOCK

     *note pthread_sigmask(): 14f1. の 'how' 引数に渡せる値で、シグナル
     がブロックされることを意味します。

     Added in version 3.3.

 -- データ: signal.SIG_UNBLOCK

     *note pthread_sigmask(): 14f1. の 'how' 引数に渡せる値で、シグナル
     がブロック解除されることを意味します。

     Added in version 3.3.

 -- データ: signal.SIG_SETMASK

     *note pthread_sigmask(): 14f1. の 'how' 引数に渡せる値で、シグナル
     が置換されることを意味します。

     Added in version 3.3.

The ‘signal’ module defines one exception:

 -- 例外: signal.ItimerError

     背後の *note setitimer(): 3cd3. または *note getitimer(): 3cd4. 実
     装からエラーを通知するために送出されます。無効なインタバルタイマー
     や負の時間が ‘setitimer()’ に渡された場合、このエラーを予期してくだ
     さい。このエラーは *note OSError: 543. を継承しています。

     Added in version 3.3: このエラーは以前は *note IOError: 1409. のサ
     ブタイプでしたが、 *note OSError: 543. のエイリアスになりました。

The ‘signal’ module defines the following functions:

 -- の関数: signal.alarm (time)

     'time' がゼロでない値の場合、この関数は 'time' 秒後頃に *note
     SIGALRM: 3cc3. をプロセスに送るように要求します。それ以前にスケジュ
     ールしたアラームはキャンセルされます (常に一つのアラームしかスケジ
     ュールできません)。この場合、戻り値は以前に設定されたアラームシグナ
     ルが通知されるまであと何秒だったかを示す値です。 'time' がゼロの場
     合、アラームは一切スケジュールされず、現在スケジュールされているア
     ラームがキャンセルされます。戻り値がゼロの場合、現在アラームがスケ
     ジュールされていないことを示します。

     *note Availability: 234c.: Unix.

     See the man page ‘alarm(2)(8)’ for further information.

 -- の関数: signal.getsignal (signalnum)

     シグナル 'signalnum' に対する現在のシグナルハンドラを返します。戻り
     値は呼び出し可能な Python オブジェクトか、 *note signal.SIG_IGN:
     1dca.、 *note signal.SIG_DFL: 1dcb.、および *note None: a6a. といっ
     た特殊な値のいずれかです。ここで ‘signal.SIG_IGN’ は以前そのシグナ
     ルが無視されていたことを示し、 ‘signal.SIG_DFL’ は以前そのシグナル
     の標準の処理方法が使われていたことを示し、 ‘None’ はシグナルハンド
     ラがまだ Python によってインストールされていないことを示します。

 -- の関数: signal.strsignal (signalnum)

     Returns the description of signal 'signalnum', such as "Interrupt"
     for *note SIGINT: 4e6.  Returns *note None: a6a. if 'signalnum' has
     no description.  Raises *note ValueError: 15a. 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: 234c.: Unix.

     See the man page ‘signal(2)(9)’ for further information.

     *note sigwait(): 14f4, *note sigwaitinfo(): 1168, *note
     sigtimedwait(): 1167. *note sigpending(): 14f3. も参照してください
     。

 -- の関数: 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: 234c.: Linux >= 5.1, Android >= *note
     build-time: f4d. 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:
     3cba.  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: 1145.

     Use *note threading.get_ident(): 151a. or the *note ident: 33a6.
     attribute of *note threading.Thread: 427. 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 監査イベント: 1e84.
     ‘signal.pthread_kill’ を送出します。

     *note Availability: 234c.: Unix.

     See the man page ‘pthread_kill(3)(11)’ for further information.

     *note os.kill(): 1721. を参照してください。

     Added in version 3.3.

 -- の関数: signal.pthread_sigmask (how, mask)

     これを呼び出すスレッドにセットされているシグナルマスクを取り出した
     り変更したりします。シグナルマスクは、呼び出し側のために現在どのシ
     グナルの配送がブロックされているかを示す集合 (set) です。呼び出し前
     のもとのシグナルマスクを集合として返却します。

     この関数の振る舞いは 'how' に依存して以下のようになります。

        * *note SIG_BLOCK: 3cbc.: 'mask' で指定されるシグナルが現時点の
          シグナルマスクに追加されます。

        * *note SIG_UNBLOCK: 3cbd.: 'mask' で指定されるシグナルが現時点
          のシグナルマスクから取り除かれます。もともとブロックされていな
          いシグナルをブロック解除しようとしても問題ありません。

        * *note SIG_SETMASK: 3cbe.: シグナルマスク全体を 'mask' としてセ
          ットします。

     'mask' はシグナル番号の集合です (例えば {*note signal.SIGINT: 4e6,
     *note signal.SIGTERM: 1798.})。全てのシグナルを含む全集合として
     *note valid_signals(): 3cce. を使うことが出来ます。

     呼び出しスレッドにセットされたシグナルマスクを問い合わせるには例え
     ば ‘signal.pthread_sigmask(signal.SIG_BLOCK, [])’ とします。

     *note SIGKILL: f1a. and *note SIGSTOP: 3cc8. cannot be blocked.

     *note Availability: 234c.: Unix.

     See the man page ‘sigprocmask(2)(12)’ and ‘pthread_sigmask(3)(13)’
     for further information.

     *note pause(): 3cd6, *note sigpending(): 14f3, *note sigwait():
     14f4. も参照して下さい。

     Added in version 3.3.

 -- の関数: signal.setitimer (which, seconds, interval=0)

     Sets given interval timer (one of *note signal.ITIMER_REAL: 3ccf,
     *note signal.ITIMER_VIRTUAL: 3cd0. or *note signal.ITIMER_PROF:
     3cd1.) specified by 'which' to fire after 'seconds' (rounded up to
     microseconds, different from *note alarm(): 3cd5.) 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: 3ccf. の場合は *note SIGALRM: 3cc3. が、 *note
     signal.ITIMER_VIRTUAL: 3cd0. の場合は *note SIGVTALRM: 3ccb. が、
     *note signal.ITIMER_PROF: 3cd1. の場合は *note SIGPROF: 3cc7. が送
     られます。

     The old values are returned as a two-tuple of floats: (‘delay’,
     ‘interval’).

     無効なインターバルタイマーを渡すと *note ItimerError: 3cd2. 例外が
     発生します。

     *note Availability: 234c.: Unix.

     バージョン 3.15 で変更: Accepts any real numbers as 'seconds' and
     'interval', not only integers or floats.

 -- の関数: signal.getitimer (which)

     'which' で指定されたインターバルタイマーの現在の値を返します。

     *note Availability: 234c.: 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
     メインインタープリターのメインスレッド: 3cba. からしか実行できませ
     ん。それ以外のスレッドからこの関数を実行しようとすると *note
     ValueError: 15a. 例外が発生します。

     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: ef9. の場合、 'signalnum' シグナルに中断されたシステムコール
     は再実行されます。それ以外の場合、システムコールは中断されます。戻
     り値はありません。

     *note Availability: 234c.: Unix.

     See the man page ‘siginterrupt(3)(14)’ for further information.

     Note that installing a signal handler with *note signal(): ce. 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: 1dca. あるいは *note
     signal.SIG_DFL: 1dcb. といった特殊な値にすることができます。以前に
     使われていたシグナルハンドラが返されます (上記の *note getsignal():
     1c4c. の記述を参照してください)。 (さらに詳しい情報については Unix
     マニュアルページ ‘signal(2)(15)’ を参照してください。)

     スレッドが有効な場合、この関数は *note
     メインインタープリターのメインスレッド: 3cba. からしか実行できませ
     ん。それ以外のスレッドからこの関数を実行しようとすると *note
     ValueError: 15a. 例外が発生します。

     'handler' は二つの引数とともに呼び出されます: シグナル番号、および
     現在のスタックフレーム (‘None’ またはフレームオブジェクト; フレーム
     オブジェクトについての記述は *note 標準型の階層における説明: ad2. か
     、 *note inspect: 81. モジュールの属性の説明を参照してください)。

     On Windows, ‘signal()’ can only be called with *note SIGABRT: 1439,
     *note SIGFPE: 1438, *note SIGILL: 143b, *note SIGINT: 4e6, *note
     SIGSEGV: 1437, *note SIGTERM: 1798, or *note SIGBREAK: 3cc4.  A
     *note ValueError: 15a. will be raised in any other case.  Note that
     not all systems define the same set of signal names; an *note
     AttributeError: 1b4. will be raised if a signal name is not defined
     as ‘SIG*’ module level constant.

 -- の関数: signal.sigpending ()

     呼び出しスレッドで配送が保留されているシグナル (つまり配送がブロッ
     クされている間に発生したシグナル) の集合を調べます。保留中のシグナ
     ルの集合を返します。

     *note Availability: 234c.: Unix.

     See the man page ‘sigpending(2)(16)’ for further information.

     *note pause(): 3cd6, *note pthread_sigmask(): 14f1, *note
     sigwait(): 14f4. も参照して下さい。

     Added in version 3.3.

 -- の関数: signal.sigwait (sigset)

     'sigset' 集合で指定されたシグナルのうちどれか一つが届くまで呼び出し
     スレッドを一時停止します。この関数はそのシグナルを受け取ると (それ
     を保留シグナルリストから取り除いて) そのシグナル番号を返します。

     *note Availability: 234c.: Unix.

     See the man page ‘sigwait(3)(17)’ for further information.

     *note pause(): 3cd6, *note pthread_sigmask(): 14f1, *note
     sigpending(): 14f3, *note sigwaitinfo(): 1168, *note
     sigtimedwait(): 1167. も参照して下さい。

     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: 1145. 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: 234c.: Unix.

     See the man page ‘sigwaitinfo(2)(18)’ for further information.

     *note pause(): 3cd6, *note sigwait(): 14f4, *note sigtimedwait():
     1167. も参照して下さい。

     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(): 1168, but takes an additional 'timeout'
     argument specifying a timeout.  If 'timeout' is specified as ‘0’, a
     poll is performed.  Returns *note None: a6a. if a timeout occurs.

     *note Availability: 234c.: Unix.

     See the man page ‘sigtimedwait(2)(20)’ for further information.

     *note pause(): 3cd6, *note sigwait(): 14f4, *note sigwaitinfo():
     1168. も参照して下さい。

     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).

     バージョン 3.15 で変更: Accepts any real number as 'timeout', not
     only integer or float.

   ---------- 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: モジュールの内容<4>,  Up: signal --- 非同期イベントにハンドラーを設定する

5.20.6.5 使用例
...............

以下は最小限のプログラム例です。この例では *note alarm(): 3cd5. を使って
ファイルを開く処理を待つのに費やす時間を制限します; 例えば、電源の入って
いないシリアルデバイスを開こうとすると、通常 *note os.open(): 114f. は未
定義の期間ハングアップしてしまいますが、この方法はそうした場合に便利です
。ここではファイルを開くまで 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: 3cb6. 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: 3cb6.'s disposition to *note SIG_DFL: 1dcb. in
order to avoid *note BrokenPipeError: 1412.  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: 6b9. instruction.  Most notably, a *note KeyboardInterrupt:
d9a. 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: d9a, 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: 4e6. 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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

メモリにマップされたファイルオブジェクトは、 *note bytearray: 1d1. と
*note ファイルオブジェクト: 1581. の両方のように振舞います。しかし通常の
文字列オブジェクトとは異なり、これらは可変です。 ‘bytearray’ が期待され
るほとんどの場所で mmap オブジェクトを利用できます。例えば、メモリマップ
ファイルを探索するために *note re: c1. モジュールを使うことができます。
それらは可変なので、 ‘obj[index] = 97’ のように文字を変換できますし、ス
ライスを使うことで ‘obj[i1:i2] = b'...'’ のように部分文字列を変換するこ
とができます。現在のファイル位置をデータの始めとする読込みや書込み、ファ
イルの異なる位置へ ‘seek()’ することもできます。

メモリマップドファイルは Unix と Windows で異なる *note mmap: 247. コン
ストラクタで生成されます。どちらの場合も、更新用に開かれたファイル記述子
を渡さなければなりません。既存の Python ファイルオブジェクトをマップした
ければ、 *note fileno(): 19d2. メソッドを使って 'fileno' パラメータの正
しい値を取得してください。そうでなければ、 *note os.open(): 114f. 関数を
使ってファイルを開けます。この関数はファイルディスクリプタを直接返します
(処理が終わったら、やはりファイルを閉じる必要があります)。

     注釈: 書き込み可能でバッファされたファイルへのメモリマップファイル
     を作りたいのであれば、まず最初にファイルの *note flush(): 1a1a. を
     呼び出すべきです。これはバッファへのローカルな修正がマッピングで実
     際に利用可能になることを保障するために必要です。

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: 29c. 例外を送出します
。 ‘ACCESS_WRITE’ 型のメモリマップへの書き込みはメモリと元のファイルの両
方に影響を与えます。 ‘ACCESS_COPY’ 型のメモリマップへの書き込みはメモリ
に影響を与えますが、元のファイルを更新することはありません。

バージョン 3.7 で変更: 定数 ‘ACCESS_DEFAULT’ が追加されました。

無名メモリ(anonymous memory)にマップするためには fileno として -1 を渡し
、length を与えてください。

 -- クラス: mmap.mmap (fileno, length, tagname=None,
          access=ACCESS_DEFAULT, offset=0, *, trackfd=True)

     '(Windows version)' Maps 'length' bytes from the file specified by
     the file descriptor '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’ の倍数でなければな
     りません。

     If 'trackfd' is ‘False’, the file handle corresponding to '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(): 1a65. and *note resize(): 3f0. methods will fail.
     This mode is useful to limit the number of open file handles.  The
     original file can be renamed (but not deleted) after closing
     'fileno'.

     バージョン 3.15 で変更: 'trackfd' パラメータが追加されました。

     引数 ‘fileno’, ‘length’, ‘access’, ‘offset’ 付きで *note
     監査イベント: 1e84. ‘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: 247. が呼
     ばれた時点でのファイルサイズになります。

     'flags' specifies the nature of the mapping.  *note MAP_PRIVATE:
     3cde. 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: 3cdf. 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: 3ce0.

     '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(): 1a65. and *note resize(): 3f0. 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: 247. の簡潔な使い方を示すものです:

          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: 247. は *note with: 215. 文の中でコンテキストマネージャ
     としても使えます:

          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
     監査イベント: 1e84. ‘mmap.__new__’ を送出します。

     メモリマップファイルオブジェクトは以下のメソッドをサポートしていま
     す:

      -- メソッド: close ()

          メモリマップファイルを閉じます。この呼出しの後にオブジェクトの
          他のメソッドの呼出すことは、 *note ValueError: 15a. 例外の送出
          を引き起こします。このメソッドは開いたファイルのクローズはしま
          せん。

      -- の属性: closed

          ファイルが閉じている場合 ‘True’ となります。

          Added in version 3.2.

      -- メソッド: find (sub[, start[, end]])

          オブジェクト内の ['start', 'end'] の範囲に含まれている部分シー
          ケンス 'sub' が見つかった場所の最も小さいインデックスを返しま
          す。オプションの引数 'start' と 'end' はスライスに使われるとき
          のように解釈されます。失敗したときには ‘-1’ を返します。

          バージョン 3.5 で変更: 書き込み可能な *note bytes-like object:
          43d. を使用できるようになりました。

      -- メソッド: flush ([offset[, size]], *, flags=MS_SYNC)

          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’.

          The 'flags' parameter specifies the synchronization behavior.
          'flags' must be one of the *note MS_* constants: 3ce4.
          available on the system.

          On Windows, the 'flags' parameter is ignored.

          ‘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.

          バージョン 3.15 で変更: Allow specifying 'offset' without
          'size'.  Previously, both 'offset' and 'size' parameters were
          required together.  Now 'offset' can be specified alone, and
          the flush operation will extend from 'offset' to the end of
          the mmap.

          バージョン 3.15 で変更: Added 'flags' parameter to control
          synchronization behavior.

      -- メソッド: 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: 3ce5. 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: 29c. 例外を発生させます。

      -- メソッド: read ([n])

          現在のファイル位置からの最大 'n' バイトを含む *note bytes:
          1d2. を返します。引数が省略されるか、 ‘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: 29c. exception.
          Resizing a map created with 'trackfd' set to ‘False’, will
          raise a *note ValueError: 15a. exception.

          'On Windows': Resizing the map will raise an *note OSError:
          543. 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.

          Availability: Windows and systems with the ‘mremap()’ system
          call.

          バージョン 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:
          43d. を使用できるようになりました。

      -- メソッド: 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.

      -- メソッド: set_name (name, /)

          Annotate the memory mapping with the given 'name' for easier
          identification in ‘/proc/<pid>/maps’ if the kernel supports
          the feature and *note -X dev: 183. is passed to Python or if
          Python is built in *note debug mode: 3e3.  The length of
          'name' must not exceed 67 bytes including the ‘'\0'’
          terminator.

          *note Availability: 234c.: Linux >= 5.17 (kernel built with
          ‘CONFIG_ANON_VMA_NAME’ option)

          Added in version 3.15.

      -- メソッド: size ()

          Return the length of the file, which can be larger than the
          size of the memory-mapped area.  For an anonymous mapping,
          return its size.

          バージョン 3.15 で変更: Anonymous mappings are now supported
          on Unix.

      -- メソッド: tell ()

          ファイルポインタの現在位置を返します。

      -- メソッド: write (bytes)

          メモリ内のファイルポイントの現在位置に 'bytes' のバイト列を書
          き込み、書き込まれたバイト数を返します(もし書き込みが失敗した
          ら *note ValueError: 15a. が送出されるため、‘len(bytes)’ より
          少なくなりません)。ファイル位置はバイト列が書き込まれた位置に
          更新されます。もしmmapが ‘ACCESS_READ’ とともに作成されていた
          場合は、書き込みは *note TypeError: 29c. 例外を送出するでしょ
          う。

          バージョン 3.5 で変更: 書き込み可能な *note bytes-like object:
          43d. を使用できるようになりました。

          バージョン 3.6 で変更: 書きこまれたバイト数を返すようになりま
          した。

      -- メソッド: write_byte (byte)

          メモリ内のファイル・ポインタの現在位置に整数 'byte' を書き込み
          ます。ファイル位置は ‘1’ だけ進みます。もし mmap が
          ‘ACCESS_READ’ で作成されていた場合、書き込み時に *note
          TypeError: 29c. 例外を発生させるでしょう。

* Menu:

* MADV_* 定数::
* MAP_* 定数::
* MS_* Constants::


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(): dce.  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_* 定数,  Next: MS_* Constants,  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(): 247.  ‘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: MS_* Constants,  Prev: MAP_* 定数,  Up: mmap --- メモリマップファイルのサポート

5.20.7.3 MS_* Constants
.......................

 -- データ: mmap.MS_SYNC
 -- データ: mmap.MS_ASYNC
 -- データ: mmap.MS_INVALIDATE

     These flags control the synchronization behavior for *note
     mmap.flush(): e62.:

        * ‘MS_SYNC’ - Synchronous flush: writes are scheduled and the
          call blocks until they are physically written to storage.

        * ‘MS_ASYNC’ - Asynchronous flush: writes are scheduled but the
          call returns immediately without waiting for completion.

        * ‘MS_INVALIDATE’ - Invalidate cached data: invalidates other
          mappings of the same file so they can see the changes.

     Added in version 3.15.


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: d2.  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: 47. 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: 221. API.

The other two major components of the package are the *note parser: 51.
and the *note generator: 43.  The parser takes the serialized version of
an email message (a stream of bytes) and converts it into a tree of
*note EmailMessage: 221. 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: 52. module.  Every *note
EmailMessage: 221, every *note generator: 43, and every *note parser:
51. 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: 47. object model, which is
the primary interface an application will use, and follow that with the
*note parser: 51. and *note generator: 43. components.  Then we cover
the *note policy: 52. 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: 51.
may detect.  Then we cover the *note headerregistry: 45. and the *note
contentmanager: 40. 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: 786.
class, cover the legacy *note compat32: 105e. 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: 105e. API for
backward compatibility reasons.

バージョン 3.6 で変更: Docs reorganized and rewritten to promote the new
*note EmailMessage: 221./*note EmailPolicy: 1475. 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/main/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: 3e. package is the *note
EmailMessage: 221. 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: 221. 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: 221. 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: 221. 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: 1476. 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: 52. 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: 786. class
          'maxheaderlen' is accepted, but defaults to ‘None’, which
          means that by default the line length is controlled by the
          *note max_line_length: 3d19. 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: 158c.

          もし、文字列への変換を完全に行うためにデフォルト値を埋める必要
          がある場合、メッセージのフラット化は *note EmailMessage: 221.
          の変更を引き起こす可能性があります (例えば、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: 158c. 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: 222. 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(): 3d18.

      -- メソッド: 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: 158d.

          もし、文字列への変換を完全に行うためにデフォルト値を埋める必要
          がある場合、メッセージのフラット化は *note EmailMessage: 221.
          の変更を引き起こす可能性があります (例えば、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: 158d. for
          a more flexible API for serializing messages.

      -- メソッド: __bytes__ ()

          Equivalent to *note as_bytes(): 3d1b.  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: 221. 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: 3d1f. 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(): 3d21, but in an *note EmailMessage: 221.
     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: 7e5. 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(): 3d25. 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: 3d26.

      -- メソッド: __setitem__ (name, val)

          メッセージヘッダに 'name' という名前の 'val' という値をもつフ
          ィールドをあらたに追加します。このフィールドは現在メッセージに
          存在するヘッダーのいちばん後に追加されます。

          注意: このメソッドでは、すでに同一の名前で存在するフィールドは
          上書き 'されません'。もしメッセージが名前 'name' をもつフィー
          ルドをひとつしか持たないようにしたければ、最初にそれを除去して
          ください。たとえば:

               del msg['subject']
               msg['subject'] = 'Python roolz!'

          If the *note policy: 52. defines certain headers to be unique
          (as the standard policies do), this method may raise a *note
          ValueError: 15a. 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__(): 78d. 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__(): 3d27. と似
          ていますが、追加のヘッダ・パラメータをキーワード引数で指定でき
          るところが違っています。 '_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: 7e5.

      -- メソッド: 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(): 3d2f.  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(): 3d2e. によって返される文字列の ‘maintype’
          部分です。

      -- メソッド: get_content_subtype ()

          そのメッセージの副 content-type (sub content-type、subtype) を
          返します。これは *note get_content_type(): 3d2e. によって返さ
          れる文字列の ‘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: 221.
          objects is deprecated.

          Note that existing parameter values of headers may be accessed
          through the *note params: 3d34. 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: 221.
          objects is deprecated.

      -- メソッド: get_filename (failobj=None)

          そのメッセージ中の ‘Content-Disposition’ ヘッダにある、
          ‘filename’ パラメータの値を返します。目的のヘッダに ‘filename’
          パラメータがない場合には ‘Content-Type’ ヘッダにある ‘name’ パ
          ラメータを探します。それも無い場合またはヘッダが無い場合には
          'failobj' が返されます。返される文字列はつねに *note
          email.utils.unquote(): 3d37. によって unquote されます。

      -- メソッド: get_boundary (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パ
          ラメータの値を返します。目的のヘッダが欠けていたり、
          ‘boundary’ パラメータがない場合には 'failobj' が返されます。返
          される文字列はつねに *note email.utils.unquote(): 3d37. によっ
          て unquote されます。

      -- メソッド: set_boundary (boundary)

          メッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パラメ
          ータに値を設定します。 *note set_boundary(): 3d39. は必要に応
          じて 'boundary' を quote します。そのメッセージが
          ‘Content-Type’ ヘッダを含んでいない場合、 *note
          HeaderParseError: 3d3a. が発生します。

          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(): 3d2c, 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(): 3d3e. との一貫
          性のために、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(): 3d40. メソッドは多目的のジェネレータで、これはあ
          るメッセージオブジェクトツリー中のすべての 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(): 3d1d. 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(): 3d40.)

      -- メソッド: get_content (*args, content_manager=None, **kw)

          Call the *note get_content(): 3d45. 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: 52.

      -- メソッド: set_content (*args, content_manager=None, **kw)

          Call the *note set_content(): 3d46. 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: 52.

      -- メソッド: 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():
          1e73. method, and *note attach(): 3d4b. it to the ‘multipart’.
          If the message is a non-‘multipart’, call *note
          make_related(): 3d47. and then proceed as above.  If the
          message is any other type of ‘multipart’, raise a *note
          TypeError: 29c.  If 'content_manager' is not specified, use
          the ‘content_manager’ specified by the current *note policy:
          52.  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(): 1e73. method, and *note attach(): 3d4b. it to
          the ‘multipart’.  If the message is a non-‘multipart’ or
          ‘multipart/related’, call *note make_alternative(): 3d48. and
          then proceed as above.  If the message is any other type of
          ‘multipart’, raise a *note TypeError: 29c.  If
          'content_manager' is not specified, use the ‘content_manager’
          specified by the current *note policy: 52.

      -- メソッド: 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():
          1e73. method, and *note attach(): 3d4b. it to the ‘multipart’.
          If the message is a non-‘multipart’, ‘multipart/related’, or
          ‘multipart/alternative’, call *note make_mixed(): 3d49. and
          then proceed as above.  If 'content_manager' is not specified,
          use the ‘content_manager’ specified by the current *note
          policy: 52.  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: 221. オブジェクトは次のようなインスタンス属性を
     持ちます:

      -- の属性: preamble

          MIME ドキュメントの形式では、ヘッダ直後にくる空行と最初の
          multipart 境界をあらわす文字列のあいだにいくらかのテキスト (訳
          注: preamble, 序文) を埋めこむことを許しています。このテキスト
          は標準的な MIME の範疇からはみ出しているので、MIME 形式を認識
          するメールソフトからこれらは通常まったく見えません。しかしメッ
          セージのテキストを生で見る場合、あるいはメッセージを MIME 対応
          していないメールソフトで見る場合、このテキストは目に見えること
          になります。

          'preamble' 属性は MIME ドキュメントに加えるこの最初の MIME 範
          囲外テキストを含んでいます。 *note Parser: 155b. があるテキス
          トをヘッダ以降に発見したが、それはまだ最初の MIME 境界文字列が
          現れる前だった場合、パーザはそのテキストをメッセージの
          'preamble' 属性に格納します。 *note Generator: 158c. がある
          MIME メッセージからプレーンテキスト形式を生成するときメッセー
          ジが 'preamble' 属性を持つことが発見されれば、これはそのテキス
          トをヘッダと最初の MIME 境界の間に挿入します。詳細は *note
          email.parser: 51. および *note email.generator: 43. を参照して
          ください。

          注意: そのメッセージに 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: 3d50, if there is no epilog text this
          attribute will be ‘None’.

      -- の属性: defects

          'defects' 属性はメッセージを解析する途中で検出されたすべての問
          題点 (defect、障害) のリストを保持しています。解析中に発見され
          うる障害についてのより詳細な説明は *note email.errors: 42. を
          参照してください。

 -- クラス: email.message.MIMEPart (policy=default)

     This class represents a subpart of a MIME message.  It is identical
     to *note EmailMessage: 221, except that no ‘MIME-Version’ headers
     are added when *note set_content(): 1e73. is called, since
     sub-parts do not need their own ‘MIME-Version’ headers.

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/email/message.py

   (2) Originally added in 3.4 as a *note provisional module: 13ee.
Docs for legacy message class moved to *note email.message.Message;
compat32 API を使用した電子メールメッセージの表現: 3d17.

   (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: 221. 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: 105e. 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: 221. object,
adding headers using the dictionary interface, and adding payload(s)
using *note set_content(): 1e73. and related methods, or they can be
created by parsing a serialized representation of the email message.

The *note email: 3e. 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: 221. 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(): 3d1d. method, and the subparts can be accessed via the
payload manipulation methods, such as *note get_body(): 3d41, *note
iter_parts(): 3d43, and *note walk(): 3d40.

There are actually two parser interfaces available for use, the *note
Parser: 155b. API and the incremental *note FeedParser: 19ca. 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: 3e. package's bundled parser and the
*note EmailMessage: 221. class is embodied in the *note Policy: 1471.
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/main/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: 1589, 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: 43d, string, or file, but the
*note BytesParser: 158a. API may be more convenient for such use cases.
The semantics and results of the two parser APIs are identical.

*note BytesFeedParser: 1589. API は簡単です。まずインスタンスをつくり、
それに bytes を (それ以上 bytes が必要なくなるまで) 流しこみます。その後
パーザを close すると根っこ (root) のメッセージオブジェクトが返されます
。標準に従ったメッセージを解析する場合、 ‘BytesFeedParser’ は非常に正確
であり、標準に従っていないメッセージでもちゃんと動きます。そのさい、これ
はメッセージがどのように壊れていると認識されたかについての情報を残します
。これはメッセージオブジェクトの *note defects: 3d52. 属性にリストとして
現れ、メッセージ中に発見された問題が記録されます。パーザが検出できる障害
(defect) については *note email.errors: 42. モジュールを参照してください
。

以下は *note BytesFeedParser: 1589. の 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: 105d. 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: 1472. policy, which maintains backward
     compatibility with the Python 3.2 version of the email package and
     provides *note Message: 786. as the default factory.  All other
     policies provide *note EmailMessage: 221. as the default
     '_factory'.  For more information on what else 'policy' controls,
     see the *note policy: 52. documentation.

     Note: 'The policy keyword should always be specified'; The default
     will change to *note email.policy.default: 1476. 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: 43d. を渡します。渡される行は完結
          していなくてもよく、その場合パーサーは部分的な行を適切につなぎ
          合わせます。各行は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(): 3d57. is called after this method has been called.

 -- クラス: email.parser.FeedParser (_factory=None, *,
          policy=policy.compat32)

     Works like *note BytesFeedParser: 1589. except that the input to
     the *note feed(): 3d57. 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: 222. 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: 158a. 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: 43d. or file.  The ‘email.parser’ module also provides *note
Parser: 155b. for parsing strings, and header-only parsers, *note
BytesHeaderParser: 147b. and *note HeaderParser: 147c, 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: 1589.

     Note: 'The policy keyword should always be specified'; The default
     will change to *note email.policy.default: 1476. 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(): 16e3. and the *note read():
          16e2. methods.

          The bytes contained in 'fp' must be formatted as a block of
          RFC 5322(1) (or, if *note utf8: 222. 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(): 3d5a. method, except it takes a
          *note bytes-like object: 43d. instead of a file-like object.
          Calling this method on a bytes-like object is equivalent to
          wrapping 'bytes' in a *note BytesIO: 1258. instance first and
          calling ‘parse()’.

          オプション引数 'headersonly' は *note parse(): 3d5a. メソッド
          と同じです。

     Added in version 3.2.

 -- クラス: email.parser.BytesHeaderParser (_class=None, *,
          policy=policy.compat32)

     Exactly like *note BytesParser: 158a, 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: 158a, 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(): 22b4.
          および *note read(): 2279. 両方のメソッドをサポートしている必
          要があります。

          Other than the text mode requirement, this method operates
          like *note BytesParser.parse(): 3d5a.

      -- メソッド: parsestr (text, headersonly=False)

          *note parse(): 3d5c. メソッドに似ていますが、ファイルなどのス
          トリーム形式のかわりに文字列を引数としてとるところが違います。
          文字列に対してこのメソッドを呼ぶことは、 'text' を *note
          StringIO: 12d8. インスタンスとして作成して ‘parse()’ を適用す
          るのと同じです。

          オプション引数 'headersonly' は *note parse(): 3d5c. メソッド
          と同じです。

 -- クラス: email.parser.HeaderParser (_class=None, *,
          policy=policy.compat32)

     Exactly like *note Parser: 155b, except that 'headersonly' defaults
     to ‘True’.

ファイルや文字列からメッセージオブジェクト構造を作成するのはかなりよくお
こなわれる作業なので、便宜上次のような 4つの関数が提供されています。これ
らは *note email: 3e. パッケージのトップレベルの名前空間で使用できます。

 -- の関数: email.message_from_bytes (s, _class=None, *,
          policy=policy.compat32)

     *note bytes-like オブジェクト: 43d. からメッセージオブジェクト構造
     を作成して返します。これは ‘BytesParser().parsebytes(s)’ と同じです
     。オプション引数 '_class' および 'policy' は *note BytesParser:
     158a. クラスのコンストラクタと同様に解釈されます。

     Added in version 3.2.

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

 -- の関数: email.message_from_binary_file (fp, _class=None, *,
          policy=policy.compat32)

     オープンされたバイナリ *note file object: 1581. からメッセージオブ
     ジェクト構造を作成して返します。これは ‘BytesParser().parse(fp)’ と
     同じです。 '_class' および 'policy' は *note BytesParser: 158a. ク
     ラスのコンストラクタと同様に解釈されます。

     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: 155b. クラスのコンストラクタと同様に解釈されます。

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

 -- の関数: email.message_from_file (fp, _class=None, *,
          policy=policy.compat32)

     オープンされた *note file object: 1581. からメッセージオブジェクト
     構造を作成して返します。これは ‘Parser().parse(fp)’ と同じです。
     '_class' および 'policy' は *note Parser: 155b. クラスのコンストラ
     クタと同様に解釈されます。

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

     バージョン 3.6 で変更: '_class' defaults to the policy
     ‘message_factory’.

対話的な Python プロンプトで *note message_from_bytes(): 1587. を使用す
るとすれば、このようになります:

     >>> 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(): 3d1d, and *note iter_parts(): 3d43. 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(): 3d1d, and *note iter_parts(): 3d43. 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(): 3d1d. method will return ‘True’.  The single
     element yielded by *note iter_parts(): 3d43. will be a sub-message
     object.

   * いくつかの標準的でないメッセージは、 ‘multipart’ の使い方に統一がと
     れていない場合があります。このようなメッセージは ‘Content-Type’ ヘ
     ッダに ‘multipart’ を指定しているものの、その *note is_multipart():
     3d1d. メソッドは ‘False’ を返すことがあります。もしこのようなメッセ
     ージが *note FeedParser: 19ca. によって解析されると、その 'defects'
     属性のリスト中には *note MultipartInvariantViolationDefect: 3d61. ク
     ラスのインスタンスが現れます。詳しい情報については *note
     email.errors: 42. を参照してください。


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(): 120d, 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: 51. 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: 52. is used for both.  That is, parsing
the serialized byte stream via the *note BytesParser: 158a. class and
then regenerating the serialized byte stream using *note BytesGenerator:
158d. should produce output identical to the input (2).  (On the other
hand, using the generator on an *note EmailMessage: 221. constructed by
program may result in changes to the ‘EmailMessage’ object as defaults
are filled in.)

The *note Generator: 158c. 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: 158c. 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(): 3d66. method, or any
     surrogateescape encoded text provided to the *note write(): 3d67.
     method, to the *note file-like object: 19d1. '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_:
     11b3. setting of the 'policy' (which is ‘True’ for the *note
     compat32: 105e. policy and ‘False’ for all others).  'mangle_from_'
     is intended for use when messages are stored in Unix mbox format
     (see *note mailbox: 8e. 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: 786. or *note EmailMessage: 221.
     object passed to ‘flatten’ to control the message generation.  See
     *note email.policy: 52. 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: 158d. イ
          ンスタンスが作成されたときに指定されたものが使われます。

          If the *note policy: 52. option *note cte_type: 3d68. 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: 8e.)
          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: 221. provides the methods *note
as_bytes(): 3d1b. and ‘bytes(aMessage)’ (a.k.a.  *note __bytes__():
3d1c.), which simplify the generation of a serialized binary
representation of a message object.  For more detail, see *note
email.message: 47.

Because strings cannot represent binary data, the *note Generator: 158c.
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: 158d, 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(): 3d6a. method, or any text provided to the
     *note write(): 3d6b. method, to the *note file-like object: 19d1.
     '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_:
     11b3. setting of the 'policy' (which is ‘True’ for the *note
     compat32: 105e. policy and ‘False’ for all others).  'mangle_from_'
     is intended for use when messages are stored in Unix mbox format
     (see *note mailbox: 8e. 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: 786. or *note EmailMessage: 221.
     object passed to ‘flatten’ to control the message generation.  See
     *note email.policy: 52. 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: 158c. インス
          タンスが作成されたときに指定されたものが使われます。

          If the *note policy: 52. option *note cte_type: 3d68. 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: 8e.)
          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(): 1324. function.

As a convenience, *note EmailMessage: 221. provides the methods *note
as_string(): 3d18. and ‘str(aMessage)’ (a.k.a.  *note __str__(): 3d1a.),
which simplify the generation of a formatted string representation of a
message object.  For more detail, see *note email.message: 47.

The ‘email.generator’ module also provides a derived class, *note
DecodedGenerator: 105c, which is like the *note Generator: 158c. 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: 158c, except that for any subpart of the
     message passed to *note Generator.flatten(): 3d6a, 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: 158c. base class.

脚注
....

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/email/generator.py

   (2) This statement assumes that you use the appropriate setting for
‘unixfrom’, and that there are no *note email.policy: 52. settings
calling for automatic adjustments (for example, *note refold_source:
3d65. 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: 3e. パッケージの主要な目的は様々なEメールやMIMEのRFCで記述
されたEメールメッセージを取り扱うことにあります。しかし、Eメールメッセー
ジの一般的なフォーマット(名前の後にコロンが続き、コロンの後に値が続くと
いう構成の複数のヘッダーフィールドのブロック、空白行、任意の 'body')は
Eメールの分野外での用途が見いだされたフォーマットです。これらの用途には
主となるEメールのRFCに厳密に従っているものもあれば、そうでないものもあり
ます。Eメールを使ったworkingのときでさえも、厳密なRFC準拠にしないのが望
ましいことがあります。たとえば、基準に従わないEメールサーバーと相互運用
するEメールを作成するときや、基準に違反する方法で使用したい拡張機能を実
装するEメールを作成するときです。

これらのばらばらな用途に対応するためPolicyオブジェクトはEメールパッケー
ジに対して柔軟性を提供します。

A *note Policy: 1471. 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: 51. classes and the related convenience
functions, and for the *note Message: 786. class, this is the *note
Compat32: 1472. policy, via its corresponding pre-defined instance *note
compat32: 105e.  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: 221.
is the *note EmailPolicy: 1475. policy, via its pre-defined instance
*note default: 1476.

When a *note Message: 786. or *note EmailMessage: 221. object is
created, it acquires a policy.  If the message is created by a *note
parser: 51, 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: 43, 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:
51. 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: 1471, an *note abstract base class: 1574. that defines the
features that are common to all policy objects, including *note
compat32: 105e.  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: 1475. and *note Compat32: 1472, which
implement the hooks that provide the standard behavior and the backward
compatible behavior and features, respectively.

*note Policy: 1471. 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: 158d. 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(): 12e7. 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: 1574. 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(): 1473. 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: a6a. の場合は行の折り返しを全くしないべ
          きであるということを示します。

      -- の属性: 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(): 3d71. and *note utf8: 222. 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: fd0, any defects encountered will be raised as
          errors.  If *note False: ef9. (the default), defects will be
          passed to the *note register_defect(): 3d73. method.

      -- の属性: mangle_from_

          If *note True: fd0, 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: ef9.

          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: 786. is used.

          Added in version 3.6.

      -- の属性: verify_generated_headers

          If ‘True’ (the default), the generator will raise *note
          HeaderWriteError: 1931. 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: 1472. 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: 3d75.

          The default implementation checks the *note raise_on_defect:
          3d72. 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(): 3d73.

      -- メソッド: register_defect (obj, defect)

          Register a 'defect' on 'obj'.  In the email package, 'defect'
          will always be a subclass of *note MessageDefect: 3d75.

          The default implementation calls the ‘append’ method of the
          ‘defects’ attribute of 'obj'.  When the email package calls
          *note handle_defect: 3d74, '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: 221.
          or *note Message: 786. 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: 15a. 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: 3d70. 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(): 3d7a. と同じです。

          'value' はサロゲートエスケープされたバイナリデータを持つことが
          あります。これらは返されたbytesオブジェクト内でバイナリデータ
          に変換されることがあります。

 -- クラス: email.policy.EmailPolicy (**kw)

     This concrete *note Policy: 1471. 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: 105d. attribute is
     *note EmailMessage: 221.

     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 RFC 2047(10)
          "encoded words".  If ‘True’, follow RFC 6532(11) 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(12)).

          When ‘False’, the generator will raise *note HeaderWriteError:
          1931. if any header includes non-ASCII characters in a context
          where RFC 2047(13) does not permit encoded words.  This
          particularly applies to mailboxes ("addr-spec") with non-ASCII
          characters, which can be created via *note Address: 1933.  To
          use a mailbox with a non-ASCII domain name with ‘utf8=False’,
          first encode the domain using the third-party idna(14) or
          uts46(15) module or with *note encodings.idna: 55.  It is not
          possible to use a non-ASCII username ("local-part") in a
          mailbox when ‘utf8=False’.

          バージョン 3.15 で変更: Can trigger the raising of *note
          HeaderWriteError: 1931.  (Earlier versions incorrectly applied
          RFC 2047(16) in certain contexts, mostly notably in
          addr-specs.)

      -- の属性: refold_source

          If the value for a header in the ‘Message’ object originated
          from a *note parser: 51. (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: 45.) is provided that supports custom parsing
          for the various address and date RFC 5322(17) 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(): 3d44. or *note
          set_content(): 1e73. method of an *note EmailMessage: 221.
          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: 3d7c.

          Added in version 3.4.

     このクラスは *note Policy: 1471. の抽象メソッドの具象実装を提供しま
     す:

      -- メソッド: header_max_count (name)

          Returns the value of the *note max_count: 3d7e. 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: 3d65.
          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():
          1610.  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: 3d68. が
          ‘7bit’ の場合は *note fold(): 1c1a. と同じです。

          If *note cte_type: 3d68. 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: 1475. 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: 222. 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(): 120e. 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: 1475, 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: 786. results in that header
     being parsed and a header object created.

   * Fetching a header value from a *note Message: 786. 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: 221. 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: 45. で述べられてい
ます。

 -- クラス: email.policy.Compat32 (**kw)

     This concrete *note Policy: 1471. 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: 105e, 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: 1471. デフォルトとは異なる値を持ちます:

      -- の属性: mangle_from_

          デフォルトは ‘True’ です。

     このクラスは *note Policy: 1471. の抽象メソッドの具象実装を提供しま
     す:

      -- メソッド: 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: 1e74. object using the ‘unknown-8bit’ charset.
          Otherwise it is returned unmodified.

      -- メソッド: fold (name, value)

          Headers are folded using the *note Header: 1e74. 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: 1e74. 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: 1472. のインスタンスで、Python 3.2 の email パッケ
     ージの挙動との後方互換性を提供します。

          注釈: The *note compat32: 105e. policy should not be used as a
          policy for *note EmailMessage: 221. objects, and should only
          be used to serialize messages that were created using the
          ‘compat32’ policy.

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 13ee.

   (9) https://datatracker.ietf.org/doc/html/rfc5322.html

   (10) https://datatracker.ietf.org/doc/html/rfc2047.html

   (11) https://datatracker.ietf.org/doc/html/rfc6532.html

   (12) https://datatracker.ietf.org/doc/html/rfc6531.html

   (13) https://datatracker.ietf.org/doc/html/rfc2047.html

   (14) https://pypi.org/project/idna/

   (15) https://pypi.org/project/uts46/

   (16) https://datatracker.ietf.org/doc/html/rfc2047.html

   (17) 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: 3e. パッケージが送出しうるすべての例外の基底ク
     ラスです。これは標準の *note Exception: da2. クラスから派生しており
     、追加のメソッドは定義されていません。

 -- 例外: email.errors.MessageParseError

     This is the base class for exceptions raised by the *note Parser:
     155b. class.  It is derived from *note MessageError: 3d8c.  This
     class is also used internally by the parser used by *note
     headerregistry: 45.

 -- 例外: 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: 3d8d.  The *note set_boundary(): 3d39. method
     will raise this error if the content type is unknown when the
     method is called.  *note Header: 1e74. 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(): 3d4b. method is called on an instance
     of a class derived from *note MIMENonMultipart: 3d90. (e.g.  *note
     MIMEImage: 3d91.).  ‘MultipartConversionError’ multiply inherits
     from *note MessageError: 3d8c. and the built-in *note TypeError:
     29c.

 -- 例外: email.errors.HeaderWriteError

     Raised when an error occurs when the *note generator: 43. outputs
     headers.

 -- 例外: email.errors.MessageDefect

     This is the base class for all defects found when parsing email
     messages.  It is derived from *note ValueError: 15a.

 -- 例外: email.errors.HeaderDefect

     This is the base class for all defects found when parsing email
     headers.  It is derived from *note MessageDefect: 3d75.

以下は *note FeedParser: 19ca. がメッセージの解析中に検出する障害
(defect) の一覧です。これらの障害は、問題が見つかったメッセージに追加さ
れるため、たとえば ‘multipart/alternative’ 内にあるネストしたメッセージ
が異常なヘッダをもっていた場合には、そのネストしたメッセージが障害を持っ
ているが、その親メッセージには障害はないとみなされることに注意してくださ
い。

すべての障害クラスは *note email.errors.MessageDefect: 3d75. のサブクラ
スです。

 -- 例外: 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():
     3d3e. 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/main/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: 1ea. のカスタマイズされたサブクラスで表現されます
。 与えられたヘッダーを表現するために使用される特定のクラスは、ヘッダー
が作成されるときに有効な *note policy: 52. の *note header_factory:
3d7b. で決定されます。 このセクションでは、email ライブラリが RFC
5322(3) に準拠したメールメッセージを扱うために実装している、特定の
‘header_factory’ について説明します。このヘッダーは、様々なヘッダータイ
プに対してカスタマイズされたヘッダーオブジェクトを提供するだけでなく、ア
プリケーションが独自のカスタムヘッダータイプを追加できるような拡張メカニ
ズムも備えています。

*note EmailPolicy: 1475. から派生したポリシーオブジェクトのいずれかを使
用する場合、すべてのヘッダーは *note HeaderRegistry: 3da1. によって生成
され、最終的な基底クラスとして *note BaseHeader: 3d26. を有します。 各ヘ
ッダクラスには、ヘッダの種類によって決まる追加のベースクラスがあります。
例えば、多くのヘッダーは *note UnstructuredHeader: 3da2. というクラスを
もうひとつの基底クラスとして持っています。 ヘッダーに特化した第二のクラ
スは、ヘッダーの名前によって決定され、 ‘HeaderRegistry’ に格納されたルッ
クアップテーブルを使用します。 これらすべては、典型的なアプリケーション
プログラムに対しては透過的に管理されますが、より複雑なアプリケーションで
使用するためにデフォルトの動作を変更するためのインタフェースが提供されて
います。

以下のセクションでは、まずヘッダーの基本クラスとその属性を説明し、次に
*note HeaderRegistry: 3da1. の動作を変更するための API、そして最後に構造
化ヘッダーからパースされたデータを表現するためのサポートクラスについて説
明します。

 -- クラス: email.headerregistry.BaseHeader (name, value)

     'name' と 'value' は *note header_factory: 3d7b. 呼び出しから
     ‘BaseHeader’ に渡されます。 どのヘッダーオブジェクトの文字列値も、
     完全にユニコードにデコードされた 'value' です。

     基底クラスは以下の読み出し専用属性を定義しています:

      -- の属性: name

          ヘッダーの名前(フィールドの':'の前の部分)。これは *note
          header_factory: 3d7b. の 'name' の呼び出しで渡された値と全く同
          じです; つまり、大文字・小文字が保持されます。

      -- の属性: defects

          パース中に見つかったRFCのコンプライアンス問題を報告する *note
          HeaderDefect: 3d92. インスタンスのタプルです。 email パッケー
          ジはコンプライアンスに関する問題を完全に検出するように努めてい
          ます。 報告されるかもしれない欠陥の種類の議論については、
          *note errors: 42. モジュールを参照してください。

      -- の属性: max_count

          このタイプのヘッダーで、同じ ‘name’ を持つことができる最大数。
          値として ‘None’ を指定すると、無制限になります。 この属性の
          ‘BaseHeader’ の値は ‘None’ です; 特殊な header クラスでは、必
          要に応じてこの値をオーバーライドすることが期待されます。

     ‘BaseHeader’ は以下のメソッドも提供します。このメソッドはemail ライ
     ブラリのコードから呼び出され、一般にアプリケーションプログラムから
     は呼び出されません：

      -- メソッド: fold (*, policy)

          ヘッダを 'policy' に従って正しく折りたたむために必要な *note
          linesep: 3d70. 文字を含む文字列を返します。 ヘッダには任意のバ
          イナリデータを含めることができないため、 *note cte_type: 3d68.
          が ‘8bit’ の場合は ‘7bit’ と同じように扱われます。 もし *note
          utf8: 222. が ‘False’ であれば、非ASCIIデータは RFC 2047(4) で
          エンコードされます。

     ‘BaseHeader’ 自身はヘッダーオブジェクトを生成するために使用すること
     はできません。このクラスは、それぞれの特殊化ヘッダーがヘッダーオブ
     ジェクトを生成するために協力するプロトコルを定義しています。 具体的
     には、 ‘BaseHeader’ は ‘parse’ という名前の *note classmethod():
     6a0. を特殊化されたクラスが提供することを要求しています。このメソッ
     ドは以下のように呼び出されます:

          parse(string, kwds)

     ‘kwds’ は、初期化されたキー ‘defects’ を含む辞書です。‘defects’ は
     空のリストです。 解析メソッドは、検出された不具合をこのリストに追加
     するべきです。 returnの際には、 ‘kwds’ 辞書に少なくとも ‘decoded’ と
     ''defects'' のキーを含む必要があります。 ‘decoded’ はヘッダの文字列
     値 (つまり、ヘッダを Unicode に完全にデコードした値) でなければなり
     ません。 parseメソッドは、 'string' がcontent-transfer-encodedな部
     分を含む可能性があると仮定すべきですが、エンコードされていないヘッ
     ダ値をパースできるように、すべての有効なUnicode文字も正しく処理する
     必要があります。

     その後、 ‘BaseHeader’ の ‘__new__’ がヘッダのインスタンスを生成し、
     ‘init’ メソッドを呼び出します。 特殊クラスは、 ‘BaseHeader’ が提供
     しない属性を設定したい場合にのみ ‘init’ メソッドを提供する必要があ
     ります。 このような''init'' メソッドは以下のようなものです：

          def init(self, /, *args, **kw):
              self._myattr = kw.pop('myattr')
              super().init(*args, **kw)

     つまり、特殊クラスが ‘kwds’ の辞書に追加したものはすべて削除して処
     理し、 ‘kw``の残りの内容 (と ``args’) は''BaseHeader'' の''init'' メ
     ソッドに渡す必要があるのです。

 -- クラス: email.headerregistry.UnstructuredHeader

     "unstructured" ヘッダは RFC 5322(5) におけるデフォルトのヘッダのタ
     イプです。指定された構文を持たないすべてのヘッダは、unstructuredと
     して扱われます。 構造化されていないヘッダの典型的な例は ‘Subject’ ヘ
     ッダです。

     RFC 5322(6) では、非構造化ヘッダは ASCII 文字セットの任意のテキスト
     の集まりです。しかし、 RFC 2047(7) にはヘッダ値の中で非 ASCII テキ
     ストを ASCII 文字としてエンコードするための RFC 5322(8) と互換性の
     あるメカニズムが備わっています。 エンコードされた単語を含む 'value'
     がコンストラクタに渡されると、 ‘UnstructuredHeader’ パーサは非構造
     化テキストに対する RFC 2047(9) 規則に従って、エンコードされた単語を
     unicode に変換します。 パーサは特定の非適合なエンコードされた単語の
     デコードを試みるためにヒューリスティックを使用します。 このような場
     合、欠陥が登録されます。また、エンコードされた単語やエンコードされ
     ていないテキスト内の無効な文字などの問題に対しても欠陥が登録されま
     す。

     このヘッダ型には追加の属性はありません。

 -- クラス: email.headerregistry.DateHeader

     RFC 5322(10) specifies a very specific format for dates within
     email headers.  The ‘DateHeader’ parser recognizes that date
     format, as well as recognizing a number of variant forms that are
     sometimes found "in the wild".

     このヘッダ型は以下の属性も提供しています:

      -- の属性: datetime

          If the header value can be recognized as a valid date of one
          form or another, this attribute will contain a *note datetime:
          6ed. 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: 3da7. 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: 147f. to record the timezone offset.

     ヘッダーの ‘decoded’ 値は、 ‘datetime’ を RFC 5322(11) のルールに従
     ってフォーマットすることで決定されます。

          email.utils.format_datetime(self.datetime)

     ‘DateHeader’ を作成する際に、 'value' は *note datetime: 6ed. イン
     スタンスである可能性があります。 これは、例えば、次のようなコードは
     有効であり、期待通りの動作をすることを意味します:

          msg['Date'] = datetime(2011, 7, 15, 21)

     これは単純な ‘datetime’ であるため、UTC タイムスタンプとして解釈さ
     れ、結果として ‘-0000’ というタイムゾーンを持つ値になります。 もっ
     と便利なのは *note utils: 53. モジュールの *note localtime(): 576.
     関数を使用することです:

          msg['Date'] = utils.localtime()

     この例では、現在のタイムゾーンオフセットを使用して、日付ヘッダーを
     現在の時刻と日付に設定します。

 -- クラス: email.headerregistry.AddressHeader

     アドレスヘッダは最も複雑な構造のヘッダタイプの1つです。
     ‘AddressHeader’ クラスは、あらゆるアドレスヘッダに対する汎用的なイ
     ンターフェースを提供します。

     このヘッダ型は以下の属性も提供しています:

      -- の属性: groups

          ヘッダー値に含まれるアドレスとグループをエンコードした *note
          Group: 3daa. オブジェクトのタプルです。 グループに属さないアド
          レスは、このリストでは *note display_name: 3dab. が ‘None’ で
          あるシングルアドレスの ‘Groups’ として表現されます。

      -- の属性: addresses

          ヘッダー値に含まれる全ての個別アドレスをエンコードした *note
          Address: 1933. オブジェクトのタプルです。 ヘッダ値にグループが
          含まれている場合、そのグループに含まれる個々のアドレスは、ヘッ
          ダ値でグループが出現した時点でリストに含まれます (つまり、アド
          レスのリストは一次元のリストに「フラット化」されます)。

     The ‘decoded’ value of the header will have all encoded words
     decoded to unicode.  *note idna: 55. encoded domain names are also
     decoded to unicode.  The ‘decoded’ value is set by *note joining:
     2865. the *note str: 1ea. value of the elements of the ‘groups’
     attribute with ‘', '’.

     A list of *note Address: 1933. and *note Group: 3daa. 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: 3da8. の派生クラスです:

      -- の属性: 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: 52.),
          accessing this attribute will result in a *note ValueError:
          15a.

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: 3d7e. 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.

          バージョン 3.15 で変更: It is now a *note frozendict: 18d.
          instead of a *note types.MappingProxyType: 194.

 -- クラス: email.headerregistry.ContentTypeHeader

     ‘Content-Type’ ヘッダを扱う *note ParameterizedMIMEHeader: 3db3. ク
     ラスです。

      -- の属性: content_type

          The content type string, in the form ‘maintype/subtype’.

      -- の属性: maintype

      -- の属性: subtype

 -- クラス: email.headerregistry.ContentDispositionHeader

     ‘Content-Disposition’ ヘッダを扱う *note ParameterizedMIMEHeader:
     3db3. クラスです。

      -- の属性: 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: 1475. 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__:
     1864. 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: 1933. 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/main/Lib/email/headerregistry.py

   (2) Originally added in 3.3 as a *note provisional module: 13ee.

   (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: 7e5. for the full MIME type.

      -- メソッド: set_content (msg, obj, *args, **kw)

          If the ‘maintype’ is ‘multipart’, raise a *note TypeError:
          29c.; otherwise look up a handler function based on the type
          of 'obj' (see next paragraph), call *note clear_content():
          3d4f. 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: 2583. (‘typ.__qualname__’)

             * the type's *note name: 1863. (‘typ.__name__’).

          If none of the above match, repeat all of the checks above for
          each of the types in the *note MRO: 1b1c. (*note typ.__mro__:
          2588.).  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: 7e5. for the fully qualified
          name of the type.

          Also add a ‘MIME-Version’ header if one is not present (see
          also *note MIMEPart: 12eb.).

      -- メソッド: add_get_handler (key, handler)

          Record the function 'handler' as the handler for 'key'.  For
          the possible values of 'key', see *note get_content(): 3dcb.

      -- メソッド: 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():
          3dcd.  For the possible values of 'typekey', see
          ‘set_content()’.

* Menu:

* Content Manager Instances::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/email/contentmanager.py

   (2) Originally added in 3.4 as a *note provisional module: 13ee.


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: 3d7c, although more may be added in the future.
‘raw_data_manager’ is the *note content_manager: 12ea. provided by *note
EmailPolicy: 1475. and its derivatives.

 -- データ: email.contentmanager.raw_data_manager

     This content manager provides only a minimum interface beyond that
     provided by *note Message: 786. 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: 221. object (for
          ‘message/rfc822’ parts), or a ‘bytes’ object (for all other
          non-multipart types).  Raise a *note KeyError: 7e5. 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: 29c. if they are not
               specified.

             * For *note EmailMessage: 221. 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: 15a.

             * For ‘str’ objects, if 'cte' is not set use heuristics to
               determine the most compact encoding.  Prior to encoding,
               *note str.splitlines(): 1610. is used to normalize all
               line boundaries, ensuring that each line of the payload
               is terminated by the current policy's *note linesep:
               3d70. 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: 221, 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: 158d.
               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: 3e. パッケージを使って電子メールメッセージを読む・
書く・送信するいくつかの例を紹介します。より複雑な 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: 51. モジュールにあるクラスを
使用することにより、簡単に実現できます:

     # 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: 786. class is very similar to the *note EmailMessage:
221. 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: 786.) policy *note Compat32: 1472.  If you are going to use
another policy, you should be using the *note EmailMessage: 221. 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: 786. 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: 786. 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: 786. クラスのメソッドは以下のとおりです:

 -- クラス: email.message.Message (policy=compat32)

     If 'policy' is specified (it must be an instance of a *note policy:
     52. class) use the rules it specifies to update and serialize the
     representation of the message.  If 'policy' is not set, use the
     *note compat32: 1472. 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: 786. の変
          更を引き起こす可能性があります (例えば、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: 158c. instance and
          use its *note flatten(): 3d6a. 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(): 12e7. and *note BytesGenerator: 158d.)

          バージョン 3.4 で変更: 'policy' キーワード引数が追加されました
          。

      -- メソッド: __str__ ()

          Equivalent to *note as_string(): 12e6.  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: 786. の変
          更を引き起こす可能性があります (例えば、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: 158d.
          instance and use its *note flatten(): 3d66. 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(): 12e7.  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: 786. 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: 786. オブ
          ジェクトのリストである必要があります。このメソッドの実行後、ペ
          イロードは必ず ‘Message’ オブジェクトのリストになります。ペイ
          ロードにスカラーオブジェクト (文字列など) を格納したい場合は、
          かわりに *note set_payload(): 3dd8. を使ってください。

          This is a legacy method.  On the *note EmailMessage: 221.
          class its functionality is replaced by *note set_content():
          1e73. and the related ‘make’ and ‘add’ methods.

      -- メソッド: get_payload (i=None, decode=False)

          現在のペイロードへの参照を返します。これは *note
          is_multipart(): 3d3e. が ‘True’ の場合 *note Message: 786. オ
          ブジェクトのリストになり、 ‘is_multipart()’ が ‘False’ の場合
          は文字列になります。ペイロードがリストの場合、リストを変更する
          ことはそのメッセージのペイロードを変更することになります。

          オプション引数の 'i' がある場合、 *note is_multipart(): 3d3e.
          が ‘True’ ならば *note get_payload(): 158b. はペイロード中で 0
          から数えて 'i' 番目の要素を返します。 'i' が 0 より小さい場合
          、あるいはペイロードの個数以上の場合は *note IndexError: 18ed.
          が発生します。ペイロードが文字列 (つまり ‘is_multipart()’ が
          ‘False’) にもかかわらず 'i' が与えられたときは *note
          TypeError: 29c. が発生します。

          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: 3d9a. or *note
          InvalidBase64CharactersDefect: 3d9b, 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: 221.
          class its functionality is replaced by *note get_content():
          3d44. and *note iter_parts(): 3d43.

      -- メソッド: set_payload (payload, charset=None)

          メッセージオブジェクト全体のペイロードを 'payload' に設定しま
          す。クライアントはペイロードを変更してはいけません。オプション
          の 'charset' はメッセージのデフォルト文字セットを設定します。
          詳しくは *note set_charset(): 3dd9. を参照してください。

          This is a legacy method.  On the *note EmailMessage: 221.
          class its functionality is replaced by *note set_content():
          1e73.

      -- メソッド: set_charset (charset)

          ペイロードの文字セットを 'charset' に変更します。これは *note
          Charset: 11b6. インスタンス (*note email.charset: 3f. 参照)、
          文字セット名を表す文字列、あるいは ‘None’ のいずれかです。文字
          列を指定した場合は ‘Charset’ インスタンスに変換されます。
          'charset' が ‘None’ の場合、 ‘charset’ 引数は ‘Content-Type’ ヘ
          ッダから除去されます (それ以外にメッセージは変更されません)。
          これら以外のものを文字セットとして指定した場合、 *note
          TypeError: 29c. を送出します。

          ‘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: 11b6. を使って transfer
          エンコードされ、適切な値のヘッダが追加されます。
          ‘Content-Transfer-Encoding’ ヘッダがすでに存在すれば、ペイロー
          ドはすでにその ‘Content-Transfer-Encoding’ によって正しくエン
          コードされたものと見なされ、変形されません。

          This is a legacy method.  On the *note EmailMessage: 221.
          class its functionality is replaced by the 'charset' parameter
          of the *note email.message.EmailMessage.set_content(): 1e73.
          method.

      -- メソッド: get_charset ()

          そのメッセージ中のペイロードの *note Charset: 11b6. インスタン
          スを返します。

          This is a legacy method.  On the *note EmailMessage: 221.
          class it always returns ‘None’.

     以下のメソッドは、メッセージの RFC 2822(2) ヘッダにアクセスするため
     のマップ (辞書) 形式のインタフェイスを実装したものです。これらのメ
     ソッドと、通常のマップ (辞書) 型はまったく同じ意味をもつわけではな
     いことに注意してください。たとえば辞書型では、同じキーが複数あるこ
     とは許されていませんが、ここでは同じメッセージヘッダが複数ある場合
     があります。また、辞書型では *note keys(): 3ddb. で返されるキーの順
     序は保証されていませんが、 *note Message: 786. オブジェクト内のヘッ
     ダはつねに元のメッセージ中に現れた順序、あるいはそのあとに追加され
     た順序で返されます。削除され、その後ふたたび追加されたヘッダはリス
     トの一番最後に現れます。

     こういった意味のちがいは意図的なもので、最大の利便性をもつようにつ
     くられています。

     注意: どんな場合も、メッセージ中のエンベロープヘッダはこのマップ形
     式のインタフェイスには含まれません。

     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:
     1e74. 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: 7e5. 例外は発生しません。

          注意: 指定された名前のフィールドがメッセージのヘッダに2回以上
          現れている場合、どちらの値が返されるかは未定義です。ヘッダに存
          在するフィールドの値をすべて取り出したい場合は *note
          get_all(): 3dde. メソッドを使ってください。

      -- メソッド: __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__(): 78d. 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__(): 1ac2. と似
          ていますが、追加のヘッダ・パラメータをキーワード引数で指定でき
          るところが違っています。 '_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:
          7e5. が発生します。

      -- メソッド: get_content_type ()

          そのメッセージの content-type を返します。返された文字列は強制
          的に小文字で ‘maintype/subtype’ の形式に変換されます。メッセー
          ジ中に ‘Content-Type’ ヘッダがない場合、デフォルトの
          content-type は *note get_default_type(): 3de5. が返す値によっ
          て与えられます。 RFC 2045(5) によればメッセージはつねにデフォ
          ルトの content-type をもっているので、 *note
          get_content_type(): 3de4. はつねになんらかの値を返すはずです。

          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(): 3de4. によって返される文字列の ‘maintype’
          部分です。

      -- メソッド: get_content_subtype ()

          そのメッセージの副 content-type (sub content-type、subtype) を
          返します。これは *note get_content_type(): 3de4. によって返さ
          れる文字列の ‘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(): 3dea. で説明されている形式になります。また、オプ
          ション引数 'unquote' が ‘True’ (デフォルト) である場合、この値
          は unquote されます。

          オプション引数 'failobj' は、 ‘Content-Type’ ヘッダが存在しな
          かった場合に返すオブジェクトです。オプション引数 'header' には
          ‘Content-Type’ のかわりに検索すべきヘッダを指定します。

          This is a legacy method.  On the *note EmailMessage: 221.
          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(): 3deb. に *note
          get_param(): 3dea. の返り値を渡して呼び出すことで、このパラメ
          ータをひとつにまとめることができます。この値がタプルならばこの
          関数は適切にデコードされた 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: 221.
          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: 15a. が発生します。

          このメソッドは ‘Content-Type’ ヘッダを置き換えますが、すべての
          パラメータはそのままにします。 'requote' が ‘False’ の場合、こ
          れはすでに存在するヘッダを quote せず放置しますが、そうでない
          場合は自動的に quote します (デフォルト動作)。

          オプション変数 'header' が与えられた場合、 ‘Content-Type’ のか
          わりにそのヘッダが使用されます。 ‘Content-Type’ ヘッダが設定さ
          れる場合には、 ‘MIME-Version’ ヘッダも同時に付加されます。

          This is a legacy method.  On the *note EmailMessage: 221.
          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(): 3d37. によって unquote されます。

      -- メソッド: get_boundary (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パ
          ラメータの値を返します。目的のヘッダが欠けていたり、
          ‘boundary’ パラメータがない場合には 'failobj' が返されます。返
          される文字列はつねに *note email.utils.unquote(): 3d37. によっ
          て unquote されます。

      -- メソッド: set_boundary (boundary)

          メッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パラメ
          ータに値を設定します。 *note set_boundary(): 3df0. は必要に応
          じて 'boundary' を quote します。そのメッセージが
          ‘Content-Type’ ヘッダを含んでいない場合、 *note
          HeaderParseError: 3d3a. が発生します。

          注意: このメソッドを使うのは、古い ‘Content-Type’ ヘッダを削除
          して新しい boundary をもったヘッダを *note add_header(): 1ac3.
          で足すのとは少し違います。 *note set_boundary(): 3df0. は一連
          のヘッダ中での ‘Content-Type’ ヘッダの位置を保つからです。しか
          し、これは元の ‘Content-Type’ ヘッダ中に存在していた連続する行
          の順番までは '保ちません' 。

      -- メソッド: get_content_charset (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘charset’ パ
          ラメータの値を返します。値はすべて小文字に変換されます。メッセ
          ージ中に ‘Content-Type’ がなかったり、このヘッダ中に
          ‘charaset’ パラメータがない場合には 'failobj' が返されます。

          注意: これは *note get_charset(): 3dda. メソッドとは異なります
          。こちらのほうは文字列のかわりに、そのメッセージボディのデフォ
          ルトエンコーディングの *note Charset: 11b6. インスタンスを返し
          ます。

      -- メソッド: 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(): 3df3. メソッドは多目的のジェネレータで、これはあ
          るメッセージオブジェクトツリー中のすべての 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(): 3d3e. 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: 786. オブジェクトはオプションとして 2つのインスタン
     ス属性をとることができます。これはある MIME メッセージからプレーン
     テキストを生成するのに使うことができます。

      -- の属性: preamble

          MIME ドキュメントの形式では、ヘッダ直後にくる空行と最初の
          multipart 境界をあらわす文字列のあいだにいくらかのテキスト (訳
          注: preamble, 序文) を埋めこむことを許しています。このテキスト
          は標準的な MIME の範疇からはみ出しているので、MIME 形式を認識
          するメールソフトからこれらは通常まったく見えません。しかしメッ
          セージのテキストを生で見る場合、あるいはメッセージを MIME 対応
          していないメールソフトで見る場合、このテキストは目に見えること
          になります。

          'preamble' 属性は MIME ドキュメントに加えるこの最初の MIME 範
          囲外テキストを含んでいます。 *note Parser: 155b. があるテキス
          トをヘッダ以降に発見したが、それはまだ最初の MIME 境界文字列が
          現れる前だった場合、パーザはそのテキストをメッセージの
          'preamble' 属性に格納します。 *note Generator: 158c. がある
          MIME メッセージからプレーンテキスト形式を生成するときメッセー
          ジが 'preamble' 属性を持つことが発見されれば、これはそのテキス
          トをヘッダと最初の MIME 境界の間に挿入します。詳細は *note
          email.parser: 51. および *note email.generator: 43. を参照して
          ください。

          注意: そのメッセージに preamble がない場合、'preamble' 属性に
          は ‘None’ が格納されます。

      -- の属性: epilogue

          'epilogue' 属性はメッセージの最後の MIME 境界文字列からメッセ
          ージ末尾までのテキストを含むもので、それ以外は 'preamble' 属性
          と同じです。

          *note Generator: 158c. でファイル終端に改行を出力するため、
          epilogue に空文字列を設定する必要はなくなりました。

      -- の属性: defects

          'defects' 属性はメッセージを解析する途中で検出されたすべての問
          題点 (defect、障害) のリストを保持しています。解析中に発見され
          うる障害についてのより詳細な説明は *note email.errors: 42. を
          参照してください。

   ---------- 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: 40. in
the new API, but in certain applications these classes may still be
useful, even in non-legacy code.

ふつう、メッセージオブジェクト構造はファイルまたは何がしかのテキストをパ
ーザに通すことで得られます。パーザは与えられたテキストを解析し、基底とな
る root のメッセージオブジェクトを返します。しかし、完全なメッセージオブ
ジェクト構造を何もないところから作成することもまた可能です。個別の *note
Message: 786. を手で作成することさえできます。実際には、すでに存在するメ
ッセージオブジェクト構造をとってきて、そこに新たな ‘Message’ オブジェク
トを追加したり、あるものを別のところへ移動させたりできます。これは MIME
メッセージを切ったりおろしたりするために非常に便利なインターフェイスを提
供します。

新しいメッセージオブジェクト構造は *note Message: 786. インスタンスを作
成することにより作れます。ここに添付ファイルやその他適切なものをすべて手
で加えてやればよいのです。MIME メッセージの場合、 *note email: 3e. パッ
ケージはこれらを簡単におこなえるようにするためにいくつかの便利なサブクラ
スを提供しています。

以下がそのサブクラスです:

 -- クラス: email.mime.base.MIMEBase (_maintype, _subtype, *,
          policy=compat32, **_params)

     モジュール: *note email.mime.base: 4b.

     これはすべての *note Message: 786. の MIME 用サブクラスの基底となる
     クラスです。とくに *note MIMEBase: 3dfa. のインスタンスを直接作成す
     ることは (可能ではありますが) ふつうはしないでしょう。 ‘MIMEBase’ は
     単により特化された MIME 用サブクラスのための便宜的な基底クラスとし
     て提供されています。

     '_maintype' は ‘Content-Type’ の主形式 (maintype) であり (‘text’ や
     ‘image’ など)、 '_subtype' は ‘Content-Type’ の副形式 (subtype) で
     す (‘plain’ や ‘gif’ など)。 '_params' は各パラメータのキーと値を格
     納した辞書であり、これは直接 *note Message.add_header: 1ac3. に渡さ
     れます。

     If 'policy' is specified, (defaults to the *note compat32: 1472.
     policy) it will be passed to *note Message: 786.

     *note MIMEBase: 3dfa. クラスはつねに ('_maintype' 、 '_subtype' 、
     および '_params' にもとづいた) ‘Content-Type’ ヘッダと、
     ‘MIME-Version’ ヘッダ (必ず ‘1.0’ に設定される) を追加します。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.nonmultipart.MIMENonMultipart

     モジュール: *note email.mime.nonmultipart: 4f.

     *note MIMEBase: 3dfa. のサブクラスで、これは ‘multipart’ 形式でない
     MIME メッセージのための中間的な基底クラスです。このクラスのおもな目
     的は、通常 ‘multipart’ 形式のメッセージに対してのみ意味をなす *note
     attach(): 3d4b. メソッドの使用をふせぐことです。もし ‘attach()’ メ
     ソッドが呼ばれた場合、これは *note MultipartConversionError: 3d8f.
     例外を発生します。

 -- クラス: email.mime.multipart.MIMEMultipart (_subtype='mixed',
          boundary=None, _subparts=None, *, policy=compat32, **_params)

     モジュール: *note email.mime.multipart: 4e.

     *note MIMEBase: 3dfa. のサブクラスで、これは ‘multipart’ 形式の
     MIME メッセージのための中間的な基底クラスです。オプション引数
     '_subtype' はデフォルトでは ‘mixed’ になっていますが、そのメッセー
     ジの副形式 (subtype) を指定するのに使うことができます。メッセージオ
     ブジェクトには ‘multipart/_subtype’ という値をもつ ‘Content-Type’ ヘ
     ッダとともに、 ‘MIME-Version’ ヘッダが追加されるでしょう。

     オプション引数 'boundary' は multipart の境界文字列です。これが
     ‘None’ の場合 (デフォルト)、境界は必要に応じて計算されます（例えば
     メッセージがシリアライズされるときなど）。

     '_subparts' はそのペイロードの subpart の初期値からなるシーケンスで
     す。このシーケンスはリストに変換できるようになっている必要がありま
     す。新しい subpart はつねに *note Message.attach: 3d4b. メソッドを
     使ってそのメッセージに追加できるようになっています。

     Optional 'policy' argument defaults to *note compat32: 1472.

     ‘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: 49.

     A subclass of *note MIMENonMultipart: 3d90, 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:
     3dfc. のインスタンスです。ペイロードをエンコードされた形式に変更す
     るために *note get_payload(): 158b. と *note set_payload(): 3dd8. を
     使い、必要に応じて ‘Content-Transfer-Encoding’ やその他のヘッダをメ
     ッセージオブジェクトに追加するべきです。デフォルトのエンコードは
     base64 です。組み込みのエンコーダの一覧は *note email.encoders: 41.
     モジュールを見てください。

     Optional 'policy' argument defaults to *note compat32: 1472.

     '_params' は基底クラスのコンストラクタにそのまま渡されます。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.audio.MIMEAudio (_audiodata, _subtype=None,
          _encoder=email.encoders.encode_base64, *, policy=compat32,
          **_params)

     モジュール: *note email.mime.audio: 4a.

     A subclass of *note MIMENonMultipart: 3d90, 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: 29c. is raised.

     オプション引数の '_encoder' は呼び出し可能なオブジェクト (関数など)
     で、オーディオデータの転送に使う実際のエンコード処理を行います。こ
     の呼び出し可能なオブジェクトは引数を 1 つ取り、それは *note
     MIMEAudio: 3dfd. のインスタンスです。ペイロードをエンコードされた形
     式に変更するために *note get_payload(): 158b. と *note
     set_payload(): 3dd8. を使い、必要に応じて
     ‘Content-Transfer-Encoding’ やその他のヘッダをメッセージオブジェク
     トに追加するべきです。デフォルトのエンコードは base64 です。組み込
     みのエンコーダの一覧は *note email.encoders: 41. モジュールを見てく
     ださい。

     Optional 'policy' argument defaults to *note compat32: 1472.

     '_params' は基底クラスのコンストラクタにそのまま渡されます。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.image.MIMEImage (_imagedata, _subtype=None,
          _encoder=email.encoders.encode_base64, *, policy=compat32,
          **_params)

     モジュール: *note email.mime.image: 4c.

     A subclass of *note MIMENonMultipart: 3d90, 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: 29c. is raised.

     オプション引数の '_encoder' は呼び出し可能なオブジェクト (関数など)
     で、画像データの転送に使う実際のエンコード処理を行います。この呼び
     出し可能なオブジェクトは引数を 1 つ取り、それは *note MIMEImage:
     3d91. のインスタンスです。ペイロードをエンコードされた形式に変更す
     るために *note get_payload(): 158b. と *note set_payload(): 3dd8. を
     使い、必要に応じて ‘Content-Transfer-Encoding’ やその他のヘッダをメ
     ッセージオブジェクトに追加するべきです。デフォルトのエンコードは
     base64 です。組み込みのエンコーダの一覧は *note email.encoders: 41.
     モジュールを見てください。

     Optional 'policy' argument defaults to *note compat32: 1472.

     '_params' は *note MIMEBase: 3dfa. コンストラクタに直接渡されます。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.message.MIMEMessage (_msg, _subtype='rfc822', *,
          policy=compat32)

     モジュール: *note email.mime.message: 4d.

     *note MIMEMessage: 3dfe. クラスは *note MIMENonMultipart: 3d90. の
     サブクラスで、主形式 (maintype) が ‘message’ の MIME オブジェクトを
     作成するのに使われます。ペイロードとして使われるメッセージは '_msg'
     になります。これは *note Message: 786. クラス (あるいはそのサブクラ
     ス) のインスタンスでなければいけません。そうでない場合、この関数は
     *note TypeError: 29c. を発生します。

     オプション引数 '_subtype' はそのメッセージの副形式 (subtype) を設定
     します。デフォルトではこれは ‘rfc822’ になっています。

     Optional 'policy' argument defaults to *note compat32: 1472.

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.text.MIMEText (_text, _subtype='plain',
          _charset=None, *, policy=compat32)

     モジュール: *note email.mime.text: 50.

     *note MIMEText: 11b5. クラスは *note MIMENonMultipart: 3d90. のサブ
     クラスで、主形式 (maintype) が ‘text’ の MIME オブジェクトを作成す
     るのに使われます。ペイロードの文字列は '_text' になります。
     '_subtype' には副形式 (subtype) を指定し、デフォルトは ‘plain’ です
     。 '_charset' はテキストの文字セットで、 ‘MIMENonMultipart’ コンス
     トラクタに引数として渡されます。この値は、文字列が ‘ascii’ コードポ
     イントのみを含む場合 ‘us-ascii’ 、それ以外は ‘utf-8’ がデフォルトに
     なっています。 '_charset' パラメータは、文字列と *note Charset:
     11b6. インスタンスの両方を受け付けます。

     ‘_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: 1472.

     バージョン 3.5 で変更: '_charset' は *note Charset: 11b6. インスタ
     ンスも受け取ります。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 221. クラスの
辞書的な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:
3e. package supports these standards in its ‘email.header’ and *note
email.charset: 3f. 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: 1e74.
class and assign the field in the *note Message: 786. 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: 1e74. インスタンスを作成することによって実現しています。のちにこ
の *note Message: 786. インスタンスからフラットなテキストを生成する際に
、この ‘Subject’ フィールドは RFC 2047(10) 準拠の適切な形式にエンコード
されます。MIME 機能のあるメーラなら、このヘッダに埋めこまれた ISO-8859-1
文字を正しく表示するでしょう。

以下は *note Header: 1e74. クラスの説明です:

 -- クラス: email.header.Header (s=None, charset=None, maxlinelen=None,
          header_name=None, continuation_ws=' ', errors='strict')

     別の文字集合の文字列を含む MIME 準拠なヘッダを作成します。

     オプション引数 's' はヘッダの値の初期値です。これが ‘None’ の場合
     (デフォルト)、ヘッダの初期値は設定されません。この値はあとから
     *note append(): 3e02. メソッドを呼びだすことによって追加することが
     できます。 's' は *note bytes: 1d2. または *note str: 1ea. のインス
     タンスにできます。このセマンティクスについては ‘append()’ の項を参
     照してください。

     オプション引数 'charset' には 2 つの目的があります。ひとつは *note
     append(): 3e02. メソッドにおける '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(): 3e02. メソッドにそのま
     ま渡されます。

      -- メソッド: append (s, charset=None, errors='strict')

          この MIME ヘッダに文字列 's' を追加します。

          オプション引数 'charset' がもし与えられた場合、これは *note
          Charset: 11b6. インスタンス (*note email.charset: 3f. を参照)
          か、あるいは文字集合の名前でなければなりません。この場合は
          ‘Charset’ インスタンスに変換されます。この値が ‘None’ の場合
          (デフォルト)、コンストラクタで与えられた 'charset' が使われま
          す。

          's' は *note bytes: 1d2. または *note str: 1ea. のインスタンス
          です。 ‘bytes’ のインスタンスの場合、 'charset' はその文字列の
          エンコーディングであり、この文字セットでデコードできないときは
          *note UnicodeError: 67c. が発生します。

          's' が *note str: 1ea. のインスタンスの場合、 'charset' はその
          文字列の文字セットを決定するためのヒントとして使われます。

          いずれの場合でも、 RFC 2822(12) 準拠のヘッダを RFC 2047(13) の
          規則を用いて生成する際、文字列は指定された文字セットの出力コー
          デックを用いてエンコードされます。出力コーデックを用いて文字列
          がエンコードできないときは *note UnicodeError: 67c. が発生しま
          す。

          オプションの '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: 1e74. クラスは、標準の演算子や組み込み関数をサポート
     するためのメソッドもいくつか提供しています。

      -- メソッド: __str__ ()

          *note Header: 1e74. の概要を文字列として返します。無制限の行長
          を使用します。すべての箇所は、指定されたエンコーディングを使用
          してUnicodeに変換され、適切に結合されます。文字セット
          ‘'unknown-8bit'’ を持つ箇所は、 ‘'replace'’ エラーハンドラを使
          ってASCIIとしてデコードされます。

          バージョン 3.2 で変更: ‘'unknown-8bit'’ 文字集合の処理が追加さ
          れました。

      -- メソッド: __eq__ (other)

          このメソッドは、ふたつの *note Header: 1e74. インスタンスどう
          しが等しいかどうか判定するのに使えます。

      -- メソッド: __ne__ (other)

          このメソッドは、ふたつの *note Header: 1e74. インスタンスどう
          しが異なっているかどうかを判定するのに使えます。

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: 1d2, 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: 1ea.

     An *note email.errors.HeaderParseError: 3d3a. 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: 3da1.

 -- の関数: email.header.make_header (decoded_seq, maxlinelen=None,
          header_name=None, continuation_ws=' ')

     *note decode_header(): 1478. によって返される 2要素タプルのリストか
     ら *note Header: 1e74. インスタンスを作成します。

     *note decode_header(): 1478. はヘッダの値をとってきて、
     ‘(decoded_string, charset)’ という形式の 2要素タプルからなるリスト
     を返します。ここで 'decoded_string' はデコードされた文字列、
     'charset' はその文字集合です。

     この関数はこれらのリストの項目から、 *note Header: 1e74. インスタン
     スを返します。オプション引数 '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/main/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: 11b6. クラスに加え、文字集合のレジストリとそれを操
作する簡易メソッドを提供しています。 ‘Charset’ インスタンスは *note
email: 3e. パッケージ中にある他のいくつかのモジュールで使用されます。

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: 11b6. インスタンスは以下のようなデータ属性をもってい
     ます:

      -- の属性: 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: 11b6. インスタンスは、以下のメソッドも持っています:

      -- メソッド: 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(): 3e12. と似ていますが、与えられた
          引数 'maxlengths' に従って、行の最大長に合うように文字列が調整
          されるところが異なります。 'maxlengths' はイテレータでなければ
          なりません: このイテレータが返す要素は次の行の最大長を表します
          。

      -- メソッド: body_encode (string)

          文字列 'string' をメッセージ本体用にエンコードします。

          エンコーディングの形式 (base64 または quoted-printable) は、
          'body_encoding' 属性に基づきます。

     *note Charset: 11b6. クラスには、標準的な演算と組み込み関数をサポー
     トするいくつかのメソッドがあります。

      -- メソッド: __str__ ()

          'input_charset' を小文字に変換された文字列型として返します。
          ‘__repr__()’ は、 ‘__str__()’ の別名となっています。

      -- メソッド: __eq__ (other)

          このメソッドは、2つの *note Charset: 11b6. インスタンスが同じ
          かどうかをチェックするのに使います。

      -- メソッド: __ne__ (other)

          このメソッドは、2つの *note Charset: 11b6. インスタンスが異な
          るかどうかをチェックするのに使います。

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(): 3e19. を使ってください。より詳しい情報については
     *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:
     1ea. の *note encode(): cab. メソッドの第 2 引数で使える Python コ
     ーデックの名前です。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 1e73. メソッドの*cte*パラメータ
によって提供されます。

このモジュールはPython3で非推奨になりました。 *note MIMEText: 11b5. クラ
スはクラスのインスタンス化中に渡された '_subtype' と '_charset' の値を使
ってcontent typeとCTEヘッダを設定するので、ここで提供されている関数は明
示的に呼び出すべきではありません。

この節の以降のテキストはモジュールの元々のドキュメントです。

何もないところから *note Message: 786. を作成するときしばしば必要になる
のが、ペイロードをメールサーバに通すためにエンコードすることです。これは
とくにバイナリデータを含んだ ‘image/*’ や ‘text/*’ タイプのメッセージで
必要です。

The *note email: 3e. package provides some convenient encoders in its
‘encoders’ module.  These encoders are actually used by the *note
MIMEAudio: 3dfd. and *note MIMEImage: 3d91. 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: 29c. が発生します。

提供されているエンコーディング関数は以下のとおりです:

 -- の関数: 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/main/Lib/email/encoders.py

   (2) 注意: *note encode_quopri(): 3e1e. を使ってエンコードすると、デー
タ中のタブ文字や空白文字もエンコードされます。


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: 6ed. 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(): 6ff. の逆で、2 要素のタプル ‘(realname,
     email_address)’ を取って ‘To’ や ‘Cc’ ヘッダに適した文字列を返しま
     す。タプル 'pair' の第1要素が偽である場合、第2要素の値をそのまま返
     します。

     任意の 'charset' は、 ‘realname’ が非 ASCII 文字を含んでいる場合に
     その RFC 2047(3) エンコーディングに使われる文字集合です。*note str:
     1ea. か *note Charset: 11b6. のインスタンスで、デフォルトは ‘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: 3dde.

     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(): 3e27. は正しく推測しようとします。 'date' は
     ‘"Mon, 20 Nov 1995 19:12:08 -0500"’ のような RFC 2822(5) 形式の日付
     を含む文字列です。 日付の解析に成功した場合、 ‘parsedate()’ は関数
     *note time.mktime(): 15a7. に直接渡せる形式の 9 要素からなるタプル
     を返します。 失敗した場合は ‘None’ を返します。 返されるタプルの 6、
     7、8番目の添字は使用不可なので注意してください。

 -- の関数: email.utils.parsedate_tz (date)

     Performs the same function as *note parsedate(): 3e27, 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(): 15a7, 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(): 147d.  Performs the same
     function as *note parsedate(): 3e27, but on success returns a *note
     datetime: 6ed.; 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: 147f. *note tzinfo: 9dd.

     Added in version 3.3.

 -- の関数: email.utils.mktime_tz (tuple)

     *note parsedate_tz(): 1e39. が返す 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(): 157e. and *note time.localtime():
     18b1, 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: 33. 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: 3dea. は 3 要素からなるタプルを返すことが
     あります。ここには、そのパラメータの文字セット、言語、および値の順
     に格納されています。 *note collapse_rfc2231_value(): 3deb. はこのパ
     ラメータをひとつの Unicode 文字列にまとめます。オプション引数
     'errors' は *note str: 1ea. の *note encode(): cab. メソッドの引数
     'errors' に渡されます。このデフォルト値は ‘'replace'’ となっていま
     す。オプション引数 'fallback_charset' は、もし RFC 2231(11) ヘッダ
     の使用している文字セットが Python の知っているものではなかった場合
     の非常用文字セットとして使われます。デフォルトでは、この値は
     ‘'us-ascii'’ です。

     便宜上、 *note collapse_rfc2231_value(): 3deb. に渡された引数
     'value' がタプルでない場合には、これは文字列でなければなりません。
     その場合にはクォートを除いた文字列を返します。

 -- の関数: email.utils.decode_params (params)

     RFC 2231(12) に従って引数のリストをデコードします。 'params' は
     ‘(content-type, string-value)’ のような形式の 2 要素タプルです。

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 3df3. 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(): 22b4. を使っ
     て、ファイルからメッセージを (ヘッダだけとばして) フラットなテキス
     トとして読むのにいくぶん似ているかもしれません。

     オプション引数 'decode' は、 *note Message.get_payload: 158b. にそ
     のまま渡されます。

 -- の関数: email.iterators.typed_subpart_iterator (msg,
          maintype='text', subtype=None)

     このイテレータは 'msg' 中のすべてのサブパートをたどり、それらの中で
     指定されたMIME 形式 'maintype' と 'subtype' をもつようなパートのみ
     を返します。

     'subtype' は省略可能であることに注意してください。これが省略された
     場合、サブパートの MIME 形式は maintype のみがチェックされます。じ
     つは 'maintype' も省略可能で、その場合にはデフォルトは ‘text’ です
     。

     つまり、デフォルトでは *note typed_subpart_iterator(): 3e2f. は
     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(): 1324. 関数が対応できるようになって
     いる必要があります。 'level' は内部的に使用されます。
     'include_default' が真の場合、デフォルトの型も出力します。

参考
....

*note smtplib: d2. モジュール

     SMTP（簡易メール転送プロトコル）クライアント

*note poplib: b1. モジュール

     POP (Post Office Protocol) クライアント

モジュール *note imaplib: 77.

     IMAP (Internet Message Access Protocol) クライアント

*note mailbox: 8e. モジュール

     Tools for creating, reading, and managing collections of messages
     on disk using a variety standard formats.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: 90. や *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: 1100. の拡張:

     >>> 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 コマンドライン・インターフェース: 4d2. を参照してく
ださい。

     注釈: JSON は YAML(8) 1.2 のサブセットです。このモジュールのデフォ
     ルト設定 (特に、デフォルトの 'セパレータ' 値) で生成される JSON は
     YAML 1.0 および 1.1 のサブセットでもあります。このモジュールは YAML
     シリアライザとしても使えます。

     注釈: このモジュールのエンコーダとデコーダは、デフォルトで入力順と
     出力順を保つようになっています。根底のコンテナに順序がない場合のみ
     、順序が失われます。

* Menu:

* 基本的な使い方: 基本的な使い方<4>.
* エンコーダとデコーダ::
* 例外: 例外<21>.
* 標準への準拠と互換性::
* コマンドライン・インターフェース: コマンドライン・インターフェース<5>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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への変換表: 3e35. を使って、 'obj' を JSON
     形式の 'fp' (‘.write()’ がサポートされている *note file-like
     object: 19d1.) へのストリームとして直列化します。

          注釈: *note pickle: ab. や *note marshal: 90. とは異なり JSON
          はフレーム付きのプロトコルではないので、同じ 'fp' に対し繰り返
          し *note dump(): 10ff. を呼び、複数のオブジェクトを直列化しよ
          うとすると、不正な JSON ファイルが作られてしまいます。


     パラメータ:

        * ‘obj’ (*note object: e51.) - The Python object to be
          serialized.

        * ‘fp’ (*note file-like object: 19d1.) - The file-like object
          'obj' will be serialized to.  The ‘json’ module always
          produces *note str: 1ea. objects, not *note bytes: 1d2.
          objects, therefore ‘fp.write()’ must support ‘str’ input.

        * ‘skipkeys’ (*note bool: 5f6.) - If ‘True’, keys that are not
          of a basic type (*note str: 1ea, *note int: 32e, *note float:
          32f, ‘bool’, ‘None’) will be skipped instead of raising a
          *note TypeError: 29c.  Default ‘False’.

        * ‘ensure_ascii’ (*note bool: 5f6.) - 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: 5f6.) - If ‘False’, the circular
          reference check for container types is skipped and a circular
          reference will result in a *note RecursionError: 1125. (or
          worse).  Default ‘True’.

        * ‘allow_nan’ (*note bool: 5f6.) - If ‘False’, serialization of
          out-of-range *note float: 32f. values (‘nan’, ‘inf’, ‘-inf’)
          will result in a *note ValueError: 15a, in strict compliance
          with the JSON specification.  If ‘True’ (the default), their
          JavaScript equivalents (‘NaN’, ‘Infinity’, ‘-Infinity’) are
          used.

        * ‘cls’ (a *note JSONEncoder: 1100. subclass) - If set, a custom
          JSON encoder with the *note default(): 3e36. method
          overridden, for serializing into custom datatypes.  If ‘None’
          (the default), ‘JSONEncoder’ is used.

        * ‘indent’ (*note int: 32e.‘ | ’*note str: 1ea.‘ | ’‘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: 1d9.‘ | ’‘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: 2fba. | 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: 29c.  If ‘None’ (the default), ‘TypeError’
          is raised.

        * ‘sort_keys’ (*note bool: 5f6.) - If ‘True’, dictionaries will
          be outputted sorted by key.  Default ‘False’.

     バージョン 3.2 で変更: 整数に加えて、文字列が 'indent' に使用できる
     ようになりました。

     バージョン 3.4 で変更: 'indent' が ‘None’ でなければ ‘(',', ': ')’
     がデフォルトで使われます。

     バージョン 3.6 で変更: すべてのオプション引数は、 *note
     キーワード専用: 7a9. になりました。

 -- の関数: 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 変換表: 3e35. を使って、'obj' を JSON 形式の *note str:
     1ea. オブジェクトに直列化します。引数は *note dump(): 10ff. と同じ
     意味です。

          注釈: JSON のキー値ペアのキーは、常に *note str: 1ea. 型です。
          辞書が 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, array_hook=None, **kw)

     Deserialize 'fp' to a Python object using the *note JSON-to-Python
     conversion table: 3e37.


     パラメータ:

        * ‘fp’ (*note file-like object: 19d1.) - A ‘.read()’-supporting
          *note text file: 227a. or *note binary file: 227b. containing
          the JSON document to be deserialized.

        * ‘cls’ (a *note JSONDecoder: 1101. 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: 2fba. | None) - If set, a
          function that is called with the result of any JSON object
          literal decoded (a *note dict: 193.).  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: 2fba. | 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:
          193.  This feature can be used to implement custom decoders.
          If 'object_hook' is also set, 'object_pairs_hook' takes
          priority.  Default ‘None’.

        * ‘array_hook’ (*note callable: 2fba. | None) - If set, a
          function that is called with the result of any JSON array
          literal decoded with as a Python list.  The return value of
          this function will be used instead of the *note list: 4e0.
          This feature can be used to implement custom decoders.
          Default ‘None’.

        * ‘parse_float’ (*note callable: 2fba. | 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: 1cd.

        * ‘parse_int’ (*note callable: 2fba. | 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: 32f.

        * ‘parse_constant’ (*note callable: 2fba. | 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: 11d9. - When the data being
          deserialized is not a valid JSON document.

        * *note UnicodeDecodeError: ddb. - 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 キーワード専用: 7a9. になりま
          した。

        * 'fp' には *note binary file: 227b. 型も使えるようになりました
          。入力のエンコーディングは UTF-8, UTF-16, UTF-32 のいずれかで
          なければなりません。

     バージョン 3.11 で変更: デフォルトの 'parse_int' である *note
     int(): 32e. は、インタープリタの *note integer string conversion
     length limitation: 9f1. により整数文字列の最大長を制限するようにな
     り、サービスを妨害する攻撃を拒否します。

     バージョン 3.15 で変更: Added the optional 'array_hook' parameter.

 -- の関数: json.loads (s, *, cls=None, object_hook=None,
          parse_float=None, parse_int=None, parse_constant=None,
          object_pairs_hook=None, array_hook=None, **kw)

     Identical to *note load(): 239, but instead of a file-like object,
     deserialize 's' (a *note str: 1ea, *note bytes: 1d2. or *note
     bytearray: 1d1. instance containing a JSON document) to a Python
     object using this *note conversion table: 3e37.

     バージョン 3.6 で変更: 's' には *note bytes: 1d2. 型と *note
     bytearray: 1d1. 型も使えるようになりました。 入力エンコーディングは
     UTF-8, UTF-16, UTF-32 のいずれかでなければなりません。

     バージョン 3.9 で変更: キーワード引数 'encoding' が削除されました。

   ---------- Footnotes ----------

   (1) https://www.jsonrpc.org


File: python.info,  Node: エンコーダとデコーダ,  Next: 例外<21>,  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, array_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: 193.  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: 193.  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' のサポートが追加されまし
     た。

     'array_hook' is an optional function that will be called with the
     result of every JSON array decoded as a list.  The return value of
     'array_hook' will be used instead of the *note list: 4e0.  This
     feature can be used to implement custom decoders.

     バージョン 3.15 で変更: Added support for 'array_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:
     1cd.).

     '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: 32f.).

     '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: 11d9. が送出されます。

     バージョン 3.6 で変更: すべての引数は、 *note キーワード専用: 7a9.
     になりました。

      -- メソッド: decode (s)

          's' (*note str: 1ea. インスタンスで JSON 文書を含むもの) の
          Python 表現を返します。

          不正な JSON ドキュメントが与えられた場合、 *note
          JSONDecodeError: 11d9. が送出されます。

      -- メソッド: raw_decode (s)

          's' (*note str: 1ea. インスタンスで 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(): 3e36. メソッドを次のように実装しま
     す。もう一つ別のメソッドでオブジェクト ‘o’ に対する直列化可能なオブ
     ジェクトを返すものを呼び出すようにします。変換できない時はスーパー
     クラスの実装を (*note TypeError: 29c. を送出させるために) 呼ばなけ
     ればなりません。

     If 'skipkeys' is false (the default), a *note TypeError: 29c. will
     be raised when trying to encode keys that are not *note str: 1ea,
     *note int: 32e, *note float: 32f, *note bool: 5f6. 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: 1125. を引き起こし
     ます) を防止します。 ‘True’ でない場合は、そういったチェックは施さ
     れません。

     'allow_nan' が true (デフォルト) ならば、 ‘NaN’, ‘Infinity’,
     ‘-Infinity’ はそのままエンコードされます。この振る舞いは JSON 仕様
     に従っていませんが、大半の JavaScript ベースのエンコーダ、デコーダ
     と矛盾しません。 ‘True’ でない場合は、そのような浮動小数点数をエン
     コードすると *note ValueError: 15a. が送出されます。

     '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: 29c. を送出しなければなりません。 指定しない場
     合は、 ‘TypeError’ が送出されます。

     バージョン 3.6 で変更: すべての引数は、 *note キーワード専用: 7a9.
     になりました。

      -- メソッド: default (o)

          このメソッドをサブクラスで実装する際には 'o' に対して直列化可
          能なオブジェクトを返すか、基底クラスの実装を (*note TypeError:
          29c. を送出するために) 呼び出すかします。

          例えば、任意のイテレータをサポートする場合、 *note default():
          3e36. をこのように実装できます

               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: 例外<21>,  Next: 標準への準拠と互換性,  Prev: エンコーダとデコーダ,  Up: json --- JSON エンコーダーとデコーダー

5.21.2.3 例外
.............

 -- 例外: json.JSONDecodeError (msg, doc, pos)

     *note ValueError: 15a. のサブクラスで、以下の追加の属性を持ちます:

      -- の属性: msg

          フォーマットされていないエラーメッセージです。

      -- の属性: doc

          パース対象 JSON ドキュメントです。

      -- の属性: pos

          'doc' の、解析に失敗した開始インデクスです。

      -- の属性: lineno

          'pos' に対応する行です。

      -- の属性: colno

          'pos' に対応する列です。

     Added in version 3.5.


File: python.info,  Node: 標準への準拠と互換性,  Next: コマンドライン・インターフェース<5>,  Prev: 例外<21>,  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: 1100. and *note JSONDecoder: 1101.
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 文字列: 1ea. の間の変換において厳密に定義されていて、それ
以外のパラメータで文字エンコーディングに直接的に関わるものはありません。

RFC は JSON テキストの最初にバイトオーダマーク(BOM)を追加することを禁止
していますので、このモジュールはその出力に BOM を追加しません。RFC は
JSON デシリアライザが入力の一番最初の BOM を無視することを、許容はします
が求めてはいません。このモジュールのデシリアライザは一番最初の BOM を見
つけると *note ValueError: 15a. を送出します。

RFC は JSON 文字列に正当な Unicode 文字に対応付かないバイト列(例えばペア
にならない UTF-16 サロゲートのかたわれ)が含まれることを明示的に禁止して
はおらず、もちろんこれは相互運用性の問題を引き起こします。デフォルトでは
、このモジュールは(オリジナルの *note str: 1ea. にある場合)そのようなシ
ーケンスのコードポイントを受け取り、出力します。


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: 193. か *note list: 4e0.)であることを要求していて、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: 32e. をシリアライズするとき、あるいは *note decimal.Decimal:
1cd. のような "風変わりな" 数値型をシリアライズするとき、に特に関係があ
ります。


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: 94f. と *note sys.stdout: ea0. が使用されます。

     $ 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: 3e49. オ
プションを使ってください。

バージョン 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/main/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: 94f. から読み込みま
     す。

 -- Option: outfile

     'infile' の出力を 'outfile' に書き込みます。そうでない場合、 *note
     sys.stdout: ea0. に書き込みます。

 -- Option: --sort-keys

     辞書の出力を、キーのアルファベット順にソートします。

     Added in version 3.5.

 -- Option: --no-ensure-ascii

     非 ASCII 文字のエスケープを無効化します。より詳しくは *note
     json.dumps(): 254. を参照してください。

     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: 1605. および *note
Message: 160a. をディスク上のメールボックスとそこに収められたメッセージ
へのアクセスと操作のために定義しています。 ‘Mailbox’ は辞書のようなキー
からメッセージへの対応付けを提供しています。 ‘Message’ は *note
email.message: 47. モジュールの *note Message: 786. を拡張して形式ごとの
状態と振る舞いを追加しています。サポートされるメールボックスの形式は
Maildir, mbox, MH, Babyl, MMDF です。

参考
....

*note email: 3e. モジュール

     メッセージの表現と操作。

* Menu:

* Mailbox オブジェクト::
* Message オブジェクト::
* 例外: 例外<22>.
* 使用例: 使用例<31>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 1606. を使います。また削除は ‘del’ 文または集合風の
     *note remove(): 3e5a. や *note discard(): 3e5b. を使って行ないます
     。

     ‘Mailbox’ インターフェースのセマンティクスと辞書のそれとは注意すべ
     き違いがあります。メッセージは、要求されるたびに新しい表現(典型的に
     は *note Message: 160a. インスタンス)が現在のメールボックスの状態に
     基づいて生成されます。同様に、メッセージが ‘Mailbox’ インスタンスに
     追加される時も、渡されたメッセージ表現の内容がコピーされます。どち
     らの場合も ‘Mailbox’ インスタンスにメッセージ表現への参照は保たれま
     せん。

     デフォルトの ‘Mailbox’ *note イテレータ: 6d4. はメッセージ表現ごと
     に繰り返すもので、*note 辞書: 193. のイテレータのようにキーごとの繰
     り返しではありません。さらに、繰り返し中のメールボックスを変更する
     ことは安全であり整合的に定義されています。イテレータが作られた後に
     メールボックスに追加されたメッセージはそのイテレータからは見えませ
     ん。そのイテレータが yield するまえにメールボックスから削除されたメ
     ッセージは黙ってスキップされますが、イテレータからのキーを使ったと
     きにはそのキーに対応するメッセージが削除されているならば *note
     KeyError: 7e5. を受け取ることになります。

          警告: 十分な注意を、何か他のプロセスによっても同時に変更される
          可能性のあるメールボックスを更新する時は、払わなければなりませ
          ん。そのようなタスクをこなすのに最も安全なメールボックス形式は
          *note Maildir: 851. で、 *note mbox: 1c22. のような単一ファイ
          ルの形式を並行した書き込みに利用するのは避けるように努力しまし
          ょう。メールボックスを更新する場面では、 '必ず' *note lock():
          3e5c. と *note unlock(): 3e5d. メソッドを、ファイル内のメッセ
          ージを読んだり書き込んだり削除したりといった操作をする '前' に
          、呼び出してロックします。メールボックスをロックし損なうと、メ
          ッセージを失ったりメールボックス全体をぐちゃぐちゃにしたりする
          羽目に陥ります。

     The ‘Mailbox’ class supports the *note with: 215. statement.  When
     used as a context manager, ‘Mailbox’ calls *note lock(): 3e5c. when
     the context is entered, returns the mailbox object as the context
     object, and at context end calls *note close(): 3e5e, thereby
     releasing the lock.

     バージョン 3.15 で変更: *note with: 215. 構文のサポートが追加されま
     した。

     ‘Mailbox’ インスタンスには次のメソッドがあります:

      -- メソッド: add (message)

          メールボックスに 'message' を追加し、それに割り当てられたキー
          を返します。

          引数 'message' は *note Message: 160a. インスタンス、 *note
          email.message.Message: 786. インスタンス、文字列、バイト文字列
          、ファイル風オブジェクト (バイナリモードで開かれていなければな
          りません) を使えます。 'message' が適切な形式に特化した
          ‘Message’ サブクラスのインスタンス (例えばメールボックスが
          *note mbox: 1c22. インスタンスのときの *note mboxMessage:
          3d1f. インスタンス) であれば、形式ごとの情報が利用されます。そ
          うでなければ、形式ごとに必要な情報は適当なデフォルトが使われま
          す。

          バージョン 3.2 で変更: バイナリ入力のサポートが追加されました
          。

      -- メソッド: remove (key)
      -- メソッド: __delitem__ (key)
      -- メソッド: discard (key)

          メールボックスから 'key' に対応するメッセージを削除します。

          対応するメッセージが無い場合、メソッドが *note remove(): 3e5a.
          または *note __delitem__(): 3e5f. として呼び出されている時は
          *note KeyError: 7e5. 例外が送出されます。しかし、 *note
          discard(): 3e5b. として呼び出されている場合は例外は発生しませ
          ん。基づいているメールボックス形式が別のプロセスからの平行した
          変更をサポートしているならば、この ‘discard()’ の振る舞いの方
          が好まれるかもしれません。

      -- メソッド: __setitem__ (key, message)

          'key' に対応するメッセージを 'message' で置き換えます。 'key'
          に対応しているメッセージが既に無くなっている場合 *note
          KeyError: 7e5. 例外が送出されます。

          *note add(): 1606. と同様に、引数の 'message' には *note
          Message: 160a. インスタンス、 *note email.message.Message:
          786. インスタンス、文字列、バイト文字列、ファイル風オブジェク
          ト (バイナリモードで開かれていなければなりません) を使えます。
          'message' が適切な形式に特化した ‘Message’ サブクラスのインス
          タンス (例えばメールボックスが *note mbox: 1c22. インスタンス
          のときの *note mboxMessage: 3d1f. インスタンス) であれば、形式
          ごとの情報が利用されます。そうでなければ、現在 'key' に対応す
          るメッセージの形式ごとの情報が変更されずに残ります。

      -- メソッド: iterkeys ()

          Return an *note iterator: 6d4. over all keys

      -- メソッド: keys ()

          The same as *note iterkeys(): 3e61, except that a *note list:
          4e0. is returned rather than an *note iterator: 6d4.

      -- メソッド: itervalues ()
      -- メソッド: __iter__ ()

          全てのメッセージの表現についての *note イテレータ: 6d4. を返し
          ます。メッセージは適切な形式ごとの *note Message: 160a. サブク
          ラスのインスタンスとして表現されるのが普通ですが、 ‘Mailbox’ イ
          ンスタンスが初期化されるときに指定すればお好みのメッセージファ
          クトリを使うこともできます。

               注釈: *note __iter__(): 3e64. は辞書のそれのようにキーに
               ついてのイテレータではありません。

      -- メソッド: values ()

          The same as *note itervalues(): 3e63, except that a *note
          list: 4e0. is returned rather than an *note iterator: 6d4.

      -- メソッド: iteritems ()

          ('key', 'message') ペア、ただし 'key' はキーで 'message' はメ
          ッセージ表現、のイテレータを返します。メッセージは適切な形式ご
          との *note Message: 160a. サブクラスのインスタンスとして表現さ
          れるのが普通ですが、 ‘Mailbox’ インスタンスが初期化されるとき
          に指定すればお好みのメッセージファクトリを使うこともできます。

      -- メソッド: items ()

          The same as *note iteritems(): 3e66, except that a *note list:
          4e0. of pairs is returned rather than an *note iterator: 6d4.
          of pairs.

      -- メソッド: get (key, default=None)
      -- メソッド: __getitem__ (key)

          'key' に対応するメッセージの表現を返します。対応するメッセージ
          が存在しない場合、 *note get(): 3e68. として呼び出されたなら
          'default' を返しますが、 ‘__getitem__()’ として呼び出されたな
          ら *note KeyError: 7e5. 例外が送出されます。メッセージは適切な
          形式ごとの *note Message: 160a. サブクラスのインスタンスとして
          表現されるのが普通ですが、 ‘Mailbox’ スタンスが初期化されると
          きに指定すればお好みのメッセージファクトリを使うこともできます
          。

      -- メソッド: get_message (key)

          'key' に対応するメッセージの表現を形式ごとの *note Message:
          160a. サブクラスのインスタンスとして返します。もし対応するメッ
          セージが存在しなければ *note KeyError: 7e5. 例外が送出されます
          。

      -- メソッド: get_bytes (key)

          'key' に対応するメッセージのバイト列を返すか、そのようなメッセ
          ージが存在しない場合は *note KeyError: 7e5. 例外を送出します。

          Added in version 3.2.

      -- メソッド: get_string (key)

          'key' に対応するメッセージの文字列表現を返すか、そのようなメッ
          セージが存在しない場合は *note KeyError: 7e5. 例外を送出します
          。このメッセージは *note email.message.Message: 786. を通して
          処理されて7ビットクリーンな表現へ変換されます。

      -- メソッド: get_file (key)

          'key' に対応するメッセージの表現を *note ファイル風: 19d1. 表
          現として返します。もし対応するメッセージが存在しなければ *note
          KeyError: 7e5. 例外が送出されます。ファイル風オブジェクトはバ
          イナリモードで開かれているように振る舞います。このファイルは必
          要がなくなったら閉じなければなりません。

          バージョン 3.2 で変更: ファイルオブジェクトは実際は *note
          バイナリファイル: 227b. です; 以前は誤ってテキストモードで返さ
          れていました。 また、現在 *note ファイル風オブジェクト: 19d1.
          は *note コンテキストマネージャ: 47f. プロトコルをサポートして
          います: *note with: 215. 文を用いることで自動的にファイルを閉
          じることができます。

               注釈: 他の表現方法とは違い、*note ファイル風: 19d1. 表現
               はそれを作り出した ‘Mailbox’ インスタンスやそれが基づいて
               いるメールボックスと独立である必要がありません。より詳細
               な説明は各サブクラスごとにあります。

      -- メソッド: __contains__ (key)

          'key' がメッセージに対応していれば ‘True’ を、そうでなければ
          ‘False’ を返します。

      -- メソッド: __len__ ()

          メールボックス中のメッセージ数を返します。

      -- メソッド: clear ()

          メールボックスから全てのメッセージを削除します。

      -- メソッド: pop (key, default=None)

          'key' に対応するメッセージの表現を返します。メッセージは適切な
          形式ごとの *note Message: 160a. サブクラスのインスタンスとして
          表現されるのが普通ですが、 ‘Mailbox’ インスタンスが初期化され
          るときに指定すればお好みのメッセージファクトリを使うこともでき
          ます。

      -- メソッド: popitem ()

          任意に選んだ ('key', 'message') ペアを返します。ただしここで
          'key' はキーで 'message' はメッセージ表現です。もしメールボッ
          クスが空ならば、 *note KeyError: 7e5. 例外を送出します。メッセ
          ージは適切な形式ごとの *note Message: 160a. サブクラスのインス
          タンスとして表現されるのが普通ですが、 ‘Mailbox’ インスタンス
          が初期化されるときに指定すればお好みのメッセージファクトリを使
          うこともできます。

      -- メソッド: update (arg)

          引数 'arg' は 'key' から 'message' へのマッピングまたは
          ('key', 'message') ペアのイテレート可能オブジェクトでなければ
          なりません。メールボックスは、各 'key' と 'message' のペアにつ
          いて *note __setitem__(): 3e60. を使ったかのように 'key' に対
          応するメッセージが 'message' になるように更新されます。
          ‘__setitem__()’ と同様に、 'key' は既存のメールボックス中のメ
          ッセージに対応しているものでなければならず、そうでなければ
          *note KeyError: 7e5. が送出されます。ですから、一般的には
          'arg' に ‘Mailbox’ インスタンスを渡すのは間違いです。

               注釈: 辞書と違い、キーワード引数はサポートされていません
               。

      -- メソッド: flush ()

          保留されている変更をファイルシステムに書き込みます。 *note
          Mailbox: 1605. のサブクラスによっては変更はいつも直ちにファイ
          ルに書き込まれ ‘flush()’ は何もしないということもありますが、
          それでもこのメソッドを呼ぶように習慣付けておきましょう。

      -- メソッド: lock ()

          メールボックスの排他的アドバイザリロックを取得し、他のプロセス
          が変更しないようにします。ロックが取得できない場合 *note
          ExternalClashError: 3e71. が送出されます。ロック機構はメールボ
          ックス形式によって変わります。メールボックスの内容に変更を加え
          るときは 'いつも' ロックを掛けるべきです。

      -- メソッド: 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: 1605. のサブク
     ラス。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモ
     ードで開かれているかのように振る舞う)ファイル風メッセージ表現を受け
     付けて好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MaildirMessage: 3e74. がデフォルトのメッセージ表現として使われます
     。 '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: 1605. の全てのメソッドに
     加え以下のメソッドもあります:

      -- メソッド: list_folders ()

          全てのフォルダ名のリストを返します。

      -- メソッド: get_folder (folder)

          名前が 'folder' であるフォルダを表わす ‘Maildir’ インスタンス
          を返します。そのようなフォルダが存在しなければ *note
          NoSuchMailboxError: 3e78. 例外が送出されます。

      -- メソッド: add_folder (folder)

          名前が 'folder' であるフォルダを作り、それを表わす ‘Maildir’ イ
          ンスタンスを返します。

      -- メソッド: remove_folder (folder)

          名前が 'folder' であるフォルダを削除します。もしフォルダに一つ
          でもメッセージが含まれていれば *note NotEmptyError: 3e7b. 例外
          が送出されフォルダは削除されません。

      -- メソッド: 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: 3e74. object, use its
          *note get_flags(): 3e7d. method instead, because changes made
          by the message's *note set_flags(): 3e7e, *note add_flag():
          3e7f. and *note remove_flag(): 3e80. methods are not reflected
          here until the mailbox's *note __setitem__(): 3e81. 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: 3e74. object, use its
          *note set_flags(): 3e7e. method instead, because changes made
          with this mailbox method will not be visible to the message
          object's method, *note get_flags(): 3e7d.

          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(): 3e7f. method are similar to those
          for *note set_flags(): 1c6c.; 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(): 3e80. method are similar to
          those for *note set_flags(): 1c6c.; 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: 3e74. object, use its
          *note get_info(): 3e82. method instead, because changes made
          by the message's *note set_info(): 3e83. method are not
          reflected here until the mailbox's *note __setitem__(): 3e81.
          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: 3e74. object, use its
          *note set_info(): 3e83. method instead, because changes made
          with this mailbox method will not be visible to the message
          object's method, *note get_info(): 3e82.

          Added in version 3.13.

     ‘Maildir’ で実装された *note Mailbox: 1605. のいくつかのメソッドに
     は特別な注意が必要です:

      -- メソッド: 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: 1605. のサブクラス
     。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモード
     で開かれているかのように振る舞う)ファイル風メッセージ表現を受け付け
     て好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     mboxMessage: 3d1f. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     mbox 形式は Unixシステム上でメールを保存する古くからある形式です。
     mbox メールボックスでは全てのメッセージが一つのファイルに保存されて
     おりそれぞれのメッセージは "From " という5文字で始まる行を先頭に付
     けられています。

     mbox 形式には幾つかのバリエーションがあり、それぞれオリジナルの形式
     にあった欠点を克服すると主張しています。互換性のために、 ‘mbox’ は
     オリジナルの(時に 'mboxo' と呼ばれる) 形式を実装しています。すなわ
     ち、 ‘Content-Length’ ヘッダはもしあっても無視され、メッセージのボ
     ディにある行頭の "From " はメッセージを保存する際に ">From " に変換
     されますが、この ">From " は読み出し時にも "From " に変換されません
     。

     ‘mbox’ で実装された *note Mailbox: 1605. のいくつかのメソッドには特
     別な注意が必要です:

      -- メソッド: 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(): 1bea. や
          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: 1605. のサブクラス。
     パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモードで
     開かれているかのように振る舞う)ファイル風メッセージ表現を受け付けて
     好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MHMessage: 3e94. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     MH はディレクトリに基づいたメールボックス形式で MH Message Handling
     System というメールユーザエージェントのために発明されました。 MH メ
     ールボックス中のそれぞれのメッセージは一つのファイルとして収められ
     ています。 MH メールボックスにはメッセージの他に別の MH メールボッ
     クス ('フォルダ' と呼ばれます)を含んでもかまいません。フォルダは無
     限にネストできます。 MH メールボックスにはもう一つ 'シーケンス' と
     いう名前付きのリストでメッセージをサブフォルダに移動することなく論
     理的に分類するものがサポートされています。シーケンスは各フォルダの
     ‘.mh_sequences’ というファイルで定義されます。

     ‘MH’ クラスは MH メールボックスを操作しますが、 ‘mh’ の動作の全てを
     模倣しようとはしていません。特に、 ‘mh’ が状態と設定を保存する
     ‘context’ や ‘.mh_profile’ といったファイルは書き換えませんし影響も
     受けません。

     ‘MH’ インスタンスには *note Mailbox: 1605. の全てのメソッドの他に次
     のメソッドがあります:

     バージョン 3.13 で変更: Supported folders that don't contain a
     ‘.mh_sequences’ file.

      -- メソッド: list_folders ()

          全てのフォルダ名のリストを返します。

      -- メソッド: get_folder (folder)

          'folder' という名前のフォルダを表わす ‘MH’ インスタンスを返し
          ます。もしフォルダが存在しなければ *note NoSuchMailboxError:
          3e78. 例外が送出されます。

      -- メソッド: add_folder (folder)

          'folder' という名前のフォルダを作成し、それを表わす ‘MH’ イン
          スタンスを返します。

      -- メソッド: remove_folder (folder)

          名前が 'folder' であるフォルダを削除します。もしフォルダに一つ
          でもメッセージが含まれていれば *note NotEmptyError: 3e7b. 例外
          が送出されフォルダは削除されません。

      -- メソッド: get_sequences ()

          シーケンス名をキーのリストに対応付ける辞書を返します。シーケン
          スが一つもなければ空の辞書を返します。

      -- メソッド: set_sequences (sequences)

          メールボックス中のシーケンスを *note get_sequences(): 3e99. で
          返されるような名前とキーのリストを対応付ける辞書 'sequences' に
          基づいて再定義します。

      -- メソッド: pack ()

          番号付けの間隔を詰める必要に応じてメールボックス中のメッセージ
          の名前を付け替えます。シーケンスのリストのエントリもそれに応じ
          て更新されます。

               注釈: 既に発行されたキーはこの操作によって無効になるので
               それ以降使ってはなりません。

     ‘MH’ で実装された *note Mailbox: 1605. のいくつかのメソッドには特別
     な注意が必要です:

      -- メソッド: remove (key)
      -- メソッド: __delitem__ (key)
      -- メソッド: discard (key)

          これらのメソッドはメッセージを直ちに削除します。名前の前にコン
          マを付加してメッセージに削除の印を付けるという MH の規約は使い
          ません。

      -- メソッド: lock ()
      -- メソッド: unlock ()

          3種類のロック機構が使われます -- ドットロッキングと、もし使用
          可能ならば ‘flock()’ と ‘lockf()’ システムコールです。 MH メー
          ルボックスに対するロックとは ‘.mh_sequences’ のロックと、それ
          が影響を与える操作中だけの個々のメッセージファイルに対するロッ
          クを意味します。

      -- メソッド: get_file (key)

          ホストプラットフォームにより、ファイルが開かれたままの場合はメ
          ッセージを削除することができない場合があります。

      -- メソッド: flush ()

          MH メールボックスへの変更は即時に適用されますのでこのメソッド
          は何もしません。

      -- メソッド: close ()

          ‘MH’ インスタンスは開いたファイルを保持しませんのでこのメソッ
          ドは *note unlock(): 3ea0. と同じです。

参考
....

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: 1605. のサブクラ
     ス。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモー
     ドで開かれているかのように振る舞う)ファイル風メッセージ表現を受け付
     けて好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     BabylMessage: 3ea7. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     Babyl は単一ファイルのメールボックス形式で Emacs に付属している
     Rmail メールユーザエージェントで使われているものです。メッセージの
     開始は Control-Underscore (‘'\037'’) および Control-L (‘'\014'’) の
     二文字を含む行で示されます。メッセージの終了は次のメッセージの開始
     または最後のメッセージの場合には Control-Underscore を含む行で示さ
     れます。

     Babyl メールボックス中のメッセージには二つのヘッダのセット、オリジ
     ナルヘッダといわゆる可視ヘッダ、があります。可視ヘッダは典型的には
     オリジナルヘッダの一部を分り易いように再整形したり短くしたりしたも
     のです。 Babyl メールボックス中のそれぞれのメッセージには 'ラベル'
     というそのメッセージについての追加情報を記録する短い文字列のリスト
     を伴い、メールボックス中に見出されるユーザが定義した全てのラベルの
     リストは Babyl オプションセクションに保持されます。

     ‘Babyl’ インスタンスには *note Mailbox: 1605. の全てのメソッドの他
     に次のメソッドがあります:

      -- メソッド: get_labels ()

          メールボックスで使われているユーザが定義した全てのラベルのリス
          トを返します。

               注釈: メールボックスにどのようなラベルが存在するかを決め
               るのに、Babyl オプションセクションのリストを参考にせず、
               実際のメッセージを捜索しますが、Babyl セクションもメール
               ボックスが変更されたときにはいつでも更新されます。

     ‘Babyl’ で実装された *note Mailbox: 1605. のいくつかのメソッドには
     特別な注意が必要です:

      -- メソッド: get_file (key)

          Babyl メールボックスにおいて、メッセージのヘッダはボディと繋が
          って格納されていません。ファイル風の表現を生成するために、ヘッ
          ダとボディがファイルと同じ API を持つ *note io.BytesIO: 1258.
          インスタンスに一緒にコピーされます。その結果、ファイル風オブジ
          ェクトは元にしているメールボックスとは真に独立していますが、文
          字列表現と比べてメモリーを節約することにはなりません。

      -- メソッド: 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: 1605. のサブクラス
     。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモード
     で開かれているかのように振る舞う)ファイル風メッセージ表現を受け付け
     て好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MMDFMessage: 3eae. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     MMDF は単一ファイルのメールボックス形式で Multichannel Memorandum
     Distribution Facility というメール転送エージェント用に発明されたも
     のです。各メッセージは mbox と同様の形式で収められますが、前後を4つ
     の Control-A (‘'\001'’) を含む行で挟んであります。mbox 形式と同じよ
     うにそれぞれのメッセージの開始は "From " の5文字を含む行で示されま
     すが、それ以外の場所での "From " は格納の際 ">From " には変えられま
     せん。それは追加されたメッセージ区切りによって新たなメッセージの開
     始と見間違うことが避けられるからです。

     ‘MMDF’ で実装された *note Mailbox: 1605. のいくつかのメソッドには特
     別な注意が必要です:

      -- メソッド: 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(): 1bea. や
          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: 例外<22>,  Prev: Mailbox オブジェクト,  Up: mailbox --- 様々な形式のメールボックスを操作する

5.21.3.7 ‘Message’ オブジェクト
...............................

 -- クラス: mailbox.Message (message=None)

     *note email.message: 47. モジュールの *note Message: 786. のサブク
     ラス。 ‘mailbox.Message’ のサブクラスはメールボックス形式ごとの状態
     と動作を追加します。

     If 'message' is omitted, the new instance is created in a default,
     empty state.  If 'message' is an *note email.message.Message: 786.
     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: 1605. インスタンスを使って取得したメッセージを表現す
     るのに ‘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: 160a. のコンストラクタと同じ意味を持ちます。

     通常、メールユーザエージェントは ‘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: 3d1f. や *note
MMDFMessage: 3eae. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態               *note mboxMessage: 3d1f. または
                         *note MMDFMessage: 3eae. の状態
                         
----------------------------------------------------------------------------
                         
"cur" サブディレクトリ   O フラグ
                         
                         
F フラグ                 F フラグ
                         
                         
R フラグ                 A フラグ
                         
                         
S フラグ                 R フラグ
                         
                         
T フラグ                 D フラグ
                         

‘MaildirMessage’ インスタンスが *note MHMessage: 3e94. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態                          *note MHMessage: 3e94. の状
                                    態
                                    
-------------------------------------------------------------------
                                    
"cur" サブディレクトリ              "unseen" シーケンス
                                    
                                    
"cur" サブディレクトリおよび S フ   "unseen" シーケンス無し
ラグ                                

F フラグ                            "flagged" シーケンス
                                    
                                    
R フラグ                            "replied" シーケンス
                                    

‘MaildirMessage’ インスタンスが *note BabylMessage: 3ea7. インスタンスに
基づいて生成されるとき、以下の変換が行われます:

結果の状態                          *note BabylMessage: 3ea7. の状態
                                    
------------------------------------------------------------------------
                                    
"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:
     160a. のコンストラクタと同じ意味を持ちます。

     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: 10ab. インスタンス、 *note time.strftime():
          15a8. に渡すのに適したタプル、または ‘True’ (この場合 *note
          time.gmtime(): 157e. を使います) のいずれかでなければなりませ
          ん。

      -- メソッド: 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: 3e74. インスタンスに
基づいて生成されるとき、 ‘MaildirMessage’ インスタンスの配送日時に基づい
て "From " 行が作り出され、次の変換が行われます:

結果の状態            *note MaildirMessage: 3e74. の状
                      態
                      
----------------------------------------------------------
                      
R フラグ              S フラグ
                      
                      
O フラグ              "cur" サブディレクトリ
                      
                      
D フラグ              T フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              R フラグ
                      

‘mboxMessage’ インスタンスが *note MHMessage: 3e94. インスタンスに基づい
て生成されるとき、以下の変換が行われます:

結果の状態              *note MHMessage: 3e94. の状
                        態
                        
-------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" シーケンス無し
グ                      

O フラグ                "unseen" シーケンス
                        
                        
F フラグ                "flagged" シーケンス
                        
                        
A フラグ                "replied" シーケンス
                        

‘mboxMessage’ インスタンスが *note BabylMessage: 3ea7. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態              *note BabylMessage: 3ea7. の状
                        態
                        
----------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" ラベル無し
グ                      

O フラグ                "unseen" ラベル
                        
                        
D フラグ                "deleted" ラベル
                        
                        
A フラグ                "answered" ラベル
                        

‘mboxMessage’ インスタンスが *note MMDFMessage: 3eae. インスタンスに基づ
いて生成されるとき、"From " 行はコピーされ全てのフラグは直接対応します:

結果の状態            *note MMDFMessage: 3eae. の状
                      態
                      
-------------------------------------------------------
                      
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:
     160a. のコンストラクタと同じ意味を持ちます。

     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: 3e74. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態               *note MaildirMessage: 3e74. の状
                         態
                         
-------------------------------------------------------------
                         
"unseen" シーケンス      S フラグ無し
                         
                         
"replied" シーケンス     R フラグ
                         
                         
"flagged" シーケンス     F フラグ
                         

‘MHMessage’ インスタンスが *note mboxMessage: 3d1f. や *note
MMDFMessage: 3eae. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態               *note mboxMessage: 3d1f. または
                         *note MMDFMessage: 3eae. の状態
                         
----------------------------------------------------------------------------
                         
"unseen" シーケンス      R フラグ無し
                         
                         
"replied" シーケンス     A フラグ
                         
                         
"flagged" シーケンス     F フラグ
                         

‘MHMessage’ インスタンスが *note BabylMessage: 3ea7. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態               *note BabylMessage: 3ea7. の状
                         態
                         
-----------------------------------------------------------
                         
"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:
     160a. のコンストラクタと同じ意味を持ちます。

     ある種のメッセージラベルは 'アトリビュート' と呼ばれ、規約により特
     別な意味が与えられています。アトリビュートは以下の通りです:

     ラベル          説明
                     
     ---------------------------------------------------------------
                     
     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: 160a. インスタンスを返します。

      -- メソッド: set_visible (visible)

          メッセージの可視ヘッダを 'visible' のヘッダと同じにセットしま
          す。引数 'visible' は *note Message: 160a. インスタンスまたは
          *note email.message.Message: 786. インスタンス、文字列、ファイ
          ル風オブジェクト(テキストモードで開かれてなければなりません)の
          いずれかです。

      -- メソッド: update_visible ()

          ‘BabylMessage’ インスタンスのオリジナルヘッダが変更されたとき
          、可視ヘッダは自動的に対応して変更されるわけではありません。こ
          のメソッドは可視ヘッダを以下のように更新します。対応するオリジ
          ナルヘッダのある可視ヘッダはオリジナルヘッダの値がセットされま
          す。対応するオリジナルヘッダの無い可視ヘッダは除去されます。そ
          して、オリジナルヘッダにあって可視ヘッダに無い ‘Date’ 、
          ‘From’ 、 ‘Reply-To’ 、 ‘To’ 、 ‘CC’ 、 ‘Subject’ は可視ヘッダ
          に追加されます。

‘BabylMessage’ インスタンスが *note MaildirMessage: 3e74. インスタンスに
基づいて生成されるとき、以下の変換が行われます:

結果の状態              *note MaildirMessage: 3e74. の状
                        態
                        
------------------------------------------------------------
                        
"unseen" ラベル         S フラグ無し
                        
                        
"deleted" ラベル        T フラグ
                        
                        
"answered" ラベル       R フラグ
                        
                        
"forwarded" ラベル      P フラグ
                        

‘BabylMessage’ インスタンスが *note mboxMessage: 3d1f. や *note
MMDFMessage: 3eae. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態             *note mboxMessage: 3d1f. または
                       *note MMDFMessage: 3eae. の状態
                       
--------------------------------------------------------------------------
                       
"unseen" ラベル        R フラグ無し
                       
                       
"deleted" ラベル       D フラグ
                       
                       
"answered" ラベル      A フラグ
                       

‘BabylMessage’ インスタンスが *note MHMessage: 3e94. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態             *note MHMessage: 3e94. の状
                       態
                       
------------------------------------------------------
                       
"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:
     160a. のコンストラクタと同じ意味を持ちます。

     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: 3d1f. インスタンス
     と同一の以下のメソッドを提供します:

      -- メソッド: get_from ()

          mbox メールボックスのメッセージの開始を示す "From " 行を表わす
          文字列を返します。先頭の "From " および末尾の改行は含まれませ
          ん。

      -- メソッド: set_from (from_, time_=None)

          "From " 行を 'from_' にセットします。 'from_' は先頭の "From "
          や末尾の改行を含まない形で指定しなければなりません。利便性のた
          めに、 'time_' を指定して適切に整形して 'from_' に追加させるこ
          とができます。 'time_' を指定する場合、それは *note
          time.struct_time: 10ab. インスタンス、 *note time.strftime():
          15a8. に渡すのに適したタプル、または ‘True’ (この場合 *note
          time.gmtime(): 157e. を使います) のいずれかでなければなりませ
          ん。

      -- メソッド: 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: 3e74. インスタンスに
基づいて生成されるとき、"From"行が ‘MaildirMessage’ インスタンスの配信日
をもとに生成され、以下の変換が行われます:

結果の状態            *note MaildirMessage: 3e74. の状
                      態
                      
----------------------------------------------------------
                      
R フラグ              S フラグ
                      
                      
O フラグ              "cur" サブディレクトリ
                      
                      
D フラグ              T フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              R フラグ
                      

 ‘MMDFMessage’ インスタンスが *note MHMessage: 3e94. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態              *note MHMessage: 3e94. の状
                        態
                        
-------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" シーケンス無し
グ                      

O フラグ                "unseen" シーケンス
                        
                        
F フラグ                "flagged" シーケンス
                        
                        
A フラグ                "replied" シーケンス
                        

‘MMDFMessage’ インスタンスが *note BabylMessage: 3ea7. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態              *note BabylMessage: 3ea7. の状
                        態
                        
----------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" ラベル無し
グ                      

O フラグ                "unseen" ラベル
                        
                        
D フラグ                "deleted" ラベル
                        
                        
A フラグ                "answered" ラベル
                        

‘MMDFMessage’ インスタンスが *note mboxMessage: 3d1f. インスタンスに基づ
いて生成されるとき、"From"行がコピーされ、全てのフラグが直接対応します:

結果の状態            *note mboxMessage: 3d1f. の状
                      態
                      
-------------------------------------------------------
                      
R フラグ              R フラグ
                      
                      
O フラグ              O フラグ
                      
                      
D フラグ              D フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              A フラグ
                      


File: python.info,  Node: 例外<22>,  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: 1605. のサブクラスを存在しないパ
     スでインスタンス化しようとしたとき(かつ '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: 1c54. イン
     スタンスが壊れた ‘.mh_sequences’ ファイルを読もうと試みた場合などに
     送出されます。


File: python.info,  Node: 使用例<31>,  Prev: 例外<22>,  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(): 3ee2. がセットアップする情報に依存していれば、これらの関数
は、 ‘init()’ を呼びます。

 -- の関数: mimetypes.guess_type (url, strict=True)

     'url' で与えられるファイル名あるいは URL に基づいて、ファイルの型を
     推定します。URL は文字列または *note path-like object: 7a5. です。

     戻り値は、タプル ‘(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: 7a5.

     *note Soft deprecated: 1b2. since version 3.13: Passing a file path
     instead of URL. Use *note guess_file_type(): 720. 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(): 721. function, but accepts a
     path instead of URL. Path can be a string, a bytes object or a
     *note path-like object: 7a5.

     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(): 721. and *note guess_file_type(): 720.

     省略可能な 'strict' 引数は *note guess_type(): 721. 関数のものと同
     じ意味を持ちます。

 -- の関数: 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(): 721. and
     *note guess_file_type(): 720.  If no extension can be guessed for
     'type', ‘None’ is returned.

     省略可能な 'strict' 引数は *note guess_type(): 721. 関数のものと同
     じ意味を持ちます。

モジュールの動作を制御するために、いくつかの追加の関数とデータ項目が利用
できます。

 -- の関数: mimetypes.init (files=None)

     内部のデータ構造を初期化します。もし 'files' が与えられていれば、こ
     れはデフォルトの type map を増やすために使われる、一連のファイル名
     でなければなりません。もし省略されていれば、使われるファイル名は
     *note knownfiles: 3ee4. から取られます。 Windows であれば、現在のレ
     ジストリの設定が読み込まれます。 'files' あるいは ‘knownfiles’ 内の
     各ファイル名は、それ以前に現れる名前より優先されます。繰り返し
     *note init(): 3ee2. を呼び出すことは許されています。

     '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)

     Add a mapping from the MIME type 'type' to the extension 'ext'.
     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.  Valid extensions are empty
     or start with a ‘'.'’.

     'strict' が ‘True’ の時(デフォルト)は、そのマッピングは正式な MIME
     型に、そうでなければ、非標準の MIME 型に追加されます。

     バージョン 3.14 で非推奨: 'ext' values that do not start with ‘'.'’
     are deprecated.

     バージョン 3.16.0a0 (unreleased) で変更: 'ext' now must start with
     ‘'.'’.  Otherwise *note ValueError: 15a. is raised.

 -- データ: mimetypes.inited

     グローバルなデータ構造が初期化されているかどうかを示すフラグ。これ
     は *note init(): 3ee2. により ‘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/main/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: 18b3. 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(): 3eed. あるいは
     *note readfp(): 3eee. メソッドを使って、データベースにロードするこ
     とで拡張されます。マッピング辞書も、もしデフォルトのデータが望むも
     のでなければ、追加のデータをロードする前にクリアされます。

     省略可能な 'filenames' パラメータは、追加のファイルを、デフォルトデ
     ータベースの"トップに"ロードさせるのに使うことができます。

      -- の属性: suffix_map

          サフィックスをサフィックスにマップする辞書。これは、符号化方式
          と型が同一拡張子で示されるような符号化ファイルが認識できるよう
          に使用されます。例えば、 ‘.tgz’ 拡張子は、符号化方式と型が別個
          に認識できるように ‘.tar.gz’ に対応づけられます。これは、最初
          はモジュールで定義されたグローバルな *note suffix_map: 3ee7. の
          コピーです。

      -- の属性: encodings_map

          ファイル名拡張子を符号化型にマッピングする辞書。これは、最初は
          モジュールで定義されたグローバルな *note encodings_map: 3ee8.
          のコピーです。

      -- の属性: types_map

          ファイル名拡張子を MIME 型にマッピングする 2 種類の辞書のタプ
          ル; 最初の辞書は非標準型、二つ目は標準型の辞書です。初期状態で
          はそれぞれ *note common_types: 3eea. と *note types_map: 3ee9.
          です。

      -- の属性: types_map_inv

          MIME 型をファイル名拡張子のリストにマッピングする 2 種類の辞書
          のタプル; 最初の辞書は非標準型、二つ目は標準型の辞書です。初期
          状態ではそれぞれ *note common_types: 3eea. と *note types_map:
          3ee9. です。

      -- メソッド: guess_extension (type, strict=True)

          *note guess_extension(): 3ee3. 関数と同様ですが、オブジェクト
          に保存されたテーブルを使用します。

      -- メソッド: guess_type (url, strict=True)

          *note guess_type(): 721. 関数と同様ですが、オブジェクトに保存
          されたテーブルを使用します。

      -- メソッド: guess_file_type (path, *, strict=True)

          Similar to the *note guess_file_type(): 720. 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(): 1e60. と同様ですが、オブジェクト
          に保存されたテーブルを参照します。

      -- メソッド: read (filename, strict=True)

          MIME 情報を、 'filename' という名のファイルからロードします。
          これはファイルを解析するのに *note readfp(): 3eee. を使用しま
          す。

          '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: 234c.: 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 で非推奨: 'ext' values that do not start with
          ‘'.'’ are deprecated.

          バージョン 3.16.0a0 (unreleased) で変更: 'ext' now must start
          with ‘'.'’.  Otherwise *note ValueError: 15a. is raised.


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 error 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: unknown extension of filename.pict

     $ # now look in the extended database built into Python
     $ python -m mimetypes --lenient filename.pict
     type: image/pict encoding: None

     $ # get a file extension by a MIME type
     $ python -m mimetypes --extension text/javascript
     .js

     $ # get a file extension by a rare MIME type
     $ python -m mimetypes --extension text/xul
     error: unknown type text/xul

     $ # now look in the extended database again
     $ python -m mimetypes --extension --lenient text/xul
     .xul

     $ # try to feed an unknown file extension
     $ python -m mimetypes filename.sh filename.nc filename.xxx filename.txt
     type: application/x-sh encoding: None
     type: application/x-netcdf encoding: None
     error: unknown extension of filename.xxx

     $ # try to feed an unknown MIME type
     $ python -m mimetypes --extension audio/aac audio/opus audio/future audio/x-wav
     .aac
     .opus
     error: unknown type audio/future


File: python.info,  Node: base64 --- Base16 Base32 Base64 Base85 データのエンコード,  Next: binascii --- バイナリ と ASCII 間の変換,  Prev: mimetypes --- ファイル名を MIME タイプへマップする,  Up: インターネット上のデータの操作

5.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: 3f02. RFC 4648(2) (Base64,
Base32 and Base16), the *note Base85 encoding: 3f03. specified in PDF
2.0(3), and non-standard variants of Base85 used elsewhere.

このモジュールは、2つのインターフェースを提供します。このモダンなインタ
ーフェースは、*note bytes-like object: 43d. を ASCII *note bytes: 1d2. に
エンコードし、bytes-like object か ASCII 文字列を、‘bytes’ にデコードす
ることができます。 RFC 4648(4) に定義されている base-64 アルファベット
(一般の、URL あるいはファイルシステムセーフなもの) の両方が使用できます
。

*note 従来のインターフェース: 3f04. は文字列からのデコードができませんが
、*note file object: 1581. との間のエンコードとデコードが可能な関数を提
供します。これは標準の base64 アルファベットのみをサポートし、 RFC
2045(5) の規定にあるように、76文字ごとに改行されます。 RFC 2045(6) のサ
ポートのためには、代わりに *note email: 3e. パッケージを参照する必要があ
るかもしれません。

バージョン 3.3 で変更: モダンなインターフェイスのデコード関数が ASCII の
みの Unicode 文字列を受け付けるようになりました。

バージョン 3.4 で変更: このモジュールのすべてのエンコード・デコード関数
が任意の *note bytes-like オブジェクト: 43d. を受け取るようになりました
。Ascii85/Base85 のサポートが追加されました。

* Menu:

* RFC 4648 エンコーディング::
* Base85 エンコーディング::
* レガシーインターフェース::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<4>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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, *, padded=True,
          wrapcol=0)

     Base64 を使って *note bytes-like object: 43d. の 's' をエンコードし
     、エンコードされた *note bytes: 1d2. を返します。

     オプション引数 'altchars' は長さ 2 の *note bytes-like object: 43d.
     で 、‘+’ と ‘/’ の代わりに使われる代替アルファベットを指定します。
     これにより、アプリケーションはたとえば URL やファイルシステムの影響
     を受けない Base64 文字列を生成できます。デフォルトは ‘None’ で、標
     準の Base64 アルファベットが使われます。

     If 'padded' is true (default), pad the encoded data with the '='
     character to a size multiple of 4.  If 'padded' is false, do not
     add the pad characters.

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not insert any newlines.

     バージョン 3.15 で変更: Added the 'padded' and 'wrapcol'
     parameters.

 -- の関数: base64.b64decode (s, altchars=None, validate=False, *,
          padded=True, canonical=False)

 -- の関数: base64.b64decode (s, altchars=None, validate=True, *,
          ignorechars, padded=True, canonical=False)

     Base64 エンコードされた *note bytes-like object: 43d. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 1d2. を返しま
     す。

     オプション引数の 'altchars' は長さ 2 の *note bytes-like object:
     43d. または ASCII 文字列で、‘+’ と ‘/’ の代わりに使われる代替アルフ
     ァベットを指定します。

     If 'padded' is true, the last group of 4 base 64 alphabet
     characters must be padded with the '=' character.  If 'padded' is
     false, padding is neither required nor recognized: the '='
     character is not treated as padding but as a non-alphabet
     character, which means it is silently discarded when 'validate' is
     false, or causes an *note Error: 13d2. when 'validate' is true
     unless b'=' is included in 'ignorechars'.

     's' が正しくパディングされていない場合は *note binascii.Error:
     13d2. 例外を発生させます。

     If 'ignorechars' is specified, it should be a *note bytes-like
     object: 43d. containing characters to ignore from the input when
     'validate' is true.  If 'ignorechars' contains the pad character
     ‘'='’, the pad characters presented before the end of the encoded
     data and the excess pad characters will be ignored.  The default
     value of 'validate' is ‘True’ if 'ignorechars' is specified,
     ‘False’ otherwise.

     If 'validate' is false, characters that are neither in the normal
     base-64 alphabet nor (if 'ignorechars' is not specified) the
     alternative alphabet are discarded prior to the padding check, but
     the ‘+’ and ‘/’ characters keep their meaning if they are not in
     'altchars' (they will be discarded in future Python versions).

     If 'validate' is true, these non-alphabet characters in the input
     result in a *note binascii.Error: 13d2.

     If 'canonical' is true, non-zero padding bits are rejected.  See
     *note binascii.a2b_base64(): 208. for details.

     厳密な base64 チェックのについての詳細は *note
     binascii.a2b_base64(): 208. を参照してください

     バージョン 3.15 で変更: Added the 'canonical', 'ignorechars', and
     'padded' parameters.

     バージョン 3.15 で非推奨: Accepting the ‘+’ and ‘/’ characters with
     an alternative alphabet is now deprecated.

 -- の関数: base64.standard_b64encode (s)

     標準の base64 アルファベットを使用して *note bytes-like object:
     43d. の 's' をエンコードし、エンコードされた *note bytes: 1d2. を返
     します。

 -- の関数: base64.standard_b64decode (s)

     標準の base64 アルファベットを使用した *note bytes-like object:
     43d. または ASCII 文字列 's' をデコードし、デコードされた *note
     bytes: 1d2. を返します。

 -- の関数: base64.urlsafe_b64encode (s, *, padded=True)

     Encode *note bytes-like object: 43d. '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: 1d2.  The result can still contain ‘=’ if
     'padded' is true (default).

     バージョン 3.15 で変更: Added the 'padded' parameter.

 -- の関数: base64.urlsafe_b64decode (s, *, padded=False)

     *note bytes-like object: 43d. または ASCII 文字列 's' を URLとファ
     イルシステムセーフなアルファベットを利用してデコードし、デコードさ
     れた *note bytes: 1d2. を返します。標準 base64 アルファベットに比べ
     て、‘+’ の替わりに ‘-’ を、‘/’ の替わりに ‘_’ を置換します。

     バージョン 3.15 で変更: Added the 'padded' parameter.  Padding of
     input is no longer required by default.

     バージョン 3.15 で非推奨: Accepting the ‘+’ and ‘/’ characters is
     now deprecated.

 -- の関数: base64.b32encode (s, *, padded=True, wrapcol=0)

     Base32 を使って *note bytes-like object: 43d. の 's' をエンコードし
     、エンコードされた *note bytes: 1d2. を返します。

     If 'padded' is true (default), pad the encoded data with the '='
     character to a size multiple of 8.  If 'padded' is false, do not
     add the pad characters.

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not add any newlines.

     バージョン 3.15 で変更: Added the 'padded' and 'wrapcol'
     parameters.

 -- の関数: base64.b32decode (s, casefold=False, map01=None, *,
          padded=True, ignorechars=b'', canonical=False)

     Base32 エンコードされた *note bytes-like object: 43d. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 1d2. を返しま
     す。

     オプション引数 'casefold' は小文字のアルファベットを受けつけるかど
     うかを指定します。セキュリティ上の理由により、デフォルトではこれは
     ‘False’ になっています。

     RFC 4648(2) は付加的なマッピングとして、数字の 0 (零) をアルファベ
     ットの O (オー) に、数字の 1 (壱) をアルファベットの I (アイ) また
     は L (エル) に対応させることを許しています。オプション引数は
     'map01' は、 ‘None’ でないときは、数字の 1 をどの文字に対応づけるか
     を指定します ('map01' が ‘None’ でないとき、数字の 0 はつねにアルフ
     ァベットの O (オー) に対応づけられます)。セキュリティ上の理由により
     、これはデフォルトでは ‘None’ になっているため、 0 および 1 は入力
     として許可されていません。

     If 'padded' is true, the last group of 8 base 32 alphabet
     characters must be padded with the '=' character.  If 'padded' is
     false, padding is neither required nor recognized: the '='
     character is not treated as padding but as a non-alphabet
     character, which means it raises an *note Error: 13d2. unless b'='
     is included in 'ignorechars'.

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.

     If 'canonical' is true, non-zero padding bits are rejected.  See
     *note binascii.a2b_base32(): 202. for details.

     's' が正しくパディングされていない場合や、入力にアルファベットでな
     い文字が含まれていた場合に、 *note binascii.Error: 13d2. 例外を発生
     させます。

     バージョン 3.15 で変更: Added the 'canonical', 'ignorechars', and
     'padded' parameters.

 -- の関数: base64.b32hexencode (s, *, padded=True, wrapcol=0)

     :func:>>'<<b32encode'に似ていますが、:rfc:>>'<<4648'で定義されてい
     るようにExtended Hex Alphabetを使用します。

     Added in version 3.10.

     バージョン 3.15 で変更: Added the 'padded' and 'wrapcol'
     parameters.

 -- の関数: base64.b32hexdecode (s, casefold=False, *, padded=True,
          ignorechars=b'', canonical=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.

     バージョン 3.15 で変更: Added the 'canonical', 'ignorechars', and
     'padded' parameters.

 -- の関数: base64.b16encode (s, *, wrapcol=0)

     Base16 を使って *note bytes-like object: 43d. の 's' をエンコードし
     、エンコードされた *note bytes: 1d2. を返します。

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not add any newlines.

     バージョン 3.15 で変更: Added the 'wrapcol' parameter.

 -- の関数: base64.b16decode (s, casefold=False, *, ignorechars=b'')

     Base16 エンコードされた *note bytes-like object: 43d. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 1d2. を返しま
     す。

     オプション引数 'casefold' は小文字のアルファベットを受けつけるかど
     うかを指定します。セキュリティ上の理由により、デフォルトではこれは
     ‘False’ になっています。

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.

     's' が正しくパディングされていない場合や、入力にアルファベットでな
     い文字が含まれていた場合に、 *note binascii.Error: 13d2. 例外を発生
     させます。

     バージョン 3.15 で変更: Added the 'ignorechars' parameter.

   ---------- 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(): 12d2.

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(): 1fb.

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(): 1f1.

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: 43d. の 'b' をエンコード
     し、エンコードされた *note bytes: 1d2. を返します。

     '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.

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not insert any newlines.

     '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', canonical=False)

     Ascii85 エンコードされた *note bytes-like object: 43d. または ASCII
     文字列 'b' をデコードし、デコードされた *note bytes: 1d2. を返しま
     す。

     '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: 15a. is raised.

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.  This should only contain
     whitespace characters, and by default contains all whitespace
     characters in ASCII.

     If 'canonical' is true, non-canonical encodings are rejected.  See
     *note binascii.a2b_ascii85(): 204. for details.

     Added in version 3.4.

     バージョン 3.15 で変更: Added the 'canonical' parameter.
     Single-character final groups are now always rejected as encoding
     violations.

 -- の関数: base64.b85encode (b, pad=False, *, wrapcol=0)

     base85 (これは例えば git スタイルのバイナリ diff で用いられています
     ) を使って *note bytes-like object: 43d. の 'b' をエンコードし、エ
     ンコードされた *note bytes: 1d2. を返します。

     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.

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not add any newlines.

     Added in version 3.4.

     バージョン 3.15 で変更: Added the 'wrapcol' parameter.

 -- の関数: base64.b85decode (b, *, ignorechars=b'', canonical=False)

     Decode the base85-encoded *note bytes-like object: 43d. or ASCII
     string 'b' and return the decoded *note bytes: 1d2.

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.

     If 'canonical' is true, non-canonical encodings are rejected.  See
     *note binascii.a2b_base85(): 206. for details.

     Added in version 3.4.

     バージョン 3.15 で変更: Added the 'canonical' and 'ignorechars'
     parameters.  Single-character final groups are now always rejected
     as encoding violations.

 -- の関数: base64.z85encode (s, pad=False, *, wrapcol=0)

     Encode the *note bytes-like object: 43d. 's' using Z85 (as used in
     ZeroMQ) and return the encoded *note bytes: 1d2.

     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, as required by the ZeroMQ standard.

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not add any newlines.

     Added in version 3.13.

     バージョン 3.15 で変更: The 'pad' parameter was added.

     バージョン 3.15 で変更: Added the 'wrapcol' parameter.

 -- の関数: base64.z85decode (s, *, ignorechars=b'', canonical=False)

     Decode the Z85-encoded *note bytes-like object: 43d. or ASCII
     string 's' and return the decoded *note bytes: 1d2.

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.

     If 'canonical' is true, non-canonical encodings are rejected.  See
     *note binascii.a2b_base85(): 206. for details.

     Added in version 3.13.

     バージョン 3.15 で変更: Added the 'canonical' and 'ignorechars'
     parameters.  Single-character final groups are now always rejected
     as encoding violations.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc1924.html


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: 1581. でなければなりません。 'input' は ‘input.readline()’
     が空バイト列を返すまで読まれます。

 -- の関数: base64.decodebytes (s)

     *note bytes-like object: 43d. 's' をデコードし、デコードされた
     *note bytes: 1d2. を返します。 's' には一行以上の base64 形式でエン
     コードされたデータが含まれている必要があります。

     Added in version 3.1.

 -- の関数: base64.encode (input, output)

     バイナリの 'input' ファイルの中身を base64 形式でエンコードした結果
     を 'output' ファイルに出力します。 'input' 、 'output' ともに *note
     file objects: 1581. でなければなりません。 'input' は
     ‘input.read()’ が空バイト列を返すまで読まれます。 *note encode():
     3f0b. は76バイトの出力ごとに改行文字(‘b'\n'’)を挿入し、 RFC 2045(1)
     (MIME) の規定にあるように常に出力が新しい行で終わることを保証します
     。

 -- の関数: base64.encodebytes (s)

     *note bytes-like object: 43d. 's' (任意のバイナリデータを含むことが
     できます) を、 RFC 2045(2) (MIME) に規定されるように末尾に新しい行
     のある、76バイトの出力ごとに新しい行 (‘b'\n'’) が挿入された、base64
     形式でエンコードしたデータを含む *note bytes: 1d2. を返します。

     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: 1d2. や *note bytearray: 1d1. または
     バッファープロトコルをサポートするその他のオブジェクトのような)
     *note bytes-like オブジェクト: 43d. だけを受け取ります。

     バージョン 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, /, *, padded=True,
          alphabet=BASE64_ALPHABET, strict_mode=False, canonical=False)

 -- の関数: binascii.a2b_base64 (string, /, *, ignorechars, padded=True,
          alphabet=BASE64_ALPHABET, strict_mode=True, canonical=False)

     base64 でエンコードされたデータのブロックをバイナリに変換し、変換後
     のバイナリデータを返します。一度に 1 行以上のデータを与えてもかまい
     ません。

     Optional 'alphabet' must be a *note bytes: 1d2. object of length 64
     which specifies an alternative alphabet.

     If 'padded' is true, the last group of 4 base 64 alphabet
     characters must be padded with the '=' character.  If 'padded' is
     false, padding is neither required nor recognized: the '='
     character is not treated as padding but as a non-alphabet
     character, which means it is silently discarded when 'strict_mode'
     is false, or causes an *note Error: 13d2. when 'strict_mode' is
     true unless b'=' is included in 'ignorechars'.

     If 'ignorechars' is specified, it should be a *note bytes-like
     object: 43d. containing characters to ignore from the input when
     'strict_mode' is true.  If 'ignorechars' contains the pad character
     ‘'='’, the pad characters presented before the end of the encoded
     data and the excess pad characters will be ignored.  The default
     value of 'strict_mode' is ‘True’ if 'ignorechars' is specified,
     ‘False’ otherwise.

     If 'strict_mode' is true, only valid base64 data will be converted.
     Invalid base64 data will raise *note binascii.Error: 13d2.

     Valid base64:

        * Conforms to RFC 4648(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.

     If 'canonical' is true, non-zero padding bits in the last group are
     rejected with *note binascii.Error: 13d2, enforcing canonical
     encoding as defined in RFC 4648(2) section 3.5.  This check is
     independent of 'strict_mode'.

     バージョン 3.11 で変更: Added the 'strict_mode' parameter.

     バージョン 3.15 で変更: Added the 'alphabet', 'canonical',
     'ignorechars', and 'padded' parameters.

 -- の関数: binascii.b2a_base64 (data, *, padded=True,
          alphabet=BASE64_ALPHABET, wrapcol=0, newline=True)

     Convert binary data to a line(s) of ASCII characters in base64
     coding, as specified in RFC 4648(3).

     If 'padded' is true (default), pad the encoded data with the '='
     character to a size multiple of 4.  If 'padded' is false, do not
     add the pad characters.

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not insert any newlines.

     If 'newline' is true (default), a newline character will be added
     at the end of the output.

     バージョン 3.6 で変更: パラメータに 'newline' を追加しました。

     バージョン 3.15 で変更: Added the 'alphabet', 'padded' and
     'wrapcol' parameters.

 -- の関数: binascii.a2b_ascii85 (string, /, *, foldspaces=False,
          adobe=False, ignorechars=b'', canonical=False)

     Convert Ascii85 data back to binary and return the binary data.

     Valid Ascii85 data contains characters from the Ascii85 alphabet in
     groups of five (except for the final group, which may have from two
     to five characters).  Each group encodes 32 bits of binary data in
     the range from ‘0’ to ‘2 ** 32 - 1’, inclusive.  The special
     character ‘z’ is accepted as a short form of the group ‘!!!!!’,
     which encodes four consecutive null bytes.  A single-character
     final group is always rejected as an encoding violation.

     'foldspaces' は、短い特殊文字 'y' を受け取って 4 つの連続した空白文
     字(ASCII 0x20)と解釈するかどうかを制御します。この機能は "標準"
     Ascii85 ではサポートされていません。

     'adobe' controls whether the encoded byte sequence is framed with
     ‘<~’ and ‘~>’, as in a PostScript base-85 string literal.  If
     'adobe' is true, a leading ‘<~’ is optionally accepted, while a
     trailing ‘~>’ is 'required', and *note binascii.Error: 13d2. is
     raised if it is not found.

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.  This should only contain
     whitespace characters.

     If 'canonical' is true, non-canonical encodings are rejected with
     *note binascii.Error: 13d2.  Here "canonical" means the encoding
     that *note b2a_ascii85(): 203. would produce: the ‘z’ abbreviation
     must be used for all-zero groups (rather than ‘!!!!!’), and partial
     final groups must use the same padding digits as the encoder.

     Invalid Ascii85 data will raise *note binascii.Error: 13d2.

     Added in version 3.15.

 -- の関数: binascii.b2a_ascii85 (data, /, *, foldspaces=False,
          wrapcol=0, pad=False, adobe=False)

     Convert binary data to a formatted sequence of ASCII characters in
     Ascii85 coding.  The return value is the converted data.

     'foldspaces' を使うと、4 つの連続した空白文字(ASCII 0x20)を 'btoa'
     によってサポートされている短い特殊文字 'y' に置き換えます。この機能
     は "標準" Ascii85 ではサポートされていません。

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not insert any newlines.

     If 'pad' is true, the 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.15.

 -- の関数: binascii.a2b_base85 (string, /, *, alphabet=BASE85_ALPHABET,
          ignorechars=b'', canonical=False)

     Convert Base85 data back to binary and return the binary data.
     More than one line may be passed at a time.

     Valid Base85 data contains characters from the Base85 alphabet in
     groups of five (except for the final group, which may have from two
     to five characters).  Each group encodes 32 bits of binary data in
     the range from ‘0’ to ‘2 ** 32 - 1’, inclusive.  A single-character
     final group is always rejected as an encoding violation.

     Optional 'alphabet' must be a *note bytes: 1d2. object of length 85
     which specifies an alternative alphabet.

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.

     If 'canonical' is true, non-canonical encodings are rejected with
     *note binascii.Error: 13d2.  Here "canonical" means the encoding
     that *note b2a_base85(): 205. would produce: partial final groups
     must use the same padding digits as the encoder.

     Invalid Base85 data will raise *note binascii.Error: 13d2.

     Added in version 3.15.

 -- の関数: binascii.b2a_base85 (data, /, *, alphabet=BASE85_ALPHABET,
          wrapcol=0, pad=False)

     Convert binary data to a line of ASCII characters in Base85 coding.
     The return value is the converted line.

     Optional 'alphabet' must be a *note bytes-like object: 43d. of
     length 85 which specifies an alternative alphabet.

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not insert any newlines.

     If 'pad' is true, the zero-padding applied to the end of the input
     is 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.15.

 -- の関数: binascii.a2b_base32 (string, /, *, padded=True,
          alphabet=BASE32_ALPHABET, ignorechars=b'', canonical=False)

     Convert base32 data back to binary and return the binary data.

     Valid base32 data contains characters from the base32 alphabet
     specified in RFC 4648(4) in groups of eight (if necessary, the
     final group is padded to eight characters with ‘=’).  Each group
     encodes 40 bits of binary data in the range from ‘0’ to ‘2 ** 40 -
     1’, inclusive.

          注釈: This function does not map lowercase characters (which
          are invalid in standard base32) to their uppercase
          counterparts, nor does it contextually map ‘0’ to ‘O’ and ‘1’
          to ‘I’/‘L’ as RFC 4648(5) allows.

     Optional 'alphabet' must be a *note bytes: 1d2. object of length 32
     which specifies an alternative alphabet.

     If 'padded' is true, the last group of 8 base 32 alphabet
     characters must be padded with the '=' character.  If 'padded' is
     false, the '=' character is treated as other non-alphabet
     characters (depending on the value of 'ignorechars').

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.  If 'ignorechars' contains the
     pad character ‘'='’, the pad characters presented before the end of
     the encoded data and the excess pad characters will be ignored.

     If 'canonical' is true, non-zero padding bits in the last group are
     rejected with *note binascii.Error: 13d2, enforcing canonical
     encoding as defined in RFC 4648(6) section 3.5.

     Invalid base32 data will raise *note binascii.Error: 13d2.

     Added in version 3.15.

 -- の関数: binascii.b2a_base32 (data, /, *, padded=True,
          alphabet=BASE32_ALPHABET, wrapcol=0)

     Convert binary data to a line of ASCII characters in base32 coding,
     as specified in RFC 4648(7).  The return value is the converted
     line.

     Optional 'alphabet' must be a *note bytes-like object: 43d. of
     length 32 which specifies an alternative alphabet.

     If 'padded' is true (default), pad the encoded data with the '='
     character to a size multiple of 8.  If 'padded' is false, do not
     add the pad characters.

     If 'wrapcol' is non-zero, insert a newline (‘b'\n'’) character
     after at most every 'wrapcol' characters.  If 'wrapcol' is zero
     (default), do not insert any newlines.

     Added in version 3.15.

 -- の関数: 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(8) にしたがってアンダースコアに
     エンコードされます。オプション引数 '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(): 1122. 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, *, ignorechars=b'')
 -- の関数: binascii.unhexlify (hexstr, *, ignorechars=b'')

     16進数表記の文字列 'hexstr' の表すバイナリデータを返します。この関
     数は *note b2a_hex(): 194c. の逆です。 'hexstr' は 16進数字 (大文字
     でも小文字でも構いません) を偶数個含んでいなければなりません。そう
     でない場合、例外 *note Error: 13d2. が送出されます。

     'ignorechars' should be a *note bytes-like object: 43d. containing
     characters to ignore from the input.

     Similar functionality (accepting only text string arguments, but
     more liberal towards whitespace) is also accessible using the *note
     bytes.fromhex(): 43b. class method.

     バージョン 3.15 で変更: Added the 'ignorechars' parameter.

 -- 例外: binascii.Error

     エラーが発生した際に送出される例外です。通常はプログラムのエラーで
     す。

 -- 例外: binascii.Incomplete

     変換するデータが不完全な場合に送出される例外です。通常はプログラム
     のエラーではなく、多少追加読み込みを行って再度変換を試みることで対
     処できます。

 -- データ: binascii.BASE64_ALPHABET

     The Base 64 alphabet according to RFC 4648(9).

     Added in version 3.15.

 -- データ: binascii.URLSAFE_BASE64_ALPHABET

     The "URL and filename safe" Base 64 alphabet according to RFC
     4648(10).

     Added in version 3.15.

 -- データ: binascii.UU_ALPHABET

     The uuencoding alphabet.

     Added in version 3.15.

 -- データ: binascii.CRYPT_ALPHABET

     The Base 64 alphabet used in the ‘crypt(3)(11)’ routine and in the
     GEDCOM format.

     Added in version 3.15.

 -- データ: binascii.BINHEX_ALPHABET

     The Base 64 alphabet used in BinHex 4 (HQX) within the classic Mac
     OS.

     Added in version 3.15.

 -- データ: binascii.BASE85_ALPHABET

     The Base85 alphabet.

     Added in version 3.15.

 -- データ: binascii.ASCII85_ALPHABET

     The Ascii85 alphabet.

     Added in version 3.15.

 -- データ: binascii.Z85_ALPHABET

     The Z85(12) alphabet.

     Added in version 3.15.

 -- データ: binascii.BASE32_ALPHABET

     The Base 32 alphabet according to RFC 4648(13).

     Added in version 3.15.

 -- データ: binascii.BASE32HEX_ALPHABET

     The "Extended Hex" Base 32 alphabet according to RFC 4648(14).
     Data encoded with this alphabet maintains its sort order during
     bitwise comparisons.

     Added in version 3.15.

参考
....

*note base64: f. モジュール

     RFC 準拠の base64 形式の、底が 16、32、64、85 のエンコーディング。

*note quopri: bf. モジュール

     MIME 電子メールメッセージで使われる quoted-printable エンコードのサ
     ポート。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc4648.html

   (2) https://datatracker.ietf.org/doc/html/rfc4648.html

   (3) https://datatracker.ietf.org/doc/html/rfc4648.html

   (4) https://datatracker.ietf.org/doc/html/rfc4648.html

   (5) https://datatracker.ietf.org/doc/html/rfc4648.html

   (6) https://datatracker.ietf.org/doc/html/rfc4648.html

   (7) https://datatracker.ietf.org/doc/html/rfc4648.html

   (8) https://datatracker.ietf.org/doc/html/rfc1522.html

   (9) https://datatracker.ietf.org/doc/html/rfc4648.html

   (10) https://datatracker.ietf.org/doc/html/rfc4648.html

   (11) https://manpages.debian.org/crypt(3)

   (12) https://rfc.zeromq.org/spec/32/

   (13) https://datatracker.ietf.org/doc/html/rfc4648.html

   (14) https://datatracker.ietf.org/doc/html/rfc4648.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 バイナリファイルオブジェクト: 1581. でなければなりません。オ
     プション引数 '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 バイナリファイルオブジェクト: 1581. でなけ
     ればなりません。 'quotetabs' は、内容に含まれている空白とタブ文字を
     エンコードするかどうかを制御する必須のフラグで、真のときは空白文字
     をエンコードし、偽のときはエンコードしないままにしておきます。 RFC
     1521(4) に従って、行末にある空白とタブ文字は常にエンコードされるこ
     とに注意してください。 'header' は、空白を RFC 1522(5) に従ってアン
     ダースコアにエンコードするかどうかを制御するフラグです。

 -- の関数: quopri.decodestring (s, header=False)

     *note decode(): 2aad. に似ていますが、ソース *note bytes: 1d2. を受
     け取り、対応するデコードされた ‘bytes’ を返します。

 -- の関数: quopri.encodestring (s, quotetabs=False, header=False)

     *note encode(): 2aac. に似ていますが、ソース *note bytes: 1d2. を受
     け取り、対応するエンコードされた ‘bytes’ を返します。 デフォルトで
     は、 ‘encode()’ 関数の 'quotetabs' パラメータに ‘False’ を渡します
     。

参考
....

*note base64: f. モジュール

     MIME base64 形式データのエンコードおよびデコード

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 1492. を対象としま
     す。

     Added in version 3.4.

__________________________________________________________________

‘html’ パッケージのサブモジュールは以下のとおりです:

   * *note html.parser: 70. - 許容性のあるモードを持つ HTML/XHTML パーサ
     ー

   * *note html.entities: 6f. - HTML 実体の定義

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: c51. クラスを定義します。このクラス
は 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: c51. インスタンスは、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/main/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: c51. 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: c51. インスタンスは以下のメソッドを提供します:

 -- メソッド: HTMLParser.feed (data)

     パーサーにテキストを入力します。入力が完全なタグ要素で構成されてい
     る場合に限り処理が行われます; 不完全なデータであった場合、新たにデ
     ータが入力されるか、*note close(): 1a64. が呼び出されるまでバッファ
     ーされます。 'data' は *note str: 1ea. でなければなりません。

 -- メソッド: HTMLParser.close ()

     全てのバッファーされているデータについて、その後にファイル終端マー
     クが続いているとみなして強制的に処理を行います。このメソッドは入力
     データの終端で行う追加処理を定義するために、派生クラスで再定義する
     ことができます。しかし、再定義されたバージョンでは、常に *note
     HTMLParser: c51. 基底クラスのメソッド *note close(): 1a64. を呼び出
     さなくてはなりません。

 -- メソッド: HTMLParser.reset ()

     インスタンスをリセットします。未処理のデータはすべて失われます。イ
     ンスタンス化の際に暗黙的に呼び出されます。

 -- メソッド: HTMLParser.getpos ()

     現在の行番号およびオフセット値を返します。

 -- メソッド: HTMLParser.get_starttag_text ()

     最も最近開かれた開始タグのテキスト部分を返します。このテキストは必
     ずしも元データを構造化する上で必須ではありませんが、 "広く知られて
     いる (as deployed)" HTML を扱ったり、入力を最小限の変更で再生成 (属
     性間の空白をそのままにする、など) したりする場合に便利なことがあり
     ます。

以下のメソッドはデータまたはマークアップ要素が見つかる度に呼び出されます
。これらはサブクラスで上書きされることを想定されています。基底クラスの実
装は (*note handle_startendtag(): 3f32. を除き) 何もしません:

 -- メソッド: 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: 6f. からのすべての実態参照は、属性値に置き換え
     られます。

 -- メソッド: HTMLParser.handle_endtag (tag)

     このメソッドは要素の終了タグを扱うために呼び出されます (例:
     ‘</div>’)。

     引数 'tag' はタグの名前で、小文字に変換されます。

 -- メソッド: HTMLParser.handle_startendtag (tag, attrs)

     *note handle_starttag(): 3f33. と似ていますが、パーサーが XHTML 形
     式の空タグ (‘<img ... />’) を見つける度に呼び出されます。この特定の
     字句情報が必要な場合にこのメソッドをサブクラスで上書きすることがで
     きます; 既定の実装では、単に ‘handle_starttag()’ および *note
     handle_endtag(): 3f34. を呼び出します。

 -- メソッド: 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: c51. クラスでは、処理指令に 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(): 3f2e. works, but *note
handle_data(): 3f35. 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: 1492.、*note name2codepoint:
3f41.、*note codepoint2name: 3f42.、および *note entitydefs: 3f43. を定
義しています。

 -- データ: html.entities.html5

     HTML5 名前付き文字参照 (2) と Unicode 文字とを対応付ける辞書です (例
     : ‘html5['gt;'] == '>'’)。末尾のセミコロンは名前に含まれますが (例:
     ‘'gt;'’)、一部の名前はセミコロンなしでも標準で受け付けます。この場
     合、‘';'’ ありの名前と ‘';'’ なしの名前が両方存在します。 *note
     html.unescape(): d25. も参照してください。

     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/main/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: 3f48.

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: 12f.
module will always be available.

*note xml.dom: 12a. および *note xml.sax: 132. パッケージのドキュメント
は Python による DOM および SAX インターフェースへのバインディングに関す
る定義です。

XML に関連するサブモジュール:

   * *note xml.etree.ElementTree: 12e.: ElementTree API、シンプルで軽量
     な XML プロセッサ

   * *note xml.dom: 12a.: DOM API の定義

   * *note xml.dom.minidom: 12b.: 最小限の DOM の実装

   * *note xml.dom.pulldom: 12c.: 部分的な DOM ツリー構築のサポート

   * *note xml.sax: 132.: SAX2 基底クラスと便利関数群

   * *note xml.parsers.expat: 12f.: Expat parser バインディング

This module also defines utility functions.

 -- の関数: xml.is_valid_name (name)

     Return ‘True’ if the string is a valid element or attribute name,
     ‘False’ otherwise.

     Almost all characters are permitted in names, except control
     characters and those which either are or reasonably could be used
     as delimiters.  Characters like ":", "-", ".", "_", and "·" are
     permitted, but "<", "/", "!", "?", and "=" are forbidden.  The name
     cannot start with a digit or a character like "-", ".", and "·".

     Added in version 3.15.

 -- の関数: xml.is_valid_text (data)

     Return ‘True’ if the string is a sequence of legal XML 1.0
     characters, ‘False’ otherwise.

     Almost all characters are permitted in XML 1.0 documents, except C0
     control characters (excluding TAB, CR and LF), surrogate characters
     and special Unicode characters U+FFFE and U+FFFF.

     Added in version 3.15.

* Menu:

* XML security::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 1d4a. in your
environment.  Python may be vulnerable if it uses such older versions of
Expat.  Check ‘pyexpat.EXPAT_VERSION’.

*note xmlrpc: 136. 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: 3f48.

* Menu:

* チュートリアル: チュートリアル<3>.
* XPath サポート::
* リファレンス: リファレンス<5>.
* XInclude サポート::
* リファレンス: リファレンス<6>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: d1d. および木構造内の単一ノードを表す *note Element: 34b. -
を持っています。文書全体とのやりとり (ファイルの読み書き) は通常
‘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(): 3f52. は XML を文字列から *note Element: 34b. に直接
パースします。‘Element’ はパースされた木のルート要素です。他のパース関数
は *note ElementTree: d1d. を作成するかもしれません。ドキュメントをきち
んと確認してください。

*note Element: 34b. として、‘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: e1c. コ
     ンストラクタにカスタムの *note TreeBuilder: e1d. インスタンスを渡す
     ことで、アクセスすることができます。


File: python.info,  Node: 非ブロックパースのためのプル API,  Next: 関心ある要素の検索,  Prev: XML の解析,  Up: チュートリアル<3>

5.22.5.4 非ブロックパースのためのプル API
.........................................

このモジュールが提供するパース関数のほとんどは、結果を返す前に、ドキュメ
ント全体を読む必要があります。 *note XMLParser: e1c. を使用して、インク
リメンタルにデータを渡すことは可能ではありますが、それはコールバック対象
のメソッドを呼ぶプッシュ API であり、多くの場合、低水準すぎて不便です。
ユーザーが望むのは、完全に出来上がった *note Element: 34b. オブジェクト
を便利に使いながら、操作をブロックすることなく XML のパースをインクリメ
ンタルに行えることです。

これを行うための最も強力なツールは、 *note XMLPullParser: 13a1. です。
XML データを取得するためにブロックするような読み込みは必要なく、 *note
XMLPullParser.feed(): 3f54. を呼び出して、インクリメンタルにデータを読み
ます。パースされた XML 要素を取得するには、*note
XMLPullParser.read_events(): 3f55. を呼び出します。以下に、例を示します
。

     >>> 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: 13a1. は柔軟性が非常に高いため、単純に使用したいユ
ーザーにとっては不便かもしれません。アプリケーションにおいて、XML データ
の読み取り時にブロックすることに支障がないが、インクリメンタルにパースす
る能力が欲しい場合、*note iterparse(): 3f2. を参照してください。大きな
XML ドキュメントを読んでいて、全てメモリ上にあるという状態にしたくない場
合に有用です。

Where 'immediate' feedback through events is wanted, calling method
*note XMLPullParser.flush(): 77e. 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: 34b. は、例えば、*note Element.iter(): 1708. などの、配下
(その子ノードや孫ノードなど) の部分木全体を再帰的にイテレートするいくつ
かの役立つメソッドを持っています:

     >>> 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(): 1ac1. はタグで現在の要素の直接の子要素のみ検索
します。 *note Element.find(): 1ac0. は特定のタグで '最初の' 子要素を検
索し、 *note Element.text: 3f57. は要素のテキストコンテンツにアクセスし
ます。 *note Element.get(): 3f58. は要素の属性にアクセスします:

     >>> 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: f6f. を使用すると、より洗練された方法で、検索したい要素を指
定することができます。


File: python.info,  Node: XML ファイルの編集,  Next: XML 文書の構築,  Prev: 関心ある要素の検索,  Up: チュートリアル<3>

5.22.5.6 XML ファイルの編集
...........................

*note ElementTree: d1d. は XML 文書を構築してファイルに出力する簡単な方
法を提供しています。*note ElementTree.write(): e5f. メソッドはこの目的に
適います。

*note Element: 34b. オブジェクトを作成すると、そのフィールドの直接変更
(*note Element.text: 3f57. など) や、属性の追加および変更 (*note
Element.set(): 3f5a. メソッド)、あるいは新しい子ノードの追加 (例えば
*note Element.append(): 3f5b. など) によってそれを操作できます。

例えば各 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(): 19a2. を使って要素を削除することが出来ます。例え
ば 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(): 1951. 関数は、与えられた要素に新しい子要素を作成する
便利な手段も提供しています:

     >>> 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(): 1ac0. や *note findall(): 1ac1. に渡す 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
の解析: 3f50. 節から 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: e1c. は、入力に含まれるコメントを読み飛ばし、コメ
     ントオブジェクトは作成しません。*note ElementTree: d1d. は、*note
     Element: 34b. メソッドの 1 つを使用して木内に挿入されたコメントノー
     ドのみを含みます。

 -- の関数: xml.etree.ElementTree.dump (elem)

     要素の木もしくは要素の構造を sys.stdout に出力します。この関数はデ
     バッグ目的のみに使用してください。

     出力される形式の正確なところは実装依存です。このバージョンでは、通
     常の XML ファイルとして出力されます。

     'elem' は要素の木もしくは個別の要素です。

     バージョン 3.8 で変更: *note dump(): 3f65. 関数はユーザーが指定した
     属性の順序を保持するようになりました。

 -- の関数: xml.etree.ElementTree.fromstring (text, parser=None)

     文字列定数で与えられた XML 断片を解析します。 *note XML(): 3f66. と
     同じです。 'text' には XML データを含む文字列を指定します。
     'parser' はオプションで、パーザのインスタンスを指定します。指定され
     なかった場合、標準の *note XMLParser: e1c. パーザを使用します。
     *note Element: 34b. インスタンスを返します。

 -- の関数: xml.etree.ElementTree.fromstringlist (sequence, parser=None)

     文字列フラグメントのシーケンスから XML ドキュメントを解析します。
     'sequence' は XML データのフラグメントを格納した、リストかその他の
     シーケンスです。 'parser' はオプションのパーザインスタンスです。パ
     ーザが指定されない場合、標準の *note XMLParser: e1c. パーザが使用さ
     れます。 *note Element: 34b. インスタンスを返します。

     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: 1581. 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: e1c. parser is used.  'parser' must
     be a subclass of ‘XMLParser’ and can only use the default *note
     TreeBuilder: e1d. as a target.  Returns an *note iterator: 6d4.
     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(): 3f2. は木をインクリメンタルに構築しますが、
     'source' (または指定のファイル) でのブロッキング読みを起こします。
     したがって、ブロッキング読みが許可されないアプリケーションには適し
     ません。完全に非ブロックのパースのためには、*note XMLPullParser:
     13a1. を参照してください。

          注釈: *note iterparse(): 3f2. は "start" イベントを発行した時
          に開始タグの文字 ">" が現れたことだけを保証します。そのため、
          属性は定義されますが、その時点ではテキストの内容も tail 属性も
          定義されていません。同じことは子要素にも言えて、その時点ではあ
          るともないとも言えません。

          全部揃った要素が必要ならば、"end" イベントを探してください。

     バージョン 3.4 で非推奨: 'parser' 引数。

     バージョン 3.8 で変更: イベント ‘comment’, ‘pi’ が追加されました。

     バージョン 3.13 で変更: Added the ‘close()’ method.

     バージョン 3.15 で変更: A *note ResourceWarning: 754. is now
     emitted if the iterator opened a file and is not explicitly closed.

 -- の関数: xml.etree.ElementTree.parse (source, parser=None)

     XML 断片を解析して要素の木にします。 'source' には XML データを含む
     ファイル名またはファイルオブジェクトを指定します。 'parser' はオプ
     ションでパーザインスタンスを指定します。パーザが指定されない場合、
     標準の *note XMLParser: e1c. パーザが使用されます。 *note
     ElementTree: d1d. インスタンスを返します。

 -- の関数: xml.etree.ElementTree.ProcessingInstruction (target,
          text=None)

     PI 要素のファクトリです。このファクトリ関数は XML の処理命令として
     シリアライズされた特別な要素を作成します。'target' は PI ターゲット
     を含んだ文字列です。'text' を指定する場合は PI コンテンツを含む文字
     列にします。PI を表わす要素インスタンスを返します。

     Note that *note XMLParser: e1c. skips over processing instructions
     in the input instead of creating PI objects for them.  An *note
     ElementTree: d1d. will only contain processing instruction nodes if
     they have been inserted into to the tree using one of the *note
     Element: 34b. 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' は追加の属性で、キーワード引数として与えます。要素インスタ
     ンスを返します。

     バージョン 3.15 で変更: 'attrib' can now be a *note frozendict:
     18d.

     バージョン 3.15 で変更: 'parent' and 'tag' are now positional-only
     parameters.

 -- の関数: xml.etree.ElementTree.tostring (element,
          encoding='us-ascii', method='xml', *, xml_declaration=None,
          default_namespace=None, short_empty_elements=True)

     XML 要素を全ての子要素を含めて表現する文字列を生成します。
     'element' は *note Element: 34b. のインスタンスです。 'encoding'
     (2) は出力エンコーディング(デフォルトは US-ASCII)です。Unicode 文字
     列を生成するには、‘encoding="unicode"’ を使用してください。
     'method' は ‘"xml"’, ‘"html"’, ‘"text"’ のいずれか(デフォルトは
     ‘"xml"’) です。 'xml_declaration', 'default_namespace',
     'short_empty_elements' は、 *note ElementTree.write(): e5f. での意
     味と同じ意味を持ちます。 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: 34b. のインスタンスです。 'encoding'
     (3) は出力エンコーディング(デフォルトは US-ASCII)です。Unicode 文字
     列を生成するには、‘encoding="unicode"’ を使用してください。
     'method' は ‘"xml"’, ‘"html"’, ‘"text"’ のいずれか(デフォルトは
     ‘"xml"’) です。 xml_declaration*, 'default_namespace',
     'short_empty_elements' は、 *note ElementTree.write(): e5f. での意
     味と同じ意味を持ちます。 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(): 13a4. 関数はユーザーが
     指定した属性の順序を保持するようになりました。

 -- の関数: xml.etree.ElementTree.XML (text, parser=None)

     文字列定数で与えられた XML 断片を解析します。この関数は Python コー
     ドに "XML リテラル" を埋め込むのに使えます。 'text' には XML データ
     を含む文字列を指定します。 'parser' はオプションで、パーザのインス
     タンスを指定します。指定されなかった場合、標準の *note XMLParser:
     e1c. パーザを使用します。 *note Element: 34b. インスタンスを返しま
     す。

 -- の関数: xml.etree.ElementTree.XMLID (text, parser=None)

     文字列定数で与えられた XML 断片を解析し、要素 ID と要素を対応付ける
     辞書を返します。 'text' には XMLデータを含んだ文字列を指定します。
     'parser' はオプションで、パーザのインスタンスを指定します。指定され
     なかった場合、標準の *note XMLParser: e1c. パーザを使用します。
     *note Element: 34b. のインスタンスと辞書のタプルを返します。

   ---------- 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: 12d. 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 オブジェクト::
* 例外: 例外<23>.


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: 34b. 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: 34b. or an
     *note ElementTree: d1d. instance to find such element.  'loader' is
     an optional resource loader.  If omitted, it defaults to *note
     default_loader(): 3f72.  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' は追加の属性で、キーワー
     ド引数として与えます。要素インスタンスを返します。

     バージョン 3.15 で変更: 'attrib' can now be a *note frozendict:
     18d.

     バージョン 3.15 で変更: 'tag' is now a positional-only parameter.

      -- の属性: 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():
          1593. を参照してください。例えば ‘"".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: 34b. でない場合、*note
          TypeError: 29c. を送出します。

      -- メソッド: extend (subelements)

          Appends 'subelements' from an iterable of elements.  Raises
          *note TypeError: 29c. 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: f6f.  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:
          f6f.  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: f6f.  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: 34b. でない場合、*note
          TypeError: 29c. を送出します。

      -- メソッド: iter (tag=None)

          現在の要素を根とする木の *note イテレータ: 6d4. を作成します。
          イテレータは現在の要素とそれ以下のすべての要素を、文書内での出
          現順 (深さ優先順) でイテレートします。 'tag' が ‘None’ または
          ‘'*'’ でない場合、与えられたタグに等しいものについてのみイテレ
          ータから返されます。イテレート中に木構造が変更された場合の結果
          は未定義です。

          Added in version 3.2.

      -- メソッド: iterfind (match, namespaces=None)

          タグ名または *note パス: f6f. にマッチするすべての子要素を検索
          します。マッチしたすべての要素を文書内での出現順で yield する
          イテレータを返します。'namespaces' はオプションで、名前空間接
          頭辞と完全名を対応付けるマップオブジェクトを指定します。

          Added in version 3.2.

      -- メソッド: itertext ()

          テキストのイテレータを作成します。イテレータは、この要素とすべ
          ての子要素を文書上の順序で巡回し、すべての内部のテキストを返し
          ます。

          Added in version 3.2.

      -- メソッド: makeelement (tag, attrib)

          現在の要素と同じ型の新しい要素オブジェクトを作成します。このメ
          ソッドは呼び出さずに、 *note SubElement(): 1951. ファクトリ関
          数を使って下さい。

      -- メソッド: remove (subelement)

          要素から 'subelement' を削除します。find* メソッド群と異なり、
          このメソッドは要素をインスタンスの同一性で比較します。タグや内
          容では比較しません。

     *note Element: 34b. オブジェクトは以下のシーケンス型のメソッドを、
     サブ要素を操作するためにサポートします: *note __delitem__(): 1686,
     *note __getitem__(): 78d, *note __setitem__(): 1685, *note
     __len__(): 19aa.

     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: 2d4.

     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(): e1b. 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(): 1ac0. と同じで、木の根要素を起点とします
          。

      -- メソッド: findall (match, namespaces=None)

          *note Element.findall(): 1ac1. と同じで、木の根要素を起点とし
          ます。

      -- メソッド: findtext (match, default=None, namespaces=None)

          *note Element.findtext(): 192b. と同じで、木の根要素を起点とし
          ます。

      -- メソッド: getroot ()

          この木のルート要素を返します。

      -- メソッド: iter (tag=None)

          根要素に対する、木を巡回するイテレータを返します。イテレータは
          木のすべての要素に渡ってセクション順にループします。'tag' は探
          したいタグです (デフォルトではすべての要素を返します)。

      -- メソッド: iterfind (match, namespaces=None)

          *note Element.iterfind(): 1592. と同じで、木の根要素を起点とし
          ます。

          Added in version 3.2.

      -- メソッド: parse (source, parser=None)

          外部の XML 断片をこの要素木に入れます。'source' にはファイル名
          か *note ファイルオブジェクト: 1581. を指定します。'parser' は
          オプションで、パーザインスタンスを指定します。パーザが指定され
          ない場合、標準の *note XMLParser: e1c. パーザが使用されます。
          断片の根要素を返します。

      -- メソッド: write (file, encoding='us-ascii',
               xml_declaration=None, default_namespace=None,
               method='xml', *, short_empty_elements=True)

          要素の木をファイルに XML として書き込みます。 'file' は、書き
          込み用に開かれたファイル名または *note ファイルオブジェクト:
          1581. です。 '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: 1ea.) かバ
          イト列 (*note bytes: 1d2.) になります。'encoding' が
          ‘"unicode"’ の場合、出力は文字列になり、それ以外ではバイト列に
          なります。'file' が *note ファイルオブジェクト: 1581. の場合、
          型が衝突する場合があります。文字列をバイト列ファイルへ書き込ん
          だり、その逆を行わないよう注意してください。

          バージョン 3.4 で変更: 'short_empty_elements' 引数を追加しまし
          た。

          バージョン 3.8 で変更: *note write(): e5f. メソッドはユーザー
          が指定した属性の順序を保持するようになりました。

以下はこれから操作する 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: 3f89. インスタンスは不透明です。


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(): 3f64. and *note
     ProcessingInstruction(): 3f6a. 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: 34b. インスタンスになります。

      -- メソッド: 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: e1d. オブジェクトは以下のメソ
     ッドを提供できます:

      -- メソッド: doctype (name, pubid, system)

          doctype 宣言を処理します。 'name' は doctype 名です。 'pubid'
          は公式の識別子です。 'system' はシステム識別子です。このメソッ
          ドはデフォルトの *note TreeBuilder: e1d. クラスには存在しませ
          ん。

          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(): e1b. 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:
     12f. を使用します。*note feed(): 3f95. メソッドで XML データをイン
     クリメンタルに受け取り、'target' オブジェクトのコールバックを呼び出
     すことで、パースイベントをプッシュ API に変換します。'target' が省
     略された場合、標準の *note TreeBuilder: e1d. が使用されます。
     'encoding' (1) が指定された場合、このあたいは XML ファイル内で指定
     されたエンコーディングを上書きします。

     バージョン 3.8 で変更: Parameters are now *note keyword-only: 7a9.
     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(): 780.
          for details.

          ‘flush()’ has been backported to some prior releases of
          CPython as a security fix.  Check for availability using *note
          hasattr(): 8e7. if used in code running across a variety of
          Python versions.

          Added in version 3.13.

     *note XMLParser.feed(): 3f95. は 'target' の ‘start(tag,
     attrs_dict)’ メソッドをそれぞれの開始タグに対して呼び、また
     ‘end(tag)’ メソッドを終了タグに対して呼び、そしてデータを
     ‘data(data)’ メソッドで処理します。サポートされているその他のコール
     バックメソッドについては、 *note TreeBuilder: e1d. クラスを参照して
     ください。*note XMLParser.close(): 3f96. は 'target' の ‘close()’ メ
     ソッドを呼びます。 *note XMLParser: e1c. は木構造を構築する以外にも
     使えます。以下の例では、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: 例外<23>,  Prev: XMLParser オブジェクト,  Up: リファレンス<6>

5.22.5.23 XMLPullParser オブジェクト
....................................

 -- クラス: xml.etree.ElementTree.XMLPullParser (events=None)

     非ブロックアプリケーションに適したプルパーザです。入力側の API は
     *note XMLParser: e1c. のものと似ていますが、コールバックターゲット
     に呼び出しをプッシュするのではなく、 *note XMLPullParser: 13a1. は
     パースイベントの内部リストを収集し、ユーザーがそこから読み出すこと
     ができます。'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(): 780.
          for details.

          ‘flush()’ has been backported to some prior releases of
          CPython as a security fix.  Check for availability using *note
          hasattr(): 8e7. if used in code running across a variety of
          Python versions.

          Added in version 3.13.

      -- メソッド: close ()

          パーザに、データストリームが終了したことを伝えます。*note
          XMLParser.close(): 3f96. とは異なり、このメソッドは常に *note
          None: a6a. を返します。パーザがクローズした時にまだ帰って来て
          いないイベントは、まだ *note read_events(): 3f55. で読むことが
          できます。

      -- メソッド: 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: 34b. 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: a6a. (this may change in a future
               version)

          *note read_events(): 3f55. の前の呼び出しで提供されたイベント
          は、再度 yield されることはありません。イベントは、イテレータ
          から取得された場合にのみ内部キューから消費されるため、
          ‘read_events()’ から取得されたイテレータに対して複数の読み出し
          を並行して反復的に行うと、予期せぬ結果が引き起こされます。

          注釈: *note XMLPullParser: 13a1. は "start" イベントを発行した
          時に開始タグの文字 ">" が現れたことだけを保証します。そのため
          、属性は定義されますが、その時点ではテキストの内容も tail 属性
          も定義されていません。子要素にもそれが存在する、しないにかかわ
          らず同じ物が適用されます。

          全部揃った要素が必要ならば、"end" イベントを探してください。

     Added in version 3.4.

     バージョン 3.8 で変更: イベント ‘comment’, ‘pi’ が追加されました。


File: python.info,  Node: 例外<23>,  Prev: XMLPullParser オブジェクト,  Up: リファレンス<6>

5.22.5.24 例外
..............

 -- クラス: xml.etree.ElementTree.ParseError

     解析に失敗した時、このモジュールの様々なメソッドから送出される XML
     解析エラーです。この例外のインスタンスが表す文字列は、ユーザフレン
     ドリなメッセージを含んでいます。その他に、以下の属性も利用できます:

      -- の属性: code

          expat パーザからの数値エラーコードです。エラーコードの一覧とそ
          れらの意味については、*note xml.parsers.expat: 12f. のドキュメ
          ントを参照してください。

      -- の属性: 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(): 3fa0. が定義されているはずです。 DOM レベ
ル 3 ではロード(Load)/ストア(Store) 仕様が追加され、リーダのインターフェ
ースにを定義していますが、Python 標準ライブラリではまだ利用することがで
きません。

DOM 文書オブジェクトを生成したら、そのプロパティとメソッドを使って XML 文
書の一部にアクセスできます。これらのプロパティは DOM 仕様で定義されてい
ます; 本リファレンスマニュアルでは、Python において DOM 仕様がどのように
解釈されているかを記述しています。

W3C から提供されている仕様は、 DOM API を Java、ECMAScript、および OMG
IDL で定義しています。ここで定義されている Python での対応づけは、大部分
がこの仕様の IDL 版に基づいていますが、厳密な準拠は必要とされていません
(実装で IDL の厳密な対応付けをサポートするのは自由ですが)。API への対応
付けに関する詳細な議論は *note 適合性: 3fa1. を参照してください。

参考
....

Document Object Model (DOM) Level 2 Specification(2)

     Python DOM API が準拠している W3C 勧告。

Document Object Model (DOM) Level 1 Specification(3)

     *note xml.dom.minidom: 12b. でサポートされている W3C の DOM に関す
     る勧告。

Python Language Mapping Specification(4)

     このドキュメントでは OMG IDL から Python への対応付けを記述していま
     す。

* Menu:

* モジュールコンテンツ: モジュールコンテンツ<2>.
* DOM 内のオブジェクト::
* 適合性::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: 1c8. を送出します。 '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 オブジェクト: 3faa.根底にある実装へのインターフェース
                                                                             。
                                                                             
                                                                             
‘Node’                               *note Node オブジェクト: 3fab.          ドキュメント内の大部分のオブジェク
                                                                             トに対する基底インターフェース。
                                                                             
                                                                             
‘NodeList’                           *note NodeList オブジェクト: 25bf.      ノード列に対するインターフェース。
                                                                             
                                                                             
‘DocumentType’                       *note DocumentType オブジェクト: 3fac.  ドキュメントの処理に必要な宣言につ
                                                                             いての情報。
                                                                             
                                                                             
‘Document’                           *note Document オブジェクト: 3fad.      ドキュメント全体を表現するオブジェ
                                                                             クト。
                                                                             
                                                                             
‘Element’                            *note Element オブジェクト: 3fae.       ドキュメント階層内の要素ノード。
                                                                             
                                                                             
‘Attr’                               *note Attr オブジェクト: 3faf.          要素ノード上の属性値ノード。
                                                                             
                                                                             
‘Comment’                            *note Comment オブジェクト: 3fb0.       ソースドキュメント内のコメント表現
                                                                             。
                                                                             
                                                                             
‘Text’                               *note Text オブジェクトおよび CDATASection オブジェクト: 3fb1.ドキュメント内のテキスト記述を含む
                                                                             ノード。
                                                                             
                                                                             
‘ProcessingInstruction’              *note ProcessingInstruction オブジェクト: 3fb2.処理命令 (processing instruction) 表
                                                                             現。
                                                                             

さらに追加の節として、Python で DOM を利用するために定義されている例外に
ついて記述しています。

* Menu:

* DOMImplementation オブジェクト::
* Node オブジェクト::
* NodeList オブジェクト::
* DocumentType オブジェクト::
* Document オブジェクト::
* Element オブジェクト: Element オブジェクト<2>.
* Attr オブジェクト::
* NamedNodeMap Objects::
* Comment オブジェクト::
* Text オブジェクトおよび CDATASection オブジェクト::
* ProcessingInstruction オブジェクト::
* 例外: 例外<24>.


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(): 3fb6. によって生成された ‘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: 3fbb. も参照してください。このノードが親ノー
     ドにおける末尾の子ノードである場合、属性値は ‘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: 3fc3. と似ています。こ
     の属性の値は文字列または ‘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: 15a. が送出されます。 'newChild' が返されます。もし
     'refChild' が ‘None’ なら、 'newChild' を子ノードリストの最後に挿入
     します。

 -- メソッド: Node.removeChild (oldChild)

     子ノードを削除します。 'oldChild' はこのノードの子ノードでなければ
     なりません。そうでない場合、 *note ValueError: 15a. が送出されます
     。成功した場合 'oldChild' が返されます。 'oldChild' をそれ以降使わ
     ない場合、 ‘unlink()’ メソッドを呼び出さなければなりません。

 -- メソッド: Node.replaceChild (newChild, oldChild)

     既存のノードと新たなノードを置き換えます。この操作は 'oldChild' が
     現在のノードの子ノードである場合に限られます; そうでない場合、
     *note ValueError: 15a. が送出されます。

 -- メソッド: 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__(): 19aa. と *note
__getitem__(): 78d. をサポートしなければなりません; このサポートにより、
*note for: 329. 文内で ‘NodeList’ にわたる繰り返しと、組み込み関数 *note
len(): a24. の適切なサポートができるようになります。

DOM 実装が文書の変更をサポートしている場合、 ‘NodeList’ の実装でも *note
__setitem__(): 1685. および *note __delitem__(): 1686. メソッドをサポー
トしなければなりません。


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: 3fed. が送出されます。

 -- メソッド: Element.removeAttributeNode (oldAttr)

     'oldAttr' が属性リストにある場合、削除して返します。 'oldAttr' が存
     在しない場合、 *note NotFoundErr: 3fed. が送出されます。

 -- メソッド: Element.removeAttributeNS (namespaceURI, localName)

     名前で指定された属性を削除します。このメソッドは 'qname' ではなく
     'localName' を使うので注意してください。該当する属性がなくても例外
     は送出されません。

 -- メソッド: Element.setAttribute (name, value)

     文字列を使って属性値を設定します。

 -- メソッド: Element.setAttributeNode (newAttr)

     新たな属性ノードを要素に追加します。 ‘name’ 属性が既存の属性に一致
     した場合、必要に応じて属性を置換します。置換が行われると古い属性ノ
     ードが返されます。 'newAttr' がすでに使われていれば、 *note
     InuseAttributeErr: 3ff2. が送出されます。

 -- メソッド: Element.setAttributeNodeNS (newAttr)

     新たな属性ノードを要素に追加します。 ‘namespaceURI’ および
     ‘localName’ 属性が既存の属性に一致した場合、必要に応じて属性を置き
     換えます。置換が生じると、古い属性ノードが返されます。 'newAttr' が
     すでに使われていれば、 *note InuseAttributeErr: 3ff2. が送出されま
     す。

 -- メソッド: 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: 例外<24>,  Prev: Text オブジェクトおよび CDATASection オブジェクト,  Up: DOM 内のオブジェクト

5.22.6.13 ProcessingInstruction オブジェクト
............................................

XML 文書内の処理命令を表現します; ‘Node’ インターフェースを継承していま
すが、子ノードを持つことはできません。

 -- の属性: ProcessingInstruction.target

     最初の空白文字までの処理命令の内容です。読み出し専用の属性です。

 -- の属性: ProcessingInstruction.data

     最初の空白文字以降の処理命令の内容です。


File: python.info,  Node: 例外<24>,  Prev: ProcessingInstruction オブジェクト,  Up: DOM 内のオブジェクト

5.22.6.14 例外
..............

DOM レベル 2 勧告では、単一の例外 *note DOMException: 4007. と、どの種の
エラーが発生したかをアプリケーションが決定できるようにする多くの定数を定
義しています。 ‘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: 4008.
                                           
                                           
‘HIERARCHY_REQUEST_ERR’                    *note HierarchyRequestErr: 4009.
                                           
                                           
‘INDEX_SIZE_ERR’                           *note IndexSizeErr: 400a.
                                           
                                           
‘INUSE_ATTRIBUTE_ERR’                      *note InuseAttributeErr: 3ff2.
                                           
                                           
‘INVALID_ACCESS_ERR’                       *note InvalidAccessErr: 400b.
                                           
                                           
‘INVALID_CHARACTER_ERR’                    *note InvalidCharacterErr: 400c.
                                           
                                           
‘INVALID_MODIFICATION_ERR’                 *note InvalidModificationErr: 400d.
                                           
                                           
‘INVALID_STATE_ERR’                        *note InvalidStateErr: 400e.
                                           
                                           
‘NAMESPACE_ERR’                            *note NamespaceErr: 400f.
                                           
                                           
‘NOT_FOUND_ERR’                            *note NotFoundErr: 3fed.
                                           
                                           
‘NOT_SUPPORTED_ERR’                        *note NotSupportedErr: 4010.
                                           
                                           
‘NO_DATA_ALLOWED_ERR’                      *note NoDataAllowedErr: 4011.
                                           
                                           
‘NO_MODIFICATION_ALLOWED_ERR’              *note NoModificationAllowedErr: 4012.
                                           
                                           
‘SYNTAX_ERR’                               *note SyntaxErr: 4013.
                                           
                                           
‘WRONG_DOCUMENT_ERR’                       *note WrongDocumentErr: 4014.
                                           

   ---------- 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: 1b4. を送出してもかまいません。

しかしながら、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: 12e. module for their XML processing
instead.

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3f48.

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(): 401d. 関数はファイル名か、開かれたファイルオブジェクトを
引数にとることができます。

 -- の関数: xml.dom.minidom.parse (filename_or_file, parser=None,
          bufsize=None)

     与えられた入力から ‘Document’ を返します。 'filename_or_file' はフ
     ァイル名でもファイルオブジェクトでもかまいません。 'parser' を指定
     する場合、SAX2 パーザオブジェクトでなければなりません。この関数はパ
     ーザの文書ハンドラを変更し、名前空間サポートを有効にします; (エンテ
     ィティリゾルバ (entity resolver) のような) 他のパーザ設定は前もって
     おこなわなければなりません。

XML データを文字列で持っている場合、 *note parseString(): 401e. を代わり
に使うことができます:

 -- の関数: xml.dom.minidom.parseString (string, parser=None)

     'string' を表わす ‘Document’ を返します。このメソッドは、文字列に対
     する *note io.StringIO: 12d8. オブジェクトを作成し、それを *note
     parse(): 401d. に渡します。

これらの関数は両方とも、文書の内容を表現する ‘Document’ オブジェクトを返
します。

What the *note parse(): 401d. and *note parseString(): 401e. 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: 12a. 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/main/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: 12a. module documentation.  This section lists the differences
between the API and ‘xml.dom.minidom’.

 -- メソッド: Node.unlink ()

     DOM との内部的な参照を破壊して、循環参照ガベージコレクションを持た
     ないバージョンの Python でもガベージコレクションされるようにします
     。循環参照ガベージコレクションが利用できる場合でも、このメソッドを
     使えば大量のメモリをすぐに使えるようにできるため、不要になったらす
     ぐに DOM オブジェクトに対してこのメソッドを呼ぶのが良い習慣です。こ
     のメソッドは ‘Document’ オブジェクトに対して呼び出すだけでよいので
     すが、あるノードの子ノードを破棄するために子ノードに対して呼び出し
     てもかまいません。

     *note with: 215. ステートメントを使用することで、このメソッドを明示
     的に呼ばないようにできます。 ‘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(): e5c. メソッドはユーザーが
     指定した属性の順序を保持するようになりました。

     バージョン 3.9 で変更: 'standalone' パラメータが追加されました。

 -- メソッド: Node.toxml (encoding=None, standalone=None)

     DOM ノードによって表わされる XML を含んだ文字列またはバイト文字列を
     返します。

     明示的に 'encoding' (1) 引数を渡すと、結果は指定されたエンコードの
     バイト文字列になります。'encoding' 引数なしだと、結果は unicode 文
     字列です。また、結果として生じる文字列の中の XML 宣言はエンコーディ
     ングを指定しません。XML のデフォルトエンコーディングは UTF-8 なので
     、この文字列を UTF-8 以外でエンコードすることはおそらく正しくありま
     せん。

     'standalone' 引数は *note writexml(): e5c. と全く同じ動作をします。

     バージョン 3.8 で変更: *note toxml(): e5d. メソッドはユーザーが指定
     した属性の順序を保持するようになりました。

     バージョン 3.9 で変更: 'standalone' パラメータが追加されました。

 -- メソッド: Node.toprettyxml (indent='\t', newl='\n', encoding=None,
          standalone=None)

     文書の整形されたバージョンを返します。 'indent' はインデントを行う
     ための文字で、デフォルトはタブです; 'newl' には行末で出力される文字
     列を指定し、デフォルトは ‘\n’ です。

     'encoding' 引数は *note toxml(): e5d. の対応する引数と同様に振る舞
     います。

     'standalone' 引数は *note writexml(): e5c. と全く同じ動作をします。

     バージョン 3.8 で変更: *note toprettyxml(): e5e. メソッドはユーザー
     が指定した属性の順序を保持するようになりました。

     バージョン 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: 32b. パラメタの
     みを使うので、引数は通常の順番 (左から右へ) で渡されます。オプショ
     ン引数はありません。 ‘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: 29c. and *note AttributeError: 1b4.

   * ‘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: 3f48.

バージョン 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(): 4029. メソッドを使用して DOM 関連の処理に切
り替える必要があります。

 -- クラス: xml.dom.pulldom.PullDOM (documentFactory=None)

     *note xml.sax.handler.ContentHandler: 402b. のサブクラスです。

 -- クラス: xml.dom.pulldom.SAX2DOM (documentFactory=None)

     *note xml.sax.handler.ContentHandler: 402b. のサブクラスです。

 -- の関数: xml.dom.pulldom.parse (stream_or_string, parser=None,
          bufsize=None)

     与えられた入力から *note DOMEventStream: b21. を返します。
     'stream_or_string' はファイル名かファイル様オブジェクトのいずれかで
     す。'parser' は、与えれた場合、 *note XMLReader: 402e. オブジェクト
     でなければなりません。この関数はパーザの文書ハンドラを変えて名前空
     間のサポートを有効にします。パーザの他の設定 (例えばエンティティリ
     ゾルバ) は前もってしておかなければなりません。

XML データを文字列で持っている場合、 *note parseString(): 402f. を代わり
に使うことができます:

 -- の関数: xml.dom.pulldom.parseString (string, parser=None)

     (ユニコード) 'string' を表す *note DOMEventStream: b21. を返します
     。

 -- データ: xml.dom.pulldom.default_bufsize

     *note parse(): 402d. の 'bufsize' パラメタのデフォルト値です。

     この変数の値は *note parse(): 402d. を呼び出す前に変更することがで
     きます。その場合、その新しい値が有効になります。

* Menu:

* DOMEventStream オブジェクト::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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__(): 78d. メソッドのサポー
     トは削除されました。

      -- メソッド: 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(): 4029.
          が呼ばれない限り、現在のノードは子ノードの情報を持ちません。

      -- メソッド: 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: 3f48.

バージョン 3.7.1 で変更: SAXパーサーは、セキュリティーを向上させるために
、デフォルトで一般的な外部エンティティーを処理しなくなりました。以前は、
パーサーは、DTDおよびエンティティ用にファイルシステムからリモートファイ
ルまたはロードされたローカルファイルをフェッチするためのネットワーク接続
を作成していました。この機能は parser オブジェクトと(実) 引数 *note
feature_external_ges: 19d7. の *note setFeature(): 4038. メソッドで再度
有効にすることができます。

その関数群は以下の通りです:

 -- の関数: xml.sax.make_parser (parser_list=[])

     SAX *note XMLReader: 402e. オブジェクトを生成し、返します。最初に見
     つかったパーサーが使用されます。'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: 402b. のインスタントである必要があります。
     'error_handler' が与えられる場合は、 SAX *note ErrorHandler: 4039.
     のインスタンスである必要があります。この引数を省略した場合、全ての
     例外に対して *note SAXParseException: 403a. が発生します。 戻り値は
     ありません。すべての操作は渡される 'handler' によって行われなければ
     なりません。

 -- の関数: xml.sax.parseString (string, handler,
          error_handler=handler.ErrorHandler())

     *note parse(): 1ff4. と同様ですが、こちらは引数で受け取ったバッファ
     'string' をパースします。 'string' は *note str: 1ea. インスタンス
     か *note bytes-like object: 43d. でなければなりません。

     バージョン 3.5 で変更: *note str: 1ea. インスタンスがサポートされま
     した。

典型的な 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: 124f, *note Locator:
403b, ‘Attributes’, ‘AttributesNS’, and *note XMLReader: 402e.
interfaces are defined in the module *note xml.sax.xmlreader: 135.  The
handler interfaces are defined in *note xml.sax.handler: 133.  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: 4039. で定義されているハンドラがこの
     例外のインスタンスを受け取ることに注意してください。実際に例外を発
     生させることは必須でなく、情報のコンテナとして利用されることもある
     からです。

     インスタンスを作成する際 'msg' はエラー内容を示す可読データにしてく
     ださい。オプションの 'exception' 引数は ‘None’ にするか、パース用コ
     ードで捕捉されて情報として渡される例外にしてください。

     このクラスはSAX 例外の基底クラスになります。

 -- 例外: xml.sax.SAXParseException (msg, exception, locator)

     パースエラー時に発生する *note SAXException: 403c. のサブクラスです
     。パースエラーに関する情報として、このクラスのインスタンスが SAX
     *note ErrorHandler: 4039. インターフェースのメソッドに渡されます。
     このクラスは *note SAXException: 403c. 同様 SAX *note Locator:
     403b. インターフェースもサポートしています。

 -- 例外: xml.sax.SAXNotRecognizedException (msg, exception=None)

     SAX *note XMLReader: 402e. が認識できない機能やプロパティに遭遇した
     とき発生させる *note SAXException: 403c. のサブクラスです。 SAX ア
     プリケーションや拡張モジュールにおいて同様の目的にこのクラスを利用
     することもできます。

 -- 例外: xml.sax.SAXNotSupportedException (msg, exception=None)

     SAX *note XMLReader: 402e. が要求された機能をサポートしていないとき
     発生させる *note SAXException: 403c. のサブクラスです。 SAX アプリ
     ケーションや拡張モジュールにおいて同様の目的にこのクラスを利用する
     こともできます。

参考
....

SAX: The Simple API for XML(2)

     SAX API 定義に関し中心となっているサイトです。Java による実装とオン
     ライン・ドキュメントが提供されています。実装と SAX API の歴史に関す
     る情報のリンクも掲載されています。

*note xml.sax.handler: 133. モジュール

     アプリケーションが提供するオブジェクトのインターフェース定義。

*note xml.sax.saxutils: 134. モジュール

     SAX アプリケーション向けの有用な関数群。

*note xml.sax.xmlreader: 135. モジュール

     パーサが提供するオブジェクトのインターフェース定義。

* Menu:

* SAXException オブジェクト::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: 403c. 例外クラスは以下のメソッドをサポートしています
:

 -- メソッド: 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/main/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: 402b. はアプリケーション側でサブクラス化して利用す
ることが前提になっています。パーサは入力ドキュメントのイベントにより、そ
れぞれに対応する以下のメソッドを呼び出します:

 -- メソッド: ContentHandler.setDocumentLocator (locator)

     アプリケーションにドキュメントイベントの発生位置を指すロケータを与
     えるためにパーサから呼び出されます。

     SAX パーサによるロケータの提供は強く推奨されています(必須ではありま
     せん)。もし提供する場合は、DocumentHandler インターフェースのどのメ
     ソッドよりも先にこのメソッドが呼び出されるようにしなければなりませ
     ん。

     パーサがエラーを報告しない場合でも、ロケータによってアプリケーショ
     ンは全てのドキュメント関連イベントの終了位置を知ることが出来ます。
     通常、アプリケーションは自身のエラー (例えば文字コンテンツがアプリ
     ケーションの規則に適合しない場合) を報告するためにこれを使用します
     。 ロケータが返す情報は検索エンジンでの利用にはおそらく不充分です。

     ロケータが正しい情報を返すのは、このインターフェースからイベントの
     呼出しが実行されている間だけです。それ以外のときは使用すべきであり
     ません。

 -- メソッド: ContentHandler.startDocument ()

     ドキュメントの開始通知を受け取ります。

     SAX パーサはこのインターフェースやDTDHandler のどのメソッド (*note
     setDocumentLocator(): 4055. を除く) よりも先にこのメソッドを一度だ
     け呼び出します。

 -- メソッド: ContentHandler.endDocument ()

     ドキュメントの終了通知を受け取ります。

     SAX パーサはこのメソッドを一度だけ呼び出します。パース中に呼び出す
     最後のメソッドです。パーサは (回復不能なエラーで) パース処理を中断
     するか、あるいは入力の最後に到達するまでこのメソッドを呼び出しませ
     ん。

 -- メソッド: ContentHandler.startPrefixMapping (prefix, uri)

     接頭辞と URI 名前空間の関連付けのスコープを開始します。

     このイベントからの情報は名前空間処理に必須ではありません。SAX XML リ
     ーダは ‘feature_namespaces’ 機能が有効な場合 (デフォルト)、要素と属
     性名の接頭辞を自動的に置換します。

     しかしながら、接頭辞の自動展開を安全に行えないために、アプリケーシ
     ョンが文字データや属性値の中で接頭辞を使わなければならない場合があ
     ります。 必要ならば *note startPrefixMapping(): 4058. や *note
     endPrefixMapping(): 4059. イベントはアプリケーションにコンテキスト
     自身の中で接頭辞を展開するための情報を提供します。

     *note startPrefixMapping(): 4058. と *note endPrefixMapping():
     4059. イベントは相互に正しい入れ子関係になることが保証されていない
     ので注意が必要です。すべての ‘startPrefixMapping()’ は対応する
     *note startElement(): 18fb. の前に発生し、 ‘endPrefixMapping()’ イ
     ベントは対応する *note endElement(): 18fc. の後で発生しますが、その
     順序は保証されていません。

 -- メソッド: ContentHandler.endPrefixMapping (prefix)

     接頭辞と URI の関連付けのスコープを終了します。

     詳しくは *note startPrefixMapping(): 4058. を参照してください。この
     イベントは常に対応する *note endElement(): 18fc. の後で発生しますが
     、複数の *note endPrefixMapping(): 4059. イベントの順序は特に保証さ
     れません。

 -- メソッド: 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: 405a. 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(): 18fb. イベントとまったく同じ要
     素型名を持ちます。

 -- メソッド: 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: 405c. 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(): 405b. イベントとまったく同じ
     要素型を持ちます。 '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: 4046. インスタンスは以下のメソッドを提供します:

 -- メソッド: 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: 402e.  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: 403a. 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(): 4077. に似ていますが、 'data' は属性値の作成に使わ
     れます。戻り値はクォート済みの 'data' で、置換する文字の追加も可能
     です。 *note quoteattr(): 4079. はクォートすべき文字を '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: 402b. インターフェースを実装しています。 つまり、
     *note XMLGenerator: 407a. をコンテントハンドラとして用いることで、
     パースしている元々の文書を複製することが出来ます。 '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: 402e. とクライアント・アプリケーショ
     ンのイベント・ハンドラとの間に位置するものとして設計されています。
     デフォルトでは何もせず、ただリクエストをリーダに、イベントをハンド
     ラに、それぞれ加工せず渡すだけです。しかし、サブクラスでメソッドを
     オーバーライドすると、イベント・ストリームやリクエストを加工してか
     ら渡すように変更可能です。

 -- の関数: xml.sax.saxutils.prepare_input_source (source, base='')

     この関数は引数に入力ソース、オプションとして URL を取り、読み取り可
     能な解決済み *note InputSource: 124f. オブジェクトを返します。入力
     ソースは文字列、ファイル風オブジェクト、 ‘InputSource’ のいずれでも
     良く、この関数を使うことで、パーサは様々な 'source' 引数を *note
     parse(): 407d. メソッドに実装することが可能になります。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: 402e. インター
フェースを実装しており、関数 ‘create_parser()’ を提供しています。この関
数は新たなパーサ・オブジェクトを生成する際、 *note
xml.sax.make_parser(): 2029. から引数なしで呼び出されます。

 -- クラス: 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: 402e. がエンティティを読み込むために必要な情報をカ
     プセル化します。

     このクラスには公開識別子、システム識別子、(場合によっては文字エンコ
     ーディング情報を含む) バイト・ストリーム、そしてエンティティの文字
     ストリームなどの情報が含まれます。

     アプリケーションは *note XMLReader.parse(): 407d. メソッドでの使用
     や EntityResolver.resolveEntity の戻り値としてこのオブジェトを作成
     します。

     *note InputSource: 124f. はアプリケーションに属します。 *note
     XMLReader: 402e. はアプリケーションから渡された ‘InputSource’ オブ
     ジェクトの変更を許可されていませんが、コピーを作ってそれを変更する
     ことは可能です。

 -- クラス: xml.sax.xmlreader.AttributesImpl (attrs)

     ‘Attributes’ インターフェース (*note Attributes インターフェース:
     405a. 参照) の実装です。これは辞書風のオブジェクトで、
     ‘startElement()’ 内で要素の属性を表示します。最も有用な辞書操作に加
     え、インターフェースに記述されているメソッドを多数サポートしていま
     す。このクラスのオブジェクトはリーダによってインスタンス化されなけ
     ればなりません。'attrs' は属性名と属性値の対応付けを含む辞書風オブ
     ジェクトでなければなりません。

 -- クラス: xml.sax.xmlreader.AttributesNSImpl (attrs, qnames)

     *note AttributesImpl: 4082. を名前空間認識型に改良したクラスで、
     ‘startElementNS()’ に渡されます。 ‘AttributesImpl’ の派生クラスです
     が、 'namespaceURI' と 'localname' の2要素のタプルを解釈します。さ
     らに、元の文書に出てくる修飾名を返す多くのメソッドを提供します。こ
     のクラスは ‘AttributesNS’ インターフェース (*note AttributesNS
     インターフェース: 405c. 参照) の実装です。

* Menu:

* XMLReader オブジェクト::
* IncrementalParser オブジェクト::
* Locator オブジェクト::
* InputSource オブジェクト::
* Attributes インターフェース::
* AttributesNS インターフェース::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/xml/sax/xmlreader.py


File: python.info,  Node: XMLReader オブジェクト,  Next: IncrementalParser オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.22.12.1 XMLReader オブジェクト
................................

*note XMLReader: 402e. は次のメソッドをサポートします:

 -- メソッド: XMLReader.parse (source)

     入力ソースを処理し、SAX イベントを作成します。 'source' オブジェク
     トはシステム識別子 (入力ソースを特定する文字列 - 一般にファイル名や
     URL)、 *note pathlib.Path: 4f5. オブジェクトか *note path-like:
     7a5. オブジェクトまたは *note InputSource: 124f. オブジェクトです。
     *note parse(): 407d. が return したとき、入力データの処理は完了し、
     パーサ・オブジェクトは破棄ないしリセットされます。

     バージョン 3.5 で変更: 文字ストリームがサポートされました。

     バージョン 3.8 で変更: path-like オブジェクトのサポートが追加されま
     した。

 -- メソッド: XMLReader.getContentHandler ()

     現在の *note ContentHandler: 402b. を返します。

 -- メソッド: XMLReader.setContentHandler (handler)

     現在の *note ContentHandler: 402b. を設定します。 ‘ContentHandler’
     が設定されていない場合、内容イベントは破棄されます。

 -- メソッド: XMLReader.getDTDHandler ()

     現在の *note DTDHandler: 4046. を返します。

 -- メソッド: XMLReader.setDTDHandler (handler)

     現在の *note DTDHandler: 4046. を返します。 ‘DTDHandler’ が設定され
     ていな場合、DTD イベントは破棄されます。

 -- メソッド: XMLReader.getEntityResolver ()

     現在の *note EntityResolver: 4047. を返します。

 -- メソッド: XMLReader.setEntityResolver (handler)

     現在の *note EntityResolver: 4047. を返します。 ‘EntityResolver’ が
     設定されていない場合、外部エンティティの解決を試行することでエンテ
     ィティのシステム識別子が開かれます。利用できない場合は失敗します。

 -- メソッド: XMLReader.getErrorHandler ()

     現在の *note ErrorHandler: 4039. を返します。

 -- メソッド: XMLReader.setErrorHandler (handler)

     現在のエラーハンドラを設定します。*note ErrorHandler: 4039. が設定
     されていない場合、エラーが例外として送出され、警告が表示されます。

 -- メソッド: XMLReader.setLocale (locale)

     アプリケーションにエラーや警告のロケール設定を許可します。

     SAX パーサにとって、エラーや警告の地域化は必須ではありません。しか
     し、パーサが要求されたロケールをサポートしていない場合、SAX 例外を
     送出しなければなりません。アプリケーションはパースの途中でロケール
     の変更を要求することができます。

 -- メソッド: XMLReader.getFeature (featurename)

     機能 'featurename' の現在の設定を返します。その機能が認識できないと
     きは、 ‘SAXNotRecognizedException’ を送出します。有名な機能名はモジ
     ュール *note xml.sax.handler: 133. に列挙されています。

 -- メソッド: XMLReader.setFeature (featurename, value)

     機能名 'featurename' に値 'value' を設定します。その機能が認識でき
     ないときは、 ‘SAXNotRecognizedException’ を送出します。また、パーサ
     が指定された機能や設定をサポートしていないときは、
     ‘SAXNotSupportedException’ を送出します。

 -- メソッド: XMLReader.getProperty (propertyname)

     属性名 'propertyname' の現在の値を返します。その属性が認識できない
     ときは、 ‘SAXNotRecognizedException’ を送出します。有名な属性名はモ
     ジュール *note xml.sax.handler: 133. に列挙されています。

 -- メソッド: 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: 4081. のインスタンスは次の追加メソッドを提供し
ます:

 -- メソッド: 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: 403b. のインスタンスは次のメソッドを提供します:

 -- メソッド: 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: 124f. の公開識別子を設定します。

 -- メソッド: InputSource.getPublicId ()

     この *note InputSource: 124f. の公開識別子を返します。

 -- メソッド: InputSource.setSystemId (id)

     この *note InputSource: 124f. のシステム識別子を設定します。

 -- メソッド: InputSource.getSystemId ()

     この *note InputSource: 124f. のシステム識別子を返します。

 -- メソッド: InputSource.setEncoding (encoding)

     この *note InputSource: 124f. の文字エンコーディングを設定します。

     エンコーディングは XML エンコーディング宣言として受け入れられる文字
     列でなければなりません (XML 勧告の 4.3.3 節を参照)。

     *note InputSource: 124f. も文字ストリームを含んでいた場合、
     ‘InputSource’ のエンコーディング属性は無視されます。

 -- メソッド: InputSource.getEncoding ()

     この InputSource の文字エンコーディングを取得します。

 -- メソッド: InputSource.setByteStream (bytefile)

     この入力ソースのバイトストリーム (*note binary file: 227b.) を設定
     します。

     文字ストリームも指定されている場合、SAX パーサはこのバイトストリー
     ムを無視しますが、URI 接続自体を開くときには優先してバイトストリー
     ムを使います。

     アプリケーションがバイトストリームの文字エンコーディングを知ってい
     る場合は、setEncoding メソッドで設定する必要があります。

 -- メソッド: InputSource.getByteStream ()

     この入力ソースのバイトストリームを取得します。

     getEncoding メソッドは、このバイトストリームの文字エンコーディング
     を返します。不明なときは ‘None’ を返します。

 -- メソッド: InputSource.setCharacterStream (charfile)

     この入力ソースの文字ストリーム (*note text file: 227a.) を設定しま
     す。

     文字ストリームが指定された場合、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__():
1772.、‘items()’、‘keys()’、‘values()’ を含む *note
マッピングプロトコル: 1579. の一部を実装しています。以下のメソッドも提供
されています:

 -- メソッド: 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
インターフェース: 405a. 参照) のサブタイプです。 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: 3f48.

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 例外: 40b6. を参照して
     ください。

 -- 例外: xml.parsers.expat.error

     *note ExpatError: 1632. の別名です。

 -- データ: xml.parsers.expat.XMLParserType

     *note ParserCreate(): 40b9. 関数から返された戻り値の型を示します。

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: 1952.

     Expat はオプションで XML 名前空間の処理を行うことができます。これは
     引数 'namespace_separator' に値を指定することで有効になります。この
     値は、1文字の文字列でなければなりません; 文字列が誤った長さを持つ場
     合には *note ValueError: 15a. が送出されます (‘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(): 40c0. や *note
     NotationDeclHandler(): 40c1, *note UnparsedEntityDeclHandler():
     40c2. に引数 'base' としてそのまま渡されます。

 -- メソッド: xmlparser.GetBase ()

     以前の *note SetBase(): 40bf. によって設定された基底 URI を文字列の
     形で返します。 ‘SetBase()’ が呼ばれていないときには ‘None’ を返しま
     す。

 -- メソッド: xmlparser.GetInputContext ()

     現在のイベントを発生させた入力データを文字列として返します。データ
     はテキストの入っているエンティティが持っているエンコードになります
     。イベントハンドラがアクティブでないときに呼ばれると、戻り値は
     ‘None’ となります。

 -- メソッド: xmlparser.ExternalEntityParserCreate (context[, encoding])

     親となるパーザで解析された内容が参照している、外部で解析されるエン
     ティティを解析するために使える "子の" パーザを作成します。
     'context' パラメータは、以下に記すように *note
     ExternalEntityRefHandler(): 40c0. ハンドラ関数に渡される文字列でな
     ければなりません。子のパーザは *note ordered_attributes: 40c5,
     *note specified_attributes: 40c6. が現在のパーザの値に設定されて生
     成されます。

 -- メソッド: 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: a6a. を設定して *note
     ExternalEntityRefHandler: 40c0. を呼び出します。XML文書が文書型定義
     を持っていなければ、 ‘ExternalEntityRefHandler’ が呼び出しますが、
     *note StartDoctypeDeclHandler: 40c9. と *note
     EndDoctypeDeclHandler: 40ca. は呼び出されません。

     'flag' にfalseを与えると、メソッドが前回呼ばれた時のtrueの設定が解
     除されますが、他には何も起こりません。

     このメソッドは *note Parse(): 40bd. または *note ParseFile(): 40be.
     メソッドが呼び出される前にだけ呼び出されます;これら2つのメソッドの
     どちらかが呼び出されたあとにメソッドが呼ばれると、 *note code: 1b.
     に定数
     ‘errors.codes[errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING]’ が
     設定されて例外 *note ExpatError: 1632. が送出されます。

 -- メソッド: 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.

     ‘SetReparseDeferralEnabled()’ has been backported to some prior
     releases of CPython as a security fix.  Check for availability
     using *note hasattr(): 8e7. 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: 1632. is raised if this method is called on a
     *note non-root: 40bb. parser.  The corresponding *note lineno:
     40cb. and *note offset: 40cc. should not be used as they may have
     no special meaning.

     ‘SetBillionLaughsAttackProtectionActivationThreshold()’ has been
     backported to some prior releases of CPython as a security fix.
     Check for availability using *note hasattr(): 8e7. if used in code
     running across a variety of Python versions.

          注釈: Activation thresholds below 4 MiB are known to break
          support for DITA 1.3 payload and are hence not recommended.

     Added in version 3.15.

 -- メソッド:
          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: 32f. 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: 1632. is raised if this method is called on a
     *note non-root: 40bb. parser or if 'max_factor' is outside the
     valid range.  The corresponding *note lineno: 40cb. and *note
     offset: 40cc. should not be used as they may have no special
     meaning.

     ‘SetBillionLaughsAttackProtectionMaximumAmplification()’ has been
     backported to some prior releases of CPython as a security fix.
     Check for availability using *note hasattr(): 8e7. if used in code
     running across a variety of Python versions.

          注釈: The maximum amplification factor is only considered if
          the threshold that can be adjusted by *note
          SetBillionLaughsAttackProtectionActivationThreshold(): 2c4. is
          exceeded.

     Added in version 3.15.

 -- メソッド: 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: 1632. is raised if this method is called on a
     *note non-root: 40bb. parser.  The corresponding *note lineno:
     40cb. and *note offset: 40cc. should not be used as they may have
     no special meaning.

     ‘SetAllocTrackerActivationThreshold()’ has been backported to some
     prior releases of CPython as a security fix.  Check for
     availability using *note hasattr(): 8e7. if used in code running
     across a variety of Python versions.

     Added in version 3.15.

 -- メソッド: 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: 32f. 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: 1632. is raised if this method is called on a
     *note non-root: 40bb. parser or if 'max_factor' is outside the
     valid range.  The corresponding *note lineno: 40cb. and *note
     offset: 40cc. should not be used as they may have no special
     meaning.

     ‘SetAllocTrackerMaximumAmplification()’ has been backported to some
     prior releases of CPython as a security fix.  Check for
     availability using *note hasattr(): 8e7. if used in code running
     across a variety of Python versions.

          注釈: The maximum amplification factor is only considered if
          the threshold that can be adjusted by *note
          SetAllocTrackerActivationThreshold(): 2c1. is exceeded.

     Added in version 3.15.

‘xmlparser’ オブジェクトは次のような属性を持ちます:

 -- の属性: xmlparser.buffer_size

     *note buffer_text: 187a. が真の時に使われるバッファのサイズです。こ
     の属性に新しい整数値を代入することで違うバッファサイズにできます。
     サイズが変えられるときにバッファはフラッシュされます。

 -- の属性: 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(): 190f. 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: 187a. が利用可能なとき、バッファに保持されたバイ
     ト数です。これらのバイトはUTF-8でエンコードされたテキストを表します
     。この属性は ‘buffer_text’ が偽の時には意味がありません。

 -- の属性: xmlparser.ordered_attributes

     この属性をゼロ以外の整数にすると、報告される(XMLノードの) 属性を辞
     書型ではなくリスト型にします。属性は文書のテキスト中の出現順で示さ
     れます。それぞれの属性は、2つのリストのエントリ: 属性名とその値、が
     与えられます。 (このモジュールの古いバージョンでも、同じフォーマッ
     トが使われています。) デフォルトでは、この属性はデフォルトでは偽と
     なりますが、いつでも変更可能です。

 -- の属性: xmlparser.specified_attributes

     ゼロ以外の整数にすると、パーザは文書のインスタンスで特定される属性
     だけを報告し、属性宣言から導出された属性は報告しないようになります
     。この属性が指定されたアプリケーションでは、XMLプロセッサの振る舞い
     に関する標準に従うために必要とされる (文書型) 宣言によって、どのよ
     うな付加情報が利用できるのかということについて特に注意を払わなけれ
     ばなりません。デフォルトで、この属性は偽となりますが、いつでも変更
     可能です。

以下の属性には、 ‘xmlparser’ オブジェクトで最も最近に起きたエラーに関す
る値が入っており、また ‘Parse()’ または ‘ParseFile()’ メソッドが *note
xml.parsers.expat.ExpatError: 1632. 例外を送出した際にのみ正しい値となり
ます。

 -- の属性: xmlparser.ErrorByteIndex

     エラーが発生したバイトのインデクスです。

 -- の属性: xmlparser.ErrorCode

     エラーを特定する数値によるコードです。この値は *note ErrorString():
     40ba. に渡したり、 ‘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: 40c5. が
     真の場合これはリストです (詳細は ‘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: 40da, *note EndCdataSectionHandler: 40db,
     and *note ElementDeclHandler: 1943. 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: 187a.
     instance attribute to ‘True’ to avoid that.

 -- メソッド: xmlparser.UnparsedEntityDeclHandler (entityName, base,
          systemId, publicId, notationName)

     解析されていない (NDATA) エンティティ宣言を処理するために呼び出され
     ます。このハンドラは Expat ライブラリのバージョン1.2のためだけに存
     在します; より最近のバージョンでは、代わりに *note
     EntityDeclHandler: 40dc. を使用してください (根底にある 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: 40d7.
     が呼び出される前に処理されます。

 -- メソッド: xmlparser.EndNamespaceDeclHandler (prefix)

     名前空間宣言を含んでいたエレメントの終了タグに到達したときに呼び出
     されます。このハンドラは、要素に関する名前空間宣言ごとに、 *note
     StartNamespaceDeclHandler: 40dd. とは逆の順番で一度だけ呼び出され、
     各名前空間宣言のスコープが開始されたことを示します。このハンドラは
     、要素が終了する際、対応する *note EndElementHandler: 40d8. が呼ば
     れた後に呼び出されます。

 -- メソッド: xmlparser.CommentHandler (data)

     コメントで呼び出されます。 'data' はコメントのテキストで、先頭の
     '‘<!-’ ‘-’' と末尾の '‘-’ ‘->’' を除きます。

 -- メソッド: xmlparser.StartCdataSectionHandler ()

     CDATA セクションの開始時に呼び出されます。CDATA セクションの構文的
     な開始と終了位置を識別できるようにするには、このハンドラと *note
     EndCdataSectionHandler: 40db. が必要です。

 -- メソッド: xmlparser.EndCdataSectionHandler ()

     CDATA セクションの終了時に呼び出されます。

 -- メソッド: xmlparser.DefaultHandler (data)

     XML 文書中で、適用可能なハンドラが指定されていない文字すべてに対し
     て呼び出されます。この文字とは、検出されたことが報告されるが、ハン
     ドラは指定されていないようなコンストラクト (construct) の一部である
     文字を意味します。

 -- メソッド: xmlparser.DefaultHandlerExpand (data)

     *note DefaultHandler(): 40e0. と同じですが、内部エンティティの展開
     を禁止しません。エンティティ参照はデフォルトハンドラに渡されません
     。

 -- メソッド: 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(): 40bf. で設定された値になっていま
     す。 public、および system の識別子である、 'systemId' と
     'publicId' が指定されている場合、値は文字列です; public 識別子が指
     定されていない場合、 'publicId' は ‘None’ になります。 'context' の
     値は不明瞭なものであり、以下に記述するようにしか使ってはなりません
     。

     外部エンティティが解析されるようにするには、このハンドラを実装しな
     ければなりません。このハンドラは、
     ‘ExternalEntityParserCreate(context)’ を使って適切なコールバックを
     指定し、子パーザを生成して、エンティティを解析する役割を担います。
     このハンドラは整数を返さなければなりません; ‘0’ を返した場合、パー
     ザは ‘XML_ERROR_EXTERNAL_ENTITY_HANDLING’ エラーを送出します。そう
     でない場合、解析を継続します。

     このハンドラが与えられておらず、 *note DefaultHandler: 40e0. コール
     バックが指定されていれば、外部エンティティは ‘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: 1632. 例外はいくつかの興味深い属性を備えています:

 -- の属性: ExpatError.code

     特定のエラーに対する Expat の内部エラー番号です。 *note
     errors.messages: 40e5. 辞書はこれらのエラー番号を 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: 130. モジュールはエラーメッセージ定数と、それらのメッ
     セージをエラーコードに対応させる辞書 *note codes: 40e6. も提供して
     います。以下を参照してください。

 -- の属性: 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: d4. が存在するこ
とが必要ですが、これは現在ではほとんどの一般的なプラットフォーム上でサポ
ートされています。ここに概観を示します:

* 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(): 1944. 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: 2341.-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: 2d. module.  If ‘ctypes’ isn't available, calls to *note
open(): 1944. will fail.

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<6>.
* Browser controller objects::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 234c.: 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 監査イベント: 1e84. ‘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(): 4125. と同様に振る舞
     います。

     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(): 4127. でそのブラウザのコントローラーを呼び出すことがで
     きます。 'instance' が指定されなかったり、 ‘None’ なら、インスタン
     スが必要な時には 'constructor' がパラメータなしに呼び出されて作られ
     ます。 'instance' が指定されたら、 'constructor' は呼び出されないの
     で、 ‘None’ でかまいません。

     'preferred' を ‘True’ に設定すると、 *note get(): 4127. の引数無し
     の呼び出しの結果が優先的にこのブラウザになります。 そうでない場合は
     、この関数は、変数 ‘BROWSER’ を設定するか、 ‘get()’ を空文字列では
     ない、宣言したハンドラの名前と一致する引数とともに呼び出すときにだ
     け、役に立ちます。

     バージョン 3.7 で変更: 'preferred' キーワード専用引数が追加されまし
     た。

いくつかの種類のブラウザがあらかじめ定義されています。このモジュールで定
義されている、関数 *note get(): 4127. に与えるブラウザの名前と、それぞれ
のコントローラークラスのインスタンスを以下の表に示します。

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)
                                                                           
                                                                           
‘'macos'’                    ‘MacOS('default')’                            (3)
                                                                           
                                                                           
‘'safari'’                   ‘MacOS('safari')’                             (3)
                                                                           
                                                                           
‘'chrome'’                   ‘MacOS('google chrome')’                      (3)
                                                                           
                                                                           
‘'firefox'’                  ‘MacOS('firefox')’                            (3)
                                                                           
                                                                           
‘'google-chrome'’            ‘Chrome('google-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 のサポートが追加されました。

Added in version 3.15: ‘MacOS’ has been added as a replacement for
‘MacOSXOSAScript’, opening browsers via ‘/usr/bin/open’ instead of
‘osascript’.

バージョン 3.15 で非推奨、バージョン 3.17 で削除予定: ‘MacOSXOSAScript’
is deprecated in favour of ‘MacOS’.  Using ‘/usr/bin/open’ instead of
‘osascript’ is a security and usability improvement: ‘osascript’ may be
blocked on managed systems due to its abuse potential as a
general-purpose scripting interpreter.

簡単な例を示します:

     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: 79f. 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(): 4125. の別名。

 -- メソッド: controller.open_new_tab (url)

     可能であれば、このコントローラーでハンドルされたブラウザの新しいペ
     ージ(「タブ」)で 'url' を開きますが、そうでない場合は *note
     open_new(): 4125. と同じです。

脚注
....


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/main/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: 4132. を
参照してください。

 -- の関数: 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(): 4134. に似ています。結果はリクエストによって指定され
     たアプリケーションオブジェクトのベース 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(): 4136. を呼んだ場合、これは "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(): 4138. 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:
     4139. protocol used to convert a file-like object to an *note
     iterator: 6d4.  The resulting objects are *note iterable: 149a.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__(): 78d. メソッドのサポー
     トは削除されました。

   ---------- 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: 124c. を提供し、WSGI レス
ポンスヘッダの操作をマップに似たインターフェースで便利にします。

 -- クラス: wsgiref.headers.Headers ([headers])

     'headers' をラップするマップ風オブジェクトを生成します。これは PEP
     3333(1) に定義されるようなヘッダの名前／値のタプルのリストです。
     'headers' のデフォルト値は空のリストです。

     ‘Headers’ objects support typical mapping operations including
     *note __getitem__(): 78d, *note get(): 2241, *note __setitem__():
     1685, *note setdefault(): 1430, *note __delitem__(): 1686. and
     *note __contains__(): 1772.  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: 124c. オブジェクトはラップされたヘ
     ッダリストに存在しないキーを取得または削除しようとした場合にもエラ
     ーを発生しません。単に、存在しないヘッダの取得は ‘None’ を返し、存
     在しないヘッダの削除は何もしません。

     *note Headers: 124c. オブジェクトは ‘keys()’ 、 ‘values()’ 、
     ‘items()’ メソッドもサポートします。複数の値を持つヘッダがある場合
     には、 ‘keys()’ と ‘items()’ で返されるリストは同じキーを一つ以上含
     むことがあります。 ‘Headers’ オブジェクトの ‘len()’ は、その
     ‘items()’ の長さと同じであり、ラップされたヘッダリストの長さと同じ
     です。実際、 ‘items()’ メソッドは単にラップされたヘッダリストのコピ
     ーを返しているだけです。

     *note Headers: 124c. オブジェクトに対して ‘bytes()’ を呼ぶと、HTTP
     レスポンスヘッダとして送信するのに適した形に整形されたバイト文字列
     を返します。それぞれのヘッダはコロンとスペースで区切られた値と共に
     一列に並んでいます。それぞれの行はキャリッジリターンとラインフィー
     ドで終了し、バイト文字列は空行で終了しています。

     これらのマッピングインターフェースと整形機能に加えて、 *note
     Headers: 124c. オブジェクトは複数の値を持つヘッダの取得と追加、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: 75. がベースです)。個々のサーバインスタンスは単一
の WSGI アプリケーションを、特定のホストとポート上で提供します。もし一つ
のホストとポート上で複数のアプリケーションを提供したいならば、
‘PATH_INFO’ をパースして個々のリクエストでどのアプリケーションを呼び出す
か選択するような WSGI アプリケーションを作る必要があります。（例えば、
*note wsgiref.util: 126. から ‘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: 413f. protocol.

 -- クラス: wsgiref.simple_server.WSGIServer (server_address,
          RequestHandlerClass)

     *note WSGIServer: 4140. インスタンスを作成します。 'server_address'
     は ‘(host,port)’ のタプル、そして 'RequestHandlerClass' はリクエス
     トの処理に使われる *note http.server.BaseHTTPRequestHandler: 231. の
     サブクラスでなければいけません。

     *note make_server(): 413e. が細かい調整をやってくれるので、通常はこ
     のコンストラクタを呼ぶ必要はありません。

     *note WSGIServer: 4140. は *note http.server.HTTPServer: 4141. のサ
     ブクラスなので、そのすべてのメソッド (‘serve_forever()’ や
     ‘handle_request()’ のような) が利用できます。 ‘WSGIServer’ も以下の
     ような WSGI 固有メソッドを提供します:

      -- メソッド: set_app (application)

          呼び出し可能 (callable) な 'application' をリクエストを受け取
          る WSGI アプリケーションとして設定します。

      -- メソッド: get_app ()

          Returns the currently set application callable.

     しかしながら、通常はこれらの追加されたメソッドを使う必要はありませ
     ん。 *note set_app(): 4142. は普通は *note make_server(): 413e. に
     よって呼ばれ、 *note get_app(): 4143. は主にリクエストハンドライン
     スタンスの便宜上存在するからです。

 -- クラス: wsgiref.simple_server.WSGIRequestHandler (request,
          client_address, server)

     与えられた 'request' （すなわちソケット）の HTTP ハンドラ、
     'client_address' (‘(host,port)’ のタプル)、 'server' (*note
     WSGIServer: 4140. インスタンス) の HTTP ハンドラを作成します。

     このクラスのインスタンスを直接生成する必要はありません; これらは必
     要に応じて *note WSGIServer: 4140. オブジェクトによって自動的に生成
     されます。しかしながら、このクラスをサブクラス化し、 *note
     make_server(): 413e. 関数に 'handler_class' として与えることは可能
     でしょう。サブクラスにおいてオーバーライドする意味のありそうなもの
     は:

      -- メソッド: get_environ ()

          リクエストに対する *note WSGIEnvironment: 4132. 辞書を返します
          。デフォルト実装では *note WSGIServer: 4140. オブジェクトの
          ‘base_environ’ 辞書属性のコンテンツをコピーし、それから HTTP リ
          クエスト由来の様々なヘッダを追加しています。このメソッド呼び出
          し毎に、 PEP 3333(2) に指定されている関連する CGI 環境変数をす
          べて含む新規の辞書を返さなければいけません。

      -- メソッド: get_stderr ()

          ‘wsgi.errors’ ストリームとして使われるオブジェクトを返します。
          デフォルト実装では単に ‘sys.stderr’ を返します。

      -- メソッド: handle ()

          HTTP リクエストを処理します。デフォルト実装では実際の WGI アプ
          リケーションインターフェースを実装するのに *note
          wsgiref.handlers: 122. クラスを使ってハンドラインスタンスを作
          成します。

   ---------- 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: a9c. 例外が送
     出されます; しかし、このエラーがどう扱われるかはサーバ依存であるこ
     とに注意してください。例えば、 *note wsgiref.simple_server: 124. と
     その他 *note wsgiref.handlers: 122. ベースのサーバ（エラー処理メソ
     ッドが他のことをするようにオーバライドしていないもの）は単純にエラ
     ーが発生したというメッセージとトレースバックのダンプを ‘sys.stderr’
     やその他のエラーストリームに出力します。

     このラッパーは、疑わしいものの実際には PEP 3333(3) で禁止されていな
     いかもしれない挙動を指摘するために *note warnings: 11b. モジュール
     を使って出力を生成します。これらは 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: 414c. のサブクラスで、これは
     ‘wsgi.run_once’ を true、 ‘wsgi.multithread’ を false、そして
     ‘wsgi.multiprocess’ を true にセットし、常に *note sys: e2. と
     *note os: a5. を、必要な CGI ストリームと環境を取得するために使用し
     ます。

 -- クラス: wsgiref.handlers.IISCGIHandler

     (IIS 7 以降の) 設定オプションの allowPathInfo や (IIS 7 より前の) メ
     タベースの allowPathInfoForScriptMappings を設定せずに Microsoft の
     IIS Web サーバにデプロイするときに使う、 *note CGIHandler: 414b. ク
     ラス以外の専用の選択肢です。

     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: 414b, 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: 414b. に似ていますが、 *note sys: e2. と *note
     os: a5. モジュールを使う代わりに CGI 環境と I/O ストリームを明示的
     に指定します。 'multithread' と 'multiprocess' の値は、ハンドライン
     スタンスにより実行されるアプリケーションの ‘wsgi.multithread’ と
     ‘wsgi.multiprocess’ フラグの設定に使われます。

     このクラスは *note SimpleHandler: 414e. のサブクラスで、HTTP の "本
     サーバ" でないソフトウェアと使うことを意図しています。もしあなたが
     ‘Status:’ ヘッダを HTTP ステータスを送信するのに使うようなゲートウ
     ェイプロトコルの実装（CGI、FastCGI、SCGIなど）を書いている場合、お
     そらく ‘SimpleHandler’ ではなくこのクラスをサブクラス化するとよいで
     しょう。

 -- クラス: wsgiref.handlers.SimpleHandler (stdin, stdout, stderr,
          environ, multithread=True, multiprocess=False)

     *note BaseCGIHandler: 414c. と似ていますが、HTTP の本サーバと使うた
     めにデザインされています。もしあなたが HTTP サーバ実装を書いている
     場合、おそらく ‘BaseCGIHandler’ ではなくこのクラスをサブクラス化す
     るとよいでしょう。

     This class is a subclass of *note BaseHandler: 1fe1.  It overrides
     the ‘__init__()’, *note get_stdin(): 414f, *note get_stderr():
     4150, *note add_cgi_vars(): 4151, *note _write(): 4152, and *note
     _flush(): 4153. 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(): 109d. method of 'stdout' should write each chunk
     in full, like *note io.BufferedIOBase: a88.

 -- クラス: wsgiref.handlers.BaseHandler

     これは WSGI アプリケーションを実行するための抽象ベースクラスです。
     それぞれのインスタンスは一つの HTTP リクエストを処理します。しかし
     原理上は複数のリクエスト用に再利用可能なサブクラスを作成することが
     できます。

     *note BaseHandler: 1fe1. インスタンスは外部から利用されるたった一つ
     のメソッドを持ちます:

      -- メソッド: run (app)

          指定された WSGI アプリケーション、'app' を実行します。

     その他のすべての *note BaseHandler: 1fe1. のメソッドはアプリケーシ
     ョン実行プロセスでこのメソッドから呼ばれます。したがって、それらは
     主にそのプロセスのカスタマイズのために存在しています。

     以下のメソッドはサブクラスでオーバーライドされなければいけません:

      -- メソッド: _write (data)

          バイト列の 'data' をクライアントへの転送用にバッファします。こ
          のメソッドが実際にデータを転送しても OK です: 下部システムが実
          際にそのような区別をしている場合に効率をより良くするために、
          *note BaseHandler: 1fe1. は書き出しとフラッシュ操作を分けてい
          るからです。

      -- メソッド: _flush ()

          バッファされたデータをクライアントに強制的に転送します。このメ
          ソッドは何もしなくても OK です（すなわち、 *note _write():
          4152. が実際にデータを送る場合）。

      -- メソッド: get_stdin ()

          Return an object compatible with *note InputStream: 4155.
          suitable for use as the ‘wsgi.input’ of the request currently
          being processed.

      -- メソッド: get_stderr ()

          Return an object compatible with *note ErrorStream: 4156.
          suitable for use as the ‘wsgi.errors’ of the request currently
          being processed.

      -- メソッド: add_cgi_vars ()

          現在のリクエストの CGI 変数を ‘environ’ 属性に追加します。

     オーバーライドされることの多いメソッド及び属性を以下に挙げます。し
     かし、このリストは単にサマリであり、オーバーライド可能なすべてのメ
     ソッドは含んでいません。カスタマイズした *note BaseHandler: 1fe1. サ
     ブクラスを作成しようとする前に docstring やソースコードでさらなる情
     報を調べてください。

     WSGI 環境のカスタマイズのための属性とメソッド:

      -- の属性: wsgi_multithread

          ‘wsgi.multithread’ 環境変数で使われる値。 *note BaseHandler:
          1fe1. ではデフォルトが true ですが、別のサブクラスではデフォル
          トで（またはコンストラクタによって設定されて）異なる値を持つこ
          とがあります。

      -- の属性: wsgi_multiprocess

          ‘wsgi.multiprocess’ 環境変数で使われる値。 *note BaseHandler:
          1fe1. ではデフォルトが true ですが、別のサブクラスではデフォル
          トで（またはコンストラクタによって設定されて）異なる値を持つこ
          とがあります。

      -- の属性: wsgi_run_once

          ‘wsgi.run_once’ 環境変数で使われる値。 *note BaseHandler:
          1fe1. ではデフォルトが false ですが、 *note CGIHandler: 414b.
          はデフォルトでこれを 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: 415c. 属性が設定されている場合、この属性
          の値がデフォルトの ‘SERVER_SOFTWARE’ WSGI 環境変数の設定や
          HTTP レスポンス中のデフォルトの ‘Server:’ ヘッダの設定に使われ
          ます。これは (*note BaseCGIHandler: 414c. や *note CGIHandler:
          414b. のような) HTTP オリジンサーバでないハンドラでは無視され
          ます。

          バージョン 3.3 で変更: "Python" という語は "CPython" や
          "Jython" などのような個別実装の語に置き換えられました。

      -- メソッド: get_scheme ()

          現在のリクエストで使われている URL スキームを返します。デフォ
          ルト実装は *note wsgiref.util: 126. の ‘guess_scheme()’ を使い
          、現在のリクエストの ‘environ’ 変数に基づいてスキームが"http"
          か "https" かを推測します。

      -- メソッド: setup_environ ()

          ‘environ’ 属性を、フル実装 (fully populated) の WSGI 環境に設
          定します。デフォルトの実装は、上記すべてのメソッドと属性、加え
          て *note get_stdin(): 414f. 、 *note get_stderr(): 4150. 、
          *note add_cgi_vars(): 4151. メソッドと *note
          wsgi_file_wrapper: 415f. 属性を利用します。これは、キーが存在
          せず、 *note origin_server: 415c. 属性が true 値で *note
          server_software: 415b. 属性も設定されている場合に
          ‘SERVER_SOFTWARE’ を挿入します。

     例外処理のカスタマイズのためのメソッドと属性:

      -- メソッド: log_exception (exc_info)

          'exc_info' タプルをサーバログに記録します。'exc_info' は
          ‘(type, value, traceback)’ のタプルです。デフォルトの実装は単
          純にトレースバックをリクエストの ‘wsgi.errors’ ストリームに書
          き出してフラッシュします。サブクラスはこのメソッドをオーバーラ
          イドしてフォーマットを変更したり出力先の変更、トレースバックを
          管理者にメールしたりその他適切と思われるいかなるアクションも取
          ることができます。

      -- の属性: traceback_limit

          デフォルトの *note log_exception(): 4160. メソッドで出力される
          トレースバック出力に含まれる最大のフレーム数です。 ‘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: 413f. protocol.

          デフォルト実装は単に *note error_status: 4163. 、 *note
          error_headers: 4164. 、 *note error_body: 4165. 属性を出力ペー
          ジの生成に使います。サブクラスではこれをオーバーライドしてもっ
          と動的なエラー出力をすることができます。

          しかし、セキュリティの観点からは診断をあらゆるユーザに吐き出す
          ことは推奨されないことに気をつけてください; 理想的には、診断的
          な出力を有効にするには何らかの特別なことをする必要があるように
          すべきで、これがデフォルト実装では何も含まれていない理由です。

      -- の属性: 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: 4139, or ‘None’.  The default value
          of this attribute is the *note wsgiref.util.FileWrapper: b22.
          class.

      -- メソッド: sendfile ()

          オーバーライドしてプラットフォーム固有のファイル転送を実装しま
          す。このメソッドはアプリケーションの戻り値が *note
          wsgi_file_wrapper: 415f. 属性で指定されたクラスのインスタンス
          の場合にのみ呼ばれます。これはファイルの転送が成功できた場合に
          は true を返して、デフォルトの転送コードが実行されないようにす
          るべきです。このデフォルトの実装は単に false 値を返します。

     その他のメソッドと属性:

      -- の属性: origin_server

          この属性はハンドラの *note _write(): 4152. と *note _flush():
          4153. が、特別に ‘Status:’ ヘッダに HTTP ステータスを求めるよ
          うな CGI 風のゲートウェイプロトコル経由でなく、クライアントと
          直接通信をするような場合には true 値に設定されているべきです。

          この属性のデフォルト値は *note BaseHandler: 1fe1. では true で
          すが、 *note BaseCGIHandler: 414c. と *note CGIHandler: 414b.
          では false です。

      -- の属性: http_version

          *note origin_server: 415c. が 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: 414b. and *note IISCGIHandler: 414d. 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: 772. 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: 772. describing a WSGI Input Stream(4).

 -- クラス: wsgiref.types.ErrorStream

     A *note typing.Protocol: 772. describing a WSGI Error Stream(5).

 -- クラス: wsgiref.types.FileWrapper

     A *note typing.Protocol: 772. describing a file wrapper(6).  See
     *note wsgiref.util.FileWrapper: b22. 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: 413f.
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: 114. は URL を開いて読むためのモジュールです

   * *note urllib.error: 112. は *note urllib.request: 114. が発生させる
     例外を持っています

   * *note urllib.parse: 113. は URL をパースするためのモジュールです

   * *note urllib.robotparser: 116. は ‘robots.txt’ ファイルをパースする
     ためのモジュールです

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 6c3. because the *note getproxies(): 4171.
     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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

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: 1386. object.

     'data' はサーバーに送信する追加データを指定するオブジェクトであるか
     ‘None’ である必要があります。詳細は *note Request: 1386. を確認して
     ください。

     urllib.request モジュールは HTTP/1.1 を使用し、その HTTP リクエスト
     に ‘Connection:close’ ヘッダーを含みます。

     任意引数 'timeout' には接続開始などのブロックする操作におけるタイム
     アウト時間を秒数で指定します (指定されなかった場合、グローバルのデ
     フォルトタイムアウト時間が利用されます)。この引数は、 HTTP, HTTPS,
     FTP 接続でのみ有効です。

     'context' を指定する場合は、様々な SSL オプションを記述する *note
     ssl.SSLContext: 33e. インスタンスでなければなりません。 詳細は
     *note HTTPSConnection: 22f. を参照してください。

     この関数は常にプロパティ 'url'、 'headers'、および 'status' を持ち
     、 *note コンテキストマネージャ: 47f. として動作するオブジェクトを
     返します。これらのプロパティに関する詳細は *note
     urllib.response.addinfourl: 4172. を確認してください。

     HTTP および HTTPS URL の場合、この関数は、わずかに修正された *note
     http.client.HTTPResponse: 148e. オブジェクトを返します。上記の3つの
     新しいメソッドに加えて、 msg 属性が ‘HTTPResponse’ のドキュメンテー
     ションで指定されているレスポンスヘッダーの代わりに *note reason:
     4173. 属性 -- サーバーから返された reason フレーズ -- と同じ情報を
     含んでいます。

     FTP 、ファイルおよびデータURLの場合、この関数は *note
     urllib.response.addinfourl: 4172. オブジェクトを返します。

     プロトコルエラー発生時は *note URLError: 541. を送出します。

     どのハンドラもリクエストを処理しなかった場合には ‘None’ を返すこと
     があるので注意してください (デフォルトでインストールされる グローバ
     ルハンドラの *note OpenerDirector: 19bc. は、 *note UnknownHandler:
     4174. を使って上記の問題が起きないようにしています)。

     さらに、プロキシ設定が検出された場合(例えば ‘http_proxy’ のような
     ‘*_proxy’ 環境変数がセットされているなど)には *note ProxyHandler:
     1fc4. がデフォルトでインストールされ、これがプロキシを通してリクエ
     ストを処理するようにしています。

     Python 2.6 以前のレガシーな ‘urllib.urlopen’ 関数は廃止されました。
     *note urllib.request.urlopen(): 586. が過去の ‘urllib2.urlopen’ に
     相当します。‘urllib.urlopen’ において辞書型オブジェクトで渡していた
     プロキシの扱いは、*note ProxyHandler: 1fc4. オブジェクトを使用して
     取得できます。

     The default opener raises an *note auditing event: 1e84.
     ‘urllib.Request’ with arguments ‘fullurl’, ‘data’, ‘headers’,
     ‘method’ taken from the request object.

     バージョン 3.2 で変更: 'cafile' および 'capath' が追加されました。

     HTTPS バーチャルホストがサポートされました (*note ssl.HAS_SNI:
     3c35. が真の場合のみ)。

     '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(): 1218.

     バージョン 3.13 で変更: Remove 'cafile', 'capath' and 'cadefault'
     parameters: use the 'context' parameter instead.

 -- の関数: urllib.request.install_opener (opener)

     指定された *note OpenerDirector: 19bc. のインスタンスを、デフォルト
     で利用されるグローバルの opener としてインストールします。 opener の
     インストールは、 urlopen にその opener を使って欲しいとき以外必要あ
     りません。普段は単に *note urlopen(): 586. の代わりに *note
     OpenerDirector.open(): 138a. を利用してください。この関数は引数が本
     当に ‘OpenerDirector’ のインスタンスであるかどうかはチェックしませ
     ん。適切なインターフェースを持った任意のクラスを利用することができ
     ます。

 -- の関数: urllib.request.build_opener ([handler, ...])

     与えられた順番に URL ハンドラを連鎖させる *note OpenerDirector:
     19bc. のインスタンスを返します。 'handler' は *note BaseHandler:
     4176. または ‘BaseHandler’ のサブクラスのインスタンスのどちらかです
     (どちらの場合も、コンストラクトは引数無しで呼び出せるようになってい
     なければなりません) 。クラス *note ProxyHandler: 1fc4. (proxy 設定
     が検出された場合), *note UnknownHandler: 4174, *note HTTPHandler:
     10bc, *note HTTPDefaultErrorHandler: 4177, *note
     HTTPRedirectHandler: 4178, *note FTPHandler: 4179, *note
     FileHandler: 417a, *note HTTPErrorProcessor: 417b. については、その
     クラスのインスタンスか、そのサブクラスのインスタンスが 'handler' に
     含まれていない限り、 'handler' よりも先に連鎖します。

     Python が SSL をサポートするように設定してインストールされている場
     合 (すなわち、 *note ssl: d8. モジュールを import できる場合) *note
     HTTPSHandler: 15e0. も追加されます。

     *note BaseHandler: 4176. サブクラスでも ‘handler_order’ メンバー変
     数を変更して、ハンドラーリスト内での場所を変更できます。

 -- の関数: urllib.request.pathname2url (path, *, add_scheme=False)

     Convert the given local path to a ‘file:’ URL. This function uses
     *note quote(): f66. 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: 543. 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(): 1d19. 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: 541.
     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(): 3bf4. 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: 541. 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: 543. 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: 541. 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: 10bc. 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(): 1249. 関数は、マップ型ある
     いは 2 タプルのシーケンスを取り、この形式の ASCII 文字列を返します
     。これは 'data' パラメーターとして使用される前に bytes 型にエンコー
     ドされなければなりません。

     'headers' は辞書でなければなりません。この辞書は *note
     add_header(): 417c. を辞書のキーおよび値を引数として呼び出した時と
     同じように扱われます。この引数は、多くの場合ブラウザーが何であるか
     を特定する ‘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: 111. はデフォルトで ‘"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: 1387. に格納され、 *note get_method(): 1527. で使用されます
     。デフォルトは '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: 1387. が Request
     クラスに追加されました。

     バージョン 3.4 で変更: *note Request.method: 1387. のデフォルト値は
     クラスレベルで指定されることがあります。

     バージョン 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: 19bc. クラスは、 *note BaseHandler: 4176. の
     連鎖的に呼び出して URL を開きます。このクラスはハンドラをどのように
     連鎖させるか、またどのようにエラーをリカバリするかを管理します。

 -- クラス: urllib.request.BaseHandler

     このクラスはハンドラ連鎖に登録される全てのハンドラがベースとしてい
     るクラスです - このクラスでは登録のための単純なメカニズムだけを扱い
     ます。

 -- クラス: urllib.request.HTTPDefaultErrorHandler

     HTTP エラーレスポンスのデフォルトハンドラーを定義するクラスです; す
     べてのレスポンスは *note HTTPError: 138c. 例外に変換されます。

 -- クラス: 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(): 4171. のドキ
          ュメンテーションを参照してください。

 -- クラス: urllib.request.HTTPPasswordMgr

     ‘(realm, uri) -> (user, password)’ の対応付けデータベースを保持しま
     す。

 -- クラス: urllib.request.HTTPPasswordMgrWithDefaultRealm

     ‘(realm, uri) -> (user, password)’ の対応付けデータベースを保持しま
     す。レルム ‘None’ はその他諸々のレルムを表し、他のレルムが該当しな
     い場合に検索されます。

 -- クラス: urllib.request.HTTPPasswordMgrWithPriorAuth

     ‘uri -> is_authenticated’ マッピングのデータベースも持つ *note
     HTTPPasswordMgrWithDefaultRealm: 417f. のバリエーションです。最初に
     ‘401’ レスポンスを待つのではなく直ちに認証情報を送るときの条件を判
     断するために、 BasicAuth ハンドラによって使われます。

     Added in version 3.5.

 -- クラス: urllib.request.AbstractBasicAuthHandler (password_mgr=None)

     これは、リモートホストとプロキシの両方に対して HTTP 認証を行うこと
     を助ける mixin クラスです。 'password_mgr' は、もし与えられたら
     *note HTTPPasswordMgr: 417e. と互換性のあるオブジェクトでなければな
     りません; サポートすべきインターフェースに関する情報は *note
     HTTPPasswordMgr オブジェクト: 4180. 節を参照してください。もし
     'passwd_mgr' が ‘is_authenticated’ と ‘update_authenticated’ メソッ
     ドも提供するなら (*note HTTPPasswordMgrWithPriorAuth オブジェクト:
     4181. を参照)、ハンドラは与えられた 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: 417e. と互換性がなければなりません; 互換性の
     ためにサポートしなければならないインターフェースについての情報はセ
     クション *note HTTPPasswordMgr オブジェクト: 4180. を参照してくださ
     い。HTTPBasicAuthHandler は、間違った認証スキーマが与えられると
     *note ValueError: 15a. を送出します。

 -- クラス: urllib.request.ProxyBasicAuthHandler (password_mgr=None)

     プロキシとの間での認証を扱います。 'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 417e. と互換性が なければなりません; 互換性
     のためにサポートしなければならないインターフェースについての情報は
     セクション *note HTTPPasswordMgr オブジェクト: 4180. を参照してくだ
     さい。

 -- クラス: urllib.request.AbstractDigestAuthHandler (password_mgr=None)

     このクラスはHTTP 認証を補助するための混ぜ込みクラス (mixin class) で
     す。遠隔ホストとプロキシの両方に対応しています。 'password_mgr' を
     与える場合、 *note HTTPPasswordMgr: 417e. と互換性がなければなりま
     せん; 互換性のためにサポートしなければならないインターフェースにつ
     いての情報はセクション *note HTTPPasswordMgr オブジェクト: 4180. を
     参照してください。

     バージョン 3.14 で変更: Added support for HTTP digest
     authentication algorithm ‘SHA-256’.

 -- クラス: urllib.request.HTTPDigestAuthHandler (password_mgr=None)

     リモートホストとの認証を扱います。'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 417e. と互換性のあるものでなければなりません
     。サポートしなければならないインターフェースについての情報は *note
     HTTPPasswordMgr オブジェクト: 4180. 節を参照してください。Digest 認
     証ハンドラーと Basic 認証ハンドラーの両方が追加された場合、常に
     Digest 認証を先に試みます。Digest 認証が 40x のレスポンスを再び返す
     と、Basic 認証ハンドラーに送信されます。このハンドラーメソッドは、
     Digest および Basic 以外の認証スキームが存在する場合は *note
     ValueError: 15a. を送出します。

     バージョン 3.3 で変更: 未サポートの認証スキームでは *note
     ValueError: 15a. を送出するようになりました。

 -- クラス: urllib.request.ProxyDigestAuthHandler (password_mgr=None)

     プロキシとの間での認証を扱います。 'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 417e. と互換性が なければなりません; 互換性
     のためにサポートしなければならないインターフェースについての情報は
     セクション *note HTTPPasswordMgr オブジェクト: 4180. を参照してくだ
     さい。

 -- クラス: urllib.request.HTTPHandler

     HTTP の URL を開きます。

 -- クラス: urllib.request.HTTPSHandler (debuglevel=0, context=None,
          check_hostname=None)

     HTTPS で URL を開きます。'context' および 'check_hostname' は *note
     http.client.HTTPSConnection: 22f. のものと同じ意味です。

     バージョン 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/main/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: 1386. の公開インターフェースについて説明
しています。これらはすべてサブクラスでオーバーライドできます。また、解析
したリクエストを調査するためにクライアントで使用するいくつかの属性も定義
します。

 -- の属性: Request.full_url

     コンストラクターに渡されたオリジナルの URL です。

     バージョン 3.4 で変更.

     Request.full_url は、 setter, getter, deleter を持つプロパティです
     。もし存在すれば、 *note full_url: 1388. はオリジナルのリクエスト
     URL フラグメント付きで返します。

 -- の属性: Request.type

     URI スキームです。

 -- の属性: Request.host

     URI オーソリティです。通常はホスト名ですが、コロンで区切られたポー
     ト番号が付随することもあります。

 -- の属性: Request.origin_req_host

     リクエストしたオリジナルのホスト名です。ポート番号はつきません。

 -- の属性: Request.selector

     URI パスです。*note Request: 1386. がプロキシを使用する場合、セレク
     ターはプロキシに渡される完全な URL になります。

 -- の属性: Request.data

     リクエストのエンティティボディか、指定されない場合は ‘None’ になり
     ます。

     バージョン 3.4 で変更: *note Request.data: 1389. の値が変更されると
     、もしそれ以前に "Content-Length" ヘッダーの値が設定または計算され
     ていたらヘッダーが削除されるようになりました。

 -- の属性: Request.unverifiable

     リクエストが RFC 2965(1) で定義された証明不能 (unverifiable) である
     かどうかを示す論理値です。

 -- の属性: Request.method

     HTTP リクエストで使うメソッドです。 デフォルト値は *note None: a6a.
     で、このときは使うメソッドを *note get_method(): 1527. が通常の方法
     で決定するということになります。 この値を設定する (従って
     ‘get_method()’ のデフォルトの決定を上書きする) 方法は、 *note
     Request: 1386. サブクラスでのクラスレベルの設定処理でデフォルト値を
     提供するか、 ‘Request’ のコンストラクタの 'method' 引数へ値を渡すか
     です。

     Added in version 3.3.

     バージョン 3.4 で変更: サブクラスでデフォルト値が設定できるようにな
     りました; 以前はコンストラクタ引数からしか設定できませんでした。

 -- メソッド: Request.get_method ()

     HTTP リクエストメソッドを示す文字列を返します。*note
     Request.method: 1387. が ‘None’ でなければその値を返します。そうで
     ない場合、*note Request.data: 1389. が ‘None’ なら ‘'GET'’ を、そう
     でなければ ‘'POST'’ を返します。これは HTTP リクエストに対してのみ
     意味を持ちます。

     バージョン 3.3 で変更: get_method は *note Request.method: 1387. の
     値を参照するようになりました。

 -- メソッド: 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: 1388. を返します。

 -- メソッド: 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: 19bc. インスタンスは以下のメソッドを持っています:

 -- メソッド: OpenerDirector.add_handler (handler)

     'handler' should be an instance of *note BaseHandler: 4176.  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(): 4196. を参照して
          ください。

        * ‘http_error_<type>()’ -- ハンドラーが HTTP エラーコード 'type'
          の処理方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.http_error_<nnn>(): 4197. を参照し
          てください。

        * ‘<protocol>_error()’ -- ハンドラーが (‘http’ でない)
          'protocol' のエラーを処理する方法を知っていることを示すシグナ
          ルです。

        * ‘<protocol>_request()’ -- ハンドラーが 'protocol' リクエストの
          プリプロセス方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.<protocol>_request(): 4198. を参照
          してください。

        * ‘<protocol>_response()’ -- ハンドラーが 'protocol' リクエスト
          のポストプロセス方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.<protocol>_response(): 4199. を参照
          してください。

 -- メソッド: OpenerDirector.open (url, data=None[, timeout])

     与えられた 'url' (リクエストオブジェクトでも文字列でもかまいません)
     を開きます。オプションとして 'data' を与えることができます。 引数、
     戻り値、および送出される例外は *note urlopen(): 586. と同じです
     (‘urlopen()’ の場合、標準でインストールされている グローバルな
     *note OpenerDirector: 19bc. の *note open(): 333. メソッドを呼び出
     します) 。 オプションの 'timeout' 引数は、接続開始のようなブロック
     する処理におけるタイムアウト時間を 秒数で指定します。(指定しなかっ
     た場合は、グローバルのデフォルト設定が利用されます) タイムアウト機
     能は、 HTTP, HTTPS, FTP 接続でのみ有効です。

 -- メソッド: OpenerDirector.error (proto, *args)

     与えられたプロトコルにおけるエラーを処理します。このメソッドは与え
     られたプロトコルにおける登録済みのエラーハンドラを (プロトコル固有
     の) 引数で呼び出します。 HTTP プロトコルは特殊なケースで、特定のエ
     ラーハンドラを選び出すのに HTTP レスポンスコードを使います; ハンド
     ラクラスの ‘http_error_<type>()’ メソッドを参照してください。

     戻り値および送出される例外は *note urlopen(): 586. と同じものです。

OpenerDirector オブジェクトは、以下の 3 つのステージに分けて URL を開き
ます:

各ステージで OpenerDirector オブジェクトのメソッドがどのような順で呼び出
されるかは、ハンドラインスタンスの並び方で決まります。

  1. ‘<protocol>_request()’ 形式のメソッドを持つすべてのハンドラーに対し
     てそのメソッドを呼び出し、リクエストのプリプロセスを行います。

  2. ‘<protocol>_open()’ のようなメソッドでハンドラーが呼び出され、リク
     エストを処理します。このステージではハンドラーが非-*note None: a6a.
     値 (例: レスポンス) か例外 (通常は *note URLError: 541.) を返した時
     点で終了します。例外は伝搬できます。

     実際には、上のアルゴリズムではまず *note default_open(): 419b. とい
     う名前のメソッドを呼び出します。このメソッドがすべて *note None:
     a6a. を返す場合、同じアルゴリズムを繰り返して、今度は
     ‘<protocol>_open()’ 形式のメソッドを試します。メソッドがすべて
     ‘None’ を返すと、さらに同じアルゴリズムを繰り返して *note
     unknown_open(): 419c. を呼び出します。

     これらのメソッドの実装には、親となる *note OpenerDirector: 19bc. イ
     ンスタンスの ‘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: 4176. オブジェクトは直接的に役に立つ 2 つのメソッドと
、その他として派生クラスで使われることを想定したメソッドを 提供します。
以下は直接的に使うためのメソッドです:

 -- メソッド: BaseHandler.add_parent (director)

     親オブジェクトとして、 ‘director’ を追加します。

 -- メソッド: BaseHandler.close ()

     全ての親オブジェクトを削除します。

以下の属性およびメソッドは *note BaseHandler: 4176. から派生したクラスで
のみ使われます。

     注釈: 慣習的に、 ‘<protocol>_request()’ や ‘<protocol>_response()’
     といったメソッドを定義している サブクラスは ‘*Processor`と名づけ、
     その他は :class:’!*Handler' と名づけることになっています

 -- の属性: BaseHandler.parent

     有効な *note OpenerDirector: 19bc. です。この値は違うプロトコルを使
     って URL を開く場合やエラーを処理する際に使われます。

 -- メソッド: BaseHandler.default_open (req)

     このメソッドは *note BaseHandler: 4176. では定義されて 'いません' 。
     しかし、全ての URL をキャッチさせたいなら、サブクラスで定義する 必
     要があります。

     このメソッドが実装されていれば、*note OpenerDirector: 19bc. の親ク
     ラスによって呼び出されます。これは ‘OpenerDirector’ の *note
     open(): 138a. の戻り値で表されるファイルライクオブジェクトか、また
     は ‘None’ を返さなければならず、真に想定外の事態が発生した場合を除
     き、*note URLError: 541. を送出しなければなりません (例えば、*note
     MemoryError: 191d. は ‘URLError’ にマップしてはなりません)。

     このメソッドはプロトコル固有のオープンメソッドが呼び出される前に呼
     び出されます。

 -- メソッド: BaseHandler.<protocol>_open(req)

     このメソッドは *note BaseHandler: 4176. では定義されて 'いません' 。
     しかしプロトコルの URL をキャッチしたいなら、サブクラスで定義する必
     要があります。

     このメソッドが定義されていた場合、 *note OpenerDirector: 19bc. から
     呼び出されます。戻り値は *note default_open(): 419b. と同じでなけれ
     ばなりません。

 -- メソッド: BaseHandler.unknown_open (req)

     このメソッドは *note BaseHandler: 4176. では定義されて 'いません' 。
     しかし URL を開くための特定のハンドラが登録されていないような URL を
     キャッチしたいなら、サブクラスで定義する必要があります。

     このメソッドが定義されていた場合、 *note parent: 41a1. *note
     OpenerDirector: 19bc. から呼び出されます。戻り値は *note
     default_open(): 419b. と同じでなければなりません。

 -- メソッド: BaseHandler.http_error_default (req, fp, code, msg, hdrs)

     このメソッドは *note BaseHandler: 4176. では定義されて 'いません' 。
     しかしその他の処理されなかった HTTP エラーを処理する機能をもたせた
     いなら、サブクラスで定義する必要があります。このメソッドはエラーに
     遭遇した *note OpenerDirector: 19bc. から自動的に呼び出されます。そ
     の他の状況では普通呼び出すべきではありません。

     *note OpenerDirector: 19bc. will call this method with five
     positional arguments:

       1. *note Request: 1386. オブジェクト

       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(): 586. と同じもので
     なければなりません。

 -- メソッド: BaseHandler.http_error_<nnn>(req, fp, code, msg, hdrs)

     'nnn' は 3 桁の 10 進数からなる HTTP エラーコードでなくてはなりませ
     ん。このメソッドも *note BaseHandler: 4176. では定義されていません
     が、サブクラスのインスタンスで定義されていた場合、エラーコード
     'nnn' の HTTP エラーが発生した際に呼び出されます。

     特定の HTTP エラーに対する処理を行うためには、このメソッドをサブク
     ラスでオーバライドする必要があります。

     引数、返される値、および送出される例外は *note
     http_error_default(): 41a2. と同じものでなければなりません。

 -- メソッド: BaseHandler.<protocol>_request(req)

     このメソッドは *note BaseHandler: 4176. では '定義されていません' が
     、サブクラスで特定のプロトコルのリクエストのプリプロセスを行いたい
     場合には定義する必要があります。

     このメソッドが定義されていると、親となる *note OpenerDirector:
     19bc. から呼び出されます。その際、 'req' は *note Request: 1386. オ
     ブジェクトになります。戻り値は ‘Request’ オブジェクトでなければなり
     ません。

 -- メソッド: BaseHandler.<protocol>_response(req, response)

     このメソッドは *note BaseHandler: 4176. では '定義されていません' が
     、サブクラスで特定のプロトコルのリクエストのポストプロセスを行いた
     い場合には定義する必要があります。

     このメソッドが定義されていると、親となる *note OpenerDirector:
     19bc. から呼び出されます。その際、 'req' は *note Request: 1386. オ
     ブジェクトになります。 'response' は *note urlopen(): 586. の戻り値
     と同じインターフェースを 実装したオブジェクトになります。戻り値もま
     た、 ‘urlopen()’ の戻り値と同じインターフェースを実装したオブジェク
     トでなければなりません。


File: python.info,  Node: HTTPRedirectHandler オブジェクト,  Next: HTTPCookieProcessor オブジェクト,  Prev: BaseHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.4 HTTPRedirectHandler オブジェクト
.........................................

     注釈: 一部の HTTP リクエストはこのモジュールのクライアントモードか
     らの操作を要求します。その場合、*note HTTPError: 138c. が送出されま
     す。さまざまなリダイレクションコードの正確な意味についての詳細は
     RFC 2616(1) を参照してください。

     セキュリティ上の配慮として、HTTPRedirectHandler に HTTP、HTTPS、あ
     るいは FTP の URL ではないリダイレクトされた URL が存在した場合、
     *note HTTPError: 138c. 例外が送出されます。

 -- メソッド: HTTPRedirectHandler.redirect_request (req, fp, code, msg,
          hdrs, newurl)

     リダイレクトへのレスポンスの *note Request: 1386. または ‘None’ を
     返します。これはサーバーからリダイレクションを受信した時に
     ‘http_error_30*()’ メソッドのデフォルトの実装によって呼び出されます
     。リダイレクションを行わなければならない場合、'newurl' へのリダイレ
     クトを実行するための ‘http_error_30*()’ を許可する新しい ‘Request’
     を返します。その他の場合、この URL を扱うその他のハンドラーがない場
     合は *note HTTPError: 138c. を、他のハンドラーでできそうな場合は
     ‘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: 19bc. によって呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_302 (req, fp, code, msg,
          hdrs)

     *note http_error_301(): 41a6. と同じですが、'found' レスポンスに対
     して呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_303 (req, fp, code, msg,
          hdrs)

     *note http_error_301(): 41a6. と同じですが、'see other' レスポンス
     に対して呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_307 (req, fp, code, msg,
          hdrs)

     The same as *note http_error_301(): 41a6, 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(): 41a6, 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: 417d. インスタンスは属性をひとつだけ持ちます:

 -- の属性: HTTPCookieProcessor.cookiejar

     Cookie の入っている *note http.cookiejar.CookieJar: 41ae. オブジェ
     クトです。


File: python.info,  Node: ProxyHandler オブジェクト,  Next: HTTPPasswordMgr オブジェクト,  Prev: HTTPCookieProcessor オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.6 ProxyHandler オブジェクト
..................................

 -- メソッド: ProxyHandler.<protocol>_open(request)

     *note ProxyHandler: 1fc4. は、コンストラクターで与えた辞書
     '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: 417e. および *note
HTTPPasswordMgrWithDefaultRealm: 417f. オブジェクトで利用できます。

 -- メソッド: 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: 417f. オブジェクトでは、与え
     られた 'realm' に対して該当するユーザ名/パスワードが存在しない場合
     、レルム ‘None’ が検索されます。


File: python.info,  Node: HTTPPasswordMgrWithPriorAuth オブジェクト,  Next: AbstractBasicAuthHandler オブジェクト,  Prev: HTTPPasswordMgr オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.8 HTTPPasswordMgrWithPriorAuth オブジェクト
..................................................

このパスワードマネージャは *note HTTPPasswordMgrWithDefaultRealm: 417f.
を継承して、認証の証明書を常に送らないといけない URI を追跡する機能をサ
ポートしています。

 -- メソッド: HTTPPasswordMgrWithPriorAuth.add_password (realm, uri,
          user, passwd, is_authenticated=False)

     'realm', 'uri', 'user', 'passwd' は *note
     HTTPPasswordMgr.add_password(): 41b2. のものと同じです。
     'is_authenticated' は、与えられた URI や URI のリストの
     ‘is_authenticated’ フラグの初期値に設定されます。
     'is_authenticated' に ‘True’ を指定した場合は、 'realm' は無視され
     ます。

 -- メソッド: HTTPPasswordMgrWithPriorAuth.find_user_password (realm,
          authuri)

     *note HTTPPasswordMgrWithDefaultRealm: 417f. オブジェクトに対する同
     名のメソッドと同じです。

 -- メソッド: 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: 1386. オブジェクト、そして 'headers' はエラーヘッダーでな
     くてはなりません。

     'host' は、オーソリティ (例 ‘"python.org"’) か、オーソリティコンポ
     ーネントを含む URL (例 ‘"http://python.org"’) です。どちらの場合も
     、オーソリティはユーザ情報コンポーネントを含んではいけません (なの
     で、 ‘"python.org"’ や ‘"python.org:80"’ は正しく、
     ‘"joe:password@python.org"’ は不正です) 。


File: python.info,  Node: HTTPBasicAuthHandler オブジェクト,  Next: ProxyBasicAuthHandler オブジェクト,  Prev: AbstractBasicAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.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: 1386. オブジェクト、そして '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:
     541. が送出されます。


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: 15a. 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: 1cbc. オブジェクトは *note FTPHandler: 4179. オブ
ジェクトに以下のメソッドを追加したものです:

 -- メソッド: 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: 541. 例外を送出します。


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(): 419a. 経由で処理を渡
     します。他にそのエラーを処理するハンドラーがない場合、*note
     HTTPDefaultErrorHandler: 4177. は最後に *note HTTPError: 138c. を送
     出します。

 -- メソッド: HTTPErrorProcessor.https_response (request, response)

     HTTPS エラー応答の処理をします。

     振る舞いは *note http_response(): 41e1. と同じです。


File: python.info,  Node: 使用例<37>,  Next: レガシーインターフェース<2>,  Prev: HTTPErrorProcessor オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.23 使用例
................

以下の例の他に *note urllib
パッケージを使ってインターネット上のリソースを取得するには: 41e5. に多く
の例があります。

以下の例では、python.org のメインページを取得して、その最初の 300 バイト
分を表示します。

     >>> import urllib.request
     >>> with urllib.request.urlopen('http://www.python.org/') as f:
     ...     print(f.read(300))
     ...
     b'<!doctype html>\n<!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->\n<!--[if IE 7]>      <html class="no-js ie7 lt-ie8 lt-ie9">          <![endif]-->\n<!--[if IE 8]>      <html class="no-js ie8 lt-ie9">

urlopen は bytes オブジェクトを返すことに注意してください。これは
urlopen が、HTTP サーバーから受信したバイトストリームのエンコーディング
を自動的に決定できないためです。一般に、返された bytes オブジェクトを文
字列にデコードするためのエンコーディングの決定あるいは推測はプログラム側
が行います。

以下の HTML の仕様ドキュメント ttps://html.spec.whatwg.org/#charset には
HTML や XML ドキュメントでそのエンコーディング情報を指定するさまざまな方
法の一覧があります。

For additional information, see the W3C document:
‘https://www.w3.org/International/questions/qa-html-encoding-declarations’.

python.org ウェブサイトでは 'utf-8' エンコーディングを使用しており、それ
をその meta タグで指定していますので、bytes オブジェクトのデコードも同様
に行います。

     >>> with urllib.request.urlopen('http://www.python.org/') as f:
     ...     print(f.read(100).decode('utf-8'))
     ...
     <!doctype html>
     <!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->
     <!-

*note コンテキストマネージャー: 47f. を使用しないアプローチでも同様の結
果を得ることができます。

     >>> import urllib.request
     >>> f = urllib.request.urlopen('http://www.python.org/')
     >>> try:
     ...     print(f.read(100).decode('utf-8'))
     ... finally:
     ...     f.close()
     ...
     <!doctype html>
     <!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->
     <!--

以下の例では、データストリームを CGI の標準入力へ送信し、返されたデータ
を読み込みます。この例は Python が SSL をサポートするように設定してイン
ストールされている場合のみ動作します。

     >>> import urllib.request
     >>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',
     ...                       data=b'This data is passed to stdin of the CGI')
     >>> with urllib.request.urlopen(req) as f:
     ...     print(f.read().decode('utf-8'))
     ...
     Got Data: "This data is passed to stdin of the CGI"

上の例で使われているサンプルの CGI は以下のようになっています:

     #!/usr/bin/env python
     import sys
     data = sys.stdin.read()
     print('Content-type: text/plain\n\nGot Data: "%s"' % data)

これは *note Request: 1386. を使った ‘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(): 588. はデフォルトで沢山のハンドラを提供しており、
その中に *note ProxyHandler: 1fc4. があります。デフォルトでは、
‘ProxyHandler’ は ‘<scheme>_proxy’ という環境変数を使います。 ここで
‘<scheme>’ は URL スキームです。例えば、 HTTP プロキシの URL を得るには
、環境変数 ‘http_proxy’ を読み出します。

この例では、デフォルトの *note ProxyHandler: 1fc4. を置き換えてプログラ
ム的に作成したプロキシ URL を使うようにし、 *note ProxyBasicAuthHandler:
4183. でプロキシ認証サポートを追加します。

     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: 1386. コンストラクタを呼び出す方法
の他に、以下のようにできます:

     import urllib.request
     req = urllib.request.Request('http://www.example.com/')
     req.add_header('Referer', 'http://www.python.org/')
     # Customize the default User-Agent header value:
     req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')
     with urllib.request.urlopen(req) as f:
         print(f.read().decode('utf-8'))

*note OpenerDirector: 19bc. は全ての *note Request: 1386. に
‘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: 1386. が *note urlopen(): 586. (や *note
OpenerDirector.open(): 138a.)に渡される際には、いくつかの標準ヘッダー
(‘Content-Length’, ‘Content-Type’ および ‘Host’) も追加されることを忘れ
ないでください。 以下は ‘GET’ メソッドを使ってパラメータを含む URL を取
得するセッションの例です:

     >>> import urllib.request
     >>> import urllib.parse
     >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
     >>> url = "http://www.musi-cal.com/cgi-bin/query?%s" % params
     >>> with urllib.request.urlopen(url) as f:
     ...     print(f.read().decode('utf-8'))
     ...

以下の例では、‘POST’ メソッドを使用しています。urlencode から出力された
パラメーターは urlopen にデータとして渡される前に bytes にエンコードされ
ていることに注意してください:

     >>> import urllib.request
     >>> import urllib.parse
     >>> data = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
     >>> data = data.encode('ascii')
     >>> with urllib.request.urlopen("http://requestb.in/xrbl82xr", data) as f:
     ...     print(f.read().decode('utf-8'))
     ...

以下の例では、環境変数による設定内容に対して上書きする形で HTTP プロキシ
を明示的に設定しています:

     >>> import urllib.request
     >>> proxies = {'http': 'http://proxy.example.com:8080/'}
     >>> opener = urllib.request.build_opener(urllib.request.ProxyHandler(proxies))
     >>> with opener.open("http://www.python.org") as f:
     ...     f.read().decode('utf-8')
     ...

以下の例では、環境変数による設定内容に対して上書きする形で、まったくプロ
キシを使わないよう設定しています:

     >>> import urllib.request
     >>> opener = urllib.request.build_opener(urllib.request.ProxyHandler({}}))
     >>> with opener.open("http://www.python.org/") as f:
     ...     f.read().decode('utf-8')
     ...


File: python.info,  Node: レガシーインターフェース<2>,  Next: urllib request Restrictions,  Prev: 使用例<37>,  Up: urllib request --- URL を開くための大規模なライブラリ

5.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(): 586. が返したオブジェクトの ‘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('http://python.org/')
          >>> html = open(local_filename)
          >>> html.close()

     'url' が ‘http:’ スキーム識別子を使用していた場合、任意の引数
     'data' は ‘POST’ リクエストの指定に使用される場合があります (通常の
     リクエストタイプは ‘GET’ です)。引数 'data' は標準
     ‘application/x-www-form-urlencoded’ 形式のバイトオブジェクトでなけ
     ればなりません。 *note urllib.parse.urlencode(): 1249. 関数を参照し
     てください。

     *note urlretrieve(): 587. は、予想 (これは 'Content-Length' ヘッダ
     ーにより通知されるサイズです) よりも取得できるデータ量が少ないこと
     を検知した場合、 *note ContentTooShortError: 41e8. を発生します。こ
     れは、例えば、ダウンロードが中断された場合などに発生します。

     'Content-Length' はデータ量の下限です: 読み込むデータ量がこれを超え
     ている場合 urlretrieve はそれらも読み込みますが、利用できるデータが
     これを下回った場合、例外が送出されます。

     このような場合にもダウンロードされたデータを取得することは可能で、
     これは exception インスタンスの ‘content’ 属性に保存されています。

     'Content-Length' ヘッダーが与えられなれけば urlretrieve はダウンロ
     ードしたデータのサイズをチェックできません。この場合ダウンロードは
     正常に完了したとみなすしかありません。

 -- の関数: urllib.request.urlcleanup ()

     以前の *note urlretrieve(): 587. 呼び出し後に残っているかもしれない
     一時ファイルをクリーンアップします。


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(): 587. のキャッシュ機能は、誰かが Expiration
     time ヘッダーの正しい処理をハックする時間を見つけるまで無効にされて
     います。

   * ある URL がキャッシュにあるかどうか調べるような関数があればと思って
     います。

   * 後方互換性のため、 URL がローカルシステム上のファイルを指しているよ
     うに見えるにも関わらずファイルを開くことができなければ、 URL は FTP
     プロトコルを使って再解釈されます。この機能は時として混乱を招くエラ
     ーメッセージを引き起こします。

   * 関数 *note urlopen(): 586. および *note urlretrieve(): 587. は、ネ
     ットワーク接続が確立されるまでの間、一定でない長さの遅延を引き起こ
     すことがあります。このことは、これらの関数を使ってインタラクティブ
     な Web クライアントを構築するのはスレッドなしには難しいことを意味し
     ます。

   * *note urlopen(): 586. あるいは *note urlretrieve(): 587. が返すデー
     タはサーバーから返された生データです。これは (画像のような) バイナ
     リ、プレーンテキスト、あるいは (例えば) HTML などになります。HTTP プ
     ロトコルはレスポンスヘッダー内でタイプ情報を提供しており、
     ‘Content-Type’ ヘッダーを見ることで調査できます。返されたデータが
     HTML の場合、モジュール *note html.parser: 70. を使用してこれを解析
     できます。

   * FTP プロトコルを扱うコードでは、ファイルとディレクトリを区別できま
     せん。このことから、アクセスできないファイルを指している URL からデ
     ータを読み出そうとすると、予期しない動作を引き起こす場合があります
     。 URL が ‘/’ で終わっていれば、ディレクトリを指しているものとみな
     して、それに適した処理を行います。しかし、ファイルの読み出し操作が
     550 エラー (URL が存在しないか、主にパーミッションの理由でアクセス
     できない) になった場合、 URL がディレクトリを指していて、末尾の ‘/’
     を忘れたケースを処理するため、パスをディレクトリとして扱います。こ
     のために、パーミッションのためにアクセスできないファイルを fetch し
     ようとすると、FTP コードはそのファイルを開こうとして 550 エラーに陥
     り、次にディレクトリ一覧を表示しようとするため、誤解を生むような結
     果を引き起こす可能性があるのです。よく調整された制御が必要なら、
     *note ftplib: 61. モジュールを使用します。


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: 4172. instance:

 -- クラス: urllib.response.addinfourl

      -- の属性: url

          取得されたリソースの URL、主にリダイレクトが発生したかどうかを
          確認するために利用します。

      -- の属性: headers

          Returns the headers of the response in the form of an *note
          EmailMessage: 221. instance.

      -- の属性: status

          Added in version 3.9.

          サーバから返される状態コードです。

      -- メソッド: geturl ()

          バージョン 3.9 で非推奨: 非推奨となったので *note url: 1b27. を
          使用してください。

      -- メソッド: info ()

          バージョン 3.9 で非推奨: 非推奨となったので *note headers:
          41eb. を使用してください。

      -- の属性: code

          バージョン 3.9 で非推奨: 非推奨となったので *note status:
          41ec. を使用してください。

      -- メソッド: getcode ()

          バージョン 3.9 で非推奨: 非推奨となったので *note status:
          41ec. を使用してください。


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: 1bc3. 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/main/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, *, missing_as_none=False)

     Parse a URL into five components, returning a 5-item *note named
     tuple: a42. *note SplitResult: 41f5. or *note SplitResultBytes:
     41f6.  This corresponds to the general structure of a URL:
     ‘scheme://netloc/path?query#fragment’.  Each tuple item is a
     string, possibly empty, or ‘None’ if 'missing_as_none' is true.
     Not defined component are represented an empty string (by default)
     or ‘None’ if 'missing_as_none' is true.  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'
          >>> urlsplit("http://docs.python.org?")
          SplitResult(scheme='http', netloc='docs.python.org', path='',
                      query='', fragment='')
          >>> urlsplit("http://docs.python.org?", missing_as_none=True)
          SplitResult(scheme='http', netloc='docs.python.org', path='',
                      query='', fragment=None)

     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='')
          >>> urlsplit('help/Python.html', missing_as_none=True)
          SplitResult(scheme=None, netloc=None, path='help/Python.html',
                      query=None, fragment=None)

     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' or ‘None’, except that the ‘''’
     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
     or query component, and ‘fragment’ is set to ‘None’ or the empty
     string (depending on the value of 'missing_as_none') in the return
     value.

     戻り値は *note 名前付きタプル: a42. です。これは、インデックス指定
     もしくは以下のような名前属性で要素にアクセスできることを意味します:

     属性                   インデッ    値                            指定されなかった場合の値
                            クス                                      
                            
     -----------------------------------------------------------------------------------------------------
                                                                      
     ‘scheme’               0           URL スキーム                  'scheme' parameter or empty
                                                                      string (2)
                                                                      
                                                                      
     ‘netloc’               1           ネットワーク上の位置          ‘None’ or empty string (3)
                                                                      
                                                                      
     ‘path’                 2           階層的パス                    空文字列
                                                                      
                                                                      
     ‘query’                3           クエリ要素                    ‘None’ or empty string (4)
                                                                      
                                                                      
     ‘fragment’             4           フラグメント識別子            ‘None’ or empty string (5)
                                                                      
                                                                      
     ‘username’                         ユーザ名                      ‘None’
                                                                      
                                                                      
     ‘password’                         パスワード                    ‘None’
                                                                      
                                                                      
     ‘hostname’                         ホスト名 (小文字)             ‘None’
                                                                      
                                                                      
     ‘port’                             ポート番号を表わす整数 (も    ‘None’
                                        しあれば)                     
                                        

     URL中で不正なポートが指定されている場合、 ‘port’ 属性を読みだすと、
     *note ValueError: 15a. を送出します。結果オブジェクトのより詳しい情
     報は *note 構造化された解析結果: 41f7. 節を参照してください。

     ‘netloc’ 属性にマッチしなかった角括弧があると *note ValueError:
     15a. を送出します。

     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: 15a.  If the URL is
     decomposed before parsing, no error will be raised.

     Following some of the WHATWG spec(6) that updates RFC 3986(7),
     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: 41f5. 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: 41f8. 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(8).  Previously, an allowlist of schemes that support
     fragments existed.

     バージョン 3.6 で変更: Out-of-range port numbers now raise *note
     ValueError: 15a, instead of returning ‘None’.

     バージョン 3.8 で変更: Characters that affect netloc parsing under
     NFKC normalization will now raise *note ValueError: 15a.

     バージョン 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.

     バージョン 3.15 で変更: Added the 'missing_as_none' parameter.

 -- の関数: 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: 15a. 例外を送出します。

     任意のパラメータ 'encoding' および 'errors' はパーセントエンコード
     されたシーケンスを Unicode 文字にデコードする方法を指定します。これ
     は *note bytes.decode(): cac. メソッドに渡されます。

     The optional argument 'max_num_fields' is the maximum number of
     fields to read.  If set, then throws a *note ValueError: 15a. 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(): 1249. 関数を (‘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: 15a. 例外を送出します。

     任意のパラメータ 'encoding' および 'errors' はパーセントエンコード
     されたシーケンスを Unicode 文字にデコードする方法を指定します。これ
     は *note bytes.decode(): cac. メソッドに渡されます。

     The optional argument 'max_num_fields' is the maximum number of
     fields to read.  If set, then throws a *note ValueError: 15a. 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(): 1249. 関数を使用します。

     バージョン 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)

 -- の関数: urllib.parse.urlunsplit (parts, *, keep_empty)

     Construct a URL from a tuple as returned by *note urlsplit(): 2ae.
     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).

     If 'keep_empty' is true, empty strings are kept in the result (for
     example, a ‘?’ for an empty query), only ‘None’ components are
     omitted.  This allows rebuilding a URL that was parsed with option
     ‘missing_as_none=True’.  By default, 'keep_empty' is true if
     'parts' is the result of the *note urlsplit(): 2ae. call with
     ‘missing_as_none=True’.

     バージョン 3.15 で変更: Added the 'keep_empty' parameter.

 -- の関数: urllib.parse.urlparse (urlstring, scheme=None,
          allow_fragments=True, *, missing_as_none=False)

     This is similar to *note urlsplit(): 2ae, but additionally splits
     the 'path' component on 'path' and 'params'.  This function returns
     a 6-item *note named tuple: a42. *note ParseResult: 41f9. or *note
     ParseResultBytes: 41fa.  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(9) and RFC 1808(10),
     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(11)).  *note urlsplit():
     2ae. should generally be used instead of ‘urlparse()’.  A separate
     function is needed to separate the path segments and parameters.

 -- の関数: urllib.parse.urlunparse (parts)

 -- の関数: urllib.parse.urlunparse (parts, *, keep_empty)

     Combine the elements of a tuple as returned by *note urlparse():
     2af. 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).

     If 'keep_empty' is true, empty strings are kept in the result (for
     example, a ‘?’ for an empty query), only ‘None’ components are
     omitted.  This allows rebuilding a URL that was parsed with option
     ‘missing_as_none=True’.  By default, 'keep_empty' is true if
     'parts' is the result of the *note urlparse(): 2af. call with
     ‘missing_as_none=True’.

     バージョン 3.15 で変更: Added the 'keep_empty' parameter.

 -- の関数: 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(): 2ae.

          注釈: '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(): 2ae. と *note urlunsplit(): 2b1. で先に処理して、
          '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(12) で定義された意味論とマッチする
     ように挙動がアップデートされました。

 -- の関数: urllib.parse.urldefrag (url, *, missing_as_none=False)

     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 (by default) or ‘None’
     if 'missing_as_none' is true.

     戻り値は *note 名前付きタプル: a42. で、インデックスによってもしく
     は名前属性として要素にアクセスできます:

     属性                   インデッ    値                            指定されなかった場合の値
                            クス                                      
                            
     -----------------------------------------------------------------------------------------------------
                                                                      
     ‘url’                  0           フラグメントのない URL        空文字列
                                                                      
                                                                      
     ‘fragment’             1           フラグメント識別子            ‘None’ or empty string (13)
                                                                      

     結果オブジェクトのより詳しい情報は *note 構造化された解析結果:
     41f7. 節を参照してください。

     バージョン 3.2 で変更: 結果はシンプルな 2 要素のタプルから構造化オ
     ブジェクトに変更されました。

     バージョン 3.15 で変更: Added the 'missing_as_none' parameter.

 -- の関数: 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) Depending on the value of the 'missing_as_none' argument.

   (3) Depending on the value of the 'missing_as_none' argument.

   (4) Depending on the value of the 'missing_as_none' argument.

   (5) Depending on the value of the 'missing_as_none' argument.

   (6) https://url.spec.whatwg.org/#concept-basic-url-parser

   (7) https://datatracker.ietf.org/doc/html/rfc3986.html

   (8) https://datatracker.ietf.org/doc/html/rfc3986.html

   (9) https://datatracker.ietf.org/doc/html/rfc1738.html

   (10) https://datatracker.ietf.org/doc/html/rfc1808.html

   (11) https://datatracker.ietf.org/doc/html/rfc3986.html

   (12) https://datatracker.ietf.org/doc/html/rfc3986.html

   (13) Depending on the value of the 'missing_as_none' argument.


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(): 2ae. and *note urlparse(): 2af. 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 ‘None’ (depending on the
value of the 'missing_as_none' argument).  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: 1d2. および *note bytearray: 1d1. オブジェクトに加えて
*note str: 1ea. オブジェクトでも処理するようになりました。

*note str: 1ea. データが渡された場合、戻り値は ‘str’ データのみを含んだ
ものになります。*note bytes: 1d2. あるいは *note bytearray: 1d1. が渡さ
れた場合、戻り値は ‘bytes’ データのみを含んだものになります。

単一の関数を呼び出す時に *note bytes: 1d2. または *note bytearray: 1d1.
が混在した *note str: 1ea. を渡した場合、*note TypeError: 29c. が、非
ASCII バイト値が渡された場合 *note UnicodeDecodeError: ddb. が送出されま
す。

*note str: 1ea. と *note bytes: 1d2. 間で容易に変換を行えるよう、すべて
の 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(): 2ae, *note urlparse():
2af. and *note urldefrag(): 2b0. functions are subclasses of the *note
tuple: 1d9. 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 unless the URL was parsed with
     ‘missing_as_none=True’.

     *note urldefrag(): 2b0. の戻り値では、空のフラグメント識別子のみ削
     除されます。*note urlsplit(): 2ae. および *note urlparse(): 2af. の
     戻り値では、このメソッドが返す 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/'
          >>> r3 = urlsplit(url, missing_as_none=True)
          >>> r3.geturl()
          'http://www.Python.org/doc/#'

以下のクラスは *note str: 1ea. オブジェクトを操作した場合、構造化された
解析結果の実装を提供します:

 -- クラス: urllib.parse.DefragResult (url, fragment)

     *note urldefrag(): 2b0. の具象クラスの結果には *note str: 1ea. デー
     タが含まれます。‘encode()’ メソッドは *note DefragResultBytes:
     4201. インスタンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.ParseResult (scheme, netloc, path, params,
          query, fragment)

     *note urlparse(): 2af. の具象クラスの結果には *note str: 1ea. デー
     タが含まれます。‘encode()’ メソッドは *note ParseResultBytes: 41fa.
     インスタンスを返します。

 -- クラス: urllib.parse.SplitResult (scheme, netloc, path, query,
          fragment)

     *note urlsplit(): 2ae. の具象クラスの結果には *note str: 1ea. デー
     タが含まれます。‘encode()’ メソッドは *note SplitResultBytes: 41f6.
     インスタンスを返します。

以下のクラスは *note bytes: 1d2. または *note bytearray: 1d1. オブジェク
トを操作した時に解析結果の実装を提供します:

 -- クラス: urllib.parse.DefragResultBytes (url, fragment)

     *note urldefrag(): 2b0. の具象クラスの結果には *note bytes: 1d2. デ
     ータが含まれます。‘decode()’ メソッドは *note DefragResult: 4200. イ
     ンスタンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.ParseResultBytes (scheme, netloc, path, params,
          query, fragment)

     *note urlparse(): 2af. の具象クラスの結果には *note bytes: 1d2. が
     含まれます。‘decode()’ メソッドは *note ParseResult: 41f9. インスタ
     ンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.SplitResultBytes (scheme, netloc, path, query,
          fragment)

     *note urlsplit(): 2ae. の具象クラスの結果には *note bytes: 1d2. デ
     ータが含まれます。‘decode()’ メソッドは *note SplitResult: 41f5. イ
     ンスタンスを返します。

     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: 1ea. か *note bytes: 1d2. オブ
     ジェクトです。

     バージョン 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(): cab.
     で受け付けられる非 ASCII 文字への対処法を指定します。'encoding' の
     デフォルトは ‘'utf-8'’、'errors' のデフォルトは ‘'strict'’ で、非サ
     ポート文字があると *note UnicodeEncodeError: a6c. を送出します。
     'string' が *note bytes: 1d2. の場合 'encoding' と 'errors' を指定
     してはいけません。指定すると *note TypeError: 29c. が送出されます。

     ‘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(): f66, 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(): f66. と似ていますが、*note str: 1ea. ではなく *note
     bytes: 1d2. オブジェクトを取り、文字列からバイト列へのエンコードを
     行いません。

     例: ‘quote_from_bytes(b'a&\xef')’ は ‘'a%26%EF'’ を返します。

 -- の関数: urllib.parse.unquote (string, encoding='utf-8',
          errors='replace')

     エスケープされた ‘%XX’ をそれに対応した単一文字に置き換えます。オプ
     ション引数の 'encoding' と 'errors' は *note bytes.decode(): cac. メ
     ソッドで受け付けられるパーセントエンコードされたシーケンスから
     Unicode 文字へのデコード法を指定します。

     'string' に使用できるのは *note str: 1ea. か *note bytes: 1d2. オブ
     ジェクトです。

     '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(): 1d19. と似ていますが、HTML フォームの値のアンクオ
     ートのために「+」を空白に置き換えます。

     'string' は *note str: 1ea. でなければなりません。

     例: ‘unquote_plus('/El+Ni%C3%B1o/')’ は ‘'/El Niño/'’ を返します。

 -- の関数: urllib.parse.unquote_to_bytes (string)

     スケープされた ‘%XX’ をそれに対応した 1 オクテットに置き換え、*note
     bytes: 1d2. オブジェクトを返します。

     'string' に使用できるのは *note str: 1ea. か *note bytes: 1d2. オブ
     ジェクトです。

     *note str: 1ea. だった場合、'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: 1ea. か *note bytes: 1d2. オブジェクトが含まれているか
     もしれません) を、パーセントエンコードされた ASCII 文字列に変換しま
     す。戻り値の文字列が *note urlopen(): 586. 関数での POST 操作の
     'data' で使用される場合はバイト列にエンコードしなければなりません。
     そうでない場合は *note TypeError: 29c. が送出されます。

     戻り値は ‘'&'’ 文字で区切られた ‘key=value’ のペアからなる一組の文
     字列になります。 'key' と 'value' は 'quote_via' を使用してクオート
     されます。デフォルトで、値をクォートするために *note quote_plus():
     1602. が使用されます。つまり、スペースは ‘'+'’ 文字に、 '/' 文字は
     ‘%2F’ にクォートされます。これは GET リクエストの標準に準拠します
     (‘application/x-www-form-urlencoded’)。 'quote_via' として渡すこと
     ができる別の関数は *note quote(): f66. です。それはスペースを ‘%20’
     にエンコードし、 '/' をエンコードしません。何がクォートされるかを最
     大限コントロールしたければ、 ‘quote’ を使って 'safe' に値を指定して
     ください。

     引数 'query' が 2 要素のタプルのシーケンスの場合、各タプルの第一要
     素はキーに、第二要素は値になります。 値となる要素はシーケンスを取る
     こともでき、この場合、オプションのパラメーター 'doseq' が ‘True’ と
     評価されるのであれば、キーに対し値シーケンスの各要素を個別に結び付
     けた ‘key=value’ のペアを、 ‘'&'’ 文字でつないだものを生成します。
     エンコードされた文字列内のパラメーターの順序はシーケンス内のパラメ
     ータータプルの順序と一致します。

     'safe', 'encoding', および 'errors' パラメータは 'quote_via' にその
     まま渡されます (クエリ要素が *note str: 1ea. の場合は、 'encoding'
     と 'errors' パラメータだけが渡されます)。

     このエンコード処理の逆を行うには、このモジュールで提供されている
     *note parse_qs(): 590. と *note parse_qsl(): 58f. を使用して、クエ
     リ文字列を Python データ構造に変換できます。

     POST リクエストのデータ、あるいは URL クエリ文字列を生成するために
     、 *note urllib.parse.urlencode(): 1249. メソッドをどのように使えば
     よいかを見るには、*note urllib の使用例: 41e6. を参照してください。

     バージョン 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: 114.  The base exception class is *note
URLError: 541.

The following exceptions are raised by ‘urllib.error’ as appropriate:

 -- 例外: urllib.error.URLError

     ハンドラが何らかの問題に遭遇した場合、この例外 (またはこの例外から
     派生した例外)を送出します。この例外は *note OSError: 543. のサブク
     ラスです。

      -- の属性: reason

          このエラーの理由。メッセージ文字列あるいは他の例外インスタンス
          です。

     バージョン 3.3 で変更: *note URLError: 541. は以前は *note IOError:
     1409. のサブタイプでしたが、 *note OSError: 543. のエイリアスになり
     ました。

 -- 例外: urllib.error.HTTPError (url, code, msg, hdrs, fp)

     *note HTTPError: 138c. は例外 (*note URLError: 541. のサブクラス) で
     すが、同時に例外ではない file-like な戻り値を返す関数でもあります
     (*note urlopen(): 586. の戻り値と同じです)。これは、例えばサーバか
     らの認証リクエストのように、変わった HTTP エラーを処理するのに役立
     ちます。

      -- の属性: url

          リクエスト URL を含みます。 'filename' 属性のエイリアスです。

      -- の属性: code

          RFC 2616(2) に定義されているHTTPステータスコード。 この数値型
          の値は、 *note http.server.BaseHTTPRequestHandler.responses:
          420a. の辞書に登録されているコードに対応します。

      -- の属性: reason

          これは通常、このエラーの原因を説明する文字列です。 'msg' 属性
          のエイリアスです。

      -- の属性: headers

          *note HTTPError: 138c. の原因となった HTTP リクエストの HTTP レ
          スポンスヘッダ。 'hdrs' 属性のエイリアスです。

          Added in version 3.4.

      -- の属性: fp

          HTTP エラーの body を読み出し可能なファイルライクオブジェクト
          。

 -- 例外: urllib.error.ContentTooShortError (msg, content)

     この例外は *note urlretrieve(): 587. 関数が、ダウンロードされたデー
     タの量が予期した量 ('Content-Length' ヘッダで与えられる) よりも少な
     いことを検知した際に発生します。

      -- の属性: content

          ダウンロードされた、 (おそらく切り捨てられた) データ。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 10be, 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: a42. ‘RequestRate(requests, seconds)’ として返し
          ます。そのようなパラメーターが存在しないか、指定された 'ユーザ
          ーエージェント' にあてはまらない、もしくは ‘robots.txt’ のこの
          パラメーターのエントリの構文が無効な場合は、 ‘None’ を返します
          。

          Added in version 3.6.

      -- メソッド: site_maps ()

          ‘robots.txt’ の ‘Sitemap’ パラメーターの内容を *note list():
          4e0. の形式で返します。そのようなパラメーターが存在しないか、
          ‘robots.txt’ のこのパラメーターのエントリの構文が無効な場合は
          、 ‘None’ を返します。

          Added in version 3.8.

以下に *note RobotFileParser: 10be. クラスの利用例を示します。

     >>> 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/main/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: 72. は低水準のHTTPプロトコルのクライアントです。
     高水準の URL を開く操作には *note urllib.request: 114. を使ってくだ
     さい

   * *note http.server: 75. は *note socketserver: d5. をベースにした基
     礎的な HTTP サーバーを実装しています

   * *note http.cookies: 74. は cookie の状態管理を実装するためのユーテ
     ィリティーを提供しています

   * *note http.cookiejar: 73. は 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: 10a1. のサブクラスです。

     使い方:

          >>> 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/main/Lib/http/__init__.py


File: python.info,  Node: HTTP ステータスコード,  Next: HTTP ステータスコードカテゴリ,  Up: http --- HTTP モジュール群

5.23.9.1 HTTP ステータスコード
..............................

*note http.HTTPStatus: cd4. で利用可能な、サポートされている、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: 72. にも定数という形で
存在します。 列挙名は定数名と同じです (すなわち ‘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: a12. のサブクラスです。

     使い方:

          >>> 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: 421d. で利用可能な、サポートされている、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: 114. モジュールが HTTP や HTTPS を使った URL を
扱う上でこのモジュールを使います。

参考
....

より高水準の HTTP クライアントインターフェースとして Requests パッケージ
(2) が推奨されています。

     注釈: HTTPS のサポートは、Python が SSL サポート付きでコンパイルさ
     れている場合にのみ利用できます (*note ssl: d8. モジュールによって
     )。

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

このモジュールでは以下のクラスを提供しています:

 -- クラス: http.client.HTTPConnection (host, port=None[, timeout],
          source_address=None, blocksize=8192,
          max_response_headers=None)

     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.  The optional
     'max_response_headers' parameter sets the maximum number of allowed
     response headers to help prevent denial-of-service attacks,
     otherwise the default value (100) is used.

     例えば、以下の呼び出しは全て同じサーバの同じポートに接続するインス
     タンスを生成します:

          >>> 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' 引数が追加されました。

     バージョン 3.15 で変更: 'max_response_headers' parameter was added.

 -- クラス: http.client.HTTPSConnection (host, port=None, *[, timeout],
          source_address=None, context=None, blocksize=8192,
          max_response_headers=None)

     *note HTTPConnection: 22e. のサブクラスはセキュア・サーバとやりとり
     する為の SSL を使う場合に用います。デフォルトのポート番号は ‘443’ で
     す。'context' が指定されれば、それは様々な SSL オプションを記述する
     *note ssl.SSLContext: 33e. インスタンスでなければなりません。

     ベストプラクティスに関するより良い情報が *note
     セキュリティで考慮すべき点: 3aee. にありますのでお読みください。

     バージョン 3.2 で変更: 'source_address'、'context' そして
     'check_hostname' が追加されました。

     バージョン 3.2 で変更: このクラスは現在、可能であれば (つまり *note
     ssl.HAS_SNI: 3c35. が真の場合) 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: df9. 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(): 1218.

     バージョン 3.12 で変更: The deprecated 'key_file', 'cert_file' and
     'check_hostname' parameters have been removed.

     バージョン 3.15 で変更: 'max_response_headers' parameter was added.

 -- クラス: 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: a88.
     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:
     4223. that holds the header fields, but no payload (the same as
     *note HTTPResponse.msg: 4224. and *note
     http.server.BaseHTTPRequestHandler.headers: 4225.).  After
     returning, the file pointer 'fp' is ready to read the HTTP body.

          注釈: *note parse_headers(): 2034. 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: da2. のサブクラスです。

 -- 例外: http.client.NotConnected

     *note HTTPException: 4226. サブクラスです。

 -- 例外: http.client.InvalidURL

     *note HTTPException: 4226. のサブクラスです。ポート番号を指定したも
     のの、その値が数字でなかったり空のオブジェクトであった場合に送出さ
     れます。

 -- 例外: http.client.UnknownProtocol

     *note HTTPException: 4226. サブクラスです。

 -- 例外: http.client.UnknownTransferEncoding

     *note HTTPException: 4226. サブクラスです。

 -- 例外: http.client.UnimplementedFileMode

     *note HTTPException: 4226. サブクラスです。

 -- 例外: http.client.IncompleteRead

     *note HTTPException: 4226. サブクラスです。

 -- 例外: http.client.ImproperConnectionState

     *note HTTPException: 4226. サブクラスです。

 -- 例外: http.client.CannotSendRequest

     *note ImproperConnectionState: 422d. のサブクラスです。

 -- 例外: http.client.CannotSendHeader

     *note ImproperConnectionState: 422d. のサブクラスです。

 -- 例外: http.client.ResponseNotReady

     *note ImproperConnectionState: 422d. のサブクラスです。

 -- 例外: http.client.BadStatusLine

     *note HTTPException: 4226. のサブクラスです。サーバが理解できない
     HTTP 状態コードで応答した場合に送出されます。

 -- 例外: http.client.LineTooLong

     A subclass of *note HTTPException: 4226.  Raised if an excessively
     long line is received in the HTTP protocol from the server.

 -- 例外: http.client.RemoteDisconnected

     A subclass of *note ConnectionResetError: 1415. and *note
     BadStatusLine: 4231.  Raised by *note HTTPConnection.getresponse():
     11c1. 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: 4231.‘('')’
     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 ステータスコード: 421a. 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/main/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: 22e. インスタンスには以下のメソッドがあります:

 -- メソッド: 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: 1ea, a *note
     bytes-like object: 43d, an open *note file object: 1581, or an
     iterable of *note bytes: 1d2.  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: a89, 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: 1581, 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: 1ea. 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(): 4238. if *note getresponse(): 11c1. raised an
          non-*note ConnectionError: 11c3. 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: 148e. インスタ
     ンスを返します。

     バージョン 3.5 で変更: If a *note ConnectionError: 11c3. or
     subclass is raised, the *note HTTPConnection: 22e. object will be
     ready to reconnect when a new request is sent.

     Note that this does not apply to *note OSError: 543.s raised by the
     underlying socket.  Instead the caller is responsible to call *note
     close(): 4238. 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: 148e.
     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: 22f. 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: 1e84. ‘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.

 -- の属性: HTTPConnection.max_response_headers

     The maximum number of allowed response headers to help prevent
     denial-of-service attacks.  By default, the maximum number of
     allowed headers is set to 100.

     Added in version 3.15.

As an alternative to using the *note request(): 106e. 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: 319. the encoding will result in a single chunk.  If
     'message_body' is a *note collections.abc.Iterable: 28c2, each
     iteration of 'message_body' will result in a chunk.  If
     'message_body' is a *note file object: 1581, 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(): 106f.
     が呼び出された直後で、かつ *note getresponse(): 11c1. が呼び出され
     る前に使わなければなりません。

     Raises an *note auditing event: 1e84. ‘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: 148e. インスタンスはサーバからのHTTPレスポンスをラッ
プします。これを使用してリクエストヘッダとエンティティボディへアクセスす
ることができます。レスポンスはイテレート可能なオブジェクトであり、また
with文と使うことも可能です。

バージョン 3.5 で変更: The *note io.BufferedIOBase: a88. 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: 4223. instance containing the
     response headers.  ‘http.client.HTTPMessage’ is a subclass of *note
     email.message.Message: 786.

 -- の属性: 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: 221. instance.

 -- の属性: HTTPResponse.status

     サーバから返される状態コードです。

 -- の属性: HTTPResponse.reason

     サーバから返される応答の理由文です。

 -- の属性: HTTPResponse.debuglevel

     A debugging hook.  If *note debuglevel: 4249. 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: 4246. を使用
     してください。

 -- メソッド: HTTPResponse.info ()

     バージョン 3.9 で非推奨: 非推奨となったので *note headers: 4247. を
     使用してください。

 -- メソッド: HTTPResponse.getcode ()

     バージョン 3.9 で非推奨: 非推奨となったので *note status: 4248. を
     使用してください。


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: 1386. 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: 4223. のインスタンスは HTTP レスポンスヘ
ッダを格納します。 *note email.message.Message: 786. クラスを利用して実
装されています。


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: cce. クラスと、それに関連するいくつかの項
目を定義しています。 ‘FTP’ クラスは、FTPプロトコルのクライアント側の機能
を備えています。このクラスを使うとFTPのいろいろな機能の自動化、例えば他
のFTPサーバのミラーリングといったことを実行するPythonプログラムを書くこ
とができます。また、 *note urllib.request: 114. モジュールもFTPを使う
URLを操作するのにこのクラスを使っています。 FTP (File Transfer
Protocol)についての詳しい情報はinternet RFC 959(2) を参照して下さい。

The default encoding is UTF-8, following RFC 2640(3).

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

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/main/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: cce. class.


     パラメータ:

        * ‘host’ (*note str: 1ea.) - The hostname to connect to.  If
          given, ‘connect(host)’ is implicitly called by the
          constructor.

        * ‘user’ (*note str: 1ea.) - The username to log in with
          (default: ‘'anonymous'’).  If given, ‘login(host, passwd,
          acct)’ is implicitly called by the constructor.

        * ‘passwd’ (*note str: 1ea.) - 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: 1ea.) - Account information to be used for
          the ‘ACCT’ FTP command.  Few systems implement this.  See
          RFC-959(1) for more details.

        * ‘timeout’ (*note float: 32f.‘ | ’‘None’) - A timeout in
          seconds for blocking operations like *note connect(): 4258.
          (default: the global default timeout setting).

        * ‘source_address’ (*note tuple: 1d9.‘ | ’‘None’) - A 2-tuple
          ‘(host, port)’ for the socket to bind to as its source address
          before connecting.

        * ‘encoding’ (*note str: 1ea.) - The encoding for directories
          and filenames (default: ‘'utf-8'’).

     *note FTP: cce. クラスは *note with: 215. 文をサポートしています。
     例えば:

          >>> 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: 215. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'source_address' 引数が追加されました。

     バージョン 3.9 で変更: If the 'timeout' parameter is set to be
     zero, it will raise a *note ValueError: 15a. 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: cce. インスタンスには以下のメソッドがあります:

      -- メソッド: set_debuglevel (level)

          Set the instance's debugging level as an *note int: 32e.  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: cce. instance
          was created.  All other ‘FTP’ methods can only be called after
          a connection has successfully been made.


          パラメータ:

             * ‘host’ (*note str: 1ea.) - The host to connect to.

             * ‘port’ (*note int: 32e.) - 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: 32f.‘ | ’‘None’) - A timeout in
               seconds for the connection attempt (default: the global
               default timeout setting).

             * ‘source_address’ (*note tuple: 1d9.‘ | ’‘None’) - A
               2-tuple ‘(host, port)’ for the socket to bind to as its
               source address before connecting.

          引数 ‘self’, ‘host’, ‘port’ を指定して *note 監査イベント:
          1e84. ‘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: cce. instance
          was created.  Most FTP commands are only allowed after the
          client has logged in.


          パラメータ:

             * ‘user’ (*note str: 1ea.) - The username to log in with
               (default: ‘'anonymous'’).

             * ‘passwd’ (*note str: 1ea.) - 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: 1ea.) - 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 監査イベント: 1e84.
          ‘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: 425f. otherwise.

          引数 ‘self’, ‘cmd’ を指定して *note 監査イベント: 1e84.
          ‘ftplib.sendcmd’ を送出します。

      -- メソッド: retrbinary (cmd, callback, blocksize=8192, rest=None)

          Retrieve a file in binary transfer mode.


          パラメータ:

             * ‘cmd’ (*note str: 1ea.) - An appropriate ‘RETR’ command:
               ‘"RETR FILENAME"’.

             * ‘callback’ (*note callable: 2fba.) - A single parameter
               callable that is called for each block of data received,
               with its single argument being the data as *note bytes:
               1d2.

             * ‘blocksize’ (*note int: 32e.) - The maximum chunk size to
               read on the low-level *note socket: 115e. 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: 32e.) - A ‘REST’ command to be sent to
               the server.  See the documentation for the 'rest'
               parameter of the *note transfercmd(): 4261. 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():
          4260.) 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: ea0.

      -- メソッド: set_pasv (val)

          'val' が真の場合 "パッシブ" モードを有効化し、偽の場合は無効化
          します。 デフォルトではパッシブモードです。

      -- メソッド: storbinary (cmd, fp, blocksize=8192, callback=None,
               rest=None)

          Store a file in binary transfer mode.


          パラメータ:

             * ‘cmd’ (*note str: 1ea.) - An appropriate ‘STOR’ command:
               ‘"STOR FILENAME"’.

             * ‘fp’ (*note file object: 1581.) - A file object (opened
               in binary mode) which is read until EOF, using its *note
               read(): 11d4. method in blocks of size 'blocksize' to
               provide the data to be stored.

             * ‘blocksize’ (*note int: 32e.) - The read block size.
               Defaults to ‘8192’.

             * ‘callback’ (*note callable: 2fba.) - A single parameter
               callable that is called for each block of data sent, with
               its single argument being the data as *note bytes: 1d2.

             * ‘rest’ (*note int: 32e.) - A ‘REST’ command to be sent to
               the server.  See the documentation for the 'rest'
               parameter of the *note transfercmd(): 4261. 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(): 16c3.).  Lines are
          read until EOF from the *note file object: 1581. 'fp' (opened
          in binary mode) using its *note readline(): 16e3. 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: 425f.
          exception will be raised.  If this happens, simply call
          ‘transfercmd()’ without a 'rest' argument.

      -- メソッド: ntransfercmd (cmd, rest=None)

          *note transfercmd(): 4261. と同様ですが、データと予想されるサ
          イズとのタプルを返します。もしサイズが計算できないなら、サイズ
          の代わりに ‘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():
               1483. 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(): 4262.;
          the default prints to *note sys.stdout: ea0.  This method
          returns ‘None’.

               注釈: If your server supports the command, *note mlsd():
               1483. offers a better API.

      -- メソッド: rename (fromname, toname)

          サーバ上のファイルのファイル名 'fromname' を 'toname' へ変更し
          ます。

      -- メソッド: delete (filename)

          サーバからファイル 'filename' を削除します。成功したら応答のテ
          キストを返し、そうでないならパーミッションエラーでは *note
          error_perm: 4268. を、他のエラーでは *note error_reply: 425f.
          を返します。

      -- メソッド: cwd (pathname)

          サーバのカレントディレクトリを設定します。

      -- メソッド: mkd (pathname)

          サーバ上に新たにディレクトリを作ります。

      -- メソッド: pwd ()

          サーバ上のカレントディレクトリのパスを返します。

      -- メソッド: rmd (dirname)

          サーバ上のディレクトリ 'dirname' を削除します。

      -- メソッド: size (filename)

          サーバ上のファイル 'filename' のサイズを尋ねます。成功したらフ
          ァイルサイズが整数で返され、そうでないなら ‘None’ が返されます
          。 ‘SIZE’ コマンドは標準化されていませんが、多くの普通のサーバ
          で実装されていることに注意して下さい。

      -- メソッド: quit ()

          サーバに ‘QUIT’ コマンドを送信し、接続を閉じます。これは接続を
          閉じるのに"礼儀正しい"方法ですが、 ‘QUIT’ コマンドに反応してサ
          ーバの例外が発生するかもしれません。この例外は、 *note
          close(): 426f. メソッドによって *note FTP: cce. インスタンスに
          対するその後のコマンド使用が不可になっていることを示しています
          （下記参照）。

      -- メソッド: close ()

          接続を一方的に閉じます。既に閉じた接続に対して実行すべきではあ
          りません（例えば *note quit(): 426e. を呼び出して成功した後な
          ど）。この実行の後、 *note FTP: cce. インスタンスはもう使用す
          べきではありません（ *note close(): 426f. あるいは ‘quit()’ を
          呼び出した後で、 *note login(): 425b. メソッドをもう一度実行し
          て再び接続を開くことはできません）。

   ---------- 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: cce. 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(): 4271. method.


     パラメータ:

        * ‘host’ (*note str: 1ea.) - The hostname to connect to.  If
          given, ‘connect(host)’ is implicitly called by the
          constructor.

        * ‘user’ (*note str: 1ea.) - The username to log in with
          (default: ‘'anonymous'’).  If given, ‘login(host, passwd,
          acct)’ is implicitly called by the constructor.

        * ‘passwd’ (*note str: 1ea.) - 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: 1ea.) - 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: 33e.) - An SSL context object
          which allows bundling SSL configuration options, certificates
          and private keys into a single, potentially long-lived,
          structure.  Please read *note セキュリティで考慮すべき点:
          3aee. for best practices.

        * ‘timeout’ (*note float: 32f.‘ | ’‘None’) - A timeout in
          seconds for blocking operations like *note connect(): 4258.
          (default: the global default timeout setting).

        * ‘source_address’ (*note tuple: 1d9.‘ | ’‘None’) - A 2-tuple
          ‘(host, port)’ for the socket to bind to as its source address
          before connecting.

        * ‘encoding’ (*note str: 1ea.) - 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: 3c23. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 3c35. を
     参照してください)。

     バージョン 3.9 で変更: If the 'timeout' parameter is set to be
     zero, it will raise a *note ValueError: 15a. 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: ccf. クラスを使ったサンプルセッションはこちらです:

          >>> 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: cce, defining these
     additional methods and attributes:

      -- メソッド: auth ()

          Set up a secure control connection by using TLS.

          バージョン 3.4 で変更: The method now supports hostname check
          with *note ssl.SSLContext.check_hostname: 3c23. and 'Server
          Name Indication' (see *note ssl.HAS_SNI: 3c35.).

      -- メソッド: 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 by using TLS.

      -- メソッド: 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: cce. インスタンスのメソッド実行時、FTP接続で (プログラミ
     ングのエラーと考えられるメソッドの実行によって) 発生する全ての例外
     (タプル形式)。この例外には以上の４つのエラーはもちろん、 *note
     OSError: 543. と *note EOFError: 1693. も含まれます。

参考
....

*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: cf4. を定義しています。 ‘POP3’ はPOP3
サーバへの接続をカプセル化し、 RFC 1939(2) で定義されているプロトコルを
実装しています。 ‘POP3’ クラスは RFC 1939(3) の最小限のコマンドセットと
オプションのコマンドセットをサポートしています。 既に確立されている接続
で暗号化された通信を行うために、 RFC 2595(4) で導入された ‘STLS’ コマン
ドもサポートされています。

加えて、このモジュールはクラス *note POP3_SSL: cf5. を提供しています。
‘POP3_SSL’ は SSL を下層のプロトコルレイヤーとして使う POP3 サーバへの接
続をサポートしています。

POP3についての注意事項は、それが広くサポートされているにもかかわらず、既
に時代遅れだということです。幾つも実装されているPOP3サーバーの品質は、貧
弱なものが多数を占めています。もし、お使いのメールサーバーがIMAPをサポー
トしているなら、 *note imaplib.IMAP4: 322. クラスが使えます。 IMAPサーバ
ーは、より良く実装されている傾向があります。

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

The ‘poplib’ module provides two classes:

 -- クラス: poplib.POP3 (host, port=POP3_PORT[, timeout])

     このクラスが、実際にPOP3プロトコルを実装します。インスタンスが初期
     化されるときに、コネクションが作成されます。 'port' が省略されると
     、POP3標準のポート(110)が使われます。オプションの 'timeout' 引数は
     、接続時のタイムアウト時間を秒数で指定します (指定されなかった場合
     は、グローバルのデフォルトタイムアウト設定が利用されます)。

     引数 ‘self’, ‘host’, ‘port’ 付きで *note 監査イベント: 1e84.
     ‘poplib.connect’ を送出します。

     全てのコマンドは引数 ‘self’ と ‘line’ を指定して *note auditing
     event: 1e84. ‘poplib.putline’ を送出します。ここで ‘line’ はリモー
     トホストに送信されるバイト数です。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 15a. を
     送出します。

 -- クラス: poplib.POP3_SSL (host, port=POP3_SSL_PORT, *, timeout=None,
          context=None)

     *note POP3: cf4. クラスのサブクラスで、SSL でカプセル化されたソケッ
     トによる POP サーバへの接続を提供します。 'port' が指定されていない
     場合、 POP3-over-SSL 標準の 995 番ポートが使われます。'timeout' に
     ついては ‘POP3’ クラスのコンストラクタの引数と同じです。 'context'
     は SSL の設定、証明書、秘密鍵を一つの (POP3_SSL オブジェクトよりも
     長く存在し続けうる) 構造にまとめた *note ssl.SSLContext: 33e. オブ
     ジェクトで、省略可能です。ベストプラクティスについては *note
     セキュリティで考慮すべき点: 3aee. を参照してください。

     引数 ‘self’, ‘host’, ‘port’ 付きで *note 監査イベント: 1e84.
     ‘poplib.connect’ を送出します。

     全てのコマンドは引数 ‘self’ と ‘line’ を指定して *note auditing
     event: 1e84. ‘poplib.putline’ を送出します。ここで ‘line’ はリモー
     トホストに送信されるバイト数です。

     バージョン 3.2 で変更: 'context' 引数が追加されました。

     バージョン 3.4 で変更: このクラスは *note
     ssl.SSLContext.check_hostname: 3c23. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 3c35. を
     参照してください)。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 15a. を
     送出します。

     バージョン 3.12 で変更: 非推奨の 'keyfile' と 'certfile' 引数を削除
     しました。

One exception is defined as an attribute of the ‘poplib’ module:

 -- 例外: poplib.error_proto

     このモジュール内で起こったあらゆるエラーで送出される例外です (*note
     socket: d4. モジュールからのエラーは捕捉されません)。例外の理由は文
     字列としてコンストラクタに渡されます。

参考
....

モジュール *note imaplib: 77.

     標準 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/main/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: cf4. クラスのインスタンスは以下のメソッドを持ちます:

 -- メソッド: 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():
     1559. が呼ばれるまでロックされます。

 -- メソッド: 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: 155a. を送出します。 RFC
     6856(2) で規定されています。

     Added in version 3.5.

 -- メソッド: POP3.stls (context=None)

     アクティブな接続にて RFC 2595(3) で定められた方法で TLS セッション
     を開始します。TLS セッションはユーザ認証を行う前に開始する必要があ
     ります。

     'context' は SSL の設定、証明書、秘密鍵を一つの (POP3 オブジェクト
     よりも長く存在し続けうる) 構造にまとめた *note ssl.SSLContext: 33e.
     オブジェクトです。ベストプラクティスについては *note
     セキュリティで考慮すべき点: 3aee. を参照してください。

     このメソッドは *note ssl.SSLContext.check_hostname: 3c23. と
     'Server Name Indication' でホスト名のチェックをサポートしました。
     (*note ssl.HAS_SNI: 3c35. を参照してください)。

     Added in version 3.4.

*note POP3_SSL: cf5. クラスのインスタンスは追加のメソッドを持ちません。
このサブクラスのインターフェイスは親クラスと同じです。

   ---------- 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: 322, *note IMAP4_SSL: cd7.
と *note IMAP4_stream: cd9. を定義します。これらのクラスは IMAP4 サーバ
への接続をカプセル化し、 RFC 2060(2) に定義されている IMAP4rev1 クライア
ントプロトコルの大規模なサブセットを実装しています。このクラスは IMAP4 (
RFC 1730(3)) 準拠のサーバと後方互換性がありますが、 ‘STATUS’ コマンドは
IMAP4 ではサポートされていないので注意してください。

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

Three classes are provided by the ‘imaplib’ module, *note IMAP4: 322. 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: 215. 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: 215. 構文のサポートが追加されま
     した。

     バージョン 3.9 で変更: オプションの 'timeout' 引数が追加されました
     。

例外は *note IMAP4: 322. クラスの属性として定義されています:

 -- 例外: IMAP4.error

     何らかのエラー発生の際に送出される例外です。例外の理由は文字列とし
     てコンストラクタに渡されます。

 -- 例外: IMAP4.abort

     IMAP4 サーバのエラーが生じると、この例外が送出されます。この例外は
     *note IMAP4.error: 1a2c. のサブクラスです。通常、インスタンスを閉じ
     、新たなインスタンスを再び生成することで、この例外から復旧できます
     。

 -- 例外: IMAP4.readonly

     この例外は書き込み可能なメールボックスの状態がサーバによって変更さ
     れた際に送出されます。この例外は *note IMAP4.error: 1a2c. のサブク
     ラスです。他の何らかのクライアントが現在書き込み権限を獲得しており
     、メールボックスを開きなおして書き込み権限を再獲得する必要がありま
     す。

このモジュールではもう一つ、安全 (secure) な接続を使ったサブクラスがあり
ます:

 -- クラス: imaplib.IMAP4_SSL (host='', port=IMAP4_SSL_PORT, *,
          ssl_context=None, timeout=None)

     This is a subclass derived from *note IMAP4: 322. 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: 33e. object which allows bundling SSL
     configuration options, certificates and private keys into a single
     (potentially long-lived) structure.  Please read *note
     セキュリティで考慮すべき点: 3aee. 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: 3c23. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 3c35. を
     参照してください)。

     バージョン 3.9 で変更: オプションの 'timeout' 引数が追加されました
     。

     バージョン 3.12 で変更: 非推奨の 'keyfile' と 'certfile' 引数を削除
     しました。

さらにもう一つのサブクラスは、子プロセスで確立した接続を使用する場合に使
用します:

 -- クラス: imaplib.IMAP4_stream (command)

     *note IMAP4: 322. から派生したサブクラスで、 'command' を
     ‘subprocess.Popen()’ に渡して作成される ‘stdin/stdout’ ディスクリプ
     タと接続します。

以下のユーティリティ関数が定義されています:

 -- の関数: imaplib.Internaldate2tuple (datestr)

     IMAP4 の ‘INTERNALDATE’ 文字列を解析してそれに相当するローカルタイ
     ムを返します。戻り値は *note time.struct_time: 10ab. のタプルか、文
     字列のフォーマットが不正な場合は ‘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(): 764.), a 9-tuple representing local
     time an instance of *note time.struct_time: 10ab. (as returned by
     *note time.localtime(): 18b1.), an aware instance of *note
     datetime.datetime: 6ed, 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/main/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: 322. のインスタンスは以下のメソッドを持っています:

 -- メソッド: IMAP4.append (mailbox, flags, date_time, message)

     指定された名前のメールボックスに 'message' を追加します。

     'flags' may be ‘None’ or a string of IMAP flag tokens.  Multiple
     flags are separated by spaces, for example ‘r'\Seen \Answered'’.
     If 'flags' is not already enclosed in parentheses, parentheses are
     added automatically.

 -- メソッド: 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: 215. statement, produces IMAP untagged responses via
     the *note iterator: 6d4. 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: 215. context) can be
     retrieved in the usual way after ‘IDLE’ ends, using *note
     IMAP4.response(): 42a5.

     Responses are represented as ‘(type, [data, ...])’ tuples, as
     described in *note IMAP4 Objects: 4297.

     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: 32e. or *note float: 32f, 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: cd9. 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: 32e. or *note float: 32f.).

          This *note generator: 1417. 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: cd9. 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: 215. statement.  Before or after that
          context, unsolicited responses are collected internally
          whenever a command finishes, and can be retrieved with *note
          IMAP4.response(): 42a5.

          注釈: 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.15 で変更: An *note IMAP4.error: 1a2c. 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: 15a. to reject
     creating a non-blocking socket.  This method is implicitly called
     by the *note IMAP4: 322. constructor.  The connection objects
     established by this method will be used in the *note IMAP4.read():
     42ad, *note IMAP4.readline(): 42ae, *note IMAP4.send(): 42af, and
     *note IMAP4.shutdown(): 42b0. methods.  You may override this
     method.

     引数 ‘self’, ‘host’, ‘port’ を指定して *note 監査イベント: 1e84.
     ‘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(): 11c6. 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 監査イベント: 1e84.
     ‘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(): e57. は暗
     黙的にこのメソッドを呼び出します。このメソッドはオーバライドするこ
     とができます。

 -- メソッド: 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: 33e. object.  This will
     enable encryption on the IMAP connection.  Please read *note
     セキュリティで考慮すべき点: 3aee. for best practices.

     Added in version 3.2.

     バージョン 3.4 で変更: The method now supports hostname check with
     *note ssl.SSLContext.check_hostname: 3c23. and 'Server Name
     Indication' (see *note ssl.HAS_SNI: 3c35.).

 -- メソッド: IMAP4.status (mailbox, names)

     'mailbox' の指定ステータス名の状態情報を要求します。

 -- メソッド: IMAP4.store (message_set, command, flag_list)

     メールボックス内のメッセージ群のフラグ設定を変更します。 'command'
     は RFC 2060(9) のセクション 6.4.6 で指定されているもので、 "FLAGS",
     "+FLAGS", あるいは "-FLAGS" のいずれかとなります。オプションで末尾
     に ".SILENT" がつくこともあります。

     たとえば、すべてのメッセージに削除フラグを設定するには次のようにし
     ます:

          typ, data = M.search(None, 'ALL')
          for num in data[0].split():
             M.store(num, '+FLAGS', '\\Deleted')
          M.expunge()

          注釈: Creating flags containing ']' (for example: "[test]")
          violates RFC 3501(10) (the IMAP protocol).  However, imaplib
          has historically allowed creation of such tags, and popular
          IMAP servers, such as Gmail, accept and produce such flags.
          There are non-Python programs which also create such tags.
          Although it is an RFC violation and IMAP clients and servers
          are supposed to be strict, imaplib still continues to allow
          such tags to be created for backward compatibility reasons,
          and as of Python 3.6, handles them if they are sent from the
          server, since this improves real-world compatibility.

 -- メソッド: IMAP4.subscribe (mailbox)

     新たなメールボックスを購読 (subscribe) します。

 -- メソッド: IMAP4.thread (threading_algorithm, charset,
          search_criterion[, ...])

     ‘thread’ コマンドは ‘search’ にスレッドの概念を加えた変形版です。返
     されるデータは空白で区切られたスレッドメンバのリストを含んでいます
     。

     各スレッドメンバは0以上のメッセージ番号からなり、空白で区切られてお
     り、親子関係を示しています。

     Thread has two arguments before the 'search_criterion' argument(s);
     a 'threading_algorithm', and the searching 'charset'.  Note that
     unlike ‘search’, the searching 'charset' argument is mandatory.
     There is also a ‘uid thread’ command which corresponds to ‘thread’
     the way that ‘uid search’ corresponds to ‘search’.  The ‘thread’
     command first searches the mailbox for messages that match the
     given searching criteria using the 'charset' argument for the
     interpretation of strings in the searching criteria.  It then
     returns the matching messages threaded according to the specified
     threading algorithm.

     ‘IMAP4rev1’ 拡張命令です。

 -- メソッド: IMAP4.uid (command, arg[, ...])

     command args を、メッセージ番号ではなく UID で指定されたメッセージ
     群に対して実行します。命令内容に応じた応答を返します。少なくとも一
     つの引数を与えなくてはなりません; 何も与えない場合、サーバはエラー
     を返し、例外が送出されます。

 -- メソッド: IMAP4.unsubscribe (mailbox)

     古いメールボックスの購読を解除 (unsubscribe) します。

 -- メソッド: IMAP4.unselect ()

     *note imaplib.IMAP4.unselect(): cda. 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(): cdb, except that no messages are
     permanently removed from the currently selected mailbox.

     Added in version 3.9.

 -- メソッド: IMAP4.xatom (name[, ...])

     サーバから ‘CAPABILITY’ 応答で通知された単純な拡張命令を許容
     (allow) します。

以下の属性が *note IMAP4: 322. のインスタンス上で定義されています:

 -- の属性: 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(): 11c6. command is successfully issued for the
     ‘UTF8=ACCEPT’ capability.

     Added in version 3.5.

 -- プロパティ: IMAP4.file

     Internal *note BufferedReader: 15cb. associated with the underlying
     socket.  This property is documented for legacy purposes but not
     part of the public interface.  The caller is responsible to ensure
     that the current file is closed before changing it.

     バージョン 3.15 で非推奨、バージョン 3.19 で削除予定.

   ---------- 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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

 -- クラス: smtplib.SMTP (host='', port=0, local_hostname=None[,
          timeout], source_address=None)

     An *note SMTP: cfe. instance encapsulates an SMTP connection.  It
     has methods that support a full repertoire of SMTP and ESMTP
     operations.

     If the host parameter is set to a truthy value, *note
     SMTP.connect(): 1934. is called with host and port automatically
     when the object is created; otherwise, ‘connect()’ must be called
     manually.

     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(): 1d0b.  If the *note connect():
     1934. call returns anything other than a success code, an *note
     SMTPConnectError: 42ca. 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: c12. 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():
     120d. と *note SMTP.quit(): 42cb. メソッドを呼びます。使用例は先の
     方で記載しています。

     The *note SMTP: cfe. class supports the *note with: 215. 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: 1e84. ‘smtplib.SMTP.send’ を送出します。ここで ‘data’ はリモ
     ートホストに送信されるバイト数です。

      -- の属性: default_port

          The default port used for SMTP connections (25).

     バージョン 3.3 で変更: *note with: 215. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'source_address' argument was added.

     Added in version 3.5: SMTPUTF8 拡張 ( RFC 6531(4)) がサポートされま
     した。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 15a. を
     送出します。

 -- クラス: 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: cfe.  ‘SMTP_SSL’ should be used for situations where
     SSL is required from the beginning of the connection and using
     *note SMTP.starttls(): 14f9. is not appropriate.

     If the host parameter is set to a truthy value, *note
     SMTP.connect(): 1934. is called with host and port automatically
     when the object is created; otherwise, ‘SMTP.connect()’ must be
     called manually.

     The optional arguments 'local_hostname', 'timeout' and
     'source_address' have the same meaning as they do in the *note
     SMTP: cfe. class.  'context', also optional, can contain a *note
     SSLContext: 33e. and allows configuring various aspects of the
     secure connection.  Please read *note セキュリティで考慮すべき点:
     3aee. for best practices.

      -- の属性: default_port

          The default port used for SMTP-over-SSL connections (465).

     バージョン 3.3 で変更: 'context' が追加されました。

     バージョン 3.3 で変更: The 'source_address' argument was added.

     バージョン 3.4 で変更: このクラスは *note
     ssl.SSLContext.check_hostname: 3c23. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 3c35. を
     参照してください)。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 15a. を
     送出します。

     バージョン 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(): 1934. 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: cfe. 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: 543. の派生クラスで、このモジュールが提供する他の全
     ての例外の基底クラスです。

     バージョン 3.4 で変更: SMTPException が *note OSError: 543. の派生
     クラスになりました。

 -- 例外: smtplib.SMTPServerDisconnected

     この例外はサーバが突然接続が切断されるか、*note SMTP: cfe. インスタ
     ンスを生成する前に接続しようとした場合に送出されます。

 -- 例外: 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: 42cf. 例外に、 SMTPサーバが弾いた 'sender' ア
     ドレスの文字列がセットされます。

 -- 例外: smtplib.SMTPRecipientsRefused

     All recipient addresses refused.

      -- の属性: recipients

          A dictionary of exactly the same sort as returned by *note
          SMTP.sendmail(): 120d. 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/main/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: cfe. クラスインスタンスは次のメソッドを提供します:

 -- メソッド: SMTP.set_debuglevel (level)

     デバッグ出力レベルを設定します。'level' が 1 や ‘True’ の場合、接続
     ならびにサーバとの送受信のメッセージがデバッグメッセージとなります
     。'level' が 2 の場合、それらのメッセージにタイムスタンプが付きます
     。

     バージョン 3.5 で変更: デバッグレベル2が追加されました。

 -- メソッド: SMTP.docmd (cmd, args='')

     サーバへコマンド 'cmd' を送信します。オプション引数 'args' はスペー
     ス文字でコマンドに連結します。戻り値は、整数値のレスポンスコードと
     、サーバからの応答の値をタプルで返します (サーバからの応答が数行に
     渡る場合でも一つの大きな文字列で返します)。

     数値応答コードと実際の応答行 (複数の応答は 1 つの長い行に結合されま
     す) からなる 2 値タプルを返します。

     通常、このメソッドを明示的に使う必要はありません。他のメソッドを実
     装するのに使い、自分で拡張したものをテストするのに役立つかもしれま
     せん。

     応答待ちのときにサーバへの接続が切れると *note
     SMTPServerDisconnected: 42ce. が送出されます。

 -- メソッド: SMTP.connect (host='localhost', port=0)

     ホスト名とポート番号をもとに接続します。デフォルトはlocalhostの標準
     的なSMTPポート(25番)に接続します。もしホスト名の末尾がコロン
     (‘':'’)で、後に番号がついている場合は、「ホスト名:ポート番号」とし
     て扱われます。このメソッドはコンストラクタにホスト名及びポート番号
     が指定されている場合、自動的に呼び出されます。戻り値は、この接続の
     応答内でサーバによって送信された応答コードとメッセージの2要素タプル
     です。

     If port is not changed from its default value of 0, the value of
     the *note default_port: 42cc. attribute is used.

     引数 ‘self’, ‘host’, ‘port’ を指定して *note 監査イベント: 1e84.
     ‘smtplib.connect’ を送出します。

 -- メソッド: SMTP.helo (name='')

     SMTPサーバに ‘HELO’ コマンドで身元を示します。デフォルトでは
     hostname引数はローカルホストを指します。サーバーが返したメッセージ
     は、オブジェクトの *note helo_resp: 42dc. 属性に格納されます。

     通常は *note sendmail(): 120d. が呼びだすため、これを明示的に呼び出
     す必要はありません。

 -- メソッド: SMTP.ehlo (name='')

     ‘EHLO’ を利用し、ESMTPサーバに身元を明かします。デフォルトでは
     hostname引数はローカルホストのFQDNです。また、ESMTPオプションのため
     に応答を調べたものは、 *note has_extn(): 42de. に備えて保存されます
     。また、幾つかの情報を属性に保存します: サーバーが返したメッセージ
     は *note ehlo_resp: 42df. 属性に、 *note does_esmtp: 42e0. 属性はサ
     ーバーがESMTPをサポートしているかどうかによって ‘True’ か ‘False’ に
     、 *note esmtp_features: 42e1. 属性は辞書で、サーバーが対応している
     SMTP サービス拡張の名前と、もしあればそのパラメータを格納します。

     メールを送信する前に *note has_extn(): 42de. を使おうとしない限り、
     このメソッドを明示的に呼ぶ必要はないはずです。必要な場合は *note
     sendmail(): 120d. に暗黙的に呼ばれます。

 -- メソッド: SMTP.ehlo_or_helo_if_needed ()

     このメソッドは、現在のセッションでまだ ‘EHLO’ か ‘HELO’ コマンドが
     実行されていない場合、 *note ehlo(): 42dd. and/or *note helo():
     42db. メソッドを呼び出します。このメソッドは先に ESMTP ‘EHLO’ を試
     します。

     *note SMTPHeloError: 42d6.

          サーバーが ‘HELO’ に正しく返答しませんでした。

 -- メソッド: SMTP.has_extn (name)

     'name' が拡張SMTPサービスセットに含まれている場合には *note True:
     fd0. を返し、そうでなければ *note False: ef9. を返します。大小文字
     は区別されません。

 -- メソッド: 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: 42d6.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPAuthenticationError: 42d7.

          サーバがユーザ名/パスワードでの認証に失敗しました。

     *note SMTPNotSupportedError: 1fbe.

          ‘AUTH’ コマンドはサーバにサポートされていません。

     *note SMTPException: 134f.

          適当な認証方法が見付かりませんでした。

     Each of the authentication methods supported by ‘smtplib’ are tried
     in turn if they are advertised as supported by the server.  See
     *note auth(): 120b. 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: 1fbe. が送出さ
     れる場合があります。'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: 42e1.

     '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(): 42e4. 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(): 42dd.
     を呼んでください。

     If 'keyfile' and 'certfile' are provided, they are used to create
     an *note ssl.SSLContext: 33e.

     Optional 'context' parameter is an *note ssl.SSLContext: 33e.
     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: 42d6.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPNotSupportedError: 1fbe.

          サーバーが STARTTLS 拡張に対応していません。

     *note RuntimeError: 317.

          実行中の Python インタプリタで、SSL/TLS サポートが利用できませ
          ん。

     バージョン 3.3 で変更: 'context' が追加されました。

     バージョン 3.4 で変更: The method now supports hostname check with
     *note ssl.SSLContext.check_hostname: 3c23. and 'Server Name
     Indicator' (see *note HAS_SNI: 3c35.).

     バージョン 3.5 で変更: The error raised for lack of STARTTLS
     support is now the *note SMTPNotSupportedError: 1fbe. subclass
     instead of the base *note SMTPException: 134f.

 -- メソッド: 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: 42d3.

          All recipients were refused.  Nobody got the mail.

     *note SMTPHeloError: 42d6.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPSenderRefused: 42d2.

          サーバが 'from_addr' を受理しませんでした。

     *note SMTPDataError: 42d5.

          サーバが予期しないエラーコードを返しました (受信拒否以外)。

     *note SMTPNotSupportedError: 1fbe.

          'mail_options' に ‘SMTPUTF8’ が与えられましたが、サーバがサポ
          ートしていません。

     また、この他の注意として、例外が上がった後もコネクションは開いたま
     まになっています。

     バージョン 3.2 で変更: 'msg' はバイト文字列でも構いません。

     バージョン 3.5 で変更: ‘SMTPUTF8’ のサポートが追加されました。
     ‘SMTPUTF8’ が与えられたが、サーバがサポートしていない場合は *note
     SMTPNotSupportedError: 1fbe. が送出されます。

 -- メソッド: SMTP.send_message (msg, from_addr=None, to_addrs=None,
          mail_options=(), rcpt_options=())

     This is a convenience method for calling *note sendmail(): 120d.
     with the message represented by an *note email.message.Message:
     786. 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: 15a. is
     raised, since there is no way to unambiguously detect the most
     recent set of ‘Resent-’ headers.

     ‘send_message’ serializes 'msg' using *note BytesGenerator: 158d.
     with ‘\r\n’ as the 'linesep', and calls *note sendmail(): 120d. 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: 1fbe. is raised.  Otherwise the
     ‘Message’ is serialized with a clone of its *note policy: 52. with
     the *note utf8: 222. 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(): 42db.

 -- の属性: SMTP.ehlo_resp

     The response to the ‘EHLO’ command, see *note ehlo(): 42dd.

 -- の属性: SMTP.does_esmtp

     A boolean value indicating whether the server supports ESMTP, see
     *note ehlo(): 42dd.

 -- の属性: SMTP.esmtp_features

     A dictionary of the names of SMTP service extensions supported by
     the server, see *note ehlo(): 42dd.

   ---------- 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: 3e. パッケージの機能を使って email
     メッセージを構築し、それを、 *note send_message(): 120e. で送信する
     、という手順を用います。 *note email; 使用例: 12ec. を参照してくだ
     さい。

   ---------- 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: e29. objects (the ‘UUID’
class) and *note functions: 42ea. for generating UUIDs corresponding to
a specific UUID version as specified in RFC 9562(2) (which supersedes
RFC 4122(3)), for example, *note uuid1(): f6b. for UUID version 1, *note
uuid3(): 568. 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(): f6b. か
*note uuid4(): 56a. を呼び出せば良いでしょう。 ‘uuid1()’ はコンピュータ
のネットワークアドレスを含む UUID を生成するためにプライバシーを侵害する
かもしれない点に注意してください。 ‘uuid4()’ はランダムな UUID を生成し
ます。

Depending on support from the underlying platform, *note uuid1(): f6b.
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: e29. have an *note
is_safe: f69. 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: 42ef. 属性の比較によ
     って行われます。UUIDではないオブジェクトとの比較は、 *note
     TypeError: 29c. を送出します。

     ‘str(uuid)’ は 32桁の16進でUUIDを表す
     ''12345678-1234-5678-1234-567812345678'' 形式の文字列を返します。

*note UUID: e29. インスタンスは以下の読み出し専用属性を持ちます:

 -- の属性: 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: 42fd, *note RFC_4122: 42fe, *note RESERVED_MICROSOFT:
     42ff, *note RESERVED_FUTURE: 4300. のいずれかです。

 -- の属性: UUID.version

     The UUID version number (1 through 8, meaningful only when the
     variant is *note RFC_4122: 42fe.).

     バージョン 3.14 で変更: Added UUID versions 6, 7 and 8.

 -- の属性: UUID.is_safe

     *note SafeUUID: 42eb. の列挙で、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(): f6a. 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: 1d2. 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: 1d2. 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(): f6b. to improve database
     locality.

     When 'node' is not specified, *note getnode(): f6a. 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(): 56a. 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(): 568. or *note uuid5(): 569.

 -- データ: 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: 42fc. 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/main/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(): 56a. 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(): 568.
     / *note uuid5(): 569. functions.

 -- Option: -N <name>
 -- Option: --name <name>

     The name used as part of generating the uuid.  Only required for
     *note uuid3(): 568. / *note uuid5(): 569. 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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

基本的な具象サーバクラスが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(): 4317. and *note server_activate():
     4318.  The other parameters are passed to the *note BaseServer:
     14fe. base class.

     バージョン 3.15 で変更: The default queue size is now
     ‘socket.SOMAXCONN’ for *note socketserver.TCPServer: 16d9.

 -- クラス: 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: 16d9.

 -- クラス: 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: 16d9.

これらの 4 つのクラスは要求を '同期的に (synchronously)' 処理します; 各
要求は次の要求を開始する前に完結していなければなりません。同期的な処理は
、サーバで大量の計算を必要とする、あるいはクライアントが処理するには時間
がかかりすぎるような大量のデータを返す、といった理由によってリクエストに
長い時間がかかる状況には向いていません。こうした状況の解決方法は別のプロ
セスを生成するか、個々の要求を扱うスレッドを生成することです; *note
ForkingMixIn: f3b. および *note ThreadingMixIn: f05. 配合クラス (mix-in
classes) を使えば、非同期的な動作をサポートできます。

サーバの作成にはいくつかのステップが必要です。最初に、 *note
BaseRequestHandler: 431c. クラスをサブクラス化して要求処理クラス
(request hander class) を生成し、その *note handle(): 431d. メソッドをオ
ーバーライドしなければなりません; このメソッドは入力される要求を処理しま
す。次に、サーバクラスのうち一つを、サーバのアドレスと要求処理クラスを渡
してインスタンス化しなければなりません。サーバを *note with: 215. 文中で
使うことが推奨されます。そして、*note handle_request(): 16dc. または
*note serve_forever(): 1500. メソッドを呼び出して、一つのまたは多数の要
求を処理します。最後に、(‘with’ 文を使っていなかったなら) *note
server_close(): f39. を呼び出してソケットを閉じます。

*note ThreadingMixIn: f05. から継承してスレッドを利用した接続を行う場合
、突発的な通信切断時の処理を明示的に指定する必要があります。
‘ThreadingMixIn’ クラスには 'daemon_threads' 属性があり、サーバがスレッ
ドの終了を待ち合わせるかどうかを指定する事ができます。スレッドが独自の処
理を行う場合は、このフラグを明示的に指定します。デフォルトは *note
False: ef9. で、Pythonは ‘ThreadingMixIn’ クラスが起動した全てのスレッド
が終了するまで実行し続けます。

サーバクラス群は使用するネットワークプロトコルに関わらず、同じ外部メソッ
ドおよび属性を持ちます。

* Menu:

* サーバ生成に関するノート::
* Serverオブジェクト::
* Request Handler Objects::
* 使用例: 使用例<40>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/socketserver.py


File: python.info,  Node: サーバ生成に関するノート,  Next: Serverオブジェクト,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.23.16.1 サーバ生成に関するノート
..................................

継承図にある五つのクラスのうち四つは四種類の同期サーバを表わしています:

     +------------+
     | BaseServer |
     +------------+
           |
           v
     +-----------+        +------------------+
     | TCPServer |------->| UnixStreamServer |
     +-----------+        +------------------+
           |
           v
     +-----------+        +--------------------+
     | UDPServer |------->| UnixDatagramServer |
     +-----------+        +--------------------+

*note UnixDatagramServer: 431b. は *note UDPServer: 4319. から派生してい
て、 *note UnixStreamServer: 431a. からではないことに注意してください --
IP と Unix サーバの唯一の違いはアドレスファミリーです。

 -- クラス: socketserver.ForkingMixIn
 -- クラス: socketserver.ThreadingMixIn

     それぞれのタイプのサーバのフォークしたりスレッド実行したりするバー
     ジョンはそれらのミクシン(mix-in)クラスを使って作ることができます。
     たとえば、*note ThreadingUDPServer: 431f. は以下のようにして作られ
     ます:

          class ThreadingUDPServer(ThreadingMixIn, UDPServer):
              pass

     ミクシンクラスは *note UDPServer: 4319. で定義されるメソッドをオー
     バライドするために、最初に来ます。様々な属性を設定することで元にな
     るサーバ機構の振る舞いを変えられます。

     ‘ForkingMixIn’ and the Forking classes mentioned below are only
     available on POSIX platforms that support *note fork(): 6c3.

      -- の属性: block_on_close

          *note ForkingMixIn.server_close: f39. waits until all child
          processes complete, except if *note block_on_close: f3a.
          attribute is ‘False’.

          *note ThreadingMixIn.server_close: f39. waits until all
          non-daemon threads complete, except if *note block_on_close:
          f3a. 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: 4321. to ‘True’ to not wait
          until threads complete.

     バージョン 3.7 で変更: *note ForkingMixIn.server_close: f39. and
     ‘ThreadingMixIn.server_close’ now waits until all child processes
     and non-daemonic threads complete.  Add a new *note
     ForkingMixIn.block_on_close: f3a. 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: 431c. からクラスを派生さ
せてその *note handle(): 431d. メソッドを再定義しなければなりません。こ
のようにすれば、サーバクラスと要求処理クラスを結合して様々なバージョンの
サービスを実行することができます。要求処理クラスはデータグラムサービスか
ストリームサービスかで異なることでしょう。この違いは処理サブクラス *note
StreamRequestHandler: 109c. または *note DatagramRequestHandler: 4329. を
使うという形で隠蔽できます。

もちろん、まだ頭を使わなければなりません!  たとえば、サービスがリクエス
トによっては書き換えられるようなメモリ上の状態を使うならば、フォークする
サーバを使うのは馬鹿げています。というのも子プロセスでの書き換えは親プロ
セスで保存されている初期状態にも親プロセスから分配される各子プロセスの状
態にも届かないからです。この場合、スレッド実行するサーバを使うことはでき
ますが、共有データの一貫性を保つためにロックを使わなければならなくなるで
しょう。

一方、全てのデータが外部に(たとえばファイルシステムに)保存される HTTP サ
ーバを作っているのだとすると、同期クラスではどうしても一つの要求が処理さ
れている間サービスが「耳の聞こえない」状態を呈することになります -- この
状態はもしクライアントが要求した全てのデータをゆっくり受け取るととても長
い時間続きかねません。こういう場合にはサーバをスレッド実行したりフォーク
することが適切です。

ある場合には、要求の一部を同期的に処理する一方で、要求データに依って子プ
ロセスをフォークして処理を終了させる、といった方法も適当かもしれません。
こうした処理方法は同期サーバを使って要求処理クラスの *note handle():
431d. メソッドの中で自分でフォークするようにして実装することができます。

Another approach to handling multiple simultaneous requests in an
environment that supports neither threads nor *note fork(): 6c3. (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: ca. 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: 432b. and *note
     RequestHandlerClass: 432c. attributes.

      -- メソッド: fileno ()

          サーバが要求待ちを行っているソケットのファイル記述子を整数で返
          します。この関数は一般的に、同じプロセス中の複数のサーバを監視
          できるようにするために、 *note selectors: ca. に渡されます。

      -- メソッド: handle_request ()

          単一の要求を処理します。この関数は以下のメソッド: *note
          get_request(): 432e. 、 *note verify_request(): 432f. 、および
          *note process_request(): 4330. を順番に呼び出します。ハンドラ
          中でユーザによって提供された *note handle(): 431d. が例外を送
          出した場合、サーバの *note handle_error(): 10fc. メソッドが呼
          び出されます。 *note timeout: 16da. 秒以内にリクエストが来なか
          った場合、 *note handle_timeout(): 16db. が呼ばれて、 *note
          handle_request(): 16dc. が終了します。

      -- メソッド: serve_forever (poll_interval=0.5)

          Handle requests until an explicit *note shutdown(): 2023.
          request.  Poll for shutdown every 'poll_interval' seconds.
          Ignores the *note timeout: 16da. attribute.  It also calls
          *note service_actions(): 14ff, which may be used by a subclass
          or mixin to provide actions specific to a given service.  For
          example, the *note ForkingMixIn: f3b. 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(): 1500. 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(): 1500. 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: 1dc6, *note
          socket.AF_INET6: 1dc7, and *note socket.AF_UNIX: 1dc9.
          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: d4. モジュー
          ルを参照してください。インターネットプロトコルでは、この値は例
          えば ‘('127.0.0.1', 80)’ のようにアドレスを与える文字列と整数
          のポート番号を含むタプルです。

      -- の属性: socket

          サーバが入力の要求待ちを行うためのソケットオブジェクトです。

     サーバクラスは以下のクラス変数をサポートします:

      -- の属性: allow_reuse_address

          サーバがアドレスの再使用を許すかどうかを示す値です。この値は標
          準で *note False: ef9. で、サブクラスで再使用ポリシを変更する
          ために設定することができます。

      -- の属性: request_queue_size

          要求待ち行列 (queue) のサイズです。単一の要求を処理するのに長
          時間かかる場合には、サーバが処理中に届いた要求は最大 *note
          request_queue_size: 4334. 個まで待ち行列に置かれます。待ち行列
          が一杯になると、それ以降のクライアントからの要求は "接続拒否
          (Connection denied)" エラーになります。標準の値は通常 5 ですが
          、この値はサブクラスで上書きすることができます。

      -- の属性: socket_type

          サーバが使うソケットの型です; 一般的な2つの値は、 *note
          socket.SOCK_STREAM: 16ad. と *note socket.SOCK_DGRAM: 16ac. で
          す。

      -- の属性: timeout

          タイムアウト時間(秒)、もしくは、タイムアウトを望まない場合に
          *note None: a6a. 。 *note handle_request(): 16dc. がこの時間内
          にリクエストを受信しない場合、 *note handle_timeout(): 16db. メ
          ソッドが呼ばれます。

     *note TCPServer: 16d9. のような基底クラスのサブクラスで上書きできる
     サーバメソッドは多数あります; これらのメソッドはサーバオブジェクト
     の外部のユーザにとっては役にたたないものです。

      -- メソッド: finish_request (request, client_address)

          *note RequestHandlerClass: 432c. をインスタンス化し、 *note
          handle(): 431d. メソッドを呼び出して、実際に要求を処理します。

      -- メソッド: get_request ()

          ソケットから要求を受理して、クライアントとの通信に使われる '新
          しい' ソケットオブジェクト、およびクライアントのアドレスからな
          る、2 要素のタプルを返します。

      -- メソッド: handle_error (request, client_address)

          この関数は *note RequestHandlerClass: 432c. インスタンスの
          *note handle(): 431d. メソッドが例外を送出した際に呼び出されま
          す。標準の動作では標準エラー出力へトレースバックを出力し、後続
          する要求を継続して処理します。

          バージョン 3.6 で変更: Now only called for exceptions derived
          from the *note Exception: da2. class.

      -- メソッド: handle_timeout ()

          この関数は *note timeout: 16da. 属性が *note None: a6a. 以外に
          設定されて、リクエストがないままタイムアウト秒数が過ぎたときに
          呼ばれます。 fork型サーバーでのデフォルトの動作は、終了した子
          プロセスの情報を集めるようになっています。スレッド型サーバーで
          はこのメソッドは何もしません。

      -- メソッド: process_request (request, client_address)

          *note finish_request(): 4336. を呼び出して、 *note
          RequestHandlerClass: 432c. のインスタンスを生成します。必要な
          ら、この関数から新たなプロセスかスレッドを生成して要求を処理す
          ることができます; その処理は *note ForkingMixIn: f3b. または
          *note ThreadingMixIn: f05. クラスが行います。

      -- メソッド: server_activate ()

          Called by the server's constructor to activate the server.
          The default behavior for a TCP server just invokes *note
          listen(): 1212. on the server's socket.  May be overridden.

      -- メソッド: server_bind ()

          サーバのコンストラクタによって呼び出され、適切なアドレスにソケ
          ットをバインドします。このメソッドは上書きできます。

      -- メソッド: verify_request (request, client_address)

          ブール値を返さなければなりません; 値が *note True: fd0. の場合
          には要求が処理され、 *note False: ef9. の場合には要求は拒否さ
          れます。サーバへのアクセス制御を実装するためにこの関数を上書き
          することができます。標準の実装では常に ‘True’ を返します。

     バージョン 3.6 で変更: *note context manager: 47f. プロトコルのサポ
     ートが追加されました。コンテキストマネージャを終了することは、
     *note server_close(): f39. を呼ぶことと同一です。


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(): 431d. method, and can override
     any of the other methods.  A new instance of the subclass is
     created for each request.

      -- メソッド: setup ()

          *note handle(): 431d. メソッドより前に呼び出され、何らかの必要
          な初期化処理を行います。標準の実装では何も行いません。

      -- メソッド: 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: 4339.; the client address as *note
          client_address: 433a.; and the server instance as *note
          server: 433b, in case it needs access to per-server
          information.

          The type of *note request: 4339. 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(): 431d. メソッドより後に呼び出され、何らかの必要
          なクリーンアップ処理を行います。標準の実装では何も行いません。
          *note setup(): 4338. メソッドが例外を送出した場合、このメソッ
          ドは呼び出されません。

      -- の属性: request

          The 'new' *note socket.socket: 115e. object to be used to
          communicate with the client.

      -- の属性: client_address

          Client address returned by *note BaseServer.get_request():
          432e.

      -- の属性: server

          *note BaseServer: 14fe. object used for handling the request.

 -- クラス: socketserver.StreamRequestHandler
 -- クラス: socketserver.DatagramRequestHandler

     These *note BaseRequestHandler: 431c. subclasses override the *note
     setup(): 4338. and *note finish(): 433c. methods, and provide *note
     rfile: 433d. and *note wfile: 109b. attributes.

      -- の属性: rfile

          A file object from which receives the request is read.
          Support the *note io.BufferedIOBase: a88. readable interface.

      -- の属性: wfile

          A file object to which the reply is written.  Support the
          *note io.BufferedIOBase: a88. writable interface

     バージョン 3.6 で変更: *note wfile: 109b. also supports the *note
     io.BufferedIOBase: a88. 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:
f05. か *note ForkingMixIn: f3b. クラスを利用します。

*note ThreadingMixIn: f05. クラスの利用例:

     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: f3b. クラスは同じように利用することができます。この
場合、サーバーはリクエスト毎に新しいプロセスを作成します。*note fork():
6c3. をサポートする 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: 4345.

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

クラス *note HTTPServer: 4141. は *note socketserver.TCPServer: 16d9. の
サブクラスです。 ‘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: 16d9. クラスの上に構築されており、サ
     ーバのアドレスをインスタンス変数 ‘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: f05.  This is useful to
     handle web browsers pre-opening sockets, on which *note HTTPServer:
     4141. 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: 4141. with a wrapped socket using the
     *note ssl: d8. module.  If the ‘ssl’ module is not available,
     instantiating a ‘HTTPSServer’ object fails with a *note
     RuntimeError: 317.

     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(): 79d. 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: 4bd. but uses threads
     to handle requests by inheriting from *note ThreadingMixIn: f05.
     This is analogous to *note ThreadingHTTPServer: f04. only using
     ‘HTTPSServer’.

     Added in version 3.14.

The *note HTTPServer: 4141, *note ThreadingHTTPServer: f04, *note
HTTPSServer: 4bd. and *note ThreadingHTTPSServer: 4346. 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: 231. は以下のインスタンス変数を持って
     います:

      -- の属性: client_address

          HTTP クライアントのアドレスを参照している、‘(host, port)’ の形
          式をとるタプルが入っています。

      -- の属性: server

          server インスタンスが入っています。

      -- の属性: close_connection

          *note handle_one_request(): 434a. が返る前に設定すべき真偽値で
          、別のリクエストが期待されているかどうか、もしくはコネクション
          を切断すべきかどうかを指し示しています。

      -- の属性: requestline

          HTTP リクエスト行の文字列表現を保持しています。 末尾の CRLF は
          除去されています。 この属性は *note handle_one_request():
          434a. によって設定されるべきです。 妥当なリクエスト行が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: 434f. class variable.  This instance parses and
          manages the headers in the HTTP request.  The *note
          parse_headers(): 2034. function from *note http.client: 72. 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: a88. 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:
          a88. stream.

     *note BaseHTTPRequestHandler: 231. は以下の属性を持っています:

      -- の属性: server_version

          サーバのソフトウェアバージョンを指定します。この値は上書きする
          必要が生じるかもしれません。書式は複数の文字列を空白で分割した
          もので、各文字列はソフトウェア名[/バージョン] の形式をとります
          。例えば、‘'BaseHTTP/0.2'’ です。

      -- の属性: sys_version

          Python 処理系のバージョンが, *note version_string: 4354. メソ
          ッドや *note server_version: 4352. クラス変数で利用可能な形式
          で入っています。例えば ‘'Python/1.4'’ です。

      -- の属性: error_message_format

          Specifies a format string that should be used by *note
          send_error(): 12ff. method for building an error response to
          the client.  The string is filled by default with variables
          from *note responses: 420a. 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():
          4357.) in all of its responses to clients.  For backwards
          compatibility, the setting defaults to ‘'HTTP/1.0'’.

      -- の属性: MessageClass

          HTTP ヘッダを解釈するための *note email.message.Message: 786.
          類似のクラスを指定します。 通常この値が上書きされることはなく
          、デフォルトの *note http.client.HTTPMessage: 4223. になってい
          ます。

      -- の属性: 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(): 4358. and *note
          send_error(): 12ff. methods.

     *note BaseHTTPRequestHandler: 231. インスタンスは以下のメソッドを持
     っています:

      -- メソッド: handle ()

          Calls *note handle_one_request(): 434a. 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: 1300. attribute and
          emitted, after a complete set of headers, as the response
          body.  The *note responses: 420a. 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(): 4354. and *note date_time_string(): 435c.
          methods, respectively.  If the server does not intend to send
          any other headers using the *note send_header(): 4357. method,
          then ‘send_response()’ should be followed by an *note
          end_headers(): 148c. call.

          バージョン 3.3 で変更: Headers are stored to an internal
          buffer and *note end_headers(): 148c. 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():
          148c. or *note flush_headers(): 148d. 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(): 148d.

          バージョン 3.2 で変更: バッファされたヘッダは出力ストリームに
          書き出されます。

      -- メソッド: flush_headers ()

          最終的にヘッダを出力ストリームに送り、内部ヘッダバッファをフラ
          ッシュします。

          Added in version 3.3.

      -- メソッド: log_request (code='-', size='-')

          受理された (成功した) リクエストをログに記録します。'code' に
          はこの応答に関連付けられた HTTP コード番号を指定します。応答メ
          ッセージの大きさを知ることができる場合、'size' パラメタに渡す
          とよいでしょう。

      -- メソッド: log_error (...)

          リクエストを遂行できなかった際に、エラーをログに記録します。標
          準では、メッセージを *note log_message(): 435f. に渡します。従
          って同じ引数 ('format' と追加の値) を取ります。

      -- メソッド: log_message (format, ...)

          任意のメッセージを ‘sys.stderr’ にログ記録します。このメソッド
          は通常、カスタムのエラーログ記録機構を作成するために上書きされ
          ます。 'format' 引数は標準の printf 形式の書式文字列で、 *note
          log_message(): 435f. に渡された追加の引数は書式化の入力として
          適用されます。ログ記録される全てのメッセージには、クライアント
          の IP アドレスおよび現在の日付、時刻が先頭に付けられます。

      -- メソッド: version_string ()

          サーバーのソフトウェアのバージョンを示す文字列を返します。 そ
          の文字列は、*note server_version: 4352. と *note sys_version:
          4353. の属性が含まれます。

      -- メソッド: date_time_string (timestamp=None)

          メッセージヘッダ向けに書式化された、 'timestamp' (‘None’ また
          は *note time.time(): 764. のフォーマットである必要があります
          )で与えられた日時を返します。もし '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,
          extra_response_headers=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: 7a5.

     バージョン 3.15 で変更: Added 'extra_response_headers' parameter.

     リクエストの解釈のような、多くの作業は基底クラス *note
     BaseHTTPRequestHandler: 231. で行われます。このクラスは関数 *note
     do_GET(): 4362. および *note do_HEAD(): 4363. を実装しています。

     *note SimpleHTTPRequestHandler: 235. では以下のメンバ変数を定義して
     います:

      -- の属性: server_version

          この値は ‘"SimpleHTTP/" + __version__’ になります。
          ‘__version__’ はこのモジュールで定義されている値です。

      -- の属性: default_content_type

          Specifies the Content-Type header value sent when the MIME
          type cannot be guessed from the file extension of the
          requested URL. By default, it is set to
          ‘'application/octet-stream'’.

          Added in version 3.15.

      -- の属性: 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.

      -- の属性: extra_response_headers

          A sequence of ‘(name, value)’ pairs containing user-defined
          extra HTTP response headers to add to each successful HTTP
          status 200 response.  These headers are not included in other
          status code responses.

          Headers that the server sends automatically such as
          ‘Content-Type’ will not be overwritten by
          ‘extra_response_headers’.

     *note SimpleHTTPRequestHandler: 235. では以下のメソッドを定義してい
     ます:

      -- メソッド: do_HEAD ()

          このメソッドは ‘'HEAD'’ 型のリクエスト処理を実行します: すなわ
          ち、 ‘GET’ リクエストの時に送信されるものと同じヘッダを送信し
          ます。送信される可能性のあるヘッダについての完全な説明は *note
          do_GET(): 4362. メソッドを参照してください。

      -- メソッド: do_GET ()

          リクエストを現在の作業ディレクトリからの相対的なパスとして解釈
          することで、リクエストをローカルシステム上のファイルと対応付け
          ます。

          リクエストがディレクトリに対応付けられた場合、 ‘index.html’ ま
          たは ‘index.htm’ を (この順序で) チェックします。もしファイル
          を発見できればその内容を、そうでなければディレクトリ一覧を
          ‘list_directory()’ メソッドで生成して、返します。このメソッド
          は *note os.listdir(): 14bb. をディレクトリのスキャンに用いて
          おり、 ‘listdir()’ が失敗した場合には ‘404’ 応答が返されます。

          If the request was mapped to a file, it is opened.  Any *note
          OSError: 543. 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:'’ ヘッダが続きます。

          The instance attribute *note extra_response_headers: 4366. is
          a sequence of ‘(name, value)’ pairs containing user-defined
          extra response headers.

          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: 235. 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: 235. can also be subclassed to enhance
behavior, such as using different index file names by overriding the
class attribute ‘index_pages’.

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<7>.
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<5>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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/main/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: 4d1.
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: --content-type <content_type>

     Specifies the default Content-Type HTTP header used when the MIME
     type cannot be guessed from the URL's file extension.  By default,
     the server uses ‘'application/octet-stream'’:

          python -m http.server --content-type text/html

     Added in version 3.15.

 -- 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.

 -- Option: -H, --header <header> <value>

     Specify an additional extra HTTP Response Header to send on
     successful HTTP 200 responses.  Can be used multiple times to send
     additional custom response headers.  Headers that are sent
     automatically by the server (for instance Content-Type) will not be
     overwritten by the server.

     Added in version 3.15.


File: python.info,  Node: セキュリティで考慮すべき点<5>,  Prev: コマンドライン・インターフェース<7>,  Up: http server --- HTTP サーバー

5.23.17.2 セキュリティで考慮すべき点
....................................

*note SimpleHTTPRequestHandler: 235. 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(): 4357. and *note
BaseHTTPRequestHandler.send_response_only(): 4358. 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: 231. ‘.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: 167d. 、 *note string.digits: 2954.
、 ‘!#$%&'*+-.^_`|~:’ を、このモジュールは cookie 名 (*note key: fc4.) と
して有効と認めています。

バージョン 3.3 で変更: ':' が有効な cookie 名の文字として認められました
。

     注釈: 不正な cookie に遭遇した場合、 *note CookieError: 4374. 例外
     を送出します。そのため、ブラウザから持ってきた cookie データをパー
     スするときには常に不正なデータに備え ‘CookieError’ 例外を捕捉してく
     ださい。

 -- 例外: http.cookies.CookieError

     属性や ‘Set-Cookie’ ヘッダが正しくないなど、 RFC 2109(4) に合致して
     いないときに発生する例外です。

 -- クラス: http.cookies.BaseCookie ([input])

     このクラスはキーが文字列、値が *note Morsel: fc7. インスタンスで構
     成される辞書風オブジェクトです。値に対するキーを設定するときは、値
     がキーと値を含む ‘Morsel’ に変換されることに注意してください。

     'input' が与えられたときは、そのまま *note load(): 4376. メソッドへ
     渡されます。

 -- クラス: http.cookies.SimpleCookie ([input])

     このクラスは *note BaseCookie: 4375. を継承し、 *note
     value_decode(): 4377. と *note value_encode(): 4378. をオーバーライ
     ドします。 ‘SimpleCookie’ は文字列と cookie 値をサポートします。値
     を設定するとき、 ‘SimpleCookie’ は組み込みの *note str(): 1ea. を呼
     び出して値を文字列に変換します。HTTP から受け取った値は文字列として
     保持されます。

参考
....

モジュール *note http.cookiejar: 73.

     HTTP cookie handling for web 'clients'.  The *note http.cookiejar:
     73. 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/main/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: 4375. においてデコードを行わず、オーバーライドさ
     れるためにだけ存在します。

 -- メソッド: BaseCookie.value_encode (val)

     タプル ‘(real_value, coded_value)’ を返します。 'val' の型はどのよ
     うなものでも許容されますが、 ‘coded_value’ は常に文字列に変換されま
     す。このメソッドは *note BaseCookie: 4375. においてエンコードを行わ
     ず、オーバーライドされるためにだけ存在します。

     通常 *note value_encode(): 4378. と *note value_decode(): 4377. は
     ともに '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: fc7.'s *note
     output(): 302. 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(): 303. と同じです。

     バージョン 3.15 で非推奨、バージョン 3.19 で削除予定: This method
     generates a JavaScript snippet to set cookies in the browser, which
     is no longer considered a standard or recommended approach.  Use
     *note output(): 303. instead to generate HTTP headers.

 -- メソッド: BaseCookie.load (rawdata)

     'rawdata' が文字列であれば、 ‘HTTP_COOKIE’ として処理し、その値を
     *note Morsel: fc7. として追加します。辞書の場合は次と同様の処理をお
     こないます。

          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: 1789. 属性は、 cookie が HTTP リクエストでのみ送信
     されて、 JavaScript からのはアクセスできない事を示します。これはい
     くつかのクロスサイトスクリプティングの脅威を和らげることを意図して
     います。

     The attribute *note samesite: 4383. 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: 4384. 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: fc4. 及び *note
     value: fc5. を考慮するようになりました。

     バージョン 3.7 で変更: *note key: fc4. と *note value: fc5. 、
     *note coded_value: fc6. 属性は読み出し専用です。設定には、 *note
     set(): fc8. を使用してください。

     バージョン 3.8 で変更: *note samesite: 4383. 属性がサポートされまし
     た。

     バージョン 3.14 で変更: Added support for the *note partitioned:
     4384. 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: fc7. のキーであるかどうかを判定します。

 -- メソッド: 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(): 302. と同じです。

     バージョン 3.15 で非推奨、バージョン 3.19 で削除予定: This method
     generates a JavaScript snippet to set cookies in the browser, which
     is no longer considered a standard or recommended approach.  Use
     *note output(): 302. instead to generate HTTP headers.

 -- メソッド: Morsel.OutputString (attrs=None)

     Moselの文字列表現をHTTPやJavaScriptで囲まずに出力します。

     'attrs' の意味は *note output(): 302. と同じです。

 -- メソッド: 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(): 1430. と同じように振る舞います。

   ---------- 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: 438e. インスタンスがファイルからク
     ッキーを読み込むのに失敗した場合に発生します。 *note LoadError:
     438d. は *note OSError: 543. のサブクラスです。

     バージョン 3.3 で変更: *note LoadError: 438d. は以前は *note
     IOError: 1409. のサブタイプでしたが、 *note OSError: 543. のエイリ
     アスになりました。

以下のクラスが提供されています:

 -- クラス: http.cookiejar.CookieJar (policy=None)

     'policy' は *note CookiePolicy: 438f. インターフェイスを実装するオ
     ブジェクトです。

     *note CookieJar: 41ae. クラスには HTTP クッキーを保管します。これは
     HTTP リクエストに応じてクッキーを取り出し、それを HTTP レスポンスの
     中で返します。必要に応じて、 ‘CookieJar’ インスタンスは保管されてい
     るクッキーを自動的に破棄します。このサブクラスは、クッキーをファイ
     ルやデータベースに格納したり取り出したりする操作をおこなう役割を負
     っています。

 -- クラス: http.cookiejar.FileCookieJar (filename=None, delayload=None,
          policy=None)

     'policy' は *note CookiePolicy: 438f. インターフェイスを実装するオ
     ブジェクトです。これ以外の引数については、該当する属性の説明を参照
     してください。

     *note FileCookieJar: 438e. はディスク上のファイルからのクッキーの読
     み込み、もしくは書き込みをサポートします。実際には、 *note load():
     4390. または *note revert(): 4391. のどちらかのメソッドが呼ばれるま
     でクッキーは指定されたファイルからはロード 'されません' 。このクラ
     スのサブクラスは *note FileCookieJar のサブクラスと web
     ブラウザとの連携: 4392. 節で説明します。

     これは直接初期化されるべきではありません。以下のサブクラスを代わり
     に使用してください。

     バージョン 3.8 で変更: 'filename' 引数が *note path-like object:
     7a5. を受け付けるようになりました。

 -- クラス: 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: a6a. でない場合、クッキーを受けと
     り、返すのはこのシーケンスのドメインに限定されます。
     'secure_protocols' は、安全なクッキーを追加できるプロトコルのシーケ
     ンスです。デフォルトでは、 'https' と 'wss' (secure websocket) が安
     全なプロトコルとみなされます。これ以外の引数については *note
     CookiePolicy: 438f. および *note DefaultCookiePolicy: 2002. オブジ
     ェクトの説明をごらんください。

     *note DefaultCookiePolicy: 2002. は Netscape および RFC 2965(4) ク
     ッキーの標準的な許可 / 拒絶のルールを実装しています。デフォルトでは
     、 RFC 2109(5) のクッキー (‘Set-Cookie’ の version クッキー属性が 1
     で受けとられるもの) は RFC 2965 のルールで扱われます。しかし、RFC
     2965 処理が無効に設定されているか *note rfc2109_as_netscape: 4393.
     が ‘True’ の場合、RFC 2109 クッキーは *note CookieJar: 41ae. インス
     タンスによって *note Cookie: 4394. のインスタンスの ‘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: 41ae. instance.

参考
....

*note urllib.request: 114. モジュール

     クッキーの自動処理をおこない URL を開くモジュールです。

*note http.cookies: 74. モジュール

     HTTP cookie classes, principally useful for server-side code.  The
     ‘http.cookiejar’ and *note http.cookies: 74. 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/main/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: 41ae. オブジェクトは保管されている *note Cookie: 4394.
オブジェクトをひとつずつ取り出すための、 *note イテレータ: 6d4. プロトコ
ルをサポートしています。

*note CookieJar: 41ae. は以下のようなメソッドを持っています:

 -- メソッド: CookieJar.add_cookie_header (request)

     'request' に正しい ‘Cookie’ ヘッダを追加します。

     ポリシーが許すようであれば (*note CookieJar: 41ae. の *note
     CookiePolicy: 438f. インスタンスにある属性のうち、 ‘rfc2965’ および
     ‘hide_cookie2’ がそれぞれ真と偽であるような場合)、必要に応じて
     ‘Cookie2’ ヘッダも追加されます。

     'request' オブジェクト (通常は *note urllib.request.Request: 1386.
     インスタンス) は、 *note urllib.request: 114. のドキュメントに記さ
     れているように、メソッド ‘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: 41ae. 内に保管します。

     *note CookieJar: 41ae. は 'response' 引数の中から許可されている
     ‘Set-Cookie’ および ‘Set-Cookie2’ ヘッダを探しだし、適切に (*note
     CookiePolicy.set_ok(): 4399. メソッドの承認におうじて) クッキーを保
     管します。

     'response' オブジェクト (通常は *note urllib.request.urlopen():
     586. あるいはそれに類似する呼び出しによって得られます) は ‘info()’
     メソッドをサポートしている必要があります。これは *note
     email.message.Message: 786. メソッドのあるオブジェクトを返すもので
     す。

     'request' オブジェクト (通常は *note urllib.request.Request: 1386.
     インスタンス) は *note urllib.request: 114. のドキュメントに記され
     ているように、メソッド ‘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: 438f. インスタンスを指定します。

 -- メソッド: CookieJar.make_cookies (response, request)

     'response' オブジェクトから得られた *note Cookie: 4394. オブジェク
     トからなるシーケンスを返します。

     'response' および 'request' 引数で要求されるインスタンスについては
     、 *note extract_cookies(): 4398. の説明を参照してください。

 -- メソッド: CookieJar.set_cookie_if_ok (cookie, request)

     ポリシーが許すのであれば、与えられた *note Cookie: 4394. を設定しま
     す。

 -- メソッド: CookieJar.set_cookie (cookie)

     与えられた *note Cookie: 4394. を、それが設定されるべきかどうかのポ
     リシーのチェックを行わずに設定します。

 -- メソッド: CookieJar.clear ([domain[, path[, name]]])

     いくつかのクッキーを消去します。

     引数なしで呼ばれた場合は、すべてのクッキーを消去します。引数がひと
     つ与えられた場合、その 'domain' に属するクッキーのみを消去します。
     ふたつの引数が与えられた場合、指定された 'domain' と URL 'path' に
     属するクッキーのみを消去します。引数が 3つ与えられた場合、'domain',
     'path' および 'name' で指定されるクッキーが消去されます。

     与えられた条件に一致するクッキーがない場合は *note KeyError: 7e5. を
     発生させます。

 -- メソッド: CookieJar.clear_session_cookies ()

     すべてのセッションクッキーを消去します。

     保存されているクッキーのうち、 ‘discard’ 属性が真になっているものす
     べてを消去します (通常これは ‘max-age’ または ‘expires’ のどちらの
     クッキー属性もないか、あるいは明示的に ‘discard’ クッキー属性が指定
     されているものです)。対話的なブラウザの場合、セッションの終了はふつ
     うブラウザのウィンドウを閉じることに相当します。

     注意: 'ignore_discard' 引数に真を指定しないかぎり、 ‘save()’ メソッ
     ドはセッションクッキーは保存しません。

さらに *note FileCookieJar: 438e. は以下のようなメソッドを実装しています
:

 -- メソッド: FileCookieJar.save (filename=None, ignore_discard=False,
          ignore_expires=False)

     クッキーをファイルに保存します。

     この基底クラスは *note NotImplementedError: 5a1. を発生させます。サ
     ブクラスはこのメソッドを実装しないままにしておいてもかまいません。

     'filename' はクッキーを保存するファイルの名前です。 'filename' が指
     定されない場合、 ‘self.filename’ が使用されます (このデフォルト値は
     、それが存在する場合は、コンストラクタに渡されています)。
     ‘self.filename’ も *note None: a6a. の場合は *note ValueError: 15a.
     が発生します。

     'ignore_discard' : 破棄されるよう指示されていたクッキーでも保存しま
     す。'ignore_expires' : 期限の切れたクッキーでも保存します。

     ここで指定されたファイルがもしすでに存在する場合は上書きされるため
     、以前にあったクッキーはすべて消去されます。保存したクッキーはあと
     で *note load(): 4390. または *note revert(): 4391. メソッドを使っ
     て復元することができます。

 -- メソッド: FileCookieJar.load (filename=None, ignore_discard=False,
          ignore_expires=False)

     ファイルからクッキーを読み込みます。

     それまでのクッキーは新しいものに上書きされない限り残ります。

     ここでの引数の値は *note save(): 43a0. と同じです。

     名前のついたファイルはこのクラスがわかるやり方で指定する必要があり
     ます。さもないと *note LoadError: 438d. が発生します。さらに、例え
     ばファイルが存在しないような時に *note OSError: 543. が発生する場合
     があります。

     バージョン 3.3 で変更: 以前は *note IOError: 1409. が送出されました
     ; それは現在 *note OSError: 543. のエイリアスです。

 -- メソッド: FileCookieJar.revert (filename=None, ignore_discard=False,
          ignore_expires=False)

     すべてのクッキーを破棄し、保存されているファイルから読み込み直しま
     す。

     *note revert(): 4391. は *note load(): 4390. と同じ例外を発生させる
     事ができます。失敗した場合、オブジェクトの状態は変更されません。

*note FileCookieJar: 438e. インスタンスは以下のような公開の属性をもって
います:

 -- の属性: FileCookieJar.filename

     クッキーを保存するデフォルトのファイル名を指定します。この属性には
     代入することができます。

 -- の属性: FileCookieJar.delayload

     真であれば、クッキーを読み込むさいにディスクから遅延読み込みします
     。この属性には代入することができません。この情報は単なるヒントであ
     り、 (ディスク上のクッキーが変わらない限りは) インスタンスのふるま
     いには影響を与えず、パフォーマンスのみに影響します。 *note
     CookieJar: 41ae. オブジェクトはこの値を無視することもあります。標準
     ライブラリに含まれている *note FileCookieJar: 438e. クラスで遅延読
     み込みをおこなうものはありません。


File: python.info,  Node: FileCookieJar のサブクラスと web ブラウザとの連携,  Next: CookiePolicy オブジェクト,  Prev: CookieJar および FileCookieJar オブジェクト,  Up: http cookiejar --- HTTP クライアント用の Cookie 処理

5.23.19.2 FileCookieJar のサブクラスと web ブラウザとの連携
...........................................................

クッキーの読み書きのために、以下の *note CookieJar: 41ae. サブクラスが提
供されています。

 -- クラス: http.cookiejar.MozillaCookieJar (filename=None,
          delayload=None, policy=None)

     Mozilla の ‘cookies.txt’ ファイル形式 (この形式はまた curl や Lynx
     と Netscape ブラウザによっても使われています) でディスクにクッキー
     を読み書きするための *note FileCookieJar: 438e. です。

          注釈: このクラスは RFC 2965(1) クッキーに関する情報を失います
          。また、より新しいか、標準でない ‘port’ などのクッキー属性につ
          いての情報も失います。

          警告: もしクッキーの損失や欠損が望ましくない場合は、クッキーを
          保存する前にバックアップを取っておくようにしてください (ファイ
          ルへの読み込み / 保存をくり返すと微妙な変化が生じる場合があり
          ます)。

     また、Mozilla の起動中にクッキーを保存すると、Mozilla によって内容
     が破壊されてしまうことにも注意してください。

 -- クラス: http.cookiejar.LWPCookieJar (filename=None, delayload=None,
          policy=None)

     libwww-perl のライブラリである ‘Set-Cookie3’ ファイル形式でディスク
     にクッキーを読み書きするための *note FileCookieJar: 438e. です。こ
     れはクッキーを人間に可読な形式で保存するのに向いています。

     バージョン 3.8 で変更: 'filename' 引数が *note path-like object:
     7a5. を受け付けるようになりました。

   ---------- 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: 438f. インターフェイスを実装するオブジェクトは以下の
ようなメソッドを持っています:

 -- メソッド: CookiePolicy.set_ok (cookie, request)

     クッキーがサーバから受け入れられるべきかどうかを表わす boolean 値を
     返します。

     'cookie' は *note Cookie: 4394. インスタンスです。 'request' は
     *note CookieJar.extract_cookies(): 4398. の説明で定義されているイン
     ターフェイスを実装するオブジェクトです。

 -- メソッド: CookiePolicy.return_ok (cookie, request)

     クッキーがサーバに返されるべきかどうかを表わす boolean 値を返します
     。

     'cookie' は *note Cookie: 4394. インスタンスです。 'request' は
     *note CookieJar.add_cookie_header(): 4397. の説明で定義されているイ
     ンターフェイスを実装するオブジェクトです。

 -- メソッド: CookiePolicy.domain_return_ok (domain, request)

     与えられたクッキーのドメインに対して、そこにクッキーを返すべきでな
     い場合には ‘False’ を返します。

     このメソッドは高速化のためのものです。これにより、すべてのクッキー
     をある特定のドメインに対してチェックする (これには多数のファイル読
     みこみを伴なう場合があります) 必要がなくなります。 *note
     domain_return_ok(): 43a9. および *note path_return_ok(): 43aa. の両
     方から true が返された場合、すべての決定は *note return_ok(): 43a8.
     に委ねられます。

     もし、このクッキードメインに対して *note domain_return_ok(): 43a9.
     が true を返すと、つぎにそのクッキーのパス名に対して *note
     path_return_ok(): 43aa. が呼ばれます。そうでない場合、そのクッキー
     ドメインに対する ‘path_return_ok()’ および *note return_ok(): 43a8.
     は決して呼ばれることはありません。 ‘path_return_ok()’ が true を返
     すと、 ‘return_ok()’ がその *note Cookie: 4394. オブジェクト自身の
     全チェックのために呼ばれます。そうでない場合、そのクッキーパス名に
     対する ‘return_ok()’ は決して呼ばれることはありません。

     注意: *note domain_return_ok(): 43a9. は 'request' ドメインだけでは
     なく、すべての 'cookie' ドメインに対して呼ばれます。たとえば
     request ドメインが ‘"www.example.com"’ だった場合、この関数は
     ‘".example.com"’ および ‘"www.example.com"’ の両方に対して呼ばれる
     ことがあります。同じことは *note path_return_ok(): 43aa. にもいえま
     す。

     'request' 引数は *note return_ok(): 43a8. で説明されているとおりで
     す。

 -- メソッド: CookiePolicy.path_return_ok (path, request)

     与えられたクッキーのパス名に対して、そこにクッキーを返すべきでない
     場合には ‘False’ を返します。

     *note domain_return_ok(): 43a9. の説明を参照してください。

上のメソッドの実装にくわえて、 *note CookiePolicy: 438f. インターフェイ
スの実装では以下の属性を設定する必要があります。これはどのプロトコルがど
のように使われるべきかを示すもので、これらの属性にはすべて代入することが
許されています。

 -- の属性: CookiePolicy.netscape

     Netscape プロトコルを実装していることを示します。

 -- の属性: CookiePolicy.rfc2965

     RFC 2965(1) プロトコルを実装していることを示します。

 -- の属性: CookiePolicy.hide_cookie2

     ‘Cookie2’ ヘッダをリクエストに含めないようにします (このヘッダが存
     在する場合、私たちは RFC 2965(2) クッキーを理解するということをサー
     バに示すことになります)。

もっとも有用な方法は、 *note DefaultCookiePolicy: 2002. をサブクラス化し
た *note CookiePolicy: 438f. クラスを定義して、いくつか (あるいはすべて)
のメソッドをオーバーライドすることでしょう。 ‘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: 438f. インターフェイスを実装するのに必要な機能に加え
て、このクラスではクッキーを受けとったり設定したりするドメインを許可した
り拒絶したりできるようになっています。ほかにも、 Netscape プロトコルのか
なり緩い規則をややきつくするために、いくつかの厳密性のスイッチがついてい
ます (いくつかの良性クッキーをブロックする危険性もありますが)。

ドメインの拒否リストや許可リストも提供されています (デフォルトではどちら
もオフです)。拒否リストになく、(許可リストがアクティブなら) 許可リストに
あるドメインのみがクッキーを設定したり返したりできます。コンストラクタの
引数 'blocked_domains' 、および ‘blocked_domains()’ と
‘set_blocked_domains()’ メソッド ( そして 'allowed_domains' に対応する引
数とメソッド) を使ってください。許可リストを設定した場合は、それを *note
None: a6a. にすることでオフに戻せます。

拒否あるいは許可リスト中にあるドメインのうち、ドット (.)  で始まっていな
いものは、正確にそれと一致するドメインのクッキーにしか適用されません。た
とえば拒否リスト中のエントリ ‘"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: 2002. は以下のような追加メソッドを実装してい
ます:

 -- メソッド: DefaultCookiePolicy.blocked_domains ()

     ブロックしているドメインのシーケンスを (タプルとして) 返します。

 -- メソッド: DefaultCookiePolicy.set_blocked_domains (blocked_domains)

     ブロックするドメインを設定します。

 -- メソッド: DefaultCookiePolicy.is_blocked (domain)

     'domain' がクッキーを授受しない拒否リストに載っていれば ‘True’ を返
     します。

 -- メソッド: DefaultCookiePolicy.allowed_domains ()

     *note None: a6a. あるいは明示的に許可されているドメインを (タプルと
     して) 返します。

 -- メソッド: DefaultCookiePolicy.set_allowed_domains (allowed_domains)

     許可するドメイン、あるいは *note None: a6a. を設定します。

 -- メソッド: DefaultCookiePolicy.is_not_allowed (domain)

     'domain' がクッキーを授受する許可リストに載っていれば ‘True’ を返し
     ます。

*note DefaultCookiePolicy: 2002. インスタンスは以下の属性をもっています
。これらはすべてコンストラクタから同じ名前の引数をつかって初期化すること
ができ、代入してもかまいません。

 -- の属性: DefaultCookiePolicy.rfc2109_as_netscape

     真の場合、 *note CookieJar: 41ae. のインスタンスに RFC 2109(2) クッ
     キー (即ち ‘Set-Cookie’ ヘッダのクッキー属性 Version の値が 1 のク
     ッキー) を Netscapeクッキーへ、 *note Cookie: 4394. インスタンスの
     version 属性を 0 に設定する事でダウングレードするように要求します。
     デフォルトの値は *note None: a6a. であり、この場合 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: 43b9. 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: 4394. 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: 438f. メソッド内でのごくわずかな例外を除けば、これら
の属性に代入する必要はないはずです。このクラスは内部の一貫性を保つように
はしていないため、代入するのは自分のやっていることを理解している場合のみ
にしてください。

 -- の属性: Cookie.version

     Integer or *note None: a6a.  Netscape cookies have *note version:
     43c2. 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: a6a. 。

 -- の属性: Cookie.port

     ポートあるいはポートの集合をあらわす文字列 (例: '80' または
     '80,8080')、あるいは *note None: a6a. 。

 -- の属性: Cookie.domain

     クッキーのドメイン (文字列) 。

 -- の属性: Cookie.path

     クッキーのパス名 (文字列、例: ‘'/acme/rocket_launchers'’)。

 -- の属性: Cookie.secure

     そのクッキーを返せるのがセキュアな接続のみならば ‘True’ を返します
     。

 -- の属性: Cookie.expires

     クッキーの期限が切れる日時をあわらす整数 (エポックから経過した秒数
     )、あるいは *note None: a6a. 。 *note is_expired(): 43ca. も参照し
     てください。

 -- の属性: Cookie.discard

     これがセッションクッキーであれば ‘True’ を返します。

 -- の属性: Cookie.comment

     このクッキーの働きを説明する、サーバからのコメント文字列、あるいは
     *note None: a6a. 。

 -- の属性: Cookie.comment_url

     このクッキーの働きを説明する、サーバからのコメントのリンク URL、あ
     るいは *note None: a6a. 。

 -- の属性: 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: 43c2. 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: 4394. クラスは以下のメソッドも定義しています:

 -- メソッド: 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: 2002. の使用例です。 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: 137.

   * *note xmlrpc.server: 138.


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: 3f48.

バージョン 3.5 で変更: For HTTPS URIs, ‘xmlrpc.client’ now performs all
the necessary certificate and hostname checks by default.

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

 -- クラス: 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: e1f. は、リモートの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: 29c.  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: 6ed.
     objects and binary data to be presented as *note bytes: 1d2.
     objects; this flag is false by default.  ‘datetime.datetime’,
     ‘bytes’ and *note bytearray: 1d1. 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: 33e. 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: 5f6.
                                
                                
     ‘int’, ‘i1’, ‘i2’, ‘i4’,   *note int: 32e. in range from -2147483648 to 2147483647.
     ‘i8’ または ‘biginteger’   Values get the ‘<int>’ tag.
                                
                                
     ‘double’ または ‘float’    *note float: 32f.  Values get the ‘<double>’ tag.
                                
                                
     ‘string’                   *note str: 1ea.
                                
                                
     ‘array’                    適合する要素を持つ *note list: 4e0. または
                                *note tuple: 1d9.。array は ‘list’ として返します。
                                
                                
     ‘struct’                   *note dict: 193. 。キーは文字列のみ。全ての値は変換可能で
                                なくてはならない。ユーザー定義型を渡すこともできます。
                                *note __dict__: 1ca. の属性のみ転送されます。
                                
                                
     ‘dateTime.iso8601’         *note DateTime: 179c. または
                                *note datetime.datetime: 6ed.。返される型は
                                'use_builtin_types' および 'use_datetime' の値に依ります
                                。
                                
                                
     ‘base64’                   *note Binary: 43dc.、 *note bytes: 1d2. または
                                *note bytearray: 1d1.。返される型は 'use_builtin_types' フ
                                ラグの値に依ります。
                                
                                
     ‘nil’                      ‘None’ 定数。 'allow_none' が真の場合にのみ渡すことが出来
                                ます。
                                
                                
     ‘bigdecimal’               *note decimal.Decimal: 1cd.  Returned type only.
                                

     上記のXML-RPCでサポートする全データ型を使用することができます。メソ
     ッド呼び出し時、XML- RPCサーバエラーが発生すると *note Fault: 43dd.
     インスタンスを送出し、HTTP/HTTPSトランスポート層でエラーが発生した
     場合には *note ProtocolError: 43de. を送出します。 ‘Error’ をベース
     とする ‘Fault’ と ‘ProtocolError’ の両方が発生します。現在のところ
     xmlrpclibでは組み込み型のサブクラスのインスタンスをマーシャルするこ
     とはできません。

     文字列を渡す場合、 ‘<’, ‘>’, ‘&’ などのXMLで特殊な意味を持つ文字は
     自動的にエスケープされます。しかし、ASCII値0〜31の制御文字(もちろん
     、タブ'TAB',改行'LF',リターン'CR'は除く)などのXMLで使用することので
     きない文字を使用することはできず、使用するとそのXML-RPCリクエストは
     well-formedなXMLとはなりません。そのようなバイト列を渡す必要がある
     場合は、 *note bytes: 1d2, *note bytearray: 1d1. クラスまたは後述の
     *note Binary: 43dc. ラッパークラスを使用してください。

     ‘Server’ は、後方互換性の為に *note ServerProxy: e1f. の別名として
     残されています。新しいコードでは ‘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/main/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: e1f. 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 either by returning data in a conformant
type or by raising a *note Fault: 43dd. or *note ProtocolError: 43de.
exception 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: e1f. support the
*note context manager: 47f. 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: 6ed, のインスタンス
     のいずれかで初期化することができます。このクラスには以下のメソッド
     があり、主にコードをマーシャル/アンマーシャルするための内部処理を行
     います:

      -- メソッド: decode (string)

          文字列をインスタンスの新しい時間を示す値として指定します。

      -- メソッド: encode (out)

          出力ストリームオブジェクト 'out' に、XML-RPCエンコーディングの
          *note DateTime: 179c. 値を出力します。

     It also supports certain of Python's built-in operators through
     *note rich comparison: 165a. and *note __repr__(): 1c7. 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: 43dc. の内容は、属性で参照します:

      -- の属性: data

          *note Binary: 43dc. インスタンスがカプセル化しているバイナリデ
          ータ。このデータは *note bytes: 1d2. オブジェクトです。

     *note Binary: 43dc. オブジェクトは以下のメソッドを持ち、主に内部的
     にマーシャル/アンマーシャル時に使用されます:

      -- メソッド: decode (bytes)

          指定されたbase64 *note bytes: 1d2. オブジェクトをデコードし、
          インスタンスのデータとします。

      -- メソッド: 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__(): ec4. and *note __ne__(): 18cf. 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: 43dd. オブジェクトは、XML-RPCのfaultタグの内容をカプセ
     ル化しており、以下の属性を持ちます:

      -- の属性: faultCode

          失敗のタイプを示す整数。

      -- の属性: faultString

          失敗の診断メッセージを含む文字列。

以下のサンプルでは、複素数型のオブジェクトを返そうとして、故意に *note
Fault: 43dd. を起こしています。

     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: 43de. オブジェクトはトランスポート層で発生した
     エラー(URI で指定したサーバが見つからなかった場合に発生する404 'not
     found'など)の内容を示し、以下の属性を持ちます:

      -- の属性: url

          エラーの原因となったURIまたはURL。

      -- の属性: errcode

          エラーコード。

      -- の属性: errmsg

          エラーメッセージまたは診断文字列。

      -- の属性: headers

          エラーの原因となったHTTP/HTTPSリクエストを含む辞書。

次の例では、不適切な URI を利用して、故意に *note ProtocolError: 43de. を
発生させています:

     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: 43f8. オブジェクトは遠隔のサーバに対する複数の呼び出し
をひとつのリクエストにカプセル化する方法を提供します (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 arguments 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: 1417.; 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: 43dd. 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: a6a. 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: 43dd. 例外を送出します。 'use_builtin_types' フラグは
     *note datetime.datetime: 6ed. のオブジェクトとして日付/時刻を、
     *note bytes: 1d2. のオブジェクトとしてバイナリデータを表現する時に
     使用し、デフォルトでは 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: 43fe. を参照してください。

脚注
....


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: 4402, or embedded in a CGI environment, using
*note CGIXMLRPCRequestHandler: 4403.

     警告: The ‘xmlrpc.server’ module is not secure against maliciously
     constructed data.  If you need to parse untrusted or
     unauthenticated data, see *note XML security: 3f48.

*note Availability: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

 -- クラス: 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: 16e1.
     です。 引数 'addr' と 'requestHandler' は *note
     socketserver.TCPServer: 16d9. のコンストラクターに渡されます。
     'logRequests' が真の場合 (デフォルト)、 リクエストはログに記録され
     ます。 この引数を偽にするとはログは記録されません。 引数
     'allow_none' と 'encoding' は *note xmlrpc.client: 137. に渡され、
     サーバーが返す XML-RPC 応答を制御します。 'bind_and_activate' 引数
     はコンストラクタが直ちに ‘server_bind()’ と ‘server_activate()’ を
     呼ぶかどうかを制御します。デフォルトでは真です。 この引数に ‘False’
     を設定することで、アドレスを束縛する前に 'allow_reuse_address' クラ
     ス変数を操作することが出来ます。 'use_builtin_types' 引数は *note
     loads(): 17ed. 関数に渡されます。 この引数は日付/時刻の値やバイナリ
     データを受け取ったときにどの型が処理されるかを制御します。デフォル
     トでは偽です。

     バージョン 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: 137. に渡され
     、サーバーが返す XML-RPC 応答を制御します。 'use_builtin_types' 引
     数は *note loads(): 17ed. 関数に渡されます。 この引数は日付/時刻の
     値やバイナリデータを受け取ったときにどの型が処理されるかを制御しま
     す。デフォルトは偽です。

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。

 -- クラス: xmlrpc.server.SimpleXMLRPCRequestHandler

     リクエストハンドラーインスタンスを新たに作成します。このリクエスト
     ハンドラーは ‘POST’ リクエストをサポートし、 *note
     SimpleXMLRPCServer: 4402. コンストラクターの引数 'logRequests' に従
     ってログ出力を行います。

* Menu:

* SimpleXMLRPCServer objects::
* CGIXMLRPCRequestHandler::
* XMLRPC サーバの文書化::
* DocXMLRPCServer objects::
* DocCGIXMLRPCRequestHandler::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 4402. クラスは *note socketserver.TCPServer:
16d9. のサブクラスで、基本的なスタンドアロンの XML-RPC サーバーを作成す
る手段を提供します。

 -- メソッド: SimpleXMLRPCServer.register_function (function=None,
          name=None)

     XML-RPC リクエストに応答可能な関数を登録します。引数 'name' が与え
     られた場合は、それが関数 'function' に関連付けられたメソッド名とな
     ります。そうでない場合は、 *note function.__name__: 168e. の値が用
     いられます。引数 'name' は文字列で、例えばピリオド "."  のような
     Pythonで識別子として正しくない文字を含んでいても構いません。

     このメソッドはデコレーターとしても使用することができます。デコレー
     ターとして使用するときは、 'name' は関数を 'name' で登録するキーワ
     ード引数としてのみ渡すことができます。 'name' が与えられていないと
     きは、 *note function.__name__: 168e. が使用されます。

     バージョン 3.7 で変更: *note register_function(): 4406. はデコレー
     ターとして使用できます。

 -- メソッド: SimpleXMLRPCServer.register_instance (instance,
          allow_dotted_names=False)

     オブジェクトを登録します。 オブジェクトは *note
     register_function(): 4406. を使用して登録されていないメソッド名を公
     開するのに使われます。 '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: 4403. クラスは、Python の CGI スクリプト
に送られた XML-RPC リクエストを処理するときに使用できます。

 -- メソッド: CGIXMLRPCRequestHandler.register_function (function=None,
          name=None)

     XML-RPC リクエストに応答可能な関数を登録します。引数 'name' が与え
     られた場合は、それが関数 'function' に関連付けられたメソッド名とな
     ります。そうでない場合は、 *note function.__name__: 168e. の値が用
     いられます。引数 'name' は文字列で、例えばピリオド "."  のような
     Pythonで識別子として正しくない文字を含んでいても構いません。

     このメソッドはデコレーターとしても使用することができます。デコレー
     ターとして使用するときは、 'name' は関数を 'name' で登録するキーワ
     ード引数としてのみ渡すことができます。 'name' が与えられていないと
     きは、 *note function.__name__: 168e. が使用されます。

     バージョン 3.7 で変更: *note register_function(): 440d. はデコレー
     ターとして使用できます。

 -- メソッド: CGIXMLRPCRequestHandler.register_instance (instance)

     オブジェクトを登録します。 オブジェクトは *note
     register_function(): 440d. を使用して登録されていないメソッド名を公
     開するのに使われます。 '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: 1fb6. を、後者では *note
DocCGIXMLRPCRequestHandler: 4413. を使用します。

 -- クラス: xmlrpc.server.DocXMLRPCServer (addr,
          requestHandler=DocXMLRPCRequestHandler, logRequests=True,
          allow_none=False, encoding=None, bind_and_activate=True,
          use_builtin_types=True)

     サーバ・インスタンスを新たに生成します。全ての引数の意味は *note
     SimpleXMLRPCServer: 4402. のものと同じですが、 'requestHandler' の
     デフォルトは *note DocXMLRPCRequestHandler: 4414. になっています。

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。

 -- クラス: xmlrpc.server.DocCGIXMLRPCRequestHandler

     CGI環境で XMR-RPC リクエストを処理するインスタンスを新たに生成しま
     す。

 -- クラス: xmlrpc.server.DocXMLRPCRequestHandler

     リクエスト・ハンドラのインスタンスを新たに生成します。このリクエス
     ト・ハンドラは XML-RPC POST 要求とドキュメントの GET 要求をサポート
     し、 *note DocXMLRPCServer: 1fb6. コンストラクタに与えられた引数
     'logRequests' を優先するためにロギングを変更します。


File: python.info,  Node: DocXMLRPCServer objects,  Next: DocCGIXMLRPCRequestHandler,  Prev: XMLRPC サーバの文書化,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.23.22.5 DocXMLRPCServer objects
.................................

*note DocXMLRPCServer: 1fb6. は *note SimpleXMLRPCServer: 4402. の派生ク
ラスで、自己文書化するスタンドアローン 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: 4413. は *note
CGIXMLRPCRequestHandler: 4403. の派生クラスで、自己文書化する 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モジュールの紹介: 4421. を参照してください。

Added in version 3.3.

* Menu:

* 便利なファクトリ関数::
* IP アドレス::
* IP ネットワーク定義::
* インターフェイスオブジェクト::
* その他のモジュールレベル関数::
* Custom Exceptions::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 716. か
     *note IPv6Address: 717. のオブジェクトを返します。 IPv4 か IPv6 の
     アドレスを受け取ります; ‘2**32’ より小さい整数はデフォルトでは IPv4
     アドレスだと判断されます。 'address' が正しい IPv4, IPv6 アドレスを
     表現していない場合は *note ValueError: 15a. を発生させます。

          >>> 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: 718. か
     *note IPv6Network: 719. のオブジェクトを返します。 'address' は IP
     ネットワークを示す文字列あるいは整数です。 IPv4 か IPv6 のネットワ
     ークを受け取ります; ‘2**32’ より小さい整数はデフォルトでは IPv4 ア
     ドレスだと判断されます。 'strict' は ‘IPv4Network’ か ‘IPv6Network’
     のコンストラクタに渡されます。 'address' が正しい IPv4, IPv6 アドレ
     スを表現していない場合や、ネットワークの host bit がセットされてい
     た場合は *note ValueError: 15a. を発生させます。

          >>> ipaddress.ip_network('192.168.0.0/28')
          IPv4Network('192.168.0.0/28')

 -- の関数: ipaddress.ip_interface (address)

     引数に渡された IP address に応じて、 *note IPv4Interface: 1db3. か
     *note IPv6Interface: 1db4. のオブジェクトを返します。 'address' は
     IP ネットワークを示す文字列あるいは整数です。 IPv4 か IPv6 のネット
     ワークを受け取ります; ‘2**32’ より小さい整数はデフォルトでは IPv4 ア
     ドレスだと判断されます。 'address' が正しい IPv4, IPv6 アドレスを表
     現していない場合は *note ValueError: 15a. を発生させます。

これらの便利関数を利用するデメリットとして、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: 716. と *note IPv6Address: 717. オブジェクトは多くの
共通した属性を持っています。両方の IP バージョンを扱うコードを書きやすく
するために、IPv6 アドレスでしか意味が無いいくつかの属性も ‘IPv4Address’
オブジェクトに実装されています。アドレスオブジェクトは *note hashable:
18e. なので、辞書のキーとして利用できます。

 -- クラス: ipaddress.IPv4Address (address)

     IPv4 アドレスを構築する。 'address' が正しい IPv4 アドレスでない場
     合、 *note AddressValueError: 4428. を発生させます。

     以下のものが正しい 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: 1d2. オブジェクトに (最上位オクテットが
          最初になるように) パックされた整数。

          >>> 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(): d30.

      -- の属性: 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:
          1d2. オブジェクト(最上位オクテットが先頭)。 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: 442f.):

                    address.is_private == address.ipv4_mapped.is_private

          ‘is_private’ has value opposite to *note is_global: 130e,
          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: 442f.):

               address.is_global == address.ipv4_mapped.is_global

          ‘is_global’ has value opposite to *note is_private: 1bec,
          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: 1bec. 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: 4432. & 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(): 1ea, ‘'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: 4428. を発生させます。

     以下のものが正しい 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: 1d2. オブ
          ジェクトにパックされた整数。

          >>> 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: 716. クラスの対
     応するドキュメントを参照してください:

      -- の属性: 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: 1bec. を利用してください。

      -- の属性: 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: 716. の対応するメソッドのドキュメントを参照して
     ください。

     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(): 1ea. と *note int(): 32e. 関数を利用します:

     >>> 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: 718. と *note IPv6Network: 719. オブジェクトは 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: 718. と *note IPv6Network: 719. で共
通なので、重複を避けるために ‘IPv4Network’ にだけドキュメントされていま
す。ネットワークオブジェクトは *note hashable: 18e. なので、辞書のキーと
して使用できます。

 -- クラス: 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: 1d2. オブジェクトにビッグエンディアンで
          パックされた整数。これは整数の '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: 716.
          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: 4428. 例外を発生させます。マスクが IPv4 アドレス
     に対して有効でない場合に *note NetmaskValueError: 4449. 例外を発生
     させます。

     'strict' が ‘True’ の場合、与えられたアドレスのホストビットが立って
     いたら *note ValueError: 15a. を発生させます。そうでない場合、ホス
     トビットをマスクして正しいネットワークアドレスを計算します。

     特に明記されない場合、他の network や address を受け取る network の
     メソッドは、引数の IP バージョンが ‘self’ と異なる場合に *note
     TypeError: 29c. を発生させます。

     バージョン 3.5 で変更: 'address' コンストラクタ引数に2要素のタプル
     形式を追加しました

      -- の属性: version

      -- の属性: max_prefixlen

          *note IPv4Address: 716. の対応する属性のドキュメントを参照して
          ください。

      -- の属性: 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: 716. オブジェクトとして表現された ホストマ
          スク。

      -- の属性: netmask

          *note IPv4Address: 716. オブジェクトとして表現された ネットマ
          スク。

      -- の属性: 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: 15a. 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: 1d2. オブジェクトにビッグエンディアンで
          パックされた整数。これは整数の '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:
          717. object; and the netmask is an integer representing the
          prefix length.

     'address' が有効な IPv6 アドレスでない場合に *note
     AddressValueError: 4428. 例外を発生させます。マスクが IPv6 アドレス
     に対して有効でない場合に *note NetmaskValueError: 4449. 例外を発生
     させます。

     'strict' が ‘True’ の場合、与えられたアドレスのホストビットが立って
     いたら *note ValueError: 15a. を発生させます。そうでない場合、ホス
     トビットをマスクして正しいネットワークアドレスを計算します。

     バージョン 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: 718. の対応する属性のドキュメントを参照して
          ください。

      -- の属性: 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(): 19e4. 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: 18e. なので、辞書のキーと
して使用できます。

 -- クラス: ipaddress.IPv4Interface (address)

     Construct an IPv4 interface.  The meaning of 'address' is as in the
     constructor of *note IPv4Network: 718, except that arbitrary host
     addresses are always accepted.

     ‘IPv4Interface’ is a subclass of *note IPv4Address: 716, so it
     inherits all the attributes from that class.  In addition, the
     following attributes are available:

      -- の属性: ip

          The address (*note IPv4Address: 716.) without network
          information.

               >>> interface = IPv4Interface('192.0.2.5/24')
               >>> interface.ip
               IPv4Address('192.0.2.5')

      -- の属性: network

          The network (*note IPv4Network: 718.) 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: 719, except that arbitrary host
     addresses are always accepted.

     *note IPv6Interface: 1db4. is a subclass of *note IPv6Address: 717,
     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: 1db3. の対応する属性のドキュメントを参照
          してください。

* 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: 15a. 例外を発生させます。

          >>> 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: 15a. 例外を発生させます。

 -- の関数: ipaddress.summarize_address_range (first, last)

     first と last で指定された IPアドレス帯に対するイテレーターを返しま
     す。 'first' はアドレス帯の中の最初の *note IPv4Address: 716. か
     *note IPv6Address: 717. で、 'last' はアドレス帯の中の最後の
     ‘IPv4Address’ か ‘IPv6Address’ です。 'first' か 'last' がIPアドレ
     スでない場合や、2つの型が揃っていない場合に、 *note TypeError: 29c.
     を発生させます。 'last' が 'first' より大きくない場合や、 'first' ア
     ドレスのバージョンが 4 でも 6 でもない場合は *note ValueError: 15a.
     を発生させます。

          >>> [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: 718. or
     *note IPv6Network: 719. objects.  'addresses' is an *note iterable:
     149a. of ‘IPv4Network’ or ‘IPv6Network’ objects.  A *note
     TypeError: 29c. 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(): f90.

     '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.

The module supports uncompressed PCM and IEEE floating-point WAV
formats.

バージョン 3.12 で変更: Support for ‘WAVE_FORMAT_EXTENSIBLE’ headers was
added, provided that the extended format is ‘KSDATAFORMAT_SUBTYPE_PCM’.

バージョン 3.15 で変更: Support for reading and writing
‘WAVE_FORMAT_IEEE_FLOAT’ files was added.

The ‘wave’ module defines the following function and exception:

 -- の関数: wave.open (file, mode=None)

     If 'file' is a string, a *note path-like object: 7a5. or a *note
     bytes-like object: 43d. 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: 2f2. オブジェクトを返し、
     ‘'wb'’ の場合 *note Wave_write: 2f3. オブジェクトを返します。
     '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: 215. statement.
     When the ‘with’ block completes, the *note Wave_read.close(): 4499.
     or *note Wave_write.close(): 449a. method is called.

     バージョン 3.4 で変更: シーク不能なファイルのサポートが追加されまし
     た。

     バージョン 3.15 で変更: Added support for *note path-like objects:
     7a5. and *note bytes-like objects: 43d.

 -- 例外: wave.Error

     WAVの仕様を犯したり、実装の欠陥に遭遇して何か実行不可能となった時に
     発生するエラー。

 -- データ: wave.WAVE_FORMAT_PCM

     Format code for uncompressed PCM audio.

 -- データ: wave.WAVE_FORMAT_IEEE_FLOAT

     Format code for IEEE floating-point audio.

 -- データ: wave.WAVE_FORMAT_EXTENSIBLE

     Format code for WAVE extensible headers.

* Menu:

* Wave_read オブジェクト::
* Wave_write オブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): d1b. によって返される 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 ()

          オーディオフレーム数を返します。

      -- メソッド: getformat ()

          Returns the frame format code.

          This is one of *note WAVE_FORMAT_PCM: 449c, *note
          WAVE_FORMAT_IEEE_FLOAT: 449d, or *note WAVE_FORMAT_EXTENSIBLE:
          449e.

      -- メソッド: getcomptype ()

          圧縮形式を返します（ ‘'NONE'’ だけがサポートされている形式です
          ）。

      -- メソッド: getcompname ()

          *note getcomptype(): 44a5. を人に判読可能な形にしたものです。
          通常、 ‘'NONE'’ に対して ‘'not compressed'’ が返されます。

      -- メソッド: getparams ()

          Returns a *note namedtuple(): 1da. ‘(nchannels, sampwidth,
          framerate, nframes, comptype, compname)’, equivalent to output
          of the ‘get*()’ methods.

      -- メソッド: readframes (n)

          最大 'n' 個のオーディオフレームを読み込んで、 *note bytes:
          1d2. オブジェクトとして返します。

      -- メソッド: rewind ()

          ファイルのポインタをオーディオストリームの先頭に戻します。

     以下の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(): d1b.

     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(): 44ab. or *note
     setparams(): 2bb. with the number of frames that will be written
     before *note close(): 449a. is called and then using *note
     writeframesraw(): 139a. to write the frame data, or by calling
     *note writeframes(): 139b. 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' バイトに設定します。

          For *note WAVE_FORMAT_IEEE_FLOAT: 449d, only 4-byte (32-bit)
          and 8-byte (64-bit) sample widths are supported.

      -- メソッド: 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.

      -- メソッド: setformat (format)

          Set the frame format code.

          Supported values are *note WAVE_FORMAT_PCM: 449c. and *note
          WAVE_FORMAT_IEEE_FLOAT: 449d.

          When setting *note WAVE_FORMAT_IEEE_FLOAT: 449d, the sample
          width must be 4 or 8 bytes.

      -- メソッド: getformat ()

          Return the current frame format code.

      -- メソッド: setparams (tuple)

          The 'tuple' should be ‘(nchannels, sampwidth, framerate,
          nframes, comptype, compname, format)’, with values valid for
          the ‘set*()’ methods.  Sets all parameters.

          For backwards compatibility, a 6-item tuple without 'format'
          is also accepted and defaults to *note WAVE_FORMAT_PCM: 449c.

          For ‘format=WAVE_FORMAT_IEEE_FLOAT’, 'sampwidth' must be 4 or
          8.

      -- メソッド: getparams ()

          Return a *note namedtuple(): 1da. ‘(nchannels, sampwidth,
          framerate, nframes, comptype, compname)’ containing the
          current output parameters.

      -- メソッド: tell ()

          ファイルの中の現在位置を返します。 *note Wave_read.tell():
          44a9. と *note Wave_read.setpos(): 44a8. メソッドでお断りした
          ことがこのメソッドにも当てはまります。

      -- メソッド: writeframesraw (data)

          'nframes' の修正なしにオーディオフレームを書き込みます。

          バージョン 3.4 で変更: どのような *note bytes-like object:
          43d. も使用できるようになりました。

      -- メソッド: writeframes (data)

          出力ストリームが seek 不可能で、 'data' が書き込まれた後でそれ
          以前に 'nframes' に設定された値と書き込まれた全フレーム数が一
          致しなければ、エラーを送出します。

          バージョン 3.4 で変更: どのような *note bytes-like object:
          43d. も使用できるようになりました。

          *note writeframes(): 139b. や *note writeframesraw(): 139a. メ
          ソッドを呼び出したあとで、どんなパラメータを設定しようとしても
          不正となることに注意して下さい。そうすると *note wave.Error:
          449b. を発生します。

          For *note WAVE_FORMAT_IEEE_FLOAT: 449d. output, a ‘fact’ chunk
          is written as required by the WAVE specification for non-PCM
          formats.


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/main/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/main/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(): 1821. と同様ですが、指定された 'domain' からメッセ
     ージを探します。

 -- の関数: gettext.ngettext (singular, plural, n)

     *note gettext(): 1821. と同様ですが、複数形を考慮しています。 翻訳
     が見つかった場合、複数形の選択公式を 'n' に適用し、その結果得られた
     メッセージを返します (言語によっては二つ以上の複数形があります)。 翻
     訳が見つからなかった場合、 'n' が 1 なら 'singular' を返します; そ
     うでない場合 'plural' を返します。

     複数形の選択公式はカタログのヘッダから取得されます。 選択公式は自由
     変数 'n' を持つ C または Python の式です; その式の評価結果はカタロ
     グにある複数形のインデックスになります。 ‘.po’ ファイルで用いられる
     詳細な文法と、様々な言語における選択公式については GNU gettext ドキ
     ュメント(2) を参照してください。

 -- の関数: gettext.dngettext (domain, singular, plural, n)

     *note ngettext(): 44c9. と同様ですが、指定された '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(): 66, *note dgettext(): 44c8, *note
     ngettext(): 44c9, *note dngettext(): 44ca.), 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: 3b2.).  For
this reason, it is always best to call *note bindtextdomain(): 44c6.
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: 44cf. 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(): 44c7. と同じく、 'domain' を引数にとります。オ
     プションの 'localedir' は *note bindtextdomain(): 44c6. と同じです
     。またオプションの 'languages' は文字列を列挙したリストで、各文字列
     は言語コードを表します。

     'localedir' が与えられていない場合、標準のシステムロケールディレク
     トリが使われます。 (1) 'languages' が与えられなかった場合、以下の環
     境変数: ‘LANGUAGE’ 、 ‘LC_ALL’ 、 ‘LC_MESSAGES’ 、および ‘LANG’ が
     検索されます。空でない値を返した最初の候補が 'languages' 変数として
     使われます。この環境変数は言語名をコロンで分かち書きしたリストを含
     んでいなければなりません。 *note find(): 44d0. はこの文字列をコロン
     で分割し、言語コードの候補リストを生成します。

     *note find(): 44d0. は次に言語コードを展開および正規化し、リストの
     各要素について、以下のパス構成:

     ‘`localedir'/`language'/LC_MESSAGES/`domain'.mo’

     からなる実在するファイルの探索を反復的に行います。 *note find():
     44d0. は上記のような実在するファイルで最初に見つかったものを返しま
     す。該当するファイルが見つからなかった場合、 ‘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(): 44d0. 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: 44cf.  The class's constructor must take a single
     *note file object: 1581. argument.

     複数の ‘.mo’ ファイルがあった場合、後ろのファイルは前のファイルのフ
     ォールバックとして利用されます。 フォールバックの設定のために、
     *note copy.copy(): 947. を使いキャッシュから翻訳オブジェクトを複製
     します; こうすることで、実際のインスタンスデータはキャッシュのもの
     と共有されたままになります。

     ‘.mo’ ファイルが見つからなかった場合、 'fallback' が偽 (デフォルト
     値) ならこの関数は *note OSError: 543. を送出し、 'fallback' が真な
     ら *note NullTranslations: 44d1. インスタンスが返されます。

     バージョン 3.3 で変更: 以前は *note IOError: 1409. が送出されました
     ; それは現在 *note OSError: 543. のエイリアスです。

     バージョン 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(): e40.

     'names' パラメータについては、翻訳オブジェクトの *note install():
     44d2. メソッドの説明を参照ください。

     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(): 44c6. に関する脚注を参照してください
。


File: python.info,  Node: NullTranslations クラス,  Next: GNUTranslations クラス,  Up: クラス形式の API

5.25.1.3 ‘NullTranslations’ クラス
..................................

翻訳クラスは、元のソースファイル中のメッセージ文字列から翻訳されたメッセ
ージ文字列への変換処理が実際に実装されているクラスです。 全ての翻訳クラ
スで基底クラスとして使われているクラスが *note NullTranslations: 44d1. で
す; このクラスは、独自の翻訳クラスを実装するのに使える基本的なインターフ
ェースを提供しています。 以下に ‘NullTranslations’ のメソッドを示します:

 -- クラス: gettext.NullTranslations (fp=None)

     オプションの *note ファイルオブジェクト: 1581. 'fp' を取ります。こ
     の引数は基底クラスでは無視されます。このメソッドは "保護された
     (protected)" インスタンス変数 '_info' および '_charset' を初期化し
     ます。これらの変数の値は派生クラスで設定することができます。同様に
     '_fallback' も初期化しますが、この値は *note add_fallback(): 44d4.
     で設定されます。その後、 '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(): dbc.
          を代替オブジェクトに転送します。そうでない場合、翻訳されたメッ
          セージを返します。派生クラスで上書きするメソッドです。

          Added in version 3.8.

      -- メソッド: npgettext (context, singular, plural, n)

          代替オブジェクトが設定されている場合、 *note npgettext():
          44cc. を代替オブジェクトに転送します。そうでない場合、翻訳され
          たメッセージを返します。派生クラスで上書きするメソッドです。

          Added in version 3.8.

      -- メソッド: info ()

          Return a dictionary containing the metadata found in the
          message catalog file.

      -- メソッド: charset ()

          メッセージカタログファイルのエンコーディングを返します。

      -- メソッド: install (names=None)

          このメソッドは *note gettext(): 44d6. を組み込み名前空間にイン
          ストールし、変数 ‘_’ に束縛します。

          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: 44d1.: *note GNUTranslations: 44cf.  This class
overrides ‘_parse()’ to enable reading GNU ‘gettext’ format ‘.mo’ files
in both big-endian and little-endian format.

*note GNUTranslations: 44cf. 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: 44cf. クラスのインスタンス化で *note
OSError: 543. が送出されることがあります。

 -- クラス: gettext.GNUTranslations

     以下のメソッドは基底クラスの実装からオーバライドされています:

      -- メソッド: gettext (message)

          カタログから 'message' id を検索して、対応するメッセージ文字列
          を Unicode でエンコードして返します。 'message' id に対応する
          エントリがカタログに存在せず、フォールバックが設定されている場
          合、検索処理をフォールバックの *note gettext(): 44d6. メソッド
          に移譲します。 それ以外の場合は、 'message' id 自体が返されま
          す。

      -- メソッド: ngettext (singular, plural, n)

          メッセージ id に対する複数形を検索します。カタログに対する検索
          では 'singular' がメッセージ id として用いられ、 'n' にはどの
          複数形を用いるかを指定します。返されるメッセージ文字列は
          Unicode 文字列です。

          メッセージ id がカタログ中に見つからず、フォールバックが指定さ
          れている場合は、メッセージ検索要求はフォールバックの *note
          ngettext(): 44d7. メソッドに移譲されます。 それ以外の場合、
          '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(): dbc. メソッドに転送されます。そう
          でない場合、 'message' id 自体が返されます。

          Added in version 3.8.

      -- メソッド: npgettext (context, singular, plural, n)

          メッセージ id に対する複数形を検索します。カタログに対する検索
          では 'singular' がメッセージ id として用いられ、 'n' にはどの
          複数形を用いるかを指定します。

          'context' に対するメッセージ id がカタログ中に見つからず、フォ
          ールバックオブジェクトが指定されている場合、メッセージ検索要求
          はフォールバックオブジェクトの *note npgettext(): 44cc. メソッ
          ドに転送されます。そうでない場合、 '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(): e40. 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 _: 66.  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(): e41. 関数に渡す
ことが出来ます:

     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:
1d3c. 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(): 23c. に渡されたロケールが認識されない場合例外が
     送出されます。

 -- の関数: locale.setlocale (category, locale=None)

     If 'locale' is given and not ‘None’, ‘setlocale()’ modifies the
     locale setting for the 'category'.  The available categories are
     listed in the data description below.  'locale' may be a *note
     string: 44ed, 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: 44ec. 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: 44ed, but without encoding.  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

     ‘setlocale()’ is not thread-safe on most systems.  Applications
     typically start with a call of:

          import locale
          locale.setlocale(locale.LC_ALL, '')

     から書き始めます。これは全てのカテゴリをユーザの環境における標準設
     定 (大抵は環境変数 ‘LANG’ で指定されています) に設定します。その後
     複数スレッドを使ってロケールを変更したりしない限り、問題は起こらな
     いはずです。

     バージョン 3.15 で変更: Support language codes with ‘@’-modifiers.

 -- の関数: locale.localeconv ()

     地域的な慣行のデータベースを辞書として返します。辞書は以下の文字列
     をキーとして持っています:

     カテゴリ                   キー                                      意味
                                                                          
     ----------------------------------------------------------------------------------------------------------
                                                                          
     *note LC_NUMERIC: 44ee.    ‘'decimal_point'’                         小数点を表す文字です。
                                                                          
                                                                          
                                ‘'grouping'’                              ‘'thousands_sep'’ が来るかもしれな
                                                                          い場所を相対的に表した数からなる配
                                                                          列です。配列が
                                                                          *note CHAR_MAX: 44ef. で終端されて
                                                                          いる場合、それ以上の桁では桁数字の
                                                                          グループ化を行いません。配列が ‘0’
                                                                          で終端されている場合、最後に指定し
                                                                          たグループが反復的に使われます。
                                                                          
                                                                          
                                ‘'thousands_sep'’                         桁グループ間を区切るために使われる
                                                                          文字です。
                                                                          
                                                                          
     *note LC_MONETARY: 44f0.   ‘'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: 44ef. を設定すると、そのロケールでは
     値が指定されていないことを表します。

     ‘'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(): 66e. は以下のキーのうち一つを受理します。
     ほとんどの記述は GNU C ライブラリ中の対応する説明から引用されていま
     す。

      -- データ: locale.CODESET

          選択されたロケールで用いられている文字エンコーディングの名前を
          文字列で取得します。

      -- データ: locale.D_T_FMT

          日付と時刻をロケール特有の方法で表現するために、 *note
          time.strftime(): 15a8. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.D_FMT

          日付をロケール特有の方法で表現するために、 *note
          time.strftime(): 15a8. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.T_FMT

          時刻をロケール特有の方法で表現するために、 *note
          time.strftime(): 15a8. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.T_FMT_AMPM

          時刻を午前／午後の書式で表現するために、 *note
          time.strftime(): 15a8. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: 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: 44f6. を日曜日
               とする慣行に従っています。国際的な (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: 451e.
               and *note NOEXPR: 451f. use syntax suitable for the
               ‘regex’ function from the C library, which might differ
               from the syntax used in *note re: c1.

      -- データ: 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(): 15a8. 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(): 15a8. の書式文字列として用いること
          のできる文字列を取得します。

      -- データ: locale.ERA_D_FMT

          日付をロケール固有の年代に基づいた方法で表現するために、 *note
          time.strftime(): 15a8. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.ERA_T_FMT

          時刻をロケール固有の年代に基づいた方法で表現するために、 *note
          time.strftime(): 15a8. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: 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: 44ed,
     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: 4526.  It defaults to
     *note LC_CTYPE: 4527.

     The language code has the same format as a *note locale name: 44ed,
     but without encoding.  The language code and encoding may be ‘None’
     if their values cannot be determined.  The "C" locale is
     represented as ‘(None, None)’.

     バージョン 3.15 で変更: ‘@’-modifier are no longer silently
     removed, but included in the language code.

 -- の関数: locale.getpreferredencoding (do_setlocale=True)

     テキストデータに使われる *note ロケールエンコーディング: 752. を、
     ユーザの設定に基づいて返します。ユーザの設定は異なるシステム間では
     異なった方法で表現され、システムによってはプログラミング的に得るこ
     とができないこともあるので、この関数が返すのはただの推測です。

     システムによっては、ユーザの設定を取得するために *note setlocale():
     23c. を呼び出す必要があるため、この関数はスレッド安全ではありません
     。 ‘setlocale()’ を呼び出す必要がない、または呼び出したくない場合、
     'do_setlocale' を ‘False’ に設定する必要があります。

     On Android or if the *note Python UTF-8 Mode: a4b. is enabled,
     always return ‘'utf-8'’, the *note locale encoding: 752. and the
     'do_setlocale' argument are ignored.

     The *note Python preinitialization: 4528. configures the LC_CTYPE
     locale.  See also the *note filesystem encoding and error handler:
     94d.

     バージョン 3.7 で変更: この関数は、 Android 上あるいは *note Python
     UTF-8 モード: a4b. が有効になっている場合、常に ‘"utf-8"’ を返すよ
     うになりました。

 -- の関数: locale.getencoding ()

     Get the current *note locale encoding: 752.:

        * On Android and VxWorks, return ‘"utf-8"’.

        * On Unix, return the encoding of the current *note LC_CTYPE:
          4527. 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: 4528. configures the LC_CTYPE
     locale.  See also the *note filesystem encoding and error handler:
     94d.

     This function is similar to *note getpreferredencoding(False): 94c.
     except this function ignores the *note Python UTF-8 Mode: a4b.

     Added in version 3.11.

 -- の関数: locale.normalize (localename)

     与えたロケール名を規格化したロケールコードを返します。返されるロケ
     ールコードは *note setlocale(): 23c. で使うために書式化されています
     。規格化が失敗した場合、もとの名前がそのまま返されます。

     与えたエンコードがシステムにとって未知の場合、標準の設定では、この
     関数は *note setlocale(): 23c. と同様に、エンコーディングをロケール
     コードにおける標準のエンコーディングに設定します。

 -- の関数: locale.strcoll (string1, string2)

     現在の *note LC_COLLATE: 452b. 設定に従って二つの文字列を比較します
     。他の比較を行う関数と同じように、 '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:
     44ee. 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: 44f0. の設定にあわせてフォ
     ーマットします。

     'symbol' が真の場合は、返される文字列に通貨記号が含まれるようになり
     ます。これはデフォルトの設定です。'grouping' が ‘True’ の場合(これ
     はデフォルトではありません)は、値をグループ化します。
     'international' が ‘True’ の場合(これはデフォルトではありません)は
     、国際的な通貨記号を使用します。

          注釈: この関数は 'C' ロケールでは動作しないので、まず *note
          setlocale(): 23c. でロケールを設定する必要があります。

 -- の関数: 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: 44ee. で設定された慣行に従って正規化され
     た数値文字列に変換します。

     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: 44ee. settings.

     Added in version 3.10.

 -- の関数: locale.atof (string, func=float)

     Converts a string to a number, following the *note LC_NUMERIC:
     44ee. settings, by calling 'func' on the result of calling *note
     delocalize(): 11dd. on 'string'.

 -- の関数: locale.atoi (string)

     文字列を *note LC_NUMERIC: 44ee. で設定された慣行に従って整数に変換
     します。

 -- データ: 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:
     1712.

 -- データ: locale.LC_COLLATE

     Locale category for sorting strings.  The functions *note
     strcoll(): 452a. and *note strxfrm(): 1a17. of the ‘locale’ module
     are affected.

 -- データ: locale.LC_TIME

     時刻を書式化するためのロケールカテゴリです。 *note time.strftime():
     15a8. はこのカテゴリに設定されている慣行に従います。

 -- データ: locale.LC_MONETARY

     金額に関係する値を書式化するためのロケールカテゴリです。設定可能な
     オプションは関数 *note localeconv(): fc1. で得ることができます。

 -- データ: locale.LC_MESSAGES

     メッセージ表示のためのロケールカテゴリです。現在 Python はアプリケ
     ーション毎にロケールに対応したメッセージを出力する機能はサポートし
     ていません。 *note os.strerror(): 325f. が返すような、オペレーティ
     ングシステムによって表示されるメッセージはこのカテゴリによって影響
     を受けます。

     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(): 932, *note atoi(): 452f, *note atof(): 452e. and
     *note str(): 452d. 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(): fc1. の返す特別な値のためのシンボル定数です。

* Menu:

* ロケールの背景、詳細、ヒント、助言および補足説明::
* Locale names::
* Python 拡張の作者と、Python を埋め込むようなプログラムに関して::
* メッセージカタログへのアクセス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 4527. カテゴリは
、現在のロケールエンコーディングをユーザーの希望するロケールエンコーディ
ングに設定するために、スタートアップで変更されます。他のカテゴリについて
は、プログラムは ‘setlocale(LC_ALL, '')’ を呼び出して、明示的にユーザの
希望するロケール設定を行わなければなりません。

*note setlocale(): 23c. をライブラリルーチン内で呼ぶことは、それがプログ
ラム全体に及ぼす副作用の面から、一般的によくない考えです。ロケールを保存
したり復帰したりするのもよくありません: 高価な処理であり、ロケールの設定
が復帰する以前に起動してしまった他のスレッドに悪影響を及ぼすからです。

もし、汎用を目的としたモジュールを作っていて、ロケールによって影響をうけ
るような操作 (例えば *note time.strftime(): 15a8. の書式の一部) のロケー
ル独立のバージョンが必要ということになれば、標準ライブラリルーチンを使わ
ずに何とかしなければなりません。よりましな方法は、ロケール設定が正しく利
用できているか確かめることです。最後の手段は、あなたのモジュールが ‘C’ ロ
ケール以外の設定には互換性がないとドキュメントに書くことです。

The only way to perform numeric operations according to the locale is to
use the special functions defined by this module: *note atof(): 452e,
*note atoi(): 452f, *note format_string(): 932, *note str(): 452d.

ロケールに従ってケース変換や文字分類を行う方法はありません。 (ユニコード
) テキスト文字列については、これらは文字の値のみによって行われます。その
一方、バイト文字列はバイトの 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(): 23c. を呼び出してはなりません。しかし、返される値もロケール
の復帰のために使えるだけなので、さほど便利とはいえません (例外はおそらく
ロケールが ‘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(): 66. 、 *note dgettext(): 4539. 、 *note
dcgettext(): 453a. 、 *note textdomain(): 453b. 、 *note
bindtextdomain(): 453c. 、および *note bind_textdomain_codeset(): 453d.
からなります。これらは *note gettext: 66. モジュールの同名の関数に似てい
ますが、メッセージカタログとして C ライブラリのバイナリフォーマットを使
い、メッセージカタログを探すために C ライブラリのサーチアルゴリズムを使
います。

Python applications should normally find no need to invoke these
functions, and should use *note gettext: 66. 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: f9. パッケージやその拡張の *note
tkinter.ttk: 102. モジュールを使って利用できます。

*note tkinter: f9. パッケージはオブジェクトの薄い層で作ったTcl/Tkの最上
層です。‘tkinter’ を使うには、Tcl のコードを書く必要はありませんが、Tk の
ドキュメント、またはときどき、Tcl のドキュメントを調べる 必要が出て来ま
す。‘tkinter’ は Python クラスとして実装した Tk ウィジェットのラッパーの
集合です。

*note tkinter: f9. の一番素晴らしい点は、速く、そしてほとんどの 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 ダイアログ::
* tkinter.messagebox: tkinter messagebox --- Tkinter メッセージプロンプト. Tkinter メッセージプロンプト
* tkinter.scrolledtext: tkinter scrolledtext --- スクロール可能なテキストウィジェット. スクロール可能なテキストウィジェット
* tkinter.dnd: tkinter dnd --- ドラッグアンドドロップのサポート. ドラッグアンドドロップのサポート
* tkinter.ttk: tkinter ttk --- Tk のテーマ付きウィジェット. Tk のテーマ付きウィジェット
* IDLE: IDLE --- Python のエディタとシェル<2>. Python のエディタとシェル
* turtle: turtle --- Turtle graphics. Turtle graphics

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/GuiProgramming


File: python.info,  Node: tkinter --- Tcl/Tk の Python インターフェース,  Next: tkinter colorchooser --- カラー選択ダイアログ,  Up: Graphical user interfaces with Tk

5.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 のドキュメントを参照する時にはそのバージ
ョン情報が役立つでしょう。

Tcl/Tkにはスレッド（並行処理）に対応しているものとそうでないものがあり、
tkinterはどちらのTcl/Tkにも対応しています。公式 Python にはスレッド対応
版 Tcl/Tk 8.6 が含まれています。対応バージョンについてさらに知りたい場合
は *note _tkinter: 3. モジュールのソースコードを参照してください。

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: 2366.  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
オプションのモジュールの要件: 2364.

参考
....

   * 
     TkDocs(2)

          Tkinterを使ったユーザインタフェースの作成に関する広範なチュー
          トリアルです。主要な概念を説明し、最新のAPI を使用した推奨され
          るアプローチを説明します。

   * 
     Tkinter 8.5 reference: a GUI for Python(3)

          参照: 利用可能なクラス、メソッド、オプションの詳細については、
          Tkinter 8.5のドキュメントを参照してください。

Tcl/Tk リソース:

   * 
     Tk commands(4)

          Comprehensive reference to each of the underlying Tcl/Tk
          commands used by Tkinter.

   * 
     Tcl/Tk ホームページ(5)

          Additional documentation, and links to Tcl/Tk core
          development.

Books:

   * 
     Modern Tkinter for Busy Python Developers(6)

          By Mark Roseman.  (ISBN 978-1999149567)

   * 
     Python GUI programming with Tkinter(7)

          By Alan D. Moore.  (ISBN 978-1788835886)

   * 
     Programming Python(8)

          By Mark Lutz; has excellent coverage of Tkinter.  (ISBN
          978-0596158101)

   * 
     Tcl and the Tk Toolkit (2nd edition)(9)

          By John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does
          not cover Tkinter.  (ISBN 978-0321336330)

* Menu:

* Architecture::
* Tkinter モジュール::
* Tkinter お助け手帳::
* Threading model::
* 簡単なリファレンス::
* ファイルハンドラ::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/tkinter/__init__.py

   (2) https://tkdocs.com/

   (3) https://www.tkdocs.com/shipman/

   (4) https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm

   (5) https://www.tcl.tk

   (6) https://tkdocs.com/book.html

   (7) 
https://www.packtpub.com/en-us/product/python-gui-programming-with-tkinter-9781788835886

   (8) https://learning-python.com/about-pp4e.html

   (9) https://www.amazon.com/exec/obidos/ASIN/032133633X


File: python.info,  Node: Architecture,  Next: Tkinter モジュール,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.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:
     4545. 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: 1bd5. 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: 102.

Internally, Tk and Ttk use facilities of the underlying operating
system, i.e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows.

When your Python application uses a class in Tkinter, e.g., to create a
widget, the ‘tkinter’ module first assembles a Tcl/Tk command string.
It passes that Tcl command string to an internal *note _tkinter: 3.
binary module, which then calls the Tcl interpreter to evaluate it.  The
Tcl interpreter will then call into the Tk and/or Ttk packages, which
will in turn make calls to Xlib, Cocoa, or GDI.

   ---------- Footnotes ----------

   (1) https://wiki.tcl-lang.org/37432


File: python.info,  Node: Tkinter モジュール,  Next: Tkinter お助け手帳,  Prev: Architecture,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.1.2 Tkinter モジュール
...........................

Support for Tkinter is spread across several modules.  Most applications
will need the main ‘tkinter’ module, as well as the *note tkinter.ttk:
102. module, which provides the modern themed widget set and API:

     from tkinter import *
     from tkinter import ttk

 -- クラス: tkinter.Tk (screenName=None, baseName=None, className='Tk',
          useTk=True, sync=False, use=None)

     Construct a toplevel Tk widget, which is usually the main window of
     an application, and initialize a Tcl interpreter for this widget.
     Each instance has its own associated Tcl interpreter.

     The ‘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(): 4547. function sets this to ‘False’.

     'sync'

          If ‘True’, execute all X server commands synchronously, so
          that errors are reported immediately.  Can be used for
          debugging.  (X11 only)

     'use'

          Specifies the 'id' of the window in which to embed the
          application, instead of it being created as an independent
          toplevel window.  'id' must be specified in the same way as
          the value for the -use option for toplevel widgets (that is,
          it has a form like that returned by ‘winfo_id()’).

          Note that on some platforms this will only work correctly if
          'id' refers to a Tk frame or toplevel that has its -container
          option enabled.

     ‘Tk’ reads and interprets profile files, named ‘.`className'.tcl’
     and ‘.`baseName'.tcl’, into the Tcl interpreter and calls *note
     exec(): 190. 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: 2e89.

      -- の属性: 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: 1a1e. attribute.

      -- の属性: master

          The widget object that contains this widget.  For ‘Tk’, the
          ‘master’ is *note None: a6a. because it is the main window.
          The terms 'master' and 'parent' are similar and sometimes used
          interchangeably as argument names; however, calling
          ‘winfo_parent()’ returns a string of the widget name whereas
          ‘master’ returns the object.  'parent'/'child' reflects the
          tree-like relationship while 'master' (or
          'container')/'content' reflects the container structure.

      -- の属性: children

          The immediate descendants of this widget as a *note dict: 193.
          with the child widget names as the keys and the child instance
          objects as the values.

 -- の関数: tkinter.Tcl (screenName=None, baseName=None, className='Tk',
          useTk=False)

     *note Tcl(): 4547. はファクトリ関数で、 *note Tk: 1bd5. クラスで生
     成するオブジェクトとよく似たオブジェクトを生成します。ただし Tk サ
     ブシステムを初期化しません。この関数は、余分なトップレベルウィンド
     ウを作る必要がなかったり、 (X サーバを持たない Unix/Linux システム
     などのように) 作成できない環境において Tcl インタプリタを駆動したい
     場合に便利です。 ‘Tcl()’ で生成したオブジェクトに対して ‘loadtk()’
     メソッドを呼び出せば、トップレベルウィンドウを作成 (して、Tk サブシ
     ステムを初期化) します。

The modules that provide Tk support include:

‘tkinter’

     Main Tkinter module.

*note tkinter.colorchooser: fa.

     ユーザに色を選択させるためのダイアログです。

*note tkinter.commondialog: fb.

     このリストの他のモジュールが定義しているダイアログの基底クラスです
     。

*note tkinter.filedialog: fd.

     ユーザが開きたいファイルや保存したいファイルを指定できるようにする
     共通のダイアログです。

*note tkinter.font: fe.

     フォントの扱いを補助するためのユーティリティです。

*note tkinter.messagebox: ff.

     標準的な Tk のダイアログボックスにアクセスします。

*note tkinter.scrolledtext: 100.

     垂直スクロールバー付きのテキストウィジェットです。

*note tkinter.simpledialog: 101.

     基本的なダイアログと便宜関数 (convenience function) です。

*note tkinter.ttk: 102.

     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: 76.

     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: fc.

     (experimental) Drag-and-drop support for ‘tkinter’.  This will
     become deprecated when it is replaced with the Tk DND.

*note turtle: 10a.

     Tk ウィンドウ上でタートルグラフィックスを実現します。


File: python.info,  Node: Tkinter お助け手帳,  Next: Threading model,  Prev: Tkinter モジュール,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.1.3 Tkinter お助け手帳
...........................

This section is not designed to be an exhaustive tutorial on either Tk
or Tkinter.  For that, refer to one of the external resources noted
earlier.  Instead, this section provides a very quick orientation to
what a Tkinter application looks like, identifies foundational Tk
concepts, and explains how the Tkinter wrapper is structured.

The remainder of this section will help you to identify the classes,
methods, and options you'll need in your Tkinter application, and where
to find more detailed documentation on them, including in the official
Tcl/Tk reference manual.

* Menu:

* A Hello World Program::
* Important Tk Concepts::
* Understanding How Tkinter Wraps Tcl/Tk::
* How do I...? What option does...?: How do I ? What option does ?.
* Navigating the Tcl/Tk Reference Manual::


File: python.info,  Node: A Hello World Program,  Next: Important Tk Concepts,  Up: Tkinter お助け手帳

5.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 ‘Tk’ class,
which initializes Tk and creates its associated Tcl interpreter.  It
also creates a toplevel window, known as the root window, which serves
as the main window of the application.

The following line creates a frame widget, which in this case will
contain a label and a button we'll create next.  The frame is fit inside
the root window.

The next line creates a label widget holding a static text string.  The
‘grid()’ method is used to specify the relative layout (position) of the
label within its containing frame widget, similar to how tables in HTML
work.

A button widget is then created, and placed to the right of the label.
When pressed, it will call the ‘destroy()’ method of the root window.

Finally, the ‘mainloop()’ method puts everything on the display, and
responds to user input until the program terminates.


File: python.info,  Node: Important Tk Concepts,  Next: Understanding How Tkinter Wraps Tcl/Tk,  Prev: A Hello World Program,  Up: Tkinter お助け手帳

5.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 ‘ttk.Frame’, ‘ttk.Label’, and ‘ttk.Button’.

widget hierarchy

     Widgets are arranged in a 'hierarchy'.  The label and button were
     contained within a frame, which in turn was contained within the
     root window.  When creating each 'child' widget, its 'parent'
     widget is passed as the first argument to the widget constructor.

configuration options

     Widgets have 'configuration options', which modify their appearance
     and behavior, such as the text to display in a label or button.
     Different classes of widgets will have different sets of options.

geometry management

     Widgets aren't automatically added to the user interface when they
     are created.  A 'geometry manager' like ‘grid’ controls where in
     the user interface they are placed.

event loop

     Tkinter reacts to user input, changes from your program, and even
     refreshes the display only when actively running an 'event loop'.
     If your program isn't running the event loop, your user interface
     won't update.


File: python.info,  Node: Understanding How Tkinter Wraps Tcl/Tk,  Next: How do I ? What option does ?,  Prev: Important Tk Concepts,  Up: Tkinter お助け手帳

5.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 ‘Tk’ instance.

Whether it's trying to navigate reference documentation, trying to find
the right method or option, adapting some existing code, or debugging
your Tkinter application, there are times that it will be useful to
understand what those underlying Tcl/Tk commands look like.

To illustrate, here is the Tcl/Tk equivalent of the main part of the
Tkinter script above.

     ttk::frame .frm -padding 10
     grid .frm
     grid [ttk::label .frm.lbl -text "Hello World!"] -column 0 -row 0
     grid [ttk::button .frm.btn -text "Quit" -command "destroy ."] -column 1 -row 0

Tcl's syntax is similar to many shell languages, where the first word is
the command to be executed, with arguments to that command following it,
separated by spaces.  Without getting into too many details, notice the
following:

   * The commands used to create widgets (like ‘ttk::frame’) correspond
     to widget classes in Tkinter.

   * Tcl widget options (like ‘-text’) correspond to keyword arguments
     in Tkinter.

   * Widgets are referred to by a 'pathname' in Tcl (like ‘.frm.btn’),
     whereas Tkinter doesn't use names but object references.

   * A widget's place in the widget hierarchy is encoded in its
     (hierarchical) pathname, which uses a ‘.’ (dot) as a path
     separator.  The pathname for the root window is just ‘.’ (dot).  In
     Tkinter, the hierarchy is defined not by pathname but by specifying
     the parent widget when creating each child widget.

   * Operations which are implemented as separate 'commands' in Tcl
     (like ‘grid’ or ‘destroy’) are represented as 'methods' on Tkinter
     widget objects.  As you'll see shortly, at other times Tcl uses
     what appear to be method calls on widget objects, which more
     closely mirror what is used in Tkinter.


File: python.info,  Node: How do I ? What option does ?,  Next: Navigating the Tcl/Tk Reference Manual,  Prev: Understanding How Tkinter Wraps Tcl/Tk,  Up: Tkinter お助け手帳

5.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(): 1324, can help you
identify what you need.

To find out what configuration options are available on any widget, call
its ‘configure()’ method, which returns a dictionary containing a
variety of information about each object, including its default and
current values.  Use ‘keys()’ to get just the names of each option.

     btn = ttk.Button(frm, ...)
     print(btn.configure().keys())

As most widgets have many configuration options in common, it can be
useful to find out which are specific to a particular widget class.
Comparing the list of options to that of a simpler widget, like a frame,
is one way to do that.

     print(set(btn.configure().keys()) - set(frm.configure().keys()))

Similarly, you can find the available methods for a widget object using
the standard *note dir(): a28. function.  If you try it, you'll see
there are over 200 common widget methods, so again identifying those
specific to a widget class is helpful.

     print(dir(btn))
     print(set(dir(btn)) - set(dir(frm)))


File: python.info,  Node: Navigating the Tcl/Tk Reference Manual,  Prev: How do I ? What option does ?,  Up: Tkinter お助け手帳

5.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, e.g.

     destroy .
     grid .frm.btn -column 0 -row 0

Others, however, look more like methods called on a widget object (in
fact, when you create a widget in Tcl/Tk, it creates a Tcl command with
the name of the widget pathname, with the first parameter to that
command being the name of a method to call).

     .frm.btn invoke
     .frm.lbl configure -text "Goodbye"

In the official Tcl/Tk reference documentation, you'll find most
operations that look like method calls on the man page for a specific
widget (e.g., you'll find the ‘invoke()’ method on the ttk::button(2)
man page), while functions that take a widget as a parameter often have
their own man page (e.g., grid(3)).

You'll find many common options and methods in the options(4) or
ttk::widget(5) man pages, while others are found in the man page for a
specific widget class.

You'll also find that many Tkinter methods have compound names, e.g.,
‘winfo_x()’, ‘winfo_height()’, ‘winfo_viewable()’.  You'd find
documentation for all of these in the winfo(6) man page.

     注釈: Somewhat confusingly, there are also methods on all Tkinter
     widgets that don't actually operate on the widget, but operate at a
     global scope, independent of any widget.  Examples are methods for
     accessing the clipboard or the system bell.  (They happen to be
     implemented as methods in the base ‘Widget’ class that all Tkinter
     widgets inherit from).

   ---------- Footnotes ----------

   (1) https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm

   (2) https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm

   (3) https://www.tcl.tk/man/tcl8.6/TkCmd/grid.htm

   (4) https://www.tcl.tk/man/tcl8.6/TkCmd/options.htm

   (5) https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_widget.htm

   (6) https://www.tcl.tk/man/tcl8.6/TkCmd/winfo.htm


File: python.info,  Node: Threading model,  Next: 簡単なリファレンス,  Prev: Tkinter お助け手帳,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.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 ‘Tk’ object created by ‘tkinter’ contains a Tcl interpreter.  It
also keeps track of which thread created that interpreter.  Calls to
‘tkinter’ can be made from any Python thread.  Internally, if a call
comes from a thread other than the one that created the ‘Tk’ object, an
event is posted to the interpreter's event queue, and when executed, the
result is returned to the calling Python thread.

Tcl/Tk applications are normally event-driven, meaning that after
initialization, the interpreter runs an event loop (i.e.
‘Tk.mainloop()’) and responds to events.  Because it is single-threaded,
event handlers must respond quickly, otherwise they will block other
events from being processed.  To avoid this, any long-running
computations should not run in an event handler, but are either broken
into smaller pieces using timers, or run in another thread.  This is
different from many GUI toolkits where the GUI runs in a completely
separate thread from all application code including event handlers.

If the Tcl interpreter is not running the event loop and processing
events, any ‘tkinter’ calls made from threads other than the one running
the Tcl interpreter will fail.

A number of special cases exist:

   * Tcl/Tk libraries can be built so they are not thread-aware.  In
     this case, ‘tkinter’ calls the library from the originating Python
     thread, even if this is different than the thread that created the
     Tcl interpreter.  A global lock ensures only one call occurs at a
     time.

   * While ‘tkinter’ allows you to create more than one instance of a
     ‘Tk’ object (with its own interpreter), all interpreters that are
     part of the same thread share a common event queue, which gets ugly
     fast.  In practice, don't create more than one instance of ‘Tk’ at
     a time.  Otherwise, it's best to create them in separate threads
     and ensure you're running a thread-aware Tcl/Tk build.

   * Blocking event handlers are not the only way to prevent the Tcl
     interpreter from reentering the event loop.  It is even possible to
     run multiple nested event loops or abandon the event loop entirely.
     If you're doing anything tricky when it comes to events or threads,
     be aware of these possibilities.

   * There are a few select ‘tkinter’ functions that presently work only
     when called from the thread that created the Tcl interpreter.


File: python.info,  Node: 簡単なリファレンス,  Next: ファイルハンドラ,  Prev: Threading model,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.1.10 簡単なリファレンス
............................

* Menu:

* オプションの設定::
* Packer::
* Packer のオプション::
* ウィジェット変数を関連付ける::
* ウィンドウマネージャ::
* Tk オプションデータ型::
* バインドとイベント::
* index パラメータ::
* 画像::


File: python.info,  Node: オプションの設定,  Next: Packer,  Up: 簡単なリファレンス

5.26.1.11 オプションの設定
..........................

オプションは、色やウィジェットの境界線幅などを制御します。オプションの設
定には三通りの方法があります:

オブジェクト生成時、キーワード引数を使用する

          fred = Button(self, fg="red", bg="blue")

オブジェクト生成後、オプション名を辞書インデックスのように扱う

          fred["fg"] = "red"
          fred["bg"] = "blue"

オブジェクト生成後に、config()メソッドを使って複数の属性を更新する

          fred.config(fg="red", bg="blue")

オプションとその振る舞いに関する詳細な説明は、該当するウィジェットの Tk
の man ページを参照してください。

man ページには、各ウィジェットの "STANDARD OPTIONS (標準オプション)" と
"WIDGET SPECIFIC OPTIONS (ウィジェット固有のオプション)" がリストされて
いることに注意してください。前者は多くのウィジェットに共通のオプションの
リストで、後者は特定のウィジェットに特有のオプションです。標準オプション
の説明は man ページの ‘options(3)(1)’ にあります。

このドキュメントでは、標準オプションとウィジェット固有のオプションを区別
していません。オプションによっては、ある種のウィジェットに適用できません
。あるウィジェットがあるオプションに対応しているかどうかは、ウィジェット
のクラスによります。例えばボタンには ‘command’ オプションがありますが、
ラベルにはありません。

あるウィジェットがどんなオプションをサポートしているかは、ウィジェットの
man ページにリストされています。また、実行時にウィジェットの ‘config()’
メソッドを引数なしで呼び出したり、 ‘keys()’ メソッドを呼び出したりして問
い合わせることもできます。メソッド呼び出しを行うと辞書型の値を返します。
この辞書は、オプションの名前がキー (例えば ‘'relief'’) になっていて、値
が 5 要素のタプルになっています。

‘bg’ のように、いくつかのオプションはより長い名前を持つ共通のオプション
に対する同義語になっています (‘bg’ は "background" を短縮したものです)。
短縮形のオプション名を ‘config()’ に渡すと、 5 要素ではなく 2 要素のタプ
ルを返します。このタプルには、同義語の名前と「本当の」オプション名が入っ
ています (例えば ‘('bg', 'background')’)。

インデッ    意味                                  使用例
クス                                              

---------------------------------------------------------------------
                                                  
0           オプション名                          ‘'relief'’
                                                  
                                                  
1           データベース検索用のオプション名      ‘'relief'’
                                                  
                                                  
2           データベース検索用のオプションクラ    ‘'Relief'’
            ス                                    
            
                                                  
3           デフォルト値                          ‘'raised'’
                                                  
                                                  
4           現在の値                              ‘'groove'’
                                                  

以下はプログラム例です:

     >>> print(fred.config())
     {'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}

もちろん、実際に出力される辞書には利用可能なオプションが全て表示されます
。上の表示例は単なる例にすぎません。

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/options(3)


File: python.info,  Node: Packer,  Next: Packer のオプション,  Prev: オプションの設定,  Up: 簡単なリファレンス

5.26.1.12 Packer
................

The packer is one of Tk's geometry-management mechanisms.  Geometry
managers are used to specify the relative positioning of widgets within
their container.  In contrast to the more cumbersome 'placer' (which is
used less commonly, and we do not cover here), the packer takes
qualitative relationship specification - 'above', 'to the left of',
'filling', etc - and works everything out to determine the exact
placement coordinates for you.

The size of any container widget is determined by the size of the
"content widgets" inside.  The packer is used to control where content
widgets appear inside the container into which they are packed.  You can
pack widgets into frames, and frames into other frames, in order to
achieve the kind of layout you desire.  Additionally, the arrangement is
dynamically adjusted to accommodate incremental changes to the
configuration, once it is packed.

ジオメトリマネージャがウィジェットのジオメトリを確定するまで、ウィジェッ
トは表示されないので注意してください。初心者のころにはよくジオメトリの確
定を忘れてしまい、ウィジェットを生成したのに何も表示されず驚くことになり
ます。ウィジェットは、(例えば packer の ‘pack()’ メソッドを適用して) ジ
オメトリを確定した後で初めて表示されます。

pack() メソッドは、キーワード引数つきで呼び出せます。キーワード引数は、
ウィジェットをコンテナ内のどこに表示するか、メインのアプリケーションウィ
ンドウをリサイズしたときにウィジェットがどう振舞うかを制御します。以下に
例を示します:

     fred.pack()                     # defaults to side = "top"
     fred.pack(side="left")
     fred.pack(expand=1)


File: python.info,  Node: Packer のオプション,  Next: ウィジェット変数を関連付ける,  Prev: Packer,  Up: 簡単なリファレンス

5.26.1.13 Packer のオプション
.............................

packer と packer の取りえるオプションについての詳細は、man ページや John
Ousterhout の本の183ページを参照してください。

anchor

     Anchor type.  Denotes where the packer is to place each content in
     its parcel.

expand

     ブール値で、 ‘0’ または ‘1’ になります。

fill

     指定できる値は ‘'x'’ 、 ‘'y'’ 、 ‘'both'’ 、 ‘'none'’ です。

ipadx および ipady

     A distance - designating internal padding on each side of the
     content.

padx および pady

     A distance - designating external padding on each side of the
     content.

side

     指定できる値は ‘'left'’, ‘'right'’, ‘'top'’, ‘'bottom'’ です。


File: python.info,  Node: ウィジェット変数を関連付ける,  Next: ウィンドウマネージャ,  Prev: Packer のオプション,  Up: 簡単なリファレンス

5.26.1.14 ウィジェット変数を関連付ける
......................................

ウィジェットによっては、(テキスト入力ウィジェットのように) 特殊なオプシ
ョンを使って、現在設定されている値をアプリケーション内の変数に直接関連付
けできます。このようなオプションには ‘variable’, ‘textvariable’,
‘onvalue’, ‘offvalue’ および ‘value’ があります。この関連付けは双方向に
働きます: 変数の値が何らかの理由で変更されると、関連付けされているウィジ
ェットも更新され、新しい値を反映します。

Unfortunately, in the current implementation of ‘tkinter’ it is not
possible to hand over an arbitrary Python variable to a widget through a
‘variable’ or ‘textvariable’ option.  The only kinds of variables for
which this works are variables that are subclassed from a class called
Variable, defined in ‘tkinter’.

Variable には、 ‘StringVar’, ‘IntVar’, ‘DoubleVar’, ‘BooleanVar’ といっ
た便利なサブクラスがすでにすでに数多く定義されています。こうした変数の現
在の値を読み出したければ、 ‘get()’ メソッドを呼び出します。また、値を変
更したければ ‘set()’ メソッドを呼び出します。このプロトコルに従っている
限り、それ以上なにも手を加えなくてもウィジェットは常に現在値に追従します
。

例えば:

     import tkinter as tk

     class App(tk.Frame):
         def __init__(self, master):
             super().__init__(master)
             self.pack()

             self.entrythingy = tk.Entry()
             self.entrythingy.pack()

             # Create the application variable.
             self.contents = tk.StringVar()
             # Set it to some value.
             self.contents.set("this is a variable")
             # Tell the entry widget to watch this variable.
             self.entrythingy["textvariable"] = self.contents

             # Define a callback for when the user hits return.
             # It prints the current value of the variable.
             self.entrythingy.bind('<Key-Return>',
                                  self.print_contents)

         def print_contents(self, event):
             print("Hi. The current entry content is:",
                   self.contents.get())

     root = tk.Tk()
     myapp = App(root)
     myapp.mainloop()


File: python.info,  Node: ウィンドウマネージャ,  Next: Tk オプションデータ型,  Prev: ウィジェット変数を関連付ける,  Up: 簡単なリファレンス

5.26.1.15 ウィンドウマネージャ
..............................

In Tk, there is a utility command, ‘wm’, for interacting with the window
manager.  Options to the ‘wm’ command allow you to control things like
titles, placement, icon bitmaps, and the like.  In ‘tkinter’, these
commands have been implemented as methods on the ‘Wm’ class.  Toplevel
widgets are subclassed from the ‘Wm’ class, and so can call the ‘Wm’
methods directly.

To get at the toplevel window that contains a given widget, you can
often just refer to the widget's ‘master’.  Of course if the widget has
been packed inside of a frame, the ‘master’ won't represent a toplevel
window.  To get at the toplevel window that contains an arbitrary
widget, you can call the ‘_root()’ method.  This method begins with an
underscore to denote the fact that this function is part of the
implementation, and not an interface to Tk functionality.

以下に典型的な使い方の例をいくつか挙げます:

     import tkinter as tk

     class App(tk.Frame):
         def __init__(self, master=None):
             super().__init__(master)
             self.pack()

     # create the application
     myapp = App()

     #
     # here are method calls to the window manager class
     #
     myapp.master.title("My Do-Nothing Application")
     myapp.master.maxsize(1000, 400)

     # start the program
     myapp.mainloop()


File: python.info,  Node: Tk オプションデータ型,  Next: バインドとイベント,  Prev: ウィンドウマネージャ,  Up: 簡単なリファレンス

5.26.1.16 Tk オプションデータ型
...............................

anchor

     指定できる値はコンパスの方位です: ‘"n"’ 、 ‘"ne"’ 、 ‘"e"’ 、
     ‘"se"’ 、 ‘"s"’ 、 ‘"sw"’ 、 ‘"w"’ 、 ‘"nw"’ 、および ‘"center"’ 。

bitmap

     八つの組み込み、名前付きビットマップ: ‘'error'’ 、 ‘'gray25'’ 、
     ‘'gray50'’ 、 ‘'hourglass'’ 、 ‘'info'’ 、 ‘'questhead'’ 、
     ‘'question'’ 、 ‘'warning'’ 。 X ビットマップファイル名を指定するた
     めに、 ‘"@/usr/contrib/bitmap/gumby.bit"’ のような ‘@’ を先頭に付け
     たファイルへの完全なパスを与えてください。

boolean

     整数 0 または 1 、あるいは、文字列 ‘"yes"’ または ‘"no"’ を渡すこと
     ができます。

callback

     これは引数を取らない Python 関数ならどれでも構いません。例えば:

          def print_it():
              print("hi there")
          fred["command"] = print_it

color

     Colors can be given as the names of X colors in the rgb.txt file,
     or as strings representing RGB values in 4 bit: ‘"#RGB"’, 8 bit:
     ‘"#RRGGBB"’, 12 bit: ‘"#RRRGGGBBB"’, or 16 bit: ‘"#RRRRGGGGBBBB"’
     ranges, where R,G,B here represent any legal hex digit.  See page
     160 of Ousterhout's book for details.

cursor

     ‘cursorfont.h’ の標準Xカーソル名を、接頭語 ‘XC_’ 無しで使うことがで
     きます。例えば、handカーソル(‘XC_hand2’)を得るには、文字列
     ‘"hand2"’ を使ってください。あなた自身のビットマップとマスクファイ
     ルを指定することもできます。 Ousterhout の本の179ページを参照してく
     ださい。

distance

     スクリーン上の距離をピクセルか絶対距離のどちらかで指定できます。ピ
     クセルは数値として与えられ、絶対距離は文字列として与えられます。絶
     対距離を表す文字列は、単位を表す終了文字 (センチメートルには ‘c’ 、
     インチには ‘i’ 、ミリメートルには ‘m’ 、プリンタのポイントには
     ‘p’)を伴います。例えば、3.5インチは ‘"3.5i"’ と表現します。

font

     Tkはフォント名の形式に ‘{courier 10 bold}’ のようなリストを使います
     。正の数のフォントサイズはポイント単位で使用され、負の数のサイズは
     ピクセル単位と見なされます。

geometry

     これは ‘widthxheight’ 形式の文字列です。ここでは、ほとんどのウィジ
     ェットに対して幅と高さピクセル単位で (テキストを表示するウィジェッ
     トに対しては文字単位で)表されます。例えば: ‘fred["geometry"] =
     "200x100"’ 。

justify

     Legal values are the strings: ‘"left"’, ‘"center"’, and ‘"right"’.

region

     これは空白で区切られた四つの要素をもつ文字列です。各要素は指定可能
     な距離です(以下を参照)。例えば: ‘"2 3 4 5"’ と ‘"3i 2i 4.5i 2i"’ と
     ‘"3c 2c 4c 10.43c"’ は、すべて指定可能な範囲です。

relief

     ウィジェットのボーダのスタイルが何かを決めます。指定できる値は:
     ‘"raised"’ 、 ‘"sunken"’ 、 ‘"flat"’ 、 ‘"groove"’ 、と ‘"ridge"’ 。

scrollcommand

     これはほとんどの場合スクロールバーウィジェットの ‘set()’ メソッドで
     すが、1 個の引数を取るあらゆるウィジェットにもなりえます。

wrap

     次の中の一つでなければなりません: ‘"none"’ 、 ‘"char"’ 、あるいは
     ‘"word"’ 。


File: python.info,  Node: バインドとイベント,  Next: index パラメータ,  Prev: Tk オプションデータ型,  Up: 簡単なリファレンス

5.26.1.17 バインドとイベント
............................

ウィジェットコマンドからの bind メソッドによって、あるイベントを待つこと
と、そのイベント型が起きたときにコールバック関数を呼び出すことができるよ
うになります。 bind メソッドの形式は:

     def bind(self, sequence, func, add=''):

ここでは:

sequence

     is a string that denotes the target kind of event.  (See the
     ‘bind(3tk)(1)’ man page, and page 201 of John Ousterhout's book,
     ‘Tcl and the Tk Toolkit (2nd edition)’, for details).

func

     は一引数を取り、イベントが起きるときに呼び出される Python 関数です
     。イベント・インスタンスが引数として渡されます。 (このように実施さ
     れる関数は、一般に 'callbacks' として知られています。)

add

     はオプションで、 ‘''’ か ‘'+'’ のどちらかです。空文字列を渡すことは
     、このイベントが関係する他のどんなバインドをもこのバインドが置き換
     えることを意味します。 ‘'+'’ を使う仕方は、この関数がこのイベント型
     にバインドされる関数のリストに追加されることを意味しています。

例えば:

     def turn_red(self, event):
         event.widget["activeforeground"] = "red"

     self.button.bind("<Enter>", self.turn_red)

イベントのウィジェットフィールドが ‘turn_red()’ コールバック内でどのよう
にアクセスされているかに注目してください。このフィールドは X イベントを
捕らえたウィジェットを含んでいます。以下の表はアクセスできる他のイベント
フィールドとそれらの Tk での表現方法の一覧です。Tk man ページを参照する
ときに役に立つでしょう。

Tk       Tkinter イベントフィー    Tk       Tkinter イベントフィー
         ルド                               ルド
                                            
----------------------------------------------------------------------
                                            
%f       focus                     %A       char
                                            
                                            
%h       高さ                      %E       send_event
                                            
                                            
%k       keycode                   %K       keysym
                                            
                                            
%s       state                     %N       keysym_num
                                            
                                            
%t       time                      %T       type
                                            
                                            
%w       幅                        %W       widget
                                            
                                            
%x       x                         %X       x_root
                                            
                                            
%y       y                         %Y       y_root
                                            

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/bind(3tk)


File: python.info,  Node: index パラメータ,  Next: 画像,  Prev: バインドとイベント,  Up: 簡単なリファレンス

5.26.1.18 index パラメータ
..........................

多くのウィジェットにはパラメータ "index" を渡す必要があります。これらは
テキストウィジェット内の特定の位置や、エントリウィジェット内の特定の文字
、あるいはメニューウィジェット内の特定のメニューアイテムを指定するために
使用されます。

エントリウィジェットのインデックス(インデックス、ビューインデックスなど)

     Entry widgets have options that refer to character positions in the
     text being displayed.  You can use these ‘tkinter’ functions to
     access these special points in text widgets:

テキストウィジェットのインデックス

     テキストウィジェットに対するインデックス記法はとても機能が豊富で、
     Tk manページでよく説明されています。

メニューのインデックス(menu.invoke()、menu.entryconfig()など)

     メニューに対するいくつかのオプションとメソッドは特定のメニュー項目
     を操作します。メニューインデックスはオプションまたはパラメータのた
     めに必要とされるときはいつでも、以下のものを渡すことができます:

        * ウィジェット内の数字の先頭からの位置を指す整数。先頭は 0。

        * 文字列 ‘"active"’。現在カーソルがあるメニューの位置を指します
          。

        * 文字列 ‘"last"’ 。最後のメニューを指します。

        * ‘@6’ のような ‘@’ が前に来る整数。ここでは、整数がメニューの座
          標系における y ピクセル座標として解釈されます。

        * 文字列 ‘"none"’。どんなメニューエントリもまったく指しておらず
          、ほとんどの場合、すべてのエントリの動作を停止させるために
          menu.activate() と一緒に使われます。そして、最後に、

        * メニューの先頭から一番下までスキャンしたときに、メニューエント
          リのラベルに一致したパターンであるテキスト文字列。このインデッ
          クス型は他すべての後に考慮されることに注意してください。その代
          わりに、それは ‘last’ 、 ‘active’ または ‘none’ とラベル付けさ
          れたメニュー項目への一致は上のリテラルとして解釈されることを意
          味します。


File: python.info,  Node: 画像,  Prev: index パラメータ,  Up: 簡単なリファレンス

5.26.1.19 画像
..............

様々な形式の画像を、それに対応する ‘tkinter.Image’ のサブクラスを使って
作成できます:

   * XBM 形式の画像のための ‘BitmapImage’ 。

   * PGM, PPM, GIF, PNG 形式の画像のための ‘PhotoImage’ 。 最後のは Tk
     8.6 からサポートされるようになりました。

画像のどちらの型でも ‘file’ または ‘data’ オプションを使って作られます
(その上、他のオプションも利用できます)。

バージョン 3.13 で変更: Added the ‘PhotoImage’ method ‘copy_replace()’
to copy a region from one image to other image, possibly with pixel
zooming and/or subsampling.  Add 'from_coords' parameter to ‘PhotoImage’
methods ‘copy()’, ‘zoom()’ and ‘subsample()’.  Add 'zoom' and
'subsample' parameters to ‘PhotoImage’ method ‘copy()’.

‘image’ オプションがウィジェットにサポートされるところならどこでも、画像
オブジェクトを使うことができます (例えば、ラベル、ボタン、メニュー)。こ
れらの場合では、Tk は画像への参照を保持しないでしょう。画像オブジェクト
への最後の Python の参照が削除されたときに、画像データも削除されます。そ
して、どこで画像が使われていようとも、Tk は空の箱を表示します。

参考
....

The Pillow(1) package adds support for formats such as BMP, JPEG, TIFF,
and WebP, among others.

   ---------- Footnotes ----------

   (1) https://python-pillow.org/


File: python.info,  Node: ファイルハンドラ,  Prev: 簡単なリファレンス,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.1.20 ファイルハンドラ
..........................

Tk を使うとコールバック関数の登録や解除ができ、ファイルディスクリプタに
対する入出力が可能なときに、Tk のメインループからその関数が呼ばれます。
ファイルディスクリプタ1つにつき、1つだけハンドラは登録されます。コード例
です:

     import tkinter
     widget = tkinter.Tk()
     mask = tkinter.READABLE | tkinter.WRITABLE
     widget.tk.createfilehandler(file, mask, callback)
     ...
     widget.tk.deletefilehandler(file)

これらの機能は Windows では利用できません。

読み込みに使えるバイト数は分からないので、 *note BufferedIOBase: a88. ク
ラスや *note TextIOBase: a89. クラスの *note read(): 16e2. メソッドおよ
び *note readline(): 16e3. メソッドを使おうとしないでください。これらは
読み込みの際に、あらかじめ決められたバイト数を要求するのです。ソケットに
は、 *note recv(): 1161. や *note recvfrom(): 1162. メソッドを使うといい
です。その他のファイルには、 raw 読み込みか ‘os.read(file.fileno(),
maxbytecount)’ を使ってください。

 -- メソッド: Widget.tk.createfilehandler (file, mask, func)

     ファイルハンドラであるコールバック関数 'func' を登録します。 'file'
     引数は、 (ファイルやソケットオブジェクトのような) *note fileno():
     19d2. メソッドを持つオブジェクトか、整数のファイルディスクリプタと
     なります。 'mask' 引数は、以下にある3つの定数の組み合わせの OR を取
     ったものです。コールバックは次のように呼ばれます:

          callback(file, mask)

 -- メソッド: Widget.tk.deletefilehandler (file)

     ファイルハンドラの登録を解除します。

 -- データ: _tkinter.READABLE
 -- データ: _tkinter.WRITABLE
 -- データ: _tkinter.EXCEPTION

     'mask' 引数で使う定数です。


File: python.info,  Node: tkinter colorchooser --- カラー選択ダイアログ,  Next: tkinter font --- Tkinter フォントラッパー,  Prev: tkinter --- Tcl/Tk の Python インターフェース,  Up: Graphical user interfaces with Tk

5.26.2 ‘tkinter.colorchooser’ -- カラー選択ダイアログ
-----------------------------------------------------

'ソースコード:' Lib/tkinter/colorchooser.py(1)

__________________________________________________________________

The ‘tkinter.colorchooser’ module provides the *note Chooser: 4566.
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: 4567. class.

 -- クラス: tkinter.colorchooser.Chooser (master=None, **options)

 -- の関数: tkinter.colorchooser.askcolor (color=None, **options)

     カラー選択ダイアログを作成します。このメソッドを呼び出すと、ウィン
     ドウが表示されユーザーが選択するのを待ち、選択された色（もしくは
     ‘None’ ）を呼び出し元に返します。

参考
....

モジュール *note tkinter.commondialog: fb.

     Tkinter標準ダイアログモジュール

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/tkinter/colorchooser.py


File: python.info,  Node: tkinter font --- Tkinter フォントラッパー,  Next: Tkinter ダイアログ,  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: 1ee3. 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.

          arguments:

                    'font' - font specifier tuple (family, size, options)
                    'name' - unique font name
                    'exists' - self points to existing named font if true

          additional keyword options (ignored if 'font' is specified):

                    'family' - font family i.e. Courier, Times
                    'size' - font size
                         If 'size' is positive it is interpreted as size in points.
                         If 'size' is a negative number its absolute value is treated
                         as size in pixels.
                    'weight' - font emphasis (NORMAL, BOLD)
                    'slant' - ROMAN, ITALIC
                    'underline' - font underlining (0 - none, 1 - underline)
                    'overstrike' - font strikeout (0 - none, 1 - strikeout)

      -- メソッド: actual (option=None, displayof=None)

          Return the attributes of the font.

      -- メソッド: cget (option)

          Retrieve an attribute of the font.

      -- メソッド: config (**options)

          Modify attributes of the font.

      -- メソッド: copy ()

          Return new instance of the current font.

      -- メソッド: measure (text, displayof=None)

          Return amount of space the text would occupy on the specified
          display when formatted in the current font.  If no display is
          specified then the main application window is assumed.

      -- メソッド: metrics (*options, **kw)

          Return font-specific data.  Options include:

          'ascent' - distance between baseline and highest point that a

               character of the font can occupy

          'descent' - distance between baseline and lowest point that a

               character of the font can occupy

          'linespace' - minimum vertical separation necessary between any two

               characters of the font that ensures no vertical overlap
               between lines.

          'fixed' - 1 if font is fixed-width else 0

 -- の関数: tkinter.font.families (root=None, displayof=None)

     Return the different font families.

 -- の関数: tkinter.font.names (root=None)

     Return the names of defined fonts.

 -- の関数: tkinter.font.nametofont (name, root=None)

     Return a *note Font: 1ee3. representation of a tk named font.

     バージョン 3.10 で変更: The 'root' parameter was added.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/tkinter/font.py


File: python.info,  Node: Tkinter ダイアログ,  Next: tkinter messagebox --- Tkinter メッセージプロンプト,  Prev: tkinter font --- Tkinter フォントラッパー,  Up: Graphical user interfaces with Tk

5.26.4 Tkinter ダイアログ
-------------------------

* Menu:

* tkinter.simpledialog: tkinter simpledialog --- Standard Tkinter input dialogs. Standard Tkinter input dialogs
* tkinter.filedialog: tkinter filedialog --- File selection dialogs. File selection dialogs
* tkinter.commondialog: tkinter commondialog --- Dialog window templates. Dialog window templates


File: python.info,  Node: tkinter simpledialog --- Standard Tkinter input dialogs,  Next: tkinter filedialog --- File selection dialogs,  Up: Tkinter ダイアログ

5.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, **kw)
 -- の関数: tkinter.simpledialog.askinteger (title, prompt, **kw)
 -- の関数: tkinter.simpledialog.askstring (title, prompt, **kw)

     上の３つの関数は、ユーザーに期待する型の値を入力を促すダイアログを
     提供します。

 -- クラス: tkinter.simpledialog.Dialog (parent, title=None)

     カスタムダイアログ用の基底クラスです。

      -- メソッド: body (master)

          ダイアログインターフェースの構築をオーバーライドし、初期フォー
          カスを持つべきウィジットを返します。

      -- メソッド: buttonbox ()

          デフォルト動作はOKとCancelボタンを追加します。カスタムのボタン
          レイアウトが必要であればオーバーライドします。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/tkinter/simpledialog.py


File: python.info,  Node: tkinter filedialog --- File selection dialogs,  Next: tkinter commondialog --- Dialog window templates,  Prev: tkinter simpledialog --- Standard Tkinter input dialogs,  Up: Tkinter ダイアログ

5.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:

* ネイティブの読み込み/保存ダイアログ::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/tkinter/filedialog.py


File: python.info,  Node: ネイティブの読み込み/保存ダイアログ,  Up: tkinter filedialog --- File selection dialogs

5.26.4.3 ネイティブの読み込み/保存ダイアログ
............................................

下記のクラスは、振る舞いをカスタマイズできる設定オプション付きの、ネイテ
ィブルック＆フィールと統合したファイルダイアログを提供します。以下のキー
ワード引数は、下記で列挙するクラスや関数に適用できます。

          'parent' - ダイアログをその上に表示するウィンドウ

          'title' - ウィンドウのタイトル

          'initialdir' - 最初に表示するディレクトリ

          'initialfile' - ダイアログを表示した際に選択するファイル

          'filetypes' - (ラベル, パターン) のタプルからなるシーケンスで、'*' ワイルドカードが利用できます

          'defaultextension' - ファイルに追加するデフォルトの拡張子 (保存ダイアログ向け)

          'multiple' - 真の場合、複数要素の選択を許可します

'静的なファクトリ関数'

The below functions when called create a modal, native look-and-feel
dialog, wait for the user's selection, then return the selected value(s)
or ‘None’ to the caller.

 -- の関数: tkinter.filedialog.askopenfile (mode='r', **options)
 -- の関数: tkinter.filedialog.askopenfiles (mode='r', **options)

     The above two functions create an *note Open: 4585. dialog and
     return the opened file object(s) in read-only mode.

 -- の関数: tkinter.filedialog.asksaveasfile (mode='w', **options)

     Create a *note SaveAs: 4587. dialog and return a file object opened
     in write-only mode.

 -- の関数: tkinter.filedialog.askopenfilename (**options)
 -- の関数: tkinter.filedialog.askopenfilenames (**options)

     The above two functions create an *note Open: 4585. dialog and
     return the selected filename(s) that correspond to existing
     file(s).

 -- の関数: tkinter.filedialog.asksaveasfilename (**options)

     Create a *note SaveAs: 4587. dialog and return the selected
     filename.

 -- の関数: tkinter.filedialog.askdirectory (**options)

          Prompt user to select a directory.
          Additional keyword option:
               'mustexist' - determines if selection must be an existing directory.

 -- クラス: tkinter.filedialog.Open (master=None, **options)
 -- クラス: tkinter.filedialog.SaveAs (master=None, **options)

     The above two classes provide native dialog windows for saving and
     loading files.

'便利なクラス'

The below classes are used for creating file/directory windows from
scratch.  These do not emulate the native look-and-feel of the platform.

 -- クラス: tkinter.filedialog.Directory (master=None, **options)

     Create a dialog prompting the user to select a directory.

     注釈: The 'FileDialog' class should be subclassed for custom event
     handling and behaviour.

 -- クラス: tkinter.filedialog.FileDialog (master, title=None)

     Create a basic file selection dialog.

      -- メソッド: cancel_command (event=None)

          Trigger the termination of the dialog window.

      -- メソッド: dirs_double_event (event)

          Event handler for double-click event on directory.

      -- メソッド: dirs_select_event (event)

          Event handler for click event on directory.

      -- メソッド: files_double_event (event)

          Event handler for double-click event on file.

      -- メソッド: files_select_event (event)

          Event handler for single-click event on file.

      -- メソッド: filter_command (event=None)

          Filter the files by directory.

      -- メソッド: get_filter ()

          Retrieve the file filter currently in use.

      -- メソッド: get_selection ()

          Retrieve the currently selected item.

      -- メソッド: go (dir_or_file=os.curdir, pattern='*', default='',
               key=None)

          Render dialog and start event loop.

      -- メソッド: ok_event (event)

          Exit dialog returning current selection.

      -- メソッド: quit (how=None)

          Exit dialog returning filename, if any.

      -- メソッド: set_filter (dir, pat)

          Set the file filter.

      -- メソッド: set_selection (file)

          Update the current file selection to 'file'.

 -- クラス: tkinter.filedialog.LoadFileDialog (master, title=None)

     A subclass of FileDialog that creates a dialog window for selecting
     an existing file.

      -- メソッド: ok_command ()

          Test that a file is provided and that the selection indicates
          an already existing file.

 -- クラス: tkinter.filedialog.SaveFileDialog (master, title=None)

     A subclass of FileDialog that creates a dialog window for selecting
     a destination file.

      -- メソッド: ok_command ()

          Test whether or not the selection points to a valid file that
          is not a directory.  Confirmation is required if an already
          existing file is selected.


File: python.info,  Node: tkinter commondialog --- Dialog window templates,  Prev: tkinter filedialog --- File selection dialogs,  Up: Tkinter ダイアログ

5.26.4.4 ‘tkinter.commondialog’ -- Dialog window templates
..........................................................

'Source code:' Lib/tkinter/commondialog.py(1)

__________________________________________________________________

The ‘tkinter.commondialog’ module provides the *note Dialog: 4567. class
that is the base class for dialogs defined in other supporting modules.

 -- クラス: tkinter.commondialog.Dialog (master=None, **options)

      -- メソッド: show (**options)

          Render the Dialog window.

参考
....

Modules *note tkinter.messagebox: ff, *note ファイルを読み書きする:
2273.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/tkinter/commondialog.py


File: python.info,  Node: tkinter messagebox --- Tkinter メッセージプロンプト,  Next: tkinter scrolledtext --- スクロール可能なテキストウィジェット,  Prev: Tkinter ダイアログ,  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 and will return a subset of (‘True’,
‘False’, ‘None’, *note OK: 45a4, *note CANCEL: 45a5, *note YES: 45a6,
*note NO: 45a7.) based on the user's selection.  Common message box
styles and layouts include but are not limited to:

[image src="python-figures/tk_msg.png"]


Figure
 -- クラス: tkinter.messagebox.Message (master=None, **options)

     Create a message window with an application-specified message, an
     icon and a set of buttons.  Each of the buttons in the message
     window is identified by a unique symbolic name (see the 'type'
     options).

     The following options are supported:

          'command'

               Specifies the function to invoke when the user closes the
               dialog.  The name of the button clicked by the user to
               close the dialog is passed as argument.  This is only
               available on macOS.

          'default'

               Gives the *note symbolic name: 45a9. of the default
               button for this message window (*note OK: 45a4, *note
               CANCEL: 45a5, 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: 45aa. to display.  If this
               option is not specified, then the *note INFO: 45ab. 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: 45ac. to
               be displayed.

      -- メソッド: show (**options)

          Display a message window and wait for the user to select one
          of the buttons.  Then return the symbolic name of the selected
          button.  Keyword arguments can override options specified in
          the constructor.

'情報メッセージボックス'

 -- の関数: tkinter.messagebox.showinfo (title=None, message=None,
          **options)

     Creates and displays an information message box with the specified
     title and message.

'警告メッセージボックス'

 -- の関数: tkinter.messagebox.showwarning (title=None, message=None,
          **options)

     Creates and displays a warning message box with the specified title
     and message.

 -- の関数: tkinter.messagebox.showerror (title=None, message=None,
          **options)

     Creates and displays an error message box with the specified title
     and message.

'質問メッセージボックス'

 -- の関数: tkinter.messagebox.askquestion (title=None, message=None, *,
          type=YESNO, **options)

     Ask a question.  By default shows buttons *note YES: 45a6. and
     *note NO: 45a7.  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: 45a4. and
     *note CANCEL: 45a5.  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:
     45b4. and *note CANCEL: 45a5.  Return ‘True’ if the answer is yes
     and ‘False’ otherwise.

 -- の関数: tkinter.messagebox.askyesno (title=None, message=None,
          **options)

     Ask a question.  Shows buttons *note YES: 45a6. and *note NO: 45a7.
     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: 45a6, *note NO: 45a7. and
     *note CANCEL: 45a5.  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: 45b7,
     *note RETRY: 45b4. and *note IGNORE: 45b8.

 -- データ: tkinter.messagebox.OK = 'ok'

     Displays one button whose symbolic name is *note OK: 45a4.

 -- データ: tkinter.messagebox.OKCANCEL = 'okcancel'

     Displays two buttons whose symbolic names are *note OK: 45a4. and
     *note CANCEL: 45a5.

 -- データ: tkinter.messagebox.RETRYCANCEL = 'retrycancel'

     Displays two buttons whose symbolic names are *note RETRY: 45b4.
     and *note CANCEL: 45a5.

 -- データ: tkinter.messagebox.YESNO = 'yesno'

     Displays two buttons whose symbolic names are *note YES: 45a6. and
     *note NO: 45a7.

 -- データ: tkinter.messagebox.YESNOCANCEL = 'yesnocancel'

     Displays three buttons whose symbolic names are *note YES: 45a6,
     *note NO: 45a7. and *note CANCEL: 45a5.
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/main/Lib/tkinter/messagebox.py


File: python.info,  Node: tkinter scrolledtext --- スクロール可能なテキストウィジェット,  Next: tkinter dnd --- ドラッグアンドドロップのサポート,  Prev: tkinter messagebox --- Tkinter メッセージプロンプト,  Up: Graphical user interfaces with Tk

5.26.6 ‘tkinter.scrolledtext’ -- スクロール可能なテキストウィジェット
---------------------------------------------------------------------

'ソースコード:' Lib/tkinter/scrolledtext.py(1)

__________________________________________________________________

The ‘tkinter.scrolledtext’ module provides a class of the same name
which implements a basic text widget which has a vertical scroll bar
configured to do the "right thing."  Using the *note ScrolledText: 45c4.
class is a lot easier than setting up a text widget and scroll bar
directly.

テキストウィジェットとスクロールバーは ‘Frame’ の中に一緒にpackされ、
‘Grid’ と ‘Pack’ ジオメトリマネジャのメソッドは‘Frame’ オブジェクトから
得られます。これによって、もっとも標準的なジオメトリマネジャの振る舞いに
するために、直接 *note ScrolledText: 45c4. ウィジェットを使えるようにな
ります。

特定の制御が必要ならば、以下の属性が利用できます:

 -- クラス: tkinter.scrolledtext.ScrolledText (master=None, **kw)

      -- の属性: frame

          テキストとスクロールバーウィジェットを取り囲むフレーム。

      -- の属性: vbar

          スクロールバーウィジェット。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/tkinter/scrolledtext.py


File: python.info,  Node: tkinter dnd --- ドラッグアンドドロップのサポート,  Next: tkinter ttk --- Tk のテーマ付きウィジェット,  Prev: tkinter scrolledtext --- スクロール可能なテキストウィジェット,  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
バインドとイベント: 4558.).  The function should call *note dnd_start():
45ca, where 'source' is the object to be dragged, and 'event' is the
event that invoked the call (the argument to your callback function).

Selection of a target object occurs as follows:

  1. Top-down search of area under mouse for target widget

        * Target widget should have a callable 'dnd_accept' attribute

        * If 'dnd_accept' is not present or returns ‘None’, search moves
          to parent widget

        * If no target widget is found, then the target object is ‘None’

  2. Call to '<old_target>.dnd_leave(source, event)'

  3. Call to '<new_target>.dnd_enter(source, event)'

  4. Call to '<target>.dnd_commit(source, event)' to notify of drop

  5. Call to '<source>.dnd_end(target, event)' to signal end of
     drag-and-drop

 -- クラス: tkinter.dnd.DndHandler (source, event)

     The 'DndHandler' class handles drag-and-drop events tracking Motion
     and ButtonRelease events on the root of the event widget.

      -- メソッド: cancel (event=None)

          Cancel the drag-and-drop process.

      -- メソッド: finish (event, commit=0)

          Execute end of drag-and-drop functions.

      -- メソッド: on_motion (event)

          Inspect area below mouse for target objects while drag is
          performed.

      -- メソッド: on_release (event)

          Signal end of drag when the release pattern is triggered.

 -- の関数: tkinter.dnd.dnd_start (source, event)

     Factory function for drag-and-drop process.

参考
....

*note バインドとイベント: 4558.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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.

参考
....

Tk Widget Styling Support(2)

     Tk のテーマサポートを紹介するドキュメント

* Menu:

* Ttk を使う::
* Ttk ウィジェット::
* ウィジェット::
* コンボボックス::
* Spinbox::
* ノートブック::
* プログレスバー::
* セパレータ::
* サイズグリップ::
* ツリービュー::
* Ttk スタイル::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/tkinter/ttk.py

   (2) https://core.tcl.tk/tips/doc/trunk/tip/48.md


File: python.info,  Node: Ttk を使う,  Next: Ttk ウィジェット,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.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 (‘Button’, ‘Checkbutton’,
‘Entry’, ‘Frame’, ‘Label’, ‘LabelFrame’, ‘Menubutton’, ‘PanedWindow’,
‘Radiobutton’, ‘Scale’ and ‘Scrollbar’) to automatically replace the Tk
widgets.

これにはプラットフォームをまたいでより良い見た目を得られるという、直接的
な利益がありますが、ウィジェットは完全な互換性を持っているわけではありま
せん。一番の違いは "fg" や "bg" やその他のスタイルに関係するウィジェット
のオプションが Ttk ウィジェットから無くなっていることです。同じ (もしく
はより良い) 見た目にするためには ‘ttk.Style’ を使ってください。

参考
....

Converting existing applications to use Tile widgets(1)

     アプリケーションを移行して新しいウィジェットを使用する際に出くわす
     典型的な差異について (Tcl の用語を使って) 書かれている研究論文

   ---------- Footnotes ----------

   (1) https://tktable.sourceforge.net/tile/doc/converting.txt


File: python.info,  Node: Ttk ウィジェット,  Next: ウィジェット,  Prev: Ttk を使う,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.2 Ttk ウィジェット
.........................

Ttk には 18 のウィジェットがあり、そのうち 12 は Tkinter に既にあるもの
です: ‘Button’, ‘Checkbutton’, ‘Entry’, ‘Frame’, ‘Label’, ‘LabelFrame’,
‘Menubutton’, ‘PanedWindow’, ‘Radiobutton’, ‘Scale’, ‘Scrollbar’, *note
Spinbox: f57. 。新しい 6 つは次のものです: *note Combobox: 45d5, *note
Notebook: 45d6, *note Progressbar: 45d7, ‘Separator’, ‘Sizegrip’, *note
Treeview: e5a. 。そして、これらは全て *note Widget: 45d8. の子クラスです
。

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: 45d9. についての詳細は *note Style: 767. クラスの文書
を読んでください。


File: python.info,  Node: ウィジェット,  Next: コンボボックス,  Prev: Ttk ウィジェット,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.3 ウィジェット
.....................

‘ttk.Widget’ はTk のテーマ付きウィジェットがサポートしている標準のオプシ
ョンやメソッドを定義するもので、これを直接インスタンス化するものではあり
ません。

* Menu:

* 標準オプション::
* スクロール可能ウィジェットのオプション::
* ラベルオプション::
* 互換性オプション::
* ウィジェットの状態::
* ttk.Widget: ttk Widget.


File: python.info,  Node: 標準オプション,  Next: スクロール可能ウィジェットのオプション,  Up: ウィジェット

5.26.8.4 標準オプション
.......................

All the ‘ttk’ Widgets accept the following options:

オプション      説明
                
-----------------------------------------------------------------------------------
                
クラス          ウィンドウクラスを指定します。このクラスはオプションデータベース
                にウィンドウの他のオプションについて問い合わせを行うときに使われ
                、これによりウィンドウのデフォルトのバインドタグを決定したり、ウ
                ィジェットのデフォルトのレイアウトやスタイルを選択します。このオ
                プションは読み出し専用で、ウィンドウが作成されるときにのみ指定で
                きます。
                
                
cursor          このウィジェットで使うマウスカーソルを指定します。空文字列 (デフ
                ォルト) が設定されている場合は、カーソルは親ウィジェットのものを
                引き継ぎます。
                
                
takefocus       キーボードによる移動のときにウィンドウがフォーカスを受け入れるか
                を決定します。0、1、空文字列のいずれかを返します。0 が返されると
                、キーボードによる移動でそのウィンドウは常にスキップされます。1
                なら、そのウィンドウが表示されているときに限り入力フォーカスを受
                け入れます。そして空文字列は、移動スクリプトによってウィンドウに
                フォーカスを当てるかどうかが決まることを意味します。
                
                
style           独自のウィジェットスタイルを指定するのに使われます。
                


File: python.info,  Node: スクロール可能ウィジェットのオプション,  Next: ラベルオプション,  Prev: 標準オプション,  Up: ウィジェット

5.26.8.5 スクロール可能ウィジェットのオプション
...............................................

以下のオプションはスクロールバーで操作されるウィジェットが持っているオプ
ションです。

オプション           説明
                     
-----------------------------------------------------------------------------------
                     
xscrollcommand       水平方向のスクロールバーとのやり取りに使われます。
                     
                     ウィジェットのウィンドウが再描画されたとき, ウィジェットは
                     scrollcommand に基いて Tcl コマンドを生成します。
                     
                     通常このオプションにはあるスクロールバーのメソッド
                     ‘Scrollbar.set()’ が設定されます。こうすると、ウィンドウの
                     見た目が変わったときにスクロールバーの状態も更新されます。
                     
                     
yscrollcommand       垂直方向のスクロールバーとのやり取りに使われます。詳しくは
                     、上記を参照してください。
                     


File: python.info,  Node: ラベルオプション,  Next: 互換性オプション,  Prev: スクロール可能ウィジェットのオプション,  Up: ウィジェット

5.26.8.6 ラベルオプション
.........................

以下のオプションはラベルやボタンやボタンに類似したウィジェットが持ってい
るオプションです。

オプション         説明
                   
-----------------------------------------------------------------------------------
                   
text               ウィジェットに表示される文字列を指定します。
                   
                   
textvariable       text オプションの代わりに使う値の変数名を指定します。
                   
                   
underline          このオプションを設定すると、文字列の中で下線を引く文字のイン
                   デックス (0 基点) を指定します。下線が引かれた文字はショート
                   カットとして使われます。
                   
                   
image              表示する画像を指定します。これは 1 つ以上の要素を持つリストで
                   す。先頭の要素はデフォルトの画像名です。残りの要素は
                   *note Style.map(): 1efa. で定義されているような状態名と値のペ
                   アの並びで、ウィジェットがある状態、もしくはある状態の組み合
                   わせにいるときに使用する別の画像を指定します。このリストにあ
                   る全ての画像は同じサイズでなればなりません。
                   
                   
compound           text オプションと image オプションが両方とも指定されていた場
                   合に、テキストに対して画像をどう配置するかを指定します。適当
                   な値は:
                   
                      * text: テキストのみ表示する
                   
                      * image: 画像のみ表示する
                   
                      * top, bottom, left, right: それぞれ画像をテキストの上、下
                        、左、右に配置する。
                   
                      * none: デフォルト。もしあれば画像を表示し、そうでなければ
                        テキストを表示する。
                   
                   
幅                 0 より大きい場合、テキストラベルを作成するのにどれくらいのス
                   ペースを使うかを文字の幅で指定します。0 より小さい場合、最小
                   の幅が指定されます。0 もしくは無指定の場合、テキストラベルに
                   対して自然な幅が使われます。
                   


File: python.info,  Node: 互換性オプション,  Next: ウィジェットの状態,  Prev: ラベルオプション,  Up: ウィジェット

5.26.8.7 互換性オプション
.........................

オプション   説明
             
----------------------------------------------------------------------------------
             
state        "normal" か "disabled" に設定され、 "disabled" 状態のビットをコン
             トロールします。これは書き込み専用のオプションです: これを設定する
             とウィジェットの状態を変更できますが、 *note Widget.state(): 45df.
             メソッドはこのオプションに影響を及ぼしません。
             


File: python.info,  Node: ウィジェットの状態,  Next: ttk Widget,  Prev: 互換性オプション,  Up: ウィジェット

5.26.8.8 ウィジェットの状態
...........................

ウィジェットの状態は独立した状態フラグのビットマップです。

Flag             説明
                 
-----------------------------------------------------------------------------------
                 
active           マウスカーソルがウィジェットの上にあり、マウスのボタンをクリッ
                 クすることで何らかの動作をさせられます
                 
                 
disabled         プログラムによってウィジェットは無効化されています
                 
                 
focus            ウィジェットにキーボードフォーカスがあります
                 
                 
pressed          ウィジェットは押されています
                 
                 
selected         チェックボタンやラジオボタンのようなウィジェットでの "オン" や
                 "チェック有" や "選択中" に当たります
                 
                 
background       Windows と Mac には "アクティブな" もしくは最前面のウィンドウと
                 いう概念があります。背面のウィンドウにあるウィジェットには
                 'background' 状態が設定され、最前面のウィンドウにあるウィジェッ
                 トでは解除されます
                 
                 
readonly         ウィジェットはユーザからの変更を受け付けません
                 
                 
alternate        ウィジェット特有の切り替え表示になっています
                 
                 
invalid          ウィジェットの値が不正です
                 

状態仕様は状態名の並びになっていて、状態名の先頭にはビットがオフになって
いることを示す感嘆符が付くことがあります。


File: python.info,  Node: ttk Widget,  Prev: ウィジェットの状態,  Up: ウィジェット

5.26.8.9 ttk.Widget
...................

以下に書かれているメソッドに加えて、 ‘ttk.Widget’ は
‘tkinter.Widget.cget()’ メソッドと ‘tkinter.Widget.configure()’ メソッド
をサポートしています。

 -- クラス: tkinter.ttk.Widget

      -- メソッド: identify (x, y)

          'x' 'y' の位置にある要素の名前、もしくはその位置に要素が無けれ
          ば空文字列を返します。

          'x' と 'y' はウィジェットに対するピクセル単位の座標です。

      -- メソッド: instate (statespec, callback=None, *args, **kw)

          ウィジェットの状態をチェックします。コールバックが指定されてい
          ない場合、ウィジェットの状態が 'statespec' に一致していれば
          ‘True’ 、そうでなければ ‘False’ を返します。コールバックが指定
          されていて、ウィジェットの状態が 'statespec' に一致している場
          合、引数に args を指定してそのコールバックを呼び出します。

      -- メソッド: state (statespec=None)

          ウィジェットの状態を変更したり、取得したりします。'statespec'
          が指定されている場合、それに応じてウィジェットの状態を設定し、
          どのフラグが変更されたかを示す新しい 'statespec' を返します。
          'statespec' が指定されていない場合、現在の状態フラグを返します
          。

     通常 'statespec' はリストもしくはタプルです。


File: python.info,  Node: コンボボックス,  Next: Spinbox,  Prev: ウィジェット,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.10 コンボボックス
........................

‘ttk.Combobox’ ウィジェットはテキストフィールドと値のポップダウンリスト
を結び付けます。このウィジェットは ‘Entry’ の子クラスです。

*note Widget: 45d8. から継承したメソッド (‘Widget.cget()’,
‘Widget.configure()’, *note Widget.identify(): 45e2, *note
Widget.instate(): 45e3, *note Widget.state(): 45df.) と以下の ‘Entry’ か
ら継承したメソッド (‘Entry.bbox()’, ‘Entry.delete()’, ‘Entry.icursor()’,
‘Entry.index()’, ‘Entry.insert()’, ‘Entry.selection()’, ‘Entry.xview()’)
に加え、このクラスには ‘ttk.Combobox’ で説明するメソッドがあります。

* Menu:

* オプション::
* 仮想イベント::
* ttk.Combobox: ttk Combobox.


File: python.info,  Node: オプション,  Next: 仮想イベント,  Up: コンボボックス

5.26.8.11 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション            説明
                      
-----------------------------------------------------------------------------------
                      
exportselection       真偽値を取る。設定されている場合、ウィジェットの選択はウィ
                      ンドウマネージャの選択とリンクしています (例えば、
                      Misc.selection_get を実行することで得られます)。
                      
                      
justify               ウィジェットの中でテキストをどう配置するかを指定します。
                      "left", "center", "right" のうちのどれか 1 つです。
                      
                      
高さ                  ポップダウンリストの高さを行数で指定します。
                      
                      
postcommand           コンボボックスの値を表示する直前に呼び出される、
                      (Misc.register などで登録した) スクリプトです。どの値を表
                      示するかについても指定できます。
                      
                      
state                 "normal", "readonly", "disabled" のどれか 1 つです。
                      "readonly" 状態では、直接入力値を編集することはできず、ユ
                      ーザはドロップダウンリストから値を 1 つ選ぶことしかできま
                      せん。"normal" 状態では、テキストフィールドは直接編集でき
                      ます。"disabled" 状態では、コンボボックスは一切反応しませ
                      ん。
                      
                      
textvariable          コンボボックスの値とリンクさせる変数名を指定します。その変
                      数の値が変更されたとき、ウィジェットの値は更新されます。ウ
                      ィジェットの値が更新されたときも同様です。
                      ‘tkinter.StringVar’ を参照してください。
                      
                      
‘values’              ドロップダウンリストに表示する値のリストを指定します。
                      
                      
幅                    入力ウィンドウに必要な幅をウィジェットのフォントの平均的な
                      サイズの文字で測った、文字数を指定します。
                      


File: python.info,  Node: 仮想イベント,  Next: ttk Combobox,  Prev: オプション,  Up: コンボボックス

5.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 ‘ttk.Spinbox’ widget is a ‘ttk.Entry’ enhanced with increment and
decrement arrows.  It can be used for numbers or lists of string values.
This widget is a subclass of ‘Entry’.

*note Widget: 45d8. から継承したメソッド: ‘Widget.cget()’,
‘Widget.configure()’, *note Widget.identify(): 45e2, *note
Widget.instate(): 45e3, *note Widget.state(): 45df. と、以下の ‘Entry’ か
ら継承したメソッド: ‘Entry.bbox()’, ‘Entry.delete()’, ‘Entry.icursor()’,
‘Entry.index()’, ‘Entry.insert()’, ‘Entry.xview()’ に加え、このクラスに
は ‘ttk.Spinbox’ で説明するいくつかのメソッドがあります。

* Menu:

* オプション: オプション<2>.
* 仮想イベント: 仮想イベント<2>.
* ttk.Spinbox: ttk Spinbox.


File: python.info,  Node: オプション<2>,  Next: 仮想イベント<2>,  Up: Spinbox

5.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

      -- メソッド: 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>.
* タブオプション::
* タブ識別子::
* 仮想イベント: 仮想イベント<3>.
* ttk.Notebook: ttk Notebook.


File: python.info,  Node: オプション<3>,  Next: タブオプション,  Up: ノートブック

5.26.8.19 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション    説明
              
-----------------------------------------------------------------------------------
              
高さ          0 より大きな値が設定されている場合、 (内部のパディングやタブを含ま
              ない) ペイン領域に必要な高さを指定します。設定されていない場合、全
              てのペインの高さの最大値が使われます。
              
              
padding       ノートブックの外周に付け足す追加の領域の量を指定します。パディング
              は最大 4 個の長さ指定のリストです: 左、上、右、下の順で指定します
              。4 個より少ない場合、デフォルトで下は上と、右は左と、上は左と同じ
              値が、それぞれ使われます。
              
              
幅            0 より大きな値が指定されている場合、(内部のパディングを含まない) ペ
              イン領域に必要な幅を指定します。設定されていない場合、全てのペイン
              の幅の最大値が使われます。
              


File: python.info,  Node: タブオプション,  Next: タブ識別子,  Prev: オプション<3>,  Up: ノートブック

5.26.8.20 タブオプション
........................

タブ用のオプションもあります:

オプション      説明
                
-----------------------------------------------------------------------------------
                
state           "normal", "disabled", "hidden" のうちどれか 1 つです。
                "disabled" の場合、タブは選択することができません。 "hidden" の
                場合、タブは表示されません。
                
                
sticky          ペイン領域の中に子ウィンドウがどう置かれるかを指定します。指定す
                る値は "n", "s", "e", "w" からなる 0 文字以上の文字列です。配置
                マネージャの ‘grid()’ と同様に、それぞれの文字は子ウィンドウが
                (北、南、東、西の) どの辺に対して追随するかに対応しています。
                
                
padding         ノートブックとこのペインの間に付け足す追加の領域の量を指定します
                。文法はこのウィジェットの padding オプションと同じです。
                
                
text            タブに表示するテキストを指定します。
                
                
image           タブに表示する画像を指定します。 *note Widget: 45d8. のオプショ
                ン image の説明を参照してください。
                
                
compound        text オプションと image オプションが両方指定されているときにテキ
                ストに対して画像をどう表示するかを指定します。指定する値について
                は *note Label Options: 45dd. を参照してください。
                
                
underline       テキスト中の下線を引く文字のインデックス (0 基点) を指定します。
                *note Notebook.enable_traversal(): 45f4. が呼ばれていた場合、下
                線が引かれた文字はショートカットとして使われます。
                


File: python.info,  Node: タブ識別子,  Next: 仮想イベント<3>,  Prev: タブオプション,  Up: ノートブック

5.26.8.21 タブ識別子
....................

‘ttk.Notebook’ のいくつかのメソッドにある 'tab_id' は以下の形式を取りま
す:

   * 0 からタブの数の間の整数

   * 子ウィンドウの名前

   * タブを指し示す "@x,y" という形式の位置指定

   * 現在選択されているタブを指し示すリテラル文字列 "current"

   * タブ数を返すリテラル文字列 "end" (*note Notebook.index(): 45f6. で
     のみ有効)


File: python.info,  Node: 仮想イベント<3>,  Next: ttk Notebook,  Prev: タブ識別子,  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:
          45f3. を参照してください。

      -- メソッド: forget (tab_id)

          'tab_id' で指定されたタブを削除します。関連付けられていたウィ
          ンドウは切り離され、管理対象でなくなります。

      -- メソッド: hide (tab_id)

          'tab_id' で指定されたタブを隠します。

          タブは表示されませんが、関連付いているウィンドウはノートブック
          によって保持されていて、その設定も記憶されています。隠れたタブ
          は *note add(): 45f9. コマンドで復元できます。

      -- メソッド: identify (x, y)

          'x' 'y' の位置にあるタブの名前を、そこにタブが無ければ空文字列
          を返します。

      -- メソッド: index (tab_id)

          'tab_id' で指定されたタブのインデックスを、 'tab_id' が文字列
          の "end" だった場合はタブの総数を返します。

      -- メソッド: insert (pos, child, **kw)

          指定された位置にペインを挿入します。

          'pos' は文字列の "end" か整数のインデックスか管理されている子
          ウィンドウの名前です。 'child' が既にノートブックの管理対象だ
          った場合、指定された場所に移動させます。

          利用可能なオプションのリストについては *note Tab Options:
          45f3. を参照してください。

      -- メソッド: select (tab_id=None)

          指定された 'tab_id' を選択します。

          関連付いている子ウィンドウは表示され、直前に選択されていたウィ
          ンドウは (もし異なれば) 表示されなくなります。 'tab_id' が指定
          されていない場合は、現在選択されているペインのウィジェット名を
          返します。

      -- メソッド: tab (tab_id, option=None, **kw)

          指定された 'tab_id' のオプションを問い合わせたり、変更したりし
          ます。

          'kw' が与えられなかった場合、タブのオプション値の辞書を返しま
          す。 'option' が指定されていた場合、その 'option' の値を返しま
          す。それ以外の場合は、オプションに対応する値が設定されます。

      -- メソッド: tabs ()

          ノートブックに管理されているウィンドウのリストを返します。

      -- メソッド: enable_traversal ()

          このノートブックを含む最上位にあるウィンドウでのキーボード移動
          を可能にします。

          これによりノートブックを含んだ最上位にあるウィンドウに対し、以
          下のキーバインディングが追加されます:

             * ‘Control’-‘Tab’: 現在選択されているタブの 1 つ次のタブを
               選択します。

             * ‘Shift’-‘Control’-‘Tab’: 現在選択されているタブの 1 つ前
               のタブを選択します。

             * ‘Alt’-‘K’: 'K' があるタブの (下線が引かれた) ショートカッ
               トキーだとして、そのタブを選択します。

          ネストしたノートブックも含め、1 つのウィンドウの最上位にある複
          数のノートブックのキーボード移動が可能になることもあります。し
          かしノートブック上の移動は、全てのペインが同じノートブックを親
          としているときのみ正しく動作します。


File: python.info,  Node: プログレスバー,  Next: セパレータ,  Prev: ノートブック,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.24 プログレスバー
........................

‘ttk.Progressbar’ ウィジェットは長く走る処理の状態を表示します。このウィ
ジェットは 2 つのモードで動作します: 1) 決定的モードでは、全ての処理の総
量のうち完了した量を表示します。 2) 非決定的モードでは、今作業が進んでい
ることをユーザに示します。

* 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(): 4605. を繰り返し呼び出すタイマーイベントを
          設定します。引数で指定しない場合は、 'interval' はデフォルトで
          50 ミリ秒になります。

      -- メソッド: step (amount=None)

          プログレスバーの値を 'amount' だけ増加させます。

          引数で指定しない場合は、 'amount' はデフォルトで 1.0 になりま
          す。

      -- メソッド: stop ()

          自動増加モードを停止します: このプログレスバーの *note
          Progressbar.start(): 4604. で開始された繰り返しのタイマーイベ
          ントを全てキャンセルします。


File: python.info,  Node: セパレータ,  Next: サイズグリップ,  Prev: プログレスバー,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.27 セパレータ
....................

‘ttk.Separator’ ウィジェットは水平もしくは垂直のセパレータを表示します。

‘ttk.Widget’ から継承したメソッド以外にメソッドを持ちません。

* 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 サイズグリップ
........................

(グローボックスとしても知られる) ‘ttk.Sizegrip’ ウィジェットを使用すると
、つまみ部分を押してドラッグすることで、このウィジェットを含む最上位のウ
ィンドウのサイズを変更できます。

このウィジェットは ‘ttk.Widget’ から継承したもの以外のオプションとメソッ
ドを持ちません。

* Menu:

* プラットフォーム固有のメモ::
* バグ::


File: python.info,  Node: プラットフォーム固有のメモ,  Next: バグ,  Up: サイズグリップ

5.26.8.30 プラットフォーム固有のメモ
....................................

   * macOS では、最上位のウィンドウにはデフォルトで組み込みのサイズグリ
     ップが含まれています。組み込みのグリップが ‘Sizegrip’ を隠してしま
     うので、 ‘Sizegrip’ を追加しても問題ありません。


File: python.info,  Node: バグ,  Prev: プラットフォーム固有のメモ,  Up: サイズグリップ

5.26.8.31 バグ
..............

   * このウィジェットを含む最上位のウィンドウの位置がスクリーンの右端や
     下端に対して相対的に指定されている場合 (例: ....)  、 ‘Sizegrip’ ウ
     ィジェットはウィンドウのサイズ変更をしません。

   * このウィジェットは "南東" 方向のサイズ変更しかサポートしていません
     。


File: python.info,  Node: ツリービュー,  Next: Ttk スタイル,  Prev: サイズグリップ,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.32 ツリービュー
......................

‘ttk.Treeview’ ウィジェットは階層のある要素 (アイテム) の集まりを表示し
ます。それぞれの要素はテキストラベル、オプションの画像、オプションのデー
タのリストを持っています。データはラベルの後に続くカラムに表示されます。

データが表示される順序はウィジェットの ‘displaycolumns’ オプションで制御
されます。ツリーウィジェットはカラムヘッダを表示することもできます。カラ
ムには数字もしくはウィジェットの columns オプションにある名前でアクセス
できます。 *note Column Identifiers: 460d. を参照してください。

それぞれの要素は一意な名前で識別されます。要素の作成時に識別子が与えられ
なかった場合、ウィジェットが要素の識別子を生成します。このウィジェットに
は ‘{}’ という名前の特別なルート要素があります。ルート要素自身は表示され
ません; その子要素たちが階層の最上位に現れます。

それぞれの要素はタグのリストも持っていて、イベントバインディングと個別の
要素を関連付け、要素の見た目を管理するのに使えます。

ツリービューウィジェットは水平方向と垂直方向のスクロールをサポートしてい
て、 *note Scrollable Widget Options: 45dc. に記述してあるオプションと
*note Treeview.xview(): 460e. メソッドおよび *note Treeview.yview():
460f. メソッドが使えます。

* Menu:

* オプション: オプション<6>.
* 要素オプション::
* タグオプション::
* カラム識別子::
* 仮想イベント: 仮想イベント<4>.
* ttk.Treeview: ttk Treeview.


File: python.info,  Node: オプション<6>,  Next: 要素オプション,  Up: ツリービュー

5.26.8.33 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション           説明
                     
----------------------------------------------------------------------------------
                     
columns              カラム数とその名前を指定するカラム識別子のリストです。
                     
                     
displaycolumns       どのデータカラムをどの順序で表示するかを指定する、 (名前も
                     しくは整数のインデックスの) カラム識別子のリストか、文字列
                     "#all" です。
                     
                     
高さ                 表示する行数を指定します。メモ: 表示に必要な幅はカラム幅の
                     合計から決定されます。
                     
                     
padding              ウィジェットの内部のパディングのサイズを指定します。パディ
                     ングは最大 4 個の長さ指定のリストです。
                     
                     
selectmode           組み込みのクラスバインディングが選択状態をどう管理するかを
                     指定します。設定する値は "extended", "browse", "none" のど
                     れか 1 つです。 "extended" に設定した場合 (デフォルト)、複
                     数の要素が選択できます。 "browse" に設定した場合、同時に 1
                     つの要素しか選択できません。 "none" に設定した場合、選択を
                     変更することはできません。
                     
                     このオプションの値によらず、アプリケーションのコードと関連
                     付けられているタグからは好きなように選択状態を設定できます
                     。
                     
                     
show                 ツリーのどの要素を表示するかを指定する、以下にある値を 0 個
                     以上含むリストです。
                     
                        * tree: カラム #0 にツリーのラベルを表示します。
                     
                        * headings: ヘッダ行を表示します。
                     
                     デフォルトは "tree headings" 、つまり全ての要素を表示しま
                     す。
                     
                     'メモ': show="tree" が指定されていない場合でも、カラム #0
                     は常にツリーカラムを参照します。
                     


File: python.info,  Node: 要素オプション,  Next: タグオプション,  Prev: オプション<6>,  Up: ツリービュー

5.26.8.34 要素オプション
........................

以下の要素オプションは、ウィジェットの insert コマンドと item コマンドで
要素に対して指定できます。

オプション   説明
             
---------------------------------------------------------------------------------
             
text         アイテムに表示するテキストラベルです。
             
             
image        ラベルの左に表示される Tk 画像です。
             
             
‘values’     要素に関連付けられている値のリストです。
             
             それぞれの要素はウィジェットの columns オプションと同じ数の値を持
             たなければいけません。 columns オプションより少ない場合、残りの値
             は空として扱われます。 columns オプションより多い場合、余計な値は
             無視されます。
             
             
open         要素の子供を表示するか隠すかを指示する ‘True’/‘False’ 値です。
             
             
tags         この要素に関連付いているタグのリストです。
             


File: python.info,  Node: タグオプション,  Next: カラム識別子,  Prev: 要素オプション,  Up: ツリービュー

5.26.8.35 タグオプション
........................

以下のオプションはタグに対して設定できます:

オプション       説明
                 
---------------------------------------------------------------------------------
                 
foreground       テキストの色を指定します。
                 
                 
background       セルや要素の背景色を指定します。
                 
                 
font             テキストを描画するときに使うフォントを指定します。
                 
                 
image            要素の image オプションが空だった場合に使用する画像を指定しま
                 す。
                 


File: python.info,  Node: カラム識別子,  Next: 仮想イベント<4>,  Prev: タグオプション,  Up: ツリービュー

5.26.8.36 カラム識別子
......................

カラム識別子は以下のいずれかの形式を取ります:

   * columns オプションのリストにある名前。

   * n 番目のデータカラムを指し示す整数 n 。

   * n を整数として n 番目の表示されているカラムを指し示す #n という形式
     の文字列。

注釈:

   * 要素のオプション値は実際に格納されている順序とは違った順序で表示さ
     れることがあります。

   * show="tree" が指定されていない場合でも、カラム #0 は常にツリーカラ
     ムを指しています。

データカラムを指す数字は、要素の values オプションのリストのインデックス
です; 表示カラムを指す数字は、値が表示されているツリーのカラム番号です。
ツリーラベルはカラム #0 に表示されます。 displaycolumns オプションが設定
されていない場合は、 n 番目のデータカラムはカラム #n+1 に表示されます。
再度言っておくと、 'カラム #0 は常にツリーカラムを指します' 。


File: python.info,  Node: 仮想イベント<4>,  Next: ttk Treeview,  Prev: カラム識別子,  Up: ツリービュー

5.26.8.37 仮想イベント
......................

ツリービューは以下の仮想イベントを生成します。

Event                    説明
                         
--------------------------------------------------------------------------------
                         
<<TreeviewSelect>>       選択状態が変更されたときに生成されます。
                         
                         
<<TreeviewOpen>>         フォーカスが当たっている要素に open=True が設定され
                         る直前に生成されます。
                         
                         
<<TreeviewClose>>        フォーカスが当たっている要素に open=False が設定され
                         た直後に生成されます。
                         

*note Treeview.focus(): 4614. メソッドと *note Treeview.selection():
e59. メソッドは変更を受けた要素を判別するのに使えます。


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 座標, 幅, 高
          さ) の形式で返します。

          'column' が指定されている場合は、セルのバウンディングボックス
          を返します。 (例えば、閉じた状態の要素の子供であったり、枠外に
          スクロールされていて) 'item' が見えなくなっている場合は、空文
          字列が返されます。

      -- メソッド: get_children (item=None)

          'item' の子要素のリストを返します。

          'item' が指定されていなかった場合は、ルート要素の子供が返され
          ます。

      -- メソッド: set_children (item, *newchildren)

          'item' の子要素を 'newchildren' で置き換えます。

          'item' にいる子供のうち 'newchildren' にないものはツリーから切
          り離されます。 'newchildren' にあるどの要素も 'item' の祖先で
          あってはいけません。 'newchildren' を指定しなかった場合は、
          'item' の子要素が全て切り離されることに注意してください。

      -- メソッド: column (column, option=None, **kw)

          指定した 'column' のオプションを問い合わせたり、変更したりしま
          す。

          'kw' が与えられなかった場合は、カラムのオプション値の辞書が返
          されます。 'option' が指定されていた場合は、その 'option' の値
          が返されます。それ以外の場合は、オプションに値を設定します。

          設定できるオプションとその値は次の通りです:

          'id'

               カラム名を返します。これは読み出し専用のオプションです。

          'anchor': One of the standard Tk anchor values.

               このカラムでセルに対してテキストをどう配置するかを指定し
               ます。

          'minwidth': width

               カラムの最小幅をピクセル単位で表したものです。ツリービュ
               ーウィジェットは、ウィジェットのサイズが変更されたりカラ
               ムをユーザがドラッグして移動させたりしたときに、このオプ
               ションで指定した幅より狭くすることはありません。

          'stretch': ‘True’/‘False’

               ウィジェットがサイズ変更されたとき、カラムの幅をそれに合
               わせるかどうかを指定します。

          'width': width

               カラムの幅をピクセル単位で表したものです。

          ツリーカラムの設定を行うには、 column = "#0" を付けてこのメソ
          ッドを呼び出してください。

      -- メソッド: delete (*items)

          指定された 'items' とその子孫たち全てを削除します。

          ルート要素は削除されません。

      -- メソッド: detach (*items)

          指定された 'items' を全てツリーから切り離します。

          その要素と子孫たちは依然として存在していて、ツリーの別の場所に
          再度挿入することができますが、隠された状態になり表示はされませ
          ん。

          ルート要素は切り離されません。

      -- メソッド: exists (item)

          指定された 'item' がツリーの中にあれば ‘True’ を返します。

      -- メソッド: focus (item=None)

          'item' が指定されていた場合は、 'item' にフォーカスを当てます
          。そうでない場合は、現在フォーカスが当たっている要素が、どの要
          素にもフォーカスが当たっていない場合は '' が返されます。

      -- メソッド: heading (column, option=None, **kw)

          指定された 'column' の heading のオプションを問い合わせたり、
          変更したりします。

          'kw' が与えられなかった場合は、見出しのオプション値の辞書が返
          されます。 'option' が指定されている場合は、 'option' の値が返
          されます。それ以外の場合は、オプションに値を設定します。

          設定できるオプションとその値は次の通りです:

          'text': text

               カラムの見出しに表示するテキスト。

          'image': imageName

               カラムの見出しの右に表示する画像を指定します。

          'anchor': anchor

               見出しのテキストをどう配置するかを指定します。標準の Tk
               anchor の値です。

          'command': callback

               見出しラベルがクリックされたときに実行されるコールバック
               です。

          ツリーカラムの見出しの設定を行うには、 column = "#0" を付けて
          このメソッドを呼び出してください。

      -- メソッド: identify (component, x, y)

          'x' 'y' で与えられた場所にある指定された 'component' の説明を
          返します。その場所に指定された 'component' が無い場合は空文字
          列を返します。 (訳注: component には "region", "item",
          "column", "row", "element" が指定でき、それぞれ "cell",
          "heading" などの場所の名前、要素の識別子、 #n という形式のカラ
          ム名、その行にある要素の識別子、 "text", "padding" などの画面
          構成要素の名前を返します。)

      -- メソッド: identify_row (y)

          y 座標が 'y' の位置にある要素の識別子を返します。

      -- メソッド: identify_column (x)

          x 座標が 'x' の位置にあるセルのデータカラムの識別子を返します
          。

          ツリーカラムは #0 という識別子を持ちます。

      -- メソッド: identify_region (x, y)

          以下のうち 1 つを返します:

          region          意味
                          
          -----------------------------------------------------------
                          
          heading         ツリーの見出し領域
                          
                          
          separator       2 つのカラム見出しの間のスペース
                          
                          
          tree            ツリーの領域
                          
                          
          cell            データセル
                          

          使用可能バージョン: Tk 8.6

      -- メソッド: identify_element (x, y)

          'x' 'y' の位置にある画面構成要素の名前を返します。

          使用可能バージョン: Tk 8.6

      -- メソッド: index (item)

          親要素の子要素リストの中での 'item' のインデックスを返します。

      -- メソッド: insert (parent, index, iid=None, **kw)

          新しい要素を作り、その要素の識別子を返します。

          'parent' は親となる要素の識別子で、空文字列にすると新しい要素
          を最上位に作成します。 'index' は整数もしくは "end" という値で
          、それによって親要素の子要素リストのどこに新しい要素を挿入する
          かを指定します。 'index' が 0 以下だった場合は、新しい要素は先
          頭に挿入されます; 'index' が現在の子要素の数以上だった場合は末
          尾に挿入されます。 'iid' が指定された場合は、要素の識別子とし
          て使われます; 'iid' はまだツリーに存在していないものに限ります
          。それ以外の場合は、一意な識別子が生成されます。

          See *note Item Options: 4611. for the list of available
          options.

      -- メソッド: item (item, option=None, **kw)

          指定された 'item' のオプションを問い合わせたり、変更したりしま
          す。

          オプションが与えられなかった場合は、要素のオプションと値が辞書
          の形で返されます。 'option' が指定された場合は、そのオプション
          の値が返されます。それ以外の場合は、 'kw' で与えられたようにオ
          プションに値が設定されます。

      -- メソッド: move (item, parent, index)

          'item' を 'parent' の子要素リストの 'index' の位置に移動します
          。

          要素を自身の子孫の下に移動させるのは許されていません。 'index'
          が 0 以下の場合、 'item' は先頭に移動されます; 子要素の数以上
          だった場合、末尾に移動されます。 'item' が切り離された状態の場
          合は、再度取り付けられます。

      -- メソッド: next (item)

          'item' の 1 つ下の兄弟の識別子を、 'item' が親にとって一番下の
          子供だった場合 '' を返します。

      -- メソッド: parent (item)

          'item' の親の識別子を、 'item' が階層の最上位にいた場合 '' を
          返します。

      -- メソッド: prev (item)

          'item' の 1 つ上の兄弟の識別子を、 'item' が親にとって一番上の
          子供だった場合 '' を返します。

      -- メソッド: reattach (item, parent, index)

          *note Treeview.move(): 4626. のエイリアスです。

      -- メソッド: see (item)

          'item' を見える状態にします。

          'item' の全ての子孫の open オプションを ‘True’ にし、必要であ
          れば 'item' がツリーの見える範囲に来るようにウィジェットをスク
          ロールさせます。

      -- メソッド: selection ()

          Returns a tuple of selected items.

          バージョン 3.8 で変更: ‘selection()’ no longer takes
          arguments.  For changing the selection state use the following
          selection methods.

      -- メソッド: selection_set (*items)

          新しく選択状態の要素が 'items' になります。

          バージョン 3.6 で変更: 'items' は 1 つのタプルとしてだけでなく
          、別々の引数としても渡せます。

      -- メソッド: selection_add (*items)

          選択状態の要素として 'items' を追加します。

          バージョン 3.6 で変更: 'items' は 1 つのタプルとしてだけでなく
          、別々の引数としても渡せます。

      -- メソッド: selection_remove (*items)

          選択状態の要素から 'items' を取り除きます。

          バージョン 3.6 で変更: 'items' は 1 つのタプルとしてだけでなく
          、別々の引数としても渡せます。

      -- メソッド: selection_toggle (*items)

          'items' のそれぞれの要素の選択状態を入れ替えます。

          バージョン 3.6 で変更: 'items' は 1 つのタプルとしてだけでなく
          、別々の引数としても渡せます。

      -- メソッド: set (item, column=None, value=None)

          1 引数で呼び出された場合、指定された 'item' のカラムと値のペア
          からなる辞書を返します。 2 引数で呼び出された場合、指定された
          'column' の現在の値を返します。 3 引数で呼び出された場合、与え
          られた 'item' の 'column' を指定された値 'value' に設定します
          。

      -- メソッド: tag_bind (tagname, sequence=None, callback=None)

          与えられたイベント 'sequence' 用のコールバックをタグ 'tagname'
          にバインドします。イベントが要素に渡ってきたときに、要素の
          tags オプションのそれぞれのコールバックが呼び出されます。

      -- メソッド: tag_configure (tagname, option=None, **kw)

          指定された 'tagname' のオプションを問い合わせたり、変更したり
          します。

          'kw' が与えられなかった場合、 'tagname' のオプション設定を辞書
          の形で返します。 'option' が指定された場合、指定された
          'tagname' の 'option' の値を返します。それ以外の場合、与えられ
          た 'tagname' のオプションに値を設定します。

      -- メソッド: tag_has (tagname, item=None)

          'item' が指定されていた場合、指定された 'item' が与えられた
          'tagname' を持っているかどうかに従って 1 または 0 が返されます
          。そうでない場合、指定されたタグを持つ全ての要素のリストを返し
          ます。

          使用可能バージョン: Tk 8.6

      -- メソッド: xview (*args)

          ツリービューの水平方向の位置を問い合わせたり、変更したりします
          。

      -- メソッド: yview (*args)

          ツリービューの垂直方向の位置を問い合わせたり、変更したりします
          。


File: python.info,  Node: Ttk スタイル,  Prev: ツリービュー,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.39 Ttk スタイル
......................

‘ttk’ のそれぞれのウィジェットにはスタイルが関連付けられていて、それと動
的もしくはデフォルトで設定される要素のオプションによってウィジェットを構
成する要素とその配置を指定します。デフォルトではスタイル名はウィジェット
のクラス名と同じですが、ウィジェットの style オプションで上書きすること
ができます。ウィジェットのクラス名が分からない場合は、
‘Misc.winfo_class()’ (somewidget.winfo_class()) メソッドを使ってください
。

参考
....

Tcl'2004 conference のプレゼンテーション(1)

     この文書ではテーマエンジンがどう動くかを説明しています

 -- クラス: tkinter.ttk.Style

     このクラスはスタイルデータベースを操作するために使われます。

      -- メソッド: configure (style, query_opt=None, **kw)

          'style' の指定されたオプションのデフォルト値を問い合わせたり、
          設定したりします。

          'kw' のそれぞれのキーはオプション名で値はそのオプションの値の
          文字列です。

          例えば、全てのデフォルトのボタンをパディングのある平らな見た目
          にし、背景の色を変更するには以下のようにします:

               from tkinter import ttk
               import tkinter

               root = tkinter.Tk()

               ttk.Style().configure("TButton", padding=6, relief="flat",
                  background="#ccc")

               btn = ttk.Button(text="Sample")
               btn.pack()

               root.mainloop()

      -- メソッド: map (style, query_opt=None, **kw)

          'style' の指定されたオプションの動的な値を問い合わせたり、設定
          したりします。

          'kw' のそれぞれのキーはオプション名で、値はタプルやリストや何
          か他のお好みのものでグループ化された状態仕様 (statespec) を要
          素とするリストやタプルです。状態仕様は 1 つもしくは複数の状態
          と値の組み合わせです。

          以下のように、例を示す方がわかりやすいでしょう:

               import tkinter
               from tkinter import ttk

               root = tkinter.Tk()

               style = ttk.Style()
               style.map("C.TButton",
                   foreground=[('pressed', 'red'), ('active', 'blue')],
                   background=[('pressed', '!disabled', 'black'), ('active', 'white')]
                   )

               colored_btn = ttk.Button(text="Test", style="C.TButton").pack()

               root.mainloop()

          あるオプションに対する状態と値の組 (states, value) の並び順は
          スタイルに影響を与えることに注意してください。例えば、
          foreground オプションの順序を ‘[('active', 'blue'),
          ('pressed', 'red')]’ に変更した場合、ウィジェットがアクティブ
          もしくは押された状態のとき前面が青くなります。

      -- メソッド: lookup (style, option, state=None, default=None)

          'style' の指定された 'option' の値を返します。

          'state' を指定する場合は、1 つ以上の状態名の並びである必要があ
          ります。 'default' 引数が指定されていた場合は、オプション指定
          が見付からなかったときに代わりに返される値として使われます。

          デフォルトでボタンがどのフォントを使うかを調べるには、以下のよ
          うに実行します:

               from tkinter import ttk

               print(ttk.Style().lookup("TButton", "font"))

      -- メソッド: layout (style, layoutspec=None)

          与えられた 'style' でのウィジェットのレイアウトを定義します。
          'layoutspec' が省略されていた場合は、与えられたスタイルのレイ
          アウト仕様を返します。

          'layoutspec' を指定する場合は、リストもしくは (文字列を除いた)
          何か他のシーケンス型である必要があります。それぞれの要素はタプ
          ルで、レイアウト名を 1 番目の要素とし、2 番目の要素は *note
          Layouts: 4637. で説明されているフォーマットである必要がありま
          す。

          フォーマットを理解するために以下の例を見てください (何かを使い
          易くするための例ではありません):

               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(): 766. が現在の要素を複製します。 '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 ()

          現在のテーマに定義されている要素のリストを返します。

      -- メソッド: element_options (elementname)

          'elementname' のオプションのリストを返します。

      -- メソッド: theme_create (themename, parent=None, settings=None)

          新しいテーマを作成します。

          'themename' が既に存在していた場合はエラーになります。
          'parent' が指定されていた場合は、新しいテーマは親テーマからス
          タイルや要素やレイアウトを継承します。 'settings' が指定された
          場合は、 *note theme_settings(): 463b. で使われるのと同じ形式
          である必要があります。

      -- メソッド: theme_settings (themename, settings)

          一時的に現在のテーマを 'themename' に設定し、指定された
          'settings' を適用した後、元のテーマを復元します。

          'settings' のそれぞれのキーはスタイル名で値はさらに
          'configure', 'map', 'layout', 'element create' をキーとして持
          ち、その値はそれぞれ *note Style.configure(): 4634, *note
          Style.map(): 1efa, *note Style.layout(): 4636, *note
          Style.element_create(): 766. メソッドで指定するのと同じ形式で
          ある必要があります。

          例として、コンボボックスの default テーマを少し変更してみまし
          ょう

               from tkinter import ttk
               import tkinter

               root = tkinter.Tk()

               style = ttk.Style()
               style.theme_settings("default", {
                  "TCombobox": {
                      "configure": {"padding": 5},
                      "map": {
                          "background": [("active", "green2"),
                                         ("!disabled", "green4")],
                          "fieldbackground": [("!disabled", "green3")],
                          "foreground": [("focus", "OliveDrab1"),
                                         ("!disabled", "OliveDrab2")]
                      }
                  }
               })

               combo = ttk.Combobox().pack()

               root.mainloop()

      -- メソッド: theme_names ()

          全ての既存のテーマのリストを返します。

      -- メソッド: theme_use (themename=None)

          'themename' が与えられなかった場合は、現在使用中のテーマ名を返
          します。そうでない場合は、現在のテーマを 'themename' に設定し
          、全てのウィジェットを再描画し、 <<ThemeChanged>> イベントを発
          生させます。

* Menu:

* レイアウト::

   ---------- Footnotes ----------

   (1) https://tktable.sourceforge.net/tile/tile-tcl2004.pdf


File: python.info,  Node: レイアウト,  Up: Ttk スタイル

5.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(): 45e2. などには要素とそ
     の子で単一の要素として扱われます。これは、グリップのついたスクロー
     ルバーサムのようなものに使われます。

'children': [sublayout... ]

     要素の内部に配置する要素のリストを指定します。リストのそれぞれの要
     素はタプル (もしくは他のシーケンス型) で、それの 1 番目の要素はレイ
     アウト名でそれ以降は *note Layout: 4637. です。


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: 76. package.

This is an *note optional module: 2366.  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
オプションのモジュールの要件: 2364.

* 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/main/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: 4645. 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: 4646. 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: 4649. 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(): 1869. 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: 464c. を実行します。エラーがなければ Shell の環
     境をクリーンにして再スタートした上で、モジュールを実行します。出力
     は Shell ウィンドウに表示されます。‘print’ や ‘write’ しない限り、
     この出力はされません。モジュール実行が完了すると Shell はフォーカス
     された状態のままで、プロンプトを表示します。これにより対話的に実行
     結果を調べることができます。この機能は、コマンドラインからファイル
     を ‘python -i file’ で実行することに相当します。

Run... Customized

     Same as *note Run Module: 464b, but run the module with customized
     settings.  'Command Line Arguments' extend *note sys.argv: 161e. 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: 4652. 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 コードコンテキスト: 4653. の項を参照してください。

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: 4652.).

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 ヘルプソース: 4656. の項を参照してください。


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 メニュー: 4647. の 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: a5f. or *note os.altsep: a60. 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: 189. 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: bea. *note match: 1df,
‘case’, and *note _: beb. 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: 45a. で参照されているファイルを実行します。 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: 45a.) 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(): 2821. 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/main/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/main/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: 2366.  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
オプションのモジュールの要件: 2364.

   ---------- 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: f9. 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: 4680. 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(): 386d.  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: f9. 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(): 52a. *note
context manager: 47f. instead of *note begin_fill(): 468c. and *note
end_fill(): 468d. 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: 4691.

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:
4692. 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(): 386d. | *note fd(): 4695.
               *note backward(): 4696. | *note bk(): 4697. | *note back(): 4698.
               *note right(): 4699. | *note rt(): 469a.
               *note left(): 469b. | *note lt(): 469c.
               *note goto(): 469d. | *note setpos(): 469e. | *note setposition(): 469f.
               *note teleport(): 1cbb.
               *note setx(): 46a0.
               *note sety(): 46a1.
               *note setheading(): 46a2. | *note seth(): 46a3.
               *note home(): 46a4.
               *note circle(): 46a5.
               *note dot(): 46a6.
               *note stamp(): 46a7.
               *note clearstamp(): 46a8.
               *note clearstamps(): 46a9.
               *note undo(): 46aa.
               *note speed(): 46ab.

     Turtle の状態を知る

               *note position(): 46ac. | *note pos(): 46ad.
               *note towards(): 46ae.
               *note xcor(): 46af.
               *note ycor(): 46b0.
               *note heading(): 46b1.
               *note distance(): 46b2.

     設定と計測

               *note degrees(): 46b3.
               *note radians(): 46b4.

Pen の制御

     描画状態

               *note pendown(): 46b5. | *note pd(): 46b6. | *note down(): 46b7.
               *note penup(): 46b8. | *note pu(): 46b9. | *note up(): 46ba.
               *note pensize(): 46bb. | *note width(): 46bc.
               *note pen(): 46bd.
               *note isdown(): 46be.

     色の制御

               *note color(): 46bf.
               *note pencolor(): 46c0.
               *note fillcolor(): 46c1.

     塗りつぶし

               *note filling(): 46c2.
               *note fill(): 52a.
               *note begin_fill(): 468c.
               *note end_fill(): 468d.

     さらなる描画の制御

               *note reset(): 46c3.
               *note clear(): 46c4.
               *note write(): 46c5.

タートルの状態

     可視性

               *note showturtle(): 46c6. | *note st(): 46c7.
               *note hideturtle(): 46c8. | *note ht(): 46c9.
               *note isvisible(): 46ca.

     見た目

               *note shape(): 46cb.
               *note resizemode(): 46cc.
               *note shapesize(): 46cd. | *note turtlesize(): 46ce.
               *note shearfactor(): 46cf.
               *note tiltangle(): b12.
               *note tilt(): 46d0.
               *note shapetransform(): 46d1.
               *note get_shapepoly(): 46d2.

イベントを利用する

          *note onclick(): 46d3.
          *note onrelease(): 46d4.
          *note ondrag(): 46d5.

特別な Turtle のメソッド

          *note poly(): 52b.
          *note begin_poly(): 46d6.
          *note end_poly(): 46d7.
          *note get_poly(): 46d8.
          *note clone(): 46d9.
          *note getturtle(): 46da. | *note getpen(): 46db.
          *note getscreen(): 46dc.
          *note setundobuffer(): 46dd.
          *note undobufferentries(): 46de.


File: python.info,  Node: TurtleScreen/Screen のメソッド,  Prev: Turtle のメソッド,  Up: Turtle graphics reference

5.26.10.17 TurtleScreen/Screen のメソッド
.........................................

ウィンドウの制御

          *note bgcolor(): 46e0.
          *note bgpic(): 46e1.
          *note clearscreen(): 46e2.
          *note resetscreen(): 46e3.
          *note screensize(): 46e4.
          *note setworldcoordinates(): 46e5.

アニメーションの制御

          *note no_animation(): 52c.
          *note delay(): 46e6.
          *note tracer(): 46e7.
          *note update(): 46e8.

スクリーンイベントを利用する

          *note listen(): 46e9.
          *note onkey(): 46ea. | *note onkeyrelease(): 46eb.
          *note onkeypress(): 46ec.
          *note onclick(): 46d3. | *note onscreenclick(): 46ed.
          *note ontimer(): 46ee.
          *note mainloop(): 46ef. | *note done(): 46f0.

設定と特殊なメソッド

          *note mode(): 46f1.
          *note colormode(): 46f2.
          *note getcanvas(): 46f3.
          *note getshapes(): 46f4.
          *note register_shape(): 46f5. | *note addshape(): 46f6.
          *note turtles(): 46f7.
          *note window_height(): 46f8.
          *note window_width(): 46f9.

入力メソッド

          *note textinput(): 1e90.
          *note numinput(): 1e91.

Screen 独自のメソッド

          *note bye(): 46fa.
          *note exitonclick(): 46fb.
          *note save(): 1ba2.
          *note setup(): 46fc.
          *note title(): 46fd.


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(): 46b3. と *note radians(): 46b4. 関数を使って
     設定できます。) 角度の向きはタートルのモードによって意味が変わりま
     す。 *note mode(): 46f1. を参照してください。

          >>> turtle.heading()
          22.0
          >>> turtle.right(45)
          >>> turtle.heading()
          337.0

 -- の関数: turtle.left (angle)
 -- の関数: turtle.lt (angle)


     パラメータ: ‘angle’ - 数 (整数または浮動小数点数)

     タートルを 'angle' 単位だけ左に回します。 (単位のデフォルトは度です
     が、 *note degrees(): 46b3. と *note radians(): 46b4. 関数を使って
     設定できます。) 角度の向きはタートルのモードによって意味が変わりま
     す。 *note mode(): 46f1. を参照してください。

          >>> 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: 4700.
     (たとえば *note pos(): 46ad. で返されます) でなければなりません。

     タートルを指定された絶対位置に移動します。ペンが下りていれば線を引
     きます。タートルの向きは変わりません。

          >>> 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(): 46f1. を参照して
     ください)。

          >>> 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(): 46a7. 呼出し
     で返された値でなければなりません

     '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: 4700. のベクトルとして) 返します
     。

          >>> 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(): 46f1. を参照してください)。

          >>> 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(): 46bd. 呼出しに渡して以前のペンの状態
     に復旧することができます。さらに一つ以上の属性をキーワード引数とし
     て渡すこともできます。一つの文で幾つものペンの属性を設定するのに使
     えます。

          >>> 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(): 46f2. を参照)。

     ‘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(): 46f2. を参照)。

     ‘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(): 46c0. およ
          び *note fillcolor(): 46c1. で返される色指定文字列またはタプル
          のペアで返します。

     ‘color(colorstring)’, ‘color((r,g,b))’, ‘color(r,g,b)’

          *note pencolor(): 46c0. の入力と同じですが、塗りつぶしの色とペ
          ンの色、両方を与えられた値に設定します。

     ‘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(): 46f2. 。


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():
     468c. before the fill-block and *note end_fill(): 468d. 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(): 468c. の後に描かれた図形を塗
     りつぶします。

     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(): 46f5. を参照して下さい。

          >>> 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(): 46cd. で設定します。

        - "noresize": タートルの見た目を調整しません。

     ‘resizemode("user")’ は *note shapesize(): 46cd. に引数を渡したとき
     に呼び出されます。

          >>> 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: 470d. オブジェクトを返します
     。 TurtleScreen のメソッドをそのオブジェクトに対して呼び出すことが
     できます。

          >>> ts = turtle.getscreen()
          >>> ts
          <turtle._Screen object at 0x...>
          >>> ts.bgcolor("pink")

 -- の関数: turtle.setundobuffer (size)


     パラメータ: ‘size’ - 整数または ‘None’

     アンドゥバッファを設定または無効化します。 'size' が整数ならばその
     サイズの空のアンドゥバッファを用意します。 'size' の値はタートルの
     アクションを何度 *note undo(): 46aa. メソッド/関数で取り消せるかの
     最大数を与えます。 '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: 4710. を直接使わなければなり
ません:

  1. タイプ "compound" の空の Shape オブジェクトを作ります。

  2. *note addcomponent(): 4711. メソッドを使って、好きなだけここにコン
     ポーネントを追加します。

     例えば:

          >>> 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: 4710. クラスは *note register_shape(): 46f5. の
     内部では違った使われ方をします。アプリケーションを書く人が 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(): 46f2.).

     ‘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(): 46e6. も参照)。

          >>> screen.tracer(8, 25)
          >>> dist = 2
          >>> for i in range(200):
          ...     fd(dist)
          ...     rt(90)
          ...     dist += 2

 -- の関数: turtle.update ()

     TurtleScreen の更新を実行します。トレーサーがオフの時に使われます。

RawTurtle/Turtle のメソッド *note speed(): 46ab. も参照して下さい。


File: python.info,  Node: スクリーンイベントを利用する,  Next: 入力メソッド,  Prev: アニメーションの制御,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.26.10.36 スクリーンイベントを利用する
.......................................

 -- の関数: turtle.listen (xdummy=None, ydummy=None)

     TurtleScreen に(キー・イベントを収集するために)フォーカスします。ダ
     ミー引数は *note listen(): 46e9. を onclick メソッドに渡せるように
     するためのものです。

 -- の関数: turtle.onkey (fun, key)
 -- の関数: turtle.onkeyrelease (fun, key)


     パラメータ:

        * ‘fun’ - 引数なしの関数または ‘None’

        * ‘key’ - 文字列: キー (例 "a") またはキー・シンボル (例
          "space")

     'fun' を指定されたキーのキーリリース(key-release)イベントに束縛しま
     す。 'fun' が ‘None’ ならばイベント束縛は除かれます。注意: キー・イ
     ベントを登録できるようにするためには TurtleScreen はフォーカスを持
     っていないとなりません(*note listen(): 46e9. を参照)。

          >>> 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(): 46e9.)

          >>> 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:
          4710. オブジェクト: 対応する合成形を取り込みます。

     タートルの形を 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:
     471d. or a *note TurtleScreen: 470d.

     タートルを作ります。タートルには上の「Turtle/RawTurtle のメソッド」
     で説明した全てのメソッドがあります。

 -- クラス: turtle.Turtle

     RawTurtle のサブクラスで同じインターフェイスを持ちますが、最初に必
     要になったとき自動的に作られる *note Screen: 4692. オブジェクトに描
     画します。

 -- クラス: turtle.TurtleScreen (cv)


     パラメータ: ‘cv’ - a ‘tkinter.Canvas’

     上で説明した *note bgcolor(): 46e0. のようなスクリーン向けのメソッ
     ドを提供します。

 -- クラス: turtle.Screen

     TurtleScreen のサブクラスで *note 4つのメソッドが加わっています:
     4719. 。

 -- クラス: 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(): 4711. メソッドを使っ
                     て作らなければなりません)
                     

      -- メソッド: 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: 470f. を参照。

 -- クラス: 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: 471e. instance will automatically create a *note Screen:
4692. instance if one is not already present.

‘Turtle’ is a subclass of *note RawTurtle: 471b, 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: 471d. or *note TurtleScreen: 470d.

*note TurtleScreen: 470d. is the basic drawing surface for a turtle.
*note Screen: 4692. is a subclass of ‘TurtleScreen’, and includes *note
some additional methods: 4719. for managing its appearance (including
size and title) and behaviour.  ‘TurtleScreen’'s constructor needs a
‘tkinter.Canvas’ or a *note ScrolledCanvas: 471d. 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(): cad. をメソッドや関数に対して呼び出すとドキュメント文
     字列が表示されます:

          >>> 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: 46fc. メソッドの引数に当たります。

   - 5行目6行目は *note Screen.screensize: 46e4. メソッドの引数に当たり
     ます。

   - '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(): 46fb. がメインループ(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(): 46e7,
                             スパターン                         *note delay(): 46e6,
                                                                *note update(): 46e8.
                                                                
                                                                
‘chaos’                      verhust 力学系のグラフ化, コンピ   世界座標系
                             ュータの計算が常識的な予想に反す   
                             る場合があることを示します。
                             
                                                                
‘clock’                      コンピュータの時間を示すアナログ   turtles as clock's hands,
                             時計                               *note ontimer(): 46ee.
                                                                
                                                                
‘colormixer’                 r, g, b の実験                     *note ondrag(): 46d5.
                                                                
                                                                
‘forest’                     3 breadth-first trees              randomization
                                                                
                                                                
‘fractalcurves’              Hilbert & Koch 曲線                再帰
                                                                
                                                                
‘lindenmayer’                民俗的数学 (インド kolams)         L-システム
                                                                
                                                                
‘minimal_hanoi’              ハノイの塔                         Rectangular Turtles as Hanoi discs
                                                                (*note shape(): 46cb,
                                                                *note shapesize(): 46cd.)
                                                                
                                                                
‘nim’                        play the classical nim game with   turtles as nimsticks, event driven
                             three heaps of sticks against      (mouse, keyboard)
                             the computer.                      
                             
                                                                
‘paint’                      超極小主義的描画プログラム         *note onclick(): 46d3.
                                                                
                                                                
‘peace’                      初歩的                             turtle: 見た目とアニメーション
                                                                
                                                                
‘penrose’                    凧と矢による非周期的タイリング     *note stamp(): 46a7.
                                                                
                                                                
‘planet_and_moon’            重力系のシミュレーション           合成形, *note Vec2D: 4700.
                                                                
                                                                
‘rosette’                    タートルグラフィックスについての   *note clone(): 46d9, *note undo(): 46aa.
                             wikipedia の記事の例               
                             
                                                                
‘round_dance’                dancing turtles rotating           compound shapes, *note clone(): 46d9.
                             pairwise in opposite direction     *note shapesize(): 46cd,
                                                                *note tilt(): 46d0,
                                                                *note get_shapepoly(): 46d2,
                                                                *note update(): 46e8.
                                                                
                                                                
‘sorting_animate’            visual demonstration of            simple alignment, randomization
                             different sorting methods          
                             
                                                                
‘tree’                       (図形的) 幅優先木 (ジェネレータ    *note clone(): 46d9.
                             を使って)                          
                             
                                                                
‘two_canvases’               simple design                      turtles on two canvases
                                                                
                                                                
‘yinyang’                    もう一つの初歩的な例               *note circle(): 46a5.
                                                                

楽しんでね!


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: 46e7, *note Turtle.window_width:
     46f9. and *note Turtle.window_height: 46f8. have been eliminated.
     Methods with these names and functionality are now available only
     as methods of *note Screen: 4692.  The functions derived from these
     remain available.  (In fact already in Python 2.6 these methods
     were merely duplications of the corresponding *note TurtleScreen:
     470d./‘Screen’ methods.)

   - The method ‘Turtle.fill()’ has been eliminated.  The behaviour of
     *note begin_fill(): 468c. and *note end_fill(): 468d. have changed
     slightly: now every filling process must be completed with an
     ‘end_fill()’ call.

   - A method *note Turtle.filling: 46c2. 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: 471e. methods *note shearfactor(): 46cf, *note
     shapetransform(): 46d1. and *note get_shapepoly(): 46d2. have been
     added.  Thus the full range of regular linear transforms is now
     available for transforming turtle shapes.  *note tiltangle(): b12.
     has been enhanced in functionality: it now can be used to get or
     set the tilt angle.

   - The *note Screen: 4692. method *note onkeypress(): 46ec. has been
     added as a complement to *note onkey(): 46ea.  As the latter binds
     actions to the key release event, an alias: *note onkeyrelease():
     46eb. was also added for it.

   - The method *note Screen.mainloop: 46ef. has been added, so there is
     no longer a need to use the standalone ‘mainloop()’ function when
     working with *note Screen: 4692. and *note Turtle: 471e. objects.

   - Two input methods have been added: *note Screen.textinput: 1e90.
     and *note Screen.numinput: 1e91.  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: bd. モジュールはモジュールの内容からドキュメントを生成
します。 *note doctest: 3d. と *note unittest: 10f. モジュールでは、自動
的に実行して予想通りの出力が生成されるか確認するユニットテストを書くこと
ができます。

この章で解説されるモジュールのリスト:

* 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: 77b. や 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: 25e0. で示されているように、引数が *note float: 32f. のインスタン
スであるという前提です。 そして、‘-> str’ というヒントにある通り、この関
数は *note str: 1ea. のインスタンスを返すことになっています。

型ヒントは *note float: 32f. や *note str: 1ea. のような単純な型を指定す
ることもできますし、もっと複雑な型も指定できます。 *note typing: 10d. モ
ジュールには、より高度な型ヒントを表現するためのいろいろな型が含まれてい
ます。

‘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 構造的部分型::
* モジュールの内容: モジュールの内容<5>.
* メジャーな機能の非推奨時系列::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 860. 文を用いて定義され、これにより *note
TypeAliasType: 531. インスタンスが生成されます。 以下の例では、 ‘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: 860. 文はPython3.12で新しく導入されました。後方互換性のため
に、単に代入によって型エイリアスを作成することもできます：

     Vector = list[float]

あるいは、 *note TypeAlias: bad. でマークすることで、これが通常の変数代
入ではなく、型エイリアスであることを明示できます

     from typing import TypeAlias

     Vector: TypeAlias = list[float]


File: python.info,  Node: NewType,  Next: 呼び出し可能オブジェクトのアノテーション,  Prev: 型エイリアス,  Up: typing --- 型ヒントのサポート

5.27.1.3 NewType
................

異なる型を作るためには *note NewType: 10b5. ヘルパークラスを使います:

     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: 10b5. は
作ることが出来ます:

     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: 2fba. なオブジェクトは、 *note
collections.abc.Callable: bca. または *note typing.Callable: ba9. を使っ
てアノテーションすることができます。 ‘Callable[[int], str]’ は、 *note
int: 32e. 型のパラメータを1つ受け取り、 *note str: 1ea. を返す関数を意味
します。

例えば:

     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: 2a0.、*note
Concatenate: ba8.、ellipsis (‘...’) のいずれかでなければなりません。返り
値の型は単一の型でなければなりません。

もしellipsisリテラル ‘...’ が引数リストとして与えられた場合、それは任意
のパラメータリストを持つ呼び出し可能オブジェクトを受け入れることを示しま
す。

     def concat(x: str, y: str) -> str:
         return x + y

     x: Callable[..., str]
     x = str     # OK
     x = concat  # これもOK

‘Callable’ は可変引数、*note オーバーロード関数: 4734.、キーワード専用引
数などを含む複雑な型シグネチャを表現することはできません。 しかし、*note
Protocol: 772. クラスとその *note __call__(): 966. メソッドを定義すれば
表現することができます:

     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: 2a0. を使
えば両者のパラメータ引数の依存関係を表現することができます。 さらに、あ
る callable が別の callable から引数を追加したり削除したりする場合は、
*note Concatenate: ba8. 演算子を使うことで表現できます。 その場合、
callable の型は ‘Callable[ParamSpecVariable, ReturnType]’ と
‘Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable],
ReturnType]’ という形になります。

バージョン 3.10 で変更: ‘Callable’ は *note ParamSpec: 2a0. と *note
Concatenate: ba8. をサポートしました。詳細は PEP 612(1) を参照してくださ
い。

参考
....

*note ParamSpec: 2a0. と *note Concatenate: ba8. のドキュメントに、
‘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 型引数構文: 7ab. を使う
ことでパラメータ化できます:

     from collections.abc import Sequence

     def first[T](l: Sequence[T]) -> T:  # この関数は型変数 "T" に関してジェネリックです
         return l[0]

もしくは、 *note TypeVar: 29f. のコンストラクタを使うこともできます:

     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: 4e0. は引数に1つの型のみ受け入れるので、型チェッカーは上記の
‘y’ への代入でエラーを出力します。同様に、*note Mapping: ca0. は引数に
2つの型のみ受け入れます。1つ目はキーの型を示し、2つ目は値の型を示します
。

しかし、他の多くのPythonのコンテナとは異なり、タプルがすべて同じ型ではな
い要素を持つことは、慣用的なPythonコードでは一般的です。このため、タプル
はPythonの型システムの中でも特殊です。*note tuple: 1d9. は任意の数の引数
を受け入れます

     # 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]: 4739.) 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: 191. are classes, *note Any:
a9f, *note type variables: 25de, 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: 191, which is the root of
Python's *note metaclass hierarchy: 25d2.


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]: 1197.  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: 1197. 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]: 28c2. or *note
Iterator[YieldType]: 28c3.:

     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]:
104e.).  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]: 119b. and
*note AsyncIterator[YieldType]: 119a. 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]: 1199.  Generic arguments correspond to those of *note
Generator: 1197, 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: 473c. ‘T’ .  This also makes ‘T’ valid as
a type within the class body.

Generic classes implicitly inherit from *note Generic: 1a12.  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__(): b26. 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: 29f. 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: 1a12. の引数のそれぞれの型変数は別のものでなければなりま
せん。このため次のクラス定義は無効です:

     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: a9f. 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: 1a12. にあった独自のメタクラスは無
くなりました。

バージョン 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: 1a12. 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: 2a0.:

     >>> 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: 2a0. can also be created using
explicit inheritance from *note Generic: 1a12.  In this case, ‘**’ is
not used:

     from typing import ParamSpec, Generic

     P = ParamSpec('P')

     class Z(Generic[P]):
         ...

Another difference between *note TypeVar: 29f. and *note ParamSpec: 2a0.
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: 2a0. may not have correct
‘__parameters__’ after substitution in some cases because they are
intended primarily for static type checking.

バージョン 3.10 で変更: *note Generic: 1a12. can now be parameterized
over parameter expressions.  See *note ParamSpec: 2a0. 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: 18e. 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’ 型
..................

*note Any: a9f. は特別な種類の型です。静的型検査器はすべての型を ‘Any’ と
互換として扱い、 ‘Any’ をすべての型と互換として扱います。

これは、 *note Any: a9f. 型の値では、任意の演算やメソッドの呼び出しが行
えることを意味します:

     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: a9f. 型の値をより詳細な型に代入する時に型検査が行われないこと
に注意してください。例えば、静的型検査器は ‘a’ を ‘s’ に代入する時、‘s’
が *note str: 1ea. 型として宣言されていて実行時に *note int: 32e. の値を
受け取るとしても、エラーを報告しません。

さらに、返り値や引数の型のないすべての関数は暗黙的に *note Any: a9f. を
使用します。

     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: a9f. を '非常口' として使用することができます。

*note Any: a9f. の挙動と *note object: e51. の挙動を対比しましょう。
‘Any’ と同様に、すべての型は ‘object’ のサブタイプです。しかしながら、
‘Any’ と異なり、逆は成り立ちません: ‘object’ はすべての他の型のサブタイ
プでは 'ありません'。

これは、ある値の型が *note object: e51. のとき、型検査器はこれについての
ほとんどすべての操作を拒否し、これをより特殊化された変数に代入する (また
は返り値として利用する) ことは型エラーになることを意味します。例えば:

     def hash_a(item: object) -> int:
         # Fails type checking; an object does not have a 'magic' method.
         item.magic()
         ...

     def hash_b(item: Any) -> int:
         # Passes type checking
         item.magic()
         ...

     # Passes type checking, since ints and strs are subclasses of object
     hash_a(42)
     hash_a("foo")

     # Passes type checking, since Any is compatible with all types
     hash_b(42)
     hash_b("foo")

*note object: e51. は、ある値が型安全な方法で任意の型として使えることを
示すために使用します。 *note Any: a9f. はある値が動的に型付けられること
を示すために使用します。


File: python.info,  Node: 名前的部分型 vs 構造的部分型,  Next: モジュールの内容<5>,  Prev: Any 型,  Up: typing --- 型ヒントのサポート

5.27.1.11 名前的部分型 vs 構造的部分型
......................................

初めは PEP 484(1) は Python の静的型システムを '名前的部分型' を使って定
義していました。 名前的部分型とは、クラス ‘B’ が期待されているところにク
ラス ‘A’ が許容されるのは ‘A’ が ‘B’ のサブクラスの場合かつその場合に限
る、ということです。

前出の必要条件は、*note Iterable: 28c2. などの抽象基底クラスにも当て嵌ま
ります。 この型付け手法の問題は、この手法をサポートするためにクラスに明
確な型付けを行う必要があることで、これは 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: 772. のサブクラスを作ることで、新し
い独自のプロトコルを作って構造的部分型というものを満喫できます。

   ---------- 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: モジュールの内容<5>,  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::
* 定数: 定数<10>.
* 非推奨のエイリアス::


File: python.info,  Node: 特殊型付けプリミティブ,  Next: プロトコル<4>,  Up: モジュールの内容<5>

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

     制約のない型であることを示す特別な型です。

        * 任意の型は *note Any: a9f. と互換です。

        * *note Any: a9f. は任意の型と互換です。

     バージョン 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: 4742.

     Definition:

          AnyStr = TypeVar('AnyStr', str, bytes)

     ‘AnyStr’ is meant to be used for functions that may accept *note
     str: 1ea. or *note bytes: 1d2. 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: a9f. 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: 7ab.  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(): 506.:

          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(): a9a.:

          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: 6a0.s that are used as alternative
          constructors and return instances of the ‘cls’ parameter.

        - Annotating an *note __enter__(): 9cb. 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:
     875.

     例えば:

          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: 860. statement, which creates instances of *note
     TypeAliasType: 531. 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: 531.:

               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型の表現: ba6. を参照ください。

     バージョン 3.14 で変更: *note types.UnionType: 52e. 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: 28e3.
     and *note ParamSpec: 2a0. 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: 28e3. 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: 1a30. 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: 2a0. 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: 2a0.

        * *note 呼び出し可能オブジェクトのアノテーション: 28e3.

 -- データ: 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: 531.:

               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: 18e. でない場合は *note
     TypeError: 29c. を送出するようになりました。

 -- データ: typing.ClassVar

     クラス変数であることを示す特別な型構築子です。

     PEP 526(3) で導入された通り、 ClassVar でラップされた変数アノテーシ
     ョンによって、ある属性はクラス変数として使うつもりであり、そのクラ
     スのインスタンスから設定すべきではないということを示せます。使い方
     は次のようになります:

          class Starship:
              stats: ClassVar[dict[str, int]] = {} # class variable
              damage: int = 10                     # instance variable

     *note ClassVar: 774. は型のみを受け入れ、それ以外は受け付けられませ
     ん。

     *note ClassVar: 774. はクラスそのものではなく、*note isinstance():
     2fb. や *note issubclass(): 2fc. で使うべきではありません。
     ‘ClassVar’ は Python の実行時の挙動を変えませんが、サードパーティの
     型検査器で使えます。 例えば、型チェッカーは次のコードをエラーとする
     かもしれません:

          enterprise_d = Starship(3000)
          enterprise_d.stats = {} # Error, setting class variable on instance
          Starship.stats = {}     # This is OK

     Added in version 3.5.3.

     バージョン 3.13 で変更: ‘ClassVar’ can now be nested in *note
     Final: 775. 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: 774. and vice versa.

 -- データ: typing.Required

     Special typing construct to mark a *note TypedDict: 29b. key as
     required.

     This is mainly useful for ‘total=False’ TypedDicts.  See *note
     TypedDict: 29b. and PEP 655(5) for more details.

     Added in version 3.11.

 -- データ: typing.NotRequired

     Special typing construct to mark a *note TypedDict: 29b. key as
     potentially missing.

     より詳しくは、 *note TypedDict: 29b. と PEP 655(6) を参照してくださ
     い。

     Added in version 3.11.

 -- データ: typing.ReadOnly

     A special typing construct to mark an item of a *note TypedDict:
     29b. as read-only.

     例えば:

          class Movie(TypedDict):
             title: ReadOnly[str]
             year: int

          def mutate_movie(m: Movie) -> None:
             m["year"] = 1999  # allowed
             m["title"] = "The Matrix"  # typechecker error

     There is no runtime checking for this property.

     See *note TypedDict: 29b. 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: aa6. 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(): 2fb.).

      -- 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: 531.:

          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:
     29e.:

          type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., Ann1]  # NOT valid

     where ‘T1’, ‘T2’, ...  are *note TypeVars: 29f.  This is invalid as
     only one type should be passed to Annotated.

     By default, *note get_type_hints(): aa3. 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(): 31c. 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.TypeForm

     A special form representing the value that results from evaluating
     a type expression.

     This value encodes the information supplied in the type expression,
     and it represents the type described by that type expression.

     When used in a type expression, ‘TypeForm’ describes a set of type
     form objects.  It accepts a single type argument, which must be a
     valid type expression.  ‘TypeForm[T]’ describes the set of all type
     form objects that represent the type ‘T’ or types assignable to
     ‘T’.

     ‘TypeForm(obj)’ simply returns ‘obj’ unchanged.  This is useful for
     explicitly marking a value as a type form for static type checkers.

     以下はプログラム例です:

          from typing import Any, TypeForm

          def cast[T](typ: TypeForm[T], value: Any) -> T: ...

          reveal_type(cast(int, "x"))  # Revealed type is "int"

     See PEP 747(9) for details.

     Added in version 3.15.

 -- データ: 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: 69e. 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(10) (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: 69d, 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(11) 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: 4745. 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: 29e. and *note
     builtins.tuple: 1d9. 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: 29b.
     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(12) 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-0747/

   (10) https://peps.python.org/pep-0742/

   (11) https://peps.python.org/pep-0647/

   (12) 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: 7ab. and the *note type: 860. 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: 2587.

     このクラスは次のように使用することが出来ます:

          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: 874.

     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: 874, *note generic classes:
     2587, and *note generic type aliases: 876.:

          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: 1a12. 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: 7ab. 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: 29c.

      -- の属性: __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: 7ab, the bound is evaluated only
          when the attribute is accessed, not when the type variable is
          created (see *note Lazy evaluation: 877.).

      -- メソッド: evaluate_bound ()

          An *note evaluate function: 474d. corresponding to the *note
          __bound__: 474b. attribute.  When called directly, this method
          supports only the *note VALUE: 412. format, which is
          equivalent to accessing the ‘__bound__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 474e. 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: 7ab, the constraints are
          evaluated only when the attribute is accessed, not when the
          type variable is created (see *note Lazy evaluation: 877.).

      -- メソッド: evaluate_constraints ()

          An *note evaluate function: 474d. corresponding to the *note
          __constraints__: 474f. attribute.  When called directly, this
          method supports only the *note VALUE: 412. format, which is
          equivalent to accessing the ‘__constraints__’ attribute
          directly, but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 474e. 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: 770. if it has no default.

          Added in version 3.13.

      -- メソッド: evaluate_default ()

          An *note evaluate function: 474d. corresponding to the *note
          __default__: 4751. attribute.  When called directly, this
          method supports only the *note VALUE: 412. format, which is
          equivalent to accessing the ‘__default__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 474e. 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__:
          4751. is not the *note typing.NoDefault: 770. singleton,
          except that it does not force evaluation of the *note lazily
          evaluated: 877. default value.

          Added in version 3.13.

     バージョン 3.12 で変更: Type variables can now be declared using
     the *note type parameter: 7ab. syntax introduced by PEP 695(3).
     The ‘infer_variance’ parameter was added.

     バージョン 3.13 で変更: Support for default values was added.

 -- クラス: typing.TypeVarTuple (name, *, bound=None, covariant=False,
          contravariant=False, infer_variance=False,
          default=typing.NoDefault)

     Type variable tuple.  A specialized form of *note type variable:
     473c. that enables 'variadic' generics.

     Type variable tuples can be declared in *note type parameter lists:
     7ab. 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: 1bd0. 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.

      -- の属性: __covariant__

          Whether the type variable tuple has been explicitly marked as
          covariant.

          Added in version 3.15.

      -- の属性: __contravariant__

          Whether the type variable tuple has been explicitly marked as
          contravariant.

          Added in version 3.15.

      -- の属性: __infer_variance__

          Whether the type variable tuple's variance should be inferred
          by type checkers.

          Added in version 3.15.

      -- の属性: __default__

          The default value of the type variable tuple, or *note
          typing.NoDefault: 770. if it has no default.

          Added in version 3.13.

      -- メソッド: evaluate_default ()

          An *note evaluate function: 474d. corresponding to the *note
          __default__: 4758. attribute.  When called directly, this
          method supports only the *note VALUE: 412. format, which is
          equivalent to accessing the ‘__default__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 474e. 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__: 4758. is not the *note typing.NoDefault: 770.
          singleton, except that it does not force evaluation of the
          *note lazily evaluated: 877. default value.

          Added in version 3.13.

     Type variable tuples 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: 29f, but its actual semantics
     are yet to be decided.

     Added in version 3.11.

     バージョン 3.12 で変更: Type variable tuples can now be declared
     using the *note type parameter: 7ab. syntax introduced by PEP
     695(5).

     バージョン 3.13 で変更: Support for default values was added.

     バージョン 3.15 で変更: Added support for the ‘bound’, ‘covariant’,
     ‘contravariant’, and ‘infer_variance’ parameters.

 -- クラス: typing.ParamSpec (name, *, bound=None, covariant=False,
          contravariant=False, infer_variance=False,
          default=typing.NoDefault)

     Parameter specification variable.  A specialized version of *note
     type variables: 473c.

     In *note type parameter lists: 7ab, 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: 1a12. 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: 29f. 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: a9f.

       2. *note cast(): 475b. 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: baa. and *note ParamSpecKwargs: bab.

      -- の属性: __name__

          The name of the parameter specification.

      -- の属性: __covariant__

          Whether the parameter specification has been explicitly marked
          as covariant.

      -- の属性: __contravariant__

          Whether the parameter specification has been explicitly marked
          as contravariant.

      -- の属性: __infer_variance__

          Whether the parameter specification's variance should be
          inferred by type checkers.

          Added in version 3.12.

      -- の属性: __default__

          The default value of the parameter specification, or *note
          typing.NoDefault: 770. if it has no default.

          Added in version 3.13.

      -- メソッド: evaluate_default ()

          An *note evaluate function: 474d. corresponding to the *note
          __default__: 4762. attribute.  When called directly, this
          method supports only the *note VALUE: 412. format, which is
          equivalent to accessing the ‘__default__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 474e. 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__: 4762. is not the *note typing.NoDefault: 770.
          singleton, except that it does not force evaluation of the
          *note lazily evaluated: 877. 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: 29f.  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: 7ab. 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: ba8.

        * *note 呼び出し可能オブジェクトのアノテーション: 28e3.

 -- データ: typing.ParamSpecArgs
 -- データ: typing.ParamSpecKwargs

     Arguments and keyword arguments attributes of a *note ParamSpec:
     2a0.  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(): 31c. 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=(),
          qualname=None)

     The type of type aliases created through the *note type: 860.
     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'

      -- の属性: __qualname__

          The *note qualified name: 1f38. of the type alias:

               >>> class Class:
               ...     type Alias = int
               ...
               >>> Class.Alias.__qualname__
               'Class.Alias'

          Added in version 3.15.

      -- の属性: __module__

          The name of the module in which the type alias was defined:

               >>> type Alias = int
               >>> Alias.__module__
               '__main__'

          This attribute is writable.

          バージョン 3.15 で変更: The attribute is now writable.

      -- の属性: __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: 877,
          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: 474d. corresponding to the *note
          __value__: 4769. attribute.  When called directly, this method
          supports only the *note VALUE: 412. format, which is
          equivalent to accessing the ‘__value__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 474e. 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(): 1da. の型付き版です。

     使い方:

          class Employee(NamedTuple):
              name: str
              id: int

     これは次と等価です:

          Employee = collections.namedtuple('Employee', ['name', 'id'])

     フィールドにデフォルト値を与えるにはクラス本体で代入してください:

          class Employee(NamedTuple):
              name: str
              id: int = 3

          employee = Employee('Guido')
          assert employee.id == 3

     デフォルト値のあるフィールドはデフォルト値のないフィールドの後でな
     ければなりません。

     最終的に出来上がるクラスには、フィールド名をフィールド型へ対応付け
     る辞書を提供する ‘__annotations__’ 属性が追加されています。 (フィー
     ルド名は ‘_fields’ 属性に、デフォルト値は ‘_field_defaults’ 属性に
     格納されていて、両方とも *note namedtuple(): 1da. 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(): 44a. (and the
     ‘__class__’ *note closure variable: 1ad6.) in methods of
     ‘NamedTuple’ subclasses is unsupported and causes a *note
     TypeError: 29c.

 -- クラス: typing.NewType (name, tp)

     Helper class to create low-overhead *note distinct types: 4731.

     A ‘NewType’ is considered a distinct type by a typechecker.  At
     runtime, however, calling a ‘NewType’ returns its argument
     unchanged.

     使い方:

          UserId = NewType('UserId', int)  # Declare the NewType "UserId"
          first_user = UserId(1)  # "UserId" returns the argument unchanged at runtime

      -- の属性: __module__

          The name of the module in which the new type is defined.

      -- の属性: __name__

          The name of the new type.

      -- の属性: __supertype__

          The type that the new type is based on.

     Added in version 3.5.2.

     バージョン 3.10 で変更: ‘NewType’ is now a class rather than a
     function.

 -- クラス: typing.Protocol (Generic)

     Base class for protocol classes.

     Protocol classes are defined like this:

          class Proto(Protocol):
              def meth(self) -> int:
                  ...

     このようなクラスは主に構造的部分型 (静的ダックタイピング) を認識す
     る静的型チェッカーが使います。例えば:

          class C:
              def meth(self) -> int:
                  return 0

          def func(x: Proto) -> int:
              return x.meth()

          func(C())  # Passes static type check

     See PEP 544(2) for more details.  Protocol classes decorated with
     *note runtime_checkable(): 867. (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(): 2fb. or *note issubclass(): 2fc.

     プロトコルクラスはジェネリックにもできます。例えば:

          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.

     バージョン 3.15 で非推奨、バージョン 3.20 で削除予定: It is
     deprecated to call *note isinstance(): 2fb. and *note issubclass():
     2fc. checks on protocol classes that were not explicitly decorated
     with ‘runtime_checkable()’ but that inherit from a
     runtime-checkable protocol class.  This will throw a *note
     TypeError: 29c. in Python 3.20.

 -- の関数: @typing.runtime_checkable

     Mark a protocol class as a runtime protocol.

     Such a protocol can be used with *note isinstance(): 2fb. and *note
     issubclass(): 2fc.  This allows a simple-minded structural check,
     very similar to "one trick ponies" in *note collections.abc: 1f.
     such as *note Iterable: 28c2.  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)

     Runtime checkability of protocols is not inherited.  A subclass of
     a runtime-checkable protocol is only runtime-checkable if it is
     explicitly marked as such, regardless of class hierarchy:

          @runtime_checkable
          class Iterable(Protocol):
              def __iter__(self): ...

          # Without @runtime_checkable, Reversible would no longer be runtime-checkable.
          @runtime_checkable
          class Reversible(Iterable, Protocol):
              def __reversed__(self): ...

     This decorator raises *note TypeError: 29c. 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: f44. is a class,
          therefore it passes an *note issubclass(): 2fc. check against
          *note Callable: 28e3.  However, the ‘ssl.SSLObject.__init__’
          method exists only to raise a *note TypeError: 29c. with a
          more informative message, therefore making it impossible to
          call (instantiate) ‘ssl.SSLObject’.

          注釈: An *note isinstance(): 2fb. 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():
          8e7. calls for structural checks in performance-sensitive
          code.

     Added in version 3.8.

     バージョン 3.12 で変更: The internal implementation of *note
     isinstance(): 2fb. checks against runtime-checkable protocols now
     uses *note inspect.getattr_static(): 8aa. to look up attributes
     (previously, *note hasattr(): 8e7. 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(): 2fb. checks comparing objects to the protocol.  See
     *note What's new in Python 3.12: 8e6. for more details.

     バージョン 3.15 で非推奨、バージョン 3.20 で削除予定: It is
     deprecated to call *note isinstance(): 2fb. and *note issubclass():
     2fc. checks on protocol classes that were not explicitly decorated
     with ‘runtime_checkable()’ but that inherit from a
     runtime-checkable protocol class.  This will throw a *note
     TypeError: 29c. in Python 3.20.

 -- クラス: typing.TypedDict (dict)

     Special construct to add type hints to a dictionary.  At runtime
     "‘TypedDict’ instances" are simply *note dicts: 193.

     ‘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: 193.:

          Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

     This functional syntax allows defining keys which are not valid
     *note identifiers: 24af, for example because they are keywords or
     contain hyphens, or when key names must not be *note mangled: 22b1.
     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: 9c8.:

          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: 9c7.:

          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

     By default, a ‘TypedDict’ is open, meaning that it may contain
     additional keys at runtime beyond those defined in the class body.
     The 'closed' class argument can be used to control this; if
     ‘closed=True’, the ‘TypedDict’ cannot contain additional keys.

          class ClosedPoint(TypedDict, closed=True):
              x: int
              y: int

          class ClosedPoint3D(ClosedPoint):  # type checker error: cannot add keys to a closed TypedDict
              z: int

     Setting ‘closed=False’ explicitly requests the default open
     behavior.  If the argument is not passed, this state is inherited
     from the parent class.

     In addition to being open or closed, a ‘TypedDict’ can also be
     configured to have extra items.  If the 'extra_items' class
     argument is set to a type, the ‘TypedDict’ can contain arbitrary
     additional keys, but the values of those keys must be of the
     specified type.

          class ExtraItemsPoint(TypedDict, extra_items=int):
              x: int
              y: int

          point: ExtraItemsPoint = {'x': 1, 'y': 2, 'anything': 3}  # OK

     The 'extra_items' argument is also inherited through subclassing.
     It is unset by default, and it may not be used together with the
     'closed' argument.

     A ‘TypedDict’ cannot inherit from a non-‘TypedDict’ class, except
     for *note Generic: 1a12.  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: 1a12. explicitly:

          T = TypeVar("T")

          class Group(TypedDict, Generic[T]):
              key: T
              group: list[T]

     A ‘TypedDict’ can be introspected via annotations dicts (see *note
     アノテーションのベストプラクティス: bba. 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: 9c8, or it may inherit from another ‘TypedDict’
          with ‘total=False’.  Therefore, it is generally better to use
          *note __required_keys__: 4770. and *note __optional_keys__:
          4771. for introspection.

      -- の属性: __required_keys__

          Added in version 3.9.

      -- の属性: __optional_keys__

          ‘Point2D.__required_keys__’ and ‘Point2D.__optional_keys__’
          return *note frozenset: 9d9. objects containing required and
          non-required keys, respectively.

          Keys marked with *note Required: 9c7. will always appear in
          ‘__required_keys__’ and keys marked with *note NotRequired:
          9c8. 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.

      -- の属性: __readonly_keys__

          A *note frozenset: 9d9. containing the names of all read-only
          keys.  Keys are read-only if they carry the *note ReadOnly:
          69c. qualifier.

          Added in version 3.13.

      -- の属性: __mutable_keys__

          A *note frozenset: 9d9. containing the names of all mutable
          keys.  Keys are mutable if they do not carry the *note
          ReadOnly: 69c. qualifier.

          Added in version 3.13.

      -- の属性: __closed__

          The value of the 'closed' class argument.  It can be ‘True’,
          ‘False’, or *note None: a6a.

      -- の属性: __extra_items__

          The value of the 'extra_items' class argument.  It can be a
          valid type or *note NoExtraItems: 4776.

     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: 9c7. or *note NotRequired: 9c8.  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: 69c.
     qualifier was added.  See PEP 705(5).

     バージョン 3.15 で変更: Support for the 'closed' and 'extra_items'
     class arguments was added.  See PEP 728(6).

   ---------- 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/

   (5) https://peps.python.org/pep-0705/

   (6) https://peps.python.org/pep-0728/


File: python.info,  Node: プロトコル<4>,  Next: ABCs and Protocols for working with I/O,  Prev: 特殊型付けプリミティブ,  Up: モジュールの内容<5>

5.27.1.18 プロトコル
....................

The following protocols are provided by the ‘typing’ module.  All are
decorated with *note @runtime_checkable: 867.

 -- クラス: typing.SupportsAbs

     返り値の型と共変な抽象メソッド ‘__abs__’ を備えた ABC です。

 -- クラス: typing.SupportsBytes

     抽象メソッド ‘__bytes__’ を備えた ABC です。

 -- クラス: typing.SupportsComplex

     抽象メソッド ‘__complex__’ を備えた ABC です。

 -- クラス: typing.SupportsFloat

     抽象メソッド ‘__float__’ を備えた ABC です。

 -- クラス: typing.SupportsIndex

     抽象メソッド ‘__index__’ を備えた ABC です。

     Added in version 3.8.

 -- クラス: typing.SupportsInt

     抽象メソッド ‘__int__’ を備えた ABC です。

 -- クラス: typing.SupportsRound

     返り値の型と共変な抽象メソッド ‘__round__’ を備えた ABC です。


File: python.info,  Node: ABCs and Protocols for working with I/O,  Next: Functions and decorators,  Prev: プロトコル<4>,  Up: モジュールの内容<5>

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(): 333.  Please note that these classes are
     not protocols, and their interface is fairly broad.

The protocols *note io.Reader: 4cb. and *note io.Writer: 4cc. 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: 28c2. 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: モジュールの内容<5>

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: 32e.
     or a *note str: 1ea, 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: 32f.  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: a9b, 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: d09. 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: 6ec.-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: 6ec.

     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: 6ec.  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:
     6ec. 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: 5f6.) - 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: 5f6.) - 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: 5f6.) - 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: 5f6.) - 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: 1d9.‘[’*note Callable:
          bca.‘[’‘...’‘, ’‘Any’‘]’‘, ’‘...’‘]’) - Specifies a static
          list of supported classes or functions that describe fields,
          similar to *note dataclasses.field(): 1966.  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: 5a1.

     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(): aa1.

 -- の関数: typing.get_overloads (func)

     Return a sequence of *note @overload: 477d.-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: 477d,
     ‘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: b1d.  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.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.disjoint_base

     Decorator to mark a class as a disjoint base.

     Type checkers do not allow child classes of a disjoint base ‘C’ to
     inherit from other disjoint bases that are not parent or child
     classes of ‘C’.

     例えば:

          @disjoint_base
          class Disjoint1: pass

          @disjoint_base
          class Disjoint2: pass

          class Disjoint3(Disjoint1, Disjoint2): pass  # Type checker error

     Type checkers can use knowledge of disjoint bases to detect
     unreachable code and determine when two types can overlap.

     The corresponding runtime concept is a solid base (see *note
     Multiple inheritance: 22af.).  Classes that are solid bases at
     runtime can be marked with ‘@disjoint_base’ in stub files.  Users
     may also mark other classes as disjoint bases to indicate to type
     checkers that multiple inheritance with other disjoint bases should
     not be allowed.

     Note that the concept of a solid base is a CPython implementation
     detail, and the exact set of standard library classes that are
     disjoint bases at runtime may change in future versions of Python.

     Added in version 3.15.

 -- の関数: @typing.type_check_only

     Decorator to mark a class or function as unavailable at runtime.

     このデコレータ自身は実行時には使えません。 このデコレータは主に、実
     装がプライベートクラスのインスタンスを返す場合に、型スタブファイル
     に定義されているクラスに対して印を付けるためのものです:

          @type_check_only
          class Response:  # private or not available at runtime
              code: int
              def get_header(self, name: str) -> str: ...

          def fetch_response() -> Response: ...

     プライベートクラスのインスタンスを返すのは推奨されません。 そのよう
     なクラスは公開クラスにするのが望ましいです。

   ---------- Footnotes ----------

   (1) https://typing.python.org/en/latest/guides/unreachable.html

   (2) https://peps.python.org/pep-0681/

   (3) https://peps.python.org/pep-0484/

   (4) https://peps.python.org/pep-0591/

   (5) https://peps.python.org/pep-0698/


File: python.info,  Node: Introspection helpers,  Next: 定数<10>,  Prev: Functions and decorators,  Up: モジュールの内容<5>

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():
     673, but this function makes the following changes to the
     annotations dictionary:

        * Forward references encoded as string literals or *note
          ForwardRef: 1df2. objects are handled by evaluating them in
          'globalns', 'localns', and (where applicable) 'obj"s *note
          type parameter: 7ab. namespace.  If 'globalns' or 'localns' is
          not given, appropriate namespace dictionaries are inferred
          from 'obj'.

        * ‘None’ is replaced with *note types.NoneType: c2e.

        * If *note @no_type_check: aa6. 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__:
          2588. and iteratively combining *note annotations: 110e. of
          each base class.  Annotations on classes appearing earlier in
          the *note method resolution order: 27a3. 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: d0d. for more information).

          注意: This function may execute arbitrary code contained in
          annotations.  See *note Security implications of introspecting
          annotations: 4780. for more information.

          注釈: If *note Format.VALUE: 412. is used and any forward
          references in the annotations of 'obj' are not resolvable, a
          *note NameError: 66c. exception is raised.  For example, this
          can happen with names imported under *note if TYPE_CHECKING:
          10b4.  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: d0d. 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(): 673. 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: baa. or *note ParamSpecKwargs:
     bab, return the underlying *note ParamSpec: 2a0.  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: c31. 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: 772.

          >>> 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: 29c. for arguments that are not Protocols.

     Added in version 3.13.

 -- の関数: typing.is_protocol (tp)

     Determine if a type is a *note Protocol: 772.

     例えば:

          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: aa4. 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: 29b.

     例えば:

          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: aa4. 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: 1988.  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: 1988. as a *note type
     hint: 25e0.

     This is similar to calling *note
     annotationlib.ForwardRef.evaluate(): 151, 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(): 151. 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: 4780. 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.

 -- データ: typing.NoExtraItems

     A *note sentinel: 196. object used to indicate that a *note
     TypedDict: 29b. does not have the 'extra_items' class argument.

          >>> from typing import TypedDict, NoExtraItems
          >>> class Point(TypedDict):
          ...     x: int
          ...     y: int
          ...
          >>> Point.__extra_items__ is NoExtraItems
          True

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0593/

   (2) https://peps.python.org/pep-0585/


File: python.info,  Node: 定数<10>,  Next: 非推奨のエイリアス,  Prev: Introspection helpers,  Up: モジュールの内容<5>

5.27.1.22 定数
..............

 -- データ: typing.TYPE_CHECKING

     A special constant that is assumed to be ‘True’ by 3rd party static
     type checkers.  It's ‘False’ at runtime.

     A module which is expensive to import, and which only contain types
     used for typing annotations, can be safely imported inside an ‘if
     TYPE_CHECKING:’ block.  This prevents the module from actually
     being imported at runtime; annotations aren't eagerly evaluated
     (see PEP 649(1)) so using undefined symbols in annotations is
     harmless-as long as you don't later examine them.  Your static type
     analysis tool will set ‘TYPE_CHECKING’ to ‘True’ during static type
     analysis, which means the module will be imported and the types
     will be checked properly during such analysis.

     使い方:

          if TYPE_CHECKING:
              import expensive_mod

          def fun(arg: expensive_mod.SomeType) -> None:
              local_var: expensive_mod.AnotherType = other_fun()

     If you occasionally need to examine type annotations at runtime
     which may contain undefined symbols, use *note
     annotationlib.get_annotations(): 673. with a ‘format’ parameter of
     *note annotationlib.Format.STRING: 414. or *note
     annotationlib.Format.FORWARDREF: 413. to safely retrieve the
     annotations without raising *note NameError: 66c.

     Added in version 3.5.2.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0649/


File: python.info,  Node: 非推奨のエイリアス,  Prev: 定数<10>,  Up: モジュールの内容<5>

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: 193. の非推奨なエイリアス。

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note Mapping: ca0. rather than to use
     *note dict: 193. or ‘typing.Dict’.

     バージョン 3.9 で非推奨: *note builtins.dict: 193. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.List (list, MutableSequence[T])

     *note list: 4e0. の非推奨なエイリアス。

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note Sequence: 1582. or *note Iterable:
     28c2. rather than to use *note list: 4e0. or ‘typing.List’.

     バージョン 3.9 で非推奨: *note builtins.list: 4e0. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Set (set, MutableSet[T])

     Deprecated alias to *note builtins.set: 432.

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note collections.abc.Set: 28b9. rather
     than to use *note set: 432. or *note typing.Set: 4789.

     バージョン 3.9 で非推奨: *note builtins.set: 432. は添字表記 (‘[]’)
     をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.FrozenSet (frozenset, AbstractSet[T_co])

     Deprecated alias to *note builtins.frozenset: 9d9.

     バージョン 3.9 で非推奨: *note builtins.frozenset: 9d9. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(4) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- データ: typing.Tuple

     *note tuple: 1d9. の非推奨なエイリアス。

     *note tuple: 1d9. and ‘Tuple’ are special-cased in the type system;
     see *note タプルのアノテーション: 28e4. for more details.

     バージョン 3.9 で非推奨: *note builtins.tuple: 1d9. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Type (Generic[CT_co])

     *note type: 191. の非推奨なエイリアス。

     See *note クラスオブジェクトの型: 4738. for details on using *note
     type: 191. or ‘typing.Type’ in type annotations.

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note builtins.type: 191. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(6) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

   ---------- 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: 157a. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.defaultdict: 157a. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.OrderedDict (collections.OrderedDict,
          MutableMapping[KT, VT])

     *note collections.OrderedDict: 9da. の非推奨なエイリアス。

     Added in version 3.7.2.

     バージョン 3.9 で非推奨: *note collections.OrderedDict: 9da. は添字
     表記 (‘[]’) をサポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.ChainMap (collections.ChainMap, MutableMapping[KT,
          VT])

     *note collections.ChainMap: fdf. の非推奨なエイリアス。

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.ChainMap: fdf. は添字表
     記 (‘[]’) をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Counter (collections.Counter, Dict[T, int])

     *note collections.Counter: 20f. の非推奨なエイリアス。

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.Counter: 20f. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(4) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Deque (deque, MutableSequence[T])

     *note collections.deque: 9db. の非推奨なエイリアス。

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.deque: 9db. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

   ---------- 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(): f97. and *note re.search(): 15e8.

     These types (and the corresponding functions) are generic over
     *note AnyStr: 7aa.  ‘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: c1. now support ‘[]’.  See PEP 585(1) and *note
     ジェネリックエイリアス型: aa4.

 -- クラス: typing.Text

     Deprecated alias for *note str: 1ea.

     ‘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: 1ea. 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: 28b9. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Set: 28b9. は添字表
     記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.ByteString (Sequence[int])

     Deprecated alias to *note collections.abc.ByteString: 2d6.

     Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
     implements the *note buffer protocol: 319. at runtime.  For use in
     type annotations, either use *note Buffer: 31a. 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: 1d2. and *note
     bytearray: 1d1.  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: 1dd. 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: 104b. の非推奨なエイリアス。

     Added in version 3.6.

     バージョン 3.9 で非推奨: *note collections.abc.Collection: 104b. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Container (Generic[T_co])

     *note collections.abc.Container: 28c4. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Container: 28c4. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(4) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.ItemsView (MappingView, AbstractSet[tuple[KT_co,
          VT_co]])

     *note collections.abc.ItemsView: 28c8. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.ItemsView: 28c8. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.KeysView (MappingView, AbstractSet[KT_co])

     *note collections.abc.KeysView: 28c7. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.KeysView: 28c7. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(6) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Mapping (Collection[KT], Generic[KT, VT_co])

     *note collections.abc.Mapping: ca0. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Mapping: ca0. は添字
     表記 (‘[]’) をサポートするようになりました。 PEP 585(7) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.MappingView (Sized)

     *note collections.abc.MappingView: 28c6. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MappingView: 28c6. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(8) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.MutableMapping (Mapping[KT, VT])

     *note collections.abc.MutableMapping: 146a. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableMapping:
     146a. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(9)
     と *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.MutableSequence (Sequence[T])

     *note collections.abc.MutableSequence: 6cc. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableSequence:
     6cc. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(10)
     と *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.MutableSet (AbstractSet[T])

     *note collections.abc.MutableSet: 28c5. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableSet: 28c5. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(11) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Sequence (Reversible[T_co], Collection[T_co])

     *note collections.abc.Sequence: 1582. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Sequence: 1582. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(12) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.ValuesView (MappingView, Collection[_VT_co])

     *note collections.abc.ValuesView: 28c9. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.ValuesView: 28c9. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(13) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

   ---------- 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: 1199. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 2bc7. for details
     on using *note collections.abc.Coroutine: 1199. and
     ‘typing.Coroutine’ in type annotations.

     Added in version 3.5.3.

     バージョン 3.9 で非推奨: *note collections.abc.Coroutine: 1199. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.AsyncGenerator (AsyncIterator[YieldType],
          Generic[YieldType, SendType])

     *note collections.abc.AsyncGenerator: 104e. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 2bc7. for details
     on using *note collections.abc.AsyncGenerator: 104e. and
     ‘typing.AsyncGenerator’ in type annotations.

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncGenerator:
     104e. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(2)
     と *note ジェネリックエイリアス型: aa4. を参照してください。

     バージョン 3.13 で変更: The ‘SendType’ parameter now has a default.

 -- クラス: typing.AsyncIterable (Generic[T_co])

     *note collections.abc.AsyncIterable: 119b. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncIterable: 119b.
     は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.AsyncIterator (AsyncIterable[T_co])

     *note collections.abc.AsyncIterator: 119a. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncIterator: 119a.
     は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(4) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Awaitable (Generic[T_co])

     *note collections.abc.Awaitable: 1198. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.Awaitable: 1198. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

   ---------- 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: 28c2. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Iterable: 28c2. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Iterator (Iterable[T_co])

     *note collections.abc.Iterator: 28c3. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Iterator: 28c3. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

 -- データ: typing.Callable

     *note collections.abc.Callable: bca. の非推奨なエイリアス。

     See *note 呼び出し可能オブジェクトのアノテーション: 28e3. for
     details on how to use *note collections.abc.Callable: bca. and
     ‘typing.Callable’ in type annotations.

     バージョン 3.9 で非推奨: *note collections.abc.Callable: bca. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

     バージョン 3.10 で変更: ‘Callable’ は *note ParamSpec: 2a0. と
     *note Concatenate: ba8. をサポートしました。詳細は PEP 612(4) を参
     照してください。

 -- クラス: typing.Generator (Iterator[YieldType], Generic[YieldType,
          SendType, ReturnType])

     *note collections.abc.Generator: 1197. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 2bc7. for details
     on using *note collections.abc.Generator: 1197. and
     ‘typing.Generator’ in type annotations.

     バージョン 3.9 で非推奨: *note collections.abc.Generator: 1197. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

     バージョン 3.13 で変更: Default values for the send and return
     types were added.

 -- クラス: typing.Hashable

     *note collections.abc.Hashable: 907. の非推奨なエイリアス。

     バージョン 3.12 で非推奨: 代わりに *note collections.abc.Hashable:
     907. を直接使用してください。

 -- クラス: typing.Reversible (Iterable[T_co])

     *note collections.abc.Reversible: 104c. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Reversible: 104c. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(6) と
     *note ジェネリックエイリアス型: aa4. を参照してください。

 -- クラス: typing.Sized

     *note collections.abc.Sized: 908. の非推奨なエイリアス。

     バージョン 3.12 で非推奨: 代わりに *note collections.abc.Sized:
     908. を直接使用してください。

   ---------- 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: 1051. の非推奨なエイリアス
     。

     The first type parameter, ‘T_co’, represents the type returned by
     the *note __enter__(): 9cb. method.  The optional second type
     parameter, ‘ExitT_co’, which defaults to ‘bool | None’, represents
     the type returned by the *note __exit__(): 16ba. method.

     Added in version 3.5.4.

     バージョン 3.9 で非推奨: *note contextlib.AbstractContextManager:
     1051. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(1)
     と *note ジェネリックエイリアス型: aa4. を参照してください。

     バージョン 3.13 で変更: Added the optional second type parameter,
     ‘ExitT_co’.

 -- クラス: typing.AsyncContextManager (Generic[T_co, AExitT_co])

     *note contextlib.AbstractAsyncContextManager: eef. の非推奨なエイリ
     アス。

     The first type parameter, ‘T_co’, represents the type returned by
     the *note __aenter__(): 2631. method.  The optional second type
     parameter, ‘AExitT_co’, which defaults to ‘bool | None’, represents
     the type returned by the *note __aexit__(): 1bcc. method.

     Added in version 3.6.2.

     バージョン 3.9 で非推奨: *note
     contextlib.AbstractAsyncContextManager: eef. は添字表記 (‘[]’) をサ
     ポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: aa4. を参照してください。

     バージョン 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: モジュールの内容<5>,  Up: typing --- 型ヒントのサポート

5.27.1.31 メジャーな機能の非推奨時系列
......................................

‘typing’ の機能の中には非推奨のものがあり、Python の将来のバージョンで削
除される可能性があります。以下の表は主な非推奨機能をまとめたものです。こ
れは変更される可能性があり、すべての非推奨機能がリストされているわけでは
ありません。

機能                          非推奨となるバージョン        削除予定のバージョン          PEP/issue
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
標準コレクションのエイリア    3.9                           未定（                        PEP 585(1)
ス                                                          *note 非推奨のエイリアス: 4783.
                                                            を参照）
                                                            
                                                                                          
*note typing.ByteString: 2ef. 3.9                           3.17                          gh-91896(2)
                                                                                          
                                                                                          
*note typing.Text: 348.       3.11                          未定                          gh-92332(3)
                                                                                          
                                                                                          
*note typing.Hashable: 905.、 3.12                          未定                          gh-94309(4)
*note typing.Sized: 906.                                                                  

*note typing.TypeAlias: bad.  3.12                          未定                          PEP 695(5)
                                                                                          
                                                                                          
*note typing.AnyStr: 7aa.     3.13                          3.18                          gh-105578(6)
                                                                                          

   ---------- 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/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__: cf8. 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(): 1b71.).

The built-in function *note help(): cad. 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: e2. モジュールのドキュメントを、Unix の
‘man’ コマンドのような形式で表示させることができます。 ‘pydoc’ の引数と
して与えることができるのは、関数名・モジュール名・パッケージ名、また、モ
ジュールやパッケージ内のモジュールに含まれるクラス・メソッド・関数へのド
ット形式での参照です。 ‘pydoc’ への引数がパスと解釈されるような場合で(オ
ペレーティングシステムのパス区切り記号を含む場合です。例えばUnixならばス
ラッシュ含む場合になります)、さらに、そのパスがPythonのソースファイルを
指しているなら、そのファイルに対するドキュメントが生成されます。

     注釈: In order to find objects and their documentation, ‘pydoc’
     imports the module(s) to be documented.  Therefore, any code on
     module level will be executed on that occasion.  Use an ‘if
     __name__ == '__main__':’ guard to only execute code when a file is
     invoked as a script and not just imported.

When printing output to the console, ‘pydoc’ attempts to paginate the
output for easier reading.  If either the ‘MANPAGER’ or the ‘PAGER’
environment variable is set, ‘pydoc’ will use its value as a pagination
program.  When both are set, ‘MANPAGER’ is used.

引数の前に ‘-w’ フラグを指定すると、コンソールにテキストを表示させるかわ
りにカレントディレクトリにHTMLドキュメントを生成します。

引数の前に ‘-k’ フラグを指定すると、引数をキーワードとして利用可能な全て
のモジュールの概要を検索します。検索のやりかたは、Unixの ‘man’ コマンド
と同様です。モジュールの概要というのは、モジュールのドキュメントの一行目
のことです。

また、 ‘pydoc’ を使うことでローカルマシンにウェブブラウザから閲覧可能な
ドキュメントを提供するHTTPサーバーを起動することもできます。 ‘python -m
pydoc -p 1234’ とすると、HTTPサーバーをポート1234に起動します。これで、
お好きなウェブブラウザを使って ‘http://localhost:1234/’ からドキュメント
を見ることができます。ポート番号に ‘0’ を指定すると、任意の空きポートが
選択されます。

‘python -m pydoc -n <hostname>’ は、与えられたホスト名で listen するサー
バーを起動します。 デフォルトではホスト名は 'localhost' ですが、他のマシ
ンからサーバーへ疎通できるようにしたい場合は、サーバーが応答するホスト名
を変更したいと思うでしょう。 開発作業中に、コンテナ内で pydoc を走らせた
い場合は、これは特に便利です。

‘python -m pydoc -b’ では、サーバとして起動するとともにブラウザも起動し
、モジュールインデクスページを開きます。提供されるページには、個別のヘル
プページに飛ぶための 'Get' ボタン、全モジュールから概要行に基くキーワー
ド検索するための 'Search' ボタン、と、'Module index', 'Topics' ,
'Keywords' へのそれぞれリンクがついたナビゲーションバーがページの一番上
に付きます。

‘pydoc’ でドキュメントを生成する場合、その時点での環境とパス情報に基づい
てモジュールがどこにあるのか決定されます。そのため、 ‘pydoc spam’ を実行
した場合につくられるドキュメントは、 Pythonインタプリタを起動して
‘import spam’ と入力したときに読み込まれるモジュールに対するドキュメント
になります。

Module docs for core modules are assumed to reside in
‘https://docs.python.org/X.Y/library/’ where ‘X’ and ‘Y’ are the major
and minor version numbers of the Python interpreter.  This can be
overridden by setting the ‘PYTHONDOCS’ environment variable to a
different URL or to a local directory containing the Library Reference
Manual pages.

バージョン 3.2 で変更: ‘-b’ オプションが追加されました。

バージョン 3.3 で変更: ‘-g’ コマンドラインオプションが削除されました。

バージョン 3.4 で変更: ‘pydoc’ now uses *note inspect.signature(): 4c4.
rather than *note inspect.getfullargspec(): b24. to extract signature
information from callables.

バージョン 3.7 で変更: ‘-n’ オプションが追加されました。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 183. command line option or by
setting the *note PYTHONDEVMODE: eb9. environment variable to ‘1’.

See also *note Python debug build: 3e3.

* 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 警告フィルタ: 2338. を追加します。次の警告が表示
     されます:

        * *note DeprecationWarning: 2d4.

        * *note ImportWarning: 90c.

        * *note PendingDeprecationWarning: c9f.

        * *note ResourceWarning: 754.

     通常、上記の警告は デフォルトの *note 警告フィルタ: 2338. によりフ
     ィルタリングされます。

     It behaves as if the *note -W default: 1cb. command line option is
     used.

     Use the *note -W error: 1cb. command line option or set the *note
     PYTHONWARNINGS: 1cc. 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(): 102c. C function.

     It behaves as if the *note PYTHONMALLOC: 1026. environment variable
     is set to ‘debug’.

     To enable the Python Development Mode without installing debug
     hooks on memory allocators, set the *note PYTHONMALLOC: 1026.
     environment variable to ‘default’.

   * Call *note faulthandler.enable(): 224. at Python startup to install
     handlers for the *note SIGSEGV: 1437, *note SIGFPE: 1438, *note
     SIGABRT: 1439, *note SIGBUS: 143a. and *note SIGILL: 143b. signals
     to dump the Python traceback on a crash.

     It behaves as if the *note -X faulthandler: 183. command line
     option is used or if the *note PYTHONFAULTHANDLER: 143c.
     environment variable is set to ‘1’.

   * Enable *note asyncio debug mode: 2347.  For example, *note asyncio:
     b. checks for coroutines that were not awaited and logs them.

     It behaves as if the *note PYTHONASYNCIODEBUG: 2346. environment
     variable is set to ‘1’.

   * Check the 'encoding' and 'errors' arguments for string encoding and
     decoding operations.  Examples: *note open(): 333, *note
     str.encode(): cab. and *note bytes.decode(): cac.

     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: 710. destructor logs ‘close()’ exceptions.

   * Set the *note dev_mode: 208e. attribute of *note sys.flags: a81. to
     ‘True’.

The Python Development Mode does not enable the *note tracemalloc: 108.
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: 754. 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: 438. command
line option from removing *note assert: d35. statements nor from setting
*note __debug__: bbb. 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: a81.

バージョン 3.8 で変更: The *note io.IOBase: 710. 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:
754. 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: 108. 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: 754. 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: 1ba.

* Menu:

* 簡単な利用法; docstring 中の実行例をチェックする: 簡単な利用法 docstring 中の実行例をチェックする.
* 簡単な利用法; テキストファイル中の実行例をチェックする: 簡単な利用法 テキストファイル中の実行例をチェックする.
* コマンドラインでの使用: コマンドラインでの使用<6>.
* doctest のからくり::
* 基本 API::
* 単体テスト API::
* 拡張 API::
* デバッグ::
* アドバイス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 1825. に渡せば、詳細報告 (verbose) モ
ードを強制できます。また、 ‘verbose=False’ にすれば禁止できます。どちら
の場合にも、 ‘testmod()’ は *note sys.argv: 161e. 上のスイッチを調べませ
ん。(したがって、 ‘-v’ をつけても効果はありません)。

There is also a command line shortcut for running *note testmod(): 1825,
see section *note コマンドラインでの使用: 47bf.

*note testmod(): 1825. の詳しい情報は *note 基本 API: 47c0. 節を参照して
ください。


File: python.info,  Node: 簡単な利用法 テキストファイル中の実行例をチェックする,  Next: コマンドラインでの使用<6>,  Prev: 簡単な利用法 docstring 中の実行例をチェックする,  Up: doctest --- 対話型の Python の例をテストする

5.27.4.2 簡単な利用法: テキストファイル中の実行例をチェックする
...............................................................

doctest のもう一つの簡単な用途は、テキストファイル中にある対話実行例に対
するテストです。これには *note testfile(): 47c3. 関数を使います:

     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(): 1825. と同じく、 *note testfile(): 47c3. は実行例が失敗
しない限り何も表示しません。実行例が失敗すると、失敗した実行例とその原因
が (場合によっては複数) ‘testmod()’ と同じ書式で標準出力に書き出されます
。

デフォルトでは、 *note testfile(): 47c3. は自分自身を呼び出したモジュー
ルのあるディレクトリを探します。その他の場所にあるファイルを見に行くよう
に ‘testfile()’ に指示するためのオプション引数についての説明は *note 基本
API: 47c0. 節を参照してください。

*note testmod(): 1825. と同様に *note testfile(): 47c3. の冗長性
(verbosity) はコマンドラインスイッチ ‘-v’ またはオプションのキーワード引
数 'verbose' によって指定できます。

There is also a command line shortcut for running *note testfile():
47c3, see section *note コマンドラインでの使用: 47bf.

*note testfile(): 47c3. の詳細は *note 基本 API: 47c0. 節を参照してくだ
さい。


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(): 1825. を実行します。このファイルがパッケ
     ージの一部で他のサブモジュールをそのパッケージからインポートしてい
     る場合はうまく動かないことに注意してください。

     If the file name does not end with ‘.py’, ‘doctest’ infers that it
     must be run with *note testfile(): 47c3. instead:

          python -m doctest -v example.txt

 -- Option: -o, --option <option>

     Option flags control various aspects of doctest's behavior, see
     section *note オプションフラグ: 12e2.

     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: 47d2. オプ
     ションか *note directive: 47d3. を有効にするしかありません。そうす
     る代わりに、テストが出力を読み取りテストの一部として期待される値と
     正しく比較するように、テストを書き直すこともできます。このソース中
     のタブの扱いは試行錯誤の結果であり、タブの扱いの中で最も問題の起き
     にくいものだということが分かっています。タブの扱いについては、独自
     の *note DocTestParser: 47d4. クラスを実装して、別のアルゴリズムを
     使うこともできます。

   * 標準出力への出力は取り込まれますが、標準エラーは取り込まれません (例
     外発生時のトレースバックは別の方法で取り込まれます)。

   * 対話セッションにおいて、バックスラッシュを用いて次の行に続ける場合
     や、その他の理由でバックスラッシュを用いる場合、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(): 1825. や *note testfile(): 47c3. に ‘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: 15a. が送出され、その詳細情報が
‘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: 15a. から始まる行) における例
外の型と詳細情報だけが比較され、それ以外の部分は無視されます。

例外を扱うコツは、実行例をドキュメントとして読む上で明らかに価値のある情
報でない限り、トレースバックスタックは省略する、ということです。したがっ
て、先ほどの例は以下のように書くべきでしょう:

     >>> raise ValueError('multi\n    line\ndetail')
     Traceback (most recent call last):
         ...
     ValueError: multi
         line
     detail

トレースバックの扱いは非常に特殊なので注意してください。特に、上の書き直
した実行例では、 ‘...’ の扱いは doctest の *note ELLIPSIS: 1826. オプシ
ョンとは独立しています。この例での省略記号は何かの省略を表しているかもし
れませんし、コンマや数字が 3 個 (または 300 個) かもしれませんし、 Monty
Python のスキットをインデントして書き写したものかもしれません。

以下の詳細はずっと覚えておく必要はないのですが、一度目を通しておいてくだ
さい:

   * doctest は期待する出力の出所が print 文なのか例外なのかを推測できま
     せん。したがって、例えば期待する出力が ‘ValueError: 42 is prime’ で
     あるような実行例は、 *note ValueError: 15a. が実際に送出された場合
     と、万が一期待する出力と同じ文字列を print した場合の両方で成功して
     しまいます。現実的には、通常の出力がトレースバックヘッダから始まる
     ことはないので、実際に問題になることはないでしょう。

   * トレースバックスタック (がある場合) の各行は、実行例の最初の行より
     も深くインデントされているか、'または' 英数文字以外で始まっていなけ
     ればなりません。トレースバックヘッダ以後に現れる行のうち、インデン
     トが等しく英数文字で始まる最初の行は例外の詳細情報が書かれた行とみ
     なされるからです。もちろん、本物のトレースバックでは正しく動作しま
     す。

   * doctest のオプション *note IGNORE_EXCEPTION_DETAIL: 16c2. を指定し
     た場合、最も左端のコロン以後の全ての内容と、例外名の中の全てのモジ
     ュール情報が無視されます。

   * 対話シェルでは、 *note SyntaxError: 189. の場合にトレースバックヘッ
     ダが省略されることがあります。しかし 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
ビット単位論理和: 26e3. でつないで様々な関数に渡すことができます。シンボ
ル名は *note doctest directives: 47d3. でも使用でき、doctest コマンドラ
インインターフェースに ‘-o’ を通して与えることができます。

最初に説明するオプション群は、テストのセマンティクスを決めます。すなわち
、実際にテストを実行したときの出力と実行例中の期待する出力とが一致してい
るかどうかを doctest がどのように判断するかを制御します:

 -- データ: doctest.DONT_ACCEPT_TRUE_FOR_1

     デフォルトでは、期待する出力ブロックに単に ‘1’ だけが入っており、実
     際の出力ブロックに ‘1’ または ‘True’ だけが入っていた場合、これらの
     出力は一致しているとみなされます。 ‘0’ と ‘False’ の場合も同様です
     。 *note DONT_ACCEPT_TRUE_FOR_1: 47db. を指定すると、こうした値の読
     み替えを行いません。デフォルトの挙動で読み替えを行うのは、最近の
     Python で多くの関数の戻り値型が整数型からブール型に変更されたことに
     対応するためです; 読み替えを行う場合、"通常の整数" の出力を期待する
     出力とするような doctest も動作します。このオプションはそのうちなく
     なるでしょうが、ここ数年はそのままでしょう。

 -- データ: doctest.DONT_ACCEPT_BLANKLINE

     デフォルトでは、期待する出力ブロックに ‘<BLANKLINE>’ だけの入った行
     がある場合、その行は実際の出力における空行に一致するようになります
     。完全な空行を入れてしまうと期待する出力がそこで終わっているとみな
     されてしまうため、期待する出力に空行を入れたい場合にはこの方法を使
     わなければなりません。 *note DONT_ACCEPT_BLANKLINE: 47dc. を指定す
     ると、 ‘<BLANKLINE>’ の読み替えを行わなくなります。

 -- データ: doctest.NORMALIZE_WHITESPACE

     このフラグを指定すると、連続する空白 (空白と改行文字) は互いに等価
     であるとみなします。期待する出力における任意の空白列は実際の出力に
     おける任意の空白と一致します。デフォルトでは、空白は厳密に一致しな
     ければなりません。 *note NORMALIZE_WHITESPACE: 47d2. は、期待する出
     力の内容が非常に長いために、ソースコード中でその内容を複数行に折り
     返して書きたい場合に特に便利です。

 -- データ: 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: 29c. 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: 1826. 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: 16c2. フラグが、 テストされている例外を含
     むモジュールの名前を無視するようになりました。

 -- データ: 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: 47df. を
     指定した場合、実行例がどこかで失敗しても、それ以後の実行例を続けて
     実行し、失敗したテストの総数を報告します; 出力が抑制されるだけです
     。

 -- データ: 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(): 47e1. は *note
     OutputChecker: 47e2. や *note DocTestRunner: 47e3. をサブクラス化し
     て、その中で新たに作成したオプションをサポートさせる際に使います。
     ‘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 オプションフラグ: 12e2. を
操作するために使われます。 doctest ディレクティブは後のソースコード例に
あるような特殊な Python コメントです:

     directive:             "#" "doctest:" *note directive_options: 47e6.
     directive_options:     *note directive_option: 47e7. ("," *note directive_option: 47e7.)*
     directive_option:      *note on_or_off: 47e8. *note directive_option_name: 47e9.
     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: 1826. ディレクティブを使うと、上のような例をうまく解決で
きます:

     >>> 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(): 1825. と *note testfile(): 47c3. は、ほとんどの基本
的な用途に十分な doctest インターフェースを提供しています。これら二つの
関数についてあまり形式的でない入門が読みたければ、 *note 簡単な利用法;
docstring 中の実行例をチェックする: 47bd. 節や *note 簡単な利用法;
テキストファイル中の実行例をチェックする: 47c1. 節を参照してください。

 -- の関数: 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(): 47c3. を呼び出しているモジ
          ュールからの相対パスになります; ただし、'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(): 181d. のように振舞います: 'globs' と 'extraglobs' と
     の間に同じキー値がある場合、両者を合わせた辞書中には 'extraglobs' の
     方の値が入ります。デフォルト、または ‘None’ であるとき、追加のグロ
     ーバル変数は使われません。この仕様は、パラメータ付きで doctest を実
     行するという、やや進んだ機能です。例えば、一般的な名前を使って基底
     クラス向けに doctest を書いておき、その後で辞書で一般的な名前からテ
     ストしたいサブクラスへの対応付けを行う辞書を 'extraglobs' に渡して
     、様々なサブクラスをテストできます。

     オプション引数 'verbose' が真の場合、様々な情報を出力します。偽の場
     合にはテストの失敗だけを報告します。デフォルトの場合や ‘None’ を指
     定した場合、*note sys.argv: 161e. に ‘'-v'’ を指定しない限りこの値
     は真になりません。

     オプション引数 'report' が真の場合、テストの最後にサマリを出力しま
     す。それ以外の場合には何も出力しません。verbose モードの場合、サマ
     リには詳細な情報を出力しますが、そうでない場合にはサマリはとても簡
     潔になります (実際には、すべてのテストが成功した場合には何も出力し
     ません)。

     オプション引数 'optionflags' (デフォルト値 ‘0’) は、各オプションフ
     ラグの *note ビット単位論理和: 26e3. を取ります。 *note
     オプションフラグ: 12e2. 節を参照してください。

     オプション引数 'raise_on_error' の値はデフォルトでは偽です。真にす
     ると、最初のテスト失敗や予期しない例外が起きたときに例外を送出しま
     す。このオプションを使うと、失敗の原因を検死デバッグ (post-mortem
     debug) できます。デフォルトの動作では、実行例の実行を継続します。

     オプション引数 'parser' には、 *note DocTestParser: 47d4. (またはそ
     のサブクラス) を指定します。このクラスはファイルから実行例を抽出す
     るために使われます。デフォルトでは通常のパーザ (‘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: 47ed. と *note testmod(): 1825. を
     合わせて利用しているようなコードでも、テスト実行例を持たないオブジ
     ェクトから出力を得るようにしています。新たに追加された *note
     DocTestFinder: 1bd2. のコンストラクタの 'exclude_empty' はデフォル
     トで真になります。

     オプション引数 'extraglobs', 'verbose', 'report', 'optionflags',
     'raise_on_error', および 'globs' は上で説明した *note testfile():
     47c3. の引数と同じです。ただし、 '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(): 47c3.
     と同様の働きをします。


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: 10f. test suites from modules
and text files containing doctests.  To integrate with ‘unittest’ test
discovery, include a *note load_tests: 47f1. 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: 11b1. インスタンスを生成するための主な関数は二つあり
ます:

 -- の関数: doctest.DocFileSuite (*paths, module_relative=True,
          package=None, setUp=None, tearDown=None, globs=None,
          optionflags=0, parser=DocTestParser(), encoding=None)

     単一または複数のテキストファイルに入っている doctest 形式のテストを
     、 *note unittest.TestSuite: 11b1. インスタンスに変換します。

     The returned *note unittest.TestSuite: 11b1. is to be run by the
     unittest framework and runs the interactive examples in each file.
     Each file is run as a separate unit test, and each example in a
     file is run as a *note subtest: 1390.  If any example in a file
     fails, then the synthesized unit test fails.  The traceback for
     failure or error contains 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(): 1a34. には、キーワード引数でオプションを指定
     できます:

     オプション引数 '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: 1c50. オブジェクトに引き渡され
     ます。 'setUp' は *note globs: 47f2. 属性を介してテストのグローバル
     変数にアクセスできます。

     オプション引数 'tearDown' には、テストを解体 (tear-down) するための
     関数を指定します。この関数は、各ファイルのテストの実行を終了するた
     びに呼び出されます。 'tearDown' 関数は *note DocTest: 1c50. オブジ
     ェクトに引き渡されます。 'tearDown' は *note globs: 47f2. 属性を介
     してテストのグローバル変数にアクセスできます。

     オプション引数 'globs' は辞書で、テストのグローバル変数の初期値が入
     ります。この辞書は各テストごとに新たにコピーして使われます。デフォ
     ルトでは 'globs' は空の新たな辞書です。

     オプション引数 'optionflags' には、テストを実行する際にデフォルトで
     適用される doctest オプションを OR で結合して指定します。 *note
     オプションフラグ: 12e2. 節を参照してください。結果レポートに関する
     オプションを指定するより適切な方法は下記の *note
     set_unittest_reportflags(): 47f3. の説明を参照してください。

     オプション引数 'parser' には、 *note DocTestParser: 47d4. (またはそ
     のサブクラス) を指定します。このクラスはファイルから実行例を抽出す
     るために使われます。デフォルトでは通常のパーザ (‘DocTestParser()’)
     です。

     オプション引数 'encoding' にはファイルをユニコードに変換する際に使
     われるエンコーディングを指定します。

     *note DocFileSuite(): 1a34. を使用してテキストファイルからロードさ
     れた doctests に提供される globals に、グローバル変数 ‘__file__’ が
     追加されます。

     バージョン 3.15 で変更: Run each example as a *note subtest: 1390.

 -- の関数: doctest.DocTestSuite (module=None, globs=None,
          extraglobs=None, test_finder=None, setUp=None, tearDown=None,
          optionflags=0, checker=None)

     doctest のテストを *note unittest.TestSuite: 11b1. に変換します。

     The returned *note unittest.TestSuite: 11b1. is to be run by the
     unittest framework and runs each doctest in the module.  Each
     docstring is run as a separate unit test, and each example in a
     docstring is run as a *note subtest: 1390.  If any of the doctests
     fail, then the synthesized unit test fails.  The traceback for
     failure or error contains 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 synthesized unit test is also
     marked as skipped.

     オプション引数 '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__: 257f.

     オプション引数 'extraglobs' には追加のグローバル変数セットを指定し
     ます。この変数セットは 'globs' に統合されます。デフォルトでは、追加
     のグローバル変数はありません。

     オプション引数 'test_finder' は、モジュールから doctest を抽出する
     ための *note DocTestFinder: 1bd2. オブジェクト (またはその代替とな
     るオブジェクト) です。

     Optional arguments 'setUp', 'tearDown', and 'optionflags' are the
     same as for function *note DocFileSuite(): 1a34. above, but they
     are called for each docstring.

     この関数は *note testmod(): 1825. と同じ検索方法を使います。

     バージョン 3.5 で変更: 'module' がドキュメンテーション文字列を含ま
     ない場合には、 *note DocTestSuite(): 11b0. は *note ValueError:
     15a. を送出するのではなく空の *note unittest.TestSuite: 11b1. を返
     します。

     バージョン 3.15 で変更: Run each example as a *note subtest: 1390.

Under the covers, *note DocTestSuite(): 11b0. creates a *note
unittest.TestSuite: 11b1. out of ‘doctest.DocTestCase’ instances, and
‘DocTestCase’ is a subclass of *note unittest.TestCase: 536.
‘DocTestCase’ isn't documented here (it's an internal detail), but
studying its code can answer questions about the exact details of *note
unittest: 10f. integration.

Similarly, *note DocFileSuite(): 1a34. creates a *note
unittest.TestSuite: 11b1. out of ‘doctest.DocFileCase’ instances, and
‘DocFileCase’ is a subclass of ‘DocTestCase’.

So both ways of creating a *note unittest.TestSuite: 11b1. 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: 10f. 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: 10f. support, via this function:

 -- の関数: doctest.set_unittest_reportflags (flags)

     Set the ‘doctest’ reporting flags to use.

     引数 'flags' はオプションフラグの *note ビット単位論理和: 26e3. を
     取ります。 *note オプションフラグ: 12e2. 節を参照してください。「レ
     ポートフラグ」しか使えません。

     This is a module-global setting, and affects all future doctests
     run by module *note unittest: 10f.: 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:
     26e3. into the option flags, and the option flags so augmented are
     passed to the *note DocTestRunner: 47e3. 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: 10f.
     レポートフラグの値を返します。


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: 47f6.: 1つの Python *note 文: 2e2d. と、その期待する
     出力をペアにしたもの。

   * *note DocTest: 1c50.: *note Example: 47f6. の集まり。通常一つの
     docstring やテキストファイルから抽出されます。

その他に、doctest の実行例を検索、構文解析、実行、チェックするための処理
クラスが以下のように定義されています:

   * *note DocTestFinder: 1bd2.: 与えられたモジュールからすべての
     docstring を検索し、 *note DocTestParser: 47d4. を使って対話モード
     での実行例が入ったすべての docstring から *note DocTest: 1c50. を生
     成します。

   * *note DocTestParser: 47d4.: (オブジェクトの docstring 等の) 文字列
     から *note DocTest: 1c50. オブジェクトを生成します。

   * *note DocTestRunner: 47e3.: *note DocTest: 1c50. 内の実行例を実行し
     、 *note OutputChecker: 47e2. を使って出力を検証します。

   * *note OutputChecker: 47e2.: 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: 1c50. インスタンス中の同名の属性の初期
     化に使われます。

     *note DocTest: 1c50. では、以下の属性を定義しています。これらの変数
     はコンストラクタで初期化されます。直接変更してはなりません。

      -- の属性: examples

          対話モードにおける実行例それぞれをエンコードしていて、テストで
          実行される、 *note Example: 47f6. オブジェクトからなるリストで
          す。

      -- の属性: globs

          実行例を実行する名前空間 (いわゆるグローバル変数) です。このメ
          ンバは、名前から値への対応付けを行っている辞書です。実行例が名
          前空間に対して (新たな変数を束縛するなど) 何らかの変更を行った
          場合、 *note globs: 47f2. への反映はテストの実行後に起こります
          。

      -- の属性: name

          *note DocTest: 1c50. を識別する名前の文字列です。通常、この値
          はテストを取り出したオブジェクトかファイルの名前になります。

      -- の属性: 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: 47fb. 中で *note DocTest: 1c50. のテスト実行例
          が始まっている行の行番号で、行番号が利用できなければ ‘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: 47f6. イ
     ンスタンス中の同名の属性の初期化に使われます。

     *note Example: 47f6. では、以下の属性を定義しています。これらの変数
     はコンストラクタで初期化されます。直接変更してはなりません。

      -- の属性: source

          実行例のソースコードが入った文字列です。ソースコードは単一の
          Python で、末尾は常に改行です。コンストラクタは必要に応じて改
          行を追加します。

      -- の属性: want

          実行例のソースコードを実行した際の期待する出力 (標準出力と、例
          外が生じた場合にはトレースバック) です。 *note want: 4800. の
          末尾は、期待する出力がまったくない場合を除いて常に改行になりま
          す。期待する出力がない場合には空文字列になります。コンストラク
          タは必要に応じて改行を追加します。

      -- の属性: exc_msg

          実行例が例外を生成すると期待される場合の例外メッセージです。例
          外を送出しない場合には ‘None’ です。この例外メッセージは、
          *note traceback.format_exception_only(): c2a. の戻り値と比較さ
          れます。値が ‘None’ でない限り、 *note exc_msg: 4801. は改行で
          終わっていなければなりません; コンストラクタは必要に応じて改行
          を追加します。

      -- の属性: 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:
          47e3.'s *note optionflags: 12e2.).  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: 1c50. を抽出する処理クラスです。モジュール、クラス、関数、
     メソッド、静的メソッド、クラスメソッド、プロパティから ‘DocTest’ を
     抽出できます。

     オプション引数 'verbose' を使うと、抽出処理の対象となるオブジェクト
     を表示できます。デフォルトは ‘False’ (出力を行わない) です。

     オプション引数 'parser' には、 docstring から *note DocTest: 1c50.
     を抽出するのに使う *note DocTestParser: 47d4. オブジェクト (または
     その代替となるオブジェクト) を指定します。

     オプション引数 'recurse' が偽の場合、 *note DocTestFinder.find():
     1c94. は与えられたオブジェクトだけを調べ、そのオブジェクトに含まれ
     る他のオブジェクトを調べません。

     オプション引数 'exclude_empty' が偽の場合、 *note
     DocTestFinder.find(): 1c94. は空の docstring を持つオブジェクトもテ
     スト対象に含めます。

     *note DocTestFinder: 1bd2. では以下のメソッドを定義しています:

      -- メソッド: find (obj[, name][, module][, globs][, extraglobs])

          'obj' または 'obj' 内に入っているオブジェクトの docstring 中で
          定義されている *note DocTest: 1c50. のリストを返します。

          オプション引数 'name' には、オブジェクトの名前を指定します。こ
          の名前は、関数が返す *note DocTest: 1c50. の名前になります。
          'name' を指定しない場合、 ‘obj.__name__’ を使います。

          オプションのパラメータ 'module' は、指定したオブジェクトを収め
          ているモジュールを指定します。 'module' を指定しないか、‘None’
          を指定した場合には、正しいモジュールを自動的に決定しようと試み
          ます。 オブジェクトのモジュールは以下のような役割を果たします:

             * 'globs' を指定していない場合、オブジェクトのモジュールは
               デフォルトの名前空間になります。

             * 他のモジュールから import されたオブジェクトに対して
               *note DocTestFinder: 1bd2. が *note DocTest: 1c50. を抽出
               するのを避けるために使います。 ('module' 由来でないオブジ
               ェクトを無視します。)

             * オブジェクトの入っているファイル名を調べるために使います
               。

             * オブジェクトがファイル内の何行目にあるかを調べる手助けに
               します。

          'module' が ‘False’ の場合には、モジュールの検索を試みません。
          これは正確さを欠くような使い方で、通常 doctest 自体のテストに
          しか使いません。'module' が ‘False’ の場合、または 'module' が
          ‘None’ で自動的に的確なモジュールを見つけ出せない場合には、す
          べてのオブジェクトは ‘(non-existent)’ モジュールに属するとみな
          され、そのオブジェクト内のすべてのオブジェクトに対して (再帰的
          に) doctest の検索を行います。

          The globals for each *note DocTest: 1c50. 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__: 257f, 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:
     1c50. オブジェクトを生成するために使われる処理クラスです。

     *note DocTestParser: 47d4. では以下のメソッドを定義しています:

      -- メソッド: get_doctest (string, globs, name, filename, lineno)

          指定した文字列からすべての doctest 実行例を抽出し、 *note
          DocTest: 1c50. オブジェクト内に集めます。

          'globs', 'name', 'filename', and 'lineno' are attributes for
          the new ‘DocTest’ object.  See the documentation for *note
          DocTest: 1c50. for more information.

      -- メソッド: get_examples (string, name='<string>')

          指定した文字列からすべての doctest 実行例を抽出し、 *note
          Example: 47f6. オブジェクトからなるリストにして返します。各
          ‘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: 47f6.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: 1c50. 内の対話モード実行例を実行し、検証する際に用い
     られる処理クラスです。

     The comparison between expected outputs and actual outputs is done
     by an *note OutputChecker: 47e2.  This comparison may be customized
     with a number of option flags; see section *note オプションフラグ:
     12e2. 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(): 6f9.; 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_skip(): 1a35, *note report_start(): 4812, *note
     report_success(): 4813, *note report_unexpected_exception(): 4814,
     and *note report_failure(): 4815.

     オプションのキーワード引数 'checker' には、 *note OutputChecker:
     47e2. オブジェクト (またはその代替となるオブジェクト) を指定します
     。このオブジェクトは doctest 実行例の期待する出力と実際の出力との比
     較を行う際に使われます。

     オプションのキーワード引数 'verbose' は、 *note DocTestRunner:
     47e3. の出すメッセージの冗長性を制御します。 'verbose' が ‘True’ の
     場合、各実行例を実行する都度、その実行例についての情報を出力します
     。 'verbose' が ‘False’ の場合、テストの失敗だけを出力します。
     'verbose' を指定しない場合や ‘None’ を指定した場合、コマンドライン
     スイッチ ‘-v’ を使った場合にのみ 'verbose' 出力を適用します。

     オプションのキーワード引数 'optionflags' を使うと、テストランナーが
     期待される出力と実際の出力を比較する方法や、テストの失敗を表示する
     方法を制御できます。詳しくは *note オプションフラグ: 12e2. 節を参照
     してください。

     The test runner accumulates statistics.  The aggregated number of
     attempted, failed and skipped examples is also available via the
     *note tries: 4816, *note failures: 4817. and *note skips: 6fa.
     attributes.  The *note run(): 6f9. and *note summarize(): 47ed.
     methods return a *note TestResults: 480d. instance.

     ‘DocTestRunner’ defines the following methods:

      -- メソッド: report_skip (out, test, example)

          Report that the given example was skipped.  This method is
          provided to allow subclasses of ‘DocTestRunner’ to customize
          their output; it should not be called directly.

          '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(): 6f9.

          Added in version 3.15.

      -- メソッド: report_start (out, test, example)

          テストランナーが実行例を処理しようとしているときにレポートを出
          力します。 *note DocTestRunner: 47e3. の出力をサブクラスでカス
          タマイズできるようにするためのメソッドです。直接呼び出してはな
          りません。

          '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(): 6f9.

      -- メソッド: report_success (out, test, example, got)

          与えられた実行例が正しく動作したことを報告します。このメソッド
          は *note DocTestRunner: 47e3. のサブクラスで出力をカスタマイズ
          できるようにするために提供されています; 直接呼び出してはなりま
          せん。

          'example' は処理する実行例です。 'got' は実行例から実際に得ら
          れた出力です。 'test' は 'example' の入っているテストです。
          'out' は出力用の関数で、 *note DocTestRunner.run(): 6f9. に渡
          されます。

      -- メソッド: report_failure (out, test, example, got)

          与えられた実行例が正しく動作しなかったことを報告します。このメ
          ソッドは *note DocTestRunner: 47e3. のサブクラスで出力をカスタ
          マイズできるようにするために提供されています; 直接呼び出しては
          なりません。

          'example' は処理する実行例です。 'got' は実行例から実際に得ら
          れた出力です。 'test' は 'example' の入っているテストです。
          'out' は出力用の関数で、 *note DocTestRunner.run(): 6f9. に渡
          されます。

      -- メソッド: report_unexpected_exception (out, test, example,
               exc_info)

          与えられた実行例が期待とは違う例外を送出したことを報告します。
          このメソッドは *note DocTestRunner: 47e3. のサブクラスで出力を
          カスタマイズできるようにするために提供されています; 直接呼び出
          してはなりません。

          'example' は処理する実行例です。 'exc_info' には予期せず送出さ
          れた例外の情報を入れたタプル (*note sys.exc_info(): a7f. の返
          す内容) になります。 'test' は 'example' の入っているテストで
          す。 'out' は出力用の関数で、 *note DocTestRunner.run(): 6f9.
          に渡されます。

      -- メソッド: run (test, compileflags=None, out=None,
               clear_globs=True)

          Run the examples in 'test' (a *note DocTest: 1c50. object),
          and display the results using the writer function 'out'.
          Return a *note TestResults: 480d. 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: 480d.
          instance.

          オプションの 'verbose' 引数を使うと、どのくらいサマリを詳しく
          するかを制御できます。冗長度を指定しない場合、 *note
          DocTestRunner: 47e3. 自体の冗長度を使います。

     *note DocTestParser: 47d4. 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:
     47e2. では、与えられた二つの出力を比較して、一致する場合には ‘True’
     を返す *note check_output(): 481a. と、二つの出力間の違いを説明する
     文字列を返す *note output_difference(): 481b. の、二つのメソッドが
     あります。

     *note OutputChecker: 47e2. では以下のメソッドを定義しています:

      -- メソッド: check_output (want, got, optionflags)

          実行例から実際に得られた出力 ('got') と、期待する出力 ('want')
          が一致する場合にのみ ‘True’ を返します。二つの文字列がまったく
          同一の場合には常に一致するとみなしますが、テストランナーの使っ
          ているオプションフラグにより、厳密には同じ内容になっていなくて
          も一致するとみなす場合もあります。オプションフラグについての詳
          しい情報は *note オプションフラグ: 12e2. 節を参照してください
          。

      -- メソッド: 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: 47e3. のサブクラス *note DebugRunner: 481e. ク
     ラスがあります。このクラスは、最初に失敗した実行例に対して例外を送
     出します。例外には実行例に関する情報が入っています。この情報は実行
     例の検死デバッグに利用できます。

   * *note DocTestSuite(): 11b0. の生成する *note unittest: 10f. テスト
     ケースは、 *note debug(): 481f. メソッドをサポートしています。
     ‘debug()’ は *note unittest.TestCase: 536. で定義されています。

   * *note pdb.set_trace(): 501. を 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(): 4820. 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(): 4821. と同じ
     です。指定したオブジェクトの docstring から合成された Python スクリ
     プトは一時ファイルに書き出され、その後 Python デバッガ *note pdb:
     aa. の制御下で実行されます。

     ローカルおよびグローバルの実行コンテキストには、‘module.__dict__’ の
     浅いコピーが使われます。

     オプション引数 'pm' は、検死デバッグを行うかどうかを指定します。
     'pm' が真の場合、スクリプトファイルは直接実行され、スクリプトが送出
     した例外が処理されないまま終了した場合にのみデバッガが立ち入ります
     。その場合、 *note pdb.post_mortem(): 1793. によって検死デバッグを
     起動し、処理されなかった例外から得られたトレースバックオブジェクト
     を渡します。 'pm' を指定しないか値を偽にした場合、 *note pdb.run():
     4822. に適切な *note exec(): 190. 呼び出しを渡して、最初からデバッ
     ガの下でスクリプトを実行します。

 -- の関数: doctest.debug_src (src, pm=False, globs=None)

     文字列中の doctest をデバッグします。

     上の *note debug(): 481f. に似ていますが、doctest の入った文字列は
     'src' 引数で直接指定します。

     オプション引数 'pm' は上の *note debug(): 481f. と同じ意味です。

     オプション引数 'globs' には、ローカルおよびグローバルな実行コンテキ
     ストの両方に使われる辞書を指定します。'globs' を指定しない場合や
     ‘None’ にした場合、空の辞書を使います。辞書を指定した場合、実際の実
     行コンテキストには浅いコピーが使われます。

*note DebugRunner: 481e. クラス自体や ‘DebugRunner’ クラスが送出する特殊
な例外は、テストフレームワークの作者にとって非常に興味のあるところですが
、ここでは概要しか述べられません。詳しくはソースコード、とりわけ
‘DebugRunner’ の docstring (それ自体 doctest です!)  を参照してください:

 -- クラス: doctest.DebugRunner (checker=None, verbose=None,
          optionflags=0)

     テストの失敗に遭遇するとすぐに例外を送出するようになっている *note
     DocTestRunner: 47e3. のサブクラスです。予期しない例外が生じると、
     *note UnexpectedException: 4824. 例外を送出します。この例外には、テ
     スト、実行例、もともと送出された例外が入っています。期待する出力と
     実際の出力が一致しないために失敗した場合には、 *note
     DocTestFailure: 4825. 例外を送出します。この例外には、テスト、実行
     例、実際の出力が入っています。

     コンストラクタのパラメータやメソッドについては、 *note 拡張 API:
     47f5. 節の *note DocTestRunner: 47e3. のドキュメントを参照してくだ
     さい。

*note DebugRunner: 481e. インスタンスの送出する例外には以下の二つがあり
ます:

 -- 例外: doctest.DocTestFailure (test, example, got)

     doctest 実行例の実際の出力が期待する出力と一致しなかったことを示す
     ために *note DocTestRunner: 47e3. が送出する例外です。コンストラク
     タの引数は、インスタンスの同名の属性を初期化するために使われます。

*note DocTestFailure: 4825. では以下の属性を定義しています:

 -- の属性: DocTestFailure.test

     実行例が失敗した時に実行されていた *note DocTest: 1c50. オブジェク
     トです。

 -- の属性: DocTestFailure.example

     失敗した *note Example: 47f6. オブジェクトです。

 -- の属性: DocTestFailure.got

     実行例の実際の出力です。

 -- 例外: doctest.UnexpectedException (test, example, exc_info)

     doctest 実行例が予期しない例外を送出したことを示すために *note
     DocTestRunner: 47e3. が送出する例外です。コンストラクタの引数は、イ
     ンスタンスの同名の属性を初期化するために使われます。

*note UnexpectedException: 4824. では以下の属性を定義しています:

 -- の属性: UnexpectedException.test

     実行例が失敗した時に実行されていた *note DocTest: 1c50. オブジェク
     トです。

 -- の属性: UnexpectedException.example

     失敗した *note Example: 47f6. オブジェクトです。

 -- の属性: UnexpectedException.exc_info

     予期しない例外についての情報の入ったタプルで、 *note
     sys.exc_info(): a7f. が返すのと同じものです。


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(): 47c3. や *note DocFileSuite(): 1a34. を使って
     そのファイルをテストします。この方法をお勧めします。最初から
     doctest を使うようにしている新たなプロジェクトでは、この方法が一番
     簡単です。

   * ‘_regrtest_topic’ という名前の関数を定義します。この関数には、ある
     トピックに対応するテストケースの入った docstring が一つだけ入ってい
     ます。この関数はモジュールと同じファイルの中にも置けますし、別のテ
     ストファイルに分けてもかまいません。

   * Define a *note __test__: 47cf. 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 アサートメソッド一覧: 4831. に進むと良いでしょう。)

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: 536, which may be used to
     create new test cases.

テストスイート (test suite)

     テストスイート ('test suite') はテストケースとテストスイートの集ま
     りで、同時に実行しなければならないテストをまとめる場合に使用します
     。

テストランナー (test runner)

     テストランナー ('test runner') はテストの実行を管理し結果を提供する
     要素です。ランナーはグラフィカルインターフェースやテキストインター
     フェースを使用しても構いませんし、テストの実行結果を示す特別な値を
     返しても構いません。

参考
....

*note doctest: 3d. モジュール

     テストをサポートするもうひとつのモジュールで、このモジュールとは趣
     きがだいぶ異なります。

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/main/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: 536. のサブクラスとして作成し
ます。メソッド名が ‘test’ で始まる三つのメソッドがテストです。テストラン
ナーはこの命名規約によってテストを行うメソッドを検索します。

これらのテスト内では、予定の結果が得られていることを確かめるために *note
assertEqual(): 93c. を、条件のチェックに *note assertTrue(): 93a. や
*note assertFalse(): 93b. を、例外が発生する事を確認するために *note
assertRaises(): 940. をそれぞれ呼び出しています。 *note assert: d35. 文
の代わりにこれらのメソッドを使用すると、テストランナーでテスト結果を集計
してレポートを作成する事ができます。

*note setUp(): 16f3. および *note tearDown(): 16f4. メソッドによって各テ
ストメソッドの前後に実行する命令を実装することが出来ます。 詳細は *note
テストコードの構成: 4834. を参照してください。

最後のブロックは簡単なテストの実行方法を示しています。 *note
unittest.main(): 1391. は、テストスクリプトのコマンドライン用インターフ
ェースを提供します。コマンドラインから起動された場合、上記のスクリプトは
以下のような結果を出力します:

     ...
     ----------------------------------------------------------------------
     Ran 3 tests in 0.000s

     OK

‘-v’ オプションをテストスクリプトに渡すことで *note unittest.main():
1391. はより冗長になり、以下のような出力をします:

     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 テストディスカバリ: 4836. が開始されます:

     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: 1ba.

* 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: d9a. の例外を発生させます。

     この機能の仕組みについては、*note シグナルハンドリング: 483a. を参
     照してください。

 -- Option: -f, --failfast

     初回のエラーもしくは失敗の時にテストを停止します。

 -- Option: -k

     パターンや部分文字列にマッチするテストメソッドとテストクラスのみ実
     行します。このオプションは複数回使うことができ、その場合はすべての
     パターンにマッチするテストケースが実行対象に含まれます。

     ワイルドカード(‘*’) を含むパターンは *note fnmatch.fnmatchcase():
     1e6b. を使用してテスト名と照合され、それ以外の場合は単純な大文字と
     小文字を区別した部分文字列マッチングが使用されます。

     パターンは、テストローダがインポートする時の完全修飾されたテストメ
     ソッド名と照合されます。

     たとえば、 ‘-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:
224b. もしくは *note packages: 225b. としてプロジェクトの最上位のディス
カバリでインポート可能である必要があります (つまり、これらのファイルは
*note identifiers: 24af. として有効である必要があるということです)。

テストディスカバリは *note TestLoader.discover(): 1393. で実装されていま
すが、コマンドラインから使う事も出来ます。その基本的な使い方は:

     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: 4842. 、 *note -p: 4844. 、および *note -t: 4846. オプションは
、この順番であれば位置引数として渡す事ができます。以下の二つのコマンドは
等価です:

     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 プロトコル: 4848. によ
ってテストのロードとディスカバリをカスタマイズすることができます。

バージョン 3.4 で変更: ディスカバリが *note 名前空間パッケージ: 535. を
サポートしました。

バージョン 3.11 で変更: Test discovery dropped the *note namespace
packages: 535. 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:
535. 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: 536.
instances.  To make your own test cases you must write subclasses of
*note TestCase: 536. or use *note FunctionTestCase: 1c9e.

*note TestCase: 536. インスタンスのテストコードは完全に独立していなけれ
ばなりません。 すなわち単独でか、他の様々なテストケースの任意の組み合わ
せのいずれかで実行可能でなければなりません。

最も単純な *note TestCase: 536. のサブクラスは、特定のテストコードを実行
するためのテストメソッド (すなわち名前が ‘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: 4831. provided by the *note TestCase: 536. 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(): 16f3. メソッドを実装することで設定コードをくくり出すこ
とができます。 テストフレームワークは実行するテストごとに自動的に
‘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(): 16f3. メソッドで例外が発生した場合、フレームワ
ークはそのテストに問題があるとみなし、そのテストメソッドは実行されません
。

同様に、テストメソッド実行後に片付けをする *note tearDown(): 16f4. メソ
ッドを提供出来ます:

     import unittest

     class WidgetTestCase(unittest.TestCase):
         def setUp(self):
             self.widget = Widget('The widget')

         def tearDown(self):
             self.widget.dispose()

*note setUp(): 16f3. が成功した場合、テストメソッドが成功したかどうかに
関わらず *note tearDown(): 16f4. が実行されます。

そのようなテストコードのための作業環境は 'テストフィクスチャ (test
fixture)' と呼ばれます。 新しい TestCase インスタンスはある単一のテスト
フィクスチャとして作成され、個々のテストメソッドを実行するのに使われます
。 従って、 *note setUp(): 16f3, *note tearDown(): 16f4,
‘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: 11b1. class.  In most cases, calling *note unittest.main():
1391. 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: 536. subclass.

For this reason, ‘unittest’ provides a *note FunctionTestCase: 1c9e.
class.  This subclass of *note TestCase: 536. 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: 1c9e. 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: 536. subclasses will make future test
     refactorings infinitely easier.

既存のテストが *note doctest: 3d. を使って書かれている場合もあるでしょう
。その場合、 ‘doctest’ は *note DocTestSuite: 11b0. クラスを提供します。
このクラスは、既存の ‘doctest’ベースのテストから、自動的に *note
unittest.TestSuite: 11b1. のインスタンスを作成します。


File: python.info,  Node: テストのスキップと予期された失敗,  Next: サブテストを利用して繰り返しテストの区別を付ける,  Prev: 既存テストコードの再利用,  Up: unittest --- ユニットテストフレームワーク

5.27.5.7 テストのスキップと予期された失敗
.........................................

Added in version 3.1.

unittest は特定のテストメソッドやテストクラス全体をスキップする仕組みを
備えています。さらに、この機能はテスト結果を「予期された失敗 (expected
failure)」とすることができ、テストが失敗しても *note TestResult: 1525. の
失敗数にはカウントされなくなります。

テストをスキップするには、 *note skip(): 1fcd. *note デコレータ: b1d. か
その条件付きバージョンの一つを使うか、*note setUp(): 16f3. やテストメソ
ッドの中で *note TestCase.skipTest(): 484e. を呼び出すか、あるいは直接
*note SkipTest: 1392. を送出するだけです。

基本的なスキップは以下のようになります:

     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(): 16f3. もスキップすることができます。この機能はセ
ットアップの対象のリソースが使用不可能な時に便利です。

予期された失敗の機能を使用するには *note expectedFailure(): 484f. デコレ
ータを使います。

     class ExpectedFailureTestCase(unittest.TestCase):
         @unittest.expectedFailure
         def test_fail(self):
             self.assertEqual(1, 0, "broken")

独自のスキップ用のデコレータの作成は簡単です。 そのためには、独自のデコ
レータのスキップしたい時点で *note skip(): 1fcd. を呼び出します。 以下の
デコレータはオブジェクトに指定した属性が無い場合にテストをスキップします
:

     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(): 484e.
     やスキッピングデコレータの一つを使用出来ます。

スキップしたテストの前後では、 *note setUp(): 16f3. および *note
tearDown(): 16f4. は実行されません。同様に、スキップしたクラスの前後では
、 *note setUpClass(): e16. および *note tearDownClass(): 16f1. は実行さ
れません。スキップしたモジュールの前後では、 *note setUpModule(): e15. お
よび *note tearDownModule(): 16f0. は実行されません。


File: python.info,  Node: サブテストを利用して繰り返しテストの区別を付ける,  Next: クラスと関数,  Prev: テストのスキップと予期された失敗,  Up: unittest --- ユニットテストフレームワーク

5.27.5.8 サブテストを利用して繰り返しテストの区別を付ける
.........................................................

Added in version 3.4.

テストの間にとても小さな差異がある場合（例えばいくつかのパラメータなど）
、unittestでは *note subTest(): 138f. コンテキストマネージャを使用してテ
ストメソッドの内部でそれらを区別することができます。

例えば以下のテストは:

     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: 536. の各インスタンスは 'methodName' という名前の単
     一の基底メソッドを実行します。 ‘TestCase’ を使用する大半の場合
     'methodName' を変更したりデフォルトの ‘runTest()’ メソッドを再実装
     することはありません。

     バージョン 3.2 で変更: *note TestCase: 536. が 'methodName' を指定
     しなくてもインスタンス化できるようになりました。これにより対話的イ
     ンタプリタから ‘TestCase’ を簡単に試せるようになりました。

     *note TestCase: 536. のインスタンスのメソッドは3種類のグループを提
     供します。 1つ目のグループはテストの実行で使用されます。 2つ目のグ
     ループは条件のチェックおよび失敗のレポートを行うテストの実装で使用
     されます。 3つ目のグループである問い合わせ用のメソッドによってテス
     ト自身の情報が収集されます。

     はじめのグループ (テスト実行) に含まれるメソッドは以下の通りです:

      -- メソッド: setUp ()

          テストフィクスチャの準備のために呼び出されるメソッドです。テス
          トメソッドの直前に呼び出されます。このメソッドで *note
          AssertionError: a9c. や *note SkipTest: 1392. 以外の例外が発生
          した場合、テストの失敗ではなくエラーとされます。デフォルトの実
          装では何も行いません。

      -- メソッド: tearDown ()

          テストメソッドが実行され、結果が記録された直後に呼び出されるメ
          ソッドです。 このメソッドはテストメソッドで例外が投げられても
          呼び出されます。 そのため、サブクラスでこのメソッドを実装する
          場合は、内部状態を確認することが必要になるでしょう。 このメソ
          ッドで *note AssertionError: a9c. や *note SkipTest: 1392. 以
          外の例外が発生した場合、テストの失敗とは別のエラーとみなされま
          す (従って報告されるエラーの総数は増えます)。 このメソッドは、
          テストの結果に関わらず *note setUp(): 16f3. が成功した場合にの
          み呼ばれます。 デフォルトの実装では何も行いません。

      -- メソッド: setUpClass ()

          個別のクラス内のテストが実行される前に呼び出されるクラスメソッ
          ドです。 ‘setUpClass’ はクラスを唯一の引数として取り、 *note
          classmethod(): 6a0. でデコレートされていなければなりません:

               @classmethod
               def setUpClass(cls):
                   ...

          詳しくは *note クラスとモジュールのフィクスチャ: 4857. を参照
          してください。

          Added in version 3.2.

      -- メソッド: tearDownClass ()

          個別のクラス内のテストが実行された後に呼び出されるクラスメソッ
          ドです。 ‘tearDownClass’ はクラスを唯一の引数として取り、
          *note classmethod(): 6a0. でデコレートされていなければなりませ
          ん:

               @classmethod
               def tearDownClass(cls):
                   ...

          詳しくは *note クラスとモジュールのフィクスチャ: 4857. を参照
          してください。

          Added in version 3.2.

      -- メソッド: run (result=None)

          テストを実行し、テスト結果を 'result' に指定された *note
          TestResult: 1525. オブジェクトにまとめます。 'result' が省略さ
          れるか ‘None’ が渡された場合、 (*note defaultTestResult():
          4858. メソッドを呼んで) 一時的な結果オブジェクトを生成し、使用
          します。 結果オブジェクトは *note run(): 1524. の呼び出し元に
          返されます。

          このメソッドは、単に *note TestCase: 536. インスタンスを呼び出
          した場合と同様に振る舞います。

          バージョン 3.3 で変更: 以前のバージョンの ‘run’ は結果オブジェ
          クトを返しませんでした。また *note TestCase: 536. インスタンス
          を呼び出した場合も同様でした。

      -- メソッド: skipTest (reason)

          テストメソッドや *note setUp(): 16f3. が現在のテストをスキップ
          する間に呼ばれます。詳細については、 *note
          テストのスキップと予期された失敗: 484d. を参照してください。

          Added in version 3.1.

      -- メソッド: subTest (msg=None, **params)

          このメソッドを囲っているブロックをサブテストとして実行するコン
          テキストマネージャを返します。 'msg' と 'params' はサブテスト
          が失敗したときに表示されるオプションの任意の値で、どんな値が使
          われたかを明確にするものです。

          テストケースには subtest 宣言を幾らでも含めることができ、任意
          にネストすることができます。

          詳細は *note サブテストを利用して繰り返しテストの区別を付ける:
          1390. を参照してください。

          Added in version 3.4.

      -- メソッド: debug ()

          テスト結果を収集せずにテストを実行します。例外が呼び出し元に通
          知されます。また、テストをデバッガで実行することができます。
     *note TestCase: 536. クラスは失敗の検査と報告を行う多くのメソッドを
     提供しています。 以下の表は最も一般的に使われるメソッドを列挙してい
     ます (より多くのアサートメソッドについては表の下を見てください):

     メソッド                                      確認事項                          初出
                                                                                     
     ----------------------------------------------------------------------------------------------------
                                                                                     
     *note assertEqual(a, b): 93c.                 ‘a == b’
                                                   
                                                                                     
     *note assertNotEqual(a, b): 93d.              ‘a != b’
                                                   
                                                                                     
     *note assertTrue(x): 93a.                     ‘bool(x) is True’
                                                   
                                                                                     
     *note assertFalse(x): 93b.                    ‘bool(x) is False’
                                                   
                                                                                     
     *note assertIs(a, b): 16f5.                   ‘a is b’                          3.1
                                                                                     
                                                                                     
     *note assertIsNot(a, b): 16f6.                ‘a is not b’                      3.1
                                                                                     
                                                                                     
     *note assertIsNone(x): 1644.                  ‘x is None’                       3.1
                                                                                     
                                                                                     
     *note assertIsNotNone(x): 1645.               ‘x is not None’                   3.1
                                                                                     
                                                                                     
     *note assertIn(a, b): 16fe.                   ‘a in b’                          3.1
                                                                                     
                                                                                     
     *note assertNotIn(a, b): 16ff.                ‘a not in b’                      3.1
                                                                                     
                                                                                     
     *note assertIsInstance(a, b): 16f7.           ‘isinstance(a, b)’                3.2
                                                                                     
                                                                                     
     *note assertNotIsInstance(a, b): 16f8.        ‘not isinstance(a, b)’            3.2
                                                                                     
                                                                                     
     *note assertIsSubclass(a, b): 539.            ‘issubclass(a, b)’                3.14
                                                                                     
                                                                                     
     *note assertNotIsSubclass(a, b): 53a.         ‘not issubclass(a, b)’            3.14
                                                                                     

     全てのアサートメソッドは 'msg' 引数を受け取り、指定された場合、失敗
     時のエラーメッセージとして使われます。 (*note longMessage: 16ef. も
     参照してください)。 'msg' キーワード引数は *note assertRaises():
     940. 、 *note assertRaisesRegex(): 942. 、 *note assertWarns():
     2ab. 、 *note assertWarnsRegex(): 2ac. には、そのメソッドをコンテキ
     ストマネージャとして使った場合にのみ使えます。

      -- メソッド: assertEqual (first, second, msg=None)

          'first' と 'second' が等しいことをテストします。両者が等しくな
          い場合、テストは失敗です。

          さらに、 'first' と 'second' が厳密に同じ型であり、list、
          tuple、dict、set、frozenset もしくは str のいずれか、またはサ
          ブクラスが *note addTypeEqualityFunc(): 1702. に登録されている
          任意の型の場合、より有用なデフォルトのエラーメッセージを生成す
          るために、その型特有の比較関数が呼ばれます（*note
          型固有のメソッドの一覧: 4859. も参照してください）。

          バージョン 3.1 で変更: 自動で型固有の比較関数が呼ばれるように
          なりました。

          バージョン 3.2 で変更: 文字列比較のデフォルトの比較関数として
          *note assertMultiLineEqual(): 16fd. が追加されました。

      -- メソッド: 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(): 2fb. が
          扱うことのできる、クラスもしくはクラスのタプルである必要があり
          ます)。正確な型をチェックするためには、 *note
          assertIs(type(obj), cls): 16f5. を使用してください。

          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(): 2fc.).  To check for the exact type, use
          *note assertIs(cls, superclass): 16f5.

          Added in version 3.14.

     以下のメソッドを使用して例外、警告、およびログメッセージの発生を確
     認することが出来ます:

     メソッド                                                      確認事項                                   初出
                                                                                                              
     --------------------------------------------------------------------------------------------------------------------------
                                                                                                              
     *note assertRaises(exc, fun, *args, **kwds): 940.             ‘fun(*args, **kwds)’ が 'exc' を送出する
                                                                   
                                                                                                              
     *note assertRaisesRegex(exc, r, fun, *args, **kwds): 942.     ‘fun(*args, **kwds)’ が 'exc' を送出して   3.1
                                                                   メッセージが正規表現 'r' とマッチする      
                                                                   
                                                                                                              
     *note assertWarns(warn, fun, *args, **kwds): 2ab.             ‘fun(*args, **kwds)’ が 'warn' を送出す    3.2
                                                                   る                                         
                                                                   
                                                                                                              
     *note assertWarnsRegex(warn, r, fun, *args, **kwds): 2ac.     ‘fun(*args, **kwds)’ が 'warn' を送出し    3.2
                                                                   てメッセージが正規表現 'r' とマッチする    
                                                                   
                                                                                                              
     *note assertLogs(logger, level): 2aa.                         ‘with’ ブロックが 最低 'level' で          3.4
                                                                   'logger' を使用する                        
                                                                   
                                                                                                              
     *note assertNoLogs(logger, level): c34.                       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(): 940. で指定した位置パラメータとキーワー
          ドパラメータを該当メソッドに渡します。 'exception' が送出され
          た場合、テストは成功です。また、他の例外が投げられた場合はエラ
          ー、例外が送出されなかった場合は失敗になります。複数の例外をキ
          ャッチする場合には、例外クラスのタプルを 'exception' に指定し
          てください。

          'exception' 引数のみ（またはそれに加えて 'msg' 引数）が渡され
          た場合には、コンテキストマネージャが返されます。これにより関数
          名を渡す形式ではなく、インラインでテスト対象のコードを書くこと
          ができます:

               with self.assertRaises(SomeException):
                   do_something()

          コンテキストマネージャとして使われたときは、 *note
          assertRaises(): 940. は加えて '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(): 940. がコンテキス
          トマネージャとして使えるようになりました。

          バージョン 3.2 で変更: ‘exception’ 属性が追加されました。

          バージョン 3.3 で変更: コンテキストマネージャとして使用したと
          きに 'msg' キーワード引数が追加されました。

      -- メソッド: assertRaisesRegex (exception, regex, callable, *args,
               **kwds)

      -- メソッド: assertRaisesRegex (exception, regex, *, msg=None)

          *note assertRaises(): 940. と同等ですが、例外の文字列表現が
          'regex' にマッチすることもテストします。 'regex' は正規表現オ
          ブジェクトか、 *note re.search(): 15e8. が扱える正規表現が書か
          れた文字列である必要があります。例えば以下のようになります:

               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(): 942. にリネ
          ームされました。

          バージョン 3.3 で変更: コンテキストマネージャとして使用したと
          きに 'msg' キーワード引数が追加されました。

      -- メソッド: assertWarns (warning, callable, *args, **kwds)

      -- メソッド: assertWarns (warning, *, msg=None)

          'callable' を呼び出した時に警告が発生することをテストします。
          *note assertWarns(): 2ab. で指定した位置パラメータとキーワード
          パラメータを該当メソッドに渡します。 'warning' が発生した場合
          にテストが成功し、そうでなければ失敗になります。例外が送出され
          た場合はエラーになります。複数の警告を捕捉する場合には、警告ク
          ラスのタプルを 'warnings' に指定してください。

          'warning' 引数のみ（またはそれに加えて 'msg' 引数）が渡された
          場合には、コンテキストマネージャが返されます。これにより関数名
          を渡す形式ではなく、インラインでテスト対象のコードを書くことが
          できます:

               with self.assertWarns(SomeWarning):
                   do_something()

          コンテキストマネージャとして使われたときは、 *note
          assertWarns(): 2ab. は加えて 'msg' キーワード引数も受け付けま
          す。

          このコンテキストマネージャは、捕捉した警告オブジェクトを
          ‘warning’ 属性に、警告が発生したソース行を ‘filename’ 属性と
          ‘lineno’ 属性に格納します。これは警告発生時に捕捉された警告に
          対して追加の確認を行いたい場合に便利です:

               with self.assertWarns(SomeWarning) as cm:
                   do_something()

               self.assertIn('myfile.py', cm.filename)
               self.assertEqual(320, cm.lineno)

          The context managers can be nested to test that multiple
          different warnings are emitted:

               with (self.assertWarns(SomeWarning),
                     self.assertWarns(OtherWarning)):
                   do_something()

          このメソッドは呼び出されたときに警告フィルタを無視して動作しま
          す。

          Added in version 3.2.

          バージョン 3.3 で変更: コンテキストマネージャとして使用したと
          きに 'msg' キーワード引数が追加されました。

          バージョン 3.15 で変更: Warnings that do not match the
          specified category are no longer swallowed.  Nested context
          managers are now supported.

      -- メソッド: assertWarnsRegex (warning, regex, callable, *args,
               **kwds)

      -- メソッド: assertWarnsRegex (warning, regex, *, msg=None)

          *note assertWarns(): 2ab. と同等ですが、警告メッセージが
          'regex' にマッチすることもテストします。 'regex' は正規表現オ
          ブジェクトか、 *note re.search(): 15e8. が扱える正規表現が書か
          れた文字列である必要があります。例えば以下のようになります:

               self.assertWarnsRegex(DeprecationWarning,
                                     r'legacy_function\(\) is deprecated',
                                     legacy_function, 'XYZ')

          もしくは:

               with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):
                   frobnicate('/etc/passwd')

          The context managers can be nested to test that multiple
          different warnings are emitted:

               with (self.assertWarns(SomeWarning, regex1),
                     self.assertWarns(OtherWarning, regex2)):
                   do_something()

          Added in version 3.2.

          バージョン 3.3 で変更: コンテキストマネージャとして使用したと
          きに 'msg' キーワード引数が追加されました。

          バージョン 3.15 で変更: Warnings that do not match the
          specified category or regex are no longer swallowed.  Nested
          context managers are now supported.

      -- メソッド: assertLogs (logger=None, level=None, formatter=None)

          'logger' かその子ロガーのうちの1つに、少なくとも1つのログメッ
          セージが少なくとも与えられた 'level' で出力されることをテスト
          するコンテキストマネージャです。

          If given, 'logger' should be a *note logging.Logger: f10.
          object or a *note str: 1ea. 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:
          22ef.) であるべきです。 デフォルトは *note logging.INFO: 22ed.
          です。

          If given, 'formatter' should be a *note logging.Formatter:
          184f. object.  The default is a formatter with format string
          ‘"%(levelname)s:%(name)s:%(message)s"’

          ‘with’ ブロック内で出たメッセージの少なくとも一つが 'logger' お
          よび 'level' 条件に合っている場合、このテストをパスします。そ
          れ以外の場合は失敗です。

          コンテキストマネージャから返されるオブジェクトは、条件に該当す
          るログメッセージを追跡し続ける記録のためのヘルパーです。 この
          オブジェクトには2つの属性があります:

           -- の属性: records

               該当するログメッセージを表す *note logging.LogRecord:
               1394. オブジェクトのリスト。

           -- の属性: output

               該当するメッセージ出力をフォーマットした *note str: 1ea.
               オブジェクトのリスト。

          以下はプログラム例です:

               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.

          バージョン 3.15 で変更: Now accepts a 'formatter' to control
          how messages are formatted.

      -- メソッド: 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: f10. オブジ
          ェクトもしくはロガーの名前である *note str: 1ea. であるべきで
          す。 デフォルトはルートロガーで、これは全てのメッセージを掴ま
          えます。

          'level' が与えられた場合、ログレベルを表す数値もしくはそれに相
          当する文字列 (例えば ‘"ERROR"’ もしくは *note logging.ERROR:
          22ef.) であるべきです。 デフォルトは *note logging.INFO: 22ed.
          です。

          *note assertLogs(): 2aa. と異なり、このコンテキストマネージャ
          は何も返しません。

          Added in version 3.10.

     より具体的な確認を行うために以下のメソッドが用意されています:

     メソッド                                    確認事項                             初出
                                                                                      
     ----------------------------------------------------------------------------------------------------
                                                                                      
     *note assertAlmostEqual(a, b): 93e.         ‘round(a-b, 7) == 0’
                                                 
                                                                                      
     *note assertNotAlmostEqual(a, b): 93f.      ‘round(a-b, 7) != 0’
                                                 
                                                                                      
     *note assertGreater(a, b): 16f9.            ‘a > b’                              3.1
                                                                                      
                                                                                      
     *note assertGreaterEqual(a, b): 16fa.       ‘a >= b’                             3.1
                                                                                      
                                                                                      
     *note assertLess(a, b): 16fb.               ‘a < b’                              3.1
                                                                                      
                                                                                      
     *note assertLessEqual(a, b): 16fc.          ‘a <= b’                             3.1
                                                                                      
                                                                                      
     *note assertRegex(s, r): 941.               ‘r.search(s)’                        3.1
                                                                                      
                                                                                      
     *note assertNotRegex(s, r): 943.            ‘not r.search(s)’                    3.2
                                                                                      
                                                                                      
     *note assertCountEqual(a, b): 15e6.         'a' contains the same elements as    3.2
                                                 'b', regardless of their order.      
                                                 
                                                                                      
     *note assertStartsWith(a, b): 53b.          ‘a.startswith(b)’                    3.14
                                                                                      
                                                                                      
     *note assertNotStartsWith(a, b): 53c.       ‘not a.startswith(b)’                3.14
                                                                                      
                                                                                      
     *note assertEndsWith(a, b): 53d.            ‘a.endswith(b)’                      3.14
                                                                                      
                                                                                      
     *note assertNotEndsWith(a, b): 53e.         ‘not a.endswith(b)’                  3.14
                                                                                      
                                                                                      
     *note assertHasAttr(a, b): 537.             ‘hasattr(a, b)’                      3.14
                                                                                      
                                                                                      
     *note assertNotHasAttr(a, b): 538.          ‘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(): 1694. と同様に) '小数位' を指定するのであって
          、'有効桁数' を指定するのではないことに注意してください。

          'places' の代わりに 'delta' が渡された場合には、'first' と
          'second' の差分が 'delta' 以下 (以上) であることをテストします
          。

          'delta' と 'places' の両方が指定された場合は *note TypeError:
          29c. が送出されます。

          バージョン 3.2 で変更: *note assertAlmostEqual(): 93e. は、オ
          ブジェクトが等しい場合には自動で近似的に等しいとみなすようにな
          りました。 *note assertNotAlmostEqual(): 93f. は、オブジェクト
          が等しい場合には自動的に失敗するようになりました。 '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(): 15e8. が扱える正規表現が書
          かれた文字列である必要があります。

          Added in version 3.1: ‘assertRegexpMatches’ という名前で追加さ
          れました。

          バージョン 3.2 で変更: メソッド ‘assertRegexpMatches()’ は
          *note assertRegex(): 941. にリネームされました。

          Added in version 3.2: *note assertNotRegex(): 943.。

      -- メソッド: 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(): 93c. メソッドは、同じ型のオブジェクトの等価性
     確認のために、型ごとに特有のメソッドにディスパッチします。これらの
     メソッドは、ほとんどの組み込み型用のメソッドは既に実装されています
     。さらに、 *note addTypeEqualityFunc(): 1702. を使う事で新たなメソ
     ッドを登録することができます:

      -- メソッド: addTypeEqualityFunc (typeobj, function)

          *note assertEqual(): 93c. で呼び出される型特有のメソッドを登録
          します。登録するメソッドは、比較する2つのオブジェクトの型が厳
          密に 'typeobj' と同じ (サブクラスでもいけません) の場合に等価
          性を確認します。 'function' は ‘assertEqual()’ と同様に、2つの
          位置引数と、3番目に msg=None のキーワード引数を取れる必要があ
          ります。このメソッドは、始めの2つに指定したパラメータ間の差分
          を検出した時に *note self.failureException(msg): 485c. の例外
          を投げる必要があります。この例外を投げる際は、出来る限り、エラ
          ーの内容が分かる有用な情報と差分の詳細をエラーメッセージに含め
          てください。

          Added in version 3.1.

     *note assertEqual(): 93c. が自動的に呼び出す型特有のメソッドの概要
     を以下の表示に記載しています。これらのメソッドは通常は直接呼び出す
     必要がないことに注意が必要です。

     メソッド                                      比較の対象                        初出
                                                                                     
     ---------------------------------------------------------------------------------------------------
                                                                                     
     *note assertMultiLineEqual(a, b): 16fd.       文字列                            3.1
                                                                                     
                                                                                     
     *note assertSequenceEqual(a, b): 1643.        シーケンス                        3.1
                                                                                     
                                                                                     
     *note assertListEqual(a, b): 1641.            リスト                            3.1
                                                                                     
                                                                                     
     *note assertTupleEqual(a, b): 1642.           タプル                            3.1
                                                                                     
                                                                                     
     *note assertSetEqual(a, b): 163f.             set または frozenset              3.1
                                                                                     
                                                                                     
     *note assertDictEqual(a, b): 1640.            辞書                              3.1
                                                                                     

      -- メソッド: assertMultiLineEqual (first, second, msg=None)

          複数行の文字列 'first' が文字列 'second' と等しいことをテスト
          します。等しくない場合には、両者の差分がハイライトされてエラー
          メッセージに表示されます。このメソッドは、デフォルトで、 *note
          assertEqual(): 93c. が string を比較するときに自動的に使用しま
          す。

          Added in version 3.1.

      -- メソッド: assertSequenceEqual (first, second, msg=None,
               seq_type=None)

          2つのシーケンスが等しいことをテストします。'seq_type' が指定さ
          れた場合、'first' と 'second' が 'seq_type' のインスタンスで無
          い場合にはテストが失敗します。シーケンスどうしが異なる場合には
          、両者の差分がエラーメッセージに表示されます。

          このメソッドは直接 *note assertEqual(): 93c. からは呼ばれませ
          んが、 *note assertListEqual(): 1641. と *note
          assertTupleEqual(): 1642. の実装で使われています。

          Added in version 3.1.

      -- メソッド: assertListEqual (first, second, msg=None)
      -- メソッド: assertTupleEqual (first, second, msg=None)

          2つのリストまたはタプルが等しいかどうかをテストします。等しく
          ない場合には、両者の差分を表示します。2つのパラメータの型が異
          なる場合にはテストがエラーになります。このメソッドは、デフォル
          トで、 *note assertEqual(): 93c. が list または tuple を比較す
          るときに自動的に使用します。

          Added in version 3.1.

      -- メソッド: assertSetEqual (first, second, msg=None)

          2つのセットが等しいかどうかをテストします。等しくない場合には
          、両者の差分を表示します。このメソッドは、デフォルトで、 *note
          assertEqual(): 93c. が set もしくは frozenset を比較するときに
          自動的に使用します。

          'first' or 'second' のいずれかに *note difference(): 28a9. が
          無い場合にはテストは失敗します。

          Added in version 3.1.

      -- メソッド: assertDictEqual (first, second, msg=None)

          2つの辞書が等しいかどうかをテストします。等しくない場合には、
          両者の差分を表示します。このメソッドは、デフォルトで、 *note
          assertEqual(): 93c. が dict を比較するときに自動的に使用します
          。

          Added in version 3.1.

     最後に、 *note TestCase: 536. の残りのメソッドと属性を紹介します:

      -- メソッド: fail (msg=None)

          無条件にテストを失敗させます。エラーメッセージの表示に、'msg'
          または ‘None’ が使われます。

      -- の属性: failureException

          *note test(): eb. メソッドが送出する例外を指定するクラス属性で
          す。例えばテストフレームワークで追加情報を付した特殊な例外が必
          要になる場合、この例外のサブクラスとして作成します。この属性の
          初期値は *note AssertionError: a9c. です。

      -- の属性: longMessage

          このクラス属性は、失敗した assertXYY の呼び出しで独自の失敗時
          のメッセージが msg 引数として渡されていたときにどうするかを決
          定します。 ‘True’ がデフォルト値です。 この場合、標準の失敗時
          のメッセージの後に独自のメッセージが追記されます。 ‘False’ に
          設定したときは、標準のメッセージを独自のメッセージで置き換えま
          す。

          アサートメソッドを呼び出す前に、個別のテストメソッドの中でイン
          スタンス属性 self.longMessage を ‘True’ または ‘False’ に設定
          して、この設定を上書きできます。

          このクラスの設定はそれぞれのテストを呼び出す前にリセットされま
          す。

          Added in version 3.1.

      -- の属性: maxDiff

          この属性は、アサーションメソッドが失敗をレポートする時に表示す
          る差分の長さをコントロールします。デフォルトは 80*8 文字です。
          この属性が影響するメソッドは、 *note assertSequenceEqual():
          1643. (およびこのメソッドに委譲するシーケンス比較メソッド)、
          *note assertDictEqual(): 1640. と *note
          assertMultiLineEqual(): 16fd. です。

          ‘maxDiff’ を ‘None’ に設定すると差分表示の上限がなくなります。

          Added in version 3.2.

     テストフレームワークは、テスト情報を収集するために以下のメソッドを
     使用します:

      -- メソッド: countTestCases ()

          テストオブジェクトに含まれるテストの数を返します。 *note
          TestCase: 536. インスタンスは常に ‘1’ を返します。

      -- メソッド: defaultTestResult ()

          このテストケースクラスで使われるテスト結果クラスのインスタンス
          を (もし *note run(): 1524. メソッドに他の結果インスタンスが提
          供されないならば) 返します。

          *note TestCase: 536. インスタンスに対しては、いつも *note
          TestResult: 1525. のインスタンスですので、 ‘TestCase’ のサブク
          ラスでは必要に応じてこのメソッドをオーバライドしてください。

      -- メソッド: id ()

          テストケースを特定する文字列を返します。通常、'id' はモジュー
          ル名・クラス名を含む、テストメソッドのフルネームを指定します。

      -- メソッド: shortDescription ()

          テストの説明を一行分、または説明がない場合には ‘None’ を返しま
          す。デフォルトでは、テストメソッドの docstring の先頭の一行、
          または ‘None’ を返します。

          バージョン 3.1 で変更: 3.1で docstring があったとしても、返さ
          れる短い説明文字列にテスト名が付けられるようになりました。 こ
          の変更によって unittest 拡張に互換性の問題が発生し、 Python
          3.2 でテスト名が追加される場所は *note TextTestResult: 944. へ
          移動しました。

      -- メソッド: addCleanup (function, /, *args, **kwargs)

          *note tearDown(): 16f4. の後に呼び出される関数を追加します。こ
          の関数はリソースのクリーンアップのために使用します。追加された
          関数は、追加された順と逆の順番で呼び出されます（LIFO）。 *note
          addCleanup(): e47. に渡された引数とキーワード引数が追加された
          関数にも渡されます。

          *note setUp(): 16f3. が失敗した場合、つまり *note tearDown():
          16f4. が呼ばれなかった場合でも、追加されたクリーンアップ関数は
          呼び出されます。

          Added in version 3.1.

      -- メソッド: enterContext (cm)

          Enter the supplied *note context manager: 47f.  If successful,
          also add its *note __exit__(): 16ba. method as a cleanup
          function by *note addCleanup(): e47. and return the result of
          the *note __enter__(): 9cb. method.

          Added in version 3.11.

      -- メソッド: doCleanups ()

          このメソッドは、 *note tearDown(): 16f4. の後、もしくは、
          *note setUp(): 16f3. が例外を投げた場合は ‘setUp()’ の後に、無
          条件で呼ばれます。

          このメソッドは、 *note addCleanup(): e47. で追加された関数を呼
          び出す責務を担います。もし、クリーンアップ関数を *note
          tearDown(): 16f4. より前に呼び出す必要がある場合には、 *note
          doCleanups(): 16f2. を明示的に呼び出してください。

          *note doCleanups(): 16f2. は、どこで呼び出されても、クリーンア
          ップ関数をスタックから削除して実行します。

          Added in version 3.1.

      -- メソッド: classmethod addClassCleanup (function, /, *args,
               **kwargs)

          *note tearDownClass(): 16f1. の後に呼び出される関数を追加しま
          す。この関数はリソースのクリーンアップのために使用します。追加
          された関数は、追加された順と逆の順番で呼び出されます（LIFO）。
          *note addClassCleanup(): e14. に渡された引数とキーワード引数が
          追加された関数にも渡されます。

          *note setUpClass(): e16. が失敗した場合、つまり *note
          tearDownClass(): 16f1. が呼ばれなかった場合でも、追加されたク
          リーンアップ関数は呼び出されます。

          Added in version 3.8.

      -- メソッド: classmethod enterClassContext (cm)

          Enter the supplied *note context manager: 47f.  If successful,
          also add its *note __exit__(): 16ba. method as a cleanup
          function by *note addClassCleanup(): e14. and return the
          result of the *note __enter__(): 9cb. method.

          Added in version 3.11.

      -- メソッド: classmethod doClassCleanups ()

          このメソッドは、 *note tearDownClass(): 16f1. の後、もしくは、
          *note setUpClass(): e16. が例外を投げた場合は ‘setUpClass()’ の
          後に、無条件で呼ばれます。

          このメソッドは、 *note addClassCleanup(): e14. で追加された関
          数を呼び出す責務を担います。もし、クリーンアップ関数を *note
          tearDownClass(): 16f1. より前に呼び出す必要がある場合には、
          *note doClassCleanups(): 4862. を明示的に呼び出してください。

          *note doClassCleanups(): 4862. は、どこで呼び出されても、クリ
          ーンアップ関数をスタックから削除して実行します。

          Added in version 3.8.

 -- クラス: unittest.IsolatedAsyncioTestCase (methodName='runTest')

     このクラスは *note TestCase: 536. と似たAPIを提供し、テスト関数とし
     てコルーチンも許容します。

     Added in version 3.8.

      -- の属性: loop_factory

          The 'loop_factory' passed to *note asyncio.Runner: 315.
          Override in subclasses with *note asyncio.EventLoop: 1c8c. to
          avoid using the asyncio policy system.

          Added in version 3.13.

      -- メソッド: async asyncSetUp ()

          テストフィクスチャを用意するために呼び出されるメソッドです。こ
          れは *note TestCase.setUp(): 16f3. の後に呼び出されます。これ
          はテストメソッドを呼び出す直前に呼び出されます。*note
          AssertionError: a9c. と *note SkipTest: 1392. を除いて、このメ
          ソッドのによって送出されたあらゆる例外はテストの失敗ではなくエ
          ラーとみなされます。デフォルトの実装では何もしません。

      -- メソッド: async asyncTearDown ()

          テストメソッドが呼び出され、その結果が記録された直後に呼び出さ
          れるメソッドです。これは *note tearDown(): 16f4. の前に呼び出
          されます。これはテストメソッドが例外を送出した場合でも呼び出さ
          れるので、サブクラスの実装では内部状態のチェックに特に気を付け
          る必要があります。このメソッドで送出された *note
          AssertionError: a9c. と *note SkipTest: 1392. 以外の例外は、テ
          ストの失敗ではなく追加のエラーとみなされます(そのため、報告さ
          れるエラーの総数が増えることになります)。このメソッドはテスト
          メソッドの結果に関係なく、*note asyncSetUp(): 4864. が成功した
          場合にのみ呼び出されます。デフォルトの実装では何もしません。

      -- メソッド: addAsyncCleanup (function, /, *args, **kwargs)

          このメソッドはクリーンアップ関数として使用できるコルーチンを受
          け入れます。

      -- メソッド: async enterAsyncContext (cm)

          Enter the supplied *note asynchronous context manager: 9d7.
          If successful, also add its *note __aexit__(): 1bcc. method as
          a cleanup function by *note addAsyncCleanup(): 4866. and
          return the result of the *note __aenter__(): 2631. method.

          Added in version 3.11.

      -- メソッド: run (result=None)

          テストを実行するための新しいイベントループを作成し、 'result'
          として渡された *note TestResult: 1525. オブジェクトに結果を収
          集します。'result' が省略された場合や ‘None’ の場合は、一時的
          なresultオブジェクトが(*note defaultTestResult(): 4858. メソッ
          ドの呼び出しによって)作成され、使用されます。このresultオブジ
          ェクトは *note run(): 4867. の呼び出し元に返されます。テスト終
          了時には、イベントループ内のすべてのタスクがキャンセルされます
          。

     順番を示す例です:

          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: 536.
     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: 11b1. インスタン
     スを実行することはスイートをイテレートして得られる個々のテストを実
     行することと同じです。

     引数 'tests' が指定された場合、それはテストケースに亘る繰り返し可能
     オブジェクトまたは内部でスイートを組み立てるための他のテストスイー
     トでなければなりません。後からテストケースやスイートをコレクション
     に付け加えるためのメソッドも提供されています。

     *note TestSuite: 11b1. は *note TestCase: 536. オブジェクトのように
     振る舞います。違いは、スイートにはテストを実装しない点にあります。
     代わりに、テストをまとめてグループ化して、同時に実行します。
     ‘TestSuite’ のインスタンスにテスト追加するためのメソッドが用意され
     ています:

      -- メソッド: addTest (test)

          *note TestCase: 536. 又は *note TestSuite: 11b1. のインスタン
          スをスイートに追加します。

      -- メソッド: addTests (tests)

          イテラブル 'tests' に含まれる全ての *note TestCase: 536. 又は
          *note TestSuite: 11b1. のインスタンスをスイートに追加します。

          このメソッドは 'tests' 上のイテレーションをしながらそれぞれの
          要素に *note addTest(): 486a. を呼び出すのと等価です。

     *note TestSuite: 11b1. クラスは *note TestCase: 536. と以下のメソッ
     ドを共有します:

      -- メソッド: run (result)

          スイート内のテストを実行し、結果を 'result' で指定した結果オブ
          ジェクトに収集します。 *note TestCase.run(): 1524. と異なり、
          *note TestSuite.run(): 486c. では必ず結果オブジェクトを指定す
          る必要があります。

      -- メソッド: debug ()

          このスイートに関連づけられたテストを結果を収集せずに実行します
          。これによりテストで送出された例外は呼び出し元に伝わるようにな
          り、デバッガの下でのテスト実行をサポートできるようになります。

      -- メソッド: countTestCases ()

          このテストオブジェクトによって表現されるテストの数を返します。
          これには個別のテストと下位のスイートも含まれます。

      -- メソッド: __iter__ ()

          *note TestSuite: 11b1. でグループ化されたテストは反復アクセス
          できます。 サブクラスは ‘__iter__()’ をオーバーライドすること
          で、遅延処理でテストを提供できます。 1つのスイート内でこのメソ
          ッドは何度も呼ばれる可能性があることに注意してください (例えば
          、テスト数のカウントや等価性の比較)。 そのため、 *note
          TestSuite.run(): 486c. を実行する前に反復アクセスを何度繰り返
          しても同じテスト群を返すようにしなければなりません。 呼び出し
          側が ‘TestSuite._removeTestAtIndex()’ をオーバーライドしたサブ
          クラスを使いテストへの参照を保存していない限り、
          ‘TestSuite.run()’ を実行した後はこのメソッドが返すテスト群を信
          頼すべきではありません。

          バージョン 3.2 で変更: 以前のバージョンでは *note TestSuite:
          11b1. はイテレータではなく、直接テストにアクセスしていました。
          そのため、 ‘__iter__()’ をオーバーラードしてもテストにアクセス
          できませんでした。

          バージョン 3.4 で変更: 以前のバージョンでは、 *note
          TestSuite.run(): 486c. の実行後は *note TestSuite: 11b1. が各
          *note TestCase: 536. への参照を保持していました。 サブクラスで
          ‘TestSuite._removeTestAtIndex()’ をオーバーライドすることでこ
          の振る舞いを復元できます。

     通常、 *note TestSuite: 11b1. の *note run(): 486c. メソッドは
     ‘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: 4870.  Using a subclass
     or instance, however, allows customization of some configurable
     properties.

     *note TestLoader: 798. オブジェクトには以下の属性があります:

      -- の属性: errors

          テストの読み込み中に起きた致命的でないエラーのリストです。 ど
          の時点でもローダーからリセットされることはありません。 致命的
          なエラーは適切なメソッドが例外を送出して、呼び出し元に通知しま
          す。 致命的でないエラーも、実行したときのエラーを総合テストが
          通知してくれます。

          Added in version 3.5.

     *note TestLoader: 798. のオブジェクトには以下のメソッドがあります:

      -- メソッド: loadTestsFromTestCase (testCaseClass)

          *note TestCase: 536. の派生クラス ‘testCaseClass’ に含まれる全
          テストケースのスイートを返します。

          *note getTestCaseNames(): 79b. で指定されたメソッドに対し、テ
          ストケースインスタンスが作成されます。 デフォルトでは ‘test’ で
          始まる名前のメソッド群です。 ‘getTestCaseNames()’ がメソッド名
          を返さなかったが、 ‘runTest()’ メソッドが実装されている場合は
          、そのメソッドに対するテストケースが代わりに作成されます。

      -- メソッド: loadTestsFromModule (module, *, pattern=None)

          指定したモジュールに含まれる全テストケースのスイートを返します
          。このメソッドは 'module' 内の *note TestCase: 536. 派生クラス
          を検索し、見つかったクラスのテストメソッドごとにクラスのインス
          タンスを作成します。

               注釈: *note TestCase: 536. クラスを基底クラスとしてクラス
               階層を構築するとテストフィクスチャや補助的な関数をうまく
               共用することができますが、基底クラスに直接インスタンス化
               できないテストメソッドがあると、この
               ‘loadTestsFromModule()’ を使うことができません。この場合
               でも、 fixture が全て別々で定義がサブクラスにある場合は使
               用することができます。

          モジュールが ‘load_tests’ 関数を用意している場合、この関数がテ
          ストの読み込みに使われます。 これによりテストの読み込み処理が
          カスタマイズできます。 これが *note load_tests プロトコル:
          4848. です。 '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: 11b1. インス
          タンスまたは *note TestCase: 536. か ‘TestSuite’ のインスタン
          スを返す呼び出し可能オブジェクトを指定します。このチェックはこ
          こで挙げた順番に行なわれます。すなわち、候補テストケースクラス
          内のメソッドは「呼び出し可能オブジェクト」としてではなく「テス
          トケースクラス内のメソッド」として拾い出されます。

          例えば モジュールに *note TestCase: 536. から派生した クラスが
          あり、 ‘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: 1c8. か *note AttributeError: 1b4. が発生した場合
          、実行するとその例外を発生させるようなテストを合成して返します
          。それらのエラーは self.errors に集められます。

      -- メソッド: loadTestsFromNames (names, module=None)

          *note loadTestsFromName(): 1700. と同じですが、名前を一つだけ
          指定するのではなく、複数の名前のシーケンスを指定する事ができま
          す。戻り値は 'names' 中の名前で指定されるテスト全てを含むテス
          トスイートです。

      -- メソッド: getTestCaseNames (testCaseClass)

          'testCaseClass' 中の全てのメソッド名を含むソート済みシーケンス
          を返します。 'testCaseClass' は *note TestCase: 536. のサブク
          ラスでなければなりません。

      -- メソッド: discover (start_dir, pattern='test*.py',
               top_level_dir=None)

          指定された開始ディレクトリからサブディレクトリに再帰することで
          すべてのテストモジュールを検索し、それらを含む TestSuite オブ
          ジェクトを返します。'pattern' にマッチしたテストファイルだけが
          ロードの対象になります。 (シェルスタイルのパターンマッチングが
          使われます)。その中で、インポート可能なもジュール (つまり
          Python の識別子として有効であるということです) がロードされま
          す。

          すべてのテストモジュールはプロジェクトのトップレベルからインポ
          ート可能である必要があります。開始ディレクトリがトップレベルデ
          ィレクトリでない場合は、'top_level_dir' を個別に指定しなければ
          なりません。

          シンタックスエラーなどでモジュールのインポートに失敗した場合、
          エラーが記録され、ディスカバリ自体は続けられます。 import の失
          敗が *note SkipTest: 1392. 例外が発生したためだった場合は、そ
          のモジュールはエラーではなく 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: 1392. を
          送出するモジュールはエラーではなくスキップとして記録されます。

          'start_dir' に *note 名前空間パッケージ: 535. を指定できます。

          ファイルシステムの順序がファイル名に従わないとしても実行順序が
          一定になるように、パスはインポートする前にソートされます。

          バージョン 3.5 で変更: パッケージ名がデフォルトのパターンに適
          合するのは不可能なので、パスが 'pattern' に適合するかどうかに
          関係無く、見付けたパッケージに ‘load_tests’ があるかをチェック
          するようになりました。

          バージョン 3.11 で変更: 'start_dir' can not be a *note
          namespace packages: 535.  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: 535.

     以下の属性は、サブクラス化またはインスタンスの属性値を変更して
     *note TestLoader: 798. をカスタマイズする場合に使用します:

      -- の属性: testMethodPrefix

          テストメソッドの名前と判断されるメソッド名の接頭語を示す文字列
          。デフォルト値は ‘'test'’ です。

          この値は *note getTestCaseNames(): 79b. と全ての
          ‘loadTestsFrom*’ メソッドに影響を与えます。

      -- の属性: sortTestMethodsUsing

          *note getTestCaseNames(): 79b. および全ての ‘loadTestsFrom*’ メ
          ソッドでメソッド名をソートする際に使用する比較関数。

      -- の属性: suiteClass

          テストのリストからテストスイートを構築する呼び出し可能オブジェ
          クト。メソッドを持つ必要はありません。デフォルト値は *note
          TestSuite: 11b1. です。

          この値は全ての ‘loadTestsFrom*’ メソッドに影響を与えます。

      -- の属性: testNamePatterns

          テストメソッドがテストスイートに含まれるためにマッチしなければ
          ならないUnixシェルスタイルのワイルドカードテスト名パターンのリ
          ストです(‘-k’ オプションを参照)。

          この属性が ‘None’ (デフォルト)でない場合、テストスイートに含ま
          れるすべてのテストメソッドはこのリストのパターンのいずれかにマ
          ッチしていなければなりません。マッチは常に *note
          fnmatch.fnmatchcase(): 1e6b. を使用して実行されるため、‘-k’ オ
          プションに渡されるパターンとは異なり、単純な部分文字列パターン
          は ‘*’ ワイルドカードを使用して変換する必要があることに注意し
          てください。

          この値は全ての ‘loadTestsFrom*’ メソッドに影響を与えます。

          Added in version 3.7.

 -- クラス: unittest.TestResult

     このクラスはどのテストが成功しどのテストが失敗したかという情報を収
     集するのに使います。

     *note TestResult: 1525. は、複数のテスト結果を記録します。 *note
     TestCase: 536. クラスと *note TestSuite: 11b1. クラスのテスト結果を
     正しく記録しますので、テスト開発者が独自にテスト結果を管理する処理
     を開発する必要はありません。

     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: 1525. インスタンスの以下の属性は、テストの実行結
     果を検査する際に使用することができます:

      -- の属性: errors

          *note TestCase: 536. と例外のトレースバック情報をフォーマット
          した文字列の 2 要素タプルからなるリスト。それぞれのタプルは予
          想外の例外を送出したテストに対応します。

      -- の属性: failures

          *note TestCase: 536. と例外のトレースバック情報をフォーマット
          した文字列の 2 要素タプルからなるリスト。それぞれのタプルは
          ref:‘assert* メソッド <assert-methods>’ を使って見つけ出した失
          敗に対応します。

      -- の属性: skipped

          *note TestCase: 536. インスタンスとテストをスキップした理由を
          保持する文字列の2要素タプルからなるリストです。

          Added in version 3.1.

      -- の属性: expectedFailures

          *note TestCase: 536. と例外のトレースバック情報をフォーマット
          済の文字列の 2 要素タプルからなるリストです。それぞれのタプル
          は予期された失敗またはエラーに対応します。

      -- の属性: unexpectedSuccesses

          予期された失敗とされていながら成功してしまった *note TestCase:
          536. のインスタンスのリスト。

      -- の属性: 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(): 487b. によりテストの実行が
          停止します。

      -- の属性: testsRun

          これまでに実行したテストの総数です。

      -- の属性: buffer

          ‘True’ が設定されると、 ‘sys.stdout’ と ‘sys.stderr’ は、
          *note startTest(): 487e. から *note stopTest(): 487f. が呼ばれ
          るまでの間バッファリングされます。実際に、結果が ‘sys.stdout’
          と ‘sys.stderr’ に出力されるのは、テストが失敗するかエラーが発
          生した時になります。表示の際には、全ての失敗 / エラーメッセー
          ジが表示されます。

          Added in version 3.2.

      -- の属性: failfast

          真の場合 *note stop(): 487b. が始めの失敗もしくはエラーの時に
          呼び出され、テストの実行が終了します。

          Added in version 3.2.

      -- の属性: tb_locals

          真の場合、局所変数がトレースバックに表示されます。

          Added in version 3.5.

      -- メソッド: wasSuccessful ()

          これまでに実行したテストが全て成功していれば ‘True’ を、それ以
          外なら ‘False’ を返します。

          バージョン 3.4 で変更: *note expectedFailure(): 484f. デコレ－
          タでマークされたテストに *note unexpectedSuccesses: 4879. があ
          った場合 ‘False’ を返します。

      -- メソッド: stop ()

          このメソッドを呼び出して *note TestResult: 1525. の *note
          shouldStop: 487a. 属性に ‘True’ をセットすることで、実行中のテ
          ストは中断しなければならないというシグナルを送ることができます
          。 ‘TestRunner’ オブジェクトはこのフラグを順守してそれ以上のテ
          ストを実行することなく復帰しなければなりません。

          たとえばこの機能は、ユーザのキーボード割り込みを受け取って
          *note TextTestRunner: 1cd8. クラスがテストフレームワークを停止
          させるのに使えます。 ‘TestRunner’ の実装を提供する対話的なツー
          ルでも同じように使用することができます。

     *note TestResult: 1525. クラスの以下のメソッドは内部データ管理用の
     メソッドですが、対話的にテスト結果をレポートするテストツールを開発
     する場合などにはサブクラスで拡張することができます。

      -- メソッド: 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(): a7f. が返すタプル
          ‘(type, value, traceback)’ です。

          デフォルトの実装では、タプル、 ‘(test, formatted_err)’ をイン
          スタンスの *note errors: 4875. 属性に追加します。ここで、
          'formatted_err' は、 'err' から導出される、整形されたトレース
          バックです。

      -- メソッド: addFailure (test, err)

          テストケース 'test' が失敗した場合に呼び出されます。 'err' は
          *note sys.exc_info(): a7f. が返すタプル ‘(type, value,
          traceback)’ です。

          デフォルトの実装では、タプル、 ‘(test, formatted_err)’ をイン
          スタンスの *note failures: 4876. 属性に追加します。ここで、
          'formatted_err' は、 'err' から導出される、整形されたトレース
          バックです。

      -- メソッド: addSuccess (test)

          テストケース 'test' が成功した場合に呼び出されます。

          デフォルトの実装では何もしません。

      -- メソッド: addSkip (test, reason)

          'test' がスキップされた時に呼び出されます。'reason' はスキップ
          の際に渡された理由の文字列です。

          デフォルトの実装では、 ‘(test, reason)’ のタプルをインスタンス
          の *note skipped: 4877. 属性に追加します。

      -- メソッド: addExpectedFailure (test, err)

          *note expectedFailure(): 484f. のデコレータでマークされた
          'test' が失敗またはエラーの時に呼び出されます。

          デフォルトの実装では ‘(test, formatted_err)’ のタプルをインス
          タンスの *note expectedFailures: 4878. に追加します。ここで
          'formatted_err' は 'err' から派生した整形されたトレースバック
          です。

      -- メソッド: addUnexpectedSuccess (test)

          *note expectedFailure(): 484f. のデコレータでマークされた
          'test' が成功した時に呼び出されます。

          デフォルトの実装ではテストをインスタンスの *note
          unexpectedSuccesses: 4879. 属性に追加します。

      -- メソッド: addSubTest (test, subtest, outcome)

          サブテストが終了すると呼ばれます。 'test' はテストメソッドに対
          応するテストケースです。 'subtest' はサブテストを記述するカス
          タムの *note TestCase: 536. インスタンスです。

          'outcome' が *note None: a6a. の場合サブテストは成功です。 そ
          れ以外の場合は失敗で、*note sys.exc_info(): a7f. が返す形式
          ‘(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: 1525. used by the
     *note TextTestRunner: 1cd8.  Subclasses should accept ‘**kwargs’ to
     ensure compatibility as the interface changes.

     Added in version 3.2.

     バージョン 3.12 で変更: 'durations' キーワード引数が追加されました
     。

 -- データ: unittest.defaultTestLoader

     *note TestLoader: 798. のインスタンスで、共用することが目的です。
     ‘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: d09. が出
     力ストリームとして使われます。 このクラスはいくつかの設定項目がある
     だけで、基本的に非常に単純です。 グラフィカルなテスト実行アプリケー
     ションでは、独自のテストランナーを実装してください。 テストランナー
     の実装は、 unittest に新しい機能が追加されランナーを構築するインタ
     ーフェースが変更されたときに備えて ‘**kwargs’ を受け取れるようにす
     るべきです。

     By default this runner shows *note DeprecationWarning: 2d4, *note
     PendingDeprecationWarning: c9f, *note ResourceWarning: 754. and
     *note ImportWarning: 90c. even if they are *note ignored by
     default: 4886.  This behavior can be overridden using Python's
     ‘-Wd’ or ‘-Wa’ options (see *note Warning control: 2337.) and
     leaving 'warnings' to ‘None’.

     バージョン 3.2 で変更: 'warnings' 引数が追加されました。

     バージョン 3.2 で変更: インポート時でなくインスタンス化時にデフォル
     トのストリームが *note sys.stderr: d09. に設定されます。

     バージョン 3.5 で変更: 'tb_locals' 引数が追加されました。

     バージョン 3.12 で変更: 'durations' 引数が追加されました。

      -- メソッド: _makeResult ()

          このメソッドは *note run(): 4888. で使われる ‘TestResult’ のイ
          ンスタンスを返します。このメソッドは明示的に呼び出す必要はあり
          ませんが、サブクラスで ‘TestResult’ をカスタマイズすることがで
          きます。

          ‘_makeResult()’ は、 ‘TextTestRunner’ のコンストラクタで
          ‘resultclass’ 引数として渡されたクラスもしくはコーラブルオブジ
          ェクトをインスタンス化します。 ‘resultclass’ が指定されていな
          い場合には、デフォルトで *note TextTestResult: 944. が使用され
          ます。結果のクラスは以下の引数が渡されインスタンス化されます:

               stream, descriptions, verbosity

      -- メソッド: run (test)

          このメソッドは ‘TextTestRunner’ へのメインの公開インターフェー
          スです。 このメソッドは *note TestSuite: 11b1. インスタンスあ
          るいは *note TestCase: 536. インスタンスを受け取ります。 *note
          _makeResult(): 4887. が呼ばれて *note TestResult: 1525. が作成
          され、テストが実行され、結果が標準出力に表示されます。

 -- の関数: 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: 161e. が使われます。

     The 'testRunner' argument can either be a test runner class or an
     already created instance of it.  By default ‘main’ calls *note
     sys.exit(): 506. 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: 798. インスタンスでなければな
     りません。デフォルトは *note defaultTestLoader: 4870. です。

     ‘main’ は、 ‘exit=False’ を指定する事で対話的なインタプリタから使用
     することもできます。この引数を指定すると、 *note sys.exit(): 506. を
     呼ばずに、結果のみを出力します:

          >>> from unittest import main
          >>> main(module='test_module', exit=False)

     'failfast', 'catchbreak', 'buffer' は、*note
     コマンドラインオプション: 4837. にある同名のオプションと同じ効果の
     あるパラメータです。

     'warnings' 引数では、テストの実行中に使うべき *note 警告フィルタ:
     1d7. を指定します。 この引数が指定されない場合には、 ‘-W’ オプショ
     ンが ‘python’ に渡されていなければ ‘None’ のまま (*note 警告の制御:
     2337. を参照してください) で、そうでなければ ‘'default'’ が設定され
     ます。

     Calling ‘main’ returns an object with the ‘result’ attribute that
     contains the result of the tests run as a *note
     unittest.TestResult: 1525.

     バージョン 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(): 799. から呼ばれます。引数は以下です:

     load_tests(loader, standard_tests, pattern)

'pattern' は ‘loadTestsFromModule’ からそのまま渡されます。デフォルトは
‘None’ です。

これは *note TestSuite: 11b1. を返すべきです。

'loader' はローディングを行う *note TestLoader: 798. のインスタンスです
。 'standard_tests' は、そのモジュールからデフォルトでロードされるテスト
です。これは、テストの標準セットのテストの追加や削除のみを行いたいテスト
モジュールに一般に使われます。第三引数は、パッケージをテストディスカバリ
の一部としてロードするときに使われます。

特定の *note TestCase: 536. クラスのセットからテストをロードする典型的な
‘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(): 1393. の呼び出しでも
、パッケージを含むディレクトリで検索を始めた場合、そのパッケージの
‘__init__.py’ をチェックして ‘load_tests’ を探します。 その関数が存在し
ない場合、他のディレクトリであるかのようにパッケージの中を再帰的に検索し
ます。 その関数が存在した場合、パッケージのテストの検索をそちらに任せ、
‘load_tests’ が次の引数で呼び出されます:

     load_tests(loader, standard_tests, pattern)

これはパッケージ内のすべてのテストを表す *note TestSuite: 11b1. を返すべ
きです。 (‘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: 11b1. に
実装されました。 テストスイートが新しいクラスのテストを始める時、以前の
クラス (あれば)の *note tearDownClass(): 16f1. を呼び出し、その後に新し
いクラスの *note setUpClass(): e16. を呼び出します。

同様に、今回のテストのモジュールが前回のテストとは異なる場合、以前のモジ
ュールの ‘tearDownModule’ を実行し、次に新しいモジュールの ‘setUpModule’
を実行します。

すべてのテストが実行された後、最後の ‘tearDownClass’ と ‘tearDownModule’
が実行されます。

なお、共有フィクスチャは、テストの並列化などの [潜在的な] 機能と同時には
うまくいかず、テストの分離を壊すので、気をつけて使うべきです。

unittest テストローダによるテスト作成のデフォルトの順序では、同じモジュ
ールやクラスからのテストはすべて同じグループにまとめられます。これにより
、‘setUpClass’ / ‘setUpModule’ (など) は、一つのクラスやモジュールにつき
一度だけ呼ばれます。この順序をバラバラにし、異なるモジュールやクラスのテ
ストが並ぶようにすると、共有フィクスチャ関数は、一度のテストで複数回呼ば
れるようにもなります。

共有フィクスチャは標準でない順序で実行されることを意図していません。 共
有フィクスチャをサポートしたくないフレームワークのために、
‘BaseTestSuite’ がまだ存在しています。

共有フィクスチャ関数のいずれかで例外が発生した場合、そのテストはエラーと
して報告されます。 そのとき、対応するテストインスタンスが無いので(*note
TestCase: 536. と同じインターフェースの) ‘_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: 536. の実装は空です
。

‘setUpClass’ の中で例外が送出されたら、クラス内のテストは実行されず、
‘tearDownClass’ も実行されません。スキップされたクラスは ‘setUpClass’ も
‘tearDownClass’ も実行されません。例外が *note SkipTest: 1392. 例外であ
れば、そのクラスはエラーではなくスキップされたものとして報告されます。


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: 1392. 例外
であれば、そのモジュールはエラーではなくスキップされたものとして報告され
ます。

例外が発生した場合でも実行しなければならないクリーンアップコードを追加す
るには''addModuleCleanup''を使用します:

 -- の関数: unittest.addModuleCleanup (function, /, *args, **kwargs)

     *note tearDownModule(): 16f0. の後に呼び出される関数を追加します。
     この関数はリソースのクリーンアップのために使用します。追加された関
     数は、追加された順と逆の順番で呼び出されます（LIFO）。 *note
     addModuleCleanup(): e13. に渡された引数とキーワード引数が追加された
     関数にも渡されます。

     *note setUpModule(): e15. が失敗した場合、つまり *note
     tearDownModule(): 16f0. が呼ばれなかった場合でも、追加されたクリー
     ンアップ関数は呼び出されます。

     Added in version 3.8.

 -- の関数: unittest.enterModuleContext (cm)

     Enter the supplied *note context manager: 47f.  If successful, also
     add its *note __exit__(): 16ba. method as a cleanup function by
     *note addModuleCleanup(): e13. and return the result of the *note
     __enter__(): 9cb. method.

     Added in version 3.11.

 -- の関数: unittest.doModuleCleanups ()

     この関数は、 *note tearDownModule(): 16f0. の後、もしくは、 *note
     setUpModule(): e15. が例外を投げた場合は ‘setUpModule()’ の後に、無
     条件で呼ばれます。

     このメソッドは、 *note addModuleCleanup(): e13. で追加された関数を
     呼び出す責務を担います。もし、クリーンアップ関数を *note
     tearDownModule(): 16f0. より前に呼び出す必要がある場合には、 *note
     doModuleCleanups(): 1a51. を明示的に呼び出してください。

     *note doModuleCleanups(): 1a51. は、どこで呼び出されても、クリーン
     アップ関数をスタックから削除して実行します。

     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: 16ec. コマンドラインオプションや、 *note
unittest.main(): 1391. の ‘catchbreak’ パラメタは、テスト実行中の
control-C の処理をよりフレンドリーにします。中断捕捉動作を有効である場合
、 control-C が押されると、現在実行されているテストまで完了され、そのテ
ストランが終わると今までの結果が報告されます。control-C がもう一度押され
ると、通常通り *note KeyboardInterrupt: d9a. が送出されます。

シグナルハンドラを処理する control-c は、独自の *note signal.SIGINT:
4e6. ハンドラをインストールするコードやテストの互換性を保とうとします。
‘unittest’ ハンドラが呼ばれ、それがインストールされた ‘signal.SIGINT’ ハ
ンドラで 'なければ' 、すなわちテスト中のシステムに置き換えられて移譲され
たなら、それはデフォルトのハンドラを呼び出します。インストールされたハン
ドラを置き換えて委譲するようなコードは、通常その動作を期待するからです。
‘unittest’ の control-c 処理を無効にしたいような個別のテストには、 *note
removeHandler(): 16ed. デコレータが使えます。

フレームワークの作者がテストフレームワーク内で control-c 処理を有効にす
るための、いくつかのユーティリティ関数があります。

 -- の関数: unittest.installHandler ()

     control-c ハンドラをインストールします。(主にユーザが control-c を
     押したことにより) *note signal.SIGINT: 4e6. が受け取られると、登録
     した結果すべてに *note stop(): 487b. が呼び出されます。

 -- の関数: unittest.registerResult (result)

     control-c 処理のために *note TestResult: 1525. を登録します。結果を
     登録するとそれに対する弱参照が格納されるので、結果がガベージコレク
     トされるのを妨げません。

     control-c 処理が有効でなければ、 *note TestResult: 1525. オブジェク
     トの登録には副作用がありません。ですからテストフレームワークは、処
     理が有効か無効かにかかわらず、作成する全ての結果を無条件に登録でき
     ます。

 -- の関数: unittest.removeResult (result)

     登録された結果を削除します。一旦結果が削除されると、control-c が押
     された際にその結果オブジェクトに対して *note stop(): 487b. が呼び出
     されなくなります。

 -- の関数: 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: e12. 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(): 1246. デコレータを提供します。さらに、ユニークなオブジ
ェクトの作成には *note sentinel: 196. が利用できます。 *note Mock: e12.
や *note MagicMock: 1243. 、 ‘patch()’ の利用例は *note quick guide:
4891. を参照してください。

Mock は *note unittest: 10f. で利用するために設計されており、多くのモッ
クフレームワークで使われる '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/main/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: e12. および *note MagicMock: 1243. オブジェクトはアクセスし
たすべての属性とメソッドを作成し、どのように使用されたかについての詳細な
情報を格納します。戻り値を指定したり利用できる属性を制限するために
‘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: 4892. によって、モック呼び出し時の例外発生などの副作
用を実行できます:

     >>> 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: 1b4. で
失敗します。

*note patch(): 1246. デコレータ / コンテキストマネージャーによってテスト
対象のモジュール内のクラスやオブジェクトを簡単にモックできます。指定した
オブジェクトはテスト中はモック (または別のオブジェクト) に置換され、テス
ト終了時に復元されます:

     >>> 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(): 1246. では探索される名前空間内のオブジェクトにパッチ
     をあてることが重要です。通常は単純ですが、詳しくは *note
     どこにパッチするか: 4893. を参照してください。

*note patch(): 1246. デコレータと同様に 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(): 1b99. を使うと、スコープ内だけで辞書に値を設
定し、テスト終了時には元の状態に復元されます:

     >>> foo = {'key': 'value'}
     >>> original = foo.copy()
     >>> with patch.dict(foo, {'newkey': 'newvalue'}, clear=True):
     ...     assert foo == {'newkey': 'newvalue'}
     ...
     >>> assert foo == original

mock は Python の *note マジックメソッド: 4894. のモックをサポートしてい
ます。 マジックメソッドのもっとも簡単な利用法は *note MagicMock: 1243. ク
ラスと使うことです。以下のように利用します:

     >>> mock = MagicMock()
     >>> mock.__str__.return_value = 'foobarbaz'
     >>> str(mock)
     'foobarbaz'
     >>> mock.__str__.assert_called_with()

mock によってマジックメソッドに関数 (あるいは他の Mock インスタンス) を
割り当てることができ、それらは適切に呼び出されます。 *note MagicMock:
1243. クラスは、すべてのマジックメソッドがあらかじめ作成されている点を除
けば *note Mock: e12. クラスと一緒です (まあ、とにかく便利ってこと)。

以下は通常の Mock クラスでマジックメソッドを利用する例です:

     >>> mock = Mock()
     >>> mock.__str__ = Mock(return_value='wheeeeee')
     >>> str(mock)
     'wheeeeee'

テスト内のモックオブジェクトが置換するオブジェクトと同じ API を持つこと
を保証するには、 *note auto-speccing: 4895. を使うことができます。パッチ
をあてる 'autospec' 引数、または *note create_autospec(): 1b6d. 関数を通
じて 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(): 1b6d. はクラスにおいても利用でき、 ‘__init__’ メ
ソッドのシグニチャをコピーします。また、呼び出し可能オブジェクトについて
も ‘__call__’ メソッドのシグニチャをコピーします。


File: python.info,  Node: Mock クラス,  Next: patcher,  Prev: クイックガイド,  Up: unittest mock --- モックオブジェクトライブラリ

5.27.6.2 Mock クラス
....................

*note Mock: e12. は、コードにおけるスタブの使用やテストダブルを置き換え
るための柔軟なモックオブジェクトです。モックは呼び出し可能で、属性にアク
セスした場合それを新たなモックとして作成します (1)。同じ属性にアクセスし
た場合は常に同じモックを返します。 モックはどのように使われたかを記録す
るので、コードがモックに行うことについてアサートできます。

*note MagicMock: 1243. は *note Mock: e12. のサブクラスで、すべてのマジ
ックメソッドが事前に作成され、利用できます。また、呼び出し不可能なモック
を作成する場合には、呼び出し不能な変種の *note NonCallableMock: 4897. や
*note NonCallableMagicMock: 4898. があります。

*note patch(): 1246. デコレータによって特定のモジュール内のクラスを
*note Mock: e12. オブジェクトで一時的に置換することが簡単にできます。デ
フォルトでは ‘patch()’ は *note MagicMock: 1243. を作成します。
‘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: e12. オブジェクトを作成します。 ‘Mock’ はモック
     オブジェクトの挙動を指定するオプション引数をいくつか取ります:

        * 'spec': モックオブジェクトの仕様として働く文字列のリストもしく
          は存在するオブジェクト (クラスもしくはインスタンス) を指定しま
          す。オブジェクトを渡した場合には、 dir 関数によって文字列のリ
          ストが生成されます (サポートされない特殊属性や特殊メソッドは除
          く) 。このリストにない属性にアクセスした際には *note
          AttributeError: 1b4. が発生します。

          'spec' が (文字列のリストではなく) オブジェクトの場合、 *note
          __class__: 1865. はスペックオブジェクトのクラスを返します。こ
          れによってモックが *note isinstance(): 2fb. テストに通るように
          なります。

        * 'spec_set': より厳しい 'spec' です。こちらを利用した場合、
          'spec_set' に渡されたオブジェクトに存在しない属性に対し '設定'
          や取得をしようとした際に *note AttributeError: 1b4. が発生しま
          す。

        * 'side_effect': モックが呼び出された際に呼び出される関数を指定
          します。 *note side_effect: 4892. 属性を参考にしてください。例
          外を発生させたり、動的に戻り値を変更する場合に便利です。関数に
          は、モックと同じ引数が渡され、 *note DEFAULT: 4899. を返さない
          限りはこの関数の戻り値が使われます。

          一方で、 'side_effect' には、例外クラスやインスタンスを指定で
          きます。この場合は、モックが呼び出された際に指定された例外を発
          生します。

          もし、 'side_effect' にイテレート可能オブジェクトを指定した場
          合には、モックの呼び出しごとに順に値を返します。

          'side_effect' に ‘None’ を指定した場合には、設定がクリアされま
          す。

        * 'return_value': モックが呼び出された際に返す値です。デフォルト
          では (最初にアクセスされた際に生成される) 新しい Mock を返しま
          す。 *note return_value: 489a. を参照してください。

        * 'unsafe': By default, accessing any attribute whose name
          starts with 'assert', 'assret', 'asert', 'aseert' or 'assrt'
          will raise an *note AttributeError: 1b4.  Passing
          ‘unsafe=True’ will allow access to these attributes.

          Added in version 3.5.

        * 'wraps': このモックオブジェクトがラップするものです。 'wraps'
          が ‘None’ でなければ、このモックを呼び出すと、その呼び出しがラ
          ップされたオブジェクトに渡され (て実際の結果を返し) ます。モッ
          クの属性アクセスは、ラップされたオブジェクトの対応する属性をラ
          ップする Mock オブジェクトを返します (なので、存在しない属性に
          アクセスしようとすると *note AttributeError: 1b4. を送出します
          )。

          モックが明示的に 'return_value' を設定されていると、呼び出しは
          ラップされたオブジェクトに渡されず、代わりに 'return_value' が
          返されます。

        * 'name': モックに名前があるなら、それがモックの repr として使わ
          れます。これはデバッグの際に役立つでしょう。この名前は子のモッ
          クにも伝播します。

     モックは、任意のキーワード引数を与えることができます。これらはモッ
     クの生成後、属性の設定に使われます。詳細は *note configure_mock():
     489b. を参照してください。

      -- メソッド: assert_called ()

          モックが少なくとも一度は呼び出されたことをアサートします。

               >>> mock = Mock()
               >>> mock.method()
               <Mock name='mock.method()' id='...'>
               >>> mock.method.assert_called()

          Added in version 3.6.

      -- メソッド: assert_called_once ()

          モックが一度だけ呼び出されたことをアサートします。

               >>> mock = Mock()
               >>> mock.method()
               <Mock name='mock.method()' id='...'>
               >>> mock.method.assert_called_once()
               >>> mock.method()
               <Mock name='mock.method()' id='...'>
               >>> mock.method.assert_called_once()
               Traceback (most recent call last):
               ...
               AssertionError: Expected 'method' to have been called once. Called 2 times.
               Calls: [call(), call()].

          Added in version 3.6.

      -- メソッド: assert_called_with (*args, **kwargs)

          This method is a convenient way of asserting that the last
          call has been made in a particular way:

               >>> mock = Mock()
               >>> mock.method(1, 2, 3, test='wow')
               <Mock name='mock.method()' id='...'>
               >>> mock.method.assert_called_with(1, 2, 3, test='wow')

      -- メソッド: assert_called_once_with (*args, **kwargs)

          モックが一度だけ呼び出され、かつ指定された引数で呼び出されたこ
          とをアサートします。

               >>> mock = Mock(return_value=None)
               >>> mock('foo', bar='baz')
               >>> mock.assert_called_once_with('foo', bar='baz')
               >>> mock('other', bar='values')
               >>> mock.assert_called_once_with('other', bar='values')
               Traceback (most recent call last):
                 ...
               AssertionError: Expected 'mock' to be called once. Called 2 times.
               Calls: [call('foo', bar='baz'), call('other', bar='values')].

      -- メソッド: assert_any_call (*args, **kwargs)

          モックが特定の引数で呼び出されたことがあるのをアサートします。

          The assert passes if the mock has 'ever' been called, unlike
          *note assert_called_with(): 2011. and *note
          assert_called_once_with(): 489c. 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)

          モックが特定の呼び出しで呼ばれたことをアサートします。呼び出し
          では *note mock_calls: 489e. のリストがチェックされます。

          'any_order' が false の場合、呼び出しは連続していなければなり
          ません。指定された呼び出しの前、あるいは呼び出しの後に余分な呼
          び出しがある場合があります。

          'any_order' が true の場合、呼び出しは任意の順番でも構いません
          が、それらがすべて *note mock_calls: 489e. に現われなければな
          りません。

               >>> 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: 489a.:

               >>> 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: 4892.:

               >>> 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: 489a, *note side_effect: 4892. 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: 48a0. や *note
          mock_calls: 489e. 属性に記録されます。

      -- メソッド: 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(): 489b. は、モック生成後のコンフィギュレ
          ーションを容易に行うために存在します。

      -- メソッド: __dir__ ()

          *note Mock: e12. オブジェクトは、有用な結果を得るために
          ‘dir(some_mock)’ の結果を制限します。 'spec' を設定したモック
          に対しては、許可された属性のみを含みます。

          このフィルタが何をしていて、どのように停止させるかは、 *note
          FILTER_DIR: 48a2. を参照してください。

      -- メソッド: _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: 489a. は生成時にも設定可能です:

               >>> mock = Mock(return_value=3)
               >>> mock.return_value
               3
               >>> mock()
               3

      -- の属性: side_effect

          このモックが呼ばれた際に呼び出される関数、イテラブル、もしくは
          発生させる例外 (クラスまたはインスタンス) を設定できます。

          関数を渡した場合はモックと同じ引数で呼び出され、 *note
          DEFAULT: 4899. を返さない限りはその関数の戻り値が返されます。
          関数が ‘DEFAULT’ を返した場合は ( *note return_value: 489a. に
          よって) モックの通常の値を返します。

          iterable が渡された場合、その値はイテレータを取り出すために使
          用されます。イテレータは毎回の呼び出しにおいて値を yield しな
          ければなりません。この値は、送出される例外インスタンスか、呼び
          出しからモックに返される値のいずれかです (*note DEFAULT: 4899.
          の処理は関数の場合と同一です)。

          以下はモックが (API による例外の扱いをテストするために) 例外を
          発生させる例です:

               >>> mock = Mock()
               >>> mock.side_effect = Exception('Boom!')
               >>> mock()
               Traceback (most recent call last):
                 ...
               Exception: Boom!

          *note side_effect: 4892. を使用して連続的に値を返します:

               >>> 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: 4892. は生成時にも設定可能です。呼び出し時
          の値に 1 を加えて返す例を以下に示します:

               >>> side_effect = lambda value: value + 1
               >>> mock = Mock(side_effect=side_effect)
               >>> mock(3)
               4
               >>> mock(-8)
               -7

          *note side_effect: 4892. に ‘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: 1f7c. は、 *note call_args_list: 48a5. や
          *note method_calls: 48a0. 、 *note mock_calls: 489e. と同様、
          *note call: 1fc2. オブジェクトです。これらはタプルとしてアンパ
          ックすることで個別に取り出すことができます。そして、より複雑な
          アサーションを行うことができます。 *note calls as tuples:
          48a6. を参照してください。

          バージョン 3.8 で変更: ‘args’ と ‘kwargs’ 属性が追加されました
          。

      -- の属性: call_args_list

          モックの呼び出しを順に記録したリストです (よって、このリストの
          長さはモックが呼び出された回数と等しくなります)。モックを作成
          してから一度も呼び出しを行なっていない場合は、空のリストが返さ
          れます。 *note call: 1fc2. オブジェクトは、 *note
          call_args_list: 48a5. の比較対象となる呼び出しのリストを作成す
          る際に便利です。

               >>> 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: 48a5. のメンバは *note call: 1fc2. オブ
          ジェクトです。タプルとしてアンパックすることで個別に取り出すこ
          とができます。 *note calls as tuples: 48a6. を参照してください
          。

      -- の属性: 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: 48a0. のメンバは *note call: 1fc2. オブジ
          ェクトです。タプルとしてアンパックすることで個別に取り出すこと
          ができます。 *note calls as tuples: 48a6. を参照してください。

      -- の属性: mock_calls

          *note mock_calls: 489e. は、メソッド、特殊メソッド、 'そして'
          戻り値のモックまで、モックオブジェクトに対する 'すべての' 呼び
          出しを記録します。

               >>> 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: 489e. のメンバは *note call: 1fc2. オブジェ
          クトです。タプルとしてアンパックすることで個別に取り出すことが
          できます。 *note calls as tuples: 48a6. を参照してください。

               注釈: The way *note mock_calls: 489e. 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(): 2fb. も通過することが
          できます:

               >>> mock = Mock(spec=3)
               >>> isinstance(mock, int)
               True

          ‘__class__’ は書き換え可能で、 *note isinstance(): 2fb. を通る
          ために必ず 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: e12. です。コンストラクタのパラメー
     タは ‘Mock’ と同様ですが、 'return_value' や 'side_effect' は意味を
     持ちません。

‘spec’ か ‘spec_set’ にクラスかインスタンスを渡した mock は *note
isinstance(): 2fb. テストをパスします:

     >>> mock = Mock(spec=SomeClass)
     >>> isinstance(mock, SomeClass)
     True
     >>> mock = Mock(spec_set=SomeClass())
     >>> isinstance(mock, SomeClass)
     True

*note Mock: e12. クラスは、 特殊メソッドをサポートしています。すべての詳
細は *note magic methods: 4894. を参照してください。

モッククラスや *note patch(): 1246. デコレータは、任意のキーワード引数を
設定できます。 ‘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(): 2011, *note
assert_called_once_with(): 489c, *note assert_has_calls(): 1c49. and
*note assert_any_call(): 489d. にも適用されます。 *note autospec を使う:
4895. と、 モックオブジェクトのメソッド呼び出しにも適用されます。

バージョン 3.4 で変更: spec や autospec を用いて生成されたモックオブジェ
クトは、シグネチャを考慮するようになりました。

 -- クラス: unittest.mock.PropertyMock (*args, **kwargs)

     *note property: 6c1. もしくは:term:‘デスクリプタ <descriptor>’ とし
     て使われるためのモックです。 *note PropertyMock: 48a8. は、 *note
     __get__(): 18a0. と *note __set__(): 25c9. メソッドを提供し、戻り値
     を指定することができます。

     オブジェクトから *note PropertyMock: 48a8. のインスタンスを取得する
     ことは、引数を与えないモックの呼び出しに相当します。設定は、 設定す
     る値を伴った呼び出しになります。:

          >>> 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: 48a8. を直接モックに取り付ける方法は、モックの属性を
保存する方法によりうまく動作しません。代わりに、モック型に取り付けてくだ
さい:

     >>> m = MagicMock()
     >>> p = PropertyMock(return_value=3)
     >>> type(m).foo = p
     >>> m.foo
     3
     >>> p.assert_called_once_with()

     注意: If an *note AttributeError: 1b4. is raised by *note
     PropertyMock: 48a8, it will be interpreted as a missing descriptor
     and *note __getattr__(): 8e8. 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__(): 8e8. を参照してください。

 -- クラス: 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: 1243.  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: e12. or *note MagicMock: 1243.
     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: e12, *note MagicMock: 1243, 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: 1f7b. 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: 1f7b.

               >>> 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(): 10ba.  Also sets *note
          await_count: 48b1. to 0, *note await_args: 48b2. to None, and
          clears the *note await_args_list: 1f7b.

      -- の属性: 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: 1f7c.

               >>> 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: 1243. 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: 48b4. attribute,
     which defaults to blocking (‘None’).

     You can configure the global default timeout by setting *note
     ThreadingMock.DEFAULT_TIMEOUT: 48b4.

      -- メソッド: 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: a9c. 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: a9c. 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: 1b4. を
発生させます。これは、インタープリタが暗黙的にこれらのメソッドを要求する
ためであり、特殊メソッドを予測する際に '非常に' 混乱してしまいます。もし
特殊メソッドのサポートが必要な場合は、 *note magic methods: 4894. を参照
してください。


File: python.info,  Node: 呼び出し,  Next: 属性の削除,  Up: Mock クラス

5.27.6.3 呼び出し
.................

モックオブジェクトは呼び出し可能です。呼び出しの戻り値は *note
return_value: 489a. 属性に設定された値です。デフォルトでは新しいモックオ
ブジェクトを返します。この新しいモックは、属性に最初にアクセスした際に作
成されます (明示もしくはモックの呼び出しによって)。 そしてそれは保存され
、それ以降は同じものが返されます。

呼び出しはオブジェクトとして *note call_args: 1f7c. や *note
call_args_list: 48a5. に記録されます。

If *note side_effect: 4892. 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: 4892. を例外クラスかインスタンスにする方法が最もシンプルで
す:

     >>> 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: 4892. 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: 489a. from inside *note side_effect:
4892, or return *note DEFAULT: 4899.:

     >>> 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: 4892, 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: 4892. 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: fbe. 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(): 8e7.
call, or raise an *note AttributeError: 1b4. 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: 1b4. を発生させ，アクセスを
"妨げる" ようになります．

     >>> 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: e12. コンストラクタの引数なので、モックオブジェク
トが "name" 属性を持つことを望む場合、単に生成時にそれを渡すことはできま
せん。2つの選択肢があります。1つのオプションは *note configure_mock():
489b. を使用することです:

     >>> 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: 48a0. や
*note mock_calls: 489e. に記録されます。これは、子のモックを構成し、親に
そのモックを設定する際に有用です。また、親に対して設定したすべての子の呼
び出しを記録するため、それらの間の順番を確認する際にも有用です:

     >>> 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(): 1246. を用いて作成したモックには、自動的に名前が与えられ
ます。名前を持つモックを設定したい場合には、親に対して *note
attach_mock(): 1b88. メソッドを呼び出します:

     >>> 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: 48be. セクションを参照してください。

 -- の関数: unittest.mock.patch (target, new=DEFAULT, spec=None,
          create=False, spec_set=None, autospec=None, new_callable=None,
          **kwargs)

     *note patch(): 1246. は関数デコレータ、クラスデコレータ、コンテキス
     トマネージャーとして利用できます。関数や with 文の body では、
     'target' は 'new' オブジェクトにパッチされます。関数/with 文が終了
     すると、パッチは元に戻されます。

     If 'new' is omitted, then the target is replaced with an *note
     AsyncMock: e11. if the patched object is an async function or a
     *note MagicMock: 1243. 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(): 1246. を呼び出した環境からインポート可能でなければなりませ
     ん。 target がインポートされるのは、デコレートした時ではなく、デコ
     レートされた関数が呼び出された時です。

     patch が *note MagicMock: 1243. を生成する場合、 '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: e11. is used for async functions and *note
     MagicMock: 1243. for the rest.

     より強力な 'spec' の形は 'autospec' です。 ‘autospec=True’ を指定し
     た場合、 mock は置換対象となるオブジェクトから得られる spec で生成
     されます。 mock のすべての属性もまた置換対象となるオブジェクトの属
     性に応じた spec を持ちます。 mock されたメソッドや関数は引数をチェ
     ックし、間違ったシグネチャで呼び出された場合は *note TypeError:
     29c. を発生させます。クラスを置き換える mock の場合、その戻り値 (つ
     まりインスタンス) はそのクラスと同じ spec を持ちます。 *note
     create_autospec(): 1b6d. 関数と *note autospec を使う: 4895. を参照
     してください。

     置換対象ではなく任意のオブジェクトを 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: 536. 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: 10f. finds tests.  You can
     specify an alternative prefix by setting ‘patch.TEST_PREFIX’.

     patch は with 文を使ってコンテキストマネージャーとして使うこともで
     きます。その場合パッチは with 文のブロック内でのみ適用されます。
     "as" を使って、 "as" に続いて指定した変数にパッチされたオブジェクト
     が代入されます。これは *note patch(): 1246. が mock オブジェクトを
     生成するときに便利です。

     ‘patch()’ takes arbitrary keyword arguments.  These will be passed
     to *note AsyncMock: e11. if the patched object is asynchronous, to
     *note MagicMock: 1243. otherwise or to 'new_callable' if specified.

     異なるユースケースのために、 ‘patch.dict(...)’,
     ‘patch.multiple(...)’, ‘patch.object(...)’ が用意されています。

*note patch(): 1246. を関数デコレータとして利用し、 mock を生成してそれ
をデコレートされた関数に渡します:

     >>> @patch('__main__.SomeClass')
     ... def function(normal_argument, mock_class):
     ...     print(mock_class is SomeClass)
     ...
     >>> function(None)
     True

クラスをパッチするとそのクラスを *note MagicMock: 1243. の 'インスタンス
' に置き換えます。テスト中のコードからそのクラスがインスタンス化される場
合、 mock の *note return_value: 489a. が利用されます。

クラスが複数回インスタンス化される場合、 *note side_effect: 4892. を利用
して毎回新しい mock を返すようにできます。もしくは、 'return_value' に、
何でも好きなものを設定できます。

To configure return values on methods of 'instances' on the patched
class you must do this on the *note return_value: 489a.  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(): 1246. が 'クラス' を置換
するとき、生成された 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: 1243. の代わりに別
のクラスをモックとして生成したい場合に便利です。例えば、 *note
NonCallableMock: 4897. を利用したい場合:

     >>> 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: 12d8. インス
タンスで置き換えることがあります:

     >>> 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(): 1246. に 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: 489a. *note
side_effect: 4892. などもセットアップできます。これらはキーワード引数の
シンタックスでは直接指定できませんが、それらをキーとする辞書を ‘**’ を使
って *note patch(): 1246. に渡すことができます:

     >>> 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: 1b4.:

     >>> @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(): 1246. 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(): 1246. now returns an *note
AsyncMock: e11. 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(): 1b44. はデコレータ、クラスデコレータ、コンテ
     キストマネージャーとして利用できます。引数の 'new', 'spec',
     'create', 'spec_set', 'autospec', 'new_callable' は *note patch():
     1246. と同じ意味を持ちます。 ‘patch()’ と同じく、 ‘patch.object()’
     も mock を生成するための任意のキーワード引数を受け取ります。

     クラスデコレータとして利用する場合、 *note patch.object(): 1b44. は
     ‘patch.TEST_PREFIX’ にしたがってラップするメソッドを選択します。

*note patch.object(): 1b44. の呼び出しには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(): 1b44. の引数は *note
patch(): 1246. の引数と同じ意味を持ちます。


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(): 1b99. はまた、任意のキーワード引数を受け取って
     辞書に設定します。

     バージョン 3.8 で変更: ‘patch.dict()’ now returns the patched
     dictionary when used as a context manager.

*note patch.dict(): 1b99. 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(): 1b99. 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:
48c1.

*note patch.dict(): 1b99. を使うと、辞書にメンバーを追加するか、または単
にテストが辞書を変更して、その後テストが終了した時にその辞書が確実に復元
されるようにすることができます。

     >>> 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(): 1b99. を呼び出すときにキーワード引数を使って辞書に値
をセットすることができます。

     >>> mymodule = MagicMock()
     >>> mymodule.function.return_value = 'fish'
     >>> with patch.dict('sys.modules', mymodule=mymodule):
     ...     import mymodule
     ...     mymodule.function('some', 'args')
     ...
     'fish'

*note patch.dict(): 1b99. 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__(): 78d, *note
__setitem__(): 1685, *note __delitem__(): 1686. and either *note
__iter__(): 22b8. or *note __contains__(): 1772.

     >>> 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(): 48c3. に mock を生成させたい場合、キーワー
     ド引数の値に *note DEFAULT: 4899. を指定します。この場合生成された
     モックはデコレート対象の関数にキーワード引数として渡され、コンテキ
     ストマネージャーとして ‘patch.multiple()’ が利用された場合は辞書と
     して返します。

     *note patch.multiple(): 48c3. はデコレータ、クラスデコレータ、コン
     テキストマネージャーとして使えます。引数の 'spec', 'spec_set',
     'create', 'autospec', 'new_callable' は *note patch(): 1246. の引数
     と同じ意味を持ちます。これらの引数は ‘patch.multiple()’ によって適
     用される 'すべての' パッチに対して適用されます。

     クラスデコレータとして利用する場合、 *note patch.multiple(): 48c3.
     は ‘patch.TEST_PREFIX’ にしたがってラップするメソッドを選択します。

*note patch.multiple(): 48c3. に mock を生成させたい場合、キーワード引数
の値に *note DEFAULT: 4899. を指定します。‘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(): 48c3. は他の ‘patch’ デコレータとネストして利用
できますが、キーワード引数は *note patch(): 1246. によって作られる通常の
引数の '後ろ' で受け取る必要があります:

     >>> @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(): 48c3. がコンテキストマネージャーとして利用される
場合、コンテキストマネージャーが返す値は、名前がキーで値が生成された
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(): 1246, *note patch.object(): 1b44. or
*note patch.dict(): 1b99. 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(): 1246. に 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: 536.:

     >>> 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(): e47. を使うと簡単にできます:

          >>> 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(): 48c6. を利用してすべての 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(): 254a. を修正します:

     >>> @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: 798. がテストメソッドを見つける方法と同じです。

他の 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(): 1246. は (一時的に) ある '名前' が参照しているオブジェク
トを別のものに変更することで適用されます。任意のオブジェクトには、それを
参照するたくさんの名前が存在しえます。なので、必ずテスト対象のシステムが
使っている名前に対して 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(): 1246.  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: 48bd. と *note patch.object: 48bf. はどちらも デスクリプタ
(クラスメソッド、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: e12. supports mocking the Python protocol methods, also
known as *note "magic methods": 48ce.  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: 215. 文の中でコンテキストマネージャーと
して使われるオブジェクトを 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: 48a0. に含まれませんが、
*note mock_calls: 489e. には記録されます。

     注釈: mock を生成するのに 'spec' キーワード引数を使った場合、 spec
     に含まれない magic method を設定しようとすると *note
     AttributeError: 1b4. が発生します。

サポートしている 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__():
1014.

バージョン 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: 1243. と *note
NonCallableMagicMock: 4898. です。

 -- クラス: unittest.mock.MagicMock (*args, **kw)

     ‘MagicMock’ is a subclass of *note Mock: e12. with default
     implementations of most of the *note magic methods: 48ce.  You can
     use ‘MagicMock’ without having to configure the magic methods
     yourself.

     コンストラクタの引数は *note Mock: e12. と同じ意味を持っています。

     'spec' か 'spec_set' 引数を利用した場合、 spec に存在する magic
     method 'のみ' が生成されます。

 -- クラス: unittest.mock.NonCallableMagicMock (*args, **kw)

     callable でないバージョンの *note MagicMock: 1243.

     コンストラクタの引数は *note MagicMock: 1243. と同じ意味を持ちます
     が、 'return_value' と 'side_effect' は callable でない mock では意
     味を持ちません。

*note MagicMock: 1243. が 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: 447.

   * ‘__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: 4892. attribute, unless you change their return value to
return something else:

     >>> MagicMock() == 3
     False
     >>> MagicMock() != 3
     True
     >>> mock = MagicMock()
     >>> mock.__eq__.return_value = True
     >>> mock == 3
     True

‘MagicMock.__iter__()’ の return_value は任意の iterable で、イテレータ
である必要はありません:

     >>> mock = MagicMock()
     >>> mock.__iter__.return_value = ['a', 'b', 'c']
     >>> list(mock)
     ['a', 'b', 'c']
     >>> list(mock)
     ['a', 'b', 'c']

return_value が iterator であった場合、最初のイテレートでその iterator を
消費してしまい、2回目以降のイテレートの結果が空になってしまいます:

     >>> mock.__iter__.return_value = iter(['a', 'b', 'c'])
     >>> list(mock)
     ['a', 'b', 'c']
     >>> list(mock)
     []

‘MagicMock’ はいくつかの曖昧であったり時代遅れなものをのぞいて、対応して
いる magic method を事前にセットアップします。自動でセットアップされてい
ないものも必要なら手動でセットアップすることができます。

‘MagicMock’ がサポートしているもののデフォルトではセットアップしない
magic method:

   * ‘__subclasses__’

   * ‘__dir__’

   * ‘__format__’

   * ‘__get__’, ‘__set__’, ‘__delete__’

   * ‘__reversed__’, ‘__missing__’

   * ‘__reduce__’, ‘__reduce_ex__’, ‘__getinitargs__’, ‘__getnewargs__’,
     ‘__getstate__’, ‘__setstate__’

   * ‘__getformat__’


File: python.info,  Node: ヘルパー,  Next: Order of precedence of side_effect return_value and wraps,  Prev: MagicMock と magic method のサポート,  Up: unittest mock --- モックオブジェクトライブラリ

5.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: 196. はこの
ようなオブジェクトを生成し、同一性をテストするのに便利な方法を提供します
。

次の例では、 ‘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: 4899. オブジェクトは事前に生成された sentinel (実際
     には ‘sentinel.DEFAULT’) オブジェクトです。 *note side_effect:
     4892. 関数が、通常の戻り値を使うことを示すために使います。


File: python.info,  Node: call,  Next: create_autospec,  Prev: DEFAULT,  Up: ヘルパー

5.27.6.24 call
..............

 -- の関数: unittest.mock.call (*args, **kwargs)

     *note call(): 1fc2. は *note call_args: 1f7c, *note call_args_list:
     48a5, *note mock_calls: 489e, *note method_calls: 48a0. と比較して
     より簡単に assert できるようにするためのヘルパーオブジェクトです。
     ‘call()’ は *note assert_has_calls(): 1c49. と組み合わせて使うこと
     もできます。

          >>> 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(): 48d4. はすべての途中の呼び出しと最終の呼び出しを含むリ
     ストを返します。

‘call_list’ は特に "chained call" に対して assert するのに便利です。
"chained call" は1行のコードにおける複数の呼び出しです。この結果は mock
の *note mock_calls: 489e. に複数の call エントリとして格納されます。こ
の call のシーケンスを手動で構築するのは退屈な作業になります。

*note call_list(): 48d4. は同じ 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: 1f7c, *note Mock.call_args_list: 48a5, *note
Mock.mock_calls: 489e. 属性の中の ‘call’ オブジェクトを解析して個々の引
数を解析することができます。

*note Mock.call_args: 1f7c. と *note Mock.call_args_list: 48a5. の中の
‘call’ オブジェクトは (位置引数, キーワード引数) のタプルで、 *note
Mock.mock_calls: 489e. の中の ‘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: 1b4. を発生させます。

     spec にクラスが指定された場合、 mock の戻り値 (そのクラスのインスタ
     ンス) は同じ spec を持ちます。 ‘instance=True’ を指定すると、インス
     タンスオブジェクトの spec としてクラスを利用できます。返される mock
     は、モックのインスタンスが callable な場合にだけ callable となりま
     す。

     *note create_autospec(): 1b6d. は任意のキーワード引数を受け取り、生
     成する mock のコンストラクタに渡します。

*note create_autospec(): 1b6d. や、 *note patch(): 1246. の 'autospec' 引
数で autospec を使うサンプルは *note autospec を使う: 4895. を参照してく
ださい。

バージョン 3.8 で変更: *note create_autospec(): 1b6d. now returns an
*note AsyncMock: e11. 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: 1f7c. から個別に取り
出してより高度な assert を行いたい場合があります。

特定の引数を無視するために、 'すべて' と等しくなるオブジェクトを使うこと
ができます。そうすると、 *note assert_called_with(): 2011. と *note
assert_called_once_with(): 489c. は、実際の引数が何であったかに関わらず
成功します。

     >>> mock = Mock(return_value=None)
     >>> mock('foo', bar=object())
     >>> mock.assert_called_once_with('foo', bar=ANY)

*note mock_calls: 489e. などの call list との比較に *note ANY: 1fc0. を
使うこともできます:

     >>> m = MagicMock(return_value=None)
     >>> m(1)
     >>> m(1, 2)
     >>> m(object())
     >>> m.mock_calls == [call(1), call(1, 2), ANY]
     True

*note ANY: 1fc0. 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: 48a2. は mock オブジェクトが *note dir(): a28. に何を
返すかを制御するためのモジュールレベル変数です。デフォルトは ‘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: e12. 自
身のプライベートな) 属性は、アンダースコアと2つのアンダースコアで prefix
された属性は ‘Mock’ に対して *note dir(): a28. した結果からフィルタリン
グされます。この動作が嫌な場合は、モジュールレベルの *note FILTER_DIR:
48a2. スイッチを設定することでフィルターを切ることができます。

     >>> 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: 48a2.


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=None)

     *note open(): 333. の利用を置き換えるための mock を作るヘルパー関数
     。 ‘open()’ を直接呼んだりコンテキストマネージャーとして利用する場
     合に使うことができます。

     'mock' 引数は構成する mock オブジェクトです。 ‘None’ (デフォルト) な
     ら、通常のファイルハンドルと同じ属性やメソッドにAPIが制限された
     *note MagicMock: 1243. が生成されます。

     'read_data' is a string for the *note read(): 11d4, *note
     readline(): 16e3, and *note readlines(): 29d3. 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(): 16e3. and *note
     readlines(): 29d3. support.  The mock of *note read(): 11d4.
     changed to consume 'read_data' rather than returning it on each
     call.

     バージョン 3.5 で変更: 'read_data' は 'mock' を呼び出す度に毎回リセ
     ットされるようになりました。

     バージョン 3.8 で変更: Added *note __iter__(): 22b8. to
     implementation so that iteration (such as in for loops) correctly
     consumes 'read_data'.

*note open(): 333. をコンテキストマネージャーとして使う方法は、ファイル
が必ず適切に閉じられるようにする素晴らしい方法で、今では一般的になってい
ます:

     with open('/some/path', 'w') as f:
         f.write('something')

The issue is that even if you mock out the call to *note open(): 333. it
is the 'returned object' that is used as a context manager (and has
*note __enter__(): 9cb. and *note __exit__(): 16ba. called).

コンテキストマネージャーを *note MagicMock: 1243. でモックするのは一般的
かつ面倒なので、ヘルパー関数を用意しています。:

     >>> 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: 29c. if they are called incorrectly.

autospec の動作について説明する前に、それが必要となる背景から説明してい
きます。

*note Mock: e12. 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(): 1246. か *note
patch.object(): 1b44. に ‘autospec=True’ を渡すか、 *note
create_autospec(): 1b6d. 関数を使って 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(): 1246. 呼び出しに ‘autospec=True’ を
加えるだけで、ミススペルやAPI変更に伴うバグから守られます。

*note patch(): 1246. を経由する以外にも、 *note create_autospec(): 1b6d.
を使って '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__(): 306. 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__():
306.  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(): 1246. はこれをサポートしていて、 '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(): a28. を呼び出して - 検索するだけです。


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: 4892.

  2. *note return_value: 489a.

  3. 'wraps'

If all three are set, mock will return the value from *note side_effect:
4892, ignoring *note return_value: 489a. 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: 4892, if you
reassign its value back to ‘None’, the order of precedence will be
checked between *note return_value: 489a. 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: 4892. is *note
DEFAULT: 4899, 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: e12. wraps an object, the default value of *note
return_value: 489a. will be *note DEFAULT: 4899.

     >>> 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: 4892. 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: e12. の使い方の中には次のものがあります:

   * メソッドにパッチを当てる

   * オブジェクトに対するメソッド呼び出しを記録する

システムの他の部分からメソッドが正しい引数で呼び出されたかどうかを確認す
るために、そのオブジェクトのメソッドを置き換えることができます:

     >>> real = SomeClass()
     >>> real.method = MagicMock(name='method')
     >>> real.method(3, 4, 5, key='value')
     <MagicMock name='method()' id='...'>

モック(上の例では ‘real.method’)が利用された場合、どう使われたかを
assert できるようにする属性やメソッドがモックにあります。

     注釈: この例のような場合、たいてい *note Mock: e12. と *note
     MagicMock: 1243. は互換です。 ‘MagicMock’ の方が強力なので、デフォ
     ルトではこちらを使うといいでしょう。

モックが呼び出されると、その *note called: 48a4. 属性が ‘True’ に設定さ
れます。そして *note assert_called_with(): 2011. や *note
assert_called_once_with(): 489c. メソッドを使ってそのメソッドが正しい引
数で呼び出されたかどうかをチェックできます。

次の例では ‘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(): 2011. が 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(): 1246. を呼び出すと ‘Foo’ クラ
スをモックに置き換えます。 ‘Foo’ のインスタンスはモックを呼び出して作ら
れるので、モックの *note return_value: 489a. を変更することでカスタマイ
ズできます。:

     >>> 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: 489e. 属性は、そのモックの子属性やさらにその子孫に対する呼び
出しすべてを記録しています。

     >>> 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: 1fc2. オブジェクト
を利用できます:

     >>> 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: 1fc2. を使って "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: 4892. という便利な属性があります。この属性に例外クラ
スやそのインスタンスを設定すると、モックが呼ばれた時にその例外を発生させ
ます。

     >>> 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): 1134. のモックをサポートしてい
ます。‘__aiter__’ の *note return_value: 489a. 属性はイテレーションに使
用される戻り値を設定するために使用できます。

     >>> 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): 9f8. のモックをサポートしています。デフォルトでは、
‘__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: e12. は '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: 4895. を使用します。

任意の属性の参照だけでなく代入も禁止するより強い定義を利用したい場合は、
'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(): 1395. is used to patch *note open(): 333. method.
*note side_effect: 4892. 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(): 1246. では探索される名前空間内のオブジェクトに
     パッチをあてることが重要です。通常は単純ですが、クイックガイドには
     *note どこにパッチするか: 4893. を読んでください。

テストの中でクラス属性やモジュール属性、例えば組み込み関数や、テスト対象
モジュールにあるインスタンス化されるクラスに対してパッチしたいことがあり
ます。モジュールやクラスは実際はグローバルなので、パッチするときは必ずテ
スト後にパッチを解除しないと、そのパッチが永続化されて他のテストに影響を
与え、解析しにくい問題になります。

mock はこのために3つの便利なデコレータを提供しています: *note patch():
1246, *note patch.object(): 1b44, *note patch.dict(): 1b99. です。
‘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(): 1b44. の代わりに *note patch(): 1246. を使用してください
:

     >>> 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(): 1246. を1引数で (または
*note patch.object(): 1b44. を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(): 1b99. を使うと、スコープ内だけで辞書に値を設
定し、テスト終了時には元の状態に復元されます:

     >>> 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(): 1246. に 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: 489a. 属性を理解
してしまえば簡単です。mock が最初に呼ばれた時や、呼び出される前に
‘return_value’ を参照した場合、新しい *note Mock: e12. が生成されます。

つまり、戻り値のオブジェクトがどう利用されたかは、‘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(): 333. を ‘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(): 489b. メソッドを使用して次のようにすることができます:

     >>> 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: 489e. を使用すると、チェーンされた呼び出しを単一のアサ
ーションでチェックすることができます。チェーンされた呼び出しは、1行のコ
ードの中で行われる複数の呼び出しです。したがって、 ‘mock_calls’ には複数
のエントリーがあるでしょう。 *note call.call_list(): 48d4. を使用するこ
とで、この呼び出しのリストを作成することができます:

     >>> 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(): 1882. to return a known date, but don't want to
prevent the code under test from creating new date objects.
Unfortunately *note datetime.date: 494. 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: 1246. が使用されています。そして、モックの date クラス
の *note side_effect: 4892. 属性は、本物の 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: 494. にパッチするのではなく、それを使
用するモジュールの中の ‘date’ にパッチしていることに留意してください。
*note どこにパッチするか: 4893. を参照してください。

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:
d97. 文を使用した関数やメソッドです (1)。

ジェネレータメソッド/関数はジェネレータオブジェクトを返すために呼び出さ
れます。そしてこのジェネレータオブジェクトが反復処理されます。イテレーシ
ョンのためのプロトコルメソッドは *note __iter__(): 22b8. なので、*note
MagicMock: 1243. を使ってこれをモックすることができます。

ここでは"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: 4e0. の呼び出しの中での暗黙的な)イテレーションから返される
値を設定するには、‘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():
1246. をクラスデコレータとして使用することができます。これはそのクラスの
すべてのテストメソッドにパッチを適用します。テストメソッドは名前が
‘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:
48c5.を使用する方法があります。これらを使うと、パッチを ‘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(): e47. を使
うと簡単にできます:

     >>> 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(): 1246. 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(): 489c. method that also asserts that the *note
call_count: 19c7. 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: 48a5.:

     >>> 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: 1fc2. ヘルパーを使えば、これらの呼び出しについて簡単にアサー
トすることができます。予想される呼び出しのリストを作成し、それを
''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: 4892.
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 we're using 'another' mock to store the
arguments so that we can use the mock methods for doing the assertion.
Again a helper function sets this up for us.

     >>> 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(): f2f. を使用して）引数をコピ
ーする、 *note Mock: e12. や *note MagicMock: 1243. のサブクラスを作成す
る方法があります。以下に実装例を示します。

     >>> 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: 48c5. 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: 1243, which will behave like a
dictionary, and using *note side_effect: 4892. to delegate dictionary
access to a real underlying dictionary that is under our control.

When the *note __getitem__(): 78d. and *note __setitem__(): 1685.
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: 48a5. 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: 7e5. 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:
e12.  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: 19da.
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(): 1b99. to 'temporarily' put a
mock in place in *note sys.modules: 19da.  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: 19da.

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: e12. class allows you to track the 'order' of method
calls on your mock objects through the *note method_calls: 48a0.
attribute.  This doesn't allow you to track the order of calls between
separate mock objects, however we can use *note mock_calls: 489e. 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(): 1b88.
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(): 1c49. method.  This takes a list of calls
(constructed with the *note call: 1fc2. object).  If that sequence of
calls are in *note mock_calls: 489e. 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: 1fc0. 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(): 2011. 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: a9c. 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: a9c. 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: ed. and *note test.regrtest: ec.
‘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: 10f. or *note doctest: 3d. 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: 10f. モジュール

     PyUnit 回帰テストを書く。

*note doctest: 3d. モジュール

     ドキュメンテーション文字列に埋め込まれたテスト。

* 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: 10f. モジュールを使ってテストを書く場合、幾つかのガイド
ラインに従うことが推奨されます。 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: ec. からテストスイート
を実行でき、 *note unittest: 10f. のコマンドラインインターフェースをサポ
ートしているスクリプトとして自分自身を起動したり、 ‘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: 536. 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: 4d1. 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: 1ba.


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:
     10f. ベースのテストでは廃止予定で、 *note unittest.TestCase: 536. の
     assertXXX メソッドが推奨されます。

 -- 例外: test.support.ResourceDenied

     *note unittest.SkipTest: 1392. のサブクラスです。 (ネットワーク接続
     のような) リソースが利用できないとき送出されます。 *note
     requires(): 4906. 関数によって送出されます。

The ‘test.support’ module defines the following constants:

 -- データ: test.support.verbose

     冗長な出力が有効な場合は ‘True’ です。実行中のテストについてのより
     詳細な情報が欲しいときにチェックします。 'verbose' は *note
     test.regrtest: ec. によって設定されます。

 -- データ: 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(): 1160, *note
     recv(): 1161. and *note send(): 1164. methods of *note
     socket.socket: 115e.

     デフォルト値は5秒です。

     *note INTERNET_TIMEOUT: 1fad. も参照してください。

 -- データ: 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: 1fad. should not
     mark a test as failed, but skip the test instead: see *note
     transient_internet(): 490f.

     デフォルト値は1分です。

     *note LOOPBACK_TIMEOUT: 1fac. も参照してください。

 -- データ: 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: 1fae. 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: 1fac, *note INTERNET_TIMEOUT:
     1fad. and *note SHORT_TIMEOUT: 1e79.

 -- データ: 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: 1a0b. macro
     defined, that is, if Python was *note built in debug mode: 3e3.

     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: 1583. を設定し
     ます。

 -- データ: test.support.max_memuse

     大量のメモリを使うテストのためのメモリ上限となる *note
     set_memlimit(): 4919. を設定します。 *note MAX_Py_ssize_t: 4917. が
     設定上限です。

 -- データ: test.support.real_max_memuse

     大量のメモリを使うテストのためのメモリ上限となる *note
     set_memlimit(): 4919. を設定します。 *note MAX_Py_ssize_t: 4917. の
     設定上限はありません。

 -- データ: 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: 23ad. option.

     See also the *note HAVE_DOCSTRINGS: 491c. variable.

 -- データ: test.support.HAVE_DOCSTRINGS

     Set to ‘True’ if function docstrings are available.  See the *note
     python -OO: 438. option, which strips docstrings of functions
     implemented in Python.

     See also the *note MISSING_C_DOCSTRINGS: 491b. 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:
     491e.).  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: a9c. 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(): 4922. 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: ec. がテストを実行している間
     のみ設定されます。

 -- の関数: 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: 4905. を送出
     します。その場合、 'msg' は ‘ResourceDenied’ の引数になります。
     ‘__name__’ が ‘'__main__'’ である関数にから呼び出された場合には常に
     ‘True’ を返します。テストを *note test.regrtest: ec. から実行すると
     きに使われます。

 -- の関数: 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(): d1a. 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: 4918. and *note
     real_max_memuse: 491a. 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():
     492d. 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: 12d8. オブジェクトで一時的
     に置き換えるコンテキストマネージャです。

     出力ストリームの使用例:

          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: 5b.

 -- の関数: 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: ea0. and then on
     *note sys.stderr: d09.  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__: 493a.  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: a9c. if the process exit code is not
     equal to 'exitcode'.

     If the process runs longer than 'timeout' seconds (*note
     SHORT_TIMEOUT: 1e79. by default), kill the process and raise an
     *note AssertionError: a9c.  The timeout feature is not available on
     Windows.

     Added in version 3.9.

 -- の関数: test.support.calcobjsize (fmt)

     Return the size of the *note PyObject: 1a6. 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: 493d. 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(): 484f. の印をテストに付
     けるデコレータ。 このデコレータを使うときはいつも、関連する問題を指
     し示すコメントを付けておくべきです。

 -- の関数: 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: 418. 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: 13c. doesn't exist.

 -- の関数: @test.support.requires_gzip

     Decorator for skipping tests if *note gzip: 6a. 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: 8d. 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: 491c.

 -- の関数: @test.support.requires_limited_api

     Decorator for only running the test if *note Limited C API: 82f. 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(): 492c. 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: 10f. instance for
     the test.  'errtext' is the regular expression which should match
     the string representation of the raised *note SyntaxError: 189.  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: 4904.

 -- の関数: 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: 1392. if *note
     AttributeError: 1b4. is raised.

 -- の関数: test.support.catch_unraisable_exception ()

     Context manager catching unraisable exception using *note
     sys.unraisablehook(): 712.

     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: 10f. ‘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: 1392.
     if *note tracemalloc: 108. 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__: 28eb. 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: 543.

     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(): 1b30. 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(): 3ee. is used to set *note
     resource.RLIMIT_CORE: 4964.'s soft limit to 0 to prevent coredump
     file creation.

     On both platforms, the old value is restored by *note __exit__():
     16ba.

 -- クラス: 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(): 4966. 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: 1dc6, *note
     SOCK_STREAM: 16ad.), 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(): 496e. 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: 1dc6. and
     ‘sock.type’ is *note SOCK_STREAM: 16ad, 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: 1392. if *note
     PermissionError: 10fd. 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: 4905. 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: 3b5. is one way to get most of the
     testsuite to run in that situation.  *note PYTHONPATH: 13cb. 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(): 4974. 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():
     6c5.  Returns a *note subprocess.Popen: 6c5. object.

 -- の関数: test.support.script_helper.kill_python (p)

     Run the given *note subprocess.Popen: 6c5. 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: a9c.

 -- メソッド: BytecodeTestCase.assertNotInBytecode (x, opname,
          argval=_UNSPECIFIED)

     Throws *note AssertionError: a9c. 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:
     a9c. 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(): 3894.  ‘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: 427. exception
     using *note threading.excepthook(): c27.

     Attributes set when an exception is caught:

        * ‘exc_type’

        * ‘exc_value’

        * ‘exc_traceback’

        * ‘thread’

     See *note threading.excepthook(): c27. 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(): 1017. でエンコードできる 非 ASCII 文字。

 -- データ: test.support.os_helper.SAVEDCWD

     *note os.getcwd(): 1b45. に設定されます。

 -- データ: test.support.os_helper.TESTFN

     テンポラリファイルの名前として安全に利用できる名前に設定されます。
     作成した一時ファイルは全て閉じ、unlink (削除) しなければなりません
     。

 -- データ: test.support.os_helper.TESTFN_NONASCII

     Set to a filename containing the *note FS_NONASCII: 498b.
     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: 7a5.  It implements the *note
     __fspath__(): 1014. 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(): 14b4. 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(): 33d. on 'path' or call *note
     os.lstat(): 8b6. and *note os.rmdir(): 14b4. to remove a path and
     its contents.  As with *note rmdir(): 499b, 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(): 735. を使って作
     成されます。

     '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(): 735.  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(): 14b6. on 'filename'.  As with *note
     rmdir(): 499b, 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: 1c8. を発生させます。

     指定されたモジュールと 'fresh' や 'blocked' 引数内のモジュール名は
     インポート前に保存され、フレッシュなインポートが完了したら
     ‘sys.modules’ に戻されます。

     'deprecated' が ‘True’ の場合、インポート中はモジュールとパッケージ
     の廃止メッセージが抑制されます。

     指定したモジュールがインポートできなかった場合に、この関数は *note
     ImportError: 1c8. を送出します。

     使用例:

          # 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: 1392. 例外を発生させます。

     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: 51f.

     Added in version 3.1.

 -- の関数: test.support.import_helper.modules_setup ()

     Return a copy of *note sys.modules: 19da.

 -- の関数: 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: 2d4. 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:
     19f.

     This makes a copy of *note sys.path: 19f, 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: 19f. 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: 2926. or a subclass.  Roughly equivalent to *note
     warnings.catch_warnings(): 42a. with *note
     warnings.simplefilter('ignore', category=category): ab3.  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: 754. 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: 451. is
     emitted only once, and that it will be converted to a *note
     SyntaxError: 189. when turned into error.  'testcase' is the *note
     unittest: 10f. 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(): 42a.
     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(): ab3. 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: 11b. 属性
     から、 *note catch_warnings(): 42a. から得られる警告のリストを取得
     することができます。便利さのために、レコーダーオブジェクトから直接
     、一番最近に発生した警告を表すオブジェクトの属性にアクセスできます
     (以下にある例を参照してください)。警告が1つも発生しなかった場合、そ
     れらの全ての属性は ‘None’ を返します。

     レコーダーオブジェクトの ‘reset()’ メソッドは警告リストをクリアしま
     す。

     コンテキストマネージャーは次のようにして使います:

          with check_warnings(("assertion is always true", SyntaxWarning),
                              ("", UserWarning)):
              exec('assert(False, "Hey!")')
              warnings.warn(UserWarning("Hide me!"))

     この場合、どちらの警告も発生しなかった場合や、それ以外の警告が発生
     した場合は、 *note check_warnings(): 49b0. はエラーを発生させます。

     警告が発生したかどうかだけでなく、もっと詳しいチェックが必要な場合
     は、次のようなコードになります:

          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(): 49b0. のドキュメントを参照してください。


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
* profiling: profiling --- Python profilers. Python profilers
* pstats: pstats --- Statistics for profilers. Statistics for 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():
1b55. または *note PySys_Audit(): 80e. の呼び出しによって送出されるすべ
てのイベントを含んでいます。これらの呼び出しは、 3.8 以降に追加されまし
た ( PEP 578(1) を参照) 。

これらのイベントの処理についての情報は *note sys.addaudithook(): 49b7. と
*note PySys_AddAuditHook(): 49b8. を参照してください。

この表は CPython ドキュメントから生成されており、他の実装により送出され
るイベントを表示していない可能性があります。実際に送出されるイベントは、
ランタイム固有のドキュメントを参照してください。

Audit event                        Arguments                                                   References
                                                                                               
-------------------------------------------------------------------------------------------------------------------
                                                                                               
_thread.start_new_thread           ‘function’, ‘args’, ‘kwargs’                                *note [1]: 49b9.
                                                                                               
                                                                                               
array.__new__                      ‘typecode’, ‘initializer’                                   *note [1]: 6cb.
                                                                                               
                                                                                               
builtins.breakpoint                ‘breakpointhook’                                            *note [1]: 500.
                                                                                               
                                                                                               
builtins.id                        ‘id’                                                        *note [1]: 17db.
                                                                                               
                                                                                               
builtins.input                     ‘prompt’                                                    *note [1]: 1692.
                                                                                               
                                                                                               
builtins.input/result              ‘result’                                                    *note [1]: 1692.
                                                                                               
                                                                                               
code.__new__                       ‘code’, ‘filename’, ‘name’, ‘argcount’,                     *note [1]: 2ed.
                                   ‘posonlyargcount’, ‘kwonlyargcount’, ‘nlocals’,             
                                   ‘stacksize’, ‘flags’
                                   
                                                                                               
compile                            ‘source’, ‘filename’                                        *note [1]: 1d3.
                                                                                               
                                                                                               
cpython.PyConfig_Set               ‘name’, ‘value’                                             *note [1]: 5b1.
                                                                                               
                                                                                               
cpython.PyInterpreterState_Clear                                                               *note [1]: 49ba.
                                                                                               
                                                                                               
cpython.PyInterpreterState_New                                                                 *note [1]: 49bb.
                                                                                               
                                                                                               
cpython._PySys_ClearAuditHooks                                                                 *note [1]: 10d3.
                                                                                               
                                                                                               
cpython.remote_debugger_script     ‘script_path’                                               *note [1]: 49bc.
                                                                                               
                                                                                               
cpython.run_command                ‘command’                                                   *note [1]: 44c.
                                                                                               
                                                                                               
cpython.run_file                   ‘filename’                                                  *note [1]: 49bd.
                                                                                               
                                                                                               
cpython.run_interactivehook        ‘hook’                                                      *note [1]: 1376.
                                                                                               
                                                                                               
cpython.run_module                 ‘module-name’                                               *note [1]: 4d1.
                                                                                               
                                                                                               
cpython.run_startup                ‘filename’                                                  *note [1]: 45a.
                                                                                               
                                                                                               
cpython.run_stdin                                                                              *note [1]: 49be.*note [2]: 49bf.*note [3]: 49c0.
                                                                                               
                                                                                               
ctypes.addressof                   ‘obj’                                                       *note [1]: 35aa.
                                                                                               
                                                                                               
ctypes.call_function               ‘func_pointer’, ‘arguments’                                 *note [1]: 35a4.
                                                                                               
                                                                                               
ctypes.cdata                       ‘address’                                                   *note [1]: 35b4.
                                                                                               
                                                                                               
ctypes.cdata/buffer                ‘pointer’, ‘size’, ‘offset’                                 *note [1]: 35b9.*note [2]: 35ba.
                                                                                               
                                                                                               
ctypes.create_string_buffer        ‘init’, ‘size’                                              *note [1]: 355d.
                                                                                               
                                                                                               
ctypes.create_unicode_buffer       ‘init’, ‘size’                                              *note [1]: 1fc3.
                                                                                               
                                                                                               
ctypes.dlopen                      ‘name’                                                      *note [1]: 359d.
                                                                                               
                                                                                               
ctypes.dlsym                       ‘library’, ‘name’                                           *note [1]: 359d.
                                                                                               
                                                                                               
ctypes.dlsym/handle                ‘handle’, ‘name’                                            *note [1]: 359d.
                                                                                               
                                                                                               
ctypes.get_errno                                                                               *note [1]: 3595.
                                                                                               
                                                                                               
ctypes.get_last_error                                                                          *note [1]: 3597.
                                                                                               
                                                                                               
ctypes.memoryview_at               ‘address’, ‘size’, ‘readonly’                               *note [1]: 49c1.
                                                                                               
                                                                                               
ctypes.set_errno                   ‘errno’                                                     *note [1]: 3596.
                                                                                               
                                                                                               
ctypes.set_exception               ‘code’                                                      *note [1]: 35a4.
                                                                                               
                                                                                               
ctypes.set_last_error              ‘error’                                                     *note [1]: 3598.
                                                                                               
                                                                                               
ctypes.string_at                   ‘ptr’, ‘size’                                               *note [1]: 489.
                                                                                               
                                                                                               
ctypes.wstring_at                  ‘ptr’, ‘size’                                               *note [1]: 35b3.
                                                                                               
                                                                                               
ensurepip.bootstrap                ‘root’                                                      *note [1]: 49c2.
                                                                                               
                                                                                               
exec                               ‘code_object’                                               *note [1]: 18f.*note [2]: 190.
                                                                                               
                                                                                               
fcntl.fcntl                        ‘fd’, ‘cmd’, ‘arg’                                          *note [1]: 1983.
                                                                                               
                                                                                               
fcntl.flock                        ‘fd’, ‘operation’                                           *note [1]: 49c3.
                                                                                               
                                                                                               
fcntl.ioctl                        ‘fd’, ‘request’, ‘arg’                                      *note [1]: 1833.
                                                                                               
                                                                                               
fcntl.lockf                        ‘fd’, ‘cmd’, ‘len’, ‘start’, ‘whence’                       *note [1]: 17a5.
                                                                                               
                                                                                               
ftplib.connect                     ‘self’, ‘host’, ‘port’                                      *note [1]: 4258.
                                                                                               
                                                                                               
ftplib.sendcmd                     ‘self’, ‘cmd’                                               *note [1]: 425d.*note [2]: 425e.
                                                                                               
                                                                                               
function.__new__                   ‘code’                                                      *note [1]: c5d.
                                                                                               
                                                                                               
gc.get_objects                     ‘generation’                                                *note [1]: be1.
                                                                                               
                                                                                               
gc.get_referents                   ‘objs’                                                      *note [1]: be3.
                                                                                               
                                                                                               
gc.get_referrers                   ‘objs’                                                      *note [1]: be2.
                                                                                               
                                                                                               
glob.glob                          ‘pathname’, ‘recursive’                                     *note [1]: 2df.*note [2]: be5.
                                                                                               
                                                                                               
glob.glob/2                        ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’               *note [1]: 2df.*note [2]: be5.
                                                                                               
                                                                                               
http.client.connect                ‘self’, ‘host’, ‘port’                                      *note [1]: 423a.
                                                                                               
                                                                                               
http.client.send                   ‘self’, ‘data’                                              *note [1]: 423f.
                                                                                               
                                                                                               
imaplib.open                       ‘self’, ‘host’, ‘port’                                      *note [1]: cd8.
                                                                                               
                                                                                               
imaplib.send                       ‘self’, ‘data’                                              *note [1]: 42af.
                                                                                               
                                                                                               
import                             ‘module’, ‘filename’, ‘sys.path’, ‘sys.meta_path’,          *note [1]: 9df.
                                   ‘sys.path_hooks’                                            
                                   
                                                                                               
marshal.dumps                      ‘value’, ‘version’                                          *note [1]: 2f80.
                                                                                               
                                                                                               
marshal.load                                                                                   *note [1]: 2004.
                                                                                               
                                                                                               
marshal.loads                      ‘bytes’                                                     *note [1]: 2004.
                                                                                               
                                                                                               
mmap.__new__                       ‘fileno’, ‘length’, ‘access’, ‘offset’                      *note [1]: 247.
                                                                                               
                                                                                               
msvcrt.get_osfhandle               ‘fd’                                                        *note [1]: 49c4.
                                                                                               
                                                                                               
msvcrt.locking                     ‘fd’, ‘mode’, ‘nbytes’                                      *note [1]: 49c5.
                                                                                               
                                                                                               
msvcrt.open_osfhandle              ‘handle’, ‘flags’                                           *note [1]: 49c6.
                                                                                               
                                                                                               
object.__delattr__                 ‘obj’, ‘name’                                               *note [1]: 258d.
                                                                                               
                                                                                               
object.__getattr__                 ‘obj’, ‘name’                                               *note [1]: f94.
                                                                                               
                                                                                               
object.__setattr__                 ‘obj’, ‘name’, ‘value’                                      *note [1]: 258c.
                                                                                               
                                                                                               
open                               ‘path’, ‘mode’, ‘flags’                                     *note [1]: 333.*note [2]: 930.*note [3]: 114f.
                                                                                               
                                                                                               
os.add_dll_directory               ‘path’                                                      *note [1]: db2.
                                                                                               
                                                                                               
os.chdir                           ‘path’                                                      *note [1]: a07.*note [2]: 1146.
                                                                                               
                                                                                               
os.chflags                         ‘path’, ‘flags’                                             *note [1]: 14ae.*note [2]: 32b5.
                                                                                               
                                                                                               
os.chmod                           ‘path’, ‘mode’, ‘dir_fd’                                    *note [1]: 732.*note [2]: 733.*note [3]: 731.
                                                                                               
                                                                                               
os.chown                           ‘path’, ‘uid’, ‘gid’, ‘dir_fd’                              *note [1]: 14af.*note [2]: 1147.*note [3]: 32b6.
                                                                                               
                                                                                               
os.exec                            ‘path’, ‘args’, ‘env’                                       *note [1]: 3326.
                                                                                               
                                                                                               
os.fork                                                                                        *note [1]: 6c3.
                                                                                               
                                                                                               
os.forkpty                                                                                     *note [1]: 6c4.
                                                                                               
                                                                                               
os.fwalk                           ‘top’, ‘topdown’, ‘onerror’, ‘follow_symlinks’, ‘dir_fd’    *note [1]: f1c.
                                                                                               
                                                                                               
os.getxattr                        ‘path’, ‘attribute’                                         *note [1]: 14c5.
                                                                                               
                                                                                               
os.kill                            ‘pid’, ‘sig’                                                *note [1]: 1721.
                                                                                               
                                                                                               
os.killpg                          ‘pgid’, ‘sig’                                               *note [1]: 1fca.
                                                                                               
                                                                                               
os.link                            ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’                    *note [1]: 14b0.
                                                                                               
                                                                                               
os.listdir                         ‘path’                                                      *note [1]: 14bb.
                                                                                               
                                                                                               
os.listdrives                                                                                  *note [1]: 8b3.
                                                                                               
                                                                                               
os.listmounts                      ‘volume’                                                    *note [1]: 8b5.
                                                                                               
                                                                                               
os.listvolumes                                                                                 *note [1]: 8b4.
                                                                                               
                                                                                               
os.listxattr                       ‘path’                                                      *note [1]: 14c6.
                                                                                               
                                                                                               
os.lockf                           ‘fd’, ‘cmd’, ‘len’                                          *note [1]: 14d4.
                                                                                               
                                                                                               
os.mkdir                           ‘path’, ‘mode’, ‘dir_fd’                                    *note [1]: 24b.*note [2]: 734.
                                                                                               
                                                                                               
os.posix_spawn                     ‘path’, ‘argv’, ‘env’                                       *note [1]: 736.*note [2]: 196a.
                                                                                               
                                                                                               
os.putenv                          ‘key’, ‘value’                                              *note [1]: 4ee.
                                                                                               
                                                                                               
os.remove                          ‘path’, ‘dir_fd’                                            *note [1]: 14b1.*note [2]: 32bb.*note [3]: 14b6.
                                                                                               
                                                                                               
os.removexattr                     ‘path’, ‘attribute’                                         *note [1]: 14c7.
                                                                                               
                                                                                               
os.rename                          ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’                    *note [1]: 14b2.*note [2]: 32bc.*note [3]: 14b3.
                                                                                               
                                                                                               
os.rmdir                           ‘path’, ‘dir_fd’                                            *note [1]: 14b4.
                                                                                               
                                                                                               
os.scandir                         ‘path’                                                      *note [1]: e27.
                                                                                               
                                                                                               
os.setxattr                        ‘path’, ‘attribute’, ‘value’, ‘flags’                       *note [1]: 14c8.
                                                                                               
                                                                                               
os.spawn                           ‘mode’, ‘path’, ‘args’, ‘env’                               *note [1]: 58d.
                                                                                               
                                                                                               
os.startfile                       ‘path’, ‘operation’                                         *note [1]: 1e98.
                                                                                               
                                                                                               
os.startfile/2                     ‘path’, ‘operation’, ‘arguments’, ‘cwd’, ‘show_cmd’         *note [1]: 1e98.
                                                                                               
                                                                                               
os.symlink                         ‘src’, ‘dst’, ‘dir_fd’                                      *note [1]: 14b5.
                                                                                               
                                                                                               
os.system                          ‘command’                                                   *note [1]: 1815.
                                                                                               
                                                                                               
os.truncate                        ‘fd’, ‘length’                                              *note [1]: 114c.*note [2]: 11f3.
                                                                                               
                                                                                               
os.unsetenv                        ‘key’                                                       *note [1]: 4ef.
                                                                                               
                                                                                               
os.utime                           ‘path’, ‘times’, ‘ns’, ‘dir_fd’                             *note [1]: 14b7.
                                                                                               
                                                                                               
os.walk                            ‘top’, ‘topdown’, ‘onerror’, ‘followlinks’                  *note [1]: 8be.
                                                                                               
                                                                                               
pathlib.Path.glob                  ‘self’, ‘pattern’                                           *note [1]: 73f.
                                                                                               
                                                                                               
pathlib.Path.rglob                 ‘self’, ‘pattern’                                           *note [1]: 740.
                                                                                               
                                                                                               
pdb.Pdb                                                                                        *note [1]: 502.
                                                                                               
                                                                                               
pickle.find_class                  ‘module’, ‘name’                                            *note [1]: 19d5.
                                                                                               
                                                                                               
poplib.connect                     ‘self’, ‘host’, ‘port’                                      *note [1]: cf4.*note [2]: cf5.
                                                                                               
                                                                                               
poplib.putline                     ‘self’, ‘line’                                              *note [1]: cf4.*note [2]: cf5.
                                                                                               
                                                                                               
pty.spawn                          ‘argv’                                                      *note [1]: 1331.
                                                                                               
                                                                                               
resource.prlimit                   ‘pid’, ‘resource’, ‘limits’                                 *note [1]: 3ef.
                                                                                               
                                                                                               
resource.setrlimit                 ‘resource’, ‘limits’                                        *note [1]: 3ee.
                                                                                               
                                                                                               
setopencodehook                                                                                *note [1]: 1cbd.
                                                                                               
                                                                                               
shutil.chown                       ‘path’, ‘user’, ‘group’                                     *note [1]: 750.
                                                                                               
                                                                                               
shutil.copyfile                    ‘src’, ‘dst’                                                *note [1]: e22.*note [2]: e23.*note [3]: e21.
                                                                                               
                                                                                               
shutil.copymode                    ‘src’, ‘dst’                                                *note [1]: e22.*note [2]: 1c4b.
                                                                                               
                                                                                               
shutil.copystat                    ‘src’, ‘dst’                                                *note [1]: e23.*note [2]: 14ef.
                                                                                               
                                                                                               
shutil.copytree                    ‘src’, ‘dst’                                                *note [1]: df1.
                                                                                               
                                                                                               
shutil.make_archive                ‘base_name’, ‘format’, ‘root_dir’, ‘base_dir’               *note [1]: 8c8.
                                                                                               
                                                                                               
shutil.move                        ‘src’, ‘dst’                                                *note [1]: e24.
                                                                                               
                                                                                               
shutil.rmtree                      ‘path’, ‘dir_fd’                                            *note [1]: 33d.
                                                                                               
                                                                                               
shutil.unpack_archive              ‘filename’, ‘extract_dir’, ‘format’                         *note [1]: 887.
                                                                                               
                                                                                               
signal.pthread_kill                ‘thread_id’, ‘signalnum’                                    *note [1]: 14f2.
                                                                                               
                                                                                               
smtplib.connect                    ‘self’, ‘host’, ‘port’                                      *note [1]: 1934.
                                                                                               
                                                                                               
smtplib.send                       ‘self’, ‘data’                                              *note [1]: cfe.
                                                                                               
                                                                                               
socket.__new__                     ‘self’, ‘family’, ‘type’, ‘protocol’                        *note [1]: 115e.
                                                                                               
                                                                                               
socket.bind                        ‘self’, ‘address’                                           *note [1]: 1481.
                                                                                               
                                                                                               
socket.connect                     ‘self’, ‘address’                                           *note [1]: 1160.*note [2]: 18f2.
                                                                                               
                                                                                               
socket.getaddrinfo                 ‘host’, ‘port’, ‘family’, ‘type’, ‘protocol’                *note [1]: 1946.
                                                                                               
                                                                                               
socket.gethostbyaddr               ‘ip_address’                                                *note [1]: 1e99.
                                                                                               
                                                                                               
socket.gethostbyname               ‘hostname’                                                  *note [1]: 3bf4.*note [2]: 1e9a.
                                                                                               
                                                                                               
socket.gethostname                                                                             *note [1]: 3261.
                                                                                               
                                                                                               
socket.getnameinfo                 ‘sockaddr’                                                  *note [1]: 1c61.
                                                                                               
                                                                                               
socket.getservbyname               ‘servicename’, ‘protocolname’                               *note [1]: 3bf6.
                                                                                               
                                                                                               
socket.getservbyport               ‘port’, ‘protocolname’                                      *note [1]: 3bf7.
                                                                                               
                                                                                               
socket.sendmsg                     ‘self’, ‘address’                                           *note [1]: 891.
                                                                                               
                                                                                               
socket.sendto                      ‘self’, ‘address’                                           *note [1]: 1166.
                                                                                               
                                                                                               
socket.sethostname                 ‘name’                                                      *note [1]: 14fc.
                                                                                               
                                                                                               
sqlite3.connect                    ‘database’                                                  *note [1]: 3e7.
                                                                                               
                                                                                               
sqlite3.connect/handle             ‘connection_handle’                                         *note [1]: 3e7.
                                                                                               
                                                                                               
sqlite3.enable_load_extension      ‘connection’, ‘enabled’                                     *note [1]: c1b.
                                                                                               
                                                                                               
sqlite3.load_extension             ‘connection’, ‘path’                                        *note [1]: 8cd.
                                                                                               
                                                                                               
subprocess.Popen                   ‘executable’, ‘args’, ‘cwd’, ‘env’                          *note [1]: 6c5.
                                                                                               
                                                                                               
sys._current_exceptions                                                                        *note [1]: 8d7.
                                                                                               
                                                                                               
sys._current_frames                                                                            *note [1]: 17eb.
                                                                                               
                                                                                               
sys._getframe                      ‘frame’                                                     *note [1]: ad3.
                                                                                               
                                                                                               
sys._getframemodulename            ‘depth’                                                     *note [1]: 1cfd.
                                                                                               
                                                                                               
sys.addaudithook                                                                               *note [1]: 49b8.*note [2]: 49b7.
                                                                                               
                                                                                               
sys.excepthook                     ‘hook’, ‘type’, ‘value’, ‘traceback’                        *note [1]: be9.
                                                                                               
                                                                                               
sys.monitoring.register_callback   ‘func’                                                      *note [1]: 49c7.
                                                                                               
                                                                                               
sys.remote_exec                    ‘pid’                                                       *note [1]: 49c8.
                                                                                               
                                                                                               
sys.set_asyncgen_hooks_finalizer                                                               *note [1]: 1bc9.
                                                                                               
                                                                                               
sys.set_asyncgen_hooks_firstiter                                                               *note [1]: 1bc9.
                                                                                               
                                                                                               
sys.setprofile                                                                                 *note [1]: 18b6.
                                                                                               
                                                                                               
sys.settrace                                                                                   *note [1]: 563.
                                                                                               
                                                                                               
sys.unraisablehook                 ‘hook’, ‘unraisable’                                        *note [1]: 712.
                                                                                               
                                                                                               
syslog.closelog                                                                                *note [1]: 951.
                                                                                               
                                                                                               
syslog.openlog                     ‘ident’, ‘logoption’, ‘facility’                            *note [1]: 950.
                                                                                               
                                                                                               
syslog.setlogmask                  ‘maskpri’                                                   *note [1]: 49c9.
                                                                                               
                                                                                               
syslog.syslog                      ‘priority’, ‘message’                                       *note [1]: 952.
                                                                                               
                                                                                               
tempfile.mkdtemp                   ‘fullpath’                                                  *note [1]: 15ef.*note [2]: 735.
                                                                                               
                                                                                               
tempfile.mkstemp                   ‘fullpath’                                                  *note [1]: 8db.*note [2]: 1a2d.*note [3]: 2f07.
                                                                                               
                                                                                               
time.sleep                         ‘secs’                                                      *note [1]: 49ca.
                                                                                               
                                                                                               
urllib.Request                     ‘fullurl’, ‘data’, ‘headers’, ‘method’                      *note [1]: 586.
                                                                                               
                                                                                               
webbrowser.open                    ‘url’                                                       *note [1]: 1944.
                                                                                               
                                                                                               
winreg.ConnectRegistry             ‘computer_name’, ‘key’                                      *note [1]: 49cb.
                                                                                               
                                                                                               
winreg.CreateKey                   ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 49cc.*note [2]: 171c.
                                                                                               
                                                                                               
winreg.DeleteKey                   ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 49cd.*note [2]: 171d.
                                                                                               
                                                                                               
winreg.DeleteTree                  ‘key’, ‘sub_key’                                            *note [1]: 1a0a.
                                                                                               
                                                                                               
winreg.DeleteValue                 ‘key’, ‘value’                                              *note [1]: 49ce.
                                                                                               
                                                                                               
winreg.DisableReflectionKey        ‘key’                                                       *note [1]: 171e.
                                                                                               
                                                                                               
winreg.EnableReflectionKey         ‘key’                                                       *note [1]: 171f.
                                                                                               
                                                                                               
winreg.EnumKey                     ‘key’, ‘index’                                              *note [1]: 49cf.
                                                                                               
                                                                                               
winreg.EnumValue                   ‘key’, ‘index’                                              *note [1]: 49d0.
                                                                                               
                                                                                               
winreg.ExpandEnvironmentStrings    ‘str’                                                       *note [1]: 17b0.
                                                                                               
                                                                                               
winreg.LoadKey                     ‘key’, ‘sub_key’, ‘file_name’                               *note [1]: 49d1.
                                                                                               
                                                                                               
winreg.OpenKey                     ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 49d2.
                                                                                               
                                                                                               
winreg.OpenKey/result              ‘key’                                                       *note [1]: 49cc.*note [2]: 171c.*note [3]: 49d2.
                                                                                               
                                                                                               
winreg.PyHKEY.Detach               ‘key’                                                       *note [1]: 49d3.
                                                                                               
                                                                                               
winreg.QueryInfoKey                ‘key’                                                       *note [1]: 49d4.
                                                                                               
                                                                                               
winreg.QueryReflectionKey          ‘key’                                                       *note [1]: 1720.
                                                                                               
                                                                                               
winreg.QueryValue                  ‘key’, ‘sub_key’, ‘value_name’                              *note [1]: 49d5.*note [2]: 19c9.
                                                                                               
                                                                                               
winreg.SaveKey                     ‘key’, ‘file_name’                                          *note [1]: 49d6.
                                                                                               
                                                                                               
winreg.SetValue                    ‘key’, ‘sub_key’, ‘type’, ‘value’                           *note [1]: 49d7.*note [2]: 1d21.
                                                                                               

以下のイベントは内部で送出され、 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: 557. クラスが、デバッガーを終了させるために投げる例外。

The ‘bdb’ module also defines two classes:

 -- クラス: bdb.Breakpoint (self, file, line, temporary=False,
          cond=None, funcname=None)

     このクラスはテンポラリブレークポイント、無視するカウント、無効化と
     再有効化、条件付きブレークポイントを実装しています。

     ブレークポイントは *note bpbynumber: 49dc. という名前のリストで番号
     によりインデックスされ、 *note bplist: 49dd. により ‘(file, line)’
     の形でインデックスされます。 ‘bpbynumber’ は *note Breakpoint:
     49db. クラスのインスタンスを指しています。一方 ‘bplist’ は、同じ行
     に複数のブレークポイントが設定される場合があるので、インスタンスの
     リストを指しています。

     ブレークポイントを作るとき、関連付けられる *note ファイル名: 49de.
     は正規化されていなければなりません。*note funcname: 49df. が定義さ
     れると、ブレークポイントの *note ヒット: 49e0. はその関数の最初の行
     が実行されたときにカウントされます。*note 条件付き: 49e1. ブレーク
     ポイントは毎回 ‘ヒット’ をカウントします。

     *note Breakpoint: 49db. インスタンスは以下のメソッドを持ちます:

      -- メソッド: 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(): 49e5. の出力を表示する。

     *note Breakpoint: 49db. インスタンスは以下の属性を持ちます:

      -- の属性: file

          File name of the ‘Breakpoint’.

      -- の属性: line

          Line number of the ‘Breakpoint’ within *note file: 49de.

      -- の属性: 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:
          49de, *note line: 49e7.) 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: 557. クラスは一般的なPythonデバッガーの基本クラスとして
     振舞います。

     このクラスはトレース機能の詳細を扱います。ユーザーとのインタラクシ
     ョンは、派生クラスが実装するべきです。標準ライブラリのデバッガクラ
     ス (*note pdb.Pdb: 502.) がその利用例です。

     '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(): 563. which has the best backward
     compatibility.  The ‘'monitoring'’ backend uses the new *note
     sys.monitoring: e3. 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: 557. のメソッドは、通常オーバーライドする必要はあ
     りません。

      -- メソッド: canonic (filename)

          Return canonical form of 'filename'.

          For real file names, the canonical form is an
          operating-system-dependent, *note case-normalized: 2e87. *note
          absolute path: 16d4.  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: 49ef. attributes with values ready to start
          debugging.

      -- メソッド: trace_dispatch (frame, event, arg)

          この関数は、デバッグされているフレームのトレース関数としてイン
          ストールされます。戻り値は新しいトレース関数(殆どの場合はこの
          関数自身)です。

          デフォルトの実装は、実行しようとしている 'event' (文字列として
          渡されます) の種類に基づいてフレームのディスパッチ方法を決定し
          ます。'event' は次のうちのどれかです:

             * ‘"line"’: 新しい行を実行しようとしています。

             * ‘"call"’: 関数が呼び出されているか、別のコードブロックに
               入ります。

             * ‘"return"’: 関数か別のコードブロックからreturnしようとし
               ています。

             * ‘"exception"’: 例外が発生しました。

          For all the events, specialized functions (see below) are
          called.

          'arg' 引数は以前のイベントに依存します。

          トレース関数についてのより詳しい情報は、 *note sys.settrace():
          563. のドキュメントを参照してください。コードとフレームオブジ
          ェクトについてのより詳しい情報は、 *note 標準型の階層: 253e. を
          参照してください。

      -- メソッド: dispatch_line (frame)

          If the debugger should stop on the current line, invoke the
          *note user_line(): 49f2. method (which should be overridden in
          subclasses).  Raise a *note BdbQuit: 507. exception if the
          *note quitting: 49ef. flag is set (which can be set from
          ‘user_line()’).  Return a reference to the *note
          trace_dispatch(): 49f0. 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(): 49f4. method (which should be overridden in
          subclasses).  Raise a *note BdbQuit: 507. exception if the
          *note quitting: 49ef. flag is set (which can be set from
          ‘user_call()’).  Return a reference to the *note
          trace_dispatch(): 49f0. 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(): 49f6. method (which should be
          overridden in subclasses).  Raise a *note BdbQuit: 507.
          exception if the *note quitting: 49ef. flag is set (which can
          be set from ‘user_return()’).  Return a reference to the *note
          trace_dispatch(): 49f0. method for further tracing in that
          scope.

      -- メソッド: dispatch_exception (frame, arg)

          If the debugger should stop at this exception, invokes the
          *note user_exception(): 49f8. method (which should be
          overridden in subclasses).  Raise a *note BdbQuit: 507.
          exception if the *note quitting: 49ef. flag is set (which can
          be set from ‘user_exception()’).  Return a reference to the
          *note trace_dispatch(): 49f0. 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(): 49fc.

      -- メソッド: break_anywhere (frame)

          Return ‘True’ if any breakpoint exists for 'frame"s filename.

     継承クラスはデバッガー操作をするために以下のメソッド群をオーバーラ
     イドするべきです。

      -- メソッド: user_call (frame, argument_list)

          Called from *note dispatch_call(): 49f3. 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(): 49fa. か *note break_here(): 49fb. が
          ‘True’ を返したときに、 *note dispatch_line(): 49f1. から呼び
          出されます。

      -- メソッド: user_return (frame, return_value)

          *note stop_here(): 49fa. が ‘True’ を返したときに、 *note
          dispatch_return(): 49f5. から呼び出されます。

      -- メソッド: user_exception (frame, exc_info)

          *note stop_here(): 49fa. が ‘True’ を返したときに、 *note
          dispatch_exception(): 49f7. から呼び出されます。

      -- メソッド: 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(): 4a04. 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: 507. 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(): 49eb. メソッドで説明されてい
          るような、標準形である必要があります。

      -- メソッド: clear_break (filename, lineno)

          'filename' の 'lineno' 行にあるブレークポイントを削除します。
          もしブレークポイントが無かった場合、エラーメッセージを返します
          。

      -- メソッド: clear_bpbynumber (arg)

          *note Breakpoint.bpbynumber: 49dc. の中で 'arg' のインデックス
          を持つブレークポイントを削除します。 'arg' が数値でないか範囲
          外の場合、エラーメッセージを返します。

      -- メソッド: clear_all_file_breaks (filename)

          'filename' にあるすべてのブレークポイントを削除します。もしブ
          レークポイントが無かった場合、エラーメッセージを返します。

      -- メソッド: clear_all_breaks ()

          存在するすべてのブレークポイントを削除します。もしブレークポイ
          ントが無かった場合、エラーメッセージを返します。

      -- メソッド: get_bpbynumber (arg)

          与えられた数値によって指定されるブレークポイントを返します。
          'arg' が文字列なら数値に変換されます。 'arg' が非数値の文字列
          である場合、指定されたブレークポイントが存在しないか削除された
          場合、 *note ValueError: 15a. が上げられます。

          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(): 4a11. 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 文: 2e2d. をデバ
     ッグするもので、クライアントから利用されます。

      -- メソッド: run (cmd, globals=None, locals=None)

          Debug a statement executed via the *note exec(): 190.
          function.  'globals' defaults to ‘__main__.__dict__’, 'locals'
          defaults to 'globals'.

      -- メソッド: runeval (expr, globals=None, locals=None)

          *note eval(): 18f. 関数を利用して式を実行しデバッグします。
          'globals' と 'locals' は *note run(): 4a14. と同じ意味です。

      -- メソッド: runctx (cmd, globals, locals)

          後方互換性のためのメソッドです。 *note run(): 4a14. を使ってく
          ださい。

      -- メソッド: runcall (func, /, *args, **kwds)

          1つの関数呼び出しをデバッグし、その結果を返します。

最後に、このモジュールは以下の関数を提供しています:

 -- の関数: bdb.checkfuncname (b, frame)

     Return ‘True’ if we should break here, depending on the way the
     *note Breakpoint: 49db. 'b' was set.

     If it was set via line number, it checks if *note b.line: 49e7. is
     the same as the one in 'frame'.  If the breakpoint was set via
     *note function name: 49df, 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: 49dd.
     for the (*note file: 49de, *note line: 49e7.) (which must exist)
     that is *note enabled: 49e9, for which *note checkfuncname(): 4a17.
     is true, and that has neither a false *note condition: 49e1. nor
     positive *note ignore: 49ea. 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: 557. クラスのインスタンスを使って、呼び出し元のフレーム
     からデバッグを開始します。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 1437.、*note SIGFPE: 1438.、*note
SIGABRT: 1439.、*note SIGBUS: 143a.、*note SIGILL: 143b. に対するフォー
ルトハンドラをインストールするには *note faulthandler.enable(): 224. を
実行してください。python起動時に有効にするには環境変数 *note
PYTHONFAULTHANDLER: 143c. を設定するか、コマンドライン引数に *note -X:
183. ‘faulthandler’ を指定してください。

Pythonのフォールトハンドラは、apportやWindowsのフォールトハンドラのよう
なシステムフォールトハンドラと互換性があります。このモジュールは
‘sigaltstack()’ 関数が使用可能であればシグナルハンドラ用に代替スタックを
利用します。これによってスタックオーバーフロー時にもトレースバックを出力
することができます。

フォールトハンドラは絶望的なケースで呼び出されます。そのためシグナルセー
フな関数しか使うことができません (例: ヒープメモリ上にメモリ確保はできま
せん)。この制限により、tracebackのダンプ機能は通常のPythonのtracebackと
比べてごく僅かなものです:

   * ASCIIのみサポートされます。エンコード時には ‘backslashreplace’ エラ
     ーハンドラを使用します。

   * すべての文字列は500文字以内に制限されています。

   * ファイル名、関数名、行数のみ表示します。(ソースコードの表示はありま
     せん)

   * It is limited to 100 frames per thread, and 100 threads
     (configurable via 'max_threads').

   * 順番は保持されます: 最新の呼び出しが最初に表示されます。

デフォルトでは、Pythonのtracebackは *note sys.stderr: d09. に書き出され
ます。tracebackを見るには、対象アプリケーションはターミナル上で実行しな
ければなりません。 *note faulthandler.enable(): 224. に渡す引数によって
ログファイルを指定することができます。

モジュールはC言語で実装されているので、アプリのクラッシュ時でもPythonが
デッドロックした場合でもダンプができます。

The *note Python Development Mode: 713. calls *note
faulthandler.enable(): 224. at Python startup.

参考
....

*note pdb: aa. モジュール

     Interactive source code debugger for Python programs.

*note traceback: 107. モジュール

     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, *, max_threads=100)

     Dump the tracebacks of all threads into 'file'.  If 'all_threads'
     is ‘False’, dump only the current thread.  'max_threads' caps the
     number of threads dumped.

     参考
     ....

     *note traceback.print_tb(): 1239, which can be used to print a
     traceback object.

     バージョン 3.5 で変更: Added support for passing file descriptor to
     this function.

     バージョン 3.15 で変更: Added the 'max_threads' keyword argument.


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: ae8.
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, *, max_threads=100)

     Enable the fault handler: install handlers for the *note SIGSEGV:
     1437, *note SIGFPE: 1438, *note SIGABRT: 1439, *note SIGBUS: 143a.
     and *note SIGILL: 143b. 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: 4a1f.

     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(): 4a6. for more information on compatibility.

     'max_threads' caps the number of threads dumped when a fatal signal
     fires.

     バージョン 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: 418. is disabled to prevent the risk of data races.

     バージョン 3.14 で変更: The dump now displays the C stack trace if
     'c_stack' is true.

     バージョン 3.15 で変更: Added the 'max_threads' keyword argument.

 -- の関数: faulthandler.disable ()

     フォールトハンドラを無効にします: *note enable(): 224. によってイン
     ストールされたシグナルハンドラをアンインストールします。

 -- の関数: 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, *, max_threads=100)

     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.  'max_threads' caps the number of threads dumped.

     The 'file' must be kept open until the traceback is dumped or *note
     cancel_dump_traceback_later(): 4a23. is called: see *note issue
     with file descriptors: 4a1f.

     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.

     バージョン 3.15 で変更: Added the 'max_threads' keyword argument.

 -- の関数: faulthandler.cancel_dump_traceback_later ()

     *note dump_traceback_later(): 226. の最新の呼び出しをキャンセルしま
     す。


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, *, max_threads=100)

     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’.  'max_threads' caps the number of threads
     dumped.

     The 'file' must be kept open until the signal is unregistered by
     *note unregister(): 4a25.: see *note issue with file descriptors:
     4a1f.

     Windowsでは利用不可です。

     バージョン 3.5 で変更: Added support for passing file descriptor to
     this function.

     バージョン 3.15 で変更: Added the 'max_threads' keyword argument.

 -- の関数: faulthandler.unregister (signum)

     ユーザシグナルを登録解除します: *note register(): 227. でインストー
     ルした 'signum' シグナルハンドラをアンインストールします。シグナル
     が登録された場合は ‘True’ を返し、そうでなければ ‘False’ を返します
     。

     Windowsでは利用不可です。


File: python.info,  Node: ファイル記述子の問題,  Next: 使用例<43>,  Prev: ユーザシグナルに対してtracebackをダンプする,  Up: faulthandler --- Python トレースバックをダンプする

5.28.3.7 ファイル記述子の問題
.............................

*note enable(): 224.、*note dump_traceback_later(): 226. ならびに *note
register(): 227. は引数 'file' に渡されたファイル記述子を保持します。フ
ァイルが閉じられファイル記述子が新しいファイルで再利用された場合や、
*note os.dup2(): f24. の使用でファイル記述子が置き換えた場合、 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.15/_ctypes.cpython-315d-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.15/_ctypes.cpython-315d-x86_64-linux-gnu.so", at +0x15a33 [0x77b7315e6a33]
       Binary file "/opt/python/build/lib.linux-x86_64-3.15/_ctypes.cpython-315d-x86_64-linux-gnu.so", at +0x164fa [0x77b7315e74fa]
       Binary file "/opt/python/build/lib.linux-x86_64-3.15/_ctypes.cpython-315d-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: profiling --- 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: 502. として定義され
ています。現在これについてのドキュメントはありませんが、ソースを読めば簡
単に理解できます。拡張インターフェースはモジュール *note bdb: 10. と
*note cmd: 1a. を使っています。

参考
....

*note faulthandler: 5b. モジュール

     Used to dump Python tracebacks explicitly, on a fault, after a
     timeout, or on a user signal.

*note traceback: 107. モジュール

     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:
4a2c. command.

バージョン 3.7 で変更: The built-in *note breakpoint(): 500, 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: c2. モジュールによるコマンドおよ
びコマンド引数のタブ補完が利用できます。たとえば、‘p’ コマンドの引数では
現在のグローバルおよびローカル名が候補として表示されます。

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<8>.
* Debugger commands::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 4a30.

     バージョン 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: 6b3.

このモジュールは以下の関数を定義しています。それぞれが少しづつ違った方法
でデバッガに入ります:

 -- の関数: pdb.run (statement, globals=None, locals=None)

     デバッガーに制御された状態で (文字列またはコードオブジェクトとして
     与えられた) 'statement' を実行します。あらゆるコードが実行される前
     にデバッガープロンプトが現れます。ブレークポイントを設定し、*note
     continue: 4a2c. とタイプできます。あるいは、文を *note step: 4a33.
     や *note next: 4a34. を使って一つづつ実行することができます (これら
     のコマンドはすべて下で説明します)。オプションの 'globals' と
     'locals' 引数はコードを実行する環境を指定します。デフォルトでは、モ
     ジュール *note __main__: 1. の辞書が使われます。(組み込み関数 *note
     exec(): 190. または *note eval(): 18f. の説明を参照してください。)

 -- の関数: pdb.runeval (expression, globals=None, locals=None)

     デバッガーに制御された状態で (文字列またはコードオブジェクトとして
     与えられる) 'expression' を評価します。*note runeval(): 4a35. から
     復帰するとき、式の値を返します。その他の点では、この関数は *note
     run(): 4822. と同様です。

 -- の関数: pdb.runcall (function, *args, **kwds)

     'function' (関数またはメソッドオブジェクト、文字列ではありません) を
     与えられた引数とともに呼び出します。 *note runcall(): 4a36. から復
     帰するとき、関数呼び出しが返したものはなんでも返します。関数に入る
     とすぐにデバッガプロンプトが現れます。

 -- の関数: 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(): 501.  This function should be
     used inside an async function with *note await: 439.

          async def f():
              await pdb.set_trace_async()

     *note await: 439. 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: ebe.  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: 8d3.

 -- の関数: pdb.set_default_backend (backend)

     There are two supported backends for pdb: ‘'settrace'’ and
     ‘'monitoring'’.  See *note bdb.Bdb: 557. for details.  The user can
     set the default backend to use if none is specified when
     instantiating *note Pdb: 502.  If no backend is specified, the
     default is ‘'settrace'’.

          注釈: *note breakpoint(): 500. and *note set_trace(): 501.
          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(): 501. は、 *note Pdb: 502. クラスをイン
スタンス化して同名のメソッドを実行することのエイリアス関数です。それ以上
の機能を利用したい場合は、インスタンス化を自分で行わなければなりません:

 -- クラス: pdb.Pdb (completekey='tab', stdin=None, stdout=None,
          skip=None, nosigint=False, readrc=True, mode=None,
          backend=None, colorize=False)

     *note Pdb: 502. はデバッガクラスです。

     'completekey', 'stdin', 'stdout' 引数は、基底にある *note cmd.Cmd:
     1a98. クラスに渡されます。そちらの解説を参照してください。

     'skip' 引数が指定された場合、 glob スタイルのモジュール名パターンの
     iterable (イテレート可能オブジェクト) でなければなりません。デバッ
     ガはこのパターンのどれかにマッチするモジュールに属するフレームには
     ステップインしません。 (2)

     デフォルトでは、Pdb は *note continue: 4a2c. コマンドが投入されると
     、(ユーザーがコンソールから ‘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(): 4a37.  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 監査イベント: 1e84. ‘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():
     500. or *note pdb.set_trace(): 501. 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: 4a3d. コマンドならば、次の 11 行がリストされます。

デバッガが認識しないコマンドは Python 文とみなして、デバッグしているプロ
グラムのコンテキストおいて実行されます。先頭にに感嘆符 (‘!’) を付けるこ
とで Python 文であると明示することもできます。これはデバッグ中のプログラ
ムを調査する強力な方法です。変数を変更したり関数を呼び出したりすることも
可能です。このような文で例外が発生した場合には例外名が出力されますが、デ
バッガの状態は変化しません。

バージョン 3.13 で変更: Expressions/Statements whose prefix is a pdb
command are now correctly identified and executed.

デバッガーは *note エイリアス: 4a3e. をサポートしています。エイリアスは
デバッグ中のコンテキストに適用可能な一定レベルのパラメータを保持すること
ができます。

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: 4a2c. や *note next:
4a34. のようなデバッグを続行するコマンドが使用できるようになりました。以
前はこのようなコマンドは無視されていました。

バージョン 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: 19f.  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: 4a43. と同じです。

 -- 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 most recently
     set breakpoint that still exists.

     ブレークポイントコマンドはプログラムを走らせ直すのに使えます。単に
     *note continue: 4a2c. コマンドや *note step: 4a33.、その他実行を再
     開するコマンドを使えば良いのです。

     Specifying any command resuming execution (currently *note
     continue: 4a2c, *note step: 4a33, *note next: 4a34, *note return:
     4a4a, *note until: 4a4b, *note jump: 4a4c, *note quit: 4a4d. 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: 4a34. と *note step: 4a33. の差は ‘step’ が呼び出
     された関数の内部で停止するのに対し、 ‘next’ は呼び出された関数を (ほ
     ぼ) 全速力で実行し、現在の関数内の次の行で停止するだけです。)

 -- Pdbcommand: unt(il) [lineno]

     引数なしだと、現在の行から 1 行先まで実行します。

     'lineno' を指定すると、番号が 'lineno' 以上である行に到達するまで実
     行します。どちらにしても現在のフレームが返ってきた時点で停止します
     。

     バージョン 3.2 で変更: 明示的に行数指定ができるようになりました。

 -- Pdbcommand: r(eturn)

     現在の関数が返るまで実行を継続します。

 -- Pdbcommand: c(ont(inue))

     ブレークポイントに出会うまで、実行を継続します。

 -- Pdbcommand: j(ump) lineno

     次に実行する行を指定します。最も底のフレーム中でのみ実行可能です。
     前に戻って実行したり、不要な部分をスキップして先の処理を実行する場
     合に使用します。

     ジャンプには制限があり、例えば *note for: 329. ループの中には飛び込
     めませんし、 *note finally: 453. 節の外にも飛ぶ事ができません。

 -- Pdbcommand: l(ist) [first[, last]]

     現在のファイルのソースコードを表示します。引数を指定しないと、現在
     の行の前後 11 行分を表示するか、直前の表示を続行します。引数に ‘.’
     を指定すると、現在の行の前後 11 行分を表示します。数値を 1 個指定す
     ると、その行番号の前後 11 行分を表示します。数値を 2 個指定すると、
     開始行と最終行として表示します; 2 個めの引数が 1 個め未満だった場合
     、1 個目を開始行、2 個めを開始行からの行数とみなします。

     現在のフレーム内の現在の行は ‘->’ で表示されます。例外をデバッグ中
     の場合、例外が発生または伝搬した行は、それが現在の行とは異なるとき
     ‘>>’ で表示されます。

     バージョン 3.2 で変更: ‘>>’ マーカーが追加されました。

 -- Pdbcommand: ll | longlist

     現在の関数またはフレームの全ソースコードを表示します。注目する行は
     *note list: 4a3d. と同じようにマーカーがつきます。

     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(): 1324. が実行され
          ます。

 -- Pdbcommand: pp expression

     *note p: 1325. コマンドに似ていますが、'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: 4a54. command.

     バージョン 3.13 で変更: *note interact: 4a54. directs its output to
     the debugger's output channel rather than *note sys.stderr: d09.

 -- 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: 6bb. 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: cc. で分割され、結果が新しい *note sys.argv: 161e.
     として使われます。ヒストリー、ブレークポイント、アクション、そして
     、デバッガーオプションは引き継がれます。 *note restart: 4a59. は
     *note run: 4a58. の別名です。

     バージョン 3.14 で変更: *note run: 4a58. and *note restart: 4a59.
     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: 4a4d.

     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(): 506. immediately, instead
     of raising *note bdb.BdbQuit: 507. 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: profiling --- Python profilers,  Next: pstats --- Statistics for profilers,  Prev: pdb --- The Python Debugger,  Up: Debugging and profiling

5.28.5 ‘profiling’ -- Python profilers
--------------------------------------

Added in version 3.15.

'Source code:' Lib/profiling/(1)

__________________________________________________________________

* Menu:

* Introduction to profiling::
* Choosing a profiler::
* Quick start::
* Understanding profile output::
* Legacy compatibility::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/profiling/


File: python.info,  Node: Introduction to profiling,  Next: Choosing a profiler,  Up: profiling --- Python profilers

5.28.5.1 Introduction to profiling
..................................

A 'profile' is a set of statistics that describes how often and for how
long various parts of a program execute.  These statistics help identify
performance bottlenecks and guide optimization efforts.  Python provides
two fundamentally different approaches to collecting this information:
statistical sampling and deterministic tracing.

The ‘profiling’ package organizes Python's built-in profiling tools
under a single namespace.  It contains two submodules, each implementing
a different profiling methodology:

*note profiling.sampling: b6.

     A statistical profiler that periodically samples the call stack.
     Run scripts directly or attach to running processes by PID.
     Provides multiple output formats (flame graphs, heatmaps, Firefox
     Profiler), GIL analysis, GC tracking, and multiple profiling modes
     (wall-clock, CPU, GIL) with virtually no overhead.

*note profiling.tracing: b7.

     A deterministic profiler that traces every function call, return,
     and exception event.  Provides exact call counts and precise timing
     information, capturing every invocation including very fast
     functions.

     注釈: The profiler modules are designed to provide an execution
     profile for a given program, not for benchmarking purposes.  For
     benchmarking, use the *note timeit: f8. module, which provides
     reasonably accurate timing measurements.  This distinction is
     particularly important when comparing Python code against C code:
     deterministic profilers introduce overhead for Python code but not
     for C-level functions, which can skew comparisons.


File: python.info,  Node: Choosing a profiler,  Next: Quick start,  Prev: Introduction to profiling,  Up: profiling --- Python profilers

5.28.5.2 Choosing a profiler
............................

For most performance analysis, use the statistical profiler (*note
profiling.sampling: b6.).  It has minimal overhead, works for both
development and production, and provides rich visualization options
including flame graphs, heatmaps, GIL analysis, and more.

Use the deterministic profiler (*note profiling.tracing: b7.) when you
need 'exact call counts' and cannot afford to miss any function calls.
Since it instruments every function call and return, it will capture
even very fast functions that complete between sampling intervals.  The
tradeoff is higher overhead.

The following table summarizes the key differences:

Feature                  Statistical sampling               Deterministic
                         (*note profiling.sampling: b6.)    (*note profiling.tracing: b7.)
                                                            
-----------------------------------------------------------------------------------------------
                                                            
'Overhead'               Virtually none                     Moderate
                                                            
                                                            
'Accuracy'               Statistical estimate               Exact call counts
                                                            
                                                            
'Output formats'         pstats, flame graph, heatmap,      pstats
                         gecko, collapsed                   
                         
                                                            
'Profiling modes'        Wall-clock, CPU, GIL               Wall-clock
                                                            
                                                            
'Special frames'         GC, native (C extensions)          N/A
                                                            
                                                            
'Attach to PID'          Yes                                No
                                                            

* Menu:

* When to use statistical sampling::
* When to use deterministic tracing::


File: python.info,  Node: When to use statistical sampling,  Next: When to use deterministic tracing,  Up: Choosing a profiler

5.28.5.3 When to use statistical sampling
.........................................

The statistical profiler (*note profiling.sampling: b6.) is recommended
for most performance analysis tasks.  Use it the same way you would use
*note profiling.tracing: b7.:

     python -m profiling.sampling run script.py

One of the main strengths of the sampling profiler is its variety of
output formats.  Beyond traditional pstats tables, it can generate
interactive flame graphs that visualize call hierarchies, line-level
source heatmaps that show exactly where time is spent in your code, and
Firefox Profiler output for timeline-based analysis.

The profiler also provides insight into Python interpreter behavior that
deterministic profiling cannot capture.  Use ‘--mode gil’ to identify
GIL contention in multi-threaded code, ‘--mode cpu’ to measure actual
CPU time excluding I/O waits, or inspect ‘<GC>’ frames to understand
garbage collection overhead.  The ‘--native’ option reveals time spent
in C extensions, helping distinguish Python overhead from library
performance.

For multi-threaded applications, the ‘-a’ option samples all threads
simultaneously, showing how work is distributed.  And for production
debugging, the ‘attach’ command connects to any running Python process
by PID without requiring a restart or code changes.


File: python.info,  Node: When to use deterministic tracing,  Prev: When to use statistical sampling,  Up: Choosing a profiler

5.28.5.4 When to use deterministic tracing
..........................................

The deterministic profiler (*note profiling.tracing: b7.) instruments
every function call and return.  This approach has higher overhead than
sampling, but guarantees complete coverage of program execution.

The primary reason to choose deterministic tracing is when you need
exact call counts.  Statistical profiling estimates frequency based on
sampling, which may undercount short-lived functions that complete
between samples.  If you need to verify that an optimization actually
reduced the number of function calls, or if you want to trace the
complete call graph to understand caller-callee relationships,
deterministic tracing is the right choice.

Deterministic tracing also excels at capturing functions that execute in
microseconds.  Such functions may not appear frequently enough in
statistical samples, but deterministic tracing records every invocation
regardless of duration.


File: python.info,  Node: Quick start,  Next: Understanding profile output,  Prev: Choosing a profiler,  Up: profiling --- Python profilers

5.28.5.5 Quick start
....................

This section provides the minimal steps needed to start profiling.  For
complete documentation, see the dedicated pages for each profiler.

* Menu:

* Statistical profiling::
* Deterministic profiling::


File: python.info,  Node: Statistical profiling,  Next: Deterministic profiling,  Up: Quick start

5.28.5.6 Statistical profiling
..............................

To profile a script, use the *note profiling.sampling: b6. module with
the ‘run’ command:

     python -m profiling.sampling run script.py
     python -m profiling.sampling run -m mypackage.module

This runs the script under the profiler and prints a summary of where
time was spent.  For an interactive flame graph:

     python -m profiling.sampling run --flamegraph script.py

To profile an already-running process, use the ‘attach’ command with the
process ID:

     python -m profiling.sampling attach 1234

For custom settings, specify the sampling interval (in microseconds) and
duration (in seconds):

     python -m profiling.sampling run -i 50 -d 30 script.py


File: python.info,  Node: Deterministic profiling,  Prev: Statistical profiling,  Up: Quick start

5.28.5.7 Deterministic profiling
................................

To profile a script from the command line:

     python -m profiling.tracing script.py

To profile a piece of code programmatically:

     import profiling.tracing
     profiling.tracing.run('my_function()')

This executes the given code under the profiler and prints a summary
showing exact function call counts and timing.


File: python.info,  Node: Understanding profile output,  Next: Legacy compatibility,  Prev: Quick start,  Up: profiling --- Python profilers

5.28.5.8 Understanding profile output
.....................................

Both profilers collect function-level statistics, though they present
them in different formats.  The sampling profiler offers multiple
visualizations (flame graphs, heatmaps, Firefox Profiler, pstats
tables), while the deterministic profiler produces pstats-compatible
output.  Regardless of format, the underlying concepts are the same.

Key profiling concepts:

'Direct time' (also called 'self time' or 'tottime')

     Time spent executing code in the function itself, excluding time
     spent in functions it called.  High direct time indicates the
     function contains expensive operations.

'Cumulative time' (also called 'total time' or 'cumtime')

     Time spent in the function and all functions it called.  This
     measures the total cost of calling a function, including its entire
     call subtree.

'Call count' (also called 'ncalls' or 'samples')

     How many times the function was called (deterministic) or sampled
     (statistical).  In deterministic profiling, this is exact.  In
     statistical profiling, it represents the number of times the
     function appeared in a stack sample.

'Primitive calls'

     Calls that are not induced by recursion.  When a function recurses,
     the total call count includes recursive invocations, but primitive
     calls counts only the initial entry.  Displayed as
     ‘total/primitive’ (for example, ‘3/1’ means three total calls, one
     primitive).

'Caller/Callee relationships'

     Which functions called a given function (callers) and which
     functions it called (callees).  Flame graphs visualize this as
     nested rectangles; pstats can display it via the *note
     print_callers(): 4a6a. and *note print_callees(): 4a6b. methods.


File: python.info,  Node: Legacy compatibility,  Prev: Understanding profile output,  Up: profiling --- Python profilers

5.28.5.9 Legacy compatibility
.............................

For backward compatibility, the ‘cProfile’ module remains available as
an alias to *note profiling.tracing: b7.  Existing code using ‘import
cProfile’ will continue to work without modification in all future
Python versions.

バージョン 3.15 で非推奨: The pure Python *note profile: b4. module is
deprecated and will be removed in Python 3.17.  Use *note
profiling.tracing: b7. (or its alias ‘cProfile’) instead.  See ‘profile’
for migration guidance.

参考
....

*note profiling.sampling: b6.

     Statistical sampling profiler with flame graphs, heatmaps, and GIL
     analysis.  Recommended for most users.

*note profiling.tracing: b7.

     Deterministic tracing profiler for exact call counts.

*note pstats: b8.

     Statistics analysis and formatting for profile data.

*note timeit: f8.

     Module for measuring execution time of small code snippets.

Submodules
..........

* Menu:

* profiling.tracing: profiling tracing --- Deterministic profiler. Deterministic profiler
* profiling.sampling: profiling sampling --- Statistical profiler. Statistical profiler


File: python.info,  Node: profiling tracing --- Deterministic profiler,  Next: profiling sampling --- Statistical profiler,  Up: Legacy compatibility

5.28.5.10 ‘profiling.tracing’ -- Deterministic profiler
.......................................................

Added in version 3.15.

'Source code:' Lib/profiling/tracing/(1)

__________________________________________________________________

The ‘profiling.tracing’ module provides deterministic profiling of
Python programs.  It monitors every function call, function return, and
exception event, recording precise timing for each.  This approach
provides exact call counts and complete visibility into program
execution, making it ideal for development and testing scenarios.

     注釈: This module is also available as ‘cProfile’ for backward
     compatibility.  The ‘cProfile’ name will continue to work in all
     future Python versions.  Use whichever import style suits your
     codebase:

          # Preferred (new style)
          import profiling.tracing
          profiling.tracing.run('my_function()')

          # Also works (backward compatible)
          import cProfile
          cProfile.run('my_function()')

* Menu:

* What is deterministic profiling?::
* Command-line interface::
* Programmatic usage examples::
* Module reference::
* Using a custom timer::
* Limitations::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/profiling/tracing/


File: python.info,  Node: What is deterministic profiling?,  Next: Command-line interface,  Up: profiling tracing --- Deterministic profiler

5.28.5.11 What is deterministic profiling?
..........................................

'Deterministic profiling' captures every function call, function return,
and exception event during program execution.  The profiler measures the
precise time intervals between these events, providing exact statistics
about how the program behaves.

In contrast to *note statistical profiling: 4a71, which samples the call
stack periodically to estimate where time is spent, deterministic
profiling records every event.  This means you get exact call counts
rather than statistical approximations.  The trade-off is that
instrumenting every event introduces overhead that can slow down program
execution.

Python's interpreted nature makes deterministic profiling practical.
The interpreter already dispatches events for function calls and
returns, so the profiler can hook into this mechanism without requiring
code modification.  The overhead tends to be moderate relative to the
inherent cost of interpretation, making deterministic profiling suitable
for most development workflows.

Deterministic profiling helps answer questions like:

   - How many times was this function called?

   - What is the complete call graph of my program?

   - Which functions are called by a particular function?

   - Are there unexpected function calls happening?

Call count statistics can identify bugs (surprising counts) and inline
expansion opportunities (high call counts).  Internal time statistics
reveal "hot loops" that warrant optimization.  Cumulative time
statistics help identify algorithmic inefficiencies.  The handling of
cumulative times in this profiler allows direct comparison of recursive
and iterative implementations.


File: python.info,  Node: Command-line interface,  Next: Programmatic usage examples,  Prev: What is deterministic profiling?,  Up: profiling tracing --- Deterministic profiler

5.28.5.12 Command-line interface
................................

The ‘profiling.tracing’ module can be invoked as a script to profile
another script or module:

     python -m profiling.tracing [-o output_file] [-s sort_order] (-m module | script.py)

This runs the specified script or module under the profiler and prints
the results to standard output (or saves them to a file).

 -- Option: -o <output_file>

     Write the profile results to a file instead of standard output.
     The output file can be read by the *note pstats: b8. module for
     later analysis.

 -- Option: -s <sort_order>

     Sort the output by the specified key.  This accepts any of the sort
     keys recognized by *note pstats.Stats.sort_stats(): 4a76, such as
     ‘cumulative’, ‘time’, ‘calls’, or ‘name’.  This option only applies
     when *note -o: 4a74. is not specified.

 -- Option: -m <module>

     Profile a module instead of a script.  The module is located using
     the standard import mechanism.

     Added in version 3.7: The ‘-m’ option for ‘cProfile’.

     Added in version 3.8: The ‘-m’ option for *note profile: b4.


File: python.info,  Node: Programmatic usage examples,  Next: Module reference,  Prev: Command-line interface,  Up: profiling tracing --- Deterministic profiler

5.28.5.13 Programmatic usage examples
.....................................

For more control over profiling, use the module's functions and classes
directly.

* Menu:

* Basic profiling::
* Using the Profile class::


File: python.info,  Node: Basic profiling,  Next: Using the Profile class,  Up: Programmatic usage examples

5.28.5.14 Basic profiling
.........................

The simplest approach uses the ‘run()’ function:

     import profiling.tracing
     profiling.tracing.run('my_function()')

This profiles the given code string and prints a summary to standard
output.  To save results for later analysis:

     profiling.tracing.run('my_function()', 'output.prof')


File: python.info,  Node: Using the Profile class,  Prev: Basic profiling,  Up: Programmatic usage examples

5.28.5.15 Using the ‘Profile’ class
...................................

The ‘Profile’ class provides fine-grained control:

     import profiling.tracing
     import pstats
     from io import StringIO

     pr = profiling.tracing.Profile()
     pr.enable()
     # ... code to profile ...
     pr.disable()

     # Print results
     s = StringIO()
     ps = pstats.Stats(pr, stream=s).sort_stats(pstats.SortKey.CUMULATIVE)
     ps.print_stats()
     print(s.getvalue())

The ‘Profile’ class also works as a context manager:

     import profiling.tracing

     with profiling.tracing.Profile() as pr:
         # ... code to profile ...

     pr.print_stats()


File: python.info,  Node: Module reference,  Next: Using a custom timer,  Prev: Programmatic usage examples,  Up: profiling tracing --- Deterministic profiler

5.28.5.16 Module reference
..........................

 -- の関数: profiling.tracing.run (command, filename=None, sort=-1)

     Profile execution of a command and print or save the results.

     This function executes the 'command' string using *note exec():
     190. in the ‘__main__’ module's namespace:

          exec(command, __main__.__dict__, __main__.__dict__)

     If 'filename' is not provided, the function creates a *note
     pstats.Stats: 4a7d. instance and prints a summary to standard
     output.  If 'filename' is provided, the raw profile data is saved
     to that file for later analysis with *note pstats: b8.

     The 'sort' argument specifies the sort order for printed output,
     accepting any value recognized by *note pstats.Stats.sort_stats():
     4a76.

 -- の関数: profiling.tracing.runctx (command, globals, locals,
          filename=None, sort=-1)

     Profile execution of a command with explicit namespaces.

     Like *note run(): 4a7c, but executes the command with the specified
     'globals' and 'locals' mappings instead of using the ‘__main__’
     module's namespace:

          exec(command, globals, locals)

 -- クラス: profiling.tracing.Profile (timer=None, timeunit=0.0,
          subcalls=True, builtins=True)

     A profiler object that collects execution statistics.

     The optional 'timer' argument specifies a custom timing function.
     If not provided, the profiler uses a platform-appropriate default
     timer.  When supplying a custom timer, it must return a single
     number representing the current time.  If the timer returns
     integers, use 'timeunit' to specify the duration of one time unit
     (for example, ‘0.001’ for milliseconds).

     The 'subcalls' argument controls whether the profiler tracks call
     relationships between functions.  The 'builtins' argument controls
     whether built-in functions are profiled.

     バージョン 3.8 で変更: Added context manager support.

      -- メソッド: enable ()

          Start collecting profiling data.

      -- メソッド: disable ()

          Stop collecting profiling data.

      -- メソッド: create_stats ()

          Stop collecting data and record the results internally as the
          current profile.

      -- メソッド: print_stats (sort=-1)

          Create a *note pstats.Stats: 4a7d. object from the current
          profile and print the results to standard output.

          The 'sort' argument specifies the sorting order.  It accepts a
          single key or a tuple of keys for multi-level sorting, using
          the same values as *note pstats.Stats.sort_stats(): 4a76.

          Added in version 3.13: Support for a tuple of sort keys.

      -- メソッド: dump_stats (filename)

          Write the current profile data to 'filename'.  The file can be
          read by *note pstats.Stats: 4a7d. for later analysis.

      -- メソッド: run (cmd)

          Profile the command string via *note exec(): 190.

      -- メソッド: runctx (cmd, globals, locals)

          Profile the command string via *note exec(): 190. with the
          specified namespaces.

      -- メソッド: runcall (func, /, *args, **kwargs)

          Profile a function call.  Returns whatever 'func' returns:

               result = pr.runcall(my_function, arg1, arg2, keyword=value)

     注釈: Profiling requires that the profiled code returns normally.
     If the interpreter terminates (for example, via *note sys.exit():
     506.) during profiling, no results will be available.


File: python.info,  Node: Using a custom timer,  Next: Limitations,  Prev: Module reference,  Up: profiling tracing --- Deterministic profiler

5.28.5.17 Using a custom timer
..............................

The *note Profile: 4a7f. class accepts a custom timing function,
allowing you to measure different aspects of execution such as
wall-clock time or CPU time.  Pass the timing function to the
constructor:

     pr = profiling.tracing.Profile(my_timer_function)

The timer function must return a single number representing the current
time.  If it returns integers, also specify 'timeunit' to indicate the
duration of one unit:

     # Timer returns time in milliseconds
     pr = profiling.tracing.Profile(my_ms_timer, 0.001)

For best performance, the timer function should be as fast as possible.
The profiler calls it frequently, so timer overhead directly affects
profiling overhead.

The *note time: f7. module provides several functions suitable for use
as custom timers:

   - *note time.perf_counter(): e4d. for high-resolution wall-clock time

   - *note time.process_time(): e4e. for CPU time (excluding sleep)

   - *note time.monotonic(): 763. for monotonic clock time


File: python.info,  Node: Limitations,  Prev: Using a custom timer,  Up: profiling tracing --- Deterministic profiler

5.28.5.18 Limitations
.....................

Deterministic profiling has inherent limitations related to timing
accuracy.

The underlying timer typically has a resolution of about one
millisecond.  Measurements cannot be more accurate than this resolution.
With enough measurements, timing errors tend to average out, but
individual measurements may be imprecise.

There is also latency between when an event occurs and when the profiler
captures the timestamp.  Similarly, there is latency after reading the
timestamp before user code resumes.  Functions called frequently
accumulate this latency, which can make them appear slower than they
actually are.  This error is typically less than one clock tick per call
but can become significant for functions called many times.

The ‘profiling.tracing’ module (and its ‘cProfile’ alias) is implemented
as a C extension with low overhead, so these timing issues are less
pronounced than with the deprecated pure Python *note profile: b4.
module.

参考
....

*note profiling: b5.

     Overview of Python profiling tools and guidance on choosing a
     profiler.

*note profiling.sampling: b6.

     Statistical sampling profiler for production use.

*note pstats: b8.

     Statistics analysis and formatting for profile data.

*note profile: b4.

     Deprecated pure Python profiler (includes calibration
     documentation).


File: python.info,  Node: profiling sampling --- Statistical profiler,  Prev: profiling tracing --- Deterministic profiler,  Up: Legacy compatibility

5.28.5.19 ‘profiling.sampling’ -- Statistical profiler
......................................................

Added in version 3.15.

'Source code:' Lib/profiling/sampling/(1)

__________________________________________________________________

[image src="python-figures/tachyon-logo.png" alt="Tachyon logo"]


The ‘profiling.sampling’ module, named 'Tachyon', provides statistical
profiling of Python programs through periodic stack sampling.  Tachyon
can run scripts directly or attach to any running Python process without
requiring code changes or restarts.  Because sampling occurs externally
to the target process, overhead is virtually zero, making Tachyon
suitable for both development and production environments.

* Menu:

* What is statistical profiling?::
* Quick examples::
* Commands::
* Sampling configuration::
* Profiling modes::
* Output formats::
* Record and replay workflow::
* Live mode::
* Async-aware profiling::
* Command-line interface: Command-line interface<2>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/Lib/profiling/sampling/


File: python.info,  Node: What is statistical profiling?,  Next: Quick examples,  Up: profiling sampling --- Statistical profiler

5.28.5.20 What is statistical profiling?
........................................

Statistical profiling builds a picture of program behavior by
periodically capturing snapshots of the call stack.  Rather than
instrumenting every function call and return as deterministic profilers
do, Tachyon reads the call stack at regular intervals to record what
code is currently running.

This approach rests on a simple principle: functions that consume
significant CPU time will appear frequently in the collected samples.
By gathering thousands of samples over a profiling session, Tachyon
constructs an accurate statistical estimate of where time is spent.  The
more samples collected, the more precise this estimate becomes.

     注釈: An interactive visualization of sampling profiling is
     available in the HTML version of this documentation.

* Menu:

* How time is estimated::
* When to use a different approach::


File: python.info,  Node: How time is estimated,  Next: When to use a different approach,  Up: What is statistical profiling?

5.28.5.21 How time is estimated
...............................

The time values shown in Tachyon's output are 'estimates derived from
sample counts', not direct measurements.  Tachyon counts how many times
each function appears in the collected samples, then multiplies by the
sampling interval to estimate time.

For example, with a 10 kHz sampling rate over a 10-second profile,
Tachyon collects approximately 100,000 samples.  If a function appears
in 5,000 samples (5% of total), Tachyon estimates it consumed 5% of the
10-second duration, or about 500 milliseconds.  This is a statistical
estimate, not a precise measurement.

The accuracy of these estimates depends on sample count.  With 100,000
samples, a function showing 5% has a margin of error of roughly ±0.5%.
With only 1,000 samples, the same 5% measurement could actually
represent anywhere from 3% to 7% of real time.

This is why longer profiling durations and shorter sampling intervals
produce more reliable results--they collect more samples.  For most
performance analysis, the default settings provide sufficient accuracy
to identify bottlenecks and guide optimization efforts.

Because sampling is statistical, results will vary slightly between
runs.  A function showing 12% in one run might show 11% or 13% in the
next.  This is normal and expected.  Focus on the overall pattern rather
than exact percentages, and don't worry about small variations between
runs.


File: python.info,  Node: When to use a different approach,  Prev: How time is estimated,  Up: What is statistical profiling?

5.28.5.22 When to use a different approach
..........................................

Statistical sampling is not ideal for every situation.

For very short scripts that complete in under one second, the profiler
may not collect enough samples for reliable results.  Use *note
profiling.tracing: b7. instead, or run the script in a loop to extend
profiling time.

When you need exact call counts, sampling cannot provide them.  Sampling
estimates frequency from snapshots, so if you need to know precisely how
many times a function was called, use *note profiling.tracing: b7.

When comparing two implementations where the difference might be only
1-2%, sampling noise can obscure real differences.  Use *note timeit:
f8. for micro-benchmarks or *note profiling.tracing: b7. for precise
measurements.

The key difference from *note profiling.tracing: b7. is how measurement
happens.  A tracing profiler instruments your code, recording every
function call and return.  This provides exact call counts and precise
timing but adds overhead to every function call.  A sampling profiler,
by contrast, observes the program from outside at fixed intervals
without modifying its execution.  Think of the difference like this:
tracing is like having someone follow you and write down every step you
take, while sampling is like taking photographs every second and
inferring your path from those snapshots.

This external observation model is what makes sampling profiling
practical for production use.  The profiled program runs at full speed
because there is no instrumentation code running inside it, and the
target process is never stopped or paused during sampling--Tachyon reads
the call stack directly from the process's memory while it continues to
run.  You can attach to a live server, collect data, and detach without
the application ever knowing it was observed.  The trade-off is that
very short-lived functions may be missed if they happen to complete
between samples.

Statistical profiling excels at answering the question, "Where is my
program spending time?"  It reveals hotspots and bottlenecks in
production code where deterministic profiling overhead would be
unacceptable.  For exact call counts and complete call graphs, use *note
profiling.tracing: b7. instead.


File: python.info,  Node: Quick examples,  Next: Commands,  Prev: What is statistical profiling?,  Up: profiling sampling --- Statistical profiler

5.28.5.23 Quick examples
........................

Profile a script and see the results immediately:

     python -m profiling.sampling run script.py

Profile a module with arguments:

     python -m profiling.sampling run -m mypackage.module arg1 arg2

Generate an interactive flame graph:

     python -m profiling.sampling run --flamegraph -o profile.html script.py

Attach to a running process by PID:

     python -m profiling.sampling attach 12345

Print a single snapshot of a running process's stack:

     python -m profiling.sampling dump 12345

Use live mode for real-time monitoring (press ‘q’ to quit):

     python -m profiling.sampling run --live script.py

Profile for 60 seconds with a faster sampling rate:

     python -m profiling.sampling run -d 60 -r 20khz script.py

Generate a line-by-line heatmap:

     python -m profiling.sampling run --heatmap script.py

Enable opcode-level profiling to see which bytecode instructions are
executing:

     python -m profiling.sampling run --opcodes --flamegraph script.py


File: python.info,  Node: Commands,  Next: Sampling configuration,  Prev: Quick examples,  Up: profiling sampling --- Statistical profiler

5.28.5.24 Commands
..................

Tachyon operates through several subcommands.  ‘run’ and ‘attach’
collect samples over time; ‘dump’ captures a single snapshot; ‘replay’
converts binary profiles to other formats.

* Menu:

* The run command::
* The attach command::
* The dump command::
* The replay command::
* Profiling in production::
* Platform requirements::
* Version compatibility::


File: python.info,  Node: The run command,  Next: The attach command,  Up: Commands

5.28.5.25 The ‘run’ command
...........................

The ‘run’ command launches a Python script or module and profiles it
from startup:

     python -m profiling.sampling run script.py
     python -m profiling.sampling run -m mypackage.module

When profiling a script, the profiler starts the target in a subprocess,
waits for it to initialize, then begins collecting samples.  The ‘-m’
flag indicates that the target should be run as a module (equivalent to
‘python -m’).  Arguments after the target are passed through to the
profiled program:

     python -m profiling.sampling run script.py --config settings.yaml


File: python.info,  Node: The attach command,  Next: The dump command,  Prev: The run command,  Up: Commands

5.28.5.26 The ‘attach’ command
..............................

The ‘attach’ command connects to an already-running Python process by
its process ID:

     python -m profiling.sampling attach 12345

This command is particularly valuable for investigating performance
issues in production systems.  The target process requires no
modification and need not be restarted.  The profiler attaches, collects
samples for the specified duration, then detaches and produces output.

     python -m profiling.sampling attach --live 12345
     python -m profiling.sampling attach --flamegraph -d 30 -o profile.html 12345

On most systems, attaching to another process requires appropriate
permissions.  See *note Platform requirements: 4a94. for
platform-specific requirements.


File: python.info,  Node: The dump command,  Next: The replay command,  Prev: The attach command,  Up: Commands

5.28.5.27 The ‘dump’ command
............................

The ‘dump’ command prints a single snapshot of a running process's
Python stack and exits, similar to a traceback:

     python -m profiling.sampling dump 12345

Unlike ‘attach’, ‘dump’ does not run a sampling loop: it reads the stack
once.  This is useful for investigating hung or unresponsive processes,
or for answering "what is this process doing right now?".

The output mirrors a traceback (most recent call last) and annotates
each thread with its current state (main thread, has GIL, on CPU,
waiting for GIL, has exception, or idle):

     Stack dump for PID 12345, thread 140735 (main thread, has GIL, on CPU; most recent call last):
       File "server.py", line 28, in serve
         await handle_request(req)
       File "handler.py", line 91, in handle_request
         result = expensive_call(req)

When the target's source files are readable, ‘dump’ prints the source
line for each frame and highlights the executing expression.

Like ‘attach’, ‘dump’ requires permission to read the target process's
memory.  See *note Platform requirements: 4a94.

The ‘dump’ command supports the following options:

‘-a’, ‘--all-threads’

     Dump every thread in the target process.  Without this flag only
     the main thread is shown.

‘--native’

     Include synthetic ‘<native>’ frames marking transitions into C
     extensions or other non-Python code.

‘--no-gc’

     Hide the synthetic ‘<GC>’ frames that mark active garbage
     collection.

‘--opcodes’

     Annotate each frame with the bytecode opcode the thread is
     currently executing (for example, ‘opcode=CALL_KW’).  Useful for
     instruction-level investigation, including identifying
     specializations chosen by the adaptive interpreter.

‘--async-aware’

     Reconstruct stacks across ‘await’ boundaries.  ‘dump’ walks the
     task graph and emits one section per task, with ‘<task>’ markers
     separating coroutines awaiting each other.

‘--async-mode {running,all}’

     Controls which tasks are included when ‘--async-aware’ is enabled.
     ‘running’ shows only the task currently executing on each thread;
     ‘all’ (the default for ‘dump’) also includes tasks suspended on a
     wait.  ‘attach’'s default for this flag is ‘running’; ‘dump’
     defaults to ‘all’ because a single snapshot is most useful when it
     shows the full task graph.

‘--blocking’

     Pause every thread in the target while reading its stack and resume
     them after.  Guarantees a fully consistent snapshot at the cost of
     briefly stopping the target.  Without it, ‘dump’ reads memory while
     the target keeps running, which is faster but can occasionally
     produce a torn stack.


File: python.info,  Node: The replay command,  Next: Profiling in production,  Prev: The dump command,  Up: Commands

5.28.5.28 The ‘replay’ command
..............................

The ‘replay’ command converts binary profile files to other output
formats:

     python -m profiling.sampling replay profile.bin
     python -m profiling.sampling replay --flamegraph -o profile.html profile.bin

This command is useful when you have captured profiling data in binary
format and want to analyze it later or convert it to a visualization
format.  Binary profiles can be replayed multiple times to different
formats without re-profiling.

     # Convert binary to pstats (default, prints to stdout)
     python -m profiling.sampling replay profile.bin

     # Convert binary to flame graph
     python -m profiling.sampling replay --flamegraph -o output.html profile.bin

     # Convert binary to gecko format for Firefox Profiler
     python -m profiling.sampling replay --gecko -o profile.json profile.bin

     # Convert binary to heatmap
     python -m profiling.sampling replay --heatmap -o my_heatmap profile.bin


File: python.info,  Node: Profiling in production,  Next: Platform requirements,  Prev: The replay command,  Up: Commands

5.28.5.29 Profiling in production
.................................

The sampling profiler is designed for production use.  It imposes no
measurable overhead on the target process because it reads memory
externally rather than instrumenting code.  The target application
continues running at full speed and is unaware it is being profiled.

When profiling production systems, keep these guidelines in mind:

Start with shorter durations (10-30 seconds) to get quick results, then
extend if you need more statistical accuracy.  By default, profiling
runs until the target process completes, which is usually sufficient to
identify major hotspots.

If possible, profile during representative load rather than peak
traffic.  Profiles collected during normal operation are easier to
interpret than those collected during unusual spikes.

The profiler itself consumes some CPU on the machine where it runs (not
on the target process).  On the same machine, this is typically
negligible.  When profiling remote processes, network latency does not
affect the target.

Results from production may differ from development due to different
data sizes, concurrent load, or caching effects.  This is expected and
is often exactly what you want to capture.


File: python.info,  Node: Platform requirements,  Next: Version compatibility,  Prev: Profiling in production,  Up: Commands

5.28.5.30 Platform requirements
...............................

The profiler reads the target process's memory to capture stack traces.
This requires elevated permissions on most operating systems.

'Linux'

On Linux, the profiler uses ‘ptrace’ or ‘process_vm_readv’ to read the
target process's memory.  This typically requires one of:

   - Running as root

   - Having the ‘CAP_SYS_PTRACE’ capability

   - Adjusting the Yama ptrace scope:
     ‘/proc/sys/kernel/yama/ptrace_scope’

The default ptrace_scope of 1 restricts ptrace to parent processes only.
To allow attaching to any process owned by the same user, set it to 0:

     echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

'macOS'

On macOS, the profiler uses ‘task_for_pid()’ to access the target
process.  This requires one of:

   - Running as root

   - The profiler binary having the ‘com.apple.security.cs.debugger’
     entitlement

   - System Integrity Protection (SIP) being disabled (not recommended)

'Windows'

On Windows, the profiler requires administrative privileges or the
‘SeDebugPrivilege’ privilege to read another process's memory.


File: python.info,  Node: Version compatibility,  Prev: Platform requirements,  Up: Commands

5.28.5.31 Version compatibility
...............................

The profiler and target process must run the same Python minor version
(for example, both Python 3.15).  Attaching from Python 3.14 to a Python
3.15 process is not supported.

Additional restrictions apply to pre-release Python versions: if either
the profiler or target is running a pre-release (alpha, beta, or release
candidate), both must run the exact same version.

On free-threaded Python builds, the profiler cannot attach from a
free-threaded build to a standard build, or vice versa.


File: python.info,  Node: Sampling configuration,  Next: Profiling modes,  Prev: Commands,  Up: profiling sampling --- Statistical profiler

5.28.5.32 Sampling configuration
................................

Before exploring the various output formats and visualization options,
it is important to understand how to configure the sampling process
itself.  The profiler offers several options that control how frequently
samples are collected, how long profiling runs, which threads are
observed, and what additional context is captured in each sample.

The default configuration works well for most use cases:

Option                        Default
                              
--------------------------------------------------------------------------------------------------------------
                              
Default for                   1 kHz
‘--sampling-rate’ / ‘-r’      

Default for ‘--duration’ /    Run to completion
‘-d’                          

Default for ‘--all-threads’   Main thread only
/ ‘-a’                        

Default for ‘--native’        No ‘<native>’ frames (C code time attributed to caller)
                              
                              
Default for ‘--no-gc’         ‘<GC>’ frames included when garbage collection is active
                              
                              
Default for ‘--mode’          Wall-clock mode (all samples recorded)
                              
                              
Default for                   Disabled
‘--realtime-stats’            

Default for                   Disabled
‘--subprocesses’              

Default for ‘--blocking’      Disabled (non-blocking sampling)
                              

* Menu:

* Sampling rate and duration::
* Thread selection::
* Blocking mode::
* Special frames::
* Opcode-aware profiling::
* Real-time statistics::
* Subprocess profiling::
* Sampling efficiency::


File: python.info,  Node: Sampling rate and duration,  Next: Thread selection,  Up: Sampling configuration

5.28.5.33 Sampling rate and duration
....................................

The two most fundamental parameters are the sampling rate and duration.
Together, these determine how many samples will be collected during a
profiling session.

The *note -sampling-rate: 4a9e. option (*note -r: 4a9e.) sets how
frequently samples are collected.  The default is 1 kHz (1,000 samples
per second):

     python -m profiling.sampling run -r 20khz script.py

Higher rates capture more samples and provide finer-grained data at the
cost of slightly higher profiler CPU usage.  Lower rates reduce profiler
overhead but may miss short-lived functions.  For most applications, the
default rate provides a good balance between accuracy and overhead.

The *note -duration: 4a9f. option (*note -d: 4a9f.) sets how long to
profile in seconds.  By default, profiling continues until the target
process exits or is interrupted:

     python -m profiling.sampling run -d 60 script.py

Specifying a duration is useful when attaching to long-running processes
or when you want to limit profiling to a specific time window.  When
profiling a script, the default behavior of running to completion is
usually what you want.


File: python.info,  Node: Thread selection,  Next: Blocking mode,  Prev: Sampling rate and duration,  Up: Sampling configuration

5.28.5.34 Thread selection
..........................

Python programs often use multiple threads, whether explicitly through
the *note threading: f6. module or implicitly through libraries that
manage thread pools.

By default, the profiler samples only the main thread.  The *note
-all-threads: 4aa1. option (*note -a: 4aa1.) enables sampling of all
threads in the process:

     python -m profiling.sampling run -a script.py

Multi-thread profiling reveals how work is distributed across threads
and can identify threads that are blocked or starved.  Each thread's
samples are combined in the output, with the ability to filter by thread
in some formats.  This option is particularly useful when investigating
concurrency issues or when work is distributed across a thread pool.


File: python.info,  Node: Blocking mode,  Next: Special frames,  Prev: Thread selection,  Up: Sampling configuration

5.28.5.35 Blocking mode
.......................

By default, Tachyon reads the target process's memory without stopping
it.  This non-blocking approach is ideal for most profiling scenarios
because it imposes virtually zero overhead on the target application:
the profiled program runs at full speed and is unaware it is being
observed.

However, non-blocking sampling can occasionally produce incomplete or
inconsistent stack traces in applications with many generators or
coroutines that rapidly switch between yield points, or in programs with
very fast-changing call stacks where functions enter and exit between
the start and end of a single stack read, resulting in reconstructed
stacks that mix frames from different execution states or that never
actually existed.

For these cases, the *note -blocking: 4aa4. option stops the target
process during each sample:

     python -m profiling.sampling run --blocking script.py
     python -m profiling.sampling attach --blocking 12345

When blocking mode is enabled, the profiler suspends the target process,
reads its stack, then resumes it.  This guarantees that each captured
stack represents a real, consistent snapshot of what the process was
doing at that instant.  The trade-off is that the target process runs
slower because it is repeatedly paused.

     警告: Do not use very high sample rates (low ‘--interval’ values)
     with blocking mode.  Suspending and resuming a process takes time,
     and if the sampling interval is too short, the target will spend
     more time stopped than running.  For blocking mode, intervals of
     1000 microseconds (1 millisecond) or higher are recommended.  The
     default 100 microsecond interval may cause noticeable slowdown in
     the target application.

Use blocking mode only when you observe inconsistent stacks in your
profiles, particularly with generator-heavy or coroutine-heavy code.
For most applications, the default non-blocking mode provides accurate
results with zero impact on the target process.


File: python.info,  Node: Special frames,  Next: Opcode-aware profiling,  Prev: Blocking mode,  Up: Sampling configuration

5.28.5.36 Special frames
........................

The profiler can inject artificial frames into the captured stacks to
provide additional context about what the interpreter is doing at the
moment each sample is taken.  These synthetic frames help distinguish
different types of execution that would otherwise be invisible.

The *note -native: 4aa6. option adds ‘<native>’ frames to indicate when
Python has called into C code (extension modules, built-in functions, or
the interpreter itself):

     python -m profiling.sampling run --native script.py

These frames help distinguish time spent in Python code versus time
spent in native libraries.  Without this option, native code execution
appears as time in the Python function that made the call.  This is
useful when optimizing code that makes heavy use of C extensions like
NumPy or database drivers.

By default, the profiler includes ‘<GC>’ frames when garbage collection
is active.  The *note -no-gc: 4aa7. option suppresses these frames:

     python -m profiling.sampling run --no-gc script.py

GC frames help identify programs where garbage collection consumes
significant time, which may indicate memory allocation patterns worth
optimizing.  If you see substantial time in ‘<GC>’ frames, consider
investigating object allocation rates or using object pooling.


File: python.info,  Node: Opcode-aware profiling,  Next: Real-time statistics,  Prev: Special frames,  Up: Sampling configuration

5.28.5.37 Opcode-aware profiling
................................

The *note -opcodes: 4aa9. option enables instruction-level profiling
that captures which Python bytecode instructions are executing at each
sample:

     python -m profiling.sampling run --opcodes --flamegraph script.py

This feature provides visibility into Python's bytecode execution,
including adaptive specialization optimizations.  When a generic
instruction like ‘LOAD_ATTR’ is specialized at runtime into a more
efficient variant like ‘LOAD_ATTR_INSTANCE_VALUE’, the profiler shows
both the specialized name and the base instruction.

Opcode information appears in several output formats:

   - 'Flame graphs': Hovering over a frame displays a tooltip with a
     bytecode instruction breakdown, showing which opcodes consumed time
     in that function

   - 'Heatmap': Expandable bytecode panels per source line show
     instruction breakdown with specialization percentages

   - 'Live mode': An opcode panel shows instruction-level statistics for
     the selected function, accessible via keyboard navigation

   - 'Gecko format': Opcode transitions are emitted as interval markers
     in the Firefox Profiler timeline

This level of detail is particularly useful for:

   - Understanding the performance impact of Python's adaptive
     specialization

   - Identifying hot bytecode instructions that might benefit from
     optimization

   - Analyzing the effectiveness of different code patterns at the
     instruction level

   - Debugging performance issues that occur at the bytecode level

The *note -opcodes: 4aa9. option is compatible with *note -live: 4aaa,
*note -flamegraph: 4aab, *note -heatmap: 4aac, and *note -gecko: 4aad.
formats.  It requires additional memory to store opcode information and
may slightly reduce sampling performance, but provides unprecedented
visibility into Python's execution model.


File: python.info,  Node: Real-time statistics,  Next: Subprocess profiling,  Prev: Opcode-aware profiling,  Up: Sampling configuration

5.28.5.38 Real-time statistics
..............................

The *note -realtime-stats: 4aaf. option displays sampling rate
statistics during profiling:

     python -m profiling.sampling run --realtime-stats script.py

This shows the actual achieved sampling rate, which may be lower than
requested if the profiler cannot keep up.  The statistics help verify
that profiling is working correctly and that sufficient samples are
being collected.  See *note Sampling efficiency: 4ab0. for details on
interpreting these metrics.


File: python.info,  Node: Subprocess profiling,  Next: Sampling efficiency,  Prev: Real-time statistics,  Up: Sampling configuration

5.28.5.39 Subprocess profiling
..............................

The *note -subprocesses: 4ab2. option enables automatic profiling of
subprocesses spawned by the target:

     python -m profiling.sampling run --subprocesses script.py
     python -m profiling.sampling attach --subprocesses 12345

When enabled, the profiler monitors the target process for child process
creation.  When a new Python child process is detected, a separate
profiler instance is automatically spawned to profile it.  This is
useful for applications that use *note multiprocessing: 98, *note
subprocess: df, *note concurrent.futures: 24. with *note
ProcessPoolExecutor: 211, or other process spawning mechanisms.

     from concurrent.futures import ProcessPoolExecutor
     import math

     def compute_factorial(n):
         total = 0
         for i in range(50):
             total += math.factorial(n)
         return total

     if __name__ == "__main__":
         numbers = [5000 + i * 100 for i in range(50)]
         with ProcessPoolExecutor(max_workers=4) as executor:
             results = list(executor.map(compute_factorial, numbers))
         print(f"Computed {len(results)} factorials")

LiteralBlock: worker_pool.py

     python -m profiling.sampling run --subprocesses --flamegraph worker_pool.py

This produces separate flame graphs for the main process and each worker
process: ‘flamegraph_<main_pid>.html’, ‘flamegraph_<worker1_pid>.html’,
and so on.

Each subprocess receives its own output file.  The filename is derived
from the specified output path (or the default) with the subprocess's
process ID appended:

   - If you specify ‘-o profile.html’, subprocesses produce
     ‘profile_12345.html’, ‘profile_12346.html’, and so on

   - With default output, subprocesses produce files like
     ‘flamegraph_12345.html’ or directories like ‘heatmap_12345’

   - For pstats format (which defaults to stdout), subprocesses produce
     files like ‘profile_12345.pstats’

The subprocess profilers inherit most sampling options from the parent
(sampling rate, duration, thread selection, native frames, GC frames,
async-aware mode, and output format).  All Python descendant processes
are profiled recursively, including grandchildren and further
descendants.

Subprocess detection works by periodically scanning for new descendants
of the target process and checking whether each new process is a Python
process by probing the process memory for Python runtime structures.
Non-Python subprocesses (such as shell commands or external tools) are
ignored.

There is a limit of 100 concurrent subprocess profilers to prevent
resource exhaustion in programs that spawn many processes.  If this
limit is reached, additional subprocesses are not profiled and a warning
is printed.

The *note -subprocesses: 4ab2. option is incompatible with *note -live:
4aaa. mode because live mode uses an interactive terminal interface that
cannot accommodate multiple concurrent profiler displays.


File: python.info,  Node: Sampling efficiency,  Prev: Subprocess profiling,  Up: Sampling configuration

5.28.5.40 Sampling efficiency
.............................

Sampling efficiency metrics help assess the quality of the collected
data.  These metrics appear in the profiler's terminal output and in the
flame graph sidebar.

'Sampling efficiency' is the percentage of sample attempts that
succeeded.  Each sample attempt reads the target process's call stack
from memory.  An attempt can fail if the process is in an inconsistent
state at the moment of reading, such as during a context switch or while
the interpreter is updating its internal structures.  A low efficiency
may indicate that the profiler could not keep up with the requested
sampling rate, often due to system load or an overly aggressive interval
setting.

'Missed samples' is the percentage of expected samples that were not
collected.  Based on the configured interval and duration, the profiler
expects to collect a certain number of samples.  Some samples may be
missed if the profiler falls behind schedule, for example when the
system is under heavy load.  A small percentage of missed samples is
normal and does not significantly affect the statistical accuracy of the
profile.

Both metrics are informational.  Even with some failed attempts or
missed samples, the profile remains statistically valid as long as
enough samples were collected.  The profiler reports the actual number
of samples captured, which you can use to judge whether the data is
sufficient for your analysis.


File: python.info,  Node: Profiling modes,  Next: Output formats,  Prev: Sampling configuration,  Up: profiling sampling --- Statistical profiler

5.28.5.41 Profiling modes
.........................

The sampling profiler supports four modes that control which samples are
recorded.  The mode determines what the profile measures: total elapsed
time, CPU execution time, time spent holding the global interpreter
lock, or exception handling.

* Menu:

* Wall-clock mode::
* CPU mode::
* Comparing wall-clock and CPU profiles::
* GIL mode::
* Exception mode::


File: python.info,  Node: Wall-clock mode,  Next: CPU mode,  Up: Profiling modes

5.28.5.42 Wall-clock mode
.........................

Wall-clock mode (*note -mode: 4ab6.‘=wall’) captures all samples
regardless of what the thread is doing.  This is the default mode and
provides a complete picture of where time passes during program
execution:

     python -m profiling.sampling run --mode=wall script.py

In wall-clock mode, samples are recorded whether the thread is actively
executing Python code, waiting for I/O, blocked on a lock, or sleeping.
This makes wall-clock profiling ideal for understanding the overall time
distribution in your program, including time spent waiting.

If your program spends significant time in I/O operations, network
calls, or sleep, wall-clock mode will show these waits as time
attributed to the calling function.  This is often exactly what you want
when optimizing end-to-end latency.


File: python.info,  Node: CPU mode,  Next: Comparing wall-clock and CPU profiles,  Prev: Wall-clock mode,  Up: Profiling modes

5.28.5.43 CPU mode
..................

CPU mode (*note -mode: 4ab6.‘=cpu’) records samples only when the thread
is actually executing on a CPU core:

     python -m profiling.sampling run --mode=cpu script.py

Samples taken while the thread is sleeping, blocked on I/O, or waiting
for a lock are discarded.  The resulting profile shows where CPU cycles
are consumed, filtering out idle time.

CPU mode is useful when you want to focus on computational hotspots
without being distracted by I/O waits.  If your program alternates
between computation and network calls, CPU mode reveals which
computational sections are most expensive.


File: python.info,  Node: Comparing wall-clock and CPU profiles,  Next: GIL mode,  Prev: CPU mode,  Up: Profiling modes

5.28.5.44 Comparing wall-clock and CPU profiles
...............................................

Running both wall-clock and CPU mode profiles can reveal whether a
function's time is spent computing or waiting.

If a function appears prominently in both profiles, it is a true
computational hotspot--actively using the CPU. Optimization should focus
on algorithmic improvements or more efficient code.

If a function is high in wall-clock mode but low or absent in CPU mode,
it is I/O-bound or waiting.  The function spends most of its time
waiting for network, disk, locks, or sleep.  CPU optimization won't help
here; consider async I/O, connection pooling, or reducing wait time
instead.

     import time

     def do_sleep():
         time.sleep(2)

     def do_compute():
         sum(i**2 for i in range(1000000))

     if __name__ == "__main__":
         do_sleep()
         do_compute()

     python -m profiling.sampling run --mode=wall script.py  # do_sleep ~98%, do_compute ~1%
     python -m profiling.sampling run --mode=cpu script.py   # do_sleep absent, do_compute dominates


File: python.info,  Node: GIL mode,  Next: Exception mode,  Prev: Comparing wall-clock and CPU profiles,  Up: Profiling modes

5.28.5.45 GIL mode
..................

GIL mode (*note -mode: 4ab6.‘=gil’) records samples only when the thread
holds Python's global interpreter lock:

     python -m profiling.sampling run --mode=gil script.py

The GIL is held only while executing Python bytecode.  When Python calls
into C extensions, performs I/O operations, or executes native code, the
GIL is typically released.  This means GIL mode effectively measures
time spent running Python code specifically, filtering out time in
native libraries.

In multi-threaded programs, GIL mode reveals which code is preventing
other threads from running Python bytecode.  Since only one thread can
hold the GIL at a time, functions that appear frequently in GIL mode
profiles are monopolizing the interpreter.

GIL mode helps answer questions like "which functions are monopolizing
the GIL?" and "why are my other threads starving?"  It can also be
useful in single-threaded programs to distinguish Python execution time
from time spent in C extensions or I/O.

     import hashlib

     def hash_work():
         # C extension - releases GIL during computation
         for _ in range(200):
             hashlib.sha256(b"data" * 250000).hexdigest()

     def python_work():
         # Pure Python - holds GIL during computation
         for _ in range(3):
             sum(i**2 for i in range(1000000))

     if __name__ == "__main__":
         hash_work()
         python_work()

     python -m profiling.sampling run --mode=cpu script.py  # hash_work ~42%, python_work ~38%
     python -m profiling.sampling run --mode=gil script.py  # hash_work ~5%, python_work ~60%


File: python.info,  Node: Exception mode,  Prev: GIL mode,  Up: Profiling modes

5.28.5.46 Exception mode
........................

Exception mode (‘--mode=exception’) records samples only when a thread
has an active exception:

     python -m profiling.sampling run --mode=exception script.py

Samples are recorded in two situations: when an exception is being
propagated up the call stack (after ‘raise’ but before being caught), or
when code is executing inside an ‘except’ block where exception
information is still present in the thread state.

The following example illustrates which code regions are captured:

     def example():
         try:
             raise ValueError("error")    # Captured: exception being raised
         except ValueError:
             process_error()              # Captured: inside except block
         finally:
             cleanup()                    # NOT captured: exception already handled

     def example_propagating():
         try:
             try:
                 raise ValueError("error")
             finally:
                 cleanup()                # Captured: exception propagating through
         except ValueError:
             pass

     def example_no_exception():
         try:
             do_work()
         finally:
             cleanup()                    # NOT captured: no exception involved

Note that ‘finally’ blocks are only captured when an exception is
actively propagating through them.  Once an ‘except’ block finishes
executing, Python clears the exception information before running any
subsequent ‘finally’ block.  Similarly, ‘finally’ blocks that run during
normal execution (when no exception was raised) are not captured because
no exception state is present.

This mode is useful for understanding where your program spends time
handling errors.  Exception handling can be a significant source of
overhead in code that uses exceptions for flow control (such as
‘StopIteration’ in iterators) or in applications that process many error
conditions (such as network servers handling connection failures).

Exception mode helps answer questions like "how much time is spent
handling exceptions?"  and "which exception handlers are the most
expensive?"  It can reveal hidden performance costs in code that catches
and processes many exceptions, even when those exceptions are handled
gracefully.  For example, if a parsing library uses exceptions
internally to signal format errors, this mode will capture time spent in
those handlers even if the calling code never sees the exceptions.


File: python.info,  Node: Output formats,  Next: Record and replay workflow,  Prev: Profiling modes,  Up: profiling sampling --- Statistical profiler

5.28.5.47 Output formats
........................

The profiler produces output in several formats, each suited to
different analysis workflows.  The format is selected with a
command-line flag, and output goes to stdout, a file, or a directory
depending on the format.

* Menu:

* pstats format::
* Collapsed stacks format::
* Flame graph format::
* Gecko format::
* Heatmap format::
* Binary format::


File: python.info,  Node: pstats format,  Next: Collapsed stacks format,  Up: Output formats

5.28.5.48 pstats format
.......................

The pstats format (*note -pstats: 4abd.) produces a text table similar
to what deterministic profilers generate.  This is the default output
format:

     python -m profiling.sampling run script.py
     python -m profiling.sampling run --pstats script.py

[image src="python-figures/tachyon-pstats.png" alt="Tachyon pstats terminal output"]


Figure: The pstats format displays profiling results in a color-coded
table showing function hotspots, sample counts, and timing estimates.

Output appears on stdout by default:

     Profile Stats (Mode: wall):
          nsamples  sample%    tottime (ms)  cumul%   cumtime (ms)  filename:lineno(function)
            234/892    11.7%       234.00     44.6%       892.00    server.py:145(handle_request)
            156/156     7.8%       156.00      7.8%       156.00    <built-in>:0(socket.recv)
             98/421     4.9%        98.00     21.1%       421.00    parser.py:67(parse_message)

The columns show sampling counts and estimated times:

   - 'nsamples': Displayed as ‘direct/cumulative’ (for example,
     ‘10/50’).  Direct samples are when the function was at the top of
     the stack, actively executing.  Cumulative samples are when the
     function appeared anywhere on the stack, including when it was
     waiting for functions it called.  If a function shows ‘10/50’, it
     was directly executing in 10 samples and was on the call stack in
     50 samples total.

   - 'sample%' and 'cumul%': Percentages of total samples for direct and
     cumulative counts respectively.

   - 'tottime' and 'cumtime': Estimated wall-clock time based on sample
     counts and the profiling duration.  Time units are selected
     automatically based on the magnitude: seconds for large values,
     milliseconds for moderate values, or microseconds for small values.

The output includes a legend explaining each column and a summary of
interesting functions that highlights:

   - 'Hot spots': Functions with high direct/cumulative sample ratio
     (ratio close to 1.0).  These functions spend most of their time
     executing their own code rather than waiting for callees.  High
     ratios indicate where CPU time is actually consumed.

   - 'Indirect calls': Functions with large differences between
     cumulative and direct samples.  These are orchestration functions
     that delegate work to other functions.  They appear frequently on
     the stack but rarely at the top.

   - 'Call magnification': Functions where cumulative samples far exceed
     direct samples (high cumulative/direct multiplier).  These are
     frequently-nested functions that appear deep in many call chains.

Use *note -no-summary: 4abe. to suppress both the legend and summary
sections.

To save pstats output to a binary file instead of stdout:

     python -m profiling.sampling run -o profile.pstats script.py

The pstats format supports several options for controlling the display.
The *note -sort: 4abf. option determines the column used for ordering
results:

     python -m profiling.sampling run --sort=tottime script.py
     python -m profiling.sampling run --sort=cumtime script.py
     python -m profiling.sampling run --sort=nsamples script.py

The *note -limit: 4ac0. option restricts output to the top N entries:

     python -m profiling.sampling run --limit=30 script.py

The *note -no-summary: 4abe. option suppresses the header summary that
precedes the statistics table.


File: python.info,  Node: Collapsed stacks format,  Next: Flame graph format,  Prev: pstats format,  Up: Output formats

5.28.5.49 Collapsed stacks format
.................................

Collapsed stacks format (*note -collapsed: 4ac2.) produces one line per
unique call stack, with a count of how many times that stack was
sampled:

     python -m profiling.sampling run --collapsed script.py

The output looks like:

     main;process_data;parse_json;decode_utf8 42
     main;process_data;parse_json 156
     main;handle_request;send_response 89

Each line contains semicolon-separated function names representing the
call stack from bottom to top, followed by a space and the sample count.
This format is designed for compatibility with external flame graph
tools, particularly Brendan Gregg's ‘flamegraph.pl’ script.

To generate a flame graph from collapsed stacks:

     python -m profiling.sampling run --collapsed script.py > stacks.txt
     flamegraph.pl stacks.txt > profile.svg

The resulting SVG can be viewed in any web browser and provides an
interactive visualization where you can click to zoom into specific call
paths.


File: python.info,  Node: Flame graph format,  Next: Gecko format,  Prev: Collapsed stacks format,  Up: Output formats

5.28.5.50 Flame graph format
............................

Flame graph format (*note -flamegraph: 4aab.) produces a self-contained
HTML file with an interactive flame graph visualization:

     python -m profiling.sampling run --flamegraph script.py
     python -m profiling.sampling run --flamegraph -o profile.html script.py

[image src="python-figures/tachyon-flamegraph.png" alt="Tachyon interactive flame graph"]


Figure: The flame graph visualization shows call stacks as nested
rectangles, with width proportional to time spent.  The sidebar displays
runtime statistics, GIL metrics, and hotspot functions.

If no output file is specified, the profiler generates a filename based
on the process ID (for example, ‘flamegraph.12345.html’).

The generated HTML file requires no external dependencies and can be
opened directly in a web browser.  The visualization displays call
stacks as nested rectangles, with width proportional to time spent.
Hovering over a rectangle shows details about that function including
source code context, and clicking zooms into that portion of the call
tree.

The flame graph interface includes:

   - A sidebar showing profile summary, thread statistics, sampling
     efficiency metrics (see *note Sampling efficiency: 4ab0.), and top
     hotspot functions

   - Search functionality supporting both function name matching and
     ‘file.py:42’ line patterns

   - Per-thread filtering via dropdown

   - Dark/light theme toggle (preference saved across sessions)

   - SVG export for saving the current view

The thread statistics section shows runtime behavior metrics:

   - 'GIL Held': percentage of samples where a thread held the global
     interpreter lock (actively running Python code)

   - 'GIL Released': percentage of samples where no thread held the GIL

   - 'Waiting GIL': percentage of samples where a thread was waiting to
     acquire the GIL

   - 'GC': percentage of samples during garbage collection

These statistics help identify GIL contention and understand how time is
distributed between Python execution, native code, and waiting.

Flame graphs are particularly effective for identifying deep call stacks
and understanding the hierarchical structure of time consumption.  Wide
rectangles at the top indicate functions that consume significant time
either directly or through their callees.

* Menu:

* Differential flame graphs::


File: python.info,  Node: Differential flame graphs,  Up: Flame graph format

5.28.5.51 Differential flame graphs
...................................

Differential flame graphs compare two profiling runs to highlight where
performance changed.  This helps identify regressions introduced by code
changes and validate that optimizations achieved their intended effect:

     # Capture baseline profile
     python -m profiling.sampling run --binary -o baseline.bin script.py

     # After modifying code, generate differential flamegraph
     python -m profiling.sampling run --diff-flamegraph baseline.bin -o diff.html script.py

The visualization draws the current profile with frame widths showing
current time consumption, then applies color to indicate how each
function changed relative to the baseline.

'Color coding':

   - 'Red': Functions consuming more time (regressions).  Lighter shades
     indicate modest increases, while darker shades show severe
     regressions.

   - 'Blue': Functions consuming less time (improvements).  Lighter
     shades for modest reductions, darker shades for significant
     speedups.

   - 'Gray': Minimal or no change.

   - 'Purple': New functions not present in the baseline.

Frame colors indicate changes in 'direct time' (time when the function
was at the top of the stack, actively executing), not cumulative time
including callees.  Hovering over a frame shows comparison details
including baseline time, current time, and the percentage change.

Some call paths may disappear entirely between profiles.  These are
called 'elided stacks' and occur when optimizations eliminate code paths
or certain branches stop executing.  If elided stacks are present, an
elided toggle appears allowing you to switch between the main
differential view and an elided-only view that shows just the removed
paths (colored purple).


File: python.info,  Node: Gecko format,  Next: Heatmap format,  Prev: Flame graph format,  Up: Output formats

5.28.5.52 Gecko format
......................

Gecko format (*note -gecko: 4aad.) produces JSON output compatible with
the Firefox Profiler:

     python -m profiling.sampling run --gecko script.py
     python -m profiling.sampling run --gecko -o profile.json script.py

The Firefox Profiler(1) is a sophisticated web-based tool originally
built for profiling Firefox itself.  It provides features beyond basic
flame graphs, including a timeline view, call tree exploration, and
marker visualization.  See the Firefox Profiler documentation(2) for
detailed usage instructions.

To use the output, open the Firefox Profiler in your browser and load
the JSON file.  The profiler runs entirely client-side, so your
profiling data never leaves your machine.

Gecko format automatically collects additional metadata about GIL state
and CPU activity, enabling analysis features specific to Python's
threading model.  The profiler emits interval markers that appear as
colored bands in the Firefox Profiler timeline:

   - 'GIL markers': show when threads hold or release the global
     interpreter lock

   - 'CPU markers': show when threads are executing on CPU versus idle

   - 'Code type markers': distinguish Python code from native (C
     extension) code

   - 'GC markers': indicate garbage collection activity

For this reason, the *note -mode: 4ab6. option is not available with
Gecko format; all relevant data is captured automatically.

[image src="python-figures/tachyon-gecko-calltree.png" alt="Firefox Profiler Call Tree view"]


Figure: The Call Tree view shows the complete call hierarchy with sample
counts and percentages.  The sidebar displays detailed statistics for
the selected function including running time and sample distribution.

[image src="python-figures/tachyon-gecko-flamegraph.png" alt="Firefox Profiler Flame Graph view"]


Figure: The Flame Graph visualization shows call stacks as nested
rectangles.  Functions names are visible in the call hierarchy.

[image src="python-figures/tachyon-gecko-opcodes.png" alt="Firefox Profiler Marker Chart with opcodes"]


Figure: The Marker Chart displays interval markers including CPU state,
GIL status, and opcodes.  With ‘--opcodes’ enabled, bytecode
instructions like ‘BINARY_OP_ADD_FLOAT’, ‘CALL_PY_EXACT_ARGS’, and
‘CALL_LIST_APPEND’ appear as markers showing execution over time.

   ---------- Footnotes ----------

   (1) https://profiler.firefox.com

   (2) https://profiler.firefox.com/docs/#/


File: python.info,  Node: Heatmap format,  Next: Binary format,  Prev: Gecko format,  Up: Output formats

5.28.5.53 Heatmap format
........................

Heatmap format (*note -heatmap: 4aac.) generates an interactive HTML
visualization showing sample counts at the source line level:

     python -m profiling.sampling run --heatmap script.py
     python -m profiling.sampling run --heatmap -o my_heatmap script.py

[image src="python-figures/tachyon-heatmap.png" alt="Tachyon heatmap visualization"]


Figure: The heatmap overlays sample counts directly on your source code.
Lines are color-coded from cool (few samples) to hot (many samples).
Navigation buttons (▲▼) let you jump between callers and callees.

Unlike other formats that produce a single file, heatmap output creates
a directory containing HTML files for each profiled source file.  If no
output path is specified, the directory is named ‘heatmap_PID’.

The heatmap visualization displays your source code with a color
gradient indicating how many samples were collected at each line.  Hot
lines (many samples) appear in warm colors, while cold lines (few or no
samples) appear in cool colors.  This view helps pinpoint exactly which
lines of code are responsible for time consumption.

The heatmap interface provides several interactive features:

   - 'Coloring modes': toggle between "Self Time" (direct execution) and
     "Total Time" (cumulative, including time in called functions)

   - 'Cold code filtering': show all lines or only lines with samples

   - 'Call graph navigation': each line shows navigation buttons (▲ for
     callers, ▼ for callees) that let you trace execution paths through
     your code.  When multiple functions called or were called from a
     line, a menu appears showing all options with their sample counts.

   - 'Scroll minimap': a vertical overview showing the heat distribution
     across the entire file

   - 'Hierarchical index': files organized by type (stdlib,
     site-packages, project) with aggregate sample counts per folder

   - 'Dark/light theme': toggle with preference saved across sessions

   - 'Line linking': click line numbers to create shareable URLs

When opcode-level profiling is enabled with *note -opcodes: 4aa9, each
hot line can be expanded to show which bytecode instructions consumed
time:

[image src="python-figures/tachyon-heatmap-with-opcodes.png" alt="Heatmap with expanded bytecode panel"]


Figure: Expanding a hot line reveals the bytecode instructions executed,
including specialized variants.  The panel shows sample counts per
instruction and the overall specialization percentage for the line.

Heatmaps are especially useful when you know which file contains a
performance issue but need to identify the specific lines.  Many
developers prefer this format because it maps directly to their source
code, making it easy to read and navigate.  For smaller scripts and
focused analysis, heatmaps provide an intuitive view that shows exactly
where time is spent without requiring interpretation of hierarchical
visualizations.


File: python.info,  Node: Binary format,  Prev: Heatmap format,  Up: Output formats

5.28.5.54 Binary format
.......................

Binary format (*note -binary: 4ac8.) produces a compact binary file for
efficient storage of profiling data:

     python -m profiling.sampling run --binary -o profile.bin script.py
     python -m profiling.sampling attach --binary -o profile.bin 12345

The *note -compression: 4ac9. option controls data compression:

   - ‘auto’ (default): Use zstd compression if available, otherwise no
     compression

   - ‘zstd’: Force zstd compression (requires *note compression.zstd:
     23. support)

   - ‘none’: Disable compression

     python -m profiling.sampling run --binary --compression=zstd -o profile.bin script.py

To analyze binary profiles, use the *note The replay command: 4a97. to
convert them to other formats like flame graphs or pstats output.


File: python.info,  Node: Record and replay workflow,  Next: Live mode,  Prev: Output formats,  Up: profiling sampling --- Statistical profiler

5.28.5.55 Record and replay workflow
....................................

The binary format combined with the replay command enables a
record-and-replay workflow that separates data capture from analysis.
Rather than generating visualizations during profiling, you capture raw
data to a compact binary file and convert it to different formats later.

This approach has three main benefits:

   - Sampling runs faster because the work of building data structures
     for visualization is deferred until replay.

   - A single binary capture can be converted to multiple output formats
     without re-profiling: pstats for a quick overview, flame graph for
     visual exploration, heatmap for line-level detail.

   - Binary files are compact and easy to share with colleagues who can
     convert them to their preferred format.

A typical workflow:

     # Capture profile in production or during tests
     python -m profiling.sampling attach --binary -o profile.bin 12345

     # Later, analyze with different formats
     python -m profiling.sampling replay profile.bin
     python -m profiling.sampling replay --flamegraph -o profile.html profile.bin
     python -m profiling.sampling replay --heatmap -o heatmap profile.bin


File: python.info,  Node: Live mode,  Next: Async-aware profiling,  Prev: Record and replay workflow,  Up: profiling sampling --- Statistical profiler

5.28.5.56 Live mode
...................

Live mode (*note -live: 4aaa.) provides a terminal-based real-time view
of profiling data, similar to the ‘top’ command for system processes:

     python -m profiling.sampling run --live script.py
     python -m profiling.sampling attach --live 12345

[image src="python-figures/tachyon-live-mode-2.gif" alt="Tachyon live mode showing all threads"]


Figure
Live mode displays real-time profiling statistics, showing combined data
from multiple threads in a multi-threaded application.

The display updates continuously as new samples arrive, showing the
current hottest functions.  This mode requires the *note curses: 2e.
module, which is available on Unix-like systems but not on Windows.  The
terminal must be at least 60 columns wide and 12 lines tall; larger
terminals display more columns.

The header displays the top 3 hottest functions, sampling efficiency
metrics, and thread status statistics (GIL held percentage, CPU usage,
GC time).  The main table shows function statistics with the currently
sorted column indicated by an arrow (▼).

When *note -opcodes: 4aa9. is enabled, an additional opcode panel
appears below the main table, showing instruction-level statistics for
the currently selected function.  This panel displays which bytecode
instructions are executing most frequently, including specialized
variants and their base opcodes.

[image src="python-figures/tachyon-live-mode-1.gif" alt="Tachyon live mode with opcode panel"]


Figure
Live mode with ‘--opcodes’ enabled shows an opcode panel with a bytecode
instruction breakdown for the selected function.

* Menu:

* Keyboard commands::


File: python.info,  Node: Keyboard commands,  Up: Live mode

5.28.5.57 Keyboard commands
...........................

Within live mode, keyboard commands control the display:

‘q’

     Quit the profiler and return to the shell.

‘s’ / ‘S’

     Cycle through sort orders forward/backward (sample count,
     percentage, total time, cumulative percentage, cumulative time).

‘p’

     Pause or resume display updates.  Sampling continues in the
     background while the display is paused, so you can freeze the view
     to examine results without stopping data collection.

‘r’

     Reset all statistics and start fresh.  This is disabled after
     profiling finishes to prevent accidental data loss.

‘/’

     Enter filter mode to search for functions by name.  The filter uses
     case-insensitive substring matching against the filename and
     function name.  Type a pattern and press Enter to apply, or Escape
     to cancel.  Glob patterns and regular expressions are not
     supported.

‘c’

     Clear the current filter and show all functions again.

‘t’

     Toggle between viewing all threads combined or per-thread
     statistics.  In per-thread mode, a thread counter (for example,
     ‘1/4’) appears showing your position among the available threads.

‘←’ ‘→’ or ‘↑’ ‘↓’

     In per-thread view, navigate between threads.  Navigation wraps
     around from the last thread to the first and vice versa.

‘+’ / ‘-’

     Increase or decrease the display refresh rate.  The range is 0.05
     seconds (20 Hz, very responsive) to 1.0 second (1 Hz, lower
     overhead).  Faster refresh rates use more CPU. The default is 0.1
     seconds (10 Hz).

‘x’

     Toggle trend indicators that show whether functions are becoming
     hotter or cooler over time.  When enabled, increasing metrics
     appear in green and decreasing metrics appear in red, comparing
     each update to the previous one.

‘h’ or ‘?’

     Show the help screen with all available commands.

‘j’ / ‘k’ (or ‘Up’ / ‘Down’)

     Navigate through opcode entries in the opcode panel (when
     ‘--opcodes’ is enabled).  These keys scroll through the
     instruction-level statistics for the currently selected function.

When profiling finishes (duration expires or target process exits), the
display shows a "PROFILING COMPLETE" banner and freezes the final
results.  You can still navigate, sort, and filter the results before
pressing ‘q’ to exit.

Live mode is incompatible with output format options (*note -collapsed:
4ac2, *note -flamegraph: 4aab, and so on) because it uses an interactive
terminal interface rather than producing file output.


File: python.info,  Node: Async-aware profiling,  Next: Command-line interface<2>,  Prev: Live mode,  Up: profiling sampling --- Statistical profiler

5.28.5.58 Async-aware profiling
...............................

For programs using *note asyncio: b, the profiler offers async-aware
mode (*note -async-aware: 4ace.) that reconstructs call stacks based on
the task structure rather than the raw Python frames:

     python -m profiling.sampling run --async-aware async_script.py

Standard profiling of async code can be confusing because the physical
call stack often shows event loop internals rather than the logical flow
of your coroutines.  Async-aware mode addresses this by tracking which
task is running and presenting stacks that reflect the ‘await’ chain.

     import asyncio

     async def fetch(url):
         await asyncio.sleep(0.1)
         return url

     async def main():
         for _ in range(50):
             await asyncio.gather(fetch("a"), fetch("b"), fetch("c"))

     if __name__ == "__main__":
         asyncio.run(main())

     python -m profiling.sampling run --async-aware --flamegraph -o out.html script.py

     注釈: Async-aware profiling requires the target process to have the
     *note asyncio: b. module loaded.  If you profile a script before it
     imports asyncio, async-aware mode will not be able to capture task
     information.

* Menu:

* Async modes::
* Task markers and stack reconstruction::
* Option restrictions::


File: python.info,  Node: Async modes,  Next: Task markers and stack reconstruction,  Up: Async-aware profiling

5.28.5.59 Async modes
.....................

The *note -async-mode: 4ad0. option controls which tasks appear in the
profile:

     python -m profiling.sampling run --async-aware --async-mode=running async_script.py
     python -m profiling.sampling run --async-aware --async-mode=all async_script.py

With *note -async-mode: 4ad0.‘=running’ (the default), only the task
currently executing on the CPU is profiled.  This shows where your
program is actively spending time and is the typical choice for
performance analysis.

With *note -async-mode: 4ad0.‘=all’, tasks that are suspended (awaiting
I/O, locks, or other tasks) are also included.  This mode is useful for
understanding what your program is waiting on, but produces larger
profiles since every suspended task appears in each sample.


File: python.info,  Node: Task markers and stack reconstruction,  Next: Option restrictions,  Prev: Async modes,  Up: Async-aware profiling

5.28.5.60 Task markers and stack reconstruction
...............................................

In async-aware profiles, you will see ‘<task>’ frames that mark
boundaries between asyncio tasks.  These are synthetic frames inserted
by the profiler to show the task structure.  The task name appears as
the function name in these frames.

When a task awaits another task, the profiler reconstructs the logical
call chain by following the ‘await’ relationships.  Only "leaf" tasks
(tasks that no other task is currently awaiting) generate their own
stack entries.  Tasks being awaited by other tasks appear as part of
their awaiter's stack instead.

If a task has multiple awaiters (a diamond pattern in the task graph),
the profiler deterministically selects one parent and annotates the task
marker with the number of parents, for example ‘MyTask (2 parents)’.
This indicates that alternate execution paths exist but are not shown in
this particular stack.


File: python.info,  Node: Option restrictions,  Prev: Task markers and stack reconstruction,  Up: Async-aware profiling

5.28.5.61 Option restrictions
.............................

Async-aware mode uses a different stack reconstruction mechanism and is
incompatible with: *note -native: 4aa6, *note -no-gc: 4aa7, *note
-all-threads: 4aa1, and *note -mode: 4ab6.‘=cpu’ or ‘--mode’‘=gil’.


File: python.info,  Node: Command-line interface<2>,  Prev: Async-aware profiling,  Up: profiling sampling --- Statistical profiler

5.28.5.62 Command-line interface
................................

The complete command-line interface for reference.

* Menu:

* Global options::
* Dump options::
* Sampling options::
* Mode options::
* Output options::
* pstats display options::
* Run command options::


File: python.info,  Node: Global options,  Next: Dump options,  Up: Command-line interface<2>

5.28.5.63 Global options
........................

 -- Option: run

     Run and profile a Python script or module.

 -- Option: attach

     Attach to and profile a running process by PID.

 -- Option: dump

     Print a single one-shot snapshot of a running process's Python
     stack.

 -- Option: replay

     Convert a binary profile file to another output format.


File: python.info,  Node: Dump options,  Next: Sampling options,  Prev: Global options,  Up: Command-line interface<2>

5.28.5.64 Dump options
......................

The following options apply to the ‘dump’ subcommand:

 -- Option: -a, --all-threads

     Dump all threads in the target process instead of just the main
     thread.

 -- Option: --native

     Include ‘<native>’ frames for non-Python code.

 -- Option: --no-gc

     Exclude ‘<GC>’ frames for active garbage collection.

 -- Option: --opcodes

     Show bytecode opcode names when available.

 -- Option: --async-aware

     Reconstruct the stack across ‘await’ boundaries for asyncio
     applications.

 -- Option: --async-mode <mode>

     Async stack mode: ‘running’ (only the running task) or ‘all’ (all
     tasks including waiting).  Defaults to ‘all’ for ‘dump’.  Requires
     *note -async-aware: 4ace.

 -- Option: --blocking

     Pause all threads in the target process while reading the stack.


File: python.info,  Node: Sampling options,  Next: Mode options,  Prev: Dump options,  Up: Command-line interface<2>

5.28.5.65 Sampling options
..........................

 -- Option: -r <rate>, --sampling-rate <rate>

     Sampling rate (for example, ‘10000’, ‘10khz’, ‘10k’).  Default:
     ‘1khz’.

 -- Option: -d <seconds>, --duration <seconds>

     Profiling duration in seconds.  Default: run to completion.

 -- Option: -a, --all-threads

     Sample all threads, not just the main thread.

 -- Option: --realtime-stats

     Display sampling statistics during profiling.

 -- Option: --native

     Include ‘<native>’ frames for non-Python code.

 -- Option: --no-gc

     Exclude ‘<GC>’ frames for garbage collection.

 -- Option: --async-aware

     Enable async-aware profiling for asyncio programs.

 -- Option: --opcodes

     Gather bytecode opcode information for instruction-level profiling.
     Shows which bytecode instructions are executing, including
     specializations.  Compatible with ‘--live’, ‘--flamegraph’,
     ‘--heatmap’, and ‘--gecko’ formats only.

 -- Option: --subprocesses

     Also profile subprocesses.  Each subprocess gets its own profiler
     instance and output file.  Incompatible with ‘--live’.

 -- Option: --blocking

     Pause the target process during each sample.  This ensures
     consistent stack traces at the cost of slowing down the target.
     Use with longer intervals (1000 µs or higher) to minimize impact.
     See *note Blocking mode: 4aa2. for details.


File: python.info,  Node: Mode options,  Next: Output options,  Prev: Sampling options,  Up: Command-line interface<2>

5.28.5.66 Mode options
......................

 -- Option: --mode <mode>

     Sampling mode: ‘wall’ (default), ‘cpu’, ‘gil’, or ‘exception’.  The
     ‘cpu’, ‘gil’, and ‘exception’ modes are incompatible with
     ‘--async-aware’.

 -- Option: --async-mode <mode>

     Async profiling mode: ‘running’ (default) or ‘all’.  Requires
     ‘--async-aware’.


File: python.info,  Node: Output options,  Next: pstats display options,  Prev: Mode options,  Up: Command-line interface<2>

5.28.5.67 Output options
........................

 -- Option: --pstats

     Generate pstats statistics.  This is the default.  When written to
     stdout, the output is a text table; with *note -o: 4ae8, it is a
     binary pstats file.

 -- Option: --collapsed

     Generate collapsed stack format for external flame graph tools.

 -- Option: --flamegraph

     Generate self-contained HTML flame graph.

 -- Option: --diff-flamegraph <baseline.bin>

     Generate differential flamegraph comparing to a baseline binary
     profile.

 -- Option: --gecko

     Generate Gecko JSON format for Firefox Profiler.

 -- Option: --heatmap

     Generate HTML heatmap with line-level sample counts.

 -- Option: --binary

     Generate high-performance binary format for later conversion with
     the ‘replay’ command.

 -- Option: --compression <type>

     Compression for binary format: ‘auto’ (use zstd if available,
     default), ‘zstd’, or ‘none’.

 -- Option: -o <path>, --output <path>

     Output file or directory path.  Default behavior varies by format:
     *note -pstats: 4abd. prints a text table to stdout, while ‘-o’
     writes a binary pstats file.  Other formats generate a file named
     ‘<format>_<PID>.<ext>’ (for example, ‘flamegraph_12345.html’).
     *note -heatmap: 4aac. creates a directory named ‘heatmap_<PID>’.

 -- Option: --browser

     Automatically open HTML output (*note -flamegraph: 4aab. and *note
     -heatmap: 4aac.) in your default web browser after generation.
     When profiling with *note -subprocesses: 4ab2, only the main
     process opens the browser; subprocess outputs are never
     auto-opened.


File: python.info,  Node: pstats display options,  Next: Run command options,  Prev: Output options,  Up: Command-line interface<2>

5.28.5.68 pstats display options
................................

These options apply only to pstats format output.

 -- Option: --sort <key>

     Sort order: ‘nsamples’, ‘tottime’, ‘cumtime’, ‘sample-pct’,
     ‘cumul-pct’, ‘nsamples-cumul’, or ‘name’.  Default: ‘nsamples’.

 -- Option: -l <count>, --limit <count>

     Maximum number of entries to display.  Default: 15.

 -- Option: --no-summary

     Omit the Legend and Summary of Interesting Functions sections from
     output.


File: python.info,  Node: Run command options,  Prev: pstats display options,  Up: Command-line interface<2>

5.28.5.69 Run command options
.............................

 -- Option: -m, --module

     Treat the target as a module name rather than a script path.

 -- Option: --live

     Start interactive terminal interface instead of batch profiling.

参考
....

*note profiling: b5.

     Overview of Python profiling tools and guidance on choosing a
     profiler.

*note profiling.tracing: b7.

     Deterministic tracing profiler for exact call counts and timing.

*note pstats: b8.

     Statistics analysis for profile data.

Firefox Profiler(1)

     Web-based profiler that accepts Gecko format output.  See the
     documentation(2) for usage details.

FlameGraph(3)

     Tools for generating flame graphs from collapsed stack format.

   ---------- Footnotes ----------

   (1) https://profiler.firefox.com

   (2) https://profiler.firefox.com/docs/#/

   (3) https://github.com/brendangregg/FlameGraph


File: python.info,  Node: pstats --- Statistics for profilers,  Next: timeit --- 小さなコードスニペットの実行時間計測,  Prev: profiling --- Python profilers,  Up: Debugging and profiling

5.28.6 ‘pstats’ -- Statistics for profilers
-------------------------------------------

'Source code:' Lib/pstats.py(1)

__________________________________________________________________

The ‘pstats’ module provides tools for reading, manipulating, and
displaying profiling statistics generated by Python's profilers.  It
reads output from both *note profiling.tracing: b7. (deterministic
profiler) and *note profiling.sampling: b6. (statistical profiler).

* Menu:

* Reading and displaying profile data::
* The Stats class::
* Command-line interface: Command-line interface<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/pstats.py


File: python.info,  Node: Reading and displaying profile data,  Next: The Stats class,  Up: pstats --- Statistics for profilers

5.28.6.1 Reading and displaying profile data
............................................

The *note Stats: 4a7d. class is the primary interface for working with
profile data.  It can read statistics from files or directly from a
*note Profile: 4a7f. object.

Load statistics from a file and print a basic report:

     import pstats

     p = pstats.Stats('profile_output.prof')
     p.print_stats()

The *note Stats: 4a7d. object provides methods for sorting and filtering
the data before printing.  For example, to see the ten functions with
the highest cumulative time:

     from pstats import SortKey

     p = pstats.Stats('profile_output.prof')
     p.sort_stats(SortKey.CUMULATIVE).print_stats(10)

* Menu:

* Working with statistics::
* Filtering output::
* Analyzing call relationships::
* Combining multiple profiles::


File: python.info,  Node: Working with statistics,  Next: Filtering output,  Up: Reading and displaying profile data

5.28.6.2 Working with statistics
................................

The *note Stats: 4a7d. class supports method chaining, making it
convenient to perform multiple operations:

     p = pstats.Stats('restats')
     p.strip_dirs().sort_stats(-1).print_stats()

The *note strip_dirs(): 4af7. method removes directory paths from
filenames, making the output more compact.  The *note sort_stats():
4a76. method accepts various keys to control the sort order.

Different sort keys highlight different aspects of performance:

     from pstats import SortKey

     # Functions that consume the most cumulative time
     p.sort_stats(SortKey.CUMULATIVE).print_stats(10)

     # Functions that consume the most time in their own code
     p.sort_stats(SortKey.TIME).print_stats(10)

     # Functions sorted by name
     p.sort_stats(SortKey.NAME).print_stats()


File: python.info,  Node: Filtering output,  Next: Analyzing call relationships,  Prev: Working with statistics,  Up: Reading and displaying profile data

5.28.6.3 Filtering output
.........................

The *note print_stats(): 4af9. method accepts restrictions that filter
which functions are displayed.  Restrictions can be integers (limiting
the count), floats between 0 and 1 (selecting a percentage), or strings
(matching function names via regular expression).

Print only the top 10%:

     p.print_stats(.1)

Print only functions whose names contain "init":

     p.print_stats('init')

Combine restrictions (they apply sequentially):

     # Top 10%, then only those containing "init"
     p.print_stats(.1, 'init')

     # Functions in files matching "foo:", limited to top 50%
     p.sort_stats(SortKey.FILENAME).print_stats('foo:', .5)


File: python.info,  Node: Analyzing call relationships,  Next: Combining multiple profiles,  Prev: Filtering output,  Up: Reading and displaying profile data

5.28.6.4 Analyzing call relationships
.....................................

The *note print_callers(): 4a6a. method shows which functions called
each displayed function:

     p.print_callers()

The *note print_callees(): 4a6b. method shows the opposite relationship,
listing which functions each displayed function called:

     p.print_callees()

Both methods accept the same restriction arguments as *note
print_stats(): 4af9.


File: python.info,  Node: Combining multiple profiles,  Prev: Analyzing call relationships,  Up: Reading and displaying profile data

5.28.6.5 Combining multiple profiles
....................................

Statistics from multiple profiling runs can be combined into a single
*note Stats: 4a7d. object:

     # Load multiple files at once
     p = pstats.Stats('run1.prof', 'run2.prof', 'run3.prof')

     # Or add files incrementally
     p = pstats.Stats('run1.prof')
     p.add('run2.prof')
     p.add('run3.prof')

When files are combined, statistics for identical functions (same file,
line, and name) are accumulated, giving an aggregate view across all
profiling runs.


File: python.info,  Node: The Stats class,  Next: Command-line interface<3>,  Prev: Reading and displaying profile data,  Up: pstats --- Statistics for profilers

5.28.6.6 The ‘Stats’ class
..........................

 -- クラス: pstats.Stats (*filenames_or_profile, stream=sys.stdout)

     Create a statistics object from profile data.

     The arguments can be filenames (strings or path-like objects) or
     *note Profile: 4a7f. objects.  If multiple sources are provided,
     their statistics are combined.

     The 'stream' argument specifies where output from *note
     print_stats(): 4af9. and related methods is written.  It defaults
     to *note sys.stdout: ea0.

     The profile data format is specific to the Python version that
     created it.  There is no compatibility guarantee between Python
     versions or between different profilers.

      -- メソッド: strip_dirs ()

          Remove leading path information from all filenames.

          This method modifies the object in place and returns it for
          method chaining.  After stripping, the statistics are
          considered to be in random order.

          If stripping causes two functions to become indistinguishable
          (same filename, line number, and function name), their
          statistics are combined into a single entry.

      -- メソッド: add (*filenames)

          Add profiling data from additional files.

          The files must have been created by the same profiler type.
          Statistics for identical functions are accumulated.

      -- メソッド: dump_stats (filename)

          Save the current statistics to a file.

          The file is created if it does not exist and overwritten if it
          does.  The saved data can be loaded by creating a new ‘Stats’
          object.

      -- メソッド: sort_stats (*keys)

          Sort the statistics according to the specified criteria.

          Each key can be a string or a *note SortKey: 4aff. enum
          member.  When multiple keys are provided, later keys break
          ties in earlier keys.

          Using *note SortKey: 4aff. enum members is preferred over
          strings as it provides better error checking:

               from pstats import SortKey
               p.sort_stats(SortKey.CUMULATIVE)

          Valid sort keys:

          String                 Enum                         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
                                                              

          All sorts on statistics are in descending order (most time
          consuming first), while name, file, and line number sorts are
          ascending (alphabetical).

          The difference between ‘SortKey.NFL’ and ‘SortKey.STDNAME’ is
          that NFL sorts line numbers numerically while STDNAME sorts
          them as strings.  ‘sort_stats(SortKey.NFL)’ is equivalent to
          ‘sort_stats(SortKey.NAME, SortKey.FILENAME, SortKey.LINE)’.

          For backward compatibility, the numeric arguments ‘-1’, ‘0’,
          ‘1’, and ‘2’ are also accepted, meaning ‘'stdname'’,
          ‘'calls'’, ‘'time'’, and ‘'cumulative'’ respectively.

          Added in version 3.7: The *note SortKey: 4aff. enum.

      -- メソッド: reverse_order ()

          Reverse the current sort order.

          By default, the sort direction is chosen appropriately for the
          sort key (descending for time-based keys, ascending for
          name-based keys).  This method inverts that choice.

      -- メソッド: print_stats (*restrictions)

          Print a report of the profiling statistics.

          The output includes a header line summarizing the data,
          followed by a table of function statistics sorted according to
          the last *note sort_stats(): 4a76. call.

          Restrictions filter the output.  Each restriction is either:

             - An integer: limits output to that many entries

             - A float between 0.0 and 1.0: selects that fraction of
               entries

             - A string: matches function names via regular expression

          Restrictions are applied sequentially.  For example:

               print_stats(.1, 'foo:')

          First limits to the top 10%, then filters to functions
          matching 'foo:'.

      -- メソッド: print_callers (*restrictions)

          Print the callers of each function in the statistics.

          For each function in the filtered results, shows which
          functions called it and how often.

          With *note profiling.tracing: b7. (or ‘cProfile’), each caller
          line shows three numbers: the number of calls from that
          caller, and the total and cumulative times for those specific
          calls.

          Accepts the same restriction arguments as *note print_stats():
          4af9.

      -- メソッド: print_callees (*restrictions)

          Print the functions called by each function in the statistics.

          This is the inverse of *note print_callers(): 4a6a, showing
          which functions each listed function called.

          Accepts the same restriction arguments as *note print_stats():
          4af9.

      -- メソッド: get_stats_profile ()

          Return a ‘StatsProfile’ object containing the statistics.

          The returned object provides programmatic access to the
          profile data, with function names mapped to ‘FunctionProfile’
          objects containing timing and call count information.

          Added in version 3.9.

 -- クラス: pstats.SortKey

     An enumeration of valid sort keys for *note Stats.sort_stats():
     4a76.

      -- の属性: CALLS

          Sort by call count.

      -- の属性: CUMULATIVE

          Sort by cumulative time.

      -- の属性: FILENAME

          Sort by file name.

      -- の属性: LINE

          Sort by line number.

      -- の属性: NAME

          Sort by function name.

      -- の属性: NFL

          Sort by name, then file, then line number (numeric line sort).

      -- の属性: PCALLS

          Sort by primitive (non-recursive) call count.

      -- の属性: STDNAME

          Sort by standard name (string-based line sort).

      -- の属性: TIME

          Sort by internal time (time in function excluding subcalls).


File: python.info,  Node: Command-line interface<3>,  Prev: The Stats class,  Up: pstats --- Statistics for profilers

5.28.6.7 Command-line interface
...............................

The ‘pstats’ module can be invoked as a script to interactively browse
profile data:

     python -m pstats profile_output.prof

This opens a line-oriented interface (built on *note cmd: 1a.) for
examining the statistics.  Type ‘help’ at the prompt for available
commands.

参考
....

*note profiling: b5.

     Overview of Python profiling tools.

*note profiling.tracing: b7.

     Deterministic tracing profiler.

*note profiling.sampling: b6.

     Statistical sampling profiler.


File: python.info,  Node: timeit --- 小さなコードスニペットの実行時間計測,  Next: trace --- Python 文実行のトレースと追跡,  Prev: pstats --- Statistics for profilers,  Up: Debugging and profiling

5.28.7 ‘timeit’ -- 小さなコードスニペットの実行時間計測
-------------------------------------------------------

'ソースコード:' Lib/timeit.py(1)

__________________________________________________________________

このモジュールは小さい Python コードをの時間を計測するシンプルな手段を提
供しています。*note コマンドライン・インターフェース: 4b10. の他 *note
呼び出しも可能: 4b11. です。このモジュールは実行時間を計測するときに共通
するいくつかの罠を回避します。O'Reilly 出版の 'Python Cookbook' 第2版に
ある、Tim Peter による "Algorithms" 章も参照してください。

* Menu:

* Basic examples::
* Python interface::
* コマンドライン・インターフェース: コマンドライン・インターフェース<9>.
* 使用例: 使用例<44>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/timeit.py


File: python.info,  Node: Basic examples,  Next: Python interface,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.28.7.1 Basic examples
.......................

次の例は *note コマンドライン・インターフェース: 4b10. を使って 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: 4b11. を使って実現することもできます:

     >>> 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: 4b11. から渡すことも
できます:

     >>> timeit.timeit(lambda: "-".join(map(str, range(100))), number=10000)
     0.19665591977536678

ただし、*note timeit(): 1232. はコマンドラインインターフェイスを使った時
だけ繰り返し回数を自動で決定する事に注意してください。*note 使用例:
4b13. 節でより高度な例を説明しています。


File: python.info,  Node: Python interface,  Next: コマンドライン・インターフェース<9>,  Prev: Basic examples,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.28.7.2 Python interface
.........................

このモジュールは 3 つの有用な関数と 1 つの公開クラスを持っています:

 -- の関数: timeit.timeit (stmt='pass', setup='pass', timer=<default
          timer>, number=1000000, globals=None)

     与えられた文、'setup' コードおよび 'timer' 関数で *note Timer:
     1880. インスタンスを作成し、その *note timeit(): 10ad. メソッドを
     'number' 回実行します。 任意の 'globals' 引数はコードを実行する名前
     空間を指定します。

     バージョン 3.5 で変更: 任意の 'globals' 引数が追加されました。

 -- の関数: timeit.repeat (stmt='pass', setup='pass', timer=<default
          timer>, repeat=5, number=1000000, globals=None)

     与えられた文、'setup' コードおよび 'timer' 関数で *note Timer:
     1880. インスタンスを作成し、その *note repeat(): 4b16. メソッドを
     '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(): e4d. になりました。

 -- クラス: timeit.Timer (stmt='pass', setup='pass', timer=<timer
          function>, globals=None)

     小さなコード片の実行時間を計測するためのクラスです。

     コンストラクターは計測する文、セットアップのための追加の文、ならび
     にタイマー関数を取ります。 両文のデフォルトは ‘'pass'’ です。 タイ
     マー関数はプラットフォーム依存です (モジュールの doctring を参照)。
     'stmt' および 'setup' には、複数行の文字列リテラルを含まない限り、
     ‘;’ や改行で区切られた複数の文でも構いません。 デフォルトでは文は
     timeit の名前空間内で実行されます。 この挙動は名前空間を 'globals'
     に渡すことで制御出来ます。

     最初の命令文の実行時間を計測するには、*note timeit(): 10ad. メソッ
     ドを使用します。*note repeat(): 4b16. と *note autorange(): 28e. メ
     ソッドは ‘timeit()’ を複数回呼び出したい時に使用します。

     'setup' の実行時間は全実行時間から除外されています。

     'stmt' および 'setup' パラメータは、引数なしの呼び出し可能オブジェ
     クトをとることもできます。呼び出し可能オブジェクトを指定すると、そ
     のオブジェクトの呼び出しがタイマー関数に埋め込まれ、その関数が
     *note timeit(): 10ad. メソッドによって実行されます。この場合、関数
     呼び出しが増えるためにタイミングのオーバーヘッドが少し増える点に注
     意してください。

     バージョン 3.5 で変更: 任意の 'globals' 引数が追加されました。

      -- メソッド: timeit (number=1000000)

          メイン文を 'number' 回実行した時間を計測します。このメソッドは
          セットアップ文を1回だけ実行し、メイン文を指定回数実行するのに
          かかった時間を返します。デフォルトのタイマーは秒数を浮動小数点
          数で返します。引数はループを何回実行するかの指定で、デフォルト
          値は 100万回です。メイン文、セットアップ文、タイマー関数はコン
          ストラクターで指定されたものを使用します。

               注釈: デフォルトでは、*note timeit(): 10ad. は計測中、一
               時的に *note ガベージコレクション: 19fe. を停止します。 こ
               の手法の利点は個々の計測結果がより比較しやすくなることで
               す。 欠点は、ガベージコレクションが計測される関数の性能の
               重要な要素である場合があることです。 その場合、'setup' 文
               字列の最初の文でガベージコレクションを有効にできます。 以
               下に例を示します:

                    timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()

      -- メソッド: autorange (callback=None, target_time=None)

          *note timeit(): 10ad. を呼び出す回数を自動的に決定します。

          This is a convenience function that calls *note timeit():
          10ad. repeatedly so that the total time >= 'Timer.target_time'
          seconds, 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 'target_time' seconds.

          'callback' が与えられ、Noneでない場合は、 callback(number,
          time_taken) という2つの引数を指定して試行された後に呼び出され
          ます。

          Added in version 3.6.

          バージョン 3.15 で変更: The optional 'target_time' parameter
          was added.

      -- メソッド: repeat (repeat=5, number=1000000)

          *note timeit(): 10ad. を複数回繰り返します。

          これは *note timeit(): 10ad. を繰り返し呼び出したい時に有用で
          、結果をリストにして返します。最初の引数で何回 ‘timeit()’ を呼
          ぶか指定します。第 2 引数で ‘timeit()’ の引数 'number' を指定
          します。

               注釈: 結果のベクトルから平均値や標準偏差を計算して出力さ
               せたいと思うかもしれませんが、それはあまり意味がありませ
               ん。多くの場合、最も低い値がそのマシンが与えられたコード
               断片を実行する場合の下限値です。結果のうち高めの値は、
               Python のスピードが一定しないために生じたものではなく、そ
               の他の計測精度に影響を及ぼすプロセスによるものです。した
               がって、結果のうち *note min(): 12bc. だけが見るべき値と
               なるでしょう。この点を押さえた上で、統計的な分析よりも常
               識的な判断で結果を見るようにしてください。

          バージョン 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: d09. になります。


File: python.info,  Node: コマンドライン・インターフェース<9>,  Next: 使用例<44>,  Prev: Python interface,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.28.7.3 コマンドライン・インターフェース
.........................................

コマンドラインからプログラムとして呼び出す場合は、次の書式を使います:

     python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...]

以下のオプションが使用できます:

 -- Option: -n N, --number=N

     'statement' を実行する回数

 -- Option: -r N, --repeat=N

     timer を繰り返す回数（デフォルトは5）

 -- Option: -s S, --setup=S

     最初に1回だけ実行する文 (デフォルトは ‘pass’)

 -- Option: -p, --process

     デフォルトの *note time.perf_counter(): e4d. の代わり *note
     time.process_time(): e4e. を利用して、実時間ではなくプロセス時間を
     計測します

     Added in version 3.3.

 -- Option: -u, --unit=U

     timer 出力の時間の単位を指定します。 ‘nsec’、‘usec’、‘msec’、‘sec’
     を選択できます。

     Added in version 3.5.

 -- Option: -t, --target-time=T

     if *note -number: 4b1a. is 0, the code will run until it takes at
     least this many seconds (default: 0.2)

     Added in version 3.15.

 -- Option: -v, --verbose

     時間計測の結果をそのまま詳細な数値でくり返し表示する

 -- Option: -h, --help

     簡単な使い方を表示して終了する

文は複数行指定することもできます。その場合、各行は独立した文として引数に
指定されたものとして処理します。クォートと行頭のスペースを使って、インデ
ントした文を使うことも可能です。この複数行のオプションは *note -s: 4b1e.
においても同じ形式で指定可能です。

If *note -n: 4b1a. 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 *note -target-time: 4b24.
seconds (default: 0.2).

*note default_timer(): 4b17. の測定値は、同じマシン上で実行されている他
のプログラムの影響を受ける可能性があるため、正確な時間計測が必要な場合は
、計測を数回繰り返し、最適な時間を使用することをおすすめします。 *note
-r: 4b1c. オプションはこれに適しています。ほとんどの場合、デフォルトの
5回の繰り返しで十分でしょう。 *note time.process_time(): e4e. を使用すれ
ばCPU時間を測定できます。

     注釈: pass 文の実行には基本的なオーバーヘッドが存在します。ここにあ
     るコードはこの事実を隠そうとはしていませんが、注意する必要がありま
     す。基本的なオーバーヘッドは引数なしでプログラムを起動することによ
     り計測でき、それは Python のバージョンによって異なるでしょう。

Added in version 3.15: Output is in color by default and can be *note
controlled using environment variables: 1ba.


File: python.info,  Node: 使用例<44>,  Prev: コマンドライン・インターフェース<9>,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.28.7.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: 1880. クラスとそのメソッドを使用して行うこともで
きます:

     >>> 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(): 8e7. と *note try: adb./*note except: 44e. を使用した場合のコ
ストを比較しています:

     $ 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(): 1e20. を '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.8 ‘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/main/Lib/trace.py

   (2) https://coverage.readthedocs.io/


File: python.info,  Node: コマンドラインからの使用<2>,  Next: プログラミングインターフェース,  Up: trace --- Python 文実行のトレースと追跡

5.28.8.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.8.2 主要なオプション
.........................

At least one of the following options must be specified when invoking
‘trace’.  The *note -listfuncs: 4b33. option is mutually exclusive with
the *note -trace: 4b34. and *note -count: 4b35. options.  When
‘--listfuncs’ is provided, neither ‘--count’ nor ‘--trace’ are accepted,
and vice versa.

 -- Option: -c, --count

     プログラム完了時に、それぞれの文が何回実行されたかを示す注釈付きリ
     ストのファイルを生成します。下記の *note -coverdir: 4b37, *note
     -file: 4b38, *note -no-report: 4b39. も参照してください。

 -- Option: -t, --trace

     実行された通りに行を表示します。

 -- Option: -l, --listfuncs

     プログラム実行の際に実行された関数を表示します。

 -- Option: -r, --report

     *note -count: 4b35. と *note -file: 4b38. 引数を使った過去のプログ
     ラム実行結果から、注釈付きリストのファイルを生成します。コードを実
     行するわけではありません。

 -- Option: -T, --trackcalls

     プログラム実行によって明らかになった呼び出しの関係を表示します。


File: python.info,  Node: 修飾的オプション,  Next: フィルターオプション,  Prev: 主要なオプション,  Up: コマンドラインからの使用<2>

5.28.8.3 修飾的オプション
.........................

 -- Option: -f, --file=<file>

     複数回にわたるトレース実行についてカウント (count) を累積するファイ
     ルに名前をつけます。 *note -count: 4b35. オプションと一緒に使って下
     さい。

 -- Option: -C, --coverdir=<dir>

     レポートファイルを保存するディレクトリを指定します。
     ‘package.module’ についてのカバレッジレポートは
     ‘`dir'/`package'/`module'.cover’ に書き込まれます。

 -- Option: -m, --missing

     注釈付きリストの生成時に、実行されなかった行に ‘>>>>>>’ の印を付け
     ます。

 -- Option: -s, --summary

     *note -count: 4b35. または *note -report: 4b3c. の利用時に、処理さ
     れたファイルそれぞれの簡潔な概要を標準出力 (stdout) に書き出します
     。

 -- Option: -R, --no-report

     注釈付きリストを生成しません。これは *note -count: 4b35. を何度か走
     らせてから最後に単一の注釈付きリストを生成するような場合に便利です
     。

 -- Option: -g, --timing

     各行の先頭にプログラム開始からの時間を付けます。トレース中にだけ使
     われます。


File: python.info,  Node: フィルターオプション,  Prev: 修飾的オプション,  Up: コマンドラインからの使用<2>

5.28.8.4 フィルターオプション
.............................

これらのオプションは複数回指定できます。

 -- Option: --ignore-module=<mod>

     指定されたモジュールと（パッケージだった場合は）そのサブモジュール
     を無視します。引数はカンマ区切りのモジュール名リストです。

 -- Option: --ignore-dir=<dir>

     指定されたディレクトリとサブディレクトリ中のモジュールとパッケージ
     を全て無視します。引数は *note os.pathsep: 2341. で区切られたディレ
     クトリのリストです。


File: python.info,  Node: プログラミングインターフェース,  Prev: コマンドラインからの使用<2>,  Up: trace --- Python 文実行のトレースと追跡

5.28.8.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(): 190. に渡せ
          るような文字列か code オブジェクトです。

      -- メソッド: runctx (cmd, globals=None, locals=None)

          指定された globals と locals 環境下で、コマンドを実行して、現
          在のトレースパラメータに基づいてその実行から統計情報を集めます
          。定義しない場合、'globals' と 'locals' はデフォルトで空の辞書
          となります。

      -- メソッド: runfunc (func, /, *args, **kwds)

          与えられた引数の 'func' を、 *note Trace: 4b4f. オブジェクトの
          コントロール下で現在のトレースパラメタのもとに呼び出します。

      -- メソッド: results ()

          与えられた *note Trace: 4b4f. インスタンスの ‘run’, ‘runctx’,
          ‘runfunc’ の以前の呼び出しについて集計した結果を納めた *note
          CoverageResults: 4b53. オブジェクトを返します。蓄積されたトレ
          ース結果はリセットしません。

 -- クラス: trace.CoverageResults

     カバレッジ結果のコンテナで、 *note Trace.results(): 4b52. で生成さ
     れるものです。ユーザーが直接生成するものではありません。

      -- メソッド: update (other)

          別の *note CoverageResults: 4b53. オブジェクトのデータを統合し
          ます。

      -- メソッド: write_results (show_missing=True, summary=False,
               coverdir=None, *, ignore_missing_files=False)

          カバレッジ結果を書き出します。ヒットしなかった行も出力するには
          'show_missing' を指定します。モジュールごとの概要を出力に含め
          るには 'summary' を指定します。'coverdir' に指定するのは結果フ
          ァイルを出力するディレクトリです。‘None’ の場合は各ソースファ
          イルごとの結果がそれぞれのディレクトリに置かれます。

          'ignore_missing_files' が ‘True’ の場合には、すでに存在しない
          ファイルのカバレッジカウントはサイレントに無視されます。そうで
          なければ、ファイルが見つからないと *note FileNotFoundError:
          24f. が発生します。

          バージョン 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.9 ‘tracemalloc’ -- メモリ割り当ての追跡
--------------------------------------------

Added in version 3.4.

'ソースコード:' Lib/tracemalloc.py(1)

__________________________________________________________________

tracemallocモジュールは、Python が割り当てたメモリブロックをトレースする
ためのデバッグツールです。このモジュールは以下の情報を提供します。

   * オブジェクトが割り当てられた場所のトレースバック

   * ファイル名ごと、及び行ごとに割り当てられたメモリブロックの以下の統
     計を取ります：総サイズ、ブロック数、割り当てられたブロックの平均サ
     イズ

   * メモリリークを検出するために2つのスナップショットの差を計算します。

Python が割り当てたメモリブロックの大半をトレースするには、 *note
PYTHONTRACEMALLOC: 233b. 環境変数を ‘1’ に設定して可能な限り早くモジュー
ルを開始させるか、*note -X: 183. ‘tracemalloc’ コマンドラインオプション
を使用してください。実行時に *note tracemalloc.start(): 233a. を呼んで
Python のメモリ割り当てのトレースを開始することが出来ます。

デフォルトでは、割り当てられたメモリブロック1つのトレースは最新1フレーム
を保存します。開始時に25フレームを保存するには、 *note
PYTHONTRACEMALLOC: 233b. 環境変数を ‘25’ に設定するか、*note -X: 183.
‘tracemalloc=25’ コマンドラインオプションを使用してください。

* Menu:

* 使用例: 使用例<45>.
* API::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/tracemalloc.py


File: python.info,  Node: 使用例<45>,  Next: API,  Up: tracemalloc --- メモリ割り当ての追跡

5.28.9.1 使用例
...............

* Menu:

* 上位10を表示する::
* 差を計算する::
* メモリブロックのトレースバックを取得する::
* top を整形化する::


File: python.info,  Node: 上位10を表示する,  Next: 差を計算する,  Up: 使用例<45>

5.28.9.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:
1da. 型をビルドするのに ‘244 KiB’ を割り当てていることが分かります。

オプションの詳細については *note Snapshot.statistics(): 4b5b. を参照して
ください。


File: python.info,  Node: 差を計算する,  Next: メモリブロックのトレースバックを取得する,  Prev: 上位10を表示する,  Up: 使用例<45>

5.28.9.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: 88. モ
ジュールはトレースバックの書式化に Python ソースコード ‘940 KiB’ をキャ
ッシュし、その全ては前回のスナップショットの後に行われたことが分かります
。

システムに空きメモリがほとんどない場合、スナップショットをオフラインで解
析するための *note Snapshot.dump(): 4b5d. メソッドを使用して、スナップシ
ョットをディスクに書き込むことが出来ます。 そして *note Snapshot.load():
4b5e. メソッドを使用してスナップショットを再読み込みします。


File: python.info,  Node: メモリブロックのトレースバックを取得する,  Next: top を整形化する,  Prev: 差を計算する,  Up: 使用例<45>

5.28.9.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:
7a. 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: 3d. module.  The
traceback may change if a new module is loaded.


File: python.info,  Node: top を整形化する,  Prev: メモリブロックのトレースバックを取得する,  Up: 使用例<45>

5.28.9.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(): 4b5b. を参照して
ください。

* 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.9.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():
4b62. and *note reset_peak(): d0b. 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(): d0b. 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(): 233a. 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: 4e0, and writing ‘sum(range(...))’).


File: python.info,  Node: API,  Prev: 使用例<45>,  Up: tracemalloc --- メモリ割り当ての追跡

5.28.9.7 API
............

* Menu:

* 関数: 関数<11>.
* DomainFilter::
* Filter::
* Frame::
* Snapshot::
* Statistic::
* StatisticDiff::
* Trace::
* Traceback::


File: python.info,  Node: 関数<11>,  Next: DomainFilter,  Up: API

5.28.9.8 関数
.............

 -- の関数: tracemalloc.clear_traces ()

     Python が割り当てたメモリブロックのトレースを消去します。

     *note stop(): 1aee. を参照してください。

 -- の関数: tracemalloc.get_object_traceback (obj)

     Get the traceback where the Python object 'obj' was allocated.
     Return a *note Traceback: f59. 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(): be2. や *note sys.getsizeof(): 1cf9. 関数
     も参照してください。

 -- の関数: tracemalloc.get_traceback_limit ()

     トレースのトレースバック内に格納されている最大フレーム数を取得しま
     す。

     The ‘tracemalloc’ module must be tracing memory allocations to get
     the limit, otherwise an exception is raised.

     *note start(): 233a. 関数で上限を設定します。

 -- の関数: 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(): 4b65.
     Snapshots taken with *note take_snapshot(): 4b67. before a call to
     ‘reset_peak()’ can be meaningfully compared to snapshots taken
     after the call.

     *note get_traced_memory(): 4b62. も参照してください。

     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: 32e.

 -- の関数: tracemalloc.is_tracing ()

     ‘True’ if the ‘tracemalloc’ module is tracing Python memory
     allocations, ‘False’ otherwise.

     *note start(): 233a. ならびに *note stop(): 1aee. 関数も参照してく
     ださい。

 -- の関数: 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: 4b6a. attribute.

     ‘1’ より多くのフレームを保存するのは ‘'traceback'’ でグループ化され
     た統計や累積的な統計を計算する場合にのみ有用です。 *note
     Snapshot.compare_to(): 4b6b. および *note Snapshot.statistics():
     4b5b. メソッドを参照してください。

     Storing more frames increases the memory and CPU overhead of the
     ‘tracemalloc’ module.  Use the *note get_tracemalloc_memory():
     4b68. function to measure how much memory is used by the
     ‘tracemalloc’ module.

     *note PYTHONTRACEMALLOC: 233b. 環境変数
     (‘PYTHONTRACEMALLOC=NFRAME’) と *note -X: 183. ‘tracemalloc=NFRAME’
     コマンドラインオプションを使って実行開始時にトレースを始めることが
     出来ます。

     *note stop(): 1aee.、*note is_tracing(): 4b69.、*note
     get_traceback_limit(): 4b66. 関数を参照してください。

 -- の関数: tracemalloc.stop ()

     Python のメモリ割り当てのトレースを停止します。つまり、Python のメ
     モリ割り当てへのフックをアンインストールします。 Python が割り当て
     たメモリブロックについてこれまで集めたトレースも全てクリアします。

     トレースが全部クリアされる前にスナップショットを取りたい場合は
     *note take_snapshot(): 4b67. 関数を呼んでください。

     *note start(): 233a.、*note is_tracing(): 4b69.、*note
     clear_traces(): 4b65. 関数も参照してください。

 -- の関数: tracemalloc.take_snapshot ()

     Python が割り当てたメモリブロックのトレースのスナップショットを取り
     ます。新しい *note Snapshot: 4b6c. インスタンスを返します。

     The snapshot does not include memory blocks allocated before the
     ‘tracemalloc’ module started to trace memory allocations.

     トレースのトレースバックは *note get_traceback_limit(): 4b66. フレ
     ームに制限されています。より多くのフレームを保存するには *note
     start(): 233a. 関数の 'nframe' 引数を使用してください。

     The ‘tracemalloc’ module must be tracing memory allocations to take
     a snapshot, see the *note start(): 233a. function.

     *note get_object_traceback(): 2145. 関数を参照してください。


File: python.info,  Node: DomainFilter,  Next: Filter,  Prev: 関数<11>,  Up: API

5.28.9.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: 4b6f.

          If 'inclusive' is ‘False’ (exclude), match memory blocks not
          allocated in the address space *note domain: 4b6f.

      -- の属性: domain

          Address space of a memory block (‘int’).  Read-only property.


File: python.info,  Node: Filter,  Next: Frame,  Prev: DomainFilter,  Up: API

5.28.9.10 Filter
................

 -- クラス: tracemalloc.Filter (inclusive: bool, filename_pattern: str,
          lineno: int = None, all_frames: bool = False, domain: int =
          None)

     メモリブロックのトレースをフィルターします。

     'filename_pattern' のシンタックスについては *note
     fnmatch.fnmatch(): 1e6a. 関数を参照してください。‘'.pyc'’ 拡張子は
     ‘'.py'’ に置換されます。

     例:

        * ‘Filter(True, subprocess.__file__)’ は *note subprocess: df. モ
          ジュールのみを含みます

        * ‘Filter(False, tracemalloc.__file__)’ excludes traces of the
          ‘tracemalloc’ module

        * ‘Filter(False, "<unknown>")’ は空のトレースバックを除外します

     バージョン 3.5 で変更: ‘'.pyo'’ ファイル拡張子が ‘'.py'’ に置換され
     ることはもうありません。

     バージョン 3.6 で変更: *note domain: 4b72. 属性が追加されました。

      -- の属性: 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: 4b74. at line number *note lineno: 4b75.

          If 'inclusive' is ‘False’ (exclude), ignore memory blocks
          allocated in a file with a name matching *note
          filename_pattern: 4b74. at line number *note lineno: 4b75.

      -- の属性: lineno

          フィルタの行番号です (‘int’)。'lineno' が ‘None’ の場合フィル
          タはあらゆる行番号にマッチします。

      -- の属性: filename_pattern

          フィルタのファイル名のパターンです (‘str’)。読み出し専用のプロ
          パティです。

      -- の属性: all_frames

          'all_frames' が ‘True’ の場合トレースバックの全てのフレームを
          チェックします。'all_frames' が ‘False’ の場合最新のフレームを
          チェックします。

          トレースバックの上限が ‘1’ の場合この属性の影響はありません。
          *note get_traceback_limit(): 4b66. 関数と *note
          Snapshot.traceback_limit: 4b77. 属性を参照してください。


File: python.info,  Node: Frame,  Next: Snapshot,  Prev: Filter,  Up: API

5.28.9.11 Frame
...............

 -- クラス: tracemalloc.Frame

     トレースバックのフレームです。

     *note Traceback: f59. クラスは *note Frame: 4b79. インスタンスのシ
     ークエンスです。

      -- の属性: filename

          ファイル名 (‘str’)。

      -- の属性: lineno

          行番号 (‘int’)。


File: python.info,  Node: Snapshot,  Next: Statistic,  Prev: Frame,  Up: API

5.28.9.12 Snapshot
..................

 -- クラス: tracemalloc.Snapshot

     Python が割り当てたメモリブロックのトレースのスナップショットです。

     *note take_snapshot(): 4b67. 関数はスナップショットのインスタンスを
     作ります。

      -- メソッド: compare_to (old_snapshot: Snapshot, key_type: str,
               cumulative: bool = False)

          古いスナップショットとの差を計算します。 'key_type' でグループ
          化された *note StatisticDiff: 4b7d. インスタンスのソート済みリ
          ストとして統計を取得します。

          'key_type' および 'cumulative' 引数については *note
          Snapshot.statistics(): 4b5b. メソッドを参照してください。

          結果は降順でソートされます: キーは *note
          StatisticDiff.size_diff: 4b7e. の絶対値、 *note
          StatisticDiff.size: 4b7f.、 *note StatisticDiff.count_diff:
          4b80. の絶対置、 *note Statistic.count: 4b81.、そして *note
          StatisticDiff.traceback: 4b82. です。

      -- メソッド: dump (filename)

          スナップショットをファイルに書き込みます。

          スナップショットをリロードするには *note load(): 4b5e. を使用
          します。

      -- メソッド: filter_traces (filters)

          Create a new *note Snapshot: 4b6c. instance with a filtered
          *note traces: 4b84. sequence, 'filters' is a list of *note
          DomainFilter: 10b1. and *note Filter: 4b71. 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: 10b1. instances are
          now also accepted in 'filters'.

      -- メソッド: classmethod load (filename)

          スナップショットをファイルからロードします。

          *note dump(): 4b5d. を参照してください。

      -- メソッド: statistics (key_type: str, cumulative: bool = False)

          'key_type' でグループ化された *note Statistic: 4b85. インスタ
          ンスのソート済みリストとして統計を取得します:

          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: 4b86,
          *note Statistic.count: 4b81, *note Statistic.traceback: 4b87.
          です。

      -- の属性: traceback_limit

          *note traces: 4b84. のトレースバック内に保存されるフレーム数の
          最大値です。 スナップショットが取られたときの *note
          get_traceback_limit(): 4b66. の結果です。

      -- の属性: traces

          Python が割り当てた全メモリブロックのトレースで、 *note Trace:
          4b88. インスタンスのシークェンスです。

          シークェンスの順序は未定義です。統計のソート済みリストを取得す
          るには *note Snapshot.statistics(): 4b5b. を使用してください。


File: python.info,  Node: Statistic,  Next: StatisticDiff,  Prev: Snapshot,  Up: API

5.28.9.13 Statistic
...................

 -- クラス: tracemalloc.Statistic

     メモリ割り当ての統計です。

     *note Snapshot.statistics(): 4b5b. は *note Statistic: 4b85. インス
     タンスの一覧を返します。

     *note StatisticDiff: 4b7d. クラスも参照してください。

      -- の属性: count

          メモリブロック数 (‘int’)。

      -- の属性: size

          メモリブロックのバイト単位の総サイズ (‘int’)。

      -- の属性: traceback

          メモリブロックが割り当てられているトレースバック。*note
          Traceback: f59. インスタンス。


File: python.info,  Node: StatisticDiff,  Next: Trace,  Prev: Statistic,  Up: API

5.28.9.14 StatisticDiff
.......................

 -- クラス: tracemalloc.StatisticDiff

     新旧 *note Snapshot: 4b6c. インスタンスのメモリ割り当ての統計差です
     。

     *note Snapshot.compare_to(): 4b6b. は *note StatisticDiff: 4b7d. イ
     ンスタンスのリストを返します。 *note Statistic: 4b85. クラスも参照
     してください。

      -- の属性: count

          新しいスナップショット内のメモリブロックの数 (‘int’) です。新
          しいスナップショット内でメモリブロックが解放された場合は ‘0’ で
          す。

      -- の属性: count_diff

          新旧スナップショットのメモリブロック数の差 (‘int’) です。メモ
          リブロックが新しいスナップショット内で割り当てられた場合は ‘0’
          です。

      -- の属性: size

          新しいスナップショット内のメモリブロックのバイト単位での総サイ
          ズ (‘int’) です。新しいスナップショット内でメモリブロックが解
          放された場合は ‘0’ です。

      -- の属性: size_diff

          新旧スナップショットのバイト単位での総サイズの差 (‘int’) です
          。メモリブロックが新しいスナップショット内で割り当てられた場合
          は ‘0’ です。

      -- の属性: traceback

          メモリブロックが割り当てられたトレースバックで、 *note
          Traceback: f59. のインスタンスです。


File: python.info,  Node: Trace,  Next: Traceback,  Prev: StatisticDiff,  Up: API

5.28.9.15 Trace
...............

 -- クラス: tracemalloc.Trace

     メモリブロックをトレースします。

     *note Snapshot.traces: 4b84. 属性は *note Trace: 4b88. インスタンス
     のシークエンスです。

     バージョン 3.6 で変更: *note domain: 4b8d. 属性が追加されました。

      -- の属性: 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: f59. インスタンス。


File: python.info,  Node: Traceback,  Prev: Trace,  Up: API

5.28.9.16 Traceback
...................

 -- クラス: tracemalloc.Traceback

     Sequence of *note Frame: 4b79. 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(): 4b66. frames.  See the *note
     take_snapshot(): 4b67. function.  The original number of frames of
     the traceback is stored in the *note Traceback.total_nframe: 4b6a.
     attribute.  That allows one to know if a traceback has been
     truncated by the traceback limit.

     The *note Trace.traceback: 4b8f. 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: 4b6a. 属性が追
     加されました。

      -- メソッド: format (limit=None, most_recent_first=False)

          Format the traceback as a list of lines.  Use the *note
          linecache: 88. 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(): 4b91. 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: 2366.  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
オプションのモジュールの要件: 2364.

参考
....

*note Python モジュールのインストール: 12a9.

     エンドユーザーが Python パッケージをインストールする際のガイドです
     。

PEP 453(2): Python インストールの際の明示的なpipのブートストラッピング

     このモジュールのもともとの論拠と仕様。

*note Availability: 234c.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 246c. と *note
WebAssemblyプラットフォーム: 1d86. をサポートしません。

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<10>.
* モジュール API::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/ensurepip

   (2) https://peps.python.org/pep-0453/


File: python.info,  Node: コマンドライン・インターフェース<10>,  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: コマンドライン・インターフェース<10>,  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: 15a. を起こします。

     'verbosity' でブートストラップ操作からの *note sys.stdout: ea0. へ
     の出力の冗長レベルをコントロールします。

     引数 ‘root’ 付きで *note 監査イベント: 1e84. ‘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: cf. 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: 4ba3. and ‘site’'s *note virtual environments
documentation: 4ba4. 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: 234c.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 246c. と *note
WebAssemblyプラットフォーム: 1d86. をサポートしません。

* Menu:

* 仮想環境の作成: 仮想環境の作成<2>.
* 仮想環境のしくみ::
* API: API<2>.
* EnvBuilder を拡張する例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 3b1. 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: 58. が呼ばれます。

‘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: 3b3.
と *note sys.exec_prefix: 3b0. は仮想環境のディレクトリを指し示し、
*note sys.base_prefix: 3b2. と *note sys.base_exec_prefix: 3af. は仮想環
境の作成に使われたベース 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: 9c1. がインストー
ルされていれば可能です。したがって、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: 778. クラスです。

 -- クラス: 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: 778. クラスを実体化するときに、以下のキーワード引
     数を受け取ります:

        * 'system_site_packages' - 真偽値で、システムの Python の
          site-packages を仮想環境から利用できるかどうかを示します (デフ
          ォルト: ‘False’)。

        * 'clear' - 真偽値で、真の場合環境を作成する前に既存の対象ディレ
          クトリの中身を削除します。

        * 'symlinks' - 真偽値で、Python のバイナリをコピーせずにシンボリ
          ックの作成を試みるかどうかを示します。

        * 'upgrade' - 真偽値で、真の場合実行中の Python で既存の環境をア
          ップグレードします。その Python がインプレースでアップグレード
          されたときに用います。デフォルトは ‘False’ です。

        * 'with_pip' - 真偽値で、真の場合仮想環境に pip がインストールさ
          れていることを保証します。‘--default-pip’ オプションで *note
          ensurepip: 58. を使用します。

        * '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(): 4bb3.

     バージョン 3.4 で変更: ‘with_pip’ 引数が追加されました。

     バージョン 3.6 で変更: ‘prompt’ 引数が追加されました。

     バージョン 3.9 で変更: ‘upgrade_deps’ 引数が追加されました。

     バージョン 3.13 で変更: ‘scm_ignore_files’ 引数が追加されました。

     *note EnvBuilder: 778. may be used as a base class.

      -- メソッド: create (env_dir)

          仮想環境を持つことになるターゲットディレクトリ (絶対パスあるい
          は現在のディレクトリからの相対パス) を指定し、仮想環境を作成し
          ます。 ‘create’ メソッドは、指定されたディレクトリに仮想環境を
          構築するか、適切な例外を送出します。

          *note EnvBuilder: 778. クラスの ‘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(): 4bb5, *note
          create_configuration(): 4bb6, *note setup_python(): 4bb7,
          *note setup_scripts(): 4bb8, *note post_setup(): 4bb9. はそれ
          ぞれオーバーライドできます。

      -- メソッド: ensure_directories (env_dir)

          仮想環境のディレクトリとすべての必要なサブディレクトリのうちま
          だ存在しないものを作成し、コンテキストオブジェクトを返します。
          このコンテキストオブジェクトは他のメソッドで使うために（パスな
          どの）属性を保持しているだけです。もし *note EnvBuilder: 778.
          が ‘clear=True’ の引数で作成された場合、仮想環境のディレクトリ
          の中身は消去され、すべての必要なサブディレクトリが再作成されま
          す。

          返されるコンテキストオブジェクトは以下の属性を持った *note
          types.SimpleNamespace: 6f0. です:

             * ‘env_dir’ - 仮想環境の場所。アクティベートスクリプトの中
               の ‘__VENV_DIR__’ で使われます（*note install_scripts():
               4bba. を参照してください）。

             * ‘env_name’ - 仮想環境の名前。アクティベートスクリプトの中
               の ‘__VENV_NAME__’ で使われます（*note install_scripts():
               4bba. を参照してください）。

             * ‘prompt’ - アクティベートスクリプトで使われるプロンプト。
               アクティベートスクリプトの中の ‘__VENV_PROMPT__’ で使われ
               ます（*note install_scripts(): 4bba. を参照してください）
               。

             * ‘executable’ - 仮想環境の元になっている Python 実行可能フ
               ァイル。これは仮想環境が別の仮想環境から作られた場合も考
               慮に入れます。

             * ‘inc_path’ - 仮想環境の include パス。

             * ‘lib_path’ - 仮想環境の purelib パス。

             * ‘platlib_path’ - The platlib path for the virtual
               environment.

             * ‘bin_path’ - 仮想環境のスクリプトのパス。

             * ‘bin_name’ - 仮想環境の場所に相対的な、スクリプトのパス。
               アクティベートスクリプトの中の ‘__VENV_BIN_NAME__’ で使わ
               れます（*note install_scripts(): 4bba. を参照してください
               ）。

             * ‘env_exe’ - 仮想環境の中の Python インタプリタの名前。ア
               クティベートスクリプトの中の ‘__VENV_PYTHON__’ で使われま
               す（*note install_scripts(): 4bba. を参照してください）。

             * ‘env_exec_cmd’ - ファイルシステムのリダイレクトを考慮に入
               れた、Python インタプリタの名前。これは仮想環境の中で
               Python を実行するのに使えます。

          バージョン 3.11 で変更: 'venv' *note
          システム構成インストールスキーム: 663. は作成されたディレクト
          リのパスを構築するために使われます。

          バージョン 3.12 で変更: コンテキストに ‘lib_path’ 属性が追加さ
          れ、コンテキストオブジェクトがドキュメントに追加されました。

          バージョン 3.15 で変更: The attribute ‘platlib_path’ was added
          to the context.

      -- メソッド: 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(): 4bb8. or
          *note post_setup(): 4bb9. in subclasses to assist in
          installing custom scripts into the virtual environment.

          'path' は ‘common’, ‘posix’, ‘nt’ ディレクトリを格納したディレ
          クトリへのパスです。各サブディレクトリには仮想環境の ‘bin’ デ
          ィレクトリにインストールするスクリプトを格納します。 ‘common’
          の中身と、 *note os.name: 323e. に一致するディレクトリの中身を
          、以下の置換処理を行いながらコピーします:

             * ‘__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(): 4bb7. だけは何もしません。

     バージョン 3.7.3 で変更: Windows では、 *note setup_scripts():
     4bb8. の代わりに *note setup_python(): 4bb7. の一部としてリダイレク
     トを行うスクリプトをコピーします。 これは 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: 778. を指定されたキーワード引数を使って作成し、そ
     の *note create(): 4bb4. メソッドに '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: 778. を拡張する方法を示します
:

     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
インタープリタで直接実行することが出来ます: 2329.。 このモジュールは
*note コマンドラインインターフェイス: 4bc0. と *note Python API: 4bc1. の
両方を提供します。

* 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/main/Lib/zipapp.py


File: python.info,  Node: 基本的な例<3>,  Next: コマンドラインインターフェイス<3>,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.29.3.1 基本的な例
...................

実行可能なアーカイブを Python コードを含むディレクトリから作成する為に
*note コマンドラインインターフェイス: 4bc0. をどのように利用することがで
きるかを以下に例示します。アーカイブは実行時にアーカイブ内の ‘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: 4bc8. を指定することは出来ません
     。

 -- 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: 4bca. に効果はありません。

     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: 7a5. オブジェクトが参照するディレクトリ。

        * 既存のアプリケーションアーカイブファイルの名前、 または
          ('interpreter' 引数に指定した値を反映し、修正する)アーカイブへ
          ファイルがコピーされる場合に *note path-like object: 7a5. オブ
          ジェクトが参照するファイル。

        * バイトモードの読込みで開くファイルオブジェクト。 ファイルの内
          容がアプリケーションアーカイブとなり、 ファイルオブジェクトが
          アーカイブの起点となります。

     'target' 引数は作成される書庫が書き込まれる場所を決めます:

        * ファイル名、または *note path-like object: 7a5. オブジェクトを
          指定した場合、アーカイブは指定したファイルへ書き込まれます。

        * 開いているファイルオブジェクトを指定した場合、 アーカイブはそ
          のファイルオブジェクトへ書込みを行ないます。 ファイルオブジェ
          クトは必ずバイトモードの書込みで開いてください。

        * 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: a6a. を返します。 '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(): f72. 関数を使用して行うことができます
:

     >>> 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(): f72.
function: を使用して変更された書庫を作成します:

     >>> import zipapp
     >>> zipapp.create_archive('old_archive.pyz', 'new_archive.pyz', '/usr/bin/python3')

アーカイブ内のファイルを更新するには *note BytesIO: 1258. オブジェクトを
使用してメモリーへ格納し、 元のファイルを上書きして置換してください。 フ
ァイルを上書きする際にエラーが発生し、元のファイルが失われる危険性がある
ことに注意してください。 このコードは上記のようなエラーからファイルを保
護しませんが、プロダクションコードは保護するべきです。 この方法はアーカ
イブがメモリーに収まる場合にのみ動作します:

     >>> 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
インタープリタの指定: 4bd4. 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: 19f. 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(): 101b. on POSIX.

  2. Standard zipfile data, as generated by the *note zipfile: 13a.
     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.abi_info

     Added in version 3.15.

     An object containing information about the ABI of the currently
     running Python interpreter.  It should include information that
     affect the CPython ABI in ways that require a specific build of the
     interpreter chosen from variants that can co-exist on a single
     machine.  For example, it does not encode the base OS (Linux or
     Windows), but does include pointer size since some systems support
     both 32- and 64-bit builds.  The available entries are the same on
     all platforms; e.g.  'pointer_size' is available even on
     64-bit-only architectures.

     The following attributes are available:

      -- の属性: abi_info.pointer_bits

          The width of pointers in bits, as an integer, equivalent to ‘8
          * sizeof(void *)’.  Usually, this is ‘32’ or ‘64’.

      -- の属性: abi_info.free_threaded

          A Boolean indicating whether the interpreter was built with
          *note free threading: 48e. support.  This reflects either the
          presence of the *note -disable-gil: 6ab. ‘configure’ option
          (on Unix) or setting the ‘DisableGil’ property (on Windows).

      -- の属性: abi_info.debug

          A Boolean indicating whether the interpreter was built in
          *note debug mode: 3e3.  This reflects either the presence of
          the *note -with-pydebug: 859. ‘configure’ option (on Unix) or
          the ‘Debug’ configuration (on Windows).

      -- の属性: abi_info.byteorder

          A string indicating the native byte order, either ‘'big'’ or
          ‘'little'’.  This is the same as the *note byteorder: 280f.
          attribute.

 -- データ: sys.abiflags

     Python が標準的な ‘configure’ でビルトされた POSIX システムにおいて
     、 PEP 3149(1) に記述された ABI フラグを含みます。

     Added in version 3.2.

     バージョン 3.8 で変更: デフォルトのフラグは空文字列になりました。
     (pymalloc のための ‘m’ フラグが取り除かれました)

     *note Availability: 234c.: Unix.

 -- の関数: sys.addaudithook (hook)

     呼び出し可能な 'hook' を現在の(サブ)インタープリタのアクティブな監
     査用フックのリストに加えます。

     When an auditing event is raised through the *note sys.audit():
     1b55. 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(): 49b8. 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(): 49b8. before initialising the runtime,
     and any modules allowing arbitrary memory modification (such as
     *note ctypes: 2d.) should be completely removed or closely
     monitored.

     Calling *note sys.addaudithook(): 49b7. will itself raise an
     auditing event named ‘sys.addaudithook’ with no arguments.  If any
     existing hooks raise an exception derived from *note RuntimeError:
     317, 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: 1e29. 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: 317. ではない *note
     Exception: da2. は抑制されなくなりました。

     'CPython 実装の詳細:' When tracing is enabled (see *note
     settrace(): 563.), 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: 44c. を付けて Pythonを起動し
     た場合、 ‘argv[0]’ は文字列 ‘'-c'’ となります。スクリプト名なしで
     Pythonを起動した場合、 ‘argv[0]’ は空文字列になります。

     標準入力もしくはコマンドライン引数で指定されたファイルのリストに渡
     ってループするには、 *note fileinput: 5e. モジュールを参照してくだ
     さい。

     See also *note sys.orig_argv: c1d.

          注釈: Unix では、コマンドライン引数は OS からバイト列で渡され
          ます。 Python はそれをファイルシステムエンコーディングと
          "surrogateescape" エラーハンドラを使ってデコードします。 オリ
          ジナルのバイト列が必要なときには、 ‘[os.fsencode(arg) for arg
          in sys.argv]’ で取得できます。

 -- の関数: sys.audit (event, *args)

     Raise an auditing event and trigger any active auditing hooks.
     'event' is a string identifying the event, and 'args' may contain
     optional arguments with more information about the event.  The
     number and types of arguments for a given event are considered a
     public and stable API and should not be modified between releases.

     For example, one auditing event is named ‘os.chdir’.  This event
     has one argument called 'path' that will contain the requested new
     working directory.

     *note sys.audit(): 1b55. 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(): 49b7. or *note
     PySys_AddAuditHook(): 49b8. functions.

     The native equivalent of this function is *note PySys_Audit(): 80e.
     Using the native function is preferred when possible.

     See the *note audit events table: 1e29. for all events raised by
     CPython.

     Added in version 3.8.

 -- データ: sys.base_exec_prefix

     Equivalent to *note exec_prefix: 3b0, but referring to the base
     Python installation.

     When running under *note Virtual Environments: 4ba3, *note
     exec_prefix: 3b0. 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: 4ba3. for more information.

     Added in version 3.3.

 -- データ: sys.base_prefix

     Equivalent to *note prefix: 3b3, but referring to the base Python
     installation.

     When running under *note virtual environment: 3b1, *note prefix:
     3b3. 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:
     4ba3. 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: c1e. 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(): 563. or *note setprofile(): 18b6. 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(): 34d. 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: 107. の関数を使えばそのように与えられたフレ
     ームのコールスタックを構築できます。

     この関数はデッドロックをデバッグするのに非常に有効です。デッドロッ
     ク状態のスレッドの協調動作を必要としませんし、そういったスレッドの
     コールスタックはデッドロックである限りフリーズしたままです。デッド
     ロックにないスレッドのフレームについては、そのフレームを調べるコー
     ドを呼んだ時にはそのスレッドの現在の実行状況とは関係ないところを指
     し示しているかもしれません。

     この関数は、内部的かつ特殊な目的にのみ利用されるべきです。

     引数無しで *note 監査イベント: 1e84. ‘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 監査イベント: 1e84. ‘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(): 500. から呼ばれます
     。 デフォルトでは、この関数は *note pdb: aa. デバッガに処理を移行さ
     せますが、他の関数を設定することもでき、使用するデバッガを選べます
     。

     この関数のシグネチャは何を呼び出すかに依存します。 例えば、
     (‘pdb.set_trace()’ などの) デフォルトの結び付けでは引数は求められま
     せんが、追加の引数 (位置引数およびキーワード引数) を求める関数に結
     び付けるかもしれません。 組み込みの ‘breakpoint()’ 関数は、自身の
     ‘*args’ と ‘**kws’ をそのまま渡します。 ‘breakpointhooks()’ の返り
     値が何であれ、そのまま ‘breakpoint()’ から返されます。

     デフォルトの実装では、最初に環境変数 *note PYTHONBREAKPOINT: ea4. を
     調べます。 それが ‘"0"’ に設定されていた場合は、この関数はすぐに終
     了します。つまり何もしません。 この環境変数が設定されていないか、空
     文字列に設定されていた場合は、 ‘pdb.set_trace()’ が呼ばれます。 そ
     れ以外の場合は、この変数は実行する関数の名前である必要があります。
     関数名の指定では、例えば ‘package.subpackage.module.function’ のよ
     うなドットでつながれた Python のインポートの命名体系を使ったを使い
     ます。 この場合では、 ‘package.subpackage.module’ がインポートされ
     、そのインポートされたモジュールには ‘function()’ という呼び出し可
     能オブジェクトがなくてはなりません。 この関数が渡された ‘*args’ と
     ‘**kws’ で実行され、 ‘function()’ の返り値が何であれ
     ‘sys.breakpointhook()’ は組み込みの *note breakpoint(): 500. 関数に
     その値をそのまま返します。

     *note PYTHONBREAKPOINT: ea4. で指名された呼び出し可能オブジェクトの
     インポートで何かしら問題が起きた場合、 *note RuntimeWarning: 6e3. が
     報告されブレークポイントは無視されることに注意してください。

     また、 ‘sys.breakpointhook()’ がプログラム上で上書きされていた場合
     は *note PYTHONBREAKPOINT: ea4. は '調べられない' ことにも注意して
     ください。

     Added in version 3.7.

 -- の関数: sys._debugmallocstats ()

     CPython のメモリアロケータの状態に関する低レベルの情報を標準エラー
     出力に出力します。

     If Python is *note built in debug mode: 3e3. (*note configure
     -with-pydebug option: 859.), it also performs some expensive
     internal consistency checks.

     Added in version 3.3.

     この関数は CPython 固有です。正確な出力形式は定義されていませんし、
     変更されるかもしれません。

 -- データ: sys.dllhandle

     Python DLLのハンドルを示す整数です。

     *note Availability: 234c.: 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 式:
     25e3. が評価されたときに呼び出されます。対話セッションの出力をカス
     タマイズする場合、 ‘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: a6c. には
     ‘'backslashreplace'’ エラーハンドラを指定してください。

 -- データ: sys.dont_write_bytecode

     この値が真の時、Python はソースモジュールをインポートする時に
     ‘.pyc’ ファイルを生成しません。この値は *note -B: 1786. コマンドラ
     インオプションと *note PYTHONDONTWRITEBYTECODE: 1787. 環境変数の値
     によって、起動時に ‘True’ か ‘False’ に設定されますが、実行時にこの
     変数を変更してバイトコード生成を制御することもできます。

 -- データ: sys._emscripten_info

     A *note named tuple: a42. 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: 234c.: 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:
     183. ‘pycache_prefix=PATH’ command-line option or the *note
     PYTHONPYCACHEPREFIX: d70. 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: 10fb. 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: 317. 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(): 712. function handles unraisable
     exceptions and the *note threading.excepthook(): c27. function
     handles exception raised by *note threading.Thread.run(): e04.

 -- データ: 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(): a80. 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: 9bd.),
     the exception itself, and a *note traceback object: ebe. 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: 3b1. 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: 3af.  Refer to *note Virtual
          Environments: 4ba3. for more information.

     バージョン 3.14 で変更: When running under a *note virtual
     environment: 3b1, *note prefix: 3b3. and ‘exec_prefix’ are now set
     to the virtual environment prefix by the *note path initialization:
     1974, instead of *note site: cf.  This means that ‘prefix’ and
     ‘exec_prefix’ always point to the virtual environment, even when
     ‘site’ is disabled (*note -S: 1566.).

 -- データ: sys.executable

     Python インタプリタの実行ファイルの絶対パスを示す文字列です。このよ
     うな名前が意味を持つシステムで利用可能です。Python が自身の実行ファ
     イルの実際のパスを取得できない場合、*note sys.executable: 3b4. は空
     の文字列または ‘None’ になります。

 -- の関数: sys.exit ([arg])

     Raise a *note SystemExit: 10fb. 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:
     d09. 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(): 27ff. 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
     *note finally: 453. clauses of *note try: adb. statements are
     honored, and it is possible to intercept the exit attempt at an
     outer level.

     バージョン 3.6 で変更: Python インタープリタが (バッファされたデー
     タを標準ストリームに吐き出すときのエラーなどの) *note SystemExit:
     10fb. を捕捉した後の後始末でエラーが起きた場合、終了ステータスは
     120 に変更されます。

 -- データ: sys.flags

     The *note named tuple: a42. '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: 2331.
                                                            
                                                            
      -- の属性: flags.inspect                              *note -i: 1893.
                                                            
                                                            
      -- の属性: flags.interactive                          *note -i: 1893.
                                                            
                                                            
      -- の属性: flags.isolated                             *note -I: d2c.
                                                            
                                                            
      -- の属性: flags.optimize                             *note -O: 438. または *note -OO: 1172.
                                                            
                                                            
      -- の属性: flags.dont_write_bytecode                  *note -B: 1786.
                                                            
                                                            
      -- の属性: flags.no_user_site                         *note -s: 1747.
                                                            
                                                            
      -- の属性: flags.no_site                              *note -S: 1566.
                                                            
                                                            
      -- の属性: flags.ignore_environment                   *note -E: d2b.
                                                            
                                                            
      -- の属性: flags.verbose                              *note -v: 17dd.
                                                            
                                                            
      -- の属性: flags.bytes_warning                        *note -b: 2f9.
                                                            
                                                            
      -- の属性: flags.quiet                                *note -q: 19b5.
                                                            
                                                            
      -- の属性: flags.hash_randomization                   *note -R: 2084.
                                                            
                                                            
      -- の属性: flags.dev_mode                             *note -X dev: 183.
                                                            (*note Python Development Mode: 713.)
                                                            
                                                            
      -- の属性: flags.utf8_mode                            *note -X utf8: 183.
                                                            
                                                            
      -- の属性: flags.safe_path                            *note -P: 9a8.
                                                            
                                                            
      -- の属性: flags.int_max_str_digits                   *note -X int_max_str_digits: 183.
                                                            (*note integer string conversion length limitation: 9f1.)
                                                            
                                                            
      -- の属性: flags.warn_default_encoding                *note -X warn_default_encoding: 183.
                                                            
                                                            
      -- の属性: flags.gil                                  *note -X gil: 183. and *note PYTHON_GIL: 6ac.
                                                            
                                                            
      -- の属性: flags.thread_inherit_context               *note -X thread_inherit_context: 183. and
                                                            *note PYTHON_THREAD_INHERIT_CONTEXT: 1aaf.
                                                            
                                                            
      -- の属性: flags.context_aware_warnings               *note -X context_aware_warnings: 183. and
                                                            *note PYTHON_CONTEXT_AWARE_WARNINGS: 1aa3.
                                                            

     バージョン 3.2 で変更: 新しい *note -q: 19b5. 向けに ‘quiet’ 属性が
     追加されました。

     Added in version 3.2.3: ‘hash_randomization’ 属性が追加されました。

     バージョン 3.3 で変更: 廃止済みの ‘division_warning’ 属性を削除しま
     した。

     バージョン 3.4 で変更: *note -I: d2c. ‘isolated’ フラグ向けに
     ‘isolated’ 属性が追加されました。

     バージョン 3.7 で変更: 新しい *note Python 開発モード: 713. 向けに
     ‘dev_mode’ 属性が、新しい *note -X: 183. ‘utf8’ フラグ向けに
     ‘utf8_mode’ 属性が追加されました。

     バージョン 3.10 で変更: Added ‘warn_default_encoding’ attribute for
     *note -X: 183. ‘warn_default_encoding’ flag.

     バージョン 3.11 で変更: Added the ‘safe_path’ attribute for *note
     -P: 9a8. 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 名前付きタプル: a42. です
     。精度と内部表現に関する低レベル情報を含んでいます。これらの値は
     'C' 言語の標準ヘッダファイル ‘float.h’ で定義されている様々な浮動小
     数点定数に対応しています。詳細は 1999 ISO/IEC C standard *note
     [C99]: 4bfd. の 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(): ce5. を参照してく
                                                                                 ださい。
                                                                                 
                                                                                 
      -- の属性: 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): ce5. 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: 4bff. 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: 4bff. より大きい
     場合には、常に復元されるとは限りません:

          >>> s = '9876543211234567'    # 16 significant digits is too many!
          >>> format(float(s), '.16g')  # conversion changes value
          '9876543211234568'

 -- データ: sys.float_repr_style

     *note repr(): 462. 関数が浮動小数点数に対してどう振る舞うかを示す文
     字列です。この文字列が値 ‘'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(): 34d. and
     *note gc.collect(): 456. 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(): 1bef.

     *note Availability: 234c.: 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(): cab.

 -- の関数: 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: 14d9.).

     *note Availability: 234c.: Unix.

 -- の関数: sys.getfilesystemencoding ()

     Get the *note filesystem encoding: 94d.: 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(): 10a7.

     最良の互換性のために、たとえファイル名の表現に bytes がサポートされ
     ていたとしても、全てのケースで str をファイル名に使うべきです。 フ
     ァイル名を受け取ったり返したりする関数は str と bytes をサポートし
     、すぐにシステムにとって好ましい表現に変換すべきです。

     *note os.fsencode(): 1017. や *note os.fsdecode(): 1016. を、正しい
     エンコーディングやエラーモードが使われていることを保証するために使
     うべきです。

     term:‘ファイルシステムのエンコーディングとエラーハンドラ
     <filesystem encoding and error handler>’ は、Pythonの開始時に
     :c:func:‘PyConfig_Read’ 関数により設定されます。 *note PyConfig:
     612. のメンバー *note filesystem_encoding: 635. と *note
     filesystem_errors: 636. を参照してください。

     バージョン 3.2 で変更: *note getfilesystemencoding(): 101b. の結果
     が ‘None’ になることはなくなりました。

     バージョン 3.6 で変更: Windows is no longer guaranteed to return
     ‘'mbcs'’.  See PEP 529(3) for more information.

     バージョン 3.7 で変更: *note Python UTF-8 モード: a4b. が有効なら
     ‘"utf-8"’ を返します。

 -- の関数: sys.getfilesystemencodeerrors ()

     Get the *note filesystem error handler: 94d.: the error handler
     used with the filesystem encoding to convert between Unicode
     filenames and bytes filenames.  The filesystem encoding is returned
     from *note getfilesystemencoding(): 101b.

     *note os.fsencode(): 1017. や *note os.fsdecode(): 1016. を、正しい
     エンコーディングやエラーモードが使われていることを保証するために使
     うべきです。

     term:‘ファイルシステムのエンコーディングとエラーハンドラ
     <filesystem encoding and error handler>’ は、Pythonの開始時に
     :c:func:‘PyConfig_Read’ 関数により設定されます。 *note PyConfig:
     612. のメンバー *note filesystem_encoding: 635. と *note
     filesystem_errors: 636. を参照してください。

     Added in version 3.6.

 -- の関数: sys.get_int_max_str_digits ()

     Returns the current value for the *note integer string conversion
     length limitation: 9f1.  See also *note set_int_max_str_digits():
     1b30.

     Added in version 3.11.

 -- の関数: sys.get_lazy_imports ()

     Returns the current lazy imports mode as a string.

        * ‘"normal"’: Only imports explicitly marked with the ‘lazy’
          keyword are lazy

        * ‘"all"’: All top-level imports are potentially lazy

        * ‘"none"’: All lazy imports are suppressed (even explicitly
          marked ones)

     See also *note set_lazy_imports(): 185. and PEP 810(4).

     Added in version 3.15.

 -- の関数: sys.get_lazy_imports_filter ()

     Returns the current lazy imports filter function, or ‘None’ if no
     filter is set.

     The filter function is called for every potentially lazy import to
     determine whether it should actually be lazy.  See *note
     set_lazy_imports_filter(): 187. for details on the filter function
     signature.

     Added in version 3.15.

 -- の関数: sys.getrefcount (object)

     'object' の参照数を返します。 'object' は (一時的に) *note
     getrefcount(): 551. からも参照されるため、参照数は予想される数より
     も 1 多くなります。

     戻り値は、実際に保持されているオブジェクトの参照の数を実際に反映し
     ているとは限らないことに注意してください。例えば、一部のオブジェク
     トは永続 (*note immortal: 3a0.) であり、実際の参照の数を反映しない
     非常に高い参照数を持ちます。したがって、 0 か 1 の値以外では、正確
     な戻り値に頼らないでください。

     'CPython 実装の詳細:' *note Immortal: 3a0. objects with a large
     reference count can be identified via *note _is_immortal(): 51e.

     バージョン 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(): 8d8. で指定すること
     ができます。

 -- の関数: sys.getsizeof (object[, default])

     'object' のサイズをバイト数で返します。'object' は任意の型のオブジ
     ェクトです。すべての組み込みオブジェクトは正しい値を返します。サー
     ドパーティー製の型については実装依存になります。

     オブジェクトに直接起因するメモリ消費のみを表し、参照するオブジェク
     トは含みません。

     オブジェクトがサイズを取得する手段を提供していない時は 'default' が
     返されます。'default' が指定されていない場合は *note TypeError:
     29c. が送出されます。

     *note getsizeof(): 1cf9. は 'object' の ‘__sizeof__’ メソッドを呼び
     出し、そのオブジェクトがガベージコレクタに管理されていた場合はガベ
     ージコレクタのオーバーヘッドを増やします。

     See recursive sizeof recipe(5) 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(): d1a.

     Added in version 3.2.

 -- の関数: sys._getframe ([depth])

     コールスタックからフレームオブジェクトを返します。オプション引数
     'depth' を指定すると、スタックのトップから 'depth' だけ下のフレーム
     オブジェクトを取得します。 'depth' がコールスタックよりも深ければ、
     *note ValueError: 15a. が発生します。 'depth' のデフォルト値は 0 で
     、この場合はコールスタックのトップのフレームを返します。

     引数 ‘frame’ で *note 監査イベント: 1e84. ‘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: 1e84. ‘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: 82e.  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: 4c0b. set to 1 or using
     *note Py_NewInterpreter(): 1d4e, and the *note main interpreter:
     417.).  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(): 18b6. 関数で設定したプロファイラ関数を取得しま
     す。

 -- の関数: sys.gettrace ()

     *note settrace(): 563. 関数で設定したトレース関数を取得します。

     *note gettrace(): 179a. 関数は、デバッガ、プロファイラ、カバレッジ
     ツールなどの実装に使うことのみを想定しています。この関数の振る舞い
     は言語定義ではなく実装プラットフォームの一部です。そのため、他の
     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: 234c.: 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: 1da. に似た形
     をしています。 'firstiter' と 'finalizer' は両方とも ‘None’ か、
     *note asynchronous generator iterator: 3b9c. を引数に取る関数と、イ
     ベントループが非同期ジェネレータの終了処理をスケジューリングするの
     に使う関数であることが求められます。

     Added in version 3.6: より詳しくは PEP 525(6) を参照してください。

          注釈: This function has been added on a provisional basis (see
          PEP 411(7) for details.)

 -- の関数: sys.get_coroutine_origin_tracking_depth ()

     Get the current coroutine origin tracking depth, as set by *note
     set_coroutine_origin_tracking_depth(): f4f.

     Added in version 3.7.

          注釈: This function has been added on a provisional basis (see
          PEP 411(8) for details.)  Use it only for debugging purposes.

 -- データ: sys.hash_info

     数値のハッシュ実装のパラメータを与える *note named tuple: a42. です
     。数値型のハッシュ化についての詳細は *note 数値型のハッシュ化:
     2816. を参照してください。

      -- の属性: 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(): 1689. 関数を使って 16 進数に変換しなけ
     れば値の意味を持ちません。より読みやすいバージョン番号が必要な場合
     には *note named tuple: a42. *note sys.version_info: 308. を使用し
     てください。

     ‘hexversion’ のより詳しい情報については *note API と ABI
     のバージョニング: 4c15. を参照してください。

 -- データ: sys.implementation

     現在起動している Python インタプリタに関する情報が格納されたオブジ
     ェクトです。すべての Python 実装において、以下の属性が存在すること
     が要求されています。

     'name' は実装の識別子です (例: ‘'cpython'’)。実際の文字列は Python
     実装によって定義されますが、小文字であることが保証されています。

     'version' は *note sys.version_info: 308. と同じ形式の、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: 4c14. と同形式の、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(9), PEP 734(10), and *note concurrent.interpreters: 25.

     *note sys.implementation: 92b. には Python 実装固有の属性を追加する
     ことができます。それら非標準属性の名前はアンダースコアから始めなく
     てはならず、そしてここでは説明されません。その内容に関係なく、
     ‘sys.implementation’ はインタプリタ起動中や実装のバージョン間で変更
     することはありません (ただし Python 言語のバージョン間についてはそ
     の限りではありません)。詳細は PEP 421(11) を参照してください。

     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(12) for more information.

 -- データ: sys.int_info

     Python における整数の内部表現に関する情報を保持する、*note named
     tuple: a42. です。この属性は読み出し専用です。

      -- の属性: 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():
          1a32. 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(): 1b30, *note
          PYTHONINTMAXSTRDIGITS: 1d57, or *note -X int_max_str_digits:
          183.

     Added in version 3.1.

     バージョン 3.11 で変更: Added *note default_max_str_digits: 28f0.
     and *note str_digits_check_threshold: 4c18.

 -- データ: sys.__interactivehook__

     この属性が存在する場合、インタープリタが *note 対話モード: 65d. で
     起動したときに値は (引数なしで) 自動的に呼ばれます。これは *note
     PYTHONSTARTUP: 45a. ファイルの読み込み後に行われるため、それにこの
     フックを設定することが出来ます。*note site: cf. モジュールで *note
     設定します: 1377.。

     Raises an *note auditing event: 1e84. ‘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: 3a0.; you must keep a
     reference to the return value of ‘intern()’ around to benefit from
     it.

 -- の関数: sys._is_gil_enabled ()

     Return *note True: fd0. if the *note GIL: 418. is enabled and *note
     False: ef9. 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: fd0. if the main Python interpreter is *note
     shutting down: 1ab.  Return *note False: ef9. otherwise.

     See also the *note PythonFinalizationError: 691. 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: 668. 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(): 669.),
          and ‘False’ otherwise.  If JIT compilation is available, this
          can be controlled by setting the *note PYTHON_JIT: 667.
          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():
          66a.), 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: fd0. if the given object is *note immortal: 3a0,
     *note False: ef9. 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: fd0. if the given string is "interned", *note
     False: ef9. 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: 8d3.
     instead.  They hold the legacy representation of ‘sys.last_exc’, as
     returned from *note exc_info(): a7f. above.

 -- データ: sys.maxsize

     *note Py_ssize_t: e28. 型の変数が取りうる最大値を示す整数です。通常
     、32 ビットプラットフォームでは ‘2**31 - 1’、64 ビットプラットフォ
     ームでは ‘2**63 - 1’ になります。

 -- データ: sys.maxunicode

     Unicode コードポイントの最大値を示す整数、すなわち ‘1114111’ (16 進
     数で ‘0x10FFFF’) です。

     バージョン 3.3 で変更: PEP 393(13) 以前は、オプション設定に
     Unicode文字の保存形式がUCS-2とUCS-4のどちらを指定したかによって、
     ‘sys.maxunicode’ の値は ‘0xFFFF’ が ‘0x10FFFF’ になっていました。

 -- データ: sys.meta_path

     A list of *note meta path finder: 1427. objects that have their
     *note find_spec(): c43. 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__:
     2261. attribute is passed in as a second argument.  The method
     returns a *note module spec: 2572, or ‘None’ if the module cannot
     be found.

     参考
     ....

     *note importlib.abc.MetaPathFinder: c48.

          The abstract base class defining the interface of finder
          objects on ‘meta_path’.

     *note importlib.machinery.ModuleSpec: 247c.

          The concrete class which *note find_spec(): c43. should return
          instances of.

     バージョン 3.4 で変更: *note Module specs: 2572. were introduced in
     Python 3.4, by PEP 451(14).

     バージョン 3.12 で変更: Removed the fallback that looked for a
     ‘find_module()’ method if a ‘meta_path’ entry didn't have a *note
     find_spec(): c43. method.

 -- データ: sys.modules

     This is a dictionary that maps module names to modules which have
     already been loaded.  This can be manipulated to force reloading of
     modules and other tricks.  However, replacing the dictionary will
     not necessarily work as expected and deleting essential items from
     the dictionary may cause Python to fail.  If you want to iterate
     over this global dictionary always use ‘sys.modules.copy()’ or
     ‘tuple(sys.modules)’ to avoid exceptions as its size may change
     during iteration as a side effect of code or activity in other
     threads.

 -- データ: sys.orig_argv

     The list of the original command line arguments passed to the
     Python executable.

     The elements of *note sys.orig_argv: c1d. are the arguments to the
     Python interpreter, while the elements of *note sys.argv: 161e. 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:
     13cb. 環境変数と、インストール時に指定したデフォルトパスで初期化さ
     れます。

     By default, as initialized upon program startup, a potentially
     unsafe path is prepended to *note sys.path: 19f. ('before' the
     entries inserted as a result of *note PYTHONPATH: 13cb.):

        * ‘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: 9a8.
     command line option or the *note PYTHONSAFEPATH: 9a9. environment
     variable.

     プログラムはその目的のために、このリストを自由に修正できます。文字
     列だけが *note sys.path: 19f. に追加でき、 ほかの全てのデータ型はイ
     ンポート中に無視されます。

     参考
     ....

        * *note site: cf. モジュールのドキュメントで、 .pth ファイルを使
          って *note sys.path: 19f. を拡張する方法を解説しています。

 -- データ: sys.path_hooks

     path を引数にとって、その path に対する *note finder: 265c. の作成
     を試みる呼び出し可能オブジェクトのリスト。 finder の作成に成功した
     ら、その呼出可能オブジェクトのは finder を返します。失敗した場合は
     、 *note ImportError: 1c8. を発生させます。

     オリジナルの仕様は PEP 302(15) を参照してください。

 -- データ: sys.path_importer_cache

     *note finder: 265c. オブジェクトのキャッシュ機能を果たす辞書です。
     キーは *note sys.path_hooks: 13d1. に渡されているパスで、値は見つか
     った finder になります。パスが正常なファイルシステムパスであり、
     finder が ‘sys.path_hooks’ 上に見つからない場合は ‘None’ が格納され
     ます。

     オリジナルの仕様は PEP 302(16) を参照してください。

 -- データ: 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: 51f. doesn't
     contain the major version anymore.  It is always ‘'linux'’, instead
     of ‘'linux2'’ or ‘'linux3'’.

     バージョン 3.8 で変更: On AIX, *note sys.platform: 51f. doesn't
     contain the major version anymore.  It is always ‘'aix'’, instead
     of ‘'aix5'’ or ‘'aix7'’.

     バージョン 3.13 で変更: On Android, *note sys.platform: 51f. now
     returns ‘'android'’ rather than ‘'linux'’.

     バージョン 3.14 で変更: On FreeBSD, *note sys.platform: 51f.
     doesn't contain the major version anymore.  It is always
     ‘'freebsd'’, instead of ‘'freebsd13'’ or ‘'freebsd14'’.

     参考
     ....

     *note os.name: 323e. has a coarser granularity.  *note os.uname():
     14d7. 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: 5a. module, the
          exact filename is platform specific)

        * ‘/usr/lib/pythonX.Y/site-packages/’ (always use ‘lib’, not
          *note sys.platlibdir: 2b4.): 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: 235b. argument to the ‘configure’ script.  See *note
     インストールパス: 663. for derived paths.

          注釈: If a *note virtual environment: 3b1. 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: 3b2.  Refer to *note Virtual Environments: 4ba3.
          for more information.

     バージョン 3.14 で変更: When running under a *note virtual
     environment: 3b1, ‘prefix’ and *note exec_prefix: 3b0. are now set
     to the virtual environment prefix by the *note path initialization:
     1974, instead of *note site: cf.  This means that ‘prefix’ and
     ‘exec_prefix’ always point to the virtual environment, even when
     ‘site’ is disabled (*note -S: 1566.).

 -- データ: sys.ps1
 -- データ: sys.ps2

     インタプリタの一次プロンプト、二次プロンプトを指定する文字列。対話
     モードで実行中のみ定義され、初期値は ‘'>>> '’ と ‘'... '’ です。文
     字列以外のオブジェクトを指定した場合、インタプリタが対話コマンドを
     読み込むごとにオブジェクトの *note str(): 1ea. を評価します。この機
     能は、動的に変化するプロンプトを実装する場合に利用します。

 -- の関数: 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: 14d9.).

     *note Availability: 234c.: Unix.

 -- の関数: sys.set_int_max_str_digits (maxdigits)

     Set the *note integer string conversion length limitation: 9f1.
     used by this interpreter.  See also *note get_int_max_str_digits():
     1a32.

     Added in version 3.11.

 -- の関数: sys.set_lazy_imports (mode)

     Sets the global lazy imports mode.  The 'mode' parameter must be
     one of the following strings:

        * ‘"normal"’: Only imports explicitly marked with the ‘lazy’
          keyword are lazy

        * ‘"all"’: All top-level imports become potentially lazy

        * ‘"none"’: All lazy imports are suppressed (even explicitly
          marked ones)

     This function is intended for advanced users who need to control
     lazy imports across their entire application.  Library developers
     should generally not use this function as it affects the runtime
     execution of applications.

     In addition to the mode, lazy imports can be controlled via the
     filter provided by *note set_lazy_imports_filter(): 187.

     See also *note get_lazy_imports(): 186. and PEP 810(17).

     Added in version 3.15.

 -- の関数: sys.set_lazy_imports_filter (filter)

     Sets the lazy imports filter callback.  The 'filter' parameter must
     be a callable or ‘None’ to clear the filter.

     The filter function is called for every potentially lazy import to
     determine whether it should actually be lazy.  It must have the
     following signature:

          def filter(importing_module: str, imported_module: str,
                     fromlist: tuple[str, ...] | None) -> bool

     Where:

        * 'importing_module' is the name of the module doing the import

        * 'imported_module' is the resolved name of the module being
          imported (for example, ‘lazy from .spam import eggs’ passes
          ‘package.spam’)

        * 'fromlist' is the tuple of names being imported (for ‘from ...
          import’ statements), or ‘None’ for regular imports

     The filter should return ‘True’ to allow the import to be lazy, or
     ‘False’ to force an eager import.

     This is an advanced feature intended for specialized users who need
     fine-grained control over lazy import behavior.

     See also *note get_lazy_imports_filter(): 4c0a. and PEP 810(18).

     Added in version 3.15.

 -- の関数: sys.setprofile (profilefunc)

     Set the system's profile function, which allows you to implement a
     Python source code profiler in Python.  See chapter *note profile
     -- Pure Python profiler: 4c1a. for more information on the Python
     profiler.  The system's profile function is called similarly to the
     system's trace function (see *note settrace(): 563.), 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(): 563.  To trace calls with ‘setprofile()’
          inside a tracing function (e.g.  in a debugger breakpoint),
          see *note call_tracing(): 1ddc.

     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 監査イベント: 1e84. ‘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: 1125. exception is raised.

     バージョン 3.5.1 で変更: A *note RecursionError: 1125. 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(): c24.

     Trace functions should have three arguments: 'frame', 'event', and
     'arg'.  'frame' is the *note current stack frame: ad2.  '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(): 1ddc.

     '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: f9f.
          to *note False: ef9. on that *note frame: ad2.

     ‘'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: 3b. 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: fa0. to *note True: fd0. on the *note frame:
          ad2.

     例外が呼び出しチェインを辿って伝播していくことに注意してください。
     ‘'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 標準型の階層: 253e. を
     参照してください。

     引数無しで *note 監査イベント: 1e84. ‘sys.settrace’ を送出します。

     *note settrace(): 563. 関数は、デバッガ、プロファイラ、カバレッジツ
     ール等で使うためだけのものです。この関数の挙動は言語定義よりも実装
     プラットフォームの分野の問題で、全ての Python 実装で利用できるとは
     限りません。

     バージョン 3.7 で変更: ‘'opcode'’ event type added; *note
     f_trace_lines: f9f. and *note f_trace_opcodes: fa0. 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: 3b9c. 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 監査イベント: 1e84.
     ‘sys.set_asyncgen_hooks_firstiter’ を送出します。

     引数無しで *note 監査イベント: 1e84.
     ‘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(19) 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(20)

          注釈: This function has been added on a provisional basis (see
          PEP 411(21) 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(22) 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: 234c.: Linux.

     Added in version 3.12.

     参考
     ....

        * *note Python support for the perf map compatible profilers:
          6bd.

        * ‘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: 234c.: Linux.

     Added in version 3.12.

 -- の関数: sys.is_stack_trampoline_active ()

     Return ‘True’ if a stack profiler trampoline is active.

     *note Availability: 234c.: 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: 4c1b. for more
     information about the remote debugging mechanism.

     When the code is executed in the remote process, an *note auditing
     event: 1e84. ‘sys.remote_exec’ is raised with the 'pid' and the
     path to the script file.  This event is raised in the process that
     called *note sys.remote_exec(): 41f.

     When the script is executed in the remote process, an *note
     auditing event: 1e84. ‘cpython.remote_debugger_script’ is raised
     with the path in the remote process.  This event is raised in the
     remote process, not the one that called *note sys.remote_exec():
     41f.

     *note Availability: 234c.: Unix, Windows.

     Added in version 3.14: See PEP 768(23) for more details.

 -- データ: sys.stdin
 -- データ: sys.stdout
 -- データ: sys.stderr

     インタプリタが使用する、それぞれ標準入力、標準出力、および標準エラ
     ー出力の *note ファイルオブジェクト: 1581. です:

        * ‘stdin’ は (*note input(): 1692. の呼び出しも含む) すべての対
          話型入力に使われます。

        * ‘stdout’ は *note print(): 1324. および *note expression:
          25e3. 文の出力と、*note input(): 1692. のプロンプトに使用され
          ます。

        * インタプリタ自身のプロンプトおよびエラーメッセージは ‘stderr’
          に出力されます。

     これらのストリームは *note open(): 333. が返すような通常の *note
     テキストファイル: 227a. です。引数は以下のように選択されます:

        * The encoding and error handling are is initialized from *note
          PyConfig.stdio_encoding: 83b. and *note PyConfig.stdio_errors:
          4c1c.

          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: 752. 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: 13b8. environment
          variable before starting Python or by using the new *note -X:
          183. ‘utf8’ command line option and *note PYTHONUTF8: 1b8.
          environment variable.  However, for the Windows console, this
          only applies when *note PYTHONLEGACYWINDOWSSTDIO: 101d. 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: 1f9e.
          command-line option or setting the *note PYTHONUNBUFFERED:
          1f9f. environment variable.

     バージョン 3.9 で変更: Non-interactive ‘stderr’ is now
     line-buffered instead of fully buffered.

          注釈: 標準ストリームにバイナリーデータの読み書きを行うには下位
          のバイナリー *note buffer: 165d. オブジェクトを使用してくださ
          い。例えば *note bytes: 1d2. を *note stdout: ea0. に書き出す
          場合は ‘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: 12d8. 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: 2254. list.

     Added in version 3.10.

 -- データ: sys.thread_info

     スレッドの実装に関する情報が格納された *note named tuple: a42. です
     。

      -- の属性: 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(): 456.).

     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’.  Similar to the *note traceback: 107. module, this adds
     color to exceptions by default.  This can be disabled using *note
     environment variables: 1ba.

     *note sys.unraisablehook(): 712. can be overridden to control how
     unraisable exceptions are handled.

     バージョン 3.15 で変更: Exceptions are now printed with colorful
     text.

     参考
     ....

     *note excepthook(): be9. 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: 308. および *note platform: af. が提供する関数
     を使って下さい。

 -- データ: sys.api_version

     The C API version, equivalent to the C macro *note
     PYTHON_API_VERSION: 4c22.  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: 11b. を参照してください。

 -- データ: 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: 234c.: Windows.

 -- データ: sys.monitoring

     Namespace containing functions and constants for register callbacks
     and controlling monitoring events.  See *note sys.monitoring: e3.
     for details.

 -- データ: sys._xoptions

     コマンドラインオプション *note -X: 183. で渡された様々な実装固有の
     フラグの辞書です。オプション名にはその値が明示されていればそれが、
     それ以外の場合は *note True: fd0. がマップされます。例えば:

          $ ./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: 183. によって渡されたオプションにアクセスする方法は
     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://peps.python.org/pep-0810/

   (5) 
https://code.activestate.com/recipes/577504-compute-memory-footprint-of-an-object-and-its-cont/

   (6) https://peps.python.org/pep-0525/

   (7) https://peps.python.org/pep-0411/

   (8) https://peps.python.org/pep-0411/

   (9) https://peps.python.org/pep-0684/

   (10) https://peps.python.org/pep-0734/

   (11) https://peps.python.org/pep-0421/

   (12) https://peps.python.org/pep-0421/

   (13) https://peps.python.org/pep-0393/

   (14) https://peps.python.org/pep-0451/

   (15) https://peps.python.org/pep-0302/

   (16) https://peps.python.org/pep-0302/

   (17) https://peps.python.org/pep-0810/

   (18) https://peps.python.org/pep-0810/

   (19) https://peps.python.org/pep-0525/

   (20) 
https://github.com/python/cpython/tree/main/Lib/asyncio/base_events.py

   (21) https://peps.python.org/pep-0411/

   (22) https://peps.python.org/pep-0411/

   (23) https://peps.python.org/pep-0768/


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: e2.
     module, not an independent module, and ‘import sys.monitoring’
     would fail with a *note ModuleNotFoundError: 1c9.  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: 4c27.

   * *note Events: 4c28.

   * *note Callbacks: 4c29.

* 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: 15a. 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(): 1b68. 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: 4c37. event.

 -- monitoring-event: sys.monitoring.events.RERAISE

     An exception is re-raised, for example at the end of a *note
     finally: 453. block.

 -- monitoring-event: sys.monitoring.events.STOP_ITERATION

     An artificial *note StopIteration: fbe. is raised; see *note the
     STOP_ITERATION event: 4c38.

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: 4c34. and *note PY_START:
4c35. 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
per location.  The local events are:

   * *note PY_START: 4c35.

   * *note PY_RESUME: 4c33.

   * *note PY_RETURN: 4c34.

   * *note PY_YIELD: 4c36.

   * *note CALL: 1be6.

   * *note LINE: 4c32.

   * *note INSTRUCTION: 4c30.

   * *note JUMP: 4c31.

   * *note BRANCH_LEFT: 522.

   * *note BRANCH_RIGHT: 523.

   * *note STOP_ITERATION: 4c37.


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: 522.
and *note BRANCH_RIGHT: 523. 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: 4c2e.

   * *note C_RETURN: 4c2f.

The *note C_RETURN: 4c2f. and *note C_RAISE: 4c2e. events are controlled
by the *note CALL: 1be6. 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 per location.

The other events that can be monitored are:

   * *note PY_THROW: 27d.

   * *note PY_UNWIND: 27e.

   * *note RAISE: 27f.

   * *note EXCEPTION_HANDLED: 280.

   * *note RERAISE: 281.

バージョン 3.15 で変更: Other events can now be turned on and disabled
on a per code object basis.  Returning *note DISABLE: 282. from a
callback disables the event for the entire code object (for the current
tool).


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: fbe. 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: 4c37. event is
provided.  ‘STOP_ITERATION’ can be locally disabled.

Note that the *note STOP_ITERATION: 4c37. event and the *note RAISE:
27f. event for a *note StopIteration: fbe. 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: 15a. 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: 2ed. should be
prepared to accept a look-alike object from functions which are not
defined in Python (see *note Monitoring C API: 69a.).

 -- の関数: sys.monitoring.get_local_events (tool_id: int, code:
          CodeType, /) -> int

     Returns all the *note local events: 4c3b. for 'code'

 -- の関数: sys.monitoring.set_local_events (tool_id: int, code:
          CodeType, event_set: int, /) -> None

     Activates all the *note local events: 4c3b. for 'code' which are
     set in 'event_set'.  Raises a *note ValueError: 15a. 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: 4c3b. can be disabled for a specific code location
by returning *note sys.monitoring.DISABLE: 282. from a callback
function.  This does not change which events are set, or any other code
locations for the same event.

*note Other events: 27c. can be disabled on a per code object basis by
returning *note sys.monitoring.DISABLE: 282. from a callback function.
This disables the event for the entire code object (for the current
tool).

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.

 -- の関数: sys.monitoring.restart_events () -> None

     Enable all the events that were disabled by *note
     sys.monitoring.DISABLE: 282. 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: 1e84.
     ‘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: 282.
will have no effect.  Different events will provide the callback
function with different arguments, as follows:

   * *note PY_START: 4c35. and *note PY_RESUME: 4c33.:

          func(code: CodeType, instruction_offset: int) -> object

   * *note PY_RETURN: 4c34. and *note PY_YIELD: 4c36.:

          func(code: CodeType, instruction_offset: int, retval: object) -> object

   * *note CALL: 1be6, *note C_RAISE: 4c2e. and *note C_RETURN: 4c2f.
     ('arg0' can be *note MISSING: 4c4b. 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: 4c4b.

     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: 27f, *note RERAISE: 281, *note EXCEPTION_HANDLED: 280,
     *note PY_UNWIND: 27e, *note PY_THROW: 27d. and *note
     STOP_ITERATION: 4c37.:

          func(code: CodeType, instruction_offset: int, exception: BaseException) -> object

   * *note LINE: 4c32.:

          func(code: CodeType, line_number: int) -> object

   * *note BRANCH_LEFT: 522, *note BRANCH_RIGHT: 523. and *note JUMP:
     4c31.:

          func(code: CodeType, instruction_offset: int, destination_offset: int) -> object

     Note that the 'destination_offset' is where the code will next
     execute.

   * *note INSTRUCTION: 4c30.:

          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/main/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(): 525. or *note
get_config_var(): 425.

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: 323e.  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: 16d6.).

   - 'posix_venv': scheme for *note Python virtual environments: 11a. 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: 11a. 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:
16d6. (written as ‘`userbase'’ hereafter).  This scheme installs pure
Python modules and extension modules in the same location (also known as
*note site.USER_SITE: 2334.).

* 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(): 4c5d.  It can be passed to ‘sysconfig’
     functions that take a 'scheme' argument, such as *note get_paths():
     160.

     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(): 1dce. and *note get_preferred_scheme(): a84.
     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(): 4c5f. が返すリストに含まれる値で
     なければなりません。

     ‘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(): 16e7. はパスを展開するのに *note
     get_config_vars(): 525. が返す変数を利用します。すべての変数は各プ
     ラットフォームにおいてデフォルト値を持っていて、この関数を呼び出し
     たときにデフォルト値を取得する場合があります。

     'scheme' が指定された場合、*note get_scheme_names(): 4c5d. が返すリ
     ストに含まれる値でなければなりません。指定されなかった場合は、現在
     のプラットフォームでのデフォルトスキームが利用されます。

     If 'vars' is provided, it must be a dictionary of variables that
     will update the dictionary returned by *note get_config_vars():
     525.

     'expand' が ‘False’ に設定された場合、パスは変数を使って展開されま
     せん。

     'name' が見つからない場合、*note KeyError: 7e5. を送出します。

 -- の関数: sysconfig.get_paths ([scheme[, vars[, expand]]])

     インストールスキームに基づいたすべてのインストールパスを格納した辞
     書を返します。詳しい情報は *note get_path(): 16e7. を参照してくださ
     い。

     'scheme' が指定されない場合、現在のプラットフォームでのデフォルトス
     キーマが使用されます。

     'vars' を指定する場合、パスを展開するために使用される辞書を更新する
     値の辞書でなければなりません。

     'expand' に偽を指定すると、パスは展開されません。

     'scheme' が実在するスキームでなかった場合、*note get_paths(): 160.
     は *note KeyError: 7e5. を発生させます。


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(): 14d7.), although the exact information
     included depends on the OS; e.g., on Linux, the kernel version
     isn't particularly important.

     返される値の例:

        - linux-x86_64

        - linux-aarch64

        - solaris-2.6-sun4u

     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: 51f. を返します。

 -- の関数: 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(): 15fd.、*note get_python_version(): 15fe.、
*note get_path(): 16e7. および *note get_config_vars(): 525. が返す情報
を標準出力に出力します。


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(): 333.

通常このモジュールはほとんどのアプリケーションで明示的にアクセスされるこ
とはありませんが、組み込みの値と同じ名前のオブジェクトを提供するモジュー
ルが同時にその名前の組み込みオブジェクトも必要とするような場合には有用で
す。たとえば、組み込みの *note open(): 333. をラップした ‘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__: 1ca. 属性です。これは実
装の詳細部分なので、異なる Python の実装では ‘__builtins__’ は使われてい
ないこともあります。

参考
....

   * *note 組み込み定数: 268c.

   * *note 組み込み例外: 1e3d.

   * *note 組み込み関数: 1616.

   * *note 組み込み型: 2801.


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 モジュール: 224b. を参照してください。

* 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: 4d1. オプションとして渡され
     る 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: 44c. オプションで渡される 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 モジュール: 224b. セクションを参照してください。


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(): 506.  For
example:

     sys.exit(main())

Since the call to ‘main’ is wrapped in *note sys.exit(): 506, 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(): 506. 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:
d09.  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
パッケージ: 225b. 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: 4d1. 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 パッケージ内参照: 225f.
in the *note モジュール: 224b. 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: 11a. 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: c6. for more details on the *note -m: 4d1. flag to the
interpreter executable.

See *note zipapp: 139. 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: 224c.) 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: 19da. 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__: 2674.
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: c5.


File: python.info,  Node: warnings --- 警告の制御,  Next: dataclasses --- データクラス,  Prev: __main__ --- トップレベルのコード環境,  Up: Python ランタイムサービス

5.30.6 ‘warnings’ -- 警告の制御
-------------------------------

'ソースコード:' Lib/warnings.py(1)

__________________________________________________________________

警告メッセージは一般に、ユーザに警告しておいた方がよいような状況下にプロ
グラムが置かれているが、その状況は (通常は) 例外を送出したりそのプログラ
ムを終了させるほどの正当な理由がないといった状況で発されます。例えば、プ
ログラムが古いモジュールを使っている場合には警告を発したくなるかもしれま
せん。

Python プログラマは、このモジュールの *note warn(): 18d1. 関数を使って警
告を発することができます。(C 言語のプログラマは *note PyErr_WarnEx():
1804. を使います; 詳細は *note 例外処理: 4c78. を参照してください)。

警告メッセージは通常 *note sys.stderr: d09. に出力されますが、すべての警
告を無視したり、警告を例外にしたりと、その処理を柔軟に変更することができ
ます。 警告の処理は *note warning category: 2925. 、警告メッセージのテキ
スト、警告が発行されたソースの位置に基づいて変化します。 同じソースの位
置で特定の警告が繰り返された場合、通常は抑制されます。

警告制御には 2 つの段階 (stage) があります: 第一に、警告が発されるたびに
、メッセージを出力すべきかどうかの決定が行われます; 次に、メッセージを出
力するなら、メッセージはユーザによって設定が可能なフックを使って書式化さ
れ印字されます。

警告メッセージを出力するかどうかの決定は、 *note 警告フィルタ: 1d7. によ
って制御されます。警告フィルタは一致規則 (matching rule)と動作からなるシ
ーケンスです。 *note filterwarnings(): 1861. を呼び出して一致規則をフィ
ルタに追加することができ、 *note resetwarnings(): 4c79. を呼び出してフィ
ルタを標準設定の状態にリセットすることができます。

警告メッセージの印字は *note showwarning(): 4c7a. を呼び出して行うことが
でき、この関数は上書きすることができます; この関数の標準の実装では、
*note formatwarning(): 2006. を呼び出して警告メッセージを書式化しますが
、この関数についても自作の実装を使うことができます。

参考
....

*note logging.captureWarnings(): 3413. を使うことで、標準ロギング基盤で
すべての警告を扱うことができます。

* Menu:

* 警告カテゴリ::
* 警告フィルタ::
* 一時的に警告を抑制する::
* 警告のテスト::
* Updating Code For New Versions of Dependencies::
* 利用可能な関数::
* 利用可能なコンテキストマネージャー::
* Concurrent safety of Context Managers::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/warnings.py


File: python.info,  Node: 警告カテゴリ,  Next: 警告フィルタ,  Up: warnings --- 警告の制御

5.30.6.1 警告カテゴリ
.....................

警告カテゴリを表現する組み込み例外は数多くあります。このカテゴリ化は警告
をグループごとフィルタする上で便利です。

これらは厳密に言えば *note 組み込み例外: 2923. ですが、概念的には警告メ
カニズムに属しているのでここで記述されています。

標準の警告カテゴリをユーザの作成したコード上でサブクラス化することで、さ
らに別の警告カテゴリを定義することができます。警告カテゴリは常に *note
Warning: 2926. クラスのサブクラスでなければなりません。

現在以下の警告カテゴリクラスが定義されています:

クラス                                 説明
                                       
-------------------------------------------------------------------------------------------
                                       
*note Warning: 2926.                   すべての警告カテゴリクラスの基底クラスです。
                                       *note Exception: da2. のサブクラスです。
                                       
                                       
*note UserWarning: 2927.               *note warn(): 18d1. の標準のカテゴリです。
                                       
                                       
*note DeprecationWarning: 2d4.         他の Python 開発者へ向けて警告を発するときの、非
                                       推奨の機能についての警告の基底カテゴリです
                                       (‘__main__’ によって引き起こされない限り通常は無
                                       視されます)。
                                       
                                       
*note SyntaxWarning: 451.              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: 6e3.             そのランタイム機能があいまいであることを示す警告
                                       カテゴリの基底クラスです。
                                       
                                       
*note FutureWarning: 84d.              Python で書かれたアプリケーションのエンドユーザー
                                       へ向けて警告を発するときの、非推奨の機能について
                                       の警告の基底カテゴリです。
                                       
                                       
*note PendingDeprecationWarning: c9f.  将来その機能が非推奨になることを示す警告カテゴリ
                                       の基底クラスです(デフォルトでは無視されます)。
                                       
                                       
*note ImportWarning: 90c.              モジュールのインポート処理中に引き起こされる警告
                                       カテゴリの基底クラスです (デフォルトでは無視され
                                       ます)。
                                       
                                       
*note UnicodeWarning: 17dc.            Unicode に関係した警告カテゴリの基底クラスです。
                                       
                                       
*note BytesWarning: 2fa.               *note bytes: 1d2. や *note bytearray: 1d1. に関連
                                       した警告カテゴリの基底クラスです。
                                       
                                       
*note ResourceWarning: 754.            リソースの使用に関連した警告カテゴリの基底クラス
                                       です (デフォルトでは無視されます)。
                                       

バージョン 3.7 で変更: Previously *note DeprecationWarning: 2d4. and
*note FutureWarning: 84d. 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: 1cb. and *note PYTHONWARNINGS: 1cc, if 'message' starts
     and ends with a forward slash (‘/’), it specifies a regular
     expression as above; otherwise it is a literal string that the
     start of the warning message must match (case-insensitively),
     ignoring any whitespace at the start or end of 'message'.

   * 'category' はクラス (*note Warning: 2926. のサブクラス) です。警告
     クラスはこのクラスのサブクラスに一致しなければなりません。

   * 'module' is a string containing a regular expression that the start
     of the fully qualified module name must match, case-sensitively.
     In *note -W: 1cb. and *note PYTHONWARNINGS: 1cc, if 'module' starts
     and ends with a forward slash (‘/’), it specifies a regular
     expression as above; otherwise it 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: 2926. クラスは組み込みの *note Exception: da2. クラスから
派生しているので、警告をエラーに変換するには単に ‘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: 1cb. options passed to
the Python interpreter command line and the *note PYTHONWARNINGS: 1cc.
environment variable.  The interpreter saves the arguments for all
supplied entries without interpretation in *note sys.warnoptions: 3ad.;
the ‘warnings’ module parses these when it is first imported (invalid
options are ignored, after printing a message to *note sys.stderr:
d09.).

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
警告フィルタ: 1d7.  When listing multiple filters on a single line (as
for *note PYTHONWARNINGS: 1cc.), 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: 1cb. コマンドラインオプション、 *note PYTHONWARNINGS: 1cc.
環境変数または *note filterwarnings(): 1861. の呼び出しでオーバーライド
できます。

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: 3e3, the list of default warning filters is
empty.

バージョン 3.2 で変更: *note PendingDeprecationWarning: c9f. に加えて、
*note DeprecationWarning: 2d4. もデフォルトで無視されるようになりました
。

バージョン 3.7 で変更: *note DeprecationWarning: 2d4. is once again
shown by default when triggered directly by code in ‘__main__’.

バージョン 3.7 で変更: *note BytesWarning: 2fa. no longer appears in the
default filter list and is instead configured via *note sys.warnoptions:
3ad. when *note -b: 2f9. 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: 3ad. 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: 2d4. 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: 42a.
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: 4c86.
          for details on the concurrency-safety of the *note
          catch_warnings: 42a. 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:
42a. コンテキストマネージャーを利用します。このクラスを使うと、一時的に
警告フィルタを操作してテストに利用できます。例えば、次のコードでは、発生
したすべての警告を取得してチェックしています:

     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: 4c86.
          for details on the concurrency-safety of the *note
          catch_warnings: 42a. 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: 2d4. (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: 10f.
module does this).

In less ideal cases, applications can be checked for use of deprecated
interfaces by passing *note -Wd: 1cb. 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 警告カテゴリクラス: 2925. でなければなり
     ません; 標準の値は *note UserWarning: 2927. です。 'message' を
     *note Warning: 2926. インスタンスで代用することもできますが、この場
     合 'category' は無視され、 ‘message.__class__’ が使われ、メッセージ
     文は ‘str(message)’ になります。発された例外が前述した *note
     警告フィルタ: 1d7. によってエラーに変更された場合、この関数は例外を
     送出します。引数 '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: 754. を
     発生させた破壊されたオブジェクトです。

     バージョン 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():
     18d1, 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: 2926. 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 module regular expression in *note warnings filter:
     1d7. will be tested against the module names constructed from the
     path components starting from all parent directories (with
     ‘/__init__.py’, ‘.py’ and, on Windows, ‘.pyw’ stripped) and against
     the filename with ‘.py’ stripped.  For example, when the filename
     is ‘'/path/to/package/module.py'’, it will be tested against
     ‘'path.to.package.module'’, ‘'to.package.module'’
     ‘'package.module'’, ‘'module'’, and ‘'/path/to/package/module'’.

     '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: 754. を
     発生させた破壊されたオブジェクトです。

     バージョン 3.6 で変更: 'source' 引数を追加しました。

     バージョン 3.15 で変更: If no module is passed, test the filter
     regular expression against module names created from the path, not
     only the path itself.

 -- の関数: warnings.showwarning (message, category, filename, lineno,
          file=None, line=None)

     警告をファイルに書き込みます。標準の実装では、
     ‘formatwarning(message, category, filename, lineno, line)’ を呼び出
     し、返された文字列を 'file' に書き込みます。 'file' は標準では
     *note sys.stderr: d09. です。この関数は ‘warnings.showwarning’ に任
     意の呼び出し可能オブジェクトを代入して置き換えることができます。
     'line' は警告メッセージに含めるソースコードの1行です。 'line' が与
     えられない場合、 *note showwarning(): 4c7a. は 'filename' と
     'lineno' から行を取得することを試みます。

 -- の関数: warnings.formatwarning (message, category, filename, lineno,
          line=None)

     警告を通常の方法で書式化します。返される文字列内には改行が埋め込ま
     れている可能性があり、かつ文字列は改行で終端されています。 'line' は
     警告メッセージに含まれるソースコードの1行です。 'line' が渡されない
     場合、 *note formatwarning(): 2006. は 'filename' と 'lineno' から
     行の取得を試みます。

 -- の関数: warnings.filterwarnings (action, message='',
          category=Warning, module='', lineno=0, append=False)

     *note 警告フィルタ仕様: 1d7. のリストにエントリを一つ挿入します。標
     準ではエントリは先頭に挿入されます; 'append' が真ならば、末尾に挿入
     されます。この関数は引数の型をチェックし、 'message' および
     'module' の正規表現をコンパイルしてから、これらをタプルにして警告フ
     ィルタのリストに挿入します。二つのエントリが特定の警告に合致した場
     合、リストの先頭に近い方のエントリが後方にあるエントリに優先します
     。引数が省略されると、標準ではすべてにマッチする値に設定されます。

 -- の関数: warnings.simplefilter (action, category=Warning, lineno=0,
          append=False)

     単純なエントリを *note 警告フィルタ仕様: 1d7. のリストに挿入します
     。引数の意味は *note filterwarnings(): 1861. と同じですが、この関数
     により挿入されるフィルタはカテゴリと行番号が一致していればすべての
     モジュールのすべてのメッセージに合致しますので、正規表現は必要あり
     ません。

 -- の関数: warnings.resetwarnings ()

     警告フィルタをリセットします。これにより、 *note -W: 1cb. コマンド
     ラインオプションによるもの *note simplefilter(): ab3. 呼び出しによ
     るものを含め、 *note filterwarnings(): 1861. の呼び出しによる影響は
     すべて無効化されます。

 -- の関数: @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: 77b. 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: 477d. decorator for the attribute to exist on
     the overload as returned by *note typing.get_overloads(): aa1.

     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)

     警告フィルタと *note showwarning(): 4c7a. 関数をコピーし、終了時に
     復元するコンテキストマネージャーです。 'record' 引数が *note False:
     ef9. (デフォルト値)だった場合、コンテキスト開始時には *note None:
     a6a. を返します。もし 'record' が *note True: fd0. だった場合、リス
     トを返します。このリストにはカスタムの ‘showwarning()’ 関数(この関
     数は同時に ‘sys.stdout’ への出力を抑制します)によってオブジェクトが
     継続的に追加されます。リストの中の各オブジェクトは、
     ‘showwarning()’ 関数の引数と同じ名前の属性を持っています。

     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(): ab3. as if it were called
     immediately on entering the context.

     See *note 警告フィルタ: 1d7. for the meaning of the 'category' and
     'lineno' parameters.

          注釈: See *note Concurrent safety of Context Managers: 4c86.
          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: 42a. context manager depends on
the *note sys.flags.context_aware_warnings: 436. 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: 3a13. 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: 436. flag is false, then *note
catch_warnings: 42a. 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: 42a. will not modify global
attributes and will instead use a *note ContextVar: 1abc. 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(): 4c7a. function.  That is not
concurrent-safe.

When 'record' is true and the flag is true, the *note showwarning():
4c7a. 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: 436. flag can be set the *note -X
context_aware_warnings: 183. command-line option or by the *note
PYTHON_CONTEXT_AWARE_WARNINGS: 1aa3. 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: 426. flag to true.  That flag
          causes threads created by *note threading.Thread: 427. to
          start with a copy of the context variables from the thread
          starting it.  When true, the context established by *note
          catch_warnings: 42a. 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: 436. flag and the use of a context
variable for *note catch_warnings: 42a. 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__(): 306. や *note __repr__(): 1c7. のよ
うな *note 特殊メソッド: 1e76. を生成し、ユーザー定義のクラスに自動的に
追加するデコレーターや関数を提供します。このモジュールは元々、 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:

* モジュールの内容: モジュールの内容<6>.
* 初期化後の処理::
* クラス変数::
* 初期化限定変数::
* 凍結されたインスタンス::
* 継承: 継承<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/main/Lib/dataclasses.py

   (2) https://peps.python.org/pep-0557/

   (3) https://peps.python.org/pep-0526/


File: python.info,  Node: モジュールの内容<6>,  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 特殊メソッド: 1e76. を生成し、クラスに追
     加する *note decorator: b1d. です。

     ‘@dataclass’ デコレータは、‘field’ を探すためにクラスを検査します。
     ‘field’ は *note 型アノテーション: 110e. を持つクラス変数として定義
     されます。後述する２つの例外を除き、 ‘@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__(): 306. method
          will be generated.

          If the class already defines ‘__init__()’, this parameter is
          ignored.

        - 'repr': If true (the default), a *note __repr__(): 1c7. 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__(): ec4. method
          will be generated.  This method compares the class as if it
          were a tuple of its fields, in order.  Both instances in the
          comparison must be of the identical type.

          If the class already defines ‘__eq__()’, this parameter is
          ignored.

        - 'order': If true (the default is ‘False’), *note __lt__():
          165a, *note __le__(): 16c4, *note __gt__(): 16c5, and *note
          __ge__(): 16c6. 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: 15a. is
          raised.

          If the class already defines any of ‘__lt__()’, ‘__le__()’,
          ‘__gt__()’, or ‘__ge__()’, then *note TypeError: 29c. is
          raised.

        - 'unsafe_hash': If true, force ‘dataclasses’ to create a *note
          __hash__(): ec5. 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(): 9e7, 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__(): ec5. 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:
          29c.

          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: e51, 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: 4c92. below.

          If *note __setattr__(): 258c. or *note __delattr__(): 258d. is
          defined in the class and 'frozen' is true, then *note
          TypeError: 29c. is raised.

        - 'match_args': If true (the default is ‘True’), the *note
          __match_args__: 1e8b. tuple will be created from the list of
          non keyword-only parameters to the generated *note __init__():
          306. 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__(): 306. parameter generated from a keyword-only field
          must be specified with a keyword when ‘__init__()’ is called.
          See the *note parameter: 255a. glossary entry for details.
          Also see the *note KW_ONLY: 1928. section.

          Keyword-only fields are not included in ‘__match_args__’.

          Added in version 3.10.

        - 'slots': If true (the default is ‘False’), *note __slots__:
          18a3. 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: 29c. is
          raised.

               警告: Passing parameters to a base class *note
               __init_subclass__(): a27. when using ‘slots=True’ will
               result in a *note TypeError: 29c.  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:
          25ce.  Therefore, do not use ‘__slots__’ to retrieve the field
          names of a dataclass.  Use *note fields(): 1b6e. 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: 139e.  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__(): 306. method, which will be defined as:

          def __init__(self, a: int, b: int = 0):

     デフォルト値を指定しないフィールドを、デフォルト値を指定したフィー
     ルドの後ろに定義すると、 *note TypeError: 29c. が送出されます。これ
     は、単一のクラスであっても、クラス継承の結果でも起きえます。

 -- の関数: 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: 1927. 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__(): 306. method.

        - 'repr': If true (the default), this field is included in the
          string returned by the generated *note __repr__(): 1c7.
          method.

        - 'hash': This can be a bool or ‘None’.  If true, this field is
          included in the generated *note __hash__(): ec5. 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__():
          ec4, *note __gt__(): 16c5, et al.).

        - 'metadata': This can be a mapping or ‘None’.  ‘None’ is
          treated as an empty dict.  This value is wrapped in *note
          MappingProxyType(): 194. to make it read-only, and exposed on
          the *note Field: 1b8d. 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__(): 306.
          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: 6ec. 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.

     バージョン 3.15 で変更: If 'metadata' is ‘None’, use an empty *note
     frozendict: 18d, instead of a *note MappingProxyType(): 194. of an
     empty *note dict: 193.

 -- クラス: dataclasses.Field

     ‘Field’ objects describe each defined field.  These objects are
     created internally, and are returned by the *note fields(): 1b6e.
     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(): 1966.
          function.

     他の属性があることもありますが、それらはプライベートであり、調べた
     り、依存したりしてはなりません。

 -- クラス: dataclasses.InitVar

     ‘InitVar[T]’ type annotations describe variables that are *note
     init-only: 4c93.  Fields annotated with ‘InitVar’ are considered
     pseudo-fields, and thus are neither returned by the *note fields():
     1b6e. function nor used in any way except adding them as parameters
     to *note __init__(): 306. and an optional *note __post_init__():
     4c94.

 -- の関数: dataclasses.fields (class_or_instance)

     このデータクラスのフィールドを定義する *note Field: 1b8d. オブジェ
     クトをタプルで返します。 データクラスあるいはデータクラスのインスタ
     ンスを受け付けます。 データクラスやデータクラスのインスタンスが渡さ
     れなかった場合は、 *note TypeError: 29c. を送出します。 ‘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,
     frozendicts, lists, and tuples are recursed into.  Other objects
     are copied with *note copy.deepcopy(): f2f.

     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: 29c. 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, frozendicts, lists, and
     tuples are recursed into.  Other objects are copied with *note
     copy.deepcopy(): f2f.

     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: 29c. 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,
          qualname=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: a9f. 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: 6ec.

     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.

     If 'qualname' is defined, the *note __qualname__: 2583. attribute
     of the dataclass is set to that value.  By default, it is set to
     the value passed to 'cls_name'.

     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: 6ec.  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__: 672.
     can then apply the *note @dataclass: 6ec. 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.

     Added in version 3.16.0a0 (unreleased): Added the 'qualname'
     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: 29c.  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__(): 306. method of the dataclass.  This ensures that *note
     __post_init__(): 4c94, 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__(): 4c94.

     It is an error for 'changes' to contain any fields that are defined
     as having ‘init=False’.  A *note ValueError: 15a. 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__(): 4c94, 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(): 461.

 -- の関数: dataclasses.is_dataclass (obj)

     Return ‘True’ if its parameter is a dataclass (including subclasses
     of a dataclass, but not including *note generic aliases: aa4.) 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__(): 306. 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__(): 258c. または *note __delattr__(): 258d. が呼び
     出されたときに送出されます。これは *note AttributeError: 1b4. のサ
     ブクラスです。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91126


File: python.info,  Node: 初期化後の処理,  Next: クラス変数,  Prev: モジュールの内容<6>,  Up: dataclasses --- データクラス

5.30.7.2 初期化後の処理
.......................

 -- の関数: dataclasses.__post_init__ ()

     When defined on the class, it will be called by the generated *note
     __init__(): 306, 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__(): 306. method generated by *note @dataclass: 6ec.
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__(): 4c94. 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(): 1c8f. が ‘init=False’ であ
るフィールドをどう取り扱うかについての警告も参照してください。


File: python.info,  Node: クラス変数,  Next: 初期化限定変数,  Prev: 初期化後の処理,  Up: dataclasses --- データクラス

5.30.7.3 クラス変数
...................

One of the few places where *note @dataclass: 6ec. 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: 774.  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(): 1b6e. 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: 6ec. 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: 1dcd.  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(): 1b6e. function.  Init-only fields are added
as parameters to the generated *note __init__(): 306. method, and are
passed to the optional *note __post_init__(): 4c94. 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(): 1b6e. will return *note Field: 1b8d.
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: 6ec. decorator you can
emulate immutability.  In that case, dataclasses will add *note
__setattr__(): 258c. and *note __delattr__(): 258d. methods to the
class.  These methods will raise a *note FrozenInstanceError: 1930. when
invoked.

There is a tiny performance penalty when using ‘frozen=True’: *note
__init__(): 306. 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: 6ec.
decorator, it looks through all of the class's base classes in reverse
MRO (that is, starting at *note object: e51.) 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: 32e, as specified in class ‘C’.

The generated *note __init__(): 306. 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__(): 306. で必要なパラメータが算出されると、キーワード専用
引数は他の一般的な（非キーワード専用）パラメータの後に移動します。これは
、すべてのキーワード専用引数は、非キーワード専用パラメータの末尾にこなけ
ればならないという、キーワード専用パラメータの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(): 1966. 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__(): 306. (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: 6ec. decorator will raise a
*note ValueError: 15a. 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: 4e0, *note dict: 193, or *note set: 432, 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: 1011. as their
default value have the following special behaviors:

   * The value for the field passed to the dataclass's *note __init__():
     306. method is passed to the descriptor's *note __set__(): 25c9.
     method rather than overwriting the descriptor object.

   * Similarly, when getting or setting the field, the descriptor's
     *note __get__(): 18a0. or ‘__set__()’ method is called rather than
     returning or overwriting the descriptor object.

   * To determine whether a field contains a default value, *note
     @dataclass: 6ec. 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: 1b4. 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: 215. 文に関わる一般的なタスクのためのユーテ
ィリティを提供します。詳しい情報は、 *note コンテキストマネージャ型:
2620. と *note with文とコンテキストマネージャ: 2591. を参照してください
。

* Menu:

* ユーティリティ::
* 例とレシピ: 例とレシピ<3>.
* 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/contextlib.py


File: python.info,  Node: ユーティリティ,  Next: 例とレシピ<3>,  Up: contextlib --- with 文コンテキスト用ユーティリティ

5.30.8.1 ユーティリティ
.......................

以下の関数とクラスを提供しています:

 -- クラス: contextlib.AbstractContextManager

     An *note abstract base class: 1574. for classes that implement
     *note __enter__(): 9cb. and *note __exit__(): 16ba.  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 コンテキストマネージャ型:
     2620.

     Added in version 3.6.

 -- クラス: contextlib.AbstractAsyncContextManager

     An *note abstract base class: 1574. for classes that implement
     *note __aenter__(): 2631. and *note __aexit__(): 1bcc.  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): 9f8.

     Added in version 3.7.

 -- の関数: @contextlib.contextmanager

     この関数は *note with: 215. 文コンテキストマネージャのファクトリ関
     数を定義するために利用できる *note デコレータ: b1d. です。新しいク
     ラスや *note __enter__(): 9cb. と *note __exit__(): 16ba. メソッド
     を別々に定義しなくても、ファクトリ関数を定義することができます。

     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 ジェネレータ:
     1417.-イテレータを返す必要があります。このイテレータは必ず値を1つ
     yield しなければなりません。 *note with: 215. 文の ‘as’ 節が存在す
     るなら、その値は as 節のターゲットへ束縛されることになります。

     ジェネレータが yield を実行した箇所で *note with: 215. 文のネストさ
     れたブロックが実行されます。ブロックから抜けた後でジェネレータは再
     開されます。ブロック内で処理されない例外が発生した場合は、ジェネレ
     ータ内部の yield を実行した箇所で例外が再送出されます。なので、(も
     しあれば) エラーを捕捉したり、クリーンアップ処理を確実に実行したり
     するために、*note try: adb...*note except: 44e...*note finally:
     453. 構文を使用できます。例外を捕捉する目的が、(完全に例外を抑制し
     てしまうのではなく) 単に例外のログをとるため、もしくはあるアクショ
     ンを実行するためなら、ジェネレータはその例外を再送出しなければなり
     ません。例外を再送出しない場合、ジェネレータのコンテキストマネージ
     ャは ‘with’ 文に対して例外が処理されたことを示し、‘with’ 文の直後の
     文から実行を再開します。

     *note contextmanager(): 219. は *note ContextDecorator: 217. を使っ
     ているので、 ‘contextmanager()’ で作ったコンテキストマネージャは
     *note with: 215. 文だけでなくデコレータとしても利用できます。デコレ
     ーターとして利用された場合、新しい generator インスタンスが関数呼び
     出しのたびに暗黙に生成されます (このことによって、
     ‘contextmanager()’ によって作られたなにがしか「単発」コンテキストマ
     ネージャを、コンテキストマネージャがデコレータとして使われるために
     は多重に呼び出されることをサポートする必要がある、という要件に合致
     させることが出来ます。)

     バージョン 3.2 で変更: *note ContextDecorator: 217. の使用。

 -- の関数: @contextlib.asynccontextmanager

     *note contextmanager(): 219. と似ていますが、 *note
     非同期コンテキストマネージャ (asynchronous context manager): 9f8. を
     生成します。

     この関数は *note async with: 216. 文のための非同期コンテキストマネ
     ージャのファクトリ関数を定義するために利用できるデコレータ (*note
     decorator: b1d.) です。新しいクラスや *note __aenter__(): 2631. と
     *note __aexit__(): 1bcc. メソッドを個別に定義する必要はありません。
     このデコレータは非同期ジェネレータ (*note asynchronous generator:
     26b1.) 関数に適用しなければなりません。

     簡単な例:

          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(): 21a. とともに定義されたコンテキストマ
     ネージャは、デコレータとして使うことも *note async with: 216. 文と
     組み合わせて使うこともできます:

          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(): 21a. で生成された単回使用のコンテキストマネ
     ージャが複数回呼び出し可能となり、コンテキストマネージャをデコレー
     タとして使うことができるための要件を満たすようにすることができます
     。

     バージョン 3.10 で変更: *note asynccontextmanager(): 21a. により生
     成された非同期コンテキストマネージャをデコレータとして使うことがで
     きるようになりました。

 -- の関数: 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: 215. ブロックを出るときに ‘page.close()’ が呼ばれます。

          注釈: Most types managing resources support the *note context
          manager: 47f. protocol, which closes 'thing' on leaving the
          *note with: 215. 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(): 586. 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: 42f. や例外によっ
     て早期にブロックが終了した場合に、 ‘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__(): 9cb, 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 非同期コンテキストマネージャ: 9f8. の代役として使うこともでき
     ます:

          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: 9d7.) のサポートが追加されました。

 -- の関数: 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 再入可能(リエントラント): 4ca6.
     です。

     If the code within the ‘with’ block raises a *note
     BaseExceptionGroup: 76d, 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(): 1c5e. method.

     Added in version 3.4.

     バージョン 3.12 で変更: ‘suppress’ now supports suppressing
     exceptions raised as part of a *note BaseExceptionGroup: 76d.

 -- の関数: contextlib.redirect_stdout (new_target)

     Context manager for temporarily redirecting *note sys.stdout: ea0.
     to another *note file object: 1581.

     This tool adds flexibility to existing functions or classes whose
     output is hardwired to *note sys.stdout: ea0.

     For example, the output of *note help(): cad. normally is sent to
     'sys.stdout'.  You can capture that output in a string by
     redirecting the output to an *note io.StringIO: 12d8. object.  The
     replacement stream is returned from the *note __enter__(): 9cb.
     method and so is available as the target of the *note with: 215.
     statement:

          with redirect_stdout(io.StringIO()) as f:
              help(pow)
          s = f.getvalue()

     *note help(): cad. の出力をディスク上のファイルに送るためには、出力
     を通常のファイルにリダイレクトします:

          with open('help.txt', 'w') as f:
              with redirect_stdout(f):
                  help(pow)

     *note help(): cad. の出力を標準エラー出力 ('sys.stderr') に送るには
     以下のようにします:

          with redirect_stdout(sys.stderr):
              help(pow)

     *note sys.stdout: ea0. のシステム全体にわたる副作用により、このコン
     テキストマネージャはライブラリコードやマルチスレッドアプリケーショ
     ンでの使用には適していません。また、サブプロセスの出力に対しても効
     果がありません。そのような制限はありますが、それでも多くのユーティ
     リティスクリプトに対して有用なアプローチです。

     このコンテキストマネージャは *note 再入可能(リエントラント): 4ca6.
     です。

     Added in version 3.4.

 -- の関数: contextlib.redirect_stderr (new_target)

     Similar to *note redirect_stdout(): 11a3. but redirecting the
     global *note sys.stderr: d09. to another *note file object: 1581.

     このコンテキストマネージャは *note 再入可能(リエントラント): 4ca6.
     です。

     Added in version 3.5.

 -- の関数: contextlib.chdir (path)

     現在の作業ディレクトリを変更するパラレル非安全なコンテキストマネー
     ジャです。グローバルな状態である作業ディレクトリを変更するため、ほ
     とんどのマルチスレッドまたは非同期のコンテキストに対する利用は適切
     ではありません。また、プログラムの実行権限を一時的に放棄するジェネ
     レータのような、直線的でないコードを実行する場合も適切ではありませ
     ん - 明確に必要でないかぎり、このコンテキストマネージャがアクティブ
     な状態で yield すべきではありません。

     これは *note chdir(): a07. の単純なラッパーで、コンテキストに入ると
     きに現在の作業ディレクトリを変更し、終了時に元の作業ディレクトリを
     復元します。

     このコンテキストマネージャは *note 再入可能(リエントラント): 4ca6.
     です。

     Added in version 3.11.

 -- クラス: contextlib.ContextDecorator

     コンテキストマネージャをデコレータとしても使用できるようにする基底
     クラスです。

     Context managers inheriting from ‘ContextDecorator’ have to
     implement *note __enter__(): 9cb. and *note __exit__(): 16ba. as
     normal.  ‘__exit__’ retains its optional exception handling even
     when used as a decorator.

     *note contextmanager(): 219. は ‘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: 215. 文に対応する必要
          があります。そうでないなら、明示的な ‘with’ 文を関数内で利用す
          るべきです。

     When the decorated callable is a generator function, coroutine
     function, or asynchronous generator function, the returned wrapper
     is of the same kind and keeps the context manager open for the
     lifetime of the iteration or await rather than only for the call
     that creates the generator or coroutine object.  Wrapped generators
     and asynchronous generators are explicitly closed when iteration
     ends, as if by *note closing(): 3f3. or *note aclosing(): bcd.

          注釈: For asynchronous generators the wrapper re-yields each
          value with ‘async for’; values sent with *note asend(): caf.
          and exceptions thrown with *note athrow(): 90b. are not
          forwarded to the wrapped generator.

     Added in version 3.2.

     バージョン 3.15 で変更: Decorating a generator function, coroutine
     function, or asynchronous generator function now keeps the context
     manager open across iteration or await.  Previously the context
     manager exited as soon as the generator or coroutine object was
     created.

 -- クラス: contextlib.AsyncContextDecorator

     Similar to *note ContextDecorator: 217, but the context manager is
     entered and exited with *note async with: 216.  Decorate coroutine
     functions and asynchronous generator functions with this class; the
     returned wrapper is of the same kind.

          注釈: Synchronous functions and generators are accepted, but
          the wrapper is always asynchronous, so the decorated callable
          must then be awaited or iterated with ‘async for’.  If that
          change of calling convention is not intended, use *note
          ContextDecorator: 217. instead.

     ‘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.

     バージョン 3.15 で変更: Decorating an asynchronous generator
     function now keeps the context manager open across iteration.
     Previously the context manager exited as soon as the generator
     object was created.  Synchronous functions and synchronous
     generator functions are also now accepted, with an asynchronous
     wrapper returned.

 -- クラス: 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__(): 9cb. method returns the ‘ExitStack’
     instance, and performs no additional operations.

     各インスタンスは登録されたコールバックのスタックを管理し、インスタ
     ンスが (明示的に、あるいは *note with: 215. 文の終わりに暗黙的に)
     close されるときに逆順でそれを呼び出します。コンテキストスタックの
     インスタンスが暗黙的にガベージコレクトされたときには callback は呼
     び出され 'ません' 。

     このスタックモデルは、(file オブジェクトのように) ‘__init__’ メソッ
     ドでリソースを確保するコンテキストマネージャーを正しく扱うためのも
     のです。

     登録されたコールバックが登録の逆順で実行されるので、複数のネストさ
     れた *note with: 215. 文を利用するのと同じ振る舞いをします。これは
     例外処理にも適用されます。内側のコールバックが例外を抑制したり置き
     換えたりした場合、外側のコールバックには更新された状態に応じた引数
     が渡されます。

     これは正しく exit callback の stack を巻き戻すための、比較的低レベ
     ルな API です。アプリケーション独自のより高レベルなコンテキストマネ
     ージャーを作るための基板として使うのに適しています。

     Added in version 3.3.

      -- メソッド: enter_context (cm)

          Enters a new context manager and adds its *note __exit__():
          16ba. method to the callback stack.  The return value is the
          result of the context manager's own *note __enter__(): 9cb.
          method.

          コンテキストマネージャーは、普段 *note with: 215. 文で利用され
          た時と同じように、例外を抑制することができます。

          バージョン 3.11 で変更: 'cm' がコンテキストマネージャでなかっ
          た場合、 *note AttributeError: 1b4. の代わりに *note
          TypeError: 29c. 例外を送出します。

          バージョン 3.15 で変更: Added support for arbitrary
          descriptors ‘__enter__()’ and ‘__exit__()’.

      -- メソッド: push (exit)

          Adds a context manager's *note __exit__(): 16ba. method to the
          callback stack.

          As ‘__enter__’ is 'not' invoked, this method can be used to
          cover part of an *note __enter__(): 9cb. implementation with a
          context manager's own *note __exit__(): 16ba. 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__(): 16ba. 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__():
          16ba. methods can.

          この関数はデコレータとしても使えるように、受け取ったオブジェク
          トをそのまま返します。

          バージョン 3.15 で変更: Added support for arbitrary
          descriptors ‘__exit__()’.

      -- メソッド: callback (callback, /, *args, **kwds)

          任意の関数と引数を受け取り、コールバックスタックに追加します。

          他のメソッドと異なり、このメソッドで追加されたコールバックは例
          外を抑制しません (例外の詳細も渡されません)。

          この関数はデコレータとしても使えるように、受け取った callback
          をそのまま返します。

      -- メソッド: pop_all ()

          コールバックスタックを新しい *note ExitStack: 213. インスタン
          スに移して、それを返します。このメソッドは callback を実行しま
          せん。代わりに、新しい stack が (明示的に、あるいは *note
          with: 215. 文の終わりに暗黙的に) 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: 213. に似た *note 非同期コンテキストマネージャ:
     9f8. です。スタック上で同期と非同期の両方のコンテキストマネージャの
     組み合わせをサポートします。また、後処理のためのコルーチンも持って
     います。

     The *note close(): 4ca9. method is not implemented; *note aclose():
     4caa. must be used instead.

      -- メソッド: async enter_async_context (cm)

          Similar to *note ExitStack.enter_context(): 9d5. but expects
          an asynchronous context manager.

          バージョン 3.11 で変更: 'cm' が非同期コンテキストマネージャで
          なかった場合、 *note AttributeError: 1b4. の代わりに *note
          TypeError: 29c. 例外を送出します。

          バージョン 3.15 で変更: Added support for arbitrary
          descriptors ‘__aenter__()’ and ‘__aexit__()’.

      -- メソッド: push_async_exit (exit)

          Similar to *note ExitStack.push(): 4ca7. but expects either an
          asynchronous context manager or a coroutine function.

          バージョン 3.15 で変更: Added support for arbitrary
          descriptors ‘__aexit__()’.

      -- メソッド: push_async_callback (callback, /, *args, **kwds)

          Similar to *note ExitStack.callback(): e49. but expects a
          coroutine function.

      -- メソッド: async aclose ()

          Similar to *note ExitStack.close(): 4ca9. but properly handles
          awaitables.

     *note asynccontextmanager(): 21a. の使用例の続きです:

          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: 213. の第一のユースケースは、クラスのドキュメントにかか
れている通り、一つの *note with: 215. 文で可変数個のコンテキストマネージ
ャーや他のクリーンアップ関数をサポートすることです。ユーザーの入力 (指定
された複数個のファイルを開く場合など) に応じて複数個のコンテキストマネー
ジャーが必要となる場合や、いくつかのコンテキストマネージャーがオプション
となる場合に、可変数個のコンテキストマネージャーが必要になります:

     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: 213. はコンテキストマネージャープ
ロトコルをサポートしていないリソースの管理を *note with: 215. 文を使って
簡単に行えるようにします。


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__(): 9cb. method implementation, 'without' inadvertently
catching exceptions from the *note with: 215. statement body or the
context manager's *note __exit__(): 16ba. method.  By using *note
ExitStack: 213. 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: adb./*note except: 44e./*note finally: 453. 文を使った直接
的なリソース管理インターフェースを提供するべきです。しかし、すべての API
がそのようによく設計されているとは限りません。もしコンテキストマネージャ
ーが提供されている唯一のリソース管理APIであるなら、 *note ExitStack:
213. を使って *note with: 215. 文を使って処理することができない様々なシ
チュエーションの処理をすることができます。


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(): 4ca7, this
method can be useful in cleaning up an already allocated resource if
later steps in the *note __enter__(): 9cb. 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: 213. を使えば、代わりに ‘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(): e49. のデコレーター形式を利用してリソース開放処理
を宣言することができます:

     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: 217. はコンテキストマネージャーを通常の ‘with’ 文
に加えて関数デコレーターとしても利用できるようにします。

例えば、関数やまとまった文を、そこに入った時と出た時の時間をトラックする
ロガーでラップしたい場合があります。そのために関数デコレーターとコンテキ
ストマネージャーを別々に書く代わりに、 *note ContextDecorator: 217. を継
承すると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__(): 9cb.  If that value is needed, then it is still
necessary to use an explicit ‘with’ statement.

参考
....

PEP 343(1) - "with" ステートメント

     Python の *note with: 215. 文の仕様、背景、および例が記載されていま
     す。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0343/


File: python.info,  Node: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ,  Prev: 例とレシピ<3>,  Up: contextlib --- with 文コンテキスト用ユーティリティ

5.30.8.8 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ
...........................................................................

ほとんどのコンテキストマネージャは、 *note with: 215. 文の中で一度だけ使
われるような場合に効果的になるように書かれています。これら単回使用のコン
テキストマネージャは毎回新規に生成されなければなりません - それらを再利
用しようとすると、例外を引き起こすか、正しく動作しません。

この共通の制限が意味することは、コンテキストマネージャは (上記すべての使
用例に示すとおり) 一般に *note with: 215. 文のヘッダ部分で直接生成するこ
とが推奨されるということです。

ファイルオブジェクトは単回使用のコンテキストマネージャ有効に利用した例で
す。最初の *note with: 215. 文によりファイルがクローズされ、それ以降その
ファイルオブジェクトに対するすべての IO 操作を防止します。

*note contextmanager(): 219. により生成されたコンテキストマネージャも単
回使用のコンテキスト マネージャです。二回目に使おうとした場合、内部にあ
るジェネレータが値の生成に失敗したと訴えるでしょう:

     >>> 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: 215. 文で使える
だけでなく、同じコンテキストマネージャをすでに使っている ‘with’ 文の '内
部' でも使うことができます。

*note threading.RLock: 2eb. はリエントラントなコンテキストマネージャの例
であり、また *note suppress(): 12d7, *note redirect_stdout(): 11a3, そし
て *note chdir(): a06. もリエントラントです。以下はリエントラントな利用
法の非常に単純な例です:

     >>> 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(): 11a3. は、 *note
sys.stdout: ea0. を異なるストリームに束縛することによりシステムの状態に
対してグローバルな変更を行うことから、明らかにスレッドセーフではありませ
ん。


File: python.info,  Node: 再利用可能なコンテキストマネージャ,  Prev: リエントラントなコンテキストマネージャ,  Up: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ

5.30.8.10 再利用可能なコンテキストマネージャ
............................................

単回使用のコンテキストマネージャとリエントラントなコンテキストマネージャ
のいずれとも異なるタイプに "再利用可能" なコンテキストマネージャがありま
す (あるいは、より明確には、"再利用可能だがリエントラントでない" コンテ
キストマネージャです。リエントラントなコンテキストマネージャもまた再利用
可能だからです)。再利用可能なコンテキストマネージャは複数回利用をサポー
トしますが、同じコンテキストマネージャのインスタンスがすでに with 文で使
われている場合には失敗します (もしくは正しく動作しません)。

*note threading.Lock: 1a30. は再利用可能だがリエントラントでないコンテキ
ストマネージャの例です (リエントラントなロックのためには *note
threading.RLock: 2eb. を代わりに使う必要があります)。

再利用可能だがリエントラントでないコンテキストマネージャのもうひとつの例
は *note ExitStack: 213. です。これは現在登録されている '全ての' コール
バック関数を、どこで登録されたかにかかわらず、呼び出します:

     >>> 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: 213. インスタンスを再利用する代わりに複数のイ
ンスタンスを使うことにより、この問題は回避することができます:

     >>> 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
抽象基底クラス: 1574. (ABC) を定義する基盤を提供します。なぜこれが
Python に付け加えられたかについてはその PEP を参照してください。 (ABC に
基づいた数の型階層を扱った PEP 3141(3) と *note numbers: a2. モジュール
も参照してください。)

*note collections: 1e. モジュール には、抽象基底クラス から派生するいく
つかの具象クラスがある。もちろん、これらはさらに派生させることができる。
さらに、‘collections.抽象基底クラス’ サブモジュールには、クラスやインス
タンス が特定のインターフェース 、たとえば 、:term:>>'<<hashable'である
か、:term:>>'<<mapping'であるかをテストするために使用できる抽象基底クラ
ス があります。

このモジュールは、 抽象基底クラスを定義するためのメタクラス *note
ABCMeta: 12cd. と、 継承を利用して抽象基底クラスを代替的に定義するヘルパ
ークラス *note ABC: 12cc. を提供します。

 -- クラス: abc.ABC

     メタクラスとして *note ABCMeta: 12cd. を持つヘルパークラスです。こ
     のクラスを使うことで、‘ABC’ を継承するだけで抽象基底クラスを作成で
     き、しばしば混乱しがちなメタクラスの使用を避けることができます。例
     えば:

          from abc import ABC

          class MyABC(ABC):
              pass

     Note that the type of ‘ABC’ is still *note ABCMeta: 12cd, 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(): 2fc. によって登録した ABC のサブクラスと判
     定されますが、登録した ABC は MRO (Method Resolution Order, メソッ
     ド解決順)には現れませんし、この ABC のメソッド実装が(*note super():
     44a. を通してだけでなく)呼び出し可能になるわけでもありません。 (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(): 12cb. function.

     また、次のメソッドを抽象基底クラスの中でオーバーライドできます:

      -- メソッド: __subclasshook__ (subclass)

          (クラスメソッドとして定義しなければなりません。)

          Check whether 'subclass' is considered a subclass of this ABC.
          This means that you can customize the behavior of *note
          issubclass(): 2fc. further without the need to call *note
          register(): 1445. on every class you want to consider a
          subclass of the ABC. (This class method is called from the
          *note __subclasscheck__(): 25dc. method of the ABC.)

          This method should return ‘True’, ‘False’ or *note
          NotImplemented: 447.  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__(): 1031, 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__(): 2bc5. class method defined here says
     that any class that has an *note __iter__(): 1031. method in its
     *note __dict__: 1ca. (or in that of one of its base classes,
     accessed via the *note __mro__: 2588. 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__():
     1031. method (it uses the old-style iterable protocol, defined in
     terms of *note __len__(): 19aa. and *note __getitem__(): 78d.).
     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: 12cd. 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(): 4cb9. function.  The ‘abstractmethod()’
     only affects subclasses derived using regular inheritance; "virtual
     subclasses" registered with the ABC's *note register(): 1445.
     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: 6c1. 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(): 44a. メカニズムを通して
          それをオーバーライドしたクラスから呼び出すことができます。これ
          は協調的多重継承を使ったフレームワークにおいて super 呼び出し
          の終点として有効です。

The ‘abc’ module also supports the following legacy decorators:

 -- の関数: @abc.abstractclassmethod

     Added in version 3.2.

     バージョン 3.3 で非推奨: *note classmethod: 6a0. を *note
     abstractmethod(): 1442. と一緒に使えるようになったため、このデコレ
     ータは冗長になりました。

     組み込みの *note classmethod(): 6a0. のサブクラスで、抽象クラスメソ
     ッドであることを示します。それ以外は *note abstractmethod(): 1442.
     と同じです。

     この特殊ケースは *note classmethod(): 6a0. デコレータが抽象メソッド
     に適用された場合に抽象的だと正しく認識されるようになったため撤廃さ
     れます:

          class C(ABC):
              @classmethod
              @abstractmethod
              def my_abstract_classmethod(cls, arg):
                  ...

 -- の関数: @abc.abstractstaticmethod

     Added in version 3.2.

     バージョン 3.3 で非推奨: *note staticmethod: 66d. を *note
     abstractmethod(): 1442. と一緒に使えるようになったため、このデコレ
     ータは冗長になりました。

     組み込みの *note staticmethod(): 66d. のサブクラスで、抽象静的メソ
     ッドであることを示します。それ以外は *note abstractmethod(): 1442.
     と同じです。

     この特殊ケースは *note staticmethod(): 66d. デコレータが抽象メソッ
     ドに適用された場合に抽象的だと正しく認識されるようになったため撤廃
     されます:

          class C(ABC):
              @staticmethod
              @abstractmethod
              def my_abstract_staticmethod(arg):
                  ...

 -- の関数: @abc.abstractproperty

     バージョン 3.3 で非推奨: *note property: 6c1. 、 *note
     property.getter(): 1c01. 、 *note property.setter(): 1c02. および
     *note property.deleter(): 1c03. を *note abstractmethod(): 1442. と
     一緒に使えるようになったため、このデコレータは冗長になりました。

     組み込みの *note property(): 6c1. のサブクラスで、抽象プロパティで
     あることを示します。

     この特殊ケースは *note property(): 6c1. デコレータが抽象メソッドに
     適用された場合に抽象的だと正しく認識されるようになったため撤廃され
     ます:

          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(): 1445. の呼び出しごと
     に、トークンは変更されます。

     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: 12cd, 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/main/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(): 290d. が呼び出された場合は実
行されません。

'注意:' クリーンアップ関数内からの関数の登録・登録解除効果は定義されてい
ません。

バージョン 3.7 で変更: C-API のサブインタープリタで使われているとき、登
録された関数は登録先のインタープリタのローカルな関数になります。

 -- の関数: atexit.register (func, *args, **kwargs)

     'func' を終了時に実行する関数として登録します。'func' に渡す引数は
     *note register(): c58. の引数として指定しなければなりません。同じ関
     数を同じ引数で複数回登録できます。

     通常のプログラムの終了時、例えば *note sys.exit(): 506. が呼び出さ
     れるとき、あるいは、メインモジュールの実行が完了したときに、登録さ
     れた全ての関数を、最後に登録されたものから順に呼び出します。通常、
     より低レベルのモジュールはより高レベルのモジュールより前に import さ
     れるので、後で後始末が行われるという仮定に基づいています。

     終了ハンドラの実行中に例外が発生すると、(*note SystemExit: 10fb. 以
     外の場合は)トレースバックを表示して、例外の情報を保存します。全ての
     終了ハンドラに動作するチャンスを与えた後に、最後に送出された例外を
     再送出します。

     この関数は 'func' を返し、これをデコレータとして利用できます。

          警告: 登録された関数から新しいスレッドを開始したり、 *note
          os.fork(): 6c3. を呼び出したりすると、メインの Python ランタイ
          ムスレッドがスレッド状態を開放する一方で、内部の *note
          threading: f6. ルーチンや新しいプロセスがそのスレッド状態を使
          用しようと試みる競合が発生します。これはクリーンなシャットダウ
          ンではなく、クラッシュにつながる恐れがあります。

     バージョン 3.12 で変更: 登録された関数から新しいスレッドの開始また
     は新しいプロセスの *note os.fork(): 6c3. が試みられた場合は、 *note
     RuntimeError: 317. が発生するようになりました。

 -- の関数: 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: c2. モジュール

     Useful example of ‘atexit’ to read and write *note readline: c2.
     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(): c58. に指定した位置引数とキーワード引数は登録した関数
を呼び出す際に渡されます:

     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 デコレータ: b1d. として利用する例:

     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: ebe. -- these are objects of
type *note types.TracebackType: ebc, which are assigned to the *note
__traceback__: 1680. field of *note BaseException: 9bd. instances.

参考
....

*note faulthandler: 5b. モジュール

     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: 76a. class and its helper classes *note
     StackSummary: 1237. and *note FrameSummary: 1238.  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: 1ba.

* Menu:

* モジュールレベルの関数: モジュールレベルの関数<2>.
* TracebackException オブジェクト::
* StackSummary オブジェクト::
* FrameSummary オブジェクト::
* Examples of Using the Module-Level Functions::
* Examples of Using TracebackException::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: ebe. '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: d09.;
     otherwise it should be an open *note file: 1581. or *note file-like
     object: 19d1. to receive the output.

          注釈: The meaning of the 'limit' parameter is different than
          the meaning of *note sys.tracebacklimit: 1b7b.  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 トレースバックオブジェクト: ebe. 'tb' から例外の情報とスタッ
     クトレースの項目を 'file' に出力します。 この関数は以下の点で *note
     print_tb(): 1239. と異なります:

        * 'tb' が ‘None’ でない場合ヘッダ ‘Traceback (most recent call
          last):’ を出力します

        * スタックトレースの後に例外タイプと 'value' を出力します

        * 'type(value)' が *note SyntaxError: 189. であり、 '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(): 1239. のものと同
     じです。 'chain' が真の場合 (デフォルト)、連鎖した例外 (例外の
     *note __cause__: 1682. か *note __context__: 1681. 属性) も出力され
     ます。 これはインタープリタ自身が処理されていない例外を出力するとき
     と同じです。

     バージョン 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: 8d3. 参照)。

 -- の関数: traceback.print_stack (f=None, limit=None, file=None)

     'limit' が正の場合、最大 'limit' 個のスタックトレース項目 (呼び出し
     地点から開始) を出力します。 そうでない場合、最新の ‘abs(limit)’ 個
     を出力します。 'limit' が省略されるか ‘None’ の場合、すべての項目が
     出力されます。オプションの 'f' 引数は、開始する *note
     スタックフレーム: ad2. を指定するために用いることができます。オプシ
     ョンの 'file' 引数は *note print_tb(): 1239. の 'file' 引数と同様の
     意味を持っています。

     バージョン 3.5 で変更: 負の 'limit' がサポートされました。

 -- の関数: traceback.extract_tb (tb, limit=None)

     *note トレースバックオブジェクト: ebe. 'tb' から取り出された "前処
     理済み" スタックトレース項目のリストを表す *note StackSummary:
     1237. オブジェクトを返します。これはスタックトレースの異なる書式化
     を行うために役に立ちます。オプションの 'limit' 引数は *note
     print_tb(): 1239. の 'limit' 引数と同様の意味を持っています。 "前処
     理済み" スタックトレース項目は 属性 *note filename: 4cc5, *note
     lineno: 4cc6, *note name: 4cc7, および *note line: 4cc8. を含む
     *note FrameSummary: 1238. オブジェクトで、スタックトレースに対して
     通常出力される情報を表しています。

 -- の関数: traceback.extract_stack (f=None, limit=None)

     現在の *note スタックフレーム: ad2. から生のトレースバックを取り出
     します。戻り値は *note extract_tb(): 4cc4. と同じ形式です。オプショ
     ンの 'f' と 'limit' 引数は *note print_stack(): 123a. と同じ意味を
     持ちます。

 -- の関数: traceback.print_list (extracted_list, file=None)

     Print the list of tuples as returned by *note extract_tb(): 4cc4.
     or *note extract_stack(): 4cc9. as a formatted stack trace to the
     given file.  If 'file' is ‘None’, the output is written to *note
     sys.stderr: d09.

 -- の関数: traceback.format_list (extracted_list)

     *note extract_tb(): 4cc4. または *note extract_stack(): 4cc9. が返
     すタプルのリストまたは *note FrameSummary: 1238. オブジェクトが与え
     られると、出力の準備を整えた文字列のリストを返します。結果として生
     じるリストの中の各文字列は、引数リストの中の同じインデックスの要素
     に対応します。各文字列は末尾に改行が付いています。さらに、ソーステ
     キスト行が ‘None’ でないそれらの要素に対しては、文字列は内部に改行
     を含んでいるかもしれません。

 -- の関数: traceback.format_exception_only (exc, /[, value], *,
          show_group=False)

     Format the exception part of a traceback using an exception value
     such as given by *note sys.last_value: 8d5.  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: 189. 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: 28f8.

     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: 76d, 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: 28f8. attached to the exception.

     バージョン 3.13 で変更: 'show_group' 引数が追加されました。

 -- の関数: traceback.format_exception (exc, /[, value, tb], limit=None,
          chain=True)

     スタックトレースと例外情報を書式化します。引数は *note
     print_exception(): c2b. の対応する引数と同じ意味を持ちます。戻り値
     は文字列のリストで、それぞれの文字列は改行で終わり、そのいくつかは
     内部に改行を含みます。これらの行が連結されて出力される場合は、厳密
     に ‘print_exception()’ と同じテキストが出力されます。

     バージョン 3.5 で変更: 引数 'etype' は無視され、 'value' の型から推
     論されます。

     バージョン 3.10 で変更: This function's behavior and signature were
     modified to match *note print_exception(): c2b.

 -- の関数: 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: ebe. 'tb' by calling the *note clear(): 78a. method of
     each *note frame object: ad2.

     Added in version 3.4.

 -- の関数: traceback.walk_stack (f)

     Walk a stack following *note f.f_back: b70. 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(): 4ccd.

     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: ebd. yielding the frame
     and line number for each frame.  This helper is used with *note
     StackSummary.extract(): 4ccd.

     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: ebe. and *note frame: ad2. 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: 1237. class.

     If 'compact' is true, only data that is required by
     ‘TracebackException’'s *note format(): 440. method is saved in the
     class attributes.  In particular, the *note __context__: 4ccf.
     field is calculated only if *note __cause__: 4cd0. is ‘None’ and
     *note __suppress_context__: 4cd1. is false.

     局所変数がキャプチャされたとき、それらはトレースバックに表示される
     ことに注意してください。

     'max_group_width' and 'max_group_depth' control the formatting of
     exception groups (see *note BaseExceptionGroup: 76d.).  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__: 1682. の ‘TracebackException’。

      -- の属性: __context__

          元々の *note __context__: 1681. の ‘TracebackException’。

      -- の属性: exceptions

          If ‘self’ represents an *note ExceptionGroup: 6de, 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__: 2729.。

      -- の属性: __notes__

          The *note __notes__: 28f8. 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: 1237.。

      -- の属性: exc_type

          元々のトレースバックのクラス。

          バージョン 3.13 で非推奨.

      -- の属性: exc_type_str

          String display of the class of the original exception.

          Added in version 3.13.

      -- の属性: filename

          構文エラー用 - エラーが発生したファイルの名前。

      -- の属性: lineno

          構文エラー用 - エラーが発生した行番号。

      -- の属性: end_lineno

          For syntax errors - the end line number where the error
          occurred.  Can be ‘None’ if not present.

          Added in version 3.10.

      -- の属性: text

          構文エラー用 - エラーが発生したテクスト。

      -- の属性: offset

          構文エラー用 - エラーが発生したテクストへのオフセット。

      -- の属性: end_offset

          For syntax errors - the end offset into the text where the
          error occurred.  Can be ‘None’ if not present.

          Added in version 3.10.

      -- の属性: msg

          構文エラー用 - コンパイラのエラーメッセージ。

      -- メソッド: classmethod from_exception (exc, *, limit=None,
               lookup_lines=True, capture_locals=False)

          後のレンダリングのために例外をキャプチャします。 'limit'、
          'lookup_lines'、'capture_locals' は *note StackSummary: 1237.
          class のものです。

          局所変数がキャプチャされたとき、それらはトレースバックに表示さ
          れることに注意してください。

      -- メソッド: print (*, file=None, chain=True)

          Print to 'file' (default ‘sys.stderr’) the exception
          information returned by *note format(): 440.

          Added in version 3.11.

      -- メソッド: format (*, chain=True)

          例外を書式化します。

          'chain' が ‘True’ でない場合 *note __cause__: 4cd0. と *note
          __context__: 4ccf. は書式化されません。

          返り値は文字列のジェネレータで、それぞれ改行で終わりますが、内
          部に改行を持つものもあります。 *note print_exception(): c2b. は
          このメソッドのラッパで、単にファイルに出力します。

      -- メソッド: 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: 189. 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: 76d, the nested exceptions are
          included as well, recursively, with indentation relative to
          their nesting depth.

          バージョン 3.11 で変更: The exception's *note notes: 28f8. 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(): 1235. や *note
          walk_tb(): 1236. が返すもの) から ‘StackSummary’ を構築します
          。

          If 'limit' is supplied, only this many frames are taken from
          'frame_gen'.  If 'lookup_lines' is ‘False’, the returned *note
          FrameSummary: 1238. 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():
          462. 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: 1238. 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: ad2.
          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: ad2.
          involved in the stack.  This method is called for each *note
          FrameSummary: 1238. object to be printed by *note
          StackSummary.format(): 4ce0.  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: ad2. in a *note
traceback: ebe.

 -- クラス: 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: ad2. in the *note traceback: ebe.
     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: 4cc8. attribute accessed
     (which also happens when casting it to a *note tuple: 1d9.).
     ‘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: 1727. on a *note frame
          object: ad2. 'f'.

      -- の属性: lineno

          The line number of the source code for this frame.

      -- の属性: name

          Equivalent to accessing *note f.f_code.co_name: 2598. on a
          *note frame object: ad2. '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 文:
677. の定義と呼ばれています。これらは特殊なケースで、 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: 677. 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/main/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: 308. と同じフォーマットの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(): 1d3. の第4引数に渡す(ビット
     フィールド)フラグです。このフラグは *note _Feature: 27e0. インスタ
     ンスの *note _Feature.compiler_flag: 25a6. 属性に保存されています。

参考
....

*note future 文 (future statement): 677.

     コンパイラがどのように 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: 15a. 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: 32f. など、実装によって幾つかの
     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 監査イベント: 1e84. ‘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: 157f. list) inside this generation;

        * ‘candidates’ is the total number of objects in this generation
          which were considered for collection and traversed;

        * ‘duration’ is the total time in seconds spent in collections
          for this generation.

     Added in version 3.4.

     バージョン 3.15 で変更: Add ‘duration’ and ‘candidates’.

 -- の関数: 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.

     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(): be2. の前に *note collect(): 456. を呼び出し
     てください。

          警告: *note get_referrers(): be2. から返されるオブジェクトは作
          りかけや利用できない状態である場合があるので、利用する際には注
          意が必要です。 ‘get_referrers()’ をデバッグ以外の目的で利用す
          るのは避けてください。

     引数 ‘objs’ を指定して *note 監査イベント: 1e84. ‘gc.get_referrers’
     を送出します。

 -- の関数: gc.get_referents (*objs)

     引数で指定したオブジェクトのいずれかから参照されている、全てのオブ
     ジェクトのリストを返します。参照先のオブジェクトは、引数で指定した
     オブジェクトの Cレベルメソッド *note tp_traverse: 373. で取得し、全
     てのオブジェクトが直接到達可能な全てのオブジェクトを返すわけではあ
     りません。 ‘tp_traverse’ はガベージコレクションをサポートするオブジ
     ェクトのみが実装しており、ここで取得できるオブジェクトは循環参照の
     一部となる可能性のあるオブジェクトのみです。従って、例えば整数オブ
     ジェクトが直接到達可能であっても、このオブジェクトは戻り値には含ま
     れません。

     引数 ‘objs’ を指定して *note 監査イベント: 1e84. ‘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: 4d00. が設定されている場合、全ての到達不能オブ
     ジェクトは解放されずにこのリストに格納されます。

     バージョン 3.2 で変更: *note インタプリタシャットダウン: 1ab. 時に
     このリストが空でない場合、(デフォルトでは黙りますが) *note
     ResourceWarning: 754. が発行されます。 *note DEBUG_UNCOLLECTABLE:
     1580. がセットされていると、加えて回収不能オブジェクトを出力します
     。

     バージョン 3.4 で変更: Following PEP 442(3), objects with a *note
     __del__(): 13ab. method don't end up in *note gc.garbage: 157f.
     anymore.

 -- データ: gc.callbacks

     ガベージコレクタの起動前と終了後に呼び出されるコールバック関数のリ
     スト。コールバックは 'phase' と 'info' の2つの引数で呼び出されます
     。

     'phase' は以下 2 つのいずれかです:

          "start": ガベージコレクションを始めます。

          "stop": ガベージコレクションが終了しました。

     'info' はコールバックに付加情報を提供する辞書です。現在のところ以下
     のキーが定義されています:

          "generation": 回収される最も古い世代。

          "collected": 'phase' が "stop" のとき、正常に回収されたオブジ
          ェクトの数。

          "uncollectable": 'phase' が "stop" のとき、回収出来ずに *note
          garbage: 157f. リストに入れられたオブジェクトの数。

          "candidates": When 'phase' is "stop", the total number of
          objects in this generation which were considered for
          collection and traversed.

          "duration": When 'phase' is "stop", the time in seconds spent
          in the collection.

     アプリケーションは自身のコールバックをこのリストに追加出来ます。基
     本的なユースケースは以下のようなものでしょう:

          世代が回収される頻度やガベージコレクションにかかった時間の長さ
          といった、ガベージコレクションの統計情報を集めます。

          *note garbage: 157f. に回収できない独自の型のオブジェクトが現
          れたとき、アプリケーションがそれらを特定し消去できるようにする
          。

     Added in version 3.3.

     バージョン 3.15 で変更: Add "duration" and "candidates".

以下は *note set_debug(): 4cfe. に指定することのできる定数です:

 -- データ: gc.DEBUG_STATS

     検出中に統計情報を出力します。この情報は、検出頻度を最適化する際に
     有益です。

 -- データ: gc.DEBUG_COLLECTABLE

     見つかった回収可能オブジェクトの情報を出力します。

 -- データ: gc.DEBUG_UNCOLLECTABLE

     見つかった回収不能オブジェクト（到達不能だが、ガベージコレクション
     で解放する事ができないオブジェクト）の情報を出力します。回収不能オ
     ブジェクトは、 ‘garbage’ リストに追加されます。

     バージョン 3.2 で変更: *note インタプリタシャットダウン: 1ab. 時に
     *note garbage: 157f. リストが空でない場合に、その中身の出力も行いま
     す。

 -- データ: 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.15/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::
* コマンドライン・インターフェース: コマンドライン・インターフェース<11>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/inspect.py


File: python.info,  Node: 型とメンバー,  Next: ソースコードの情報取得,  Up: inspect --- 活動中のオブジェクトを調査する

5.30.14.1 型とメンバー
......................

*note getmembers(): 1e08. は、クラスやモジュールなどのオブジェクトからメ
ンバーを取得します。名前が "is" で始まる関数は、主に ‘getmembers()’ の第
2引数として利用するために提供されています。以下のような特殊属性を参照で
きるかどうか調べる時にも使えるでしょう (モジュール属性については *note
Import-related attributes on module objects: 2570. を参照してください):

型                    属性                    説明
                                              
------------------------------------------------------------------------------
                                              
クラス                __doc__                 ドキュメント文字列
                                              
                                              
                      __name__                クラスの定義名
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      __module__              クラスを定義しているモジュー
                                              ルの名前
                                              
                                              
                      __type_params__         ジェネリッククラスの
                                              *note 型パラメータ (type parameters): 7ab.
                                              を含むタプル
                                              
                                              
メソッド              __doc__                 ドキュメント文字列
                                              
                                              
                      __name__                メソッドの定義名
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      __func__                メソッドを実装している関数オ
                                              ブジェクト
                                              
                                              
                      __self__                メソッドに結合しているインス
                                              タンス、または ‘None’
                                              
                                              
                      __module__              このメソッドが定義されている
                                              モジュールの名前
                                              
                                              
関数                  __doc__                 ドキュメント文字列
                                              
                                              
                      __name__                関数の定義名
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      __code__                関数をコンパイルした
                                              *note バイトコード: 6b9. を格
                                              納するコードオブジェクト
                                              
                                              
                      __defaults__            位置またはキーワード引数の全
                                              ての既定値のタプル
                                              
                                              
                      __kwdefaults__          キーワード専用引数の全ての既
                                              定値のマッピング
                                              
                                              
                      __globals__             関数が定義されたグローバル名
                                              前空間
                                              
                                              
                      __builtins__            組み込みモジュールの名前空間
                                              
                                              
                      __annotations__         仮引数名からアノテーションへ
                                              のマッピング; ‘"return"’ キー
                                              は return アノテーションに予
                                              約されています
                                              
                                              
                      __type_params__         ジェネリック関数の
                                              *note 型パラメータ (type parameters): 7ab.
                                              を含むタプル
                                              
                                              
                      __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 こちら: 25a5. を
                                              参照。
                                              
                                              
                      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’
                                              
                                              
                      gi_state                state of the generator, one
                                              of ‘GEN_CREATED’,
                                              ‘GEN_RUNNING’,
                                              ‘GEN_SUSPENDED’, or
                                              ‘GEN_CLOSED’
                                              
                                              
非同期ジェネレータ    __name__                name
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      ag_await                待機されているオブジェクト、
                                              または ‘None’
                                              
                                              
                      ag_frame                フレーム
                                              
                                              
                      ag_running              ジェネレータが実行中かどうか
                                              
                                              
                      ag_suspended            is the generator suspended?
                                              
                                              
                      ag_code                 コード
                                              
                                              
                      ag_state                state of the async generator,
                                              one of ‘AGEN_CREATED’,
                                              ‘AGEN_RUNNING’,
                                              ‘AGEN_SUSPENDED’, or
                                              ‘AGEN_CLOSED’
                                              
                                              
コルーチン            __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(): f4f.
                                              を参照。
                                              
                                              
                      cr_state                state of the coroutine, one
                                              of ‘CORO_CREATED’,
                                              ‘CORO_RUNNING’,
                                              ‘CORO_SUSPENDED’, or
                                              ‘CORO_CLOSED’
                                              
                                              
組み込み              __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.

バージョン 3.15 で変更: Add ‘gi_state’ attribute to generators,
‘cr_state’ attribute to coroutines, and ‘ag_state’ attribute to async
generators.

 -- の関数: inspect.getmembers (object[, predicate])

     オブジェクトの全てのメンバーを ‘(name, value)’ ペアのリストで返しま
     す。リストは名前 (name) でソートされます。オプション引数
     'predicate' が指定された場合、各メンバーの ‘value’ オブジェクトを引
     数として 'predicate' が呼ばれ、その戻り値が真となるとなるメンバーだ
     けがリストに含まれます。

          注釈: 引数がクラスでその属性がメタクラスで特別に定義された
          *note __dir__(): 1956. に列挙されている場合、*note
          getmembers(): 1e08. はメタクラスで定義されたクラス属性のみを返
          します。

 -- の関数: inspect.getmembers_static (object[, predicate])

     オブジェクトの全てのメンバーを ‘(name, value)’ ペアのリストで返しま
     す。ただし、デスクリプタプロトコルの __getattr__ や
     __getattribute__ を介した動的なルックアップは行いません。オプション
     として、引数に与えられた predicate を満たすメンバーのみを返すことも
     できます。

          注釈: *note getmembers_static(): a3d. は getmembers が取得でき
          るメンバーの全てを取り出すことはできないかもしれません (たとえ
          ば動的に生成された属性など)が、逆に getmembers が見つけること
          のできなかったメンバーを取得できることもあります
          (AttributeError を送出するデスクリプタなど)。また、時にはイン
          スタンスメンバーの代わりにデスクリプタオブジェクトを返すことも
          あります。

     Added in version 3.11.

 -- の関数: inspect.getmodulename (path)

     ファイル 'path' で指定されたモジュールの名前を、そのモジュールを含
     むパッケージの名前を含まない形で返します。ファイル拡張子は、 *note
     importlib.machinery.all_suffixes(): 4d08. の全てのエントリに対して
     一致するかどうかをチェックされます。拡張子が一致した場合、最後のパ
     ス成分から拡張子を除いたものを返します。それ以外の場合は ‘None’ を
     返します。

     この関数は、実際の Python モジュールとして意味のある名前 'だけ' を
     返します。すなわち、 Python パッケージを指している可能性のあるパス
     に対しては、依然として ‘None’ を返します。

     バージョン 3.3 で変更: この関数は直接 *note importlib: 7a. に依存す
     るようになりました。

 -- の関数: inspect.ismodule (object)

     オブジェクトがモジュールの場合 ‘True’ を返します。

 -- の関数: inspect.isclass (object)

     オブジェクトが組み込みか Python が生成したクラスの場合に ‘True’ を
     返します。

     This function returns ‘False’ for *note generic aliases: aa4. 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: 26cd. 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(): 4d0c. will return
          ‘True’:

               >>> Greeter.say_hello
               <function Greeter.say_hello at 0x7f7503854a90>
               >>> ismethod(Greeter.say_hello)
               False
               >>> isfunction(Greeter.say_hello)
               True

          See *note メソッド: 28dc. for details.

 -- の関数: inspect.isfunction (object)

     オブジェクトが、 *note lambda: 2de4. 式で生成されたものを含む
     Python 関数の場合に ‘True’ を返します。

     See the note for *note ismethod(): 4d0b. for an example.

 -- の関数: inspect.ispackage (object)

     Return ‘True’ if the object is a *note package: 4c8.

     Added in version 3.14.

 -- の関数: inspect.isgeneratorfunction (object)

     オブジェクトが Python のジェネレータ関数の場合 ‘True’ を返します。

     It also returns ‘True’ for bound methods created from Python
     generator functions (see *note メソッド: 28dc. for more
     information).

     バージョン 3.8 で変更: *note functools.partial(): 4ad. でラップした
     関数に対して、ラップされた関数が Python のジェネレータ関数である場
     合は ‘True’ を返すようになりました。

     バージョン 3.13 で変更: *note functools.partialmethod(): 4ae. でラ
     ップした関数に対して、ラップされた関数が Python のジェネレータ関数
     である場合は ‘True’ を返すようになりました。

 -- の関数: inspect.isgenerator (object)

     オブジェクトがジェネレータの場合 ‘True’ を返します。

 -- の関数: inspect.iscoroutinefunction (object)

     オブジェクトがコルーチン関数 *note coroutine function: 1130. (*note
     async def: 9d4. 構文で定義された関数)、コルーチン関数 coroutine
     function をラップしている *note functools.partial(): 4ad. もしくは
     *note markcoroutinefunction(): 8a6. とマークされた同期関数のいずれ
     かの場合に ‘True’ を返します

     Added in version 3.5.

     バージョン 3.8 で変更: *note functools.partial(): 4ad. でラップした
     関数に対して、ラップされた関数が コルーチン関数 *note coroutine
     function: 1130. である場合は ‘True’ を返すようになりました。

     バージョン 3.12 で変更: *note markcoroutinefunction(): 8a6. とマー
     クされた同期関数に対して ‘True’ を返すようになりました。

     バージョン 3.13 で変更: *note functools.partialmethod(): 4ae. でラ
     ップした関数に対して、ラップされた関数がコルーチン関数 *note
     coroutine function: 1130. である場合は ‘True’ を返すようになりまし
     た。

 -- の関数: inspect.markcoroutinefunction (func)

     そのままであれば *note iscoroutinefunction(): 154. がコルーチン関数
     と判定しないような呼び出し可能オブジェクトを、コルーチン関数 *note
     coroutine function: 1130. とマークするためのデコレータです。

     これは、コルーチン *note coroutine: 8a7. を返す同期関数が、 *note
     iscoroutinefunction(): 154. が真であることを要求するAPIに渡される場
     合に役に立つかもしれません。

     可能なら、 *note async def: 9d4. を使った関数定義が好ましいです。ま
     た、関数を呼び出した上でその戻り値を *note iscoroutine(): 11ce. で
     テストする方法も容認できます。

     Added in version 3.12.

 -- の関数: inspect.iscoroutine (object)

     オブジェクトが *note async def: 9d4. で生成された *note コルーチン:
     8a7. の場合 ‘True’ を返します。

     Added in version 3.5.

 -- の関数: inspect.isawaitable (object)

     オブジェクトを *note await: 439. 式内で使用できる場合 ‘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:
     26b1. 関数である場合に ‘True’ を返します。使用例:

          >>> async def agen():
          ...     yield 1
          ...
          >>> inspect.isasyncgenfunction(agen)
          True

     Added in version 3.6.

     バージョン 3.8 で変更: *note functools.partial(): 4ad. でラップされ
     た関数でも、元の関数が非同期ジェネレータ *note asynchronous
     generator: 26b1. 関数であれば ‘True’ を返すようになりました。

     バージョン 3.13 で変更: Functions wrapped in *note
     functools.partialmethod(): 4ae. now return ‘True’ if the wrapped
     function is a *note asynchronous generator: 26b1. function.

 -- の関数: inspect.isasyncgen (object)

     オブジェクトが *note asynchronous generator: 26b1. 関数によって生成
     された *note asynchronous generator iterator: 3b9c. である場合に
     ‘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: a3f. である場合に
     ‘True’ を返します。

     真を返すのは *note MethodWrapperType: a3f. のインスタンスで、 *note
     __str__(): a14, *note __eq__(): ec4, *note __repr__(): 1c7. などで
     す。

     Added in version 3.11.

 -- の関数: inspect.isroutine (object)

     オブジェクトがユーザ定義か組み込みの関数またはメソッドの場合は
     ‘True’ を返します。

 -- の関数: inspect.isabstract (object)

     オブジェクトが抽象基底クラスであるときに ‘True’ を返します。

 -- の関数: inspect.ismethoddescriptor (object)

     オブジェクトがメソッドデスクリプタであり、 *note ismethod(): 4d0b,
     *note isclass(): 4d0a, *note isfunction(): 4d0c, *note isbuiltin():
     4d12. でない場合に ‘True’ を返します。

     これはたとえば、 ‘int.__add__’ で真を返します。この関数によるテスト
     をパスする（真を返す）オブジェクトは *note __get__(): 18a0. メソッ
     ドを持ちますが、 *note __set__(): 25c9. メソッドや *note
     __delete__(): 1b83. メソッドは持ちません。それ以外の属性の有無はさ
     まざまです。 *note __name__: 141d. 属性は普通は存在しますし、 *note
     __doc__: cf8. 属性もしばしば見られます。

     デスクリプタによって実装されたメソッドがこのメソッド以外のテストを
     パスする場合、 *note ismethoddescriptor(): 1b82. によるテストでは
     ‘False’ を返します。これは単純に、他のテストはより多くを約束するか
     らです - たとえば、あるオブジェクトが *note ismethod(): 4d0b. のテ
     ストをパスするとき、そのオブジェクトが *note __func__: 16b6. 属性
     (など) を持っていることを期待することができます。

     バージョン 3.13 で変更: この関数は、 *note __get__(): 18a0. 属性と
     *note __delete__(): 1b83. 属性を持ち、 *note __set__(): 25c9. 属性
     を持たないオブジェクトをメソッドデスクリプタであると不正に報告する
     ことはなくなりました (そのようなオブジェクトはデータデスクリプタで
     あって、メソッドデスクリプタではありません)。

 -- の関数: inspect.isdatadescriptor (object)

     オブジェクトがデータデスクリプタの場合に ‘True’ を返します。

     データデスクリプタは *note __set__: 25c9. メソッドか *note
     __delete__: 1b83. メソッドのいずれかを持ちます。例としては、
     (Python で定義された) プロパティ、 getset デスクリプタ、メンバーデ
     スクリプタがあります。後者2つは C で定義されており、それぞれの型に
     対して特別なテストが存在します。それらのテストは、全ての Python 実
     装に対して堅牢です。概して、データデスクリプタは *note __name__:
     141d. 属性や ‘__doc__’ 属性も持ちますが、このことは保証されてはいま
     せん (一方でプロパティ、 getset デスクリプタ、メンバーデスクリプタ
     はこれら2つの属性を両方持っています)。

 -- の関数: inspect.isgetsetdescriptor (object)

     オブジェクトが getset デスクリプタの場合に ‘True’ を返します。

     getset とは、拡張モジュールで *note PyGetSetDef: f7b. 構造体を用い
     て定義された属性のことです。そのような型を持たない Python 実装の場
     合は、このメソッドは常に ‘False’ を返します。

 -- の関数: inspect.ismemberdescriptor (object)

     オブジェクトがメンバーデスクリプタの場合に ‘True’ を返します。

     メンバーデスクリプタとは、拡張モジュールで *note PyMemberDef: 95f.
     構造体を用いて定義された属性のことです。そのような型を持たない
     Python 実装の場合は、このメソッドは常に ‘False’ を返します。


File: python.info,  Node: ソースコードの情報取得,  Next: Signature オブジェクトで呼び出し可能オブジェクトを内省する,  Prev: 型とメンバー,  Up: inspect --- 活動中のオブジェクトを調査する

5.30.14.2 ソースコードの情報取得
................................

 -- の関数: inspect.getdoc (object, *, inherit_class_doc=True,
          fallback_to_class_doc=True)

     Get the documentation string for an object, cleaned up with *note
     cleandoc(): 1c53.  If the documentation string for an object is not
     provided:

        * if the object is a class and 'inherit_class_doc' is true (by
          default), retrieve the documentation string from the
          inheritance hierarchy;

        * if the object is a method, a property or a descriptor,
          retrieve the documentation string from the inheritance
          hierarchy;

        * otherwise, if 'fallback_to_class_doc' is true (by default),
          retrieve the documentation string from the class of the
          object.

     Return ‘None’ if the documentation string is invalid or missing.

     バージョン 3.5 で変更: ドキュメンテーション文字列がオーバーライドさ
     れていない場合は継承されるようになりました。

     バージョン 3.15 で変更: Added parameters 'inherit_class_doc' and
     'fallback_to_class_doc'.

     Documentation strings on *note cached_property: 953. objects are
     now inherited if not overridden.

 -- の関数: inspect.getcomments (object)

     オブジェクトのソースコード直前 (クラス、関数、メソッドの場合) また
     は Python ソースファイルの先頭 (モジュールの場合) の任意の行数にわ
     たるコメントを、ひとつの文字列として返します。オブジェクトのソース
     コードが存在しない場合は ‘None’ を返します。オブジェクトが C で定義
     されている場合や、対話型シェルで定義したオブジェクトの場合にこのよ
     うなことが起こり得ます。

 -- の関数: inspect.getfile (object)

     オブジェクトを定義している (テキストまたはバイナリの) ファイルの名
     前を返します。オブジェクトが組み込みモジュール、クラス、関数の場合
     は *note TypeError: 29c. 例外が発生します。

 -- の関数: inspect.getmodule (object)

     オブジェクトが定義されているモジュールの推定を試みます。モジュール
     が決められない場合は ‘None’ を返します。

 -- の関数: inspect.getsourcefile (object)

     オブジェクトが定義されている Python ソースファイルの名前を返します
     。ソースを取得する方法がない場合は ‘None’ を返します。組み込みのモ
     ジュール、クラス、関数に対しては *note TypeError: 29c. で失敗します
     。

 -- の関数: inspect.getsourcelines (object)

     オブジェクトを定義しているソースコードの行のリストと、定義の開始行
     番号を返します。引数にはモジュール、クラス、メソッド、関数、トレー
     スバック、またはコードオブジェクトを渡すことができます。オブジェク
     トに対応するソースコードが行のリストとして返されます。また行番号は
     、元のソースファイル中でコードが見つかった最初の行を示します。ソー
     スコードを探し出すことができなかった場合、 *note OSError: 543. 例外
     が送出されます。オブジェクトが組み込みのモジュール、クラス、または
     関数である場合は *note TypeError: 29c. 例外が送出されます。

     バージョン 3.3 で変更: *note IOError: 1409. の代わりに *note
     OSError: 543. を送出します。前者は後者のエイリアスです。

 -- の関数: inspect.getsource (object)

     オブジェクトを定義しているソースコードのテキストを返します。引数に
     はモジュール、クラス、メソッド、関数、トレースバック、フレーム、ま
     たはコードオブジェクトを渡すことができます。ソースコードはひとつの
     文字列として返されます。ソースコードを探し出すことができなかった場
     合、 *note OSError: 543. 例外が送出されます。オブジェクトが組み込み
     のモジュール、クラス、または関数である場合は *note TypeError: 29c.
     例外が送出されます。

     バージョン 3.3 で変更: *note IOError: 1409. の代わりに *note
     OSError: 543. を送出します。前者は後者のエイリアスです。

 -- の関数: 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: 6ee. オブジェクトは、呼び出し可能オブジェクトの呼び出し
シグネチャと戻り値のアノテーションを表現します。 ‘Signature’ オブジェク
トを取得するには、 ‘signature()’ 関数を使ってください。

 -- の関数: inspect.signature (callable, *, follow_wrapped=True,
          globals=None, locals=None, eval_str=False,
          annotation_format=Format.VALUE)

     'callable' で与えられたオブジェクトに対する *note Signature: 6ee. オ
     ブジェクトを返します:

          >>> 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(): 4ad. オブジェク
     トまで、幅広い Python の呼び出し可能なオブジェクトを受け付けます。

     アノテーションのいくつかが (たとえば ‘from __future__ import
     annotations’ が使われていることを理由に) 文字列である場合、 *note
     signature(): 4c4. は *note annotationlib.get_annotations(): 673. を
     使って「非文字列化」すなわち文字列アノテーションを解決して本来のア
     ノテーションに戻すことを試みます。アノテーションの解決を行う際には
     'globals', 'locals', および 'eval_str' パラメータが
     ‘annotationlib.get_annotations()’ に渡されます; これらのパラメータ
     を使う方法についての説明は ‘annotationlib.get_annotations()’ のドキ
     ュメンテーションを参照してください。返されるアノテーションの形式を
     制御するため、 'annotation_format' パラメータには *note
     annotationlib.Format: 4c5. 列挙型のメンバーを渡すことができます。た
     とえばアノテーションを文字列形式で返すためには
     ‘annotation_format=annotationlib.Format.STRING’ を使ってください。

     シグネチャを提供できない場合は *note ValueError: 15a. 例外を送出し
     ます。またオブジェクトの型がサポートされていない場合は *note
     TypeError: 29c. 例外を送出します。さらに、アノテーションが文字列化
     されており、 'eval_str' が偽でない場合、アノテーションを「非文字列
     化」するために *note annotationlib.get_annotations(): 673. 内部で呼
     ばれる ‘eval()’ により、いかなる種類の例外も送出される可能性があり
     ます。

     関数シグネチャにおけるスラッシュ (/) は、それより前のパラメータが位
     置専用引数であることを示します。より詳しい情報は、 *note
     位置専用引数に関する FAQ エントリ: 27ee. を参照してください。

     バージョン 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: 4d1b.
     集合として、関数が受け取るパラメータそれぞれについての *note
     Parameter: 6ef. オブジェクトを保存します。

     オプション引数 'parameters' は *note Parameter: 6ef. オブジェクトの
     シーケンスで、重複した名前のパラメータはないか、パラメータの並び順
     は正しいか、すなわち位置専用引数からはじまり次に位置引数としてもキ
     ーワード引数としても指定可能なパラメータが続くかどうか、またデフォ
     ルト値のあるパラメータがデフォルト値のないパラメータの後にあるかど
     うか、といった項目をチェックするための検証が行われます。

     オプション引数 'return_annotation' は任意の Python オブジェクトをと
     ることができます。この引数は、呼び出し可能オブジェクトの "戻り値" に
     対するアノテーションを表します。

     ‘Signature’ オブジェクトは 'immutable' すなわち変更不可能です。変更
     されたコピーを生成するためには、 *note Signature.replace(): 4d1c. ま
     たは *note copy.replace(): 461. を使ってください。

     バージョン 3.5 で変更: ‘Signature’ オブジェクトは pickle 可能かつ ハ
     ッシュ可能 になりました。

      -- の属性: empty

          return アノテーションがないことを指すクラスレベルの特殊マーカ
          です。

      -- の属性: parameters

          パラメータの名前と対応する *note Parameter: 6ef. オブジェクト
          の、順序ありマッピングです。パラメータは、キーワード専用パラメ
          ータも含めて、厳密な定義順に現れます。

          バージョン 3.7 で変更: バージョン 3.7 までは、Python はキーワ
          ード専用パラメータだけしか順序を保つことを明確に保証していませ
          んでした。とはいえ Python 3 では事実上パラメータの順序は維持さ
          れていました。

      -- の属性: return_annotation

          呼び出し可能オブジェクトの "return" アノテーションです。呼び出
          し可能オブジェクトに "return" アノテーションがない場合、この属
          性は *note Signature.empty: 4d1d. に設定されます。

      -- メソッド: bind (*args, **kwargs)

          位置引数およびキーワード引数からパラメータへのマッピングを生成
          します。 ‘*args’ と ‘**kwargs’ がシグネチャに一致した場合
          *note BoundArguments: 1420. を返します。引数がシグネチャと一致
          しない場合は *note TypeError: 29c. 例外を送出します。

      -- メソッド: bind_partial (*args, **kwargs)

          *note Signature.bind(): 1ad5. と同様に動作しますが、いくつかの
          必要な引数を省略することができます (*note functools.partial():
          4ad. の振る舞いによく似たものです) 。 *note BoundArguments:
          1420. を返します。引数がシグネチャと一致しない場合は *note
          TypeError: 29c. 例外を送出します。

      -- メソッド: replace (*[, parameters][, return_annotation])

          *note replace(): 4d1c. メソッドが呼び出されたインスタンスから
          、新しい *note Signature: 6ee. インスタンスを生成します。元に
          なるシグネチャのプロパティをオーバーライドするために異なる
          'parameters' や 'return_annotation' を渡すことが可能です。
          ‘return_annotation’ をコピーされた ‘Signature’ インスタンスか
          ら削除したい場合、 *note Signature.empty: 4d1d. を渡してくださ
          い。

               >>> 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: 6ee. オブジェクトのコピーは、汎用の関数 *note
          copy.replace(): 461. でもサポートされています。

      -- メソッド: format (*, max_width=None,
               quote_annotation_strings=True)

          *note Signature: 6ee. オブジェクトの文字列表現を生成します。

          'max_width' が指定されると、メソッドはシグネチャをそれぞれの行
          が最大 'max_width' 文字になるようにフォーマットを試みます。シ
          グネチャが 'max_width' よりも長くなってしまう場合は、全てのパ
          ラメータごとに改行されます。

          'quote_annotation_strings' が偽の場合、文字列で表されたシグネ
          チャの中の *note アノテーション: 410. は、最初と最後のクォート
          記号無しで表示されます。この挙動は、シグネチャが *note STRING:
          414. フォーマットで作られた場合や ‘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: 6ee. (またはそのサブクラスの) オブジェクトを返しま
          す。

          このメソッドは *note Signature: 6ee. からサブクラスを作る作業
          を簡素化します:

               class MySignature(Signature):
                   pass
               sig = MySignature.from_callable(sum)
               assert isinstance(sig, MySignature)

          このメソッドの振る舞いは、上記を除けば *note signature(): 4c4.
          と同じです。

          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(): 4d20. や *note copy.replace(): 461. を使ってオ
     ブジェクトの内容を変更したコピーを作成することができます。

     バージョン 3.5 で変更: Parameter オブジェクトはピックル化可能
     (picklable) かつ ハッシュ化可能 (*note hashable: 18e.) になりました
     。

      -- の属性: empty

          デフォルト値とアノテーションがないことを指すクラスレベルの特殊
          マーカです。

      -- の属性: name

          仮引数名 (文字列) です。名前は有効な Python 識別子でなければな
          りません。

          CPython は内包表記やジェネレータ式を実装するためのコードオブジ
          ェクトにおいて、 ‘.0’ という形式で暗黙のパラメータ名を生成しま
          す。

          バージョン 3.6 で変更: このモジュールにより、これら暗黙のパラ
          メータ名は ‘implicit0’ のような名前で公開されるようになりまし
          た。

      -- の属性: default

          引数のデフォルト値です。引数にデフォルト値がない場合、この属性
          は *note Parameter.empty: 4d21. に設定されます。

      -- の属性: annotation

          引数のアノテーションです。引数にアノテーションがない場合、この
          属性は *note Parameter.empty: 4d21. に設定されます。

      -- の属性: kind

          引数の値がどのようにパラメータと紐付けられるかを記述します。指
          定可能な値は *note Parameter: 6ef. を介して
          (‘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: 4d25. 列挙型の各定数を説明します。

          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: 6ef. インスタンスを生成します。 ‘Parameter’ の
          属性をオーバーライドするには、対応する引数をこのメソッドに渡し
          てください。 ‘Parameter’ からデフォルト値やアノテーションを取
          り除きたい場合は、 *note Parameter.empty: 4d21. を渡してくださ
          い。

               >>> 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: 6ef. オブジェクトは汎用関数 *note
          copy.replace(): 461. でもサポートされています。

     バージョン 3.4 で変更: Python 3.3 では、‘kind’ が ‘POSITIONAL_ONLY’
     の場合に限り、 ‘name’ が ‘None’ であるような *note Parameter: 6ef.
     オブジェクトが許されていました。ですが、そのようなオブジェクトはも
     はや許可されていません。

 -- クラス: inspect.BoundArguments

     *note Signature.bind(): 1ad5. または *note
     Signature.bind_partial(): 4d1f. を呼び出して得られる結果です。引数
     と関数のパラメータとの間のマッピング情報を保持します。

      -- の属性: arguments

          パラメータの名前と引数の値との間のミュータブルなマッピングです
          。明示的に紐付けされた引数だけを含みます。 *note arguments:
          cdf. に対する変更は *note args: 4d27. と *note kwargs: 4d28. に
          反映されます。

          いかなる引数処理の目的でも、 *note Signature.parameters: 4d1b.
          とあわせて使うようにしてください。

               注釈: *note Signature.bind(): 1ad5. または *note
               Signature.bind_partial(): 4d1f. でデフォルト値をあてにす
               るとされた引数は、スキップされます。それらをマッピングに
               加えたい場合は、必要に応じて *note
               BoundArguments.apply_defaults(): 11cd. を使ってください。

          バージョン 3.9 で変更: *note arguments: cdf. の型が *note
          dict: 193. になりました。以前は *note collections.OrderedDict:
          9da. 型でした。

      -- の属性: args

          位置引数の値のタプルです。*note arguments: cdf. 属性から動的に
          計算されます。

      -- の属性: kwargs

          キーワード引数の値の辞書です。 *note arguments: cdf. 属性から
          動的に計算されます。位置引数として渡すことができる引数は、
          *note args: 4d27. に含まれることに注意してください。

      -- の属性: signature

          親の *note Signature: 6ee. オブジェクトへの参照です。

      -- メソッド: 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: 4d27. と *note kwargs: 4d28. の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, *,
          annotation_format=Format.VALUE)

     Python 関数のパラメータの名前とデフォルト値を取得します。 *note
     named tuple: a42. を返します:

     ‘FullArgSpec(args, varargs, varkw, defaults, kwonlyargs,
     kwonlydefaults, annotations)’

     'args' は位置引数の名前のリストです。 'varargs' は ‘*’ で始まる可変
     長位置引数の名前で、この引数を受け付けない場合は ‘None’ です。
     'varkw' は ‘**’ で始まる可変長キーワード引数の名前で、この引数を受
     け付けない場合は ‘None’ です。 'defaults' は末尾 'n' 個の位置引数に
     対応するデフォルト引数の 'n'-タプルで、 そのようなデフォルト値が定
     義されていない場合は ‘None’ です。 'kwonlyargs' は宣言順に並んだキ
     ーワード専用引数の名前のリストです。 'kwonlydefaults' はそれらに対
     して値が渡されなかった場合の、 'kwonlyargs' の名前からデフォルト値
     へのマッピングを行う辞書です。 'annotations' 引数名からアノテーショ
     ンへのマッピングを行う辞書です。特殊キー ‘"return"’ は (もしあれば)
     関数の戻り値に対するアノテーションを伝えるために使われます。

     *note signature(): 4c4. と *note Signature オブジェクト: 4d19. が呼
     び出し可能オブジェクトのイントロスペクション (実行時オブジェクト調
     査) のための推奨される API を提供しており、かつ拡張モジュール API で
     ときどき遭遇する追加の振る舞い (位置専用引数など) もサポートしてい
     ることに注意してください。この関数は、主に Python 2 の ‘inspect’ モ
     ジュール API との互換性を維持することが必要なコードで利用されるため
     に残されています。

     A member of the *note annotationlib.Format: 4c5. enum can be passed
     to the 'annotation_format' parameter to control the format of the
     returned annotations.  For example, use
     ‘annotation_format=annotationlib.Format.STRING’ to return
     annotations in string format.  Note that with the default ‘VALUE’
     format, creation of some argspecs may raise an exception.

     バージョン 3.4 で変更: この関数は *note signature(): 4c4. をもとに
     実装されています。ただし、 ‘__wrapped__’ 属性を無視します。また、束
     縛されたメソッドに対するシグネチャの出力において、すでに束縛された
     最初のパラメータを含みます。

     バージョン 3.6 で変更: This method was previously documented as
     deprecated in favour of *note signature(): 4c4. 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 では事実上パラメータの順序は維持されていました。

     バージョン 3.15 で変更: 'annotation_format' パラメータが追加されま
     した。

 -- の関数: inspect.getargvalues (frame)

     指定したフレームに渡された引数の情報を取得します。戻り値は *note
     名前付きタプル: a42. ‘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(): 1270. で取得した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(): 1ad5. や
     *note Signature.bind_partial(): 4d1f. を使ってください。

 -- の関数: inspect.getclosurevars (func)

     Python 関数またはメソッド 'func' の外部の名前参照と、それらの現在の
     値のマッピングを取得します。 *note named tuple: a42.
     ‘ClosureVars(nonlocals, globals, builtins, unbound)’ を返します。参
     照名を、 'nonlocals' はレキシカルクロージャ変数、すなわち外側のスコ
     ープで定義された変数の値にマップし、 'globals' は関数が属するモジュ
     ールのグローバル変数にマップし、 'builtins' は関数本体から見える組
     み込み変数にマップします。 'unbound' は、現在のモジュールにおけるグ
     ローバル変数や組み込み変数において解決できないにもかかわらず、関数
     内で参照されている名前の集合です。

     'func' が Python の関数やメソッドでない場合 *note TypeError: 29c. が
     送出されます。

     Added in version 3.3.

 -- の関数: inspect.unwrap (func, *, stop=None)

     'func' によりラップされたオブジェクトを取得します。 ‘__wrapped__’ 属
     性の連鎖をたどり、ラップの連鎖の最後にあるオブジェクトを返します。

     'stop' はオプションで指定可能なコールバック関数で、ラッパーの連鎖に
     おけるオブジェクトをただひとつの引数として取ります。このコールバッ
     ク関数が真値を返した段階で、オブジェクトのアンラップを早期に終了さ
     せることができます。コールバック関数が真値を返さない場合は、通常通
     りラッパーの連鎖における最後のオブジェクトを返します。例えば、
     *note signature(): 4c4. は、オブジェクトに ‘__signature__’ 属性が定
     義されていたらオブジェクトのアンラップを停止するために、このオプシ
     ョンを使っています。

     循環を検知した場合は *note ValueError: 15a. を送出します。

     Added in version 3.4.

 -- の関数: inspect.get_annotations (obj, *, globals=None, locals=None,
          eval_str=False, format=annotationlib.Format.VALUE)

     オブジェクトに対するアノテーション辞書を計算します。

     これは *note annotationlib.get_annotations(): 673. のエイリアスです
     ; 詳細はその関数のドキュメントを参照してください。

          注意: This function may execute arbitrary code contained in
          annotations.  See *note Security implications of introspecting
          annotations: 4780. for more information.

     Added in version 3.10.

     バージョン 3.14 で変更: この関数は *note
     annotationlib.get_annotations(): 673. のエイリアスになりました。
     ‘inspect.get_annotations’ として呼び出しても、引き続き正しく動作し
     ます。


File: python.info,  Node: インタープリタスタック,  Next: 属性の静的なフェッチ,  Prev: クラスと関数<2>,  Up: inspect --- 活動中のオブジェクトを調査する

5.30.14.5 インタープリタスタック
................................

以下の関数のうちいくつかは *note FrameInfo: a40. オブジェクトを返します
。これらのオブジェクトは、後方互換性のために ‘positions’ を除く全ての属
性に対して、タプル的な演算を許可します。この振る舞いは非推奨と考えられて
おり、将来削除されるかもしれません。

 -- クラス: inspect.FrameInfo

      -- の属性: frame

          そのレコードに相当する *note フレームオブジェクト: ad2. です。

      -- の属性: filename

          このレコードに相当するフレームによって実行されるコードのファイ
          ル名です。

      -- の属性: lineno

          このレコードに相当するフレームによって実行されるコードの、現在
          の行の行番号です。

      -- の属性: function

          このレコードに相当するフレームによって実行される関数名です。

      -- の属性: code_context

          このレコードに相当するフレームによって実行される、ソースコード
          から生成されたコンテキストの行のリストです。

      -- の属性: index

          *note code_context: 4d34. リストにおいて実行される現在の行のイ
          ンデックスです。

      -- の属性: positions

          このレコードに相当するフレームによって実行される命令に結びつい
          た *note dis.Positions: 1b77. オブジェクトで、開始行番号、終了
          行番号、開始カラムオフセット、終了カラムオフセットを含んでいま
          す。

     バージョン 3.5 で変更: *note tuple: 1d9. ではなく *note named
     tuple: a42. を返すようになりました。

     バージョン 3.11 で変更: ‘FrameInfo’ はクラスインスタンスになりまし
     た (ただしそれ以前の *note named tuple: a42. とは後方互換です) 。

 -- クラス: inspect.Traceback

      -- の属性: filename

          このトレースバックに対応するフレームによって実行されるコードの
          ファイル名です。

      -- の属性: lineno

          このトレースバックに対応するフレームによって実行されるコードの
          、現在の行の行番号です。

      -- の属性: function

          このトレースバックに対応するフレームによって実行される関数名で
          す。

      -- の属性: code_context

          このトレースバックに対応するフレームによって実行される、ソース
          コードから生成されたコンテキストの行のリストです。

      -- の属性: index

          *note code_context: 4d3a. リストにおいて実行される現在の行のイ
          ンデックスです。

      -- の属性: positions

          このトレースバックに対応するフレームによって実行される命令の開
          始行番号、終了行番号、開始カラムオフセット、終了カラムオフセッ
          トを含む *note dis.Positions: 1b77. オブジェクトです。

     バージョン 3.11 で変更: ‘Traceback’ はクラスインスタンスになりまし
     た (ただしそれ以前の *note named tuple: a42. とは後方互換です) 。

     注釈: フレームレコードの最初の要素などのフレームオブジェクトへの参
     照を保存すると、循環参照になってしまう場合があります。循環参照がで
     きると、Python の循環参照検出機能を有効にしていたとしても関連するオ
     ブジェクトが参照しているすべてのオブジェクトが解放されにくくなり、
     明示的に参照を削除しないとメモリ消費量が増大する恐れがあります。

     参照の削除を Python の循環参照検出機能にまかせることもできますが、
     *note finally: 453. 節で循環参照を解除すれば確実にフレーム (とその
     ローカル変数) は削除されます。また、循環参照検出機能は Python のコ
     ンパイルオプションや *note gc.disable(): 4cfc. で無効とされている場
     合がありますので注意が必要です。例:

          def handle_stackframe_without_leak():
              frame = inspect.currentframe()
              try:
                  # フレーム上で何か処理をします
              finally:
                  del frame

     (たとえばトレースバックをあとで表示したいなどの理由で) フレームを削
     除せずにとっておきたい場合は、 *note frame.clear(): 78a. メソッドを
     使って循環参照を壊すこともできます。

以下の関数でオプション引数 'context' には、戻り値のソース行リストに何行
分のソースを含めるかを指定します。ソース行リストには、実行中の行を中心と
して指定された行数分のリストを返します。

 -- の関数: inspect.getframeinfo (frame, context=1)

     フレームまたはトレースバックオブジェクトの情報を取得します。 *note
     Traceback: a41. オブジェクトが返されます。

     バージョン 3.11 で変更: 名前付きタプルの代わりに *note Traceback:
     a41. オブジェクトが返されるようになりました。

 -- の関数: inspect.getouterframes (frame, context=1)

     指定したフレームと、その外側の全フレームの *note FrameInfo: a40. オ
     ブジェクトのリストを取得します。外側のフレームとは 'frame' が生成さ
     れるまでのすべての関数呼び出しを示します。戻り値のリストの先頭は
     'frame' のフレームレコードで、末尾の要素は 'frame' のスタックにある
     最も外側のフレームのフレームレコードとなります。

     バージョン 3.5 で変更: *note 名前付きタプル: a42. ‘FrameInfo(frame,
     filename, lineno, function, code_context, index)’ のリストが返され
     ます。

     バージョン 3.11 で変更: *note FrameInfo: a40. オブジェクトのリスト
     が返されるようになりました。

 -- の関数: inspect.getinnerframes (traceback, context=1)

     トレースバックのフレームと、その内側の全フレームの *note FrameInfo:
     a40. オブジェクトのリストを取得します。内のフレームとは 'frame' か
     ら続く一連の関数呼び出しを示します。戻り値のリストの先頭は
     'traceback' のフレームレコードで、末尾の要素は例外が発生した位置を
     示します。

     バージョン 3.5 で変更: *note 名前付きタプル: a42. ‘FrameInfo(frame,
     filename, lineno, function, code_context, index)’ のリストが返され
     ます。

     バージョン 3.11 で変更: *note FrameInfo: a40. オブジェクトのリスト
     が返されるようになりました。

 -- の関数: inspect.currentframe ()

     呼び出し元のフレームオブジェクトを返します。

     この関数はインタプリタの Python スタックフレームサポートに依存しま
     す。これは Python のすべての実装に存在している保証はありません。
     Python スタックフレームサポートのない環境では、この関数は ‘None’ を
     返します。

 -- の関数: inspect.stack (context=1)

     呼び出し元スタックの *note FrameInfo: a40. オブジェクトのリストを返
     します。最初の要素は呼び出し元のフレームレコードで、末尾の要素はス
     タックにある最も外側のフレームのフレームレコードとなります。

     バージョン 3.5 で変更: *note 名前付きタプル: a42. ‘FrameInfo(frame,
     filename, lineno, function, code_context, index)’ のリストが返され
     ます。

     バージョン 3.11 で変更: *note FrameInfo: a40. オブジェクトのリスト
     が返されるようになりました。

 -- の関数: inspect.trace (context=1)

     実行中のフレームと処理中の例外が発生したフレームの間の *note
     FrameInfo: a40. オブジェクトのリストを返します。最初の要素は呼び出
     し元のフレームレコードで、末尾の要素は例外が発生した位置を示します
     。

     バージョン 3.5 で変更: *note 名前付きタプル: a42. ‘FrameInfo(frame,
     filename, lineno, function, code_context, index)’ のリストが返され
     ます。

     バージョン 3.11 で変更: *note FrameInfo: a40. オブジェクトのリスト
     が返されるようになりました。


File: python.info,  Node: 属性の静的なフェッチ,  Next: Current State of Generators Coroutines and Asynchronous Generators,  Prev: インタープリタスタック,  Up: inspect --- 活動中のオブジェクトを調査する

5.30.14.6 属性の静的なフェッチ
..............................

*note getattr(): f93. や *note hasattr(): 8e7. は属性の存在確認や属性値
の取得に際してコードの実行を伴うことがあります。プロパティなどのデスクリ
プタが呼び出され、また *note __getattr__(): 8e8. や *note
__getattribute__(): f94. が呼び出されたりするかもしれません。

たとえばドキュメントツールのように受動的なイントロスペクションをしたい場
合、この振る舞いは不便です。 *note getattr_static(): 8aa. は *note
getattr(): f93. と同じシグネチャを持ちますが、属性値を取得する際にコード
の実行をしないようにします。

 -- の関数: inspect.getattr_static (obj, attr, default=None)

     Retrieve attributes without triggering dynamic lookup via the
     descriptor protocol, *note __getattr__(): 8e8. or *note
     __getattribute__(): f94.

     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__: 1ca. 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(): 8aa. 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(): 15f1. 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: 9d4.
     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: 9d4. functions which use the *note
     yield: d97. 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():
     296. in the body of the generator, and all the same caveats apply.

     If 'generator' is a *note generator: 1417. with no currently
     associated frame, then an empty dictionary is returned.  *note
     TypeError: 29c. 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(): 1496, but
     works for coroutine objects created by *note async def: 9d4.
     functions.

     Added in version 3.5.

 -- の関数: inspect.getasyncgenlocals (agen)

     This function is analogous to *note getgeneratorlocals(): 1496, but
     works for asynchronous generator objects created by *note async
     def: 9d4. functions which use the *note yield: d97. 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: 1b1b. 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:
     298. 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: 1ade.

     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: コマンドライン・インターフェース<11>,  Prev: Code Objects Bit Flags,  Up: inspect --- 活動中のオブジェクトを調査する

5.30.14.9 Buffer flags
......................

 -- クラス: inspect.BufferFlags

     This is an *note enum.IntFlag: 1061. that represents the flags that
     can be passed to the *note __buffer__(): 87e. method of objects
     implementing the *note buffer protocol: 319.

     The meaning of the flags is explained at *note
     バッファリクエストのタイプ: 13f4.

      -- の属性: 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: コマンドライン・インターフェース<11>,  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
appending a colon and the qualified name of the target object.

 -- Option: --details

     Print information about the specified object rather than the source
     code

バージョン 3.15 で変更: The ‘--details’ option now supports basic
introspection for modules without available source code and indicates
when modules are frozen.  It also indicates when the given target
reference is not the canonical name of the referenced object.


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: 410. on modules, classes, and functions.

Annotations are *note lazily evaluated: 877. 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: 4c5.), each of which works best for different use cases:

   * *note VALUE: 412. 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: 413. returns *note ForwardRef: 1988. 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: 414. 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(): 673. 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: 411. that is used to evaluate annotations, such as *note
get_annotate_from_class_namespace(): 675. and *note
call_annotate_function(): 19ef, as well as the *note
call_evaluate_function(): 474e. function for working with *note evaluate
functions: 474d.

     注意: Most functionality in this module can execute arbitrary code;
     see *note the security section: 4780. 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 アノテーションのベストプラクティス: bba. provides best practices
for working with annotations.

typing-extensions(5) provides a backport of *note get_annotations():
673. 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/main/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: 677.  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: 66c. 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: 10a1. 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(): 673. and other
     functions in this module, as well as to *note __annotate__: 1bb4.
     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: 412.
          format, or raise *note NotImplementedError: 5a1. 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:
          412. format) for defined values, and *note ForwardRef: 1988.
          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:
     413. 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: 412. (the default),
          this method may throw an exception, such as *note NameError:
          66c, 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: 413, 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: 414, the method will return
          *note __forward_arg__: 4d64.

          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(): 18f, 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: 2587. and
          *note functions: 874.  It is a tuple of *note type parameters:
          7ab. 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():
          673. 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(): 1a9e.  This is meant as
     a helper for user-provided annotate functions that support the
     *note STRING: 414. format but do not have access to the code
     creating the annotations.

     For example, this is used to implement the *note STRING: 414. for
     *note typing.TypedDict: 29b. 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: 411. 'annotate' with the given
     'format', a member of the *note Format: 4c5. 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: 412. 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: 413. format to produce a *note ForwardRef: 1988. 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: 474d. 'evaluate' with the given
     'format', a member of the *note Format: 4c5. enum, and return the
     value produced by the function.  This is similar to *note
     call_annotate_function(): 19ef, 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(): 476a, the value
          of type aliases

        * *note typing.TypeVar.evaluate_bound(): 474c, the bound of type
          variables

        * *note typing.TypeVar.evaluate_constraints(): 4750, the
          constraints of type variables

        * *note typing.TypeVar.evaluate_default(): 4752, the default
          value of type variables

        * *note typing.ParamSpec.evaluate_default(): 4763, the default
          value of parameter specifications

        * *note typing.TypeVarTuple.evaluate_default(): 4759, 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: 411. 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: 4d67. 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__: 1bb4. or *note __annotations__: 672. attributes.
     Passing any other object raises *note TypeError: 29c.

     The 'format' parameter controls the format in which annotations are
     returned, and must be a member of the *note Format: 4c5. 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: 413.  If this is not implemented,
               it will then check if *note VALUE_WITH_FAKE_GLOBALS:
               4d63. 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: 412.  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(): 4d66.

             * When calling ‘object.__annotate__’ it is first called
               with *note STRING: 414.  If this is not implemented, it
               will then check if *note VALUE_WITH_FAKE_GLOBALS: 4d63.
               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: 412. with the
               result converted using *note annotations_to_string():
               4d66.  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(): 18f.  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: 412.

        * 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(): 18f. on those
     values:

        * If eval_str is true, *note eval(): 18f. 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(): 18f.; 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__: 168d, although if 'obj' is a wrapped function
          (using *note functools.update_wrapper(): 13cf.) or a *note
          functools.partial: 4ad. 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
     アノテーションのベストプラクティス: bba. 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: 414. format.  This calls *note repr(): 462. 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: 414. 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: 25d2. 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(): 675. can be
used to get the annotate function, and *note call_annotate_function():
19ef. can be used to call it and retrieve the annotations.  Using the
*note FORWARDREF: 413. 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: 774. 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: 411. 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: 2fba. can be used as an annotate function.

To provide the *note VALUE: 412, *note STRING: 414, or *note FORWARDREF:
413. formats directly, an *note annotate function: 411. must provide the
following attribute:

   * A callable ‘__call__’ with signature ‘__call__(format, /) -> dict’,
     that does not raise a *note NotImplementedError: 5a1. when called
     with a supported format.

To provide the *note VALUE_WITH_FAKE_GLOBALS: 4d63. format, which is
used to automatically generate *note STRING: 414. or *note FORWARDREF:
413. if they are not supported directly, *note annotate functions: 411.
must provide the following attributes:

   * A callable ‘__call__’ with signature ‘__call__(format, /) -> dict’,
     that does not raise a *note NotImplementedError: 5a1. when called
     with *note VALUE_WITH_FAKE_GLOBALS: 4d63.

   * A *note code object: 6f1. ‘__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: 1fa2.

     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: 414. 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: 1fc1.

   * *note ast.UnaryOp: 4d6c.

        * *note ast.Invert: 4d6d. (‘~’), *note ast.UAdd: 4d6e. (‘+’),
          and *note ast.USub: 4d6f. (‘-’) are supported

        * *note ast.Not: 4d70. (‘not’) is not supported

   * *note ast.Dict: 1f5c. (except when using ‘**’ unpacking)

   * *note ast.Set: 4d71.

   * *note ast.Compare: 4d72.

        * *note ast.Eq: 4d73. and *note ast.NotEq: 4d74. are supported

        * *note ast.Lt: 4d75, *note ast.LtE: 4d76, *note ast.Gt: 4d77,
          and *note ast.GtE: 4d78. are supported, but the operand may be
          flipped

        * *note ast.Is: 4d79, *note ast.IsNot: 4d7a, *note ast.In: 4d7b,
          and *note ast.NotIn: 4d7c. are not supported

   * *note ast.Call: 4d7d. (except when using ‘**’ unpacking)

   * *note ast.Constant: 570. (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: 4d7e. (assuming the value is not a constant)

   * *note ast.Subscript: 4d7f. (assuming the value is not a constant)

   * *note ast.Starred: 4d80. (‘*’ unpacking)

   * *note ast.Name: 1f36.

   * *note ast.List: 4d81.

   * *note ast.Tuple: 4d82.

   * *note ast.Slice: 4d83.

The following are unsupported, but throw an informative error when
encountered by the stringifier:

   * *note ast.FormattedValue: 4d84. (f-strings; error is not detected
     if conversion specifiers like ‘!r’ are used)

   * *note ast.JoinedStr: 1c81. (f-strings)

The following are unsupported and result in incorrect output:

   * *note ast.BoolOp: 4d85. (‘and’ and ‘or’)

   * *note ast.IfExp: 4d86.

   * *note ast.Lambda: 4d87.

   * *note ast.ListComp: 4d88.

   * *note ast.SetComp: 4d89.

   * *note ast.DictComp: 4d8a.

   * *note ast.GeneratorExp: 4d8b.

The following are disallowed in annotation scopes and therefore not
relevant:

   * *note ast.NamedExpr: 4d8c. (‘:=’)

   * *note ast.Await: 4d8d.

   * *note ast.Yield: 4d8e.

   * *note ast.YieldFrom: 4d8f.


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: 413. format aims to produce real values as much as
possible, with anything that cannot be resolved replaced with *note
ForwardRef: 1988. objects.  It is affected by broadly the same
Limitations as the *note STRING: 414. 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(): 673. may call an arbitrary *note annotate function:
411, and *note ForwardRef.evaluate(): 151. may call *note eval(): 18f.
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__: 672. attribute, and for various functions in the *note
typing: 10d. module that work with annotations, such as *note
typing.get_type_hints(): aa3.

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: 1988. object.


File: python.info,  Node: site --- サイト固有の設定フック,  Prev: annotationlib --- Functionality for introspecting annotations,  Up: Python ランタイムサービス

5.30.16 ‘site’ -- サイト固有の設定フック
----------------------------------------

'ソースコード:' Lib/site.py(1)

__________________________________________________________________

'このモジュールは初期化中に自動的にインポートされます。' 自動インポート
はインタプリタの *note -S: 1566. オプションで禁止できます。

Importing this module normally appends site-specific paths to the module
search path and adds *note callables: 27fd, including *note help(): cad.
to the built-in namespace.  However, Python startup option *note -S:
1566. 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(): 2335. function.

バージョン 3.3 で変更: 以前は *note -S: 1566. を使っているときでも、モジ
ュールをインポートするとパス変更が起動されていました。

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: 1a3, and is appended
if ‘"t"’ is present in the *note sys.abiflags: e2c. 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: 48e. 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: 3b3. and *note sys.exec_prefix: 3b0. on *note Virtual
Environments: 4ba3.  This is now done during the *note path
initialization: 1974.  As a result, under *note Virtual Environments:
4ba3, ‘sys.prefix’ and ‘sys.exec_prefix’ no longer depend on the ‘site’
initialization, and are therefore unaffected by *note -S: 1566.

When running under a *note virtual environment: 4ba3, the ‘pyvenv.cfg’
file in *note sys.prefix: 3b3. 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.  If the system-level
prefixes are not searched then the user site prefixes are also
implicitly not searched for site-packages.

The ‘site’ module recognizes two startup configuration files of the form
‘`name'.pth’ for path configurations, and ‘`name'.start’ for
pre-first-line code execution.  Both files can exist in one of the four
directories mentioned above.  Within each directory, these files are
sorted alphabetically by filename, then parsed in sorted order.

* Menu:

* Path extensions (.pth files): Path extensions pth files.
* Startup entry points (.start files): Startup entry points start files.
* Startup file examples::
* Migrating from import lines in .pth files to .start files: Migrating from import lines in pth files to start files.
* sitecustomize::
* usercustomize::
* readline の設定::
* モジュールの内容: モジュールの内容<7>.
* コマンドライン・インターフェース: コマンドライン・インターフェース<12>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/site.py


File: python.info,  Node: Path extensions pth files,  Next: Startup entry points start files,  Up: site --- サイト固有の設定フック

5.30.16.1 Path extensions (‘.pth’ files)
........................................

‘`name'.pth’ contains additional items (one per line) to be appended to
‘sys.path’.  Items that name non-existing directories 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.

For backward compatibility, lines starting with ‘import’ (followed by
space or tab) are executed with *note exec(): 190.

バージョン 3.13 で変更: ‘.pth’ ファイルは、最初に UTF-8 で、失敗した場合
は *note locale encoding: 752. でデコードされるようになります。

バージョン 3.15 で変更: ‘.pth’ file lines starting with ‘import’ are
deprecated.  During the deprecation period, such lines are still
executed (except in the case below), but a diagnostic message is emitted
only when the *note -v: 17dd. flag is given.

‘import’ lines in ‘`name'.pth’ are silently ignored when a *note
matching: 1a0. ‘`name'.start’ file exists.

Errors on individual lines no longer abort processing of the rest of the
file.  Each error is reported and the remaining lines continue to be
processed.

バージョン 3.15 で非推奨、バージョン 3.20 で削除予定: Decoding
‘`name'.pth’ files in any encoding other than ‘utf-8-sig’ is deprecated
in Python 3.15, and support for decoding from the locale encoding will
be removed in Python 3.20.

‘import’ lines in ‘`name'.pth’ files are deprecated and will be silently
ignored in Python 3.18 and 3.19.  In Python 3.20 a warning will be
produced for ‘import’ lines in ‘`name'.pth’ files.


File: python.info,  Node: Startup entry points start files,  Next: Startup file examples,  Prev: Path extensions pth files,  Up: site --- サイト固有の設定フック

5.30.16.2 Startup entry points (‘.start’ files)
...............................................

Added in version 3.15.

A startup entry point file is a file whose name has the form
‘`name'.start’ and exists in one of the site-packages directories
described above.  Each file specifies entry points to be called during
interpreter startup, using the ‘pkg.mod:callable’ syntax understood by
*note pkgutil.resolve_name(): 1925.

Each non-blank line that does not begin with ‘#’ must contain an entry
point reference in the form ‘pkg.mod:callable’.  The colon and callable
portion are mandatory.  Each callable is invoked with no arguments, and
any return value is discarded.

‘.start’ files are processed after all ‘.pth’ path extensions have been
applied to *note sys.path: 19f, ensuring that paths are available before
any startup code runs.

Unlike *note sys.path: 19f. extensions from ‘.pth’ files, duplicate
entry points are 'not' de-duplicated -- if an entry point appears more
than once, it will be called more than once.

If an exception occurs during resolution or invocation of an entry
point, a traceback is printed to *note sys.stderr: d09. and processing
continues with the remaining entry points.

‘.start’ files must be encoded in UTF-8.

PEP 829(1) defined the original specification for these features.

     注釈: If a ‘`name'.start’ file exists alongside a ‘`name'.pth’ file
     with the same base name, any ‘import’ lines in the ‘.pth’ file are
     ignored in favor of the entry points in the ‘.start’ file.

     注釈: Executable lines (‘import’ lines in ‘`name'.pth’ files and
     ‘`name'.start’ file entry points) are always run at Python startup
     (unless *note -S: 1566. is given to disable the ‘site.py’ module
     entirely), regardless of whether a particular module is actually
     going to be used.

     注釈: ‘`name'.start’ files invoke *note pkgutil.resolve_name():
     1925. with ‘strict=True’, which requires the full
     ‘pkg.mod:callable’ form.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0829/


File: python.info,  Node: Startup file examples,  Next: Migrating from import lines in pth files to start files,  Prev: Startup entry points start files,  Up: site --- サイト固有の設定フック

5.30.16.3 Startup file examples
...............................

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
sub-subdirectories, ‘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’ はどちらの
パス設定ファイルにも記載されていないため、省略されます。

Let's say that there is also a ‘foo.start’ file containing the
following:

     # foo package startup code

     foo.submod:initialize

Now, after ‘sys.path’ has been extended as above, and before Python
turns control over to user code, the ‘foo.submod’ module is imported and
the ‘initialize()’ function from that module is called.


File: python.info,  Node: Migrating from import lines in pth files to start files,  Next: sitecustomize,  Prev: Startup file examples,  Up: site --- サイト固有の設定フック

5.30.16.4 Migrating from ‘import’ lines in ‘.pth’ files to ‘.start’ files
.........................................................................

If your package currently ships a ‘`name'.pth’ file, you can keep all
‘sys.path’ extension lines unchanged.  Only ‘import’ lines need to be
migrated.

To migrate, create a callable (taking zero arguments) within an
importable module in your package.  Reference it as a ‘pkg.mod:callable’
entry point in a matching ‘`name'.start’ file.  Move everything on your
‘import’ line after the first semi-colon into the ‘callable()’ function.

If your package must straddle older Pythons that do not support PEP
829(1) and newer Pythons that do, change the ‘import’ lines in your
‘`name'.pth’ to use the following form:

     import pkg.mod; pkg.mod.callable()

Older Pythons will execute these ‘import’ lines, while newer Pythons
will ignore them in favor of the ‘`name'.start’ file.  After the
straddling period, remove all ‘import’ lines from your ‘.pth’ files.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0829/


File: python.info,  Node: sitecustomize,  Next: usercustomize,  Prev: Migrating from import lines in pth files to start files,  Up: site --- サイト固有の設定フック

5.30.16.5 ‘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: 1c8. or its subclass exception, and the exception's *note
name: 1923. 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.6 ‘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: 4d9c. 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: 1747.  If this import fails with
an *note ImportError: 1c8. or its subclass exception, and the
exception's *note name: 1923. 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: d0. and ‘usercustomize’ is still attempted.


File: python.info,  Node: readline の設定,  Next: モジュールの内容<7>,  Prev: usercustomize,  Up: site --- サイト固有の設定フック

5.30.16.7 readline の設定
.........................

On systems that support *note readline: c2, this module will also import
and configure the *note rlcompleter: c5. module, if Python is started in
*note interactive mode: 65d. and without the *note -S: 1566. 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__: 1376. attribute in your
*note sitecustomize: d0. or *note usercustomize: 117. module or your
*note PYTHONSTARTUP: 45a. file.

バージョン 3.4 で変更: rlcompleter とhistory のアクティベーションが自動
で行われるようになりました。


File: python.info,  Node: モジュールの内容<7>,  Next: コマンドライン・インターフェース<12>,  Prev: readline の設定,  Up: site --- サイト固有の設定フック

5.30.16.8 モジュールの内容
..........................

 -- データ: site.PREFIXES

     siteパッケージディレクトリのprefixのリスト。

 -- データ: site.ENABLE_USER_SITE

     ユーザサイトディレクトリのステータスを示すフラグ。 ‘True’ の場合、
     ユーザサイトディレクトリが有効で ‘sys.path’ に追加されていることを
     意味しています。 ‘False’ の場合、ユーザによるリクエスト(オプション
     *note -s: 1747. か *note PYTHONNOUSERSITE: 1748.)によって、 ‘None’
     の場合セキュリティ上の理由(ユーザまたはグループIDと実効IDの間のミス
     マッチ)あるいは管理者によって、ユーザサイトディレクトリが無効になっ
     ていることを示しています。

 -- データ: site.USER_SITE

     Path to the user site-packages for the running Python.  Can be
     ‘None’ if *note getusersitepackages(): 15fb. 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(): 15fa. がまだ呼び出されていなければ ‘None’ かも
     しれません。デフォルト値は UNIX と frameworkなしの macOS ビルドでは
     ‘~/.local’ 、macOS framework ビルドでは ‘~/Library/Python/`X.Y'’ 、
     Windows では ‘`%APPDATA%'\Python’ です。この値は、スクリプト、デー
     タファイル、Python モジュールなどのインストール先のディレクトリを
     *note ユーザーインストールスキーム: 2344. で計算するのに使われます
     。 *note PYTHONUSERBASE: 1746. も参照してください。

 -- の関数: site.main ()

     モジュール検索パスに標準のサイト固有ディレクトリを追加します。この
     関数は、Python インタプリタが *note -S: 1566. で開始されていない限
     り、このモジュールインポート時に自動的に呼び出されます。

     バージョン 3.3 で変更: この関数は以前は無条件に呼び出されていました
     。

 -- の関数: site.addsitedir (sitedir, known_paths=None, *,
          defer_processing_start_files=False)

     Add a directory to sys.path and parse the ‘.pth’ and ‘.start’ files
     found in that directory.  Typically used in *note sitecustomize:
     d0. or *note usercustomize: 117. (see above).

     The 'known_paths' argument is an optional set of case-normalized
     paths used to prevent duplicate *note sys.path: 19f. entries.  When
     ‘None’ (the default), the set is built from the current ‘sys.path’.

     While ‘.pth’ and ‘.start’ files are always parsed, set
     'defer_processing_start_files' to ‘True’ to prevent processing the
     startup data found in those files, so that you can process them
     explicitly (this is typically used by the *note main(): 2335.
     function).

     バージョン 3.15 で変更: Also processes ‘.start’ files.  See *note
     Startup entry points (.start files): 1a0.  All ‘.pth’ and ‘.start’
     files are now read and accumulated before any path extensions,
     ‘import’ line execution, or entry point invocations take place.

 -- の関数: site.getsitepackages ()

     全てのグローバルな site-packages ディレクトリのリストを返します。

     Added in version 3.2.

 -- の関数: site.getuserbase ()

     ユーザのベースディレクトリへのパス *note USER_BASE: 16d6. を返しま
     す。未初期化であればこの関数は *note PYTHONUSERBASE: 1746. を参考に
     して、設定もします。

     Added in version 3.2.

 -- の関数: site.getusersitepackages ()

     ユーザ固有の site パッケージのディレクトリへのパス *note USER_SITE:
     2334. を返します。未初期化であればこの関数は *note USER_BASE: 16d6.
     を参考にして、設定もします。 ユーザ固有の site パッケージが
     ‘sys.path’ に追加されたかどうかを確認するには *note
     ENABLE_USER_SITE: 4d9c. を使ってください。

     Added in version 3.2.


File: python.info,  Node: コマンドライン・インターフェース<12>,  Prev: モジュールの内容<7>,  Up: site --- サイト固有の設定フック

5.30.16.9 コマンドライン・インターフェース
..........................................

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: 19f. の中身を表示し、続けて
*note USER_BASE: 16d6. とそのディレクトリが存在するかどうか、 *note
USER_SITE: 2334. とそのディレクトリが存在するかどうか、最後に *note
ENABLE_USER_SITE: 4d9c. の値を、標準出力に出力します。

 -- Option: --user-base

     ユーザのベースディレクトリを表示します。

 -- Option: --user-site

     ユーザの site-packages ディレクトリを表示します。

両方のオプションが指定された場合、ユーザのベースとユーザの site が(常に
この順序で) *note os.pathsep: 2341. 区切りで表示されます。

いずれかのオプションが与えられた場合に、このスクリプトは次のいずれかの終
了コードで終了します: ユーザの site-packages が有効ならば ‘0’ 、ユーザに
より無効にされていれば ‘1’ 、セキュリティ的な理由あるいは管理者によって
無効にされている場合 ‘2’ 、そして何かエラーがあった場合は 2 より大きな値
。

参考
....

   * PEP 370(1) - ユーザごとの ‘site-packages’ ディレクトリ

   * PEP 829(2) - Startup entry points and the deprecation of import
     lines in ‘.pth’ files

   * *note sys.path モジュール検索パスの初期化: 1974. - *note sys.path:
     19f.  の初期化。

参考
....

   * See the *note concurrent.interpreters: 25. module, which similarly
     exposes core runtime functionality.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0370/

   (2) https://peps.python.org/pep-0829/


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: 1b7a. を継承しており、
     よく知られた ‘sys.ps1’ と ‘sys.ps2’ を使用してプロンプトと入力バッ
     ファリングを追加します。 'local_exit' が真の場合、コンソールでの
     ‘exit()’ と ‘quit()’ は *note SystemExit: 10fb. を送出せず、代わり
     に呼び出し元のコードに戻ります。

     バージョン 3.13 で変更: 'local_exit' 引数が追加されました。

 -- の関数: code.interact (banner=None, readfunc=None, local=None,
          exitmsg=None, local_exit=False)

     read-eval-print ループを実行するための便利な関数。これは *note
     InteractiveConsole: 2a36. の新しいインスタンスを作り、 'readfunc' が
     与えられた場合は *note InteractiveConsole.raw_input(): 4daa. メソッ
     ドとして使われるように設定します。 'local' が与えられた場合は、イン
     タープリターループのデフォルト名前空間として使うために
     ‘InteractiveConsole’ コンストラクタへ渡されます。 'local_exit' が与
     えられた場合は、 ‘InteractiveConsole’ コンストラクタへ渡されます。
     そして、インスタンスの *note interact(): 4dab. メソッドは、もし提供
     されていれば、見出しと終了メッセージして使うために '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: 189. を発生させます。または、コマンドが無効な
     リテラルを含む場合は、 *note OverflowError: c5b. もしくは *note
     ValueError: 15a. を発生させます。

* Menu:

* 対話的なインタプリタオブジェクト::
* 対話的なコンソールオブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/code.py


File: python.info,  Node: 対話的なインタプリタオブジェクト,  Next: 対話的なコンソールオブジェクト,  Up: code --- インタープリター基底クラス

5.31.1.1 対話的なインタプリタオブジェクト
.........................................

 -- メソッド: InteractiveInterpreter.runsource (source,
          filename='<input>', symbol='single')

     インタプリタ内のあるソースをコンパイルし実行します。引数は *note
     compile_command(): 4dac. のものと同じです。 'filename' のデフォルト
     は ‘'<input>'’ で、 'symbol' は ‘'single'’ です。あるいくつかのこと
     が起きる可能性があります:

        * 入力が不正。 *note compile_command(): 4dac. が例外(*note
          SyntaxError: 189. か *note OverflowError: c5b.)を起こした場合
          。 *note showsyntaxerror(): 4db0. メソッドの呼び出によって、構
          文トレースバックが表示されるでしょう。 *note runsource():
          4daf. は ‘False’ を返します。

        * 入力が完全でなく、さらに入力が必要。 *note compile_command():
          4dac. が ‘None’ を返した場合。 *note runsource(): 4daf. は
          ‘True’ を返します。

        * 入力が完全。 *note compile_command(): 4dac. がコードオブジェク
          トを返した場合。 (*note SystemExit: 10fb. を除く実行時例外も処
          理する) *note runcode(): 4db1. を呼び出すことによって、コード
          は実行されます。 *note runsource(): 4daf. は ‘False’ を返しま
          す。

     戻り値は、次の行のプロンプトに ‘sys.ps1’ か ‘sys.ps2’ のどちらを使
     うのか判断するために使えます。

 -- メソッド: InteractiveInterpreter.runcode (code)

     コードオブジェクトを実行します。例外が生じたときは、トレースバック
     を表示するために *note showtraceback(): 118b. が呼び出されます。伝
     搬することが許されている *note SystemExit: 10fb. を除くすべての例外
     が捉えられます。

     *note KeyboardInterrupt: d9a. についての注意。このコードの他の場所
     でこの例外が生じる可能性がありますし、常に捕らえることができるとは
     限りません。呼び出し側はそれを処理するために準備しておくべきです。

 -- メソッド: InteractiveInterpreter.showsyntaxerror (filename=None)

     起きたばかりの構文エラーを表示します。複数の構文エラーに対して一つ
     あるのではないため、これはスタックトレースを表示しません。
     'filename' が与えられた場合は、Pythonのパーサが与えるデフォルトのフ
     ァイル名の代わりに例外の中へ入れられます。なぜなら、文字列から読み
     込んでいるときはパーサは常に ‘'<string>'’ を使うからです。出力は
     *note write(): 4db2. メソッドによって書き込まれます。

 -- メソッド: InteractiveInterpreter.showtraceback ()

     起きたばかりの例外を表示します。スタックの最初の項目を取り除きます
     。なぜなら、それはインタプリタオブジェクトの実装の内部にあるからで
     す。出力は *note write(): 4db2. メソッドによって書き込まれます。

     バージョン 3.5 で変更: 最初のトレースバックではなく、完全なトレース
     バックの連鎖が表示されます。

 -- メソッド: InteractiveInterpreter.write (data)

     文字列を標準エラーストリーム(‘sys.stderr’)へ書き込みます。必要に応
     じて適切な出力処理を提供するために、派生クラスはこれをオーバーライ
     ドすべきです。


File: python.info,  Node: 対話的なコンソールオブジェクト,  Prev: 対話的なインタプリタオブジェクト,  Up: code --- インタープリター基底クラス

5.31.1.2 対話的なコンソールオブジェクト
.......................................

*note InteractiveConsole: 2a36. クラスは *note InteractiveInterpreter:
1b7a. のサブクラスです。以下の追加メソッドだけでなく、インタプリタオブジ
ェクトのすべてのメソッドも提供します。

 -- メソッド: InteractiveConsole.interact (banner=None, exitmsg=None)

     対話的な Python コンソールをそっくりにエミュレートします。オプショ
     ンの 'banner' 引数は最初のやりとりの前に表示するバナーを指定します
     。デフォルトでは、標準 Python インタプリタが表示するものと同じよう
     なバナーを表示します。それに続けて、実際のインタプリタと混乱しない
     ように (とても似ているから!)  括弧の中にコンソールオブジェクトのク
     ラス名を表示します。

     オプション引数の 'exitmsg' は、終了時に出力される終了メッセージを指
     定します。空文字列を渡すと、出力メッセージを抑止します。もし、
     'exitmsg' が与えられないか、‘None’ の場合は、デフォルトのメッセージ
     が出力されます。

     バージョン 3.4 で変更: バナーの表示を抑制するには、空の文字列を渡し
     てください。

     バージョン 3.6 で変更: 終了時に、終了メッセージを表示します。

 -- メソッド: InteractiveConsole.push (line)

     ソーステキストの一行をインタープリターへ送ります。その行の末尾に改
     行がついていてはいけません。内部に改行を持っているかもしれません。
     その行はバッファへ追加され、ソースとして連結されたバッファの内容が
     渡されインタープリターの *note runsource(): 4daf. メソッドが呼び出
     されます。コマンドが実行されたか、有効であることをこれが示している
     場合は、バッファはリセットされます。そうでなければ、コマンドが不完
     全で、その行が付加された後のままバッファは残されます。さらに入力が
     必要ならば、戻り値は ‘True’ です。その行がある方法で処理されたなら
     ば、 ‘False’ です(これは ‘runsource()’ と同じです)。

 -- メソッド: InteractiveConsole.resetbuffer ()

     入力バッファから処理されていないソーステキストを取り除きます。

 -- メソッド: InteractiveConsole.raw_input (prompt='')

     プロンプトを書き込み、一行を読み込みます。返る行は末尾に改行を含み
     ません。ユーザがEOFキーシーケンスを入力したときは、 *note EOFError:
     1693. を発生させます。基本実装では、 ‘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: 189. を発生させます。また、無効なリ
     テラルがある場合は、 *note OverflowError: c5b. または *note
     ValueError: 15a. を発生させます。

     'symbol' 引数は 'source' が文としてコンパイルされるか(‘'single'’ 、
     デフォルト) 、*note 文: 2e2d. のシーケンスとしてか (‘'exec'’) 、ま
     たは *note 式: 25e3. としてコンパイルされるかを決定します
     (‘'eval'’)。他のどんな値も *note ValueError: 15a. を送出させます。

          注釈: ソースの終わりに達する前に、成功した結果をもってパーサは
          構文解析を止めることがあります。このような場合、後ろに続く記号
          はエラーとならずに無視されます。例えば、バックスラッシュの後ろ
          に改行が2つあって、その後ろにゴミがあるかもしれません。パーサ
          のAPIがより良くなればすぐに、この挙動は修正されるでしょう。

 -- クラス: codeop.Compile

     このクラスのインスタンスは組み込み関数 *note compile(): 1d3. とシグ
     ネチャが一致する *note __call__(): 966. メソッドを持っていますが、
     インスタンスが *note __future__: 0. 文を含むプログラムテキストをコ
     ンパイルする場合は、インスタンスは有効なその文とともに続くすべての
     プログラムテキストを'覚えていて'コンパイルするという違いがあります
     。

 -- クラス: codeop.CommandCompiler

     このクラスのインスタンスは *note compile_command(): 1d70. とシグネ
     チャが一致する *note __call__(): 966. メソッドを持っています。イン
     スタンスが *note __future__: 0. 文を含むプログラムテキストをコンパ
     イルする場合に、インスタンスは有効なその文とともにそれに続くすべて
     のプログラムテキストを'覚えていて'コンパイルするという違いがありま
     す。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 9df. mechanism for *note sys.path: 19f. items
that are paths to ZIP archives.

普通、 *note sys.path: 19f. はディレクトリ名の文字列からなるリストです。
このモジュールを使うと、 ‘sys.path’ の要素に ZIP ファイルアーカイブを示
す文字列を使えるようになります。ZIP アーカイブにはサブディレクトリ構造を
含めることができ、パッケージの import をサポートさせたり、アーカイブ内の
パスを指定してサブディレクトリ下から import を行わせたりできます。例えば
、 ‘example.zip/lib/’ のように指定すると、アーカイブ中の ‘lib/’ サブディ
レクトリ下だけから import を行います。

ZIP アーカイブ内にはどんなファイルを置いてもかまいませんが、インポートは
‘.py’ および ‘.pyc’ ファイルにのみ呼び出されます。動的モジュール
(‘.pyd’, ‘.so’) の ZIP インポートは行えません。アーカイブ内に ‘.py’ ファ
イルしかない場合、 Python は対応する ‘.pyc’ ファイルを追加してアーカイブ
を変更しようとはしません。つまり、 ZIP アーカイブ内に ‘.pyc’ がない場合
は、インポートが多少遅くなるかもしれないので注意してください。

バージョン 3.15 で変更: Zstandard ('zstd') compressed zip file entries
are supported.

バージョン 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: 7a. - *note import: 9df. の実装

     Package providing the relevant protocols for all importers to
     implement.

このモジュールでは例外を一つ定義しています:

 -- 例外: zipimport.ZipImportError

     zipimporter オブジェクトが送出する例外です。 *note ImportError:
     1c8. のサブクラスなので、 ‘ImportError’ としても捕捉できます。

* Menu:

* zipimporter オブジェクト::
* 使用例: 使用例<47>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 4dc5. は ZIP ファイルを import するためのクラスです。

 -- クラス: zipimport.zipimporter (archivepath)

     新たな zipimporter インスタンスを生成します。 'archivepath' は ZIP
     ファイルへのパスまたは ZIP ファイル中の特定のパスへのパスでなければ
     なりません。たとえば、 ‘foo/bar.zip/lib’ という 'archivepath' の場
     合、 ‘foo/bar.zip’ という ZIP ファイルの中の ‘lib’ ディレクトリにあ
     るモジュールを (存在するものとして) 検索します。

     'archivepath' が有効な ZIP アーカイブを指していない場合、 *note
     ZipImportError: 4dc2. を送出します。

     バージョン 3.12 で変更: Methods ‘find_loader()’ and
     ‘find_module()’, deprecated in 3.10 are now removed.  Use *note
     find_spec(): c39. instead.

      -- メソッド: create_module (spec)

          Implementation of *note importlib.abc.Loader.create_module():
          1073. that returns *note None: a6a. to explicitly request the
          default semantics.

          Added in version 3.10.

      -- メソッド: exec_module (module)

          *note importlib.abc.Loader.exec_module(): c44. の実装です。

          Added in version 3.10.

      -- メソッド: find_spec (fullname, target=None)

          *note importlib.abc.PathEntryFinder.find_spec(): c46. の実装で
          す。

          Added in version 3.10.

      -- メソッド: get_code (fullname)

          'fullname' に指定したモジュールのコードオブジェクトを返します
          。モジュールがインポートできなかった場合には *note
          ZipImportError: 4dc2. を送出します。

      -- メソッド: get_data (pathname)

          'pathname' に関連付けられたデータを返します。該当するファイル
          が見つからなかった場合には *note OSError: 543. を送出します。

          バージョン 3.3 で変更: 以前は *note IOError: 1409. が送出され
          ました; それは現在 *note OSError: 543. のエイリアスです。

      -- メソッド: get_filename (fullname)

          指定されたモジュールが import された場合、そのモジュールに設定
          した ‘__file__’ の値を返します。モジュールがインポートできなか
          った場合、 *note ZipImportError: 4dc2. を送出します。

          Added in version 3.1.

      -- メソッド: get_source (fullname)

          'fullname' で指定されたモジュールのソースコードを返します。モ
          ジュールが見つからない場合、*note ZipImportError: 4dc2. を送出
          します。アーカイブにはモジュールがあるもののソースコードがない
          場合、 *note None: a6a. を返します。

      -- メソッド: is_package (fullname)

          'fullname' で指定されたモジュールがパッケージの場合 ‘True’ を
          返します。モジュールを見つけられない場合 *note ZipImportError:
          4dc2. を送出します。

      -- メソッド: 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: 4dcb. と *note prefix: 4dcc.
     属性は *note zipimporter: 4dc5. コンストラクタに渡された元々の
     '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: 19f. that has a subdirectory
     that matches the package name, add the subdirectory to the
     package's *note __path__: 2261.  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: cf. 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: 19f. はシーケンスであることが前提になっています。
     ‘sys.path’ の要素の内、実在するディレクトリを指す文字列となっていな
     いものは無視されます。ファイル名として使ったときにエラーが発生する
     ‘sys.path’ の Unicode要素がある場合、この関数(*note
     os.path.isdir(): dd8. を実行している行) で例外が発生する可能性があ
     ります。

 -- の関数: pkgutil.get_importer (path_item)

     指定された 'path_item' に対する *note finder: 265c. を取得します。

     path hook により新しい finder が作成された場合は、それは *note
     sys.path_importer_cache: 9e0. にキャッシュされます。

     キャッシュ (やその一部) は、 *note sys.path_hooks: 13d1. のリスキャ
     ンが必要になった場合は手動でクリアすることができます。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(2) エミュレーション
     に依存するのではなく直接的に *note importlib: 7a. に基くように更新
     されました。

 -- の関数: pkgutil.iter_importers (fullname='')

     Yield *note finder: 265c. 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: 10e7. and
     *note sys.path_hooks: 13d1.).

     その名前のついたモジュールがパッケージ内に含まれている場合、この関
     数を実行した副作用としてそのパッケージが import されます。

     モジュール名が指定されない場合は全てのトップレベルの finder が生成
     されます。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(3) エミュレーション
     に依存するのではなく直接的に *note importlib: 7a. に基くように更新
     されました。

 -- の関数: pkgutil.iter_modules (path=None, prefix='')

     'path' を指定すればそのすべてのサブモジュールに対して、 'path' が
     ‘None’ なら *note sys.path: 19f. のすべてのトップレベルモジュールに
     対して、*note ModuleInfo: 1105. を yield します。

     'path' は ‘None’ か、モジュールを検索する path のリストのどちらかで
     なければなりません。

     'prefix' は出力の全てのモジュール名の頭に出力する文字列です。

          注釈: これは ‘iter_modules()’ メソッドを定義している *note
          finder: 265c. に対してのみ動作します。このインターフェイスは非
          標準なので、モジュールは *note importlib.machinery.FileFinder:
          1429. と *note zipimport.zipimporter: 4dc5. の実装も提供します
          。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(4) エミュレーション
     に依存するのではなく直接的に *note importlib: 7a. に基くように更新
     されました。

 -- の関数: pkgutil.walk_packages (path=None, prefix='', onerror=None)

     'path' を指定すれば再帰的にその中のモジュールすべてに対して、
     'path' が ‘None’ ならばアクセスできるすべてのモジュールに対して、
     *note ModuleInfo: 1105. を yield します。

     'path' は ‘None’ か、モジュールを検索する path のリストのどちらかで
     なければなりません。

     'prefix' は出力の全てのモジュール名の頭に出力する文字列です。

     この関数は与えられた 'path' 上の全ての 'パッケージ' (全てのモジュー
     ル 'ではない') を、サブモジュールを検索するのに必要な ‘__path__’ 属
     性にアクセスするために import します。

     'onerror' は、パッケージを import しようとしたときに何かの例外が発
     生した場合に、 1つの引数 (import しようとしていたパッケージの名前)
     で呼び出される関数です。 'onerror' 関数が提供されない場合、 *note
     ImportError: 1c8. は補足され無視されます。それ以外の全ての例外は伝
     播し、検索を停止させます。

     例:

          # list all modules python can access
          walk_packages()

          # list all submodules of ctypes
          walk_packages(ctypes.__path__, ctypes.__name__ + '.')

          注釈: これは ‘iter_modules()’ メソッドを定義している *note
          finder: 265c. に対してのみ動作します。このインターフェイスは非
          標準なので、モジュールは *note importlib.machinery.FileFinder:
          1429. と *note zipimport.zipimporter: 4dc5. の実装も提供します
          。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(5) エミュレーション
     に依存するのではなく直接的に *note importlib: 7a. に基くように更新
     されました。

 -- の関数: pkgutil.get_data (package, resource)

     パッケージからリソースを取得します。

     This is a wrapper for the *note loader: 1c4f. *note get_data: 4dd4.
     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: 1c4f. method *note get_data():
     4dd5. 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(): 333. 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: 2e5.  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: 1c4f. which does not support *note get_data: 4dd4, then
     ‘None’ is returned.  In particular, the loader for *note namespace
     packages: 535. does not support ‘get_data’.

     参考
     ....

     The *note importlib.resources: 7e. module provides structured
     access to module resources.

 -- の関数: pkgutil.resolve_name (name, *, strict=False)

     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)*)?’

        * ‘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 first two forms are accepted when ‘strict=False’ (the default).

     The third form requires both the module name and callable,
     separated by a colon.  Only this form is accepted when
     ‘strict=True’.

     The function will return an object (which might be a module), or
     raise one of the following exceptions:

     *note ValueError: 15a. - if 'name' isn't in a recognised format.

     *note ImportError: 1c8. - if an import failed when it shouldn't
     have.

     *note AttributeError: 1b4. - If a failure occurred when traversing
     the object hierarchy within the imported package to get to the
     desired object.

     Added in version 3.9.

     バージョン 3.15 で変更: The optional keyword-only ‘strict’ flag was
     added.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 1ff3. クラスを提供しています。
‘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(): 4ddb. および *note report():
     4ddc. メソッドを提供しています。これらのメソッドは何らかのスクリプ
     ト中で import されているモジュールの集合を調べます。 'path' はモジ
     ュールを検索する先のディレクトリ名からなるリストです。 'path' を指
     定しない場合、 ‘sys.path’ を使います。 'debug' にはデバッグレベルを
     設定します; 値を大きくすると、実行している内容を表すデバッグメッセ
     ージを出力します。 'excludes' は検索から除外するモジュール名です。
     'replace_paths' には、モジュールパス内で置き換えられるパスをタプル
     ‘(oldpath, newpath)’ からなるリストで指定します。

      -- メソッド: report ()

          スクリプトで import しているモジュールと、そのパスからなるリス
          トを列挙したレポートを標準出力に出力します。モジュールを見つけ
          られなかったり、モジュールがないように見える場合にも報告します
          。

      -- メソッド: run_script (pathname)

          'pathname' に指定したファイルの内容を解析します。ファイルには
          Python コードが入っていなければなりません。

      -- の属性: modules

          モジュール名をモジュールに結びつける辞書。 *note ModuleFinder
          の使用例: 4dde. を参照して下さい。

* Menu:

* ModuleFinder の使用例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 4d1.
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: 7a. 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__’,
     ‘__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: a6a. でない
     場合、指定されたモジュールがパッケージであれば ‘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__’, ‘__loader__’ and ‘__package__’ are *note set as normal:
     2570. based on the module spec.

     引数 'alter_sys' が与えられて *note True: fd0. に評価されるならば、
     ‘sys.argv[0]’ は ‘__file__’ の値で更新され ‘sys.modules[__name__]’
     は実行されるモジュールの一時的モジュールオブジェクトで更新されます
     。 ‘sys.argv[0]’ と ‘sys.modules[__name__]’ はどちらも関数が処理を
     戻す前にもとの値に復旧します。

     Note that this manipulation of *note sys: e2. 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: 4d1. オプションを与えることで同じ機
     能を実現出来ます。

     バージョン 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: 247c. for
     alternatives.

     バージョン 3.15 で変更: ‘__cached__’ is no longer set.

 -- の関数: 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: 19f. 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: 19f. 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__’,
     ‘__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: a6a. でない
     場合、 'run_name' に設定され、それ以外の場合は ‘'<run_path>'’ に設
     定されます。

     If 'file_path' directly references a script file (whether as source
     or as precompiled byte code), then ‘__file__’ will be set to
     'file_path', and ‘__spec__’, ‘__loader__’ and ‘__package__’ will
     all be set to *note None: a6a.

     If 'file_path' is a reference to a valid *note sys.path: 19f.
     entry, then ‘__spec__’ will be set appropriately for the imported
     *note __main__: 1. module (that is, ‘__spec__.name’ will always be
     ‘__main__’).  ‘__file__’, ‘__loader__’ and ‘__package__’ will be
     *note set as normal: 2570. based on the module spec.

     A number of alterations are also made to the *note sys: e2. module.
     Firstly, *note sys.path: 19f. 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(): 1922, the alterations made to
     *note sys: e2. are not optional in this function as these
     adjustments are essential to allowing the execution of *note
     sys.path: 19f. 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 インターフェイスオプション: 2329. で同じ機
     能を使えます (‘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: 19f. entry rather than being executed directly.

     バージョン 3.12 で変更: The setting of ‘__cached__’, ‘__loader__’,
     and ‘__package__’ are deprecated.

     バージョン 3.15 で変更: ‘__cached__’ is no longer set.

参考
....

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 コマンドラインと環境: 1fb7. - CPython コマンドライン詳細

*note importlib.import_module(): 92c. 関数

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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/main/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: 9df. 文の(そして、拡張
として、 *note __import__(): caa. 関数の)実装を提供することです。このパ
ッケージは ‘import’ 文の、どの Python インタープリターでも動作する実装を
提供します。また、 Python 以外の言語で実装されたどの実装よりも把握しやす
い実装を提供します。

2つ目の目的は、このパッケージが公開している *note import: 9df. を実装す
るための要素を利用して、(*note インポーター: 265d. として知られる) イン
ポートプロセスで動作するカスタムのオブジェクトを実装しやすくすることです
。

Three, the package contains modules exposing additional functionality
for managing aspects of Python packages:

   * *note importlib.metadata: 7d. presents access to metadata from
     third-party distributions.

   * *note importlib.resources: 7e. provides routines for accessing
     non-code "resources" from Python packages.

参考
....

*note import 文: 9df.

     *note import: 9df. 文の言語リファレンス。

Packages specification(1)

     パッケージの元の仕様。幾つかの動作はこの仕様が書かれた頃から変更さ
     れています (例: *note sys.modules: 19da. で ‘None’ に基づくリダイレ
     クト)。

*note __import__(): 1424. 関数

     *note import: 9df. 文はこの関数のシンタックスシュガーです。

*note sys.path モジュール検索パスの初期化: 1974.

     The initialization of *note sys.path: 19f.

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__(): caa. 関数の実装です。

          注釈: プログラムからモジュールをインポートする場合はこの関数の
          代わりに *note import_module(): 92c. を使ってください。

 -- の関数: importlib.import_module (name, package=None)

     モジュールをインポートします。'name' 引数は、インポートするモジュー
     ルを絶対または相対表現 (例えば ‘pkg.mod’ または ‘..mod’) で指定しま
     す。name が相対表現で与えられたら、'package' 引数を、パッケージ名を
     解決するためのアンカーとなるパッケージの名前に設定する必要がありま
     す (例えば ‘import_module('..mod', 'pkg.subpkg')’ は ‘pkg.mod’ をイ
     ンポートします)。

     *note import_module(): 92c. 関数は *note importlib.__import__():
     1424. を単純化するラッパーとして働きます。つまり、この関数のすべて
     の意味は ‘importlib.__import__()’ から受け継いでいます。これらの2つ
     の関数の最も重要な違いは、 ‘import_module()’ が指定されたパッケージ
     やモジュール (例えば ‘pkg.mod’) を返すのに対し、 *note
     __import__(): caa. はトップレベルのパッケージやモジュール (例えば
     ‘pkg’) を返すことです。

     もしモジュールを動的にインポートしていて、インタープリタの実行開始
     後にモジュールが作成された (例えば、 Python ソースファイルを作成し
     た) 場合、インポートシステムが新しいモジュールを見つけられるように
     、 *note invalidate_caches(): fd3. を呼ぶ必要があるでしょう。

     If the module cannot be imported, ‘import_module()’ will raise
     *note ImportError: 1c8. or an appropriate subclass like *note
     ModuleNotFoundError: 1c9.

     バージョン 3.3 で変更: 親パッケージは自動的にインポートされます。

 -- の関数: importlib.invalidate_caches ()

     *note sys.meta_path: 10e7. に保存されたファインダーの内部キャッシュ
     を無効にします。ファインダーが ‘invalidate_caches()’ を実装していれ
     ば、無効化を行うためにそれが呼び出されます。すべてのファインダーが
     新しいモジュールの存在に気づくことを保証しているプログラムの実行中
     に、モジュールが作成またはインストールされたなら、この関数が呼び出
     されるべきです。

     Added in version 3.3.

     バージョン 3.10 で変更: Namespace packages created/installed in a
     different *note sys.path: 19f. location after the same namespace
     was already imported are noticed.

 -- の関数: importlib.reload (module)

     以前にインポートされた 'module' をリロードします。引数はモジュール
     オブジェクトでなければならず、したがってそれ以前に必ずインポートに
     成功していなければなりません。この関数は、モジュールのソースファイ
     ルを外部エディタで編集していて Python インタープリタから離れること
     なく新しいバージョンを試したい際に便利です。戻り値はモジュールオブ
     ジェクトです。 (もし再インポートが異なるオブジェクトを *note
     sys.modules: 19da. に配置したら、元の 'module' とは異なるかもしれま
     せん。)

     *note reload(): 92d. が実行された場合:

        * Python モジュールのコードは再コンパイルされ、モジュールレベル
          のコードが再度実行されます。モジュールの辞書中にある何らかの名
          前に結び付けられたオブジェクトは、そのモジュールを最初にロード
          したときの *note ローダー: 1c4f. を再利用して新たに定義されま
          す。拡張モジュールの ‘init’ 関数が二度呼び出されることはありま
          せん。

        * Python における他のオブジェクトと同様、以前のオブジェクトのメ
          モリ領域は、参照カウントがゼロにならないかぎり再利用されません
          。

        * モジュール名前空間内の名前は新しいオブジェクト (または更新され
          たオブジェクト) を指すよう更新されます。

        * 以前のオブジェクトが (外部の他のモジュールなどからの) 参照を受
          けている場合、それらを新たなオブジェクトに再束縛し直すことはな
          いので、必要なら自分で名前空間を更新しなければなりません。

     いくつか補足説明があります:

     モジュールが再ロードされた際、その辞書 (モジュールのグローバル変数
     を含みます) はそのまま残ります。名前の再定義を行うと、以前の定義を
     上書きするので、一般的には問題はありません。新たなバージョンのモジ
     ュールが古いバージョンで定義された名前を定義していない場合、古い定
     義がそのまま残ります。辞書がグローバルテーブルやオブジェクトのキャ
     ッシュを維持していれば、この機能をモジュールを有効性を引き出すため
     に使うことができます -- つまり、 *note try: adb. 文を使えば、必要に
     応じてテーブルがあるかどうかをテストし、その初期化を飛ばすことがで
     きます:

          try:
              cache
          except NameError:
              cache = {}

     組み込みモジュールや動的にロードされるモジュールを再ロードすること
     は、一般的にそれほど便利ではありません。 *note sys: e2, *note
     __main__: 1, *note builtins: 13. やその他重要なモジュールの再ロード
     はお勧め出来ません。多くの場合、拡張モジュールは 1 度以上初期化され
     るようには設計されておらず、再ロードされた場合には何らかの理由で失
     敗するかもしれません。

     一方のモジュールが *note from: 1665. ...  *note import: 9df. ...  を
     使って、オブジェクトを他方のモジュールからインポートしているなら、
     他方のモジュールを *note reload(): 92d. で呼び出しても、そのモジュ
     ールからインポートされたオブジェクトを再定義することはできません --
     この問題を回避する一つの方法は、 ‘from’ 文を再度実行することで、も
     う一つの方法は ‘from’ 文の代わりに ‘import’ と限定的な名前
     ('module.name') を使うことです。

     あるモジュールがクラスのインスタンスを生成している場合、そのクラス
     を定義しているモジュールの再ロードはそれらインスタンスのメソッド定
     義に影響しません -- それらは古いクラス定義を使い続けます。これは派
     生クラスの場合でも同じです。

     Added in version 3.4.

     バージョン 3.7 で変更: リロードされたモジュールの *note ModuleSpec:
     247c. が欠けていたときは *note ModuleNotFoundError: 1c9. が送出され
     ます。

          警告: 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: 1a30. 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: 9df.  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: 1427. を表す抽象基底クラスです。

     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: 2572. 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__: 2261.
          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(): c47.
          may be useful for implementing concrete ‘MetaPathFinders’.

          Added in version 3.4.

      -- メソッド: invalidate_caches ()

          このファインダーで使われている内部キャッシュがあれば無効にする
          オプションのメソッドです。 *note sys.meta_path: 10e7. 上のすべ
          てのファインダーのキャッシュを無効化する際、 *note
          importlib.invalidate_caches(): fd3. によって使われます。

          バージョン 3.4 で変更: Returns ‘None’ when called instead of
          *note NotImplemented: 447.

      -- メソッド: discover (parent=None)

          An optional method which searches for possible specs with
          given 'parent' module spec.  If 'parent' is 'None',
          ‘MetaPathFinder.discover()’ will search for top-level modules.

          Returns an iterable of possible specs.

          Raises *note ValueError: 15a. if 'parent' is not a package
          module.

               警告: This method can potentially yield a very large
               number of objects, and it may carry out IO operations
               when computing these values.

               Because of this, it will generally be desirable to
               compute the result values on-the-fly, as they are needed.
               As such, the returned object is only guaranteed to be an
               *note iterable: 28c2, instead of a *note list: 4e0. or
               other *note collection: 104b. type.

          Added in version 3.15.

 -- クラス: importlib.abc.PathEntryFinder

     *note path entry finder: 1428. を表す抽象基底クラスです。 *note
     MetaPathFinder: c48. と似ているところがありますが、
     ‘PathEntryFinder’ は *note importlib.machinery.PathFinder: 13d0. が
     提供するパスに基づく import サブシステムの中でのみ使うことが意図さ
     れています。

     Added in version 3.3.

     バージョン 3.10 で変更: No longer a subclass of ‘Finder’.

      -- メソッド: find_spec (fullname, target=None)

          指定されたモジュールに対応する *note スペック: 2572. を検索す
          る抽象メソッド。ファインダーは、割り当てられている *note
          パス・エントリー: 266d. 内のモジュールだけを検索します。スペッ
          クが見つからなければ ‘None’ が返されます。 ‘target’ は、渡され
          てきたならモジュールオブジェクトです。これはファインダーがどの
          ようなスペックを返せばよいか推測するために使用します。具体的な
          ‘PathEntryFinders’ を実装するためには *note
          importlib.util.spec_from_loader(): c47. が便利かもしれません。

          Added in version 3.4.

      -- メソッド: invalidate_caches ()

          このファインダーで使われている内部キャッシュがあれば無効にする
          オプションのメソッドです。キャッシュされたすべてのファインダー
          の無効化する際、 *note
          importlib.machinery.PathFinder.invalidate_caches(): fd2. によ
          って使われます。

      -- メソッド: discover (parent=None)

          An optional method which searches for possible specs with
          given 'parent' module spec.  If 'parent' is 'None',
          ‘PathEntryFinder.discover()’ will search for top-level
          modules.

          Returns an iterable of possible specs.

          Raises *note ValueError: 15a. if 'parent' is not a package
          module.

               警告: This method can potentially yield a very large
               number of objects, and it may carry out IO operations
               when computing these values.

               Because of this, it will generally be desirable to
               compute the result values on-the-fly, as they are needed.
               As such, the returned object is only guaranteed to be an
               *note iterable: 28c2, instead of a *note list: 4e0. or
               other *note collection: 104b. type.

          Added in version 3.15.

 -- クラス: importlib.abc.Loader

          *note loader: 1c4f. の抽象基底クラスです。ローダーの厳密な定義
          は PEP 302(2) を参照してください。

          リソースの読み出しをサポートさせたいローダーには、 *note
          importlib.resources.abc.ResourceReader: 4deb. で指定されている
          ‘get_resource_reader()’ メソッドを実装してください。

          バージョン 3.7 で変更: オプションの ‘get_resource_reader()’ メ
          ソッドが導入されました。

     バージョン 3.15 で変更: Removed the ‘load_module()’ method.

      -- メソッド: create_module (spec)

          モジュールをインポートする際に使用されるモジュールオブジェクト
          を返すメソッド。このメソッドは ‘None’ を戻すことができ、その場
          合はデフォルトのモジュール作成のセマンティクスが適用されること
          を示します。

          Added in version 3.4.

          バージョン 3.6 で変更: *note exec_module(): c44. が定義されて
          いる場合は、このメソッドはオプションではなくなりました。

      -- メソッド: exec_module (module)

          モジュールがインポートまたはリロードされる際に、そのモジュール
          をモジュール自身の名前空間の中で実行する抽象的なメソッド。
          *note exec_module(): c44. が呼ばれる時点で、モジュールはすでに
          初期設定されている必要があります。 このメソッドが存在するとき
          は、 *note create_module(): 1073. の定義が必須です。

          Added in version 3.4.

          バージョン 3.6 で変更: *note create_module(): 1073. の定義が必
          須となりました。

 -- クラス: importlib.abc.ResourceLoader

     'TraversableResources に取って代わられました'

          *note loader: 1c4f. の抽象基底クラスで、ストレージバックエンド
          から任意のリソースをロードするオプションの PEP 302(3) プロトコ
          ルを実装します。

          バージョン 3.7 で非推奨: This ABC is deprecated in favour of
          supporting resource loading through *note
          importlib.resources.abc.TraversableResources: 578.  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: 543. is
                    to be raised if the 'path' cannot be found.  The
                    'path' is expected to be constructed using a
                    module's *note __file__: 2578. attribute or an item
                    from a package's *note __path__: 2261.

                    バージョン 3.4 で変更: *note NotImplementedError:
                    5a1. の代わりに *note OSError: 543. を送出します。

 -- クラス: importlib.abc.InspectLoader

     *note loader: 1c4f. の抽象基底クラスで、ローダーがモジュールを検査
     するためのオプションの PEP 302(4) プロトコルを実装します。

      -- メソッド: get_code (fullname)

          モジュールの *note code: 1b. オブジェクトを返すか、 (例えば組
          み込みモジュールの場合に) モジュールがコードオブジェクトを持た
          なければ ‘None’ を返します。要求されたモジュールをローダーが見
          つけられなかった場合は *note ImportError: 1c8. を送出します。

               注釈: このメソッドにはデフォルト実装がありますが、とはい
               えパフォーマンスのために、可能ならばオーバライドしたほう
               が良いです。

          バージョン 3.4 で変更: このメソッドはもはや抽象メソッドではな
          く、具象実装が提供されます。

      -- メソッド: abstractmethod get_source (fullname)

               モジュールのソースを返す抽象メソッドです。これは認識され
               たすべての行セパレータを ‘'\n'’ 文字に変換し、 *note
               universal newlines: 10f5. を使ったテキスト文字列として返
               されます。利用できるソースがなければ (例えば組み込みモジ
               ュール)、 ‘None’ を返します。指定されたモジュールが見つか
               らなければ、 *note ImportError: 1c8. を送出します。

               バージョン 3.4 で変更: *note NotImplementedError: 5a1. の
               代わりに *note ImportError: 1c8. を送出します。

      -- メソッド: is_package (fullname)

          モジュールがパッケージであれば True を返し、そうでなければ
          False を返すオプションのメソッドです。 *note ローダー: 1c4f. が
          モジュールを見つけられなかったなら *note ImportError: 1c8. が
          送出されます。

          バージョン 3.4 で変更: *note NotImplementedError: 5a1. の代わ
          りに *note ImportError: 1c8. を送出します。

      -- メソッド: static source_to_code (data, path='<string>',
               fullname=None)

          Python のソースからコードオブジェクトを作ります。

          'data' 引数は *note compile(): 1d3. 関数がサポートするもの (す
          なわち文字列かバイト) なら何でも構いません。'path' 引数はソー
          スコードの元々の場所への "パス" でなければなりませんが、抽象概
          念 (例えば zip ファイル内の場所) でも構いません。

          結果のコードオブジェクトを使って、 ‘exec(code,
          module.__dict__)’ を呼ぶことでモジュール内でコードを実行できま
          す。

          The optional argument 'fullname' specifies the module name.
          It is needed to unambiguous *note filter: 1d7. syntax warnings
          by module name.

          Added in version 3.4.

          バージョン 3.5 で変更: スタティックメソッドになりました。

          Added in version 3.15: Added the 'fullname' parameter.

      -- メソッド: exec_module (module)

          *note Loader.exec_module(): c44. の実装です。

          Added in version 3.4.

 -- クラス: importlib.abc.ExecutionLoader

     *note InspectLoader: 1303. から継承された抽象基底クラスで、実装され
     ていれば、モジュールをスクリプトとして実行する助けになります。この
     抽象基底クラスはオプションの PEP 302(5) プロトコルを表します。

      -- メソッド: abstractmethod get_filename (fullname)

               An abstract method that is to return the value of *note
               __file__: 2578. for the specified module.  If no path is
               available, *note ImportError: 1c8. is raised.

               ソースコードが利用できるなら、そのモジュールのロードにバ
               イトコードが使われたかにかかわらず、このメソッドはそのソ
               ースファイルへのパスを返す必要があります。

               バージョン 3.4 で変更: *note NotImplementedError: 5a1. の
               代わりに *note ImportError: 1c8. を送出します。

 -- クラス: importlib.abc.FileLoader (fullname, path)

     *note ResourceLoader: fab. と *note ExecutionLoader: 4ded. から継承
     された抽象基底クラスで、 *note ResourceLoader.get_data(): 4dd4. お
     よび *note ExecutionLoader.get_filename(): 4dee. の具象実装を提供し
     ます。

     'fullname' 引数は、ローダーが解決しようとするモジュールの、完全に解
     決された名前です。'path' 引数は、モジュールのファイルへのパスです。

     Added in version 3.3.

     バージョン 3.15 で変更: Removed the ‘load_module()’ method.

      -- の属性: name

          ローダーが扱えるモジュールの名前です。

      -- の属性: path

          モジュールのファイルへのパスです。

      -- メソッド: abstractmethod get_filename (fullname)

          *note path: 4df0. を返します。

      -- メソッド: abstractmethod get_data (path)

          'path' をバイナリファイルとして読み込み、そのバイト列を返しま
          す。

 -- クラス: importlib.abc.SourceLoader

     ソース (オプションでバイトコード) ファイルのロードを実装する抽象基
     底クラスです。このクラスは、 *note ResourceLoader: fab. と *note
     ExecutionLoader: 4ded. の両方を継承し、以下の実装が必要です:

        * *note ResourceLoader.get_data(): 4dd4.

        * 
          *note ExecutionLoader.get_filename(): 4dee.

               ソースファイルへのパスのみを返す必要があります。ソースな
               しのロードはサポートされていません。

     このクラスでこれらの抽象メソッドを定義することで、バイトコードファ
     イルを追加でサポートします。これらのメソッドを定義しなければ (また
     はそのモジュールが *note NotImplementedError: 5a1. を送出すれば)、
     このローダーはソースコードに対してのみ働きます。これらのメソッドを
     実装することで、ローダーはソースとバイトコードファイル 'の組み合わ
     せ' に対して働きます。バイトコードのみを与えた 'ソースのない' ロー
     ドは認められません。バイトコードファイルは、 Python コンパイラによ
     る解析の工程をなくして速度を上げる最適化です。ですから、バイトコー
     ド特有の API は公開されていません。

     バージョン 3.15 で変更: Removed the ‘load_module()’ method.

      -- メソッド: path_stats (path)

          指定されたパスについてのメタデータを含む *note dict: 193. を返
          す、オプションの抽象メソッドです。サポートされる辞書のキーは:

             - ‘'mtime'’ (必須): ソースコードの更新時刻を表す整数または
               浮動小数点数です。

             - ‘'size'’ (任意): バイト数で表したソースコードのサイズです
               。

          未来の拡張のため、辞書内の他のキーは無視されます。パスが扱えな
          ければ、 *note OSError: 543. が送出されます。

          Added in version 3.3.

          バージョン 3.4 で変更: *note NotImplementedError: 5a1. の代わ
          りに *note OSError: 543. を送出します。

      -- メソッド: path_mtime (path)

          指定されたパスの更新時刻を返す、オプションの抽象メソッドです。

          バージョン 3.3 で非推奨: このメソッドは廃止され、 *note
          path_stats(): 1547. が推奨されます。このモジュールを実装する必
          要はありませんが、互換性のため現在も利用できます。パスが扱えな
          ければ、 *note OSError: 543. が送出されます。

          バージョン 3.4 で変更: *note NotImplementedError: 5a1. の代わ
          りに *note OSError: 543. を送出します。

      -- メソッド: set_data (path, data)

          ファイルパスに指定されたバイト列を書き込むオプションの抽象メソ
          ッドです。存在しない中間ディレクトリがあれば、自動で作成されま
          す。

          When writing to the path fails because the path is read-only
          (*note errno.EACCES: 2920./*note PermissionError: 10fd.), do
          not propagate the exception.

          バージョン 3.4 で変更: 呼ばれたときに *note
          NotImplementedError: 5a1. を送出することは最早ありません。

      -- メソッド: get_code (fullname)

          *note InspectLoader.get_code(): 1304. の具象実装です。

      -- メソッド: exec_module (module)

          *note Loader.exec_module(): c44. の具象実装です。

          Added in version 3.4.

      -- メソッド: get_source (fullname)

          *note InspectLoader.get_source(): 1307. の具象実装です。

      -- メソッド: is_package (fullname)

          *note InspectLoader.is_package(): 4dec. の具象実装です。モジュ
          ールは、次の '両方' を満たすならパッケージであると決定されます
          。モジュールの (*note ExecutionLoader.get_filename(): 4dee. で
          与えられる) ファイルパスが、ファイル拡張子を除くと ‘__init__’
          という名のファイルであること。モジュール名自体が ‘__init__’ で
          終わらないこと。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 9df. がモジュールを検索してロードする
のに役立つ様々なオブジェクトがあります。

 -- データ: 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: 92a. instead.

 -- データ: importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES

     最適化されたバイトコードモジュールのファイル接尾辞を表す文字列のリ
     ストです。

     Added in version 3.3.

     バージョン 3.5 で非推奨: Use *note BYTECODE_SUFFIXES: 92a. 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(): 10f4.) です。

     Added in version 3.3.

 -- クラス: importlib.machinery.BuiltinImporter

     組み込みモジュールの *note importer: 265d. です。すべての既知のモジ
     ュールは *note sys.builtin_module_names: 2254. に列挙されています。
     このクラスは *note importlib.abc.MetaPathFinder: c48. および *note
     importlib.abc.InspectLoader: 1303. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     バージョン 3.5 で変更: PEP 489(2) の一環として、ビルトインインポー
     ターは ‘Loader.create_module()’ と ‘Loader.exec_module()’ を実装し
     ています。

 -- クラス: importlib.machinery.FrozenImporter

     フリーズされたモジュールの *note インポーター: 265d. です。このクラ
     スは *note importlib.abc.MetaPathFinder: c48. および *note
     importlib.abc.InspectLoader: 1303. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     バージョン 3.4 で変更: Gained ‘create_module()’ and ‘exec_module()’
     methods.

 -- クラス: importlib.machinery.WindowsRegistryFinder

     Windows レジストリで宣言されたモジュールの *note finder: 265c. です
     。このクラスは *note importlib.abc.MetaPathFinder: c48. 抽象基底ク
     ラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     Added in version 3.3.

     バージョン 3.6 で非推奨: 代わりに *note site: cf. の設定を使ってく
     ださい。 Python の将来のバージョンでは、デフォルトでこのファインダ
     ーが使えなくなるかもしれません。

 -- クラス: importlib.machinery.PathFinder

     *note sys.path: 19f. およびパッケージの ‘__path__’ 属性の *note
     Finder: 265c. です。このクラスは *note
     importlib.abc.MetaPathFinder: c48. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

      -- メソッド: classmethod find_spec (fullname, path=None,
               target=None)

          *note sys.path: 19f. または定義されていれば 'path' から、
          'fullname' で指定されたモジュールの *note スペック: 2572. の検
          索を試みるクラスメソッドです。検索されるそれぞれのパスエントリ
          に対して *note sys.path_importer_cache: 9e0. が検査されます。
          偽でないオブジェクトが見つかれば、それが目的のモジュールを検索
          するための *note パスエントリ・ファインダー: 1428. として使わ
          れます。 ‘sys.path_importer_cache’ に目的のエントリが見つから
          なければ、パスエントリに対するファインダーが *note
          sys.path_hooks: 13d1. から検索され、見つかれば、それが
          ‘sys.path_importer_cache’ に保管されるとともに、モジュールにつ
          いて問い合わせられます。それでもファインダーが見つからなければ
          ‘None’ が保管され、また返されます。

          Added in version 3.4.

          バージョン 3.5 で変更: もしカレントワーキングディレクトリ - 空
          の文字列によって表されている - がすでに有効でなければ、 ‘None’
          が返されますが値は *note sys.path_importer_cache: 9e0. にキャ
          ッシュされません。

      -- メソッド: classmethod invalidate_caches ()

          Calls *note importlib.abc.PathEntryFinder.invalidate_caches():
          4dea. on all finders stored in *note sys.path_importer_cache:
          9e0. 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: 9e0. are deleted.

     バージョン 3.4 で変更: ‘''’ (すなわち空の文字列) に対してはカレント
     ワーキングディレクトリとともに *note sys.path_hooks: 13d1. のオブジ
     ェクトを呼び出します。

 -- クラス: importlib.machinery.FileFinder (path, *loader_details)

     ファイルシステムからの結果をキャッシュする *note
     importlib.abc.PathEntryFinder: c49. の具象実装です。

     'path' 引数は検索を担当するファインダーのディレクトリです。

     'loader_details' 引数は、可変個の 2 要素タプルで、それぞれがローダ
     ーとローダーが認識するファイル接尾辞のシーケンスとを含みます。ロー
     ダーは、呼び出し可能でモジュール名と見つかったファイルのパスとの 2
     引数を受け付けることを期待されます。

     ファインダーはモジュール検索のたびに stat を呼び出し、必要に応じて
     ディレクトリの内容をキャッシュすることで、コードキャッシュが古くな
     っていないことを確かめます。キャッシュの古さはオペレーティングシス
     テムのファイルシステムのステート情報の粒度に依存しますから、モジュ
     ールを検索し、新しいファイルを作成し、その後に新しいファイルが表す
     モジュールを検索する、という競合状態の可能性があります。この操作が
     stat の呼び出しの粒度に収まるほど速く起こると、モジュールの検索が失
     敗します。これを防ぐためには、モジュールを動的に作成する際に、必ず
     *note importlib.invalidate_caches(): fd3. を呼び出してください。

     Added in version 3.3.

      -- の属性: path

          ファインダーが検索されるパスです。

      -- メソッド: find_spec (fullname, target=None)

          *note path: 4df7. 内で '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: 13d1.  An instance of *note FileFinder: 1429.
          is returned by the closure using the path argument given to
          the closure directly and 'loader_details' indirectly.

          クロージャへの引数が存在するディレクトリでなければ、 *note
          ImportError: 1c8. が送出されます。

 -- クラス: importlib.machinery.NamespacePath (name, path, path_finder)

     Represents a *note namespace package: 535.'s path (*note
     module.__path__: 2261.).

     When its ‘__path__’ value is accessed it will be recomputed if
     necessary.  This keeps it in-sync with the global state (*note
     sys.modules: 19da.).

     The 'name' argument is the name of the namespace module.

     The 'path' argument is the initial path value.

     The 'path_finder' argument is the callable used to recompute the
     path value.  The callable has the same signature as *note
     importlib.abc.MetaPathFinder.find_spec(): c43.

     When the parent's *note module.__path__: 2261. attribute is
     updated, the path value is recomputed.

     If the parent module is missing from *note sys.modules: 19da, then
     *note ModuleNotFoundError: 1c9. will be raised.

     For top-level modules, the parent module's path is *note sys.path:
     19f.

          注釈: *note PathFinder.invalidate_caches(): fd2. invalidates
          ‘NamespacePath’, forcing the path value to be recomputed next
          time it is accessed.

     Added in version 3.15.

 -- クラス: importlib.machinery.SourceFileLoader (fullname, path)

     *note importlib.abc.FileLoader: 142a. を継承し、その他いくつかのメ
     ソッドの具象実装を提供する、 *note importlib.abc.SourceLoader:
     4df2. の具象実装です。

     Added in version 3.3.

     バージョン 3.15 で変更: Removed the ‘load_module()’ method.

      -- の属性: name

          このローダーが扱うモジュールの名前です。

      -- の属性: path

          ソースファイルへのパスです。

      -- メソッド: is_package (fullname)

          *note path: 4dfb. がパッケージを表すとき ‘True’ を返します。

      -- メソッド: path_stats (path)

          *note importlib.abc.SourceLoader.path_stats(): 1547. の具象実
          装です。

      -- メソッド: set_data (path, data)

          *note importlib.abc.SourceLoader.set_data(): 4df3. の具象実装
          です。

 -- クラス: importlib.machinery.SourcelessFileLoader (fullname, path)

     バイトコードファイル (すなわちソースコードファイルが存在しない) を
     インポートできる *note importlib.abc.FileLoader: 142a. の具象実装で
     す。

     注意として、バイトコードを直接使う (つまりソースコードファイルがな
     い) と、そのモジュールはすべての Python 実装では使用できないし、新
     しいバージョンの Python ではバイトコードフォーマットが変更されてい
     たら使用できません。

     Added in version 3.3.

     バージョン 3.15 で変更: Removed the ‘load_module()’ method.

      -- の属性: name

          ローダーが扱うモジュールの名前です。

      -- の属性: path

          バイトコードファイルへのパスです。

      -- メソッド: is_package (fullname)

          そのモジュールがパッケージであるかを *note path: 4e00. に基づ
          いて決定します。

      -- メソッド: get_code (fullname)

          *note path: 4e00. から作成された *note name: 4dff. のコードオ
          ブジェクトを返します。

      -- メソッド: get_source (fullname)

          このローダーが使われたとき、バイトコードファイルのソースがなけ
          れば ‘None’ を返します。

 -- クラス: importlib.machinery.ExtensionFileLoader (fullname, path)

     拡張モジュールのための *note importlib.abc.ExecutionLoader: 4ded. の
     具象実装です。

     '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: 929.

      -- メソッド: get_code (fullname)

          拡張モジュールにコードオブジェクトがなければ ‘None’ を返します
          。

      -- メソッド: get_source (fullname)

          拡張モジュールにソースコードがなければ ‘None’ を返します。

      -- メソッド: get_filename (fullname)

          *note path: 4e05. を返します。

          Added in version 3.4.

 -- クラス: importlib.machinery.NamespaceLoader (name, path,
          path_finder)

     A concrete implementation of *note importlib.abc.InspectLoader:
     1303. 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__: 2573.
     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__: 2578. at runtime and this will not be automatically
     reflected in the module's *note __spec__.origin: 4e0b, and vice
     versa.

     Added in version 3.4.

      -- の属性: name

          The module's fully qualified name (see *note module.__name__:
          1744.).  The *note finder: 265c. should always set this
          attribute to a non-empty string.

      -- の属性: loader

          The *note loader: 1c4f. used to load the module (see *note
          module.__loader__: 30b.).  The *note finder: 265c. should
          always set this attribute.

      -- の属性: origin

          The location the *note loader: 1c4f. should use to load the
          module (see *note module.__file__: 2578.).  For example, for
          modules loaded from a ‘.py’ file this is the filename.  The
          *note finder: 265c. 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: 904. of strings enumerating
          the locations in which a package's submodules will be found
          (see *note module.__path__: 2261.).  Most of the time there
          will only be a single directory in this list.

          The *note finder: 265c. 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: 265c. 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.  The
          *note finder: 265c. 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__: 593.  If the module is a package then this
          is the same as *note name: 2574.

      -- の属性: has_location

          ‘True’ if the spec's *note origin: 4e0b. refers to a loadable
          location, ‘False’ otherwise.  This value impacts how ‘origin’
          is interpreted and how the module's *note __file__: 2578. is
          populated.

 -- クラス: importlib.machinery.AppleFrameworkLoader (name, path)

     フレームワーク形式の拡張モジュールを読み込み事ができる、特殊な
     *note importlib.machinery.ExtensionFileLoader: 1075. です。

     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: 234c.: iOS.

      -- の属性: name

          ローダーがサポートするモジュールの名前です。

      -- の属性: path

          拡張モジュールの ‘.fwork’ ファイルへのパス。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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 インポーター: 265d. の構築を助ける様々なオブ
ジェクトがあります。

 -- データ: importlib.util.MAGIC_NUMBER

     バイトコードバージョン番号を表しているバイト列。バイトコードのロー
     ド／書き込みについてヘルプが必要なら *note
     importlib.abc.SourceLoader: 4df2. を参照してください。

     Added in version 3.4.

 -- の関数: importlib.util.cache_from_source (path, *,
          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: 5a1. が送出されます。)

     '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: 15a. が上げられます。

     Added in version 3.4.

     バージョン 3.5 で変更: 'optimization' パラメータが追加され、
     'debug_override' パラメータは deprecated になりました。

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

     バージョン 3.15 で変更: The 'debug_override' parameter was removed.

 -- の関数: 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: 15a. が送出されます。
     ‘sys.implementation.cache_tag’ が定義されていない場合、 *note
     NotImplementedError: 5a1. が送出されます。

     Added in version 3.4.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: importlib.util.decode_source (source_bytes)

     与えられたソースコードを表すバイト列をデコードして、文字列としてそ
     れを一般的な改行形式 (universal newlines) で返します (*note
     importlib.abc.InspectLoader.get_source(): 1307. で要求されるように
     )。

     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: 1c8. が送出
     されます。相対的な名前がそれを含むパッケージから抜け出る (例えば
     ‘spam’ パッケージ内から ‘..bacon’ を要求する) 場合にも
     ‘ImportError’ が送出されます。

     Added in version 3.3.

     バージョン 3.9 で変更: To improve consistency with import
     statements, raise *note ImportError: 1c8. instead of *note
     ValueError: 15a. for invalid relative import attempts.

 -- の関数: importlib.util.find_spec (name, package=None)

     Find the *note spec: 2572. for a module, optionally relative to the
     specified 'package' name.  If the module is in *note sys.modules:
     19da, then ‘sys.modules[name].__spec__’ is returned (unless the
     spec would be ‘None’ or is not set, in which case *note ValueError:
     15a. is raised).  Otherwise a search using *note sys.meta_path:
     10e7. 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: 1c9.
     instead of *note AttributeError: 1b4. if 'package' is in fact not a
     package (i.e.  lacks a *note __path__: 2261. attribute).

 -- の関数: importlib.util.module_from_spec (spec)

     'spec' と *note spec.loader.create_module: 1073. に基づいて新しいモ
     ジュールを作ります。

     *note spec.loader.create_module: 1073. が ‘None’ を返さない場合は、
     既に存在するどの属性もリセットされません。また、 'spec' にアクセス
     したり属性をモジュールに設定したりする際に *note AttributeError:
     1b4. 例外が起きても例外は送出されません。

     この関数は、新しいモジュールを作る方法として *note
     types.ModuleType: 11cb. よりも推奨されます。なぜなら、できるだけ多
     くのインポートコントロールされた属性をモジュールに設定するために
     'spec' が使用されるからです。

     Added in version 3.5.

 -- の関数: importlib.util.spec_from_loader (name, loader, *,
          origin=None, is_package=None)

     この関数は、スペックに不足している情報を埋めるために *note
     ModuleSpec: 247c. のような利用可能な *note loader: 1c4f. API を使い
     ます。

     Added in version 3.4.

 -- の関数: importlib.util.spec_from_file_location (name, location, *,
          loader=None, submodule_search_locations=None)

     ファイルへのパスにもとづいて *note ModuleSpec: 247c. インスタンスを
     生成するためのファクトリー関数。不足している情報は、ローダー API を
     利用してスペックから得られる情報と、モジュールがファイルベースであ
     るという暗黙的な情報によって埋められます。

     Added in version 3.4.

     バージョン 3.6 で変更: *note path-like object: 7a5. を受け入れるよ
     うになりました。

 -- の関数: 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(): c44. as control over what module type is used for
     the module is required.  For those same reasons, the loader's *note
     create_module(): 1073. method must return ‘None’ or a type for
     which its ‘__class__’ attribute can be mutated along with not using
     *note slots: 9de.  Finally, modules which substitute the object
     placed into *note sys.modules: 19da. will not work as there is no
     way to properly replace the module references throughout the
     interpreter safely; *note ValueError: 15a. is raised if such a
     substitution is detected.

          注釈: 起動時間が重要なプロジェクトでは、もし決して使われないモ
          ジュールがあれば、このクラスを使ってモジュールをロードするコス
          トを最小化できるかもしれません。スタートアップ時間が重要でない
          プロジェクトでは、遅延されたロードの際に発生して文脈の外で起こ
          るエラーメッセージのため、このクラスの使用は '著しく' 推奨され
          ません。

     Added in version 3.5.

     バージョン 3.6 で変更: Began calling *note create_module(): 1073,
     removing the compatibility warning for *note
     importlib.machinery.BuiltinImporter: 1074. and *note
     importlib.machinery.ExtensionFileLoader: 1075.

      -- メソッド: 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/main/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(): 92c. を使ってください。

     import importlib

     itertools = importlib.import_module('itertools')


File: python.info,  Node: モジュールがインポートできるか確認する,  Next: ソースファイルから直接インポートする,  Prev: プログラムからのインポート,  Up: 使用例<48>

5.32.5.8 モジュールがインポートできるか確認する
...............................................

インポートを実際に行わずに、あるモジュールがインポートできるかを知る必要
がある場合は、 *note importlib.util.find_spec(): 7ad. を使ってください。

Note that if ‘name’ is a submodule (contains a dot), *note
importlib.util.find_spec(): 7ad. 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: 19f. 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(): 6b4. 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: 265d.  This means managing both the *note finder: 265c.
and *note loader: 1c4f. side of things.  For finders there are two
flavours to choose from depending on your needs: a *note meta path
finder: 1427. or a *note path entry finder: 1428.  The former is what
you would put on *note sys.meta_path: 10e7. while the latter is what you
create using a *note path entry hook: 266f. on *note sys.path_hooks:
13d1. which works with *note sys.path: 19f. 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(): 92c.:

     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: 2e5. 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: 13b. を使って zip ファイルからインポートすること
ができます。

     警告: ‘importlib.resources’ follows the same security model as the
     built-in *note open(): 333. function.  Passing untrusted inputs to
     the functions in this module is unsafe.

     注釈: このモジュールのスタンドアローンバックポートでは、
     importlib.resources の使用(2) と pkg_resources から
     importlib.resources への移行(3) についての詳細情報を提供しています
     。

*note Loaders: 1278. でリソースの読み込みをサポートしたい場合は、 *note
importlib.resources.abc.ResourceReader: 4deb. で指定された
‘get_resource_reader(fullname)’ メソッドを実装しなければいけません。

 -- クラス: importlib.resources.Anchor

     Represents an anchor for resources, either a *note module object:
     11cb. or a module name as a string.  Defined as ‘Union[str,
     ModuleType]’.

 -- の関数: importlib.resources.files (anchor: Anchor | None = None)

     Returns a *note Traversable: 579. 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: 4e1e.  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'.  'package' was still accepted, but deprecated.

     バージョン 3.15 で変更: 'package' parameter was fully removed.
     'anchor' can now be a non-package module and if omitted will
     default to the caller's module.  'package' is no longer accepted
     since Python 3.15.  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: 579. object representing a file or
     directory, typically from *note importlib.resources.files(): 2e2,
     return a context manager for use in a *note with: 215. statement.
     The context manager provides a *note pathlib.Path: 4f5. 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/main/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: 4e1e, as in *note files(): 2e2.
     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: 579, 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: 4e20. for details on 'anchor' and
     'path_names'.

     This function returns a *note BinaryIO: 4cf. 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: 4e20. for details on 'anchor' and
     'path_names'.  'encoding' and 'errors' have the same meaning as in
     built-in *note open(): 333.

     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: 4ce. 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:
     1d2.

     See *note the introduction: 4e20. 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:
     1ea.  By default, the contents are read as strict UTF-8.

     See *note the introduction: 4e20. for details on 'anchor' and
     'path_names'.  'encoding' and 'errors' have the same meaning as in
     built-in *note open(): 333.

     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:
     215. statement.  The context manager provides a *note pathlib.Path:
     4f5. 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(): c00. 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: 4e20. for details on 'anchor' and
     'path_names'.

     This function is roughly equivalent to:

          as_file(files(anchor).joinpath(*path_names))

     バージョン 3.13 で変更: Multiple 'path_names' are accepted.
     'encoding' and 'errors' must be given as keyword arguments.

 -- の関数: importlib.resources.is_resource (anchor, *path_names)

     Return ‘True’ if the named resource exists, otherwise ‘False’.
     This function does not consider directories to be resources.

     See *note the introduction: 4e20. 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: 1ea.  The iterable
     does not recurse into subdirectories.

     See *note the introduction: 4e20. 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): 1574. です。

     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: 7a5. 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: a6a.  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: 578. instead.

      -- メソッド: abstractmethod open_resource (resource)

          Returns an opened, *note file-like object: 19d1. for binary
          reading of the 'resource'.

          リソースが見付からない場合は、 *note FileNotFoundError: 24f. が
          送出されます。

      -- メソッド: abstractmethod resource_path (resource)

          'resource' へのファイルシステムパスを返します。

          リソースの実体がファイルシステムに存在しない場合、 *note
          FileNotFoundError: 24f. が送出されます。

      -- メソッド: abstractmethod is_resource (path)

          Returns ‘True’ if the named 'path' is considered a resource.
          *note FileNotFoundError: 24f. is raised if 'path' does not
          exist.

          バージョン 3.10 で変更: The argument 'name' was renamed to
          'path'.

      -- メソッド: abstractmethod contents ()

          Returns an *note iterable: 149a. 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():
          4e26. 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: 4f5. methods
     suitable for traversing directories and opening files.

     For a representation of the object on the file-system, use *note
     importlib.resources.as_file(): 8a4.

      -- の属性: 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:
          2e6b.).

          When opening as text, accepts encoding parameters such as
          those accepted by *note io.TextIOWrapper: ba0.

      -- メソッド: 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(): 2e2. interface.  Subclasses
     *note ResourceReader: 4deb. 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: 579.
          object for the loaded package.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/main/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: 7e, it
supersedes ‘pkg_resources’.

‘importlib.metadata’ は、Pythonの ‘site-packages’ ディレクトリに pip(4)
などのツールでインストールしたサードパーティの '配布パッケージ' に対して
動作します。具体的には、 ‘dist-info’ や ‘egg-info’ ディレクトリを持つ配
布物や、 コアとなるメタデータの仕様(5) で定義されたメタデータを検出でき
るようにします。

     重要: これらはPythonコード内でインポートできるトップレベルの 'パッ
     ケージ' 名と '必ずしも' 同等であったり、1:1 で対応するものではあり
     ません。1つの '配布パッケージ' は複数の 'パッケージ' (および単一の
     モジュール) を含むことができ、1つのトップレベルの 'パッケージ' は、
     それが名前空間パッケージであれば複数の '配布パッケージ' にマップす
     ることができます。これらのマッピングを得るには *note
     packages_distributions(): bed. を使用します。

By default, distribution metadata can live on the file system or in zip
archives on *note sys.path: 19f.  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/main/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: 78e. objects.

*note ディストリビューションのメタデータ: 4e37. を取得することができます
。:

     >>> 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 配布物のバージョン番号: 4e38. を取得し、 *note
構成ファイル: 4e39. をリストアップし、配布物の *note 配布物の要件: 4e3a.
のリストを取得することができます。

 -- 例外: importlib.metadata.PackageNotFoundError

     Subclass of *note ModuleNotFoundError: 1c9. 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: 4e3e. 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: to query for entry points based on ‘EntryPoint.dist’
     attribute, use *note Distribution.entry_points(): 4e3f. instead (as
     different *note Distribution: 1970. 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__(): 78d.).

   ---------- 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: 4e43. instance.

     Raises *note PackageNotFoundError: 19ed. 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: 4e43. 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: 19ed. 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 as *note PackagePath: 1971. instances.

     Raises *note PackageNotFoundError: 19ed. if the named distribution
     package is not installed in the current Python environment.

     Returns *note None: a6a. 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: 8bb. derived object with additional
     ‘dist’, ‘size’, and ‘hash’ properties corresponding to the
     distribution package's installation metadata for that file, also:

      -- メソッド: locate ()

          If possible, return the concrete *note SimplePath: 4e48.
          allowing to access data, or raise a *note NotImplementedError:
          5a1. otherwise.

 -- クラス: importlib.metadata.SimplePath

     A protocol representing a minimal subset of *note pathlib.Path:
     4f5. that allows to check if it ‘exists()’, to traverse using
     ‘joinpath()’ and ‘parent’, and to retrieve data using ‘read_text()’
     and ‘read_bytes()’.

The ‘files()’ function takes a Distribution Package(1) name and returns
all of the files installed by this distribution.  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: a6a.  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: 19ed. 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: 10e7. 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
......................

While the module level API described above is the most common and
convenient usage, all that information is accessible from the *note
Distribution: 1970. class.  ‘Distribution’ is an abstract object that
represents the metadata for a Python Distribution Package(1).  Get the
concrete ‘Distribution’ subclass instance for an installed distribution
package by calling the *note distribution(): 4e4f. function:

     >>> from importlib.metadata import distribution
     >>> dist = distribution('wheel')
     >>> type(dist)
     <class 'importlib.metadata.PathDistribution'>

 -- の関数: importlib.metadata.distribution (distribution_name)

     Return a *note Distribution: 1970. instance describing the named
     distribution package.

     Raises *note PackageNotFoundError: 19ed. if the named distribution
     package is not installed in the current Python environment.

Thus, an alternative way to get e.g.  the version number is through the
*note Distribution.version: 4e50. attribute:

     >>> dist.version
     '0.32.3'

The same applies for *note entry_points(): 4e3d. and *note files():
4e46.

 -- クラス: 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.

      -- メソッド: static at (path)

      -- メソッド: classmethod from_name (name)

          Return a ‘Distribution’ instance at the given path or with the
          given name.

      -- メソッド: classmethod discover (*, context=None, **kwargs)

          Returns an iterable of ‘Distribution’ instances for all
          packages (see *note distribution-discovery: 4e54.).

          The optional argument 'context' is a *note
          DistributionFinder.Context: 4e55. instance, used to modify the
          search for distributions.  Alternatively, 'kwargs' may contain
          keyword arguments for constructing a new
          ‘DistributionFinder.Context’.

      -- の属性: metadata: *note PackageMetadata: 4e43.

          There are all kinds of additional metadata available on
          ‘Distribution’ instances as a *note PackageMetadata: 4e43.
          instance:

               >>> dist.metadata['Requires-Python']
               '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
               >>> dist.metadata['License']
               'MIT'

          The full set of available metadata is not described here.  See
          the PyPA Core metadata specification(2) for additional
          details.

      -- の属性: name: *note str: 1ea.

      -- の属性: requires: *note list: 4e0.[*note str: 1ea.]

      -- の属性: version: *note str: 1ea.

          A few metadata fields are also available as shortcut
          properties.

          Added in version 3.10: The ‘name’ shortcut was added.

      -- の属性: origin

          For editable packages, an ‘origin’ property may present PEP
          610(3) metadata (for non-editable packages, ‘origin’ is *note
          None: a6a.):

               >>> dist.origin.url
               'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'

          The ‘origin’ object follows the Direct URL Data Structure(4).

          Added in version 3.13.

      -- の属性: entry_points: *note EntryPoints: 4e3e.

          The entry points provided by this distribution package.

      -- の属性: files: *note list: 4e0.[*note PackagePath: 1971.] |
               *note None: a6a.

          All files contained in this distribution package.  Like *note
          files(): 4e46, this returns *note None: a6a. if there are no
          records.

     The following two abstract methods need to be implemented when
     *note implementing-custom-providers: 4e5b.:

      -- メソッド: locate_file (path)

          Like ‘PackagePath.locate()’, return a *note SimplePath: 4e48.
          for the given path.  Takes a *note os.PathLike: 1013. or a
          *note str: 1ea.

      -- メソッド: read_text (filename)

          A shortcut for
          ‘distribution.locate_file(filename).read_text()’.

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package

   (2) 
https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata

   (3) https://peps.python.org/pep-0610/

   (4) 
https://packaging.python.org/en/latest/specifications/direct-url-data-structure/


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: 1d2. オブジェク
     トを受け入れません。

   - ‘importlib.metadata’ は、インポート時には無視されますが、
     ‘sys.path’ 上の *note pathlib.Path: 4f5. オブジェクトを優先的に使用
     します。

 -- クラス: importlib.metadata.DistributionFinder

     A *note MetaPathFinder: c48. subclass capable of discovering
     installed distributions.

     Custom providers should implement this interface in order to supply
     metadata.

           -- クラス: Context (**kwargs)

               A ‘Context’ gives a custom provider a means to solicit
               additional details from the callers of distribution
               discovery functions like *note distributions(): 4e60. or
               *note Distribution.discover(): 4e53. beyond ‘.name’ and
               ‘.path’ when searching for distributions.

               For example, a provider could expose suites of packages
               in either a "public" or "private" ‘realm’.  A caller of
               distribution discovery functions may wish to query only
               for distributions in a particular realm and could call
               ‘distributions(realm="private")’ to signal to the custom
               provider to only include distributions from that realm.

               Each ‘DistributionFinder’ must expect any parameters and
               should attempt to honor the canonical parameters defined
               below when appropriate.

               See the section on *note Implementing Custom Providers:
               4e5b. for more details.

                -- の属性: name

                    Specific name for which a distribution finder should
                    match.

                    A ‘.name’ of ‘None’ matches all distributions.

                -- の属性: path

                    A property providing the sequence of directory paths
                    that a distribution finder should search.

                    Typically refers to Python installed package paths
                    such as "site-packages" directories and defaults to
                    *note sys.path: 19f.

 -- の関数: importlib.metadata.distributions (**kwargs)

     Returns an iterable of *note Distribution: 1970. instances for all
     packages.

     The 'kwargs' argument may contain either a keyword argument
     ‘context’, a *note DistributionFinder.Context: 4e55. instance, or
     pass keyword arguments for constructing a new
     ‘DistributionFinder.Context’.  The ‘DistributionFinder.Context’ is
     used to modify the search for distributions.

   ---------- 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: 19f. searches, or package loaders directly, the metadata for a
distribution is found through import system *note finders: 265a.  To
find a distribution package's metadata, ‘importlib.metadata’ queries the
list of *note meta path finders: 1427. on *note sys.meta_path: 10e7.

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: c48. 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:
10e7. and presents this extended interface as the *note
DistributionFinder: 4e5f. 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 *note DistributionFinder.Context: 4e55. object provides *note path:
4e62. and *note name: 4e61. 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 *note
DistributionFinder: 4e5f.:

     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: 19f. でアクセス可能です。

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: 44c. command, or *note -m: 4d1. module.

The *note PYTHONPATH: 13cb. 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: 13cb. will affect all installed Python
     versions/environments.  Be wary of setting this in your shell
     profile or global environment variables.  The *note site: cf.
     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: 2461.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: 3b5. 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: 2b4. and *note PYTHONPLATLIBDIR: 1f37.

Once found, ‘prefix’ and ‘exec_prefix’ are available at *note
sys.base_prefix: 3b2. and *note sys.base_exec_prefix: 3af. respectively.

If *note PYTHONHOME: 3b5. is not set, and a ‘pyvenv.cfg’ file is found
alongside the main executable, or in its parent directory, *note
sys.prefix: 3b3. and *note sys.exec_prefix: 3b0. get set to the
directory containing ‘pyvenv.cfg’, otherwise they are set to the same
value as *note sys.base_prefix: 3b2. and *note sys.base_exec_prefix:
3af, respectively.  This is used by *note Virtual Environments: 4ba3.

Finally, the *note site: cf. module is processed and ‘site-packages’
directories are added to the module search path.  The *note
PYTHONUSERBASE: 1746. environment variable controls where is searched
for user site-packages and the *note PYTHONNOUSERSITE: 1748. environment
variable prevents searching for user site-packages all together.  A
common way to customize the search path is to create *note
sitecustomize: d0. or *note usercustomize: 117. modules as described in
the ‘site’ module documentation.

     注釈: The command line options *note -E: d2b, *note -P: 9a8, *note
     -I: d2c, *note -S: 1566. and *note -s: 1747. further affect path
     calculations, see their documentation for details.

バージョン 3.14 で変更: *note sys.prefix: 3b3. and *note
sys.exec_prefix: 3b0. are now set to the ‘pyvenv.cfg’ directory during
the path initialization.  This was previously done by *note site: cf,
therefore affected by *note -S: 1566.

* 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: 3b3. and *note sys.exec_prefix: 3b0. 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: 3b2. and *note sys.base_exec_prefix:
3af.

As well as being used as a marker to identify virtual environments,
‘pyvenv.cfg’ may also be used to configure the *note site: cf.
initialization.  Please refer to ‘site’'s *note virtual environments
documentation: 4ba4.

     注釈: *note PYTHONHOME: 3b5. overrides the ‘pyvenv.cfg’ detection.

     注釈: There are other ways "virtual environments" could be
     implemented.  This documentation refers to implementations based on
     the ‘pyvenv.cfg’ mechanism, such as *note venv: 11a, that many
     virtual environment implementations follow.


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: 19f. 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: cf. がインポートできなくなります。 空行と ‘#’ で始まる行は無視され
ます。 それぞれのパスはファイルの場所を指す絶対パスあるいは相対パスです
。 ‘site’ 以外のインポート文は許可されておらず、任意のコードも書けません
。

‘import site’ を指定したときは、(アンダースコアが前に付かない) ‘.pth’ フ
ァイルは *note site: cf. モジュールにより通常通り処理されることに注意し
てください。


File: python.info,  Node: 埋め込みの Python,  Prev: _pth files,  Up: sys path モジュール検索パスの初期化

5.32.9.3 埋め込みの Python
..........................

Python が他のアプリケーションに埋め込まれている場合は、 *note
Py_InitializeFromConfig(): 611. と *note PyConfig: 612. 構造体が Python
の初期化に使用可能です。パス固有の詳細は、 *note Python Path
Configuration: c84. で説明されています。

参考
....

   * Windows の詳細についてのメモは、 *note モジュールの検索: fe3. を参
     照。

   * Unix の詳細は、 *note Unix プラットフォームで Python を使う: 2350.
     を参照。


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: 4e71. を組み込み関数
*note compile(): 1d3. のフラグとして渡すか、あるいはこのモジュールで提供
されているヘルパー関数 *note parse(): 1d4. を使います。その結果は、
*note ast.AST: 2f8. を継承したクラスのオブジェクトのツリーとなります。抽
象構文木は組み込み関数 ‘compile()’ を使って Python コード・オブジェクト
にコンパイルすることができます。

* Menu:

* Abstract grammar::
* Node クラス::
* ast helpers::
* Compiler flags: Compiler flags<2>.
* コマンドラインでの使用: コマンドラインでの使用<8>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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, int? is_lazy)
               | ImportFrom(identifier? module, alias* names, int? level, int? is_lazy)

               | 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 abstract base of all AST node classes.  The actual node
     classes are derived from the ‘Parser/Python.asdl’ file, which is
     reproduced *note above: 4e72.  They are defined in the ‘_ast’ C
     module and re-exported in ‘ast’.

     抽象文法の左辺のシンボル一つずつにそれぞれ一つのクラスがあります (た
     とえば ‘ast.stmt’ や ‘ast.expr’)。それに加えて、右辺のコンストラク
     タ一つずつにそれぞれ一つのクラスがあり、これらのクラスは左辺のツリ
     ーのクラスを継承しています。たとえば、 *note ast.BinOp: 1fc1. は
     ‘ast.expr’ から継承しています。代替を伴った生成規則 (production
     rules with alternatives) (別名 "sums") の場合、左辺は抽象クラスとな
     り、特定のコンストラクタ・ノードのインスタンスのみが作成されます。

      -- の属性: _fields

          各具象クラスは属性 ‘_fields’ を持っており、すべての子ノードの
          名前をそこに保持しています。

          具象クラスのインスタンスは、各子ノードに対してそれぞれひとつの
          属性を持っています。この属性は、文法で定義された型となります。
          たとえば *note ast.BinOp: 1fc1. のインスタンスは ‘left’ という
          属性を持っており、その型は ‘ast.expr’ です。

          これらの属性が、文法上 (クエスチョンマークを用いて) オプション
          であるとマークされている場合は、その値が ‘None’ となることもあ
          ります。属性が0個以上の複数の値をとりうる場合 (アスタリスクで
          マークされている場合) は、値は Python のリストで表されます。全
          ての属性は AST を *note compile(): 1d3. でコンパイルする際には
          存在しなければならず、そして妥当な値でなければなりません。

      -- の属性: _field_types

          The ‘_field_types’ attribute on each concrete class is a
          dictionary mapping field names (as also listed in *note
          _fields: 19fa.) 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: 4e75, *note col_offset: 4e76, *note end_lineno: 4e77,
          および *note end_col_offset: 4e78. 属性を持ちます。 ‘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: 4d6c. ノードを生成して属性を埋めるに
     は、次のようにすることができます

          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(): 6cf.  If any other field
     is omitted, a *note DeprecationWarning: 2d4. 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: 570. が全ての定数に使われるよ
うになりました。

バージョン 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(): 6cf.  Previously, omitted
attributes would not exist on constructed nodes (accessing them raised
*note AttributeError: 1b4.).

バージョン 3.14 で変更: The *note __repr__(): 1c7. output of *note AST:
2f8. 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: 570.

バージョン 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.  These cases now raise a
*note TypeError: 29c.

バージョン 3.15 で非推奨、バージョン 3.20 で削除予定: In the *note
grammar above: 4e72, the AST node classes that correspond to production
rules with variants (aka "sums") are abstract classes.  Previous
versions of Python allowed for the creation of direct instances of these
abstract node classes.  This behavior is deprecated and will be removed
in Python 3.20.

     注釈: ここに示されている特定のノードクラスについての記述は、素晴ら
     しい 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: 27b7.  Node type
     generated by *note ast.parse(): 1d4. in the default ‘"exec"’
     'mode'.

     ‘body’ is a *note list: 4e0. of the module's *note 文 (Statements):
     4e7c.

     ‘type_ignores’ is a *note list: 4e0. of the module's type ignore
     comments; see *note ast.parse(): 1d4. 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: 27bd.  Node type generated
     by *note ast.parse(): 1d4. when 'mode' is ‘"eval"’.

     ‘body’ is a single node, one of the *note expression types: 4e7e.

          >>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))
          Expression(
              body=Constant(value=123))

 -- クラス: ast.Interactive (body)

     A single *note interactive input: 27ba, like in *note 対話モード:
     6a6.  Node type generated by *note ast.parse(): 1d4. when 'mode' is
     ‘"single"’.

     ‘body’ is a *note list: 4e0. of *note statement nodes: 4e7c.

          >>> 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(): 1d4. 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: 4e0. of *note expression nodes: 4e7e.

     ‘returns’ is a single *note expression node: 4e7e.

          >>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), indent=4))
          FunctionType(
              argtypes=[
                  Name(id='int'),
                  Name(id='str')],
              returns=Subscript(
                  value=Name(id='List'),
                  slice=Name(id='int')))

     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: 1ea, *note bytes: 1d2, *note int:
     32e, *note float: 32f, *note complex: 330, and *note bool: 5f6, and
     the constants *note None: a6a. and *note Ellipsis: 2537.

     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:
     1c81. の一部としてあらわれます。

        * ‘value’ は式ツリーのノードのいずれか (リテラル、変数、関数呼び
          出しなど) です。

        * ‘conversion’ は整数です:

             * -1: 書式指定なし

             * 97 (‘ord('a')’): ‘!a’ *note ASCII: 179f. formatting

             * 114 (‘ord('r')’): ‘!r’ *note repr(): 462. formatting

             * 115 (‘ord('s')’): ‘!s’ *note string: 1ea. formatting

        * ‘format_spec’ は値の書式指定を表現する *note JoinedStr: 1c81.
          ノード、もしくは書式指定がない場合は ‘None’ です。
          ‘conversion’ と ‘format_spec’ を同時に設定することができます。

 -- クラス: ast.JoinedStr (values)

     *note FormattedValue: 4d84. ノードと *note Constant: 570. ノードの
     集まりからなる 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'),
                          conversion=-1),
                      Constant(value=') is '),
                      FormattedValue(
                          value=Call(
                              func=Name(id='sin'),
                              args=[
                                  Name(id='a')]),
                          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: 19ec. and *note Constant: 570. 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'),
                          str='name',
                          conversion=-1),
                      Constant(value=' finished '),
                      Interpolation(
                          value=Name(id='place'),
                          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(): cba.  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: 179f. conversion

             * 114 (‘ord('r')’): ‘!r’ *note repr(): 462. conversion

             * 115 (‘ord('s')’): ‘!s’ *note string: 1ea. conversion

          This has the same meaning as ‘FormattedValue.conversion’.

        * ‘format_spec’ is a *note JoinedStr: 1c81. 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:
     4e82. であり、そうでない場合は *note Load: 6cf. です。

          >>> 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)]))
          >>> 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)]))

 -- クラス: 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')]))


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'))])

          >>> 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: 1f36. ノード、を保持します。この型は ‘*args’ を伴う関数
     呼び出しノード *note Call: 4d7d. を構築する際に使用します。

          >>> 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'))])


File: python.info,  Node: 式 expression<2>,  Next: 文 Statements,  Prev: 変数,  Up: Node クラス

5.33.1.6 式 (expression)
........................

 -- クラス: ast.Expr (value)

     関数呼び出しのような式がそれ自身で文となり、戻り値が使われないかま
     たは保存されないとき、その式はこのコンテナでラップされます。
     ‘value’ はこの節で説明する他のノード、 *note Constant: 570. ノード
     、 *note Name: 1f36. ノード、 *note Lambda: 4d87. ノード *note
     Yield: 4d8e. ノードまたは *note YieldFrom: 4d8f. ノードのいずれかを
     保持します。

          >>> print(ast.dump(ast.parse('-a'), indent=4))
          Module(
              body=[
                  Expr(
                      value=UnaryOp(
                          op=USub(),
                          operand=Name(id='a')))])

 -- クラス: ast.UnaryOp (op, operand)

     単項演算をあらわします。 ‘op’ は演算子で、 ‘operand’ は任意の式ツリ
     ーのノードです。

 -- クラス: ast.UAdd
 -- クラス: ast.USub
 -- クラス: ast.Not
 -- クラス: ast.Invert

     単項演算の演算子をあらわします。 *note Not: 4d70. は論理否定キーワ
     ード ‘not’ であり、 *note Invert: 4d6d. はビット反転演算子 ‘~’ です
     。

          >>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))
          Expression(
              body=UnaryOp(
                  op=Not(),
                  operand=Name(id='x')))

 -- クラス: 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'),
                  op=Add(),
                  right=Name(id='y')))

 -- クラス: 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:
     4e94. または *note And: 4e95. です。 ‘values’ は必要な値のリストで
     す。 ‘a or b or c’ のように同じ演算子を使う連続した演算は、複数の値
     を持った単一のノードとして表現されます。

     ‘not’ は単項演算 *note UnaryOp: 4d6c. のため、ここには含まれません
     。

          >>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))
          Expression(
              body=BoolOp(
                  op=Or(),
                  values=[
                      Name(id='x'),
                      Name(id='y')]))

 -- クラス: 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'),
                      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: 1f36. または *note Attribute: 4d7e. のオブジェクトです。 関数
     呼び出しの引数:

        * ‘args’ は位置引数のリストを保持します。

        * ‘keywords’ holds a list of *note keyword: 4e96. 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'),
                  args=[
                      Name(id='a'),
                      Starred(
                          value=Name(id='d'))],
                  keywords=[
                      keyword(
                          arg='b',
                          value=Name(id='c')),
                      keyword(
                          value=Name(id='e'))]))

 -- クラス: ast.keyword (arg, value)

     関数呼び出しまたはクラス定義のキーワード引数をあらわします。 ‘arg’
     はパラメータ名をあらわす文字列、 ‘value’ は引数に渡す値をあらわすノ
     ードです。

 -- クラス: ast.IfExp (test, body, orelse)

     ‘a if b else c’ のような式をあらわします。各フィールドは単一のノー
     ドを保持します。以下の例では、3つの式ノードはすべて *note Name:
     1f36. ノードです。

          >>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))
          Expression(
              body=IfExp(
                  test=Name(id='b'),
                  body=Name(id='a'),
                  orelse=Name(id='c')))

 -- クラス: ast.Attribute (value, attr, ctx)

     たとえば ‘d.keys’ のような属性へのアクセスです。 ‘value’ はノードで
     、典型的には *note Name: 1f36. です。 ‘attr’ は属性名を与える生の文
     字列で、 ‘ctx’ はその属性がどのように振る舞うかに応じて *note Load:
     6cf.、 *note Store: 4e82. または *note Del: 4e84. のいずれかです。

          >>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))
          Expression(
              body=Attribute(
                  value=Name(id='snake'),
                  attr='colour'))

 -- クラス: ast.NamedExpr (target, value)

     代入式です。この AST ノードは代入式演算子（ウォルラス演算子、または
     「セイウチ演算子」としても知られています）によって生成されます。第
     一引数が複数のノードであってもよい *note Assign: 4e97. ノードと異な
     り、このノードの場合は ‘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: 4d83. を含む
     *note Tuple: 4d82. でもかまいません。 ‘ctx’ は要素の参照により実行
     されるアクションに応じて *note Load: 6cf.、 *note Store: 4e82. また
     は *note Del: 4e84. のいずれかです。

          >>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))
          Expression(
              body=Subscript(
                  value=Name(id='l'),
                  slice=Tuple(
                      elts=[
                          Slice(
                              lower=Constant(value=1),
                              upper=Constant(value=2)),
                          Constant(value=3)])))

 -- クラス: ast.Slice (lower, upper, step)

     基本的なスライス操作 (‘lower:upper’ や ‘lower:upper:step’ の形式) を
     あらわします。 *note Subscript: 4d7f. の 'slice' フィールドでの直接
     指定か、または *note Tuple: 4d82. の要素として指定する場合のみ利用
     可能です。

          >>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))
          Expression(
              body=Subscript(
                  value=Name(id='l'),
                  slice=Slice(
                      lower=Constant(value=1),
                      upper=Constant(value=2))))


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: 4e9a. ノードのリストです。

          >>> print(ast.dump(
          ...     ast.parse('[x for x in numbers]', mode='eval'),
          ...     indent=4,
          ... ))
          Expression(
              body=ListComp(
                  elt=Name(id='x'),
                  generators=[
                      comprehension(
                          target=Name(id='x', ctx=Store()),
                          iter=Name(id='numbers'),
                          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'),
                  value=BinOp(
                      left=Name(id='x'),
                      op=Pow(),
                      right=Constant(value=2)),
                  generators=[
                      comprehension(
                          target=Name(id='x', ctx=Store()),
                          iter=Name(id='numbers'),
                          is_async=0)]))
          >>> print(ast.dump(
          ...     ast.parse('{x for x in numbers}', mode='eval'),
          ...     indent=4,
          ... ))
          Expression(
              body=SetComp(
                  elt=Name(id='x'),
                  generators=[
                      comprehension(
                          target=Name(id='x', ctx=Store()),
                          iter=Name(id='numbers'),
                          is_async=0)]))

 -- クラス: ast.comprehension (target, iter, ifs, is_async)

     内包表記におけるひとつの ‘for’ 節をあらわします。 ‘target’ は各要素
     への参照です - 典型的には *note Name: 1f36. または *note Tuple:
     4d82. ノードです。 ‘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'),
                      args=[
                          Name(id='c')]),
                  generators=[
                      comprehension(
                          target=Name(id='line', ctx=Store()),
                          iter=Name(id='file'),
                          is_async=0),
                      comprehension(
                          target=Name(id='c', ctx=Store()),
                          iter=Name(id='line'),
                          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'),
                      op=Pow(),
                      right=Constant(value=2)),
                  generators=[
                      comprehension(
                          target=Name(id='n', ctx=Store()),
                          iter=Name(id='it'),
                          ifs=[
                              Compare(
                                  left=Name(id='n'),
                                  ops=[
                                      Gt()],
                                  comparators=[
                                      Constant(value=5)]),
                              Compare(
                                  left=Name(id='n'),
                                  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'),
                  generators=[
                      comprehension(
                          target=Name(id='i', ctx=Store()),
                          iter=Name(id='soc'),
                          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: 4d82. または
     *note List: 4d81. を置くことで表現されます。

      -- の属性: 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'))])

 -- クラス: ast.AnnAssign (target, annotation, value, simple)

     An assignment with a type annotation.  ‘target’ is a single node
     and can be a *note Name: 1f36, an *note Attribute: 4d7e. or a *note
     Subscript: 4d7f.  ‘annotation’ is the annotation, such as a *note
     Constant: 570. 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: 1f36. node that does not appear between
     parentheses; all other targets are considered complex.  Only simple
     targets appear in the *note __annotations__: 672. 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'),
                      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'),
                      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'),
                          attr='b',
                          ctx=Store()),
                      annotation=Name(id='int'),
                      simple=0)])

          >>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript annotation
          Module(
              body=[
                  AnnAssign(
                      target=Subscript(
                          value=Name(id='a'),
                          slice=Constant(value=1),
                          ctx=Store()),
                      annotation=Name(id='int'),
                      simple=0)])

 -- クラス: ast.AugAssign (target, op, value)

     ‘a += 1’ のような累積代入をあらわします。下記の例では、 ‘target’ は
     (*note Store: 4e82. コンテキストを伴う) ‘x’ のための *note Name:
     1f36. ノード、 ‘op’ は *note Add: 4e87. 演算子、そして ‘value’ は定
     数1をあらわす *note Constant: 570. ノードです。

     *note Assign: 4e97. と異なり、 ‘target’ 属性は class *note Tuple:
     4d82. や *note List: 4d81. であってはいけません。

          >>> 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: 4d7d. または *note Name: 1f36.、 もしくは単独の
     ‘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'),
                      cause=Name(id='y'))])

 -- クラス: ast.Assert (test, msg)

     アサーションです。 ‘test’ は *note Compare: 4d72. ノードなどのよう
     な条件を保持します。 ‘msg’ は失敗した時のメッセージを保持します。

          >>> print(ast.dump(ast.parse('assert x,y'), indent=4))
          Module(
              body=[
                  Assert(
                      test=Name(id='x'),
                      msg=Name(id='y'))])

 -- クラス: ast.Delete (targets)

     ‘del’ 文をあらわします。 ‘targets’ は *note Name: 1f36, *note
     Attribute: 4d7e, *note Subscript: 4d7f. などのノードのリストです。

          >>> 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: 875. created through the *note type: 860.
     statement.  ‘name’ is the name of the alias, ‘type_params’ is a
     list of *note type parameters: 4ea3, 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'))])

     Added in version 3.12.

関数またはループの内部でのみ適用可能な他の文は、別のセクションで説明しま
す。

* Menu:

* インポート::


File: python.info,  Node: インポート,  Up: 文 Statements

5.33.1.10 インポート
....................

 -- クラス: ast.Import (names)

     インポート文です。 ‘names’ は *note alias: 1e8a. ノードのリストです
     。

          >>> print(ast.dump(ast.parse('import x,y,z'), indent=4))
          Module(
              body=[
                  Import(
                      names=[
                          alias(name='x'),
                          alias(name='y'),
                          alias(name='z')],
                      is_lazy=0)])

 -- クラス: 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,
                      is_lazy=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,
                      is_lazy=0)])


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: 4d72. ノードなどの単一のノー
     ドを保持します。 ‘body’ と ‘orelse’ はそれぞれノードのリストを保持
     します。

     ‘elif’ 節は AST において固有の表現を持たず、先行する節をあらわすノ
     ードの ‘orelse’ セクションに追加の *note If: 4ea8. ノードとして現れ
     ます。

          >>> print(ast.dump(ast.parse("""
          ... if x:
          ...    ...
          ... elif y:
          ...    ...
          ... else:
          ...    ...
          ... """), indent=4))
          Module(
              body=[
                  If(
                      test=Name(id='x'),
                      body=[
                          Expr(
                              value=Constant(value=Ellipsis))],
                      orelse=[
                          If(
                              test=Name(id='y'),
                              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: 1f36, *note Tuple: 4d82, *note List: 4d81,
     *note Attribute: 4d7e. or *note Subscript: 4d7f. 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'),
                      body=[
                          Expr(
                              value=Constant(value=Ellipsis))],
                      orelse=[
                          Expr(
                              value=Constant(value=Ellipsis))])])

 -- クラス: ast.While (test, body, orelse)

     ‘while’ ループです。 ‘test’ は *note Compare: 4d72. のような条件を
     あらわすノードを保持します。

          >>> print(ast.dump(ast.parse("""
          ... while x:
          ...    ...
          ... else:
          ...    ...
          ... """), indent=4))
          Module(
              body=[
                  While(
                      test=Name(id='x'),
                      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'),
                      body=[
                          If(
                              test=Compare(
                                  left=Name(id='a'),
                                  ops=[
                                      Gt()],
                                  comparators=[
                                      Constant(value=5)]),
                              body=[
                                  Break()],
                              orelse=[
                                  Continue()])])])

 -- クラス: ast.Try (body, handlers, orelse, finalbody)

     ‘try’ ブロックです。 *note ExceptHandler: 4eaf. ノードのリストであ
     る ‘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'),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))]),
                          ExceptHandler(
                              type=Name(id='OtherException'),
                              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: 4eae. but the *note
     ExceptHandler: 4eaf. 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'),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.11.

 -- クラス: ast.ExceptHandler (type, name, body)

     単一の ‘except’ 節をあらわします。 ‘type’ はこの節にマッチする例外
     のタイプで、典型的には *note Name: 1f36. ノードです (‘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'),
                                  op=Add(),
                                  right=Constant(value=1)))],
                      handlers=[
                          ExceptHandler(
                              type=Name(id='TypeError'),
                              body=[
                                  Pass()])])])

 -- クラス: ast.With (items, body, type_comment)

     ‘with’ ブロックです。 ‘items’ は *note withitem: 4eb2. ノードのリス
     トで、コンテキストマネージャのリストをあらわします。また ‘body’ は
     コンテキスト内にインデントされたブロックです。

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

 -- クラス: ast.withitem (context_expr, optional_vars)

     ‘with’ ブロックにおける単一のコンテキストマネージャをあらわします。
     ‘context_expr’ はコンテキストマネージャで、しばしば *note Call:
     4d7d. ノードが設定されます。 ‘optional_vars’ は ‘as foo’ に相当する
     *note Name: 1f36, *note Tuple: 4d82. または *note List: 4d81. のい
     ずれかのノードか、または、この部分が不要な場合は ‘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'),
                              optional_vars=Name(id='b', ctx=Store())),
                          withitem(
                              context_expr=Name(id='c'),
                              optional_vars=Name(id='d', ctx=Store()))],
                      body=[
                          Expr(
                              value=Call(
                                  func=Name(id='something'),
                                  args=[
                                      Name(id='b'),
                                      Name(id='d')]))])])


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: 4eb6. 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: 2f8. 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'),
                      cases=[
                          match_case(
                              pattern=MatchSequence(
                                  patterns=[
                                      MatchAs(name='x')]),
                              guard=Compare(
                                  left=Name(id='x'),
                                  ops=[
                                      Gt()],
                                  comparators=[
                                      Constant(value=0)]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))]),
                          match_case(
                              pattern=MatchClass(
                                  cls=Name(id='tuple')),
                              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'),
                      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'),
                      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'),
                      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'),
                      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'),
                      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'),
                      cases=[
                          match_case(
                              pattern=MatchClass(
                                  cls=Name(id='Point2D'),
                                  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'),
                                  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'),
                      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'),
                      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'),
                      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(): 1d4. 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: 7ab. can exist on classes, functions, and type
aliases.

 -- クラス: ast.TypeVar (name, bound, default_value)

     A *note typing.TypeVar: 29f.  ‘name’ is the name of the type
     variable.  ‘bound’ is the bound or constraints, if any.  If ‘bound’
     is a *note Tuple: 4d82, 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'),
                              default_value=Name(id='bool'))],
                      value=Subscript(
                          value=Name(id='list'),
                          slice=Name(id='T')))])

     Added in version 3.12.

     バージョン 3.13 で変更: Added the 'default_value' parameter.

 -- クラス: ast.ParamSpec (name, default_value)

     A *note typing.ParamSpec: 2a0.  ‘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'),
                                      Name(id='str')]))],
                      value=Subscript(
                          value=Name(id='Callable'),
                          slice=Tuple(
                              elts=[
                                  Name(id='P'),
                                  Name(id='int')])))])

     Added in version 3.12.

     バージョン 3.13 で変更: Added the 'default_value' parameter.

 -- クラス: ast.TypeVarTuple (name, default_value)

     A *note typing.TypeVarTuple: 29e.  ‘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())],
                      value=Subscript(
                          value=Name(id='tuple'),
                          slice=Tuple(
                              elts=[
                                  Starred(
                                      value=Name(id='Ts'))])))])

     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: 4ec5. ノードです。

        * ‘body’ は関数の本体をあらわすノードのリストです。

        * ‘decorator_list’ は関数に適用されるデコレータのリストで、外側
          のデコレータがリストの先頭に保存されます (すなわち、リストの先
          頭にあるデコレータが最後に適用されます)。

        * ‘returns’ は戻り値に対する注釈です。

        * ‘type_params’ is a list of *note type parameters: 4ea3.

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

     バージョン 3.12 で変更: Added ‘type_params’.

 -- クラス: ast.Lambda (args, body)

     ‘lambda’ は式の中で使うことができる最小限の関数定義です。 *note
     FunctionDef: 1c9d. ノードと異なり、 ‘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: 4ec7. ノードのリストです。

        * ‘vararg’ と ‘kwarg’ はそれぞれ単一の *note arg: 4ec7. ノードで
          、 ‘*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: 1f36.
     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'),
                          Name(id='decorator2')],
                      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: 4e86. 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')))])

          >>> print(ast.dump(ast.parse('yield from x'), indent=4))
          Module(
              body=[
                  Expr(
                      value=YieldFrom(
                          value=Name(id='x')))])

 -- クラス: 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: 4e96. nodes,
          principally for 'metaclass'.  Other keywords will be passed to
          the metaclass, as per PEP 3115(1).

        * ‘body’ はクラス定義に含まれるコードをあらわすノードのリストで
          す。

        * ‘decorator_list’ はノードのリストで、関数定義 *note
          FunctionDef: 1c9d. の場合と同様に解釈されます。

        * ‘type_params’ is a list of *note type parameters: 4ea3.

          >>> 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'),
                          Name(id='base2')],
                      keywords=[
                          keyword(
                              arg='metaclass',
                              value=Name(id='meta'))],
                      body=[
                          Pass()],
                      decorator_list=[
                          Name(id='decorator1'),
                          Name(id='decorator2')])])

     バージョン 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:
     1c9d. と同じフィールドを持ちます。

     バージョン 3.12 で変更: Added ‘type_params’.

 -- クラス: ast.Await (value)

     ‘await’ 式をあらわします。 ‘value’ は待ち受ける値です。 *note
     AsyncFunctionDef: 1c9c. の本体 (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'))))])])

 -- クラス: ast.AsyncFor (target, iter, body, orelse, type_comment)
 -- クラス: ast.AsyncWith (items, body, type_comment)

     ‘async for’ ループと ‘async with’ コンテキストマネージャです。それ
     ぞれ *note For: 4ea9. および *note With: 4eb1. と同じフィールドを持
     ちます。 *note AsyncFunctionDef: 1c9c. の本体 (body) の中でのみ有効
     です。

     注釈: When a string is parsed by *note ast.parse(): 1d4, 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: 4e87.).


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,
          module=None)

     Parse the source into an AST node.  Equivalent to ‘compile(source,
     filename, mode, flags=FLAGS_VALUE, optimize=optimize,
     module=module)’, 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: 4ed0. to
     the flags passed to *note compile(): 1d3.  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: 4e7b. (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: 1df. 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: 15a.
     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: 189. exceptions.  For
          instance, the source ‘return 42’ generates a valid AST node
          for a return statement, but it cannot be compiled alone (it
          needs to be inside a function node).

          In particular, *note ast.parse(): 1d4. 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.

     Added in version 3.15: 'module' 引数が追加されました。

 -- の関数: ast.unparse (ast_obj)

     *note ast.AST: 2f8. オブジェクトを逆に構文解析して、 *note
     ast.parse(): 1d4. が元の ‘ast.AST’ と等価なオブジェクトを生成できる
     ような文字列を生成します。

          警告: 生成されたコード文字列は、生成元のコードである *note
          ast.AST: 2f8. オブジェクトと必ずしも等価であるとは限りません
          (定数タプルや frozenset などに対するコンパイラ最適化なしのコー
          ドです)。

          警告: 非常に複雑な式を逆構文解析すると *note RecursionError:
          1125. となることがあります。

     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(): 18f.  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: 15a, *note TypeError: 29c,
          *note SyntaxError: 189, *note MemoryError: 191d. and *note
          RecursionError: 1125. 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: 1c9d, *note
     AsyncFunctionDef: 1c9c, *note ClassDef: 1c9b, *note Module: 4e7b. の
     いずれかのノードでなければなりません) のドキュメント文字列を返しま
     す。もしドキュメント文字列が無ければ ‘None’ を返します。 'clean' が
     真ならば、ドキュメント文字列のインデントを *note
     inspect.cleandoc(): 1c53. を用いて一掃します。

     バージョン 3.5 で変更: *note AsyncFunctionDef: 1c9c. がサポートされ
     ました。

 -- の関数: ast.get_source_segment (source, node, *, padded=False)

     Get source code segment of the 'source' that generated 'node'.  If
     some location information (*note lineno: 4e75, *note end_lineno:
     4e77, *note col_offset: 4e76, or *note end_col_offset: 4e78.) 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(): 1d3, the
     compiler expects *note lineno: 4e75. and *note col_offset: 4e76.
     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: 4e75, *note col_offset: 4e76,
     *note end_lineno: 4e77, and *note end_col_offset: 4e78.) 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(): 4ed6. メ
     ソッドに送られる値を返してもかまいません。

     このクラスはビジター・メソッドを付け加えたサブクラスを派生させるこ
     とを意図しています。

      -- メソッド: visit (node)

          ノードを訪れます。デフォルトの実装では ‘self.visit_CLASSNAME’
          というメソッド (ここで 'classname' はノードのクラス名です) を
          呼び出すか、そのメソッドがなければ *note generic_visit():
          4ed7. を呼び出します。

      -- メソッド: generic_visit (node)

          このビジターはノードの全ての子について *note visit(): 4ed6. を
          呼び出します。

          注意して欲しいのは、専用のビジター・メソッドを具えたノードの子
          ノードは、このビジターが *note generic_visit(): 4ed7. を呼び出
          すかそれ自身で子ノードを訪れない限り訪れられないということです
          。

      -- メソッド: visit_Constant (node)

          Handles all constant nodes.

     トラバースの途中でノードを変化させたいならば *note NodeVisitor:
     571. を使ってはいけません。そうした目的のために変更を許す特別なビジ
     ター (*note NodeTransformer: 4ed8.) があります。

     バージョン 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(): e36. method instead
     to handle all constant nodes.

 -- クラス: ast.NodeTransformer

     *note NodeVisitor: 571. のサブクラスで抽象構文木を渡り歩きながらノ
     ードを変更することを許すものです。

     *note NodeTransformer: 4ed8. は抽象構文木(AST)を渡り歩き、ビジター
     ・メソッドの戻り値を使って古いノードを置き換えたり削除したりします
     。ビジター・メソッドの戻り値が ‘None’ ならば、ノードはその場から取
     り去られ、そうでなければ戻り値で置き換えられます。置き換えない場合
     は戻り値が元のノードそのものであってもかまいません。

     それでは例を示しましょう。Name (たとえば ‘foo’) を見つけるたび全て
     ‘data['foo']’ に書き換える変換器 (transformer) です:

          class RewriteName(NodeTransformer):

              def visit_Name(self, node):
                  return Subscript(
                      value=Name(id='data'),
                      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(): 4ed7. 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: 4e75.), *note fix_missing_locations(): 4ed1. 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, *, color=False, indent=None,
          show_empty=False)

     'node' 内のツリーのフォーマットされたダンプを返します。主な使い道は
     デバッグです。 'annotate_fields' が true の場合 (デフォルト)、返さ
     れる文字列はフィールドの名前と値を示します。 'annotate_fields' が
     false の場合、あいまいさのないフィールド名を省略することにより、結
     果文字列はよりコンパクトになります。行番号や列オフセットのような属
     性はデフォルトではダンプされません。これが必要であれば、
     'include_attributes' を true にすると表示できます。

     If 'color' is ‘True’, the returned string is syntax highlighted
     using ANSI escape sequences.  If ‘False’ (the default), colored
     output is always disabled.

     'indent' が非負の整数または文字列の場合、ツリーは指定されたインデン
     トレベルで整形されて出力されます (pretty-printed)。インデントレベル
     がゼロ、負の数、または ‘""’ の場合は改行だけを挿入します。 ‘None’
     (デフォルト値) は単一行での表記になります。正の整数を指定すると各イ
     ンデントレベルでその数だけの空白でインデントされます。 'indent' が
     文字列 (‘"\t"’ など) の場合、その文字列が各レベルのインデントに使わ
     れます。

     If 'show_empty' is false (the default), optional empty lists and
     ‘Load()’ values will be omitted from the output.  Optional ‘None’
     values are always omitted.

          >>> tree = ast.parse('print(None)', '?', 'eval')
          >>> print(ast.dump(tree, indent=4))
          Expression(
              body=Call(
                  func=Name(id='print'),
                  args=[
                      Constant(value=None)]))
          >>> print(ast.dump(tree, indent=4, show_empty=True))
          Expression(
              body=Call(
                  func=Name(id='print', ctx=Load()),
                  args=[
                      Constant(value=None)],
                  keywords=[]))

     バージョン 3.9 で変更: 'indent' オプションを追加しました。

     バージョン 3.13 で変更: Added the 'show_empty' option.

     バージョン 3.15 で変更: Omit optional ‘Load()’ values by default.

     バージョン 3.15 で変更: Added the 'color' parameter.

 -- の関数: 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(): 1d3. に渡すことができます:

 -- データ: 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(): 1d3. or *note ast.parse(): 1d4.

     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.

バージョン 3.15 で変更: The output is now syntax highlighted by default.
This can be *note controlled using environment variables: 1ba.

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(): 1d4. 関数の '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/main/Lib/symtable.py


File: python.info,  Node: 記号表の生成,  Next: 記号表の検査,  Up: symtable --- コンパイラーの記号表へのアクセス

5.33.2.1 記号表の生成
.....................

 -- の関数: symtable.symtable (code, filename, compile_type, *,
          module=None)

     Return the toplevel *note SymbolTable: 4eeb. 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(): 1d3.
     The optional argument 'module' specifies the module name.  It is
     needed to unambiguous *note filter: 1d7. syntax warnings by module
     name.

     Added in version 3.15: 'module' 引数が追加されました。


File: python.info,  Node: 記号表の検査,  Next: コマンドラインからの使用<3>,  Prev: 記号表の生成,  Up: symtable --- コンパイラーの記号表へのアクセス

5.33.2.2 記号表の検査
.....................

 -- クラス: symtable.SymbolTableType

     An enumeration indicating the type of a *note SymbolTable: 4eeb.
     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: 6ba.

      -- の属性: ANNOTATION = "annotation"

          Used for annotations if ‘from __future__ import annotations’
          is active.

      -- の属性: TYPE_ALIAS = "type alias"

          Used for the symbol table of *note type: 860. constructions.

      -- の属性: TYPE_PARAMETERS = "type parameters"

          Used for the symbol table of *note generic functions: 874. or
          *note generic classes: 2587.

      -- の属性: 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: 1b85. 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: 1b85. enumeration.

          The exact values of the returned string may change in the
          future, and thus, it is recommended to use *note
          SymbolTableType: 1b85. 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(): 1b86. 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: 29f. bound scopes,
          it is the name of the ‘TypeVar’.

      -- メソッド: get_lineno ()

          この記号表に対応するブロックの一行目の行番号を返します。

      -- メソッド: is_optimized ()

          この記号表に含まれるローカル変数が最適化できるならば ‘True’ を
          返します。

      -- メソッド: is_nested ()

          ブロックが入れ子のクラスまたは関数のとき ‘True’ を返します。

      -- メソッド: has_children ()

          ブロックが入れ子の名前空間を含んでいるならば ‘True’ を返します
          。入れ子の名前空間は *note get_children(): 4efa. で得られます
          。

      -- メソッド: get_identifiers ()

          Return a view object containing the names of symbols in the
          table.  See the *note documentation of view objects: 28b6.

      -- メソッド: lookup (name)

          記号表から名前 'name' を見つけ出して *note Symbol: 518. インス
          タンスとして返します。

      -- メソッド: get_symbols ()

          記号表中の名前を表す *note Symbol: 518. インスタンスのリストを
          返します。

      -- メソッド: get_children ()

          入れ子になった記号表のリストを返します。

 -- クラス: symtable.Function

     A namespace for a function or method.  This class inherits from
     *note SymbolTable: 4eeb.

      -- メソッド: 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: 1ad6. in this function.

      -- メソッド: get_cells ()

          Return a tuple containing names of *note cell variables: 1ad6.
          in this table.

          Added in version 3.15.

 -- クラス: symtable.Class

     A namespace of a class.  This class inherits from *note
     SymbolTable: 4eeb.

 -- クラス: symtable.Symbol

     *note SymbolTable: 4eeb. のエントリーでソースの識別子に対応するもの
     です。コンストラクタはパブリックではありません。

      -- メソッド: 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_cell ()

          Return ‘True’ if the symbol is referenced but not assigned in
          a nested block.

          Added in version 3.15.

      -- メソッド: 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: 15a. が送出
          されます。


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: 4f16. or *note OP:
2499, or a ‘"match"’ token may be either *note NAME: 24c8. or *note
SOFT_KEYWORD: 4f17.

 -- データ: 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: 24af.

 -- データ: token.NUMBER

     Token value that indicates a *note numeric literal: 24b0.

 -- データ: token.STRING

     Token value that indicates a *note string or byte literal: 24ae,
     excluding *note formatted string literals: 441.  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: 249b. or
     *note delimiter: 249a.

     'CPython 実装の詳細:' This value is only reported by the *note
     tokenize: 104. module.  Internally, the tokenizer uses *note exact
     token types: 252d. 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: 24b4.

 -- データ: 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: 24b4. to
     indicate the start of an *note indented block: 24ab.

 -- データ: token.DEDENT

     Token value used at the beginning of a *note logical line: 24b4. to
     indicate the end of an *note indented block: 24ab.

 -- データ: token.FSTRING_START

     Token value used to indicate the beginning of an *note f-string
     literal: 441.

     '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:
     441, 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: 4f1e, *note RBRACE: 4f1f, *note
     EXCLAMATION: 4f20. and *note COLON: 4f21. tokens.

 -- データ: token.FSTRING_END

     Token value used to indicate the end of a *note f-string: 441.

     '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: 4f1e, *note RBRACE: 4f1f, *note
     EXCLAMATION: 4f20. and *note COLON: 4f21. 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: 27b3.

 -- データ: token.ENCODING

     ソースの bytes をテキストにデコードするために使われるエンコーディン
     グを示すトークン値。*note tokenize.tokenize(): 8ee. は常に最初に
     ENCODING トークンを返します。

     'CPython 実装の詳細:' This token type isn't used by the C tokenizer
     but is needed for the *note tokenize: 104. module.

The following token types are not produced by the *note tokenize: 104.
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: 4f1c. tokens only with the *note PyCF_TYPE_COMMENTS: 4ed0.
     flag.

 -- データ: token.TYPE_COMMENT

     Token value indicating that a type comment was recognized.  Such
     tokens are produced instead of regular *note COMMENT: 4f1c. tokens
     only with the *note PyCF_TYPE_COMMENTS: 4ed0. flag.

 -- データ: token.SOFT_KEYWORD

     Token value indicating a *note soft keyword: bea.

     The tokenizer never produces this value.  To check for a soft
     keyword, pass a *note NAME: 24c8. token's string to *note
     keyword.issoftkeyword(): 4f28.

 -- データ: token.ERRORTOKEN

     Token value used to indicate wrong input.

     The *note tokenize: 104. module generally indicates errors by
     raising exceptions instead of emitting this token.  It can also
     emit tokens such as *note OP: 2499. or *note NAME: 24c8. with
     strings that are later rejected by the parser.
The remaining tokens represent specific *note operators: 249b. and *note
delimiters: 249a.  (The *note tokenize: 104. module reports these as
*note OP: 2499.; 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: 4f1c. 、*note NL: 4f1d.、*note
ENCODING: 4f25. トークンが追加されました。

バージョン 3.7 で変更: Removed ‘AWAIT’ and ‘ASYNC’ tokens.  "async" and
"await" are now tokenized as *note NAME: 24c8. tokens.

バージョン 3.8 で変更: Added *note TYPE_COMMENT: 4f27, *note
TYPE_IGNORE: 4f26, *note COLONEQUAL: 4f54.  Added ‘AWAIT’ and ‘ASYNC’
tokens back (they're needed to support parsing older Python versions for
*note ast.parse(): 1d4. with ‘feature_version’ set to 6 or lower).

バージョン 3.12 で変更: Added *note EXCLAMATION: 4f20.

バージョン 3.13 で変更: Removed ‘AWAIT’ and ‘ASYNC’ tokens again.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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 キーワード: 2498.
や *note ソフトキーワード: bea. か否かをチェックする機能を提供します。

 -- の関数: keyword.iskeyword (s)

     's' が Python の *note キーワード: 2498. であれば ‘True’ を返します
     。

 -- データ: keyword.kwlist

     インタープリタで定義している全ての *note キーワード: 2498. のシーケ
     ンス。特定の *note __future__: 0. 宣言がなければ有効ではないキーワ
     ードでもこのリストには含まれます。

 -- の関数: keyword.issoftkeyword (s)

     's' が Python の *note ソフトキーワード: bea. であれば ‘True’ を返
     します。

     Added in version 3.9.

 -- データ: keyword.softkwlist

     インタープリタで定義している全ての *note ソフトキーワード: bea. の
     シーケンス。特定の *note __future__: 0. 宣言がなければ有効ではない
     ソフトキーワードでもこのリストには含まれます。

     Added in version 3.9.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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:
249b. と *note delimiter: 249a. トークンおよび *note Ellipsis: 2537. は
ジェネリックな *note OP: 2499. トークンタイプとして返されます。正確な型
は *note tokenize.tokenize(): 8ee. が返す *note named tuple: a42. の
‘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(): 1d4.).  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::
* コマンドラインでの使用: コマンドラインでの使用<9>.
* 使用例: 使用例<50>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/tokenize.py


File: python.info,  Node: Tokenizing input,  Next: コマンドラインでの使用<9>,  Up: tokenize --- Python ソース用のトークナイザー

5.33.5.1 Tokenizing input
.........................

第一のエントリポイントは *note ジェネレータ: 1417. です:

 -- の関数: tokenize.tokenize (readline)

     *note tokenize(): 8ee. ジェネレータは一つの引数 'readline' を必要と
     します。この引数は呼び出し可能オブジェクトで、ファイルオブジェクト
     の *note io.IOBase.readline(): 16e3. メソッドと同じインタフェースを
     提供している必要があります。この関数は呼び出しのたびに入力の一行を
     bytes で返さなければなりません。

     このジェネレータは次の5要素のタプルを返します; トークンタイプ; トー
     クン文字列; ソース内でそのトークンがどの行、列で開始するかを示す
     int の ‘(srow, scol)’ タプル; どの行、列で終了するかを示す int の
     ‘(erow, ecol)’ タプル; トークンが見つかった行。 (タプルの最後の要素
     にある) 行は '物理' 行です。この5要素のタプルは *note named tuple:
     a42. として返され、フィールド名は ‘type string start end line’ にな
     ります。

     返される *note named tuple: a42. は追加のプロパティ ‘exact_type’ を
     持ちます。このプロパティは *note OP: 2499. トークンに対して正確な演
     算子のタイプを持ちます。それ以外のトークンタイプについては、
     ‘exact_type’ は ‘type’ フィールドと同じ値を持ちます。

     バージョン 3.1 で変更: named tuple のサポートを追加。

     バージョン 3.3 で変更: ‘exact_type’ のサポートを追加。

     *note tokenize(): 8ee. は PEP 263(1) にしたがって、ソースのエンコー
     ディングを UTF-8 BOM か encoding cookie を見つけて決定します。

 -- の関数: tokenize.generate_tokens (readline)

     Tokenize a source reading unicode strings instead of bytes.

     Like *note tokenize(): 8ee, 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(): 8ee.  It does not yield an *note ENCODING: 4f25. token.

All constants from the *note token: 103. 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: 4f25. token,
     which is the first token sequence output by *note tokenize(): 8ee.
     If there is no encoding token in the input, it returns a str
     instead.

*note tokenize(): 8ee. はトークナイズしようとしているソースファイルのエ
ンコーディングを検出する必要があります。これを行うために使っている関数が
公開されています:

 -- の関数: tokenize.detect_encoding (readline)

     *note detect_encoding(): 19ee. 関数は Python のソースファイルをデコ
     ードするのに使うエンコーディングを検出するために使われます。 *note
     tokenize(): 8ee. ジェネレータと同じ readline を引数として取ります。

     readline を最大2回呼び出し、利用するエンコーディング (文字列として)
     と、読み込んだ行を (bytes からデコードされないままの状態で) 返しま
     す。

     UTF-8 BOM か PEP 263(2) で定義されている encoding cookie からエンコ
     ーディングを検出します。BOMと cookie の両方が存在し、一致していない
     場合、*note SyntaxError: 189. が送出されます。 BOM が見つかった場合
     はエンコーディングとして ‘'utf-8-sig'’ が返されます。

     エンコーディングが指定されていない場合、デフォルトの ‘'utf-8'’ が返
     されます。

     Python のソースファイルを開くには *note open(): 2f1b. を使ってくだ
     さい。これは *note detect_encoding(): 19ee. を利用してファイルエン
     コーディングを検出します。

 -- の関数: tokenize.open (filename)

     *note detect_encoding(): 19ee. を使って検出したエンコーディングを利
     用して、ファイルを読み出し専用モードで開きます。

     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: コマンドラインでの使用<9>,  Next: 使用例<50>,  Prev: Tokenizing input,  Up: tokenize --- Python ソース用のトークナイザー

5.33.5.2 コマンドラインでの使用
...............................

Added in version 3.3.

The ‘tokenize’ module can be executed as a script from the command line.
It is as simple as:

     python -m tokenize [-e] [filename.py]

以下のオプションが使用できます:

 -- Option: -h, --help

     このヘルプメッセージを出力して終了します

 -- Option: -e, --exact

     exact type を使ってトークン名を表示します

‘filename.py’ が指定された場合、その内容がトークナイズされ stdout に出力
されます。指定されなかった場合は stdin からトークナイズします。

Added in version 3.15: Output is in color by default and can be *note
controlled using environment variables: 1ba.


File: python.info,  Node: 使用例<50>,  Prev: コマンドラインでの使用<9>,  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: 4f62. オプションで表示できます:

     $ 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(): 8ef.:

     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(): 8ee.:

     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(): 4f68. を
使うことができます。

     注釈: このモジュールが提供する API を将来のリリースで変更する確率が
     高いです。このような変更は後方互換性がないかもしれません。

 -- の関数: tabnanny.check (file_or_dir)

     'file_or_dir' がディレクトリであってシンボリックリンクでないときに
     、 'file_or_dir' という名前のディレクトリツリーを再帰的に下って行き
     、この通り道に沿ってすべての ‘.py’ ファイルをチェックします。
     'file_or_dir' が通常の Python ソースファイルの場合には、問題のある
     空白をチェックします。診断メッセージは *note print(): 1324. 関数を
     使って標準出力に書き込まれます。

 -- データ: tabnanny.verbose

     冗長なメッセージをプリントするかどうかを示すフラグ。スクリプトとし
     て呼び出された場合は、‘-v’ オプションによって増加します。

 -- データ: tabnanny.filename_only

     問題のある空白を含むファイルのファイル名のみをプリントするかどうか
     を示すフラグ。スクリプトとして呼び出された場合は、‘-q’ オプションに
     よって真に設定されます。

 -- 例外: tabnanny.NannyNag

     あいまいなインデントを検出した場合に *note process_tokens(): 4f6c.
     が送出します。 この例外は *note check(): 4f68. で捕捉され処理されま
     す。

 -- の関数: tabnanny.process_tokens (tokens)

     この関数は、 *note tokenize: 104. モジュールによって生成されたトー
     クンを *note check(): 4f68. が処理するために使われます。

参考
....

*note tokenize: 104. モジュール

     Pythonソースコードの字句解析器。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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/main/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: 193. 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:
          9d4. 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:
     4f72. 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(): c09. are listed as a string with the class
          name instead of as ‘Class’ objects.

      -- の属性: methods

          A *note dictionary: 193. mapping method names to line numbers.
          This can be derived from the newer *note children: 4f82.
          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: 4f88. 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: 4f88. is
     raised instead.  However if 'quiet' is 2, no message is written,
     and 'doraise' has no effect.

     (明示的に指定されたか計算された結果の) 'cfile' のパスがシンボリック
     リンクだったり通常のファイルでなかったりした場合は、 *note
     FileExistsError: 13cd. が送出されます。この動作は、それらのパスにバ
     イトコンパイルされたファイルを書き込む権限がある場合、インポートの
     ときにそのパスを通常のファイルに変えてしまうことを警告するためのも
     のです。これはリネームを使ってバイトコンパイルされたファイルを配置
     するインポートで、同時にファイル書き込みをしてしまう問題を避けるた
     めの副作用です。

     'optimize' は最適化レベルを制御するもので、組み込みの *note
     compile(): 1d3. 関数に渡されます。デフォルトは現在のインタープリタ
     の最適化レベルを選ぶ ‘-1’ です。

     'invalidation_mode' should be a member of the *note
     PycInvalidationMode: 4f89. enum and controls how the generated
     bytecode cache is invalidated at runtime.  The default is *note
     PycInvalidationMode.CHECKED_HASH: 4f8a. if the ‘SOURCE_DATE_EPOCH’
     environment variable is set, otherwise the default is *note
     PycInvalidationMode.TIMESTAMP: 4f8b.

     バージョン 3.2 で変更: PEP 3147(4) に準拠し 'cfile' のデフォルト値
     を変更しました。以前のデフォルトは 'file' + ‘'c'’ (最適化が有効な場
     合は ‘'o'’) でした。同時に 'optimize' パラメータも追加されました。

     バージョン 3.4 で変更: バイトコードをキャッシュするファイルへの書き
     込みに *note importlib: 7a. を使うようにコードを変更しました。これ
     により、例えば権限や write-and-move セマンティクスなどの、ファイル
     の作成や書き込みの動作が ‘importlib’ と一致するようになりました。
     'cfile' がシンボリックリンクであるか通常のファイルでない場合、
     *note FileExistsError: 13cd. を送出するという注意書きも追加されまし
     た。

     バージョン 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: 4f8a.

     バージョン 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 キャッシュされたバイトコードの無効化: 9e8. 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: 4f8a, 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/main/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: 4f91. のサポートが追加されました。

参考
....

*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: 234c.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1d86. を見てください。

* Menu:

* コマンドラインでの使用: コマンドラインでの使用<10>.
* パブリックな関数::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/compileall.py


File: python.info,  Node: コマンドラインでの使用<10>,  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():
     6e6. will be used.

 -- Option: --invalidation-mode [timestamp|checked-hash|unchecked-hash]

     生成したバイトコードファイルを実行時に無効化する方法を制御します。
     ‘timestamp’ を指定すると、生成した''.pyc'' ファイルにソースファイル
     のタイムスタンプとサイズを埋め込みます。‘checked-hash’ と
     ‘unchecked-hash’ を指定すると、ハッシュベースの pycファイルが生成さ
     れます。ハッシュベースのpycファイルは、ソースファイルにタイムスタン
     プではなくハッシュ値を埋め込みます。Python がバイトコードキャッシュ
     ファイルを実行時に検証する方法の詳細を知るには、*note
     キャッシュされたバイトコードの無効化: 9e8. を参照してください。デフ
     ォルト値は、 ‘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(): 8d9.  Added the possibility to specify the ‘-o’
option multiple times.

*note compile(): 1d3. 関数で利用される最適化レベルを制御するコマンドライ
ンオプションはありません。 Python インタプリタ自体のオプションを使ってく
ださい: ‘python -O -m compileall’.

Similarly, the *note compile(): 1d3. function respects the *note
sys.pycache_prefix: d71. 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: コマンドラインでの使用<10>,  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: 1336.
     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(): 1d3. 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: 15a.
     will be raised.

     'invalidation_mode' は、*note py_compile.PycInvalidationMode: 4f89.
     のメンバーでなければならず、生成された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: 1013.

     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: 7a5. を受け入れるよ
     うになりました。

     バージョン 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: 1336. 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(): 1d3. 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: 4f89.
     のメンバーでなければならず、生成された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: 1013.

     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(): eec.
     関数に渡されます。 その他の 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: bb.

     一つのソースファイルをバイトコンパイルします。

   ---------- 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: 6b9.
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: aeb.
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: aeb. entries.

As a consequence, the presence of the *note CACHE: aeb. 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: 4a0. command-line option and the
‘show_positions’ argument were added.

The *note -S: 4a1. 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:

* コマンドライン・インターフェース: コマンドライン・インターフェース<13>.
* バイトコード解析::
* 解析関数::
* Python バイトコード命令::
* 命令コードコレクション::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/dis.py


File: python.info,  Node: コマンドライン・インターフェース<13>,  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: コマンドライン・インターフェース<13>,  Up: dis --- Python バイトコードの逆アセンブラー

5.33.10.2 バイトコード解析
..........................

Added in version 3.4.

バイトコード解析の API を使うと、 Python のコード片を *note Bytecode:
49c. オブジェクトでラップでき、コンパイルされたコードの細かいところに簡
単にアクセスできます。

 -- クラス: dis.Bytecode (x, *, first_line=None, current_offset=None,
          show_caches=False, adaptive=False, show_offsets=False,
          show_positions=False)

     関数、ジェネレータ、非同期ジェネレータ、コルーチン、メソッド、ソー
     スコード文字列、(*note compile(): 1d3. が返すような) コードオブジェ
     クトに対応するバイトコードを解析します。

     これは、下で並べられている関数の多くのものをまとめた便利なラッパー
     です。 とりわけ目立つのは *note get_instructions(): 6f7. で、 *note
     Bytecode: 49c. インスタンスに対し反復処理をしながら、バイトコード命
     令を *note Instruction: 49b. インスタンスとして返します。

     'first_line' が ‘None’ でない場合は、それを逆アセンブルしたコードの
     ソースの最初の行に表示する行番号とします。 そうでない場合は、ソース
     の行の情報 (もしあれば) を逆アセンブルされたコードオブジェクトから
     直接取得します。

     'current_offset' が ‘None’ でない場合は、逆アセンブルされたコードで
     のあるインストラクションのオフセット位置を示します。 これを設定する
     と、 *note dis(): 12de. の出力において、指定された命令コード
     (opcode) に "現在の命令 (instruction)" を表す印が表示されます。

     If 'show_caches' is ‘True’, *note dis(): 12de. will display inline
     cache entries used by the interpreter to specialize the bytecode.

     If 'adaptive' is ‘True’, *note dis(): 12de. will display
     specialized bytecode that may be different from the original
     bytecode.

     If 'show_offsets' is ‘True’, *note dis(): 12de. will include
     instruction offsets in the output.

     If 'show_positions' is ‘True’, *note dis(): 12de. will include
     instruction source code positions in the output.

      -- メソッド: classmethod from_traceback (tb, *, show_caches=False)

          与えられたトレースバックから *note Bytecode: 49c. インスタンス
          を構築し、 'current_offset' がその例外の原因となった命令となる
          よう設定します。

      -- データ: codeobj

          コンパイルされたコードオブジェクト。

      -- データ: first_line

          コードオブジェクトのソースの最初の行 (利用可能であれば)

      -- メソッド: dis ()

          バイトコード命令の整形された表示を返します (*note dis.dis():
          49d. と同じ出力になりますが、複数行文字列として返されます)。

      -- メソッド: info ()

          *note code_info(): 15f4. のようなコードオブジェクトの詳細を含
          んだ整形された複数行文字列を返します。

     バージョン 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:
     6ba.  Strings are first compiled to code objects with the *note
     compile(): 1d3. 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: 49b. からなる列を生成します。

     'first_line' が ‘None’ でない場合は、それを逆アセンブルしたコードの
     ソースの最初の行に表示する行番号とします。 そうでない場合は、ソース
     の行の情報 (もしあれば) を逆アセンブルされたコードオブジェクトから
     直接取得します。

     The 'adaptive' parameter works as it does in *note dis(): 3b.

     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:
     49b. 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(): 335. method of
     the *note code object: 6f1. '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(): 335.
     method is used instead of the *note co_firstlineno: 25a3. and
     ‘codeobject.co_lnotab’ attributes of the *note code object: 6f1.

     バージョン 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(): 6f7. 関数と *note Bytecode: 49c. クラスはバイ
トコード命令の詳細を *note Instruction: 49b. インスタンスの形で提供しま
す:

 -- クラス: dis.Instruction

     バイトコード命令の詳細

      -- データ: opcode

          以下の命令コードの値と *note 命令コードコレクション: 4fc0. の
          バイトコードの値に対応する、命令の数値コードです。

      -- データ: opname

          人間が読むための命令名

      -- データ: baseopcode

          numeric code for the base operation if operation is
          specialized; otherwise equal to *note opcode: 4fbf.

      -- データ: baseopname

          human readable name for the base operation if operation is
          specialized; otherwise equal to *note opname: 4fc4.

      -- データ: arg

          (ある場合は) 命令の数値引数、無ければ ‘None’

      -- データ: oparg

          alias for *note arg: 4fc5.

      -- データ: 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: 4fc9.

      -- データ: 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: 1b77. 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: 522. and *note BRANCH_RIGHT: 523. events for *note
     sys.monitoring: e3.

     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: 5f6. 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: fa2. or *note
     coroutine: 8a7. 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: 4d47. 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: e74. 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:
     201d, 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(): 90a. or *note
     close(): 19bf. call through the current frame.  If ‘STACK[-1]’ is
     an instance of *note StopIteration: fbe, 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: 4fe1, *note LIST_APPEND: 4fe2, *note MAP_ADD: e75. は、追
加した値または 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: 1417.

     バージョン 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: 110e.
     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: c62. 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: 215. 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: d35. statement to load *note AssertionError:
     a9c.

     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: 1df.
     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:
     ca0. (or, more technically: if it has the *note Py_TPFLAGS_MAPPING:
     1e6e. flag set in its *note tp_flags: 1e87.), 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:
     1582. and is 'not' an instance of *note str: 1ea./*note bytes:
     1d2./*note bytearray: 1d1. (or, more technically: if it has the
     *note Py_TPFLAGS_SEQUENCE: 1e6f. flag set in its *note tp_flags:
     1e87.), 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: 1d9. 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: 25a2. of the *note code object: 6f1.
     The compiler tries to use *note STORE_FAST: 1c88. or *note
     STORE_GLOBAL: 4feb. if possible.

 -- Opcode: DELETE_NAME (namei)

     Implements ‘del name’, where 'namei' is the index into *note
     co_names: 25a2. attribute of the *note code object: 6f1.

 -- 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: 25a2. of the
     *note code object: 6f1.

 -- Opcode: DELETE_ATTR (namei)

     Implements:

          obj = STACK.pop()
          del obj.name

     where 'namei' is the index of name into *note co_names: 25a2. of
     the *note code object: 6f1.

 -- Opcode: STORE_GLOBAL (namei)

     *note STORE_NAME: 4fea. と同じように動作しますが、 name をグローバ
     ルとして保存します。

 -- Opcode: DELETE_GLOBAL (namei)

     *note DELETE_NAME: 4fec. と同じように動作しますが、グローバルの
     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: 8fa. and *note LOAD_FROM_DICT_OR_GLOBALS:
     8fb.

     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:
     1c7f.  This is used for loading global variables in *note
     annotation scopes: 6ba. within class bodies.

     Added in version 3.12.

 -- Opcode: BUILD_TEMPLATE

     Constructs a new *note Template: 41c. 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: 41d. 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: 4ff2. と同じように動作しますが、この命令はリスト
     を作り出します。

 -- Opcode: BUILD_SET (count)

     *note BUILD_TUPLE: 4ff2. と同じように動作しますが、この命令は 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: 4ff7. 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: af8. or *note CALL_KW:
     5a8. 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(): 44a, 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: 8f2, 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: 8f2, 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(): 44a. (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: 5f6.

 -- 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__(): caa.  The module object is pushed onto the
     stack.  The current namespace is not affected: for a proper import
     statement, a subsequent *note STORE_FAST: 1c88. 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: 1c88. 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: 5f6. 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: 5f6. 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: 6d4.  Call its *note __next__():
     1687. 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: 18ee.

 -- 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: 18ee. 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: 259e.

 -- 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: 5000.  This is used for loading *note
     closure variables: 1ad6. in class bodies (which previously used
     ‘LOAD_CLASSDEREF’) and in *note annotation scopes: 6ba. 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: 259e.

 -- Opcode: DELETE_DEREF (i)

     Empties the cell contained in slot ‘i’ of the "fast locals"
     storage.  Used by the *note del: 1d3c. statement.

     Added in version 3.2.

     バージョン 3.11 で変更: ‘i’ is no longer offset by the length of
     *note co_varnames: 259e.

 -- Opcode: COPY_FREE_VARS (n)

     Copies the ‘n’ *note free (closure) variables: 1ad6. 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: 5a8.

 -- 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: 1d9. 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 *note LOAD_ATTR: 8f2. 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: 5004.

 -- 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: 411. 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(): 1db. 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(): 1ea. on 'value'

        * ‘oparg == 2’: call *note repr(): 462. on 'value'

        * ‘oparg == 3’: call *note ascii(): 179f. 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: fbe, 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: 7a4. 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: 7a4. 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: 29f.
                                             
                                             
     ‘INTRINSIC_PARAMSPEC’                   Creates a
                                             *note typing.ParamSpec: 2a0.
                                             
                                             
     ‘INTRINSIC_TYPEVARTUPLE’                Creates a
                                             *note typing.TypeVarTuple: 29e.
                                             
                                             
     ‘INTRINSIC_SUBSCRIPT_GENERIC’           Returns *note typing.Generic: 1a12.
                                             subscripted with the argument
                                             
                                             
     ‘INTRINSIC_TYPEALIAS’                   Creates a
                                             *note typing.TypeAliasType: 531.;
                                             used in the *note type: 860.
                                             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: 6de. to raise
                                                  from a ‘try-except*’.
                                                  
                                                  
     ‘INTRINSIC_TYPEVAR_WITH_BOUND’               Creates a *note typing.TypeVar: 29f.
                                                  with a bound.
                                                  
                                                  
     ‘INTRINSIC_TYPEVAR_WITH_CONSTRAINTS’         Creates a *note typing.TypeVar: 29f.
                                                  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: 215. and *note async with: 216.
     constructs, which push the return value of the context manager's
     *note __enter__(): 9cb. or *note __aenter__(): 2631. 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: 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:
     1ad6.  '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: 5014.

 -- データ: 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:

* コマンドラインでの使用: コマンドラインでの使用<11>.
* Programmatic interface::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/pickletools.py


File: python.info,  Node: コマンドラインでの使用<11>,  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: コマンドラインでの使用<11>

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.

Added in version 3.15: Output is in color by default and can be *note
controlled using environment variables: 1ba.


File: python.info,  Node: Programmatic interface,  Prev: コマンドラインでの使用<11>,  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 イテレータ: 6d4. を返しま
     す。このイテレータは ‘(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++ ランタイムの有用なルーチン群
-------------------------------------------------------

'Source code:' PC/msvcrtmodule.c(1)

__________________________________________________________________

このモジュールの関数は、 Windows プラットフォームの便利な機能のいくつか
に対するアクセス機構を提供しています。高レベルモジュールのいくつかは、提
供するサービスを Windows で実装するために、これらの関数を使っています。
例えば、 *note getpass: 65. モジュールは関数 *note getpass(): 65. を実装
するためにこのモジュールの関数を使います。

ここに挙げた関数の詳細なドキュメントについては、プラットフォーム API ド
キュメントで見つけることができます。

このモジュールは、通常版とワイド文字列版の両方のコンソールI/O APIを実装
しています。通常版の API は ASCII 文字列のためのもので、国際化アプリケー
ションでは利用が制限されます。可能な限りワイド文字列版APIを利用するべき
です。

*note Availability: 234c.: Windows.

バージョン 3.3 で変更: このモジュールの操作で以前は *note IOError: 1409.
が送出されていたところで *note OSError: 543. が送出されるようになりまし
た。

* Menu:

* ファイル操作関連::
* コンソール I/O 関連::
* その多の関数::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/PC/msvcrtmodule.c


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: 543. 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 監査イベント: 1e84.
     ‘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: 543. is
     raised.

 -- データ: msvcrt.LK_NBLCK
 -- データ: msvcrt.LK_NBRLCK

     指定されたバイト列にロックをかけます。指定領域がロックできなかった
     場合、 *note OSError: 543. が送出されます。

 -- データ: msvcrt.LK_UNLCK

     指定されたバイト列のロックを解除します。指定領域はあらかじめロック
     されていなければなりません。

 -- の関数: msvcrt.setmode (fd, flags)

     ファイル記述子 'fd' に対して、行末文字の変換モードを設定します。テ
     キストモードに設定するには、 'flags' を *note os.O_TEXT: 328f. にし
     ます; バイナリモードにするには *note os.O_BINARY: 3280. にします。

 -- の関数: 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:
     3282, *note os.O_RDONLY: 327e, *note os.O_TEXT: 328f. and *note
     os.O_NOINHERIT: 328a.  The returned file descriptor may be used as
     a parameter to *note os.fdopen(): 2590. to create a file object.

     The file descriptor is inheritable by default.  Pass *note
     os.O_NOINHERIT: 328a. flag to make it non inheritable.

     引数 ‘handle’, ‘flags’ を指定して *note 監査イベント: 1e84.
     ‘msvcrt.open_osfhandle’ を送出します。

 -- の関数: msvcrt.get_osfhandle (fd)

     Return the file handle for the file descriptor 'fd'.  Raises *note
     OSError: 543. if 'fd' is not recognized.

     引数 ‘fd’ を指定して *note 監査イベント: 1e84.
     ‘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(): 503b. のワイド文字列版。Unicode の値を返します。

 -- の関数: msvcrt.getche ()

     Similar to *note getch(): 503b, but the keypress will be echoed if
     it represents a printable character.

 -- の関数: msvcrt.getwche ()

     *note getche(): 503c. のワイド文字列版。Unicode の値を返します。

 -- の関数: msvcrt.putch (char)

     バイト文字列 'char' をバッファリングを行わないでコンソールに出力し
     ます。

 -- の関数: msvcrt.putwch (unicode_char)

     *note putch(): 503d. のワイド文字列版。Unicode の値を引数に取ります
     。

 -- の関数: msvcrt.ungetch (char)

     バイト文字列 'char' をコンソールバッファに "押し戻し (push back)" ま
     す; これにより、押し戻された文字は *note getch(): 503b. や *note
     getche(): 503c. で次に読み出される文字になります。

 -- の関数: msvcrt.ungetwch (unicode_char)

     *note ungetch(): 503e. のワイド文字列版。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: 543.

 -- の関数: 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: 5044.
     Returns the old setting or -1 if an error occurs.  Only available
     in *note debug build of Python: 3e3.

 -- データ: msvcrt.OUT_TO_DEFAULT

     Error sink is determined by the app's type.  Only available in
     *note debug build of Python: 3e3.

 -- データ: msvcrt.OUT_TO_STDERR

     Error sink is a standard error.  Only available in *note debug
     build of Python: 3e3.

 -- データ: msvcrt.OUT_TO_MSGBOX

     Error sink is a message box.  Only available in *note debug build
     of Python: 3e3.

 -- データ: msvcrt.REPORT_ERRMODE

     Report the current error mode value.  Only available in *note debug
     build of Python: 3e3.

 -- の関数: 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: 3e3.

 -- の関数: msvcrt.CrtSetReportFile (type, file)

     After you use *note CrtSetReportMode(): 5048. to specify *note
     CRTDBG_MODE_FILE: 504a, 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: 3e3.

 -- データ: 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(): 5049. 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 レジストリへのアクセス
-------------------------------------------------

'Source code:' PC/winreg.c(1)

__________________________________________________________________

これらの関数は Windows レジストリ API を Python から使えるようにします。
プログラマがレジストリハンドルを明示的にクローズするのを忘れた場合でも、
確実にハンドルがクローズされるようにするために、レジストリハンドルとして
整数値ではなく *note ハンドルオブジェクト: 5054. が使われます。

*note Availability: 234c.: Windows.

バージョン 3.3 で変更: このモジュールのいくつかの関数は以前は *note
WindowsError: 140b. を送出していました。それは今では *note OSError: 543.
の別名です。

* Menu:

* 関数: 関数<14>.
* 定数: 定数<11>.
* レジストリハンドルオブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/PC/winreg.c


File: python.info,  Node: 関数<14>,  Next: 定数<11>,  Up: winreg --- Windows レジストリへのアクセス

5.34.2.1 関数
.............

このモジュールでは以下の関数を提供します:

 -- の関数: winreg.CloseKey (hkey)

     以前開かれたレジストリキーを閉じます。'hkey' 引数は以前開かれたレジ
     ストリキーを指定します。

          注釈: このメソッドを使って (または *note hkey.Close(): 5059. に
          よって) 'hkey' が閉じられなかった場合、Python が 'hkey' オブジ
          ェクトを破壊する際に閉じられます。

 -- の関数: winreg.ConnectRegistry (computer_name, key)

     他のコンピュータ上にある事前に定義されたレジストリハンドルとの接続
     を確立し、 *note ハンドルオブジェクト: 5054. を返します。

     'computer_name' はリモートコンピュータの名前で、‘r"\\computername"’
     の形式をとります。‘None’ の場合、ローカルのコンピュータが使われます
     。

     'key' は、事前に定義された接続先のハンドルです。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 543. 例外が送出されます。

     引数 ‘computer_name’, ‘key’ を指定して *note 監査イベント: 1e84.
     ‘winreg.ConnectRegistry’ を送出します。

     バージョン 3.3 で変更: *note 上記: 5055. を参照。

 -- の関数: winreg.CreateKey (key, sub_key)

     指定されたキーを生成するか開き、 *note ハンドルオブジェクト: 5054.
     を返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'sub_key' はこのメソッドが開く、または新規作成するキーの名前です。

     'key' が事前に定義されたキーのうちの一つなら、'sub_key' は ‘None’ で
     かまいません。その場合、この関数に渡されるキーハンドルと同じハンド
     ルが返されます。

     キーがすでに存在する場合、この関数はその既存のキーを開きます。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 543. 例外が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1e84. ‘winreg.CreateKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1e84.
     ‘winreg.OpenKey/result’ を送出します。

     バージョン 3.3 で変更: *note 上記: 5055. を参照。

 -- の関数: winreg.CreateKeyEx (key, sub_key, reserved=0,
          access=KEY_WRITE)

     指定されたキーを生成するか開き、 *note ハンドルオブジェクト: 5054.
     を返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'sub_key' はこのメソッドが開く、または新規作成するキーの名前です。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_WRITE: 505b. で
     す。その他の利用可能な値については *note アクセス権: 505c. を参照し
     てください。

     'key' が事前に定義されたキーのうちの一つなら、'sub_key' は ‘None’ で
     かまいません。その場合、この関数に渡されるキーハンドルと同じハンド
     ルが返されます。

     キーがすでに存在する場合、この関数はその既存のキーを開きます。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 543. 例外が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1e84. ‘winreg.CreateKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1e84.
     ‘winreg.OpenKey/result’ を送出します。

     Added in version 3.2.

     バージョン 3.3 で変更: *note 上記: 5055. を参照。

 -- の関数: winreg.DeleteKey (key, sub_key)

     指定されたキーを削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'sub_key' は文字列で、'key' 引数によって指定されたキーのサブキーで
     なければなりません。この値は ‘None’ であってはならず、キーはサブキ
     ーを持っていなくてもかまいません。

     'このメソッドはサブキーをもつキーを削除することはできません。'

     このメソッドの実行が成功すると、キー全体が、その値すべてを含めて削
     除されます。このメソッドが失敗した場合、 *note OSError: 543. 例外が
     送出されます。

     Raises an *note auditing event: 1e84. ‘winreg.DeleteKey’ with
     arguments ‘key’, ‘sub_key’, ‘access’.

     バージョン 3.3 で変更: *note 上記: 5055. を参照。

 -- の関数: winreg.DeleteKeyEx (key, sub_key, access=KEY_WOW64_64KEY,
          reserved=0)

     指定されたキーを削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'sub_key' は 'key' 引数によって指定された key の subkey でなければ
     なりません。この値は ‘None’ であってはなりません。また、key は
     subkey を持たないかもしれません。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_WOW64_64KEY:
     505d. です。32 bit Windows では、WOW64 定数は無視されます。その他の
     利用可能な値については *note アクセス権: 505c. を参照してください。

     'このメソッドはサブキーをもつキーを削除することはできません。'

     このメソッドの実行が成功すると、キー全体が、その値すべてを含めて削
     除されます。このメソッドが失敗した場合、 *note OSError: 543. 例外が
     送出されます。

     サポートされていない Windows バージョンでは、 *note
     NotImplementedError: 5a1. 例外を発生させます。

     Raises an *note auditing event: 1e84. ‘winreg.DeleteKey’ with
     arguments ‘key’, ‘sub_key’, ‘access’.

     Added in version 3.2.

     バージョン 3.3 で変更: *note 上記: 5055. を参照。

 -- の関数: winreg.DeleteTree (key, sub_key=None)

     Deletes the specified key and all its subkeys and values
     recursively.

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'sub_key' is a string that names the subkey to delete.  If ‘None’,
     deletes all subkeys and values of the specified key.

     This function deletes a key and all its descendants.  If 'sub_key'
     is ‘None’, all subkeys and values of the specified key are deleted.

     Raises an *note auditing event: 1e84. ‘winreg.DeleteTree’ with
     arguments ‘key’, ‘sub_key’.

     Added in version 3.15.

 -- の関数: winreg.DeleteValue (key, value)

     レジストリキーから指定された名前つきの値を削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'value' は削除したい値を指定するための文字列です。

     引数 ‘key’, ‘value’ を指定して *note 監査イベント: 1e84.
     ‘winreg.DeleteValue’ を送出します。

 -- の関数: winreg.EnumKey (key, index)

     開かれているレジストリキーのサブキーを列挙し、文字列で返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'index' は整数値で、取得するキーのインデクスを指定します。

     この関数は、呼び出されるたびに一つのサブキーの名前を取得します。こ
     の関数は通常、これ以上値がないことを示す *note OSError: 543. 例外が
     送出されるまで繰り返し呼び出されます。

     引数 ‘key’, ‘index’ を指定して *note 監査イベント: 1e84.
     ‘winreg.EnumKey’ を送出します。

     バージョン 3.3 で変更: *note 上記: 5055. を参照。

 -- の関数: winreg.EnumValue (key, index)

     開かれているレジストリキーの値を列挙し、タプルで返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'index' は整数値で、取得する値のインデクスを指定します。

     この関数は、呼び出されるたびに一つのサブキーの名前を取得します。こ
     の関数は通常、これ以上値がないことを示す *note OSError: 543. 例外が
     送出されるまで繰り返し呼び出されます。

     結果は 3 要素のタプルになります:

     インデッ    意味
     クス        

     -------------------------------------------------------------
                 
     ‘0’         値の名前を指定する文字列
                 
                 
     ‘1’         値のデータを保持するためのオブジェクトで、その
                 型は背後のレジストリ型に依存します
                 
                 
     ‘2’         値のデータ型を指定する整数です
                 (*note SetValueEx(): 1d21. のドキュメント内の
                 テーブルを参照してください)
                 

     引数 ‘key’, ‘index’ を指定して *note 監査イベント: 1e84.
     ‘winreg.EnumValue’ を送出します。

     バージョン 3.3 で変更: *note 上記: 5055. を参照。

 -- の関数: winreg.ExpandEnvironmentStrings (str)

     *note REG_EXPAND_SZ: 505e. のように、環境変数プレースホルダ
     ‘%NAME%’ を文字列で展開します:

          >>> ExpandEnvironmentStrings('%windir%')
          'C:\\Windows'

     引数 ‘str’ を指定して *note 監査イベント: 1e84.
     ‘winreg.ExpandEnvironmentStrings’ を送出します。

 -- の関数: winreg.FlushKey (key)

     キーのすべての属性をレジストリに書き込みます。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     キーを変更するために *note FlushKey(): 505f. を呼ぶ必要はありません
     。レジストリの変更は怠惰なフラッシュ機構 (lazy flusher) を使ってフ
     ラッシュされます。また、システムの遮断時にもディスクにフラッシュさ
     れます。 *note CloseKey(): 5058. と違って、 ‘FlushKey()’ メソッドは
     レジストリに全てのデータを書き終えたときにのみ返ります。アプリケー
     ションは、レジストリへの変更を絶対に確実にディスク上に反映させる必
     要がある場合にのみ、 ‘FlushKey()’ を呼ぶべきです。

          注釈: *note FlushKey(): 505f. を呼び出す必要があるかどうか分か
          らない場合、おそらくその必要はありません。

 -- の関数: winreg.LoadKey (key, sub_key, file_name)

     指定されたキーの下にサブキーを生成し、サブキーに指定されたファイル
     のレジストリ情報を記録します。

     'key' は *note ConnectRegistry(): 49cb. が返したハンドルか、定数
     *note HKEY_USERS: 5060. と *note HKEY_LOCAL_MACHINE: 5061. のどちら
     かです。

     'sub_key' は記録先のサブキーを指定する文字列です。

     'file_name' はレジストリデータを読み出すためのファイル名です。この
     ファイルは *note SaveKey(): 49d6. 関数で生成されたファイルでなくて
     はなりません。ファイル割り当てテーブル (FAT) ファイルシステム下では
     、ファイル名は拡張子を持っていてはなりません。

     A call to *note LoadKey(): 49d1. 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(): 49cb. によって返されたハンドルの
     場合、 'file_name' に指定されたパスはリモートコンピュータに対する相
     対パス名になります。

     引数 ‘key’, ‘sub_key’, ‘file_name’ を指定して *note 監査イベント:
     1e84. ‘winreg.LoadKey’ を送出します。

 -- の関数: winreg.OpenKey (key, sub_key, reserved=0, access=KEY_READ)
 -- の関数: winreg.OpenKeyEx (key, sub_key, reserved=0, access=KEY_READ)

     指定されたキーを開き、 *note ハンドルオブジェクト: 5054. を返します
     。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'sub_key' は開くサブキーを指定する文字列です。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_READ: 5063. で
     す。その他の利用可能な値については *note アクセス権: 505c. を参照し
     てください。

     指定されたキーへの新しいハンドルが返されます。

     この関数が失敗すると、 *note OSError: 543. が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1e84. ‘winreg.OpenKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1e84.
     ‘winreg.OpenKey/result’ を送出します。

     バージョン 3.2 で変更: 名前付き引数が使用できるようになりました。

     バージョン 3.3 で変更: *note 上記: 5055. を参照。

 -- の関数: winreg.QueryInfoKey (key)

     キーに関する情報をタプルとして返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     結果は 3 要素のタプルになります:

     インデッ    意味
     クス        

     --------------------------------------------------------------
                 
     ‘0’         このキーが持つサブキーの数を表す整数。
                 
                 
     ‘1’         このキーが持つ値の数を表す整数。
                 
                 
     ‘2’         最後のキーの変更が (あれば) いつだったかを表す
                 整数で、1601 年 1 月 1 日からの 100 ナノ秒単位
                 で数えたもの。
                 

     引数 ‘key’ を指定して *note 監査イベント: 1e84.
     ‘winreg.QueryInfoKey’ を送出します。

 -- の関数: winreg.QueryValue (key, sub_key)

     キーに対する、名前付けられていない値を文字列で取得します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'sub_key' は値が関連付けられているサブキーの名前を保持する文字列で
     す。この引数が ‘None’ または空文字列の場合、この関数は 'key' で指定
     されたキーに対して *note SetValue(): 49d7. メソッドで設定された値を
     取得します。

     レジストリ中の値は名前、型、およびデータから構成されています。この
     メソッドはあるキーのデータ中で、名前 ‘NULL’ をもつ最初の値を取得し
     ます。しかし背後のAPI 呼び出しは型情報を返しません。なので、可能な
     らいつでも *note QueryValueEx(): 19c9. を使うべきです。

     引数 ‘key’, ‘sub_key’, ‘value_name’ を指定して *note 監査イベント:
     1e84. ‘winreg.QueryValue’ を送出します。

 -- の関数: winreg.QueryValueEx (key, value_name)

     開かれたレジストリキーに関連付けられている、指定した名前の値に対し
     て、型およびデータを取得します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'value_name' は要求する値を指定する文字列です。

     結果は 2 つの要素からなるタプルです:

     インデッ    意味
     クス        

     ----------------------------------------------------------
                 
     ‘0’         レジストリ要素の値。
                 
                 
     ‘1’         この値のレジストリ型を表す整数。
                 (*note SetValueEx(): 1d21. のドキュメント内
                 のテーブルを参照してください。)
                 

     引数 ‘key’, ‘sub_key’, ‘value_name’ を指定して *note 監査イベント:
     1e84. ‘winreg.QueryValue’ を送出します。

 -- の関数: winreg.SaveKey (key, file_name)

     指定されたキーと、そのサブキー全てを指定したファイルに保存します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'file_name' はレジストリデータを保存するファイルの名前です、このフ
     ァイルはすでに存在していてはいけません。このファイル名が拡張子を含
     んでいる場合、 *note LoadKey(): 49d1. メソッドは、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 監査イベント: 1e84.
     ‘winreg.SaveKey’ を送出します。

 -- の関数: winreg.SetValue (key, sub_key, type, value)

     値を指定したキーに関連付けます。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'sub_key' は値が関連付けられているサブキーの名前を表す文字列です。

     'type' はデータの型を指定する整数です。現状では、この値は *note
     REG_SZ: 5064. でなければならず、これは文字列だけがサポートされてい
     ることを示します。他のデータ型をサポートするには *note
     SetValueEx(): 1d21. を使ってください。

     'value' は新たな値を指定する文字列です。

     'sub_key' 引数で指定されたキーが存在しなければ、SetValue 関数で生成
     されます。

     値の長さは利用可能なメモリによって制限されます。(2048 バイト以上の)
     長い値はファイルに保存して、そのファイル名を設定レジストリに保存す
     るべきです。そうすればレジストリを効率的に動作させる役に立ちます。

     'key' 引数に指定されたキーは *note KEY_SET_VALUE: 5065. アクセスで
     開かれていなければなりません。

     引数 ‘key’, ‘sub_key’, ‘type’, ‘value’ を指定して *note
     監査イベント: 1e84. ‘winreg.SetValue’ を送出します。

 -- の関数: winreg.SetValueEx (key, value_name, reserved, type, value)

     開かれたレジストリキーの値フィールドにデータを記録します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     'value_name' は値が関連付けられているサブキーの名前を表す文字列です
     。

     'reserved' は何もしません - API には常にゼロが渡されます。

     'type' はデータの型を指定する整数です。利用できる型については *note
     値の型: 5066. を参照してください。

     'value' は新たな値を指定する文字列です。

     このメソッドではまた、指定されたキーに対して、さらに別の値や型情報
     を設定することができます。 'key' 引数で指定されたキーは *note
     KEY_SET_VALUE: 5065. アクセスで開かれていなければなりません。

     キーを開くには、 *note CreateKey(): 49cc. または *note OpenKey():
     49d2. メソッドを使ってください。

     値の長さは利用可能なメモリによって制限されます。(2048 バイト以上の)
     長い値はファイルに保存して、そのファイル名を設定レジストリに保存す
     るべきです。そうすればレジストリを効率的に動作させる役に立ちます。

     引数 ‘key’, ‘sub_key’, ‘type’, ‘value’ を指定して *note
     監査イベント: 1e84. ‘winreg.SetValue’ を送出します。

 -- の関数: winreg.DisableReflectionKey (key)

     64ビット OS上で動作している 32bit プロセスに対するレジストリリフレ
     クションを無効にします。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     32bit OS上では一般的に *note NotImplementedError: 5a1. 例外を発生さ
     せます。

     key がリフレクションリストに無い場合は、この関数は成功しますが効果
     はありません。あるキーのリフレクションを無効にしても、そのキーのサ
     ブキーのリフレクションには全く影響しません。

     引数 ‘key’ を指定して *note 監査イベント: 1e84.
     ‘winreg.DisableReflectionKey’ を送出します。

 -- の関数: winreg.EnableReflectionKey (key)

     指定された、リフレクションが無効にされたキーのリフレクションを再び
     有効にします。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     32bit OS上では一般的に *note NotImplementedError: 5a1. 例外を発生さ
     せます。

     あるキーのリフレクションを再開しても、その全てのサブキーには影響し
     ません。

     引数 ‘key’ を指定して *note 監査イベント: 1e84.
     ‘winreg.EnableReflectionKey’ を送出します。

 -- の関数: winreg.QueryReflectionKey (key)

     指定されたキーのリフレクション状態を確認します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 505a. のう
     ちの一つです。

     リフレクションが無効になっている場合、‘True’ を返します。

     32bit OS上では一般的に *note NotImplementedError: 5a1. 例外を発生さ
     せます。

     引数 ‘key’ を指定して *note 監査イベント: 1e84.
     ‘winreg.QueryReflectionKey’ を送出します。

   ---------- Footnotes ----------

   (1) 
https://msdn.microsoft.com/en-us/library/ms724889%28v=VS.85%29.aspx

   (2) 
https://msdn.microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx


File: python.info,  Node: 定数<11>,  Next: レジストリハンドルオブジェクト,  Prev: 関数<14>,  Up: winreg --- Windows レジストリへのアクセス

5.34.2.2 定数
.............

The following constants are defined for use in many ‘winreg’ functions.

* Menu:

* HKEY_* 定数::
* アクセス権限::
* 値の型::


File: python.info,  Node: HKEY_* 定数,  Next: アクセス権限,  Up: 定数<11>

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: 定数<11>

5.34.2.4 アクセス権限
.....................

より詳しい情報については、 Registry Key Security and Access(1) を参照し
てください。

 -- データ: winreg.KEY_ALL_ACCESS

     STANDARD_RIGHTS_REQUIRED (*note KEY_QUERY_VALUE: 5071, *note
     KEY_SET_VALUE: 5065, *note KEY_CREATE_SUB_KEY: 5072, *note
     KEY_ENUMERATE_SUB_KEYS: 5073, *note KEY_NOTIFY: 5074, *note
     KEY_CREATE_LINK: 5075.) アクセス権限の組み合わせ。

 -- データ: winreg.KEY_WRITE

     STANDARD_RIGHTS_WRITE (*note KEY_SET_VALUE: 5065, *note
     KEY_CREATE_SUB_KEY: 5072.) アクセス権限の組み合わせ。

 -- データ: winreg.KEY_READ

     STANDARD_RIGHTS_READ (*note KEY_QUERY_VALUE: 5071, *note
     KEY_ENUMERATE_SUB_KEYS: 5073, *note KEY_NOTIFY: 5074.) アクセス権限
     の組み合わせ。

 -- データ: winreg.KEY_EXECUTE

     *note KEY_READ: 5063. と同じ。

 -- データ: 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: 定数<11>

5.34.2.6 値の型
...............

より詳しい情報については、 Registry Value Types(1) を参照してください。

 -- データ: winreg.REG_BINARY

     何らかの形式のバイナリデータ。

 -- データ: winreg.REG_DWORD

     32 ビットの数。

 -- データ: winreg.REG_DWORD_LITTLE_ENDIAN

     32 ビットのリトルエンディアン形式の数。*note REG_DWORD: 507c. と等
     価。

 -- データ: 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: 10c2. と等
     価。

     Added in version 3.6.

 -- データ: winreg.REG_RESOURCE_LIST

     デバイスドライバリソースのリスト。

 -- データ: winreg.REG_FULL_RESOURCE_DESCRIPTOR

     ハードウェアセッティング。

 -- データ: winreg.REG_RESOURCE_REQUIREMENTS_LIST

     ハードウェアリソースリスト。

 -- データ: winreg.REG_SZ

     ヌル文字で終端された文字列。

   ---------- Footnotes ----------

   (1) 
https://msdn.microsoft.com/en-us/library/ms724884%28v=VS.85%29.aspx


File: python.info,  Node: レジストリハンドルオブジェクト,  Prev: 定数<11>,  Up: winreg --- Windows レジストリへのアクセス

5.34.2.7 レジストリハンドルオブジェクト
.......................................

このオブジェクトは Windows の HKEY オブジェクトをラップし、オブジェクト
が破壊されたときに自動的にハンドルを閉じます。オブジェクトの *note
Close(): 5059. メソッドと *note CloseKey(): 5058. 関数のどちらも、後始末
がきちんと行われることを保証するために呼び出すことができます。

このモジュールのレジストリ関数は全て、これらのハンドルオブジェクトの一つ
を返します。

このモジュールのレジストリ関数でハンドルオブジェクトを受理するものは全て
整数も受理しますが、ハンドルオブジェクトを利用することを推奨します。

Handle objects provide semantics for *note __bool__(): 168f. - thus

     if handle:
         print("Yes")

は、ハンドルが現在有効な (閉じられたり切り離されたりしていない) 場合には
‘Yes’ となります。

The object also support equality comparison semantics, so handle objects
will compare equal if they both reference the same underlying Windows
handle value.  Closed handle objects (those with a handle value of zero)
always compare equal.

ハンドルオブジェクトは (例えば組み込みの *note int(): 32e. 関数を使って)
整数に変換することができます。この場合、背後の Windows ハンドル値が返さ
れます、また、 *note Detach(): 49d3. メソッドを使って整数のハンドル値を
返させると同時に、ハンドルオブジェクトから Windows ハンドルを切り離すこ
ともできます。

 -- メソッド: PyHKEY.Close ()

     背後の Windows ハンドルを閉じます。

     ハンドルがすでに閉じられていてもエラーは送出されません。

 -- メソッド: PyHKEY.Detach ()

     ハンドルオブジェクトから Windows ハンドルを切り離します。

     切り離される以前にそのハンドルを保持していた整数オブジェクトが返さ
     れます。ハンドルがすでに切り離されていたり閉じられていたりした場合
     、ゼロが返されます。

     この関数を呼び出した後、ハンドルは確実に無効化されますが、閉じられ
     るわけではありません。背後の Win32 ハンドルがハンドルオブジェクトよ
     りも長く維持される必要がある場合にはこの関数を呼び出すとよいでしょ
     う。

     Raises an *note auditing event: 1e84. ‘winreg.PyHKEY.Detach’ with
     argument ‘key’.

 -- メソッド: PyHKEY.__enter__ ()
 -- メソッド: PyHKEY.__exit__ (*exc_info)

     HKEY オブジェクトは *note __enter__(): 9cb, *note __exit__(): 16ba.
     メソッドを実装していて、 *note with: 215. 文のためのコンテキストプ
     ロトコルをサポートしています:

          with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key:
              ...  # work with key

     このコードは、 *note with: 215. ブロックから抜けるときに自動的に
     'key' を閉じます。

バージョン 3.15 で変更: Handle objects are now compared by their
underlying Windows handle value instead of object identity for equality
comparisons.


File: python.info,  Node: winsound --- Windows 用の音声再生インターフェース,  Prev: winreg --- Windows レジストリへのアクセス,  Up: MS Windows 固有のサービス

5.34.3 ‘winsound’ -- Windows 用の音声再生インターフェース
---------------------------------------------------------

'Source code:' PC/winsound.c(1)

__________________________________________________________________

The ‘winsound’ module provides access to the basic sound-playing
machinery provided by Windows platforms.  It includes functions and
several constants.

*note Availability: 234c.: Windows.

* Menu:

* 関数: 関数<15>.
* 定数: 定数<12>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/PC/winsound.c


File: python.info,  Node: 関数<15>,  Next: 定数<12>,  Up: winsound --- Windows 用の音声再生インターフェース

5.34.3.1 関数
.............

 -- の関数: winsound.Beep (frequency, duration)

     PC のスピーカを鳴らします。引数 'frequency' は鳴らす音の周波数の指
     定で、単位は Hz です。値は 37 から 32,767 でなくてはなりません。引
     数 'duration' は音を何ミリ秒鳴らすかの指定です。システムがスピーカ
     を鳴らすことができない場合、例外 *note RuntimeError: 317. が送出さ
     れます。

 -- の関数: winsound.PlaySound (sound, flags)

     プラットフォームの API から関数 ‘PlaySound()’ を呼び出します。引数
     'sound' はファイル名、システム音エイリアス、音声データの *note
     bytes-like オブジェクト: 43d.、または ‘None’ をとり得ます。 'sound'
     の解釈は 'flags' の値に依存します。この値は以下に述べる定数をビット
     単位OR して組み合わせたものになります。 'sound' 引数が ‘None’ だっ
     た場合、現在再生中のWave形式サウンドの再生を停止します。システムの
     エラーが発生した場合、例外 *note RuntimeError: 317. が送出されます
     。

 -- の関数: winsound.MessageBeep (type=MB_OK)

     根底にある ‘MessageBeep()’ 関数をプラットフォームの API から呼び出
     します。この関数は音声をレジストリの指定に従って再生します。 'type'
     引数はどの音声を再生するかを指定します; とり得る値は ‘-1’,
     ‘MB_ICONASTERISK’, ‘MB_ICONEXCLAMATION’, ‘MB_ICONHAND’,
     ‘MB_ICONQUESTION’,および ‘MB_OK’ で、全て以下に記述されています。値
     ‘-1’ は "単純なビープ音" を再生します; この値は他の場合で音声を再生
     することができなかった際の最終的な代替音です。システムがエラーを示
     したら、*note RuntimeError: 317. が送出されます。


File: python.info,  Node: 定数<12>,  Prev: 関数<15>,  Up: winsound --- Windows 用の音声再生インターフェース

5.34.3.2 定数
.............

 -- データ: winsound.SND_FILENAME

     'sound' パラメタが WAV ファイル名であることを示します。 *note
     SND_ALIAS: 508e. と同時に使ってはいけません。

 -- データ: winsound.SND_ALIAS

     引数 'sound' はレジストリにある音声データに関連付けられた名前である
     ことを示します。指定した名前がレジストリ上にない場合、定数 *note
     SND_NODEFAULT: 508f. が同時に指定されていない限り、システム標準の音
     声データが再生されます。標準の音声データが登録されていない場合、例
     外 *note RuntimeError: 317. が送出されます。 *note SND_FILENAME:
     508d. と同時に使ってはいけません。

     全ての Win32 システムは少なくとも以下の名前をサポートします; ほとん
     どのシステムでは他に多数あります:

     *note PlaySound(): 10c6.       対応するコントロールパネルでの音声名
     '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: 5091. フラグを同時に使わなくてはなりません
     。 *note SND_MEMORY: 5092. と同時に使うことはできません。

 -- データ: winsound.SND_MEMORY

     *note PlaySound(): 10c6. の引数 'sound' が *note bytes-like
     オブジェクト: 43d. の形式をとった WAV ファイルのメモリ上のイメージ
     であることを示します。

          注釈: このモジュールはメモリ上のイメージを非同期に再生する機能
          をサポートしていません。従って、このフラグと *note SND_ASYNC:
          5091. を組み合わせると例外 *note RuntimeError: 317. が送出され
          ます。

 -- データ: 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:
     508e. 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: 108e. クラスは Unix シェルに似た、単純な構文に対する字句解
析器を簡単に書けるようにします。このクラスはしばしば、 Python アプリケー
ションのための実行制御ファイルのような小規模言語を書く上で便利です。

The ‘shlex’ module defines the following functions:

 -- の関数: shlex.split (s, comments=False, posix=True)

     シェルに似た文法を使って、文字列 's' を分割します。 'comments' が
     *note False: ef9. (デフォルト値) の場合、受理した文字列内のコメント
     を解析しません (*note shlex: 108e. インスタンスの *note commenters:
     50a9. メンバの値を空文字列にします)。この関数はデフォルトでは POSIX
     モードで動作し、 'posix' 引数が偽の場合は非 POSIX モードで動作しま
     す。

     バージョン 3.12 で変更: Passing ‘None’ for 's' argument now raises
     an exception, rather than reading *note sys.stdin: 94f.

 -- の関数: shlex.join (split_command)

     Concatenate the tokens of the list 'split_command' and return a
     string.  This function is the inverse of *note split(): 94e.

          >>> 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(): 787.).

     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(): f49. 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(): 787. がそのセキュリティホールをふさぎます:

          >>> 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(): 94e. と互換です
     :

          >>> from shlex import split
          >>> remote_command = split(remote_command)
          >>> remote_command
          ['ssh', 'home', "ls -l 'somefile; rm -rf ~'"]
          >>> command = split(remote_command[-1])
          >>> command
          ['ls', '-l', 'somefile; rm -rf ~']

     Added in version 3.3.

The ‘shlex’ module defines the following class:

 -- クラス: shlex.shlex (instream=None, infile=None, posix=False,
          punctuation_chars=False)

     A *note shlex: 108e. 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(): 2279. and *note
     readline(): 22b4. 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: 50aa. 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: 50ab. attribute that appear in 'punctuation_chars' will
     be removed from ‘wordchars’.  See *note Improved Compatibility with
     Shells: 108f. 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/main/Lib/shlex.py


File: python.info,  Node: shlex オブジェクト,  Next: 解析規則,  Up: shlex --- 単純な字句解析

5.35.1.1 shlex オブジェクト
...........................

*note shlex: 108e. インスタンスは以下のメソッドを持っています:

 -- メソッド: shlex.get_token ()

     トークンを一つ返します。トークンが *note push_token(): 50af. で使っ
     てスタックに積まれていた場合、トークンをスタックからポップします。
     そうでない場合、トークンを一つ入力ストリームから読み出します。読み
     出し即時にファイル終了子に遭遇した場合、 *note eof: 50b0. (非 POSIX
     モードでは空文字列 (‘''’)、POSIX モードでは ‘None’) が返されます。

 -- メソッド: shlex.push_token (str)

     トークンスタックに引数文字列をスタックします。

 -- メソッド: shlex.read_token ()

     生 (raw) のトークンを読み出します。プッシュバックスタックを無視し、
     かつソースリクエストを解釈しません (通常これは便利なエントリポイン
     トではありません。完全性のためにここで記述されています)。

 -- メソッド: shlex.sourcehook (filename)

     *note shlex: 108e. がソースリクエスト (下の *note source: 50b3. を
     参照してください) を検出した際、このメソッドはその後に続くトークン
     を引数として渡され、ファイル名と開かれたファイル類似オブジェクトか
     らなるタプルを返すとされています。

     通常、このメソッドはまず引数から何らかのクオートを取り除きます。処
     理後の引数が絶対パス名であった場合か、以前に有効になったソースリク
     エストが存在しない場合か、以前のソースが (‘sys.stdin’ のような) ス
     トリームであった場合、この結果はそのままにされます。そうでない場合
     で、処理後の引数が相対パス名の場合、ソースインクルードスタックにあ
     る直前のファイル名からディレクトリ部分が取り出され、相対パスの前の
     部分に追加されます (この動作は C 言語プリプロセッサにおける
     ‘#include "file.h"’ の扱いと同様です)。

     これらの操作の結果はファイル名として扱われ、タプルの最初の要素とし
     て返されます。同時にこのファイル名で *note open(): 333. を呼び出し
     た結果が二つ目の要素になります (注意: インスタンス初期化のときとは
     引数の並びが逆になっています！)

     このフックはディレクトリサーチパスや、ファイル拡張子の追加、その他
     の名前空間に関するハックを実装できるようにするために公開されていま
     す。 'close' フックに対応するものはありませんが、shlex インスタンス
     はソースリクエストされている入力ストリームが EOF を返した時には
     *note close(): 711. を呼び出します。

     ソーススタックをより明示的に操作するには、 *note push_source():
     50b4. および *note pop_source(): 50b5. メソッドを使ってください。

 -- メソッド: shlex.push_source (newstream, newfile=None)

     入力ソースストリームを入力スタックにプッシュします。ファイル名引数
     が指定された場合、以後のエラーメッセージ中で利用することができます
     。 *note sourcehook(): 50b2. メソッドが内部で使用しているのと同じメ
     ソッドです。

 -- メソッド: 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: 108e. サブクラスのインスタンスは、字句解析を制御したり、デ
バッグに使えるような 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: 1fc5. 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: 50b7. is set to ‘True’,
     this will have no effect.

 -- の属性: shlex.whitespace

     空白と見なされ、読み飛ばされる文字群です。空白はトークンの境界を作
     ります。標準では、スペース、タブ、改行 (linefeed) および復帰
     (carriage-return) が入っています。

 -- の属性: shlex.escape

     エスケープ文字と見なされる文字群です。これは POSIX モードでのみ使わ
     れ、デフォルトでは ‘'\'’ だけが入っています。

 -- の属性: shlex.quotes

     文字列引用符と見なされる文字群です。トークンを構成する際、同じクオ
     ートが再び出現するまで文字をバッファに蓄積します (すなわち、異なる
     クオート形式はシェル中で互いに保護し合う関係にあります)。標準では、
     ASCII 単引用符および二重引用符が入っています。

 -- の属性: shlex.escapedquotes

     *note quotes: 50ba. のうち、 *note escape: 50b9. で定義されたエスケ
     ープ文字を解釈する文字群です。これは 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:
     108e, getting tokens in a similar way to shell arguments.  When
     used in combination with *note punctuation_chars: 1fc5, tokens will
     be split on whitespace in addition to those characters.

     バージョン 3.8 で変更: The *note punctuation_chars: 1fc5. attribute
     was made compatible with the *note whitespace_split: 50b7.
     attribute.

 -- の属性: shlex.infile

     現在の入力ファイル名です。クラスのインスタンス化時に初期設定される
     か、その後のソースリクエストでスタックされます。エラーメッセージを
     構成する際にこの値を調べると便利なことがあります。

 -- の属性: shlex.instream

     *note shlex: 108e. インスタンスが文字を読み出している入力ストリーム
     です。

 -- の属性: shlex.source

     このメンバ変数は標準で *note None: a6a. を取ります。この値に文字列
     を代入すると、その文字列は多くのシェルにおける ‘source’ キーワード
     に似た、字句解析レベルでのインクルード要求として認識されます。すな
     わち、その直後に現れるトークンをファイル名として新たなストリームを
     開き、そのストリームを入力として、EOF に到達するまで読み込まれます
     。新たなストリームの EOF に到達した時点で *note close(): 711. が呼
     び出され、入力は元の入力ストリームに戻されます。ソースリクエストは
     任意のレベルの深さまでスタックしてかまいません。

 -- の属性: shlex.debug

     このメンバ変数が数値で、かつ ‘1’ またはそれ以上の値の場合、 *note
     shlex: 108e. インスタンスは動作に関する冗長な進捗報告を出力します。
     この出力を使いたいなら、モジュールのソースコードを読めば詳細を学ぶ
     ことができます。

 -- の属性: 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: 108e. will try to obey
the following rules.

   * ワード内の引用符を認識しない (‘Do"Not"Separate’ は単一ワード
     ‘Do"Not"Separate’ として解析されます)

   * エスケープ文字を認識しない

   * 引用符で囲まれた文字列は、引用符内の全ての文字リテラルを保持する

   * 閉じ引用符でワードを区切る (‘"Do"Separate’ は、 ‘"Do"’ と
     ‘Separate’ であると解析されます)

   * *note whitespace_split: 50b7. が ‘False’ の場合、wordchar、
     whitespace または quote として宣言されていない全ての文字を、単一の
     文字トークンとして返す。 ‘True’ の場合、 *note shlex: 108e. は空白
     文字でのみ単語を区切る。

   * 空文字列 (‘''’) で EOF を送出する

   * 引用符に囲んであっても、空文字列を解析しない

When operating in POSIX mode, *note shlex: 108e. will try to obey the
following parsing rules.

   * 引用符を取り除き、引用符で単語を分解しない (‘"Do"Not"Separate"’ は
     単一ワード ‘DoNotSeparate’ として解析されます)

   * 引用符で囲まれないエスケープ文字群 (‘'\'’ など) は直後に続く文字の
     リテラル値を保持する

   * *note escapedquotes: 50bb. でない引用符文字 (‘"'"’ など) で囲まれて
     いる全ての文字のリテラル値を保持する

   * Enclosing characters in quotes which are part of *note
     escapedquotes: 50bb. (e.g.  ‘'"'’)  preserves the literal value of
     all characters within the quotes, with the exception of the
     characters mentioned in *note escape: 50b9.  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: a6a. で 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: cc. 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:
     50ab. 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: 50b7.
     when using *note punctuation_chars: 1fc5, which will negate *note
     wordchars: 50ab. entirely.

For best effect, ‘punctuation_chars’ should be set in conjunction with
‘posix=True’.  (Note that ‘posix=False’ is the default for *note shlex:
108e.)


File: python.info,  Node: posix --- 最も一般的な POSIX システムコール群,  Next: pwd --- パスワードデータベース,  Prev: shlex --- 単純な字句解析,  Up: Unix-specific services

5.35.2 ‘posix’ -- 最も一般的な POSIX システムコール群
-----------------------------------------------------

__________________________________________________________________

このモジュールはオペレーティングシステムの機能のうち、C 言語標準および
(Unix インターフェースをほんの少し隠蔽した) POSIX 標準で標準化されている
機能に対するアクセス機構を提供します。

*note Availability: 234c.: 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(): 4ee. when an entry in
‘os.environ’ is changed.

エラーは例外として報告されます; よくある例外は型エラーです。一方、システ
ムコールから報告されたエラーは以下に述べるように *note OSError: 543. を
送出します。

* 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(): 3254. 、 *note popen(): 58c.
     、 *note system(): 1815. で渡された環境変数文字列には影響は与えませ
     ん; 環境変数を変更したい場合は、 ‘environ’ を *note execve(): 14ba.
     に渡すか、変数への代入文と 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: 4ec.
          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: 234c.: 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: 7e5. が発生します。

     注釈: 伝統的なUnixでは、 ‘pw_passwd’ フィールドはDES由来のアルゴリ
     ズムで暗号化されたパスワードが含まれています。しかし、近代的な
     UNIX系OSでは 'シャドウパスワード' とよばれる仕組みを利用しています
     。この場合には 'pw_passwd' フィールドにはアスタリスク(‘'*'’)か、
     ‘'x'’ という一文字だけが含まれており、暗号化されたパスワードは、一
     般には見えない ‘/etc/shadow’ というファイルに入っています。
     'pw_passwd' フィールドに有用な値が入っているかはシステムに依存しま
     す。

このモジュールでは以下の内容を定義しています:

 -- の関数: pwd.getpwuid (uid)

     与えられたUIDに対応するパスワードデータベースのエントリを返します。

 -- の関数: pwd.getpwnam (name)

     与えられたユーザ名に対応するパスワードデータベースのエントリを返し
     ます。

 -- の関数: pwd.getpwall ()

     パスワードデータベースの全てのエントリを、任意の順番で並べたリスト
     を返します。

参考
....

*note grp: 69. モジュール

     このモジュールに似た、グループデータベースへのアクセスを提供するモ
     ジュール。


File: python.info,  Node: grp --- グループデータベース,  Next: termios --- POSIX スタイルの端末制御,  Prev: pwd --- パスワードデータベース,  Up: Unix-specific services

5.35.4 ‘grp’ -- グループデータベース
------------------------------------

__________________________________________________________________

このモジュールでは Unix グループ (group) データベースへのアクセス機構を
提供します。全ての Unix バージョンで利用可能です。

*note Availability: 234c.: 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(): 39a1. や *note getgrgid():
10e4. でアクセスできないかもしれないことにも注意してください。)

このモジュールでは以下の内容を定義しています:

 -- の関数: grp.getgrgid (id)

     与えられたグループ ID に対するグループデータベースエントリを返しま
     す。要求したエントリが見つからなかった場合、 *note KeyError: 7e5. が
     送出されます。

     バージョン 3.10 で変更: 浮動小数点数や文字列のような、整数でない引
     数には *note TypeError: 29c. が送出されます。

 -- の関数: grp.getgrnam (name)

     与えられたグループ名に対するグループデータベースエントリを返します
     。要求したエントリが見つからなかった場合、 *note KeyError: 7e5. が
     送出されます。

 -- の関数: grp.getgrall ()

     全ての入手可能なグループエントリを返します。順番は決まっていません
     。

参考
....

*note pwd: ba. モジュール

     このモジュールと類似の、ユーザデータベースへのインターフェース。


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: 234c.: Unix.

このモジュールの関数は全て、ファイル記述子 'fd' を最初の引数としてとりま
す。この値は、 ‘sys.stdin.fileno()’ が返すような整数のファイル記述子でも
、 ‘sys.stdin’ 自体のような *note file object: 1581. でもかまいません。

このモジュールではまた、モジュールで提供されている関数を使う上で必要とな
る全ての定数を定義しています; これらの定数は 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(): 1c1b.  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(): 50dc.  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: 109. モジュール

     一般的な端末制御操作のための便利な関数。

* Menu:

* 使用例: 使用例<51>.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/termios(3)


File: python.info,  Node: 使用例<51>,  Up: termios --- POSIX スタイルの端末制御

5.35.5.1 使用例
...............

以下はエコーバックを切った状態でパスワード入力を促す関数です。ユーザの入
力に関わらず以前の端末属性を正確に回復するために、二つの *note
tcgetattr(): 1c1b. と *note try: adb. ...  *note finally: 453. 文による
テクニックが使われています:

     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: 234c.: Unix.

このモジュールは *note termios: ea. モジュールを必要とするため、 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(): 1c1b, 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(): 1c1b, 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(): 1c1c. 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: 50d7, and is
     passed to *note termios.tcsetattr(): 1c8e.  The return value of
     *note termios.tcgetattr(): 1c1b. 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: 50d7, and is
     passed to *note termios.tcsetattr(): 1c8e.  The return value of
     *note termios.tcgetattr(): 1c1b. 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: ea.

     低水準端末制御インターフェース。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 234c.: 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' として子プロセスの制御端末 (子プロセスの標準入出力に接続されて
     いる)のファイル記述子を受けとります。

     The returned file descriptor 'fd' is *note non-inheritable: 12ad.

          警告: On macOS the use of this function is unsafe when mixed
          with using higher-level system APIs, and that includes using
          *note urllib.request: 114.

     バージョン 3.15 で変更: The returned file descriptor is now made
     non-inheritable.

 -- の関数: pty.openpty ()

     新しい擬似端末のペアを開きます。利用できるなら *note os.openpty():
     3295. を使い、利用できなければ一般的な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(): 1157. on the
     child process.

     *note os.waitstatus_to_exitcode(): cee. can be used to convert the
     exit status into an exit code.

     引数 ‘argv’ を指定して *note 監査イベント: 1e84. ‘pty.spawn’ を送出
     します。

     バージョン 3.4 で変更: *note spawn(): 1331. が *note os.waitpid():
     1157. が返す子プロセスのステータス値を返すようになりました。

* Menu:

* 使用例: 使用例<52>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 234c.: Unix, not WASI.

このモジュール内の全ての関数はファイル記述子 'fd' を最初の引数に取ります
。 この値は ‘sys.stdin.fileno()’ が返すような整数のファイル記述子でも、
‘sys.stdin’ 自体のような、純粋にファイル記述子だけを返す *note fileno():
19d2. メソッドを提供している *note io.IOBase: 710. オブジェクトでもかま
いません。

バージョン 3.3 で変更: 以前は *note IOError: 1409. を送出していたこのモ
ジュールの操作が、 *note OSError: 543. を送出するようになりました。

バージョン 3.8 で変更: The ‘fcntl’ module now contains ‘F_ADD_SEALS’,
‘F_GET_SEALS’, and ‘F_SEAL_*’ constants for sealing of *note
os.memfd_create(): dd1. 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(): 19d2. 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: 43d, 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(): 1630.  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: 1d2. object.
     The length of the returned object will be the same as the length of
     the 'arg' argument.

     If the ‘fcntl()’ call fails, an *note OSError: 543. 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
          the size of 'arg'), this is most likely to result in a
          segmentation violation or a more subtle data corruption.

     引数 ‘fd’, ‘cmd’, ‘arg’ を指定して *note 監査イベント: 1e84.
     ‘fcntl.fcntl’ を送出します。

     バージョン 3.14 で変更: Add support of arbitrary *note bytes-like
     objects: 43d, not only *note bytes: 1d2.

     バージョン 3.15 で変更: The size of bytes-like objects is no longer
     limited to 1024 bytes.

 -- の関数: fcntl.ioctl (fd, request, arg=0, mutate_flag=True, /)

     この関数は *note fcntl(): 1983. 関数と同じですが、引数の扱いがより
     複雑であるところが異なります。

     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: ea. 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:
     43d, 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(): 1983.
     function.

     If 'arg' supports the read-write buffer interface (like *note
     bytearray: 1d1.) 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: 543. 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
          the size of 'arg'), 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 監査イベント: 1e84.
     ‘fcntl.ioctl’ を送出します。

     バージョン 3.14 で変更: The GIL is always released during a system
     call.  System calls failing with EINTR are automatically retried.

     バージョン 3.15 で変更: The size of not mutated bytes-like objects
     is no longer limited to 1024 bytes.

 -- の関数: fcntl.flock (fd, operation, /)

     ファイル記述子 'fd' (*note fileno(): 19d2. メソッドを提供しているフ
     ァイルオブジェクトも含む) に対してロック操作 'operation' を実行しま
     す。 詳細は Unix マニュアルの ‘flock(2)(3)’ を参照してください (シ
     ステムによっては、この関数は ‘fcntl()’ を使ってエミュレーションされ
     ています)。

     If the ‘flock()’ call fails, an *note OSError: 543. exception is
     raised.

     引数 ‘fd’, ‘operation’ を指定して *note 監査イベント: 1e84.
     ‘fcntl.flock’ を送出します。

 -- の関数: fcntl.lockf (fd, cmd, len=0, start=0, whence=0, /)

     本質的に *note fcntl(): 1983. によるロッキングの呼び出しをラップし
     たものです。 'fd' はロックまたはアンロックするファイルのファイル記
     述子 (*note fileno(): 19d2. メソッドを提供するファイルオブジェクト
     も受け付けられます) で、 '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: 543. will be raised and the exception will have an 'errno'
     attribute set to *note EACCES: 2920. or *note EAGAIN: 2911.
     (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(): 1646. と同じで、具体的には:

        * ‘0’ - relative to the start of the file (*note os.SEEK_SET:
          1647.)

        * ‘1’ - relative to the current buffer position (*note
          os.SEEK_CUR: 1648.)

        * ‘2’ - relative to the end of the file (*note os.SEEK_END:
          1649.)

     'start' の標準の値は 0 で、ファイルの先頭から開始することを意味しま
     す。'len' の標準の値は 0 で、ファイルの終了までロックすることを表し
     ます。'whence' の標準の値も 0 です。

     引数 ‘fd’, ‘cmd’, ‘len’, ‘start’, ‘whence’ を指定して *note
     監査イベント: 1e84. ‘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: 1d2. オブジェクトを保持しています。 'lockdata' 変数の構造体レイア
ウトはシステム依存です -- 従って *note flock(): 49c3. を呼ぶ方が良いでし
ょう。

参考
....

*note os: a5. モジュール

     If the locking flags *note O_SHLOCK: 17e7. and *note O_EXLOCK:
     17e8. are present in the *note os: a5. module (on BSD only), the
     *note os.open(): 114f. function provides an alternative to the
     *note lockf(): 17a5. and *note flock(): 49c3. 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: 234c.: Unix, not WASI.

特定のシステムリソースを指定したり、現在のプロセスやその子プロセスのリソ
ース使用情報を要求するためにシンボル定数が使われます。

システムコールが失敗した場合 *note OSError: 543. を送出します。

 -- 例外: resource.error

     *note OSError: 543. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 543. のエイリアスになりました。

* Menu:

* リソースの制限::
* リソースの使用状態::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/


File: python.info,  Node: リソースの制限,  Next: リソースの使用状態,  Up: resource --- リソース使用情報

5.35.9.1 リソースの制限
.......................

リソースの使用は下に述べる *note setrlimit(): 3ee. 関数を使って制限する
ことができます。各リソースは二つ組の制限値: ソフトリミット (soft limit)
、およびハードリミット (hard limit) 、で制御されます。ソフトリミットは現
在の制限値で、時間とともにプロセスによって下げたり上げたりできます。ソフ
トリミットはハードリミットを超えることはできません。ハードリミットはソフ
トリミットよりも高い任意の値まで下げることができますが、上げることはでき
ません。 (スーパユーザの有効な UID を持つプロセスのみがハードリミットを
上げることができます。)

制限をかけるべく指定できるリソースはシステムに依存します。指定できるリソ
ースは ‘getrlimit(2)(1)’ マニュアルページで解説されています。以下に列挙
するリソースは背後のオペレーティングシステムがサポートする場合にサポート
されています; オペレーティングシステム側で値を調べたり制御したりできない
リソースは、そのプラットフォーム向けのこのモジュール内では定義されていま
せん。

 -- データ: resource.RLIM_INFINITY

     無制限のリソースの上限を示すための定数です。

     バージョン 3.15 で変更: It is now always positive.  Previously, it
     could be negative, such as -1 or -3.

 -- データ: resource.RLIM_SAVED_CUR

 -- データ: resource.RLIM_SAVED_MAX

     Constants used to represent the soft and hard limit values if they
     cannot be represented in the ‘rlim_t’ value in C. Can be equal to
     *note RLIM_INFINITY: 3ed.

     Added in version 3.15.

 -- の関数: resource.getrlimit (resource)

     'resource' の現在のソフトおよびハードリミットを表すタプル ‘(soft,
     hard)’ を返します。無効なリソースが指定された場合には *note
     ValueError: 15a. が、背後のシステムコールが予期せず失敗した場合には
     *note error: 50f0. が送出されます。

 -- の関数: 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: 3ed. can be used
     to request a limit that is unlimited.

     Raises *note ValueError: 15a. 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: 3ed. 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: 50f0. を送出する場合があります。

     VxWorks only supports setting *note RLIMIT_NOFILE: 50f2.

     引数 ‘src’, ‘dst`, ``limits’ を指定して *note 監査イベント: 1e84.
     ‘resource.setrlimit’ を送出します。

 -- の関数: resource.prlimit (pid, resource[, limits])

     1つの関数の中で *note setrlimit(): 3ee. と *note getrlimit(): 1a25.
     を組み合わせ、任意のプロセスのリソースの制限値を取得したり設定した
     りします。 'pid' が 0 の場合は、現在のプロセスに適用されます。
     'resource' および 'limits' は、 'limits' がオプションであることを除
     けば、 ‘setrlimit()’ と同じ意味です。

     'limits' が与えられないときは、関数はプロセス 'pid' の 'resource' の
     制限値を返します。 'limits' が与えられたときは、プロセスの
     'resource' の制限値が設定され、設定が変更される前のリソースの制限値
     が返されます。

     'pid' が見付からないときは *note ProcessLookupError: 1411. を、ユー
     ザがプロセスの ‘CAP_SYS_RESOURCE’ を持ってないときは *note
     PermissionError: 10fd. を送出します。

     引数 ‘pid’, ‘dst`, ``limits’ を指定して *note 監査イベント: 1e84.
     ‘resource.prlimit’ を送出します。

     *note Availability: 234c.: Linux >= 2.6.36 with glibc >= 2.13.

     Added in version 3.4.

以下のシンボルは、後に述べる関数 *note setrlimit(): 3ee. および *note
getrlimit(): 1a25. を使って消費量を制御することができるリソースを定義し
ています。これらのシンボルの値は、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: 3ccd. signal
     is sent to the process.  (See the *note signal: ce. 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: 50f2. の 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: 50fc.

     *note Availability: 234c.: Solaris, FreeBSD, NetBSD.

 -- データ: resource.RLIMIT_AS

     アドレス空間でプロセスが占有できる最大領域 (バイト単位) です。

 -- データ: resource.RLIMIT_MSGQUEUE

     POSIX メッセージキューに割り当てることの出来るバイト数です。

     *note Availability: 234c.: Linux >= 2.6.8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_NICE

     プロセスの nice の上限です (20 - rlim_cur)。

     *note Availability: 234c.: Linux >= 2.6.12.

     Added in version 3.4.

 -- データ: resource.RLIMIT_RTPRIO

     リアルタイム優先順位の上限です。

     *note Availability: 234c.: Linux >= 2.6.12.

     Added in version 3.4.

 -- データ: resource.RLIMIT_RTTIME

     リアルタイムスケジューリングにおいて、プロセスがブロッキングシステ
     ムコールを行わずに使用できるCPU時間の制限値（マイクロ秒単位）。

     *note Availability: 234c.: Linux >= 2.6.25.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SIGPENDING

     プロセスがキュー出来るシグナルの数です。

     *note Availability: 234c.: Linux >= 2.6.8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SBSIZE

     このユーザが使用するソケットバッファの最大サイズ(バイト単位)。これ
     は、このユーザが常に保持できるネットワークメモリの量、つまり mbuf の
     量を制限します。

     *note Availability: 234c.: FreeBSD, NetBSD.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SWAP

     このユーザ ID のすべてのプロセスで予約または使用できるスワップスペ
     ースの最大サイズ (バイト単位)。この制限は vm.overcommit sysctl のビ
     ット 1 が設定されている場合のみ適用されます。この sysctl の完全な説
     明については tuning(7)(3) を参照してください。

     *note Availability: 234c.: FreeBSD >= 8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_NPTS

     このユーザ ID が作成する擬似端末の数の上限です。

     *note Availability: 234c.: FreeBSD >= 8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_KQUEUES

     The maximum number of kqueues this user id is allowed to create.

     *note Availability: 234c.: FreeBSD >= 11.

     Added in version 3.10.

 -- データ: resource.RLIMIT_NTHR

     The maximum number of threads for this user id, not counting the
     main and kernel threads.

     *note Availability: 234c.: NetBSD >= 7.0.

     Added in version 3.15.

 -- データ: resource.RLIMIT_PIPEBUF

     The maximum total size of in-kernel buffers for bi-directional
     pipes/fifos that this user id is allowed to consume.

     *note Availability: 234c.: FreeBSD >= 14.2.

     Added in version 3.15.

 -- データ: resource.RLIMIT_THREADS

     The maximum number of threads each process can create.

     *note Availability: 234c.: AIX.

     Added in version 3.15.

 -- データ: resource.RLIMIT_UMTXP

     The limit of the number of process-shared Posix thread library
     objects allocated by user id.

     *note Availability: 234c.: FreeBSD >= 11.

     Added in version 3.15.

   ---------- 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:
     15a. を送出します。また、異常が発生した場合には *note error: 50f0.
     例外が送出される可能性があります。

 -- の関数: resource.getpagesize ()

     システムページ内のバイト数を返します。(ハードウェアページサイズと同
     じとは限りません。)

The following ‘RUSAGE_*’ symbols are passed to the *note getrusage():
17e9. function to specify which processes information should be provided
for.

 -- データ: resource.RUSAGE_SELF

     *note getrusage(): 17e9. に渡すと呼び出し中のプロセスが消費している
     リソースを要求します。そのプロセスの全スレッドが使用するリソースの
     合計です。

 -- データ: resource.RUSAGE_CHILDREN

     呼び出し元のプロセスの子プロセスが消費するリソースを要求するために
     、 *note getrusage(): 17e9. に渡して終了させ、待機させることができ
     ます。

 -- データ: resource.RUSAGE_BOTH

     *note getrusage(): 17e9. に渡すと現在のプロセスおよび子プロセスの両
     方が消費しているリソースを要求します。全てのシステムで利用可能なわ
     けではありません。

 -- データ: resource.RUSAGE_THREAD

     *note getrusage(): 17e9. に渡すと現在のスレッドが消費しているリソー
     スを要求します。全てのシステムで利用可能なわけではありません。

     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: 234c.: Unix, not WASI, not iOS.

このモジュールはシステムの ‘syslog’ ファミリのルーチンをラップしています
。 syslog サーバーと通信できる pure Python のライブラリが、 *note
logging.handlers: 8c. モジュールの *note SysLogHandler: a51. にあります
。

このモジュールには、以下の関数が定義されています:

 -- の関数: syslog.syslog (message)

 -- の関数: syslog.syslog (priority, message)

     文字列 'message' をシステムログ機構に送信します。末尾の改行文字は必
     要に応じて追加されます。各メッセージは 'facility' および 'level' か
     らなる優先度でタグ付けされます。オプションの 'priority' 引数はメッ
     セージの優先度を定義します。標準の値は *note LOG_INFO: 5106. です。
     'priority' 中に、便宜レベルが (‘LOG_INFO | LOG_USER’ のように) 論理
     和を使ってコード化されていない場合、 *note openlog(): 950. を呼び出
     した際の値が使われます。

     *note syslog(): e5. が呼び出される前に *note openlog(): 950. が呼び
     出されなかった場合、 ‘openlog()’ が引数なしで呼び出されます。

     引数 ‘priority’, ‘message’ を指定して *note 監査イベント: 1e84.
     ‘syslog.syslog’ を送出します。

     バージョン 3.2 で変更: In previous versions, *note openlog(): 950.
     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(): 950. must be called in the main interpreter before
     ‘syslog()’ may be used in a subinterpreter.  Otherwise it will
     raise *note RuntimeError: 317.

 -- の関数: syslog.openlog ([ident[, logoption[, facility]]])

     *note openlog(): 950. 関数を呼び出すことで以降の *note syslog():
     e5. の呼び出しに対するログオプションを設定することができます。ログ
     がまだ開かれていない状態で ‘syslog()’ を呼び出すと ‘openlog()’ が引
     数なしで呼び出されます。

     オプションの 'ident' キーワード引数は全てのメッセージの先頭に付く文
     字列で、デフォルトでは ‘sys.argv[0]’ から前方のパス部分を取り除いた
     ものです。オプションの 'logoption' キーワード引数 (デフォルトは 0)
     はビットフィールドです。組み合わせられる値については下記を参照して
     ください。オプションの 'facility' キーワード引数 (デフォルトは
     *note LOG_USER: 5107.) は明示的に facility が encode されていないメ
     ッセージに設定される facility です。

     引数 ‘ident’, ‘logoptiona'’, ‘facility’ を指定して *note
     監査イベント: 1e84. ‘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: 317. if called in a subinterpreter.

 -- の関数: syslog.closelog ()

     syslog モジュールの値をリセットし、システムライブラリの
     ‘closelog()’ を呼び出します。

     この関数を呼ぶと、モジュールが最初に import されたときと同じように
     ふるまいます。例えば、(*note openlog(): 950. を呼び出さないで)
     *note syslog(): e5. を最初に呼び出したときに、 ‘openlog()’ が呼び出
     され、 'ident' やその他の ‘openlog()’ の引数はデフォルト値にリセッ
     トされます。

     引数無しで *note 監査イベント: 1e84. ‘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: 317. if called in a subinterpreter.

 -- の関数: syslog.setlogmask (maskpri)

     優先度マスクを 'maskpri' に設定し、以前のマスク値を返します。
     'maskpri' に設定されていない優先度レベルを持った *note syslog():
     e5. の呼び出しは無視されます。標準では全ての優先度をログ出力します
     。関数 ‘LOG_MASK(pri)’ は個々の優先度 'pri' に対する優先度マスクを
     計算します。関数 ‘LOG_UPTO(pri)’ は優先度 'pri' までの全ての優先度
     を含むようなマスクを計算します。

     引数 ‘maskpri’ を指定して *note 監査イベント: 1e84.
     ‘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: 5110, *note LOG_FTP: 5113, *note LOG_NETINFO: 5119,
     *note LOG_REMOTEAUTH: 511c, *note LOG_INSTALL: 5114. and *note
     LOG_RAS: 511b.

     バージョン 3.13 で変更: Added *note LOG_FTP: 5113, *note
     LOG_NETINFO: 5119, *note LOG_REMOTEAUTH: 511c, *note LOG_INSTALL:
     5114, *note LOG_RAS: 511b, and *note LOG_LAUNCHD: 5116.

 -- データ: 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: 512a, *note LOG_NOWAIT: 512b. and *note LOG_PERROR:
     512c.

* 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: 1ed.

   * *note asyncio: 3a1c.

   * *note base64: f.

   * *note calendar: 20c.

   * *note code: 1b.

   * *note compileall: 4f97.

   * ‘cProfile’: see *note profiling.tracing: 4a73.

   * *note dis: 4fae.

   * *note doctest: 47bf.

   * ‘encodings.rot_13’

   * *note ensurepip: 4b98.

   * *note filecmp: 5d.

   * *note fileinput: 5e.

   * *note ftplib: 61.

   * *note gzip: 3096.

   * *note http.server: 232.

   * *note idlelib: 4666.

   * *note inspect: 130a.

   * *note json: 4d2.

   * *note mimetypes: 4da.

   * *note pdb: 564.

   * *note pickle: 2f68.

   * *note pickletools: 2f69.

   * *note platform: 34b1.

   * *note poplib: b1.

   * *note profiling.sampling: 4a71.

   * *note profiling.tracing: 4a73.

   * *note pstats: 4b0c.

   * *note py_compile: 4f8e.

   * *note pyclbr: bc.

   * *note pydoc: bd.

   * *note quopri: bf.

   * *note random: 694.

   * *note runpy: c6.

   * *note site: 4da1.

   * *note sqlite3: 263.

   * *note symtable: 4f12.

   * *note sysconfig: 4c64.

   * *note tabnanny: e6.

   * *note tarfile: 1379.

   * ‘this’

   * *note timeit: 4b10.

   * *note tokenize: 291.

   * *note trace: 4b2f.

   * *note turtledemo: 10b.

   * *note unittest: 12e4.

   * *note uuid: 868.

   * *note venv: 4ba6.

   * *note webbrowser: 411f.

   * *note zipapp: 4bc0.

   * *note zipfile: 3105.

*note Python コマンドラインインターフェース: 1fb7. も参照してください。


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:
64. 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: 1b2. 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
* profile: profile --- Pure Python profiler. Pure Python profiler

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/


File: python.info,  Node: getopt --- C-style parser for command line options,  Next: profile --- Pure Python profiler,  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: 35df. 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: 1b29. 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(): 64. と同じように動作します。つまり、オプションとオ
     プションでない引数とを混在させることができます。‘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: 1b29. へのエイリアスです。後方互換性のために残さ
     れています。

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: 35df. 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/main/Lib/getopt.py


File: python.info,  Node: profile --- Pure Python profiler,  Prev: getopt --- C-style parser for command line options,  Up: Superseded modules

5.37.2 ‘profile’ -- Pure Python profiler
----------------------------------------

'Source code:' Lib/profile.py(1)

__________________________________________________________________

バージョン 3.15 で非推奨、バージョン 3.17 で削除予定.

The ‘profile’ module is deprecated and will be removed in Python 3.17.
Use *note profiling.tracing: b7. instead.

The ‘profile’ module provides a pure Python implementation of a
deterministic profiler.  While useful for understanding profiler
internals or extending profiler behavior through subclassing, its pure
Python implementation introduces significant overhead compared to the
C-based *note profiling.tracing: b7. module.

For most profiling tasks, use:

   - *note profiling.sampling: b6. for production debugging with zero
     overhead

   - *note profiling.tracing: b7. for development and testing

* Menu:

* Migration::
* profile and profiling.tracing module reference: profile and profiling tracing module reference.
* Differences from profiling.tracing: Differences from profiling tracing.
* What is deterministic profiling?: What is deterministic profiling?<2>.
* 制限事項: 制限事項<2>.
* キャリブレーション (補正): キャリブレーション 補正.
* カスタムな時刻取得用関数を使う::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Lib/profile.py


File: python.info,  Node: Migration,  Next: profile and profiling tracing module reference,  Up: profile --- Pure Python profiler

5.37.2.1 Migration
..................

Migrating from ‘profile’ to *note profiling.tracing: b7. is
straightforward.  The APIs are compatible:

     # Old (deprecated)
     import profile
     profile.run('my_function()')

     # New (recommended)
     import profiling.tracing
     profiling.tracing.run('my_function()')

For most code, replacing ‘import profile’ with ‘import
profiling.tracing’ (and using ‘profiling.tracing’ instead of ‘profile’
throughout) provides a straightforward migration path.

     注釈: The ‘cProfile’ module remains available as a
     backward-compatible alias to *note profiling.tracing: b7.  Existing
     code using ‘import cProfile’ will continue to work without
     modification.


File: python.info,  Node: profile and profiling tracing module reference,  Next: Differences from profiling tracing,  Prev: Migration,  Up: profile --- Pure Python profiler

5.37.2.2 ‘profile’ and ‘profiling.tracing’ module reference
...........................................................

Both the ‘profile’ and *note profiling.tracing: b7. modules provide the
following functions:

 -- の関数: profile.run (command, filename=None, sort=-1)

     この関数は *note exec(): 190. 関数に渡せる一つの引数と、オプション
     引数としてファイル名を指定できます。全ての場合でこのルーチンは以下
     を実行します:

          exec(command, __main__.__dict__, __main__.__dict__)

     そして実行結果からプロファイル情報を収集します。 ファイル名が指定さ
     れていない場合は、 *note Stats: 4a7d. のインスタンスが自動的に作ら
     れ、簡単なプロファイルレポートが表示されます。 'sort' が指定されて
     いる場合は、 ‘Stats’ インスタンスに渡され、結果をどのように並び替え
     るかを制御します。

 -- の関数: profile.runctx (command, globals, locals, filename=None,
          sort=-1)

     This function is similar to *note run(): 513f, with added arguments
     to supply the globals and locals mappings for the 'command' string.
     This routine executes:

          exec(command, globals, locals)

     そしてプロファイル統計情報を *note run(): 513f. 同様に収集します。

 -- クラス: 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 *note profiling.tracing.run():
     4a7c. function provides.

     'timer' 引数に、コードの実行時間を計測するためのカスタムな時刻取得
     用関数を渡せます。これは現在時刻を表す単一の数値を返す関数でなけれ
     ばなりません。もしこれが整数を返す関数ならば、 'timeunit' には単位
     時間当たりの実際の持続時間を指定します。たとえば関数が 1000 分の 1
     秒単位で計測した時間を返すとすると、 'timeunit' は ‘.001’ でしょう
     。

     *note Profile: dab. クラスを直接使うと、プロファイルデータをファイ
     ルに書き出すことなしに結果をフォーマット出来ます:

          import profiling.tracing
          import pstats
          import io
          from pstats import SortKey

          pr = profiling.tracing.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 *note profiling.tracing: b7, not in the
     deprecated ‘profile’ module; see *note コンテキストマネージャ型:
     2620.):

          import profiling.tracing

          with profiling.tracing.Profile() as pr:
              # ... do something ...

              pr.print_stats()

     バージョン 3.8 で変更: コンテキストマネージャーサポートが追加されま
     した。

      -- メソッド: enable ()

          Start collecting profiling data.  Only in *note
          profiling.tracing: b7.

      -- メソッド: disable ()

          Stop collecting profiling data.  Only in *note
          profiling.tracing: b7.

      -- メソッド: create_stats ()

          プロファイリングデータの収集を停止し、現在のプロファイルとして
          結果を内部で記録します。

      -- メソッド: print_stats (sort=-1)

          現在のプロファイルに基づいて *note Stats: 4a7d. オブジェクトを
          作成し、結果を標準出力に出力します。

          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
          pstats.Stats.sort_stats(): 4a76.

          Added in version 3.13: ‘print_stats()’ now accepts a tuple of
          keys.

      -- メソッド: dump_stats (filename)

          現在のプロファイルの結果を 'filename' に書き出します。

      -- メソッド: run (cmd)

          *note exec(): 190. を用いて cmd をプロファイルします。

      -- メソッド: runctx (cmd, globals, locals)

          *note exec(): 190. を用いて指定されたグローバルおよびローカル
          な環境で 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(): 506. call during the called command/function execution) no
profiling results will be printed.


File: python.info,  Node: Differences from profiling tracing,  Next: What is deterministic profiling?<2>,  Prev: profile and profiling tracing module reference,  Up: profile --- Pure Python profiler

5.37.2.3 Differences from ‘profiling.tracing’
.............................................

The ‘profile’ module differs from *note profiling.tracing: b7. in
several ways:

'Higher overhead.'  The pure Python implementation is significantly
slower than the C implementation, making it unsuitable for profiling
long-running programs or performance-sensitive code.

'Calibration support.'  The ‘profile’ module supports calibration to
compensate for profiling overhead.  This is not needed in *note
profiling.tracing: b7. because the C implementation has negligible
overhead.

'Custom timers.'  Both modules support custom timers, but ‘profile’
accepts timer functions that return tuples (like *note os.times():
14d6.), while *note profiling.tracing: b7. requires a function returning
a single number.

'Subclassing.'  The pure Python implementation is easier to subclass and
extend for custom profiling behavior.


File: python.info,  Node: What is deterministic profiling?<2>,  Next: 制限事項<2>,  Prev: Differences from profiling tracing,  Up: profile --- Pure Python profiler

5.37.2.4 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 provided by the *note
profiling.sampling: b6. module) periodically 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?<2>,  Up: profile --- Pure Python profiler

5.37.2.5 制限事項
.................

一つの制限はタイミング情報の正確さに関するものです。決定論的プロファイラ
には正確さに関する根本的問題があります。最も明白な制限は、 (一般に) "ク
ロック"は .001 秒の精度しかないということです。これ以上の精度で計測する
ことはできません。仮に充分な精度が得られたとしても、"誤差"が計測の平均値
に影響を及ぼすことがあります。この最初の誤差を取り除いたとしても、それが
また別の誤差を引き起こす原因となります。

もう一つの問題として、イベントを検知してからプロファイラがその時刻を実際
に '取得' するまでに "いくらかの時間がかかる" ことです。同様に、イベント
ハンドラが終了する時にも、時刻を取得して (そしてその値を保存して) から、
ユーザコードが処理を再開するまでの間に遅延が発生します。結果的に多く呼び
出される関数または多数の関数から呼び出される関数の情報にはこの種の誤差が
蓄積する傾向にあります。このようにして蓄積される誤差は、典型的にはクロッ
クの精度を下回ります (1クロック以下) が、一方でこの時間が累計して非常に
大きな値になることも 'あり得ます' 。

The problem is more important with the deprecated ‘profile’ module than
with the lower-overhead *note profiling.tracing: b7.  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: profile --- Pure Python profiler

5.37.2.6 キャリブレーション (補正)
..................................

The profiler of the ‘profile’ 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 制限事項: 514c.).

     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: profile --- Pure Python profiler

5.37.2.7 カスタムな時刻取得用関数を使う
.......................................

プロファイラが時刻を取得する方法を変更したいなら (たとえば、実測時間やプ
ロセスの経過時間を使いたい場合)、時刻取得用の関数を *note Profile: dab.
クラスのコンストラクタに指定することができます:

     pr = profile.Profile(your_time_func)

The resulting profiler will then call ‘your_time_func’.  Depending on
whether you are using *note profile.Profile: dab. or *note
profiling.tracing.Profile: 4a7f, ‘your_time_func’'s return value will be
interpreted differently:

*note profile.Profile: dab.

     ‘your_time_func()’ は単一の数値、あるいは (*note os.times(): 14d6.
     と同じように) その合計が累計時間を示すリストを返すようになっていな
     ければなりません。関数が1つの数値、あるいは長さ2の数値のリストを返
     すようになっていれば、ディスパッチルーチンには特別な高速化バージョ
     ンが使われます。

     Be warned that you should calibrate the profiler class for the
     timer function that you choose (see *note キャリブレーション
     (補正): 514e.).  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(): 14d6. 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.

*note profiling.tracing.Profile: 4a7f.

     ‘your_time_func()’ は単一の数値を返すようになっていなければなりませ
     ん。単一の整数を返すのであれば、クラスコンストラクタの第二引数に単
     位時間当たりの実際の持続時間を渡せます。例えば
     ‘your_integer_time_func’ が 1000 分の 1 秒単位で計測した時間を返す
     とすると、 *note Profile: dab. インスタンスを以下のように構築出来ま
     す:

          pr = profiling.tracing.Profile(your_integer_time_func, 0.001)

     As the *note profiling.tracing.Profile: 4a7f. 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: f7. に、プロセス時間や実時間の精密な計測に使え
る新しい関数が追加されました。 例えば、 *note time.perf_counter(): e4d.
を参照してください。

参考
....

*note profiling: b5.

     Overview of Python profiling tools.

*note profiling.tracing: b7.

     Recommended replacement for this module.

*note pstats: b8.

     Statistical analysis and formatting for profile data.


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 で削除:
689. されました。削除の決定は 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: 916. 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: 916. 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は PEP 594(1) でなされました。

Applications can use the *note hashlib: 6b. 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: 91c. 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 で削除:
689. されました。削除の決定は 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: 926. after being deprecated in Python 3.4.

The *note removal notice: 926. includes guidance for migrating code from
‘imp’ to *note importlib: 7a.

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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は PEP 594(1) でなされました。

Applications should use the *note subprocess: df. 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: 916. 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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 で削除:
689. されました。削除の決定は 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: 3f0c. in
     RFC 4648(1)

   * *note hashlib: 6b.: *note all constructors take a "usedforsecurity"
     keyword-only argument disabling known insecure and blocked
     algorithms: 3203.

   * *note http.server: 75. is not suitable for production use, only
     implementing basic security checks.  See the *note security
     considerations: 4345.

   * *note logging: 8a.: *note Logging configuration uses eval(): 341b.

   * *note multiprocessing: 98.: *note Connection.recv() uses pickle:
     38e5.

   * *note pickle: ab.: *note Restricting globals in pickle: 2f54.

   * *note random: c0. shouldn't be used for security purposes, use
     *note secrets: c8. instead

   * *note shelve: cb.: *note shelve is based on pickle and thus
     unsuitable for dealing with untrusted sources: 2f77.

   * *note ssl: d8.: *note SSL/TLS security considerations: 3aee.

   * *note subprocess: df.: *note Subprocess security considerations:
     39b1.

   * *note tempfile: e9.: *note mktemp is deprecated due to
     vulnerability to race conditions: 2f10.

   * *note xml: 129.: *note XML security: 3f48.

   * *note zipfile: 13a.: *note maliciously prepared .zip files can
     cause disk volume exhaustion: 3114.

The *note -I: d2c. command line option can be used to run Python in
isolated mode.  When it cannot be used, the *note -P: 9a8. option or the
*note PYTHONSAFEPATH: 9a9. environment variable can be used to not
prepend a potentially unsafe path to *note sys.path: 19f. 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 do what Python
code does - define functions, object types and methods - but also
interact with native libraries or achieve better performance by avoiding
the overhead of an interpreter.  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 C and Python.  For an
informal introduction to Python, see *note Python チュートリアル: 21c8.
*note Python 言語リファレンス: 3ff. gives a more formal definition of
the language.  *note Python 標準ライブラリ: 3fe. 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: 21ca. を参照してください。

To support extensions, Python's C 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"’.

     注釈: C 拡張のインターフェイスは CPython に固有のものであり、これに
     よる拡張モジュールはほかの Python 実装では動作しません。多くの場合
     、C 拡張を書くことを避けてほかの Python 実装のために移植性を確保す
     ることは可能です。たとえば、あなたがしたいことが C ライブラリの関数
     やシステムコールを呼び出すことである場合、 *note ctypes: 2d. あるい
     は cffi(1) ライブラリの利用を検討すべきです。これらのモジュールは C
     コードとインターフェイスし、C 拡張を書いてコンパイルするのに較べて
     Python 実装間のより高い移植性をもった Python コードを書かせてくれま
     す。
* Menu:

* Your first C API extension module::
* Using the C API; Assorted topics: Using the C API Assorted topics.
* 拡張の型の定義; チュートリアル: 拡張の型の定義 チュートリアル.
* 拡張の型の定義; 雑多なトピック: 拡張の型の定義 雑多なトピック.
* C および C++ 拡張のビルド::
* Windows 上での C および C++ 拡張モジュールのビルド::
* 他のアプリケーションへの Python の埋め込み::
* おすすめのサードパーティツール::
* C API Tutorial::
* Guides for intermediate topics::
* 大規模なアプリケーションへの Python ランタイムの埋め込み::

   ---------- Footnotes ----------

   (1) https://cffi.readthedocs.io/


File: python.info,  Node: Your first C API extension module,  Next: Using the C API Assorted topics,  Up: Python インタプリタの拡張と埋め込み

6.1 Your first C API extension module
=====================================

This tutorial will take you through creating a simple Python extension
module written in C or C++.

We will use the low-level Python C API directly.  For easier ways to
create extension modules, see the *note recommended third party tools:
51a7.

The tutorial assumes basic knowledge about Python: you should be able to
define functions in Python code before starting to write them in C. See
*note Python チュートリアル: 21c8. for an introduction to Python itself.

The tutorial should be approachable for anyone who can write a basic C
library.  While we will mention several concepts that a C beginner would
not be expected to know, like ‘static’ functions or linkage
declarations, understanding these is not necessary for success.

We will focus on giving you a "feel" of what Python's C API is like.  It
will not teach you important concepts, like error handling and reference
counting, which are covered in later chapters.

We will assume that you use a Unix-like system (including macOS and
Linux), or Windows.  On other systems, you might need to adjust some
details - for example, a system command name.

You need to have a suitable C compiler and Python development headers
installed.  On Linux, headers are often in a package like ‘python3-dev’
or ‘python3-devel’.

You need to be able to install Python packages.  This tutorial uses
pip(1) (‘pip install’), but you can substitute any tool that can build
and install ‘pyproject.toml’-based projects, like uv(2) (‘uv pip
install’).  Preferably, have a *note virtual environment: 3b1.
activated.

     注釈: This tutorial uses APIs that were added in CPython 3.15.  To
     create an extension that's compatible with earlier versions of
     CPython, please follow an earlier version of this documentation.

     This tutorial uses C syntax added in C11 and C++20.  If your
     extension needs to be compatible with earlier standards, please
     follow tutorials in documentation for Python 3.14 or below.

* Menu:

* What we'll do::
* Start with the headers::
* Running your build tool::
* Module export hook::
* The slot table::
* Exposing a function::
* Returning an integer::
* Accepting a string::
* The result::
* Appendix; Other build tools: Appendix Other build tools.

   ---------- Footnotes ----------

   (1) https://pip.pypa.io/

   (2) https://docs.astral.sh/uv/


File: python.info,  Node: What we'll do,  Next: Start with the headers,  Up: Your first C API extension module

6.1.1 What we'll do
-------------------

Let's create an extension module called ‘spam’ (1), which will include a
Python interface to the C standard library function ‘system()’.  This
function is defined in ‘stdlib.h’.  It takes a C string as argument,
runs the argument as a system command, and returns a result value as an
integer.  A manual page for ‘system()’ might summarize it this way:

     #include <stdlib.h>
     int system(const char *command);

Note that like many functions in the C standard library, this function
is already exposed in Python.  In production, use *note os.system():
1815. or *note subprocess.run(): f49. rather than the module you'll
write here.

We want this function to be callable from Python as follows:

     >>> import spam
     >>> status = spam.system("whoami")
     User Name
     >>> status
     0

     注釈: The system command ‘whoami’ prints out your username.  It's
     useful in tutorials like this one because it has the same name on
     both Unix and Windows.

   ---------- Footnotes ----------

   (1) ‘spam’ is the favorite food of Monty Python fans...


File: python.info,  Node: Start with the headers,  Next: Running your build tool,  Prev: What we'll do,  Up: Your first C API extension module

6.1.2 Start with the headers
----------------------------

Begin by creating a directory for this tutorial, and switching to it on
the command line.  Then, create a file named ‘spammodule.c’ in your
directory.  (1)

In this file, we'll include two headers: ‘Python.h’ to pull in all
declarations of the Python C API, and ‘stdlib.h’ for the ‘system()’
function.  (2)

Add the following lines to ‘spammodule.c’:

     #include <Python.h>
     #include <stdlib.h>     // for system()

Be sure to put ‘stdlib.h’, and any other standard library includes,
'after' ‘Python.h’.  On some systems, Python may define some
pre-processor definitions that affect the standard headers.

   ---------- Footnotes ----------

   (1) The source file name is entirely up to you, though some tools can
be picky about the ‘.c’ extension.  This tutorial uses the traditional
‘*module.c’ suffix.  Some people would just use ‘spam.c’ to implement a
module named ‘spam’, projects where Python isn't the primary language
might use ‘py_spam.c’, and so on.

   (2) Including ‘stdlib.h’ is technically not necessary, since
‘Python.h’ includes it and *note several other standard headers: 51aa.
for its own use or for backwards compatibility.  However, it is good
practice to explicitly include what you need.


File: python.info,  Node: Running your build tool,  Next: Module export hook,  Prev: Start with the headers,  Up: Your first C API extension module

6.1.3 Running your build tool
-----------------------------

With only the includes in place, your extension won't do anything.
Still, it's a good time to compile it and try to import it.  This will
ensure that your build tool works, so that you can make and test
incremental changes as you follow the rest of the text.

CPython itself does not come with a tool to build extension modules; it
is recommended to use a third-party project for this.  In this tutorial,
we'll use meson-python(1).  (If you want to use another one, see *note
Appendix; Other build tools: 51ac.)

‘meson-python’ requires defining a "project" using two extra files.

First, add ‘pyproject.toml’ with these contents:

     [build-system]
     build-backend = 'mesonpy'
     requires = ['meson-python']

     [project]
     # Placeholder project information
     # (change this before distributing the module)
     name = 'sampleproject'
     version = '0'

Then, create ‘meson.build’ containing the following:

     project('sampleproject', 'c')

     py = import('python').find_installation(pure: false)

     py.extension_module(
        'spam',          # name of the importable Python module
        'spammodule.c',  # the C source file
        install: true,
     )

     注釈: See meson-python documentation(2) for details on
     configuration.

Now, build install the 'project in the current directory' (‘.’) via
‘pip’:

     python -m pip -v install .

The ‘-v’ (‘--verbose’) option causes ‘pip’ to show the output from the
compiler, which is often useful during development.

     Tip: If you don't have ‘pip’ installed, run ‘python -m ensurepip’,
     preferably in a *note virtual environment: 3b1.  (Or, if you prefer
     another tool that can build and install ‘pyproject.toml’-based
     projects, use that.)

Note that you will need to run this command again every time you change
your extension.  Unlike Python, C has an explicit compilation step.

When your extension is compiled and installed, start Python and try to
import it.  This should fail with the following exception:

     >>> import spam
     Traceback (most recent call last):
        ...
     ImportError: dynamic module does not define module export function (PyModExport_spam or PyInit_spam)

   ---------- Footnotes ----------

   (1) https://mesonbuild.com/meson-python/

   (2) meson-python


File: python.info,  Node: Module export hook,  Next: The slot table,  Prev: Running your build tool,  Up: Your first C API extension module

6.1.4 Module export hook
------------------------

The exception you got when you tried to import the module told you that
Python is looking for a "module export function", also known as a *note
module export hook: 395.  Let's define one.

First, add a prototype below the ‘#include’ lines:


     PyMODEXPORT_FUNC PyModExport_spam(void);


     Tip: The prototype is not strictly necessary, but some modern
     compilers emit warnings without it.  It's generally better to add
     the prototype than to disable the warning.

The *note PyMODEXPORT_FUNC: 19b1. macro declares the function's return
type, and adds any special linkage declarations needed to make the
function visible and usable when CPython loads it.

After the prototype, add the function itself.  For now, make it return
‘NULL’:

     PyMODEXPORT_FUNC
     PyModExport_spam(void)
     {
        return NULL;
     }

Compile and load the module again.  You should get a different error
this time.

     >>> import spam
     Traceback (most recent call last):
        ...
     SystemError: module export hook for module 'spam' failed without setting an exception

Simply returning ‘NULL’ is 'not' correct behavior for an export hook,
and CPython complains about it.  That's good - it means that CPython
found the function!  Let's now make it do something useful.


File: python.info,  Node: The slot table,  Next: Exposing a function,  Prev: Module export hook,  Up: Your first C API extension module

6.1.5 The slot table
--------------------

Rather than ‘NULL’, the export hook should return the information needed
to create a module.  Let's start with the basics: the name and
docstring.

The information should be defined in an array of *note PySlot: 1a8.
entries, which are essentially key-value pairs.  Define this array just
before your export hook:

     PyABIInfo_VAR(abi_info);

     static PySlot spam_slots[] = {
        PySlot_STATIC_DATA(Py_mod_abi, &abi_info),
        PySlot_STATIC_DATA(Py_mod_name, "spam"),
        PySlot_STATIC_DATA(Py_mod_doc, "A wonderful module with an example function"),
        PySlot_END
     };

The *note PySlot_STATIC_DATA: 390. macro is used when the slot value
(here: ‘&abi_info’, ‘"spam"’, and the docstring) is a pointer to
constant, statically allocated data.

The ‘PyABIInfo_VAR(abi_info);’ macro and the *note Py_mod_abi: 360. slot
are a bit of boilerplate that helps prevent extensions compiled for a
different version of Python from crashing the interpreter.

For both *note Py_mod_name: 51af. and *note Py_mod_doc: 51b0, the values
are C strings - that is, NUL-terminated, UTF-8 encoded byte arrays.

Note ‘PySlot_END’ sentinel entry at the end.  This marks the end of the
array.  If you forget it, you'll trigger undefined behavior.

The array is defined as ‘static’ - that is, not visible outside this
‘.c’ file.  This will be a common theme.  CPython only needs to access
the export hook; all global variables and all other functions should
generally be ‘static’, so that they don't clash with other extensions.

Return this array from your export hook instead of ‘NULL’:

     PyMODEXPORT_FUNC
     PyModExport_spam(void)
     {
        return spam_slots;
     }

Now, recompile and try it out:

     >>> import spam
     >>> print(spam)
     <module 'spam' from '/home/encukou/dev/cpython/spam.so'>

You have an extension module!  Try ‘help(spam)’ to see the docstring.

The next step will be adding a function.


File: python.info,  Node: Exposing a function,  Next: Returning an integer,  Prev: The slot table,  Up: Your first C API extension module

6.1.6 Exposing a function
-------------------------

To expose the ‘system()’ C function directly to Python, we'll need to
write a layer of glue code to convert arguments from Python objects to C
values, and the C return value back to Python.

One of the simplest ways to write glue code is a "*note METH_O: 18bf."
function, which takes two Python objects and returns one.  All Python
objects - regardless of the Python type - are represented in C as
pointers to the *note PyObject: 1a6. structure.

Add such a function above the slots array:

     static PyObject *
     spam_system(PyObject *self, PyObject *arg)
     {
        Py_RETURN_NONE;
     }

For now, we ignore the arguments, and use the *note Py_RETURN_NONE:
182b. macro, which expands to a ‘return’ statement that properly returns
a Python *note None: a6a. object.

Recompile your extension to make sure you don't have syntax errors.  We
haven't yet added ‘spam_system’ to the module, so you might get a
warning that ‘spam_system’ is unused.

* Menu:

* Method definitions::


File: python.info,  Node: Method definitions,  Up: Exposing a function

6.1.6.1 Method definitions
..........................

To expose the C function to Python, you will need to provide several
pieces of information in a structure called *note PyMethodDef: 188f.
(1):

   * ‘ml_name’: the name of the Python function;

   * ‘ml_doc’: a docstring;

   * ‘ml_meth’: the C function to be called; and

   * ‘ml_flags’: a set of flags describing details like how Python
     arguments are passed to the C function.  We'll use *note METH_O:
     18bf. here - the flag that matches our ‘spam_system’ function's
     signature.

Because modules typically create several functions, these definitions
need to be collected in an array, with a zero-filled sentinel at the
end.  Add this array just below the ‘spam_system’ function:


     static PyMethodDef spam_methods[] = {
         {
             .ml_name="system",
             .ml_meth=spam_system,
             .ml_flags=METH_O,
             .ml_doc="Execute a shell command.",
         },
         {NULL, NULL, 0, NULL}        /* Sentinel */
     };


As with module slots, a zero-filled sentinel marks the end of the array.

Next, we'll add the method to the module.  Add a *note Py_mod_methods:
51b5. slot to your *note PyMethodDef: 188f. array:


     PyABIInfo_VAR(abi_info);

     static PySlot spam_slots[] = {
         PySlot_STATIC_DATA(Py_mod_abi, &abi_info),
         PySlot_STATIC_DATA(Py_mod_name, "spam"),
         PySlot_STATIC_DATA(Py_mod_doc, "A wonderful module with an example function"),
         PySlot_STATIC_DATA(Py_mod_methods, spam_methods),
         PySlot_END
     };


Recompile your extension again, and test it.  Be sure to restart the
Python interpreter, so that ‘import spam’ picks up the new version of
the module.

You should now be able to call the function:

     >>> import spam
     >>> print(spam.system)
     <built-in function system>
     >>> print(spam.system('whoami'))
     None

Note that our ‘spam.system’ does not yet run the ‘whoami’ command; it
only returns ‘None’.

Check that the function accepts exactly one argument, as specified by
the *note METH_O: 18bf. flag:

     >>> print(spam.system('too', 'many', 'arguments'))
     Traceback (most recent call last):
        ...
     TypeError: spam.system() takes exactly one argument (3 given)

   ---------- Footnotes ----------

   (1) The ‘PyMethodDef’ structure is also used to create methods of
classes, so there's no separate "‘PyFunctionDef’".


File: python.info,  Node: Returning an integer,  Next: Accepting a string,  Prev: Exposing a function,  Up: Your first C API extension module

6.1.7 Returning an integer
--------------------------

Now, let's take a look at the return value.  Instead of ‘None’, we'll
want ‘spam.system’ to return a number - that is, a Python *note int:
32e. object.  Eventually this will be the exit code of a system command,
but let's start with a fixed value, say, ‘3’.

The Python C API provides a function to create a Python *note int: 32e.
object from a C ‘int’ value: *note PyLong_FromLong(): 1de9.  (1)

To call it, replace the ‘Py_RETURN_NONE’ with the following 3 lines:

     static PyObject *
     spam_system(PyObject *self, PyObject *arg)
     {
        int status = 3;
        PyObject *result = PyLong_FromLong(status);
        return result;
     }

Recompile, restart the Python interpreter again, and check that the
function now returns 3:

     >>> import spam
     >>> spam.system('whoami')
     3

   ---------- Footnotes ----------

   (1) The name *note PyLong_FromLong(): 1de9. might not seem obvious.
‘PyLong’ refers to a the Python *note int: 32e, which was originally
called ‘long’; the ‘FromLong’ refers to the C ‘long’ (or ‘long int’)
type.


File: python.info,  Node: Accepting a string,  Next: The result,  Prev: Returning an integer,  Up: Your first C API extension module

6.1.8 Accepting a string
------------------------

Finally, let's handle the function argument.

Our C function, ‘spam_system()’, takes two arguments.  The first one,
‘PyObject *self’, will be set to the ‘spam’ module object.  This isn't
useful in our case, so we'll ignore it.

The other one, ‘PyObject *arg’, will be set to the object that the user
passed from Python.  We expect that it should be a Python string.  In
order to use the information in it, we will need to convert it to a C
value - in this case, a C string (‘const char *’).

There's a slight type mismatch here: Python's *note str: 1ea. objects
store Unicode text, but C strings are arrays of bytes.  So, we'll need
to 'encode' the data, and we'll use the UTF-8 encoding for it.  (UTF-8
might not always be correct for system commands, but it's what *note
str.encode(): cab. uses by default, and the C API has special support
for it.)

The function to encode a Python string into a UTF-8 buffer is named
*note PyUnicode_AsUTF8AndSize(): c73. (1).  Call it like this:

     static PyObject *
     spam_system(PyObject *self, PyObject *arg)
     {
        const char *command = PyUnicode_AsUTF8AndSize(arg, NULL);
        int status = 3;
        PyObject *result = PyLong_FromLong(status);
        return result;
     }

If *note PyUnicode_AsUTF8AndSize(): c73. is successful, 'command' will
point to the resulting C string - a zero-terminated array of bytes (2).
This buffer is managed by the 'arg' object, which means we don't need to
free it, but we must follow some rules:

   * We should only use the buffer inside the ‘spam_system’ function.
     After ‘spam_system’ returns, 'arg' and the buffer it manages might
     be garbage-collected.

   * We must not modify it.  This is why we use ‘const’.

If *note PyUnicode_AsUTF8AndSize(): c73. was 'not' successful, it
returns a ‘NULL’ pointer.  When calling 'any' Python C API, we always
need to handle such error cases.  The way to do this in general is left
for later chapters of this documentation.  For now, be assured that we
are already handling errors from *note PyLong_FromLong(): 1de9.
correctly.

For the *note PyUnicode_AsUTF8AndSize(): c73. call, the correct way to
handle errors is returning ‘NULL’ from ‘spam_system’.  Add an ‘if’ block
for this:

     static PyObject *
     spam_system(PyObject *self, PyObject *arg)
     {
        const char *command = PyUnicode_AsUTF8AndSize(arg);
        if (command == NULL) {
           return NULL;
        }
        int status = 3;
        PyObject *result = PyLong_FromLong(status);
        return result;
     }

To test that error handling works, compile again, restart Python so that
‘import spam’ picks up the new version of your module, and try passing a
non-string value to your function:

     >>> import spam
     >>> spam.system(3)
     Traceback (most recent call last):
        ...
     TypeError: bad argument type for built-in operation

Now, all that is left is calling the C library function ‘system()’ with
the ‘char *’ buffer, and using its result instead of the ‘3’:

     static PyObject *
     spam_system(PyObject *self, PyObject *arg)
     {
        const char *command = PyUnicode_AsUTF8AndSize(arg);
        if (command == NULL) {
           return NULL;
        }
        int status = system(command);
        PyObject *result = PyLong_FromLong(status);
        return result;
     }

Compile your module, restart Python, and test.  This time, you should
see your username - the output of the ‘whoami’ system command:

     >>> import spam
     >>> result = spam.system('whoami')
     User Name
     >>> result
     0

You can also test with other commands, like ‘ls’, ‘dir’, or one that
doesn't exist:

     >>> import spam
     >>> result = spam.system('nonexistent-command')
     sh: line 1: nonexistent-command: command not found
     >>> result
     32512

   ---------- Footnotes ----------

   (1) Here, ‘PyUnicode’ refers to the original name of the Python *note
str: 1ea. class: ‘unicode’.

The ‘AndSize’ part of the name refers to the fact that this function can
also retrieve the size of the buffer, using an output argument.  We
don't need this, so we set the second argument to NULL.

   (2) We're ignoring the fact that Python strings can also contain NUL
bytes, which terminate a C string.  In other words, our function will
treat ‘spam.system("foo\0bar")’ as ‘spam.system("foo")’.  This
possibility can lead to security issues, so the real ‘os.system’
function size checks for this case and raises an error.


File: python.info,  Node: The result,  Next: Appendix Other build tools,  Prev: Accepting a string,  Up: Your first C API extension module

6.1.9 The result
----------------

Congratulations!  You have written a complete Python C API extension
module, and completed this tutorial!

Here is the entire source file, for your convenience:
     /// Includes

     #include <Python.h>
     #include <stdlib.h>     // for system()

     /// Implementation of spam.system

     static PyObject *
     spam_system(PyObject *self, PyObject *arg)
     {
        const char *command = PyUnicode_AsUTF8AndSize(arg, NULL);
        if (command == NULL) {
           return NULL;
        }
        int status = system(command);
        PyObject *result = PyLong_FromLong(status);
        return result;
     }

     /// Module method table

     static PyMethodDef spam_methods[] = {
         {
             .ml_name="system",
             .ml_meth=spam_system,
             .ml_flags=METH_O,
             .ml_doc="Execute a shell command.",
         },
         {NULL, NULL, 0, NULL}        /* Sentinel */
     };

     /// Module slot table

     PyABIInfo_VAR(abi_info);

     static PySlot spam_slots[] = {
         PySlot_STATIC_DATA(Py_mod_abi, &abi_info),
         PySlot_STATIC_DATA(Py_mod_name, "spam"),
         PySlot_STATIC_DATA(Py_mod_doc, "A wonderful module with an example function"),
         PySlot_STATIC_DATA(Py_mod_methods, spam_methods),
         PySlot_END
     };

     /// Export hook prototype

     PyMODEXPORT_FUNC PyModExport_spam(void);

     /// Module export hook

     PyMODEXPORT_FUNC
     PyModExport_spam(void)
     {
        return spam_slots;
     }


File: python.info,  Node: Appendix Other build tools,  Prev: The result,  Up: Your first C API extension module

6.1.10 Appendix: Other build tools
----------------------------------

You should be able to follow this tutorial - except the 'Running your
build tool' section itself - with a build tool other than
‘meson-python’.

The Python Packaging User Guide has a list of recommended tools(1); be
sure to choose one for the C language.

* Menu:

* Workaround for missing PyInit function::
* Compiling directly::

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/guides/tool-recommendations/#build-backends-for-extension-modules


File: python.info,  Node: Workaround for missing PyInit function,  Next: Compiling directly,  Up: Appendix Other build tools

6.1.10.1 Workaround for missing PyInit function
...............................................

If your build tool output complains about missing ‘PyInit_spam’, add the
following function to your module for now:

     // A workaround
     void *PyInit_spam(void) { return NULL; }

This is a shim for an old-style *note initialization function: 395,
which was required in extension modules for CPython 3.14 and below.
Current CPython does not need it, but some build tools may still assume
that all extension modules need to define it.

If you use this workaround, you will get the exception ‘SystemError:
initialization of spam failed without raising an exception’ instead of
‘ImportError: dynamic module does not define module export function’.


File: python.info,  Node: Compiling directly,  Prev: Workaround for missing PyInit function,  Up: Appendix Other build tools

6.1.10.2 Compiling directly
...........................

Using a third-party build tool is heavily recommended, as it will take
care of various details of your platform and Python installation, of
naming the resulting extension, and, later, of distributing your work.

If you are building an extension for as 'specific' system, or for
yourself only, you might instead want to run your compiler directly.
The way to do this is system-specific; be prepared for issues you will
need to solve yourself.

* Menu:

* Linux: Linux<2>.


File: python.info,  Node: Linux<2>,  Up: Compiling directly

6.1.10.3 Linux
..............

On Linux, the Python development package may include a ‘python3-config’
command that prints out the required compiler flags.  If you use it,
check that it corresponds to the CPython interpreter you'll use to load
the module.  Then, start with the following command:

     gcc --shared $(python3-config --cflags --ldflags) spammodule.c -o spam.so

This should generate a ‘spam.so’ file that you need to put in a
directory on *note sys.path: 19f.


File: python.info,  Node: Using the C API Assorted topics,  Next: 拡張の型の定義 チュートリアル,  Prev: Your first C API extension module,  Up: Python インタプリタの拡張と埋め込み

6.2 Using the C API: Assorted topics
====================================

The *note tutorial: 51a5. walked you through creating a C API extension
module, but left many areas unexplained.  This document looks at several
concepts that you'll need to learn in order to write more complex
extensions.

* Menu:

* エラーと例外: エラーと例外<2>.
* Embedding an extension::
* C から Python 関数を呼び出す::
* 拡張モジュール関数でのパラメタ展開::
* 拡張モジュール関数のキーワードパラメタ::
* 任意の値を構築する::
* 参照カウント法::
* C++での拡張モジュール作成::
* 拡張モジュールに C API を提供する::


File: python.info,  Node: エラーと例外<2>,  Next: Embedding an extension,  Up: Using the C API Assorted topics

6.2.1 エラーと例外
------------------

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(): a7f.  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(): 985. です。引数は例
外オブジェクトと C 文字列です。例外オブジェクトは通常、 *note
PyExc_ZeroDivisionError: 51c4. のような定義済みのオブジェクトです。 C 文
字列はエラーの原因を示し、Python 文字列オブジェクトに変換されて例外の "付
属値" に保存されます。

もう一つ有用な関数として *note PyErr_SetFromErrno(): 51c5. があります。
この関数は引数に例外だけをとり、付属値はグローバル変数 ‘errno’ から構築
します。もっとも汎用的な関数は *note PyErr_SetObject(): 984. で、二つの
オブジェクト、例外と付属値を引数にとります。これら関数に渡すオブジェクト
には *note Py_INCREF(): 979. を使う必要はありません。

例外がセットされているかどうかは、 *note PyErr_Occurred(): 1ec4. を使っ
て非破壊的に調べられます。この関数は現在の例外オブジェクトを返します。例
外が発生していない場合には ‘NULL’ を返します。通常は、関数の戻り値からエ
ラーが発生したかを判別できるはずなので、 ‘PyErr_Occurred()’ を呼び出す必
要はありません。

関数 'g' を呼び出す 'f' が、前者の関数の呼び出しに失敗したことを検出する
と、 'f' 自体はエラー値 (大抵は ‘NULL’ や ‘-1’) を返さねばなりません。し
かし、 ‘PyErr_*’ 関数群のいずれかを呼び出す必要は 'ありません' -- なぜな
ら、 'g' がすでに呼び出しているからです。次いで 'f' を呼び出したコードも
エラーを示す値を '自らを呼び出したコード' に返すことになりますが、同様に
‘PyErr_*’ は '呼び出しません' 。以下同様に続きます -- エラーの最も詳しい
原因は、最初にエラーを検出した関数がすでに報告しているからです。エラーが
Python インタプリタのメインループに到達すると、現在実行中の Python コー
ドは一時停止し、 Python プログラマが指定した例外ハンドラを探し出そうとし
ます。

(モジュールが ‘PyErr_*’ 関数をもう一度呼び出して、より詳細なエラーメッセ
ージを提供するような状況があります。このような状況ではそうすべきです。と
はいえ、一般的な規則としては、この関数を何度も呼び出す必要はなく、ともす
ればエラーの原因に関する情報を失う結果になりがちです: これにより、ほとん
どの操作が様々な理由から失敗するかもしれません)

ある関数呼び出しでの処理の失敗によってセットされた例外を無視するには、
*note PyErr_Clear(): 13dd. を呼び出して例外状態を明示的に消去しなくては
なりません。エラーをインタプリタには渡したくなく、自前で (何か他の作業を
行ったり、何も起こらなかったかのように見せかけるような) エラー処理を完全
に行う場合にのみ、 ‘PyErr_Clear()’ を呼び出すようにすべきです。

‘malloc()’ の呼び出し失敗は、常に例外にしなくてはなりません --
‘malloc()’ (または ‘realloc()’) を直接呼び出しているコードは、 *note
PyErr_NoMemory(): 51c6. を呼び出して、失敗を示す値を返さねばなりません。
オブジェクトを生成する全ての関数 (例えば *note PyLong_FromLong(): 1de9.)
は ‘PyErr_NoMemory()’ の呼び出しを済ませてしまうので、この規則が関係する
のは直接 ‘malloc()’ を呼び出すコードだけです。

また、 *note PyArg_ParseTuple(): 3b9. という重要な例外を除いて、整数の状
態コードを返す関数はたいてい、Unix のシステムコールと同じく、処理が成功
した際にはゼロまたは正の値を返し、失敗した場合には ‘-1’ を返します。

最後に、エラー標示値を返す際に、(エラーが発生するまでに既に生成してしま
ったオブジェクトに対して *note Py_XDECREF(): b73. や *note Py_DECREF():
97a. を呼び出して) ごみ処理を注意深く行ってください!

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: 51c4, which you can use directly.
Of course, you should choose exceptions wisely -- don't use *note
PyExc_TypeError: 51c7. to mean that a file couldn't be opened (that
should probably be *note PyExc_OSError: 51c8.).  If something's wrong
with the argument list, the *note PyArg_ParseTuple(): 3b9. 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: 51c9. 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(): 1623. in the
module's *note Py_mod_exec: d4a. 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: d4a.
function is called.

For now, let's avoid the issue: we will block repeated initialization by
raising an *note ImportError: 1c8.:

     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(): 1623. function may create a class with the
base class being *note Exception: da2. (unless another class is passed
in instead of ‘NULL’), described in *note 組み込み例外: 1e3d.

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(): 97a. 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: 188b. 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(): 985. 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: Embedding an extension,  Next: C から Python 関数を呼び出す,  Prev: エラーと例外<2>,  Up: Using the C API Assorted topics

6.2.2 Embedding an extension
----------------------------

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.  On Unix, 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: Embedding an extension,  Up: Using the C API Assorted topics

6.2.3 C から Python 関数を呼び出す
----------------------------------

The tutorial 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.

幸運なことに、Python インタプリタは簡単に再帰呼び出しでき、 Python 関数
を呼び出すための標準インターフェースもあります。 (Python パーザを特定の
入力文字を使って呼び出す方法について詳説するつもりはありません -- この方
法に興味があるなら、 Python ソースコードの ‘Modules/main.c’ にある、コマ
ンドラインオプション *note -c: 44c. の実装を見てください)

Python 関数の呼び出しは簡単です。まず、C のコードに対してコールバックを
登録しようとする Python プログラムは、何らかの方法で Python の関数オブジ
ェクトを渡さねばなりません。このために、コールバック登録関数 (またはその
他のインターフェース) を提供せねばなりません。このコールバック登録関数が
呼び出された際に、引き渡された Python 関数オブジェクトへのポインタをグロ
ーバル変数に -- あるいは、どこか適切な場所に -- 保存します (関数オブジェ
クトを *note Py_INCREF(): 979. するようよく注意してください!)。例えば、
以下のような関数がモジュールの一部になっていることでしょう:

     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: 18c0. flag in *note PyMethodDef.ml_flags: 51ce.  The *note
PyArg_ParseTuple(): 3b9. function and its arguments are documented in
section *note 拡張モジュール関数でのパラメタ展開: 51cf.

*note Py_XINCREF(): e2d. および *note Py_XDECREF(): b73. は、オブジェク
トに対する参照カウントをインクリメント/デクリメントするためのマクロで、
‘NULL’ ポインタが渡されても安全に操作できる形式です (とはいえ、上の流れ
では 'temp' が ‘NULL’ になることはありません)。これらのマクロと参照カウ
ントについては、 *note 参照カウント法: 51d0. で説明しています。

その後、コールバック関数を呼び出す時が来たら、C 関数 *note
PyObject_CallObject(): 51d1. を呼び出します。この関数には二つの引数:
Python 関数と Python 関数の引数リストがあり、いずれも任意の Python オブ
ジェクトを表すポインタ型です。引数リストは常にタプルオブジェクトでなけれ
ばならず、その長さは引数の数になります。Python 関数を引数なしで呼び出す
のなら、 ‘NULL’ か空のタプルを渡します; 単一の引数で関数を呼び出すのなら
、単要素 (singleton) のタプルを渡します。 *note Py_BuildValue(): 5f5. の
書式文字列中に、ゼロ個または一個以上の書式化コードが入った丸括弧がある場
合、この関数はタプルを返します。以下に例を示します:

     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(): 51d1. は Python オブジェクトへのポインタを
返します: これは Python 関数からの戻り値になります。
‘PyObject_CallObject()’ は、引数に対して "参照カウント中立
(reference-count- neutral)" です。上の例ではタプルを生成して引数リストと
して提供しており、このタプルは ‘PyObject_CallObject()’ の呼び出し直後に
*note Py_DECREF(): 97a. されています。

*note PyObject_CallObject(): 51d1. は戻り値として "新しい" オブジェクト:
新規に作成されたオブジェクトか、既存のオブジェクトの参照カウントをインク
リメントしたものを返します。従って、このオブジェクトをグローバル変数に保
存したいのでないかぎり、たとえこの戻り値に興味がなくても (むしろ、そうで
あればなおさら!)  何がしかの方法で戻り値オブジェクトを *note
Py_DECREF(): 97a. しなければなりません。

とはいえ、戻り値を *note Py_DECREF(): 97a. する前には、値が ‘NULL’ でな
いかチェックしておくことが重要です。もし ‘NULL’ なら、呼び出した Python
関数は例外を送出して終了させられています。 *note PyObject_CallObject():
51d1. を呼び出しているコード自体もまた Python から呼び出されているのであ
れば、今度は C コードが自分を呼び出している Python コードにエラー標示値
を返さねばなりません。それにより、インタプリタはスタックトレースを出力し
たり、例外を処理するための Python コードを呼び出したりできます。例外の送
出が不可能だったり、したくないのなら、 *note PyErr_Clear(): 13dd. を呼ん
で例外を消去しておかねばなりません。例えば以下のようにします:

     if (result == NULL)
         return NULL; /* Pass error back */
     ...use result...
     Py_DECREF(result);

Python コールバック関数をどんなインターフェースにしたいかによっては、引
数リストを *note PyObject_CallObject(): 51d1. に与えなければならない場合
もあります。あるケースでは、コールバック関数を指定したのと同じインターフ
ェースを介して、引数リストも渡されているかもしれません。また別のケースで
は、新しいタプルを構築して引数リストを渡さねばならないかもしれません。こ
の場合最も簡単なのは *note Py_BuildValue(): 5f5. を呼ぶやり方です。例え
ば、整数のイベントコードを渡したければ、以下のようなコードを使うことにな
るでしょう:

     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(): 5f5. はメモリ不足におちいるかもしれず、
チェックしておくべきです。

通常の引数とキーワード引数をサポートする *note PyObject_Call(): 835. を
使って、キーワード引数を伴う関数呼び出しをすることができます。上の例と同
じように、 *note Py_BuildValue(): 5f5. を作って辞書を作ります。

     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: Using the C API Assorted topics

6.2.4 拡張モジュール関数でのパラメタ展開
----------------------------------------

The *note tutorial: 51a5. uses a "*note METH_O: 18bf." function, which
is limited to a single Python argument.  If you want more, you can use
*note METH_VARARGS: 18c0. instead.  With this flag, the C function will
receive a *note tuple: 1d9. of arguments instead of a single object.

For unpacking the tuple, CPython provides the *note PyArg_ParseTuple():
3b9. function, declared as follows:

     int PyArg_ParseTuple(PyObject *arg, const char *format, ...);

引数 'arg' は C 関数から Python に渡される引数リストが入ったタプルオブジ
ェクトでなければなりません。 'format' 引数は書式文字列で、 Python/C API
リファレンスマニュアルの *note 引数の解釈と値の構築: 608. で解説されてい
る書法に従わねばなりません。残りの引数は、それぞれの変数のアドレスで、書
式化文字列から決まる型になっていなければなりません。

For example, to receive a single Python *note str: 1ea. object and turn
it into a C buffer, you would use ‘"s"’ as the format string:

     const char *command;
     if (!PyArg_ParseTuple(args, "s", &command)) {
         return NULL;
     }

If an error is detected in the argument list, ‘PyArg_ParseTuple()’
returns ‘NULL’ (the error indicator for functions returning object
pointers); your function may return ‘NULL’, relying on the exception set
by *note PyArg_ParseTuple(): 3b9.

*note PyArg_ParseTuple(): 3b9. は Python 側から与えられた引数が必要な型
になっているか調べるのに対し、 ‘PyArg_ParseTuple()’ は呼び出しの際に渡さ
れた C 変数のアドレスが有効な値を持つか調べられないことに注意してくださ
い: ここで間違いを犯すと、コードがクラッシュするかもしれませんし、少なく
ともでたらめなビットをメモリに上書きしてしまいます。慎重に!

呼び出し側に提供されるオブジェクトへの参照はすべて '借用' 参照 (borrowed
reference) になります; これらのオブジェクトの参照カウントをデクリメント
してはなりません!

以下にいくつかの呼び出し例を示します:

     #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: Using the C API Assorted topics

6.2.5 拡張モジュール関数のキーワードパラメタ
--------------------------------------------

If you also want your function to accept *note keyword arguments: 10d0,
use the *note METH_KEYWORDS: 51d5. flag in combination with *note
METH_VARARGS: 18c0.  (‘METH_KEYWORDS’ can also be used with other flags;
see its documentation for the allowed combinations.)

In this case, the C function should accept a third ‘PyObject *’
parameter which will be a dictionary of keywords.  Use *note
PyArg_ParseTupleAndKeywords(): 81e. to parse the arguments to such a
function.

*note PyArg_ParseTupleAndKeywords(): 81e. は、以下のように宣言されていま
す:

     int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
                                     const char *format, char * const *kwlist, ...);

'arg' と 'format' パラメタは *note PyArg_ParseTuple(): 3b9. のものと同じ
です。 'kwdict' パラメタはキーワード引数の入った辞書で、 Python ランタイ
ムシステムから第三パラメタとして受け取ります。 'kwlist' パラメタは各パラ
メタを識別するための文字列からなる、 ‘NULL’ 終端されたリストです; 各パラ
メタ名は 'format' 中の型情報に対して左から右の順に照合されます。成功する
と *note PyArg_ParseTupleAndKeywords(): 81e. は真を返し、それ以外の場合
には適切な例外を送出して偽を返します。

     注釈: キーワード引数を使っている場合、タプルは入れ子にして使えませ
     ん!  'kwlist' 内に存在しないキーワードパラメタが渡された場合、
     *note TypeError: 29c. の送出を引き起こします。

以下にキーワードを使ったモジュール例を示します。これは 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 */
     };


File: python.info,  Node: 任意の値を構築する,  Next: 参照カウント法,  Prev: 拡張モジュール関数のキーワードパラメタ,  Up: Using the C API Assorted topics

6.2.6 任意の値を構築する
------------------------

*note Py_BuildValue(): 5f5. は *note PyArg_ParseTuple(): 3b9. の対極に位
置するものです。この関数は以下のように定義されています:

     PyObject *Py_BuildValue(const char *format, ...);

*note Py_BuildValue(): 5f5. は、 *note PyArg_ParseTuple(): 3b9. の認識す
る一連の書式単位に似た書式単位を認識します。ただし (関数への出力ではなく
、入力に使われる) 引数はポインタではなく、ただの値でなければなりません。
Python から呼び出された C 関数が返す値として適切な、新たな Python オブジ
ェクトを返します。

*note PyArg_ParseTuple(): 3b9. とは一つ違う点があります:
‘PyArg_ParseTuple()’ は第一引数をタプルにする必要があります (Python の引
数リストは内部的には常にタプルとして表現されるからです) が、 *note
Py_BuildValue(): 5f5. はタプルを生成するとは限りません。
‘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: Using the C API Assorted topics

6.2.7 参照カウント法
--------------------

C や C++のような言語では、プログラマはヒープ上のメモリを動的に確保したり
解放したりする責任があります。こうした作業は C では関数 ‘malloc()’ や
‘free()’ で行います。C++では本質的に同じ意味で演算子 ‘new’ や ‘delete’ が
使われます。そこで、以下の議論は C の場合に限定して行います。

Every block of memory allocated with ‘malloc()’ should eventually be
returned to the pool of available memory by exactly one call to
‘free()’.  It is important to call ‘free()’ at the right time.  If a
block's address is forgotten but ‘free()’ is not called for it, the
memory it occupies cannot be reused until the program terminates.  This
is called a 'memory leak'.  On the other hand, if a program calls
‘free()’ for a block and then continues to use the block, it creates a
conflict with reuse of the block through another ‘malloc()’ call.  This
is called 'using freed memory'.  It has the same bad consequences as
referencing uninitialized data -- core dumps, wrong results, mysterious
crashes.

よくあるメモリリークの原因はコード中の普通でない処理経路です。例えば、あ
る関数があるメモリブロックを確保し、何らかの計算を行って、再度ブロックを
解放するとします。さて、関数の要求仕様を変更して、計算に対するテストを追
加すると、エラー条件を検出し、関数の途中で処理を戻すようになるかもしれま
せん。この途中での終了が起きるとき、確保されたメモリブロックは解放し忘れ
やすいのです。コードが後で追加された場合には特にそうです。このようなメモ
リリークが一旦紛れ込んでしまうと、長い間検出されないままになることがよく
あります: エラーによる関数の終了は、全ての関数呼び出しのに対してほんのわ
ずかな割合しか起きず、その一方でほとんどの近代的な計算機は相当量の仮想記
憶を持っているため、メモリリークが明らかになるのは、長い間動作していたプ
ロセスがリークを起こす関数を何度も使った場合に限られるからです。従って、
この種のエラーを最小限にとどめるようなコーディング規約や戦略を設けて、不
慮のメモリリークを避けることが重要なのです。

Python は ‘malloc()’ や ‘free()’ を非常によく利用するため、メモリリーク
の防止に加え、解放されたメモリの使用を防止する戦略が必要です。このために
選ばれたのが参照カウント法 ('reference counting') と呼ばれる手法です。参
照カウント法の原理は簡単です: 全てのオブジェクトにはカウンタがあり、オブ
ジェクトに対する参照がどこかに保存されたらカウンタをインクリメントし、オ
ブジェクトに対する参照が削除されたらデクリメントします。カウンタがゼロに
なったら、オブジェクトへの最後の参照が削除されたことになり、オブジェクト
は解放されます。

もう一つの戦略は自動ガベージコレクション ('automatic garbage
collection') と呼ばれています。 (参照カウント法はガベージコレクション戦
略の一つとして挙げられることもあるので、二つを区別するために筆者は "自動
(automatic)" を使っています。) 自動ガベージコレクションの大きな利点は、
ユーザが ‘free()’ を明示的によばなくてよいことにあります。 (速度やメモリ
の有効利用性も利点として主張されています -- が、これは確たる事実ではあり
ません。) C における自動ガベージコレクションの欠点は、真に可搬性のあるガ
ベージコレクタが存在しないということです。それに対し、参照カウント法は可
搬性のある実装ができます (‘malloc()’ や ‘free()’ を利用できるのが前提で
す -- C 標準はこれを保証しています)。いつの日か、十分可搬性のあるガベー
ジコレクタが C で使えるようになるかもしれませんが、それまでは参照カウン
ト法でやっていく以外にはないのです。

Python では、伝統的な参照カウント法の実装を行っている一方で、参照の循環
を検出するために働く循環参照検出機構 (cycle detector) も提供しています。
循環参照検出機構のおかげで、直接、間接にかかわらず循環参照の生成を気にせ
ずにアプリケーションを構築できます; というのも、参照カウント法だけを使っ
たガベージコレクション実装にとって循環参照は弱点だからです。循環参照は、
(間接参照の場合も含めて) 相互への参照が入ったオブジェクトから形成される
ため、循環内のオブジェクトは各々非ゼロの参照カウントを持ちます。典型的な
参照カウント法の実装では、たとえ循環参照を形成するオブジェクトに対して他
に全く参照がないとしても、循環参照内のどのオブジェクトに属するメモリも再
利用できません。

循環参照検出機構はそのようなガベージサイクル (前述したような循環参照オブ
ジェクト) を検出して回収することができます。 *note gc: 63. モジュールそ
のような検出機構の実行 (*note collect(): 456. 関数) を提供するとともに、
設定のためのインタフェースおよび検出機構を実行時に無効にする方法も提供し
ています。

* Menu:

* Python における参照カウント法::
* 所有権にまつわる規則::
* 薄氷::
* NULL ポインタ::


File: python.info,  Node: Python における参照カウント法,  Next: 所有権にまつわる規則,  Up: 参照カウント法

6.2.7.1 Python における参照カウント法
.....................................

Python には、参照カウントのインクリメントやデクリメントを処理する二つの
マクロ、 ‘Py_INCREF(x)’ と ‘Py_DECREF(x)’ があります。 *note
Py_DECREF(): 97a. は、参照カウントがゼロに到達した際に、オブジェクトのメ
モリ解放も行います。柔軟性を持たせるために、 ‘free()’ を直接呼び出しませ
ん -- その代わりにオブジェクトの型オブジェクト ('type object') を介しま
す。このために (他の目的もありますが)、全てのオブジェクトには自身の型オ
ブジェクトに対するポインタが入っています。

さて、まだ重大な疑問が残っています: いつ ‘Py_INCREF(x)’ や
‘Py_DECREF(x)’ を使えばよいのでしょうか?  まず、いくつかの用語説明から始
めさせてください。まず、オブジェクトは "占有 (own)" されることはありませ
ん; しかし、あるオブジェクトに対する参照の所有 'own a reference' はでき
ます。オブジェクトの参照カウントは、そのオブジェクトが参照の所有を受けて
いる回数と定義されています。参照の所有者は、参照が必要なくなった際に
*note Py_DECREF(): 97a. を呼び出す役割を担います。参照の所有権は委譲
(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(): 97a.  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(): 979. を呼び出すと、借用参照を所有参照に変更できます。
この操作は参照の借用元の状態には影響しません -- ‘Py_INCREF()’ は新たな所
有参照を生成し、参照の所有者が担うべき全ての責任を課します (つまり、新た
な参照の所有者は、以前の所有者と同様、参照の放棄を適切に行わねばなりませ
ん)。

   ---------- Footnotes ----------

   (1) 参照を "借用する" というメタファは厳密には正しくありません: なぜ
なら、参照の所有者は依然として参照のコピーを持っているからです。

   (2) 参照カウントが 1 以上かどうか調べる方法は 'うまくいきません' -- 参
照カウント自体も解放されたメモリ上にあるため、その領域が他のオブジェクト
に使われている可能性があります!


File: python.info,  Node: 所有権にまつわる規則,  Next: 薄氷,  Prev: Python における参照カウント法,  Up: 参照カウント法

6.2.7.2 所有権にまつわる規則
............................

オブジェクトへの参照を関数の内外に渡す場合には、オブジェクトの所有権が参
照と共に渡されるか否かが常に関数インターフェース仕様の一部となります。

オブジェクトへの参照を返すほとんどの関数は、参照とともに所有権も渡します
。特に、 *note PyLong_FromLong(): 1de9. や *note Py_BuildValue(): 5f5. の
ように、新しいオブジェクトを生成する関数は全て所有権を相手に渡します。オ
ブジェクトが実際には新たなオブジェクトでなくても、そのオブジェクトに対す
る新たな参照の所有権を得ます。例えば、 ‘PyLong_FromLong()’ はよく使う値
をキャッシュしており、キャッシュされた値への参照を返すことがあります。

*note PyObject_GetAttrString(): 7ec. のように、あるオブジェクトから別の
オブジェクトを抽出するような関数もまた、参照とともに所有権を委譲します。
こちらの方はやや理解しにくいかもしれません。というのはよく使われるルーチ
ンのいくつかが例外となっているからです: *note PyTuple_GetItem(): 51dd. 、
*note PyList_GetItem(): 7fb. 、 *note PyDict_GetItem(): 822. 、および
*note PyDict_GetItemString(): 823. は全て、タプル、リスト、または辞書か
ら借用参照を返します。

*note PyImport_AddModule(): 7f8. は、実際にはオブジェクトを生成して返す
ことがあるにもかかわらず、借用参照を返します: これが可能なのは、生成され
たオブジェクトに対する所有参照は ‘sys.modules’ に保持されるからです。

オブジェクトへの参照を別の関数に渡す場合、一般的には、関数側は呼び出し手
から参照を借用します -- 参照を保存する必要があるなら、関数側は *note
Py_INCREF(): 979. を呼び出して独立した所有者になります。とはいえ、この規
則には二つの重要な例外: *note PyTuple_SetItem(): 51de. と *note
PyList_SetItem(): 1afa. があります。これらの関数は、渡された引数要素に対
して所有権を乗っ取り (take over) ます -- たとえ失敗してもです!  (*note
PyDict_SetItem(): 51df. とその仲間は所有権を乗っ取りません -- これらはい
わば "普通の" 関数です。)

Python から C 関数が呼び出される際には、C 関数は呼び出し側から引数への参
照を借用します。C 関数の呼び出し側はオブジェクトへの参照を所有しているの
で、借用参照の生存期間が保証されるのは関数が処理を返すまでです。このよう
にして借用参照を保存したり他に渡したりしたい場合にのみ、 *note
Py_INCREF(): 979. を使って所有参照にする必要があります。

Python から呼び出された C 関数が返す参照は所有参照でなければなりません
-- 所有権は関数から呼び出し側へと委譲されます。


File: python.info,  Node: 薄氷,  Next: NULL ポインタ,  Prev: 所有権にまつわる規則,  Up: 参照カウント法

6.2.7.3 薄氷
............

数少ない状況において、一見無害に見える借用参照の利用が問題をひきおこすこ
とがあります。この問題はすべて、インタプリタが非明示的に呼び出され、イン
タプリタが参照の所有者に参照を放棄させてしまう状況と関係しています。

知っておくべきケースのうち最初の、そして最も重要なものは、リスト要素に対
する参照を借りている際に起きる、関係ないオブジェクトに対する *note
Py_DECREF(): 97a. の使用です。例えば:

     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(): 1afa.  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(): 97a. on the replaced item, which invokes replaced item's
corresponding *note tp_dealloc: 51e2. function.  During deallocation,
‘tp_dealloc’ calls *note tp_finalize: e70, 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:
68c. protecting Python's entire object space.  However, it is possible
to temporarily release this lock using the macro *note
Py_BEGIN_ALLOW_THREADS: 51e3, and to re-acquire it using *note
Py_END_ALLOW_THREADS: e52.  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.7.4 NULL ポインタ
.....................

一般論として、オブジェクトへの参照を引数にとる関数はユーザが ‘NULL’ ポイ
ンタを渡すとは予想しておらず、渡そうとするとコアダンプになる (か、あとで
コアダンプを引き起こす) ことでしょう。一方、オブジェクトへの参照を返すよ
うな関数は一般に、例外の発生を示す場合にのみ ‘NULL’ を返します。引数に対
して ‘NULL’ テストを行わない理由は、関数はしばしば受け取ったオブジェクト
を他の関数へと引き渡すからです -- 各々の関数が ‘NULL’ テストを行えば、冗
長なテストが大量に行われ、コードはより低速に動くことになります。

従って、 ‘NULL’ のテストはオブジェクトの "発生源"、すなわち値が ‘NULL’ に
なるかもしれないポインタを受け取ったときだけにしましょう。 ‘malloc()’ や
、例外を送出する可能性のある関数がその例です。

マクロ *note Py_INCREF(): 979. および *note Py_DECREF(): 97a. は ‘NULL’
ポインタのチェックを行いません -- しかし、これらのマクロの変化形である
*note Py_XINCREF(): e2d. および *note Py_XDECREF(): b73. はチェックを行
います。

特定のオブジェクト型について調べるマクロ (‘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: Using the C API Assorted topics

6.2.8 C++での拡張モジュール作成
-------------------------------

C++でも拡張モジュールは作成できます。ただしいくつか制限があります。メイ
ンプログラム (Python インタプリタ) は C コンパイラでコンパイルされリンク
されているので、グローバル変数や静的オブジェクトをコンストラクタで作成で
きません。メインプログラムが C++ コンパイラでリンクされているならこれは
問題ではありません。 Python インタプリタから呼び出される関数 (特にモジュ
ール初期化関数) は、 ‘extern "C"’ を使って宣言しなければなりません。また
、Python ヘッダファイルを ‘extern "C" {...}’ に入れる必要はありません--
シンボル ‘__cplusplus’ (最近の C++ コンパイラは全てこのシンボルを定義し
ています) が定義されているときに ‘extern "C" {...}’ が行われるように、ヘ
ッダファイル内にすでに書かれているからです。


File: python.info,  Node: 拡張モジュールに C API を提供する,  Prev: C++での拡張モジュール作成,  Up: Using the C API Assorted topics

6.2.9 拡張モジュールに 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.  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(): 51e9. は name 引数 (const char*) を取ります。
‘NULL’ を name に渡すことも許可されていますが、 name を設定することを強
く推奨します。正しく名前を付けられた Capsule はある程度の実行時型安全性
を持ちます。名前を付けられていない Capsule を他の Capsule と区別する現実
的な方法はありません。

特に、 C API を公開するための Capsule には次のルールに従った名前を付ける
べきです:

     modulename.attributename

*note PyCapsule_Import(): 1e26. という便利関数は、 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 the
*note tutorial: 51a5.  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: d4a. 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: d4a. 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
カプセル: 2c1c, および Capsule の実装部分 (Python ソースコード配布物中の
ファイル ‘Include/pycapsule.h’ および ‘Objects/pycapsule.c’ に述べられて
います。

脚注
....


File: python.info,  Node: 拡張の型の定義 チュートリアル,  Next: 拡張の型の定義 雑多なトピック,  Prev: Using the C API Assorted topics,  Up: Python インタプリタの拡張と埋め込み

6.3 拡張の型の定義: チュートリアル
==================================

Python では、組み込みの *note str: 1ea. 型や *note list: 4e0. 型のような
Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できま
す。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に
理解しておくべき細かいことがあります。 このドキュメントはその話題につい
てのやさしい入門です。

* Menu:

* 基本的なこと::
* 基本のサンプルにデータとメソッドを追加する::
* データ属性をこまかく制御する::
* 循環ガベージコレクションをサポートする::
* 他の型のサブクラスを作る::


File: python.info,  Node: 基本的なこと,  Next: 基本のサンプルにデータとメソッドを追加する,  Up: 拡張の型の定義 チュートリアル

6.3.1 基本的なこと
------------------

*note CPython: ae8. ランタイムは Python の全てのオブジェクトを、 Python
の全てのオブジェクトの "基底型 (base type)" である *note PyObject: 1a6.*
型の変数と見なします。 *note PyObject: 1a6. 構造体自身は *note
参照カウント: 2d0. と、オブジェクトの "型オブジェクト" へのポインタのみ
を持ちます。ここには動作が定義されています; 型オブジェクトは、例えば、あ
る属性があるオブジェクトから検索されたり、メソッドが呼ばれたり、他のオブ
ジェクトによって操作されたりしたときに、どの (C) 関数がインタープリター
から呼ばれるのかを決定します。これらの C 関数は "型メソッド (type
method)" と呼ばれます。

それなので、新しい拡張の型を定義したいときは、新しい型オブジェクトを作成
すればよいわけです。

この手のことは例を見たほうが早いでしょうから、以下に C 拡張モジュール
‘custom’ にある ‘Custom’ という名前の新しい型を定義する、最小限ながら完
全なモジュールをあげておきます:

     注釈: ここで紹介している例は、 '静的な' 拡張の型を定義する伝統的な
     実装方法です。 これはほとんどの場面で十分なものなのです。 C API で
     は、 *note PyType_FromSpec(): 396. 関数を使い、ヒープ上に配置された
     拡張の型も定義できますが、これについてはこのチュートリアルでは扱い
     ません。

     #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: 1a6. 型の ‘ob_base’
という名前のフィールドを定義します。 ‘PyObject’ 型には (それぞれ *note
Py_TYPE: 5fc. マクロおよび *note Py_REFCNT: 552. マクロからアクセスでき
る) 型オブジェクトへのポインタと参照カウントが格納されています。このマク
ロが用意されている理由は、構造体のレイアウトを抽象化し、デバッグビルドで
フィールドを追加できるようにするためです。

     注釈: 上の例では *note PyObject_HEAD: 1697. マクロの後にセミコロン
     はありません。 うっかりセミコロンを追加しないように気を付けてくださ
     い: これを警告するコンパイラもあります。

もちろん、一般的にはオブジェクトは標準的な ‘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: e6f. の特に関心の無いフィールドまで全て並べたり、フィ
     ールドを宣言する順序に気を使ったりせずに済ませるのをお薦めします。

‘object.h’ にある実際の *note PyTypeObject: e6f. の定義には上の定義にあ
るよりももっと多くの *note フィールド: d59. があります。 ここに出てきて
いないフィールドは 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: bd. モジュ
ールや *note pickle: ab. モジュールと互換性を持たせるために重要なのです
。

     .tp_basicsize = sizeof(CustomObject),
     .tp_itemsize = 0,

これは、新しい ‘Custom’ インスタンスを作るときに Python が割り当てるべき
メモリがどのくらいなのかを知るためのものです。 *note tp_itemsize: 25cf.
は可変サイズのオブジェクトでのみ使うものなので、サイズが可変でないオブジ
ェクトでは 0 にすべきです。

     注釈: If you want your type to be subclassable from Python, and
     your type has the same *note tp_basicsize: d53. 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__: 1864, or else it will not be able to call your type's
     *note __new__(): 987. 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: e51, or else you will be adding data members to your base
     type, and therefore increasing its size.

*note Py_TPFLAGS_DEFAULT: 51ef. にクラスフラグを設定します。

     .tp_flags = Py_TPFLAGS_DEFAULT,

すべての型はフラグにこの定数を含めておく必要があります。これは最低でも
Python 3.3 までに定義されているすべてのメンバを許可します。それ以上のメ
ンバが必要なら、対応するフラグの OR をとる必要があります。

この型の docstring は *note tp_doc: 51f0. に入れます。

     .tp_doc = PyDoc_STR("Custom objects"),

オブジェクトが生成できるように、 *note tp_new: 986. ハンドラを提供する必
要があります。これは Python のメソッド *note __new__(): 987. と同等のも
のですが、明示的に与える必要があります。今の場合では、 API 関数の *note
PyType_GenericNew(): 51f1. として提供されるデフォルトの実装をそのまま使
えます。

     .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: 51f2. も含めて、いくつかの
メンバーを適切なデフォルト値で埋めて、 ‘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.3.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: 51e2. メンバに代入されます。

     .tp_dealloc = Custom_dealloc,

このメソッドは、まず二つのPython 属性の参照カウントをクリアします。
*note Py_XDECREF(): b73. は引数が ‘NULL’ のケースを正しく扱えます (これ
は、‘tp_new’ が途中で失敗した場合に起こりえます) 。このメソッドは、つぎ
にオブジェクトの型 (‘Py_TYPE(self)’ で算出します) のメンバ *note
tp_free: 51f4. を呼び出し、オブジェクトのメモリを開放します。オブジェク
トの型が ‘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: 986. メンバとしてインストールします:

     .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__(): 987. method.  It is not required to define a ‘tp_new’ member,
and indeed many extension types will simply reuse *note
PyType_GenericNew(): 51f1. 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: 51f5. スロットを呼び出してメモリ
を割り当てます:

     self = (CustomObject *) type->tp_alloc(type, 0);

メモリ割り当ては失敗するかもしれないので、先に進む前に *note tp_alloc:
51f5. の結果が ‘NULL’ でないかチェックしなければなりません。

     注釈: We didn't fill the *note tp_alloc: 51f5. slot ourselves.
     Rather *note PyType_Ready(): b63. fills it for us by inheriting it
     from our base class, which is *note object: e51. by default.  Most
     types use the default allocation strategy.

     注釈: もし協力的な *note tp_new: 986. (基底タイプの ‘tp_new’ または
     *note __new__(): 987. を呼んでいるもの) を作りたいのならば、実行時
     のメソッド解決順序をつかってどのメソッドを呼びだすかを決定しようと
     しては 'いけません' 。常に呼び出す型を静的に決めておき、直接その
     ‘tp_new’ を呼び出すか、あるいは ‘type->tp_base->tp_new’ を経由して
     ください。こうしないと、あなたが作成したタイプの Python サブクラス
     が他の Python で定義されたクラスも継承している場合にうまく動かない
     場合があります。 (とりわけ、そのようなサブクラスのインスタンスを
     *note TypeError: 29c. を出さずに作ることが不可能になります。)

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: 988. メンバに代入されます。

     .tp_init = Custom_init,

The *note tp_init: 988. slot is exposed in Python as the *note
__init__(): 306. 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__(): 306. 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:
1ac. 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: 1ac. nor cause any calls back into
     our type's code;

   * when decrementing a reference count in a *note tp_dealloc: 51e2.
     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: 51f6. スロットに入れましょう:

     .tp_members = Custom_members,

Each member definition has a member name, type, offset, access flags and
documentation string.  See the *note 総称的な属性を管理する: 51f7.
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: 188c. flag to indicate that
the method is expecting no arguments other than 'self')

and assign it to the *note tp_methods: 51f8. 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: 51f9. 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: d49. struct, and update the full class
name in the *note PyTypeObject: e6f. 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: 51e2. handler in this
example, because our type doesn't support garbage collection.


File: python.info,  Node: データ属性をこまかく制御する,  Next: 循環ガベージコレクションをサポートする,  Prev: 基本のサンプルにデータとメソッドを追加する,  Up: 拡張の型の定義 チュートリアル

6.3.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: f7b. 構造体の配列をつくります:

     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: 51fb. スロットに登録します:

     .tp_getset = Custom_getsetters,

The last item in a *note PyGetSetDef: f7b. 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: 988. ハンドラも渡されるものとして文字列の
みを許可するように修正する必要があります (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(): b73. calls can
be converted to *note Py_DECREF(): 97a. 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.3.4 循環ガベージコレクションをサポートする
--------------------------------------------

Python は *note 循環ガベージコレクタ (GC) 機能: 19fe. をもっており、これ
は不要なオブジェクトを、たとえ参照カウントがゼロでなくても発見することが
できます。そのような状況はオブジェクトの参照が循環しているときに起こりえ
ます。たとえば以下の例を考えてください:

     >>> 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(): 51fd. 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: 373. implementation must name its
     arguments exactly 'visit' and 'arg' in order to use *note
     Py_VISIT(): 51fd.

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(): 981. 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(): b73. 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(): 981. 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(): 981. 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():
18bd. 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: 3a6. flag to the class
flags:

     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,

これで完了です。 *note tp_alloc: 51f5. スロットまたは *note tp_free:
51f4. ハンドラが書かれていれば、それらを循環ガベージコレクションに使える
よう修正すればよいのです。ほとんどの拡張機能は自動的に提供されるバージョ
ンを使うでしょう。

   ---------- Footnotes ----------

   (1) Also, even with our attributes restricted to strings instances,
the user could pass arbitrary *note str: 1ea. subclasses and therefore
still create reference cycles.


File: python.info,  Node: 他の型のサブクラスを作る,  Prev: 循環ガベージコレクションをサポートする,  Up: 拡張の型の定義 チュートリアル

6.3.5 他の型のサブクラスを作る
------------------------------

既存の型を継承した新しい拡張型を作成することができます。組み込み型から継
承するのは特に簡単です。必要な *note PyTypeObject: e6f. を簡単に利用でき
るからです。それに比べて、 ‘PyTypeObject’ 構造体を拡張モジュール間で共有
するのは難しいです。

In this example we will create a ‘SubList’ type that inherits from the
built-in *note list: 4e0. 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(): 1697. 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__(): 306. method of
the base type.

This pattern is important when writing a type with custom *note tp_new:
986. and *note tp_dealloc: 51e2. members.  The ‘tp_new’ handler should
not actually create the memory for the object with its *note tp_alloc:
51f5, but let the base class handle it by calling its own ‘tp_new’.

The *note PyTypeObject: e6f. struct supports a *note tp_base: 2585.
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: 51ff.; it should be done in the *note Py_mod_exec:
d4a. 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: 2585. スロットは
埋められていなければなりません。既存の型を継承する際には、 *note
tp_alloc: 51f5. スロットを *note PyType_GenericNew(): 51f1. で埋める必要
はありません。 - 基底型のアロケーション関数が継承されます。

After that, calling *note PyType_Ready(): b63. 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: Python インタプリタの拡張と埋め込み

6.4 拡張の型の定義: 雑多なトピック
==================================

この節ではさまざまな実装可能なタイプメソッドと、それらが何をするものであ
るかについて、ざっと説明します。

以下は *note PyTypeObject: e6f. の定義です。 *note デバッグビルド: 3e3.
でしか使われないいくつかのメンバは省いてあります:

     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: 25cf. メンバが使われます
。これらについてはあとでふれます。

     const char *tp_doc;

ここには Python スクリプトリファレンス ‘obj.__doc__’ が doc string を返
すときの文字列 (あるいはそのアドレス) を入れます。

では次に、型の基本的なメソッドに進みます。ほとんどの拡張の型がこのメソッ
ドを実装します。

* Menu:

* ファイナライズとメモリ解放::
* オブジェクト表現::
* 属性を管理する::
* オブジェクトの比較::
* 抽象的なプロトコルのサポート::
* 弱参照(Weak Reference)のサポート: 弱参照 Weak Reference のサポート.
* その他いろいろ::


File: python.info,  Node: ファイナライズとメモリ解放,  Next: オブジェクト表現,  Up: 拡張の型の定義 雑多なトピック

6.4.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(): 18bd. 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(): 642. および *note PyErr_Restore(): 645. 関数を使うことに
よって可能になります:

     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: 373. および *note
     tp_clear: 5206. を使って) ガベージコレクションをサポートしている場
     合、 *note tp_dealloc: 51e2. が呼び出されるまでに、消去されファイナ
     ライズされてしまうオブジェクトのメンバーが有り得ることです。 2つ目
     は、 ‘tp_dealloc’ の中ではオブジェクトは不安定な状態にあることです:
     つまり参照カウントが0であるということです。 (上の例にあるような) 複
     雑なオブジェクトや API の呼び出しでは、 ‘tp_dealloc’ を再度呼び出し
     、二重解放からクラッシュすることになるかもしれません。

     Python 3.4 からは、複雑なファイナライズのコードは *note tp_dealloc:
     51e2. に置かず、代わりに新しく導入された *note tp_finalize: e70. と
     いう型メソッドを使うことが推奨されています。

     参考
     ....

     PEP 442(1) で新しいファイナライズの仕組みが説明されています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0442/


File: python.info,  Node: オブジェクト表現,  Next: 属性を管理する,  Prev: ファイナライズとメモリ解放,  Up: 拡張の型の定義 雑多なトピック

6.4.2 オブジェクト表現
----------------------

Python では、オブジェクトの文字列表現を生成するのに 2つのやり方がありま
す: *note repr(): 462. 関数を使う方法と、 *note str(): 1ea. 関数を使う方
法です。 (*note print(): 1324. 関数は単に ‘str()’ を呼び出します。) これ
らのハンドラはどちらも省略できます。

     reprfunc tp_repr;
     reprfunc tp_str;

*note tp_repr: 5208. ハンドラは呼び出されたインスタンスの文字列表現を格
納した文字列オブジェクトを返す必要があります。簡単な例は以下のようなもの
です:

     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: 5208. handler is specified, the interpreter will
supply a representation that uses the type's *note tp_name: 1ec5. and a
uniquely identifying value for the object.

*note tp_str: 5209. ハンドラと *note str(): 1ea. の関係は、上の *note
tp_repr: 5208. ハンドラと *note repr(): 462. の関係に相当します。つまり
、これは 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.4.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: 1a6.*.  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: 1a6.* 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.4.3.1 総称的な属性を管理する
..............................

ほとんどの型は '単純な' 属性を使うだけです。では、どのような属性が単純だ
といえるのでしょうか?  それが満たすべき条件はごくわずかです:

  1. *note PyType_Ready(): b63. が呼ばれたとき、すでに属性の名前がわかっ
     ていること。

  2. 属性を参照したり設定したりするときに、特別な記録のための処理が必要
     でなく、また参照したり設定した値に対してどんな操作も実行する必要が
     ないこと。

これらの条件は、属性の値や、値が計算されるタイミング、または格納されたデ
ータがどの程度妥当なものであるかといったことになんら制約を課すものではな
いことに注意してください。

When *note PyType_Ready(): b63. is called, it uses three tables
referenced by the type object to create *note descriptor: 22a.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: 1c89. and *note tp_setattro: 520c. 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: 51f8. is not ‘NULL’, it must refer to an array of
*note PyMethodDef: 188f. 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: 520d. 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: 22a. will be
constructed and added to the type which will be able to extract a value
from the instance structure.  The *note type: 520e. field should contain
a type code like *note Py_T_INT: 993. or *note Py_T_DOUBLE: 994.; the
value will be used to determine how to convert Python values to and from
C values.  The *note flags: 520f. field is used to store flags which
control how the attribute can be accessed: you can set it to *note
Py_READONLY: 995. to prevent Python code from setting it.

An interesting advantage of using the *note tp_members: 51f6. 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__: 22a2. attribute.

As with the *note tp_methods: 51f8. table, a sentinel entry with a *note
ml_name: 520d. value of ‘NULL’ is required.


File: python.info,  Node: 特定の型に特化した属性の管理,  Prev: 総称的な属性を管理する,  Up: 属性を管理する

6.4.3.2 特定の型に特化した属性の管理
....................................

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: 1a6.* 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: 5211. handler is called when the object requires
an attribute look-up.  It is called in the same situations where the
*note __getattr__(): 8e8. 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: 5212. handler is called when the *note
__setattr__(): 258c. or *note __delattr__(): 258d. 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.4.4 オブジェクトの比較
------------------------

     richcmpfunc tp_richcompare;

The *note tp_richcompare: 5214. handler is called when comparisons are
needed.  It is analogous to the *note rich comparison methods: 25c2,
like ‘__lt__()’, and also called by *note PyObject_RichCompare(): 5215.
and *note PyObject_RichCompareBool(): 1f9d.

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.4.5 抽象的なプロトコルのサポート
----------------------------------

Python はいくつもの '抽象的な' “プロトコル”をサポートしています。これら
を使用する特定のインターフェイスについては *note 抽象オブジェクトレイヤ
(Abstract Objects Layer): 5217. で解説されています。

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: 17d6. 構造体、
*note PySequenceMethods: 5218. 構造体、または *note PyMappingMethods:
5219. 構造体のアドレスを入れます。これらに適切な値を入れても入れなくても
かまいません。これらを使った例は 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: 161d. is a signed integer type with a platform-varying
width.  Returning ‘-1’ from *note tp_hash: 521a. 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: 967. ハンドラ
が呼ばれます。

この関数は 3つの引数をとります:

  1. 'self' は呼び出しの対象となるデータ型のインスタンスです。 たとえば
     呼び出しが ‘obj1('hello')’ の場合、'self' は ‘obj1’ になります。

  2. 'args' は呼び出しの引数を格納しているタプルです。ここから引数を取り
     出すには *note PyArg_ParseTuple(): 3b9. を使います。

  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(): 81e. to extract the arguments.  If
     you do not want to support keyword arguments and this is
     non-‘NULL’, raise a *note TypeError: 29c. 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: 18a7.
corresponds to the Python *note __iter__(): 1031. method, while *note
tp_iternext: 18a8. corresponds to the Python *note __next__(): 1687.
method.

Any *note iterable: 149a. object must implement the *note tp_iter: 18a7.
handler, which must return an *note iterator: 6d4. 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: 18a7.

   * Objects which can only be iterated over once (usually due to side
     effects of iteration, such as file objects) can implement *note
     tp_iter: 18a7. by returning a new reference to themselves - and
     should also therefore implement the *note tp_iternext: 18a8.
     handler.

Any *note iterator: 6d4. object should implement both *note tp_iter:
18a7. and *note tp_iternext: 18a8.  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: fbe. '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.4.6 弱参照(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: 11d. module.

For an object to be weakly referenceable, the extension type must set
the ‘Py_TPFLAGS_MANAGED_WEAKREF’ bit of the *note tp_flags: 1e87. field.
The legacy *note tp_weaklistoffset: d54. field should be left as zero.

If this flag is set, *note Py_TPFLAGS_HAVE_GC: 3a6. should also be set.

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(): 97f.):

     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.4.7 その他いろいろ
--------------------

In order to learn how to implement any specific method for your new data
type, get the *note CPython: ae8. 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(): 1eca.
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: Python インタプリタの拡張と埋め込み

6.5 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 拡張モジュールの定義: 5221. for details.
* Menu:

* setuptools による C および C++ 拡張のビルド::


File: python.info,  Node: setuptools による C および C++ 拡張のビルド,  Up: C および C++ 拡張のビルド

6.5.1 setuptools による C および C++ 拡張のビルド
-------------------------------------------------

拡張モジュールのビルド、パッケージ化および配布には、サードパーティのツー
ルが最適であり、このドキュメントの範囲外です。適切なツールの一つは
Setuptools であり、ドキュメントは
‘https://setuptools.pypa.io/en/latest/setuptools.html’ にあります。

The *note distutils: 3c. 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++ 拡張モジュールのビルド,  Next: 他のアプリケーションへの Python の埋め込み,  Prev: C および C++ 拡張のビルド,  Up: Python インタプリタの拡張と埋め込み

6.6 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.6.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++ 拡張のビルド: 12ab.  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/main/PCbuild/winsound.vcxproj


File: python.info,  Node: Unix と Windows の相違点,  Next: DLL 使用の実際,  Prev: 型どおりのアプローチ,  Up: Windows 上での C および C++ 拡張モジュールのビルド

6.6.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.6.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:
     522c. 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(): 3b9.), 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: 65e. 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():
     3b9. のような) 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 の埋め込み,  Next: おすすめのサードパーティツール,  Prev: Windows 上での C および C++ 拡張モジュールのビルド,  Up: Python インタプリタの拡張と埋め込み

6.7 他のアプリケーションへの 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(): 67a. を呼び出さねばなりません。オプションとして、Python
側にコマンドライン引数を渡すために関数呼び出しを行います。その後、アプリ
ケーションのどこでもインタプリタを呼び出せるようになります。

インタプリタを呼び出すには、異なるいくつかの方法があります: Python 文が
入った文字列を *note PyRun_SimpleString(): 5230. に渡す、 stdio ファイル
ポインタとファイル名 (これはエラーメッセージ内でコードを識別するためだけ
のものです) を *note PyRun_SimpleFile(): 5231. に渡す、といった具合です
。これまでの各章で説明した低水準の操作を呼び出して、Python オブジェクト
を構築したり使用したりもできます。

参考
....

*note Python/C API reference manual: 21ca.

     Python C インターフェースの詳細はこのマニュアルに書かれています。必
     要な情報の大部分はここにあるはずです。

* Menu:

* 高水準の埋め込み::
* 超高水準の埋め込みから踏み出す; 概要: 超高水準の埋め込みから踏み出す 概要.
* 純粋な埋め込み::
* 埋め込まれた Python の拡張::
* C++による Python の埋め込み::
* Unix 系システムにおけるコンパイルとリンク::


File: python.info,  Node: 高水準の埋め込み,  Next: 超高水準の埋め込みから踏み出す 概要,  Up: 他のアプリケーションへの Python の埋め込み

6.7.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 文字列とバッファ:
     825. にあります。

Setting *note PyConfig.program_name: 60f. should be called before *note
Py_InitializeFromConfig(): 611. to inform the interpreter about paths to
Python run-time libraries.  Next, the Python interpreter is initialized
with *note Py_Initialize(): 67a, followed by the execution of a
hard-coded Python script that prints the date and time.  Afterwards, the
*note Py_FinalizeEx(): 10d3. 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(): 5231. function, which saves
you the trouble of allocating memory space and loading the file
contents.


File: python.info,  Node: 超高水準の埋め込みから踏み出す 概要,  Next: 純粋な埋め込み,  Prev: 高水準の埋め込み,  Up: 他のアプリケーションへの Python の埋め込み

6.7.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.7.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 コンパイルしてリンク: 5238. し
(できた実行可能形式を ‘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(): 17b4.  This routine needs a Python string as its
argument, which is constructed using the *note
PyUnicode_DecodeFSDefault(): 1cad. 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():
7ec. を使って必要な名前を取得できます。名前がスクリプト中に存在し、取得
したオブジェクトが呼び出し可能オブジェクトであれば、このオブジェクトが関
数であると考えて差し支えないでしょう。そこでプログラムは定石どおりに引数
のタプル構築に進みます。その後、Python 関数を以下のコードで呼び出します:

     pValue = PyObject_CallObject(pFunc, pArgs);

関数が処理を戻す際、 ‘pValue’ は ‘NULL’ になるか、関数の戻り値への参照が
入っています。値を調べた後には忘れずに参照を解放してください。


File: python.info,  Node: 埋め込まれた Python の拡張,  Next: C++による Python の埋め込み,  Prev: 純粋な埋め込み,  Up: 他のアプリケーションへの Python の埋め込み

6.7.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(): 67a. の呼び出しの前に挿入します:

     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.7.5 C++による Python の埋め込み
---------------------------------

C++ プログラム中にも Python を埋め込めます; 厳密に言うと、どうやって埋め
込むかは使っているC++ 処理系の詳細に依存します; 一般的には、メインプログ
ラムをC++で書き、C++ コンパイラを使ってプログラムをコンパイル・リンクす
る必要があるでしょう。 Python 自体を C++でコンパイルしなおす必要はありま
せん。


File: python.info,  Node: Unix 系システムにおけるコンパイルとリンク,  Prev: C++による Python の埋め込み,  Up: 他のアプリケーションへの Python の埋め込み

6.7.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:
523e. は歓迎です)、あなたのシステムのダイナミックリンクについてのドキュ
メントを読み、Python の ‘Makefile’ のコンパイルオプションを調べる必要が
あるでしょう(Makefile の場所を調べるには *note
sysconfig.get_makefile_filename(): 4c63. を使ってください)。この場合、
*note sysconfig: e4. モジュールが役に立つ道具になります。これによってあ
なたが付け加えたいコンパイル・リンクのオプション構成をプログラム的に抽出
できます。例えば:

     >>> import sysconfig
     >>> sysconfig.get_config_var('LIBS')
     '-lpthread -ldl  -lutil'
     >>> sysconfig.get_config_var('LINKFORSHARED')
     '-Xlinker -export-dynamic'


File: python.info,  Node: おすすめのサードパーティツール,  Next: C API Tutorial,  Prev: 他のアプリケーションへの Python の埋め込み,  Up: Python インタプリタの拡張と埋め込み

6.8 おすすめのサードパーティツール
==================================

This document only covers the basic tools for creating extensions
provided as part of this version of CPython.  Some *note third party
tools: 51a7. offer both simpler and more sophisticated approaches to
creating C and C++ extensions for Python.

While this document is aimed at extension authors, it should also be
helpful to the authors of such tools.  For example, the tutorial module
can serve as a simple test case for a build tool or sample expected
output of a code generator.


File: python.info,  Node: C API Tutorial,  Next: Guides for intermediate topics,  Prev: おすすめのサードパーティツール,  Up: Python インタプリタの拡張と埋め込み

6.9 C API Tutorial
==================

This tutorial describes how to write a simple module in C or C++, using
the Python C API - that is, using the basic tools provided as part of
this version of CPython.

  1. *note Your first C API extension module: 51a5.


File: python.info,  Node: Guides for intermediate topics,  Next: 大規模なアプリケーションへの Python ランタイムの埋め込み,  Prev: C API Tutorial,  Up: Python インタプリタの拡張と埋め込み

6.10 Guides for intermediate topics
===================================

ガイドのこの節ではサードパーティツールの補助無しに C および C++ 拡張を作
成する方法を説明します。 これは自分自身の C 拡張を作成するおすすめの方法
というよりも、主にそれらのツールを作成する人向けのものです。

   * *note Using the C API; Assorted topics: 51bf.

   * *note 拡張の型の定義; チュートリアル: 51eb.

   * *note 拡張の型の定義; 雑多なトピック: 5202.

   * *note C および C++ 拡張のビルド: 521e.

   * *note Windows 上での C および C++ 拡張モジュールのビルド: 2434.


File: python.info,  Node: 大規模なアプリケーションへの Python ランタイムの埋め込み,  Prev: Guides for intermediate topics,  Up: Python インタプリタの拡張と埋め込み

6.11 大規模なアプリケーションへの Python ランタイムの埋め込み
=============================================================

Python インタープリタの中でメインアプリケーションとして実行される拡張を
作るのではなく、 CPython をより大きなアプリケーションの中に埋め込む方が
望ましいことがあります。 この節ではその上手い埋め込みに関わる詳細につい
て説明します。

   * *note 他のアプリケーションへの Python の埋め込み: 246b.


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 インタプリタの拡張と埋め込み: 21c9. は拡張モ
ジュールを書く際の一般的な決まりごとについて記述していますが、 API の詳
細までは記述していないので、このドキュメントが手引きになります。

* Menu:

* はじめに: はじめに<14>.
* C API and ABI Stability::
* 超高水準レイヤ::
* 参照カウント::
* 例外処理::
* 拡張モジュールの定義::
* Definition slots::
* ユーティリティ: ユーティリティ<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 and ABI 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:

* 言語バージョン互換性::
* コーディング基準::
* インクルードファイル::
* 便利なマクロ::
* オブジェクト、型および参照カウント::
* 例外: 例外<25>.
* 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
     引数の解釈と値の構築: 608. を参照してください。

Python.h で定義されている、ユーザから見える名前全て (Python.h がインクル
ードしている標準ヘッダの名前は除きます) には、接頭文字列 ‘Py’ または
‘_Py’ が付きます。‘_Py’ で始まる名前は Python 実装で内部使用するための名
前で、拡張モジュールの作者は使ってはなりません。構造体のメンバには予約済
みの接頭文字列はありません。

     注釈: API のユーザは、‘Py’ や ‘_Py’ で始まる名前を定義するコードを
     絶対に書いてはなりません。 後からコードを読む人を混乱させたり、将来
     の Python のバージョンで同じ名前が定義されて、ユーザの書いたコード
     の可搬性を危うくする可能性があります。

ヘッダファイル群は通常 Python と共にインストールされます。 Unixでは
‘`prefix'/include/pythonversion/’ および
‘`exec_prefix'/include/pythonversion/’ に置かれます。 *note prefix:
235b. と *note exec_prefix: 235c. は Python をビルドする際の ‘configure’
スクリプトに与えたパラメタに対応し、 'version' は ‘'%d.%d' %
sys.version_info[:2]’ に対応します。 Windows では、ヘッダは
‘`prefix'/include’ に置かれます。 ‘prefix’ はインストーラに指定したイン
ストールディレクトリです。

ヘッダをインクルードするには、各ヘッダの入ったディレクトリ (別々のディレ
クトリの場合は両方) を、コンパイラがインクルードファイルを検索するための
パスに入れます。親ディレクトリをサーチパスに入れて、 ‘#include
<pythonX.Y/Python.h>’ のようにしては 'なりません' ; *note prefix: 235b.
内のプラットフォームに依存しないヘッダは、 *note exec_prefix: 235c. から
プラットフォーム依存のヘッダをインクルードしているので、このような操作を
行うと複数のプラットフォームでのビルドができなくなります。

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++.

* Menu:

* System includes::


File: python.info,  Node: System includes,  Up: インクルードファイル

7.1.3.1 System includes
.......................

     ‘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.  The implicit includes are:

        * ‘<assert.h>’

        * ‘<intrin.h>’ (on Windows)

        * ‘<inttypes.h>’

        * ‘<limits.h>’

        * ‘<math.h>’

        * ‘<stdarg.h>’

        * ‘<string.h>’

        * ‘<wchar.h>’

        * ‘<sys/types.h>’ (if present)

     The following are included for backwards compatibility, unless
     using *note Limited API: 82f. 3.13 or newer:

        * ‘<ctype.h>’

        * ‘<unistd.h>’ (on POSIX)

     The following are included for backwards compatibility, unless
     using *note Limited API: 82f. 3.11 or newer:

        * ‘<errno.h>’

        * ‘<stdio.h>’

        * ‘<stdlib.h>’

     注釈: Python は、システムによっては標準ヘッダの定義に影響するような
     プリプロセッサ定義を行っているので、 ‘Python.h’ をいずれの標準ヘッ
     ダよりも前にインクルード 'せねばなりません' 。


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: 182b, *note PyMODINIT_FUNC: 188b.).  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: d2b. was passed
     on the command line (see *note PyConfig.use_environment: 625.).

* 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:
     23ad.), 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: 23ad.).

     以下はプログラム例です:

          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(): d4f.

     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(): d4f. 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: 1a0b. 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: 3e3. (if the *note
     Py_DEBUG: 1a0b. macro is defined), the *note Py_ALWAYS_INLINE:
     1e81. 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: 1802. 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 *note soft deprecated: 1b2. macros have been used to
features that have been standardized in C11 (or previous standards).

 -- C のマクロ: Py_ALIGNED (num)

     On some GCC-like compilers, specify alignment to 'num' bytes.  This
     does nothing on other compilers.

     Use the standard ‘alignas’ specifier rather than this macro.

     *note Soft deprecated: 1b2. since version 3.15.

 -- C のマクロ: PY_FORMAT_SIZE_T

     The ‘printf()’ formatting modifier for ‘size_t’.  Use ‘"z"’
     directly instead.

     *note Soft deprecated: 1b2. since version 3.15.

 -- 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.

     *note Soft deprecated: 1b2. since version 3.15.

 -- C のマクロ: PY_LONG_LONG
 -- C のマクロ: PY_INT32_T
 -- C のマクロ: PY_UINT32_T
 -- C のマクロ: PY_INT64_T
 -- C のマクロ: PY_UINT64_T

     Aliases for the types ‘long long’, ‘int32_t’, ‘uint32_t’.
     ‘int64_t’ and ‘uint64_t’, respectively.  Historically, these types
     needed compiler-specific extensions.

     *note Soft deprecated: 1b2. since version 3.15.

 -- C のマクロ: PY_LLONG_MIN
 -- C のマクロ: PY_LLONG_MAX
 -- C のマクロ: PY_ULLONG_MAX
 -- C のマクロ: PY_SIZE_MAX

     Aliases for the values ‘LLONG_MIN’, ‘LLONG_MAX’, ‘ULLONG_MAX’, and
     ‘SIZE_MAX’, respectively.  Use these standard names instead.

     The required header, ‘<limits.h>’, *note is included: 51aa. in
     ‘Python.h’.

     *note Soft deprecated: 1b2. since version 3.15.

 -- C のマクロ: Py_MEMCPY (dest, src, n)

     This is an alias to ‘memcpy()’.

     *note Soft deprecated: 1b2. since version 3.14: Use ‘memcpy()’
     directly instead.

 -- C のマクロ: Py_UNICODE_SIZE

     Size of the ‘wchar_t’ type.  Use ‘sizeof(wchar_t)’ or
     ‘WCHAR_WIDTH/8’ instead.

     The required header for the latter, ‘<limits.h>’, *note is
     included: 51aa. in ‘Python.h’.

     *note Soft deprecated: 1b2. since version 3.15.

 -- C のマクロ: Py_UNICODE_WIDE

     Defined if ‘wchar_t’ can hold a Unicode character (UCS-4).  Use
     ‘sizeof(wchar_t) >= 4’ instead

     *note Soft deprecated: 1b2. since version 3.15.

 -- C のマクロ: Py_VA_COPY

     This is an 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’.

     *note Soft deprecated: 1b2. since version 3.15.


File: python.info,  Node: オブジェクト、型および参照カウント,  Next: 例外<25>,  Prev: 便利なマクロ,  Up: はじめに<14>

7.1.5 オブジェクト、型および参照カウント
----------------------------------------

Python/C API 関数は、 *note PyObject: 1a6.* 型の一つ以上の引数と戻り値を
持ちます。この型は、任意の Python オブジェクトを表現する不透明 (opaque)
なデータ型へのポインタです。 Python 言語は、全ての Python オブジェクト型
をほとんどの状況 (例えば代入、スコープ規則 (scope rule)、引数渡し) で同
様に扱います。ほとんど全ての Python オブジェクトはヒープ (heap) 上に置か
れます: このため、 *note PyObject: 1a6. 型のオブジェクトは、自動記憶
(automatic) としても静的記憶 (static) としても宣言できません。 PyObject*
型のポインタ変数のみ宣言できます。唯一の例外は、型オブジェクトです; 型オ
ブジェクトはメモリ解放 (deallocate) してはならないので、通常は静的記憶の
*note PyTypeObject: e6f. オブジェクトにします。

全ての Python オブジェクトには (Python 整数型ですら) 型 ('type') と参照
カウント ('reference count') があります。あるオブジェクトの型は、そのオ
ブジェクトがどの種類のオブジェクトか (例えば整数、リスト、ユーザ定義関数
、など; その他多数については *note 標準型の階層: 253e. で説明しています)
を決定します。よく知られている型については、各々マクロが存在して、あるオ
ブジェクトがその型かどうか調べられます; 例えば、 ‘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: 7e0. 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(): 979. to take a new reference to an
object (i.e.  increment its reference count by one), and *note
Py_DECREF(): 97a. 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: 7e0. (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(): 97a, 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: 7e0. (i.e.  increment the reference count) of the object they
return.  This leaves the caller with the responsibility to call *note
Py_DECREF(): 97a. 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(): 97a. or *note Py_XDECREF(): b73. 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: 60a.

逆に、ある関数呼び出しで、あるオブジェクトへの参照を呼び出される関数に渡
す際には、二つの可能性: 関数がオブジェクトへの参照を '盗み取る' (steal)
場合と、そうでない場合があります。'参照を盗む' とは、関数に参照を渡した
ときに、参照の所有者がその関数になったと仮定し、関数の呼び出し元には所有
権がなくなるということです。

参照を盗み取る関数はほとんどありません; 例外としてよく知られているのは、
*note PyList_SetItem(): 1afa. と *note PyTuple_SetItem(): 51de. で、これ
らはシーケンスに入れる要素に対する参照を盗み取ります (しかし、要素の入る
先のタプルやリストの参照は盗み取りません!)。これらの関数は、リストやタプ
ルの中に新たに作成されたオブジェクトを入れていく際の常套的な書き方をしや
すくするために、参照を盗み取るように設計されています; 例えば、 ‘(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(): 1de9. は新しい参照を返し、すぐに *note
PyTuple_SetItem(): 51de. に盗まれます。参照が盗まれた後もそのオブジェク
トを利用したい場合は、参照盗む関数を呼び出す前に、 *note Py_INCREF():
979. を利用してもう一つの参照を取得してください。

ちなみに、 *note PyTuple_SetItem(): 51de. はタプルに値をセットするための
'唯一の' 方法です; タプルは変更不能なデータ型なので、 *note
PySequence_SetItem(): 2041. や *note PyObject_SetItem(): 526e. を使うと
上の操作は拒否されてしまいます。自分でタプルの値を入れていくつもりなら、
‘PyTuple_SetItem()’ だけしか使えません。

同じく、リストに値を入れていくコードは *note PyList_New(): 526f. と
*note PyList_SetItem(): 1afa. で書けます。

しかし実際には、タプルやリストを生成して値を入れる際には、上記のような方
法はほとんど使いません。より汎用性のある関数、 *note Py_BuildValue():
5f5. があり、ほとんどの主要なオブジェクトをフォーマット文字列 '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(): 526e. 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():
7e8. や *note PySequence_GetItem(): 2040. のように、オブジェクトに対する
参照を返す汎用の関数は、常に新たな参照を返します (呼び出し側が参照の所有
者になります)。

重要なのは、関数が返す参照の所有権を持てるかどうかは、どの関数を呼び出す
かだけによる、と理解することです -- 関数呼び出し時の 'お飾り' (関数に引
数として渡したオブジェクトの型) は 'この問題には関係ありません!'  従って
、 *note PyList_GetItem(): 7fb. を使ってリスト内の要素を得た場合には、参
照の所有者にはなりません -- が、同じ要素を同じリストから *note
PySequence_GetItem(): 2040. (図らずもこの関数は全く同じ引数をとります) を
使って取り出すと、返されたオブジェクトに対する参照を得ます。

以下は、整数からなるリストに対して各要素の合計を計算する関数をどのように
して書けるかを示した例です; 一つは *note PyList_GetItem(): 7fb. を使って
いて、もう一つは *note PySequence_GetItem(): 2040. を使っています。

     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: 961.'  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: e28.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0353/


File: python.info,  Node: 例外<25>,  Next: Python の埋め込み<2>,  Prev: オブジェクト、型および参照カウント,  Up: はじめに<14>

7.1.6 例外
----------

Python プログラマは、特定のエラー処理が必要なときだけしか例外を扱う必要
はありません; 処理しなかった例外は、処理の呼び出し側、そのまた呼び出し側
、といった具合に、トップレベルのインタプリタ層まで自動的に伝播します。イ
ンタプリタ層は、スタックトレースバックと合わせて例外をユーザに報告します
。

ところが、 C プログラマの場合、エラーチェックは常に明示的に行わねばなり
ません。 Python/C API の全ての関数は、関数のドキュメントで明確に説明がな
い限り例外を発行する可能性があります。一般的な話として、ある関数が何らか
のエラーに遭遇すると、関数は例外を設定して、関数内における参照の所有権を
全て放棄し、エラー値 (error indicator) を返します。ドキュメントに書かれ
てない場合、このエラー値は関数の戻り値の型によって、 ‘NULL’ か ‘-1’ のど
ちらかになります。いくつかの関数ではブール型で真/偽を返し、偽はエラーを
示します。きわめて少数の関数では明確なエラー指標を返さなかったり、あいま
いな戻り値を返したりするので、 *note PyErr_Occurred(): 1ec4. で明示的に
エラーテストを行う必要があります。これらの例外は常に明示的にドキュメント
化されます。

例外時の状態情報 (exception state)は、スレッド単位に用意された記憶領域
(per-thread storage) 内で管理されます (この記憶領域は、スレッドを使わな
いアプリケーションではグローバルな記憶領域と同じです)。一つのスレッドは
二つの状態のどちらか: 例外が発生したか、まだ発生していないか、をとります
。関数 *note PyErr_Occurred(): 1ec4. を使うと、この状態を調べられます: こ
の関数は例外が発生した際にはその例外型オブジェクトに対する借用参照
(borrowed reference) を返し、そうでないときには ‘NULL’ を返します。例外
状態を設定する関数は数多くあります: *note PyErr_SetString(): 985. はもっ
ともよく知られている (が、もっとも汎用性のない) 例外を設定するための関数
で、 *note PyErr_Clear(): 13dd. は例外状態情報を消し去る関数です。

完全な例外状態情報は、3 つのオブジェクト: 例外の型、例外の値、そしてトレ
ースバック、からなります (どのオブジェクトも ‘NULL’ を取り得ます)。これ
らの情報は、 Python の ‘sys.exc_info()’ の結果と同じ意味を持ちます; とは
いえ、 C と Python の例外状態情報は全く同じではありません: Python におけ
る例外オブジェクトは、Python の *note try: adb. ...  *note except: 44e.
文で最近処理したオブジェクトを表す一方、 C レベルの例外状態情報が存続す
るのは、渡された例外情報を ‘sys.exc_info()’ その他に転送するよう取り計ら
う Python のバイトコードインタプリタのメインループに到達するまで、例外が
関数の間で受け渡しされている間だけです。

Python 1.5 からは、Python で書かれたコードから例外状態情報にアクセスする
方法として、推奨されていてスレッドセーフな方法は *note sys.exc_info():
a7f. になっているので注意してください。この関数は 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(): 5274.
および *note PyErr_Clear(): 13dd. をどう使うかを示しています。また、所有
権を持っている参照で、値が ‘NULL’ になるかもしれないものを捨てるために
*note Py_XDECREF(): b73. をどう使うかも示しています (関数名に ‘'X'’ が付
いていることに注意してください; *note Py_DECREF(): 97a. は ‘NULL’ 参照に
出くわすとクラッシュします)。正しく動作させるためには、所有権を持つ参照
を保持するための変数を ‘NULL’ で初期化することが重要です; 同様に、あらか
じめ戻り値を定義する際には値を ‘-1’ (失敗) で初期化しておいて、最後の関
数呼び出しまでうまくいった場合にのみ ‘0’ (成功) に設定します。


File: python.info,  Node: Python の埋め込み<2>,  Next: デバッグ版ビルド Debugging Builds,  Prev: 例外<25>,  Up: はじめに<14>

7.1.7 Python の埋め込み
-----------------------

Python インタプリタの埋め込みを行う人 (いわば拡張モジュールの書き手の対
極) が気にかけなければならない重要なタスクは、Python インタプリタの初期
化処理 (initialization)、そしておそらくは終了処理 (finalization) です。
インタプリタのほとんどの機能は、インタプリタの起動後しか使えません。

基本的な初期化処理を行う関数は *note Py_Initialize(): 67a. です。この関
数はロード済みのモジュールからなるテーブルを作成し、土台となるモジュール
*note builtins: 13, *note __main__: 1, および *note sys: e2. を作成しま
す。また、モジュール検索パス (‘sys.path’) の初期化も行います。

*note Py_Initialize(): 67a. 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: 60e. and *note
PyConfig.parse_argv: 1f05. must be set: see *note Python Initialization
Configuration: 83d.

ほとんどのシステムでは (特に Unix と Windows は、詳細がわずかに異なりは
しますが)、 *note Py_Initialize(): 67a. は標準の 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: 3b5. を設定することでこの動作をオーバーライドしたり、 *note
PYTHONPATH: 13cb. を設定して追加のディレクトリを標準モジュール検索パスの
前に挿入したりできます。

The embedding application can steer the search by setting *note
PyConfig.program_name: 60f. 'before' calling *note
Py_InitializeFromConfig(): 611.  Note that *note PYTHONHOME: 3b5. still
overrides this and *note PYTHONPATH: 13cb. is still inserted in front of
the standard path.

たまに、 Python を初期化前の状態にもどしたいことがあります。例えば、ある
アプリケーションでは実行を最初からやりなおし (start over) させる (*note
Py_Initialize(): 67a. をもう一度呼び出させる) ようにしたいかもしれません
。あるいは、アプリケーションが Python を一旦使い終えて、Python が確保し
たメモリを解放させたいかもしれません。 *note Py_FinalizeEx(): 10d3. を使
うとこうした処理を実現できます。また、関数 *note Py_IsInitialized():
1940. は、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: 3e3.

On Unix, ‘Py_DEBUG’ can be enabled by adding *note -with-pydebug: 859.
to the ‘./configure’ command.  This will also disable compiler
optimization.

On Windows, selecting a debug build (e.g., by passing the *note -d:
2331. option to ‘PCbuild/build.bat’) automatically enables ‘Py_DEBUG’.
Additionally, the presence of the not-Python-specific ‘_DEBUG’ macro,
when defined by the compiler, will also implicitly enable ‘Py_DEBUG’.

In addition to the reference count debugging described below, extra
checks are performed.  See *note Python Debug Build: 3e3. for more
details.

‘Py_TRACE_REFS’ を宣言すると、参照トレースが有効になります (*note
configure -with-trace-refs オプション: 82e. を参照してください)。全ての
*note PyObject: 1a6. に二つのフィールドを追加することで、使用中のオブジ
ェクトの循環二重連結リストが管理されます。全ての割り当て(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 and ABI Stability,  Next: 超高水準レイヤ,  Prev: はじめに<14>,  Up: Python/C API reference manual

7.2 C API and ABI 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 プラットフォームで考慮すべき点: 527d. 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: 959, may change in minor versions without a
     deprecation period.  It is marked by the ‘PyUnstable’ prefix in
     names.

   - *note Limited API: 82f, is compatible across several minor
     releases.  When *note Py_LIMITED_API: 853. 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 Interfaces::
* プラットフォームで考慮すべき点::
* ABI Checking::
* 限定版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 Interfaces,  Up: C API and ABI 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 Interfaces,  Next: プラットフォームで考慮すべき点,  Prev: Unstable C API,  Up: C API and ABI Stability

7.2.2 Stable Application Binary Interfaces
------------------------------------------

Python's 'Stable ABI' allows extensions to be compatible with multiple
versions of Python, without recompilation.

     注釈: For simplicity, this document talks about 'extensions', but
     Stable ABI works the same way for all uses of the API – for
     example, embedding Python.

There are two Stable ABIs:

   - ‘abi3’, introduced in Python 3.2, is compatible with 'non'-*note
     free-threaded: 1a3. builds of CPython.

   - ‘abi3t’, introduced in Python 3.15, is compatible with *note
     free-threaded: 1a3. builds of CPython.  It has stricter API
     limitations than ‘abi3’.

          Added in version 3.15: ‘abi3t’ was added in PEP 803(1)

It is possible for an extension to be compiled for 'both' ‘abi3’ and
‘abi3t’ at the same time; the result will be compatible with both
free-threaded and non-free-threaded builds of Python.  Currently, this
has no downsides compared to compiling for ‘abi3t’ only.

Each Stable ABI is versioned using the first two numbers of the Python
version.  For example, Stable ABI 3.14 corresponds to Python 3.14.  An
extension compiled for Stable ABI 3.x is ABI-compatible with Python 3.x
and above.

Extensions that target a stable ABI must only use a limited subset of
the C API. This subset is known as the 'Limited API'; its contents are
*note listed below: b7e.

On Windows, extensions that use a Stable ABI should be linked against
‘python3.dll’ rather than a version-specific library such as
‘python39.dll’.  This library only exposes the relevant symbols.

On some platforms, Python will look for and load shared library files
named with the ‘abi3’ or ‘abi3t’ tag (for example, ‘mymodule.abi3.so’).
*note Free-threaded: 1a3. interpreters only recognize the ‘abi3t’ tag,
while non-free-threaded ones will prefer ‘abi3’ but fall back to
‘abi3t’.  Thus, extensions compatible with both ABIs should use the
‘abi3t’ tag.

Python does not necessarily check that extensions it loads have
compatible ABI. Extension authors are encouraged to add a check using
the *note Py_mod_abi: 360. slot or the *note PyABIInfo_Check(): 361.
function, but the user (or their packaging tool) is ultimately
responsible for ensuring that, for example, extensions built for Stable
ABI 3.10 are not installed for lower versions of Python.

All functions in Stable ABI are present as functions in Python's shared
library, not solely as macros.  This makes them usable in languages that
don't use the C preprocessor, including Python's *note ctypes: 2d.

* Menu:

* Compiling for Stable ABI::
* Stable ABI Scope and Performance::
* Stable ABI Caveats::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0803/


File: python.info,  Node: Compiling for Stable ABI,  Next: Stable ABI Scope and Performance,  Up: Stable Application Binary Interfaces

7.2.2.1 Compiling for Stable ABI
................................

     注釈: Build tools (such as, for example, meson-python,
     scikit-build-core, or Setuptools) often have a mechanism for
     setting macros and synchronizing them with extension filenames and
     other metadata.  Prefer using such a mechanism, if it exists, over
     defining the macros manually.

     The rest of this section is mainly relevant for tool authors, and
     for people who compile extensions manually.

     参考
     ....

     list of recommended tools(1) in the Python Packaging User Guide

To compile for a Stable ABI, define one or both of the following macros
to the lowest Python version your extension should support, in *note
Py_PACK_VERSION: 5b3. format.  Typically, you should choose a specific
value rather than the version of the Python headers you are compiling
against.

The macros must be defined before including ‘Python.h’.  Since *note
Py_PACK_VERSION: 5b3. is not available at this point, you will need to
use the numeric value directly.  For reference, the values for a few
recent Python versions are:

     0x30b0000  /* Py_PACK_VERSION(3.11) */
     0x30c0000  /* Py_PACK_VERSION(3.12) */
     0x30d0000  /* Py_PACK_VERSION(3.13) */
     0x30e0000  /* Py_PACK_VERSION(3.14) */
     0x30f0000  /* Py_PACK_VERSION(3.15) */
     0x3100000  /* Py_PACK_VERSION(3.16) */

When one of the macros is defined, ‘Python.h’ will only expose API that
is compatible with the given Stable ABI - that is, the *note Limited
API: b7e. plus some definitions that need to be visible to the compiler
but should not be used directly.  When both are defined, ‘Python.h’ will
only expose API compatible with both Stable ABIs.

 -- C のマクロ: Py_LIMITED_API

     Target ‘abi3’, that is, non-*note free-threaded builds: 1a3. of
     CPython.  See *note above: 1a9. for common information.

 -- C のマクロ: Py_TARGET_ABI3T

     Target ‘abi3t’, that is, *note free-threaded builds: 1a3. of
     CPython.  See *note above: 1a9. for common information.

     Added in version 3.15.

Both macros specify a target ABI; the different naming style is due to
backwards compatibility.

     Historical note: You can also define ‘Py_LIMITED_API’ as ‘3’.  This
     works the same as ‘0x03020000’ (Python 3.2, the version that
     introduced Stable ABI).

When both are defined, ‘Python.h’ may, or may not, redefine
‘Py_LIMITED_API’ to match ‘Py_TARGET_ABI3T’.

On a *note free-threaded build: 1a3. - that is, when *note
Py_GIL_DISABLED: 193f. is defined - ‘Py_TARGET_ABI3T’ defaults to the
value of ‘Py_LIMITED_API’.  This means that there are two ways to build
for both ‘abi3’ and ‘abi3t’:

   - define both ‘Py_LIMITED_API’ and ‘Py_TARGET_ABI3T’, or

   - define only ‘Py_LIMITED_API’ and:

        - on Windows, define ‘Py_GIL_DISABLED’;

        - on other systems, use the headers of free-threaded build of
          Python.

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/guides/tool-recommendations/#build-backends-for-extension-modules


File: python.info,  Node: Stable ABI Scope and Performance,  Next: Stable ABI Caveats,  Prev: Compiling for Stable ABI,  Up: Stable Application Binary Interfaces

7.2.2.2 Stable ABI Scope and Performance
........................................

The goal for Stable ABI is to allow everything that is possible with the
full C API, but possibly with a performance penalty.  Generally,
compatibility with Stable ABI will require some changes to an
extension's source code.

For example, while *note PyList_GetItem(): 7fb. is available, its
"unsafe" macro variant *note PyList_GET_ITEM(): 5284. is not.  The macro
can be faster because it can rely on version-specific implementation
details of the list object.

For another example, when 'not' compiling for Stable ABI, some C API
functions are inlined or replaced by macros.  Compiling for Stable ABI
disables this inlining, allowing stability as Python's data structures
are improved, but possibly reducing performance.

By leaving out the ‘Py_LIMITED_API’ or ‘Py_TARGET_ABI3T’ definition, it
is possible to compile Stable-ABI-compatible source for a
version-specific ABI. A potentially faster version-specific extension
can then be distributed alongside a version compiled for Stable ABI - a
slower but more compatible fallback.


File: python.info,  Node: Stable ABI Caveats,  Prev: Stable ABI Scope and Performance,  Up: Stable Application Binary Interfaces

7.2.2.3 Stable ABI Caveats
..........................

Note that compiling for Stable ABI is 'not' a complete guarantee that
code will be compatible with the expected Python versions.  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.

One issue that the *note Py_TARGET_ABI3T: 5281. and *note
Py_LIMITED_API: 853. macros do 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.

For these reasons, we recommend testing an extension with 'all' minor
Python versions it supports.

また、使用するすべての API のドキュメントを確認し、それが明示的に
Limited API の一部であるかどうかをチェックすることをお勧めします。
‘Py_LIMITED_API’ が定義されていても、技術的な理由で(あるいはバグとして意
図せず)いくつかのプライベート宣言が公開されることがあります。

Also note that while compiling with ‘Py_LIMITED_API’ 3.8 means that the
extension should 'load' on Python 3.12, and 'compile' with Python 3.12,
the same source will not necessarily compile with ‘Py_LIMITED_API’ set
to 3.12.  In general, parts of the Limited API may be deprecated and
removed, provided that Stable ABI stays stable.


File: python.info,  Node: プラットフォームで考慮すべき点,  Next: ABI Checking,  Prev: Stable Application Binary Interfaces,  Up: C API and ABI 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 ABIs: 1a2, 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 ABIs, or the version-specific ABIs.
This is the case with Windows and macOS releases from ‘python.org’ and
many third-party distributors.


File: python.info,  Node: ABI Checking,  Next: 限定版APIの内容,  Prev: プラットフォームで考慮すべき点,  Up: C API and ABI Stability

7.2.4 ABI Checking
------------------

Added in version 3.15.

Python includes a rudimentary check for ABI compatibility.

This check is not comprehensive.  It only guards against common cases of
incompatible modules being installed for the wrong interpreter.  It also
does not take *note platform incompatibilities: 527d. into account.  It
can only be done after an extension is successfully loaded.

Despite these limitations, it is recommended that extension modules use
this mechanism, so that detectable incompatibilities raise exceptions
rather than crash.

Most modules can use this check via the *note Py_mod_abi: 360. slot and
the *note PyABIInfo_VAR: 362. macro, for example like this:

     PyABIInfo_VAR(abi_info);

     static PyModuleDef_Slot mymodule_slots[] = {
        {Py_mod_abi, &abi_info},
        ...
     };

The full API is described below for advanced use cases.

 -- C の関数: int PyABIInfo_Check (PyABIInfo *info, const char
          *module_name)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Verify that the given 'info' is compatible with the currently
     running interpreter.

     Return 0 on success.  On failure, raise an exception and return -1.

     If the ABI is incompatible, the raised exception will be *note
     ImportError: 1c8.

     The 'module_name' argument can be ‘NULL’, or point to a
     NUL-terminated UTF-8-encoded string used for error messages.

     Note that if 'info' describes the ABI that the current code uses
     (as defined by *note PyABIInfo_VAR: 362, for example), using any
     other Python C API may lead to crashes.  In particular, it is not
     safe to examine the raised exception.

     Added in version 3.15.

 -- C のマクロ: PyABIInfo_VAR (NAME)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Define a static *note PyABIInfo: 5289. variable with the given
     'NAME' that describes the ABI that the current code will use.  This
     macro expands to:

          static PyABIInfo NAME = {
              1, 0,
              PyABIInfo_DEFAULT_FLAGS,
              PY_VERSION_HEX,
              PyABIInfo_DEFAULT_ABI_VERSION
          }

     Added in version 3.15.

 -- C のデータ型: type PyABIInfo
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む) (バ
     ージョン 3.15 より).'
      -- C のメンバ変数: uint8_t abiinfo_major_version

          The major version of *note PyABIInfo: 5289.  Can be set to:

             * ‘0’ to skip all checking, or

             * ‘1’ to specify this version of ‘PyABIInfo’.

      -- C のメンバ変数: uint8_t abiinfo_minor_version

          The minor version of *note PyABIInfo: 5289.  Must be set to
          ‘0’; larger values are reserved for backwards-compatible
          future versions of ‘PyABIInfo’.

      -- C のメンバ変数: uint16_t flags

          This field is usually set to the following macro:

           -- C のマクロ: PyABIInfo_DEFAULT_FLAGS
               ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 よ
               り).'  Default flags, based on current values of macros
               such as *note Py_LIMITED_API: 853. and *note
               Py_GIL_DISABLED: 193f.

          Alternately, the field can be set to the following flags,
          combined by bitwise OR. Unused bits must be set to zero.

          ABI variant - one of:

                -- C のマクロ: PyABIInfo_STABLE
                    ' 次に属します: *note Stable ABI: 961. (バージョン
                    3.15 より).'  Specifies that Stable ABI is used.

                -- C のマクロ: PyABIInfo_INTERNAL

                    Specifies ABI specific to a particular build of
                    CPython.  Internal use only.

          Free-threading compatibility - one of:

                -- C のマクロ: PyABIInfo_FREETHREADED
                    ' 次に属します: *note Stable ABI: 961. (バージョン
                    3.15 より).'  Specifies ABI compatible with *note
                    free-threaded builds: 1a3. of CPython.  (That is,
                    ones compiled with *note -disable-gil: 6ab.; with
                    ‘t’ in *note sys.abiflags: e2c.)

                -- C のマクロ: PyABIInfo_GIL
                    ' 次に属します: *note Stable ABI: 961. (バージョン
                    3.15 より).'  Specifies ABI compatible with
                    non-free-threaded builds of CPython (ones compiled
                    'without' *note -disable-gil: 6ab.).

                -- C のマクロ: PyABIInfo_FREETHREADING_AGNOSTIC
                    ' 次に属します: *note Stable ABI: 961. (バージョン
                    3.15 より).'  Specifies ABI compatible with both
                    free-threaded and non-free-threaded builds of
                    CPython, that is, both ‘abi3’ and ‘abi3t’.

      -- C のメンバ変数: uint32_t build_version

          The version of the Python headers used to build the code, in
          the format used by *note PY_VERSION_HEX: 5b6.

          This can be set to ‘0’ to skip any checks related to this
          field.  This option is meant mainly for projects that do not
          use the CPython headers directly, and do not emulate a
          specific version of them.

      -- C のメンバ変数: uint32_t abi_version

          The ABI version.

          For Stable ABI, this field should be the value of *note
          Py_LIMITED_API: 853. or *note Py_TARGET_ABI3T: 5281.  If both
          are defined, use the smaller value.  (If ‘Py_LIMITED_API’ is
          ‘3’; use *note Py_PACK_VERSION: 5b3.(3, 2) instead of ‘3’.)

          Otherwise, it should be set to *note PY_VERSION_HEX: 5b6.

          It can also be set to ‘0’ to skip any checks related to this
          field.

           -- C のマクロ: PyABIInfo_DEFAULT_ABI_VERSION
               ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 よ
               り).'  The value that should be used for this field,
               based on current values of macros such as *note
               Py_LIMITED_API: 853, *note PY_VERSION_HEX: 5b6. and *note
               Py_GIL_DISABLED: 193f.

     Added in version 3.15.


File: python.info,  Node: 限定版APIの内容,  Prev: ABI Checking,  Up: C API and ABI Stability

7.2.5 限定版APIの内容
---------------------

This is the definitive list of *note Limited API: 82f. for Python 3.16:

   * *note METH_CLASS: 188d.

   * *note METH_COEXIST: 182f.

   * *note METH_FASTCALL: 353.

   * *note METH_METHOD: d3d.

   * *note METH_NOARGS: 188c.

   * *note METH_O: 18bf.

   * *note METH_STATIC: 188e.

   * *note METH_VARARGS: 18c0.

   * *note PY_VECTORCALL_ARGUMENTS_OFFSET: 96a.

   * *note PyABIInfo: 5289.

   * *note PyABIInfo_Check(): 361.

   * *note PyABIInfo_DEFAULT_ABI_VERSION: 5295.

   * *note PyABIInfo_DEFAULT_FLAGS: 528d.

   * *note PyABIInfo_FREETHREADED: 5290.

   * *note PyABIInfo_FREETHREADING_AGNOSTIC: 5292.

   * *note PyABIInfo_GIL: 5291.

   * *note PyABIInfo_STABLE: 528e.

   * *note PyABIInfo_VAR: 362.

   * *note PyAIter_Check(): 5297.

   * *note PyArg_Parse(): 1a8b.

   * *note PyArg_ParseTuple(): 3b9.

   * *note PyArg_ParseTupleAndKeywords(): 81e.

   * *note PyArg_UnpackTuple(): 18be.

   * *note PyArg_VaParse(): 5298.

   * *note PyArg_VaParseTupleAndKeywords(): 81f.

   * *note PyArg_ValidateKeywordArguments(): 5299.

   * *note PyBUF_ANY_CONTIGUOUS: 529a.

   * *note PyBUF_CONTIG: 529b.

   * *note PyBUF_CONTIG_RO: 529c.

   * *note PyBUF_C_CONTIGUOUS: 176f.

   * *note PyBUF_FORMAT: 529d.

   * *note PyBUF_FULL: 529e.

   * *note PyBUF_FULL_RO: 529f.

   * *note PyBUF_F_CONTIGUOUS: 1770.

   * *note PyBUF_INDIRECT: 52a0.

   * *note PyBUF_MAX_NDIM: 52a1.

   * *note PyBUF_ND: 52a2.

   * *note PyBUF_READ: 1c32.

   * *note PyBUF_RECORDS: 52a3.

   * *note PyBUF_RECORDS_RO: 52a4.

   * *note PyBUF_SIMPLE: 52a5.

   * *note PyBUF_STRIDED: 52a6.

   * *note PyBUF_STRIDED_RO: 52a7.

   * *note PyBUF_STRIDES: 52a8.

   * *note PyBUF_WRITABLE: 176e.

   * *note PyBUF_WRITE: 1c33.

   * *note PyBaseObject_Type: 52a9.

   * *note PyBool_FromLong(): 52aa.

   * *note PyBool_Type: 52ab.

   * *note PyBuffer_FillContiguousStrides(): b46.

   * *note PyBuffer_FillInfo(): b47.

   * *note PyBuffer_FromContiguous(): b43.

   * *note PyBuffer_GetPointer(): b40.

   * *note PyBuffer_IsContiguous(): b45.

   * *note PyBuffer_Release(): 833.

   * *note PyBuffer_SizeFromFormat(): b41.

   * *note PyBuffer_ToContiguous(): b42.

   * *note PyByteArrayIter_Type: 52ac.

   * *note PyByteArray_AsString(): 52ad.

   * *note PyByteArray_Concat(): 52ae.

   * *note PyByteArray_FromObject(): 1761.

   * *note PyByteArray_FromStringAndSize(): 1762.

   * *note PyByteArray_Resize(): 52af.

   * *note PyByteArray_Size(): 52b0.

   * *note PyByteArray_Type: 52b1.

   * *note PyBytesIter_Type: 52b2.

   * *note PyBytes_AsString(): c61.

   * *note PyBytes_AsStringAndSize(): 52b3.

   * *note PyBytes_Concat(): 52b4.

   * *note PyBytes_ConcatAndDel(): 52b5.

   * *note PyBytes_DecodeEscape(): 52b6.

   * *note PyBytes_FromFormat(): 2019.

   * *note PyBytes_FromFormatV(): 52b7.

   * *note PyBytes_FromObject(): 52b8.

   * *note PyBytes_FromString(): 52b9.

   * *note PyBytes_FromStringAndSize(): 3ba.

   * *note PyBytes_Repr(): 52ba.

   * *note PyBytes_Size(): 52bb.

   * *note PyBytes_Type: 52bc.

   * *note PyCFunction: 1830.

   * *note PyCFunctionFast: 52bd.

   * *note PyCFunctionFastWithKeywords: 52be.

   * *note PyCFunctionWithKeywords: 52bf.

   * *note PyCFunction_GetFlags(): 52c0.

   * *note PyCFunction_GetFunction(): 52c1.

   * *note PyCFunction_GetSelf(): 52c2.

   * *note PyCFunction_New(): 1ec6.

   * *note PyCFunction_NewEx(): 1f89.

   * *note PyCFunction_Type: 52c3.

   * *note PyCMethod_New(): 1ec0.

   * *note PyCallIter_New(): 52c4.

   * *note PyCallIter_Type: 52c5.

   * *note PyCallable_Check(): 52c6.

   * *note PyCapsule_Destructor: 52c7.

   * *note PyCapsule_GetContext(): 52c8.

   * *note PyCapsule_GetDestructor(): 52c9.

   * *note PyCapsule_GetName(): 52ca.

   * *note PyCapsule_GetPointer(): 52cb.

   * *note PyCapsule_Import(): 1e26.

   * *note PyCapsule_IsValid(): 1716.

   * *note PyCapsule_New(): 51e9.

   * *note PyCapsule_SetContext(): 52cc.

   * *note PyCapsule_SetDestructor(): 52cd.

   * *note PyCapsule_SetName(): 52ce.

   * *note PyCapsule_SetPointer(): 52cf.

   * *note PyCapsule_Type: 52d0.

   * *note PyClassMethodDescr_Type: 52d1.

   * *note PyCodec_BackslashReplaceErrors(): 52d2.

   * *note PyCodec_Decode(): 3a9.

   * *note PyCodec_Decoder(): 52d3.

   * *note PyCodec_Encode(): 3aa.

   * *note PyCodec_Encoder(): 52d4.

   * *note PyCodec_IgnoreErrors(): 52d5.

   * *note PyCodec_IncrementalDecoder(): 52d6.

   * *note PyCodec_IncrementalEncoder(): 52d7.

   * *note PyCodec_KnownEncoding(): 52d8.

   * *note PyCodec_LookupError(): 52d9.

   * *note PyCodec_NameReplaceErrors(): 1263.

   * *note PyCodec_Register(): 52da.

   * *note PyCodec_RegisterError(): 52db.

   * *note PyCodec_ReplaceErrors(): 52dc.

   * *note PyCodec_StreamReader(): 52dd.

   * *note PyCodec_StreamWriter(): 52de.

   * *note PyCodec_StrictErrors(): 52df.

   * *note PyCodec_Unregister(): c71.

   * *note PyCodec_XMLCharRefReplaceErrors(): 52e0.

   * *note PyComplex_FromDoubles(): 52e1.

   * *note PyComplex_ImagAsDouble(): 1c3a.

   * *note PyComplex_RealAsDouble(): 1c39.

   * *note PyComplex_Type: 52e2.

   * *note PyCriticalSection: 370.

   * *note PyCriticalSection2: 52e3.

   * *note PyCriticalSection2_Begin(): 52e4.

   * *note PyCriticalSection2_End(): 52e5.

   * *note PyCriticalSection_Begin(): 52e6.

   * *note PyCriticalSection_End(): 52e7.

   * *note PyDescr_NewClassMethod(): 52e8.

   * *note PyDescr_NewGetSet(): 52e9.

   * *note PyDescr_NewMember(): 52ea.

   * *note PyDescr_NewMethod(): 1f88.

   * *note PyDictItems_Type: 52eb.

   * *note PyDictIterItem_Type: 52ec.

   * *note PyDictIterKey_Type: 52ed.

   * *note PyDictIterValue_Type: 52ee.

   * *note PyDictKeys_Type: 52ef.

   * *note PyDictProxy_New(): 52f0.

   * *note PyDictProxy_Type: 52f1.

   * *note PyDictRevIterItem_Type: 52f2.

   * *note PyDictRevIterKey_Type: 52f3.

   * *note PyDictRevIterValue_Type: 52f4.

   * *note PyDictValues_Type: 52f5.

   * *note PyDict_Clear(): 52f6.

   * *note PyDict_Contains(): 7dd.

   * *note PyDict_Copy(): 855.

   * *note PyDict_DelItem(): 52f7.

   * *note PyDict_DelItemString(): 52f8.

   * *note PyDict_GetItem(): 822.

   * *note PyDict_GetItemRef(): 7de.

   * *note PyDict_GetItemString(): 823.

   * *note PyDict_GetItemStringRef(): 63b.

   * *note PyDict_GetItemWithError(): 7df.

   * *note PyDict_Items(): 52f9.

   * *note PyDict_Keys(): 52fa.

   * *note PyDict_Merge(): 52fb.

   * *note PyDict_MergeFromSeq2(): 52fc.

   * *note PyDict_New(): 52fd.

   * *note PyDict_Next(): 1bbb.

   * *note PyDict_SetDefaultRef(): 7e1.

   * *note PyDict_SetItem(): 51df.

   * *note PyDict_SetItemString(): 1bba.

   * *note PyDict_Size(): 52fe.

   * *note PyDict_Type: 52ff.

   * *note PyDict_Update(): 5300.

   * *note PyDict_Values(): 5301.

   * *note PyEllipsis_Type: 5302.

   * *note PyEnum_Type: 5303.

   * *note PyErr_BadArgument(): 5304.

   * *note PyErr_BadInternalCall(): 5305.

   * *note PyErr_CheckSignals(): 885.

   * *note PyErr_Clear(): 13dd.

   * ‘PyErr_Display()’

   * *note PyErr_DisplayException(): 64f.

   * *note PyErr_ExceptionMatches(): 5274.

   * *note PyErr_Fetch(): 642.

   * *note PyErr_Format(): 1265.

   * *note PyErr_FormatV(): 1264.

   * *note PyErr_GetExcInfo(): b59.

   * *note PyErr_GetHandledException(): b56.

   * *note PyErr_GetRaisedException(): 643.

   * *note PyErr_GivenExceptionMatches(): 5306.

   * *note PyErr_NewException(): 1623.

   * *note PyErr_NewExceptionWithDoc(): 1622.

   * *note PyErr_NoMemory(): 51c6.

   * *note PyErr_NormalizeException(): 644.

   * *note PyErr_Occurred(): 1ec4.

   * *note PyErr_Print(): 1f40.

   * *note PyErr_PrintEx(): 5307.

   * *note PyErr_ProgramText(): 5308.

   * *note PyErr_ResourceWarning(): 10d5.

   * *note PyErr_Restore(): 645.

   * *note PyErr_SetExcFromWindowsErr(): 5309.

   * *note PyErr_SetExcFromWindowsErrWithFilename(): 1cab.

   * *note PyErr_SetExcFromWindowsErrWithFilenameObject(): 530a.

   * *note PyErr_SetExcFromWindowsErrWithFilenameObjects(): 530b.

   * *note PyErr_SetExcInfo(): b58.

   * *note PyErr_SetFromErrno(): 51c5.

   * *note PyErr_SetFromErrnoWithFilename(): 1caa.

   * *note PyErr_SetFromErrnoWithFilenameObject(): 530c.

   * *note PyErr_SetFromErrnoWithFilenameObjects(): 530d.

   * *note PyErr_SetFromWindowsErr(): 530e.

   * *note PyErr_SetFromWindowsErrWithFilename(): 1cac.

   * *note PyErr_SetHandledException(): b57.

   * *note PyErr_SetImportError(): 10f9.

   * *note PyErr_SetImportErrorSubclass(): 10d4.

   * *note PyErr_SetInterrupt(): 530f.

   * *note PyErr_SetInterruptEx(): c78.

   * *note PyErr_SetNone(): 5310.

   * *note PyErr_SetObject(): 984.

   * *note PyErr_SetRaisedException(): 646.

   * *note PyErr_SetString(): 985.

   * *note PyErr_SyntaxLocation(): 5311.

   * *note PyErr_SyntaxLocationEx(): 5312.

   * *note PyErr_WarnEx(): 1804.

   * *note PyErr_WarnExplicit(): 1cb2.

   * *note PyErr_WarnFormat(): 5313.

   * *note PyErr_WriteUnraisable(): 7ee.

   * *note PyEval_AcquireThread(): 840.

   * *note PyEval_EvalCode(): c60.

   * *note PyEval_EvalCodeEx(): 1cf8.

   * *note PyEval_EvalFrame(): 5314.

   * *note PyEval_EvalFrameEx(): 13da.

   * *note PyEval_GetBuiltins(): 7f0.

   * *note PyEval_GetFrame(): 1d56.

   * *note PyEval_GetFrameBuiltins(): 7ef.

   * *note PyEval_GetFrameGlobals(): 7f1.

   * *note PyEval_GetFrameLocals(): 7f3.

   * *note PyEval_GetFuncDesc(): 5315.

   * *note PyEval_GetFuncName(): 5316.

   * *note PyEval_GetGlobals(): 7f2.

   * *note PyEval_GetLocals(): 7f4.

   * *note PyEval_InitThreads(): 1be2.

   * *note PyEval_ReleaseThread(): 5317.

   * *note PyEval_RestoreThread(): 83f.

   * *note PyEval_SaveThread(): 83e.

   * *note PyExc_ArithmeticError: 5318.

   * *note PyExc_AssertionError: 5319.

   * *note PyExc_AttributeError: 531a.

   * *note PyExc_BaseException: 531b.

   * *note PyExc_BaseExceptionGroup: 531c.

   * *note PyExc_BlockingIOError: 531d.

   * *note PyExc_BrokenPipeError: 531e.

   * *note PyExc_BufferError: 531f.

   * *note PyExc_BytesWarning: 5320.

   * *note PyExc_ChildProcessError: 5321.

   * *note PyExc_ConnectionAbortedError: 5322.

   * *note PyExc_ConnectionError: 5323.

   * *note PyExc_ConnectionRefusedError: 5324.

   * *note PyExc_ConnectionResetError: 5325.

   * *note PyExc_DeprecationWarning: 5326.

   * *note PyExc_EOFError: 5327.

   * *note PyExc_EncodingWarning: 5328.

   * *note PyExc_EnvironmentError: 5329.

   * *note PyExc_Exception: 532a.

   * *note PyExc_FileExistsError: 532b.

   * *note PyExc_FileNotFoundError: 532c.

   * *note PyExc_FloatingPointError: 532d.

   * *note PyExc_FutureWarning: 532e.

   * *note PyExc_GeneratorExit: 532f.

   * *note PyExc_IOError: 5330.

   * *note PyExc_ImportError: 5331.

   * *note PyExc_ImportWarning: 5332.

   * *note PyExc_IndentationError: 5333.

   * *note PyExc_IndexError: 5334.

   * *note PyExc_InterruptedError: 5335.

   * *note PyExc_IsADirectoryError: 5336.

   * *note PyExc_KeyError: 5337.

   * *note PyExc_KeyboardInterrupt: 5338.

   * *note PyExc_LookupError: 5339.

   * *note PyExc_MemoryError: 533a.

   * *note PyExc_ModuleNotFoundError: 533b.

   * *note PyExc_NameError: 533c.

   * *note PyExc_NotADirectoryError: 533d.

   * *note PyExc_NotImplementedError: 533e.

   * *note PyExc_OSError: 51c8.

   * *note PyExc_OverflowError: 533f.

   * *note PyExc_PendingDeprecationWarning: 5340.

   * *note PyExc_PermissionError: 5341.

   * *note PyExc_ProcessLookupError: 5342.

   * *note PyExc_RecursionError: 1266.

   * *note PyExc_ReferenceError: 5343.

   * *note PyExc_ResourceWarning: 5344.

   * *note PyExc_RuntimeError: 5345.

   * *note PyExc_RuntimeWarning: 5346.

   * *note PyExc_StopAsyncIteration: 5347.

   * *note PyExc_StopIteration: 5348.

   * *note PyExc_SyntaxError: 5349.

   * *note PyExc_SyntaxWarning: 534a.

   * *note PyExc_SystemError: 534b.

   * *note PyExc_SystemExit: 534c.

   * *note PyExc_TabError: 534d.

   * *note PyExc_TimeoutError: 534e.

   * *note PyExc_TypeError: 51c7.

   * *note PyExc_UnboundLocalError: 534f.

   * *note PyExc_UnicodeDecodeError: 5350.

   * *note PyExc_UnicodeEncodeError: 5351.

   * *note PyExc_UnicodeError: 5352.

   * *note PyExc_UnicodeTranslateError: 5353.

   * *note PyExc_UnicodeWarning: 5354.

   * *note PyExc_UserWarning: 5355.

   * *note PyExc_ValueError: 51c9.

   * *note PyExc_Warning: 5356.

   * *note PyExc_WindowsError: 5357.

   * *note PyExc_ZeroDivisionError: 51c4.

   * *note PyExceptionClass_Name(): e2e.

   * *note PyException_GetArgs(): 975.

   * *note PyException_GetCause(): 5358.

   * *note PyException_GetContext(): 5359.

   * *note PyException_GetTraceback(): 535a.

   * *note PyException_SetArgs(): 976.

   * *note PyException_SetCause(): 535b.

   * *note PyException_SetContext(): 535c.

   * *note PyException_SetTraceback(): 1fdd.

   * *note PyFile_FromFd(): 535d.

   * *note PyFile_GetLine(): 535e.

   * *note PyFile_WriteObject(): 535f.

   * *note PyFile_WriteString(): 5360.

   * *note PyFilter_Type: 5361.

   * *note PyFloat_AsDouble(): e32.

   * *note PyFloat_FromDouble(): 5362.

   * *note PyFloat_FromString(): 5363.

   * *note PyFloat_GetInfo(): 17a9.

   * *note PyFloat_GetMax(): 17a7.

   * *note PyFloat_GetMin(): 17a8.

   * *note PyFloat_Type: 5364.

   * *note PyFrameObject: b6d.

   * *note PyFrame_GetCode(): b6e.

   * *note PyFrame_GetLineNumber(): b6f.

   * *note PyFrozenSet_New(): 17fd.

   * *note PyFrozenSet_Type: 5365.

   * *note PyGC_Collect(): d5a.

   * *note PyGC_Disable(): c7f.

   * *note PyGC_Enable(): c7e.

   * *note PyGC_IsEnabled(): c80.

   * *note PyGILState_Ensure(): 1b0.

   * *note PyGILState_GetThisThreadState(): 5366.

   * *note PyGILState_Release(): 1b1.

   * *note PyGILState_STATE: 5367.

   * *note PyGetSetDef: f7b.

   * *note PyGetSetDescr_Type: 5368.

   * *note PyImport_AddModule(): 7f8.

   * *note PyImport_AddModuleObject(): 5369.

   * *note PyImport_AddModuleRef(): 7f7.

   * *note PyImport_AppendInittab(): 1d39.

   * *note PyImport_ExecCodeModule(): 536a.

   * *note PyImport_ExecCodeModuleEx(): 536b.

   * *note PyImport_ExecCodeModuleObject(): 536c.

   * *note PyImport_ExecCodeModuleWithPathnames(): 536d.

   * *note PyImport_GetImporter(): 1ca9.

   * *note PyImport_GetMagicNumber(): 1561.

   * *note PyImport_GetMagicTag(): 536e.

   * *note PyImport_GetModule(): f75.

   * *note PyImport_GetModuleDict(): 536f.

   * *note PyImport_Import(): 17b4.

   * *note PyImport_ImportFrozenModule(): 5370.

   * *note PyImport_ImportFrozenModuleObject(): 5371.

   * *note PyImport_ImportModule(): 3ab.

   * *note PyImport_ImportModuleLevel(): 1562.

   * *note PyImport_ImportModuleLevelObject(): 5372.

   * *note PyImport_ReloadModule(): 5373.

   * *note PyIndex_Check(): d56.

   * *note PyInterpreterGuard: 5374.

   * *note PyInterpreterGuard_Close(): 5375.

   * *note PyInterpreterGuard_FromCurrent(): 5376.

   * *note PyInterpreterGuard_FromView(): 5377.

   * *note PyInterpreterState: c94.

   * *note PyInterpreterState_Clear(): 49ba.

   * *note PyInterpreterState_Delete(): 5378.

   * *note PyInterpreterState_Get(): 841.

   * *note PyInterpreterState_GetDict(): 5379.

   * *note PyInterpreterState_GetID(): f88.

   * *note PyInterpreterState_New(): 49bb.

   * *note PyInterpreterView: 537a.

   * *note PyInterpreterView_Close(): 537b.

   * *note PyInterpreterView_FromCurrent(): 537c.

   * *note PyInterpreterView_FromMain(): 537d.

   * *note PyIter_Check(): 1ec7.

   * *note PyIter_Next(): 5cd.

   * *note PyIter_NextItem(): 5cc.

   * *note PyIter_Send(): c72.

   * *note PyListIter_Type: 537e.

   * *note PyListRevIter_Type: 537f.

   * *note PyList_Append(): 5380.

   * *note PyList_AsTuple(): 5381.

   * *note PyList_GetItem(): 7fb.

   * *note PyList_GetItemRef(): 7fa.

   * *note PyList_GetSlice(): 5382.

   * *note PyList_Insert(): 1af9.

   * *note PyList_New(): 526f.

   * *note PyList_Reverse(): 5383.

   * *note PyList_SetItem(): 1afa.

   * *note PyList_SetSlice(): 5384.

   * *note PyList_Size(): 17d2.

   * *note PyList_Sort(): 5385.

   * *note PyList_Type: 51ff.

   * *note PyLongExport: 1991.

   * *note PyLongLayout: 1990.

   * *note PyLongObject: 5d2.

   * *note PyLongRangeIter_Type: 5386.

   * *note PyLongWriter: 1992.

   * *note PyLongWriter_Create(): 5de.

   * *note PyLongWriter_Discard(): 5e0.

   * *note PyLongWriter_Finish(): 5df.

   * *note PyLong_AsDouble(): 1ba6.

   * *note PyLong_AsInt(): 800.

   * *note PyLong_AsInt32(): 5d3.

   * *note PyLong_AsInt64(): 5d4.

   * *note PyLong_AsLong(): 801.

   * *note PyLong_AsLongAndOverflow(): 161f.

   * *note PyLong_AsLongLong(): 5387.

   * *note PyLong_AsLongLongAndOverflow(): 1620.

   * *note PyLong_AsNativeBytes(): 802.

   * *note PyLong_AsSize_t(): 5388.

   * *note PyLong_AsSsize_t(): 5389.

   * *note PyLong_AsUInt32(): 5d5.

   * *note PyLong_AsUInt64(): 5d6.

   * *note PyLong_AsUnsignedLong(): 538a.

   * *note PyLong_AsUnsignedLongLong(): 164e.

   * *note PyLong_AsUnsignedLongLongMask(): 1fd9.

   * *note PyLong_AsUnsignedLongMask(): 538b.

   * *note PyLong_AsVoidPtr(): 538c.

   * *note PyLong_Export(): 5dc.

   * *note PyLong_FreeExport(): 5dd.

   * *note PyLong_FromDouble(): d12.

   * *note PyLong_FromInt32(): 5d7.

   * *note PyLong_FromInt64(): 5d8.

   * *note PyLong_FromLong(): 1de9.

   * *note PyLong_FromLongLong(): 1dea.

   * *note PyLong_FromNativeBytes(): 803.

   * *note PyLong_FromSize_t(): 1aff.

   * *note PyLong_FromSsize_t(): 1ae1.

   * *note PyLong_FromString(): 538d.

   * *note PyLong_FromUInt32(): 5d9.

   * *note PyLong_FromUInt64(): 5da.

   * *note PyLong_FromUnsignedLong(): 1afd.

   * *note PyLong_FromUnsignedLongLong(): 1afe.

   * *note PyLong_FromUnsignedNativeBytes(): 804.

   * *note PyLong_FromVoidPtr(): 538e.

   * *note PyLong_GetInfo(): 538f.

   * *note PyLong_GetNativeLayout(): 5db.

   * *note PyLong_Type: 5390.

   * *note PyMODEXPORT_FUNC: 19b1.

   * *note PyMap_Type: 5391.

   * *note PyMapping_Check(): 5392.

   * *note PyMapping_GetItemString(): 7e9.

   * *note PyMapping_GetOptionalItem(): 7e6.

   * *note PyMapping_GetOptionalItemString(): 7e7.

   * *note PyMapping_HasKey(): 81a.

   * *note PyMapping_HasKeyString(): 81c.

   * *note PyMapping_HasKeyStringWithError(): 81b.

   * *note PyMapping_HasKeyWithError(): 819.

   * *note PyMapping_Items(): f80.

   * *note PyMapping_Keys(): f7e.

   * *note PyMapping_Length(): 5393.

   * *note PyMapping_SetItemString(): 5394.

   * *note PyMapping_Size(): 2043.

   * *note PyMapping_Values(): f7f.

   * *note PyMem_Calloc(): 1261.

   * *note PyMem_Free(): 17fa.

   * *note PyMem_Malloc(): 1027.

   * *note PyMem_RawCalloc(): 82a.

   * *note PyMem_RawFree(): 82c.

   * *note PyMem_RawMalloc(): 2ca.

   * *note PyMem_RawRealloc(): 82b.

   * *note PyMem_Realloc(): 13de.

   * *note PyMemberDef: 95f.

   * *note PyMemberDescr_Type: 5395.

   * *note PyMember_GetOne(): 991.

   * *note PyMember_SetOne(): 992.

   * *note PyMemoryView_FromBuffer(): b48.

   * *note PyMemoryView_FromMemory(): 152e.

   * *note PyMemoryView_FromObject(): 5396.

   * *note PyMemoryView_GetContiguous(): 5397.

   * *note PyMemoryView_Type: 5398.

   * *note PyMethodDef: 188f.

   * *note PyMethodDescr_Type: 5399.

   * *note PyModuleDef: d49.

   * *note PyModuleDef_Base: 539a.

   * *note PyModuleDef_Init(): 539b.

   * *note PyModuleDef_Slot: 539c.

   * *note PyModuleDef_Type: 539d.

   * *note PyModule_Add(): 805.

   * *note PyModule_AddFunctions(): 539e.

   * *note PyModule_AddIntConstant(): 18f4.

   * *note PyModule_AddObject(): 807.

   * *note PyModule_AddObjectRef(): 806.

   * *note PyModule_AddStringConstant(): 18f5.

   * *note PyModule_AddType(): d41.

   * *note PyModule_Create2(): 539f.

   * *note PyModule_Exec(): 53a0.

   * *note PyModule_ExecDef(): 39c.

   * *note PyModule_FromDefAndSpec2(): 39b.

   * *note PyModule_FromSlotsAndSpec(): 394.

   * *note PyModule_GetDef(): 53a1.

   * *note PyModule_GetDict(): 53a2.

   * *note PyModule_GetFilename(): 647.

   * *note PyModule_GetFilenameObject(): 648.

   * *note PyModule_GetName(): 53a3.

   * *note PyModule_GetNameObject(): 53a4.

   * *note PyModule_GetState(): d4c.

   * *note PyModule_GetStateSize(): 53a5.

   * *note PyModule_GetState_DuringGC(): 377.

   * *note PyModule_GetToken(): 53a6.

   * *note PyModule_GetToken_DuringGC(): 378.

   * *note PyModule_New(): 53a7.

   * *note PyModule_NewObject(): 53a8.

   * *note PyModule_SetDocString(): 53a9.

   * *note PyModule_Type: 53aa.

   * *note PyNumber_Absolute(): 53ab.

   * *note PyNumber_Add(): 53ac.

   * *note PyNumber_And(): 53ad.

   * *note PyNumber_AsSsize_t(): 53ae.

   * *note PyNumber_Check(): e2f.

   * *note PyNumber_Divmod(): 53af.

   * *note PyNumber_Float(): e31.

   * *note PyNumber_FloorDivide(): 53b0.

   * *note PyNumber_InPlaceAdd(): 53b1.

   * *note PyNumber_InPlaceAnd(): 53b2.

   * *note PyNumber_InPlaceFloorDivide(): 53b3.

   * *note PyNumber_InPlaceLshift(): 53b4.

   * *note PyNumber_InPlaceMatrixMultiply(): 1268.

   * *note PyNumber_InPlaceMultiply(): 53b5.

   * *note PyNumber_InPlaceOr(): 53b6.

   * *note PyNumber_InPlacePower(): 53b7.

   * *note PyNumber_InPlaceRemainder(): 53b8.

   * *note PyNumber_InPlaceRshift(): 53b9.

   * *note PyNumber_InPlaceSubtract(): 53ba.

   * *note PyNumber_InPlaceTrueDivide(): 53bb.

   * *note PyNumber_InPlaceXor(): 53bc.

   * *note PyNumber_Index(): c6d.

   * *note PyNumber_Invert(): 53bd.

   * *note PyNumber_Long(): e30.

   * *note PyNumber_Lshift(): 53be.

   * *note PyNumber_MatrixMultiply(): 1267.

   * *note PyNumber_Multiply(): 53bf.

   * *note PyNumber_Negative(): 53c0.

   * *note PyNumber_Or(): 53c1.

   * *note PyNumber_Positive(): 53c2.

   * *note PyNumber_Power(): 53c3.

   * *note PyNumber_Remainder(): 53c4.

   * *note PyNumber_Rshift(): 53c5.

   * *note PyNumber_Subtract(): 53c6.

   * *note PyNumber_ToBase(): 1d8f.

   * *note PyNumber_TrueDivide(): 53c7.

   * *note PyNumber_Xor(): 53c8.

   * *note PyOS_AfterFork(): 649.

   * *note PyOS_AfterFork_Child(): 64a.

   * *note PyOS_AfterFork_Parent(): f82.

   * *note PyOS_BeforeFork(): f81.

   * *note PyOS_CheckStack(): 1dba.

   * *note PyOS_FSPath(): 10d6.

   * *note PyOS_InputHook: 98b.

   * *note PyOS_InterruptOccurred(): 1f55.

   * *note PyOS_double_to_string(): 53c9.

   * *note PyOS_getsig(): 18f6.

   * *note PyOS_mystricmp(): 1f4e.

   * *note PyOS_mystrnicmp(): 1f4d.

   * *note PyOS_setsig(): 18f7.

   * *note PyOS_sighandler_t: 53ca.

   * *note PyOS_snprintf(): 18c1.

   * *note PyOS_string_to_double(): 164f.

   * *note PyOS_strtol(): 53cb.

   * *note PyOS_strtoul(): 53cc.

   * *note PyOS_vsnprintf(): 18c2.

   * *note PyObject: 1a6.

   * *note PyObject.ob_refcnt: c79.

   * *note PyObject.ob_type: 51f2.

   * *note PyObject_ASCII(): 53cd.

   * *note PyObject_AsFileDescriptor(): 53ce.

   * *note PyObject_Bytes(): 53cf.

   * *note PyObject_Call(): 835.

   * *note PyObject_CallFinalizerFromDealloc(): 359.

   * *note PyObject_CallFunction(): 837.

   * *note PyObject_CallFunctionObjArgs(): 53d0.

   * *note PyObject_CallMethod(): 3be.

   * *note PyObject_CallMethodObjArgs(): 1fed.

   * *note PyObject_CallNoArgs(): 834.

   * *note PyObject_CallObject(): 51d1.

   * *note PyObject_Calloc(): 1262.

   * *note PyObject_CheckBuffer(): 831.

   * *note PyObject_ClearWeakRefs(): 97f.

   * *note PyObject_CopyData(): b44.

   * *note PyObject_DelAttr(): 1a8d.

   * *note PyObject_DelAttrString(): 1a8e.

   * *note PyObject_DelItem(): 53d1.

   * *note PyObject_DelItemString(): 53d2.

   * *note PyObject_Dir(): 53d3.

   * *note PyObject_Format(): 53d4.

   * *note PyObject_Free(): 1028.

   * *note PyObject_GC_Del(): 18bb.

   * *note PyObject_GC_IsFinalized(): d43.

   * *note PyObject_GC_IsTracked(): d42.

   * *note PyObject_GC_Track(): 18bc.

   * *note PyObject_GC_UnTrack(): 18bd.

   * *note PyObject_GenericGetAttr(): 53d5.

   * *note PyObject_GenericGetDict(): 1f19.

   * *note PyObject_GenericSetAttr(): 53d6.

   * *note PyObject_GenericSetDict(): 53d7.

   * *note PyObject_GetAIter(): 53d8.

   * *note PyObject_GetAttr(): 3bf.

   * *note PyObject_GetAttrString(): 7ec.

   * *note PyObject_GetBuffer(): 832.

   * *note PyObject_GetItem(): 7e8.

   * *note PyObject_GetIter(): 53d9.

   * *note PyObject_GetOptionalAttr(): 7ea.

   * *note PyObject_GetOptionalAttrString(): 7eb.

   * *note PyObject_GetTypeData(): 1a5.

   * *note PyObject_GetTypeData_DuringGC(): 374.

   * *note PyObject_HasAttr(): 816.

   * *note PyObject_HasAttrString(): 818.

   * *note PyObject_HasAttrStringWithError(): 817.

   * *note PyObject_HasAttrWithError(): 815.

   * *note PyObject_Hash(): 650.

   * *note PyObject_HashNotImplemented(): 177f.

   * *note PyObject_Init(): e33.

   * *note PyObject_InitVar(): 1f53.

   * *note PyObject_IsInstance(): 125a.

   * *note PyObject_IsSubclass(): 125b.

   * *note PyObject_IsTrue(): 53da.

   * *note PyObject_Length(): 53db.

   * *note PyObject_Malloc(): 102a.

   * *note PyObject_Not(): 53dc.

   * *note PyObject_Realloc(): 17fb.

   * *note PyObject_Repr(): 13db.

   * *note PyObject_RichCompare(): 5215.

   * *note PyObject_RichCompareBool(): 1f9d.

   * *note PyObject_SelfIter(): 53dd.

   * *note PyObject_SetAttr(): 1948.

   * *note PyObject_SetAttrString(): 1a8c.

   * *note PyObject_SetItem(): 526e.

   * *note PyObject_Size(): 53de.

   * *note PyObject_Str(): 13dc.

   * *note PyObject_Type(): 53df.

   * *note PyObject_Vectorcall(): 968.

   * *note PyObject_VectorcallMethod(): 969.

   * *note PyProperty_Type: 53e0.

   * *note PyRangeIter_Type: 53e1.

   * *note PyRange_Type: 53e2.

   * *note PyReversed_Type: 53e3.

   * *note PySeqIter_New(): 53e4.

   * *note PySeqIter_Type: 53e5.

   * *note PySequence_Check(): 53e6.

   * *note PySequence_Concat(): 53e7.

   * *note PySequence_Contains(): 60c.

   * *note PySequence_Count(): 53e8.

   * *note PySequence_DelItem(): 2042.

   * *note PySequence_DelSlice(): 53e9.

   * *note PySequence_Fast(): 1ae5.

   * *note PySequence_GetItem(): 2040.

   * *note PySequence_GetSlice(): 53ea.

   * *note PySequence_In(): 60b.

   * *note PySequence_InPlaceConcat(): 53eb.

   * *note PySequence_InPlaceRepeat(): 53ec.

   * *note PySequence_Index(): 53ed.

   * *note PySequence_Length(): 53ee.

   * *note PySequence_List(): 53ef.

   * *note PySequence_Repeat(): 53f0.

   * *note PySequence_SetItem(): 2041.

   * *note PySequence_SetSlice(): 53f1.

   * *note PySequence_Size(): 203f.

   * *note PySequence_Tuple(): 53f2.

   * *note PySetIter_Type: 53f3.

   * *note PySet_Add(): 17fe.

   * *note PySet_Clear(): 53f4.

   * *note PySet_Contains(): 1800.

   * *note PySet_Discard(): 17ff.

   * *note PySet_New(): 17fc.

   * *note PySet_Pop(): 53f5.

   * *note PySet_Size(): 1801.

   * *note PySet_Type: 53f6.

   * *note PySlice_AdjustIndices(): 64d.

   * *note PySlice_GetIndices(): 53f7.

   * *note PySlice_GetIndicesEx(): 64b.

   * *note PySlice_New(): 53f8.

   * *note PySlice_Type: 53f9.

   * *note PySlice_Unpack(): 64c.

   * *note PySlot: 1a8.

   * *note PySlot_DATA: 38b.

   * *note PySlot_END: 391.

   * *note PySlot_FUNC: 38c.

   * *note PySlot_INT64: 38e.

   * *note PySlot_INTPTR: 53fa.

   * *note PySlot_OPTIONAL: 53fb.

   * *note PySlot_PTR: 392.

   * *note PySlot_PTR_STATIC: 393.

   * *note PySlot_SIZE: 38d.

   * *note PySlot_STATIC: 53fc.

   * *note PySlot_STATIC_DATA: 390.

   * *note PySlot_UINT64: 38f.

   * *note PyState_AddModule(): 53fd.

   * *note PyState_FindModule(): 53fe.

   * *note PyState_RemoveModule(): 53ff.

   * *note PyStructSequence_Desc: f7d.

   * *note PyStructSequence_Field: f7c.

   * *note PyStructSequence_GetItem(): 5400.

   * *note PyStructSequence_New(): 5401.

   * *note PyStructSequence_NewType(): 5402.

   * *note PyStructSequence_SetItem(): 5403.

   * *note PyStructSequence_UnnamedField: d4e.

   * *note PySuper_Type: 5404.

   * *note PySys_Audit(): 80e.

   * *note PySys_AuditTuple(): 80d.

   * *note PySys_FormatStderr(): 5405.

   * *note PySys_FormatStdout(): 5406.

   * *note PySys_GetAttr(): 35a.

   * *note PySys_GetAttrString(): 35b.

   * *note PySys_GetObject(): 35e.

   * *note PySys_GetOptionalAttr(): 35c.

   * *note PySys_GetOptionalAttrString(): 35d.

   * *note PySys_GetXOptions(): 5407.

   * *note PySys_SetArgv(): 1be1.

   * *note PySys_SetArgvEx(): 1be0.

   * *note PySys_SetObject(): 5408.

   * *note PySys_WriteStderr(): 5409.

   * *note PySys_WriteStdout(): 540a.

   * *note PyThreadState: b71.

   * *note PyThreadStateToken: 540b.

   * *note PyThreadState_Clear(): 1bbd.

   * *note PyThreadState_Delete(): 1f9a.

   * *note PyThreadState_Ensure(): 540c.

   * *note PyThreadState_EnsureFromView(): 540d.

   * *note PyThreadState_Get(): 80f.

   * *note PyThreadState_GetDict(): 540e.

   * *note PyThreadState_GetFrame(): b72.

   * *note PyThreadState_GetID(): d3f.

   * *note PyThreadState_GetInterpreter(): d3e.

   * *note PyThreadState_New(): 540f.

   * *note PyThreadState_Release(): 5410.

   * *note PyThreadState_SetAsyncExc(): f86.

   * *note PyThreadState_Swap(): 5411.

   * *note PyThread_GetInfo(): 5412.

   * *note PyThread_ReInitTLS(): 65b.

   * *note PyThread_acquire_lock(): 5413.

   * *note PyThread_acquire_lock_timed(): 5414.

   * *note PyThread_allocate_lock(): 5415.

   * *note PyThread_create_key(): 651.

   * *note PyThread_delete_key(): 653.

   * *note PyThread_delete_key_value(): 659.

   * *note PyThread_exit_thread(): 5416.

   * *note PyThread_free_lock(): 5417.

   * *note PyThread_get_key_value(): 657.

   * *note PyThread_get_stacksize(): 5418.

   * *note PyThread_get_thread_ident(): 5419.

   * *note PyThread_get_thread_native_id(): 1dbb.

   * *note PyThread_init_thread(): 541a.

   * *note PyThread_release_lock(): 541b.

   * *note PyThread_set_key_value(): 655.

   * *note PyThread_set_stacksize(): 541c.

   * *note PyThread_start_new_thread(): 2037.

   * *note PyThread_tss_alloc(): 652.

   * *note PyThread_tss_create(): 541d.

   * *note PyThread_tss_delete(): 65a.

   * *note PyThread_tss_free(): 654.

   * *note PyThread_tss_get(): 658.

   * *note PyThread_tss_is_created(): 541e.

   * *note PyThread_tss_set(): 656.

   * *note PyTraceBack_Here(): 541f.

   * *note PyTraceBack_Print(): 5420.

   * *note PyTraceBack_Type: 5421.

   * *note PyTupleIter_Type: 5422.

   * *note PyTuple_GetItem(): 51dd.

   * *note PyTuple_GetSlice(): 5423.

   * *note PyTuple_New(): 836.

   * *note PyTuple_Pack(): 5424.

   * *note PyTuple_SetItem(): 51de.

   * *note PyTuple_Size(): 5425.

   * *note PyTuple_Type: 5426.

   * *note PyTypeObject: e6f.

   * *note PyType_ClearCache(): 5427.

   * *note PyType_Freeze(): 5e3.

   * *note PyType_FromMetaclass(): 399.

   * *note PyType_FromModuleAndSpec(): 398.

   * *note PyType_FromSlots(): 37e.

   * *note PyType_FromSpec(): 396.

   * *note PyType_FromSpecWithBases(): 397.

   * *note PyType_GenericAlloc(): e34.

   * *note PyType_GenericNew(): 51f1.

   * *note PyType_GetBaseByToken(): 5e4.

   * *note PyType_GetBaseByToken_DuringGC(): 379.

   * *note PyType_GetFlags(): 1f50.

   * *note PyType_GetFullyQualifiedName(): 810.

   * *note PyType_GetModule(): d3b.

   * *note PyType_GetModuleByDef(): 82d.

   * *note PyType_GetModuleByToken(): 5428.

   * *note PyType_GetModuleByToken_DuringGC(): 37b.

   * *note PyType_GetModuleName(): 812.

   * *note PyType_GetModuleState(): d3c.

   * *note PyType_GetModuleState_DuringGC(): 376.

   * *note PyType_GetModule_DuringGC(): 37a.

   * *note PyType_GetName(): b3b.

   * *note PyType_GetQualName(): b3c.

   * *note PyType_GetSlot(): c76.

   * *note PyType_GetTypeDataSize(): 95a.

   * *note PyType_IsSubtype(): 5429.

   * *note PyType_Modified(): 1d96.

   * *note PyType_Ready(): b63.

   * *note PyType_Slot: 542a.

   * *note PyType_Spec: 1cae.

   * *note PyType_Type: 95d.

   * *note PyUnicodeDecodeError_Create(): 542b.

   * *note PyUnicodeDecodeError_GetEncoding(): 542c.

   * *note PyUnicodeDecodeError_GetEnd(): 542d.

   * *note PyUnicodeDecodeError_GetObject(): 542e.

   * *note PyUnicodeDecodeError_GetReason(): 542f.

   * *note PyUnicodeDecodeError_GetStart(): 5430.

   * *note PyUnicodeDecodeError_SetEnd(): 5431.

   * *note PyUnicodeDecodeError_SetReason(): 5432.

   * *note PyUnicodeDecodeError_SetStart(): 5433.

   * *note PyUnicodeEncodeError_GetEncoding(): 5434.

   * *note PyUnicodeEncodeError_GetEnd(): 1b39.

   * *note PyUnicodeEncodeError_GetObject(): 5435.

   * *note PyUnicodeEncodeError_GetReason(): 5436.

   * *note PyUnicodeEncodeError_GetStart(): 1b3c.

   * *note PyUnicodeEncodeError_SetEnd(): 5437.

   * *note PyUnicodeEncodeError_SetReason(): 5438.

   * *note PyUnicodeEncodeError_SetStart(): 5439.

   * *note PyUnicodeIter_Type: 543a.

   * *note PyUnicodeTranslateError_GetEnd(): 543b.

   * *note PyUnicodeTranslateError_GetObject(): 543c.

   * *note PyUnicodeTranslateError_GetReason(): 543d.

   * *note PyUnicodeTranslateError_GetStart(): 543e.

   * *note PyUnicodeTranslateError_SetEnd(): 543f.

   * *note PyUnicodeTranslateError_SetReason(): 5440.

   * *note PyUnicodeTranslateError_SetStart(): 5441.

   * *note PyUnicode_Append(): 5442.

   * *note PyUnicode_AppendAndDel(): 5443.

   * *note PyUnicode_AsASCIIString(): 1550.

   * *note PyUnicode_AsCharmapString(): 5444.

   * *note PyUnicode_AsEncodedString(): 5445.

   * *note PyUnicode_AsLatin1String(): 154f.

   * *note PyUnicode_AsMBCSString(): 1551.

   * *note PyUnicode_AsRawUnicodeEscapeString(): 154e.

   * *note PyUnicode_AsUCS4(): 1536.

   * *note PyUnicode_AsUCS4Copy(): c92.

   * *note PyUnicode_AsUTF16String(): 5446.

   * *note PyUnicode_AsUTF32String(): 5447.

   * *note PyUnicode_AsUTF8AndSize(): c73.

   * *note PyUnicode_AsUTF8String(): 154c.

   * *note PyUnicode_AsUnicodeEscapeString(): 154d.

   * *note PyUnicode_AsWideChar(): 2044.

   * *note PyUnicode_AsWideCharString(): c93.

   * *note PyUnicode_BuildEncodingMap(): 1c87.

   * *note PyUnicode_Compare(): c8e.

   * *note PyUnicode_CompareWithASCIIString(): 1621.

   * *note PyUnicode_Concat(): 155f.

   * *note PyUnicode_Contains(): 5448.

   * *note PyUnicode_Count(): 5449.

   * *note PyUnicode_Decode(): 1fd6.

   * *note PyUnicode_DecodeASCII(): 544a.

   * *note PyUnicode_DecodeCharmap(): 544b.

   * *note PyUnicode_DecodeCodePageStateful(): 544c.

   * *note PyUnicode_DecodeFSDefault(): 1cad.

   * *note PyUnicode_DecodeFSDefaultAndSize(): 544d.

   * *note PyUnicode_DecodeLatin1(): 544e.

   * *note PyUnicode_DecodeLocale(): 544f.

   * *note PyUnicode_DecodeLocaleAndSize(): f8b.

   * *note PyUnicode_DecodeMBCS(): 5450.

   * *note PyUnicode_DecodeMBCSStateful(): 5451.

   * *note PyUnicode_DecodeRawUnicodeEscape(): 5452.

   * *note PyUnicode_DecodeUTF16(): 5453.

   * *note PyUnicode_DecodeUTF16Stateful(): 5454.

   * *note PyUnicode_DecodeUTF32(): 5455.

   * *note PyUnicode_DecodeUTF32Stateful(): 5456.

   * *note PyUnicode_DecodeUTF7(): 5457.

   * *note PyUnicode_DecodeUTF7Stateful(): 5458.

   * *note PyUnicode_DecodeUTF8(): 5459.

   * *note PyUnicode_DecodeUTF8Stateful(): 1d34.

   * *note PyUnicode_DecodeUnicodeEscape(): 545a.

   * *note PyUnicode_EncodeCodePage(): 1552.

   * *note PyUnicode_EncodeFSDefault(): 203d.

   * *note PyUnicode_EncodeLocale(): f8c.

   * *note PyUnicode_Equal(): 5e6.

   * *note PyUnicode_EqualToUTF8(): 814.

   * *note PyUnicode_EqualToUTF8AndSize(): 813.

   * *note PyUnicode_FSConverter(): 10d7.

   * *note PyUnicode_FSDecoder(): 980.

   * *note PyUnicode_Find(): 545b.

   * *note PyUnicode_FindChar(): c90.

   * *note PyUnicode_Format(): 545c.

   * *note PyUnicode_FromEncodedObject(): 545d.

   * *note PyUnicode_FromFormat(): 824.

   * *note PyUnicode_FromFormatV(): 97e.

   * *note PyUnicode_FromObject(): 545e.

   * *note PyUnicode_FromOrdinal(): 545f.

   * *note PyUnicode_FromString(): 5460.

   * *note PyUnicode_FromStringAndSize(): 5461.

   * *note PyUnicode_FromWideChar(): 154a.

   * *note PyUnicode_GetDefaultEncoding(): 5462.

   * *note PyUnicode_GetLength(): c8a.

   * *note PyUnicode_InternFromString(): 3bd.

   * *note PyUnicode_InternInPlace(): c88.

   * *note PyUnicode_IsIdentifier(): 1f97.

   * *note PyUnicode_Join(): 1560.

   * *note PyUnicode_Partition(): 1adb.

   * *note PyUnicode_RPartition(): 1adc.

   * *note PyUnicode_RSplit(): 1ada.

   * *note PyUnicode_ReadChar(): 152f.

   * *note PyUnicode_Replace(): 5463.

   * *note PyUnicode_Resize(): 5464.

   * *note PyUnicode_RichCompare(): 5465.

   * *note PyUnicode_Split(): 5466.

   * *note PyUnicode_Splitlines(): 5467.

   * *note PyUnicode_Substring(): c8d.

   * *note PyUnicode_Tailmatch(): c8f.

   * *note PyUnicode_Translate(): 5468.

   * *note PyUnicode_Type: 5469.

   * *note PyUnicode_WriteChar(): 1530.

   * *note PyVarObject: 493d.

   * *note PyVarObject.ob_base: 546a.

   * *note PyVarObject.ob_size: 546b.

   * *note PyVectorcall_Call(): 964.

   * *note PyVectorcall_NARGS(): 963.

   * ‘PyWeakReference’

   * *note PyWeakref_GetRef(): 3ac.

   * *note PyWeakref_NewProxy(): 546c.

   * *note PyWeakref_NewRef(): 1dfe.

   * *note PyWrapperDescr_Type: 546d.

   * *note PyWrapper_New(): 546e.

   * *note PyZip_Type: 546f.

   * *note Py_ASNATIVEBYTES_ALLOW_INDEX: 5470.

   * *note Py_ASNATIVEBYTES_BIG_ENDIAN: 5471.

   * *note Py_ASNATIVEBYTES_DEFAULTS: 5472.

   * *note Py_ASNATIVEBYTES_LITTLE_ENDIAN: 5473.

   * *note Py_ASNATIVEBYTES_NATIVE_ENDIAN: 5474.

   * *note Py_ASNATIVEBYTES_REJECT_NEGATIVE: 5475.

   * *note Py_ASNATIVEBYTES_UNSIGNED_BUFFER: 5476.

   * *note Py_AUDIT_READ: 996.

   * *note Py_AddPendingCall(): d4d.

   * *note Py_AtExit(): 5477.

   * *note Py_BEGIN_ALLOW_THREADS: 51e3.

   * *note Py_BEGIN_CRITICAL_SECTION: 5478.

   * *note Py_BEGIN_CRITICAL_SECTION2: 5479.

   * *note Py_BLOCK_THREADS: 547a.

   * *note Py_BuildValue(): 5f5.

   * *note Py_BytesMain(): d8d.

   * *note Py_CompileString(): c5f.

   * *note Py_DecRef(): 547b.

   * *note Py_DecodeLocale(): f89.

   * *note Py_END_ALLOW_THREADS: e52.

   * *note Py_END_CRITICAL_SECTION: 547c.

   * *note Py_END_CRITICAL_SECTION2: 547d.

   * *note Py_EncodeLocale(): f8a.

   * *note Py_EndInterpreter(): 1a8f.

   * *note Py_EnterRecursiveCall(): 605.

   * *note Py_Exit(): 1108.

   * *note Py_FatalError(): d4f.

   * ‘Py_FileSystemDefaultEncodeErrors’

   * ‘Py_FileSystemDefaultEncoding’

   * *note Py_Finalize(): 679.

   * *note Py_FinalizeEx(): 10d3.

   * *note Py_GenericAlias(): 547e.

   * *note Py_GenericAliasType: 547f.

   * *note Py_GetBuildInfo(): 17ea.

   * *note Py_GetCompiler(): 5480.

   * *note Py_GetConstant(): 7f5.

   * *note Py_GetConstantBorrowed(): 7f6.

   * *note Py_GetCopyright(): 5481.

   * *note Py_GetPlatform(): 5482.

   * *note Py_GetRecursionLimit(): 5483.

   * *note Py_GetVersion(): 5484.

   * ‘Py_HasFileSystemDefaultEncoding’

   * *note Py_IS_TYPE(): 19db.

   * *note Py_IncRef(): 5485.

   * *note Py_Initialize(): 67a.

   * *note Py_InitializeEx(): 5486.

   * *note Py_Is(): c7a.

   * *note Py_IsFalse(): c7d.

   * *note Py_IsFinalizing(): 7f9.

   * *note Py_IsInitialized(): 1940.

   * *note Py_IsNone(): c7b.

   * *note Py_IsTrue(): c7c.

   * *note Py_LeaveRecursiveCall(): d40.

   * *note Py_Main(): fe6.

   * *note Py_MakePendingCalls(): 5487.

   * *note Py_NewInterpreter(): 1d4e.

   * *note Py_NewRef(): c74.

   * *note Py_PACK_FULL_VERSION(): 5b4.

   * *note Py_PACK_VERSION(): 5b3.

   * *note Py_READONLY: 995.

   * *note Py_REFCNT(): 552.

   * *note Py_RELATIVE_OFFSET: 95e.

   * *note Py_ReprEnter(): 5488.

   * *note Py_ReprLeave(): 5489.

   * *note Py_SET_SIZE(): b67.

   * *note Py_SIZE(): b66.

   * *note Py_SetProgramName(): 1bdf.

   * *note Py_SetPythonHome(): 1bde.

   * *note Py_SetRecursionLimit(): 548a.

   * *note Py_TPFLAGS_BASETYPE: 51f9.

   * *note Py_TPFLAGS_DEFAULT: 51ef.

   * *note Py_TPFLAGS_HAVE_GC: 3a6.

   * *note Py_TPFLAGS_HAVE_VECTORCALL: 962.

   * *note Py_TPFLAGS_ITEMS_AT_END: 95b.

   * *note Py_TPFLAGS_METHOD_DESCRIPTOR: 548b.

   * *note Py_TP_USE_SPEC: 548c.

   * *note Py_TYPE(): 5fc.

   * *note Py_T_BOOL: 548d.

   * *note Py_T_BYTE: 548e.

   * *note Py_T_CHAR: 548f.

   * *note Py_T_DOUBLE: 994.

   * *note Py_T_FLOAT: 5490.

   * *note Py_T_INT: 993.

   * *note Py_T_LONG: 5491.

   * *note Py_T_LONGLONG: 5492.

   * *note Py_T_OBJECT_EX: 998.

   * *note Py_T_PYSSIZET: 5493.

   * *note Py_T_SHORT: 5494.

   * *note Py_T_STRING: 5495.

   * *note Py_T_STRING_INPLACE: 5496.

   * *note Py_T_UBYTE: 5497.

   * *note Py_T_UINT: 5498.

   * *note Py_T_ULONG: 5499.

   * *note Py_T_ULONGLONG: 549a.

   * *note Py_T_USHORT: 549b.

   * *note Py_UCS4: 30d.

   * *note Py_UNBLOCK_THREADS: 549c.

   * ‘Py_UTF8Mode’

   * *note Py_VaBuildValue(): 549d.

   * *note Py_Version: 5b5.

   * *note Py_XNewRef(): c75.

   * *note Py_am_aiter: 549e.

   * *note Py_am_anext: 549f.

   * *note Py_am_await: 54a0.

   * *note Py_am_send: 54a1.

   * *note Py_bf_getbuffer: 54a2.

   * *note Py_bf_releasebuffer: 54a3.

   * *note Py_buffer: b3f.

   * ‘Py_intptr_t’

   * *note Py_mod_abi: 360.

   * *note Py_mod_create: 54a4.

   * *note Py_mod_doc: 51b0.

   * *note Py_mod_exec: d4a.

   * *note Py_mod_gil: 697.

   * *note Py_mod_methods: 51b5.

   * *note Py_mod_multiple_interpreters: 54a5.

   * *note Py_mod_name: 51af.

   * *note Py_mod_slots: 383.

   * *note Py_mod_state_clear: 54a6.

   * *note Py_mod_state_free: 54a7.

   * *note Py_mod_state_size: 54a8.

   * *note Py_mod_state_traverse: 54a9.

   * *note Py_mod_token: 54aa.

   * *note Py_mp_ass_subscript: 54ab.

   * *note Py_mp_length: 54ac.

   * *note Py_mp_subscript: 54ad.

   * *note Py_nb_absolute: 54ae.

   * *note Py_nb_add: 54af.

   * *note Py_nb_and: 54b0.

   * *note Py_nb_bool: 54b1.

   * *note Py_nb_divmod: 54b2.

   * *note Py_nb_float: 54b3.

   * *note Py_nb_floor_divide: 54b4.

   * *note Py_nb_index: 54b5.

   * *note Py_nb_inplace_add: 54b6.

   * *note Py_nb_inplace_and: 54b7.

   * *note Py_nb_inplace_floor_divide: 54b8.

   * *note Py_nb_inplace_lshift: 54b9.

   * *note Py_nb_inplace_matrix_multiply: 54ba.

   * *note Py_nb_inplace_multiply: 54bb.

   * *note Py_nb_inplace_or: 54bc.

   * *note Py_nb_inplace_power: 54bd.

   * *note Py_nb_inplace_remainder: 54be.

   * *note Py_nb_inplace_rshift: 54bf.

   * *note Py_nb_inplace_subtract: 54c0.

   * *note Py_nb_inplace_true_divide: 54c1.

   * *note Py_nb_inplace_xor: 54c2.

   * *note Py_nb_int: 54c3.

   * *note Py_nb_invert: 54c4.

   * *note Py_nb_lshift: 54c5.

   * *note Py_nb_matrix_multiply: 54c6.

   * *note Py_nb_multiply: 54c7.

   * *note Py_nb_negative: 54c8.

   * *note Py_nb_or: 54c9.

   * *note Py_nb_positive: 54ca.

   * *note Py_nb_power: 54cb.

   * *note Py_nb_remainder: 54cc.

   * *note Py_nb_rshift: 54cd.

   * *note Py_nb_subtract: 54ce.

   * *note Py_nb_true_divide: 54cf.

   * *note Py_nb_xor: 54d0.

   * *note Py_slot_end: 37f.

   * *note Py_slot_invalid: 380.

   * *note Py_slot_subslots: 381.

   * *note Py_sq_ass_item: 54d1.

   * *note Py_sq_concat: 54d2.

   * *note Py_sq_contains: 54d3.

   * *note Py_sq_inplace_concat: 54d4.

   * *note Py_sq_inplace_repeat: 54d5.

   * *note Py_sq_item: 54d6.

   * *note Py_sq_length: 54d7.

   * *note Py_sq_repeat: 54d8.

   * *note Py_ssize_t: e28.

   * *note Py_tp_alloc: 54d9.

   * *note Py_tp_base: 54da.

   * *note Py_tp_bases: 54db.

   * *note Py_tp_basicsize: 385.

   * *note Py_tp_call: 54dc.

   * *note Py_tp_clear: 54dd.

   * *note Py_tp_dealloc: 54de.

   * *note Py_tp_del: 54df.

   * *note Py_tp_descr_get: 54e0.

   * *note Py_tp_descr_set: 54e1.

   * *note Py_tp_doc: 54e2.

   * *note Py_tp_extra_basicsize: 386.

   * *note Py_tp_finalize: 54e3.

   * *note Py_tp_flags: 388.

   * *note Py_tp_free: 54e4.

   * *note Py_tp_getattr: 54e5.

   * *note Py_tp_getattro: 54e6.

   * *note Py_tp_getset: 54e7.

   * *note Py_tp_hash: 54e8.

   * *note Py_tp_init: 54e9.

   * *note Py_tp_is_gc: 54ea.

   * *note Py_tp_itemsize: 387.

   * *note Py_tp_iter: 54eb.

   * *note Py_tp_iternext: 54ec.

   * *note Py_tp_members: 54ed.

   * *note Py_tp_metaclass: 389.

   * *note Py_tp_methods: 54ee.

   * *note Py_tp_module: 38a.

   * *note Py_tp_name: 384.

   * *note Py_tp_new: 54ef.

   * *note Py_tp_repr: 54f0.

   * *note Py_tp_richcompare: 54f1.

   * *note Py_tp_setattr: 54f2.

   * *note Py_tp_setattro: 54f3.

   * *note Py_tp_slots: 382.

   * *note Py_tp_str: 54f4.

   * *note Py_tp_token: 5e5.

   * *note Py_tp_traverse: 54f5.

   * *note Py_tp_vectorcall: 54f6.

   * ‘Py_uintptr_t’

   * *note allocfunc: 54f7.

   * *note binaryfunc: 54f8.

   * *note descrgetfunc: 54f9.

   * *note descrsetfunc: 54fa.

   * *note destructor: 54fb.

   * *note getattrfunc: 54fc.

   * *note getattrofunc: 54fd.

   * *note getbufferproc: 54fe.

   * *note getiterfunc: 54ff.

   * *note getter: 5500.

   * *note hashfunc: 5501.

   * *note initproc: 5502.

   * *note inquiry: 5503.

   * *note iternextfunc: 5504.

   * *note lenfunc: 5505.

   * *note newfunc: 5506.

   * *note objobjargproc: 5507.

   * *note objobjproc: 5508.

   * *note releasebufferproc: 5509.

   * *note reprfunc: 550a.

   * *note richcmpfunc: 550b.

   * *note setattrfunc: 550c.

   * *note setattrofunc: 550d.

   * *note setter: 550e.

   * *note ssizeargfunc: 550f.

   * *note ssizeobjargproc: 5510.

   * ‘ssizessizeargfunc’

   * ‘ssizessizeobjargproc’

   * ‘symtable’

   * *note ternaryfunc: 5511.

   * *note traverseproc: 5512.

   * *note unaryfunc: 5513.

   * *note vectorcallfunc: 965.

   * *note visitproc: 5514.


File: python.info,  Node: 超高水準レイヤ,  Next: 参照カウント,  Prev: C API and ABI 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: 5519,
*note Py_file_input: 551a, *note Py_single_input: 551b, and *note
Py_func_type_input: 551c.  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(): 551e. の 'closeit' を ‘0’ に、
     'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileFlags (FILE *fp, const char *filename,
          PyCompilerFlags *flags)

     下記の *note PyRun_AnyFileExFlags(): 551e. の 'closeit' を ‘0’ にし
     て単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileEx (FILE *fp, const char *filename, int
          closeit)

     下記の *note PyRun_AnyFileExFlags(): 551e. の 'flags' を ‘NULL’ に
     して単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileExFlags (FILE *fp, const char *filename,
          int closeit, PyCompilerFlags *flags)

     'fp' が対話的デバイス (コンソールや端末入力あるいは Unix 仮想端末)
     と関連づけられたファイルを参照している場合は、 *note
     PyRun_InteractiveLoop(): 5521. の値を返します。それ以外の場合は、
     *note PyRun_SimpleFile(): 5231. の結果を返します。 'filename' はフ
     ァイルシステムのエンコーディング (*note
     sys.getfilesystemencoding(): 101b.) でデコードされます。 'filename'
     が ‘NULL’ ならば、この関数はファイル名として ‘"???"’ を使います。
     'closeit' が真なら、ファイルは ‘PyRun_SimpleFileExFlags()’ が処理を
     戻す前に閉じられます。

 -- C の関数: int PyRun_SimpleString (const char *command)

     下記の *note PyRun_SimpleStringFlags(): 5522. の *note
     PyCompilerFlags: e6b.* を ‘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: 10fb. is
     raised, this function will not return ‘-1’, but exit the process,
     as long as *note PyConfig.inspect: 61c. is zero.

 -- C の関数: int PyRun_SimpleFile (FILE *fp, const char *filename)

     下記の *note PyRun_SimpleFileExFlags(): 1edf. の 'closeit' を ‘0’ に
     、 'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_SimpleFileEx (FILE *fp, const char *filename,
          int closeit)

     下記の *note PyRun_SimpleFileExFlags(): 1edf. の 'flags' を ‘NULL’
     にして単純化したインターフェースです。

 -- C の関数: int PyRun_SimpleFileExFlags (FILE *fp, const char
          *filename, int closeit, PyCompilerFlags *flags)

     *note PyRun_SimpleStringFlags(): 5522. と似ていますが、Pythonソース
     コードをメモリ内の文字列ではなく 'fp' から読み込みます。 'filename'
     はそのファイルの名前でなければならず、 *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. でデコード
     されます。 '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: 1ea. object.

     入力が正常に実行されたときは ‘0’ を返します。例外が発生した場合は
     ‘-1’ を返します。パースエラーの場合はPythonの一部として配布されてい
     る ‘errcode.h’ インクルードファイルにあるエラーコードを返します。
     (‘Python.h’ は ‘errcode.h’ をインクルードしません。従って、 必要な
     場合はその都度インクルードしなければならないことに注意してください
     。)

 -- C の関数: int PyRun_InteractiveOne (FILE *fp, const char *filename)

     下記の *note PyRun_InteractiveOneFlags(): 5526. の 'flags' を
     ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_InteractiveOneFlags (FILE *fp, const char
          *filename, PyCompilerFlags *flags)

     Similar to *note PyRun_InteractiveOneObject(): 5524, but 'filename'
     is a const char*, which is decoded from the *note filesystem
     encoding and error handler: 94d.

 -- C の関数: int PyRun_InteractiveLoop (FILE *fp, const char *filename)

     下記の *note PyRun_InteractiveLoopFlags(): 5527. の 'flags' を
     ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_InteractiveLoopFlags (FILE *fp, const char
          *filename, PyCompilerFlags *flags)

     対話的デバイスに関連付けられたファイルから EOF に達するまで文を読み
     込み実行します。 ‘sys.ps1’ と ‘sys.ps2’ を使って、ユーザにプロンプ
     トを表示します。 'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. でデコード
     されます。 EOFに達すると ‘0’ を返すか、失敗したら負の数を返します。

 -- C 変数: int (*PyOS_InputHook)(void)
     ' 次に属します: *note Stable ABI: 961.'  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: 417.

 -- C 変数: char *(*PyOS_ReadlineFunctionPointer)(FILE*, FILE*, const
          char*)

     ‘char *func(FILE *stdin, FILE *stdout, char *prompt)’ というプロト
     タイプの関数へのポインタが設定でき、デフォルトの関数を上書きするこ
     とでインタプリタのプロンプトへの入力を1行だけ読めます。 この関数は
     、文字列 'prompt' が ‘NULL’ でない場合は 'prompt' を出力し、与えら
     れた標準入力ファイルから入力を1行読み、結果の文字列を返すという動作
     が期待されています。 例えば、 *note readline: c2. モジュールはこの
     フックを設定して、行編集機能やタブ補完機能を提供しています。

     返り値は *note PyMem_RawMalloc(): 2ca. または *note
     PyMem_RawRealloc(): 82b. でメモリ確保した文字列、あるいはエラーが起
     きた場合には ‘NULL’ でなければなりません。

     バージョン 3.4 で変更: 返り値は、 *note PyMem_Malloc(): 1027. や
     *note PyMem_Realloc(): 13de. ではなく、 *note PyMem_RawMalloc():
     2ca. または *note PyMem_RawRealloc(): 82b. でメモリ確保したものでな
     ければなりません。

     バージョン 3.12 で変更: This function is only called from the *note
     main interpreter: 417.

 -- C の関数: *note PyObject: 1a6. *PyRun_String (const char *str, int
          start, PyObject *globals, PyObject *locals)
     '戻り値: 新しい参照。' 下記の *note PyRun_StringFlags(): 5528. の
     'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 1a6. *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: 5529.

     コードを実行した結果をPythonオブジェクトとして返します。または、例
     外が発生したならば ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyRun_File (FILE *fp, const char
          *filename, int start, PyObject *globals, PyObject *locals)
     '戻り値: 新しい参照。' 下記の *note PyRun_FileExFlags(): 552b. の
     'closeit' を ‘0’ にし、 'flags' を ‘NULL’ にして単純化したインター
     フェースです。

 -- C の関数: *note PyObject: 1a6. *PyRun_FileEx (FILE *fp, const char
          *filename, int start, PyObject *globals, PyObject *locals, int
          closeit)
     '戻り値: 新しい参照。' 下記の *note PyRun_FileExFlags(): 552b. の
     'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 1a6. *PyRun_FileFlags (FILE *fp, const
          char *filename, int start, PyObject *globals, PyObject
          *locals, PyCompilerFlags *flags)
     '戻り値: 新しい参照。' 下記の *note PyRun_FileExFlags(): 552b. の
     'closeit' を ‘0’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 1a6. *PyRun_FileExFlags (FILE *fp, const
          char *filename, int start, PyObject *globals, PyObject
          *locals, int closeit, PyCompilerFlags *flags)
     '戻り値: 新しい参照。' *note PyRun_StringFlags(): 5528. と似ていま
     すが、Pythonソースコードをメモリ内の文字列ではなく 'fp' から読み込
     みます。 'filename' はそのファイルの名前でなければならず、 *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. でデコード
     されます。 'closeit' に真を指定した場合は、*note
     PyRun_FileExFlags(): 552b. が処理を戻す前にファイルを閉じます。

 -- C の関数: *note PyObject: 1a6. *Py_CompileString (const char *str,
          const char *filename, int start)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  下記
     の *note Py_CompileStringFlags(): 552e. の 'flags' を ‘NULL’ にして
     単純化したインターフェースです。

 -- C の関数: *note PyObject: 1a6. *Py_CompileStringFlags (const char
          *str, const char *filename, int start, PyCompilerFlags *flags)
     '戻り値: 新しい参照。' 下記の *note Py_CompileStringExFlags():
     552f. の 'optimize' を ‘-1’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 1a6. *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: 5529.  The
     filename specified by 'filename' is used to construct the code
     object and may appear in tracebacks or *note SyntaxError: 189.
     exception messages.  This returns ‘NULL’ if the code cannot be
     parsed or compiled.

     整数 'optimize' は、コンパイラの最適化レベルを指定します; ‘-1’ は、
     インタプリタの *note -O: 438. オプションで与えられるのと同じ最適化
     レベルを選びます。明示的なレベルは、 ‘0’ (最適化なし、 ‘__debug__’
     は真)、 ‘1’ (assert は取り除かれ、 ‘__debug__’ は偽)、 ‘2’
     (docstring も取り除かれる) です。

     Added in version 3.4.

 -- C の関数: *note PyObject: 1a6. *Py_CompileStringExFlags (const char
          *str, const char *filename, int start, PyCompilerFlags *flags,
          int optimize)
     '戻り値: 新しい参照。' *note Py_CompileStringObject(): 5530. と似て
     いますが、 'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. でデコード
     されたバイト文字列です。

     Added in version 3.2.

 -- C の関数: *note PyObject: 1a6. *PyEval_EvalCode (PyObject *co,
          PyObject *globals, PyObject *locals)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     *note PyEval_EvalCodeEx(): 1cf8. のシンプルなインターフェースで、コ
     ードオブジェクトと、グローバル変数とローカル変数だけを受け取ります
     。 他の引数には ‘NULL’ が渡されます。

 -- C の関数: *note PyObject: 1a6. *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: 961.'  与え
     られた特定の環境で、コンパイル済みのコードオブジェクトを評価します
     。この環境はグローバル変数の辞書と、ローカル変数のマッピングオブジ
     ェクト、引数の配列、キーワードとデフォルト値、*note キーワード専用:
     7a9. 引数のデフォルト値の辞書と、セルのクロージャタプルで構成されま
     す。

 -- C の関数: *note PyObject: 1a6. *PyEval_EvalFrame (PyFrameObject *f)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  実行
     フレームを評価します。これは *note PyEval_EvalFrameEx(): 13da. に対
     するシンプルなインターフェースで、後方互換性のためのものです。

 -- C の関数: *note PyObject: 1a6. *PyEval_EvalFrameEx (PyFrameObject
          *f, int throwflag)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Python のインタープリタの主要な、直接的な関数です。実行フレーム 'f'
     に関連付けられたコードオブジェクトを実行します。 バイトコードを解釈
     して、必要に応じて呼び出しを実行します。 追加の 'throwflag' 引数は
     ほとんど無視できます。 - もし true なら、 すぐに例外を発生させます
     。これはジェネレータオブジェクトの *note throw(): 90a. メソッドで利
     用されます。

     バージョン 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: 5532.
     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: 5532.

     バージョン 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: 27df. 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: 5538. to enable features
     normally selectable using *note future statements: 677.  See *note
     Code Object Flags: 5539. 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():
     c5f. と一緒に使います。

 -- C 変数: int Py_file_input

     ファイルあるいは他のソースから読み込まれた文の並びに対するPython文
     法の開始記号で、 *note Py_CompileString(): c5f. と一緒に使います。
     これは任意の長さのPythonソースコードをコンパイルするときに使う記号
     です。

 -- C 変数: int Py_single_input

     単一の文に対するPython文法の開始記号で、 *note Py_CompileString():
     c5f. と一緒に使います。これは対話式のインタプリタループのための記号
     です。

 -- C 変数: int Py_func_type_input

     The start symbol from the Python grammar for a function type; for
     use with *note Py_CompileString(): c5f.  This is used to parse
     "signature type comments" from PEP 484(1).

     This requires the *note PyCF_ONLY_AST: 5535. flag to be set.

     参考
     ....

        * *note ast.FunctionType: 4e7f.

        * 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(): 12e0.

 -- 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: 553c.

     Added in version 3.4.

 -- C の関数: int PyCompile_OpcodeStackEffectWithJump (int opcode, int
          oparg, int jump)

     Similar to *note PyCompile_OpcodeStackEffect(): 553d, 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: 553c.

     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: e28. Py_REFCNT (PyObject *o)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.14 より).'
     Python オブジェクト 'o' の参照カウントを取得します。

     戻り値は、実際に保持されているオブジェクトの参照の数を実際に反映し
     ているとは限らないことに注意してください。例えば、一部のオブジェク
     トは永続 (*note immortal: 3a0.) であり、実際の参照の数を反映しない
     非常に高い参照数を持ちます。したがって、 0 か 1 の値以外では、正確
     な戻り値に頼らないでください。

     オブジェクトの参照カウントを設定するためには、 *note
     Py_SET_REFCNT(): c82. 関数を使用してください。

          注釈: On *note free-threaded builds: 1a3. 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(): 5f9. for that
          instead.

          See also the function *note
          PyUnstable_Object_IsUniqueReferencedTemporary(): 5fa.

     バージョン 3.10 で変更: *note Py_REFCNT(): 552. は static なインラ
     イン関数に変更されました。

     バージョン 3.11 で変更: 引数の型は const *note PyObject: 1a6.* では
     なくなりました。

 -- C の関数: void Py_SET_REFCNT (PyObject *o, Py_ssize_t refcnt)

     オブジェクト 'o' の参照カウントを 'refcnt' に設定します。

     *note フリースレッドな Python ビルド: 2379. では、 'refcnt' が
     ‘UINT32_MAX’ より大きい場合、オブジェクトは永続 (*note immortal:
     3a0.) となります。

     この関数は永続 (*note immortal: 3a0.) オブジェクトには何もしません
     。

     Added in version 3.9.

     バージョン 3.12 で変更: 永続オブジェクトは変更されません。

 -- C の関数: void Py_INCREF (PyObject *o)

     オブジェクト 'o' への新しい *note 強参照: 7e0. を取得し、それが使用
     中で破棄されてはならないことを示します。

     この関数は永続 (*note immortal: 3a0.) オブジェクトには何もしません
     。

     This function is usually used to convert a *note borrowed
     reference: 60a. to a *note strong reference: 7e0. in-place.  The
     *note Py_NewRef(): c74. function can be used to create a new strong
     reference.

     When done using the object, release is by calling *note
     Py_DECREF(): 97a.

     オブジェクトが ‘NULL’ であってはいけません。それが ‘NULL’ ではない
     と確信が持てないならば、 *note Py_XINCREF(): e2d. を使ってください
     。

     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(): 979, but the object 'o' can be
     ‘NULL’, in which case this has no effect.

     See also *note Py_XNewRef(): c75.

 -- C の関数: *note PyObject: 1a6. *Py_NewRef (PyObject *o)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Create a new *note strong reference: 7e0. to an object: call *note
     Py_INCREF(): 979. on 'o' and return the object 'o'.

     When the *note strong reference: 7e0. is no longer needed, *note
     Py_DECREF(): 97a. should be called on it to release the reference.

     The object 'o' must not be ‘NULL’; use *note Py_XNewRef(): c75. 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(): 979.

     Added in version 3.10.

 -- C の関数: *note PyObject: 1a6. *Py_XNewRef (PyObject *o)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Similar to *note Py_NewRef(): c74, 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: 7e0. to object 'o', indicating
     the reference is no longer used.

     この関数は永続 (*note immortal: 3a0.) オブジェクトには何もしません
     。

     Once the last *note strong reference: 7e0. 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:
     7e0. before exiting its scope.

     オブジェクトが ‘NULL’ であってはいけません。それが ‘NULL’ ではない
     と確信が持てないならば、 *note Py_XDECREF(): b73. を使ってください
     。

     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__(): 13ab. 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(): 97a. 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(): 97a, 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: 7e0. 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(): 97a, 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: 961.'  Indicate taking a new
     *note strong reference: 7e0. to object 'o'.  A function version of
     *note Py_XINCREF(): e2d.  It can be used for runtime dynamic
     embedding of Python.

 -- C の関数: void Py_DecRef (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'  Release a *note strong
     reference: 7e0. to object 'o'.  A function version of *note
     Py_XDECREF(): b73.  It can be used for runtime dynamic embedding of
     Python.

 -- C のマクロ: Py_SETREF (dst, src)

     Macro safely releasing a *note strong reference: 7e0. to object
     'dst' and setting 'dst' to 'src'.

     As in case of *note Py_CLEAR(): 981, "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: 982. macro that uses *note
     Py_XDECREF(): b73. instead of *note Py_DECREF(): 97a.

     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(): a7f.  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: 961.'  エラーインジケータをクリア
     します。エラーインジケータが設定されていないならば、効果はありませ
     ん。

 -- C の関数: void PyErr_PrintEx (int set_sys_last_vars)
     ' 次に属します: *note Stable ABI: 961.'  標準のトレースバックを
     ‘sys.stderr’ に出力し、エラーインジケータをクリアします。 ただし、
     エラーが ‘SystemExit’ 'である場合を除いて' です。 その場合、トレー
     スバックは出力されず、 Python プロセスは ‘SystemExit’ インスタンス
     で指定されたエラーコードで終了します。

     エラーインジケータが設定されているときに 'だけ'、この関数を呼び出し
     てください。 それ以外の場合、致命的なエラーを引き起こすでしょう!

     If 'set_sys_last_vars' is nonzero, the variable *note sys.last_exc:
     8d3. is set to the printed exception.  For backwards compatibility,
     the deprecated variables *note sys.last_type: 8d4, *note
     sys.last_value: 8d5. and *note sys.last_traceback: 8d6. are also
     set to the type, value and traceback of this exception,
     respectively.

     バージョン 3.12 で変更: The setting of *note sys.last_exc: 8d3. was
     added.

 -- C の関数: void PyErr_Print ()
     ' 次に属します: *note Stable ABI: 961.'  ‘PyErr_PrintEx(1)’ のエイ
     リアスです。

 -- C の関数: void PyErr_WriteUnraisable (PyObject *obj)
     ' 次に属します: *note Stable ABI: 961.'  現在の例外と 'obj' 引数で
     *note sys.unraisablehook(): 712. を呼び出します。

     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__(): 13ab. 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(): 712.

 -- C の関数: void PyErr_FormatUnraisable (const char *format, ...)

     Similar to *note PyErr_WriteUnraisable(): 7ee, but the 'format' and
     subsequent parameters help format the warning message; they have
     the same meaning and values as in *note PyUnicode_FromFormat():
     824.  ‘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: 961. (バージョン 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: 961.'  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: 5345.  You need not create a new *note
     strong reference: 7e0. to it (e.g.  with *note Py_INCREF(): 979.).
     The second argument is an error message; it is decoded from
     ‘'utf-8'’.

 -- C の関数: void PyErr_SetObject (PyObject *type, PyObject *value)
     ' 次に属します: *note Stable ABI: 961.'  この関数は *note
     PyErr_SetString(): 985. に似ていますが、例外の "値(value)" として任
     意のPythonオブジェクトを指定することができます。

 -- C の関数: *note PyObject: 1a6. *PyErr_Format (PyObject *exception,
          const char *format, ...)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961.'  この
     関数はエラーインジケータを設定し ‘NULL’ を返します。 'exception' は
     Python例外クラスであるべきです。 'format' と以降の引数はエラーメッ
     セージを作るためのもので, *note PyUnicode_FromFormat(): 824. の引数
     と同じ意味を持っています。 'format' は ASCII エンコードされた文字列
     です。

 -- C の関数: *note PyObject: 1a6. *PyErr_FormatV (PyObject *exception,
          const char *format, va_list vargs)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.5 より).'  *note PyErr_Format(): 1265. と同じですが、可変
     長引数の代わりに ‘va_list’ 引数を受け取ります。

     Added in version 3.5.

 -- C の関数: void PyErr_SetNone (PyObject *type)
     ' 次に属します: *note Stable ABI: 961.'  これは
     ‘PyErr_SetObject(type, Py_None)’ を省略したものです。

 -- C の関数: int PyErr_BadArgument ()
     ' 次に属します: *note Stable ABI: 961.'  これは
     ‘PyErr_SetString(PyExc_TypeError, message)’ を省略したもので、ここ
     で 'message' は組み込み操作が不正な引数で呼び出されたということを表
     しています。主に内部で使用するためのものです。

 -- C の関数: *note PyObject: 1a6. *PyErr_NoMemory ()
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961.'  これ
     は ‘PyErr_SetNone(PyExc_MemoryError)’ を省略したもので、‘NULL’ を返
     します。したがって、メモリ不足になったとき、オブジェクト割り当て関
     数は ‘return PyErr_NoMemory();’ と書くことができます。

 -- C の関数: *note PyObject: 1a6. *PyErr_SetFromErrno (PyObject *type)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961.'

     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(): 885, 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: 1a6. *PyErr_SetFromErrnoWithFilenameObject
          (PyObject *type, PyObject *filenameObject)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961.'
     Similar to *note PyErr_SetFromErrno(): 51c5, 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: 543. exception, this is used to define the
     ‘filename’ attribute of the exception instance.

 -- C の関数: *note PyObject: 1a6.
          *PyErr_SetFromErrnoWithFilenameObjects (PyObject *type,
          PyObject *filenameObject, PyObject *filenameObject2)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  *note PyErr_SetFromErrnoWithFilenameObject():
     530c. に似てますが、ファイル名を2つ取る関数が失敗したときに例外を送
     出するために、2つ目のファイル名オブジェクトを受け取ります。

     Added in version 3.4.

 -- C の関数: *note PyObject: 1a6. *PyErr_SetFromErrnoWithFilename
          (PyObject *type, const char *filename)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961.'
     *note PyErr_SetFromErrnoWithFilenameObject(): 530c. に似ていますが
     、ファイル名は C 文字列として与えられます。 'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. でデコード
     されます。

 -- C の関数: *note PyObject: 1a6. *PyErr_SetFromWindowsErr (int ierr)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  This is a convenience function to
     raise *note OSError: 543.  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: 2903.
     attribute set to the error code, the *note strerror: 2904.
     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: 234c.: Windows.

 -- C の関数: *note PyObject: 1a6. *PyErr_SetExcFromWindowsErr (PyObject
          *type, int ierr)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  *note PyErr_SetFromWindowsErr():
     530e. に似ていますが、送出する例外の型を指定する引数が追加されてい
     ます。

     *note Availability: 234c.: Windows.

 -- C の関数: *note PyObject: 1a6. *PyErr_SetFromWindowsErrWithFilename
          (int ierr, const char *filename)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  Similar to *note
     PyErr_SetFromWindowsErr(): 530e, with the additional behavior that
     if 'filename' is not ‘NULL’, it is decoded from the filesystem
     encoding (*note os.fsdecode(): 1016.) and passed to the constructor
     of *note OSError: 543. as a third parameter to be used to define
     the ‘filename’ attribute of the exception instance.

     *note Availability: 234c.: Windows.

 -- C の関数: *note PyObject: 1a6.
          *PyErr_SetExcFromWindowsErrWithFilenameObject (PyObject *type,
          int ierr, PyObject *filename)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  Similar to *note
     PyErr_SetExcFromWindowsErr(): 5309, with the additional behavior
     that if 'filename' is not ‘NULL’, it is passed to the constructor
     of *note OSError: 543. as a third parameter to be used to define
     the ‘filename’ attribute of the exception instance.

     *note Availability: 234c.: Windows.

 -- C の関数: *note PyObject: 1a6.
          *PyErr_SetExcFromWindowsErrWithFilenameObjects (PyObject
          *type, int ierr, PyObject *filename, PyObject *filename2)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  *note
     PyErr_SetExcFromWindowsErrWithFilenameObject(): 530a. に似てますが
     、2つ目のファイル名オブジェクトを受け取ります。

     *note Availability: 234c.: Windows.

     Added in version 3.4.

 -- C の関数: *note PyObject: 1a6.
          *PyErr_SetExcFromWindowsErrWithFilename (PyObject *type, int
          ierr, const char *filename)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  *note
     PyErr_SetFromWindowsErrWithFilename(): 1cac. に似ていますが、送出す
     る例外の型を指定する引数が追加されています。

     *note Availability: 234c.: Windows.

 -- C の関数: *note PyObject: 1a6. *PyErr_SetImportError (PyObject *msg,
          PyObject *name, PyObject *path)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  *note ImportError: 1c8. を簡単に送出するための
     関数です。 'msg' は例外のメッセージ文字列としてセットされます。
     'name' と 'path' はどちらも ‘NULL’ にしてよく、それぞれ
     ‘ImportError’ の ‘name’ 属性と ‘path’ 属性としてセットされます。

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyErr_SetImportErrorSubclass
          (PyObject *exception, PyObject *msg, PyObject *name, PyObject
          *path)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.6 より).'  *note PyErr_SetImportError(): 10f9. とよく似て
     いますが、この関数は送出する例外として、 *note ImportError: 1c8. の
     サブクラスを指定できます。

     Added in version 3.6.

 -- C の関数: void PyErr_SyntaxLocationObject (PyObject *filename, int
          lineno, int col_offset)

     現在の例外のファイル、行、オフセットの情報をセットします。 現在の例
     外が *note SyntaxError: 189. でない場合は、例外を表示するサブシステ
     ムが、例外が ‘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(): 5547, 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: 961. (バージョン 3.7 より).'
     *note PyErr_SyntaxLocationObject(): 5547. と似ていますが、
     'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. でデコード
     されたバイト文字列です。

     Added in version 3.2.

 -- C の関数: void PyErr_SyntaxLocation (const char *filename, int
          lineno)
     ' 次に属します: *note Stable ABI: 961.'  *note
     PyErr_SyntaxLocationEx(): 5312. と似ていますが、 'col_offset' 引数
     が除去されています。

 -- C の関数: void PyErr_BadInternalCall ()
     ' 次に属します: *note Stable ABI: 961.'
     ‘PyErr_SetString(PyExc_SystemError, message)’ を省略したものです。
     ここで 'message' は内部操作(例えば、Python/C API関数)が不正な引数と
     ともに呼び出されたということを示しています。主に内部で使用するため
     のものです。

 -- C の関数: *note PyObject: 1a6. *PyErr_ProgramTextObject (PyObject
          *filename, int lineno)

     Get the source line in 'filename' at line 'lineno'.  'filename'
     should be a Python *note str: 1ea. 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: 1a6. *PyErr_ProgramText (const char
          *filename, int lineno)
     ' 次に属します: *note Stable ABI: 961.'  Similar to *note
     PyErr_ProgramTextObject(): 5549, but 'filename' is a const char*,
     which is decoded with the *note filesystem encoding and error
     handler: 94d, instead of a Python object reference.


File: python.info,  Node: 警告<3>,  Next: エラーインジケータの問い合わせ,  Prev: 例外の送出,  Up: 例外処理

7.5.3 警告
----------

以下の関数を使い、 C コードで起きた警告を報告します。 Python の *note
warnings: 11b. モジュールで公開されている同様の関数とよく似てます。 これ
らの関数は通常警告メッセージを 'sys.stderr' へ出力しますが、ユーザが警告
をエラーへ変更するように指定することもでき、その場合は、関数は例外を送出
します。 警告機構がもつ問題のためにその関数が例外を送出するということも
有り得ます。 例外が送出されない場合は戻り値は ‘0’ で、例外が送出された場
合は ‘-1’ です。 (警告メッセージが実際に出力されるか、およびその例外の原
因が何かについては判断できません; これは意図的なものです。) 例外が送出さ
れた場合、呼び出し元は通常の例外処理を行います (例えば、保持していた参照
に対し *note Py_DECREF(): 97a. を行い、エラー値を返します)。

 -- C の関数: int PyErr_WarnEx (PyObject *category, const char *message,
          Py_ssize_t stack_level)
     ' 次に属します: *note Stable ABI: 961.'  警告メッセージを発行します
     。 'category' 引数は警告カテゴリ(以下を参照) かまたは ‘NULL’ で、
     'message' 引数は UTF-8 エンコードされた文字列です。 'stacklevel' は
     スタックフレームの数を示す正の整数です; 警告はそのスタックフレーム
     の中の実行している行から発行されます。 'stacklevel' が 1 だと *note
     PyErr_WarnEx(): 1804. を呼び出している関数が、2 だとその上の関数が
     Warning の発行元になります。

     警告カテゴリは *note PyExc_Warning: 5356. のサブクラスでなければな
     りません。 ‘PyExc_Warning’ は *note PyExc_Exception: 532a. のサブク
     ラスです。 デフォルトの警告カテゴリは *note PyExc_RuntimeWarning:
     5346. です。 標準の Python 警告カテゴリは、 *note Warning types:
     554b. で名前が列挙されているグローバル変数として利用可能です。

     警告をコントロールするための情報については、 *note warnings: 11b. モ
     ジュールのドキュメンテーションとコマンドライン・ドキュメンテーショ
     ンの *note -W: 1cb. オプションを参照してください。警告コントロール
     のためのC APIはありません。

 -- C の関数: int PyErr_WarnExplicitObject (PyObject *category, PyObject
          *message, PyObject *filename, int lineno, PyObject *module,
          PyObject *registry)

     すべての警告の属性を明示的に制御した警告メッセージを出します。これ
     は Python 関数 *note warnings.warn_explicit(): 2b6. の直接的なラッ
     パーで、さらに情報を得るにはそちらを参照してください。そこに説明さ
     れているデフォルトの効果を得るために、 '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: 961.'  *note
     PyErr_WarnExplicitObject(): 554c. に似ていますが、 'message' と
     'module' が UTF-8 エンコードされた文字列であるところが異なり、
     'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. でデコード
     されます。

 -- C の関数: int PyErr_WarnFormat (PyObject *category, Py_ssize_t
          stack_level, const char *format, ...)
     ' 次に属します: *note Stable ABI: 961.'  *note PyErr_WarnEx():
     1804. に似たような関数ですが、警告メッセージをフォーマットするのに
     *note PyUnicode_FromFormat(): 824. を使用します。 'format' は ASCII
     にエンコードされた文字列です。

     Added in version 3.2.

 -- C の関数: int PyErr_WarnExplicitFormat (PyObject *category, const
          char *filename, int lineno, const char *module, PyObject
          *registry, const char *format, ...)

     Similar to *note PyErr_WarnExplicit(): 1cb2, but uses *note
     PyUnicode_FromFormat(): 824. 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: 961. (バージョン 3.6 より).'
     Function similar to *note PyErr_WarnFormat(): 5313, but 'category'
     is *note ResourceWarning: 754. 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: 1a6. *PyErr_Occurred ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'  エラー
     インジケータが設定されているかテストします。設定されている場合は、
     例外の '型' (‘PyErr_Set*’ 関数の一つあるいは *note PyErr_Restore():
     645. への最も新しい呼び出しに対する第一引数)を返します。設定されて
     いない場合は ‘NULL’ を返します。あなたは戻り値への参照を持っていま
     せんので、それに *note Py_DECREF(): 97a. する必要はありません。

     The caller must have an *note attached thread state: 1ac.

          注釈: 戻り値を特定の例外と比較しないでください。その代わりに、
          下に示す *note PyErr_ExceptionMatches(): 5274. を使ってくださ
          い。(比較は簡単に失敗するでしょう。なぜなら、例外はクラスでは
          なくインスタンスかもしれないし、あるいは、クラス例外の場合は期
          待される例外のサブクラスかもしれないからです。)

 -- C の関数: int PyErr_ExceptionMatches (PyObject *exc)
     ' 次に属します: *note Stable ABI: 961.'
     ‘PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)’ と同じ。例外が
     実際に設定されたときにだけ、これを呼び出だすべきです。例外が発生し
     ていないならば、メモリアクセス違反が起きるでしょう。

 -- C の関数: int PyErr_GivenExceptionMatches (PyObject *given, PyObject
          *exc)
     ' 次に属します: *note Stable ABI: 961.'  例外 'given' が 'exc' の例
     外型と適合する場合に真を返します。 'exc' がクラスオブジェクトである
     場合も、 'given' がサブクラスのインスタンスであるときに真を返します
     。 'exc' がタプルの場合は、タプルにある (およびそのサブタプルに再帰
     的にある) すべての例外型が適合するか調べられます。

 -- C の関数: *note PyObject: 1a6. *PyErr_GetRaisedException (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.12 より).'  現在発生している例外を返し、同時にエラーインジ
     ケータを消去します。エラーインジケータが設定されていない場合は
     ‘NULL’ を返します。

     この関数は、例外をキャッチする必要があるコード、または一時的にエラ
     ーインジケータを保存・復元する必要があるコードに使用されます。

     例えば:

          {
             PyObject *exc = PyErr_GetRaisedException();

             /* ... 他のエラーを発生させる可能性があるコード ... */

             PyErr_SetRaisedException(exc);
          }

     参考
     ....

     *note PyErr_GetHandledException(): b56, to save the exception
     currently being handled.

     Added in version 3.12.

 -- C の関数: void PyErr_SetRaisedException (PyObject *exc)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 961.'

     バージョン 3.12 で非推奨: Use *note PyErr_GetRaisedException():
     643. 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: 961.'

     バージョン 3.12 で非推奨: Use *note PyErr_SetRaisedException():
     646. 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(): 642. to save the current error
          indicator.

 -- C の関数: void PyErr_NormalizeException (PyObject **exc, PyObject
          **val, PyObject **tb)
     ' 次に属します: *note Stable ABI: 961.'

     バージョン 3.12 で非推奨: Use *note PyErr_GetRaisedException():
     643. instead, to avoid any possible de-normalization.

     ある状況では、以下の *note PyErr_Fetch(): 642. が返す値は "正規化さ
     れていない" 可能性があります。つまり、 ‘*exc’ はクラスオブジェクト
     だが ‘*val’ は同じクラスのインスタンスではないという意味です。この
     関数はそのような場合にそのクラスをインスタンス化するために使われま
     す。その値がすでに正規化されている場合は何も起きません。遅延正規化
     はパフォーマンスを改善するために実装されています。

          注釈: This function 'does not' implicitly set the *note
          __traceback__: 1680. 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: 1a6. *PyErr_GetHandledException (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     Retrieve the active exception instance, as would be returned by
     *note sys.exception(): a80.  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(): b57. を使
          ってください。

     Added in version 3.11.

 -- C の関数: void PyErr_SetHandledException (PyObject *exc)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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(): b56. を使ってください。

     Added in version 3.11.

 -- C の関数: void PyErr_GetExcInfo (PyObject **ptype, PyObject
          **pvalue, PyObject **ptraceback)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'
     Retrieve the old-style representation of the exception info, as
     known from *note sys.exc_info(): a7f.  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(): b56.

          注釈: この関数は、通常は例外を扱うコードでは使用されません。正
          確に言うと、これは例外の状態を一時的に保存し、元に戻す必要があ
          るコードで使用することができます。例外の状態を元に戻す、もしく
          はクリアするには *note PyErr_SetExcInfo(): b58. を使ってくださ
          い。

     Added in version 3.3.

 -- C の関数: void PyErr_SetExcInfo (PyObject *type, PyObject *value,
          PyObject *traceback)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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(): b57.

          注釈: この関数は、通常は例外を扱うコードでは使用されません。正
          確に言うと、これは例外の状態を一時的に保存し、元に戻す必要があ
          るコードで使用することができます。例外の状態を取得するには
          *note PyErr_GetExcInfo(): b59. を使ってください。

     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: 961.'

     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: 4e6. signal.  This function executes the
     corresponding Python signal handler, which, by default, raises the
     *note KeyboardInterrupt: d9a. 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: ce. 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: 4c1b. script.

        - Raise the exception set by *note PyThreadState_SetAsyncExc():
          f86.

     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(): 885. 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.

     バージョン 3.15 で変更: The exception set by *note
     PyThreadState_SetAsyncExc(): f86. is now raised.

 -- C の関数: void PyErr_SetInterrupt ()
     ' 次に属します: *note Stable ABI: 961.'

     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: 1ac. and from a C
          signal handler.

 -- C の関数: int PyErr_SetInterruptEx (int signum)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'

     シグナルが到達した効果をシミュレートします。 次に *note
     PyErr_CheckSignals(): 885. が呼ばれたとき、与えられたシグナル番号用
     の 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: 1dcb. or *note signal.SIG_IGN: 1dca.), 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: 1ac. 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(): f31. と同等ですが、
     どんなエラーチェックも行いません。 'fd' は有効なファイル記述子であ
     るべきです。 この関数はメインスレッドからのみ呼び出されるべきです。

     バージョン 3.5 で変更: Windowsで、この関数はソケットハンドルをサポ
     ートするようになりました。


File: python.info,  Node: 例外クラス<2>,  Next: 例外オブジェクト,  Prev: シグナルハンドリング<2>,  Up: 例外処理

7.5.6 例外クラス
----------------

 -- C の関数: *note PyObject: 1a6. *PyErr_NewException (const char
          *name, PyObject *base, PyObject *dict)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  この
     ユーティリティ関数は新しい例外クラスを作成して返します。 'name' 引
     数は新しい例外の名前、 ‘module.classname’ 形式の C文字列でなければ
     ならない。 'base' と 'dict' 引数は通常 ‘NULL’ です。これはすべての
     例外のためのルート、組み込み名 *note Exception: da2. (Cでは *note
     PyExc_Exception: 532a. としてアクセス可能)をルートとして派生したク
     ラスオブジェクトを作成します。

     The *note __module__: 811. 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: 1a6. *PyErr_NewExceptionWithDoc (const
          char *name, const char *doc, PyObject *base, PyObject *dict)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     *note PyErr_NewException(): 1623. とほぼ同じですが、新しい例外クラ
     スに簡単に 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: 961. (バージョン 3.8 より).'
     Return *note tp_name: 1ec5. of the exception class 'ob'.

 -- C のマクロ: PyException_HEAD

     This is a macro including the base fields for an exception object.

     This was included in Python's C API by mistake and is not designed
     for use in extensions.  For creating custom exception objects, use
     *note PyErr_NewException(): 1623. or otherwise create a class
     inheriting from *note PyExc_BaseException: 531b.

     *note Soft deprecated: 1b2. since version 3.15.


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: 9bd,
     false otherwise.  This function always succeeds.

 -- C のマクロ: PyExceptionInstance_Class (op)

     Equivalent to *note Py_TYPE(op): 5fc.

 -- C の関数: *note PyObject: 1a6. *PyException_GetTraceback (PyObject
          *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Python で *note __traceback__: 1680. 属性からアクセスできるものと同
     じ、例外に関する traceback の新しい参照を返します。関係する
     traceback が無い場合は、 ‘NULL’ を返します。

 -- C の関数: int PyException_SetTraceback (PyObject *ex, PyObject *tb)
     ' 次に属します: *note Stable ABI: 961.'  その例外に関する traceback
     に 'tb' をセットします。クリアするには ‘Py_None’ を使用してください
     。

 -- C の関数: *note PyObject: 1a6. *PyException_GetContext (PyObject
          *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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__:
     1681. attribute.  If there is no context associated, this returns
     ‘NULL’.

 -- C の関数: void PyException_SetContext (PyObject *ex, PyObject *ctx)
     ' 次に属します: *note Stable ABI: 961.'  例外に関するコンテキストに
     'ctx' をセットします。クリアするには ‘NULL’ を使用してください。
     'ctx' が例外インスタンスかどうかを確かめる型チェックは行われません
     。これは 'ctx' への参照を盗みます。

 -- C の関数: *note PyObject: 1a6. *PyException_GetCause (PyObject *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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__:
     1682. attribute.

 -- C の関数: void PyException_SetCause (PyObject *ex, PyObject *cause)
     ' 次に属します: *note Stable ABI: 961.'  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__: 2729. attribute is implicitly set
     to ‘True’ by this function.

 -- C の関数: *note PyObject: 1a6. *PyException_GetArgs (PyObject *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.12 より).'  Return *note args: 977. of exception 'ex'.

 -- C の関数: void PyException_SetArgs (PyObject *ex, PyObject *args)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     Set *note args: 977. of exception 'ex' to 'args'.

 -- C の関数: *note PyObject: 1a6. *PyUnstable_Exc_PrepReraiseStar
          (PyObject *orig, PyObject *excs)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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: 6de. 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: 1a6. *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: 961.'
     'encoding', 'object', 'length', 'start', 'end', 'reason' 属性をもっ
     た *note UnicodeDecodeError: ddb. オブジェクトを作成します。
     'encoding' および 'reason' は UTF-8 エンコードされた文字列です。

 -- C の関数: *note PyObject: 1a6. *PyUnicodeDecodeError_GetEncoding
          (PyObject *exc)
 -- C の関数: *note PyObject: 1a6. *PyUnicodeEncodeError_GetEncoding
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた例外オブジェクトの 'encoding' 属性を返します。

 -- C の関数: *note PyObject: 1a6. *PyUnicodeDecodeError_GetObject
          (PyObject *exc)
 -- C の関数: *note PyObject: 1a6. *PyUnicodeEncodeError_GetObject
          (PyObject *exc)
 -- C の関数: *note PyObject: 1a6. *PyUnicodeTranslateError_GetObject
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた例外オブジェクトの '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: 961.'  渡された例外オブジェクトか
     ら 'start' 属性を取得して '*start' に格納します。'start' は ‘NULL’
     であってはなりません。成功したら ‘0’ を、失敗したら ‘-1’ を返します
     。

     If the *note UnicodeError.object: 1b3a. is an empty sequence, the
     resulting 'start' is ‘0’.  Otherwise, it is clipped to ‘[0,
     len(object) - 1]’.

     参考
     ....

     *note UnicodeError.start: 1b00.

 -- 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: 961.'  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: 961.'  渡された例外オブジェクトか
     ら 'end' 属性を取得して '*end' に格納します。'end' は ‘NULL’ であっ
     てはなりません。成功したら ‘0’ を、失敗したら ‘-1’ を返します。

     If the *note UnicodeError.object: 1b3a. 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: 961.'  渡された例外オブジェクトの
     'end' 属性を 'end' に設定します。成功したら ‘0’ を、失敗したら ‘-1’
     を返します。

     参考
     ....

     *note UnicodeError.end: 1b01.

 -- C の関数: *note PyObject: 1a6. *PyUnicodeDecodeError_GetReason
          (PyObject *exc)
 -- C の関数: *note PyObject: 1a6. *PyUnicodeEncodeError_GetReason
          (PyObject *exc)
 -- C の関数: *note PyObject: 1a6. *PyUnicodeTranslateError_GetReason
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  渡さ
     れた例外オブジェクトの '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: 961.'  渡された例外オブジェクトの
     '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: 98a. takes
care of recursion handling.

 -- C の関数: int Py_EnterRecursiveCall (const char *where)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.9 より).'  C レ
     ベルの再帰呼び出しをしようとしているところに印を付けます。

     The function then checks if the stack limit is reached.  If this is
     the case, a *note RecursionError: 1125. is set and a nonzero value
     is returned.  Otherwise, zero is returned.

     'where' は ‘" in instance check"’ のような UTF-8 エンコードされた文
     字列にして、再帰の深さの限界に達したことで送出される *note
     RecursionError: 1125. のメッセージに連結できるようにすべきです。

     参考
     ....

     The *note PyUnstable_ThreadState_SetStackProtection(): 39d.
     function.

     バージョン 3.9 で変更: This function is now also available in the
     *note limited API: 82f.

 -- C の関数: void Py_LeaveRecursiveCall (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.9 より).'
     *note Py_EnterRecursiveCall(): 605. を終了させます。
     ‘Py_EnterRecursiveCall()’ の '成功した' 呼び出しに対し 1 回呼ばなけ
     ればなりません。

     バージョン 3.9 で変更: This function is now also available in the
     *note limited API: 82f.

コンテナ型に対し *note tp_repr: 5208. を適切に実装するには、特殊な再帰の
処理が求められます。スタックの防護に加え、 ‘tp_repr’ は循環処理を避ける
ためにオブジェクトを辿っていく必要があります。次の 2 つの関数はその機能
を容易にします。実質的には、これらは *note reprlib.recursive_repr():
15b2. と同等な C の実装です。

 -- C の関数: int Py_ReprEnter (PyObject *object)
     ' 次に属します: *note Stable ABI: 961.'  循環処理を検知するために、
     *note tp_repr: 5208. の実装の先頭で呼び出します。

     そのオブジェクトが既に処理されたものだった場合、この関数は正の整数
     を返します。その場合、 *note tp_repr: 5208. の実装は、循環を示す文
     字列オブジェクトを返すべきです。例えば、 *note dict: 193. オブジェ
     クトは ‘{...}’ を返しますし、 *note list: 4e0. オブジェクトは
     ‘[...]’ を返します。

     再帰回数の上限に達した場合は、この関数は負の整数を返します。この場
     合、 *note tp_repr: 5208. の実装は一般的には ‘NULL’ を返すべきです
     。

     それ以外の場合は、関数はゼロを返し、 *note tp_repr: 5208. の実装は
     通常どおり処理を続けてかまいません。

 -- C の関数: void Py_ReprLeave (PyObject *object)
     ' 次に属します: *note Stable ABI: 961.'  *note Py_ReprEnter():
     5488. を終了させます。 0 を返した ‘Py_ReprEnter()’ の呼び出しに対し
     1 回呼ばなければなりません。

 -- C の関数: int Py_GetRecursionLimit (void)
     ' 次に属します: *note Stable ABI: 961.'  Get the recursion limit
     for the current interpreter.  It can be set with *note
     Py_SetRecursionLimit(): 548a.  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: 1ac.

     参考
     ....

     *note sys.getrecursionlimit(): 8d9.

 -- C の関数: void Py_SetRecursionLimit (int new_limit)
     ' 次に属します: *note Stable ABI: 961.'  Set the recursion limit
     for the current interpreter.

     This function cannot fail, and the caller must hold an *note
     attached thread state: 1ac.

     参考
     ....

     *note sys.setrecursionlimit(): 8d8.


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: 1a6.*; 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: 1a6.                       *note BaseException: 9bd.
          *PyExc_BaseException                         
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note BaseExceptionGroup: 76d.
          *PyExc_BaseExceptionGroup                    
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.11 より).'

 -- C 変数: *note PyObject: 1a6. *PyExc_Exception      *note Exception: da2.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note ArithmeticError: 28f9.
          *PyExc_ArithmeticError                       
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note AssertionError: a9c.
          *PyExc_AssertionError                        
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note AttributeError: 1b4.
          *PyExc_AttributeError                        
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note BlockingIOError: 4ca.
          *PyExc_BlockingIOError                       
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note BrokenPipeError: 1412.
          *PyExc_BrokenPipeError                       
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6. *PyExc_BufferError    *note BufferError: 19b9.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note ChildProcessError: 140e.
          *PyExc_ChildProcessError                     
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note ConnectionAbortedError: 1413.
          *PyExc_ConnectionAbortedError                
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note ConnectionError: 11c3.
          *PyExc_ConnectionError                       
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note ConnectionRefusedError: 1414.
          *PyExc_ConnectionRefusedError                
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note ConnectionResetError: 1415.
          *PyExc_ConnectionResetError                  
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6. *PyExc_EOFError       *note EOFError: 1693.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note FileExistsError: 13cd.
          *PyExc_FileExistsError                       
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note FileNotFoundError: 24f.
          *PyExc_FileNotFoundError                     
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note FloatingPointError: 28fa.
          *PyExc_FloatingPointError                    
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note GeneratorExit: 1780.
          *PyExc_GeneratorExit                         
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note ImportCycleError: 28ff.
          *PyExc_ImportCycleError                      

 -- C 変数: *note PyObject: 1a6. *PyExc_ImportError    *note ImportError: 1c8.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note IndentationError: 18ef.
          *PyExc_IndentationError                      
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6. *PyExc_IndexError     *note IndexError: 18ed.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note InterruptedError: 1145.
          *PyExc_InterruptedError                      
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note IsADirectoryError: 140f.
          *PyExc_IsADirectoryError                     
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6. *PyExc_KeyError       *note KeyError: 7e5.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note KeyboardInterrupt: d9a.
          *PyExc_KeyboardInterrupt                     
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6. *PyExc_LookupError    *note LookupError: 25f9.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6. *PyExc_MemoryError    *note MemoryError: 191d.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note ModuleNotFoundError: 1c9.
          *PyExc_ModuleNotFoundError                   
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.6 より).'

 -- C 変数: *note PyObject: 1a6. *PyExc_NameError      *note NameError: 66c.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note NotADirectoryError: 1410.
          *PyExc_NotADirectoryError                    
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note NotImplementedError: 5a1.
          *PyExc_NotImplementedError                   
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6. *PyExc_OSError        *note OSError: 543.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note OverflowError: c5b.
          *PyExc_OverflowError                         
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note PermissionError: 10fd.
          *PyExc_PermissionError                       
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note ProcessLookupError: 1411.
          *PyExc_ProcessLookupError                    
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note PythonFinalizationError: 691.
          *PyExc_PythonFinalizationError               

 -- C 変数: *note PyObject: 1a6.                       *note RecursionError: 1125.
          *PyExc_RecursionError                        
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note ReferenceError: 18c5.
          *PyExc_ReferenceError                        
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6. *PyExc_RuntimeError   *note RuntimeError: 317.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note StopAsyncIteration: 201d.
          *PyExc_StopAsyncIteration                    
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note StopIteration: fbe.
          *PyExc_StopIteration                         
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6. *PyExc_SyntaxError    *note SyntaxError: 189.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6. *PyExc_SystemError    *note SystemError: 3f1.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6. *PyExc_SystemExit     *note SystemExit: 10fb.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6. *PyExc_TabError       *note TabError: 955.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6. *PyExc_TimeoutError   *note TimeoutError: c12.
     ' 次に属します: *note Stable ABI: 961. (バージ    
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6. *PyExc_TypeError      *note TypeError: 29c.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note UnboundLocalError: 18ee.
          *PyExc_UnboundLocalError                     
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note UnicodeDecodeError: ddb.
          *PyExc_UnicodeDecodeError                    
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note UnicodeEncodeError: a6c.
          *PyExc_UnicodeEncodeError                    
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6. *PyExc_UnicodeError   *note UnicodeError: 67c.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note UnicodeTranslateError: 1b3b.
          *PyExc_UnicodeTranslateError                 
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6. *PyExc_ValueError     *note ValueError: 15a.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note ZeroDivisionError: d15.
          *PyExc_ZeroDivisionError                     
     ' 次に属します: *note Stable ABI: 961.'

Added in version 3.3: *note PyExc_BlockingIOError: 531d. 、 *note
PyExc_BrokenPipeError: 531e. 、 *note PyExc_ChildProcessError: 5321. 、
*note PyExc_ConnectionError: 5323. 、 *note
PyExc_ConnectionAbortedError: 5322. 、 *note
PyExc_ConnectionRefusedError: 5324. 、 *note PyExc_ConnectionResetError:
5325. 、 *note PyExc_FileExistsError: 532b. 、 *note
PyExc_FileNotFoundError: 532c. 、 *note PyExc_InterruptedError: 5335. 、
*note PyExc_IsADirectoryError: 5336. 、 *note PyExc_NotADirectoryError:
533d. 、 *note PyExc_PermissionError: 5341. 、 *note
PyExc_ProcessLookupError: 5342. 、 *note PyExc_TimeoutError: 534e. は
PEP 3151(1) により導入されました。

Added in version 3.5: *note PyExc_StopAsyncIteration: 5347. および *note
PyExc_RecursionError: 1266. 。

Added in version 3.6: *note PyExc_ModuleNotFoundError: 533b.

Added in version 3.11: *note PyExc_BaseExceptionGroup: 531c.

   ---------- 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: 51c8.

バージョン 3.3 で変更: これらのエイリアスは例外の種類を分けるために使わ
れます。

C name                                Python name                           注釈
                                                                            
------------------------------------------------------------------------------------------------------------------
                                                                            
 -- C 変数: *note PyObject: 1a6.      *note OSError: 543.
          *PyExc_EnvironmentError     
     ' 次に属します:
     *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.      *note OSError: 543.
          *PyExc_IOError              
     ' 次に属します:
     *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.      *note OSError: 543.                   *note [win]: 5560.
          *PyExc_WindowsError                                               
     ' 次に属します:
     *note Stable ABI: 961. 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: 1a6. *PyExc_Warning        *note Warning: 2926.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6. *PyExc_BytesWarning   *note BytesWarning: 2fa.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyObject: 1a6.                       *note DeprecationWarning: 2d4.
          *PyExc_DeprecationWarning                    
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note EncodingWarning: 233c.
          *PyExc_EncodingWarning                       
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.10 より).'

 -- C 変数: *note PyObject: 1a6.                       *note FutureWarning: 84d.
          *PyExc_FutureWarning                         
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note ImportWarning: 90c.
          *PyExc_ImportWarning                         
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note PendingDeprecationWarning: c9f.
          *PyExc_PendingDeprecationWarning             
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note ResourceWarning: 754.
          *PyExc_ResourceWarning                       
     ' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 1a6.                       *note RuntimeWarning: 6e3.
          *PyExc_RuntimeWarning                        
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note SyntaxWarning: 451.
          *PyExc_SyntaxWarning                         
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6.                       *note UnicodeWarning: 17dc.
          *PyExc_UnicodeWarning                        
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyObject: 1a6. *PyExc_UserWarning    *note UserWarning: 2927.
     ' 次に属します: *note Stable ABI: 961.'           

Added in version 3.2: *note PyExc_ResourceWarning: 5344.

Added in version 3.10: *note PyExc_EncodingWarning: 5328.


File: python.info,  Node: Tracebacks,  Prev: Exception and warning types,  Up: 例外処理

7.5.11 Tracebacks
-----------------

 -- C 変数: *note PyTypeObject: e6f. PyTraceBack_Type
     ' 次に属します: *note Stable ABI: 961.'  Type object for traceback
     objects.  This is available as *note types.TracebackType: ebc. 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: 961.'  Replace the *note
     __traceback__: 1680. 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: 961.'  Write the traceback 'tb'
     into the file 'f'.

     This function returns ‘0’ on success, and returns ‘-1’ with an
     exception set on failure.

 -- C の関数: const char *PyUnstable_DumpTraceback (int fd,
          PyThreadState *tstate)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Write a trace of the Python stack in 'tstate' into the file 'fd'.
     The format looks like:

          Traceback (most recent call first):
            File "xxx", line xxx in <xxx>
            File "xxx", line xxx in <xxx>
            ...
            File "xxx", line xxx in <xxx>

     This function is meant to debug situations such as segfaults, fatal
     errors, and similar.  The file and function names it outputs are
     encoded to ASCII with backslashreplace and truncated to 500
     characters.  It writes only the first 100 frames; further frames
     are truncated with the line ‘...’.

     This function will return ‘NULL’ on success, or an error message on
     error.

     This function is intended for use in crash scenarios such as signal
     handlers for SIGSEGV, where the interpreter may be in an
     inconsistent state.  Given that it reads interpreter data
     structures that may be partially modified, the function might
     produce incomplete output or it may even crash itself.

     The caller does not need to hold an *note attached thread state:
     1ac, nor does 'tstate' need to be attached.

     Added in version 3.15.

 -- C の関数: const char *PyUnstable_DumpTracebackThreads (int fd,
          PyInterpreterState *interp, PyThreadState *current_tstate,
          Py_ssize_t max_threads)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Write the traces of all Python threads in 'interp' into the file
     'fd'.

     If 'interp' is ‘NULL’ then this function will try to identify the
     current interpreter using thread-specific storage.  If it cannot,
     it will return an error.

     If 'current_tstate' is not ‘NULL’ then it will be used to identify
     what the current thread is in the written output.  If it is ‘NULL’
     then this function will identify the current thread using
     thread-specific storage.  It is not an error if the function is
     unable to get the current Python thread state.

     This function will return ‘NULL’ on success, or an error message on
     error.

     This function is meant to debug debug situations such as segfaults,
     fatal errors, and similar.  It calls *note
     PyUnstable_DumpTraceback(): 3a1. for each thread.  It only writes
     the tracebacks of the first 'max_threads' threads, further output
     is truncated with the line ‘...’.  If 'max_threads' is 0, the
     function will use a default value of 100 for the argument.

     This function is intended for use in crash scenarios such as signal
     handlers for SIGSEGV, where the interpreter may be in an
     inconsistent state.  Given that it reads interpreter data
     structures that may be partially modified, the function might
     produce incomplete output or it may even crash itself.

     The caller does not need to hold an *note attached thread state:
     1ac, nor does 'current_tstate' need to be attached.

          警告: On the *note free-threaded build: 1a3, this function is
          not thread-safe.  If another thread deletes its *note thread
          state: 1a90. while this function is being called, the process
          will likely crash.

     Added in version 3.15.


File: python.info,  Node: 拡張モジュールの定義,  Next: Definition slots,  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 'export hook' function (or an old-style *note
initialization function: 5567.).

デフォルトで (つまり、 *note importlib.machinery.ExtensionFileLoader:
1075. によって) インポート可能であるためには、共有ライブラリは *note
sys.path: 19f. 上で利用可能である必要があり、モジュール名と *note
importlib.machinery.EXTENSION_SUFFIXES: 929.  に含まれる拡張子で命名する
必要があります。

     注釈: 拡張モジュールのビルド、パッケージ化および配布には、サードパ
     ーティのツールが最適であり、このドキュメントの範囲外です。適切なツ
     ールの一つは Setuptools であり、ドキュメントは
     ‘https://setuptools.pypa.io/en/latest/setuptools.html’ にあります。

* Menu:

* Extension export hook::
* 多段階初期化::
* 複数のモジュールインスタンス::
* PyInit function::


File: python.info,  Node: Extension export hook,  Next: 多段階初期化,  Up: 拡張モジュールの定義

7.6.1 Extension export hook
---------------------------

Added in version 3.15: Support for the ‘PyModExport_<NAME>’ export hook
was added in Python 3.15.  The older way of defining modules is still
available: consult either the *note PyInit function: 5567. section or
earlier versions of this documentation if you plan to support earlier
Python versions.

The export hook must be an exported function with the following
signature:

 -- C の関数: *note PySlot: 1a8. *PyModExport_modulename (void)

For modules with ASCII-only names, the *note export hook: 395. must be
named ‘PyModExport_<NAME>’, with ‘<name>’ replaced by the module's name.

For non-ASCII module names, the export hook must instead be named
‘PyModExportU_<NAME>’ (note the ‘U’), with ‘<name>’ encoded using
Python's 'punycode' encoding with hyphens replaced by underscores.  In
Python:

     def hook_name(name):
         try:
             suffix = b'_' + name.encode('ascii')
         except UnicodeEncodeError:
             suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')
         return b'PyModExport' + suffix

The export hook returns an array of *note PySlot: 1a8. entries,
terminated by an entry with a slot ID of ‘0’.  These slots describe how
the module should be created and initialized.

This array must remain valid and constant until interpreter shutdown.
Typically, it should use ‘static’ storage.  Prefer using the *note
Py_mod_create: 54a4. and *note Py_mod_exec: d4a. slots for any dynamic
behavior.

The export hook may return ‘NULL’ with an exception set to signal
failure.

It is recommended to define the export hook function using a helper
macro:

 -- C のマクロ: PyMODEXPORT_FUNC
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Declare an extension module export hook.  This macro:

        * specifies the *note PySlot: 1a8.* 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:

     PyABIInfo_VAR(abi_info);

     static PySlot spam_slots[] = {
         PySlot_STATIC_DATA(Py_mod_abi, &abi_info),
         PySlot_STATIC_DATA(Py_mod_name, "spam"),
         PySlot_FUNC(Py_mod_init, spam_init_function),
         ...
         PySlot_END
     };

     PyMODEXPORT_FUNC
     PyModExport_spam(void)
     {
         return spam_slots;
     }

The export hook is typically the only non-‘static’ item defined in the
module's C source.

The hook should be kept short - ideally, one line as above.  If you do
need to use Python C API in this function, it is recommended to call
‘PyABIInfo_Check(&abi_info, "modulename")’ first to raise an exception,
rather than crash, in common cases of ABI mismatch.

     注釈: It is possible to export multiple modules from a single
     shared library by defining multiple export hooks.  However,
     importing them requires a custom importer or suitably named
     copies/links of the extension file, because Python's import
     machinery only finds the function corresponding to the filename.
     See the Multiple modules in one library(1) section in PEP 489(2)
     for details.

   ---------- 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: Extension export hook,  Up: 拡張モジュールの定義

7.6.2 多段階初期化
------------------

The process of creating an extension module follows several phases:

   - Python finds and calls the export hook to get information on how to
     create the module.

   - 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.  Slots like *note
     Py_mod_abi: 360, *note Py_mod_gil: 697. and *note
     Py_mod_multiple_interpreters: 54a5. influence this step.

   - By default, Python itself then creates the module object - that is,
     it does the equivalent of calling *note __new__(): 987. when
     creating an object.  This step can be overridden using the *note
     Py_mod_create: 54a4. slot.

   - Python sets initial module attributes like *note __package__: 593.
     and *note __loader__: 30b, and inserts the module object into *note
     sys.modules: 19da.

   - Afterwards, the module object is initialized in an
     extension-specific way - the equivalent of *note __init__(): 306.
     when creating an object, or of executing top-level code in a
     Python-language module.  The behavior is specified using the *note
     Py_mod_exec: d4a. slot.

This is called 'multi-phase initialization' to distinguish it from the
legacy (but still supported) *note single-phase initialization: 556b,
where an initialization function returns a fully constructed module.

バージョン 3.5 で変更: 多段階初期化 ( PEP 489(1)) のサポートを追加しまし
た。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/


File: python.info,  Node: 複数のモジュールインスタンス,  Next: PyInit function,  Prev: 多段階初期化,  Up: 拡張モジュールの定義

7.6.3 複数のモジュールインスタンス
----------------------------------

By default, extension modules are not singletons.  For example, if the
*note sys.modules: 19da. 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:
417. or after Python runtime reinitialization (*note Py_Finalize(): 679.
and *note Py_Initialize(): 67a.).  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 拡張モジュールを分離する: 419. for more details and a practical
guide.

A simpler way to avoid these issues is *note raising an error on
repeated initialization: 556d.

All modules are expected to support *note sub-interpreters: 417, 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: 54a5. slot.


File: python.info,  Node: PyInit function,  Prev: 複数のモジュールインスタンス,  Up: 拡張モジュールの定義

7.6.4 ‘PyInit’ function
-----------------------

*note Soft deprecated: 1b2. since version 3.15: This functionality will
not get new features, but there are no plans to remove it.

Instead of *note PyModExport_modulename(): 1a7, an extension module can
define an older-style 'initialization function' with the signature:

 -- C の関数: *note PyObject: 1a6. *PyInit_modulename (void)

Its name should be ‘PyInit_<NAME>’, with ‘<name>’ replaced by the name
of the module.  For non-ASCII module names, use ‘PyInitU_<NAME>’
instead, with ‘<name>’ encoded in the same way as for the *note export
hook: 395. (that is, using Punycode with underscores).

If a module exports both ‘PyInit_<NAME>’ and ‘PyModExport_<NAME>’, the
‘PyInit_<NAME>’ function is ignored.

Like with *note PyMODEXPORT_FUNC: 19b1, 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: 1a6.* return type,

        * adds any special linkage declarations required by the
          platform, and

        * for C++, declares the function as ‘extern "C"’.

Normally, the initialization function (‘PyInit_modulename’) returns a
*note PyModuleDef: d49. instance with non-‘NULL’ *note m_slots: 198d.
This allows Python to use *note multi-phase initialization: 556a.

Before it is returned, the ‘PyModuleDef’ instance must be initialized
using the following function:

 -- C の関数: *note PyObject: 1a6. *PyModuleDef_Init (PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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 before returning a *note
     PyModuleDef: d49. from a module initialization function.  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.

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);
     }

* Menu:

* 従来の一段階初期化::


File: python.info,  Node: 従来の一段階初期化,  Up: PyInit function

7.6.4.1 従来の一段階初期化
..........................

*note Soft deprecated: 1b2. since version 3.15: 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.

However, there are no plans to remove support for it.

In single-phase initialization, the old-style *note initialization
function: 5567. (‘PyInit_modulename’) should create, populate and return
a module object.  This is typically done using *note PyModule_Create():
5571. and functions like *note PyModule_AddObjectRef(): 806.

Single-phase initialization differs from the *note default: 556a. 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(): 53fe.

   * The module's *note PyModuleDef.m_slots: 198d. must be NULL.

   ---------- 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: Definition slots,  Next: ユーティリティ<2>,  Prev: 拡張モジュールの定義,  Up: Python/C API reference manual

7.7 Definition slots
====================

To define *note module objects: 5575. and *note classes: 5576. using the
C API, you may use an array of 'slots' - essentially, key-value pairs
that describe features of the object to create.  This decouples the data
from the structures used at runtime, allowing CPython - and other Python
C API implementations - to update the structures without breaking
backwards compatibility.

This section documents slots in general.  For object-specific behavior
and slot values, see documentation for functions that apply slots:

   - *note PyType_FromSlots(): 37e. for types;

   - *note PyModule_FromSlotsAndSpec(): 394. and *note Extension export
     hook: 395. for modules.

When slots are passed to a function that applies them, the function will
not modify the slot array, nor any data it points to (recursively).
After the function is done, the caller is allowed to modify or
deallocate the array and any data it points to (recursively), except
data explicitly marked with *note PySlot_STATIC: 53fc.

Except when documented otherwise, multiple slots with the same ID (*note
sl_id: 5577.) may not occur in a single slots array.

Added in version 3.15: Slot arrays generalize an earlier way of defining
objects: using *note PyType_Spec: 1cae. with *note PyType_Slot: 542a.
for types, and *note PyModuleDef: d49. with *note PyModuleDef_Slot:
539c. for modules.  The earlier API is *note soft deprecated: 1b2.;
there are no plans to remove it.

Entries of the slots array use the following structure:

 -- C のデータ型: type PySlot
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む) (バ
     ージョン 3.15 より).'  An entry in a slots array.  Defined as:

          typedef struct {
              uint16_t sl_id;
              uint16_t sl_flags;
              uint32_t _reserved;  // must be 0
              union {
                  void *sl_ptr;
                  void (*sl_func)(void);
                  Py_ssize_t sl_size;
                  int64_t sl_int64;
                  uint64_t sl_uint64;
              };
          } PySlot;

      -- C のメンバ変数: uint16_t sl_id

          A slot ID, chosen from:

             - ‘Py_slot_*’ values documented in *note Common slot IDs:
               5578. below;

             - ‘Py_mod_*’ values for modules, as documented in *note
               Module definition: 5579.;

             - Values for types, as documented in *note Type slot IDs:
               557a.

          A ‘sl_id’ of zero (*note Py_slot_end: 37f.) marks the end of a
          slots array.

      -- C のメンバ変数: void *sl_ptr
      -- C のメンバ変数: void (*sl_func)(void)
      -- C のメンバ変数: *note Py_ssize_t: e28. sl_size
      -- C のメンバ変数: int64_t sl_int64
      -- C のメンバ変数: uint64_t sl_uint64

          The data for the slot.  These members are part of an anonymous
          union; the member to use depends on which data type is
          required by the slot ID: data pointer, function pointer, size,
          signed or unsigned integer, respectively.

          Except when documented otherwise for a specific slot ID,
          pointers (that is ‘sl_ptr’ and ‘sl_func’) may not be NULL.

      -- C のメンバ変数: uint16_t sl_flags

          Zero or more of the following flags, OR-ed together:

           -- C のマクロ: PySlot_STATIC
               ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 よ
               り).'  All data the slot points to is statically
               allocated and constant.  Thus, the interpreter does not
               need to copy the information.

               This flag is implied for function pointers.

               The flag applies even to data the slot points to
               “indirectly”, except for slots nested via *note
               Py_slot_subslots: 381. which may have their own
               ‘PySlot_STATIC’ flags.  For example, if applied to a
               *note Py_tp_members: 54ed. slot that points to an array
               of *note PyMemberDef: 95f. structures, then the entire
               array, as well as the name and doc strings in its
               elements, must be static and constant.

           -- C のマクロ: PySlot_INTPTR
               ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 よ
               り).'  The data is stored in ‘sl_ptr’; CPython will cast
               it to the appropriate type.

               This flag can simplify porting from the older *note
               PyType_Slot: 542a. and *note PyModuleDef_Slot: 539c.
               structures.

           -- C のマクロ: PySlot_OPTIONAL
               ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 よ
               り).'  If the slot ID is unknown, the interpreter should
               ignore the slot, rather than fail.

               For example, if Python 3.16 adds a new feature with a new
               slot ID,attr the corresponding slot may be marked
               ‘PySlot_OPTIONAL’ so that Python 3.15 ignores it.

               Note that the "optionality" only applies to unknown slot
               IDs.  This flag does not make Python skip invalid values
               of known slots.

     Added in version 3.15.

* Menu:

* Convenience macros::
* Common slot IDs::


File: python.info,  Node: Convenience macros,  Next: Common slot IDs,  Up: Definition slots

7.7.1 Convenience macros
------------------------

 -- C のマクロ: PySlot_DATA (name, value)
 -- C のマクロ: PySlot_FUNC (name, value)
 -- C のマクロ: PySlot_SIZE (name, value)
 -- C のマクロ: PySlot_INT64 (name, value)
 -- C のマクロ: PySlot_UINT64 (name, value)
 -- C のマクロ: PySlot_STATIC_DATA (name, value)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Convenience macros to define ‘PySlot’ structures with *note sl_id:
     5577. and a particular union member set.

     ‘PySlot_STATIC_DATA’ sets the *note PySlot_STATIC: 53fc. flag;
     others set no flags.

     Note that these macros use 'designated initializers', a C language
     feature that C++ added in the 2020 version of the standard.  If
     your code needs to be compatible with C++11 or older, use *note
     PySlot_PTR: 392. instead.

     Defined as:

          #define PySlot_DATA(NAME, VALUE) \
             {.sl_id=NAME, .sl_ptr=(void*)(VALUE)}

          #define PySlot_FUNC(NAME, VALUE) \
             {.sl_id=NAME, .sl_func=(VALUE)}

          #define PySlot_SIZE(NAME, VALUE) \
             {.sl_id=NAME, .sl_size=(VALUE)}

          #define PySlot_INT64(NAME, VALUE) \
             {.sl_id=NAME, .sl_int64=(VALUE)}

          #define PySlot_UINT64(NAME, VALUE) \
             {.sl_id=NAME, .sl_uint64=(VALUE)}

          #define PySlot_STATIC_DATA(NAME, VALUE) \
             {.sl_id=NAME, .sl_flags=PySlot_STATIC, .sl_ptr=(VALUE)}

     Added in version 3.15.

 -- C のマクロ: PySlot_END
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Convenience macro to mark the end of a ‘PySlot’ array.

     Defined as:

          #define PySlot_END {0}

     Added in version 3.15.

 -- C のマクロ: PySlot_PTR (name, value)
 -- C のマクロ: PySlot_PTR_STATIC (name, value)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Convenience macros for use in C++11-compatible code.  This version
     of C++ does not allow setting arbitrary union members in literals;
     instead, these macros set the *note PySlot_INTPTR: 53fa. flag and
     cast the value to ‘(void*)’.

     Defined as:

          #define PySlot_PTR(NAME, VALUE) \
             {NAME, PySlot_INTPTR, {0}, {(void*)(VALUE)}}

          #define PySlot_PTR_STATIC(NAME, VALUE) \
             {NAME, PySlot_INTPTR|Py_SLOT_STATIC, {0}, {(void*)(VALUE)}}

     Added in version 3.15.


File: python.info,  Node: Common slot IDs,  Prev: Convenience macros,  Up: Definition slots

7.7.2 Common slot IDs
---------------------

The following slot IDs may be used in both type and module definitions.

 -- C のマクロ: Py_slot_end
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Marks the end of a slots array.  Defined as zero.

     Added in version 3.15.

 -- C のマクロ: Py_slot_subslots
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Nested slots array.

     The value (*note sl_ptr: 557b.) should point to an array of *note
     PySlot: 1a8. structures.  The slots in the array (up to but not
     including the zero-ID terminator) will be treated as if they were
     inserted if the current slot array, at the point ‘Py_slot_subslots’
     appears.

     Slot nesting depth is limited to 5 levels.  This restriction may be
     lifted in the future.

     Added in version 3.15.

 -- C のマクロ: Py_slot_invalid
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Reserved; will always be treated as an unknown slot ID. Defined as
     ‘UINT16_MAX’ (‘0xFFFF’).

     When used with the *note PySlot_OPTIONAL: 53fb. flag, defines a
     slot with no effect.  Without the flag, processing a slot with this
     ID will fail.

     Added in version 3.15.


File: python.info,  Node: ユーティリティ<2>,  Next: 抽象オブジェクトレイヤ Abstract Objects Layer,  Prev: Definition slots,  Up: Python/C API reference manual

7.8 ユーティリティ
==================

この章の関数は、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.8.1 オペレーティングシステム関連のユーティリティ
--------------------------------------------------

 -- C の関数: *note PyObject: 1a6. *PyOS_FSPath (PyObject *path)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.6 より).'  Return the file system representation for
     'path'.  If the object is a *note str: 1ea. or *note bytes: 1d2.
     object, then a new *note strong reference: 7e0. is returned.  If
     the object implements the *note os.PathLike: 1013. interface, then
     *note __fspath__(): 1014. is returned as long as it is a ‘str’ or
     ‘bytes’ object.  Otherwise *note TypeError: 29c. 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: 61a. 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: 961. on platforms with fork() (バ
     ージョン 3.7 より).'  プロセスがフォークする前に、いくつかの内部状
     態を準備するための関数です。‘fork()’ や現在のプロセスを複製するその
     他の類似の関数を呼び出す前にこの関数を呼びださなければなりません。
     ‘fork()’ が定義されているシステムでのみ利用できます。

          警告: The C ‘fork()’ call should only be made from the *note
          "main" thread: 558b. (of the *note "main" interpreter: 417.).
          The same is true for ‘PyOS_BeforeFork()’.

     Added in version 3.7.

 -- C の関数: void PyOS_AfterFork_Parent ()
     ' 次に属します: *note Stable ABI: 961. on platforms with fork() (バ
     ージョン 3.7 より).'  プロセスがフォークした後に内部状態を更新する
     ための関数です。 ‘fork()’ や、現在のプロセスを複製するその他の類似
     の関数を呼び出した後に、プロセスの複製が成功したかどうかにかかわら
     ず、親プロセスからこの関数を呼び出さなければなりません。‘fork()’ が
     定義されているシステムでのみ利用できます。

          警告: The C ‘fork()’ call should only be made from the *note
          "main" thread: 558b. (of the *note "main" interpreter: 417.).
          The same is true for ‘PyOS_AfterFork_Parent()’.

     Added in version 3.7.

 -- C の関数: void PyOS_AfterFork_Child ()
     ' 次に属します: *note Stable ABI: 961. 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: 558b. (of the *note "main" interpreter: 417.).
          The same is true for ‘PyOS_AfterFork_Child()’.

     Added in version 3.7.

     参考
     ....

     *note os.register_at_fork(): 33a. を利用すると *note
     PyOS_BeforeFork(): f81.、*note PyOS_AfterFork_Parent(): f82. *note
     PyOS_AfterFork_Child(): 64a. によって呼び出されるカスタムのPython関
     数を登録できます。

 -- C の関数: void PyOS_AfterFork ()
     ' 次に属します: *note Stable ABI: 961. on platforms with fork().'  プ
     ロセスが fork した後の内部状態を更新するための関数です; fork 後
     Python インタプリタを使い続ける場合、新たなプロセス内でこの関数を呼
     び出さねばなりません。新たなプロセスに新たな実行可能物をロードする
     場合、この関数を呼び出す必要はありません。

     バージョン 3.7 で非推奨: この関数は *note PyOS_AfterFork_Child():
     64a. によって置き換えられました。

 -- C の関数: int PyOS_CheckStack ()
     ' 次に属します: *note Stable ABI: 961. 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: 961.'

 -- C の関数: *note PyOS_sighandler_t: 53ca. PyOS_getsig (int i)
     ' 次に属します: *note Stable ABI: 961.'  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: 53ca. PyOS_setsig (int i,
          PyOS_sighandler_t h)
     ' 次に属します: *note Stable ABI: 961.'  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: 961.'  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(): 885.
     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: 1ac.

 -- C の関数: wchar_t *Py_DecodeLocale (const char *arg, size_t *size)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'
          警告: This function should not be called directly: use the
          *note PyConfig: 612. API with the *note
          PyConfig_SetBytesString(): d80. function which ensures that
          *note Python is preinitialized: 4528.

          This function must not be called before *note Python is
          preinitialized: 4528. and so that the LC_CTYPE locale is
          properly configured: see the *note Py_PreInitialize(): 638.
          function.

     *note ファイルシステムのエンコーディングとエラーハンドラ: 94d. から
     バイト文字列をデコードします。エラーハンドラが *note
     surrogateescape エラーハンドラ: 2a82. なら、 デコードできないバイト
     は U+DC80 から U+DCFF までの範囲の文字としてデコードされ、バイト列
     がサロゲート文字としてデコードできる場合は、デコードするのではなく
     surrogateescape エラーハンドラを使ってバイト列がエスケープされます
     。

     新しくメモリ確保されたワイドキャラクター文字列へのポインタを返しま
     す。 このメモリを解放するのには *note PyMem_RawFree(): 82c. を使っ
     てください。 引数 size が ‘NULL’ でない場合は、 null 文字以外のワイ
     ドキャラクターの数を ‘*size’ へ書き込みます。

     デコードもしくはメモリ確保でエラーが起きると ‘NULL’ を返します。
     'size' が ‘NULL’ でない場合は、メモリエラーのときは ‘(size_t)-1’ を
     、デコードでのエラーのときは ‘(size_t)-2’ を ‘*size’ に設定します。

     The *note filesystem encoding and error handler: 94d. are selected
     by *note PyConfig_Read(): b74.: see *note filesystem_encoding: 635.
     and *note filesystem_errors: 636. members of *note PyConfig: 612.

     C ライブラリーにバグがない限り、デコードでのエラーは起こりえません
     。

     キャラクター文字列をバイト文字列に戻すには *note Py_EncodeLocale():
     f8a. 関数を使ってください。

     参考
     ....

     *note PyUnicode_DecodeFSDefaultAndSize(): 544d. および *note
     PyUnicode_DecodeLocaleAndSize(): f8b. 関数。

     Added in version 3.5.

     バージョン 3.7 で変更: この関数は、*note Python UTF-8 Mode: a4b. で
     はUTF-8エンコーディングを利用するようになりました。

     バージョン 3.8 で変更: The function now uses the UTF-8 encoding on
     Windows if *note PyPreConfig.legacy_windows_fs_encoding: 632. is
     zero;

 -- C の関数: char *Py_EncodeLocale (const wchar_t *text, size_t
          *error_pos)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'  ワ
     イドキャラクター文字列を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 94d. にエンコー
     ドします。エラーハンドラが *note surrogateescape エラーハンドラ:
     2a82. なら、 U+DC80 から U+DCFF までの範囲のサロゲート文字は 0x80 か
     ら 0xFF までのバイトに変換されます。

     新しくメモリ確保されたバイト文字列へのポインタを返します。 このメモ
     リを解放するのには *note PyMem_Free(): 17fa. を使ってください。 エ
     ンコードエラーかメモリ確保エラーのときは ‘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: 94d. are selected
     by *note PyConfig_Read(): b74.: see *note filesystem_encoding: 635.
     and *note filesystem_errors: 636. members of *note PyConfig: 612.

     バイト文字列をワイドキャラクター文字列に戻すには *note
     Py_DecodeLocale(): f89. 関数を使ってください。

          警告: This function must not be called before *note Python is
          preinitialized: 4528. and so that the LC_CTYPE locale is
          properly configured: see the *note Py_PreInitialize(): 638.
          function.

     参考
     ....

     *note PyUnicode_EncodeFSDefault(): 203d. および *note
     PyUnicode_EncodeLocale(): f8c. 関数。

     Added in version 3.5.

     バージョン 3.7 で変更: この関数は、*note Python UTF-8 Mode: a4b. で
     はUTF-8エンコーディングを利用するようになりました。

     バージョン 3.8 で変更: The function now uses the UTF-8 encoding on
     Windows if *note PyPreConfig.legacy_windows_fs_encoding: 632. 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: 1ea. object, a *note bytes: 1d2.
     object, or a *note path-like object: 7a5.

     On success, return the new file pointer.  On error, set an
     exception and return ‘NULL’.

     The file must be closed by *note Py_fclose(): 5c8. rather than
     calling directly ‘fclose()’.

     The file descriptor is created non-inheritable ( PEP 446(1)).

     The caller must have an *note attached thread state: 1ac.

     Added in version 3.14.

 -- C の関数: int Py_fclose (FILE *file)

     Close a file that was opened by *note Py_fopen(): 5c7.

     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(): 5c8.) 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.8.2 システム関数
------------------

*note sys: e2. モジュールが提供している機能にCのコードからアクセスする関
数です。すべての関数は現在のインタプリタスレッドの ‘sys’ モジュールの辞
書に対して動作します。この辞書は内部のスレッド状態構造体に格納されていま
す。

 -- C の関数: *note PyObject: 1a6. *PySys_GetAttr (PyObject *name)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Get the attribute 'name' of the *note sys: e2. module.  Return a
     *note strong reference: 7e0.  Raise *note RuntimeError: 317. and
     return ‘NULL’ if it does not exist or if the ‘sys’ module cannot be
     found.

     If the non-existing object should not be treated as a failure, you
     can use *note PySys_GetOptionalAttr(): 35c. instead.

     Added in version 3.15.

 -- C の関数: *note PyObject: 1a6. *PySys_GetAttrString (const char
          *name)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     This is the same as *note PySys_GetAttr(): 35a, but 'name' is
     specified as a const char* UTF-8 encoded bytes string, rather than
     a *note PyObject: 1a6.*.

     If the non-existing object should not be treated as a failure, you
     can use *note PySys_GetOptionalAttrString(): 35d. instead.

     Added in version 3.15.

 -- C の関数: int PySys_GetOptionalAttr (PyObject *name, PyObject
          **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Variant of *note PySys_GetAttr(): 35a. which doesn't raise
     exception if the object does not exist.

        * Set '*result' to a new *note strong reference: 7e0. to the
          object and return ‘1’ if the object exists.

        * Set '*result' to ‘NULL’ and return ‘0’ without setting an
          exception if the object does not exist.

        * Set an exception, set '*result' to ‘NULL’, and return ‘-1’, if
          an error occurred.

     Added in version 3.15.

 -- C の関数: int PySys_GetOptionalAttrString (const char *name,
          PyObject **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     This is the same as *note PySys_GetOptionalAttr(): 35c, but 'name'
     is specified as a const char* UTF-8 encoded bytes string, rather
     than a *note PyObject: 1a6.*.

     Added in version 3.15.

 -- C の関数: *note PyObject: 1a6. *PySys_GetObject (const char *name)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'
     Similar to *note PySys_GetAttrString(): 35b, but return a *note
     borrowed reference: 60a. and return ‘NULL’ 'without' setting
     exception on failure.

     Preserves exception that was set before the call.

 -- C の関数: int PySys_SetObject (const char *name, PyObject *v)
     ' 次に属します: *note Stable ABI: 961.'  'v' が ‘NULL’ で無い場合、
     *note sys: e2. モジュールの 'name' に 'v' を設定します。 'v' が
     ‘NULL’ なら、 sys モジュールから 'name' を削除します。成功したら
     ‘0’ を、エラー時は ‘-1’ を返します。

 -- C の関数: void PySys_WriteStdout (const char *format, ...)
     ' 次に属します: *note Stable ABI: 961.'  'format' で指定された出力
     文字列を *note sys.stdout: ea0. に出力します。切り詰めが起こった場
     合を含め、例外は一切発生しません (後述)。

     'format' は、フォーマット後の出力文字列のトータルの大きさを1000バイ
     ト以下に抑えるべきです。- 1000 バイト以降の出力文字列は切り詰められ
     ます。特に、制限のない "%s" フォーマットを使うべきではありません。
     "%.<N>s" のようにして N に10進数の値を指定し、<N> + その他のフォー
     マット後の最大サイズが1000を超えないように設定するべきです。同じよ
     うに "%f" にも気を付ける必要があります。非常に大きい数値に対して、
     数百の数字を出力する可能性があります。

     問題が発生したり、 *note sys.stdout: ea0. が設定されていなかった場
     合、フォーマット後のメッセージは本物の(Cレベルの) 'stdout' に出力さ
     れます。

 -- C の関数: void PySys_WriteStderr (const char *format, ...)
     ' 次に属します: *note Stable ABI: 961.'  *note PySys_WriteStdout():
     540a. と同じですが、 *note sys.stderr: d09. もしくは 'stderr' に出
     力します。

 -- C の関数: void PySys_FormatStdout (const char *format, ...)
     ' 次に属します: *note Stable ABI: 961.'  PySys_WriteStdout() に似た
     関数ですが、 *note PyUnicode_FromFormatV(): 97e. を使ってメッセージ
     をフォーマットし、メッセージを任意の長さに切り詰めたりはしません。

     Added in version 3.2.

 -- C の関数: void PySys_FormatStderr (const char *format, ...)
     ' 次に属します: *note Stable ABI: 961.'  *note
     PySys_FormatStdout(): 5406. と同じですが、 *note sys.stderr: d09. も
     しくは 'stderr' に出力します。

     Added in version 3.2.

 -- C の関数: *note PyObject: 1a6. *PySys_GetXOptions ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'  *note sys._xoptions: 233e. と同様、 *note -X:
     183. オプションの現在の辞書を返します。エラーが起きると、 ‘NULL’ が
     返され、例外がセットされます。

     Added in version 3.2.

 -- C の関数: int PySys_Audit (const char *event, const char *format,
          ...)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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(): 5f5. 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: e28, regardless of whether ‘PY_SSIZE_T_CLEAN’ was
     defined.

     *note sys.audit(): 1b55. performs the same function from Python
     code.

     See also *note PySys_AuditTuple(): 80d.

     Added in version 3.8.

     バージョン 3.8.2 で変更: Require *note Py_ssize_t: e28. for ‘#’
     format characters.  Previously, an unavoidable deprecation warning
     was raised.

 -- C の関数: int PySys_AuditTuple (const char *event, PyObject *args)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Similar to *note PySys_Audit(): 80e, but pass arguments as a Python
     object.  'args' must be a *note tuple: 1d9.  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(): 67a.
     When called after runtime initialization, existing audit hooks are
     notified and may silently abort the operation by raising an error
     subclassed from *note Exception: da2. (other errors will not be
     silenced).

     The hook function is always called with an *note attached thread
     state: 1ac. 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: 1e29.  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: da2, 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: 1a6. *args, void *userData)

          The type of the hook function.  'event' is the C string event
          argument passed to *note PySys_Audit(): 80e. or *note
          PySys_AuditTuple(): 80d.  'args' is guaranteed to be a *note
          PyTupleObject: 558f.  '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.8.3 プロセス制御
------------------

 -- C の関数: void Py_FatalError (const char *message)
     ' 次に属します: *note Stable ABI: 961.'

     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: 961.'

     現在のプロセスを終了します。*note Py_FinalizeEx(): 10d3. を呼び出し
     た後、標準Cライブラリ関数の ‘exit(status)’ を呼び出します。
     ‘Py_FinalizeEx()’ がエラーになった場合、終了ステータスは 120に設定
     されます。

     バージョン 3.6 で変更: 終了処理のエラーは無視されなくなりました。

 -- C の関数: int Py_AtExit (void (*func)())
     ' 次に属します: *note Stable ABI: 961.'

     *note Py_FinalizeEx(): 10d3. から呼び出される後始末処理を行う関数
     (cleanup function) を登録します。後始末関数は引数無しで呼び出され、
     値を返しません。最大で 32 の後始末処理関数を登録できます。登録に成
     功すると、 *note Py_AtExit(): 5477. は ‘0’ を返します; 失敗すると
     ‘-1’ を返します。最後に登録した後始末処理関数から先に呼び出されます
     。各関数は高々一度しか呼び出されません。 Python の内部的な終了処理
     は後始末処理関数より以前に完了しているので、 'func' からはいかなる
     Python API も呼び出してはなりません。

     参考
     ....

     *note PyUnstable_AtExit(): 1b38. for passing a ‘void *data’
     argument.


File: python.info,  Node: モジュールのインポート<2>,  Next: データ整列化 data marshalling のサポート,  Prev: プロセス制御,  Up: ユーティリティ<2>

7.8.4 モジュールのインポート
----------------------------

 -- C の関数: *note PyObject: 1a6. *PyImport_ImportModule (const char
          *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     This is a wrapper around *note PyImport_Import(): 17b4. which takes
     a const char* as an argument instead of a *note PyObject: 1a6.*.

 -- C の関数: *note PyObject: 1a6. *PyImport_ImportModuleEx (const char
          *name, PyObject *globals, PyObject *locals, PyObject
          *fromlist)
     '戻り値: 新しい参照。'

     モジュールをインポートします。モジュールのインポートについては組み
     込みの Python 関数 *note __import__(): caa. を読むとよくわかります
     。

     戻り値は、インポートされたモジュールかトップレベルパッケージへの新
     しい参照か、失敗した場合は例外を設定して ‘NULL’ を返します。 *note
     __import__(): caa. と同じように、パッケージのサブモジュールが要求さ
     れたときは、空でない 'fromlist' を渡された時以外は、トップレベルの
     パッケージを返します。

     インポートが失敗した場合は、*note PyImport_ImportModule(): 3ab. と
     同様に不完全なモジュールのオブジェクトを削除します。

 -- C の関数: *note PyObject: 1a6. *PyImport_ImportModuleLevelObject
          (PyObject *name, PyObject *globals, PyObject *locals, PyObject
          *fromlist, int level)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  モジュールをインポートします。モジュールのイン
     ポートについては組み込みの Python 関数 *note __import__(): caa. を
     読むとよく分かります。というのも、標準の ‘__import__()’ はこの関数
     を直接呼び出しているからです。

     戻り値は、インポートされたモジュールかトップレベルパッケージへの新
     しい参照か、失敗した場合は例外を設定して ‘NULL’ を返します。 *note
     __import__(): caa. と同じように、パッケージのサブモジュールが要求さ
     れたときは、空でない 'fromlist' を渡された時以外は、トップレベルの
     パッケージを返します。

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyImport_ImportModuleLevel (const
          char *name, PyObject *globals, PyObject *locals, PyObject
          *fromlist, int level)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     *note PyImport_ImportModuleLevelObject(): 5372. と似ていますが、
     name が Unicode オブジェクトではなく UTF-8 でエンコードされた文字列
     である点で異なります。

     バージョン 3.3 で変更: 'level' にはもはや負の値は使用できません。

 -- C の関数: *note PyObject: 1a6. *PyImport_Import (PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  現在
     の "インポートフック関数" を呼び出すための高水準のインターフェース
     です ('level' に 0 を明示すると、絶対インポートを意味します)。 この
     関数は現在のグローバル変数辞書内の ‘__builtins__’ から *note
     __import__(): caa. 関数を呼び出します。すなわち、現在の環境にインス
     トールされているインポートフック使ってインポートを行います。

     この関数は常に絶対インポートを使用します。

 -- C の関数: *note PyObject: 1a6. *PyImport_ReloadModule (PyObject *m)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  モジ
     ュールを再ロード (reload) します。戻り値は再ロードしたモジュールか
     トップレベルパッケージへの新たな参照になります。 失敗した場合には例
     外をセットし、‘NULL’ を返します (その場合でも、モジュールは生成され
     ている場合があります)。

 -- C の関数: *note PyObject: 1a6. *PyImport_AddModuleRef (const char
          *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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: 7e0. 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(): 3ab. 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: 1a6. *PyImport_AddModuleObject (PyObject
          *name)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.7 より).'  Similar to *note PyImport_AddModuleRef(): 7f7,
     but return a *note borrowed reference: 60a. and 'name' is a Python
     *note str: 1ea. object.

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyImport_AddModule (const char
          *name)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'
     Similar to *note PyImport_AddModuleRef(): 7f7, but return a *note
     borrowed reference: 60a.

 -- C の関数: *note PyObject: 1a6. *PyImport_ExecCodeModule (const char
          *name, PyObject *co)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     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(): 1d3, 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:
     19da. in error cases, even if 'name' was already in ‘sys.modules’
     on entry to *note PyImport_ExecCodeModule(): 536a.  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__: 2573. and *note __loader__: 30b. 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: 142b. otherwise.

     The module's *note __file__: 2578. attribute will be set to the
     code object's *note co_filename: 1727.

     この関数は、すでにインポートされているモジュールの場合には再ロード
     を行います。意図的にモジュールの再ロードを行う方法は *note
     PyImport_ReloadModule(): 5373. を参照してください。

     'name' が ‘package.module’ 形式のドット名表記であった場合、まだ作成
     されていないパッケージ構造はその作成されないままになります。

     *note PyImport_ExecCodeModuleEx(): 536b. と *note
     PyImport_ExecCodeModuleWithPathnames(): 536d. も参照してください。

     バージョン 3.12 で変更: The setting of ‘__cached__’ and *note
     __loader__: 30b. is deprecated.  See *note ModuleSpec: 247c. for
     alternatives.

     バージョン 3.15 で変更: ‘__cached__’ is no longer set.

 -- C の関数: *note PyObject: 1a6. *PyImport_ExecCodeModuleEx (const
          char *name, PyObject *co, const char *pathname)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  Like
     *note PyImport_ExecCodeModule(): 536a, but the *note __file__:
     2578. attribute of the module object is set to 'pathname' if it is
     non-‘NULL’.

     *note PyImport_ExecCodeModuleWithPathnames(): 536d. も参照してくだ
     さい。

 -- C の関数: *note PyObject: 1a6. *PyImport_ExecCodeModuleObject
          (PyObject *name, PyObject *co, PyObject *pathname, PyObject
          *cpathname)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  Like *note PyImport_ExecCodeModuleEx(): 536b,
     but the path to any compiled file via 'cpathname' is used
     appropriately when non-‘NULL’.  Of the three functions, this is the
     preferred one to use.

     Added in version 3.3.

     バージョン 3.12 で変更: Setting ‘__cached__’ is deprecated.  See
     *note ModuleSpec: 247c. for alternatives.

     バージョン 3.15 で変更: ‘__cached__’ no longer set.

 -- C の関数: *note PyObject: 1a6. *PyImport_ExecCodeModuleWithPathnames
          (const char *name, PyObject *co, const char *pathname, const
          char *cpathname)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     *note PyImport_ExecCodeModuleObject(): 536c. と似ていますが、
     '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: 961.'  Python バイトコードファイ
     ル (別名 ‘.pyc’ ファイル) のマジックナンバーを返します。マジックナ
     ンバーはバイトコードファイルの最初の4バイトに、リトルエンディアンバ
     イトオーダーで現れるべきです。エラーの場合は ‘-1’ を返します。

     バージョン 3.3 で変更: 失敗した場合は ‘-1’ の値を返します。

 -- C の関数: const char *PyImport_GetMagicTag ()
     ' 次に属します: *note Stable ABI: 961.'  マジックタグ文字列を
     Python バイトコードファイル名の PEP 3147(1) フォーマットで返します
     。‘sys.implementation.cache_tag’ の値が信頼でき、かつこの関数の代わ
     りに使用すべきであることを肝に命じましょう。

     Added in version 3.2.

 -- C の関数: *note PyObject: 1a6. *PyImport_GetModuleDict ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'  モジュ
     ール管理のための辞書 (いわゆる ‘sys.modules’)を返します。この辞書は
     インタプリタごとに一つだけある変数なので注意してください。

 -- C の関数: *note PyObject: 1a6. *PyImport_GetModule (PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.8 より).'  与えられた名前の既にインポート済みのモジュール
     を返します。 モジュールがインポートされていなかった場合は、 ‘NULL’
     を返しますが、エラーはセットしません。 モジュールの検索に失敗した場
     合は、 ‘NULL’ を返し、エラーをセットします。

     Added in version 3.7.

 -- C の関数: *note PyObject: 1a6. *PyImport_GetImporter (PyObject
          *path)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Return a finder object for a *note sys.path: 19f./‘pkg.__path__’
     item 'path', possibly by fetching it from the *note
     sys.path_importer_cache: 9e0. dict.  If it wasn't yet cached,
     traverse *note sys.path_hooks: 13d1. 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: 2662. 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: 961. (バージョン 3.7 より).'
     'name' という名前のフリーズ (freeze) されたモジュールをロードします
     。成功すると ‘1’ を、モジュールが見つからなかった場合には ‘0’ を、
     初期化が失敗した場合には例外をセットして ‘-1’ を返します。ロードに
     成功したモジュールにアクセスするには *note PyImport_ImportModule():
     3ab. を使ってください。 (Note この関数はいささか誤解を招く名前です
     -- この関数はモジュールがすでにインポートされていたらリロードしてし
     まいます。)

     Added in version 3.3.

     バージョン 3.4 で変更: ‘__file__’ 属性はもうモジュールにセットされ
     ません。

 -- C の関数: int PyImport_ImportFrozenModule (const char *name)
     ' 次に属します: *note Stable ABI: 961.'  *note
     PyImport_ImportFrozenModuleObject(): 5371. と似ていますが、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: b5c. *PyImport_FrozenModules

     このポインタは *note _frozen: b5c. のレコードからなり、終端の要素の
     メンバが ‘NULL’ かゼロになっているような配列を指すよう初期化されま
     す。 フリーズされたモジュールをインポートするとき、このテーブルを検
     索します。 サードパーティ製のコードからこのポインタに仕掛けを講じて
     、動的に生成されたフリーズ化モジュールの集合を提供するようにできま
     す。

 -- C の関数: int PyImport_AppendInittab (const char *name, PyObject
          *(*initfunc)(void))
     ' 次に属します: *note Stable ABI: 961.'  既存の組み込みモジュールテ
     ーブルに単一のモジュールを追加します。この関数は利便性を目的とした
     *note PyImport_ExtendInittab(): 1d3a. のラッパー関数で、テーブルが
     拡張できないときには ‘-1’ を返します。新たなモジュールは 'name' で
     インポートでき、最初にインポートを試みた際に呼び出される関数として
     'initfunc' を使います。 *note Py_Initialize(): 67a. よりも前に呼び
     出さなければなりません。

 -- 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():
     1d3a. 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: 1a6. *(*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: 5597. 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():
     67a.

     Python が複数回初期化される場合、*note PyImport_AppendInittab():
     1d39. または *note PyImport_ExtendInittab(): 1d3a. は、それぞれの初
     期化の前に呼び出される必要があります。

 -- C 変数: struct *note _inittab: 5596. *PyImport_Inittab

     The table of built-in modules used by Python initialization.  Do
     not use this directly; use *note PyImport_AppendInittab(): 1d39.
     and *note PyImport_ExtendInittab(): 1d3a. instead.

 -- C の関数: *note PyObject: 1a6. *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: 1ea. objects.

     Helper function combining *note PyImport_Import(): 17b4. and *note
     PyObject_GetAttr(): 3bf.  For example, it can raise *note
     ImportError: 1c8. if the module is not found, and *note
     AttributeError: 1b4. if the attribute doesn't exist.

     Added in version 3.14.

 -- C の関数: *note PyObject: 1a6. *PyImport_ImportModuleAttrString
          (const char *mod_name, const char *attr_name)
     '戻り値: 新しい参照。' Similar to *note
     PyImport_ImportModuleAttr(): 5ca, but names are UTF-8 encoded
     strings instead of Python *note str: 1ea. objects.

     Added in version 3.14.

 -- C の関数: *note PyImport_LazyImportsMode: 559a.
          PyImport_GetLazyImportsMode ()

     Gets the current lazy imports mode.

     Added in version 3.15.

 -- C の関数: *note PyObject: 1a6. *PyImport_GetLazyImportsFilter ()

     Return a *note strong reference: 7e0. to the current lazy imports
     filter, or ‘NULL’ if none exists.  This function always succeeds.

     Added in version 3.15.

 -- C の関数: int PyImport_SetLazyImportsMode (PyImport_LazyImportsMode
          mode)

     Similar to *note PyImport_ImportModuleAttr(): 5ca, but names are
     UTF-8 encoded strings instead of Python *note str: 1ea. objects.

     This function always returns ‘0’.

     Added in version 3.15.

 -- C の関数: int PyImport_SetLazyImportsFilter (PyObject *filter)

     Sets the current lazy imports filter.  The 'filter' should be a
     callable that will receive ‘(importing_module_name,
     imported_module_name, [fromlist])’ when an import can potentially
     be lazy.  The ‘imported_module_name’ value is the resolved module
     name, so ‘lazy from .spam import eggs’ passes ‘package.spam’.  The
     callable must return ‘True’ if the import should be lazy and
     ‘False’ otherwise.

     Return ‘0’ on success and ‘-1’ with an exception set otherwise.

     Added in version 3.15.

 -- C のデータ型: type PyImport_LazyImportsMode

     Enumeration of possible lazy import modes.

      -- C Enumerator: enumerator PyImport_LAZY_NORMAL

          Respect the ‘lazy’ keyword in source code.  This is the
          default mode.

      -- C Enumerator: enumerator PyImport_LAZY_ALL

          Make all imports lazy by default.

      -- C Enumerator: enumerator PyImport_LAZY_NONE

          Disable lazy imports entirely.  Even explicit ‘lazy’
          statements become eager imports.

     Added in version 3.15.

 -- C の関数: *note PyObject: 1a6. *PyImport_CreateModuleFromInitfunc
          (PyObject *spec, PyObject *(*initfunc)(void))

     This function is a building block that enables embedders to
     implement the *note create_module(): 1073. step of custom static
     extension importers (e.g.  of statically-linked extensions).

     'spec' must be a *note ModuleSpec: 247c. object.

     'initfunc' must be an *note initialization function: 395, the same
     as for *note PyImport_AppendInittab(): 1d39.

     On success, create and return a module object.  This module will
     not be initialized; call *note PyModule_Exec(): 53a0. to initialize
     it.  (Custom importers should do this in their *note exec_module():
     c44. method.)

     On error, return NULL with an exception set.

     Added in version 3.15.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3147/


File: python.info,  Node: データ整列化 data marshalling のサポート,  Next: 引数の解釈と値の構築,  Prev: モジュールのインポート<2>,  Up: ユーティリティ<2>

7.8.5 データ整列化 (data marshalling) のサポート
------------------------------------------------

以下のルーチン群は、 *note marshal: 90. モジュールと同じ形式を使った整列
化オブジェクトを C コードから使えるようにします。整列化形式でデータを書
き出す関数に加えて、データを読み戻す関数もあります。整列化されたデータを
記録するファイルはバイナリモードで開かれていなければなりません。

数値は最小桁が先にくるように記録されます。

The module supports several versions of the data format; see the *note
Python module documentation: 90. for details.

 -- C のマクロ: Py_MARSHAL_VERSION

     The current format version.  See *note marshal.version: 2f7f.

 -- C の関数: void PyMarshal_WriteLongToFile (long value, FILE *file,
          int version)

     long 型の整数値 'value' を 'file' へ整列化します。この関数は
     'value' の下桁 32 ビットを書き込むだけです; ネイティブの long 型サ
     イズには関知しません。 'version' はファイルフォーマットを示します。

     この関数は失敗することがあり、その場合はエラー指示子を設定します。
     それを確認するために *note PyErr_Occurred(): 1ec4. を使います。

 -- C の関数: void PyMarshal_WriteObjectToFile (PyObject *value, FILE
          *file, int version)

     Python オブジェクト 'value' を 'file' へ整列化します。'version' は
     ファイルフォーマットを示します。

     この関数は失敗することがあり、その場合はエラー指示子を設定します。
     それを確認するために *note PyErr_Occurred(): 1ec4. を使います。

 -- C の関数: *note PyObject: 1a6. *PyMarshal_WriteObjectToString
          (PyObject *value, int version)
     '戻り値: 新しい参照。' 'value' の整列化表現が入ったバイト列オブジェ
     クトを返します。'version' はファイルフォーマットを示します。

以下の関数を使うと、整列化された値を読み戻せます。

 -- C の関数: long PyMarshal_ReadLongFromFile (FILE *file)

     読み出し用に開かれた FILE* 内のデータストリームから、 C の long 型
     データを読み出して返します。この関数は、ネイティブの long のサイズ
     に関係なく、 32 ビットの値だけを読み出せます。

     エラーの場合、適切な例外 (*note EOFError: 1693.) を設定し ‘-1’ を返
     します。

 -- C の関数: int PyMarshal_ReadShortFromFile (FILE *file)

     読み出し用に開かれた FILE* 内のデータストリームから、 C の short 型
     データを読み出して返します。この関数は、ネイティブの short のサイズ
     に関係なく、 16 ビットの値だけを読み出せます。

     エラーの場合、適切な例外 (*note EOFError: 1693.) を設定し ‘-1’ を返
     します。

 -- C の関数: *note PyObject: 1a6. *PyMarshal_ReadObjectFromFile (FILE
          *file)
     '戻り値: 新しい参照。' 読み出し用に開かれた FILE* 内のデータストリ
     ームから Python オブジェクトを返します。

     エラーの場合、適切な例外 (*note EOFError: 1693, *note ValueError:
     15a, *note TypeError: 29c.) を設定し ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyMarshal_ReadLastObjectFromFile
          (FILE *file)
     '戻り値: 新しい参照。' Return a Python object from the data stream
     in a FILE* opened for reading.  Unlike *note
     PyMarshal_ReadObjectFromFile(): 55a8, 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: 1693, *note ValueError:
     15a, *note TypeError: 29c.) を設定し ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyMarshal_ReadObjectFromString
          (const char *data, Py_ssize_t len)
     '戻り値: 新しい参照。' 'data' が指す 'len' バイトのバイト列バッファ
     内のデータストリームから Python オブジェクトを返します。

     エラーの場合、適切な例外 (*note EOFError: 1693, *note ValueError:
     15a, *note TypeError: 29c.) を設定し ‘NULL’ を返します。


File: python.info,  Node: 引数の解釈と値の構築,  Next: 文字列の変換と書式化,  Prev: データ整列化 data marshalling のサポート,  Up: ユーティリティ<2>

7.8.6 引数の解釈と値の構築
--------------------------

These functions are useful when creating your own extension functions
and methods.  Additional information and examples are available in *note
Python インタプリタの拡張と埋め込み: 21c9.

最初に説明する 3 つの関数、 *note PyArg_ParseTuple(): 3b9, *note
PyArg_ParseTupleAndKeywords(): 81e,および *note PyArg_Parse(): 1a8b. は
いずれも '書式文字列 (format string)' を使います。書式文字列は、関数が受
け取るはずの引数に関する情報を伝えるのに用いられます。いずれの関数におけ
る書式文字列も、同じ書式を使っています。

* Menu:

* 引数を解析する: 引数を解析する<2>.
* 値の構築::


File: python.info,  Node: 引数を解析する<2>,  Next: 値の構築,  Up: 引数の解釈と値の構築

7.8.6.1 引数を解析する
......................

書式文字列は、ゼロ個またはそれ以上の "書式単位 (format unit)" から成り立
ちます。 1つの書式単位は1つの Python オブジェクトを表します; 通常は単一
の文字か、書式単位からなる文字列を括弧で囲ったものになります。例外として
、括弧で囲われていない書式単位文字列が単一のアドレス引数に対応する場合が
いくつかあります。以下の説明では、引用符のついた形式は書式単位です; (丸
)括弧で囲った部分は書式単位に対応する Python のオブジェクト型です; [角]
括弧は値をアドレス渡しする際に使う C の変数型です。

* Menu:

* 文字列とバッファ::
* 数: 数<2>.
* その他のオブジェクト::
* API 関数::


File: python.info,  Node: 文字列とバッファ,  Next: 数<2>,  Up: 引数を解析する<2>

7.8.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: b3f. 構造体。
     これはロックします 根底 バッファ これにより、呼び出し元はその後、バ
     ッファを内部でも使用できるようになります
     :c:type:‘Py_BEGIN_ALLOW_THREADS’ ブロック リスクなしに 可変 データ
     が再サイズ化または破壊される。その結果、'電話をかけなければならない
     ' *note PyBuffer_Release(): 833. データ処理が完了した後（または早期
     終了の場合）。

   * その ‘es’, ‘es#’, ‘et’ そして ‘et#’ フォーマットは結果を割り当てま
     す バッファ.  '必ず電話をかけてください' *note PyMem_Free(): 17fa.
     データ処理が完了した後（または早期終了の場合）。

   * 他の形式では *note str: 1ea. または 読み出し専用 bytes-like オブジ
     ェクト、例えば *note bytes: 1d2, および提供する ‘const char *’ ポイ
     ンタ その バッファ.  この場合 バッファ「借用」されています：これは
     対応するPythonオブジェクトによって管理され、このオブジェクトのライ
     フサイクルを共有します。メモリを自分で解放する必要はありません。

     以下のことを確実にするため 根底 バッファ 安全に借りることができます
     , 対象の *note PyBufferProcs.bf_releasebuffer: b4a. フィールドは必
     須です。 ‘NULL’.  これは一般的な 可変 次のようなオブジェクト *note
     bytearray: 1d1, また、いくつかの 読み出し専用 次のようなオブジェク
     ト *note memoryview: 1dd. の *note bytes: 1d2.

     これに加えて ‘bf_releasebuffer’ 要件として、入力が有効かどうかを確
     認するチェックはありません 対象は 不変 （例：請求に応じるかどうか 書
     き込み可能 バッファ, または、別のスレッドがデータを変更できるかどう
     か)。

‘s’ (*note str: 1ea.) [const char *]

     Unicode オブジェクトを、キャラクタ文字列を指す C のポインタに変換し
     ます。キャラクタ型ポインタ変数のアドレスを渡すと、すでに存在してい
     る文字列へのポインタをその変数に記録します。C 文字列は NUL で終端さ
     れています。Python の文字列型は、 null コードポイントが途中に埋め込
     まれていてはなりません; もし埋め込まれていれば *note ValueError:
     15a. 例外を送出します。Unicode オブジェクトは ‘'utf-8'’ を使って C
     文字列に変換されます。変換に失敗すると *note UnicodeError: 67c. を
     送出します。

          注釈: このフォーマットは *note bytes-like objects: 43d. をサポ
          ートしません。 ファイルシステムパスを受け取って C 言語の文字列
          に変換したい場合は、 ‘O&’ フォーマットを、 'converter' に
          *note PyUnicode_FSConverter(): 10d7. を指定して利用すると良い
          です。

     バージョン 3.5 で変更: 以前は Python 文字列に null コードポイントが
     埋め込まれていたときに *note TypeError: 29c. を送出していました。

‘s*’ (*note str: 1ea. または *note bytes-like object: 43d.) [Py_buffer]

     このフォーマットは Unicode オブジェクトと bytes-like object を受け
     付けて、呼び出し元から渡された *note Py_buffer: b3f. 構造体に値を格
     納します。 結果の C 文字列は NUL バイトを含むかもしれません。
     Unicode オブジェクトは ‘'utf-8'’ エンコーディングで C 文字列に変換
     されます。

‘s#’ (*note str: 1ea, 読み取り専用の *note bytes-like object: 43d.) [const char *, *note Py_ssize_t: e28.]

     のように ‘s*’, ただし、それは *note 借用された バッファ: 609.  結果
     は2つのC変数に格納されます。最初の変数はC文字列へのポインター、2つ
     目の変数はその長さです。文字列には埋め込まれたヌルバイトが含まれる
     可能性があります。Unicodeオブジェクトは、C文字列に変換されます
     ‘'utf-8'’ エンコード。

‘z’ (*note str: 1ea. または ‘None’) [const char *]

     ‘s’ に似ていますが、Python オブジェクトは ‘None’ でもよく、その場合
     には C のポインタは ‘NULL’ にセットされます。

‘z*’ (*note str: 1ea, *note bytes-like object: 43d. または ‘None’) [Py_buffer]

     ‘s*’ と同じですが、 Python の ‘None’ オブジェクトを受け取ることがで
     きます。その場合、 *note Py_buffer: b3f. 構造体の ‘buf’ メンバーは
     ‘NULL’ になります。

‘z#’ (*note str: 1ea, 読み出し専用の *note bytes-like object: 43d. または ‘None’) [const char *, *note Py_ssize_t: e28.]

     ‘s#’ に似ていますが、Python オブジェクトは ‘None’ でもよく、その場
     合には C のポインタは ‘NULL’ にセットされます。

‘y’ (読み出し専用の *note bytes-like object: 43d.) [const char *]

     この形式は bytes-like Cポインタへのオブジェクトへの参照を拒否する
     *note borrowed: 609. 文字列; Unicode オブジェクトは受け付けません。
     バイトバッファには埋め込みのヌルバイトを含んではいけません。もし含
     まれている場合 *note ValueError: 15a. 例外が発生します。

     バージョン 3.5 で変更: 以前は bytes バッファにヌルバイトが埋め込ま
     れていたときに *note TypeError: 29c. を送出していました。

‘y*’ (*note bytes-like object: 43d.) [Py_buffer]

     ‘s*’ の変形で、 Unicode オブジェクトを受け付けず、 bytes-like
     object のみを受け付けます。 'バイナリデータを受け付ける目的には、こ
     のフォーマットを使うことを推奨します。'

‘y#’ (読み出し専用の *note bytes-like object: 43d.) [const char *, *note Py_ssize_t: e28.]

     ‘s#’ の変形で、 Unicode オブジェクトを受け付けず、bytes-like object
     だけを受け付けます。

‘S’ (*note bytes: 1d2.) [PyBytesObject *]

     Pythonオブジェクトとして、 *note bytes: 1d2. オブジェクトを要求し、
     いかなる変換も行いません。オブジェクトが bytes オブジェクトでなけれ
     ば、 *note TypeError: 29c. を送出します。C 変数は *note PyObject:
     1a6.* と宣言しても構いません。

‘Y’ (*note bytearray: 1d1.) [PyByteArrayObject *]

     Python オブジェクトとして *note bytearray: 1d1. オブジェクトを要求
     し、いかなる変換もおこないません。 もしオブジェクトが ‘bytearray’ で
     なければ、 *note TypeError: 29c. を送出します。C 変数は *note
     PyObject: 1a6.* として宣言しても構いません。

‘U’ (*note str: 1ea.) [PyObject *]

     Python オブジェクトとして Unicode オブジェクトを要求し、いかなる変
     換も行いません。オブジェクトが Unicode オブジェクトではない場合、
     *note TypeError: 29c. が送出されます。C変数は *note PyObject: 1a6.*
     として宣言しても構いません。

‘w*’ (読み書き可能な *note bytes-like object: 43d.) [Py_buffer]

     This format accepts any object which implements the read-write
     buffer interface.  It fills a *note Py_buffer: b3f. structure
     provided by the caller.  The buffer may contain embedded null
     bytes.  The caller has to call *note PyBuffer_Release(): 833. when
     it is done with the buffer.

‘es’ (*note str: 1ea.) [const char *encoding, char **buffer]

     これは ‘s’ の変化形で、Unicodeをキャラクタ型バッファにエンコードす
     るために用いられます。NULバイトが埋め込まれていないデータでのみ動作
     します。

     この書式には二つの引数が必要です。一つ目は入力にのみ用いられ、 NUL
     で終端されたエンコード名文字列を指す const char* 型または、
     ‘'utf-8'’ が使われることを表す ‘NULL’ でなければなりません。指定し
     たエンコード名を Python が理解できない場合には例外を送出します。第
     二の引数は char** でなければなりません; この引数が参照しているポイ
     ンタの値は、引数に指定したテキストの内容が入ったバッファへのポイン
     タになります。テキストは最初の引数に指定したエンコード方式でエンコ
     ードされます。

     *note PyArg_ParseTuple(): 3b9. を使うと、必要なサイズのバッファを確
     保し、そのバッファにエンコード後のデータをコピーして、 '*buffer' が
     この新たに確保された記憶領域を指すように変更します。呼び出し側には
     、確保されたバッファを使い終わった後に *note PyMem_Free(): 17fa. で
     解放する責任があります。

‘et’ (*note str: 1ea, *note bytes: 1d2. または *note bytearray: 1d1.) [const char *encoding, char **buffer]

     ‘es’ と同じです。ただし、バイト文字列オブジェクトをエンコードし直さ
     ずに渡します。その代わり、実装ではバイト文字列オブジェクトがパラメ
     タに渡したエンコードを使っているものと仮定します。

‘es#’ (*note str: 1ea.) [const char *encoding, char **buffer, *note Py_ssize_t: e28. *buffer_length]

     ‘s#’ の変化形で、Unicode をキャラクタ型バッファにエンコードするため
     に用いられます。‘es’ 書式違って、この変化形はバイトが埋め込まれてい
     てもかまいません。

     この書式には三つの引数が必要です。一つ目は入力にのみ用いられ、 NUL
     で終端されたエンコード名文字列を指す const char* 型か ‘NULL’ でなけ
     ればなりません。 ‘NULL’ の場合には ‘'utf-8'’ を使います。指定したエ
     ンコード名を Python が理解できない場合には例外を送出します。第二の
     引数は char** でなければなりません; この引数が参照しているポインタ
     の値は、引数に指定したテキストの内容が入ったバッファへのポインタに
     なります。テキストは最初の引数に指定したエンコード方式でエンコード
     されます。第三の引数は整数へのポインタでなければなりません; ポイン
     タが参照している整数の値は出力バッファ内のバイト数にセットされます
     。

     この書式の処理には二つのモードがあります:

     '*buffer' が ‘NULL’ ポインタを指している場合、関数は必要なサイズの
     バッファを確保し、そのバッファにエンコード後のデータをコピーして、
     '*buffer' がこの新たに確保された記憶領域を指すように変更します。呼
     び出し側には、確保されたバッファを使い終わった後に *note
     PyMem_Free(): 17fa. で解放する責任があります。

     '*buffer' が非 ‘NULL’ のポインタ (すでにメモリ確保済みのバッファ) を
     指している場合、 *note PyArg_ParseTuple(): 3b9. はこのメモリ位置を
     バッファとして用い、 '*buffer_length' の初期値をバッファサイズとし
     て用います。 PyArg_ParseTuple は次にエンコード済みのデータをバッフ
     ァにコピーして、NUL で終端します。バッファの大きさが足りなければ
     *note ValueError: 15a. がセットされます。

     どちらの場合も、 '*buffer_length' は終端の NUL バイトを含まないエン
     コード済みデータの長さにセットされます。

‘et#’ (*note str: 1ea, *note bytes: 1d2. または *note bytearray: 1d1.) [const char *encoding, char **buffer, *note Py_ssize_t: e28. *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.8.6.3 数
..........

These formats allow representing Python numbers or single characters as
C numbers.  Formats that require *note int: 32e, *note float: 32f. or
*note complex: 330. can also use the corresponding special methods *note
__index__(): 444, *note __float__(): d96. or *note __complex__(): 9e3.
to convert the Python object to the required type.

For signed integer formats, *note OverflowError: c5b. is raised if the
value is out of range for the C type.  For unsigned integer formats, the
most significant bits are silently truncated when the receiving field is
too small to receive the value, and *note DeprecationWarning: 2d4. is
emitted when the value is larger than the maximal value for the C type
or less than the minimal value for the corresponding signed integer type
of the same size.

‘b’ (*note int: 32e.) [unsigned char]

     Convert a nonnegative Python integer to an unsigned tiny integer,
     stored in a C unsigned char.

‘B’ (*note int: 32e.) [unsigned char]

     Convert a Python integer to a tiny integer without overflow
     checking, stored in a C unsigned char.  Convert a Python integer to
     a C unsigned char.

‘h’ (*note int: 32e.) [short int]

     Python の整数を、 C の short int 型に変換します。

‘H’ (*note int: 32e.) [unsigned short int]

     Convert a Python integer to a C unsigned short int.

‘i’ (*note int: 32e.) [int]

     Python の整数を、 C の int 型に変換します。

‘I’ (*note int: 32e.) [unsigned int]

     Convert a Python integer to a C unsigned int.

‘l’ (*note int: 32e.) [long int]

     Python の整数を、 C の long int 型に変換します。

‘k’ (*note int: 32e.) [unsigned long]

     Convert a Python integer to a C unsigned long.

     バージョン 3.14 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

‘L’ (*note int: 32e.) [long long]

     Python の整数を、 C の long long 型に変換します。

‘K’ (*note int: 32e.) [unsigned long long]

     Convert a Python integer to a C unsigned long long.

     バージョン 3.14 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

‘n’ (*note int: 32e.) [*note Py_ssize_t: e28.]

     Python の整数をCの *note Py_ssize_t: e28. 型に変換します。

‘c’ (長さ 1 の、 *note bytes: 1d2. または *note bytearray: 1d1.) [char]

     長さ 1 の *note bytes: 1d2. または *note bytearray: 1d1. オブジェク
     トとして表現されている Python バイトを C の char 型に変換します。

     バージョン 3.3 で変更: *note bytearray: 1d1. を受け付けるようになり
     ました。

‘C’ (長さ 1 の *note str: 1ea.) [int]

     長さ 1 の *note str: 1ea. オブジェクトとして表現されている Python キ
     ャラクタを C の int 型に変換します。

‘f’ (*note float: 32f.) [float]

     Convert a Python floating-point number to a C float.

‘d’ (*note float: 32f.) [double]

     Convert a Python floating-point number to a C double.

‘D’ (*note complex: 330.) [Py_complex]

     Python の複素数型を、 C の *note Py_complex: 3c4. 構造体に変換しま
     す。

バージョン 3.15 で非推奨: For unsigned integer formats ‘B’, ‘H’, ‘I’,
‘k’ and ‘K’, *note DeprecationWarning: 2d4. is emitted when the value is
larger than the maximal value for the C type or less than the minimal
value for the corresponding signed integer type of the same size.


File: python.info,  Node: その他のオブジェクト,  Next: API 関数,  Prev: 数<2>,  Up: 引数を解析する<2>

7.8.6.4 その他のオブジェクト
............................

‘O’ (object) [PyObject *]

     Python オブジェクトを（変換なしで）C オブジェクトのポインターに格納
     します。 これにより、C プログラムは渡された実際のオブジェクトを受け
     取ります。新しい :term: 強参照 オブジェクトが作成されていません （
     すなわち、その参照カウント 増加しません)。その ポインタ 保存されて
     いない ‘NULL’.

‘O!’ (object) ['typeobject', PyObject *]

     Python オブジェクトを C の Python オブジェクト型ポインタに保存しま
     す。 ‘O’ に似ていますが、二つの C の引数をとります: 一つ目の引数は
     Python の型オブジェクトへのアドレスで、二つ目の引数はオブジェクトへ
     のポインタが保存されている (*note PyObject: 1a6.* の) C の変数への
     アドレスです。Python オブジェクトが指定した型ではない場合、 *note
     TypeError: 29c. を送出します。

‘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(): 10d7. and
     *note PyUnicode_FSDecoder(): 980.

     バージョン 3.1 で変更: ‘Py_CLEANUP_SUPPORTED’ was added.

‘p’ (*note bool: 5f6.) [int]

     真偽値が求められる箇所 (a boolean 'p'redicate) に渡された値を判定し
     、その結果を等価な C の true/false 整数値に変換します。 もし式が真
     なら int には ‘1’ が、偽なら ‘0’ が設定されます。この関数は任意の有
     効なPython値を受け付けます。 Pythonが値の真偽をどのように判定するか
     を知りたければ、 *note 真理値判定: 1aa0. を参照してください。

     Added in version 3.3.

‘(items)’ (sequence) ['matching-items']

     The object must be a Python sequence (except *note str: 1ea, *note
     bytes: 1d2. or *note bytearray: 1d1.) 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: 609. (‘s’, ‘s#’, ‘z’, ‘z#’, ‘y’, or ‘y#’) or a *note
     borrowed reference: 60a. (‘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: 1ea. and *note bytearray: 1d1.
     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(): 3b9. は対応する C 変数の内容に手を加えま
     せん。

‘$’

     *note PyArg_ParseTupleAndKeywords(): 81e. でのみ使用可能: 後続の
     Python引数がキーワード専用であることを示します。 現在、すべてのキー
     ワード専用引数は任意の引数でなければならず、そのため フォーマット文
     字列中の ‘|’ は常に ‘$’ より前に指定されなければなりません。

     Added in version 3.3.

‘:’

     この文字があると、書式単位の記述はそこで終わります; コロン以降の文
     字列は、エラーメッセージにおける関数名 (*note PyArg_ParseTuple():
     3b9. が送出する例外の "付属値 (associated value)") として使われます
     。

‘;’

     この文字があると、書式単位の記述はそこで終わります; セミコロン以降
     の文字列は、デフォルトエラーメッセージを '置き換える' エラーメッセ
     ージとして使われます。 ‘:’ と ‘;’ は相互に排他の文字です。

注意：呼び出し元に渡されるPythonオブジェクトの参照はすべて*借用*された参
照です。これらを解放しないでください（つまり、参照カウントを減らさないで
ください）！

以下の関数に渡す補助引数 (additional argument) は、書式文字列から決定さ
れる型へのアドレスでなければなりません; 補助引数に指定したアドレスは、タ
プルから入力された値を保存するために使います。上の書式単位のリストで説明
したように、補助引数を入力値として使う場合がいくつかあります; その場合、
対応する書式単位の指定する形式に従うようにしなければなりません。

変換を正しく行うためには、 'arg' オブジェクトは書式文字に一致しなければ
ならず、かつ書式文字列内の書式単位に全て値が入るようにしなければなりませ
ん。成功すると、 ‘PyArg_Parse*’ 関数は真を返します。それ以外の場合には偽
を返し、適切な例外を送出します。書式単位のどれかの変換失敗により
‘PyArg_Parse*’ が失敗した場合、失敗した書式単位に対応するアドレスとそれ
以降のアドレスの内容は変更されません。


File: python.info,  Node: API 関数,  Prev: その他のオブジェクト,  Up: 引数を解析する<2>

7.8.6.5 API 関数
................

 -- C の関数: int PyArg_ParseTuple (PyObject *args, const char *format,
          ...)
     ' 次に属します: *note Stable ABI: 961.'  位置引数のみを引数にとる関
     数のパラメタを解釈して、ローカルな変数に変換します。成功すると真を
     返します;失敗すると偽を返し、適切な例外を送出します。

 -- C の関数: int PyArg_VaParse (PyObject *args, const char *format,
          va_list vargs)
     ' 次に属します: *note Stable ABI: 961.'  *note PyArg_ParseTuple():
     3b9. と同じですが、可変長の引数ではなく 'va_list' を引数にとります
     。

 -- C の関数: int PyArg_ParseTupleAndKeywords (PyObject *args, PyObject
          *kw, const char *format, char *const *keywords, ...)
     ' 次に属します: *note Stable ABI: 961.'  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: e4b.  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: 820. macro.

     バージョン 3.6 で変更: *note 位置専用引数: e4b. を追加した。

     バージョン 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: 961.'  *note
     PyArg_ParseTupleAndKeywords(): 81e. と同じですが、可変長の引数では
     なく 'va_list' を引数にとります。

 -- C の関数: int PyArg_ValidateKeywordArguments (PyObject*)
     ' 次に属します: *note Stable ABI: 961.'  キーワード引数を格納した辞
     書のキーが文字列であることを確認します。この関数は *note
     PyArg_ParseTupleAndKeywords(): 81e. を使用しないときにのみ必要で、
     その理由は後者の関数は同様のチェックを実施するためです。

     Added in version 3.2.

 -- C の関数: int PyArg_Parse (PyObject *args, const char *format, ...)
     ' 次に属します: *note Stable ABI: 961.'  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_ParseArray (PyObject *const *args, Py_ssize_t
          nargs, const char *format, ...)

     Parse the parameters of a function that takes only array parameters
     into local variables (that is, a function using the *note
     METH_FASTCALL: 353. calling convention).  Returns true on success;
     on failure, it returns false and raises the appropriate exception.

     Added in version 3.15.

 -- C の関数: int PyArg_ParseArrayAndKeywords (PyObject *const *args,
          Py_ssize_t nargs, PyObject *kwnames, const char *format, const
          char *const *kwlist, ...)

     Parse the parameters of a function that takes both array and
     keyword parameters into local variables (that is, a function using
     the *note METH_FASTCALL: 353. ‘|’ *note METH_KEYWORDS: 51d5.
     calling convention).  Returns true on success; on failure, it
     returns false and raises the appropriate exception.

     Added in version 3.15.

 -- C の関数: int PyArg_UnpackTuple (PyObject *args, const char *name,
          Py_ssize_t min, Py_ssize_t max, ...)
     ' 次に属します: *note Stable ABI: 961.'  パラメーターの取得方法のよ
     りシンプルな形式で、使用しないもの a 書式文字列 引数の型を指定する
     。関数 これを使用する メソッド 彼らの パラメータ 次のように宣言する
     必要があります *note METH_VARARGS: 18c0. に 関数 にメソッド テーブ
     ル。実際のパラメーターを含むタプルは '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(): 18be. 呼び出しは、 *note
     PyArg_ParseTuple(): 3b9. を使った以下の呼び出しと全く等価です:

          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(): 81e. and *note
     PyArg_VaParseTupleAndKeywords(): 81f.  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.8.6.6 値の構築
................

 -- C の関数: *note PyObject: 1a6. *Py_BuildValue (const char *format,
          ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     ‘PyArg_Parse*’ ファミリの関数が受け取るのと似た形式の書式文字列およ
     び値列に基づいて、新たな値を生成します。生成した値を返します。エラ
     ーの場合には ‘NULL’ を返します; ‘NULL’ を返す場合、例外を送出するで
     しょう。

     *note Py_BuildValue(): 5f5. は常にタプルを生成するとは限りません。
     この関数がタプルを生成するのは、書式文字列に二つ以上の書式単位が入
     っているときだけです。書式文字列が空の場合 ‘None’ を返します; 書式
     単位が厳密に一つだけ入っている場合、書式単位で指定されている何らか
     のオブジェクト単体を返します。サイズがゼロや 1 のタプルを返すように
     強制するには、丸括弧で囲われた書式文字列を使います。

     書式単位 ‘s’ や ‘s#’ の場合のように、オブジェクトを構築する際にデー
     タを供給するためにメモリバッファをパラメタとして渡す場合には、指定
     したデータはコピーされます。 *note Py_BuildValue(): 5f5. が生成した
     オブジェクトは、呼び出し側が提供したバッファを決して参照しません。
     別の言い方をすれば、 ‘malloc()’ を呼び出してメモリを確保し、それを
     ‘Py_BuildValue()’ に渡した場合、コード内で ‘Py_BuildValue()’ が返っ
     た後で ‘free()’ を呼び出す責任があるということです。

     以下の説明では、引用符のついた形式は書式単位です; (丸)括弧で囲った
     部分は書式単位が返す Python のオブジェクト型です; [角] 括弧は関数に
     渡す値の C 変数型です。

     書式文字列内では、(‘s#’ のような書式単位を除いて) スペース、タブ、
     コロンおよびコンマは無視されます。これらの文字を使うと、長い書式文
     字列をちょっとだけ読みやすくできます。

     ‘s’ (*note str: 1ea. または ‘None’) [const char *]

          null終端された C 文字列を、 ‘'utf-8'’ エンコーディングを用いて
          、 Python *note str: 1ea. オブジェクトに変換します。もし C 文
          字列ポインタが ‘NULL’ の場合、 ‘None’ になります。

     ‘s#’ (*note str: 1ea. or ‘None’) [const char *, *note Py_ssize_t: e28.]

          C 文字列とその長さを ‘'utf-8'’ エンコーディングを使って Python
          *note str: 1ea. オブジェクトに変換します。C 文字列ポインタが
          ‘NULL’ の場合、長さは無視され、 ‘None’ になります。

     ‘y’ (*note bytes: 1d2.) [const char *]

          C 文字列をPython *note bytes: 1d2. オブジェクトに変換します。
          もしC 文字列ポインタが ‘NULL’ だった場合、‘None’ を返します。

     ‘y#’ (*note bytes: 1d2.) [const char *, *note Py_ssize_t: e28.]

          これは C 文字列とその長さから Python オブジェクトに変換します
          。C 文字列ポインタが ‘NULL’ の場合、長さは無視され ‘None’ にな
          ります。

     ‘z’ (*note str: 1ea. または ‘None’) [const char *]

          ‘s’ と同じです。

     ‘z#’ (*note str: 1ea. または ‘None’) [const char *, *note Py_ssize_t: e28.]

          ‘s#’ と同じです。

     ‘u’ (*note str: 1ea.) [const wchar_t *]

          null 終端された Unicode (UTF-16 または UCS-4) データの
          ‘wchar_t’ バッファから Python Unicode オブジェクトに変換します
          。 Unicode バッファポインタが ‘NULL’ の場合、 ‘None’ になりま
          す。

     ‘u#’ (*note str: 1ea.) [const wchar_t *, *note Py_ssize_t: e28.]

          Unicode (UTF-16 または UCS-4) データのバッファとその長さから
          Python Unicode オブジェクトに変換します。 Unicode バッファポイ
          ンタが ‘NULL’ の場合、長さは無視され ‘None’ になります。

     ‘U’ (*note str: 1ea. または ‘None’) [const char *]

          ‘s’ と同じです。

     ‘U#’ (*note str: 1ea. または ‘None’) [const char *, *note Py_ssize_t: e28.]

          ‘s#’ と同じです。

     ‘i’ (*note int: 32e.) [int]

          通常の C の int を Python の整数オブジェクトに変換します。

     ‘b’ (*note int: 32e.) [char]

          通常のC の char を Python の整数オブジェクトに変換します。

     ‘h’ (*note int: 32e.) [short int]

          通常のC の short int を Python の整数オブジェクトに変換します
          。

     ‘l’ (*note int: 32e.) [long int]

          C の long int を Python の整数オブジェクトに変換します。

     ‘B’ (*note int: 32e.) [unsigned char]

          C の unsigned char を Python の整数オブジェクトに変換します。

     ‘H’ (*note int: 32e.) [unsigned short int]

          C の unsigned short int を Python の整数オブジェクトに変換しま
          す。

     ‘I’ (*note int: 32e.) [unsigned int]

          C の unsigned int を Python の整数オブジェクトに変換します。

     ‘k’ (*note int: 32e.) [unsigned long]

          C の unsigned long を Python の整数オブジェクトに変換します。

     ‘L’ (*note int: 32e.) [long long]

          C の long long を Python の整数オブジェクトに変換します。

     ‘K’ (*note int: 32e.) [unsigned long long]

          C unsigned long long をPythonのintオブジェクトへ変換する。

     ‘n’ (*note int: 32e.) [*note Py_ssize_t: e28.]

          C の *note Py_ssize_t: e28. を Python の整数オブジェクトに変換
          します。

     ‘p’ (*note bool: 5f6.) [int]

          Convert a C int to a Python *note bool: 5f6. 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: 1d2.) [char]

          バイトを表す通常の C の int を、長さ 1 の Python の *note
          bytes: 1d2. オブジェクトに変換します。

     ‘C’ (長さ 1 の *note str: 1ea.) [int]

          文字を表す通常の C の int を、長さ 1 の Python の *note str:
          1ea. オブジェクトに変換します。

     ‘d’ (*note float: 32f.) [double]

          Convert a C double to a Python floating-point number.

     ‘f’ (*note float: 32f.) [float]

          Convert a C float to a Python floating-point number.

     ‘D’ (*note complex: 330.) [Py_complex *]

          C の *note Py_complex: 3c4. 構造体を Python の複素数型に変換し
          ます。

     ‘O’ (object) [PyObject *]

          Python オブジェクトをそのまま渡すものの、それに対する新しい 強
          参照 を作成する（つまり、その参照カウントが1増加します）。渡さ
          れたオブジェクトが ‘NULL’ ポインタ, この問題は、引数を生成する
          呼び出しがエラーを検出し、例外を設定したため発生したものと推測
          されます。したがって、*note Py_BuildValue(): 5f5. 戻ってきます
          ‘NULL’ しかし、そうはならない 送出 例外。 例外がまだ発生してい
          ない場合、*note SystemError: 3f1. 設定されています。

     ‘S’ (object) [PyObject *]

          ‘O’ と同じです。

     ‘N’ (object) [PyObject *]

          同じです ‘O’, ただし、新しい 強参照 を作成しません。オブジェク
          トが引数リスト内のオブジェクトコンストラクターの呼び出しによっ
          て作成される場合に便利です。

     ‘O&’ (object) ['converter', 'anything']

          'anything' を 'converter' 関数を介して Python オブジェクトに変
          換します。この関数は 'anything' (void* と互換の型でなければな
          りません) を引数にして呼び出され、"新たな" オブジェクトを返す
          か、失敗した場合には ‘NULL’ を返すようにしなければなりません。

     ‘(items)’ (*note tuple: 1d9.) ['matching-items']

          C の値からなる配列を、同じ要素数を持つ Python のタプルに変換し
          ます。

     ‘[items]’ (*note list: 4e0.) ['matching-items']

          C の値からなる配列を、同じ要素数を持つ Python のリストに変換し
          ます。

     ‘{items}’ (*note dict: 193.) ['matching-items']

          C の値からなる配列を Python の辞書に変換します。一連のペアから
          なる C の値が、それぞれキーおよび値となって辞書に追加されます
          。

     書式文字列に関するエラーが生じると、 *note SystemError: 3f1. 例外を
     セットして ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *Py_VaBuildValue (const char *format,
          va_list vargs)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     *note Py_BuildValue(): 5f5. と同じですが、可変長引数の代わりに
     va_list を受け取ります。


File: python.info,  Node: 文字列の変換と書式化,  Next: Character classification and conversion,  Prev: 引数の解釈と値の構築,  Up: ユーティリティ<2>

7.8.7 文字列の変換と書式化
--------------------------

数値変換と、書式化文字列出力のための関数群。

 -- C の関数: int PyOS_snprintf (char *str, size_t size, const char
          *format, ...)
     ' 次に属します: *note Stable ABI: 961.'  書式文字列 '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: 961.'  書式文字列 'format' と可変
     長引数リスト 'va' から、 'size' バイトを超えない文字列を 'str' に出
     力します。 Unix man page の ‘vsnprintf(3)(2)’ を参照してください。

*note PyOS_snprintf(): 18c1. と *note PyOS_vsnprintf(): 18c2. は標準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: 961.'  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: 961.'  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(): 53cc, 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: 961.'  文字列 ‘s’ を double に変
     換します。失敗したときは Python の例外を発生させます。受け入れられ
     る文字列は、 Python の *note float(): 32f. コンストラクタが受け付け
     る文字列に準拠しますが、 ‘s’ の先頭と末尾に空白文字があってはならな
     いという部分が異なります。この変換は現在のロケールに依存しません。

     ‘endptr’ が ‘NULL’ の場合、変換は文字列全体に対して行われます。文字
     列が正しい浮動小数点数の表現になっていない場合は ‘-1.0’ を返して
     *note ValueError: 15a. を発生させます。

     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 ‘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: 961.'  double 'val' を指定された
     'format_code', 'precision', 'flags' に基づいて文字列に変換します。

     'format_code' は ‘'e'’, ‘'E'’, ‘'f'’, ‘'F'’, ‘'g'’, ‘'G'’, ‘'r'’ の
     どれかでなければなりません。 ‘'r'’ の場合、 'precision' は 0 でなけ
     ればならず、無視されます。 ‘'r'’ フォーマットコードは標準の *note
     repr(): 462. フォーマットを指定しています。

     '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(): 18c1. ‘'#'’ 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(): 17fa. を使って解放する責任があります。

     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: 961.'  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():
     1f4e. and *note PyOS_mystrnicmp(): 1f4d, 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.8.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.8.9 PyHash API
----------------

*note PyTypeObject.tp_hash: 521a. メンバや *note 数値型のハッシュ化:
2816. も参照してください。

 -- 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: 1ea. 、 *note bytes: 1d2. や *note memoryview: 1dd. のハ
     ッシュ用アルゴリズムを示す数値型。

     アルゴリズム名は *note sys.hash_info.algorithm: 4c10. により公開さ
     れます。

     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: 3b8. to
     determine which algorithm is used for hashing.  The hash algorithm
     can be configured via the configure *note -with-hash-algorithm:
     23c1. 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: 3b8.

        - 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: 4c13. 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: 2817.
     constant.

     Added in version 3.13.

 -- C のマクロ: PyHASH_BITS

     The exponent ‘n’ of ‘P’ in *note PyHASH_MODULUS: 1c10.

     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: 4c0d. 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: 4c0f. constant.

     Added in version 3.13.

 -- C のデータ型: type PyHash_FuncDef

     Hash function definition used by *note PyHash_GetFuncDef(): 55cc.

      -- C のメンバ変数: *note Py_hash_t: 161d. (*const hash)(const
               void*, *note Py_ssize_t: e28.)

          Hash function.

      -- C のメンバ変数: const char *name

          Hash function name (UTF-8 encoded string).

          This corresponds to the *note sys.hash_info.algorithm: 4c10.
          constant.

      -- C のメンバ変数: const int hash_bits

          Internal size of the hash value in bits.

          This corresponds to the *note sys.hash_info.hash_bits: 4c11.
          constant.

      -- C のメンバ変数: const int seed_bits

          Size of seed input in bits.

          This corresponds to the *note sys.hash_info.seed_bits: 4c12.
          constant.

     Added in version 3.4.

 -- C の関数: *note PyHash_FuncDef: 55cb. *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: 161d. 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: 161d. 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: 1d2, *note memoryview: 1dd, and other built-in objects
     that implement the *note buffer protocol: 319.

     Use this function to implement hashing for immutable objects whose
     *note tp_richcompare: 5214. 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: 161d. 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(): 63f.

     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.8.10 リフレクション
---------------------

 -- C の関数: *note PyObject: 1a6. *PyEval_GetBuiltins (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'

     バージョン 3.13 で非推奨: Use *note PyEval_GetFrameBuiltins(): 7ef.
     instead.

     現在の実行フレーム内のビルトインの辞書か、もし実行中のフレームがな
     ければスレッド状態のインタプリタのビルトイン辞書を返します。

 -- C の関数: *note PyObject: 1a6. *PyEval_GetLocals (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'

     バージョン 3.13 で非推奨: Use either *note PyEval_GetFrameLocals():
     7f3. to obtain the same behaviour as calling *note locals(): 296.
     in Python code, or else call *note PyFrame_GetLocals(): 854. on the
     result of *note PyEval_GetFrame(): 1d56. to access the *note
     f_locals: 298. 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(): 296. for details of the mapping returned
     at different scopes.

     As this function returns a *note borrowed reference: 60a, the
     dictionary returned for *note optimized scopes: 6b3. is cached on
     the frame object and will remain alive as long as the frame object
     does.  Unlike *note PyEval_GetFrameLocals(): 7f3. and *note
     locals(): 296, 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(): 854, *note locals(): 296, and *note
     FrameType.f_locals: 298. no longer make use of the shared cache
     dictionary.  Refer to the *note What's New entry: 688. for
     additional details.

 -- C の関数: *note PyObject: 1a6. *PyEval_GetGlobals (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'

     バージョン 3.13 で非推奨: Use *note PyEval_GetFrameGlobals(): 7f1.
     instead.

     現在の実行フレーム内のグローバル変数の辞書か、実行中のフレームがな
     ければ ‘NULL’ を返します。

 -- C の関数: *note PyFrameObject: b6d. *PyEval_GetFrame (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'  Return
     the *note attached thread state: 1ac.'s frame, which is ‘NULL’ if
     no frame is currently executing.

     See also *note PyThreadState_GetFrame(): b72.

 -- C の関数: *note PyObject: 1a6. *PyEval_GetFrameBuiltins (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.13 より).'  現在の実行フレーム内のビルトインの辞書か、もし
     実行中のフレームがなければスレッド状態のインタプリタのビルトイン辞
     書を返します。

     Added in version 3.13.

 -- C の関数: *note PyObject: 1a6. *PyEval_GetFrameLocals (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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(): 296. in Python
     code.

     To access *note f_locals: 298. on the current frame without making
     an independent snapshot in *note optimized scopes: 6b3, call *note
     PyFrame_GetLocals(): 854. on the result of *note PyEval_GetFrame():
     1d56.

     Added in version 3.13.

 -- C の関数: *note PyObject: 1a6. *PyEval_GetFrameGlobals (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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(): 1e20. in Python
     code.

     Added in version 3.13.

 -- C の関数: const char *PyEval_GetFuncName (PyObject *func)
     ' 次に属します: *note Stable ABI: 961.'  'func' が関数、クラス、イ
     ンスタンスオブジェクトであればその名前を、そうでなければ 'func' の
     型を返します。

 -- C の関数: const char *PyEval_GetFuncDesc (PyObject *func)
     ' 次に属します: *note Stable ABI: 961.'  'func' の型に依存する、解
     説文字列(description string)を返します。戻り値は、関数とメソッドに
     対しては "()", " constructor", " instance", " object" です。 *note
     PyEval_GetFuncName(): 5316. と連結された結果、 'func' の解説になり
     ます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0667/


File: python.info,  Node: codec レジストリとサポート関数,  Next: PyTime C API,  Prev: リフレクション,  Up: ユーティリティ<2>

7.8.11 codec レジストリとサポート関数
-------------------------------------

 -- C の関数: int PyCodec_Register (PyObject *search_function)
     ' 次に属します: *note Stable ABI: 961.'  新しい 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: 961. (バージョン 3.10 より).'  コ
     ーデック検索関数の登録を解除し、レジストリのキャッシュをクリアしま
     す。 検索関数が登録されていない場合は何もしません。 成功したら0を返
     します。 エラーの場合は例外を送出させ、-1を返します。

     Added in version 3.10.

 -- C の関数: int PyCodec_KnownEncoding (const char *encoding)
     ' 次に属します: *note Stable ABI: 961.'  'encoding' のための登録さ
     れた codec が存在するかどうかに応じて ‘1’ か ‘0’ を返します。 この
     関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyCodec_Encode (PyObject *object,
          const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  汎用
     の codec ベースの encode API.

     'encoding' に応じて見つかったエンコーダ関数に対して 'object' を渡し
     ます。 エラーハンドリングメソッドは 'errors' で指定します。
     'errors' は ‘NULL’ でもよく、その場合はその codec のデフォルトのメ
     ソッドが利用されます。 エンコーダが見つからなかった場合は *note
     LookupError: 25f9. を発生させます。

 -- C の関数: *note PyObject: 1a6. *PyCodec_Decode (PyObject *object,
          const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  汎用
     の 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: 25f9. if no decoder can be
     found.

* Menu:

* コーデック検索API::
* Unicode エラーハンドラ用レジストリ API::
* Codec utility variables::


File: python.info,  Node: コーデック検索API,  Next: Unicode エラーハンドラ用レジストリ API,  Up: codec レジストリとサポート関数

7.8.11.1 コーデック検索API
..........................

次の関数では、文字列 'encoding' は全て小文字に変換することで、効率的に、
大文字小文字を無視した検索をします。 コーデックが見つからない場合、
*note KeyError: 7e5. を設定して ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyCodec_Encoder (const char
          *encoding)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた 'encoding' のエンコーダ関数を返します。

 -- C の関数: *note PyObject: 1a6. *PyCodec_Decoder (const char
          *encoding)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた 'encoding' のデコーダ関数を返します。

 -- C の関数: *note PyObject: 1a6. *PyCodec_IncrementalEncoder (const
          char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた 'encoding' の *note IncrementalEncoder: 2a65. オブジェクトを
     返します。

 -- C の関数: *note PyObject: 1a6. *PyCodec_IncrementalDecoder (const
          char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた 'encoding' の *note IncrementalDecoder: 2a66. オブジェクトを
     返します。

 -- C の関数: *note PyObject: 1a6. *PyCodec_StreamReader (const char
          *encoding, PyObject *stream, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた 'encoding' の *note StreamReader: 2a6a. ファクトリ関数を返し
     ます。

 -- C の関数: *note PyObject: 1a6. *PyCodec_StreamWriter (const char
          *encoding, PyObject *stream, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた 'encoding' の *note StreamWriter: 2a69. ファクトリ関数を返し
     ます。


File: python.info,  Node: Unicode エラーハンドラ用レジストリ API,  Next: Codec utility variables,  Prev: コーデック検索API,  Up: codec レジストリとサポート関数

7.8.11.2 Unicode エラーハンドラ用レジストリ API
...............................................

 -- C の関数: int PyCodec_RegisterError (const char *name, PyObject
          *error)
     ' 次に属します: *note Stable ABI: 961.'  エラーハンドルのためのコー
     ルバック関数 'error' を 'name' で登録します。このコールバック関数は
     、コーデックがエンコードできない文字/デコードできないバイトに遭遇し
     た時に、そのエンコード/デコード関数の呼び出しで 'name' が指定されて
     いたら呼び出されます。

     コールバックは1つの引数として、 *note UnicodeEncodeError: a6c,
     *note UnicodeDecodeError: ddb, *note UnicodeTranslateError: 1b3b. の
     どれかのインスタンスを受け取ります。このインスタンスは問題のある文
     字列やバイト列に関する情報と、その元の文字列中のオフセットを持って
     います。(その情報を取得するための関数については *note Unicode
     例外オブジェクト: 67b. を参照してください。) コールバックは渡された
     例外を発生させるか、2要素のタプルに問題のシーケンスの代替と、
     encode/decode を再開する元の文字列中のオフセットとなる整数を格納し
     て返します。

     成功したら ‘0’ を、エラー時は ‘-1’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyCodec_LookupError (const char
          *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     'name' で登録されたエラーハンドリングコールバック関数を検索します。
     特別な場合として、‘NULL’ が渡された場合、"strict" のエラーハンドリ
     ングコールバック関数を返します。

 -- C の関数: *note PyObject: 1a6. *PyCodec_StrictErrors (PyObject *exc)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 961.'
     'exc' を例外として発生させます。

 -- C の関数: *note PyObject: 1a6. *PyCodec_IgnoreErrors (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     unicode エラーを無視し、問題の入力をスキップします。

 -- C の関数: *note PyObject: 1a6. *PyCodec_ReplaceErrors (PyObject
          *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     unicode エラーを ‘?’ か ‘U+FFFD’ で置き換えます。

 -- C の関数: *note PyObject: 1a6. *PyCodec_XMLCharRefReplaceErrors
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     unicode encode エラーを XML文字参照で置き換えます。

 -- C の関数: *note PyObject: 1a6. *PyCodec_BackslashReplaceErrors
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     unicode encode エラーをバックスラッシュエスケープ (‘\x’, ‘\u’,
     ‘\U’) で置き換えます。

 -- C の関数: *note PyObject: 1a6. *PyCodec_NameReplaceErrors (PyObject
          *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  unicode encode エラーを ‘\N{...}’ で置き換えま
     す。

     Added in version 3.5.


File: python.info,  Node: Codec utility variables,  Prev: Unicode エラーハンドラ用レジストリ API,  Up: codec レジストリとサポート関数

7.8.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.8.12 PyTime C API
-------------------

Added in version 3.13.

クロック C API は、システムクロックへのアクセスを提供します。これは
Python の *note time: f7. モジュールに似ています。

*note datetime: 33. モジュールに関連する C API については、*note
DateTime オブジェクト: 55de. を参照してください。

* Menu:

* 型: 型<3>.
* Clock Functions::
* Raw Clock Functions::
* Conversion functions::


File: python.info,  Node: 型<3>,  Next: Clock Functions,  Up: PyTime C API

7.8.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(): 7da. 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: 7d2. PyTime_MIN

     Minimum value of *note PyTime_t: 7d2.

 -- C 変数: *note PyTime_t: 7d2. PyTime_MAX

     Maximum value of *note PyTime_t: 7d2.


File: python.info,  Node: Clock Functions,  Next: Raw Clock Functions,  Prev: 型<3>,  Up: PyTime C API

7.8.12.2 Clock Functions
........................

The following functions take a pointer to a *note PyTime_t: 7d2. 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: 533f.
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: 1ac.

 -- C の関数: int PyTime_Monotonic (PyTime_t *result)

     Read the monotonic clock.  See *note time.monotonic(): 763. for
     important details on this clock.

 -- C の関数: int PyTime_PerfCounter (PyTime_t *result)

     Read the performance counter.  See *note time.perf_counter(): e4d.
     for important details on this clock.

 -- C の関数: int PyTime_Time (PyTime_t *result)

     Read the “wall clock” time.  See *note time.time(): 764. for
     details important on this clock.


File: python.info,  Node: Raw Clock Functions,  Next: Conversion functions,  Prev: Clock Functions,  Up: PyTime C API

7.8.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: 1ac.

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: 1ac. a *note
thread state: 1a90, 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(): 7d6, but don't set an
     exception on error and don't require an *note attached thread
     state: 1ac.

 -- C の関数: int PyTime_PerfCounterRaw (PyTime_t *result)

     Similar to *note PyTime_PerfCounter(): 7d8, but don't set an
     exception on error and don't require an *note attached thread
     state: 1ac.

 -- C の関数: int PyTime_TimeRaw (PyTime_t *result)

     Similar to *note PyTime_Time(): 7da, but don't set an exception on
     error and don't require an *note attached thread state: 1ac.


File: python.info,  Node: Conversion functions,  Prev: Raw Clock Functions,  Up: PyTime C API

7.8.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.8.13 Support for Perf Maps
----------------------------

On supported platforms (Linux and macOS), the runtime can take advantage
of 'perf map files' to make Python functions visible to an external
profiling tool (such as perf(1) or samply(2)).  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(3).

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: 1ac. is not required
for these APIs.

 -- C の関数: int PyUnstable_PerfMapState_Init (void)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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():
     1ccb.).  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,
          size_t code_size, const char *entry_name)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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(): 1ccc. 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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Close the perf map file opened by *note
     PyUnstable_PerfMapState_Init(): 1ccc.  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://github.com/mstange/samply/

   (3) 
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.9 抽象オブジェクトレイヤ (Abstract Objects Layer)
===================================================

この章で説明する関数は、オブジェクトの型に依存しないような Python オブジ
ェクトの操作や、(数値型全て、シーケンス型全てといった) 大まかな型のオブ
ジェクトに対する操作を行ないます。関数を適用対象でないオブジェクトに対し
て使った場合、Python の例外が送出されることになります。

これらの関数は、 *note PyList_New(): 526f. で作成された後に ‘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.9.1 オブジェクトプロトコル (object protocol)
----------------------------------------------

 -- C の関数: *note PyObject: 1a6. *Py_GetConstant (unsigned int
          constant_id)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Get a *note strong reference: 7e0. 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: a6a.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_FALSE            ‘1’       *note False: ef9.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_TRUE             ‘2’       *note True: fd0.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_ELLIPSIS         ‘3’       *note Ellipsis: 2537.
                                                            
                                                            
      -- C のマクロ:                              ‘4’       *note NotImplemented: 447.
               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: 3a0.

 -- C の関数: *note PyObject: 1a6. *Py_GetConstantBorrowed (unsigned int
          constant_id)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Similar to *note Py_GetConstant(): 7f5, but return a *note borrowed
     reference: 60a.

     This function is primarily intended for backwards compatibility:
     using *note Py_GetConstant(): 7f5. 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: 1a6. *Py_NotImplemented

     与えられたオブジェクトとメソッドの引数の型の組み合わせの処理が未実
     装である印として使われる、 ‘未実装 (NotImplemented)’ シングルトン。

 -- C のマクロ: Py_RETURN_NOTIMPLEMENTED

     Properly handle returning *note Py_NotImplemented: 55f7. from
     within a C function (that is, create a new *note strong reference:
     7e0. to *note NotImplemented: 447. and return it).

 -- C のマクロ: Py_PRINT_RAW

     Flag to be used with multiple functions that print the object (like
     *note PyObject_Print(): 191f. and *note PyFile_WriteObject():
     535f.).  If passed, these functions use the *note str(): 1ea. of
     the object instead of the *note repr(): 462.

 -- 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: 55f8.; if
     given, the *note str(): 1ea. of the object is written instead of
     the *note repr(): 462.

 -- C の関数: void PyObject_Dump (PyObject *op)

     Dump an object 'op' to ‘stderr’.  This should only be used for
     debugging.

     The output is intended to try dumping objects even after memory
     corruption:

        * Information is written starting with fields that are the least
          likely to crash when accessed.

        * This function can be called without an *note attached thread
          state: 1ac, but it's not recommended to do so: it can cause
          deadlocks.

        * An object that does not belong to the current interpreter may
          be dumped, but this may also cause crashes or unintended
          behavior.

        * Implement a heuristic to detect if the object memory has been
          freed.  Don't display the object contents in this case, only
          its memory address.

        * The output format may change at any time.

     Example of output:

          object address  : 0x7f80124702c0
          object refcount : 2
          object type     : 0x9902e0
          object type name: str
          object repr     : 'abcdef'

     Added in version 3.15.

 -- C の関数: int PyObject_HasAttrWithError (PyObject *o, PyObject
          *attr_name)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 961. (バージョン 3.13 より).'
     This is the same as *note PyObject_HasAttrWithError(): 815, but
     'attr_name' is specified as a const char* UTF-8 encoded bytes
     string, rather than a *note PyObject: 1a6.*.

     Added in version 3.13.

 -- C の関数: int PyObject_HasAttr (PyObject *o, PyObject *attr_name)
     ' 次に属します: *note Stable ABI: 961.'  Returns ‘1’ if 'o' has the
     attribute 'attr_name', and ‘0’ otherwise.  This function always
     succeeds.

          注釈: Exceptions that occur when this calls *note
          __getattr__(): 8e8. and *note __getattribute__(): f94. methods
          aren't propagated, but instead given to *note
          sys.unraisablehook(): 712.  For proper error handling, use
          *note PyObject_HasAttrWithError(): 815, *note
          PyObject_GetOptionalAttr(): 7ea. or *note PyObject_GetAttr():
          3bf. instead.

 -- C の関数: int PyObject_HasAttrString (PyObject *o, const char
          *attr_name)
     ' 次に属します: *note Stable ABI: 961.'  This is the same as *note
     PyObject_HasAttr(): 816, but 'attr_name' is specified as a const
     char* UTF-8 encoded bytes string, rather than a *note PyObject:
     1a6.*.

          注釈: Exceptions that occur when this calls *note
          __getattr__(): 8e8. and *note __getattribute__(): f94. methods
          or while creating the temporary *note str: 1ea. object are
          silently ignored.  For proper error handling, use *note
          PyObject_HasAttrStringWithError(): 817, *note
          PyObject_GetOptionalAttrString(): 7eb. or *note
          PyObject_GetAttrString(): 7ec. instead.

 -- C の関数: *note PyObject: 1a6. *PyObject_GetAttr (PyObject *o,
          PyObject *attr_name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  オブ
     ジェクト '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(): 7ea. instead.

 -- C の関数: *note PyObject: 1a6. *PyObject_GetAttrString (PyObject *o,
          const char *attr_name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  This
     is the same as *note PyObject_GetAttr(): 3bf, but 'attr_name' is
     specified as a const char* UTF-8 encoded bytes string, rather than
     a *note PyObject: 1a6.*.

     If the missing attribute should not be treated as a failure, you
     can use *note PyObject_GetOptionalAttrString(): 7eb. instead.

 -- C の関数: int PyObject_GetOptionalAttr (PyObject *obj, PyObject
          *attr_name, PyObject **result);
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Variant of *note PyObject_GetAttr(): 3bf. which doesn't raise *note
     AttributeError: 1b4. if the attribute is not found.

     If the attribute is found, return ‘1’ and set '*result' to a new
     *note strong reference: 7e0. to the attribute.  If the attribute is
     not found, return ‘0’ and set '*result' to ‘NULL’; the *note
     AttributeError: 1b4. 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: 961. (バージョン 3.13 より).'
     This is the same as *note PyObject_GetOptionalAttr(): 7ea, but
     'attr_name' is specified as a const char* UTF-8 encoded bytes
     string, rather than a *note PyObject: 1a6.*.

     Added in version 3.13.

 -- C の関数: *note PyObject: 1a6. *PyObject_GenericGetAttr (PyObject
          *o, PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  型オ
     ブジェクトの ‘tp_getattro’ スロットに置かれる、属性を取得する総称的
     な関数です。この関数は、 (もし存在すれば) オブジェクトの属性 *note
     __dict__: 1ca. に加え、オブジェクトの MRO にあるクラスの辞書にある
     デスクリプタを探します。 *note デスクリプタ (descriptor) の実装:
     1011. で概要が述べられている通り、データのデスクリプタはインスタン
     スの属性より優先され、非データデスクリプタは後回しにされます。見付
     からなかった場合は *note AttributeError: 1b4. を送出します。

 -- C の関数: int PyObject_SetAttr (PyObject *o, PyObject *attr_name,
          PyObject *v)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクト 'o' の
     'attr_name' という名の属性に、値 'v' を設定します。 失敗すると例外
     を送出し ‘-1’ を返します; 成功すると ‘0’ を返します。 この関数は
     Python の式 ‘o.attr_name = v’ と同じです。

     'v' が ‘NULL’ のとき、アトリビュートは削除されます。この動作は
     *note PyObject_DelAttr(): 1a8d. のため、非推奨となっていますが、削
     除される予定はありません。

     The function must not be called with a ‘NULL’ 'v' and an exception
     set.  This case can arise from forgetting ‘NULL’ checks and would
     delete the attribute.

     バージョン 3.15 で変更: Must not be called with NULL value if an
     exception is set.

 -- C の関数: int PyObject_SetAttrString (PyObject *o, const char
          *attr_name, PyObject *v)
     ' 次に属します: *note Stable ABI: 961.'  This is the same as *note
     PyObject_SetAttr(): 1948, but 'attr_name' is specified as a const
     char* UTF-8 encoded bytes string, rather than a *note PyObject:
     1a6.*.

     'v' が ‘NULL’ の場合は属性が削除されますが、この機能は非推奨であり
     *note PyObject_DelAttrString(): 1a8e. を使うのが望ましいです。

     The function must not be called with a ‘NULL’ 'v' and an exception
     set.  This case can arise from forgetting ‘NULL’ checks and would
     delete the attribute.

     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(): 5460.
     and *note PyObject_SetAttr(): 1948. directly.  For more details,
     see *note PyUnicode_InternFromString(): 3bd, which may be used
     internally to create a key object.

     バージョン 3.15 で変更: Must not be called with NULL value if an
     exception is set.

 -- C の関数: int PyObject_GenericSetAttr (PyObject *o, PyObject *name,
          PyObject *value)
     ' 次に属します: *note Stable ABI: 961.'  属性の設定と削除を行う汎用
     的な関数で、型オブジェクトの *note tp_setattro: 520c. スロットに置
     かれます。 オブジェクトの MRO にあるクラスの辞書からデータディスク
     リプタを探し、見付かった場合はインスタンスの辞書にある属性の設定や
     削除よりも優先されます。 そうでない場合は、(もし存在すれば) オブジ
     ェクトの *note __dict__: 1ca. に属性を設定もしくは削除します。 成功
     すると ‘0’ が返され、そうでない場合は *note AttributeError: 1b4. が
     送出され ‘-1’ が返されます。

 -- C の関数: int PyObject_DelAttr (PyObject *o, PyObject *attr_name)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'  オ
     ブジェクト 'o' の 'attr_name' という名の属性を削除します。失敗する
     と ‘-1’ を返します。この関数は Python の文 ‘del o.attr_name’ と同じ
     です。

 -- C の関数: int PyObject_DelAttrString (PyObject *o, const char
          *attr_name)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     This is the same as *note PyObject_DelAttr(): 1a8d, but 'attr_name'
     is specified as a const char* UTF-8 encoded bytes string, rather
     than a *note PyObject: 1a6.*.

     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(): 5460.
     and *note PyObject_DelAttr(): 1a8d. directly.  For more details,
     see *note PyUnicode_InternFromString(): 3bd, which may be used
     internally to create a key object for lookup.

 -- C の関数: *note PyObject: 1a6. *PyObject_GenericGetDict (PyObject
          *o, void *context)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.10 より).'  ‘__dict__’ デスクリプタの getter の総称的な実
     装です。必要な場合は、辞書を作成します。

     This function may also be called to get the *note __dict__: 1ca. 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(): 3bf. 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: 961. (バージョン 3.7 より).'
     ‘__dict__’ デスクリプタの setter の総称的な実装です。この実装では辞
     書を削除することは許されていません。

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. **_PyObject_GetDictPtr (PyObject
          *obj)

     Return a pointer to *note __dict__: 1ca. 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(): 3bf. when
     accessing an attribute on the object.

 -- C の関数: *note PyObject: 1a6. *PyObject_RichCompare (PyObject *o1,
          PyObject *o2, int opid)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Compare the values of 'o1' and 'o2' using the operation specified
     by 'opid', which must be one of *note Py_LT: 55fa, *note Py_LE:
     55fb, *note Py_EQ: 55fc, *note Py_NE: 55fd, *note Py_GT: 55fe, or
     *note Py_GE: 55ff, 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: 961.'  Compare the values of 'o1'
     and 'o2' using the operation specified by 'opid', like *note
     PyObject_RichCompare(): 5215, but returns ‘-1’ on error, ‘0’ if the
     result is false, ‘1’ otherwise.

     注釈: If 'o1' and 'o2' are the same object, *note
     PyObject_RichCompareBool(): 1f9d. will always return ‘1’ for *note
     Py_EQ: 55fc. and ‘0’ for *note Py_NE: 55fd.

 -- C の関数: *note PyObject: 1a6. *PyObject_Format (PyObject *obj,
          PyObject *format_spec)
     ' 次に属します: *note Stable ABI: 961.'  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: 1a6. *PyObject_Repr (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     オブジェクト 'o' の文字列表現を計算します。成功すると文字列表現を返
     し、失敗すると ‘NULL’ を返します。 Python 式 ‘repr(o)’ と同じです。
     この関数は組み込み関数 *note repr(): 462. の処理で呼び出されます。

     If argument is ‘NULL’, return the string ‘'<NULL>'’.

     バージョン 3.4 で変更: アクティブな例外を黙って捨てないことを保証す
     るのに便利なように、この関数はデバッグアサーションを含むようになり
     ました。

 -- C の関数: *note PyObject: 1a6. *PyObject_ASCII (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     *note PyObject_Repr(): 13db. と同様、オブジェクト 'o' の文字列表現
     を計算しますが、 ‘PyObject_Repr()’ によって返された文字列に含まれる
     非 ASCII 文字を、エスケープ文字 ‘\x’ 、 ‘\u’ 、 ‘\U’ でエスケープし
     ます。この関数は Pythoh 2 の ‘PyObject_Repr()’ が返す文字列と同じ文
     字列を生成します。 *note ascii(): 179f. によって呼び出されます。

     If argument is ‘NULL’, return the string ‘'<NULL>'’.

 -- C の関数: *note PyObject: 1a6. *PyObject_Str (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  オブ
     ジェクト 'o' の文字列表現を計算します。成功すると文字列表現を返し、
     失敗すると ‘NULL’ を返します。 Python 式 ‘str(o)’ と同じです。この
     関数は組み込み関数 *note str(): 1ea. や、 *note print(): 1324. 関数
     の処理で呼び出されます。

     If argument is ‘NULL’, return the string ‘'<NULL>'’.

     バージョン 3.4 で変更: アクティブな例外を黙って捨てないことを保証す
     るのに便利なように、この関数はデバッグアサーションを含むようになり
     ました。

 -- C の関数: *note PyObject: 1a6. *PyObject_Bytes (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     オブジェクト 'o' のバイト列表現を計算します。失敗すると ‘NULL’ を返
     し、成功すると bytes オブジェクトを返します。 'o' が整数でないとき
     の、 Python 式 ‘bytes(o)’ と同じです。 ‘bytes(o)’ と違って、 'o' が
     整数のときには、ゼロで初期化された bytes オブジェクトを返すのではな
     く TypeError が送出されます。

     If argument is ‘NULL’, return the *note bytes: 1d2. object
     ‘b'<NULL>'’.

 -- C の関数: int PyObject_IsSubclass (PyObject *derived, PyObject *cls)
     ' 次に属します: *note Stable ABI: 961.'  クラス 'derived' がクラス
     'cls' と同一であるか、そこから派生したクラスである場合は ‘1’ を返し
     、そうでない場合は ‘0’ を返します。 エラーが起きた場合は ‘-1’ を返
     します。

     'cls' がタプルの場合、 'cls' の全ての要素に対してチェックします。 少
     なくとも1つのチェックで ‘1’ が返ったとき、結果は ‘1’ となり、それ以
     外のとき ‘0’ になります。

     If 'cls' has a *note __subclasscheck__(): 25dc. 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__:
     2588.

     Normally only class objects, i.e.  instances of *note type: 191. or
     a derived class, are considered classes.  However, objects can
     override this by having a *note __bases__: 1864. attribute (which
     must be a tuple of base classes).

 -- C の関数: int PyObject_IsInstance (PyObject *inst, PyObject *cls)
     ' 次に属します: *note Stable ABI: 961.'  'inst' がクラス 'cls' もし
     くは 'cls' の子クラスのインスタンスである場合に ‘1’ を返し、そうで
     ない場合に ‘0’ を返します。 エラーが起きると ‘-1’ を返し例外を設定
     します。

     'cls' がタプルの場合、 'cls' の全ての要素に対してチェックします。 少
     なくとも1つのチェックで ‘1’ が返ったとき、結果は ‘1’ となり、それ以
     外のとき ‘0’ になります。

     If 'cls' has a *note __instancecheck__(): 25db. 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__: 1865. attribute.

     An object 'cls' can override if it is considered a class, and what
     its base classes are, by having a *note __bases__: 1864. attribute
     (which must be a tuple of base classes).

 -- C の関数: *note Py_hash_t: 161d. PyObject_Hash (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'

     オブジェクト 'o' のハッシュ値を計算して返します。失敗すると ‘-1’ を
     返します。 Python の式 ‘hash(o)’ と同じです。

     バージョン 3.2 で変更: 返り値の型が Py_hash_t になりました。この型
     は、 *note Py_ssize_t: e28. と同じサイズをもつ符号付き整数です。

 -- C の関数: *note Py_hash_t: 161d. PyObject_HashNotImplemented
          (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'  Set a *note TypeError:
     29c. indicating that ‘type(o)’ is not *note hashable: 18e. 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: 961.'  'o' が真を表すとみなせる場
     合には ‘1’ を、そうでないときには ‘0’ を返します。 Python の式 ‘not
     not o’ と同じです。失敗すると ‘-1’ を返します。

 -- C の関数: int PyObject_Not (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'  'o' が真を表すとみなせる場
     合には ‘0’ を、そうでないときには ‘1’ を返します。 Python の式 ‘not
     o’ と同じです。失敗すると ‘-1’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyObject_Type (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     When 'o' is non-‘NULL’, returns a type object corresponding to the
     object type of object 'o'.  On failure, raises *note SystemError:
     3f1. and returns ‘NULL’.  This is equivalent to the Python
     expression ‘type(o)’.  This function creates a new *note strong
     reference: 7e0. to the return value.  There's really no reason to
     use this function instead of the *note Py_TYPE(): 5fc. function,
     which returns a pointer of type *note PyTypeObject: e6f.*, 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: e28. PyObject_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: e28. PyObject_Length (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'

     'o' の長さを返します。ただしオブジェクト 'o' がシーケンス型プロトコ
     ルとマップ型プロトコルの両方を提供している場合、シーケンスとしての
     長さを返します。エラーが生じると ‘-1’ を返します。 Python の式
     ‘len(o)’ と同じです。

 -- C の関数: *note Py_ssize_t: e28. PyObject_LengthHint (PyObject *o,
          Py_ssize_t defaultvalue)

     オブジェクト 'o' の概算の長さを返します。 最初に実際の長さを、次に
     *note __length_hint__(): 12c0. を使って概算の長さを、そして最後にデ
     フォルトの値を返そうとします。 この関数は Python の式
     ‘operator.length_hint(o, defaultvalue)’ と同じです。

     Added in version 3.4.

 -- C の関数: *note PyObject: 1a6. *PyObject_GetItem (PyObject *o,
          PyObject *key)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  オブ
     ジェクト 'key' に対応する 'o' の要素を返します。失敗すると ‘NULL’ を
     返します。Python の式 ‘o[key]’ と同じです。

 -- C の関数: int PyObject_SetItem (PyObject *o, PyObject *key, PyObject
          *v)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクト 'key' を値
     'v' に対応付けます。 失敗すると、例外を送出し ‘-1’ を返します。成功
     すると ‘0’ を返します。 これは Python の文 ‘o[key] = v’ と同等です
     。 この関数は 'v' への参照を '盗み取りません' 。

 -- C の関数: int PyObject_DelItem (PyObject *o, PyObject *key)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクト 'o' から
     'key' に関する対応付けを削除します。失敗すると ‘-1’ を返します。
     Python の文 ‘del o[key]’ と同じです。

 -- C の関数: int PyObject_DelItemString (PyObject *o, const char *key)
     ' 次に属します: *note Stable ABI: 961.'  This is the same as *note
     PyObject_DelItem(): 53d1, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 1a6.*.

 -- C の関数: *note PyObject: 1a6. *PyObject_Dir (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  この
     関数は Python の式 ‘dir(o)’ と同じで、オブジェクトの変数名に割り当
     てている文字列からなるリスト (空の場合もあります) を返します。エラ
     ーの場合には ‘NULL’ を返します。引数を ‘NULL’ にすると、Python にお
     ける ‘dir()’ と同様に、現在のローカルな名前を返します; この場合、ア
     クティブな実行フレームがなければ ‘NULL’ を返しますが、 *note
     PyErr_Occurred(): 1ec4. は偽を返します。

 -- C の関数: *note PyObject: 1a6. *PyObject_GetIter (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Python の式 ‘iter(o)’ と同じです。引数にとったオブジェクトに対する
     新たなイテレータか、オブジェクトがすでにイテレータの場合にはオブジ
     ェクト自身を返します。オブジェクトが反復処理不可能であった場合には
     *note TypeError: 29c. を送出して ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyObject_SelfIter (PyObject *obj)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  This
     is equivalent to the Python ‘__iter__(self): return self’ method.
     It is intended for *note iterator: 6d4. types, to be used in the
     *note PyTypeObject.tp_iter: 18a7. slot.

 -- C の関数: *note PyObject: 1a6. *PyObject_GetAIter (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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: 29c. 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: 961. (バージョン 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: 1a4.
     Python does not check this.

     On error, set an exception and return ‘NULL’.

     Added in version 3.12.

 -- C の関数: *note Py_ssize_t: e28. PyType_GetTypeDataSize
          (PyTypeObject *cls)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     Return the size of the instance memory space reserved for 'cls',
     i.e.  the size of the memory *note PyObject_GetTypeData(): 1a5.
     returns.

     This may be larger than requested using *note
     -PyType_Spec.basicsize: 1a4.; 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: 1a4.  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: 95b.

     On error, set an exception and return ‘NULL’.  *note TypeError:
     29c. is raised if 'o' does not have *note Py_TPFLAGS_ITEMS_AT_END:
     95b. 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: 3a4. 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: 3a4. flag set.

     Added in version 3.13.

 -- C の関数: int PyUnstable_Object_EnableDeferredRefcount (PyObject
          *obj)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Enable deferred reference counting(3) on 'obj', if supported by the
     runtime.  In the *note free-threaded: 48e. 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: 418.
     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(): 16c7. and *note
     PyObject_GC_IsTracked(): d42.).

     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:
     986. slot.

     Added in version 3.14.

 -- C の関数: int PyUnstable_Object_IsUniqueReferencedTemporary
          (PyObject *obj)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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: 60a. 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(): 552.

     Added in version 3.14.

 -- C の関数: int PyUnstable_IsImmortal (PyObject *obj)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     This function returns non-zero if 'obj' is *note immortal: 3a0, 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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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(): 1b0a. must have been called
     earlier on 'obj' or this function may spuriously return ‘0’ in the
     *note free-threaded build: 1a3.

     This function is logically equivalent to the following C code,
     except that it behaves atomically in the *note free-threaded build:
     1a3.:

          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: 5600.

     Typically, correct use of this function requires support from
     'obj"s deallocator (*note tp_dealloc: 51e2.).  For example, the
     following sketch could be adapted to implement a "weakmap" that
     works like a *note WeakValueDictionary: 1b64. 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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Enables subsequent uses of *note PyUnstable_TryIncRef(): 1b09. on
     'obj'.  The caller must hold a *note strong reference: 7e0. to
     'obj' when calling this.

     Added in version 3.14.

 -- C の関数: int PyUnstable_Object_IsUniquelyReferenced (PyObject *op)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Determine if 'op' only has one reference.

     On GIL-enabled builds, this function is equivalent to *note
     Py_REFCNT: 552.(*note op: 5f9.) == 1.

     On a *note free-threaded build: 1a3, this checks if 'op"s *note
     reference count: 2d0. is equal to one and additionally checks if
     'op' is only used by this thread.  *note Py_REFCNT: 552.(*note op:
     5f9.) == 1 is 'not' thread-safe on free-threaded builds; prefer
     this function.

     The caller must hold an *note attached thread state: 1ac, despite
     the fact that this function doesn't call into the Python
     interpreter.  This function cannot fail.

     Added in version 3.14.

 -- C の関数: int PyUnstable_SetImmortal (PyObject *op)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Marks the object 'op' *note immortal: 3a0.  The argument should be
     uniquely referenced by the calling thread.  This is intended to be
     used for reducing reference counting contention in the *note
     free-threaded build: 1a3. for objects which are shared across
     threads.

     This is a one-way process: objects can only be made immortal; they
     cannot be made mortal once again.  Immortal objects do not
     participate in reference counting and will never be garbage
     collected.  If the object is GC-tracked, it is untracked.

     This function is intended to be used soon after 'op' is created, by
     the code that creates it, such as in the object's *note tp_new:
     986. slot.  Returns 1 if the object was made immortal and returns 0
     if it was not.  This function cannot fail.

     Added in version 3.15.

   ---------- 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.9.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.9.2.1 The 'tp_call' Protocol
..............................

Instances of classes that set *note tp_call: 967. 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: 986. and
*note tp_init: 988. also pass arguments this way.

To call an object, use *note PyObject_Call(): 835. or another *note call
API: 5605.


File: python.info,  Node: The Vectorcall Protocol,  Next: Object Calling API,  Prev: The tp_call Protocol,  Up: Call プロトコル

7.9.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(): 835.).  Therefore, a class supporting
vectorcall must also implement *note tp_call: 967.  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(): 964.  This bears repeating:

     警告: A class supporting vectorcall 'must' also implement *note
     tp_call: 967. with the same semantics.

バージョン 3.12 で変更: The *note Py_TPFLAGS_HAVE_VECTORCALL: 962. flag
is now removed from a class when the class's *note __call__(): 966.
method is reassigned.  (This internally sets *note tp_call: 967. only,
and thus may make it behave differently than the vectorcall function.)
In earlier Python versions, vectorcall should only be used with *note
immutable: 602. 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: 962. flag and setting *note
tp_vectorcall_offset: 5607. 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: 1a6. *(*vectorcallfunc)(*note
          PyObject: 1a6. *callable, *note PyObject: 1a6. *const *args,
          size_t nargsf, *note PyObject: 1a6. *kwnames)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 96a. flag.  To get the
          actual number of positional arguments from 'nargsf', use *note
          PyVectorcall_NARGS(): 963.

   - 
     '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: 961. (バージョン 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(): 969, 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:
     96a.  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:
5605. function as with any other callable.  *note PyObject_Vectorcall():
968. 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.9.2.3 再帰の管理
..................

When using 'tp_call', callees do not need to worry about *note
recursion: 5558.: CPython uses *note Py_EnterRecursiveCall(): 605. and
*note Py_LeaveRecursiveCall(): d40. 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.9.2.4 Vectorcall Support API
..............................

 -- C の関数: *note Py_ssize_t: e28. PyVectorcall_NARGS (size_t nargsf)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 965. 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: 1a6. *PyVectorcall_Call (PyObject
          *callable, PyObject *tuple, PyObject *dict)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     Call 'callable"s *note vectorcallfunc: 965. 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: 967. slot or be used in an implementation of ‘tp_call’.
     It does not check the *note Py_TPFLAGS_HAVE_VECTORCALL: 962. 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.9.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(): 835.                    ‘PyObject *’           tuple                    dict/‘NULL’
                                                                                               
                                                                                               
*note PyObject_CallNoArgs(): 834.              ‘PyObject *’           --                       --
                                                                                               
                                                                                               
*note PyObject_CallOneArg(): d44.              ‘PyObject *’           1 object                 --
                                                                                               
                                                                                               
*note PyObject_CallObject(): 51d1.             ‘PyObject *’           tuple/‘NULL’             --
                                                                                               
                                                                                               
*note PyObject_CallFunction(): 837.            ‘PyObject *’           format                   --
                                                                                               
                                                                                               
*note PyObject_CallMethod(): 3be.              obj + ‘char*’          format                   --
                                                                                               
                                                                                               
*note PyObject_CallFunctionObjArgs(): 53d0.    ‘PyObject *’           variadic                 --
                                                                                               
                                                                                               
*note PyObject_CallMethodObjArgs(): 1fed.      obj + name             variadic                 --
                                                                                               
                                                                                               
*note PyObject_CallMethodNoArgs(): 560c.       obj + name             --                       --
                                                                                               
                                                                                               
*note PyObject_CallMethodOneArg(): 560d.       obj + name             1 object                 --
                                                                                               
                                                                                               
*note PyObject_Vectorcall(): 968.              ‘PyObject *’           vectorcall               vectorcall
                                                                                               
                                                                                               
*note PyObject_VectorcallDict(): 560e.         ‘PyObject *’           vectorcall               dict/‘NULL’
                                                                                               
                                                                                               
*note PyObject_VectorcallMethod(): 969.        arg + name             vectorcall               vectorcall
                                                                                               

 -- C の関数: *note PyObject: 1a6. *PyObject_Call (PyObject *callable,
          PyObject *args, PyObject *kwargs)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  呼び
     出し可能な Python のオブジェクト 'callable' を、タプル 'args' とし
     て与えられる引数と辞書 'kwargs' として与えられる名前付き引数ととも
     に呼び出します。

     'args' は 'NULL' であってはならず、引数を必要としない場合は空のタプ
     ルを使ってください。 'kwargs' は 'NULL' でも構いません。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(*args, **kwargs)’ 。

 -- C の関数: *note PyObject: 1a6. *PyObject_CallNoArgs (PyObject
          *callable)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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: 1a6. *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: 1a6. *PyObject_CallObject (PyObject
          *callable, PyObject *args)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  呼び
     出し可能な Python のオブジェクト 'callable' を、タプル 'args' とし
     て与えられる引数とともに呼び出します。 引数が必要な場合は、 'args'
     は 'NULL' で構いません。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(*args)’ 。

 -- C の関数: *note PyObject: 1a6. *PyObject_CallFunction (PyObject
          *callable, const char *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  呼び
     出し可能な Python オブジェクト 'callable' を可変数個の C 引数ととも
     に呼び出します。 C 引数は *note Py_BuildValue(): 5f5. 形式のフォー
     マット文字列を使って記述します。 'format' は 'NULL' かもしれず、与
     える引数がないことを表します。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(*args)’ 。

     *note PyObject: 1a6.* args だけを引数に渡す場合は、 *note
     PyObject_CallFunctionObjArgs(): 53d0. がより速い方法であることを覚
     えておいてください。

     バージョン 3.4 で変更: 'format' の型が ‘char *’ から変更されました
     。

 -- C の関数: *note PyObject: 1a6. *PyObject_CallMethod (PyObject *obj,
          const char *name, const char *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  オブ
     ジェクト 'obj' の 'name' という名前のメソッドを、いくつかの C 引数
     とともに呼び出します。 C 引数はタプルを生成する *note
     Py_BuildValue(): 5f5. 形式のフォーマット文字列で記述されています。

     'format' は 'NULL' でもよく、引数が与えられないことを表します。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘obj.name(arg1, arg2, ...)’ 。

     *note PyObject: 1a6.* args だけを引数に渡す場合は、 *note
     PyObject_CallMethodObjArgs(): 1fed. がより速い方法であることを覚え
     ておいてください。

     バージョン 3.4 で変更: 'name' と 'format' の型が ‘char *’ から変更
     されました。

 -- C の関数: *note PyObject: 1a6. *PyObject_CallFunctionObjArgs
          (PyObject *callable, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  呼び
     出し可能な Python オブジェクト 'callable' を可変数個の *note
     PyObject: 1a6.* 引数とともに呼び出します。引数列は末尾に 'NULL' が
     ついた可変数個のパラメタとして与えます。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(arg1, arg2, ...)’ 。

 -- C の関数: *note PyObject: 1a6. *PyObject_CallMethodObjArgs (PyObject
          *obj, PyObject *name, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Python オブジェクト 'obj' のメソッドを呼び出します、メソッド名は
     Python 文字列オブジェクト 'name' で与えます。可変数個の *note
     PyObject: 1a6.* 引数と共に呼び出されます.  引数列は末尾に 'NULL' が
     ついた可変数個のパラメタとして与えます。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

 -- C の関数: *note PyObject: 1a6. *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: 1a6. *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: 1a6. *PyObject_Vectorcall (PyObject
          *callable, PyObject *const *args, size_t nargsf, PyObject
          *kwnames)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     Call a callable Python object 'callable'.  The arguments are the
     same as for *note vectorcallfunc: 965.  If 'callable' supports
     *note vectorcall: 960, 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: 1b2.

 -- C の関数: *note PyObject: 1a6. *PyObject_VectorcallDict (PyObject
          *callable, PyObject *const *args, size_t nargsf, PyObject
          *kwdict)

     Call 'callable' with positional arguments passed exactly as in the
     *note vectorcall: 960. 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: 1a6. *PyObject_VectorcallMethod (PyObject
          *name, PyObject *const *args, size_t nargsf, PyObject
          *kwnames)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 96a. if the value of ‘args[0]’ may
     temporarily be changed.  Keyword arguments can be passed just like
     in *note PyObject_Vectorcall(): 968.

     If the object has the *note Py_TPFLAGS_METHOD_DESCRIPTOR: 548b.
     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.9.2.6 Call Support API
........................

 -- C の関数: int PyCallable_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクト 'o' が呼び出
     し可能オブジェクトかどうか調べます。オブジェクトが呼び出し可能であ
     るときに ‘1’ を返し、そうでないときには ‘0’ を返します。この関数呼
     び出しは常に成功します。


File: python.info,  Node: 数値型プロトコル number protocol,  Next: シーケンス型プロトコル sequence protocol,  Prev: Call プロトコル,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.9.3 数値型プロトコル (number protocol)
----------------------------------------

 -- C の関数: int PyNumber_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクト 'o' が数値型
     プロトコルを提供している場合に ‘1’ を返し、そうでないときには偽を返
     します。この関数呼び出しは常に成功します。

     バージョン 3.8 で変更: 'o' がインデックス整数だった場合、 ‘1’ を返
     します。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Add (PyObject *o1, PyObject
          *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' を加算した結果を返し、失敗すると ‘NULL’ を返し
     ます。Python の式 ‘o1 + o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Subtract (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' から 'o2' を減算した結果を返し、失敗すると ‘NULL’ を返
     します。Python の式 ‘o1 - o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Multiply (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' を乗算した結果を返し、失敗すると ‘NULL’ を返し
     ます。Python の式 ‘o1 * o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_MatrixMultiply (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  成功すると 'o1' と 'o2' を行列乗算した結果を返
     し、失敗すると ‘NULL’ を返します。 Python の式 ‘o1 @ o2’ と同じです
     。

     Added in version 3.5.

 -- C の関数: *note PyObject: 1a6. *PyNumber_FloorDivide (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyNumber_TrueDivide (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyNumber_Remainder (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' を 'o2' で除算した剰余を返し、失敗すると ‘NULL’ を返し
     ます。Python の式 ‘o1 % o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Divmod (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     組み込み関数 *note divmod(): d6e. を参照してください。失敗すると
     ‘NULL’ を返します。 Python の式 ‘divmod(o1, o2)’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Power (PyObject *o1,
          PyObject *o2, PyObject *o3)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     組み込み関数 *note pow(): 448. を参照してください。失敗すると
     ‘NULL’ を返します。 Python の式 ‘pow(o1, o2, o3)’ と同じです。 'o3'
     はオプションです。 'o3' を無視させたいなら、 *note Py_None: 5615. を
     入れてください ('o3' に ‘NULL’ を渡すと、不正なメモリアクセスを引き
     起こすことがあります)。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Negative (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o' の符号反転を返し、失敗すると ‘NULL’ を返します。Python の
     式 ‘-o’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Positive (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o' を返し、失敗すると ‘NULL’ を返します。Python の式 ‘+o’ と
     同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Absolute (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     成功すると 'o' の絶対値を返し、失敗すると ‘NULL’ を返します。Python
     の式 ‘abs(o)’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Invert (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o' のビット単位反転 (bitwise negation) を返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘~o’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Lshift (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' を 'o2' だけ左シフトした結果を返し、失敗すると ‘NULL’ を
     返します。Python の式 ‘o1 << o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Rshift (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' を 'o2' だけ右シフトした結果を返し、失敗すると ‘NULL’ を
     返します。Python の式 ‘o1 >> o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_And (PyObject *o1, PyObject
          *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' の "ビット単位論理積 (bitwise and)" を返し、失
     敗すると ‘NULL’ を返します。Python の式 ‘o1 & o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Xor (PyObject *o1, PyObject
          *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' の "ビット単位排他的論理和 (bitwise exclusive
     or)" を返し、失敗すると ‘NULL’ を返します。Python の式 ‘o1 ^ o2’ と
     同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Or (PyObject *o1, PyObject
          *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' の "ビット単位論理和 (bitwise or)" を返し失敗す
     ると ‘NULL’ を返します。Python の式 ‘o1 | o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceAdd (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' を加算した結果を返し、失敗すると ‘NULL’ を返し
     ます。'o1' が 'in-place' 演算をサポートする場合、in-place 演算を行
     います。Python の文 ‘o1 += o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceSubtract (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' から 'o2' を減算した結果を返し、失敗すると ‘NULL’ を返
     します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算を
     行います。Python の文 ‘o1 -= o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceMultiply (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' を乗算した結果を返し、失敗すると ‘NULL’ を返し
     ます。'o1' が 'in-place' 演算をサポートする場合、in-place 演算を行
     います。Python の文 ‘o1 *= o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceMatrixMultiply
          (PyObject *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  成功すると 'o1' と 'o2' を行列乗算した結果を返
     し、失敗すると ‘NULL’ を返します。 'o1' が 'in-place' 演算をサポー
     トする場合、 in-place 演算を行います。 Python の文 ‘o1 @= o2’ と同
     じです。

     Added in version 3.5.

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceFloorDivide
          (PyObject *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' を 'o2' で除算した切捨て値を返し、失敗すると ‘NULL’ を
     返します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算
     を行います。Python の文 ‘o1 //= o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceTrueDivide (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyNumber_InPlaceRemainder (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' を 'o2' で除算した剰余を返し、, 失敗すると ‘NULL’ を返
     します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算を
     行います。Python の文 ‘o1 %= o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlacePower (PyObject *o1,
          PyObject *o2, PyObject *o3)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     組み込み関数 *note pow(): 448. を参照してください。失敗すると
     ‘NULL’ を返します。 'o1' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。この関数は 'o3' が *note Py_None: 5615. の
     場合は Python 文 ‘o1 **= o2’ と同じで、それ以外の場合は ‘pow(o1,
     o2, o3)’ の in-place 版です。 'o3' を無視させたいなら、 ‘Py_None’ を
     入れてください ('o3' に ‘NULL’ を渡すと、不正なメモリアクセスを引き
     起こすことがあります)。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceLshift (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' を 'o2' だけ左シフトした結果を返し、失敗すると ‘NULL’ を
     返します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算
     を行います。Python の文 ‘o1 <<= o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceRshift (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' を 'o2' だけ右シフトした結果を返し、失敗すると ‘NULL’ を
     返します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算
     を行います。Python の文 ‘o1 >>= o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceAnd (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' の "ビット単位論理積 (bitwise and)" を返し、失
     敗すると ‘NULL’ を返します。'o1' が 'in-place' 演算をサポートする場
     合、in-place 演算を行います。Python の文 ‘o1 &= o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceXor (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' の "ビット単位排他的論理和 (bitwise exclusive
     or)" を返し、失敗すると ‘NULL’ を返します。'o1' が 'in-place' 演算
     をサポートする場合、in-place 演算を行います。Python の文 ‘o1 ^= o2’
     と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_InPlaceOr (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' の "ビット単位論理和 (bitwise or)" を返し失敗す
     ると ‘NULL’ を返します。'o1' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。Python の文 ‘o1 |= o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Long (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     成功すると 'o' を整数に変換したものを返し、失敗すると ‘NULL’ を返し
     ます。Python の式 ‘int(o)’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Float (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     成功すると 'o' を浮動小数点数に変換したものを返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘float(o)’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyNumber_Index (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  'o'
     をPythonのint型に変換し、成功したらその値を返します。失敗したら
     ‘NULL’ が返され、 *note TypeError: 29c. 例外が送出されます。

     バージョン 3.10 で変更: 結果は常に厳密な *note int: 32e. 型です。 以
     前は、結果は ‘int’ のサブクラスのインスタンスのこともありました。

 -- C の関数: *note PyObject: 1a6. *PyNumber_ToBase (PyObject *n, int
          base)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     'base' 進数に変換された整数 'n' を文字列として返します。 'base' 引
     数は2, 8, 10または16のいずれかでなければなりません。 基数2、8、16に
     ついて、返される文字列の先頭には基数マーカー ‘'0b'’ 、 ‘'0o'’ また
     は ‘'0x'’ が、それぞれ付与されます。 もし 'n' が Python のint型でな
     ければ、まず *note PyNumber_Index(): c6d. で変換されます。

 -- C の関数: *note Py_ssize_t: e28. PyNumber_AsSsize_t (PyObject *o,
          PyObject *exc)
     ' 次に属します: *note Stable ABI: 961.'  'o' を整数として解釈可能だ
     った場合、*note Py_ssize_t: e28. 型の値に変換して返します。呼び出し
     が失敗したら、例外が送出され、 ‘-1’ が返されます。

     もし 'o' がPythonのintに変換できたのに、*note Py_ssize_t: e28. への
     変換が *note OverflowError: c5b. になる場合は、 'exc' 引数で渡され
     た型 (普通は *note IndexError: 18ed. か ‘OverflowError’) の例外を送
     出します。もし、 'exc' が ‘NULL’ なら、例外はクリアされて、値が負の
     場合は ‘PY_SSIZE_T_MIN’ へ、正の場合は ‘PY_SSIZE_T_MAX’ へと制限さ
     れます。

 -- C の関数: int PyIndex_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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.9.4 シーケンス型プロトコル (sequence protocol)
------------------------------------------------

 -- C の関数: int PySequence_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'  Return ‘1’ if the object
     provides the sequence protocol, and ‘0’ otherwise.  Note that it
     returns ‘1’ for Python classes with a *note __getitem__(): 78d.
     method, unless they are *note dict: 193. 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: e28. PySequence_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: e28. PySequence_Length (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'

     成功するとシーケンス 'o' 中のオブジェクトの数を返し、失敗すると
     ‘-1’ を返します。これは、Python の式 ‘len(o)’ と同じになります。

 -- C の関数: *note PyObject: 1a6. *PySequence_Concat (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' の連結 (concatenation) を返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘o1 + o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PySequence_Repeat (PyObject *o,
          Py_ssize_t count)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     するとオブジェクト 'o' の 'count' 回繰り返しを返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘o * count’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PySequence_InPlaceConcat (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o1' と 'o2' の連結 (concatenation) を返し、失敗すると
     ‘NULL’ を返します。'o1' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。Python の式 ‘o1 += o2’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PySequence_InPlaceRepeat (PyObject
          *o, Py_ssize_t count)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     するとオブジェクト 'o' の 'count' 回繰り返しを返し、失敗すると
     ‘NULL’ を返します。'o' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。Python の式 ‘o *= count’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PySequence_GetItem (PyObject *o,
          Py_ssize_t i)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o' の 'i' 番目の要素を返し、失敗すると ‘NULL’ を返します。
     Python の式 ‘o[i]’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PySequence_GetSlice (PyObject *o,
          Py_ssize_t i1, Py_ssize_t i2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     すると 'o' の 'i1' から 'i2' までの間のスライスを返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘o[i1:i2]’ と同じです。

 -- C の関数: int PySequence_SetItem (PyObject *o, Py_ssize_t i,
          PyObject *v)
     ' 次に属します: *note Stable ABI: 961.'  'o' の 'i' 番目の要素に
     'v' を代入します。 失敗すると、例外を送出し ‘-1’ を返します; 成功す
     ると ‘0’ を返します。 これは Python の文 ‘o[i] = v’ と同じです。 こ
     の関数は 'v' への参照を '盗み取りません' 。

     'v' が ‘NULL’ の場合はその要素が削除されますが、この機能は非推奨で
     あり、 *note PyObject_DelAttr(): 1a8d. を使うのが望ましいです。

 -- C の関数: int PySequence_DelItem (PyObject *o, Py_ssize_t i)
     ' 次に属します: *note Stable ABI: 961.'  '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: 961.'  '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: 961.'  シーケンスオブジェクト 'o'
     の 'i1' から 'i2' までの間のスライスを削除します。失敗すると ‘-1’ を
     返します。Python の文 ‘del o[i1:i2]’ と同じです。

 -- C の関数: *note Py_ssize_t: e28. PySequence_Count (PyObject *o,
          PyObject *value)
     ' 次に属します: *note Stable ABI: 961.'  'o' における 'value' の出
     現回数、すなわち ‘o[key] == value’ となる 'key' の個数を返します。
     失敗すると ‘-1’ を返します。Python の式 ‘o.count(value)’ と同じです
     。

 -- C の関数: int PySequence_Contains (PyObject *o, PyObject *value)
     ' 次に属します: *note Stable ABI: 961.'  'o' に 'value' が入ってい
     るか判定します。'o' のある要素が 'value' と等価 (equal) ならば ‘1’
     を返し、それ以外の場合には ‘0’ を返します。エラーが発生すると ‘-1’
     を返します。Python の式 ‘value in o’ と同じです。

 -- C の関数: int PySequence_In (PyObject *o, PyObject *value)
     ' 次に属します: *note Stable ABI: 961.'  Alias for *note
     PySequence_Contains(): 60c.

     *note Soft deprecated: 1b2. since version 3.14: The function should
     no longer be used to write new code.

 -- C の関数: *note Py_ssize_t: e28. PySequence_Index (PyObject *o,
          PyObject *value)
     ' 次に属します: *note Stable ABI: 961.'  ‘o[i] == value’ となる最初
     に見つかったインデクス 'i' を返します。エラーが発生すると ‘-1’ を返
     します。Python の式 ‘o.index(value)’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PySequence_List (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  シー
     ケンスもしくはイテラブル 'o' と同じ内容を持つリストオブジェクトを返
     します。 失敗したら ‘NULL’ を返します。 返されるリストは新しく作ら
     れたことが保証されています。 これは Python の式 ‘list(o)’ と同等で
     す。

 -- C の関数: *note PyObject: 1a6. *PySequence_Tuple (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     シーケンスあるいはイテラブルである 'o' と同じ内容を持つタプルオブジ
     ェクトを返します。 失敗したら ‘NULL’ を返します。'o' がタプルの場合
     、新たな参照を返します。 それ以外の場合、適切な内容が入ったタプルを
     構築して返します。 Pythonの式 ‘tuple(o)’ と同等です。

 -- C の関数: *note PyObject: 1a6. *PySequence_Fast (PyObject *o, const
          char *m)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  シー
     ケンスまたはイテラブルの 'o' を ‘PySequence_Fast*’ ファミリの関数で
     利用できるオブジェクトとして返します。オブジェクトがシーケンスでも
     イテラブルでもない場合は、メッセージ 'm' を持つ、 *note TypeError:
     29c. を送出します。失敗したら ‘NULL’ を返します。

     ‘PySequence_Fast*’ ファミリの関数は、'o' が *note PyTupleObject:
     558f. または *note PyListObject: 2941. と仮定し、'o' のデータフィー
     ルドに直接アクセスするため、そのように名付けられています。

     CPythonの実装では、もし 'o' が 既にシーケンスかタプルであれば、'o'
     そのものを返します。

 -- C の関数: *note Py_ssize_t: e28. PySequence_Fast_GET_SIZE (PyObject
          *o)

     'o' が ‘NULL’ でなく、 *note PySequence_Fast(): 1ae5. が返したオブ
     ジェクトであると仮定して、 'o' の長さを返します。 'o' のサイズは
     *note PySequence_Size(): 203f. を呼び出しても得られますが、 *note
     PySequence_Fast_GET_SIZE(): 5fd. の方が 'o' をリストかタプルである
     と仮定して処理するため、より高速です。

 -- C の関数: *note PyObject: 1a6. *PySequence_Fast_GET_ITEM (PyObject
          *o, Py_ssize_t i)
     '戻り値: 借用参照。' 'o' が ‘NULL’ でなく、 *note
     PySequence_Fast(): 1ae5. が返したオブジェクトであり、かつ 'i' がイ
     ンデクスの範囲内にあると仮定して、 'o' の 'i' 番目の要素を返します
     。

 -- C の関数: *note PyObject: 1a6. **PySequence_Fast_ITEMS (PyObject *o)

     PyObject ポインタの背後にあるアレイを返します。この関数では、 'o' は
     *note PySequence_Fast(): 1ae5. の返したオブジェクトであり、 ‘NULL’
     でないものと仮定しています。

     リストのサイズが変更されるとき、メモリ再確保が要素の配列を再配置す
     るかもしれないことに注意してください。そのため、シーケンスの変更が
     発生しないコンテキストでのみ背後にあるポインタを使ってください。

 -- C の関数: *note PyObject: 1a6. *PySequence_ITEM (PyObject *o,
          Py_ssize_t i)
     '戻り値: 新しい参照。' 'o' の 'i' 番目の要素を返し、失敗すると
     ‘NULL’ を返します。 *note PySequence_GetItem(): 2040. の高速版であ
     り、*note PySequence_Check(): 53e6. で 'o' が真を返すかどうかの検証
     や、負の添え字の調整を行いません。


File: python.info,  Node: マップ型プロトコル mapping protocol,  Next: イテレータプロトコル iterator protocol,  Prev: シーケンス型プロトコル sequence protocol,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.9.5 マップ型プロトコル (mapping protocol)
-------------------------------------------

*note PyObject_GetItem(): 7e8, *note PyObject_SetItem(): 526e, *note
PyObject_DelItem(): 53d1. も参照してください。

 -- C の関数: int PyMapping_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'  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__(): 78d. 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: e28. PyMapping_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: e28. PyMapping_Length (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.'

     成功するとオブジェクト 'o' 中のキーの数を返し、失敗すると ‘-1’ を返
     します。これは、Python の式 ‘len(o)’ と同じになります。

 -- C の関数: *note PyObject: 1a6. *PyMapping_GetItemString (PyObject
          *o, const char *key)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  This
     is the same as *note PyObject_GetItem(): 7e8, but 'key' is
     specified as a const char* UTF-8 encoded bytes string, rather than
     a *note PyObject: 1a6.*.

 -- C の関数: int PyMapping_GetOptionalItem (PyObject *obj, PyObject
          *key, PyObject **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Variant of *note PyObject_GetItem(): 7e8. which doesn't raise *note
     KeyError: 7e5. if the key is not found.

     If the key is found, return ‘1’ and set '*result' to a new *note
     strong reference: 7e0. to the corresponding value.  If the key is
     not found, return ‘0’ and set '*result' to ‘NULL’; the *note
     KeyError: 7e5. 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: 961. (バージョン 3.13 より).'
     This is the same as *note PyMapping_GetOptionalItem(): 7e6, but
     'key' is specified as a const char* UTF-8 encoded bytes string,
     rather than a *note PyObject: 1a6.*.

     Added in version 3.13.

 -- C の関数: int PyMapping_SetItemString (PyObject *o, const char *key,
          PyObject *v)
     ' 次に属します: *note Stable ABI: 961.'  This is the same as *note
     PyObject_SetItem(): 526e, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 1a6.*.

 -- C の関数: int PyMapping_DelItem (PyObject *o, PyObject *key)

     This is an alias of *note PyObject_DelItem(): 53d1.

 -- C の関数: int PyMapping_DelItemString (PyObject *o, const char *key)

     This is the same as *note PyObject_DelItem(): 53d1, but 'key' is
     specified as a const char* UTF-8 encoded bytes string, rather than
     a *note PyObject: 1a6.*.

 -- C の関数: int PyMapping_HasKeyWithError (PyObject *o, PyObject *key)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 961. (バージョン 3.13 より).'
     This is the same as *note PyMapping_HasKeyWithError(): 819, but
     'key' is specified as a const char* UTF-8 encoded bytes string,
     rather than a *note PyObject: 1a6.*.

     Added in version 3.13.

 -- C の関数: int PyMapping_HasKey (PyObject *o, PyObject *key)
     ' 次に属します: *note Stable ABI: 961.'  マップ型オブジェクトがキー
     'key' を持つ場合に ‘1’ を返し、そうでないときには ‘0’ を返します。
     これは、Python の式 ‘key in o’ と等価です。この関数呼び出しは常に成
     功します。

          注釈: Exceptions which occur when this calls the *note
          __getitem__(): 78d. method are silently ignored.  For proper
          error handling, use *note PyMapping_HasKeyWithError(): 819,
          *note PyMapping_GetOptionalItem(): 7e6. or *note
          PyObject_GetItem(): 7e8. instead.

 -- C の関数: int PyMapping_HasKeyString (PyObject *o, const char *key)
     ' 次に属します: *note Stable ABI: 961.'  This is the same as *note
     PyMapping_HasKey(): 81a, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 1a6.*.

          注釈: Exceptions that occur when this calls the *note
          __getitem__(): 78d. method or while creating the temporary
          *note str: 1ea. object are silently ignored.  For proper error
          handling, use *note PyMapping_HasKeyStringWithError(): 81b,
          *note PyMapping_GetOptionalItemString(): 7e7. or *note
          PyMapping_GetItemString(): 7e9. instead.

 -- C の関数: *note PyObject: 1a6. *PyMapping_Keys (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     するとオブジェクト 'o' のキーからなるリストを返します。 失敗すると
     ‘NULL’ を返します。

     バージョン 3.7 で変更: 以前は、関数はリストもしくはタプルを返してい
     ました。

 -- C の関数: *note PyObject: 1a6. *PyMapping_Values (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     するとオブジェクト 'o' の値からなるリストを返します。 失敗すると
     ‘NULL’ を返します。

     バージョン 3.7 で変更: 以前は、関数はリストもしくはタプルを返してい
     ました。

 -- C の関数: *note PyObject: 1a6. *PyMapping_Items (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  成功
     するとオブジェクト 'o' の要素からなるリストを返し、各要素はキーと値
     のペアが入ったタプルになっています。 失敗すると ‘NULL’ を返します。

     バージョン 3.7 で変更: 以前は、関数はリストもしくはタプルを返してい
     ました。


File: python.info,  Node: イテレータプロトコル iterator protocol,  Next: バッファプロトコル buffer Protocol,  Prev: マップ型プロトコル mapping protocol,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.9.6 イテレータプロトコル (iterator protocol)
----------------------------------------------

イテレータを扱うための固有の関数は二つあります。

 -- C の関数: int PyIter_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.8 より).'
     Return non-zero if the object 'o' can be safely passed to *note
     PyIter_NextItem(): 5cc. and ‘0’ otherwise.  This function always
     succeeds.

 -- C の関数: int PyAIter_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 961. (バージョン 3.14 より).'
     Return ‘1’ and set 'item' to a *note strong reference: 7e0. 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: 1a6. *PyIter_Next (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  This
     is an older version of ‘PyIter_NextItem()’, which is retained for
     backwards compatibility.  Prefer *note PyIter_NextItem(): 5cc.

     Return the next value from the iterator 'o'.  The object must be an
     iterator according to *note PyIter_Check(): 1ec7. (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(): c72.

     Added in version 3.10.

 -- C の関数: *note PySendResult: 5625. PyIter_Send (PyObject *iter,
          PyObject *arg, PyObject **presult)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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 an 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.9.7 バッファプロトコル (buffer Protocol)
------------------------------------------

Pythonで利用可能ないくつかのオブジェクトは、下層にあるメモリ配列または
'buffer' へのアクセスを提供します。このようなオブジェクトとして、組み込
みの *note bytes: 1d2. や *note bytearray: 1d1. 、 *note array.array:
6cb. のようないくつかの拡張型が挙げられます。サードバーティのライブラリ
は画像処理や数値解析のような特別な目的のために、それら自身の型を定義する
ことができます。

それぞれの型はそれ自身のセマンティクスを持ちますが、おそらく大きなメモリ
バッファからなるという共通の特徴を共有します。いくつかの状況では仲介する
コピーを行うことなく直接バッファにアクセスすることが望まれます。

Python provides such a facility at the C and Python level in the form of
the *note buffer protocol: 319.  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): 13f3.;
     for Python see *note Emulating buffer types: 2624.

   - 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: 1dd.

*note bytes: 1d2. や *note bytearray: 1d1. などのシンプルなオブジェクト
は、内部のバッファーをバイト列の形式で公開します。 バイト列以外の形式も
利用可能です。例えば、 *note array.array: 6cb. が公開する要素はマルチバ
イト値になることがあります。

bufferインターフェースの利用者の一例は、ファイルオブジェクトの *note
write(): 109d. メソッドです: bufferインターフェースを通して一連のバイト
列を提供できるどんなオブジェクトでもファイルに書き込むことができます。
‘write()’ は、その引数として渡されたオブジェクトの内部要素に対する読み出
し専用アクセスのみを必要としますが、 *note readinto(): 1ad8. のような他
のメソッドでは、その引数の内容に対する書き込みアクセスが必要です。
bufferインターフェースにより、オブジェクトは読み書き両方、読み出し専用バ
ッファへのアクセスを許可するかそれとも拒否するか選択することができます。

bufferインターフェースの利用者には、対象となるオブジェクトのバッファを得
る二つの方法があります:

   * 正しい引数で *note PyObject_GetBuffer(): 832. を呼び出す;

   * *note PyArg_ParseTuple(): 3b9. (またはその同族のひとつ) を ‘y*’ 、
     ‘w*’ または ‘s*’ *note format codes: 608. のいずれかとともに呼び出
     す。

どちらのケースでも、bufferが必要なくなった時に *note PyBuffer_Release():
833. を呼び出さなければなりません。これを怠ると、リソースリークのような
様々な問題につながる恐れがあります。

Added in version 3.12: The buffer protocol is now accessible in Python,
see *note Emulating buffer types: 2624. and *note memoryview: 1dd.

* Menu:

* buffer 構造体::
* バッファリクエストのタイプ::
* 複雑な配列::
* バッファ関連の関数::


File: python.info,  Node: buffer 構造体,  Next: バッファリクエストのタイプ,  Up: バッファプロトコル buffer Protocol

7.9.7.1 buffer 構造体
.....................

バッファ構造体（または単純に "buffers"）は別のオブジェクトのバイナリデー
タをPythonプログラマに提供するのに便利です。これはまた、ゼロコピースライ
シング機構としても使用できます。このメモリブロックを参照する機能を使うこ
とで、どんなデータでもとても簡単にPythonプログラマに提供することができま
す。メモリは、C 拡張の大きな配列定数かもしれませんし、オペレーティングシ
ステムライブラリに渡す前のメモリブロックかもしれませんし、構造化データを
ネイティブのインメモリ形式受け渡すのに使用されるかもしれません。

Pythonインタプリタによって提供される多くのデータ型とは異なり、バッファは
*note PyObject: 1a6. ポインタではなく、シンプルなC 構造体です。そのため
、作成とコピーが非常に簡単に行えます。バッファの一般的なラッパーが必要な
ときは、 *note memoryview: 562b. オブジェクトが作成されます。

エクスポートされるオブジェクトを書く方法の短い説明には、 *note Buffer
Object Structures: 13f3. を参照してください。バッファを取得するには、
*note PyObject_GetBuffer(): 832. を参照してください。

 -- C のデータ型: type Py_buffer
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む) (バ
     ージョン 3.11 より).'
      -- C のメンバ変数: void *buf

          バッファフィールドが表している論理構造の先頭を指すポインタ。 バ
          ッファを提供するオブジェクトの下層物理メモリブロック中のどの位
          置にもなりえます。 例えば *note strides: 562d. が負だと、この
          値はメモリブロックの末尾かもしれません。

          *note 連続: 13f9. 配列の場合この値はメモリブロックの先頭を指し
          ます。

      -- C のメンバ変数: *note PyObject: 1a6. *obj

          エクスポート対象オブジェクトへの新しい参照。この参照は消費者に
          よって所有され、自動的に解放されます（つまり、参照カウントが減
          少します）し、設定されます ‘NULL’ by *note PyBuffer_Release():
          833.  このフィールドは、標準のC-API関数の戻り値に相当します。

          *note PyMemoryView_FromBuffer(): b48. または *note
          PyBuffer_FillInfo(): b47. によってラップされた '一時的な' バッ
          ファである特別なケースでは、このフィールドは ‘NULL’ です。一般
          的に、エクスポートオブジェクトはこの方式を使用してはなりません
          。

      -- C のメンバ変数: *note Py_ssize_t: e28. len

          ‘product(shape) * itemsize’。contiguous配列では、下層のメモリ
          ブロックの長さになります。非contiguous 配列では、contiguous表
          現にコピーされた場合に論理構造がもつ長さです。

          ‘((char *)buf)[0]’ から ‘((char *)buf)[len-1]’ の範囲へのアク
          セスは、連続性 (contiguity) を保証するリクエストによって取得さ
          れたバッファに対してのみ許されます。 多くの場合に、そのような
          リクエストは *note PyBUF_SIMPLE: 52a5. または *note
          PyBUF_WRITABLE: 176e. です。

      -- C のメンバ変数: int readonly

          バッファが読み出し専用であるか示します。このフィールドは *note
          PyBUF_WRITABLE: 176e. フラグで制御できます。

      -- C のメンバ変数: *note Py_ssize_t: e28. itemsize

          要素一つ分のbyte単位のサイズ。 *note struct.calcsize(): 1fb9.
          を非 ‘NULL’ の *note format: 5632. 値に対して呼び出した結果と
          同じです。

          重要な例外: 消費者が *note PyBUF_FORMAT: 529d. フラグを設定す
          ることなくバッファを要求した場合、 ‘format’ は ‘NULL’ に設定さ
          れます。 しかし *note itemsize: 5631. は元のフォーマットに従っ
          た値を保持します。

          *note shape: 5633. が存在する場合、 ‘product(shape) * itemsize
          == len’ の等式が守られ、利用者は *note itemsize: 5631. を
          buffer を読むために利用できます。

          *note PyBUF_SIMPLE: 52a5. または *note PyBUF_WRITABLE: 176e. で
          要求した結果、 *note shape: 5633. が ‘NULL’ であれば、消費者は
          *note itemsize: 5631. を無視して ‘itemsize == 1’ と見なさなけ
          ればなりません。

      -- C のメンバ変数: char *format

          A 'NULL' terminated string in *note struct: de. module style
          syntax describing the contents of a single item.  If this is
          ‘NULL’, ‘"B"’ (unsigned bytes) is assumed.

          このフィールドは *note PyBUF_FORMAT: 529d. フラグによって制御
          されます。

      -- C のメンバ変数: int ndim

          The number of dimensions the memory represents as an
          n-dimensional array.  If it is ‘0’, *note buf: 562c. points to
          a single item representing a scalar.  In this case, *note
          shape: 5633, *note strides: 562d. and *note suboffsets: 5635.
          MUST be ‘NULL’.  The maximum number of dimensions is given by
          *note PyBUF_MAX_NDIM: 52a1.

      -- C のメンバ変数: *note Py_ssize_t: e28. *shape

          メモリ上のN次元配列の形を示す、長さが *note ndim: 5634. である
          *note Py_ssize_t: e28. の配列です。 ‘shape[0] * ... *
          shape[ndim-1] * itemsize’ は *note len: 562f. と等しくなければ
          なりません。

          shape の値は ‘shape[n] >= 0’ に制限されます。 ‘shape[n] == 0’
          の場合に特に注意が必要です。 詳細は *note complex arrays:
          5636. を参照してください。

          shepe (形状) 配列は利用者からは読み出し専用です。

      -- C のメンバ変数: *note Py_ssize_t: e28. *strides

          各次元において新しい値を得るためにスキップするバイト数を示す、
          長さ *note ndim: 5634. の *note Py_ssize_t: e28. の配列。

          ストライド値は、任意の整数を指定できます。規定の配列では、スト
          ライドは通常でいけば有効です。しかし利用者は、‘strides[n] <=
          0’ のケースを処理することができる必要があります。詳細について
          は *note complex arrays: 5636. を参照してください。

          消費者にとって、この strides 配列は読み出し専用です。

      -- C のメンバ変数: *note Py_ssize_t: e28. *suboffsets

          *note Py_ssize_t: e28. 型の要素を持つ長さ *note ndim: 5634. の
          配列。 ‘suboffsets[n] >= 0’ の場合は、 n 番目の次元に沿って保
          存されている値はポインタで、 suboffset 値は各ポインタの参照を
          解決した後に何バイト加えればいいかを示しています。 suboffset の
          値が負の数の場合は、ポインタの参照解決は不要 (連続したメモリブ
          ロック内に直接配置されいる) ということになります。

          全ての suboffset が負数の場合 (つまり参照解決が不要) な場合、
          このフィールドは ‘NULL’ (デフォルト値) でなければなりません。

          この種の配列表現は Python Imaging Library (PIL) で使われていま
          す。 このような配列で要素にアクセスする方法についてさらに詳し
          ことは *note complex arrays: 5636. を参照してください。

          消費者にとって、suboffsets 配列は読み出し専用です。

      -- C のメンバ変数: void *internal

          バッファを提供する側のオブジェクトが内部的に利用するための変数
          です。例えば、提供側はこの変数に整数型をキャストして、shape,
          strides, suboffsets といった配列をバッファを開放するときに同時
          に解放するべきかどうかを管理するフラグに使うことができるでしょ
          う。バッファを受け取る側は、この値を決して変更してはなりません
          。

Constants:

 -- C のマクロ: PyBUF_MAX_NDIM
     ' 次に属します: *note Stable ABI: 961. (バージョン 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.9.7.2 バッファリクエストのタイプ
..................................

バッファは通常、 *note PyObject_GetBuffer(): 832. を使うことで、エクスポ
ートするオブジェクトにバッファリクエストを送ることで得られます。メモリの
論理的な構造の複雑性は多岐にわたるため、消費者は 'flags' 引数を使って、
自身が扱えるバッファの種類を指定します。

*note Py_buffer: b3f. の全フィールドは、リクエストの種類によって曖昧さを
残さずに定義されます。

* Menu:

* リクエストに依存しないフィールド::
* readonly, format: readonly format.
* shape, strides, suboffsets: shape strides suboffsets.
* 隣接性のリクエスト::
* 複合リクエスト::


File: python.info,  Node: リクエストに依存しないフィールド,  Next: readonly format,  Up: バッファリクエストのタイプ

7.9.7.3 リクエストに依存しないフィールド
........................................

下記のフィールドは 'flags' の影響を受けずに、常に正しい値で設定されます
。: *note obj: 562e, *note buf: 562c, *note len: 562f, *note itemsize:
5631, *note ndim: 5634.


File: python.info,  Node: readonly format,  Next: shape strides suboffsets,  Prev: リクエストに依存しないフィールド,  Up: バッファリクエストのタイプ

7.9.7.4 readonly, format
........................

      -- C のマクロ: PyBUF_WRITABLE
          ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より
          ).'  Controls the *note readonly: 5630. 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: 52a5. | *note PyBUF_WRITABLE: 176e. can be used
          to request a simple writable buffer.

      -- C のマクロ: PyBUF_WRITEABLE

          This is an alias to *note PyBUF_WRITABLE: 176e.

          *note Soft deprecated: 1b2. since version 3.13.

      -- C のマクロ: PyBUF_FORMAT
          ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より
          ).'  *note format: 5632. フィールドを制御します。もしフラグが
          設定されていれば、このフィールドを正しく埋めなければなりません
          。フラグが設定されていなければ、このフィールドを ‘NULL’ に設定
          しなければなりません。

*note PyBUF_WRITABLE: 176e. は、次の節に出てくるどのフラグとも | を取っ
てかまいません。 *note PyBUF_SIMPLE: 52a5. は 0 と定義されているので、
‘PyBUF_WRITABLE’ は単純な書き込み可能なバッファを要求する単独のフラグと
して使えます。

*note PyBUF_FORMAT: 529d. must be |'d to any of the flags except *note
PyBUF_SIMPLE: 52a5, 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.9.7.5 shape, strides, suboffsets
..................................

このフラグは、以下で複雑性が大きい順に並べたメモリの論理的な構造を制御し
ます。個々のフラグは、それより下に記載されたフラグのすべてのビットを含む
ことに注意してください。

リクエスト                        shape       strides       suboffsets
                                                            
-----------------------------------------------------------------------------
                                                            
 -- C のマクロ: PyBUF_INDIRECT    yes         yes           必要な場合
     ' 次に属します:                                        
     *note Stable ABI: 961. (バ
     ージョン 3.11 より).'

 -- C のマクロ: PyBUF_STRIDES     yes         yes           NULL
     ' 次に属します:                                        
     *note Stable ABI: 961. (バ
     ージョン 3.11 より).'

 -- C のマクロ: PyBUF_ND          yes         NULL          NULL
     ' 次に属します:                                        
     *note Stable ABI: 961. (バ
     ージョン 3.11 より).'

 -- C のマクロ: PyBUF_SIMPLE      NULL        NULL          NULL
     ' 次に属します:                                        
     *note Stable ABI: 961. (バ
     ージョン 3.11 より).'


File: python.info,  Node: 隣接性のリクエスト,  Next: 複合リクエスト,  Prev: shape strides suboffsets,  Up: バッファリクエストのタイプ

7.9.7.6 隣接性のリクエスト
..........................

ストライドの情報があってもなくても、C または Fortran の *note 連続性:
13f9. が明確に要求される可能性があります。 ストライド情報なしに、バッフ
ァーは C と隣接している必要があります。

リクエスト                              shape       strides       suboffsets       contig
                                                                                   
------------------------------------------------------------------------------------------------
                                                                                   
 -- C のマクロ: PyBUF_C_CONTIGUOUS      yes         yes           NULL             C
     ' 次に属します:                                                               
     *note Stable ABI: 961. (バージョ
     ン 3.11 より).'

 -- C のマクロ: PyBUF_F_CONTIGUOUS      yes         yes           NULL             F
     ' 次に属します:                                                               
     *note Stable ABI: 961. (バージョ
     ン 3.11 より).'

 -- C のマクロ: PyBUF_ANY_CONTIGUOUS    yes         yes           NULL             C か F
     ' 次に属します:                                                               
     *note Stable ABI: 961. (バージョ
     ン 3.11 より).'

*note PyBUF_ND: 52a2.                   yes         NULL          NULL             C
                                                                                   


File: python.info,  Node: 複合リクエスト,  Prev: 隣接性のリクエスト,  Up: バッファリクエストのタイプ

7.9.7.7 複合リクエスト
......................

有り得る全てのリクエストの値は、前の節でのフラグの組み合わせで網羅的に定
義されています。 便利なように、バッファープロトコルでは頻繁に使用される
組み合わせを単一のフラグとして提供してます。

次のテーブルの 'U' は連続性が未定義であることを表します。 利用者は *note
PyBuffer_IsContiguous(): b45. を呼び出して連続性を判定する必要があるでし
ょう。

リクエスト                          shape       strides       suboffsets       contig       readonly       format
                                                                                                           
------------------------------------------------------------------------------------------------------------------------
                                                                                                           
 -- C のマクロ: PyBUF_FULL          yes         yes           必要な場合       U            0              yes
     ' 次に属します:                                                                                       
     *note Stable ABI: 961. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_FULL_RO       yes         yes           必要な場合       U            1 か 0         yes
     ' 次に属します:                                                                                       
     *note Stable ABI: 961. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_RECORDS       yes         yes           NULL             U            0              yes
     ' 次に属します:                                                                                       
     *note Stable ABI: 961. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_RECORDS_RO    yes         yes           NULL             U            1 か 0         yes
     ' 次に属します:                                                                                       
     *note Stable ABI: 961. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_STRIDED       yes         yes           NULL             U            0              NULL
     ' 次に属します:                                                                                       
     *note Stable ABI: 961. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_STRIDED_RO    yes         yes           NULL             U            1 か 0         NULL
     ' 次に属します:                                                                                       
     *note Stable ABI: 961. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_CONTIG        yes         NULL          NULL             C            0              NULL
     ' 次に属します:                                                                                       
     *note Stable ABI: 961. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_CONTIG_RO     yes         NULL          NULL             C            1 か 0         NULL
     ' 次に属します:                                                                                       
     *note Stable ABI: 961. (バー
     ジョン 3.11 より).'


File: python.info,  Node: 複雑な配列,  Next: バッファ関連の関数,  Prev: バッファリクエストのタイプ,  Up: バッファプロトコル buffer Protocol

7.9.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.9.7.9 NumPy スタイル: shape, strides
......................................

NumPy スタイルの配列の論理的構造は *note itemsize: 5631, *note ndim:
5634, *note shape: 5633, *note strides: 562d. で定義されます。

‘ndim == 0’ の場合は、 *note buf: 562c. が指すメモリの場所は、サイズが
*note itemsize: 5631. のスカラ値として解釈されます。 この場合、 *note
shape: 5633. と *note strides: 562d. の両方とも ‘NULL’ です。

*note strides: 562d. が ‘NULL’ の場合は、配列は標準の n 次元 C 配列とし
て解釈されます。 そうでない場合は、利用者は次のように n 次元配列にアクセ
スしなければなりません:

     ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * strides[n-1];
     item = *((typeof(item) *)ptr);

上記のように、 *note buf: 562c. はメモリブロック内のどの場所でも指すこと
が可能です。エクスポーターはこの関数を使用することによってバッファの妥当
性を確認出来ます。

     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.9.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: 562c. の先頭に埋め込め、メモリのどこにでも配置で
きる 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.9.7.11 バッファ関連の関数
...........................

 -- C の関数: int PyObject_CheckBuffer (PyObject *obj)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     'obj' がbuffer インターフェースをサポートしている場合は ‘1’ を返し
     、そうでない場合は ‘0’ を返します。 ‘1’ を返したとしても、 *note
     PyObject_GetBuffer(): 832. が成功することは保証されません。 この関
     数は常に成功します。

 -- C の関数: int PyObject_GetBuffer (PyObject *exporter, Py_buffer
          *view, int flags)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     'exporter' に 'flags' で指定された方法で 'view' を埋めるように要求
     します。もし exporter が指定されたとおりにバッファを提供できない場
     合、 *note BufferError: 19b9. を送出し、 ‘view->obj’ を ‘NULL’ に設
     定した上で、 ‘-1’ を返さなければなりません。

     成功したときは、 'view' を埋め、 ‘view->obj’ に 'exporter' への新し
     い参照を設定し、0を返します。チェイン状のバッファプロバイダがリクエ
     ストを単一のオブジェクトにリダイレクトするケースでは、 ‘view->obj’
     は 'exporter' の代わりにこのオブジェクトを参照します (*note
     バッファオブジェクト構造体: 13f3. を参照してください)。

     ‘malloc()’ と ‘free()’ のように、呼び出しに成功した *note
     PyObject_GetBuffer(): 832. と対になる *note PyBuffer_Release():
     833. の呼び出しがなけれなればなりません。 従って、バッファの利用が
     済んだら ‘PyBuffer_Release()’ が厳密に1回だけ呼び出されなければなり
     ません。

 -- C の関数: void PyBuffer_Release (Py_buffer *view)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     Release the buffer 'view' and release the *note strong reference:
     7e0. (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(): 832. を通して取得していないバッファに対
     してこの関数を呼び出すのは間違いです。

 -- C の関数: *note Py_ssize_t: e28. PyBuffer_SizeFromFormat (const char
          *format)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     Return the implied *note itemsize: 5631. from *note format: 5632.
     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: 961. (バージョン 3.11 より).'
     'view' で定義されているメモリが、 C スタイル ('order' == ‘'C'’) の
     ときか、 Fortran スタイル ('order' == ‘'F'’) *note 連続: 13f9. のと
     きか、そのいずれか ('order' == ‘'A'’) であれば ‘1’ を返します。 そ
     れ以外の場合は ‘0’ を返します。 この関数は常に成功します。

 -- C の関数: void *PyBuffer_GetPointer (const Py_buffer *view, const
          Py_ssize_t *indices)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'  与
     えられた 'view' 内にある 'indices' が指すメモリ領域を取得します。
     'indices' は ‘view->ndim’ 個のインデックスからなる配列を指していな
     ければなりません。

 -- C の関数: int PyBuffer_FromContiguous (const Py_buffer *view, const
          void *buf, Py_ssize_t len, char order)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     Copy contiguous 'len' bytes from 'buf' to 'view'.  'order' can be
     ‘'C'’ or ‘'F'’ or ‘'A'’ (for C-style or Fortran-style ordering or
     either one).  ‘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: 961. (バージョン 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: 961. (バージョン 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: 961. (バージョン 3.11 より).'
     'strides' 配列を、 'itemsize' の大きさの要素がバイト単位の、
     'shape' の形をした *note 連続な: 13f9. ('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: 961. (バージョン 3.11 より).'  サ
     イズが 'len' の 'buf' を 'readonly' に従った書き込み可/不可の設定で
     公開するバッファリクエストを処理します。 'buf' は符号無しバイトの列
     として解釈されます。

     'flags' 引数はリクエストのタイプを示します。 この関数は、 'buf' が
     読み出し専用と指定されていて、 'flags' に *note PyBUF_WRITABLE:
     176e. が設定されていない限り、常にフラグに指定された通りに 'view' を
     埋めます。

     On success, set ‘view->obj’ to a new reference to 'exporter' and
     return 0.  Otherwise, raise *note BufferError: 19b9, set
     ‘view->obj’ to ‘NULL’ and return ‘-1’;

     この関数を *note getbufferproc: 13f3. の一部として使う場合には、
     'exporter' はエクスポートするオブジェクトに設定しなければならず、さ
     らに 'flags' は変更せずに渡さなければなりません。 そうでない場合は
     、 'exporter' は ‘NULL’ でなければなりません。


File: python.info,  Node: 具象オブジェクト concrete object レイヤ,  Next: インタープリタの初期化と終了処理,  Prev: 抽象オブジェクトレイヤ Abstract Objects Layer,  Up: Python/C API reference manual

7.10 具象オブジェクト (concrete object) レイヤ
==============================================

この章では、特定の Python オブジェクト型固有の関数について述べています。
これらの関数に間違った型のオブジェクトを渡すのは良い考えではありません;
Python プログラムから何らかのオブジェクトを受け取ったとき、そのオブジェ
クトが正しい型になっているか確信をもてないのなら、まず型チェックを行わな
ければなりません; 例えば、あるオブジェクトが辞書型か調べるには、 *note
PyDict_Check(): 5646. を使います。この章は 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.10.1 基本オブジェクト (fundamental object)
--------------------------------------------

この節では、Python の型オブジェクトとシングルトン(singleton)オブジェクト
‘None’ について述べます。

* Menu:

* 型オブジェクト: 型オブジェクト<2>.
* None オブジェクト::


File: python.info,  Node: 型オブジェクト<2>,  Next: None オブジェクト,  Up: 基本オブジェクト fundamental object

7.10.1.1 型オブジェクト
.......................

 -- C のデータ型: type PyTypeObject
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として).'  組
     み込み型を記述する際に用いられる、オブジェクトを表す C 構造体です。

 -- C 変数: *note PyTypeObject: e6f. PyType_Type
     ' 次に属します: *note Stable ABI: 961.'  型オブジェクト自身の型オブ
     ジェクトです。Python レイヤにおける *note type: 191. と同じオブジェ
     クトです。

 -- 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: 961.'  内部の検索キャッシュをクリ
     アします。現在のバージョンタグを返します。

 -- C の関数: unsigned long PyType_GetFlags (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 961.'  Return the *note tp_flags:
     1e87. 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: 82f.

     Added in version 3.2.

     バージョン 3.4 で変更: 返り値の型が ‘long’ ではなく ‘unsigned long’
     になりました。

 -- C の関数: *note PyObject: 1a6. *PyType_GetDict (PyTypeObject *type)

     Return the type object's internal namespace, which is otherwise
     only exposed via a read-only proxy (*note cls.__dict__: 101f.).
     This is a replacement for accessing *note tp_dict: 1cb1. 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(): 3bf.)
     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: 961.'  内部の検索キャッシュを、そ
     の 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(): 970.  In case of error (e.g.  no more watcher IDs
     available), return ‘-1’ and set an exception.

     In free-threaded builds, *note PyType_AddWatcher(): 96f. 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(): 96f.).  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(): 96f.

     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(): 96f. will be called whenever *note
     PyType_Modified(): 1d96. 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.)

     The callback is also invoked when a watched heap type is
     deallocated.

     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(): 96f.

     Added in version 3.12.

     バージョン 3.15 で変更: The callback is now also invoked when a
     watched heap type is deallocated.

 -- C の関数: int PyType_Unwatch (int watcher_id, PyObject *type)

     Mark 'type' as not watched.  This undoes a previous call to *note
     PyType_Watch(): 970.  '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(): 96f.

     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:
          1a6. *type)

     Type of a type-watcher callback function.

     The callback must not modify 'type' or cause *note
     PyType_Modified(): 1d96. to be called on 'type' or any type in its
     MRO; violating this rule could cause infinite recursion.

     The callback may be called during type deallocation.  In this case,
     the type object is temporarily resurrected (its reference count is
     at least 1) and all its attributes are still valid.  However, the
     callback should not store new strong references to the type, as
     this would resurrect the object and prevent its deallocation.

     Added in version 3.12.

     バージョン 3.15 で変更: The callback may now be called during
     deallocation of a watched heap type.

 -- 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:
     564f.  This function is used by many ‘_Check’ functions for common
     types.

     参考
     ....

     *note PyObject_TypeCheck(): 1eca, 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: 3a6.

 -- C の関数: int PyType_IsSubtype (PyTypeObject *a, PyTypeObject *b)
     ' 次に属します: *note Stable ABI: 961.'  'a' が 'b' のサブタイプの
     場合に真を返します。

     This function only checks for actual subtypes, which means that
     *note __subclasscheck__(): 25dc. is not called on 'b'.  Call *note
     PyObject_IsSubclass(): 125b. to do the same check that *note
     issubclass(): 2fc. would do.

 -- C の関数: *note PyObject: 1a6. *PyType_GenericAlloc (PyTypeObject
          *type, Py_ssize_t nitems)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Generic handler for the *note tp_alloc: 51f5. 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(): e33.
     or *note PyObject_InitVar(): 1f53.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 51f5. slot instead.

     For types that support garbage collection (i.e., the *note
     Py_TPFLAGS_HAVE_GC: 3a6. flag is set), this function behaves like
     *note PyObject_GC_New: e6c. or *note PyObject_GC_NewVar: e6d.
     (except the memory is guaranteed to be zeroed before
     initialization), and should be paired with *note PyObject_GC_Del():
     18bb. in *note tp_free: 51f4.  Otherwise, it behaves like *note
     PyObject_New: d51. or *note PyObject_NewVar: d52. (except the
     memory is guaranteed to be zeroed before initialization) and should
     be paired with *note PyObject_Free(): 1028. in ‘tp_free’.

 -- C の関数: *note PyObject: 1a6. *PyType_GenericNew (PyTypeObject
          *type, PyObject *args, PyObject *kwds)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Generic handler for the *note tp_new: 986. slot of a type object.
     Creates a new instance using the type's *note tp_alloc: 51f5. slot
     and returns the resulting object.

 -- C の関数: int PyType_Ready (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 961.'  型オブジェクトのファイナラ
     イズを行います。この関数は全てのオブジェクトで初期化を完了するため
     に呼び出されなくてはなりません。この関数は、基底クラス型から継承し
     たスロットを型オブジェクトに追加する役割があります。成功した場合に
     は ‘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: 3a6. 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: 373. handle.

 -- C の関数: *note PyObject: 1a6. *PyType_GetName (PyTypeObject *type)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.11 より).'  Return the type's name.  Equivalent to getting
     the type's *note __name__: 1863. attribute.

     Added in version 3.11.

 -- C の関数: *note PyObject: 1a6. *PyType_GetQualName (PyTypeObject
          *type)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.11 より).'  Return the type's qualified name.  Equivalent
     to getting the type's *note __qualname__: 2583. attribute.

     Added in version 3.11.

 -- C の関数: *note PyObject: 1a6. *PyType_GetFullyQualifiedName
          (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Return the type's fully qualified name.  Equivalent to
     ‘f"{type.__module__}.{type.__qualname__}"’, or *note
     type.__qualname__: 2583. if *note type.__module__: 811. is not a
     string or is equal to ‘"builtins"’.

     Added in version 3.13.

 -- C の関数: *note PyObject: 1a6. *PyType_GetModuleName (PyTypeObject
          *type)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Return the type's module name.  Equivalent to getting the *note
     type.__module__: 811. attribute.

     Added in version 3.13.

 -- C の関数: void *PyType_GetSlot (PyTypeObject *type, int slot)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.4 より).'  与
     えられたスロットに格納されている関数ポインタを返します。返り値が
     ‘NULL’ の場合は、スロットが ‘NULL’ か、関数が不正な引数で呼ばれたこ
     とを示します。通常、呼び出し側は返り値のポインタを適切な関数型にキ
     ャストします。

     See *note PyType_Slot.slot: 5651. for possible values of the 'slot'
     argument.

     Added in version 3.4.

     バージョン 3.10 で変更: *note PyType_GetSlot(): c76. can now accept
     all types.  Previously, it was limited to *note heap types: d33.

 -- C の関数: *note PyObject: 1a6. *PyType_GetModule (PyTypeObject
          *type)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.10 より).'  Return the module object associated with the
     given type when the type was created using *note
     PyType_FromModuleAndSpec(): 398.

     The returned reference is *note borrowed: 60a. from 'type', and
     will be valid as long as you hold a reference to 'type'.  Do not
     release it with *note Py_DECREF(): 97a. or similar.

     If no module is associated with the given type, sets *note
     TypeError: 29c. 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: b4b. to get the class that
     defines the method.  See *note PyType_GetModuleByToken(): 5428. for
     cases when ‘PyCMethod’ cannot be used.

     Added in version 3.9.

 -- C の関数: void *PyType_GetModuleState (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Return the state of the module object associated with the given
     type.  This is a shortcut for calling *note PyModule_GetState():
     d4c. on the result of *note PyType_GetModule(): d3b.

     If no module is associated with the given type, sets *note
     TypeError: 29c. 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: 1a6. *PyType_GetModuleByToken
          (PyTypeObject *type, const void *mod_token)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.15 より).'  Find the first superclass whose module has the
     given *note module token: 5652, and return that module.

     If no module is found, raises a *note TypeError: 29c. and returns
     ‘NULL’.

     This function is intended to be used together with *note
     PyModule_GetState(): d4c. to get module state from slot methods
     (such as *note tp_init: 988. or *note nb_add: 5653.) and other
     places where a method's defining class cannot be passed using the
     *note PyCMethod: b4b. calling convention.

     Added in version 3.15.

 -- C の関数: *note PyObject: 1a6. *PyType_GetModuleByDef (PyTypeObject
          *type, struct PyModuleDef *def)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.13 より).'  Find the first superclass whose module was
     created from the given *note PyModuleDef: d49. 'def', or whose
     *note module token: 5652. is equal to 'def', and return that
     module.

     Note that modules created from a *note PyModuleDef: d49. always
     have their token set to the ‘PyModuleDef’'s address.  In other
     words, this function is equivalent to *note
     PyType_GetModuleByToken(): 5428, except that it:

        - returns a borrowed reference, and

        - has a non-‘void*’ argument type (which is a cosmetic
          difference in C).

     The returned reference is *note borrowed: 60a. from 'type', and
     will be valid as long as you hold a reference to 'type'.  Do not
     release it with *note Py_DECREF(): 97a. or similar.

     Added in version 3.11.

 -- C の関数: int PyType_GetBaseByToken (PyTypeObject *type, void
          *tp_token, PyTypeObject **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.14 より).'
     Find the first superclass in 'type"s *note method resolution order:
     27a3. whose *note Py_tp_token: 5e5. token is equal to 'tp_token'.

        * If found, set '*result' to a new *note strong reference: 7e0.
          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 'tp_token' argument may not be ‘NULL’.

     Added in version 3.14.

 -- C の関数: int PyUnstable_Type_AssignVersionTag (PyTypeObject *type)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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 弱参照オブジェクト: 5600.

        * *note weakref: 11d.

* Menu:

* Creating Heap-Allocated Types::
* Soft-deprecated API::


File: python.info,  Node: Creating Heap-Allocated Types,  Next: Soft-deprecated API,  Up: 型オブジェクト<2>

7.10.1.2 Creating Heap-Allocated Types
......................................

The following function is used to create *note heap types: d33.:

 -- C の関数: *note PyObject: 1a6. *PyType_FromSlots (const PySlot
          *slots)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Create and return a *note heap type: d33. from a ‘PySlot’ array.
     See *note Definition slots: 37d. for general information on slots,
     and *note Type slot IDs: 557a. for slots specific to type creation.

     This function calls *note PyType_Ready(): b63. on the new type.

     Note that this function does 'not' fully match the behavior of
     calling *note type(): 191. or using the *note class: 1691.
     statement.  With user-provided base types or metaclasses, prefer
     *note calling: 5605. ‘type’ (or the metaclass) over ‘PyType_From*’
     functions.  Specifically:

        * *note __new__(): 987. is not called on the new class (and it
          must be set to ‘type.__new__’).

        * *note __init__(): 306. is not called on the new class.

        * *note __init_subclass__(): a27. is not called on any bases.

        * *note __set_name__(): 1010. is not called on new descriptors.

     Slots are typically defined as a global static constant arrays.
     However, sometimes slot values are not statically known at compile
     time.  For example, slots like *note Py_tp_bases: 54db, *note
     Py_tp_metaclass: 389. and *note Py_tp_module: 38a. require live
     Python objects.  In this case, it is recommended to put such slots
     on the stack, and use *note Py_slot_subslots: 381. to refer to an
     array of static slots.  For example:

          static const PySlot my_slots[] = {
             PySlot_STATIC_DATA(Py_tp_name, "MyClass"),
             PySlot_FUNC(Py_tp_repr, my_repr_func),
             ...
             PySlot_END
          };

          PyObject *make_my_class(PyObject *module) {
             PySlot all_slots[] = {
                PySlot_STATIC_DATA(Py_slot_subslots, my_slots),
                PySlot_DATA(Py_tp_module, module),
                PySlot_END
             };
             return PyType_FromSlots(all_slots);
          }

Heap types created without the *note Py_TPFLAGS_IMMUTABLETYPE: 602. flag
may be modified, for example by setting attributes on them, as with
classes defined in Python code.  Sometimes, such modifications are
necessary to fully initialize a type, but you may wish to prevent users
from changing the type after the initialization is done:

 -- C の関数: int PyType_Freeze (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.14 より).'
     Make a type immutable: set the *note Py_TPFLAGS_IMMUTABLETYPE: 602.
     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.

* Menu:

* Type slot IDs::


File: python.info,  Node: Type slot IDs,  Up: Creating Heap-Allocated Types

7.10.1.3 Type slot IDs
......................

Most type slot IDs are named like the field names of the structures
*note PyTypeObject: e6f, *note PyNumberMethods: 17d6, *note
PySequenceMethods: 5218, *note PyMappingMethods: 5219. and *note
PyAsyncMethods: 5658. with an added ‘Py_’ prefix.  For example, use:

   * *note Py_tp_dealloc: 54de. to set *note PyTypeObject.tp_dealloc:
     51e2.

   * *note Py_nb_add: 54af. to set *note PyNumberMethods.nb_add: 5653.

   * *note Py_sq_length: 54d7. to set *note PySequenceMethods.sq_length:
     5659.

The following slots need additional considerations when specified as
slots:

   * *note Py_tp_name: 384.

   * *note Py_tp_basicsize: 385. and *note Py_tp_extra_basicsize: 386.

   * *note Py_tp_itemsize: 387.

   * *note Py_tp_flags: 388.

Additional slots do not directly correspond to a ‘PyTypeObject’ struct
field:

   * *note Py_tp_token: 5e5.

   * *note Py_tp_metaclass: 389.

   * *note Py_tp_module: 38a.

The following “offset” fields cannot be set using *note PyType_Slot:
542a.:

   * *note tp_weaklistoffset: d54. (use *note
     Py_TPFLAGS_MANAGED_WEAKREF: 3a5. instead if possible)

   * *note tp_dictoffset: 565a. (use *note Py_TPFLAGS_MANAGED_DICT: 3a4.
     instead if possible)

   * *note tp_vectorcall_offset: 5607. (use ‘"__vectorcalloffset__"’ in
     *note PyMemberDef: 565b.)

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: 54ed.  See *note PyMemberDef documentation: 565b.
for details.

The following internal fields cannot be set at all when creating a heap
type:

   * *note tp_dict: 1cb1, *note tp_mro: 565c, *note tp_cache: 565d,
     *note tp_subclasses: 97c, and *note tp_weaklist: 565e.

The *note Py_tp_base: 54da. slot is equivalent to *note Py_tp_bases:
54db.; both may be set either to a type or a tuple of types.  If both
are specified, the value of ‘Py_tp_bases’ is used.

Slot values may not be ‘NULL’, except for the following:

   * *note Py_tp_doc: 54e2.

   * *note Py_tp_token: 5e5. (for clarity, prefer *note Py_TP_USE_SPEC:
     548c. rather than ‘NULL’)

バージョン 3.9 で変更: Slots in *note PyBufferProcs: 565f. may be set in
the unlimited API.

バージョン 3.11 で変更: *note bf_getbuffer: b49. and *note
bf_releasebuffer: b4a. are now available under the *note limited API:
82f.

バージョン 3.14 で変更: The field *note tp_vectorcall: 1bb9. can now be
set using *note Py_tp_vectorcall: 54f6.  See the field's documentation
for details.

バージョン 3.15 で変更: The *note Py_tp_bases: 54db. slot may be set to
a single type object, making it equivalent to the *note Py_tp_base:
54da. slot.  Previously, a tuple of types was required.

The following slots correspond to fields in the underlying type
structure, but need extra remarks for use as slots:

 -- C のマクロ: Py_tp_name
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for the name of the type, used to set *note
     PyTypeObject.tp_name: 1ec5.

     This slot (or *note PyType_Spec.name(): 5660.) is required to
     create a type.

     This may not be used in *note PyType_Spec.slots: 5661.  Use *note
     PyType_Spec.name(): 5660. instead.

     'CPython 実装の詳細:' CPython processes slots in order.  It is
     recommended to put ‘Py_tp_name’ at the beginning of the slots
     array, so that if processing of a later slots fails, error messages
     can include the name.

     Added in version 3.15.

 -- C のマクロ: Py_tp_basicsize
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for the size of the instance in bytes.  It is
     used to set *note PyTypeObject.tp_basicsize: d53.

     The value must be positive.

     This may not be used in *note PyType_Spec.slots: 5661.  Use *note
     PyType_Spec.basicsize(): 1a4. instead.

     This slot may not be used with *note PyType_GetSlot(): c76.  Use
     *note PyTypeObject.tp_basicsize: d53. instead if needed, but be
     aware that a type's size is often considered an implementation
     detail.

     Added in version 3.15.

 -- C のマクロ: Py_tp_extra_basicsize
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for type data size in bytes, that is, how much
     space instances of the class need 'in addition' to space needed for
     superclasses.

     The value is used, together with the size of superclasses, to set
     *note PyTypeObject.tp_basicsize: d53.  Python will insert padding
     as needed to meet ‘tp_basicsize’'s alignment requirements.

     Use *note PyObject_GetTypeData(): 1a5. to get a pointer to
     subclass-specific memory reserved this way.

     The value must be positive.  To specify that instances need no
     additional size (that is, size should be inherited), omit the
     ‘Py_tp_extra_basicsize’ slot rather than set it to zero.

     Specifying both *note Py_tp_basicsize: 385. and
     ‘Py_tp_extra_basicsize’ is an error.

     This may not be used in *note PyType_Spec.slots: 5661.  Use
     negative *note PyType_Spec.basicsize(): 1a4. instead.

     This slot may not be used with *note PyType_GetSlot(): c76.

     Added in version 3.15.

 -- C のマクロ: Py_tp_itemsize
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for the size of one element of a variable-size
     type, in bytes.  Used to set *note PyTypeObject.tp_itemsize: 25cf.
     See ‘tp_itemsize’ documentation for caveats.

     The value must be positive.

     If this slot is missing, *note tp_itemsize: 25cf. 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: 25cf.).

        - The requested *note PyType_Spec.basicsize: 1a4. is positive,
          suggesting that the memory layout of the base class is known.

        - The requested *note PyType_Spec.basicsize: 1a4. is zero,
          suggesting that the subclass does not access the instance's
          memory directly.

        - With the *note Py_TPFLAGS_ITEMS_AT_END: 95b. flag.

     This may not be used in *note PyType_Spec.slots: 5661.  Use *note
     PyType_Spec.itemsize(): 5662. instead.

     This slot may not be used with *note PyType_GetSlot(): c76.

     Added in version 3.15.

 -- C のマクロ: Py_tp_flags
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for type flags, used to set *note
     PyTypeObject.tp_flags: 1e87.

     The ‘Py_TPFLAGS_HEAPTYPE’ flag is not set, *note
     PyType_FromSpecWithBases(): 397. sets it automatically.

     This may not be used in *note PyType_Spec.slots: 5661.  Use
     negative *note PyType_Spec.basicsize(): 1a4. instead.

     This slot may not be used with *note PyType_GetSlot(): c76.  Use
     *note PyType_GetFlags(): 1f50. instead.

     Added in version 3.15.

The following slots do not correspond to public fields in the underlying
structures:

 -- C のマクロ: Py_tp_metaclass
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for the metaclass used to construct the
     resulting type object.  When omitted the metaclass is derived from
     bases (*note Py_tp_bases: 54db. or the 'bases' argument of *note
     PyType_FromMetaclass(): 399.).

     Metaclasses that override *note tp_new: 986. are not supported,
     except if ‘tp_new’ is ‘NULL’.

     This may not be used in *note PyType_Spec.slots: 5661.  Use *note
     PyType_FromMetaclass(): 399. to specify a metaclass with
     ‘PyType_Spec’.

     This slot may not be used with *note PyType_GetSlot(): c76.  Use
     *note Py_TYPE(): 5fc. on the type object instead.

     Added in version 3.15.

 -- C のマクロ: Py_tp_module
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for recording the module in which the new
     class is defined.

     The value must be a module object.  The module is associated with
     the new type and can later be retrieved with *note
     PyType_GetModule(): d3b.  The associated module is not inherited by
     subclasses; it must be specified for each class individually.

     This may not be used in *note PyType_Spec.slots: 5661.  Use *note
     PyType_FromMetaclass(): 399. to specify a module with
     ‘PyType_Spec’.

     This slot may not be used with *note PyType_GetSlot(): c76.  Use
     *note PyType_GetModule(): d3b. instead.

     Added in version 3.15.

 -- C のマクロ: Py_tp_token
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.14 より).'
     *note Slot ID: 5577. for recording a static memory layout ID for a
     class.

     If the class is defined using a *note PyType_Spec: 1cae, and that
     spec is statically allocated, the token can be set to the spec
     using the special value *note Py_TP_USE_SPEC: 548c.:

          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(): 5e4. 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(): c76. with ‘Py_tp_token’.

     Added in version 3.14.

      -- C のマクロ: Py_TP_USE_SPEC
          ' 次に属します: *note Stable ABI: 961. (バージョン 3.14 より
          ).'  Used as a value with *note Py_tp_token: 5e5. to set the
          token to the class's *note PyType_Spec: 1cae.  May only be
          used for classes defined using ‘PyType_Spec’.

          Expands to ‘NULL’.

          Added in version 3.14.

 -- C のマクロ: Py_tp_slots
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. that works like *note Py_slot_subslots: 381,
     except it specifies an array of *note PyType_Slot: 542a.
     structures.

     Added in version 3.15.


File: python.info,  Node: Soft-deprecated API,  Prev: Creating Heap-Allocated Types,  Up: 型オブジェクト<2>

7.10.1.4 Soft-deprecated API
............................

The following functions are *note soft deprecated: 1b2.  They will
continue to work, but new features will be added as slots for *note
PyType_FromSlots(): 37e, not as arguments to new ‘PyType_From*’
functions.

 -- C の関数: *note PyObject: 1a6. *PyType_FromMetaclass (PyTypeObject
          *metaclass, PyObject *module, PyType_Spec *spec, PyObject
          *bases)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     Create and return a *note heap type: d33. from the 'spec' (see
     *note Py_TPFLAGS_HEAPTYPE: c86.).

     A non-‘NULL’ 'metaclass' argument corresponds to the *note
     Py_tp_metaclass: 389. slot.

     A non-‘NULL’ 'bases' argument corresponds to the *note Py_tp_bases:
     54db. slot, and takes precedence over ‘Py_tp_bases’ and
     ‘Py_tp_bases’ slots.

     A non-‘NULL’ 'module' argument corresponds to the *note
     Py_tp_module: 38a. slot.

     This function calls *note PyType_Ready(): b63. on the new type.

     Note that this function does 'not' fully match the behavior of
     calling *note type(): 191. or using the *note class: 1691.
     statement.  See the note in *note PyType_FromSlots(): 37e.
     documentation for details.

     Added in version 3.12.

     *note Soft deprecated: 1b2. since version 3.16.0a0 (unreleased):
     Prefer *note PyType_FromSlots(): 37e. in new code.

 -- C の関数: *note PyObject: 1a6. *PyType_FromModuleAndSpec (PyObject
          *module, PyType_Spec *spec, PyObject *bases)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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: 191. instances were returned.

     The *note tp_new: 986. 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: 986. is no longer allowed.

     *note Soft deprecated: 1b2. since version 3.16.0a0 (unreleased):
     Prefer *note PyType_FromSlots(): 37e. in new code.

 -- C の関数: *note PyObject: 1a6. *PyType_FromSpecWithBases
          (PyType_Spec *spec, PyObject *bases)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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: 191. instances were returned.

     The *note tp_new: 986. 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: 986. is no longer allowed.

     *note Soft deprecated: 1b2. since version 3.16.0a0 (unreleased):
     Prefer *note PyType_FromSlots(): 37e. in new code.

 -- C の関数: *note PyObject: 1a6. *PyType_FromSpec (PyType_Spec *spec)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 191. instances were returned.

     The *note tp_new: 986. 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: 986. is no longer allowed.

     *note Soft deprecated: 1b2. since version 3.16.0a0 (unreleased):
     Prefer *note PyType_FromSlots(): 37e. in new code.

 -- C のデータ型: type PyType_Spec
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む).'
     Structure defining a type's behavior, used for soft-deprecated
     functions like *note PyType_FromMetaclass(): 399.

     This structure contains several members that can instead be
     specified as *note slots: 557a. for *note PyType_FromSlots(): 37e,
     and an array of slot entries with a simpler structure.

      -- C のメンバ変数: const char *name

          Corresponds to *note Py_tp_name: 384.

      -- C のメンバ変数: int basicsize

          If positive, corresponds to *note Py_tp_basicsize: 385.

          If negative, corresponds to *note Py_tp_extra_basicsize: 386.
          set to the absolute value.

          バージョン 3.12 で変更: Previously, this field could not be
          negative.

      -- C のメンバ変数: int itemsize

          Corresponds to *note Py_tp_itemsize: 387.

      -- C のメンバ変数: unsigned int flags

          Corresponds to *note Py_tp_flags: 388.

      -- C のメンバ変数: *note PyType_Slot: 542a. *slots

          Array of *note PyType_Slot: 542a. (not *note PySlot: 1a8.)
          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: 961. (すべてのメンバー
               を含む).'  Structure defining optional functionality of a
               type, used for soft-deprecated functions like *note
               PyType_FromMetaclass(): 399.

               Note that a ‘PyType_Slot’ array may be included in a
               ‘PySlot’ array using *note Py_tp_slots: 382, and vice
               versa using *note Py_slot_subslots: 381.

               Each ‘PyType_Slot’ structure ‘tpslot’ is interpreted as
               the following *note PySlot: 1a8. structure:

                    (PySlot){
                       .sl_id=tpslot.slot,
                       .sl_flags=PySlot_INTPTR | sub_static,
                       .sl_ptr=tpslot.func
                    }

               where ‘sub_static’ is ‘PySlot_STATIC’ if the slot
               requires the flag (such as for *note Py_tp_methods:
               54ee.), or if this flag is present on the "parent"
               ‘Py_tp_slots’ slot (if any).

                -- C のメンバ変数: int slot

                    Corresponds to *note PySlot.sl_id: 5577.

                -- C のメンバ変数: void *pfunc

                    Corresponds to *note PySlot.sl_ptr: 557b.


File: python.info,  Node: None オブジェクト,  Prev: 型オブジェクト<2>,  Up: 基本オブジェクト fundamental object

7.10.1.5 ‘None’ オブジェクト
............................

‘None’ に対する *note PyTypeObject: e6f. は、 Python/C API では直接公開
されていないので注意してください。 ‘None’ は単量子 (singleton) なので、
オブジェクトの同一性テスト (C では ‘==’) を使うだけで十分だからです。同
じ理由から、 ‘PyNone_Check()’ 関数はありません。

 -- C 変数: *note PyObject: 1a6. *Py_None

     値の欠如を示す、 Python の ‘None’ オブジェクト。このオブジェクトは
     メソッドを持たず、 *note immortal: 3a0. です。

     バージョン 3.12 で変更: *note Py_None: 5615. は *note immortal:
     3a0. です。

 -- C のマクロ: Py_RETURN_NONE

     関数から *note Py_None: 5615. を返します。


File: python.info,  Node: 数値型オブジェクト numeric object,  Next: シーケンスオブジェクト sequence object,  Prev: 基本オブジェクト fundamental object,  Up: 具象オブジェクト concrete object レイヤ

7.10.2 数値型オブジェクト (numeric object)
------------------------------------------

* Menu:

* 整数型オブジェクト (integer object): 整数型オブジェクト integer object.
* Boolean オブジェクト::
* Floating-Point Objects::
* 複素数オブジェクト::


File: python.info,  Node: 整数型オブジェクト integer object,  Next: Boolean オブジェクト,  Up: 数値型オブジェクト numeric object

7.10.2.1 整数型オブジェクト (integer object)
............................................

すべての整数は任意の長さをもつ "long" 整数として実装されます。

エラーが起きると、ほとんどの ‘PyLong_As*’ API は ‘(return type)-1’ を返
しますが、これは数値と見分けが付きません。 見分けを付けるためには *note
PyErr_Occurred(): 1ec4. を使ってください。

 -- C のデータ型: type PyLongObject
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として).'  こ
     の *note PyObject: 1a6. のサブタイプは整数型を表現します。

 -- C 変数: *note PyTypeObject: e6f. PyLong_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは Python 整数型を表現します。これは Python レイ
     ヤにおける *note int: 32e. と同じオブジェクトです。

 -- C の関数: int PyLong_Check (PyObject *p)

     引数が *note PyLongObject: 5d2. か ‘PyLongObject’ のサブタイプであ
     るときに真を返します。この関数は常に成功します。

 -- C の関数: int PyLong_CheckExact (PyObject *p)

     引数が *note PyLongObject: 5d2. であるが ‘PyLongObject’ のサブタイ
     プでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyLong_FromLong (long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  'v'
     から新たな *note PyLongObject: 5d2. オブジェクトを生成して返します
     。失敗のときには ‘NULL’ を返します。

     'CPython 実装の詳細:' CPython keeps an array of integer objects for
     all integers between ‘-5’ and ‘1024’.  When you create an int in
     that range you actually just get back a reference to the existing
     object.

 -- C の関数: *note PyObject: 1a6. *PyLong_FromUnsignedLong (unsigned
          long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  Cの
     unsigned long から新たな *note PyLongObject: 5d2. オブジェクトを生
     成して返します。失敗した際には ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyLong_FromSsize_t (Py_ssize_t v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  C の
     *note Py_ssize_t: e28. 型から新たな *note PyLongObject: 5d2. オブジ
     ェクトを生成して返します。 失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyLong_FromSize_t (size_t v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  C の
     ‘size_t’ 型から新たな *note PyLongObject: 5d2. オブジェクトを生成し
     て返します。 失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyLong_FromLongLong (long long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  C の
     long long 型から新たな *note PyLongObject: 5d2. オブジェクトを生成
     して返します。失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyLong_FromInt32 (int32_t value)
 -- C の関数: *note PyObject: 1a6. *PyLong_FromInt64 (int64_t value)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.14 より).'
     Return a new *note PyLongObject: 5d2. 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: 1a6. *PyLong_FromUnsignedLongLong
          (unsigned long long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  C の
     unsigned long long 型から新たな *note PyLongObject: 5d2. オブジェク
     トを生成して返します。失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyLong_FromUInt32 (uint32_t value)
 -- C の関数: *note PyObject: 1a6. *PyLong_FromUInt64 (uint64_t value)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.14 より).'
     Return a new *note PyLongObject: 5d2. 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: 1a6. *PyLong_FromDouble (double v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  'v'
     の整数部から新たな *note PyLongObject: 5d2. オブジェクトを生成して
     返します。失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyLong_FromString (const char *str,
          char **pend, int base)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Return a new *note PyLongObject: 5d2. 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 整数リテラル: 251a. definition; in this case,
     leading zeros in a non-zero decimal number raises a *note
     ValueError: 15a.  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(): 802. and *note
     PyLong_FromNativeBytes(): 803. functions can be used to convert a
     *note PyLongObject: 5d2. to/from an array of bytes in base ‘256’.

 -- C の関数: *note PyObject: 1a6. *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: 1a6. *PyLong_FromVoidPtr (void *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  ポイ
     ンタ 'p' から Python 整数値を生成します。ポインタの値は *note
     PyLong_AsVoidPtr(): 538c. を適用した結果から取得されます。

 -- C の関数: *note PyObject: 1a6. *PyLong_FromNativeBytes (const void
          *buffer, size_t n_bytes, int flags)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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(): 802.  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(): 804.  Other flags
     are ignored.

     Added in version 3.13.

 -- C の関数: *note PyObject: 1a6. *PyLong_FromUnsignedNativeBytes
          (const void *buffer, size_t n_bytes, int flags)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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(): 802.  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(): 1de9.
     or *note PyLong_FromLongLong(): 1dea, depending on the size of the
     system's PID type.

     Added in version 3.2.

 -- C の関数: long PyLong_AsLong (PyObject *obj)
     ' 次に属します: *note Stable ABI: 961.'

     Return a C long representation of 'obj'.  If 'obj' is not an
     instance of *note PyLongObject: 5d2, first call its *note
     __index__(): 444. method (if present) to convert it to a
     ‘PyLongObject’.

     もし 'obj' の値が long の範囲外であれば、 *note OverflowError: c5b.
     を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1ec4. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 443.

      -- C の関数: long PyLong_AS_LONG (PyObject *obj)

          Exactly equivalent to the preferred ‘PyLong_AsLong’.  In
          particular, it can fail with *note OverflowError: c5b. or
          another exception.

          *note Soft deprecated: 1b2. since version 3.14.

 -- C の関数: int PyLong_AsInt (PyObject *obj)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Similar to *note PyLong_AsLong(): 801, 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: 961.'  Return a C long
     representation of 'obj'.  If 'obj' is not an instance of *note
     PyLongObject: 5d2, first call its *note __index__(): 444. 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(): 1ec4. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 443.

 -- C の関数: long long PyLong_AsLongLong (PyObject *obj)
     ' 次に属します: *note Stable ABI: 961.'

     Return a C long long representation of 'obj'.  If 'obj' is not an
     instance of *note PyLongObject: 5d2, first call its *note
     __index__(): 444. method (if present) to convert it to a
     ‘PyLongObject’.

     もし 'obj' の値が long long の範囲外であれば、 *note OverflowError:
     c5b. を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1ec4. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 443.

 -- C の関数: long long PyLong_AsLongLongAndOverflow (PyObject *obj, int
          *overflow)
     ' 次に属します: *note Stable ABI: 961.'  Return a C long long
     representation of 'obj'.  If 'obj' is not an instance of *note
     PyLongObject: 5d2, first call its *note __index__(): 444. 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(): 1ec4. を使ってください。

     Added in version 3.2.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 443.

 -- C の関数: *note Py_ssize_t: e28. PyLong_AsSsize_t (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 961.'

     'pylong' を表す C の *note Py_ssize_t: e28. を返します。 'pylong' は
     *note PyLongObject: 5d2. のインスタンスでなければなりません。

     もし 'pylong' の値が *note Py_ssize_t: e28. の範囲外であれば、
     *note OverflowError: c5b. を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1ec4. を使ってください。

 -- C の関数: unsigned long PyLong_AsUnsignedLong (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 961.'

     'pylong' を表す C の unsigned long を返します。 'pylong' は *note
     PyLongObject: 5d2. のインスタンスでなければなりません。

     もし 'pylong' の値が unsigned long の範囲外であれば、 *note
     OverflowError: c5b. を送出します。

     エラーが起きたときに ‘(unsigned long)-1’ を返します。 見分けを付け
     るためには *note PyErr_Occurred(): 1ec4. を使ってください。

 -- C の関数: size_t PyLong_AsSize_t (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 961.'

     'pylong' を表す C の ‘size_t’ を返します。 'pylong' は *note
     PyLongObject: 5d2. のインスタンスでなければなりません。

     もし 'pylong' の値が ‘size_t’ の範囲外であれば、 *note
     OverflowError: c5b. を送出します。

     エラーが起きたときに ‘(size_t)-1’ を返します。 見分けを付けるために
     は *note PyErr_Occurred(): 1ec4. を使ってください。

 -- C の関数: unsigned long long PyLong_AsUnsignedLongLong (PyObject
          *pylong)
     ' 次に属します: *note Stable ABI: 961.'

     'pylong' を表す C の unsigned long long を返します。 'pylong' は
     *note PyLongObject: 5d2. のインスタンスでなければなりません。

     もし 'pylong' の値が unsigned long long の範囲外であれば、 *note
     OverflowError: c5b. を送出します。

     エラーが起きたときに ‘(unsigned long long)-1’ を返します。 見分けを
     付けるためには *note PyErr_Occurred(): 1ec4. を使ってください。

     バージョン 3.1 で変更: 負 'pylong' を指定した際に *note TypeError:
     29c. ではなく、 *note OverflowError: c5b. を送出するようになりまし
     た。

 -- C の関数: unsigned long PyLong_AsUnsignedLongMask (PyObject *obj)
     ' 次に属します: *note Stable ABI: 961.'  Return a C unsigned long
     representation of 'obj'.  If 'obj' is not an instance of *note
     PyLongObject: 5d2, first call its *note __index__(): 444. method
     (if present) to convert it to a ‘PyLongObject’.

     'obj' の値が unsigned long の範囲から外れていた場合は、 ‘ULONG_MAX
     + 1’ を法とした剰余を返します。

     エラーが起きたときに ‘(unsigned long)-1’ を返します。 見分けを付け
     るためには *note PyErr_Occurred(): 1ec4. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 443.

 -- C の関数: unsigned long long PyLong_AsUnsignedLongLongMask (PyObject
          *obj)
     ' 次に属します: *note Stable ABI: 961.'  Return a C unsigned long
     long representation of 'obj'.  If 'obj' is not an instance of *note
     PyLongObject: 5d2, first call its *note __index__(): 444. method
     (if present) to convert it to a ‘PyLongObject’.

     'obj' の値が unsigned long long の範囲から外れていた場合は、
     ‘ULLONG_MAX + 1’ を法とした剰余を返します。

     エラーが起きたときに ‘(unsigned long long)-1’ を返します。 見分けを
     付けるためには *note PyErr_Occurred(): 1ec4. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 443.

 -- C の関数: int PyLong_AsInt32 (PyObject *obj, int32_t *value)
 -- C の関数: int PyLong_AsInt64 (PyObject *obj, int64_t *value)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 5d2, first call
     its *note __index__(): 444. method (if present) to convert it to a
     ‘PyLongObject’.

     If the 'obj' value is out of range, raise an *note OverflowError:
     c5b.

     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: 961. (バージョン 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: 5d2, first call
     its *note __index__(): 444. method (if present) to convert it to a
     ‘PyLongObject’.

        * If 'obj' is negative, raise a *note ValueError: 15a.

        * If the 'obj' value is out of range, raise an *note
          OverflowError: c5b.

     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: 961.'  'pylong' を表す C の
     double を返します。 'pylong' は *note PyLongObject: 5d2. のインスタ
     ンスでなければなりません。

     もし 'pylong' の値が double の範囲外であれば、 *note OverflowError:
     c5b. を送出します。

     エラーが起きたときに ‘-1.0’ を返します。 見分けを付けるためには
     *note PyErr_Occurred(): 1ec4. を使ってください。

 -- C の関数: void *PyLong_AsVoidPtr (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 961.'  Python の整数型を指す
     'pylong' を、 C の void ポインタに変換します。 'pylong' を変換でき
     なければ、 *note OverflowError: c5b. を送出します。この関数は *note
     PyLong_FromVoidPtr(): 538e. で値を生成するときに使うような void ポ
     インタ型を生成できるだけです。

     エラーが起きたときに ‘NULL’ を返します。 見分けを付けるためには
     *note PyErr_Occurred(): 1ec4. を使ってください。

 -- C の関数: *note Py_ssize_t: e28. PyLong_AsNativeBytes (PyObject
          *pylong, void *buffer, Py_ssize_t n_bytes, int flags)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 961. (バ   
          ージョン 3.14 より).'

      -- C のマクロ: Py_ASNATIVEBYTES_BIG_ENDIAN       ‘0’
          ' 次に属します: *note Stable ABI: 961. (バ   
          ージョン 3.14 より).'

      -- C のマクロ: Py_ASNATIVEBYTES_LITTLE_ENDIAN    ‘1’
          ' 次に属します: *note Stable ABI: 961. (バ   
          ージョン 3.14 より).'

      -- C のマクロ: Py_ASNATIVEBYTES_NATIVE_ENDIAN    ‘3’
          ' 次に属します: *note Stable ABI: 961. (バ   
          ージョン 3.14 より).'

      -- C のマクロ:                                   ‘4’
               Py_ASNATIVEBYTES_UNSIGNED_BUFFER        
          ' 次に属します: *note Stable ABI: 961. (バ
          ージョン 3.14 より).'

      -- C のマクロ:                                   ‘8’
               Py_ASNATIVEBYTES_REJECT_NEGATIVE        
          ' 次に属します: *note Stable ABI: 961. (バ
          ージョン 3.14 より).'

      -- C のマクロ: Py_ASNATIVEBYTES_ALLOW_INDEX      ‘16’
          ' 次に属します: *note Stable ABI: 961. (バ   
          ージョン 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__(): 444. 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: 29c.

          注釈: 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(): 801,
     *note PyLong_FromLongLong(): 1dea, or *note PyLong_AsInt(): 800,
     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: 5d2. 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: 5d2. 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: 5d2. 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: 5d2. 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: 1a6. *PyLong_GetInfo (void)
     ' 次に属します: *note Stable ABI: 961.'  On success, return a read
     only *note named tuple: a42, that holds information about Python's
     internal representation of integers.  See *note sys.int_info: 164d.
     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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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(): 98e.; for others fall back to
     a *note PyLong_As*: 5388. function or *note PyLong_AsNativeBytes():
     802.

     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: e28. PyUnstable_Long_CompactValue (const
          PyLongObject *op)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     If 'op' is compact, as determined by *note
     PyUnstable_Long_IsCompact(): 98d, 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.10.2.2 Export API
...................

Added in version 3.14.

 -- C のデータ型: type PyLongLayout
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む) (バ
     ージョン 3.15 より).'  Layout of an array of "digits" ("limbs" in
     the GMP terminology), used to represent absolute value for
     arbitrary precision integers.

     Use *note PyLong_GetNativeLayout(): 5db. to get the native layout
     of Python *note int: 32e. objects, used internally for integers
     with "big enough" absolute value.

     See also *note sys.int_info: 164d. 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: 1990. *PyLong_GetNativeLayout
          (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Get the native layout of Python *note int: 32e. objects.

     See the *note PyLongLayout: 1990. 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 のデータ型: type PyLongExport
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む) (バ
     ージョン 3.15 より).'  Export of a Python *note int: 32e. object.

     There are two cases:

        * If *note digits: 5678. is ‘NULL’, only use the *note value:
          5679. member.

        * If *note digits: 5678. is not ‘NULL’, use *note negative:
          567a, *note ndigits: 567b. and ‘digits’ members.

      -- C のメンバ変数: int64_t value

          The native integer value of the exported *note int: 32e.
          object.  Only valid if *note digits: 5678. is ‘NULL’.

      -- C のメンバ変数: uint8_t negative

          ‘1’ if the number is negative, ‘0’ otherwise.  Only valid if
          *note digits: 5678. is not ‘NULL’.

      -- C のメンバ変数: *note Py_ssize_t: e28. ndigits

          Number of digits in *note digits: 5678. 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)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Export a Python *note int: 32e. object.

     'export_long' must point to a *note PyLongExport: 1991. 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(): 5dd. must be called when the export is
     no longer needed.

          'CPython 実装の詳細:' This function always succeeds if 'obj'
          is a Python *note int: 32e. object or a subclass.

 -- C の関数: void PyLong_FreeExport (PyLongExport *export_long)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Release the export 'export_long' created by *note PyLong_Export():
     5dc.

     'CPython 実装の詳細:' Calling *note PyLong_FreeExport(): 5dd. is
     optional if 'export_long->digits' is ‘NULL’.


File: python.info,  Node: PyLongWriter API,  Next: Deprecated API,  Prev: Export API,  Up: 整数型オブジェクト integer object

7.10.2.3 PyLongWriter API
.........................

The *note PyLongWriter: 1992. API can be used to import an integer.

Added in version 3.14.

 -- C のデータ型: type PyLongWriter
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として) (バー
     ジョン 3.15 より).'  A Python *note int: 32e. writer instance.

     The instance must be destroyed by *note PyLongWriter_Finish(): 5df.
     or *note PyLongWriter_Discard(): 5e0.

 -- C の関数: *note PyLongWriter: 1992. *PyLongWriter_Create (int
          negative, Py_ssize_t ndigits, void **digits)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Create a *note PyLongWriter: 1992.

     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(): 5df. to get a Python *note int: 32e.  The
     layout of 'digits' is described by *note PyLong_GetNativeLayout():
     5db.

     Digits must be in the range [‘0’; ‘(1 << bits_per_digit) - 1’]
     (where the *note bits_per_digit: 5674. is the number of bits per
     digit).  Any unused most significant digits must be set to ‘0’.

     Alternately, call *note PyLongWriter_Discard(): 5e0. to destroy the
     writer instance without creating an *note int: 32e. object.

 -- C の関数: *note PyObject: 1a6. *PyLongWriter_Finish (PyLongWriter
          *writer)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.15 より).'  Finish a *note PyLongWriter: 1992. created by
     *note PyLongWriter_Create(): 5de.

     On success, return a Python *note int: 32e. 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)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Discard a *note PyLongWriter: 1992. created by *note
     PyLongWriter_Create(): 5de.

     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.10.2.4 Deprecated API
.......................

These macros are *note soft deprecated: 1b2.  They describe parameters
of the internal representation of *note PyLongObject: 5d2. instances.

Use *note PyLong_GetNativeLayout(): 5db. instead, along with *note
PyLong_Export(): 5dc. to read integer data or *note PyLongWriter: 1992.
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: 5674. in the output of
     *note PyLong_GetNativeLayout(): 5db.

 -- C のマクロ: PyLong_BASE

     This is currently equivalent to 1 << *note PyLong_SHIFT: 567e.

 -- C のマクロ: PyLong_MASK

     This is currently equivalent to (1 << *note PyLong_SHIFT: 567e.) -
     1


File: python.info,  Node: Boolean オブジェクト,  Next: Floating-Point Objects,  Prev: 整数型オブジェクト integer object,  Up: 数値型オブジェクト numeric object

7.10.2.5 Boolean オブジェクト
.............................

Python の Bool 型は整数のサブクラスとして実装されています。ブール型の値
は、 *note Py_False: 5684. と *note Py_True: 5685. の 2 つしかありません
。従って、通常の生成／削除関数はブール型にはあてはまりません。とはいえ、
以下のマクロが利用できます。

 -- C 変数: *note PyTypeObject: e6f. PyBool_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは Python の boolean 型を表現します; Python レイ
     ヤにおける *note bool: 5f6. と同じオブジェクトです。

 -- C の関数: int PyBool_Check (PyObject *o)

     'o' が *note PyBool_Type: 52ab. 型の場合に真を返します。この関数は
     常に成功します。

 -- C 変数: *note PyObject: 1a6. *Py_False

     Python の ‘False’ オブジェクト。このオブジェクトはメソッドを持たず
     、 *note immortal: 3a0. です。

     バージョン 3.12 で変更: *note Py_False: 5684. は *note immortal:
     3a0. です。

 -- C 変数: *note PyObject: 1a6. *Py_True

     Python の ‘True’ オブジェクト。このオブジェクトはメソッドを持たず、
     *note immortal: 3a0. です。

     バージョン 3.12 で変更: *note Py_True: 5685. は *note immortal:
     3a0. です。

 -- C のマクロ: Py_RETURN_FALSE

     関数から *note Py_False: 5684. を返します。

 -- C のマクロ: Py_RETURN_TRUE

     関数から *note Py_True: 5685. を返します。

 -- C の関数: *note PyObject: 1a6. *PyBool_FromLong (long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  'v'
     の真理値に応じて *note Py_True: 5685. または *note Py_False: 5684.
     を返します。


File: python.info,  Node: Floating-Point Objects,  Next: 複素数オブジェクト,  Prev: Boolean オブジェクト,  Up: 数値型オブジェクト numeric object

7.10.2.6 Floating-Point Objects
...............................

 -- C のデータ型: type PyFloatObject

     This subtype of *note PyObject: 1a6. represents a Python
     floating-point object.

 -- C 変数: *note PyTypeObject: e6f. PyFloat_Type
     ' 次に属します: *note Stable ABI: 961.'  This instance of *note
     PyTypeObject: e6f. represents the Python floating-point type.  This
     is the same object as *note float: 32f. in the Python layer.

 -- C の関数: int PyFloat_Check (PyObject *p)

     引数が *note PyFloatObject: 568b. か ‘PyFloatObject’ のサブタイプで
     あるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyFloat_CheckExact (PyObject *p)

     引数が *note PyFloatObject: 568b. であるが ‘PyFloatObject’ のサブタ
     イプでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyFloat_FromString (PyObject *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     'str' の文字列値をもとに *note PyFloatObject: 568b. オブジェクトを
     生成します。失敗すると ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyFloat_FromDouble (double v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  'v'
     から *note PyFloatObject: 568b. オブジェクトを生成して返します。 失
     敗すると ‘NULL’ を返します。

 -- C の関数: double PyFloat_AsDouble (PyObject *pyfloat)
     ' 次に属します: *note Stable ABI: 961.'  Return a C double
     representation of the contents of 'pyfloat'.  If 'pyfloat' is not a
     Python floating-point object but has a *note __float__(): d96.
     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__(): 444.  This method returns ‘-1.0’ upon failure,
     so one should call *note PyErr_Occurred(): 1ec4. to check for
     errors.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

 -- C の関数: double PyFloat_AS_DOUBLE (PyObject *pyfloat)

     'pyfloat' の指す値を、 C の double 型表現で返しますが、エラーチェッ
     クを行いません。

 -- C の関数: *note PyObject: 1a6. *PyFloat_GetInfo (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     float の精度、最小値、最大値に関する情報を含む structseq インスタン
     スを返します。これは、 ‘float.h’ ファイルの薄いラッパーです。

 -- C の関数: double PyFloat_GetMax ()
     ' 次に属します: *note Stable ABI: 961.'  float の表現できる最大限解
     値 'DBL_MAX' を C の double 型で返します。

 -- C の関数: double PyFloat_GetMin ()
     ' 次に属します: *note Stable ABI: 961.'  float の正規化された最小の
     正の値 'DBL_MIN' を C の double 型で返します。

 -- C のマクロ: Py_INFINITY

     This macro expands to a constant expression of type double, that
     represents the positive infinity.

     It is equivalent to the ‘INFINITY’ macro from the C11 standard
     ‘<math.h>’ header.

     *note Soft deprecated: 1b2. since version 3.15.

 -- 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’.

     *note Soft deprecated: 1b2. since version 3.14.

 -- C のマクロ: Py_MATH_E

     The definition (accurate for a double type) of the *note math.e:
     2cac. constant.

 -- C のマクロ: Py_MATH_El

     High precision (long double) definition of *note e: 2cac. constant.

     バージョン 3.15 で非推奨、バージョン 3.20 で削除予定.

 -- C のマクロ: Py_MATH_PI

     The definition (accurate for a double type) of the *note math.pi:
     2cab. constant.

 -- C のマクロ: Py_MATH_PIl

     High precision (long double) definition of *note pi: 2cab.
     constant.

     バージョン 3.15 で非推奨、バージョン 3.20 で削除予定.

 -- C のマクロ: Py_MATH_TAU

     The definition (accurate for a double type) of the *note math.tau:
     2cad. constant.

     Added in version 3.6.

 -- C のマクロ: Py_RETURN_NAN

     Return *note math.nan: a58. from a function.

     On most platforms, this is equivalent to ‘return
     PyFloat_FromDouble(NAN)’.

 -- C のマクロ: Py_RETURN_INF (sign)

     Return *note math.inf: 1045. 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.

     *note Soft deprecated: 1b2. since version 3.14: 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.

     *note Soft deprecated: 1b2. since version 3.14: 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.

     *note Soft deprecated: 1b2. since version 3.14: Use ‘isnan’
     instead.

* Menu:

* Pack and Unpack functions::


File: python.info,  Node: Pack and Unpack functions,  Up: Floating-Point Objects

7.10.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:

   * The 2-byte format is the IEEE 754 binary16 half-precision format.

   * The 4-byte format is the IEEE 754 binary32 single-precision format.

   * The 8-byte format is the IEEE 754 binary64 double-precision format.

The NaN type may not be preserved on some platforms while unpacking
(signaling NaNs become quiet NaNs), for example on x86 systems in 32-bit
mode.

It's assumed that the double type has the IEEE 754 binary64 double
precision format.  What happens if it's not true is partly accidental
(alas).  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.  The packing of special numbers like INFs and NaNs (if
such things exist on the platform) may not be handled correctly, and
attempting to unpack a bytes string containing an IEEE INF or NaN may
raise an exception.

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.10.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').  Use the
‘PY_LITTLE_ENDIAN’ constant to select the native endian: it is equal to
‘0’ on big endian processor, or ‘1’ on little endian processor.

Return value: ‘0’ if all is OK, ‘-1’ if error (and an exception is set,
most likely *note OverflowError: c5b.).

 -- 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.

     'CPython 実装の詳細:' This function always succeeds in CPython.


File: python.info,  Node: Unpack functions,  Prev: Pack functions,  Up: Pack and Unpack functions

7.10.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').  Use the ‘PY_LITTLE_ENDIAN’ constant to select
the native endian: it is equal to ‘0’ on big endian processor, or ‘1’ on
little endian processor.

Return value: The unpacked double.  On error, this is ‘-1.0’ and *note
PyErr_Occurred(): 1ec4. is true (and an exception is set, most likely
*note OverflowError: c5b.).

'CPython 実装の詳細:' These functions always succeed in CPython.

 -- 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.10.2.10 複素数オブジェクト
............................

 -- C のデータ型: type PyComplexObject

     この *note PyObject: 1a6. のサブタイプは Python の複素数型を表現し
     ます。

      -- C のメンバ変数: *note Py_complex: 3c4. cval

          The complex number value, using the C *note Py_complex: 3c4.
          representation.

          バージョン 3.15 で非推奨、バージョン 3.20 で削除予定: Use
          *note PyComplex_AsCComplex(): 3c2. and *note
          PyComplex_FromCComplex(): 3c3. to convert a Python complex
          number to/from the C *note Py_complex: 3c4. representation.

 -- C 変数: *note PyTypeObject: e6f. PyComplex_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは Python の複素数型を表現します。 Pythonレイヤ
     の *note complex: 330. と同じオブジェクトです。

 -- C の関数: int PyComplex_Check (PyObject *p)

     引数が *note PyComplexObject: 3c1. か ‘PyComplexObject’ のサブタイ
     プであるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyComplex_CheckExact (PyObject *p)

     引数が *note PyComplexObject: 3c1. であるが ‘PyComplexObject’ のサ
     ブタイプでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyComplex_FromDoubles (double real,
          double imag)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Return a new *note PyComplexObject: 3c1. object from 'real' and
     'imag'.  Return ‘NULL’ with an exception set on error.

 -- C の関数: double PyComplex_RealAsDouble (PyObject *op)
     ' 次に属します: *note Stable ABI: 961.'  'op' の実数部分を C の
     double 型で返します。

     If 'op' is not a Python complex number object but has a *note
     __complex__(): 9e3. 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():
     e32. and returns its result.

     Upon failure, this method returns ‘-1.0’ with an exception set, so
     one should call *note PyErr_Occurred(): 1ec4. to check for errors.

     バージョン 3.13 で変更: Use *note __complex__(): 9e3. if available.

 -- C の関数: double PyComplex_ImagAsDouble (PyObject *op)
     ' 次に属します: *note Stable ABI: 961.'  'op' の虚数部分を C の
     double 型で返します。

     If 'op' is not a Python complex number object but has a *note
     __complex__(): 9e3. 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():
     e32. and returns ‘0.0’ on success.

     Upon failure, this method returns ‘-1.0’ with an exception set, so
     one should call *note PyErr_Occurred(): 1ec4. to check for errors.

     バージョン 3.13 で変更: Use *note __complex__(): 9e3. if available.

 -- C のデータ型: type Py_complex

     This C structure defines an export format for a Python complex
     number object.

      -- C のメンバ変数: double real
      -- C のメンバ変数: double imag

     The structure is defined as:

          typedef struct {
              double real;
              double imag;
          } Py_complex;

 -- C の関数: *note PyObject: 1a6. *PyComplex_FromCComplex (Py_complex
          v)
     '戻り値: 新しい参照。' Create a new Python complex number object
     from a C *note Py_complex: 3c4. value.  Return ‘NULL’ with an
     exception set on error.

 -- C の関数: *note Py_complex: 3c4. PyComplex_AsCComplex (PyObject *op)

     複素数値 'op' から *note Py_complex: 3c4. 型を生成します。

     If 'op' is not a Python complex number object but has a *note
     __complex__(): 9e3. 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__(): d96.  If
     ‘__float__()’ is not defined then it falls back to *note
     __index__(): 444.

     Upon failure, this method returns *note Py_complex: 3c4. with *note
     real: 56a4. set to ‘-1.0’ and with an exception set, so one should
     call *note PyErr_Occurred(): 1ec4. to check for errors.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 444. を使う
     ようになりました。

* Menu:

* C 構造体としての複素数::


File: python.info,  Node: C 構造体としての複素数,  Up: 複素数オブジェクト

7.10.2.11 C 構造体としての複素数
................................

The API also provides functions for working with complex numbers, using
the *note Py_complex: 3c4. representation.  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.

Please note, that these functions are *note soft deprecated: 1b2. since
Python 3.15.  Avoid using this API in a new code to do complex
arithmetic: either use the Number Protocol(1) API or use native complex
types, like double complex.

 -- C の関数: *note Py_complex: 3c4. _Py_c_sum (Py_complex left,
          Py_complex right)

     二つの複素数の和を C の *note Py_complex: 3c4. 型で返します。

     バージョン 3.15 で非推奨.

 -- C の関数: *note Py_complex: 3c4. _Py_c_diff (Py_complex left,
          Py_complex right)

     二つの複素数の差を C の *note Py_complex: 3c4. 型で返します。

     バージョン 3.15 で非推奨.

 -- C の関数: *note Py_complex: 3c4. _Py_c_neg (Py_complex num)

     複素数 'num' の符号反転 C の *note Py_complex: 3c4. 型で返します。

     バージョン 3.15 で非推奨.

 -- C の関数: *note Py_complex: 3c4. _Py_c_prod (Py_complex left,
          Py_complex right)

     二つの複素数の積を C の *note Py_complex: 3c4. 型で返します。

     バージョン 3.15 で非推奨.

 -- C の関数: *note Py_complex: 3c4. _Py_c_quot (Py_complex dividend,
          Py_complex divisor)

     二つの複素数の商を C の *note Py_complex: 3c4. 型で返します。

     'divisor' が null の場合は、このメソッドはゼロを返し、 ‘errno’ に
     ‘EDOM’ をセットします。

     バージョン 3.15 で非推奨.

 -- C の関数: *note Py_complex: 3c4. _Py_c_pow (Py_complex num,
          Py_complex exp)

     指数 'exp' の 'num' 乗を C の *note Py_complex: 3c4. 型で返します。

     'num' が null で 'exp' が正の実数でない場合は、このメソッドはゼロを
     返し、 ‘errno’ に ‘EDOM’ をセットします。

     Set ‘errno’ to ‘ERANGE’ on overflows.

     バージョン 3.15 で非推奨.

 -- C の関数: double _Py_c_abs (Py_complex num)

     Return the absolute value of the complex number 'num'.

     Set ‘errno’ to ‘ERANGE’ on overflows.

     バージョン 3.15 で非推奨.

   ---------- Footnotes ----------

   (1) number


File: python.info,  Node: シーケンスオブジェクト sequence object,  Next: Container オブジェクト,  Prev: 数値型オブジェクト numeric object,  Up: 具象オブジェクト concrete object レイヤ

7.10.3 シーケンスオブジェクト (sequence object)
-----------------------------------------------

シーケンスオブジェクトに対する一般的な操作については前の章ですでに述べま
した; この節では、Python 言語にもともと備わっている特定のシーケンスオブ
ジェクトについて扱います。

* Menu:

* バイトオブジェクト: バイトオブジェクト<2>.
* PyBytesWriter::
* bytearray オブジェクト: bytearray オブジェクト<2>.
* Unicode オブジェクトと codec::
* タプルオブジェクト (tuple object): タプルオブジェクト tuple object.
* Struct Sequence オブジェクト::
* リストオブジェクト::


File: python.info,  Node: バイトオブジェクト<2>,  Next: PyBytesWriter,  Up: シーケンスオブジェクト sequence object

7.10.3.1 バイトオブジェクト
...........................

下記の関数は、バイトオブジェクトを期待している引数にバイトオブジェクトで
ないパラメタを指定して呼び出されると、 *note TypeError: 29c. を送出しま
す。

 -- C のデータ型: type PyBytesObject

     この *note PyObject: 1a6. のサブタイプは、Python バイトオブジェクト
     を表します。

 -- C 変数: *note PyTypeObject: e6f. PyBytes_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは、Python バイト型を表します; Pythonレイヤの
     *note bytes: 1d2. と同じオブジェクトです。

 -- C の関数: int PyBytes_Check (PyObject *o)

     オブジェクト 'o' が bytes オブジェクトか bytes 型のサブタイプのイン
     スタンスである場合に真を返します。この関数は常に成功します。

 -- C の関数: int PyBytes_CheckExact (PyObject *o)

     オブジェクト 'o' が bytes オブジェクトだが bytes 型のサブタイプのイ
     ンスタンスでない場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyBytes_FromString (const char *v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  成功時に、文字列 'v' のコピー
     を値とする新しいバイトオブジェクトを返し、失敗時に ‘NULL’ を返しま
     す。 引数 'v' は ‘NULL’ であってはなりません; そのチェックは行われ
     ません。

 -- C の関数: *note PyObject: 1a6. *PyBytes_FromStringAndSize (const
          char *v, Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  成功時に、文字列 'v' のコピー
     を値とする長さ 'len' の新しいバイトオブジェクトを返し、失敗時に
     ‘NULL’ を返します。 引数 'v' が ‘NULL’ の場合、バイトオブジェクトの
     中身は初期化されていません。

     *note Soft deprecated: 1b2. since version 3.15: Use the *note
     PyBytesWriter: 3bc. API instead of ‘PyBytes_FromStringAndSize(NULL,
     len)’.

 -- C の関数: *note PyObject: 1a6. *PyBytes_FromFormat (const char
          *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  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: e28.‘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: 1a6. *PyBytes_FromFormatV (const char
          *format, va_list vargs)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  ちょうど２つの引数を取ることを
     除いて、 *note PyBytes_FromFormat(): 2019. と同じです。

 -- C の関数: *note PyObject: 1a6. *PyBytes_FromObject (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe for concurrent use on the same object:
     293e.'  バッファプロトコルを実装するオブジェクト '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: e28. PyBytes_Size (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  バイトオブジェクト 'o' のバイト単位の長さを返します
     。

 -- C の関数: *note Py_ssize_t: e28. PyBytes_GET_SIZE (PyObject *o)
     ' Thread safety: *note Atomic: 2943.'  *note PyBytes_Size(): 52bb.
     に似ていますが、エラーチェックを行いません。

 -- C の関数: char *PyBytes_AsString (PyObject *o)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     2937.'  'o' の中身へのポインタを返します。 ポインタは、 ‘len(o) +
     1’ バイトからなる 'o' の内部バッファを参照します。 他に null のバイ
     トがあるかどうかにかかわらず、バッファの最後のバイトは必ず null に
     なります。 ‘PyBytes_FromStringAndSize(NULL, size)’ で生成された場合
     を除いて、データを修正してはなりません。 またポインタを解放（
     deallocated）してはなりません。 もし、 'o' が bytes オブジェクトで
     なければ、 *note PyBytes_AsString(): c61. は ‘NULL’ を返し *note
     TypeError: 29c. を送出します。

 -- C の関数: char *PyBytes_AS_STRING (PyObject *string)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  *note PyBytes_AsString():
     c61. に似ていますが、エラーチェックを行いません。

 -- C の関数: int PyBytes_AsStringAndSize (PyObject *obj, char **buffer,
          Py_ssize_t *length)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     2937.'  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: 15a. を送出します。

     buffer は 'obj' の内部バッファを参照していて、これには末尾の null バ
     イトも含んでいます (これは 'length' には数えられません)。 オブジェ
     クトが ‘PyBytes_FromStringAndSize(NULL, size)’ で生成された場合を除
     いて、何があってもデータを改変してはいけません。 オブジェクトを解放
     (deallocate) してもいけません。 'obj' が bytes オブジェクトでなかっ
     た場合は、 *note PyBytes_AsStringAndSize(): 52b3. は ‘-1’ を返し
     *note TypeError: 29c. を送出します。

     バージョン 3.5 で変更: 以前は bytes オブジェクトにヌルバイトが埋め
     込まれていたときに *note TypeError: 29c. を送出していました。

 -- C の関数: void PyBytes_Concat (PyObject **bytes, PyObject *newpart)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  '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: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  Create a new bytes
     object in '*bytes' containing the contents of 'newpart' appended to
     'bytes'.  This version releases the *note strong reference: 7e0. 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: 1a6. *PyBytes_Join (PyObject *sep,
          PyObject *iterable)
     ' Thread safety: *note Safe for concurrent use on the same object:
     293e.'  Similar to ‘sep.join(iterable)’ in Python.

     'sep' must be Python *note bytes: 1d2. object.  (Note that *note
     PyUnicode_Join(): 1560. accepts ‘NULL’ separator and treats it as a
     space, whereas *note PyBytes_Join(): 5b7. doesn't accept ‘NULL’
     separator.)

     'iterable' must be an iterable object yielding objects that
     implement the *note buffer protocol: 319.

     On success, return a new *note bytes: 1d2. 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: 293c.'  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: 191d. is set, and ‘-1’ is returned.

     *note Soft deprecated: 1b2. since version 3.15: Use the *note
     PyBytesWriter: 3bc. API instead.

 -- C の関数: *note PyObject: 1a6. *PyBytes_Repr (PyObject *bytes, int
          smartquotes)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  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: 7e0. to
     a *note str: 1ea. object containing the representation.  On
     failure, this returns ‘NULL’ with an exception set.

 -- C の関数: *note PyObject: 1a6. *PyBytes_DecodeEscape (const char *s,
          Py_ssize_t len, const char *errors, Py_ssize_t unicode, const
          char *recode_encoding)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  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: 7e0. to
     a Python *note bytes: 1d2. 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: PyBytesWriter,  Next: bytearray オブジェクト<2>,  Prev: バイトオブジェクト<2>,  Up: シーケンスオブジェクト sequence object

7.10.3.2 PyBytesWriter
......................

The *note PyBytesWriter: 3bc. API can be used to create a Python *note
bytes: 1d2. object.

Added in version 3.15.

 -- C のデータ型: type PyBytesWriter

     A bytes writer instance.

     The API is 'not thread safe': a writer should only be used by a
     single thread at the same time.

     The instance must be destroyed by *note PyBytesWriter_Finish():
     368. on success, or *note PyBytesWriter_Discard(): 365. on error.

* Menu:

* Create, Finish, Discard: Create Finish Discard.
* 高レベルAPI::
* Getters::
* 低レベルAPI::


File: python.info,  Node: Create Finish Discard,  Next: 高レベルAPI,  Up: PyBytesWriter

7.10.3.3 Create, Finish, Discard
................................

 -- C の関数: *note PyBytesWriter: 3bc. *PyBytesWriter_Create
          (Py_ssize_t size)

     Create a *note PyBytesWriter: 3bc. to write 'size' bytes.

     If 'size' is greater than zero, allocate 'size' bytes, and set the
     writer size to 'size'.  The caller is responsible to write 'size'
     bytes using *note PyBytesWriter_GetData(): 36a.  This function does
     not overallocate.

     On error, set an exception and return ‘NULL’.

     'size' must be positive or zero.

 -- C の関数: *note PyObject: 1a6. *PyBytesWriter_Finish (PyBytesWriter
          *writer)

     Finish a *note PyBytesWriter: 3bc. created by *note
     PyBytesWriter_Create(): 364.

     On success, return a Python *note bytes: 1d2. object.  On error,
     set an exception and return ‘NULL’.

     The writer instance is invalid after the call in any case.  No API
     can be called on the writer after *note PyBytesWriter_Finish():
     368.

 -- C の関数: *note PyObject: 1a6. *PyBytesWriter_FinishWithSize
          (PyBytesWriter *writer, Py_ssize_t size)

     Similar to *note PyBytesWriter_Finish(): 368, but resize the writer
     to 'size' bytes before creating the *note bytes: 1d2. object.

 -- C の関数: *note PyObject: 1a6. *PyBytesWriter_FinishWithPointer
          (PyBytesWriter *writer, void *buf)

     Similar to *note PyBytesWriter_Finish(): 368, but resize the writer
     using 'buf' pointer before creating the *note bytes: 1d2. object.

     Set an exception and return ‘NULL’ if 'buf' pointer is outside the
     internal buffer bounds.

     Function pseudo-code:

          Py_ssize_t size = (char*)buf - (char*)PyBytesWriter_GetData(writer);
          return PyBytesWriter_FinishWithSize(writer, size);

 -- C の関数: void PyBytesWriter_Discard (PyBytesWriter *writer)

     Discard a *note PyBytesWriter: 3bc. created by *note
     PyBytesWriter_Create(): 364.

     Do nothing if 'writer' is ‘NULL’.

     The writer instance is invalid after the call.  No API can be
     called on the writer after *note PyBytesWriter_Discard(): 365.


File: python.info,  Node: 高レベルAPI,  Next: Getters,  Prev: Create Finish Discard,  Up: PyBytesWriter

7.10.3.4 高レベルAPI
....................

 -- C の関数: int PyBytesWriter_WriteBytes (PyBytesWriter *writer, const
          void *bytes, Py_ssize_t size)

     Grow the 'writer' internal buffer by 'size' bytes, write 'size'
     bytes of 'bytes' at the 'writer' end, and add 'size' to the
     'writer' size.

     If 'size' is equal to ‘-1’, call ‘strlen(bytes)’ to get the string
     length.

     On success, return ‘0’.  On error, set an exception and return
     ‘-1’.

 -- C の関数: int PyBytesWriter_Format (PyBytesWriter *writer, const
          char *format, ...)

     Similar to *note PyBytes_FromFormat(): 2019, but write the output
     directly at the writer end.  Grow the writer internal buffer on
     demand.  Then add the written size to the writer size.

     On success, return ‘0’.  On error, set an exception and return
     ‘-1’.


File: python.info,  Node: Getters,  Next: 低レベルAPI,  Prev: 高レベルAPI,  Up: PyBytesWriter

7.10.3.5 Getters
................

 -- C の関数: *note Py_ssize_t: e28. PyBytesWriter_GetSize
          (PyBytesWriter *writer)

     Get the writer size.

     The function cannot fail.

 -- C の関数: void *PyBytesWriter_GetData (PyBytesWriter *writer)

     Get the writer data: start of the internal buffer.

     The pointer is valid until *note PyBytesWriter_Finish(): 368. or
     *note PyBytesWriter_Discard(): 365. is called on 'writer'.

     The function cannot fail.


File: python.info,  Node: 低レベルAPI,  Prev: Getters,  Up: PyBytesWriter

7.10.3.6 低レベルAPI
....................

 -- C の関数: int PyBytesWriter_Resize (PyBytesWriter *writer,
          Py_ssize_t size)

     Resize the writer to 'size' bytes.  It can be used to enlarge or to
     shrink the writer.  This function typically overallocates to
     achieve amortized performance when resizing multiple times.

     Newly allocated bytes are left uninitialized.

     On success, return ‘0’.  On error, set an exception and return
     ‘-1’.

     'size' must be positive or zero.

 -- C の関数: int PyBytesWriter_Grow (PyBytesWriter *writer, Py_ssize_t
          grow)

     Resize the writer by adding 'grow' bytes to the current writer
     size.  This function typically overallocates to achieve amortized
     performance when resizing multiple times.

     Newly allocated bytes are left uninitialized.

     On success, return ‘0’.  On error, set an exception and return
     ‘-1’.

     'size' can be negative to shrink the writer.

 -- C の関数: void *PyBytesWriter_GrowAndUpdatePointer (PyBytesWriter
          *writer, Py_ssize_t size, void *buf)

     Similar to *note PyBytesWriter_Grow(): 36d, but update also the
     'buf' pointer.

     The 'buf' pointer is moved if the internal buffer is moved in
     memory.  The 'buf' relative position within the internal buffer is
     left unchanged.

     On error, set an exception and return ‘NULL’.

     'buf' must not be ‘NULL’.

     Function pseudo-code:

          Py_ssize_t pos = (char*)buf - (char*)PyBytesWriter_GetData(writer);
          if (PyBytesWriter_Grow(writer, size) < 0) {
              return NULL;
          }
          return (char*)PyBytesWriter_GetData(writer) + pos;


File: python.info,  Node: bytearray オブジェクト<2>,  Next: Unicode オブジェクトと codec,  Prev: PyBytesWriter,  Up: シーケンスオブジェクト sequence object

7.10.3.7 bytearray オブジェクト
...............................

 -- C のデータ型: type PyByteArrayObject

     この *note PyObject: 1a6. のサブタイプは Python の bytearray オブジ
     ェクトを表します。

 -- C 変数: *note PyTypeObject: e6f. PyByteArray_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは、 Python bytearray 型を示します。 Python レイ
     ヤでの *note bytearray: 1d1. と同じオブジェクトです。

* Menu:

* 型チェックマクロ::
* ダイレクト API 関数::
* マクロ::


File: python.info,  Node: 型チェックマクロ,  Next: ダイレクト API 関数,  Up: bytearray オブジェクト<2>

7.10.3.8 型チェックマクロ
.........................

 -- 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.10.3.9 ダイレクト API 関数
............................

 -- C の関数: *note PyObject: 1a6. *PyByteArray_FromObject (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe for concurrent use on the same object:
     293e.'  *note buffer protocol: 319. を実装した任意のオブジェクト
     '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: 1a6. *PyByteArray_FromStringAndSize (const
          char *string, Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  Create a new bytearray object
     from 'string' and its length, 'len'.

     On failure, return ‘NULL’ with an exception set.

 -- C の関数: *note PyObject: 1a6. *PyByteArray_Concat (PyObject *a,
          PyObject *b)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe for concurrent use on the same object:
     293e.'  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: e28. PyByteArray_Size (PyObject
          *bytearray)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  ‘NULL’ ポインタチェックの後に 'bytearray' のサイズ
     を返します。

 -- C の関数: char *PyByteArray_AsString (PyObject *bytearray)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     2937.'  ‘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: 961.'  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.10.3.10 マクロ
................

以下のマクロは、ポインタのチェックをしないことにより安全性を犠牲にしてス
ピードを優先しています。

 -- C の関数: char *PyByteArray_AS_STRING (PyObject *bytearray)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  *note
     PyByteArray_AsString(): 52ad. に似ていますが、エラーチェックを行い
     ません。

          注釈: It is not thread-safe to mutate the bytearray object
          while using the returned char array.

 -- C の関数: *note Py_ssize_t: e28. PyByteArray_GET_SIZE (PyObject
          *bytearray)
     ' Thread safety: *note Atomic: 2943.'  *note PyByteArray_Size():
     52b0. に似ていますが、エラーチェックを行いません。


File: python.info,  Node: Unicode オブジェクトと codec,  Next: タプルオブジェクト tuple object,  Prev: bytearray オブジェクト<2>,  Up: シーケンスオブジェクト sequence object

7.10.3.11 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.10.3.12 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: b7f. 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.10.3.13 Unicode 型
....................

以下は Python の Unicode 実装に用いられている基本 Unicode オブジェクト型
です:

 -- C 変数: *note PyTypeObject: e6f. PyUnicode_Type
     ' 次に属します: *note Stable ABI: 961.'  This instance of *note
     PyTypeObject: e6f. represents the Python Unicode type.  It is
     exposed to Python code as *note str: 1ea.

 -- C 変数: *note PyTypeObject: e6f. PyUnicodeIter_Type
     ' 次に属します: *note Stable ABI: 961.'  This instance of *note
     PyTypeObject: e6f. 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: 961.'  これらの型は、それぞれ、
     32ビット、16ビット、そして8ビットの文字を保持するのに充分な幅を持つ
     符号なしの整数型のtypedefです。単一のUnicode文字を扱う場合は、
     *note Py_UCS4: 30d. を用いてください。

     Added in version 3.3.

 -- C のデータ型: type PyASCIIObject
 -- C のデータ型: type PyCompactUnicodeObject
 -- C のデータ型: type PyUnicodeObject

     これらの *note PyObject: 1a6. のサブタイプは 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: 1534.
          structure.

          Added in version 3.3.

      -- C のマクロ: PyUnicode_IS_COMPACT_ASCII (o)

          True if 'o' uses the *note PyASCIIObject: 1533. 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: e28. PyUnicode_GET_LENGTH (PyObject
          *unicode)

     Unicode 文字列のコードポイントでの長さを返します。 'unicode' は "正
     統な" 表現形式の Unicode オブジェクトでなければなりません (ただしチ
     ェックはしません)。

     Added in version 3.3.

 -- C の関数: *note Py_UCS1: 1531. *PyUnicode_1BYTE_DATA (PyObject
          *unicode)
 -- C の関数: *note Py_UCS2: 1532. *PyUnicode_2BYTE_DATA (PyObject
          *unicode)
 -- C の関数: *note Py_UCS4: 30d. *PyUnicode_4BYTE_DATA (PyObject
          *unicode)

     文字に直接アクセスするために、 UCS1, UCS2, UCS4 のいずれかの整数型
     にキャストされた正統な表現形式へのポインタを返します。 正統な表現が
     適正な文字サイズになっているかどうかのチェックはしません; *note
     PyUnicode_KIND(): 153b. を使って正しい関数を選んでください。

     Added in version 3.3.

 -- C のマクロ: PyUnicode_1BYTE_KIND
 -- C のマクロ: PyUnicode_2BYTE_KIND
 -- C のマクロ: PyUnicode_4BYTE_KIND

     *note PyUnicode_KIND(): 153b. マクロの返り値です。

     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(): 153b. and *note
     PyUnicode_DATA(): 1537. respectively.  You must hold a reference to
     that string while calling ‘PyUnicode_WRITE()’.  All requirements of
     *note PyUnicode_WriteChar(): 1530. 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: 30d. PyUnicode_READ (int kind, void *data,
          Py_ssize_t index)

     正統な表現形式となっている (*note PyUnicode_DATA(): 1537. で取得し
     た) 'data' からコードポイントを読み取ります。 チェックや事前確認の
     マクロ呼び出しは一切行われません。

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 30d. PyUnicode_READ_CHAR (PyObject
          *unicode, Py_ssize_t index)

     Unicode オブジェクト 'unicode' から文字を読み取ります。 この
     Unicode オブジェクトは "正統な" 表現形式でなければなりません。 何度
     も連続して読み取る場合には、このマクロは *note PyUnicode_READ():
     153f. よりも非効率的です。

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 30d. PyUnicode_MAX_CHAR_VALUE (PyObject
          *unicode)

     'unicode' に基づいて他の文字列を作るのに適した最大のコードポイント
     を返します。 この Unicode オブジェクトは "正統な" 表現形式でなけれ
     ばなりません。 この値は常に概算値ですが、文字列全体を調べるよりも効
     率的です。

     Added in version 3.3.

 -- C の関数: int PyUnicode_IsIdentifier (PyObject *unicode)
     ' 次に属します: *note Stable ABI: 961.'  文字列が、 *note Names
     (identifiers and keywords): 24af. 節の言語定義における有効な識別子
     であれば ‘1’ を返します。それ以外の場合は ‘0’ を返します。

     バージョン 3.9 で変更: The function does not call *note
     Py_FatalError(): d4f. 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(): ebb.

     Added in version 3.2.

 -- C の関数: *note Py_hash_t: 161d. PyUnstable_Unicode_GET_CACHED_HASH
          (PyObject *str)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     If the hash of 'str', as returned by *note PyObject_Hash(): 650,
     has been cached and is immediately available, return it.
     Otherwise, return ‘-1’ 'without' setting an exception.

     If 'str' is not a string (that is, if ‘PyUnicode_Check(obj)’ is
     false), the behavior is undefined.

     This function never fails with an exception.

     Note that there are no guarantees on when an object's hash is
     cached, and the (non-)existence of a cached hash does not imply
     that the string has any other properties.


File: python.info,  Node: Unicode 文字プロパティ,  Next: Unicode 文字列の生成とアクセス,  Prev: Unicode 型,  Up: Unicode オブジェクト

7.10.3.14 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(): 1195.

以下の API は、高速に直接文字変換を行うために使われます:

 -- C の関数: *note Py_UCS4: 30d. Py_UNICODE_TOLOWER (Py_UCS4 ch)

     'ch' を小文字に変換したものを返します。

 -- C の関数: *note Py_UCS4: 30d. Py_UNICODE_TOUPPER (Py_UCS4 ch)

     'ch' を大文字に変換したものを返します。

 -- C の関数: *note Py_UCS4: 30d. 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: 30d. 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: 30d. 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: 30d. Py_UNICODE_JOIN_SURROGATES (Py_UCS4
          high, Py_UCS4 low)

     Join two surrogate code points and return a single *note Py_UCS4:
     30d. 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.10.3.15 Unicode 文字列の生成とアクセス
........................................

Unicode オブジェクトを生成したり、Unicode のシーケンスとしての基本的なプ
ロパティにアクセスしたりするには、以下の API を使ってください:

 -- C の関数: *note PyObject: 1a6. *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(): 1530, *note PyUnicode_CopyCharacters(): c8c,
     *note PyUnicode_Fill(): 154b, *note PyUnicode_WRITE(): 1541. 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: c73, 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: 5e7. API, or one of the
     ‘PyUnicode_From*’ functions below.

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_FromKindAndData (int kind,
          const void *buffer, Py_ssize_t size)
     '戻り値: 新しい参照。' 与えられた 'kind' (取り得る値は *note
     PyUnicode_1BYTE_KIND: 153c. などの *note PyUnicode_KIND(): 153b. が
     返す値です) の 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: 153e.) and it consists only of
     codepoints in the UCS1 range, it will be transformed into UCS1
     (*note PyUnicode_1BYTE_KIND: 153c.).

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_FromStringAndSize (const
          char *str, Py_ssize_t size)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 3f1. when:

        * 'size' < 0,

        * 'str' is ‘NULL’ and 'size' > 0

     バージョン 3.12 で変更: 'str' == ‘NULL’ with 'size' > 0 is not
     allowed anymore.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_FromString (const char
          *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     UTF-8 エンコードされたnull終端のchar 型バッファ 'str' から Unicode
     オブジェクトを生成します。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_FromFormat (const char
          *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  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: 1a6.*                 *note ascii(): 179f. の戻り値。
                                                                                 
                                                                                 
     ‘U’                                   *note PyObject: 1a6.*                 Unicode オブジェクト。
                                                                                 
                                                                                 
     ‘V’                                   *note PyObject: 1a6.*, 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: 1a6.*                 *note PyObject_Str(): 13dc. の戻り
                                                                                 値。
                                                                                 
                                                                                 
     ‘R’                                   *note PyObject: 1a6.*                 *note PyObject_Repr(): 13db. の戻り
                                                                                 値。
                                                                                 
                                                                                 
     ‘T’                                   *note PyObject: 1a6.*                 Get the fully qualified name of an
                                                                                 object type; call
                                                                                 *note PyType_GetFullyQualifiedName(): 810.
                                                                                 
                                                                                 
     ‘#T’                                  *note PyObject: 1a6.*                 Similar to ‘T’ format, but use a
                                                                                 colon (‘:’) as separator between
                                                                                 the module name and the qualified
                                                                                 name.
                                                                                 
                                                                                 
     ‘N’                                   *note PyTypeObject: e6f.*             Get the fully qualified name of a
                                                                                 type; call
                                                                                 *note PyType_GetFullyQualifiedName(): 810.
                                                                                 
                                                                                 
     ‘#N’                                  *note PyTypeObject: e6f.*             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: 3f1.
     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: 1a6. *PyUnicode_FromFormatV (const char
          *format, va_list vargs)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  ちょ
     うど２つの引数を取ることを除いて、 *note PyUnicode_FromFormat():
     824. と同じです。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_FromObject (PyObject *obj)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  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: 7e0. to the object.

     Unicode やそのサブタイプ以外のオブジェクトでは *note TypeError:
     29c. が引き起こされます。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_FromOrdinal (int ordinal)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Create a Unicode Object from the given Unicode code point
     'ordinal'.

     The ordinal must be in ‘range(0x110000)’.  A *note ValueError: 15a.
     is raised in the case it is not.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_FromEncodedObject
          (PyObject *obj, const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  エン
     コードされている 'obj' を Unicode オブジェクトにデコードします。

     *note bytes: 1d2. や *note bytearray: 1d1. や他の *note bytes-like
     objects: 43d. は、与えられた 'encoding' に従ってデコードされ、
     'errors' で定義されたエラーハンドリングが使われます。 これらの引数
     は両方とも ‘NULL’ にでき、その場合この API はデフォルト値を使います
     (詳しことは *note 組み込み codec (built-in codec): 56e2. を参照して
     ください)。

     その他のUnicodeオブジェクトを含むオブジェクトは *note TypeError:
     29c. 例外を引き起こします。

     この API は、エラーが生じたときには ‘NULL’ を返します。呼び出し側は
     返されたオブジェクトに対し参照カウンタを 1 つ減らす (decref) する責
     任があります。

 -- C の関数: void PyUnicode_Append (PyObject **p_left, PyObject *right)
     ' 次に属します: *note Stable ABI: 961.'  Append the string 'right'
     to the end of 'p_left'.  'p_left' must point to a *note strong
     reference: 7e0. 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: 961.'  The function is similar to
     *note PyUnicode_Append(): 5442, with the only difference being that
     it decrements the reference count of 'right' by one.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_BuildEncodingMap (PyObject
          *string)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 29c. and return ‘NULL’ on
     invalid input.

     Added in version 3.2.

 -- C の関数: const char *PyUnicode_GetDefaultEncoding (void)
     ' 次に属します: *note Stable ABI: 961.'  Return the name of the
     default string encoding, ‘"utf-8"’.  See *note
     sys.getdefaultencoding(): 4c09.

     The returned string does not need to be freed, and is valid until
     interpreter shutdown.

 -- C の関数: *note Py_ssize_t: e28. PyUnicode_GetLength (PyObject
          *unicode)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'
     Unicode オブジェクトの長さをコードポイントで返します。

     On error, set an exception and return ‘-1’.

     Added in version 3.3.

 -- C の関数: *note Py_ssize_t: e28. 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(): c83. for details.

     Added in version 3.3.

 -- C の関数: int PyUnicode_Resize (PyObject **unicode, Py_ssize_t
          length);
     ' 次に属します: *note Stable ABI: 961.'  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: e28. 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(): c83. 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: 961. (バージョン 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(): 1541. for a version that
     skips these checks, making them your responsibility.

     The string must not have been “used” yet.  See *note
     PyUnicode_New(): c83. for details.

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 30d. PyUnicode_ReadChar (PyObject *unicode,
          Py_ssize_t index)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'  文
     字列から文字を読み取ります。 エラーチェックを行わない *note
     PyUnicode_READ_CHAR(): 1540. とは対照的に、この関数は 'unicode' が
     Unicode オブジェクトであること、インデックスが範囲内であることをチ
     ェックします。

     Return character on success, ‘-1’ on error with an exception set.

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_Substring (PyObject
          *unicode, Py_ssize_t start, Py_ssize_t end)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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: 30d. *PyUnicode_AsUCS4 (PyObject *unicode,
          Py_UCS4 *buffer, Py_ssize_t buflen, int copy_null)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 3f1. if
     'buflen' is smaller than the length of 'unicode').  'buffer' is
     returned on success.

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 30d. *PyUnicode_AsUCS4Copy (PyObject
          *unicode)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'  文
     字列 'unicode' を *note PyMem_Malloc(): 1027. でメモリ確保された新
     しい UCS4 型のバッファにコピーします。 これが失敗した場合は、
     ‘NULL’ を返し *note MemoryError: 191d. をセットします。 返されたバ
     ッファは必ず null コードポイントが追加されています。

     Added in version 3.3.


File: python.info,  Node: ロケールエンコーディング,  Next: ファイルシステムエンコーディング,  Prev: Unicode 文字列の生成とアクセス,  Up: Unicode オブジェクト

7.10.3.16 ロケールエンコーディング
..................................

現在のロケールエンコーディングはオペレーティングシステムのテキストをデコ
ードするのに使えます。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeLocaleAndSize (const
          char *str, Py_ssize_t length, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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(): 544d. to decode a
     string from the *note filesystem encoding and error handler: 94d.

     This function ignores the *note Python UTF-8 Mode: a4b.

     参考
     ....

     *note Py_DecodeLocale(): f89. 関数。

     Added in version 3.3.

     バージョン 3.7 で変更: この関数は、 Android 以外では現在のロケール
     エンコーディングを ‘surrogateescape’ エラーハンドラで使うようになり
     ました。 以前は、 *note Py_DecodeLocale(): f89. が
     ‘surrogateescape’ で使われ、現在のロケールエンコーディングは
     ‘strict’ で使われていました。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeLocale (const char
          *str, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  Similar to *note
     PyUnicode_DecodeLocaleAndSize(): f8b, but compute the string length
     using ‘strlen()’.

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_EncodeLocale (PyObject
          *unicode, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 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: 1d2. object.  'unicode' cannot
     contain embedded null characters.

     Use *note PyUnicode_EncodeFSDefault(): 203d. to encode a string to
     the *note filesystem encoding and error handler: 94d.

     This function ignores the *note Python UTF-8 Mode: a4b.

     参考
     ....

     *note Py_EncodeLocale(): f8a. 関数。

     Added in version 3.3.

     バージョン 3.7 で変更: この関数は、 Android 以外では現在のロケール
     エンコーディングを ‘surrogateescape’ エラーハンドラで使うようになり
     ました。 以前は、 *note Py_EncodeLocale(): f8a. が
     ‘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.10.3.17 ファイルシステムエンコーディング
..........................................

Functions encoding to and decoding from the *note filesystem encoding
and error handler: 94d. ( PEP 383(1) and PEP 529(2)).

To encode file names to *note bytes: 1d2. 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: 961.'  *note PyArg_Parse*
     converter: 608.: encode *note str: 1ea. objects - obtained directly
     or through the *note os.PathLike: 1013. interface - to *note bytes:
     1d2. using *note PyUnicode_EncodeFSDefault(): 203d.; ‘bytes’
     objects are output as-is.  'result' must be an address of a C
     variable of type *note PyObject: 1a6.* (or *note PyBytesObject:
     b76.*).  On success, set the variable to a new *note strong
     reference: 7e0. to a *note bytes object: 56ab. which must be
     released when it is no longer used and return a non-zero value
     (*note Py_CLEANUP_SUPPORTED: 55b2.).  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: 7a5. を受け入れるよ
     うになりました。

To decode file names to *note str: 1ea. 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: 961.'  *note PyArg_Parse*
     converter: 608.: decode *note bytes: 1d2. objects - obtained either
     directly or indirectly through the *note os.PathLike: 1013.
     interface - to *note str: 1ea. using *note
     PyUnicode_DecodeFSDefaultAndSize(): 544d.; ‘str’ objects are output
     as-is.  'result' must be an address of a C variable of type *note
     PyObject: 1a6.* (or *note PyUnicodeObject: b78.*).  On success, set
     the variable to a new *note strong reference: 7e0. to a *note
     Unicode object: 56c2. which must be released when it is no longer
     used and return a non-zero value (*note Py_CLEANUP_SUPPORTED:
     55b2.).  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: 7a5. を受け入れるよ
     うになりました。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeFSDefaultAndSize
          (const char *str, Py_ssize_t size)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Decode a string from the *note filesystem encoding and error
     handler: 94d.

     If you need to decode a string from the current locale encoding,
     use *note PyUnicode_DecodeLocaleAndSize(): f8b.

     参考
     ....

     *note Py_DecodeLocale(): f89. 関数。

     バージョン 3.6 で変更: The *note filesystem error handler: 94d. is
     now used.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeFSDefault (const
          char *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Decode a null-terminated string from the *note filesystem encoding
     and error handler: 94d.

     If the string length is known, use *note
     PyUnicode_DecodeFSDefaultAndSize(): 544d.

     バージョン 3.6 で変更: The *note filesystem error handler: 94d. is
     now used.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_EncodeFSDefault (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Encode a Unicode object to the *note filesystem encoding and error
     handler: 94d, and return *note bytes: 1d2.  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(): f8c.

     参考
     ....

     *note Py_EncodeLocale(): f8a. 関数。

     Added in version 3.2.

     バージョン 3.6 で変更: The *note filesystem error handler: 94d. 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.10.3.18 wchar_t サポート
..........................

‘wchar_t’ をサポートするプラットフォームでの wchar_t サポート:

 -- C の関数: *note PyObject: 1a6. *PyUnicode_FromWideChar (const
          wchar_t *wstr, Py_ssize_t size)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: e28. PyUnicode_AsWideChar (PyObject
          *unicode, wchar_t *wstr, Py_ssize_t size)
     ' 次に属します: *note Stable ABI: 961.'  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: 961. (バージョン 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: 15a. is raised.

     Returns a buffer allocated by *note PyMem_New: 18dc. (use *note
     PyMem_Free(): 17fa. to free it) on success.  On error, returns
     ‘NULL’ and '*size' is undefined.  Raises a *note MemoryError: 191d.
     if memory allocation is failed.

     Added in version 3.2.

     バージョン 3.7 で変更: Raises a *note ValueError: 15a. 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.10.3.19 組み込み codec (built-in codec)
.........................................

Python には、処理速度を高めるために C で書かれた codec が揃えてあります
。これら全ての codec は以下の関数を介して直接利用できます。

以下の API の多くが、 'encoding' と 'errors' という二つの引数をとります
。これらのパラメータは、組み込みの文字列コンストラクタである *note
str(): 1ea. における同名のパラメータと同じ意味を持ちます。

Setting encoding to ‘NULL’ causes the default encoding to be used which
is UTF-8.  The file system calls should use *note
PyUnicode_FSConverter(): 10d7. for encoding file names.  This uses the
*note filesystem encoding and error handler: 94d. internally.

'errors' で指定するエラー処理もまた、 ‘NULL’ を指定できます。 ‘NULL’ を
指定すると、codec で定義されているデフォルト処理の使用を意味します。全て
の組み込み codec で、デフォルトのエラー処理は "strict" (*note
ValueError: 15a. を送出する) になっています。

個々の 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.10.3.20 汎用 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: 1a6. *PyUnicode_Decode (const char *str,
          Py_ssize_t size, const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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(): 1ea. 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: 1a6. *PyUnicode_AsEncodedString (PyObject
          *unicode, const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Unicode オブジェクトをエンコードし、その結果を Python の bytes オブ
     ジェクトとして返します。 'encoding' および 'errors' は Unicode 型の
     *note encode(): cab. メソッドに与える同名のパラメータと同じ意味を持
     ちます。 使用する codec の検索は、 Python の codec レジストリを使っ
     て行います。 codec が例外を送出した場合には ‘NULL’ を返します。


File: python.info,  Node: UTF-8 Codecs,  Next: UTF-32 Codecs,  Prev: 汎用 codec,  Up: 組み込み codec built-in codec

7.10.3.21 UTF-8 Codecs
......................

以下は UTF-8 codec の APIです:

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeUTF8 (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     UTF-8 でエンコードされた 'size' バイトの文字列 'str' から Unicode オ
     ブジェクトを生成します。codec が例外を送出した場合には ‘NULL’ を返
     します。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeUTF8Stateful (const
          char *str, Py_ssize_t size, const char *errors, Py_ssize_t
          *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     'consumed' が ‘NULL’ の場合、 *note PyUnicode_DecodeUTF8(): 5459. と
     同じように動作します。 'consumed' が ‘NULL’ でない場合、末尾の不完
     全な UTF-8 バイト列はエラーとみなされません。これらのバイト列はデコ
     ードされず、デコードされたバイト数は 'consumed' に格納されます。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_AsUTF8String (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 961. (バージョン 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: 82f.

 -- C の関数: const char *PyUnicode_AsUTF8 (PyObject *unicode)

     *note PyUnicode_AsUTF8AndSize(): c73. とほぼ同じですが、サイズを格
     納しません。

          警告: 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(): c73.
          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.10.3.22 UTF-32 Codecs
.......................

以下は UTF-32 codec API です:

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeUTF32 (const char
          *str, Py_ssize_t size, const char *errors, int *byteorder)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyUnicode_DecodeUTF32Stateful (const
          char *str, Py_ssize_t size, const char *errors, int
          *byteorder, Py_ssize_t *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     'consumed' が ‘NULL’ のとき、 *note PyUnicode_DecodeUTF32(): 5455.
     と同じように振る舞います。 'consumed' が ‘NULL’ でないとき、 *note
     PyUnicode_DecodeUTF32Stateful(): 5456. は末尾の不完全な (4 で割り切
     れない長さのバイト列などの) UTF-32 バイト列をエラーとして扱いません
     。末尾の不完全なバイト列はデコードされず、デコードされたバイト数が
     'consumed' に格納されます。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_AsUTF32String (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  ネイ
     ティブバイトオーダーで 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.10.3.23 UTF-16 Codecs
.......................

以下は UTF-16 codec の APIです:

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeUTF16 (const char
          *str, Py_ssize_t size, const char *errors, int *byteorder)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyUnicode_DecodeUTF16Stateful (const
          char *str, Py_ssize_t size, const char *errors, int
          *byteorder, Py_ssize_t *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     'consumed' が ‘NULL’ の場合、 *note PyUnicode_DecodeUTF16(): 5453.
     と同じように動作します。 'consumed' が ‘NULL’ でない場合、 *note
     PyUnicode_DecodeUTF16Stateful(): 5454. は末尾の不完全な UTF-16 バイ
     ト列 (奇数長のバイト列や分割されたサロゲートペア) をエラーとみなし
     ません。これらのバイト列はデコードされず、デコードされたバイト数を
     'consumed' に返します。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_AsUTF16String (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  ネイ
     ティブバイトオーダーで 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.10.3.24 UTF-7 Codecs
......................

以下は UTF-7 codec の API です:

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeUTF7 (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyUnicode_DecodeUTF7Stateful (const
          char *str, Py_ssize_t size, const char *errors, Py_ssize_t
          *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     'consumed' が ‘NULL’ のとき、 *note PyUnicode_DecodeUTF7(): 5457. と
     同じように動作します。 '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.10.3.25 Unicode-Escape Codecs
...............................

以下は "Unicode Escape" codec の API です:

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeUnicodeEscape (const
          char *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyUnicode_AsUnicodeEscapeString
          (PyObject *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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.10.3.26 Raw-Unicode-Escape Codecs
...................................

以下は "Raw Unicode Escape" codec の APIです:

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeRawUnicodeEscape
          (const char *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyUnicode_AsRawUnicodeEscapeString
          (PyObject *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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.10.3.27 Latin-1 Codecs
........................

以下は Latin-1 codec の APIです: Latin-1 は、 Unicode 序数の最初の 256 個
に対応し、エンコード時にはこの 256 個だけを受理します。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeLatin1 (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Latin-1 でエンコードされた 'size' バイトの文字列 'str' から Unicode
     オブジェクトを生成します。codec が例外を送出した場合には ‘NULL’ を
     返します。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_AsLatin1String (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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.10.3.28 ASCII Codecs
......................

以下は ASCII codec の APIです。 7 ビットの ASCII データだけを受理します
。その他のコードはエラーになります。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeASCII (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyUnicode_AsASCIIString (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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.10.3.29 Character Map Codecs
..............................

この codec は、多くの様々な codec を実装する際に使われるという点で特殊な
codec です (実際、 ‘encodings’ パッケージに入っている標準 codecs のほと
んどは、この codec を使っています)。 この codec は、文字のエンコードやデ
コードに対応表を使います。 提供される対応表のオブジェクトは *note
__getitem__(): 78d. マッピングインターフェースをサポートしていなければな
りません; 辞書やシーケンスがそれに適しています。

以下は mapping codec の APIです:

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeCharmap (const char
          *str, Py_ssize_t length, PyObject *mapping, const char
          *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  与え
     られた '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: 25f9, as well as ones which get mapped
     to ‘None’, ‘0xFFFE’ or ‘'\ufffe'’, are treated as undefined
     mappings and cause an error.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_AsCharmapString (PyObject
          *unicode, PyObject *mapping)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 25f9.) as
     well as mapped to ‘None’ are treated as "undefined mapping" and
     cause an error.

以下の codec API は Unicode から Unicode への対応付けを行う特殊なもので
す。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_Translate (PyObject
          *unicode, PyObject *table, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  文字
     列に文字対応表 'table' を適用して変換し、変換結果を Unicode オブジ
     ェクトで返します。codec が例外を発行した場合には ‘NULL’ を返します
     。

     対応表は、Unicode 序数を表す整数を Unicode 序数を表す整数または
     ‘None’ (その文字を削除する) に対応付けなければなりません。

     Mapping tables need only provide the *note __getitem__(): 78d.
     interface; dictionaries and sequences work well.  Unmapped
     character ordinals (ones which cause a *note LookupError: 25f9.)
     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.10.3.30 Windows 用の MBCS codec
.................................

以下は MBCS codec の API です。この codec は現在のところ、 Windows 上だ
けで利用でき、変換の実装には Win32 MBCS 変換機構 (Win32 MBCS converter)
を使っています。 MBCS (または DBCS) はエンコード方式の種類 (class) を表
す言葉で、単一のエンコード方式を表すわけでなないので注意してください。利
用されるエンコード方式 (target encoding) は、 codec を動作させているマシ
ン上のユーザ設定で定義されています。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeMBCS (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. 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: 1a6. *PyUnicode_DecodeMBCSStateful (const
          char *str, Py_ssize_t size, const char *errors, Py_ssize_t
          *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  'consumed' が ‘NULL’ のとき、
     *note PyUnicode_DecodeMBCS(): 5450. と同じ動作をします。 'consumed'
     が ‘NULL’ でないとき、 *note PyUnicode_DecodeMBCSStateful(): 5451.
     は文字列の最後にあるマルチバイト文字の前半バイトをデコードせず、
     'consumed' にデコードしたバイト数を格納します。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_DecodeCodePageStateful
          (int code_page, const char *str, Py_ssize_t size, const char
          *errors, Py_ssize_t *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  Similar to *note
     PyUnicode_DecodeMBCSStateful(): 5451, except uses the code page
     specified by 'code_page'.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_AsMBCSString (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. on
     Windows (バージョン 3.7 より).'  MBCS で Unicode オブジェクトをエン
     コードし、結果を Python バイト列オブジェクトとして返します。エラー
     処理は "strict" です。 codec が例外を送出した場合には ‘NULL’ を返し
     ます。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_EncodeCodePage (int
          code_page, PyObject *unicode, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. 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.10.3.31 メソッドおよびスロット関数 (slot function)
....................................................

以下の API は Unicode オブジェクトおよび文字列を入力に取り (説明では、ど
ちらも文字列と表記しています)、場合に応じて Unicode オブジェクトか整数を
返す機能を持っています。

これらの関数は全て、例外が発生した場合には ‘NULL’ または ‘-1’ を返します
。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_Concat (PyObject *left,
          PyObject *right)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  二つ
     の文字列を結合して、新たな Unicode 文字列を生成します。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_Split (PyObject *unicode,
          PyObject *sep, Py_ssize_t maxsplit)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Unicode 文字列のリストを分割して、 Unicode 文字列からなるリストを返
     します。 'sep' が ‘NULL’ の場合、全ての空白文字を使って分割を行いま
     す。それ以外の場合、指定された文字を使って分割を行います。最大で
     'maxsplit' 個までの分割を行います。 'maxsplit' が負ならば分割数に制
     限を設けません。分割結果のリスト内には分割文字は含みません。

     On error, return ‘NULL’ with an exception set.

     Equivalent to *note str.split(): 125e.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_RSplit (PyObject *unicode,
          PyObject *sep, Py_ssize_t maxsplit)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Similar to *note PyUnicode_Split(): 5466, 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(): 160f.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_Splitlines (PyObject
          *unicode, int keepends)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 1a6. *PyUnicode_Partition (PyObject
          *unicode, PyObject *sep)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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(): 125f.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_RPartition (PyObject
          *unicode, PyObject *sep)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Similar to *note PyUnicode_Partition(): 1adb, 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(): 1612.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_Join (PyObject *separator,
          PyObject *seq)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  指定
     した 'separator' で文字列からなるシーケンスを連結 (join) し、連結結
     果を Unicode 文字列で返します。

 -- C の関数: *note Py_ssize_t: e28. PyUnicode_Tailmatch (PyObject
          *unicode, PyObject *substr, Py_ssize_t start, Py_ssize_t end,
          int direction)
     ' 次に属します: *note Stable ABI: 961.'  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: e28. PyUnicode_Find (PyObject *unicode,
          PyObject *substr, Py_ssize_t start, Py_ssize_t end, int
          direction)
     ' 次に属します: *note Stable ABI: 961.'  ‘unicode[start:end]’ 中に
     'substr' が最初に出現する場所を返します。 このとき指定された検索方
     向 'direction' ('direction' == ‘1’ は順方向検索、 'direction' ==
     ‘-1’ は逆方向検索) で検索します。 戻り値は最初にマッチが見つかった
     場所のインデックスです; 戻り値 ‘-1’ はマッチが見つからなかったこと
     を表し、 ‘-2’ はエラーが発生して例外情報が設定されていることを表し
     ます。

 -- C の関数: *note Py_ssize_t: e28. PyUnicode_FindChar (PyObject
          *unicode, Py_UCS4 ch, Py_ssize_t start, Py_ssize_t end, int
          direction)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: e28. PyUnicode_Count (PyObject *unicode,
          PyObject *substr, Py_ssize_t start, Py_ssize_t end)
     ' 次に属します: *note Stable ABI: 961.'  ‘unicode[start:end]’ に
     'substr' が重複することなく出現する回数を返します。エラーが発生した
     場合には ‘-1’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_Replace (PyObject
          *unicode, PyObject *substr, PyObject *replstr, Py_ssize_t
          maxcount)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     'unicode' 中に出現する 'substr' を最大で 'maxcount' 個 'replstr' に
     置換し、置換結果である Unicode オブジェクトを返します。 'maxcount'
     == ‘-1’ にすると、文字列中に現れる全ての 'substr' を置換します。

 -- C の関数: int PyUnicode_Compare (PyObject *left, PyObject *right)
     ' 次に属します: *note Stable ABI: 961.'  二つの文字列を比較して、左
     引数が右引数より小さい場合、左右引数が等価の場合、左引数が右引数よ
     り大きい場合に対して、それぞれ ‘-1’, ‘0’, ‘1’ を返します。

     この関数は、失敗したときに ‘-1’ を返すので、 *note
     PyErr_Occurred(): 1ec4. を呼び出して、エラーをチェックすべきです。

     参考
     ....

     The *note PyUnicode_Equal(): 5e6. function.

 -- C の関数: int PyUnicode_Equal (PyObject *a, PyObject *b)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 29c. exception and return ‘-1’ if 'a'
          or 'b' is not a *note str: 1ea. object.

     The function always succeeds if 'a' and 'b' are *note str: 1ea.
     objects.

     The function works for *note str: 1ea. subclasses, but does not
     honor custom ‘__eq__()’ method.

     参考
     ....

     The *note PyUnicode_Compare(): c8e. function.

     Added in version 3.14.

 -- C の関数: int PyUnicode_EqualToUTF8AndSize (PyObject *unicode, const
          char *string, Py_ssize_t size)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 961. (バージョン 3.13 より).'
     Similar to *note PyUnicode_EqualToUTF8AndSize(): 813, 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: 961.'  Unicode オブジェクト
     'unicode' と 'string' を比較して、左引数が右引数より小さい場合、左
     右引数が等価の場合、左引数が右引数より大きい場合に対して、それぞれ
     ‘-1’, ‘0’, ‘1’ を返します。 ASCII エンコードされた文字列だけを渡す
     のが最も良いですが、入力文字列に非 ASCII 文字が含まれている場合は
     ISO-8859-1 として解釈します。

     この関数は例外を送出しません。

 -- C の関数: *note PyObject: 1a6. *PyUnicode_RichCompare (PyObject
          *left, PyObject *right, int op)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  二つ
     のUnicode文字列を比較して、下のうちの一つを返します:

        * ‘NULL’ を、例外が発生したときに返します。

        * *note Py_True: 5685. もしくは *note Py_False: 5684. を、正しく
          比較できた時に返します。

        * *note Py_NotImplemented: 55f7. in case the type combination is
          unknown

     Possible values for 'op' are *note Py_GT: 55fe, *note Py_GE: 55ff,
     *note Py_EQ: 55fc, *note Py_NE: 55fd, *note Py_LT: 55fa, and *note
     Py_LE: 55fb.

 -- C の関数: *note PyObject: 1a6. *PyUnicode_Format (PyObject *format,
          PyObject *args)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  新た
     な文字列オブジェクトを 'format' および 'args' から生成して返します;
     このメソッドは ‘format % args’ のようなものです。

 -- C の関数: int PyUnicode_Contains (PyObject *unicode, PyObject
          *substr)
     ' 次に属します: *note Stable ABI: 961.'  'substr' が 'unicode' 内に
     あるか調べ、その結果に応じて真または偽を返します。

     'substr' は単要素の Unicode 文字に型強制できなければなりません。エ
     ラーが生じた場合には ‘-1’ を返します。

 -- C の関数: void PyUnicode_InternInPlace (PyObject **p_unicode)
     ' 次に属します: *note Stable ABI: 961.'  Intern the argument **note
     p_unicode: c88. 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:
     7e0. 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: 1ea. may not be interned,
     that is, *note PyUnicode_CheckExact: 56c8.(**note p_unicode: c88.)
     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: 1a6. *PyUnicode_InternFromString (const
          char *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  A
     combination of *note PyUnicode_FromString(): 5460. and *note
     PyUnicode_InternInPlace(): c88, 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: 3a0, 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(): 5460. and *note PyUnicode_InternInPlace():
     c88. 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.10.3.32 PyUnicodeWriter
.........................

The *note PyUnicodeWriter: 5e7. API can be used to create a Python *note
str: 1ea. object.

Added in version 3.14.

 -- C のデータ型: type PyUnicodeWriter

     A Unicode writer instance.

     The instance must be destroyed by *note PyUnicodeWriter_Finish():
     5eb. on success, or *note PyUnicodeWriter_Discard(): 5ea. on error.

 -- C の関数: *note PyUnicodeWriter: 5e7. *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: 1a6. *PyUnicodeWriter_Finish
          (PyUnicodeWriter *writer)

     Return the final Python *note str: 1ea. 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(): 5e9.

 -- 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,
          const 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(): 13dc. 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: 1ea. subclass which overrides the *note
     __str__(): a14. method, *note PyUnicode_FromObject(): 545e. can be
     used to get the original string.

 -- C の関数: int PyUnicodeWriter_WriteRepr (PyUnicodeWriter *writer,
          PyObject *obj)

     Call *note PyObject_Repr(): 13db. 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: 1ea. 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(): 824, 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: 1d8b. 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(): 5f3.


File: python.info,  Node: Deprecated API<2>,  Prev: PyUnicodeWriter,  Up: Unicode オブジェクトと codec

7.10.3.33 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(): 64e. is necessary.


File: python.info,  Node: タプルオブジェクト tuple object,  Next: Struct Sequence オブジェクト,  Prev: Unicode オブジェクトと codec,  Up: シーケンスオブジェクト sequence object

7.10.3.34 タプルオブジェクト (tuple object)
...........................................

 -- C のデータ型: type PyTupleObject

     この *note PyObject: 1a6. のサブタイプは Python のタプルオブジェク
     トを表現します。

 -- C 変数: *note PyTypeObject: e6f. PyTuple_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは Python のタプル型を表現します; Python レイヤ
     における *note tuple: 1d9. と同じオブジェクトです。

 -- C の関数: int PyTuple_Check (PyObject *p)

     'p' がタプルオブジェクトかタプル型のサブタイプのインスタンスである
     場合に真を返します。この関数は常に成功します。

 -- C の関数: int PyTuple_CheckExact (PyObject *p)

     'p' がタプルオブジェクトだがタプル型のサブタイプのインスタンスでな
     い場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyTuple_New (Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  Return a new tuple object of
     size 'len', or ‘NULL’ with an exception set on failure.

 -- C の関数: *note PyObject: 1a6. *PyTuple_FromArray (PyObject *const
          *array, Py_ssize_t size)
     ' Thread safety: *note Atomic: 2943.'  Create a tuple of 'size'
     items and copy references from 'array' to the new tuple.

     'array' can be NULL if 'size' is ‘0’.

     On success, return a new reference.  On error, set an exception and
     return ‘NULL’.

     Added in version 3.15.

 -- C の関数: *note PyObject: 1a6. *PyTuple_Pack (Py_ssize_t n, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  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: e28. PyTuple_Size (PyObject *p)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  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: e28. PyTuple_GET_SIZE (PyObject *p)
     ' Thread safety: *note Atomic: 2943.'  Like *note PyTuple_Size():
     5425, but without error checking.

 -- C の関数: *note PyObject: 1a6. *PyTuple_GetItem (PyObject *p,
          Py_ssize_t pos)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  'p' の指すタプルオブジェクト
     内の、位置 'pos' にあるオブジェクトを返します。 'pos' が負であるか
     範囲を超えている場合、 ‘NULL’ を返して *note IndexError: 18ed. 例外
     をセットします。

     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: 7e0, use *note
     Py_NewRef(PyTuple_GetItem(...)): c74. or *note
     PySequence_GetItem(): 2040.

 -- C の関数: *note PyObject: 1a6. *PyTuple_GET_ITEM (PyObject *p,
          Py_ssize_t pos)
     '戻り値: 借用参照。'' Thread safety: *note Safe to call from
     multiple threads with external synchronization only: 2937.'  *note
     PyTuple_GetItem(): 51dd. に似ていますが、引数に対するエラーチェック
     を行いません。

 -- C の関数: *note PyObject: 1a6. *PyTuple_GetSlice (PyObject *p,
          Py_ssize_t low, Py_ssize_t high)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  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: 961.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     2937.'  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: 18ed.
     exception.  This function should only be used to fill in brand new
     tuples; using it on an existing tuple is thread-unsafe.

          注釈: この関数は 'o' への参照を "盗み取り" ます。また、変更先
          のインデクスにすでに別の要素が入っている場合、その要素に対する
          参照を放棄します。

 -- C の関数: void PyTuple_SET_ITEM (PyObject *p, Py_ssize_t pos,
          PyObject *o)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  Like *note
     PyTuple_SetItem(): 51de, but does no error checking, and should
     'only' be used to fill in brand new tuples, using it on an existing
     tuple is thread-unsafe.

     Bounds checking is performed as an assertion if Python is built in
     *note debug mode: 3e3. or *note with assertions: 826.

          注釈: この関数は 'o' への参照を "盗み取り" ます。また、 *note
          PyTuple_SetItem(): 51de. と違って、要素の置き換えが生じても置
          き換えられるオブジェクトへの参照を放棄 'しません' ; その結果、
          タプル中の位置 '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)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  タプルをリサイズする際に使え
     ます。 'newsize' はタプルの新たな長さです。タプルは変更不能なオブジ
     ェクト 'ということになっている' ので、この関数はこのオブジェクトに
     対してただ一つしか参照がない時以外には使ってはなりません。タプルが
     コード中の他の部分ですでに参照されている場合には、この関数を '使っ
     てはなりません' 。タプルは常に指定サイズの末尾まで伸縮します。成功
     した場合には ‘0’ を返します。クライアントコードは、 ‘*p’ の値が呼び
     出し前と同じになると期待してはなりません。 ‘*p’ が置き換えられた場
     合、オリジナルの ‘*p’ は破壊されます。失敗すると ‘-1’ を返し、 ‘*p’
     を ‘NULL’ に設定して、 *note MemoryError: 191d. または *note
     SystemError: 3f1. を送出します。


File: python.info,  Node: Struct Sequence オブジェクト,  Next: リストオブジェクト,  Prev: タプルオブジェクト tuple object,  Up: シーケンスオブジェクト sequence object

7.10.3.35 Struct Sequence オブジェクト
......................................

A struct sequence object is a *note named tuple: a42, that is, a
sequence whose items can also be accessed through attributes.  It is
similar to *note collections.namedtuple(): 1da, but provides a slightly
different interface.

To create a struct sequence, you first have to create a specific struct
sequence type.

 -- C の関数: *note PyTypeObject: e6f. *PyStructSequence_NewType
          (PyStructSequence_Desc *desc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  後述の 'desc' 中のデータから新
     しい struct sequence 型を生成します。返される型のインスタンスは
     *note PyStructSequence_New(): 5401. で生成できます。

     Return ‘NULL’ with an exception set on failure.

 -- C の関数: void PyStructSequence_InitType (PyTypeObject *type,
          PyStructSequence_Desc *desc)
     ' Thread safety: *note Safe to call without external
     synchronization on distinct objects: 293c.'  struct sequence 型であ
     る 'type' を 'desc' をもとにその場で初期化します。

 -- C の関数: int PyStructSequence_InitType2 (PyTypeObject *type,
          PyStructSequence_Desc *desc)
     ' Thread safety: *note Safe to call without external
     synchronization on distinct objects: 293c.'  Like *note
     PyStructSequence_InitType(): 13b0, 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: 961. (すべてのメンバーを含む).'  生
     成する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: f7c. *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: 961. (すべてのメンバーを含む).'
     Describes a field of a struct sequence.  As a struct sequence is
     modeled as a tuple, all fields are typed as *note PyObject: 1a6.*.
     The index in the *note fields: 5704. array of the *note
     PyStructSequence_Desc: f7d. 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: d4e. to leave
          unnamed.

      -- C のメンバ変数: const char *doc

          Field docstring or ‘NULL’ to omit.

 -- C 変数: const char *const PyStructSequence_UnnamedField
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'  フ
     ィールド名を名前がないままするための特殊な値。

     バージョン 3.9 で変更: 型が ‘char *’ から変更されました。

 -- C の関数: *note PyObject: 1a6. *PyStructSequence_New (PyTypeObject
          *type)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  'type' のインスタンスを生成し
     ます。 'type' は *note PyStructSequence_NewType(): 5402. によって事
     前に生成していなければなりません。

     Return ‘NULL’ with an exception set on failure.

 -- C の関数: *note PyObject: 1a6. *PyStructSequence_GetItem (PyObject
          *p, Py_ssize_t pos)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  Return the object at
     position 'pos' in the struct sequence pointed to by 'p'.  The
     returned reference is borrowed from the struct sequence 'p' (that
     is: it is only valid as long as you hold a reference to 'p').

     Bounds checking is performed as an assertion if Python is built in
     *note debug mode: 3e3. or *note with assertions: 826.

 -- C の関数: *note PyObject: 1a6. *PyStructSequence_GET_ITEM (PyObject
          *p, Py_ssize_t pos)
     '戻り値: 借用参照。'' Thread safety: *note Safe to call from
     multiple threads with external synchronization only: 2937.'  Alias
     to *note PyStructSequence_GetItem(): 5400.

     バージョン 3.13 で変更: Now implemented as an alias to *note
     PyStructSequence_GetItem(): 5400.

 -- C の関数: void PyStructSequence_SetItem (PyObject *p, Py_ssize_t
          pos, PyObject *o)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     2937.'  struct sequence 'p' の 'pos' の位置にあるフィールドに値 'o'
     を設定します。*note PyTuple_SET_ITEM(): 827. のように、生成したての
     インスタンスに対してのみ使用すべきです。

     Bounds checking is performed as an assertion if Python is built in
     *note debug mode: 3e3. or *note with assertions: 826.

          注釈: この関数は 'o' への参照を "盗み取り" ます。

 -- C の関数: void PyStructSequence_SET_ITEM (PyObject *p, Py_ssize_t
          *pos, PyObject *o)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  Alias to *note
     PyStructSequence_SetItem(): 5403.

     バージョン 3.13 で変更: Now implemented as an alias to *note
     PyStructSequence_SetItem(): 5403.


File: python.info,  Node: リストオブジェクト,  Prev: Struct Sequence オブジェクト,  Up: シーケンスオブジェクト sequence object

7.10.3.36 リストオブジェクト
............................

 -- C のデータ型: type PyListObject

     この *note PyObject: 1a6. のサブタイプは Python のリストオブジェク
     トを表現します。

 -- C 変数: *note PyTypeObject: e6f. PyList_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは Python のリスト型を表現します。これは Python
     レイヤにおける *note list: 4e0. と同じオブジェクトです。

 -- C の関数: int PyList_Check (PyObject *p)
     ' Thread safety: *note Atomic: 2943.'  'p' がリストオブジェクトかリ
     スト型のサブタイプのインスタンスである場合に真を返します。この関数
     は常に成功します。

 -- C の関数: int PyList_CheckExact (PyObject *p)
     ' Thread safety: *note Atomic: 2943.'  'p' がリストオブジェクトだが
     リスト型のサブタイプのインスタンスでない場合に真を返します。この関
     数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyList_New (Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  サイズが '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():
          2041. or expose the object to Python code before setting all
          items to a real object with *note PyList_SetItem(): 1afa. or
          *note PyList_SET_ITEM(): 828.  The following APIs are safe
          APIs before the list is fully initialized: ‘PyList_SetItem()’
          and ‘PyList_SET_ITEM()’.

 -- C の関数: *note Py_ssize_t: e28. PyList_Size (PyObject *list)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'

     リストオブジェクト 'list' の長さを返します; リストオブジェクトにお
     ける ‘len(list)’ と同じです。

 -- C の関数: *note Py_ssize_t: e28. PyList_GET_SIZE (PyObject *list)
     ' Thread safety: *note Atomic: 2943.'  *note PyList_Size(): 17d2. に
     似ていますが、エラーチェックを行いません。

 -- C の関数: *note PyObject: 1a6. *PyList_GetItemRef (PyObject *list,
          Py_ssize_t index)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.13 より).''  Thread safety: *note Atomic: 2943.'  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: 18ed.
     exception.

     Added in version 3.13.

 -- C の関数: *note PyObject: 1a6. *PyList_GetItem (PyObject *list,
          Py_ssize_t index)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  Like *note
     PyList_GetItemRef(): 7fa, but returns a *note borrowed reference:
     60a. instead of a *note strong reference: 7e0.

          注釈: In the *note free-threaded build: 1a3, the returned
          *note borrowed reference: 60a. may become invalid if another
          thread modifies the list concurrently.  Prefer *note
          PyList_GetItemRef(): 7fa, which returns a *note strong
          reference: 7e0.

 -- C の関数: *note PyObject: 1a6. *PyList_GET_ITEM (PyObject *list,
          Py_ssize_t i)
     '戻り値: 借用参照。'' Thread safety: *note Safe to call from
     multiple threads with external synchronization only: 2937.'  *note
     PyList_GetItem(): 7fb. に似ていますが、エラーチェックを行いません。

          注釈: In the *note free-threaded build: 1a3, the returned
          *note borrowed reference: 60a. may become invalid if another
          thread modifies the list concurrently.  Prefer *note
          PyList_GetItemRef(): 7fa, which returns a *note strong
          reference: 7e0.

 -- C の関数: int PyList_SetItem (PyObject *list, Py_ssize_t index,
          PyObject *item)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  リストオブジェクト内の位置 'index' に、オブジェクト
     'item' を挿入します。 成功した場合には ‘0’ を返します。 'index' が
     範囲を越えている場合、 ‘-1’ を返して *note IndexError: 18ed. をセッ
     トします。

          注釈: この関数は '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: 2937.'  *note PyList_SetItem():
     1afa. をマクロによる実装で、エラーチェックを行いません。このマクロ
     は、新たなリストのまだ要素を入れたことのない位置に要素を入れるとき
     にのみ使います。

     Bounds checking is performed as an assertion if Python is built in
     *note debug mode: 3e3. or *note with assertions: 826.

          注釈: このマクロは 'item' への参照を "盗み取り" ます。また、
          *note PyList_SetItem(): 1afa. と違って、要素の置き換えが生じて
          も置き換えられるオブジェクトへの参照を放棄 'しません' ; その結
          果、 'list' 中の位置 'i' で参照されていたオブジェクトがメモリ
          リークを引き起こします。

          注釈: In the *note free-threaded build: 1a3, 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(): 1afa.
          instead, which uses a *note per-object lock: 293f.

 -- C の関数: int PyList_Insert (PyObject *list, Py_ssize_t index,
          PyObject *item)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  要素 'item' をリスト
     'list' のインデックス 'index' の前に挿入します。成功すると ‘0’ を返
     します。失敗すると ‘-1’ を返し、例外をセットします。
     ‘list.insert(index, item)’ に類似した機能です。

 -- C の関数: int PyList_Append (PyObject *list, PyObject *item)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  オブジェクト 'item' を 'list' の末尾に追加します。
     成功すると ‘0’ を返します; 失敗すると ‘-1’ を返し、例外をセットしま
     す。‘list.append(item)’ に類似した機能です。

 -- C の関数: *note PyObject: 1a6. *PyList_GetSlice (PyObject *list,
          Py_ssize_t low, Py_ssize_t high)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  '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: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  'low' から 'high' ま
     での 'list' のスライスを、 'itemlist' の内容にします。
     ‘list[low:high] = itemlist’ と類似の機能です。 'itemlist' は ‘NULL’
     でもよく、空リストの代入 (指定スライスの削除) になります。 成功した
     場合には ‘0’ を、失敗した場合には ‘-1’ を返します。 ただし、リスト
     の末尾からのインデックスはサポートされていません。

          注釈: In the *note free-threaded build: 1a3, when 'itemlist'
          is a *note list: 4e0, 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:
     293e.'  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:
     4e0. object.  Return 0 on success.

     Added in version 3.13.

          注釈: In the *note free-threaded build: 1a3, when 'iterable'
          is a *note list: 4e0, *note set: 432, *note dict: 193, 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: 2943.'  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:
     4e0. object.  Return 0 on success.

     Added in version 3.13.

 -- C の関数: int PyList_Sort (PyObject *list)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  'list' の内容をイン
     プレースでソートします。成功した場合には ‘0’ を、失敗した場合には
     ‘-1’ を返します。‘list.sort()’ と同じです。

          注釈: In the *note free-threaded build: 1a3, element
          comparison via *note __lt__(): 165a. can execute arbitrary
          Python code, during which the *note per-object lock: 293f. may
          be temporarily released.  For built-in types (*note str: 1ea,
          *note int: 32e, *note float: 32f.), the lock is not released
          during comparison.

 -- C の関数: int PyList_Reverse (PyObject *list)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  'list' の要素をイン
     プレースで反転します。成功した場合には ‘0’ を、失敗した場合には
     ‘-1’ を返します。‘list.reverse()’ と同じです。

 -- C の関数: *note PyObject: 1a6. *PyList_AsTuple (PyObject *list)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'

     'list' の内容が入った新たなタプルオブジェクトを返します;
     ‘tuple(list)’ と同じです。


File: python.info,  Node: Container オブジェクト,  Next: Function オブジェクト<2>,  Prev: シーケンスオブジェクト sequence object,  Up: 具象オブジェクト concrete object レイヤ

7.10.4 Container オブジェクト
-----------------------------

* Menu:

* Dictionary objects::
* Set オブジェクト::


File: python.info,  Node: Dictionary objects,  Next: Set オブジェクト,  Up: Container オブジェクト

7.10.4.1 Dictionary objects
...........................

 -- C のデータ型: type PyDictObject

     この *note PyObject: 1a6. のサブタイプは Python の辞書オブジェクト
     を表現します。

 -- C 変数: *note PyTypeObject: e6f. PyDict_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは Python の辞書を表現します。このオブジェクトは
     、Python レイヤにおける *note dict: 193. と同じオブジェクトです。

 -- C の関数: int PyDict_Check (PyObject *p)
     ' Thread safety: *note Atomic: 2943.'  'p' が辞書オブジェクトか辞書
     型のサブタイプのインスタンスである場合に真を返します。この関数は常
     に成功します。

 -- C の関数: int PyDict_CheckExact (PyObject *p)
     ' Thread safety: *note Atomic: 2943.'  'p' が辞書オブジェクトだが辞
     書型のサブタイプのインスタンスでない場合に真を返します。この関数は
     常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyDict_New ()
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  空の新たな辞書を返します。 失
     敗すると ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyDictProxy_New (PyObject *mapping)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  ある
     マップ型オブジェクトに対して、読み出し専用に制限された *note
     types.MappingProxyType: 194. オブジェクトを返します。通常、この関数
     は動的でないクラス型 (non-dynamic class type) のクラス辞書が変更さ
     れないようにビューを作成するために使われます。

     The first argument can be a *note dict: 193, a *note frozendict:
     18d, or a mapping.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C 変数: *note PyTypeObject: e6f. PyDictProxy_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for
     mapping proxy objects created by *note PyDictProxy_New(): 52f0. and
     for the read-only ‘__dict__’ attribute of many built-in types.  A
     *note PyDictProxy_Type: 52f1. 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: 194. in Python.

 -- C の関数: void PyDict_Clear (PyObject *p)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  現在辞書に入っている全てのキーと値のペアを除去して
     空にします。

     Do nothing if the argument is not a *note dict: 193. or a ‘dict’
     subclass.

 -- C の関数: int PyDict_Contains (PyObject *p, PyObject *key)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  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 first argument can be a *note dict: 193. or a *note frozendict:
     18d.

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: int PyDict_ContainsString (PyObject *p, const char *key)
     ' Thread safety: *note Atomic: 2943.'  This is the same as *note
     PyDict_Contains(): 7dd, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 1a6.*.

     The first argument can be a *note dict: 193. or a *note frozendict:
     18d.

     Added in version 3.13.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: *note PyObject: 1a6. *PyDict_Copy (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  'p' と同じキーと値のペアが入っ
     た新たな辞書を返します。

 -- C の関数: int PyDict_SetItem (PyObject *p, PyObject *key, PyObject
          *val)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  辞書 'p' に、 'key'
     をキーとして値 'val' を挿入します。 'key' はハッシュ可能(*note
     hashable: 18e.)でなければなりません。ハッシュ可能でない場合、 *note
     TypeError: 29c. を送出します。 成功した場合には ‘0’ を、失敗した場
     合には ‘-1’ を返します。 この関数は 'val' への参照を盗み取り 'ませ
     ん'。

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

 -- C の関数: int PyDict_SetItemString (PyObject *p, const char *key,
          PyObject *val)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  This is the same as *note PyDict_SetItem(): 51df,
     but 'key' is specified as a const char* UTF-8 encoded bytes string,
     rather than a *note PyObject: 1a6.*.

 -- C の関数: int PyDict_DelItem (PyObject *p, PyObject *key)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  辞書 'p' から 'key'
     をキーとするエントリを除去します。 'key' は *note ハッシュ可能:
     18e. でなければなりません; ハッシュ可能でない場合、 *note
     TypeError: 29c. を送出します。'key' が辞書になければ、*note
     KeyError: 7e5. を送出します。成功した場合には ‘0’ を、失敗した場合
     には ‘-1’ を返します。

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

 -- C の関数: int PyDict_DelItemString (PyObject *p, const char *key)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  This is the same as *note PyDict_DelItem(): 52f7,
     but 'key' is specified as a const char* UTF-8 encoded bytes string,
     rather than a *note PyObject: 1a6.*.

 -- C の関数: int PyDict_GetItemRef (PyObject *p, PyObject *key,
          PyObject **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).''
     Thread safety: *note Safe for concurrent use on the same object:
     293e.'  Return a new *note strong reference: 7e0. to the object
     from dictionary 'p' which has a key 'key':

        * If the key is present, set '*result' to a new *note strong
          reference: 7e0. 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 first argument can be a *note dict: 193. or a *note frozendict:
     18d.

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

     Added in version 3.13.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

     See also the *note PyObject_GetItem(): 7e8. function.

 -- C の関数: *note PyObject: 1a6. *PyDict_GetItem (PyObject *p,
          PyObject *key)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  Return a *note borrowed
     reference: 60a. to the object from dictionary 'p' which has a key
     'key'.  Return ‘NULL’ if the key 'key' is missing 'without' setting
     an exception.

     The first argument can be a *note dict: 193. or a *note frozendict:
     18d.

          注釈: Exceptions that occur while this calls *note __hash__():
          ec5. and *note __eq__(): ec4. methods are silently ignored.
          Prefer the *note PyDict_GetItemWithError(): 7df. function
          instead.

          注釈: In the *note free-threaded build: 1a3, the returned
          *note borrowed reference: 60a. may become invalid if another
          thread modifies the dictionary concurrently.  Prefer *note
          PyDict_GetItemRef(): 7de, which returns a *note strong
          reference: 7e0.

     バージョン 3.10 で変更: Calling this API without an *note attached
     thread state: 1ac. had been allowed for historical reason.  It is
     no longer allowed.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: *note PyObject: 1a6. *PyDict_GetItemWithError (PyObject
          *p, PyObject *key)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  *note PyDict_GetItem(): 822.
     の変種で例外を隠しません。 例外が発生した場合は、例外をセット 'した
     上で' ‘NULL’ を返します。 キーが存在しなかった場合は、例外をセット
     'せずに' ‘NULL’ を返します。

          注釈: In the *note free-threaded build: 1a3, the returned
          *note borrowed reference: 60a. may become invalid if another
          thread modifies the dictionary concurrently.  Prefer *note
          PyDict_GetItemRef(): 7de, which returns a *note strong
          reference: 7e0.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: *note PyObject: 1a6. *PyDict_GetItemString (PyObject *p,
          const char *key)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 2937.'  This is the same as *note
     PyDict_GetItem(): 822, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 1a6.*.

          注釈: Exceptions that occur while this calls *note __hash__():
          ec5. and *note __eq__(): ec4. methods or while creating the
          temporary *note str: 1ea. object are silently ignored.  Prefer
          using the *note PyDict_GetItemWithError(): 7df. function with
          your own *note PyUnicode_FromString(): 5460. 'key' instead.

          注釈: In the *note free-threaded build: 1a3, the returned
          *note borrowed reference: 60a. may become invalid if another
          thread modifies the dictionary concurrently.  Prefer *note
          PyDict_GetItemStringRef(): 63b, which returns a *note strong
          reference: 7e0.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: int PyDict_GetItemStringRef (PyObject *p, const char *key,
          PyObject **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).''
     Thread safety: *note Atomic: 2943.'  Similar to *note
     PyDict_GetItemRef(): 7de, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 1a6.*.

     Added in version 3.13.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: *note PyObject: 1a6. *PyDict_SetDefault (PyObject *p,
          PyObject *key, PyObject *defaultobj)
     '戻り値: 借用参照。'' Thread safety: *note Safe to call from
     multiple threads with external synchronization only: 2937.'  これは
     Python レベルの *note dict.setdefault(): 1430. と同じです。 もしあ
     れば、辞書 'p' から 'key' に対応する値を返します。 キーが辞書になけ
     れば、値 'defaultobj' を挿入し 'defaultobj' を返します。 この関数は
     、 'key' のハッシュ値を検索と挿入ごとに別々に評価するのではなく、一
     度だけしか評価しません。

     Added in version 3.4.

          注釈: In the *note free-threaded build: 1a3, the returned
          *note borrowed reference: 60a. may become invalid if another
          thread modifies the dictionary concurrently.  Prefer *note
          PyDict_SetDefaultRef(): 7e1, which returns a *note strong
          reference: 7e0.

 -- C の関数: int PyDict_SetDefaultRef (PyObject *p, PyObject *key,
          PyObject *default_value, PyObject **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).''
     Thread safety: *note Safe for concurrent use on the same object:
     293e.'  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: 7e0. 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: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

     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:
     293e.'  Remove 'key' from dictionary 'p' and optionally return the
     removed value.  Do not raise *note KeyError: 7e5. 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(): 7e4, but without the default value and
     not raising *note KeyError: 7e5. if the key is missing.

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

     Added in version 3.13.

 -- C の関数: int PyDict_PopString (PyObject *p, const char *key,
          PyObject **result)
     ' Thread safety: *note Atomic: 2943.'  Similar to *note
     PyDict_Pop(): 63c, but 'key' is specified as a const char* UTF-8
     encoded bytes string, rather than a *note PyObject: 1a6.*.

     Added in version 3.13.

 -- C の関数: *note PyObject: 1a6. *PyDict_Items (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  辞書内の全ての要素対が入った
     *note PyListObject: 2941. を返します。

     The first argument can be a *note dict: 193. or a *note frozendict:
     18d.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: *note PyObject: 1a6. *PyDict_Keys (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  辞書内の全てのキーが入った
     *note PyListObject: 2941. を返します。

     The first argument can be a *note dict: 193. or a *note frozendict:
     18d.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: *note PyObject: 1a6. *PyDict_Values (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  辞書 'p' 内の全ての値が入った
     *note PyListObject: 2941. を返します。

     The first argument can be a *note dict: 193. or a *note frozendict:
     18d.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: *note Py_ssize_t: e28. PyDict_Size (PyObject *p)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'

     辞書内の要素の数を返します。辞書に対して ‘len(p)’ を実行するのと同
     じです。

     The argument can be a *note dict: 193. or a *note frozendict: 18d.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: *note Py_ssize_t: e28. PyDict_GET_SIZE (PyObject *p)
     ' Thread safety: *note Atomic: 2943.'  Similar to *note
     PyDict_Size(): 52fe, but without error checking.

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: int PyDict_Next (PyObject *p, Py_ssize_t *ppos, PyObject
          **pkey, PyObject **pvalue)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     2937.'  辞書 'p' 内の全てのキー/値のペアにわたる反復処理を行います
     。 'ppos' が参照している *note Py_ssize_t: e28. 型は、この関数で反
     復処理を開始する際に、最初に関数を呼び出すよりも前に ‘0’ に初期化し
     ておかなければなりません。この関数は辞書内の各ペアを取り上げるごと
     に真を返し、全てのペアを取り上げたことが分かると偽を返します。 パラ
     メーター 'pkey' および 'pvalue' には、それぞれ辞書の各々のキーと値
     が埋められた *note PyObject: 1a6.* 変数を指すポインタか、または
     ‘NULL’ が入ります。 この関数から返される参照はすべて借用参照になり
     ます。 反復処理中に 'ppos' を変更してはなりません。 この値は内部的
     な辞書構造体のオフセットを表現しており、構造体はスパースなので、オ
     フセットの値に一貫性がないためです。

     The first argument can be a *note dict: 193. or a *note frozendict:
     18d.

     例えば:

          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: 48e.
     build without external synchronization for a mutable *note dict:
     193.  You can use *note Py_BEGIN_CRITICAL_SECTION: 5478. 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();

     The function is thread-safe on a *note frozendict: 18d.

          注釈: 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: 60a. 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: 7e0. (for example, using *note Py_NewRef(): c74.).

     バージョン 3.15 で変更: Also accept *note frozendict: 18d.

 -- C の関数: int PyDict_Merge (PyObject *a, PyObject *b, int override)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  マップ型オブジェクト
     'b' の全ての要素にわたって、反復的にキー/値のペアを辞書 'a' に追加
     します。 'b' は辞書か、 *note PyMapping_Keys(): f7e. または *note
     PyObject_GetItem(): 7e8. をサポートする何らかのオブジェクトにできま
     す。 'override' が真ならば、 'a' のキーと一致するキーが 'b' にある
     際に、既存のペアを置き換えます。それ以外の場合は、 'b' のキーに一致
     するキーが 'a' にないときのみ追加を行います。成功した場合には ‘0’ を
     返し、例外が送出された場合には ‘-1’ を返します。

          注釈: In the *note free-threaded build: 1a3, when 'b' is a
          *note dict: 193. (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: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  C で表せば
     ‘PyDict_Merge(a, b, 1)’ と同じで、また Python の ‘a.update(b)’ と似
     ていますが、 *note PyDict_Update(): 5300. は第二引数が "keys" 属性
     を持たない場合にキー/値ペアのシーケンスを反復することはありません。
     成功した場合には ‘0’ を返し、例外が送出された場合には ‘-1’ を返しま
     す。

          注釈: In the *note free-threaded build: 1a3, when 'b' is a
          *note dict: 193. (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: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  '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: 48e. 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: 2937.'  Register 'callback' as a
     dictionary watcher.  Return a non-negative integer id which must be
     passed to future calls to *note PyDict_Watch(): 96e.  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: 48e. build, callers should ensure no
          concurrent calls to *note PyDict_AddWatcher(): 603. or *note
          PyDict_ClearWatcher(): 1916. 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: 2937.'  Clear watcher identified by
     'watcher_id' previously returned from *note PyDict_AddWatcher():
     603.  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: 48e. build, callers should ensure no
          concurrent calls to *note PyDict_AddWatcher(): 603. or *note
          PyDict_ClearWatcher(): 1916. 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: 293c.'  Mark dictionary 'dict'
     as watched.  The callback granted 'watcher_id' by *note
     PyDict_AddWatcher(): 603. 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: 293c.'  Mark dictionary 'dict'
     as no longer watched.  The callback granted 'watcher_id' by *note
     PyDict_AddWatcher(): 603. 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: 5718. event, *note PyObject: 1a6. *dict,
          *note PyObject: 1a6. *key, *note PyObject: 1a6. *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(): 7ee.  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:

* 辞書ビューオブジェクト: 辞書ビューオブジェクト<2>.
* Frozen dictionary objects::
* Ordered dictionaries::


File: python.info,  Node: 辞書ビューオブジェクト<2>,  Next: Frozen dictionary objects,  Up: Dictionary objects

7.10.4.2 辞書ビューオブジェクト
...............................

 -- 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: 571c.(*note op:
     571b.) || *note PyDictItems_Check: 571d.(op).  This function always
     succeeds.

 -- C 変数: *note PyTypeObject: e6f. PyDictKeys_Type
     ' 次に属します: *note Stable ABI: 961.'  Type object for a view of
     dictionary keys.  In Python, this is the type of the object
     returned by *note dict.keys(): bb1.

 -- 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: e6f. PyDictValues_Type
     ' 次に属します: *note Stable ABI: 961.'  Type object for a view of
     dictionary values.  In Python, this is the type of the object
     returned by *note dict.values(): bb2.

 -- 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: e6f. PyDictItems_Type
     ' 次に属します: *note Stable ABI: 961.'  Type object for a view of
     dictionary items.  In Python, this is the type of the object
     returned by *note dict.items(): bb3.

 -- 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: Frozen dictionary objects,  Next: Ordered dictionaries,  Prev: 辞書ビューオブジェクト<2>,  Up: Dictionary objects

7.10.4.3 Frozen dictionary objects
..................................

Added in version 3.15.

 -- C 変数: *note PyTypeObject: e6f. PyFrozenDict_Type

     This instance of *note PyTypeObject: e6f. represents the Python
     frozen dictionary type.  This is the same object as *note
     frozendict: 18d. in the Python layer.

 -- C の関数: int PyAnyDict_Check (PyObject *p)

     Return true if 'p' is a *note dict: 193. object, a *note
     frozendict: 18d. object, or an instance of a subtype of the ‘dict’
     or ‘frozendict’ type.  This function always succeeds.

 -- C の関数: int PyAnyDict_CheckExact (PyObject *p)

     Return true if 'p' is a *note dict: 193. object or a *note
     frozendict: 18d. object, but not an instance of a subtype of the
     ‘dict’ or ‘frozendict’ type.  This function always succeeds.

 -- C の関数: int PyFrozenDict_Check (PyObject *p)

     Return true if 'p' is a *note frozendict: 18d. object or an
     instance of a subtype of the ‘frozendict’ type.  This function
     always succeeds.

 -- C の関数: int PyFrozenDict_CheckExact (PyObject *p)

     Return true if 'p' is a *note frozendict: 18d. object, but not an
     instance of a subtype of the ‘frozendict’ type.  This function
     always succeeds.

 -- C の関数: *note PyObject: 1a6. *PyFrozenDict_New (PyObject
          *iterable)

     Return a new *note frozendict: 18d. from an iterable, or ‘NULL’ on
     failure with an exception set.

     Create an empty dictionary if 'iterable' is ‘NULL’.


File: python.info,  Node: Ordered dictionaries,  Prev: Frozen dictionary objects,  Up: Dictionary objects

7.10.4.4 Ordered dictionaries
.............................

Python's C API provides interface for *note collections.OrderedDict:
9da. 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: e6f. PyODict_Type

     Type object for ordered dictionaries.  This is the same object as
     *note collections.OrderedDict: 9da. 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: 9da. 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: 9da. type.  This
     function always succeeds.

 -- C 変数: *note PyTypeObject: e6f. PyODictKeys_Type

     Analogous to *note PyDictKeys_Type: 52ef. for ordered dictionaries.

 -- C 変数: *note PyTypeObject: e6f. PyODictValues_Type

     Analogous to *note PyDictValues_Type: 52f5. for ordered
     dictionaries.

 -- C 変数: *note PyTypeObject: e6f. PyODictItems_Type

     Analogous to *note PyDictItems_Type: 52eb. for ordered
     dictionaries.

 -- C の関数: *note PyObject: 1a6. *PyODict_New (void)

     Return a new empty ordered dictionary, or ‘NULL’ on failure.

     This is analogous to *note PyDict_New(): 52fd.

 -- 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(): 51df.

 -- 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(): 52f7.

These are *note soft deprecated: 1b2. aliases to ‘PyDict’ APIs:

‘PyODict’                                              ‘PyDict’
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C のマクロ: PyODict_GetItem (od, key)              *note PyDict_GetItem(): 822.
                                                       
                                                       
 -- C のマクロ: PyODict_GetItemWithError (od, key)     *note PyDict_GetItemWithError(): 7df.
                                                       
                                                       
 -- C のマクロ: PyODict_GetItemString (od, key)        *note PyDict_GetItemString(): 823.
                                                       
                                                       
 -- C のマクロ: PyODict_Contains (od, key)             *note PyDict_Contains(): 7dd.
                                                       
                                                       
 -- C のマクロ: PyODict_Size (od)                      *note PyDict_Size(): 52fe.
                                                       
                                                       
 -- C のマクロ: PyODict_SIZE (od)                      *note PyDict_GET_SIZE(): 5717.
                                                       


File: python.info,  Node: Set オブジェクト,  Prev: Dictionary objects,  Up: Container オブジェクト

7.10.4.5 Set オブジェクト
.........................

このセクションでは *note set: 432. と *note frozenset: 9d9. の公開 API に
ついて詳しく述べます。以降で説明していない機能は、抽象オブジェクトプロト
コル (*note PyObject_CallMethod(): 3be, *note
PyObject_RichCompareBool(): 1f9d, *note PyObject_Hash(): 650, *note
PyObject_Repr(): 13db, *note PyObject_IsTrue(): 53da, *note
PyObject_Print(): 191f, *note PyObject_GetIter(): 53d9. を含む) か抽象数
値プロトコル (*note PyNumber_And(): 53ad, *note PyNumber_Subtract():
53c6, *note PyNumber_Or(): 53c1, *note PyNumber_Xor(): 53c8, *note
PyNumber_InPlaceAnd(): 53b2, *note PyNumber_InPlaceSubtract(): 53ba,
*note PyNumber_InPlaceOr(): 53b6, *note PyNumber_InPlaceXor(): 53bc. を
含む) を使って利用できます。

 -- C のデータ型: type PySetObject

     この *note PyObject: 1a6. を継承した型は、 *note set: 432. と *note
     frozenset: 9d9. 両方の内部データを保存するのに用いられます。 *note
     PyDictObject: 844. と同じように、小さい集合(set)に対しては(タプルの
     ように)固定サイズであり、そうでない集合に対しては(リストと同じよう
     に)可変長のメモリブロックを用います。この構造体のどのフィールドも、
     公開されていると考えるべきではなく、変更される可能性があります。す
     べてのアクセスは、構造体の中の値を直接操作するのではなく、ドキュメ
     ントされた API を用いて行うべきです。

 -- C 変数: *note PyTypeObject: e6f. PySet_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは、Python の *note set: 432. 型を表します。

 -- C 変数: *note PyTypeObject: e6f. PyFrozenSet_Type
     ' 次に属します: *note Stable ABI: 961.'  この *note PyTypeObject:
     e6f. のインスタンスは、Python の *note frozenset: 9d9. 型を表します
     。

以降の型チェックマクロはすべての Python オブジェクトに対するポインタに対
して動作します。同様に、コンストラクタはすべてのイテレート可能な Python
オブジェクトに対して動作します。

 -- C の関数: int PySet_Check (PyObject *p)

     'p' が *note set: 432. かそのサブタイプのオブジェクトであるときに
     true を返します。この関数は常に成功します。

 -- C の関数: int PyFrozenSet_Check (PyObject *p)

     'p' が *note frozenset: 9d9. かそのサブタイプのオブジェクトであると
     きに true を返します。この関数は常に成功します。

 -- C の関数: int PyAnySet_Check (PyObject *p)

     'p' が *note set: 432. か *note frozenset: 9d9. 、あるいはそのサブ
     タイプのオブジェクトであれば、true を返します。この関数は常に成功し
     ます。

 -- C の関数: int PySet_CheckExact (PyObject *p)

     'p' が *note set: 432. オブジェクトだがサブタイプのインスタンスでな
     い場合に真を返します。この関数は常に成功します。

     Added in version 3.10.

 -- C の関数: int PyAnySet_CheckExact (PyObject *p)

     'p' が *note set: 432. か *note frozenset: 9d9. のどちらかのオブジ
     ェクトであるときに true を返します。サブタイプのオブジェクトは含み
     ません。この関数は常に成功します。

 -- C の関数: int PyFrozenSet_CheckExact (PyObject *p)

     'p' が *note frozenset: 9d9. オブジェクトだがサブタイプのインスタン
     スでない場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PySet_New (PyObject *iterable)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe for concurrent use on the same object:
     293e.'  'iterable' が返すオブジェクトを含む新しい *note set: 432. を
     返します。 'iterable' が ‘NULL’ のときは、空の set を返します。 成
     功したら新しい set を、失敗したら ‘NULL’ を返します。 'iterable' が
     イテレート可能でない場合は、 *note TypeError: 29c. を送出します。 こ
     のコンストラクタは set をコピーするときにも使えます (‘c=set(s)’)。

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'iterable' is a *note set: 432, *note frozenset: 9d9,
          *note dict: 193. or *note frozendict: 18d.

 -- C の関数: *note PyObject: 1a6. *PyFrozenSet_New (PyObject *iterable)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Safe for concurrent use on the same object:
     293e.'  'iterable' が返すオブジェクトを含む新しい *note frozenset:
     9d9. を返します。 'iterable' が ‘NULL’ のときは、空の frozenset を
     返します。 成功時には新しい set を、失敗時には ‘NULL’ を返します。
     'iterable' がイテレート可能でない場合は、 *note TypeError: 29c. を
     送出します。

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'iterable' is a *note set: 432, *note frozenset: 9d9,
          *note dict: 193. or *note frozendict: 18d.

以降の関数やマクロは、 *note set: 432. と *note frozenset: 9d9. とそのサ
ブタイプのインスタンスに対して利用できます。

 -- C の関数: *note Py_ssize_t: e28. PySet_Size (PyObject *anyset)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'

     Return the length of a *note set: 432. or *note frozenset: 9d9.
     object.  Equivalent to ‘len(anyset)’.  Raises a *note SystemError:
     3f1. if 'anyset' is not a ‘set’, ‘frozenset’, or an instance of a
     subtype.

 -- C の関数: *note Py_ssize_t: e28. PySet_GET_SIZE (PyObject *anyset)
     ' Thread safety: *note Atomic: 2943.'  エラーチェックを行わない、
     *note PySet_Size(): 1801. のマクロ形式。

 -- C の関数: int PySet_Contains (PyObject *anyset, PyObject *key)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  Return ‘1’ if found,
     ‘0’ if not found, and ‘-1’ if an error is encountered.  Unlike the
     Python *note __contains__(): 1772. method, this function does not
     automatically convert unhashable sets into temporary frozensets.
     Raise a *note TypeError: 29c. if the 'key' is unhashable.  Raise
     *note SystemError: 3f1. if 'anyset' is not a *note set: 432, *note
     frozenset: 9d9, or an instance of a subtype.

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

 -- C の関数: int PySet_Add (PyObject *set, PyObject *key)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  *note set: 432. のイ
     ンスタンスに 'key' を追加します。 *note frozenset: 9d9. に対しても
     動作します (*note PyTuple_SetItem(): 51de. のように、他のコードに見
     える前の新しい frozenset の値を埋めるために使用できます)。 成功した
     ら ‘0’ を、失敗したら ‘-1’ を返します。 'key' がハッシュ可能でない
     場合は、 *note TypeError: 29c. を送出します。 'set' を大きくする余
     裕がない場合は、 *note MemoryError: 191d. を送出します。 'set' が
     ‘set’ かそのサブタイプのインスタンスでない場合は、 *note
     SystemError: 3f1. を送出します。

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

以降の関数は、 *note set: 432. とそのサブタイプに対して利用可能です。
*note frozenset: 9d9. とそのサブタイプには利用できません。

 -- C の関数: int PySet_Discard (PyObject *set, PyObject *key)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     for concurrent use on the same object: 293e.'  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: 7e5. for
     missing keys.  Raise a *note TypeError: 29c. if the 'key' is
     unhashable.  Unlike the Python *note discard(): 28b1. method, this
     function does not automatically convert unhashable sets into
     temporary frozensets.  Raise *note SystemError: 3f1. if 'set' is
     not an instance of *note set: 432. or its subtype.

          注釈: The operation is atomic on *note free threading: 1a3.
          when 'key' is *note str: 1ea, *note int: 32e, *note float:
          32f, *note bool: 5f6. or *note bytes: 1d2.

 -- C の関数: *note PyObject: 1a6. *PySet_Pop (PyObject *set)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  'set' の中の要素のどれかに対す
     る新しい参照を返し、そのオブジェクトを 'set' から削除します。 失敗
     したら ‘NULL’ を返します。 set が空の場合には *note KeyError: 7e5.
     を送出します。 'set' が *note set: 432. とそのサブタイプのインスタ
     ンスでない場合は、 *note SystemError: 3f1. を送出します。

 -- C の関数: int PySet_Clear (PyObject *set)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note
     Atomic: 2943.'  Empty an existing set of all elements.  Return ‘0’
     on success.  Return ‘-1’ and raise *note SystemError: 3f1. if 'set'
     is not an instance of *note set: 432. or its subtype.

          注釈: In the *note free-threaded build: 1a3, 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.10.4.6 Deprecated API
.......................

 -- C のマクロ: PySet_MINSIZE

     A constant representing the size of an internal preallocated table
     inside *note PySetObject: 5735. 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(): 1801.
     instead.

     *note Soft deprecated: 1b2. since version 3.14.


File: python.info,  Node: Function オブジェクト<2>,  Next: その他のオブジェクト<2>,  Prev: Container オブジェクト,  Up: 具象オブジェクト concrete object レイヤ

7.10.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.10.5.1 Function オブジェクト
..............................

Functionオブジェクト固有の関数はわずかです。

 -- C のデータ型: type PyFunctionObject

     関数に使われるCの構造体。

 -- C 変数: *note PyTypeObject: e6f. PyFunction_Type

     *note PyTypeObject: e6f. 型のインスタンスで、 Python の関数型を表し
     ます。これは Python プログラムに ‘types.FunctionType’ として公開さ
     れています。

 -- C の関数: int PyFunction_Check (PyObject *o)

     'o' が関数オブジェクト (*note PyFunction_Type: 5743. 型である) 場合
     に真を返します。パラメータは ‘NULL’ にできません。この関数は常に成
     功します。

 -- C の関数: *note PyObject: 1a6. *PyFunction_New (PyObject *code,
          PyObject *globals)
     '戻り値: 新しい参照。' コードオブジェクト 'code' に関連付けられた新
     しい関数オブジェクトを返します。'globals' はこの関数からアクセスで
     きるグローバル変数の辞書でなければなりません。

     関数のドキュメント文字列と名前はコードオブジェクトから取得されます
     。 *note __module__: 2559. は 'globals' から取得されます。 引数のデ
     フォルト値やアノテーション、クロージャは ‘NULL’ に設定されます。
     *note __qualname__: 2558. はコードオブジェクトの *note co_qualname:
     2599. フィールドと同じ値に設定されます。

 -- C の関数: *note PyObject: 1a6. *PyFunction_NewWithQualName (PyObject
          *code, PyObject *globals, PyObject *qualname)
     '戻り値: 新しい参照。' *note PyFunction_New(): 5745. に似ていますが
     、関数オブジェクトの *note __qualname__: 2558. 属性に値をセットでき
     ます。 'qualname' はユニコードオブジェクトか ‘NULL’ でなくてはなり
     ません。‘NULL’ だった場合、 ‘__qualname__’ 属性にはコードオブジェク
     トの *note co_qualname: 2599. フィールドと同じ値がセットされます。

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyFunction_GetCode (PyObject *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' に関連付けられたコードオ
     ブジェクトを返します。

 -- C の関数: *note PyObject: 1a6. *PyFunction_GetGlobals (PyObject *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' に関連付けられた
     globals辞書を返します。

 -- C の関数: *note PyObject: 1a6. *PyFunction_GetModule (PyObject *op)
     '戻り値: 借用参照。' Return a *note borrowed reference: 60a. to the
     *note __module__: 2559. attribute of the *note function object:
     7a1. 'op'.  It can be 'NULL'.

     This is normally a *note string: 1ea. containing the module name,
     but can be set to any other object by Python code.

 -- C の関数: *note PyObject: 1a6. *PyFunction_GetDefaults (PyObject
          *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' の引数のデフォルト値を返
     します。 引数のタプルか ‘NULL’ になります。

 -- C の関数: int PyFunction_SetDefaults (PyObject *op, PyObject
          *defaults)

     関数オブジェクト 'op' の引数のデフォルト値を設定します。 'defaults'
     は ‘Py_None’ かタプルでなければいけません。

     失敗した時は、 *note SystemError: 3f1. を発生させ、 ‘-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: 1a6. *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: 1a6. *PyFunction_GetClosure (PyObject *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' に設定されたクロージャを
     返します。 ‘NULL’ か cell オブジェクトのタプルです。

 -- C の関数: int PyFunction_SetClosure (PyObject *op, PyObject
          *closure)

     関数オブジェクト 'op' にクロージャを設定します。 'closure' は、
     ‘Py_None’ もしくは cell オブジェクトのタプルでなければなりません。

     失敗した時は、 *note SystemError: 3f1. を発生させ、 ‘-1’ を返します
     。

 -- C の関数: *note PyObject: 1a6. *PyFunction_GetAnnotations (PyObject
          *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' のアノテーションを返しま
     す。 返り値は修正可能な辞書か ‘NULL’ になります。

 -- C の関数: int PyFunction_SetAnnotations (PyObject *op, PyObject
          *annotations)

     関数オブジェクト 'op' のアノテーションを設定します。 'annotations'
     は辞書か、‘Py_None’ でなければなりません。

     失敗した時は、 *note SystemError: 3f1. を発生させ、 ‘-1’ を返します
     。

 -- C の関数: *note PyObject: 1a6. *PyFunction_GET_CODE (PyObject *op)
 -- C の関数: *note PyObject: 1a6. *PyFunction_GET_GLOBALS (PyObject
          *op)
 -- C の関数: *note PyObject: 1a6. *PyFunction_GET_MODULE (PyObject *op)
 -- C の関数: *note PyObject: 1a6. *PyFunction_GET_DEFAULTS (PyObject
          *op)
 -- C の関数: *note PyObject: 1a6. *PyFunction_GET_KW_DEFAULTS (PyObject
          *op)
 -- C の関数: *note PyObject: 1a6. *PyFunction_GET_CLOSURE (PyObject
          *op)
 -- C の関数: *note PyObject: 1a6. *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:
     5743. 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(): 5759.  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(): 5758. 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:

        - ‘PyFunction_PYFUNC_EVENT_MODIFY_QUALNAME’

     Added in version 3.15.

 -- C のデータ型: typedef int (*PyFunction_WatchCallback)(*note
          PyFunction_WatchEvent: 575a. event, *note PyFunctionObject:
          96d. *func, *note PyObject: 1a6. *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: 60a.
     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(): 7ee.  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.10.5.2 インスタンスメソッドオブジェクト(Instance Method Objects)
..................................................................

An instance method is a wrapper for a *note PyCFunction: 1830. 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: e6f. PyInstanceMethod_Type

     *note PyTypeObject: e6f. のインスタンスは Python のインスタンスメソ
     ッドの型を表現します。これは Python のプログラムには公開されません
     。

 -- C の関数: int PyInstanceMethod_Check (PyObject *o)

     'o' がインスタンスメソッドオブジェクト (*note
     PyInstanceMethod_Type: 5760. 型である) 場合に真を返します。パラメー
     タは ‘NULL’ にできません。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyInstanceMethod_New (PyObject
          *func)
     '戻り値: 新しい参照。' 任意の呼び出し可能オブジェクト 'func' を使っ
     た新たなインスタンスメソッドオブジェクトを返します。'func' はインス
     タンスメソッドが呼び出されたときに呼び出される関数です。

 -- C の関数: *note PyObject: 1a6. *PyInstanceMethod_Function (PyObject
          *im)
     '戻り値: 借用参照。' インスタンスメソッド 'im' に関連付けられた関数
     オブジェクトを返します。

 -- C の関数: *note PyObject: 1a6. *PyInstanceMethod_GET_FUNCTION
          (PyObject *im)
     '戻り値: 借用参照。' *note PyInstanceMethod_Function(): 5763. のマ
     クロ版で、エラーチェックを行いません。


File: python.info,  Node: メソッドオブジェクト<2>,  Next: セルオブジェクト cell object,  Prev: インスタンスメソッドオブジェクト Instance Method Objects,  Up: Function オブジェクト<2>

7.10.5.3 メソッドオブジェクト
.............................

メソッドは関数オブジェクトに束縛されています。メソッドは常にあるユーザー
定義のクラスに束縛されているのです。束縛されていないメソッド(クラスオブ
ジェクトに束縛されたメソッド)は利用することができません。

 -- C 変数: *note PyTypeObject: e6f. PyMethod_Type

     この *note PyTypeObject: e6f. のインスタンスは Python のメソッド型
     を表現します。このオブジェクトは、 ‘types.MethodType’ として Python
     プログラムに公開されています。

 -- C の関数: int PyMethod_Check (PyObject *o)

     'o' がメソッドオブジェクト (*note PyMethod_Type: 5767. 型である) 場
     合に真を返します。パラメータは ‘NULL’ にできません。この関数は常に
     成功します。

 -- C の関数: *note PyObject: 1a6. *PyMethod_New (PyObject *func,
          PyObject *self)
     '戻り値: 新しい参照。' 任意の呼び出し可能オブジェクト 'func' とメソ
     ッドが束縛されるべきインスタンス 'self' を使った新たなメソッドオブ
     ジェクトを返します。 関数 'func' は、メソッドが呼び出された時に呼び
     出されるオブジェクトです。 'self' は ‘NULL’ にできません。

 -- C の関数: *note PyObject: 1a6. *PyMethod_Function (PyObject *meth)
     '戻り値: 借用参照。' メソッド 'meth' に関連付けられている関数オブジ
     ェクトを返します。

 -- C の関数: *note PyObject: 1a6. *PyMethod_GET_FUNCTION (PyObject
          *meth)
     '戻り値: 借用参照。' *note PyMethod_Function(): 576a. のマクロ版で
     、エラーチェックを行いません。

 -- C の関数: *note PyObject: 1a6. *PyMethod_Self (PyObject *meth)
     '戻り値: 借用参照。' メソッド 'meth' に関連付けられたインスタンスを
     返します。

 -- C の関数: *note PyObject: 1a6. *PyMethod_GET_SELF (PyObject *meth)
     '戻り値: 借用参照。' *note PyMethod_Self(): 576c. のマクロ版で、エ
     ラーチェックを行いません。


File: python.info,  Node: セルオブジェクト cell object,  Next: コードオブジェクト<3>,  Prev: メソッドオブジェクト<2>,  Up: Function オブジェクト<2>

7.10.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: e6f. PyCell_Type

     セルオブジェクトに対応する型オブジェクトです。

 -- C の関数: int PyCell_Check (PyObject *ob)

     'ob' がセルオブジェクトの場合に真を返します; 'ob' は ‘NULL’ であっ
     てはなりません。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyCell_New (PyObject *ob)
     '戻り値: 新しい参照。' 値 'ob' の入った新たなセルオブジェクトを生成
     して返します。 引数を ‘NULL’ にしてもかまいません。

 -- C の関数: *note PyObject: 1a6. *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: 1a6. *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.10.5.5 コードオブジェクト
...........................

コードオブジェクト(Code objects)は CPython 実装の低レベルな詳細部分です
。各オブジェクトは関数に束縛されていない実行可能コードの塊を表現していま
す。

 -- C のデータ型: type PyCodeObject

     コードオブジェクトを表現するために利用されるC構造体。この型のフィー
     ルドは何時でも変更され得ます。

 -- C 変数: *note PyTypeObject: e6f. PyCode_Type

     This is an instance of *note PyTypeObject: e6f. representing the
     Python *note code object: 6f1.

 -- C の関数: int PyCode_Check (PyObject *co)

     Return true if 'co' is a *note code object: 6f1.  This function
     always succeeds.

 -- C の関数: *note Py_ssize_t: e28. PyCode_GetNumFree (PyCodeObject
          *co)

     Return the number of *note free (closure) variables: 1ad6. in a
     code object.

 -- C の関数: int PyUnstable_Code_GetFirstFree (PyCodeObject *co)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Return the position of the first *note free (closure) variable:
     1ad6. in a code object.

     バージョン 3.13 で変更: Renamed from ‘PyCode_GetFirstFree’ as part
     of *note Unstable C API: 959.  The old name is deprecated, but will
     remain available until the signature changes again.

 -- C の関数: *note PyCodeObject: b5e. *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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Return a new code object.  If you need a dummy code object to
     create a frame, use *note PyCode_NewEmpty(): 170a. instead.

     Since the definition of the bytecode changes often, calling *note
     PyUnstable_Code_New(): 577e. 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: 959.  The old name is deprecated, but will remain
     available until the signature changes again.

 -- C の関数: *note PyCodeObject: b5e.
          *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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Similar to *note PyUnstable_Code_New(): 577e, 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: b5e. *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(): b6f. 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: 1a6. *PyCode_GetCode (PyCodeObject *co)

     Equivalent to the Python code ‘getattr(co, 'co_code')’.  Returns a
     strong reference to a *note PyBytesObject: b76. 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: 1a6. *PyCode_GetVarnames (PyCodeObject
          *co)

     Equivalent to the Python code ‘getattr(co, 'co_varnames')’.
     Returns a new reference to a *note PyTupleObject: 558f. 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: 1a6. *PyCode_GetCellvars (PyCodeObject
          *co)

     Equivalent to the Python code ‘getattr(co, 'co_cellvars')’.
     Returns a new reference to a *note PyTupleObject: 558f. 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: 1a6. *PyCode_GetFreevars (PyCodeObject
          *co)

     Equivalent to the Python code ‘getattr(co, 'co_freevars')’.
     Returns a new reference to a *note PyTupleObject: 558f. containing
     the names of the *note free (closure) variables: 1ad6.  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(): 972.  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(): 971. 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:
          5781. event, *note PyCodeObject: b5e. *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(): 7ee.  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: 1a6. *PyCode_Optimize (PyObject *code,
          PyObject *consts, PyObject *names, PyObject *lnotab_obj)

     This is a 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.

     *note Soft deprecated: 1b2. since version 3.13.

   ---------- 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.10.5.6 Code Object Flags
..........................

Code objects contain a bit-field of flags, which can be retrieved as the
*note co_flags: 1b1b. Python attribute (for example using *note
PyObject_GetAttrString(): 7ec.), and set using a 'flags' argument to
*note PyUnstable_Code_New(): 577e. and similar functions.

Flags whose names start with ‘CO_FUTURE_’ correspond to features
normally selectable by *note future statements: 677.  These flags can be
used in *note PyCompilerFlags.cf_flags: 5532.  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: 4d40.
                                                       
                                                       
 -- C のマクロ: CO_NEWLOCALS                           *note inspect.CO_NEWLOCALS: 4d41.
                                                       
                                                       
 -- C のマクロ: CO_VARARGS                             *note inspect.CO_VARARGS: 4d42.
                                                       
                                                       
 -- C のマクロ: CO_VARKEYWORDS                         *note inspect.CO_VARKEYWORDS: 4d43.
                                                       
                                                       
 -- C のマクロ: CO_NESTED                              *note inspect.CO_NESTED: 4d44.
                                                       
                                                       
 -- C のマクロ: CO_GENERATOR                           *note inspect.CO_GENERATOR: 4d45.
                                                       
                                                       
 -- C のマクロ: CO_COROUTINE                           *note inspect.CO_COROUTINE: 4d46.
                                                       
                                                       
 -- C のマクロ: CO_ITERABLE_COROUTINE                  *note inspect.CO_ITERABLE_COROUTINE: 4d47.
                                                       
                                                       
 -- C のマクロ: CO_ASYNC_GENERATOR                     *note inspect.CO_ASYNC_GENERATOR: 4d48.
                                                       
                                                       
 -- C のマクロ: CO_HAS_DOCSTRING                       *note inspect.CO_HAS_DOCSTRING: 25a7.
                                                       
                                                       
 -- C のマクロ: CO_METHOD                              *note inspect.CO_METHOD: 4d49.
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_DIVISION                     no effect (*note __future__.division: 4cee.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_ABSOLUTE_IMPORT              no effect (*note __future__.absolute_import: 4cef.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_WITH_STATEMENT               no effect (*note __future__.with_statement: 4cf0.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_PRINT_FUNCTION               no effect (*note __future__.print_function: 4cf1.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_UNICODE_LITERALS             no effect (*note __future__.unicode_literals: 4cf2.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_GENERATOR_STOP               no effect (*note __future__.generator_stop: 4cf3.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_ANNOTATIONS                  *note __future__.annotations: 4cf4.
                                                       


File: python.info,  Node: Extra information,  Prev: Code Object Flags,  Up: Function オブジェクト<2>

7.10.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: e28.
          PyUnstable_Eval_RequestCodeExtraIndex (freefunc free)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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(): 547b. when storing *note PyObject: 1a6.

     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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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.10.6 その他のオブジェクト
---------------------------

* Menu:

* File objects::
* モジュールオブジェクト (module object): モジュールオブジェクト module object.
* イテレータオブジェクト (iterator object): イテレータオブジェクト iterator object.
* デスクリプタオブジェクト (descriptor object): デスクリプタオブジェクト descriptor object.
* スライスオブジェクト (slice object): スライスオブジェクト slice object.
* memoryview オブジェクト::
* Pickle buffer objects::
* 弱参照オブジェクト: 弱参照オブジェクト<2>.
* カプセル: カプセル<2>.
* Sentinel objects::
* フレーム (frame) オブジェクト: フレーム frame オブジェクト<2>.
* ジェネレータオブジェクト::
* コルーチンオブジェクト: コルーチンオブジェクト<2>.
* コンテキスト変数オブジェクト::
* 型ヒントのためのオブジェクト::


File: python.info,  Node: File objects,  Next: モジュールオブジェクト module object,  Up: その他のオブジェクト<2>

7.10.6.1 File objects
.....................

これらの API は、 Python 2 の組み込みのファイルオブジェクトの C API を最
低限エミュレートするためのものです。それらは、標準 C ライブラリでサポー
トされているバッファ付き I/O (FILE*) に頼るために使われます。 Python 3 で
は、ファイルとストリームは新しい *note io: 82. モジュールを使用され、そ
こに OS の低レベルなバッファ付き I/O の上にいくつかの層が定義されていま
す。下で解説されている関数は、それらの新しい API の便利な C ラッパーであ
り、インタプリタでの内部的なエラー通知に向いています; サードパーティーの
コードは代わりに ‘io’ の API を使うことが推奨されます。

 -- C の関数: *note PyObject: 1a6. *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: 961.'  既に
     開かれているファイル 'fd' のファイルディスクリプタから Python のフ
     ァイルオブジェクトを作成します。 引数 'name' 、 'encoding' 、
     'errors' 、 'newline' には、デフォルトの値として ‘NULL’ が使えます
     。 'buffering' には '-1' を指定してデフォルトの値を使うことができま
     す。 'name' は無視されるのですが、後方互換性のために残されています
     。 失敗すると ‘NULL’ を返します。 より包括的な引数の解説は、 *note
     io.open(): 930. 関数のドキュメントを参照してください。

          警告: Python ストリームは自身のバッファリング層を持つため、フ
          ァイル記述子のOSレベルのバッファリングと併用すると、様々な問題
          (予期せぬデータ順) などを引き起こします。

     バージョン 3.2 で変更: 'name' 属性の無視。

 -- C の関数: int PyObject_AsFileDescriptor (PyObject *p)
     ' 次に属します: *note Stable ABI: 961.'  'p' に関連づけられる ファ
     イルディスクリプタを int として返します。オブジェクトが整数なら、そ
     の値を返します。 整数でない場合、オブジェクトに *note fileno():
     19d2. メソッドがあれば呼び出します; このメソッドの返り値は、ファイ
     ル記述子の値として返される整数でなければなりません。失敗すると例外
     を設定して ‘-1’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyFile_GetLine (PyObject *p, int n)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     ‘p.readline([n])’ と同じで、この関数はオブジェクト 'p' の各行を読み
     出します。 'p' はファイルオブジェクトか、 *note readline(): 16e3. メ
     ソッドを持つ何らかのオブジェクトでかまいません。 'n' が ‘0’ の場合
     、行の長さに関係なく正確に 1 行だけ読み出します。 'n' が ‘0’ より大
     きければ、 'n' バイト以上のデータは読み出しません; 従って、行の一部
     だけが返される場合があります。 どちらの場合でも、読み出し後すぐにフ
     ァイルの終端に到達した場合には空文字列を 返します。 'n' が ‘0’ より
     小さければ、長さに関わらず 1 行だけを 読み出しますが、すぐにファイ
     ルの終端に到達した場合には *note EOFError: 1693. を送出します。

 -- C の関数: int PyFile_SetOpenCodeHook (Py_OpenCodeHookFunction
          handler)

     *note io.open_code(): 1964. の通常の振る舞いを上書きして、そのパラ
     メーターを提供されたハンドラで渡します。

     ハンドラーは次の型の関数です。

      -- C のデータ型: typedef *note PyObject: 1a6.
               *(*Py_OpenCodeHookFunction)(*note PyObject: 1a6.*, void*)

          *note PyObject: 1a6. *(*)(PyObject *path, void *userData) と等
          価で、 'path' は *note PyUnicodeObject: b78. であることが保証
          されています。

     'userData' ポインタはフック関数に渡されます。 フック関数は別なラン
     タイムから呼び出されるかもしれないので、このポインタは直接 Python の
     状態を参照すべきではありません。

     このフック関数はインポート中に使われることを意図しているため、モジ
     ュールが frozen なモジュールであるか ‘sys.modules’ にある利用可能な
     モジュールであることが分かっている場合を除いては、フック関数の実行
     中に新しいモジュールをインポートするのは避けてください。

     いったんフック関数が設定されたら、削除や置き換えもできず、後からの
     *note PyFile_SetOpenCodeHook(): 1cbd. の呼び出しは失敗します。 この
     関数が失敗したときは、インタープリタが初期化されていた場合、 -1 を
     返して例外をセットします。

     この関数は *note Py_Initialize(): 67a. より前に呼び出しても安全です
     。

     引数無しで *note 監査イベント: 1e84. ‘setopencodehook’ を送出します
     。

     Added in version 3.8.

 -- C の関数: *note PyObject: 1a6. *PyFile_OpenCodeObject (PyObject
          *path)

     Open 'path' with the mode ‘'rb'’.  'path' must be a Python *note
     str: 1ea. object.  The behavior of this function may be overridden
     by *note PyFile_SetOpenCodeHook(): 1cbd. to allow for some
     preprocessing of the text.

     This is analogous to *note io.open_code(): 1964. in Python.

     On success, this function returns a *note strong reference: 7e0. to
     a Python file object.  On failure, this function returns ‘NULL’
     with an exception set.

     Added in version 3.8.

 -- C の関数: *note PyObject: 1a6. *PyFile_OpenCode (const char *path)

     Similar to *note PyFile_OpenCodeObject(): 579f, 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: 961.'

     Write object 'obj' to file object 'p'.  The only supported flag for
     'flags' is *note Py_PRINT_RAW: 55f8.; if given, the *note str():
     1ea. of the object is written instead of the *note repr(): 462.

     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: 961.'  文字列 's' をファイルオブ
     ジェクト 'p' に書き出します。成功した場合には ‘0’ を返し、失敗する
     と ‘-1’ を返して適切な例外をセットします。

* Menu:

* Soft-deprecated API: Soft-deprecated API<2>.


File: python.info,  Node: Soft-deprecated API<2>,  Up: File objects

7.10.6.2 Soft-deprecated API
............................

*note Soft deprecated: 1b2. 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: 1a6. *PyFile_NewStdPrinter (int fd)

     Use *note PyFile_FromFd(): 535d. with defaults (‘fd, NULL, "w", -1,
     NULL, NULL, NULL, 0’) instead.

 -- C 変数: *note PyTypeObject: e6f. PyStdPrinter_Type

     Type of file-like objects used internally at Python startup when
     *note io: 82. is not yet available.  Use Python *note open(): 333.
     or *note PyFile_FromFd(): 535d. to create file objects instead.


File: python.info,  Node: モジュールオブジェクト module object,  Next: イテレータオブジェクト iterator object,  Prev: File objects,  Up: その他のオブジェクト<2>

7.10.6.3 モジュールオブジェクト (module object)
...............................................

 -- C 変数: *note PyTypeObject: e6f. PyModule_Type
     ' 次に属します: *note Stable ABI: 961.'

     This instance of *note PyTypeObject: e6f. represents the Python
     module type.  This is exposed to Python programs as *note
     types.ModuleType: 11cb.

 -- C の関数: int PyModule_Check (PyObject *p)

     'p' がモジュールオブジェクトかモジュールオブジェクトのサブタイプで
     あるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyModule_CheckExact (PyObject *p)

     'p' がモジュールオブジェクトで、かつ *note PyModule_Type: 53aa. の
     サブタイプでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyModule_NewObject (PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'

     Return a new module object with *note module.__name__: 1744. set to
     'name'.  The module's ‘__name__’, *note __doc__: 1e06, *note
     __package__: 593. and *note __loader__: 30b. attributes are filled
     in (all but ‘__name__’ are set to ‘None’).  The caller is
     responsible for setting a *note __file__: 2578. attribute.

     Return ‘NULL’ with an exception set on error.

     Added in version 3.3.

     バージョン 3.4 で変更: *note __package__: 593. and *note
     __loader__: 30b. are now set to ‘None’.

 -- C の関数: *note PyObject: 1a6. *PyModule_New (const char *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     *note PyModule_NewObject(): 53a8. に似ていますが、 name は Unicode
     オブジェクトではなく UTF-8 でエンコードされた文字列です。

 -- C の関数: *note PyObject: 1a6. *PyModule_GetDict (PyObject *module)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'

     'module' の名前空間を実装する辞書オブジェクトを返します; このオブジ
     ェクトは、モジュールオブジェクトの *note __dict__: 1ca. 属性と同じ
     ものです。 'module' がモジュールオブジェクト (もしくはモジュールオ
     ブジェクトのサブタイプ) でない場合は、 *note SystemError: 3f1. が送
     出され ‘NULL’ が返されます。

     拡張モジュールでは、モジュールの *note __dict__: 1ca. を直接操作す
     るよりも、 ‘PyModule_*’ および ‘PyObject_*’ 関数を使う方が推奨され
     ます。

     The returned reference is borrowed from the module; it is valid
     until the module is destroyed.

 -- C の関数: *note PyObject: 1a6. *PyModule_GetNameObject (PyObject
          *module)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'

     Return 'module"s *note __name__: 1744. value.  If the module does
     not provide one, or if it is not a string, *note SystemError: 3f1.
     is raised and ‘NULL’ is returned.

     Added in version 3.3.

 -- C の関数: const char *PyModule_GetName (PyObject *module)
     ' 次に属します: *note Stable ABI: 961.'  *note
     PyModule_GetNameObject(): 53a4. に似ていますが、 ‘'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__: 1744. attribute.

 -- C の関数: *note PyModuleDef: d49. *PyModule_GetDef (PyObject
          *module)
     ' 次に属します: *note Stable ABI: 961.'  モジュールが作られる元とな
     った *note PyModuleDef: d49. 構造体へのポインタを返します。 モジュ
     ールが定義によって作られていなかった場合は ‘NULL’ を返します。

     On error, return ‘NULL’ with an exception set.  Use *note
     PyErr_Occurred(): 1ec4. to tell this case apart from a missing
     ‘PyModuleDef’.

 -- C の関数: *note PyObject: 1a6. *PyModule_GetFilenameObject (PyObject
          *module)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'

     Return the name of the file from which 'module' was loaded using
     'module"s *note __file__: 2578. attribute.  If this is not defined,
     or if it is not a string, raise *note SystemError: 3f1. 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: 961.'  *note
     PyModule_GetFilenameObject(): 648. と似ていますが、 'utf-8' でエン
     コードされたファイル名を返します。

     The returned buffer is only valid until the module's *note
     __file__: 2578. attribute is reassigned or the module is destroyed.

     バージョン 3.2 で非推奨: *note PyModule_GetFilename(): 647. はエン
     コードできないファイル名に対しては *note UnicodeEncodeError: a6c. を
     送出します。これの代わりに *note PyModule_GetFilenameObject(): 648.
     を使用してください。

* Menu:

* Module definition::
* Module state::
* Creating extension modules dynamically::
* Module definition struct::
* サポート関数::


File: python.info,  Node: Module definition,  Next: Module state,  Up: モジュールオブジェクト module object

7.10.6.4 Module definition
..........................

Modules created using the C API are typically defined using an array of
*note PySlot: 1a8. structs, which provides a "description" of how a
module should be created.  See *note Definition slots: 37d. for more
information on slots in general.

バージョン 3.15 で変更: Previously, a *note PyModuleDef: d49. struct was
necessary to define modules.  The older way of defining modules is still
available: consult either the *note Module definition struct: 57ab.
section or earlier versions of this documentation if you plan to support
earlier Python versions.

The slots array is usually used to define an extension module's “main”
module object (see *note 拡張モジュールの定義: 5221. for details).  It
can also be used to *note create extension modules dynamically: 57ac.

Unless specified otherwise, the same slot ID may not be repeated in an
array of slots.

* Menu:

* Metadata slots::
* Feature slots::
* Creation and initialization slots::


File: python.info,  Node: Metadata slots,  Next: Feature slots,  Up: Module definition

7.10.6.5 Metadata slots
.......................

 -- C のマクロ: Py_mod_name
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for the name of the new module, as a
     NUL-terminated UTF8-encoded ‘const char *’.

     Note that modules are typically created using a *note ModuleSpec:
     247c, and when they are, the name from the spec will be used
     instead of ‘Py_mod_name’.  However, it is still recommended to
     include this slot for introspection and debugging purposes.

     Added in version 3.15: Use *note PyModuleDef.m_name: 57ae. instead
     to support previous versions.

 -- C のマクロ: Py_mod_doc
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for the docstring of the new module, as a
     NUL-terminated UTF8-encoded ‘const char *’.

     Usually it is set to a variable created with *note PyDoc_STRVAR:
     1f6e.

     Added in version 3.15: Use *note PyModuleDef.m_doc: 57af. instead
     to support previous versions.


File: python.info,  Node: Feature slots,  Next: Creation and initialization slots,  Prev: Metadata slots,  Up: Module definition

7.10.6.6 Feature slots
......................

 -- C のマクロ: Py_mod_abi
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. whose value points to a *note PyABIInfo: 5289.
     structure describing the ABI that the extension is using.

     A suitable ‘PyABIInfo’ variable can be defined using the *note
     PyABIInfo_VAR: 362. macro, as in:

          PyABIInfo_VAR(abi_info);

          static PySlot mymodule_slots[] = {
             PySlot_DATA(Py_mod_abi, &abi_info),
             ...
          };

     When creating a module, Python checks the value of this slot using
     *note PyABIInfo_Check(): 361.

     This slot is required, except for modules created from *note
     PyModuleDef: d49.

     Added in version 3.15.

 -- C のマクロ: Py_mod_multiple_interpreters
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     *note Slot ID: 5577. whose value is one of:

      -- 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
          拡張モジュールを分離する: 419.)

      -- C のマクロ: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED

          The module supports being imported in subinterpreters, even
          when they have their own GIL. (See *note
          拡張モジュールを分離する: 419.)

     This slot determines whether or not importing this module in a
     subinterpreter will fail.

     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: 961. (バージョン 3.13 より).'
     *note Slot ID: 5577. whose value is one of:

      -- 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: 6ab.  Otherwise, it determines whether or not
     importing this module will cause the GIL to be automatically
     enabled.  See *note フリースレッドの CPython: 686. for more detail.

     If ‘Py_mod_gil’ is not specified, the import machinery defaults to
     ‘Py_MOD_GIL_USED’.

     Added in version 3.13.


File: python.info,  Node: Creation and initialization slots,  Prev: Feature slots,  Up: Module definition

7.10.6.7 Creation and initialization slots
..........................................

 -- C のマクロ: Py_mod_create
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.5 より).'
     *note Slot ID: 5577. for a function that creates the module object
     itself.  The function must have the signature:

      -- C の関数: *note PyObject: 1a6. *create_module (PyObject *spec,
               PyModuleDef *def)

     The function will be called with:

        - 'spec': a ‘ModuleSpec’-like object, meaning that any
          attributes defined for *note importlib.machinery.ModuleSpec:
          247c. have matching semantics.  However, any of the attributes
          may be missing.

        - 'def': ‘NULL’, or the module definition if the module is
          created from one.

     The function should return a new module object, or set an error and
     return ‘NULL’.

     この関数は最小限に留めておくべきです。 特に任意のPythonコードを呼び
     出すべきではなく、同じモジュールをインポートしようとすると無限ルー
     プに陥るでしょう。

     ‘Py_mod_create’ が設定されていない場合は、インポート機構は *note
     PyModule_New(): 53a7. を使って通常のモジュールオブジェクトを生成し
     ます。 モジュールの名前は定義ではなく 'spec' から取得され、これによ
     って拡張モジュールが動的にモジュール階層における位置を調整できたり
     、シンボリックリンクを通して同一のモジュール定義を共有しつつ別の名
     前でインポートできたりします。

     There is no requirement for the returned object to be an instance
     of *note PyModule_Type: 53aa.  However, some slots may only be used
     with ‘PyModule_Type’ instances; in particular:

        - *note Py_mod_exec: d4a,

        - *note module state slots: 57b8. (‘Py_mod_state_*’),

        - *note Py_mod_token: 54aa.

     Added in version 3.5.

     バージョン 3.15 で変更: The 'slots' argument may be a
     ‘ModuleSpec’-like object, rather than a true *note ModuleSpec:
     247c. instance.  Note that previous versions of CPython did not
     enforce this.

     The 'def' argument may now be ‘NULL’, since modules are not
     necessarily made from definitions.

 -- C のマクロ: Py_mod_exec
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.5 より).'
     *note Slot ID: 5577. for a function that will 'execute', or
     initialize, the module.  This function does the equivalent to
     executing the code of a Python module: typically, it adds classes
     and constants to the module.  The signature of the function is:

      -- C の関数: int exec_module (PyObject *module)

     See the *note サポート関数: 57ba. section for some useful functions
     to call.

     For backwards compatibility, the *note PyModuleDef.m_slots: 198d.
     array may contain multiple ‘Py_mod_exec’ slots; these are processed
     in the order they appear in the array.  Elsewhere (that is, in
     arguments to *note PyModule_FromSlotsAndSpec(): 394. and in return
     values of ‘PyModExport_<NAME>’), repeating the slot is not allowed.

     Added in version 3.5.

     バージョン 3.15 で変更: Repeated ‘Py_mod_exec’ slots are
     disallowed, except in *note PyModuleDef.m_slots: 198d.

 -- C のマクロ: Py_mod_methods
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for a table of module-level functions, as an
     array of *note PyMethodDef: 188f. values suitable as the
     'functions' argument to *note PyModule_AddFunctions(): 539e.

     Like other slot IDs, a slots array may only contain one
     ‘Py_mod_methods’ entry.  To add functions from multiple *note
     PyMethodDef: 188f. arrays, call *note PyModule_AddFunctions():
     539e. in the *note Py_mod_exec: d4a. function.

     The table must be statically allocated (or otherwise guaranteed to
     outlive the module object).

     Added in version 3.15: Use *note PyModuleDef.m_methods: 57bb.
     instead to support previous versions.


File: python.info,  Node: Module state,  Next: Creating extension modules dynamically,  Prev: Module definition,  Up: モジュールオブジェクト module object

7.10.6.8 Module state
.....................

Extension modules can have 'module state' - a piece of memory that is
allocated on module creation, and freed when the module object is
deallocated.  The module state is specified using *note dedicated slots:
57b8.

A typical use of module state is storing an exception type - or indeed
'any' type object defined by the module -

Unlike the module's Python attributes, Python code cannot replace or
delete data stored in module state.

Keeping per-module information in attributes and module state, rather
than in static globals, makes module objects 'isolated' and safer for
use in multiple sub-interpreters.  It also helps Python do an orderly
clean-up when it shuts down.

Extensions that keep references to Python objects as part of module
state must implement *note Py_mod_state_traverse: 54a9. and *note
Py_mod_state_clear: 54a6. functions to avoid reference leaks.

To retrieve the state from a given module, use the following functions:

 -- C の関数: void *PyModule_GetState (PyObject *module)
     ' 次に属します: *note Stable ABI: 961.'  Return the "state" of the
     module, that is, a pointer to the block of memory allocated at
     module creation time, or ‘NULL’.  See *note Py_mod_state_size:
     54a8.

     On error, return ‘NULL’ with an exception set.  Use *note
     PyErr_Occurred(): 1ec4. to tell this case apart from missing module
     state.

 -- C の関数: int PyModule_GetStateSize (PyObject *module, Py_ssize_t
          *result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Set '*result' to the size of 'module"s state, as specified using
     *note Py_mod_state_size: 54a8. (or *note PyModuleDef.m_size: d4b.),
     and return 0.

     On error, set '*result' to -1, and return -1 with an exception set.

     Added in version 3.15.

* Menu:

* Slots for defining module state::
* Module token::


File: python.info,  Node: Slots for defining module state,  Next: Module token,  Up: Module state

7.10.6.9 Slots for defining module state
........................................

The following *note slot IDs: 5577. are available for defining the
module state.

 -- C のマクロ: Py_mod_state_size
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for the size of the module state, in bytes.

     Setting the value 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.

     詳細は PEP 3121(1) を参照。

     Use *note PyModule_GetStateSize(): 53a5. to retrieve the size of a
     given module.

     Added in version 3.15: Use *note PyModuleDef.m_size: d4b. instead
     to support previous versions.

 -- C のマクロ: Py_mod_state_traverse
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for a traversal function to call during GC
     traversal of the module object.

     The signature of the function, and meanings of the arguments, is
     similar as for *note PyTypeObject.tp_traverse: 373.:

      -- C の関数: int traverse_module_state (PyObject *module,
               visitproc visit, void *arg)

     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: d4a. function).  More precisely, this function is not
     called if the state size (*note Py_mod_state_size: 54a8.) is
     greater than 0 and the module state (as returned by *note
     PyModule_GetState(): d4c.) is ‘NULL’.

     Added in version 3.15: Use *note PyModuleDef.m_size: d4b. instead
     to support previous versions.

 -- C のマクロ: Py_mod_state_clear
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for a clear function to call during GC
     clearing of the module object.

     The signature of the function is:

      -- C の関数: int clear_module_state (PyObject *module)

     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: d4a. function).  More precisely, this function is not
     called if the state size (*note Py_mod_state_size: 54a8.) is
     greater than 0 and the module state (as returned by *note
     PyModule_GetState(): d4c.) is ‘NULL’.

     Like *note PyTypeObject.tp_clear: 5206, 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 the
     *note Py_mod_state_free: 54a7. function is called directly.

     Added in version 3.15: Use *note PyModuleDef.m_clear: d47. instead
     to support previous versions.

 -- C のマクロ: Py_mod_state_free
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for a function to call during deallocation of
     the module object.

     The signature of the function is:

      -- C の関数: int free_module_state (PyObject *module)

     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: d4a. function).  More precisely, this function is not
     called if the state size (*note Py_mod_state_size: 54a8.) is
     greater than 0 and the module state (as returned by *note
     PyModule_GetState(): d4c.) is ‘NULL’.

     Added in version 3.15: Use *note PyModuleDef.m_free: d48. instead
     to support previous versions.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3121/


File: python.info,  Node: Module token,  Prev: Slots for defining module state,  Up: Module state

7.10.6.10 Module token
......................

Each module may have an associated 'token': a pointer-sized value
intended to identify of the module state's memory layout.  This means
that if you have a module object, but you are not sure if it “belongs”
to your extension, you can check using code like this:

     PyObject *module = <the module in question>

     void *module_token;
     if (PyModule_GetToken(module, &module_token) < 0) {
         return NULL;
     }
     if (module_token != your_token) {
         PyErr_SetString(PyExc_ValueError, "unexpected module")
         return NULL;
     }

     // This module's state has the expected memory layout; it's safe to cast
     struct my_state state = (struct my_state*)PyModule_GetState(module)

A module's token - and the 'your_token' value to use in the above code -
is:

   - For modules created with *note PyModuleDef: d49.: the address of
     that ‘PyModuleDef’;

   - For modules defined with the *note Py_mod_token: 54aa. slot: the
     value of that slot;

   - For modules created from an ‘PyModExport_*’ *note export hook:
     395.: the slots array that the export hook returned (unless
     overridden with *note Py_mod_token: 54aa.).

 -- C のマクロ: Py_mod_token
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. for the module token.

     If you use this slot to set the module token (rather than rely on
     the default), 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.

        * If the token points to a *note PyModuleDef: d49. struct, the
          module should behave as if it was created from that
          ‘PyModuleDef’.  In particular, the module state must have
          matching layout and semantics.

     Modules created from *note PyModuleDef: d49. always use the address
     of the ‘PyModuleDef’ as the token.  This means that ‘Py_mod_token’
     cannot be used in *note PyModuleDef.m_slots: 198d.

     Added in version 3.15.

 -- C の関数: int PyModule_GetToken (PyObject *module, void **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Set '*result' to the module token for 'module' and return 0.

     On error, set '*result' to NULL, and return -1 with an exception
     set.

     Added in version 3.15.

See also *note PyType_GetModuleByToken(): 5428.


File: python.info,  Node: Creating extension modules dynamically,  Next: Module definition struct,  Prev: Module state,  Up: モジュールオブジェクト module object

7.10.6.11 Creating extension modules dynamically
................................................

The following functions may be used to create an extension module
dynamically, rather than from an extension's *note export hook: 395.

 -- C の関数: *note PyObject: 1a6. *PyModule_FromSlotsAndSpec (const
          PySlot *slots, PyObject *spec)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.15 より).'  Create a new module object, given an array of
     *note slots: 57aa. and the *note ModuleSpec: 247c. 'spec'.

     The 'slots' argument must point to an array of *note PySlot: 1a8.
     structures, terminated by an entry with slot ID of 0 (typically
     written as *note PySlot_END: 391.).  The array must include a *note
     Py_mod_abi: 360. entry.

     The 'spec' argument may be any ‘ModuleSpec’-like object, as
     described in *note Py_mod_create: 54a4. documentation.  Currently,
     the 'spec' must have a ‘name’ attribute.

     On success, return the new module.  On error, return ‘NULL’ with an
     exception set.

     Note that this does not process the module's execution slot (*note
     Py_mod_exec: d4a.).  Both ‘PyModule_FromSlotsAndSpec()’ and *note
     PyModule_Exec(): 53a0. must be called to fully initialize a module.
     (See also *note 多段階初期化: 556a.)

     Added in version 3.15.

 -- C の関数: int PyModule_Exec (PyObject *module)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Execute the *note Py_mod_exec: d4a. slot(s) of 'module'.

     On success, return 0.  On error, return -1 with an exception set.

     For clarity: If 'module' has no slots, for example if it uses *note
     legacy single-phase initialization: 556b, this function does
     nothing and returns 0.

     Added in version 3.15.


File: python.info,  Node: Module definition struct,  Next: サポート関数,  Prev: Creating extension modules dynamically,  Up: モジュールオブジェクト module object

7.10.6.12 Module definition struct
..................................

Traditionally, extension modules were defined using a 'module
definition' as the “description" of how a module should be created.
Rather than using an array of *note slots: 57aa. directly, the
definition has dedicated members for most common functionality, and
allows additional slots as an extension mechanism.

This way of defining modules is still available and there are no plans
to remove it.

 -- C のデータ型: type PyModuleDef
     ' 次に属します: *note Stable ABI: 961. (see below).'  The module
     definition struct, which holds 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 defined this way.

     The struct, including all members, is part of the *note Stable ABI:
     1a2. for non-free-threaded builds (‘abi3’).  In the Stable ABI for
     free-threaded builds (‘abi3t’), this struct is opaque, and unusable
     in practice; see *note Module definition: 57aa. for a replacement.

      -- C のメンバ変数: *note PyModuleDef_Base: 539a. m_base

          Always initialize this member to *note PyModuleDef_HEAD_INIT:
          57c6.:

           -- C のデータ型: type PyModuleDef_Base
               ' 次に属します: *note Stable ABI: 961. (see below).'  The
               type of ‘PyModuleDef.m_base’.

               The struct is part of the *note Stable ABI: 1a2. for
               non-free-threaded builds (‘abi3’).  In the Stable ABI for
               Free-Threaded Builds (‘abi3t’), this struct is opaque,
               and unusable in practice.

           -- C のマクロ: PyModuleDef_HEAD_INIT

               The required initial value for ‘PyModuleDef.m_base’.

      -- C のメンバ変数: const char *m_name

          Corresponds to the *note Py_mod_name: 51af. slot.

      -- C のメンバ変数: const char *m_doc

          These members correspond to the *note Py_mod_doc: 51b0. slot.
          Setting this to NULL is equivalent to omitting the slot.

      -- C のメンバ変数: *note Py_ssize_t: e28. m_size

          Corresponds to the *note Py_mod_state_size: 54a8. slot.
          Setting this to zero is equivalent to omitting the slot.

          When using *note legacy single-phase initialization: 556b. or
          when creating modules dynamically using *note
          PyModule_Create(): 5571. or *note PyModule_Create2(): 539f,
          ‘m_size’ may be set to -1.  This indicates that the module
          does not support sub-interpreters, because it has global
          state.

      -- C のメンバ変数: *note PyMethodDef: 188f. *m_methods

          Corresponds to the *note Py_mod_methods: 51b5. slot.  Setting
          this to NULL is equivalent to omitting the slot.

      -- C のメンバ変数: *note PyModuleDef_Slot: 539c. *m_slots

          An array of additional slots, terminated by a ‘{0, NULL}’
          entry.  Note that the entries use the older *note
          PyModuleDef_Slot: 539c. structure, rather than *note PySlot:
          1a8.

          If the array contains slots corresponding to *note
          PyModuleDef: d49. members, the values must match.  For
          example, if you use *note Py_mod_name: 51af. in ‘m_slots’,
          *note PyModuleDef.m_name: 57ae. must be set to the same
          pointer (not just an equal string).

          バージョン 3.5 で変更: バージョン 3.5 より前は、このメンバは常
          に ‘NULL’ に設定されていて、次のものとして定義されていました:

                -- C のメンバ変数: *note inquiry: 5503. m_reload

           -- C のデータ型: type PyModuleDef_Slot
               ' 次に属します: *note Stable ABI: 961. (すべてのメンバー
               を含む) (バージョン 3.5 より).'  Older structure defining
               additional slots of a module.

               Note that a ‘PyModuleDef_Slot’ array may be included in a
               ‘PySlot’ array using *note Py_mod_slots: 383, and vice
               versa using *note Py_slot_subslots: 381.

               Each ‘PyModuleDef_Slot’ structure ‘modslot’ is
               interpreted as the following *note PySlot: 1a8.
               structure:

                    (PySlot){
                       .sl_id=modslot.slot,
                       .sl_flags=PySlot_INTPTR | sub_static,
                       .sl_ptr=modslot.value
                    }

               where ‘sub_static’ is ‘PySlot_STATIC’ if the slot
               requires the flag (such as for *note Py_mod_methods:
               51b5.), or if this flag is present on the "parent"
               ‘Py_mod_slots’ slot (if any).

                -- C のメンバ変数: int slot

                    Corresponds to *note PySlot.sl_id: 5577.

                -- C のメンバ変数: void *value

                    Corresponds to *note PySlot.sl_ptr: 557b.

               Added in version 3.5.

      -- C のメンバ変数: *note traverseproc: 5512. m_traverse
      -- C のメンバ変数: *note inquiry: 5503. m_clear
      -- C のメンバ変数: *note freefunc: 57ca. m_free

          These members correspond to the *note Py_mod_state_traverse:
          54a9, *note Py_mod_state_clear: 54a6, and *note
          Py_mod_state_free: 54a7. slots, respectively.

          Setting these members to NULL is equivalent to omitting the
          corresponding slots.

          バージョン 3.9 で変更: *note m_traverse: d46, *note m_clear:
          d47. and *note m_free: d48. functions are no longer called
          before the module state is allocated.

 -- C 変数: *note PyTypeObject: e6f. PyModuleDef_Type
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.5 より).'  The
     type of ‘PyModuleDef’ objects.

 -- C のマクロ: Py_mod_slots
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     *note Slot ID: 5577. that works like *note Py_slot_subslots: 381,
     except it specifies an array of *note PyModuleDef_Slot: 539c.
     structures.

     Added in version 3.15.

The following API can be used to create modules from a ‘PyModuleDef’
struct:

 -- C の関数: *note PyObject: 1a6. *PyModule_Create (PyModuleDef *def)
     '戻り値: 新しい参照。' Create a new module object, given the
     definition in 'def'.  This is a macro that calls *note
     PyModule_Create2(): 539f. with 'module_api_version' set to *note
     PYTHON_API_VERSION: 4c22, or to *note PYTHON_ABI_VERSION: 57cc. if
     using the *note limited API: 82f.

 -- C の関数: *note PyObject: 1a6. *PyModule_Create2 (PyModuleDef *def,
          int module_api_version)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  APIバ
     ージョンを 'module_api_version' として 'def' での定義に従って新しい
     モジュールオブジェクトを生成します。 もし指定されたバージョンが実行
     しているインタープリターのバージョンと異なる場合は、 *note
     RuntimeWarning: 6e3. を発生させます。

     Return ‘NULL’ with an exception set on error.

     This function does not support slots.  The *note m_slots: 198d.
     member of 'def' must be ‘NULL’.

          注釈: ほとんどの場合、この関数ではなく *note
          PyModule_Create(): 5571. を利用するべきです。この関数は、この
          関数の必要性を理解しているときにだけ利用してください。

 -- C の関数: *note PyObject: 1a6. *PyModule_FromDefAndSpec (PyModuleDef
          *def, PyObject *spec)
     '戻り値: 新しい参照。' This macro calls *note
     PyModule_FromDefAndSpec2(): 39b. with 'module_api_version' set to
     *note PYTHON_API_VERSION: 4c22, or to *note PYTHON_ABI_VERSION:
     57cc. if using the *note limited API: 82f.

     Added in version 3.5.

     *note Soft deprecated: 1b2. since version 3.16.0a0 (unreleased):
     Prefer *note PyModule_FromSlotsAndSpec(): 394. in new code.

 -- C の関数: *note PyObject: 1a6. *PyModule_FromDefAndSpec2
          (PyModuleDef *def, PyObject *spec, int module_api_version)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  APIバージョンを 'module_api_version' として、
     'def' と ModuleSpec オブジェクトの 'spec' で定義されたとおりに新し
     いモジュールオブジェクトを生成します。 もし指定されたバージョンが実
     行しているインタープリターのバージョンと異なる場合は、 *note
     RuntimeWarning: 6e3. を発生させます。

     Return ‘NULL’ with an exception set on error.

     Note that this does not process execution slots (*note Py_mod_exec:
     d4a.).  Both ‘PyModule_FromDefAndSpec’ and ‘PyModule_ExecDef’ must
     be called to fully initialize a module.

          注釈: ほとんどの場合、この関数ではなく *note
          PyModule_FromDefAndSpec(): 39a. を利用するべきです。 この関数
          は、この関数の必要性を理解しているときにだけ利用してください。

     Added in version 3.5.

     *note Soft deprecated: 1b2. since version 3.16.0a0 (unreleased):
     Prefer *note PyModule_FromSlotsAndSpec(): 394. in new code.

 -- C の関数: int PyModule_ExecDef (PyObject *module, PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'
     'def' で与えられた任意の実行スロット (*note Py_mod_exec: d4a.) を実
     行します。

     Added in version 3.5.

     *note Soft deprecated: 1b2. since version 3.16.0a0 (unreleased): To
     run a module's own execution slots, prefer *note PyModule_Exec():
     53a0, which works on modules that were not created from a *note
     PyModuleDef: d49. structure.

 -- C のマクロ: PYTHON_API_VERSION
 -- C のマクロ: PYTHON_API_STRING

     The C API version, as an integer (‘1013’) and string (‘"1013"’),
     respectively.  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
 -- C のマクロ: PYTHON_ABI_STRING

     Defined as ‘3’ and ‘"3"’, respectively, 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: サポート関数,  Prev: Module definition struct,  Up: モジュールオブジェクト module object

7.10.6.13 サポート関数
......................

The following functions are provided to help initialize a module object.
They are intended for a module's execution slot (*note Py_mod_exec:
d4a.), the initialization function for legacy *note single-phase
initialization: 556b, or code that creates modules dynamically.

 -- C の関数: int PyModule_AddObjectRef (PyObject *module, const char
          *name, PyObject *value)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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(): 5460. and *note
     PyObject_SetAttr(): 1948. directly.  For more details, see *note
     PyUnicode_InternFromString(): 3bd, 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: 961. (バージョン 3.13 より).'
     Similar to *note PyModule_AddObjectRef(): 806, 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: 961.'  Similar to *note
     PyModule_AddObjectRef(): 806, but steals a reference to 'value' on
     success (if it returns ‘0’).

     The new *note PyModule_Add(): 805. or *note
     PyModule_AddObjectRef(): 806. functions are recommended, since it
     is easy to introduce reference leaks by misusing the *note
     PyModule_AddObject(): 807. 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(): b73. '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: 1b2. since version 3.13.

 -- C の関数: int PyModule_AddIntConstant (PyObject *module, const char
          *name, long value)
     ' 次に属します: *note Stable ABI: 961.'  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():
     1de9. and *note PyModule_AddObjectRef(): 806.; see their
     documentation for details.

 -- C の関数: int PyModule_AddStringConstant (PyObject *module, const
          char *name, const char *value)
     ' 次に属します: *note Stable ABI: 961.'  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(): 3bd. and *note
     PyModule_AddObjectRef(): 806.; 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: 961. (バージョン 3.10 より).'
     Add a type object to 'module'.  The type object is finalized by
     calling internally *note PyType_Ready(): b63.  The name of the type
     object is taken from the last component of *note tp_name: 1ec5.
     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: 961. (バージョン 3.7 より).'  Add
     the functions from the ‘NULL’ terminated 'functions' array to
     'module'.  Refer to the *note PyMethodDef: 188f. 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 多段階初期化: 556a,
     ‘PyModule_Create’, or ‘PyModule_FromDefAndSpec’).  Some module
     authors may prefer defining functions in multiple *note
     PyMethodDef: 188f. 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: 961. (バージョン 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 多段階初期化: 556a, ‘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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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: 697.  It must be called during 'module"s initialization
     function when using *note 従来の一段階初期化: 556b.  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: 6ab.  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.10.6.14 Module lookup (single-phase initialization)
.....................................................

The legacy *note single-phase initialization: 556b. 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: 1a6. *PyState_FindModule (PyModuleDef
          *def)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'  現在の
     インタプリタの 'def' から作られたモジュールオブジェクトを返します。
     このメソッドの前提条件として、前もって *note PyState_AddModule():
     53fd. でインタプリタの state にモジュールオブジェクトを連結しておく
     ことを要求します。対応するモジュールオブジェクトが見付からない、も
     しくは事前にインタプリタの state に連結されていない場合は、 ‘NULL’
     を返します。

 -- C の関数: int PyState_AddModule (PyObject *module, PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.3 より).'  関
     数に渡されたモジュールオブジェクトを、インタプリタの state に連結し
     ます。この関数を使うことで *note PyState_FindModule(): 53fe. からモ
     ジュールオブジェクトにアクセスできるようになります。

     一段階初期化を使って作成されたモジュールにのみ有効です。

     Python calls ‘PyState_AddModule’ automatically after importing a
     module that uses *note single-phase initialization: 556b, 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: 1ac.

     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: 961. (バージョン 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: 1ac.

     Added in version 3.3.


File: python.info,  Node: イテレータオブジェクト iterator object,  Next: デスクリプタオブジェクト descriptor object,  Prev: モジュールオブジェクト module object,  Up: その他のオブジェクト<2>

7.10.6.15 イテレータオブジェクト (iterator object)
..................................................

Python では二種類のイテレータオブジェクトを提供しています。一つ目はシー
ケンスイテレータで、 *note __getitem__(): 78d. メソッドをサポートする任
意のシーケンスを取り扱います。二つ目は呼び出し可能オブジェクトと番兵
(sentinel value) を扱い、シーケンス内の要素ごとに呼び出し可能オブジェク
トを呼び出して、センチネル値が返されたときに反復処理を終了します。

 -- C 変数: *note PyTypeObject: e6f. PySeqIter_Type
     ' 次に属します: *note Stable ABI: 961.'  *note PySeqIter_New():
     53e4. や、組み込みシーケンス型に対して 1 引数形式の組み込み関数
     *note iter(): bb8. を呼び出したときに返される、イテレータオブジェク
     トの型オブジェクトです。

 -- C の関数: int PySeqIter_Check (PyObject *op)

     'op' の型が ‘PySeqlter_Type’ 型の場合に真を返します。この関数は常に
     成功します。

 -- C の関数: *note PyObject: 1a6. *PySeqIter_New (PyObject *seq)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  一般
     的なシーケンスオブジェクト 'seq' を扱うイテレータを返します。反復処
     理は、シーケンスが添字指定操作の際に *note IndexError: 18ed. を返し
     たときに終了します。

 -- C 変数: *note PyTypeObject: e6f. PyCallIter_Type
     ' 次に属します: *note Stable ABI: 961.'  *note PyCallIter_New():
     52c4. や、組み込み関数 *note iter(): bb8. の 2 引数形式が返すイテレ
     ータオブジェクトの型オブジェクトです。

 -- C の関数: int PyCallIter_Check (PyObject *op)

     'op' の型が *note PyCallIter_Type: 52c5. 型の場合に真を返します。こ
     の関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyCallIter_New (PyObject *callable,
          PyObject *sentinel)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  新た
     なイテレータを返します。最初のパラメタ '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.10.6.16 Range Objects
.......................

 -- C 変数: *note PyTypeObject: e6f. PyRange_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for *note
     range: d13. objects.

 -- C の関数: int PyRange_Check (PyObject *o)

     Return true if the object 'o' is an instance of a *note range: d13.
     object.  This function always succeeds.


File: python.info,  Node: Builtin Iterator Types,  Next: Other Iterator Objects,  Prev: Range Objects,  Up: イテレータオブジェクト iterator object

7.10.6.17 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: e6f. PyEnum_Type       *note enumerate: 1839.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyTypeObject: e6f. PyFilter_Type     *note filter: c3f.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyTypeObject: e6f. PyMap_Type        *note map: 445.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyTypeObject: e6f. PyReversed_Type   *note reversed: c40.
     ' 次に属します: *note Stable ABI: 961.'           

 -- C 変数: *note PyTypeObject: e6f. PyZip_Type        *note zip: 446.
     ' 次に属します: *note Stable ABI: 961.'           


File: python.info,  Node: Other Iterator Objects,  Prev: Builtin Iterator Types,  Up: イテレータオブジェクト iterator object

7.10.6.18 Other Iterator Objects
................................

 -- C 変数: *note PyTypeObject: e6f. PyByteArrayIter_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyBytesIter_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyListIter_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyListRevIter_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PySetIter_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyTupleIter_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyRangeIter_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyLongRangeIter_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyDictIterKey_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyDictRevIterKey_Type
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: e6f. PyDictIterValue_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyDictRevIterValue_Type
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: e6f. PyDictIterItem_Type
     ' 次に属します: *note Stable ABI: 961.'

 -- C 変数: *note PyTypeObject: e6f. PyDictRevIterItem_Type
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: e6f. PyODictIter_Type

     Type objects for iterators of various built-in objects.

     Do not create instances of these directly; prefer calling *note
     PyObject_GetIter(): 53d9. instead.

     Note that there is no guarantee that a given built-in type uses a
     given iterator type.  For example, iterating over *note range: d13.
     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.10.6.19 デスクリプタオブジェクト (descriptor object)
......................................................

"デスクリプタ (descriptor)" は、あるオブジェクトのいくつかの属性について
記述したオブジェクトです。デスクリプタオブジェクトは型オブジェクトの辞書
内にあります。

 -- C の関数: *note PyObject: 1a6. *PyDescr_NewGetSet (PyTypeObject
          *type, struct PyGetSetDef *getset)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Create a new get-set descriptor for extension type 'type' from the
     *note PyGetSetDef: f7b. structure 'getset'.

     Get-set descriptors expose attributes implemented by C getter and
     setter functions rather than stored directly in the instance.  This
     is the same kind of descriptor created for entries in *note
     tp_getset: 51fb, and it appears in Python as a *note
     types.GetSetDescriptorType: 2c14. object.

     On success, return a *note strong reference: 7e0. to the
     descriptor.  Return ‘NULL’ with an exception set on failure.

 -- C の関数: *note PyObject: 1a6. *PyDescr_NewMember (PyTypeObject
          *type, struct PyMemberDef *member)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Create a new member descriptor for extension type 'type' from the
     *note PyMemberDef: 95f. structure 'member'.

     Member descriptors expose fields in the type's C struct as Python
     attributes.  This is the same kind of descriptor created for
     entries in *note tp_members: 51f6, and it appears in Python as a
     *note types.MemberDescriptorType: 2c15. object.

     On success, return a *note strong reference: 7e0. to the
     descriptor.  Return ‘NULL’ with an exception set on failure.

 -- C 変数: *note PyTypeObject: e6f. PyMemberDescr_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for member
     descriptor objects created from *note PyMemberDef: 95f. structures.
     These descriptors expose fields of a C struct as attributes on a
     type, and correspond to *note types.MemberDescriptorType: 2c15.
     objects in Python.

 -- C 変数: *note PyTypeObject: e6f. PyGetSetDescr_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for
     get/set descriptor objects created from *note PyGetSetDef: f7b.
     structures.  These descriptors implement attributes whose value is
     computed by C getter and setter functions, and are used for many
     built-in type attributes.  They correspond to *note
     types.GetSetDescriptorType: 2c14. objects in Python.

 -- C の関数: *note PyObject: 1a6. *PyDescr_NewMethod (PyTypeObject
          *type, struct PyMethodDef *meth)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Create a new method descriptor for extension type 'type' from the
     *note PyMethodDef: 188f. structure 'meth'.

     Method descriptors expose C functions as methods on a type.  This
     is the same kind of descriptor created for entries in *note
     tp_methods: 51f8, and it appears in Python as a *note
     types.MethodDescriptorType: f5d. object.

     On success, return a *note strong reference: 7e0. to the
     descriptor.  Return ‘NULL’ with an exception set on failure.

 -- C 変数: *note PyTypeObject: e6f. PyMethodDescr_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for method
     descriptor objects created from *note PyMethodDef: 188f.
     structures.  These descriptors expose C functions as methods on a
     type, and correspond to *note types.MethodDescriptorType: f5d.
     objects in Python.

 -- C Struct: struct wrapperbase

     Describes a slot wrapper used by *note PyDescr_NewWrapper(): 57e1.

     Each ‘wrapperbase’ record stores the Python-visible name and
     metadata for a special method implemented by a type slot, together
     with the wrapper function used to adapt that slot to Python's
     calling convention.

 -- C の関数: *note PyObject: 1a6. *PyDescr_NewWrapper (PyTypeObject
          *type, struct wrapperbase *base, void *wrapped)
     '戻り値: 新しい参照。' Create a new wrapper descriptor for
     extension type 'type' from the *note wrapperbase: 57e0. structure
     'base' and the wrapped slot function pointer 'wrapped'.

     Wrapper descriptors expose special methods implemented by type
     slots.  This is the same kind of descriptor that CPython creates
     for slot-based special methods such as ‘__repr__’ or ‘__add__’, and
     it appears in Python as a *note types.WrapperDescriptorType: f5c.
     object.

     On success, return a *note strong reference: 7e0. to the
     descriptor.  Return ‘NULL’ with an exception set on failure.

 -- C 変数: *note PyTypeObject: e6f. PyWrapperDescr_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for
     wrapper descriptor objects created by *note PyDescr_NewWrapper():
     57e1. and *note PyWrapper_New(): 546e.  Wrapper descriptors are
     used internally to expose special methods implemented via wrapper
     structures, and appear in Python as *note
     types.WrapperDescriptorType: f5c. objects.

 -- C の関数: *note PyObject: 1a6. *PyDescr_NewClassMethod (PyTypeObject
          *type, PyMethodDef *method)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Create a new class method descriptor for extension type 'type' from
     the *note PyMethodDef: 188f. structure 'method'.

     Class method descriptors expose C methods that receive the class
     rather than an instance when accessed.  This is the same kind of
     descriptor created for ‘METH_CLASS’ entries in *note tp_methods:
     51f8, and it appears in Python as a *note
     types.ClassMethodDescriptorType: f5e. object.

     On success, return a *note strong reference: 7e0. to the
     descriptor.  Return ‘NULL’ with an exception set on failure.

 -- 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: 1a6. *PyWrapper_New (PyObject *d, PyObject
          *self)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Create a new bound wrapper object from the wrapper descriptor 'd'
     and the instance 'self'.

     This is the bound form of a wrapper descriptor created by *note
     PyDescr_NewWrapper(): 57e1.  CPython creates these objects when a
     slot wrapper is accessed through an instance, and they appear in
     Python as *note types.MethodWrapperType: a3f. objects.

     On success, return a *note strong reference: 7e0. to the wrapper
     object.  Return ‘NULL’ with an exception set on failure.

 -- C のマクロ: PyDescr_COMMON

     This is a macro including the common fields for a descriptor
     object.

     This was included in Python's C API by mistake; do not use it in
     extensions.  For creating custom descriptor objects, create a class
     implementing the descriptor protocol (*note tp_descr_get: 57e3. and
     *note tp_descr_set: 1ec9.).

     *note Soft deprecated: 1b2. since version 3.15.

* Menu:

* Built-in descriptors::


File: python.info,  Node: Built-in descriptors,  Up: デスクリプタオブジェクト descriptor object

7.10.6.20 Built-in descriptors
..............................

 -- C 変数: *note PyTypeObject: e6f. PyProperty_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for
     property objects.  This is the same object as *note property: 6c1.
     in the Python layer.

 -- C 変数: *note PyTypeObject: e6f. PySuper_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for super
     objects.  This is the same object as *note super: 44a. in the
     Python layer.

 -- C 変数: *note PyTypeObject: e6f. PyClassMethod_Type

     The type of class method objects.  This is the same object as *note
     classmethod: 6a0. in the Python layer.

 -- C 変数: *note PyTypeObject: e6f. PyClassMethodDescr_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object for
     C-level class method descriptor objects.  This is the type of the
     descriptors created for *note classmethod(): 6a0. defined in C
     extension types, and corresponds to *note
     types.ClassMethodDescriptorType: f5e. objects in Python.

 -- C の関数: *note PyObject: 1a6. *PyClassMethod_New (PyObject
          *callable)

     Create a new *note classmethod: 6a0. object wrapping 'callable'.
     'callable' must be a callable object and must not be ‘NULL’.

     On success, this function returns a *note strong reference: 7e0. to
     a new class method descriptor.  On failure, this function returns
     ‘NULL’ with an exception set.

 -- C 変数: *note PyTypeObject: e6f. PyStaticMethod_Type

     The type of static method objects.  This is the same object as
     *note staticmethod: 66d. in the Python layer.

 -- C の関数: *note PyObject: 1a6. *PyStaticMethod_New (PyObject
          *callable)

     Create a new *note staticmethod: 66d. object wrapping 'callable'.
     'callable' must be a callable object and must not be ‘NULL’.

     On success, this function returns a *note strong reference: 7e0. 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.10.6.21 スライスオブジェクト (slice object)
.............................................

 -- C 変数: *note PyTypeObject: e6f. PySlice_Type
     ' 次に属します: *note Stable ABI: 961.'  スライスオブジェクトの型オ
     ブジェクトです。これは、Pythonレイヤにおける *note slice: 1db. と同
     じオブジェクトです。

 -- C の関数: int PySlice_Check (PyObject *ob)

     'ob' がスライスオブジェクトの場合に真を返します; 'ob' は ‘NULL’ で
     あってはなりません。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PySlice_New (PyObject *start,
          PyObject *stop, PyObject *step)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     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: 961.'  スライスオブジェクト
     '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: 961.'  *note
     PySlice_GetIndices(): 53f7. の便利な代替です。 '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(): 64c. and *note
          PySlice_AdjustIndices(): 64d. 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: 961. (バージョン 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: e28. PySlice_AdjustIndices (Py_ssize_t
          length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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.10.6.22 Ellipsis オブジェクト
...............................

 -- C 変数: *note PyTypeObject: e6f. PyEllipsis_Type
     ' 次に属します: *note Stable ABI: 961.'  The type of Python *note
     Ellipsis: 2537. object.  Same as *note types.EllipsisType: c2d. in
     the Python layer.

 -- C 変数: *note PyObject: 1a6. *Py_Ellipsis

     Python の ‘Ellipsis’ オブジェクト。このオブジェクトにはメソッドがあ
     りません。 *note Py_None: 5615. と同様、これは *note immortal: 3a0.
     でシングルトンなオブジェクトです。

     バージョン 3.12 で変更: *note Py_Ellipsis: 57ef. は immortal です。


File: python.info,  Node: memoryview オブジェクト,  Next: Pickle buffer objects,  Prev: スライスオブジェクト slice object,  Up: その他のオブジェクト<2>

7.10.6.23 memoryview オブジェクト
.................................

*note memoryview: 1dd. オブジェクトは、他のオブジェクトと同じように扱え
る Python オブジェクトの形をした C 言語レベルの *note
バッファのインターフェース: 319. です。

 -- C 変数: *note PyTypeObject: e6f. PyMemoryView_Type
     ' 次に属します: *note Stable ABI: 961.'  This instance of *note
     PyTypeObject: e6f. represents the Python memoryview type.  This is
     the same object as *note memoryview: 1dd. in the Python layer.

 -- C の関数: *note PyObject: 1a6. *PyMemoryView_FromObject (PyObject
          *obj)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'  バッ
     ファインターフェースを提供するオブジェクトからmemoryview オブジェク
     トを生成します。もし 'obj' が書き込み可能なバッファのエクスポートを
     サポートするなら、その memoryview オブジェクトは読み書き可能です。
     そうでなければ読出しのみになるか、エクスポーターの分別にもとづいて
     読み書きが可能となります。

 -- C のマクロ: PyBUF_READ
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     Flag to request a readonly buffer.

 -- C のマクロ: PyBUF_WRITE
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     Flag to request a writable buffer.

 -- C の関数: *note PyObject: 1a6. *PyMemoryView_FromMemory (char *mem,
          Py_ssize_t size, int flags)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.7 より).'  'mem' を配下のバッファとしてmemoryview オブジェ
     クトを作成します。 'flags' は *note PyBUF_READ: 1c32. か *note
     PyBUF_WRITE: 1c33. のどちらかになります。

     Added in version 3.3.

 -- C の関数: *note PyObject: 1a6. *PyMemoryView_FromBuffer (const
          Py_buffer *view)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.11 より).'  'view' として与えられたバッファ構造をラップす
     る memoryview オブジェクトを作成します。単なるバイトバッファ向けに
     は、 *note PyMemoryView_FromMemory(): 152e. のほうが望ましいです。

 -- C の関数: *note PyObject: 1a6. *PyMemoryView_GetContiguous (PyObject
          *obj, int buffertype, char order)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     buffer インターフェースを定義しているオブジェクトから ('C' か
     'F'ortran の 'order' で) *note 連続した: 13f9. メモリチャンクへの
     memoryview オブジェクトを作ります。メモリが連続している場合、
     memoryview オブジェクトは元のメモリを参照します。それ以外の場合、メ
     モリはコピーされて、 memoryview オブジェクトは新しい bytes オブジェ
     クトを参照します。

     'buffertype' can be one of *note PyBUF_READ: 1c32. or *note
     PyBUF_WRITE: 1c33.

 -- C の関数: int PyMemoryView_Check (PyObject *obj)

     'obj' が memoryview オブジェクトの場合に真を返します。現在のところ
     、 *note memoryview: 1dd. のサブクラスの作成は許可されていません。
     この関数は常に成功します。

 -- C の関数: *note Py_buffer: b3f. *PyMemoryView_GET_BUFFER (PyObject
          *mview)

     書きだされたバッファーの memoryview のプライベート コピーに、ポイン
     ターを返します。 'mview' は memoryview インスタンスでなければなりま
     せん; このマクロは型をチェックしないので自前で型チェックしなければ
     ならず、それを怠るとクラッシュする恐れがあります。

 -- C の関数: *note PyObject: 1a6. *PyMemoryView_GET_BASE (PyObject
          *mview)

     memoryview をエクスポートしているオブジェクトへのポインタを返します
     。 memoryview が *note PyMemoryView_FromMemory(): 152e. か *note
     PyMemoryView_FromBuffer(): b48. のどちらかで作成されていた場合、
     ‘NULL’ を返します。


File: python.info,  Node: Pickle buffer objects,  Next: 弱参照オブジェクト<2>,  Prev: memoryview オブジェクト,  Up: その他のオブジェクト<2>

7.10.6.24 Pickle buffer objects
...............................

Added in version 3.8.

A *note pickle.PickleBuffer: 1929. object wraps a *note buffer-providing
object: 319. for out-of-band data transfer with the *note pickle: ab.
module.

 -- C 変数: *note PyTypeObject: e6f. PyPickleBuffer_Type

     This instance of *note PyTypeObject: e6f. represents the Python
     pickle buffer type.  This is the same object as *note
     pickle.PickleBuffer: 1929. 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: 1a6. *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: 319.

     On success, return a new pickle buffer instance.  On failure, set
     an exception and return ‘NULL’.

     Analogous to calling *note pickle.PickleBuffer: 1929. with 'obj' in
     Python.

 -- C の関数: const *note Py_buffer: b3f. *PyPickleBuffer_GetBuffer
          (PyObject *picklebuf)

     Get a pointer to the underlying *note Py_buffer: b3f. 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: b3f.  If the pickle buffer has been
     released, raise *note ValueError: 15a.

     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(): 2f56. in
     Python.


File: python.info,  Node: 弱参照オブジェクト<2>,  Next: カプセル<2>,  Prev: Pickle buffer objects,  Up: その他のオブジェクト<2>

7.10.6.25 弱参照オブジェクト
............................

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: 1a6. *PyWeakref_NewRef (PyObject *ob,
          PyObject *callback)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Return a weak reference object for the object 'ob'.  This will
     always return a new reference, but is not guaranteed to create a
     new object; an existing reference object may be returned.  The
     second parameter, 'callback', can be a callable object that
     receives notification when 'ob' is garbage collected; it should
     accept a single parameter, which will be the weak reference object
     itself.  'callback' may also be ‘None’ or ‘NULL’.  If 'ob' is not a
     weakly referenceable object, or if 'callback' is not callable,
     ‘None’, or ‘NULL’, this will return ‘NULL’ and raise *note
     TypeError: 29c.

     参考
     ....

     *note PyType_SUPPORTS_WEAKREFS(): 5655. for checking if 'ob' is
     weakly referenceable.

 -- C の関数: *note PyObject: 1a6. *PyWeakref_NewProxy (PyObject *ob,
          PyObject *callback)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Return a weak reference proxy object for the object 'ob'.  This
     will always return a new reference, but is not guaranteed to create
     a new object; an existing proxy object may be returned.  The second
     parameter, 'callback', can be a callable object that receives
     notification when 'ob' is garbage collected; it should accept a
     single parameter, which will be the weak reference object itself.
     'callback' may also be ‘None’ or ‘NULL’.  If 'ob' is not a weakly
     referenceable object, or if 'callback' is not callable, ‘None’, or
     ‘NULL’, this will return ‘NULL’ and raise *note TypeError: 29c.

     参考
     ....

     *note PyType_SUPPORTS_WEAKREFS(): 5655. for checking if 'ob' is
     weakly referenceable.

 -- C の関数: int PyWeakref_GetRef (PyObject *ref, PyObject **pobj)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Get a *note strong reference: 7e0. to the referenced object from a
     weak reference, 'ref', into '*pobj'.

        * On success, set '*pobj' to a new *note strong reference: 7e0.
          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 の関数: 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: 961.'  This function is called by
     the *note tp_dealloc: 51e2. 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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Clears the weakrefs for 'object' without calling the callbacks.

     This function is called by the *note tp_dealloc: 51e2. handler for
     types with finalizers (i.e., *note __del__(): 13ab.).  The handler
     for those objects first calls *note PyObject_ClearWeakRefs(): 97f.
     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(): 97f. to clear weakrefs instead of this
     function.

     Added in version 3.13.


File: python.info,  Node: カプセル<2>,  Next: Sentinel objects,  Prev: 弱参照オブジェクト<2>,  Up: その他のオブジェクト<2>

7.10.6.26 カプセル
..................

‘using-capsules’ 以下のオブジェクトを使う方法については *note
拡張モジュールに C API を提供する: 1717. を参照してください。

Added in version 3.1.

 -- C のデータ型: type PyCapsule

     This subtype of *note PyObject: 1a6. 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: e6f. PyCapsule_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object
     corresponding to capsule objects.  This is the same object as *note
     types.CapsuleType: 2c1b. in the Python layer.

 -- C のデータ型: type PyCapsule_Destructor
     ' 次に属します: *note Stable ABI: 961.'  カプセルに対するデストラク
     タコールバック型.  次のように定義されます:

          typedef void (*PyCapsule_Destructor)(PyObject *);

     PyCapsule_Destructor コールバックの動作については *note
     PyCapsule_New(): 51e9. を参照してください。

 -- C の関数: int PyCapsule_CheckExact (PyObject *p)
     ' Thread safety: *note Atomic: 2943.'  引数が *note PyCapsule:
     162c. の場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyCapsule_New (void *pointer, const
          char *name, PyCapsule_Destructor destructor)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.''
     Thread safety: *note Atomic: 2943.'  'pointer' を格納する *note
     PyCapsule: 162c. を作成します。 'pointer' 引数は ‘NULL’ であっては
     なりません。

     失敗した場合、例外を設定して ‘NULL’ を返します。

     'name' 文字列は ‘NULL’ か、有効なC文字列へのポインタです。‘NULL’ で
     無い場合、この文字列は少なくともカプセルより長く生存する必要があり
     ます。('destructor' の中で解放することは許可されています)

     'destructor' が ‘NULL’ で無い場合、カプセルが削除されるときにそのカ
     プセルを引数として呼び出されます。

     このカプセルがモジュールの属性として保存される場合、 'name' は
     ‘modulename.attributename’ と指定されるべきです。こうすると、他のモ
     ジュールがそのカプセルを *note PyCapsule_Import(): 1e26. でインポー
     トすることができます。

 -- C の関数: void *PyCapsule_GetPointer (PyObject *capsule, const char
          *name)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  カプセルに保存されている '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: 52c7. PyCapsule_GetDestructor
          (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  カプセルに保存されている現在のデストラクタを返します。失敗
     した場合、例外を設定して ‘NULL’ を返します。

     カプセルは ‘NULL’ をデストラクタとして持つことができます。従って、
     戻り値の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1716. か *note PyErr_Occurred(): 1ec4. を利用
     して確認してください。

 -- C の関数: void *PyCapsule_GetContext (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  カプセルに保存されている現在のコンテキスト(context)を返しま
     す。失敗した場合、例外を設定して ‘NULL’ を返します。

     カプセルは ‘NULL’ をコンテキストとして持つことができます。従って、
     戻り値の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1716. か *note PyErr_Occurred(): 1ec4. を利用
     して確認してください。

 -- C の関数: const char *PyCapsule_GetName (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  カプセルに保存されている現在の name を返します。失敗した場
     合、例外を設定して ‘NULL’ を返します。

     カプセルは ‘NULL’ を name として持つことができます。従って、戻り値
     の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1716. か *note PyErr_Occurred(): 1ec4. を利用
     して確認してください。

 -- C の関数: void *PyCapsule_Import (const char *name, int no_block)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     2937.'  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(): 3ab.) 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: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  'capsule' が有効なカプセルであるかどうかをチェックします。
     有効な 'capsule' は、非 ‘NULL’ で、 *note PyCapsule_CheckExact():
     5809. をパスし、非 ‘NULL’ なポインタを格納していて、内部の name が
     引数 'name' とマッチします。 (name の比較方法については *note
     PyCapsule_GetPointer(): 52cb. を参照)

     In other words, if *note PyCapsule_IsValid(): 1716. 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: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  'capsule' 内部のコンテキストポインタを 'context' に設定しま
     す。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetDestructor (PyObject *capsule,
          PyCapsule_Destructor destructor)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  'capsule' 内部のデストラクタを 'destructor' に設定します。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetName (PyObject *capsule, const char
          *name)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  'capsule' 内部の name を 'name' に設定します。'name' が非
     ‘NULL’ のとき、それは 'capsule' よりも長い寿命を持つ必要があります
     。もしすでに 'capsule' に非 ‘NULL’ の 'name' が保存されていた場合、
     それに対する解放は行われません。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetPointer (PyObject *capsule, void
          *pointer)
     ' 次に属します: *note Stable ABI: 961.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     293c.'  'capsule' 内部のポインタを 'pointer' に設定します。
     'pointer' は ‘NULL’ であってはなりません。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。


File: python.info,  Node: Sentinel objects,  Next: フレーム frame オブジェクト<2>,  Prev: カプセル<2>,  Up: その他のオブジェクト<2>

7.10.6.27 Sentinel objects
..........................

 -- C 変数: *note PyTypeObject: e6f. PySentinel_Type

     This instance of *note PyTypeObject: e6f. represents the Python
     *note sentinel: 196. type.  This is the same object as ‘sentinel’.

     Added in version 3.15.

 -- C の関数: int PySentinel_Check (PyObject *o)

     Return true if 'o' is a *note sentinel: 196. object or a subtype.
     The ‘sentinel’ type does not currently allow subclasses, so this
     check is exact.  Future Python versions may choose to allow
     subtyping.  This function always succeeds.

     Added in version 3.15.

 -- C の関数: int PySentinel_CheckExact (PyObject *o)

     Return true if 'o' is a *note sentinel: 196. object, but not a
     subtype.  The ‘sentinel’ type does not currently allow subclasses.
     Future Python versions may choose to allow subtyping.  This
     function always succeeds.

     Added in version 3.15.

 -- C の関数: *note PyObject: 1a6. *PySentinel_New (const char *name,
          const char *module_name)
     '戻り値: 新しい参照。' Return a new *note sentinel: 196. object
     with *note __name__: 27f6. set to 'name' and *note __module__:
     27f7. set to 'module_name'.  'name' must not be ‘NULL’.  If
     'module_name' is ‘NULL’, ‘__module__’ is set to ‘None’.  Return
     ‘NULL’ with an exception set on failure.

     For pickling to work, 'module_name' must be the name of an
     importable module, and the sentinel must be accessible from that
     module under a path matching 'name'.  Pickle treats 'name' as a
     global variable name in 'module_name' (see *note
     object.__reduce__(): d9b.).

     Added in version 3.15.


File: python.info,  Node: フレーム frame オブジェクト<2>,  Next: ジェネレータオブジェクト,  Prev: Sentinel objects,  Up: その他のオブジェクト<2>

7.10.6.28 フレーム (frame) オブジェクト
.......................................

 -- C のデータ型: type PyFrameObject
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として).'  フ
     レームオブジェクトを記述する際に用いられる、オブジェクトを表す 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: b6c.
     for details.

The *note PyEval_GetFrame(): 1d56. and *note PyThreadState_GetFrame():
b72. functions can be used to get a frame object.

See also *note Reflection: 55d3.

 -- C 変数: *note PyTypeObject: e6f. PyFrame_Type

     The type of frame objects.  It is the same object as *note
     types.FrameType: 1e05. in the Python layer.

     バージョン 3.11 で変更: Previously, this type was only available
     after including ‘<frameobject.h>’.

 -- C の関数: *note PyFrameObject: b6d. *PyFrame_New (PyThreadState
          *tstate, PyCodeObject *code, PyObject *globals, PyObject
          *locals)

     Create a new frame object.  This function returns a *note strong
     reference: 7e0. 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: b6d. *PyFrame_GetBack (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame' next outer frame.

     Return a *note strong reference: 7e0, or ‘NULL’ if 'frame' has no
     outer frame.  This raises no exceptions.

     Added in version 3.9.

 -- C の関数: *note PyObject: 1a6. *PyFrame_GetBuiltins (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame"s *note f_builtins: 25ae.
     attribute.

     Return a *note strong reference: 7e0.  The result cannot be ‘NULL’.

     Added in version 3.11.

 -- C の関数: *note PyCodeObject: b5e. *PyFrame_GetCode (PyFrameObject
          *frame)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.10 より).'  Get the 'frame' code.

     Return a *note strong reference: 7e0.

     The result (frame code) cannot be ‘NULL’.

     Added in version 3.9.

 -- C の関数: *note PyObject: 1a6. *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: 7e0, or ‘NULL’.

     Added in version 3.11.

 -- C の関数: *note PyObject: 1a6. *PyFrame_GetGlobals (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame"s *note f_globals: 25ad.
     attribute.

     Return a *note strong reference: 7e0.  The result cannot be ‘NULL’.

     Added in version 3.11.

 -- C の関数: int PyFrame_GetLasti (PyFrameObject *frame)

     Get the 'frame"s *note f_lasti: c62. attribute.

     Returns -1 if ‘frame.f_lasti’ is ‘None’.

     Added in version 3.11.

 -- C の関数: *note PyObject: 1a6. *PyFrame_GetVar (PyFrameObject
          *frame, PyObject *name)
     '戻り値: 新しい参照。' Get the variable 'name' of 'frame'.

        * Return a *note strong reference: 7e0. to the variable value on
          success.

        * Raise *note NameError: 66c. and return ‘NULL’ if the variable
          does not exist.

        * Raise an exception and return ‘NULL’ on error.

     'name' type must be a *note str: 1ea.

     Added in version 3.12.

 -- C の関数: *note PyObject: 1a6. *PyFrame_GetVarString (PyFrameObject
          *frame, const char *name)
     '戻り値: 新しい参照。' Similar to *note PyFrame_GetVar(): 973, but
     the variable name is a C string encoded in UTF-8.

     Added in version 3.12.

 -- C の関数: *note PyObject: 1a6. *PyFrame_GetLocals (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame"s *note f_locals: 298.
     attribute.  If the frame refers to an *note optimized scope: 6b3,
     this returns a write-through proxy object that allows modifying the
     locals.  In all other cases (classes, modules, *note exec(): 190,
     *note eval(): 18f.) it returns the mapping representing the frame
     locals directly (as described for *note locals(): 296.).

     Return a *note strong reference: 7e0.

     Added in version 3.11.

     バージョン 3.13 で変更: As part of PEP 667(1), return an instance
     of *note PyFrameLocalsProxy_Type: 5813.

 -- C の関数: int PyFrame_GetLineNumber (PyFrameObject *frame)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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.10.6.29 Frame locals proxies
..............................

Added in version 3.13.

The *note f_locals: 298. attribute on a *note frame object: ad2. 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: e6f. PyFrameLocalsProxy_Type

     The type of frame *note locals(): 296. proxy objects.

 -- C の関数: int PyFrameLocalsProxy_Check (PyObject *obj)

     Return non-zero if 'obj' is a frame *note locals(): 296. 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.10.6.30 Legacy local variable APIs
....................................

These APIs are *note soft deprecated: 1b2.  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:
     298. 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: 1b2. 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: 298. attribute of 'f', allowing changes in local
     variables to be visible to frame objects.

     *note Soft deprecated: 1b2. 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(): 5818, but would return ‘0’ on success, and
     ‘-1’ with an exception set on failure.

     *note Soft deprecated: 1b2. 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.10.6.31 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: 1a6. *PyUnstable_InterpreterFrame_GetCode
          (struct _PyInterpreterFrame *frame);

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
          Return a *note strong reference: 7e0. 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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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.10.6.32 ジェネレータオブジェクト
..................................

ジェネレータオブジェクトは、 Python がジェネレータイテレータを実装するの
に使っているオブジェクトです。ジェネレータオブジェクトは通常、 *note
PyGen_New(): 5822. や *note PyGen_NewWithQualName(): 5823. の明示的な呼
び出しではなく、値を yield する関数のイテレーションにより生成されます。

 -- C のデータ型: type PyGenObject

     ジェネレータオブジェクトに使われている C 構造体です。

 -- C 変数: *note PyTypeObject: e6f. PyGen_Type

     ジェネレータオブジェクトに対応する型オブジェクトです。

 -- C の関数: int PyGen_Check (PyObject *ob)

     'ob' がジェネレータオブジェクトの場合に真を返ます、 'ob' は ‘NULL’
     であってはなりません。この関数は常に成功します。

 -- C の関数: int PyGen_CheckExact (PyObject *ob)

     'ob' が *note PyGen_Type: 5825. の場合に真を返します。 'o' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *PyGen_New (PyFrameObject *frame)
     '戻り値: 新しい参照。' 'frame' オブジェクトに基づいて新たなジェネレ
     ータオブジェクトを生成して返します。 この関数は 'frame' への参照を
     盗みます。 引数が ‘NULL’ であってはなりません。

 -- C の関数: *note PyObject: 1a6. *PyGen_NewWithQualName (PyFrameObject
          *frame, PyObject *name, PyObject *qualname)
     '戻り値: 新しい参照。' 'frame' オブジェクトから新たなジェネレータオ
     ブジェクトを生成し、 ‘__name__’ と ‘__qualname__’ を 'name' と
     'qualname' に設定して返します。 この関数は 'frame' への参照を盗みま
     す。 'frame' 引数は ‘NULL’ であってはなりません。

 -- C の関数: *note PyCodeObject: b5e. *PyGen_GetCode (PyGenObject *gen)

     Return a new *note strong reference: 7e0. 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.10.6.33 Asynchronous Generator Objects
........................................

参考
....

PEP 525(1)

 -- C 変数: *note PyTypeObject: e6f. PyAsyncGen_Type

     The type object corresponding to asynchronous generator objects.
     This is available as *note types.AsyncGeneratorType: 2c10. in the
     Python layer.

     Added in version 3.6.

 -- C の関数: *note PyObject: 1a6. *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: 7e0. 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.10.6.34 Deprecated API
........................

 -- C のマクロ: PyAsyncGenASend_CheckExact (op)

     This is an API that was included in Python's C API by mistake.

     It is solely here for completeness; do not use this API.

     *note Soft deprecated: 1b2. since version 3.14.


File: python.info,  Node: コルーチンオブジェクト<2>,  Next: コンテキスト変数オブジェクト,  Prev: ジェネレータオブジェクト,  Up: その他のオブジェクト<2>

7.10.6.35 コルーチンオブジェクト
................................

Added in version 3.5.

コルーチンオブジェクトは ‘async’ キーワードを使って定義した関数が返すオ
ブジェクトです。

 -- C のデータ型: type PyCoroObject

     コルーチンオブジェクトのための C 構造体。

 -- C 変数: *note PyTypeObject: e6f. PyCoro_Type

     コルーチンオブジェクトに対応する型オブジェクト。

 -- C の関数: int PyCoro_CheckExact (PyObject *ob)

     'ob' が *note PyCoro_Type: 5833. の場合に真を返します。 'ob' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: *note PyObject: 1a6. *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.10.6.36 コンテキスト変数オブジェクト
......................................

Added in version 3.7.

バージョン 3.7.1 で変更:

     注釈: Python 3.7.1 で全てのコンテキスト変数の C API のシグネチャは
     、 *note PyContext: 5839, *note PyContextVar: 583a, *note
     PyContextToken: 583b. の代わりに *note PyObject: 1a6. ポインタを使
     うように '変更' されました。例えば:

          // 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: 428. オブジェクトを表現するための C 構造
     体。

 -- C のデータ型: type PyContextVar

     *note contextvars.ContextVar: 1abc. オブジェクトを表現するための C
     構造体。

 -- C のデータ型: type PyContextToken

     *note contextvars.Token: 480. オブジェクトを表現するための C 構造体
     。

 -- C 変数: *note PyTypeObject: e6f. PyContext_Type

     'コンテキスト' 型を表現する型オブジェクト。

 -- C 変数: *note PyTypeObject: e6f. PyContextVar_Type

     'コンテキスト変数' 型を表現する型オブジェクト。

 -- C 変数: *note PyTypeObject: e6f. PyContextToken_Type

     'コンテキスト変数トークン' 型を表現する型オブジェクト。

型チェックマクロ:

 -- C の関数: int PyContext_CheckExact (PyObject *o)

     'o' が *note PyContext_Type: 583c. の場合に真を返します。 'o' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: int PyContextVar_CheckExact (PyObject *o)

     'o' が *note PyContextVar_Type: 583d. の場合に真を返します。 'o' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: int PyContextToken_CheckExact (PyObject *o)

     'o' が *note PyContextToken_Type: 583e. の場合に真を返します。 'o'
     は ‘NULL’ であってはなりません。 この関数は常に成功します。

コンテキストオブジェクトを取り扱う関数:

 -- C の関数: *note PyObject: 1a6. *PyContext_New (void)
     '戻り値: 新しい参照。' 新しい空のコンテキストオブジェクトを作成しま
     す。 エラーが起きた場合は ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *PyContext_Copy (PyObject *ctx)
     '戻り値: 新しい参照。' 渡された 'ctx' コンテキストオブジェクトの浅
     いコピーを作成します。 エラーが起きた場合は ‘NULL’ を返します。

 -- C の関数: *note PyObject: 1a6. *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(): 1bbf.  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(): 1bbe. 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: 1b96. has
          switched to a different context.  The object passed to the
          watch callback is the now-current *note contextvars.Context:
          428. object, or None if no context is current.

     Added in version 3.14.

 -- C のデータ型: typedef int (*PyContext_WatchCallback)(*note
          PyContextEvent: 5847. event, *note PyObject: 1a6. *obj)

     Context object watcher callback function.  The object passed to the
     callback is event-specific; see *note PyContextEvent: 5847. 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(): 7ed.  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: 1a6. *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: 1a6. *PyContextVar_Set (PyObject *var,
          PyObject *value)
     '戻り値: 新しい参照。' 現在のコンテキストにおいて 'var' の値を
     'value' にセットします。この変更による新しいトークンオブジェクトか
     、エラーが起こった場合は''NULL''を返します。

 -- C の関数: int PyContextVar_Reset (PyObject *var, PyObject *token)

     'var' コンテキスト変数の状態をリセットし、 'token' を返した *note
     PyContextVar_Set(): 584b. が呼ばれる前の状態に戻します。 この関数は
     成功したら ‘0’ 、失敗したら ‘-1’ を返します。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34762


File: python.info,  Node: 型ヒントのためのオブジェクト,  Prev: コンテキスト変数オブジェクト,  Up: その他のオブジェクト<2>

7.10.6.37 型ヒントのためのオブジェクト
......................................

Various built-in types for type hinting are provided.  Currently, two
types exist - *note GenericAlias: aa4. and *note Union: ba6.  Only
‘GenericAlias’ is exposed to C.

 -- C の関数: *note PyObject: 1a6. *Py_GenericAlias (PyObject *origin,
          PyObject *args)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.9 より).'
     *note GenericAlias: aa4. オブジェクトを生成します。Pythonクラス
     *note types.GenericAlias: bcb. を呼び出すことと同等です。引数
     'origin' と 'args' は ‘GenericAlias’ の ‘__origin__’ および
     ‘__args__’ 属性をそれぞれ設定します。 'origin' は *note
     PyTypeObject: e6f.* でなければならず、 'args' は *note
     PyTupleObject: 558f.* または任意の ‘PyObject*’ です。 'args' がタプ
     ルでない場合には1タプルが自動的に生成され、‘__args__’ には
     ‘(args,)’ が設定されます。引数チェックは最小限なため、たとえ
     'origin' が型を示すオブジェクトでなくても関数呼び出しは成功します。
     ‘GenericAlias’ の ‘__parameters__’ 属性は ‘__args__’ から必要に応じ
     て遅延生成されます。失敗した場合、例外が送出されて ‘NULL’ を返しま
     す。

     以下は拡張の型をジェネリックにする例です。

          ...
          static PyMethodDef my_obj_methods[] = {
              // Other methods.
              ...
              {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, "See PEP 585"}
              ...
          }

     参考
     ....

     The data model method *note __class_getitem__(): b26.

     Added in version 3.9.

 -- C 変数: *note PyTypeObject: e6f. Py_GenericAliasType
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.9 より).'
     *note Py_GenericAlias(): 547e. により返されるCの型オブジェクトです
     。Pythonの *note types.GenericAlias: bcb. と同等です。

     Added in version 3.9.


File: python.info,  Node: C API for extension modules,  Prev: その他のオブジェクト<2>,  Up: 具象オブジェクト concrete object レイヤ

7.10.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.10.7.1 Curses C API
.....................

*note curses: 2e. 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(): 5854. must
be invoked, usually as part of the module initialisation function, to
populate *note PyCurses_API: 5855.

     警告: Neither the C API nor the pure Python *note curses: 2e.
     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: 5855. pointer.

     On failure, set *note PyCurses_API: 5855. to NULL and set an
     exception.  The caller must check if an error occurred via *note
     PyErr_Occurred(): 1ec4.:

          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: 5854.
     succeeds.

     ‘PyCurses_API[0]’ corresponds to *note PyCursesWindow_Type: 5856.

     ‘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(): 370f, *note curses.initscr(): 1a3b, and *note
     curses.start_color(): 3710. have been called respectively.

     See also the convenience macros *note PyCursesSetupTermCalled:
     5857, *note PyCursesInitialised: 5858, and *note
     PyCursesInitialisedColor: 5859.

          注釈: The number of entries in this structure is subject to
          changes.  Consider using *note PyCurses_API_pointers: 585a. to
          check if new fields are available or not.

 -- C のマクロ: PyCurses_API_pointers

     The number of accessible fields (‘4’) in *note PyCurses_API: 5855.
     This number is incremented whenever new fields are added.

 -- C 変数: *note PyTypeObject: e6f. PyCursesWindow_Type

     The *note heap type: d33. corresponding to *note curses.window:
     1451.

 -- C の関数: int PyCursesWindow_Check (PyObject *op)

     Return true if 'op' is a *note curses.window: 1451. 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(): 370f. 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(): 1a3b. 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(): 3710. 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.10.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():
     1e26.

     Internal usage only.  Use *note import_curses: 5854. instead.


File: python.info,  Node: DateTime オブジェクト<2>,  Next: Internal data<2>,  Prev: Internal data,  Up: C API for extension modules

7.10.7.3 DateTime オブジェクト
..............................

*note datetime: 33. モジュールでは、様々な日付オブジェクトや時刻オブジェ
クトを提供しています。以下に示す関数を使う場合には、あらかじめヘッダファ
イル ‘datetime.h’ をソースに include し (‘Python.h’ はこのファイルを
include しません)、 *note PyDateTime_IMPORT: 3a7. マクロを、通常はモジュ
ール初期化関数から、起動しておく必要があります。このマクロは以下のマクロ
で使われる静的変数 *note PyDateTimeAPI: 5861. に C 構造体へのポインタを
入れます。

 -- C のマクロ: PyDateTime_IMPORT ()

     Import the datetime C API.

     On success, populate the *note PyDateTimeAPI: 5861. pointer.  On
     failure, set ‘PyDateTimeAPI’ to ‘NULL’ and set an exception.  The
     caller must check if an error occurred via *note PyErr_Occurred():
     1ec4.:

          PyDateTime_IMPORT;
          if (PyErr_Occurred()) { /* cleanup */ }

          警告: This is not compatible with subinterpreters.

     バージョン 3.15 で変更: This macro is now thread safe.

 -- 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: 5862. *PyDateTimeAPI

     Dynamically allocated object containing the datetime C API.

     This variable is only available once *note PyDateTime_IMPORT: 3a7.
     succeeds.

     バージョン 3.15 で変更: This variable should not be accessed
     directly as direct access is not thread-safe.  Use *note
     PyDateTime_IMPORT(): 3a7. instead.

 -- C のデータ型: type PyDateTime_Date

     この *note PyObject: 1a6. のサブタイプは、Pythonの日付オブジェクト
     を表します。

 -- C のデータ型: type PyDateTime_DateTime

     この *note PyObject: 1a6. のサブタイプは Python の datetime オブジ
     ェクトを表します。

 -- C のデータ型: type PyDateTime_Time

     この *note PyObject: 1a6. のサブタイプは Python の time オブジェク
     トを表現します。

 -- C のデータ型: type PyDateTime_Delta

     この *note PyObject: 1a6. のサブタイプは二つの datetime の値の差分
     を表します。

 -- C 変数: *note PyTypeObject: e6f. PyDateTime_DateType

     この *note PyTypeObject: e6f. のインスタンスは Python の date 型を
     表します; Python レイヤにおける *note datetime.date: 494. と同じオ
     ブジェクトです。

 -- C 変数: *note PyTypeObject: e6f. PyDateTime_DateTimeType

     この *note PyTypeObject: e6f. のインスタンスは Python の datetime 型
     を表現します; Python レイヤにおける *note datetime.datetime: 6ed. と
     同じオブジェクトです。

 -- C 変数: *note PyTypeObject: e6f. PyDateTime_TimeType

     この *note PyTypeObject: e6f. のインスタンスは Python の time 型を
     表します; Python レイヤにおける *note datetime.time: 495. と同じオ
     ブジェクトです。

 -- C 変数: *note PyTypeObject: e6f. PyDateTime_DeltaType

     This instance of *note PyTypeObject: e6f. represents the Python
     type for the difference between two datetime values; it is the same
     object as *note datetime.timedelta: d98. in the Python layer.

 -- C 変数: *note PyTypeObject: e6f. PyDateTime_TZInfoType

     この *note PyTypeObject: e6f. のインスタンスは Python の タイムゾー
     ン情報型を表します; Python レイヤにおける *note datetime.tzinfo:
     9dd. と同じオブジェクトです。

UTCシングルトンにアクセスするためのマクロ:

 -- C 変数: *note PyObject: 1a6. *PyDateTime_TimeZone_UTC

     UTCタイムゾーンに相当するシングルトンを返します。これは *note
     datetime.timezone.utc: a0c. と同じオブジェクトです。

     Added in version 3.7.

型チェックマクロ:

 -- C の関数: int PyDate_Check (PyObject *ob)

     'ob' が *note PyDateTime_DateType: 5867. 型か ‘PyDateTime_DateType’
     型のサブタイプのオブジェクトの場合に真を返します; 'ob' は ‘NULL’ で
     あってはなりません。この関数は常に成功します。

 -- C の関数: int PyDate_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DateType: 5867. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyDateTime_Check (PyObject *ob)

     'ob' が *note PyDateTime_DateTimeType: 5868. 型か
     ‘PyDateTime_DateTimeType’ 型のサブタイプのオブジェクトの場合に真を
     返します; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功し
     ます。

 -- C の関数: int PyDateTime_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DateTimeType: 5868. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyTime_Check (PyObject *ob)

     'ob' が *note PyDateTime_TimeType: 5869. 型か ‘PyDateTime_TimeType’
     型のサブタイプのオブジェクトの場合に真を返します; 'ob' は ‘NULL’ で
     あってはなりません。この関数は常に成功します。

 -- C の関数: int PyTime_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_TimeType: 5869. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyDelta_Check (PyObject *ob)

     'ob' が *note PyDateTime_DeltaType: 586a. 型か
     ‘PyDateTime_DeltaType’ 型のサブタイプのオブジェクトの場合に真を返し
     ます; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功します
     。

 -- C の関数: int PyDelta_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DeltaType: 586a. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyTZInfo_Check (PyObject *ob)

     'ob' が *note PyDateTime_TZInfoType: 586b. 型か
     ‘PyDateTime_TZInfoType’ 型のサブタイプのオブジェクトの場合に真を返
     します; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功しま
     す。

 -- C の関数: int PyTZInfo_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_TZInfoType: 586b. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

以下はオブジェクトを作成するためのマクロです:

 -- C の関数: *note PyObject: 1a6. *PyDate_FromDate (int year, int
          month, int day)
     '戻り値: 新しい参照。' 指定した年、月、日の *note datetime.date:
     494. オブジェクトを返します。

 -- C の関数: *note PyObject: 1a6. *PyDateTime_FromDateAndTime (int
          year, int month, int day, int hour, int minute, int second,
          int usecond)
     '戻り値: 新しい参照。' 指定した年、月、日、時、分、秒、マイクロ秒の
     *note datetime.datetime: 6ed. オブジェクトを返します。

 -- C の関数: *note PyObject: 1a6. *PyDateTime_FromDateAndTimeAndFold
          (int year, int month, int day, int hour, int minute, int
          second, int usecond, int fold)
     '戻り値: 新しい参照。' 指定された年、月、日、時、分、秒、マイクロ秒
     、fold の *note datetime.datetime: 6ed. オブジェクトを返します。

     Added in version 3.6.

 -- C の関数: *note PyObject: 1a6. *PyTime_FromTime (int hour, int
          minute, int second, int usecond)
     '戻り値: 新しい参照。' 指定された時、分、秒、マイクロ秒の *note
     datetime.time: 495. オブジェクトを返します。

 -- C の関数: *note PyObject: 1a6. *PyTime_FromTimeAndFold (int hour,
          int minute, int second, int usecond, int fold)
     '戻り値: 新しい参照。' 指定された時、分、秒、マイクロ秒、fold の
     *note datetime.time: 495. オブジェクトを返します。

     Added in version 3.6.

 -- C の関数: *note PyObject: 1a6. *PyDelta_FromDSU (int days, int
          seconds, int useconds)
     '戻り値: 新しい参照。' 指定された日、秒、マイクロ秒の *note
     datetime.timedelta: d98. オブジェクトを返します。マイクロ秒と秒が
     ‘datetime.timedelta’ オブジェクトで定義されている範囲に入るように正
     規化を行います。

 -- C の関数: *note PyObject: 1a6. *PyTimeZone_FromOffset (PyObject
          *offset)
     '戻り値: 新しい参照。' 'offset' 引数で指定した固定オフセットを持つ
     、名前のない *note datetime.timezone: 147f. オブジェクトを返します
     。

     Added in version 3.7.

 -- C の関数: *note PyObject: 1a6. *PyTimeZone_FromOffsetAndName
          (PyObject *offset, PyObject *name)
     '戻り値: 新しい参照。' 'offset*引数で指定した固定のオフセットと、
     *name' のタイムゾーン名を持つ *note datetime.timezone: 147f. オブジ
     ェクトを返します。

     Added in version 3.7.

以下のマクロは date オブジェクトからフィールド値を取り出すためのものです
。引数は *note PyDateTime_Date: 5863. またはそのサブクラス (例えば *note
PyDateTime_DateTime: 5864.)の インスタンスでなければなりません。引数を
‘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: 5864. またはそのサブクラスのイン
スタンスでなければなりません。引数を ‘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: 1a6. *PyDateTime_DATE_GET_TZINFO
          (PyDateTime_DateTime *o)

     Return the tzinfo (which may be ‘None’).

     Added in version 3.10.

以下のマクロは time オブジェクトからフィールド値を取り出すためのものです
。引数は *note PyDateTime_Time: 5865. またはそのサブクラスのインスタンス
でなければなりません。引数を ‘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: 1a6. *PyDateTime_TIME_GET_TZINFO
          (PyDateTime_Time *o)

     Return the tzinfo (which may be ‘None’).

     Added in version 3.10.

以下のマクロは time delta オブジェクトからフィールド値をとりだすためのも
のです。引数は *note PyDateTime_Delta: 5866. かそのサブクラスのインスタ
ンスでなければなりません。引数を ‘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: 1a6. *PyDateTime_FromTimestamp (PyObject
          *args)
     '戻り値: 新しい参照。' Create and return a new *note
     datetime.datetime: 6ed. object given an argument tuple suitable for
     passing to *note datetime.datetime.fromtimestamp(): 900.

 -- C の関数: *note PyObject: 1a6. *PyDate_FromTimestamp (PyObject
          *args)
     '戻り値: 新しい参照。' Create and return a new *note datetime.date:
     494. object given an argument tuple suitable for passing to *note
     datetime.date.fromtimestamp(): f96.


File: python.info,  Node: Internal data<2>,  Prev: DateTime オブジェクト<2>,  Up: C API for extension modules

7.10.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():
     1e26.

     Internal usage only.  Use *note PyDateTime_IMPORT: 3a7. instead.


File: python.info,  Node: インタープリタの初期化と終了処理,  Next: Thread states and the global interpreter lock,  Prev: 具象オブジェクト concrete object レイヤ,  Up: Python/C API reference manual

7.11 インタープリタの初期化と終了処理
=====================================

See *note Python Initialization Configuration: 83d. for details on how
to configure the interpreter prior to initialization.

* Menu:

* Before Python initialization::
* グローバルな設定変数::
* インタープリタの初期化と終了処理: インタープリタの初期化と終了処理<2>.
* Cautions regarding interpreter finalization::
* Interpreter views::
* プロセスワイドのパラメータ::


File: python.info,  Node: Before Python initialization,  Next: グローバルな設定変数,  Up: インタープリタの初期化と終了処理

7.11.1 Before Python initialization
-----------------------------------

In an application embedding Python, the *note Py_Initialize(): 67a.
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: 5894.

次の関数は Python の初期化の前でも安全に呼び出せます:

   * Functions that initialize the interpreter:

        * *note Py_Initialize(): 67a.

        * *note Py_InitializeEx(): 5486.

        * *note Py_InitializeFromConfig(): 611.

        * *note Py_BytesMain(): d8d.

        * *note Py_Main(): fe6.

        * the runtime pre-initialization functions covered in *note
          Python 初期化設定: 83d.

   * 設定関数:

        * *note PyImport_AppendInittab(): 1d39.

        * *note PyImport_ExtendInittab(): 1d3a.

        * ‘PyInitFrozenExtensions()’

        * *note PyMem_SetAllocator(): 98f.

        * *note PyMem_SetupDebugHooks(): 102c.

        * *note PyObject_SetArenaAllocator(): 5895.

        * *note Py_SetProgramName(): 1bdf.

        * *note Py_SetPythonHome(): 1bde.

        * the configuration functions covered in *note Python
          初期化設定: 83d.

   * 情報取得の関数:

        * *note Py_IsInitialized(): 1940.

        * *note PyMem_GetAllocator(): 5896.

        * *note PyObject_GetArenaAllocator(): 5897.

        * *note Py_GetBuildInfo(): 17ea.

        * *note Py_GetCompiler(): 5480.

        * *note Py_GetCopyright(): 5481.

        * *note Py_GetPlatform(): 5482.

        * *note Py_GetVersion(): 5484.

        * *note Py_IsInitialized(): 1940.

   * ユーティリティ:

        * *note Py_DecodeLocale(): f89.

        * the status reporting and utility functions covered in *note
          Python 初期化設定: 83d.

   * メモリアロケータ:

        * *note PyMem_RawMalloc(): 2ca.

        * *note PyMem_RawRealloc(): 82b.

        * *note PyMem_RawCalloc(): 82a.

        * *note PyMem_RawFree(): 82c.

   * Synchronization:

        * *note PyMutex_Lock(): 7cf.

        * *note PyMutex_Unlock(): 7d0.

     注釈: 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(): f8a,
     *note PyEval_InitThreads(): 1be2, and *note Py_RunMain(): d91.


File: python.info,  Node: グローバルな設定変数,  Next: インタープリタの初期化と終了処理<2>,  Prev: Before Python initialization,  Up: インタープリタの初期化と終了処理

7.11.2 グローバルな設定変数
---------------------------

Python には、様々な機能やオプションを制御するグローバルな設定のための変
数があります。 デフォルトでは、これらのフラグは *note
コマンドラインオプション: 2329. で制御されます。

オプションでフラグがセットされると、フラグの値はそのオプションがセットさ
れた回数になります。 例えば、 ‘-b’ では *note Py_BytesWarningFlag: 621.
が 1 に設定され、 ‘-bb’ では ‘Py_BytesWarningFlag’ が 2 に設定されます。

 -- C 変数: int Py_BytesWarningFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.bytes_warning: 3cc. should be used instead, see *note
     Python Initialization Configuration: 83d.

     *note bytes: 1d2. または *note bytearray: 1d1. を *note str: 1ea. と
     比較した場合、または、 ‘bytes’ を *note int: 32e. と比較した場合に
     警告を発生させます。 ‘2’ 以上の値を設定している場合は、エラーを発生
     させます。

     *note -b: 2f9. オプションで設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_DebugFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.parser_debug: 614. should be used instead, see *note
     Python Initialization Configuration: 83d.

     パーサーのデバッグ出力を有効にします。(専門家専用です。コンパイルオ
     プションに依存します)。

     *note -d: 2331. オプションと *note PYTHONDEBUG: 2332. 環境変数で設
     定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_DontWriteBytecodeFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.write_bytecode: 627. should be used instead, see *note
     Python Initialization Configuration: 83d.

     非ゼロに設定した場合、Python はソースモジュールのインポート時に
     ‘.pyc’ ファイルの作成を試みません。

     *note -B: 1786. オプションと *note PYTHONDONTWRITEBYTECODE: 1787. 環
     境変数で設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_FrozenFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.pathconfig_warnings: 623. should be used instead, see
     *note Python Initialization Configuration: 83d.

     ‘_freeze_module’ プログラムと ‘frozenmain’ プログラムが使用する非公
     開フラグです。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_HashRandomizationFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.hash_seed: 62e. and *note PyConfig.use_hash_seed: 62d.
     should be used instead, see *note Python Initialization
     Configuration: 83d.

     *note PYTHONHASHSEED: 1434. 環境変数が空でない文字列に設定された場
     合に、 ‘1’ が設定されます。

     フラグがゼロでない場合、 *note PYTHONHASHSEED: 1434. 環境変数を読み
     シークレットハッシュシードを初期化します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_IgnoreEnvironmentFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.use_environment: 625. should be used instead, see *note
     Python Initialization Configuration: 83d.

     Ignore all ‘PYTHON*’ environment variables, e.g.  *note PYTHONPATH:
     13cb. and *note PYTHONHOME: 3b5, that might be set.

     *note -E: d2b. オプションと *note -I: d2c. オプションで設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_InspectFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.inspect: 61c. should be used instead, see *note Python
     Initialization Configuration: 83d.

     最初の引数にスクリプトが指定されたときや *note -c: 44c. オプション
     が利用された際に、 *note sys.stdin: 94f. がターミナルに出力されない
     ときであっても、スクリプトかコマンドを実行した後にインタラクティブ
     モードに入ります。

     *note -i: 1893. オプションと *note PYTHONINSPECT: 1892. 環境変数で
     設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_InteractiveFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.interactive: 61a. should be used instead, see *note Python
     Initialization Configuration: 83d.

     *note -i: 1893. オプションで設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_IsolatedFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.isolated: 630. should be used instead, see *note Python
     Initialization Configuration: 83d.

     Python を隔離モードで実行します。 隔離モードでは *note sys.path:
     19f. はスクリプトのディレクトリやユーザのサイトパッケージのディレク
     トリを含みません。

     *note -I: d2c. オプションで設定します。

     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: 632. should be used
     instead, see *note Python Initialization Configuration: 83d.

     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:
     94d.

     *note PYTHONLEGACYWINDOWSFSENCODING: 15e. 環境変数が空でない文字列
     に設定された場合に、 ‘1’ に設定されます。

     より詳しくは PEP 529(1) を参照してください。

     *note Availability: 234c.: Windows.

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_LegacyWindowsStdioFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.legacy_windows_stdio: 634. should be used instead, see
     *note Python Initialization Configuration: 83d.

     If the flag is non-zero, use *note io.FileIO: 16c9. instead of
     ‘io._WindowsConsoleIO’ for *note sys: e2. standard streams.

     *note PYTHONLEGACYWINDOWSSTDIO: 101d. 環境変数が空でない文字列に設
     定された場合に、 ‘1’ に設定されます。

     より詳しくは PEP 528(2) を参照してください。

     *note Availability: 234c.: Windows.

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_NoSiteFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.site_import: 620. should be used instead, see *note Python
     Initialization Configuration: 83d.

     *note site: cf. モジュールの import と、そのモジュールが行なってい
     た site ごとの *note sys.path: 19f. への操作を無効にします。後で
     ‘site’ を明示的に import しても、これらの操作は実行されません (実行
     したい場合は、 *note site.main(): 2335. を呼び出してください)。

     *note -S: 1566. オプションで設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_NoUserSiteDirectory

     This API is kept for backward compatibility: setting *note
     PyConfig.user_site_directory: 629. should be used instead, see
     *note Python Initialization Configuration: 83d.

     *note ユーザのサイトパッケージのディレクトリ: 2334. を *note
     sys.path: 19f. に追加しません。

     *note -s: 1747. オプション、 *note -I: d2c. 、 *note
     PYTHONNOUSERSITE: 1748. 環境変数で設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_OptimizeFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.optimization_level: 61e. should be used instead, see *note
     Python Initialization Configuration: 83d.

     *note -O: 438. オプションと *note PYTHONOPTIMIZE: 2333. 環境変数で
     設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_QuietFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.quiet: 618. should be used instead, see *note Python
     Initialization Configuration: 83d.

     インタラクティブモードでも copyright とバージョンのメッセージを表示
     しません。

     *note -q: 19b5. オプションで設定します。

     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: 62b. should be used instead, see *note
     Python Initialization Configuration: 83d.

     標準出力と標準エラーをバッファリングしないように強制します。

     *note -u: 1f9e. オプションと *note PYTHONUNBUFFERED: 1f9f. 環境変数
     で設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除.

 -- C 変数: int Py_VerboseFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.verbose: 616. should be used instead, see *note Python
     Initialization Configuration: 83d.

     モジュールが初期化されるたびにメッセージを出力し、それがどこ (ファ
     イル名やビルトインモジュール) からロードされたのかを表示します。 値
     が 2 以上の場合は、モジュールを検索するときにチェックしたファイルご
     とにメッセージを出力します。また、終了時のモジュールクリーンアップ
     に関する情報も提供します。

     *note -v: 17dd. オプションと *note PYTHONVERBOSE: 2336. 環境変数で
     設定します。

     バージョン 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 interpreter finalization,  Prev: グローバルな設定変数,  Up: インタープリタの初期化と終了処理

7.11.3 インタープリタの初期化と終了処理
---------------------------------------

 -- C の関数: void Py_Initialize ()
     ' 次に属します: *note Stable ABI: 961.'

     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: f87. 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: e2.  It also initializes the module search path
     (‘sys.path’).  It does not set ‘sys.argv’; use the *note Python
     Initialization Configuration: 83d. API for that.  This is a no-op
     when called for a second time (without calling *note
     Py_FinalizeEx(): 10d3. first).  There is no return value; it is a
     fatal error if the initialization fails.

     Use *note Py_InitializeFromConfig(): 611. to customize the *note
     Python Initialization Configuration: 83d.

          注釈: Windows では ‘O_TEXT’ から ‘O_BINARY’ へコンソールモード
          が変更されますが、これはその C ランタイムを使っているコンソー
          ルでの Python 以外の使い勝手にも影響を及ぼします。

 -- C の関数: void Py_InitializeEx (int initsigs)
     ' 次に属します: *note Stable ABI: 961.'  This function works like
     *note Py_Initialize(): 67a. 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(): 611. to customize the *note
     Python Initialization Configuration: 83d.

 -- C の関数: *note PyStatus: d79. Py_InitializeFromConfig (const
          PyConfig *config)

     Initialize Python from 'config' configuration, as described in
     *note Initialization with PyConfig: 589a.

     See the *note Python 初期化設定: 83d. 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: 961.'  Python インタプリタが初期
     化済みであれば真(非ゼロ)を、さもなければ偽(ゼロ)を返します。*note
     Py_FinalizeEx(): 10d3. を呼び出した後は、*note Py_Initialize():
     67a. を再び呼び出すまで、この関数は偽を返します。

     バージョン 3.15 で変更: This function no longer returns true until
     initialization has fully completed, including import of the *note
     site: cf. module.  Previously it could return true while *note
     Py_Initialize(): 67a. was still running.

 -- C の関数: int Py_IsFinalizing ()
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Return true (non-zero) if the main Python interpreter is *note
     shutting down: 1ab.  Return false (zero) otherwise.

     Added in version 3.13.

 -- C の関数: int Py_FinalizeEx ()
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.6 より).'
     Undo all initializations made by *note Py_Initialize(): 67a. and
     subsequent use of Python/C API functions, and destroy all
     sub-interpreters (see *note Py_NewInterpreter(): 1d4e. 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(): 67a, 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(): d91. 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(): 67a.  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__(): 13ab. 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(): 67a. and *note Py_FinalizeEx(): 10d3. 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 監査イベント: 1e84.
     ‘cpython._PySys_ClearAuditHooks’ を送出します。

     Added in version 3.6.

 -- C の関数: void Py_Finalize ()
     ' 次に属します: *note Stable ABI: 961.'  この関数は *note
     Py_FinalizeEx(): 10d3. の後方互換性バージョンで、戻り値がありません
     。

 -- C の関数: int Py_BytesMain (int argc, char **argv)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.8 より).'
     Similar to *note Py_Main(): fe6. 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: 961.'  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 コマンドライン: 13b5.

     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(): f89.  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(): d91.

     In terms of the CPython runtime configuration APIs documented in
     the *note runtime configuration: 83d. 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(): 67a, *note
     Py_InitializeEx(): 5486. or *note Py_InitializeFromConfig(): 611.
     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: 589b.), the
     script (*note PyConfig.run_filename: 589c.) or the module (*note
     PyConfig.run_module: 589d.) 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: 61c. 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: 10fb, or ‘1’ for any other unhandled exception.

     If *note PyConfig.inspect: 61c. is set (such as when the *note -i:
     1893. 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: 10fb, as specified above.

     This function always finalizes the Python interpreter before it
     returns.

     See *note Python Configuration: 589e. for an example of a
     customized Python that always runs in isolated mode using *note
     Py_RunMain(): d91.

 -- C の関数: int PyUnstable_AtExit (PyInterpreterState *interp, void
          (*func)(void*), void *data)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Register an *note atexit: d. callback for the target interpreter
     'interp'.  This is similar to *note Py_AtExit(): 5477, but takes an
     explicit interpreter and data pointer for the callback.

     There must be an *note attached thread state: 1ac. for 'interp'.

     Added in version 3.13.


File: python.info,  Node: Cautions regarding interpreter finalization,  Next: Interpreter views,  Prev: インタープリタの初期化と終了処理<2>,  Up: インタープリタの初期化と終了処理

7.11.4 Cautions regarding interpreter finalization
--------------------------------------------------

In the late stage of *note interpreter shutdown: 1ab, after attempting
to wait for non-daemon threads to exit (though this can be interrupted
by *note KeyboardInterrupt: d9a.) and running the *note atexit: d.
functions, the runtime is marked as finalizing, meaning that *note
Py_IsFinalizing(): 7f9. and *note sys.is_finalizing(): e53. return true.
At this point, only the finalization thread (the thread that initiated
finalization; this is typically the main thread) is allowed to *note
attach: 1ac. a thread state.

Other threads that attempt to attach during finalization, either
explicitly (such as via *note PyThreadState_Ensure(): 540c. or *note
Py_END_ALLOW_THREADS: e52.) or implicitly (such as in-between bytecode
instructions), will enter a 'permanently blocked state'.  Generally,
this is harmless, but this can result in deadlocks.  For example, a
thread may be permanently blocked while holding a lock, meaning that the
finalization thread can never acquire that lock.

Prior to CPython 3.13, the thread would exit instead of hanging, which
led to other issues (see the warning note at *note
PyThread_exit_thread(): 5416.).

Gross?  Yes.  Starting in Python 3.15, there are a number of C APIs that
make it possible to avoid these issues by temporarily preventing
finalization:

参考
....

PEP 788(1) explains the design, motivation and rationale for these APIs.

 -- C のデータ型: type PyInterpreterGuard
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として) (バー
     ジョン 3.15 より).'  An opaque interpreter guard structure.

     By holding an interpreter guard, the caller can ensure that the
     interpreter will not finalize until the guard is closed (through
     *note PyInterpreterGuard_Close(): 5375.).

     When a guard is held, a thread attempting to finalize the
     interpreter will block until the guard is closed before starting
     finalization.  After finalization has started, threads are forever
     unable to acquire guards for that interpreter.  This means that if
     you forget to close an interpreter guard, the process will
     'permanently hang' during finalization!

     Holding a guard for an interpreter is similar to holding a *note
     strong reference: 7e0. to a Python object, except finalization does
     not happen automatically after all guards are released: it requires
     an explicit *note Py_EndInterpreter(): 1a8f. call.

     Added in version 3.15.

 -- C の関数: *note PyInterpreterGuard: 5374.
          *PyInterpreterGuard_FromCurrent (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Create a finalization guard for the current interpreter.  This will
     prevent finalization until the guard is closed.

     例えば:

          // Temporarily prevent finalization.
          PyInterpreterGuard *guard = PyInterpreterGuard_FromCurrent();
          if (guard == NULL) {
             // Finalization has already started or we're out of memory.
             return NULL;
          }

          Py_BEGIN_ALLOW_THREADS;
          // Do some critical processing here. For example, we can safely acquire
          // locks that might be acquired by the finalization thread.
          Py_END_ALLOW_THREADS;

          // Now that we're done with our critical processing, the interpreter is
          // allowed to finalize again.
          PyInterpreterGuard_Close(guard);

     On success, this function returns a guard for the current
     interpreter; on failure, it returns ‘NULL’ with an exception set.

     This function will fail only if the current interpreter has already
     started finalizing, or if the process is out of memory.

     The guard pointer returned by this function must be eventually
     closed with *note PyInterpreterGuard_Close(): 5375.; failing to do
     so will result in the Python process infinitely hanging.

     The caller must hold an *note attached thread state: 1ac.

     Added in version 3.15.

 -- C の関数: *note PyInterpreterGuard: 5374.
          *PyInterpreterGuard_FromView (PyInterpreterView *view)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Create a finalization guard for an interpreter through a view.

     On success, this function returns a guard to the interpreter
     represented by 'view'.  The view is still valid after calling this
     function.  The guard must eventually be closed with *note
     PyInterpreterGuard_Close(): 5375.

     If the interpreter no longer exists, is already finalizing, or out
     of memory, then this function returns ‘NULL’ without setting an
     exception.

     The caller does not need to hold an *note attached thread state:
     1ac.

     Added in version 3.15.

 -- C の関数: void PyInterpreterGuard_Close (PyInterpreterGuard *guard)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Close an interpreter guard, allowing the interpreter to start
     finalization if no other guards remain.  If an interpreter guard is
     never closed, the interpreter will infinitely wait when trying to
     enter finalization!

     After an interpreter guard is closed, it may not be used in *note
     PyThreadState_Ensure(): 540c.  Doing so will result in undefined
     behavior.

     This function cannot fail, and the caller doesn't need to hold an
     *note attached thread state: 1ac.

     Added in version 3.15.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0788/


File: python.info,  Node: Interpreter views,  Next: プロセスワイドのパラメータ,  Prev: Cautions regarding interpreter finalization,  Up: インタープリタの初期化と終了処理

7.11.5 Interpreter views
------------------------

In some cases, it may be necessary to access an interpreter that may
have been deleted.  This can be done using interpreter views.

 -- C のデータ型: type PyInterpreterView
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として) (バー
     ジョン 3.15 より).'  An opaque view of an interpreter.

     This is a thread-safe way to access an interpreter that may have be
     finalizing or already destroyed.

     Added in version 3.15.

 -- C の関数: *note PyInterpreterView: 537a.
          *PyInterpreterView_FromCurrent (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Create a view to the current interpreter.

     This function is generally meant to be used alongside *note
     PyInterpreterGuard_FromView(): 5377. or *note
     PyThreadState_EnsureFromView(): 540d.

     On success, this function returns a view to the current
     interpreter; on failure, it returns ‘NULL’ with an exception set.

     The caller must hold an *note attached thread state: 1ac.

     Added in version 3.15.

 -- C の関数: void PyInterpreterView_Close (PyInterpreterView *view)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Close an interpreter view.

     If an interpreter view is never closed, the view's memory will
     never be freed, but there are no other consequences.  (In contrast,
     forgetting to close a guard will infinitely hang the main thread
     during finalization.)

     This function cannot fail, and the caller doesn't need to hold an
     *note attached thread state: 1ac.

     Added in version 3.15.

 -- C の関数: *note PyInterpreterView: 537a. *PyInterpreterView_FromMain
          (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Create a view for the main interpreter (the first and default
     interpreter in a Python process; see *note
     PyInterpreterState_Main(): 58a2.).

     On success, this function returns a view to the main interpreter;
     on failure, it returns ‘NULL’ without an exception set.  Failure
     indicates that the process is out of memory.

     Use this function when an interpreter pointer or view cannot be
     supplied by the caller, such as when a native threading library
     does not provide a ‘void *arg’ parameter that could carry a *note
     PyInterpreterGuard: 5374. or *note PyInterpreterView: 537a.  In
     code that supports subinterpreters, prefer *note
     PyInterpreterView_FromCurrent(): 537c. so the guard tracks the
     calling interpreter rather than the main one.

     The caller does not need to hold an *note attached thread state:
     1ac.

     Added in version 3.15.


File: python.info,  Node: プロセスワイドのパラメータ,  Prev: Interpreter views,  Up: インタープリタの初期化と終了処理

7.11.6 プロセスワイドのパラメータ
---------------------------------

 -- C の関数: void Py_SetProgramName (const wchar_t *name)
     ' 次に属します: *note Stable ABI: 961.'

     This API is kept for backward compatibility: setting *note
     PyConfig.program_name: 60f. should be used instead, see *note
     Python Initialization Configuration: 83d.

     This function should be called before *note Py_Initialize(): 67a.
     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 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(): f89. to decode a bytes string to get a
     wchar_t* string.

     バージョン 3.11 で非推奨、バージョン 3.15 で削除.

 -- C の関数: const char *Py_GetVersion ()
     ' 次に属します: *note Stable ABI: 961.'  Python インタプリタのバー
     ジョンを返します。バージョンは、次のような形式の文字列です

          "3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \n[GCC 4.2.3]"

     第一ワード (最初のスペース文字まで) は、現在の Python のバージョン
     です; 最初の文字は、ピリオドで区切られたメジャーバージョンとマイナ
     ーバージョンです。関数が返す文字列ポインタは静的な記憶領域を返しま
     す; 関数の呼び出し側はこの値を変更できません。この値は Python コー
     ドからは *note sys.version: 6ae. として利用できます。

     See also the *note Py_Version: 5b5. constant.

 -- C の関数: const char *Py_GetPlatform ()
     ' 次に属します: *note Stable ABI: 961.'

     現在のプラットフォームのプラットフォーム識別文字列を返します。
     Unixでは、オペレーティングシステムの "公式の" 名前を小文字に変換し
     、後ろにメジャーリビジョン番号を付けた構成になっています。例えば
     Solaris 2.x は、SunOS 5.x, としても知られていますが、‘'sunos5'’ に
     なります。macOS では ‘'darwin'’ です。Windows では ‘'win'’ です。関
     数が返す文字列ポインタは静的な記憶領域を返します; 関数の呼び出し側
     はこの値を変更できません。この値は Python コードからは
     ‘sys.platform’ として利用できます。

 -- C の関数: const char *Py_GetCopyright ()
     ' 次に属します: *note Stable ABI: 961.'  現在の Python バージョンに
     対する公式の著作権表示文字列を返します。例えば

     ‘'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'’

     関数が返す文字列ポインタは静的な記憶領域を返します; 関数の呼び出し
     側はこの値を変更できません。この値は Python コードからは
     ‘sys.copyright’ として利用できます。

 -- C の関数: const char *Py_GetCompiler ()
     ' 次に属します: *note Stable ABI: 961.'  現在使っているバージョンの
     Python をビルドする際に用いたコンパイラを示す文字列を、角括弧で囲っ
     た文字列を返します。例えば:

          "[GCC 2.7.2.2]"

     関数が返す文字列ポインタは静的な記憶領域を返します; 関数の呼び出し
     側はこの値を変更できません。この値は Python コードからは
     ‘sys.version’ の一部として取り出せます。

 -- C の関数: const char *Py_GetBuildInfo ()
     ' 次に属します: *note Stable ABI: 961.'  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: 961.'

     This API is kept for backward compatibility: setting *note
     PyConfig.argv: 60e, *note PyConfig.parse_argv: 1f05. and *note
     PyConfig.safe_path: b5a. should be used instead, see *note Python
     Initialization Configuration: 83d.

     'argc' および 'argv' に基づいて *note sys.argv: 161e. を設定します
     。これらの引数はプログラムの ‘main()’ に渡した引数に似ていますが、
     最初の要素が Python インタプリタの宿主となっている実行形式の名前で
     はなく、実行されるスクリプト名を参照しなければならない点が違います
     。実行するスクリプトがない場合、 'argv' の最初の要素は空文字列にし
     てもかまいません。この関数が ‘sys.argv’ の初期化に失敗した場合、致
     命的エラーを *note Py_FatalError(): d4f. で知らせます。

     'updatepath' が 0 の場合、ここまでの動作がこの関数がすることの全て
     です。 'updatepath' が 0 でない場合、この関数は *note sys.path:
     19f. を以下のアルゴリズムに基づいて修正します:

        - 存在するスクリプトの名前が ‘argv[0]’ に渡された場合、そのスク
          リプトがある場所の絶対パスを *note sys.path: 19f. の先頭に追加
          します。

        - それ以外の場合 ('argc' が ‘0’ だったり、 ‘argv[0]’ が存在する
          ファイル名を指していない場合)、 *note sys.path: 19f. の先頭に
          空の文字列を追加します。 これは現在の作業ディレクトリ (‘"."’)
          を先頭に追加するのと同じです。

     Use *note Py_DecodeLocale(): f89. to decode a bytes string to get a
     wchar_t* string.

     See also *note PyConfig.orig_argv: c6e. and *note PyConfig.argv:
     60e. members of the *note Python Initialization Configuration: 83d.

          注釈: 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: 19f.
          themselves if desired.  See CVE 2008-5983(1).

          3.1.3 より前のバージョンでは、 *note PySys_SetArgv(): 1be1. の
          呼び出しが完了した後に *note sys.path: 19f. の先頭の要素を取り
          出すことで、同じ効果が得られます。例えばこのように使います:

               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: 961.'  This API is kept for
     backward compatibility: setting *note PyConfig.argv: 60e. and *note
     PyConfig.parse_argv: 1f05. should be used instead, see *note Python
     Initialization Configuration: 83d.

     この関数は、 ‘python’ インタプリタが *note -I: d2c. オプション付き
     で実行されている場合を除き *note PySys_SetArgvEx(): 1be0. の
     'updatepath' に ‘1’ を設定したのと同じように動作します。

     Use *note Py_DecodeLocale(): f89. to decode a bytes string to get a
     wchar_t* string.

     See also *note PyConfig.orig_argv: c6e. and *note PyConfig.argv:
     60e. members of the *note Python Initialization Configuration: 83d.

     バージョン 3.4 で変更: 'updatepath' の値は *note -I: d2c. オプショ
     ンに依存します。

     バージョン 3.11 で非推奨、バージョン 3.15 で削除.

 -- C の関数: void Py_SetPythonHome (const wchar_t *home)
     ' 次に属します: *note Stable ABI: 961.'  This API is kept for
     backward compatibility: setting *note PyConfig.home: 610. should be
     used instead, see *note Python Initialization Configuration: 83d.

     Python の標準ライブラリがある、デフォルトの "home" ディレクトリを設
     定します。引数の文字列の意味については *note PYTHONHOME: 3b5. を参
     照してください。

     引数は静的なストレージに置かれてプログラム実行中に書き換えられない
     ようなゼロ終端の文字列であるべきです。Python インタプリタはこのスト
     レージの内容を変更しません。

     Use *note Py_DecodeLocale(): f89. to decode a bytes string to get a
     wchar_t* string.

     バージョン 3.11 で非推奨、バージョン 3.15 で削除.

   ---------- 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.12 Thread states and the global interpreter lock
==================================================

Unless on a *note free-threaded build: 1a3. of *note CPython: ae8, 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: 68c. or *note GIL: 418, 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(): d1a.).  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: 58a8.

The Python interpreter keeps some thread-local information inside a data
structure called *note PyThreadState: b71, known as a *note thread
state: 1a90.  Each thread has a thread-local pointer to a
‘PyThreadState’; a thread state referenced by this pointer is considered
to be *note attached: 1ac.

A thread can only have one *note attached thread state: 1ac. 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:
51e3. block or in a fresh thread, will the thread not have an attached
thread state.  If uncertain, check if *note
PyThreadState_GetUnchecked(): 63d. returns ‘NULL’.

If it turns out that you do need to create a thread state, it is
recommended to use *note PyThreadState_Ensure(): 540c. or *note
PyThreadState_EnsureFromView(): 540d, which will manage the thread state
for you.

* Menu:

* Detaching the thread state from extension code::
* Using the C API from foreign threads::
* GIL-state APIs::
* Cautions about fork(): Cautions about fork.
* 高水準 API::
* 低水準 API::


File: python.info,  Node: Detaching the thread state from extension code,  Next: Using the C API from foreign threads,  Up: Thread states and the global interpreter lock

7.12.1 Detaching the thread state from extension code
-----------------------------------------------------

Most extension code manipulating the *note thread state: 1a90. 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: 51e3. マクロは新たなブロックを開始し、隠し
ローカル変数を宣言します; *note Py_END_ALLOW_THREADS: e52. はブロックを
閉じます。

上のブロックは次のコードに展開されます:

     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(): 83e. 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():
83f, 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: 13c. and
     *note hashlib: 6b. modules detach the *note thread state: 1ac. when
     compressing or hashing data.

On a *note free-threaded build: 1a3, the *note GIL: 418. 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
     interpreter finalization: 58a0. for more details.

* Menu:

* APIs::


File: python.info,  Node: APIs,  Up: Detaching the thread state from extension code

7.12.1.1 APIs
.............

以下のマクロは、通常末尾にセミコロンを付けずに使います; Python ソース配
布物内の使用例を見てください。

     注釈: These macros are still necessary on the *note free-threaded
     build: 1a3. to prevent deadlocks.

 -- C のマクロ: Py_BEGIN_ALLOW_THREADS
     ' 次に属します: *note Stable ABI: 961.'  このマクロを展開すると ‘{
     PyThreadState *_save; _save = PyEval_SaveThread();’ になります。マ
     クロに開き波括弧が入っていることに注意してください; この波括弧は後
     で *note Py_END_ALLOW_THREADS: e52. マクロと対応させなければなりま
     せん。マクロについての詳しい議論は上記を参照してください。

 -- C のマクロ: Py_END_ALLOW_THREADS
     ' 次に属します: *note Stable ABI: 961.'  このマクロを展開すると
     ‘PyEval_RestoreThread(_save); }’ になります。マクロに開き波括弧が入
     っていることに注意してください; この波括弧は事前の *note
     Py_BEGIN_ALLOW_THREADS: 51e3. マクロと対応していなければなりません
     。マクロについての詳しい議論は上記を参照してください。

 -- C のマクロ: Py_BLOCK_THREADS
     ' 次に属します: *note Stable ABI: 961.'  このマクロを展開すると
     ‘PyEval_RestoreThread(_save);’ になります: 閉じ波括弧のない *note
     Py_END_ALLOW_THREADS: e52. と同じです。

 -- C のマクロ: Py_UNBLOCK_THREADS
     ' 次に属します: *note Stable ABI: 961.'  このマクロを展開すると
     ‘_save = PyEval_SaveThread();’ になります: 開き波括弧のない *note
     Py_BEGIN_ALLOW_THREADS: 51e3. と同じです。


File: python.info,  Node: Using the C API from foreign threads,  Next: GIL-state APIs,  Prev: Detaching the thread state from extension code,  Up: Thread states and the global interpreter lock

7.12.2 Using the C API from foreign threads
-------------------------------------------

When threads are created using the dedicated Python APIs (such as the
*note threading: f6. 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 easiest way to do this is through *note PyThreadState_Ensure():
540c. or *note PyThreadState_EnsureFromView(): 540d.

     注釈: These functions require an argument pointing to the desired
     interpreter; such a pointer can be acquired via a call to *note
     PyInterpreterGuard_FromCurrent(): 5376. (for
     ‘PyThreadState_Ensure’) or *note PyInterpreterView_FromCurrent():
     537c. (for ‘PyThreadState_EnsureFromView’) from the function that
     creates the thread.  If no pointer is available (such as when the
     given native thread library doesn't provide a data argument), *note
     PyInterpreterView_FromMain(): 537d. can be used to get a view for
     the main interpreter, but note that this will make the code
     incompatible with subinterpreters.

例えば:

     // The return value of PyInterpreterGuard_FromCurrent() from the
     // function that created this thread.
     PyInterpreterGuard *guard = thread_data->guard;

     // Create a new thread state for the interpreter.
     PyThreadStateToken *token = PyThreadState_Ensure(guard);
     if (token == NULL) {
        PyInterpreterGuard_Close(guard);
        return;
     }

     // We have a valid thread state -- perform Python actions here.
     result = CallSomeFunction();
     // Evaluate result or handle exceptions.

     // Release the thread state. No calls to the C API are allowed beyond this
     // point.
     PyThreadState_Release(token);
     PyInterpreterGuard_Close(guard);

Keep in mind that calling ‘PyThreadState_Ensure’ might not always create
a new thread state, and calling ‘PyThreadState_Release’ might not always
detach it.  These functions may reuse an existing attached thread state,
or may re-attach a thread state that was previously attached for the
current thread.

参考
....

PEP 788(1)

* Menu:

* Attaching/detaching thread states::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0788/


File: python.info,  Node: Attaching/detaching thread states,  Up: Using the C API from foreign threads

7.12.2.1 Attaching/detaching thread states
..........................................

 -- C の関数: *note PyThreadStateToken: 540b. *PyThreadState_Ensure
          (PyInterpreterGuard *guard)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Ensure that the thread has an attached thread state for the
     interpreter protected by 'guard', and thus can safely invoke that
     interpreter.

     It is OK to call this function if the thread already has an
     attached thread state, as long as there is a subsequent call to
     *note PyThreadState_Release(): 5410. that matches this one (meaning
     that "nested" calls to this function are permitted).

     The function's effect (if any) will be reversed by the matching
     call to *note PyThreadState_Release(): 5410.

     On error, this function returns ‘NULL’ 'without' an exception set.
     Do not call ‘PyThreadState_Release()’ in this case.

     On success, this function returns a pointer value that must be
     passed to the matching call to ‘PyThreadState_Release()’.

     The conditions in which this function creates a new *note thread
     state: 1a90. are considered unstable and implementation-dependent.
     If you need to control the exact lifetime of a thread state,
     consider using *note PyThreadState_New(): 540f.  However, do not
     avoid this function solely on the basis that the lifetime of the
     thread state may be inconsistent across versions; changes to this
     function will be done with caution and in a backwards-compatible
     manner.  In particular, the saving of thread-local variables and
     similar state will be retained across Python versions.

     'CPython 実装の詳細:' The exact behavior of whether this function
     creates a new thread state is described below, but be aware that
     this may change in the future.

     First, this function checks if an attached thread state is present.
     If there is, this function then checks if the interpreter of that
     thread state matches the interpreter guarded by 'guard'.  If that
     is the case, this function simply marks the thread state as being
     used by a ‘PyThreadState_Ensure’ call and returns.

     If there is no attached thread state, then this function checks if
     any thread state has been used by the current OS thread.  (This is
     returned by *note PyGILState_GetThisThreadState(): 5366.)  If there
     was, then this function checks if that thread state's interpreter
     matches 'guard'.  If it does, it is re-attached and marked as used.

     Otherwise, if both of the above cases fail, a new thread state is
     created for 'guard'.  It is then attached and marked as owned by
     ‘PyThreadState_Ensure’.

     Added in version 3.15.

 -- C の関数: *note PyThreadStateToken: 540b.
          *PyThreadState_EnsureFromView (PyInterpreterView *view)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Get an attached thread state for the interpreter referenced by
     'view'.

     The behavior and return value are the same as for *note
     PyThreadState_Ensure(): 540c.; additionally, if the function
     succeeds, the interpreter referenced by 'view' will be implicitly
     guarded.  The guard will be released upon the corresponding *note
     PyThreadState_Release(): 5410. call.

     Added in version 3.15.

 -- C の関数: void PyThreadState_Release (PyThreadStateToken *token)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Undo a *note PyThreadState_Ensure(): 540c. or *note
     PyThreadState_EnsureFromView(): 540d. call.

     This must be called exactly once for each successful 'Ensure' call,
     with 'token' set to that call's return value.

     The state that was attached before the corresponding 'Ensure' call
     (if any) will be attached when *note PyThreadState_Release(): 5410.
     returns.

     The exact behavior of whether this function deletes a thread state
     is considered unstable and implementation-dependent.

     'CPython 実装の詳細:' Currently, this function will decrement an
     internal counter on the attached thread state.  If this counter
     ever reaches below zero, this function emits a fatal error (via
     *note Py_FatalError(): d4f.).

     If the attached thread state is owned by ‘PyThreadState_Ensure’,
     then the attached thread state will be deallocated and deleted upon
     the internal counter reaching zero.  Otherwise, nothing happens
     when the counter reaches zero.

     Added in version 3.15.

 -- C のデータ型: type PyThreadStateToken
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として) (バー
     ジョン 3.15 より).'  An opaque token retrieved from a *note
     PyThreadState_Ensure(): 540c. call and passed to a corresponding
     *note PyThreadState_Release(): 5410. call.


File: python.info,  Node: GIL-state APIs,  Next: Cautions about fork,  Prev: Using the C API from foreign threads,  Up: Thread states and the global interpreter lock

7.12.3 GIL-state APIs
---------------------

The following APIs are generally not compatible with subinterpreters and
will hang the process during interpreter finalization (see *note
Cautions regarding interpreter finalization: 58a0.).  As such, these
APIs were *note soft deprecated: 1b2. in Python 3.15 in favor of the
*note new APIs: 58ac.

 -- C のデータ型: type PyGILState_STATE
     ' 次に属します: *note Stable ABI: 961.'  The type of the value
     returned by *note PyGILState_Ensure(): 1b0. and passed to *note
     PyGILState_Release(): 1b1.

      -- C Enumerator: enumerator PyGILState_LOCKED

          The GIL was already held when *note PyGILState_Ensure(): 1b0.
          was called.

      -- C Enumerator: enumerator PyGILState_UNLOCKED

          The GIL was not held when *note PyGILState_Ensure(): 1b0. was
          called.

 -- C の関数: *note PyGILState_STATE: 5367. PyGILState_Ensure ()
     ' 次に属します: *note Stable ABI: 961.'  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: 1ac.  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(): 1b1.  In
     general, other thread-related APIs may be used between *note
     PyGILState_Ensure(): 1b0. 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: 51e3. and *note Py_END_ALLOW_THREADS: e52.
     macros is acceptable.

     The return value is an opaque "handle" to the *note attached thread
     state: 1ac. when *note PyGILState_Ensure(): 1b0. was called, and
     must be passed to *note PyGILState_Release(): 1b1. 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: 1ac. and the thread will be able to call arbitrary Python
     code.

     This function has no way to return an error.  As such, errors are
     either fatal (that is, they send ‘SIGABRT’ and crash the process;
     see *note Py_FatalError(): d4f.), or the thread will be permanently
     blocked (such as during interpreter finalization).

          警告: Calling this function when the interpreter is finalizing
          will infinitely hang the thread, which may cause deadlocks.
          *note Cautions regarding interpreter finalization: 58a0. for
          more details.

          In addition, this function generally does not work with
          subinterpreters when used from foreign threads, because this
          function has no way of knowing which interpreter created the
          thread (and as such, will implicitly pick the main
          interpreter).

     バージョン 3.14 で変更: Hangs the current thread, rather than
     terminating it, if called while the interpreter is finalizing.

     *note Soft deprecated: 1b2. since version 3.15: Use *note
     PyThreadState_Ensure(): 540c. or *note
     PyThreadState_EnsureFromView(): 540d. instead.

 -- C の関数: void PyGILState_Release (PyGILState_STATE)
     ' 次に属します: *note Stable ABI: 961.'  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(): 1b0. call (but generally this state will be
     unknown to the caller, hence the use of the GIL-state API).

     *note PyGILState_Ensure(): 1b0. を呼び出す場合は、必ず同一スレッド
     内で対応する *note PyGILState_Release(): 1b1. を呼び出してください
     。

     *note Soft deprecated: 1b2. since version 3.15: Use *note
     PyThreadState_Release(): 5410. instead.

 -- C の関数: *note PyThreadState: b71. *PyGILState_GetThisThreadState
          ()
     ' 次に属します: *note Stable ABI: 961.'  Get the *note thread
     state: 1a90. that was most recently *note attached: 1ac. for this
     thread.  (If the most recent thread state has been deleted, this
     returns ‘NULL’.)

     If the caller has an attached thread state, it is returned.

     In other terms, this function returns the thread state that will be
     used by *note PyGILState_Ensure(): 1b0.  If this returns ‘NULL’,
     then ‘PyGILState_Ensure’ will create a new thread state.

     This function cannot fail.

     *note Soft deprecated: 1b2. since version 3.15: Use *note
     PyThreadState_Get(): 80f. or *note PyThreadState_GetUnchecked():
     63d. instead.

 -- C の関数: int PyGILState_Check ()

     Return ‘1’ if the current thread has an *note attached thread
     state: 1ac. that matches the thread state returned by *note
     PyGILState_GetThisThreadState(): 5366.  If the caller has no
     attached thread state or it otherwise doesn't match, then this
     returns ‘0’.

     If the current Python process has ever created a subinterpreter,
     this function will 'always' return ‘1’.

     This is mainly a helper/diagnostic function.

     Added in version 3.4.

     *note Soft deprecated: 1b2. since version 3.15: Use
     ‘PyThreadState_GetUnchecked() != NULL’ instead.


File: python.info,  Node: Cautions about fork,  Next: 高水準 API,  Prev: GIL-state APIs,  Up: Thread states and the global interpreter lock

7.12.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(): 6c3. by acquiring the locks it uses internally before the
fork, and releasing them afterwards.  In addition, it resets any *note
Lock objects: 3881. 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(): 64a. 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():
6c3. does.  This means finalizing all other *note PyThreadState: b71.
objects belonging to the current interpreter and all other *note
PyInterpreterState: c94. objects.  Due to this and the special nature of
the *note "main" interpreter: 417, ‘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: 低水準 API,  Prev: Cautions about fork,  Up: Thread states and the global interpreter lock

7.12.5 高水準 API
-----------------

These are the most commonly used types and functions when writing
multi-threaded C extensions.

 -- C のデータ型: type PyThreadState
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として).'
     This data structure represents the state of a single thread.  The
     only public data member is:

      -- C のメンバ変数: *note PyInterpreterState: c94. *interp

          This thread's interpreter state.

 -- C の関数: void PyEval_InitThreads ()
     ' 次に属します: *note Stable ABI: 961.'

     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(): 67a. から
     呼び出されるようになり、わざわざ呼び出す必要はもう無くなりました。

     バージョン 3.2 で変更: この関数は *note Py_Initialize(): 67a. より
     前に呼び出すことができなくなりました。

     バージョン 3.9 で非推奨.

 -- C の関数: *note PyThreadState: b71. *PyEval_SaveThread ()
     ' 次に属します: *note Stable ABI: 961.'  Detach the *note attached
     thread state: 1ac. and return it.  The thread will have no *note
     thread state: 1a90. upon returning.

 -- C の関数: void PyEval_RestoreThread (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 961.'  Set the *note attached
     thread state: 1ac. to 'tstate'.  The passed *note thread state:
     1a90. '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 interpreter finalization: 58a0. for more
          details.

     バージョン 3.14 で変更: Hangs the current thread, rather than
     terminating it, if called while the interpreter is finalizing.

 -- C の関数: *note PyThreadState: b71. *PyThreadState_Get ()
     ' 次に属します: *note Stable ABI: 961.'  Return the *note attached
     thread state: 1ac.  If the thread has no attached thread state,
     (such as when inside of *note Py_BEGIN_ALLOW_THREADS: 51e3. block),
     then this issues a fatal error (so that the caller needn't check
     for ‘NULL’).

     See also *note PyThreadState_GetUnchecked(): 63d.

 -- C の関数: *note PyThreadState: b71. *PyThreadState_GetUnchecked ()

     Similar to *note PyThreadState_Get(): 80f, 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: b71. *PyThreadState_Swap
          (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 961.'  Set the *note attached
     thread state: 1ac. to 'tstate', and return the *note thread state:
     1a90. that was attached prior to calling.

     This function is safe to call without an *note attached thread
     state: 1ac.; it will simply return ‘NULL’ indicating that there was
     no prior thread state.

     参考
     ....

     *note PyEval_ReleaseThread(): 5317.

          注釈: Similar to *note PyGILState_Ensure(): 1b0, this function
          will hang the thread if the runtime is finalizing.


File: python.info,  Node: 低水準 API,  Prev: 高水準 API,  Up: Thread states and the global interpreter lock

7.12.6 低水準 API
-----------------

 -- C の関数: *note PyThreadState: b71. *PyThreadState_New
          (PyInterpreterState *interp)
     ' 次に属します: *note Stable ABI: 961.'  Create a new thread state
     object belonging to the given interpreter object.  An *note
     attached thread state: 1ac. is not needed.

 -- C の関数: void PyThreadState_Clear (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 961.'  Reset all information in a
     *note thread state: 1a90. object.  'tstate' must be *note attached:
     1ac.

     バージョン 3.9 で変更: This function now calls the
     ‘PyThreadState.on_delete’ callback.  Previously, that happened in
     *note PyThreadState_Delete(): 1f9a.

     バージョン 3.13 で変更: The ‘PyThreadState.on_delete’ callback was
     removed.

 -- C の関数: void PyThreadState_Delete (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 961.'  Destroy a *note thread
     state: 1a90. object.  'tstate' should not be *note attached: 1ac.
     to any thread.  'tstate' must have been reset with a previous call
     to *note PyThreadState_Clear(): 1bbd.

 -- C の関数: void PyThreadState_DeleteCurrent (void)

     Detach the *note attached thread state: 1ac. (which must have been
     reset with a previous call to *note PyThreadState_Clear(): 1bbd.)
     and then destroy it.

     No *note thread state: 1a90. will be *note attached: 1ac. upon
     returning.

 -- C の関数: *note PyFrameObject: b6d. *PyThreadState_GetFrame
          (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Get the current frame of the Python thread state 'tstate'.

     Return a *note strong reference: 7e0.  Return ‘NULL’ if no frame is
     currently executing.

     See also *note PyEval_GetFrame(): 1d56.

     'tstate' must not be ‘NULL’, and must be *note attached: 1ac.

     Added in version 3.9.

 -- C の関数: uint64_t PyThreadState_GetID (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Get the unique *note thread state: 1a90. identifier of the Python
     thread state 'tstate'.

     'tstate' must not be ‘NULL’, and must be *note attached: 1ac.

     Added in version 3.9.

 -- C の関数: *note PyInterpreterState: c94.
          *PyThreadState_GetInterpreter (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Get the interpreter of the Python thread state 'tstate'.

     'tstate' must not be ‘NULL’, and must be *note attached: 1ac.

     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(): b3e.
     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(): b3d. function.

     See also *note PyEval_SetTrace(): 856. and *note
     PyEval_SetProfile(): 18b5. 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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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: 5558. for C code by
     raising *note RecursionError: 1125. when it notices that the
     machine execution stack is close to overflow.  See for example the
     *note Py_EnterRecursiveCall(): 605. 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(): 39d. to inform CPython
     of the change.

     Call *note PyUnstable_ThreadState_SetStackProtection(): 39d. 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(): 39e. for
     undoing this operation.

     Added in version 3.15.

 -- C の関数: void PyUnstable_ThreadState_ResetStackProtection
          (PyThreadState *tstate)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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(): 39d. for an
     explanation.

     Added in version 3.15.

 -- C の関数: *note PyObject: 1a6. *PyThreadState_GetDict ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'  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: 1a90. is *note attached: 1ac.  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: 961.'  *note Attach: 1ac.
     '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: 1ac.

          注釈: 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 interpreter finalization: 58a0. for more
          details.

     バージョン 3.8 で変更: Updated to be consistent with *note
     PyEval_RestoreThread(): 83f, *note Py_END_ALLOW_THREADS(): e52, and
     *note PyGILState_Ensure(): 1b0, 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(): 83f. はいつでも (スレッドが初期化され
     たいないときでも) 利用可能な高レベル関数です。

 -- C の関数: void PyEval_ReleaseThread (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 961.'  Detach the *note attached
     thread state: 1ac.  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(): 83e. はより高レベルな関数で常に (スレッ
     ドが初期化されていないときでも) 利用できます。


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.13 Asynchronous notifications
===============================

インタプリタのメインスレッドに非同期な通知を行うために提供されている仕組
みです。これらの通知は関数ポインタと void ポインタ引数という形態を取りま
す。

 -- C の関数: int Py_AddPendingCall (int (*func)(void*), void *arg)
     ' 次に属します: *note Stable ABI: 961.'  インタプリタのメインスレッ
     ドから関数が呼び出される予定を組みます。成功すると ‘0’ が返り、
     'func' はメインスレッドの呼び出しキューに詰められます。失敗すると、
     例外をセットせずに ‘-1’ が返ります。

     無事にキューに詰められると、'func' は 'いつかは必ず' インタプリタの
     メインスレッドから、'arg' を引数として呼び出されます。この関数は、
     通常の実行中の Python コードに対して非同期に呼び出されますが、次の
     両方の条件に合致したときに呼び出されます:

        * *note bytecode: 6b9. 境界上にいるとき、

        * with the main thread holding an *note attached thread state:
          1ac. ('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: 1ac. is
     detached.

     This function doesn't need an *note attached thread state: 1ac.
     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 *note PyThreadState_EnsureFromView(): 540d.

     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: 961.'  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: 1ac.

     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: 961.'  Schedule an exception to
     be raised asynchronously in a thread.  If the thread has a
     previously scheduled exception, it is overwritten.

     The 'id' argument is the thread id of the target thread, as
     returned by *note PyThread_get_thread_ident(): 5419.  'exc' is the
     class of the exception to be raised, or ‘NULL’ to clear the pending
     exception (if any).

     Return the number of affected thread states.  This is normally ‘1’
     if 'id' is found, even when no change was made (the given 'exc' was
     already pending, or 'exc' is ‘NULL’ but no exception is pending).
     If the thread id isn't found, return ‘0’.  This raises no
     exceptions.

     To prevent naive misuse, you must write your own C extension to
     call this.  This function must be called with an *note attached
     thread state: 1ac.  This function does not steal any references to
     'exc'.  This function does not necessarily interrupt system calls
     such as *note sleep(): a91.

     バージョン 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.14 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: 961.'  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: 58bb.

     The caller does not need to hold an *note attached thread state:
     1ac.

 -- C の関数: unsigned long PyThread_get_thread_ident (void)
     ' 次に属します: *note Stable ABI: 961.'  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: 1ac.

     参考
     ....

     *note threading.get_ident(): 151a. and *note
     threading.Thread.ident: 33a6. expose this identifier to Python.

 -- C の関数: *note PyObject: 1a6. *PyThread_GetInfo (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.3 より).'  Get
     general information about the current thread in the form of a *note
     struct sequence: 157d. object.  This information is accessible as
     *note sys.thread_info: 1510. in Python.

     On success, this returns a new *note strong reference: 7e0. to the
     thread information; on failure, this returns ‘NULL’ with an
     exception set.

     The caller must hold an *note attached thread state: 1ac.

 -- 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: 961. 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: 58bc. is defined.

     This function cannot fail, and the caller does not need to hold an
     *note attached thread state: 1ac.

     参考
     ....

     *note threading.get_native_id(): e05.

 -- C の関数: void PyThread_exit_thread (void)
     ' 次に属します: *note Stable ABI: 961.'  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: 961.'  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: 961.'  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:
     1ac.

 -- C の関数: size_t PyThread_get_stacksize (void)
     ' 次に属します: *note Stable ABI: 961.'  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:
     1ac.

   ---------- 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.15 同期プリミティブ
=====================

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: 2943.'  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: 1ac. if one exists.

     Added in version 3.13.

 -- C の関数: void PyMutex_Unlock (PyMutex *m)
     ' Thread safety: *note Atomic: 2943.'  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: 2943.'  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.15.1 Python critical section API
----------------------------------

The critical section API provides a deadlock avoidance layer on top of
per-object locks for *note free-threaded: 48e. CPython.  They are
intended to replace reliance on the *note global interpreter lock: 68c,
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: 4e0. and *note dict: 193. because their public
C-APIs already use critical sections internally, with the notable
exception of *note PyDict_Next(): 1bbb, 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: 699.  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: 699. 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: 1a6. - 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.

     注釈: Operations that need to lock two objects at once must use
     *note Py_BEGIN_CRITICAL_SECTION2: 5479.  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: 982. calls *note Py_DECREF: 97a,
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(): 83e.

 -- C のマクロ: Py_BEGIN_CRITICAL_SECTION (op)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Acquires the per-object lock for the object 'op' and begins a
     critical section.

     In the free-threaded build, and when building for the *note Stable
     ABI: 1a2, 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: 5478, there is no
     cast for the argument of the macro - it must be a *note PyMutex:
     699. pointer.

     On the default build, this macro expands to ‘{’.

     Added in version 3.14.

 -- C のマクロ: Py_END_CRITICAL_SECTION ()
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Ends the critical section and releases the per-object lock.

     In the free-threaded build, and when building for the *note Stable
     ABI: 1a2, 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)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     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, and when building for the *note Stable
     ABI: 1a2, this macro expands to:

          {
               PyCriticalSection2 _py_cs2;
               PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)

     Note that unlike *note Py_BEGIN_CRITICAL_SECTION2: 5479, there is
     no cast for the arguments of the macro - they must be *note
     PyMutex: 699. pointers.

     On the default build, this macro expands to ‘{’.

     Added in version 3.14.

 -- C のマクロ: Py_END_CRITICAL_SECTION2 ()
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Ends the critical section and releases the per-object locks.

     In the free-threaded build, and when building for the *note Stable
     ABI: 1a2, this macro expands to:

              PyCriticalSection2_End(&_py_cs2);
          }

     In the default build, this macro expands to ‘}’.

     Added in version 3.13.

* Menu:

* Low-level critical section API::


File: python.info,  Node: Low-level critical section API,  Up: Python critical section API

7.15.1.1 Low-level critical section API
.......................................

The following functions and structs are exposed for cases where C macros
are not available.

 -- C の関数: void PyCriticalSection_Begin (PyCriticalSection *c,
          PyObject *op)
 -- C の関数: void PyCriticalSection_End (PyCriticalSection *c)
 -- C の関数: void PyCriticalSection2_Begin (PyCriticalSection2 *c,
          PyObject *a, PyObject *b)
 -- C の関数: void PyCriticalSection2_End (PyCriticalSection2 *c);
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'  To
     be used only as in the macro expansions listed *note earlier in
     this section: 58c2.

     In non-*note free-threaded: 48e. builds of CPython, these functions
     do nothing.

     Added in version 3.13.

 -- C のデータ型: type PyCriticalSection
 -- C のデータ型: type PyCriticalSection2
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む) (バ
     ージョン 3.15 より).'  To be used only as in the macro expansions
     listed *note earlier in this section: 58c2.  Note that the contents
     of the structures are private and their meaning may change in
     future Python versions.

     Added in version 3.13.

 -- C の関数: void PyCriticalSection_BeginMutex (PyCriticalSection *c,
          PyMutex *m);
 -- C の関数: void PyCriticalSection2_BeginMutex (PyCriticalSection2 *c,
          PyMutex *m1, PyMutex *m2);

     To be used only as in the macro expansions listed *note earlier in
     this section: 58c2.

     In non-*note free-threaded: 48e. builds of CPython, these functions
     do nothing.

     Added in version 3.14.


File: python.info,  Node: Legacy locking APIs,  Prev: Python critical section API,  Up: 同期プリミティブ<3>

7.15.2 Legacy locking APIs
--------------------------

These APIs are obsolete since Python 3.13 with the introduction of *note
PyMutex: 699.

バージョン 3.15 で変更: These APIs are now a simple wrapper around
‘PyMutex’.

 -- C のデータ型: type PyThread_type_lock

     A pointer to a mutual exclusion lock.

 -- C のデータ型: type PyLockStatus

     The result of acquiring a lock with a timeout.

      -- C Enumerator: enumerator PY_LOCK_FAILURE

          Failed to acquire the lock.

      -- C Enumerator: enumerator PY_LOCK_ACQUIRED

          The lock was successfully acquired.

      -- C Enumerator: enumerator PY_LOCK_INTR

          The lock was interrupted by a signal.

 -- C の関数: *note PyThread_type_lock: 58c9. PyThread_allocate_lock
          (void)
     ' 次に属します: *note Stable ABI: 961.'  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:
     1ac.

     バージョン 3.15 で変更: This function now always uses *note
     PyMutex: 699.  In prior versions, this would use a lock provided by
     the operating system.

 -- C の関数: void PyThread_free_lock (PyThread_type_lock lock)
     ' 次に属します: *note Stable ABI: 961.'  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:
     1ac.

 -- C の関数: *note PyLockStatus: 58ca. PyThread_acquire_lock_timed
          (PyThread_type_lock lock, long long microseconds, int
          intr_flag)
     ' 次に属します: *note Stable ABI: 961.'  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: 58cb.  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:
     58cd.  Upon interruption, it's generally expected that the caller
     makes a call to *note Py_MakePendingCalls(): 5487. to propagate an
     exception to Python code.

     If the lock is successfully acquired, this function returns *note
     PY_LOCK_ACQUIRED: 58cc.

     The caller does not need to hold an *note attached thread state:
     1ac.

 -- C の関数: int PyThread_acquire_lock (PyThread_type_lock lock, int
          waitflag)
     ' 次に属します: *note Stable ABI: 961.'  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(): 5414, acquiring the
     lock cannot be interrupted by a signal.

     The caller does not need to hold an *note attached thread state:
     1ac.

 -- C の関数: int PyThread_release_lock (PyThread_type_lock lock)
     ' 次に属します: *note Stable ABI: 961.'  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:
     1ac.


File: python.info,  Node: Thread-local storage support,  Next: Multiple interpreters in a Python process,  Prev: 同期プリミティブ<3>,  Up: Python/C API reference manual

7.16 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: 1aa6.).  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: 1a90. does 'not' need to be *note attached: 1ac.
when calling these functions; they supply their own locking.

‘Python.h’ は TLS API の宣言を include せず、スレッドローカルストレージ
を使うには ‘pythread.h’ を include する必要があることに注意してください
。

     注釈: この API 関数はどれも void* 値の代わりにメモリ管理を行うこと
     はしません。 メモリの確保と解放は自前で行う必要があります。 void* 値
     がたまたま *note PyObject: 1a6.* だった場合は、 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.16.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: ea8. 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: 961. が定義されていないときは、この型の *note
     Py_tss_NEEDS_INIT: 58d3. による静的メモリ確保ができます。

 -- C のマクロ: Py_tss_NEEDS_INIT

     このマクロは *note Py_tss_t: ea8. 変数の初期化子に展開されます。 こ
     のマクロは *note Py_LIMITED_API: 961. があるときは定義されません。

   ---------- 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.16.2 Dynamic allocation
-------------------------

動的な *note Py_tss_t: ea8. のメモリ確保は *note Py_LIMITED_API: 961. で
ビルドされた拡張モジュールで必要になりますが、その実装がビルド時に不透明
なために、この型の静的なメモリ確保は不可能です。

 -- C の関数: *note Py_tss_t: ea8. *PyThread_tss_alloc ()
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'
     Return a value which is the same state as a value initialized with
     *note Py_tss_NEEDS_INIT: 58d3, or ‘NULL’ in the case of dynamic
     allocation failure.

 -- C の関数: void PyThread_tss_free (Py_tss_t *key)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'
     Free the given 'key' allocated by *note PyThread_tss_alloc(): 652,
     after first calling *note PyThread_tss_delete(): 65a. 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.16.3 メソッド
---------------

The parameter 'key' of these functions must not be ‘NULL’.  Moreover,
the behaviors of *note PyThread_tss_set(): 656. and *note
PyThread_tss_get(): 658. are undefined if the given *note Py_tss_t: ea8.
has not been initialized by *note PyThread_tss_create(): 541d.

 -- C の関数: int PyThread_tss_is_created (Py_tss_t *key)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'
     Return a non-zero value if the given *note Py_tss_t: ea8. has been
     initialized by *note PyThread_tss_create(): 541d.

 -- C の関数: int PyThread_tss_create (Py_tss_t *key)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 58d3.  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: 961. (バージョン 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(): 541d.  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: 961. (バージョン 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: 961. (バージョン 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.16.4 Legacy APIs
------------------

バージョン 3.7 で非推奨: This API is superseded by the *note
thread-specific storage (TSS) API: ea7.

     注釈: 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(): 651. 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: 961.'

 -- C の関数: void PyThread_delete_key (int key)
     ' 次に属します: *note Stable ABI: 961.'

 -- C の関数: int PyThread_set_key_value (int key, void *value)
     ' 次に属します: *note Stable ABI: 961.'

 -- C の関数: void *PyThread_get_key_value (int key)
     ' 次に属します: *note Stable ABI: 961.'

 -- C の関数: void PyThread_delete_key_value (int key)
     ' 次に属します: *note Stable ABI: 961.'

 -- C の関数: void PyThread_ReInitTLS ()
     ' 次に属します: *note Stable ABI: 961.'


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.17 Multiple interpreters in a Python process
==============================================

ほとんどの場合は埋め込む Python インタプリタは1つだけですが、いくつかの
場合に同一プロセス内、あるいは同一スレッド内で、複数の独立したインタプリ
タを作成する必要があります。 これを可能にするのがサブインタプリタです。

"メイン" インタプリタとは、ランタイムが初期化を行ったときに最初に作成さ
れたインタプリタのことです。 サブインタプリタと違い、メインインタプリタ
にはシグナルハンドリングのような、プロセス全域で唯一な責務があります。 メ
インインタプリタにはランタイムの初期化中の処理実行という責務もあり、通常
はランタイムの終了処理中に動いているランタイムでもあります。 *note
PyInterpreterState_Main(): 58a2. 関数は、メインインタプリタの状態へのポ
インタを返します。

サブインタプリタを切り替えが *note PyThreadState_Swap(): 5411. 関数でで
きます。 次の関数を使ってサブインタプリタの作成と削除が行えます:

 -- C のデータ型: type PyInterpreterConfig

     Structure containing most parameters to configure a
     sub-interpreter.  Its values are used only in *note
     Py_NewInterpreterFromConfig(): 87b. 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: 58da.
          must be ‘1’ (non-zero).  If this is ‘1’ then *note gil: 58db.
          must not be *note PyInterpreterConfig_OWN_GIL: 58dc.

      -- 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: df. 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(): 3254.) in
          any thread where the sub-interpreter is currently active.
          Otherwise exec is unrestricted.

          Note that the *note subprocess: df. module still works when
          exec is disallowed.

      -- C のメンバ変数: int allow_threads

          If this is ‘0’ then the sub-interpreter's *note threading: f6.
          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: f6.
          module won't create daemon threads.  Otherwise daemon threads
          are allowed (as long as *note allow_threads: 58df. 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:
          54a5.)

          This must be ‘1’ (non-zero) if *note use_main_obmalloc: 4c0b.
          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: 58e2.).

           -- 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: 58dc. then *note
          PyInterpreterConfig.use_main_obmalloc: 4c0b. must be ‘0’.

 -- C の関数: *note PyStatus: d79. Py_NewInterpreterFromConfig
          (PyThreadState **tstate_p, const PyInterpreterConfig *config)

     新しいサブインタプリタ (sub-interpreter) を生成します。サブインタプ
     リタとは、(ほぼ完全に) 個別に分割された Python コードの実行環境です
     。特に、新しいサブインタプリタは、 import されるモジュール全てにつ
     いて個別のバージョンを持ち、これには基盤となるモジュール *note
     builtins: 13, *note __main__: 1. および *note sys: e2. も含まれます
     。ロード済みのモジュールからなるテーブル (‘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: 1a90. created in the new sub-interpreter.  This thread state
     is *note attached: 1ac.  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: 1ac. 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: 418. then the attached thread state of the calling
     interpreter will be detached.  When the function returns, the new
     interpreter's *note thread state: 1a90. 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: c94. 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(): 39a, 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:
          556b, e.g.  *note PyModule_Create(): 5571, 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: 58e3. 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():
          10d3. and *note Py_Initialize(): 67a.; 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: b71. *Py_NewInterpreter (void)
     ' 次に属します: *note Stable ABI: 961.'

     Create a new sub-interpreter.  This is essentially just a wrapper
     around *note Py_NewInterpreterFromConfig(): 87b. 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: 961.'

     Destroy the (sub-)interpreter represented by the given *note thread
     state: 1a90.  The given thread state must be *note attached: 1ac.
     When the call returns, there will be no attached thread state.  All
     thread states associated with this interpreter are destroyed.

     *note Py_FinalizeEx(): 10d3. 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.17.1 A per-interpreter GIL
----------------------------

Added in version 3.12.

Using *note Py_NewInterpreterFromConfig(): 87b. 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: 3a0.  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.17.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(): f35. 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(): 1b0. と *note
PyGILState_Release(): 1b1. の呼び出しのペアの間では、サブインタプリタの
切り替えを行わないことを強く推奨します。さらに、(*note ctypes: 2d. のよ
うな)これらのAPIを使ってPythonの外で作られたスレッドから Pythonコードを
実行している拡張モジュールはサブインタプリタを使うと壊れる可能性がありま
す。


File: python.info,  Node: 高水準 API<2>,  Next: 低水準 API<2>,  Prev: バグと注意事項,  Up: Multiple interpreters in a Python process

7.17.3 高水準 API
-----------------

 -- C のデータ型: type PyInterpreterState
     ' 次に属します: *note Stable ABI: 961. (不透明な構造体として).'  こ
     のデータ構造体は、協調動作する多数のスレッド間で共有されている状態
     を表現します。同じインタプリタに属するスレッドはモジュール管理情報
     やその他いくつかの内部的な情報を共有しています。この構造体には公開
     (public) のメンバはありません。

     異なるインタプリタに属するスレッド間では、利用可能なメモリ、開かれ
     ているファイルデスクリプタなどといったプロセス状態を除いて、初期状
     態では何も共有されていません。GILもまた、スレッドがどのインタプリタ
     に属しているかに関わらずすべてのスレッドで共有されています。

     バージョン 3.12 で変更: PEP 684(1) introduced the possibility of a
     *note per-interpreter GIL: 58e5.  See *note
     Py_NewInterpreterFromConfig(): 87b.

 -- C の関数: *note PyInterpreterState: c94. *PyInterpreterState_Get
          (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.9 より).'  Get
     the current interpreter.

     Issue a fatal error if there is no *note attached thread state:
     1ac.  It cannot return NULL.

     Added in version 3.9.

 -- C の関数: int64_t PyInterpreterState_GetID (PyInterpreterState
          *interp)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'  イ
     ンタプリタの一意な ID を返します。 処理中に何かエラーが起きたら、
     ‘-1’ が返され、エラーがセットされます。

     The caller must have an *note attached thread state: 1ac.

     Added in version 3.7.

 -- C の関数: *note PyObject: 1a6. *PyInterpreterState_GetDict
          (PyInterpreterState *interp)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.8 より).'  インタプリタ固有のデータを保持している辞書を返し
     ます。 この関数が ‘NULL’ を返した場合は、ここまでで例外は送出されて
     おらず、呼び出し側はインタプリタ固有の辞書は利用できないと考えなけ
     ればなりません。

     この関数は *note PyModule_GetState(): d4c. を置き換えるものではなく
     、拡張モジュールがインタプリタ固有の状態情報を格納するのに使うべき
     ものです。

     The returned dictionary is borrowed from the interpreter and is
     valid until interpreter shutdown.

     Added in version 3.8.

 -- C のデータ型: typedef *note PyObject: 1a6.
          *(*_PyFrameEvalFunction)(*note PyThreadState: b71. *tstate,
          *note _PyInterpreterFrame: 1ba0. *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: b5d.
          _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.

 -- C の関数: void _PyInterpreterState_SetEvalFrameAllowSpecialization
          (PyInterpreterState *interp, int allow_specialization)

     Enables or disables specialization why a custom frame evaluator is
     in place.

     If 'allow_specialization' is non-zero, the adaptive specializer
     will continue to specialize bytecodes even though a custom eval
     frame function is set.  When 'allow_specialization' is zero,
     setting a custom eval frame disables specialization.  The standard
     interpreter loop will continue to deopt while a frame evaluation
     API is in place - the frame evaluation function needs to handle the
     specialized opcodes to take advantage of this.

     Added in version 3.15.

 -- C の関数: int _PyInterpreterState_IsSpecializationEnabled
          (PyInterpreterState *interp)

     Return non-zero if adaptive specialization is enabled for the
     interpreter.  Specialization is enabled when no custom eval frame
     function is set, or when one is set with 'allow_specialization'
     enabled.

     Added in version 3.15.

   ---------- 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.17.4 低水準 API
-----------------

次の全ての関数は *note Py_Initialize(): 67a. の後に呼び出さなければなり
ません。

バージョン 3.7 で変更: *note Py_Initialize(): 67a. now initializes the
*note GIL: 418. and sets an *note attached thread state: 1ac.

 -- C の関数: *note PyInterpreterState: c94. *PyInterpreterState_New ()
     ' 次に属します: *note Stable ABI: 961.'  Create a new interpreter
     state object.  An *note attached thread state: 1ac. is not needed,
     but may optionally exist if it is necessary to serialize calls to
     this function.

     引数無しで *note 監査イベント: 1e84.
     ‘cpython.PyInterpreterState_New’ を送出します。

 -- C の関数: void PyInterpreterState_Clear (PyInterpreterState *interp)
     ' 次に属します: *note Stable ABI: 961.'  Reset all information in
     an interpreter state object.  There must be an *note attached
     thread state: 1ac. for the interpreter.

     引数無しで *note 監査イベント: 1e84.
     ‘cpython.PyInterpreterState_Clear’ を送出します。

 -- C の関数: void PyInterpreterState_Delete (PyInterpreterState
          *interp)
     ' 次に属します: *note Stable ABI: 961.'  Destroy an interpreter
     state object.  There 'should not' be an *note attached thread
     state: 1ac. for the target interpreter.  The interpreter state must
     have been reset with a previous call to *note
     PyInterpreterState_Clear(): 49ba.


File: python.info,  Node: Advanced debugger support,  Prev: 低水準 API<2>,  Up: Multiple interpreters in a Python process

7.17.5 Advanced debugger support
--------------------------------

以下の関数は高度なデバッグツールでの使用のためだけのものです。

 -- C の関数: *note PyInterpreterState: c94. *PyInterpreterState_Head ()

     インタプリタ状態オブジェクトからなるリストのうち、先頭にあるものを
     返します。

 -- C の関数: *note PyInterpreterState: c94. *PyInterpreterState_Main ()

     メインインタプリタの状態オブジェクトを返します。

 -- C の関数: *note PyInterpreterState: c94. *PyInterpreterState_Next
          (PyInterpreterState *interp)

     インタプリタ状態オブジェクトからなるリストのうち、'interp' の次にあ
     るものを返します。

 -- C の関数: *note PyThreadState: b71. *PyInterpreterState_ThreadHead
          (PyInterpreterState *interp)

     インタプリタ 'interp' に関連付けられているスレッドからなるリストの
     うち、先頭にある *note PyThreadState: b71. オブジェクトを返します。

 -- C の関数: *note PyThreadState: b71. *PyThreadState_Next
          (PyThreadState *tstate)

     'tstate' と同じ *note PyInterpreterState: c94. オブジェクトに属して
     いるスレッド状態オブジェクトのうち、 '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.18 Profiling and tracing
==========================

Python インタプリタは、プロファイル: 分析 (profile) や実行のトレース: 追
跡 (trace) といった機能を組み込むために低水準のサポートを提供しています
。このサポートは、プロファイルやデバッグ、適用範囲分析 (coverage
analysis) ツールなどに使われます。

この C インターフェースは、プロファイルやトレース作業時に、Python レベル
の呼び出し可能オブジェクトが呼び出されることによるオーバヘッドを避け、直
接 C 関数呼び出しが行えるようにしています。プロファイルやトレース機能の
本質的な特性は変わっていません; インターフェースではトレース関数をスレッ
ドごとにインストールでき、トレース関数に報告される基本イベント (basic
event) は以前のバージョンにおいて Python レベルのトレース関数で報告され
ていたものと同じです。

 -- C のデータ型: typedef int (*Py_tracefunc)(*note PyObject: 1a6. *obj,
          *note PyFrameObject: b6d. *frame, int what, *note PyObject:
          1a6. *arg)

     The type of the trace function registered using *note
     PyEval_SetProfile(): 18b5. and *note PyEval_SetTrace(): 856.  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: 58f1, *note
     PyTrace_EXCEPTION: 58f2, *note PyTrace_LINE: 58f3, *note
     PyTrace_RETURN: 58f4, *note PyTrace_C_CALL: 58f5, *note
     PyTrace_C_EXCEPTION: 58f6, *note PyTrace_C_RETURN: 58f7, or *note
     PyTrace_OPCODE: 58f8, and 'arg' depends on the value of 'what':

     'what' の値                         'arg' の意味
                                         
     ---------------------------------------------------------------------------------
                                         
     *note PyTrace_CALL: 58f1.           常に *note Py_None: 5615. 。
                                         
                                         
     *note PyTrace_EXCEPTION: 58f2.      *note sys.exc_info(): a7f. の返す例外情報
                                         です。
                                         
                                         
     *note PyTrace_LINE: 58f3.           常に *note Py_None: 5615. 。
                                         
                                         
     *note PyTrace_RETURN: 58f4.         呼び出し側に返される予定の値か、例外によっ
                                         て関数を抜ける場合は ‘NULL’ です。
                                         
                                         
     *note PyTrace_C_CALL: 58f5.         呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_C_EXCEPTION: 58f6.    呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_C_RETURN: 58f7.       呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_OPCODE: 58f8.         常に *note Py_None: 5615. 。
                                         

 -- C 変数: int PyTrace_CALL

     関数やメソッドが新たに呼び出されたり、ジェネレータが新たなエントリ
     の処理に入ったことを報告する際の、 *note Py_tracefunc: 58f0. の
     'what' の値です。イテレータやジェネレータ関数の生成は、対応するフレ
     ーム内の Python バイトコードに制御の委譲 (control transfer) が起こ
     らないため報告されないので注意してください。

 -- C 変数: int PyTrace_EXCEPTION

     The value of the 'what' parameter to a *note Py_tracefunc: 58f0.
     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:
     58f0. 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: f9f. to '0' on that frame.

 -- C 変数: int PyTrace_RETURN

     呼び出しが返るときに *note Py_tracefunc: 58f0. 関数に 'what' 引数と
     して渡す値です。

 -- C 変数: int PyTrace_C_CALL

     C関数を呼び出す直前に *note Py_tracefunc: 58f0. 関数の 'what' 引数
     として渡す値です。

 -- C 変数: int PyTrace_C_EXCEPTION

     C関数が例外を送出したときに *note Py_tracefunc: 58f0. 関数の 'what'
     引数として渡す値です。

 -- C 変数: int PyTrace_C_RETURN

     C関数から戻るときに *note Py_tracefunc: 58f0. 関数の 'what' 引数と
     して渡す値です。

 -- C 変数: int PyTrace_OPCODE

     The value for the 'what' parameter to *note Py_tracefunc: 58f0.
     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: fa0. 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: 58f3.
     *note PyTrace_OPCODE: 58f8. and *note PyTrace_EXCEPTION: 58f2.

     *note sys.setprofile(): 18b6. 関数も参照してください。

     The caller must have an *note attached thread state: 1ac.

 -- C の関数: void PyEval_SetProfileAllThreads (Py_tracefunc func,
          PyObject *obj)

     Like *note PyEval_SetProfile(): 18b5. 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: 1ac.

     As *note PyEval_SetProfile(): 18b5, 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(): 18b5, 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(): 856. will not
     receive *note PyTrace_C_CALL: 58f5, *note PyTrace_C_EXCEPTION:
     58f6. or *note PyTrace_C_RETURN: 58f7. as a value for the 'what'
     parameter.

     *note sys.settrace(): 563. 関数も参照してください。

     The caller must have an *note attached thread state: 1ac.

 -- C の関数: void PyEval_SetTraceAllThreads (Py_tracefunc func,
          PyObject *obj)

     Like *note PyEval_SetTrace(): 856. 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: 1ac.

     As *note PyEval_SetTrace(): 856, 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.19 Reference tracing
======================

Added in version 3.13.

 -- C のデータ型: typedef int (*PyRefTracer)(*note PyObject: 1a6.*, int
          event, void *data)

     The type of the trace function registered using *note
     PyRefTracer_SetTracer(): 80b.  The first parameter is a Python
     object that has been just created (when 'event' is set to *note
     PyRefTracer_CREATE: 58fb.) or about to be destroyed (when 'event'
     is set to *note PyRefTracer_DESTROY: 58fc.).  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: 1a6b.
     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: 58fa.
     functions when a Python object has been created.

 -- C 変数: int PyRefTracer_DESTROY

     The value for the 'event' parameter to *note PyRefTracer: 58fa.
     functions when a Python object has been destroyed.

 -- C 変数: int PyRefTracer_TRACKER_REMOVED

     The value for the 'event' parameter to *note PyRefTracer: 58fa.
     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: 1a90. will be active every time the tracer function
     is called.

     There must be an *note attached thread state: 1ac. 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: 1a6b. just before the new function is
     registered.

Added in version 3.13.

 -- C の関数: *note PyRefTracer: 58fa. 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(): 80b. 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: 1ac. 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.20 Python 初期化設定
======================

* Menu:

* PyInitConfig C API::
* Configuration Options::
* Runtime Python configuration API::
* PyConfig C API::
* Py_GetArgcArgv(): Py_GetArgcArgv.
* Multi-Phase Initialization Private Provisional API::


File: python.info,  Node: PyInitConfig C API,  Next: Configuration Options,  Up: Python 初期化設定

7.20.1 PyInitConfig C API
-------------------------

Added in version 3.14.

Python は *note Py_InitializeFromInitConfig(): 5ba. で初期化できます。

*note Py_RunMain(): d91. 関数は、カスタマイズされた Python プログラムを
書くために使用できます。

*note Initialization, Finalization, and Threads: 5890. も参照してくださ
い。

参考
....

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.20.1.1 使用例
...............

常に *note Python 開発モード: 713. が有効化された状態で実行されるカスタ
マイズされた 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.20.1.2 設定の作成
...................

 -- C Struct: struct PyInitConfig

     Python の初期化を構成するための不透明な構造体です。

 -- C の関数: *note PyInitConfig: 5903. *PyInitConfig_Create (void)

     Create a new initialization configuration using *note Isolated
     Configuration: 5904. default values.

     It must be freed by *note PyInitConfig_Free(): 5bc.

     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.20.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.20.1.4 Get Options
....................

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
5907.

 -- 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.20.1.5 Set Options
....................

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
5907.

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.20.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(): 1d39. function.


File: python.info,  Node: Initialize Python,  Prev: Module,  Up: PyInitConfig C API

7.20.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.20.2 Configuration Options
----------------------------

オプション                    PyConfig/PyPreConfig member   型                            可視性
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
‘"allocator"’                 *note allocator: 590c.        ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"argv"’                      *note argv: 60e.              ‘list[str]’                   Public
                                                                                          
                                                                                          
‘"base_exec_prefix"’          *note base_exec_prefix: 590d. ‘str’                         Public
                                                                                          
                                                                                          
‘"base_executable"’           *note base_executable: 590e.  ‘str’                         Public
                                                                                          
                                                                                          
‘"base_prefix"’               *note base_prefix: 590f.      ‘str’                         Public
                                                                                          
                                                                                          
‘"buffered_stdio"’            *note buffered_stdio: 62b.    ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"bytes_warning"’             *note bytes_warning: 3cc.     ‘int’                         Public
                                                                                          
                                                                                          
‘"check_hash_pycs_mode"’      *note check_hash_pycs_mode: 5910.‘str’                      読み出し専用
                                                                                          
                                                                                          
‘"code_debug_ranges"’         *note code_debug_ranges: 5911.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"coerce_c_locale"’           *note coerce_c_locale: 5912.  ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"coerce_c_locale_warn"’      *note coerce_c_locale_warn: 5913.‘bool’                     読み出し専用
                                                                                          
                                                                                          
‘"configure_c_stdio"’         *note configure_c_stdio: 5914.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"configure_locale"’          *note configure_locale: 5915. ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"cpu_count"’                 *note cpu_count: 5916.        ‘int’                         Public
                                                                                          
                                                                                          
‘"dev_mode"’                  *note dev_mode: 5917.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"dump_refs"’                 *note dump_refs: 5918.        ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"dump_refs_file"’            *note dump_refs_file: 5919.   ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"exec_prefix"’               *note exec_prefix: 591a.      ‘str’                         Public
                                                                                          
                                                                                          
‘"executable"’                *note executable: 83c.        ‘str’                         Public
                                                                                          
                                                                                          
‘"faulthandler"’              *note faulthandler: 591b.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"filesystem_encoding"’       *note filesystem_encoding: 635.‘str’                        読み出し専用
                                                                                          
                                                                                          
‘"filesystem_errors"’         *note filesystem_errors: 636. ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"hash_seed"’                 *note hash_seed: 62e.         ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"home"’                      *note home: 610.              ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"import_time"’               *note import_time: 591c.      ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"inspect"’                   *note inspect: 61c.           ‘bool’                        Public
                                                                                          
                                                                                          
‘"install_signal_handlers"’   *note install_signal_handlers: c95.‘bool’                   読み出し専用
                                                                                          
                                                                                          
‘"int_max_str_digits"’        *note int_max_str_digits: 591d.‘int’                        Public
                                                                                          
                                                                                          
‘"interactive"’               *note interactive: 61a.       ‘bool’                        Public
                                                                                          
                                                                                          
‘"isolated"’                  *note isolated: 630.          ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"legacy_windows_fs_encoding"’*note legacy_windows_fs_encoding: 632.‘bool’                読み出し専用
                                                                                          
                                                                                          
‘"legacy_windows_stdio"’      *note legacy_windows_stdio: 634.‘bool’                      読み出し専用
                                                                                          
                                                                                          
‘"malloc_stats"’              *note malloc_stats: 591e.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"module_search_paths"’       *note module_search_paths: 83a.‘list[str]’                  Public
                                                                                          
                                                                                          
‘"optimization_level"’        *note optimization_level: 61e.‘int’                         Public
                                                                                          
                                                                                          
‘"orig_argv"’                 *note orig_argv: c6e.         ‘list[str]’                   読み出し専用
                                                                                          
                                                                                          
‘"parse_argv"’                *note parse_argv: 1f05.       ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"parser_debug"’              *note parser_debug: 614.      ‘bool’                        Public
                                                                                          
                                                                                          
‘"pathconfig_warnings"’       *note pathconfig_warnings: 623.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"perf_profiling"’            *note perf_profiling: 591f.   ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"platlibdir"’                *note platlibdir: 1f35.       ‘str’                         Public
                                                                                          
                                                                                          
‘"prefix"’                    *note prefix: 5920.           ‘str’                         Public
                                                                                          
                                                                                          
‘"program_name"’              *note program_name: 60f.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"pycache_prefix"’            *note pycache_prefix: 5921.   ‘str’                         Public
                                                                                          
                                                                                          
‘"quiet"’                     *note quiet: 618.             ‘bool’                        Public
                                                                                          
                                                                                          
‘"run_command"’               *note run_command: 589b.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_filename"’              *note run_filename: 589c.     ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_module"’                *note run_module: 589d.       ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_presite"’               *note run_presite: 5922.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"safe_path"’                 *note safe_path: b5a.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"show_ref_count"’            *note show_ref_count: 5923.   ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"site_import"’               *note site_import: 620.       ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"skip_source_first_line"’    *note skip_source_first_line: 5924.‘bool’                   読み出し専用
                                                                                          
                                                                                          
‘"stdio_encoding"’            *note stdio_encoding: 83b.    ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"stdio_errors"’              *note stdio_errors: 4c1c.     ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"stdlib_dir"’                *note stdlib_dir: 5925.       ‘str’                         Public
                                                                                          
                                                                                          
‘"tracemalloc"’               *note tracemalloc: 5926.      ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"use_environment"’           *note use_environment: 625.   ‘bool’                        Public
                                                                                          
                                                                                          
‘"use_frozen_modules"’        *note use_frozen_modules: 5927.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"use_hash_seed"’             *note use_hash_seed: 62d.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"use_system_logger"’         *note use_system_logger: 2481.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"user_site_directory"’       *note user_site_directory: 629.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"utf8_mode"’                 *note utf8_mode: 637.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"verbose"’                   *note verbose: 616.           ‘int’                         Public
                                                                                          
                                                                                          
‘"warn_default_encoding"’     *note warn_default_encoding: 5928.‘bool’                    読み出し専用
                                                                                          
                                                                                          
‘"warnoptions"’               *note warnoptions: 838.       ‘list[str]’                   Public
                                                                                          
                                                                                          
‘"write_bytecode"’            *note write_bytecode: 627.    ‘bool’                        Public
                                                                                          
                                                                                          
‘"xoptions"’                  *note xoptions: 839.          ‘dict[str, str]’              Public
                                                                                          
                                                                                          
‘"_pystats"’                  *note _pystats: 5929.         ‘bool’                        読み出し専用
                                                                                          

Visibility:

   * Public: Can be retrieved by *note PyConfig_Get(): 3ae. and set by
     *note PyConfig_Set(): 5b1.

   * Read-only: Can be retrieved by *note PyConfig_Get(): 3ae, but
     cannot be set by *note PyConfig_Set(): 5b1.


File: python.info,  Node: Runtime Python configuration API,  Next: PyConfig C API,  Prev: Configuration Options,  Up: Python 初期化設定

7.20.3 Runtime Python configuration API
---------------------------------------

At runtime, it's possible to get and set configuration options using
*note PyConfig_Get(): 3ae. and *note PyConfig_Set(): 5b1. functions.

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
5907.

Some options are read from the *note sys: e2. attributes.  For example,
the option ‘"argv"’ is read from *note sys.argv: 161e.

 -- C の関数: *note PyObject: 1a6. *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: 1ac.  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(): 3ae, 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: 1a6. *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: 1ac.  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: 15a. if there is no option 'name'.

        * Raise a *note ValueError: 15a. if 'value' is an invalid value.

        * Raise a *note ValueError: 15a. if the option is read-only
          (cannot be set).

        * Raise a *note TypeError: 29c. if 'value' has not the proper
          type.

     The caller must have an *note attached thread state: 1ac.  The
     function cannot be called before Python initialization nor after
     Python finalization.

     Raises an *note auditing event: 1e84. ‘cpython.PyConfig_Set’ with
     arguments ‘name’, ‘value’.

     Added in version 3.14.


File: python.info,  Node: PyConfig C API,  Next: Py_GetArgcArgv,  Prev: Runtime Python configuration API,  Up: Python 初期化設定

7.20.4 PyConfig C API
---------------------

Added in version 3.8.

Pythonは *note Py_InitializeFromConfig(): 611. と *note PyConfig: 612. 構
造体を使って初期化できます。*note Py_PreInitialize(): 638. と *note
PyPreConfig: d78. 構造体によって事前に初期化できます。

設定には二つの種類があります:

   * *note Python Configuration: 589e. は、通常の Python と同じ振る舞い
     をするカスタマイズされた Python を構築するために使用されます。例え
     ば、環境変数やコマンドライン引数がPythonを設定するために使用されま
     す。

   * The *note Isolated Configuration: 5904. 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(): d91. 関数は、カスタマイズされた Python プログラムを
書くために使用できます。

*note Initialization, Finalization, and Threads: 5890. も参照してくださ
い。

参考
....

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.20.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.20.4.2 PyWideStringList
.........................

 -- C のデータ型: type PyWideStringList

     ‘wchar_t*’ 文字列のリスト。

     'length' が非ゼロの場合は、'items' は非 ‘NULL’ かつすべての文字列は
     非 ‘NULL’ でなければなりません。

     メソッド:

      -- C の関数: *note PyStatus: d79. PyWideStringList_Append
               (PyWideStringList *list, const wchar_t *item)

          'item' を 'list' に追加します。

          Python must be preinitialized to call this function.

      -- C の関数: *note PyStatus: d79. 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: e28. length

          リストの長さ。

      -- C のメンバ変数: wchar_t **items

          リストの要素。


File: python.info,  Node: PyStatus,  Next: PyPreConfig,  Prev: PyWideStringList,  Up: PyConfig C API

7.20.4.3 PyStatus
.................

 -- C のデータ型: type PyStatus

     初期化関数のステータス(成功、エラー、終了)を格納する構造体です。

     エラー時には、エラーを生成したC関数の名前を格納できます。

     構造体フィールド:

      -- C のメンバ変数: int exitcode

          終了コード。‘exit()’ の引数として渡されます。

      -- C のメンバ変数: const char *err_msg

          エラーメッセージ。

      -- C のメンバ変数: const char *func

          エラーを生成した関数の名前で、‘NULL’ になりえます。

     ステータスを生成する関数:

      -- C の関数: *note PyStatus: d79. PyStatus_Ok (void)

          成功。

      -- C の関数: *note PyStatus: d79. PyStatus_Error (const char
               *err_msg)

          メッセージとともにエラーを初期化します。

          'err_msg' must not be ‘NULL’.

      -- C の関数: *note PyStatus: d79. PyStatus_NoMemory (void)

          メモリ割り当ての失敗(メモリ不足)。

      -- C の関数: *note PyStatus: d79. 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():
          d8e. 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.20.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: 589e.

      -- C の関数: void PyPreConfig_InitIsolatedConfig (PyPreConfig
               *preconfig)

          Initialize the preconfiguration with *note Isolated
          Configuration: 5904.

     構造体フィールド:

      -- 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: 2348.

             * ‘PYMEM_ALLOCATOR_DEBUG’ (‘2’): *note default memory
               allocators: 2348. with *note debug hooks: 234b.

             * ‘PYMEM_ALLOCATOR_MALLOC’ (‘3’): use ‘malloc()’ of the C
               library.

             * ‘PYMEM_ALLOCATOR_MALLOC_DEBUG’ (‘4’): force usage of
               ‘malloc()’ with *note debug hooks: 234b.

             * ‘PYMEM_ALLOCATOR_PYMALLOC’ (‘5’): *note Python pymalloc
               memory allocator: 3e1.

             * ‘PYMEM_ALLOCATOR_PYMALLOC_DEBUG’ (‘6’): *note Python
               pymalloc memory allocator: 3e1. with *note debug hooks:
               234b.

             * ‘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: 234b.

          ‘PYMEM_ALLOCATOR_PYMALLOC’ and
          ‘PYMEM_ALLOCATOR_PYMALLOC_DEBUG’ are not supported if Python
          is *note configured using -without-pymalloc: 23ac.

          ‘PYMEM_ALLOCATOR_MIMALLOC’ and
          ‘PYMEM_ALLOCATOR_MIMALLOC_DEBUG’ are not supported if Python
          is *note configured using -without-mimalloc: 23ab. or if the
          underlying atomic support isn't available.

          See *note Memory Management: 5935.

          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: 5912. and *note
          coerce_c_locale_warn: 5913. members to ‘0’.

          See the *note locale encoding: 752.

          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: 752.

          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: 713.: see *note
          PyConfig.dev_mode: 5917.

          Default: ‘-1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: int isolated

          Isolated mode: see *note PyConfig.isolated: 630.

          Default: ‘0’ in Python mode, ‘1’ in isolated mode.

      -- C のメンバ変数: int legacy_windows_fs_encoding

          If non-zero:

             * Set *note PyPreConfig.utf8_mode: 637. to ‘0’,

             * Set *note PyConfig.filesystem_encoding: 635. to ‘"mbcs"’,

             * Set *note PyConfig.filesystem_errors: 636. to
               ‘"replace"’.

          Initialized from the *note PYTHONLEGACYWINDOWSFSENCODING: 15e.
          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(): d8f. and *note
          Py_PreInitializeFromBytesArgs(): d90. parse their ‘argv’
          argument the same way the regular Python parses command line
          arguments: see *note Command Line Arguments: 13b5.

          Default: ‘1’ in Python config, ‘0’ in isolated config.

      -- C のメンバ変数: int use_environment

          Use *note environment variables: 9ed.?  See *note
          PyConfig.use_environment: 625.

          Default: ‘1’ in Python config and ‘0’ in isolated config.

      -- C のメンバ変数: int utf8_mode

          If non-zero, enable the *note Python UTF-8 Mode: a4b.

          Set to ‘0’ or ‘1’ by the *note -X utf8: 183. command line
          option and the *note PYTHONUTF8: 1b8. environment variable.

          Default: ‘1’.


File: python.info,  Node: Preinitialize Python with PyPreConfig,  Next: PyConfig,  Prev: PyPreConfig,  Up: PyConfig C API

7.20.4.5 Preinitialize Python with PyPreConfig
..............................................

The preinitialization of Python:

   * Set the Python memory allocators (*note PyPreConfig.allocator:
     590c.)

   * Configure the LC_CTYPE locale (*note locale encoding: 752.)

   * Set the *note Python UTF-8 Mode: a4b. (*note PyPreConfig.utf8_mode:
     637.)

The current preconfiguration (‘PyPreConfig’ type) is stored in
‘_PyRuntime.preconfig’.

Functions to preinitialize Python:

 -- C の関数: *note PyStatus: d79. Py_PreInitialize (const PyPreConfig
          *preconfig)

     Preinitialize Python from 'preconfig' preconfiguration.

     'preconfig' must not be ‘NULL’.

 -- C の関数: *note PyStatus: d79. 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: 5938. of 'preconfig' is non-zero.

     'preconfig' must not be ‘NULL’.

 -- C の関数: *note PyStatus: d79. 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: 5938. of 'preconfig' is non-zero.

     'preconfig' must not be ‘NULL’.

The caller is responsible to handle exceptions (error or exit) using
*note PyStatus_Exception(): d85. and *note Py_ExitStatusException():
d8e.

For *note Python Configuration: 589e. (*note
PyPreConfig_InitPythonConfig(): d83.), 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: 183.
command line option enables the *note Python UTF-8 Mode: a4b.

‘PyMem_SetAllocator()’ can be called after *note Py_PreInitialize():
638. and before *note Py_InitializeFromConfig(): 611. to install a
custom memory allocator.  It can be called before ‘Py_PreInitialize()’
if *note PyPreConfig.allocator: 590c. is set to
‘PYMEM_ALLOCATOR_NOT_SET’.

Python memory allocation functions like *note PyMem_RawMalloc(): 2ca.
must not be used before the Python preinitialization, whereas calling
directly ‘malloc()’ and ‘free()’ is always safe.  *note
Py_DecodeLocale(): f89. must not be called before the Python
preinitialization.

Example using the preinitialization to enable the *note Python UTF-8
Mode: a4b.:

     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.20.4.6 PyConfig
.................

 -- C のデータ型: type PyConfig

     Structure containing most parameters to configure Python.

     When done, the *note PyConfig_Clear(): d7b. function must be used
     to release the configuration memory.

     Structure methods:

      -- C の関数: void PyConfig_InitPythonConfig (PyConfig *config)

          Initialize configuration with the *note Python Configuration:
          589e.

      -- C の関数: void PyConfig_InitIsolatedConfig (PyConfig *config)

          Initialize configuration with the *note Isolated
          Configuration: 5904.

      -- C の関数: *note PyStatus: d79. 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: 4528. if needed.

      -- C の関数: *note PyStatus: d79. PyConfig_SetBytesString
               (PyConfig *config, wchar_t *const *config_str, const char
               *str)

          Decode 'str' using *note Py_DecodeLocale(): f89. and set the
          result into ‘*config_str’.

          *note Preinitialize Python: 4528. if needed.

      -- C の関数: *note PyStatus: d79. PyConfig_SetArgv (PyConfig
               *config, int argc, wchar_t *const *argv)

          Set command line arguments (*note argv: 60e. member of
          'config') from the 'argv' list of wide character strings.

          *note Preinitialize Python: 4528. if needed.

      -- C の関数: *note PyStatus: d79. PyConfig_SetBytesArgv (PyConfig
               *config, int argc, char *const *argv)

          Set command line arguments (*note argv: 60e. member of
          'config') from the 'argv' list of bytes strings.  Decode bytes
          using *note Py_DecodeLocale(): f89.

          *note Preinitialize Python: 4528. if needed.

      -- C の関数: *note PyStatus: d79. 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: 4528. if needed.

      -- C の関数: *note PyStatus: d79. PyConfig_Read (PyConfig *config)

          Read all Python configuration.

          Fields which are already initialized are left unchanged.

          Fields for *note path configuration: c84. are no longer
          calculated or modified when calling this function, as of
          Python 3.11.

          The *note PyConfig_Read(): b74. function only parses *note
          PyConfig.argv: 60e. arguments once: *note PyConfig.parse_argv:
          1f05. 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: 4528. if needed.

          バージョン 3.10 で変更: The *note PyConfig.argv: 60e.
          arguments are now only parsed once, *note PyConfig.parse_argv:
          1f05. is set to ‘2’ after arguments are parsed, and arguments
          are only parsed if ‘PyConfig.parse_argv’ equals ‘1’.

          バージョン 3.11 で変更: *note PyConfig_Read(): b74. no longer
          calculates all paths, and so fields listed under *note Python
          Path Configuration: c84. may no longer be updated until *note
          Py_InitializeFromConfig(): 611. is called.

      -- C の関数: void PyConfig_Clear (PyConfig *config)

          Release configuration memory.

     Most ‘PyConfig’ methods *note preinitialize Python: 4528. if
     needed.  In that case, the Python preinitialization configuration
     (*note PyPreConfig: d78.) is based on the *note PyConfig: 612.  If
     configuration fields which are in common with ‘PyPreConfig’ are
     tuned, they must be set before calling a ‘PyConfig’ method:

        * *note PyConfig.dev_mode: 5917.

        * *note PyConfig.isolated: 630.

        * *note PyConfig.parse_argv: 1f05.

        * *note PyConfig.use_environment: 625.

     Moreover, if *note PyConfig_SetArgv(): d7e. or *note
     PyConfig_SetBytesArgv(): d7f. is used, this method must be called
     before other methods, since the preinitialization configuration
     depends on command line arguments (if *note parse_argv: 1f05. 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: d7a. argv

          Set *note sys.argv: 161e. command line arguments based on
          *note argv: 60e.  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: 1f05. to ‘1’ to parse *note argv: 60e.
          the same way the regular Python parses Python command line
          arguments and then to strip Python arguments from ‘argv’.

          If *note argv: 60e. is empty, an empty string is added to
          ensure that *note sys.argv: 161e. always exists and is never
          empty.

          Default: ‘NULL’.

          See also the *note orig_argv: c6e. member.

      -- C のメンバ変数: int safe_path

          If equals to zero, ‘Py_RunMain()’ prepends a potentially
          unsafe path to *note sys.path: 19f. at startup:

             * If *note argv[0]: 60e. 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: 9a8. command line option and the
          *note PYTHONSAFEPATH: 9a9. 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: 3af.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: c84. output.

          See also *note PyConfig.exec_prefix: 591a.

      -- C のメンバ変数: wchar_t *base_executable

          Python base executable: ‘sys._base_executable’.

          Set by the ‘__PYVENV_LAUNCHER__’ environment variable.

          Set from *note PyConfig.executable: 83c. if ‘NULL’.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: c84. output.

          See also *note PyConfig.executable: 83c.

      -- C のメンバ変数: wchar_t *base_prefix

          *note sys.base_prefix: 3b2.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: c84. output.

          See also *note PyConfig.prefix: 5920.

      -- C のメンバ変数: int buffered_stdio

          If equals to ‘0’ and *note configure_c_stdio: 5914. is
          non-zero, disable buffering on the C streams stdout and
          stderr.

          Set to ‘0’ by the *note -u: 1f9e. command line option and the
          *note PYTHONUNBUFFERED: 1f9f. 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:
          1d2. or *note bytearray: 1d1. with *note str: 1ea, or
          comparing ‘bytes’ with *note int: 32e.

          If equal or greater to ‘2’, raise a *note BytesWarning: 2fa.
          exception in these cases.

          Incremented by the *note -b: 2f9. command line option.

          Default: ‘0’.

          バージョン 3.15 で非推奨、バージョン 3.17 で削除予定: The
          *note -b: 2f9. and ‘-bb’ options will become no-op in 3.17.
          *note bytes_warning: 3cc. member will be removed in 3.17.

      -- C のメンバ変数: int warn_default_encoding

          If non-zero, emit a *note EncodingWarning: 233c. warning when
          *note io.TextIOWrapper: ba0. uses its default encoding.  See
          *note Opt-in EncodingWarning: 1b7. 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: 9ba. environment
          variable and by the *note -X no_debug_ranges: 183. 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: 2330. 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: 62b. equals zero, disable
               buffering of stdin, stdout and stderr streams.

             * If *note interactive: 61a. 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: 713.

          Set to ‘1’ by the *note -X dev: 183. option and the *note
          PYTHONDEVMODE: eb9. 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: d73. environment
          variable.

          Needs a special build of Python with the ‘Py_TRACE_REFS’ macro
          defined: see the *note configure -with-trace-refs option: 82e.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *dump_refs_file

          Filename where to dump Python references.

          Set by the *note PYTHONDUMPREFSFILE: 1e55. 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: 3b0.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: c84. output.

          See also *note PyConfig.base_exec_prefix: 590d.

      -- C のメンバ変数: wchar_t *executable

          The absolute path of the executable binary for the Python
          interpreter: *note sys.executable: 3b4.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: c84. output.

          See also *note PyConfig.base_executable: 590e.

      -- C のメンバ変数: int faulthandler

          Enable faulthandler?

          If non-zero, call *note faulthandler.enable(): 224. at
          startup.

          Set to ‘1’ by *note -X faulthandler: 183. and the *note
          PYTHONFAULTHANDLER: 143c. environment variable.

          Default: ‘-1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: wchar_t *filesystem_encoding

          *note Filesystem encoding: 94d.: *note
          sys.getfilesystemencoding(): 101b.

          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: 632. of *note PyPreConfig: d78. is
          non-zero.

          Default encoding on other platforms:

             * ‘"utf-8"’ if *note PyPreConfig.utf8_mode: 637. 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: 752.:
               ‘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: 636. member.

      -- C のメンバ変数: wchar_t *filesystem_errors

          *note Filesystem error handler: 94d.: *note
          sys.getfilesystemencodeerrors(): 10a7.

          On Windows: use ‘"surrogatepass"’ by default, or ‘"replace"’
          if *note legacy_windows_fs_encoding: 632. of *note
          PyPreConfig: d78. 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: 635. member.

      -- C のメンバ変数: int use_frozen_modules

          If non-zero, use frozen modules.

          Set by the *note PYTHON_FROZEN_MODULES: 6bc. environment
          variable.

          Default: ‘1’ in a release build, or ‘0’ in a *note debug
          build: 3e3.

      -- C のメンバ変数: unsigned long hash_seed

      -- C のメンバ変数: int use_hash_seed

          Randomized hash function seed.

          If *note use_hash_seed: 62d. is zero, a seed is chosen
          randomly at Python startup, and *note hash_seed: 62e. is
          ignored.

          Set by the *note PYTHONHASHSEED: 1434. 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: 3b5.).

          Set by the *note PYTHONHOME: 3b5. environment variable.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: c84. 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: 183. option and the *note
               PYTHONPROFILEIMPORTTIME: ebf. 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: 94f. does not appear to be a terminal.

          Incremented by the *note -i: 1893. command line option.  Set
          to ‘1’ if the *note PYTHONINSPECT: 1892. 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: 1893. command line option.

          Default: ‘0’.

      -- C のメンバ変数: int int_max_str_digits

          Configures the *note integer string conversion length
          limitation: 9f1.  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: 28f0.).  A value of ‘0’
          disables the limitation.  Values greater than zero but less
          than 640 (*note sys.int_info.str_digits_check_threshold:
          4c18.) are unsupported and will produce an error.

          Configured by the *note -X int_max_str_digits: 183. command
          line flag or the *note PYTHONINTMAXSTRDIGITS: 1d57.
          environment variable.

          Default: ‘-1’ in Python mode.  4300 (*note
          sys.int_info.default_max_str_digits: 28f0.) in isolated mode.

          Added in version 3.12.

      -- C のメンバ変数: int cpu_count

          If the value of *note cpu_count: 5916. is not ‘-1’ then it
          will override the return values of *note os.cpu_count(): 6e7,
          *note os.process_cpu_count(): 6e6, and *note
          multiprocessing.cpu_count(): 131e.

          Configured by the ‘-X cpu_count=N|DEFAULT’ command line flag
          or the *note PYTHON_CPU_COUNT: 727. environment variable.

          Default: ‘-1’.

          Added in version 3.13.

      -- C のメンバ変数: int isolated

          If greater than ‘0’, enable isolated mode:

             * Set *note safe_path: b5a. to ‘1’: don't prepend a
               potentially unsafe path to *note sys.path: 19f. at Python
               startup, such as the current directory, the script's
               directory or an empty string.

             * Set *note use_environment: 625. to ‘0’: ignore ‘PYTHON’
               environment variables.

             * Set *note user_site_directory: 629. to ‘0’: don't add the
               user site directory to *note sys.path: 19f.

             * Python REPL doesn't import *note readline: c2. nor enable
               default readline configuration on interactive prompts.

          Set to ‘1’ by the *note -I: d2c. command line option.

          Default: ‘0’ in Python mode, ‘1’ in isolated mode.

          See also the *note Isolated Configuration: 5904. and *note
          PyPreConfig.isolated: 5937.

      -- C のメンバ変数: int legacy_windows_stdio

          If non-zero, use *note io.FileIO: 16c9. instead of
          ‘io._WindowsConsoleIO’ for *note sys.stdin: 94f, *note
          sys.stdout: ea0. and *note sys.stderr: d09.

          *note PYTHONLEGACYWINDOWSSTDIO: 101d. 環境変数が空でない文字列
          に設定された場合に、 ‘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: 3e1. at exit.

          Set to ‘1’ by the *note PYTHONMALLOCSTATS: 2143. environment
          variable.

          The option is ignored if Python is *note configured using the
          -without-pymalloc option: 23ac.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *platlibdir

          Platform library directory name: *note sys.platlibdir: 2b4.

          Set by the *note PYTHONPLATLIBDIR: 1f37. environment variable.

          Default: value of the ‘PLATLIBDIR’ macro which is set by the
          *note configure -with-platlibdir option: 19dd. (default:
          ‘"lib"’, or ‘"DLLs"’ on Windows).

          Part of the *note Python Path Configuration: c84. 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: 19f.) as a string
          separated by ‘DELIM’ (*note os.pathsep: 2341.).

          Set by the *note PYTHONPATH: 13cb. environment variable.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: c84. input.

      -- C のメンバ変数: *note PyWideStringList: d7a.
               module_search_paths

      -- C のメンバ変数: int module_search_paths_set

          Module search paths: *note sys.path: 19f.

          If *note module_search_paths_set: 9eb. is equal to ‘0’, *note
          Py_InitializeFromConfig(): 611. will replace *note
          module_search_paths: 83a. 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: c84. 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: 438. command line option.  Set to
          the *note PYTHONOPTIMIZE: 2333. environment variable value.

          Default: ‘0’.

      -- C のメンバ変数: *note PyWideStringList: d7a. orig_argv

          The list of the original command line arguments passed to the
          Python executable: *note sys.orig_argv: c1d.

          If *note orig_argv: c6e. list is empty and *note argv: 60e. is
          not a list only containing an empty string, *note
          PyConfig_Read(): b74. copies ‘argv’ into ‘orig_argv’ before
          modifying ‘argv’ (if *note parse_argv: 1f05. is non-zero).

          See also the *note argv: 60e. member and the *note
          Py_GetArgcArgv(): 1f54. function.

          Default: empty list.

          Added in version 3.10.

      -- C のメンバ変数: int parse_argv

          Parse command line arguments?

          If equals to ‘1’, parse *note argv: 60e. the same way the
          regular Python parses *note command line arguments: 13b5, and
          strip Python arguments from ‘argv’.

          The *note PyConfig_Read(): b74. function only parses *note
          PyConfig.argv: 60e. arguments once: *note PyConfig.parse_argv:
          1f05. 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: 60e.
          arguments are now only parsed if *note PyConfig.parse_argv:
          1f05. 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: 2331. command line option.  Set
          to the *note PYTHONDEBUG: 2332. environment variable value.

          Needs a *note debug build of Python: 3e3. (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: c84. 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: 3b3.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: c84. output.

          See also *note PyConfig.base_prefix: 590f.

      -- C のメンバ変数: wchar_t *program_name

          Program name used to initialize *note executable: 83c. and in
          early error messages during Python initialization.

             * On macOS, use *note PYTHONEXECUTABLE: 2345. 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: 60e. 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: c84. input.

      -- C のメンバ変数: wchar_t *pycache_prefix

          Directory where cached ‘.pyc’ files are written: *note
          sys.pycache_prefix: d71.

          Set by the *note -X pycache_prefix=PATH: 183. command line
          option and the *note PYTHONPYCACHEPREFIX: d70. environment
          variable.  The command-line option takes precedence.

          If ‘NULL’, *note sys.pycache_prefix: d71. 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: 19b5. command line option.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *run_command

          Value of the *note -c: 44c. command line option.

          Used by *note Py_RunMain(): d91.

          Default: ‘NULL’.

      -- C のメンバ変数: wchar_t *run_filename

          Filename passed on the command line: trailing command line
          argument without *note -c: 44c. or *note -m: 4d1.  It is used
          by the *note Py_RunMain(): d91. 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: 5924.
          option.

          Default: ‘NULL’.

      -- C のメンバ変数: wchar_t *run_module

          Value of the *note -m: 4d1. command line option.

          Used by *note Py_RunMain(): d91.

          Default: ‘NULL’.

      -- C のメンバ変数: wchar_t *run_presite

          ‘module’ or ‘module:func’ entry point that should be executed
          before the *note site: cf. module is imported.

          Set by the *note -X presite=module;func: 183. command-line
          option and the *note PYTHON_PRESITE: 1920. environment
          variable.  The command-line option takes precedence.

          Needs a *note debug build of Python: 3e3. (the ‘Py_DEBUG’
          macro must be defined).

          Default: ‘NULL’.

      -- C のメンバ変数: int show_ref_count

          Show total reference count at exit (excluding *note immortal:
          3a0. objects)?

          Set to ‘1’ by *note -X showrefcount: 183. command line option.

          Needs a *note debug build of Python: 3e3. (the ‘Py_REF_DEBUG’
          macro must be defined).

          Default: ‘0’.

      -- C のメンバ変数: int site_import

          Import the *note site: cf. module at startup?

          If equal to zero, disable the import of the module site and
          the site-dependent manipulations of *note sys.path: 19f. that
          it entails.

          Also disable these manipulations if the *note site: cf. module
          is explicitly imported later (call *note site.main(): 2335. if
          you want them to be triggered).

          Set to ‘0’ by the *note -S: 1566. command line option.

          *note sys.flags.no_site: a81. is set to the inverted value of
          *note site_import: 620.

          Default: ‘1’.

      -- C のメンバ変数: int skip_source_first_line

          If non-zero, skip the first line of the *note
          PyConfig.run_filename: 589c. 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: 2339. command line option.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *stdio_encoding

      -- C のメンバ変数: wchar_t *stdio_errors

          Encoding and encoding errors of *note sys.stdin: 94f, *note
          sys.stdout: ea0. and *note sys.stderr: d09. (but ‘sys.stderr’
          always uses ‘"backslashreplace"’ error handler).

          Use the *note PYTHONIOENCODING: 13b8. environment variable if
          it is non-empty.

          Default encoding:

             * ‘"UTF-8"’ if *note PyPreConfig.utf8_mode: 637. is
               non-zero.

             * Otherwise, use the *note locale encoding: 752.

          Default error handler:

             * On Windows: use ‘"surrogateescape"’.

             * ‘"surrogateescape"’ if *note PyPreConfig.utf8_mode: 637.
               is non-zero, or if the LC_CTYPE locale is "C" or "POSIX".

             * ‘"strict"’ otherwise.

          See also *note PyConfig.legacy_windows_stdio: 634.

      -- C のメンバ変数: int tracemalloc

          Enable tracemalloc?

          If non-zero, call *note tracemalloc.start(): 233a. at startup.

          Set by *note -X tracemalloc=N: 183. command line option and by
          the *note PYTHONTRACEMALLOC: 233b. 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: 183. command-line option and the
          *note PYTHONPERFSUPPORT: 889. environment variable.

          Set to ‘2’ by the *note -X perf_jit: 183. command-line option
          and the *note PYTHON_PERF_JIT_SUPPORT: 6be. environment
          variable.

          Default: ‘-1’.

          参考
          ....

          See *note Python support for the perf map compatible
          profilers: 6bd. 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: 9ed.?

          If equals to zero, ignore the *note environment variables:
          9ed.

          Set to ‘0’ by the *note -E: d2b. 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:
          19f.

          Set to ‘0’ by the *note -s: 1747. and *note -I: d2c. command
          line options.

          Set to ‘0’ by the *note PYTHONNOUSERSITE: 1748. 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: 17dd. command line option.

          Set by the *note PYTHONVERBOSE: 2336. environment variable
          value.

          Default: ‘0’.

      -- C のメンバ変数: *note PyWideStringList: d7a. warnoptions

          Options of the *note warnings: 11b. module to build warnings
          filters, lowest to highest priority: *note sys.warnoptions:
          3ad.

          The *note warnings: 11b. module adds *note sys.warnoptions:
          3ad. in the reverse order: the last *note
          PyConfig.warnoptions: 838. item becomes the first item of
          ‘warnings.filters’ which is checked first (highest priority).

          The *note -W: 1cb. command line options adds its value to
          *note warnoptions: 838, it can be used multiple times.

          The *note PYTHONWARNINGS: 1cc. 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: 1786. command line option and the
          *note PYTHONDONTWRITEBYTECODE: 1787. environment variable.

          *note sys.dont_write_bytecode: 4be5. is initialized to the
          inverted value of *note write_bytecode: 627.

          Default: ‘1’.

      -- C のメンバ変数: *note PyWideStringList: d7a. xoptions

          Values of the *note -X: 183. command line options: *note
          sys._xoptions: 233e.

          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: 1d55.

          Default: ‘0’.

If *note parse_argv: 1f05. is non-zero, *note argv: 60e. arguments are
parsed the same way the regular Python parses *note command line
arguments: 13b5, and Python arguments are stripped from ‘argv’.

The *note xoptions: 839. options are parsed to set other options: see
the *note -X: 183. 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.20.4.7 Initialization with PyConfig
.....................................

Initializing the interpreter from a populated configuration struct is
handled by calling *note Py_InitializeFromConfig(): 611.

The caller is responsible to handle exceptions (error or exit) using
*note PyStatus_Exception(): d85. and *note Py_ExitStatusException():
d8e.

If *note PyImport_FrozenModules(): 3587, *note PyImport_AppendInittab():
1d39. or *note PyImport_ExtendInittab(): 1d3a. 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_GetAttrString("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.20.4.8 Isolated Configuration
...............................

*note PyPreConfig_InitIsolatedConfig(): d82. and *note
PyConfig_InitIsolatedConfig(): d7c. 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: 60e. 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: 610. 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.20.4.9 Python Configuration
.............................

*note PyPreConfig_InitPythonConfig(): d83. and *note
PyConfig_InitPythonConfig(): d7d. 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: a4b. ( PEP 540(2)) depending on the LC_CTYPE locale, *note
PYTHONUTF8: 1b8. and *note PYTHONCOERCECLOCALE: e9f. 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.20.4.10 Python Path Configuration
...................................

*note PyConfig: 612. contains multiple fields for the path
configuration:

   * Path configuration inputs:

        * *note PyConfig.home: 610.

        * *note PyConfig.platlibdir: 1f35.

        * *note PyConfig.pathconfig_warnings: 623.

        * *note PyConfig.program_name: 60f.

        * *note PyConfig.pythonpath_env: 593c.

        * current working directory: to get absolute paths

        * ‘PATH’ environment variable to get the program full path (from
          *note PyConfig.program_name: 60f.)

        * ‘__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: 590d.

        * *note PyConfig.base_executable: 590e.

        * *note PyConfig.base_prefix: 590f.

        * *note PyConfig.exec_prefix: 591a.

        * *note PyConfig.executable: 83c.

        * *note PyConfig.module_search_paths_set: 9eb, *note
          PyConfig.module_search_paths: 83a.

        * *note PyConfig.prefix: 5920.

If at least one "output field" is not set, Python calculates the path
configuration to fill unset fields.  If *note module_search_paths_set:
9eb. is equal to ‘0’, *note module_search_paths: 83a. 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: 623. to ‘0’ to suppress warnings when
calculating the path configuration (Unix only, Windows does not log any
warning).

If *note base_prefix: 590f. or *note base_exec_prefix: 590d. fields are
not set, they inherit their value from *note prefix: 5920. and *note
exec_prefix: 591a. respectively.

*note Py_RunMain(): d91. and *note Py_Main(): fe6. modify *note
sys.path: 19f.:

   * If *note run_filename: 589c. is set and is a directory which
     contains a ‘__main__.py’ script, prepend ‘run_filename’ to *note
     sys.path: 19f.

   * If *note isolated: 630. is zero:

        * If *note run_module: 589d. is set, prepend the current
          directory to *note sys.path: 19f.  Do nothing if the current
          directory cannot be read.

        * If *note run_filename: 589c. is set, prepend the directory of
          the filename to *note sys.path: 19f.

        * Otherwise, prepend an empty string to *note sys.path: 19f.

If *note site_import: 620. is non-zero, *note sys.path: 19f. can be
modified by the *note site: cf. module.  If *note user_site_directory:
629. 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: 630. to ‘1’.

   * Set *note use_environment: 625. to ‘0’.

   * Set *note site_import: 620. to ‘0’.

   * Set *note user_site_directory: 629. to ‘0’ (since 3.15).

   * Set *note safe_path: b5a. to ‘1’.

If *note home: 610. is not set and a ‘pyvenv.cfg’ file is present in the
same directory as *note executable: 83c, or its parent, *note prefix:
5920. and *note exec_prefix: 591a. are set that location.  When this
happens, *note base_prefix: 590f. and *note base_exec_prefix: 590d.
still keep their value, pointing to the base installation.  See *note
Virtual Environments: 4ba3. for more information.

The ‘__PYVENV_LAUNCHER__’ environment variable is used to set *note
PyConfig.base_executable: 590e.

バージョン 3.14 で変更: *note prefix: 5920, and *note exec_prefix: 591a,
are now set to the ‘pyvenv.cfg’ directory.  This was previously done by
*note site: cf, therefore affected by *note -S: 1566.

バージョン 3.15 で変更: *note user_site_directory: 629. is now set to
‘0’ when a ‘._pth’ file is present.


File: python.info,  Node: Py_GetArgcArgv,  Next: Multi-Phase Initialization Private Provisional API,  Prev: PyConfig C API,  Up: Python 初期化設定

7.20.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: c6e. member.


File: python.info,  Node: Multi-Phase Initialization Private Provisional API,  Prev: Py_GetArgcArgv,  Up: Python 初期化設定

7.20.6 Multi-Phase Initialization Private Provisional API
---------------------------------------------------------

This section is a private provisional API introducing multi-phase
initialization, the core feature of PEP 432(1):

   * "Core" initialization phase, "bare minimum Python":

        * Builtin types;

        * Builtin exceptions;

        * Builtin and frozen modules;

        * The *note sys: e2. module is only partially initialized (ex:
          *note sys.path: 19f. doesn't exist yet).

   * "Main" initialization phase, Python is fully initialized:

        * Install and configure *note importlib: 7a.;

        * Apply the *note Path Configuration: c84.;

        * Install signal handlers;

        * Finish *note sys: e2. module initialization (ex: create *note
          sys.stdout: ea0. and *note sys.path: 19f.);

        * Enable optional features like *note faulthandler: 5b. and
          *note tracemalloc: 108.;

        * Import the *note site: cf. module;

        * etc.

Private provisional API:

 -- C のメンバ変数: int *note PyConfig: 612._init_main

     If set to ‘0’, *note Py_InitializeFromConfig(): 611. stops at the
     "Core" initialization phase.

 -- C の関数: *note PyStatus: d79. _Py_InitializeMain (void)

     Move to the "Main" initialization phase, finish the Python
     initialization.

No module is imported during the "Core" phase and the ‘importlib’ module
is not configured: the *note Path Configuration: c84. is only applied
during the "Main" phase.  It may allow to customize Python in Python to
override or tune the *note Path Configuration: c84, maybe install a
custom *note sys.meta_path: 10e7. importer or an import hook, etc.

It may become possible to calculate the *note Path Configuration: c84.
in Python, after the Core phase and before the Main phase, which is one
of the PEP 432(2) motivation.

The "Core" phase is not properly defined: what should be and what should
not be available at this phase is not specified yet.  The API is marked
as private and provisional: the API can be modified or even be removed
anytime until a proper public API is designed.

Example running Python code between "Core" and "Main" initialization
phases:

     void init_python(void)
     {
         PyStatus status;

         PyConfig config;
         PyConfig_InitPythonConfig(&config);
         config._init_main = 0;

         /* ... customize 'config' configuration ... */

         status = Py_InitializeFromConfig(&config);
         PyConfig_Clear(&config);
         if (PyStatus_Exception(status)) {
             Py_ExitStatusException(status);
         }

         /* Use sys.stderr because sys.stdout is only created
            by _Py_InitializeMain() */
         int res = PyRun_SimpleString(
             "import sys; "
             "print('Run Python code before _Py_InitializeMain', "
                    "file=sys.stderr)");
         if (res < 0) {
             exit(1);
         }

         /* ... put more configuration code here ... */

         status = _Py_InitializeMain();
         if (PyStatus_Exception(status)) {
             Py_ExitStatusException(status);
         }
     }

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0432/

   (2) https://peps.python.org/pep-0432/


File: python.info,  Node: メモリ管理,  Next: オブジェクト実装サポート object implementation support,  Prev: Python 初期化設定,  Up: Python/C API reference manual

7.21 メモリ管理
===============

* 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.21.1 概要
-----------

Python におけるメモリ管理には、全ての Python オブジェクトとデータ構造が
入ったプライベートヒープ (private heap) が必須です。プライベートヒープの
管理は、内部的には 'Python メモリマネージャ (Python memory manager)' が
確実に行います。Python メモリマネージャには、共有 (sharing)、セグメント
分割 (segmentation)、事前割り当て (preallocation)、キャッシュ化
(caching) といった、様々な動的記憶管理の側面を扱うために、個別のコンポー
ネントがあります。

最低水準層では、素のメモリ操作関数 (raw memory allocator) がオペレーティ
ングシステムのメモリ管理機構とやりとりして、プライベートヒープ内にPython
関連の全てのデータを記憶するのに十分な空きがあるかどうか確認します。素の
メモリ操作関数の上には、いくつかのオブジェクト固有のメモリ操作関数があり
ます。これらは同じヒープを操作し、各オブジェクト型固有の事情に合ったメモ
リ管理ポリシを実装しています。例えば、整数オブジェクトは文字列やタプル、
辞書とは違ったやり方でヒープ内で管理されます。というのも、整数には値を記
憶する上で特別な要件があり、速度/容量のトレードオフが存在するからです。
このように、Python メモリマネジャは作業のいくつかをオブジェクト固有のメ
モリ操作関数に委譲しますが、これらの関数がプライベートヒープからはみ出し
てメモリ管理を行わないようにしています。

重要なのは、たとえユーザがいつもヒープ内のメモリブロックを指すようなオブ
ジェクトポインタを操作しているとしても、Python 用ヒープの管理はインタプ
リタ自体が行うもので、ユーザがそれを制御する余地はないと理解することです
。Python オブジェクトや内部使用されるバッファを入れるためのヒープ空間の
メモリ確保は、必要に応じて、Python メモリマネージャがこのドキュメント内
で列挙しているPython/C API 関数群を介して行います。

メモリ管理の崩壊を避けるため、拡張モジュールの作者は決して Python オブジ
ェクトを C ライブラリが公開している関数: ‘malloc()’ 、 ‘calloc()’ 、
‘realloc()’ および ‘free()’ で操作しようとしてはなりません。こうした関数
を使うと、C のメモリ操作関数と Python メモリマネージャとの間で関数呼び出
しが交錯します。 C のメモリ操作関数とPython メモリマネージャは異なるアル
ゴリズムで実装されていて、異なるヒープを操作するため、呼び出しの交錯は致
命的な結果を招きます。とはいえ、個別の目的のためなら、 C ライブラリのメ
モリ操作関数を使って安全にメモリを確保したり解放したりできます。例えば、
以下がそのような例です:

     PyObject *res;
     char *buf = (char *) malloc(BUFSIZ); /* for I/O */

     if (buf == NULL)
         return PyErr_NoMemory();
     ...Do some I/O operation involving buf...
     res = PyBytes_FromString(buf);
     free(buf); /* malloc'ed */
     return res;

この例では、I/O バッファに対するメモリ要求は C ライブラリのメモリ操作関
数を使っています。Python メモリマネージャーは戻り値として返される bytes
オブジェクトを確保する時にだけ必要です。

とはいえ、ほとんどの状況では、メモリの操作は Python ヒープに固定して行う
よう勧めます。なぜなら、Python ヒープは Python メモリマネジャの管理下に
あるからです。例えば、インタプリタを C で書かれた新たなオブジェクト型で
拡張する際には、ヒープでのメモリ管理が必要です。Python ヒープを使った方
がよいもう一つの理由として、拡張モジュールが必要としているメモリについて
Python メモリマネージャに '情報を提供' してほしいということがあります。
たとえ必要なメモリが内部的かつ非常に特化した用途に対して排他的に用いられ
るものだとしても、全てのメモリ操作要求を Python メモリマネージャに委譲す
れば、インタプリタはより正確なメモリフットプリントの全体像を把握できます
。その結果、特定の状況では、Python メモリマネージャがガベージコレクショ
ンやメモリのコンパクト化、その他何らかの予防措置といった、適切な動作をト
リガできることがあります。上の例で示したように C ライブラリのメモリ操作
関数を使うと、I/O バッファ用に確保したメモリは Python メモリマネージャの
管理から完全に外れることに注意してください。

参考
....

環境変数 *note PYTHONMALLOC: 1026. を使用して Python が利用するメモリア
ロケータを制御することができます。

環境変数 *note PYTHONMALLOCSTATS: 2143. を使用して、新たなオブジェクトア
リーナが生成される時と、シャットダウン時に *note pymalloc
メモリアロケータ: 3e1. の統計情報を表示できます。


File: python.info,  Node: Allocator Domains,  Next: 生メモリインターフェース,  Prev: 概要<4>,  Up: メモリ管理

7.21.2 Allocator Domains
------------------------

All allocating functions belong to one of three different "domains" (see
also *note PyMemAllocatorDomain: 594c.).  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: 2348.  The APIs used to
allocate and free a block of memory must be from the same domain.  For
example, *note PyMem_Free(): 17fa. must be used to free memory allocated
using *note PyMem_Malloc(): 1027.

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: 1ac.  The memory is requested directly from
     the system.  See *note Raw Memory Interface: 594d.

   * "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: 1ac.  The memory is
     taken from the Python private heap.  See *note Memory Interface:
     594e.

   * Object domain: intended for allocating memory for Python objects.
     The memory is taken from the Python private heap.  See *note Object
     allocators: 594f.

     注釈: The *note free-threaded: 48e. 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(): 1027, *note PyMem_RawMalloc(): 2ca, or
     ‘malloc()’, but not *note PyObject_Malloc(): 102a.

     See *note Memory Allocation APIs: 5950.


File: python.info,  Node: 生メモリインターフェース,  Next: メモリインターフェース,  Prev: Allocator Domains,  Up: メモリ管理

7.21.3 生メモリインターフェース
-------------------------------

The following function sets are wrappers to the system allocator.  These
functions are thread-safe, so a *note thread state: 1a90. does not need
to be *note attached: 1ac.

The *note default raw memory allocator: 2348. 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: 961. (バージョン 3.13 より).'
     'n' バイトを割り当て、そのメモリを指す void* 型のポインタを返します
     。要求が失敗した場合 ‘NULL’ を返します。

     0バイトを要求すると、 ‘PyMem_RawMalloc(1)’ が呼ばれたときと同じよう
     に、可能なら ‘NULL’ でないユニークなポインタを返します。確保された
     メモリーにはいかなる初期化も行われません。

 -- C の関数: void *PyMem_RawCalloc (size_t nelem, size_t elsize)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'  各
     要素が 'elsize' バイトの要素 'nelem' 個分のメモリーを確保し、そのメ
     モリーを指す void* 型のポインタを返します。アロケートに失敗した場合
     は ‘NULL’ を返します。確保されたメモリー領域はゼロで初期化されます
     。

     要素数か要素のサイズが0バイトの要求に対しては、可能なら
     ‘PyMem_RawCalloc(1, 1)’ が呼ばれたのと同じように、ユニークな ‘NULL’
     でないポインタを返します。

     Added in version 3.5.

 -- C の関数: void *PyMem_RawRealloc (void *p, size_t n)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     'p' が指すメモリブロックを 'n' バイトにリサイズします。古いサイズと
     新しいサイズの小さい方までの内容は変更されません。

     'p' が ‘NULL’ の場合呼び出しは ‘PyMem_RawMalloc(n)’ と等価です。そ
     うでなく、 'n' がゼロに等しい場合、メモリブロックはリサイズされます
     が解放されません。返されたポインタは非 ‘NULL’ です。

     'p' が ‘NULL’ でない限り、'p' はそれより前の *note
     PyMem_RawMalloc(): 2ca, *note PyMem_RawRealloc(): 82b, *note
     PyMem_RawCalloc(): 82a. の呼び出しにより返されなければなりません。

     要求が失敗した場合 *note PyMem_RawRealloc(): 82b. は ‘NULL’ を返し
     、 'p' は前のメモリエリアをさす有効なポインタのままです。

 -- C の関数: void PyMem_RawFree (void *p)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     'p' が指すメモリブロックを解放します。 'p' は以前呼び出した *note
     PyMem_RawMalloc(): 2ca, *note PyMem_RawRealloc(): 82b, *note
     PyMem_RawCalloc(): 82a. の返した値でなければなりません。それ以外の
     場合や ‘PyMem_RawFree(p)’ を呼び出した後だった場合、未定義の動作に
     なります。

     'p' が ‘NULL’ の場合何もしません。


File: python.info,  Node: メモリインターフェース,  Next: オブジェクトアロケータ,  Prev: 生メモリインターフェース,  Up: メモリ管理

7.21.4 メモリインターフェース
-----------------------------

以下の関数群が利用して Python ヒープに対してメモリを確保したり解放したり
出来ます。これらの関数は ANSI C 標準に従ってモデル化されていますが、0 バ
イトを要求した際の動作についても定義しています:

In the GIL-enabled build (default build) the *note default memory
allocator: 2348. uses the *note pymalloc memory allocator: 3e1, whereas
in the *note free-threaded build: 1a3, the default is the *note mimalloc
memory allocator: 234a. instead.

     警告: There must be an *note attached thread state: 1ac. when using
     these functions.

バージョン 3.6 で変更: デフォルトのアロケータがシステムの ‘malloc()’ か
ら pymalloc になりました。

バージョン 3.13 で変更: In the *note free-threaded: 48e. build, the
default allocator is now *note mimalloc: 234a.

 -- C の関数: void *PyMem_Malloc (size_t n)
     ' 次に属します: *note Stable ABI: 961.'  'n' バイトを割り当て、その
     メモリを指す void* 型のポインタを返します。要求が失敗した場合
     ‘NULL’ を返します。

     0バイトを要求すると、 ‘PyMem_Malloc(1)’ が呼ばれたときと同じように
     、可能なら ‘NULL’ でないユニークなポインタを返します。 確保されたメ
     モリーにはいかなる初期化も行われません。

 -- C の関数: void *PyMem_Calloc (size_t nelem, size_t elsize)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'  各
     要素が 'elsize' バイトの要素 'nelem' 個分のメモリーを確保し、そのメ
     モリーを指す void* 型のポインタを返します。アロケートに失敗した場合
     は ‘NULL’ を返します。確保されたメモリー領域はゼロで初期化されます
     。

     要素数か要素のサイズが0バイトの要求に対しては、可能なら
     ‘PyMem_Calloc(1, 1)’ が呼ばれたのと同じように、ユニークな ‘NULL’ で
     ないポインタを返します。

     Added in version 3.5.

 -- C の関数: void *PyMem_Realloc (void *p, size_t n)
     ' 次に属します: *note Stable ABI: 961.'  'p' が指すメモリブロックを
     'n' バイトにリサイズします。古いサイズと新しいサイズの小さい方まで
     の内容は変更されません。

     'p' が ‘NULL’ の場合呼び出しは ‘PyMem_Malloc(n)’ と等価です。そうで
     なく、 'n' がゼロに等しい場合、メモリブロックはリサイズされますが解
     放されません。返されたポインタは非 ‘NULL’ です。

     'p' が ‘NULL’ でない限り、'p' はそれより前の *note PyMem_Malloc():
     1027, *note PyMem_Realloc(): 13de. または *note PyMem_Calloc():
     1261. の呼び出しにより返されなければなりません。

     要求が失敗した場合 *note PyMem_Realloc(): 13de. は ‘NULL’ を返し、
     'p' は前のメモリエリアをさす有効なポインタのままです。

 -- C の関数: void PyMem_Free (void *p)
     ' 次に属します: *note Stable ABI: 961.'  'p' が指すメモリブロックを
     解放します。 'p' は以前呼び出した *note PyMem_Malloc(): 1027.、
     *note PyMem_Realloc(): 13de.、または *note PyMem_Calloc(): 1261. の
     返した値でなければなりません。それ以外の場合や ‘PyMem_Free(p)’ を呼
     び出した後だった場合、未定義の動作になります。

     'p' が ‘NULL’ の場合何もしません。

以下に挙げる型対象のマクロは利便性のために提供されているものです。'TYPE'
は任意の C の型を表します。

 -- C のマクロ: PyMem_New (TYPE, n)

     Same as *note PyMem_Malloc(): 1027, 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(): 13de, 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(): 17fa. と同じです。

* Menu:

* 非推奨のエイリアス: 非推奨のエイリアス<2>.


File: python.info,  Node: 非推奨のエイリアス<2>,  Up: メモリインターフェース

7.21.4.1 非推奨のエイリアス
...........................

These are *note soft deprecated: 1b2. aliases to existing functions and
macros.  They exist solely for backwards compatibility.

非推奨のエイリアス                                     Corresponding function or macro
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C のマクロ: PyMem_MALLOC (size)                    *note PyMem_Malloc(): 1027.
                                                       
                                                       
 -- C のマクロ: PyMem_NEW (type, size)                 *note PyMem_New: 18dc.
                                                       
                                                       
 -- C のマクロ: PyMem_REALLOC (ptr, size)              *note PyMem_Realloc(): 13de.
                                                       
                                                       
 -- C のマクロ: PyMem_RESIZE (ptr, type, size)         *note PyMem_Resize: 5953.
                                                       
                                                       
 -- C のマクロ: PyMem_FREE (ptr)                       *note PyMem_Free(): 17fa.
                                                       
                                                       
 -- C のマクロ: PyMem_DEL (ptr)                        *note PyMem_Free(): 17fa.
                                                       

バージョン 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.21.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: 595c. section.

The *note default object allocator: 2348. uses the *note pymalloc memory
allocator: 3e1.  In the *note free-threaded: 48e. build, the default is
the *note mimalloc memory allocator: 234a. instead.

     警告: There must be an *note attached thread state: 1ac. when using
     these functions.

 -- C の関数: void *PyObject_Malloc (size_t n)
     ' 次に属します: *note Stable ABI: 961.'  'n' バイトを割り当て、その
     メモリを指す void* 型のポインタを返します。要求が失敗した場合
     ‘NULL’ を返します。

     0バイトを要求すると、 ‘PyObject_Malloc(1)’ が呼ばれたときと同じよう
     に、可能なら ‘NULL’ でないユニークなポインタを返します。 確保された
     メモリーにはいかなる初期化も行われません。

 -- C の関数: void *PyObject_Calloc (size_t nelem, size_t elsize)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'  各
     要素が 'elsize' バイトの要素 'nelem' 個分のメモリーを確保し、そのメ
     モリーを指す void* 型のポインタを返します。アロケートに失敗した場合
     は ‘NULL’ を返します。確保されたメモリー領域はゼロで初期化されます
     。

     要素数か要素のサイズが0バイトの要求に対しては、可能なら
     ‘PyObject_Calloc(1, 1)’ が呼ばれたのと同じように、ユニークな ‘NULL’
     でないポインタを返します。

     Added in version 3.5.

 -- C の関数: void *PyObject_Realloc (void *p, size_t n)
     ' 次に属します: *note Stable ABI: 961.'  'p' が指すメモリブロックを
     'n' バイトにリサイズします。古いサイズと新しいサイズの小さい方まで
     の内容は変更されません。

     'p' が ‘NULL’ の場合呼び出しは ‘PyObject_Malloc(n)’ と等価です。そ
     うでなく、 'n' がゼロに等しい場合、メモリブロックはリサイズされます
     が解放されません。返されたポインタは非 ‘NULL’ です。

     'p' が ‘NULL’ でない限り、'p' はそれより前の *note
     PyObject_Malloc(): 102a, *note PyObject_Realloc(): 17fb. または
     *note PyObject_Calloc(): 1262. の呼び出しにより返されなければなりま
     せん。

     要求が失敗した場合 *note PyObject_Realloc(): 17fb. は ‘NULL’ を返し
     、 'p' は前のメモリエリアをさす有効なポインタのままです。

 -- C の関数: void PyObject_Free (void *p)
     ' 次に属します: *note Stable ABI: 961.'  'p' が指すメモリブロックを
     解放します。 'p' は以前呼び出した *note PyObject_Malloc(): 102a.、
     *note PyObject_Realloc(): 17fb.、または *note PyObject_Calloc():
     1262. の返した値でなければなりません。それ以外の場合や
     ‘PyObject_Free(p)’ を呼び出した後だった場合、未定義の動作になります
     。

     'p' が ‘NULL’ の場合何もしません。

     Do not call this directly to free an object's memory; call the
     type's *note tp_free: 51f4. slot instead.

     Do not use this for memory allocated by *note PyObject_GC_New: e6c.
     or *note PyObject_GC_NewVar: e6d.; use *note PyObject_GC_Del():
     18bb. instead.

     参考
     ....

        * *note PyObject_GC_Del(): 18bb. is the equivalent of this
          function for memory allocated by types that support garbage
          collection.

        * *note PyObject_Malloc(): 102a.

        * *note PyObject_Realloc(): 17fb.

        * *note PyObject_Calloc(): 1262.

        * *note PyObject_New: d51.

        * *note PyObject_NewVar: d52.

        * *note PyType_GenericAlloc(): e34.

        * *note tp_free: 51f4.


File: python.info,  Node: Default Memory Allocators,  Next: メモリアロケータをカスタマイズする,  Prev: オブジェクトアロケータ,  Up: メモリ管理

7.21.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: 1026. environment variable.

   * ‘malloc’: system allocators from the standard C library, C
     functions: ‘malloc()’, ‘calloc()’, ‘realloc()’ and ‘free()’.

   * ‘pymalloc’: *note pymalloc memory allocator: 3e1.

   * ‘mimalloc’: *note mimalloc memory allocator: 234a.

   * "+ debug": with *note debug hooks on the Python memory allocators:
     234b.

   * "Debug build": *note Python build in debug mode: 3e3.


File: python.info,  Node: メモリアロケータをカスタマイズする,  Next: Debug hooks on the Python memory allocators,  Prev: Default Memory Allocators,  Up: メモリ管理

7.21.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: 127f. and a new ‘calloc’ field was
     added.

 -- C のデータ型: type PyMemAllocatorDomain

     アロケータドメインを同定するための列挙型です。ドメインは:

      -- C のマクロ: PYMEM_DOMAIN_RAW

          関数:

             * *note PyMem_RawMalloc(): 2ca.

             * *note PyMem_RawRealloc(): 82b.

             * *note PyMem_RawCalloc(): 82a.

             * *note PyMem_RawFree(): 82c.

      -- C のマクロ: PYMEM_DOMAIN_MEM

          関数:

             * *note PyMem_Malloc(): 1027,

             * *note PyMem_Realloc(): 13de.

             * *note PyMem_Calloc(): 1261.

             * *note PyMem_Free(): 17fa.

      -- C のマクロ: PYMEM_DOMAIN_OBJ

          関数:

             * *note PyObject_Malloc(): 102a.

             * *note PyObject_Realloc(): 17fb.

             * *note PyObject_Calloc(): 1262.

             * *note PyObject_Free(): 1028.

 -- C の関数: void PyMem_GetAllocator (PyMemAllocatorDomain domain,
          PyMemAllocatorEx *allocator)

     指定されたドメインのメモリブロックアロケータを取得します。

 -- C の関数: void PyMem_SetAllocator (PyMemAllocatorDomain domain,
          PyMemAllocatorEx *allocator)

     指定されたドメインのメモリブロックアロケータを設定します。

     新しいアロケータは、0バイトを要求されたときユニークな ‘NULL’ でない
     ポインタを返さなければなりません。

     For the *note PYMEM_DOMAIN_RAW: 2349. domain, the allocator must be
     thread-safe: a *note thread state: 1a90. is not *note attached:
     1ac. 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: 418.

     新しいアロケータがフックでない (1つ前のアロケータを呼び出さない) 場
     合、 *note PyMem_SetupDebugHooks(): 102c. 関数を呼び出して、新しい
     アロケータの上にデバッグフックを再度設置しなければなりません。

     See also *note PyPreConfig.allocator: 590c. and *note Preinitialize
     Python with PyPreConfig: 4528.

          警告: *note PyMem_SetAllocator(): 98f. does have the following
          contract:

             * It can be called after *note Py_PreInitialize(): 638. and
               before *note Py_InitializeFromConfig(): 611. 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: 1ac.).  See *note the section on allocator
               domains: 594b. for more information.

             * If called after Python has finish initializing (after
               *note Py_InitializeFromConfig(): 611. 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: 234b. to
     detect memory errors.


File: python.info,  Node: Debug hooks on the Python memory allocators,  Next: pymalloc アロケータ,  Prev: メモリアロケータをカスタマイズする,  Up: メモリ管理

7.21.8 Debug hooks on the Python memory allocators
--------------------------------------------------

When *note Python is built in debug mode: 3e3, the *note
PyMem_SetupDebugHooks(): 102c. function is called at the *note Python
preinitialization: 4528. to setup debug hooks on Python memory
allocators to detect memory errors.

The *note PYTHONMALLOC: 1026. environment variable can be used to
install debug hooks on a Python compiled in release mode (ex:
‘PYTHONMALLOC=debug’).

The *note PyMem_SetupDebugHooks(): 102c. function can be used to set
debug hooks after calling *note PyMem_SetAllocator(): 98f.

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(): 1028. is called on a memory block allocated by
     *note PyMem_Malloc(): 1027.

   - 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: 1ac. when
     allocator functions of *note PYMEM_DOMAIN_OBJ: 1029. (ex: *note
     PyObject_Malloc(): 102a.) and *note PYMEM_DOMAIN_MEM: 102b. (ex:
     *note PyMem_Malloc(): 1027.) domains are called.

On error, the debug hooks use the *note tracemalloc: 108. 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: 2349.

        * ‘'m'’ for *note PYMEM_DOMAIN_MEM: 102b.

        * ‘'o'’ for *note PYMEM_DOMAIN_OBJ: 1029.

‘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(): 102c. function
now also works on Python compiled in release mode.  On error, the debug
hooks now use *note tracemalloc: 108. to get the traceback where a
memory block was allocated.  The debug hooks now also check if there is
an *note attached thread state: 1ac. when functions of *note
PYMEM_DOMAIN_OBJ: 1029. and *note PYMEM_DOMAIN_MEM: 102b. 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.21.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.  When Python is configured with *note
-with-pymalloc-hugepages: 3e0, the arena size on 64-bit platforms is
increased to 2 MiB to match the huge page size, and arena allocation
will attempt to use huge pages (‘MAP_HUGETLB’ on Linux,
‘MEM_LARGE_PAGES’ on Windows) with automatic fallback to regular pages.
It falls back to *note PyMem_RawMalloc(): 2ca. and *note
PyMem_RawRealloc(): 82b. for allocations larger than 512 bytes.

'pymalloc' is the *note default allocator: 2348. of the *note
PYMEM_DOMAIN_MEM: 102b. (ex: *note PyMem_Malloc(): 1027.) and *note
PYMEM_DOMAIN_OBJ: 1029. (ex: *note PyObject_Malloc(): 102a.) 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: 23ac. option.  It can also be disabled at runtime
using the *note PYTHONMALLOC: 1026. environment variable (ex:
‘PYTHONMALLOC=malloc’).

Typically, it makes sense to disable the pymalloc allocator when
building Python with AddressSanitizer (*note -with-address-sanitizer:
23b5.) which helps uncover low level bugs within the C code.

* Menu:

* pymalloc アリーナアロケータのカスタマイズ::


File: python.info,  Node: pymalloc アリーナアロケータのカスタマイズ,  Up: pymalloc アロケータ

7.21.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.21.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: 3e1, which is optimized for small objects (512
bytes or fewer), mimalloc handles allocations of any size.

In the *note free-threaded: 48e. build, mimalloc is the default and
'required' allocator for the *note PYMEM_DOMAIN_MEM: 102b. and *note
PYMEM_DOMAIN_OBJ: 1029. 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: 1026.‘=mimalloc’ (or ‘mimalloc_debug’ to include *note
debug hooks: 234b.).  It can be disabled at build time using the *note
-without-mimalloc: 23ab. configure option, but this option cannot be
combined with *note -disable-gil: 6ab.

   ---------- Footnotes ----------

   (1) https://github.com/microsoft/mimalloc/


File: python.info,  Node: tracemalloc C API,  Next: 使用例<56>,  Prev: The mimalloc allocator,  Up: メモリ管理

7.21.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: 108.
     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: 108.
     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.21.12 使用例
--------------

最初に述べた関数セットを使って、 *note 概要: 5948. 節の例を 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: d51, *note PyObject_NewVar: d52. and *note
PyObject_Free(): 1028.

これらの関数については、次章の C による新しいオブジェクト型の定義や実装
に関する記述の中で説明します。


File: python.info,  Node: オブジェクト実装サポート object implementation support,  Next: API と ABI のバージョニング,  Prev: メモリ管理,  Up: Python/C API reference manual

7.22 オブジェクト実装サポート (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.22.1 Allocating objects on the heap
-------------------------------------

 -- C の関数: *note PyObject: 1a6. *_PyObject_New (PyTypeObject *type)
     '戻り値: 新しい参照。'

 -- C の関数: *note PyVarObject: 493d. *_PyObject_NewVar (PyTypeObject
          *type, Py_ssize_t size)
     '戻り値: 新しい参照。'

 -- C の関数: *note PyObject: 1a6. *PyObject_Init (PyObject *op,
          PyTypeObject *type)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'
     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__(): 306. method (*note
     tp_init: 988. 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: 51f5. where possible.  For implementing ‘tp_alloc’
     for your type, prefer *note PyType_GenericAlloc(): e34. or *note
     PyObject_New(): d51.

          注釈: This function only initializes the object's memory
          corresponding to the initial *note PyObject: 1a6. structure.
          It does not zero the rest.

 -- C の関数: *note PyVarObject: 493d. *PyObject_InitVar (PyVarObject
          *op, PyTypeObject *type, Py_ssize_t size)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961.'  *note
     PyObject_Init(): e33. の全ての処理を行い、可変サイズオブジェクトの
     場合には長さ情報も初期化します。

          注釈: 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(): 102a. to allocate memory and initializing it
     like *note PyObject_Init(): e33.  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: 51f5. slot instead.

     When populating a type's *note tp_alloc: 51f5. slot, *note
     PyType_GenericAlloc(): e34. is preferred over a custom function
     that simply calls this macro.

     This macro does not call *note tp_alloc: 51f5, *note tp_new: 986.
     (*note __new__(): 987.), or *note tp_init: 988. (*note __init__():
     306.).

     This cannot be used for objects with *note Py_TPFLAGS_HAVE_GC: 3a6.
     set in *note tp_flags: 1e87.; use *note PyObject_GC_New: e6c.
     instead.

     Memory allocated by this macro must be freed with *note
     PyObject_Free(): 1028. (usually called via the object's *note
     tp_free: 51f4. 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: 988.  To
          construct a fully initialized object, call 'typeobj' instead.
          For example:

               PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);

     参考
     ....

        * *note PyObject_Free(): 1028.

        * *note PyObject_GC_New: e6c.

        * *note PyType_GenericAlloc(): e34.

        * *note tp_alloc: 51f5.

 -- C のマクロ: PyObject_NewVar (TYPE, typeobj, size)

     Like *note PyObject_New: d51. except:

        * It allocates enough memory for the 'TYPE' structure plus
          'size' (‘Py_ssize_t’) fields of the size given by the *note
          tp_itemsize: 25cf. field of 'typeobj'.

        * The memory is initialized like *note PyObject_InitVar(): 1f53.

     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: 51f5. slot instead.

     When populating a type's *note tp_alloc: 51f5. slot, *note
     PyType_GenericAlloc(): e34. is preferred over a custom function
     that simply calls this macro.

     This cannot be used for objects with *note Py_TPFLAGS_HAVE_GC: 3a6.
     set in *note tp_flags: 1e87.; use *note PyObject_GC_NewVar: e6d.
     instead.

     Memory allocated by this function must be freed with *note
     PyObject_Free(): 1028. (usually called via the object's *note
     tp_free: 51f4. 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: 988.  To
          construct a fully initialized object, call 'typeobj' instead.
          For example:

               PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);

     参考
     ....

        * *note PyObject_Free(): 1028.

        * *note PyObject_GC_NewVar: e6d.

        * *note PyType_GenericAlloc(): e34.

        * *note tp_alloc: 51f5.

 -- C 変数: *note PyObject: 1a6. _Py_NoneStruct

     Python からは ‘None’ に見えるオブジェクトです。この値へのアクセスは
     、このオブジェクトへのポインタを評価する *note Py_None: 5615. マク
     ロを使わなければなりません。

参考
....

*note モジュールオブジェクト (module object): 5575.

     拡張モジュールのアロケートと生成。

* Menu:

* Soft-deprecated aliases::


File: python.info,  Node: Soft-deprecated aliases,  Up: Allocating objects on the heap

7.22.1.1 Soft-deprecated aliases
................................

*note Soft deprecated: 1b2. since version 3.15.

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: d51.
                                                       
                                                       
 -- C のマクロ: PyObject_NEW_VAR (type, typeobj, n)    *note PyObject_NewVar: d52.
                                                       
                                                       
 -- C のマクロ: PyObject_INIT (op, typeobj)            *note PyObject_Init(): e33.
                                                       
                                                       
 -- C のマクロ: PyObject_INIT_VAR (op, typeobj, n)     *note PyObject_InitVar(): 1f53.
                                                       
                                                       
 -- C のマクロ: PyObject_MALLOC (n)                    *note PyObject_Malloc(): 102a.
                                                       
                                                       
 -- C のマクロ: PyObject_REALLOC (p, n)                *note PyObject_Realloc(): 17fb.
                                                       
                                                       
 -- C のマクロ: PyObject_FREE (p)                      *note PyObject_Free(): 1028.
                                                       
                                                       
 -- C のマクロ: PyObject_DEL (p)                       *note PyObject_Free(): 1028.
                                                       
                                                       
 -- C のマクロ: PyObject_Del (p)                       *note PyObject_Free(): 1028.
                                                       


File: python.info,  Node: Object Life Cycle,  Next: 共通のオブジェクト構造体 common object structure,  Prev: Allocating objects on the heap,  Up: オブジェクト実装サポート object implementation support

7.22.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: d59. for details about a
particular slot.

* Menu:

* Life Events::
* Cyclic Isolate Destruction::
* 関数: 関数<16>.


File: python.info,  Node: Life Events,  Next: Cyclic Isolate Destruction,  Up: Object Life Cycle

7.22.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: 986. is called to create a new object.

       2. *note tp_alloc: 51f5. is directly called by *note tp_new: 986.
          to allocate the memory for the new object.

       3. *note tp_init: 988. 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__(): 987.

   * 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: e70. function.  Python does 'not' finalize an
          object when the last reference to it is deleted; use *note
          PyObject_CallFinalizerFromDealloc(): 359. to ensure that
          ‘tp_finalize’ is always called.

       2. If the object is marked as finalized, *note tp_clear: 5206.
          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: 51e2. is called to destroy the object.  To
          avoid code duplication, ‘tp_dealloc’ typically calls into
          *note tp_clear: 5206. to free up the object's references.

       4. When *note tp_dealloc: 51e2. finishes object destruction, it
          directly calls *note tp_free: 51f4. (usually set to *note
          PyObject_Free(): 1028. or *note PyObject_GC_Del(): 18bb.
          automatically as appropriate for the type) to deallocate the
          memory.

   * The *note tp_finalize: e70. 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:
     5206. and *note tp_dealloc: 51e2. 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:
     3a6. 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: 51e2. can optionally call *note tp_finalize: e70.
     via *note PyObject_CallFinalizerFromDealloc(): 359. 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: 597d. and
     either *note tp_clear: 5206. fails to break the reference cycle or
     the cyclic isolate is not detected (perhaps *note gc.disable():
     4cfc. was called, or the *note Py_TPFLAGS_HAVE_GC: 3a6. flag was
     erroneously omitted in one of the involved types), the objects
     remain indefinitely uncollectable (they "leak").  See *note
     gc.garbage: 157f.

If the object is marked as supporting garbage collection (the *note
Py_TPFLAGS_HAVE_GC: 3a6. flag is set in *note tp_flags: 1e87.), the
following events are also possible:

   * The garbage collector occasionally calls *note tp_traverse: 373. to
     identify *note cyclic isolates: 597d.

   * When the garbage collector discovers a *note cyclic isolate: 597d,
     it finalizes one of the objects in the group by marking it as
     'finalized' and calling its *note tp_finalize: e70. 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: e70. is permitted to resurrect the object by
     adding a reference from outside the *note cyclic isolate: 597d.
     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: 597d.
     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: 5206. 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: 関数<16>,  Prev: Life Events,  Up: Object Life Cycle

7.22.2.2 Cyclic Isolate Destruction
...................................

Listed below are the stages of life of a hypothetical *note cyclic
isolate: 597d. 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:
e70.).

  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: 418. 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: 157f.).  It is a
     bug if a cyclic isolate reaches this stage--it means the *note
     tp_clear: 5206. methods of the participating objects have failed to
     break the reference cycle as required.

If *note tp_clear: 5206. 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: 51e2. 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: 5206. (if called) and concludes with *note tp_dealloc:
51e2.

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: e70. and *note tp_clear: 5206.
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: 関数<16>,  Prev: Cyclic Isolate Destruction,  Up: Object Life Cycle

7.22.2.3 関数
.............

To allocate and free memory, see *note Allocating objects on the heap:
596c.

 -- C の関数: void PyObject_CallFinalizer (PyObject *op)

     Finalizes the object as described in *note tp_finalize: e70.  Call
     this function (or *note PyObject_CallFinalizerFromDealloc(): 359.)
     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: 3a6. flag is set); this may change in
     the future.

     Added in version 3.4.

 -- C の関数: int PyObject_CallFinalizerFromDealloc (PyObject *op)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Same as *note PyObject_CallFinalizer(): 5980. but meant to be
     called at the beginning of the object's destructor (*note
     tp_dealloc: 51e2.).  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: 51e2. for example code.


File: python.info,  Node: 共通のオブジェクト構造体 common object structure,  Next: Type Object Structures,  Prev: Object Life Cycle,  Up: オブジェクト実装サポート object implementation support

7.22.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.22.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: 1a6. and *note PyVarObject: 493d.
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: 553f.

 -- C のデータ型: type PyObject
     ' 次に属します: *note Stable ABI: 961. (see below).'  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: 1a6, but every
     pointer to a Python object can be cast to a *note PyObject: 1a6.*.

     The members must not be accessed directly; instead use macros such
     as *note Py_REFCNT: 552. and *note Py_TYPE: 5fc.

     In the *note Stable ABI: 1a2. for Free-Threaded Builds (‘abi3t’),
     this struct is opaque; its size and layout may change between
     Python versions.  In Stable ABI for non-free-threaded builds
     (‘abi3’), the ‘ob_refcnt’ and ‘ob_type’ fields are available, but
     using them directly is discouraged.

      -- C のメンバ変数: *note Py_ssize_t: e28. ob_refcnt
          ' 次に属します: *note Stable ABI: 961.'  The object's
          reference count, as returned by *note Py_REFCNT: 552.  Do not
          use this field directly; instead use functions and macros such
          as ‘Py_REFCNT’, *note Py_INCREF(): 979. and *note Py_DecRef():
          547b.

          The field type may be different from ‘Py_ssize_t’, depending
          on build configuration and platform.

      -- C のメンバ変数: *note PyTypeObject: e6f. *ob_type
          ' 次に属します: *note Stable ABI: 961.'  The object's type.
          Do not use this field directly; use *note Py_TYPE: 5fc. and
          *note Py_SET_TYPE(): b65. instead.

      -- C のメンバ変数: *note PyMutex: 699. ob_mutex

          A *note per-object lock: 5987, present only in the *note
          free-threaded: 48e. build (when *note Py_GIL_DISABLED: 193f.
          is defined).

          This field is 'reserved for use by the critical section API'
          (*note Py_BEGIN_CRITICAL_SECTION: 5478. / *note
          Py_END_CRITICAL_SECTION: 547c.).  Do 'not' lock it directly
          with ‘PyMutex_Lock’; doing so can cause deadlocks.  If you
          need your own lock, add a separate *note PyMutex: 699. field
          to your object struct.

          Added in version 3.13.

 -- C のデータ型: type PyVarObject
     ' 次に属します: *note Stable ABI: 961. (see below).'  An extension
     of *note PyObject: 1a6. that adds the *note ob_size: 546b. 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: b66, *note Py_REFCNT:
     552. and *note Py_TYPE: 5fc.

     In the *note Stable ABI: 1a2. for Free-Threaded Builds (‘abi3t’),
     this struct is opaque; its size and layout may change between
     Python versions.  In Stable ABI for non-free-threaded builds
     (‘abi3’), the ‘ob_base’ and ‘ob_size’ fields are available, but
     using them directly is discouraged.

      -- C のメンバ変数: *note PyObject: 1a6. ob_base
          ' 次に属します: *note Stable ABI: 961.'  Common object header.
          Typically, this field is not accessed directly; instead
          ‘PyVarObject’ can be cast to *note PyObject: 1a6.

      -- C のメンバ変数: *note Py_ssize_t: e28. ob_size
          ' 次に属します: *note Stable ABI: 961.'  A size field, whose
          contents should be considered an object's internal
          implementation detail.

          Do not use this field directly; use *note Py_SIZE: b66.
          instead.

          Object creation functions such as *note PyObject_NewVar():
          d52. 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: b67.

          To get an object's publicly exposed length, as returned by the
          Python function *note len(): a24, use *note PyObject_Length():
          53db. instead.

 -- C のマクロ: PyObject_HEAD

     可変な長さを持たないオブジェクトを表現する新しい型を宣言するときに
     使うマクロです。 PyObject_HEAD マクロは次のように展開されます:

          PyObject ob_base;

     上にある *note PyObject: 1a6. のドキュメントを参照してください。

 -- C のマクロ: PyObject_VAR_HEAD

     インスタンスごとに異なる長さを持つオブジェクトを表現する新しい型を
     宣言するときに使うマクロです。 PyObject_VAR_HEAD マクロは次のように
     展開されます:

          PyVarObject ob_base;

     上にある *note PyVarObject: 493d. のドキュメントを参照してください
     。

 -- C 変数: *note PyTypeObject: e6f. PyBaseObject_Type
     ' 次に属します: *note Stable ABI: 961.'  The base class of all
     other objects, the same as *note object: e51. in Python.

 -- C の関数: int Py_Is (PyObject *x, PyObject *y)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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: 961. (バージョン 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: 961. (バージョン 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: 961. (バージョン 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: e6f. *Py_TYPE (PyObject *o)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.14 より).'  Get the type of the Python object 'o'.

     The returned reference is *note borrowed: 60a. from 'o'.  Do not
     release it with *note Py_DECREF(): 97a. or similar.

     バージョン 3.11 で変更: *note Py_TYPE(): 5fc. is changed to an
     inline static function.  The parameter type is no longer const
     *note PyObject: 1a6.*.

 -- C の関数: int Py_IS_TYPE (PyObject *o, PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     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__: 1865. using *note
     PyObject_SetAttrString(): 1a8c. or similar.

     Note that assigning an incompatible type can lead to undefined
     behavior.

     If 'type' is a *note heap type: d33, 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: e28. Py_SIZE (PyVarObject *o)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Get the *note ob_size: 546b. field of 'o'.

     バージョン 3.11 で変更: *note Py_SIZE(): b66. is changed to an
     inline static function.  The parameter type is no longer const
     *note PyVarObject: 493d.*.

 -- C の関数: void Py_SET_SIZE (PyVarObject *o, Py_ssize_t size)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     Set the *note ob_size: 546b. field of 'o' to 'size'.

     Added in version 3.9.

 -- C のマクロ: PyObject_HEAD_INIT (type)

     新しい *note PyObject: 1a6. 型のための初期値に展開するマクロです。
     このマクロは次のように展開されます。

          _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: 493d. type, including the *note ob_size: 546b.
     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.22.3.2 Implementing functions and methods
...........................................

 -- C のデータ型: type PyCFunction
     ' 次に属します: *note Stable ABI: 961.'  Type of the functions used
     to implement most Python callables in C. Functions of this type
     take two *note PyObject: 1a6.* 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: 961.'  Type of the functions used
     to implement Python callables in C with signature *note
     METH_VARARGS | METH_KEYWORDS: 598c.  The function signature is:

          PyObject *PyCFunctionWithKeywords(PyObject *self,
                                            PyObject *args,
                                            PyObject *kwargs);

 -- C のデータ型: type PyCFunctionFast
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Type of the functions used to implement Python callables in C with
     signature *note METH_FASTCALL: 353.  The function signature is:

          PyObject *PyCFunctionFast(PyObject *self,
                                    PyObject *const *args,
                                    Py_ssize_t nargs);

 -- C のデータ型: type PyCFunctionFastWithKeywords
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.13 より).'
     Type of the functions used to implement Python callables in C with
     signature *note METH_FASTCALL | METH_KEYWORDS: 598d.  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: 1c30.
     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: 961. (すべてのメンバーを含む).'  拡
     張型のメソッドを記述する際に用いる構造体です。この構造体には 4 つの
     フィールドがあります:

      -- C のメンバ変数: const char *ml_name

          Name of the method.

          A ‘NULL’ 'ml_name' marks the end of a ‘PyMethodDef’ array.

      -- C のメンバ変数: *note PyCFunction: 1830. 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: 598e. is a C function pointer.  The functions may be
of different types, but they always return *note PyObject: 1a6.*.  If
the function is not of the *note PyCFunction: 1830, 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: 51ce. 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: 961.'  *note PyCFunction: 1830. 型
     のメソッドで典型的に使われる呼び出し規約です。関数は *note
     PyObject: 1a6.* 型の引数値を二つ要求します。最初の引数はメソッドの
     'self' オブジェクトです; モジュール関数の場合、これはモジュールオブ
     ジェクトです。第二のパラメタ (よく 'args' と呼ばれます) は、全ての
     引数を表現するタプルオブジェクトです。パラメタは通常、 *note
     PyArg_ParseTuple(): 3b9. や *note PyArg_UnpackTuple(): 18be. で処理
     されます。

 -- C のマクロ: METH_KEYWORDS

     Can only be used in certain combinations with other flags: *note
     METH_VARARGS | METH_KEYWORDS: 598c, *note METH_FASTCALL |
     METH_KEYWORDS: 598d. and *note METH_METHOD | METH_FASTCALL |
     METH_KEYWORDS: 1c30.

*note METH_VARARGS: 18c0. | *note METH_KEYWORDS: 51d5.

     Methods with these flags must be of type *note
     PyCFunctionWithKeywords: 52bf.  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(): 81e.

 -- C のマクロ: METH_FASTCALL
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.7 より).'
     Fast calling convention supporting only positional arguments.  The
     methods have the type *note PyCFunctionFast: 52bd.  The first
     parameter is 'self', the second parameter is a C array of *note
     PyObject: 1a6.* 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: 1a2.

*note METH_FASTCALL: 353. | *note METH_KEYWORDS: 51d5.

     Extension of *note METH_FASTCALL: 353. supporting also keyword
     arguments, with methods of type *note PyCFunctionFastWithKeywords:
     52be.  Keyword arguments are passed the same way as in the *note
     vectorcall protocol: 960.: there is an additional fourth *note
     PyObject: 1a6.* 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: 961. (バージョン 3.7 より).'  Can
     only be used in the combination with other flags: *note METH_METHOD
     | METH_FASTCALL | METH_KEYWORDS: 1c30.

*note METH_METHOD: d3d. | *note METH_FASTCALL: 353. | *note METH_KEYWORDS: 51d5.

     Extension of *note METH_FASTCALL | METH_KEYWORDS: 598d. 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: b4b, 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: 961.'  Methods without parameters
     don't need to check whether arguments are given if they are listed
     with the *note METH_NOARGS: 188c. flag.  They need to be of type
     *note PyCFunction: 1830.  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: 1caf. can be used to prevent a compiler
     warning.

 -- C のマクロ: METH_O
     ' 次に属します: *note Stable ABI: 961.'  Methods with a single
     object argument can be listed with the *note METH_O: 18bf. flag,
     instead of invoking *note PyArg_ParseTuple(): 3b9. with a ‘"O"’
     argument.  They have the type *note PyCFunction: 1830, with the
     'self' parameter, and a *note PyObject: 1a6.* 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: 961.'

     メソッドの最初の引数には、型のインスタンスではなく型オブジェクトが
     渡されます。このフラグは組み込み関数 *note classmethod(): 6a0. を使
     って生成するのと同じ 'クラスメソッド (class method)' を生成するため
     に使われます。

 -- C のマクロ: METH_STATIC
     ' 次に属します: *note Stable ABI: 961.'

     メソッドの最初の引数には、型のインスタンスではなく ‘NULL’ が渡され
     ます。このフラグは、 *note staticmethod(): 66d. を使って生成するの
     と同じ '静的メソッド (static method)' を生成するために使われます。

もう一つの定数は、あるメソッドを同名の別のメソッド定義と置き換えるかどう
かを制御します。

 -- C のマクロ: METH_COEXIST
     ' 次に属します: *note Stable ABI: 961.'  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__(): 1772. 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: e6f. PyCMethod_Type

     The type object corresponding to Python C method objects.  This is
     available as *note types.BuiltinMethodType: 2c13. in the Python
     layer.

 -- C の関数: int PyCMethod_Check (PyObject *op)

     Return true if 'op' is an instance of the *note PyCMethod_Type:
     5990. type or a subtype of it.  This function always succeeds.

 -- C の関数: int PyCMethod_CheckExact (PyObject *op)

     This is the same as *note PyCMethod_Check(): 5991, but does not
     account for subtypes.

 -- C の関数: *note PyObject: 1a6. *PyCMethod_New (PyMethodDef *ml,
          PyObject *self, PyObject *module, PyTypeObject *cls)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.9 より).'  Turn 'ml' into a Python *note callable: 2fba.
     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: 2fba. 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: a6a. or
     ‘NULL’.

     参考
     ....

     *note function.__module__: 2559.

     The 'cls' parameter will be passed as the 'defining_class' argument
     to the C function.  Must be set if *note METH_METHOD: d3d. is set
     on ‘ml->ml_flags’.

     Added in version 3.9.

 -- C 変数: *note PyTypeObject: e6f. PyCFunction_Type
     ' 次に属します: *note Stable ABI: 961.'  The type object
     corresponding to Python C function objects.  This is available as
     *note types.BuiltinFunctionType: 2c12. in the Python layer.

 -- C の関数: int PyCFunction_Check (PyObject *op)

     Return true if 'op' is an instance of the *note PyCFunction_Type:
     52c3. type or a subtype of it.  This function always succeeds.

 -- C の関数: int PyCFunction_CheckExact (PyObject *op)

     This is the same as *note PyCFunction_Check(): 5993, but does not
     account for subtypes.

 -- C の関数: *note PyObject: 1a6. *PyCFunction_NewEx (PyMethodDef *ml,
          PyObject *self, PyObject *module)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961.'
     Equivalent to ‘PyCMethod_New(ml, self, module, NULL)’.

 -- C の関数: *note PyObject: 1a6. *PyCFunction_New (PyMethodDef *ml,
          PyObject *self)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 961. (バー
     ジョン 3.4 より).'  Equivalent to ‘PyCMethod_New(ml, self, NULL,
     NULL)’.

 -- C の関数: int PyCFunction_GetFlags (PyObject *func)
     ' 次に属します: *note Stable ABI: 961.'  Get the function's flags
     on 'func' as they were passed to *note ml_flags: 51ce.

     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(): 52c0, but without
     error or type checking.

 -- C の関数: *note PyCFunction: 1830. PyCFunction_GetFunction (PyObject
          *func)
     ' 次に属します: *note Stable ABI: 961.'  Get the function pointer
     on 'func' as it was passed to *note ml_meth: 598e.

     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(): 52c1, but
     without error or type checking.

 -- C の関数: *note PyObject: 1a6. *PyCFunction_GetSelf (PyObject *func)
     ' 次に属します: *note Stable ABI: 961.'  Get the "self" object on
     'func'.  This is the object that would be passed to the first
     argument of a *note PyCFunction: 1830.  For C function objects
     created through a *note PyMethodDef: 188f. on a *note PyModuleDef:
     d49, 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: 60a. to the
     "self" object on success, and ‘NULL’ with an exception set on
     failure.

 -- C の関数: *note PyObject: 1a6. *PyCFunction_GET_SELF (PyObject
          *func)

     This is the same as *note PyCFunction_GetSelf(): 52c2, 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.22.3.3 Accessing attributes of extension types
................................................

 -- C のデータ型: type PyMemberDef
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む).'
     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: 51f6. 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: 1c18. for the possible values.

      -- C のメンバ変数: *note Py_ssize_t: e28. 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: 599b, 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: 1db1.

     By default (when *note flags: 520f. is ‘0’), members allow both
     read and write access.  Use the *note Py_READONLY: 995. flag for
     read-only access.  Certain types, like *note Py_T_STRING: 5495,
     imply ‘Py_READONLY’.  Only *note Py_T_OBJECT_EX: 998. (and legacy
     *note T_OBJECT: 997.) members can be deleted.  For heap-allocated
     types (created using *note PyType_FromSpec(): 396. or similar),
     ‘PyMemberDef’ may contain a definition for the special member
     ‘"__vectorcalloffset__"’, corresponding to *note
     tp_vectorcall_offset: 5607. 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: 565a. and *note
     tp_weaklistoffset: d54. can be defined similarly using
     ‘"__dictoffset__"’ and ‘"__weaklistoffset__"’ members, but
     extensions are strongly encouraged to use *note
     Py_TPFLAGS_MANAGED_DICT: 3a4. and *note Py_TPFLAGS_MANAGED_WEAKREF:
     3a5. instead.

     バージョン 3.12 で変更: ‘PyMemberDef’ is always available.
     Previously, it required including ‘"structmember.h"’.

     バージョン 3.14 で変更: *note Py_RELATIVE_OFFSET: 95e. is now
     allowed for ‘"__vectorcalloffset__"’, ‘"__dictoffset__"’ and
     ‘"__weaklistoffset__"’.

 -- C の関数: *note PyObject: 1a6. *PyMember_GetOne (const char
          *obj_addr, struct PyMemberDef *m)
     ' 次に属します: *note Stable ABI: 961.'  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: 961.'  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.22.3.4 Member flags
.....................

The following flags can be used with *note PyMemberDef.flags: 520f.:

 -- C のマクロ: Py_READONLY
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     Not writable.

 -- C のマクロ: Py_AUDIT_READ
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     Emit an ‘object.__getattr__’ *note audit event: 1e29. before
     reading.

 -- C のマクロ: Py_RELATIVE_OFFSET
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'
     Indicates that the *note offset: 599a. 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: 54ed. *note
     slot: 542a. when creating a class using negative *note basicsize:
     1a4.  It is mandatory in that case.  When setting *note tp_members:
     51f6. from the slot during class creation, Python clears the flag
     and sets *note PyMemberDef.offset: 599a. 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: 996.; ‘WRITE_RESTRICTED’ does nothing.

バージョン 3.12 で変更: The ‘READONLY’ macro was renamed to *note
Py_READONLY: 995.  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.22.3.5 Member types
.....................

*note PyMemberDef.type: 520e. 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: 29c. or *note
ValueError: 15a. is raised.

Unless marked (D), attributes defined this way cannot be deleted using
e.g.  *note del: 1d3c. or *note delattr(): 1b5.

マクロ名                             C の型                            Python の型
                                                                       
--------------------------------------------------------------------------------------------------
                                                                       
 -- C のマクロ: Py_T_BYTE            char                              *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_SHORT           short                             *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_INT             int                               *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_LONG            long                              *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_LONGLONG        long long                         *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_UBYTE           unsigned char                     *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_UINT            unsigned int                      *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_USHORT          unsigned short                    *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_ULONG           unsigned long                     *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_ULONGLONG       unsigned long long                *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_PYSSIZET        *note Py_ssize_t: e28.            *note int: 32e.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_FLOAT           float                             *note float: 32f.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_DOUBLE          double                            *note float: 32f.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_BOOL            char (written as 0 or 1)          *note bool: 5f6.
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_STRING          const char* (*)                   *note str: 1ea. (RO)
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ:                      const char[] (*)                  *note str: 1ea. (RO)
          Py_T_STRING_INPLACE                                          
     ' 次に属します:
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_CHAR            char (0-127)                      *note str: 1ea. (**)
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_OBJECT_EX       *note PyObject: 1a6.*             *note object: e51. (D)
     ' 次に属します:                                                   
     *note Stable ABI: 961. (バー
     ジョン 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: 995.

     (D): Can be deleted, in which case the pointer is set to ‘NULL’.
     Reading a ‘NULL’ pointer raises *note AttributeError: 1b4.

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: 995.


File: python.info,  Node: Defining Getters and Setters,  Prev: Member types,  Up: Accessing attributes of extension types

7.22.3.6 Defining Getters and Setters
.....................................

 -- C のデータ型: type PyGetSetDef
     ' 次に属します: *note Stable ABI: 961. (すべてのメンバーを含む).'  型
     のプロパティのようなアクセスを定義するための構造体です。 *note
     PyTypeObject.tp_getset: 51fb. スロットの説明も参照してください。

      -- C のメンバ変数: const char *name

          属性名

      -- C のメンバ変数: *note getter: 5500. get

          C function to get the attribute.

      -- C のメンバ変数: *note setter: 550e. 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: 1a6. *(*getter)(*note
          PyObject: 1a6.*, void*)
     ' 次に属します: *note Stable ABI: 961.'  The ‘get’ function takes
     one *note PyObject: 1a6.* parameter (the instance) and a user data
     pointer (the associated ‘closure’):

     成功または失敗時に ‘NULL’ と例外の集合にされたときは新しい参照を返
     します。

 -- C のデータ型: typedef int (*setter)(*note PyObject: 1a6.*, *note
          PyObject: 1a6.*, void*)
     ' 次に属します: *note Stable ABI: 961.'  ‘set’ functions take two
     *note PyObject: 1a6.* 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.22.4 Type Object Structures
-----------------------------

新スタイルの型を定義する構造体: *note PyTypeObject: e6f. 構造体は、おそ
らく Python オブジェクトシステムの中で最も重要な構造体の1つでしょう。型
オブジェクトは ‘PyObject_*’ 系や ‘PyType_*’ 系の関数で扱えますが、ほとん
どの Python アプリケーションにとって、さして面白みのある機能を提供しませ
ん。型オブジェクトはオブジェクトがどのように振舞うかを決める基盤ですから
、インタプリタ自体や新たな型を定義する拡張モジュールでは非常に重要な存在
です。

型オブジェクトは標準の型 (standard type) に比べるとかなり大きな構造体で
す。各型オブジェクトは多くの値を保持しており、そのほとんどは C 関数への
ポインタで、それぞれの関数はその型の機能の小さい部分を実装しています。こ
の節では、型オブジェクトの各フィールドについて詳細を説明します。各フィー
ルドは、構造体内で出現する順番に説明されています。

以下のクイックリファレンスに加えて、 *note 使用例: 59a8. 節では *note
PyTypeObject: e6f. の意味と使い方を一目で理解できる例を載せています。

* 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.22.4.1 クイックリファレンス
.............................

* Menu:

* tp スロット::
* sub-slots::
* スロットの定義型 (typedef): スロットの定義型 typedef.


File: python.info,  Node: tp スロット,  Next: sub-slots,  Up: クイックリファレンス

7.22.4.2 tp スロット
....................

PyTypeObject スロッ    *note 型: 59ac.        特殊メソッド/特殊属    Info
ト (1)                                        性                     (2)
                                                                     
---------------------------------------------------------------------------------------------
                                                                     
O                      T                      D                      I
                                                                     
                                                                                       
<R>                    const char *           __name__               X     X
*note tp_name: 1ec5.                                                       

*note tp_basicsize: d53.*note Py_ssize_t: e28.                       X     X           X
                                                                                       
                                                                                       
*note tp_itemsize: 25cf.*note Py_ssize_t: e28.                             X           X
                                                                                       
                                                                                       
*note tp_dealloc: 51e2.*note destructor: 54fb.                       X     X           X
                                                                                       
                                                                                       
*note tp_vectorcall_offset: 5607.*note Py_ssize_t: e28.                    X           X
                                                                                       
                                                                                       
(*note tp_getattr: 5211.)*note getattrfunc: 54fc.__getattribute__,                     G
                                              __getattr__                              
                                              
                                                                                       
(*note tp_setattr: 5212.)*note setattrfunc: 550c.__setattr__,                          G
                                              __delattr__                              
                                              
                                                                                       
*note tp_as_async: 1280.*note PyAsyncMethods: 5658.*note sub-slots: 59ad.              %
                       *                                                               
                       
                                                                                       
*note tp_repr: 5208.   *note reprfunc: 550a.  __repr__               X     X           X
                                                                                       
                                                                                       
*note tp_as_number: d57.*note PyNumberMethods: 17d6.*note sub-slots: 59ad.             %
                       *                                                               
                       
                                                                                       
*note tp_as_sequence: 59ae.*note PySequenceMethods: 5218.*note sub-slots: 59ad.        %
                       *                                                               
                       
                                                                                       
*note tp_as_mapping: 59af.*note PyMappingMethods: 5219.*note sub-slots: 59ad.          %
                       *                                                               
                       
                                                                                       
*note tp_hash: 521a.   *note hashfunc: 5501.  __hash__               X                 G
                                                                                       
                                                                                       
*note tp_call: 967.    *note ternaryfunc: 5511.__call__                    X           X
                                                                                       
                                                                                       
*note tp_str: 5209.    *note reprfunc: 550a.  __str__                X                 X
                                                                                       
                                                                                       
*note tp_getattro: 1c89.*note getattrofunc: 54fd.__getattribute__,   X     X           G
                                              __getattr__                              
                                              
                                                                                       
*note tp_setattro: 520c.*note setattrofunc: 550d.__setattr__,        X     X           G
                                              __delattr__                              
                                              
                                                                                       
*note tp_as_buffer: d55.*note PyBufferProcs: 565f.*note sub-slots: 59ad.               %
                       *                                                               
                       
                                                                                       
*note tp_flags: 1e87.  unsigned long                                 X     X           ?
                                                                                       
                                                                                       
*note tp_doc: 51f0.    const char *           __doc__                X     X
                                                                           
                                                                                       
*note tp_traverse: 373.*note traverseproc: 5512.                           X           G
                                                                                       
                                                                                       
*note tp_clear: 5206.  *note inquiry: 5503.                                X           G
                                                                                       
                                                                                       
*note tp_richcompare: 5214.*note richcmpfunc: 550b.__lt__, __le__,   X                 G
                                              __eq__, __ne__,                          
                                              __gt__, __ge__
                                              
                                                                                       
(*note tp_weaklistoffset: d54.)*note Py_ssize_t: e28.                      X           ?
                                                                                       
                                                                                       
*note tp_iter: 18a7.   *note getiterfunc: 54ff.__iter__                                X
                                                                                       
                                                                                       
*note tp_iternext: 18a8.*note iternextfunc: 5504.__next__                              X
                                                                                       
                                                                                       
*note tp_methods: 51f8.*note PyMethodDef: 188f.                      X     X
                       []                                                  
                       
                                                                                       
*note tp_members: 51f6.*note PyMemberDef: 95f.                             X
                       []                                                  
                       
                                                                                       
*note tp_getset: 51fb. *note PyGetSetDef: f7b.                       X     X
                       []                                                  
                       
                                                                                       
*note tp_base: 2585.   *note PyTypeObject: e6f.__base__                          X
                       *                                                         
                       
                                                                                       
*note tp_dict: 1cb1.   *note PyObject: 1a6.   __dict__                           ?
                       *                                                         
                       
                                                                                       
*note tp_descr_get: 57e3.*note descrgetfunc: 54f9.__get__                              X
                                                                                       
                                                                                       
*note tp_descr_set: 1ec9.*note descrsetfunc: 54fa.__set__, __delete__                  X
                                                                                       
                                                                                       
(*note tp_dictoffset: 565a.)*note Py_ssize_t: e28.                         X           ?
                                                                                       
                                                                                       
*note tp_init: 988.    *note initproc: 5502.  __init__               X     X           X
                                                                                       
                                                                                       
*note tp_alloc: 51f5.  *note allocfunc: 54f7.                        X           ?     ?
                                                                                       
                                                                                       
*note tp_new: 986.     *note newfunc: 5506.   __new__                X     X     ?     ?
                                                                                       
                                                                                       
*note tp_free: 51f4.   *note freefunc: 57ca.                         X     X     ?     ?
                                                                                       
                                                                                       
*note tp_is_gc: 59b0.  *note inquiry: 5503.                                X           X
                                                                                       
                                                                                       
<*note tp_bases: 59b1.>*note PyObject: 1a6.   __bases__                          ~
                       *                                                         
                       
                                                                                       
<*note tp_mro: 565c.>  *note PyObject: 1a6.   __mro__                            ~
                       *                                                         
                       
                                                                                       
[*note tp_cache: 565d.]*note PyObject: 1a6.
                       *
                       
                                                                                       
[*note tp_subclasses: 97c.]void *             __subclasses__
                                              
                                                                                       
[*note tp_weaklist: 565e.]*note PyObject: 1a6.
                       *
                       
                                                                                       
(*note tp_del: 59b2.)  *note destructor: 54fb.
                       
                                                                                       
[*note tp_version_tag: 59b3.]unsigned int
                       
                                                                                       
*note tp_finalize: e70.*note destructor: 54fb.__del__                                  X
                                                                                       
                                                                                       
*note tp_vectorcall: 1bb9.*note vectorcallfunc: 965.
                       
                                                                                       
[*note tp_watched: 59b4.]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: 52a9.

'"T"': set on *note PyType_Type: 95d.

'"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.22.4.3 sub-slots
..................

Slot                           *note 型: 59ac.       特殊メソッド
                                                     
----------------------------------------------------------------------
                                                     
*note am_await: 59b6.          *note unaryfunc: 5513.__await__
                                                     
                                                     
*note am_aiter: 59b7.          *note unaryfunc: 5513.__aiter__
                                                     
                                                     
*note am_anext: 59b8.          *note unaryfunc: 5513.__anext__
                                                     
                                                     
*note am_send: 59b9.           *note sendfunc: 59ba.
                               
                                                     
                                                     
*note nb_add: 5653.            *note binaryfunc: 54f8.__add__
                                                     __radd__
                                                     
                                                     
*note nb_inplace_add: 59bb.    *note binaryfunc: 54f8.__iadd__
                                                     
                                                     
*note nb_subtract: 59bc.       *note binaryfunc: 54f8.__sub__
                                                     __rsub__
                                                     
                                                     
*note nb_inplace_subtract: 59bd.*note binaryfunc: 54f8.__isub__
                                                     
                                                     
*note nb_multiply: 59be.       *note binaryfunc: 54f8.__mul__
                                                     __rmul__
                                                     
                                                     
*note nb_inplace_multiply: 59bf.*note binaryfunc: 54f8.__imul__
                                                     
                                                     
*note nb_remainder: 59c0.      *note binaryfunc: 54f8.__mod__
                                                     __rmod__
                                                     
                                                     
*note nb_inplace_remainder: 59c1.*note binaryfunc: 54f8.__imod__
                                                     
                                                     
*note nb_divmod: 59c2.         *note binaryfunc: 54f8.__divmod__
                                                     __rdivmod__
                                                     
                                                     
*note nb_power: 59c3.          *note ternaryfunc: 5511.__pow__
                                                     __rpow__
                                                     
                                                     
*note nb_inplace_power: 59c4.  *note ternaryfunc: 5511.__ipow__
                                                     
                                                     
*note nb_negative: 59c5.       *note unaryfunc: 5513.__neg__
                                                     
                                                     
*note nb_positive: 59c6.       *note unaryfunc: 5513.__pos__
                                                     
                                                     
*note nb_absolute: 59c7.       *note unaryfunc: 5513.__abs__
                                                     
                                                     
*note nb_bool: 59c8.           *note inquiry: 5503.  __bool__
                                                     
                                                     
*note nb_invert: 59c9.         *note unaryfunc: 5513.__invert__
                                                     
                                                     
*note nb_lshift: 59ca.         *note binaryfunc: 54f8.__lshift__
                                                     __rlshift__
                                                     
                                                     
*note nb_inplace_lshift: 59cb. *note binaryfunc: 54f8.__ilshift__
                                                     
                                                     
*note nb_rshift: 59cc.         *note binaryfunc: 54f8.__rshift__
                                                     __rrshift__
                                                     
                                                     
*note nb_inplace_rshift: 59cd. *note binaryfunc: 54f8.__irshift__
                                                     
                                                     
*note nb_and: 59ce.            *note binaryfunc: 54f8.__and__
                                                     __rand__
                                                     
                                                     
*note nb_inplace_and: 59cf.    *note binaryfunc: 54f8.__iand__
                                                     
                                                     
*note nb_xor: 59d0.            *note binaryfunc: 54f8.__xor__
                                                     __rxor__
                                                     
                                                     
*note nb_inplace_xor: 59d1.    *note binaryfunc: 54f8.__ixor__
                                                     
                                                     
*note nb_or: 59d2.             *note binaryfunc: 54f8.__or__ __ror__
                                                     
                                                     
*note nb_inplace_or: 59d3.     *note binaryfunc: 54f8.__ior__
                                                     
                                                     
*note nb_int: 59d4.            *note unaryfunc: 5513.__int__
                                                     
                                                     
*note nb_reserved: 59d5.       void *
                               
                                                     
*note nb_float: 59d6.          *note unaryfunc: 5513.__float__
                                                     
                                                     
*note nb_floor_divide: 59d7.   *note binaryfunc: 54f8.__floordiv__
                                                     
                                                     
*note nb_inplace_floor_divide: 59d8.*note binaryfunc: 54f8.__ifloordiv__
                                                     
                                                     
*note nb_true_divide: 59d9.    *note binaryfunc: 54f8.__truediv__
                                                     
                                                     
*note nb_inplace_true_divide: 59da.*note binaryfunc: 54f8.__itruediv__
                                                     
                                                     
*note nb_index: 17d5.          *note unaryfunc: 5513.__index__
                                                     
                                                     
*note nb_matrix_multiply: 59db.*note binaryfunc: 54f8.__matmul__
                                                     __rmatmul__
                                                     
                                                     
*note nb_inplace_matrix_multiply: 59dc.*note binaryfunc: 54f8.__imatmul__
                                                     
                                                     
                                                     
*note mp_length: 59dd.         *note lenfunc: 5505.  __len__
                                                     
                                                     
*note mp_subscript: 1f0a.      *note binaryfunc: 54f8.__getitem__
                                                     
                                                     
*note mp_ass_subscript: 59de.  *note objobjargproc: 5507.__setitem__,
                                                     __delitem__
                                                     
                                                     
                                                     
*note sq_length: 5659.         *note lenfunc: 5505.  __len__
                                                     
                                                     
*note sq_concat: 59df.         *note binaryfunc: 54f8.__add__
                                                     
                                                     
*note sq_repeat: 59e0.         *note ssizeargfunc: 550f.__mul__
                                                     
                                                     
*note sq_item: 1f09.           *note ssizeargfunc: 550f.__getitem__
                                                     
                                                     
*note sq_ass_item: 59e1.       *note ssizeobjargproc: 5510.__setitem__
                                                     __delitem__
                                                     
                                                     
*note sq_contains: 59e2.       *note objobjproc: 5508.__contains__
                                                     
                                                     
*note sq_inplace_concat: 59e3. *note binaryfunc: 54f8.__iadd__
                                                     
                                                     
*note sq_inplace_repeat: 59e4. *note ssizeargfunc: 550f.__imul__
                                                     
                                                     
                                                     
*note bf_getbuffer: b49.       *note getbufferproc(): 54fe.__buffer__
                                                     
                                                     
*note bf_releasebuffer: b4a.   *note releasebufferproc(): 5509.__release_buffer__
                                                     


File: python.info,  Node: スロットの定義型 typedef,  Prev: sub-slots,  Up: クイックリファレンス

7.22.4.4 スロットの定義型 (typedef)
...................................

定義型 (typedef)                  引数型                            返り値型
                                                                    
-----------------------------------------------------------------------------------------------
                                                                    
*note allocfunc: 54f7.                 *note PyTypeObject: e6f. *   *note PyObject: 1a6. *
                                       *note Py_ssize_t: e28.       
                                  
                                                                    
*note destructor: 54fb.           *note PyObject: 1a6. *            void
                                                                    
                                                                    
*note freefunc: 57ca.             void *                            void
                                                                    
                                                                    
*note traverseproc: 5512.              *note PyObject: 1a6. *       int
                                       *note visitproc: 5514.       
                                       void *
                                  
                                                                    
*note newfunc: 5506.                   *note PyTypeObject: e6f. *   *note PyObject: 1a6. *
                                       *note PyObject: 1a6. *       
                                       *note PyObject: 1a6. *
                                  
                                                                    
*note initproc: 5502.                  *note PyObject: 1a6. *       int
                                       *note PyObject: 1a6. *       
                                       *note PyObject: 1a6. *
                                  
                                                                    
*note reprfunc: 550a.             *note PyObject: 1a6. *            *note PyObject: 1a6. *
                                                                    
                                                                    
*note getattrfunc: 54fc.               *note PyObject: 1a6. *       *note PyObject: 1a6. *
                                       const char *                 
                                  
                                                                    
*note setattrfunc: 550c.               *note PyObject: 1a6. *       int
                                       const char *                 
                                       *note PyObject: 1a6. *
                                  
                                                                    
*note getattrofunc: 54fd.              *note PyObject: 1a6. *       *note PyObject: 1a6. *
                                       *note PyObject: 1a6. *       
                                  
                                                                    
*note setattrofunc: 550d.              *note PyObject: 1a6. *       int
                                       *note PyObject: 1a6. *       
                                       *note PyObject: 1a6. *
                                  
                                                                    
*note descrgetfunc: 54f9.              *note PyObject: 1a6. *       *note PyObject: 1a6. *
                                       *note PyObject: 1a6. *       
                                       *note PyObject: 1a6. *
                                  
                                                                    
*note descrsetfunc: 54fa.              *note PyObject: 1a6. *       int
                                       *note PyObject: 1a6. *       
                                       *note PyObject: 1a6. *
                                  
                                                                    
*note hashfunc: 5501.             *note PyObject: 1a6. *            Py_hash_t
                                                                    
                                                                    
*note richcmpfunc: 550b.               *note PyObject: 1a6. *       *note PyObject: 1a6. *
                                       *note PyObject: 1a6. *       
                                       int
                                  
                                                                    
*note getiterfunc: 54ff.          *note PyObject: 1a6. *            *note PyObject: 1a6. *
                                                                    
                                                                    
*note iternextfunc: 5504.         *note PyObject: 1a6. *            *note PyObject: 1a6. *
                                                                    
                                                                    
*note lenfunc: 5505.              *note PyObject: 1a6. *            *note Py_ssize_t: e28.
                                                                    
                                                                    
*note getbufferproc: 54fe.             *note PyObject: 1a6. *       int
                                       *note Py_buffer: b3f. *      
                                       int
                                  
                                                                    
*note releasebufferproc: 5509.         *note PyObject: 1a6. *       void
                                       *note Py_buffer: b3f. *      
                                  
                                                                    
*note inquiry: 5503.              *note PyObject: 1a6. *            int
                                                                    
                                                                    
*note unaryfunc: 5513.                 *note PyObject: 1a6. *       *note PyObject: 1a6. *
                                                                    
                                                                    
*note binaryfunc: 54f8.                *note PyObject: 1a6. *       *note PyObject: 1a6. *
                                       *note PyObject: 1a6. *       
                                  
                                                                    
*note ternaryfunc: 5511.               *note PyObject: 1a6. *       *note PyObject: 1a6. *
                                       *note PyObject: 1a6. *       
                                       *note PyObject: 1a6. *
                                  
                                                                    
*note ssizeargfunc: 550f.              *note PyObject: 1a6. *       *note PyObject: 1a6. *
                                       *note Py_ssize_t: e28.       
                                  
                                                                    
*note ssizeobjargproc: 5510.           *note PyObject: 1a6. *       int
                                       *note Py_ssize_t: e28.       
                                       *note PyObject: 1a6. *
                                  
                                                                    
*note objobjproc: 5508.                *note PyObject: 1a6. *       int
                                       *note PyObject: 1a6. *       
                                  
                                                                    
*note objobjargproc: 5507.             *note PyObject: 1a6. *       int
                                       *note PyObject: 1a6. *       
                                       *note PyObject: 1a6. *
                                  

See *note Slot Type typedefs: 59e6. below for more detail.


File: python.info,  Node: PyTypeObject 定義,  Next: PyObject スロット,  Prev: クイックリファレンス,  Up: Type Object Structures

7.22.4.5 PyTypeObject 定義
..........................

The structure definition for *note PyTypeObject: e6f. 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.22.4.6 PyObject スロット
..........................

The type object structure extends the *note PyVarObject: 493d.
structure.  The *note ob_size: 546b. field is used for dynamic types
(created by ‘type_new()’, usually called from a class statement).  Note
that *note PyType_Type: 95d. (the metatype) initializes *note
tp_itemsize: 25cf, which means that its instances (i.e.  type objects)
'must' have the ‘ob_size’ field.

*note PyObject.ob_refcnt: c79.

     The type object's reference count is initialized to ‘1’ by the
     ‘PyObject_HEAD_INIT’ macro.  Note that for *note statically
     allocated type objects: b64, the type's instances (objects whose
     *note ob_type: 51f2. points back to the type) do 'not' count as
     references.  But for *note dynamically allocated type objects: d33,
     the instances 'do' count as references.

     '継承:'

     サブタイプはこのフィールドを継承しません。

*note PyObject.ob_type: 51f2.

     型自体の型、別の言い方をするとメタタイプです。 ‘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(): b63. checks if *note ob_type: 51f2. 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.22.4.7 PyVarObject スロット
.............................

*note PyVarObject.ob_size: 546b.

     *note 静的にメモリ確保されている型オブジェクト: b64. の場合、このフ
     ィールドはゼロに初期化されます。*note
     動的にメモリ確保されている型オブジェクト: d33. の場合、このフィール
     ドは内部使用される特殊な意味を持ちます。

     This field should be accessed using the *note Py_SIZE(): b66.
     macro.

     '継承:'

     サブタイプはこのフィールドを継承しません。


File: python.info,  Node: PyTypeObject スロット,  Next: Static Types,  Prev: PyVarObject スロット,  Up: Type Object Structures

7.22.4.8 PyTypeObject スロット
..............................

Each slot has a section describing inheritance.  If *note
PyType_Ready(): b63. 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: 52a9. and *note PyType_Type: 95d.
effectively act as defaults.)

 -- C のメンバ変数: const char **note PyTypeObject: e6f.tp_name

     See *note Py_tp_name: 384. for the corresponding *note Slot ID:
     5577.

     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: 1ec5. initializer ‘"P.Q.M.T"’.

     *note 動的にメモリ確保される型オブジェクト: d33. の場合、このフィー
     ルドは単に型の名前になり、モジュール名は型の辞書内でキー
     ‘'__module__'’ に対する値として明示的に保存されます。

     For *note statically allocated type objects: b64, the 'tp_name'
     field should contain a dot.  Everything before the last dot is made
     accessible as the *note __module__: 811. attribute, and everything
     after the last dot is made accessible as the *note __name__: 1863.
     attribute.

     If no dot is present, the entire *note tp_name: 1ec5. field is made
     accessible as the *note __name__: 1863. attribute, and the *note
     __module__: 811. 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(): e6f. (other than potentially *note
     tp_itemsize: 25cf.).

     '継承:'

     サブタイプはこのフィールドを継承しません。

 -- C のメンバ変数: *note Py_ssize_t: e28. *note PyTypeObject:
          e6f.tp_basicsize
 -- C のメンバ変数: *note Py_ssize_t: e28. *note PyTypeObject:
          e6f.tp_itemsize

     これらのフィールドは、型インスタンスのバイトサイズを計算できるよう
     にします。

     See *note Py_tp_basicsize: 385, *note Py_tp_extra_basicsize: 386.
     and *note Py_tp_itemsize: 387. for the corresponding *note Slot
     IDs: 5577.

     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(): 1cca.)

     For a type with variable-length instances, the instances must have
     an *note ob_size: 546b. 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(): d52. will take the value of
     N as an argument, and store in the instance's *note ob_size: 546b.
     field.  Note that the ‘ob_size’ field may later be used for other
     purposes.  For example, *note int: 32e. 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(): 5dc.

          注釈: The *note ob_size: 546b. field should be accessed using
          the *note Py_SIZE(): b66. and *note Py_SET_SIZE(): b67.
          macros.

     Also, the presence of an *note ob_size: 546b. field in the instance
     layout doesn't mean that the instance structure is variable-length.
     For example, the *note list: 4e0. type has fixed-length instances,
     yet those instances have a ‘ob_size’ field.  (As with *note int:
     32e, avoid reading lists' ‘ob_size’ directly.  Call *note
     PyList_Size(): 17d2. instead.)

     The ‘tp_basicsize’ includes size needed for data of the type's
     *note tp_base: 2585, 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: e51, this struct
     must include *note PyObject: 1a6. or *note PyVarObject: 493d.
     (depending on whether *note ob_size: 546b. should be included).
     These are usually defined by the macro *note PyObject_HEAD: 1697.
     or *note PyObject_VAR_HEAD: 5988, respectively.

     The basic size does not include the GC header size, as that header
     is not part of *note PyObject_HEAD: 1697.

     For cases where struct used to declare the base type is unknown,
     see *note PyType_Spec.basicsize: 1a4. and *note
     PyType_FromMetaclass(): 399.

     Notes about alignment:

        - ‘tp_basicsize’ must be a multiple of ‘_Alignof(PyObject)’.
          When using ‘sizeof’ on a ‘struct’ that includes *note
          PyObject_HEAD: 1697, 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(): b63. 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: 25cf, 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: 54fb. *note PyTypeObject:
          e6f.tp_dealloc

     ' The corresponding *note slot ID: 542a. ‘Py_tp_dealloc’ is part of
     the *note Stable ABI: 961.'

     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(): 981.), free all memory
     buffers owned by the instance, and call the type's *note tp_free:
     51f4. function to free the object itself.

     If you may call functions that may set the error indicator, you
     must use *note PyErr_GetRaisedException(): 643. and *note
     PyErr_SetRaisedException(): 646. 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(): 7ed.
     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: e70.) subsequently resurrects
          the object.

        * An object will not be destroyed while it is being
          automatically finalized (*note tp_finalize: e70.) or
          automatically cleared (*note tp_clear: 5206.).

     CPython currently destroys an object immediately from *note
     Py_DECREF(): 97a. when the new reference count is zero, but this
     may change in a future version.

     It is recommended to call *note
     PyObject_CallFinalizerFromDealloc(): 359. 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: 3a6. flag is set), the destructor should call
     *note PyObject_GC_UnTrack(): 18bd. before clearing any member
     fields.

     It is permissible to call *note tp_clear: 5206. 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: c86.),
     the deallocator should release the owned reference to its type
     object (via *note Py_DECREF(): 97a.) 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(): 7ee.).

     以下はプログラム例です:

          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: 1ac.  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: 5979. for details about how this slot
     relates to other slots.

 -- C のメンバ変数: *note Py_ssize_t: e28. *note PyTypeObject:
          e6f.tp_vectorcall_offset

     An optional offset to a per-instance function that implements
     calling the object using the *note vectorcall protocol: 960, a more
     efficient alternative of the simpler *note tp_call: 967.

     This field is only used if the flag *note
     Py_TPFLAGS_HAVE_VECTORCALL: 962. is set.  If so, this must be a
     positive integer containing the offset in the instance of a *note
     vectorcallfunc: 965. pointer.

     The 'vectorcallfunc' pointer may be ‘NULL’, in which case the
     instance behaves as if *note Py_TPFLAGS_HAVE_VECTORCALL: 962. was
     not set: calling the instance falls back to *note tp_call: 967.

     Any class that sets ‘Py_TPFLAGS_HAVE_VECTORCALL’ must also set
     *note tp_call: 967. and make sure its behaviour is consistent with
     the 'vectorcallfunc' function.  This can be done by setting
     'tp_call' to *note PyVectorcall_Call(): 964.

     バージョン 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: d33. to implement the vectorcall
     protocol.  When a user sets *note __call__: 966. 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: 962. flag.

     '継承:'

     This field is always inherited.  However, the *note
     Py_TPFLAGS_HAVE_VECTORCALL: 962. flag is not always inherited.  If
     it's not set, then the subclass won't use *note vectorcall: 960,
     except when *note PyVectorcall_Call(): 964. is explicitly called.

 -- C のメンバ変数: *note getattrfunc: 54fc. *note PyTypeObject:
          e6f.tp_getattr

     ' The corresponding *note slot ID: 542a. ‘Py_tp_getattr’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、get-attribute-string を行う関数を指します。

     このフィールドは非推奨です。 このフィールドを定義するときは、 *note
     tp_getattro: 1c89. 関数と同じように動作し、属性名は Python 文字列 オ
     ブジェクトではなく C 文字列で指定するような関数を指すようにしなけれ
     ばなりません。

     '継承:'

     Group: *note tp_getattr: 5211, *note tp_getattro: 1c89.

     このフィールドは *note tp_getattro: 1c89. と共にサブタイプに継承さ
     れます: すなわち、サブタイプの *note tp_getattr: 5211. および
     ‘tp_getattro’ が共に ‘NULL’ の場合、サブタイプは基底タイプから
     ‘tp_getattr’ と ‘tp_getattro’ を両方とも継承します。

 -- C のメンバ変数: *note setattrfunc: 550c. *note PyTypeObject:
          e6f.tp_setattr

     ' The corresponding *note slot ID: 542a. ‘Py_tp_setattr’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、属性の設定と削除を行う関数を指します。

     このフィールドは非推奨です。 このフィールドを定義するときは、 *note
     tp_setattro: 520c. 関数と同じように動作し、属性名は Python 文字列 オ
     ブジェクトではなく C 文字列で指定するような関数を指すようにしなけれ
     ばなりません。

     '継承:'

     Group: *note tp_setattr: 5212, *note tp_setattro: 520c.

     このフィールドは *note tp_setattro: 520c. と共にサブタイプに継承さ
     れます: すなわち、サブタイプの *note tp_setattr: 5212. および
     ‘tp_setattro’ が共に ‘NULL’ の場合、サブタイプは基底タイプから
     ‘tp_setattr’ と ‘tp_setattro’ を両方とも継承します。

 -- C のメンバ変数: *note PyAsyncMethods: 5658. **note PyTypeObject:
          e6f.tp_as_async

     追加の構造体を指すポインタです。 この構造体は、 C レベルで *note
     awaitable: 6d5. プロトコルと *note asynchronous iterator: 6d3. プロ
     トコルを実装するオブジェクトだけに関係するフィールドを持ちます。 詳
     しいことは *note async オブジェクト構造体: 59eb. を参照してください
     。

     Added in version 3.5: 以前は ‘tp_compare’ や ‘tp_reserved’ として知
     られていました。

     '継承:'

     *note tp_as_async: 1280. フィールドは継承されませんが、これに含まれ
     るフィールドが個別に継承されます。

 -- C のメンバ変数: *note reprfunc: 550a. *note PyTypeObject:
          e6f.tp_repr

     ' The corresponding *note slot ID: 542a. ‘Py_tp_repr’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、組み込み関数 *note repr(): 462. を実装して
     いる関数を指します。

     The signature is the same as for *note PyObject_Repr(): 13db.:

          PyObject *tp_repr(PyObject *self);

     この関数は文字列オブジェクトか Unicode オブジェクトを返さなければな
     りません。理想的には、この関数が返す文字列は、適切な環境で *note
     eval(): 18f. に渡した場合、同じ値を持つオブジェクトになるような文字
     列でなければなりません。不可能な場合には、オブジェクトの型と値から
     導出した内容の入った ‘'<'’ から始まって ‘'>'’ で終わる文字列を返さ
     なければなりません。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     このフィールドが設定されていない場合、 ‘<%s object at %p>’ の形式を
     とる文字列が返されます。 ‘%s’ は型の名前に、 ‘%p’ はオブジェクトの
     メモリアドレスに置き換えられます。

 -- C のメンバ変数: *note PyNumberMethods: 17d6. **note PyTypeObject:
          e6f.tp_as_number

     数値プロトコルを実装した追加の構造体を指すポインタです。これらのフ
     ィールドについては *note 数値オブジェクト構造体: 59ec. で説明されて
     います。

     '継承:'

     *note tp_as_number: d57. フィールドは継承されませんが、そこの含まれ
     るフィールドが個別に継承されます。

 -- C のメンバ変数: *note PySequenceMethods: 5218. **note PyTypeObject:
          e6f.tp_as_sequence

     シーケンスプロトコルを実装した追加の構造体を指すポインタです。これ
     らのフィールドについては *note シーケンスオブジェクト構造体: 59ed.
     で説明されています。

     '継承:'

     *note tp_as_sequence: 59ae. フィールドは継承されませんが、これに含
     まれるフィールドが個別に継承されます。

 -- C のメンバ変数: *note PyMappingMethods: 5219. **note PyTypeObject:
          e6f.tp_as_mapping

     マッピングプロトコルを実装した追加の構造体を指すポインタです。これ
     らのフィールドについては *note マップオブジェクト構造体: 59ee. で説
     明されています。

     '継承:'

     *note tp_as_mapping: 59af. フィールドは継承されませんが、これに含ま
     れるフィールドが個別に継承されます。

 -- C のメンバ変数: *note hashfunc: 5501. *note PyTypeObject:
          e6f.tp_hash

     ' The corresponding *note slot ID: 542a. ‘Py_tp_hash’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、組み込み関数 *note hash(): 9e7. を実装して
     いる関数を指します。

     The signature is the same as for *note PyObject_Hash(): 650.:

          Py_hash_t tp_hash(PyObject *);

     通常時には ‘-1’ を戻り値にしてはなりません; ハッシュ値の計算中にエ
     ラーが生じた場合、関数は例外をセットして ‘-1’ を返さねばなりません
     。

     When this field is not set ('and' *note tp_richcompare: 5214. is
     not set), an attempt to take the hash of the object raises *note
     TypeError: 29c.  This is the same as setting it to *note
     PyObject_HashNotImplemented(): 177f.

     このフィールドは明示的に *note PyObject_HashNotImplemented(): 177f.
     に設定することで、親 type からのハッシュメソッドの継承をブロックす
     ることができます。これは Python レベルでの ‘__hash__ = None’ と同等
     に解釈され、 ‘isinstance(o, collections.Hashable)’ が正しく ‘False’
     を返すようになります。逆もまた可能であることに注意してください -
     Python レベルで ‘__hash__ = None’ を設定することで ‘tp_hash’ スロッ
     トは ‘PyObject_HashNotImplemented()’ に設定されます。

     '継承:'

     Group: *note tp_hash: 521a, *note tp_richcompare: 5214.

     このフィールドは *note tp_richcompare: 5214. と共にサブタイプに継承
     されます: すなわち、サブタイプの ‘tp_richcompare’ および *note
     tp_hash: 521a. が両方とも ‘NULL’ のとき、サブタイプは基底タイプから
     ‘tp_richcompare’ と ‘tp_hash’ を両方とも継承します。

     'デフォルト'

     *note PyBaseObject_Type: 52a9. uses *note PyObject_GenericHash():
     808.

 -- C のメンバ変数: *note ternaryfunc: 5511. *note PyTypeObject:
          e6f.tp_call

     ' The corresponding *note slot ID: 542a. ‘Py_tp_call’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、オブジェクトの呼び出しを実装している関数を
     指します。オブジェクトが呼び出し可能でない場合には ‘NULL’ にしなけ
     ればなりません。シグネチャは *note PyObject_Call(): 835. と同じです
     。

          PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note reprfunc: 550a. *note PyTypeObject: e6f.tp_str

     ' The corresponding *note slot ID: 542a. ‘Py_tp_str’ is part of the
     *note Stable ABI: 961.'

     オプションのポインタで、組み込みの演算 *note str(): 1ea. を実装して
     いる関数を指します。(*note str: 1ea. が型の一つになったため、
     ‘str()’ は ‘str’ のコンストラクタを呼び出すことに注意してください。
     このコンストラクタは実際の処理を行う上で *note PyObject_Str():
     13dc. を呼び出し、さらに ‘PyObject_Str()’ がこのハンドラを呼び出す
     ことになります。)

     The signature is the same as for *note PyObject_Str(): 13dc.:

          PyObject *tp_str(PyObject *self);

     この関数は文字列オブジェクトか Unicode オブジェクトを返さなければな
     りません。それはオブジェクトを "分かりやすく (friendly)" 表現した文
     字列でなければなりません。というのは、この文字列はとりわけ *note
     print(): 1324. 関数で使われることになる表記だからです。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     このフィールドが設定されていない場合、文字列表現を返すためには
     *note PyObject_Repr(): 13db. が呼び出されます。

 -- C のメンバ変数: *note getattrofunc: 54fd. *note PyTypeObject:
          e6f.tp_getattro

     ' The corresponding *note slot ID: 542a. ‘Py_tp_getattro’ is part
     of the *note Stable ABI: 961.'

     オプションのポインタで、get-attribute を実装している関数を指します
     。

     The signature is the same as for *note PyObject_GetAttr(): 3bf.:

          PyObject *tp_getattro(PyObject *self, PyObject *attr);

     通常の属性検索を実装している *note PyObject_GenericGetAttr(): 53d5.
     をこのフィールドに設定しておくとたいていの場合は便利です。

     '継承:'

     Group: *note tp_getattr: 5211, *note tp_getattro: 1c89.

     このフィールドは *note tp_getattr: 5211. と共にサブタイプに継承され
     ます: すなわち、サブタイプの ‘tp_getattr’ および *note tp_getattro:
     1c89. が共に ‘NULL’ の場合、サブタイプは基底タイプから ‘tp_getattr’
     と ‘tp_getattro’ を両方とも継承します。

     'デフォルト'

     *note PyBaseObject_Type: 52a9. uses *note
     PyObject_GenericGetAttr(): 53d5.

 -- C のメンバ変数: *note setattrofunc: 550d. *note PyTypeObject:
          e6f.tp_setattro

     ' The corresponding *note slot ID: 542a. ‘Py_tp_setattro’ is part
     of the *note Stable ABI: 961.'

     オプションのポインタで、属性の設定と削除を行う関数を指します。

     The signature is the same as for *note PyObject_SetAttr(): 1948.:

          int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);

     さらに、'value' に ‘NULL’ を指定して属性を削除できるようにしなけれ
     ばなりません。 通常のオブジェクト属性設定を実装している *note
     PyObject_GenericSetAttr(): 53d6. をこのフィールドに設定しておくとた
     いていの場合は便利です。

     '継承:'

     Group: *note tp_setattr: 5212, *note tp_setattro: 520c.

     このフィールドは *note tp_setattr: 5212. と共にサブタイプに継承され
     ます: すなわち、サブタイプの ‘tp_setattr’ および *note tp_setattro:
     520c. が共に ‘NULL’ の場合、サブタイプは基底タイプから ‘tp_setattr’
     と ‘tp_setattro’ を両方とも継承します。

     'デフォルト'

     *note PyBaseObject_Type: 52a9. uses *note
     PyObject_GenericSetAttr(): 53d6.

 -- C のメンバ変数: *note PyBufferProcs: 565f. **note PyTypeObject:
          e6f.tp_as_buffer

     バッファインターフェースを実装しているオブジェクトにのみ関連する、
     一連のフィールド群が入った別の構造体を指すポインタです。構造体内の
     各フィールドは *note バッファオブジェクト構造体 (buffer object
     structure): 13f3. で説明します。

     '継承:'

     *note tp_as_buffer: d55. フィールド自体は継承されませんが、これに含
     まれるフィールドは個別に継承されます。

 -- C のメンバ変数: unsigned long *note PyTypeObject: e6f.tp_flags

     See *note Py_tp_flags: 388. for the corresponding *note Slot ID:
     5577.

     このフィールドは様々なフラグからなるビットマスクです。いくつかのフ
     ラグは、特定の状況において変則的なセマンティクスが適用されることを
     示します; その他のフラグは、型オブジェクト (あるいは *note
     tp_as_number: d57. 、 *note tp_as_sequence: 59ae. 、 *note
     tp_as_mapping: 59af. 、 および *note tp_as_buffer: d55. が参照して
     いる拡張機能構造体) の特定のフィールドのうち、過去から現在までずっ
     と存在していたわけではないものが有効になっていることを示すために使
     われます; フラグビットがクリアされていれば、フラグが保護しているフ
     ィールドにはアクセスしない代わりに、その値はゼロか ‘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: 3a6. flag bit is
     inherited together with the *note tp_traverse: 373. and *note
     tp_clear: 5206. 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: 52a9. uses ‘Py_TPFLAGS_DEFAULT |
     Py_TPFLAGS_BASETYPE’.

     'Bit Masks:'

     以下に挙げるビットマスクは現在定義されているものです; フラグは ‘|’
     演算子で論理和を取って *note tp_flags: 1e87. フィールドの値を作成で
     きます。 *note PyType_HasFeature(): 1f4f. マクロは型とフラグ値、
     '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(): 396.  In this case, the *note ob_type:
          51f2. 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: 59ef. as they can form a reference cycle with
          their own module object.

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_BASETYPE
          ' 次に属します: *note Stable ABI: 961.'  型を別の型の基底タイ
          プとして使える場合にセットされるビットです。このビットがクリア
          ならば、この型のサブタイプは生成できません (Java における
          "final" クラスに似たクラスになります)。

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_READY

          型オブジェクトが *note PyType_Ready(): b63. で完全に初期化され
          るとセットされるビットです。

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_READYING

          *note PyType_Ready(): b63. による型オブジェクトの初期化処理中
          にセットされるビットです。

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_HAVE_GC
          ' 次に属します: *note Stable ABI: 961.'  This bit is set when
          the object supports garbage collection.  If this bit is set,
          memory for new instances (see *note tp_alloc: 51f5.) must be
          allocated using *note PyObject_GC_New: e6c. or *note
          PyType_GenericAlloc(): e34. and deallocated (see *note
          tp_free: 51f4.) using *note PyObject_GC_Del(): 18bb.  More
          information in section *note
          循環参照ガベージコレクションをサポートする: 59ef.

          '継承:'

          Group: *note Py_TPFLAGS_HAVE_GC: 3a6, *note tp_traverse: 373,
          *note tp_clear: 5206.

          The *note Py_TPFLAGS_HAVE_GC: 3a6. flag bit is inherited
          together with the *note tp_traverse: 373. and *note tp_clear:
          5206. 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: 961.'  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: 59f2.

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_METHOD_DESCRIPTOR
          ' 次に属します: *note Stable ABI: 961. (バージョン 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: 602. flag set.  For extension types,
          it is inherited whenever *note tp_descr_get: 57e3. is
          inherited.

      -- C のマクロ: Py_TPFLAGS_MANAGED_DICT

          This bit indicates that instances of the class have a *note
          __dict__: 1ca. attribute, and that the space for the
          dictionary is managed by the VM.

          If this flag is set, *note Py_TPFLAGS_HAVE_GC: 3a6. must also
          be set.

          The type traverse function must call *note
          PyObject_VisitManagedDict(): 809. and its clear function must
          call *note PyObject_ClearManagedDict(): 80a.

          Added in version 3.12.

          '継承:'

          This flag is inherited unless the *note tp_dictoffset: 565a.
          field is set in a superclass.

      -- C のマクロ: Py_TPFLAGS_MANAGED_WEAKREF

          This bit indicates that instances of the class should be
          weakly referenceable.

          If this flag is set, *note Py_TPFLAGS_HAVE_GC: 3a6. must also
          be set.

          Added in version 3.12.

          '継承:'

          This flag is inherited unless the *note tp_weaklistoffset:
          d54. field is set in a superclass.

      -- C のマクロ: Py_TPFLAGS_PREHEADER

          These bits indicate that the VM will manage some fields by
          storing them before the object.  Currently, this macro is
          equivalent to *note Py_TPFLAGS_MANAGED_DICT: 3a4. | *note
          Py_TPFLAGS_MANAGED_WEAKREF: 3a5.

          This macro value relies on the implementation of the VM, so
          its value is not stable and may change in a future version.
          Prefer using individual flags instead.

          Added in version 3.12.

      -- C のマクロ: Py_TPFLAGS_ITEMS_AT_END
          ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より
          ).'  Only usable with variable-size types, i.e.  ones with
          non-zero *note tp_itemsize: 25cf.

          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(): 566f. will call *note
          PyType_FastSubclass(): 564e. 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(): 125a.  Custom types that inherit
          from built-ins should have their *note tp_flags: 1e87. 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: e70. スロットが存在しているとき
          にセットされるビットです。

          Added in version 3.4.

          バージョン 3.8 で非推奨: This flag isn't necessary anymore, as
          the interpreter assumes the *note tp_finalize: e70. slot is
          always present in the type structure.

      -- C のマクロ: Py_TPFLAGS_HAVE_VECTORCALL
          ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より
          ).'  This bit is set when the class implements the *note
          vectorcall protocol: 960.  See *note tp_vectorcall_offset:
          5607. for details.

          '継承:'

          This bit is inherited if *note tp_call: 967. 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: 1b2.

          バージョン 3.12 で変更: This flag is now removed from a class
          when the class's *note __call__(): 966. 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(): b63. automatically applies this flag to
          *note static types: b64.

          '継承:'

          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:
          986. 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(): b63. is
          called on the type.

          The flag is set automatically on *note static types: b64. if
          *note tp_base: 2585. is NULL or ‘&PyBaseObject_Type’ and *note
          tp_new: 986. is NULL.

          '継承:'

          This flag is not inherited.  However, subclasses will not be
          instantiable unless they provide a non-NULL *note tp_new: 986.
          (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: 1574.), do not use this flag.
               Instead, make *note tp_new: 986. 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:
          1df. block.  It is automatically set when registering or
          subclassing *note collections.abc.Mapping: ca0, and unset when
          registering *note collections.abc.Sequence: 1582.

               注釈: *note Py_TPFLAGS_MAPPING: 1e6e. and *note
               Py_TPFLAGS_SEQUENCE: 1e6f. 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: 1e6f.

          参考
          ....

          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:
          1df. block.  It is automatically set when registering or
          subclassing *note collections.abc.Sequence: 1582, and unset
          when registering *note collections.abc.Mapping: ca0.

               注釈: *note Py_TPFLAGS_MAPPING: 1e6e. and *note
               Py_TPFLAGS_SEQUENCE: 1e6f. 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: 1e6e.

          参考
          ....

          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(): 1d96.

               警告: 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 macro does nothing.  Historically, this would indicate
          that the *note tp_version_tag: 59b3. field was available and
          initialized.

          *note Soft deprecated: 1b2. since version 3.13.

      -- 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: 3a6. 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: e6f.tp_doc

     ' The corresponding *note slot ID: 542a. ‘Py_tp_doc’ is part of the
     *note Stable ABI: 961.'

     An optional pointer to a NUL-terminated C string giving the
     docstring for this type object.  This is exposed as the *note
     __doc__: 22a2. attribute on the type and instances of the type.

     '継承:'

     サブタイプはこのフィールドを継承 'しません' 。

 -- C のメンバ変数: *note traverseproc: 5512. *note PyTypeObject:
          e6f.tp_traverse

     ' The corresponding *note slot ID: 542a. ‘Py_tp_traverse’ is part
     of the *note Stable ABI: 961.'

     An optional pointer to a traversal function for the garbage
     collector.  This is only used if the *note Py_TPFLAGS_HAVE_GC: 3a6.
     flag bit is set.

     See *note Traversal: 59ff. for documentation.

     '継承:'

     Group: *note Py_TPFLAGS_HAVE_GC: 3a6, *note tp_traverse: 373, *note
     tp_clear: 5206.

     This field is inherited by subtypes together with *note tp_clear:
     5206. and the *note Py_TPFLAGS_HAVE_GC: 3a6. flag bit: the flag
     bit, *note tp_traverse: 373, and ‘tp_clear’ are all inherited from
     the base type if they are all zero in the subtype.

 -- C のメンバ変数: *note inquiry: 5503. *note PyTypeObject:
          e6f.tp_clear

     ' The corresponding *note slot ID: 542a. ‘Py_tp_clear’ is part of
     the *note Stable ABI: 961.'

     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: 597d. 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: 51e2. 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(): 981.)

     Any non-trivial cleanup should be performed in *note tp_finalize:
     e70. instead of ‘tp_clear’.

          注釈: If ‘tp_clear’ fails to break a reference cycle then the
          objects in the *note cyclic isolate: 597d. may remain
          indefinitely uncollectable ("leak").  See *note gc.garbage:
          157f.

          注釈: Referents (direct and indirect) might have already been
          cleared; they are not guaranteed to be in a consistent state.

          注釈: The *note tp_clear: 5206. function can be called from
          any thread.

          注釈: An object is not guaranteed to be automatically cleared
          before its destructor (*note tp_dealloc: 51e2.) is called.

     This function differs from the destructor (*note tp_dealloc: 51e2.)
     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: 51f4.).

        * 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: 51f4.).  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: 597d.).

     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: 597d.

        * Python will not automatically clear an object if it has not
          been automatically finalized (see *note tp_finalize: e70.).
          (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: 597d,
          Python will not automatically clear it if any member of the
          cyclic isolate has not yet been automatically finalized (*note
          tp_finalize: e70.).

        * 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: 597d, but future
     versions might clear objects regularly before their destruction.

     Taken together, all *note tp_clear: 5206. 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: 5206. の実装は、インスタンスか
     ら 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(): 981. macro should be used, because clearing
     references is delicate: the reference to the contained object must
     not be released (via *note Py_DECREF(): 97a.) 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: 3a4. bit is set in the *note
     tp_flags: 1e87. field, the clear function must call *note
     PyObject_ClearManagedDict(): 80a. like this:

          PyObject_ClearManagedDict((PyObject*)self);

     Pythonのガベージコレクションの仕組みについての詳細は、 *note
     循環参照ガベージコレクションをサポートする: 59ef. にあります。

     '継承:'

     Group: *note Py_TPFLAGS_HAVE_GC: 3a6, *note tp_traverse: 373, *note
     tp_clear: 5206.

     This field is inherited by subtypes together with *note
     tp_traverse: 373. and the *note Py_TPFLAGS_HAVE_GC: 3a6. flag bit:
     the flag bit, ‘tp_traverse’, and *note tp_clear: 5206. are all
     inherited from the base type if they are all zero in the subtype.

     参考
     ....

     *note Object Life Cycle: 5979. for details about how this slot
     relates to other slots.

 -- C のメンバ変数: *note richcmpfunc: 550b. *note PyTypeObject:
          e6f.tp_richcompare

     ' The corresponding *note slot ID: 542a. ‘Py_tp_richcompare’ is
     part of the *note Stable ABI: 961.'

     オプションのポインタで、拡張比較関数を指します。シグネチャは次の通
     りです:

          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: e6f.

     この関数は、比較結果を返すべきです。(普通は ‘Py_True’ か ‘Py_False’
     です。) 比較が未定義の場合は、‘Py_NotImplemented’ を、それ以外のエ
     ラーが発生した場合には例外状態をセットして ‘NULL’ を返さなければな
     りません。

     *note tp_richcompare: 5214. および *note PyObject_RichCompare():
     5215. 関数の第三引数に使うための定数としては以下が定義されています:

     定数                     比較
                              
     ------------------------------------------
                              
      -- 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(): 5215. と
          同様に要求された演算を指定します。

          The returned value is a new *note strong reference: 7e0.

          エラー時には例外を設定して、関数から ‘NULL’ でリターンします。

          Added in version 3.7.

     '継承:'

     Group: *note tp_hash: 521a, *note tp_richcompare: 5214.

     このフィールドは *note tp_hash: 521a. と共にサブタイプに継承されま
     す: すなわち、サブタイプの *note tp_richcompare: 5214. および
     ‘tp_hash’ が両方とも ‘NULL’ のとき、サブタイプは基底タイプから
     ‘tp_richcompare’ と ‘tp_hash’ を両方とも継承します。

     'デフォルト'

     *note PyBaseObject_Type: 52a9. provides a *note tp_richcompare:
     5214. implementation, which may be inherited.  However, if only
     *note tp_hash: 521a. 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: e28. *note PyTypeObject:
          e6f.tp_weaklistoffset

     While this field is still supported, *note
     Py_TPFLAGS_MANAGED_WEAKREF: 3a5. should be used instead, if at all
     possible.

     型のインスタンスが弱参照可能な場合、このフィールドはゼロよりも大き
     な数になり、インスタンス構造体における弱参照リストの先頭を示すオフ
     セットが入ります (GC ヘッダがある場合には無視します); このオフセッ
     ト値は *note PyObject_ClearWeakRefs(): 97f. および ‘PyWeakref_*’ 関
     数が利用します。インスタンス構造体には、 ‘NULL’ に初期化された
     *note PyObject: 1a6.* 型のフィールドが入っていなければなりません。

     このフィールドを *note tp_weaklist: 565e. と混同しないようにしてく
     ださい; これは型オブジェクト自身への弱参照からなるリストの先頭です
     。

     It is an error to set both the *note Py_TPFLAGS_MANAGED_WEAKREF:
     3a5. bit and *note tp_weaklistoffset: d54.

     '継承:'

     このフィールドはサブタイプに継承されますが、以下の規則を読んでくだ
     さい。サブタイプはこのオフセット値をオーバライドすることがあります;
     従って、サブタイプでは弱参照リストの先頭が基底タイプとは異なる場合
     があります。リストの先頭は常に *note tp_weaklistoffset: d54. で分か
     るはずなので、このことは問題にはならないはずです。

     'デフォルト'

     If the *note Py_TPFLAGS_MANAGED_WEAKREF: 3a5. bit is set in the
     *note tp_flags: 1e87. field, then *note tp_weaklistoffset: d54.
     will be set to a negative value, to indicate that it is unsafe to
     use this field.

 -- C のメンバ変数: *note getiterfunc: 54ff. *note PyTypeObject:
          e6f.tp_iter

     ' The corresponding *note slot ID: 542a. ‘Py_tp_iter’ is part of
     the *note Stable ABI: 961.'

     オプションの変数で、そのオブジェクトの *note イテレータ: 6d4. を返
     す関数へのポインタです。この値が存在することは、通常この型のインス
     タンスが *note イテレート可能: 149a. であることを示しています (しか
     し、シーケンスはこの関数がなくてもイテレート可能です)。

     この関数は *note PyObject_GetIter(): 53d9. と同じシグネチャを持って
     います:

          PyObject *tp_iter(PyObject *self);

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note iternextfunc: 5504. *note PyTypeObject:
          e6f.tp_iternext

     ' The corresponding *note slot ID: 542a. ‘Py_tp_iternext’ is part
     of the *note Stable ABI: 961.'

     オプションのポインタで、*note イテレーター: 6d4. の次の要素を返す関
     数を指します。シグネチャは次の通りです:

          PyObject *tp_iternext(PyObject *self);

     イテレータの要素がなくなると、この関数は ‘NULL’ を返さなければなり
     ません。 *note StopIteration: fbe. 例外は設定してもしなくても良いで
     す。その他のエラーが発生したときも、 ‘NULL’ を返さなければなりませ
     ん。このフィールドがあると、この型のインスタンスがイテレータである
     ことを示します。

     イテレータ型では、 *note tp_iter: 18a7. 関数も定義されていなければ
     ならず、その関数は (新たなイテレータインスタンスではなく) イテレー
     タインスタンス自体を返さねばなりません。

     この関数のシグネチャは *note PyIter_Next(): 5cd. と同じです。

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: struct *note PyMethodDef: 188f. **note PyTypeObject:
          e6f.tp_methods

     ' The corresponding *note slot ID: 542a. ‘Py_tp_methods’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、この型の正規 (regular) のメソッドを宣言して
     いる *note PyMethodDef: 188f. 構造体からなる、 ‘NULL’ で終端された
     静的な配列を指します。

     配列の各要素ごとに、メソッドデスクリプタの入った、要素が型の辞書 (下
     記の *note tp_dict: 1cb1. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (メソッドは別個のメカニズ
     ムで継承されています)。

 -- C のメンバ変数: struct *note PyMemberDef: 95f. **note PyTypeObject:
          e6f.tp_members

     ' The corresponding *note slot ID: 542a. ‘Py_tp_members’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、型の正規 (regular) のデータメンバ (フィール
     ドおよびスロット) を宣言している *note PyMemberDef: 95f. 構造体から
     なる、 ‘NULL’ で終端された静的な配列を指します。

     配列の各要素ごとに、メンバデスクリプタの入った要素が型の辞書 (下記
     の *note tp_dict: 1cb1. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (メンバは別個のメカニズム
     で継承されています)。

 -- C のメンバ変数: struct *note PyGetSetDef: f7b. **note PyTypeObject:
          e6f.tp_getset

     ' The corresponding *note slot ID: 542a. ‘Py_tp_getset’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、インスタンスの算出属性 (computed attribute)
     を宣言している *note PyGetSetDef: f7b. 構造体からなる、 ‘NULL’ で終
     端された静的な配列を指します。

     配列の各要素ごとに、 getter/setter デスクリプタの入った、要素が型の
     辞書 (下記の *note tp_dict: 1cb1. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (算出属性は別個のメカニズ
     ムで継承されています)。

 -- C のメンバ変数: *note PyTypeObject: e6f. **note PyTypeObject:
          e6f.tp_base

     ' The corresponding *note slot ID: 542a. ‘Py_tp_base’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、型に関するプロパティを継承する基底タイプを
     指します。このフィールドのレベルでは、単継承 (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(): 51f1, 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: 52a9. 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: 2585. should be set in the
          extension module's init function.

     '継承:'

     (当たり前ですが) サブタイプはこのフィールドを継承しません。

     'デフォルト'

     このフィールドのデフォルト値は (Python プログラマは *note object:
     e51. 型として知っている) ‘&PyBaseObject_Type’ になります。

 -- C のメンバ変数: *note PyObject: 1a6. **note PyTypeObject:
          e6f.tp_dict

     型の辞書は *note PyType_Ready(): b63. によってこのフィールドに収め
     られます。

     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(): b63. 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__(): 25f1.).
     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(): 1cb0. 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(): 1cb0. to get
     the dict for an arbitrary type.

     '継承:'

     サブタイプはこのフィールドを継承しません (が、この辞書内で定義され
     ている属性は異なるメカニズムで継承されます)。

     'デフォルト'

     If this field is ‘NULL’, *note PyType_Ready(): b63. will assign a
     new dictionary to it.

          警告: *note tp_dict: 1cb1. に *note PyDict_SetItem(): 51df. を
          使ったり、辞書 C-API で編集するのは安全ではありません。

 -- C のメンバ変数: *note descrgetfunc: 54f9. *note PyTypeObject:
          e6f.tp_descr_get

     ' The corresponding *note slot ID: 542a. ‘Py_tp_descr_get’ is part
     of the *note Stable ABI: 961.'

     オプションのポインタで、デスクリプタの get 関数を指します。

     関数のシグネチャは次のとおりです

          PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note descrsetfunc: 54fa. *note PyTypeObject:
          e6f.tp_descr_set

     ' The corresponding *note slot ID: 542a. ‘Py_tp_descr_set’ is part
     of the *note Stable ABI: 961.'

     オプションのポインタで、デスクリプタの値の設定と削除を行う関数を指
     します。

     関数のシグネチャは次のとおりです

          int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);

     値を削除するには、'value' 引数に ‘NULL’ を設定します。

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note Py_ssize_t: e28. *note PyTypeObject:
          e6f.tp_dictoffset

     While this field is still supported, *note Py_TPFLAGS_MANAGED_DICT:
     3a4. should be used instead, if at all possible.

     型のインスタンスにインスタンス変数の入った辞書がある場合、このフィ
     ールドは非ゼロの値になり、型のインスタンスデータ構造体におけるイン
     スタンス変数辞書へのオフセットが入ります; このオフセット値は *note
     PyObject_GenericGetAttr(): 53d5. が使います。

     このフィールドを *note tp_dict: 1cb1. と混同しないようにしてくださ
     い; これは型オブジェクト自身の属性の辞書です。

     The value specifies the offset of the dictionary from the start of
     the instance structure.

     The *note tp_dictoffset: 565a. should be regarded as write-only.
     To get the pointer to the dictionary call *note
     PyObject_GenericGetDict(): 1f19.  Calling
     ‘PyObject_GenericGetDict()’ may need to allocate memory for the
     dictionary, so it is may be more efficient to call *note
     PyObject_GetAttr(): 3bf. when accessing an attribute on the object.

     It is an error to set both the *note Py_TPFLAGS_MANAGED_DICT: 3a4.
     bit and *note tp_dictoffset: 565a.

     '継承:'

     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: 3a4.

     'デフォルト'

     This slot has no default.  For *note static types: b64, if the
     field is ‘NULL’ then no *note __dict__: 1ca. gets created for
     instances.

     If the *note Py_TPFLAGS_MANAGED_DICT: 3a4. bit is set in the *note
     tp_flags: 1e87. field, then *note tp_dictoffset: 565a. will be set
     to ‘-1’, to indicate that it is unsafe to use this field.

 -- C のメンバ変数: *note initproc: 5502. *note PyTypeObject:
          e6f.tp_init

     ' The corresponding *note slot ID: 542a. ‘Py_tp_init’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、インスタンス初期化関数を指します。

     This function corresponds to the *note __init__(): 306. 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__(): 306.

     *note tp_init: 988. 関数のフィールドが ‘NULL’ でない場合、通常の型
     を呼び出す方法のインスタンス生成において、型の *note tp_new: 986. 関
     数がインスタンスを返した後に呼び出されます。 ‘tp_new’ が元の型のサ
     ブタイプでない別の型を返す場合、 ‘tp_init’ は全く呼び出されません;
     ‘tp_new’ が元の型のサブタイプのインスタンスを返す場合、サブタイプの
     ‘tp_init’ が呼び出されます。

     成功のときには ‘0’ を、エラー時には例外をセットして ‘-1’ を返します
     。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     For *note static types: b64. this field does not have a default.

 -- C のメンバ変数: *note allocfunc: 54f7. *note PyTypeObject:
          e6f.tp_alloc

     ' The corresponding *note slot ID: 542a. ‘Py_tp_alloc’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、インスタンスのメモリ確保関数を指します。

     関数のシグネチャは次のとおりです

          PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);

     '継承:'

     Static subtypes inherit this slot, which will be *note
     PyType_GenericAlloc(): e34. if inherited from *note object: e51.

     *note Heap subtypes: d33. do not inherit this slot.

     'デフォルト'

     For heap subtypes, this field is always set to *note
     PyType_GenericAlloc(): e34.

     For static subtypes, this slot is inherited (see above).

 -- C のメンバ変数: *note newfunc: 5506. *note PyTypeObject: e6f.tp_new

     ' The corresponding *note slot ID: 542a. ‘Py_tp_new’ is part of the
     *note Stable ABI: 961.'

     オプションのポインタで、インスタンス生成関数を指します。

     関数のシグネチャは次のとおりです

          PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);

     'subtype' 引数は生成するオブジェクトの型です; 'args' および 'kwds'
     引数は、型を呼び出すときの位置引数およびキーワード引数です。
     'subtype' は *note tp_new: 986. 関数を呼び出すときに使う型と同じで
     ある必要はないことに注意してください; その型の (無関係ではない) サ
     ブタイプのこともあります。

     *note tp_new: 986. 関数は ‘subtype->tp_alloc(subtype, nitems)’ を呼
     び出してオブジェクトのメモリ領域を確保し、初期化で絶対に必要とされ
     る処理だけを行います。省略したり繰り返したりしても問題のない初期化
     処理は *note tp_init: 988. ハンドラ内に配置しなければなりません。だ
     いたいの目安としては、変更不能な型では初期化は全て ‘tp_new’ で行い
     、一方、変更可能な型ではほとんどの初期化を ‘tp_init’ に回すべきです
     。

     Set the *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 989. flag to
     disallow creating instances of the type in Python.

     '継承:'

     サブタイプはこのフィールドを継承します。例外として、 *note tp_base:
     2585. が ‘NULL’ か ‘&PyBaseObject_Type’ になっている *note
     静的な型: b64. では継承しません。

     'デフォルト'

     For *note static types: b64. 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: 57ca. *note PyTypeObject:
          e6f.tp_free

     ' The corresponding *note slot ID: 542a. ‘Py_tp_free’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、インスタンスのメモリ解放関数を指します。シ
     グネチャは以下の通りです:

          void tp_free(void *self);

     This function must free the memory allocated by *note tp_alloc:
     51f5.

     '継承:'

     Static subtypes inherit this slot, which will be *note
     PyObject_Free(): 1028. if inherited from *note object: e51.
     Exception: If the type supports garbage collection (i.e., the *note
     Py_TPFLAGS_HAVE_GC: 3a6. flag is set in *note tp_flags: 1e87.) and
     it would inherit ‘PyObject_Free()’, then this slot is not inherited
     but instead defaults to *note PyObject_GC_Del(): 18bb.

     *note Heap subtypes: d33. do not inherit this slot.

     'デフォルト'

     For *note heap subtypes: d33, this slot defaults to a deallocator
     suitable to match *note PyType_GenericAlloc(): e34. and the value
     of the *note Py_TPFLAGS_HAVE_GC: 3a6. flag.

     For static subtypes, this slot is inherited (see above).

 -- C のメンバ変数: *note inquiry: 5503. *note PyTypeObject:
          e6f.tp_is_gc

     ' The corresponding *note slot ID: 542a. ‘Py_tp_is_gc’ is part of
     the *note Stable ABI: 961.'

     オプションのポインタで、ガベージコレクタから呼び出される関数を指し
     ます。

     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: 1e87. field, and check the *note
     Py_TPFLAGS_HAVE_GC: 3a6. 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: 95d. は、型のメモリ確保が静的か *note 動的: d33. かを
     区別するためにこの関数を定義しています。)

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     This slot has no default.  If this field is ‘NULL’, *note
     Py_TPFLAGS_HAVE_GC: 3a6. is used as the functional equivalent.

 -- C のメンバ変数: *note PyObject: 1a6. **note PyTypeObject:
          e6f.tp_bases

     ' The corresponding *note slot ID: 542a. ‘Py_tp_bases’ is part of
     the *note Stable ABI: 961.'

     基底型からなるタプルです。

     This field should be set to ‘NULL’ and treated as read-only.
     Python will fill it in when the type is *note initialized: b63.

     For dynamically created classes, the *note Py_tp_bases: 54db. *note
     slot: 542a. can be used instead of the 'bases' argument of *note
     PyType_FromSpecWithBases(): 397.  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: 1a6. **note PyTypeObject: e6f.tp_mro

     基底タイプ群を展開した集合が入っているタプルです。集合は該当する型
     自体からはじまり、 *note object: e51. で終わります。メソッド解決順
     序 (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: b63.

     '継承:'

     このフィールドは継承されません; フィールドの値は *note
     PyType_Ready(): b63. で毎回計算されます。

 -- C のメンバ変数: *note PyObject: 1a6. **note PyTypeObject:
          e6f.tp_cache

     未使用のフィールドです。内部でのみ利用されます。

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: void **note PyTypeObject: e6f.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__(): 97d.

     バージョン 3.12 で変更: For some types, this field does not hold a
     valid *note PyObject: 1a6.*.  The type was changed to void* to
     indicate this.

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: *note PyObject: 1a6. **note PyTypeObject:
          e6f.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: 54fb. *note PyTypeObject:
          e6f.tp_del

     ' The corresponding *note slot ID: 542a. ‘Py_tp_del’ is part of the
     *note Stable ABI: 961.'

     このフィールドは廃止されました。*note tp_finalize: e70. を代わりに
     利用してください。

 -- C のメンバ変数: unsigned int *note PyTypeObject: e6f.tp_version_tag

     メソッドキャッシュへのインデックスとして使われます。内部使用だけの
     ための関数です。

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: *note destructor: 54fb. *note PyTypeObject:
          e6f.tp_finalize

     ' The corresponding *note slot ID: 542a. ‘Py_tp_finalize’ is part
     of the *note Stable ABI: 961. (バージョン 3.5 より).'

     An optional pointer to an instance finalization function.  This is
     the C implementation of the *note __del__(): 13ab. 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: 5206.) 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: 5206.) 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: 51e2.) is
          called.  It is recommended to call *note
          PyObject_CallFinalizerFromDealloc(): 359. at the beginning of
          ‘tp_dealloc’ to guarantee that the object is always finalized
          before destruction.

          注釈: The *note tp_finalize: e70. function can be called from
          any thread, although the *note GIL: 418. 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__(): 13ab. 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: 3a6. flag is
          set in *note tp_flags: 1e87.) 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: 597d.), 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(): 5980. or
     *note PyObject_CallFinalizerFromDealloc(): 359.  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: 597d.

        * 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: 3a6. flag is
          not set.  Such objects can still be manually finalized by
          calling *note PyObject_CallFinalizer(): 5980. or *note
          PyObject_CallFinalizerFromDealloc(): 359.

        * Python will not automatically finalize any two members of a
          *note cyclic isolate: 597d. concurrently.

        * Python will not automatically finalize an object after it has
          automatically cleared (*note tp_clear: 5206.) the object.

        * If an object is a member of a *note cyclic isolate: 597d,
          Python will not automatically finalize it after automatically
          clearing (see *note tp_clear: 5206.) any other member.

        * Python will automatically finalize every member of a *note
          cyclic isolate: 597d. before it automatically clears (see
          *note tp_clear: 5206.) any of them.

        * If Python is going to automatically clear an object (*note
          tp_clear: 5206.), it will automatically finalize the object
          first.

     Python currently only automatically finalizes objects that are
     members of a *note cyclic isolate: 597d, 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(): 5980. or *note
     PyObject_CallFinalizerFromDealloc(): 359. instead.

     *note tp_finalize: e70. 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(): 643. and restore the exception at the
     end by calling *note PyErr_SetRaisedException(): 646.  If an
     exception is encountered in the middle of the finalizer, log and
     clear it with *note PyErr_WriteUnraisable(): 7ee. or *note
     PyErr_FormatUnraisable(): 7ed.  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: 641. flags bit in order for
     this field to be used.  This is no longer required.

     参考
     ....

        * PEP 442(3): "Safe object finalization"

        * *note Object Life Cycle: 5979. for details about how this slot
          relates to other slots.

        * *note PyObject_CallFinalizer(): 5980.

        * *note PyObject_CallFinalizerFromDealloc(): 359.

 -- C のメンバ変数: *note vectorcallfunc: 965. *note PyTypeObject:
          e6f.tp_vectorcall

     ' The corresponding *note slot ID: 542a. ‘Py_tp_vectorcall’ is part
     of the *note Stable ABI: 961. (バージョン 3.14 より).'

     A *note vectorcall function: 960. 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: 960. 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: 95d.->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: 986. and *note tp_init:
          988.  When doing this for user-subclassable types, note that
          both can be overridden (using *note __new__(): 987. and *note
          __init__(): 306, respectively).

     '継承:'

     このフィールドは決して継承されません。

     Added in version 3.9: （このフィールドは3.8から存在していますが、
     3.9以降でしか利用できません）

 -- C のメンバ変数: unsigned char *note PyTypeObject: e6f.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://peps.python.org/pep-0442/


File: python.info,  Node: Static Types,  Next: Heap Types,  Prev: PyTypeObject スロット,  Up: Type Object Structures

7.22.4.9 Static Types
.....................

Traditionally, types defined in C code are 'static', that is, a static
*note PyTypeObject: e6f. structure is defined directly in code and
initialized using *note PyType_Ready(): b63.

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: 417,
     so they should not include any subinterpreter-specific state.

Also, since *note PyTypeObject: e6f. is only part of the *note Limited
API: 82f. 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.22.4.10 Heap Types
....................

An alternative to *note static types: b64. 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: c86. flag set.

This is done by filling a *note PyType_Spec: 1cae. structure and calling
*note PyType_FromSpec(): 396, *note PyType_FromSpecWithBases(): 397,
*note PyType_FromModuleAndSpec(): 398, or *note PyType_FromMetaclass():
399.


File: python.info,  Node: 数値オブジェクト構造体,  Next: マップオブジェクト構造体,  Prev: Heap Types,  Up: Type Object Structures

7.22.4.11 数値オブジェクト構造体
................................

 -- C のデータ型: type PyNumberMethods

     この構造体は数値型プロトコルを実装するために使われる関数群へのポイ
     ンタを保持しています。 以下のそれぞれの関数は *note 数値型プロトコル
     (number protocol): 5612. で解説されている似た名前の関数から利用され
     ます。

     以下は構造体の定義です:

          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: 59d5. field should always be
          ‘NULL’.  It was previously called ‘nb_long’, and was renamed
          in Python 3.0.1.

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_add

     ' The corresponding *note slot ID: 542a. ‘Py_nb_add’ is part of the
     *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_subtract

     ' The corresponding *note slot ID: 542a. ‘Py_nb_subtract’ is part
     of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_multiply

     ' The corresponding *note slot ID: 542a. ‘Py_nb_multiply’ is part
     of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_remainder

     ' The corresponding *note slot ID: 542a. ‘Py_nb_remainder’ is part
     of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_divmod

     ' The corresponding *note slot ID: 542a. ‘Py_nb_divmod’ is part of
     the *note Stable ABI: 961.'

 -- C のメンバ変数: *note ternaryfunc: 5511. *note PyNumberMethods:
          17d6.nb_power

     ' The corresponding *note slot ID: 542a. ‘Py_nb_power’ is part of
     the *note Stable ABI: 961.'

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyNumberMethods:
          17d6.nb_negative

     ' The corresponding *note slot ID: 542a. ‘Py_nb_negative’ is part
     of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyNumberMethods:
          17d6.nb_positive

     ' The corresponding *note slot ID: 542a. ‘Py_nb_positive’ is part
     of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyNumberMethods:
          17d6.nb_absolute

     ' The corresponding *note slot ID: 542a. ‘Py_nb_absolute’ is part
     of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note inquiry: 5503. *note PyNumberMethods:
          17d6.nb_bool

     ' The corresponding *note slot ID: 542a. ‘Py_nb_bool’ is part of
     the *note Stable ABI: 961.'

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyNumberMethods:
          17d6.nb_invert

     ' The corresponding *note slot ID: 542a. ‘Py_nb_invert’ is part of
     the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_lshift

     ' The corresponding *note slot ID: 542a. ‘Py_nb_lshift’ is part of
     the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_rshift

     ' The corresponding *note slot ID: 542a. ‘Py_nb_rshift’ is part of
     the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_and

     ' The corresponding *note slot ID: 542a. ‘Py_nb_and’ is part of the
     *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_xor

     ' The corresponding *note slot ID: 542a. ‘Py_nb_xor’ is part of the
     *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_or

     ' The corresponding *note slot ID: 542a. ‘Py_nb_or’ is part of the
     *note Stable ABI: 961.'

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyNumberMethods:
          17d6.nb_int

     ' The corresponding *note slot ID: 542a. ‘Py_nb_int’ is part of the
     *note Stable ABI: 961.'

 -- C のメンバ変数: void **note PyNumberMethods: 17d6.nb_reserved

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyNumberMethods:
          17d6.nb_float

     ' The corresponding *note slot ID: 542a. ‘Py_nb_float’ is part of
     the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_add

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_add’ is
     part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_subtract

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_subtract’
     is part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_multiply

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_multiply’
     is part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_remainder

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_remainder’
     is part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note ternaryfunc: 5511. *note PyNumberMethods:
          17d6.nb_inplace_power

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_power’ is
     part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_lshift

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_lshift’ is
     part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_rshift

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_rshift’ is
     part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_and

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_and’ is
     part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_xor

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_xor’ is
     part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_or

     ' The corresponding *note slot ID: 542a. ‘Py_nb_inplace_or’ is part
     of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_floor_divide

     ' The corresponding *note slot ID: 542a. ‘Py_nb_floor_divide’ is
     part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_true_divide

     ' The corresponding *note slot ID: 542a. ‘Py_nb_true_divide’ is
     part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_floor_divide

     ' The corresponding *note slot ID: 542a.
     ‘Py_nb_inplace_floor_divide’ is part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_true_divide

     ' The corresponding *note slot ID: 542a.
     ‘Py_nb_inplace_true_divide’ is part of the *note Stable ABI: 961.'

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyNumberMethods:
          17d6.nb_index

     ' The corresponding *note slot ID: 542a. ‘Py_nb_index’ is part of
     the *note Stable ABI: 961.'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_matrix_multiply

     ' The corresponding *note slot ID: 542a. ‘Py_nb_matrix_multiply’ is
     part of the *note Stable ABI: 961. (バージョン 3.5 より).'

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyNumberMethods:
          17d6.nb_inplace_matrix_multiply

     ' The corresponding *note slot ID: 542a.
     ‘Py_nb_inplace_matrix_multiply’ is part of the *note Stable ABI:
     961. (バージョン 3.5 より).'


File: python.info,  Node: マップオブジェクト構造体,  Next: シーケンスオブジェクト構造体,  Prev: 数値オブジェクト構造体,  Up: Type Object Structures

7.22.4.12 マップオブジェクト構造体
..................................

 -- C のデータ型: type PyMappingMethods

     この構造体はマップ型プロトコルを実装するために使われる関数群へのポ
     インタを保持しています。 以下の3つのメンバを持っています:

 -- C のメンバ変数: *note lenfunc: 5505. *note PyMappingMethods:
          5219.mp_length

     ' The corresponding *note slot ID: 542a. ‘Py_mp_length’ is part of
     the *note Stable ABI: 961.'

     この関数は *note PyMapping_Size(): 2043. や *note PyObject_Size():
     53de. から利用され、それらと同じシグネチャを持っています。オブジェ
     クトが定義された長さを持たない場合は、このスロットは ‘NULL’ に設定
     されることがあります。

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PyMappingMethods:
          5219.mp_subscript

     ' The corresponding *note slot ID: 542a. ‘Py_mp_subscript’ is part
     of the *note Stable ABI: 961.'

     この関数は *note PyObject_GetItem(): 7e8. および *note
     PySequence_GetSlice(): 53ea. から利用され、‘PyObject_GetItem()’ と
     同じシグネチャを持っています。このスロットは *note
     PyMapping_Check(): 5392. が ‘1’ を返すためには必要で、そうでなけれ
     ば ‘NULL’ の場合があります。

 -- C のメンバ変数: *note objobjargproc: 5507. *note PyMappingMethods:
          5219.mp_ass_subscript

     ' The corresponding *note slot ID: 542a. ‘Py_mp_ass_subscript’ is
     part of the *note Stable ABI: 961.'

     This function is used by *note PyObject_SetItem(): 526e, *note
     PyObject_DelItem(): 53d1, *note PySequence_SetSlice(): 53f1. and
     *note PySequence_DelSlice(): 53e9.  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.22.4.13 シーケンスオブジェクト構造体
......................................

 -- C のデータ型: type PySequenceMethods

     この構造体はシーケンス型プロトコルを実装するために使われる関数群へ
     のポインタを保持しています。

 -- C のメンバ変数: *note lenfunc: 5505. *note PySequenceMethods:
          5218.sq_length

     ' The corresponding *note slot ID: 542a. ‘Py_sq_length’ is part of
     the *note Stable ABI: 961.'

     This function is used by *note PySequence_Size(): 203f. and *note
     PyObject_Size(): 53de, and has the same signature.  It is also used
     for handling negative indices via the *note sq_item: 1f09. and the
     *note sq_ass_item: 59e1. slots.

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PySequenceMethods:
          5218.sq_concat

     ' The corresponding *note slot ID: 542a. ‘Py_sq_concat’ is part of
     the *note Stable ABI: 961.'

     この関数は *note PySequence_Concat(): 53e7. で利用され、同じシグネ
     チャを持っています。また、 ‘+’ 演算子でも、 *note nb_add: 5653. ス
     ロットによる数値加算を試した後に利用されます。

 -- C のメンバ変数: *note ssizeargfunc: 550f. *note PySequenceMethods:
          5218.sq_repeat

     ' The corresponding *note slot ID: 542a. ‘Py_sq_repeat’ is part of
     the *note Stable ABI: 961.'

     この関数は *note PySequence_Repeat(): 53f0. で利用され、同じシグネ
     チャを持っています。また、 ‘*’ 演算でも、 *note nb_multiply: 59be.
     スロットによる数値乗算を試したあとに利用されます。

 -- C のメンバ変数: *note ssizeargfunc: 550f. *note PySequenceMethods:
          5218.sq_item

     ' The corresponding *note slot ID: 542a. ‘Py_sq_item’ is part of
     the *note Stable ABI: 961.'

     This function is used by *note PySequence_GetItem(): 2040. and has
     the same signature.  It is also used by *note PyObject_GetItem():
     7e8, after trying the subscription via the *note mp_subscript:
     1f0a. slot.  This slot must be filled for the *note
     PySequence_Check(): 53e6. function to return ‘1’, it can be ‘NULL’
     otherwise.

     Negative indexes are handled as follows: if the *note sq_length:
     5659. slot is filled, it is called and the sequence length is used
     to compute a positive index which is passed to *note sq_item: 1f09.
     If ‘sq_length’ is ‘NULL’, the index is passed as is to the
     function.

 -- C のメンバ変数: *note ssizeobjargproc: 5510. *note
          PySequenceMethods: 5218.sq_ass_item

     ' The corresponding *note slot ID: 542a. ‘Py_sq_ass_item’ is part
     of the *note Stable ABI: 961.'

     This function is used by *note PySequence_SetItem(): 2041. and has
     the same signature.  It is also used by *note PyObject_SetItem():
     526e. and *note PyObject_DelItem(): 53d1, after trying the item
     assignment and deletion via the *note mp_ass_subscript: 59de. slot.
     This slot may be left to ‘NULL’ if the object does not support item
     assignment and deletion.

 -- C のメンバ変数: *note objobjproc: 5508. *note PySequenceMethods:
          5218.sq_contains

     ' The corresponding *note slot ID: 542a. ‘Py_sq_contains’ is part
     of the *note Stable ABI: 961.'

     この関数は *note PySequence_Contains(): 60c. から利用され、同じシグ
     ネチャを持っています。このスロットは ‘NULL’ の場合があり、その時
     ‘PySequence_Contains()’ はシンプルにマッチするオブジェクトを見つけ
     るまでシーケンスを巡回します。

 -- C のメンバ変数: *note binaryfunc: 54f8. *note PySequenceMethods:
          5218.sq_inplace_concat

     ' The corresponding *note slot ID: 542a. ‘Py_sq_inplace_concat’ is
     part of the *note Stable ABI: 961.'

     This function is used by *note PySequence_InPlaceConcat(): 53eb.
     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(): 53e7.  It is also used by the augmented
     assignment ‘+=’, after trying numeric in-place addition via the
     *note nb_inplace_add: 59bb. slot.

 -- C のメンバ変数: *note ssizeargfunc: 550f. *note PySequenceMethods:
          5218.sq_inplace_repeat

     ' The corresponding *note slot ID: 542a. ‘Py_sq_inplace_repeat’ is
     part of the *note Stable ABI: 961.'

     This function is used by *note PySequence_InPlaceRepeat(): 53ec.
     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(): 53f0.  It is also used by the augmented
     assignment ‘*=’, after trying numeric in-place multiplication via
     the *note nb_inplace_multiply: 59bf. slot.


File: python.info,  Node: バッファオブジェクト構造体 buffer object structure,  Next: async オブジェクト構造体,  Prev: シーケンスオブジェクト構造体,  Up: Type Object Structures

7.22.4.14 バッファオブジェクト構造体 (buffer object structure)
..............................................................

 -- C のデータ型: type PyBufferProcs

     この構造体は *note buffer プロトコル: 319. が要求する関数群へのポイ
     ンタを保持しています。 そのプロトコルは、エクスポーターオブジェクト
     が如何にして、その内部データをコンシューマオブジェクトに渡すかを定
     義します。

 -- C のメンバ変数: *note getbufferproc: 54fe. *note PyBufferProcs:
          565f.bf_getbuffer

     ' The corresponding *note slot ID: 542a. ‘Py_bf_getbuffer’ is part
     of the *note Stable ABI: 961. (バージョン 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: 19b9, set view->obj to ‘NULL’ and return ‘-1’.

       2. 要求されたフィールドを埋めます。

       3. エクスポートした回数を保持する内部カウンタをインクリメントしま
          す。

       4. view->obj に 'exporter' を設定し、 view->obj をインクリメント
          します。

       5. ‘0’ を返します。

     'Thread safety:'

     In the *note free-threaded build: 1a3, 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: 1d1.), the export counter is checked
          atomically before such operations, and *note BufferError:
          19b9. is raised if exports exist.

        * The function is safe to call concurrently from multiple
          threads.

     See also *note Thread safety for memoryview objects: 2625. for the
     Python-level thread safety guarantees of *note memoryview: 1dd.
     objects.

     'exporter' がバッファプロバイダのチェインかツリーの一部であれば、２
     つの主要な方式が使用できます:

        * 再エクスポート: ツリーの各要素がエクスポートされるオブジェクト
          として振る舞い、自身への新しい参照を view->obj へセットします
          。

        * リダイレクト: バッファ要求がツリーのルートオブジェクトにリダイ
          レクトされます。ここでは、 view->obj はルートオブジェクトへの
          新しい参照になります。

     'view' の個別のフィールドは *note バッファ構造体: 5629. の節で説明
     されており、エクスポートが特定の要求に対しどう対応しなければならな
     いかの規則は、 *note バッファ要求のタイプ: 13f4. の節にあります。

     *note Py_buffer: b3f. 構造体の中から参照している全てのメモリはエク
     スポータに属し、コンシューマがいなくなるまで有効でなくてはなりませ
     ん。 *note format: 5632. 、 *note shape: 5633. 、 *note strides:
     562d. 、 *note suboffsets: 5635. 、 *note internal: 5637. はコンシ
     ューマからは読み出し専用です。

     *note PyBuffer_FillInfo(): b47. は、全てのリクエストタイプを正しく
     扱う際に、単純なバイトバッファを公開する簡単な方法を提供します。

     *note PyObject_GetBuffer(): 832. は、この関数をラップするコンシュー
     マ向けのインターフェースです。

 -- C のメンバ変数: *note releasebufferproc: 5509. *note PyBufferProcs:
          565f.bf_releasebuffer

     ' The corresponding *note slot ID: 542a. ‘Py_bf_releasebuffer’ is
     part of the *note Stable ABI: 961. (バージョン 3.11 より).'

     この関数のシグネチャは以下の通りです:

          void (PyObject *exporter, Py_buffer *view);

     バッファのリソースを開放する要求を処理します。もし開放する必要のあ
     るリソースがない場合、 *note PyBufferProcs.bf_releasebuffer: b4a. は
     ‘NULL’ にしても構いません。そうでない場合は、この関数の標準的な実装
     は、以下の任意の処理手順 (optional step) を行います:

       1. エクスポートした回数を保持する内部カウンタをデクリメントします
          。

       2. カウンタが ‘0’ の場合は、'view' に関連付けられた全てのメモリを
          解放します。

     'Thread safety:'

     In the *note free-threaded build: 1a3.:

        * 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: 5637. フィールドを使わなければなりません。このフィールド
     は、コンシューマが 'view' 引数としてオリジナルのバッファのコピーを
     渡しているであろう間、変わらないことが保証されています。

     この関数は、view->obj をデクリメントしてはいけません、なぜならそれ
     は *note PyBuffer_Release(): 833. で自動的に行われるからです(この方
     式は参照の循環を防ぐのに有用です)。

     *note PyBuffer_Release(): 833. は、この関数をラップするコンシューマ
     向けのインターフェースです。


File: python.info,  Node: async オブジェクト構造体,  Next: Slot Type typedefs,  Prev: バッファオブジェクト構造体 buffer object structure,  Up: Type Object Structures

7.22.4.15 async オブジェクト構造体
..................................

Added in version 3.5.

 -- C のデータ型: type PyAsyncMethods

     この構造体は *note awaitable: 6d5. オブジェクトと *note
     asynchronous iterator: 6d3. オブジェクトを実装するのに必要な関数へ
     のポインタを保持しています。

     以下は構造体の定義です:

          typedef struct {
              unaryfunc am_await;
              unaryfunc am_aiter;
              unaryfunc am_anext;
              sendfunc am_send;
          } PyAsyncMethods;

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyAsyncMethods:
          5658.am_await

     ' The corresponding *note slot ID: 542a. ‘Py_am_await’ is part of
     the *note Stable ABI: 961. (バージョン 3.5 より).'

     この関数のシグネチャは以下の通りです:

          PyObject *am_await(PyObject *self);

     返されるオブジェクトは *note イテレータ: 6d4. でなければなりません
     。 つまりこのオブジェクトに対して *note PyIter_Check(): 1ec7. が
     ‘1’ を返さなければなりません。

     オブジェクトが *note awaitable: 6d5. でない場合、このスロットを
     ‘NULL’ に設定します。

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyAsyncMethods:
          5658.am_aiter

     ' The corresponding *note slot ID: 542a. ‘Py_am_aiter’ is part of
     the *note Stable ABI: 961. (バージョン 3.5 より).'

     この関数のシグネチャは以下の通りです:

          PyObject *am_aiter(PyObject *self);

     Must return an *note asynchronous iterator: 6d3. object.  See *note
     __anext__(): 1ac6. for details.

     オブジェクトが非同期反復処理のプロトコルを実装していない場合、この
     スロットを ‘NULL’ に設定します。

 -- C のメンバ変数: *note unaryfunc: 5513. *note PyAsyncMethods:
          5658.am_anext

     ' The corresponding *note slot ID: 542a. ‘Py_am_anext’ is part of
     the *note Stable ABI: 961. (バージョン 3.5 より).'

     この関数のシグネチャは以下の通りです:

          PyObject *am_anext(PyObject *self);

     Must return an *note awaitable: 6d5. object.  See *note
     __anext__(): 1ac6. for details.  This slot may be set to ‘NULL’.

 -- C のメンバ変数: *note sendfunc: 59ba. *note PyAsyncMethods:
          5658.am_send

     ' The corresponding *note slot ID: 542a. ‘Py_am_send’ is part of
     the *note Stable ABI: 961. (バージョン 3.10 より).'

     この関数のシグネチャは以下の通りです:

          PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);

     See *note PyIter_Send(): c72. 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.22.4.16 Slot Type typedefs
............................

 -- C のデータ型: typedef *note PyObject: 1a6. *(*allocfunc)(*note
          PyTypeObject: e6f. *cls, *note Py_ssize_t: e28. nitems)
     ' 次に属します: *note Stable ABI: 961.'  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: c79. set to ‘1’ and *note
     ob_type: 51f2. set to the type argument.  If the type's *note
     tp_itemsize: 25cf. is non-zero, the object's *note ob_size: 546b.
     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: d53.

     この関数では他のいかなるインスタンス初期化も行ってはなりません。追
     加のメモリ割り当てすらも行ってはなりません。そのような処理は *note
     tp_new: 986. で行われるべきです。

 -- C のデータ型: typedef void (*destructor)(*note PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'

 -- C のデータ型: typedef void (*freefunc)(void*)

     *note tp_free: 51f4. を参照してください。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*newfunc)(*note
          PyTypeObject: e6f.*, *note PyObject: 1a6.*, *note PyObject:
          1a6.*)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_new: 986. を参照
     してください。

 -- C のデータ型: typedef int (*initproc)(*note PyObject: 1a6.*, *note
          PyObject: 1a6.*, *note PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_init: 988. を参照
     してください。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*reprfunc)(*note
          PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_repr: 5208. を参
     照してください。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*getattrfunc)(*note
          PyObject: 1a6. *self, char *attr)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクトの属性の値を返
     します。

 -- C のデータ型: typedef int (*setattrfunc)(*note PyObject: 1a6. *self,
          char *attr, *note PyObject: 1a6. *value)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクトの属性に値を設
     定します。属性を削除するには、 value (実) 引数に ‘NULL’ を設定しま
     す。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*getattrofunc)(*note
          PyObject: 1a6. *self, *note PyObject: 1a6. *attr)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクトの属性の値を返
     します。

     *note tp_getattro: 1c89. を参照してください。

 -- C のデータ型: typedef int (*setattrofunc)(*note PyObject: 1a6.
          *self, *note PyObject: 1a6. *attr, *note PyObject: 1a6.
          *value)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクトの属性に値を設
     定します。属性を削除するには、 value (実) 引数に ‘NULL’ を設定しま
     す。

     *note tp_setattro: 520c. を参照してください。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*descrgetfunc)(*note
          PyObject: 1a6.*, *note PyObject: 1a6.*, *note PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_descr_get: 57e3.
     を参照してください。

 -- C のデータ型: typedef int (*descrsetfunc)(*note PyObject: 1a6.*,
          *note PyObject: 1a6.*, *note PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_descr_set: 1ec9.
     を参照してください。

 -- C のデータ型: typedef *note Py_hash_t: 161d. (*hashfunc)(*note
          PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_hash: 521a. を参
     照してください。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*richcmpfunc)(*note
          PyObject: 1a6.*, *note PyObject: 1a6.*, int)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_richcompare:
     5214. を参照してください。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*getiterfunc)(*note
          PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_iter: 18a7. を参
     照してください。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*iternextfunc)(*note
          PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_iternext: 18a8. を
     参照してください。

 -- C のデータ型: typedef *note Py_ssize_t: e28. (*lenfunc)(*note
          PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'

 -- C のデータ型: typedef int (*getbufferproc)(*note PyObject: 1a6.*,
          *note Py_buffer: b3f.*, int)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'

 -- C のデータ型: typedef void (*releasebufferproc)(*note PyObject:
          1a6.*, *note Py_buffer: b3f.*)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.12 より).'

 -- C のデータ型: typedef *note PyObject: 1a6. *(*unaryfunc)(*note
          PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'

 -- C のデータ型: typedef *note PyObject: 1a6. *(*binaryfunc)(*note
          PyObject: 1a6.*, *note PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'

 -- C のデータ型: typedef *note PySendResult: 5625. (*sendfunc)(*note
          PyObject: 1a6.*, *note PyObject: 1a6.*, *note PyObject:
          1a6.**)

     *note am_send: 59b9. を参照してください。

 -- C のデータ型: typedef *note PyObject: 1a6. *(*ternaryfunc)(*note
          PyObject: 1a6.*, *note PyObject: 1a6.*, *note PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'

 -- C のデータ型: typedef *note PyObject: 1a6. *(*ssizeargfunc)(*note
          PyObject: 1a6.*, *note Py_ssize_t: e28.)
     ' 次に属します: *note Stable ABI: 961.'

 -- C のデータ型: typedef int (*ssizeobjargproc)(*note PyObject: 1a6.*,
          *note Py_ssize_t: e28, *note PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'

 -- C のデータ型: typedef int (*objobjproc)(*note PyObject: 1a6.*, *note
          PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'

 -- C のデータ型: typedef int (*objobjargproc)(*note PyObject: 1a6.*,
          *note PyObject: 1a6.*, *note PyObject: 1a6.*)
     ' 次に属します: *note Stable ABI: 961.'


File: python.info,  Node: 使用例<57>,  Prev: Slot Type typedefs,  Up: Type Object Structures

7.22.4.17 使用例
................

ここでは Python の型定義の簡単な例をいくつか挙げます。これらの例にはあな
たが遭遇する共通的な利用例を含んでいます。いくつかの例ではトリッキーなコ
ーナーケースを実演しています。より多くの例や実践的な情報、チュートリアル
が必要なら、*note 拡張の型の定義; チュートリアル: 51eb. や *note
拡張の型の定義; 雑多なトピック: 5202. を参照してください。

A basic *note static type: b64.:

     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: 989. 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: b64. 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: b64. 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.22.5 循環参照ガベージコレクションをサポートする
-------------------------------------------------

Python が循環参照を含むガベージの検出とコレクションをサポートするには、
他のオブジェクトに対する "コンテナ" (他のオブジェクトには他のコンテナも
含みます) となるオブジェクト型によるサポートが必要です。他のオブジェクト
に対する参照を記憶しないオブジェクトや、(数値や文字列のような) アトム型
(atomic type) への参照だけを記憶するような型では、ガベージコレクションに
際して特別これといったサポートを提供する必要はありません。

To create a container type, the *note tp_flags: 1e87. field of the type
object must include the *note Py_TPFLAGS_HAVE_GC: 3a6. and provide an
implementation of the *note tp_traverse: 373. handler.  If instances of
the type are mutable, a *note tp_clear: 5206. implementation must also
be provided.

*note Py_TPFLAGS_HAVE_GC: 3a6.

     このフラグをセットした型のオブジェクトは、この節に述べた規則に適合
     しなければなりません。簡単のため、このフラグをセットした型のオブジ
     ェクトをコンテナオブジェクトと呼びます。

コンテナ型のコンストラクタは以下の二つの規則に適合しなければなりません:

  1. The memory for the object must be allocated using *note
     PyObject_GC_New: e6c. or *note PyObject_GC_NewVar: e6d.

  2. 他のコンテナへの参照が入るかもしれないフィールドが全て初期化された
     ら、すぐに *note PyObject_GC_Track(): 18bc. を呼び出さなければなり
     ません。

同様に、オブジェクトのメモリ解放関数も以下の二つの規則に適合しなければな
りません:

  1. 他のコンテナを参照しているフィールドを無効化する前に、 *note
     PyObject_GC_UnTrack(): 18bd. を呼び出さなければなりません。

  2. オブジェクトのメモリは *note PyObject_GC_Del(): 18bb. で解放しなけ
     ればなりません。

          警告: If a type adds the Py_TPFLAGS_HAVE_GC, then it 'must'
          implement at least a *note tp_traverse: 373. handler or
          explicitly use one from its subclass or subclasses.

          When calling *note PyType_Ready(): b63. or some of the APIs
          that indirectly call it like *note PyType_FromSpecWithBases():
          397. or *note PyType_FromSpec(): 396. the interpreter will
          automatically populate the *note tp_flags: 1e87, *note
          tp_traverse: 373. and *note tp_clear: 5206. 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: 3a6. flag.

 -- C のマクロ: PyObject_GC_New (TYPE, typeobj)

     Analogous to *note PyObject_New: d51. but for container objects
     with the *note Py_TPFLAGS_HAVE_GC: 3a6. flag set.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 51f5. slot instead.

     When populating a type's *note tp_alloc: 51f5. slot, *note
     PyType_GenericAlloc(): e34. is preferred over a custom function
     that simply calls this macro.

     Memory allocated by this macro must be freed with *note
     PyObject_GC_Del(): 18bb. (usually called via the object's *note
     tp_free: 51f4. slot).

     参考
     ....

        * *note PyObject_GC_Del(): 18bb.

        * *note PyObject_New: d51.

        * *note PyType_GenericAlloc(): e34.

        * *note tp_alloc: 51f5.

 -- C のマクロ: PyObject_GC_NewVar (TYPE, typeobj, size)

     Analogous to *note PyObject_NewVar: d52. but for container objects
     with the *note Py_TPFLAGS_HAVE_GC: 3a6. flag set.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 51f5. slot instead.

     When populating a type's *note tp_alloc: 51f5. slot, *note
     PyType_GenericAlloc(): e34. is preferred over a custom function
     that simply calls this macro.

     Memory allocated by this macro must be freed with *note
     PyObject_GC_Del(): 18bb. (usually called via the object's *note
     tp_free: 51f4. slot).

     参考
     ....

        * *note PyObject_GC_Del(): 18bb.

        * *note PyObject_NewVar: d52.

        * *note PyType_GenericAlloc(): e34.

        * *note tp_alloc: 51f5.

 -- C の関数: *note PyObject: 1a6.
          *PyUnstable_Object_GC_NewWithExtraData (PyTypeObject *type,
          size_t extra_size)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     Analogous to *note PyObject_GC_New: e6c. but allocates 'extra_size'
     bytes at the end of the object (at offset *note tp_basicsize:
     d53.).  The allocated memory is initialized to zeros, except for
     the *note Python object header: 1a6.

     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(): 18bb. (usually called via the object's *note
     tp_free: 51f4. 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: 493d. and *note tp_itemsize:
          25cf. instead.

     Added in version 3.12.

 -- C のマクロ: PyObject_GC_Resize (TYPE, op, newsize)

     Resize an object allocated by *note PyObject_NewVar: d52.  Returns
     the resized object of type ‘TYPE*’ (refers to any C type) or ‘NULL’
     on failure.

     'op' must be of type *note PyVarObject: 493d.* and must not be
     tracked by the collector yet.  'newsize' must be of type *note
     Py_ssize_t: e28.

 -- C の関数: void PyObject_GC_Track (PyObject *op)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクト 'op' を、コレ
     クタによって追跡されるオブジェクトの集合に追加します。コレクタは何
     回動くのかは予想できないので、追跡されている間はオブジェクトは正し
     い状態でいなければなりません。 *note tp_traverse: 373. の対象となる
     全てのフィールドが正しい状態になってすぐに、たいていはコンストラク
     タの末尾付近で、呼び出すべきです。

 -- 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: 961. (バージョン 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():
     16c7.

     Added in version 3.9.

 -- C の関数: int PyObject_GC_IsFinalized (PyObject *op)
     ' 次に属します: *note Stable ABI: 961. (バージョン 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():
     cd1.

     Added in version 3.9.

 -- C の関数: void PyObject_GC_Del (void *op)
     ' 次に属します: *note Stable ABI: 961.'  Releases memory allocated
     to an object using *note PyObject_GC_New: e6c. or *note
     PyObject_GC_NewVar: e6d.

     Do not call this directly to free an object's memory; call the
     type's *note tp_free: 51f4. slot instead.

     Do not use this for memory allocated by *note PyObject_New: d51,
     *note PyObject_NewVar: d52, or related allocation functions; use
     *note PyObject_Free(): 1028. instead.

     参考
     ....

        * *note PyObject_Free(): 1028. is the non-GC equivalent of this
          function.

        * *note PyObject_GC_New: e6c.

        * *note PyObject_GC_NewVar: e6d.

        * *note PyType_GenericAlloc(): e34.

        * *note tp_free: 51f4.

 -- C の関数: void PyObject_GC_UnTrack (void *op)
     ' 次に属します: *note Stable ABI: 961.'  オブジェクト 'op' を、コレ
     クタによって追跡されるオブジェクトの集合から除去します。このオブジ
     ェクトに対して *note PyObject_GC_Track(): 18bc. を再度呼び出して、
     追跡されるオブジェクトの集合に戻すことも可能です。 *note
     tp_traverse: 373. ハンドラの対象となるフィールドが正しくない状態に
     なる前に、デアロケータ (*note tp_dealloc: 51e2. ハンドラ) はオブジ
     ェクトに対して、この関数を呼び出すべきです。

バージョン 3.8 で変更: The ‘_PyObject_GC_TRACK()’ and
‘_PyObject_GC_UNTRACK()’ macros have been removed from the public C API.

*note tp_traverse: 373. ハンドラはこの型の関数パラメータを受け取ります:

 -- C のデータ型: typedef int (*visitproc)(*note PyObject: 1a6. *object,
          void *arg)
     ' 次に属します: *note Stable ABI: 961.'  *note tp_traverse: 373. ハ
     ンドラに渡されるビジター関数 (visitor function) の型です。この関数
     は、探索するオブジェクトを 'object' として、 ‘tp_traverse’ ハンドラ
     の第 3 引数を 'arg' として呼び出します。 Python のコアはいくつかの
     ビジター関数を使って、ゴミとなった循環参照を検出する仕組みを実装し
     ます; ユーザが自身のためにビジター関数を書く必要が出てくることはな
     いでしょう。

*note tp_clear: 5206. ハンドラは *note inquiry: 5503. 型であるか、オブジ
ェクトが不変 (immutable) な場合は ‘NULL’ でなければなりません。

 -- C のデータ型: typedef int (*inquiry)(*note PyObject: 1a6. *self)
     ' 次に属します: *note Stable ABI: 961.'  循環参照を形成しているとお
     ぼしき参照群を放棄します。変更不可能なオブジェクトは循環参照を直接
     形成することが決してないので、この関数を定義する必要はありません。
     このメソッドを呼び出した後でもオブジェクトは有効なままでなければな
     らないので注意してください (参照に対して *note Py_DECREF(): 97a. を
     呼ぶだけにしないでください)。ガベージコレクタは、オブジェクトが循環
     参照を形成していることを検出した際にこのメソッドを呼び出します。

* Menu:

* Traversal::
* Controlling the Garbage Collector State::
* Querying Garbage Collector State::


File: python.info,  Node: Traversal,  Next: Controlling the Garbage Collector State,  Up: 循環参照ガベージコレクションをサポートする

7.22.5.1 Traversal
..................

*note tp_traverse: 373. ハンドラは次の型を持っていなければなりません:

 -- C のデータ型: typedef int (*traverseproc)(*note PyObject: 1a6.
          *self, *note visitproc: 5514. visit, void *arg)
     ' 次に属します: *note Stable ABI: 961.'  Traversal function for a
     garbage-collected object, used by the garbage collector to detect
     reference cycles.  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.

     A typical ‘tp_traverse’ function calls the *note Py_VISIT(): 51fd.
     convenience macro on each of the instance's members that are Python
     objects that the instance owns.  For example, this is a (slightly
     outdated) traversal function for the *note threading.local: 1aa6.
     class:

          static int
          local_traverse(PyObject *op, visitproc visit, void *arg)
          {
              localobject *self = (localobject *) op;
              Py_VISIT(Py_TYPE(self));
              Py_VISIT(self->args);
              Py_VISIT(self->kw);
              Py_VISIT(self->dict);
              return 0;
          }

          注釈: *note Py_VISIT(): 51fd. 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: d33. hold a reference to
     their type.  Their traversal function must therefore visit the
     type:

          Py_VISIT(Py_TYPE(self));

     Alternately, the type may delegate this responsibility by calling
     ‘tp_traverse’ of a heap-allocated superclass (or another
     heap-allocated type, if applicable).  If they do not, the type
     object may not be garbage-collected.

     If the *note Py_TPFLAGS_MANAGED_DICT: 3a4. bit is set in the *note
     tp_flags: 1e87. field, the traverse function must call *note
     PyObject_VisitManagedDict(): 809. like this:

          int err = PyObject_VisitManagedDict((PyObject*)self, visit, arg);
          if (err) {
              return err;
          }

     Only the members that the instance 'owns' (by having *note strong
     references: 7e0. to them) must be visited.  For instance, if an
     object supports weak references via the *note tp_weaklist: 565e.
     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 traversal function has a limitation:

          警告: 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,
          directly or indirectly.

     This means that 'most' Python C API functions may not be used,
     since they can raise a new exception, return a new reference to a
     result object, have internal logic that uses side effects.  Also,
     unless documented otherwise, functions that happen to not have side
     effects may start having them in future versions, without warning.

     For a list of safe functions, see a *note separate section: 5a0d.
     below.

          注釈: The *note Py_VISIT(): 51fd. call may be skipped for
          those members that provably cannot participate in reference
          cycles.  In the ‘local_traverse’ example above, there is also
          a ‘self->key’ member, but it can only be ‘NULL’ or a Python
          string and therefore cannot be part of a reference cycle.

          一方、メンバが循環参照の一部になり得ないと判っていても、デバッ
          グ目的で巡回したい場合があるかもしれないので、 *note gc: 63. モ
          ジュールの *note get_referents(): be3. 関数は循環参照になり得
          ないメンバも返します。

          注釈: The *note tp_traverse: 373. function can be called from
          any thread.

          'CPython 実装の詳細:' Garbage collection is a "stop-the-world"
          operation: even in *note free threading: 48e. builds, only one
          thread state is *note attached: 1ac. when ‘tp_traverse’
          handlers run.

     バージョン 3.9 で変更: Heap-allocated types are expected to visit
     ‘Py_TYPE(self)’ in ‘tp_traverse’.  In earlier versions of Python,
     due to bug 40217(1), doing this may lead to crashes in subclasses.

To simplify writing *note tp_traverse: 373. handlers, a *note
Py_VISIT(): 51fd. 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: 1a6.* 'o' is not ‘NULL’, call the 'visit'
     callback, with arguments 'o' and 'arg'.  If 'visit' returns a
     non-zero value, then return it.

     This corresponds roughly to:

          #define Py_VISIT(o)                             \
             if (op) {                                    \
                int visit_result = visit(o, arg);         \
                if (visit_result != 0) {                  \
                   return visit_result;                   \
                }                                         \
             }

* Menu:

* Traversal-safe functions::
* "DuringGC" functions::

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue40217


File: python.info,  Node: Traversal-safe functions,  Next: "DuringGC" functions,  Up: Traversal

7.22.5.2 Traversal-safe functions
.................................

The following functions and macros are safe to use in a *note
tp_traverse: 373. handler:

   * the 'visit' function passed to ‘tp_traverse’

   * *note Py_VISIT(): 51fd.

   * *note Py_SIZE(): b66.

   * *note Py_TYPE(): 5fc.: if called from a ‘tp_traverse’ handler,
     ‘Py_TYPE()’'s result will be valid for the duration of the handler
     call

   * *note PyObject_VisitManagedDict(): 809.

   * *note PyObject_TypeCheck(): 1eca, *note PyType_IsSubtype(): 5429,
     *note PyType_HasFeature(): 1f4f.

   * ‘Py<TYPE>_Check’ and ‘Py<TYPE>_CheckExact’ - for example, *note
     PyTuple_Check(): 56fd.

   * *note "DuringGC" functions: 5a0d.


File: python.info,  Node: "DuringGC" functions,  Prev: Traversal-safe functions,  Up: Traversal

7.22.5.3 "DuringGC" functions
.............................

The following functions should 'only' be used in a *note tp_traverse:
373. handler; calling them in other contexts may have unintended
consequences.

These functions act like their counterparts without the ‘_DuringGC’
suffix, but they are guaranteed to not have side effects, they do not
set an exception on failure, and they return/set *note borrowed
references: 60a. as detailed in the individual documentation.

Note that these functions may fail (return ‘NULL’ or ‘-1’), but as they
do not set an exception, no error information is available.  In some
cases, failure is not distinguishable from a successful ‘NULL’ result.

 -- C の関数: void *PyObject_GetTypeData_DuringGC (PyObject *o,
          PyTypeObject *cls)
 -- C の関数: void *PyObject_GetItemData_DuringGC (PyObject *o)
 -- C の関数: void *PyType_GetModuleState_DuringGC (PyTypeObject *type)
 -- C の関数: void *PyModule_GetState_DuringGC (PyObject *module)
 -- C の関数: int PyModule_GetToken_DuringGC (PyObject *module, void
          **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     See *note "DuringGC" functions: 5a0d. for common information.

     Added in version 3.15.

     参考
     ....

     *note PyObject_GetTypeData(): 1a5, *note PyObject_GetItemData():
     95c, *note PyType_GetModuleState(): d3c, *note PyModule_GetState():
     d4c, *note PyModule_GetToken(): 53a6, *note
     PyType_GetBaseByToken(): 5e4.

 -- C の関数: int PyType_GetBaseByToken_DuringGC (PyTypeObject *type,
          void *tp_token, PyTypeObject **result)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.15 より).'
     See *note "DuringGC" functions: 5a0d. for common information.

     Sets '*result' to a *note borrowed reference: 60a. rather than a
     strong one.  The reference is valid for the duration of the
     ‘tp_traverse’ handler call.

     Added in version 3.15.

     参考
     ....

     *note PyType_GetBaseByToken(): 5e4.

 -- C の関数: *note PyObject: 1a6. *PyType_GetModule_DuringGC
          (PyTypeObject *type)
 -- C の関数: *note PyObject: 1a6. *PyType_GetModuleByToken_DuringGC
          (PyTypeObject *type, const void *mod_token)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 961. (バージ
     ョン 3.15 より).'  See *note "DuringGC" functions: 5a0d. for common
     information.

     These functions return a *note borrowed reference: 60a, which is
     valid for the duration of the ‘tp_traverse’ handler call.

     Added in version 3.15.

     参考
     ....

     *note PyType_GetModule(): d3b, *note PyType_GetModuleByToken():
     5428.


File: python.info,  Node: Controlling the Garbage Collector State,  Next: Querying Garbage Collector State,  Prev: Traversal,  Up: 循環参照ガベージコレクションをサポートする

7.22.5.4 Controlling the Garbage Collector State
................................................

The C-API provides the following functions for controlling garbage
collection runs.

 -- C の関数: *note Py_ssize_t: e28. PyGC_Collect (void)
     ' 次に属します: *note Stable ABI: 961.'  Perform a full garbage
     collection, if the garbage collector is enabled.  (Note that *note
     gc.collect(): 456. 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: 712.  This
     function does not raise exceptions.

 -- C の関数: int PyGC_Enable (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Enable the garbage collector: similar to *note gc.enable(): 4cfb.
     Returns the previous state, 0 for disabled and 1 for enabled.

     Added in version 3.10.

 -- C の関数: int PyGC_Disable (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Disable the garbage collector: similar to *note gc.disable(): 4cfc.
     Returns the previous state, 0 for disabled and 1 for enabled.

     Added in version 3.10.

 -- C の関数: int PyGC_IsEnabled (void)
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.10 より).'
     Query the state of the garbage collector: similar to *note
     gc.isenabled(): 4cfd.  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.22.5.5 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: 959.です。マイナーリリースで予告なく変更されることがあります。': 
     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: 1a6.
          *object, void *arg)

     Type of the visitor function to be passed to *note
     PyUnstable_GC_VisitObjects(): 5a12.  '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.23 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.23.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: 5b5. for the version used at 'run time'.

バージョン間の API と ABI の安定性については *note C API and ABI
Stability: 961. を参照してください。

 -- 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’ となります。

     For completeness, the values are available as macros:
     ‘PY_RELEASE_LEVEL_ALPHA’ (‘0xA’), ‘PY_RELEASE_LEVEL_BETA’ (‘0xB’),
     ‘PY_RELEASE_LEVEL_GAMMA’ (‘0xC’), and ‘PY_RELEASE_LEVEL_FINAL’
     (‘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(): 5b4. for the encoding details.

     Use this for numeric comparisons, for example, ‘#if PY_VERSION_HEX
     >= ...’.

 -- C のマクロ: PY_VERSION

     The Python version as a string, for example, ‘"3.4.1a2"’.

These macros are defined in Include/patchlevel.h(1).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Include/patchlevel.h


File: python.info,  Node: Run-time version,  Next: Bit-packing macros,  Prev: Build-time version constants,  Up: API と ABI のバージョニング

7.23.2 Run-time version
-----------------------

 -- C 変数: const unsigned long Py_Version
     ' 次に属します: *note Stable ABI: 961. (バージョン 3.11 より).'
     The Python runtime version number encoded in a single constant
     integer.  See *note Py_PACK_FULL_VERSION(): 5b4. 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.23.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: 961. (バージョン 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: 961. (バージョン 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.24 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: e3.


File: python.info,  Node: Generating Execution Events,  Prev: Monitoring C API,  Up: Python/C API reference manual

7.25 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: e3. for details about the signatures of the
different event callbacks).  The ‘codelike’ argument should be an
instance of *note types.CodeType: 2ed. 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: e3. 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(): 643.).

 -- 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(): 643.).

 -- 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(): 643.).

 -- 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(): 643.).

 -- 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(): 643.).

 -- 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(): 643.).

 -- 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: fbe, 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.25.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: 522.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_BRANCH_RIGHT       *note BRANCH_RIGHT: 523.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_CALL               *note CALL: 1be6.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_C_RAISE            *note C_RAISE: 4c2e.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_C_RETURN           *note C_RETURN: 4c2f.
                                                            
                                                            
      -- C のマクロ:                                        *note EXCEPTION_HANDLED: 280.
               PY_MONITORING_EVENT_EXCEPTION_HANDLED        

      -- C のマクロ: PY_MONITORING_EVENT_INSTRUCTION        *note INSTRUCTION: 4c30.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_JUMP               *note JUMP: 4c31.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_LINE               *note LINE: 4c32.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_RESUME          *note PY_RESUME: 4c33.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_RETURN          *note PY_RETURN: 4c34.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_START           *note PY_START: 4c35.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_THROW           *note PY_THROW: 27d.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_UNWIND          *note PY_UNWIND: 27e.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_YIELD           *note PY_YIELD: 4c36.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_RAISE              *note RAISE: 27f.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_RERAISE            *note RERAISE: 281.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_STOP_ITERATION     *note STOP_ITERATION: 4c37.
                                                            

 -- 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: 4c3b.

     Added in version 3.13.

     *note Soft deprecated: 1b2. 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: 22fc. の利用を前提にして
     います。

     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: 11a. モジュールを通して行われます。 有効な
仮想環境にインストールするには 上記のコマンドを使います。

参考
....

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 perf map compatible profilers::
* アノテーションのベストプラクティス::
* 拡張モジュールを分離する::
* 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: 5a4a. 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: Event loop<2>.
* Asynchronous functions and coroutines::
* Task: Task<2>.
* await::


File: python.info,  Node: Event loop<2>,  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, but prefers to work behind the scenes, managing and
coordinating resources.  It's like an orchestra conductor.  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 band members.

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, such as when I/O operations complete or timers expire.

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<2>,  Up: A conceptual overview part 1 the high-level

9.1.1.2 Asynchronous functions and coroutines
.............................................

This is a basic, boring Python function:

     def hello_printer():
         print(
             "Hi, I am a lowly, simple printer, though I have all I "
             "need in life -- \nfresh paper and my dearly beloved octopus "
             "partner in crime."
         )

Calling a regular function invokes its logic or body:

     >>> hello_printer()
     Hi, I am a lowly, simple printer, though I have all I need in life --
     fresh paper and my dearly beloved octopus partner in crime.

The *note async def: 9d4, as opposed to just a plain ‘def’, makes this
an asynchronous function (or "coroutine function").  Calling it creates
and returns a *note coroutine: 3a13. 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: 123d. (native coroutine).
Note that coroutines can also exist as instances of *note
collections.abc.Coroutine: 1199. - 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: fa2. and *note generator functions:
1417.  Recall, a generator function is a function that *note yield:
d97.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(): bb9.  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: 3a43. 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: 439.

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).  The recommended way to create tasks is via *note
asyncio.create_task(): 469.

‘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(): 314, 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: 439. 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.

* Menu:

* Awaiting tasks::
* Awaiting coroutines::


File: python.info,  Node: Awaiting tasks,  Next: Awaiting coroutines,  Up: await

9.1.1.5 Awaiting tasks
......................

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.


File: python.info,  Node: Awaiting coroutines,  Prev: Awaiting tasks,  Up: await

9.1.1.6 Awaiting coroutines
...........................

'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(): 314. can help you detect such
occurrences via the ‘debug=True’ flag, which enables *note debug mode:
2347.  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.  Then, the event loop needs to manage its internal state and work
through its processing logic to resume the next job.  That might sound
minor, but in a large program with many ‘await’s, that overhead can add
up to a non-negligible 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 of Python to pass around control.

*note coroutine.send(arg): 1418. 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: 26ae, 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__(): 1132. 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: fbe. exception with the
return value attached in the *note value: 262b. 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:
     26b2, a different beast entirely.

     2.  What about a *note yield from: 26ae. 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.  Despite that, ‘yield from’ and
     ‘await’ effectively do the same thing.  Initially ‘yield’ was
     barred as well, but was re-accepted to allow for async generators.


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: 3b1e. 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: 467. subclasses *note asyncio.Future: f8f. 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(): e37.

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(): 3a46. (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: 51a7. offer abstractions over
     the Python's C API. Extensions generally need to be re-written to
     use one of them, but the library then handles differences between
     various Python versions and implementations.

   ---------- Footnotes ----------

   (1) http://python3porting.com/cextensions.html

   (2) https://py3c.readthedocs.io/en/latest/guide.html


File: python.info,  Node: Python で Curses プログラミング,  Next: デスクリプタ ガイド,  Prev: Python 3 への拡張モジュール移植,  Up: Python HOWTO

9.3 Python で Curses プログラミング
===================================


著者: A.M. Kuchling, Eric S. Raymond


リリース: 2.04

概要
....

このドキュメントでは *note curses: 2e. 拡張モジュールでテキストモードデ
ィスプレイを制御する方法について記述します。

* 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: 2e.
module.  A ported version called UniCurses(2) is available.

* Menu:

* Python の curses module::

   ---------- Footnotes ----------

   (1) https://pypi.org/project/Urwid/

   (2) https://pypi.org/project/UniCurses/


File: python.info,  Node: Python の curses module,  Up: curses ってなに?

9.3.1.1 Python の curses module
...............................

The Python module is a fairly simple wrapper over the C functions
provided by curses; if you're already familiar with curses programming
in C, it's really easy to transfer that knowledge to Python.  The
biggest difference is that the Python interface makes things simpler by
merging different C functions such as ‘addstr()’, ‘mvaddstr()’, and
‘mvwaddstr()’ into a single *note addstr(): 1a47. 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(): 1a3b. 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(): 3706.
function.

     curses.noecho()

通常アプリケーションはまた、Enter キーを押すことなく、キーに対してすぐに
反応する必要があります; これは cbreak モードと呼ばれ、通常の入力がバッフ
ァされるモードと逆に動作します。

     curses.cbreak()

端末は通常、カーソルキーや Page Up や Home といった操作キーなどの特別な
キーをマルチバイトエスケープシーケンスとして返します。それらのシーケンス
を想定して対応する処理を行うアプリケーションを書けるように、 curses はそ
れを *note curses.KEY_LEFT: 3772. のような特別な値を返して行ってくれます
。 curses にその仕事をさせるには、キーパッドモードを有効にする必要があり
ます。

     stdscr.keypad(True)

curses アプリケーションを終了させるのは起動よりも簡単です。 以下を呼び出
す必要があります:

     curses.nocbreak()
     stdscr.keypad(False)
     curses.echo()

cursesに親和性の高い設定をもとに戻します。そして、*note endwin(): 36e5.
関数を呼び出し、端末を通常の操作モードに復旧します。

     curses.endwin()

curses アプリケーションをデバッグするときの一般的な問題は、アプリケーシ
ョンが端末を以前の状態に復旧することなく異常終了したときに端末がめちゃめ
ちゃになることです。Python ではこの問題はコードにバグがあって、捕捉でき
ない例外が発生したときによく起きます。タイプしたキーはもはやエコーされま
せん、例えば、シェルを使うのが難しくなります。

Pythonでは、これらの複雑さを避けデバッグをより容易にするために、 *note
curses.wrapper(): e46. 関数をインポートして、このように使います:

     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(): e46. 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: adb...*note
except: 44e. 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(): 1a3b. 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(): 3705. 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: 11a8. and *note curses.COLS: 11a9. 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(): 1a41. 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(): 1a42. メソッドを呼び出
     して、配下にある、スクリーンの望ましい状態を表すデータ構造を更新し
     ます。

  2. *note doupdate(): 36e4. 関数を呼び出して、データ構造に記録された望
     ましい状態に合致するように、物理スクリーンを更新します。

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(): 1a47. のようなメソッドは複数の引数形式を許容してくれます。通常
それらは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(): 1a47. 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: 1452. attribute; this defaults to the default
system encoding as returned by *note locale.getencoding(): a4a.

The *note addch(): 1a45. 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: 37df. is a
+/- symbol, and *note ACS_ULCORNER: 3723. 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(): 36de.  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: 375e.       テキストを点滅
                           
                           
*note A_BOLD: 375f.        高輝度またはボールドテキスト
                           
                           
*note A_DIM: 3760.         低輝度テキスト
                           
                           
*note A_REVERSE: 36dc.     反転テキスト
                           
                           
*note A_STANDOUT: 36db.    利用できる最良のハイライトモード
                           
                           
*note A_UNDERLINE: 3764.   下線付きテキスト
                           

つまり、反転するステータスラインを画面の最上部に表示するには、コードをこ
うします:

     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(): 3710. function soon
after calling *note initscr(): 1a3b, to initialize the default color set
(the *note curses.wrapper(): e46. function does this automatically).
Once that's done, the *note has_colors(): 36f7. 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(): 36da. function; this can be bitwise-OR'ed with other
attributes such as *note A_REVERSE: 36dc, 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(): 3710. 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: 2e.
module defines named constants for each of these colors: *note
curses.COLOR_BLACK: 37f1, *note curses.COLOR_RED: 37f6, 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(): 36d9, 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: 2e. module adds a basic text-input widget.  (Other
libraries such as Urwid(1) have more extensive collections of widgets.)

ウィンドウから入力を得るための2つのメソッドがあります。

   * *note getch(): 1a50. refreshes the screen and then waits for the
     user to hit a key, displaying the key if *note echo(): 1a39. has
     been called earlier.  You can optionally specify a coordinate to
     which the cursor should be moved before pausing.

   * *note getkey(): 3734. 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(): 3746.
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(): 36fb. 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:
3783, *note curses.KEY_HOME: 3774, or *note curses.KEY_LEFT: 3772.  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: 2f. 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(): 3839. returns the control character
corresponding to its argument.

There's also a method to retrieve an entire string, *note getstr():
1a54.  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: 31. module supplies a text box that supports
an Emacs-like set of keybindings.  Various methods of the *note Textbox:
37fa. 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: 31.
を参照してください。

   ---------- Footnotes ----------

   (1) https://pypi.org/project/Urwid/


File: python.info,  Node: より多くの情報,  Prev: ユーザ入力,  Up: Python で Curses プログラミング

9.3.6 より多くの情報
--------------------

この HOWTO ではいくつかの進んだ話題、スクリーンスクレイピングや xterm イ
ンスタンスからマウスイベントを捉えるなど、については扱っていません。しか
し、Python の *note curses: 2e. モジュールのライブラリページはいまやかな
り充実しています。次はこれを見るべきです。

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_*: 37cb. characters available to you.

Because the curses API is so large, some functions aren't supported in
the Python interface.  Often this isn't because they're difficult to
implement, but because no one has needed them yet.  Also, Python doesn't
yet support the menu library associated with ncurses.  Patches adding
support for these would be welcome; see the Python Developer's Guide(1)
to learn more about submitting patches to Python.

   * Writing Programs with NCURSES(2): a lengthy tutorial for C
     programmers.

   * The ncurses man page(3)

   * The ncurses FAQ(4)

   * "Use curses...  don't swear"(5): curses または Urwid を使って端末を
     制御する PyCon 2013 講演ビデオです。

   * "Console Applications with Urwid"(6): video of a PyCon CA 2012 talk
     demonstrating some applications written using Urwid.

   ---------- Footnotes ----------

   (1) https://devguide.python.org/

   (2) https://invisible-island.net/ncurses/ncurses-intro.html

   (3) https://linux.die.net/man/3/ncurses

   (4) https://invisible-island.net/ncurses/ncurses.faq.html

   (5) https://www.youtube.com/watch?v=eN1eZtjLEnU

   (6) https://pyvideo.org/video/1568/console-applications-with-urwid


File: python.info,  Node: デスクリプタ ガイド,  Next: Debugging C API extensions and CPython Internals with GDB,  Prev: Python で Curses プログラミング,  Up: Python HOWTO

9.4 デスクリプタ ガイド
=======================


著者: Raymond Hettinger


問い合わせ先: <python at rcn dot com>

*note デスクリプタ: 22a. を使うと、オブジェクトの属性検索、保存、削除を
カスタマイズできます。

本ガイドは4つの大項目から構成されています。

  1. 最初の「入門」では基本の紹介をして、シンプルな例から少しずつ概念を
     説明していきます。もしデスクリプタに触れるのが初めての場合はここか
     ら学んでいきましょう。

  2. 2つ目のセクションでは完全で実践的なデスクリプタのサンプルを紹介しま
     す。もしデスクリプタの基本を理解しているのであれば、ここから読み始
     めても良いでしょう。

  3. 3番目のセクションはより技巧的なチュートリアルを通じて、デスクリプタ
     がどのようなメカニズムで動作しているのかを紹介します。多くの人はこ
     のレベルの理解は不要でしょう。

  4. 最後のセクションは、Cで書かれた組み込みのデスクリプタをピュア
     Pythonで実現する方法を紹介します。このセクションがどのように関数が
     束縛メソッドになるのか、 *note classmethod(): 6a0. や *note
     staticmethod(): 66d, *note property(): 6c1, *note __slots__: 9de. と
     いった一般的なツールの実装がどのようになっているのか興味を持ったら
     読んでください。

* 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__(): 18a0. 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__(): 18a0.  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__(): 18a0. and *note
__set__(): 25c9. 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__(): 1010. 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__(): 1010. so that the field names would be recorded.  Here
we call *note vars(): 2030. 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: 22a. is what we call any object that defines *note
__get__(): 18a0, *note __set__(): 25c9, or *note __delete__(): 1b83.

Optionally, descriptors can have a *note __set_name__(): 1010. 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(): 6a0, *note staticmethod(): 66d, *note property(): 6c1,
*note functools.cached_property(): 953. といったツールもすべて、デスクリ
プタとして実装されています。


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: 1574. 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: 32e. or
     *note float: 32f.  Optionally, it verifies that a value is between
     a given minimum or maximum.

  3. ‘String’ verifies that a value is a *note str: 1ea.  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__():
18a0, *note __set__(): 25c9, and *note __delete__(): 1b83.  If any of
those methods are defined for an attribute, it is said to be a *note
descriptor: 22a.

属性アクセスのデフォルトの振る舞いは、オブジェクトの辞書の属性の取得、設
定、削除です。例えば ‘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(): 44a.  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__(): 25c9. or *note __delete__(): 1b83,
it is considered a data descriptor.  Descriptors that only define *note
__get__(): 18a0. 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__(): 18a0.
and *note __set__(): 25c9. with the ‘__set__()’ raising an *note
AttributeError: 1b4. 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__: 1ca, its *note __get__(): 18a0. 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__(): 8e8. if it is provided.

‘a.x’ に対するデスクリプタが見つかった場合、 ‘desc.__get__(a, type(a))’
という形式で呼び出されます。

ドットによるルックアップのロジックは*note object.__getattribute__():
f94. の中で行われます。ピュア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 = sentinel('null')
         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__(): 8e8. hook in the *note
__getattribute__(): f94. 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(): f93. function
that are responsible for invoking *note __getattr__(): 8e8. whenever
*note __getattribute__(): f94. raises an *note AttributeError: 1b4.
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:
27a3.

‘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/main/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__():
f94. method for object returned by *note super(): 44a.

‘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/main/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__(): f94. methods for *note object: e51, *note type: 191,
and *note super(): 44a.

憶えておくべき重要な点は:

   * Descriptors are invoked by the *note __getattribute__(): f94.
     method.

   * クラスはこの機構を *note object: e51. 、 *note type: 191. 、 *note
     super(): 44a. から継承する

   * Overriding *note __getattribute__(): f94. prevents automatic
     descriptor calls because all the descriptor logic is in that
     method.

   * ‘object.__getattribute__()’ and ‘type.__getattribute__()’ make
     different calls to *note __get__(): 18a0.  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:
191. metaclass scans the dictionary of the new class.  If any of the
entries are descriptors and if they define *note __set_name__(): 1010,
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__(): 1010. will need to be called
manually.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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(): 6c1. を呼び出すことで、属性へアクセスすると関数の呼び
出しを引き起こす、データデスクリプタを簡潔に組み立てられます。シグネチャ
はこうです:

     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(): 6c1. 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(): 6c1. 関数は、ユーザインターフェースへの属性
アクセスが与えられ、続く変更がメソッドの介入を要求するときに役立ちます。

例えば、スプレッドシートクラスが、‘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(): 6c1. 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: 1d9e. を使え
ば手動で作れます。

     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__(): 18a0. 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:
1f38. も持っています。

     >>> D.f.__qualname__
     'D.f'

Accessing the function through the class dictionary does not invoke
*note __get__(): 18a0.  Instead, it just returns the underlying function
object:

     >>> D.__dict__['f']
     <function D.f at 0x00C45070>

Dotted access from a class calls *note __get__(): 18a0. 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__(): 18a0. 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__(): 18a0. 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(): 66d. は以下のようになります:

     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(): 13cf. 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__: 168e, *note __qualname__:
2558, and *note __doc__: 1597.


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(): 4e1. は新しい辞書をキーのリストから生成します。等価な
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(): 6a0. の
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(): 13cf. の呼び出しは
、根底にある関数を参照する ‘__wrapped__’ 属性を追加します。また、ラッパ
ーがそのラップされた関数のように見えるよう、必要な属性を追加します:
*note __name__: 168e. 、 *note __qualname__: 2558. 、 *note __doc__:
1597. 、 *note __annotations__: 1596. 。


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(): 953. 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 = sentinel('null')

     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__(): 987. メソッドはインスタンス辞書の代わりにスロッ
トを持つインスタンスの作成の処理をします。おおざっぱにピュア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: 25e4. 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: 1a6.* 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: 3e3. 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: 713. (‘-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}, '__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: 5d2.*) 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: 5d2.*:

     (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: b78.*:

     (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: a26. は、ユニークな値に束縛されたシンボル名の集合です。グロ
ーバル変数に似ていますが、 *note repr(): 462. がより便利だったり、グルー
ピングの機能、型安全などいくつかの機能があります。

これらは、限られた選択肢の値の一つを取る変数がある場合に便利です。例えば
、曜日情報があります:

     >>> 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: a26. の作成は ‘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: 494. has two methods for returning the weekday: *note
weekday(): 2aeb. and *note isoweekday(): 2aec.  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: 4e0. - we could use a
different type of *note Enum: a26.:

     >>> from enum import Flag
     >>> class Weekday(Flag):
     ...     MONDAY = 1
     ...     TUESDAY = 2
     ...     WEDNESDAY = 4
     ...     THURSDAY = 8
     ...     FRIDAY = 16
     ...     SATURDAY = 32
     ...     SUNDAY = 64

ここでは2つの変更が行われています。*note Flag: a19. を継承している点と、
値がすべて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: a19. は複数のメンバーをひとつの変数にまとめることも
できます:

     >>> weekend = Weekday.SATURDAY | Weekday.SUNDAY
     >>> weekend
     <Weekday.SATURDAY|SUNDAY: 96>

*note Flag: a19. 変数は反復することもできます:

     >>> 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(): 1062. を使用すること
で手間を省くことができます:

     >>> 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(): 2c55. デコレータを使用で
きます:

     >>> 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: 1062. が使えます:

     >>> 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_(): 2c68, 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_(): 2c68. 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: 5aa1. を参照してください):

     >>> 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

Equality comparisons against non-enumeration values will always return
‘False’ (again, *note IntEnum: 10a1. 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: 5aa3. ではデフォルトで設定さ
れる）ですが、これは強制されているわけではありません。大半の使用例では、
列挙値の実際の値が何であるかは意識しません。しかし、値が重要な場合、列挙
型は任意の値を持つことができます。

列挙型は 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__(): a14, *note __add__(): 25f1, etc.), descriptors (methods are
also descriptors), and variable names listed in *note _ignore_: 2c66.

Note: if your enumeration defines *note __new__(): 987. and/or *note
__init__(): 306, any value(s) given to the enum member will be passed
into those methods.  See *note Planet: 5aa4. for an example.

     注釈: The *note __new__(): 987. 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__():
     5aa5. for more details.


File: python.info,  Node: Enumのサブクラス化の制限,  Next: データクラスのサポート,  Prev: 列挙型で許されるメンバーと属性,  Up: 列挙型 HOWTO

9.6.8 Enumのサブクラス化の制限
------------------------------

新しい *note Enum: a26. クラスは、ベースの enum クラスを1つ、具象データ
型を1つ、複数の *note object: e51. ベースのミックスインクラスが許容され
ます。これらのベースクラスの順序は次の通りです:

     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: 5aa7. の例を参照してください。)


File: python.info,  Node: データクラスのサポート,  Next: Pickle 化,  Prev: Enumのサブクラス化の制限,  Up: 列挙型 HOWTO

9.6.9 データクラスのサポート
----------------------------

*note dataclass: 6ec. を継承する場合、 *note __repr__(): 1d18. は継承す
るクラス名を省略します。 例えば:

     >>> 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(): 462. を使うには、*note dataclass(): 6ec. の引数
‘repr=False’ を使用してください。

バージョン 3.12 で変更: dataclass のフィールドだけが値の領域に表示され、
dataclassの名前は表示されなくなりました

     注釈: *note Enum: a26. やそのサブクラスに *note dataclass(): 6ec. デ
     コレータを加えることはサポートされていません。そうしてもエラーは送
     出されませんが、実行時にそれぞれのメンバが互いに等しいなど、非常に
     奇妙な結果が起こります:

          >>> @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__(): 1b9d. 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: a26. クラスは呼び出し可能で、以下の関数 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: 1da. と似ています。*note Enum: a26.
呼び出しの第 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: a26. 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__: 2583. 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: a26. の派生型であり、 *note int:
32e. のサブクラスでもあります。 *note IntEnum: 10a1. のメンバーは整数と
比較できます; さらに言うと、異なる整数列挙型どうしでも比較できます:

     >>> 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: a26. 列挙型とは比較できません:

     >>> class Shape(IntEnum):
     ...     CIRCLE = 1
     ...     SQUARE = 2
     ...
     >>> class Color(Enum):
     ...     RED = 1
     ...     GREEN = 2
     ...
     >>> Shape.CIRCLE == Color.RED
     False

*note IntEnum: 10a1. の値は他の用途では整数のように振る舞います:

     >>> 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: a26. の派生型もまた、 *note str: 1ea.
のサブクラスでもあります。*note StrEnum: a12. のメンバーは、文字列と比較
できます; さらに言うと、異なる文字列列挙型どうしでも比較できます。

Added in version 3.11.


File: python.info,  Node: IntFlag,  Next: Flag,  Prev: StrEnum,  Up: 派生列挙型

9.6.12.3 IntFlag
................

次の *note Enum: a26. の派生型 *note IntFlag: 1061. も、*note int: 32e.
を基底クラスとしています。 違いは、 ‘IntFlag’ のメンバーをビット演算子
(&amp;, |, ^, ~) を使って組み合わせられ、その結果も ‘IntFlag’ メンバーに
なることです。 *note IntEnum: 10a1. と同様、‘IntFlag’ のメンバーも整数で
あり、‘int’ が使用されるところであればどこでも使えます。

     注釈: *note IntFlag: 1061. メンバーに対してビット演算以外のどんな演
     算をしても、その結果は ‘IntFlag’ メンバーではなくなります。

     ビット単位演算の結果が *note IntFlag: 1061. として不正な値な値の場
     合、値は ‘IntFlag’ メンバーではなくなります。 詳しくは *note
     FlagBoundary: a1a. を参照してください。

Added in version 3.6.

バージョン 3.11 で変更.

*note IntFlag: 1061. クラスの例:

     >>> 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: 1061. と *note Enum: a26. のもう 1 つの重要な違いは、フラ
グが設定されていない (値が0である) 場合、その真偽値としての評価は *note
False: ef9. になることです:

     >>> Perm.R & Perm.X
     <Perm: 0>
     >>> bool(Perm.R & Perm.X)
     False

*note IntFlag: 1061. メンバーも *note int: 32e. のサブクラスであるため、
それらと組み合わせることができます（ただし、 ‘IntFlag’ 型ではなくなる可
能性があります）:

     >>> Perm.X | 4
     <Perm.R|X: 5>

     >>> Perm.X + 8
     9

     注釈: 否定の演算子 ‘~’ は、常に正の値を持つ *note IntFlag: 1061. メ
     ンバー を返す:

          >>> (~Perm.X).value == (Perm.R|Perm.W).value == 6
          True

*note IntFlag: 1061. メンバーは反復処理することもできます:

     >>> 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: a19. です。 *note IntFlag: 1061. と同様に、
‘Flag’ メンバーもビット演算子 (&, |, ^, ~) を使って組み合わせられます。
しかし ‘IntFlag’ とは違い、他のどの ‘Flag’ 列挙型とも *note int: 32e. と
も組み合わせたり、比較したりできません。 値を直接指定することも可能です
が、値として *note auto: 1062. を使い、 ‘Flag’ に適切な値を選ばせること
が推奨されています。

Added in version 3.6.

*note IntFlag: 1061. と同様に、 *note Flag: a19. メンバーの組み合わせが
どのフラグも設定されていない状態になった場合、その真偽値としての評価は
*note False: ef9. となります:

     >>> 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: a19. メンバーは反復処理することもできます:

     >>> purple = Color.RED | Color.BLUE
     >>> list(purple)
     [<Color.RED: 1>, <Color.BLUE: 2>]

Added in version 3.11.

     注釈: ほとんどの新しいコードでは、 *note Enum: a26. と *note Flag:
     a19. が強く推奨されます。 というのは、 *note IntEnum: 10a1. と
     *note IntFlag: 1061. は (整数と比較でき、従って推移的に他の無関係な
     列挙型と比較できてしまうことにより) 列挙型の意味論的な約束に反する
     からです。 ‘IntEnum’ と ‘IntFlag’ は、 ‘Enum’ や ‘Flag’ では上手く
     いかない場合のみに使うべきです; 例えば、整数定数を列挙型で置き換え
     るときや、他のシステムとの相互運用性を持たせたいときです。


File: python.info,  Node: その他<6>,  Prev: Flag,  Up: 派生列挙型

9.6.12.5 その他
...............

*note IntEnum: 10a1. は *note enum: 59. モジュールの一部ですが、単独での
実装もとても簡単に行なえます:

     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: 32f. instead of *note
int: 32e.

いくつかのルール:

  1. *note Enum: a26. のサブクラスを作成するとき、複合させるデータ型は、
     基底クラスの並びで ‘Enum’ クラス自身より先に記述しなければなりませ
     ん (上記 *note IntEnum: 10a1. の例を参照)。

  2. 複合させる型はサブクラス化可能でなければいけません。例えば、 *note
     bool: 5f6. と *note range: d13. はサブクラス化できないため、複合さ
     せるとEnum作成時にエラーが発生します。

  3. *note Enum: a26. のメンバーはどんなデータ型でも構いませんが、追加の
     データ型 (例えば、上の例の *note int: 32e.) と複合させてしまうと、
     すべてのメンバーの値はそのデータ型でなければならなくなります。この
     制限は、メソッドの追加するだけの、他のデータ型を指定しない複合には
     適用されません。

  4. When another data type is mixed in, the *note value: 2c61.
     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__(): 987, or a
     *note dataclass: 6ec.

  6. %-style formatting: ‘%s’ and ‘%r’ call the *note Enum: a26. class's
     *note __str__(): a14. and *note __repr__(): 1c7. respectively;
     other codes (such as ‘%i’ or ‘%h’ for IntEnum) treat the enum
     member as its mixed-in type.

  7. *note Formatted string literals: 441, *note str.format(): a17, and
     *note format(): 440. will use the enum's *note __str__(): a14.
     method.

     注釈: Because *note IntEnum: 10a1, *note IntFlag: 1061, and *note
     StrEnum: a12. are designed to be drop-in replacements for existing
     constants, their *note __str__(): a14. 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__(): 987. must be used whenever you want to customize the
actual value of the *note Enum: a26. member.  Any other modifications
may go in either ‘__new__()’ or *note __init__(): 306, 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: 2c7c.


File: python.info,  Node: _Private__names,  Next: Enum メンバー型,  Prev: Supported __dunder__ and _sunder_ names,  Up: 細かい点

9.6.14.2 _Private__names
........................

*note Private names: 22b1. は列挙型メンバーには変換されず、通常の属性と
なります。

バージョン 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: 32e. or *note str:
1ea, with an *note Enum: a26, 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: 32e, *note str: 1ea. などのような) 非 *note Enum: a26. 型と
複合させた enum クラスは、その複合された型の規則に従って評価されます; そ
うでない場合は、全てのメンバーは *note True: fd0. と評価されます。 メン
バーの値に依存する独自の enum の真偽値評価を行うには、クラスに次のコード
を追加してください:

     def __bool__(self):
         return bool(self.value)

プレーンな *note Enum: a26. クラスは *note True: fd0. として評価されます
。


File: python.info,  Node: メソッド付きの Enum クラス,  Next: Flag のメンバーの組み合わせ,  Prev: Enum クラスとメンバーの真偽値,  Up: 細かい点

9.6.14.6 メソッド付きの ‘Enum’ クラス
.....................................

enum サブクラスに追加のメソッドを与えた場合、後述の *note Planet: 5aa4.
クラスのように、そのメソッドはメンバーの *note dir(): a28. に表示されま
すが、クラスの ‘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: a19. 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: a26. 派生クラスやそれらのインスタンス (メンバー) 双
方の多くの側面に影響を及ぼすカスタムメタクラスを持っています。

* Menu:

* Enum クラス::
* Flag クラス::
* Enum メンバー (インスタンス): Enum メンバー インスタンス.
* Flag メンバー::


File: python.info,  Node: Enum クラス,  Next: Flag クラス,  Up: EnumとFlagはどう違うのか？

9.6.15.1 Enum クラス
....................

The *note EnumType: 702. metaclass is responsible for providing the
*note __contains__(): 1772, *note __dir__(): 1956, *note __iter__():
1031. and other methods that allow one to do things with an *note Enum:
a26. 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__(): 987, *note __getnewargs__(): 1191, *note __str__():
a14. and *note __repr__(): 1c7.).


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: a26. 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: 702. creates them all while it is creating
the enum class itself, and then puts a custom *note __new__(): 987. 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: a19. クラスと同様に反復処理することがで
き、正規のメンバーのみが返されます。 例えば:

     >>> 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: a26, *note IntEnum: 10a1, *note StrEnum: a12, *note Flag:
a19, *note IntFlag: 1061. は用途の大部分をカバーすると予想されますが、そ
のすべてをカバーできているわけではありません。ここでは、そのまま、あるい
は独自の列挙型を作る例として使える、様々なタイプの列挙型を紹介します。

* Menu:

* 値の省略::
* OrderedEnum::
* DuplicateFreeEnum::
* MultiValueEnum::
* Planet::
* TimePeriod::


File: python.info,  Node: 値の省略,  Next: OrderedEnum,  Up: Enum クックブック

9.6.16.1 値の省略
.................

多くの用途では、列挙型の実際の値が何かは気にされません。 このタイプの単
純な列挙型を定義する方法はいくつかあります:

   - 値に *note auto: 1062. インスタンスを使用する

   - 値として *note object: e51. インスタンスを使用する

   - 値として解説文字列を使用する

   - use a tuple as the value and a custom *note __new__(): 987. to
     replace the tuple with an *note int: 32e. 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: 1062. を使うと次のようになります:

     >>> 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: e51. を使うと次のようになります:

     >>> 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__(): 1c7.:

     >>> 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__(): 987. 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__(): 987. 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: 10a1. をベースとしないため、通常の *note Enum: a26. の不
変条件 (他の列挙型と比較できないなど) のままで、メンバーを順序付けできる
列挙型です:

     >>> 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(): 2c55. デコレーターを使用して行えます。


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__(): 987. or *note __init__(): 306. 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_: 2c66. 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: a26.
subclasses, either with class decorators or custom functions, *note
EnumType: 702. can be subclassed to provide a different Enum experience.


File: python.info,  Node: 関数型プログラミング HOWTO,  Next: Logging HOWTO,  Prev: 列挙型 HOWTO,  Up: Python HOWTO

9.7 関数型プログラミング HOWTO
==============================


著者: A. M. Kuchling


リリース: 0.32

この文書では、関数型スタイルでプログラムを実装するのにピッタリな Python
の機能を見てまわることにしましょう。まず関数型プログラミングという概念を
紹介したあと、 *note iterator: 6d4. や *note generator: 1417. のような言
語機能、および *note itertools: 84. や *note functools: 62. といった関連
するライブラリモジュールを見ることにします。

* 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): 5acd. まで
飛ばしてください。

プログラミング言語とは問題を分解するものですが、各言語がサポートする分解
方法にはいくつかの種類があります:

   * ほとんどのプログラミング言語は '手続き型' です: プログラムは、入力
     に対して行うべきことをコンピュータに教える指示リストとなります。 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(): 1324.
や *note time.sleep(): a91. 関数の呼び出しもありますが、どちらも有用な値
を返しません。画面にテキストを送ったり、実行を 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__(): 1687. という、引数を取らず次の要素を返すメソッドを必ずサポー
トしています。データストリームに要素が残っていない場合、 ‘__next__()’ は
必ず *note StopIteration: fbe. 例外を出します。ただし、イテレータの長さ
は有限である必要はありません; 無限のストリームを生成するイテレータを書く
というのもまったく理に適ったことです。

ビルトインの *note iter(): bb8. 関数は任意のオブジェクトを受けて、 その
中身や要素を返すイテレータを返そうとします。引数のオブジェクトが イテレ
ータを作れないときは *note TypeError: 29c. を投げます。Python の ビルト
インなデータ型にもいくつかイテレータ化のできるものがあり、 中でもよく使
われるのはリストと辞書です。イテレータを作れる オブジェクトは *note
iterable: 149a. オブジェクトと呼ばれます。

手を動かしてイテレータ化の実験をしてみましょう:

     >>> 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: 329. 文です。 ‘for X in Y’ という文の Y は、 イテレータ
か、あるいは *note iter(): bb8. でイテレータを作れるオブジェクトである必
要があります。次の二つは同じ意味になります:

     for i in iter(obj):
         print(i)

     for i in obj:
         print(i)

イテレータは *note list(): 4e0. や *note tuple(): 1d9. といったコンスト
ラクタ関数を使ってリストやタプルに具現化することができます:

     >>> 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(): 12bd. や *note min(): 12bc. なども、イテレ
ータ一つだけを引数に取って最大・最小の要素を返すことができます。 ‘"in"’
や ‘"not in"’ 演算子もイテレータに対応しています: ‘X in iterator’ は、そ
のイテレータから返るストリームに X があれば真です。ですからイテレータが
無限長だと、当然ながら問題に直面します; ‘max()’, ‘min()’ はいつまでも戻
って来ませんし、 要素 X がストリームに出てこなければ ‘"in"’, ‘"not in"’
オペレータも戻りません。

イテレータは次に進むことしかできませんのでご注意ください; 前の要素を手に
入れたり、イテレータをリセットしたり、コピーを作ったりする方法はありませ
ん。イテレータがオブジェクトとしてそうした追加機能を 持つことはできます
が、プロトコルでは *note __next__(): 1687. メソッドのことしか指定されて
いません。ですから関数はイテレータの出力を使い尽くして しまうかもしれま
せんし、同じストリームに何か別のことをする 必要があるなら新しいイテレー
タを作らなくてはいけません。

* Menu:

* イテレータ対応のデータ型::


File: python.info,  Node: イテレータ対応のデータ型,  Up: イテレータ iterator<2>

9.7.2.1 イテレータ対応のデータ型
................................

リストやタプルがイテレータに対応している方法については既に見ましたが、実
のところ Python のシーケンス型はどれでも、たとえば文字列なども、自動でイ
テレータ生成に対応しています。

辞書に対して *note iter(): bb8. すると、辞書のキーでループを回すイテレー
タが返されます:

     >>> 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(): bb8. を適用するとキーでループを回しますが、辞書には
他のイテレータを返すメソッドもあります。明示的に値、あるいはキーと値のペ
アでイテレートしたければ、*note values(): bb2, *note items(): bb3. とい
うメソッドでイテレータを作ることができます。

逆に *note dict(): 193. コンストラクタは、有限な ‘(key, value)’ タプルの
ストリームを返すイテレータを受け入れることができます:

     >>> L = [('Italy', 'Rome'), ('France', 'Paris'), ('US', 'Washington DC')]
     >>> dict(iter(L))
     {'Italy': 'Rome', 'France': 'Paris', 'US': 'Washington DC'}

ファイルも、最後の行まで *note readline(): 22b4. メソッドを呼んでいくこ
とでイテレータ化に対応しています。つまりこうやってファイルの各行を読んで
いくことができるわけです:

     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: d97. キーワードを含む関数はすべてジェネレータ関数です;
Python の *note bytecode: 6b9. コンパイラがこれを検出して、特別な方法で
コンパイルしてくれるのです。

ジェネレータ関数は、呼ばれたときに一回だけ値を返すのではなく、イテレータ
プロトコルに対応したオブジェクトを返します。上の例で ‘yield’ を実行した
とき、 ジェネレータは ‘return’ 文のようにして ‘i’ の値を出力します。
‘yield’ と ‘return’ 文の大きな違いは、 ‘yield’ に到達した段階でジェネレ
ータの実行状態が一時停止になって、ローカル変数が保存される点です。 次回
そのジェネレータの *note __next__(): 22bc. を呼ぶと、そこから関数が実行
を再開します。

上記 ‘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__(): 22bc. メソ
ッドから送出された ‘StopIteration(value)’ を引き起こします。これが発生し
た場合や、関数の終わりに到達した場合は、値の生成が終了してジェネレーター
がそれ以上の値を返さない。

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note __next__():
1687. メソッドが ‘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/main/Lib/test/test_generators.py


File: python.info,  Node: ジェネレータに値を渡す,  Up: ジェネレータ generator<2>

9.7.4.1 ジェネレータに値を渡す
..............................

Python 2.4 までのジェネレータは出力することしかできませんでした。ジェネ
レータのコードを実行してイテレータを作ってしまったあとで、その関数を再開
するときに新しい情報を渡す手段はなかったのです。ジェネレータがグローバル
変数を見るようにしたり、ミュータブルなオブジェクトを渡しておいて呼び出し
元であとからそれを変更したり、といったハックは可能でしたが、どれもゴチャ
ゴチャしていますね。

Python 2.5 で、ジェネレータに値を渡す簡単な手段ができました。 *note
yield: d97. が、変数に代入したり演算したりできる値を返す式になったのです
:

     val = (yield i)

上のように、返り値で何かをするときは ‘yield’ 式の前後に '必ず' 括弧を付
けるようお勧めします。括弧は常に必要なわけではありませんが、どんなとき付
けなくて良いのかを覚えておくより、いつも付けておくほうが楽ですから。

( PEP 342(1) がその規則を正確に説明していますが、それによると ‘yield’-式
は、代入式で右辺のトップレベルにあるとき以外はいつも括弧を付ける必要があ
ります。つまり ‘val = yield i’ とは書けますが、 ‘val = (yield i) + 12’ の
ように演算子があるときは括弧を使わなくてはいけません。)

ジェネレータに値を送るには *note send(value): 1418. メソッドを呼びます。
するとジェネレータのコードが実行を再開し、 ‘yield’ 式がその値を返すので
す。ふつうの *note __next__(): 22bc. メソッドを呼ぶと、 ‘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(): 1418. しかないのだと確定してるのでない限り、式の値
をそのまま使ってはいけません。

ジェネレータには、 *note send(): 1418. のほかにもメソッドが二つあります:

   * *note throw(value): 90a. はジェネレータ内で例外を投げるために使いま
     す; その例外はジェネレータの実行が停止したところの ‘yield’ 式によっ
     て投げられます。

   * *note close(): 19bf. sends a *note GeneratorExit: 1780. exception
     to the generator to terminate the iteration.  On receiving this
     exception, the generator's code must either raise ‘GeneratorExit’
     or *note StopIteration: fbe.; catching the exception and doing
     anything else is illegal and will trigger a *note RuntimeError:
     317.  ‘close()’ will also be called by Python's garbage collector
     when the generator is garbage-collected.

     *note GeneratorExit: 1780. が起こったときにクリーンアップ作業をする
     必要があるなら、 ‘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(): 445. と *note filter(): c3f. は、機
能がジェネレータ式と重複しています:

*note map(f, iterA, iterB, ...): 445. は以下のシーケンスのイテレータを返します

     ‘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): c3f. はある条件を満たす要素に渡るイテレー
タを返すので、同様にリスト内包表記で再現できます。 '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): 1839. はイテラブルの要素に順番に番号を振
っていき、('start' から数え始めたときの) 番号とそれぞれの要素を含む 2 タ
プルを返します。

     >>> for item in enumerate(['subject', 'verb', 'object']):
     ...     print(item)
     (0, 'subject')
     (1, 'verb')
     (2, 'object')

*note enumerate(): 1839. はよく、リストに対してループさせて、条件に合う
所に印を付けていくときに使われます:

     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): f90. はイテラブルの要素
をすべて集めたリストを作り、ソートして返します。 引数 'key' および
'reverse' は、リストの *note sort(): f91. メソッドにそのまま渡されます。

     >>> 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 ソートのテクニック: 1599. を参照)

組み込みの *note any(iter): 17d9. および *note all(iter): 17da. は
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, ...): 446. はそれぞれの iterable から1つの要素を
取り、それらをタプルに入れて返します:

     zip(['a', 'b', 'c'], (1, 2, 3)) =>
       ('a', 1), ('b', 2), ('c', 3)

*note zip(): 446. は結果を返す前に入力のイテレーターを全て消費してメモリ
上に 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: 84. モジュールには、よく使うイテレータや、イテレータ同
士の連結に使う関数がたくさん含まれています。この章では、そのモジュールの
内容を小さな例で紹介していきたいと思います。

このモジュールの関数を大まかに分けるとこうなります:

   * 既存のイテレータに基づいて新しいイテレータを作る関数。

   * イテレータの要素を引数として扱う関数。

   * イテレータの出力から一部を取り出す関数。

   * イテレータの出力をグループ分けする関数。

* Menu:

* 新しいイテレータを作る::
* 要素に対して関数を呼ぶ::
* 要素を選択する::
* 組合せ関数::
* 要素をグループ分けする::


File: python.info,  Node: 新しいイテレータを作る,  Next: 要素に対して関数を呼ぶ,  Up: itertools モジュール

9.7.6.1 新しいイテレータを作る
..............................

*note itertools.count(start, step): 163d. は値の間隔が一定の無限ストリー
ムを返します。 オプションで開始する数 (デフォルトは 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): 1a61. は与えられたイテラブルの内容をコピー
して、 その要素を最初から最後まで無限に繰り返していくイテレータを返しま
す。

     itertools.cycle([1, 2, 3, 4, 5]) =>
       1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ...

*note itertools.repeat(elem, [n]): 1aa1. は、与えられた要素を '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, ...): 19b. は任意の数のイテラブルを
受け取って、最初のイテレータから要素をすべて返し、次に二番目から 要素を
すべて返し、ということを要素がなくなるまで続けます。

     itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>
       a, b, c, 1, 2, 3

*note itertools.islice(iter, [start], stop, [step]): f0d. は、イテレータ
の スライスをストリームで返します。 '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]): 2dd8. はイテレータを複製します; 元のイテ
レータの内容を同じように返す、独立した '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):
2dff. (二つの値を加算)、 *note operator.ne(a, b): 2def. (‘a != b’ と同じ
)、 *note operator.attrgetter('id'): 11ea. (‘.id’ 属性を取得するコーラブ
ルを返す) といった関数です。

*note itertools.starmap(func, iter): 14a3. は、イテラブルがタプルのスト
リームを返すとみなして、 そのタプルを引数に使って '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): 27e6. は *note filter():
c3f. とは反対に、 述語が偽を返す要素をすべて返します:

     itertools.filterfalse(is_even, itertools.count()) =>
       1, 3, 5, 7, 9, 11, 13, 15, ...

*note itertools.takewhile(predicate, iter): 2dd7. は述語が真を返している
間だけ要素を返します。一度でも述語が偽を返すと、イテレータは出力終了の合
図をします。

     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): 2dd6. は、述語が真を返してい
るうちは要素を無視し、偽になってから残りの出力をすべて返します。

     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): 163c. は 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): 16cb. は、 '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): 1982. が
あり、こちらはこの順序についての制約がなく、 '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): 163b. 関数は
別の制約を取り払います: 一回の選択で同じ要素を繰り返し選んでも良い。概念
的には、それぞれのタプルの最初のものとして一つ要素が選ばれ、続いて 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):
194b. は、 これまでで最も複雑です。 ‘key_func(elem)’ は、イテラブルから
返ってきた要素それぞれのキー値を計算する関数です。この関数が指定されてい
なければ、 キーは単に各要素そのものになります。

*note groupby(): 194b. は、元になるイテラブルから同じキー値を持つ連続す
る要素を集めて、キー値とそのキーに対応する要素のイテレータの 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(): 194b. は、元になるイテラブルの内容がキー値でソートされ
た状態で与えられることを想定しています。ここで、返されるイテレータ自体も
元のイテラブルを使うということに注意してください。そのため、 iterator-1
の結果を読み終わるまでは iterator-2 とそれに対応するキー値を要求すること
はできません。


File: python.info,  Node: functools モジュール,  Next: 小さな関数とラムダ式,  Prev: itertools モジュール,  Up: 関数型プログラミング HOWTO

9.7.7 functools モジュール
--------------------------

*note functools: 62. モジュールには、高階関数がいくつか入っています。 '高
階関数' とは、入力として関数を受け取って新たな関数を返す関数です。このモ
ジュールで一番便利なツールは *note functools.partial(): 4ad. 関数です。

関数型スタイルのプログラムでは時折、既存の関数から一部のパラメータを埋め
た変種を作りたくなることがあります。Python の関数 ‘f(a, b, c)’ というも
のがあるとしてください; ‘f(1, b, c)’ と同じ意味の ‘g(b, c)’ という関数を
作りたくなることがあります; つまり ‘f()’ のパラメータを一つ埋めるわけで
す。これは「関数の部分適用」と呼ばれています。

*note partial(): 4ad. のコンストラクタは ‘(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]): 156. はイテラブルの
要素に対して次々に演算を実行していった最終結果を出すもので、それゆえ無限
長イテラブルには適用できません。 'func' には、要素を二つ取って値を一つ返
す関数が入ります。 ‘functools.reduce()’ はイテレータが返す最初の二要素 A
と B を取って ‘func(A, B)’ を計算します。それから三番目の要素 C を要求し
て ‘func(func(A, B), C)’ を計算すると、その結果をさらに四番目の要素と組
み合わせて……ということをイテラブルが尽きるまで続けるのです。 もしイテラ
ブルが一つも値を返さなければ *note TypeError: 29c. が発生します。 初期値
‘initial_value’ があるときには、最初の計算で ‘func(initial_value, A)’ が
実行されます。

     >>> import operator, functools
     >>> functools.reduce(operator.concat, ['A', 'BB', 'C'])
     'ABBC'
     >>> functools.reduce(operator.concat, [])
     Traceback (most recent call last):
       ...
     TypeError: reduce() of empty sequence with no initial value
     >>> functools.reduce(operator.mul, [1, 2, 3], 1)
     6
     >>> functools.reduce(operator.mul, [], 1)
     1

*note operator.add(): 2dff. を *note functools.reduce(): 156. で使うと、
iterable の全要素を合計することになります。これは使用頻度が高いので、そ
のための *note sum(): 886. というビルトイン関数があります:

     >>> import functools, operator
     >>> functools.reduce(operator.add, [1, 2, 3, 4], 0)
     10
     >>> sum([1, 2, 3, 4])
     10
     >>> sum([])
     0

とはいえ、多くの場合 *note functools.reduce(): 156. を使うよりは、単に
*note for: 329. ループを書いたほうがわかりやすくなります:

     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):
dc3. です。この関数は同じ計算をしますが、最終結果を返すのではなく、
‘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: 1657. 式です。 ‘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(): 886. ビルトインとジェネレータ式でも良いですね:

     total = sum(b for a, b in items)

多くの場合、 *note functools.reduce(): 156. を使っているところは ‘for’ ル
ープに 書き直したほうが見やすいです。

Fredrik Lundh は以前 ‘lambda’ 利用のリファクタリングに関して以下の指針を
提案したことがあります:

  1. ラムダ関数を書く。

  2. そのラムダが一体ぜんたい何をしているのかコメントで説明する。

  3. そのコメントをしばらく研究して、本質をとらえた名前を考える。

  4. ラムダをその名前で def 文に書き換える。

  5. コメントを消す。

著者はこの指針を本当に気に入っていますが、こうしたラムダなしスタイルが他
より優れているかどうかについて、異論は認めます。


File: python.info,  Node: 更新履歴と謝辞,  Next: 参考資料<2>,  Prev: 小さな関数とラムダ式,  Up: 関数型プログラミング HOWTO

9.7.9 更新履歴と謝辞
--------------------

著者は提案の申し出や修正、様々なこの記事の草稿の助けをしてくれた以下の人
々に感謝します: Ian Bicking, Nick Coghlan, Nick Efford, Raymond
Hettinger, Jim Jewett, Mike Krell, Leandro Lameiro, Jussi Salmela,
Collin Winter, Blake Winton.

Version 0.1: posted June 30 2006.

Version 0.11: posted July 1 2006.  Typo fixes.

Version 0.2: posted July 10 2006.  Merged genexp and listcomp sections
into one.  Typo fixes.

Version 0.21: Added more references suggested on the tutor mailing list.

Version 0.30: Adds a section on the ‘functional’ module written by
Collin Winter; adds short section on the operator module; a few other
edits.


File: python.info,  Node: 参考資料<2>,  Prev: 更新履歴と謝辞,  Up: 関数型プログラミング HOWTO

9.7.10 参考資料
---------------

* Menu:

* 一般論::
* Python 特有の話::
* Python 文書::


File: python.info,  Node: 一般論,  Next: Python 特有の話,  Up: 参考資料<2>

9.7.10.1 一般論
...............

'計算機プログラムの構造と解釈'、Harold AbelsonとGerald Jay Sussman、
Julie Sussman著。この本は ‘https://mitpress.mit.edu/sicp’ で見れます。こ
の計算機科学の古典的な教科書では、2章と3章でシーケンスとストリームを使っ
てプログラム内のデータフローを整理する方法について説明しています。この本
では例に Scheme を使っていますが、これらの章で説明されている設計アプロー
チの多くは、関数型スタイルの Python コードにも適用できます。

‘https://defmacro.org/2006/06/19/fp.html’: A general introduction to
functional programming that uses Java examples and has a lengthy
historical introduction.

‘https://en.wikipedia.org/wiki/Functional_programming’: 関数プログラミン
グに関する一般的な内容の記事。

‘https://en.wikipedia.org/wiki/Coroutine’: コルーチンに関する記事。

‘https://en.wikipedia.org/wiki/Partial_application’: 関数の部分適用の概
念についての記事。

‘https://en.wikipedia.org/wiki/Currying’: カリー化の概念に関する記事。


File: python.info,  Node: Python 特有の話,  Next: Python 文書,  Prev: 一般論,  Up: 参考資料<2>

9.7.10.2 Python 特有の話
........................

‘https://gnosis.cx/TPiP/’: David Mertz's の本の最初の章 ‘Text Processing
in Python’ では文書処理のための関数プログラミングについて議論しています
、この議論の節には "Utilizing Higher-Order Functions in Text Processing"
というタイトルがついています。

Mertz は IBM の DeveloperWorks サイトにも関数型プログラミングに関する 3
部構成の記事を書いています; part 1(1), part 2(2), part 3(3),

   ---------- Footnotes ----------

   (1) https://developer.ibm.com/articles/l-prog/

   (2) https://developer.ibm.com/tutorials/l-prog2/

   (3) https://developer.ibm.com/tutorials/l-prog3/


File: python.info,  Node: Python 文書,  Prev: Python 特有の話,  Up: 参考資料<2>

9.7.10.3 Python 文書
....................

*note itertools: 84. モジュールの文書。

*note functools: 62. モジュールについてのドキュメント。

*note operator: a3. モジュールの文書。

PEP 289(1): "Generator Expressions"

PEP 342(2): "Coroutines via Enhanced Generators" describes the new
generator features in Python 2.5.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0289/

   (2) https://peps.python.org/pep-0342/


File: python.info,  Node: Logging HOWTO,  Next: Logging クックブック,  Prev: 関数型プログラミング HOWTO,  Up: Python HOWTO

9.8 Logging HOWTO
=================


著者: Vinay Sajip <vinay_sajip at red-dove dot com>

このページはチュートリアルです。レファレンスやロギングクックブックは、
*note その他のリソース: 5aea. を参照してください。

* 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(): 11e2, *note info(): 22eb, *note warning(): 1c99, *note error():
33cd. and *note critical(): 11e1. 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(): 1324.
普通に使う、コンソール出力の表示          

プログラムの通常の操作中に発生したイベ    A logger's *note info(): 22eb. (or
ントの報告 (例えば、状態の監視や障害の    *note debug(): 11e2. method for very
分析)                                     detailed output for diagnostic purposes)
                                          
                                          
特定のランタイムイベントに関わる警告の    その発行が避けられるもので、クライアント
発行                                      アプリケーションを修正してその警告を排除
                                          するべきなら
                                          *note warnings.warn(): 18d1.
                                          
                                          A logger's *note warning(): 1c99. 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(): 33cd,
、長期のサーバプロセス中のエラーハンド    *note exception(): 11e0. or
ラ)                                       *note critical(): 11e1. 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(): dc6. 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(): 333. が使うデフォルト値が使われます。上の例に出てきていませんが
、同じく渡せるようになった '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(): dc6. の '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(): dc6. should come 'before' any calls to
a logger's methods such as *note debug(): 11e2, *note info(): 22eb, 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(): a17. や *note
string.Template: a7c. のような新しいフォーマットオプションよりも先に生ま
れました。新しいフォーマットオプションはサポートされて 'います' が、その
探求はこのチュートリアルでは対象としません。詳細は *note
固有の書式化スタイルをアプリケーション全体で使う: 33ea. を参照してくださ
い。


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 属性: 33cb. のドキュメ
ントから参照できますが、単純な用途では、必要なものは '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(): 15a8. でサポート
されているものと同じです。

   ---------- 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 クックブック:
15b6. もご覧ください。

   ---------- 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: 1394. インスタンスの形で、 logger,
handler, filter, formatter の間でやりとりされます。

ロギングは、 *note Logger: f10. クラスのインスタンス (以下 'ロガー') に
メソッドを呼び出すことで実行されます。各インスタンスには名前があり、名前
空間階層構造に、ドット (ピリオド) をセパレータとして、概念的に並べられて
います。例えば、 'scan' という名前のロガーは、ロガー 'scan.text',
'scan.html' および 'scan.pdf'の親です。ロガー名は、何でも望むものにでき
、ロギングされたメッセージが発生した場所を指し示します。

ロガーに名前をつけるときの良い習慣は、ロギングを使う各モジュールに、以下
のように名付けられた、モジュールレベルロガーを使うことです:

     logger = logging.getLogger(__name__)

これにより、ロガー名はパッケージ/モジュール階層をなぞり、ロガー名だけで
、どこでイベントのログが取られたか、直感的に明らかになります。

ロガーの階層構造の根源は、ルートロガーと呼ばれます。それが、関数 *note
debug(): 33cc, *note info(): 33f5, *note warning(): 339, *note error():
3409. および *note critical(): 340a. によって使われるロガーとなります。
これらの関数は単に、ルートロガーの同名のメソッドを呼び出します。これらの
関数とメソッドは、同じ署名をもっています。ルートロガーの名前は、ログ出力
では 'root' と表示されます。

もちろん、メッセージを異なる送信先に記録することも出来ます。このパッケー
ジでは、ファイルへ、 HTTP GET/POST 先へ、 SMTP 経由で電子メールへ、汎用
のソケットへ、キューへ、または Windows NT イベントログのような OS 毎のロ
グ記録機構への、ログメッセージの書きこみがサポートされています。送信先は
、 'handler' クラスによって取り扱われます。組み込みのハンドラクラスでは
満たせないような、特殊な要件があるなら、独自のログ送信先を生成できます。

デフォルトでは、どのロギングメッセージに対しても、送信先は設定されていま
せん。チュートリアルの例のように、 *note basicConfig(): dc6. を使って、
送信先 (コンソールやファイルなど) を指定できます。関数 *note debug():
33cc, *note info(): 33f5, *note warning(): 339, *note error(): 3409. お
よび *note critical(): 340a. を呼び出すと、それらは送信先が設定されてい
ないかを調べます。そして設定されていなければ、ルートロガーに委譲して実際
にメッセージを出力する前に、コンソール (‘sys.stderr’) を送信先に、デフォ
ルトのフォーマットを表示されるメッセージに設定します。

*note basicConfig(): dc6. が設定するデフォルトのメッセージのフォーマット
は次のようになります:

     severity:logger name:message

*note basicConfig(): dc6. の 'format' キーワード引数にフォーマット文字列
を渡すことで、これを変更できます。フォーマット文字列を構成するためのすべ
てのオプションは、 *note フォーマッタオブジェクト: 33e7. を参照してくだ
さい。

* 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: f10. オブジェクトの仕事は大きく三つに分かれます。一つ目は
、アプリケーションが実行中にメッセージを記録できるように、いくつかのメソ
ッドをアプリケーションから呼べるようにしています。二つ目に、ロガーオブジ
ェクトはどのメッセージに対して作用するかを、深刻度 (デフォルトのフィルタ
機構) またはフィルタオブジェクトに基づいて決定します。三つ目に、ロガーオ
ブジェクトは関心を持っているすべてのログハンドラに関連するログメッセージ
を回送します。

とりわけ広く使われるロガーオブジェクトのメソッドは、二つのカテゴリーに分
類できます: 設定とメッセージ送信です。

これらが設定メソッドの中でよく使われます:

   * *note Logger.setLevel(): 184b. はロガーが扱うログメッセージの最も低
     い深刻度を指定します。組み込みの深刻度の中では DEBUG が一番低く、
     CRITICAL が一番高くなります。たとえば、深刻度が INFO と設定されたロ
     ガーは INFO, WARNING, ERROR, CRITICAL のメッセージしか扱わず、
     DEBUG メッセージは無視します。

   * *note Logger.addHandler(): 33c6. と *note Logger.removeHandler():
     33c7. は、ハンドラオブジェクトをロガーオブジェクトから追加または削
     除します。ハンドラについては、 *note ハンドラ: 5af7. で詳しく述べま
     す。

   * *note Logger.addFilter(): 33ce. と *note Logger.removeFilter():
     33cf. はロガーオブジェクトにフィルタオブジェクトを追加または削除し
     ます。フィルタについては、 *note フィルタオブジェクト: 33f2. で詳し
     く述べます。

これらのメソッドを、生成したすべてのロガーに毎回呼び出さなければならない
わけではありません。この節の最後の 2 段落を参照してください。

ロガーオブジェクトが設定されれば、以下のメソッドがログメッセージを生成し
ます:

   * *note Logger.debug(): 11e2, *note Logger.info(): 22eb, *note
     Logger.warning(): 1c99, *note Logger.error(): 33cd, *note
     Logger.critical(): 11e1. はすべて、メッセージとメソッド名に対応した
     レベルでログ記録を作り出します。メッセージは実際にはフォーマット文
     字列であり、通常の文字列代入に使う ‘%s’, ‘%d’, ‘%f’ などを含むこと
     ができます。残りの引数はメッセージの代入される位置に対応するオブジ
     ェクトのリストです。 ‘**kwargs’ については、ログ記録メソッドが気に
     するキーワードは ‘exc_info’ だけで、例外の情報をログに記録するかを
     決定するのに使います。

   * *note Logger.exception(): 11e0. は *note Logger.error(): 33cd. と似
     たログメッセージを作成します。違いは ‘Logger.exception()’ がスタッ
     クトレースを一緒にダンプすることです。このメソッドは例外ハンドラか
     らだけ呼び出すようにしてください。

   * *note Logger.log(): 11df. はログレベルを明示的な引数として受け取り
     ます。これは上に挙げた便宜的なログレベル毎のメソッドを使うより少し
     コード量が多くなりますが、独自のログレベルを使うことができます。

*note getLogger(): d2e. は、指定されればその特定の名前の、そうでなければ
‘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: 184e. オブジェクトは適切なログメッセージを (ログメッセー
ジの深刻度に基づいて) ハンドラの指定された出力先に振り分けることに責任を
持ちます。 *note Logger: f10. オブジェクトには *note addHandler(): 33c6.
メソッドで 0 個以上のハンドラを追加することができます。例として、あるア
プリケーションがすべてのログメッセージをログファイルに、 error 以上のす
べてのログメッセージを標準出力に、 critical のメッセージはすべてメールア
ドレスに、それぞれ送りたいとします。この場合、 3 つの個別のハンドラがそ
れぞれの深刻度と宛先に応じて必要になります。

このライブラリには多くのハンドラが用意されています (*note
便利なハンドラ: 5af9. を参照してください) が、このチュートリアルでは
*note StreamHandler: 15b7. と *note FileHandler: 1e69. だけを例に取り上
げます。

アプリケーション開発者にとってハンドラを扱う上で気にするべきメソッドは極
々限られています。組み込みのハンドラオブジェクトを使う (つまり自作ハンド
ラを作らない) 開発者に関係あるハンドラのメソッドは、次の設定用のメソッド
だけでしょう:

   * *note setLevel(): 33dc. メソッドは、ロガーオブジェクトの場合と同様
     に、適切な出力先に振り分けられるべき最も低い深刻度を指定します。な
     ぜ 2 つも ‘setLevel()’ メソッドがあるのでしょうか?  ロガーで設定さ
     れるレベルは、付随するハンドラにどんな深刻度のメッセージを渡すか決
     めます。それぞれのハンドラで設定されるレベルは、そのハンドラがどの
     メッセージを転送するべきか決めます。

   * *note setFormatter(): 33dd. でこのハンドラが使用する Formatter オブ
     ジェクトを選択します。

   * *note addFilter(): 33de. および *note removeFilter(): 33df. はそれ
     ぞれハンドラへのフィルタオブジェクトの設定と解除を行います。

アプリケーションのコード中では *note Handler: 184e. のインスタンスを直接
インスタンス化して使ってはなりません。代わりに、 ‘Handler’ クラスはすべ
てのハンドラが持つべきインターフェイスを定義する基底クラスであり、子クラ
スが使える (もしくはオーバライドできる) いくつかのデフォルトの振る舞いを
規定します。


File: python.info,  Node: フォーマッタ,  Next: ロギングの環境設定,  Prev: ハンドラ,  Up: 上級ロギングチュートリアル

9.8.2.4 フォーマッタ
....................

フォーマッタオブジェクトは最終的なログメッセージの順序、構造および内容を
設定します。基底クラスである *note logging.Handler: 184e. とは違って、ア
プリケーションのコードはフォーマッタクラスをインスタンス化しても構いませ
ん。特別な振る舞いをさせたいアプリケーションではフォーマッタのサブクラス
を使う可能性もあります。コンストラクタは三つのオプション引数を取ります -
メッセージのフォーマット文字列、日付のフォーマット文字列、スタイル標識で
す。

 -- メソッド: 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 属性: 33cb. に文書化されています。 style が ‘'{'’ の場合、メッ
セージフォーマット文字列は (キーワード引数を使う) *note str.format():
a17. と互換となります。 style が ‘'$'’ の場合、メッセージフォーマット文
字列は *note string.Template.substitute(): 22e3. で期待されているものと
一致します。

バージョン 3.2 で変更: ‘style’ パラメータが追加されました。

次のメッセージフォーマット文字列は、人が読みやすい形式の時刻、メッセージ
の深刻度、およびメッセージの内容を、順番に出力します:

     '%(asctime)s - %(levelname)s - %(message)s'

フォーマッタは、ユーザが設定できる関数を使って、生成時刻をタプルに記録し
ます。デフォルトでは、 *note time.localtime(): 18b1. が使われます。特定
のフォーマッタインスタンスに対してこれを変更するには、インスタンスの
‘converter’ 属性を ‘time.localtime()’ や *note time.gmtime(): 157e. と同
じ署名をもつ関数に設定してください。すべてのフォーマッタインスタンスに対
してこれを変更するには、例えば全てのロギング時刻を GMT で表示するには、
フォーマッタクラスの ‘converter’ 属性を (GMT 表示の ‘time.gmtime’ に) 設
定してください。


File: python.info,  Node: ロギングの環境設定,  Next: 環境設定が与えられないとどうなるか,  Prev: フォーマッタ,  Up: 上級ロギングチュートリアル

9.8.2.5 ロギングの環境設定
..........................

プログラマは、ロギングを 3 種類の方法で設定できます:

  1. 上述の設定メソッドを呼び出す Python コードを明示的に使って、ロガー
     、ハンドラ、そしてフォーマッタを生成する。

  2. ロギング設定ファイルを作り、それを *note fileConfig(): f12. 関数を
     使って読み込む。

  3. 設定情報の辞書を作り、それを *note dictConfig(): 156e. 関数に渡す。

最後の2つの選択肢については、 *note 環境設定のための関数: 16ab. で解説し
ています。以下の例では、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(): f12. 関数はデフォルト引数
     ‘disable_existing_loggers’ を取り、後方互換性のためにデフォルト値は
     ‘True’ になっています。 これはあなたの望むものかもしれませんし、そ
     うでないかもしれません。というのは、設定で明示的に指定したクラス (も
     しくはその親クラス) を除いて、 ‘fileConfig()’ が呼び出される前に存
     在した非ルートロガーを無効化してしまうからです。 より詳細なことはリ
     ファレンスを参照し、望むならこの引数に ‘False’ を指定してください。

     *note dictConfig(): 156e. に渡される辞書でも、キー
     ‘disable_existing_loggers’ で真偽値を指定することができ、辞書の中で
     明示的に指定しなかった場合はデフォルトで ‘True’ と解釈されます。こ
     れは上で説明したロガー無効化につながりますが、それを望まないことも
     あるでしょう - その場合は、明示的にキーを与えて値を ‘False’ にして
     ください。

なお、設定ファイルで参照されるクラス名は、logging モジュールに対して相対
であるか、通常のインポート機構を使って解決される絶対である値でなければな
りません。従って、(logging モジュールに相対な) *note WatchedFileHandler:
3449. または (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 環境設定のための関数: 16ab. を
参照してください。


File: python.info,  Node: 環境設定が与えられないとどうなるか,  Next: ライブラリのためのロギングの設定,  Prev: ロギングの環境設定,  Up: 上級ロギングチュートリアル

9.8.2.6 環境設定が与えられないとどうなるか
..........................................

ロギング環境設定を与えられないと、ロギングイベントを出力しなければならな
いのに、イベントを出力するハンドラが見つからないことがあります。

イベントは、 *note lastResort: 15b9. に格納された「最終手段ハンドラ」を
使用して出力されます。この内部的なハンドラはどんなロガーにも関係しておら
ず、イベント記述メッセージを現在の ‘sys.stderr’ に書く *note
StreamHandler: 15b7. のように動作します (したがって、あらゆるリダイレク
トの効果が反映されます)。メッセージに対してフォーマットは行われません。
イベント記述メッセージだけがそのまま表示されます。ハンドラのレベルは
‘WARNING’ にセットされ、重大度がこれ以上のすべてのイベントが出力されます
。

バージョン 3.2 で変更: Python 3.2 より前のバージョンでは、振る舞いは以下
の通りです:

   * *note raiseExceptions: 15b8. が ‘False’ (製品モード) なら、イベント
     は黙って捨てられます。

   * *note raiseExceptions: 15b8. が ‘True’ (開発モード) なら、メッセー
     ジ 'No handlers could be found for logger X.Y.Z' が一度表示されます
     。

3.2 より前の動作にするために、*note lastResort: 15b9. を ‘None’ に設定す
ることもできます。


File: python.info,  Node: ライブラリのためのロギングの設定,  Prev: 環境設定が与えられないとどうなるか,  Up: 上級ロギングチュートリアル

9.8.2.7 ライブラリのためのロギングの設定
........................................

ロギングを使うライブラリを開発するときは、ライブラリがどのようにロギング
を使うのか、例えば使われているロガーの名前などを、ドキュメントにしておく
べきです。ロギングの設定については、いくつか考えておくべきこともあります
。使っているアプリケーションがロギングを使っていなくて、ライブラリコード
がロギングを呼び出すと、(前の節で解説したように) 重大度 ‘WARNING’ 以上の
イベントが、‘sys.stderr’ に表示されます。これが最高のデフォルトの振る舞
いと見なされます。

何らかの理由でロギング設定がなされていないときにメッセージを表示 'させた
くない' のであれば、ライブラリのトップレベルのロガーに何もしないハンドラ
を取り付けられます。ライブラリの全てのイベントに対してそのハンドラが見つ
かるので、メッセージが表示されなくなります。ライブラリのユーザーがアプリ
ケーションのためにロギングを設定する場合、おそらくハンドラが追加され、そ
してレベルが適切に設定された場合に、ライブラリコード内でのロギングの呼び
出しは通常通りそのハンドラに出力を送るようになります。

何もしないハンドラ *note NullHandler: 163e. (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: 163e. '以外のハ
     ンドラを追加しない' ことを強く推奨します。これは、ハンドラの設定が
     、あなたのライブラリを使うアプリケーション開発者にも伝播するからで
     す。アプリケーション開発者は、対象となる聴衆と、そのアプリケーショ
     ンにどのハンドラが最も適しているかを知っています。ハンドラを 'ボン
     ネットの中で' 加えてしまうと、ユニットテストをして必要に応じたログ
     を送達する能力に干渉しかねません。


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: 1394. クラスのインスタンスと
してエンコードされます。ロガーがあるイベントを実際にログ出力すると決定し
た場合、ログメッセージから ‘LogRecord’ インスタンスが生成されます。

ログ記録されるメッセージは、ハンドラ ('handlers') を通してディスパッチ機
構にかけられます。ハンドラは *note Handler: 184e. クラスのサブクラスのイ
ンスタンスで、ログ記録された (*note LogRecord: 1394. 形式の) メッセージ
が、そのメッセージの伝達対象となる相手 (エンドユーザ、サポートデスクのス
タッフ、システム管理者、開発者) に行き着くようにする役割を持ちます。ハン
ドラには特定の出力先を意図された ‘LogRecord’ インスタンスが渡されます。
各ロガーは 0 個以上のハンドラを (*note Logger: f10. の *note
addHandler(): 33c6. メソッド) で関連付けることができます。ロガーに直接関
連付けられたハンドラに加えて、'ロガーの上位にあるロガーすべてに関連付け
られたハンドラ' がメッセージを処理する際に呼び出されます (ただしロガーの
'propagate' フラグが false 値にセットされている場合を除きます。その場合
は、祖先ハンドラへの伝搬はそこで止まります)。

ロガーと同様に、ハンドラは関連付けられたレベルを持つことができます。ハン
ドラのレベルはロガーのレベルと同じ方法で、フィルタとして働きます。ハンド
ラがあるイベントを実際に処理すると決定した場合、 *note emit(): 33e5. メ
ソッドが使われ、メッセージを出力先に送信します。ほとんどのユーザ定義の
*note Handler: 184e. のサブクラスで、この ‘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: 184e. クラスに加え、多くの便利なサブクラスが提供さ
れています:

  1. *note StreamHandler: 15b7. インスタンスは、メッセージをストリーム
     (ファイル風オブジェクト) に送ります。

  2. *note FileHandler: 1e69. インスタンスは、メッセージをディスクファイ
     ルに送ります。

  3. *note BaseRotatingHandler: 344d. は、ある地点でログファイルを循環さ
     せるハンドラの基底クラスです。これを直接インスタンス化することは意
     図されていません。代わりに、 *note RotatingFileHandler: 1b78. や
     *note TimedRotatingFileHandler: 1310. を使用してください。

  4. *note RotatingFileHandler: 1b78. インスタンスは、メッセージをディス
     クファイルに送り、最大ログファイル数とログファイル循環をサポートし
     ます。

  5. *note TimedRotatingFileHandler: 1310. インスタンスは、メッセージを
     ディスクファイルに送り、ログファイルを特定時間のインターバルで循環
     します。

  6. *note SocketHandler: 1311. インスタンスは、 TCP/IP ソケットにメッセ
     ージを送ります。バージョン3.4　から、 Unixドメインソケットもサポー
     トされます。

  7. *note DatagramHandler: 1312. インスタンスは UDP ソケットにメッセー
     ジを送ります。バージョン 3.4 から、Unix ドメインソケットもサポート
     されます。

  8. *note SMTPHandler: 1af2. インスタンスは、メッセージを指示された
     email アドレスに送ります。

  9. *note SysLogHandler: a51. インスタンスは、メッセージを、必要ならば
     リモートマシンの、Unix syslog daemon に送ります。

  10. *note NTEventLogHandler: 19a6. インスタンスは、メッセージを
     Windows NT/2000/XP イベントログに送ります。

  11. *note MemoryHandler: 342c. インスタンスは、メッセージを、特定の基
     準が満たされる度に流される、メモリ中のバッファに送ります。

  12. *note HTTPHandler: 11e3. インスタンスは、メッセージを、 ‘GET’ また
     は ‘POST’ セマンティクスを使って、HTTP サーバに送ります。

  13. *note WatchedFileHandler: 3449. インスタンスは、ロギングする先のフ
     ァイルを監視します。ファイルが変更されると、そのファイルは閉じられ
     、ファイル名を使って再び開かれます。このハンドラは Unix 系のシステ
     ムにのみ便利です。Windows は、使われている基の機構をサポートしてい
     ません。

  14. *note QueueHandler: 1d7e. インスタンスは、 *note queue: be. モジュ
     ールや *note multiprocessing: 98. モジュールなどで実装されているキ
     ューにメッセージを送ります。

  15. *note NullHandler: 163e. インスタンスは、エラーメッセージについて
     何もしません。このクラスはライブラリ開発者が、 logging は使いたいが
     、ライブラリのユーザーが logging の設定をしなかったときに表示されう
     る 'No handlers could be found for logger 'XXX" のようなメッセージ
     を回避したいときに使います。詳しくは、 *note
     ライブラリのためのロギングの設定: 3446. を参照してください。

Added in version 3.1: *note NullHandler: 163e. クラス。

Added in version 3.2: *note QueueHandler: 1d7e. クラス。

コア logging パッケージで、 *note NullHandler: 163e, *note
StreamHandler: 15b7. および *note FileHandler: 1e69. クラスが定義されて
います。その他のハンドラは、サブモジュールの *note logging.handlers: 8c.
で定義されています。(環境設定機能のためのサブモジュール、 *note
logging.config: 8b. もあります。)

ログメッセージは、 *note Formatter: 184f. クラスのインスタンスを通してフ
ォーマット化してから表示されます。このインスタンスは、 % 演算子と辞書で
使うのに適切なフォーマット文字列で初期化されます。

複数のメッセージを一括してフォーマット化するには、 *note
BufferingFormatter: 33ee. が使えます。(一連の文字列のそれぞれに適用され
る) フォーマット文字列に加え、ヘッダとトレーラフォーマット文字列も提供さ
れています。

ロガーレベルおよび/またはハンドラレベルに基づくフィルタリングで十分でな
ければ、 *note Filter: 15ba. のインスタンスを *note Logger: f10. と
*note Handler: 184e. インスタンスの両方に (*note addFilter(): 33de. を通
して) 加えることができます。メッセージの処理を続ける前に、ロガーもハンド
ラも、全てのフィルタに許可を求めます。フィルタのいずれかが偽値を返したら
、メッセージの処理は続けられません。

基本の *note Filter: 15ba. 機能では、特定のロガー名でのフィルタリングを
できます。この機能が使われると、指名されたロガーに送られたメッセージとそ
の子だけがフィルタを通り、その他は落とされます。


File: python.info,  Node: ログ記録中に発生する例外,  Next: 任意のオブジェクトをメッセージに使用する,  Prev: 便利なハンドラ,  Up: Logging HOWTO

9.8.5 ログ記録中に発生する例外
------------------------------

logging パッケージは、ログを生成している間に起こる例外を飲み込むように設
計されています。これは、ログ記録イベントを扱っている間に発生するエラー
(ログ記録の設定ミス、ネットワークまたは他の同様のエラー) によってログ記
録を使用するアプリケーションが早期に終了しないようにするためです。

*note SystemExit: 10fb. と *note KeyboardInterrupt: d9a. 例外は決して飲
み込まれません。 *note Handler: 184e. サブクラスの *note emit(): 33e5. メ
ソッドの間に起こる他の例外は、 *note handleError(): 33e4. メソッドに渡さ
れます。

*note Handler: 184e. の *note handleError(): 33e4. のデフォルト実装は、
モジュールレベル変数 *note raiseExceptions: 15b8. が設定されているかどう
かチェックします。設定されているなら、トレースバックが *note sys.stderr:
d09. に出力されます。設定されていないなら、例外は飲み込まれます。

     注釈: *note raiseExceptions: 15b8. のデフォルト値は ‘True’ です。こ
     れは、開発の間に起こるどんな例外についても通常は通知してほしいから
     です。実運用環境では ‘raiseExceptions’ を ‘False’ に設定することを
     お勧めします。


File: python.info,  Node: 任意のオブジェクトをメッセージに使用する,  Next: 最適化<19>,  Prev: ログ記録中に発生する例外,  Up: Logging HOWTO

9.8.6 任意のオブジェクトをメッセージに使用する
----------------------------------------------

前の節とそこで挙げた例では、イベントを記録するときに渡されたメッセージが
文字列であると仮定していました。しかし、これは唯一の可能性ではありません
。メッセージとして任意のオブジェクトを渡すことができます。そして、ロギン
グシステムがそのオブジェクトを文字列表現に変換する必要があるとき、オブジ
ェクトの *note __str__(): a14. メソッドが呼び出されます。実際、そうした
ければ、文字列表現を計算することを完全に避けることができます - 例えば、
*note SocketHandler: 1311. は、イベントを pickle してネットワーク上で送
信することでログ出力します。


File: python.info,  Node: 最適化<19>,  Next: その他のリソース,  Prev: 任意のオブジェクトをメッセージに使用する,  Up: Logging HOWTO

9.8.7 最適化
------------

message 引数の整形は、必要になるまで延期されます。しかしながら、ログ記録
メソッドに渡す引数を計算するだけでもコストがかかる場合があります。ロガー
が単にイベントを捨てるなら、その計算を避けたいと考えるかもしれません。ど
うするかを決定するために *note isEnabledFor(): 16b0. メソッドを呼ぶこと
ができます。このメソッドは引数にレベルを取って、そのレベルの呼び出しに対
して Logger がイベントを生成するなら true を返します。このようにコードを
書くことができます:

     if logger.isEnabledFor(logging.DEBUG):
         logger.debug('Message with %s, %s', expensive_func1(),
                                             expensive_func2())

このようにすると、ロガーの閾値が ‘DEBUG’ より上に設定されている場合、
‘expensive_func1’ と ‘expensive_func2’ の呼び出しは行われません。

     注釈: ある種のケースでは、 *note isEnabledFor(): 16b0. それ自身があ
     なたが期待するよりも高価になる場合があります(たとえば明示的なレベル
     指定がロガー階層の上位のみに設定されていて、ロガーが深くネストされ
     ているような場合です)。そのようなケース(あるいはタイトなループ内で
     メソッド呼び出しを避けたい場合)は、 ‘isEnabledFor()’ 結果をローカル
     にもしくはインスタンス変数としてキャッシュし、メソッドを毎回呼び出
     すかわりに使えば良いです。そのようなキャッシュ値は、(まったく一般的
     ではありませんが)ロギング設定がアプリケーション実行中に動的に変更さ
     れた場合にのみ再計算が必要でしょう。

これ以外にも、どんなログ情報が集められるかについてより正確なコントロール
を必要とする、特定のアプリケーションでできる最適化があります。これは、ロ
グ記録の間の不要な処理を避けるためにできることのリストです:

不要な情報                                                それを避ける方法
                                                          
------------------------------------------------------------------------------------------------------------------
                                                          
呼び出しがどこから行われたかに関する情報。                ‘logging._srcfile’ を ‘None’ にする。このことにより
                                                          *note sys._getframe(): ad3. 呼び出しを避けることが出
                                                          来、PyPy のような環境(‘sys._getframe()’ の高速化が出
                                                          来ない)において高速化の役に立ちます。
                                                          
                                                          
スレッド情報。                                            ‘logging.logThreads’ を ‘False’ にする。
                                                          
                                                          
現在のプロセスID(*note os.getpid(): 323c.)                ‘logging.logProcesses’ を ‘False’ にする。
                                                          
                                                          
マルチプロセスの制御に ‘multiprocessing’ を使っていると   ‘logging.logMultiprocessing’ を ‘False’ にする。
きの、現在のプロセス名                                    

‘asyncio’ を使っているときの、現在の                      ‘logging.logAsyncioTasks’ を ‘False’ に設定する。
*note asyncio.Task: 467. の名前。                         

また、コア logging モジュールが基本的なハンドラだけを含んでいることに注
意してください。 *note logging.handlers: 8c. と *note logging.config:
8b. をインポートしなければ、余分なメモリを消費することはありません。


File: python.info,  Node: その他のリソース,  Prev: 最適化<19>,  Up: Logging HOWTO

9.8.8 その他のリソース
----------------------

参考
....

*note logging: 8a. モジュール

     logging モジュールの API リファレンス。

*note logging.config: 8b. モジュール

     logging モジュールの環境設定 API です。

*note logging.handlers: 8c. モジュール

     logging モジュールに含まれる、便利なハンドラです。

*note ロギングクックブック: 15b6.


File: python.info,  Node: Logging クックブック,  Next: Regular expression HOWTO,  Prev: Logging HOWTO,  Up: Python HOWTO

9.9 Logging クックブック
========================


著者: Vinay Sajip <vinay_sajip at red-dove dot com>

このページは、過去に有用であるとされていた、logging に関連するいくつもの
レシピを含んでいます。チュートリアルやリファレンス情報へのリンクについて
は *note その他のリソース: 5b0a. を参照してください。

* 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(): 33c6. メソ
ッドは追加されるハンドラの個数について最小値も最大値も定めていません。時
にアプリケーションがすべての深刻度のすべてのメッセージをテキストファイル
に記録しつつ、同時にエラーやそれ以上のものをコンソールに出力することが役
に立ちます。これを実現する方法は、単に適切なハンドラを設定するだけです。
アプリケーションコードの中のログ記録の呼び出しは変更されずに残ります。少
し前に取り上げた単純なモジュール式の例を少し変えるとこうなります:

     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: 1af2.: が電子メールを送るのに時間がかかることです
。しかし、ほとんどのネットワークをまたぐ handler はブロックする可能性が
あります: *note SocketHandler: 1311. による処理でさえ、裏で DNS への問い
合わせというとても遅い処理を行うことがあります (そしてこの問い合わせ処理
は、 Python の層より下のあなたの手の届かない、ソケットライブラリの深いと
ころにある可能性もあります)。

解決策の1つは、2パートに分離したアプローチを用いることです。最初のパート
は、パフォーマンスが重要なスレッドからアクセスされる、 *note
QueueHandler: 1d7e. だけをアタッチした logger です。この logger は単に、
十分大きい、あるいは無制限の容量を持ったキューに書き込むだけです。キュー
への書き込みは通常すぐに完了しますが、念の為に *note queue.Full: 38cc. 例
外をキャッチする必要があるかもしれません。もしパフォーマンスクリティカル
なスレッドを持つライブラリの開発者であるなら、このことを (‘QueueHandler’
だけをアタッチした logger についての言及を添えて) ドキュメントに書いてお
きましょう。

2つ目のパートは *note QueueHandler: 1d7e. の対向として作られた *note
QueueListener: 4d6. です。 ‘QueueListener’ はとてもシンプルで、キューと
handler を渡され、内部で ‘QueueHandler’ (もしくは他の ‘LogRecord’ の出力
元) から送られた LogRecord をキューから受け取るスレッドを起動します。
‘LogRecord’ をキューから取り出して、 handler に渡して処理させます。

分離した *note QueueListener: 4d6. クラスを持つメリットは、複数の
‘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: 4d6. ク
ラスは常にキューから受け取ったメッセージを、初期化元となっているそれぞれ
のハンドラーに受け渡していました。 ( というのも、レベルフィルターリング
は別サイド、つまり、キューが満たされている場所で処理されるということが想
定されているからです) Python 3.5以降では、キーワードとなる引数
‘respect_handler_level=True’ をリスナーのコントラクターに受け渡すことで
、この挙動を変更することができるようになっています。これが行われると、各
メッセージのレベルをハンドラーのレベルと比較して、そうすることが適切な場
合のみ、メッセージをハンドラーに渡します。

バージョン 3.14 で変更: The *note QueueListener: 4d6. can be started
(and stopped) via the *note with: 215. 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: 1311. インスタンスを送信端の 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: d5. モジュールを使って受信プログラムを作
成しておきます。簡単な実用プログラムを以下に示します:

     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(): 3464. メソッドをオーバーライ
ドし代替シリアライズ手法を実装して、それを使うように上記のスクリプトを修
正することもできます。

* 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: f10. インスタン
スを生成する誘惑に駆られるかもしれませんが、生成した ‘Logger’ インスタン
スはガーベジコレクションで回収されないので、これは良いアイデアとは言えま
せん。この例は現実的な問題ではないかもしれませんが、 ‘Logger’ インスタン
スの個数がアプリケーションの中でログ記録が行われるレベルの粒度に依存する
場合、 ‘Logger’ インスタンスの個数が事実上無制限にならないと、管理が難し
くなります。

* Menu:

* LoggerAdapter を使ったコンテキスト情報の伝達::
* Filter を使ったコンテキスト情報の伝達::


File: python.info,  Node: LoggerAdapter を使ったコンテキスト情報の伝達,  Next: Filter を使ったコンテキスト情報の伝達,  Up: コンテキスト情報をログ記録出力に付加する

9.9.9.1 LoggerAdapter を使ったコンテキスト情報の伝達
....................................................

logging イベントの情報と一緒に出力されるコンテキスト情報を渡す簡単な方法
は、 *note LoggerAdapter: 16af. を使うことです。このクラスは *note
Logger: f10. のように見えるように設計されていて、 *note debug(): 33cc,
*note info(): 33f5, *note warning(): 339, *note error(): 3409, *note
exception(): 184c, *note critical(): 340a, *note log(): 340b. の各メソッ
ドを呼び出せるようになっています。これらのメソッドは対応する ‘Logger’ の
メソッドと同じ引数を取るので、二つの型を取り替えて使うことができます。

*note LoggerAdapter: 16af. のインスタンスを生成する際には、 *note
Logger: f10. インスタンスとコンテキスト情報を収めた辞書風 (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: 16af. の *note process(): 3402. メソッドがコンテキ
スト情報をログ出力に加える場所です。そこではログ記録呼び出しのメッセージ
とキーワード引数が渡され、加工された (可能性のある) それらの情報を配下の
ロガーへの呼び出しに渡し直します。このメソッドのデフォルト実装ではメッセ
ージは元のままですが、キーワード引数にはコンストラクタに渡された辞書風オ
ブジェクトを値として "extra" キーが挿入されます。もちろん、呼び出し時に
"extra" キーワードを使った場合には何事もなかったかのように上書きされます
。

"extra" を用いる利点は辞書風オブジェクトの中の値が *note LogRecord:
1394. インスタンスの __dict__ にマージされることで、辞書風オブジェクトの
キーを知っている *note Formatter: 184f. を用意して文字列をカスタマイズす
るようにできることです。それ以外のメソッドが必要なとき、たとえばコンテキ
スト情報をメッセージの前や後ろにつなげたい場合には、 *note
LoggerAdapter: 16af. から *note process(): 3402. を望むようにオーバライ
ドしたサブクラスを作ることが必要なだけです。次に挙げるのはこのクラスを使
った例で、コンストラクタで使われる「辞書風」オブジェクトにどの振る舞いが
必要なのかも示しています:

     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: 16af. に渡すのは本物の dict でなくても構いません。
‘__getitem__’ と ‘__iter__’ を実装していて logging が辞書のように扱える
クラスのインスタンスを利用することができます。これは (dict の値が固定さ
れるのに対して) 値を動的に生成できるので便利です。


File: python.info,  Node: Filter を使ったコンテキスト情報の伝達,  Prev: LoggerAdapter を使ったコンテキスト情報の伝達,  Up: コンテキスト情報をログ記録出力に付加する

9.9.9.3 Filter を使ったコンテキスト情報の伝達
.............................................

ユーザ定義の *note Filter: 15ba. を使ってログ出力にコンテキスト情報を加
えることもできます。 ‘Filter’ インスタンスは、渡された ‘LogRecords’ を修
正することができます。これにより、適切なフォーマット文字列や必要なら
*note Formatter: 184f. を使って、出力となる属性を新しく追加することも出
来ます。

例えば、web アプリケーションで、処理されるリクエスト (または、少なくとも
その重要な部分) は、スレッドローカル (*note threading.local: 1aa6.) な変
数に保存して、 ‘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:
f6. と *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: 184e. はそれぞれ一連のフィルタを独自に持っています。コン
テキスト情報を、他のハンドラに漏らすことなく *note LogRecord: 1394. に付
加したい場合、以下に示すスクリプトのように、直接レコードを編集する代わり
に新しい ‘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:
1311. に対してログ記録を行い、独立したプロセスとしてソケットサーバを動か
すことです。ソケットサーバはソケットから読み取ってファイルにログを書き出
します。 (この機能を実行するために、既存のプロセスの 1 つのスレッドを割
り当てることもできます) *note この節: 5b14. では、このアプローチをさらに
詳細に文書化しています。動作するソケット受信プログラムが含まれているので
、アプリケーションに組み込むための出発点として使用できるでしょう。

You could also write your own handler which uses the *note Lock: 1a9c.
class from the *note multiprocessing: 98. module to serialize access to
the file from your processes.  The stdlib *note FileHandler: 1e69. and
subclasses do not make use of ‘multiprocessing’.

別の方法として、 ‘Queue’ と *note QueueHandler: 1d7e. を使って、マルチプ
ロセスアプリケーションの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: 211. を使いたいのであれば、少し
違う方法でキューを作る必要があります。次のような方法の代わりに

     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:
1311. 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:
5b16. 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: 1b78. を提供しています:

     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:
a7c. (Python 2.4 で追加) と *note str.format(): a17. (Python 2.6 で追加)
が加わりました。

logging は (3.2 から) この2つの追加されたフォーマット方法をサポートして
います。 *note Formatter: 184f. クラスが ‘style’ という名前のオプション
のキーワード引数を受け取ります。このデフォルト値は ‘'%'’ ですが、他に
‘'{'’ と ‘'$'’ が指定可能で、それぞれのフォーマット方法に対応しています
。後方互換性はデフォルト値によって維持されていますが、明示的に style 引
数を指定することで、 *note str.format(): a17. か *note string.Template:
a7c. を使った 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(): a17. や *note string.Template: a7c. を使っ
て 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(): 1821. やその仲間によくエイリアスとして使われるアンダ
ースコア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: 16af. を利用して上と似たような効果
を実現する方法もあります:

     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: 1394. のインスタンスとして表
現されます。イベントのログが取られて logger のレベルでフィルタされなかっ
た場合、イベントの情報を含む ‘LogRecord’ が生成され、その logger (と、
propagate が無効になるまでの上位 logger) の handler に渡されます。
Python 3.2 までは、この生成が行われているのは2箇所だけでした:

   * *note Logger.makeRecord(): 33d3.: 通常のイベント logging プロセスで
     呼ばれます。これは *note LogRecord: 1394. を直接読んでインスタンス
     を生成します。

   * *note makeLogRecord(): 33f9.: LogRecord に追加される属性を含む辞書
     を渡して呼び出されます。これはネットワーク越しに (pickle 形式で
     *note SocketHandler: 1311. 経由で、あるいは JSON 形式で *note
     HTTPHandler: 11e3. 経由で) 辞書を受け取った場合などに利用されます。

そのために *note LogRecord: 1394. で何か特別なことをしたい場合は、次のど
ちらかをしなければなりません。

   * *note Logger.makeRecord(): 33d3. をオーバーライドした独自の *note
     Logger: f10. のサブクラスを作り、利用したい logger のどれかがインス
     タンス化される前に、それを *note setLoggerClass(): 3408. を使って登
     録する。

   * *note filter(): 33f4. メソッドで必要な特殊な処理を行う *note
     Filter: 15ba. を logger か handler に追加する。

最初の方法は、複数の異なるライブラリが別々のことをしようとした場合にうま
く行きません。各ライブラリが独自の *note Logger: f10. のサブクラスを登録
しようとして、最後に登録されたライブラリが生き残ります。

2つ目の方法はほとんどのケースでうまくいきますが、たとえば *note
LogRecord: 1394. を特殊化したサブクラスを使うことなどはできません。ライ
ブラリの開発者は利用している logger に適切な filter を設定できますが、新
しい logger を作るたびに忘れずに設定しないといけなくなります。 (新しいパ
ッケージやモジュールを追加し、モジュールレベルで次の式を実行することで、
新しい logger が作られます)

     logger = logging.getLogger(__name__)

これでは考えることが余計に1つ増えてしまうでしょう。開発者は、最も高いレ
ベルのロガーに取り付けられた *note NullHandler: 163e. に、フィルタを追加
することもできますが、アプリケーション開発者が、より低いレベルに対するラ
イブラリのロガーにハンドラを取り付けた場合、フィルタは呼び出されません
-- 従って、そのハンドラからの出力はライブラリ開発者の意図を反映したもの
にはなりません。

Python 3.2 以降では、 *note LogRecord: 1394. の生成は、指定できるファク
トリ経由になります。ファクトリは callable で、 *note
setLogRecordFactory(): 33fd. で登録でき、 *note getLogRecordFactory():
33fc. で現在のファクトリを取得できます。ファクトリは ‘LogRecord’ コンス
トラクタと同じシグネチャで呼び出され、 *note LogRecord: 1394. がデフォル
トのファクトリとして設定されています。

このアプローチはカスタムのファクトリが 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: 15ba. を利用するだけでは望む結果が得られな
い場合にのみ使うべきです。


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: 1d7e. のサブクラスを作ってメッセージを他のキュー、例
えば 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: 4d6. のサブクラスを作って、メッセージを他のキュー、
例えば 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(): 156e.
に渡して設定を有効にします:

     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: a51. に、 message に BOM を挿入するコ
ードが追加されました。しかし、そのときの実装が悪くて、 message の先頭に
BOM をつけてしまうのでピュアASCII 部分をその前に書くことができませんでし
た。

この動作は壊れているので、Python 3.2.4 以降では BOM を挿入するコードが、
削除されました。書き直されるのではなく削除されたので、 RFC 5424(3) 準拠
の、BOM と、オプションのピュア ASCII部分をBOMの前に、任意の Unicode を
BOM の後ろに持つ UTF-8 でエンコードされた message を生成したい場合、次の
手順に従う必要があります:

  1. *note SysLogHandler: a51. のインスタンスに、次のような format 文字
     列を持った *note Formatter: 184f. インスタンスをアタッチする:

          '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(): 156e. を使っているなら、サブクラスを作らなくてもカスタマイ
ズが可能です。例えば、ログファイルの owner を設定したいとします。これは
POSIX 環境では *note shutil.chown(): 750. を使って簡単に実現できますが、
標準ライブラリの 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(): 156e. に渡される構成設定の中で、この関数を
使って 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(): 750. が追加されたのが Python 3.3 からなので、この
例は Python 3.3 を使っています。このアプローチ自体は *note dictConfig():
156e. をサポートした全ての Python バージョン - Python 2.7, 3.2 以降 - で
利用できます。 3.3 以前のバージョンでは、オーナーを変更するのに *note
os.chown(): 14af. を利用する必要があるでしょう。

実際には、handler を生成する関数はプロジェクト内のどこかにあるユーティリ
ティモジュールに置くことになるでしょう。設定の中で直接関数を参照する代わ
りに:

     '()': owned_file_handler,

次のように書くこともできます:

     '()': 'ext://project.util.owned_file_handler',

‘project.util’ は関数がある実際の場所に置き換えてください。上のスクリプ
トでは ‘'ext://__main__.owned_file_handler'’ で動くはずです。 *note
dictConfig(): 156e. は ‘ext://’ から実際の callable を見つけます。

この例は他のファイルに対する変更を実装する例にもなっています。例えば
*note os.chmod(): 732. を使って、同じ方法で POSIX パーミッションを設定で
きるでしょう。

もちろん、このアプローチは *note FileHandler: 1e69. 以外の handler 、ロ
ーテートする file handler のいずれかやその他の handler にも適用できます
。


File: python.info,  Node: 固有の書式化スタイルをアプリケーション全体で使う,  Next: filter を dictConfig を使ってカスタマイズする,  Prev: handler を dictConfig を使ってカスタマイズする,  Up: Logging クックブック

9.9.24 固有の書式化スタイルをアプリケーション全体で使う
-------------------------------------------------------

Python 3.2 では、*note Formatter: 184f. クラスが ‘style’ という名前のオ
プションのキーワード引数を受け取ります。このデフォルト値は後方互換性を維
持するために ‘%’ となっていますが、 ‘{’ か ‘$’ を指定することで、*note
str.format(): a17. か *note string.Template: a7c. でサポートされているの
と同じ書式化のアプローチを採れます。これは最終的に出力されるログメッセー
ジの書式化に影響を与えますが、個々のログメッセージが構築される方法とは完
全に直交していることに注意してください。

ロギングの呼び出し (*note debug(): 11e2, *note info(): 22eb. など) はロ
グメッセージのためには位置引数しか取らず、ロギングの呼び出しを処理する方
法を決定するためだけにキーワード引数を指定できます (たとえば ‘exc_info’
キーワード引数はトレースバックの情報をログに含めるかどうかを指定し、
‘extra’ キーワード引数はログに付加する追加のコンテキスト情報を指定します
)。ロギングパッケージは内部で %-format を使って書式文字列に可変長引数を
埋め込んでいるため、 *note str.format(): a17. や *note string.Template:
a7c. の構文を使って直接ロギングの呼び出しを行うことはできません。既存の
コードにおける全てのロギングの呼び出しは %-format 文字列を使っているため
、後方互換性を維持する限りこの部分が変更されることはないでしょう。

特定のロガーに関連付ける書式スタイルへの提案がなされてきましたが、そのア
プローチは同時に後方互換性の問題にぶち当たります。あらゆる既存のコードは
ロガーの名前を使っているでしょうし、 % 形式書式化を使っているでしょう。

あらゆるサードパーティのライブラリ、あらゆるあなたのコードの間で相互運用
可能なようにロギングを行うには、書式化についての決定は、個々のログ呼び出
しのレベルで行う必要があります。これは受け容れ可能な代替書式化スタイルに
様々な手段の可能性を広げます。

* Menu:

* LogRecord ファクトリを使う::
* カスタムなメッセージオブジェクトを使う::


File: python.info,  Node: LogRecord ファクトリを使う,  Next: カスタムなメッセージオブジェクトを使う,  Up: 固有の書式化スタイルをアプリケーション全体で使う

9.9.24.1 LogRecord ファクトリを使う
...................................

Python 3.2 において、上述した *note Formatter: 184f. の変更とともに、
*note setLogRecordFactory(): 33fd. 関数を使って *note LogRecord: 1394. の
サブクラスをユーザに指定することを可能にするロギングパッケージの機能拡張
がありました。これにより、 *note getMessage(): 33fb. をオーバライドして
た　だ　し　い　ことをする、あなた自身の手による ‘LogRecord’ のサブクラ
スをセットすることが出来ます。このメソッドの実装は基底クラスでは ‘msg %
args’ 書式化をし、あなたの代替の書式化の置換が出来る場所ですが、他のコー
ドとの相互運用性を保障するために、全ての書式化スタイルをサポートするよう
注意深く行うべきであり、また、%-書式化をデフォルトで認めるべきです。基底
クラスの実装がそうしているように、 ‘str(self.msg)’ 呼び出しもしてくださ
い。

さらに詳しい情報は、リファレンスの *note setLogRecordFactory(): 33fd,
*note LogRecord: 1394. を参照してください。


File: python.info,  Node: カスタムなメッセージオブジェクトを使う,  Prev: LogRecord ファクトリを使う,  Up: 固有の書式化スタイルをアプリケーション全体で使う

9.9.24.2 カスタムなメッセージオブジェクトを使う
...............................................

あなた独自のログメッセージを構築するのに {}- および $- 書式化を使えるよ
うにするための、もうひとつの、おそらくもっと簡単な方法があります。ロギン
グの際には、あなたはメッセージ書式文字列として、任意のオブジェクトを使え
ることを(*note 任意のオブジェクトをメッセージに使用する: 33fa. より)思い
出してみましょう、そしてロギングパッケージはそのオブジェクトに対して実際
の書式文字列を得るために *note str(): 1ea. を呼び出すことも。以下 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(): a17. を
使ってフォーマットする例です:

     >>> __ = 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: a7c. でフォーマットする例です:

     >>> __ = 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(): 156e. によってフィルタを設定 '出来ます' が、どうやっ
てそれを行うのかが初見では明快とは言えないでしょう(そのためのこのレシピ
です)。 *note Filter: 15ba. のみが唯一標準ライブラリに含まれているだけで
すし、それは何の要求にも応えてはくれません(ただの基底クラスですから)ので
、典型的には *note filter(): 33f4. メソッドをオーバライドした ‘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 外部オブジェクトへのアクセス: 3429. に記述され
     ている ‘ext://...’ 形式を使えます。例えば、上記例のように
     ‘MyFilter’ と指定する代わりに、 ‘'ext://__main__.MyFilter'’ と記述
     することが出来ます。

   * フィルタについてとともに、このテクニックは、カスタムハンドラ、カス
     タムフォーマッタに対しても同様に使えます。ロギングが設定において、
     どのようにユーザ定義のオブジェクトをサポートするのかについてのさら
     なる詳細については、 *note ユーザ定義オブジェクト: 341d. と、本クッ
     クブックの上の方のレシピ *note handler を dictConfig()
     を使ってカスタマイズする: 5b33. を参照してください。


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: 107. モジュールが有用です。


File: python.info,  Node: ロギングメッセージを喋る,  Next: ロギングメッセージをバッファリングし、条件に従って出力する,  Prev: 例外の書式化をカスタマイズする,  Up: Logging クックブック

9.9.27 ロギングメッセージを喋る
-------------------------------

ロギングメッセージを目で見る形式ではなく音で聴く形式として出力したい、と
いう状況があるかもしれません。これはあなたのシステムで text- to-speech
(TTS) 機能が利用可能であれば、容易です。それが Python バインディングを持
っていなくとも、です。ほとんどの TTS システムはあなたが実行出来るコマン
ドラインプログラムを持っていて、このことで、 *note subprocess: df. を使
うことでハンドラが呼び出せます。ここでは、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: 342c. を使います。これにより何か条件を満
たすまでロギングイベントを溜め込むことが出来、条件を満たせば溜め込まれた
イベントが ‘flushed’ として他のハンドラ (‘target’ のハンドラ)に渡されま
す。デフォルトでは、 ‘MemoryHandler’ はそのバッファが一杯になるか、指定
された閾値のレベル以上のイベントが起こるとフラッシュされます。何か特別な
フラッシュの振る舞いをしたければ、このレシピはさらに特殊化した
‘MemoryHandler’ とともに利用出来ます。

スクリプト例では、 ‘foo’ という、単に全てのログレベルについて、
‘sys.stderr’ にもどのレベルを出力したのかについて書き出しながら実際のロ
グ出力も行う、という単純な関数を使っています。 ‘foo’ に真を与えると
ERROR と CRITICAL の出力をし、そうでなければ DEBUG, INFO, WARNING だけを
出力します。

スクリプトが行うことは単に、 ‘foo’ を必要とされている特定の条件でのロギ
ングを行うようにするデコレータで修飾することだけです。このデコレータはパ
ラメータとしてロガーを取り、修飾された関数が呼ばれている間だけメモリハン
ドラをアタッチします。追加のパラメータとして、ターゲットのハンドラ、フラ
ッシュが発生すべきレベル、バッファの容量(バッファされたレコード数)も受け
取れます。これらのデフォルトは順に ‘sys.stderr’ へ書き出す *note
StreamHandler: 15b7, ‘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: 347e. を継承します
。以下の例は、必要に応じて改変することもできますが、 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: 184f. の代わりに使え
ます。これを設定を通して行いたい場合、 *note dictConfig(): 156e. 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: f6. モジュールではなく、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: a51. 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.prefixmatch(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(): dc6. の呼び出しが (‘LoggerWriter’ インスタ
ンスで上書きされる '前の' ‘sys.stderr’ を使って) 設定を行います。そして
、以下のような結果を得るでしょう:

     >>> print('Foo')
     INFO:demo:Foo
     >>> print('Bar', file=sys.stderr)
     WARNING:demo:Bar
     >>>

言うまでもなく上記の例は *note basicConfig(): dc6. で使われている書式に
もとづく出力を示していますが、ロギングの設定で異なるフォーマッタを使うこ
とができます。

上記の例では、バッファリングや奪取した書き込み呼び出しのシーケンスの扱い
についてはなすがままになっています。たとえば、上記の ‘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
複数のプロセスからの単一ファイルへのログ記録: 5b1e. で紹介したテクニック
を使用してください。


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:
163e. インスタンス以外のロガーを追加してはいけない、ということを意味しま
す。


File: python.info,  Node: 大量のロガーを作成する,  Prev: ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する,  Up: 避けるべきパターン

9.9.37.4 大量のロガーを作成する
...............................

ロガーはシングルトンであり、スクリプトの実行中に解放されることがないため
、大量のロガーを作成すると、メモリが解放されることなく消費されます。ファ
イルの処理単位やネットワーク接続単位でロガーを作るのではなく、 *note
既存のメカニズム: 3401. を使ってコンテキスト依存の情報をログに渡し、ロガ
ーはアプリケーション内の説明の単位（通常はモジュールだが、場合によっては
それよりも小さい可能性もある）で作るように制限してください。


File: python.info,  Node: その他のリソース<2>,  Prev: 避けるべきパターン,  Up: Logging クックブック

9.9.38 その他のリソース
-----------------------

参考
....

*note logging: 8a. モジュール

     logging モジュールの API リファレンス。

*note logging.config: 8b. モジュール

     logging モジュールの環境設定 API です。

*note logging.handlers: 8c. モジュール

     logging モジュールに含まれる、便利なハンドラです。

*note 基本チュートリアル: 15b4.

*note 上級チュートリアル: 15b5.


File: python.info,  Node: Regular expression HOWTO,  Next: ソケットプログラミング HOWTO,  Prev: Logging クックブック,  Up: Python HOWTO

9.10 Regular expression HOWTO
=============================


著者: A.M. Kuchling <<amk@amk.ca>>

概要
....

このドキュメントは *note re: c1. モジュールを使って 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: c1. モジュールから利用可能です。この小さな言
語を利用することで、マッチさせたい文字列に適合するような文字列の集合を指
定することができます; この集合は英文や 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: 10e. モジュールで提
供されている Unicode データベースで letters としてマークされている全ての
文字とマッチします。正規表現のコンパイル時に *note re.ASCII: a22. フラグ
を与えることにより、 ‘\w’ を、より制限された定義で使うことが出来ます。

以下に続く特別な文字列のリストは完全ではありません。特殊シーケンスと拡張
クラスについてのユニコードパターンの定義についての完全なリストは、標準ラ
イブラリリファレンスの *note 正規表現の構文: b11. の最後のパートを参照し
てください。一般的にユニコードバージョンは、ユニコードデータベース内で相
応しいカテゴリに属すればマッチします。

‘\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:
2995.) があります。 ‘.’ は「任意の文字」にマッチさせたい場合に利用されま
す。


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: c1. モジュールは正規表現エン
ジンに対するインターフェースを提供していて、それらを使うことで正規表現を
オブジェクトにコンパイルし、マッチを実行することができます。

* Menu:

* Compiling regular expressions::
* The backslash plague::
* Performing matches::
* Module-level functions::
* 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(): f97. はいくつかの 'flags' 引数を受け付けることができ
ます、この引数はさまざまな特別な機能を有効にしたり、構文を変化させたりし
ます。利用できる設定に何があるかは後に飛ばすことにして、簡単な例をやるこ
とにしましょう:

     >>> p = re.compile('ab*', re.IGNORECASE)

正規表現は文字列として *note re.compile(): f97. に渡されます。正規表現は
文字列として扱われますが、それは正規表現が Python 言語のコアシステムに含
まれないためです、そのため正規表現を表わす特殊な構文はありません。 (正規
表現を全く必要としないアプリケーションも存在します、そのためそれらを含め
て言語仕様を無駄に大きくする必要はありません) その代わり、 *note re: c1.
モジュールは *note socket: d4. や *note zlib: 13c. モジュールのような通
常の 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():
f97. に渡す文字列は ‘\\section’ でなければいけません。しかし、これを
Python の文字列リテラルとして扱うにはこの二つのバックスラッシュを '再び'
エスケープする必要があります。

文字                    段階
                        
-----------------------------------------------------------------------
                        
‘\section’              マッチさせるテキスト
                        
                        
‘\\section’             *note re.compile(): f97. のためのバックスラ
                        ッシュエスケープ
                        
                        
‘"\\\\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: 451. and will eventually become a *note
SyntaxError: 189, 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,  Prev: The backslash plague,  Up: Using regular expressions

9.10.3.3 Performing matches
...........................

一旦コンパイルした正規表現を表現するオブジェクトを作成したら、次に何をし
ますか?  パターンオブジェクトはいくつかのメソッドや属性を持っています。
ここでは、その中でも最も重要なものについて扱います; 完全なリストは *note
re: c1. ドキュメントを参照して下さい。

メソッド/属性          目的
                       
---------------------------------------------------------------------------
                       
‘search()’             文字列を先頭から走査して、正規表現がどこにマッチ
                       するか調べます。
                       
                       
‘prefixmatch()’        Determine if the RE matches at the beginning of
                       the string.  Previously named *note match(): 305.
                       
                       
‘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: 6d4.
                       

*note search(): 29a6. and *note prefixmatch(): 257. return ‘None’ if no
match can be found.  If they're successful, a *note match object: 1337.
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: c1. module.

この HOWTO では例として標準の Python インタプリタを使います。最初に
Python インタプリタを起動して、 *note re: c1. モジュールをインポートし、
正規表現をコンパイルします:

     >>> 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 search(): 29a6. should return ‘None’ in this case,
which will cause the interpreter to print no output.  You can explicitly
print the result of ‘search()’ to make this clear.

     >>> p.search("")
     >>> print(p.search(""))
     None

Now, let's try it on a string that it should match, such as ‘tempo’.  In
this case, *note search(): 29a6. will return a *note match object: 1337,
so you should store the result in a variable for later use.

     >>> m = p.search('tempo')
     >>> m
     <re.Match object; span=(0, 5), match='tempo'>

これでマッチした文字列についての情報を *note Match オブジェクト: 1337. に
問い合わせることが出来ます。 Match オブジェクトインスタンスはいくつかの
メソッドと属性も持っていて、最も重要なのは次のものです:

メソッド/属性          目的
                       
------------------------------------------------------------------------
                       
‘group()’              正規表現にマッチした文字列を返す
                       
                       
‘start()’              マッチの開始位置を返す
                       
                       
‘end()’                マッチの終了位置を返す
                       
                       
‘span()’               マッチの位置 (start, end) を含むタプルを返す
                       

これらのメソッドを試せば、その意味はすぐに理解できます:

     >>> m.group()
     'tempo'
     >>> m.start(), m.end()
     (0, 5)
     >>> m.span()
     (0, 5)

*note group(): 13d7. returns the substring that was matched by the RE.
*note start(): 29b8. and *note end(): 29b9. return the starting and
ending index of the match.  *note span(): 29ba. returns both start and
end indexes in a single tuple.  The *note search(): 29a6. method of
patterns scans through the string, so the match may not start at zero.
However, the *note prefixmatch(): 257. method only checks if the RE
matches at the start of a string, so ‘start()’ will always be zero in
that case.

     >>> m = p.search('::: message'); print(m)
     <re.Match object; span=(4, 11), match='message'>
     >>> m.group()
     'message'
     >>> m.span()
     (4, 11)
     >>> print(p.prefixmatch('::: message'))
     None

実際のプログラムでは *note Match オブジェクト: 1337. を変数に記憶してお
き, その次に ‘None’ なのか調べるのが一般的なスタイルです。普通このように
します:

     p = re.compile( ... )
     m = p.search( 'string goes here' )
     if m:
         print('Match found: ', m.group())
     else:
         print('No match')

あるパターンにマッチするもの全てを返す Pattern インスタンスのメソッドが
2つあります。 *note findall(): 29ac. はマッチした文字列のリストを返しま
す:

     >>> 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: 451. and will
eventually become a *note SyntaxError: 189.  See *note The backslash
plague: 5b5d.

*note findall(): 29ac. は結果を返す前に完全なリストを必ず生成してしまい
ます。いっぽう *note finditer(): 29ad. メソッドは *note
マッチオブジェクト: 1337. インスタンスのシーケンスを *note iterator:
6d4. として返します:

     >>> 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,  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: c1. module also provides top-level functions called *note
search(): 15e8, *note prefixmatch(): 256, *note findall(): 13d6, *note
sub(): 7a7, 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: 1337.
instance.

     >>> print(re.prefixmatch(r'From\s+', 'Fromage amk'))
     None
     >>> re.prefixmatch(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,  Up: Using regular expressions

9.10.3.5 Compilation flags
..........................

コンパイルフラグは正規表現の動作をいくつかの側面から変更します。フラグは
*note re: c1. モジュール下で二つの名前で利用することができます、例えば長
い名前は *note IGNORECASE: 1cba. で短い名前は1文字で *note I: 2998. のよ
うになっています。 (1文字形式は Perl のパターン修飾子と同じ形式を使いま
す; 例えば *note re.VERBOSE: 29a4. の短かい形式は *note re.X: 299d. です
。) 複数のフラグが OR ビット演算で指定することができます; 例えば ‘re.I |
re.M’ は ‘I’ と *note M: 299a. フラグの両方を設定します。

ここに利用可能なフラグの表があります、それぞれについてのより詳細な説明が
後に続きます。

Flag                                  意味
                                      
---------------------------------------------------------------------------------------
                                      
*note ASCII: a22, *note A: 2997.      ‘\w’, ‘\b’, ‘\s’, そして ‘\d’ などをそれぞれの
                                      プロパティをもつ ASCII 文字だけにマッチさせま
                                      す。
                                      
                                      
*note DOTALL: 2995, *note S: 299b.    ‘.’ を改行を含む任意の文字にマッチするようにし
                                      ます。
                                      
                                      
*note IGNORECASE: 1cba,               大文字小文字を区別しないマッチを行います。
*note I: 2998.                        

*note LOCALE: f2d, *note L: 2999.     ロケールに対応したマッチを行います。
                                      
                                      
*note MULTILINE: 2996,                ‘^’ や ‘$’ の意味を変更し、複数行文字列に対す
*note M: 299a.                        るマッチングを行います。
                                      
                                      
*note VERBOSE: 29a4, *note X: 299d.   冗長な正規表現を利用できるようにして、よりきれ
('X' は 'extended' の 'X')            いで理解しやすくまとめることができます。
                                      

 -- データ: re.I

 -- データ: re.IGNORECASE

     大文字と小文字を区別しないマッチングを実行します; 文字クラスと文字
     列リテラルは大文字か小文字かに関係なくパターンにマッチします。例え
     ば、 ‘[A-Z]’ は小文字のアルファベットにもマッチします。 *note
     ASCII: a22. フラグによって非 ASCII 文字のマッチングが無効化されてい
     なければ、完全なユニコードのマッチングも可能です。ユニコードで
     ‘[a-z]’ または ‘[A-Z]’ が *note IGNORECASE: 1cba. フラグとともに使
     われると、 52個の ASCII 文字に加えて 次の4つの 非 ASCII 文字にマッ
     チします: 'İ' (U+0130, ラテン語の大文字 I で、上部に点がついたもの
     ), 'ı' (U+0131, ラテン語の小文字 i で上部に点がない), 'ſ' (U+017F,
     ラテン語の小文字 s), 'K' (U+212A, ケルビン記号)。 ‘Spam’ は
     ‘'Spam'’, ‘'spam'’, ‘'spAM'’, そして ‘'ſpam'’ にマッチします (ただ
     し最後の文字列はユニコードモードの場合のみマッチします)。この「小文
     字化」は現在のロケールを考慮しません; ただし *note LOCALE: f2d. フ
     ラグをセットした場合はロケールを考慮します。

 -- データ: re.L

 -- データ: re.LOCALE

     ‘\w’, ‘\W’, ‘\b’, ‘\B’ と小文字大文字の区別を無視したマッチングを、
     Unicode データベースではなく現在のロケールに従って行います。

     ロケールは言語の違いを考慮したプログラムを書くことを手助けすること
     を目的とした C ライブラリの機能です。例えば、エンコードされたフラン
     ス語のテキストを処理していて、‘\w+’ を使って単語のマッチを行いたい
     とします。ですがこの場合、 ‘\w’ はバイトパターンにおいて文字クラス
     ‘[A-Za-z]’ だけにマッチします; すなわち ‘é’ や ‘ç’ に対応するバイト
     列にはマッチしません。もしシステムが適切に設定されていて、ロケール
     がフランス語に設定されていれば、ある C 関数はプログラムに ‘é’ に対
     応するバイト列も文字として考慮するべきであると伝えます。正規表現を
     コンパイルするときに *note LOCALE: f2d. フラグを設定すると、コンパ
     イルされたオブジェクトが ‘\w’ に対してロケールを考慮する C 関数を使
     うようになります; これにより処理は遅くなりますが、 ‘\w+’ を期待通り
     フランス語の単語にマッチさせることが可能になります。このフラグを
     Python 3 で利用することは推奨されません。なぜならロケールの仕組みは
     非常に信頼性が低く、同時にひとつの "文化" しか扱うことができず、ま
     た8ビットのロケールでしか正しく動作しないからです。Python 3 ではユ
     ニコード (文字列の) パターンに対してユニコードのマッチングがデフォ
     ルトで有効化されており、これにより異なるロケールまたは言語を同時に
     扱うことができます。

 -- データ: re.M

 -- データ: re.MULTILINE

     (‘^’ と ‘$’ についてはまだ説明していません; これらは *note More
     metacharacters: 5b61. の節で説明します。)

     通常 ‘^’ は文字列の先頭にマッチし、 ‘$’ は文字列の末尾と文字列の末
     尾に改行(があれば)その直前にマッチします。このフラグが指定されると
     、 ‘^’ は文字列の先頭と文字列の中の改行に続く各行の先頭にマッチしま
     す。同様に ‘$’ 特殊文字は文字列の末尾と各行の末尾(各改行の直前)のど
     ちらにもマッチします。

 -- データ: 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: 29a4. を利用した正規表現があります
     ; 読み易いと思いませんか?

          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: 29a4. を使った場
     合に比べるとまだ難しくなっています。


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: 2996. フラグが設定されな
     い場合には、文字列の先頭にのみマッチします。 ‘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: 2996. モードでな
     い場合には ‘\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.search('ababababab').span())
     (0, 10)

‘'('’, ‘')'’ で指示されたグループは、マッチしたテキスト開始と終了位置も
キャプチャします; *note group(): 13d7, *note start(): 29b8, *note end():
29b9, *note span(): 29ba. に引数を与えて取り出せます。グループはゼロ始ま
りの数値です。グループ 0 は常に使えます; それは RE でマッチした全体で、
*note Match オブジェクト: 1337. メソッドの全てはグループ 0 をデフォルト
引数にしています。マッチするテキストの範囲をキャプチャしないグループの書
き方はのちほど見ることにします。

     >>> p = re.compile('(a)b')
     >>> m = p.search('ab')
     >>> m.group()
     'ab'
     >>> m.group(0)
     'ab'

サブグループは左から右へ1づつ番号付けされます。グループはネストしてもか
まいません; 番号を決めるには、単に開き括弧を左から右へ数え上げます。

     >>> p = re.compile('(a(b)c)d')
     >>> m = p.search('abcd')
     >>> m.group(0)
     'abcd'
     >>> m.group(1)
     'abc'
     >>> m.group(2)
     'b'

*note group(): 13d7. には一回に複数の引数を渡してもかまいません、その場
合にはそれらのグループに対応する値を含むタプルを返します。

     >>> m.group(2,1,2)
     ('b', 'abc', 'b')

*note groups(): 13d8. メソッドは 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.search("([abc])+", "abc")
     >>> m.groups()
     ('c',)
     >>> m = re.search("(?:[abc])+", "abc")
     >>> m.groups()
     ()

マッチしたグループの内容を取得しないということを除けば、取り込まないグル
ープは厳密に取り込むグループと同様に振る舞います; この中に何を入れてもか
まいません、 ‘*’ のような繰り返しの特殊文字で繰り返したり、他のグループ
(取り込むまたは取り込まない) の入れ子にすることもでいます。 ‘(?:...)’ は
特に、既にあるパターンを変更する際に便利です、なぜなら他の番号づけ新しい
グループを変更することなく新しいグループを追加することができます。取り込
むグループと取り込まないグループで検索のパフォーマンスに差がないことにも
触れておくべきことです; どちらも同じ速度で動作します。

より重要な機能は名前つきグループです: 番号で参照する代わりに、グループに
対して名前で参照できます。

名前つきグループのための構文は、 Python 固有拡張の一つ: ‘(?P<name>...)’
を使います。 'name' は、もちろん、グループの名前です。名前つきグループは
取り込むグループと完全に同じに振る舞い、加えて名前が関連付けられます。
*note Match オブジェクト: 1337. の取りこむグループを扱うメソッドは全て、
番号によるグループ参照のための整数、名前によるグループ参照のための文字列
、ともに許容しています。名前つきグループにも番号が振られますので、グルー
プについての情報を、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(): 29b7. を使って辞書として
取り出すこともできます:

     >>> m = re.search(r'(?P<first>\w+) (?P<last>\w+)', 'Jane Doe')
     >>> m.groupdict()
     {'first': 'Jane', 'last': 'Doe'}

名前つきグループは、番号を覚える代わりに簡単に覚えられる名前で管理できる
ため、便利です。以下は *note imaplib: 77. モジュールで使われている正規表
現の例です:

     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(): 125e. メソッドに似てはいますが、もっと
ずっと一般化したデリミタで分割出来ます; 文字列の ‘split()’ メソッドは単
に空白文字か固定文字列で分割出来るだけです。ご想像通り、モジュールレベル
の *note re.split(): 7a6. 関数もあります。

 -- メソッド: .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(): 7a6. は最初の引数に利用する正規表
現を追加しますが、それ以外は同じです。

     >>> 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(): 29ae. メソッドは置換する値をとります、
文字列と関数の両方をとることができ、文字列を処理します。

 -- メソッド: .sub (replacement, string[, count=0])

     'string' 内で最も長く、他の部分と重複するところがない正規表現を
     'replacement' に置換した文字列を返します。パターンが見つからなかっ
     た場合 'string' は変更されずに返されます。

     オプション引数 'count' はパターンの出現の最大置換回数です; 'count'
     は非負の整数でなければいけません。デフォルト値 0 は全ての出現で置換
     することを意味します。

ここに *note sub(): 29ae. メソッドを使った単純な例があります。これは色の
名前を ‘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(): 29af. メソッドも同じ働きをしますが、新しい文字列と置換の実
行回数を含む 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 オブジェクト: 1337. が引数として渡されるので、望みの置換と返
却のためにこの情報を利用出来ます。

続く例では、置換関数は十進数文字列を十六進数文字列に変換しています:

     >>> 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(): 7a7. 関数を使うときには、パターンが最
初の引数として渡されます。パターンはオブジェクトや文字列をとります; 正規
表現フラグを指定する必要がある場合、パターンオブジェクトを最初の引数とし
て使うか、修飾子を埋め込んだパターン文字列を使うかしなければいけません、
例えば ‘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::
* prefixmatch() (aka match) versus search(): prefixmatch aka match versus search.
* Greedy versus non-greedy::
* re.VERBOSE の利用: re VERBOSE の利用.


File: python.info,  Node: Use string methods,  Next: prefixmatch aka match versus search,  Up: Common problems

9.10.6.1 Use string methods
...........................

いくつかの場合 *note re: c1. モジュールを利用することは間違いである場合
があります。固定文字列や単一の文字クラスにマッチさせる場合や、 *note
IGNORECASE: 1cba. フラグのような ‘re’ の機能を利用しない場合、正規表現の
全ての能力は必要とされていなでしょう。文字列は固定文字列に対する操作を実
行するメソッドを持っていて、大きな汎用化された正規表現エンジンではなく、
目的のために最適化された単一の小さな C loop で実装されているため、大抵の
場合高速です.

一つの例としては、単一の固定文字列を別の固定文字列に置き換える作業がある
でしょう; 例えば ‘word’ を ‘deed’ で置換したい場合です。 *note re.sub():
7a7. はこの目的で使う関数のように思えますが、 *note replace(): 6c6. メソ
ッドを利用することを考えた方がいいでしょう。 ‘replace()’ は単語内の
‘word’ も置換し、 ‘swordfish’ を ‘sdeedfish’ に変えますが、安直な正規表
現 ‘word’ も同様に動作することに注意して下さい。(単語の一部に対する置換
の実行を避けるには、パターンを ‘\bword\b’ として、 ‘word’ の両側に単語の
境界が要求されるようにします。これは ‘replace()’ の能力を越えた作業です
。)

別のよくある作業は、文字列の中に出現する文字を全て削除することと、別の文
字で置換することです。この作業を ‘re.sub('\n', ' ', S)’ のようにして行う
かもしれませんが、 *note translate(): 199a. は削除と置換の両方の作業をこ
なし、正規表現操作よりも高速に行うことができます。

要は、 *note re: c1. モジュールに向う前に問題が高速で単純な文字列メソッ
ドで解決できるか考えましょうということです。


File: python.info,  Node: prefixmatch aka match versus search,  Next: Greedy versus non-greedy,  Prev: Use string methods,  Up: Common problems

9.10.6.2 prefixmatch() (aka match) versus search()
..................................................

*note prefixmatch(): 256. was added in Python 3.15 as the *note
preferred name: 305. for *note match(): 258.  Before this, it was only
known as ‘match()’ and the distinction with *note search(): 15e8. was
often misunderstood.

‘prefixmatch()’ aka ‘match()’ only checks if the RE matches at the
beginning of the string while ‘search()’ scans forward through the
string for a match.

     >>> print(re.prefixmatch('super', 'superstition').span())
     (0, 5)
     >>> print(re.prefixmatch('super', 'insuperable'))
     None

On the other hand, *note search(): 15e8. scans 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)

This distinction is important to remember when using the old *note
match(): 258. name in code requiring compatibility with older Python
versions.


File: python.info,  Node: Greedy versus non-greedy,  Next: re VERBOSE の利用,  Prev: prefixmatch aka 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.prefixmatch('<.*>', s).span())
     (0, 32)
     >>> print(re.prefixmatch('<.*>', s).group())
     <html><head><title>Title</title>

正規表現は ‘'<html>'’ 内の ‘'<'’ にマッチし、 ‘.*’ は残りの文字列の全て
にマッチします。 しかし、正規表現には依然として残っている部分があって、
‘>’ は文字列の終端にマッチしないので、正規表現エンジンは一文字ずつ ‘>’ と
マッチするまで引き返すことになります。 最終的にマッチする領域は
‘'<html>'’ の ‘'<'’ から ‘'</title>'’ の ‘'>'’ まで広がりますが、これは
望んだ結果ではありません。

この場合の解決策は、非貪欲 (non-greedy) な数量子 ‘*?’, ‘+?’, ‘??’, ある
いは ‘{m,n}?’ を使うことです。これらはできるだけ '少ない' テキストにマッ
チしようとします。上記の例では、 ‘'>'’ は ‘'<'’ がマッチした直後の文字か
らマッチするかどうかを調べられ、失敗すると同時にエンジンは文字を先に進め
ながら、各ステップで ‘'>'’ のマッチを試みます。この動作は正しい結果を生
成します:

     >>> print(re.prefixmatch('<.*?>', 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: 29a4. フラグを指定することが助けになります。なぜなら、より明
確な書式で正規表現を書けるからです。

‘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: 75e.

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
=================================


著者: Gordon McMillan

概要
....

ソケットはそこかしこで使われているが、最大級に誤解されている技術でもある
。この文書はソケットの全体像を俯瞰しており、チュートリアルとしてはあまり
役に立たない。実際に動くモノを完成させるには、他にもやらなければいけない
ことがあるからだ。この文書はソケットの微妙なところ (たくさんある) までは
カバーしていないが、恥ずかしくない使い方ができるようになる程度の情報は得
られるはずだ。

* Menu:

* ソケット::
* ソケットの作成: ソケットの作成<3>.
* ソケットの利用::
* 切断::
* ノンブロッキングソケット::


File: python.info,  Node: ソケット,  Next: ソケットの作成<3>,  Up: ソケットプログラミング HOWTO

9.11.1 ソケット
---------------

INET (すなわち IPv4) ソケットのことしか語らないつもりだが、利用率でいう
とソケットの 99% 以上はこれだ。さらに中でも STREAM (すなわち TCP) ソケッ
トに話題を絞ろうと思う - 自分が何をしているのか分かっているのでない限り
(分かってるならこの HOWTO なんて要らないだろ!)、STREAM ソケットが一番分
かりやすく、一番性能が出るのだ。そうやって謎に包まれたソケットの正体を明
らかにしてゆくと共に、ブロッキングおよびノンブロッキングなソケットの扱い
に関するいくつかのヒントを提示しよう。だが、まずはブロッキングソケットか
ら始めることにする。ノンブロッキングを扱うより先に、ブロッキングの仕組み
を知っておかなくてはならないのだ。

話を理解しにくくしている要因として、「ソケット」という言葉が文脈によって
微妙に違うものを指すことが挙げられる。そこでまず、「クライアント」ソケッ
ト - 対話の両端 - と「サーバ」ソケット - 電話交換手みたいなもの - の区別
を付けておこう。クライアントアプリケーション (たとえばブラウザ) は「クラ
イアント」ソケットだけを使うが、話し相手のウェブサーバは「サーバ」ソケッ
トと「クライアント」ソケットの両方を使う。

* Menu:

* 歴史::


File: python.info,  Node: 歴史,  Up: ソケット

9.11.1.1 歴史
.............

各種 IPC (Inter Process Communication (プロセス間通信) の中でも、ソケッ
トは群を抜いて人気がある。どのプラットフォームにも、ソケットより速い IPC
はあるだろう。だが、プラットフォームをまたぐ通信はソケットの独擅場だ。

ソケットは BSD Unix の一部としてバークレイで発明され、インターネットの普
及と共に野火のごとく広まった。それももっともなことで、ソケットと INET の
コンビによって世界中どんなマシンとも、信じられないほど簡単 (少なくとも他
のスキームと比べて) に通信できるようになったのだ。


File: python.info,  Node: ソケットの作成<3>,  Next: ソケットの利用,  Prev: ソケット,  Up: ソケットプログラミング HOWTO

9.11.2 ソケットの作成
---------------------

あなたがリンクをクリックしてこのページに来たとき、ブラウザは大雑把に言っ
て次のようなことをしたのである:

     # create an INET, STREAMing socket
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     # now connect to the web server on port 80 - the normal http port
     s.connect(("www.python.org", 80))

この ‘connect’ が完了すると、ソケット ‘s’ を使ってこのページ文章への要求
を送ることができるようになる。その同じソケットが返答を読み、そして破壊さ
れる。そう、破壊される。クライアントソケットは通常、一回 (か少数の) やり
取りで使い捨てになるのだ。

ウェブサーバで起こる事柄はもう少し複雑だ。まず「サーバソケット」を作る:

     # create an INET, STREAMing socket
     serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     # bind the socket to a public host, and a well-known port
     serversocket.bind((socket.gethostname(), 80))
     # become a server socket
     serversocket.listen(5)

ここで注意すべき点がいくつかある: 今回はソケットが外界に見えるよう、
‘socket.gethostname()’ を使った。 ‘s.bind(('localhost', 80))’ や
‘s.bind(('127.0.0.1', 80))’ でも「サーバ」ソケットにはなるが、それだと同
じマシン内にしか見えないものになってしまう。 ‘s.bind(('', 80))’ はこのマ
シンが持っている全てのアドレスで接続可能になるようにという指定になる。

ふたつめ: 小さな番号のポートは大抵、「ウェルノウン (有名)」なサービス
(HTTP, SNMP 等々) のために取ってある。お遊びで使うのなら適当に大きな数
(4桁) を使おう。

最後に: ‘listen’ の引数はソケットライブラリに、接続要求を 5 個 (通常の最
大値) まで順番待ちさせるように命じている。これ以降の外部接続は拒否するの
だが、コードが適切に書かれていれば、それで十分すぎるほどだ。

よし、「サーバーソケット」ができて、80 番ポートで耳を澄ましているところ
まで来た。では、ウェブサーバのメインループに入ろう:

     while True:
         # accept connections from outside
         (clientsocket, address) = serversocket.accept()
         # now do something with the clientsocket
         # in this case, we'll pretend this is a threaded server
         ct = make_client_thread(clientsocket)
         ct.start()

このループには実際のところ、3 通りの一般的な動作方法がある -
‘clientsocket’ を扱うようにスレッドを割り当てたり、‘clientsocket’ を扱う
新しいプロセスを作ったり、あるいはノンブロッキングソケットを使うようにア
プリを作り直して ‘select’ で「サーバ」ソケットとアクティブな
‘clientsocket’ の間を多重化したりするのだ。最後のについてはまた後にしよ
う。ここで理解しておくべき要点はこれだ: 以上が「サーバ」ソケットの仕事の
'すべて' である。データは一切送信しないし、受信しない。「クライアント」
ソケットを生み出すだけ。我々のバインドされているホストとポートに
‘connect()’ してくる '他の' 「クライアント」ソケットに応える形で
‘clientsocket’ を作り、作るや否や、さらなる接続を聞きに戻っていくのだ。
このふたつの「クライアント」は、あとは勝手に喋っていればいい - 使うポー
トは動的に割り当てられ、会話が終わればリサイクルに廻される。

* Menu:

* IPC::


File: python.info,  Node: IPC,  Up: ソケットの作成<3>

9.11.2.1 IPC
............

1つのマシン上の2プロセス間で高速なIPCを行いたい場合は、pipe か共有メモリ
を検討するべきです。AF_INET ソケットを使用すると決めた場合、「サーバー」
ソケットは ‘'localhost'’ にバインドしましょう。ほとんどのプラットフォー
ムで、いくつかのネットワークレイヤーをショートカットすることでかなり高速
になります。

参考
....

*note multiprocessing: 98. はクロスプラットフォームなIPCの高級なAPIを提
供しています。


File: python.info,  Node: ソケットの利用,  Next: 切断,  Prev: ソケットの作成<3>,  Up: ソケットプログラミング HOWTO

9.11.3 ソケットの利用
---------------------

はじめに憶えておくべきなのは、ウェブブラウザの「クライアント」ソケットと
ウェブサーバの「クライアント」ソケットがまったく同じ種族だということだ。
つまり、これは「ピア・トゥ・ピア」(1 対 1) の会話である。別の言い方をす
ると、 '設計者として自分で会話のエチケット規則を決めなくてはいけない' と
いうことでもある。通常は、 ‘connect’ してくるソケットが要求あるいは宣言
をして会話を始める。だが、それはそう設計しただけのことだ - ソケットの規
則ではない。

さて、コミュニケーションに使う動詞は二組ある。 ‘send’ と ‘recv’ を使うこ
ともできるし、クライアントソケットをファイルっぽい種族に変形して ‘read’
と ‘write’ を使っても良い。後者は Java のソケットの表現方法だ。ここで詳
しく語るつもりはないが、その場合はソケットも ‘flush’ しなければいけない
、とだけ言っておく。これはバッファリングした「ファイル」なので、何かを
‘write’ してすぐに返答を ‘read’ するというのはよくある間違いだ。間に
‘flush’ を入れないと、要求がまだ出力バッファにあって永遠に返事が来ない、
という可能性がある。

さあ、ソケットの主要な難関に進もう - ‘send’ と ‘recv’ はネットワークバッ
ファに働きかけるものだ。だから、手渡したもの (や返してもらいたいもの) を
1 バイトも残さず実際に処理してくれているとは限らない。一般的に言って、
‘send’ はバッファが埋まるまで、‘recv’ はバッファが空になるまで処理をして
、そのバイト数を返す。メッセージが完全に処理されるまで繰り返し呼び出すの
は '自分の' 責任なのだ。

‘recv’ が 0 バイトを返したときは、向こう側が接続を閉じてしまった (または
閉じようとしている途中) という意味だ。もうこの接続でデータを受け取ること
はない。永遠にだ。ただ、データ送信は成功するかもしれない; これについては
あとで語ることにしよう。

HTTP のようなプロトコルでは、ひとつのソケットを1回の転送にしか使わない。
クライアントは要求を送り、返答を受ける。以上だ。これでソケットは破棄され
る。だからこの場合、クライアントは受信 0 バイトの時点で返答の末尾を検出
することができる。

だが、以降の転送にもそのソケットを使い回すつもりなら、ソケットに EOT
(End of Transfer) など '存在しない' ことを認識する必要がある。もう一度言
おう: ソケットの ‘send’ や ‘recv’ が 0 バイト処理で返ってきたなら、その
接続は終わっている。終わって 'いない' なら、いつまで ‘recv’ を待てばいい
かは分からない。ソケットは「もう読むものが (今のところ) ないぜ」などと
'言わない' のだから。このことを少し考えれば、ソケットの真実を悟ることに
なるだろう: 'メッセージは必ず固定長か' (うげぇ) '区切り文字を使うか' (や
れやれ) '長さ標識を付けておくか' (かなりマシ) '接続を閉じて終わらせるか
のいずれかでなければいけない' のだ。選ぶ権利と責任はまったくもって自分に
ある (が、正しさの程度に違いはある)。

毎回接続を終わらせるのはイヤだとして、最も単純な解決策は固定長メッセージ
だろう:

     class MySocket:
         """demonstration class only
           - coded for clarity, not efficiency
         """

         def __init__(self, sock=None):
             if sock is None:
                 self.sock = socket.socket(
                                 socket.AF_INET, socket.SOCK_STREAM)
             else:
                 self.sock = sock

         def connect(self, host, port):
             self.sock.connect((host, port))

         def mysend(self, msg):
             totalsent = 0
             while totalsent < MSGLEN:
                 sent = self.sock.send(msg[totalsent:])
                 if sent == 0:
                     raise RuntimeError("socket connection broken")
                 totalsent = totalsent + sent

         def myreceive(self):
             chunks = []
             bytes_recd = 0
             while bytes_recd < MSGLEN:
                 chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048))
                 if chunk == b'':
                     raise RuntimeError("socket connection broken")
                 chunks.append(chunk)
                 bytes_recd = bytes_recd + len(chunk)
             return b''.join(chunks)

この送信コードは、ほぼあらゆるメッセージ通信スキームで使える - 文字列を
送るとき、Python なら長さを ‘len()’ で見極めることができる (中に ‘\0’ が
埋め込まれていても大丈夫)。難しくしているのは、おもに受信コードである。
(なお、C でも事態はあまり悪くならないが、メッセージに ‘\0’ が埋め込まれ
ていると ‘strlen’ が使えないのは面倒だ。)

最も簡単な改良法は、メッセージの最初の一文字をタイプ標識にして、そのタイ
プで長さを決定するというものだ。この場合ふたつの ‘recv’ があることになる
- 一番目でその一文字 (だけじゃなくても可) を取って長さを調べ、二番目でル
ープして残りを取るのだ。あるいはもし区切り方式の道を行くのであれば、任意
のサイズ (4096 か 8192 がネットワークバッファには最適なことが多い) で受
信して区切り文字を走査していくことになる。

心に留めておくべき面倒な点がひとつ: 複数メッセージが次々に (何らかの返事
を待たずに) 返ってくることのある会話プロトコルなら、そして任意のサイズを
‘recv’ に渡しているなら、次のメッセージの冒頭部分まで読んでしまうことが
あるかもしれない。そのときは、必要になるまで脇によけて、大切に保管してお
く必要がある。

メッセージ冒頭に長さを (たとえば 5 桁の数字で) 付けるのは、それよりもさ
らに複雑になる。というのも、(信じられないかもしれないが) 一回の ‘recv’ で
5 文字を全部受け取ることができるとは限らないからだ。お遊びでやっている間
はごまかせても、高負荷ネットワークのもとでは、‘recv’ ループをふたつ使わ
ないコードは、あっと言う間にダメになってしまう - 一番目は長さを見定める
用で、二番目はデータ部分を受け取る用だ。うーむ、いやらしい。さらにこのと
き、‘send’ も一発で全部を出し切れるとは限らないことに気付くだろう。なお
、今こうやって読んでいても、いつか誰もが痛い目を見るのである!

紙面の都合および教育的配慮 (と著者の地位確保) のため、こうした改良は練習
問題として残しておく。さあ片付けてしまおう。

* Menu:

* バイナリデータ::


File: python.info,  Node: バイナリデータ,  Up: ソケットの利用

9.11.3.1 バイナリデータ
.......................

It is perfectly possible to send binary data over a socket.  The major
problem is that not all machines use the same formats for binary data.
For example, network byte order(1) is big-endian, with the most
significant byte first, so a 16 bit integer with the value ‘1’ would be
the two hex bytes ‘00 01’.  However, most common processors (x86/AMD64,
ARM, RISC-V), are little-endian, with the least significant byte first -
that same ‘1’ would be ‘01 00’.

Socket libraries have calls for converting 16 and 32 bit integers -
‘ntohl, htonl, ntohs, htons’ where "n" means 'network' and "h" means
'host', "s" means 'short' and "l" means 'long'.  Where network order is
host order, these do nothing, but where the machine is byte-reversed,
these swap the bytes around appropriately.

In these days of 64-bit machines, the ASCII representation of binary
data is frequently smaller than the binary representation.  That's
because a surprising amount of the time, most integers have the value 0,
or maybe 1.  The string ‘"0"’ would be two bytes, while a full 64-bit
integer would be 8.  Of course, this doesn't fit well with fixed-length
messages.  Decisions, decisions.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Endianness#Networking


File: python.info,  Node: 切断,  Next: ノンブロッキングソケット,  Prev: ソケットの利用,  Up: ソケットプログラミング HOWTO

9.11.4 切断
-----------

厳密には、ソケットを ‘close’ する前には ‘shutdown’ することになっている
。 ‘shutdown’ は相手ソケットに対する報告であり、渡す引数によって「これ以
上こっちからは送らないけど、まだ聞いてるぜ」という意味になったり、「もう
聞かない。せいせいした!」だったりする。しかしほとんどのソケットライブラ
リは、このエチケットを怠るプログラマに慣れてしまって、通常 ‘close’ だけ
で ‘shutdown(); close()’ と同じことになる。だから大抵はわざわざ
‘shutdown’ しなくてもいい。

‘shutdown’ の効果的な使い方のひとつは、HTTP 風のやりとりだ。クライアント
は要求を出してすぐに ‘shutdown(1)’ する。これでサーバに、「クライアント
は送信完了ですが、まだ受信可能です」と伝わる。サーバは 0 バイト受信で
"EOF" を検出することができる。要求を残さず受け取ったことにして良いのだ。
対してサーバは返答を送る。その ‘send’ が成功したなら、クライアントは実際
にまだ受信していたことになる。

Python はこの自動 shutdown をもう一歩進めて、ソケットが GC されるときに
必要なら自動で ‘close’ してくれると言っている。しかしこれに頼るクセをつ
けてはいけない。もしソケットが ‘close’ せずに姿を消せば、相手ソケットは
こちらが遅いだけだと思ってハングしてしまうかもしれない。 'お願いだから'
終わったらちゃんと ‘close’ してくれ。

* Menu:

* ソケットが死ぬと::


File: python.info,  Node: ソケットが死ぬと,  Up: 切断

9.11.4.1 ソケットが死ぬと
.........................

ブロッキングソケットを使っていて一番いやなのは多分、相手側が意地悪く
(‘close’ せずに) ダウンするときに起こる事柄だ。自分側のソケットは高確率
でハングするだろう。TCP は信頼性の高いプロトコルなので、ずっとずっと待ち
続けて、なかなか見捨てないのだ。スレッドを使っているのであれば、そのスレ
ッド全体が根本から死んだ状態になる。こうなると、もう手の施しようがない。
まあ、ブロッキング読み出しの間ロックし続けるといった馬鹿げたことをしてい
ない限り、リソースの点ではたいして消費にならない。だから 'ぜったいに' そ
のスレッドを殺そうとしてはいけない - プロセスよりスレッドが効率的である
理由のひとつは、自動リソース回収にまつわるオーバヘッドを避けられるという
点にあるのだ。つまり別の言い方をすると、どうにかしてそのスレッドを殺した
なら、プロセス全体がぐちゃぐちゃになってしまうだろうということだ。


File: python.info,  Node: ノンブロッキングソケット,  Prev: 切断,  Up: ソケットプログラミング HOWTO

9.11.5 ノンブロッキングソケット
-------------------------------

ここまで理解してきたなら、もうソケットの仕組みについて必要なことはほとん
ど知っていることになる。これからも同じコールを、ほぼ同じように使っていく
だけ、それだけだ。これをちゃんとやっていれば、そのアプリはだいたい完璧で
あろう。

Python の場合、ノンブロッキングにするには ‘socket.setblocking(False)’ を
使う。 C ならもっと複雑だ (一例を挙げると、BSD 方式の ‘O_NONBLOCK’ およ
びほぼ違いのない POSIX 方式 ‘O_NDELAY’ のどちらを選ぶか決めなくてはなら
なくて、後者は ‘TCP_NODELAY’ とは全然別物だったりする) が、考え方はまっ
たく一緒だ。これは、ソケットを作成した後、使用する前に行う。(実際、常識
破りなら、切り替えることができます。)

構造上の大きな違いは、 ‘send’, ‘recv’, ‘connect’, ‘accept’ が何もしない
で戻ってくるかもしれないという点である。選択肢は (当然ながら) いくつかあ
る。返り値とエラーコードをチェックするという方法もある。が、発狂すること
請け合いだ。信じないなら、いつかやってみるといい。アプリは肥大化し、バグ
が増え、CPU を喰い尽くすだろう。だからそんな愚かな解法は飛ばして、正解に
進もう。

‘select’ を使え。

C において ‘select’ でコードを書くのはかなり面倒だが、Python なら造作も
ない。しかし Python で ‘select’ を理解しておけば C でもほとんど問題なく
書ける、という程度には似ている:

     ready_to_read, ready_to_write, in_error = \
                    select.select(
                       potential_readers,
                       potential_writers,
                       potential_errs,
                       timeout)

‘select’ に三つのリストを渡しているが、一番目にはあとで読みたくなるかも
しれないソケットすべて、二番目には書き込みたくなるかもしれないソケットす
べて、最後に (通常は空のままだが) エラーをチェックしたいソケットが入って
いる。ひとつのソケットが複数にまたがってリストされても構わないことを憶え
ておくと良い。なお、 ‘select’ コールはブロックするが、時間制限を与えるこ
とができる。これは、やっておいて損はない - 特に理由がなければ、かなり長
い (たとえば 1 分とかの) 時間制限を付けておくことだ。

戻り値として、三つのリストが手に入る。それぞれには、実際に読めるソケット
、書けるソケット、エラー中のソケットが入っていて、渡したリストの部分集合
(空集合かもしれない) になっている。

出力のうち、readable リストにあるソケットについては、 ‘recv’ がとりあえ
ず '何か' を返すであろう、ということは史上最高度に確信できる。 writable
リストも考え方は同じで、 '何か' は送れる。送りたいもの全体は無理かもしれ
ないが、 '何も' ないよりはマシだろう。 (実のところ、ふつうに健康なソケッ
トなら writable で返ってくることができる - それは外向きネットワークバッ
ファに空きがあるというだけの意味しかないのだから)

「サーバ」ソケットは potential_readers リストに入れておこう。それが
readable リストに入って出てきたら、 ‘accept’ は (ほぼ) 確実に成功するは
ずだ。どこかへ ‘connect’ するために作った新しいソケットは
potential_writers リストに入れる。それが writable リストに現れたら、接続
が成功している可能性は高いと言える。

じつは ‘select’ はブロッキングソケットにも便利に使える。それはブロックす
るかどうかを見極める方法のひとつである - バッファに何かがあれば readable
として返ってくるのだ。しかしこれも、相手の用事がもう済んでいるのか、それ
とも単に他のことで忙しいだけなのかを見極める役には立たない。

'非互換警報': Unix ではソケットにもファイルにも ‘select’ が使える。これ
を Windows でやろうとしてはいけない。Windows で ‘select’ はソケットにし
か使えない。また C の場合、高度なソケットオプションの多くは、やり方が
Windows では違っている。実際、Windows なら著者は通常、ソケットにスレッド
を使っている (これは実に、実にうまくいく)。


File: python.info,  Node: ソートのテクニック,  Next: Unicode HOWTO,  Prev: ソケットプログラミング HOWTO,  Up: Python HOWTO

9.12 ソートのテクニック
=======================


著者: Andrew Dalke and Raymond Hettinger

Python のリストにはリストをインプレースに変更する、組み込みメソッド
*note list.sort(): f91. があります。他にもイテラブルからソートしたリスト
を作成する組み込み関数 *note sorted(): f90. があります。

このドキュメントでは 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(): f90. 関数を呼ぶだけ
です。そうすれば、新たにソートされたリストが返されます:

     >>> sorted([5, 2, 3, 1, 4])
     [1, 2, 3, 4, 5]

*note list.sort(): f91. メソッドを呼びだしても同じことができます。この方
法はリストをインプレースに変更します (そして sorted との混乱を避けるため
‘None’ を返します)。多くの場合、こちらの方法は *note sorted(): f90. と比
べると不便です - ただし、元々のリストが不要な場合には、わずかですがより
効率的です。

     >>> a = [5, 2, 3, 1, 4]
     >>> a.sort()
     >>> a
     [1, 2, 3, 4, 5]

違いは他にもあります、 *note list.sort(): f91. メソッドはリストにのみ定
義されています。一方 *note sorted(): f90. 関数は任意のイテラブルを受け付
けます。

     >>> 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(): f91. method and the functions *note sorted():
f90, *note min(): 12bc, *note max(): 12bd, *note heapq.nsmallest():
2bd1, and *note heapq.nlargest(): 2bd0. 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(): 1193.:

     >>> 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: 6ec. や *note named tuple: a42. のインスタン
スでもよいです。


File: python.info,  Node: operator モジュールの関数や partial 関数による評価,  Next: 昇順と降順,  Prev: Key 関数,  Up: ソートのテクニック

9.12.3 operator モジュールの関数や partial 関数による評価
---------------------------------------------------------

上で示した *note key function: 11be. パターンは非常に一般的なので、
Python はアクセサ関数を簡単に速く作れる便利な関数を提供しています。*note
operator: a3. モジュールに *note itemgetter(): e2a.、*note attrgetter():
11ea.、および *note methodcaller(): 11eb. 関数があります。

これらの関数を利用すると、上の例はもっと簡単で高速になります:

     >>> 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: 62. モジュールには他にもキー関数を作るための便利なツー
ルがあります。*note partial(): 4ad. 関数は複数引数の関数の アリティ(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(): f91. と *note sorted(): f90. の両方とも '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():
452a. は比較関数です。

このような場合に対処するため、Python は比較関数をラップしてキー関数とし
て使えるようにする関数 *note functools.cmp_to_key: 1598. を提供していま
す。

     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: 29c.

   * 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:
29c.

   * 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(): 1a17. を使うか、比較関数に *note
     locale.strcoll(): 452a. を使ってください。これが必要なのは、同じア
     ルファベットを使っていたとしても、文化が違えば "アルファベット順" の
     意味するものが変わることがあるからです。

   * 'reverse' パラメータはソートの安定性を保ちます (ですから、レコード
     のキーが等しい場合元々の順序が維持されます)。面白いことにこの影響は
     パラメータ無しで *note reversed(): c40. 関数を二回使うことで模倣す
     ることができます:

          >>> 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__():
     165a. メソッドを定義することで達成できます。

          >>> Student.__lt__ = lambda self, other: self.age < other.age
          >>> sorted(student_objects)
          [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

     ただし、‘<’ は *note __lt__(): 165a. が実装されていなければ *note
     __gt__(): 16c5. を使って代替することに注意してください (この技法に
     ついて詳しくは *note object.__lt__(): 165a. を参照してください)。驚
     きを防ぐため、 PEP 8(1) は6つの比較メソッドを全て実装することを推奨
     しています。この作業を簡単にするため、*note total_ordering(): 12f2.
     デコレータが提供されています。

   * 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(): 12bc. と *note max(): 12bd. はそれぞれ最小値と最大値を
     返します。これらの関数は入力データを一度だけ通過し、補助的なメモリ
     をほとんど要求しません。

   * *note heapq.nsmallest(): 2bd1. と *note heapq.nlargest(): 2bd0. は
     それぞれ最小と最大の値 'n' 個を返します。これらの関数はデータを一度
     だけ通過し、一度に 'n' 要素だけを記憶します。入力の数に対して小さい
     'n' の値では、これらの関数は完全なソートより比較の回数がはるかに少
     なくなります。

   * *note heapq.heappush(): 1874. と *note heapq.heappop(): 1875. は最
     小の要素がつねに位置 ‘0’ になる、部分的にソートされたデータの配列を
     作り維持します。これらの関数はタスクスケジューリングに一般的に使わ
     れる優先度キューを実装するのに適しています。


File: python.info,  Node: Unicode HOWTO,  Next: urllib パッケージを使ってインターネット上のリソースを取得するには,  Prev: ソートのテクニック,  Up: Python HOWTO

9.13 Unicode HOWTO
==================


リリース: 1.12

この HOWTO 文書は、文字データの表現のための Unicode 仕様の Python におけ
るサポートについて論じ、さらに Unicode を使おうというときによく出喰わす
多くの問題について説明します。

* Menu:

* Unicode 入門::
* Python の Unicode サポート::
* Unicode データを読み書きする::
* 謝辞: 謝辞<10>.


File: python.info,  Node: Unicode 入門,  Next: Python の Unicode サポート,  Up: Unicode HOWTO

9.13.1 Unicode 入門
-------------------

* Menu:

* 定義::
* エンコーディング: エンコーディング<3>.
* 参考資料: 参考資料<3>.


File: python.info,  Node: 定義,  Next: エンコーディング<3>,  Up: Unicode 入門

9.13.1.1 定義
.............

今日のプログラムは広範囲の文字を扱える必要があります。 アプリケーション
は国際化され、ユーザーが選べる様々な言語でメッセージや出力を表示します;
同じプログラムが、英語、フランス語、日本語、ヘブライ語、ロシア語でエラー
メッセージを出力する必要があるかもしれません。 Webコンテンツはどんな言語
でも書かれる可能性がありますし、様々な絵文字が含まれることもあります。
Python の文字列型は文字表現のための Unicode 標準を使っていて、 Python プ
ログラムは有り得る様々な文字を全て扱えます。

Unicode (‘https://www.unicode.org/’) は、人類の言語で使われる全ての文字
を列挙し、それぞれの文字自身の一意な符号を与えるのを目的とした仕様です。
Unicode 仕様は継続的に改訂され、新しい言語や記号を追加する更新がなされて
います。

'文字' は文章の最小の構成要素です。 'A', 'B', 'C' などは全て異なる文字で
す。 'È' と 'Í' も同様に異なる文字です。 文字は、話している言語や文脈に
よって変わってきます。 例えば、「ローマ数字の 1」という文字 'Ⅰ' は大文字
の 'I' とは別の文字です。 両者は通常は同じに見えますが、異なる意味を持つ
別々の2つの文字です。

The Unicode standard describes how characters are represented by 'code
points'.  A code point value is an integer in the range 0 to 0x10FFFF
(about 1.1 million values, the actual number assigned(1) is less than
that).  In the standard and in this document, a code point is written
using the notation ‘U+265E’ to mean the character with value ‘0x265e’
(9,822 in decimal).

Unicode 標準は、文字とそれに対応するコードポイントを列挙した多くの表を含
んでいます:

     0061    'a'; LATIN SMALL LETTER A
     0062    'b'; LATIN SMALL LETTER B
     0063    'c'; LATIN SMALL LETTER C
     ...
     007B    '{'; LEFT CURLY BRACKET
     ...
     2167    'Ⅷ'; ROMAN NUMERAL EIGHT
     2168    'Ⅸ'; ROMAN NUMERAL NINE
     ...
     265E    '♞'; BLACK CHESS KNIGHT
     265F    '♟'; BLACK CHESS PAWN
     ...
     1F600   '😀'; GRINNING FACE
     1F609   '😉'; WINKING FACE
     ...

厳密には、この定義から「これは文字 ‘U+265E’ です」と言うのは意味の無いこ
とだと分かります。‘U+265E’ はコードポイントであり、それはある特定の文字
を表しているのです; この場合では、 'BLACK CHESS KNIGHT', '♞' という文字
を表しています。 形式ばらない文脈では、このコードポイントと文字の区別は
忘れ去られることもあります。

文字は画面や紙面上では 'グリフ (glyph)' と呼ばれるグラフィック要素の組で
表示されます。大文字の A のグリフは例えば、厳密な形は使っているフォント
によって異なりますが、斜めの線と水平の線です。たいていの Python コードで
はグリフの心配をする必要はありません; 一般的には表示する正しいグリフを見
付けることは GUI toolkit や端末のフォントレンダラーの仕事です。

   ---------- Footnotes ----------

   (1) https://www.unicode.org/versions/latest/#Summary


File: python.info,  Node: エンコーディング<3>,  Next: 参考資料<3>,  Prev: 定義,  Up: Unicode 入門

9.13.1.2 エンコーディング
.........................

前の節をまとめると: Unicode 文字列はコードポイントの列であり、コードポイ
ントとは 0 から ‘0x10FFFF’ (10 進表記で 1,114,111) までの数値です。この
コードポイント列はメモリ上では 'コードユニット' 列として表され、その 'コ
ードユニット' 列は 8-bit のバイト列にマップされます。Unicode 文字列をバ
イト列として翻訳する規則を '文字エンコーディング' または単に 'エンコーデ
ィング' と呼びます。

The first encoding you might think of is using 32-bit integers as the
code unit, and then using the CPU's representation of 32-bit integers.
In this representation, the string "Python" might look like this:

        P           y           t           h           o           n
     0x50 00 00 00 79 00 00 00 74 00 00 00 68 00 00 00 6f 00 00 00 6e 00 00 00
        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

この表現は直接的でわかりやすい方法ですが、この表現を使うにはいくつかの問
題があります。

  1. 可搬性がない; プロセッサが異なるとバイトの順序づけも変わってしまい
     ます。

  2. 無駄な領域が多いです。多くの文書では、コードポイントは 127 未満もし
     くは 255 未満が多数派を占め、そのため多くの領域が ‘0x00’ というバイ
     トで埋め尽くされます。上の文字列は、ASCII 表現では 6 バイトなのに対
     し、24 バイトのサイズになっています。RAM の使用量が増加するのはそれ
     ほど問題にはなりません (デスクトップコンピュータはギガバイト単位の
     RAM を持っており、通常、文字列はそんな大きさにはなりません) が、デ
     ィスクとネットワーク帯域が 4 倍多く使われてしまうのは我慢できるもの
     ではありません。

  3. ‘strlen()’ のような現存する C 関数と互換性がありません、そのためワ
     イド文字列関数一式が新たに必要となります。

Therefore this encoding isn't used very much, and people instead choose
other encodings that are more efficient and convenient, such as UTF-8.

UTF-8 is one of the most commonly used encodings, and Python often
defaults to using it.  UTF stands for "Unicode Transformation Format",
and the '8' means that 8-bit values are used in the encoding.  (There
are also UTF-16 and UTF-32 encodings, but they are less frequently used
than UTF-8.)  UTF-8 uses the following rules:

  1. コードポイントが 128 未満だった場合、対応するバイト値で表現します。

  2. コードポイントが 128 以上の場合、128 から 255 までのバイトからなる
     、2、3 または 4 バイトのシーケンスに変換します。

UTF-8 はいくつかの便利な性質を持っています:

  1. 任意の Unicode コードポイントを扱うことができる。

  2. A Unicode string is turned into a sequence of bytes that contains
     embedded zero bytes only where they represent the null character
     (U+0000).  This means that UTF-8 strings can be processed by C
     functions such as ‘strcpy()’ and sent through protocols that can't
     handle zero bytes for anything other than end-of-string markers.

  3. ASCII テキストの文字列は UTF-8 テキストとしても有効です。

  4. UTF-8 はかなりコンパクトです; よく使われている文字の大多数は 1 バイ
     トか 2 バイトで表現できます。

  5. バイトが欠落したり、失われた場合、次の UTF-8 でエンコードされたコー
     ドポイントの開始を決定し、再同期することができる可能性があります。
     同様の理由でランダムな 8-bit データは正当な UTF-8 とみなされにくく
     なっています。

  6. UTF-8 is a byte oriented encoding.  The encoding specifies that
     each character is represented by a specific sequence of one or more
     bytes.  This avoids the byte-ordering issues that can occur with
     integer and word oriented encodings, like UTF-16 and UTF-32, where
     the sequence of bytes varies depending on the hardware on which the
     string was encoded.


File: python.info,  Node: 参考資料<3>,  Prev: エンコーディング<3>,  Up: Unicode 入門

9.13.1.3 参考資料
.................

Unicode コンソーシアムのサイト(1) には文字の図表、用語辞典、PDF 版の
Unicode 仕様があります。これ読むのはそれなりに難しいので覚悟してください
。Unicode の起源と発展の 年表(2) もサイトにあります。

On the Computerphile Youtube channel, Tom Scott briefly discusses the
history of Unicode and UTF-8(3) (9 minutes 36 seconds).

標準を理解する助けにするために、Jukka Korpela が Unicode 文字表を読むた
めの 入門ガイド(4) を書いています。

Another good introductory article(5) was written by Joel Spolsky.  If
this introduction didn't make things clear to you, you should try
reading this alternate article before continuing.

Wikipedia の記事はしばしば役に立ちます; 例えば、"character encoding(6)"
や UTF-8(7) の記事を読んでみてください。

   ---------- Footnotes ----------

   (1) https://www.unicode.org

   (2) https://www.unicode.org/history/

   (3) https://www.youtube.com/watch?v=MijmeoH9LT4

   (4) https://jkorpela.fi/unicode/guide.html

   (5) 
https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/

   (6) https://en.wikipedia.org/wiki/Character_encoding

   (7) https://en.wikipedia.org/wiki/UTF-8


File: python.info,  Node: Python の Unicode サポート,  Next: Unicode データを読み書きする,  Prev: Unicode 入門,  Up: Unicode HOWTO

9.13.2 Python の Unicode サポート
---------------------------------

ここまでで Unicode の基礎を学びました、ここから Python の Unicode 機能に
触れます。

* Menu:

* 文字列型::
* バイト列への変換::
* Python ソースコード内の Unicode リテラル::
* Unicode プロパティ::
* Comparing Strings::
* Unicode 正規表現::
* 参考資料: 参考資料<4>.


File: python.info,  Node: 文字列型,  Next: バイト列への変換,  Up: Python の Unicode サポート

9.13.2.1 文字列型
.................

Since Python 3.0, the language's *note str: 1ea. 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: 1d2. クラスの *note decode(): cac. メソッドを使っ
て文字列を作ることもできます。このメソッドは ‘UTF-8’ のような値を
'encoding' 引数に取り、オプションで 'errors' 引数を取ります。

'errors' 引数は、入力文字列に対しエンコーディングルールに従った変換がで
きなかったときの対応方法を指定します。この引数に使える値は ‘'strict'’
(*note UnicodeDecodeError: ddb. を送出する)、 ‘'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 標準エンコーディング: 1175. を参照
してください。いくつかのエンコーディングは複数の名前を持っています; 例え
ば、 ‘'latin-1'’ と ‘'iso_8859_1'’ と ‘'8859'’ は全て同じエンコーディン
グの別名です。

Unicode 文字列の一つの文字は *note chr(): 1c17. 組み込み関数で作成するこ
とができます、この関数は整数を引数にとり、対応するコードポイントを含む長
さ1の Unicode 文字列を返します。逆の操作は *note ord(): 254a. 組み込み関
数です、この関数は一文字の 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(): cac. とは処理が逆向きのメソッドが *note
str.encode(): cab. です。このメソッドは、 Unicode 文字列を指定された
'encoding' でエンコードして、 *note bytes: 1d2. による表現で返します。

'errors' 引数は *note decode(): cac. メソッドのパラメータと同じものです
が、サポートされているハンドラの数がもう少し多いです。 ‘'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(): 1c17. 組み込み関数を使って組み上げることも
できますが、それはさらに長くなってしまうでしょう。

理想的にはあなたの言語の自然なエンコーディングでリテラルを書くことでしょ
う。そうなれば、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():
1193. 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: 10e. module's *note normalize():
ac7. 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(): ac7. 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(): 1193. 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: c1. モジュールがサポートしている正規表現はバイト列や文字列とし
て与えられます。 ‘\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: a22. を *note compile(): f97. に渡した場合、 ‘\d+’ は先
程とは違って部分文字列 "57" に一致します。

同様に、 ‘\w’ は非常に多くの Unicode 文字に一致しますが、バイト列の場合
もしくは *note re.ASCII: a22. が渡された場合は ‘[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: 1ea. 型については Python ライブラリリファレンスの *note
テキストシーケンス型 -- str: 21ec. で解説されています。

*note unicodedata: 10e. モジュールについてのドキュメント。

*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(): 333. 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(): 2279. and *note write(): 2268.  This works through
‘open()’'s 'encoding' and 'errors' parameters which are interpreted just
like those in *note str.encode(): cab. and *note bytes.decode(): cac.

そのためファイルから 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: 94d.  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(): 101b. 関数は現在のシステムで利用する
エンコーディングを返し、エンコーディングを手動で設定したい場合利用します
、ただしわざわざそうする積極的な理由はありません。読み書きのためにファイ
ルを開く時には、ファイル名を Unicode 文字列として渡すだけで正しいエンコ
ーディングに自動的に変更されます:

     filename = 'filename\u4500abc'
     with open(filename, 'w') as f:
         f.write('blah\n')

*note os.stat(): 4fc. のような *note os: a5. モジュールの関数も Unicode
のファイル名を受け付けます。

The *note os.listdir(): 14bb. 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: 94d. 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:
29c. will be raised.

web ブラウザから来るデータやその他の信頼できないところからのデータを利用
する場合、それらの文字列から生成したコマンド行の実行や、それらの文字列を
データベースに蓄える前に文字列の中に不正な文字が含まれていないか確認する
のが一般的です。もしそういう状況になった場合には、エンコードされたバイト
データではなく、デコードされた文字列のチェックを入念に行なって下さい; い
くつかのエンコーディングは問題となる性質を持っています、例えば全単射でな
かったり、完全に ASCII 互換でないなど。入力データがエンコーディングを指
定している場合でもそうして下さい、なぜなら攻撃者は巧みに悪意あるテキスト
をエンコードした文字列の中に隠すことができるからです。

* Menu:

* ファイルエンコーディングの変換::
* 不明なエンコーディングのファイル::


File: python.info,  Node: ファイルエンコーディングの変換,  Next: 不明なエンコーディングのファイル,  Up: Unicode 対応のプログラムを書くための Tips

9.13.3.3 ファイルエンコーディングの変換
.......................................

The *note StreamRecoder: 1fe2. 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: 1fe2. to return bytes encoded in
UTF-8:

     new_f = codecs.StreamRecoder(f,
         # en/decoder: used by read() to encode its results and
         # by write() to decode its input.
         codecs.getencoder('utf-8'), codecs.getdecoder('utf-8'),

         # reader/writer: used to read and write to the stream.
         codecs.getreader('latin-1'), codecs.getwriter('latin-1') )


File: python.info,  Node: 不明なエンコーディングのファイル,  Prev: ファイルエンコーディングの変換,  Up: Unicode 対応のプログラムを書くための Tips

9.13.3.4 不明なエンコーディングのファイル
.........................................

What can you do if you need to make a change to a file, but don't know
the file's encoding?  If you know the encoding is ASCII-compatible and
only want to examine or modify the ASCII parts, you can open the file
with the ‘surrogateescape’ error handler:

     with open(fname, 'r', encoding="ascii", errors="surrogateescape") as f:
         data = f.read()

     # make changes to the string 'data'

     with open(fname + '.new', 'w',
               encoding="ascii", errors="surrogateescape") as f:
         f.write(data)

The ‘surrogateescape’ error handler will decode any non-ASCII bytes as
code points in a special range running from U+DC80 to U+DCFF. These code
points will then turn back into the same bytes when the
‘surrogateescape’ error handler is used to encode the data and write it
back out.


File: python.info,  Node: 参考資料<5>,  Prev: Unicode 対応のプログラムを書くための Tips,  Up: Unicode データを読み書きする

9.13.3.5 参考資料
.................

One section of Mastering Python 3 Input/Output(1), a PyCon 2010 talk by
David Beazley, discusses text processing and binary data handling.

Marc-André Lemburg のプレゼンテーション "Writing Unicode-aware
Applications in Python" の PDF スライドが
<‘https://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf’>
から入手可能です、そして文字エンコーディングの問題と同様にアプリケーショ
ンの国際化やローカライズについても議論されています。このスライドは
Python 2.x のみをカバーしています。

The Guts of Unicode in Python(2) is a PyCon 2013 talk by Benjamin
Peterson that discusses the internal Unicode representation in Python
3.3.

   ---------- Footnotes ----------

   (1) https://pyvideo.org/video/289/pycon-2010-mastering-python-3-i-o

   (2) https://pyvideo.org/video/1768/the-guts-of-unicode-in-python


File: python.info,  Node: 謝辞<10>,  Prev: Unicode データを読み書きする,  Up: Unicode HOWTO

9.13.4 謝辞
-----------

このドキュメントの最初の草稿は Andrew Kuchling によって書かれました。そ
れからさらに Alexander Belopolsky, Georg Brandl, Andrew Kuchling, Ezio
Melotti らで改訂が重ねられています。

この記事中の誤りの指摘や提案を申し出てくれた以下の人々に感謝します: Éric
Araujo, Nicholas Bastin, Nick Coghlan, Marius Gedminas, Kent Johnson,
Ken Krugler, Marc-André Lemburg, Martin von Löwis, Terry J. Reedy,
Serhiy Storchaka, Eryk Sun, Chad Whitacre, Graham Wideman.


File: python.info,  Node: urllib パッケージを使ってインターネット上のリソースを取得するには,  Next: ipaddressモジュールの紹介,  Prev: Unicode HOWTO,  Up: Python HOWTO

9.14 urllib パッケージを使ってインターネット上のリソースを取得するには
======================================================================


著者: Michael Foord(1)

* Menu:

* はじめに: はじめに<17>.
* URL を取得する::
* 例外を処理する: 例外を処理する<2>.
* info と geturl::
* Openers と Handlers::
* Basic 認証::
* プロキシ::
* ソケットとレイヤー::
* 脚注::

   ---------- Footnotes ----------

   (1) https://agileabstractions.com/


File: python.info,  Node: はじめに<17>,  Next: URL を取得する,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.1 はじめに
---------------

Related Articles
................

同じように Python でインターネットリソースを取得するのに以下の記事が役に
立ちます:

   * Basic Authentication(1)

          'Basic 認証' についてのチュートリアルで Python の例がついてい
          ます。

'urllib.request' は URLs (Uniform Resource Locators) を取得するための
Python モジュールです。このモジュールはとても簡単なインターフェースを
'urlopen' 関数の形式で提供しています。また、このモジュールは一般的な状況
で利用するためにいくらか複雑なインターフェースも提供しています - basic 認
証やクッキー、プロキシ等。これらは handler や opener と呼ばれるオブジェ
クトとして提供されます。

urllib.request は多くの "URL スキーム" (URL の ":" の前の文字列で識別さ
れるもの - 例えば "‘ftp://python.org/’" では "ftp") の URL を、関連する
ネットワークプロトコル(例えば FTP, HTTP) を利用することで、取得できます
。

単純な状況では 'urlopen' はとても簡単に使うことができます。しかし HTTP の
URL を開くときにエラーが起きたり、特殊なケースに遭遇すると、 HyperText
Transfer Protocol に関するいくつかのことを理解する必要があります。 HTTP
に関して最も包括的で信頼できる文献は RFC 2616(2) です。この文書は技術文
書なので簡単には読めません。この HOWTO の目的は 'urllib' の利用法を例示
することです、 HTTP についてはその助けになるのに十分に詳しく載せています
。このドキュメントは *note urllib.request: 114. のドキュメントの代わりに
はなりませんが、補完する役割を持っています。

   ---------- 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(): e25. と *note
tempfile.NamedTemporaryFile(): 8db. 関数を使って行うことができます:

     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: 113. ライブラリの関数を使っ
て行います。

     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:
5ba7. の節を見て下さい、この節は後で問題が起きた場合に見ておくべき内容で
す。

   ---------- 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: 541. when it cannot handle a response
(though as usual with Python APIs, built-in exceptions such as *note
ValueError: 15a, *note TypeError: 29c. etc.  may also be raised).

*note HTTPError: 138c. is the subclass of *note URLError: 541. raised in
the specific case of HTTP URLs.

例外クラスは *note urllib.error: 112. モジュールから提供されています。

* 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: 138c.  Typical errors include '404' (page not found), '403'
(request forbidden), and '401' (authentication required).

HTTP のエラーコード全てについては RFC 2616(1) の10節を参照して下さい。

The *note HTTPError: 138c. 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: 420a. 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: 138c. インスタンスはエラーページのレ
スポンスとして扱えます。これは 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: 138c. 'or' *note
URLError: 541. 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: 138c.


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: 138c.
instance) has two useful methods ‘info()’ and ‘geturl()’ and is defined
in the module *note urllib.response: 115.

   * 'geturl' - これは取得したページの実際の URL を返します。 ‘urlopen’
     (または利用される opener オブジェクト) はリダイレクトに追従するため
     、有用です。取得したページの URL は要求した URL と同じとは限りませ
     ん。

   * 'info' - これは取得したページ (特にサーバからヘッダ)を表す辞書風オ
     ブジェクトを返します。これは現在では *note http.client.HTTPMessage:
     4223. インスタンスです。

典型的なヘッダは '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: 19bc. のインスタンス) を利用します。標準
的にはデフォルトの 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: 5bb0. 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(): 4171. のドキュメンテーションを参
     照してください。

   ---------- 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: 72. ライブラリを利用していますが、そのライ
ブラリはさらに 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: 83. モジュールへのやさしい入門を提供
するのが目的です。これは主にまだIPネットワーキングの用語に詳しくないユー
ザーを対象としていますが、‘ipaddress’ がどのようにIPネットワークアドレス
処理の概念を表現しているかをざっと見るのにも役立つかもしれません。

* Menu:

* アドレス/ネットワーク/インターフェースオブジェクトの作成::
* アドレス/ネットワーク/インターフェースオブジェクト::
* アドレスのリストとしてのネットワーク::
* 比較: 比較<4>.
* 他のモジュールでIPアドレスを使用する::
* インスタンスの生成に失敗した場合にさらに詳細を取得する::


File: python.info,  Node: アドレス/ネットワーク/インターフェースオブジェクトの作成,  Next: アドレス/ネットワーク/インターフェースオブジェクト,  Up: ipaddressモジュールの紹介

9.15.1 アドレス/ネットワーク/インターフェースオブジェクトの作成
---------------------------------------------------------------

*note ipaddress: 83. は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(): 4423. ファクトリー関数を使用することで、この方法
では渡された値をもとに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: 83. はネ
ットワーク定義の作成、検査、操作の手段を提供します。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: 15a. が発生する結果となります。
‘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: 83. はそれに応じて特定のネットワークと
アドレスを関連づけるハイブリッドクラス集を提供します。アドレス部分がネッ
トワークアドレスであることに制限されないことを除き、作成用のインターフェ
ースはネットワーク定義用のインターフェースと同一です。

     >>> 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: 83. はこの作業を簡単で直観的にできるようにします。

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: 83. はオブジェクトの比較をするための単純で、かつ願わく
ば直観的な方法を意味が通じるように提供します:

     >>> ipaddress.ip_address('192.0.2.1') < ipaddress.ip_address('192.0.2.2')
     True

異なるバージョンや異なるタイプのオブジェクトを比較しようとすると *note
TypeError: 29c. 例外が発生します。


File: python.info,  Node: 他のモジュールでIPアドレスを使用する,  Next: インスタンスの生成に失敗した場合にさらに詳細を取得する,  Prev: 比較<4>,  Up: ipaddressモジュールの紹介

9.15.5 他のモジュールでIPアドレスを使用する
-------------------------------------------

IPアドレスを使用する他のモジュール(*note socket: d4. など)は通常このモジ
ュールからオブジェクトを直接受け付けません。直接渡すのではなく、他のモジ
ュールが受け付ける整数や文字列に強制的に変換する必要があります:

     >>> 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: 15a. として報告されます。特定
のエラーが提供されないのは、拒否された理由をより詳細に提供するために、値
がIPv4またはIPv6である 'はず' かどうかを知る必要があるためです。

追加の詳細を得ると役立つ場合のユースケースに対応するため、個別のクラスの
コンストラクタは実際に *note ValueError: 15a. のサブクラスである *note
ipaddress.AddressValueError: 4428. と *note ipaddress.NetmaskValueError:
4449. を発生させて具体的に定義のどの部分のパースに失敗したのかを示します
。

クラスコンストラクタを直接使用する場合にはこれらのエラーメッセージはさら
に非常に詳細になっています。例えば:

     >>> 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:
15a. を親クラスとして持ち、エラーの特定のタイプに興味がない場合でも、以
下のようにコードを記述できます:

     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 perf map compatible profilers,  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:
23b4.:

     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: c3e. 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: c3e. 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: 3e3. 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():
     456.

 -- Object: gc__done(long collected)

     Python インタプリタによる循環参照のガベージコレクションが完了したと
     きに発火します。 ‘arg0’ は回収したオブジェクトの数です。

 -- Object: import__find__load__start(str modulename)

     Fires before *note importlib: 7a. 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: 7a.'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(): 1b55. or *note PySys_Audit(): 80e. is
     called.  ‘arg0’ is the event name as C string, ‘arg1’ is a *note
     PyObject: 1a6. 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 perf map compatible profilers,  Next: アノテーションのベストプラクティス,  Prev: DTrace と SystemTap で CPython を測定する,  Up: Python HOWTO

9.17 Python support for the ‘perf map’ compatible profilers
===========================================================


author: Pablo Galindo

The Linux perf profiler(1) and samply(2) are powerful tools that allow
you to profile and obtain information about the performance of your
application.  Both tools have vibrant ecosystems that aid with the
analysis of the data they produce.

The main problem with using these profilers with Python applications is
that they only get 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
profiler output.

Since Python 3.12, the interpreter can run in a special mode that allows
Python functions to appear in the output of compatible profilers.  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 the profiler the relationship between this piece of
code and the associated Python function using *note perf map files:
55e3.

     注釈: Support for profiling is available on Linux and macOS on
     select architectures.  Perf is available on Linux, while samply can
     be used on both Linux and macOS. samply support on macOS is
     available starting from Python 3.15.  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%--_PyCompactLong_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%--_PyCompactLong_Add
                             |          |          |                     |          |          |
                             |          |          |                     |          |          |--3.26%--_PyObject_Malloc

* Menu:

* Using the samply profiler::
* 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

   (2) https://github.com/mstange/samply


File: python.info,  Node: Using the samply profiler,  Next: How to enable perf profiling support,  Up: Python support for the perf map compatible profilers

9.17.1 Using the samply profiler
--------------------------------

samply is a modern profiler that can be used as an alternative to perf.
It uses the same perf map files that Python generates, making it
compatible with Python's profiling support.  samply is particularly
useful on macOS where perf is not available.

To use samply with Python, first install it following the instructions
at ‘https://github.com/mstange/samply’, then run:

     $ samply record PYTHONPERFSUPPORT=1 python my_script.py

This will open a web interface where you can analyze the profiling data
interactively.  The advantage of samply is that it provides a modern
web-based interface for analyzing profiling data and works on both Linux
and macOS.

On macOS, samply support requires Python 3.15 or later.  Also on macOS,
samply can't profile signed Python executables due to restrictions by
macOS. You can profile with Python binaries that you've compiled
yourself, or which are unsigned or locally-signed (such as anything
installed by Homebrew).  In order to attach to running processes on
macOS, run ‘samply setup’ once (and every time samply is updated) to
self-sign the samply binary.


File: python.info,  Node: How to enable perf profiling support,  Next: How to obtain the best results,  Prev: Using the samply profiler,  Up: Python support for the perf map compatible profilers

9.17.2 How to enable ‘perf’ profiling support
---------------------------------------------

‘perf’ profiling support can be enabled either from the start using the
environment variable *note PYTHONPERFSUPPORT: 889. or the *note -X perf:
183. option, or dynamically using *note sys.activate_stack_trampoline():
88a. and *note sys.deactivate_stack_trampoline(): 88b.

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: e2. 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 perf map compatible profilers

9.17.3 How to obtain the best results
-------------------------------------

For best results, keep frame pointers enabled.  On supported
GCC-compatible toolchains, CPython builds itself with
‘-fno-omit-frame-pointer’ and similar flags (see *note
-without-frame-pointers: 3e4. for details).  These flags allow 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 perf map compatible profilers

9.17.4 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: 6be. or the *note -X perf_jit: 183. 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 perf map compatible profilers,  Up: Python HOWTO

9.18 アノテーションのベストプラクティス
=======================================


author: Larry Hastings

概要
....

このドキュメントは、アノテーションの辞書を扱う上でのベストプラクティスを
まとめるものです。Python オブジェクトに付与された ‘__annotations__’ を
Python コードからアクセスする際には、以下のガイドラインに従うことを推奨
します。

本ドキュメントは次の４セクションで構成されています。Python 3.10 以降でオ
ブジェクトのアノテーションにアクセスするときのベストプラクティス、Python
3.9 以下でオブジェクトのアノテーションにアクセスするときのベストプラクテ
ィス、Python バージョンに関わらない ‘__annotations__’ に関するベストプラ
クティス、 ‘__annotations__’ の注意点、です。

注意：本ドキュメントは、アノテーションの使い方ではなく、
‘__annotations__’ の使い方を扱っています。型ヒントをコードの中でどうやっ
て使うかについては、 *note typing: 10d. モジュールを参照してください。

* 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(): bf0. 関
数が新たに追加されました。Python 3.10 から 3.13 までは、アノテーションに
対応しているオブジェクトのアノテーション辞書にアクセスするには、この関数
を使うのが一番良いです。文字列で指定されたアノテーションも自動的に文字列
でない値に解決してくれます。

Python 3.14 では、アノテーションを扱うためのモジュール *note
annotationlib: 6. が追加されました。このモジュールに *note
annotationlib.get_annotations(): 673. があり、 *note
inspect.get_annotations(): bf0. を置き換えるものです。

もし何らかの理由で自分の用途に *note inspect.get_annotations(): bf0. が
合わないという場合は、手動で ‘__annotations__’ にアクセスすることもでき
ます。これについても、推奨のアクセス方法が Python 3.10 で変わりました。
3.10 で、 ‘o.__annotations__’ は関数、クラス、モジュールに対しては必ず使
えることが保証されるようになりました。オブジェクトが確実にこの３つのいず
れかである場合は、単に ‘o.__annotations__’ を使えばアノテーション辞書を
取得できます。

しかし、それ以外の callable (例えば、 *note functools.partial(): 4ad. で
作られたもの) は ‘__annotations__’ 属性が定義されていない可能性がありま
す。この属性があるかどうか不明なオブジェクトの場合は、Python 3.10 以降で
は、 *note getattr(): f93. に３つの引数を渡して呼び出す (例えば
‘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(): bf0. ではなく、 *note getattr(): f93. に３つ
の引数を渡すことで ‘__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__: 101f. の辞書に格納されるという実装になっています。クラスにはア
ノテーションがない場合もあるため、この辞書の *note get(): 2241. メソッド
を使ってアノテーションを取得する、というのが推奨の方法です。

以上を踏まえると、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(): 2fb. で型を再度確認すること
を推奨します。

ただし、一部の特殊な型オブジェクトや不正な形式の型オブジェクトは *note
__dict__: 101f. 属性がないこともあるため、さらに安全をとるには *note
getattr(): f93. を使って ‘__dict__’ を取得したほうがいいです。


File: python.info,  Node: 文字列指定のアノテーションを手動で解決する方法,  Next: __annotations__ のベストプラクティス 全 Python バージョン共通,  Prev: オブジェクトのアノテーション辞書へのアクセス Python 3 9 以前,  Up: アノテーションのベストプラクティス

9.18.3 文字列指定のアノテーションを手動で解決する方法
-----------------------------------------------------

アノテーションは文字列として指定されている場合があり、それを評価して
Python の値に変換するには、 *note inspect.get_annotations(): bf0. を使う
のが一番です。

Python 3.9 以前を使っているか、もしくは何らかの理由で *note
inspect.get_annotations(): bf0. を使えない場合は、自分で実装する必要があ
ります。現状の Python バージョンの ‘inspect.get_annotations()’ の実装を
確認して、同様の処理を実装することを推奨します。

すなわち、任意のオブジェクト ‘o’ の文字列アノテーションを評価するには:

   * ‘o’ がモジュールならば、 ‘o.__dict__’ を ‘globals’ として *note
     eval(): 18f. を呼ぶ。

   * ‘o’ がクラスならば、 ‘sys.modules[o.__module__].__dict__’ を
     ‘globals’ とし、 ‘dict(vars(o))’ を ‘locals’ として *note eval():
     18f. を呼ぶ。

   * ‘o’ が *note functools.update_wrapper(): 13cf. か *note
     functools.wraps(): 130c. か *note functools.partial(): 4ad. でラッ
     プされた callable ならば、一番内部の関数に到達するまで、
     ‘o.__wrapped__’ か ‘o.func’ のどちらかを繰り返し取得する。

   * ‘o’ がクラス以外の callable であれば、 *note o.__globals__: 168d. を
     globals として *note eval(): 18f. を呼ぶ。

しかし、必ずしもアノテーションの文字列が *note eval(): 18f. で Python の
値に変換できるとは限りません。理論上どんな文字列も指定可能であり、変換で
きない文字列を型ヒントとして指定する必要がある場合が実際にあります。例え
ば:

   * ‘|’ を使った PEP 604(1) のユニオン型 (これが追加された Python 3.10
     より前のバージョン)

   * *note typing.TYPE_CHECKING: 10b4. が True の時だけインポートされ、
     実行時には必要ない型定義。

*note eval(): 18f. で上記のような値を評価しようとすると、失敗し例外が発
生します。そのため、アノテーションを扱うライブラリ 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(): 673. 、 Python 3.10 以降は *note
     inspect.get_annotations(): bf0. を使いましょう。

   * 直接 ‘__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(): 673. on Python 3.14+ or *note
inspect.get_annotations(): bf0. on Python 3.10+.  On earlier versions of
Python, you can avoid these bugs by accessing the annotations from the
class's *note __dict__: 101f. (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(): 191. 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: 21ca. 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(): 5486./*note
     Py_FinalizeEx(): 10d3. cycles, and

   - in parallel, managing "sub-interpreters" using *note
     Py_NewInterpreter(): 1d4e./*note Py_EndInterpreter(): 1a8f.

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: 1a6.*; 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:
5bf9.), 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: 5bf8, 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: 556d.


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: 556a.  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: 1dac.) 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: d47. 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(): 10d3.) and
re-initialization (*note Py_Initialize(): 67a.).


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: 602. flag to prevent
     mutability.

   * Heap types inherit *note tp_new: 986. by default, so it may become
     possible to instantiate them from Python code.  You can prevent
     this with the *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 989. 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: 1cae.
structure, a description or "blueprint" of a class, and calling *note
PyType_FromModuleAndSpec(): 398. to construct a new class object.

     注釈: Other functions, like *note PyType_FromSpec(): 396, can also
     create heap types, but *note PyType_FromModuleAndSpec(): 398.
     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: 3a6. flag.

   - Define a traverse function using *note Py_tp_traverse: 54f5, which
     visits the type (e.g.  using ‘Py_VISIT(Py_TYPE(self))’).

Please refer to the documentation of *note Py_TPFLAGS_HAVE_GC: 3a6. and
*note tp_traverse: 373. 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: 5b5. was only added in Python 3.11.  As
a replacement, use:

   * *note PY_VERSION_HEX: 5b6, if not using the stable ABI, or

   * *note sys.version_info: 308. (via *note PySys_GetObject(): 35e. and
     *note PyArg_ParseTuple(): 3b9.).


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: 373. 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: 986. and *note tp_clear: 5206.


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: 51e2. function, it needs to:

   - call *note PyObject_GC_UnTrack(): 18bd. 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: 51f4. slot of a heap type must be set to *note
PyObject_GC_Del(): 18bb.  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(): d51. or *note PyObject_NewVar(): d52.:

   - Get and call type's *note tp_alloc: 51f5. 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(): e6c. or *note PyObject_GC_NewVar():
     e6d.:

          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():
398, you can call *note PyType_GetModule(): d3b. to get the associated
module, and then *note PyModule_GetState(): d4c. 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(): d3c, 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: 1c30. *note calling
convention: 188f. and the corresponding *note PyCMethod: b4b. 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():
d3c. 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: 5653. for *note __add__: 25f1. or *note tp_new: 986. for
initialization—have a very simple API that doesn't allow passing in the
defining class, unlike with *note PyCMethod: b4b.  The same goes for
getters and setters defined with *note PyGetSetDef: f7b.

To access the module state in these cases, use the *note
PyType_GetModuleByDef(): 82d. function, and pass in the module
definition.  Once you have the module, call *note PyModule_GetState():
d4c. 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: 27a3. (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(): 398, 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: 32f. 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(): 1342. 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(): 115d. 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(): 258a. 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: 48e. where the *note global
interpreter lock: 68c. (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: 2461, may not be ready for use in a free-threaded build, and
will re-enable the *note GIL: 418.

This document describes the implications of free threading for Python
code.  See *note C API Extension Support for Free Threading: 5c20. 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: 6ab.
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: 6ad. and *note sys.version: 6ae. contain "free-threading
build".  The new *note sys._is_gil_enabled(): 4c19. 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: 6ac.
or the command-line option *note -X gil: 183.

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: 193, *note list: 4e0, and *note set: 432. 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: 1a30. 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: 3a0.
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(): 1695.


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: 298. from a *note frame:
ad2. object if that frame is currently executing in another thread, and
doing so may crash the interpreter.


File: python.info,  Node: イテレータ iterator<3>,  Next: Single-threaded performance,  Prev: フレーム frame オブジェクト<3>,  Up: Known limitations

9.22.5.3 イテレータ (iterator)
..............................

It is generally not thread-safe to access the same iterator object from
multiple threads concurrently, and threads may see duplicate or missing
elements.


File: python.info,  Node: Single-threaded performance,  Prev: イテレータ iterator<3>,  Up: Known limitations

9.22.5.4 Single-threaded performance
....................................

The free-threaded build has additional overhead when executing Python
code compared to the default GIL-enabled build.  The amount of overhead
depends on the workload and hardware.  On the pyperformance benchmark
suite, the average overhead ranges from about 1% on macOS aarch64 to 8%
on x86-64 Linux systems.


File: python.info,  Node: Behavioral changes,  Prev: Known limitations,  Up: Python support for free threading

9.22.6 Behavioral changes
-------------------------

This section describes CPython behavioural changes with the
free-threaded build.

* Menu:

* Context variables::
* Warning filters::


File: python.info,  Node: Context variables,  Next: Warning filters,  Up: Behavioral changes

9.22.6.1 Context variables
..........................

In the free-threaded build, the flag *note thread_inherit_context: 426.
is set to true by default which causes threads created with *note
threading.Thread: 427. to start with a copy of the *note Context(): 428.
of the caller of *note start(): 429.  In the default GIL-enabled build,
the flag defaults to false so threads start with an empty ‘Context()’.


File: python.info,  Node: Warning filters,  Prev: Context variables,  Up: Behavioral changes

9.22.6.2 Warning filters
........................

In the free-threaded build, the flag *note context_aware_warnings: 436.
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: 42a. 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: 11b. module for more details.


File: python.info,  Node: C API Extension Support for Free Threading,  Next: Remote debugging attachment protocol,  Prev: Python support for free threading,  Up: Python HOWTO

9.23 C API Extension Support for Free Threading
===============================================

Starting with the 3.13 release, CPython has support for running with the
*note global interpreter lock: 68c. (GIL) disabled in a configuration
called *note free threading: 48e.  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(): 425. 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 *note multi-phase initialization: 556a. (functions
like *note PyModuleDef_Init(): 539b, *note PyModExport_*: 1a7. export
hook, *note PyModule_FromSlotsAndSpec(): 394.) should add a *note
Py_mod_gil: 697. slot in the module definition.  If your extension
supports older versions of CPython, you should guard the slot with a
*note PY_VERSION_HEX: 5b6. check.

     static struct PyModuleDef_Slot module_slots[] = {
         ...
     #if PY_VERSION_HEX >= 0x030D0000
         {Py_mod_gil, Py_MOD_GIL_NOT_USED},
     #endif
         {0, NULL}
     };


File: python.info,  Node: Single-Phase Initialization,  Prev: Multi-Phase Initialization,  Up: Module Initialization

9.23.2.2 Single-Phase Initialization
....................................

Extensions that use legacy *note single-phase initialization: 556b.
(that is, *note PyModule_Create(): 5571.) should call *note
PyUnstable_Module_SetGIL(): 6af. 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: 5284, *note
     PyList_SET_ITEM: 828, and macros like *note
     PySequence_Fast_GET_SIZE: 5fd. that use the object returned by
     *note PySequence_Fast(): 1ae5. 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: 60a. may not be thread-safe if the containing object is
     modified concurrently.  See the section on *note borrowed
     references: 5c35. 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: 2941, *note PyDictObject: 844, and
*note PySetObject: 5735. perform internal locking in the free-threaded
build.  For example, the *note PyList_Append(): 5380. 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(): 1bbb, which does not lock
the dictionary.  You should use *note Py_BEGIN_CRITICAL_SECTION: 5478.
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: 60a.  These APIs
are not thread-safe if the containing object is modified concurrently.
For example, it's not safe to use *note PyList_GetItem(): 7fb. if the
list may be modified concurrently.

The following table lists some borrowed reference APIs and their
replacements that return *note strong references: 7e0.

Borrowed reference API                  Strong reference API
                                        
--------------------------------------------------------------------------------
                                        
*note PyList_GetItem(): 7fb.            *note PyList_GetItemRef(): 7fa.
                                        
                                        
*note PyList_GET_ITEM(): 5284.          *note PyList_GetItemRef(): 7fa.
                                        
                                        
*note PyDict_GetItem(): 822.            *note PyDict_GetItemRef(): 7de.
                                        
                                        
*note PyDict_GetItemWithError(): 7df.   *note PyDict_GetItemRef(): 7de.
                                        
                                        
*note PyDict_GetItemString(): 823.      *note PyDict_GetItemStringRef(): 63b.
                                        
                                        
*note PyDict_SetDefault(): 7e2.         *note PyDict_SetDefaultRef(): 7e1.
                                        
                                        
*note PyDict_Next(): 1bbb.              none (see *note PyDict_Next: 5c38.)
                                        
                                        
‘PyWeakref_GetObject()’                 *note PyWeakref_GetRef(): 3ac.
                                        
                                        
‘PyWeakref_GET_OBJECT()’                *note PyWeakref_GetRef(): 3ac.
                                        
                                        
*note PyImport_AddModule(): 7f8.        *note PyImport_AddModuleRef(): 7f7.
                                        
                                        
*note PyCell_GET(): 5776.               *note PyCell_Get(): 5775.
                                        

Not all APIs that return borrowed references are problematic.  For
example, *note PyTuple_GetItem(): 51dd. is safe because tuples are
immutable.  Similarly, not all uses of the above APIs are problematic.
For example, *note PyDict_GetItem(): 822. 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: 594b.: "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(): 102a. in your
     extension and check that the allocated memory is used for Python
     objects.  Use *note PyMem_Malloc(): 1027. 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 PyThreadState_Ensure(): 540c, *note
     PyThreadState_EnsureFromView(): 540d, and *note
     PyThreadState_Release(): 5410.

   * *note PyGILState_Ensure(): 1b0. and *note PyGILState_Release():
     1b1.

   * *note PyEval_SaveThread(): 83e. and *note PyEval_RestoreThread():
     83f.

   * *note Py_BEGIN_ALLOW_THREADS: 51e3. and *note Py_END_ALLOW_THREADS:
     e52.

These functions should still be used in the free-threaded build to
manage thread state even when the *note GIL: 418. is disabled.  For
example, if you create a thread outside of Python, you must call *note
PyThreadState_Ensure(): 540c. 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(): 83e. or *note
Py_BEGIN_ALLOW_THREADS: 51e3. around blocking operations, such as I/O or
lock acquisitions, to allow other threads to run the *note cyclic
garbage collector: 19fe.


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::
* Per-Object Locks (ob_mutex): Per-Object Locks ob_mutex.


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(): 51df, 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: 5478. and *note
     Py_END_CRITICAL_SECTION: 547c. - For locking a single object

   * *note Py_BEGIN_CRITICAL_SECTION2: 5479. and *note
     Py_END_CRITICAL_SECTION2: 547d. - 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: 5479. to lock two
objects simultaneously.

Note that the locks described above are only *note PyMutex: 699. 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,  Next: Per-Object Locks ob_mutex,  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: 5479, 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: Per-Object Locks ob_mutex,  Prev: Important Considerations,  Up: Critical Sections

9.23.8.6 Per-Object Locks (‘ob_mutex’)
......................................

In the free-threaded build, each Python object contains a *note
ob_mutex: 5986. field of type *note PyMutex: 699.  This mutex is
'reserved for use by the critical section API' (*note
Py_BEGIN_CRITICAL_SECTION: 5478. / *note Py_END_CRITICAL_SECTION:
547c.).

     警告: Do 'not' lock ‘ob_mutex’ directly with
     ‘PyMutex_Lock(&obj->ob_mutex)’.  Mixing direct ‘PyMutex_Lock’ calls
     with the critical section API on the same mutex can cause
     deadlocks.

Even if your own code never uses critical sections on a particular
object type, 'CPython internals may use the critical section API on any
Python object'.

If your extension type needs its own lock, add a separate *note PyMutex:
699. field (or another synchronization primitive) to your object struct.
‘PyMutex’ is very lightweight, so there is negligible cost to having an
additional one.


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<85>.

   ---------- 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<85>,  Up: Building Extensions for the Free-Threaded Build

9.23.9.1 Limited C API and Stable ABI
.....................................

The free-threaded build does not currently support the *note Limited C
API: 82f. or the stable ABI. If you use setuptools(1) to build your
extension and currently set ‘py_limited_api=True’ you can use
‘py_limited_api=not sysconfig.get_config_var("Py_GIL_DISABLED")’ to opt
out of the limited API when building with the free-threaded build.

     注釈: You will need to build separate wheels specifically for the
     free-threaded build.  If you currently use the stable ABI, you can
     continue to build a single wheel for multiple non-free-threaded
     Python versions.

   ---------- Footnotes ----------

   (1) https://setuptools.pypa.io/en/latest/setuptools.html


File: python.info,  Node: Windows<85>,  Prev: Limited C API and Stable ABI,  Up: Building Extensions for the Free-Threaded Build

9.23.9.2 Windows
................

Due to a limitation of the official Windows installer, you will need to
manually define ‘Py_GIL_DISABLED=1’ when building extensions from
source.

参考
....

Porting Extension Modules to Support Free-Threading(1): A
community-maintained porting guide for extension authors.

   ---------- Footnotes ----------

   (1) https://py-free-threading.github.io/porting/


File: python.info,  Node: Remote debugging attachment protocol,  Next: Permission requirements,  Prev: C API Extension Support for Free Threading,  Up: Python HOWTO

9.24 Remote debugging attachment protocol
=========================================

This protocol enables external tools to attach to a running CPython
process and execute Python code remotely.

Most platforms require elevated privileges to attach to another Python
process.

* Menu:

* Disabling remote debugging::


File: python.info,  Node: Disabling remote debugging,  Up: Remote debugging attachment protocol

9.24.1 Disabling remote debugging
---------------------------------

To disable remote debugging support, use any of the following:

   * Set the *note PYTHON_DISABLE_REMOTE_DEBUG: 420. environment
     variable to ‘1’ before starting the interpreter.

   * Use the *note -X disable_remote_debug: 183. command-line option.

   * Compile Python with the *note -without-remote-debug: 421. 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:
     5c4d. 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(): 41f.
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: 420. (and
the equivalent *note -X disable_remote_debug: 183. 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: 3a12.

   * *note アノテーションのベストプラクティス: bba.

   * *note Argparse チュートリアル: 35e0.

   * *note デスクリプタ ガイド: 18a5.

   * *note 列挙型 HOWTO: 5a98.

   * *note 関数型プログラミング HOWTO: 5ac9.

   * *note ipaddressモジュールの紹介: 4421.

   * *note Logging HOWTO: 5ae8.

   * *note Logging クックブック: 15b6.

   * *note Regular expression HOWTO: 2994.

   * *note ソートのテクニック: 1599.

   * *note Unicode HOWTO: 165e.

   * *note urllib
     パッケージを使ってインターネット上のリソースを取得するには: 41e5.

Advanced development:

   * *note Python で Curses プログラミング: 36d4.

   * *note Python support for free threading: 2931.

   * *note C API Extension Support for Free Threading: 5c20.

   * *note 拡張モジュールを分離する: 419.

   * *note The Python 2.3 Method Resolution Order: 1862.

   * *note ソケットプログラミング HOWTO: 3bff.

   * *note timer file descriptor HOWTO: 5c11.

   * *note Python 3 への拡張モジュール移植: 169a.

Debugging and profiling:

   * *note Debugging C API extensions and CPython Internals with GDB:
     5a89.

   * *note DTrace と SystemTap で CPython を測定する: 102e.

   * *note Python support for the perf map compatible profilers: 6bd.

   * *note Remote debugging attachment protocol: 4c1b.


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 チュートリアル: 21c8. から始めましょう
。他にも、 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
標準ライブラリ: 3fe. の一覧を参照してください。また、様々なサードパーテ
ィの拡張も使えます。 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: 6ae. 、 *note sys.hexversion: 4c14. 、 *note
sys.version_info: 308. も参照してください。

   ---------- 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 チュートリアル: 21c8. などがあります。

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(): 500. 関数でそれらのデバッガに処理を移せます。

pdb モジュールは簡素にして十分な Python のコンソールモードデバッガです。
これは Python の標準ライブラリに含まれているもので、 *note
ライブラリリファレンスマニュアルにドキュメントがあります: aa. 。 pdb の
コードを手本にして自分用のデバッガを書くこともできます。

IDLE 対話型開発環境は、標準 Python ディストリビューションの一部 (普通は
*note idlelib: 76. として利用可能) であり、グラフィカルなデバッガを含ん
でいます。

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/main/Tools/freeze

   (2) https://nuitka.net/

   (3) https://pyinstaller.org/

   (4) https://pyoxidizer.readthedocs.io/en/stable/

   (5) https://marcelotduarte.github.io/cx_Freeze/

   (6) https://github.com/ronaldoussoren/py2app

   (7) https://www.py2exe.org/


File: python.info,  Node: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？,  Prev: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？,  Up: 一般的な質問

10.2.1.4 Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？
........................................................................................

はい。標準ライブラリモジュールに求められるコーディングスタイルは PEP
8(1) として文書化されています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0008/


File: python.info,  Node: コア言語,  Next: 数と文字列,  Prev: 一般的な質問,  Up: プログラミング FAQ

10.2.2 コア言語
---------------

* Menu:

* なぜ変数に値があるのに UnboundLocalError が出るのですか？::
* Python のローカルとグローバル変数のルールは何ですか？::
* ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？::
* グローバル変数をモジュール間で共有するにはどうしたらいいですか？::
* モジュールで import を使う際の「ベストプラクティス」は何ですか？::
* なぜオブジェクト間でデフォルト値が共有されるのですか？::
* オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？::
* 実引数と仮引数の違いは何ですか?::
* なぜ list 'y' を変更すると list 'x' も変更されるのですか?::
* 出力引数のある関数 (参照渡し) はどのように書きますか？: 出力引数のある関数 参照渡し はどのように書きますか？.
* Python で高次関数はどのようにつくりますか？::
* Python のオブジェクトはどのようにコピーしますか？::
* オブジェクトのメソッドや属性はどのように見つけますか？::
* コードはどのようにオブジェクトの名前を見つけるのですか？::
* カンマ演算子はなぜ優先されるのですか？::
* C の "?;" 三項演算子と等価なものはありますか？: C の "? " 三項演算子と等価なものはありますか？.
* Python で解し難いワンライナーを書くことはできますか？::
* 関数の引数リストにあるスラッシュ (/) は何を意味しますか？: 関数の引数リストにあるスラッシュ / は何を意味しますか？.


File: python.info,  Node: なぜ変数に値があるのに UnboundLocalError が出るのですか？,  Next: Python のローカルとグローバル変数のルールは何ですか？,  Up: コア言語

10.2.2.1 なぜ変数に値があるのに UnboundLocalError が出るのですか？
..................................................................

もともと動いていたコードが、関数の本体のどこかに代入文を加えるという変更
をしたら *note UnboundLocalError: 18ee. を出すのには驚くかもしれません。

このコード:

     >>> 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: 1661. 予約語を使う
ことでもできます:

     >>> 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: 6bb. を要求することで、意図しない副作用を防げま
す。他方では、グローバルな参照の度に ‘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: e2, *note os: a5, *note
     argparse: 7, *note re: c1.

  2. サードパーティのライブラリモジュール (Python の site-packages ディ
     レクトリにインストールされているもの) - 例 dateutil(1),
     requests(2), tzdata(3)

  3. 自前で開発したモジュール

循環参照の問題を避けるために、インポートを関数やクラスに移すことが必要な
ときもあります。Gordon McMillan によれば:

     循環参照は両方のモジュールが "import <module>" 形式のインポートを使
     っていれば大丈夫です。二つ目のモジュールが最初のモジュールから名前
     を確保しようとして ("from module import name")、そのインポートがト
     ップレベルにあると駄目です。最初のモジュールが二つ目のモジュールを
     インポートするのに忙しくて、最初のモジュールの名前が利用可能になっ
     ていないからです。

この状況では、二つ目のモジュールが一つの関数の中でのみ使われているならば
、そのインポートは簡単に関数の中に移せます。インポートが呼ばれたとき、最
初のモジュールは初期化を完了していて、二つ目のモジュールは自分のインポー
トをできます。

プラットフォーム依存のモジュールがあるときには、インポートをトップレベル
の外に動かすことも必要です。この場合、ファイルの先頭ではすべてのモジュー
ルをインポートすることさえできないかもしれません。この場合は、対応するプ
ラットフォームに合わせたコードで正しいモジュールをインポートすることを選
ぶと良いです。

循環参照の問題を避けたりモジュールの初期化にかかる時間を減らしたりしたい
なら、単にインポートを関数定義の中などのローカルなスコープに移してくださ
い。この手法は多くのインポートがプログラムがどのように実行されるかに依存
しなくてよいときに特に有効です。ある関数の中でのみモジュールが使われるの
なら、インポートをその関数の中に移すことを考えてもいいでしょう。なお、モ
ジュールを読み込む最初の回はモジュールの初期化の時間のために高価になりえ
ますが、複数回目にモジュールを読み込むのは事実上無料、辞書探索の数回のコ
ストだけで済みます。モジュール名がスコープから外れてさえ、そのモジュール
はおそらく *note sys.modules: 19da. から利用できるでしょう。

   ---------- 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): 255a. は関数定義に表れる名前で定義されるのに対
し、 *note 実引数 (argument): 86d. は関数を呼び出すときに実際に渡す値の
ことです。仮引数は関数が受け取ることの出来る 実引数の型 を定義します。例
えば、以下のような関数定義があったとして:

     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: 1759. です。内容を変更出来る、ということで
     す。

After the call to *note append(): 25ea, the content of the mutable
object has changed from ‘[]’ to ‘[10]’.  Since both the variables refer
to the same object, using either name accesses the modified value
‘[10]’.

代わりに ‘x’ にイミュータブルを代入すると:

     >>> x = 5  # ints are immutable
     >>> y = x
     >>> x = x + 1  # 5 can't be mutated, we are creating a new object here
     >>> x
     6
     >>> y
     5

この場合ご覧の通り ‘x’ と ‘y’ はまったく同じではありませんね。これは整数
が *note immutable: 18c. だからで、 ‘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):
f90.) は新しいオブジェクトを作ります。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’ は新しいオブジェクトを作ります)。

言い換えると:

   * If we have a mutable object (such as *note list: 4e0, *note dict:
     193, *note set: 432.), we can use some specific operations to
     mutate it and all the variables that refer to it will see the
     change.

   * If we have an immutable object (such as *note str: 1ea, *note int:
     32e, *note tuple: 1d9.), all the variables that refer to it will
     always see the same value, but operations that transform that value
     into a new value always return a new object.

2つの変数が同じオブジェクトを参照しているかどうかが知りたければ、 *note
is: 32c. 演算子や組み込み関数 *note id(): 17db. が使えます。


File: python.info,  Node: 出力引数のある関数 参照渡し はどのように書きますか？,  Next: Python で高次関数はどのようにつくりますか？,  Prev: なぜ list 'y' を変更すると list 'x' も変更されるのですか?,  Up: コア言語

10.2.2.10 出力引数のある関数 (参照渡し) はどのように書きますか？
................................................................

Remember that arguments are passed by assignment in Python.  Since
assignment just creates references to objects, there's no alias between
an argument name in the caller and callee, and consequently no
call-by-reference.  You can achieve the desired effect in a number of
ways.

  1. 結果のタプルを返すことによって:

          >>> def func1(a, b):
          ...     a = 'new-value'        # a and b are local names
          ...     b = b + 1              # assigned to new objects
          ...     return a, b            # return new values
          ...
          >>> x, y = 'old-value', 99
          >>> func1(x, y)
          ('new-value', 100)

     これはたいてい一番明確な方法です。

  2. グローバル変数を使って。これはスレッドセーフでないので、推奨されま
     せん。

  3. ミュータブルな (インプレースに変更可能な) オブジェクトを渡すことに
     よって:

          >>> def func2(a):
          ...     a[0] = 'new-value'     # 'a' references a mutable list
          ...     a[1] = a[1] + 1        # changes a shared object
          ...
          >>> args = ['old-value', 99]
          >>> func2(args)
          >>> args
          ['new-value', 100]

  4. 変更される辞書に渡すことによって:

          >>> def func3(args):
          ...     args['a'] = 'new-value'     # args is a mutable dictionary
          ...     args['b'] = args['b'] + 1   # change it in-place
          ...
          >>> args = {'a': 'old-value', 'b': 99}
          >>> func3(args)
          >>> args
          {'a': 'new-value', 'b': 100}

  5. または、クラスインスタンスに値を同梱することによって:

          >>> class Namespace:
          ...     def __init__(self, /, **args):
          ...         for key, value in args.items():
          ...             setattr(self, key, value)
          ...
          >>> def func4(args):
          ...     args.a = 'new-value'        # args is a mutable Namespace
          ...     args.b = args.b + 1         # change object in-place
          ...
          >>> args = Namespace(a='old-value', b=99)
          >>> func4(args)
          >>> vars(args)
          {'a': 'new-value', 'b': 100}

     このような複雑なことをする理由はめったに無いでしょう。

一番の選択は、複数の結果を含むタプルを返すことです。


File: python.info,  Node: Python で高次関数はどのようにつくりますか？,  Next: Python のオブジェクトはどのようにコピーしますか？,  Prev: 出力引数のある関数 参照渡し はどのように書きますか？,  Up: コア言語

10.2.2.11 Python で高次関数はどのようにつくりますか？
.....................................................

二つの方法があります: ネストされたスコープを使う方法と、呼び出し可能オブ
ジェクトを使う方法です。例えば、‘a*x+b’ の値を計算する ‘f(x)’ 関数を返す
‘linear(a,b)’ を定義したいとします。ネストされたスコープを使うと:

     def linear(a, b):
         def result(x):
             return a * x + b
         return result

また、呼び出し可能オブジェクトを使うと:

     class linear:

         def __init__(self, a, b):
             self.a, self.b = a, b

         def __call__(self, x):
             return self.a * x + self.b

どちらの場合でも、

     taxes = linear(0.3, 2)

とすれば、‘taxes(10e6) == 0.3 * 10e6 + 2’ となるような呼び出し可能オブジ
ェクトを得られます。

呼び出し可能オブジェクトを使う方法は、少し遅くなり、わずかにコードが長く
なるという短所があります。ですが、継承を使って呼び出し可能オブジェクト同
士で記号を共有することもできます:

     class exponential(linear):
         # __init__ inherited
         def __call__(self, x):
             return self.a * (x ** self.b)

オブジェクトはいくつかのメソッドに状態をカプセル化できます:

     class counter:

         value = 0

         def set(self, x):
             self.value = x

         def up(self):
             self.value = self.value + 1

         def down(self):
             self.value = self.value - 1

     count = counter()
     inc, dec, reset = count.up, count.down, count.set

ここで、‘inc()’、‘dec()’、‘reset()’ は同じカウント変数を共有する関数のよ
うにふるまいます。


File: python.info,  Node: Python のオブジェクトはどのようにコピーしますか？,  Next: オブジェクトのメソッドや属性はどのように見つけますか？,  Prev: Python で高次関数はどのようにつくりますか？,  Up: コア言語

10.2.2.12 Python のオブジェクトはどのようにコピーしますか？
...........................................................

一般的に、普通は *note copy.copy(): 947. や *note copy.deepcopy(): f2f.
を試してください。何でもコピーできるとは限りませんが、たいていはできます
。

もっと簡単にコピーできるオブジェクトもあります。辞書には *note copy():
f92. メソッドがあります:

     newdict = olddict.copy()

シーケンスはスライシングでコピーできます:

     new_l = l[:]


File: python.info,  Node: オブジェクトのメソッドや属性はどのように見つけますか？,  Next: コードはどのようにオブジェクトの名前を見つけるのですか？,  Prev: Python のオブジェクトはどのようにコピーしますか？,  Up: コア言語

10.2.2.13 オブジェクトのメソッドや属性はどのように見つけますか？
................................................................

ユーザー定義クラスのインスタンス ‘x’ で、*note dir(x): a28,< はインスタ
ンス属性とそのクラスで定義されたメソッドや属性を含む名前のアルファベット
順リストを返します。


File: python.info,  Node: コードはどのようにオブジェクトの名前を見つけるのですか？,  Next: カンマ演算子はなぜ優先されるのですか？,  Prev: オブジェクトのメソッドや属性はどのように見つけますか？,  Up: コア言語

10.2.2.14 コードはどのようにオブジェクトの名前を見つけるのですか？
..................................................................

概して、オブジェクトは本当は名前を持たないので、見つけることはできません
。本質的には、代入とはいつも値に名前を束縛することです。‘def’ と ‘class’
文も同じですが、この場合は値はコーラブルです。以下のコードを考えてみまし
ょう:

     >>> class A:
     ...     pass
     ...
     >>> B = A
     >>> a = B()
     >>> b = a
     >>> print(b)
     <__main__.A object at 0x16D07CC>
     >>> print(a)
     <__main__.A object at 0x16D07CC>

おそらく、このクラスには名前があります。このクラスは二つの名前に縛られて
、名前 ‘B’ を通して呼び出されますが、それでもクラス ‘A’ のインスタンスと
して報告されるのです。しかし、両方の名前が同じ値に束縛されている以上、こ
のインスタンスの名前が ‘a’ か ‘b’ か決めることはできないのです。

概して、コードにとってある値の「名前を知っている」事は重要ではありません
。あなたがわざと内省的なコードを書いているのでない限り、方針を変えた方が
いいかもしれないということになるでしょう。

comp.lang.python で、Fredrik Lundh はこの問題の答えとして素晴らしい喩え
をしてくれました:

     玄関にいた猫の名前を知るのと同じ方法です: その猫 (オブジェクト) 自
     体はその名前を言うことができないし、それは実は問題ではありません -
     その猫が何と呼ばれているかを知る唯一の方法は、すべての隣人 (名前空
     間) にその猫 (オブジェクト) が何と呼ばれているかを聞くことです。

     ……そして、その猫が沢山の名前で知られていたり、逆に全く名前が無かっ
     たりしても驚かないでください！


File: python.info,  Node: カンマ演算子はなぜ優先されるのですか？,  Next: C の "? " 三項演算子と等価なものはありますか？,  Prev: コードはどのようにオブジェクトの名前を見つけるのですか？,  Up: コア言語

10.2.2.15 カンマ演算子はなぜ優先されるのですか？
................................................

カンマは Python では演算子ではありません。このセッションを考えてください
:

     >>> "a" in "b", "a"
     (False, 'a')

カンマは演算子ではなく、式の分離子なので、上の式は次の式と同じように評価
されます:

     ("a" in "b"), "a"

こうではありません:

     "a" in ("b", "a")

The same is true of the various assignment operators (‘=’, ‘+=’, and so
on).  They are not truly operators but syntactic delimiters in
assignment statements.


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: 1657. がネ
ストされています。Ulf Bartelt によるものを少しアレンジした下の３つの例を
見てください:

     from functools import reduce

     # Primes < 1000
     print(list(filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,
     map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))))

     # First 10 Fibonacci numbers
     print(list(map(lambda x,f=lambda x,f:(f(x-1,f)+f(x-2,f)) if x>1 else 1:
     f(x,f), range(10))))

     # Mandelbrot set
     print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\n'+y,map(lambda y,
     Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,
     Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,
     i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y
     >=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(
     64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy
     ))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24))
     #    \___ ___/  \___ ___/  |   |   |__ lines on screen
     #        V          V      |   |______ columns on screen
     #        |          |      |__________ maximum of "iterations"
     #        |          |_________________ range on y axis
     #        |____________________________ range on x axis

よい子はまねしないでね！


File: python.info,  Node: 関数の引数リストにあるスラッシュ / は何を意味しますか？,  Prev: Python で解し難いワンライナーを書くことはできますか？,  Up: コア言語

10.2.2.18 関数の引数リストにあるスラッシュ (/) は何を意味しますか？
...................................................................

パラメータ関数の仮引数にあるスラッシュは、それより前にある仮引数は位置専
用引数であることを示します。 位置専用引数は、外で使える名前を持たない仮
引数です。 位置専用引数を受け付ける関数の呼び出しにおいて、実引数はその
位置だけに基づいて仮引数に対応付けられます。 例えば、 *note divmod():
d6e. は位置専用引数を受け付けます。 そのドキュメントは次のようになります
:

     >>> 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(): d6e. をキーワード
引数を使って呼び出すとエラーになります:

     >>> divmod(x=3, y=4)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: divmod() takes no keyword arguments


File: python.info,  Node: 数と文字列,  Next: 性能<4>,  Prev: コア言語,  Up: プログラミング FAQ

10.2.3 数と文字列
-----------------

* Menu:

* 十六進数や八進数を指定するにはどうしたらいいですか？::
* なぜ -22 // 10 は -3 を返すのですか？::
* どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？::
* 文字列を数に変換するにはどうしたらいいですか？::
* 数を文字列に変換するにはどうしたらいいですか？::
* 文字列をインプレースに変更するにはどうしたらいいですか？::
* 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？::
* Is there an equivalent to Perl's chomp() for removing trailing newlines from strings?: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?.
* Is there a scanf() or sscanf() equivalent?: Is there a scanf or sscanf equivalent?.
* What does UnicodeDecodeError or UnicodeEncodeError error mean?::
* raw string を奇数個のバックスラッシュで終えることはできますか？::


File: python.info,  Node: 十六進数や八進数を指定するにはどうしたらいいですか？,  Next: なぜ -22 // 10 は -3 を返すのですか？,  Up: 数と文字列

10.2.3.1 十六進数や八進数を指定するにはどうしたらいいですか？
.............................................................

八進数を指定するには、八進数での値の先頭に 0 と "o" (小文字または大文字)
を加えてください。たとえば、変数 "a" に八進数での "10" (十進数での"8") を
代入するには、こう打ってください:

     >>> a = 0o10
     >>> a
     8

十六進数も簡単です。ただ十六進数での値の先頭に 0 と "x" (小文字または大
文字) を加えてください。十六進数は小文字でも大文字でも指定できます。たと
えば、Python インタプリタで:

     >>> a = 0xa5
     >>> a
     165
     >>> b = 0XB2
     >>> b
     178


File: python.info,  Node: なぜ -22 // 10 は -3 を返すのですか？,  Next: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？,  Prev: 十六進数や八進数を指定するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.2 なぜ -22 // 10 は -3 を返すのですか？
..............................................

‘i % j’ が ‘j’ と同じ符号であってほしいことに基づいています。それに加え
て以下のようにもしたいとすると:

     i == (i // j) * j + (i % j)

整数除算は床を返すことになります。C にも C の一貫性があって、‘i % j’ が
‘i’ と同じ符号を持つように ‘i // j’ を丸めています。

‘i % j’ は、‘j’ が負の時には実際にはほとんど使いません。‘j’ が正なら、た
くさん使います。その事実上すべての場合、‘i % j’ は ‘>= 0’ となる方が便利
です。時計が 10 時を指している時、その 200 時間前は何時でしょうか。‘-190
% 12 == 2’ となるのが便利です。‘-190 % 12 == -10’ は噛み付きかねないバグ
です。


File: python.info,  Node: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？,  Next: 文字列を数に変換するにはどうしたらいいですか？,  Prev: なぜ -22 // 10 は -3 を返すのですか？,  Up: 数と文字列

10.2.3.3 どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？
..............................................................................

ふつうの方法で ‘int’ リテラルの属性を探そうとすると、ピリオドが小数点と
みなされ、*note SyntaxError: 189. となります:

     >>> 1.__class__
       File "<stdin>", line 1
       1.__class__
        ^
     SyntaxError: invalid decimal literal

解決策は、リテラルとピリオドを スペースや括弧で分けることです。

     >>> 1 .__class__
     <class 'int'>
     >>> (1).__class__
     <class 'int'>


File: python.info,  Node: 文字列を数に変換するにはどうしたらいいですか？,  Next: 数を文字列に変換するにはどうしたらいいですか？,  Prev: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？,  Up: 数と文字列

10.2.3.4 文字列を数に変換するにはどうしたらいいですか？
.......................................................

For integers, use the built-in *note int(): 32e. type constructor, for
example, ‘int('144') == 144’.  Similarly, *note float(): 32f. converts
to a floating-point number, for example, ‘float('144') == 144.0’.

デフォルトでは、これらは数を十進数として解釈するので、 ‘int('0144') ==
144’ は成立しますが ‘int('0x144')’ は *note ValueError: 15a. を送出しま
す。 ‘int(string, base)’ はオプションの第二引数をとって変換元の基数にし
ます。つまり ‘int( '0x144', 16) == 324’ です。基数が 0 と指定された場合
、その数は Python の基準によって解釈されます。先頭が '0o' なら八進数で、
'0x' なら十六進数を表します。

文字列を数に変換するだけのために *note eval(): 18f. を使わないでください
。 ‘eval()’ は特に遅いですし、セキュリティ上のリスクもあります。求められ
ない副作用を持つような Python の式を渡そうとする人がいるかも知れません。
例えば、あなたのホームディレクトリを消去する
‘__import__('os').system("rm -rf $HOME")’ を渡そうとする人がいるかも知れ
ません。

*note eval(): 18f. also has the effect of interpreting numbers as Python
expressions, so that, for example, ‘eval('09')’ gives a syntax error
because Python does not allow leading '0' in a decimal number (except
'0').


File: python.info,  Node: 数を文字列に変換するにはどうしたらいいですか？,  Next: 文字列をインプレースに変更するにはどうしたらいいですか？,  Prev: 文字列を数に変換するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.5 数を文字列に変換するにはどうしたらいいですか？
.......................................................

For example, to convert the number ‘144’ to the string ‘'144'’, use the
built-in type constructor *note str(): 1ea.  If you want a hexadecimal
or octal representation, use the built-in functions *note hex(): 1689.
or *note oct(): 1688.  For fancy formatting, see the *note f-strings:
441. and *note Format string syntax: 1754. sections.  For example,
‘"{:04d}".format(144)’ yields ‘'0144'’ and ‘"{:.3f}".format(1.0/3.0)’
yields ‘'0.333'’.


File: python.info,  Node: 文字列をインプレースに変更するにはどうしたらいいですか？,  Next: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？,  Prev: 数を文字列に変換するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.6 文字列をインプレースに変更するにはどうしたらいいですか？
.................................................................

You can't, because strings are immutable.  In most situations, you
should simply construct a new string from the various parts you want to
assemble it from.  However, if you need an object with the ability to
modify in-place Unicode data, try using an *note io.StringIO: 12d8.
object or the *note array: 8. module:

     >>> import io
     >>> s = "Hello, world"
     >>> sio = io.StringIO(s)
     >>> sio.getvalue()
     'Hello, world'
     >>> sio.seek(7)
     7
     >>> sio.write("there!")
     6
     >>> sio.getvalue()
     'Hello, there!'

     >>> import array
     >>> a = array.array('w', s)
     >>> print(a)
     array('w', 'Hello, world')
     >>> a[0] = 'y'
     >>> print(a)
     array('w', 'yello, world')
     >>> a.tounicode()
     'yello, world'


File: python.info,  Node: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？,  Next: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?,  Prev: 文字列をインプレースに変更するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.7 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？
.......................................................................

様々なテクニックがあります。

   * 一番いいのは、文字列を関数に対応させる辞書を使うことです。このテク
     ニックの一番の利点は、文字列が関数の名前と同じ必要がないことです。
     この方法は case 構造をエミュレートするための一番のテクニックでもあ
     ります:

          def a():
              pass

          def b():
              pass

          dispatch = {'go': a, 'stop': b}  # Note lack of parens for funcs

          dispatch[get_input()]()  # Note trailing parens to call function

   * 組み込み関数の *note getattr(): f93. を使う方法:

          import foo
          getattr(foo, 'bar')()

     なお、 *note getattr(): f93. はクラス、クラスインスタンス、モジュー
     ルなど、どんなオブジェクトにも使えます。

     これは標準ライブラリでも何箇所か使われています。このように:

          class Foo:
              def do_foo(self):
                  ...

              def do_bar(self):
                  ...

          f = getattr(foo_instance, 'do_' + opname)
          f()

   * *note locals(): 296. を使って関数名を決める方法:

          def myFunc():
              print("hello")

          fname = "myFunc"

          f = locals()[fname]
          f()


File: python.info,  Node: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?,  Next: Is there a scanf or sscanf equivalent?,  Prev: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.8 Is there an equivalent to Perl's ‘chomp()’ for removing trailing newlines from strings?
................................................................................................

‘S.rstrip("\r\n")’ を使って文字列 ‘S’ の終端から他の空白文字を取り除くこ
となくすべての行末記号を取り除くことができます。文字列 ‘S’ が複数行を表
し、終端に空行があるとき、そのすべての空行も取り除かれます:

     >>> lines = ("line 1 \r\n"
     ...          "\r\n"
     ...          "\r\n")
     >>> lines.rstrip("\n\r")
     'line 1 '

これは典型的に一度に一行ずつテキストを読みたい時にのみ使われるので、
‘S.rstrip()’ をこの方法で使うとうまくいきます。


File: python.info,  Node: Is there a scanf or sscanf equivalent?,  Next: What does UnicodeDecodeError or UnicodeEncodeError error mean?,  Prev: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?,  Up: 数と文字列

10.2.3.9 Is there a ‘scanf()’ or ‘sscanf()’ equivalent?
.......................................................

そのようなものはありません。

For simple input parsing, the easiest approach is usually to split the
line into whitespace-delimited words using the *note split(): 125e.
method of string objects and then convert decimal strings to numeric
values using *note int(): 32e. or *note float(): 32f.  ‘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: 165e. を参照して下さい。


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(): 1a62. を使ってバックスラッシュを追加
することもできます:

     >>> os.path.join(r'C:\this\will\work', '')
     'C:\\this\\will\\work\\'

注意点として、バックスラッシュは raw string 終端のクォートを「エスケープ
」しますが、 raw string の値を解釈する際にはエスケープが生じません。つま
り、バックスラッシュは raw string 値の中に残ったままになります:

     >>> r'backslash\'preserved'
     "backslash\\'preserved"

*note 言語リファレンス: 24ae. の仕様も参照してください。


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: ae8. に焦点を当てます。

   * 振る舞いはオペレーティングシステムによって変わりえます。特に、I/O や
     マルチスレッドに関しては顕著です。

   * 常に、コードの最適化を始める '前に' プログラムのホットスポットを見
     つけるべきです (*note profile: b4. モジュールを参照してください)。

   * ベンチマークスクリプトを書くことで、改善箇所の捜索を素早く繰り返せ
     ます (*note timeit: f8. モジュールを参照してください)。

   * 洗練された最適化に隠れたリグレッションの可能性を生む前に、(ユニット
     テストやその他の技法で) コードカバレッジを上げることを強く推奨しま
     す。

とは言っても、Python コードを高速化する技法はたくさんあります。ここでは
、満足な性能のレベルにたどり着くまでの長い道のりを進む、一般的な方針を示
します:

   * コード中に細かい最適化の技法をばらまこうとするよりも、アルゴリズム
     を高速化 (または高速なアルゴリズムに変更) するほうが、大きな利益を
     生むことがあります。

   * 適切なデータ構造を使ってください。*note 組み込み型: 2801. や *note
     collections: 1e. を調べてください。

   * 何かをするための基本要素が標準ライブラリにあるなら、自分で発明した
     代用品よりもそちらのほうが、(絶対にとは言えませんが) おそらく速いで
     す。 それが組み込み型やある種の拡張型のように C で書かれたものなら
     なおさらです。 たとえば、ソートするには、必ず *note list.sort():
     f91. 組み込みメソッドか *note sorted(): f90. 関数を使ってください
     (また、中程度に高度な例は、 *note ソートのテクニック: 1599. を参照
     してください)。

   * 抽象化は、遠回りにしがちで、インタプリタの作業を増やすことになりま
     す。この遠回りさが、なされる作業の量より重大になると、プログラムが
     遅くなってしまいます。過度な抽象化、特に細かい関数やメソッドの形で
     現れるもの (これは読みにくさも落とします) は防ぐべきです。

pure Python にできる限界に達したなら、更に進むためのツールがあります。例
えば、Cython(1) は、Python コードのわずかに変形した版を C 拡張にコンパイ
ルし、多種のプラットフォームで使えます。Cython は、コンパイル (と任意の
型アノテーション) を利用し、コードの解釈を大幅に速くします。C プログラミ
ングに自信があるなら、自分で *note write a C extension module: 21c9. こ
ともできます。

参考
....

パフォーマンス 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: 1ea. および *note bytes: 1d2. オブジェクトはイミュータブルな
ので、多くの文字列の結合は結合ごとに新しいオブジェクトを作成し、効率が悪
いです。 一般的に、全体の実行時間のコストは文字列の長さの二乗に比例しま
す。

多くの *note str: 1ea. オブジェクトを累積するのにおすすめのイディオムは
、すべてをリストに配置してから最後に *note str.join(): 2821. を呼び出す
ことです:

     chunks = []
     for s in my_strings:
         chunks.append(s)
     result = ''.join(chunks)

(Another reasonably efficient idiom is to use *note io.StringIO: 12d8.)

多くの *note bytes: 1d2. オブジェクトを累積するのにおすすめのイディオム
は、 *note bytearray: 1d1. オブジェクトをインプレース結合 (‘+=’ 演算子)
で拡張することです:

     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(): 1d9. を呼ぶのが手軽です。

型コンストラクタ ‘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(): c40. を使ってください。

     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: 18e.) 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: ac0. is an elegant solution:

     result = [obj.method() for obj in mylist]

     result = [function(obj) for obj in mylist]

戻り値を保存せずにメソッドや関数を実行するだけなら、ただの *note for:
329. ループで十分です:

     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__(): 25f3. 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(): 25ed. on the list and returning
the list.  That's why we say that for lists, ‘+=’ is a "shorthand" for
*note list.extend(): 7fe.:

     >>> 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(): f91. メソッドに ‘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'
を明示しなければならないのですか？: 5cb1. も参照してください。


File: python.info,  Node: あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？,  Next: 委譲とは何ですか？,  Prev: self とは何ですか？,  Up: オブジェクト

10.2.6.4 あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？
.............................................................................................................

Use the built-in function *note isinstance(obj, cls): 2fb.  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(): 2fb. also checks for virtual inheritance
from an *note abstract base class: 1574.  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: 27a3. (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(): 2fb. をユーザー定義の
クラスに何度も使うべきではありません。クラスを自分で開発するときに、適切
なオブジェクト指向スタイルは、特定の振る舞いをカプセル化するクラスのメソ
ッドを定義するものであって、オブジェクトのクラスを調べてそのクラスに応じ
て違うことをするものではありません。例えば、何かをする関数があったとして
:

     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__(): 8e8. メソッ
ドを通してなされます。属性の制御の詳細は *note 言語リファレンス: 25c3. を
参照してください。

なお、一般的に委譲はトリッキーになりがちです。属性が設定される時には読み
出される時と同様に、そのクラスに *note __setattr__(): 258c. メソッドを定
義する必要があり、それには細心の注意が必要です。 ‘__setattr__()’ の基本
的な実装はおおよそ以下のようになります:

     class X:
         ...
         def __setattr__(self, name, value):
             self.__dict__[name] = value
         ...

Many *note __setattr__(): 258c. 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__: 1ca. directly.


File: python.info,  Node: 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？,  Next: 基底クラスの名前を変えやすいコードを書くにはどうしますか？,  Prev: 委譲とは何ですか？,  Up: オブジェクト

10.2.6.6 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？
.......................................................................................................

組み込みの *note super(): 44a. 関数を使ってください:

     class Derived(Base):
         def meth(self):
             super().meth()  # calls Base.meth

この例では、 *note super(): 44a. は呼ばれたインスタンス (‘self’ の値) を
自動判断し、 ‘type(self).__mro__’ で *note method resolution order:
27a3. (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: 22b1. 。


File: python.info,  Node: クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。,  Next: 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？,  Prev: __spam を使おうとしたら _SomeClassName__spam からエラーがでました。,  Up: オブジェクト

10.2.6.11 クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。
.....................................................................................................

いくつかの可能性があります。

*note del: 1d3c. 文は必ずしも *note __del__(): 13ab. を呼び出すとは限り
ません - これは単純にオブジェクトの参照カウントを減らすもので、カウント
がゼロになったときに ‘__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(): 456.
to force a collection, but there 'are' pathological cases where objects
will never be collected.

循環参照コレクタがあるとはいえ、オブジェクトに ‘close()’ メソッドを明示
的に定義し、使い終わったらいつでも呼び出せるようにするのはいいことです。
‘close()’ メソッドを使うと、サブオブジェクトを参照している属性を取り除け
ます。 ‘__del__()’ を直接呼び出さないでください - ‘__del__()’ は
‘close()’ を呼び出すでしょうし、 ‘close()’ なら同じオブジェクトに対して
複数回呼ばれてもいいことが保証されているでしょう。

循環参照を避ける他の方法は、 *note weakref: 11d. モジュールを使って、参
照カウントを増やすことなくオブジェクトを示すことです。例えばツリー構造は
、親と (必要なら！) 兄弟に弱参照を使うべきです。

最後に、 ‘__del__()’ メソッドが例外を発生させた場合、警告のメッセージが
*note sys.stderr: d09. に書きこまれます。


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(): 17db. は、オブジェクトが生存している間は一意なこ
とが保証されている整数値を返します。 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: 32e. や
*note str: 1ea. などの定数をチェックするために同一性テストを使わないでく
ださい。

     >>> 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(): 7e4. のように振る舞
     うメソッドを実装する方法を示します:

          _sentinel = sentinel('_sentinel')

          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__(): 306. ではなく
*note __new__(): 987. メソッドを継承します。 前者はインスタンスが生成さ
れた '後' に動くため、イミュータブルなインスタンスのデータを変えるには遅
すぎます。

これらのイミュータブルクラスはすべて、親クラスと異なるシグネチャを持ちま
す:

     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(): 953. と *note functools.lru_cache(): db7. で
す。前者はインスタンスレベル、後者はクラスレベルで結果を保存します。

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:
18e. 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__(): ec4. and *note __hash__():
ec5. 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: 1787. 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:
bb. モジュールと *note compileall: 21. モジュールを使えば可能です。

*note py_compile: bb. モジュールは手動で任意のモジュールをコンパイルでき
ます。やり方の一つは、このモジュールの ‘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: 7a. に *note import_module(): 92c. という便利な関数があ
るので、代わりにそちらを使用することを検討してください。

     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: 32f. 型は 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: 230f.
の章を参照してください。


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__(): 306. メソッドに便利ですし、派生クラスの
メソッドが、基底クラスにある同じ名前のメソッドを拡張するために、基底クラ
スのメソッドをどうにかして呼び出したい時にも便利です。

最後に、インスタンス変数に対する、代入の構文の問題を解決できます。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(): 125e. を文字列のメソッド
としておいた方がはるかに簡単です。これを見ると分かりやすいでしょう

     "1, 2, 4, 8, 16".split(", ")

これは文字列リテラルに対する、与えられたセパレータ (または、デフォルトで
は任意の空白文字の連続) で区切られた部分文字列を返せという指示です。

*note join(): 2821. は、セパレータ文字列に、文字列のシーケンスをイテレー
トして隣り合う要素の間に自身を挿入するように指示しているので、文字列のメ
ソッドです。このメソッドは、独自に定義された新しいクラスを含め、シーケン
スの規則を満たすいかなる引数にも使えます。バイト列やバイト配列にも同様の
メソッドがあります。


File: python.info,  Node: 例外はどれくらい速いのですか？,  Next: Python に switch や case 文がないのはなぜですか？,  Prev: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？,  Up: デザインと歴史 FAQ

10.3.9 例外はどれくらい速いのですか？
-------------------------------------

*note try: adb./*note except: 44e. ブロックは例外が送出されなければ極端
に効率的です。実際に例外を捕捉するのは高価です。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(): f93.
組み込み関数で特定の名前のメソッドを検索できます:

     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: ae8. は、参照カウントを使ってアクセスできない（訳注：参照
されえない）オブジェクトを検出し、そして別の仕組みで参照サイクル（循環参
照）を集めます。サイクル検出アルゴリズムを定期的に実行し、アクセスできな
いサイクルを見つけて一連のオブジェクトを削除します。 *note gc: 63. モジ
ュールは、ガベージコレクションの実行、デバッグ統計の取得、コレクタのパラ
メータ調整を行う関数を提供します。

ただし、他の実装（ 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: 215. 文を使ってください。これでメモリ管理のスキームに関係
なく動きます:

     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('.'): 14bb. はカレントディレクトリ内にあるファイルの文
字列表現のリストを返します。この出力を演算する関数は一般に、ディレクトリ
に一つや二つの別のファイルを加えても壊れません。

Tuples are *note immutable: 18c, meaning that once a tuple has been
created, you can't replace any of its elements with a new value.  Lists
are *note mutable: 1759, meaning that you can always change a list's
elements.  Only *note hashable: 18e. objects can be used as dictionary
keys.  Most immutable types are hashable, which is why tuples, but not
lists, can be used as keys.  Note, however, that a tuple is only
hashable if all of its elements are hashable.


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(): 9e7. ビルトイン関数で計算することで機能します。このハッシ
ュコードはキーやプロセスごとのシードによって大きく変化します。例えば、
‘'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: 7e5. 例外を送出するでしょう。言い換えれば、辞書のキーは
     ‘==’ を使って比較されるべきであり、 *note is: 32c. ではないというこ
     とです。

   - リストをキーとして使うときにコピーを作る。リストはミュータブルなの
     で、自分自身への参照を含むことができ、コードをコピーするときに無限
     ループにハマる可能性があるので、これは駄目です。

   - リストをキーとして使うことを認めるが、ユーザにそれを変更させないよ
     うに伝える。もしユーザが忘れたり、偶然にリストが変更されてしまった
     りしたら、追跡困難なバグの可能性を生じてしまいます。またこれは、
     ‘d.keys()’ のすべての値は辞書のキーとして使えるという、辞書の重要な
     不変性も潰してしまいます。

   - リストが一旦辞書のキーとして使われたら、読み出し専用のマークを付け
     る。問題は、値を変えられるのはトップレベルオブジェクトだけではない
     ことです。リストを含むタプルもキーとして使えます。全てを辞書のキー
     として導入すると、そこから到達可能な全てのオブジェクトに読み出し専
     用のマークを付ける必要があります - そして再び、自己参照オブジェクト
     が無限ループを引き起こします。

必要ならばこれを回避する方法がありますが、自己責任のもとで行ってください
。ミュータブルな構造を、 *note __eq__(): ec4. と *note __hash__(): ec5.
メソッドの両方を持つクラスインスタンスに含めることができます。その時、辞
書 (またはハッシュに基づく別の構造体) に属するような全てのラッパーオブジ
ェクトのハッシュ値が、そのオブジェクトが辞書 (その他の構造体) 中にある間
固定され続けることを確実にしてください。

     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(): f91. はインプレース
にリストをソートします。このことを忘れないため、この関数はソートされたリ
ストを返しません。こうすることで、ソートされたコピーが必要で、ソートされ
ていないものも残しておきたいときに、うっかり上書きしてしまうようなことが
なくなります。

新しいリストを返したいなら、代わりに組み込みの *note sorted(): f90. 関数
を使ってください。この関数は、与えられたイテレート可能オブジェクトから新
しいリストを生成し、ソートして返します。例えば、辞書のキーをソートされた
順序でイテレートする方法は:

     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(): 2fb. と *note issubclass(): 2fc. を使って、インスタンスや
クラスが、ある ABC を実装しているかどうかチェックできます。*note
collections.abc: 1f. モジュールでは、 *note Iterable: 28c2. 、 *note
Container: 28c4. 、 *note MutableMapping: 146a. などの便利な ABC が定義
されています。

Pythonでは、インターフェース仕様の多くの利点は、コンポーネントへの適切な
テスト規律により得られます。

モジュールのための適切なテストスイートは、回帰テストを提供し、モジュール
のインターフェース仕様や用例集としても役立ちます。多くの Python モジュー
ルは、簡単な「自己テスト」を提供するスクリプトとして実行できます。複雑な
外部インターフェースを使うモジュールさえ、外部インターフェースの細かい「
スタブ」エミュレーションで単独にテストできることが多いです。 *note
doctest: 3d. や *note unittest: 10f. モジュール、あるいはサードパーティ
のテストフレームワークで、モジュールのコードの全ての行に及ぶ徹底的なテス
トスイートを構成できます。

Python で大きくて複雑なアプリケーションを構築するとき、インターフェース
仕様と同様に、適切なテスト規律も役立ちます。 実際には、インターフェース
仕様ではテストできないプログラムの属性もあるので、それ以上にもなりえます
。 例えば、 *note list.append(): abf. メソッドは新しい要素をある内部リス
トの終わりに加えます。インターフェース仕様ではこの ‘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: 32a. 文及び *note or: 32d. ・ *note and: 327. ・ ‘if’/*note
else: 328. 式を使います。ループには *note while: 1ba5. 文と *note for:
329. 文を使い、 ループ内に *note continue: 430. ・ *note break: 42f. を
含むことがあります)

関数の呼び出しをまたいでも動作する "構造化された 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: 215. 文があり、ブロックに
入るときとブロックから出るときに、コードを呼び出します。以下のような構造
を持つ言語があります:

     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: 215. ブロッ
クの中で使われるのでしょうか。この通り、Python の動的な特質から、このよ
うな選択はとても難しい物になっています。

しかし、*note with: 215. やそれに類する言語の機能の一番の利点 (コード量
の削減) は、 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: 215. 文で *note contextlib.closing(generator): 3f3. のようにラップ
します。


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 ライブラリリファンレス: 3fe. から関係がありそうな標準ライブラリモ
ジュールがあるかどうか調べてください。 (標準ライブラリに何があるかが分か
るようになると、この段階をスキップすることができます。)

サードパーティのパッケージについては、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: 2e. モジュールは基本的な curses の機能や、色付きの表示、別
の文字集合サポート、パッド、マウスサポートなどの ncurses や SYSV curses
の多くの機能をサポートしています。このことは、モジュールが BSD curses だ
けしか持っていない OS とは互換性が無いことを意味しますが、現在メンテナン
スされている OS でそういう類のものは無さそうです。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/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: 3d.
モジュールは、モジュールの docstring から使用例を見つけてそれらを実行し
、出力を docstring によって与えられた望まれる出力と比較します。

*note unittest: 10f. モジュールは、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: bd. モジュールで 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: f6. モジュー
ルを使ってください。 ‘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(): a91. の良い遅延時間を推測しようとするよりも、セマフ
ォのような仕組みを使う方が良いでしょう。 1 つのアイディアは *note queue:
be. モジュールを使って、キューオブジェクトを作り、各スレッドが完了したと
きにキューにトークンを追加し、メインスレッドにスレッドと同じ数のトークン
をキューから読み出させることです。


File: python.info,  Node: たくさんのワーカースレッドに作業を割り振るにはどうしますか？,  Next: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？,  Prev: スレッドが一つも実行されていないようです。なぜですか？,  Up: スレッド

10.4.3.3 たくさんのワーカースレッドに作業を割り振るにはどうしますか？
.....................................................................

最も簡単な方法は、新しい *note concurrent.futures: 24. モジュール、特に
*note ThreadPoolExecutor: b2c. クラスを使うことです。

もしくは、実行アルゴリズムを上手にコントロールしたい場合は、自身の手でロ
ジックを書くこともできます。 *note queue: be. モジュールを使って、ジョブ
のリストを含むキューを作ってください。 *note Queue: 174d. クラスはオブジ
ェクトのリストを保持し、キューに要素を追加する ‘.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:
174d. クラスは多機能なインターフェースを提供しています。


File: python.info,  Node: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？,  Next: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？,  Prev: たくさんのワーカースレッドに作業を割り振るにはどうしますか？,  Up: スレッド

10.4.3.4 グローバルな値のどんな種類の変更がスレッドセーフになるのですか？
.........................................................................

*note global interpreter lock: 68c. (GIL) が内部で使われ、Python VM で一
度に一つだけのスレッドが実行されることが保証されています。一般に、Python
ではスレッド間の切り替えをバイトコード命令の間でのみ行います。切り替えの
周期は、 *note sys.setswitchinterval(): d1a. で設定できます。したがって
、それぞれのバイトコード命令、そしてそれぞれの命令が届く全ての 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__(): 13ab. メソッドを呼び出すことがあり
、これが影響を及ぼすかもしれません。これは特に、辞書やリストの大規模な更
新に当てはまります。疑わしければ、mutex を使ってください！


File: python.info,  Node: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？,  Prev: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？,  Up: スレッド

10.4.3.5 グローバルインタプリタロック (Global Interpreter Lock) を取り除くことはできないのですか？
..................................................................................................

マルチスレッド Python プログラムは事実上一つの CPU しか使えず、 (ほとん
ど) 全ての Python コードが *note グローバルインタプリタロック: 68c.
(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: 211. クラスが提供しますが、タスクのディスパッチをよ
り深く制御したい場合には *note multiprocessing: 98. モジュールがより低水
準な API を提供しています。

C 拡張をうまく使うことも役立ちます。C 拡張を時間のかかるタスクの実行に使
えば、その拡張は実行が C コードで行われている間 GIL を解放でき、その間に
他のスレッドで作業が進められます。 *note zlib: 13c. や *note hashlib:
6b. など、すでにこれを行なっている標準ライブラリモジュールもあります。

GIL の影響を減らす別のアプローチとして、 GIL を真にグローバルなロックで
はなく、インタープリタごとのロックにするというものがあります。これは
*note Python 3.12 で初めて実装され: 863. 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(): 14b6. は単に、この関数の Unix システ
ムコールの名称です。

ディレクトリを削除するには、*note os.rmdir(): 14b4. を使ってください。作
成には *note os.mkdir(): 734. を使ってください。‘os.makedirs(path)’ は
‘path’ の中間のディレクトリの、存在しないものを作成します。
‘os.removedirs(path)’ は中間のディレクトリが空である限り、それらを削除し
ます。ディレクトリツリー全体とその中身全てを削除したいなら、*note
shutil.rmtree(): 33d. を使ってください。

ファイルの名前を変更するには、‘os.rename(old_path, new_path)’ を使ってく
ださい。

ファイルを切り詰めるには、 ‘f = open(filename, "rb+")’ を使ってファイル
を開き、 ‘f.truncate(offset)’ を使ってください; offset はデフォルトでは
現在のシーク位置です。 *note os.open(): 114f. で開かれたファイル用の
‘os.ftruncate(fd, offset)’ もあります。 'fd' はファイルディスクリプタ (小
さい整数値) です。

*note shutil: cd. モジュールにも、*note copyfile(): e21.、 *note
copytree(): df1.、*note rmtree(): 33d. 等、ファイルに作用する関数がいく
つか含まれます。


File: python.info,  Node: ファイルをコピーするにはどうしますか？,  Next: バイナリデータを読み書きするにはどうしますか？,  Prev: ファイルを削除するにはどうしますか？ その他、ファイルに関する質問,  Up: 入力と出力<2>

10.4.4.2 ファイルをコピーするにはどうしますか？
...............................................

*note shutil: cd. モジュールに *note copyfile(): e21. 関数があります。注
意点として、これは Windows NTFS ボリューム上の alternate data streams(1)
も macOS HFS+ 上の resource forks(2) もコピーしません。ただし現在ではど
ちらも使われることは ほとんどありません。またファイルのパーミッションや
メタデータもコピーされませんが、この代わりに *note shutil.copy2(): e23.
を使うとそのほとんど (すべてではありませんが) が保持されます。

   ---------- 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: de. モジュールを使
うのが一番です。これでバイナリデータ (通常は数) を含む文字列を取って、
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(): 333. に渡して) ファイルをバイナリモードで開く義務があ
     ります。代わりに (デフォルトの) ‘"r"’ を使った場合は、ファイルはテ
     キストモードで開かれ、 ‘f.read()’ は *note bytes: 1d2. オブジェクト
     ではなく *note str: 1ea. オブジェクトを返します。


File: python.info,  Node: os popen によって作られたパイプで os read が使われていないようです。なぜですか？,  Next: シリアル RS232 ポートにアクセスするにはどうしますか？,  Prev: バイナリデータを読み書きするにはどうしますか？,  Up: 入力と出力<2>

10.4.4.4 os.popen() によって作られたパイプで os.read() が使われていないようです。なぜですか？
.............................................................................................

*note os.read(): 1152. は、開かれたファイルを表す小さな整数、ファイルデ
ィスクリプタを引数に取る、低レベルの関数です。 *note os.popen(): 58c. は
、組み込みの *note open(): 333. 関数の返り値と同じ型の、高レベルなファイ
ルオブジェクトを作成します。従って、 ‘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: 1581. は、低水準の C ファイルディスクリプタ
上の、抽象の高水準レイヤです。

組み込みの *note open(): 333. 関数によって生成されたほとんどのファイルオ
ブジェクトでは、 ‘f.close()’ は Python ファイルオブジェクトが Python の
視点からは閉じられているものとする印をつけ、その下にある C ファイルディ
スクリプタを閉じるように手配します。これは、 ‘f’ がガベージとなったとき
にも、 ‘f’ のデストラクタで自動的に起こります。

しかし、stdin、stdout、stderr は C で特別な立場が与えられていることから
、Python でも同様に特別に扱われます。‘sys.stdout.close()’ を実行すると、
Python レベルのファイルオブジェクトには閉じられているものとする印がつけ
られますが、C ファイルディスクリプタは '閉じられません'。

下にある C ファイルディスクリプタのうち、この三つのどれかを閉じるには、
まず本当に閉じる必要があることを確かめるべきです (例えば、拡張モジュール
の I/O を混乱させてしまうかもしれません)。本当に必要ならば、 *note
os.close(): f35. を使ってください:

     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
インターネットプロトコルとサポート: 4119. と *note
インターネット上のデータの操作: 3d11. という章を参照してください。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: d2. を使ってください。

以下に示すのが、これを使ったごく単純な対話型のメール送信器です。このメソ
ッドは 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: c9. モジュールがソケットの非同期の I/O を扱うのに使わ
れます。

TCP 接続がブロッキングされないようにするために、ソケットをノンブロッキン
グモードに設定することが出来ます。そして *note connect(): 1160. したとき
に、即座に接続できるか、エラー番号を ‘.errno’ として含む例外を受け取るか
のどちらかになります。‘errno.EINPROGRESS’ は、接続が進行中であるが、まだ
完了していないということを示します。異なる OS では異なる値が返されるので
、あなたのシステムで何が返されるかを確かめておく必要があります。

*note connect_ex(): 18f2. メソッドを使えば例外を生成しなくて済みます。こ
れは単に errno の値を返すでしょう。ポーリングのためには、後でまた
‘connect_ex()’ を呼び出すことができます - ‘0’ または ‘errno.EISCONN’ は
接続されたことを表します - または、このソケットを *note select.select():
115d. に渡して書き込み可能か調べることができます。

     注釈: *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: 37. や *note GDBM: 36. などの、ディスク
ベースのハッシュへのインターフェースも含まれています。また、 *note
sqlite3: d7. モジュールは、軽量なディスクベースの関係データベースを提供
します。

ほとんどの関係データベースがサポートされています。詳細は
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: cb. ライブラリモジュールは 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: c0. が乱数生成器を実装しています。使い方
は単純です:

     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
インタプリタの拡張と埋め込み: 21c9. で説明されています。

ほとんどの中級から上級の 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: 51a7. 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(): 5230. で、一つの
文字列引数を取り、モジュール ‘__main__’ のコンテキストでそれを実行し、成
功なら ‘0’、例外 (*note SyntaxError: 189. を含む) が発生したら ‘-1’ を返
します。更に制御したければ、 *note PyRun_String(): 1fcf. を使ってくださ
い。ソースは ‘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(): 1fcf. を、スタートシンボル *note
Py_eval_input: 5519. を渡して呼び出してください。これは式を解析し、評価
してその値を返します。


File: python.info,  Node: Python オブジェクトから C の値を取り出すにはどうしますか？,  Next: Py_BuildValue で任意長のタプルを作るにはどうしますか？,  Prev: C から任意の Python 式を評価するにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.6 Python オブジェクトから C の値を取り出すにはどうしますか？
-----------------------------------------------------------------

オブジェクトの型に依ります。タプルなら、 *note PyTuple_Size(): 5425. が
長さを返し、 *note PyTuple_GetItem(): 51dd. が指定されたインデックスの要
素を返します。リストにも同様の関数 *note PyList_Size(): 17d2. と *note
PyList_GetItem(): 7fb. があります。

bytes では、 *note PyBytes_Size(): 52bb. がその長さを返し、 *note
PyBytes_AsStringAndSize(): 52b3. がその値へのポインタと長さを提供します
。 Python の bytes オブジェクトは null を含むこともできるので、 C の
‘strlen()’ を使うべきではないことに注意してください。

オブジェクトの型を検査するには、まず最初にそれが ‘NULL’ でないことを確か
めた上で、 *note PyBytes_Check(): 1758. 、 *note PyTuple_Check(): 56fd.
、 *note PyList_Check(): 570e. などを使います。

いわゆる 'abstract' インターフェースから提供される、 Python オブジェクト
に対する高レベル API もあります - より詳しいことは ‘Include/abstract.h’
を読んでください。これを使うと、数値型プロトコル (*note
PyNumber_Index(): c6d. など) や PyMapping API のマップ型プロトコルなどの
役に立つプロトコルに加え、 *note PySequence_Length(): 53ee. や *note
PySequence_GetItem(): 2040. などの任意の種類の Python シーケンスへのイン
ターフェースにアクセスできます。


File: python.info,  Node: Py_BuildValue で任意長のタプルを作るにはどうしますか？,  Next: C からオブジェクトのメソッドを呼び出すにはどうしますか？,  Prev: Python オブジェクトから C の値を取り出すにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.7 Py_BuildValue() で任意長のタプルを作るにはどうしますか？
---------------------------------------------------------------

できません。代わりに *note PyTuple_Pack(): 5424. を使ってください。


File: python.info,  Node: C からオブジェクトのメソッドを呼び出すにはどうしますか？,  Next: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？,  Prev: Py_BuildValue で任意長のタプルを作るにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.8 C からオブジェクトのメソッドを呼び出すにはどうしますか？
---------------------------------------------------------------

*note PyObject_CallMethod(): 3be. 関数でオブジェクトの任意のメソッドを呼
び出せます。パラメタは、オブジェクト、呼び出すメソッドの名前、 *note
Py_BuildValue(): 5f5. で使われるようなフォーマット文字列、そして引数です
:

     PyObject *
     PyObject_CallMethod(PyObject *object, const char *method_name,
                         const char *arg_format, ...);

これはメソッドを持ついかなるオブジェクトにも有効で、組み込みかユーザ定義
かは関係ありません。返り値に対して *note Py_DECREF(): 97a. する必要があ
ることもあります。

例えば、あるファイルオブジェクトの "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(): 51d1. の引数リストには '常に' タプル
が必要です。関数を引数なしで呼び出すには、フォーマットに "()" を渡し、関
数を一つの引数で呼び出すには、関数を括弧でくくって例えば "(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: ea0. と *note
sys.stderr: d09. に代入してください。print_error を呼び出すか、単に標準
のトレースバック機構を作動させてください。そうすれば、出力は ‘write()’ が
送る任意の所に行きます。

最も簡単な方法は、 *note io.StringIO: 12d8. クラスを使うことです:

     >>> 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: 19da. に現れていない) なら、これはモジュールを初期化します
。そうでなければ、単純に ‘sys.modules["<modulename>"]’ の値を返します。
なお、これはモジュールをいかなる名前空間にも代入しません。これはモジュー
ルが初期化されて '‘sys.modules’ に保管されていることを保証するだけです。

これで、モジュールの属性 (つまり、モジュールで定義された任意の名前) に以
下のようにアクセスできるようになります:

     attr = PyObject_GetAttrString(module, "<attrname>");

*note PyObject_SetAttrString(): 1a8c. を呼んでモジュールの変数に代入する
こともできます。


File: python.info,  Node: Python から C++ へインターフェースするにはどうしますか？,  Next: セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？,  Prev: C から Python で書かれたモジュールにアクセスするにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.11 Python から C++ へインターフェースするにはどうしますか？
----------------------------------------------------------------

やりたいことに応じて、いろいろな方法があります。手動でやるなら、 *note
"拡張と埋め込み" ドキュメント: 21c9. を読むことから始めてください。なお
、Python ランタイムシステムにとっては、 C と C++ はあまり変わりません。
だから、C 構造体 (ポインタ)型に基づいて新しい Python の型を構築する方針
は C++ オブジェクトに対しても有効です。

C++ ライブラリに関しては、 *note C
を書くのは大変です。他の方法はありませんか？: 5d0e. を参照してください。


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(): 5521. を
(おそらく別のスレッドで) 呼び出し、Python インタプリタにあなたの入力を扱
わせることです。独自の入力関数を指定するのに *note
PyOS_ReadlineFunctionPointer(): 98c. を設定することもできます。詳しいヒ
ントは、 ‘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: 32e. 、 *note list: 4e0. 、 *note dict: 193. などのビ
ルトインクラスから継承できます。

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(): 27ff. 関数
を呼び出すか、 ‘Ctrl’ キーを押しながら ‘Z’ を入力し "‘Enter’" キーを押し
て、 Windows コマンドプロンプトに戻ってください。

スタート ‣ すべてのプログラム ‣ Python 3.x ‣ Python (command line) のよ
うな項目がスタートメニューに見付かるかもしれません。 これを起動すると、
新しいウィンドウに ‘>>>’ というプロンプトが見られるでしょう。その場合、
*note exit(): 27ff. 関数を呼び出すか ‘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
スクリプトからスタンドアロンバイナリを作れますか？: 5c7a. を参照してくだ
さい。


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: 18ef. または *note TabError: 955. を送出し
ます。 *note tabnanny: e6. モジュールを実行することで、ディレクトリーツ
リーをバッチモードでチェックすることができます。

   ---------- 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: 4540. という 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 ファイルハンドラ: 455d. を参照してください。


File: python.info,  Node: Tkinter で働くキーバインディングが得られません。なぜですか？,  Prev: I/O を待つ間に扱われる Tk イベントを作れますか？,  Up: Tkinter の質問

10.7.3.3 Tkinter で働くキーバインディングが得られません。なぜですか？
.....................................................................

‘bind()’ メソッドでイベントに *note 結び付けられた: 4558. イベントハンド
ラが、適切なキーが押されたときにさえハンドルされないという苦情がよく聞か
れます。

最も一般的な原因は、バインディングが適用されるウィジェットが "キーボード
フォーカス" を持たないことです。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<8>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<5>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<6>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<5>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<5>.
* Pending removal in Python 3.21: Pending removal in Python 3 21.
* Pending removal in future versions: Pending removal in future versions<8>.
* Soft deprecations: Soft deprecations<2>.
* C API deprecations::


File: python.info,  Node: Pending removal in Python 3 15<7>,  Next: Pending removal in Python 3 16<8>,  Up: 非推奨<14>

11.1 Pending removal in Python 3.15
===================================

   * The import system:

        * Setting ‘__cached__’ on a module while failing to set *note
          __spec__.cached: 592. 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__: 593. on a module while failing to
          set *note __spec__.parent: 594. 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: 2d.:

        * The undocumented ‘ctypes.SetPointerType()’ function has been
          deprecated since Python 3.13.

   * *note http.server: 75.:

        * The obsolete and rarely used ‘CGIHTTPRequestHandler’ 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: 7a.:

        * ‘load_module()’ method: use ‘exec_module()’ instead.

   * *note pathlib: a8.:

        * ‘.PurePath.is_reserved()’ has been deprecated since Python
          3.13.  Use *note os.path.isreserved(): 2e5. to detect reserved
          paths on Windows.

   * *note platform: af.:

        * ‘platform.java_ver()’ 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: e4.:

        * The 'check_home' argument of *note
          sysconfig.is_python_build(): 2e9. has been deprecated since
          Python 3.12.

   * *note threading: f6.:

        * *note RLock(): 2eb. 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: 10c.:

        * *note types.CodeType: 2ed.: Accessing ‘codeobject.co_lnotab’
          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: 2d4. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(4).)

   * *note typing: 10d.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 2f0. 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: 29b.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 ‘typing.no_type_check_decorator()’ decorator function has
          been deprecated since Python 3.13.  After eight years in the
          *note typing: 10d. module, it has yet to be supported by any
          major type checker.

   * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.

   * *note wave: 11c.:

        * The ‘getmark()’, ‘setmark()’ and ‘getmarkers()’ methods of the
          *note Wave_read: 2f2. and *note Wave_write: 2f3. classes have
          been deprecated since Python 3.13.

   * *note zipimport: 13b.:

        * ‘zipimport.zipimporter.load_module()’ has been deprecated
          since Python 3.10.  Use *note exec_module(): 2f5. instead.
          (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<8>,  Next: Pending removal in Python 3 17<5>,  Prev: Pending removal in Python 3 15<7>,  Up: 非推奨<14>

11.2 Pending removal in Python 3.16
===================================

   * The import system:

        * Setting *note __loader__: 30b. on a module while failing to
          set *note __spec__.loader: 30c. 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: 30d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 154. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 314. or *note
          asyncio.Runner: 315. 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: 62.:

        * Calling the Python implementation of *note functools.reduce():
          156. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8a.:

        * 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(): 159.  Undotted extensions are
          deprecated and will raise a *note ValueError: 15a. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: cd.:

        * 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: 317.

   * *note symtable: e1.:

        * The ‘symtable.Class.get_methods()’ method has been deprecated
          since Python 3.14.

   * *note sys: e2.:

        * The ‘_enablelegacywindowsfsencoding()’ function has been
          deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 15e. environment variable
          instead.

   * *note sysconfig: e4.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 160. instead.

   * *note tarfile: e7.:

        * The undocumented and unused ‘TarInfo.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<5>,  Next: Pending removal in Python 3 18<6>,  Prev: Pending removal in Python 3 16<8>,  Up: 非推奨<14>

11.3 Pending removal in Python 3.17
===================================

   * *note datetime: 33.:

        * *note strptime(): 2dd. calls using a format string containing
          ‘%e’ (day of month) without a year.  This has been deprecated
          since Python 3.15.  (Contributed by Stan Ulbrych in
          gh-70647(1).)

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 2d6. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(2) for more details.  (Contributed by Shantanu
          Jain in gh-91896(3).)

   * *note encodings: 54.:

        - Passing non-ascii 'encoding' names to *note
          encodings.normalize_encoding(): 31b. is deprecated and
          scheduled for removal in Python 3.17.  (Contributed by Stan
          Ulbrych in gh-136702(4).)

   * *note webbrowser: 11e.:

        - ‘webbrowser.MacOSXOSAScript’ is deprecated in favour of
          ‘webbrowser.MacOS’.  (gh-137586(5))

   * *note typing: 10d.:

        - 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(): 31c. and *note
          typing.get_args(): 31d. instead of relying on private
          implementation details.

        - *note typing.ByteString: 2ef, 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: 319. at runtime.  For
          use in type annotations, either use *note Buffer: 31a. 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: 1d2. and
          *note bytearray: 1d1.  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:
          1dd. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(6) for more details.  (Contributed by Shantanu
          Jain in gh-91896(7).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/70647

   (2) https://peps.python.org/pep-0688/#current-options

   (3) https://github.com/python/cpython/issues/91896

   (4) https://github.com/python/cpython/issues/136702

   (5) https://github.com/python/cpython/issues/137586

   (6) https://peps.python.org/pep-0688/#current-options

   (7) https://github.com/python/cpython/issues/91896


File: python.info,  Node: Pending removal in Python 3 18<6>,  Next: Pending removal in Python 3 19<5>,  Prev: Pending removal in Python 3 17<5>,  Up: 非推奨<14>

11.4 Pending removal in Python 3.18
===================================

   * No longer accept a boolean value when a file descriptor is
     expected.  (Contributed by Serhiy Storchaka in gh-82626(1).)

   * *note decimal: 39.:

        * The non-standard and undocumented *note Decimal: 1cd. 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(2).)

   * Deprecations defined by PEP 829(3):

        * ‘import’ lines in ‘`name'.pth’ files are silently ignored.

     (Contributed by Barry Warsaw in gh-148641(4).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/82626

   (2) https://github.com/python/cpython/issues/89902

   (3) https://peps.python.org/pep-0829/

   (4) https://github.com/python/cpython/issues/148641


File: python.info,  Node: Pending removal in Python 3 19<5>,  Next: Pending removal in Python 3 20<5>,  Prev: Pending removal in Python 3 18<6>,  Up: 非推奨<14>

11.5 Pending removal in Python 3.19
===================================

   * *note ctypes: 2d.:

        * Implicitly switching to the MSVC-compatible struct layout by
          setting *note _pack_: 320. but not *note _layout_: 321. on
          non-Windows platforms.

   * *note hashlib: 6b.:

        - In hash function constructors such as *note new(): 2fd. or the
          direct hash-named constructors such as *note md5(): 2fe. and
          *note sha256(): 2ff, their optional initial data parameter
          could also be passed a keyword argument named ‘data=’ or
          ‘string=’ in various ‘hashlib’ implementations.

          Support for the ‘string’ keyword argument name is now
          deprecated and slated for removal in Python 3.19.

          Before Python 3.13, the ‘string’ keyword parameter was not
          correctly supported depending on the backend implementation of
          hash functions.  Prefer passing the initial data as a
          positional argument for maximum backwards compatibility.

   * *note http.cookies: 74.:

        * *note http.cookies.Morsel.js_output(): 300. is deprecated and
          will be removed in Python 3.19.

        * *note http.cookies.BaseCookie.js_output(): 301. is deprecated
          and will be removed in Python 3.19.

   * *note imaplib: 77.:

        * Altering *note IMAP4.file: 304. is now deprecated and slated
          for removal in Python 3.19.  This property is now unused and
          changing its value does not automatically close the current
          file.

          Before Python 3.14, this property was used to implement the
          corresponding ‘read()’ and ‘readline()’ methods for *note
          IMAP4: 322. but this is no longer the case since then.


File: python.info,  Node: Pending removal in Python 3 20<5>,  Next: Pending removal in Python 3 21,  Prev: Pending removal in Python 3 19<5>,  Up: 非推奨<14>

11.6 Pending removal in Python 3.20
===================================

   * Calling the ‘__new__()’ method of *note struct.Struct: 307. without
     the 'format' argument is deprecated and will be removed in Python
     3.20.  Calling *note __init__(): 306. method on initialized
     ‘Struct’ objects is deprecated and will be removed in Python 3.20.

     (Contributed by Sergey B Kirpichev and Serhiy Storchaka in
     gh-143715(1).)

   * The ‘__version__’, ‘version’ and ‘VERSION’ attributes have been
     deprecated in these standard library modules and will be removed in
     Python 3.20.  Use *note sys.version_info: 308. instead.

        - *note argparse: 7.

        - *note csv: 2c.

        - *note ctypes: 2d.

        - ‘ctypes.macholib’

        - *note decimal: 39. (use *note decimal.SPEC_VERSION: 309.
          instead)

        - *note http.server: 75.

        - *note imaplib: 77.

        - *note ipaddress: 83.

        - *note json: 85.

        - *note logging: 8a. (‘__date__’ also deprecated)

        - *note optparse: a4.

        - *note pickle: ab.

        - *note platform: af.

        - *note re: c1.

        - *note socketserver: d5.

        - *note tabnanny: e6.

        - *note tarfile: e7.

        - *note tkinter.font: fe.

        - *note tkinter.ttk: 102.

        - *note wsgiref.simple_server: 124.

        - *note xml.etree.ElementTree: 12e.

        - ‘xml.sax.expatreader’

        - *note xml.sax.handler: 133.

        - *note zlib: 13c.

     (Contributed by Hugo van Kemenade and Stan Ulbrych in gh-76007(2).)

   * Deprecations defined by PEP 829(3):

        * Warnings are produced for ‘import’ lines found in ‘`name'.pth’
          files.

        * ‘`name'.pth’ files are no longer decoded in the locale
          encoding by default.  They 'MUST' be encoded in ‘utf-8-sig’.

     (Contributed by Barry Warsaw in gh-148641(4).)

   * *note ast: 9.:

        * Creating instances of abstract AST nodes (such as *note
          ast.AST: 2f8. or ‘ast.expr’) is deprecated and will raise an
          error in Python 3.20.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/143715

   (2) https://github.com/python/cpython/issues/76007

   (3) https://peps.python.org/pep-0829/

   (4) https://github.com/python/cpython/issues/148641


File: python.info,  Node: Pending removal in Python 3 21,  Next: Pending removal in future versions<8>,  Prev: Pending removal in Python 3 20<5>,  Up: 非推奨<14>

11.7 Pending removal in Python 3.21
===================================

   * *note ast: 9.:

        * Classes ‘slice’, ‘Index’, ‘ExtSlice’, ‘Suite’, ‘Param’,
          ‘AugLoad’ and ‘AugStore’, will be removed in Python 3.21.
          These types are not generated by the parser or accepted by the
          code generator.

        * The ‘dims’ property of ‘ast.Tuple’ will be removed in Python
          3.21.  Use the ‘ast.Tuple.elts’ property instead.


File: python.info,  Node: Pending removal in future versions<8>,  Next: Soft deprecations<2>,  Prev: Pending removal in Python 3 21,  Up: 非推奨<14>

11.8 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(): 325. is now deprecated.

        * The *note argparse.FileType: 326. 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:
          327, *note else: 328, *note for: 329, *note if: 32a, *note in:
          32b, *note is: 32c. and *note or: 32d.  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: 32e.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 32f.: these methods will be required to return
          an instance of ‘float’.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 330.: 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(): 330. 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:
     331. and *note calendar.FEBRUARY: 332.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 333. instead of *note
     codecs.open(): 334.  (gh-133038(4))

   * ‘codeobject.co_lnotab’: use the *note codeobject.co_lines(): 335.
     method instead.

   * *note datetime: 33.:

        * *note utcnow(): 336.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 337.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 66.: Plural value must be an integer.

   * *note importlib: 7a.:

        * *note cache_from_source(): 338. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7d.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8a.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 339. instead.

   * *note mailbox: 8e.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 33a. in a
     multi-threaded process.

   * *note os.path: a6.: *note os.path.commonprefix(): 33b. is
     deprecated, use *note os.path.commonpath(): 33c. for path prefixes.
     The ‘os.path.commonprefix()’ function is being deprecated due to
     having a misleading name and module.  The function is not safe to
     use for path prefixes despite being included in a module about path
     manipulation, meaning it is easy to accidentally introduce path
     traversal vulnerabilities into Python programs by using this
     function.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: c1.: 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).)

   * *note shutil: cd.: *note rmtree(): 33d.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d8. options and protocols:

        * *note ssl.SSLContext: 33e. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 33e.: *note set_npn_protocols(): 33f.
          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: f6. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          340.

        * ‘threading.Event.isSet()’: use *note is_set(): 341.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 342.: use *note
          threading.Thread.daemon: 343. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 344.: use *note
          threading.Thread.name: 345. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 346.

        * ‘threading.activeCount()’: use *note threading.active_count():
          347.

   * *note typing.Text: 348. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 349.  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: 34a.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 113. deprecated functions: *note urlparse():
     2af. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 121.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12e.: Testing the truth value of an
     *note Element: 34b. 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(): 34c. is deprecated: use *note
     sys._clear_internal_caches(): 34d. 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: Soft deprecations<2>,  Next: C API deprecations,  Prev: Pending removal in future versions<8>,  Up: 非推奨<14>

11.9 Soft deprecations
======================

There are no plans to remove *note soft deprecated: 1b2. APIs.

   * *note re.match(): 258. and *note re.Pattern.match(): 259. are now
     *note soft deprecated: 1b2. in favor of the new *note
     re.prefixmatch(): 256. and *note re.Pattern.prefixmatch(): 257.
     APIs, which have been added as alternate, more explicit names.
     These are intended to be used to alleviate confusion around what
     'match' means by following the Zen of Python's '"Explicit is better
     than implicit"' mantra.  Most other language regular expression
     libraries use an API named 'match' to mean what Python has always
     called 'search'.

     We 'do not' plan to remove the older ‘match()’ name, as it has been
     used in code for over 30 years.  Code supporting older versions of
     Python should continue to use ‘match()’, while new code should
     prefer ‘prefixmatch()’.  See *note prefixmatch() vs.  match(): 305.

     (Contributed by Gregory P. Smith in gh-86519(1) and Hugo van
     Kemenade in gh-148100(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/86519

   (2) https://github.com/python/cpython/issues/148100


File: python.info,  Node: C API deprecations,  Prev: Soft deprecations<2>,  Up: 非推奨<14>

11.10 C API deprecations
========================

* Menu:

* Pending removal in Python 3.15: Pending removal in Python 3 15<8>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<9>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<7>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<6>.
* Pending removal in Python 3.20: Pending removal in Python 3 20<6>.
* Pending removal in future versions: Pending removal in future versions<9>.


File: python.info,  Node: Pending removal in Python 3 15<8>,  Next: Pending removal in Python 3 16<9>,  Up: C API deprecations

11.10.1 Pending removal in Python 3.15
--------------------------------------

   * The ‘PyImport_ImportModuleNoBlock()’: Use *note
     PyImport_ImportModule(): 3ab. instead.

   * ‘PyWeakref_GetObject()’ and ‘PyWeakref_GET_OBJECT()’: Use *note
     PyWeakref_GetRef(): 3ac. instead.  The pythoncapi-compat project(1)
     can be used to get ‘PyWeakref_GetRef()’ on Python 3.12 and older.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3a9.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3a9.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 1ea, such as *note bytes: 1d2.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3aa.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3aa.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 1d2, such as *note str: 1ea.

   * Python initialization functions, deprecated in Python 3.13:

        * ‘Py_GetPath()’: Use *note PyConfig_Get("module_search_paths"):
          3ae. (*note sys.path: 19f.) instead.

        * ‘Py_GetPrefix()’: Use *note PyConfig_Get("base_prefix"): 3ae.
          (*note sys.base_prefix: 3b2.) instead.  Use
          ‘PyConfig_Get("prefix")’ (*note sys.prefix: 3b3.) if *note
          virtual environments: 3b1. need to be handled.

        * ‘Py_GetExecPrefix()’: Use *note
          PyConfig_Get("base_exec_prefix"): 3ae. (*note
          sys.base_exec_prefix: 3af.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3b0.) if
          *note virtual environments: 3b1. need to be handled.

        * ‘Py_GetProgramFullPath()’: Use *note
          PyConfig_Get("executable"): 3ae. (*note sys.executable: 3b4.)
          instead.

        * ‘Py_GetProgramName()’: Use *note PyConfig_Get("executable"):
          3ae. (*note sys.executable: 3b4.) instead.

        * ‘Py_GetPythonHome()’: Use *note PyConfig_Get("home"): 3ae. or
          the *note PYTHONHOME: 3b5. environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 3ae. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 60e. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 60e. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 60f.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 610. instead.

        * ‘PySys_ResetWarnOptions()’: Clear *note sys.warnoptions: 3ad.
          and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 613.: Use *note PyConfig.parser_debug:
          614. or *note PyConfig_Get("parser_debug"): 3ae. instead.

        * *note Py_VerboseFlag: 615.: Use *note PyConfig.verbose: 616.
          or *note PyConfig_Get("verbose"): 3ae. instead.

        * *note Py_QuietFlag: 617.: Use *note PyConfig.quiet: 618. or
          *note PyConfig_Get("quiet"): 3ae. instead.

        * *note Py_InteractiveFlag: 619.: Use *note
          PyConfig.interactive: 61a. or *note
          PyConfig_Get("interactive"): 3ae. instead.

        * *note Py_InspectFlag: 61b.: Use *note PyConfig.inspect: 61c.
          or *note PyConfig_Get("inspect"): 3ae. instead.

        * *note Py_OptimizeFlag: 61d.: Use *note
          PyConfig.optimization_level: 61e. or *note
          PyConfig_Get("optimization_level"): 3ae. instead.

        * *note Py_NoSiteFlag: 61f.: Use *note PyConfig.site_import:
          620. or *note PyConfig_Get("site_import"): 3ae. instead.

        * *note Py_BytesWarningFlag: 621.: Use *note
          PyConfig.bytes_warning: 3cc. or *note
          PyConfig_Get("bytes_warning"): 3ae. instead.

        * *note Py_FrozenFlag: 622.: Use *note
          PyConfig.pathconfig_warnings: 623. or *note
          PyConfig_Get("pathconfig_warnings"): 3ae. instead.

        * *note Py_IgnoreEnvironmentFlag: 624.: Use *note
          PyConfig.use_environment: 625. or *note
          PyConfig_Get("use_environment"): 3ae. instead.

        * *note Py_DontWriteBytecodeFlag: 626.: Use *note
          PyConfig.write_bytecode: 627. or *note
          PyConfig_Get("write_bytecode"): 3ae. instead.

        * *note Py_NoUserSiteDirectory: 628.: Use *note
          PyConfig.user_site_directory: 629. or *note
          PyConfig_Get("user_site_directory"): 3ae. instead.

        * *note Py_UnbufferedStdioFlag: 62a.: Use *note
          PyConfig.buffered_stdio: 62b. or *note
          PyConfig_Get("buffered_stdio"): 3ae. instead.

        * *note Py_HashRandomizationFlag: 62c.: Use *note
          PyConfig.use_hash_seed: 62d. and *note PyConfig.hash_seed:
          62e. or *note PyConfig_Get("hash_seed"): 3ae. instead.

        * *note Py_IsolatedFlag: 62f.: Use *note PyConfig.isolated: 630.
          or *note PyConfig_Get("isolated"): 3ae. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 631.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 632. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 3ae. instead.

        * *note Py_LegacyWindowsStdioFlag: 633.: Use *note
          PyConfig.legacy_windows_stdio: 634. or *note
          PyConfig_Get("legacy_windows_stdio"): 3ae. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 635. or *note
          PyConfig_Get("filesystem_encoding"): 3ae. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 636. or *note
          PyConfig_Get("filesystem_errors"): 3ae. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 637. or *note
          PyConfig_Get("utf8_mode"): 3ae. instead.  (see *note
          Py_PreInitialize(): 638.)

     The *note Py_InitializeFromConfig(): 611. API should be used with
     *note PyConfig: 612. to set these options.  Or *note
     PyConfig_Get(): 3ae. 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<9>,  Next: Pending removal in Python 3 18<7>,  Prev: Pending removal in Python 3 15<8>,  Up: C API deprecations

11.10.2 Pending removal in Python 3.16
--------------------------------------

   * The bundled copy of ‘libmpdec’.


File: python.info,  Node: Pending removal in Python 3 18<7>,  Next: Pending removal in Python 3 19<6>,  Prev: Pending removal in Python 3 16<9>,  Up: C API deprecations

11.10.3 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(): 5b7.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 63b.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 63c.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 5ce.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 5de.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 63d.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 63e.

        * ‘_PyUnicodeWriter_Init()’: replace
          ‘_PyUnicodeWriter_Init(&writer)’ with *note writer =
          PyUnicodeWriter_Create(0): 5e8.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 5eb.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 5ea.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 5ee.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 5f0.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 5f1.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteASCII(writer, str): 5ed.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 5f3.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement).

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement).

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 63f.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 5c7.

     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 Python 3 19<6>,  Next: Pending removal in Python 3 20<6>,  Prev: Pending removal in Python 3 18<7>,  Up: C API deprecations

11.10.4 Pending removal in Python 3.19
--------------------------------------

   * PEP 456(1) embedders support for the string hashing scheme
     definition.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0456/


File: python.info,  Node: Pending removal in Python 3 20<6>,  Next: Pending removal in future versions<9>,  Prev: Pending removal in Python 3 19<6>,  Up: C API deprecations

11.10.5 Pending removal in Python 3.20
--------------------------------------

   * ‘_PyObject_CallMethodId()’, ‘_PyObject_GetAttrId()’ and
     ‘_PyUnicode_FromId()’ are deprecated since 3.15 and will be removed
     in 3.20.  Instead, use *note PyUnicode_InternFromString(): 3bd. and
     cache the result in the module state, then call *note
     PyObject_CallMethod(): 3be. or *note PyObject_GetAttr(): 3bf.
     (Contributed by Victor Stinner in gh-141049(1).)

   * The ‘cval’ field in *note PyComplexObject: 3c1. (gh-128813(2)).
     Use *note PyComplex_AsCComplex(): 3c2. and *note
     PyComplex_FromCComplex(): 3c3. to convert a Python complex number
     to/from the C *note Py_complex: 3c4. representation.

   * Macros ‘Py_MATH_PIl’ and ‘Py_MATH_El’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141049

   (2) https://github.com/python/cpython/issues/128813


File: python.info,  Node: Pending removal in future versions<9>,  Prev: Pending removal in Python 3 20<6>,  Up: C API deprecations

11.10.6 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: 641.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 642.: Use *note PyErr_GetRaisedException():
     643. instead.

   * *note PyErr_NormalizeException(): 644.: Use *note
     PyErr_GetRaisedException(): 643. instead.

   * *note PyErr_Restore(): 645.: Use *note PyErr_SetRaisedException():
     646. instead.

   * *note PyModule_GetFilename(): 647.: Use *note
     PyModule_GetFilenameObject(): 648. instead.

   * *note PyOS_AfterFork(): 649.: Use *note PyOS_AfterFork_Child():
     64a. instead.

   * *note PySlice_GetIndicesEx(): 64b.: Use *note PySlice_Unpack():
     64c. and *note PySlice_AdjustIndices(): 64d. instead.

   * *note PyUnicode_READY(): 64e.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 64f.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 650.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 651.: Use *note
          PyThread_tss_alloc(): 652. instead.

        * *note PyThread_delete_key(): 653.: Use *note
          PyThread_tss_free(): 654. instead.

        * *note PyThread_set_key_value(): 655.: Use *note
          PyThread_tss_set(): 656. instead.

        * *note PyThread_get_key_value(): 657.: Use *note
          PyThread_tss_get(): 658. instead.

        * *note PyThread_delete_key_value(): 659.: Use *note
          PyThread_tss_delete(): 65a. instead.

        * *note PyThread_ReInitTLS(): 65b.: Unneeded since Python 3.7.


File: python.info,  Node: 用語集<2>,  Next: このドキュメントについて,  Prev: 非推奨<14>,  Up: Top

12 用語集
*********

‘>>>’

     *note 対話型: 458. シェルにおけるデフォルトの Python プロンプトです
     。インタープリターで対話的に実行されるコード例でよく見られます。

‘...’

     次のものが考えられます:

        * 対話型 (*note interactive: 458.) シェルにおいて、インデントさ
          れたコードブロック、対応する左右の区切り文字の組 (丸括弧、角括
          弧、波括弧、三重引用符) の内側、デコレーターの後に、コードを入
          力する際に表示されるデフォルトの Python プロンプトです。

        * The three dots form of the *note Ellipsis: 2208. object.

abstract base class

     (抽象基底クラス) 抽象基底クラスは *note duck-typing: 5d51. を補完す
     るもので、 *note hasattr(): 8e7. などの別のテクニックでは不恰好であ
     ったり微妙に誤る (例えば *note magic methods: 25c5. の場合) 場合に
     インターフェースを定義する方法を提供します。ABC は仮想 (virtual) サ
     ブクラスを導入します。これは親クラスから継承しませんが、それでも
     *note isinstance(): 2fb. や *note issubclass(): 2fc. に認識されます
     ; *note abc: 4. モジュールのドキュメントを参照してください。Python
     には、多くの組み込み ABC が同梱されています。その対象は、(*note
     collections.abc: 1f. モジュールで) データ構造、(*note numbers: a2.
     モジュールで) 数、(*note io: 82. モジュールで) ストリーム、(*note
     importlib.abc: 7b. モジュールで) インポートファインダ及びローダーで
     す。 ‘abc’ モジュールを利用して独自の ABC を作成できます。

annotate function

     A callable that can be called to retrieve the *note annotations:
     410. of an object.  Annotate functions are usually *note functions:
     26cd, automatically generated as the *note __annotate__: 1bb4.
     attribute of functions, classes, and modules.  Annotate functions
     are a subset of *note evaluate functions: 474d.

annotation

     (アノテーション) 変数、クラス属性、関数のパラメータや返り値に関係す
     るラベルです。 慣例により *note type hint: 25e0. として使われていま
     す。

     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():
     673. on modules, classes, and functions, respectively.

     機能の説明がある *note variable annotation: 110e, *note function
     annotation: 2225, PEP 484(1), PEP 526(2), PEP 649(3) を参照してくだ
     さい。また、アノテーションを利用するベストプラクティスとして *note
     アノテーションのベストプラクティス: bba. も参照してください。

引数 (argument)

     (実引数) 関数を呼び出す際に、 *note 関数: 26cd. (または *note
     メソッド: 1aab.) に渡す値です。実引数には２種類あります:

        * 'キーワード引数': 関数呼び出しの際に引数の前に識別子がついたも
          の (例: ‘name=’) や、 ‘**’ に続けた辞書の中の値として渡された
          引数。例えば、次の *note complex(): 330. の呼び出しでは、 ‘3’
          と ‘5’ がキーワード引数です:

               complex(real=3, imag=5)
               complex(**{'real': 3, 'imag': 5})

        * '位置引数': キーワード引数以外の引数。位置引数は引数リストの先
          頭に書くことができ、また ‘*’ に続けた *note iterable: 149a. の
          要素として渡すことができます。例えば、次の例では ‘3’ と ‘5’ は
          両方共位置引数です:

               complex(3, 5)
               complex(*(3, 5))

     実引数は関数の実体において名前付きのローカル変数に割り当てられます
     。割り当てを行う規則については *note 呼び出し (call): 113a. を参照
     してください。シンタックスにおいて実引数を表すためにあらゆる式を使
     うことが出来ます。評価された値はローカル変数に割り当てられます。

     *note 仮引数: 255a. 、FAQ の *note 実引数と仮引数の違いは何ですか?:
     5c85. 、 PEP 362(4) を参照してください。

asynchronous context manager

     (非同期コンテキストマネージャ) *note __aenter__(): 2631. と *note
     __aexit__(): 1bcc. メソッドを定義することで *note async with: 216.
     文内の環境を管理するオブジェクトです。 PEP 492(5) で導入されました
     。

asynchronous generator

     (非同期ジェネレータ) *note asynchronous generator iterator: 3b9c. を
     返す関数です。 *note async def: 9d4. で定義されたコルーチン関数に似
     ていますが、 *note yield: d97. 式を持つ点で異なります。 ‘yield’ 式
     は *note async for: e74. ループで使用できる値の並びを生成するのに使
     用されます。

     通常は非同期ジェネレータ関数を指しますが、文脈によっては '非同期ジ
     ェネレータイテレータ' を指す場合があります。 意図された意味が明らか
     でない場合、 明瞭化のために完全な単語を使用します。

     非同期ジェネレータ関数には、 *note async for: e74. 文や *note async
     with: 216. 文だけでなく *note await: 439. 式もあることがあります。

asynchronous generator iterator

     (非同期ジェネレータイテレータ) *note asynchronous generator: 26b1.
     関数で生成されるオブジェクトです。

     これは *note asynchronous iterator: 6d3. で、 *note __anext__():
     1ac6. メソッドを使って呼ばれると awaitable オブジェクトを返します。
     この awaitable オブジェクトは、次の *note yield: d97. 式まで非同期
     ジェネレータ関数の本体を実行します。

     各 *note yield: d97. では一時的に処理を中断し、その実行状態 (ローカ
     ル変数や保留中の try 文を含む) を記憶します。 '非同期ジェネレータイ
     テレータ' が *note __anext__(): 1ac6. で返された他の awaitable で実
     際に再開する時には、その中断箇所が選ばれます。 PEP 492(6) および
     PEP 525(7) を参照してください。

asynchronous iterable

     (非同期イテラブル) *note async for: e74. 文の中で使用できるオブジェ
     クトです。 自身の *note __aiter__(): fbf. メソッドから *note
     asynchronous iterator: 6d3. を返さなければなりません。 PEP 492(8) で
     導入されました。

asynchronous iterator

     (非同期イテレータ) *note __aiter__(): fbf. と *note __anext__():
     1ac6. メソッドを実装したオブジェクトです。 ‘__anext__()’ は *note
     awaitable: 6d5. オブジェクトを返さなければなりません。 *note async
     for: e74. は *note StopAsyncIteration: 201d. 例外を送出するまで、非
     同期イテレータの ‘__anext__()’ メソッドが返す awaitable を解決しま
     す。 PEP 492(9) で導入されました。

atomic operation

     An operation that appears to execute as a single, indivisible step:
     no other thread can observe it half-done, and its effects become
     visible all at once.  Python does not guarantee that high-level
     statements are atomic (for example, ‘x += 1’ performs multiple
     bytecode operations and is not atomic).  Atomicity is only
     guaranteed where explicitly documented.  See also *note race
     condition: 2939. and *note data race: 293a.

attached thread state

     A *note thread state: 1a90. that is active for the current OS
     thread.

     When a *note thread state: 1a90. 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: 418. for the current
     interpreter, so only one OS thread can have an attached thread
     state at a given moment.  In *note free-threaded builds: 1a3. 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): 24af. で
     定義される識別子ではない名前の属性を与えることができます。たとえば
     *note setattr(): 27d6. を使い、オブジェクトがそれを許可している場合
     に行えます。このような属性はドット表記式ではアクセスできず、代わり
     に *note getattr(): f93. を使って取る必要があります。

awaitable

     (待機可能) *note await: 439. 式で使用することが出来るオブジェクトで
     す。 *note coroutine: 8a7. か、 *note __await__(): 1132. メソッドが
     あるオブジェクトです。 PEP 492(10) を参照してください。

BDFL

     慈悲深き終身独裁者 (Benevolent Dictator For Life) の略です。Python
     の作者、Guido van Rossum(11) のことです。

binary file

     (バイナリファイル) *note bytes-like オブジェクト: 43d. の読み込みお
     よび書き込みができる *note ファイルオブジェクト: 1581. です。 バイ
     ナリファイルの例は、バイナリモード (‘'rb'’, ‘'wb'’ or ‘'rb+'’) で開
     かれたファイル、*note sys.stdin.buffer: 94f.、*note
     sys.stdout.buffer: ea0.、 *note io.BytesIO: 1258. や *note
     gzip.GzipFile: 84f.  のインスタンスです。

     *note str: 1ea. オブジェクトの読み書きができるファイルオブジェクト
     については、 *note text file: 227a. も参照してください。

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: 7e0. to the object and so destroy it.

     Calling *note Py_INCREF(): 979. on the *note borrowed reference:
     60a. is recommended to convert it to a *note strong reference: 7e0.
     in-place, except when the object cannot be destroyed before the
     last usage of the borrowed reference.  The *note Py_NewRef(): c74.
     function can be used to create a new strong reference.

bytes-like object

     *note バッファプロトコル (buffer Protocol): 319. をサポートしていて
     、 C 言語の意味で *note 連続した: 13f9. バッファーを提供可能なオブ
     ジェクト。 *note bytes: 1d2, *note bytearray: 1d1, *note
     array.array: 6cb. や、多くの一般的な *note memoryview: 1dd. オブジ
     ェクトがこれに当たります。 bytes-like オブジェクトは、データ圧縮、
     バイナリファイルへの保存、ソケットを経由した送信など、バイナリデー
     タを要求するいろいろな操作に利用することができます。

     幾つかの操作ではバイナリデータを変更する必要があります。 その操作の
     ドキュメントではよく "読み書き可能な bytes-like オブジェクト" に言
     及しています。 変更可能なバッファーオブジェクトには、 *note
     bytearray: 1d1. と ‘bytearray’ の *note memoryview: 1dd. などが含ま
     れます。 また、他の幾つかの操作では不変なオブジェクト内のバイナリデ
     ータ ("読み出し専用の bytes-like オブジェクト") を必要します。それ
     には *note bytes: 1d2. と ‘bytes’ の ‘memoryview’ オブジェクトが含
     まれます。

bytecode

     (バイトコード) Python のソースコードは、 Python プログラムの
     CPython インタプリタの内部表現であるバイトコードへとコンパイルされ
     ます。 バイトコードは ‘.pyc’ ファイルにキャッシュされ、同じファイル
     が二度目に実行されるときはより高速になります (ソースコードからバイ
     トコードへの再度のコンパイルは回避されます)。 この "中間言語
     (intermediate language)" は、各々のバイトコードに対応する機械語を実
     行する *note 仮想マシン: 3cb8. で動作するといえます。 重要な注意と
     して、バイトコードは異なる Python 仮想マシン間で動作することや、
     Python リリース間で安定であることは期待されていません。

     バイトコードの命令一覧は *note dis モジュール: 9b6. にあります。

callable

     A callable is an object that can be called, possibly with a set of
     arguments (see *note argument: 86d.), with the following syntax:

          callable(argument1, argument2, argumentN)

     A *note function: 26cd, and by extension a *note method: 1aab, is a
     callable.  An instance of a class that implements the *note
     __call__(): 966. method is also a callable.

callback

     (コールバック) 将来のある時点で実行されるために引数として渡される関
     数

クラス

     (クラス) ユーザー定義オブジェクトを作成するためのテンプレートです。
     クラス定義は普通、そのクラスのインスタンス上の操作をするメソッドの
     定義を含みます。

class variable

     (クラス変数) クラス上に定義され、クラスレベルで (つまり、クラスのイ
     ンスタンス上ではなしに) 変更されることを目的としている変数です。

closure variable

     A *note free variable: 263c. referenced from a *note nested scope:
     25a0. 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: 1661. 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: 263c, 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: 2556. 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: 263c. 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: 91.
     モジュールの複素数版を利用するには、 *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: f6. 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:
     5d56.).

concurrent modification

     When multiple threads modify shared data at the same time.
     Concurrent modification without proper synchronization can cause
     *note race conditions: 2939, and might also trigger a *note data
     race: 293a, 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: 47f. via a *note with: 215. statement.

        * The collection of key­value bindings associated with a
          particular *note contextvars.Context: 428. object and accessed
          via *note ContextVar: 1abc. objects.  Also see *note context
          variable: 5d58.

        * A *note contextvars.Context: 428. object.  Also see *note
          current context: 1b96.

コンテキスト管理プロトコル

     The *note __enter__(): 9cb. and *note __exit__(): 16ba. methods
     called by the *note with: 215. statement.  See PEP 343(12).

context manager

     An object which implements the *note context management protocol:
     1b97. and controls the environment seen in a *note with: 215.
     statement.  See PEP 343(13).

context variable

     A variable whose value depends on which context is the *note
     current context: 1b96.  Values are accessed via *note
     contextvars.ContextVar: 1abc. objects.  Context variables are
     primarily used to isolate state between concurrent asynchronous
     tasks.

contiguous

     (隣接、連続) バッファが厳密に 'C-連続' または 'Fortran 連続' である
     場合に、そのバッファは連続しているとみなせます。 ゼロ次元バッファは
     C 連続であり Fortran 連続です。 一次元の配列では、その要素は必ずメ
     モリ上で隣接するように配置され、添字がゼロから始まり増えていく順序
     で並びます。 多次元の C-連続な配列では、メモリアドレス順に要素を巡
     る際には最後の添え字が最初に変わるのに対し、 Fortran 連続な配列では
     最初の添え字が最初に動きます。

コルーチン

     (コルーチン) コルーチンはサブルーチンのより一般的な形式です。 サブ
     ルーチンには決められた地点から入り、別の決められた地点から出ます。
     コルーチンには多くの様々な地点から入る、出る、再開することができま
     す。 コルーチンは *note async def: 9d4. 文で実装できます。 PEP
     492(14) を参照してください。

coroutine function

     (コルーチン関数) *note coroutine: 8a7. オブジェクトを返す関数です。
     コルーチン関数は *note async def: 9d4. 文で実装され、*note await:
     439.、*note async for: e74.、 および *note async with: 216. キーワ
     ードを持つことが出来ます。 これらは PEP 492(15) で導入されました。

CPython

     python.org(16) で配布されている、Python プログラミング言語の標準的
     な実装です。"CPython" という単語は、この実装を Jython や IronPython
     といった他の実装と区別する必要が有る場合に利用されます。

current context

     The *note context: 1b95. (*note contextvars.Context: 428. object)
     that is currently used by *note ContextVar: 1abc. objects to access
     (get or set) the values of *note context variables: 5d58.  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: 19fe. 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: 5d59. behavior and can
     cause data corruption.  Proper use of *note locks: 2938. and other
     *note synchronization primitives: 5d5a. prevents data races.  Note
     that data races can only happen in native code, but that *note
     native code: 5d5b. might be exposed in a Python API. See also *note
     race condition: 2939. and *note thread-safe: 5d5c.

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: 2938. in a consistent order.  See also lock
     and *note reentrant: 5d5e.

decorator

     (デコレータ) 別の関数を返す関数で、通常、 ‘@wrapper’ 構文で関数変換
     として適用されます。デコレータの一般的な利用例は、 *note
     classmethod(): 6a0. と *note staticmethod(): 66d. です。

     デコレータの文法はシンタックスシュガーです。次の2つの関数定義は意味
     的に同じものです:

          def f(arg):
              ...
          f = staticmethod(f)

          @staticmethod
          def f(arg):
              ...

     同じ概念がクラスにも存在しますが、あまり使われません。デコレータに
     ついて詳しくは、 *note 関数定義: 2224. および *note クラス定義:
     1691. のドキュメントを参照してください。

descriptor

     Any object which defines the methods *note __get__(): 18a0, *note
     __set__(): 25c9, or *note __delete__(): 1b83.  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) の実装: 1011. や *note Descriptor How To Guide: 18a5.
     を参照してください。

dictionary

     An associative array, where arbitrary keys are mapped to values.
     The keys can be any object with *note __hash__(): ec5. and *note
     __eq__(): ec4. methods.  Called a hash in Perl.

dictionary comprehension

     (辞書内包表記) iterable 内の全てあるいは一部の要素を処理して、その
     結果からなる辞書を返すコンパクトな書き方です。 ‘results = {n: n **
     2 for n in range(10)}’ とすると、キー ‘n’ を値 ‘n ** 2’ に対応付け
     る辞書を生成します。 *note リスト、集合、辞書の表示: 9d3. を参照し
     てください。

dictionary view

     (辞書ビュー) *note dict.keys(): bb1.、*note dict.values(): bb2.、
     *note dict.items(): bb3. が返すオブジェクトです。 辞書の項目の動的
     なビューを提供します。 すなわち、辞書が変更されるとビューはそれを反
     映します。 辞書ビューを強制的に完全なリストにするには
     ‘list(dictview)’ を使用してください。 *note 辞書ビューオブジェクト:
     28b6. を参照してください。

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__: cf8.
     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(): 191. や *note isinstance(): 2fb. による判
     定を避けます。 (ただし、ダックタイピングを *note 抽象基底クラス:
     1574. で補完することもできます。) その代わり、典型的に *note
     hasattr(): 8e7. 判定や *note EAFP: 32b4. プログラミングを利用します
     。

dunder

     An informal short-hand for "double underscore", used when talking
     about a *note special method: 1e76.  For example, ‘__init__’ is
     often pronounced "dunder init".

EAFP

     「認可をとるより許しを請う方が容易 (easier to ask for forgiveness
     than permission、マーフィーの法則)」の略です。この Python で広く使
     われているコーディングスタイルでは、通常は有効なキーや属性が存在す
     るものと仮定し、その仮定が誤っていた場合に例外を捕捉します。この簡
     潔で手早く書けるコーディングスタイルには、 *note try: adb. 文および
     *note except: 44e. 文がたくさんあるのが特徴です。このテクニックは、
     C のような言語でよく使われている *note LBYL: 5d61. スタイルと対照的
     なものです。

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: 860. statement.

expression

     (式) 何かの値と評価される、一まとまりの構文 (a piece of syntax) で
     す。言い換えると、式とはリテラル、名前、属性アクセス、演算子や関数
     呼び出しなど、値を返す式の要素の積み重ねです。他の多くの言語と違い
     、Python では言語の全ての構成要素が式というわけではありません。
     *note while: 1ba5. のように、式としては使えない *note 文: 2e2d. も
     あります。代入も式ではなく文です。

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:
     441.  See also PEP 498(17).

file object

     An object exposing a file-oriented API (with methods such as
     ‘read()’ or ‘write()’) to an underlying resource.  Depending on the
     way it was created, a file object can mediate access to a real
     on-disk file or to another type of storage or communication device
     (for example standard input/output, in-memory buffers, sockets,
     pipes, etc.).  File objects are also called 'file-like objects' or
     'streams'.

     ファイルオブジェクトには実際には 3 種類あります: 生の *note
     バイナリーファイル: 227b.、バッファされた バイナリーファイル、そし
     て *note テキストファイル: 227a. です。インターフェイスは *note io:
     82. モジュールで定義されています。ファイルオブジェクトを作る標準的
     な方法は *note open(): 333. 関数を使うことです。

file-like object

     *note file object: 1581. と同義です。

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: 67c. を送出することがあります。

     The *note sys.getfilesystemencoding(): 101b. and *note
     sys.getfilesystemencodeerrors(): 10a7. 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:
     612. のメンバー *note filesystem_encoding: 635. と *note
     filesystem_errors: 636. を参照してください。

     See also the *note locale encoding: 752.

finder

     (ファインダ) インポートされているモジュールの *note loader: 1c4f. の
     発見を試行するオブジェクトです。

     There are two types of finder: *note meta path finders: 1427. for
     use with *note sys.meta_path: 10e7, and *note path entry finders:
     1428. for use with *note sys.path_hooks: 13d1.

     See *note ファインダーとローダー: 265a. and *note importlib: 7a.
     for much more detail.

floor division

     (切り捨て除算) 一番近い整数に切り捨てる数学的除算。 切り捨て除算演
     算子は ‘//’ です。 例えば、 ‘11 // 4’ は ‘2’ になり、それとは対称に
     浮動小数点数の真の除算では ‘2.75’ が 返ってきます。 ‘(-11) // 4’ は
     ‘-2.75’ を '小さい方に' 丸める (訳注: 負の無限大への丸めを行う) の
     で ‘-3’ になることに注意してください。 PEP 238(18) を参照してくださ
     い。

free threading

     A threading model where multiple threads can run Python bytecode
     simultaneously within the same interpreter.  This is in contrast to
     the *note global interpreter lock: 68c. which allows only one
     thread to execute Python bytecode at a time.  See PEP 703(19).

free-threaded build

     A build of *note CPython: ae8. that supports *note free threading:
     48e, configured using the *note -disable-gil: 6ab. option before
     compilation.

     See *note Python support for free threading: 2931.

free variable

     Formally, as defined in the *note language execution model: 2639, a
     free variable is any variable used in a namespace which is not a
     local variable in that namespace.  See *note closure variable:
     1ad6. for an example.  Pragmatically, due to the name of the *note
     codeobject.co_freevars: 2556. attribute, the term is also sometimes
     used as a synonym for closure variable.

関数

     (関数) 呼び出し側に値を返す一連の文のことです。関数には0以上の
     *note 実引数: 86d. を渡すことが出来ます。実体の実行時に引数を使用す
     ることが出来ます。 *note 仮引数: 255a.、*note メソッド: 1aab.、
     *note 関数定義: 2224. を参照してください。

function annotation

     (関数アノテーション) 関数のパラメータや返り値の *note annotation:
     410. です。

     関数アノテーションは、通常は *note 型ヒント: 25e0. のために使われま
     す: 例えば、この関数は 2 つの *note int: 32e. 型の引数を取ると期待
     され、また ‘int’ 型の返り値を持つと期待されています。

          def sum_two_numbers(a: int, b: int) -> int:
             return a + b

     関数アノテーションの文法は *note 関数定義: 2224. の節で解説されてい
     ます。

     機能の説明がある *note variable annotation: 110e, PEP 484(20),を参
     照してください。また、アノテーションを利用するベストプラクティスと
     して *note アノテーションのベストプラクティス: bba. も参照してくだ
     さい。

__future__

     ‘from __future__ import <feature>’ という *note future 文: 677. は
     、コンパイラーに将来の 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: 63. モジュールを使って操作できます。

ジェネレータ

     (ジェネレータ) *note generator iterator: fa2. を返す関数です。 通常
     の関数に似ていますが、 *note yield: d97. 式を持つ点で異なります。
     ‘yield’ 式は、 for ループで使用できたり、*note next(): bb9. 関数で
     値を 1 つずつ取り出したりできる、値の並びを生成するのに使用されます
     。

     通常はジェネレータ関数を指しますが、文脈によっては 'ジェネレータイ
     テレータ' を指す場合があります。 意図された意味が明らかでない場合、
     明瞭化のために完全な単語を使用します。

generator iterator

     (ジェネレータイテレータ) *note generator: 1417. 関数で生成されるオ
     ブジェクトです。

     Each *note yield: d97. temporarily suspends processing, remembering
     the execution state (including local variables and pending
     try-statements).  When the 'generator iterator' resumes, it picks
     up where it left off (in contrast to functions which start fresh on
     every invocation).

generator expression

     (ジェネレータ式) iterator を返す *note 式: 25e3. です。 普通の式に
     、ループ変数を定義する ‘for’ 節、範囲、そして省略可能な ‘if’ 節がつ
     づいているように見えます。 こうして構成された式は、外側の関数に向け
     て値を生成します:

          >>> sum(i*i for i in range(10))         # sum of squares 0, 1, 4, ... 81
          285

generic function

     (ジェネリック関数) 異なる型に対し同じ操作をする関数群から構成される
     関数です。呼び出し時にどの実装を用いるかはディスパッチアルゴリズム
     により決定されます。

     *note single dispatch: db8.、*note functools.singledispatch(): a2f.
     デコレータ、 PEP 443(21) を参照してください。

generic type

     A *note type: 1f12. that can be parameterized; typically a *note
     container class: 25e8. such as *note list: 4e0. or *note dict: 193.
     Used for *note type hints: 25e0. and *note annotations: 410.

     For more details, see *note generic alias types: aa4, PEP 483(22),
     PEP 484(23), PEP 585(24), and the *note typing: 10d. module.

GIL

     *note global interpreter lock: 68c. を参照してください。

global interpreter lock

     (グローバルインタプリタロック) *note CPython: ae8. インタプリタが利
     用している、一度に Python の *note バイトコード: 6b9. を実行するス
     レッドは一つだけであることを保証する仕組みです。これにより (*note
     dict: 193. などの重要な組み込み型を含む) オブジェクトモデルが同時ア
     クセスに対して暗黙的に安全になるので、 CPython の実装がシンプルにな
     ります。インタプリタ全体をロックすることで、マルチプロセッサマシン
     が生じる並列化のコストと引き換えに、インタプリタを簡単にマルチスレ
     ッド化できるようになります。

     ただし、標準あるいは外部のいくつかの拡張モジュールは、圧縮やハッシ
     ュ計算などの計算の重い処理をするときに GIL を解除するように設計され
     ています。また、I/O 処理をする場合 GIL は常に解除されます。

     As of Python 3.13, the GIL can be disabled using the *note
     -disable-gil: 6ab. build configuration.  After building Python with
     this option, code must be run with *note -X gil=0: 183. or after
     setting the *note PYTHON_GIL=0: 6ac. environment variable.  This
     feature enables improved performance for multi-threaded
     applications and makes it easier to use multi-core CPUs
     efficiently.  For more details, see PEP 703(25).

     In prior versions of Python's C API, a function might declare that
     it requires the GIL to be held in order to use it.  This refers to
     having an *note attached thread state: 1ac.

global state

     Data that is accessible throughout a program, such as module-level
     variables, class variables, or C static variables in *note
     extension modules: 2461.  In multi-threaded programs, global state
     shared between threads typically requires synchronization to avoid
     *note race conditions: 2939. and *note data races: 293a.

hash-based pyc

     (ハッシュベース pyc ファイル) 正当性を判別するために、対応するソー
     スファイルの最終更新時刻ではなくハッシュ値を使用するバイトコードの
     キャッシュファイルです。*note キャッシュされたバイトコードの無効化:
     9e8. を参照してください。

hashable

     An object is 'hashable' if it has a hash value which never changes
     during its lifetime (it needs a *note __hash__(): ec5. method), and
     can be compared to other objects (it needs an *note __eq__(): ec4.
     method).  Hashable objects which compare equal must have the same
     hash value.

     ハッシュ可能なオブジェクトは辞書のキーや集合のメンバーとして使えま
     す。辞書や集合のデータ構造は内部でハッシュ値を使っているからです。

     Python のイミュータブルな組み込みオブジェクトは、ほとんどがハッシュ
     可能です。(リストや辞書のような) ミュータブルなコンテナはハッシュ不
     可能です。(タプルや frozenset のような) イミュータブルなコンテナは
     、要素がハッシュ可能であるときのみハッシュ可能です。 ユーザー定義の
     クラスのインスタンスであるようなオブジェクトはデフォルトでハッシュ
     可能です。 それらは全て (自身を除いて) 比較結果は非等価であり、ハッ
     シュ値は *note id(): 17db. より得られます。

IDLE

     Python の統合開発環境 (Integrated DeveLopment Environment)及び学習
     環境 (Learning Environment) です。*note IDLE -- Python
     のエディタとシェル: 13c3. は Python の標準的な配布に同梱されている
     基本的な機能のエディタとインタプリタ環境です。

永続オブジェクト (immortal)

     'Immortal objects' are a CPython implementation detail introduced
     in PEP 683(26).

     If an object is immortal, its *note reference count: 2d0. is never
     modified, and therefore it is never deallocated while the
     interpreter is running.  For example, *note True: fd0. and *note
     None: a6a. are immortal in CPython.

     Immortal objects can be identified via *note sys._is_immortal():
     51e, or via *note PyUnstable_IsImmortal(): 5f7. 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: 5d5c. because their state cannot
     be modified after creation, eliminating concerns about improperly
     synchronized *note concurrent modification: 5d57.

import path

     *note path based finder: 2662. が import するモジュールを検索する場
     所 (または *note path entry: 266d.) のリスト。 import 中、このリス
     トは通常 *note sys.path: 19f. から来ますが、サブパッケージの場合は
     親パッケージの ‘__path__’ 属性からも来ます。

importing

     あるモジュールの Python コードが別のモジュールの Python コードで使
     えるようにする処理です。

importer

     モジュールを探してロードするオブジェクト。 *note finder: 265c. と
     *note loader: 1c4f. のどちらでもあるオブジェクト。

index

     A numeric value that represents the position of an element in a
     *note sequence: 904.

     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: 26c4.

     See also *note subscript: 5d67.

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 対話モード: 6a6.

interpreted

     Python はインタプリタ形式の言語であり、コンパイラ言語の対極に位置し
     ます。 (バイトコードコンパイラがあるために、この区別は曖昧ですが。)
     ここでのインタプリタ言語とは、ソースコードのファイルを、まず実行可
     能形式にしてから実行させるといった操作なしに、直接実行できることを
     意味します。インタプリタ形式の言語は通常、コンパイラ形式の言語より
     も開発／デバッグのサイクルは短いものの、プログラムの実行は一般に遅
     いです。 *note 対話的: 458. も参照してください。

interpreter shutdown

     Python インタープリターはシャットダウンを要請された時に、モジュール
     やすべてのクリティカルな内部構造をなどの、すべての確保したリソース
     を段階的に開放する、特別なフェーズに入ります。 このフェーズは *note
     ガベージコレクタ: 19fe. を複数回呼び出します。 これによりユーザー定
     義のデストラクターや 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: 4e0,
     *note str: 1ea, and *note tuple: 1d9.) and some non-sequence types
     like *note dict: 193, *note file objects: 1581, and objects of any
     classes you define with an *note __iter__(): 1031. method or with a
     *note __getitem__(): 78d. method that implements *note sequence:
     904. semantics.

     反復可能オブジェクトは *note for: 329. ループ内やその他多くのシーケ
     ンス (訳注: ここでのシーケンスとは、シーケンス型ではなくただの列と
     いう意味)が必要となる状況 (*note zip(): 446, *note map(): 445, ...)
     で利用できます。 反復可能オブジェクトを組み込み関数 *note iter():
     bb8. の引数として渡すと、 オブジェクトに対するイテレータを返します
     。 このイテレータは一連の値を引き渡す際に便利です。 通常は反復可能
     オブジェクトを使う際には、 ‘iter()’ を呼んだりイテレータオブジェク
     トを自分で操作する必要はありません。 ‘for’ 文ではこの操作を自動的に
     行い、一時的な無名の変数を作成してループを回している間イテレータを
     保持します。 *note イテレータ: 6d4. 、 *note シーケンス: 904. 、
     *note ジェネレータ: 1417. も参照してください。

iterator

     データの流れを表現するオブジェクトです。イテレータの *note
     __next__(): 1687. メソッドを繰り返し呼び出す (または組み込み関数
     *note next(): bb9. に渡す) と、流れの中の要素を一つずつ返します。デ
     ータがなくなると、代わりに *note StopIteration: fbe. 例外を送出しま
     す。その時点で、イテレータオブジェクトは尽きており、それ以降は
     ‘__next__()’ を何度呼んでも ‘StopIteration’ を送出します。イテレー
     タは、そのイテレータオブジェクト自体を返す *note __iter__(): 22bb.
     メソッドを実装しなければならないので、イテレータは他の iterable を
     受理するほとんどの場所で利用できます。はっきりとした例外は複数の反
     復を行うようなコードです。 (*note list: 4e0. のような) コンテナオブ
     ジェクトは、自身を *note iter(): bb8. 関数にオブジェクトに渡したり
     *note for: 329. ループ内で使うたびに、新たな未使用のイテレータを生
     成します。これをイテレータで行おうとすると、前回のイテレーションで
     使用済みの同じイテレータオブジェクトを単純に返すため、空のコンテナ
     のようになってしまいます。

     詳細な情報は *note イテレータ型: 27ef. にあります。

     'CPython 実装の詳細:' CPython does not consistently apply the
     requirement that an iterator define *note __iter__(): 22bb.  And
     also please note that *note free-threaded: 48e. CPython does not
     guarantee *note thread-safe: 5d5c. behavior of iterator operations.

キー

     A value that identifies an entry in a *note mapping: 1579.  See
     also *note subscript: 5d67.

key function

     (キー関数) キー関数、あるいは照合関数とは、ソートや順序比較のための
     値を返す呼び出し可能オブジェクト(callable)です。例えば、 *note
     locale.strxfrm(): 1a17. をキー関数に使えば、ロケール依存のソートの
     慣習にのっとったソートキーを返します。

     Python の多くのツールはキー関数を受け取り要素の並び順やグループ化を
     管理します。 *note min(): 12bc, *note max(): 12bd, *note sorted():
     f90, *note list.sort(): f91, *note heapq.merge(): 11bd, *note
     heapq.nsmallest(): 2bd1, *note heapq.nlargest(): 2bd0, *note
     itertools.groupby(): 194b. 等があります。

     There are several ways to create a key function.  For example.  the
     *note str.casefold(): 1193. method can serve as a key function for
     case insensitive sorts.  Alternatively, a key function can be built
     from a *note lambda: 1657. expression such as ‘lambda r: (r[0],
     r[2])’.  Also, *note operator.attrgetter(): 11ea, *note
     operator.itemgetter(): e2a, and *note operator.methodcaller():
     11eb. are three key function constructors.  See the *note Sorting
     HOW TO: 1599. for examples of how to create and use key functions.

keyword argument

     *note 実引数: 86d. を参照してください。

lambda

     (ラムダ) 無名のインライン関数で、関数が呼び出されたときに評価される
     1 つの *note 式: 25e3. を含みます。ラムダ関数を作る構文は ‘lambda
     [parameters]: expression’ です。

LBYL

     「ころばぬ先の杖 (look before you leap)」 の略です。このコーディン
     グスタイルでは、呼び出しや検索を行う前に、明示的に前提条件
     (pre-condition) 判定を行います。 *note EAFP: 32b4. アプローチと対照
     的で、 *note if: 32a. 文がたくさん使われるのが特徴的です。

     In a multi-threaded environment, the LBYL approach can risk
     introducing a *note race condition: 2939. 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: 2938. or by using the *note EAFP: 32b4.
     approach.  See also *note thread-safe: 5d5c.

lexical analyzer

     Formal name for the 'tokenizer'; see *note token: 2497.

list

     A built-in Python *note sequence: 904.  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: 32a. 節はオプションです。 ‘if’ 節がない場
     合、 ‘range(256)’ の全ての要素が処理されます。

lock

     A *note synchronization primitive: 5d5a. 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: f6. module provides
     *note Lock: 1a30. (a basic lock) and *note RLock: 2eb. (a *note
     reentrant: 5d5e. lock).  Locks are used to prevent *note race
     conditions: 2939. and ensure *note thread-safe: 5d5c. access to
     shared data.  Alternative design patterns to locks exist such as
     queues, producer/consumer patterns, and thread-local state.  See
     also *note deadlock: 5d5d, and reentrant.

lock-free

     An operation that does not acquire any *note lock: 2938. 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: 48e. Python, built-in types like *note dict: 193.
     and *note list: 4e0. 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: 293f.

loader

     An object that loads a module.  It must define the ‘exec_module()’
     and ‘create_module()’ methods to implement the *note Loader: 1278.
     interface.  A loader is typically returned by a *note finder: 265c.
     See also:

        * *note ファインダーとローダー: 265a.

        * *note importlib.abc.Loader: 1278.

        * PEP 302(27)

ロケールエンコーディング

     On Unix, it is the encoding of the LC_CTYPE locale.  It can be set
     with *note locale.setlocale(locale.LC_CTYPE, new_locale): 23c.

     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(): a4a. can be used to get the locale
     encoding.

     See also the *note filesystem encoding and error handler: 94d.

magic method

     *note special method: 1e76. のくだけた同義語です。

mapping

     (マッピング) 任意のキー探索をサポートしていて、 *note
     collections.abc.Mapping: ca0. か *note
     collections.abc.MutableMapping: 146a. の *note 抽象基底クラス: c52.
     で指定されたメソッドを実装しているコンテナオブジェクトです。例えば
     、 *note dict: 193, *note collections.defaultdict: 157a, *note
     collections.OrderedDict: 9da, *note collections.Counter: 20f. など
     です。

meta path finder

     *note sys.meta_path: 10e7. を検索して得られた *note finder: 265c.
     meta path finder は *note path entry finder: 1428. と関係はあります
     が、別物です。

     meta path finder が実装するメソッドについては *note
     importlib.abc.MetaPathFinder: c48. を参照してください。

metaclass

     (メタクラス) クラスのクラスです。クラス定義は、クラス名、クラスの辞
     書と、基底クラスのリストを作ります。メタクラスは、それら 3 つを引数
     として受け取り、クラスを作る責任を負います。ほとんどのオブジェクト
     指向言語は(訳注:メタクラスの)デフォルトの実装を提供しています。
     Python が特別なのはカスタムのメタクラスを作成できる点です。ほとんど
     のユーザーに取って、メタクラスは全く必要のないものです。しかし、一
     部の場面では、メタクラスは強力でエレガントな方法を提供します。たと
     えば属性アクセスのログを取ったり、スレッドセーフ性を追加したり、オ
     ブジェクトの生成を追跡したり、シングルトンを実装するなど、多くの場
     面で利用されます。

     詳細は *note メタクラス: 25d2. を参照してください。

メソッド

     (メソッド) クラス本体の中で定義された関数。そのクラスのインスタンス
     の属性として呼び出された場合、メソッドはインスタンスオブジェクトを
     第一 *note 引数: 86d. として受け取ります (この第一引数は通常 ‘self’
     と呼ばれます)。 *note 関数: 26cd. と *note ネストされたスコープ:
     25a0. も参照してください。

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: 1862. for details of the algorithm used by
     the Python interpreter since the 2.3 release.

module

     (モジュール) Python コードの組織単位としてはたらくオブジェクトです
     。モジュールは任意の Python オブジェクトを含む名前空間を持ちます。
     モジュールは *note importing: 2650. の処理によって Python に読み込
     まれます。

     *note パッケージ: 4c8. を参照してください。

module spec

     モジュールをロードするのに使われるインポート関連の情報を含む名前空
     間です。 *note importlib.machinery.ModuleSpec: 247c. のインスタンス
     です。

     See also *note Module specs: 2575.

MRO

     *note method resolution order: 27a3. を参照してください。

mutable

     An *note object: 5d6a. 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: 2939.  See also
     *note immutable: 18c, *note thread-safe: 5d5c, and *note concurrent
     modification: 5d57.

named tuple

     "名前付きタプル" という用語は、タプルを継承していて、インデックスが
     付く要素に対し属性を使ってのアクセスもできる任意の型やクラスに応用
     されています。 その型やクラスは他の機能も持っていることもあります。

     *note time.localtime(): 18b1. や *note os.stat(): 4fc. の返り値を含
     むいくつかの組み込み型は名前付きタプルです。 他の例は *note
     sys.float_info: 1fde. です:

          >>> 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: 1d9. and that defines
     named fields.  Such a class can be written by hand, or it can be
     created by inheriting *note typing.NamedTuple: 2f0, or with the
     factory function *note collections.namedtuple(): 1da.  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: 333. と *note os.open(): 114f. は
     名前空間で区別されています。また、どのモジュールが関数を実装してい
     るか明示することによって名前空間は可読性と保守性を支援します。例え
     ば、*note random.seed(): 162d. や *note itertools.islice(): f0d. と
     書くと、それぞれモジュール *note random: c0. や *note itertools:
     84. で実装されていることが明らかです。

namespace package

     A *note package: 4c8. which serves only as a container for
     subpackages.  Namespace packages may have no physical
     representation, and specifically are not like a *note regular
     package: 2654. 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: 2654.

     For more information, see PEP 420(28) and *note 名前空間パッケージ:
     2656.

     *note module: 1c06. を参照してください。

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:
     2461. that can be called from Python.  See also extension module.

nested scope

     (ネストされたスコープ) 外側で定義されている変数を参照する機能です。
     例えば、ある関数が別の関数の中で定義されている場合、内側の関数は外
     側の関数中の変数を参照できます。ネストされたスコープはデフォルトで
     は変数の参照だけができ、変数の代入はできないので注意してください。
     ローカル変数は、最も内側のスコープで変数を読み書きします。同様に、
     グローバル変数を使うとグローバル名前空間の値を読み書きします。
     *note nonlocal: 1661. で外側の変数に書き込めます。

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__: 18a3,
     descriptors, properties, *note __getattribute__(): f94, 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: 2939. where the relative timing or interleaving of
     threads affects the result.  Proper synchronization using *note
     locks: 2938. and other *note synchronization primitives: 5d5a.
     helps ensure deterministic behavior.

object

     (オブジェクト) 状態 (属性や値) と定義された振る舞い (メソッド) をも
     つ全てのデータ。もしくは、全ての *note 新スタイルクラス: 2f45. の究
     極の基底クラスのこと。

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: 2461. that is part of the *note standard
     library: 3df, but may be absent in some builds of *note CPython:
     ae8, usually due to missing third-party libraries or because the
     module is not available for a given platform.

     See *note オプションのモジュールの要件: 2364. for a list of
     optional modules that require third-party libraries.

package

     (パッケージ) サブモジュールや再帰的にサブパッケージを含むことの出来
     る *note module: 1c06. のことです。専門的には、パッケージは
     ‘__path__’ 属性を持つ Python オブジェクトです。

     *note regular package: 2654. と *note namespace package: 535. を参
     照してください。

parallelism

     Executing multiple operations at the same time (e.g.  on multiple
     CPU cores).  In Python builds with the *note global interpreter
     lock (GIL): 68c, 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: 48e. Python, multiple
     Python threads can run Python code simultaneously on different
     cores.

parameter

     (仮引数) 名前付の実体で *note 関数: 26cd. (や *note メソッド: 1aab.
     ) の定義において関数が受ける *note 実引数: 86d. を指定します。仮引
     数には5種類あります:

        * '位置またはキーワード': *note 位置: 86d. であるいは キーワード
          引数 として渡すことができる引数を指定します。 これはたとえば以
          下の '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 仮引数: 255a. 、FAQ の *note 実引数と仮引数の違いは何ですか?:
     5c85. 、*note inspect.Parameter: 6ef. クラス、 *note 関数定義:
     2224. セクション、 PEP 362(29) を参照してください。

per-object lock

     A *note lock: 2938. associated with an individual object instance
     rather than a global lock shared across all objects.  In *note
     free-threaded: 48e. Python, built-in types like *note dict: 193.
     and *note list: 4e0. 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: 2946. operations.

path entry

     *note path based finder: 2662. が import するモジュールを探す *note
     import path: 265f. 上の1つの場所です。

path entry finder

     *note sys.path_hooks: 13d1. にある callable (つまり *note path
     entry hook: 266f.) が返した *note finder: 265c. です。与えられた
     *note path entry: 266d. にあるモジュールを見つける方法を知っていま
     す。

     パスエントリーファインダが実装するメソッドについては *note
     importlib.abc.PathEntryFinder: c49. を参照してください。

path entry hook

     A callable on the *note sys.path_hooks: 13d1. list which returns a
     *note path entry finder: 1428. if it knows how to find modules on a
     specific *note path entry: 266d.

path based finder

     デフォルトの *note meta path finder: 1427. の1つは、モジュールの
     *note import path: 265f. を検索します。

path-like object

     (path-like オブジェクト) ファイルシステムパスを表します。 path-like
     オブジェクトは、パスを表す *note str: 1ea. オブジェクトや *note
     bytes: 1d2. オブジェクト、または *note os.PathLike: 1013. プロトコ
     ルを実装したオブジェクトのどれかです。 ‘os.PathLike’ プロトコルをサ
     ポートしているオブジェクトは *note os.fspath(): 1015. を呼び出すこ
     とで ‘str’ または ‘bytes’ のファイルシステムパスに変換できます。
     *note os.fsdecode(): 1016. と *note os.fsencode(): 1017. はそれぞれ
     ‘str’ あるいは ‘bytes’ になるのを保証するのに使えます。 PEP 519(30)
     で導入されました。

PEP

     Python Enhancement Proposal。PEP は、Python コミュニティに対して情
     報を提供する、あるいは Python の新機能やその過程や環境について記述
     する設計文書です。 PEP は、機能についての簡潔な技術的仕様と提案する
     機能の論拠 (理論) を伝えるべきです。

     PEP は、新機能の提案にかかる、コミュニティによる問題提起の集積と
     Python になされる設計決断の文書化のための最上位の機構となることを意
     図しています。PEP の著者にはコミュニティ内の合意形成を行うこと、反
     対意見を文書化することの責務があります。

     PEP 1(31) を参照してください。

portion

     PEP 420(32) で定義されている、namespace package に属する、複数のフ
     ァイルが (zipファイルに格納されている場合もある) 1つのディレクトリ
     に格納されたもの。

位置引数 (positional argument)

     *note 実引数: 86d. を参照してください。

provisional API

     (暫定 API) 標準ライブラリの後方互換性保証から計画的に除外されたもの
     です。そのようなインターフェースへの大きな変更は、暫定であるとされ
     ている間は期待されていませんが、コア開発者によって必要とみなされれ
     ば、後方非互換な変更 (インターフェースの削除まで含まれる) が行われ
     えます。このような変更はむやみに行われるものではありません - これは
     API を組み込む前には見落とされていた重大な欠陥が露呈したときにのみ
     行われます。

     暫定 API についても、後方互換性のない変更は「最終手段」とみなされて
     います。問題点が判明した場合でも後方互換な解決策を探すべきです。

     このプロセスにより、標準ライブラリは問題となるデザインエラーに長い
     間閉じ込められることなく、時代を超えて進化を続けられます。詳細は
     PEP 411(33) を参照してください。

provisional package

     *note provisional API: 604. を参照してください。

Python 3000

     Python 3.x リリースラインのニックネームです。(Python 3 が遠い将来の
     話だった頃に作られた言葉です。) "Py3k" と略されることもあります。

Pythonic

     他の言語で一般的な考え方で書かれたコードではなく、Python の特に一般
     的なイディオムに従った考え方やコード片。例えば、Python の一般的なイ
     ディオムでは *note for: 329. 文を使ってイテラブルのすべての要素に渡
     ってループします。他の多くの言語にはこの仕組みはないので、Python に
     慣れていない人は代わりに数値のカウンターを使うかもしれません:

          for i in range(len(food)):
              print(food[i])

     これに対し、きれいな Pythonic な方法は:

          for piece in food:
              print(piece)

qualified name

     (修飾名) モジュールのグローバルスコープから、そのモジュールで定義さ
     れたクラス、関数、メソッドへの、 "パス" を表すドット名表記です。
     PEP 3155(34) で定義されています。トップレベルの関数やクラスでは、修
     飾名はオブジェクトの名前と同じです:

          >>> class C:
          ...     class D:
          ...         def meth(self):
          ...             pass
          ...
          >>> C.__qualname__
          'C'
          >>> C.D.__qualname__
          'C.D'
          >>> C.D.meth.__qualname__
          'C.D.meth'

     モジュールへの参照で使われると、'完全修飾名 (fully qualified name)'
     はすべての親パッケージを含む全体のドット名表記、例えば
     ‘email.mime.text’ を意味します:

          >>> import email.mime.text
          >>> email.mime.text.__name__
          'email.mime.text'

race condition

     A condition of a program where the behavior depends on the relative
     timing or ordering of events, particularly in multi-threaded
     programs.  Race conditions can lead to *note non-deterministic:
     5d59. behavior and bugs that are difficult to reproduce.  A *note
     data race: 293a. is a specific type of race condition involving
     unsynchronized access to shared memory.  The *note LBYL: 5d61.
     coding style is particularly susceptible to race conditions in
     multi-threaded code.  Using *note locks: 2938. and other *note
     synchronization primitives: 5d5a. helps prevent race conditions.

reference count

     (参照カウント) あるオブジェクトに対する参照の数。参照カウントが0に
     なったとき、そのオブジェクトは破棄されます。 *note 永続: 3a0. であ
     り、参照カウントが決して変更されないために割り当てが解除されないオ
     ブジェクトもあります。参照カウントは通常は Python のコード上には現
     れませんが、 *note CPython: ae8. 実装の重要な要素です。プログラマー
     は、 任意のオブジェクトの参照カウントを知るために *note
     sys.getrefcount(): 551. 関数を呼び出すことが出来ます。

     In *note CPython: ae8, 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: 4c8.。

     *note namespace package: 535. を参照してください。

reentrant

     A property of a function or *note lock: 2938. that allows it to be
     called or acquired multiple times by the same thread without
     causing errors or a *note deadlock: 5d5d.

     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:
     5d59. if they're called reentrantly in a multithreaded program.

     For locks, Python's *note threading.RLock: 2eb. (reentrant lock) is
     reentrant, meaning a thread that already holds the lock can acquire
     it again without blocking.  In contrast, *note threading.Lock:
     1a30. is not reentrant - attempting to acquire it twice from the
     same thread will cause a deadlock.

     See also *note lock: 2938. and *note deadlock: 5d5d.

REPL

     "read–eval–print loop" の頭字語で、 *note 対話型: 458. インタープリ
     ターシェルの別名。

__slots__

     クラス内での宣言で、インスタンス属性の領域をあらかじめ定義しておき
     、インスタンス辞書を排除することで、メモリを節約します。これはよく
     使われるテクニックですが、正しく扱うには少しトリッキーなので、稀な
     ケース、例えばメモリが死活問題となるアプリケーションでインスタンス
     が大量に存在する、といったときを除き、使わないのがベストです。

sequence

     An *note iterable: 149a. which supports efficient element access
     using integer indices via the *note __getitem__(): 78d. special
     method and defines a *note __len__(): 19aa. method that returns the
     length of the sequence.  Some built-in sequence types are *note
     list: 4e0, *note str: 1ea, *note tuple: 1d9, and *note bytes: 1d2.
     Note that *note dict: 193. also supports ‘__getitem__()’ and
     ‘__len__()’, but is considered a mapping rather than a sequence
     because the lookups use arbitrary *note hashable: 18e. keys rather
     than integers.

     The *note collections.abc.Sequence: 1582. abstract base class
     defines a much richer interface that goes beyond just *note
     __getitem__(): 78d. and *note __len__(): 19aa, adding *note
     count(): 25ec, *note index(): 1baa, *note __contains__(): 1772, and
     *note __reversed__(): 104d.  Types that implement this expanded
     interface can be registered explicitly using *note register():
     1445.  For more documentation on sequence methods generally, see
     *note Common Sequence Operations: 281f.

set comprehension

     (集合内包表記) iterable 内の全てあるいは一部の要素を処理して、その
     結果からなる集合を返すコンパクトな書き方です。 ‘results = {c for c
     in 'abracadabra' if c not in 'abc'}’ とすると、‘{'r', 'd'}’ という
     文字列の辞書を生成します。 *note リスト、集合、辞書の表示: 9d3. を
     参照してください。

single dispatch

     *note generic function: db9. の一種で実装は一つの引数の型により選択
     されます。

slice

     An object of type *note slice: 1db, used to describe a portion of a
     *note sequence: 904.  A slice object is created when using the
     *note slicing: 26c3. form of *note subscript notation: 25b8, with
     colons inside square brackets, such as in ‘variable_name[1:3:5]’.

soft deprecated

     A soft deprecated API should not be used in new code, but it is
     safe for already existing code to use it.  The API remains
     documented and tested, but will not be enhanced further.

     Soft deprecation, unlike normal deprecation, does not plan on
     removing the API and will not emit warnings.

     See PEP 387: Soft Deprecation(35).

special method

     (特殊メソッド) ある型に特定の操作、例えば加算をするために Python か
     ら暗黙に呼び出されるメソッド。この種類のメソッドは、メソッド名の最
     初と最後にアンダースコア 2 つがついています。特殊メソッドについては
     *note 特殊メソッド名: 1030. で解説されています。

standard library

     The collection of *note packages: 4c8, *note modules: 1c06. and
     *note extension modules: 2461. 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
     標準ライブラリ: 3fe.

     See also *note sys.stdlib_module_names: c1e. for a list of all
     possible standard library module names.

statement

     (文) 文はスイート (コードの"ブロック") に不可欠な要素です。文は
     *note 式: 25e3. かキーワードから構成されるもののどちらかです。後者
     には *note if: 32a.、*note while: 1ba5.、*note for: 329. があります
     。

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:
     25e0. and the *note typing: 10d. module.

stdlib

     An abbreviation of *note standard library: 3df.

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(): 979. when the
     reference is created and released with *note Py_DECREF(): 97a. when
     the reference is deleted.

     The *note Py_NewRef(): c74. function can be used to create a strong
     reference to an object.  Usually, the *note Py_DECREF(): 97a.
     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: 60a.

添字

     The expression in square brackets of a *note subscription
     expression: 25b8, for example, the ‘3’ in ‘items[3]’.  Usually used
     to select an element of a container.  Also called a *note key:
     25f8. when subscripting a *note mapping: 1579, or an *note index:
     25f7. when subscripting a *note sequence: 904.

synchronization primitive

     A basic building block for coordinating (synchronizing) the
     execution of multiple threads to ensure *note thread-safe: 5d5c.
     access to shared resources.  Python's *note threading: f6. module
     provides several synchronization primitives including *note Lock:
     1a30, *note RLock: 2eb, *note Semaphore: 1516, *note Condition:
     1515, *note Event: 1518, and *note Barrier: 15a2.  Additionally,
     the *note queue: be. module provides multi-producer, multi-consumer
     queues that are especially useful in multithreaded programs.  These
     primitives help prevent *note race conditions: 2939. and coordinate
     thread execution.  See also *note lock: 2938.

t-string

t-strings

     String literals prefixed with ‘t’ or ‘T’ are commonly called
     "t-strings" which is short for *note template string literals:
     1a70.

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:
     1175, which are collectively referred to as "text encodings".

text file

     (テキストファイル) *note str: 1ea. オブジェクトを読み書きできる
     *note file object: 1581. です。 しばしば、テキストファイルは実際に
     バイト指向のデータストリームにアクセスし、 *note
     テキストエンコーディング: 27f3. を自動的に行います。 テキストファイ
     ルの例は、 *note sys.stdin: 94f, *note sys.stdout: ea0, *note
     io.StringIO: 12d8. インスタンスなどをテキストモード (‘'r'’ or
     ‘'w'’) で開いたファイルです。

     *note bytes-like オブジェクト: 43d. を読み書きできるファイルオブジ
     ェクトについては、 *note バイナリファイル: 227b. も参照してください
     。

thread state

     The information used by the *note CPython: ae8. 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: 1ac. at once.

     An *note attached thread state: 1ac. 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: 1ac.
     in that thread at any given moment.

     See *note Thread State and the Global Interpreter Lock: 58a6. 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: 5d5a. like *note locks: 2938. to
     protect shared mutable state, or is designed to avoid shared
     mutable state entirely.  In the *note free-threaded: 48e. build,
     built-in types like *note dict: 193, *note list: 4e0, and *note
     set: 432. 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: 2939. and
     *note data races: 293a. when used in multi-threaded programs.

トークン

     A small unit of source code, generated by the *note lexical
     analyzer: 24a4. (also called the 'tokenizer').  Names, numbers,
     strings, operators, newlines and similar are represented by tokens.

     The *note tokenize: 104. module exposes Python's lexical analyzer.
     The *note token: 103. 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__: 1865. attribute or can be retrieved with
     ‘type(obj)’.

type alias

     (型エイリアス) 型の別名で、型を識別子に代入して作成します。

     型エイリアスは *note 型ヒント: 25e0. を単純化するのに有用です。例え
     ば:

          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: 10d. と PEP 484(36) を参照してくださ
     い。

type hint

     (型ヒント) 変数、クラス属性、関数のパラメータや返り値の期待される型
     を指定する *note annotation: 410. です。

     Type hints are optional and are not enforced by Python but they are
     useful to *note static type checkers: 77b.  They can also aid IDEs
     with code completion and refactoring.

     グローバル変数、クラス属性、関数で、ローカル変数でないものの型ヒン
     トは *note typing.get_type_hints(): aa3. で取得できます。

     機能の説明がある *note typing: 10d. と PEP 484(37) を参照してくださ
     い。

universal newlines

     テキストストリームの解釈法の一つで、以下のすべてを行末と認識します:
     Unix の行末規定 ‘'\n'’、Windows の規定 ‘'\r\n'’、古い Macintosh の
     規定 ‘'\r'’。利用法について詳しくは、 PEP 278(38) と PEP 3116(39) 、
     さらに *note bytes.splitlines(): 283a. も参照してください。

variable annotation

     (変数アノテーション) 変数あるいはクラス属性の *note annotation:
     410. 。

     変数あるいはクラス属性に注釈を付けたときは、代入部分は任意です:

          class C:
              field: 'annotation'

     変数アノテーションは通常は *note 型ヒント: 25e0. のために使われます
     : 例えば、この変数は *note int: 32e. の値を取ることを期待されていま
     す:

          count: int = 0

     変数アノテーションの構文については *note 注釈付き代入文 (annotated
     assignment statements): 2720. 節で解説しています。

     機能の説明がある *note function annotation: 2225, PEP 484(40) , PEP
     526(41) を参照してください。また、アノテーションを利用するベストプ
     ラクティスとして *note アノテーションのベストプラクティス: bba. も
     参照してください。

virtual environment

     (仮想環境) 協調的に切り離された実行環境です。これにより Python ユー
     ザとアプリケーションは同じシステム上で動いている他の Python アプリ
     ケーションの挙動に干渉することなく Python パッケージのインストール
     と更新を行うことができます。

     *note venv: 11a. を参照してください。

virtual machine

     (仮想マシン) 完全にソフトウェアにより定義されたコンピュータ。
     Python の仮想マシンは、バイトコードコンパイラが出力した *note
     バイトコード: 6b9. を実行します。

walrus operator

     A light-hearted way to refer to the *note assignment expression:
     26f3. operator ‘:=’ because it looks a bit like a walrus if you
     turn your head.

Zen of Python

     (Pythonの悟り) Python を理解し利用する上での導きとなる、Python の設
     計原則と哲学をリストにしたものです。対話プロンプトで "‘import
     this’" とするとこのリストを読めます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0526/

   (3) https://peps.python.org/pep-0649/

   (4) https://peps.python.org/pep-0362/

   (5) https://peps.python.org/pep-0492/

   (6) https://peps.python.org/pep-0492/

   (7) https://peps.python.org/pep-0525/

   (8) https://peps.python.org/pep-0492/

   (9) https://peps.python.org/pep-0492/

   (10) https://peps.python.org/pep-0492/

   (11) https://gvanrossum.github.io/

   (12) https://peps.python.org/pep-0343/

   (13) https://peps.python.org/pep-0343/

   (14) https://peps.python.org/pep-0492/

   (15) https://peps.python.org/pep-0492/

   (16) https://www.python.org

   (17) https://peps.python.org/pep-0498/

   (18) https://peps.python.org/pep-0238/

   (19) https://peps.python.org/pep-0703/

   (20) https://peps.python.org/pep-0484/

   (21) https://peps.python.org/pep-0443/

   (22) https://peps.python.org/pep-0483/

   (23) https://peps.python.org/pep-0484/

   (24) https://peps.python.org/pep-0585/

   (25) https://peps.python.org/pep-0703/

   (26) https://peps.python.org/pep-0683/

   (27) https://peps.python.org/pep-0302/

   (28) https://peps.python.org/pep-0420/

   (29) https://peps.python.org/pep-0362/

   (30) https://peps.python.org/pep-0519/

   (31) https://peps.python.org/pep-0001/

   (32) https://peps.python.org/pep-0420/

   (33) https://peps.python.org/pep-0411/

   (34) https://peps.python.org/pep-3155/

   (35) https://peps.python.org/pep-0387/#soft-deprecation

   (36) https://peps.python.org/pep-0484/

   (37) https://peps.python.org/pep-0484/

   (38) https://peps.python.org/pep-0278/

   (39) https://peps.python.org/pep-3116/

   (40) https://peps.python.org/pep-0484/

   (41) https://peps.python.org/pep-0526/


File: python.info,  Node: このドキュメントについて,  Next: バグへの対処,  Prev: 用語集<2>,  Up: Top

13 このドキュメントについて
***************************

Pythonのドキュメントは、Sphinx(1) を使って、reStructuredText(2) のソース
から生成されています。 Sphinx はもともとPythonのために作られ、現在は独立
したプロジェクトとして保守されています。

ドキュメントとそのツール群の開発は、Python 自身と同様に完全にボランティ
アの努力です。 もしあなたが貢献したいなら、どのようにすればよいかについ
て *note バグへの対処: 523e. ページをご覧下さい。 新しいボランティアはい
つでも歓迎です!  （訳注: 日本語訳の問題については、 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 the CPython GitHub
repository(1) for a partial list of contributors.

Python コミュニティからの情報提供と貢献がなければこの素晴らしいドキュメ
ントは生まれませんでした - ありがとう!

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/graphs/contributors


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: 5d7b.

* 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: 75e.
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
     coordination teams.

   ---------- 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/translations/translating/#translation-coordinators


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 歴史とライセンス: 5d82.
を参照してください。


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: 5d88.

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: 5d89. 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<5>.
* cfuhash::
* libmpdec::
* W3C C14N test suite::
* mimalloc::
* asyncio: asyncio<17>.
* Global Unbounded Sequences (GUS): Global Unbounded Sequences GUS.
* Zstandard bindings::
* Profiling module::
* Pixi packages::


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: c0. 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: d4. 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: 74. 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: 106. 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: 137. 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: c9. モジュールは 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: 6b, *note posix: b2. and *note ssl: d8. 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: 12f. extension is built using an included copy of the
expat sources unless the build is configured *note -with-system-expat:
1d4a.:

     Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
     Copyright (c) 2001-2025 Expat maintainers

     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<5>,  Prev: expat,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.14 libffi
--------------

The ‘_ctypes’ C extension underlying the *note ctypes: 2d. 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<5>,  Next: cfuhash,  Prev: libffi,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.15 zlib
------------

The *note zlib: 13c. 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<5>,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.16 cfuhash
---------------

The implementation of the hash table used by the *note tracemalloc: 108.
で使用しているハッシュテーブルの実装は、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: 39. 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: eb. 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<17>,  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<17>,  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<17>,  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,  Next: Profiling module,  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: Profiling module,  Next: Pixi packages,  Prev: Zstandard bindings,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.23 Profiling module
------------------------

The ‘profiling’ module includes vendored third-party libraries in
‘Lib/profiling/sampling/_vendor/’ with the following licenses:

'd3-flamegraph'

The d3-flamegraph library is distributed under the Apache License,
Version 2.0.  See the OpenSSL section above for the full text of the
Apache License Version 2.0.

'd3.js'

The d3.js library contains the following notice:

     Copyright 2010-2021 Mike Bostock

     Permission to use, copy, modify, and/or distribute this software for any purpose
     with or without fee is hereby granted, provided that the above copyright notice
     and this permission notice appear in all copies.

     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: Pixi packages,  Prev: Profiling module,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.24 Pixi packages
---------------------

The Pixi package definitions found in ‘Tools/pixi-packages’ are derived
from ‘https://github.com/conda-forge/python-feedstock’ which contains
the following license:

     BSD-3-Clause license
     Copyright (c) 2015-2026, conda-forge 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 REGENTS 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: 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.
* crypt: 2b. Removed in 3.13.
* csv: 2c. Write and read tabular data to and from delimited
                        files.
* ctypes: 2d. A foreign function library for Python.
* curses: 2e. An interface to the curses library, providing
                        portable terminal handling.
* curses.ascii: 2f. Constants and set-membership functions for ASCII
                        characters.
* curses.panel: 30. A panel stack extension that adds depth to curses
                        windows.
* curses.textpad: 31. Emacs-like input editing in a curses window.
* dataclasses: 32. Generate special methods on user-defined classes.
* datetime: 33. Basic date and time types.
* dbm: 34. Interfaces to various Unix "database" formats.
* dbm.dumb: 35. Portable implementation of the simple DBM interface.
* dbm.gnu: 36. GNU database manager
* dbm.ndbm: 37. The New Database Manager
* dbm.sqlite3: 38. SQLite backend for dbm
* decimal: 39. Implementation of the General Decimal Arithmetic
                        Specification.
* difflib: 3a. Helpers for computing differences between objects.
* dis: 3b. Disassembler for Python bytecode.
* distutils: 3c. Removed in 3.12.
* doctest: 3d. Test pieces of code within docstrings.
* email: 3e. Package supporting the parsing,
                        manipulating, and generating email messages.
* email.charset: 3f. Character Sets
* email.contentmanager: 40. Storing and Retrieving Content from MIME Parts
* email.encoders: 41. Encoders for email message payloads.
* email.errors: 42. The exception classes used by the email package.
* email.generator: 43. Generate flat text email messages from a message
                        structure.
* email.header: 44. Representing non-ASCII headers
* email.headerregistry: 45. Automatic Parsing of headers based on the field name
* email.iterators: 46. Iterate over a message object tree.
* email.message: 47. The base class representing email messages.
* email.mime: 48. Build MIME messages.
* email.mime.application: 49.
* email.mime.audio: 4a.
* email.mime.base: 4b.
* email.mime.image: 4c.
* email.mime.message: 4d.
* email.mime.multipart: 4e.
* email.mime.nonmultipart: 4f.
* email.mime.text: 50.
* email.parser: 51. Parse flat text email messages to produce a message
                        object structure.
* email.policy: 52. Controlling the parsing and generating of messages
* email.utils: 53. Miscellaneous email package utilities.
* encodings: 54. Encodings package
* encodings.idna: 55. Internationalized Domain Names implementation
* encodings.mbcs: 56. Windows ANSI codepage
* encodings.utf_8_sig: 57. UTF-8 codec with BOM signature
* ensurepip: 58. Bootstrapping the "pip" installer into an existing
                        Python installation or virtual environment.
* enum: 59. Implementation of an enumeration class.
* errno: 5a. Standard errno system symbols.
* faulthandler: 5b. Dump the Python traceback.
* fcntl: 5c. The fcntl() and ioctl() system calls.
* filecmp: 5d. Compare files efficiently.
* fileinput: 5e. Loop over standard input or a list of files.
* fnmatch: 5f. Unix shell style filename pattern matching.
* fractions: 60. Rational numbers.
* ftplib: 61. FTP protocol client (requires sockets).
* functools: 62. Higher-order functions and operations on callable
                        objects.
* gc: 63. Interface to the cycle-detecting garbage collector.
* getopt: 64. Portable parser for command line options; support both
                        short and long option names.
* getpass: 65. Portable reading of passwords and retrieval of the
                        userid.
* gettext: 66. Multilingual internationalization services.
* glob: 67. Unix shell style pathname pattern expansion.
* graphlib: 68. Functionality to operate with graph-like structures
* grp: 69. The group database (getgrnam() and friends).
* gzip: 6a. Interfaces for gzip compression and decompression
                        using file objects.
* hashlib: 6b. Secure hash and message digest algorithms.
* heapq: 6c. Heap queue algorithm (a.k.a. priority queue).
* hmac: 6d. Keyed-Hashing for Message Authentication (HMAC)
                        implementation
* html: 6e. Helpers for manipulating HTML.
* html.entities: 6f. Definitions of HTML general entities.
* html.parser: 70. A simple parser that can handle HTML and XHTML.
* http: 71. HTTP status codes and messages
* http.client: 72. HTTP and HTTPS protocol client (requires sockets).
* http.cookiejar: 73. Classes for automatic handling of HTTP cookies.
* http.cookies: 74. Support for HTTP state management (cookies).
* http.server: 75. HTTP server and request handlers.
* idlelib: 76. Implementation package for the IDLE shell/editor.
* imaplib: 77. IMAP4 protocol client (requires sockets).
* imghdr: 78. Removed in 3.13.
* imp: 79. Removed in 3.12.
* importlib: 7a. The implementation of the import machinery.
* importlib.abc: 7b. Abstract base classes related to import
* importlib.machinery: 7c. Importers and path hooks
* importlib.metadata: 7d. Accessing package metadata
* importlib.resources: 7e. Package resource reading, opening, and
                        access
* importlib.resources.abc: 7f. Abstract base classes for resources
* importlib.util: 80. Utility code for importers
* inspect: 81. Extract information and source code from live objects.
* io: 82. Core tools for working with streams.
* ipaddress: 83. IPv4/IPv6 manipulation library.
* itertools: 84. Functions creating iterators for efficient looping.
* json: 85. Encode and decode the JSON format.
* json.tool: 86. A command-line interface to validate and pretty-print
                        JSON.
* keyword: 87. Test whether a string is a keyword in Python.
* linecache: 88. Provides random access to individual lines from text
                        files.
* locale: 89. Internationalization services.
* logging: 8a. Flexible event logging system for applications.
* logging.config: 8b. Configuration of the logging module.
* logging.handlers: 8c. Handlers for the logging module.
* lzma: 8d. A Python wrapper for the liblzma compression library.
* mailbox: 8e. Manipulate mailboxes in various formats
* mailcap: 8f. Removed in 3.13.
* marshal: 90. Convert Python objects to streams of bytes and back
                        (with different constraints).
* math: 91. Mathematical functions (sin() etc.).
* math.integer: 92. Integer-specific mathematics functions.
* 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. Pure Python profiler (deprecated).
* profiling: b5. Python profiling tools for performance analysis.
* profiling.sampling: b6. Statistical sampling profiler for Python processes.
* profiling.tracing: b7. Deterministic tracing profiler for Python programs.
* pstats: b8. Statistics object for analyzing profiler output.
* pty: b9. Pseudo-Terminal Handling for Unix.
* pwd: ba. The password database (getpwnam() and friends).
* py_compile: bb. Generate byte-code files from Python source files.
* pyclbr: bc. Supports information extraction for a Python module
                        browser.
* pydoc: bd. Documentation generator and online help system.
* queue: be. A synchronized queue class.
* quopri: bf. Encode and decode files using the MIME quoted-
                        printable encoding.
* random: c0. Generate pseudo-random numbers with various common
                        distributions.
* re: c1. Regular expression operations.
* readline: c2. GNU readline support for Python.
* reprlib: c3. Alternate repr() implementation with size limits.
* resource: c4. An interface to provide resource usage information on
                        the current process.
* rlcompleter: c5. Python identifier completion, suitable for the
                        GNU readline library.
* runpy: c6. Locate and run Python modules without importing them
                        first.
* sched: c7. General purpose event scheduler.
* secrets: c8. Generate secure random numbers for managing secrets.
* select: c9. Wait for I/O completion on multiple streams.
* selectors: ca. High-level I/O multiplexing.
* shelve: cb. Python object persistence.
* shlex: cc. Simple lexical analysis for Unix shell-like languages.
* shutil: cd. High-level file operations, including copying.
* signal: ce. Set handlers for asynchronous events.
* site: cf. Module responsible for site-specific configuration.
* sitecustomize: d0.
* smtpd: d1. Removed in 3.12.
* smtplib: d2. SMTP protocol client (requires sockets).
* sndhdr: d3. Removed in 3.13.
* socket: d4. Low-level networking interface.
* socketserver: d5. A framework for network servers.
* spwd: d6. Removed in 3.13.
* sqlite3: d7. A DB-API 2.0 implementation using SQLite 3.x.
* ssl: d8. TLS/SSL wrapper for socket objects
* stat: d9. Utilities for interpreting the results of
                        os.stat(), os.lstat() and os.fstat().
* statistics: da. Mathematical statistics functions
* string: db. Common string operations.
* string.templatelib: dc. Support for template string literals.
* stringprep: dd. String preparation, as per RFC 3453
* struct: de. Interpret bytes as packed binary data.
* subprocess: df. Subprocess management.
* sunau: e0. Removed in 3.13.
* symtable: e1. Interface to the compiler's internal symbol tables.
* sys: e2. Access system-specific parameters and functions.
* sys.monitoring: e3. Access and control event monitoring
* sysconfig: e4. Python's configuration information
* syslog: e5. An interface to the Unix syslog library routines.
* tabnanny: e6. Tool for detecting white space related problems in
                        Python source files in a directory tree.
* tarfile: e7. Read and write tar-format archive files.
* telnetlib: e8. Removed in 3.13.
* tempfile: e9. Generate temporary files and directories.
* termios: ea. POSIX style tty control.
* test: eb. Regression tests package containing the testing suite
                        for Python.
* test.regrtest: ec. Drives the regression test suite.
* test.support: ed. Support for Python's regression test suite.
* test.support.bytecode_helper: ee. Support tools for testing correct bytecode
                                generation.
* test.support.import_helper: ef. Support for import tests.
* test.support.os_helper: f0. Support for os tests.
* test.support.script_helper: f1. Support for Python's script execution tests.
* test.support.socket_helper: f2. Support for socket tests.
* test.support.threading_helper: f3. Support for threading tests.
* test.support.warnings_helper: f4. Support for warnings tests.
* textwrap: f5. Text wrapping and filling
* threading: f6. Thread-based parallelism.
* time: f7. Time access and conversions.
* timeit: f8. Measure the execution time of small code snippets.
* tkinter: f9. Interface to Tcl/Tk for graphical user interfaces
* tkinter.colorchooser: fa. Color choosing dialog
* tkinter.commondialog: fb. Tkinter base class for dialogs
* tkinter.dnd: fc. Tkinter drag-and-drop interface
* tkinter.filedialog: fd. Dialog classes for file selection
* tkinter.font: fe. Tkinter font-wrapping class
* tkinter.messagebox: ff. Various types of alert dialogs
* tkinter.scrolledtext: 100. Text widget with a vertical scroll bar.
* tkinter.simpledialog: 101. Simple dialog windows
* tkinter.ttk: 102. Tk themed widget set
* token: 103. Constants representing terminal nodes of the parse
                        tree.
* tokenize: 104. Lexical scanner for Python source code.
* tomllib: 105. Parse TOML files.
* trace: 106. Trace or track Python statement execution.
* traceback: 107. Print or retrieve a stack traceback.
* tracemalloc: 108. Trace memory allocations.
* tty: 109. Utility functions that perform common terminal control
                        operations.
* turtle: 10a. An educational framework for simple graphics
                        applications
* turtledemo: 10b. A viewer for example turtle scripts
* types: 10c. Names for built-in types.
* typing: 10d. Support for type hints (see :pep:'484').
* unicodedata: 10e. Access the Unicode Database.
* unittest: 10f. Unit testing framework for Python.
* unittest.mock: 110. Mock object library.
* urllib: 111.
* urllib.error: 112. Exception classes raised by urllib.request.
* urllib.parse: 113. Parse URLs into or assemble them from components.
* urllib.request: 114. Extensible library for opening URLs.
* urllib.response: 115. Response classes used by urllib.
* urllib.robotparser: 116. Load a robots.txt file and answer questions about
                        fetchability of other URLs.
* usercustomize: 117.
* uu: 118. Removed in 3.13.
* uuid: 119. UUID objects (universally unique identifiers)
                        according to RFC 9562
* venv: 11a. Creation of virtual environments.
* warnings: 11b. Issue warning messages and control their disposition.
* wave: 11c. Provide an interface to the WAV sound format.
* weakref: 11d. Support for weak references and weak dictionaries.
* webbrowser: 11e. Easy-to-use controller for web browsers.
* winreg: 11f. Routines and objects for manipulating the Windows
                        registry.
* winsound: 120. Access to the sound-playing machinery for Windows.
* wsgiref: 121. WSGI Utilities and Reference Implementation.
* wsgiref.handlers: 122. WSGI server/gateway base classes.
* wsgiref.headers: 123. WSGI response header tools.
* wsgiref.simple_server: 124. A simple WSGI HTTP server.
* wsgiref.types: 125. WSGI types for static type checking
* wsgiref.util: 126. WSGI environment utilities.
* wsgiref.validate: 127. WSGI conformance checker.
* xdrlib: 128. Removed in 3.13.
* xml: 129. Package containing XML processing modules
* xml.dom: 12a. Document Object Model API for Python.
* xml.dom.minidom: 12b. Minimal Document Object Model (DOM) implementation.
* xml.dom.pulldom: 12c. Support for building partial DOM trees from SAX
                        events.
* xml.etree.ElementInclude: 12d.
* xml.etree.ElementTree: 12e. Implementation of the ElementTree API.
* xml.parsers.expat: 12f. An interface to the Expat non-validating XML parser.
* xml.parsers.expat.errors: 130.
* xml.parsers.expat.model: 131.
* xml.sax: 132. Package containing SAX2 base classes and convenience
                        functions.
* xml.sax.handler: 133. Base classes for SAX event handlers.
* xml.sax.saxutils: 134. Convenience functions and classes for use with SAX.
* xml.sax.xmlreader: 135. Interface which SAX-compliant XML parsers must
                        implement.
* xmlrpc: 136. Server and client modules implementing XML-RPC.
* xmlrpc.client: 137. XML-RPC client access.
* xmlrpc.server: 138. Basic XML-RPC server implementations.
* zipapp: 139. Manage executable Python zip archives
* zipfile: 13a. Read and write ZIP-format archive files.
* zipimport: 13b. Support for importing Python modules from ZIP
                        archives.
* zlib: 13c. Low-level interface to compression and decompression
                        routines compatible with gzip.
* zoneinfo: 13d. 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   28)
* __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__() (object のメソッド):        基本的なカスタマイズ.
                                                             (line  315)
* __bool__() (オブジェクトメソッド):     コンテナをエミュレートする.
                                                             (line   46)
* __bound__ (typing.TypeVar の属性):     Building generic types and type aliases.
                                                             (line  175)
* __breakpointhook__ (sys モジュール):   sys --- システム固有のパラメーターと関数.
                                                             (line  453)
* __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)
* __call__() (argparse.Action のメソッド): Action クラス.    (line   28)
* __call__() (email.headerregistry.HeaderRegistry のメソッド): email headerregistry Custom Header Objects.
                                                             (line  386)
* __call__() (enum.EnumType のメソッド): データ型<2>.        (line   20)
* __call__() (object のメソッド):        呼び出し可能オブジェクトをエミュレートする.
                                                             (line    6)
* __call__() (operator モジュール):      operator --- 関数形式の標準演算子.
                                                             (line  228)
* __call__() (weakref.finalize のメソッド): weakref --- Weak references.
                                                             (line  285)
* __call__() (オブジェクトメソッド):     呼び出し call.      (line  152)
* __callback__ (weakref.ref の属性):     weakref --- Weak references.
                                                             (line  119)
* __cause__ (BaseException の属性):      例外コンテキスト.   (line    9)
* __cause__ (exception の属性):          raise 文.           (line   30)
* __cause__ (exception の属性) <1>:      例外コンテキスト.   (line    6)
* __cause__ (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   44)
* __ceil__() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  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)
* __closed__ (typing.TypedDict の属性):  Other special directives.
                                                             (line  507)
* __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  208)
* __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.ParamSpec の属性): Building generic types and type aliases.
                                                             (line  513)
* __contravariant__ (typing.TypeVar の属性): Building generic types and type aliases.
                                                             (line  163)
* __contravariant__ (typing.TypeVarTuple の属性): Building generic types and type aliases.
                                                             (line  371)
* __copy__() (コピープロトコル):         copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   81)
* __covariant__ (typing.ParamSpec の属性): Building generic types and type aliases.
                                                             (line  508)
* __covariant__ (typing.TypeVar の属性): Building generic types and type aliases.
                                                             (line  159)
* __covariant__ (typing.TypeVarTuple の属性): Building generic types and type aliases.
                                                             (line  364)
* __debug__:                             assert 文.          (line   22)
* __debug__ (組み込み変数):              組み込み定数.       (line   68)
* __deepcopy__() (コピープロトコル):     copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   81)
* __default__ (typing.ParamSpec の属性): Building generic types and type aliases.
                                                             (line  525)
* __default__ (typing.TypeVar の属性):   Building generic types and type aliases.
                                                             (line  218)
* __default__ (typing.TypeVarTuple の属性): Building generic types and type aliases.
                                                             (line  385)
* __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   85)
* __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  453)
* __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   58)
* __eq__() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  154)
* __eq__() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line  162)
* __eq__() (memoryview のメソッド):      メモリビュー.       (line  114)
* __eq__() (object のメソッド):          基本的なカスタマイズ.
                                                             (line  175)
* __eq__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   24)
* __eq__() (インスタンスメソッド):       比較<2>.            (line   49)
* __excepthook__ (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line  453)
* __excepthook__ (threading モジュール): リファレンス<2>.    (line   63)
* __exit__() (contextmanager のメソッド): コンテキストマネージャ型.
                                                             (line   30)
* __exit__() (object のメソッド):        with文とコンテキストマネージャ.
                                                             (line   27)
* __exit__() (winreg.PyHKEY のメソッド): レジストリハンドルオブジェクト.
                                                             (line   58)
* __extra_items__ (typing.TypedDict の属性): Other special directives.
                                                             (line  512)
* __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   93)
* __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  789)
* __format__() (datetime.date のメソッド): date objects.     (line  335)
* __format__() (datetime.datetime のメソッド): datetime objects.
                                                             (line  766)
* __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  693)
* __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  381)
* __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  155)
* __getitem__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line   71)
* __getitem__() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  204)
* __getitem__() (re.Match のメソッド):   Match objects.      (line   87)
* __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.ParamSpec の属性): Building generic types and type aliases.
                                                             (line  518)
* __infer_variance__ (typing.TypeVar の属性): Building generic types and type aliases.
                                                             (line  168)
* __infer_variance__ (typing.TypeVarTuple の属性): Building generic types and type aliases.
                                                             (line  378)
* __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 1269)
* __inv__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  111)
* __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__() (iterator のメソッド):      イテレータ型.       (line   29)
* __iter__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  124)
* __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)
* __lazy_modules__:                      Compatibility via __lazy_modules__.
                                                             (line    6)
* __lazy_modules__ (module attribute):   モジュール<3>.      (line   21)
* __lazy_modules__ (module の属性):      Other writable attributes on module objects.
                                                             (line   31)
* __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__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  213)
* __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 frozendict.
                                                             (line  111)
* __missing__() (collections.defaultdict のメソッド): defaultdict オブジェクト.
                                                             (line   27)
* __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__ (sentinel の属性):          組み込み関数.       (line 1813)
* __module__ (type の属性):              Special attributes. (line   18)
* __module__ (typing.NewType の属性):    Other special directives.
                                                             (line  106)
* __module__ (typing.TypeAliasType の属性): Building generic types and type aliases.
                                                             (line  636)
* __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  499)
* __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 1658)
* __name__ (sentinel の属性):            組み込み関数.       (line 1809)
* __name__ (type の属性):                Special attributes. (line   10)
* __name__ (typing.NewType の属性):      Other special directives.
                                                             (line  110)
* __name__ (typing.ParamSpec の属性):    Building generic types and type aliases.
                                                             (line  504)
* __name__ (typing.TypeAliasType の属性): Building generic types and type aliases.
                                                             (line  616)
* __name__ (typing.TypeVar の属性):      Building generic types and type aliases.
                                                             (line  155)
* __name__ (typing.TypeVarTuple の属性): Building generic types and type aliases.
                                                             (line  360)
* __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  279)
* __new__() (string.templatelib.Template のメソッド): 型.    (line  106)
* __next__() (csv.csvreader のメソッド): reader オブジェクト.
                                                             (line   10)
* __next__() (generator のメソッド):     ジェネレータ-イテレータメソッド.
                                                             (line   12)
* __next__() (iterator のメソッド):      イテレータ型.       (line   37)
* __not__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line   47)
* __notes__ (BaseException の属性):      基底クラス.         (line   56)
* __notes__ (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   64)
* __objclass__ (object の属性):          デスクリプタ descriptor の実装.
                                                             (line   50)
* __optional_keys__ (typing.TypedDict の属性): Other special directives.
                                                             (line  453)
* __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  728)
* __qualname__ (definition の属性):      特殊属性.           (line   15)
* __qualname__ (function の属性):        Special writable attributes.
                                                             (line   20)
* __qualname__ (type の属性):            Special attributes. (line   14)
* __qualname__ (typing.TypeAliasType の属性): Building generic types and type aliases.
                                                             (line  624)
* __radd__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __rand__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __rdivmod__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   41)
* __readonly_keys__ (typing.TypedDict の属性): Other special directives.
                                                             (line  491)
* __reduce__() (object のメソッド):      クラスインスタンスの pickle 化.
                                                             (line  124)
* __reduce_ex__() (object のメソッド):   クラスインスタンスの pickle 化.
                                                             (line  183)
* __release_buffer__() (object のメソッド): Emulating buffer types.
                                                             (line   32)
* __replace__() (replace protocol):      copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   99)
* __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  449)
* __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   99)
* __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 1565)
* __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 2124)
* __stdin__ (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 2124)
* __stdout__ (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 2124)
* __str__() (datetime.date のメソッド):  date objects.       (line  307)
* __str__() (datetime.datetime のメソッド): datetime objects.
                                                             (line  736)
* __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  442)
* __str__() (email.headerregistry.Group のメソッド): email headerregistry Custom Header Objects.
                                                             (line  477)
* __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  114)
* __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  424)
* __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  648)
* __unpacked__ (genericalias の属性):    GenericAlias オブジェクトの特別な属性.
                                                             (line   41)
* __unraisablehook__ (sys モジュール):   sys --- システム固有のパラメーターと関数.
                                                             (line  453)
* __value__ (typing.TypeAliasType の属性): Building generic types and type aliases.
                                                             (line  660)
* __xor__() (enum.Flag のメソッド):      データ型<2>.        (line  551)
* __xor__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __xor__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  176)
* _, identifiers:                        ソフトキーワード.   (line   29)
* _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  229)
* _clear_type_cache() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  218)
* _current_exceptions() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  256)
* _current_frames() (sys モジュール):    sys --- システム固有のパラメーターと関数.
                                                             (line  237)
* _debugmallocstats() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  312)
* _emscripten_info (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  377)
* _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  260)
* _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  968)
* _getframemodulename() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  982)
* _getvalue() (multiprocessing.managers.BaseProxy のメソッド): Proxy オブジェクト.
                                                             (line  135)
* _handle (ctypes.CDLL の属性):          共有ライブラリをロードする.
                                                             (line  129)
* _ignore_ (enum.Enum の属性):           データ型<2>.        (line  188)
* _incompatible_extension_module_restrictions() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  167)
* _inittab (C struct):                   モジュールのインポート<2>.
                                                             (line  297)
* _inittab.initfunc (C member):          モジュールのインポート<2>.
                                                             (line  309)
* _inittab.name (C member):              モジュールのインポート<2>.
                                                             (line  305)
* _is_gil_enabled() (sys モジュール):    sys --- システム固有のパラメーターと関数.
                                                             (line 1298)
* _is_immortal() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 1386)
* _is_interned() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 1402)
* _jit (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line 1317)
* _jit.is_active() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line 1345)
* _jit.is_available() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1328)
* _jit.is_enabled() (sys モジュール):    sys --- システム固有のパラメーターと関数.
                                                             (line 1336)
* _layout_ (ctypes.Structure の属性):    構造化データ型.     (line  136)
* _leave_task() (asyncio モジュール):    Task lifetime support.
                                                             (line   30)
* _length_ (ctypes.Array の属性):        配列とポインタ.     (line   18)
* _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  133)
* _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   39)
* _Py_c_abs (C function):                C 構造体としての複素数.
                                                             (line   65)
* _Py_c_diff (C function):               C 構造体としての複素数.
                                                             (line   23)
* _Py_c_neg (C function):                C 構造体としての複素数.
                                                             (line   30)
* _Py_c_pow (C function):                C 構造体としての複素数.
                                                             (line   53)
* _Py_c_prod (C function):               C 構造体としての複素数.
                                                             (line   36)
* _Py_c_quot (C function):               C 構造体としての複素数.
                                                             (line   43)
* _Py_c_sum (C function):                C 構造体としての複素数.
                                                             (line   16)
* _Py_InitializeMain (C function):       Multi-Phase Initialization Private Provisional API.
                                                             (line   45)
* _Py_NoneStruct (C var):                Allocating objects on the heap.
                                                             (line  142)
* _Py_TPFLAGS_HAVE_VECTORCALL (C macro): PyTypeObject スロット.
                                                             (line  869)
* _PyBytes_Resize (C function):          バイトオブジェクト<2>.
                                                             (line  219)
* _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_IsSpecializationEnabled (C function): 高水準 API<2>.
                                                             (line  108)
* _PyInterpreterState_SetEvalFrameAllowSpecialization (C function): 高水準 API<2>.
                                                             (line   92)
* _PyInterpreterState_SetEvalFrameFunc (C function): 高水準 API<2>.
                                                             (line   83)
* _PyObject_GetDictPtr (C function):     オブジェクトプロトコル object protocol.
                                                             (line  332)
* _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  128)
* _register_task() (asyncio モジュール): Task lifetime support.
                                                             (line   10)
* _replace() (collections.somenamedtuple のメソッド): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line  127)
* _setroot() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   14)
* _SimpleCData (ctypes のクラス):        基本データ型<2>.    (line    6)
* _structure() (email.iterators モジュール): email iterators イテレータ.
                                                             (line   44)
* _type_ (ctypes._Pointer の属性):       配列とポインタ.     (line   54)
* _type_ (ctypes._SimpleCData の属性):   基本データ型<2>.    (line   32)
* _type_ (ctypes.Array の属性):          配列とポインタ.     (line   24)
* _unregister_task() (asyncio モジュール): Task lifetime support.
                                                             (line   16)
* _value_ (enum.Enum の属性):            データ型<2>.        (line  156)
* _write() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  109)
* _xoptions (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 2310)
* - (負符号);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 form.
                                                             (line   19)
* , (comma);argument list:               Formal subscription grammar.
                                                             (line   16)
* , (comma);expression list:             リスト表示.         (line    6)
* , (comma);expression list <1>:         集合表示.           (line    6)
* , (comma);expression list <2>:         式のリスト.         (line    6)
* , (comma);expression list <3>:         assert 文.          (line    6)
* , (comma);expression list <4>:         クラス定義.         (line    6)
* , (comma);identifier list:             global 文.          (line    6)
* , (comma);identifier list <1>:         nonlocal 文.        (line    6)
* , (comma);import statement:            import 文.          (line    6)
* , (comma);in dictionary displays:      辞書表示.           (line    6)
* , (comma);in target list:              代入文 assignment statement.
                                                             (line   34)
* , (comma);parameter list:              関数定義.           (line    6)
* , (comma);with statement:              with 文.            (line    6)
* , (comma);スライス:                    Subscriptions and slicings.
                                                             (line   70)
* , (カンマ);文字列のフォーマットで:     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  973)
* ; (コロン);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  973)
* ! (pdb command):                       Debugger commands.  (line  406)
* ! (エクスクラメーション);curses モジュール内: curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  226)
* ! (エクスクラメーション);glob 形式のワイルドカード: glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* ! (エクスクラメーション);glob 形式のワイルドカード <1>: fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   15)
* ! (エクスクラメーション);in a command interpreter: Cmdオブジェクト.
                                                             (line   26)
* ! (エクスクラメーション);in formatted string literal: Raw string literals.
                                                             (line   25)
* ! (エクスクラメーション);in struct format strings: バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* ! (エクスクラメーション);文字列のフォーマットで: Format string syntax.
                                                             (line   13)
* ! f-string:                            文字列メソッド<2>.  (line  973)
* ! formatted string literal:            文字列メソッド<2>.  (line  973)
* ! 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: Type Codes.
                                                             (line  111)
* ? (クエスチョンマーク);in struct format strings <1>: Type Codes.
                                                             (line  207)
* ? (クエスチョンマーク);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   60)
* ...;ellipsisリテラル <3>:              ヌルオブジェクト.   (line   12)
* ...;ellipsisリテラル <4>:              呼び出し可能オブジェクトのアノテーション.
                                                             (line   28)
* ...;ellipsisリテラル <5>:              タプルのアノテーション.
                                                             (line   42)
* ...;ellipsisリテラル <6>:              特殊形式.           (line   86)
* ...;ellipsisリテラル <7>:              用語集<2>.          (line   20)
* ...;in doctests:                       オプションフラグ.   (line   46)
* ...;interpreter prompt:                docstring 内の実行例をどのように認識するのか?.
                                                             (line   26)
* ...;interpreter prompt <1>:            sys --- システム固有のパラメーターと関数.
                                                             (line 1666)
* ...;placeholder:                       textwrap --- テキストの折り返しと詰め込み.
                                                             (line  272)
* ...;placeholder <1>:                   PrettyPrinter objects.
                                                             (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 form.
                                                             (line    6)
* [] (角カッコ);glob 形式のワイルドカード: glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* [] (角カッコ);glob 形式のワイルドカード <1>: fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   15)
* [] (角カッコ);in assignment target list: 代入文 assignment statement.
                                                             (line   34)
* [] (角カッコ);in regular expressions:  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  973)
* {} (波括弧);in regular expressions:    Regular expression syntax.
                                                             (line  111)
* {} (波括弧);set expression:            集合表示.           (line    6)
* {} (波括弧);文字列のフォーマットで:    Format string syntax.
                                                             (line   13)
* @ (at);class definition:               クラス定義.         (line   47)
* @ (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  225)
* \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   57)
* # (hash);文字列のフォーマットで:       Format specification mini-language.
                                                             (line   99)
* % (パーセント);datetime format:        timezone objects.   (line   72)
* % (パーセント);datetime format <1>:    関数<5>.            (line  333)
* % (パーセント);datetime format <2>:    関数<5>.            (line  490)
* % (パーセント);environment variables expansion (Windows): os path --- 一般的なパス名操作.
                                                             (line  177)
* % (パーセント);environment variables expansion (Windows) <1>: 関数<14>.
                                                             (line  245)
* % (パーセント);interpolation in configuration files: 値の補間.
                                                             (line   10)
* % (パーセント);printf 形式の書式化:    printf 形式の文字列書式化.
                                                             (line    6)
* % (パーセント);printf 形式の書式化 <1>: printf 形式での bytes の書式化.
                                                             (line    6)
* %=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* ''parser'':                            字句解析.           (line    6)
* ^ (キャレット);curses モジュール内:    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  226)
* ^ (キャレット);in regular expressions: 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  972)
* = (等号);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 1666)
* | (縦棒);in regular expressions:       Regular expression syntax.
                                                             (line  217)
* |=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* ~ (チルダ);home directory expansion:   os path --- 一般的なパス名操作.
                                                             (line  151)
* $ (ダラー);environment variables expansion: os path --- 一般的なパス名操作.
                                                             (line  177)
* $ (ダラー);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_ascii85() (binascii モジュール):   binascii --- バイナリ と ASCII 間の変換.
                                                             (line  116)
* a2b_base32() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  227)
* a2b_base64() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line   41)
* a2b_base85() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  180)
* a2b_hex() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line  358)
* a2b_qp() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line  284)
* a2b_uu() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   25)
* a85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   65)
* a85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   37)
* ABC (abc のクラス):                    abc --- 抽象基底クラス.
                                                             (line   27)
* ABCMeta (abc のクラス):                abc --- 抽象基底クラス.
                                                             (line   52)
* ABDAY_1 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  232)
* ABDAY_2 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  232)
* ABDAY_3 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  232)
* ABDAY_4 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  232)
* ABDAY_5 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  232)
* ABDAY_6 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  232)
* ABDAY_7 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  232)
* abi_info (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line   13)
* abiflags (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line   54)
* ABMON_1 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* ABMON_10 (locale モジュール):          locale --- 国際化サービス.
                                                             (line  257)
* ABMON_11 (locale モジュール):          locale --- 国際化サービス.
                                                             (line  257)
* ABMON_12 (locale モジュール):          locale --- 国際化サービス.
                                                             (line  257)
* ABMON_2 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* ABMON_3 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* ABMON_4 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* ABMON_5 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* ABMON_6 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* ABMON_7 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* ABMON_8 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* ABMON_9 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  257)
* abort (C function):                    プロセス制御.       (line    7)
* ABORT (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  147)
* 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  162)
* ABOVE_NORMAL_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   68)
* above() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (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  314)
* AbsolutePathError:                     tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  300)
* 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   13)
* access() (os モジュール):              ファイルとディレクトリ.
                                                             (line   50)
* accumulate() (itertools モジュール):   Itertool関数.       (line   10)
* ACK (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   36)
* aclose() (agen のメソッド):            非同期ジェネレータイテレータメソッド.
                                                             (line   60)
* aclose() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  694)
* aclosing() (contextlib モジュール):    ユーティリティ.     (line  189)
* acos() (cmath モジュール):             三角関数<2>.        (line    6)
* acos() (math モジュール):              三角関数.           (line    6)
* acosh() (cmath モジュール):            双曲線関数<2>.      (line    6)
* acosh() (math モジュール):             双曲線関数.         (line    9)
* acquire() (_thread.lock のメソッド):   _thread --- 低水準なスレッド API.
                                                             (line  143)
* 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 1982)
* active_children() (multiprocessing モジュール): その他<5>. (line    6)
* active_count() (threading モジュール): リファレンス<2>.    (line    8)
* actual() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   47)
* Add (ast のクラス):                    式 expression<2>.   (line   55)
* add_alias() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  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_cgi_vars() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  135)
* add_charset() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  168)
* add_codec() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  207)
* add_cookie_header() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   12)
* add_dll_directory() (os モジュール):   プロセス管理.       (line   24)
* add_done_callback() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   83)
* add_done_callback() (asyncio.Task のメソッド): Task object.
                                                             (line  102)
* add_done_callback() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   67)
* add_fallback() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   31)
* add_flag() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  127)
* add_flag() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   81)
* add_flag() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   78)
* add_flag() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   77)
* add_folder() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   73)
* add_folder() (mailbox.MH のメソッド):  MH オブジェクト.    (line   47)
* add_get_handler() (email.contentmanager.ContentManager のメソッド): email contentmanager Managing MIME Content.
                                                             (line   74)
* add_handler() (urllib.request.OpenerDirector のメソッド): OpenerDirector オブジェクト.
                                                             (line    8)
* add_header() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  261)
* add_header() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  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_parser() (argparse._SubParsersAction のメソッド): Subcommands.
                                                             (line  202)
* add_password() (urllib.request.HTTPPasswordMgr のメソッド): HTTPPasswordMgr オブジェクト.
                                                             (line    9)
* add_password() (urllib.request.HTTPPasswordMgrWithPriorAuth のメソッド): HTTPPasswordMgrWithPriorAuth オブジェクト.
                                                             (line   10)
* add_reader() (asyncio.loop のメソッド): ファイル記述子の監視.
                                                             (line    6)
* add_related() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  628)
* add_section() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  117)
* add_section() (configparser.RawConfigParser のメソッド): RawConfigParser オブジェクト.
                                                             (line   36)
* add_sequence() (mailbox.MHMessage のメソッド): MHMessage オブジェクト.
                                                             (line   40)
* add_set_handler() (email.contentmanager.ContentManager のメソッド): email contentmanager Managing MIME Content.
                                                             (line   79)
* add_signal_handler() (asyncio.loop のメソッド): Unix シグナル.
                                                             (line    6)
* add_subparsers() (argparse.ArgumentParser のメソッド): Subcommands.
                                                             (line    6)
* add_type() (mimetypes モジュール):     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  124)
* 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   67)
* add() (mailbox.Maildir のメソッド):    Maildir オブジェクト.
                                                             (line  191)
* add() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line   88)
* add() (pstats.Stats のメソッド):       The Stats class.    (line   34)
* add() (set のメソッド):                set（集合）型 --- set frozenset.
                                                             (line  197)
* add() (tarfile.TarFile のメソッド):    TarFile オブジェクト.
                                                             (line  276)
* add() (tkinter.ttk.Notebook のメソッド): ttk Notebook.     (line    8)
* addAsyncCleanup() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  975)
* addaudithook() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line   66)
* addch() (curses.window のメソッド):    Window オブジェクト.
                                                             (line   11)
* addClassCleanup() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  898)
* addCleanup() (unittest.TestCase のメソッド): テストクラス. (line  859)
* 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 オブジェクト.
                                                             (line   24)
* AddPackagePath() (modulefinder モジュール): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   16)
* addr_spec (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  436)
* Address (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  399)
* address (email.headerregistry.SingleAddressHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  216)
* 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  191)
* addresses (email.headerregistry.Group の属性): email headerregistry Custom Header Objects.
                                                             (line  472)
* AddressHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  176)
* addressof() (ctypes モジュール):       ユーティリティー関数.
                                                             (line    6)
* AddressValueError:                     Custom Exceptions.  (line    9)
* addshape() (turtle モジュール):        設定と特殊なメソッド.
                                                             (line   70)
* addsitedir() (site モジュール):        モジュールの内容<7>.
                                                             (line   52)
* addSkip() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  387)
* addstr() (curses.window のメソッド):   Window オブジェクト.
                                                             (line   31)
* addSubTest() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  413)
* addSuccess() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  381)
* addTest() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   25)
* addTests() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   30)
* addTypeEqualityFunc() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  682)
* 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_combine() (zlib モジュール):   zlib --- gzip 互換の圧縮.
                                                             (line   45)
* adler32() (zlib モジュール):           zlib --- gzip 互換の圧縮.
                                                             (line   30)
* AF_ALG (socket モジュール):            定数<8>.            (line  275)
* AF_BLUETOOTH (socket モジュール):      定数<8>.            (line  310)
* AF_CAN (socket モジュール):            定数<8>.            (line  137)
* AF_DIVERT (socket モジュール):         定数<8>.            (line  214)
* AF_HYPERV (socket モジュール):         定数<8>.            (line  448)
* AF_INET (socket モジュール):           定数<8>.            (line   11)
* AF_INET6 (socket モジュール):          定数<8>.            (line   11)
* AF_LINK (socket モジュール):           定数<8>.            (line  299)
* AF_PACKET (socket モジュール):         定数<8>.            (line  224)
* AF_QIPCRTR (socket モジュール):        定数<8>.            (line  409)
* AF_RDS (socket モジュール):            定数<8>.            (line  246)
* AF_UNIX (socket モジュール):           定数<8>.            (line   11)
* AF_UNSPEC (socket モジュール):         定数<8>.            (line   21)
* AF_VSOCK (socket モジュール):          定数<8>.            (line  286)
* alarm() (signal モジュール):           モジュールの内容<4>.
                                                             (line  296)
* ALERT_DESCRIPTION_HANDSHAKE_FAILURE (ssl モジュール): 定数<9>.
                                                             (line  524)
* ALERT_DESCRIPTION_INTERNAL_ERROR (ssl モジュール): 定数<9>.
                                                             (line  524)
* AlertDescription (ssl のクラス):       定数<9>.            (line  538)
* algorithm (sys.hash_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 1140)
* algorithms_available (hashlib モジュール): 属性.           (line   18)
* algorithms_guaranteed (hashlib モジュール): 属性.          (line    8)
* alias (ast のクラス):                  インポート.         (line   41)
* alias (pdb command):                   Debugger commands.  (line  378)
* alignment() (ctypes モジュール):       ユーティリティー関数.
                                                             (line   14)
* alive (weakref.finalize の属性):       weakref --- Weak references.
                                                             (line  302)
* ALL_BUT_LAST (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  457)
* 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   81)
* allocfunc (C type):                    Slot Type typedefs. (line    6)
* ALLOW_MISSING (os.path モジュール):    os path --- 一般的なパス名操作.
                                                             (line  464)
* allow_reuse_address (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (line   93)
* allowed_domains() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   64)
* ALT_DIGITS (locale モジュール):        locale --- 国際化サービス.
                                                             (line  337)
* alt() (curses.ascii モジュール):       curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  218)
* 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:                  例外<13>.           (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)
* 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 2267)
* apilevel (sqlite3 モジュール):         モジュール定数.     (line   64)
* apop() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   40)
* append_history_file() (readline モジュール): 履歴ファイル. (line   27)
* append() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  157)
* append() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   35)
* 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   88)
* appendChild() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  114)
* appendleft() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   39)
* AppleFrameworkLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  458)
* application_uri() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line   33)
* apply_async() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line   78)
* apply_defaults() (inspect.BoundArguments のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  391)
* apply() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line   70)
* APRIL (calendar モジュール):           calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  517)
* architecture() (platform モジュール):  Cross platform.     (line    6)
* archive (zipimport.zipimporter の属性): zipimporter オブジェクト.
                                                             (line   86)
* AREGTYPE (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  339)
* 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  125)
* args (typing.ParamSpec の属性):        Building generic types and type aliases.
                                                             (line  489)
* 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:                         例外<11>.           (line    6)
* ArgumentError <1>:                     例外<12>.           (line    6)
* ArgumentParser (argparse のクラス):    ArgumentParser オブジェクト.
                                                             (line    6)
* arguments (ast のクラス):              関数およびクラス定義.
                                                             (line   49)
* arguments (inspect.BoundArguments の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  356)
* ArgumentTypeError:                     例外<12>.           (line   14)
* argv (in module sys):                  プロセスワイドのパラメータ.
                                                             (line   90)
* argv (in module sys) <1>:              PyConfig.           (line  126)
* argv (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line  110)
* ArithmeticError:                       基底クラス.         (line   68)
* array (array のクラス):                array --- 効率的な数値配列.
                                                             (line  124)
* Array (ctypes のクラス):               配列とポインタ.     (line    6)
* ARRAY() (ctypes モジュール):           配列とポインタ.     (line   31)
* Array() (multiprocessing モジュール):  共有 ctypes オブジェクト.
                                                             (line   42)
* Array() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  216)
* Array() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   51)
* arrays:                                array --- 効率的な数値配列.
                                                             (line    6)
* arraysize (sqlite3.Cursor の属性):     Cursor オブジェクト.
                                                             (line  174)
* AS pattern, OR pattern, capture pattern, wildcard pattern: パターン.
                                                             (line    6)
* as_bytes() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  107)
* as_bytes() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  107)
* as_completed() (asyncio モジュール):   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   75)
* 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  209)
* ASCII85_ALPHABET (binascii モジュール): binascii --- バイナリ と ASCII 間の変換.
                                                             (line  425)
* asctime() (time モジュール):           関数<5>.            (line    6)
* asdict() (dataclasses モジュール):     モジュールの内容<6>.
                                                             (line  344)
* asend() (agen のメソッド):             非同期ジェネレータイテレータメソッド.
                                                             (line   27)
* asin() (cmath モジュール):             三角関数<2>.        (line   12)
* asin() (math モジュール):              三角関数.           (line   10)
* asinh() (cmath モジュール):            双曲線関数<2>.      (line   11)
* asinh() (math モジュール):             双曲線関数.         (line   13)
* askcolor() (tkinter.colorchooser モジュール): tkinter colorchooser --- カラー選択ダイアログ.
                                                             (line   17)
* askdirectory() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   53)
* askfloat() (tkinter.simpledialog モジュール): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   14)
* askinteger() (tkinter.simpledialog モジュール): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   14)
* askokcancel() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  119)
* askopenfile() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   30)
* askopenfilename() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   41)
* askopenfilenames() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   41)
* askopenfiles() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   30)
* askquestion() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  113)
* askretrycancel() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  126)
* asksaveasfile() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   36)
* asksaveasfilename() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   48)
* askstring() (tkinter.simpledialog モジュール): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   14)
* askyesno() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  133)
* askyesnocancel() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  139)
* Assert (ast のクラス):                 文 Statements.      (line  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  576)
* assertCountEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  632)
* assertDictEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  770)
* assertEndsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  657)
* assertEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  183)
* assertFalse() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  206)
* assertGreater() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  600)
* assertGreaterEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  600)
* assertHasAttr() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  667)
* 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  600)
* assertLessEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  600)
* assertListEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  747)
* assertLogs() (unittest.TestCase のメソッド): テストクラス. (line  452)
* assertMultiLineEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  723)
* assertNoLogs() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  503)
* assertNotAlmostEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  576)
* assertNotEndsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  659)
* assertNotEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  201)
* assertNotHasAttr() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  669)
* 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  614)
* assertNotStartsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  649)
* assertRaises() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  295)
* assertRaisesRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  337)
* assertRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  614)
* assertSequenceEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  733)
* assertSetEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  758)
* assertStartsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  647)
* assertTrue() (unittest.TestCase のメソッド): テストクラス. (line  206)
* assertTupleEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  747)
* assertWarns() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  364)
* assertWarnsRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  417)
* 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   32)
* ast コマンドラインオプション; -feature-version: コマンドラインでの使用<8>.
                                                             (line   41)
* ast コマンドラインオプション; -h:      コマンドラインでの使用<8>.
                                                             (line   18)
* ast コマンドラインオプション; -help:   コマンドラインでの使用<8>.
                                                             (line   18)
* ast コマンドラインオプション; -i:      コマンドラインでの使用<8>.
                                                             (line   36)
* ast コマンドラインオプション; -include-attributes: コマンドラインでの使用<8>.
                                                             (line   32)
* ast コマンドラインオプション; -indent: コマンドラインでの使用<8>.
                                                             (line   36)
* ast コマンドラインオプション; -m:      コマンドラインでの使用<8>.
                                                             (line   22)
* ast コマンドラインオプション; -mode:   コマンドラインでの使用<8>.
                                                             (line   22)
* ast コマンドラインオプション; -no-type-comments: コマンドラインでの使用<8>.
                                                             (line   28)
* ast コマンドラインオプション; -O:      コマンドラインでの使用<8>.
                                                             (line   48)
* ast コマンドラインオプション; -optimize: コマンドラインでの使用<8>.
                                                             (line   48)
* ast コマンドラインオプション; -show-empty: コマンドラインでの使用<8>.
                                                             (line   55)
* astimezone() (datetime.datetime のメソッド): datetime objects.
                                                             (line  483)
* astuple() (dataclasses モジュール):    モジュールの内容<6>.
                                                             (line  376)
* async for;in comprehensions:           リスト、集合、辞書の表示.
                                                             (line   14)
* AsyncContextDecorator (contextlib のクラス): ユーティリティ.
                                                             (line  486)
* AsyncContextManager (typing のクラス): Aliases to contextlib ABCs.
                                                             (line   25)
* asynccontextmanager() (contextlib モジュール): ユーティリティ.
                                                             (line   93)
* AsyncExitStack (contextlib のクラス):  ユーティリティ.     (line  659)
* 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 iterator:       用語集<2>.          (line  110)
* asynchronous generator;asynchronous iterator: 非同期ジェネレータ関数 asynchronous generator function.
                                                             (line    6)
* asynchronous generator;関数:           非同期ジェネレータ関数 asynchronous generator function.
                                                             (line    6)
* asynchronous iterable:                 用語集<2>.          (line  126)
* asynchronous iterator:                 用語集<2>.          (line  133)
* 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  953)
* asyncTearDown() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  962)
* AsyncWith (ast のクラス):              async と await.     (line   34)
* AT (token モジュール):                 token --- Python 解析木で使われる定数.
                                                             (line  329)
* at_eof() (asyncio.StreamReader のメソッド): StreamReader.  (line   84)
* AT_NO_AUTOMOUNT (os モジュール):       ファイルとディレクトリ.
                                                             (line 1781)
* AT_STATX_DONT_SYNC (os モジュール):    ファイルとディレクトリ.
                                                             (line 1759)
* AT_STATX_FORCE_SYNC (os モジュール):   ファイルとディレクトリ.
                                                             (line 1748)
* AT_STATX_SYNC_AS_STAT (os モジュール): ファイルとディレクトリ.
                                                             (line 1768)
* at() (importlib.metadata.Distribution の静的メソッド): Distributions.
                                                             (line   43)
* atan() (cmath モジュール):             三角関数<2>.        (line   17)
* atan() (math モジュール):              三角関数.           (line   15)
* atan2() (math モジュール):             三角関数.           (line   20)
* atanh() (cmath モジュール):            双曲線関数<2>.      (line   17)
* atanh() (math モジュール):             双曲線関数.         (line   17)
* ATEQUAL (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line  332)
* atexit (weakref.finalize の属性):      weakref --- Weak references.
                                                             (line  307)
* athrow() (agen のメソッド):            非同期ジェネレータイテレータメソッド.
                                                             (line   42)
* atof() (locale モジュール):            locale --- 国際化サービス.
                                                             (line  512)
* atoi() (locale モジュール):            locale --- 国際化サービス.
                                                             (line  518)
* atom:                                  アトム、原子的要素 atom.
                                                             (line    6)
* atomic operation:                      用語集<2>.          (line  142)
* attach_mock() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  255)
* attach() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  168)
* attached thread state:                 用語集<2>.          (line  152)
* attempted (doctest.TestResults の属性): TestResults objects.
                                                             (line   12)
* AttlistDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  370)
* attrgetter() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  241)
* attrib (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   51)
* Attribute (ast のクラス):              式 expression<2>.   (line  171)
* AttributeError:                        具象例外.           (line   12)
* attributes (xml.dom.Node の属性):      Node オブジェクト.  (line   26)
* AttributesImpl (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   67)
* AttributesNSImpl (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   77)
* attroff() (curses.window のメソッド):  Window オブジェクト.
                                                             (line   53)
* attron() (curses.window のメソッド):   Window オブジェクト.
                                                             (line   58)
* attrset() (curses.window のメソッド):  Window オブジェクト.
                                                             (line   63)
* audit() (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line  130)
* auditing:                              sys --- システム固有のパラメーターと関数.
                                                             (line  132)
* AugAssign (ast のクラス):              文 Statements.      (line   94)
* augmented;代入:                        累算代入文 augmented assignment statement.
                                                             (line    6)
* AUGUST (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  517)
* auth() (ftplib.FTP_TLS のメソッド):    FTP_TLS オブジェクト.
                                                             (line   84)
* auth() (smtplib.SMTP のメソッド):      SMTP オブジェクト.  (line  138)
* authenticate() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line   41)
* 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  738)
* 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:               リスト、集合、辞書の表示.
                                                             (line   43)
* awaitable:                             用語集<2>.          (line  187)
* 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  215)
* b16encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line  204)
* b2a_ascii85() (binascii モジュール):   binascii --- バイナリ と ASCII 間の変換.
                                                             (line  153)
* b2a_base32() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  264)
* b2a_base64() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line   94)
* b2a_base85() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  207)
* b2a_hex() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line  329)
* b2a_qp() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line  291)
* b2a_uu() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   32)
* b32decode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line  138)
* b32encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line  122)
* b32hexdecode() (base64 モジュール):    RFC 4648 エンコーディング.
                                                             (line  188)
* b32hexencode() (base64 モジュール):    RFC 4648 エンコーディング.
                                                             (line  178)
* b64decode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   33)
* b64encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   10)
* b85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line  115)
* b85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   95)
* 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  532)
* backward() (turtle モジュール):        Turtle の動き.      (line   24)
* BadGzipFile:                           gzip --- gzip ファイルのサポート.
                                                             (line   73)
* BadOptionError:                        例外<13>.           (line   21)
* BadStatusLine:                         http client --- HTTP プロトコルクライアント.
                                                             (line  192)
* 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  161)
* base_prefix (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  174)
* BASE32_ALPHABET (binascii モジュール): binascii --- バイナリ と ASCII 間の変換.
                                                             (line  437)
* BASE32HEX_ALPHABET (binascii モジュール): binascii --- バイナリ と ASCII 間の変換.
                                                             (line  443)
* BASE64_ALPHABET (binascii モジュール): binascii --- バイナリ と ASCII 間の変換.
                                                             (line  386)
* base64;encoding:                       base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line    8)
* BASE85_ALPHABET (binascii モジュール): binascii --- バイナリ と ASCII 間の変換.
                                                             (line  419)
* BaseCGIHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   54)
* BaseCookie (http.cookies のクラス):    http cookies --- HTTP の状態管理.
                                                             (line   38)
* BaseException:                         基底クラス.         (line    8)
* BaseExceptionGroup:                    例外グループ.       (line   13)
* BaseHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  326)
* BaseHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   89)
* BaseHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line   39)
* BaseHTTPRequestHandler (http.server のクラス): http server --- HTTP サーバー.
                                                             (line   98)
* BaseManager (multiprocessing.managers のクラス): マネージャー.
                                                             (line   24)
* basename() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line   63)
* BaseProtocol (asyncio のクラス):       基底プロトコル.     (line    6)
* BaseProxy (multiprocessing.managers のクラス): Proxy オブジェクト.
                                                             (line   91)
* BaseRequestHandler (socketserver のクラス): Request Handler Objects.
                                                             (line    6)
* BaseRotatingHandler (logging.handlers のクラス): BaseRotatingHandler.
                                                             (line   12)
* BaseSelector (selectors のクラス):     クラス<4>.          (line   54)
* BaseServer (socketserver のクラス):    Serverオブジェクト. (line    6)
* BaseTransport (asyncio のクラス):      トランスポートのクラス階層構造.
                                                             (line    6)
* basicConfig() (logging モジュール):    モジュールレベルの関数.
                                                             (line  194)
* BasicContext (decimal モジュール):     Context オブジェクト.
                                                             (line   71)
* BasicInterpolation (configparser のクラス): 値の補間.      (line   10)
* batched() (itertools モジュール):      Itertool関数.       (line   71)
* baudrate() (curses モジュール):        関数<6>.            (line   33)
* bbox() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line    8)
* BDADDR_ANY (socket モジュール):        定数<8>.            (line  318)
* BDADDR_BREDR (socket モジュール):      定数<8>.            (line  326)
* BDADDR_LE_PUBLIC (socket モジュール):  定数<8>.            (line  326)
* BDADDR_LE_RANDOM (socket モジュール):  定数<8>.            (line  326)
* BDADDR_LOCAL (socket モジュール):      定数<8>.            (line  318)
* Bdb (bdb のクラス):                    bdb --- デバッガーフレームワーク.
                                                             (line  125)
* BdbQuit:                               bdb --- デバッガーフレームワーク.
                                                             (line   15)
* BDFL:                                  用語集<2>.          (line  193)
* beep() (curses モジュール):            関数<6>.            (line   41)
* Beep() (winsound モジュール):          関数<15>.           (line    6)
* begin_fill() (turtle モジュール):      塗りつぶし.         (line   35)
* begin_poly() (turtle モジュール):      特別な Turtle のメソッド.
                                                             (line   18)
* BEL (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   39)
* BELOW_NORMAL_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   75)
* below() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   17)
* betavariate() (random モジュール):     実数分布.           (line   29)
* bgcolor() (turtle モジュール):         ウィンドウの制御.   (line    6)
* bgpic() (turtle モジュール):           ウィンドウの制御.   (line   48)
* bidirectional() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line   90)
* bigaddrspacetest() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  596)
* BigEndianStructure (ctypes のクラス):  構造化データ型.     (line   27)
* BigEndianUnion (ctypes のクラス):      構造化データ型.     (line   13)
* bigmemtest() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  580)
* bin() (enum モジュール):               Utilities and decorators.
                                                             (line  109)
* Binary (xmlrpc.client のクラス):       Binary オブジェクト.
                                                             (line    6)
* binary file:                           用語集<2>.          (line  198)
* binary semaphores:                     _thread --- 低水準なスレッド API.
                                                             (line    6)
* BINARY_OP (opcode):                    Python バイトコード命令.
                                                             (line  255)
* BINARY_SLICE (opcode):                 Python バイトコード命令.
                                                             (line  286)
* binaryfunc (C type):                   Slot Type typedefs. (line  121)
* BinaryIO (typing のクラス):            ABCs and Protocols for working with I/O.
                                                             (line    6)
* bind (widgets):                        バインドとイベント. (line    6)
* bind_partial() (inspect.Signature のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  140)
* bind_port() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   37)
* bind_textdomain_codeset() (locale モジュール): メッセージカタログへのアクセス.
                                                             (line   16)
* bind_unix_socket() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   54)
* bind() (inspect.Signature のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  133)
* bind() (socket.socket のメソッド):     socket オブジェクト.
                                                             (line   30)
* bindtextdomain() (gettext モジュール): GNU gettext API.    (line   14)
* bindtextdomain() (locale モジュール):  メッセージカタログへのアクセス.
                                                             (line   14)
* BINHEX_ALPHABET (binascii モジュール): binascii --- バイナリ と ASCII 間の変換.
                                                             (line  412)
* binomialvariate() (random モジュール): Discrete distributions.
                                                             (line    8)
* BinOp (ast のクラス):                  式 expression<2>.   (line   43)
* bisect_left() (bisect モジュール):     bisect --- 配列二分法アルゴリズム.
                                                             (line   32)
* bisect_right() (bisect モジュール):    bisect --- 配列二分法アルゴリズム.
                                                             (line   56)
* bisect() (bisect モジュール):          bisect --- 配列二分法アルゴリズム.
                                                             (line   56)
* bit_count() (int のメソッド):          整数型における追加のメソッド.
                                                             (line   30)
* bit_length() (int のメソッド):         整数型における追加のメソッド.
                                                             (line    9)
* bit_offset (ctypes.CField の属性):     構造化データ型.     (line  288)
* bit_size (ctypes.CField の属性):       構造化データ型.     (line  288)
* BitAnd (ast のクラス):                 式 expression<2>.   (line   55)
* BitOr (ast のクラス):                  式 expression<2>.   (line   55)
* bits_per_digit (sys.int_info の属性):  sys --- システム固有のパラメーターと関数.
                                                             (line 1243)
* BitXor (ast のクラス):                 式 expression<2>.   (line   55)
* bk() (turtle モジュール):              Turtle の動き.      (line   24)
* bkgd() (curses.window のメソッド):     Window オブジェクト.
                                                             (line   68)
* bkgdset() (curses.window のメソッド):  Window オブジェクト.
                                                             (line   79)
* blake2b, blake2s:                      BLAKE2.             (line    6)
* blake2b.MAX_DIGEST_SIZE (hashlib モジュール): 定数<5>.     (line   24)
* blake2b.MAX_KEY_SIZE (hashlib モジュール): 定数<5>.        (line   18)
* blake2b.PERSON_SIZE (hashlib モジュール): 定数<5>.         (line   12)
* blake2b.SALT_SIZE (hashlib モジュール): 定数<5>.           (line    6)
* blake2b() (hashlib モジュール):        ハッシュオブジェクトの作成.
                                                             (line    9)
* blake2s.MAX_DIGEST_SIZE (hashlib モジュール): 定数<5>.     (line   26)
* blake2s.MAX_KEY_SIZE (hashlib モジュール): 定数<5>.        (line   20)
* blake2s.PERSON_SIZE (hashlib モジュール): 定数<5>.         (line   14)
* blake2s.SALT_SIZE (hashlib モジュール): 定数<5>.           (line    8)
* blake2s() (hashlib モジュール):        ハッシュオブジェクトの作成.
                                                             (line   14)
* BLKTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  356)
* 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)
* block() (unicodedata モジュール):      unicodedata --- Unicode データベース.
                                                             (line  114)
* 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   25)
* BOLD (tkinter.font モジュール):        tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* BOM (codecs モジュール):               codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_BE (codecs モジュール):            codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_LE (codecs モジュール):            codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_UTF16 (codecs モジュール):         codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_UTF16_BE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_UTF16_LE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_UTF32 (codecs モジュール):         codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_UTF32_BE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_UTF32_LE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* BOM_UTF8 (codecs モジュール):          codecs --- codec レジストリと基底クラス.
                                                             (line  282)
* bool (組み込みクラス):                 組み込み関数.       (line  134)
* BOOLEAN_STATES (configparser.ConfigParser の属性): パーサーの振る舞いをカスタマイズする.
                                                             (line  235)
* Boolean;''values'':                    ブーリアン型 - bool.
                                                             (line    9)
* Boolean;type:                          組み込み関数.       (line  145)
* Boolean;操作:                          真理値判定.         (line    6)
* Boolean;操作 <1>:                      ブール演算 --- and or not.
                                                             (line    6)
* Boolean;演算:                          ブール演算 boolean operation.
                                                             (line    6)
* BooleanOptionalAction (argparse のクラス): Action クラス.  (line   64)
* BoolOp (ast のクラス):                 式 expression<2>.   (line   71)
* bootstrap() (ensurepip モジュール):    モジュール API.     (line   13)
* border() (curses.window のメソッド):   Window オブジェクト.
                                                             (line   88)
* borrowed reference:                    用語集<2>.          (line  210)
* bottom_panel() (curses.panel モジュール): 関数<7>.         (line    8)
* bottom() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   21)
* BoundArguments (inspect のクラス):     Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  350)
* BoundaryError:                         email errors Exception and Defect classes.
                                                             (line   38)
* BoundedSemaphore (asyncio のクラス):   BoundedSemaphore.   (line    6)
* BoundedSemaphore (multiprocessing のクラス): 同期プリミティブ.
                                                             (line   23)
* BoundedSemaphore (threading のクラス): Semaphore objects.  (line   74)
* 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 オブジェクト.
                                                             (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  279)
* break_here() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  270)
* 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  274)
* 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)
* BROWSER:                               webbrowser<2>.      (line    6)
* BROWSER <1>:                           webbrowser<2>.      (line   10)
* BROWSER <2>:                           ライブラリ<29>.     (line  418)
* BROWSER <3>:                           ライブラリ<29>.     (line  422)
* 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   72)
* btlazy2 (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  318)
* btopt (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  320)
* BTPROTO_HCI (socket モジュール):       定数<8>.            (line  310)
* BTPROTO_L2CAP (socket モジュール):     定数<8>.            (line  310)
* BTPROTO_RFCOMM (socket モジュール):    定数<8>.            (line  310)
* BTPROTO_SCO (socket モジュール):       定数<8>.            (line  310)
* 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 1447)
* buffer_info() (array.array のメソッド): array --- 効率的な数値配列.
                                                             (line  162)
* buffer_size (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  251)
* buffer_text (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  257)
* buffer_updated() (asyncio.BufferedProtocol のメソッド): バッファリングされたストリーミングプロトコル.
                                                             (line   34)
* buffer_used (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  268)
* BufferedIOBase (io のクラス):          I/O 基底クラス.     (line  223)
* BufferedProtocol (asyncio のクラス):   基底プロトコル.     (line   16)
* BufferedRandom (io のクラス):          バッファ付きストリーム.
                                                             (line  141)
* BufferedReader (io のクラス):          バッファ付きストリーム.
                                                             (line   60)
* BufferedRWPair (io のクラス):          バッファ付きストリーム.
                                                             (line  156)
* BufferedWriter (io のクラス):          バッファ付きストリーム.
                                                             (line   99)
* 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 2217)
* built-in function; abs():              組み込み関数.       (line   43)
* built-in function; aiter():            組み込み関数.       (line   49)
* built-in function; all():              組み込み関数.       (line   60)
* built-in function; anext():            組み込み関数.       (line   71)
* built-in function; any():              組み込み関数.       (line   91)
* built-in function; ascii():            組み込み関数.       (line  102)
* built-in function; bin():              組み込み関数.       (line  109)
* built-in function; breakpoint():       組み込み関数.       (line  147)
* built-in function; callable():         組み込み関数.       (line  226)
* built-in function; chr():              組み込み関数.       (line  239)
* built-in function; classmethod():      組み込み関数.       (line  248)
* built-in function; compile():          組み込み関数.       (line  288)
* built-in function; delattr():          組み込み関数.       (line  445)
* built-in function; dir():              組み込み関数.       (line  468)
* built-in function; divmod():           組み込み関数.       (line  527)
* built-in function; enumerate():        組み込み関数.       (line  538)
* built-in function; eval():             組み込み関数.       (line  561)
* built-in function; exec():             組み込み関数.       (line  637)
* built-in function; filter():           組み込み関数.       (line  707)
* built-in function; format():           組み込み関数.       (line  789)
* built-in function; getattr():          組み込み関数.       (line  822)
* built-in function; globals():          組み込み関数.       (line  841)
* built-in function; hasattr():          組み込み関数.       (line  847)
* built-in function; hash():             組み込み関数.       (line  854)
* built-in function; help():             組み込み関数.       (line  865)
* built-in function; hex():              組み込み関数.       (line  889)
* built-in function; id():               組み込み関数.       (line  919)
* built-in function; input():            組み込み関数.       (line  931)
* built-in function; isinstance():       組み込み関数.       (line 1029)
* built-in function; issubclass():       組み込み関数.       (line 1046)
* built-in function; iter():             組み込み関数.       (line 1059)
* built-in function; len():              組み込み関数.       (line 1089)
* built-in function; locals():           組み込み関数.       (line 1105)
* built-in function; map():              組み込み関数.       (line 1153)
* built-in function; max():              組み込み関数.       (line 1167)
* built-in function; min():              組み込み関数.       (line 1202)
* built-in function; multiprocessing.Manager(): マネージャー.
                                                             (line   12)
* built-in function; next():             組み込み関数.       (line 1232)
* built-in function; oct():              組み込み関数.       (line 1252)
* built-in function; open():             組み込み関数.       (line 1277)
* built-in function; ord():              組み込み関数.       (line 1494)
* built-in function; pow():              組み込み関数.       (line 1506)
* built-in function; print():            組み込み関数.       (line 1548)
* built-in function; property.deleter(): 組み込み関数.       (line 1624)
* built-in function; property.getter():  組み込み関数.       (line 1620)
* built-in function; property.setter():  組み込み関数.       (line 1622)
* built-in function; repr():             組み込み関数.       (line 1673)
* built-in function; reversed():         組み込み関数.       (line 1695)
* built-in function; round():            組み込み関数.       (line 1703)
* built-in function; setattr():          組み込み関数.       (line 1738)
* built-in function; sorted():           組み込み関数.       (line 1847)
* built-in function; staticmethod():     組み込み関数.       (line 1882)
* built-in function; sum():              組み込み関数.       (line 1941)
* built-in function; vars():             組み込み関数.       (line 2098)
* built-in function; zip():              組み込み関数.       (line 2121)
* builtin_module_names (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  193)
* 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  168)
* busy_retry() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  217)
* BUTTON_ALT (curses モジュール):        定数<6>.            (line  627)
* BUTTON_CTRL (curses モジュール):       定数<6>.            (line  624)
* BUTTON_SHIFT (curses モジュール):      定数<6>.            (line  621)
* buttonbox() (tkinter.simpledialog.Dialog のメソッド): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   30)
* BUTTONn_CLICKED (curses モジュール):   定数<6>.            (line  612)
* BUTTONn_DOUBLE_CLICKED (curses モジュール): 定数<6>.       (line  615)
* BUTTONn_PRESSED (curses モジュール):   定数<6>.            (line  606)
* BUTTONn_RELEASED (curses モジュール):  定数<6>.            (line  609)
* BUTTONn_TRIPLE_CLICKED (curses モジュール): 定数<6>.       (line  618)
* bye() (turtle モジュール):             Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line    6)
* byref() (ctypes モジュール):           ユーティリティー関数.
                                                             (line   19)
* byte_offset (ctypes.CField の属性):    構造化データ型.     (line  259)
* byte_size (ctypes.CField の属性):      構造化データ型.     (line  267)
* bytearray:                             変更可能なシーケンス型 mutable sequence.
                                                             (line   27)
* bytearray (組み込みクラス):            bytearray オブジェクト.
                                                             (line    9)
* bytearray;メソッド:                    bytes と bytearray の操作.
                                                             (line    6)
* bytearray;書式化:                      printf 形式での bytes の書式化.
                                                             (line    6)
* bytearray;補間:                        printf 形式での bytes の書式化.
                                                             (line    6)
* bytecode:                              コードオブジェクト. (line    6)
* bytecode <1>:                          用語集<2>.          (line  243)
* 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  187)
* byteorder (sys.abi_info の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line   48)
* 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  597)
* bytes-like object:                     用語集<2>.          (line  224)
* 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  182)
* 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  256)
* c_byte (ctypes のクラス):              基本データ型<2>.    (line   68)
* c_char (ctypes のクラス):              基本データ型<2>.    (line   74)
* c_char_p (ctypes のクラス):            基本データ型<2>.    (line   80)
* C_CONTIGUOUS (inspect.BufferFlags の属性): Buffer flags.   (line   25)
* c_contiguous (memoryview の属性):      メモリビュー.       (line  491)
* c_double (ctypes のクラス):            基本データ型<2>.    (line   87)
* c_double_complex (ctypes のクラス):    基本データ型<2>.    (line  104)
* c_float (ctypes のクラス):             基本データ型<2>.    (line   99)
* c_float_complex (ctypes のクラス):     基本データ型<2>.    (line  111)
* c_int (ctypes のクラス):               基本データ型<2>.    (line  125)
* c_int16 (ctypes のクラス):             基本データ型<2>.    (line  137)
* c_int32 (ctypes のクラス):             基本データ型<2>.    (line  142)
* c_int64 (ctypes のクラス):             基本データ型<2>.    (line  147)
* c_int8 (ctypes のクラス):              基本データ型<2>.    (line  132)
* c_long (ctypes のクラス):              基本データ型<2>.    (line  152)
* c_longdouble (ctypes のクラス):        基本データ型<2>.    (line   92)
* c_longdouble_complex (ctypes のクラス): 基本データ型<2>.   (line  118)
* c_longlong (ctypes のクラス):          基本データ型<2>.    (line  157)
* C_RAISE (monitoring event):            Events.             (line   25)
* C_RETURN (monitoring event):           Events.             (line   30)
* c_short (ctypes のクラス):             基本データ型<2>.    (line  164)
* c_size_t (ctypes のクラス):            基本データ型<2>.    (line  169)
* c_ssize_t (ctypes のクラス):           基本データ型<2>.    (line  174)
* c_time_t (ctypes のクラス):            基本データ型<2>.    (line  182)
* c_ubyte (ctypes のクラス):             基本データ型<2>.    (line  189)
* c_uint (ctypes のクラス):              基本データ型<2>.    (line  195)
* c_uint16 (ctypes のクラス):            基本データ型<2>.    (line  207)
* c_uint32 (ctypes のクラス):            基本データ型<2>.    (line  212)
* c_uint64 (ctypes のクラス):            基本データ型<2>.    (line  217)
* c_uint8 (ctypes のクラス):             基本データ型<2>.    (line  202)
* c_ulong (ctypes のクラス):             基本データ型<2>.    (line  222)
* c_ulonglong (ctypes のクラス):         基本データ型<2>.    (line  227)
* c_ushort (ctypes のクラス):            基本データ型<2>.    (line  234)
* c_void_p (ctypes のクラス):            基本データ型<2>.    (line  239)
* c_wchar (ctypes のクラス):             基本データ型<2>.    (line  244)
* c_wchar_p (ctypes のクラス):           基本データ型<2>.    (line  250)
* C-contiguous:                          shape strides suboffsets.
                                                             (line   34)
* C-contiguous <1>:                      用語集<2>.          (line  380)
* 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  207)
* cache_from_source() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   21)
* cache_info() (functools.lru_cache のメソッド): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  202)
* cache() (functools モジュール):        functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line   16)
* cached (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  437)
* cached_property() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line   53)
* 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  124)
* calendar コマンドラインオプション; -css: コマンドラインでの使用.
                                                             (line  124)
* 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  410)
* 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  202)
* 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  257)
* Callable (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   18)
* Callable (typing モジュール):          Aliases to other ABCs in collections abc.
                                                             (line   22)
* CallableProxyType (weakref モジュール): weakref --- Weak references.
                                                             (line  330)
* callback:                              用語集<2>.          (line  268)
* callback (optparse.Option の属性):     オプション属性.     (line   67)
* callback_args (optparse.Option の属性): オプション属性.    (line   74)
* callback_kwargs (optparse.Option の属性): オプション属性.  (line   74)
* callback() (contextlib.ExitStack のメソッド): ユーティリティ.
                                                             (line  622)
* callbacks (gc モジュール):             gc --- ガベージコレクターインターフェース.
                                                             (line  275)
* called (unittest.mock.Mock の属性):    Mock クラス.        (line  313)
* CalledProcessError:                    Using the subprocess Module.
                                                             (line  205)
* calloc (C function):                   概要<4>.            (line   33)
* CALLS (pstats.SortKey の属性):         The Stats class.    (line  198)
* CAN (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   96)
* CAN_BCM (socket モジュール):           定数<8>.            (line  156)
* can_change_color() (curses モジュール): 関数<6>.           (line   45)
* can_fetch() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   32)
* CAN_ISOTP (socket モジュール):         定数<8>.            (line  196)
* CAN_J1939 (socket モジュール):         定数<8>.            (line  205)
* CAN_RAW_FD_FRAMES (socket モジュール): 定数<8>.            (line  171)
* CAN_RAW_JOIN_FILTERS (socket モジュール): 定数<8>.         (line  185)
* can_symlink() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   75)
* can_write_eof() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line   51)
* can_write_eof() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   14)
* can_xattr() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   80)
* CANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  155)
* cancel_command() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   81)
* cancel_dump_traceback_later() (faulthandler モジュール): タイムアウト後にtracebackをダンプする.
                                                             (line   31)
* cancel_join_thread() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  199)
* cancel() (asyncio.Future のメソッド):  Future オブジェクト<2>.
                                                             (line  118)
* cancel() (asyncio.Handle のメソッド):  Callback handles.   (line   18)
* cancel() (asyncio.Task のメソッド):    Task object.        (line  201)
* cancel() (asyncio.TaskGroup のメソッド): Task groups.      (line   31)
* cancel() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   16)
* cancel() (sched.scheduler のメソッド): スケジューラオブジェクト.
                                                             (line   40)
* cancel() (threading.Timer のメソッド): Timer objects.      (line   33)
* cancel() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   47)
* cancelled() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   72)
* cancelled() (asyncio.Handle のメソッド): Callback handles. (line   23)
* cancelled() (asyncio.Task のメソッド): Task object.        (line  270)
* cancelled() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   23)
* CancelledError:                        例外クラス.         (line    6)
* CancelledError <1>:                    例外<17>.           (line   18)
* cancelling() (asyncio.Task のメソッド): Task object.       (line  328)
* CannotSendHeader:                      http client --- HTTP プロトコルクライアント.
                                                             (line  184)
* CannotSendRequest:                     http client --- HTTP プロトコルクライアント.
                                                             (line  180)
* 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)
* capa() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   23)
* capitalize() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  474)
* capitalize() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  474)
* capitalize() (str のメソッド):         文字列メソッド<2>.  (line   20)
* capitals (decimal.Context の属性):     Context オブジェクト.
                                                             (line  149)
* CapsuleType (types のクラス):          標準的なインタプリタ型.
                                                             (line  322)
* capture_call_graph() (asyncio モジュール): Call Graph Introspection.
                                                             (line   77)
* captured_stderr() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  354)
* captured_stdin() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  354)
* captured_stdout() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  354)
* captureWarnings() (logging モジュール): warnings モジュールとの統合.
                                                             (line    9)
* capwords() (string モジュール):        ヘルパー関数.       (line    6)
* case block:                            論駁不可能なケースブロック.
                                                             (line    6)
* casefold() (str のメソッド):           文字列メソッド<2>.  (line   30)
* cast() (ctypes モジュール):            ユーティリティー関数.
                                                             (line   51)
* cast() (memoryview のメソッド):        メモリビュー.       (line  274)
* cast() (typing モジュール):            Functions and decorators.
                                                             (line    6)
* catch_threading_exception() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   47)
* catch_unraisable_exception() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  635)
* catch_warnings (warnings のクラス):    利用可能なコンテキストマネージャー.
                                                             (line    6)
* category() (unicodedata モジュール):   unicodedata --- Unicode データベース.
                                                             (line   80)
* cbreak() (curses モジュール):          関数<6>.            (line   50)
* cbrt() (math モジュール):              Power exponential and logarithmic functions.
                                                             (line    6)
* CC:                                    新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   56)
* ccc() (ftplib.FTP_TLS のメソッド):     FTP_TLS オブジェクト.
                                                             (line   92)
* cdf() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line   86)
* CDLL (ctypes のクラス):                共有ライブラリをロードする.
                                                             (line    9)
* cdll (ctypes モジュール):              共有ライブラリをロードする.
                                                             (line  211)
* ceil() (math モジュール):              数値型 int float complex.
                                                             (line  115)
* ceil() (math モジュール) <1>:          Floating point arithmetic.
                                                             (line    6)
* CellType (types モジュール):           標準的なインタプリタ型.
                                                             (line   69)
* center() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  295)
* center() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  295)
* 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:                      例外<20>.           (line   92)
* certificates:                          SSL contexts.       (line  834)
* CField (ctypes のクラス):              構造化データ型.     (line  217)
* CFLAGS:                                新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   57)
* CFLAGS <1>:                            パフォーマンスに関するオプション.
                                                             (line   28)
* CFLAGS <2>:                            Compiler flags.     (line   26)
* CFLAGS <3>:                            Compiler flags.     (line   28)
* CFLAGS <4>:                            Compiler flags.     (line   32)
* CFLAGS <5>:                            Compiler flags.     (line   54)
* CFLAGS <6>:                            Linker flags.       (line   18)
* CFLAGS_NODIST:                         Compiler flags.     (line   24)
* CFLAGS_NODIST <1>:                     Compiler flags.     (line   61)
* CFLAGS_NODIST <2>:                     Linker flags.       (line   26)
* cfmakecbreak() (tty モジュール):       tty --- 端末制御用の関数群.
                                                             (line   28)
* cfmakeraw() (tty モジュール):          tty --- 端末制御用の関数群.
                                                             (line   20)
* CFUNCTYPE() (ctypes モジュール):       関数プロトタイプ.   (line   14)
* cget() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   51)
* CGIHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   11)
* 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  486)
* CHAR_MAX (locale モジュール):          locale --- 国際化サービス.
                                                             (line  581)
* CharacterDataHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  399)
* 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  566)
* 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   62)
* check() (tabnanny モジュール):         tabnanny --- あいまいなインデントの検出.
                                                             (line   17)
* checkcache() (linecache モジュール):   linecache --- テキストラインへのランダムアクセス.
                                                             (line   49)
* CHECKED_HASH (py_compile.PycInvalidationMode の属性): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line  110)
* checkfuncname() (bdb モジュール):      bdb --- デバッガーフレームワーク.
                                                             (line  495)
* 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 オブジェクト.
                                                             (line  133)
* childNodes (xml.dom.Node の属性):      Node オブジェクト.  (line   48)
* ChildProcessError:                     OS 例外.            (line   25)
* children (pyclbr.Class の属性):        クラスオブジェクト<2>.
                                                             (line   35)
* children (pyclbr.Function の属性):     Function オブジェクト.
                                                             (line   34)
* children (tkinter.Tk の属性):          Tkinter モジュール. (line   86)
* chksum (tarfile.TarInfo の属性):       TarInfo オブジェクト.
                                                             (line  139)
* chmod() (os モジュール):               ファイルとディレクトリ.
                                                             (line  182)
* chmod() (pathlib.Path のメソッド):     パーミッションと所有者.
                                                             (line   40)
* choice() (random モジュール):          シーケンス用の関数. (line    6)
* choice() (secrets モジュール):         乱数.               (line   15)
* choices (optparse.Option の属性):      オプション属性.     (line   62)
* choices() (random モジュール):         シーケンス用の関数. (line   11)
* Chooser (tkinter.colorchooser のクラス): tkinter colorchooser --- カラー選択ダイアログ.
                                                             (line   15)
* chown() (os モジュール):               ファイルとディレクトリ.
                                                             (line  252)
* chown() (shutil モジュール):           ディレクトリとファイルの操作.
                                                             (line  418)
* chroot() (os モジュール):              ファイルとディレクトリ.
                                                             (line  281)
* CHRTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  352)
* cipher() (ssl.SSLSocket のメソッド):   SSL sockets.        (line  236)
* 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  158)
* CLASS (symtable.SymbolTableType の属性): 記号表の検査.     (line   19)
* class variable:                        用語集<2>.          (line  279)
* ClassDef (ast のクラス):               関数およびクラス定義.
                                                             (line  168)
* ClassMethodDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  115)
* ClassVar (typing モジュール):          特殊形式.           (line  201)
* clause:                                複合文 compound statement.
                                                             (line   17)
* CLD_CONTINUED (os モジュール):         プロセス管理.       (line 1070)
* CLD_DUMPED (os モジュール):            プロセス管理.       (line 1070)
* CLD_EXITED (os モジュール):            プロセス管理.       (line 1070)
* CLD_KILLED (os モジュール):            プロセス管理.       (line 1070)
* CLD_STOPPED (os モジュール):           プロセス管理.       (line 1070)
* CLD_TRAPPED (os モジュール):           プロセス管理.       (line 1070)
* clean() (mailbox.Maildir のメソッド):  Maildir オブジェクト.
                                                             (line   84)
* cleandoc() (inspect モジュール):       ソースコードの情報取得.
                                                             (line   90)
* 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  388)
* clear_all_file_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  383)
* clear_bpbynumber() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  377)
* clear_break() (bdb.Bdb のメソッド):    bdb --- デバッガーフレームワーク.
                                                             (line  371)
* 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  174)
* 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  264)
* clear() (asyncio.Event のメソッド):    Event.              (line   59)
* clear() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   43)
* clear() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  149)
* clear() (dict のメソッド):             Mapping types --- dict frozendict.
                                                             (line  158)
* 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  217)
* 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   61)
* clearcache() (linecache モジュール):   linecache --- テキストラインへのランダムアクセス.
                                                             (line   43)
* clearok() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  154)
* clearscreen() (turtle モジュール):     ウィンドウの制御.   (line   72)
* clearstamp() (turtle モジュール):      Turtle の動き.      (line  286)
* clearstamps() (turtle モジュール):     Turtle の動き.      (line  305)
* client_address (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  118)
* client_address (socketserver.BaseRequestHandler の属性): Request Handler Objects.
                                                             (line   46)
* client_sigalg() (ssl.SSLSocket のメソッド): SSL sockets.   (line  260)
* Client() (multiprocessing.connection モジュール): リスナーとクライアント.
                                                             (line   34)
* CLOCK_BOOTTIME (time モジュール):      Clock ID Constants. (line    9)
* clock_getres() (time モジュール):      関数<5>.            (line   40)
* clock_gettime_ns() (time モジュール):  関数<5>.            (line   63)
* clock_gettime() (time モジュール):     関数<5>.            (line   50)
* CLOCK_HIGHRES (time モジュール):       Clock ID Constants. (line   23)
* CLOCK_MONOTONIC (time モジュール):     Clock ID Constants. (line   33)
* CLOCK_MONOTONIC_RAW (time モジュール): Clock ID Constants. (line   42)
* CLOCK_MONOTONIC_RAW_APPROX (time モジュール): Clock ID Constants.
                                                             (line   51)
* CLOCK_PROCESS_CPUTIME_ID (time モジュール): Clock ID Constants.
                                                             (line   60)
* CLOCK_PROF (time モジュール):          Clock ID Constants. (line   68)
* CLOCK_REALTIME (time モジュール):      Clock ID Constants. (line  128)
* clock_seq (uuid.UUID の属性):          uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  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   87)
* 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  649)
* CLONE_FS (os モジュール):              プロセスのパラメーター.
                                                             (line  649)
* CLONE_NEWCGROUP (os モジュール):       プロセスのパラメーター.
                                                             (line  649)
* CLONE_NEWIPC (os モジュール):          プロセスのパラメーター.
                                                             (line  649)
* CLONE_NEWNET (os モジュール):          プロセスのパラメーター.
                                                             (line  649)
* CLONE_NEWNS (os モジュール):           プロセスのパラメーター.
                                                             (line  649)
* CLONE_NEWPID (os モジュール):          プロセスのパラメーター.
                                                             (line  649)
* CLONE_NEWTIME (os モジュール):         プロセスのパラメーター.
                                                             (line  649)
* CLONE_NEWUSER (os モジュール):         プロセスのパラメーター.
                                                             (line  649)
* CLONE_NEWUTS (os モジュール):          プロセスのパラメーター.
                                                             (line  649)
* CLONE_SIGHAND (os モジュール):         プロセスのパラメーター.
                                                             (line  649)
* CLONE_SYSVSEM (os モジュール):         プロセスのパラメーター.
                                                             (line  649)
* CLONE_THREAD (os モジュール):          プロセスのパラメーター.
                                                             (line  649)
* CLONE_VM (os モジュール):              プロセスのパラメーター.
                                                             (line  649)
* 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  652)
* close() (coroutine のメソッド):        コルーチンオブジェクト.
                                                             (line   48)
* close() (dbm.dumb.dumbdbm のメソッド): dbm dumb --- Portable DBM implementation.
                                                             (line   85)
* 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   66)
* 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  273)
* close() (mailbox.Maildir のメソッド):  Maildir オブジェクト.
                                                             (line  212)
* close() (mailbox.MH のメソッド):       MH オブジェクト.    (line  108)
* close() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  193)
* 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  914)
* 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  104)
* close() (socket モジュール):           その他の関数<2>.    (line    8)
* close() (socket.socket のメソッド):    socket オブジェクト.
                                                             (line   41)
* close() (sqlite3.Blob のメソッド):     Blob オブジェクト.  (line   38)
* close() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   90)
* close() (sqlite3.Cursor のメソッド):   Cursor オブジェクト.
                                                             (line  157)
* close() (tarfile.TarFile のメソッド):  TarFile オブジェクト.
                                                             (line  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   36)
* 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  200)
* 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  284)
* clrtobot() (curses.window のメソッド): Window オブジェクト.
                                                             (line  159)
* clrtoeol() (curses.window のメソッド): Window オブジェクト.
                                                             (line  164)
* Cmd (cmd のクラス):                    cmd --- 行指向のコマンドインタープリターのサポート.
                                                             (line   15)
* cmd (subprocess.CalledProcessError の属性): Using the subprocess Module.
                                                             (line  217)
* cmd (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  172)
* cmdloop() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line    8)
* cmdqueue (cmd.Cmd の属性):             Cmdオブジェクト.    (line  139)
* cmp_op (dis モジュール):               命令コードコレクション.
                                                             (line   22)
* cmp_to_key() (functools モジュール):   functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  123)
* cmp() (filecmp モジュール):            filecmp --- ファイルとディレクトリの比較.
                                                             (line   16)
* cmpfiles() (filecmp モジュール):       filecmp --- ファイルとディレクトリの比較.
                                                             (line   36)
* CMSG_LEN() (socket モジュール):        その他の関数<2>.    (line  342)
* CMSG_SPACE() (socket モジュール):      その他の関数<2>.    (line  360)
* 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   76)
* 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_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   73)
* 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  410)
* 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 の属性): 例外<23>.  (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   75)
* 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  189)
* 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 の属性):   例外<21>.           (line   26)
* colno (re.PatternError の属性):        例外<3>.            (line   32)
* colno (tomllib.TOMLDecodeError の属性): tomllib --- TOML ファイルの解析.
                                                             (line   89)
* colno (traceback.FrameSummary の属性): FrameSummary オブジェクト.
                                                             (line   57)
* colon (mailbox.Maildir の属性):        Maildir オブジェクト.
                                                             (line   43)
* COLON (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  215)
* COLONEQUAL (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  341)
* COLOR_BLACK (curses モジュール):       定数<6>.            (line  639)
* COLOR_BLUE (curses モジュール):        定数<6>.            (line  642)
* color_content() (curses モジュール):   関数<6>.            (line   60)
* COLOR_CYAN (curses モジュール):        定数<6>.            (line  645)
* COLOR_GREEN (curses モジュール):       定数<6>.            (line  648)
* COLOR_MAGENTA (curses モジュール):     定数<6>.            (line  651)
* color_pair() (curses モジュール):      関数<6>.            (line   68)
* COLOR_PAIRS (curses モジュール):       定数<6>.            (line   39)
* COLOR_RED (curses モジュール):         定数<6>.            (line  654)
* COLOR_WHITE (curses モジュール):       定数<6>.            (line  657)
* COLOR_YELLOW (curses モジュール):      定数<6>.            (line  660)
* color() (turtle モジュール):           色の制御<2>.        (line  111)
* colormode() (turtle モジュール):       設定と特殊なメソッド.
                                                             (line   33)
* COLORS (curses モジュール):            定数<6>.            (line   34)
* COLS (curses モジュール):              定数<6>.            (line   44)
* column() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   35)
* columnize() (cmd.Cmd のメソッド):      Cmdオブジェクト.    (line   86)
* COLUMNS:                               関数<6>.            (line  596)
* COLUMNS <1>:                           関数<6>.            (line  597)
* columns (os.terminal_size の属性):     ターミナルのサイズの問い合わせ.
                                                             (line   29)
* comb() (math モジュール):              Number-theoretic functions.
                                                             (line    9)
* comb() (math.integer モジュール):      math integer --- integer-specific mathematics functions.
                                                             (line   18)
* combinations_with_replacement() (itertools モジュール): Itertool関数.
                                                             (line  169)
* combinations() (itertools モジュール): Itertool関数.       (line  128)
* combine() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  186)
* combining() (unicodedata モジュール):  unicodedata --- Unicode データベース.
                                                             (line  101)
* Combobox (tkinter.ttk のクラス):       ttk Combobox.       (line    6)
* COMError:                              例外<11>.           (line   11)
* COMMA (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  218)
* command (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  140)
* 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  376)
* 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  458)
* 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  127)
* Common Vulnerabilities and Exposures; CVE 2012-0876: セキュリティ<48>.
                                                             (line   23)
* Common Vulnerabilities and Exposures; CVE 2012-0876 <1>: セキュリティ<51>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2012-0876 <2>: セキュリティ<57>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2013-0340: セキュリティ<28>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2013-1753: ライブラリ<212>.
                                                             (line  193)
* Common Vulnerabilities and Exposures; CVE 2014-0224: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
                                                             (line   30)
* Common Vulnerabilities and Exposures; CVE 2014-4616: ライブラリ<212>.
                                                             (line 1122)
* Common Vulnerabilities and Exposures; CVE 2015-1283: セキュリティ<54>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2015-1283 <1>: セキュリティ<59>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2016-0718: セキュリティ<48>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <1>: セキュリティ<48>.
                                                             (line   23)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <2>: セキュリティ<48>.
                                                             (line   35)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <3>: セキュリティ<51>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <4>: セキュリティ<51>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <5>: セキュリティ<52>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <6>: セキュリティ<57>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <7>: セキュリティ<57>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <8>: セキュリティ<57>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2016-0772: セキュリティ<54>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2016-0772 <1>: セキュリティ<59>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2016-1000110: ライブラリ<191>.
                                                             (line   82)
* Common Vulnerabilities and Exposures; CVE 2016-1000110 <1>: ライブラリ<198>.
                                                             (line  267)
* Common Vulnerabilities and Exposures; CVE 2016-2183: ライブラリ<190>.
                                                             (line  178)
* Common Vulnerabilities and Exposures; CVE 2016-2183 <1>: ライブラリ<198>.
                                                             (line  205)
* Common Vulnerabilities and Exposures; CVE 2016-3189: Windows<31>.
                                                             (line   25)
* Common Vulnerabilities and Exposures; CVE 2016-4472: セキュリティ<48>.
                                                             (line   35)
* Common Vulnerabilities and Exposures; CVE 2016-4472 <1>: セキュリティ<52>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2016-4472 <2>: セキュリティ<57>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2016-5300: セキュリティ<48>.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2016-5300 <1>: セキュリティ<51>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2016-5300 <2>: セキュリティ<57>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2016-9063: セキュリティ<48>.
                                                             (line   21)
* Common Vulnerabilities and Exposures; CVE 2016-9063 <1>: セキュリティ<51>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2016-9063 <2>: セキュリティ<57>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2017-1000158: セキュリティ<56>.
                                                             (line   21)
* Common Vulnerabilities and Exposures; CVE 2017-9233: セキュリティ<48>.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2017-9233 <1>: セキュリティ<51>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2017-9233 <2>: セキュリティ<57>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2018-1060: セキュリティ<45>.
                                                             (line   48)
* Common Vulnerabilities and Exposures; CVE 2018-1060 <1>: セキュリティ<46>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2018-1060 <2>: セキュリティ<49>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2018-1061: セキュリティ<45>.
                                                             (line   49)
* Common Vulnerabilities and Exposures; CVE 2018-1061 <1>: セキュリティ<46>.
                                                             (line   16)
* Common Vulnerabilities and Exposures; CVE 2018-1061 <2>: セキュリティ<49>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2018-14647: セキュリティ<45>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2018-25032: Windows<31>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2018-8970: セキュリティ<45>.
                                                             (line   38)
* Common Vulnerabilities and Exposures; CVE 2018-8970 <1>: セキュリティ<46>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2019-12900: Windows<31>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2019-15903: セキュリティ<41>.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2019-18348: セキュリティ<38>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2019-20907: ライブラリ<155>.
                                                             (line  186)
* Common Vulnerabilities and Exposures; CVE 2019-5010: セキュリティ<45>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2019-9740: セキュリティ<43>.
                                                             (line    9)
* Common Vulnerabilities and Exposures; CVE 2019-9948: セキュリティ<42>.
                                                             (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: セキュリティ<35>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2020-15801: セキュリティ<35>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2020-8492: セキュリティ<37>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2021-3426: セキュリティ<30>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2022-26488: Windows<31>.
                                                             (line   28)
* Common Vulnerabilities and Exposures; CVE 2022-37434: Windows<28>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2022-42919: セキュリティ<26>.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2022-4303: セキュリティ<22>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2022-4303 <1>: セキュリティ<22>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2023-0286: セキュリティ<22>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2023-24329: セキュリティ<21>.
                                                             (line   19)
* Common Vulnerabilities and Exposures; CVE 2023-27043: email<3>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2023-27043 <1>: ライブラリ<67>.
                                                             (line  429)
* Common Vulnerabilities and Exposures; CVE 2023-40217: セキュリティ<20>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2023-52425: xml<2>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2023-52425 <1>: セキュリティ<17>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2023-52425 <2>: ドキュメント<17>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2023-52425 <3>: XML security.
                                                             (line   55)
* Common Vulnerabilities and Exposures; CVE 2024-12718: tarfile<2>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2024-12718 <1>: tarfile<2>.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2024-12718 <2>: tarfile<3>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2024-12718 <3>: tarfile<3>.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2024-12718 <4>: セキュリティ<8>.
                                                             (line   71)
* Common Vulnerabilities and Exposures; CVE 2024-4030: os<4>.
                                                             (line   38)
* Common Vulnerabilities and Exposures; CVE 2024-4030 <1>: tempfile.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2024-4030 <2>: セキュリティ<15>.
                                                             (line   54)
* Common Vulnerabilities and Exposures; CVE 2025-4138: tarfile<2>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2025-4138 <1>: tarfile<3>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2025-4138 <2>: セキュリティ<8>.
                                                             (line   71)
* Common Vulnerabilities and Exposures; CVE 2025-4330: tarfile<2>.
                                                             (line   19)
* Common Vulnerabilities and Exposures; CVE 2025-4330 <1>: tarfile<3>.
                                                             (line   19)
* Common Vulnerabilities and Exposures; CVE 2025-4330 <2>: セキュリティ<8>.
                                                             (line   71)
* Common Vulnerabilities and Exposures; CVE 2025-4435: tarfile<2>.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2025-4435 <1>: tarfile<3>.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2025-4517: os path.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2025-4517 <1>: os path<2>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2025-4517 <2>: セキュリティ<8>.
                                                             (line   72)
* Common Vulnerabilities and Exposures; CVE 2026-2297: セキュリティ<4>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2026-3219: ライブラリ<2>.
                                                             (line  111)
* Common Vulnerabilities and Exposures; CVE 2026-3644: セキュリティ<3>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2026-4224: セキュリティ<3>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2026-45186: セキュリティ.
                                                             (line    7)
* Common Weakness Enumeration; CWE 257:  レシピとベストプラクティス.
                                                             (line   16)
* Common Weakness Enumeration; CWE 295:  ssl<4>.             (line   21)
* Common Weakness Enumeration; CWE 295 <1>: ライブラリ<92>.  (line  514)
* common_dirs (filecmp.dircmp の属性):   dircmp クラス.      (line   75)
* common_files (filecmp.dircmp の属性):  dircmp クラス.      (line   79)
* common_funny (filecmp.dircmp の属性):  dircmp クラス.      (line   83)
* common_types (mimetypes モジュール):   mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  167)
* 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   52)
* 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  323)
* compare() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  276)
* compare() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  143)
* compare() (difflib.Differ のメソッド): Differ objects.     (line   36)
* COMPARISON_FLAGS (doctest モジュール): オプションフラグ.   (line  100)
* Compat32 (email.policy のクラス):      email policy Policy Objects.
                                                             (line  577)
* compat32 (email.policy モジュール):    email policy Policy Objects.
                                                             (line  631)
* 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: コマンドラインでの使用<10>.
                                                             (line   64)
* compileall コマンドラインオプション; -d: コマンドラインでの使用<10>.
                                                             (line   31)
* compileall コマンドラインオプション; -e: コマンドラインでの使用<10>.
                                                             (line  104)
* compileall コマンドラインオプション; -f: コマンドラインでの使用<10>.
                                                             (line   21)
* compileall コマンドラインオプション; -hardlink-dupes: コマンドラインでの使用<10>.
                                                             (line  108)
* compileall コマンドラインオプション; -i: コマンドラインでの使用<10>.
                                                             (line   58)
* compileall コマンドラインオプション; -invalidation-mode: コマンドラインでの使用<10>.
                                                             (line   84)
* compileall コマンドラインオプション; -j: コマンドラインでの使用<10>.
                                                             (line   78)
* compileall コマンドラインオプション; -l: コマンドラインでの使用<10>.
                                                             (line   16)
* compileall コマンドラインオプション; -o: コマンドラインでの使用<10>.
                                                             (line   98)
* compileall コマンドラインオプション; -p: コマンドラインでの使用<10>.
                                                             (line   46)
* compileall コマンドラインオプション; -q: コマンドラインでの使用<10>.
                                                             (line   25)
* compileall コマンドラインオプション; -r: コマンドラインでの使用<10>.
                                                             (line   71)
* compileall コマンドラインオプション; -s: コマンドラインでの使用<10>.
                                                             (line   39)
* compileall コマンドラインオプション; -x: コマンドラインでの使用<10>.
                                                             (line   53)
* compileall コマンドラインオプション; directory: コマンドラインでの使用<10>.
                                                             (line    9)
* compileall コマンドラインオプション; file: コマンドラインでの使用<10>.
                                                             (line    9)
* compiler_flag (__future__._Feature の属性): モジュールコンテンツ<3>.
                                                             (line   90)
* complete_statement() (sqlite3 モジュール): モジュール関数. (line  101)
* 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  369)
* complex number:                        用語集<2>.          (line  312)
* 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  206)
* compress() (itertools モジュール):     Itertool関数.       (line  210)
* compress() (lzma モジュール):          メモリ上での圧縮と展開<2>.
                                                             (line  171)
* compress() (lzma.LZMACompressor のメソッド): メモリ上での圧縮と展開<2>.
                                                             (line   75)
* compress() (zlib モジュール):          zlib --- gzip 互換の圧縮.
                                                             (line   60)
* compress() (zlib.Compress のメソッド): zlib --- gzip 互換の圧縮.
                                                             (line  231)
* 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  277)
* CompressionError:                      tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  270)
* CompressionParameter (compression.zstd のクラス): Advanced parameter control.
                                                             (line    6)
* compressobj() (zlib モジュール):       zlib --- gzip 互換の圧縮.
                                                             (line   97)
* COMSPEC:                               プロセス管理.       (line  800)
* COMSPEC <1>:                           Popen コンストラクター.
                                                             (line  111)
* concat() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  184)
* Concatenate (typing モジュール):       特殊形式.           (line   82)
* concurrency:                           用語集<2>.          (line  322)
* concurrent modification:               用語集<2>.          (line  334)
* concurrent_tee() (threading モジュール): Iterator synchronization.
                                                             (line  107)
* 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   55)
* ConfigParser (configparser のクラス):  ConfigParser オブジェクト.
                                                             (line    6)
* configuration information:             sysconfig --- Python の構成情報へのアクセスを提供する.
                                                             (line   10)
* configure_mock() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  261)
* configure() (tkinter.ttk.Style のメソッド): Ttk スタイル.  (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   86)
* connect_read_pipe() (asyncio.loop のメソッド): パイプとやりとりする.
                                                             (line    6)
* connect_write_pipe() (asyncio.loop のメソッド): パイプとやりとりする.
                                                             (line   23)
* connect() (ftplib.FTP のメソッド):     FTP オブジェクト.   (line   89)
* connect() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  150)
* connect() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   79)
* connect() (smtplib.SMTP のメソッド):   SMTP オブジェクト.  (line   34)
* connect() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line   61)
* 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 の属性): 例外<17>.     (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  281)
* content_manager (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  433)
* content_size_flag (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  178)
* content_type (email.headerregistry.ContentTypeHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  268)
* ContentDispositionHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  276)
* ContentHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   18)
* ContentManager (email.contentmanager のクラス): email contentmanager Managing MIME Content.
                                                             (line   12)
* contents (ctypes._Pointer の属性):     配列とポインタ.     (line   58)
* contents() (importlib.resources モジュール): 関数 API.     (line  150)
* contents() (importlib.resources.abc.ResourceReader のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   71)
* ContentTooShortError:                  urllib error --- urllib request によって送出される例外クラス.
                                                             (line   66)
* ContentTransferEncodingHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  286)
* ContentTypeHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  263)
* context:                               用語集<2>.          (line  341)
* Context (contextvars のクラス):        マニュアルでのコンテキスト管理.
                                                             (line   20)
* Context (decimal のクラス):            Context オブジェクト.
                                                             (line  118)
* context (ssl.SSLSocket の属性):        SSL sockets.        (line  368)
* context manager:                       with文とコンテキストマネージャ.
                                                             (line   13)
* context manager <1>:                   コンテキストマネージャ型.
                                                             (line    6)
* context manager <2>:                   用語集<2>.          (line  362)
* context variable:                      用語集<2>.          (line  368)
* context_aware_warnings (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  630)
* 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  376)
* contiguous (memoryview の属性):        メモリビュー.       (line  505)
* 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  236)
* CONTTYPE (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  368)
* conversion (string.templatelib.Interpolation の属性): 型.  (line  239)
* 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)
* 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  165)
* copy_negate() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  296)
* copy_negate() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  205)
* copy_sign() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  300)
* copy_sign() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  210)
* copy;プロトコル:                       クラスインスタンスの pickle 化.
                                                             (line  110)
* copy() (collections.deque のメソッド): deque オブジェクト. (line   47)
* copy() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  103)
* copy() (copy モジュール):              copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   19)
* copy() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  195)
* copy() (dict のメソッド):              Mapping types --- dict frozendict.
                                                             (line  162)
* 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  115)
* copy() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line   72)
* 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   59)
* copy() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  284)
* copy() (zlib.Compress のメソッド):     zlib --- gzip 互換の圧縮.
                                                             (line  253)
* copy() (zlib.Decompress のメソッド):   zlib --- gzip 互換の圧縮.
                                                             (line  322)
* 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   62)
* copyright (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line  214)
* 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  394)
* 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  192)
* count() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line   36)
* count() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line   36)
* count() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   53)
* count() (itertools モジュール):        Itertool関数.       (line  223)
* count() (memoryview のメソッド):       メモリビュー.       (line  372)
* count() (multiprocessing.shared_memory.ShareableList のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  331)
* count() (sequence のメソッド):         共通のシーケンス演算.
                                                             (line  167)
* count() (str のメソッド):              文字列メソッド<2>.  (line   65)
* Counter (collections のクラス):        Counter オブジェクト.
                                                             (line   23)
* Counter (typing のクラス):             Aliases to types in collections.
                                                             (line   39)
* countOf() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  195)
* countTestCases() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  827)
* 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)
* CPU 時間:                              関数<5>.            (line  259)
* CPU 時間 <1>:                          関数<5>.            (line  627)
* cpu_count() (multiprocessing モジュール): その他<5>.       (line   14)
* cpu_count() (os モジュール):           雑多なシステム情報. (line   34)
* CPython:                               用語集<2>.          (line  401)
* 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  137)
* CRC (zipfile.ZipInfo の属性):          ZipInfo objects.    (line  151)
* crc_hqx() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line  306)
* crc32_combine() (zlib モジュール):     zlib --- gzip 互換の圧縮.
                                                             (line  149)
* crc32() (binascii モジュール):         binascii --- バイナリ と ASCII 間の変換.
                                                             (line  313)
* crc32() (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  135)
* create_aggregate() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  162)
* create_archive() (zipapp モジュール):  Python API.         (line    8)
* create_autospec() (unittest.mock モジュール): create_autospec.
                                                             (line    6)
* CREATE_BREAKAWAY_FROM_JOB (subprocess モジュール): Windows Constants.
                                                             (line  140)
* create_collation() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  303)
* create_configuration() (venv.EnvBuilder のメソッド): API<2>.
                                                             (line  148)
* create_connection() (asyncio.loop のメソッド): ネットワーク接続の確立.
                                                             (line    6)
* create_connection() (socket モジュール): ソケットの作成.   (line   81)
* 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  212)
* create_module() (importlib.abc.Loader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  152)
* create_module() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  328)
* create_module() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   23)
* CREATE_NEW_CONSOLE (subprocess モジュール): Windows Constants.
                                                             (line   54)
* CREATE_NEW_PROCESS_GROUP (subprocess モジュール): Windows Constants.
                                                             (line   59)
* CREATE_NO_WINDOW (subprocess モジュール): Windows Constants.
                                                             (line  115)
* create_queue() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line   30)
* create_server() (asyncio.loop のメソッド): ネットワークサーバの生成.
                                                             (line    6)
* create_server() (socket モジュール):   ソケットの作成.     (line  111)
* create_stats() (profile.Profile のメソッド): profile and profiling tracing module reference.
                                                             (line   91)
* create_stats() (profiling.tracing.Profile のメソッド): Module reference.
                                                             (line   61)
* 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_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  214)
* create() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line   25)
* create() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line   77)
* create() (venv モジュール):            API<2>.             (line  233)
* create() (venv.EnvBuilder のメソッド): API<2>.             (line   59)
* createAttribute() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   45)
* createAttributeNS() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   52)
* createComment() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   33)
* createDocument() (xml.dom.DOMImplementation のメソッド): DOMImplementation オブジェクト.
                                                             (line   17)
* createDocumentType() (xml.dom.DOMImplementation のメソッド): DOMImplementation オブジェクト.
                                                             (line   28)
* createElement() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   14)
* createElementNS() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   20)
* createfilehandler() (_tkinter.Widget.tk のメソッド): ファイルハンドラ.
                                                             (line   28)
* CreateKey() (winreg モジュール):       関数<14>.           (line   36)
* CreateKeyEx() (winreg モジュール):     関数<14>.           (line   63)
* createLock() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   21)
* createLock() (logging.NullHandler のメソッド): NullHandler.
                                                             (line   24)
* createProcessingInstruction() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   39)
* createSocket() (logging.handlers.SocketHandler のメソッド): SocketHandler.
                                                             (line   71)
* createSocket() (logging.handlers.SysLogHandler のメソッド): SysLogHandler.
                                                             (line   57)
* createTextNode() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   27)
* credits (組み込み変数):                site モジュールで追加される定数.
                                                             (line   26)
* CRITICAL (logging モジュール):         ロギングレベル.     (line   44)
* critical() (logging モジュール):       モジュールレベルの関数.
                                                             (line   83)
* critical() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  297)
* CRNCYSTR (locale モジュール):          locale --- 国際化サービス.
                                                             (line  297)
* 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)
* CRYPT_ALPHABET (binascii モジュール):  binascii --- バイナリ と ASCII 間の変換.
                                                             (line  405)
* cryptography:                          暗号関連のサービス. (line    6)
* cssclass_month (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  290)
* cssclass_month_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  283)
* cssclass_noday (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  269)
* cssclass_year (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  297)
* cssclass_year_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  304)
* cssclasses (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  256)
* cssclasses_weekday_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  276)
* csv:                                   csv --- CSV ファイルの読み書き.
                                                             (line    8)
* cte (email.headerregistry.ContentTransferEncodingHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  290)
* cte_type (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  158)
* ctermid() (os モジュール):             プロセスのパラメーター.
                                                             (line    9)
* ctime() (datetime.date のメソッド):    date objects.       (line  312)
* ctime() (datetime.datetime のメソッド): datetime objects.  (line  741)
* ctime() (time モジュール):             関数<5>.            (line   96)
* CTRL_BREAK_EVENT (signal モジュール):  モジュールの内容<4>.
                                                             (line  229)
* CTRL_C_EVENT (signal モジュール):      モジュールの内容<4>.
                                                             (line  220)
* ctrl() (curses.ascii モジュール):      curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  213)
* CUMULATIVE (pstats.SortKey の属性):    The Stats class.    (line  202)
* curdir (os モジュール):                雑多なシステム情報. (line   99)
* currency() (locale モジュール):        locale --- 国際化サービス.
                                                             (line  477)
* current context:                       用語集<2>.          (line  407)
* 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  322)
* CurrentColumnNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  326)
* currentframe() (inspect モジュール):   インタープリタスタック.
                                                             (line  155)
* CurrentLineNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  330)
* curs_set() (curses モジュール):        関数<6>.            (line   76)
* Cursor (sqlite3 のクラス):             Cursor オブジェクト.
                                                             (line   20)
* cursor() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   27)
* cursyncup() (curses.window のメソッド): Window オブジェクト.
                                                             (line  168)
* Cut [切り取り]:                        Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   32)
* cutoff (sys.hash_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 1153)
* cwd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  334)
* cwd() (pathlib.Path のクラスメソッド): パスの展開と解決.   (line   30)
* cycle() (itertools モジュール):        Itertool関数.       (line  245)
* CycleError:                            例外<4>.            (line    8)
* cyclic isolate:                        用語集<2>.          (line  417)
* D_FMT (locale モジュール):             locale --- 国際化サービス.
                                                             (line  200)
* D_T_FMT (locale モジュール):           locale --- 国際化サービス.
                                                             (line  194)
* daemon (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  134)
* daemon (threading.Thread の属性):      Thread objects.     (line  244)
* 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  147)
* 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  425)
* data_filter() (tarfile モジュール):    Default named filters.
                                                             (line   36)
* data_open() (urllib.request.DataHandler のメソッド): DataHandler オブジェクト.
                                                             (line    6)
* data_received() (asyncio.Protocol のメソッド): ストリーミングプロトコル.
                                                             (line   13)
* data() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   32)
* DatabaseError:                         例外<8>.            (line   42)
* dataclass_transform() (typing モジュール): Functions and decorators.
                                                             (line  113)
* dataclass() (dataclasses モジュール):  モジュールの内容<6>.
                                                             (line    6)
* DataError:                             例外<8>.            (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  446)
* DateHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  134)
* datetime (datetime のクラス):          datetime objects.   (line   17)
* datetime (email.headerregistry.DateHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  143)
* DateTime (xmlrpc.client のクラス):     DateTime オブジェクト.
                                                             (line    6)
* Day (calendar のクラス):               calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  457)
* day (datetime.date の属性):            date objects.       (line  156)
* day (datetime.datetime の属性):        datetime objects.   (line  318)
* DAY_1 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  218)
* DAY_2 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  218)
* DAY_3 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  218)
* DAY_4 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  218)
* DAY_5 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  218)
* DAY_6 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  218)
* DAY_7 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  218)
* day_abbr (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  435)
* day_name (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  426)
* daylight (time モジュール):            Timezone Constants. (line   13)
* days (datetime.timedelta の属性):      timedelta objects.  (line  112)
* DbfilenameShelf (shelve のクラス):     制限事項.           (line   88)
* DC1 (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   75)
* DC2 (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   78)
* DC3 (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   81)
* DC4 (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   84)
* dcgettext() (locale モジュール):       メッセージカタログへのアクセス.
                                                             (line   10)
* deactivate_stack_trampoline() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 2001)
* deadlock:                              用語集<2>.          (line  437)
* deallocation, object:                  ファイナライズとメモリ解放.
                                                             (line    6)
* debug (imaplib.IMAP4 の属性):          IMAP4 オブジェクト. (line  494)
* DEBUG (logging モジュール):            ロギングレベル.     (line   24)
* debug (pdb command):                   Debugger commands.  (line  448)
* DEBUG (re モジュール):                 フラグ.             (line   31)
* debug (shlex.shlex の属性):            shlex オブジェクト. (line  161)
* debug (sys.abi_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line   41)
* debug (sys.flags の属性):              sys --- システム固有のパラメーターと関数.
                                                             (line  567)
* debug (zipfile.ZipFile の属性):        ZipFile objects.    (line  370)
* DEBUG_BYTECODE_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   20)
* DEBUG_COLLECTABLE (gc モジュール):     gc --- ガベージコレクターインターフェース.
                                                             (line  326)
* DEBUG_LEAK (gc モジュール):            gc --- ガベージコレクターインターフェース.
                                                             (line  346)
* DEBUG_SAVEALL (gc モジュール):         gc --- ガベージコレクターインターフェース.
                                                             (line  340)
* debug_src() (doctest モジュール):      デバッグ.           (line  143)
* DEBUG_STATS (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line  321)
* DEBUG_UNCOLLECTABLE (gc モジュール):   gc --- ガベージコレクターインターフェース.
                                                             (line  330)
* debug() (doctest モジュール):          デバッグ.           (line  122)
* debug() (logging モジュール):          モジュールレベルの関数.
                                                             (line   44)
* debug() (logging.Logger のメソッド):   ロガーオブジェクト. (line  182)
* debug() (unittest.TestCase のメソッド): テストクラス.      (line  122)
* debug() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   48)
* debugger:                              リファレンス<2>.    (line  131)
* debugger <1>:                          Debug メニュー Shell ウィンドウのみ.
                                                             (line   15)
* debugger <2>:                          sys --- システム固有のパラメーターと関数.
                                                             (line 1030)
* debugger <3>:                          sys --- システム固有のパラメーターと関数.
                                                             (line 1840)
* debugger;設定;ファイル:                Debugger commands.  (line   60)
* debuglevel (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   70)
* DebugRunner (doctest のクラス):        デバッグ.           (line  162)
* DECEMBER (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  517)
* Decimal (decimal のクラス):            Decimal オブジェクト.
                                                             (line    6)
* decimal() (unicodedata モジュール):    unicodedata --- Unicode データベース.
                                                             (line   51)
* DecimalException (decimal のクラス):   シグナル.           (line   29)
* decode (codecs.CodecInfo の属性):      codecs --- codec レジストリと基底クラス.
                                                             (line   86)
* 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   69)
* 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   95)
* 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  159)
* 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  238)
* decompress() (lzma モジュール):        メモリ上での圧縮と展開<2>.
                                                             (line  180)
* decompress() (lzma.LZMADecompressor のメソッド): メモリ上での圧縮と展開<2>.
                                                             (line  121)
* decompress() (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  164)
* decompress() (zlib.Decompress のメソッド): zlib --- gzip 互換の圧縮.
                                                             (line  289)
* decompressed_size (compression.zstd.FrameInfo の属性): その他<3>.
                                                             (line   16)
* DecompressionParameter (compression.zstd のクラス): Advanced parameter control.
                                                             (line  258)
* decompressobj() (zlib モジュール):     zlib --- gzip 互換の圧縮.
                                                             (line  209)
* decorator:                             用語集<2>.          (line  450)
* 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  348)
* DEF_MEM_LEVEL (zlib モジュール):       zlib --- gzip 互換の圧縮.
                                                             (line  344)
* def_prog_mode() (curses モジュール):   関数<6>.            (line   85)
* def_shell_mode() (curses モジュール):  関数<6>.            (line   92)
* default (email.policy モジュール):     email policy Policy Objects.
                                                             (line  518)
* 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_content_type (http.server.SimpleHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  420)
* DEFAULT_ENTROPY (secrets モジュール):  トークンは何バイト使うべきか？.
                                                             (line   20)
* default_exception_handler() (asyncio.loop のメソッド): Error handling API.
                                                             (line   34)
* default_factory (collections.defaultdict の属性): defaultdict オブジェクト.
                                                             (line   54)
* DEFAULT_FORMAT (tarfile モジュール):   tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  400)
* DEFAULT_IGNORES (filecmp モジュール):  dircmp クラス.      (line  112)
* default_loader() (xml.etree.ElementInclude モジュール): 関数<10>.
                                                             (line    6)
* default_max_str_digits (sys.int_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line 1252)
* DEFAULT_MODE (ctypes モジュール):      共有ライブラリをロードする.
                                                             (line  183)
* default_open() (urllib.request.BaseHandler のメソッド): BaseHandler オブジェクト.
                                                             (line   30)
* default_port (smtplib.SMTP の属性):    smtplib --- SMTP プロトコルクライアント.
                                                             (line   68)
* default_port (smtplib.SMTP_SSL の属性): smtplib --- SMTP プロトコルクライアント.
                                                             (line  104)
* 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  212)
* 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  473)
* DefaultHandlerExpand() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  480)
* defaults() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  108)
* DefaultSelector (selectors のクラス):  クラス<4>.          (line  164)
* defaultTestLoader (unittest モジュール): テストのロードと起動.
                                                             (line  448)
* defaultTestResult() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  832)
* 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  335)
* defpath (os モジュール):               雑多なシステム情報. (line  141)
* DefragResult (urllib.parse のクラス):  構造化された解析結果.
                                                             (line   44)
* DefragResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   69)
* degrees() (math モジュール):           角度変換.           (line    6)
* degrees() (turtle モジュール):         設定と計測.         (line    6)
* Del (ast のクラス):                    変数.               (line   11)
* DEL (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  123)
* del_param() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  384)
* del_param() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  548)
* delay_output() (curses モジュール):    関数<6>.            (line  100)
* delay() (turtle モジュール):           アニメーションの制御.
                                                             (line   19)
* delayload (http.cookiejar.FileCookieJar の属性): CookieJar および FileCookieJar オブジェクト.
                                                             (line  166)
* delch() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  173)
* dele() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   67)
* Delete (ast のクラス):                 文 Statements.      (line  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   81)
* delete() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   74)
* deleteacl() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line   85)
* deletefilehandler() (_tkinter.Widget.tk のメソッド): ファイルハンドラ.
                                                             (line   38)
* DeleteKey() (winreg モジュール):       関数<14>.           (line  101)
* DeleteKeyEx() (winreg モジュール):     関数<14>.           (line  123)
* deleteln() (curses.window のメソッド): Window オブジェクト.
                                                             (line  177)
* deleteMe() (bdb.Breakpoint のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line   42)
* DeleteTree() (winreg モジュール):      関数<14>.           (line  159)
* DeleteValue() (winreg モジュール):     関数<14>.           (line  178)
* 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  498)
* 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  148)
* 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   74)
* derwin() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  182)
* descrgetfunc (C type):                 Slot Type typedefs. (line   75)
* description (inspect.Parameter.kind の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  303)
* description (sqlite3.Cursor の属性):   Cursor オブジェクト.
                                                             (line  196)
* descriptor:                            用語集<2>.          (line  471)
* descrsetfunc (C type):                 Slot Type typedefs. (line   80)
* deserialize() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  705)
* dest (optparse.Option の属性):         オプション属性.     (line   35)
* destructor (C type):                   Slot Type typedefs. (line   25)
* detach() (io.BufferedIOBase のメソッド): I/O 基底クラス.   (line  257)
* detach() (io.TextIOBase のメソッド):   テキスト I/O<2>.    (line   37)
* detach() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  100)
* detach() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   80)
* detach() (weakref.finalize のメソッド): weakref --- Weak references.
                                                             (line  291)
* Detach() (winreg.PyHKEY のメソッド):   レジストリハンドルオブジェクト.
                                                             (line   42)
* DETACHED_PROCESS (subprocess モジュール): Windows Constants.
                                                             (line  122)
* details (ctypes.COMError の属性):      例外<11>.           (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:               profiling --- Python profilers.
                                                             (line   12)
* dev_mode (sys.flags の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  606)
* 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  184)
* dialect (csv.csvreader の属性):        reader オブジェクト.
                                                             (line   20)
* dialect (csv.csvwriter の属性):        writer オブジェクト.
                                                             (line   33)
* Dialog (tkinter.commondialog のクラス): tkinter commondialog --- Dialog window templates.
                                                             (line   13)
* Dialog (tkinter.simpledialog のクラス): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   21)
* Dict (ast のクラス):                   リテラル<3>.        (line  172)
* Dict (typing のクラス):                Aliases to built-in types.
                                                             (line    6)
* dict (組み込みクラス):                 Mapping types --- dict frozendict.
                                                             (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  488)
* dictionary comprehension:              用語集<2>.          (line  494)
* dictionary view:                       用語集<2>.          (line  502)
* dictionary_id (compression.zstd.FrameInfo の属性): その他<3>.
                                                             (line   20)
* dictionary;内包表記:                   辞書表示.           (line    6)
* dictionary;表示:                       辞書表示.           (line    6)
* DictReader (csv のクラス):             モジュールコンテンツ.
                                                             (line  103)
* DictWriter (csv のクラス):             モジュールコンテンツ.
                                                             (line  150)
* diff_bytes() (difflib モジュール):     difflib --- 差分の計算の補助.
                                                             (line  338)
* 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  686)
* digest_size (hmac.HMAC の属性):        hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   94)
* digest() (hashlib.hash のメソッド):    Hash Objects.       (line   37)
* digest() (hashlib.shake のメソッド):   SHAKE 可変長ダイジェスト.
                                                             (line   15)
* digest() (hmac モジュール):            hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   33)
* digest() (hmac.HMAC のメソッド):       hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   61)
* digit() (unicodedata モジュール):      unicodedata --- Unicode データベース.
                                                             (line   62)
* digits (string モジュール):            文字列定数.         (line   23)
* dir() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  308)
* dircmp (filecmp のクラス):             dircmp クラス.      (line    6)
* Directory (tkinter.filedialog のクラス): ネイティブの読み込み/保存ダイアログ.
                                                             (line   70)
* DirEntry (os のクラス):                ファイルとディレクトリ.
                                                             (line  954)
* dirname() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  119)
* dirs_double_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   85)
* dirs_select_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   89)
* DirsOnSysPath (test.support.import_helper のクラス): test support import_helper --- Utilities for import tests.
                                                             (line   97)
* DIRTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  360)
* dis コマンドラインオプション; -C:      コマンドライン・インターフェース<13>.
                                                             (line   16)
* dis コマンドラインオプション; -h:      コマンドライン・インターフェース<13>.
                                                             (line   12)
* dis コマンドラインオプション; -help:   コマンドライン・インターフェース<13>.
                                                             (line   12)
* dis コマンドラインオプション; -O:      コマンドライン・インターフェース<13>.
                                                             (line   22)
* dis コマンドラインオプション; -P:      コマンドライン・インターフェース<13>.
                                                             (line   28)
* dis コマンドラインオプション; -S:      コマンドライン・インターフェース<13>.
                                                             (line   34)
* dis コマンドラインオプション; -show-caches: コマンドライン・インターフェース<13>.
                                                             (line   16)
* dis コマンドラインオプション; -show-offsets: コマンドライン・インターフェース<13>.
                                                             (line   22)
* dis コマンドラインオプション; -show-positions: コマンドライン・インターフェース<13>.
                                                             (line   28)
* dis コマンドラインオプション; -specialized: コマンドライン・インターフェース<13>.
                                                             (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  425)
* 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   42)
* disable() (gc モジュール):             gc --- ガベージコレクターインターフェース.
                                                             (line   25)
* disable() (logging モジュール):        モジュールレベルの関数.
                                                             (line  102)
* disable() (profile.Profile のメソッド): profile and profiling tracing module reference.
                                                             (line   86)
* disable() (profiling.tracing.Profile のメソッド): Module reference.
                                                             (line   57)
* disabled (logging.Logger の属性):      ロガーオブジェクト. (line   96)
* DisableReflectionKey() (winreg モジュール): 関数<14>.      (line  495)
* disassemble() (dis モジュール):        解析関数.           (line  102)
* discard (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   59)
* discard() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   85)
* discard() (mailbox.MH のメソッド):     MH オブジェクト.    (line   81)
* discard() (set のメソッド):            set（集合）型 --- set frozenset.
                                                             (line  206)
* disco() (dis モジュール):              解析関数.           (line  102)
* discover() (importlib.abc.MetaPathFinder のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line   58)
* discover() (importlib.abc.PathEntryFinder のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  114)
* discover() (importlib.metadata.Distribution のクラスメソッド): Distributions.
                                                             (line   50)
* discover() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line  113)
* disjoint_base() (typing モジュール):   Functions and decorators.
                                                             (line  397)
* disk_usage() (shutil モジュール):      ディレクトリとファイルの操作.
                                                             (line  399)
* dispatch_call() (bdb.Bdb のメソッド):  bdb --- デバッガーフレームワーク.
                                                             (line  227)
* dispatch_exception() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  247)
* dispatch_line() (bdb.Bdb のメソッド):  bdb --- デバッガーフレームワーク.
                                                             (line  217)
* dispatch_return() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  237)
* dispatch_table (pickle.Pickler の属性): モジュールインターフェース.
                                                             (line  186)
* DISPLAY:                               Tkinter モジュール. (line   25)
* display (pdb command):                 Debugger commands.  (line  295)
* display_name (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  422)
* display_name (email.headerregistry.Group の属性): email headerregistry Custom Header Objects.
                                                             (line  466)
* displayhook() (sys モジュール):        sys --- システム固有のパラメーターと関数.
                                                             (line  332)
* dist() (math モジュール):              Summation and product functions.
                                                             (line    6)
* distance() (turtle モジュール):        Turtle の状態を知る.
                                                             (line   66)
* distb() (dis モジュール):              解析関数.           (line   83)
* Distribution (importlib.metadata のクラス): Distributions. (line   35)
* distribution() (importlib.metadata モジュール): Distributions.
                                                             (line   18)
* DistributionFinder (importlib.metadata のクラス): Distribution Discovery.
                                                             (line   19)
* DistributionFinder.Context (importlib.metadata のクラス): Distribution Discovery.
                                                             (line   27)
* distributions() (importlib.metadata モジュール): Distribution Discovery.
                                                             (line   65)
* 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)
* DllCanUnloadNow() (ctypes モジュール): ユーティリティー関数.
                                                             (line  113)
* DllGetClassObject() (ctypes モジュール): ユーティリティー関数.
                                                             (line  121)
* dllhandle (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line  326)
* dllist() (ctypes.util モジュール):     ユーティリティー関数.
                                                             (line  129)
* dnd_start() (tkinter.dnd モジュール):  tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   64)
* DndHandler (tkinter.dnd のクラス):     tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   42)
* dngettext() (gettext モジュール):      GNU gettext API.    (line   59)
* dnpgettext() (gettext モジュール):     GNU gettext API.    (line   70)
* do_clear() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  310)
* do_command() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line   31)
* do_GET() (http.server.SimpleHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  460)
* do_handshake() (ssl.SSLSocket のメソッド): SSL sockets.    (line  133)
* do_HEAD() (http.server.SimpleHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  453)
* do_help() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line   47)
* doc (json.JSONDecodeError の属性):     例外<21>.           (line   14)
* doc (tomllib.TOMLDecodeError の属性):  tomllib --- TOML ファイルの解析.
                                                             (line   77)
* doc_header (cmd.Cmd の属性):           Cmdオブジェクト.    (line  152)
* DocCGIXMLRPCRequestHandler (xmlrpc.server のクラス): XMLRPC サーバの文書化.
                                                             (line   22)
* DocFileSuite() (doctest モジュール):   単体テスト API.     (line   25)
* doClassCleanups() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  922)
* doCleanups() (unittest.TestCase のメソッド): テストクラス. (line  882)
* docmd() (smtplib.SMTP のメソッド):     SMTP オブジェクト.  (line   17)
* docstring:                             クラス定義.         (line    6)
* docstring <1>:                         用語集<2>.          (line  511)
* 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  107)
* 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  355)
* domain (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  432)
* 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:                          例外<24>.           (line   17)
* doModuleCleanups() (unittest モジュール): setUpModule と tearDownModule.
                                                             (line   45)
* DomstringSizeErr:                      例外<24>.           (line   22)
* done() (asyncio.Future のメソッド):    Future オブジェクト<2>.
                                                             (line   64)
* done() (asyncio.Task のメソッド):      Task object.        (line   67)
* 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  369)
* dont_write_bytecode (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  582)
* doRollover() (logging.handlers.RotatingFileHandler のメソッド): RotatingFileHandler.
                                                             (line   44)
* doRollover() (logging.handlers.TimedRotatingFileHandler のメソッド): TimedRotatingFileHandler.
                                                             (line  102)
* DOT (token モジュール):                token --- Python 解析木で使われる定数.
                                                             (line  251)
* dot() (turtle モジュール):             Turtle の動き.      (line  248)
* DOTALL (re モジュール):                フラグ.             (line  103)
* doublequote (csv.Dialect の属性):      Dialect クラスと書式化パラメータ.
                                                             (line   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)
* doupdate() (curses モジュール):        関数<6>.            (line  104)
* down (pdb command):                    Debugger commands.  (line   93)
* down() (turtle モジュール):            描画状態.           (line    6)
* dpgettext() (gettext モジュール):      GNU gettext API.    (line   66)
* drain() (asyncio.StreamWriter のメソッド): StreamWriter.   (line   71)
* drive (pathlib.PurePath の属性):       メソッドとプロパティ.
                                                             (line   15)
* drop_whitespace (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  203)
* dropwhile() (itertools モジュール):    Itertool関数.       (line  266)
* dst() (datetime.datetime のメソッド):  datetime objects.   (line  545)
* dst() (datetime.time のメソッド):      time objects.       (line  258)
* dst() (datetime.timezone のメソッド):  timezone objects.   (line   57)
* dst() (datetime.tzinfo のメソッド):    tzinfo objects.     (line   65)
* DTDHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   24)
* duck-typing:                           用語集<2>.          (line  520)
* dump_c_stack() (faulthandler モジュール): Dumping the C stack.
                                                             (line    8)
* dump_stats() (profile.Profile のメソッド): profile and profiling tracing module reference.
                                                             (line  109)
* dump_stats() (profiling.tracing.Profile のメソッド): Module reference.
                                                             (line   77)
* dump_stats() (pstats.Stats のメソッド): The Stats class.   (line   41)
* dump_traceback_later() (faulthandler モジュール): タイムアウト後にtracebackをダンプする.
                                                             (line    6)
* dump_traceback() (faulthandler モジュール): tracebackのダンプ.
                                                             (line    6)
* dump() (ast モジュール):               ast helpers.        (line  272)
* dump() (json モジュール):              基本的な使い方<4>.  (line    6)
* dump() (marshal モジュール):           marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   75)
* dump() (pickle モジュール):            モジュールインターフェース.
                                                             (line   39)
* dump() (pickle.Pickler のメソッド):    モジュールインターフェース.
                                                             (line  162)
* dump() (plistlib モジュール):          plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line   93)
* dump() (tracemalloc.Snapshot のメソッド): Snapshot.        (line   29)
* dump() (xml.etree.ElementTree モジュール): 関数<9>.        (line   85)
* dumps() (json モジュール):             基本的な使い方<4>.  (line   91)
* dumps() (marshal モジュール):          marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line  117)
* dumps() (pickle モジュール):           モジュールインターフェース.
                                                             (line   51)
* dumps() (plistlib モジュール):         plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  130)
* dumps() (xmlrpc.client モジュール):    補助関数.           (line    6)
* dunder:                                用語集<2>.          (line  534)
* dup() (os モジュール):                 ファイル記述子の操作.
                                                             (line   93)
* dup() (socket.socket のメソッド):      socket オブジェクト.
                                                             (line  108)
* dup2() (os モジュール):                ファイル記述子の操作.
                                                             (line  106)
* DuplicateOptionError:                  例外<10>.           (line   24)
* DuplicateSectionError:                 例外<10>.           (line   14)
* dwFlags (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   20)
* DynamicClassAttribute() (types モジュール): 追加のユーティリティクラスと関数.
                                                             (line   54)
* e (cmath モジュール):                  定数<3>.            (line   10)
* e (math モジュール):                   定数<2>.            (line   10)
* e;in numeric literal:                  整数リテラル.       (line   65)
* E2BIG (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   56)
* EACCES (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   82)
* EADDRINUSE (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  450)
* EADDRNOTAVAIL (errno モジュール):      errno --- 標準の errno システムシンボル.
                                                             (line  454)
* EADV (errno モジュール):               errno --- 標準の errno システムシンボル.
                                                             (line  313)
* EAFNOSUPPORT (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  445)
* EAFP:                                  用語集<2>.          (line  540)
* EAGAIN (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   73)
* eager_task_factory() (asyncio モジュール): Eager task factory.
                                                             (line    6)
* EALREADY (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  529)
* east_asian_width() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  108)
* EAUTH (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  609)
* EBADARCH (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  615)
* EBADE (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  248)
* EBADEXEC (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  621)
* EBADF (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   64)
* EBADFD (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  350)
* EBADMACHO (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  627)
* EBADMSG (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  337)
* EBADR (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  252)
* EBADRPC (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  693)
* EBADRQC (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  264)
* EBADSLT (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  268)
* EBFONT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  277)
* EBUSY (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   95)
* ECANCELED (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  720)
* ECHILD (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   68)
* echo() (curses モジュール):            関数<6>.            (line  120)
* echochar() (curses.window のメソッド): Window オブジェクト.
                                                             (line  191)
* ECHRNG (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  215)
* ECOMM (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  321)
* ECONNABORTED (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  472)
* ECONNREFUSED (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  510)
* ECONNRESET (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  477)
* EDEADLK (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  177)
* EDEADLOCK (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  272)
* EDESTADDRREQ (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  404)
* EDEVERR (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  633)
* edit() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line   20)
* EDOM (errno モジュール):               errno --- 標準の errno システムシンボル.
                                                             (line  167)
* EDOTDOT (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  333)
* EDQUOT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  563)
* EEXIST (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   99)
* EFAULT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   87)
* EFBIG (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  142)
* EFD_CLOEXEC (os モジュール):           ファイルとディレクトリ.
                                                             (line 2338)
* EFD_NONBLOCK (os モジュール):          ファイルとディレクトリ.
                                                             (line 2347)
* EFD_SEMAPHORE (os モジュール):         ファイルとディレクトリ.
                                                             (line 2356)
* effective() (bdb モジュール):          bdb --- デバッガーフレームワーク.
                                                             (line  506)
* EFTYPE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  639)
* ehlo_or_helo_if_needed() (smtplib.SMTP のメソッド): SMTP オブジェクト.
                                                             (line   74)
* ehlo_resp (smtplib.SMTP の属性):       SMTP オブジェクト.  (line  351)
* ehlo() (smtplib.SMTP のメソッド):      SMTP オブジェクト.  (line   59)
* 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 スタイル.
                                                             (line  133)
* element_names() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  252)
* element_options() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  256)
* ElementDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  365)
* 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   60)
* EllipsisType (types モジュール):       標準的なインタプリタ型.
                                                             (line  143)
* ELNRNG (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  231)
* ELOCKUNMAPPED (errno モジュール):      errno --- 標準の errno システムシンボル.
                                                             (line  601)
* ELOOP (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  197)
* else;conditional expression:           条件式 Conditional Expressions.
                                                             (line    6)
* EM (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   99)
* EmailMessage (email.message のクラス): email message Representing an email message.
                                                             (line   52)
* EmailPolicy (email.policy のクラス):   email policy Policy Objects.
                                                             (line  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   76)
* 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  383)
* EMSGSIZE (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  408)
* EMULTIHOP (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  329)
* enable (pdb command):                  Debugger commands.  (line  148)
* enable_callback_tracebacks() (sqlite3 モジュール): モジュール関数.
                                                             (line  123)
* enable_interspersed_args() (optparse.OptionParser のメソッド): オプション解析器への問い合わせと操作.
                                                             (line   32)
* enable_load_extension() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  428)
* enable_long_distance_matching (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  131)
* enable_traversal() (tkinter.ttk.Notebook のメソッド): ttk Notebook.
                                                             (line   74)
* ENABLE_USER_SITE (site モジュール):    モジュールの内容<7>.
                                                             (line   10)
* enable() (bdb.Breakpoint のメソッド):  bdb --- デバッガーフレームワーク.
                                                             (line   49)
* enable() (faulthandler モジュール):    フォールトハンドラの状態.
                                                             (line    6)
* enable() (gc モジュール):              gc --- ガベージコレクターインターフェース.
                                                             (line   21)
* enable() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line   89)
* enable() (profile.Profile のメソッド): profile and profiling tracing module reference.
                                                             (line   81)
* enable() (profiling.tracing.Profile のメソッド): Module reference.
                                                             (line   53)
* EnableControlFlowGuard:                ビルド<43>.         (line   47)
* enabled (bdb.Breakpoint の属性):       bdb --- デバッガーフレームワーク.
                                                             (line  104)
* EnableReflectionKey() (winreg モジュール): 関数<14>.       (line  513)
* ENAMETOOLONG (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  181)
* ENAVAIL (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  551)
* enclose() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  196)
* encode (codecs.CodecInfo の属性):      codecs --- codec レジストリと基底クラス.
                                                             (line   86)
* 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  231)
* 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  221)
* encodePriority() (logging.handlers.SysLogHandler のメソッド): SysLogHandler.
                                                             (line  100)
* encodestring() (quopri モジュール):    quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   47)
* encoding (curses.window の属性):       Window オブジェクト.
                                                             (line  206)
* encoding (io.TextIOBase の属性):       テキスト I/O<2>.    (line   15)
* ENCODING (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  334)
* ENCODING (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  153)
* encoding (UnicodeError の属性):        具象例外.           (line  447)
* encoding declarations (source file):   エンコード宣言 encoding declaration.
                                                             (line    6)
* encodings_map (mimetypes モジュール):  mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  159)
* encodings_map (mimetypes.MimeTypes の属性): MimeTypes objects.
                                                             (line   32)
* EncodingWarning:                       警告.               (line   71)
* end (UnicodeError の属性):             具象例外.           (line  468)
* 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  343)
* 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  348)
* 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  142)
* 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  469)
* EndDoctypeDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  360)
* 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  391)
* endElementNS() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  114)
* endheaders() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  198)
* ENDMARKER (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  148)
* EndNamespaceDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  449)
* endpos (re.Match の属性):              Match objects.      (line  179)
* 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  125)
* ENEEDAUTH (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  645)
* ENETDOWN (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  459)
* ENETRESET (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  467)
* ENETUNREACH (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  463)
* ENFILE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  126)
* ENOANO (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  260)
* ENOATTR (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  651)
* ENOBUFS (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  482)
* ENOCSI (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  240)
* ENODATA (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  285)
* ENODEV (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  108)
* ENOENT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   32)
* ENOEXEC (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line   60)
* ENOKEY (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  581)
* ENOLCK (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  185)
* ENOLINK (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  309)
* ENOMEDIUM (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  573)
* ENOMEM (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   78)
* ENOMSG (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  207)
* ENONET (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  297)
* ENOPKG (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  301)
* ENOPOLICY (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  657)
* ENOPROTOOPT (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  417)
* ENOSPC (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  146)
* ENOSR (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  293)
* ENOSTR (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  281)
* ENOSYS (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  189)
* ENOTACTIVE (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  605)
* ENOTBLK (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line   91)
* ENOTCAPABLE (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  711)
* ENOTCONN (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  491)
* ENOTDIR (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  112)
* ENOTEMPTY (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  193)
* ENOTNAM (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  547)
* ENOTRECOVERABLE (errno モジュール):    errno --- 標準の errno システムシンボル.
                                                             (line  732)
* ENOTSOCK (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  400)
* ENOTSUP (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  434)
* ENOTTY (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  134)
* ENOTUNIQ (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  346)
* ENQ (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   33)
* enqueue_sentinel() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line  100)
* enqueue() (logging.handlers.QueueHandler のメソッド): QueueHandler.
                                                             (line   89)
* ensure_directories() (venv.EnvBuilder のメソッド): API<2>. (line   86)
* ensure_future() (asyncio モジュール):  Future の関数.      (line   19)
* ensurepip コマンドラインオプション; -altinstall: コマンドライン・インターフェース<10>.
                                                             (line   40)
* ensurepip コマンドラインオプション; -default-pip: コマンドライン・インターフェース<10>.
                                                             (line   45)
* ensurepip コマンドラインオプション; -root: コマンドライン・インターフェース<10>.
                                                             (line   24)
* ensurepip コマンドラインオプション; -user: コマンドライン・インターフェース<10>.
                                                             (line   30)
* enter_async_context() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  669)
* enter_context() (contextlib.ExitStack のメソッド): ユーティリティ.
                                                             (line  581)
* enter() (sched.scheduler のメソッド):  スケジューラオブジェクト.
                                                             (line   29)
* enterabs() (sched.scheduler のメソッド): スケジューラオブジェクト.
                                                             (line    8)
* enterAsyncContext() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  980)
* enterClassContext() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  913)
* enterContext() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  873)
* enterModuleContext() (unittest モジュール): setUpModule と tearDownModule.
                                                             (line   36)
* entities (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   38)
* EntityDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  420)
* entitydefs (html.entities モジュール): html entities --- HTML 一般実体の定義.
                                                             (line   24)
* EntityResolver (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   31)
* entry_points (importlib.metadata.Distribution の属性): Distributions.
                                                             (line  100)
* entry_points() (importlib.metadata モジュール): エントリポイント.
                                                             (line    6)
* EntryPoint (importlib.metadata のクラス): エントリポイント.
                                                             (line   26)
* EntryPoints (importlib.metadata のクラス): エントリポイント.
                                                             (line   18)
* Enum (enum のクラス):                  データ型<2>.        (line  119)
* enum_certificates() (ssl モジュール):  証明書の取り扱い.   (line   86)
* enum_crls() (ssl モジュール):          証明書の取り扱い.   (line  109)
* EnumCheck (enum のクラス):             データ型<2>.        (line  650)
* EnumDict (enum のクラス):              データ型<2>.        (line  777)
* enumerate() (threading モジュール):    リファレンス<2>.    (line   98)
* EnumKey() (winreg モジュール):         関数<14>.           (line  190)
* EnumType (enum のクラス):              データ型<2>.        (line    6)
* EnumValue() (winreg モジュール):       関数<14>.           (line  208)
* EnvBuilder (venv のクラス):            API<2>.             (line   10)
* environ (os モジュール):               プロセスのパラメーター.
                                                             (line   15)
* environ (posix モジュール):            注目すべきモジュールの内容.
                                                             (line    9)
* environb (os モジュール):              プロセスのパラメーター.
                                                             (line   63)
* EnvironmentError:                      具象例外.           (line  505)
* 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  211)
* 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  280)
* 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  678)
* 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  303)
* ERA_D_FMT (locale モジュール):         locale --- 国際化サービス.
                                                             (line  325)
* ERA_D_T_FMT (locale モジュール):       locale --- 国際化サービス.
                                                             (line  319)
* ERA_T_FMT (locale モジュール):         locale --- 国際化サービス.
                                                             (line  331)
* ERANGE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  172)
* erase() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  216)
* erasechar() (curses モジュール):       関数<6>.            (line  129)
* EREMCHG (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  354)
* EREMOTE (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  305)
* EREMOTEIO (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  559)
* ERESTART (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  387)
* erf() (math モジュール):               特殊関数.           (line    6)
* erfc() (math モジュール):              特殊関数.           (line   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  176)
* error:                                 関数と例外.         (line    8)
* Error:                                 copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   34)
* Error <1>:                             ディレクトリとファイルの操作.
                                                             (line  492)
* error <1>:                             dbm --- Unix "データベース" へのインターフェース.
                                                             (line   27)
* 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>:                             例外<8>.            (line   15)
* error <5>:                             zlib --- gzip 互換の圧縮.
                                                             (line   26)
* Error <3>:                             モジュールコンテンツ.
                                                             (line  333)
* Error <4>:                             例外<10>.           (line    6)
* error <6>:                             os --- 雑多なオペレーティングシステムインターフェース.
                                                             (line   50)
* error <7>:                             関数<6>.            (line    8)
* error <8>:                             _thread --- 低水準なスレッド API.
                                                             (line   20)
* error <9>:                             例外<19>.           (line    6)
* error <10>:                            select --- I/O 完了の待機.
                                                             (line   30)
* Error <5>:                             例外<22>.           (line    8)
* Error <6>:                             binascii --- バイナリ と ASCII 間の変換.
                                                             (line  375)
* error <11>:                            xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   31)
* Error <7>:                             コマンドライン・インターフェース<6>.
                                                             (line   26)
* Error <8>:                             wave --- WAV ファイルの読み書き.
                                                             (line   60)
* Error <9>:                             locale --- 国際化サービス.
                                                             (line   21)
* error <12>:                            resource --- リソース使用情報.
                                                             (line   18)
* error <13>:                            getopt --- C-style parser for command line options.
                                                             (line  105)
* ERROR (logging モジュール):            ロギングレベル.     (line   40)
* ERROR (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  192)
* error_body (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  261)
* error_content_type (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  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  298)
* errorcode (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line   13)
* ErrorCode (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  302)
* ErrorColumnNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  308)
* ErrorHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   37)
* errorlevel (tarfile.TarFile の属性):   TarFile オブジェクト.
                                                             (line  228)
* ErrorLineNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  312)
* 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  267)
* 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  360)
* 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  234)
* ETHERTYPE_ARP (socket モジュール):     定数<8>.            (line  468)
* ETHERTYPE_IP (socket モジュール):      定数<8>.            (line  468)
* ETHERTYPE_IPV6 (socket モジュール):    定数<8>.            (line  468)
* ETHERTYPE_VLAN (socket モジュール):    定数<8>.            (line  468)
* 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  551)
* 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  532)
* evaluate_default() (typing.TypeVar のメソッド): Building generic types and type aliases.
                                                             (line  225)
* evaluate_default() (typing.TypeVarTuple のメソッド): Building generic types and type aliases.
                                                             (line  392)
* evaluate_forward_ref() (typing モジュール): Introspection helpers.
                                                             (line  203)
* evaluate_value() (typing.TypeAliasType のメソッド): Building generic types and type aliases.
                                                             (line  677)
* evaluate() (annotationlib.ForwardRef のメソッド): クラス<5>.
                                                             (line   65)
* Event (asyncio のクラス):              Event.              (line    6)
* Event (multiprocessing のクラス):      同期プリミティブ.   (line   58)
* Event (threading のクラス):            Event objects.      (line   14)
* EVENT_READ (selectors モジュール):     クラス<4>.          (line   23)
* EVENT_WRITE (selectors モジュール):    クラス<4>.          (line   26)
* Event() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  186)
* eventfd_read() (os モジュール):        ファイルとディレクトリ.
                                                             (line 2318)
* eventfd_write() (os モジュール):       ファイルとディレクトリ.
                                                             (line 2328)
* eventfd() (os モジュール):             ファイルとディレクトリ.
                                                             (line 2265)
* EventLoop (asyncio のクラス):          Event loop implementations.
                                                             (line   42)
* events (selectors.SelectorKey の属性): クラス<4>.          (line   44)
* events (widgets):                      バインドとイベント. (line    6)
* EWOULDBLOCK (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  202)
* EX_CANTCREAT (os モジュール):          プロセス管理.       (line  208)
* EX_CONFIG (os モジュール):             プロセス管理.       (line  243)
* EX_DATAERR (os モジュール):            プロセス管理.       (line  157)
* EX_IOERR (os モジュール):              プロセス管理.       (line  215)
* EX_NOHOST (os モジュール):             プロセス管理.       (line  176)
* EX_NOINPUT (os モジュール):            プロセス管理.       (line  163)
* EX_NOPERM (os モジュール):             プロセス管理.       (line  236)
* EX_NOTFOUND (os モジュール):           プロセス管理.       (line  249)
* EX_NOUSER (os モジュール):             プロセス管理.       (line  170)
* EX_OK (os モジュール):                 プロセス管理.       (line  142)
* EX_OSERR (os モジュール):              プロセス管理.       (line  194)
* EX_OSFILE (os モジュール):             プロセス管理.       (line  201)
* EX_PROTOCOL (os モジュール):           プロセス管理.       (line  229)
* EX_SOFTWARE (os モジュール):           プロセス管理.       (line  188)
* EX_TEMPFAIL (os モジュール):           プロセス管理.       (line  221)
* EX_UNAVAILABLE (os モジュール):        プロセス管理.       (line  182)
* EX_USAGE (os モジュール):              プロセス管理.       (line  150)
* EXACT_TOKEN_TYPES (token モジュール):  token --- Python 解析木で使われる定数.
                                                             (line  353)
* Example (doctest のクラス):            Example オブジェクト.
                                                             (line    6)
* example (doctest.DocTestFailure の属性): デバッグ.         (line  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>:         例外<25>.           (line   45)
* exc_info() (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  480)
* 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  203)
* excel_tab (csv のクラス):              モジュールコンテンツ.
                                                             (line  209)
* ExceptHandler (ast のクラス):          制御フロー.         (line  201)
* excepthook() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line  426)
* excepthook() (threading モジュール):   リファレンス<2>.    (line   24)
* Exception:                             基底クラス.         (line   63)
* EXCEPTION (_tkinter モジュール):       ファイルハンドラ.   (line   42)
* EXCEPTION_HANDLED (monitoring event):  Events.             (line   35)
* exception() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line  133)
* exception() (asyncio.Task のメソッド): Task object.        (line   88)
* exception() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   52)
* exception() (logging モジュール):      モジュールレベルの関数.
                                                             (line   89)
* exception() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  308)
* exception() (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  468)
* ExceptionGroup:                        例外グループ.       (line   11)
* exceptions (BaseExceptionGroup の属性): 例外グループ.      (line   37)
* exceptions (pdb command):              Debugger commands.  (line  458)
* exceptions (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   52)
* excinfo (concurrent.interpreters.ExecutionFailed の属性): 例外<14>.
                                                             (line   21)
* EXCLAMATION (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  344)
* EXDEV (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  104)
* EXE_LDFLAGS:                           Linker flags.       (line  102)
* exec_module() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  271)
* exec_module() (importlib.abc.Loader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  164)
* 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  335)
* exec_module() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   31)
* exec_prefix (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  499)
* 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 (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  522)
* 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:                       例外<14>.           (line   16)
* ExecutionLoader (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line  277)
* 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  127)
* exists() (pathlib.Path のメソッド):    ファイルの種類とステータスを問い合わせる.
                                                             (line   44)
* exists() (pathlib.types.PathInfo のメソッド): プロトコル.  (line   16)
* exists() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   90)
* exists() (zipfile.Path のメソッド):    Path objects.       (line   74)
* exit (C function):                     プロセス制御.       (line   23)
* exit (組み込み変数):                   site モジュールで追加される定数.
                                                             (line   11)
* exit() (_thread モジュール):           _thread --- 低水準なスレッド API.
                                                             (line   76)
* exit() (argparse.ArgumentParser のメソッド): 終了メソッド. (line    6)
* exit() (sys モジュール):               sys --- システム固有のパラメーターと関数.
                                                             (line  529)
* exitcode (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  160)
* exitonclick() (turtle モジュール):     Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   10)
* ExitStack (contextlib のクラス):       ユーティリティ.     (line  542)
* 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   21)
* ExpandEnvironmentStrings() (winreg モジュール): 関数<14>.  (line  245)
* expandNode() (xml.dom.pulldom.DOMEventStream のメソッド): DOMEventStream オブジェクト.
                                                             (line   20)
* expandtabs() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  485)
* expandtabs() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  485)
* expandtabs() (str のメソッド):         文字列メソッド<2>.  (line  137)
* expanduser() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  151)
* expanduser() (pathlib.Path のメソッド): パスの展開と解決.  (line   18)
* expandvars() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  177)
* Expat:                                 xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   11)
* ExpatError:                            xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   25)
* expected (asyncio.IncompleteReadError の属性): 例外<17>.   (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  557)
* Expression (ast のクラス):             Root nodes.         (line   26)
* expression (string.templatelib.Interpolation の属性): 型.  (line  221)
* expression;list:                       式のリスト.         (line    6)
* expression;list <1>:                   式文 expression statement.
                                                             (line    6)
* expression;list <2>:                   式文 expression statement.
                                                             (line    6)
* expression;statement:                  式文 expression statement.
                                                             (line    6)
* expunge() (imaplib.IMAP4 のメソッド):  IMAP4 オブジェクト. (line   98)
* extend_path() (pkgutil モジュール):    pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   19)
* extend() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  196)
* extend() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   59)
* extend() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line   92)
* extend() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   94)
* EXTENDED_ARG (opcode):                 Python バイトコード命令.
                                                             (line 1206)
* extended_pictographic() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  182)
* ExtendedContext (decimal モジュール):  Context オブジェクト.
                                                             (line   82)
* ExtendedInterpolation (configparser のクラス): 値の補間.   (line   39)
* extendleft() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   64)
* extension module:                      用語集<2>.          (line  566)
* EXTENSION_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   48)
* ExtensionFileLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  303)
* extensions_map (http.server.SimpleHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  429)
* external_attr (zipfile.ZipInfo の属性): ZipInfo objects.   (line  143)
* ExternalClashError:                    例外<22>.           (line   26)
* ExternalEntityParserCreate() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   43)
* ExternalEntityRefHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  495)
* extra (zipfile.ZipInfo の属性):        ZipInfo objects.    (line  109)
* extra_response_headers (http.server.SimpleHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  439)
* extract_cookies() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   32)
* extract_stack() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line   92)
* extract_tb() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line   80)
* extract_version (zipfile.ZipInfo の属性): ZipInfo objects. (line  123)
* extract() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  181)
* extract() (traceback.StackSummary のクラスメソッド): StackSummary オブジェクト.
                                                             (line   13)
* extract() (zipfile.ZipFile のメソッド): ZipFile objects.   (line  195)
* extractall() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  141)
* extractall() (zipfile.ZipFile のメソッド): ZipFile objects.
                                                             (line  223)
* ExtractError:                          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  280)
* 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_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  498)
* f_generator (frame attribute):         フレーム frame オブジェクト.
                                                             (line   10)
* f_generator (frame の属性):            Special read-only attributes<3>.
                                                             (line   38)
* f_globals (frame の属性):              Special read-only attributes<3>.
                                                             (line   25)
* f_globals (フレーム属性):              フレーム frame オブジェクト.
                                                             (line   10)
* f_lasti (frame の属性):                Special read-only attributes<3>.
                                                             (line   33)
* f_lasti (フレーム属性):                フレーム frame オブジェクト.
                                                             (line   10)
* f_lineno (frame の属性):               Special writable attributes<2>.
                                                             (line   23)
* f_lineno (フレーム属性):               Special read-only attributes<3>.
                                                             (line   44)
* f_locals (frame の属性):               Special read-only attributes<3>.
                                                             (line   16)
* f_locals (フレーム属性):               フレーム frame オブジェクト.
                                                             (line   10)
* F_LOCK (os モジュール):                ファイル記述子の操作.
                                                             (line  279)
* F_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* F_TEST (os モジュール):                ファイル記述子の操作.
                                                             (line  279)
* F_TLOCK (os モジュール):               ファイル記述子の操作.
                                                             (line  279)
* f_trace (frame の属性):                Special writable attributes<2>.
                                                             (line    6)
* f_trace (フレーム属性):                Special read-only attributes<3>.
                                                             (line   45)
* f_trace_lines (frame attribute):       Special read-only attributes<3>.
                                                             (line   45)
* f_trace_lines (frame の属性):          Special writable attributes<2>.
                                                             (line   12)
* f_trace_opcodes (frame attribute):     Special read-only attributes<3>.
                                                             (line   45)
* f_trace_opcodes (frame の属性):        Special writable attributes<2>.
                                                             (line   16)
* F_ULOCK (os モジュール):               ファイル記述子の操作.
                                                             (line  279)
* f-string:                              出力を見やすくフォーマットする.
                                                             (line   91)
* f-string <1>:                          Raw string literals.
                                                             (line   25)
* f-string <2>:                          用語集<2>.          (line  571)
* f-strings:                             文字列メソッド<2>.  (line  973)
* f-strings <1>:                         用語集<2>.          (line  574)
* 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   13)
* factorial() (math.integer モジュール): math integer --- integer-specific mathematics functions.
                                                             (line   32)
* factory() (importlib.util.LazyLoader のクラスメソッド): importlib util -- Utility code for importers.
                                                             (line  221)
* FAIL_FAST (doctest モジュール):        オプションフラグ.   (line  138)
* fail() (unittest.TestCase のメソッド): テストクラス.       (line  781)
* failed (doctest.TestResults の属性):   TestResults objects.
                                                             (line    8)
* failfast (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  300)
* failureException (unittest.TestCase の属性): テストクラス. (line  786)
* failures (doctest.DocTestRunner の属性): DocTestRunner オブジェクト.
                                                             (line  153)
* 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 (組み込みオブジェクト):          真理値判定.         (line   17)
* False (組み込み変数):                  組み込み定数.       (line    8)
* families() (tkinter.font モジュール):  tkinter font --- Tkinter フォントラッパー.
                                                             (line   88)
* family (socket.socket の属性):         socket オブジェクト.
                                                             (line  616)
* 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  517)
* 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  105)
* 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 のクラス):          モジュールの内容<6>.
                                                             (line  308)
* field_size_limit() (csv モジュール):   モジュールコンテンツ.
                                                             (line   94)
* field() (dataclasses モジュール):      モジュールの内容<6>.
                                                             (line  204)
* fieldnames (csv.DictReader の属性):    reader オブジェクト.
                                                             (line   31)
* fields (uuid.UUID の属性):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   96)
* fields() (dataclasses モジュール):     モジュールの内容<6>.
                                                             (line  336)
* FIFOTYPE (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  364)
* file (bdb.Breakpoint の属性):          bdb --- デバッガーフレームワーク.
                                                             (line   83)
* file (imaplib.IMAP4 のプロパティ):     IMAP4 オブジェクト. (line  507)
* file (pyclbr.Class の属性):            クラスオブジェクト<2>.
                                                             (line   12)
* file (pyclbr.Function の属性):         Function オブジェクト.
                                                             (line   11)
* file object:                           用語集<2>.          (line  579)
* file object;io module:                 概要<2>.            (line    6)
* file object;open() built-in function:  組み込み関数.       (line 1277)
* 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  595)
* fileConfig() (logging.config モジュール): 環境設定のための関数.
                                                             (line   60)
* FileCookieJar (http.cookiejar のクラス): http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   57)
* FileDialog (tkinter.filedialog のクラス): ネイティブの読み込み/保存ダイアログ.
                                                             (line   77)
* FileExistsError:                       OS 例外.            (line   63)
* FileFinder (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  152)
* FileHandler (logging のクラス):        FileHandler.        (line   10)
* FileHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  473)
* FileInput (fileinput のクラス):        fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  135)
* FileIO (io のクラス):                  生ファイルI/O.      (line    6)
* filelineno() (fileinput モジュール):   fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  102)
* FileLoader (importlib.abc のクラス):   importlib abc -- Abstract base classes related to import.
                                                             (line  296)
* 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  197)
* FILENAME (pstats.SortKey の属性):      The Stats class.    (line  206)
* filename (SyntaxError の属性):         具象例外.           (line  325)
* filename (traceback.FrameSummary の属性): FrameSummary オブジェクト.
                                                             (line   28)
* filename (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   89)
* filename (tracemalloc.Frame の属性):   Frame.              (line   13)
* filename (zipfile.ZipFile の属性):     ZipFile objects.    (line  366)
* 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  197)
* 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  119)
* fileno() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line   15)
* FileNotFoundError:                     OS 例外.            (line   68)
* fileobj (selectors.SelectorKey の属性): クラス<4>.         (line   36)
* files (importlib.metadata.Distribution の属性): Distributions.
                                                             (line  104)
* files_double_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   93)
* files_select_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   97)
* files() (importlib.metadata モジュール): 配布物ファイル.   (line    6)
* files() (importlib.resources モジュール): importlib resources -- パッケージリソースの読み取り、オープン、アクセス.
                                                             (line   51)
* files() (importlib.resources.abc.TraversableResources のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  172)
* filesystem encoding and error handler: 用語集<2>.          (line  599)
* 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 のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  101)
* FILTER_DIR (unittest.mock モジュール): FILTER_DIR.         (line    6)
* filter_traces() (tracemalloc.Snapshot のメソッド): Snapshot.
                                                             (line   36)
* filter() (curses モジュール):          関数<6>.            (line  136)
* filter() (fnmatch モジュール):         fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   76)
* filter() (logging.Filter のメソッド):  フィルタオブジェクト.
                                                             (line   21)
* filter() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   63)
* filter() (logging.Logger のメソッド):  ロガーオブジェクト. (line  323)
* FilterError:                           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  291)
* filterfalse() (fnmatch モジュール):    fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   83)
* filterfalse() (itertools モジュール):  Itertool関数.       (line  287)
* filterwarnings() (warnings モジュール): 利用可能な関数.    (line  121)
* Final (typing モジュール):             特殊形式.           (line  232)
* final() (typing モジュール):           Functions and decorators.
                                                             (line  309)
* finalization, of objects:              ファイナライズとメモリ解放.
                                                             (line    6)
* finalize (weakref のクラス):           weakref --- Weak references.
                                                             (line  258)
* finalize_dict() (compression.zstd モジュール): Zstandard dictionaries.
                                                             (line   28)
* finalizer:                             基本的なカスタマイズ.
                                                             (line   53)
* find_class() (pickle プロトコル):      グローバル変数を制限する.
                                                             (line    6)
* find_class() (pickle.Unpickler のメソッド): モジュールインターフェース.
                                                             (line  310)
* find_library() (ctypes.util モジュール): 共有ライブラリを見つける.
                                                             (line   26)
* find_longest_match() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line   65)
* find_msvcrt() (ctypes.util モジュール): 共有ライブラリを見つける.
                                                             (line   85)
* 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   93)
* 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   99)
* find_spec() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   37)
* find_unused_port() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   15)
* find_user_password() (urllib.request.HTTPPasswordMgr のメソッド): HTTPPasswordMgr オブジェクト.
                                                             (line   16)
* find_user_password() (urllib.request.HTTPPasswordMgrWithPriorAuth のメソッド): HTTPPasswordMgrWithPriorAuth オブジェクト.
                                                             (line   20)
* find() (bytearray のメソッド):         bytes と bytearray の操作.
                                                             (line  134)
* find() (bytes のメソッド):             bytes と bytearray の操作.
                                                             (line  134)
* find() (doctest.DocTestFinder のメソッド): DocTestFinder オブジェクト.
                                                             (line   32)
* find() (gettext モジュール):           クラス形式の API.   (line   14)
* find() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  206)
* find() (str のメソッド):               文字列メソッド<2>.  (line  161)
* find() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  101)
* find() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   20)
* findall() (re モジュール):             関数<2>.            (line  144)
* findall() (re.Pattern のメソッド):     Regular expression objects.
                                                             (line  102)
* findall() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  110)
* findall() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   25)
* findCaller() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  340)
* finder:                                ファインダーとローダー.
                                                             (line    6)
* finder <1>:                            用語集<2>.          (line  621)
* finder;find_spec:                      メタパス.           (line    6)
* findfile() (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line  296)
* finditer() (re モジュール):            関数<2>.            (line  170)
* finditer() (re.Pattern のメソッド):    Regular expression objects.
                                                             (line  108)
* findlabels() (dis モジュール):         解析関数.           (line  186)
* findlinestarts() (dis モジュール):     解析関数.           (line  169)
* findtext() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  119)
* 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   51)
* 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  358)
* fix_missing_locations() (ast モジュール): ast helpers.     (line  149)
* 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  124)
* flags (select.kevent の属性):          Kevent objects.     (line   52)
* flags (sys モジュール):                sys --- システム固有のパラメーターと関数.
                                                             (line  561)
* flash() (curses モジュール):           関数<6>.            (line  147)
* flatten() (email.generator.BytesGenerator のメソッド): email generator Generating MIME documents.
                                                             (line   79)
* flatten() (email.generator.Generator のメソッド): email generator Generating MIME documents.
                                                             (line  172)
* float (組み込みクラス):                組み込み関数.       (line  724)
* float_info (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  665)
* float_repr_style (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  772)
* floating-point literal:                数値リテラル.       (line    6)
* FloatingPointError:                    具象例外.           (line   39)
* FloatOperation (decimal のクラス):     シグナル.           (line  107)
* flock() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  174)
* floor division:                        用語集<2>.          (line  633)
* 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  127)
* 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  254)
* flush() (mailbox.Maildir のメソッド):  Maildir オブジェクト.
                                                             (line  201)
* flush() (mailbox.MH のメソッド):       MH オブジェクト.    (line  103)
* flush() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  216)
* flush() (xml.etree.ElementTree.XMLParser のメソッド): XMLParser オブジェクト.
                                                             (line   32)
* flush() (xml.etree.ElementTree.XMLPullParser のメソッド): XMLPullParser オブジェクト.
                                                             (line   22)
* flush() (zlib.Compress のメソッド):    zlib --- gzip 互換の圧縮.
                                                             (line  239)
* flush() (zlib.Decompress のメソッド):  zlib --- gzip 互換の圧縮.
                                                             (line  313)
* flushinp() (curses モジュール):        関数<6>.            (line  153)
* FlushKey() (winreg モジュール):        関数<14>.           (line  256)
* fma() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  320)
* fma() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  275)
* fma() (math モジュール):               Floating point arithmetic.
                                                             (line   22)
* fmax() (math モジュール):              Floating point arithmetic.
                                                             (line   37)
* fmean() (statistics モジュール):       関数の詳細.         (line   45)
* fmin() (math モジュール):              Floating point arithmetic.
                                                             (line   50)
* fmod() (math モジュール):              Floating point arithmetic.
                                                             (line   63)
* FMT_BINARY (plistlib モジュール):      plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  162)
* FMT_XML (plistlib モジュール):         plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  156)
* fnmatch() (fnmatch モジュール):        fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   51)
* fnmatchcase() (fnmatch モジュール):    fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   70)
* focus() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line   94)
* fold (datetime.datetime の属性):       datetime objects.   (line  343)
* fold (datetime.time の属性):           time objects.       (line   71)
* fold_binary() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  621)
* fold_binary() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  501)
* 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  613)
* fold() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  481)
* 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:                 リスト、集合、辞書の表示.
                                                             (line   14)
* forget() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   11)
* forget() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   18)
* fork() (os モジュール):                プロセス管理.       (line  255)
* fork() (pty モジュール):               pty --- 擬似端末ユーティリティ.
                                                             (line   22)
* ForkingMixIn (socketserver のクラス):  サーバ生成に関するノート.
                                                             (line   26)
* ForkingTCPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ForkingUDPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ForkingUnixDatagramServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ForkingUnixStreamServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* forkpty() (os モジュール):             プロセス管理.       (line  300)
* Format (annotationlib のクラス):       クラス<5>.          (line    6)
* FORMAT (inspect.BufferFlags の属性):   Buffer flags.       (line   19)
* format (memoryview の属性):            メモリビュー.       (line  440)
* format (multiprocessing.shared_memory.ShareableList の属性): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  340)
* format (struct.Struct の属性):         クラス<3>.          (line   56)
* format_call_graph() (asyncio モジュール): Call Graph Introspection.
                                                             (line   70)
* format_datetime() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  173)
* format_exc() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line  161)
* format_exception_only() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  116)
* format_exception_only() (traceback.TracebackException のメソッド): TracebackException オブジェクト.
                                                             (line  151)
* format_exception() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  146)
* format_field() (string.Formatter のメソッド): Custom string formatting.
                                                             (line  102)
* format_frame_summary() (traceback.StackSummary のメソッド): StackSummary オブジェクト.
                                                             (line   54)
* format_help() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   30)
* format_list() (traceback モジュール):  モジュールレベルの関数<2>.
                                                             (line  106)
* format_map() (str のメソッド):         文字列メソッド<2>.  (line  216)
* FORMAT_SIMPLE (opcode):                Python バイトコード命令.
                                                             (line 1232)
* format_spec (string.templatelib.Interpolation の属性): 型. (line  257)
* format_stack_entry() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  455)
* format_stack() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  170)
* format_string() (locale モジュール):   locale --- 国際化サービス.
                                                             (line  460)
* format_tb() (traceback モジュール):    モジュールレベルの関数<2>.
                                                             (line  166)
* format_usage() (argparse.Action のメソッド): Action クラス.
                                                             (line   57)
* format_usage() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   25)
* FORMAT_WITH_SPEC (opcode):             Python バイトコード命令.
                                                             (line 1244)
* format() (inspect.Signature のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  169)
* format() (logging.BufferingFormatter のメソッド): フォーマッタオブジェクト.
                                                             (line  150)
* format() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line   52)
* format() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line  105)
* format() (pprint.PrettyPrinter のメソッド): PrettyPrinter objects.
                                                             (line  105)
* format() (str のメソッド):             文字列メソッド<2>.  (line  182)
* format() (string.Formatter のメソッド): Custom string formatting.
                                                             (line   17)
* format() (traceback.StackSummary のメソッド): StackSummary オブジェクト.
                                                             (line   39)
* format() (traceback.TracebackException のメソッド): TracebackException オブジェクト.
                                                             (line  140)
* format() (tracemalloc.Traceback のメソッド): Traceback.    (line   37)
* format() (組み込み関数);__str__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  128)
* formataddr() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line   71)
* formatargvalues() (inspect モジュール): クラスと関数<2>.   (line   80)
* formatdate() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  151)
* formatday() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  154)
* FormatError:                           例外<22>.           (line   33)
* FormatError() (ctypes モジュール):     ユーティリティー関数.
                                                             (line  145)
* formatException() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line  113)
* formatFooter() (logging.BufferingFormatter のメソッド): フォーマッタオブジェクト.
                                                             (line  143)
* formatHeader() (logging.BufferingFormatter のメソッド): フォーマッタオブジェクト.
                                                             (line  135)
* formatmonth() (calendar.HTMLCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  225)
* formatmonth() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  183)
* formatmonthname() (calendar.HTMLCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  247)
* formatmonthname() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  191)
* formatStack() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line  120)
* formatted string literal:              出力を見やすくフォーマットする.
                                                             (line   91)
* formatted string literal <1>:          Raw string literals.
                                                             (line   25)
* formatted string literals:             文字列メソッド<2>.  (line  973)
* FormattedValue (ast のクラス):         リテラル<3>.        (line   25)
* Formatter (logging のクラス):          フォーマッタオブジェクト.
                                                             (line    6)
* Formatter (string のクラス):           Custom string formatting.
                                                             (line   13)
* formatTime() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line   75)
* formatwarning() (warnings モジュール): 利用可能な関数.     (line  112)
* formatweek() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  161)
* formatweekday() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  169)
* formatweekheader() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  176)
* formatyear() (calendar.HTMLCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  231)
* formatyear() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  205)
* formatyearpage() (calendar.HTMLCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  237)
* Fortran contiguous:                    shape strides suboffsets.
                                                             (line   33)
* Fortran contiguous <1>:                用語集<2>.          (line  380)
* 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  161)
* Fraction (fractions のクラス):         fractions --- 有理数.
                                                             (line   15)
* frame (inspect.FrameInfo の属性):      インタープリタスタック.
                                                             (line   13)
* frame (tkinter.scrolledtext.ScrolledText の属性): tkinter scrolledtext --- スクロール可能なテキストウィジェット.
                                                             (line   26)
* Frame (tracemalloc のクラス):          Frame.              (line    6)
* FrameInfo (compression.zstd のクラス): その他<3>.          (line   12)
* FrameInfo (inspect のクラス):          インタープリタスタック.
                                                             (line   11)
* FrameLocalsProxyType (types モジュール): 標準的なインタプリタ型.
                                                             (line  202)
* FrameSummary (traceback のクラス):     FrameSummary オブジェクト.
                                                             (line   11)
* FrameType (types モジュール):          標準的なインタプリタ型.
                                                             (line  197)
* free (C function):                     概要<4>.            (line   33)
* free threading:                        用語集<2>.          (line  642)
* free variable:                         用語集<2>.          (line  657)
* free_threaded (sys.abi_info の属性):   sys --- システム固有のパラメーターと関数.
                                                             (line   34)
* free_tool_id() (sys.monitoring モジュール): Registering and using tools.
                                                             (line   18)
* free-threaded build:                   用語集<2>.          (line  649)
* 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  221)
* frexp() (math モジュール):             Floating point manipulation functions.
                                                             (line   12)
* FRIDAY (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  444)
* 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_name() (importlib.metadata.Distribution のクラスメソッド): Distributions.
                                                             (line   45)
* 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  205)
* fromfd() (select.epoll のメソッド):    Edge and level trigger polling epoll objects.
                                                             (line   83)
* fromfd() (select.kqueue のメソッド):   Kqueue objects.     (line   18)
* fromfd() (socket モジュール):          ソケットの作成.     (line  156)
* fromfile() (array.array のメソッド):   array --- 効率的な数値配列.
                                                             (line  215)
* fromhex() (bytearray のクラスメソッド): bytearray オブジェクト.
                                                             (line   37)
* fromhex() (bytes のクラスメソッド):    バイトオブジェクト. (line   63)
* fromhex() (float のクラスメソッド):    浮動小数点数に対する追加のメソッド.
                                                             (line   49)
* fromisocalendar() (datetime.date のクラスメソッド): date objects.
                                                             (line   92)
* fromisocalendar() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  250)
* fromisoformat() (datetime.date のクラスメソッド): date objects.
                                                             (line   65)
* fromisoformat() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  203)
* fromisoformat() (datetime.time のクラスメソッド): time objects.
                                                             (line  106)
* fromkeys() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line  119)
* fromkeys() (dict のクラスメソッド):    Mapping types --- dict frozendict.
                                                             (line  166)
* fromlist() (array.array のメソッド):   array --- 効率的な数値配列.
                                                             (line  223)
* fromordinal() (datetime.date のクラスメソッド): date objects.
                                                             (line   56)
* fromordinal() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  178)
* fromshare() (socket モジュール):       ソケットの作成.     (line  173)
* 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  229)
* fromutc() (datetime.timezone のメソッド): timezone objects.
                                                             (line   61)
* fromutc() (datetime.tzinfo のメソッド): tzinfo objects.    (line  166)
* frozendict (組み込みクラス):           Frozen dictionaries.
                                                             (line    6)
* FrozenImporter (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line   79)
* FrozenInstanceError:                   モジュールの内容<6>.
                                                             (line  528)
* FrozenSet (typing のクラス):           Aliases to built-in types.
                                                             (line   42)
* frozenset (組み込みクラス):            set（集合）型 --- set frozenset.
                                                             (line   33)
* FS (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  108)
* fs_is_case_insensitive() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  102)
* FS_NONASCII (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   10)
* fsdecode() (os モジュール):            プロセスのパラメーター.
                                                             (line  119)
* fsencode() (os モジュール):            プロセスのパラメーター.
                                                             (line  106)
* fspath() (os モジュール):              プロセスのパラメーター.
                                                             (line  132)
* fstat() (os モジュール):               ファイル記述子の操作.
                                                             (line  181)
* fstatvfs() (os モジュール):            ファイル記述子の操作.
                                                             (line  193)
* fstring:                               出力を見やすくフォーマットする.
                                                             (line   91)
* fstring <1>:                           Raw string literals.
                                                             (line   25)
* fstring <2>:                           文字列メソッド<2>.  (line  973)
* FSTRING_END (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  110)
* FSTRING_MIDDLE (token モジュール):     token --- Python 解析木で使われる定数.
                                                             (line  100)
* FSTRING_START (token モジュール):      token --- Python 解析木で使われる定数.
                                                             (line   92)
* fsum() (math モジュール):              Summation and product functions.
                                                             (line   18)
* fsync() (os モジュール):               ファイル記述子の操作.
                                                             (line  201)
* FTP:                                   urllib request Restrictions.
                                                             (line   37)
* FTP (ftplib のクラス):                 FTP オブジェクト.   (line    6)
* ftp_open() (urllib.request.FTPHandler のメソッド): FTPHandler オブジェクト.
                                                             (line    6)
* FTP_TLS (ftplib のクラス):             FTP_TLS オブジェクト.
                                                             (line    6)
* FTP;ftplib (standard module):          ftplib --- FTP プロトコルクライアント.
                                                             (line    8)
* FTP;プロトコル:                        urllib request Restrictions.
                                                             (line    6)
* FTP;プロトコル <1>:                    ftplib --- FTP プロトコルクライアント.
                                                             (line    8)
* FTPHandler (urllib.request のクラス):  urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  483)
* ftruncate() (os モジュール):           ファイル記述子の操作.
                                                             (line  213)
* Full:                                  queue --- 同期キュークラス.
                                                             (line   82)
* FULL (inspect.BufferFlags の属性):     Buffer flags.       (line   45)
* full_match() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  248)
* 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   82)
* fullmatch() (re.Pattern のメソッド):   Regular expression objects.
                                                             (line   80)
* 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  673)
* FunctionDef (ast のクラス):            関数およびクラス定義.
                                                             (line    6)
* FunctionTestCase (unittest のクラス):  テストクラス.       (line 1040)
* 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 2161)
* gaierror:                              例外<19>.           (line   26)
* gamma() (math モジュール):             特殊関数.           (line   27)
* gammavariate() (random モジュール):    実数分布.           (line   43)
* garbage (gc モジュール):               gc --- ガベージコレクターインターフェース.
                                                             (line  255)
* garbage collection:                    オブジェクト、値、および型.
                                                             (line   35)
* garbage collection <1>:                用語集<2>.          (line  708)
* gather() (asyncio モジュール):         Running tasks concurrently.
                                                             (line    6)
* gather() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line  112)
* gauss() (random モジュール):           実数分布.           (line   56)
* gc_collect() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  382)
* gcd() (math モジュール):               Number-theoretic functions.
                                                             (line   16)
* gcd() (math.integer モジュール):       math integer --- integer-specific mathematics functions.
                                                             (line   36)
* 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  739)
* generator expression <1>:              用語集<2>.          (line  739)
* generator iterator:                    用語集<2>.          (line  726)
* 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  748)
* generic type:                          用語集<2>.          (line  756)
* generic_visit() (ast.NodeVisitor のメソッド): ast helpers. (line  204)
* Generic;Alias:                         ジェネリックエイリアス型.
                                                             (line    6)
* GenericAlias (types のクラス):         標準的なインタプリタ型.
                                                             (line  149)
* genops() (pickletools モジュール):     Programmatic interface.
                                                             (line   21)
* geometric_mean() (statistics モジュール): 関数の詳細.      (line   73)
* GET_AITER (opcode):                    Python バイトコード命令.
                                                             (line  330)
* get_all_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  417)
* 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  162)
* get_app() (wsgiref.simple_server.WSGIServer のメソッド): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   69)
* get_archive_formats() (shutil モジュール): アーカイブ化操作.
                                                             (line   74)
* get_args() (typing モジュール):        Introspection helpers.
                                                             (line   97)
* get_asyncgen_hooks() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1090)
* get_attribute() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  630)
* GET_AWAITABLE (opcode):                Python バイトコード命令.
                                                             (line  311)
* get_begidx() (readline モジュール):    補完.               (line   41)
* get_blocking() (os モジュール):        ファイル記述子の操作.
                                                             (line  226)
* get_body_encoding() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line   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  393)
* get_break() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  402)
* get_breaks() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  407)
* get_buffer() (asyncio.BufferedProtocol のメソッド): バッファリングされたストリーミングプロトコル.
                                                             (line   21)
* get_bytes() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  174)
* 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_cells() (symtable.Function のメソッド): 記号表の検査.  (line  151)
* get_channel_binding() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  288)
* 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   19)
* get_ciphers() (ssl.SSLContext のメソッド): SSL contexts.   (line  194)
* get_clock_info() (time モジュール):    関数<5>.            (line  111)
* get_close_matches() (difflib モジュール): difflib --- 差分の計算の補助.
                                                             (line  199)
* get_code() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  211)
* 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  347)
* get_code() (importlib.machinery.SourcelessFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  293)
* 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   70)
* 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  172)
* get_context() (multiprocessing モジュール): その他<5>.     (line   86)
* get_coro() (asyncio.Task のメソッド):  Task object.        (line  158)
* get_coroutine_origin_tracking_depth() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1104)
* get_count() (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line  132)
* 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  322)
* get_data() (importlib.abc.ResourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  191)
* 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   84)
* get_disassembly_as_string() (test.support.bytecode_helper.BytecodeTestCase のメソッド): test support bytecode_helper --- Support tools for testing correct bytecode generation.
                                                             (line   18)
* get_docstring() (ast モジュール):      ast helpers.        (line  125)
* 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  161)
* get_escdelay() (curses モジュール):    関数<6>.            (line  451)
* 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  190)
* 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  412)
* get_file() (mailbox.Babyl のメソッド): Babyl オブジェクト. (line   47)
* get_file() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  188)
* 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  283)
* get_filename() (importlib.abc.FileLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  318)
* get_filename() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  356)
* get_filename() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   58)
* get_filter() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  105)
* get_flags() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   90)
* get_flags() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   68)
* get_flags() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   66)
* get_flags() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   65)
* get_folder() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   67)
* get_folder() (mailbox.MH のメソッド):  MH オブジェクト.    (line   41)
* get_frame_info() (compression.zstd モジュール): その他<3>. (line    6)
* get_frees() (symtable.Function のメソッド): 記号表の検査.  (line  146)
* get_freeze_count() (gc モジュール):    gc --- ガベージコレクターインターフェース.
                                                             (line  246)
* 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_groups() (ssl.SSLContext のメソッド): SSL contexts.    (line  231)
* get_handle_inheritable() (os モジュール): ファイル記述子の継承.
                                                             (line   38)
* get_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  122)
* get_history_item() (readline モジュール): 履歴リスト.      (line   19)
* get_history_length() (readline モジュール): 履歴ファイル.  (line   40)
* get_id() (symtable.SymbolTable のメソッド): 記号表の検査.  (line   70)
* get_ident() (_thread モジュール):      _thread --- 低水準なスレッド API.
                                                             (line   86)
* get_ident() (threading モジュール):    リファレンス<2>.    (line   71)
* get_identifiers() (string.Template のメソッド): Template strings $-strings.
                                                             (line   85)
* get_identifiers() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line  105)
* get_importer() (pkgutil モジュール):   pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   53)
* get_info() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  153)
* get_info() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line  106)
* get_inheritable() (os モジュール):     ファイル記述子の継承.
                                                             (line   28)
* get_inheritable() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  129)
* get_instructions() (dis モジュール):   解析関数.           (line  142)
* get_int_max_str_digits() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  878)
* 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  169)
* get_lazy_imports_filter() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  902)
* get_lazy_imports() (sys モジュール):   sys --- システム固有のパラメーターと関数.
                                                             (line  886)
* 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  146)
* 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   74)
* get_map() (selectors.BaseSelector のメソッド): クラス<4>.  (line  156)
* get_matching_blocks() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line  107)
* get_message() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  167)
* get_method() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line   68)
* get_mixed_type_key() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line   56)
* get_name() (asyncio.Task のメソッド):  Task object.        (line  179)
* get_name() (symtable.Symbol のメソッド): 記号表の検査.     (line  168)
* get_name() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   74)
* get_namespace() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  286)
* get_namespaces() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  282)
* get_native_id() (_thread モジュール):  _thread --- 低水準なスレッド API.
                                                             (line   94)
* get_native_id() (threading モジュール): リファレンス<2>.   (line   81)
* get_nonlocals() (symtable.Function のメソッド): 記号表の検査.
                                                             (line  141)
* get_nonstandard_attr() (http.cookiejar.Cookie のメソッド): Cookieオブジェクト<2>.
                                                             (line  104)
* get_nowait() (asyncio.Queue のメソッド): Queue.            (line   48)
* get_nowait() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  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_pre_input_hook() (readline モジュール): 開始フック.    (line   25)
* 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  162)
* get_referrers() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  141)
* 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 のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  109)
* get_sequences() (mailbox.MH のメソッド): MH オブジェクト.  (line   58)
* get_sequences() (mailbox.MHMessage のメソッド): MHMessage オブジェクト.
                                                             (line   32)
* get_server_certificate() (ssl モジュール): 証明書の取り扱い.
                                                             (line   30)
* get_server() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   66)
* get_shapepoly() (turtle モジュール):   見た目.             (line  167)
* get_sigalgs() (ssl モジュール):        Signature algorithms.
                                                             (line    6)
* get_source_segment() (ast モジュール): ast helpers.        (line  137)
* get_source() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  225)
* get_source() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  407)
* get_source() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  352)
* get_source() (importlib.machinery.SourcelessFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  298)
* get_source() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   66)
* get_stack() (asyncio.Task のメソッド): Task object.        (line  122)
* get_stack() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  446)
* 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  183)
* 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  181)
* get_string() (mailbox.mbox のメソッド): mbox オブジェクト. (line   51)
* get_subdir() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   51)
* get_symbols() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line  115)
* get_tabsize() (curses モジュール):     関数<6>.            (line  466)
* get_task_factory() (asyncio.loop のメソッド): Creating futures and tasks.
                                                             (line   83)
* get_terminal_size() (os モジュール):   ターミナルのサイズの問い合わせ.
                                                             (line    8)
* get_terminal_size() (shutil モジュール): 出力ターミナルのサイズの取得.
                                                             (line    6)
* get_threshold() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  136)
* 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  210)
* get_unverified_chain() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  229)
* 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  220)
* get_version() (optparse.OptionParser のメソッド): バージョン番号の出力.
                                                             (line   33)
* get_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   64)
* get_wch() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  236)
* get_write_buffer_limits() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   25)
* get_write_buffer_size() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   20)
* GET_YIELD_FROM_ITER (opcode):          Python バイトコード命令.
                                                             (line  231)
* get() (asyncio.Queue のメソッド):      Queue.              (line   39)
* get() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  221)
* get() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  118)
* get() (contextvars.ContextVar のメソッド): コンテキスト変数.
                                                             (line   30)
* get() (dict のメソッド):               Mapping types --- dict frozendict.
                                                             (line  178)
* 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  155)
* 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.ttk.Combobox のメソッド): ttk Combobox.     (line   15)
* get() (tkinter.ttk.Spinbox のメソッド): ttk Spinbox.       (line    8)
* get() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  288)
* get() (webbrowser モジュール):         コマンドライン・インターフェース<6>.
                                                             (line   69)
* get() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   66)
* getacl() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  112)
* getaddresses() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line   85)
* getaddrinfo() (asyncio.loop のメソッド): DNS.              (line    6)
* getaddrinfo() (socket モジュール):     その他の関数<2>.    (line   16)
* getallocatedblocks() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  783)
* getandroidapilevel() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  803)
* getannotation() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  117)
* getargvalues() (inspect モジュール):   クラスと関数<2>.    (line   69)
* 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  190)
* getattr_static() (inspect モジュール): 属性の静的なフェッチ.
                                                             (line   16)
* getattrfunc (C type):                  Slot Type typedefs. (line   48)
* getAttribute() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   32)
* getAttributeNode() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   38)
* getAttributeNodeNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   48)
* getAttributeNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   42)
* getattrofunc (C type):                 Slot Type typedefs. (line   59)
* GetBase() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   30)
* getbegyx() (curses.window のメソッド): Window オブジェクト.
                                                             (line  220)
* getbkgd() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  224)
* getblocking() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  167)
* getboolean() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  251)
* getbuffer() (io.BytesIO のメソッド):   バッファ付きストリーム.
                                                             (line   25)
* getbufferproc (C type):                Slot Type typedefs. (line  109)
* getByteStream() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   48)
* getcallargs() (inspect モジュール):    クラスと関数<2>.    (line   98)
* getcanvas() (turtle モジュール):       設定と特殊なメソッド.
                                                             (line   54)
* getch() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  228)
* getch() (msvcrt モジュール):           コンソール I/O 関連.
                                                             (line   11)
* getCharacterStream() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   63)
* getche() (msvcrt モジュール):          コンソール I/O 関連.
                                                             (line   25)
* getChild() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  158)
* getChildren() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  169)
* getclasstree() (inspect モジュール):   クラスと関数<2>.    (line    6)
* getclosurevars() (inspect モジュール): クラスと関数<2>.    (line  127)
* 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   36)
* getcompname() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   49)
* getcompname() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   87)
* getcomptype() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   44)
* getcomptype() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   83)
* getconfig() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  655)
* 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  207)
* getcwd() (os モジュール):              ファイルとディレクトリ.
                                                             (line  302)
* getcwdb() (os モジュール):             ファイルとディレクトリ.
                                                             (line  306)
* getdecoder() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  126)
* getdefaultencoding() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  814)
* getdefaultlocale() (locale モジュール): locale --- 国際化サービス.
                                                             (line  352)
* getdefaulttimeout() (socket モジュール): その他の関数<2>.  (line  381)
* getdlopenflags() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  819)
* getdoc() (inspect モジュール):         ソースコードの情報取得.
                                                             (line    6)
* getDOMImplementation() (xml.dom モジュール): モジュールコンテンツ<2>.
                                                             (line   17)
* getDTDHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   31)
* getEffectiveLevel() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  148)
* getegid() (os モジュール):             プロセスのパラメーター.
                                                             (line  199)
* getElementsByTagName() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   60)
* getElementsByTagName() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   14)
* getElementsByTagNameNS() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   65)
* getElementsByTagNameNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   18)
* getencoder() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  118)
* getencoding() (locale モジュール):     locale --- 国際化サービス.
                                                             (line  414)
* getEncoding() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   32)
* getEntityResolver() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   40)
* getenv() (os モジュール):              プロセスのパラメーター.
                                                             (line  158)
* getenvb() (os モジュール):             プロセスのパラメーター.
                                                             (line  174)
* getErrorHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   50)
* geteuid() (os モジュール):             プロセスのパラメーター.
                                                             (line  206)
* getEvent() (xml.dom.pulldom.DOMEventStream のメソッド): DOMEventStream オブジェクト.
                                                             (line   11)
* getEventCategory() (logging.handlers.NTEventLogHandler のメソッド): NTEventLogHandler.
                                                             (line   41)
* getEventType() (logging.handlers.NTEventLogHandler のメソッド): NTEventLogHandler.
                                                             (line   47)
* getException() (xml.sax.SAXException のメソッド): SAXException オブジェクト.
                                                             (line   13)
* getFeature() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   68)
* getfile() (inspect モジュール):        ソースコードの情報取得.
                                                             (line   45)
* getFilesToDelete() (logging.handlers.TimedRotatingFileHandler のメソッド): TimedRotatingFileHandler.
                                                             (line  111)
* getfilesystemencodeerrors() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  859)
* getfilesystemencoding() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  828)
* getfirstweekday() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   46)
* getfloat() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  244)
* getformat() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   36)
* getformat() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line  101)
* getfqdn() (socket モジュール):         その他の関数<2>.    (line  106)
* getframeinfo() (inspect モジュール):   インタープリタスタック.
                                                             (line  117)
* getframerate() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   28)
* getframerate() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   64)
* getfullargspec() (inspect モジュール): クラスと関数<2>.    (line   15)
* getgeneratorlocals() (inspect モジュール): Current State of Generators Coroutines and Asynchronous Generators.
                                                             (line   72)
* getgeneratorstate() (inspect モジュール): Current State of Generators Coroutines and Asynchronous Generators.
                                                             (line   12)
* getgid() (os モジュール):              プロセスのパラメーター.
                                                             (line  212)
* getgrall() (grp モジュール):           grp --- グループデータベース.
                                                             (line   60)
* getgrgid() (grp モジュール):           grp --- グループデータベース.
                                                             (line   45)
* getgrnam() (grp モジュール):           grp --- グループデータベース.
                                                             (line   54)
* getgrouplist() (os モジュール):        プロセスのパラメーター.
                                                             (line  221)
* getgroups() (os モジュール):           プロセスのパラメーター.
                                                             (line  232)
* getHandlerByName() (logging モジュール): モジュールレベルの関数.
                                                             (line  174)
* getHandlerNames() (logging モジュール): モジュールレベルの関数.
                                                             (line  181)
* getheader() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   25)
* getheaders() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   33)
* gethostbyaddr() (socket モジュール):   プロセスのパラメーター.
                                                             (line  573)
* gethostbyaddr() (socket モジュール) <1>: その他の関数<2>.  (line  164)
* gethostbyname_ex() (socket モジュール): その他の関数<2>.   (line  133)
* gethostbyname() (socket モジュール):   その他の関数<2>.    (line  118)
* gethostname() (socket モジュール):     プロセスのパラメーター.
                                                             (line  573)
* gethostname() (socket モジュール) <1>: その他の関数<2>.    (line  150)
* getincrementaldecoder() (codecs モジュール): codecs --- codec レジストリと基底クラス.
                                                             (line  142)
* getincrementalencoder() (codecs モジュール): codecs --- codec レジストリと基底クラス.
                                                             (line  134)
* 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)
* getitem() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  204)
* getiterfunc (C type):                  Slot Type typedefs. (line   95)
* getitimer() (signal モジュール):       モジュールの内容<4>.
                                                             (line  468)
* getkey() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  244)
* GetLastError() (ctypes モジュール):    ユーティリティー関数.
                                                             (line  153)
* getLength() (xml.sax.xmlreader.Attributes のメソッド): Attributes インターフェース.
                                                             (line   11)
* getLevelName() (logging モジュール):   モジュールレベルの関数.
                                                             (line  144)
* getLevelNamesMapping() (logging モジュール): モジュールレベルの関数.
                                                             (line  135)
* getlimit() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  596)
* getline() (linecache モジュール):      linecache --- テキストラインへのランダムアクセス.
                                                             (line   23)
* getLineNumber() (xml.sax.xmlreader.Locator のメソッド): Locator オブジェクト.
                                                             (line   12)
* getloadavg() (os モジュール):          雑多なシステム情報. (line   49)
* getlocale() (locale モジュール):       locale --- 国際化サービス.
                                                             (line  375)
* getLogger() (logging モジュール):      モジュールレベルの関数.
                                                             (line    8)
* getLoggerClass() (logging モジュール): モジュールレベルの関数.
                                                             (line   21)
* getlogin() (os モジュール):            プロセスのパラメーター.
                                                             (line  254)
* getLogRecordFactory() (logging モジュール): モジュールレベルの関数.
                                                             (line   32)
* getMandatoryRelease() (__future__._Feature のメソッド): モジュールコンテンツ<3>.
                                                             (line   77)
* getmaxyx() (curses.window のメソッド): Window オブジェクト.
                                                             (line  251)
* getmember() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  106)
* getmembers_static() (inspect モジュール): 型とメンバー.    (line  392)
* getmembers() (inspect モジュール):     型とメンバー.       (line  379)
* 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   51)
* getmodulename() (inspect モジュール):  型とメンバー.       (line  410)
* getmouse() (curses モジュール):        関数<6>.            (line  159)
* getmro() (inspect モジュール):         クラスと関数<2>.    (line   90)
* getmtime() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  197)
* getName() (threading.Thread のメソッド): Thread objects.   (line  201)
* getNameByQName() (xml.sax.xmlreader.AttributesNS のメソッド): AttributesNS インターフェース.
                                                             (line   17)
* getnameinfo() (asyncio.loop のメソッド): DNS.              (line   11)
* getnameinfo() (socket モジュール):     その他の関数<2>.    (line  180)
* 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   74)
* getnode() (uuid モジュール):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  173)
* getobjects() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line  998)
* 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   54)
* getparams() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line  117)
* getparyx() (curses.window のメソッド): Window オブジェクト.
                                                             (line  255)
* getpass() (getpass モジュール):        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   17)
* GetPassWarning:                        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   69)
* getpeercert() (ssl.SSLSocket のメソッド): SSL sockets.     (line  155)
* getpeername() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  137)
* getpen() (turtle モジュール):          特別な Turtle のメソッド.
                                                             (line   51)
* getpgid() (os モジュール):             プロセスのパラメーター.
                                                             (line  264)
* getpgrp() (os モジュール):             プロセスのパラメーター.
                                                             (line  271)
* getpid() (os モジュール):              プロセスのパラメーター.
                                                             (line  277)
* getpos() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   29)
* getppid() (os モジュール):             プロセスのパラメーター.
                                                             (line  284)
* getpreferredencoding() (locale モジュール): locale --- 国際化サービス.
                                                             (line  390)
* getpriority() (os モジュール):         プロセスのパラメーター.
                                                             (line  295)
* getprofile() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line 1023)
* getprofile() (threading モジュール):   リファレンス<2>.    (line  151)
* getProperty() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   81)
* getprotobyname() (socket モジュール):  その他の関数<2>.    (line  200)
* 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  122)
* getquotaroot() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  127)
* getrandbits() (random モジュール):     整数用の関数.       (line   36)
* getrandbits() (random.Random のメソッド): 他の生成器.      (line   42)
* getrandom() (os モジュール):           乱数<2>.            (line    6)
* getreader() (codecs モジュール):       codecs --- codec レジストリと基底クラス.
                                                             (line  150)
* getrecursionlimit() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  932)
* getrefcount() (sys モジュール):        sys --- システム固有のパラメーターと関数.
                                                             (line  914)
* GetReparseDeferralEnabled() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  108)
* getresgid() (os モジュール):           プロセスのパラメーター.
                                                             (line  342)
* getresponse() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line   81)
* getresuid() (os モジュール):           プロセスのパラメーター.
                                                             (line  333)
* getrlimit() (resource モジュール):     リソースの制限.     (line   39)
* 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   53)
* getscreen() (turtle モジュール):       特別な Turtle のメソッド.
                                                             (line   62)
* getservbyname() (socket モジュール):   その他の関数<2>.    (line  211)
* getservbyport() (socket モジュール):   その他の関数<2>.    (line  223)
* GetSetDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  228)
* getshapes() (turtle モジュール):       設定と特殊なメソッド.
                                                             (line   63)
* getsid() (os モジュール):              プロセスのパラメーター.
                                                             (line  531)
* getsignal() (signal モジュール):       モジュールの内容<4>.
                                                             (line  311)
* getsitepackages() (site モジュール):   モジュールの内容<7>.
                                                             (line   74)
* getsize() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  218)
* getsizeof() (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  940)
* getsockname() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  145)
* getsockopt() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  152)
* getsource() (inspect モジュール):      ソースコードの情報取得.
                                                             (line   77)
* getsourcefile() (inspect モジュール):  ソースコードの情報取得.
                                                             (line   56)
* getsourcelines() (inspect モジュール): ソースコードの情報取得.
                                                             (line   63)
* getstate() (codecs.IncrementalDecoder のメソッド): IncrementalDecoder オブジェクト.
                                                             (line   44)
* getstate() (codecs.IncrementalEncoder のメソッド): IncrementalEncoder オブジェクト.
                                                             (line   42)
* getstate() (random モジュール):        保守 bookkeeping 関数.
                                                             (line   32)
* getstate() (random.Random のメソッド): 他の生成器.         (line   24)
* getstatusoutput() (subprocess モジュール): レガシーなシェル呼び出し関数.
                                                             (line   11)
* getstr() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  260)
* getSubject() (logging.handlers.SMTPHandler のメソッド): SMTPHandler.
                                                             (line   37)
* getswitchinterval() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  961)
* getSystemId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   18)
* getSystemId() (xml.sax.xmlreader.Locator のメソッド): Locator オブジェクト.
                                                             (line   20)
* getsyx() (curses モジュール):          関数<6>.            (line  178)
* gettarinfo() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  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  176)
* gettrace() (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1028)
* gettrace() (threading モジュール):     リファレンス<2>.    (line  129)
* getturtle() (turtle モジュール):       特別な Turtle のメソッド.
                                                             (line   51)
* getType() (xml.sax.xmlreader.Attributes のメソッド): Attributes インターフェース.
                                                             (line   19)
* getuid() (os モジュール):              プロセスのパラメーター.
                                                             (line  351)
* getunicodeinternedsize() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  797)
* 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   74)
* getuserbase() (site モジュール):       モジュールの内容<7>.
                                                             (line   80)
* getusersitepackages() (site モジュール): モジュールの内容<7>.
                                                             (line   88)
* getvalue() (io.BytesIO のメソッド):    バッファ付きストリーム.
                                                             (line   42)
* getvalue() (io.StringIO のメソッド):   テキスト I/O<2>.    (line  264)
* getValue() (xml.sax.xmlreader.Attributes のメソッド): Attributes インターフェース.
                                                             (line   23)
* getValueByQName() (xml.sax.xmlreader.AttributesNS のメソッド): AttributesNS インターフェース.
                                                             (line   13)
* getwch() (msvcrt モジュール):          コンソール I/O 関連.
                                                             (line   21)
* getwche() (msvcrt モジュール):         コンソール I/O 関連.
                                                             (line   30)
* getweakrefcount() (weakref モジュール): weakref --- Weak references.
                                                             (line  149)
* getweakrefs() (weakref モジュール):    weakref --- Weak references.
                                                             (line  153)
* getwelcome() (ftplib.FTP のメソッド):  FTP オブジェクト.   (line  121)
* getwelcome() (poplib.POP3 のメソッド): POP3 オブジェクト.  (line   19)
* getwin() (curses モジュール):          関数<6>.            (line  184)
* getwindowsversion() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1037)
* getwriter() (codecs モジュール):       codecs --- codec レジストリと基底クラス.
                                                             (line  158)
* getxattr() (os モジュール):            Linux 拡張属性.     (line   10)
* getyx() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  274)
* gid (tarfile.TarInfo の属性):          TarInfo オブジェクト.
                                                             (line  115)
* GIL:                                   用語集<2>.          (line  765)
* gil (sys.flags の属性):                sys --- システム固有のパラメーターと関数.
                                                             (line  623)
* 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  769)
* global state:                          用語集<2>.          (line  796)
* global_enum() (enum モジュール):       Utilities and decorators.
                                                             (line   93)
* globs (doctest.DocTest の属性):        DocTest オブジェクト.
                                                             (line   22)
* gmtime() (time モジュール):            関数<5>.            (line  145)
* gname (tarfile.TarInfo の属性):        TarInfo オブジェクト.
                                                             (line  131)
* GNOME:                                 Catalog コンストラクタ.
                                                             (line    6)
* GNU_FORMAT (tarfile モジュール):       tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  392)
* gnu_getopt() (getopt モジュール):      getopt --- C-style parser for command line options.
                                                             (line   73)
* GNUTranslations (gettext のクラス):    GNUTranslations クラス.
                                                             (line   33)
* GNUTYPE_LONGLINK (tarfile モジュール): tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  376)
* GNUTYPE_LONGNAME (tarfile モジュール): tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  372)
* GNUTYPE_SPARSE (tarfile モジュール):   tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  380)
* go() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  113)
* got (doctest.DocTestFailure の属性):   デバッグ.           (line  197)
* goto() (turtle モジュール):            Turtle の動き.      (line   74)
* grantpt() (os モジュール):             ファイル記述子の操作.
                                                             (line  246)
* grapheme_cluster_break() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  168)
* GREATER (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line  245)
* GREATEREQUAL (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line  272)
* greedy (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  312)
* GRND_NONBLOCK (os モジュール):         乱数<2>.            (line   77)
* GRND_RANDOM (os モジュール):           乱数<2>.            (line   90)
* Group (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  452)
* group() (pathlib.Path のメソッド):     パーミッションと所有者.
                                                             (line   23)
* group() (re.Match のメソッド):         Match objects.      (line   34)
* group() (ssl.SSLSocket のメソッド):    SSL sockets.        (line  253)
* groupby() (itertools モジュール):      Itertool関数.       (line  304)
* groupdict() (re.Match のメソッド):     Match objects.      (line  132)
* groupindex (re.Pattern の属性):        Regular expression objects.
                                                             (line  135)
* groups (email.headerregistry.AddressHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  184)
* groups (re.Pattern の属性):            Regular expression objects.
                                                             (line  131)
* groups() (re.Match のメソッド):        Match objects.      (line  110)
* 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   67)
* guess_all_extensions() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   69)
* guess_extension() (mimetypes モジュール): mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   79)
* guess_extension() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   52)
* guess_file_type() (mimetypes モジュール): mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   58)
* 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   81)
* halfdelay() (curses モジュール):       関数<6>.            (line  224)
* 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 のクラス):            モジュールの内容<4>.
                                                             (line   24)
* hardlink_to() (pathlib.Path のメソッド): ファイルとディレクトリの作成.
                                                             (line   81)
* harmonic_mean() (statistics モジュール): 関数の詳細.       (line   93)
* HAS_ALPN (ssl モジュール):             定数<9>.            (line  384)
* has_children() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   99)
* has_colors() (curses モジュール):      関数<6>.            (line  191)
* has_default() (typing.ParamSpec のメソッド): Building generic types and type aliases.
                                                             (line  544)
* has_default() (typing.TypeVar のメソッド): Building generic types and type aliases.
                                                             (line  237)
* has_default() (typing.TypeVarTuple のメソッド): Building generic types and type aliases.
                                                             (line  404)
* has_dualstack_ipv6() (socket モジュール): ソケットの作成.  (line  149)
* HAS_ECDH (ssl モジュール):             定数<9>.            (line  400)
* has_extended_color_support() (curses モジュール): 関数<6>. (line  196)
* has_extn() (smtplib.SMTP のメソッド):  SMTP オブジェクト.  (line   85)
* has_header() (csv.Sniffer のメソッド): モジュールコンテンツ.
                                                             (line  238)
* has_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line   96)
* has_ic() (curses モジュール):          関数<6>.            (line  207)
* has_il() (curses モジュール):          関数<6>.            (line  213)
* has_ipv6 (socket モジュール):          定数<8>.            (line  305)
* has_key() (curses モジュール):         関数<6>.            (line  219)
* has_location (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  451)
* 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  480)
* HAS_PSK (ssl モジュール):              定数<9>.            (line  467)
* HAS_PSK_TLS13 (ssl モジュール):        定数<9>.            (line  473)
* 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 1145)
* hash_info (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1114)
* hash_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   63)
* hash_randomization (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  603)
* hash-based pyc:                        用語集<2>.          (line  804)
* hash.block_size (hashlib モジュール):  Hash Objects.       (line   13)
* hash.digest_size (hashlib モジュール): Hash Objects.       (line    9)
* hashable:                              辞書表示.           (line   48)
* hashable <1>:                          用語集<2>.          (line  811)
* 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   44)
* HAVE_DOCSTRINGS (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  183)
* HAVE_THREADS (decimal モジュール):     定数<4>.            (line   37)
* HCI_CHANNEL_CONTROL (socket モジュール): 定数<8>.          (line  396)
* HCI_CHANNEL_LOGGING (socket モジュール): 定数<8>.          (line  396)
* HCI_CHANNEL_MONITOR (socket モジュール): 定数<8>.          (line  396)
* HCI_CHANNEL_RAW (socket モジュール):   定数<8>.            (line  396)
* HCI_CHANNEL_USER (socket モジュール):  定数<8>.            (line  396)
* HCI_DATA_DIR (socket モジュール):      定数<8>.            (line  374)
* HCI_DEV_NONE (socket モジュール):      定数<8>.            (line  387)
* HCI_FILTER (socket モジュール):        定数<8>.            (line  374)
* HCI_TIME_STAMP (socket モジュール):    定数<8>.            (line  374)
* 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  422)
* header_fetch_parse() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  607)
* header_fetch_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  472)
* 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  449)
* 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  595)
* header_source_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  455)
* header_source_parse() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  278)
* header_store_parse() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  603)
* header_store_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  463)
* 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  286)
* 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  295)
* 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  100)
* heading() (turtle モジュール):         Turtle の状態を知る.
                                                             (line   56)
* heapify_max() (heapq モジュール):      heapq --- ヒープキューアルゴリズム.
                                                             (line   95)
* heapify() (heapq モジュール):          heapq --- ヒープキューアルゴリズム.
                                                             (line   55)
* heapmin() (msvcrt モジュール):         その多の関数.       (line    6)
* heappop_max() (heapq モジュール):      heapq --- ヒープキューアルゴリズム.
                                                             (line  108)
* heappop() (heapq モジュール):          heapq --- ヒープキューアルゴリズム.
                                                             (line   64)
* heappush_max() (heapq モジュール):     heapq --- ヒープキューアルゴリズム.
                                                             (line  101)
* heappush() (heapq モジュール):         heapq --- ヒープキューアルゴリズム.
                                                             (line   59)
* heappushpop_max() (heapq モジュール):  heapq --- ヒープキューアルゴリズム.
                                                             (line  117)
* heappushpop() (heapq モジュール):      heapq --- ヒープキューアルゴリズム.
                                                             (line   71)
* heapreplace_max() (heapq モジュール):  heapq --- ヒープキューアルゴリズム.
                                                             (line  126)
* heapreplace() (heapq モジュール):      heapq --- ヒープキューアルゴリズム.
                                                             (line   77)
* helo_resp (smtplib.SMTP の属性):       SMTP オブジェクト.  (line  347)
* helo() (smtplib.SMTP のメソッド):      SMTP オブジェクト.  (line   50)
* help (optparse.Option の属性):         オプション属性.     (line   80)
* help (pdb command):                    Debugger commands.  (line   74)
* help;online:                           pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line    8)
* herror:                                例外<19>.           (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  188)
* 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  329)
* hexversion (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1163)
* hidden() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   25)
* hide_cookie2 (http.cookiejar.CookiePolicy の属性): CookiePolicy オブジェクト.
                                                             (line   78)
* hide() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   30)
* hide() (tkinter.ttk.Notebook のメソッド): ttk Notebook.    (line   23)
* hideturtle() (turtle モジュール):      可視性.             (line    6)
* HierarchyRequestErr:                   例外<24>.           (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 オブジェクト.
                                                             (line  279)
* hls_to_rgb() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   40)
* HMAC (hmac のクラス):                  hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   47)
* HOME:                                  os path<6>.         (line   15)
* HOME <1>:                              Python API の変更<6>.
                                                             (line  118)
* HOME <2>:                              Windows<48>.        (line   15)
* HOME <3>:                              Windows<48>.        (line   18)
* HOME <4>:                              os path --- 一般的なパス名操作.
                                                             (line  157)
* HOME <5>:                              os path --- 一般的なパス名操作.
                                                             (line  175)
* HOME <6>:                              Tkinter モジュール. (line   64)
* home() (pathlib.Path のクラスメソッド): パスの展開と解決.  (line    6)
* home() (turtle モジュール):            Turtle の動き.      (line  193)
* HOMEDRIVE:                             os path --- 一般的なパス名操作.
                                                             (line  164)
* HOMEPATH:                              os path --- 一般的なパス名操作.
                                                             (line  164)
* hook_compressed() (fileinput モジュール): fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  193)
* hook_encoded() (fileinput モジュール): fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  213)
* hooks;import:                          インポートフック.   (line    6)
* hooks;meta:                            インポートフック.   (line    6)
* hooks;パス:                            インポートフック.   (line    6)
* host (urllib.request.Request の属性):  Request オブジェクト.
                                                             (line   25)
* hostmask (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   95)
* hostmask (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  315)
* hostname_checks_common_name (ssl.SSLContext の属性): SSL contexts.
                                                             (line  686)
* hosts (netrc.netrc の属性):            netrc オブジェクト. (line   25)
* hosts() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  136)
* hosts() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  333)
* hour (datetime.datetime の属性):       datetime objects.   (line  322)
* hour (datetime.time の属性):           time objects.       (line   50)
* HRESULT (ctypes のクラス):             基本データ型<2>.    (line  262)
* hresult (ctypes.COMError の属性):      例外<11>.           (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  219)
* HtmlDiff (difflib のクラス):           difflib --- 差分の計算の補助.
                                                             (line   80)
* HTMLParser (html.parser のクラス):     html parser --- HTML と XHTML のシンプルなパーサー.
                                                             (line   14)
* htonl() (socket モジュール):           その他の関数<2>.    (line  252)
* htons() (socket モジュール):           その他の関数<2>.    (line  259)
* HTTP (email.policy モジュール):        email policy Policy Objects.
                                                             (line  539)
* 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  215)
* 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 コマンドラインオプション; -content-type: コマンドライン・インターフェース<7>.
                                                             (line   54)
* http.server コマンドラインオプション; -d: コマンドライン・インターフェース<7>.
                                                             (line   34)
* http.server コマンドラインオプション; -directory: コマンドライン・インターフェース<7>.
                                                             (line   34)
* http.server コマンドラインオプション; -H: コマンドライン・インターフェース<7>.
                                                             (line   93)
* http.server コマンドラインオプション; -header: コマンドライン・インターフェース<7>.
                                                             (line   93)
* http.server コマンドラインオプション; -p: コマンドライン・インターフェース<7>.
                                                             (line   44)
* http.server コマンドラインオプション; -protocol: コマンドライン・インターフェース<7>.
                                                             (line   44)
* http.server コマンドラインオプション; -tls-cert: コマンドライン・インターフェース<7>.
                                                             (line   64)
* http.server コマンドラインオプション; -tls-key: コマンドライン・インターフェース<7>.
                                                             (line   72)
* http.server コマンドラインオプション; -tls-password-file: コマンドライン・インターフェース<7>.
                                                             (line   80)
* 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  145)
* 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  112)
* https_open() (urllib.request.HTTPSHandler のメソッド): HTTPSHandler オブジェクト.
                                                             (line    6)
* HTTPS_PORT (http.client モジュール):   http client --- HTTP プロトコルクライアント.
                                                             (line  219)
* https_response() (urllib.request.HTTPErrorProcessor のメソッド): HTTPErrorProcessor オブジェクト.
                                                             (line   18)
* HTTPSConnection (http.client のクラス): http client --- HTTP プロトコルクライアント.
                                                             (line   70)
* 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  448)
* HV_GUID_CHILDREN (socket モジュール):  定数<8>.            (line  448)
* HV_GUID_LOOPBACK (socket モジュール):  定数<8>.            (line  448)
* HV_GUID_PARENT (socket モジュール):    定数<8>.            (line  448)
* HV_GUID_WILDCARD (socket モジュール):  定数<8>.            (line  448)
* HV_GUID_ZERO (socket モジュール):      定数<8>.            (line  448)
* HV_PROTOCOL_RAW (socket モジュール):   定数<8>.            (line  448)
* HVSOCKET_ADDRESS_FLAG_PASSTHRU (socket モジュール): 定数<8>.
                                                             (line  448)
* HVSOCKET_CONNECT_TIMEOUT (socket モジュール): 定数<8>.     (line  448)
* HVSOCKET_CONNECT_TIMEOUT_MAX (socket モジュール): 定数<8>. (line  448)
* HVSOCKET_CONNECTED_SUSPEND (socket モジュール): 定数<8>.   (line  448)
* hypot() (math モジュール):             Summation and product functions.
                                                             (line   33)
* I (re モジュール):                     フラグ.             (line   37)
* I/O control;buffering:                 組み込み関数.       (line 1447)
* I/O control;buffering <1>:             socket オブジェクト.
                                                             (line  216)
* iadd() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   34)
* iand() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   39)
* iconcat() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   44)
* id (concurrent.interpreters.Interpreter の属性): Interpreter objects.
                                                             (line   13)
* id (concurrent.interpreters.Queue の属性): Communicating Between Interpreters.
                                                             (line   16)
* id (ssl.SSLSession の属性):            SSL セッション.     (line   12)
* id() (unittest.TestCase のメソッド):   テストクラス.       (line  842)
* idcok() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  286)
* ident (select.kevent の属性):          Kevent objects.     (line    8)
* ident (threading.Thread の属性):       Thread objects.     (line  209)
* identchars (cmd.Cmd の属性):           Cmdオブジェクト.    (line  131)
* identify_column() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  146)
* identify_element() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  175)
* identify_region() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  153)
* identify_row() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  142)
* identify() (tkinter.ttk.Notebook のメソッド): ttk Notebook.
                                                             (line   31)
* identify() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  132)
* identify() (tkinter.ttk.Widget のメソッド): ttk Widget.    (line   12)
* IDLE:                                  IDLE --- Python のエディタとシェル<2>.
                                                             (line    8)
* IDLE <1>:                              用語集<2>.          (line  830)
* 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  133)
* 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 オブジェクト.
                                                             (line  293)
* IEEE_CONTEXT_MAX_BITS (decimal モジュール): 定数<4>.       (line   34)
* IEEEContext() (decimal モジュール):    Context オブジェクト.
                                                             (line   59)
* If (ast のクラス):                     制御フロー.         (line    9)
* if_indextoname() (socket モジュール):  その他の関数<2>.    (line  454)
* if_nameindex() (socket モジュール):    その他の関数<2>.    (line  410)
* if_nametoindex() (socket モジュール):  その他の関数<2>.    (line  436)
* if;conditional expression:             条件式 Conditional Expressions.
                                                             (line    6)
* if;in comprehensions:                  リスト、集合、辞書の表示.
                                                             (line   14)
* IfExp (ast のクラス):                  式 expression<2>.   (line  158)
* 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  151)
* ignore_environment (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  591)
* 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  545)
* IllegalWeekdayError:                   calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  559)
* ilshift() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   55)
* imag (numbers.Complex の属性):         数値塔.             (line   19)
* imag (sys.hash_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line 1136)
* imap_unordered() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  150)
* imap() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  135)
* IMAP4 (imaplib のクラス):              imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   25)
* IMAP4_SSL (imaplib のクラス):          imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   76)
* IMAP4_SSL;プロトコル:                  imaplib --- IMAP4 プロトコルクライアント.
                                                             (line    8)
* IMAP4_stream (imaplib のクラス):       imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  109)
* IMAP4_stream;プロトコル:               imaplib --- IMAP4 プロトコルクライアント.
                                                             (line    8)
* IMAP4;プロトコル:                      imaplib --- IMAP4 プロトコルクライアント.
                                                             (line    8)
* IMAP4.abort:                           imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   58)
* IMAP4.error:                           imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   53)
* IMAP4.readonly:                        imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   65)
* imatmul() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   70)
* immedok() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  299)
* immutable:                             用語集<2>.          (line  850)
* immutable;object:                      リテラル<2>.        (line   31)
* immutable;object <1>:                  辞書表示.           (line   48)
* 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 1185)
* Import (ast のクラス):                 インポート.         (line    6)
* import hooks:                          インポートフック.   (line    6)
* import machinery:                      インポートシステム. (line    6)
* import path:                           用語集<2>.          (line  861)
* 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)
* ImportCycleError:                      具象例外.           (line   79)
* importer:                              用語集<2>.          (line  873)
* ImportError:                           具象例外.           (line   51)
* ImportFrom (ast のクラス):             インポート.         (line   21)
* importing:                             用語集<2>.          (line  868)
* ImportWarning:                         警告.               (line   59)
* ImproperConnectionState:               http client --- HTTP プロトコルクライアント.
                                                             (line  176)
* 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  774)
* inch() (curses.window のメソッド):     Window オブジェクト.
                                                             (line  307)
* include() (xml.etree.ElementInclude モジュール): 関数<10>. (line   17)
* inclusive (tracemalloc.DomainFilter の属性): DomainFilter. (line   12)
* inclusive (tracemalloc.Filter の属性): Filter.             (line   39)
* Incomplete:                            binascii --- バイナリ と ASCII 間の変換.
                                                             (line  380)
* IncompleteRead:                        http client --- HTTP プロトコルクライアント.
                                                             (line  172)
* IncompleteReadError:                   例外<17>.           (line   45)
* incr_item():                           例外<25>.           (line   78)
* incr_item() <1>:                       例外<25>.           (line  123)
* increment_lineno() (ast モジュール):   ast helpers.        (line  159)
* IncrementalDecoder (codecs のクラス):  IncrementalDecoder オブジェクト.
                                                             (line   11)
* incrementaldecoder (codecs.CodecInfo の属性): codecs --- codec レジストリと基底クラス.
                                                             (line   96)
* IncrementalEncoder (codecs のクラス):  IncrementalEncoder オブジェクト.
                                                             (line   11)
* incrementalencoder (codecs.CodecInfo の属性): codecs --- codec レジストリと基底クラス.
                                                             (line   96)
* 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  362)
* index:                                 用語集<2>.          (line  878)
* index (inspect.FrameInfo の属性):      インタープリタスタック.
                                                             (line   36)
* index (inspect.Traceback の属性):      インタープリタスタック.
                                                             (line   76)
* index() (array.array のメソッド):      array --- 効率的な数値配列.
                                                             (line  237)
* index() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  156)
* index() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  156)
* index() (collections.abc.ByteString のメソッド): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   84)
* index() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   70)
* index() (memoryview のメソッド):       メモリビュー.       (line  378)
* 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.ttk.Notebook のメソッド): ttk Notebook.   (line   36)
* index() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  181)
* IndexError:                            具象例外.           (line   87)
* indexOf() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  209)
* IndexSizeErr:                          例外<24>.           (line   32)
* indic_conjunct_break() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  175)
* indices() (slice のメソッド):          スライス slice オブジェクト.
                                                             (line   20)
* INDIRECT (inspect.BufferFlags の属性): Buffer flags.       (line   31)
* inet_aton() (socket モジュール):       その他の関数<2>.    (line  269)
* inet_ntoa() (socket モジュール):       その他の関数<2>.    (line  287)
* inet_ntop() (socket モジュール):       その他の関数<2>.    (line  320)
* inet_pton() (socket モジュール):       その他の関数<2>.    (line  304)
* Inexact (decimal のクラス):            シグナル.           (line   43)
* inf (cmath モジュール):                定数<3>.            (line   20)
* inf (math モジュール):                 定数<2>.            (line   24)
* inf (sys.hash_info の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line 1128)
* infile (shlex.shlex の属性):           shlex オブジェクト. (line  139)
* Infinity:                              組み込み関数.       (line  728)
* infj (cmath モジュール):               定数<3>.            (line   26)
* INFO (logging モジュール):             ロギングレベル.     (line   29)
* info (pathlib.Path の属性):            ファイルの種類とステータスを問い合わせる.
                                                             (line  173)
* INFO (tkinter.messagebox モジュール):  tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  194)
* info() (dis.Bytecode のメソッド):      バイトコード解析.   (line   67)
* info() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   68)
* info() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   85)
* info() (logging モジュール):           モジュールレベルの関数.
                                                             (line   61)
* info() (logging.Logger のメソッド):    ロガーオブジェクト. (line  278)
* info() (urllib.response.addinfourl のメソッド): urllib response --- Response classes used by urllib.
                                                             (line   35)
* infolist() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  127)
* inheritance:                           クラス定義.         (line    6)
* ini ファイル:                          configparser --- 設定ファイルのパーサー.
                                                             (line    8)
* init_color() (curses モジュール):      関数<6>.            (line  232)
* init_pair() (curses モジュール):       関数<6>.            (line  242)
* init() (mimetypes モジュール):         mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   95)
* inited (mimetypes モジュール):         mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  141)
* initgroups() (os モジュール):          プロセスのパラメーター.
                                                             (line  360)
* initial_indent (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  211)
* initproc (C type):                     Slot Type typedefs. (line   38)
* initscr() (curses モジュール):         関数<6>.            (line  256)
* InitVar (dataclasses のクラス):        モジュールの内容<6>.
                                                             (line  327)
* inode() (os.DirEntry のメソッド):      ファイルとディレクトリ.
                                                             (line 1005)
* 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  236)
* insch() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  312)
* insdelln() (curses.window のメソッド): Window オブジェクト.
                                                             (line  319)
* insert_text() (readline モジュール):   行バッファ.         (line   13)
* insert() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  248)
* insert() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   78)
* insert() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line   98)
* insert() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   41)
* insert() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line  185)
* insert() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  130)
* insertBefore() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  120)
* insertln() (curses.window のメソッド): Window オブジェクト.
                                                             (line  327)
* insnstr() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  332)
* insort_left() (bisect モジュール):     bisect --- 配列二分法アルゴリズム.
                                                             (line   69)
* insort_right() (bisect モジュール):    bisect --- 配列二分法アルゴリズム.
                                                             (line   87)
* insort() (bisect モジュール):          bisect --- 配列二分法アルゴリズム.
                                                             (line   87)
* inspect (sys.flags の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line  570)
* inspect コマンドラインオプション; -details: コマンドライン・インターフェース<11>.
                                                             (line   13)
* InspectLoader (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line  206)
* insstr() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  342)
* install_opener() (urllib.request モジュール): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  111)
* install_scripts() (venv.EnvBuilder のメソッド): API<2>.    (line  182)
* 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 オブジェクト.
                                                             (line  351)
* instream (shlex.shlex の属性):         shlex オブジェクト. (line  145)
* Instruction (dis のクラス):            Python バイトコード命令.
                                                             (line   10)
* INSTRUCTION (monitoring event):        Events.             (line   39)
* Instruction.arg (dis モジュール):      Python バイトコード命令.
                                                             (line   33)
* Instruction.argrepr (dis モジュール):  Python バイトコード命令.
                                                             (line   45)
* Instruction.argval (dis モジュール):   Python バイトコード命令.
                                                             (line   41)
* Instruction.baseopcode (dis モジュール): Python バイトコード命令.
                                                             (line   23)
* Instruction.baseopname (dis モジュール): Python バイトコード命令.
                                                             (line   28)
* Instruction.cache_info (dis モジュール): Python バイトコード命令.
                                                             (line   92)
* Instruction.cache_offset (dis モジュール): Python バイトコード命令.
                                                             (line   60)
* Instruction.end_offset (dis モジュール): Python バイトコード命令.
                                                             (line   64)
* Instruction.is_jump_target (dis モジュール): Python バイトコード命令.
                                                             (line   77)
* Instruction.jump_target (dis モジュール): Python バイトコード命令.
                                                             (line   82)
* Instruction.line_number (dis モジュール): Python バイトコード命令.
                                                             (line   72)
* Instruction.offset (dis モジュール):   Python バイトコード命令.
                                                             (line   50)
* Instruction.oparg (dis モジュール):    Python バイトコード命令.
                                                             (line   37)
* Instruction.opcode (dis モジュール):   Python バイトコード命令.
                                                             (line   14)
* Instruction.opname (dis モジュール):   Python バイトコード命令.
                                                             (line   19)
* Instruction.positions (dis モジュール): Python バイトコード命令.
                                                             (line   87)
* Instruction.start_offset (dis モジュール): Python バイトコード命令.
                                                             (line   54)
* Instruction.starts_line (dis モジュール): Python バイトコード命令.
                                                             (line   68)
* int (uuid.UUID の属性):                uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  143)
* int (組み込みクラス):                  組み込み関数.       (line  954)
* int_info (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1238)
* int_max_str_digits (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  616)
* Int2AP() (imaplib モジュール):         imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  123)
* Integral (numbers のクラス):           数値塔.             (line   59)
* Integrated Development Environment:    IDLE --- Python のエディタとシェル<2>.
                                                             (line    8)
* IntegrityError:                        例外<8>.            (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  891)
* Interactive (ast のクラス):            Root nodes.         (line   37)
* interactive (sys.flags の属性):        sys --- システム固有のパラメーターと関数.
                                                             (line  573)
* InteractiveConsole (code のクラス):    code --- インタープリター基底クラス.
                                                             (line   30)
* InteractiveInterpreter (code のクラス): code --- インタープリター基底クラス.
                                                             (line   15)
* InterfaceError:                        例外<8>.            (line   36)
* intern() (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1283)
* internal_attr (zipfile.ZipInfo の属性): ZipInfo objects.   (line  139)
* Internaldate2tuple() (imaplib モジュール): imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  117)
* InternalError:                         例外<8>.            (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  973)
* Interpolation (ast のクラス):          リテラル<3>.        (line   99)
* Interpolation (string.templatelib のクラス): 型.           (line  192)
* InterpolationDepthError:               例外<10>.           (line   40)
* InterpolationError:                    例外<10>.           (line   36)
* InterpolationMissingOptionError:       例外<10>.           (line   46)
* interpolations (string.templatelib.Template の属性): 型.   (line   74)
* InterpolationSyntaxError:              例外<10>.           (line   51)
* interpreted:                           用語集<2>.          (line  901)
* Interpreter (concurrent.interpreters のクラス): Interpreter objects.
                                                             (line    6)
* interpreter lock:                      Thread states and the global interpreter lock.
                                                             (line    6)
* interpreter prompts:                   sys --- システム固有のパラメーターと関数.
                                                             (line 1666)
* interpreter shutdown:                  用語集<2>.          (line  911)
* interpreter_requires_environment() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line    9)
* InterpreterError:                      例外<14>.           (line    6)
* InterpreterNotFoundError:              例外<14>.           (line   11)
* InterpreterPoolExecutor (concurrent.futures のクラス): InterpreterPoolExecutor.
                                                             (line   54)
* interrupt_main() (_thread モジュール): _thread --- 低水準なスレッド API.
                                                             (line   54)
* interrupt() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  204)
* interrupt() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  345)
* 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)
* intro (cmd.Cmd の属性):                Cmdオブジェクト.    (line  146)
* InuseAttributeErr:                     例外<24>.           (line   37)
* inv_cdf() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line   92)
* inv() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  111)
* InvalidAccessErr:                      例外<24>.           (line   42)
* invalidate_caches() (importlib モジュール): 関数<13>.      (line   42)
* 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  106)
* 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   79)
* 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:                   例外<24>.           (line   47)
* InvalidDateDefect:                     email errors Exception and Defect classes.
                                                             (line  141)
* InvalidFileException:                  plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  170)
* InvalidModificationErr:                例外<24>.           (line   54)
* InvalidOperation (decimal のクラス):   シグナル.           (line   51)
* InvalidStateErr:                       例外<24>.           (line   58)
* InvalidStateError:                     例外クラス.         (line   26)
* InvalidStateError <1>:                 例外<17>.           (line   30)
* InvalidTZPathWarning:                  例外と警告.         (line   12)
* InvalidURL:                            http client --- HTTP プロトコルクライアント.
                                                             (line  154)
* InvalidWriteError:                     例外<10>.           (line   83)
* Invert (ast のクラス):                 式 expression<2>.   (line   28)
* invert() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  111)
* IO (typing のクラス):                  ABCs and Protocols for working with I/O.
                                                             (line    6)
* IO_REPARSE_TAG_APPEXECLINK (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  483)
* IO_REPARSE_TAG_MOUNT_POINT (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  483)
* IO_REPARSE_TAG_SYMLINK (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  483)
* IOBase (io のクラス):                  I/O 基底クラス.     (line    6)
* IOCTL_VM_SOCKETS_GET_LOCAL_CID (socket モジュール): 定数<8>.
                                                             (line  286)
* ioctl() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  112)
* ioctl() (socket.socket のメソッド):    socket オブジェクト.
                                                             (line  184)
* IOError:                               具象例外.           (line  507)
* 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  235)
* is_android (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line   40)
* is_annotated() (symtable.Symbol のメソッド): 記号表の検査. (line  207)
* 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  245)
* 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_cell() (symtable.Symbol のメソッド): 記号表の検査.      (line  218)
* is_char_device() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line  147)
* IS_CHARACTER_JUNK() (difflib モジュール): difflib --- 差分の計算の補助.
                                                             (line  365)
* 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  257)
* is_comp_iter() (symtable.Symbol のメソッド): 記号表の検査. (line  250)
* is_dataclass() (dataclasses モジュール): モジュールの内容<6>.
                                                             (line  484)
* is_declared_global() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  198)
* is_dir() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  106)
* is_dir() (os.DirEntry のメソッド):     ファイルとディレクトリ.
                                                             (line 1016)
* 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   47)
* 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 1047)
* 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  201)
* is_finalizing() (sys モジュール):      sys --- システム固有のパラメーターと関数.
                                                             (line 1308)
* is_finite() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  329)
* is_finite() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  290)
* is_free_class() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  225)
* is_free() (symtable.Symbol のメソッド): 記号表の検査.      (line  213)
* is_global (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line  136)
* is_global (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  279)
* is_global() (symtable.Symbol のメソッド): 記号表の検査.    (line  190)
* is_hop_by_hop() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line  112)
* is_imported() (symtable.Symbol のメソッド): 記号表の検査.  (line  176)
* 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 1083)
* 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  358)
* is_linetouched() (curses.window のメソッド): Window オブジェクト.
                                                             (line  364)
* 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  203)
* 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  264)
* 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  194)
* is_normal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  344)
* is_normal() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  305)
* is_normalized() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  223)
* 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  237)
* is_package() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  411)
* is_package() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  342)
* is_package() (importlib.machinery.SourceFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  251)
* is_package() (importlib.machinery.SourcelessFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  288)
* is_package() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   73)
* is_parameter() (symtable.Symbol のメソッド): 記号表の検査. (line  180)
* 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   52)
* 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  172)
* 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_resource_enabled() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  265)
* is_resource() (importlib.resources モジュール): 関数 API.  (line  136)
* is_resource() (importlib.resources.abc.ResourceReader のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   62)
* is_running() (asyncio.loop のメソッド): ループの開始と停止.
                                                             (line   39)
* is_running() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   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  261)
* 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 2011)
* is_subnormal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  364)
* is_subnormal() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  327)
* is_symlink() (os.DirEntry のメソッド): ファイルとディレクトリ.
                                                             (line 1063)
* 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  250)
* is_term_resized() (curses モジュール): 関数<6>.            (line  264)
* is_tracing() (tracemalloc モジュール): 関数<11>.           (line   60)
* is_tracked() (gc モジュール):          gc --- ガベージコレクターインターフェース.
                                                             (line  177)
* is_type_parameter() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  184)
* 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_name() (xml モジュール):      XMLを扱うモジュール群.
                                                             (line   42)
* is_valid_text() (xml モジュール):      XMLを扱うモジュール群.
                                                             (line   55)
* is_valid() (string.Template のメソッド): Template strings $-strings.
                                                             (line   77)
* is_wasi (test.support モジュール):     test support --- Utilities for the Python test suite.
                                                             (line   48)
* is_wintouched() (curses.window のメソッド): Window オブジェクト.
                                                             (line  371)
* 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  226)
* isabstract() (inspect モジュール):     型とメンバー.       (line  637)
* IsADirectoryError:                     OS 例外.            (line   83)
* isalnum() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  511)
* isalnum() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  511)
* isalnum() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  133)
* isalnum() (str のメソッド):            文字列メソッド<2>.  (line  247)
* isalpha() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  528)
* isalpha() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  528)
* isalpha() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  138)
* isalpha() (str のメソッド):            文字列メソッド<2>.  (line  264)
* isascii() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  544)
* isascii() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  544)
* isascii() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  143)
* isascii() (str のメソッド):            文字列メソッド<2>.  (line  284)
* isasyncgen() (inspect モジュール):     型とメンバー.       (line  596)
* isasyncgenfunction() (inspect モジュール): 型とメンバー.   (line  575)
* isatty() (io.IOBase のメソッド):       I/O 基底クラス.     (line   72)
* isatty() (os モジュール):              ファイル記述子の操作.
                                                             (line  258)
* isawaitable() (inspect モジュール):    型とメンバー.       (line  554)
* isblank() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  147)
* isblk() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  211)
* isbuiltin() (inspect モジュール):      型とメンバー.       (line  616)
* ischr() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  207)
* isclass() (inspect モジュール):        型とメンバー.       (line  430)
* isclose() (cmath モジュール):          類別関数.           (line   23)
* isclose() (math モジュール):           Floating point manipulation functions.
                                                             (line   25)
* iscntrl() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  151)
* iscode() (inspect モジュール):         型とメンバー.       (line  612)
* iscoroutine() (asyncio モジュール):    イントロスペクション.
                                                             (line   26)
* iscoroutine() (inspect モジュール):    型とメンバー.       (line  547)
* iscoroutinefunction() (inspect モジュール): 型とメンバー.  (line  509)
* isctrl() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  191)
* isDaemon() (threading.Thread のメソッド): Thread objects.  (line  257)
* isdatadescriptor() (inspect モジュール): 型とメンバー.     (line  667)
* isdecimal() (str のメソッド):          文字列メソッド<2>.  (line  297)
* isdev() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  219)
* isdevdrive() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  301)
* isdigit() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  553)
* isdigit() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  553)
* isdigit() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  156)
* isdigit() (str のメソッド):            文字列メソッド<2>.  (line  313)
* isdir() (os.path モジュール):          os path --- 一般的なパス名操作.
                                                             (line  253)
* 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  269)
* ISEOF() (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line   36)
* isfifo() (tarfile.TarInfo のメソッド): TarInfo オブジェクト.
                                                             (line  215)
* isfile() (os.path モジュール):         os path --- 一般的なパス名操作.
                                                             (line  243)
* 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  608)
* isfunction() (inspect モジュール):     型とメンバー.       (line  476)
* isfuture() (asyncio モジュール):       Future の関数.      (line    6)
* isgenerator() (inspect モジュール):    型とメンバー.       (line  505)
* isgeneratorfunction() (inspect モジュール): 型とメンバー.  (line  489)
* isgetsetdescriptor() (inspect モジュール): 型とメンバー.   (line  681)
* isgraph() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  161)
* isidentifier() (str のメソッド):       文字列メソッド<2>.  (line  322)
* isinf() (cmath モジュール):            類別関数.           (line   13)
* isinf() (math モジュール):             Floating point manipulation functions.
                                                             (line   82)
* isjunction() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  263)
* iskeyword() (keyword モジュール):      keyword --- Python キーワードのテスト.
                                                             (line   13)
* isleap() (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  362)
* islice() (itertools モジュール):       Itertool関数.       (line  366)
* islink() (os.path モジュール):         os path --- 一般的なパス名操作.
                                                             (line  271)
* islnk() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  203)
* islower() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  567)
* islower() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  567)
* islower() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  165)
* islower() (str のメソッド):            文字列メソッド<2>.  (line  340)
* ismemberdescriptor() (inspect モジュール): 型とメンバー.   (line  689)
* ismeta() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  195)
* ismethod() (inspect モジュール):       型とメンバー.       (line  438)
* ismethoddescriptor() (inspect モジュール): 型とメンバー.   (line  641)
* ismethodwrapper() (inspect モジュール): 型とメンバー.      (line  621)
* ismodule() (inspect モジュール):       型とメンバー.       (line  426)
* ismount() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  280)
* isnan() (cmath モジュール):            類別関数.           (line   18)
* isnan() (math モジュール):             Floating point manipulation functions.
                                                             (line   87)
* ISNONTERMINAL() (token モジュール):    token --- Python 解析木で使われる定数.
                                                             (line   32)
* isnormal() (math モジュール):          Floating point manipulation functions.
                                                             (line   66)
* IsNot (ast のクラス):                  式 expression<2>.   (line  110)
* isnumeric() (str のメソッド):          文字列メソッド<2>.  (line  346)
* isocalendar() (datetime.date のメソッド): date objects.    (line  274)
* isocalendar() (datetime.datetime のメソッド): datetime objects.
                                                             (line  658)
* isoformat() (datetime.date のメソッド): date objects.      (line  299)
* isoformat() (datetime.datetime のメソッド): datetime objects.
                                                             (line  663)
* isoformat() (datetime.time のメソッド): time objects.      (line  179)
* isolated (sys.flags の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  576)
* IsolatedAsyncioTestCase (unittest のクラス): テストクラス. (line  938)
* isolation_level (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  784)
* isoweekday() (datetime.date のメソッド): date objects.     (line  267)
* isoweekday() (datetime.datetime のメソッド): datetime objects.
                                                             (line  652)
* ispackage() (inspect モジュール):      型とメンバー.       (line  483)
* isprint() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  169)
* isprintable() (str のメソッド):        文字列メソッド<2>.  (line  368)
* ispunct() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  173)
* isqrt() (math モジュール):             Number-theoretic functions.
                                                             (line   19)
* isqrt() (math.integer モジュール):     math integer --- integer-specific mathematics functions.
                                                             (line   44)
* isreadable() (pprint モジュール):      関数<4>.            (line   79)
* isreadable() (pprint.PrettyPrinter のメソッド): PrettyPrinter objects.
                                                             (line   89)
* isrecursive() (pprint モジュール):     関数<4>.            (line   88)
* isrecursive() (pprint.PrettyPrinter のメソッド): PrettyPrinter objects.
                                                             (line   97)
* isreg() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  191)
* isreserved() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  320)
* isReservedKey() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line   79)
* isroutine() (inspect モジュール):      型とメンバー.       (line  632)
* isSameNode() (xml.dom.Node のメソッド): Node オブジェクト. (line  100)
* issoftkeyword() (keyword モジュール):  keyword --- Python キーワードのテスト.
                                                             (line   24)
* isspace() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  585)
* isspace() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  585)
* isspace() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  177)
* isspace() (str のメソッド):            文字列メソッド<2>.  (line  394)
* isstdin() (fileinput モジュール):      fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  113)
* issubnormal() (math モジュール):       Floating point manipulation functions.
                                                             (line   74)
* 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  594)
* istitle() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  594)
* istitle() (str のメソッド):            文字列メソッド<2>.  (line  417)
* istraceback() (inspect モジュール):    型とメンバー.       (line  604)
* isub() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   92)
* isupper() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  609)
* isupper() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  609)
* isupper() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  182)
* isupper() (str のメソッド):            文字列メソッド<2>.  (line  435)
* isvisible() (turtle モジュール):       可視性.             (line   22)
* isxdigit() (curses.ascii モジュール):  curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  186)
* isxidcontinue() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  146)
* isxidstart() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  133)
* ITALIC (tkinter.font モジュール):      tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* item() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  201)
* item() (xml.dom.NamedNodeMap のメソッド): NamedNodeMap Objects.
                                                             (line   12)
* item() (xml.dom.NodeList のメソッド):  NodeList オブジェクト.
                                                             (line   16)
* itemgetter() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  277)
* items() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  262)
* items() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  142)
* items() (dict のメソッド):             Mapping types --- dict frozendict.
                                                             (line  185)
* 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  149)
* items() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  296)
* items() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   72)
* itemsize (array.array の属性):         array --- 効率的な数値配列.
                                                             (line  153)
* itemsize (memoryview の属性):          メモリビュー.       (line  452)
* 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  176)
* iter_fields() (ast モジュール):        ast helpers.        (line  171)
* iter_graphemes() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  230)
* 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  136)
* iter() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   39)
* iterable:                              用語集<2>.          (line  925)
* Iterable (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   26)
* Iterable (typing のクラス):            Aliases to other ABCs in collections abc.
                                                             (line    6)
* iterable;unpacking:                    式のリスト.         (line   17)
* iterator:                              用語集<2>.          (line  947)
* Iterator (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   43)
* Iterator (typing のクラス):            Aliases to other ABCs in collections abc.
                                                             (line   14)
* iterdecode() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  254)
* 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  503)
* iterencode() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  241)
* iterencode() (json.JSONEncoder のメソッド): エンコーダとデコーダ.
                                                             (line  238)
* iterfind() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  147)
* iterfind() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   45)
* iteritems() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  141)
* iterkeys() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  115)
* 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  156)
* itervalues() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  124)
* iterweekdays() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   59)
* ITIMER_PROF (signal モジュール):       モジュールの内容<4>.
                                                             (line  253)
* ITIMER_REAL (signal モジュール):       モジュールの内容<4>.
                                                             (line  243)
* ITIMER_VIRTUAL (signal モジュール):    モジュールの内容<4>.
                                                             (line  248)
* ItimerError:                           モジュールの内容<4>.
                                                             (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  517)
* 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  342)
* join() (queue.Queue のメソッド):       キューオブジェクト. (line   87)
* join() (shlex モジュール):             shlex --- 単純な字句解析.
                                                             (line   28)
* join() (str のメソッド):               文字列メソッド<2>.  (line  450)
* 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  234)
* 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:                       例外<21>.           (line    6)
* JSONDecoder (json のクラス):           エンコーダとデコーダ.
                                                             (line    6)
* JSONEncoder (json のクラス):           エンコーダとデコーダ.
                                                             (line  112)
* JULY (calendar モジュール):            calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  517)
* JUMP (monitoring event):               Events.             (line   43)
* JUMP (opcode):                         Python バイトコード命令.
                                                             (line 1483)
* 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 1489)
* JUMP_IF_TRUE (opcode):                 Python バイトコード命令.
                                                             (line 1489)
* JUMP_NO_INTERRUPT (opcode):            Python バイトコード命令.
                                                             (line 1483)
* JUNE (calendar モジュール):            calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  517)
* 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  115)
* key (http.cookies.Morsel の属性):      Morselオブジェクト. (line   71)
* key (zoneinfo.ZoneInfo の属性):        ZoneInfo クラス.    (line   78)
* key function:                          用語集<2>.          (line  977)
* 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   98)
* KeyboardInterrupt (組み込み例外):      シグナルハンドリング<2>.
                                                             (line    7)
* KeyboardInterrupt (組み込み例外) <1>:  シグナルハンドリング<2>.
                                                             (line   57)
* KeyboardInterrupt (組み込み例外) <2>:  シグナルハンドリング<2>.
                                                             (line   67)
* KeyError:                              具象例外.           (line   93)
* keylog_filename (ssl.SSLContext の属性): SSL contexts.     (line  601)
* keyname() (curses モジュール):         関数<6>.            (line  274)
* keypad() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  377)
* keyrefs() (weakref.WeakKeyDictionary のメソッド): weakref --- Weak references.
                                                             (line  201)
* keys() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  133)
* keys() (dict のメソッド):              Mapping types --- dict frozendict.
                                                             (line  190)
* 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  119)
* keys() (sqlite3.Row のメソッド):       Row オブジェクト.   (line   20)
* keys() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  301)
* keys() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   77)
* KeysView (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  127)
* KeysView (typing のクラス):            Aliases to container ABCs in collections abc.
                                                             (line   64)
* keyword (ast のクラス):                式 expression<2>.   (line  152)
* keyword argument:                      用語集<2>.          (line 1000)
* 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  329)
* kill() (subprocess.Popen のメソッド):  Popen オブジェクト. (line  116)
* killchar() (curses モジュール):        関数<6>.            (line  284)
* killpg() (os モジュール):              プロセス管理.       (line  351)
* kind (inspect.Parameter の属性):       Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  254)
* knownfiles (mimetypes モジュール):     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  146)
* kqueue() (select モジュール):          select --- I/O 完了の待機.
                                                             (line  104)
* KqueueSelector (selectors のクラス):   クラス<4>.          (line  198)
* KW_ONLY (dataclasses モジュール):      モジュールの内容<6>.
                                                             (line  502)
* kwargs (inspect.BoundArguments の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  381)
* kwargs (typing.ParamSpec の属性):      Building generic types and type aliases.
                                                             (line  491)
* kwlist (keyword モジュール):           keyword --- Python キーワードのテスト.
                                                             (line   18)
* L (re モジュール):                     フラグ.             (line   57)
* L2CAP_LM (socket モジュール):          定数<8>.            (line  349)
* lambda:                                用語集<2>.          (line 1003)
* 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  359)
* LANG <4>:                              locale --- 国際化サービス.
                                                             (line  363)
* LANGUAGE:                              GNU gettext API.    (line   20)
* LANGUAGE <1>:                          クラス形式の API.   (line   25)
* large files:                           ラージファイルのサポート.
                                                             (line    6)
* LARGEST (test.support モジュール):     test support --- Utilities for the Python test suite.
                                                             (line  205)
* LargeZipFile:                          zipfile --- ZIP アーカイブの処理.
                                                             (line   45)
* last_accepted (multiprocessing.connection.Listener の属性): リスナーとクライアント.
                                                             (line  104)
* last_exc (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1373)
* last_mode (compression.zstd.ZstdCompressor の属性): メモリ上での圧縮と展開.
                                                             (line  148)
* last_traceback (sys モジュール):       トレースバック traceback オブジェクト.
                                                             (line    6)
* last_traceback (sys モジュール) <1>:   sys --- システム固有のパラメーターと関数.
                                                             (line 1412)
* last_type (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1412)
* last_value (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1412)
* lastChild (xml.dom.Node の属性):       Node オブジェクト.  (line   58)
* lastcmd (cmd.Cmd の属性):              Cmdオブジェクト.    (line  135)
* lastgroup (re.Match の属性):           Match objects.      (line  193)
* lastindex (re.Match の属性):           Match objects.      (line  185)
* lastResort (logging モジュール):       モジュールレベル属性.
                                                             (line    6)
* lastrowid (sqlite3.Cursor の属性):     Cursor オブジェクト.
                                                             (line  205)
* layout() (tkinter.ttk.Style のメソッド): Ttk スタイル.     (line   97)
* lazy (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  314)
* lazy import:                           Lazy imports.       (line    6)
* lazy;import:                           Lazy imports.       (line    6)
* lazy2 (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  316)
* lazycache() (linecache モジュール):    linecache --- テキストラインへのランダムアクセス.
                                                             (line   56)
* LazyImportType (types モジュール):     標準的なインタプリタ型.
                                                             (line  214)
* LazyLoader (importlib.util のクラス):  importlib util -- Utility code for importers.
                                                             (line  191)
* LBRACE (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line  257)
* LBYL:                                  用語集<2>.          (line 1009)
* LC_ALL:                                GNU gettext API.    (line   20)
* LC_ALL <1>:                            クラス形式の API.   (line   25)
* LC_ALL (locale モジュール):            locale --- 国際化サービス.
                                                             (line  572)
* LC_COLLATE (locale モジュール):        locale --- 国際化サービス.
                                                             (line  537)
* LC_CTYPE (locale モジュール):          locale --- 国際化サービス.
                                                             (line  523)
* LC_MESSAGES:                           GNU gettext API.    (line   20)
* LC_MESSAGES <1>:                       クラス形式の API.   (line   25)
* LC_MESSAGES (locale モジュール):       locale --- 国際化サービス.
                                                             (line  553)
* LC_MONETARY (locale モジュール):       locale --- 国際化サービス.
                                                             (line  548)
* LC_NUMERIC (locale モジュール):        locale --- 国際化サービス.
                                                             (line  564)
* LC_TIME (locale モジュール):           locale --- 国際化サービス.
                                                             (line  543)
* lchflags() (os モジュール):            ファイルとディレクトリ.
                                                             (line  315)
* lchmod() (os モジュール):              ファイルとディレクトリ.
                                                             (line  329)
* lchmod() (pathlib.Path のメソッド):    パーミッションと所有者.
                                                             (line   60)
* lchown() (os モジュール):              ファイルとディレクトリ.
                                                             (line  351)
* lcm() (math モジュール):               Number-theoretic functions.
                                                             (line   22)
* lcm() (math.integer モジュール):       math integer --- integer-specific mathematics functions.
                                                             (line   55)
* ldexp() (math モジュール):             Floating point manipulation functions.
                                                             (line   92)
* 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  367)
* leaveok() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  384)
* left (filecmp.dircmp の属性):          dircmp クラス.      (line   44)
* left_list (filecmp.dircmp の属性):     dircmp クラス.      (line   52)
* left_only (filecmp.dircmp の属性):     dircmp クラス.      (line   67)
* left() (turtle モジュール):            Turtle の動き.      (line   57)
* LEFTSHIFT (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  281)
* LEFTSHIFTEQUAL (token モジュール):     token --- Python 解析木で使われる定数.
                                                             (line  314)
* LEGACY_TRANSACTION_CONTROL (sqlite3 モジュール): モジュール定数.
                                                             (line    6)
* lenfunc (C type):                      Slot Type typedefs. (line  105)
* length (xml.dom.NamedNodeMap の属性):  NamedNodeMap Objects.
                                                             (line    8)
* length (xml.dom.NodeList の属性):      NodeList オブジェクト.
                                                             (line   22)
* length_hint() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  218)
* LESS (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  242)
* LESSEQUAL (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  269)
* level (logging.Logger の属性):         ロガーオブジェクト. (line   32)
* lexical analyzer:                      用語集<2>.          (line 1024)
* LexicalHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   44)
* lexists() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  142)
* 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 の属性):         例外<20>.           (line   18)
* LibraryLoader (ctypes のクラス):       共有ライブラリをロードする.
                                                             (line  193)
* license (組み込み変数):                site モジュールで追加される定数.
                                                             (line   32)
* LifoQueue (asyncio のクラス):          LIFO キュー.        (line    6)
* LifoQueue (queue のクラス):            queue --- 同期キュークラス.
                                                             (line   39)
* light-weight processes:                _thread --- 低水準なスレッド API.
                                                             (line    6)
* limit_denominator() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  164)
* LimitOverrunError:                     例外<17>.           (line   62)
* line (bdb.Breakpoint の属性):          bdb --- デバッガーフレームワーク.
                                                             (line   87)
* LINE (monitoring event):               Events.             (line   47)
* LINE (pstats.SortKey の属性):          The Stats class.    (line  210)
* 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 1447)
* 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 の属性):  例外<21>.           (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  329)
* lineno (tomllib.TOMLDecodeError の属性): tomllib --- TOML ファイルの解析.
                                                             (line   85)
* lineno (traceback.FrameSummary の属性): FrameSummary オブジェクト.
                                                             (line   34)
* lineno (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   93)
* lineno (tracemalloc.Filter の属性):    Filter.             (line   49)
* lineno (tracemalloc.Frame の属性):     Frame.              (line   17)
* lineno (xml.parsers.expat.ExpatError の属性): ExpatError 例外.
                                                             (line   26)
* lineno() (fileinput モジュール):       fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line   96)
* LINES:                                 関数<6>.            (line  140)
* LINES <1>:                             関数<6>.            (line  595)
* LINES <2>:                             関数<6>.            (line  597)
* 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  197)
* link() (os モジュール):                ファイルとディレクトリ.
                                                             (line  366)
* linked_to_musl() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  600)
* LinkFallbackError:                     tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  323)
* linkname (tarfile.TarInfo の属性):     TarInfo オブジェクト.
                                                             (line   97)
* LinkOutsideDestinationError:           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  318)
* list:                                  用語集<2>.          (line 1028)
* 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 1034)
* list_all() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line    8)
* LIST_APPEND (opcode):                  Python バイトコード命令.
                                                             (line  380)
* list_dialects() (csv モジュール):      モジュールコンテンツ.
                                                             (line   90)
* LIST_EXTEND (opcode):                  Python バイトコード命令.
                                                             (line  734)
* list_folders() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   63)
* list_folders() (mailbox.MH のメソッド): MH オブジェクト.   (line   37)
* list;内包表記:                         リスト表示.         (line    6)
* list;表示:                             リスト表示.         (line    6)
* list() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  212)
* list() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  234)
* list() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   55)
* list() (tarfile.TarFile のメソッド):   TarFile オブジェクト.
                                                             (line  125)
* ListComp (ast のクラス):               内包表記 Comprehension.
                                                             (line    6)
* listdir() (os モジュール):             ファイルとディレクトリ.
                                                             (line  389)
* listdrives() (os モジュール):          ファイルとディレクトリ.
                                                             (line  428)
* listen() (logging.config モジュール):  環境設定のための関数.
                                                             (line  115)
* listen() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  201)
* 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  447)
* listvolumes() (os モジュール):         ファイルとディレクトリ.
                                                             (line  471)
* listxattr() (os モジュール):           Linux 拡張属性.     (line   26)
* Literal (typing モジュール):           特殊形式.           (line  140)
* literal_eval() (ast モジュール):       ast helpers.        (line   87)
* LiteralString (typing モジュール):     特殊型.             (line   67)
* LittleEndianStructure (ctypes のクラス): 構造化データ型.   (line   32)
* LittleEndianUnion (ctypes のクラス):   構造化データ型.     (line   20)
* ljust() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  307)
* ljust() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  307)
* ljust() (str のメソッド):              文字列メソッド<2>.  (line  465)
* 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  124)
* ln() (decimal.Context のメソッド):     Context オブジェクト.
                                                             (line  374)
* ln() (decimal.Decimal のメソッド):     Decimal オブジェクト.
                                                             (line  337)
* LNKTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  344)
* 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 1495)
* LOAD_COMMON_CONSTANT (opcode):         Python バイトコード命令.
                                                             (line  494)
* LOAD_CONST (opcode):                   Python バイトコード命令.
                                                             (line  619)
* load_default_certs() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  130)
* LOAD_DEREF (opcode):                   Python バイトコード命令.
                                                             (line 1017)
* load_dh_params() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  426)
* load_extension() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  475)
* 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_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   44)
* load() (json モジュール):              基本的な使い方<4>.  (line  106)
* load() (marshal モジュール):           marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   96)
* load() (pickle モジュール):            モジュールインターフェース.
                                                             (line   62)
* load() (pickle.Unpickler のメソッド):  モジュールインターフェース.
                                                             (line  288)
* load() (plistlib モジュール):          plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line   47)
* load() (tomllib モジュール):           tomllib --- TOML ファイルの解析.
                                                             (line   40)
* load() (tracemalloc.Snapshot のクラスメソッド): Snapshot.  (line   51)
* loader:                                ファインダーとローダー.
                                                             (line    6)
* loader <1>:                            用語集<2>.          (line 1070)
* Loader (importlib.abc のクラス):       importlib abc -- Abstract base classes related to import.
                                                             (line  138)
* loader (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  402)
* loader_state (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  431)
* LoadError:                             http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   33)
* LoadFileDialog (tkinter.filedialog のクラス): ネイティブの読み込み/保存ダイアログ.
                                                             (line  134)
* LoadKey() (winreg モジュール):         関数<14>.           (line  274)
* LoadLibrary() (ctypes.LibraryLoader のメソッド): 共有ライブラリをロードする.
                                                             (line  204)
* loads() (json モジュール):             基本的な使い方<4>.  (line  198)
* loads() (marshal モジュール):          marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line  134)
* loads() (pickle モジュール):           モジュールインターフェース.
                                                             (line   80)
* loads() (plistlib モジュール):         plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line   82)
* loads() (tomllib モジュール):          tomllib --- TOML ファイルの解析.
                                                             (line   57)
* 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)
* local (threading のクラス):            Thread-local data.  (line  127)
* LOCAL_CREDS (socket モジュール):       定数<8>.            (line  416)
* LOCAL_CREDS_PERSISTENT (socket モジュール): 定数<8>.       (line  416)
* localcontext() (decimal モジュール):   Context オブジェクト.
                                                             (line   25)
* LOCALE (re モジュール):                フラグ.             (line   57)
* localeconv() (locale モジュール):      locale --- 国際化サービス.
                                                             (line   68)
* LocaleHTMLCalendar (calendar のクラス): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  333)
* LocaleTextCalendar (calendar のクラス): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  327)
* localize() (locale モジュール):        locale --- 国際化サービス.
                                                             (line  505)
* 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  158)
* locate_file() (importlib.metadata.Distribution のメソッド): Distributions.
                                                             (line  114)
* locate() (importlib.metadata.PackagePath のメソッド): 配布物ファイル.
                                                             (line   24)
* Locator (xml.sax.xmlreader のクラス):  xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   42)
* lock:                                  用語集<2>.          (line 1043)
* Lock (asyncio のクラス):               Lock.               (line    6)
* Lock (multiprocessing のクラス):       同期プリミティブ.   (line   65)
* lock (sys.thread_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 2181)
* Lock (threading のクラス):             Lock objects.       (line   33)
* LOCK_EX (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  203)
* LOCK_NB (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  207)
* LOCK_SH (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  199)
* LOCK_UN (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  195)
* lock-free:                             用語集<2>.          (line 1058)
* lock, interpreter:                     Thread states and the global interpreter lock.
                                                             (line    6)
* lock() (mailbox.Babyl のメソッド):     Babyl オブジェクト. (line   56)
* lock() (mailbox.Mailbox のメソッド):   Mailbox オブジェクト.
                                                             (line  261)
* lock() (mailbox.Maildir のメソッド):   Maildir オブジェクト.
                                                             (line  206)
* lock() (mailbox.mbox のメソッド):      mbox オブジェクト.  (line   58)
* lock() (mailbox.MH のメソッド):        MH オブジェクト.    (line   89)
* lock() (mailbox.MMDF のメソッド):      MMDF オブジェクト.  (line   47)
* Lock() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  191)
* locked() (_thread.lock のメソッド):    _thread --- 低水準なスレッド API.
                                                             (line  178)
* 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   93)
* locked() (threading.RLock のメソッド): RLock objects.      (line  114)
* lockf() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  188)
* lockf() (os モジュール):               ファイル記述子の操作.
                                                             (line  264)
* locking() (msvcrt モジュール):         ファイル操作関連.   (line    6)
* LockType (_thread モジュール):         _thread --- 低水準なスレッド API.
                                                             (line   27)
* 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  224)
* login_tty() (os モジュール):           ファイル記述子の操作.
                                                             (line  290)
* login() (ftplib.FTP のメソッド):       FTP オブジェクト.   (line  127)
* login() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line  219)
* login() (smtplib.SMTP のメソッド):     SMTP オブジェクト.  (line  101)
* LOGNAME:                               プロセスのパラメーター.
                                                             (line  258)
* LOGNAME <1>:                           getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   78)
* lognormvariate() (random モジュール):  実数分布.           (line   72)
* logout() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  233)
* 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  793)
* longname() (curses モジュール):        関数<6>.            (line  291)
* lookup_error() (codecs モジュール):    エラーハンドラ.     (line  125)
* lookup() (codecs モジュール):          codecs --- codec レジストリと基底クラス.
                                                             (line   56)
* lookup() (symtable.SymbolTable のメソッド): 記号表の検査.  (line  110)
* lookup() (tkinter.ttk.Style のメソッド): Ttk スタイル.     (line   82)
* lookup() (unicodedata モジュール):     unicodedata --- Unicode データベース.
                                                             (line   22)
* LookupError:                           基底クラス.         (line   79)
* loop control;target:                   break 文.           (line   12)
* loop_factory (unittest.IsolatedAsyncioTestCase の属性): テストクラス.
                                                             (line  945)
* 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  627)
* lower() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  627)
* lower() (str のメソッド):              文字列メソッド<2>.  (line  482)
* LPAR (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  203)
* lpAttributeList (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   60)
* lru_cache() (functools モジュール):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  147)
* lseek() (os モジュール):               ファイル記述子の操作.
                                                             (line  301)
* LShift (ast のクラス):                 式 expression<2>.   (line   55)
* lshift() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  118)
* LSQB (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  209)
* lstat() (os モジュール):               ファイルとディレクトリ.
                                                             (line  492)
* lstat() (pathlib.Path のメソッド):     ファイルの種類とステータスを問い合わせる.
                                                             (line   38)
* lstrip() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  319)
* lstrip() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  319)
* lstrip() (str のメソッド):             文字列メソッド<2>.  (line  493)
* lsub() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  240)
* Lt (ast のクラス):                     式 expression<2>.   (line  110)
* lt() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* lt() (turtle モジュール):              Turtle の動き.      (line   57)
* LtE (ast のクラス):                    式 expression<2>.   (line  110)
* LWPCookieJar (http.cookiejar のクラス): FileCookieJar のサブクラスと web ブラウザとの連携.
                                                             (line   28)
* LZMACompressor (lzma のクラス):        メモリ上での圧縮と展開<2>.
                                                             (line    6)
* LZMADecompressor (lzma のクラス):      メモリ上での圧縮と展開<2>.
                                                             (line   91)
* LZMAError:                             lzma --- LZMA アルゴリズムを使用した圧縮.
                                                             (line   28)
* LZMAFile (lzma のクラス):              圧縮ファイルへの読み書き<2>.
                                                             (line   45)
* M (re モジュール):                     フラグ.             (line   80)
* mac_ver() (platform モジュール):       macOS platform.     (line    6)
* machine() (platform モジュール):       Cross platform.     (line   34)
* macros (netrc.netrc の属性):           netrc オブジェクト. (line   31)
* MADV_AUTOSYNC (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_CORE (mmap モジュール):           MADV_* 定数.        (line    6)
* MADV_DODUMP (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_DOFORK (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_DONTDUMP (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_DONTFORK (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_DONTNEED (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_FREE (mmap モジュール):           MADV_* 定数.        (line    6)
* MADV_FREE_REUSABLE (mmap モジュール):  MADV_* 定数.        (line    6)
* MADV_FREE_REUSE (mmap モジュール):     MADV_* 定数.        (line    6)
* MADV_HUGEPAGE (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_HWPOISON (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_MERGEABLE (mmap モジュール):      MADV_* 定数.        (line    6)
* MADV_NOCORE (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_NOHUGEPAGE (mmap モジュール):     MADV_* 定数.        (line    6)
* MADV_NORMAL (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_NOSYNC (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_PROTECT (mmap モジュール):        MADV_* 定数.        (line    6)
* MADV_RANDOM (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_REMOVE (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_SEQUENTIAL (mmap モジュール):     MADV_* 定数.        (line    6)
* MADV_SOFT_OFFLINE (mmap モジュール):   MADV_* 定数.        (line    6)
* MADV_UNMERGEABLE (mmap モジュール):    MADV_* 定数.        (line    6)
* MADV_WILLNEED (mmap モジュール):       MADV_* 定数.        (line    6)
* madvise() (mmap.mmap のメソッド):      mmap --- メモリマップファイルのサポート.
                                                             (line  249)
* magic method:                          用語集<2>.          (line 1098)
* MAGIC_NUMBER (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   13)
* magic;メソッド:                        用語集<2>.          (line 1102)
* 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  106)
* main():                                プロセスワイドのパラメータ.
                                                             (line    7)
* main() <1>:                            プロセスワイドのパラメータ.
                                                             (line   90)
* main() <2>:                            PyConfig.           (line  126)
* main() (site モジュール):              モジュールの内容<7>.
                                                             (line   43)
* main() (unittest モジュール):          テストのロードと起動.
                                                             (line  506)
* mainloop() (turtle モジュール):        スクリーンイベントを利用する.
                                                             (line  105)
* maintype (email.headerregistry.ContentTypeHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  272)
* major (email.headerregistry.MIMEVersionHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  240)
* major() (os モジュール):               ファイルとディレクトリ.
                                                             (line  655)
* 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 モジュール): モジュールの内容<6>.
                                                             (line  396)
* 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  665)
* makedirs() (os モジュール):            ファイルとディレクトリ.
                                                             (line  560)
* makeelement() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  164)
* makefile() (socket のメソッド):        I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* makefile() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  213)
* 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  514)
* MalformedHeaderDefect:                 email errors Exception and Defect classes.
                                                             (line  108)
* malloc (C function):                   概要<4>.            (line   33)
* manager (logging.LoggerAdapter の属性): LoggerAdapter オブジェクト.
                                                             (line   30)
* mangle_from_ (email.policy.Compat32 の属性): email policy Policy Objects.
                                                             (line  588)
* 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  691)
* 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  373)
* MAP_TPRO (mmap モジュール):            MAP_* 定数.         (line    6)
* MAP_TRANSLATED_ALLOW_EXECUTE (mmap モジュール): MAP_* 定数.
                                                             (line    6)
* MAP_UNIX03 (mmap モジュール):          MAP_* 定数.         (line    6)
* map() (concurrent.futures.Executor のメソッド): Executor オブジェクト.
                                                             (line   21)
* map() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line   98)
* map() (tkinter.ttk.Style のメソッド):  Ttk スタイル.       (line   49)
* mapLogRecord() (logging.handlers.HTTPHandler のメソッド): HTTPHandler.
                                                             (line   26)
* mapping:                               用語集<2>.          (line 1102)
* Mapping (collections.abc のクラス):    コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  121)
* Mapping (typing のクラス):             Aliases to container ABCs in collections abc.
                                                             (line   72)
* MappingProxyType (types のクラス):     標準的なインタプリタ型.
                                                             (line  252)
* 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  517)
* markcoroutinefunction() (inspect モジュール): 型とメンバー.
                                                             (line  531)
* master (tkinter.Tk の属性):            Tkinter モジュール. (line   75)
* Match (ast のクラス):                  Pattern matching.   (line    6)
* Match (re のクラス):                   Match objects.      (line   13)
* 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  280)
* match() (re モジュール):               関数<2>.            (line   72)
* match() (re.Pattern のメソッド):       Regular expression objects.
                                                             (line   70)
* 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  136)
* max (datetime.datetime の属性):        datetime objects.   (line  297)
* max (datetime.time の属性):            time objects.       (line   37)
* max (datetime.timedelta の属性):       timedelta objects.  (line   95)
* max (sys.float_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  696)
* MAX (uuid モジュール):                 uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  318)
* max_10_exp (sys.float_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line  705)
* max_children (socketserver.ThreadingMixIn の属性): サーバ生成に関するノート.
                                                             (line   54)
* max_count (email.headerregistry.BaseHeader の属性): email headerregistry Custom Header Objects.
                                                             (line   61)
* MAX_EMAX (decimal モジュール):         定数<4>.            (line   25)
* max_exp (sys.float_info の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line  700)
* 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   22)
* 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_response_headers (http.client.HTTPConnection の属性): HTTPConnection オブジェクト.
                                                             (line  169)
* MAX_WBITS (zlib モジュール):           zlib --- gzip 互換の圧縮.
                                                             (line  339)
* 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  811)
* maxfrozenset (reprlib.Repr の属性):    Reprオブジェクト.   (line   21)
* MAXIMUM_SUPPORTED (ssl.TLSVersion の属性): 定数<9>.        (line  579)
* maximum_version (ssl.SSLContext の属性): SSL contexts.     (line  612)
* maxlen (collections.deque の属性):     deque オブジェクト. (line  121)
* maxlevel (reprlib.Repr の属性):        Reprオブジェクト.   (line   17)
* maxlist (reprlib.Repr の属性):         Reprオブジェクト.   (line   21)
* maxlong (reprlib.Repr の属性):         Reprオブジェクト.   (line   33)
* maxother (reprlib.Repr の属性):        Reprオブジェクト.   (line   45)
* maxset (reprlib.Repr の属性):          Reprオブジェクト.   (line   21)
* maxsize (asyncio.Queue の属性):        Queue.              (line   22)
* maxsize (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line 1420)
* maxstring (reprlib.Repr の属性):       Reprオブジェクト.   (line   38)
* maxtuple (reprlib.Repr の属性):        Reprオブジェクト.   (line   21)
* maxunicode (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1426)
* MAXYEAR (datetime モジュール):         定数.               (line   13)
* MAY (calendar モジュール):             calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  517)
* MB_ICONASTERISK (winsound モジュール): 定数<12>.           (line  123)
* MB_ICONERROR (winsound モジュール):    定数<12>.           (line  143)
* MB_ICONEXCLAMATION (winsound モジュール): 定数<12>.        (line  127)
* MB_ICONHAND (winsound モジュール):     定数<12>.           (line  131)
* MB_ICONINFORMATION (winsound モジュール): 定数<12>.        (line  149)
* MB_ICONQUESTION (winsound モジュール): 定数<12>.           (line  135)
* MB_ICONSTOP (winsound モジュール):     定数<12>.           (line  155)
* MB_ICONWARNING (winsound モジュール):  定数<12>.           (line  161)
* MB_OK (winsound モジュール):           定数<12>.           (line  139)
* mbox (mailbox のクラス):               mbox オブジェクト.  (line    6)
* mboxMessage (mailbox のクラス):        mboxMessage オブジェクト.
                                                             (line    6)
* md5() (hashlib モジュール):            コンストラクタ.     (line   20)
* mean (statistics.NormalDist の属性):   NormalDist オブジェクト.
                                                             (line   21)
* mean() (statistics モジュール):        関数の詳細.         (line    9)
* measure() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   63)
* median (statistics.NormalDist の属性): NormalDist オブジェクト.
                                                             (line   26)
* median_grouped() (statistics モジュール): 関数の詳細.      (line  265)
* median_high() (statistics モジュール): 関数の詳細.         (line  248)
* median_low() (statistics モジュール):  関数の詳細.         (line  231)
* median() (statistics モジュール):      関数の詳細.         (line  205)
* member_names (enum.EnumDict の属性):   データ型<2>.        (line  792)
* member() (enum モジュール):            Utilities and decorators.
                                                             (line   81)
* MemberDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  236)
* memfd_create() (os モジュール):        ファイルとディレクトリ.
                                                             (line 2221)
* memmove() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  179)
* MemoryBIO (ssl のクラス):              Memory BIO support. (line  132)
* MemoryError:                           具象例外.           (line  114)
* MemoryHandler (logging.handlers のクラス): MemoryHandler.  (line   42)
* memoryview (組み込みクラス):           メモリビュー.       (line   10)
* memoryview_at() (ctypes モジュール):   ユーティリティー関数.
                                                             (line  274)
* memset() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  185)
* merge() (heapq モジュール):            heapq --- ヒープキューアルゴリズム.
                                                             (line  140)
* message (BaseExceptionGroup の属性):   例外グループ.       (line   33)
* Message (email.message のクラス):      email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line   49)
* Message (mailbox のクラス):            Message オブジェクト.
                                                             (line    6)
* Message (tkinter.messagebox のクラス): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   21)
* message digest, MD5:                   hashlib --- セキュアハッシュとメッセージダイジェスト.
                                                             (line    8)
* message_factory (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  194)
* message_from_binary_file() (email モジュール): Parser API. (line  132)
* message_from_bytes() (email モジュール): Parser API.       (line  119)
* message_from_file() (email モジュール): Parser API.        (line  155)
* message_from_string() (email モジュール): Parser API.      (line  145)
* MessageBeep() (winsound モジュール):   関数<15>.           (line   25)
* 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 1112)
* meta_path (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1435)
* meta() (curses モジュール):            関数<6>.            (line  298)
* metaclass:                             メタクラス.         (line    6)
* metaclass <1>:                         用語集<2>.          (line 1121)
* metaclass hint:                        適切なメタクラスの決定.
                                                             (line    6)
* metadata (importlib.metadata.Distribution の属性): Distributions.
                                                             (line   61)
* 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  195)
* METH_COEXIST (C macro):                Implementing functions and methods.
                                                             (line  213)
* METH_FASTCALL (C macro):               Implementing functions and methods.
                                                             (line  125)
* METH_KEYWORDS (C macro):               Implementing functions and methods.
                                                             (line  109)
* METH_METHOD (C macro):                 Implementing functions and methods.
                                                             (line  152)
* METH_NOARGS (C macro):                 Implementing functions and methods.
                                                             (line  170)
* METH_O (C macro):                      Implementing functions and methods.
                                                             (line  182)
* METH_STATIC (C macro):                 Implementing functions and methods.
                                                             (line  203)
* METH_VARARGS (C macro):                Implementing functions and methods.
                                                             (line   99)
* method (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   53)
* method resolution order:               用語集<2>.          (line 1144)
* 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   69)
* MFD_ALLOW_SEALING (os モジュール):     ファイルとディレクトリ.
                                                             (line 2239)
* MFD_CLOEXEC (os モジュール):           ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_16GB (os モジュール):         ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_16MB (os モジュール):         ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_1GB (os モジュール):          ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_1MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_256MB (os モジュール):        ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_2GB (os モジュール):          ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_2MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_32MB (os モジュール):         ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_512KB (os モジュール):        ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_512MB (os モジュール):        ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_64KB (os モジュール):         ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_8MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_MASK (os モジュール):         ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGE_SHIFT (os モジュール):        ファイルとディレクトリ.
                                                             (line 2239)
* MFD_HUGETLB (os モジュール):           ファイルとディレクトリ.
                                                             (line 2239)
* MH (mailbox のクラス):                 MH オブジェクト.    (line    6)
* MHMessage (mailbox のクラス):          MHMessage オブジェクト.
                                                             (line    6)
* microsecond (datetime.datetime の属性): datetime objects.  (line  334)
* 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   60)
* 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  228)
* min (datetime.date の属性):            date objects.       (line  132)
* min (datetime.datetime の属性):        datetime objects.   (line  292)
* min (datetime.time の属性):            time objects.       (line   33)
* min (datetime.timedelta の属性):       timedelta objects.  (line   90)
* min (sys.float_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  710)
* min_10_exp (sys.float_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line  723)
* MIN_EMIN (decimal モジュール):         定数<4>.            (line   28)
* MIN_ETINY (decimal モジュール):        定数<4>.            (line   31)
* min_exp (sys.float_info の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line  718)
* 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  577)
* minimum_version (ssl.SSLContext の属性): SSL contexts.     (line  630)
* minor (email.headerregistry.MIMEVersionHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  244)
* minor() (os モジュール):               ファイルとディレクトリ.
                                                             (line  660)
* MINUS (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  227)
* minus() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  418)
* minute (datetime.datetime の属性):     datetime objects.   (line  326)
* minute (datetime.time の属性):         time objects.       (line   54)
* MINYEAR (datetime モジュール):         定数.               (line    8)
* mirrored() (unicodedata モジュール):   unicodedata --- Unicode データベース.
                                                             (line  123)
* misc_header (cmd.Cmd の属性):          Cmdオブジェクト.    (line  157)
* MisplacedEnvelopeHeaderDefect:         email errors Exception and Defect classes.
                                                             (line   96)
* MISSING (contextvars.Token の属性):    コンテキスト変数.   (line  128)
* MISSING (dataclasses モジュール):      モジュールの内容<6>.
                                                             (line  497)
* 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:             例外<10>.           (line   56)
* mkd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  338)
* mkdir() (os モジュール):               ファイルとディレクトリ.
                                                             (line  525)
* mkdir() (pathlib.Path のメソッド):     ファイルとディレクトリの作成.
                                                             (line   21)
* mkdir() (zipfile.ZipFile のメソッド):  ZipFile objects.    (line  352)
* mkdtemp() (tempfile モジュール):       tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  287)
* mkfifo() (os モジュール):              ファイルとディレクトリ.
                                                             (line  611)
* mknod() (os モジュール):               ファイルとディレクトリ.
                                                             (line  634)
* mkstemp() (tempfile モジュール):       tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  229)
* mktemp() (tempfile モジュール):        非推奨の関数と変数. (line   14)
* mktime_tz() (email.utils モジュール):  email utils Miscellaneous utilities.
                                                             (line  145)
* mktime() (time モジュール):            関数<5>.            (line  174)
* 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  153)
* mode (io.FileIO の属性):               生ファイルI/O.      (line   55)
* 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   80)
* 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 1151)
* 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 1160)
* module_from_spec() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  120)
* module; __future__:                    __future__ --- future 文の定義.
                                                             (line    6)
* module; __main__:                      __main__ --- トップレベルのコード環境.
                                                             (line    6)
* module; _thread:                       _thread --- 低水準なスレッド API.
                                                             (line    6)
* module; _tkinter:                      Tkinter モジュール. (line  148)
* 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; 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; math.integer:                  math integer --- integer-specific mathematics functions.
                                                             (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 --- Pure Python profiler.
                                                             (line    6)
* module; profiling:                     profiling --- Python profilers.
                                                             (line    6)
* module; profiling.sampling:            profiling sampling --- Statistical profiler.
                                                             (line    6)
* module; profiling.tracing:             profiling tracing --- Deterministic profiler.
                                                             (line    6)
* module; pstats:                        pstats --- Statistics for profilers.
                                                             (line    6)
* module; pty:                           pty --- 擬似端末ユーティリティ.
                                                             (line    6)
* module; pwd:                           pwd --- パスワードデータベース.
                                                             (line    6)
* module; py_compile:                    py_compile --- Python ソースファイルをコンパイルする.
                                                             (line    6)
* module; pyclbr:                        pyclbr --- Python モジュールブラウザーサポート.
                                                             (line    6)
* module; pydoc:                         pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line    6)
* module; queue:                         queue --- 同期キュークラス.
                                                             (line    6)
* module; quopri:                        quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line    6)
* module; random:                        random --- 疑似乱数を生成する.
                                                             (line    6)
* module; re:                            re --- 正規表現操作.
                                                             (line    6)
* module; readline:                      readline --- GNU readline のインターフェース.
                                                             (line    6)
* module; reprlib:                       reprlib --- もう一つの repr の実装.
                                                             (line    6)
* module; resource:                      resource --- リソース使用情報.
                                                             (line    6)
* module; rlcompleter:                   rlcompleter --- GNU readline の補完機能.
                                                             (line    6)
* module; runpy:                         runpy --- Python モジュールの位置特定と実行.
                                                             (line    6)
* module; sched:                         sched --- イベントスケジューラー.
                                                             (line    6)
* module; secrets:                       secrets --- 機密を扱うために安全な乱数を生成する.
                                                             (line    6)
* module; select:                        select --- I/O 完了の待機.
                                                             (line    6)
* module; selectors:                     selectors --- 高水準の I/O 多重化.
                                                             (line    6)
* module; shelve:                        shelve --- Python オブジェクトの永続化.
                                                             (line    6)
* module; shlex:                         shlex --- 単純な字句解析.
                                                             (line    6)
* module; shutil:                        shutil --- 高水準のファイル操作.
                                                             (line    6)
* module; signal:                        signal --- 非同期イベントにハンドラーを設定する.
                                                             (line    6)
* module; site:                          site --- サイト固有の設定フック.
                                                             (line    6)
* module; sitecustomize:                 sitecustomize.      (line    6)
* module; smtpd:                         smtpd --- SMTP Server.
                                                             (line    6)
* module; smtplib:                       smtplib --- SMTP プロトコルクライアント.
                                                             (line    6)
* module; sndhdr:                        sndhdr --- Determine type of sound file.
                                                             (line    6)
* module; socket:                        socket --- 低水準ネットワークインターフェース.
                                                             (line    6)
* module; socketserver:                  socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line    6)
* module; spwd:                          spwd --- The shadow password database.
                                                             (line    6)
* module; sqlite3:                       sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース.
                                                             (line    6)
* module; ssl:                           ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    6)
* module; stat:                          stat --- stat の結果を解釈する.
                                                             (line    6)
* module; statistics:                    statistics --- 数学的統計関数.
                                                             (line    6)
* module; string:                        string --- 一般的な文字列操作.
                                                             (line    6)
* module; string.templatelib:            string templatelib --- テンプレート文字列リテラルのサポート.
                                                             (line    6)
* module; stringprep:                    stringprep --- インターネットの文字列調製.
                                                             (line    6)
* module; struct:                        struct --- バイト列をパックされたバイナリデータとして解釈する.
                                                             (line    6)
* module; subprocess:                    subprocess --- サブプロセス管理.
                                                             (line    6)
* module; sunau:                         sunau --- Read and write Sun AU files.
                                                             (line    6)
* module; symtable:                      symtable --- コンパイラーの記号表へのアクセス.
                                                             (line    6)
* module; sys:                           sys --- システム固有のパラメーターと関数.
                                                             (line    6)
* module; sys.monitoring:                sys monitoring --- 実行イベントモニタリング.
                                                             (line    6)
* module; sysconfig:                     sysconfig --- Python の構成情報へのアクセスを提供する.
                                                             (line    6)
* module; syslog:                        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line    6)
* module; tabnanny:                      tabnanny --- あいまいなインデントの検出.
                                                             (line    6)
* module; tarfile:                       tarfile --- tar アーカイブファイルの読み書き.
                                                             (line    6)
* module; telnetlib:                     telnetlib --- Telnet client.
                                                             (line    6)
* module; tempfile:                      tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line    6)
* module; termios:                       termios --- POSIX スタイルの端末制御.
                                                             (line    6)
* module; test:                          test --- Regression tests package for Python.
                                                             (line    6)
* module; test.regrtest:                 コマンドラインインターフェースを利用してテストを実行する.
                                                             (line    6)
* module; test.support:                  test support --- Utilities for the Python test suite.
                                                             (line    6)
* module; test.support.bytecode_helper:  test support bytecode_helper --- Support tools for testing correct bytecode generation.
                                                             (line    6)
* module; test.support.import_helper:    test support import_helper --- Utilities for import tests.
                                                             (line    6)
* module; test.support.os_helper:        test support os_helper --- Utilities for os tests.
                                                             (line    6)
* module; test.support.script_helper:    test support script_helper --- Utilities for the Python execution tests.
                                                             (line    6)
* module; test.support.socket_helper:    test support socket_helper --- Utilities for socket tests.
                                                             (line    6)
* module; test.support.threading_helper: test support threading_helper --- Utilities for threading tests.
                                                             (line    6)
* module; test.support.warnings_helper:  test support warnings_helper --- Utilities for warnings tests.
                                                             (line    6)
* module; textwrap:                      textwrap --- テキストの折り返しと詰め込み.
                                                             (line    6)
* module; threading:                     threading --- スレッドベースの並列処理.
                                                             (line    6)
* module; time:                          time --- 時刻データへのアクセスと変換.
                                                             (line    6)
* module; timeit:                        timeit --- 小さなコードスニペットの実行時間計測.
                                                             (line    6)
* module; tkinter:                       tkinter --- Tcl/Tk の Python インターフェース.
                                                             (line    6)
* module; tkinter.colorchooser:          tkinter colorchooser --- カラー選択ダイアログ.
                                                             (line    6)
* module; tkinter.commondialog:          tkinter commondialog --- Dialog window templates.
                                                             (line    6)
* module; tkinter.dnd:                   tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line    6)
* module; tkinter.filedialog:            tkinter filedialog --- File selection dialogs.
                                                             (line    6)
* module; tkinter.font:                  tkinter font --- Tkinter フォントラッパー.
                                                             (line    6)
* module; tkinter.messagebox:            tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line    6)
* module; tkinter.scrolledtext:          tkinter scrolledtext --- スクロール可能なテキストウィジェット.
                                                             (line    6)
* module; tkinter.simpledialog:          tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line    6)
* module; tkinter.ttk:                   tkinter ttk --- Tk のテーマ付きウィジェット.
                                                             (line    6)
* module; token:                         token --- Python 解析木で使われる定数.
                                                             (line    6)
* module; tokenize:                      tokenize --- Python ソース用のトークナイザー.
                                                             (line    6)
* module; tomllib:                       tomllib --- TOML ファイルの解析.
                                                             (line    6)
* module; trace:                         trace --- Python 文実行のトレースと追跡.
                                                             (line    6)
* module; traceback:                     traceback --- スタックトレースの表示または取得.
                                                             (line    6)
* module; tracemalloc:                   tracemalloc --- メモリ割り当ての追跡.
                                                             (line    6)
* module; tty:                           tty --- 端末制御用の関数群.
                                                             (line    6)
* module; turtle:                        turtle --- Turtle graphics.
                                                             (line    6)
* module; turtledemo:                    turtledemo --- Demo scripts.
                                                             (line    6)
* module; types:                         types --- 動的な型生成と組み込み型の名前.
                                                             (line    6)
* module; typing:                        typing --- 型ヒントのサポート.
                                                             (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  101)
* 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 2220)
* 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  160)
* module;glob:                           fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   34)
* module;importing:                      import 文.          (line    6)
* module;io:                             I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* module;json:                           json による構造化されたデータの保存.
                                                             (line    6)
* module;math:                           数値型 int float complex.
                                                             (line  115)
* module;math <1>:                       定数<3>.            (line   47)
* module;namespace:                      モジュール<3>.      (line   21)
* module;os:                             posix --- 最も一般的な POSIX システムコール群.
                                                             (line   14)
* module;pickle:                         copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   76)
* module;pickle <1>:                     copyreg --- pickle サポート関数を登録する.
                                                             (line    8)
* module;pickle <2>:                     shelve --- Python オブジェクトの永続化.
                                                             (line    8)
* module;pickle <3>:                     marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   15)
* module;pty:                            ファイル記述子の操作.
                                                             (line  479)
* module;pwd:                            os path --- 一般的なパス名操作.
                                                             (line  157)
* 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  195)
* module;signal <1>:                     シグナルハンドリング<2>.
                                                             (line    7)
* module;signal <2>:                     シグナルハンドリング<2>.
                                                             (line   57)
* module;signal <3>:                     シグナルハンドリング<2>.
                                                             (line   67)
* module;socket:                         インターネットプロトコルとサポート.
                                                             (line    6)
* module;stat:                           ファイルとディレクトリ.
                                                             (line 1158)
* module;struct:                         socket オブジェクト.
                                                             (line  566)
* module;sys:                            標準モジュール.     (line    6)
* module;sys <1>:                        except 節.          (line   57)
* module;sys <2>:                        完全な Python プログラム.
                                                             (line    6)
* module;sys <3>:                        組み込み関数.       (line 1447)
* 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 1495)
* module;検索;パス <3>:                  site --- サイト固有の設定フック.
                                                             (line   13)
* module;検索;パス <4>:                  Python の埋め込み<2>.
                                                             (line   11)
* module;検索;パス <5>:                  インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* 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 1468)
* 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  380)
* ModuleType (in module types):          モジュールオブジェクト module object.
                                                             (line    7)
* ModuleType (types のクラス):           標準的なインタプリタ型.
                                                             (line  122)
* modulus (sys.hash_info の属性):        sys --- システム固有のパラメーターと関数.
                                                             (line 1124)
* MON_1 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MON_10 (locale モジュール):            locale --- 国際化サービス.
                                                             (line  242)
* MON_11 (locale モジュール):            locale --- 国際化サービス.
                                                             (line  242)
* MON_12 (locale モジュール):            locale --- 国際化サービス.
                                                             (line  242)
* MON_2 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MON_3 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MON_4 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MON_5 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MON_6 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MON_7 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MON_8 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MON_9 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  242)
* MONDAY (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  444)
* monotonic_ns() (time モジュール):      関数<5>.            (line  219)
* monotonic() (time モジュール):         関数<5>.            (line  187)
* Month (calendar のクラス):             calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  535)
* month (calendar.IllegalMonthError の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  555)
* month (datetime.date の属性):          date objects.       (line  152)
* month (datetime.datetime の属性):      datetime objects.   (line  314)
* month_abbr (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  484)
* month_name (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  465)
* month() (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  400)
* monthcalendar() (calendar モジュール): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  389)
* monthdatescalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  108)
* monthdays2calendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  113)
* monthdayscalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  118)
* monthrange() (calendar モジュール):    calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  384)
* Morsel (http.cookies のクラス):        Morselオブジェクト. (line    6)
* most_common() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line   78)
* mouseinterval() (curses モジュール):   関数<6>.            (line  303)
* mousemask() (curses モジュール):       関数<6>.            (line  309)
* move_into() (pathlib.Path のメソッド): Copying moving and deleting.
                                                             (line  100)
* move_to_end() (collections.OrderedDict のメソッド): OrderedDict オブジェクト.
                                                             (line   76)
* move() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   35)
* move() (curses.window のメソッド):     Window オブジェクト.
                                                             (line  393)
* move() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  262)
* move() (pathlib.Path のメソッド):      Copying moving and deleting.
                                                             (line   83)
* move() (shutil モジュール):            ディレクトリとファイルの操作.
                                                             (line  353)
* move() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  211)
* MozillaCookieJar (http.cookiejar のクラス): FileCookieJar のサブクラスと web ブラウザとの連携.
                                                             (line    9)
* MRO:                                   用語集<2>.          (line 1168)
* mro() (type のメソッド):               Special methods.    (line    9)
* MS_ASYNC (mmap モジュール):            MS_* Constants.     (line    6)
* MS_INVALIDATE (mmap モジュール):       MS_* Constants.     (line    6)
* MS_SYNC (mmap モジュール):             MS_* Constants.     (line    6)
* msg (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   41)
* msg (json.JSONDecodeError の属性):     例外<21>.           (line   10)
* msg (netrc.NetrcParseError の属性):    netrc --- netrc ファイルの処理.
                                                             (line   55)
* msg (re.PatternError の属性):          例外<3>.            (line   15)
* msg (tomllib.TOMLDecodeError の属性):  tomllib --- TOML ファイルの解析.
                                                             (line   73)
* msg (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  119)
* mtime (gzip.GzipFile の属性):          gzip --- gzip ファイルのサポート.
                                                             (line  160)
* 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:            例外<10>.           (line   69)
* multimode() (statistics モジュール):   関数の詳細.         (line  348)
* MultipartConversionError:              email errors Exception and Defect classes.
                                                             (line   42)
* MultipartInvariantViolationDefect:     email errors Exception and Defect classes.
                                                             (line  116)
* multiply() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  422)
* mutable:                               用語集<2>.          (line 1172)
* mutable;sequence;types:                ミュータブルなシーケンス型.
                                                             (line    6)
* MutableMapping (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  121)
* MutableMapping (typing のクラス):      Aliases to container ABCs in collections abc.
                                                             (line   88)
* MutableSequence (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   68)
* MutableSequence (typing のクラス):     Aliases to container ABCs in collections abc.
                                                             (line   96)
* MutableSet (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  116)
* MutableSet (typing のクラス):          Aliases to container ABCs in collections abc.
                                                             (line  104)
* mvderwin() (curses.window のメソッド): Window オブジェクト.
                                                             (line  397)
* mvwin() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  403)
* myrights() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  248)
* 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   82)
* name (compression.zstd.ZstdFile の属性): 圧縮ファイルへの読み書き.
                                                             (line  110)
* name (contextvars.ContextVar の属性):  コンテキスト変数.   (line   24)
* name (ctypes.CField の属性):           構造化データ型.     (line  251)
* name (doctest.DocTest の属性):         DocTest オブジェクト.
                                                             (line   30)
* name (email.headerregistry.BaseHeader の属性): email headerregistry Custom Header Objects.
                                                             (line   47)
* name (enum.Enum の属性):               データ型<2>.        (line  123)
* name (gzip.GzipFile の属性):           gzip --- gzip ファイルのサポート.
                                                             (line  168)
* 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  310)
* name (importlib.machinery.AppleFrameworkLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  517)
* name (importlib.machinery.ExtensionFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  320)
* name (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  396)
* name (importlib.machinery.SourceFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  243)
* name (importlib.machinery.SourcelessFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  280)
* name (importlib.metadata.Distribution の属性): Distributions.
                                                             (line   76)
* name (importlib.metadata.DistributionFinder.Context の属性): Distribution Discovery.
                                                             (line   49)
* name (importlib.resources.abc.Traversable の属性): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   97)
* name (inspect.Parameter の属性):       Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  231)
* name (io.FileIO の属性):               生ファイルI/O.      (line   59)
* name (logging.Logger の属性):          ロガーオブジェクト. (line   25)
* name (lzma.LZMAFile の属性):           圧縮ファイルへの読み書き<2>.
                                                             (line  103)
* name (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  115)
* name (multiprocessing.shared_memory.SharedMemory の属性): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  119)
* name (NameError の属性):               具象例外.           (line  133)
* name (os モジュール):                  os --- 雑多なオペレーティングシステムインターフェース.
                                                             (line   54)
* name (os.DirEntry の属性):             ファイルとディレクトリ.
                                                             (line  980)
* name (pathlib.PurePath の属性):        メソッドとプロパティ.
                                                             (line  122)
* NAME (pstats.SortKey の属性):          The Stats class.    (line  214)
* name (pyclbr.Class の属性):            クラスオブジェクト<2>.
                                                             (line   20)
* name (pyclbr.Function の属性):         Function オブジェクト.
                                                             (line   19)
* name (sys.thread_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 2168)
* name (tarfile.TarInfo の属性):         TarInfo オブジェクト.
                                                             (line   62)
* name (tempfile.TemporaryDirectory の属性): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  194)
* name (threading.Thread の属性):        Thread objects.     (line  184)
* 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 1181)
* NAMED_FLAGS (enum.EnumCheck の属性):   データ型<2>.        (line  686)
* NamedExpr (ast のクラス):              式 expression<2>.   (line  184)
* NamedTemporaryFile() (tempfile モジュール): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line   73)
* NamedTuple (typing のクラス):          Other special directives.
                                                             (line   10)
* namedtuple() (collections モジュール): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line   11)
* NameError:                             具象例外.           (line  124)
* 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   92)
* namespace:                             名前づけと束縛 naming and binding.
                                                             (line    6)
* namespace <1>:                         用語集<2>.          (line 1207)
* Namespace (argparse のクラス):         Namespace オブジェクト.
                                                             (line    6)
* Namespace (multiprocessing.managers のクラス): マネージャー.
                                                             (line  257)
* namespace package:                     用語集<2>.          (line 1220)
* 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  253)
* Namespace() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  196)
* NamespaceErr:                          例外<24>.           (line   63)
* NamespaceLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  362)
* NamespacePath (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  201)
* namespaceURI (xml.dom.Node の属性):    Node オブジェクト.  (line   73)
* nametofont() (tkinter.font モジュール): tkinter font --- Tkinter フォントラッパー.
                                                             (line   96)
* NaN:                                   組み込み関数.       (line  728)
* nan (cmath モジュール):                定数<3>.            (line   33)
* nan (math モジュール):                 定数<2>.            (line   31)
* nan (sys.hash_info の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line 1132)
* nanj (cmath モジュール):               定数<3>.            (line   40)
* NannyNag:                              tabnanny --- あいまいなインデントの検出.
                                                             (line   37)
* napms() (curses モジュール):           関数<6>.            (line  318)
* nargs (optparse.Option の属性):        オプション属性.     (line   50)
* native code:                           用語集<2>.          (line 1236)
* native_id (threading.Thread の属性):   Thread objects.     (line  217)
* nb_workers (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  222)
* nbytes (memoryview の属性):            メモリビュー.       (line  400)
* ncurses_version (curses モジュール):   定数<6>.            (line   22)
* ND (inspect.BufferFlags の属性):       Buffer flags.       (line   21)
* ndiff() (difflib モジュール):          difflib --- 差分の計算の補助.
                                                             (line  227)
* ndim (memoryview の属性):              メモリビュー.       (line  465)
* ne() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* needs_input (bz2.BZ2Decompressor の属性): 逐次圧縮および展開.
                                                             (line   85)
* needs_input (compression.zstd.ZstdDecompressor の属性): メモリ上での圧縮と展開.
                                                             (line  221)
* needs_input (lzma.LZMADecompressor の属性): メモリ上での圧縮と展開<2>.
                                                             (line  164)
* neg() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  140)
* nested scope:                          用語集<2>.          (line 1244)
* 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 1254)
* new() (hashlib モジュール):            コンストラクタ.     (line    6)
* new() (hmac モジュール):               hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   15)
* newfunc (C type):                      Slot Type typedefs. (line   32)
* NEWLINE (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line   72)
* NEWLINE トークン:                      論理行 logical line.
                                                             (line    6)
* NEWLINE トークン <1>:                  複合文 compound statement.
                                                             (line   52)
* newlines (io.TextIOBase の属性):       テキスト I/O<2>.    (line   24)
* newpad() (curses モジュール):          関数<6>.            (line  322)
* NewType (typing のクラス):             Other special directives.
                                                             (line   93)
* newwin() (curses モジュール):          関数<6>.            (line  339)
* 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  221)
* nextafter() (math モジュール):         Floating point manipulation functions.
                                                             (line   97)
* nextfile() (fileinput モジュール):     fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  118)
* nextkey() (dbm.gnu.gdbm のメソッド):   dbm gnu --- GNU database manager.
                                                             (line  107)
* nextSibling (xml.dom.Node の属性):     Node オブジェクト.  (line   41)
* NFL (pstats.SortKey の属性):           The Stats class.    (line  218)
* ngettext() (gettext モジュール):       GNU gettext API.    (line   45)
* ngettext() (gettext.GNUTranslations のメソッド): GNUTranslations クラス.
                                                             (line   46)
* ngettext() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   45)
* nice() (os モジュール):                プロセス管理.       (line  360)
* 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  178)
* nl() (curses モジュール):              関数<6>.            (line  349)
* nlargest() (heapq モジュール):         heapq --- ヒープキューアルゴリズム.
                                                             (line  166)
* nlst() (ftplib.FTP のメソッド):        FTP オブジェクト.   (line  298)
* NO (tkinter.messagebox モジュール):    tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  159)
* no_animation() (turtle モジュール):    アニメーションの制御.
                                                             (line    6)
* no_cache() (zoneinfo.ZoneInfo のクラスメソッド): ZoneInfo クラス.
                                                             (line   44)
* NO_EVENTS (monitoring event):          Events.             (line  105)
* no_proxy:                              urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  358)
* no_site (sys.flags の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line  588)
* no_tracing() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  568)
* no_type_check() (typing モジュール):   Functions and decorators.
                                                             (line  346)
* no_user_site (sys.flags の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line  585)
* NoBoundaryInMultipartDefect:           email errors Exception and Defect classes.
                                                             (line   75)
* nocbreak() (curses モジュール):        関数<6>.            (line  355)
* NoDataAllowedErr:                      例外<24>.           (line   79)
* node (uuid.UUID の属性):               uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  124)
* node() (platform モジュール):          Cross platform.     (line   42)
* NoDefault (typing モジュール):         Introspection helpers.
                                                             (line  226)
* nodelay() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  407)
* nodeName (xml.dom.Node の属性):        Node オブジェクト.  (line   78)
* NodeTransformer (ast のクラス):        ast helpers.        (line  228)
* nodeType (xml.dom.Node の属性):        Node オブジェクト.  (line    8)
* NODEV (os モジュール):                 ファイルとディレクトリ.
                                                             (line  670)
* nodeValue (xml.dom.Node の属性):       Node オブジェクト.  (line   86)
* NodeVisitor (ast のクラス):            ast helpers.        (line  188)
* noecho() (curses モジュール):          関数<6>.            (line  360)
* NOEXPR (locale モジュール):            locale --- 国際化サービス.
                                                             (line  286)
* NoExtraItems (typing モジュール):      Introspection helpers.
                                                             (line  240)
* NOFLAG (re モジュール):                フラグ.             (line   91)
* NoModificationAllowedErr:              例外<24>.           (line   84)
* non-deterministic:                     用語集<2>.          (line 1262)
* NonCallableMagicMock (unittest.mock のクラス): Magic Mock. (line   21)
* NonCallableMock (unittest.mock のクラス): Mock クラス.     (line  571)
* None (組み込みオブジェクト):           真理値判定.         (line   17)
* None (組み込み変数):                   組み込み定数.       (line   18)
* NoneType (types モジュール):           標準的なインタプリタ型.
                                                             (line   18)
* nonl() (curses モジュール):            関数<6>.            (line  364)
* Nonlocal (ast のクラス):               関数およびクラス定義.
                                                             (line  144)
* nonmember() (enum モジュール):         Utilities and decorators.
                                                             (line   87)
* noop() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  257)
* noop() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   78)
* NoOptionError:                         例外<10>.           (line   31)
* NOP (opcode):                          Python バイトコード命令.
                                                             (line  133)
* noqiflush() (curses モジュール):       関数<6>.            (line  373)
* noraw() (curses モジュール):           関数<6>.            (line  381)
* NoReturn (typing モジュール):          特殊型.             (line   99)
* NORMAL (tkinter.font モジュール):      tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* NORMAL_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   96)
* NormalDist (statistics のクラス):      NormalDist オブジェクト.
                                                             (line   13)
* normalize_encoding() (encodings モジュール): encodings --- Encodings package.
                                                             (line    8)
* NORMALIZE_WHITESPACE (doctest モジュール): オプションフラグ.
                                                             (line   37)
* normalize() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  438)
* normalize() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  420)
* normalize() (locale モジュール):       locale --- 国際化サービス.
                                                             (line  436)
* normalize() (unicodedata モジュール):  unicodedata --- Unicode データベース.
                                                             (line  189)
* normalize() (xml.dom.Node のメソッド): Node オブジェクト.  (line  141)
* normalvariate() (random モジュール):   実数分布.           (line   78)
* normcase() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  377)
* normpath() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  386)
* NoSectionError:                        例外<10>.           (line   10)
* NoSuchMailboxError:                    例外<22>.           (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  435)
* notations (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   46)
* NotConnected:                          http client --- HTTP プロトコルクライアント.
                                                             (line  150)
* Notebook (tkinter.ttk のクラス):       ttk Notebook.       (line    6)
* NotEmptyError:                         例外<22>.           (line   20)
* NotEq (ast のクラス):                  式 expression<2>.   (line  110)
* NOTEQUAL (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  266)
* NotFoundErr:                           例外<24>.           (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 オブジェクト.
                                                             (line  412)
* NotImplemented (組み込み変数):         組み込み定数.       (line   25)
* NotImplementedError:                   具象例外.           (line  139)
* NotImplementedType (types モジュール): 標準的なインタプリタ型.
                                                             (line  102)
* NotIn (ast のクラス):                  式 expression<2>.   (line  110)
* NotRequired (typing モジュール):       特殊形式.           (line  268)
* NOTSET (logging モジュール):           ロギングレベル.     (line   15)
* NotShareableError:                     例外<14>.           (line   26)
* NotStandaloneHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  486)
* NotSupportedErr:                       例外<24>.           (line   74)
* NotSupportedError:                     例外<8>.            (line   82)
* noutrefresh() (curses.window のメソッド): Window オブジェクト.
                                                             (line  420)
* NOVEMBER (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  517)
* now() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line   61)
* npgettext() (gettext モジュール):      GNU gettext API.    (line   68)
* npgettext() (gettext.GNUTranslations のメソッド): GNUTranslations クラス.
                                                             (line   79)
* npgettext() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   60)
* NSIG (signal モジュール):              モジュールの内容<4>.
                                                             (line  238)
* nsmallest() (heapq モジュール):        heapq --- ヒープキューアルゴリズム.
                                                             (line  174)
* NTEventLogHandler (logging.handlers のクラス): NTEventLogHandler.
                                                             (line   11)
* ntohl() (socket モジュール):           その他の関数<2>.    (line  235)
* ntohs() (socket モジュール):           その他の関数<2>.    (line  242)
* 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_addresses (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  128)
* num_addresses (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  329)
* num_tickets (ssl.SSLContext の属性):   SSL contexts.       (line  637)
* 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() (unicodedata モジュール):    unicodedata --- Unicode データベース.
                                                             (line   71)
* numinput() (turtle モジュール):        入力メソッド.       (line   22)
* O_APPEND (os モジュール):              ファイル記述子の操作.
                                                             (line  417)
* O_ASYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  460)
* O_BINARY (os モジュール):              ファイル記述子の操作.
                                                             (line  440)
* O_CLOEXEC (os モジュール):             ファイル記述子の操作.
                                                             (line  427)
* O_CREAT (os モジュール):               ファイル記述子の操作.
                                                             (line  417)
* O_DIRECT (os モジュール):              ファイル記述子の操作.
                                                             (line  460)
* O_DIRECTORY (os モジュール):           ファイル記述子の操作.
                                                             (line  460)
* O_DSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  427)
* O_EVTONLY (os モジュール):             ファイル記述子の操作.
                                                             (line  450)
* O_EXCL (os モジュール):                ファイル記述子の操作.
                                                             (line  417)
* O_EXLOCK (os モジュール):              ファイル記述子の操作.
                                                             (line  460)
* O_FSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  450)
* O_NDELAY (os モジュール):              ファイル記述子の操作.
                                                             (line  427)
* O_NOATIME (os モジュール):             ファイル記述子の操作.
                                                             (line  460)
* O_NOCTTY (os モジュール):              ファイル記述子の操作.
                                                             (line  427)
* O_NOFOLLOW (os モジュール):            ファイル記述子の操作.
                                                             (line  460)
* O_NOFOLLOW_ANY (os モジュール):        ファイル記述子の操作.
                                                             (line  450)
* O_NOINHERIT (os モジュール):           ファイル記述子の操作.
                                                             (line  440)
* O_NONBLOCK (os モジュール):            ファイル記述子の操作.
                                                             (line  427)
* O_PATH (os モジュール):                ファイル記述子の操作.
                                                             (line  460)
* O_RANDOM (os モジュール):              ファイル記述子の操作.
                                                             (line  440)
* O_RDONLY (os モジュール):              ファイル記述子の操作.
                                                             (line  417)
* O_RDWR (os モジュール):                ファイル記述子の操作.
                                                             (line  417)
* O_RSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  427)
* O_SEQUENTIAL (os モジュール):          ファイル記述子の操作.
                                                             (line  440)
* O_SHLOCK (os モジュール):              ファイル記述子の操作.
                                                             (line  460)
* O_SHORT_LIVED (os モジュール):         ファイル記述子の操作.
                                                             (line  440)
* O_SYMLINK (os モジュール):             ファイル記述子の操作.
                                                             (line  450)
* O_SYNC (os モジュール):                ファイル記述子の操作.
                                                             (line  427)
* O_TEMPORARY (os モジュール):           ファイル記述子の操作.
                                                             (line  440)
* O_TEXT (os モジュール):                ファイル記述子の操作.
                                                             (line  440)
* O_TMPFILE (os モジュール):             ファイル記述子の操作.
                                                             (line  460)
* O_TRUNC (os モジュール):               ファイル記述子の操作.
                                                             (line  417)
* O_WRONLY (os モジュール):              ファイル記述子の操作.
                                                             (line  417)
* obj (AttributeError の属性):           具象例外.           (line   25)
* obj (memoryview の属性):               メモリビュー.       (line  389)
* object:                                オブジェクト、値、および型.
                                                             (line    6)
* object <1>:                            用語集<2>.          (line 1272)
* object (UnicodeError の属性):          具象例外.           (line  455)
* object (組み込みクラス):               組み込み関数.       (line 1241)
* 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 frozendict.
                                                             (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 frozendict.
                                                             (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  491)
* 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 2058)
* 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   80)
* 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  517)
* offset (ctypes.CField の属性):         構造化データ型.     (line  259)
* offset (SyntaxError の属性):           具象例外.           (line  334)
* offset (tarfile.TarInfo の属性):       TarInfo オブジェクト.
                                                             (line  151)
* offset (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  108)
* offset (xml.parsers.expat.ExpatError の属性): ExpatError 例外.
                                                             (line   30)
* offset_data (tarfile.TarInfo の属性):  TarInfo オブジェクト.
                                                             (line  155)
* OK (curses モジュール):                定数<6>.            (line   13)
* OK (tkinter.messagebox モジュール):    tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  153)
* ok_command() (tkinter.filedialog.LoadFileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  139)
* ok_command() (tkinter.filedialog.SaveFileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  149)
* ok_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  118)
* OKCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  171)
* old_value (contextvars.Token の属性):  コンテキスト変数.   (line  121)
* OleDLL (ctypes のクラス):              共有ライブラリをロードする.
                                                             (line  137)
* oledll (ctypes モジュール):            共有ライブラリをロードする.
                                                             (line  221)
* on_motion() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   55)
* on_release() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   60)
* onclick() (turtle モジュール):         スクリーンイベントを利用する.
                                                             (line   56)
* ondrag() (turtle モジュール):          イベントを利用する. (line   56)
* onecmd() (cmd.Cmd のメソッド):         Cmdオブジェクト.    (line   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 のクラス):    ネイティブの読み込み/保存ダイアログ.
                                                             (line   59)
* open_binary() (importlib.resources モジュール): 関数 API.  (line   35)
* open_code() (io モジュール):           高水準のモジュールインターフェイス.
                                                             (line   22)
* open_connection() (asyncio モジュール): ストリーム.        (line   42)
* open_flags (dbm.gnu モジュール):       dbm gnu --- GNU database manager.
                                                             (line   30)
* open_new_tab() (webbrowser モジュール): コマンドライン・インターフェース<6>.
                                                             (line   60)
* open_new_tab() (webbrowser.controller のメソッド): Browser controller objects.
                                                             (line   27)
* open_new() (webbrowser モジュール):    コマンドライン・インターフェース<6>.
                                                             (line   51)
* open_new() (webbrowser.controller のメソッド): Browser controller objects.
                                                             (line   21)
* open_osfhandle() (msvcrt モジュール):  ファイル操作関連.   (line   44)
* open_resource() (importlib.resources.abc.ResourceReader のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   47)
* open_text() (importlib.resources モジュール): 関数 API.    (line   51)
* open_unix_connection() (asyncio モジュール): ストリーム.   (line  118)
* open_urlresource() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  619)
* open() (bz2 モジュール):               ファイルの圧縮/解凍.
                                                             (line    6)
* open() (codecs モジュール):            codecs --- codec レジストリと基底クラス.
                                                             (line  189)
* open() (compression.zstd モジュール):  圧縮ファイルへの読み書き.
                                                             (line    6)
* open() (dbm モジュール):               dbm --- Unix "データベース" へのインターフェース.
                                                             (line   55)
* 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  261)
* open() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  144)
* open() (io モジュール):                高水準のモジュールインターフェイス.
                                                             (line   12)
* open() (lzma モジュール):              圧縮ファイルへの読み書き<2>.
                                                             (line    6)
* open() (os モジュール):                ファイル記述子の操作.
                                                             (line  373)
* open() (pathlib.Path のメソッド):      ファイルを読み書きする<2>.
                                                             (line    6)
* open() (shelve モジュール):            shelve --- Python オブジェクトの永続化.
                                                             (line   17)
* open() (tarfile モジュール):           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line   54)
* open() (tarfile.TarFile のクラスメソッド): TarFile オブジェクト.
                                                             (line  100)
* open() (tokenize モジュール):          Tokenizing input.   (line   97)
* open() (urllib.request.OpenerDirector のメソッド): OpenerDirector オブジェクト.
                                                             (line   47)
* open() (wave モジュール):              wave --- WAV ファイルの読み書き.
                                                             (line   24)
* 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  302)
* OpenKeyEx() (winreg モジュール):       関数<14>.           (line  302)
* openlog() (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   51)
* openpty() (os モジュール):             ファイル記述子の操作.
                                                             (line  477)
* openpty() (pty モジュール):            pty --- 擬似端末ユーティリティ.
                                                             (line   39)
* OPENSSL_VERSION (ssl モジュール):      定数<9>.            (line  494)
* OPENSSL_VERSION_INFO (ssl モジュール): 定数<9>.            (line  504)
* OPENSSL_VERSION_NUMBER (ssl モジュール): 定数<9>.          (line  513)
* OpenSSL;(use in module hashlib):       ハッシュアルゴリズム.
                                                             (line   18)
* OpenSSL;(use in module ssl):           ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    8)
* OperationalError:                      例外<8>.            (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  579)
* optimize() (pickletools モジュール):   Programmatic interface.
                                                             (line   30)
* optimized scope:                       用語集<2>.          (line 1278)
* OPTIMIZED_BYTECODE_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   29)
* Option (optparse のクラス):            オプション属性.     (line    6)
* Optional (typing モジュール):          特殊形式.           (line   60)
* optional module:                       用語集<2>.          (line 1289)
* OptionConflictError:                   例外<13>.           (line   11)
* OptionError:                           例外<13>.           (line    6)
* OptionGroup (optparse のクラス):       オプションをグループ化する.
                                                             (line   12)
* OptionParser (optparse のクラス):      parserを作る.       (line    9)
* options (doctest.Example の属性):      Example オブジェクト.
                                                             (line   49)
* Options (ssl のクラス):                定数<9>.            (line  341)
* options (ssl.SSLContext の属性):       SSL contexts.       (line  645)
* options() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  134)
* OptionValueError:                      例外<13>.           (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  274)
* OrderedDict (collections のクラス):    OrderedDict オブジェクト.
                                                             (line   59)
* OrderedDict (typing のクラス):         Aliases to types in collections.
                                                             (line   17)
* orig_argv (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1480)
* origin (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  408)
* origin (importlib.metadata.Distribution の属性): Distributions.
                                                             (line   87)
* 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  156)
* 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  485)
* 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  102)
* OutsideDestinationError:               tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  304)
* Overflow (decimal のクラス):           シグナル.           (line   69)
* OverflowError:                         具象例外.           (line  216)
* 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 オブジェクト.
                                                             (line  427)
* overload() (typing モジュール):        Functions and decorators.
                                                             (line  246)
* override() (typing モジュール):        Functions and decorators.
                                                             (line  358)
* overwrite() (curses.window のメソッド): Window オブジェクト.
                                                             (line  439)
* owner() (pathlib.Path のメソッド):     パーミッションと所有者.
                                                             (line    6)
* p (pdb command):                       Debugger commands.  (line  271)
* P_ALL (os モジュール):                 プロセス管理.       (line  982)
* P_DETACH (os モジュール):              プロセス管理.       (line  717)
* P_NOWAIT (os モジュール):              プロセス管理.       (line  697)
* P_NOWAITO (os モジュール):             プロセス管理.       (line  697)
* P_OVERLAY (os モジュール):             プロセス管理.       (line  717)
* P_PGID (os モジュール):                プロセス管理.       (line  982)
* P_PID (os モジュール):                 プロセス管理.       (line  982)
* P_PIDFD (os モジュール):               プロセス管理.       (line  982)
* P_WAIT (os モジュール):                プロセス管理.       (line  707)
* pack_into() (struct モジュール):       関数と例外.         (line   19)
* pack_into() (struct.Struct のメソッド): クラス<3>.         (line   30)
* pack() (mailbox.MH のメソッド):        MH オブジェクト.    (line   69)
* pack() (struct モジュール):            関数と例外.         (line   13)
* pack() (struct.Struct のメソッド):     クラス<3>.          (line   24)
* package:                               パッケージ<2>.      (line    6)
* package <1>:                           Startup entry points start files.
                                                             (line   49)
* package <2>:                           用語集<2>.          (line 1299)
* package variable;__all__:              モジュールのインポート<2>.
                                                             (line    8)
* package;namespace:                     名前空間パッケージ. (line    6)
* package;portion:                       名前空間パッケージ. (line    6)
* package;regular:                       通常のパッケージ.   (line    6)
* PackageMetadata (importlib.metadata のクラス): 配布物メタデータ.
                                                             (line   14)
* PackageNotFoundError:                  概要<3>.            (line   37)
* PackagePath (importlib.metadata のクラス): 配布物ファイル. (line   18)
* packages_distributions() (importlib.metadata モジュール): Mapping import to distribution packages.
                                                             (line    6)
* packed (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   72)
* packed (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  267)
* packing (widgets):                     Packer.             (line    6)
* PAGER:                                 pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line   46)
* pair_content() (curses モジュール):    関数<6>.            (line  386)
* pair_number() (curses モジュール):     関数<6>.            (line  392)
* pairwise() (itertools モジュール):     Itertool関数.       (line  411)
* parallelism:                           用語集<2>.          (line 1308)
* parameter:                             用語集<2>.          (line 1319)
* 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  248)
* parameters (inspect.Signature の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  116)
* params (email.headerregistry.ParameterizedMIMEHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  256)
* ParamSpec (ast のクラス):              Type parameters.    (line   35)
* ParamSpec (typing のクラス):           Building generic types and type aliases.
                                                             (line  431)
* ParamSpecArgs (typing モジュール):     Building generic types and type aliases.
                                                             (line  581)
* ParamSpecKwargs (typing モジュール):   Building generic types and type aliases.
                                                             (line  581)
* paramstyle (sqlite3 モジュール):       モジュール定数.     (line   69)
* pardir (os モジュール):                雑多なシステム情報. (line  105)
* parent (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  444)
* parent (logging.Logger の属性):        ロガーオブジェクト. (line   42)
* parent (pathlib.PurePath の属性):      メソッドとプロパティ.
                                                             (line   94)
* parent (pyclbr.Class の属性):          クラスオブジェクト<2>.
                                                             (line   28)
* parent (pyclbr.Function の属性):       Function オブジェクト.
                                                             (line   27)
* parent (urllib.request.BaseHandler の属性): BaseHandler オブジェクト.
                                                             (line   25)
* parent_process() (multiprocessing モジュール): その他<5>.  (line   43)
* parent() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line  226)
* parentNode (xml.dom.Node の属性):      Node オブジェクト.  (line   17)
* parents (collections.ChainMap の属性): ChainMap オブジェクト.
                                                             (line   62)
* parents (pathlib.PurePath の属性):     メソッドとプロパティ.
                                                             (line   78)
* paretovariate() (random モジュール):   実数分布.           (line   92)
* parse_and_bind() (readline モジュール): 初期化ファイル.    (line    8)
* parse_args() (argparse.ArgumentParser のメソッド): parse_args メソッド.
                                                             (line    6)
* parse_args() (optparse.OptionParser のメソッド): 引数を解析する.
                                                             (line    9)
* PARSE_COLNAMES (sqlite3 モジュール):   モジュール定数.     (line   34)
* parse_config_h() (sysconfig モジュール): その他の関数<3>.  (line   59)
* PARSE_DECLTYPES (sqlite3 モジュール):  モジュール定数.     (line   13)
* parse_headers() (http.client モジュール): http client --- HTTP プロトコルクライアント.
                                                             (line  124)
* 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  176)
* parse_qsl() (urllib.parse モジュール): URL の解析.         (line  226)
* 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  176)
* 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 のクラス): 例外<23>.     (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   52)
* ParseResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   77)
* 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:                          例外<10>.           (line   61)
* partial (asyncio.IncompleteReadError の属性): 例外<17>.    (line   57)
* partial() (functools モジュール):      functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  333)
* partial() (imaplib.IMAP4 のメソッド):  IMAP4 オブジェクト. (line  280)
* partialmethod (functools のクラス):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  403)
* 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  534)
* 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<10>.          (line   14)
* PATH <5>:                              Windows<29>.        (line   55)
* PATH <6>:                              Windows<33>.        (line   14)
* PATH <7>:                              セキュリティ<43>.   (line   16)
* PATH <8>:                              セキュリティ<43>.   (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  125)
* 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  449)
* PATH <40>:                             ディレクトリとファイルの操作.
                                                             (line  454)
* PATH <41>:                             プロセス管理.       (line   45)
* PATH <42>:                             プロセス管理.       (line   87)
* PATH <43>:                             プロセス管理.       (line   90)
* PATH <44>:                             プロセス管理.       (line   93)
* PATH <45>:                             プロセス管理.       (line  565)
* PATH <46>:                             プロセス管理.       (line  653)
* PATH <47>:                             プロセス管理.       (line  655)
* PATH <48>:                             プロセス管理.       (line  657)
* 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>:                             Python の埋め込み<2>.
                                                             (line   26)
* PATH <57>:                             Python の埋め込み<2>.
                                                             (line   34)
* PATH <58>:                             Python のスクリプトを Unix で実行可能にするにはどうしますか？.
                                                             (line   20)
* PATH <59>:                             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  314)
* path (importlib.machinery.AppleFrameworkLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  521)
* path (importlib.machinery.ExtensionFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  324)
* path (importlib.machinery.FileFinder の属性): importlib machinery -- Importers and path hooks.
                                                             (line  176)
* path (importlib.machinery.SourceFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  247)
* path (importlib.machinery.SourcelessFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  284)
* path (importlib.metadata.DistributionFinder.Context の属性): Distribution Discovery.
                                                             (line   56)
* path (os.DirEntry の属性):             ファイルとディレクトリ.
                                                             (line  990)
* Path (pathlib のクラス):               具象パス.           (line   10)
* path (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line 1493)
* path (sys モジュール) <1>:             Python の埋め込み<2>.
                                                             (line   11)
* path (sys モジュール) <2>:             インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* Path (zipfile のクラス):               Path objects.       (line    6)
* path based finder:                     パスベース・ファインダー.
                                                             (line    6)
* path based finder <1>:                 用語集<2>.          (line 1396)
* Path browser:                          File メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   23)
* path entry:                            用語集<2>.          (line 1375)
* path entry finder:                     用語集<2>.          (line 1380)
* path entry hook:                       用語集<2>.          (line 1390)
* path hooks:                            インポートフック.   (line    6)
* path_hook() (importlib.machinery.FileFinder のクラスメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  191)
* path_hooks (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1526)
* path_importer_cache (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1535)
* 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  255)
* path-like object:                      用語集<2>.          (line 1401)
* Path.stem (zipfile モジュール):        Path objects.       (line   86)
* Path.suffix (zipfile モジュール):      Path objects.       (line   79)
* Path.suffixes (zipfile モジュール):    Path objects.       (line   92)
* path() (importlib.resources モジュール): 関数 API.         (line  110)
* pathconf_names (os モジュール):        ファイルとディレクトリ.
                                                             (line  698)
* pathconf() (os モジュール):            ファイルとディレクトリ.
                                                             (line  676)
* PathEntryFinder (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line   81)
* PATHEXT:                               その他の改善<2>.    (line   30)
* PATHEXT <1>:                           ライブラリ<140>.    (line  138)
* PATHEXT <2>:                           Installing without UI.
                                                             (line   78)
* PATHEXT <3>:                           Installing without UI.
                                                             (line   83)
* PATHEXT <4>:                           ディレクトリとファイルの操作.
                                                             (line  464)
* 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  141)
* 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 モジュール):           モジュールの内容<4>.
                                                             (line  338)
* PAX_FORMAT (tarfile モジュール):       tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  396)
* pax_headers (tarfile.TarFile の属性):  TarFile オブジェクト.
                                                             (line  333)
* pax_headers (tarfile.TarInfo の属性):  TarInfo オブジェクト.
                                                             (line  163)
* pbkdf2_hmac() (hashlib モジュール):    鍵導出.             (line   11)
* PCALLS (pstats.SortKey の属性):        The Stats class.    (line  222)
* 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  141)
* peek() (io.BufferedReader のメソッド): バッファ付きストリーム.
                                                             (line   80)
* peek() (lzma.LZMAFile のメソッド):     圧縮ファイルへの読み書き<2>.
                                                             (line   85)
* peek() (weakref.finalize のメソッド):  weakref --- Weak references.
                                                             (line  297)
* PEM_cert_to_DER_cert() (ssl モジュール): 証明書の取り扱い. (line   58)
* pen() (turtle モジュール):             描画状態.           (line   32)
* pencolor() (turtle モジュール):        色の制御<2>.        (line    6)
* pending (ssl.MemoryBIO の属性):        Memory BIO support. (line  137)
* pending() (ssl.SSLSocket のメソッド):  SSL sockets.        (line  363)
* PendingDeprecationWarning:             警告.               (line   28)
* pendown() (turtle モジュール):         描画状態.           (line    6)
* pensize() (turtle モジュール):         描画状態.           (line   18)
* penup() (turtle モジュール):           描画状態.           (line   12)
* PEP:                                   用語集<2>.          (line 1413)
* per-object lock:                       用語集<2>.          (line 1364)
* PERCENT (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line  254)
* PERCENTEQUAL (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line  302)
* perf_counter_ns() (time モジュール):   関数<5>.            (line  250)
* perf_counter() (time モジュール):      関数<5>.            (line  226)
* perm() (math モジュール):              Number-theoretic functions.
                                                             (line   25)
* perm() (math.integer モジュール):      math integer --- integer-specific mathematics functions.
                                                             (line   63)
* 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  137)
* PF_DIVERT (socket モジュール):         定数<8>.            (line  214)
* PF_PACKET (socket モジュール):         定数<8>.            (line  224)
* PF_RDS (socket モジュール):            定数<8>.            (line  246)
* pformat() (pprint モジュール):         関数<4>.            (line   70)
* pformat() (pprint.PrettyPrinter のメソッド): PrettyPrinter objects.
                                                             (line   74)
* 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   34)
* 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  166)
* pidfd_getfd() (os モジュール):         プロセス管理.       (line  392)
* PIDFD_NONBLOCK (os モジュール):        プロセス管理.       (line  380)
* pidfd_open() (os モジュール):          プロセス管理.       (line  367)
* pidfd_send_signal() (signal モジュール): モジュールの内容<4>.
                                                             (line  357)
* PIP_USER:                              Windows<50>.        (line  102)
* PIPE (subprocess モジュール):          Using the subprocess Module.
                                                             (line  150)
* PIPE_BUF (select モジュール):          select --- I/O 完了の待機.
                                                             (line  175)
* 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  488)
* pipe2() (os モジュール):               ファイル記述子の操作.
                                                             (line  498)
* Placeholder (functools モジュール):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  325)
* placeholder (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  272)
* platform (in module sys):              プロセスワイドのパラメータ.
                                                             (line   45)
* platform (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1545)
* platform コマンドラインオプション; -nonaliased: コマンドラインでの使用<3>.
                                                             (line   19)
* platform コマンドラインオプション; -terse: コマンドラインでの使用<3>.
                                                             (line   13)
* platform() (platform モジュール):      Cross platform.     (line   47)
* platlibdir (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1617)
* PlaySound() (winsound モジュール):     関数<15>.           (line   14)
* plist;ファイル:                        plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line    8)
* plock() (os モジュール):               プロセス管理.       (line  407)
* PLUS (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  224)
* plus() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  446)
* PLUSEQUAL (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  290)
* pm() (pdb モジュール):                 コマンドライン・インターフェース<8>.
                                                             (line  150)
* pointer_bits (sys.abi_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line   29)
* POINTER() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  192)
* pointer() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  205)
* 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   95)
* 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  632)
* 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  254)
* pop() (collections.deque のメソッド):  deque オブジェクト. (line   87)
* pop() (dict のメソッド):               Mapping types --- dict frozendict.
                                                             (line  195)
* pop() (mailbox.Mailbox のメソッド):    Mailbox オブジェクト.
                                                             (line  221)
* 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  415)
* popen() (os モジュール) <2>:           select --- I/O 完了の待機.
                                                             (line  152)
* popitem() (collections.OrderedDict のメソッド): OrderedDict オブジェクト.
                                                             (line   70)
* popitem() (collections.UserDict のメソッド): UserDict オブジェクト.
                                                             (line   33)
* popitem() (dict のメソッド):           Mapping types --- dict frozendict.
                                                             (line  204)
* popitem() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  229)
* popleft() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   93)
* port (http.cookiejar.Cookie の属性):   Cookieオブジェクト<2>.
                                                             (line   35)
* port_specified (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   81)
* portion:                               用語集<2>.          (line 1427)
* pos (json.JSONDecodeError の属性):     例外<21>.           (line   18)
* pos (re.Match の属性):                 Match objects.      (line  173)
* pos (re.PatternError の属性):          例外<3>.            (line   23)
* pos (tomllib.TOMLDecodeError の属性):  tomllib --- TOML ファイルの解析.
                                                             (line   81)
* pos() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  150)
* pos() (turtle モジュール):             Turtle の状態を知る.
                                                             (line    6)
* position (xml.etree.ElementTree.ParseError の属性): 例外<23>.
                                                             (line   18)
* position() (turtle モジュール):        Turtle の状態を知る.
                                                             (line    6)
* Positions (dis のクラス):              Python バイトコード命令.
                                                             (line  110)
* positions (inspect.FrameInfo の属性):  インタープリタスタック.
                                                             (line   41)
* positions (inspect.Traceback の属性):  インタープリタスタック.
                                                             (line   81)
* Positions.col_offset (dis モジュール): Python バイトコード命令.
                                                             (line  119)
* Positions.end_col_offset (dis モジュール): Python バイトコード命令.
                                                             (line  121)
* Positions.end_lineno (dis モジュール): Python バイトコード命令.
                                                             (line  117)
* Positions.lineno (dis モジュール):     Python バイトコード命令.
                                                             (line  115)
* POSIX Shared Memory:                   multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line   10)
* POSIX_FADV_DONTNEED (os モジュール):   ファイル記述子の操作.
                                                             (line  532)
* POSIX_FADV_NOREUSE (os モジュール):    ファイル記述子の操作.
                                                             (line  532)
* POSIX_FADV_NORMAL (os モジュール):     ファイル記述子の操作.
                                                             (line  532)
* POSIX_FADV_RANDOM (os モジュール):     ファイル記述子の操作.
                                                             (line  532)
* POSIX_FADV_SEQUENTIAL (os モジュール): ファイル記述子の操作.
                                                             (line  532)
* POSIX_FADV_WILLNEED (os モジュール):   ファイル記述子の操作.
                                                             (line  532)
* posix_fadvise() (os モジュール):       ファイル記述子の操作.
                                                             (line  518)
* posix_fallocate() (os モジュール):     ファイル記述子の操作.
                                                             (line  509)
* posix_openpt() (os モジュール):        ファイル記述子の操作.
                                                             (line  558)
* POSIX_SPAWN_CLOSE (os モジュール):     プロセス管理.       (line  484)
* POSIX_SPAWN_CLOSEFROM (os モジュール): プロセス管理.       (line  496)
* POSIX_SPAWN_DUP2 (os モジュール):      プロセス管理.       (line  490)
* POSIX_SPAWN_OPEN (os モジュール):      プロセス管理.       (line  478)
* posix_spawn() (os モジュール):         プロセス管理.       (line  454)
* posix_spawnp() (os モジュール):        プロセス管理.       (line  557)
* POSIX;I/O control:                     termios --- POSIX スタイルの端末制御.
                                                             (line    6)
* PosixPath (pathlib のクラス):          具象パス.           (line   21)
* post_handshake_auth (ssl.SSLContext の属性): SSL contexts. (line  662)
* post_mortem() (pdb モジュール):        コマンドライン・インターフェース<8>.
                                                             (line  140)
* post_setup() (venv.EnvBuilder のメソッド): API<2>.         (line  176)
* postcmd() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line  102)
* postloop() (cmd.Cmd のメソッド):       Cmdオブジェクト.    (line  118)
* 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   62)
* pprint() (pprint.PrettyPrinter のメソッド): PrettyPrinter objects.
                                                             (line   80)
* prcal() (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  405)
* pread() (os モジュール):               ファイル記述子の操作.
                                                             (line  546)
* preadv() (os モジュール):              ファイル記述子の操作.
                                                             (line  576)
* 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 1642)
* prefix (xml.dom.Attr の属性):          Attr オブジェクト.  (line   18)
* prefix (xml.dom.Node の属性):          Node オブジェクト.  (line   68)
* prefix (zipimport.zipimporter の属性): zipimporter オブジェクト.
                                                             (line   91)
* PREFIXES (site モジュール):            モジュールの内容<7>.
                                                             (line    6)
* prefixlen (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  132)
* prefixlen (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  331)
* prefixmatch() (re モジュール):         関数<2>.            (line   47)
* prefixmatch() (re.Pattern のメソッド): Regular expression objects.
                                                             (line   41)
* 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 objects.
                                                             (line    6)
* prev() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  231)
* previousSibling (xml.dom.Node の属性): Node オブジェクト.  (line   32)
* print_call_graph() (asyncio モジュール): Call Graph Introspection.
                                                             (line   17)
* print_callees() (pstats.Stats のメソッド): The Stats class.
                                                             (line  173)
* print_callers() (pstats.Stats のメソッド): The Stats class.
                                                             (line  158)
* print_exc() (timeit.Timer のメソッド): Python interface.   (line  129)
* 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   99)
* print_stack() (asyncio.Task のメソッド): Task object.      (line  143)
* print_stack() (traceback モジュール):  モジュールレベルの関数<2>.
                                                             (line   68)
* print_stats() (profile.Profile のメソッド): profile and profiling tracing module reference.
                                                             (line   96)
* print_stats() (profiling.tracing.Profile のメソッド): Module reference.
                                                             (line   66)
* print_stats() (pstats.Stats のメソッド): The Stats class.  (line  134)
* print_tb() (traceback モジュール):     モジュールレベルの関数<2>.
                                                             (line    6)
* print_usage() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   10)
* print_usage() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line   15)
* print_version() (optparse.OptionParser のメソッド): バージョン番号の出力.
                                                             (line   25)
* print_warning() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  437)
* print() (traceback.TracebackException のメソッド): TracebackException オブジェクト.
                                                             (line  133)
* print() (組み込み関数);__str__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  128)
* printable (string モジュール):         文字列定数.         (line   40)
* printdir() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  245)
* printf 形式の書式化:                   printf 形式の文字列書式化.
                                                             (line    6)
* printf 形式の書式化 <1>:               printf 形式での bytes の書式化.
                                                             (line    6)
* PRIO_DARWIN_BG (os モジュール):        プロセスのパラメーター.
                                                             (line  321)
* PRIO_DARWIN_NONUI (os モジュール):     プロセスのパラメーター.
                                                             (line  321)
* PRIO_DARWIN_PROCESS (os モジュール):   プロセスのパラメーター.
                                                             (line  321)
* PRIO_DARWIN_THREAD (os モジュール):    プロセスのパラメーター.
                                                             (line  321)
* PRIO_PGRP (os モジュール):             プロセスのパラメーター.
                                                             (line  310)
* PRIO_PROCESS (os モジュール):          プロセスのパラメーター.
                                                             (line  310)
* PRIO_USER (os モジュール):             プロセスのパラメーター.
                                                             (line  310)
* PriorityQueue (asyncio のクラス):      優先度付きのキュー. (line    6)
* PriorityQueue (queue のクラス):        queue --- 同期キュークラス.
                                                             (line   46)
* prlimit() (resource モジュール):       リソースの制限.     (line   70)
* prmonth() (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  395)
* prmonth() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  200)
* 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  269)
* process_time() (time モジュール):      関数<5>.            (line  257)
* process_tokens() (tabnanny モジュール): tabnanny --- あいまいなインデントの検出.
                                                             (line   43)
* process;id:                            プロセスのパラメーター.
                                                             (line  279)
* process;kill:                          プロセス管理.       (line  331)
* process;kill <1>:                      プロセス管理.       (line  353)
* process;グループ:                      プロセスのパラメーター.
                                                             (line  214)
* process;グループ <1>:                  プロセスのパラメーター.
                                                             (line  273)
* process;シグナル:                      プロセス管理.       (line  331)
* process;シグナル <1>:                  プロセス管理.       (line  353)
* process;スケジューリング優先度:        プロセスのパラメーター.
                                                             (line  297)
* process;スケジューリング優先度 <1>:    プロセスのパラメーター.
                                                             (line  486)
* process;親の ID:                       プロセスのパラメーター.
                                                             (line  286)
* process() (logging.LoggerAdapter のメソッド): LoggerAdapter オブジェクト.
                                                             (line   21)
* ProcessError:                          Process クラスと例外.
                                                             (line  279)
* processes, light-weight:               _thread --- 低水準なスレッド API.
                                                             (line    6)
* ProcessingInstruction() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line  184)
* processingInstruction() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  156)
* ProcessingInstructionHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  395)
* 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 profiling tracing module reference.
                                                             (line   34)
* Profile (profiling.tracing のクラス):  Module reference.   (line   35)
* profile function:                      リファレンス<2>.    (line  137)
* profile function <1>:                  リファレンス<2>.    (line  153)
* profile function <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1025)
* profile function <3>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1753)
* PROFILE_TASK:                          ビルド<23>.         (line   13)
* PROFILE_TASK <1>:                      パフォーマンスに関するオプション.
                                                             (line   12)
* profiler:                              sys --- システム固有のパラメーターと関数.
                                                             (line 1025)
* profiler <1>:                          sys --- システム固有のパラメーターと関数.
                                                             (line 1753)
* profiling, deterministic:              profiling --- Python profilers.
                                                             (line   12)
* profiling, statistical:                profiling --- Python profilers.
                                                             (line   12)
* profiling.sampling コマンドラインオプション; -a: Dump options.
                                                             (line    8)
* profiling.sampling コマンドラインオプション; -a <1>: Sampling options.
                                                             (line   15)
* profiling.sampling コマンドラインオプション; -all-threads: Dump options.
                                                             (line    8)
* profiling.sampling コマンドラインオプション; -all-threads <1>: Sampling options.
                                                             (line   15)
* profiling.sampling コマンドラインオプション; -async-aware: Dump options.
                                                             (line   25)
* profiling.sampling コマンドラインオプション; -async-aware <1>: Sampling options.
                                                             (line   31)
* profiling.sampling コマンドラインオプション; -async-mode: Dump options.
                                                             (line   30)
* profiling.sampling コマンドラインオプション; -async-mode <1>: Mode options.
                                                             (line   12)
* profiling.sampling コマンドラインオプション; -binary: Output options.
                                                             (line   33)
* profiling.sampling コマンドラインオプション; -blocking: Dump options.
                                                             (line   36)
* profiling.sampling コマンドラインオプション; -blocking <1>: Sampling options.
                                                             (line   47)
* profiling.sampling コマンドラインオプション; -browser: Output options.
                                                             (line   51)
* profiling.sampling コマンドラインオプション; -collapsed: Output options.
                                                             (line   12)
* profiling.sampling コマンドラインオプション; -compression: Output options.
                                                             (line   38)
* profiling.sampling コマンドラインオプション; -d: Sampling options.
                                                             (line   11)
* profiling.sampling コマンドラインオプション; -diff-flamegraph: Output options.
                                                             (line   20)
* profiling.sampling コマンドラインオプション; -duration: Sampling options.
                                                             (line   11)
* profiling.sampling コマンドラインオプション; -flamegraph: Output options.
                                                             (line   16)
* profiling.sampling コマンドラインオプション; -gecko: Output options.
                                                             (line   25)
* profiling.sampling コマンドラインオプション; -heatmap: Output options.
                                                             (line   29)
* profiling.sampling コマンドラインオプション; -l: pstats display options.
                                                             (line   13)
* profiling.sampling コマンドラインオプション; -limit: pstats display options.
                                                             (line   13)
* profiling.sampling コマンドラインオプション; -live: Run command options.
                                                             (line   10)
* profiling.sampling コマンドラインオプション; -m: Run command options.
                                                             (line    6)
* profiling.sampling コマンドラインオプション; -mode: Mode options.
                                                             (line    6)
* profiling.sampling コマンドラインオプション; -module: Run command options.
                                                             (line    6)
* profiling.sampling コマンドラインオプション; -native: Dump options.
                                                             (line   13)
* profiling.sampling コマンドラインオプション; -native <1>: Sampling options.
                                                             (line   23)
* profiling.sampling コマンドラインオプション; -no-gc: Dump options.
                                                             (line   17)
* profiling.sampling コマンドラインオプション; -no-gc <1>: Sampling options.
                                                             (line   27)
* profiling.sampling コマンドラインオプション; -no-summary: pstats display options.
                                                             (line   17)
* profiling.sampling コマンドラインオプション; -o: Output options.
                                                             (line   43)
* profiling.sampling コマンドラインオプション; -opcodes: Dump options.
                                                             (line   21)
* profiling.sampling コマンドラインオプション; -opcodes <1>: Sampling options.
                                                             (line   35)
* profiling.sampling コマンドラインオプション; -output: Output options.
                                                             (line   43)
* profiling.sampling コマンドラインオプション; -pstats: Output options.
                                                             (line    6)
* profiling.sampling コマンドラインオプション; -r: Sampling options.
                                                             (line    6)
* profiling.sampling コマンドラインオプション; -realtime-stats: Sampling options.
                                                             (line   19)
* profiling.sampling コマンドラインオプション; -sampling-rate: Sampling options.
                                                             (line    6)
* profiling.sampling コマンドラインオプション; -sort: pstats display options.
                                                             (line    8)
* profiling.sampling コマンドラインオプション; -subprocesses: Sampling options.
                                                             (line   42)
* profiling.sampling コマンドラインオプション; attach: Global options.
                                                             (line   10)
* profiling.sampling コマンドラインオプション; dump: Global options.
                                                             (line   14)
* profiling.sampling コマンドラインオプション; replay: Global options.
                                                             (line   19)
* profiling.sampling コマンドラインオプション; run: Global options.
                                                             (line    6)
* profiling.tracing コマンドラインオプション; -m: Command-line interface.
                                                             (line   27)
* profiling.tracing コマンドラインオプション; -o: Command-line interface.
                                                             (line   14)
* profiling.tracing コマンドラインオプション; -s: Command-line interface.
                                                             (line   20)
* ProgrammingError:                      例外<8>.            (line   75)
* Progressbar (tkinter.ttk のクラス):    ttk Progressbar.    (line    6)
* prompt (cmd.Cmd の属性):               Cmdオブジェクト.    (line  127)
* prompts, interpreter:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1666)
* propagate (logging.Logger の属性):     ロガーオブジェクト. (line   50)
* property (組み込みクラス):             組み込み関数.       (line 1573)
* 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  104)
* prot_p() (ftplib.FTP_TLS のメソッド):  FTP_TLS オブジェクト.
                                                             (line  100)
* proto (socket.socket の属性):          socket オブジェクト.
                                                             (line  624)
* Protocol (asyncio のクラス):           基底プロトコル.     (line   11)
* protocol (ssl.SSLContext の属性):      SSL contexts.       (line  681)
* Protocol (typing のクラス):            Other special directives.
                                                             (line  123)
* 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  489)
* ProtocolError (xmlrpc.client のクラス): ProtocolError オブジェクト.
                                                             (line    6)
* provisional API:                       用語集<2>.          (line 1437)
* provisional package:                   用語集<2>.          (line 1454)
* proxy() (weakref モジュール):          weakref --- Weak references.
                                                             (line  128)
* proxyauth() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  285)
* ProxyBasicAuthHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  417)
* ProxyDigestAuthHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  452)
* ProxyHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  345)
* ProxyType (weakref モジュール):        weakref --- Weak references.
                                                             (line  326)
* ProxyTypes (weakref モジュール):       weakref --- Weak references.
                                                             (line  334)
* prweek() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  149)
* pryear() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  214)
* ps1 (sys モジュール):                  sys --- システム固有のパラメーターと関数.
                                                             (line 1663)
* ps2 (sys モジュール):                  sys --- システム固有のパラメーターと関数.
                                                             (line 1663)
* pstdev() (statistics モジュール):      関数の詳細.         (line  362)
* pthread_getcpuclockid() (time モジュール): 関数<5>.        (line   21)
* pthread_kill() (signal モジュール):    モジュールの内容<4>.
                                                             (line  372)
* pthread_sigmask() (signal モジュール): モジュールの内容<4>.
                                                             (line  402)
* pthreads:                              _thread --- 低水準なスレッド API.
                                                             (line   15)
* pthreads (sys._emscripten_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  393)
* ptsname() (os モジュール):             ファイル記述子の操作.
                                                             (line  654)
* 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  299)
* Purpose.CLIENT_AUTH (ssl モジュール):  定数<9>.            (line  554)
* Purpose.SERVER_AUTH (ssl モジュール):  定数<9>.            (line  545)
* push_async_callback() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  689)
* push_async_exit() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  681)
* 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  598)
* 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)
* putch() (msvcrt モジュール):           コンソール I/O 関連.
                                                             (line   34)
* putenv() (os モジュール):              プロセスのパラメーター.
                                                             (line  370)
* putheader() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  191)
* putp() (curses モジュール):            関数<6>.            (line  397)
* putrequest() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  181)
* putwch() (msvcrt モジュール):          コンソール I/O 関連.
                                                             (line   39)
* putwin() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  451)
* pvariance() (statistics モジュール):   関数の詳細.         (line  370)
* pwd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  342)
* pwrite() (os モジュール):              ファイル記述子の操作.
                                                             (line  668)
* pwritev() (os モジュール):             ファイル記述子の操作.
                                                             (line  679)
* 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  194)
* 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   59)
* Py_BEGIN_CRITICAL_SECTION_MUTEX (C macro): Python critical section API.
                                                             (line   75)
* Py_BEGIN_CRITICAL_SECTION2 (C macro):  Python critical section API.
                                                             (line  107)
* Py_BEGIN_CRITICAL_SECTION2_MUTEX (C macro): Python critical section API.
                                                             (line  123)
* Py_bf_getbuffer (C macro):             バッファオブジェクト構造体 buffer object structure.
                                                             (line   17)
* Py_bf_releasebuffer (C macro):         バッファオブジェクト構造体 buffer object structure.
                                                             (line   92)
* 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  131)
* 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):                   複素数オブジェクト. (line   72)
* Py_complex.imag (C member):            複素数オブジェクト. (line   77)
* Py_complex.real (C member):            複素数オブジェクト. (line   77)
* 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_CORE_EXE_LDFLAGS:                   Linker flags.       (line   95)
* PY_CORE_LDFLAGS:                       Linker flags.       (line   96)
* PY_CXX_CONST (C macro):                API 関数.           (line  133)
* 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   93)
* Py_END_CRITICAL_SECTION2 (C macro):    Python critical section API.
                                                             (line  142)
* Py_EndInterpreter (C function):        Multiple interpreters in a Python process.
                                                             (line  205)
* Py_EnterRecursiveCall (C function):    再帰の管理.         (line   13)
* Py_EQ (C macro):                       PyTypeObject スロット.
                                                             (line 1259)
* 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   90)
* 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  126)
* 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   69)
* 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_FORMAT_SIZE_T (C macro):            Outdated macros.    (line   18)
* 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 1268)
* 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   77)
* Py_GetCompiler (C function):           プロセスワイドのパラメータ.
                                                             (line   66)
* Py_GetConstant (C function):           オブジェクトプロトコル object protocol.
                                                             (line    6)
* Py_GetConstantBorrowed (C function):   オブジェクトプロトコル object protocol.
                                                             (line   57)
* Py_GetCopyright (C function):          プロセスワイドのパラメータ.
                                                             (line   56)
* Py_GETENV (C macro):                   便利なマクロ.       (line   23)
* Py_GetPlatform (C function):           プロセスワイドのパラメータ.
                                                             (line   44)
* Py_GetRecursionLimit (C function):     再帰の管理.         (line   71)
* Py_GetVersion (C function):            プロセスワイドのパラメータ.
                                                             (line   30)
* Py_GIL_DISABLED (C macro):             一般的なオプション. (line  246)
* Py_GT (C macro):                       PyTypeObject スロット.
                                                             (line 1265)
* 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   51)
* Py_hexdigits (C var):                  Codec utility variables.
                                                             (line    6)
* Py_HUGE_VAL (C macro):                 Floating-Point Objects.
                                                             (line   85)
* 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_INT32_T (C macro):                  Outdated macros.    (line   39)
* PY_INT64_T (C macro):                  Outdated macros.    (line   39)
* 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  123)
* Py_IS_FINITE (C macro):                Floating-Point Objects.
                                                             (line  137)
* Py_IS_INFINITY (C macro):              Floating-Point Objects.
                                                             (line  146)
* Py_IS_NAN (C macro):                   Floating-Point Objects.
                                                             (line  154)
* Py_IS_TYPE (C function):               Base object types and macros.
                                                             (line  162)
* 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  144)
* Py_IsFinalizing (C function):          インタープリタの初期化と終了処理<2>.
                                                             (line   62)
* Py_IsInitialized (C function):         Python の埋め込み<2>.
                                                             (line   45)
* 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  130)
* 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  137)
* 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 1256)
* Py_LeaveRecursiveCall (C function):    再帰の管理.         (line   34)
* Py_LegacyWindowsFSEncodingFlag (C var): グローバルな設定変数.
                                                             (line  138)
* Py_LegacyWindowsStdioFlag (C var):     グローバルな設定変数.
                                                             (line  158)
* Py_LIMITED_API (C macro):              Compiling for Stable ABI.
                                                             (line   44)
* Py_LL (C macro):                       Outdated macros.    (line   25)
* PY_LLONG_MAX (C macro):                Outdated macros.    (line   51)
* PY_LLONG_MIN (C macro):                Outdated macros.    (line   51)
* Py_LOCAL (C macro):                    Declaration utilities.
                                                             (line   65)
* Py_LOCAL_INLINE (C macro):             Declaration utilities.
                                                             (line   71)
* Py_LOCAL_SYMBOL (C macro):             Declaration utilities.
                                                             (line   76)
* PY_LOCK_ACQUIRED (C enumerator):       Legacy locking APIs.
                                                             (line   24)
* PY_LOCK_FAILURE (C enumerator):        Legacy locking APIs.
                                                             (line   20)
* PY_LOCK_INTR (C enumerator):           Legacy locking APIs.
                                                             (line   28)
* PY_LONG_LONG (C macro):                Outdated macros.    (line   39)
* Py_LT (C macro):                       PyTypeObject スロット.
                                                             (line 1253)
* Py_Main (C function):                  インタープリタの初期化と終了処理<2>.
                                                             (line  139)
* 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   91)
* Py_MATH_El (C macro):                  Floating-Point Objects.
                                                             (line   96)
* Py_MATH_PI (C macro):                  Floating-Point Objects.
                                                             (line  102)
* Py_MATH_PIl (C macro):                 Floating-Point Objects.
                                                             (line  107)
* Py_MATH_TAU (C macro):                 Floating-Point Objects.
                                                             (line  114)
* 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   64)
* 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_abi (C macro):                  Feature slots.      (line    6)
* Py_mod_create (C macro):               Creation and initialization slots.
                                                             (line    6)
* Py_mod_doc (C macro):                  Metadata slots.     (line   19)
* Py_mod_exec (C macro):                 Creation and initialization slots.
                                                             (line   58)
* Py_mod_gil (C macro):                  Feature slots.      (line   57)
* Py_MOD_GIL_NOT_USED (C macro):         Feature slots.      (line   67)
* Py_MOD_GIL_USED (C macro):             Feature slots.      (line   61)
* Py_mod_methods (C macro):              Creation and initialization slots.
                                                             (line   81)
* Py_mod_multiple_interpreters (C macro): Feature slots.     (line   29)
* Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED (C macro): Feature slots.
                                                             (line   33)
* Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED (C macro): Feature slots.
                                                             (line   37)
* Py_mod_name (C macro):                 Metadata slots.     (line    6)
* Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (C macro): Feature slots.
                                                             (line   43)
* Py_mod_slots (C macro):                Module definition struct.
                                                             (line  145)
* Py_mod_state_clear (C macro):          Slots for defining module state.
                                                             (line   47)
* Py_mod_state_free (C macro):           Slots for defining module state.
                                                             (line   73)
* Py_mod_state_size (C macro):           Slots for defining module state.
                                                             (line    9)
* Py_mod_state_traverse (C macro):       Slots for defining module state.
                                                             (line   25)
* Py_mod_token (C macro):                Module token.       (line   38)
* 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   77)
* 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 1262)
* 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  269)
* 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_LEVEL_ALPHA (C macro):      Build-time version constants.
                                                             (line   30)
* PY_RELEASE_LEVEL_BETA (C macro):       Build-time version constants.
                                                             (line   30)
* PY_RELEASE_LEVEL_FINAL (C macro):      Build-time version constants.
                                                             (line   30)
* PY_RELEASE_LEVEL_GAMMA (C macro):      Build-time version constants.
                                                             (line   30)
* PY_RELEASE_SERIAL (C macro):           Build-time version constants.
                                                             (line   35)
* Py_REMOTE_DEBUG (C macro):             パフォーマンスに関するオプション.
                                                             (line  223)
* 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  128)
* Py_RETURN_NAN (C macro):               Floating-Point Objects.
                                                             (line  121)
* Py_RETURN_NONE (C macro):              None オブジェクト.  (line   19)
* Py_RETURN_NOTIMPLEMENTED (C macro):    オブジェクトプロトコル object protocol.
                                                             (line   76)
* Py_RETURN_RICHCOMPARE (C macro):       PyTypeObject スロット.
                                                             (line 1274)
* Py_RETURN_TRUE (C macro):              Boolean オブジェクト.
                                                             (line   41)
* Py_RunMain (C function):               インタープリタの初期化と終了処理<2>.
                                                             (line  187)
* 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  195)
* Py_SET_TYPE (C function):              Base object types and macros.
                                                             (line  169)
* Py_SetProgramName (C function):        プロセスワイドのパラメータ.
                                                             (line    6)
* Py_SetPythonHome (C function):         プロセスワイドのパラメータ.
                                                             (line  160)
* 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  187)
* PY_SIZE_MAX (C macro):                 Outdated macros.    (line   51)
* Py_slot_end (C macro):                 Common slot IDs.    (line    8)
* Py_slot_invalid (C macro):             Common slot IDs.    (line   29)
* Py_slot_subslots (C macro):            Common slot IDs.    (line   14)
* 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_TARGET_ABI3T (C macro):             Compiling for Stable ABI.
                                                             (line   49)
* 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 1637)
* Py_tp_base (C macro):                  PyTypeObject スロット.
                                                             (line 1446)
* Py_tp_bases (C macro):                 PyTypeObject スロット.
                                                             (line 1771)
* Py_tp_basicsize (C macro):             Type slot IDs.      (line  109)
* Py_tp_call (C macro):                  PyTypeObject スロット.
                                                             (line  502)
* Py_tp_clear (C macro):                 PyTypeObject スロット.
                                                             (line 1073)
* Py_tp_dealloc (C macro):               PyTypeObject スロット.
                                                             (line  145)
* Py_tp_del (C macro):                   PyTypeObject スロット.
                                                             (line 1849)
* Py_tp_descr_get (C macro):             PyTypeObject スロット.
                                                             (line 1519)
* Py_tp_descr_set (C macro):             PyTypeObject スロット.
                                                             (line 1535)
* Py_tp_doc (C macro):                   PyTypeObject スロット.
                                                             (line 1037)
* Py_tp_extra_basicsize (C macro):       Type slot IDs.      (line  126)
* Py_tp_finalize (C macro):              PyTypeObject スロット.
                                                             (line 1867)
* Py_tp_flags (C macro):                 Type slot IDs.      (line  186)
* Py_tp_free (C macro):                  PyTypeObject スロット.
                                                             (line 1704)
* Py_tp_getattr (C macro):               PyTypeObject スロット.
                                                             (line  331)
* Py_tp_getattro (C macro):              PyTypeObject スロット.
                                                             (line  549)
* Py_tp_getset (C macro):                PyTypeObject スロット.
                                                             (line 1428)
* Py_tp_hash (C macro):                  PyTypeObject スロット.
                                                             (line  458)
* Py_tp_init (C macro):                  PyTypeObject スロット.
                                                             (line 1598)
* Py_tp_is_gc (C macro):                 PyTypeObject スロット.
                                                             (line 1737)
* Py_tp_itemsize (C macro):              Type slot IDs.      (line  153)
* Py_tp_iter (C macro):                  PyTypeObject スロット.
                                                             (line 1345)
* Py_tp_iternext (C macro):              PyTypeObject スロット.
                                                             (line 1365)
* Py_tp_members (C macro):               PyTypeObject スロット.
                                                             (line 1410)
* Py_tp_metaclass (C macro):             Type slot IDs.      (line  205)
* Py_tp_methods (C macro):               PyTypeObject スロット.
                                                             (line 1392)
* Py_tp_module (C macro):                Type slot IDs.      (line  224)
* Py_tp_name (C macro):                  Type slot IDs.      (line   91)
* Py_tp_new (C macro):                   PyTypeObject スロット.
                                                             (line 1662)
* Py_tp_repr (C macro):                  PyTypeObject スロット.
                                                             (line  392)
* Py_tp_richcompare (C macro):           PyTypeObject スロット.
                                                             (line 1231)
* Py_tp_setattr (C macro):               PyTypeObject スロット.
                                                             (line  353)
* Py_tp_setattro (C macro):              PyTypeObject スロット.
                                                             (line  579)
* Py_tp_slots (C macro):                 Type slot IDs.      (line  283)
* Py_tp_str (C macro):                   PyTypeObject スロット.
                                                             (line  518)
* Py_tp_token (C macro):                 Type slot IDs.      (line  243)
* Py_tp_traverse (C macro):              PyTypeObject スロット.
                                                             (line 1051)
* Py_TP_USE_SPEC (C macro):              Type slot IDs.      (line  273)
* Py_tp_vectorcall (C macro):            PyTypeObject スロット.
                                                             (line 2037)
* Py_TPFLAGS_BASE_EXC_SUBCLASS (C macro): PyTypeObject スロット.
                                                             (line  845)
* Py_TPFLAGS_BASETYPE (C macro):         PyTypeObject スロット.
                                                             (line  680)
* Py_TPFLAGS_BYTES_SUBCLASS (C macro):   PyTypeObject スロット.
                                                             (line  839)
* Py_TPFLAGS_DEFAULT (C macro):          PyTypeObject スロット.
                                                             (line  729)
* Py_TPFLAGS_DICT_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  843)
* Py_TPFLAGS_DISALLOW_INSTANTIATION (C macro): PyTypeObject スロット.
                                                             (line  905)
* Py_TPFLAGS_HAVE_FINALIZE (C macro):    PyTypeObject スロット.
                                                             (line  858)
* Py_TPFLAGS_HAVE_GC (C macro):          PyTypeObject スロット.
                                                             (line  708)
* Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (C macro): PyTypeObject スロット.
                                                             (line 1025)
* Py_TPFLAGS_HAVE_VECTORCALL (C macro):  PyTypeObject スロット.
                                                             (line  869)
* Py_TPFLAGS_HAVE_VERSION_TAG (C macro): PyTypeObject スロット.
                                                             (line  989)
* Py_TPFLAGS_HEAPTYPE (C macro):         PyTypeObject スロット.
                                                             (line  662)
* Py_TPFLAGS_IMMUTABLETYPE (C macro):    PyTypeObject スロット.
                                                             (line  891)
* Py_TPFLAGS_INLINE_VALUES (C macro):    PyTypeObject スロット.
                                                             (line  997)
* Py_TPFLAGS_IS_ABSTRACT (C macro):      PyTypeObject スロット.
                                                             (line 1011)
* Py_TPFLAGS_ITEMS_AT_END (C macro):     PyTypeObject スロット.
                                                             (line  813)
* Py_TPFLAGS_LIST_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  835)
* Py_TPFLAGS_LONG_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  833)
* Py_TPFLAGS_MANAGED_DICT (C macro):     PyTypeObject スロット.
                                                             (line  765)
* Py_TPFLAGS_MANAGED_WEAKREF (C macro):  PyTypeObject スロット.
                                                             (line  785)
* Py_TPFLAGS_MAPPING (C macro):          PyTypeObject スロット.
                                                             (line  933)
* Py_TPFLAGS_METHOD_DESCRIPTOR (C macro): PyTypeObject スロット.
                                                             (line  740)
* Py_TPFLAGS_PREHEADER (C macro):        PyTypeObject スロット.
                                                             (line  800)
* Py_TPFLAGS_READY (C macro):            PyTypeObject スロット.
                                                             (line  690)
* Py_TPFLAGS_READYING (C macro):         PyTypeObject スロット.
                                                             (line  699)
* Py_TPFLAGS_SEQUENCE (C macro):         PyTypeObject スロット.
                                                             (line  957)
* Py_TPFLAGS_TUPLE_SUBCLASS (C macro):   PyTypeObject スロット.
                                                             (line  837)
* Py_TPFLAGS_TYPE_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  847)
* Py_TPFLAGS_UNICODE_SUBCLASS (C macro): PyTypeObject スロット.
                                                             (line  841)
* Py_TPFLAGS_VALID_VERSION_TAG (C macro): PyTypeObject スロット.
                                                             (line  981)
* 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  151)
* 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_UINT32_T (C macro):                 Outdated macros.    (line   39)
* PY_UINT64_T (C macro):                 Outdated macros.    (line   39)
* Py_ULL (C macro):                      Outdated macros.    (line   25)
* PY_ULLONG_MAX (C macro):               Outdated macros.    (line   51)
* 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_SIZE (C macro):             Outdated macros.    (line   71)
* 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_UNICODE_WIDE (C macro):             Outdated macros.    (line   81)
* 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   88)
* 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 macro):                  Build-time version constants.
                                                             (line   47)
* Py_Version (C var):                    Run-time version.   (line    6)
* PY_VERSION_HEX (C macro):              Build-time version constants.
                                                             (line   39)
* Py_VISIT (C macro):                    Traversal.          (line  111)
* Py_XDECREF (C function):               例外<25>.           (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)
* PyABIInfo (C type):                    ABI Checking.       (line   67)
* PyABIInfo_Check (C function):          ABI Checking.       (line   31)
* PyABIInfo_DEFAULT_ABI_VERSION (C macro): ABI Checking.     (line  153)
* PyABIInfo_DEFAULT_FLAGS (C macro):     ABI Checking.       (line   88)
* PyABIInfo_FREETHREADED (C macro):      ABI Checking.       (line  110)
* PyABIInfo_FREETHREADING_AGNOSTIC (C macro): ABI Checking.  (line  123)
* PyABIInfo_GIL (C macro):               ABI Checking.       (line  117)
* PyABIInfo_INTERNAL (C macro):          ABI Checking.       (line  103)
* PyABIInfo_STABLE (C macro):            ABI Checking.       (line   99)
* PyABIInfo_VAR (C macro):               ABI Checking.       (line   52)
* PyABIInfo.abi_version (C member):      ABI Checking.       (line  139)
* PyABIInfo.abiinfo_major_version (C member): ABI Checking.  (line   69)
* PyABIInfo.abiinfo_minor_version (C member): ABI Checking.  (line   78)
* PyABIInfo.build_version (C member):    ABI Checking.       (line  129)
* PyABIInfo.flags (C member):            ABI Checking.       (line   84)
* PyAIter_Check (C function):            イテレータプロトコル iterator protocol.
                                                             (line   14)
* PyAnyDict_Check (C function):          Frozen dictionary objects.
                                                             (line   14)
* PyAnyDict_CheckExact (C function):     Frozen dictionary objects.
                                                             (line   20)
* 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_ParseArray (C function):         API 関数.           (line   72)
* PyArg_ParseArrayAndKeywords (C function): API 関数.        (line   82)
* PyArg_ParseTuple (C function):         C から Python 関数を呼び出す.
                                                             (line  150)
* PyArg_ParseTuple (C function) <1>:     API 関数.           (line    6)
* PyArg_ParseTupleAndKeywords (C function): 拡張モジュール関数のキーワードパラメタ.
                                                             (line   16)
* PyArg_ParseTupleAndKeywords (C function) <1>: API 関数.    (line   18)
* PyArg_UnpackTuple (C function):        API 関数.           (line   94)
* 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  119)
* 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   22)
* 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   88)
* 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  144)
* PyBytes_AsString (C function):         バイトオブジェクト<2>.
                                                             (line  132)
* PyBytes_AsStringAndSize (C function):  バイトオブジェクト<2>.
                                                             (line  149)
* PyBytes_Check (C function):            バイトオブジェクト<2>.
                                                             (line   20)
* PyBytes_CheckExact (C function):       バイトオブジェクト<2>.
                                                             (line   25)
* PyBytes_Concat (C function):           バイトオブジェクト<2>.
                                                             (line  172)
* PyBytes_ConcatAndDel (C function):     バイトオブジェクト<2>.
                                                             (line  185)
* PyBytes_DecodeEscape (C function):     バイトオブジェクト<2>.
                                                             (line  255)
* PyBytes_FromFormat (C function):       バイトオブジェクト<2>.
                                                             (line   49)
* PyBytes_FromFormatV (C function):      バイトオブジェクト<2>.
                                                             (line  107)
* PyBytes_FromObject (C function):       バイトオブジェクト<2>.
                                                             (line  113)
* PyBytes_FromString (C function):       バイトオブジェクト<2>.
                                                             (line   30)
* PyBytes_FromStringAndSize (C function): バイトオブジェクト<2>.
                                                             (line   37)
* PyBytes_GET_SIZE (C function):         バイトオブジェクト<2>.
                                                             (line  128)
* PyBytes_Join (C function):             バイトオブジェクト<2>.
                                                             (line  197)
* PyBytes_Repr (C function):             バイトオブジェクト<2>.
                                                             (line  235)
* PyBytes_Size (C function):             バイトオブジェクト<2>.
                                                             (line  123)
* PyBytes_Type (C var):                  バイトオブジェクト<2>.
                                                             (line   15)
* PyBytesIter_Type (C var):              Other Iterator Objects.
                                                             (line    9)
* PyBytesObject (C type):                バイトオブジェクト<2>.
                                                             (line   10)
* PyBytesWriter (C type):                PyBytesWriter.      (line   11)
* PyBytesWriter_Create (C function):     Create Finish Discard.
                                                             (line    6)
* PyBytesWriter_Discard (C function):    Create Finish Discard.
                                                             (line   53)
* PyBytesWriter_Finish (C function):     Create Finish Discard.
                                                             (line   20)
* PyBytesWriter_FinishWithPointer (C function): Create Finish Discard.
                                                             (line   39)
* PyBytesWriter_FinishWithSize (C function): Create Finish Discard.
                                                             (line   33)
* PyBytesWriter_Format (C function):     高レベルAPI.        (line   19)
* PyBytesWriter_GetData (C function):    Getters.            (line   13)
* PyBytesWriter_GetSize (C function):    Getters.            (line    6)
* PyBytesWriter_Grow (C function):       低レベルAPI.        (line   20)
* PyBytesWriter_GrowAndUpdatePointer (C function): 低レベルAPI.
                                                             (line   34)
* PyBytesWriter_Resize (C function):     低レベルAPI.        (line    6)
* PyBytesWriter_WriteBytes (C function): 高レベルAPI.        (line    6)
* pycache_prefix (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line  405)
* 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  273)
* PyCFunction_CheckExact (C function):   Implementing functions and methods.
                                                             (line  278)
* PyCFunction_GET_FLAGS (C function):    Implementing functions and methods.
                                                             (line  304)
* PyCFunction_GET_FUNCTION (C function): Implementing functions and methods.
                                                             (line  320)
* PyCFunction_GET_SELF (C function):     Implementing functions and methods.
                                                             (line  339)
* PyCFunction_GetFlags (C function):     Implementing functions and methods.
                                                             (line  294)
* PyCFunction_GetFunction (C function):  Implementing functions and methods.
                                                             (line  309)
* PyCFunction_GetSelf (C function):      Implementing functions and methods.
                                                             (line  325)
* PyCFunction_New (C function):          Implementing functions and methods.
                                                             (line  288)
* PyCFunction_NewEx (C function):        Implementing functions and methods.
                                                             (line  283)
* PyCFunction_Type (C var):              Implementing functions and methods.
                                                             (line  268)
* 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   28)
* PyClassMethod_Type (C var):            Built-in descriptors.
                                                             (line   16)
* PyClassMethodDescr_Type (C var):       Built-in descriptors.
                                                             (line   21)
* PyCMethod (C type):                    Implementing functions and methods.
                                                             (line   49)
* PyCMethod_Check (C function):          Implementing functions and methods.
                                                             (line  231)
* PyCMethod_CheckExact (C function):     Implementing functions and methods.
                                                             (line  236)
* PyCMethod_New (C function):            Implementing functions and methods.
                                                             (line  241)
* PyCMethod_Type (C var):                Implementing functions and methods.
                                                             (line  225)
* 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):     複素数オブジェクト. (line   93)
* PyComplex_Check (C function):          複素数オブジェクト. (line   26)
* PyComplex_CheckExact (C function):     複素数オブジェクト. (line   31)
* PyComplex_FromCComplex (C function):   複素数オブジェクト. (line   87)
* PyComplex_FromDoubles (C function):    複素数オブジェクト. (line   36)
* PyComplex_ImagAsDouble (C function):   複素数オブジェクト. (line   57)
* PyComplex_RealAsDouble (C function):   複素数オブジェクト. (line   42)
* PyComplex_Type (C var):                複素数オブジェクト. (line   21)
* PyComplexObject (C type):              複素数オブジェクト. (line    6)
* PyComplexObject.cval (C member):       複素数オブジェクト. (line   11)
* 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._init_main (C member):        Multi-Phase Initialization Private Provisional API.
                                                             (line   40)
* PyConfig._pystats (C member):          PyConfig.           (line 1018)
* 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  256)
* PyConfig.code_debug_ranges (C member): PyConfig.           (line  242)
* PyConfig.configure_c_stdio (C member): PyConfig.           (line  276)
* PyConfig.cpu_count (C member):         PyConfig.           (line  513)
* PyConfig.dev_mode (C member):          PyConfig.           (line  291)
* PyConfig.dump_refs (C member):         PyConfig.           (line  300)
* PyConfig.dump_refs_file (C member):    PyConfig.           (line  314)
* PyConfig.exec_prefix (C member):       PyConfig.           (line  325)
* PyConfig.executable (C member):        PyConfig.           (line  337)
* PyConfig.faulthandler (C member):      PyConfig.           (line  348)
* PyConfig.filesystem_encoding (C member): PyConfig.         (line  360)
* PyConfig.filesystem_errors (C member): PyConfig.           (line  393)
* PyConfig.hash_seed (C member):         PyConfig.           (line  425)
* PyConfig.home (C member):              PyConfig.           (line  440)
* PyConfig.import_time (C member):       PyConfig.           (line  451)
* PyConfig.inspect (C member):           PyConfig.           (line  464)
* PyConfig.install_signal_handlers (C member): PyConfig.     (line  479)
* PyConfig.int_max_str_digits (C member): PyConfig.          (line  493)
* PyConfig.interactive (C member):       PyConfig.           (line  485)
* PyConfig.isolated (C member):          PyConfig.           (line  527)
* PyConfig.legacy_windows_stdio (C member): PyConfig.        (line  552)
* PyConfig.malloc_stats (C member):      PyConfig.           (line  569)
* PyConfig.module_search_paths (C member): PyConfig.         (line  613)
* PyConfig.module_search_paths_set (C member): PyConfig.     (line  616)
* PyConfig.optimization_level (C member): PyConfig.          (line  630)
* PyConfig.orig_argv (C member):         PyConfig.           (line  646)
* PyConfig.parse_argv (C member):        PyConfig.           (line  663)
* PyConfig.parser_debug (C member):      PyConfig.           (line  683)
* PyConfig.pathconfig_warnings (C member): PyConfig.         (line  697)
* PyConfig.perf_profiling (C member):    PyConfig.           (line  890)
* PyConfig.platlibdir (C member):        PyConfig.           (line  582)
* PyConfig.prefix (C member):            PyConfig.           (line  709)
* PyConfig.program_name (C member):      PyConfig.           (line  720)
* PyConfig.pycache_prefix (C member):    PyConfig.           (line  741)
* PyConfig.pythonpath_env (C member):    PyConfig.           (line  602)
* PyConfig.quiet (C member):             PyConfig.           (line  754)
* PyConfig.run_command (C member):       PyConfig.           (line  763)
* PyConfig.run_filename (C member):      PyConfig.           (line  771)
* PyConfig.run_module (C member):        PyConfig.           (line  785)
* PyConfig.run_presite (C member):       PyConfig.           (line  793)
* PyConfig.safe_path (C member):         PyConfig.           (line  146)
* PyConfig.show_ref_count (C member):    PyConfig.           (line  807)
* PyConfig.site_import (C member):       PyConfig.           (line  819)
* PyConfig.skip_source_first_line (C member): PyConfig.      (line  838)
* PyConfig.stdio_encoding (C member):    PyConfig.           (line  850)
* PyConfig.stdio_errors (C member):      PyConfig.           (line  852)
* PyConfig.stdlib_dir (C member):        PyConfig.           (line  917)
* PyConfig.tracemalloc (C member):       PyConfig.           (line  879)
* PyConfig.use_environment (C member):   PyConfig.           (line  925)
* PyConfig.use_frozen_modules (C member): PyConfig.          (line  415)
* PyConfig.use_hash_seed (C member):     PyConfig.           (line  427)
* PyConfig.use_system_logger (C member): PyConfig.           (line  936)
* PyConfig.user_site_directory (C member): PyConfig.         (line  948)
* PyConfig.verbose (C member):           PyConfig.           (line  961)
* PyConfig.warn_default_encoding (C member): PyConfig.       (line  232)
* PyConfig.warnoptions (C member):       PyConfig.           (line  978)
* PyConfig.write_bytecode (C member):    PyConfig.           (line  998)
* PyConfig.xoptions (C member):          PyConfig.           (line 1011)
* 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)
* PyCriticalSection (C type):            Low-level critical section API.
                                                             (line   24)
* PyCriticalSection_Begin (C function):  Low-level critical section API.
                                                             (line    9)
* PyCriticalSection_BeginMutex (C function): Low-level critical section API.
                                                             (line   34)
* PyCriticalSection_End (C function):    Low-level critical section API.
                                                             (line    9)
* PyCriticalSection2 (C type):           Low-level critical section API.
                                                             (line   24)
* PyCriticalSection2_Begin (C function): Low-level critical section API.
                                                             (line    9)
* PyCriticalSection2_BeginMutex (C function): Low-level critical section API.
                                                             (line   34)
* PyCriticalSection2_End (C function):   Low-level critical section API.
                                                             (line    9)
* 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  110)
* PyDate_CheckExact (C function):        DateTime オブジェクト<2>.
                                                             (line  116)
* PyDate_FromDate (C function):          DateTime オブジェクト<2>.
                                                             (line  170)
* PyDate_FromTimestamp (C function):     DateTime オブジェクト<2>.
                                                             (line  344)
* PyDateTime_CAPI (C type):              DateTime オブジェクト<2>.
                                                             (line   30)
* PyDateTime_CAPSULE_NAME (C macro):     Internal data<2>.   (line    9)
* PyDateTime_Check (C function):         DateTime オブジェクト<2>.
                                                             (line  121)
* PyDateTime_CheckExact (C function):    DateTime オブジェクト<2>.
                                                             (line  128)
* PyDateTime_Date (C type):              DateTime オブジェクト<2>.
                                                             (line   49)
* PyDateTime_DATE_GET_FOLD (C function): DateTime オブジェクト<2>.
                                                             (line  263)
* PyDateTime_DATE_GET_HOUR (C function): DateTime オブジェクト<2>.
                                                             (line  246)
* PyDateTime_DATE_GET_MICROSECOND (C function): DateTime オブジェクト<2>.
                                                             (line  258)
* PyDateTime_DATE_GET_MINUTE (C function): DateTime オブジェクト<2>.
                                                             (line  250)
* PyDateTime_DATE_GET_SECOND (C function): DateTime オブジェクト<2>.
                                                             (line  254)
* PyDateTime_DATE_GET_TZINFO (C function): DateTime オブジェクト<2>.
                                                             (line  270)
* PyDateTime_DateTime (C type):          DateTime オブジェクト<2>.
                                                             (line   54)
* PyDateTime_DateTimeType (C var):       DateTime オブジェクト<2>.
                                                             (line   75)
* PyDateTime_DateType (C var):           DateTime オブジェクト<2>.
                                                             (line   69)
* PyDateTime_Delta (C type):             DateTime オブジェクト<2>.
                                                             (line   64)
* PyDateTime_DELTA_GET_DAYS (C function): DateTime オブジェクト<2>.
                                                             (line  317)
* PyDateTime_DELTA_GET_MICROSECONDS (C function): DateTime オブジェクト<2>.
                                                             (line  329)
* PyDateTime_DELTA_GET_SECONDS (C function): DateTime オブジェクト<2>.
                                                             (line  323)
* PyDateTime_DeltaType (C var):          DateTime オブジェクト<2>.
                                                             (line   87)
* PyDateTime_FromDateAndTime (C function): DateTime オブジェクト<2>.
                                                             (line  175)
* PyDateTime_FromDateAndTimeAndFold (C function): DateTime オブジェクト<2>.
                                                             (line  181)
* PyDateTime_FromTimestamp (C function): DateTime オブジェクト<2>.
                                                             (line  338)
* PyDateTime_GET_DAY (C function):       DateTime オブジェクト<2>.
                                                             (line  237)
* PyDateTime_GET_MONTH (C function):     DateTime オブジェクト<2>.
                                                             (line  233)
* PyDateTime_GET_YEAR (C function):      DateTime オブジェクト<2>.
                                                             (line  229)
* PyDateTime_IMPORT (C macro):           DateTime オブジェクト<2>.
                                                             (line   14)
* PyDateTime_Time (C type):              DateTime オブジェクト<2>.
                                                             (line   59)
* PyDateTime_TIME_GET_FOLD (C function): DateTime オブジェクト<2>.
                                                             (line  298)
* PyDateTime_TIME_GET_HOUR (C function): DateTime オブジェクト<2>.
                                                             (line  282)
* PyDateTime_TIME_GET_MICROSECOND (C function): DateTime オブジェクト<2>.
                                                             (line  294)
* PyDateTime_TIME_GET_MINUTE (C function): DateTime オブジェクト<2>.
                                                             (line  286)
* PyDateTime_TIME_GET_SECOND (C function): DateTime オブジェクト<2>.
                                                             (line  290)
* PyDateTime_TIME_GET_TZINFO (C function): DateTime オブジェクト<2>.
                                                             (line  305)
* PyDateTime_TimeType (C var):           DateTime オブジェクト<2>.
                                                             (line   81)
* PyDateTime_TimeZone_UTC (C var):       DateTime オブジェクト<2>.
                                                             (line  101)
* PyDateTime_TZInfoType (C var):         DateTime オブジェクト<2>.
                                                             (line   93)
* PyDateTimeAPI (C var):                 DateTime オブジェクト<2>.
                                                             (line   38)
* PyDelta_Check (C function):            DateTime オブジェクト<2>.
                                                             (line  144)
* PyDelta_CheckExact (C function):       DateTime オブジェクト<2>.
                                                             (line  151)
* PyDelta_FromDSU (C function):          DateTime オブジェクト<2>.
                                                             (line  201)
* PyDescr_COMMON (C macro):              デスクリプタオブジェクト descriptor object.
                                                             (line  142)
* PyDescr_IsData (C function):           デスクリプタオブジェクト descriptor object.
                                                             (line  122)
* PyDescr_NewClassMethod (C function):   デスクリプタオブジェクト descriptor object.
                                                             (line  107)
* PyDescr_NewGetSet (C function):        デスクリプタオブジェクト descriptor object.
                                                             (line   10)
* PyDescr_NewMember (C function):        デスクリプタオブジェクト descriptor object.
                                                             (line   25)
* PyDescr_NewMethod (C function):        デスクリプタオブジェクト descriptor object.
                                                             (line   54)
* PyDescr_NewWrapper (C function):       デスクリプタオブジェクト descriptor object.
                                                             (line   84)
* PyDict_AddWatcher (C function):        Dictionary objects. (line  491)
* PyDict_Check (C function):             Dictionary objects. (line   16)
* PyDict_CheckExact (C function):        Dictionary objects. (line   21)
* PyDict_Clear (C function):             Dictionary objects. (line   53)
* PyDict_ClearWatcher (C function):      Dictionary objects. (line  506)
* PyDict_Contains (C function):          Dictionary objects. (line   61)
* PyDict_ContainsString (C function):    Dictionary objects. (line   77)
* PyDict_Copy (C function):              Dictionary objects. (line   89)
* PyDict_DelItem (C function):           Dictionary objects. (line  115)
* PyDict_DelItemString (C function):     Dictionary objects. (line  128)
* PyDict_GET_SIZE (C function):          Dictionary objects. (line  358)
* PyDict_GetItem (C function):           Dictionary objects. (line  162)
* PyDict_GetItemRef (C function):        Dictionary objects. (line  134)
* PyDict_GetItemString (C function):     Dictionary objects. (line  208)
* PyDict_GetItemStringRef (C function):  Dictionary objects. (line  230)
* PyDict_GetItemWithError (C function):  Dictionary objects. (line  191)
* PyDict_Items (C function):             Dictionary objects. (line  317)
* PyDict_Keys (C function):              Dictionary objects. (line  327)
* PyDict_Merge (C function):             Dictionary objects. (line  438)
* PyDict_MergeFromSeq2 (C function):     Dictionary objects. (line  470)
* PyDict_New (C function):               Dictionary objects. (line   26)
* PyDict_Next (C function):              Dictionary objects. (line  364)
* PyDict_Pop (C function):               Dictionary objects. (line  285)
* PyDict_PopString (C function):         Dictionary objects. (line  309)
* PyDict_SetDefault (C function):        Dictionary objects. (line  241)
* PyDict_SetDefaultRef (C function):     Dictionary objects. (line  259)
* PyDict_SetItem (C function):           Dictionary objects. (line   94)
* PyDict_SetItemString (C function):     Dictionary objects. (line  108)
* PyDict_Size (C function):              Dictionary objects. (line  347)
* PyDict_Type (C var):                   Dictionary objects. (line   11)
* PyDict_Unwatch (C function):           Dictionary objects. (line  529)
* PyDict_Update (C function):            Dictionary objects. (line  455)
* PyDict_Values (C function):            Dictionary objects. (line  337)
* PyDict_Watch (C function):             Dictionary objects. (line  520)
* PyDict_WatchCallback (C type):         Dictionary objects. (line  548)
* PyDict_WatchEvent (C type):            Dictionary objects. (line  539)
* PyDictItems_Check (C function):        辞書ビューオブジェクト<2>.
                                                             (line   38)
* PyDictItems_Type (C var):              辞書ビューオブジェクト<2>.
                                                             (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):         辞書ビューオブジェクト<2>.
                                                             (line   18)
* PyDictKeys_Type (C var):               辞書ビューオブジェクト<2>.
                                                             (line   13)
* PyDictObject (C type):                 Dictionary objects. (line    6)
* PyDictProxy_New (C function):          Dictionary objects. (line   31)
* PyDictProxy_Type (C var):              Dictionary objects. (line   43)
* 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):       辞書ビューオブジェクト<2>.
                                                             (line   28)
* PyDictValues_Type (C var):             辞書ビューオブジェクト<2>.
                                                             (line   23)
* PyDictViewSet_Check (C function):      辞書ビューオブジェクト<2>.
                                                             (line    6)
* PyDLL (ctypes のクラス):               共有ライブラリをロードする.
                                                             (line  162)
* pydll (ctypes モジュール):             共有ライブラリをロードする.
                                                             (line  227)
* 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):              例外<25>.           (line   24)
* PyErr_Clear (C function) <1>:          例外<25>.           (line  123)
* PyErr_Clear (C function) <2>:          出力とクリア.       (line    6)
* PyErr_DisplayException (C function):   出力とクリア.       (line   68)
* PyErr_ExceptionMatches (C function):   例外<25>.           (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):           例外<25>.           (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   56)
* PyErr_SetInterruptEx (C function):     シグナルハンドリング<2>.
                                                             (line   66)
* PyErr_SetNone (C function):            例外の送出.         (line   41)
* PyErr_SetObject (C function):          例外の送出.         (line   19)
* PyErr_SetRaisedException (C function): エラーインジケータの問い合わせ.
                                                             (line   63)
* PyErr_SetString (C function):          例外<25>.           (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_ImportCycleError (C var):        Exception types.    (line   93)
* PyExc_ImportError (C var):             Exception types.    (line   96)
* PyExc_ImportWarning (C var):           Warning types.      (line   29)
* PyExc_IndentationError (C var):        Exception types.    (line   99)
* PyExc_IndexError (C var):              Exception types.    (line  103)
* PyExc_InterruptedError (C var):        Exception types.    (line  106)
* PyExc_IOError (C var):                 OSError aliases.    (line   20)
* PyExc_IsADirectoryError (C var):       Exception types.    (line  111)
* PyExc_KeyboardInterrupt (C var):       Exception types.    (line  119)
* PyExc_KeyError (C var):                Exception types.    (line  116)
* PyExc_LookupError (C var):             Exception types.    (line  123)
* PyExc_MemoryError (C var):             Exception types.    (line  126)
* PyExc_ModuleNotFoundError (C var):     Exception types.    (line  129)
* PyExc_NameError (C var):               Exception types.    (line  134)
* PyExc_NotADirectoryError (C var):      Exception types.    (line  137)
* PyExc_NotImplementedError (C var):     Exception types.    (line  142)
* PyExc_OSError (C var):                 Exception types.    (line  146)
* PyExc_OverflowError (C var):           Exception types.    (line  149)
* PyExc_PendingDeprecationWarning (C var): Warning types.    (line   33)
* PyExc_PermissionError (C var):         Exception types.    (line  153)
* PyExc_ProcessLookupError (C var):      Exception types.    (line  158)
* PyExc_PythonFinalizationError (C var): Exception types.    (line  163)
* PyExc_RecursionError (C var):          Exception types.    (line  166)
* PyExc_ReferenceError (C var):          Exception types.    (line  171)
* PyExc_ResourceWarning (C var):         Warning types.      (line   37)
* PyExc_RuntimeError (C var):            Exception types.    (line  175)
* PyExc_RuntimeWarning (C var):          Warning types.      (line   42)
* PyExc_StopAsyncIteration (C var):      Exception types.    (line  178)
* PyExc_StopIteration (C var):           Exception types.    (line  183)
* PyExc_SyntaxError (C var):             Exception types.    (line  187)
* PyExc_SyntaxWarning (C var):           Warning types.      (line   46)
* PyExc_SystemError (C var):             Exception types.    (line  190)
* PyExc_SystemExit (C var):              Exception types.    (line  193)
* PyExc_TabError (C var):                Exception types.    (line  196)
* PyExc_TimeoutError (C var):            Exception types.    (line  199)
* PyExc_TypeError (C var):               Exception types.    (line  203)
* PyExc_UnboundLocalError (C var):       Exception types.    (line  206)
* PyExc_UnicodeDecodeError (C var):      Exception types.    (line  210)
* PyExc_UnicodeEncodeError (C var):      Exception types.    (line  214)
* PyExc_UnicodeError (C var):            Exception types.    (line  218)
* PyExc_UnicodeTranslateError (C var):   Exception types.    (line  221)
* PyExc_UnicodeWarning (C var):          Warning types.      (line   50)
* PyExc_UserWarning (C var):             Warning types.      (line   54)
* PyExc_ValueError (C var):              Exception types.    (line  225)
* PyExc_Warning (C var):                 Warning types.      (line   10)
* PyExc_WindowsError (C var):            OSError aliases.    (line   25)
* PyExc_ZeroDivisionError (C var):       Exception types.    (line  228)
* 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_HEAD (C macro):            例外クラス<2>.      (line   42)
* 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<2>.
                                                             (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   16)
* PyFloat_Pack4 (C function):            Pack functions.     (line   20)
* PyFloat_Pack8 (C function):            Pack functions.     (line   24)
* PyFloat_Type (C var):                  Floating-Point Objects.
                                                             (line   11)
* PyFloat_Unpack2 (C function):          Unpack functions.   (line   19)
* PyFloat_Unpack4 (C function):          Unpack functions.   (line   23)
* PyFloat_Unpack8 (C function):          Unpack functions.   (line   27)
* 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)
* PyFrozenDict_Check (C function):       Frozen dictionary objects.
                                                             (line   26)
* PyFrozenDict_CheckExact (C function):  Frozen dictionary objects.
                                                             (line   32)
* PyFrozenDict_New (C function):         Frozen dictionary objects.
                                                             (line   38)
* PyFrozenDict_Type (C var):             Frozen dictionary objects.
                                                             (line    8)
* 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  185)
* 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   46)
* PyGILState_Check (C function):         GIL-state APIs.     (line  108)
* PyGILState_Ensure (C function):        GIL-state APIs.     (line   27)
* PyGILState_GetThisThreadState (C function): GIL-state APIs.
                                                             (line   89)
* PyGILState_Release (C function):       GIL-state APIs.     (line   75)
* PyGILState_STATE (C type):             GIL-state APIs.     (line   12)
* PyGILState_STATE.PyGILState_LOCKED (C enumerator): GIL-state APIs.
                                                             (line   17)
* PyGILState_STATE.PyGILState_UNLOCKED (C enumerator): GIL-state APIs.
                                                             (line   22)
* 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  107)
* PyImport_AddModuleObject (C function): モジュールのインポート<2>.
                                                             (line   98)
* PyImport_AddModuleRef (C function):    モジュールのインポート<2>.
                                                             (line   75)
* PyImport_AppendInittab (C function):   モジュールのインポート<2>.
                                                             (line  287)
* PyImport_CreateModuleFromInitfunc (C function): モジュールのインポート<2>.
                                                             (line  415)
* PyImport_ExecCodeModule (C function):  モジュールのインポート<2>.
                                                             (line  113)
* PyImport_ExecCodeModuleEx (C function): モジュールのインポート<2>.
                                                             (line  153)
* PyImport_ExecCodeModuleObject (C function): モジュールのインポート<2>.
                                                             (line  163)
* PyImport_ExecCodeModuleWithPathnames (C function): モジュールのインポート<2>.
                                                             (line  179)
* PyImport_ExtendInittab (C function):   モジュールのインポート<2>.
                                                             (line  314)
* PyImport_FrozenModules (C var):        モジュールのインポート<2>.
                                                             (line  278)
* PyImport_GetImporter (C function):     モジュールのインポート<2>.
                                                             (line  226)
* PyImport_GetLazyImportsFilter (C function): モジュールのインポート<2>.
                                                             (line  364)
* PyImport_GetLazyImportsMode (C function): モジュールのインポート<2>.
                                                             (line  357)
* PyImport_GetMagicNumber (C function):  モジュールのインポート<2>.
                                                             (line  196)
* PyImport_GetMagicTag (C function):     モジュールのインポート<2>.
                                                             (line  204)
* PyImport_GetModule (C function):       モジュールのインポート<2>.
                                                             (line  217)
* PyImport_GetModuleDict (C function):   モジュールのインポート<2>.
                                                             (line  212)
* PyImport_Import (C function):          モジュールのインポート<2>.
                                                             (line   58)
* PyImport_ImportFrozenModule (C function): モジュールのインポート<2>.
                                                             (line  254)
* PyImport_ImportFrozenModuleObject (C function): モジュールのインポート<2>.
                                                             (line  239)
* PyImport_ImportModule (C function):    モジュールのインポート<2>.
                                                             (line    6)
* PyImport_ImportModuleAttr (C function): モジュールのインポート<2>.
                                                             (line  335)
* PyImport_ImportModuleAttrString (C function): モジュールのインポート<2>.
                                                             (line  349)
* PyImport_ImportModuleEx (C function):  モジュールのインポート<2>.
                                                             (line   13)
* PyImport_ImportModuleLevel (C function): モジュールのインポート<2>.
                                                             (line   48)
* PyImport_ImportModuleLevelObject (C function): モジュールのインポート<2>.
                                                             (line   31)
* PyImport_Inittab (C var):              モジュールのインポート<2>.
                                                             (line  329)
* PyImport_LazyImportsMode (C type):     モジュールのインポート<2>.
                                                             (line  395)
* PyImport_LazyImportsMode.PyImport_LAZY_ALL (C enumerator): モジュールのインポート<2>.
                                                             (line  404)
* PyImport_LazyImportsMode.PyImport_LAZY_NONE (C enumerator): モジュールのインポート<2>.
                                                             (line  408)
* PyImport_LazyImportsMode.PyImport_LAZY_NORMAL (C enumerator): モジュールのインポート<2>.
                                                             (line  399)
* PyImport_ReloadModule (C function):    モジュールのインポート<2>.
                                                             (line   68)
* PyImport_SetLazyImportsFilter (C function): モジュールのインポート<2>.
                                                             (line  381)
* PyImport_SetLazyImportsMode (C function): モジュールのインポート<2>.
                                                             (line  371)
* PyIndex_Check (C function):            数値型プロトコル number protocol.
                                                             (line  280)
* PyInit_modulename (C function):        PyInit function.    (line   12)
* 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)
* PyInterpreterGuard (C type):           Cautions regarding interpreter finalization.
                                                             (line   36)
* PyInterpreterGuard_Close (C function): Cautions regarding interpreter finalization.
                                                             (line  115)
* PyInterpreterGuard_FromCurrent (C function): Cautions regarding interpreter finalization.
                                                             (line   58)
* PyInterpreterGuard_FromView (C function): Cautions regarding interpreter finalization.
                                                             (line   96)
* 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)
* PyInterpreterView (C type):            Interpreter views.  (line    9)
* PyInterpreterView_Close (C function):  Interpreter views.  (line   34)
* PyInterpreterView_FromCurrent (C function): Interpreter views.
                                                             (line   18)
* PyInterpreterView_FromMain (C function): Interpreter views.
                                                             (line   48)
* PyIter_Check (C function):             イテレータプロトコル iterator protocol.
                                                             (line    8)
* PyIter_Next (C function):              イテレータプロトコル iterator protocol.
                                                             (line   30)
* PyIter_NextItem (C function):          イテレータプロトコル iterator protocol.
                                                             (line   21)
* PyIter_Send (C function):              イテレータプロトコル iterator protocol.
                                                             (line   48)
* PYLAUNCHER_ALLOW_INSTALL:              Windows<17>.        (line   24)
* PYLAUNCHER_ALLOW_INSTALL <1>:          Windows<31>.        (line   15)
* PyList_Append (C function):            リストオブジェクト. (line  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   16)
* 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   90)
* PyLong_FreeExport (C function):        Export API.         (line  107)
* PyLong_FromDouble (C function):        整数型オブジェクト integer object.
                                                             (line   84)
* PyLong_FromInt32 (C function):         整数型オブジェクト integer object.
                                                             (line   62)
* PyLong_FromInt64 (C function):         整数型オブジェクト integer object.
                                                             (line   62)
* PyLong_FromLong (C function):          整数型オブジェクト integer object.
                                                             (line   31)
* PyLong_FromLongLong (C function):      整数型オブジェクト integer object.
                                                             (line   57)
* PyLong_FromNativeBytes (C function):   整数型オブジェクト integer object.
                                                             (line  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   70)
* 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   47)
* 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 type):                 Export API.         (line   59)
* PyLongExport.digits (C member):        Export API.         (line   86)
* PyLongExport.ndigits (C member):       Export API.         (line   81)
* PyLongExport.negative (C member):      Export API.         (line   76)
* PyLongExport.value (C member):         Export API.         (line   71)
* PyLongLayout (C type):                 Export API.         (line    8)
* PyLongLayout.bits_per_digit (C member): Export API.        (line   21)
* PyLongLayout.digit_endianness (C member): Export API.      (line   39)
* PyLongLayout.digit_size (C member):    Export API.         (line   26)
* PyLongLayout.digits_order (C member):  Export API.         (line   31)
* PyLongObject (C type):                 整数型オブジェクト integer object.
                                                             (line   12)
* PyLongRangeIter_Type (C var):          Other Iterator Objects.
                                                             (line   27)
* PyLongWriter (C type):                 PyLongWriter API.   (line   10)
* PyLongWriter_Create (C function):      PyLongWriter API.   (line   17)
* PyLongWriter_Discard (C function):     PyLongWriter API.   (line   60)
* 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   90)
* 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   62)
* 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   74)
* PyMem_NEW (C macro):                   非推奨のエイリアス<2>.
                                                             (line   16)
* PyMem_RawCalloc (C function):          生メモリインターフェース.
                                                             (line   25)
* PyMem_RawFree (C function):            生メモリインターフェース.
                                                             (line   54)
* PyMem_RawMalloc (C function):          生メモリインターフェース.
                                                             (line   16)
* PyMem_RawRealloc (C function):         生メモリインターフェース.
                                                             (line   38)
* PyMem_Realloc (C function):            メモリインターフェース.
                                                             (line   46)
* PyMem_REALLOC (C macro):               非推奨のエイリアス<2>.
                                                             (line   19)
* PyMem_Resize (C macro):                メモリインターフェース.
                                                             (line   80)
* 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   39)
* 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   82)
* PyMethodDef.ml_flags (C member):       Implementing functions and methods.
                                                             (line   78)
* PyMethodDef.ml_meth (C member):        Implementing functions and methods.
                                                             (line   74)
* PyMethodDef.ml_name (C member):        Implementing functions and methods.
                                                             (line   68)
* PyMethodDescr_Type (C var):            デスクリプタオブジェクト descriptor object.
                                                             (line   68)
* PyMODEXPORT_FUNC (C macro):            Extension export hook.
                                                             (line   47)
* PyModExport_modulename (C function):   Extension export hook.
                                                             (line   15)
* PyMODINIT_FUNC (C macro):              PyInit function.    (line   25)
* 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):          Module definition struct.
                                                             (line  156)
* PyModule_Create2 (C function):         Module definition struct.
                                                             (line  163)
* PyModule_Exec (C function):            Creating extension modules dynamically.
                                                             (line   34)
* PyModule_ExecDef (C function):         Module definition struct.
                                                             (line  216)
* PyModule_FromDefAndSpec (C function):  Module definition struct.
                                                             (line  180)
* PyModule_FromDefAndSpec2 (C function): Module definition struct.
                                                             (line  192)
* PyModule_FromSlotsAndSpec (C function): Creating extension modules dynamically.
                                                             (line    9)
* PyModule_GetDef (C function):          モジュールオブジェクト module object.
                                                             (line   81)
* PyModule_GetDict (C function):         モジュールオブジェクト module object.
                                                             (line   45)
* PyModule_GetFilename (C function):     モジュールオブジェクト module object.
                                                             (line  102)
* PyModule_GetFilenameObject (C function): モジュールオブジェクト module object.
                                                             (line   91)
* PyModule_GetName (C function):         モジュールオブジェクト module object.
                                                             (line   72)
* PyModule_GetNameObject (C function):   モジュールオブジェクト module object.
                                                             (line   61)
* PyModule_GetState (C function):        Module state.       (line   28)
* PyModule_GetState_DuringGC (C function): "DuringGC" functions.
                                                             (line   19)
* PyModule_GetStateSize (C function):    Module state.       (line   38)
* PyModule_GetToken (C function):        Module token.       (line   62)
* PyModule_GetToken_DuringGC (C function): "DuringGC" functions.
                                                             (line   19)
* 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 definition struct.
                                                             (line   15)
* PyModuleDef_Base (C type):             Module definition struct.
                                                             (line   35)
* PyModuleDef_HEAD_INIT (C macro):       Module definition struct.
                                                             (line   44)
* PyModuleDef_Init (C function):         PyInit function.    (line   43)
* PyModuleDef_Slot (C type):             Module definition struct.
                                                             (line   92)
* PyModuleDef_Slot.slot (C member):      Module definition struct.
                                                             (line  116)
* PyModuleDef_Slot.value (C member):     Module definition struct.
                                                             (line  120)
* PyModuleDef_Type (C var):              Module definition struct.
                                                             (line  141)
* PyModuleDef.m_base (C member):         Module definition struct.
                                                             (line   30)
* PyModuleDef.m_clear (C member):        Module definition struct.
                                                             (line  126)
* PyModuleDef.m_doc (C member):          Module definition struct.
                                                             (line   52)
* PyModuleDef.m_free (C member):         Module definition struct.
                                                             (line  126)
* PyModuleDef.m_methods (C member):      Module definition struct.
                                                             (line   69)
* PyModuleDef.m_name (C member):         Module definition struct.
                                                             (line   48)
* PyModuleDef.m_size (C member):         Module definition struct.
                                                             (line   57)
* PyModuleDef.m_slots (C member):        Module definition struct.
                                                             (line   74)
* PyModuleDef.m_slots.m_reload (C member): Module definition struct.
                                                             (line   90)
* PyModuleDef.m_traverse (C member):     Module definition struct.
                                                             (line  126)
* 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  388)
* PyObject_AsFileDescriptor (C function): File objects.      (line   33)
* PyObject_Bytes (C function):           オブジェクトプロトコル object protocol.
                                                             (line  412)
* PyObject_Call (C function):            Object Calling API. (line   57)
* PyObject_CallFinalizer (C function):   関数<16>.           (line    9)
* PyObject_CallFinalizerFromDealloc (C function): 関数<16>.  (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  638)
* PyObject_ClearWeakRefs (C function):   弱参照オブジェクト<2>.
                                                             (line   92)
* 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  287)
* PyObject_DelAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  293)
* PyObject_DelItem (C function):         オブジェクトプロトコル object protocol.
                                                             (line  543)
* PyObject_DelItemString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  548)
* PyObject_Dir (C function):             オブジェクトプロトコル object protocol.
                                                             (line  553)
* PyObject_Dump (C function):            オブジェクトプロトコル object protocol.
                                                             (line   97)
* PyObject_Format (C function):          オブジェクトプロトコル object protocol.
                                                             (line  365)
* PyObject_Free (C function):            オブジェクトアロケータ.
                                                             (line   61)
* 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  222)
* PyObject_GenericGetDict (C function):  オブジェクトプロトコル object protocol.
                                                             (line  308)
* PyObject_GenericHash (C function):     PyHash API.         (line  171)
* PyObject_GenericSetAttr (C function):  オブジェクトプロトコル object protocol.
                                                             (line  276)
* PyObject_GenericSetDict (C function):  オブジェクトプロトコル object protocol.
                                                             (line  324)
* PyObject_GetAIter (C function):        オブジェクトプロトコル object protocol.
                                                             (line  575)
* PyObject_GetArenaAllocator (C function): pymalloc アリーナアロケータのカスタマイズ.
                                                             (line   26)
* PyObject_GetAttr (C function):         オブジェクトプロトコル object protocol.
                                                             (line  178)
* PyObject_GetAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  188)
* PyObject_GetBuffer (C function):       バッファ関連の関数. (line   13)
* PyObject_GetItem (C function):         オブジェクトプロトコル object protocol.
                                                             (line  530)
* PyObject_GetItemData (C function):     オブジェクトプロトコル object protocol.
                                                             (line  617)
* PyObject_GetItemData_DuringGC (C function): "DuringGC" functions.
                                                             (line   19)
* PyObject_GetIter (C function):         オブジェクトプロトコル object protocol.
                                                             (line  562)
* PyObject_GetOptionalAttr (C function): オブジェクトプロトコル object protocol.
                                                             (line  198)
* PyObject_GetOptionalAttrString (C function): オブジェクトプロトコル object protocol.
                                                             (line  213)
* PyObject_GetTypeData (C function):     オブジェクトプロトコル object protocol.
                                                             (line  586)
* PyObject_GetTypeData_DuringGC (C function): "DuringGC" functions.
                                                             (line   19)
* PyObject_HasAttr (C function):         オブジェクトプロトコル object protocol.
                                                             (line  150)
* PyObject_HasAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  163)
* PyObject_HasAttrStringWithError (C function): オブジェクトプロトコル object protocol.
                                                             (line  141)
* PyObject_HasAttrWithError (C function): オブジェクトプロトコル object protocol.
                                                             (line  132)
* PyObject_Hash (C function):            オブジェクトプロトコル object protocol.
                                                             (line  467)
* PyObject_HashNotImplemented (C function): オブジェクトプロトコル object protocol.
                                                             (line  476)
* PyObject_HEAD (C macro):               Base object types and macros.
                                                             (line   99)
* PyObject_HEAD_INIT (C macro):          Base object types and macros.
                                                             (line  201)
* 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  445)
* PyObject_IsSubclass (C function):      オブジェクトプロトコル object protocol.
                                                             (line  424)
* PyObject_IsTrue (C function):          オブジェクトプロトコル object protocol.
                                                             (line  484)
* PyObject_Length (C function):          オブジェクトプロトコル object protocol.
                                                             (line  511)
* PyObject_LengthHint (C function):      オブジェクトプロトコル object protocol.
                                                             (line  520)
* 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  489)
* PyObject_Print (C function):           オブジェクトプロトコル object protocol.
                                                             (line   89)
* PyObject_Realloc (C function):         オブジェクトアロケータ.
                                                             (line   44)
* PyObject_REALLOC (C macro):            Soft-deprecated aliases.
                                                             (line   30)
* PyObject_Repr (C function):            オブジェクトプロトコル object protocol.
                                                             (line  375)
* PyObject_RichCompare (C function):     オブジェクトプロトコル object protocol.
                                                             (line  342)
* PyObject_RichCompareBool (C function): オブジェクトプロトコル object protocol.
                                                             (line  354)
* PyObject_SelfIter (C function):        オブジェクトプロトコル object protocol.
                                                             (line  569)
* PyObject_SetArenaAllocator (C function): pymalloc アリーナアロケータのカスタマイズ.
                                                             (line   31)
* PyObject_SetAttr (C function):         オブジェクトプロトコル object protocol.
                                                             (line  233)
* PyObject_SetAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  251)
* PyObject_SetItem (C function):         オブジェクトプロトコル object protocol.
                                                             (line  536)
* PyObject_Size (C function):            オブジェクトプロトコル object protocol.
                                                             (line  511)
* PyObject_Str (C function):             オブジェクトプロトコル object protocol.
                                                             (line  399)
* PyObject_Type (C function):            オブジェクトプロトコル object protocol.
                                                             (line  494)
* PyObject_TypeCheck (C function):       オブジェクトプロトコル object protocol.
                                                             (line  506)
* PyObject_VAR_HEAD (C macro):           Base object types and macros.
                                                             (line  108)
* 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  628)
* PyObject.ob_mutex (C member):          Base object types and macros.
                                                             (line   47)
* PyObject.ob_refcnt (C member):         Base object types and macros.
                                                             (line   32)
* PyObject.ob_type (C member):           Base object types and macros.
                                                             (line   42)
* 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):               Built-in descriptors.
                                                             (line    6)
* 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)
* PySentinel_Check (C function):         Sentinel objects.   (line   13)
* PySentinel_CheckExact (C function):    Sentinel objects.   (line   22)
* PySentinel_New (C function):           Sentinel objects.   (line   31)
* PySentinel_Type (C var):               Sentinel objects.   (line    6)
* 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   92)
* 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)
* PySlot (C type):                       Definition slots.   (line   38)
* PySlot_DATA (C macro):                 Convenience macros. (line    6)
* PySlot_END (C macro):                  Convenience macros. (line   46)
* PySlot_FUNC (C macro):                 Convenience macros. (line    6)
* PySlot_INT64 (C macro):                Convenience macros. (line    6)
* PySlot_INTPTR (C macro):               Definition slots.   (line  106)
* PySlot_OPTIONAL (C macro):             Definition slots.   (line  115)
* PySlot_PTR (C macro):                  Convenience macros. (line   56)
* PySlot_PTR_STATIC (C macro):           Convenience macros. (line   56)
* PySlot_SIZE (C macro):                 Convenience macros. (line    6)
* PySlot_STATIC (C macro):               Definition slots.   (line   89)
* PySlot_STATIC_DATA (C macro):          Convenience macros. (line    6)
* PySlot_UINT64 (C macro):               Convenience macros. (line    6)
* PySlot.sl_flags (C member):            Definition slots.   (line   85)
* PySlot.sl_func (C member):             Definition slots.   (line   71)
* PySlot.sl_id (C member):               Definition slots.   (line   55)
* PySlot.sl_int64 (C member):            Definition slots.   (line   71)
* PySlot.sl_ptr (C member):              Definition slots.   (line   71)
* PySlot.sl_size (C member):             Definition slots.   (line   71)
* PySlot.sl_uint64 (C member):           Definition slots.   (line   71)
* 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   43)
* PyStaticMethod_Type (C var):           Built-in descriptors.
                                                             (line   38)
* 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<2>.
                                                             (line   17)
* PyStructSequence_Desc (C type):        Struct Sequence オブジェクト.
                                                             (line   38)
* PyStructSequence_Desc.doc (C member):  Struct Sequence オブジェクト.
                                                             (line   47)
* PyStructSequence_Desc.fields (C member): Struct Sequence オブジェクト.
                                                             (line   51)
* PyStructSequence_Desc.n_in_sequence (C member): Struct Sequence オブジェクト.
                                                             (line   56)
* PyStructSequence_Desc.name (C member): Struct Sequence オブジェクト.
                                                             (line   42)
* PyStructSequence_Field (C type):       Struct Sequence オブジェクト.
                                                             (line   61)
* PyStructSequence_Field.doc (C member): Struct Sequence オブジェクト.
                                                             (line   75)
* PyStructSequence_Field.name (C member): Struct Sequence オブジェクト.
                                                             (line   69)
* PyStructSequence_GET_ITEM (C function): Struct Sequence オブジェクト.
                                                             (line  106)
* PyStructSequence_GetItem (C function): Struct Sequence オブジェクト.
                                                             (line   94)
* PyStructSequence_InitType (C function): Struct Sequence オブジェクト.
                                                             (line   23)
* PyStructSequence_InitType2 (C function): Struct Sequence オブジェクト.
                                                             (line   29)
* PyStructSequence_New (C function):     Struct Sequence オブジェクト.
                                                             (line   85)
* PyStructSequence_NewType (C function): Struct Sequence オブジェクト.
                                                             (line   14)
* PyStructSequence_SET_ITEM (C function): Struct Sequence オブジェクト.
                                                             (line  128)
* PyStructSequence_SetItem (C function): Struct Sequence オブジェクト.
                                                             (line  115)
* PyStructSequence_UnnamedField (C var): Struct Sequence オブジェクト.
                                                             (line   79)
* PySuper_Type (C var):                  Built-in descriptors.
                                                             (line   11)
* PySys_AddAuditHook (C function):       システム関数.       (line  160)
* PySys_Audit (C function):              システム関数.       (line  119)
* PySys_AuditTuple (C function):         システム関数.       (line  152)
* PySys_FormatStderr (C function):       システム関数.       (line  104)
* PySys_FormatStdout (C function):       システム関数.       (line   97)
* PySys_GetAttr (C function):            システム関数.       (line   11)
* PySys_GetAttrString (C function):      システム関数.       (line   23)
* PySys_GetObject (C function):          システム関数.       (line   61)
* PySys_GetOptionalAttr (C function):    システム関数.       (line   35)
* PySys_GetOptionalAttrString (C function): システム関数.    (line   52)
* PySys_GetXOptions (C function):        システム関数.       (line  111)
* PySys_SetArgv (C function):            プロセスワイドのパラメータ.
                                                             (line  139)
* PySys_SetArgvEx (C function):          プロセスワイドのパラメータ.
                                                             (line   88)
* PySys_SetObject (C function):          システム関数.       (line   69)
* PySys_WriteStderr (C function):        システム関数.       (line   92)
* PySys_WriteStdout (C function):        システム関数.       (line   75)
* Python 3000:                           用語集<2>.          (line 1458)
* Python Editor:                         IDLE --- Python のエディタとシェル<2>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 0007#documentation-strings: ドキュメント<29>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 0249#threadsafety: モジュール定数.
                                                             (line  119)
* 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 1427)
* Python Enhancement Proposals; PEP 100: Unicode 文字列型<2>.
                                                             (line   18)
* Python Enhancement Proposals; PEP 11:  Build changes<3>.   (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>: ビルド<33>.     (line   56)
* Python Enhancement Proposals; PEP 11 <12>: ビルド<33>.     (line  107)
* Python Enhancement Proposals; PEP 11 <13>: ビルド<71>.     (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<3>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 11#tier-3 <2>: 概要 -- リリースハイライト<2>.
                                                             (line  132)
* Python Enhancement Proposals; PEP 11#tier-3 <3>: 概要 -- リリースハイライト<2>.
                                                             (line  135)
* Python Enhancement Proposals; PEP 11#tier-3 <4>: Build Changes<3>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 201: 新しい開発プロセス. (line   81)
* Python Enhancement Proposals; PEP 205: PEP 205 弱参照.     (line   82)
* Python Enhancement Proposals; PEP 205 <1>: weakref --- Weak references.
                                                             (line  343)
* Python Enhancement Proposals; PEP 207: PEP 207 拡張比較.   (line   68)
* Python Enhancement Proposals; PEP 207 <1>: PEP 207 拡張比較.
                                                             (line   74)
* Python Enhancement Proposals; PEP 208: PEP 208 新しい型強制モデル.
                                                             (line   26)
* Python Enhancement Proposals; PEP 217: PEP 217 対話モード用 Display Hook.
                                                             (line   27)
* Python Enhancement Proposals; PEP 218: PEP 218 ビルトインの集合オブジェクト.
                                                             (line   51)
* Python Enhancement Proposals; PEP 218 <1>: その他の言語変更<17>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 218 <2>: PEP 218 標準の集合データ型.
                                                             (line   86)
* Python Enhancement Proposals; PEP 227: PEP 227 入れ子状のスコープ.
                                                             (line   89)
* Python Enhancement Proposals; PEP 227 <1>: PEP 227 入れ子状のスコープ<2>.
                                                             (line   90)
* Python Enhancement Proposals; PEP 227 <2>: モジュールコンテンツ<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  641)
* Python Enhancement Proposals; PEP 241: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
                                                             (line   17)
* Python Enhancement Proposals; PEP 241 <1>: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
                                                             (line   30)
* Python Enhancement Proposals; PEP 241 <2>: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
                                                             (line   37)
* Python Enhancement Proposals; PEP 243: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
                                                             (line   41)
* Python Enhancement Proposals; PEP 246: ドキュメント<28>.   (line   48)
* Python Enhancement Proposals; PEP 246 <1>: PrepareProtocol オブジェクト.
                                                             (line   10)
* Python Enhancement Proposals; PEP 247: hmac<4>.            (line   20)
* Python Enhancement Proposals; PEP 249: sqlite3<4>.         (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>: ライブラリ<82>. (line  123)
* Python Enhancement Proposals; PEP 249 <4>: ライブラリ<97>. (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  740)
* Python Enhancement Proposals; PEP 249 <9>: Connection オブジェクト.
                                                             (line  743)
* Python Enhancement Proposals; PEP 249 <10>: Connection オブジェクト.
                                                             (line  756)
* Python Enhancement Proposals; PEP 249 <11>: 例外<8>.       (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<109>.
                                                             (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   47)
* Python Enhancement Proposals; PEP 273 <3>: zipimport --- Zip アーカイブからモジュールをインポートする.
                                                             (line   50)
* 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 1836)
* 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   50)
* Python Enhancement Proposals; PEP 282 <3>: warnings モジュールとの統合.
                                                             (line   34)
* Python Enhancement Proposals; PEP 285: PEP 285 Boolean 型. (line   46)
* Python Enhancement Proposals; PEP 285 <1>: PEP 285 Boolean 型.
                                                             (line   69)
* Python Enhancement Proposals; PEP 288: PEP 342 ジェネレータの新機能.
                                                             (line  139)
* Python Enhancement Proposals; PEP 289: PEP 289 ジェネレータ式.
                                                             (line   55)
* Python Enhancement Proposals; PEP 289 <1>: その他の言語変更<17>.
                                                             (line   14)
* Python Enhancement Proposals; PEP 289 <2>: Python 文書.    (line   12)
* Python Enhancement Proposals; PEP 292: PEP 292 より単純な文字列置換 string substitution.
                                                             (line   45)
* Python Enhancement Proposals; PEP 292 <1>: Template strings $-strings.
                                                             (line   16)
* Python Enhancement Proposals; PEP 293: PEP 293 コーデックエラーを処理するコールバック.
                                                             (line   29)
* Python Enhancement Proposals; PEP 3000: Python 3 0.        (line   42)
* Python Enhancement Proposals; PEP 301: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ.
                                                             (line   43)
* Python Enhancement Proposals; PEP 302: インポート実装としての importlib の使用.
                                                             (line   12)
* Python Enhancement Proposals; PEP 302 <1>: 目に見える変化. (line   19)
* Python Enhancement Proposals; PEP 302 <2>: Python コードの移植.
                                                             (line   72)
* Python Enhancement Proposals; PEP 302 <3>: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>.
                                                             (line  107)
* Python Enhancement Proposals; PEP 302 <4>: 新たなモジュール、改良されたモジュール、削除されたモジュール.
                                                             (line  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 2227)
* Python Enhancement Proposals; PEP 302 <12>: linecache --- テキストラインへのランダムアクセス.
                                                             (line   34)
* Python Enhancement Proposals; PEP 302 <13>: sys --- システム固有のパラメーターと関数.
                                                             (line 1533)
* Python Enhancement Proposals; PEP 302 <14>: sys --- システム固有のパラメーターと関数.
                                                             (line 1543)
* Python Enhancement Proposals; PEP 302 <15>: zipimport --- Zip アーカイブからモジュールをインポートする.
                                                             (line   51)
* 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  141)
* Python Enhancement Proposals; PEP 302 <23>: importlib abc -- Abstract base classes related to import.
                                                             (line  182)
* Python Enhancement Proposals; PEP 302 <24>: importlib abc -- Abstract base classes related to import.
                                                             (line  209)
* Python Enhancement Proposals; PEP 302 <25>: importlib abc -- Abstract base classes related to import.
                                                             (line  281)
* Python Enhancement Proposals; PEP 302 <26>: 用語集<2>.     (line 1083)
* 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<10>.         (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   86)
* Python Enhancement Proposals; PEP 3115 <4>: 動的な型生成.  (line   48)
* Python Enhancement Proposals; PEP 3115 <5>: 関数およびクラス定義.
                                                             (line  180)
* Python Enhancement Proposals; PEP 3116: 最適化<13>.        (line    8)
* Python Enhancement Proposals; PEP 3116 <1>: PEP 3116 新しい I/O ライブラリ.
                                                             (line   73)
* Python Enhancement Proposals; PEP 3116 <2>: 用語集<2>.     (line 1836)
* 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>: ライブラリ<178>.
                                                             (line   99)
* Python Enhancement Proposals; PEP 3118 <7>: ライブラリ<183>.
                                                             (line   61)
* Python Enhancement Proposals; PEP 3118 <8>: ライブラリ<212>.
                                                             (line  958)
* Python Enhancement Proposals; PEP 3118 <9>: メモリビュー.  (line  116)
* Python Enhancement Proposals; PEP 3118 <10>: モジュールインターフェース.
                                                             (line   27)
* Python Enhancement Proposals; PEP 3119: PEP 3119 抽象基底クラス.
                                                             (line  137)
* Python Enhancement Proposals; PEP 3119 <1>: インスタンスのカスタマイズとサブクラスチェック.
                                                             (line   34)
* Python Enhancement Proposals; PEP 3119 <2>: 例とレシピ.    (line   70)
* Python Enhancement Proposals; PEP 3119 <3>: abc --- 抽象基底クラス.
                                                             (line   10)
* Python Enhancement Proposals; PEP 3119 <4>: オブジェクトプロトコル object protocol.
                                                             (line  435)
* Python Enhancement Proposals; PEP 3119 <5>: オブジェクトプロトコル object protocol.
                                                             (line  456)
* 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>: ライブラリ<152>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 3121 <2>: Slots for defining module state.
                                                             (line   17)
* 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   91)
* Python Enhancement Proposals; PEP 3131: Unicode 対 8 ビット、ではなく、テキスト対データに.
                                                             (line  112)
* Python Enhancement Proposals; PEP 3131 <1>: ライブラリ<167>.
                                                             (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>: ライブラリ<97>.
                                                             (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>: test support import_helper --- Utilities for import tests.
                                                             (line   82)
* Python Enhancement Proposals; PEP 3147 <4>: runpy --- Python モジュールの位置特定と実行.
                                                             (line   86)
* Python Enhancement Proposals; PEP 3147 <5>: はじめに<13>.  (line   93)
* Python Enhancement Proposals; PEP 3147 <6>: importlib util -- Utility code for importers.
                                                             (line   24)
* Python Enhancement Proposals; PEP 3147 <7>: importlib util -- Utility code for importers.
                                                             (line   55)
* Python Enhancement Proposals; PEP 3147 <8>: importlib util -- Utility code for importers.
                                                             (line   59)
* Python Enhancement Proposals; PEP 3147 <9>: py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   29)
* Python Enhancement Proposals; PEP 3147 <10>: py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   70)
* Python Enhancement Proposals; PEP 3147 <11>: コマンドラインでの使用<10>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 3147 <12>: パブリックな関数.
                                                             (line   40)
* Python Enhancement Proposals; PEP 3147 <13>: パブリックな関数.
                                                             (line  122)
* Python Enhancement Proposals; PEP 3147 <14>: モジュールのインポート<2>.
                                                             (line  206)
* Python Enhancement Proposals; PEP 3147 <15>: 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<208>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 3149 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line   57)
* 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>: 例外<19>.      (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  241)
* Python Enhancement Proposals; PEP 3153: asyncio<16>.       (line   22)
* Python Enhancement Proposals; PEP 3154: 概要 -- リリースハイライト<11>.
                                                             (line   58)
* Python Enhancement Proposals; PEP 3154 <1>: pickle<6>.     (line   16)
* Python Enhancement Proposals; PEP 3154 <2>: ライブラリ<167>.
                                                             (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 1484)
* Python Enhancement Proposals; PEP 3156: 概要 -- リリースハイライト<11>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 3156 <1>: 概要 -- リリースハイライト<11>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 3156 <2>: asyncio<16>.   (line    6)
* Python Enhancement Proposals; PEP 3156 <3>: asyncio<16>.   (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   94)
* 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 2244)
* 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  100)
* Python Enhancement Proposals; PEP 338 <2>: 参考資料.       (line   24)
* Python Enhancement Proposals; PEP 338 <3>: runpy --- Python モジュールの位置特定と実行.
                                                             (line  179)
* 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  362)
* Python Enhancement Proposals; PEP 343 <8>: 用語集<2>.      (line  368)
* Python Enhancement Proposals; PEP 347: ビルドならびに C API の変更<10>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 352: 例外に関する変更.   (line    8)
* Python Enhancement Proposals; PEP 352 <1>: 非推奨と削除.   (line    9)
* Python Enhancement Proposals; PEP 352 <2>: PEP 352 例外の新スタイルクラス化.
                                                             (line   65)
* Python Enhancement Proposals; PEP 353: Porting to Python 3 10<2>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 353 <1>: PEP 353 添え字型に ssize_t を使う.
                                                             (line   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<47>.      (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 1364)
* Python Enhancement Proposals; PEP 366: 目に見える変化.     (line   25)
* Python Enhancement Proposals; PEP 366 <1>: Import-related attributes on module objects.
                                                             (line   62)
* Python Enhancement Proposals; PEP 366 <2>: 参考資料.       (line   17)
* Python Enhancement Proposals; PEP 366 <3>: 参考資料.       (line   21)
* Python Enhancement Proposals; PEP 366 <4>: runpy --- Python モジュールの位置特定と実行.
                                                             (line  183)
* 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>: ライブラリ<92>. (line  602)
* Python Enhancement Proposals; PEP 370 <2>: その他のオプション.
                                                             (line  171)
* Python Enhancement Proposals; PEP 370 <3>: 環境変数.       (line  203)
* Python Enhancement Proposals; PEP 370 <4>: 環境変数.       (line  218)
* Python Enhancement Proposals; PEP 370 <5>: コマンドライン・インターフェース<12>.
                                                             (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  150)
* Python Enhancement Proposals; PEP 380: PEP 380 サブジェネレータへの委譲構文.
                                                             (line   66)
* Python Enhancement Proposals; PEP 380 <1>: Yield 式.       (line   93)
* Python Enhancement Proposals; PEP 380#use-of-stopiteration-to-return-values: The STOP_ITERATION event.
                                                             (line    6)
* Python Enhancement Proposals; PEP 383: ドキュメント<29>.   (line   29)
* Python Enhancement Proposals; PEP 383 <1>: エラーハンドラ. (line   49)
* Python Enhancement Proposals; PEP 383 <2>: ソケットファミリー.
                                                             (line   15)
* Python Enhancement Proposals; PEP 383 <3>: ロケールエンコーディング.
                                                             (line   15)
* Python Enhancement Proposals; PEP 383 <4>: ロケールエンコーディング.
                                                             (line   51)
* Python Enhancement Proposals; PEP 383 <5>: ファイルシステムエンコーディング.
                                                             (line    7)
* Python Enhancement Proposals; PEP 384: 削除<7>.            (line   53)
* Python Enhancement Proposals; PEP 384 <1>: その他のビルド並びに C API の変更.
                                                             (line   10)
* Python Enhancement Proposals; PEP 384 <2>: PEP 384 安定 ABI の定義.
                                                             (line   24)
* Python Enhancement Proposals; PEP 384 <3>: C API<41>.      (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 and ABI Stability.
                                                             (line    7)
* Python Enhancement Proposals; PEP 387 <3>: 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<39>.     (line  142)
* Python Enhancement Proposals; PEP 393 <12>: エンコーディングと Unicode.
                                                             (line    7)
* Python Enhancement Proposals; PEP 393 <13>: sys --- システム固有のパラメーターと関数.
                                                             (line 1431)
* 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 1102)
* Python Enhancement Proposals; PEP 411 <1>: sys --- システム固有のパラメーターと関数.
                                                             (line 1112)
* Python Enhancement Proposals; PEP 411 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line 1960)
* Python Enhancement Proposals; PEP 411 <3>: sys --- システム固有のパラメーターと関数.
                                                             (line 1980)
* Python Enhancement Proposals; PEP 411 <4>: 用語集<2>.      (line 1453)
* Python Enhancement Proposals; PEP 412: PEP 412 キー共有辞書.
                                                             (line   14)
* Python Enhancement Proposals; PEP 412 <1>: functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line   95)
* 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<193>.
                                                             (line   56)
* Python Enhancement Proposals; PEP 420 <4>: Core and Builtins<198>.
                                                             (line  114)
* Python Enhancement Proposals; PEP 420 <5>: インポートシステム.
                                                             (line   43)
* Python Enhancement Proposals; PEP 420 <6>: 名前空間パッケージ.
                                                             (line   27)
* Python Enhancement Proposals; PEP 420 <7>: __path__ attributes on modules.
                                                             (line   23)
* Python Enhancement Proposals; PEP 420 <8>: __path__ attributes on modules.
                                                             (line   23)
* Python Enhancement Proposals; PEP 420 <9>: 参考資料.       (line   11)
* Python Enhancement Proposals; PEP 420 <10>: 参考資料.      (line   13)
* Python Enhancement Proposals; PEP 420 <11>: 参考資料.      (line   13)
* Python Enhancement Proposals; PEP 420 <12>: はじめに<13>.  (line   69)
* Python Enhancement Proposals; PEP 420 <13>: 用語集<2>.     (line 1233)
* Python Enhancement Proposals; PEP 420 <14>: 用語集<2>.     (line 1431)
* Python Enhancement Proposals; PEP 421: SimpleNamespace.    (line   16)
* Python Enhancement Proposals; PEP 421 <1>: sys --- システム固有のパラメーターと関数.
                                                             (line 1228)
* Python Enhancement Proposals; PEP 421 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line 1236)
* 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<15>.    (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<176>.
                                                             (line  312)
* Python Enhancement Proposals; PEP 432 <2>: Multi-Phase Initialization Private Provisional API.
                                                             (line    7)
* Python Enhancement Proposals; PEP 432 <3>: Multi-Phase Initialization Private Provisional API.
                                                             (line   58)
* 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<54>.      (line   55)
* Python Enhancement Proposals; PEP 442 <6>: gc --- ガベージコレクターインターフェース.
                                                             (line  271)
* 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 2024)
* Python Enhancement Proposals; PEP 443: 概要 -- リリースハイライト<11>.
                                                             (line   56)
* Python Enhancement Proposals; PEP 443 <1>: functools<8>.   (line   25)
* Python Enhancement Proposals; PEP 443 <2>: 用語集<2>.      (line  756)
* 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<64>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 446 <5>: オペレーティングシステム関連のユーティリティ.
                                                             (line  243)
* Python Enhancement Proposals; PEP 448: PEP 798 Unpacking in comprehensions.
                                                             (line    7)
* Python Enhancement Proposals; PEP 448 <1>: PEP 448 - 追加可能なアンパックへの一般化.
                                                             (line    6)
* Python Enhancement Proposals; PEP 448 <2>: PEP 448 - 追加可能なアンパックへの一般化.
                                                             (line   39)
* Python Enhancement Proposals; PEP 448 <3>: ドキュメント<76>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 448 <4>: ドキュメント<80>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 448 <5>: Core and Builtins<201>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 448 <6>: Core and Builtins<204>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 448 <7>: 辞書表示.       (line   28)
* Python Enhancement Proposals; PEP 448 <8>: 呼び出し call.  (line  117)
* Python Enhancement Proposals; PEP 448 <9>: 式のリスト.     (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<3>.       (line    8)
* Python Enhancement Proposals; PEP 451 <1>: zipimport<4>.   (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>: ライブラリ<92>. (line  455)
* Python Enhancement Proposals; PEP 451 <6>: Core and Builtins<193>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 451 <7>: 参考資料.       (line   27)
* Python Enhancement Proposals; PEP 451 <8>: sys --- システム固有のパラメーターと関数.
                                                             (line 1462)
* Python Enhancement Proposals; PEP 451 <9>: runpy --- Python モジュールの位置特定と実行.
                                                             (line   89)
* Python Enhancement Proposals; PEP 451 <10>: runpy --- Python モジュールの位置特定と実行.
                                                             (line  167)
* Python Enhancement Proposals; PEP 451 <11>: runpy --- Python モジュールの位置特定と実行.
                                                             (line  187)
* Python Enhancement Proposals; PEP 451 <12>: はじめに<13>.  (line   73)
* 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<8>.        (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: Deprecated C APIs<2>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 456 <1>: 概要 -- リリースハイライト<11>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 456 <2>: PEP 456 安全で取り換え可能なハッシュアルゴリズム.
                                                             (line    6)
* Python Enhancement Proposals; PEP 456 <3>: Core and Builtins<4>.
                                                             (line  139)
* Python Enhancement Proposals; PEP 456 <4>: PyHash API.     (line  140)
* Python Enhancement Proposals; PEP 456 <5>: Pending removal in Python 3 19<6>.
                                                             (line    6)
* 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<59>.
                                                             (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>: ライブラリ<185>.
                                                             (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>: ライブラリ<211>.
                                                             (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>: ライブラリ<176>.
                                                             (line  228)
* Python Enhancement Proposals; PEP 475 <4>: ライブラリ<209>.
                                                             (line  143)
* Python Enhancement Proposals; PEP 475 <5>: 組み込み関数.   (line 1479)
* Python Enhancement Proposals; PEP 475 <6>: OS 例外.        (line   81)
* Python Enhancement Proposals; PEP 475 <7>: ファイル記述子の操作.
                                                             (line  406)
* Python Enhancement Proposals; PEP 475 <8>: ファイル記述子の操作.
                                                             (line  768)
* Python Enhancement Proposals; PEP 475 <9>: ファイル記述子の操作.
                                                             (line 1005)
* Python Enhancement Proposals; PEP 475 <10>: プロセス管理.  (line  954)
* Python Enhancement Proposals; PEP 475 <11>: I/O 基底クラス.
                                                             (line  279)
* Python Enhancement Proposals; PEP 475 <12>: I/O 基底クラス.
                                                             (line  298)
* Python Enhancement Proposals; PEP 475 <13>: 関数<5>.       (line  322)
* Python Enhancement Proposals; PEP 475 <14>: socket オブジェクト.
                                                             (line   28)
* Python Enhancement Proposals; PEP 475 <15>: socket オブジェクト.
                                                             (line   82)
* Python Enhancement Proposals; PEP 475 <16>: socket オブジェクト.
                                                             (line  249)
* Python Enhancement Proposals; PEP 475 <17>: socket オブジェクト.
                                                             (line  264)
* Python Enhancement Proposals; PEP 475 <18>: socket オブジェクト.
                                                             (line  336)
* Python Enhancement Proposals; PEP 475 <19>: socket オブジェクト.
                                                             (line  410)
* Python Enhancement Proposals; PEP 475 <20>: socket オブジェクト.
                                                             (line  429)
* Python Enhancement Proposals; PEP 475 <21>: socket オブジェクト.
                                                             (line  448)
* Python Enhancement Proposals; PEP 475 <22>: socket オブジェクト.
                                                             (line  491)
* Python Enhancement Proposals; PEP 475 <23>: select --- I/O 完了の待機.
                                                             (line  169)
* Python Enhancement Proposals; PEP 475 <24>: /dev/poll polling objects.
                                                             (line   83)
* Python Enhancement Proposals; PEP 475 <25>: Edge and level trigger polling epoll objects.
                                                             (line  111)
* Python Enhancement Proposals; PEP 475 <26>: Polling objects.
                                                             (line   94)
* Python Enhancement Proposals; PEP 475 <27>: Kqueue objects.
                                                             (line   37)
* Python Enhancement Proposals; PEP 475 <28>: クラス<4>.     (line  138)
* Python Enhancement Proposals; PEP 475 <29>: モジュールの内容<4>.
                                                             (line  621)
* Python Enhancement Proposals; PEP 475 <30>: モジュールの内容<4>.
                                                             (line  640)
* 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>: ライブラリ<167>.
                                                             (line 1267)
* Python Enhancement Proposals; PEP 479 <4>: ライブラリ<171>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 479 <5>: Core and Builtins<172>.
                                                             (line   34)
* Python Enhancement Proposals; PEP 479 <6>: ライブラリ<179>.
                                                             (line   95)
* Python Enhancement Proposals; PEP 479 <7>: ライブラリ<192>.
                                                             (line   80)
* Python Enhancement Proposals; PEP 479 <8>: ライブラリ<198>.
                                                             (line  326)
* Python Enhancement Proposals; PEP 479 <9>: 具象例外.       (line  300)
* Python Enhancement Proposals; PEP 479 <10>: 具象例外.      (line  303)
* 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  764)
* 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<7>.         (line   17)
* Python Enhancement Proposals; PEP 484 <9>: ast<7>.         (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   19)
* Python Enhancement Proposals; PEP 484 <26>: ast helpers.   (line   30)
* 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  690)
* Python Enhancement Proposals; PEP 484 <32>: 用語集<2>.     (line  764)
* Python Enhancement Proposals; PEP 484 <33>: 用語集<2>.     (line 1814)
* Python Enhancement Proposals; PEP 484 <34>: 用語集<2>.     (line 1829)
* Python Enhancement Proposals; PEP 484 <35>: 用語集<2>.     (line 1858)
* 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>: ライブラリ<207>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 485 <3>: Floating point manipulation functions.
                                                             (line   57)
* Python Enhancement Proposals; PEP 485 <4>: 類別関数.       (line   55)
* Python Enhancement Proposals; PEP 486: PEP 486 Python ランチャーが仮想環境を認識する.
                                                             (line    6)
* Python Enhancement Proposals; PEP 486 <1>: PEP 486 Python ランチャーが仮想環境を認識する.
                                                             (line   14)
* Python Enhancement Proposals; PEP 486 <2>: Windows<82>.    (line    6)
* Python Enhancement Proposals; PEP 487: PEP 487 Simpler customization of class creation.
                                                             (line   32)
* Python Enhancement Proposals; PEP 487 <1>: PEP 487 記述子プロトコルの改善.
                                                             (line    6)
* Python Enhancement Proposals; PEP 487 <2>: PEP 487 記述子プロトコルの改善.
                                                             (line   33)
* Python Enhancement Proposals; PEP 487 <3>: Python API の変更<9>.
                                                             (line  103)
* Python Enhancement Proposals; PEP 487 <4>: ドキュメント<66>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 487 <5>: ドキュメント<73>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 487 <6>: Core and Builtins<190>.
                                                             (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   84)
* Python Enhancement Proposals; PEP 488 <3>: Core and Builtins<208>.
                                                             (line   15)
* Python Enhancement Proposals; PEP 488 <4>: その他のオプション.
                                                             (line   95)
* Python Enhancement Proposals; PEP 488 <5>: その他のオプション.
                                                             (line   97)
* Python Enhancement Proposals; PEP 488 <6>: その他のオプション.
                                                             (line  104)
* Python Enhancement Proposals; PEP 488 <7>: その他のオプション.
                                                             (line  106)
* 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   59)
* 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>: ライブラリ<51>. (line   83)
* Python Enhancement Proposals; PEP 489 <4>: C API<17>.      (line   23)
* Python Enhancement Proposals; PEP 489 <5>: ライブラリ<60>. (line  254)
* Python Enhancement Proposals; PEP 489 <6>: ライブラリ<76>. (line   24)
* Python Enhancement Proposals; PEP 489 <7>: ライブラリ<131>.
                                                             (line   64)
* Python Enhancement Proposals; PEP 489 <8>: ライブラリ<131>.
                                                             (line   79)
* Python Enhancement Proposals; PEP 489 <9>: ライブラリ<133>.
                                                             (line   28)
* Python Enhancement Proposals; PEP 489 <10>: ライブラリ<134>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 489 <11>: ライブラリ<134>.
                                                             (line  177)
* Python Enhancement Proposals; PEP 489 <12>: ライブラリ<135>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <13>: ライブラリ<138>.
                                                             (line  103)
* Python Enhancement Proposals; PEP 489 <14>: C API<45>.     (line   11)
* Python Enhancement Proposals; PEP 489 <15>: C API<45>.     (line   14)
* Python Enhancement Proposals; PEP 489 <16>: C API<45>.     (line   17)
* Python Enhancement Proposals; PEP 489 <17>: C API<45>.     (line   20)
* Python Enhancement Proposals; PEP 489 <18>: C API<45>.     (line   23)
* Python Enhancement Proposals; PEP 489 <19>: C API<45>.     (line   26)
* Python Enhancement Proposals; PEP 489 <20>: C API<45>.     (line   29)
* Python Enhancement Proposals; PEP 489 <21>: C API<45>.     (line   38)
* Python Enhancement Proposals; PEP 489 <22>: C API<45>.     (line   41)
* Python Enhancement Proposals; PEP 489 <23>: C API<45>.     (line   44)
* Python Enhancement Proposals; PEP 489 <24>: C API<45>.     (line   47)
* Python Enhancement Proposals; PEP 489 <25>: ライブラリ<140>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 489 <26>: ライブラリ<141>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <27>: ライブラリ<142>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <28>: ライブラリ<142>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 489 <29>: ライブラリ<142>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 489 <30>: ライブラリ<142>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 489 <31>: ライブラリ<143>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <32>: ライブラリ<143>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 489 <33>: ライブラリ<143>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 489 <34>: ライブラリ<145>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <35>: ライブラリ<147>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <36>: ライブラリ<148>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <37>: ライブラリ<155>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 489 <38>: ライブラリ<155>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 489 <39>: ライブラリ<155>.
                                                             (line  423)
* Python Enhancement Proposals; PEP 489 <40>: Core and Builtins<155>.
                                                             (line   28)
* Python Enhancement Proposals; PEP 489 <41>: Core and Builtins<155>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 489 <42>: Core and Builtins<155>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 489 <43>: Core and Builtins<156>.
                                                             (line   46)
* Python Enhancement Proposals; PEP 489 <44>: Core and Builtins<156>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 489 <45>: Core and Builtins<156>.
                                                             (line   51)
* Python Enhancement Proposals; PEP 489 <46>: Core and Builtins<156>.
                                                             (line   71)
* Python Enhancement Proposals; PEP 489 <47>: Core and Builtins<156>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 489 <48>: Core and Builtins<157>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 489 <49>: Core and Builtins<157>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 489 <50>: Core and Builtins<157>.
                                                             (line   40)
* Python Enhancement Proposals; PEP 489 <51>: Core and Builtins<157>.
                                                             (line   54)
* Python Enhancement Proposals; PEP 489 <52>: Core and Builtins<157>.
                                                             (line  109)
* Python Enhancement Proposals; PEP 489 <53>: Core and Builtins<157>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 489 <54>: Core and Builtins<158>.
                                                             (line   29)
* Python Enhancement Proposals; PEP 489 <55>: Core and Builtins<158>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 489 <56>: Core and Builtins<158>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 489 <57>: Core and Builtins<158>.
                                                             (line   55)
* Python Enhancement Proposals; PEP 489 <58>: Core and Builtins<158>.
                                                             (line   58)
* Python Enhancement Proposals; PEP 489 <59>: Core and Builtins<159>.
                                                             (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  312)
* Python Enhancement Proposals; PEP 489 <63>: importlib machinery -- Importers and path hooks.
                                                             (line  330)
* Python Enhancement Proposals; PEP 489 <64>: importlib machinery -- Importers and path hooks.
                                                             (line  337)
* Python Enhancement Proposals; PEP 489 <65>: importlib util -- Utility code for importers.
                                                             (line  182)
* Python Enhancement Proposals; PEP 489 <66>: Extension export hook.
                                                             (line   89)
* Python Enhancement Proposals; PEP 489 <67>: 多段階初期化.  (line   36)
* Python Enhancement Proposals; PEP 489 <68>: 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<175>.
                                                             (line   98)
* Python Enhancement Proposals; PEP 492 <7>: ライブラリ<193>.
                                                             (line   51)
* Python Enhancement Proposals; PEP 492 <8>: ライブラリ<199>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 492 <9>: Core and Builtins<205>.
                                                             (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  125)
* Python Enhancement Proposals; PEP 492 <18>: 用語集<2>.     (line  132)
* Python Enhancement Proposals; PEP 492 <19>: 用語集<2>.     (line  142)
* Python Enhancement Proposals; PEP 492 <20>: 用語集<2>.     (line  193)
* Python Enhancement Proposals; PEP 492 <21>: 用語集<2>.     (line  393)
* Python Enhancement Proposals; PEP 492 <22>: 用語集<2>.     (line  401)
* 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>: ライブラリ<191>.
                                                             (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<193>.
                                                             (line  283)
* Python Enhancement Proposals; PEP 498 <3>: f-strings.      (line  150)
* Python Enhancement Proposals; PEP 498 <4>: 用語集<2>.      (line  579)
* 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>: ライブラリ<194>.
                                                             (line   60)
* Python Enhancement Proposals; PEP 506 <2>: secrets --- 機密を扱うために安全な乱数を生成する.
                                                             (line   23)
* Python Enhancement Proposals; PEP 509: C API<17>.          (line   16)
* Python Enhancement Proposals; PEP 511: Python API の変更<9>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 514: Windows py exe ランチャーの改善.
                                                             (line    7)
* Python Enhancement Proposals; PEP 514 <1>: Windows<31>.    (line   13)
* Python Enhancement Proposals; PEP 514 <2>: Windows<74>.    (line    8)
* Python Enhancement Proposals; PEP 514 <3>: コマンドラインから起動する.
                                                             (line   46)
* Python Enhancement Proposals; PEP 515: fractions<4>.       (line    6)
* Python Enhancement Proposals; PEP 515 <1>: PEP 515 数値リテラル内のアンダースコア.
                                                             (line    6)
* Python Enhancement Proposals; PEP 515 <2>: PEP 515 数値リテラル内のアンダースコア.
                                                             (line   31)
* Python Enhancement Proposals; PEP 515 <3>: Core and Builtins<189>.
                                                             (line   15)
* Python Enhancement Proposals; PEP 515 <4>: Core and Builtins<189>.
                                                             (line   43)
* Python Enhancement Proposals; PEP 515 <5>: Format specification mini-language.
                                                             (line  153)
* Python Enhancement Proposals; PEP 515 <6>: fractions --- 有理数.
                                                             (line   93)
* Python Enhancement Proposals; PEP 519: PEP 519 ファイルシステムパスプロトコルの追加.
                                                             (line   62)
* Python Enhancement Proposals; PEP 519 <1>: ライブラリ<191>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 519 <2>: Core and Builtins<192>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 519 <3>: ライブラリ<193>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 519 <4>: ライブラリ<193>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 519 <5>: ライブラリ<193>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 519 <6>: C API<75>.      (line    6)
* Python Enhancement Proposals; PEP 519 <7>: 用語集<2>.      (line 1412)
* 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<67>.
                                                             (line   23)
* Python Enhancement Proposals; PEP 523 <6>: Tools/Demos<41>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 523 <7>: Tools/Demos<45>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 523 <8>: Core and Builtins<189>.
                                                             (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<11>.         (line   20)
* Python Enhancement Proposals; PEP 524 <2>: os<11>.         (line   25)
* Python Enhancement Proposals; PEP 524 <3>: ライブラリ<190>.
                                                             (line  150)
* Python Enhancement Proposals; PEP 524 <4>: ライブラリ<190>.
                                                             (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<189>.
                                                             (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 1099)
* Python Enhancement Proposals; PEP 525 <5>: sys --- システム固有のパラメーターと関数.
                                                             (line 1955)
* 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  125)
* Python Enhancement Proposals; PEP 526: その他の言語変更<4>.
                                                             (line   56)
* Python Enhancement Proposals; PEP 526 <1>: ast<7>.         (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<12>.     (line   23)
* Python Enhancement Proposals; PEP 526 <5>: Core and Builtins<189>.
                                                             (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   19)
* 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 1858)
* Python Enhancement Proposals; PEP 528: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更.
                                                             (line   17)
* Python Enhancement Proposals; PEP 528 <1>: UTF-8 モード.   (line   37)
* Python Enhancement Proposals; PEP 528 <2>: グローバルな設定変数.
                                                             (line  170)
* Python Enhancement Proposals; PEP 528 <3>: PyConfig.       (line  566)
* Python Enhancement Proposals; PEP 529: Python API の変更<6>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 529 <1>: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更.
                                                             (line   22)
* Python Enhancement Proposals; PEP 529 <2>: ドキュメント<29>.
                                                             (line   29)
* Python Enhancement Proposals; PEP 529 <3>: ライブラリ<162>.
                                                             (line  619)
* Python Enhancement Proposals; PEP 529 <4>: Windows<69>.    (line   14)
* Python Enhancement Proposals; PEP 529 <5>: 環境変数.       (line  387)
* Python Enhancement Proposals; PEP 529 <6>: UTF-8 モード.   (line   40)
* Python Enhancement Proposals; PEP 529 <7>: ファイルとディレクトリ.
                                                             (line  312)
* Python Enhancement Proposals; PEP 529 <8>: sys --- システム固有のパラメーターと関数.
                                                             (line  854)
* Python Enhancement Proposals; PEP 529 <9>: ファイルシステムエンコーディング.
                                                             (line    7)
* Python Enhancement Proposals; PEP 529 <10>: グローバルな設定変数.
                                                             (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<189>.
                                                             (line  145)
* Python Enhancement Proposals; PEP 530 <3>: リスト、集合、辞書の表示.
                                                             (line   54)
* 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>: Core and Builtins<15>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 538 <5>: ドキュメント<56>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 538 <6>: ドキュメント<57>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 538 <7>: Core and Builtins<176>.
                                                             (line  134)
* Python Enhancement Proposals; PEP 538 <8>: 環境変数.       (line  456)
* Python Enhancement Proposals; PEP 538 <9>: 一般的なオプション.
                                                             (line   89)
* Python Enhancement Proposals; PEP 538 <10>: locale --- 国際化サービス.
                                                             (line  527)
* Python Enhancement Proposals; PEP 538 <11>: 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<64>.      (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<173>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 540 <3>: Python UTF-8 Mode.
                                                             (line    6)
* Python Enhancement Proposals; PEP 540 <4>: locale --- 国際化サービス.
                                                             (line  527)
* Python Enhancement Proposals; PEP 540 <5>: Python Configuration.
                                                             (line   14)
* Python Enhancement Proposals; PEP 544: typing<11>.         (line   32)
* Python Enhancement Proposals; PEP 544 <1>: 名前的部分型 vs 構造的部分型.
                                                             (line   24)
* Python Enhancement Proposals; PEP 544 <2>: Other special directives.
                                                             (line  145)
* 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>: ライブラリ<167>.
                                                             (line  794)
* Python Enhancement Proposals; PEP 552 <4>: Core and Builtins<173>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 552 <5>: はじめに<13>.   (line   85)
* Python Enhancement Proposals; PEP 552 <6>: py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   83)
* Python Enhancement Proposals; PEP 552 <7>: PyConfig.       (line  274)
* Python Enhancement Proposals; PEP 553: PEP 553 組み込みの breakpoint.
                                                             (line   20)
* Python Enhancement Proposals; PEP 553 <1>: Core and Builtins<175>.
                                                             (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<7>.       (line   12)
* Python Enhancement Proposals; PEP 560 <2>: Core and Builtins<173>.
                                                             (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>: ライブラリ<174>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 562 <2>: Core and Builtins<173>.
                                                             (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>: ライブラリ<124>.
                                                             (line  300)
* Python Enhancement Proposals; PEP 563 <4>: Core and Builtins<139>.
                                                             (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>: ライブラリ<176>.
                                                             (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<12>.    (line   19)
* Python Enhancement Proposals; PEP 567 <2>: ドキュメント<56>.
                                                             (line   86)
* Python Enhancement Proposals; PEP 567 <3>: ドキュメント<58>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 567 <4>: Core and Builtins<172>.
                                                             (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  109)
* 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<163>.
                                                             (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<74>.
                                                             (line   40)
* Python Enhancement Proposals; PEP 572 <4>: ドキュメント<47>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 572 <5>: Core and Builtins<161>.
                                                             (line  184)
* Python Enhancement Proposals; PEP 572 <6>: Core and Builtins<166>.
                                                             (line   92)
* Python Enhancement Proposals; PEP 572 <7>: 辞書表示.       (line   56)
* 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<155>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 573 <3>: C API<48>.      (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   19)
* Python Enhancement Proposals; PEP 578 <2>: 監査イベント表. (line    9)
* Python Enhancement Proposals; PEP 578 <3>: sys --- システム固有のパラメーターと関数.
                                                             (line   98)
* Python Enhancement Proposals; PEP 578 <4>: システム関数.   (line  182)
* Python Enhancement Proposals; PEP 584: 概要 -- リリースハイライト<6>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 584 <1>: 辞書のマージと更新演算子.
                                                             (line   19)
* Python Enhancement Proposals; PEP 584 <2>: ライブラリ<157>.
                                                             (line  193)
* Python Enhancement Proposals; PEP 584 <3>: ライブラリ<157>.
                                                             (line  196)
* Python Enhancement Proposals; PEP 584 <4>: ライブラリ<157>.
                                                             (line  210)
* Python Enhancement Proposals; PEP 584 <5>: ライブラリ<158>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 584 <6>: ライブラリ<158>.
                                                             (line   62)
* Python Enhancement Proposals; PEP 584 <7>: ライブラリ<158>.
                                                             (line  120)
* Python Enhancement Proposals; PEP 584 <8>: ライブラリ<158>.
                                                             (line  142)
* Python Enhancement Proposals; PEP 584 <9>: ChainMap オブジェクト.
                                                             (line   88)
* Python Enhancement Proposals; PEP 584 <10>: defaultdict オブジェクト.
                                                             (line   60)
* Python Enhancement Proposals; PEP 584 <11>: OrderedDict オブジェクト.
                                                             (line  111)
* Python Enhancement Proposals; PEP 584 <12>: weakref --- Weak references.
                                                             (line  191)
* Python Enhancement Proposals; PEP 584 <13>: weakref --- Weak references.
                                                             (line  210)
* Python Enhancement Proposals; PEP 584 <14>: 標準的なインタプリタ型.
                                                             (line  261)
* 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>: ライブラリ<79>. (line  158)
* Python Enhancement Proposals; PEP 585 <3>: ライブラリ<110>.
                                                             (line  124)
* Python Enhancement Proposals; PEP 585 <4>: ドキュメント<35>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 585 <5>: GenericAlias オブジェクトの特別な属性.
                                                             (line   55)
* Python Enhancement Proposals; PEP 585 <6>: collections abc --- コンテナの抽象基底クラス.
                                                             (line   87)
* Python Enhancement Proposals; PEP 585 <7>: 標準的なインタプリタ型.
                                                             (line  175)
* Python Enhancement Proposals; PEP 585 <8>: Introspection helpers.
                                                             (line  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  765)
* Python Enhancement Proposals; PEP 586: typing<8>.          (line    8)
* Python Enhancement Proposals; PEP 586 <1>: typing<10>.     (line    6)
* Python Enhancement Proposals; PEP 586 <2>: typing<11>.     (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<3>.
                                                             (line   15)
* Python Enhancement Proposals; PEP 587 <4>: Removed C APIs<4>.
                                                             (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<13>.      (line   31)
* Python Enhancement Proposals; PEP 587 <9>: C API<39>.      (line  124)
* Python Enhancement Proposals; PEP 587 <10>: Core and Builtins<161>.
                                                             (line   76)
* Python Enhancement Proposals; PEP 587 <11>: C API<55>.     (line    6)
* Python Enhancement Proposals; PEP 587 <12>: PyConfig C API.
                                                             (line   33)
* Python Enhancement Proposals; PEP 589: typing<11>.         (line    8)
* Python Enhancement Proposals; PEP 590: Removed C APIs<4>.  (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<57>.
                                                             (line  145)
* Python Enhancement Proposals; PEP 590 <7>: ライブラリ<69>. (line 1078)
* Python Enhancement Proposals; PEP 590 <8>: C API<24>.      (line  146)
* Python Enhancement Proposals; PEP 590 <9>: Core and Builtins<79>.
                                                             (line  112)
* Python Enhancement Proposals; PEP 590 <10>: ライブラリ<97>.
                                                             (line   69)
* Python Enhancement Proposals; PEP 590 <11>: Core and Builtins<101>.
                                                             (line   57)
* Python Enhancement Proposals; PEP 590 <12>: Core and Builtins<110>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 590 <13>: Core and Builtins<119>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 590 <14>: Core and Builtins<125>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 590 <15>: Core and Builtins<125>.
                                                             (line   59)
* Python Enhancement Proposals; PEP 590 <16>: Core and Builtins<140>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 590 <17>: Core and Builtins<140>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 590 <18>: Core and Builtins<156>.
                                                             (line   39)
* Python Enhancement Proposals; PEP 590 <19>: Core and Builtins<156>.
                                                             (line   91)
* Python Enhancement Proposals; PEP 590 <20>: Core and Builtins<157>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 590 <21>: Core and Builtins<157>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 590 <22>: Core and Builtins<157>.
                                                             (line   67)
* Python Enhancement Proposals; PEP 590 <23>: C API<55>.     (line   17)
* Python Enhancement Proposals; PEP 590 <24>: The Vectorcall Protocol.
                                                             (line    8)
* Python Enhancement Proposals; PEP 591: typing<11>.         (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<9>.      (line    6)
* Python Enhancement Proposals; PEP 593 <2>: ライブラリ<159>.
                                                             (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>: ライブラリ<69>. (line  844)
* Python Enhancement Proposals; PEP 594 <8>: ライブラリ<69>. (line  847)
* Python Enhancement Proposals; PEP 594 <9>: ライブラリ<69>. (line  850)
* Python Enhancement Proposals; PEP 594 <10>: ライブラリ<69>.
                                                             (line  858)
* Python Enhancement Proposals; PEP 594 <11>: ライブラリ<69>.
                                                             (line  862)
* Python Enhancement Proposals; PEP 594 <12>: ライブラリ<69>.
                                                             (line  868)
* Python Enhancement Proposals; PEP 594 <13>: ライブラリ<69>.
                                                             (line  871)
* Python Enhancement Proposals; PEP 594 <14>: ライブラリ<69>.
                                                             (line  886)
* Python Enhancement Proposals; PEP 594 <15>: ライブラリ<69>.
                                                             (line  889)
* Python Enhancement Proposals; PEP 594 <16>: ライブラリ<69>.
                                                             (line  896)
* Python Enhancement Proposals; PEP 594 <17>: ライブラリ<69>.
                                                             (line  899)
* Python Enhancement Proposals; PEP 594 <18>: ライブラリ<69>.
                                                             (line  902)
* Python Enhancement Proposals; PEP 594 <19>: ライブラリ<69>.
                                                             (line  905)
* Python Enhancement Proposals; PEP 594 <20>: ライブラリ<69>.
                                                             (line  908)
* Python Enhancement Proposals; PEP 594 <21>: ライブラリ<69>.
                                                             (line  963)
* Python Enhancement Proposals; PEP 594 <22>: ライブラリ<69>.
                                                             (line  966)
* Python Enhancement Proposals; PEP 594 <23>: ライブラリ<69>.
                                                             (line  969)
* Python Enhancement Proposals; PEP 594 <24>: ライブラリ<69>.
                                                             (line  972)
* Python Enhancement Proposals; PEP 594 <25>: ライブラリ<82>.
                                                             (line  105)
* Python Enhancement Proposals; PEP 594 <26>: ライブラリ<92>.
                                                             (line  680)
* Python Enhancement Proposals; PEP 594 <27>: ライブラリ<94>.
                                                             (line   93)
* Python Enhancement Proposals; PEP 594 <28>: ライブラリ<97>.
                                                             (line  124)
* Python Enhancement Proposals; PEP 594 <29>: ライブラリ<97>.
                                                             (line  150)
* Python Enhancement Proposals; PEP 594 <30>: テスト<34>.    (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>: ライブラリ<126>.
                                                             (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>: ライブラリ<134>.
                                                             (line   25)
* Python Enhancement Proposals; PEP 604 <3>: ドキュメント<44>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 604 <4>: Union 型.       (line  105)
* Python Enhancement Proposals; PEP 604 <5>: 文字列指定のアノテーションを手動で解決する方法.
                                                             (line   37)
* Python Enhancement Proposals; PEP 610: Distributions.      (line   89)
* 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>: ライブラリ<121>.
                                                             (line  691)
* Python Enhancement Proposals; PEP 612 <3>: ライブラリ<124>.
                                                             (line   95)
* Python Enhancement Proposals; PEP 612 <4>: ライブラリ<133>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 612 <5>: ライブラリ<134>.
                                                             (line   25)
* Python Enhancement Proposals; PEP 612 <6>: ライブラリ<134>.
                                                             (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  574)
* 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>: ライブラリ<140>.
                                                             (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<157>.
                                                             (line  112)
* Python Enhancement Proposals; PEP 614 <3>: 関数定義.       (line   56)
* Python Enhancement Proposals; PEP 614 <4>: クラス定義.     (line   64)
* Python Enhancement Proposals; PEP 615: 概要 -- リリースハイライト<6>.
                                                             (line   53)
* Python Enhancement Proposals; PEP 615 <1>: zoneinfo.       (line   37)
* Python Enhancement Proposals; PEP 615 <2>: ライブラリ<156>.
                                                             (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<156>.
                                                             (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>: ライブラリ<121>.
                                                             (line  178)
* Python Enhancement Proposals; PEP 617 <7>: ライブラリ<157>.
                                                             (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<151>.
                                                             (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<32>.      (line   21)
* Python Enhancement Proposals; PEP 623 <5>: Core and Builtins<126>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 623 <6>: ドキュメント<39>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 623 <7>: Unicode オブジェクト.
                                                             (line   16)
* Python Enhancement Proposals; PEP 624: 概要 -- リリースハイライト<4>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 624 <1>: 削除<5>.        (line   97)
* Python Enhancement Proposals; PEP 624 <2>: 概要 -- リリースハイライト<5>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 624 <3>: C API<39>.      (line  142)
* Python Enhancement Proposals; PEP 624#alternative-apis: 削除<5>.
                                                             (line   97)
* Python Enhancement Proposals; PEP 626: types<2>.           (line    6)
* Python Enhancement Proposals; PEP 626 <1>: Pending removal in Python 3 15.
                                                             (line   67)
* Python Enhancement Proposals; PEP 626 <2>: Pending removal in Python 3 15<3>.
                                                             (line   67)
* Python Enhancement Proposals; PEP 626 <3>: 非推奨<2>.      (line  226)
* Python Enhancement Proposals; PEP 626 <4>: Pending removal in Python 3 15<5>.
                                                             (line   67)
* Python Enhancement Proposals; PEP 626 <5>: 概要 -- リリースハイライト<5>.
                                                             (line   22)
* Python Enhancement Proposals; PEP 626 <6>: Core and Builtins<2>.
                                                             (line  207)
* Python Enhancement Proposals; PEP 626 <7>: Core and Builtins<87>.
                                                             (line   45)
* Python Enhancement Proposals; PEP 626 <8>: Methods on code objects.
                                                             (line   81)
* Python Enhancement Proposals; PEP 626 <9>: 解析関数.       (line  179)
* Python Enhancement Proposals; PEP 626 <10>: Pending removal in Python 3 15<7>.
                                                             (line   67)
* Python Enhancement Proposals; PEP 628: cmath.              (line    7)
* Python Enhancement Proposals; PEP 628 <1>: math<9>.        (line    7)
* Python Enhancement Proposals; PEP 628 <2>: ライブラリ<191>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 630: C API<17>.          (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>: ライブラリ<82>. (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<91>.
                                                             (line   55)
* Python Enhancement Proposals; PEP 634 <3>: Core and Builtins<122>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 634 <4>: Core and Builtins<127>.
                                                             (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  953)
* Python Enhancement Proposals; PEP 634 <9>: PyTypeObject スロット.
                                                             (line  977)
* 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<2>.         (line    8)
* Python Enhancement Proposals; PEP 644 <1>: 概要 -- リリースハイライト<5>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 644 <2>: hashlib<4>.     (line    7)
* Python Enhancement Proposals; PEP 644 <3>: ssl<5>.         (line    7)
* Python Enhancement Proposals; PEP 644 <4>: Build Changes<4>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 644 <5>: Core and Builtins<64>.
                                                             (line  167)
* Python Enhancement Proposals; PEP 644 <6>: ライブラリ<92>. (line  523)
* Python Enhancement Proposals; PEP 644 <7>: ビルド<44>.     (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  266)
* 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  358)
* 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>: ライブラリ<124>.
                                                             (line  182)
* Python Enhancement Proposals; PEP 647 <3>: 特殊形式.       (line  583)
* 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<3>.      (line   28)
* Python Enhancement Proposals; PEP 649 <5>: Changes in annotations PEP 649 and PEP 749.
                                                             (line    6)
* Python Enhancement Proposals; PEP 649 <6>: ライブラリ<51>. (line  790)
* Python Enhancement Proposals; PEP 649 <7>: Core and Builtins<54>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 649 <8>: Core and Builtins<54>.
                                                             (line  115)
* Python Enhancement Proposals; PEP 649 <9>: Core and Builtins<54>.
                                                             (line  134)
* Python Enhancement Proposals; PEP 649 <10>: Special writable attributes.
                                                             (line   52)
* Python Enhancement Proposals; PEP 649 <11>: Other writable attributes on module objects.
                                                             (line   21)
* Python Enhancement Proposals; PEP 649 <12>: Special attributes.
                                                             (line   67)
* Python Enhancement Proposals; PEP 649 <13>: Annotations.   (line   48)
* Python Enhancement Proposals; PEP 649 <14>: Annotation scopes.
                                                             (line   63)
* Python Enhancement Proposals; PEP 649 <15>: 定数<10>.      (line   15)
* Python Enhancement Proposals; PEP 649 <16>: モジュールコンテンツ<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<40>.      (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<84>.
                                                             (line   23)
* Python Enhancement Proposals; PEP 654 <4>: Core and Builtins<107>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 654 <5>: Core and Builtins<110>.
                                                             (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>: ライブラリ<94>. (line  265)
* 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  526)
* Python Enhancement Proposals; PEP 657: PEP 657 トレースバックのエラー位置の詳細化.
                                                             (line   54)
* Python Enhancement Proposals; PEP 657 <1>: inspect<4>.     (line   17)
* Python Enhancement Proposals; PEP 657 <2>: ライブラリ<94>. (line  222)
* Python Enhancement Proposals; PEP 657 <3>: Core and Builtins<118>.
                                                             (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 661: Summary -- Release highlights.
                                                             (line   11)
* Python Enhancement Proposals; PEP 661 <1>: PEP 661 Add sentinel built-in type.
                                                             (line    3)
* Python Enhancement Proposals; PEP 661 <2>: PEP 661 Add sentinel built-in type.
                                                             (line   16)
* Python Enhancement Proposals; PEP 661 <3>: Core and Builtins<2>.
                                                             (line   53)
* Python Enhancement Proposals; PEP 667: types.              (line    8)
* Python Enhancement Proposals; PEP 667 <1>: New deprecations<2>.
                                                             (line  116)
* Python Enhancement Proposals; PEP 667 <2>: 概要 -- リリースハイライト<2>.
                                                             (line   38)
* Python Enhancement Proposals; PEP 667 <3>: Defined mutation semantics for locals.
                                                             (line    8)
* Python Enhancement Proposals; PEP 667 <4>: Defined mutation semantics for locals.
                                                             (line   41)
* Python Enhancement Proposals; PEP 667 <5>: Deprecated C APIs<4>.
                                                             (line   30)
* Python Enhancement Proposals; PEP 667 <6>: Python API の変更<2>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 667 <7>: Python API の変更<2>.
                                                             (line   26)
* Python Enhancement Proposals; PEP 667 <8>: Python API の変更<2>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 667 <9>: ライブラリ<15>. (line  551)
* Python Enhancement Proposals; PEP 667 <10>: 組み込み関数.  (line 1147)
* Python Enhancement Proposals; PEP 667 <11>: 標準的なインタプリタ型.
                                                             (line  212)
* Python Enhancement Proposals; PEP 667 <12>: コマンドライン・インターフェース<8>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 667 <13>: リフレクション.
                                                             (line   40)
* Python Enhancement Proposals; PEP 667 <14>: フレーム frame オブジェクト<2>.
                                                             (line  138)
* Python Enhancement Proposals; PEP 667 <15>: Frame locals proxies.
                                                             (line   14)
* Python Enhancement Proposals; PEP 667 <16>: 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<68>.
                                                             (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>: ライブラリ<101>.
                                                             (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>: ライブラリ<97>. (line   59)
* Python Enhancement Proposals; PEP 675 <2>: 特殊型.         (line   95)
* Python Enhancement Proposals; PEP 676: ドキュメント<30>.   (line    8)
* Python Enhancement Proposals; PEP 678: その他の言語変更<2>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 678 <1>: PEP 678 ノートによって例外を充実させる.
                                                             (line   11)
* Python Enhancement Proposals; PEP 678 <2>: Core and Builtins<68>.
                                                             (line   48)
* Python Enhancement Proposals; PEP 678 <3>: Core and Builtins<70>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 678 <4>: Core and Builtins<91>.
                                                             (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>: ライブラリ<97>. (line  205)
* Python Enhancement Proposals; PEP 681: PEP 681 Data class transforms.
                                                             (line   30)
* Python Enhancement Proposals; PEP 681 <1>: ライブラリ<94>. (line  109)
* 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<67>.
                                                             (line   70)
* Python Enhancement Proposals; PEP 683 <2>: 参照カウント.   (line  136)
* Python Enhancement Proposals; PEP 683 <3>: 用語集<2>.      (line  842)
* 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 1221)
* 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: Summary -- Release highlights.
                                                             (line   24)
* Python Enhancement Proposals; PEP 686 <1>: Other language changes<2>.
                                                             (line   28)
* Python Enhancement Proposals; PEP 686 <2>: Core and Builtins<26>.
                                                             (line   72)
* Python Enhancement Proposals; PEP 686 <3>: UTF-8 モード.   (line    8)
* Python Enhancement Proposals; PEP 686 <4>: Python UTF-8 Mode.
                                                             (line    8)
* Python Enhancement Proposals; PEP 686 <5>: Text Encoding.  (line   32)
* Python Enhancement Proposals; PEP 687: ライブラリ<65>.     (line  137)
* Python Enhancement Proposals; PEP 687 <1>: Core and Builtins<66>.
                                                             (line  326)
* Python Enhancement Proposals; PEP 687 <2>: ライブラリ<72>. (line  293)
* Python Enhancement Proposals; PEP 687 <3>: ライブラリ<72>. (line  300)
* Python Enhancement Proposals; PEP 687 <4>: ライブラリ<72>. (line  333)
* Python Enhancement Proposals; PEP 687 <5>: ライブラリ<72>. (line  336)
* Python Enhancement Proposals; PEP 687 <6>: ライブラリ<72>. (line  346)
* Python Enhancement Proposals; PEP 687 <7>: ライブラリ<72>. (line  403)
* Python Enhancement Proposals; PEP 687 <8>: ライブラリ<74>. (line    6)
* Python Enhancement Proposals; PEP 687 <9>: ライブラリ<75>. (line  111)
* Python Enhancement Proposals; PEP 687 <10>: ライブラリ<75>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 688: PEP 688 バッファプロトコルを Python で利用可能にする.
                                                             (line    6)
* Python Enhancement Proposals; PEP 688 <1>: Core and Builtins<68>.
                                                             (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   33)
* Python Enhancement Proposals; PEP 688#current-options <1>: Pending removal in Python 3 17.
                                                             (line   77)
* Python Enhancement Proposals; PEP 688#current-options <2>: Pending removal in Python 3 17<2>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 688#current-options <3>: Pending removal in Python 3 17<2>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 688#current-options <4>: Pending removal in Python 3 17<3>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 688#current-options <5>: Pending removal in Python 3 17<3>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 688#current-options <6>: 非推奨<2>.
                                                             (line   70)
* Python Enhancement Proposals; PEP 688#current-options <7>: Pending removal in Python 3 17<4>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 688#current-options <8>: Pending removal in Python 3 17<4>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 688#current-options <9>: コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  114)
* Python Enhancement Proposals; PEP 688#current-options <10>: Aliases to container ABCs in collections abc.
                                                             (line   33)
* Python Enhancement Proposals; PEP 688#current-options <11>: Pending removal in Python 3 17<5>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 688#current-options <12>: Pending removal in Python 3 17<5>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 689: C API<27>.          (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>: ライブラリ<72>. (line  120)
* Python Enhancement Proposals; PEP 692 <3>: ドキュメント<21>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 692 <4>: 特殊形式.       (line  663)
* 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>: ライブラリ<51>. (line  813)
* Python Enhancement Proposals; PEP 695 <4>: ライブラリ<60>. (line  123)
* Python Enhancement Proposals; PEP 695 <5>: ライブラリ<69>. (line   95)
* Python Enhancement Proposals; PEP 695 <6>: ライブラリ<69>. (line  660)
* Python Enhancement Proposals; PEP 695 <7>: ライブラリ<69>. (line  855)
* Python Enhancement Proposals; PEP 695 <8>: ライブラリ<69>. (line  948)
* Python Enhancement Proposals; PEP 695 <9>: Core and Builtins<67>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 695 <10>: Core and Builtins<67>.
                                                             (line  105)
* Python Enhancement Proposals; PEP 695 <11>: ライブラリ<72>.
                                                             (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  423)
* Python Enhancement Proposals; PEP 695 <18>: Building generic types and type aliases.
                                                             (line  563)
* 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<57>.
                                                             (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: PEP 803 -- Stable ABI for free-threaded builds.
                                                             (line   11)
* Python Enhancement Proposals; PEP 697 <1>: 新しい機能<5>.  (line    6)
* Python Enhancement Proposals; PEP 697 <2>: 新しい機能<5>.  (line   33)
* Python Enhancement Proposals; PEP 697 <3>: C API<25>.      (line   38)
* Python Enhancement Proposals; PEP 698: PEP 698 Override Decorator for Static Typing.
                                                             (line   30)
* Python Enhancement Proposals; PEP 698 <1>: ライブラリ<75>. (line  100)
* Python Enhancement Proposals; PEP 698 <2>: Functions and decorators.
                                                             (line  393)
* 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<17>.      (line   15)
* Python Enhancement Proposals; PEP 699 <4>: ビルド<28>.     (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<2>.    (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<2>.    (line    6)
* Python Enhancement Proposals; PEP 702 <2>: ライブラリ<67>. (line  469)
* Python Enhancement Proposals; PEP 702 <3>: 利用可能な関数. (line  194)
* 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<16>.      (line   21)
* Python Enhancement Proposals; PEP 703 <6>: Core and Builtins<54>.
                                                             (line  169)
* Python Enhancement Proposals; PEP 703 <7>: Core and Builtins<60>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 703 <8>: C API<23>.      (line  137)
* Python Enhancement Proposals; PEP 703 <9>: Installing free-threaded binaries<2>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 703 <10>: フリースレッドバイナリ Free-threaded Binaries のインストール.
                                                             (line    9)
* Python Enhancement Proposals; PEP 703 <11>: GIL and performance considerations.
                                                             (line   16)
* Python Enhancement Proposals; PEP 703 <12>: Python support for free threading.
                                                             (line   26)
* Python Enhancement Proposals; PEP 703 <13>: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？.
                                                             (line   12)
* Python Enhancement Proposals; PEP 703 <14>: 用語集<2>.     (line  649)
* Python Enhancement Proposals; PEP 703 <15>: 用語集<2>.     (line  792)
* Python Enhancement Proposals; PEP 705: 概要 -- リリースハイライト<2>.
                                                             (line  123)
* Python Enhancement Proposals; PEP 705 <1>: typing<4>.      (line    6)
* Python Enhancement Proposals; PEP 705 <2>: ライブラリ<65>. (line   17)
* Python Enhancement Proposals; PEP 705 <3>: 特殊形式.       (line  295)
* Python Enhancement Proposals; PEP 705 <4>: Other special directives.
                                                             (line  534)
* Python Enhancement Proposals; PEP 706: その他の言語変更<2>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 706 <1>: tarfile<4>.     (line   13)
* Python Enhancement Proposals; PEP 706 <2>: tarfile<5>.     (line   13)
* Python Enhancement Proposals; PEP 706 <3>: tarfile<6>.     (line   13)
* Python Enhancement Proposals; PEP 706 <4>: tarfile<8>.     (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<68>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 709 <5>: 組み込み関数.   (line 1145)
* Python Enhancement Proposals; PEP 719: What's New In Python 3 13.
                                                             (line   16)
* Python Enhancement Proposals; PEP 728: Summary -- Release highlights.
                                                             (line   29)
* Python Enhancement Proposals; PEP 728 <1>: typing.         (line   23)
* Python Enhancement Proposals; PEP 728 <2>: ライブラリ<15>. (line  313)
* Python Enhancement Proposals; PEP 728 <3>: Other special directives.
                                                             (line  537)
* 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>: ライブラリ<15>. (line  840)
* Python Enhancement Proposals; PEP 734 <4>: ライブラリ<47>. (line  348)
* Python Enhancement Proposals; PEP 734 <5>: ライブラリ<60>. (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 1221)
* Python Enhancement Proposals; PEP 737: Changed C APIs<2>.  (line   44)
* Python Enhancement Proposals; PEP 737 <1>: C API<19>.      (line    6)
* Python Enhancement Proposals; PEP 737 <2>: C API<19>.      (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>: ライブラリ<60>. (line   54)
* Python Enhancement Proposals; PEP 739: build-details json. (line   19)
* Python Enhancement Proposals; PEP 739 <1>: Windows.        (line   12)
* Python Enhancement Proposals; PEP 739 <2>: ビルド<8>.      (line   52)
* Python Enhancement Proposals; PEP 739 <3>: ビルド<8>.      (line   60)
* Python Enhancement Proposals; PEP 739 <4>: Core and Builtins<34>.
                                                             (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<13>.      (line   27)
* Python Enhancement Proposals; PEP 741 <3>: C API<17>.      (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<4>.      (line    9)
* Python Enhancement Proposals; PEP 742 <2>: ライブラリ<60>. (line  239)
* Python Enhancement Proposals; PEP 742 <3>: 特殊形式.       (line  561)
* 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 747: Summary -- Release highlights.
                                                             (line   31)
* Python Enhancement Proposals; PEP 747 <1>: typing.         (line    6)
* Python Enhancement Proposals; PEP 747 <2>: ライブラリ<4>.  (line   53)
* Python Enhancement Proposals; PEP 747 <3>: 特殊形式.       (line  471)
* 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>: ライブラリ<51>. (line  528)
* Python Enhancement Proposals; PEP 749 <6>: ライブラリ<51>. (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>: ライブラリ<15>. (line 1151)
* Python Enhancement Proposals; PEP 750 <4>: Core and Builtins<22>.
                                                             (line   23)
* Python Enhancement Proposals; PEP 750 <5>: Core and Builtins<30>.
                                                             (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<13>.      (line   76)
* Python Enhancement Proposals; PEP 757 <2>: C API<15>.      (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>: ライブラリ<30>. (line    6)
* Python Enhancement Proposals; PEP 758 <3>: Core and Builtins<32>.
                                                             (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<14>.
                                                             (line   80)
* 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<24>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 768 <4>: Core and Builtins<30>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 768 <5>: Core and Builtins<32>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 768 <6>: その他のオプション.
                                                             (line  398)
* Python Enhancement Proposals; PEP 768 <7>: その他のオプション.
                                                             (line  405)
* Python Enhancement Proposals; PEP 768 <8>: 環境変数.       (line  528)
* Python Enhancement Proposals; PEP 768 <9>: パフォーマンスに関するオプション.
                                                             (line  216)
* Python Enhancement Proposals; PEP 768 <10>: パフォーマンスに関するオプション.
                                                             (line  219)
* Python Enhancement Proposals; PEP 768 <11>: sys --- システム固有のパラメーターと関数.
                                                             (line 2054)
* Python Enhancement Proposals; PEP 776: 概要 -- リリースハイライト.
                                                             (line   69)
* Python Enhancement Proposals; PEP 776 <1>: Build changes<3>.
                                                             (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 782: Summary -- Release highlights.
                                                             (line   35)
* Python Enhancement Proposals; PEP 782 <1>: New features<4>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 782 <2>: C API<9>.       (line   19)
* 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 788: Summary -- Release highlights.
                                                             (line   41)
* Python Enhancement Proposals; PEP 788 <1>: PEP 788 Protecting the C API from interpreter finalization.
                                                             (line    3)
* Python Enhancement Proposals; PEP 788 <2>: PEP 788 Protecting the C API from interpreter finalization.
                                                             (line   33)
* Python Enhancement Proposals; PEP 788 <3>: C API<2>.       (line   15)
* Python Enhancement Proposals; PEP 788 <4>: Cautions regarding interpreter finalization.
                                                             (line   34)
* Python Enhancement Proposals; PEP 788 <5>: Using the C API from foreign threads.
                                                             (line   62)
* Python Enhancement Proposals; PEP 791: math integer.       (line    7)
* Python Enhancement Proposals; PEP 791 <1>: ライブラリ<9>.  (line  355)
* Python Enhancement Proposals; PEP 793: Summary -- Release highlights.
                                                             (line   38)
* Python Enhancement Proposals; PEP 793 <1>: PEP 803 -- Stable ABI for free-threaded builds.
                                                             (line   17)
* Python Enhancement Proposals; PEP 793 <2>: New features<4>.
                                                             (line   87)
* Python Enhancement Proposals; PEP 793 <3>: Core and Builtins<8>.
                                                             (line  122)
* Python Enhancement Proposals; PEP 793 <4>: C API<8>.       (line   23)
* Python Enhancement Proposals; PEP 798: Summary -- Release highlights.
                                                             (line   22)
* Python Enhancement Proposals; PEP 798 <1>: PEP 798 Unpacking in comprehensions.
                                                             (line    3)
* Python Enhancement Proposals; PEP 798 <2>: PEP 798 Unpacking in comprehensions.
                                                             (line   39)
* Python Enhancement Proposals; PEP 798 <3>: Core and Builtins<5>.
                                                             (line  116)
* Python Enhancement Proposals; PEP 799: Summary -- Release highlights.
                                                             (line   13)
* Python Enhancement Proposals; PEP 799 <1>: Summary -- Release highlights.
                                                             (line   16)
* Python Enhancement Proposals; PEP 799 <2>: PEP 799 A dedicated profiling package.
                                                             (line    3)
* Python Enhancement Proposals; PEP 799 <3>: PEP 799 A dedicated profiling package.
                                                             (line   22)
* Python Enhancement Proposals; PEP 799 <4>: ライブラリ<15>. (line  291)
* Python Enhancement Proposals; PEP 8:   ライブラリの変更.   (line   25)
* Python Enhancement Proposals; PEP 8 <1>: ライブラリ<176>.  (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 1871)
* 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 Enhancement Proposals; PEP 800: Summary -- Release highlights.
                                                             (line   33)
* Python Enhancement Proposals; PEP 800 <1>: typing.         (line   40)
* Python Enhancement Proposals; PEP 800 <2>: ライブラリ<2>.  (line  218)
* Python Enhancement Proposals; PEP 803: Summary -- Release highlights.
                                                             (line   38)
* Python Enhancement Proposals; PEP 803 <1>: PEP 803 -- Stable ABI for free-threaded builds.
                                                             (line    3)
* Python Enhancement Proposals; PEP 803 <2>: PEP 803 -- Stable ABI for free-threaded builds.
                                                             (line   40)
* Python Enhancement Proposals; PEP 803 <3>: C API<2>.       (line   28)
* Python Enhancement Proposals; PEP 803 <4>: Stable Application Binary Interfaces.
                                                             (line   22)
* Python Enhancement Proposals; PEP 810: Summary -- Release highlights.
                                                             (line    6)
* Python Enhancement Proposals; PEP 810 <1>: PEP 810 Explicit lazy imports.
                                                             (line    3)
* Python Enhancement Proposals; PEP 810 <2>: PEP 810 Explicit lazy imports.
                                                             (line  107)
* Python Enhancement Proposals; PEP 810 <3>: Core and Builtins<4>.
                                                             (line  136)
* Python Enhancement Proposals; PEP 810 <4>: Lazy imports.   (line   41)
* Python Enhancement Proposals; PEP 810 <5>: 標準的なインタプリタ型.
                                                             (line  226)
* Python Enhancement Proposals; PEP 810 <6>: sys --- システム固有のパラメーターと関数.
                                                             (line  898)
* Python Enhancement Proposals; PEP 810 <7>: sys --- システム固有のパラメーターと関数.
                                                             (line 1714)
* Python Enhancement Proposals; PEP 810 <8>: sys --- システム固有のパラメーターと関数.
                                                             (line 1747)
* Python Enhancement Proposals; PEP 814: Summary -- Release highlights.
                                                             (line    9)
* Python Enhancement Proposals; PEP 814 <1>: PEP 814 Add frozendict built-in type.
                                                             (line    3)
* Python Enhancement Proposals; PEP 814 <2>: PEP 814 Add frozendict built-in type.
                                                             (line   46)
* Python Enhancement Proposals; PEP 820: Summary -- Release highlights.
                                                             (line   38)
* Python Enhancement Proposals; PEP 820 <1>: PEP 803 -- Stable ABI for free-threaded builds.
                                                             (line   18)
* Python Enhancement Proposals; PEP 820 <2>: New features<4>.
                                                             (line  104)
* Python Enhancement Proposals; PEP 820 <3>: C API<2>.       (line   17)
* Python Enhancement Proposals; PEP 829: Summary -- Release highlights.
                                                             (line   27)
* Python Enhancement Proposals; PEP 829 <1>: PEP 829 Package startup configuration files.
                                                             (line    3)
* Python Enhancement Proposals; PEP 829 <2>: Pending removal in Python 3 18.
                                                             (line   16)
* Python Enhancement Proposals; PEP 829 <3>: Pending removal in Python 3 20.
                                                             (line   69)
* Python Enhancement Proposals; PEP 829 <4>: Pending removal in Python 3 18<2>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 829 <5>: Pending removal in Python 3 20<2>.
                                                             (line   69)
* Python Enhancement Proposals; PEP 829 <6>: Pending removal in Python 3 18<4>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 829 <7>: Pending removal in Python 3 20<3>.
                                                             (line   69)
* Python Enhancement Proposals; PEP 829 <8>: Pending removal in Python 3 20<4>.
                                                             (line   69)
* Python Enhancement Proposals; PEP 829 <9>: ライブラリ<2>.  (line  214)
* Python Enhancement Proposals; PEP 829 <10>: Startup entry points start files.
                                                             (line   33)
* Python Enhancement Proposals; PEP 829 <11>: Migrating from import lines in pth files to start files.
                                                             (line   15)
* Python Enhancement Proposals; PEP 829 <12>: コマンドライン・インターフェース<12>.
                                                             (line   39)
* Python Enhancement Proposals; PEP 829 <13>: Pending removal in Python 3 18<6>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 829 <14>: Pending removal in Python 3 20<5>.
                                                             (line   69)
* Python Enhancement Proposals; PEP 831: Summary -- Release highlights.
                                                             (line   19)
* Python Enhancement Proposals; PEP 831 <1>: PEP 831 Frame pointers enabled by default.
                                                             (line    3)
* Python Enhancement Proposals; PEP 831 <2>: PEP 831 Frame pointers enabled by default.
                                                             (line   33)
* Python Enhancement Proposals; PEP 831 <3>: Build changes<2>.
                                                             (line   34)
* Python Enhancement Proposals; PEP 831 <4>: パフォーマンスに関するオプション.
                                                             (line  116)
* PYTHON_ABI_STRING (C macro):           Module definition struct.
                                                             (line  237)
* PYTHON_ABI_VERSION (C macro):          Module definition struct.
                                                             (line  237)
* PYTHON_API_STRING (C macro):           Module definition struct.
                                                             (line  228)
* PYTHON_API_VERSION (C macro):          Module definition struct.
                                                             (line  228)
* PYTHON_BASIC_COMPLETER:                Default interactive shell.
                                                             (line    7)
* PYTHON_BASIC_REPL:                     Default interactive shell<2>.
                                                             (line    7)
* PYTHON_BASIC_REPL <1>:                 改善された対話的インタープリタ.
                                                             (line   28)
* PYTHON_BASIC_REPL <2>:                 ライブラリ<2>.      (line  103)
* PYTHON_BASIC_REPL <3>:                 ライブラリ<51>.     (line   52)
* PYTHON_BASIC_REPL <4>:                 ライブラリ<51>.     (line   55)
* PYTHON_BASIC_REPL <5>:                 Core and Builtins<54>.
                                                             (line   13)
* PYTHON_BASIC_REPL <6>:                 対話モード<2>.      (line   21)
* PYTHON_BASIC_REPL <7>:                 使用例<2>.          (line   79)
* PYTHON_BASIC_REPL <8>:                 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_compiler() (platform モジュール): Cross platform.   (line   81)
* PYTHON_CONTEXT_AWARE_WARNINGS:         ライブラリ<29>.     (line  368)
* PYTHON_CONTEXT_AWARE_WARNINGS <1>:     その他のオプション. (line  453)
* PYTHON_CONTEXT_AWARE_WARNINGS <2>:     sys --- システム固有のパラメーターと関数.
                                                             (line  630)
* PYTHON_CONTEXT_AWARE_WARNINGS <3>:     Concurrent safety of Context Managers.
                                                             (line   41)
* PYTHON_CPU_COUNT:                      os<4>.              (line   11)
* PYTHON_CPU_COUNT <1>:                  その他のオプション. (line  413)
* PYTHON_CPU_COUNT <2>:                  雑多なシステム情報. (line   45)
* PYTHON_CPU_COUNT <3>:                  雑多なシステム情報. (line   66)
* PYTHON_CPU_COUNT <4>:                  その他<5>.          (line   32)
* PYTHON_CPU_COUNT <5>:                  PyConfig.           (line  521)
* PYTHON_DISABLE_REMOTE_DEBUG:           PEP 768 安全な外部デバッガインターフェース.
                                                             (line   39)
* PYTHON_DISABLE_REMOTE_DEBUG <1>:       その他のオプション. (line  404)
* 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<65>.
                                                             (line  105)
* PYTHON_FROZEN_MODULES <2>:             その他のオプション. (line  372)
* PYTHON_FROZEN_MODULES <3>:             PyConfig.           (line  419)
* PYTHON_GIL:                            フリースレッドの CPython.
                                                             (line   23)
* PYTHON_GIL <1>:                        フリースレッドの CPython.
                                                             (line   37)
* PYTHON_GIL <2>:                        Core and Builtins<50>.
                                                             (line   50)
* PYTHON_GIL <3>:                        その他のオプション. (line  435)
* PYTHON_GIL <4>:                        sys --- システム固有のパラメーターと関数.
                                                             (line  623)
* PYTHON_GIL <5>:                        The global interpreter lock in free-threaded Python.
                                                             (line    7)
* PYTHON_GIL <6>:                        用語集<2>.          (line  789)
* PYTHON_HISTORY:                        その他の言語変更.   (line   57)
* PYTHON_HISTORY <1>:                    ライブラリ<67>.     (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  264)
* PYTHON_JIT <2>:                        一般的なオプション. (line  267)
* PYTHON_JIT <3>:                        一般的なオプション. (line  272)
* PYTHON_JIT <4>:                        sys --- システム固有のパラメーターと関数.
                                                             (line 1341)
* PYTHON_LAZY_IMPORTS:                   PEP 810 Explicit lazy imports.
                                                             (line   55)
* PYTHON_LAZY_IMPORTS <1>:               その他のオプション. (line  477)
* PYTHON_LAZY_IMPORTS <2>:               Compatibility via __lazy_modules__.
                                                             (line   43)
* PYTHON_MANAGER_AUTOMATIC_INSTALL:      Installing runtimes.
                                                             (line   47)
* PYTHON_MANAGER_DEFAULT:                基本的な使い方.     (line   46)
* PYTHON_MANAGER_DEFAULT <1>:            Troubleshooting.    (line   76)
* PYTHON_PATHCONFIG_WARNINGS:            Core and Builtins<4>.
                                                             (line   35)
* PYTHON_PATHCONFIG_WARNINGS <1>:        その他のオプション. (line  461)
* PYTHON_PERF_JIT_SUPPORT:               その他の言語変更.   (line   52)
* PYTHON_PERF_JIT_SUPPORT <1>:           その他のオプション. (line  391)
* PYTHON_PERF_JIT_SUPPORT <2>:           PyConfig.           (line  904)
* PYTHON_PERF_JIT_SUPPORT <3>:           How to work without frame pointers.
                                                             (line   14)
* PYTHON_PRESITE:                        Core and Builtins<2>.
                                                             (line  143)
* PYTHON_PRESITE <1>:                    その他のオプション. (line  425)
* PYTHON_PRESITE <2>:                    PyConfig.           (line  799)
* PYTHON_PRESITE=package.module:         Core and Builtins<65>.
                                                             (line  154)
* PYTHON_PYMALLOC_HUGEPAGES:             Build changes<2>.   (line   24)
* PYTHON_PYMALLOC_HUGEPAGES <1>:         パフォーマンスに関するオプション.
                                                             (line  174)
* python_revision() (platform モジュール): Cross platform.   (line   96)
* PYTHON_THREAD_INHERIT_CONTEXT:         Core and Builtins<31>.
                                                             (line  134)
* PYTHON_THREAD_INHERIT_CONTEXT <1>:     その他のオプション. (line  445)
* PYTHON_THREAD_INHERIT_CONTEXT <2>:     sys --- システム固有のパラメーターと関数.
                                                             (line  626)
* PYTHON_TLBC:                           その他のオプション. (line  469)
* 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  231)
* PYTHONASYNCIODEBUG:                    デバッグモードの有効化.
                                                             (line   10)
* PYTHONASYNCIODEBUG <1>:                デバッグモード.     (line   11)
* PYTHONASYNCIODEBUG <2>:                Python 開発モードの影響.
                                                             (line   65)
* PYTHONBREAKPOINT:                      PEP 553 組み込みの breakpoint.
                                                             (line   13)
* PYTHONBREAKPOINT <1>:                  組み込み関数.       (line  160)
* PYTHONBREAKPOINT <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line  288)
* PYTHONBREAKPOINT <3>:                  sys --- システム固有のパラメーターと関数.
                                                             (line  302)
* PYTHONBREAKPOINT <4>:                  sys --- システム固有のパラメーターと関数.
                                                             (line  307)
* PYTHONCASEOK:                          Python API の変更<5>.
                                                             (line   29)
* PYTHONCASEOK <1>:                      PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み.
                                                             (line   17)
* PYTHONCASEOK <2>:                      ライブラリ<158>.    (line  144)
* PYTHONCASEOK <3>:                      組み込み関数.       (line 2284)
* PYTHONCOERCECLOCALE:                   PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   12)
* PYTHONCOERCECLOCALE <1>:               一般的なオプション. (line   89)
* PYTHONCOERCECLOCALE <2>:               Python UTF-8 Mode.  (line   59)
* PYTHONCOERCECLOCALE <3>:               Python Configuration.
                                                             (line   15)
* PYTHONDEBUG:                           その他のオプション. (line   44)
* PYTHONDEBUG <1>:                       Python デバッグビルド.
                                                             (line   20)
* PYTHONDEBUG <2>:                       グローバルな設定変数.
                                                             (line   38)
* PYTHONDEBUG <3>:                       PyConfig.           (line  690)
* PYTHONDEVMODE:                         Python Development Mode -X dev.
                                                             (line    6)
* PYTHONDEVMODE <1>:                     その他のオプション. (line  331)
* PYTHONDEVMODE <2>:                     Python 開発モード.  (line   14)
* PYTHONDEVMODE <3>:                     PyConfig.           (line  295)
* PYTHONDONTWRITEBYTECODE:               インタプリタの変更<2>.
                                                             (line   15)
* PYTHONDONTWRITEBYTECODE <1>:           新しいモジュールと改良されたモジュール<2>.
                                                             (line  636)
* PYTHONDONTWRITEBYTECODE <2>:           その他のオプション. (line   25)
* PYTHONDONTWRITEBYTECODE <3>:           sys --- システム固有のパラメーターと関数.
                                                             (line  373)
* PYTHONDONTWRITEBYTECODE <4>:           グローバルな設定変数.
                                                             (line   52)
* PYTHONDONTWRITEBYTECODE <5>:           PyConfig.           (line 1003)
* PYTHONDONTWRITEBYTECODE <6>:           pyc ファイルを作るにはどうしますか？.
                                                             (line   19)
* PYTHONDUMPREFS:                        デバッグビルドとリリースビルドのABI 共通化.
                                                             (line   15)
* PYTHONDUMPREFS <1>:                    ビルド<60>.         (line   54)
* PYTHONDUMPREFS <2>:                    Debug options.      (line   22)
* PYTHONDUMPREFS <3>:                    Debug options.      (line   24)
* PYTHONDUMPREFS <4>:                    PyConfig.           (line  306)
* PYTHONDUMPREFSFILE:                    Core and Builtins<116>.
                                                             (line   16)
* PYTHONDUMPREFSFILE <1>:                PyConfig.           (line  318)
* PYTHONEXECUTABLE:                      PyConfig.           (line  725)
* PYTHONFAULTHANDLER:                    faulthandler<6>.    (line   12)
* PYTHONFAULTHANDLER <1>:                その他のオプション. (line  283)
* PYTHONFAULTHANDLER <2>:                Python 開発モードの影響.
                                                             (line   59)
* PYTHONFAULTHANDLER <3>:                faulthandler --- Python トレースバックをダンプする.
                                                             (line   15)
* PYTHONFAULTHANDLER <4>:                PyConfig.           (line  355)
* PythonFinalizationError:               具象例外.           (line  225)
* PYTHONHASHSEED:                        組み込みの関数と型. (line   18)
* PYTHONHASHSEED <1>:                    Python コードの移植.
                                                             (line    7)
* PYTHONHASHSEED <2>:                    Core and Builtins<173>.
                                                             (line   30)
* PYTHONHASHSEED <3>:                    その他のオプション. (line  137)
* PYTHONHASHSEED <4>:                    その他のオプション. (line  154)
* PYTHONHASHSEED <5>:                    環境変数.           (line  156)
* PYTHONHASHSEED <6>:                    基本的なカスタマイズ.
                                                             (line  310)
* PYTHONHASHSEED <7>:                    グローバルな設定変数.
                                                             (line   75)
* PYTHONHASHSEED <8>:                    グローバルな設定変数.
                                                             (line   78)
* PYTHONHASHSEED <9>:                    PyConfig.           (line  435)
* PYTHONHOME:                            Removed C APIs<2>.  (line   68)
* PYTHONHOME <1>:                        Pending removal in Python 3 15<2>.
                                                             (line   51)
* PYTHONHOME <2>:                        Deprecated C APIs<4>.
                                                             (line   22)
* PYTHONHOME <3>:                        Pending removal in Python 3 15<4>.
                                                             (line   51)
* PYTHONHOME <4>:                        Pending removal in Python 3 15<6>.
                                                             (line   51)
* PYTHONHOME <5>:                        概要 -- リリースハイライト<9>.
                                                             (line  106)
* PYTHONHOME <6>:                        その他のオプション. (line   53)
* 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  166)
* PYTHONHOME <22>:                       PyConfig.           (line  443)
* PYTHONHOME <23>:                       PyConfig.           (line  445)
* PYTHONHOME <24>:                       Pending removal in Python 3 15<8>.
                                                             (line   51)
* Pythonic:                              用語集<2>.          (line 1463)
* PYTHONINSPECT:                         その他の変更と修正<2>.
                                                             (line   13)
* PYTHONINSPECT <1>:                     Core and Builtins<6>.
                                                             (line   77)
* PYTHONINSPECT <2>:                     その他のオプション. (line   75)
* PYTHONINSPECT <3>:                     グローバルな設定変数.
                                                             (line  107)
* PYTHONINSPECT <4>:                     PyConfig.           (line  474)
* PYTHONINTMAXSTRDIGITS:                 Core and Builtins<82>.
                                                             (line   74)
* PYTHONINTMAXSTRDIGITS <1>:             その他のオプション. (line  305)
* PYTHONINTMAXSTRDIGITS <2>:             上限値を設定する.   (line    9)
* PYTHONINTMAXSTRDIGITS <3>:             上限値を設定する.   (line   16)
* PYTHONINTMAXSTRDIGITS <4>:             sys --- システム固有のパラメーターと関数.
                                                             (line 1260)
* PYTHONINTMAXSTRDIGITS <5>:             PyConfig.           (line  505)
* PYTHONIOENCODING:                      その他の改善<2>.    (line   75)
* PYTHONIOENCODING <1>:                  インタプリタの変更<2>.
                                                             (line   22)
* PYTHONIOENCODING <2>:                  環境変数.           (line  439)
* PYTHONIOENCODING <3>:                  Python UTF-8 Mode.  (line   33)
* PYTHONIOENCODING <4>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 2096)
* PYTHONIOENCODING <5>:                  PyConfig.           (line  858)
* PYTHONLEGACYWINDOWSFSENCODING:         sys.                (line    7)
* PYTHONLEGACYWINDOWSFSENCODING <1>:     Pending removal in Python 3 16.
                                                             (line  102)
* PYTHONLEGACYWINDOWSFSENCODING <2>:     Pending removal in Python 3 16<2>.
                                                             (line  102)
* PYTHONLEGACYWINDOWSFSENCODING <3>:     New Deprecations.   (line  131)
* PYTHONLEGACYWINDOWSFSENCODING <4>:     Pending removal in Python 3 16<4>.
                                                             (line  102)
* PYTHONLEGACYWINDOWSFSENCODING <5>:     Pending removal in Python 3 16<6>.
                                                             (line  102)
* PYTHONLEGACYWINDOWSFSENCODING <6>:     PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更.
                                                             (line   18)
* PYTHONLEGACYWINDOWSFSENCODING <7>:     Windows<19>.        (line   37)
* PYTHONLEGACYWINDOWSFSENCODING <8>:     グローバルな設定変数.
                                                             (line  149)
* PYTHONLEGACYWINDOWSFSENCODING <9>:     PyPreConfig.        (line  123)
* PYTHONLEGACYWINDOWSFSENCODING <10>:    Pending removal in Python 3 16<8>.
                                                             (line  102)
* PYTHONLEGACYWINDOWSSTDIO:              PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更.
                                                             (line   12)
* PYTHONLEGACYWINDOWSSTDIO <1>:          環境変数.           (line  190)
* PYTHONLEGACYWINDOWSSTDIO <2>:          sys --- システム固有のパラメーターと関数.
                                                             (line 2100)
* PYTHONLEGACYWINDOWSSTDIO <3>:          グローバルな設定変数.
                                                             (line  167)
* PYTHONLEGACYWINDOWSSTDIO <4>:          PyConfig.           (line  558)
* PYTHONMALLOC:                          PYTHONMALLOC 環境変数.
                                                             (line    6)
* PYTHONMALLOC <1>:                      C API の変更<13>.   (line    9)
* PYTHONMALLOC <2>:                      Core and Builtins<193>.
                                                             (line   90)
* PYTHONMALLOC <3>:                      環境変数.           (line  345)
* PYTHONMALLOC <4>:                      パフォーマンスに関するオプション.
                                                             (line  156)
* PYTHONMALLOC <5>:                      パフォーマンスに関するオプション.
                                                             (line  163)
* PYTHONMALLOC <6>:                      Python 開発モードの影響.
                                                             (line   46)
* PYTHONMALLOC <7>:                      Python 開発モードの影響.
                                                             (line   50)
* PYTHONMALLOC <8>:                      概要<4>.            (line   75)
* PYTHONMALLOC <9>:                      Default Memory Allocators.
                                                             (line   32)
* PYTHONMALLOC <10>:                     Debug hooks on the Python memory allocators.
                                                             (line   11)
* PYTHONMALLOC <11>:                     pymalloc アロケータ.
                                                             (line   31)
* PYTHONMALLOC <12>:                     The mimalloc allocator.
                                                             (line   24)
* PYTHONMALLOCSTATS:                     Core and Builtins<193>.
                                                             (line   96)
* PYTHONMALLOCSTATS <1>:                 PyConfig.           (line  574)
* PYTHONMALLOCSTATS <2>:                 概要<4>.            (line   78)
* PYTHONNODEBUGRANGES:                   PEP 657 トレースバックのエラー位置の詳細化.
                                                             (line   61)
* PYTHONNODEBUGRANGES <1>:               その他のオプション. (line  360)
* PYTHONNODEBUGRANGES <2>:               Methods on code objects.
                                                             (line   40)
* PYTHONNODEBUGRANGES <3>:               PyConfig.           (line  248)
* PYTHONNOUSERSITE:                      PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   30)
* PYTHONNOUSERSITE <1>:                  その他のオプション. (line  166)
* PYTHONNOUSERSITE <2>:                  環境変数.           (line  212)
* PYTHONNOUSERSITE <3>:                  モジュールの内容<7>.
                                                             (line   15)
* PYTHONNOUSERSITE <4>:                  sys path モジュール検索パスの初期化.
                                                             (line   66)
* PYTHONNOUSERSITE <5>:                  グローバルな設定変数.
                                                             (line  200)
* PYTHONNOUSERSITE <6>:                  PyConfig.           (line  956)
* PYTHONOPTIMIZE:                        その他のオプション. (line   95)
* PYTHONOPTIMIZE <1>:                    グローバルな設定変数.
                                                             (line  211)
* PYTHONOPTIMIZE <2>:                    PyConfig.           (line  642)
* 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   52)
* 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 1495)
* PYTHONPATH <19>:                       sys --- システム固有のパラメーターと関数.
                                                             (line 1501)
* 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  607)
* PYTHONPERFSUPPORT:                     その他の言語変更<2>.
                                                             (line   84)
* PYTHONPERFSUPPORT <1>:                 その他のオプション. (line  380)
* PYTHONPERFSUPPORT <2>:                 PyConfig.           (line  900)
* PYTHONPERFSUPPORT <3>:                 How to enable perf profiling support.
                                                             (line    7)
* PYTHONPLATLIBDIR:                      Core and Builtins<152>.
                                                             (line   47)
* PYTHONPLATLIBDIR <1>:                  sys path モジュール検索パスの初期化.
                                                             (line   51)
* PYTHONPLATLIBDIR <2>:                  PyConfig.           (line  586)
* PYTHONPROFILEIMPORTTIME:               その他の言語変更<7>.
                                                             (line   47)
* PYTHONPROFILEIMPORTTIME <1>:           Core and Builtins<175>.
                                                             (line   66)
* PYTHONPROFILEIMPORTTIME <2>:           その他のオプション. (line  321)
* PYTHONPROFILEIMPORTTIME <3>:           PyConfig.           (line  457)
* PYTHONPYCACHEPREFIX:                   コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム.
                                                             (line    8)
* PYTHONPYCACHEPREFIX <1>:               Core and Builtins<166>.
                                                             (line  402)
* PYTHONPYCACHEPREFIX <2>:               その他のオプション. (line  344)
* PYTHONPYCACHEPREFIX <3>:               sys --- システム固有のパラメーターと関数.
                                                             (line  420)
* PYTHONPYCACHEPREFIX <4>:               PyConfig.           (line  747)
* PYTHONREGRTEST_UNICODE_GUARD:          テスト<33>.         (line   13)
* PYTHONSAFEPATH:                        概要 -- リリースハイライト<4>.
                                                             (line   27)
* PYTHONSAFEPATH <1>:                    その他の言語変更<3>.
                                                             (line   37)
* PYTHONSAFEPATH <2>:                    セキュリティ<27>.   (line    6)
* PYTHONSAFEPATH <3>:                    その他のオプション. (line  123)
* PYTHONSAFEPATH <4>:                    sys --- システム固有のパラメーターと関数.
                                                             (line 1513)
* PYTHONSAFEPATH <5>:                    セキュリティで考慮すべき点<6>.
                                                             (line   47)
* PYTHONSAFEPATH <6>:                    PyConfig.           (line  161)
* PYTHONSTARTUP:                         Default interactive shell<2>.
                                                             (line   15)
* PYTHONSTARTUP <1>:                     sys<14>.            (line   16)
* PYTHONSTARTUP <2>:                     sys<14>.            (line   21)
* PYTHONSTARTUP <3>:                     ライブラリ<2>.      (line  404)
* PYTHONSTARTUP <4>:                     ライブラリ<6>.      (line  148)
* PYTHONSTARTUP <5>:                     Core and Builtins<19>.
                                                             (line   33)
* 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   71)
* 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 1272)
* PYTHONSTARTUP <17>:                    readline の設定.    (line   12)
* PYTHONTRACEMALLOC:                     その他のオプション. (line  300)
* PYTHONTRACEMALLOC <1>:                 tracemalloc --- メモリ割り当ての追跡.
                                                             (line   23)
* PYTHONTRACEMALLOC <2>:                 tracemalloc --- メモリ割り当ての追跡.
                                                             (line   30)
* PYTHONTRACEMALLOC <3>:                 関数<11>.           (line   90)
* PYTHONTRACEMALLOC <4>:                 PyConfig.           (line  886)
* PYTHONTZPATH:                          例外と警告.         (line   14)
* PYTHONUNBUFFERED:                      Core and Builtins<159>.
                                                             (line  107)
* PYTHONUNBUFFERED <1>:                  その他のオプション. (line  185)
* PYTHONUNBUFFERED <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 2107)
* PYTHONUNBUFFERED <3>:                  グローバルな設定変数.
                                                             (line  239)
* PYTHONUNBUFFERED <4>:                  PyConfig.           (line  208)
* PYTHONUOPS:                            Core and Builtins<66>.
                                                             (line   27)
* PYTHONUOPS <1>:                        Core and Builtins<66>.
                                                             (line  179)
* PYTHONUOPS <2>:                        Core and Builtins<66>.
                                                             (line  258)
* PYTHONUOPS <3>:                        Core and Builtins<66>.
                                                             (line  317)
* PYTHONUOPS <4>:                        Core and Builtins<66>.
                                                             (line  381)
* PYTHONUSERBASE:                        PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   23)
* PYTHONUSERBASE <1>:                    モジュールの内容<7>.
                                                             (line   41)
* PYTHONUSERBASE <2>:                    モジュールの内容<7>.
                                                             (line   83)
* PYTHONUSERBASE <3>:                    sys path モジュール検索パスの初期化.
                                                             (line   64)
* PYTHONUSERSITE:                        test support script_helper --- Utilities for the Python execution tests.
                                                             (line   26)
* PYTHONUTF8:                            Other language changes<2>.
                                                             (line   22)
* PYTHONUTF8 <1>:                        PEP 540 強制 UTF-8 実行モード.
                                                             (line    6)
* PYTHONUTF8 <2>:                        その他のオプション. (line  338)
* PYTHONUTF8 <3>:                        環境変数.           (line  449)
* PYTHONUTF8 <4>:                        UTF-8 モード.       (line   24)
* PYTHONUTF8 <5>:                        Python UTF-8 Mode.  (line    9)
* PYTHONUTF8 <6>:                        Python UTF-8 Mode.  (line   52)
* PYTHONUTF8 <7>:                        sys --- システム固有のパラメーターと関数.
                                                             (line 2098)
* PYTHONUTF8 <8>:                        PyPreConfig.        (line  152)
* PYTHONUTF8 <9>:                        Python Configuration.
                                                             (line   14)
* PYTHONVERBOSE:                         その他のオプション. (line  201)
* PYTHONVERBOSE <1>:                     グローバルな設定変数.
                                                             (line  256)
* PYTHONVERBOSE <2>:                     PyConfig.           (line  973)
* PYTHONWARNDEFAULTENCODING:             Optional EncodingWarning and encoding="locale" option.
                                                             (line   19)
* PYTHONWARNDEFAULTENCODING <1>:         ライブラリ<126>.    (line   45)
* PYTHONWARNDEFAULTENCODING <2>:         その他のオプション. (line  350)
* PYTHONWARNDEFAULTENCODING <3>:         Opt-in EncodingWarning.
                                                             (line    9)
* PYTHONWARNINGS:                        Other language changes<2>.
                                                             (line   58)
* PYTHONWARNINGS <1>:                    warnings<4>.        (line   21)
* PYTHONWARNINGS <2>:                    その他の言語変更<12>.
                                                             (line  157)
* PYTHONWARNINGS <3>:                    Deprecation Warnings の扱いの変更.
                                                             (line   23)
* PYTHONWARNINGS <4>:                    インタプリタの変更. (line    6)
* PYTHONWARNINGS <5>:                    ライブラリ<15>.     (line  285)
* PYTHONWARNINGS <6>:                    ドキュメント<28>.   (line   67)
* PYTHONWARNINGS <7>:                    その他のオプション. (line  261)
* PYTHONWARNINGS <8>:                    Python 開発モードの影響.
                                                             (line   30)
* PYTHONWARNINGS <9>:                    警告フィルタ.       (line   49)
* PYTHONWARNINGS <10>:                   警告フィルタ.       (line   60)
* PYTHONWARNINGS <11>:                   Describing Warning Filters.
                                                             (line    7)
* PYTHONWARNINGS <12>:                   Describing Warning Filters.
                                                             (line   21)
* PYTHONWARNINGS <13>:                   デフォルトの警告フィルタ.
                                                             (line    7)
* PYTHONWARNINGS <14>:                   PyConfig.           (line  992)
* PyThread_acquire_lock (C function):    Legacy locking APIs.
                                                             (line   76)
* PyThread_acquire_lock_timed (C function): Legacy locking APIs.
                                                             (line   53)
* PyThread_allocate_lock (C function):   Legacy locking APIs.
                                                             (line   32)
* PyThread_create_key (C function):      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   72)
* PyThread_free_lock (C function):       Legacy locking APIs.
                                                             (line   46)
* PyThread_get_key_value (C function):   Legacy APIs.        (line   27)
* PyThread_get_stacksize (C function):   Operating system thread APIs.
                                                             (line  111)
* PyThread_get_thread_ident (C function): Operating system thread APIs.
                                                             (line   26)
* PyThread_get_thread_native_id (C function): Operating system thread APIs.
                                                             (line   55)
* PyThread_GetInfo (C function):         Operating system thread APIs.
                                                             (line   39)
* PyThread_init_thread (C function):     Operating system thread APIs.
                                                             (line   95)
* 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   95)
* PyThread_set_key_value (C function):   Legacy APIs.        (line   24)
* PyThread_set_stacksize (C function):   Operating system thread APIs.
                                                             (line  100)
* 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   12)
* 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_Ensure (C function):     Attaching/detaching thread states.
                                                             (line    6)
* PyThreadState_EnsureFromView (C function): Attaching/detaching thread states.
                                                             (line   59)
* 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_Release (C function):    Attaching/detaching thread states.
                                                             (line   73)
* PyThreadState_SetAsyncExc (C function): Asynchronous notifications.
                                                             (line   72)
* PyThreadState_Swap (C function):       高水準 API.         (line   74)
* PyThreadState.interp (C member):       高水準 API.         (line   14)
* PyThreadStateToken (C type):           Attaching/detaching thread states.
                                                             (line  100)
* PyTime_AsSecondsDouble (C function):   Conversion functions.
                                                             (line    6)
* PyTime_Check (C function):             DateTime オブジェクト<2>.
                                                             (line  133)
* PyTime_CheckExact (C function):        DateTime オブジェクト<2>.
                                                             (line  139)
* PyTime_FromTime (C function):          DateTime オブジェクト<2>.
                                                             (line  189)
* PyTime_FromTimeAndFold (C function):   DateTime オブジェクト<2>.
                                                             (line  194)
* 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  208)
* PyTimeZone_FromOffsetAndName (C function): DateTime オブジェクト<2>.
                                                             (line  216)
* 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_FromArray (C function):        タプルオブジェクト tuple object.
                                                             (line   31)
* PyTuple_GET_ITEM (C function):         タプルオブジェクト tuple object.
                                                             (line   75)
* PyTuple_GET_SIZE (C function):         タプルオブジェクト tuple object.
                                                             (line   56)
* PyTuple_GetItem (C function):          タプルオブジェクト tuple object.
                                                             (line   60)
* PyTuple_GetSlice (C function):         タプルオブジェクト tuple object.
                                                             (line   82)
* PyTuple_New (C function):              タプルオブジェクト tuple object.
                                                             (line   26)
* PyTuple_Pack (C function):             タプルオブジェクト tuple object.
                                                             (line   43)
* PyTuple_SET_ITEM (C function):         タプルオブジェクト tuple object.
                                                             (line  106)
* PyTuple_SetItem (C function):          参照カウントの詳細. (line   26)
* PyTuple_SetItem (C function) <1>:      タプルオブジェクト tuple object.
                                                             (line   92)
* PyTuple_Size (C function):             タプルオブジェクト tuple object.
                                                             (line   51)
* 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  152)
* PyType_Freeze (C function):            Creating Heap-Allocated Types.
                                                             (line   62)
* PyType_FromMetaclass (C function):     Soft-deprecated API.
                                                             (line   11)
* PyType_FromModuleAndSpec (C function): Soft-deprecated API.
                                                             (line   40)
* PyType_FromSlots (C function):         Creating Heap-Allocated Types.
                                                             (line    8)
* PyType_FromSpec (C function):          Soft-deprecated API.
                                                             (line   87)
* PyType_FromSpecWithBases (C function): Soft-deprecated API.
                                                             (line   65)
* PyType_GenericAlloc (C function):      型オブジェクト<2>.  (line  180)
* PyType_GenericNew (C function):        型オブジェクト<2>.  (line  202)
* PyType_GetBaseByToken (C function):    型オブジェクト<2>.  (line  353)
* PyType_GetBaseByToken_DuringGC (C function): "DuringGC" functions.
                                                             (line   39)
* PyType_GetDict (C function):           型オブジェクト<2>.  (line   43)
* PyType_GetFlags (C function):          型オブジェクト<2>.  (line   31)
* PyType_GetFullyQualifiedName (C function): 型オブジェクト<2>.
                                                             (line  240)
* PyType_GetModule (C function):         型オブジェクト<2>.  (line  273)
* PyType_GetModule_DuringGC (C function): "DuringGC" functions.
                                                             (line   55)
* PyType_GetModuleByDef (C function):    型オブジェクト<2>.  (line  329)
* PyType_GetModuleByToken (C function):  型オブジェクト<2>.  (line  312)
* PyType_GetModuleByToken_DuringGC (C function): "DuringGC" functions.
                                                             (line   55)
* PyType_GetModuleName (C function):     型オブジェクト<2>.  (line  250)
* PyType_GetModuleState (C function):    型オブジェクト<2>.  (line  298)
* PyType_GetModuleState_DuringGC (C function): "DuringGC" functions.
                                                             (line   19)
* PyType_GetName (C function):           型オブジェクト<2>.  (line  225)
* PyType_GetQualName (C function):       型オブジェクト<2>.  (line  232)
* PyType_GetSlot (C function):           型オブジェクト<2>.  (line  258)
* PyType_GetTypeDataSize (C function):   オブジェクトプロトコル object protocol.
                                                             (line  599)
* PyType_HasFeature (C function):        型オブジェクト<2>.  (line  147)
* PyType_IS_GC (C function):             型オブジェクト<2>.  (line  166)
* PyType_IsSubtype (C function):         型オブジェクト<2>.  (line  171)
* PyType_Modified (C function):          型オブジェクト<2>.  (line   60)
* PyType_Ready (C function):             型オブジェクト<2>.  (line  209)
* PyType_Slot (C type):                  Soft-deprecated API.
                                                             (line  144)
* PyType_Slot.pfunc (C member):          Soft-deprecated API.
                                                             (line  172)
* PyType_Slot.slot (C member):           Soft-deprecated API.
                                                             (line  168)
* PyType_Spec (C type):                  Soft-deprecated API.
                                                             (line  105)
* PyType_Spec.basicsize (C member):      Soft-deprecated API.
                                                             (line  118)
* PyType_Spec.flags (C member):          Soft-deprecated API.
                                                             (line  132)
* PyType_Spec.itemsize (C member):       Soft-deprecated API.
                                                             (line  128)
* PyType_Spec.name (C member):           Soft-deprecated API.
                                                             (line  114)
* PyType_Spec.slots (C member):          Soft-deprecated API.
                                                             (line  136)
* PyType_SUPPORTS_WEAKREFS (C function): 型オブジェクト<2>.  (line  384)
* PyType_Type (C var):                   型オブジェクト<2>.  (line   10)
* PyType_Unwatch (C function):           型オブジェクト<2>.  (line  113)
* PyType_Watch (C function):             型オブジェクト<2>.  (line   91)
* PyType_WatchCallback (C type):         型オブジェクト<2>.  (line  127)
* PyTypeObject (C type):                 型オブジェクト<2>.  (line    6)
* PyTypeObject.tp_alloc (C member):      PyTypeObject スロット.
                                                             (line 1633)
* PyTypeObject.tp_as_async (C member):   PyTypeObject スロット.
                                                             (line  371)
* PyTypeObject.tp_as_buffer (C member):  PyTypeObject スロット.
                                                             (line  606)
* PyTypeObject.tp_as_mapping (C member): PyTypeObject スロット.
                                                             (line  442)
* PyTypeObject.tp_as_number (C member):  PyTypeObject スロット.
                                                             (line  418)
* PyTypeObject.tp_as_sequence (C member): PyTypeObject スロット.
                                                             (line  430)
* PyTypeObject.tp_base (C member):       PyTypeObject スロット.
                                                             (line 1442)
* PyTypeObject.tp_bases (C member):      PyTypeObject スロット.
                                                             (line 1767)
* PyTypeObject.tp_basicsize (C member):  PyTypeObject スロット.
                                                             (line   51)
* PyTypeObject.tp_cache (C member):      PyTypeObject スロット.
                                                             (line 1805)
* PyTypeObject.tp_call (C member):       PyTypeObject スロット.
                                                             (line  498)
* PyTypeObject.tp_clear (C member):      PyTypeObject スロット.
                                                             (line 1069)
* PyTypeObject.tp_dealloc (C member):    PyTypeObject スロット.
                                                             (line  141)
* PyTypeObject.tp_del (C member):        PyTypeObject スロット.
                                                             (line 1845)
* PyTypeObject.tp_descr_get (C member):  PyTypeObject スロット.
                                                             (line 1515)
* PyTypeObject.tp_descr_set (C member):  PyTypeObject スロット.
                                                             (line 1531)
* PyTypeObject.tp_dict (C member):       PyTypeObject スロット.
                                                             (line 1478)
* PyTypeObject.tp_dictoffset (C member): PyTypeObject スロット.
                                                             (line 1550)
* PyTypeObject.tp_doc (C member):        PyTypeObject スロット.
                                                             (line 1034)
* PyTypeObject.tp_finalize (C member):   PyTypeObject スロット.
                                                             (line 1863)
* PyTypeObject.tp_flags (C member):      PyTypeObject スロット.
                                                             (line  619)
* PyTypeObject.tp_free (C member):       PyTypeObject スロット.
                                                             (line 1700)
* PyTypeObject.tp_getattr (C member):    PyTypeObject スロット.
                                                             (line  327)
* PyTypeObject.tp_getattro (C member):   PyTypeObject スロット.
                                                             (line  545)
* PyTypeObject.tp_getset (C member):     PyTypeObject スロット.
                                                             (line 1424)
* PyTypeObject.tp_hash (C member):       PyTypeObject スロット.
                                                             (line  454)
* PyTypeObject.tp_init (C member):       PyTypeObject スロット.
                                                             (line 1594)
* PyTypeObject.tp_is_gc (C member):      PyTypeObject スロット.
                                                             (line 1733)
* PyTypeObject.tp_itemsize (C member):   PyTypeObject スロット.
                                                             (line   51)
* PyTypeObject.tp_iter (C member):       PyTypeObject スロット.
                                                             (line 1341)
* PyTypeObject.tp_iternext (C member):   PyTypeObject スロット.
                                                             (line 1361)
* PyTypeObject.tp_members (C member):    PyTypeObject スロット.
                                                             (line 1406)
* PyTypeObject.tp_methods (C member):    PyTypeObject スロット.
                                                             (line 1388)
* PyTypeObject.tp_mro (C member):        PyTypeObject スロット.
                                                             (line 1791)
* PyTypeObject.tp_name (C member):       PyTypeObject スロット.
                                                             (line   12)
* PyTypeObject.tp_new (C member):        PyTypeObject スロット.
                                                             (line 1659)
* PyTypeObject.tp_repr (C member):       PyTypeObject スロット.
                                                             (line  388)
* PyTypeObject.tp_richcompare (C member): PyTypeObject スロット.
                                                             (line 1227)
* PyTypeObject.tp_setattr (C member):    PyTypeObject スロット.
                                                             (line  349)
* PyTypeObject.tp_setattro (C member):   PyTypeObject スロット.
                                                             (line  575)
* PyTypeObject.tp_str (C member):        PyTypeObject スロット.
                                                             (line  515)
* PyTypeObject.tp_subclasses (C member): PyTypeObject スロット.
                                                             (line 1814)
* PyTypeObject.tp_traverse (C member):   PyTypeObject スロット.
                                                             (line 1047)
* PyTypeObject.tp_vectorcall (C member): PyTypeObject スロット.
                                                             (line 2033)
* PyTypeObject.tp_vectorcall_offset (C member): PyTypeObject スロット.
                                                             (line  287)
* PyTypeObject.tp_version_tag (C member): PyTypeObject スロット.
                                                             (line 1854)
* PyTypeObject.tp_watched (C member):    PyTypeObject スロット.
                                                             (line 2076)
* PyTypeObject.tp_weaklist (C member):   PyTypeObject スロット.
                                                             (line 1830)
* PyTypeObject.tp_weaklistoffset (C member): PyTypeObject スロット.
                                                             (line 1305)
* PyTZInfo_Check (C function):           DateTime オブジェクト<2>.
                                                             (line  156)
* PyTZInfo_CheckExact (C function):      DateTime オブジェクト<2>.
                                                             (line  163)
* 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  219)
* 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_DumpTraceback (C function): Tracebacks.         (line   34)
* PyUnstable_DumpTracebackThreads (C function): Tracebacks.  (line   67)
* PyUnstable_EnableTryIncRef (C function): オブジェクトプロトコル object protocol.
                                                             (line  793)
* 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  709)
* 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  100)
* PyUnstable_Object_EnableDeferredRefcount (C function): オブジェクトプロトコル object protocol.
                                                             (line  647)
* PyUnstable_Object_GC_NewWithExtraData (C function): 循環参照ガベージコレクションをサポートする.
                                                             (line  110)
* PyUnstable_Object_IsUniquelyReferenced (C function): オブジェクトプロトコル object protocol.
                                                             (line  802)
* PyUnstable_Object_IsUniqueReferencedTemporary (C function): オブジェクトプロトコル object protocol.
                                                             (line  676)
* PyUnstable_PerfMapState_Fini (C function): Support for Perf Maps.
                                                             (line   48)
* PyUnstable_PerfMapState_Init (C function): Support for Perf Maps.
                                                             (line   19)
* PyUnstable_SetImmortal (C function):   オブジェクトプロトコル object protocol.
                                                             (line  822)
* PyUnstable_ThreadState_ResetStackProtection (C function): 低水準 API.
                                                             (line  121)
* PyUnstable_ThreadState_SetStackProtection (C function): 低水準 API.
                                                             (line   90)
* PyUnstable_TryIncRef (C function):     オブジェクトプロトコル object protocol.
                                                             (line  720)
* PyUnstable_Type_AssignVersionTag (C function): 型オブジェクト<2>.
                                                             (line  374)
* PyUnstable_Unicode_GET_CACHED_HASH (C function): Unicode 型.
                                                             (line  181)
* PyUnstable_WritePerfMapEntry (C function): Support for Perf Maps.
                                                             (line   33)
* PyVarObject (C type):                  Base object types and macros.
                                                             (line   62)
* PyVarObject_HEAD_INIT (C macro):       Base object types and macros.
                                                             (line  209)
* PyVarObject.ob_base (C member):        Base object types and macros.
                                                             (line   77)
* PyVarObject.ob_size (C member):        Base object types and macros.
                                                             (line   82)
* 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_GetRef (C function):         弱参照オブジェクト<2>.
                                                             (line   70)
* PyWeakref_IsDead (C function):         弱参照オブジェクト<2>.
                                                             (line   84)
* PyWeakref_NewProxy (C function):       弱参照オブジェクト<2>.
                                                             (line   51)
* PyWeakref_NewRef (C function):         弱参照オブジェクト<2>.
                                                             (line   31)
* PyWideStringList (C type):             PyWideStringList.   (line    6)
* PyWideStringList_Append (C function):  PyWideStringList.   (line   15)
* PyWideStringList_Insert (C function):  PyWideStringList.   (line   22)
* PyWideStringList.items (C member):     PyWideStringList.   (line   41)
* PyWideStringList.length (C member):    PyWideStringList.   (line   37)
* PyWrapper_New (C function):            デスクリプタオブジェクト descriptor object.
                                                             (line  128)
* PyWrapperDescr_Type (C var):           デスクリプタオブジェクト descriptor object.
                                                             (line   99)
* PyZip_Type (C var):                    Builtin Iterator Types.
                                                             (line   25)
* PyZipFile (zipfile のクラス):          PyZipFile objects.  (line    9)
* qiflush() (curses モジュール):         関数<6>.            (line  403)
* QName (xml.etree.ElementTree のクラス): QName オブジェクト.
                                                             (line    6)
* qsize() (asyncio.Queue のメソッド):    Queue.              (line   79)
* qsize() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  109)
* qsize() (queue.Queue のメソッド):      キューオブジェクト. (line    9)
* qsize() (queue.SimpleQueue のメソッド): SimpleQueue オブジェクト.
                                                             (line    9)
* qualified name:                        用語集<2>.          (line 1480)
* 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  335)
* QueryReflectionKey() (winreg モジュール): 関数<14>.        (line  530)
* QueryValue() (winreg モジュール):      関数<14>.           (line  363)
* QueryValueEx() (winreg モジュール):    関数<14>.           (line  383)
* QUESTION (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  196)
* Queue (asyncio のクラス):              Queue.              (line    6)
* Queue (concurrent.interpreters のクラス): Communicating Between Interpreters.
                                                             (line    6)
* Queue (multiprocessing のクラス):      パイプ Pipe とキュー Queue.
                                                             (line   91)
* Queue (queue のクラス):                queue --- 同期キュークラス.
                                                             (line   32)
* queue (sched.scheduler の属性):        スケジューラオブジェクト.
                                                             (line   73)
* Queue() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  201)
* QueueEmpty:                            例外<16>.           (line    6)
* QueueEmptyError:                       Communicating Between Interpreters.
                                                             (line   22)
* QueueFull:                             例外<16>.           (line   11)
* QueueFullError:                        Communicating Between Interpreters.
                                                             (line   28)
* QueueHandler (logging.handlers のクラス): QueueHandler.    (line   21)
* QueueListener (logging.handlers のクラス): QueueListener.  (line   24)
* QueueShutDown:                         例外<16>.           (line   16)
* quick_ratio() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line  202)
* quiet (sys.flags の属性):              sys --- システム固有のパラメーターと関数.
                                                             (line  600)
* 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  335)
* quit() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  122)
* quitting (bdb.Bdb attribute):          bdb --- デバッガーフレームワーク.
                                                             (line  355)
* QUOTE_ALL (csv モジュール):            モジュールコンテンツ.
                                                             (line  268)
* quote_from_bytes() (urllib.parse モジュール): URL のクオート.
                                                             (line   52)
* QUOTE_MINIMAL (csv モジュール):        モジュールコンテンツ.
                                                             (line  273)
* QUOTE_NONE (csv モジュール):           モジュールコンテンツ.
                                                             (line  293)
* QUOTE_NONNUMERIC (csv モジュール):     モジュールコンテンツ.
                                                             (line  279)
* QUOTE_NOTNULL (csv モジュール):        モジュールコンテンツ.
                                                             (line  306)
* quote_plus() (urllib.parse モジュール): URL のクオート.    (line   40)
* QUOTE_STRINGS (csv モジュール):        モジュールコンテンツ.
                                                             (line  318)
* quote() (email.utils モジュール):      email utils Miscellaneous utilities.
                                                             (line   45)
* quote() (shlex モジュール):            shlex --- 単純な字句解析.
                                                             (line   42)
* quote() (urllib.parse モジュール):     URL のクオート.     (line   11)
* quoteattr() (xml.sax.saxutils モジュール): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   38)
* quotechar (csv.Dialect の属性):        Dialect クラスと書式化パラメータ.
                                                             (line   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 1507)
* radians() (math モジュール):           角度変換.           (line   10)
* radians() (turtle モジュール):         設定と計測.         (line   28)
* radix (sys.float_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line  727)
* radix() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  493)
* radix() (decimal.Decimal のメソッド):  Decimal オブジェクト.
                                                             (line  494)
* RADIXCHAR (locale モジュール):         locale --- 国際化サービス.
                                                             (line  272)
* 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 モジュール):    モジュールの内容<4>.
                                                             (line  351)
* RAISE_VARARGS (opcode):                Python バイトコード命令.
                                                             (line 1063)
* raiseExceptions (logging モジュール):  モジュールレベル属性.
                                                             (line   19)
* raising;例外:                          raise 文.           (line    6)
* RAND_add() (ssl モジュール):           乱数生成.           (line   32)
* RAND_bytes() (ssl モジュール):         乱数生成.           (line    6)
* RAND_status() (ssl モジュール):        乱数生成.           (line   25)
* randbelow() (secrets モジュール):      乱数.               (line   19)
* randbits() (secrets モジュール):       乱数.               (line   23)
* randbytes() (random モジュール):       バイト列用の関数.   (line    6)
* randbytes() (random.Random のメソッド): 他の生成器.        (line   47)
* randint() (random モジュール):         整数用の関数.       (line   31)
* Random (random のクラス):              他の生成器.         (line    6)
* random コマンドラインオプション; -c:   コマンドラインでの使用<2>.
                                                             (line   18)
* random コマンドラインオプション; -choice: コマンドラインでの使用<2>.
                                                             (line   18)
* random コマンドラインオプション; -f:   コマンドラインでの使用<2>.
                                                             (line   29)
* random コマンドラインオプション; -float: コマンドラインでの使用<2>.
                                                             (line   29)
* random コマンドラインオプション; -h:   コマンドラインでの使用<2>.
                                                             (line   14)
* random コマンドラインオプション; -help: コマンドラインでの使用<2>.
                                                             (line   14)
* random コマンドラインオプション; -i:   コマンドラインでの使用<2>.
                                                             (line   23)
* random コマンドラインオプション; -integer: コマンドラインでの使用<2>.
                                                             (line   23)
* random() (random モジュール):          実数分布.           (line   10)
* random() (random.Random のメソッド):   他の生成器.         (line   34)
* randrange() (random モジュール):       整数用の関数.       (line    6)
* range (組み込みクラス):                range.              (line    9)
* RARROW (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line  335)
* ratio() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line  178)
* Rational (numbers のクラス):           数値塔.             (line   41)
* raw (io.BufferedIOBase の属性):        I/O 基底クラス.     (line  250)
* raw_data_manager (email.contentmanager モジュール): Content Manager Instances.
                                                             (line   11)
* raw_decode() (json.JSONDecoder のメソッド): エンコーダとデコーダ.
                                                             (line  103)
* raw_input() (code.InteractiveConsole のメソッド): 対話的なコンソールオブジェクト.
                                                             (line   45)
* raw() (curses モジュール):             関数<6>.            (line  409)
* 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  198)
* READ (inspect.BufferFlags の属性):     Buffer flags.       (line   49)
* read_binary() (importlib.resources モジュール): 関数 API.  (line   75)
* read_byte() (mmap.mmap のメソッド):    mmap --- メモリマップファイルのサポート.
                                                             (line  279)
* 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  116)
* READ_RESTRICTED (C macro):             Member flags.       (line   30)
* read_string() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  196)
* read_text() (importlib.metadata.Distribution のメソッド): Distributions.
                                                             (line  120)
* 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  290)
* read() (io.BufferedIOBase のメソッド): I/O 基底クラス.     (line  270)
* read() (io.BufferedReader のメソッド): バッファ付きストリーム.
                                                             (line   87)
* 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  268)
* read() (os モジュール):                ファイル記述子の操作.
                                                             (line  750)
* read() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   46)
* read() (ssl.MemoryBIO のメソッド):     Memory BIO support. (line  145)
* read() (ssl.SSLSocket のメソッド):     SSL sockets.        (line   83)
* read() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   24)
* read() (zipfile.ZipFile のメソッド):   ZipFile objects.    (line  254)
* read1() (bz2.BZ2File のメソッド):      ファイルの圧縮/解凍.
                                                             (line  109)
* read1() (io.BufferedIOBase のメソッド): I/O 基底クラス.    (line  294)
* read1() (io.BufferedReader のメソッド): バッファ付きストリーム.
                                                             (line   92)
* read1() (io.BytesIO のメソッド):       バッファ付きストリーム.
                                                             (line   46)
* READABLE (_tkinter モジュール):        ファイルハンドラ.   (line   42)
* readable() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line   91)
* readable() (io.IOBase のメソッド):     I/O 基底クラス.     (line   77)
* readall() (io.RawIOBase のメソッド):   I/O 基底クラス.     (line  199)
* readbuffer_encode() (codecs モジュール): codecs --- codec レジストリと基底クラス.
                                                             (line  268)
* Reader (io のクラス):                  Static Typing.      (line   10)
* reader() (csv モジュール):             モジュールコンテンツ.
                                                             (line    8)
* ReadError:                             tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  265)
* readexactly() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   47)
* readfp() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   84)
* readframes() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   60)
* readinto() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line  119)
* readinto() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   18)
* readinto() (io.BufferedIOBase のメソッド): I/O 基底クラス. (line  306)
* readinto() (io.RawIOBase のメソッド):  I/O 基底クラス.     (line  204)
* readinto() (os モジュール):            ファイル記述子の操作.
                                                             (line  770)
* readinto1() (io.BufferedIOBase のメソッド): I/O 基底クラス.
                                                             (line  320)
* readinto1() (io.BytesIO のメソッド):   バッファ付きストリーム.
                                                             (line   53)
* readline() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   36)
* readline() (codecs.StreamReader のメソッド): StreamReader オブジェクト.
                                                             (line   60)
* readline() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  295)
* readline() (io.IOBase のメソッド):     I/O 基底クラス.     (line   82)
* readline() (io.TextIOBase のメソッド): テキスト I/O<2>.    (line   57)
* readline() (mmap.mmap のメソッド):     mmap --- メモリマップファイルのサポート.
                                                             (line  284)
* readlines() (codecs.StreamReader のメソッド): StreamReader オブジェクト.
                                                             (line   70)
* readlines() (io.IOBase のメソッド):    I/O 基底クラス.     (line   91)
* readlink() (os モジュール):            ファイルとディレクトリ.
                                                             (line  707)
* 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  436)
* ReadOnly (typing モジュール):          特殊形式.           (line  278)
* ReadTransport (asyncio のクラス):      トランスポートのクラス階層構造.
                                                             (line   20)
* readuntil() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   56)
* readv() (os モジュール):               ファイル記述子の操作.
                                                             (line  935)
* 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  405)
* 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 の属性):          例外<20>.           (line   26)
* reason (UnicodeError の属性):          具象例外.           (line  451)
* reason (urllib.error.HTTPError の属性): urllib error --- urllib request によって送出される例外クラス.
                                                             (line   49)
* reason (urllib.error.URLError の属性): urllib error --- urllib request によって送出される例外クラス.
                                                             (line   22)
* reattach() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  236)
* rebinding;name:                        代入文 assignment statement.
                                                             (line    6)
* recent() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  300)
* recipients (smtplib.SMTPRecipientsRefused の属性): smtplib --- SMTP プロトコルクライアント.
                                                             (line  181)
* 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  480)
* 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  254)
* 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  486)
* recv_into() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  387)
* recv() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   24)
* recv() (socket.socket のメソッド):     socket オブジェクト.
                                                             (line  237)
* recvfrom_into() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  376)
* recvfrom() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  251)
* recvmsg_into() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  338)
* recvmsg() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  270)
* 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 オブジェクト.
                                                             (line  457)
* redrawwin() (curses.window のメソッド): Window オブジェクト.
                                                             (line  463)
* reduce() (functools モジュール):       functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  447)
* reducer_override() (pickle.Pickler のメソッド): モジュールインターフェース.
                                                             (line  209)
* reentrant:                             用語集<2>.          (line 1540)
* 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 1518)
* ReferenceError:                        具象例外.           (line  263)
* ReferenceType (weakref モジュール):    weakref --- Weak references.
                                                             (line  322)
* refold_source (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  402)
* refresh() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  468)
* 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  136)
* register_archive_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  104)
* register_at_fork() (os モジュール):    プロセス管理.       (line  577)
* register_callback() (sys.monitoring モジュール): Registering callback functions.
                                                             (line    6)
* register_converter() (sqlite3 モジュール): モジュール関数. (line  144)
* register_defect() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  243)
* register_dialect() (csv モジュール):   モジュールコンテンツ.
                                                             (line   70)
* 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  198)
* register_optionflag() (doctest モジュール): オプションフラグ.
                                                             (line  153)
* register_shape() (turtle モジュール):  設定と特殊なメソッド.
                                                             (line   70)
* register_unpack_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  181)
* 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  169)
* register() (faulthandler モジュール):  ユーザシグナルに対してtracebackをダンプする.
                                                             (line    6)
* register() (functools.singledispatch のメソッド): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  497)
* 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() (webbrowser モジュール):    コマンドライン・インターフェース<6>.
                                                             (line   75)
* registerDOMImplementation() (xml.dom モジュール): モジュールコンテンツ<2>.
                                                             (line    8)
* registerResult() (unittest モジュール): シグナルハンドリング.
                                                             (line   33)
* REGTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  339)
* regular package:                       用語集<2>.          (line 1533)
* relative_to() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  303)
* relative;import:                       import 文.          (line  104)
* relative;URL:                          urllib parse --- URL を構成要素に解析する.
                                                             (line    8)
* release() (_thread.lock のメソッド):   _thread --- 低水準なスレッド API.
                                                             (line  172)
* 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  240)
* 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   78)
* release() (threading.RLock のメソッド): RLock objects.     (line   98)
* release() (threading.Semaphore のメソッド): Semaphore objects.
                                                             (line   64)
* releasebufferproc (C type):            Slot Type typedefs. (line  113)
* reload_environ() (os モジュール):      プロセスのパラメーター.
                                                             (line   79)
* reload() (importlib モジュール):       関数<13>.           (line   57)
* relpath() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  471)
* 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   90)
* remote_exec() (sys モジュール):        sys --- システム固有のパラメーターと関数.
                                                             (line 2019)
* RemoteDisconnected:                    http client --- HTTP プロトコルクライアント.
                                                             (line  202)
* remove_done_callback() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line  111)
* remove_done_callback() (asyncio.Task のメソッド): Task object.
                                                             (line  112)
* remove_flag() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  140)
* remove_flag() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   88)
* remove_flag() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   84)
* remove_flag() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   83)
* remove_folder() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   78)
* remove_folder() (mailbox.MH のメソッド): MH オブジェクト.  (line   52)
* remove_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  101)
* remove_history_item() (readline モジュール): 履歴リスト.   (line   25)
* remove_label() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   59)
* remove_option() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  301)
* remove_option() (optparse.OptionParser のメソッド): オプション解析器への問い合わせと操作.
                                                             (line   48)
* remove_reader() (asyncio.loop のメソッド): ファイル記述子の監視.
                                                             (line   15)
* remove_section() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  308)
* remove_sequence() (mailbox.MHMessage のメソッド): MHMessage オブジェクト.
                                                             (line   45)
* remove_signal_handler() (asyncio.loop のメソッド): Unix シグナル.
                                                             (line   27)
* remove_writer() (asyncio.loop のメソッド): ファイル記述子の監視.
                                                             (line   32)
* remove() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  260)
* remove() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   99)
* remove() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   85)
* remove() (mailbox.MH のメソッド):      MH オブジェクト.    (line   81)
* remove() (os モジュール):              ファイルとディレクトリ.
                                                             (line  744)
* remove() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line  108)
* remove() (set のメソッド):             set（集合）型 --- set frozenset.
                                                             (line  201)
* remove() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  170)
* 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  768)
* 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  552)
* removeResult() (unittest モジュール):  シグナルハンドリング.
                                                             (line   44)
* removesuffix() (bytearray のメソッド): bytes と bytearray の操作.
                                                             (line   72)
* removesuffix() (bytes のメソッド):     bytes と bytearray の操作.
                                                             (line   72)
* removesuffix() (str のメソッド):       文字列メソッド<2>.  (line  567)
* removexattr() (os モジュール):         Linux 拡張属性.     (line   46)
* rename() (ftplib.FTP のメソッド):      FTP オブジェクト.   (line  322)
* rename() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  305)
* rename() (os モジュール):              ファイルとディレクトリ.
                                                             (line  786)
* rename() (pathlib.Path のメソッド):    Copying moving and deleting.
                                                             (line   41)
* renames() (os モジュール):             ファイルとディレクトリ.
                                                             (line  823)
* reopenIfNeeded() (logging.handlers.WatchedFileHandler のメソッド): WatchedFileHandler.
                                                             (line   42)
* reorganize() (dbm.dumb.dumbdbm のメソッド): dbm dumb --- Portable DBM implementation.
                                                             (line   89)
* reorganize() (dbm.gnu.gdbm のメソッド): dbm gnu --- GNU database manager.
                                                             (line  118)
* reorganize() (dbm.sqlite3.sqlite3 のメソッド): dbm sqlite3 --- SQLite backend for dbm.
                                                             (line   58)
* reorganize() (shelve.Shelf のメソッド): shelve --- Python オブジェクトの永続化.
                                                             (line   97)
* repeat() (itertools モジュール):       Itertool関数.       (line  524)
* repeat() (timeit モジュール):          Python interface.   (line   18)
* repeat() (timeit.Timer のメソッド):    Python interface.   (line  107)
* REPL:                                  用語集<2>.          (line 1560)
* 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 オブジェクト.
                                                             (line   39)
* replace() (dataclasses モジュール):    モジュールの内容<6>.
                                                             (line  453)
* replace() (datetime.date のメソッド):  date objects.       (line  225)
* replace() (datetime.datetime のメソッド): datetime objects.
                                                             (line  468)
* replace() (datetime.time のメソッド):  time objects.       (line  165)
* replace() (inspect.Parameter のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  322)
* replace() (inspect.Signature のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  148)
* replace() (os モジュール):             ファイルとディレクトリ.
                                                             (line  840)
* replace() (pathlib.Path のメソッド):   Copying moving and deleting.
                                                             (line   69)
* replace() (str のメソッド):            文字列メソッド<2>.  (line  582)
* replace() (tarfile.TarInfo のメソッド): TarInfo オブジェクト.
                                                             (line  167)
* replaceChild() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  135)
* ReplacePackage() (modulefinder モジュール): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   21)
* REPORT_CDIFF (doctest モジュール):     オプションフラグ.   (line  111)
* REPORT_ERRMODE (msvcrt モジュール):    その多の関数.       (line   35)
* report_failure() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line   89)
* 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_skip() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line   54)
* report_start() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line   66)
* report_success() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line   77)
* REPORT_UDIFF (doctest モジュール):     オプションフラグ.   (line  106)
* report_unexpected_exception() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line  101)
* 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 (importlib.metadata.Distribution の属性): Distributions.
                                                             (line   78)
* 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  416)
* reset_shell_mode() (curses モジュール): 関数<6>.           (line  421)
* 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   83)
* reset() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   24)
* reset() (threading.Barrier のメソッド): Barrier objects.   (line   69)
* reset() (turtle モジュール):           さらなる描画の制御. (line    6)
* reset() (xml.dom.pulldom.DOMEventStream のメソッド): DOMEventStream オブジェクト.
                                                             (line   36)
* reset() (xml.sax.xmlreader.IncrementalParser のメソッド): IncrementalParser オブジェクト.
                                                             (line   18)
* resetbuffer() (code.InteractiveConsole のメソッド): 対話的なコンソールオブジェクト.
                                                             (line   41)
* resetscreen() (turtle モジュール):     ウィンドウの制御.   (line   84)
* resetty() (curses モジュール):         関数<6>.            (line  426)
* resetwarnings() (warnings モジュール): 利用可能な関数.     (line  141)
* resize_term() (curses モジュール):     関数<6>.            (line  431)
* resize() (bytearray のメソッド):       bytearray オブジェクト.
                                                             (line   75)
* resize() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  213)
* resize() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  486)
* resize() (mmap.mmap のメソッド):       mmap --- メモリマップファイルのサポート.
                                                             (line  290)
* resizemode() (turtle モジュール):      見た目.             (line   24)
* resizeterm() (curses モジュール):      関数<6>.            (line  440)
* resolution (datetime.date の属性):     date objects.       (line  140)
* resolution (datetime.datetime の属性): datetime objects.   (line  302)
* 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   78)
* 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  177)
* ResourceReader (importlib.resources.abc のクラス): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   12)
* ResourceWarning:                       警告.               (line   84)
* response() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  310)
* ResponseNotReady:                      http client --- HTTP プロトコルクライアント.
                                                             (line  188)
* responses (http.client モジュール):    http client --- HTTP プロトコルクライアント.
                                                             (line  223)
* responses (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  227)
* restart (pdb command):                 Debugger commands.  (line  421)
* restart_events() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  433)
* restart_events() (sys.monitoring モジュール): Disabling events.
                                                             (line   26)
* restore() (difflib モジュール):        difflib --- 差分の計算の補助.
                                                             (line  265)
* restore() (test.support.SaveSignals のメソッド): test support --- Utilities for the Python test suite.
                                                             (line  814)
* RESTRICTED (C macro):                  Member flags.       (line   30)
* restype (ctypes._CFuncPtr の属性):     外部関数.           (line   32)
* result() (asyncio.Future のメソッド):  Future オブジェクト<2>.
                                                             (line   33)
* result() (asyncio.Task のメソッド):    Task object.        (line   74)
* result() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   37)
* results() (trace.Trace のメソッド):    プログラミングインターフェース.
                                                             (line   39)
* RESUME (opcode):                       Python バイトコード命令.
                                                             (line 1273)
* resume_reading() (asyncio.ReadTransport のメソッド): 読み出し専用のトランスポート.
                                                             (line   22)
* resume_writing() (asyncio.BaseProtocol のメソッド): 基底プロトコル<2>.
                                                             (line   46)
* retr() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   61)
* retrbinary() (ftplib.FTP のメソッド):  FTP オブジェクト.   (line  174)
* retrlines() (ftplib.FTP のメソッド):   FTP オブジェクト.   (line  199)
* RETRY (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  149)
* RETRYCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  176)
* Return (ast のクラス):                 関数およびクラス定義.
                                                             (line  113)
* return (pdb command):                  Debugger commands.  (line  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  173)
* retval (pdb command):                  Debugger commands.  (line  454)
* reveal_type() (typing モジュール):     Functions and decorators.
                                                             (line   81)
* reverse_order() (pstats.Stats のメソッド): The Stats class.
                                                             (line  126)
* reverse_pointer (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   78)
* reverse_pointer (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  269)
* reverse() (array.array のメソッド):    array --- 効率的な数値配列.
                                                             (line  270)
* reverse() (collections.deque のメソッド): deque オブジェクト.
                                                             (line  104)
* reverse() (sequence のメソッド):       ミュータブルなシーケンス型.
                                                             (line  115)
* Reversible (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   49)
* Reversible (typing のクラス):          Aliases to other ABCs in collections abc.
                                                             (line   61)
* revert() (http.cookiejar.FileCookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line  149)
* rewind() (wave.Wave_read のメソッド):  Wave_read オブジェクト.
                                                             (line   65)
* RFC_4122 (uuid モジュール):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  295)
* RFC; RFC 1123:                         関数<5>.            (line  759)
* RFC; RFC 1123 <1>:                     関数<5>.            (line  772)
* RFC; RFC 1123 <2>:                     関数<5>.            (line  789)
* RFC; RFC 1321:                         hashlib --- セキュアハッシュとメッセージダイジェスト.
                                                             (line   15)
* RFC; RFC 1422:                         証明書.             (line   32)
* RFC; RFC 1422 <1>:                     TLS 1 3.            (line   45)
* RFC; RFC 1494:                         mimetypes<3>.       (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  300)
* 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  301)
* 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   52)
* RFC; RFC 1808 <3>:                     URL の解析.         (line  301)
* RFC; RFC 1808 <4>:                     URL のクオート.     (line  184)
* RFC; RFC 1869:                         smtplib --- SMTP プロトコルクライアント.
                                                             (line   13)
* RFC; RFC 1869 <1>:                     smtplib --- SMTP プロトコルクライアント.
                                                             (line  219)
* 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  233)
* RFC; RFC 2045 <5>:                     email headerregistry Custom Header Objects.
                                                             (line  293)
* 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<8>.           (line   29)
* RFC; RFC 2047 <2>:                     ライブラリ.         (line  132)
* RFC; RFC 2047 <3>:                     ライブラリ<2>.      (line  445)
* RFC; RFC 2047 <4>:                     ライブラリ<2>.      (line  454)
* RFC; RFC 2047 <5>:                     ライブラリ<4>.      (line  115)
* RFC; RFC 2047 <6>:                     email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   15)
* RFC; RFC 2047 <7>:                     email policy Policy Objects.
                                                             (line  361)
* RFC; RFC 2047 <8>:                     email policy Policy Objects.
                                                             (line  367)
* RFC; RFC 2047 <9>:                     email policy Policy Objects.
                                                             (line  380)
* RFC; RFC 2047 <10>:                    email policy Policy Objects.
                                                             (line  388)
* RFC; RFC 2047 <11>:                    email policy Policy Objects.
                                                             (line  399)
* RFC; RFC 2047 <12>:                    email headerregistry Custom Header Objects.
                                                             (line   78)
* RFC; RFC 2047 <13>:                    email headerregistry Custom Header Objects.
                                                             (line  121)
* RFC; RFC 2047 <14>:                    email headerregistry Custom Header Objects.
                                                             (line  125)
* RFC; RFC 2047 <15>:                    email header 国際化されたヘッダー.
                                                             (line   29)
* RFC; RFC 2047 <16>:                    email header 国際化されたヘッダー.
                                                             (line   51)
* RFC; RFC 2047 <17>:                    email header 国際化されたヘッダー.
                                                             (line  111)
* RFC; RFC 2047 <18>:                    email header 国際化されたヘッダー.
                                                             (line  135)
* RFC; RFC 2047 <19>:                    email utils Miscellaneous utilities.
                                                             (line   79)
* RFC; RFC 2060:                         imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   12)
* RFC; RFC 2060 <1>:                     IMAP4 オブジェクト. (line  411)
* RFC; RFC 2068:                         http cookies --- HTTP の状態管理.
                                                             (line   15)
* RFC; RFC 2087:                         IMAP4 オブジェクト. (line  125)
* RFC; RFC 2087 <1>:                     IMAP4 オブジェクト. (line  130)
* RFC; RFC 2087 <2>:                     IMAP4 オブジェクト. (line  360)
* RFC; RFC 2104:                         hmac.               (line    6)
* RFC; RFC 2104 <1>:                     新しいモジュールと改良されたモジュール<3>.
                                                             (line   34)
* RFC; RFC 2104 <2>:                     ライブラリ<34>.     (line    6)
* RFC; RFC 2104 <3>:                     hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   10)
* RFC; RFC 2109:                         Python API の変更<10>.
                                                             (line   77)
* 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  111)
* RFC; RFC 2109 <7>:                     Morselオブジェクト. (line  123)
* 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  136)
* 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:                         ライブラリ<15>.     (line  907)
* RFC; RFC 2231 <1>:                     ライブラリ<60>.     (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  255)
* RFC; RFC 2361:                         mimetypes<3>.       (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<6>.    (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>:                     テスト<50>.         (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<7>.    (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<14>.            (line   17)
* RFC; RFC 2821:                         email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   12)
* RFC; RFC 2822:                         新しいモジュールと改良されたモジュール<3>.
                                                             (line   98)
* RFC; RFC 2822 <1>:                     関数<5>.            (line  761)
* RFC; RFC 2822 <2>:                     関数<5>.            (line  774)
* RFC; RFC 2822 <3>:                     関数<5>.            (line  791)
* 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  165)
* RFC; RFC 3330:                         Address オブジェクト.
                                                             (line  181)
* RFC; RFC 3339:                         メッセージ内での日付と時刻の表示.
                                                             (line   17)
* RFC; RFC 3362:                         mimetypes<3>.       (line   41)
* RFC; RFC 3454:                         セキュリティ<25>.   (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:                         セキュリティ<25>.   (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  424)
* RFC; RFC 3542:                         ライブラリ<167>.    (line  350)
* RFC; RFC 3542 <1>:                     その他の関数<2>.    (line  348)
* RFC; RFC 3548:                         新たなモジュール、改良されたモジュール、非推奨のモジュール<3>.
                                                             (line   15)
* RFC; RFC 3596 Section 2.5:             ライブラリ<51>.     (line  340)
* RFC; RFC 3659:                         FTP オブジェクト.   (line  286)
* RFC; RFC 3745:                         mimetypes<3>.       (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<3>.       (line   46)
* RFC; RFC 3986:                         urllib parse<2>.    (line   17)
* RFC; RFC 3986 <1>:                     urllib parse<4>.    (line    7)
* RFC; RFC 3986 <2>:                     urllib parse<5>.    (line    7)
* RFC; RFC 3986 <3>:                     urllib parse<6>.    (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>:                     ライブラリ<47>.     (line  197)
* RFC; RFC 3986 <8>:                     urllib parse --- URL を構成要素に解析する.
                                                             (line   35)
* RFC; RFC 3986 <9>:                     URL の解析.         (line  132)
* RFC; RFC 3986 <10>:                    URL の解析.         (line  158)
* RFC; RFC 3986 <11>:                    URL の解析.         (line  304)
* RFC; RFC 3986 <12>:                    URL の解析.         (line  363)
* RFC; RFC 3986 <13>:                    URL parsing security.
                                                             (line   26)
* 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<3>.       (line   49)
* RFC; RFC 4086:                         TLS 1 3.            (line   49)
* 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:                         ライブラリ<69>.     (line 1074)
* RFC; RFC 4291 <1>:                     ライブラリ<121>.    (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<3>.       (line   60)
* RFC; RFC 4366:                         ssl<14>.            (line   26)
* RFC; RFC 4380:                         Address オブジェクト.
                                                             (line  322)
* RFC; RFC 4627:                         json --- JSON エンコーダーとデコーダー.
                                                             (line   10)
* RFC; RFC 4627 <1>:                     トップレベルの非オブジェクト、非配列の値の扱い.
                                                             (line    6)
* RFC; RFC 4648:                         ライブラリ<3>.      (line  247)
* RFC; RFC 4648 <1>:                     ドキュメント<36>.   (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  149)
* RFC; RFC 4648 <6>:                     セキュリティで考慮すべき点<4>.
                                                             (line    6)
* RFC; RFC 4648 <7>:                     binascii --- バイナリ と ASCII 間の変換.
                                                             (line   75)
* RFC; RFC 4648 <8>:                     binascii --- バイナリ と ASCII 間の変換.
                                                             (line   86)
* RFC; RFC 4648 <9>:                     binascii --- バイナリ と ASCII 間の変換.
                                                             (line   98)
* RFC; RFC 4648 <10>:                    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  233)
* RFC; RFC 4648 <11>:                    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  241)
* RFC; RFC 4648 <12>:                    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  258)
* RFC; RFC 4648 <13>:                    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  268)
* RFC; RFC 4648 <14>:                    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  388)
* RFC; RFC 4648 <15>:                    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  394)
* RFC; RFC 4648 <16>:                    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  439)
* RFC; RFC 4648 <17>:                    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  445)
* RFC; RFC 4648 <18>:                    セキュリティで考慮すべき点<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  132)
* RFC; RFC 4954 <1>:                     SMTP オブジェクト.  (line  155)
* RFC; RFC 5161:                         imaplib<3>.         (line   11)
* RFC; RFC 5161 <1>:                     IMAP4 オブジェクト. (line   91)
* RFC; RFC 5246:                         定数<9>.            (line  529)
* RFC; RFC 5246 <1>:                     TLS 1 3.            (line   57)
* RFC; RFC 5280:                         ssl<3>.             (line   10)
* RFC; RFC 5280 <1>:                     その他の変更.       (line   20)
* RFC; RFC 5280 <2>:                     Python API の変更<10>.
                                                             (line   99)
* 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   53)
* RFC; RFC 5321:                         smtpd<4>.           (line    6)
* RFC; RFC 5321 <1>:                     email headerregistry Custom Header Objects.
                                                             (line  448)
* RFC; RFC 5322:                         ライブラリ<2>.      (line  466)
* RFC; RFC 5322 <1>:                     Batteries included. (line   15)
* RFC; RFC 5322 <2>:                     関数<5>.            (line  761)
* RFC; RFC 5322 <3>:                     関数<5>.            (line  774)
* RFC; RFC 5322 <4>:                     関数<5>.            (line  473)
* RFC; RFC 5322 <5>:                     関数<5>.            (line  791)
* RFC; RFC 5322 <6>:                     email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   14)
* RFC; RFC 5322 <7>:                     email message Representing an email message.
                                                             (line   20)
* RFC; RFC 5322 <8>:                     email message Representing an email message.
                                                             (line   31)
* RFC; RFC 5322 <9>:                     Parser API.         (line   41)
* RFC; RFC 5322 <10>:                    email generator Generating MIME documents.
                                                             (line  101)
* RFC; RFC 5322 <11>:                    email generator Generating MIME documents.
                                                             (line  192)
* RFC; RFC 5322 <12>:                    email policy Policy Objects.
                                                             (line  147)
* RFC; RFC 5322 <13>:                    email policy Policy Objects.
                                                             (line  340)
* RFC; RFC 5322 <14>:                    email policy Policy Objects.
                                                             (line  361)
* RFC; RFC 5322 <15>:                    email policy Policy Objects.
                                                             (line  367)
* RFC; RFC 5322 <16>:                    email policy Policy Objects.
                                                             (line  379)
* RFC; RFC 5322 <17>:                    email policy Policy Objects.
                                                             (line  429)
* RFC; RFC 5322 <18>:                    email errors Exception and Defect classes.
                                                             (line   28)
* RFC; RFC 5322 <19>:                    email headerregistry Custom Header Objects.
                                                             (line   15)
* RFC; RFC 5322 <20>:                    email headerregistry Custom Header Objects.
                                                             (line  115)
* RFC; RFC 5322 <21>:                    email headerregistry Custom Header Objects.
                                                             (line  120)
* RFC; RFC 5322 <22>:                    email headerregistry Custom Header Objects.
                                                             (line  122)
* RFC; RFC 5322 <23>:                    email headerregistry Custom Header Objects.
                                                             (line  136)
* RFC; RFC 5322 <24>:                    email headerregistry Custom Header Objects.
                                                             (line  155)
* RFC; RFC 5322 <25>:                    email headerregistry Custom Header Objects.
                                                             (line  412)
* RFC; RFC 5322 <26>:                    email headerregistry Custom Header Objects.
                                                             (line  445)
* RFC; RFC 5322 <27>:                    email headerregistry Custom Header Objects.
                                                             (line  479)
* RFC; RFC 5322 <28>:                    email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line   21)
* RFC; RFC 5322 <29>:                    Message オブジェクト.
                                                             (line   17)
* RFC; RFC 5322 <30>:                    http client --- HTTP プロトコルクライアント.
                                                             (line  128)
* RFC; RFC 5322 <31>:                    SMTP オブジェクト.  (line  309)
* RFC; RFC 5322 <32>:                    http server --- HTTP サーバー.
                                                             (line  164)
* RFC; RFC 5322 Section 2.2:             ライブラリ<33>.     (line  171)
* RFC; RFC 5334:                         mimetypes<3>.       (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<13>.            (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:                         セキュリティ<25>.   (line   20)
* RFC; RFC 5895:                         encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   12)
* RFC; RFC 5929:                         SSL sockets.        (line  295)
* RFC; RFC 6066:                         定数<9>.            (line  410)
* RFC; RFC 6066 <1>:                     SSL contexts.       (line  363)
* RFC; RFC 6066 <2>:                     TLS 1 3.            (line   61)
* RFC; RFC 6152:                         smtpd<2>.           (line   15)
* RFC; RFC 6531:                         email<5>.           (line   19)
* RFC; RFC 6531 <1>:                     smtpd<2>.           (line   21)
* RFC; RFC 6531 <2>:                     smtplib<2>.         (line   15)
* RFC; RFC 6531 <3>:                     email message Representing an email message.
                                                             (line  103)
* RFC; RFC 6531 <4>:                     email policy Policy Objects.
                                                             (line  384)
* RFC; RFC 6531 <5>:                     smtplib --- SMTP プロトコルクライアント.
                                                             (line   77)
* RFC; RFC 6532:                         email<5>.           (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<3>.       (line   64)
* RFC; RFC 6855:                         imaplib<3>.         (line   12)
* RFC; RFC 6855 <1>:                     imaplib<3>.         (line   14)
* RFC; RFC 6855 <2>:                     IMAP4 オブジェクト. (line   93)
* RFC; RFC 6855 <3>:                     IMAP4 オブジェクト. (line   95)
* 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  206)
* RFC; RFC 7301:                         Application-Layer Protocol Negotiation Support.
                                                             (line   10)
* RFC; RFC 7301 <1>:                     定数<9>.            (line  386)
* RFC; RFC 7301 <2>:                     SSL contexts.       (line  333)
* RFC; RFC 7525:                         TLS 1 3.            (line   69)
* RFC; RFC 7538:                         ライブラリ<111>.    (line  171)
* RFC; RFC 7616:                         urllib.             (line    8)
* RFC; RFC 7616 <1>:                     ライブラリ<43>.     (line    8)
* RFC; RFC 7693:                         BLAKE2.             (line    6)
* RFC; RFC 7725:                         HTTP ステータスコード.
                                                             (line  163)
* RFC; RFC 7903:                         mimetypes<3>.       (line   51)
* RFC; RFC 7914:                         鍵導出.             (line   52)
* RFC; RFC 8081:                         mimetypes<3>.       (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  214)
* RFC; RFC 822:                          新しいモジュールと改良されたモジュール<3>.
                                                             (line   98)
* RFC; RFC 822 <1>:                      関数<5>.            (line  754)
* RFC; RFC 822 <2>:                      関数<5>.            (line  757)
* RFC; RFC 822 <3>:                      関数<5>.            (line  767)
* RFC; RFC 822 <4>:                      関数<5>.            (line  770)
* RFC; RFC 822 <5>:                      関数<5>.            (line  784)
* RFC; RFC 822 <6>:                      関数<5>.            (line  787)
* RFC; RFC 822 <7>:                      email 使用例.       (line   36)
* RFC; RFC 822 <8>:                      email header 国際化されたヘッダー.
                                                             (line   19)
* RFC; RFC 822 <9>:                      HTTPConnection オブジェクト.
                                                             (line  193)
* RFC; RFC 822 <10>:                     SMTP オブジェクト.  (line   94)
* RFC; RFC 822 <11>:                     SMTP オブジェクト.  (line  227)
* RFC; RFC 822 <12>:                     SMTP オブジェクト.  (line  228)
* 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:                          ライブラリ<45>.     (line  212)
* RFC; RFC 9110:                         ライブラリ<45>.     (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:                         ライブラリ<92>.     (line   74)
* RFC; RFC 9258:                         ssl.                (line    8)
* RFC; RFC 9258 <1>:                     定数<9>.            (line  476)
* RFC; RFC 9309:                         ライブラリ<2>.      (line  157)
* RFC; RFC 9309 <1>:                     urllib robotparser --- robots txt 用のパーサー.
                                                             (line   13)
* RFC; RFC 9512:                         mimetypes<3>.       (line   68)
* RFC; RFC 9512 <1>:                     ライブラリ<29>.     (line  273)
* RFC; RFC 9559:                         mimetypes<3>.       (line   27)
* RFC; RFC 9559 <1>:                     ライブラリ<47>.     (line  105)
* RFC; RFC 9562:                         uuid.               (line    8)
* RFC; RFC 9562 <1>:                     uuid.               (line   12)
* RFC; RFC 9562 <2>:                     ライブラリ<35>.     (line  256)
* RFC; RFC 9562 <3>:                     ライブラリ<35>.     (line  259)
* RFC; RFC 9562 <4>:                     ライブラリ<38>.     (line  174)
* RFC; RFC 9562 <5>:                     ライブラリ<47>.     (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:          ライブラリ<15>.     (line  793)
* RFC; RFC 959:                          ftplib --- FTP プロトコルクライアント.
                                                             (line   16)
* RFC; RFC 9639:                         mimetypes<3>.       (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  219)
* rfind() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  219)
* rfind() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  312)
* rfind() (str のメソッド):              文字列メソッド<2>.  (line  597)
* 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)
* right (filecmp.dircmp の属性):         dircmp クラス.      (line   48)
* right_list (filecmp.dircmp の属性):    dircmp クラス.      (line   57)
* right_only (filecmp.dircmp の属性):    dircmp クラス.      (line   71)
* right() (turtle モジュール):           Turtle の動き.      (line   40)
* RIGHTSHIFT (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  284)
* RIGHTSHIFTEQUAL (token モジュール):    token --- Python 解析木で使われる定数.
                                                             (line  317)
* rindex() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  233)
* rindex() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  233)
* rindex() (str のメソッド):             文字列メソッド<2>.  (line  611)
* rjust() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  349)
* rjust() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  349)
* rjust() (str のメソッド):              文字列メソッド<2>.  (line  627)
* RLIM_INFINITY (resource モジュール):   リソースの制限.     (line   22)
* RLIM_SAVED_CUR (resource モジュール):  リソースの制限.     (line   29)
* RLIM_SAVED_MAX (resource モジュール):  リソースの制限.     (line   31)
* RLIMIT_AS (resource モジュール):       リソースの制限.     (line  163)
* RLIMIT_CORE (resource モジュール):     リソースの制限.     (line  106)
* RLIMIT_CPU (resource モジュール):      リソースの制限.     (line  113)
* RLIMIT_DATA (resource モジュール):     リソースの制限.     (line  125)
* RLIMIT_FSIZE (resource モジュール):    リソースの制限.     (line  121)
* RLIMIT_KQUEUES (resource モジュール):  リソースの制限.     (line  237)
* RLIMIT_MEMLOCK (resource モジュール):  リソースの制限.     (line  152)
* RLIMIT_MSGQUEUE (resource モジュール): リソースの制限.     (line  167)
* RLIMIT_NICE (resource モジュール):     リソースの制限.     (line  175)
* RLIMIT_NOFILE (resource モジュール):   リソースの制限.     (line  144)
* RLIMIT_NPROC (resource モジュール):    リソースの制限.     (line  140)
* RLIMIT_NPTS (resource モジュール):     リソースの制限.     (line  229)
* RLIMIT_NTHR (resource モジュール):     リソースの制限.     (line  245)
* RLIMIT_OFILE (resource モジュール):    リソースの制限.     (line  148)
* RLIMIT_PIPEBUF (resource モジュール):  リソースの制限.     (line  254)
* RLIMIT_RSS (resource モジュール):      リソースの制限.     (line  135)
* RLIMIT_RTPRIO (resource モジュール):   リソースの制限.     (line  183)
* RLIMIT_RTTIME (resource モジュール):   リソースの制限.     (line  191)
* RLIMIT_SBSIZE (resource モジュール):   リソースの制限.     (line  208)
* RLIMIT_SIGPENDING (resource モジュール): リソースの制限.   (line  200)
* RLIMIT_STACK (resource モジュール):    リソースの制限.     (line  129)
* RLIMIT_SWAP (resource モジュール):     リソースの制限.     (line  218)
* RLIMIT_THREADS (resource モジュール):  リソースの制限.     (line  263)
* RLIMIT_UMTXP (resource モジュール):    リソースの制限.     (line  271)
* RLIMIT_VMEM (resource モジュール):     リソースの制限.     (line  156)
* 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  861)
* 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  110)
* 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_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  731)
* Row (sqlite3 のクラス):                Row オブジェクト.   (line    6)
* row_factory (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  804)
* row_factory (sqlite3.Cursor の属性):   Cursor オブジェクト.
                                                             (line  229)
* rowcount (sqlite3.Cursor の属性):      Cursor オブジェクト.
                                                             (line  220)
* RPAR (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  206)
* rpartition() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  245)
* rpartition() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  245)
* rpartition() (str のメソッド):         文字列メソッド<2>.  (line  644)
* 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  361)
* rsplit() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  361)
* rsplit() (str のメソッド):             文字列メソッド<2>.  (line  662)
* RSQB (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  212)
* rstrip() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  372)
* rstrip() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  372)
* rstrip() (str のメソッド):             文字列メソッド<2>.  (line  671)
* rt() (turtle モジュール):              Turtle の動き.      (line   40)
* RTLD_DEEPBIND (os モジュール):         雑多なシステム情報. (line  162)
* RTLD_GLOBAL (ctypes モジュール):       共有ライブラリをロードする.
                                                             (line  173)
* RTLD_GLOBAL (os モジュール):           雑多なシステム情報. (line  162)
* RTLD_LAZY (os モジュール):             雑多なシステム情報. (line  162)
* RTLD_LOCAL (ctypes モジュール):        共有ライブラリをロードする.
                                                             (line  178)
* 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   99)
* 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  473)
* run() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line   64)
* run() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line  115)
* run() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line   68)
* run() (pdb モジュール):                コマンドライン・インターフェース<8>.
                                                             (line   84)
* run() (pdb.Pdb のメソッド):            コマンドライン・インターフェース<8>.
                                                             (line  241)
* run() (profile モジュール):            profile and profiling tracing module reference.
                                                             (line    9)
* run() (profile.Profile のメソッド):    profile and profiling tracing module reference.
                                                             (line  113)
* run() (profiling.tracing モジュール):  Module reference.   (line    6)
* run() (profiling.tracing.Profile のメソッド): Module reference.
                                                             (line   82)
* 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  989)
* 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  489)
* runcall() (pdb モジュール):            コマンドライン・インターフェース<8>.
                                                             (line  103)
* runcall() (pdb.Pdb のメソッド):        コマンドライン・インターフェース<8>.
                                                             (line  241)
* runcall() (profile.Profile のメソッド): profile and profiling tracing module reference.
                                                             (line  122)
* runcall() (profiling.tracing.Profile のメソッド): Module reference.
                                                             (line   91)
* runcode() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   33)
* runctx() (bdb.Bdb のメソッド):         bdb --- デバッガーフレームワーク.
                                                             (line  484)
* runctx() (profile モジュール):         profile and profiling tracing module reference.
                                                             (line   23)
* runctx() (profile.Profile のメソッド): profile and profiling tracing module reference.
                                                             (line  117)
* runctx() (profiling.tracing モジュール): Module reference. (line   24)
* runctx() (profiling.tracing.Profile のメソッド): Module reference.
                                                             (line   86)
* runctx() (trace.Trace のメソッド):     プログラミングインターフェース.
                                                             (line   27)
* runeval() (bdb.Bdb のメソッド):        bdb --- デバッガーフレームワーク.
                                                             (line  479)
* 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  388)
* runtime_checkable() (typing モジュール): Other special directives.
                                                             (line  176)
* RuntimeError:                          具象例外.           (line  270)
* 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  736)
* RWF_ATOMIC (os モジュール):            ファイル記述子の操作.
                                                             (line  645)
* RWF_DONTCACHE (os モジュール):         ファイル記述子の操作.
                                                             (line  637)
* RWF_DSYNC (os モジュール):             ファイル記述子の操作.
                                                             (line  716)
* RWF_HIPRI (os モジュール):             ファイル記述子の操作.
                                                             (line  624)
* RWF_NOWAIT (os モジュール):            ファイル記述子の操作.
                                                             (line  610)
* RWF_SYNC (os モジュール):              ファイル記述子の操作.
                                                             (line  726)
* S (re モジュール):                     フラグ.             (line  103)
* S_ENFMT (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  323)
* S_IEXEC (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  337)
* S_IFBLK (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  211)
* S_IFCHR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  219)
* S_IFDIR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  215)
* S_IFDOOR (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  227)
* S_IFIFO (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  223)
* S_IFLNK (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  203)
* S_IFMT() (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line   83)
* S_IFPORT (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  233)
* S_IFREG (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  207)
* S_IFSOCK (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  199)
* S_IFWHT (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  239)
* S_IMODE() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   75)
* S_IREAD (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  329)
* S_IRGRP (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  295)
* S_IROTH (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  311)
* S_IRUSR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  279)
* S_IRWXG (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  291)
* S_IRWXO (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  307)
* S_IRWXU (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  275)
* S_ISBLK() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   31)
* S_ISCHR() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   26)
* S_ISDIR() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   22)
* S_ISDOOR() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line   54)
* S_ISFIFO() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line   40)
* S_ISGID (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  256)
* S_ISLNK() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   45)
* S_ISPORT() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line   60)
* S_ISREG() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   36)
* S_ISSOCK() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line   50)
* S_ISUID (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  252)
* S_ISVTX (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  268)
* S_ISWHT() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   66)
* S_IWGRP (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  299)
* S_IWOTH (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  315)
* S_IWRITE (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  333)
* S_IWUSR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  283)
* S_IXGRP (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  303)
* S_IXOTH (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  319)
* S_IXUSR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  287)
* safe (uuid.SafeUUID の属性):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   36)
* safe_path (sys.flags の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line  613)
* safe_substitute() (string.Template のメソッド): Template strings $-strings.
                                                             (line   60)
* saferepr() (pprint モジュール):        関数<4>.            (line   95)
* 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  484)
* samefile() (pathlib.Path のメソッド):  ファイルの種類とステータスを問い合わせる.
                                                             (line  154)
* SameFileError:                         ディレクトリとファイルの操作.
                                                             (line   67)
* sameopenfile() (os.path モジュール):   os path --- 一般的なパス名操作.
                                                             (line  499)
* samesite (http.cookies.Morsel の属性): Morselオブジェクト. (line   13)
* samestat() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  509)
* sample() (random モジュール):          シーケンス用の関数. (line   65)
* samples() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line   58)
* SATURDAY (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  444)
* save() (http.cookiejar.FileCookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line  110)
* save() (test.support.SaveSignals のメソッド): test support --- Utilities for the Python test suite.
                                                             (line  809)
* save() (turtle モジュール):            Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   20)
* SaveAs (tkinter.filedialog のクラス):  ネイティブの読み込み/保存ダイアログ.
                                                             (line   59)
* SAVEDCWD (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   14)
* SaveFileDialog (tkinter.filedialog のクラス): ネイティブの読み込み/保存ダイアログ.
                                                             (line  144)
* SaveKey() (winreg モジュール):         関数<14>.           (line  411)
* SaveSignals (test.support のクラス):   test support --- Utilities for the Python test suite.
                                                             (line  804)
* savetty() (curses モジュール):         関数<6>.            (line  446)
* SAX2DOM (xml.dom.pulldom のクラス):    xml dom pulldom --- 部分的な DOM ツリー構築のサポート.
                                                             (line   79)
* SAXException:                          xml sax --- SAX2 バーサーのサポート.
                                                             (line   88)
* SAXNotRecognizedException:             xml sax --- SAX2 バーサーのサポート.
                                                             (line  112)
* SAXNotSupportedException:              xml sax --- SAX2 バーサーのサポート.
                                                             (line  119)
* SAXParseException:                     xml sax --- SAX2 バーサーのサポート.
                                                             (line  104)
* scaleb() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  517)
* scaleb() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  537)
* scandir() (os モジュール):             ファイルとディレクトリ.
                                                             (line  879)
* 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  416)
* scope_id (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  306)
* Screen (turtle のクラス):              Public classes.     (line   30)
* screensize() (turtle モジュール):      ウィンドウの制御.   (line   88)
* script_from_examples() (doctest モジュール): デバッグ.     (line   72)
* scroll() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  492)
* ScrolledCanvas (turtle のクラス):      Public classes.     (line   35)
* ScrolledText (tkinter.scrolledtext のクラス): tkinter scrolledtext --- スクロール可能なテキストウィジェット.
                                                             (line   24)
* scrollok() (curses.window のメソッド): Window オブジェクト.
                                                             (line  496)
* scrypt() (hashlib モジュール):         鍵導出.             (line   49)
* seal() (unittest.mock モジュール):     Sealing mocks.      (line    6)
* search_function() (encodings モジュール): encodings --- Encodings package.
                                                             (line   23)
* search_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   83)
* search() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  316)
* search() (re モジュール):              関数<2>.            (line   35)
* search() (re.Pattern のメソッド):      Regular expression objects.
                                                             (line   15)
* second (datetime.datetime の属性):     datetime objects.   (line  330)
* 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  698)
* see() (tkinter.ttk.Treeview のメソッド): ttk Treeview.     (line  240)
* seed_bits (sys.hash_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 1149)
* seed() (random モジュール):            保守 bookkeeping 関数.
                                                             (line    6)
* seed() (random.Random のメソッド):     他の生成器.         (line   19)
* SEEK_CUR (os モジュール):              ファイル記述子の操作.
                                                             (line  324)
* SEEK_DATA (os モジュール):             ファイル記述子の操作.
                                                             (line  348)
* SEEK_END (os モジュール):              ファイル記述子の操作.
                                                             (line  324)
* SEEK_HOLE (os モジュール):             ファイル記述子の操作.
                                                             (line  348)
* SEEK_SET (os モジュール):              ファイル記述子の操作.
                                                             (line  324)
* seek() (io.IOBase のメソッド):         I/O 基底クラス.     (line  105)
* seek() (io.TextIOBase のメソッド):     テキスト I/O<2>.    (line   64)
* seek() (io.TextIOWrapper のメソッド):  テキスト I/O<2>.    (line  204)
* seek() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  322)
* seek() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   66)
* seekable() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line   97)
* seekable() (io.IOBase のメソッド):     I/O 基底クラス.     (line  128)
* seekable() (mmap.mmap のメソッド):     mmap --- メモリマップファイルのサポート.
                                                             (line  333)
* select() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  333)
* select() (select モジュール):          select --- I/O 完了の待機.
                                                             (line  123)
* select() (selectors.BaseSelector のメソッド): クラス<4>.   (line  112)
* select() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   52)
* selected_alpn_protocol() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  302)
* selected_npn_protocol() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  312)
* selection_add() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  263)
* selection_remove() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  270)
* selection_set() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  256)
* selection_toggle() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  277)
* selection() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  248)
* selector (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   34)
* SelectorEventLoop (asyncio のクラス):  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_fds() (socket モジュール):        その他の関数<2>.    (line  472)
* send_header() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  301)
* send_message() (smtplib.SMTP のメソッド): SMTP オブジェクト.
                                                             (line  299)
* 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   99)
* send() (coroutine のメソッド):         コルーチンオブジェクト.
                                                             (line   22)
* send() (generator のメソッド):         ジェネレータ-イテレータメソッド.
                                                             (line   27)
* send() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  225)
* send() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  340)
* 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  396)
* sendall() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  412)
* sendcmd() (ftplib.FTP のメソッド):     FTP オブジェクト.   (line  156)
* sendfile() (asyncio.loop のメソッド):  ファイルの転送.     (line    6)
* sendfile() (os モジュール):            ファイル記述子の操作.
                                                             (line  797)
* sendfile() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  504)
* sendfile() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  278)
* SendfileNotAvailableError:             例外<17>.           (line   38)
* sendfunc (C type):                     Slot Type typedefs. (line  125)
* sendmail() (smtplib.SMTP のメソッド):  SMTP オブジェクト.  (line  224)
* sendmsg_afalg() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  493)
* sendmsg() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  450)
* sendto() (asyncio.DatagramTransport のメソッド): データグラムトランスポート.
                                                             (line    6)
* sendto() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  431)
* sentinel (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  188)
* sentinel (unittest.mock モジュール):   sentinel.           (line    6)
* sentinel (組み込みクラス):             組み込み関数.       (line 1759)
* sep (os モジュール):                   雑多なシステム情報. (line  111)
* SEPTEMBER (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  517)
* sequence:                              用語集<2>.          (line 1573)
* 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)
* serialize_iterator (threading のクラス): Iterator synchronization.
                                                             (line   25)
* serialize() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  684)
* 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  381)
* server_side (ssl.SSLSocket の属性):    SSL sockets.        (line  374)
* server_sigalg() (ssl.SSLSocket のメソッド): SSL sockets.   (line  269)
* 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  415)
* ServerProxy (xmlrpc.client のクラス):  xmlrpc client --- XML-RPC クライアントアクセス.
                                                             (line   29)
* service_actions() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line   45)
* session (ssl.SSLSocket の属性):        SSL sockets.        (line  393)
* session_reused (ssl.SSLSocket の属性): SSL sockets.        (line  403)
* session_stats() (ssl.SSLContext のメソッド): SSL contexts. (line  554)
* Set (ast のクラス):                    リテラル<3>.        (line  159)
* 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 1594)
* 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  329)
* set_app() (wsgiref.simple_server.WSGIServer のメソッド): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   64)
* set_asyncgen_hooks() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1937)
* set_authorizer() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  352)
* set_auto_history() (readline モジュール): 履歴リスト.      (line   42)
* set_blocked_domains() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   55)
* set_blocking() (os モジュール):        ファイル記述子の操作.
                                                             (line  858)
* 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  363)
* set_charset() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  237)
* set_children() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line   26)
* set_ciphers() (ssl.SSLContext のメソッド): SSL contexts.   (line  260)
* set_ciphersuites() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  276)
* set_client_sigalgs() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  303)
* 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  347)
* 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 1962)
* 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  260)
* 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  251)
* set_defaults() (argparse.ArgumentParser のメソッド): パーサーのデフォルト値.
                                                             (line    6)
* set_defaults() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line   27)
* set_ecdh_curve() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  440)
* set_errno() (ctypes モジュール):       ユーティリティー関数.
                                                             (line  220)
* set_error_mode() (msvcrt モジュール):  その多の関数.       (line   12)
* set_escdelay() (curses モジュール):    関数<6>.            (line  457)
* 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   57)
* set_exception() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line  119)
* set_executable() (multiprocessing モジュール): その他<5>.  (line  118)
* set_filter() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  126)
* set_flags() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  108)
* set_flags() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   77)
* set_flags() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   72)
* set_flags() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   71)
* set_forkserver_preload() (multiprocessing モジュール): その他<5>.
                                                             (line  134)
* set_from() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   55)
* set_from() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   54)
* SET_FUNCTION_ATTRIBUTE (opcode):       Python バイトコード命令.
                                                             (line 1163)
* set_groups() (ssl.SSLContext のメソッド): SSL contexts.    (line  291)
* 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  520)
* set_int_max_str_digits() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1685)
* set_labels() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   50)
* set_last_error() (ctypes モジュール):  ユーティリティー関数.
                                                             (line  228)
* set_lazy_imports_filter() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1718)
* set_lazy_imports() (sys モジュール):   sys --- システム固有のパラメーターと関数.
                                                             (line 1693)
* set_local_events() (sys.monitoring モジュール): Per code object events.
                                                             (line   16)
* set_memlimit() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  329)
* set_name() (asyncio.Task のメソッド):  Task object.        (line  189)
* set_name() (mmap.mmap のメソッド):     mmap --- メモリマップファイルのサポート.
                                                             (line  340)
* set_next() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  324)
* set_nonstandard_attr() (http.cookiejar.Cookie のメソッド): Cookieオブジェクト<2>.
                                                             (line  109)
* set_npn_protocols() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  343)
* 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  384)
* set_protocol() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line   82)
* set_proxy() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  116)
* set_psk_client_callback() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  733)
* set_psk_server_callback() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  785)
* set_quit() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  353)
* set_result() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   50)
* set_result() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line  107)
* set_return() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  329)
* set_running_or_notify_cancel() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   86)
* set_selection() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  130)
* 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_sigalgs() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  316)
* 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  411)
* set_start_method() (multiprocessing モジュール): その他<5>.
                                                             (line  161)
* set_startup_hook() (readline モジュール): 開始フック.      (line    6)
* set_step() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  320)
* set_subdir() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   62)
* set_tabsize() (curses モジュール):     関数<6>.            (line  472)
* set_task_factory() (asyncio.loop のメソッド): Creating futures and tasks.
                                                             (line   61)
* set_threshold() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  104)
* set_trace_async() (pdb モジュール):    コマンドライン・インターフェース<8>.
                                                             (line  126)
* set_trace_callback() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  401)
* set_trace() (bdb モジュール):          bdb --- デバッガーフレームワーク.
                                                             (line  522)
* set_trace() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  338)
* 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  178)
* 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  333)
* 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 オブジェクト.
                                                             (line   43)
* set_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   69)
* set_wakeup_fd() (signal モジュール):   モジュールの内容<4>.
                                                             (line  474)
* set_write_buffer_limits() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   35)
* set() (asyncio.Event のメソッド):      Event.              (line   52)
* set() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  277)
* set() (configparser.RawConfigParser のメソッド): RawConfigParser オブジェクト.
                                                             (line   54)
* set() (contextvars.ContextVar のメソッド): コンテキスト変数.
                                                             (line   45)
* set() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line   75)
* set() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  241)
* set() (test.support.os_helper.EnvironmentVarGuard のメソッド): test support os_helper --- Utilities for os tests.
                                                             (line   64)
* set() (threading.Event のメソッド):    Event objects.      (line   31)
* set() (tkinter.ttk.Combobox のメソッド): ttk Combobox.     (line   19)
* set() (tkinter.ttk.Spinbox のメソッド): ttk Spinbox.       (line   12)
* set() (tkinter.ttk.Treeview のメソッド): ttk Treeview.     (line  284)
* set() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   82)
* setacl() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  348)
* SetAllocTrackerActivationThreshold() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  189)
* SetAllocTrackerMaximumAmplification() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  211)
* setannotation() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  353)
* 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  118)
* SetBillionLaughsAttackProtectionMaximumAmplification() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  147)
* setblocking() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  527)
* 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   78)
* setconfig() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  668)
* setContentHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   26)
* setcontext() (decimal モジュール):     Context オブジェクト.
                                                             (line   18)
* setDaemon() (threading.Thread のメソッド): Thread objects. (line  257)
* setdefault() (dict のメソッド):        Mapping types --- dict frozendict.
                                                             (line  225)
* setdefault() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line  121)
* setdefaulttimeout() (socket モジュール): その他の関数<2>.  (line  388)
* setdlopenflags() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line 1672)
* setDocumentLocator() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   10)
* setDTDHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   35)
* setegid() (os モジュール):             プロセスのパラメーター.
                                                             (line  396)
* 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  402)
* setFeature() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   74)
* setfirstweekday() (calendar モジュール): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  347)
* setfirstweekday() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   52)
* setformat() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   91)
* setFormatter() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   50)
* setframerate() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   57)
* setgid() (os モジュール):              プロセスのパラメーター.
                                                             (line  408)
* setgroups() (os モジュール):           プロセスのパラメーター.
                                                             (line  414)
* seth() (turtle モジュール):            Turtle の動き.      (line  164)
* setheading() (turtle モジュール):      Turtle の動き.      (line  164)
* sethostname() (socket モジュール):     その他の関数<2>.    (line  398)
* setinputsizes() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  166)
* setitem() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  213)
* setitimer() (signal モジュール):       モジュールの内容<4>.
                                                             (line  440)
* setLevel() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   36)
* setLevel() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  104)
* setlimit() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  620)
* setlocale() (locale モジュール):       locale --- 国際化サービス.
                                                             (line   26)
* setLocale() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   59)
* setLoggerClass() (logging モジュール): モジュールレベルの関数.
                                                             (line  327)
* setlogmask() (syslog モジュール):      syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   98)
* setLogRecordFactory() (logging モジュール): モジュールレベルの関数.
                                                             (line  339)
* setMaxConns() (urllib.request.CacheFTPHandler のメソッド): CacheFTPHandler オブジェクト.
                                                             (line   13)
* setmode() (msvcrt モジュール):         ファイル操作関連.   (line   38)
* setName() (threading.Thread のメソッド): Thread objects.   (line  201)
* setnchannels() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   38)
* setnframes() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   68)
* setns() (os モジュール):               プロセスのパラメーター.
                                                             (line  429)
* setoutputsize() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  170)
* SetParamEntityParsing() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   53)
* setparams() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line  105)
* setpassword() (zipfile.ZipFile のメソッド): ZipFile objects.
                                                             (line  249)
* setpgid() (os モジュール):             プロセスのパラメーター.
                                                             (line  476)
* setpgrp() (os モジュール):             プロセスのパラメーター.
                                                             (line  468)
* setpos() (turtle モジュール):          Turtle の動き.      (line   74)
* setpos() (wave.Wave_read のメソッド):  Wave_read オブジェクト.
                                                             (line   72)
* setposition() (turtle モジュール):     Turtle の動き.      (line   74)
* setpriority() (os モジュール):         プロセスのパラメーター.
                                                             (line  484)
* setprofile_all_threads() (threading モジュール): リファレンス<2>.
                                                             (line  141)
* setprofile() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line 1751)
* setprofile() (threading モジュール):   リファレンス<2>.    (line  135)
* setProperty() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   87)
* setPublicId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line    6)
* setquota() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  358)
* setraw() (tty モジュール):             tty --- 端末制御用の関数群.
                                                             (line   43)
* setrecursionlimit() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1808)
* setregid() (os モジュール):            プロセスのパラメーター.
                                                             (line  501)
* SetReparseDeferralEnabled() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   80)
* setresgid() (os モジュール):           プロセスのパラメーター.
                                                             (line  507)
* setresuid() (os モジュール):           プロセスのパラメーター.
                                                             (line  516)
* setreuid() (os モジュール):            プロセスのパラメーター.
                                                             (line  525)
* setrlimit() (resource モジュール):     リソースの制限.     (line   46)
* setsampwidth() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   46)
* setscrreg() (curses.window のメソッド): Window オブジェクト.
                                                             (line  505)
* setsid() (os モジュール):              プロセスのパラメーター.
                                                             (line  538)
* setsockopt() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  562)
* 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 1826)
* setswitchinterval() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  312)
* setSystemId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   14)
* setsyx() (curses モジュール):          関数<6>.            (line  480)
* setTarget() (logging.handlers.MemoryHandler のメソッド): MemoryHandler.
                                                             (line   70)
* setter (C type):                       Defining Getters and Setters.
                                                             (line   42)
* settimeout() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  543)
* setTimeout() (urllib.request.CacheFTPHandler のメソッド): CacheFTPHandler オブジェクト.
                                                             (line    9)
* settrace_all_threads() (threading モジュール): リファレンス<2>.
                                                             (line  119)
* settrace() (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1838)
* settrace() (threading モジュール):     リファレンス<2>.    (line  113)
* setuid() (os モジュール):              プロセスのパラメーター.
                                                             (line  545)
* 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  152)
* setup_scripts() (venv.EnvBuilder のメソッド): API<2>.      (line  160)
* 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  485)
* SetValue() (winreg モジュール):        関数<14>.           (line  435)
* SetValueEx() (winreg モジュール):      関数<14>.           (line  464)
* setworldcoordinates() (turtle モジュール): ウィンドウの制御.
                                                             (line  116)
* setx() (turtle モジュール):            Turtle の動き.      (line  138)
* setxattr() (os モジュール):            Linux 拡張属性.     (line   62)
* 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  837)
* SF_NOCACHE (os モジュール):            ファイル記述子の操作.
                                                             (line  848)
* SF_NODISKIO (os モジュール):           ファイル記述子の操作.
                                                             (line  837)
* 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  837)
* 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  469)
* Shape (turtle のクラス):               Public classes.     (line   44)
* shape() (turtle モジュール):           見た目.             (line    6)
* shapesize() (turtle モジュール):       見た目.             (line   50)
* shapetransform() (turtle モジュール):  見た目.             (line  135)
* share() (socket.socket のメソッド):    socket オブジェクト.
                                                             (line  594)
* 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  242)
* shared_memory (sys._emscripten_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  397)
* 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   32)
* ShelveError:                           例外<7>.            (line    6)
* 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  847)
* 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 オブジェクト.
                                                             (line   49)
* show() (tkinter.commondialog.Dialog のメソッド): tkinter commondialog --- Dialog window templates.
                                                             (line   15)
* show() (tkinter.messagebox.Message のメソッド): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   82)
* showerror() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  105)
* showinfo() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   91)
* showsyntaxerror() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   44)
* showtraceback() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   53)
* showturtle() (turtle モジュール):      可視性.             (line   15)
* showwarning() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   99)
* showwarning() (warnings モジュール):   利用可能な関数.     (line  100)
* shuffle() (random モジュール):         シーケンス用の関数. (line   50)
* SHUT_RD (socket モジュール):           定数<8>.            (line  479)
* SHUT_RDWR (socket モジュール):         定数<8>.            (line  479)
* SHUT_WR (socket モジュール):           定数<8>.            (line  479)
* ShutDown:                              queue --- 同期キュークラス.
                                                             (line   88)
* shutdown_asyncgens() (asyncio.loop のメソッド): ループの開始と停止.
                                                             (line   61)
* shutdown_default_executor() (asyncio.loop のメソッド): ループの開始と停止.
                                                             (line   84)
* shutdown() (asyncio.Queue のメソッド): Queue.              (line   83)
* shutdown() (concurrent.futures.Executor のメソッド): Executor オブジェクト.
                                                             (line   60)
* shutdown() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  363)
* shutdown() (logging モジュール):       モジュールレベルの関数.
                                                             (line  316)
* shutdown() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   87)
* shutdown() (queue.Queue のメソッド):   Terminating queues. (line    9)
* shutdown() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  585)
* 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 モジュール):         モジュールの内容<4>.
                                                             (line  261)
* SIG_DFL (signal モジュール):           モジュールの内容<4>.
                                                             (line   46)
* SIG_IGN (signal モジュール):           モジュールの内容<4>.
                                                             (line   53)
* SIG_SETMASK (signal モジュール):       モジュールの内容<4>.
                                                             (line  275)
* SIG_UNBLOCK (signal モジュール):       モジュールの内容<4>.
                                                             (line  268)
* SIGABRT (signal モジュール):           モジュールの内容<4>.
                                                             (line   58)
* SIGALRM (signal モジュール):           モジュールの内容<4>.
                                                             (line   62)
* SIGBREAK (signal モジュール):          モジュールの内容<4>.
                                                             (line   68)
* SIGBUS (signal モジュール):            モジュールの内容<4>.
                                                             (line   74)
* SIGCHLD (signal モジュール):           モジュールの内容<4>.
                                                             (line   80)
* SIGCLD (signal モジュール):            モジュールの内容<4>.
                                                             (line   86)
* SIGCONT (signal モジュール):           モジュールの内容<4>.
                                                             (line   92)
* SIGFPE (signal モジュール):            モジュールの内容<4>.
                                                             (line   98)
* SIGHUP (signal モジュール):            モジュールの内容<4>.
                                                             (line  108)
* SIGILL (signal モジュール):            モジュールの内容<4>.
                                                             (line  115)
* SIGINT (C macro):                      シグナルハンドリング<2>.
                                                             (line    7)
* SIGINT (C macro) <1>:                  シグナルハンドリング<2>.
                                                             (line   57)
* SIGINT (signal モジュール):            モジュールの内容<4>.
                                                             (line  119)
* siginterrupt() (signal モジュール):    モジュールの内容<4>.
                                                             (line  520)
* SIGKILL (signal モジュール):           モジュールの内容<4>.
                                                             (line  125)
* Sigmasks (signal のクラス):            モジュールの内容<4>.
                                                             (line   31)
* signal() (signal モジュール):          モジュールの内容<4>.
                                                             (line  535)
* Signals (signal のクラス):             モジュールの内容<4>.
                                                             (line   17)
* Signature (inspect のクラス):          Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line   85)
* signature (inspect.BoundArguments の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  387)
* signature() (inspect モジュール):      Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line   12)
* signbit() (math モジュール):           Floating point manipulation functions.
                                                             (line  123)
* sigpending() (signal モジュール):      モジュールの内容<4>.
                                                             (line  563)
* SIGPIPE (signal モジュール):           モジュールの内容<4>.
                                                             (line  133)
* SIGPROF (signal モジュール):           モジュールの内容<4>.
                                                             (line  141)
* SIGQUIT (signal モジュール):           モジュールの内容<4>.
                                                             (line  147)
* SIGSEGV (signal モジュール):           モジュールの内容<4>.
                                                             (line  153)
* SIGSTKFLT (signal モジュール):         モジュールの内容<4>.
                                                             (line  163)
* SIGSTOP (signal モジュール):           モジュールの内容<4>.
                                                             (line  157)
* SIGTERM (signal モジュール):           モジュールの内容<4>.
                                                             (line  175)
* sigtimedwait() (signal モジュール):    モジュールの内容<4>.
                                                             (line  623)
* SIGUSR1 (signal モジュール):           モジュールの内容<4>.
                                                             (line  179)
* SIGUSR2 (signal モジュール):           モジュールの内容<4>.
                                                             (line  185)
* SIGVTALRM (signal モジュール):         モジュールの内容<4>.
                                                             (line  191)
* sigwait() (signal モジュール):         モジュールの内容<4>.
                                                             (line  578)
* sigwaitinfo() (signal モジュール):     モジュールの内容<4>.
                                                             (line  594)
* SIGWINCH (signal モジュール):          モジュールの内容<4>.
                                                             (line  197)
* SIGXCPU (signal モジュール):           モジュールの内容<4>.
                                                             (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)
* simplefilter() (warnings モジュール):  利用可能な関数.     (line  132)
* SimpleHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   70)
* SimpleHTTPRequestHandler (http.server のクラス): http server --- HTTP サーバー.
                                                             (line  393)
* SimpleNamespace (types のクラス):      追加のユーティリティクラスと関数.
                                                             (line    6)
* SimplePath (importlib.metadata のクラス): 配布物ファイル.  (line   30)
* 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 dispatch:                       用語集<2>.          (line 1602)
* SingleAddressHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  212)
* singledispatch() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  480)
* singledispatchmethod (functools のクラス): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  651)
* sinh() (cmath モジュール):             双曲線関数<2>.      (line   27)
* sinh() (math モジュール):              双曲線関数.         (line   25)
* SIO_KEEPALIVE_VALS (socket モジュール): 定数<8>.           (line  259)
* SIO_LOOPBACK_FAST_PATH (socket モジュール): 定数<8>.       (line  259)
* SIO_RCVALL (socket モジュール):        定数<8>.            (line  259)
* site コマンドラインオプション; -user-base: コマンドライン・インターフェース<12>.
                                                             (line   17)
* site コマンドラインオプション; -user-site: コマンドライン・インターフェース<12>.
                                                             (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  354)
* Sized (collections.abc のクラス):      コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   14)
* Sized (typing のクラス):               Aliases to other ABCs in collections abc.
                                                             (line   69)
* sizeof_digit (sys.int_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line 1248)
* sizeof() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  239)
* 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  157)
* SkipTest:                              テストのスキップと予期された失敗.
                                                             (line  106)
* skipTest() (unittest.TestCase のメソッド): テストクラス.   (line   99)
* skipUnless() (unittest モジュール):    テストのスキップと予期された失敗.
                                                             (line   95)
* SLASH (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  233)
* SLASHEQUAL (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  299)
* sleep() (asyncio モジュール):          スリープ.           (line    6)
* sleep() (time モジュール):             関数<5>.            (line  276)
* sleeping_retry() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  239)
* slice:                                 Subscriptions and slicings.
                                                             (line   70)
* slice <1>:                             用語集<2>.          (line 1607)
* Slice (ast のクラス):                  配列要素の参照 Subscripting.
                                                             (line   26)
* slice (組み込みクラス):                組み込み関数.       (line 1819)
* 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  524)
* SMTP (smtplib のクラス):               smtplib --- SMTP プロトコルクライアント.
                                                             (line   21)
* smtp_code (smtplib.SMTPResponseException の属性): smtplib --- SMTP プロトコルクライアント.
                                                             (line  163)
* smtp_error (smtplib.SMTPResponseException の属性): smtplib --- SMTP プロトコルクライアント.
                                                             (line  167)
* SMTP_SSL (smtplib のクラス):           smtplib --- SMTP プロトコルクライアント.
                                                             (line   84)
* SMTP;プロトコル:                       smtplib --- SMTP プロトコルクライアント.
                                                             (line    8)
* SMTPAuthenticationError:               smtplib --- SMTP プロトコルクライアント.
                                                             (line  206)
* SMTPConnectError:                      smtplib --- SMTP プロトコルクライアント.
                                                             (line  192)
* SMTPDataError:                         smtplib --- SMTP プロトコルクライアント.
                                                             (line  187)
* SMTPException:                         smtplib --- SMTP プロトコルクライアント.
                                                             (line  144)
* SMTPHandler (logging.handlers のクラス): SMTPHandler.      (line    9)
* SMTPHeloError:                         smtplib --- SMTP プロトコルクライアント.
                                                             (line  196)
* SMTPNotSupportedError:                 smtplib --- SMTP プロトコルクライアント.
                                                             (line  200)
* SMTPRecipientsRefused:                 smtplib --- SMTP プロトコルクライアント.
                                                             (line  177)
* SMTPResponseException:                 smtplib --- SMTP プロトコルクライアント.
                                                             (line  157)
* SMTPSenderRefused:                     smtplib --- SMTP プロトコルクライアント.
                                                             (line  171)
* SMTPServerDisconnected:                smtplib --- SMTP プロトコルクライアント.
                                                             (line  152)
* SMTPUTF8 (email.policy モジュール):    email policy Policy Objects.
                                                             (line  530)
* Snapshot (tracemalloc のクラス):       Snapshot.           (line    6)
* SND_ALIAS (winsound モジュール):       定数<12>.           (line   11)
* SND_APPLICATION (winsound モジュール): 定数<12>.           (line   98)
* SND_ASYNC (winsound モジュール):       定数<12>.           (line   77)
* SND_FILENAME (winsound モジュール):    定数<12>.           (line    6)
* SND_LOOP (winsound モジュール):        定数<12>.           (line   53)
* SND_MEMORY (winsound モジュール):      定数<12>.           (line   59)
* SND_NODEFAULT (winsound モジュール):   定数<12>.           (line   81)
* SND_NOSTOP (winsound モジュール):      定数<12>.           (line   86)
* SND_NOWAIT (winsound モジュール):      定数<12>.           (line   90)
* SND_PURGE (winsound モジュール):       定数<12>.           (line   70)
* SND_SENTRY (winsound モジュール):      定数<12>.           (line  104)
* SND_SYNC (winsound モジュール):        定数<12>.           (line  110)
* SND_SYSTEM (winsound モジュール):      定数<12>.           (line  116)
* sni_callback (ssl.SSLContext の属性):  SSL contexts.       (line  359)
* sniff() (csv.Sniffer のメソッド):      モジュールコンテンツ.
                                                             (line  231)
* Sniffer (csv のクラス):                モジュールコンテンツ.
                                                             (line  224)
* SO (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   66)
* SO_HCI_EVT_FILTER (socket モジュール): 定数<8>.            (line  374)
* SO_HCI_PKT_FILTER (socket モジュール): 定数<8>.            (line  374)
* SO_INCOMING_CPU (socket モジュール):   定数<8>.            (line  430)
* SO_REUSEPORT_LB (socket モジュール):   定数<8>.            (line  439)
* sock_accept() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line  110)
* SOCK_CLOEXEC (socket モジュール):      定数<8>.            (line   38)
* sock_connect() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   89)
* SOCK_DGRAM (socket モジュール):        定数<8>.            (line   27)
* SOCK_MAX_SIZE (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  141)
* SOCK_NONBLOCK (socket モジュール):     定数<8>.            (line   38)
* SOCK_RAW (socket モジュール):          定数<8>.            (line   27)
* SOCK_RDM (socket モジュール):          定数<8>.            (line   27)
* sock_recv_into() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   26)
* sock_recv() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   12)
* sock_recvfrom_into() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   49)
* sock_recvfrom() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   38)
* sock_sendall() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   60)
* sock_sendfile() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line  132)
* sock_sendto() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   78)
* SOCK_SEQPACKET (socket モジュール):    定数<8>.            (line   27)
* SOCK_STREAM (socket モジュール):       定数<8>.            (line   27)
* socket (socket のクラス):              ソケットの作成.     (line    8)
* socket (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (line   87)
* socket_type (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (line  108)
* socket() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  369)
* socket() (in module socket):           select --- I/O 完了の待機.
                                                             (line  152)
* SocketHandler (logging.handlers のクラス): SocketHandler.  (line   10)
* socketpair() (socket モジュール):      ソケットの作成.     (line   63)
* sockets (asyncio.Server の属性):       Server objects.     (line  130)
* SocketType (socket モジュール):        ソケットの作成.     (line  183)
* soft deprecated:                       用語集<2>.          (line 1614)
* 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  275)
* SOL_BLUETOOTH (socket モジュール):     定数<8>.            (line  337)
* SOL_HCI (socket モジュール):           定数<8>.            (line  337)
* SOL_L2CAP (socket モジュール):         定数<8>.            (line  337)
* SOL_RDS (socket モジュール):           定数<8>.            (line  246)
* SOL_RFCOMM (socket モジュール):        定数<8>.            (line  337)
* SOL_SCO (socket モジュール):           定数<8>.            (line  337)
* SOMAXCONN (socket モジュール):         定数<8>.            (line   55)
* sort_stats() (pstats.Stats のメソッド): The Stats class.   (line   49)
* sort() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  373)
* sort() (list のメソッド):              リスト型 list<2>.   (line   37)
* sortdict() (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line  292)
* SortKey (pstats のクラス):             The Stats class.    (line  193)
* 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>:                 ライブラリ<167>.    (line  451)
* SOURCE_DATE_EPOCH <3>:                 ビルド<68>.         (line   15)
* SOURCE_DATE_EPOCH <4>:                 ZipFile objects.    (line  347)
* 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>:                 コマンドラインでの使用<10>.
                                                             (line   94)
* source_from_cache() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   53)
* source_hash() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  159)
* 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  247)
* SourceFileLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  233)
* sourcehook() (shlex.shlex のメソッド): shlex オブジェクト. (line   26)
* SourcelessFileLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  265)
* SourceLoader (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line  327)
* SP (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  120)
* span() (re.Match のメソッド):          Match objects.      (line  167)
* 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   46)
* spawnl() (os モジュール):              プロセス管理.       (line  613)
* spawnle() (os モジュール):             プロセス管理.       (line  613)
* spawnlp() (os モジュール):             プロセス管理.       (line  613)
* spawnlpe() (os モジュール):            プロセス管理.       (line  613)
* spawnv() (os モジュール):              プロセス管理.       (line  613)
* spawnve() (os モジュール):             プロセス管理.       (line  613)
* spawnvp() (os モジュール):             プロセス管理.       (line  613)
* spawnvpe() (os モジュール):            プロセス管理.       (line  613)
* spec_from_file_location() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  146)
* spec_from_loader() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  137)
* SPEC_VERSION (decimal モジュール):     定数<4>.            (line    6)
* special method:                        用語集<2>.          (line 1625)
* SpecialFileError:                      ディレクトリとファイルの操作.
                                                             (line   60)
* SpecialFileError <1>:                  tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  309)
* specified_attributes (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  283)
* speed() (turtle モジュール):           Turtle の動き.      (line  332)
* Spinbox (tkinter.ttk のクラス):        ttk Spinbox.        (line    6)
* SPLICE_F_MORE (os モジュール):         ファイル記述子の操作.
                                                             (line  929)
* SPLICE_F_MOVE (os モジュール):         ファイル記述子の操作.
                                                             (line  929)
* SPLICE_F_NONBLOCK (os モジュール):     ファイル記述子の操作.
                                                             (line  929)
* splice() (os モジュール):              ファイル記述子の操作.
                                                             (line  878)
* split() (BaseExceptionGroup のメソッド): 例外グループ.     (line   68)
* split() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  402)
* split() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  402)
* split() (os.path モジュール):          os path --- 一般的なパス名操作.
                                                             (line  519)
* split() (re モジュール):               関数<2>.            (line   94)
* split() (re.Pattern のメソッド):       Regular expression objects.
                                                             (line   97)
* split() (shlex モジュール):            shlex --- 単純な字句解析.
                                                             (line   16)
* split() (str のメソッド):              文字列メソッド<2>.  (line  695)
* splitdrive() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  535)
* splitext() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  591)
* splitlines() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  646)
* splitlines() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  646)
* splitlines() (str のメソッド):         文字列メソッド<2>.  (line  750)
* SplitResult (urllib.parse のクラス):   構造化された解析結果.
                                                             (line   59)
* SplitResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   86)
* splitroot() (os.path モジュール):      os path --- 一般的なパス名操作.
                                                             (line  560)
* SpooledTemporaryFile (tempfile のクラス): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  151)
* sprintf 形式の書式化:                  printf 形式の文字列書式化.
                                                             (line    6)
* sprintf 形式の書式化 <1>:              printf 形式での bytes の書式化.
                                                             (line    6)
* SQLITE_DBCONFIG_DEFENSIVE (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_DQS_DDL (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_DQS_DML (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_ENABLE_FKEY (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_ENABLE_QPSG (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_ENABLE_TRIGGER (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_ENABLE_VIEW (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_LEGACY_ALTER_TABLE (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_LEGACY_FILE_FORMAT (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_RESET_DATABASE (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_TRIGGER_EQP (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_TRUSTED_SCHEMA (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DBCONFIG_WRITABLE_SCHEMA (sqlite3 モジュール): モジュール定数.
                                                             (line  139)
* SQLITE_DENY (sqlite3 モジュール):      モジュール定数.     (line   48)
* sqlite_errorcode (sqlite3.Error の属性): 例外<8>.          (line   24)
* sqlite_errorname (sqlite3.Error の属性): 例外<8>.          (line   30)
* SQLITE_IGNORE (sqlite3 モジュール):    モジュール定数.     (line   48)
* SQLITE_KEYWORDS (sqlite3 モジュール):  モジュール定数.     (line   88)
* 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)
* SSLCertVerificationError:              例外<20>.           (line   77)
* SSLContext (ssl のクラス):             SSL contexts.       (line   13)
* SSLEOFError:                           例外<20>.           (line   69)
* SSLError:                              例外<20>.           (line    6)
* SSLErrorNumber (ssl のクラス):         定数<9>.            (line  563)
* SSLKEYLOGFILE:                         コンテキストの作成. (line   34)
* SSLKEYLOGFILE <1>:                     コンテキストの作成. (line   83)
* SSLObject (ssl のクラス):              Memory BIO support. (line   30)
* sslobject_class (ssl.SSLContext の属性): SSL contexts.     (line  546)
* SSLSession (ssl のクラス):             SSL セッション.     (line    8)
* SSLSocket (ssl のクラス):              SSL sockets.        (line    6)
* sslsocket_class (ssl.SSLContext の属性): SSL contexts.     (line  520)
* SSLSyscallError:                       例外<20>.           (line   61)
* SSLv3 (ssl.TLSVersion の属性):         定数<9>.            (line  585)
* SSLWantReadError:                      例外<20>.           (line   43)
* SSLWantWriteError:                     例外<20>.           (line   52)
* SSLZeroReturnError:                    例外<20>.           (line   34)
* st_atime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1235)
* ST_ATIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  168)
* st_atime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1252)
* st_birthtime (os.stat_result の属性):  ファイルとディレクトリ.
                                                             (line 1276)
* st_birthtime_ns (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1284)
* st_blksize (os.stat_result の属性):    ファイルとディレクトリ.
                                                             (line 1321)
* st_blocks (os.stat_result の属性):     ファイルとディレクトリ.
                                                             (line 1315)
* st_creator (os.stat_result の属性):    ファイルとディレクトリ.
                                                             (line 1357)
* st_ctime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1243)
* ST_CTIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  176)
* st_ctime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1264)
* st_dev (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1210)
* ST_DEV (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  147)
* st_file_attributes (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1367)
* st_flags (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1331)
* st_fstype (os.stat_result の属性):     ファイルとディレクトリ.
                                                             (line 1346)
* st_gen (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1339)
* st_gid (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1222)
* ST_GID (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  159)
* st_ino (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1201)
* ST_INO (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  143)
* st_mode (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1196)
* ST_MODE (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  139)
* st_mtime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1239)
* ST_MTIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  172)
* st_mtime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1258)
* st_nlink (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1214)
* ST_NLINK (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  151)
* st_rdev (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1327)
* st_reparse_tag (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1377)
* st_rsize (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1353)
* st_size (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1226)
* ST_SIZE (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  163)
* st_type (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1361)
* st_uid (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1218)
* ST_UID (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  155)
* st() (turtle モジュール):              可視性.             (line   15)
* stack (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   73)
* stack viewer:                          Debug メニュー Shell ウィンドウのみ.
                                                             (line   15)
* stack_effect() (dis モジュール):       解析関数.           (line  191)
* stack_size() (_thread モジュール):     _thread --- 低水準なスレッド API.
                                                             (line  111)
* stack_size() (threading モジュール):   リファレンス<2>.    (line  158)
* stack() (inspect モジュール):          インタープリタスタック.
                                                             (line  164)
* StackSummary (traceback のクラス):     StackSummary オブジェクト.
                                                             (line   11)
* stamp() (turtle モジュール):           Turtle の動き.      (line  276)
* standalone_month_abbr (calendar モジュール): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  509)
* standalone_month_name (calendar モジュール): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  501)
* standard library:                      用語集<2>.          (line 1632)
* standard_b64decode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   93)
* standard_b64encode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   87)
* standard;output:                       式文 expression statement.
                                                             (line   16)
* standend() (curses.window のメソッド): Window オブジェクト.
                                                             (line  510)
* standout() (curses.window のメソッド): Window オブジェクト.
                                                             (line  515)
* 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 1833)
* start (UnicodeError の属性):           具象例外.           (line  460)
* start (スライスオブジェクトの属性):    シーケンス型 sequence.
                                                             (line   18)
* start (スライスオブジェクトの属性) <1>: スライス slice オブジェクト.
                                                             (line   14)
* start_color() (curses モジュール):     関数<6>.            (line  492)
* start_new_thread() (_thread モジュール): _thread --- 低水準なスレッド API.
                                                             (line   31)
* start_ns() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   74)
* start_server() (asyncio モジュール):   ストリーム.         (line   76)
* start_serving() (asyncio.Server のメソッド): Server 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  142)
* 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  463)
* StartDoctypeDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  349)
* 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  384)
* 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  729)
* StartNamespaceDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  443)
* 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  257)
* startswith() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  257)
* startswith() (str のメソッド):         文字列メソッド<2>.  (line  821)
* startTest() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  339)
* startTestRun() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  347)
* starttls() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  391)
* starttls() (smtplib.SMTP のメソッド):  SMTP オブジェクト.  (line  182)
* STARTUPINFO (subprocess のクラス):     Windows Popen ヘルパー.
                                                             (line    9)
* stat_result (os のクラス):             ファイルとディレクトリ.
                                                             (line 1188)
* stat() (os モジュール):                ファイルとディレクトリ.
                                                             (line 1131)
* stat() (os.DirEntry のメソッド):       ファイルとディレクトリ.
                                                             (line 1094)
* stat() (pathlib.Path のメソッド):      ファイルの種類とステータスを問い合わせる.
                                                             (line   19)
* stat() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   50)
* state() (tkinter.ttk.Widget のメソッド): ttk Widget.       (line   27)
* statement:                             用語集<2>.          (line 1644)
* 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 frozendict.
                                                             (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 2220)
* statement;import <3>:                  site --- サイト固有の設定フック.
                                                             (line   57)
* 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 1651)
* static_order() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line  165)
* Statistic (tracemalloc のクラス):      Statistic.          (line    6)
* statistical profiling:                 profiling --- Python profilers.
                                                             (line   12)
* StatisticDiff (tracemalloc のクラス):  StatisticDiff.      (line    6)
* statistics() (tracemalloc.Snapshot のメソッド): Snapshot.  (line   57)
* StatisticsError:                       例外<5>.            (line    8)
* Stats (pstats のクラス):               The Stats class.    (line    6)
* 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  404)
* statvfs() (os モジュール):             ファイルとディレクトリ.
                                                             (line 1792)
* STATX_ATIME (os モジュール):           ファイルとディレクトリ.
                                                             (line 1720)
* STATX_ATTR_APPEND (stat モジュール):   stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_AUTOMOUNT (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_COMPRESSED (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_DAX (stat モジュール):      stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_ENCRYPTED (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_IMMUTABLE (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_MOUNT_ROOT (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_NODUMP (stat モジュール):   stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_VERITY (stat モジュール):   stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_ATTR_WRITE_ATOMIC (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  495)
* STATX_BASIC_STATS (os モジュール):     ファイルとディレクトリ.
                                                             (line 1720)
* STATX_BLOCKS (os モジュール):          ファイルとディレクトリ.
                                                             (line 1720)
* STATX_BTIME (os モジュール):           ファイルとディレクトリ.
                                                             (line 1720)
* STATX_CTIME (os モジュール):           ファイルとディレクトリ.
                                                             (line 1720)
* STATX_DIO_READ_ALIGN (os モジュール):  ファイルとディレクトリ.
                                                             (line 1720)
* STATX_DIOALIGN (os モジュール):        ファイルとディレクトリ.
                                                             (line 1720)
* STATX_GID (os モジュール):             ファイルとディレクトリ.
                                                             (line 1720)
* STATX_INO (os モジュール):             ファイルとディレクトリ.
                                                             (line 1720)
* STATX_MNT_ID (os モジュール):          ファイルとディレクトリ.
                                                             (line 1720)
* STATX_MNT_ID_UNIQUE (os モジュール):   ファイルとディレクトリ.
                                                             (line 1720)
* STATX_MODE (os モジュール):            ファイルとディレクトリ.
                                                             (line 1720)
* STATX_MTIME (os モジュール):           ファイルとディレクトリ.
                                                             (line 1720)
* STATX_NLINK (os モジュール):           ファイルとディレクトリ.
                                                             (line 1720)
* statx_result (os のクラス):            ファイルとディレクトリ.
                                                             (line 1456)
* STATX_SIZE (os モジュール):            ファイルとディレクトリ.
                                                             (line 1720)
* STATX_SUBVOL (os モジュール):          ファイルとディレクトリ.
                                                             (line 1720)
* STATX_TYPE (os モジュール):            ファイルとディレクトリ.
                                                             (line 1720)
* STATX_UID (os モジュール):             ファイルとディレクトリ.
                                                             (line 1720)
* STATX_WRITE_ATOMIC (os モジュール):    ファイルとディレクトリ.
                                                             (line 1720)
* statx() (os モジュール):               ファイルとディレクトリ.
                                                             (line 1428)
* 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  151)
* stderr (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  192)
* stderr (sys モジュール):               I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stderr (sys モジュール) <1>:           sys --- システム固有のパラメーターと関数.
                                                             (line 2056)
* 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  132)
* stdin (sys モジュール):                I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stdin (sys モジュール) <1>:            sys --- システム固有のパラメーターと関数.
                                                             (line 2056)
* 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 1657)
* stdlib_module_names (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 2144)
* STDNAME (pstats.SortKey の属性):       The Stats class.    (line  226)
* 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  141)
* stdout (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  188)
* stdout (sys モジュール):               I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stdout (sys モジュール) <1>:           sys --- システム固有のパラメーターと関数.
                                                             (line 2056)
* 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 1833)
* step (スライスオブジェクトの属性):     シーケンス型 sequence.
                                                             (line   18)
* step (スライスオブジェクトの属性) <1>: スライス slice オブジェクト.
                                                             (line   14)
* step() (tkinter.ttk.Progressbar のメソッド): ttk Progressbar.
                                                             (line   15)
* stls() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line  114)
* stop (range の属性):                   range.              (line   60)
* stop (slice の属性):                   組み込み関数.       (line 1833)
* stop (スライスオブジェクトの属性):     シーケンス型 sequence.
                                                             (line   18)
* stop (スライスオブジェクトの属性) <1>: スライス slice オブジェクト.
                                                             (line   14)
* stop_here() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  265)
* 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  307)
* StopIteration:                         具象例外.           (line  275)
* 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  408)
* storlines() (ftplib.FTP のメソッド):   FTP オブジェクト.   (line  246)
* str (組み込みクラス):                  テキストシーケンス型 --- str.
                                                             (line   44)
* str (組み込みクラス);(string も参照のこと): range.         (line  118)
* str_digits_check_threshold (sys.int_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line 1257)
* str() (locale モジュール):             locale --- 国際化サービス.
                                                             (line  492)
* Strategy (compression.zstd のクラス):  Advanced parameter control.
                                                             (line  295)
* strategy (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  120)
* strcoll() (locale モジュール):         locale --- 国際化サービス.
                                                             (line  446)
* StreamError:                           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  275)
* StreamHandler (logging のクラス):      StreamHandler.      (line   12)
* StreamReader (asyncio のクラス):       StreamReader.       (line    6)
* StreamReader (codecs のクラス):        StreamReader オブジェクト.
                                                             (line   11)
* streamreader (codecs.CodecInfo の属性): codecs --- codec レジストリと基底クラス.
                                                             (line  105)
* 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  105)
* StrEnum (enum のクラス):               データ型<2>.        (line  435)
* strerror (C function):                 例外の送出.         (line   58)
* strerror (OSError の属性):             具象例外.           (line  191)
* strerror() (os モジュール):            プロセスのパラメーター.
                                                             (line  551)
* strftime() (datetime.date のメソッド): date objects.       (line  328)
* strftime() (datetime.datetime のメソッド): datetime objects.
                                                             (line  760)
* strftime() (datetime.time のメソッド): time objects.       (line  234)
* strftime() (time モジュール):          関数<5>.            (line  333)
* strict (csv.Dialect の属性):           Dialect クラスと書式化パラメータ.
                                                             (line   89)
* strict (email.policy モジュール):      email policy Policy Objects.
                                                             (line  545)
* 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  477)
* STRING (annotationlib.Format の属性):  クラス<5>.          (line   37)
* string (re.Match の属性):              Match objects.      (line  204)
* STRING (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line   50)
* string_at() (ctypes モジュール):       ユーティリティー関数.
                                                             (line  244)
* string;__format__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  149)
* string;__str__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  128)
* string;format() (組み込み関数):        組み込み関数.       (line  789)
* string;formatted literal:              出力を見やすくフォーマットする.
                                                             (line   91)
* string;formatted literal <1>:          Raw string literals.
                                                             (line   25)
* string;formatted literal <2>:          文字列メソッド<2>.  (line  973)
* 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  973)
* string;interpolation, printf:          printf 形式の文字列書式化.
                                                             (line    6)
* string;object representation:          ファイナライズとメモリ解放.
                                                             (line   94)
* string;PyObject_Str (C 関数):          オブジェクトプロトコル object protocol.
                                                             (line  399)
* string;str (組み込みクラス):           テキストシーケンス型 --- str.
                                                             (line   44)
* string;str() (built-in function):      組み込み関数.       (line 1926)
* 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)
* strip_dirs() (pstats.Stats のメソッド): The Stats class.   (line   22)
* strip() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  446)
* strip() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  446)
* strip() (str のメソッド):              文字列メソッド<2>.  (line  839)
* stripspaces (curses.textpad.Textbox の属性): Textbox オブジェクト.
                                                             (line  118)
* strong reference:                      用語集<2>.          (line 1661)
* strptime() (datetime.date のクラスメソッド): date objects. (line  100)
* strptime() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  260)
* strptime() (datetime.time のクラスメソッド): time objects. (line  146)
* strptime() (time モジュール):          関数<5>.            (line  490)
* strsignal() (signal モジュール):       モジュールの内容<4>.
                                                             (line  321)
* Struct (struct のクラス):              クラス<3>.          (line    8)
* struct_time (time のクラス):           関数<5>.            (line  524)
* structmember.h:                        Member types.       (line  122)
* Structure (ctypes のクラス):           構造化データ型.     (line   41)
* strxfrm() (locale モジュール):         locale --- 国際化サービス.
                                                             (line  453)
* STX (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   24)
* stx_atime (os.statx_result の属性):    ファイルとディレクトリ.
                                                             (line 1462)
* stx_atime_ns (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1469)
* stx_atomic_write_segments_max (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1476)
* stx_atomic_write_unit_max (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1486)
* stx_atomic_write_unit_max_opt (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1496)
* stx_atomic_write_unit_min (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1507)
* stx_attributes (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1517)
* stx_attributes_mask (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1522)
* stx_blksize (os.statx_result の属性):  ファイルとディレクトリ.
                                                             (line 1527)
* stx_blocks (os.statx_result の属性):   ファイルとディレクトリ.
                                                             (line 1533)
* stx_btime (os.statx_result の属性):    ファイルとディレクトリ.
                                                             (line 1542)
* stx_btime_ns (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1549)
* stx_ctime (os.statx_result の属性):    ファイルとディレクトリ.
                                                             (line 1556)
* stx_ctime_ns (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1563)
* stx_dev (os.statx_result の属性):      ファイルとディレクトリ.
                                                             (line 1571)
* stx_dev_major (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1575)
* stx_dev_minor (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1579)
* stx_dio_mem_align (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1583)
* stx_dio_offset_align (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1593)
* stx_dio_read_offset_align (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1603)
* stx_gid (os.statx_result の属性):      ファイルとディレクトリ.
                                                             (line 1613)
* stx_ino (os.statx_result の属性):      ファイルとディレクトリ.
                                                             (line 1620)
* stx_mask (os.statx_result の属性):     ファイルとディレクトリ.
                                                             (line 1627)
* stx_mnt_id (os.statx_result の属性):   ファイルとディレクトリ.
                                                             (line 1633)
* stx_mode (os.statx_result の属性):     ファイルとディレクトリ.
                                                             (line 1643)
* stx_mtime (os.statx_result の属性):    ファイルとディレクトリ.
                                                             (line 1651)
* stx_mtime_ns (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1658)
* stx_nlink (os.statx_result の属性):    ファイルとディレクトリ.
                                                             (line 1665)
* stx_rdev (os.statx_result の属性):     ファイルとディレクトリ.
                                                             (line 1672)
* stx_rdev_major (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1676)
* stx_rdev_minor (os.statx_result の属性): ファイルとディレクトリ.
                                                             (line 1680)
* stx_size (os.statx_result の属性):     ファイルとディレクトリ.
                                                             (line 1684)
* stx_subvol (os.statx_result の属性):   ファイルとディレクトリ.
                                                             (line 1694)
* stx_uid (os.statx_result の属性):      ファイルとディレクトリ.
                                                             (line 1704)
* Style (tkinter.ttk のクラス):          Ttk スタイル.       (line   21)
* Sub (ast のクラス):                    式 expression<2>.   (line   55)
* SUB (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  102)
* sub() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  165)
* sub() (re モジュール):                 関数<2>.            (line  184)
* sub() (re.Pattern のメソッド):         Regular expression objects.
                                                             (line  114)
* subdirs (filecmp.dircmp の属性):       dircmp クラス.      (line  102)
* SubElement() (xml.etree.ElementTree モジュール): 関数<9>.  (line  208)
* subgroup() (BaseExceptionGroup のメソッド): 例外グループ.  (line   42)
* submit() (concurrent.futures.Executor のメソッド): Executor オブジェクト.
                                                             (line   11)
* submodule_search_locations (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  418)
* subn() (re モジュール):                関数<2>.            (line  258)
* subn() (re.Pattern のメソッド):        Regular expression objects.
                                                             (line  119)
* 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  486)
* subpad() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  519)
* 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)
* subscribe() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  434)
* 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  274)
* subwin() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  526)
* successful() (multiprocessing.pool.AsyncResult のメソッド): プロセスプール.
                                                             (line  221)
* suffix (pathlib.PurePath の属性):      メソッドとプロパティ.
                                                             (line  137)
* suffix_map (mimetypes モジュール):     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  152)
* 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>:                    例外<25>.           (line   65)
* summarize_address_range() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line   27)
* summarize() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line  137)
* sumprod() (math モジュール):           Summation and product functions.
                                                             (line   58)
* SUNDAY (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  444)
* super (pyclbr.Class の属性):           クラスオブジェクト<2>.
                                                             (line   42)
* super (組み込みクラス):                組み込み関数.       (line 1964)
* 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  557)
* supports_dir_fd (os モジュール):       ファイルとディレクトリ.
                                                             (line 1836)
* supports_effective_ids (os モジュール): ファイルとディレクトリ.
                                                             (line 1861)
* supports_fd (os モジュール):           ファイルとディレクトリ.
                                                             (line 1880)
* supports_follow_symlinks (os モジュール): ファイルとディレクトリ.
                                                             (line 1899)
* supports_unicode_filenames (os.path モジュール): os path --- 一般的なパス名操作.
                                                             (line  622)
* SupportsAbs (typing のクラス):         プロトコル<4>.      (line    9)
* SupportsBytes (typing のクラス):       プロトコル<4>.      (line   13)
* SupportsComplex (typing のクラス):     プロトコル<4>.      (line   17)
* SupportsFloat (typing のクラス):       プロトコル<4>.      (line   21)
* SupportsIndex (typing のクラス):       プロトコル<4>.      (line   25)
* SupportsInt (typing のクラス):         プロトコル<4>.      (line   31)
* SupportsRound (typing のクラス):       プロトコル<4>.      (line   35)
* suppress() (contextlib モジュール):    ユーティリティ.     (line  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_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  671)
* swapcase() (bytes のメソッド):         bytes と bytearray の操作.
                                                             (line  671)
* swapcase() (str のメソッド):           文字列メソッド<2>.  (line  871)
* Symbol (symtable のクラス):            記号表の検査.       (line  163)
* SymbolTable (symtable のクラス):       記号表の検査.       (line   49)
* SymbolTableType (symtable のクラス):   記号表の検査.       (line    6)
* symlink_to() (pathlib.Path のメソッド): ファイルとディレクトリの作成.
                                                             (line   53)
* symlink() (os モジュール):             ファイルとディレクトリ.
                                                             (line 1922)
* 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  348)
* SYN (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   90)
* sync() (dbm.dumb.dumbdbm のメソッド):  dbm dumb --- Portable DBM implementation.
                                                             (line  101)
* sync() (dbm.gnu.gdbm のメソッド):      dbm gnu --- GNU database manager.
                                                             (line  132)
* sync() (os モジュール):                ファイルとディレクトリ.
                                                             (line 1972)
* sync() (shelve.Shelf のメソッド):      shelve --- Python オブジェクトの永続化.
                                                             (line   89)
* syncdown() (curses.window のメソッド): Window オブジェクト.
                                                             (line  536)
* synchronization primitive:             用語集<2>.          (line 1684)
* synchronized_iterator() (threading モジュール): Iterator synchronization.
                                                             (line   70)
* synchronized() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   96)
* SyncManager (multiprocessing.managers のクラス): マネージャー.
                                                             (line  153)
* syncok() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  543)
* syncup() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  548)
* SyntaxErr:                             例外<24>.           (line   89)
* SyntaxError:                           具象例外.           (line  315)
* 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)
* 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  784)
* system() (platform モジュール):        Cross platform.     (line  122)
* SystemError:                           具象例外.           (line  372)
* SystemError (組み込み例外):            モジュールオブジェクト module object.
                                                             (line   64)
* SystemError (組み込み例外) <1>:        モジュールオブジェクト module object.
                                                             (line   93)
* SystemExit:                            具象例外.           (line  389)
* 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  206)
* T_FMT_AMPM (locale モジュール):        locale --- 国際化サービス.
                                                             (line  212)
* 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 1697)
* t-strings:                             用語集<2>.          (line 1700)
* TAB (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   45)
* tab() (tkinter.ttk.Notebook のメソッド): ttk Notebook.     (line   61)
* TabError:                              具象例外.           (line  367)
* tabs() (tkinter.ttk.Notebook のメソッド): ttk Notebook.    (line   70)
* tabsize (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  178)
* tag (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   21)
* tag_bind() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  292)
* tag_configure() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  298)
* tag_has() (tkinter.ttk.Treeview のメソッド): ttk Treeview. (line  308)
* tagName (xml.dom.Element の属性):      Element オブジェクト<2>.
                                                             (line    9)
* tail (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   26)
* take_bytes() (bytearray のメソッド):   bytearray オブジェクト.
                                                             (line  107)
* 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  261)
* 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  295)
* Task (asyncio のクラス):               Task object.        (line    6)
* task_done() (asyncio.Queue のメソッド): Queue.             (line  118)
* 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  953)
* tcgetwinsize() (termios モジュール):   termios --- POSIX スタイルの端末制御.
                                                             (line   83)
* Tcl() (tkinter モジュール):            Tkinter モジュール. (line   92)
* 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  960)
* 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  363)
* tell() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   61)
* tell() (wave.Wave_read のメソッド):    Wave_read オブジェクト.
                                                             (line   76)
* tell() (wave.Wave_write のメソッド):   Wave_write オブジェクト.
                                                             (line  123)
* 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  488)
* TERM <1>:                              関数<6>.            (line  513)
* termattrs() (curses モジュール):       関数<6>.            (line  505)
* 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  110)
* terminator (logging.StreamHandler の属性): StreamHandler.  (line   48)
* termname() (curses モジュール):        関数<6>.            (line  511)
* 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  272)
* text (ctypes.COMError の属性):         例外<11>.           (line   19)
* text (SyntaxError の属性):             具象例外.           (line  339)
* text (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  104)
* Text (typing のクラス):                Aliases to other concrete types.
                                                             (line   21)
* text (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   26)
* text encoding:                         用語集<2>.          (line 1705)
* text file:                             用語集<2>.          (line 1718)
* text mode:                             組み込み関数.       (line 1447)
* text_encoding() (io モジュール):       高水準のモジュールインターフェイス.
                                                             (line   38)
* text_factory (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  816)
* 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 スタイル.
                                                             (line  260)
* theme_names() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  308)
* theme_settings() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  270)
* theme_use() (tkinter.ttk.Style のメソッド): Ttk スタイル.  (line  312)
* THOUSEP (locale モジュール):           locale --- 国際化サービス.
                                                             (line  276)
* Thread (threading のクラス):           Thread objects.     (line   59)
* thread state:                          用語集<2>.          (line 1732)
* thread_info (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line 2163)
* thread_inherit_context (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  626)
* thread_time_ns() (time モジュール):    関数<5>.            (line  641)
* thread_time() (time モジュール):       関数<5>.            (line  625)
* thread_unsafe() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  563)
* thread-safe:                           用語集<2>.          (line 1755)
* thread() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  438)
* 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   97)
* throw() (coroutine のメソッド):        コルーチンオブジェクト.
                                                             (line   32)
* throw() (generator のメソッド):        ジェネレータ-イテレータメソッド.
                                                             (line   37)
* THURSDAY (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  444)
* ticket_lifetime_hint (ssl.SSLSession の属性): SSL セッション.
                                                             (line   18)
* tigetflag() (curses モジュール):       関数<6>.            (line  516)
* tigetnum() (curses モジュール):        関数<6>.            (line  522)
* tigetstr() (curses モジュール):        関数<6>.            (line  528)
* TILDE (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  275)
* tilt() (turtle モジュール):            見た目.             (line   99)
* tiltangle() (turtle モジュール):       見た目.             (line  115)
* time (datetime のクラス):              time objects.       (line   10)
* TIME (pstats.SortKey の属性):          The Stats class.    (line  230)
* time (ssl.SSLSession の属性):          SSL セッション.     (line   14)
* 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  618)
* time() (asyncio.loop のメソッド):      遅延コールバックのスケジューリング.
                                                             (line   67)
* time() (datetime.datetime のメソッド): datetime objects.   (line  450)
* time() (time モジュール):              関数<5>.            (line  582)
* Time2Internaldate() (imaplib モジュール): imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  132)
* timedelta (datetime のクラス):         timedelta objects.  (line    9)
* TimedRotatingFileHandler (logging.handlers のクラス): TimedRotatingFileHandler.
                                                             (line   10)
* timegm() (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  416)
* timeit コマンドラインオプション; -h:   コマンドライン・インターフェース<9>.
                                                             (line   50)
* timeit コマンドラインオプション; -help: コマンドライン・インターフェース<9>.
                                                             (line   50)
* timeit コマンドラインオプション; -n:   コマンドライン・インターフェース<9>.
                                                             (line   12)
* timeit コマンドラインオプション; -number: コマンドライン・インターフェース<9>.
                                                             (line   12)
* timeit コマンドラインオプション; -p:   コマンドライン・インターフェース<9>.
                                                             (line   24)
* timeit コマンドラインオプション; -process: コマンドライン・インターフェース<9>.
                                                             (line   24)
* timeit コマンドラインオプション; -r:   コマンドライン・インターフェース<9>.
                                                             (line   16)
* timeit コマンドラインオプション; -repeat: コマンドライン・インターフェース<9>.
                                                             (line   16)
* timeit コマンドラインオプション; -s:   コマンドライン・インターフェース<9>.
                                                             (line   20)
* timeit コマンドラインオプション; -setup: コマンドライン・インターフェース<9>.
                                                             (line   20)
* timeit コマンドラインオプション; -t:   コマンドライン・インターフェース<9>.
                                                             (line   39)
* timeit コマンドラインオプション; -target-time: コマンドライン・インターフェース<9>.
                                                             (line   39)
* timeit コマンドラインオプション; -u:   コマンドライン・インターフェース<9>.
                                                             (line   32)
* timeit コマンドラインオプション; -unit: コマンドライン・インターフェース<9>.
                                                             (line   32)
* timeit コマンドラインオプション; -v:   コマンドライン・インターフェース<9>.
                                                             (line   46)
* timeit コマンドラインオプション; -verbose: コマンドライン・インターフェース<9>.
                                                             (line   46)
* timeit() (timeit モジュール):          Python interface.   (line    8)
* timeit() (timeit.Timer のメソッド):    Python interface.   (line   68)
* timeout:                               例外<19>.           (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  133)
* TIMEOUT_MAX (threading モジュール):    リファレンス<2>.    (line  182)
* timeout() (asyncio モジュール):        タイムアウト.       (line    6)
* timeout() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  553)
* TimeoutError:                          OS 例外.            (line  111)
* TimeoutError <1>:                      Process クラスと例外.
                                                             (line  295)
* TimeoutError <2>:                      例外クラス.         (line   10)
* TimeoutError <3>:                      例外<17>.           (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  820)
* TIMESTAMP (py_compile.PycInvalidationMode の属性): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line  103)
* timestamp() (datetime.datetime のメソッド): datetime objects.
                                                             (line  607)
* timetuple() (datetime.date のメソッド): date objects.      (line  241)
* timetuple() (datetime.datetime のメソッド): datetime objects.
                                                             (line  561)
* timetz() (datetime.datetime のメソッド): datetime objects. (line  459)
* timezone (datetime のクラス):          timezone objects.   (line   14)
* timezone (time モジュール):            Timezone Constants. (line   18)
* title() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  696)
* title() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  696)
* title() (str のメソッド):              文字列メソッド<2>.  (line  887)
* title() (turtle モジュール):           Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   68)
* Tk:                                    Graphical user interfaces with Tk.
                                                             (line    6)
* Tk (tkinter のクラス):                 Tkinter モジュール. (line   13)
* tk (tkinter.Tk の属性):                Tkinter モジュール. (line   68)
* Tk オプションデータ型:                 Tk オプションデータ型.
                                                             (line    6)
* Tkinter:                               Graphical user interfaces with Tk.
                                                             (line    6)
* TLS:                                   ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    8)
* TLSv1 (ssl.TLSVersion の属性):         定数<9>.            (line  587)
* TLSv1_1 (ssl.TLSVersion の属性):       定数<9>.            (line  589)
* TLSv1_2 (ssl.TLSVersion の属性):       定数<9>.            (line  591)
* TLSv1_3 (ssl.TLSVersion の属性):       定数<9>.            (line  593)
* TLSVersion (ssl のクラス):             定数<9>.            (line  569)
* tm_gmtoff (time.struct_time の属性):   関数<5>.            (line  567)
* tm_hour (time.struct_time の属性):     関数<5>.            (line  543)
* tm_isdst (time.struct_time の属性):    関数<5>.            (line  560)
* tm_mday (time.struct_time の属性):     関数<5>.            (line  540)
* tm_min (time.struct_time の属性):      関数<5>.            (line  546)
* tm_mon (time.struct_time の属性):      関数<5>.            (line  537)
* tm_sec (time.struct_time の属性):      関数<5>.            (line  549)
* tm_wday (time.struct_time の属性):     関数<5>.            (line  554)
* tm_yday (time.struct_time の属性):     関数<5>.            (line  557)
* tm_year (time.struct_time の属性):     関数<5>.            (line  534)
* tm_zone (time.struct_time の属性):     関数<5>.            (line  564)
* TMP:                                   tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  329)
* TMPDIR:                                ライブラリ<15>.     (line 1028)
* TMPDIR <1>:                            テスト<32>.         (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  274)
* tobytes() (memoryview のメソッド):     メモリビュー.       (line  162)
* today() (datetime.date のクラスメソッド): date objects.    (line   28)
* today() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line   47)
* tofile() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  283)
* tok_name (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line   23)
* Token (contextvars のクラス):          コンテキスト変数.   (line  101)
* token (shlex.shlex の属性):            shlex オブジェクト. (line  172)
* token_bytes() (secrets モジュール):    トークンの生成.     (line   10)
* token_hex() (secrets モジュール):      トークンの生成.     (line   20)
* token_urlsafe() (secrets モジュール):  トークンの生成.     (line   31)
* TokenError:                            Tokenizing input.   (line  104)
* tokenize コマンドラインオプション; -e: コマンドラインでの使用<9>.
                                                             (line   19)
* tokenize コマンドラインオプション; -exact: コマンドラインでの使用<9>.
                                                             (line   19)
* tokenize コマンドラインオプション; -h: コマンドラインでの使用<9>.
                                                             (line   15)
* tokenize コマンドラインオプション; -help: コマンドラインでの使用<9>.
                                                             (line   15)
* tokenize() (tokenize モジュール):      Tokenizing input.   (line    8)
* tolist() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  288)
* tolist() (memoryview のメソッド):      メモリビュー.       (line  205)
* TOMLDecodeError:                       tomllib --- TOML ファイルの解析.
                                                             (line   69)
* toordinal() (datetime.date のメソッド): date objects.      (line  255)
* toordinal() (datetime.datetime のメソッド): datetime objects.
                                                             (line  602)
* top_panel() (curses.panel モジュール): 関数<7>.            (line   19)
* top() (curses.panel.Panel のメソッド): Panel オブジェクト. (line   53)
* top() (poplib.POP3 のメソッド):        POP3 オブジェクト.  (line   87)
* TopologicalSorter (graphlib のクラス): graphlib --- グラフ構造を操作する機能.
                                                             (line   10)
* toprettyxml() (xml.dom.minidom.Node のメソッド): DOM オブジェクト.
                                                             (line   71)
* toreadonly() (memoryview のメソッド):  メモリビュー.       (line  221)
* tostring() (xml.etree.ElementTree モジュール): 関数<9>.    (line  226)
* tostringlist() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line  248)
* total_changes (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  827)
* total_nframe (tracemalloc.Traceback の属性): Traceback.    (line   28)
* total_ordering() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  276)
* total_seconds() (datetime.timedelta のメソッド): timedelta objects.
                                                             (line  248)
* total() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line  106)
* touch() (pathlib.Path のメソッド):     ファイルとディレクトリの作成.
                                                             (line    6)
* touchline() (curses.window のメソッド): Window オブジェクト.
                                                             (line  562)
* touchwin() (curses.window のメソッド): Window オブジェクト.
                                                             (line  568)
* tounicode() (array.array のメソッド):  array --- 効率的な数値配列.
                                                             (line  292)
* 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  535)
* Trace (trace のクラス):                プログラミングインターフェース.
                                                             (line    6)
* Trace (tracemalloc のクラス):          Trace.              (line    6)
* trace function:                        リファレンス<2>.    (line  115)
* trace function <1>:                    リファレンス<2>.    (line  131)
* trace function <2>:                    sys --- システム固有のパラメーターと関数.
                                                             (line 1030)
* trace function <3>:                    sys --- システム固有のパラメーターと関数.
                                                             (line 1840)
* trace コマンドラインオプション; -c:    主要なオプション.   (line   12)
* trace コマンドラインオプション; -C:    修飾的オプション.   (line   12)
* trace コマンドラインオプション; -count: 主要なオプション.  (line   12)
* trace コマンドラインオプション; -coverdir: 修飾的オプション.
                                                             (line   12)
* trace コマンドラインオプション; -f:    修飾的オプション.   (line    6)
* trace コマンドラインオプション; -file: 修飾的オプション.   (line    6)
* trace コマンドラインオプション; -g:    修飾的オプション.   (line   35)
* trace コマンドラインオプション; -help: コマンドラインからの使用<2>.
                                                             (line   14)
* trace コマンドラインオプション; -ignore-dir: フィルターオプション.
                                                             (line   13)
* trace コマンドラインオプション; -ignore-module: フィルターオプション.
                                                             (line    8)
* trace コマンドラインオプション; -l:    主要なオプション.   (line   22)
* trace コマンドラインオプション; -listfuncs: 主要なオプション.
                                                             (line   22)
* trace コマンドラインオプション; -m:    修飾的オプション.   (line   18)
* trace コマンドラインオプション; -missing: 修飾的オプション.
                                                             (line   18)
* trace コマンドラインオプション; -no-report: 修飾的オプション.
                                                             (line   29)
* trace コマンドラインオプション; -r:    主要なオプション.   (line   26)
* trace コマンドラインオプション; -R:    修飾的オプション.   (line   29)
* trace コマンドラインオプション; -report: 主要なオプション. (line   26)
* trace コマンドラインオプション; -s:    修飾的オプション.   (line   23)
* trace コマンドラインオプション; -summary: 修飾的オプション.
                                                             (line   23)
* trace コマンドラインオプション; -t:    主要なオプション.   (line   18)
* trace コマンドラインオプション; -T:    主要なオプション.   (line   32)
* trace コマンドラインオプション; -timing: 修飾的オプション. (line   35)
* trace コマンドラインオプション; -trace: 主要なオプション.  (line   18)
* trace コマンドラインオプション; -trackcalls: 主要なオプション.
                                                             (line   32)
* trace コマンドラインオプション; -version: コマンドラインからの使用<2>.
                                                             (line   18)
* trace_dispatch() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  187)
* trace() (inspect モジュール):          インタープリタスタック.
                                                             (line  177)
* Traceback (inspect のクラス):          インタープリタスタック.
                                                             (line   54)
* Traceback (tracemalloc のクラス):      Traceback.          (line    6)
* traceback (tracemalloc.Statistic の属性): Statistic.       (line   23)
* traceback (tracemalloc.StatisticDiff の属性): StatisticDiff.
                                                             (line   39)
* traceback (tracemalloc.Trace の属性):  Trace.              (line   27)
* traceback_limit (tracemalloc.Snapshot の属性): Snapshot.   (line   84)
* traceback_limit (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  219)
* TracebackException (traceback のクラス): TracebackException オブジェクト.
                                                             (line   15)
* tracebacklimit (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 2199)
* TracebackType (types のクラス):        標準的なインタプリタ型.
                                                             (line  188)
* tracer() (turtle モジュール):          アニメーションの制御.
                                                             (line   36)
* traces (tracemalloc.Snapshot の属性):  Snapshot.           (line   90)
* train_dict() (compression.zstd モジュール): Zstandard dictionaries.
                                                             (line    6)
* transfercmd() (ftplib.FTP のメソッド): FTP オブジェクト.   (line  256)
* transient_internet() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   64)
* translate() (bytearray のメソッド):    bytes と bytearray の操作.
                                                             (line  269)
* translate() (bytes のメソッド):        bytes と bytearray の操作.
                                                             (line  269)
* translate() (fnmatch モジュール):      fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   92)
* translate() (glob モジュール):         glob --- Unix 形式のパス名のパターン展開.
                                                             (line  127)
* translate() (str のメソッド):          文字列メソッド<2>.  (line  921)
* translation() (gettext モジュール):    クラス形式の API.   (line   42)
* Transport (asyncio のクラス):          トランスポートのクラス階層構造.
                                                             (line   29)
* transport (asyncio.StreamWriter の属性): StreamWriter.     (line   62)
* Transport Layer Security:              ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    8)
* traps (decimal.Context の属性):        Context オブジェクト.
                                                             (line  136)
* Traversable (importlib.resources.abc のクラス): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   89)
* TraversableResources (importlib.resources.abc のクラス): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  161)
* traverseproc (C type):                 Traversal.          (line    8)
* TreeBuilder (xml.etree.ElementTree のクラス): TreeBuilder オブジェクト.
                                                             (line    6)
* Treeview (tkinter.ttk のクラス):       ttk Treeview.       (line    6)
* triangular() (random モジュール):      実数分布.           (line   22)
* tries (doctest.DocTestRunner の属性):  DocTestRunner オブジェクト.
                                                             (line  149)
* triple-quoted string:                  文字列およびバイト列リテラル.
                                                             (line   33)
* triple-quoted string <1>:              用語集<2>.          (line 1778)
* True:                                  numbers Integral 整数.
                                                             (line   24)
* true:                                  真理値判定.         (line    9)
* True <1>:                              真理値判定.         (line   25)
* True <2>:                              ブーリアン型 - bool.
                                                             (line    9)
* True (組み込み変数):                   組み込み定数.       (line   13)
* truediv() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  170)
* trunc() (math モジュール):             数値型 int float complex.
                                                             (line  115)
* trunc() (math モジュール) <1>:         Floating point arithmetic.
                                                             (line  111)
* truncate() (io.IOBase のメソッド):     I/O 基底クラス.     (line  139)
* truncate() (os モジュール):            ファイルとディレクトリ.
                                                             (line 1980)
* 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  968)
* TUESDAY (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  444)
* 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 1787)
* type (ctypes.CField の属性):           構造化データ型.     (line  255)
* type (optparse.Option の属性):         オプション属性.     (line   27)
* type (socket.socket の属性):           socket オブジェクト.
                                                             (line  620)
* type (tarfile.TarInfo の属性):         TarInfo オブジェクト.
                                                             (line   87)
* Type (typing のクラス):                Aliases to built-in types.
                                                             (line   61)
* type (urllib.request.Request の属性):  Request オブジェクト.
                                                             (line   21)
* type (組み込みクラス):                 組み込み関数.       (line 2054)
* type alias:                            用語集<2>.          (line 1794)
* type hint:                             用語集<2>.          (line 1815)
* type parameters:                       Type parameter lists.
                                                             (line   11)
* TYPE_ALIAS (symtable.SymbolTableType の属性): 記号表の検査.
                                                             (line   31)
* type_check_only() (typing モジュール): Functions and decorators.
                                                             (line  431)
* TYPE_CHECKER (optparse.Option の属性): 新しい型の追加.     (line   17)
* TYPE_CHECKING (typing モジュール):     定数<10>.           (line    6)
* type_comment (ast.arg の属性):         関数およびクラス定義.
                                                             (line   73)
* type_comment (ast.Assign の属性):      文 Statements.      (line   15)
* type_comment (ast.For の属性):         制御フロー.         (line   54)
* type_comment (ast.FunctionDef の属性): 関数およびクラス定義.
                                                             (line   25)
* type_comment (ast.With の属性):        制御フロー.         (line  237)
* TYPE_COMMENT (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line  172)
* TYPE_IGNORE (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  165)
* TYPE_PARAMETERS (symtable.SymbolTableType の属性): 記号表の検査.
                                                             (line   35)
* type_repr() (annotationlib モジュール): 関数<12>.          (line  226)
* TYPE_VARIABLE (symtable.SymbolTableType の属性): 記号表の検査.
                                                             (line   40)
* type;階層:                             標準型の階層.       (line    6)
* typeahead() (curses モジュール):       関数<6>.            (line  543)
* TypeAlias (ast のクラス):              文 Statements.      (line  161)
* TypeAlias (typing モジュール):         特殊型.             (line  198)
* TypeAliasType (typing のクラス):       Building generic types and type aliases.
                                                             (line  602)
* typecode (array.array の属性):         array --- 効率的な数値配列.
                                                             (line  149)
* typecodes (array モジュール):          array --- 効率的な数値配列.
                                                             (line  115)
* TYPED_ACTIONS (optparse.Option の属性): 新しいアクションの追加.
                                                             (line   39)
* typed_subpart_iterator() (email.iterators モジュール): email iterators イテレータ.
                                                             (line   26)
* TypedDict (typing のクラス):           Other special directives.
                                                             (line  255)
* TypeError:                             具象例外.           (line  415)
* TypeForm (typing モジュール):          特殊形式.           (line  446)
* TypeGuard (typing モジュール):         特殊形式.           (line  565)
* TypeIgnore (ast のクラス):             Type annotations.   (line    6)
* TypeIs (typing モジュール):            特殊形式.           (line  475)
* TYPES (optparse.Option の属性):        新しい型の追加.     (line   11)
* types_map (mimetypes モジュール):      mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  163)
* 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   64)
* TypeVarTuple (typing のクラス):        Building generic types and type aliases.
                                                             (line  253)
* TZ:                                    関数<5>.            (line  651)
* TZ <1>:                                関数<5>.            (line  652)
* TZ <2>:                                関数<5>.            (line  660)
* TZ <3>:                                関数<5>.            (line  664)
* TZ <4>:                                関数<5>.            (line  666)
* TZ <5>:                                関数<5>.            (line  729)
* tzinfo (datetime のクラス):            tzinfo objects.     (line    6)
* tzinfo (datetime.datetime の属性):     datetime objects.   (line  338)
* tzinfo (datetime.time の属性):         time objects.       (line   66)
* tzname (time モジュール):              Timezone Constants. (line   25)
* tzname() (datetime.datetime のメソッド): datetime objects. (line  555)
* 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  648)
* 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  252)
* udata (select.kevent の属性):          Kevent objects.     (line  180)
* UDPServer (socketserver のクラス):     socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line   33)
* 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  141)
* uid (tarfile.TarInfo の属性):          TarInfo オブジェクト.
                                                             (line  107)
* uid() (imaplib.IMAP4 のメソッド):      IMAP4 オブジェクト. (line  461)
* uidl() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   99)
* ULONG_MAX (C macro):                   整数型オブジェクト integer object.
                                                             (line  275)
* ulp() (math モジュール):               Floating point manipulation functions.
                                                             (line  132)
* umask() (os モジュール):               プロセスのパラメーター.
                                                             (line  564)
* unalias (pdb command):                 Debugger commands.  (line  402)
* uname (tarfile.TarInfo の属性):        TarInfo オブジェクト.
                                                             (line  123)
* uname() (os モジュール):               プロセスのパラメーター.
                                                             (line  571)
* uname() (platform モジュール):         Cross platform.     (line  145)
* UNARY_INVERT (opcode):                 Python バイトコード命令.
                                                             (line  223)
* UNARY_NEGATIVE (opcode):               Python バイトコード命令.
                                                             (line  212)
* UNARY_NOT (opcode):                    Python バイトコード命令.
                                                             (line  216)
* unaryfunc (C type):                    Slot Type typedefs. (line  117)
* UnaryOp (ast のクラス):                式 expression<2>.   (line   23)
* unbinding;name:                        del 文<2>.          (line   15)
* UnboundLocalError:                     名前解決.           (line   17)
* UnboundLocalError <1>:                 具象例外.           (line  432)
* unbuffered I/O:                        組み込み関数.       (line 1447)
* UNC パス;os.makedirs():                ファイルとディレクトリ.
                                                             (line  563)
* uncancel() (asyncio.Task のメソッド):  Task object.        (line  279)
* UNCHECKED_HASH (py_compile.PycInvalidationMode の属性): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line  116)
* unconsumed_tail (zlib.Decompress の属性): zlib --- gzip 互換の圧縮.
                                                             (line  271)
* unctrl() (curses モジュール):          関数<6>.            (line  555)
* unctrl() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  226)
* Underflow (decimal のクラス):          シグナル.           (line   98)
* 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  239)
* unget_wch() (curses モジュール):       関数<6>.            (line  577)
* ungetch() (curses モジュール):         関数<6>.            (line  562)
* ungetch() (msvcrt モジュール):         コンソール I/O 関連.
                                                             (line   44)
* ungetmouse() (curses モジュール):      関数<6>.            (line  587)
* ungetwch() (msvcrt モジュール):        コンソール I/O 関連.
                                                             (line   50)
* unhexlify() (binascii モジュール):     binascii --- バイナリ と ASCII 間の変換.
                                                             (line  358)
* 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  481)
* UnicodeEncodeError:                    具象例外.           (line  476)
* UnicodeError:                          具象例外.           (line  438)
* UnicodeTranslateError:                 具象例外.           (line  486)
* UnicodeWarning:                        警告.               (line   67)
* unidata_version (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  248)
* unified_diff() (difflib モジュール):   difflib --- 差分の計算の補助.
                                                             (line  288)
* uniform() (random モジュール):         実数分布.           (line   14)
* UnimplementedFileMode:                 http client --- HTTP プロトコルクライアント.
                                                             (line  168)
* 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)
* 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 1830)
* universal newlines;bytearray.splitlines メソッド: bytes と bytearray の操作.
                                                             (line  646)
* universal newlines;bytes.splitlines メソッド: bytes と bytearray の操作.
                                                             (line  646)
* universal newlines;csv.reader 関数:    モジュールコンテンツ.
                                                             (line    8)
* universal newlines;importlib.abc.InspectLoader.get_source メソッド: importlib abc -- Abstract base classes related to import.
                                                             (line  222)
* 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 1387)
* universal newlines;str.splitlines メソッド: 文字列メソッド<2>.
                                                             (line  750)
* 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  215)
* unix_shell (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line   61)
* UNIX;file control:                     fcntl --- fcntl および ioctl システムコール.
                                                             (line    6)
* UNIX;I/O control:                      fcntl --- fcntl および ioctl システムコール.
                                                             (line    6)
* UnixDatagramServer (socketserver のクラス): socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line   40)
* UnixStreamServer (socketserver のクラス): socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line   40)
* 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  160)
* UnknownTransferEncoding:               http client --- HTTP プロトコルクライアント.
                                                             (line  164)
* unlink() (multiprocessing.shared_memory.SharedMemory のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  102)
* unlink() (os モジュール):              ファイルとディレクトリ.
                                                             (line 1999)
* 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  269)
* 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  976)
* UNNAMED_SECTION (configparser モジュール): ConfigParser オブジェクト.
                                                             (line  333)
* UnnamedSectionDisabledError:           例外<10>.           (line   76)
* Unpack (typing モジュール):            特殊形式.           (line  622)
* unpack_archive() (shutil モジュール):  アーカイブ化操作.   (line  138)
* 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   71)
* unparsedEntityDecl() (xml.sax.handler.DTDHandler のメソッド): DTDHandler オブジェクト.
                                                             (line   12)
* UnparsedEntityDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  411)
* Unpickler (pickle のクラス):           モジュールインターフェース.
                                                             (line  245)
* UnpicklingError:                       モジュールインターフェース.
                                                             (line  111)
* unquote_plus() (urllib.parse モジュール): URL のクオート.  (line   80)
* unquote_to_bytes() (urllib.parse モジュール): URL のクオート.
                                                             (line   90)
* unquote() (email.utils モジュール):    email utils Miscellaneous utilities.
                                                             (line   51)
* unquote() (urllib.parse モジュール):   URL のクオート.     (line   60)
* unraisablehook() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line 2206)
* unregister_archive_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  133)
* unregister_dialect() (csv モジュール): モジュールコンテンツ.
                                                             (line   79)
* unregister_unpack_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  205)
* unregister() (atexit モジュール):      atexit --- 終了ハンドラー.
                                                             (line   56)
* unregister() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  177)
* unregister() (faulthandler モジュール): ユーザシグナルに対してtracebackをダンプする.
                                                             (line   26)
* 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  472)
* unset() (test.support.os_helper.EnvironmentVarGuard のメソッド): test support os_helper --- Utilities for os tests.
                                                             (line   68)
* unsetenv() (os モジュール):            プロセスのパラメーター.
                                                             (line  606)
* unshare() (os モジュール):             プロセスのパラメーター.
                                                             (line  625)
* UnstructuredHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  113)
* unsubscribe() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  468)
* 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 オブジェクト.
                                                             (line  573)
* unused_data (bz2.BZ2Decompressor の属性): 逐次圧縮および展開.
                                                             (line   78)
* unused_data (compression.zstd.ZstdDecompressor の属性): メモリ上での圧縮と展開.
                                                             (line  215)
* unused_data (lzma.LZMADecompressor の属性): メモリ上での圧縮と展開<2>.
                                                             (line  158)
* unused_data (zlib.Decompress の属性):  zlib --- gzip 互換の圧縮.
                                                             (line  263)
* unverifiable (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   48)
* unwrap() (inspect モジュール):         クラスと関数<2>.    (line  144)
* unwrap() (ssl.SSLSocket のメソッド):   SSL sockets.        (line  323)
* unwrap() (urllib.parse モジュール):    URL の解析.         (line  396)
* up (pdb command):                      Debugger commands.  (line   98)
* up() (turtle モジュール):              描画状態.           (line   12)
* update_abstractmethods() (abc モジュール): abc --- 抽象基底クラス.
                                                             (line  335)
* update_authenticated() (urllib.request.HTTPPasswordMgrWithPriorAuth のメソッド): HTTPPasswordMgrWithPriorAuth オブジェクト.
                                                             (line   26)
* update_lines_cols() (curses モジュール): 関数<6>.          (line  570)
* update_panels() (curses.panel モジュール): 関数<7>.        (line   23)
* update_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   77)
* update_wrapper() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  704)
* update() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line  124)
* update() (dict のメソッド):            Mapping types --- dict frozendict.
                                                             (line  231)
* update() (hashlib.hash のメソッド):    Hash Objects.       (line   30)
* update() (hmac.HMAC のメソッド):       hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   51)
* update() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line  108)
* update() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  239)
* update() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  191)
* update() (set のメソッド):             set（集合）型 --- set frozenset.
                                                             (line  171)
* update() (trace.CoverageResults のメソッド): プログラミングインターフェース.
                                                             (line   51)
* update() (turtle モジュール):          アニメーションの制御.
                                                             (line   58)
* upgrade_dependencies() (venv.EnvBuilder のメソッド): API<2>.
                                                             (line  165)
* upper() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  738)
* upper() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  738)
* upper() (str のメソッド):              文字列メソッド<2>.  (line  946)
* 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  366)
* urlencode() (urllib.parse モジュール): URL のクオート.     (line  103)
* URLError:                              urllib error --- urllib request によって送出される例外クラス.
                                                             (line   16)
* urljoin() (urllib.parse モジュール):   URL の解析.         (line  330)
* urlopen() (urllib.request モジュール): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line   33)
* urlparse() (urllib.parse モジュール):  URL の解析.         (line  291)
* urlretrieve() (urllib.request モジュール): レガシーインターフェース<2>.
                                                             (line   10)
* urlsafe_b64decode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line  109)
* urlsafe_b64encode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   99)
* URLSAFE_BASE64_ALPHABET (binascii モジュール): binascii --- バイナリ と ASCII 間の変換.
                                                             (line  392)
* urlsplit() (urllib.parse モジュール):  URL の解析.         (line    9)
* urlunparse() (urllib.parse モジュール): URL の解析.        (line  308)
* urlunsplit() (urllib.parse モジュール): URL の解析.        (line  270)
* urn (uuid.UUID の属性):                uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  147)
* US (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  117)
* use_default_colors() (curses モジュール): 関数<6>.         (line  602)
* use_env() (curses モジュール):         関数<6>.            (line  592)
* 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   78)
* USER_BASE (site モジュール):           モジュールの内容<7>.
                                                             (line   32)
* user_call() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  286)
* user_exception() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  305)
* user_line() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  294)
* user_return() (bdb.Bdb のメソッド):    bdb --- デバッガーフレームワーク.
                                                             (line  300)
* USER_SITE (site モジュール):           モジュールの内容<7>.
                                                             (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  166)
* USERNAME <1>:                          プロセスのパラメーター.
                                                             (line  259)
* USERNAME <2>:                          getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   78)
* username (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  428)
* USERPROFILE:                           os path<6>.         (line   14)
* USERPROFILE <1>:                       Python API の変更<6>.
                                                             (line  117)
* USERPROFILE <2>:                       Windows<48>.        (line   15)
* USERPROFILE <3>:                       os path --- 一般的なパス名操作.
                                                             (line  163)
* userptr() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   57)
* UserString (collections のクラス):     UserString オブジェクト.
                                                             (line   11)
* UserWarning:                           警告.               (line   13)
* USTAR_FORMAT (tarfile モジュール):     tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  388)
* 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  136)
* utcnow() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line   81)
* utcoffset() (datetime.datetime のメソッド): datetime objects.
                                                             (line  535)
* 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  580)
* utf8 (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  377)
* utf8_enabled (imaplib.IMAP4 の属性):   IMAP4 オブジェクト. (line  499)
* utf8_mode (sys.flags の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line  610)
* utf8() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line  106)
* utime() (os モジュール):               ファイルとディレクトリ.
                                                             (line 2013)
* UU_ALPHABET (binascii モジュール):     binascii --- バイナリ と ASCII 間の変換.
                                                             (line  399)
* 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 モジュール):   モジュールの内容<4>.
                                                             (line  330)
* validator() (wsgiref.validate モジュール): wsgiref validate --- WSGI conformance checker.
                                                             (line   21)
* value:                                 辞書表示.           (line    6)
* VALUE (annotationlib.Format の属性):   クラス<5>.          (line   14)
* value (ctypes._SimpleCData の属性):    基本データ型<2>.    (line   17)
* value (enum.Enum の属性):              データ型<2>.        (line  130)
* value (http.cookiejar.Cookie の属性):  Cookieオブジェクト<2>.
                                                             (line   31)
* value (http.cookies.Morsel の属性):    Morselオブジェクト. (line   63)
* value (StopIteration の属性):          具象例外.           (line  281)
* value (string.templatelib.Interpolation の属性): 型.       (line  214)
* value (xml.dom.Attr の属性):           Attr オブジェクト.  (line   23)
* value_decode() (http.cookies.BaseCookie のメソッド): Cookieオブジェクト.
                                                             (line    6)
* value_encode() (http.cookies.BaseCookie のメソッド): Cookieオブジェクト.
                                                             (line   13)
* VALUE_WITH_FAKE_GLOBALS (annotationlib.Format の属性): クラス<5>.
                                                             (line   19)
* Value() (multiprocessing モジュール):  共有 ctypes オブジェクト.
                                                             (line    9)
* Value() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  220)
* Value() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   71)
* ValueError:                            具象例外.           (line  491)
* valuerefs() (weakref.WeakValueDictionary のメソッド): weakref --- Weak references.
                                                             (line  217)
* Values (optparse のクラス):            オプションの定義.   (line   87)
* values (string.templatelib.Template の属性): 型.           (line   90)
* values() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  137)
* values() (dict のメソッド):            Mapping types --- dict frozendict.
                                                             (line  248)
* 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  136)
* values() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  305)
* ValuesView (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  127)
* ValuesView (typing のクラス):          Aliases to container ABCs in collections abc.
                                                             (line  120)
* var (contextvars.Token の属性):        コンテキスト変数.   (line  116)
* variable annotation:                   用語集<2>.          (line 1837)
* 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 --- スクロール可能なテキストウィジェット.
                                                             (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  594)
* 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  331)
* verify_code (ssl.SSLCertVerificationError の属性): 例外<20>.
                                                             (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  705)
* verify_generated_headers (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  202)
* verify_message (ssl.SSLCertVerificationError の属性): 例外<20>.
                                                             (line   88)
* verify_mode (ssl.SSLContext の属性):   SSL contexts.       (line  720)
* 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   91)
* 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  236)
* version (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   47)
* version (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   19)
* version (http.cookies.Morsel の属性):  Morselオブジェクト. (line   13)
* version (importlib.metadata.Distribution の属性): Distributions.
                                                             (line   80)
* version (in module sys):               プロセスワイドのパラメータ.
                                                             (line   36)
* version (in module sys) <1>:           プロセスワイドのパラメータ.
                                                             (line   73)
* version (in module sys) <2>:           プロセスワイドのパラメータ.
                                                             (line   84)
* 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  153)
* version (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line 2259)
* version (sys.thread_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 2192)
* version (uuid.UUID の属性):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  157)
* version_info (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line 2275)
* 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  353)
* vformat() (string.Formatter のメソッド): Custom string formatting.
                                                             (line   26)
* virtual environment:                   用語集<2>.          (line 1861)
* virtual machine:                       用語集<2>.          (line 1870)
* visit_Constant() (ast.NodeVisitor のメソッド): ast helpers.
                                                             (line  214)
* visit() (ast.NodeVisitor のメソッド):  ast helpers.        (line  197)
* visitproc (C type):                    循環参照ガベージコレクションをサポートする.
                                                             (line  223)
* vline() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  578)
* voidcmd() (ftplib.FTP のメソッド):     FTP オブジェクト.   (line  164)
* volume (zipfile.ZipInfo の属性):       ZipInfo objects.    (line  135)
* vonmisesvariate() (random モジュール): 実数分布.           (line   85)
* VT (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   57)
* W_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* wait_closed() (asyncio.Server のメソッド): Server 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() (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  848)
* 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  956)
* wait4() (os モジュール):               プロセス管理.       (line  969)
* waitid() (os モジュール):              プロセス管理.       (line  872)
* waitpid() (os モジュール):             プロセス管理.       (line  911)
* waitstatus_to_exitcode() (os モジュール): プロセス管理.    (line 1086)
* walk_packages() (pkgutil モジュール):  pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line  107)
* walk_stack() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line  182)
* walk_tb() (traceback モジュール):      モジュールレベルの関数<2>.
                                                             (line  196)
* walk() (ast モジュール):               ast helpers.        (line  182)
* 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 2060)
* walk() (pathlib.Path のメソッド):      ディレクトリを読む. (line  117)
* walrus operator:                       ブール演算 boolean operation.
                                                             (line   34)
* walrus operator <1>:                   用語集<2>.          (line 1876)
* want (doctest.Example の属性):         Example オブジェクト.
                                                             (line   22)
* warn_default_encoding (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  620)
* warn_explicit() (warnings モジュール): 利用可能な関数.     (line   61)
* warn() (warnings モジュール):          利用可能な関数.     (line    6)
* Warning:                               警告.               (line    9)
* Warning <1>:                           例外<8>.            (line    8)
* WARNING (logging モジュール):          ロギングレベル.     (line   33)
* WARNING (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  198)
* warning() (logging モジュール):        モジュールレベルの関数.
                                                             (line   67)
* warning() (logging.Logger のメソッド): ロガーオブジェクト. (line  283)
* warning() (xml.sax.handler.ErrorHandler のメソッド): ErrorHandler オブジェクト.
                                                             (line   29)
* warnings:                              warnings --- 警告の制御.
                                                             (line    8)
* WarningsRecorder (test.support.warnings_helper のクラス): test support warnings_helper --- Utilities for warnings tests.
                                                             (line  111)
* warnoptions (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line 2288)
* wasSuccessful() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  313)
* WatchedFileHandler (logging.handlers のクラス): WatchedFileHandler.
                                                             (line   25)
* WAVE_FORMAT_EXTENSIBLE (wave モジュール): wave --- WAV ファイルの読み書き.
                                                             (line   73)
* WAVE_FORMAT_IEEE_FLOAT (wave モジュール): wave --- WAV ファイルの読み書き.
                                                             (line   69)
* WAVE_FORMAT_PCM (wave モジュール):     wave --- WAV ファイルの読み書き.
                                                             (line   65)
* Wave_read (wave のクラス):             Wave_read オブジェクト.
                                                             (line    6)
* Wave_write (wave のクラス):            Wave_write オブジェクト.
                                                             (line    6)
* WCONTINUED (os モジュール):            プロセス管理.       (line 1008)
* WCOREDUMP() (os モジュール):           プロセス管理.       (line 1127)
* WeakKeyDictionary (weakref のクラス):  weakref --- Weak references.
                                                             (line  158)
* WeakMethod (weakref のクラス):         weakref --- Weak references.
                                                             (line  226)
* WeakSet (weakref のクラス):            weakref --- Weak references.
                                                             (line  221)
* WeakValueDictionary (weakref のクラス): weakref --- Weak references.
                                                             (line  205)
* webbrowser コマンドラインオプション; -n: コマンドライン・インターフェース<6>.
                                                             (line   10)
* webbrowser コマンドラインオプション; -new-tab: コマンドライン・インターフェース<6>.
                                                             (line   14)
* webbrowser コマンドラインオプション; -new-window: コマンドライン・インターフェース<6>.
                                                             (line   10)
* webbrowser コマンドラインオプション; -t: コマンドライン・インターフェース<6>.
                                                             (line   14)
* WEDNESDAY (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  444)
* weekday (calendar.IllegalWeekdayError の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  564)
* weekday() (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  374)
* weekday() (datetime.date のメソッド):  date objects.       (line  261)
* weekday() (datetime.datetime のメソッド): datetime objects.
                                                             (line  646)
* weekheader() (calendar モジュール):    calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  379)
* weibullvariate() (random モジュール):  実数分布.           (line   96)
* WEXITED (os モジュール):               プロセス管理.       (line 1017)
* WEXITSTATUS() (os モジュール):         プロセス管理.       (line 1174)
* 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  439)
* whichdb() (dbm モジュール):            dbm --- Unix "データベース" へのインターフェース.
                                                             (line   35)
* While (ast のクラス):                  制御フロー.         (line   77)
* whitespace (shlex.shlex の属性):       shlex オブジェクト. (line  103)
* whitespace (string モジュール):        文字列定数.         (line   51)
* whitespace_split (shlex.shlex の属性): shlex オブジェクト. (line  127)
* Widget (tkinter.ttk のクラス):         ttk Widget.         (line   10)
* width (sys.hash_info の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line 1120)
* width (textwrap.TextWrapper の属性):   textwrap --- テキストの折り返しと詰め込み.
                                                             (line  165)
* width() (turtle モジュール):           描画状態.           (line   18)
* WIFCONTINUED() (os モジュール):        プロセス管理.       (line 1137)
* WIFEXITED() (os モジュール):           プロセス管理.       (line 1166)
* WIFSIGNALED() (os モジュール):         プロセス管理.       (line 1159)
* WIFSTOPPED() (os モジュール):          プロセス管理.       (line 1147)
* 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  153)
* windll (ctypes モジュール):            共有ライブラリをロードする.
                                                             (line  215)
* window (curses のクラス):              Window オブジェクト.
                                                             (line    6)
* window manager (widgets):              ウィンドウマネージャ.
                                                             (line    6)
* window_height() (turtle モジュール):   設定と特殊なメソッド.
                                                             (line  114)
* window_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   53)
* window_log_max (compression.zstd.DecompressionParameter の属性): Advanced parameter control.
                                                             (line  286)
* window_width() (turtle モジュール):    設定と特殊なメソッド.
                                                             (line  121)
* window() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   61)
* Windows:                               完全な Python プログラム.
                                                             (line   24)
* Windows ini ファイル:                  configparser --- 設定ファイルのパーサー.
                                                             (line    8)
* WindowsError:                          具象例外.           (line  509)
* 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  180)
* WinError() (ctypes モジュール):        ユーティリティー関数.
                                                             (line  253)
* WINFUNCTYPE() (ctypes モジュール):     関数プロトタイプ.   (line   23)
* WinSock:                               select --- I/O 完了の待機.
                                                             (line  160)
* winver (sys モジュール):               sys --- システム固有のパラメーターと関数.
                                                             (line 2293)
* 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  346)
* 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  405)
* with_statement (__future__ モジュール): モジュールコンテンツ<3>.
                                                             (line   31)
* with_stem() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  362)
* with_suffix() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  385)
* with_traceback() (BaseException のメソッド): 基底クラス.   (line   23)
* withitem (ast のクラス):               制御フロー.         (line  242)
* WNOHANG (os モジュール):               プロセス管理.       (line 1052)
* WNOWAIT (os モジュール):               プロセス管理.       (line 1060)
* 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  529)
* wrap_future() (asyncio モジュール):    Future の関数.      (line   54)
* wrap_socket() (ssl.SSLContext のメソッド): SSL contexts.   (line  464)
* wrap() (textwrap モジュール):          textwrap --- テキストの折り返しと詰め込み.
                                                             (line   16)
* wrap() (textwrap.TextWrapper のメソッド): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  282)
* wrapper() (curses モジュール):         関数<6>.            (line  606)
* wrapperbase (C struct):                デスクリプタオブジェクト descriptor object.
                                                             (line   75)
* WrapperDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line   87)
* wraps() (functools モジュール):        functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  750)
* WRITABLE (_tkinter モジュール):        ファイルハンドラ.   (line   42)
* WRITABLE (inspect.BufferFlags の属性): Buffer flags.       (line   17)
* 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  383)
* write_bytes() (pathlib.Path のメソッド): ファイルを読み書きする<2>.
                                                             (line   68)
* 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  333)
* write() (io.BufferedWriter のメソッド): バッファ付きストリーム.
                                                             (line  133)
* write() (io.RawIOBase のメソッド):     I/O 基底クラス.     (line  212)
* write() (io.TextIOBase のメソッド):    テキスト I/O<2>.    (line   91)
* write() (io.Writer のメソッド):        Static Typing.      (line   40)
* write() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  367)
* write() (os モジュール):               ファイル記述子の操作.
                                                             (line  988)
* write() (sqlite3.Blob のメソッド):     Blob オブジェクト.  (line   55)
* write() (ssl.MemoryBIO のメソッド):    Memory BIO support. (line  150)
* write() (ssl.SSLSocket のメソッド):    SSL sockets.        (line  103)
* write() (turtle モジュール):           さらなる描画の制御. (line   29)
* write() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   60)
* write() (zipfile.ZipFile のメソッド):  ZipFile objects.    (line  282)
* writeframes() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line  136)
* writeframesraw() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line  129)
* 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   40)
* writerow() (csv.csvwriter のメソッド): writer オブジェクト.
                                                             (line   16)
* writerows() (csv.csvwriter のメソッド): writer オブジェクト.
                                                             (line   25)
* writestr() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  318)
* WriteTransport (asyncio のクラス):     トランスポートのクラス階層構造.
                                                             (line   11)
* writev() (os モジュール):              ファイル記述子の操作.
                                                             (line 1007)
* writexml() (xml.dom.minidom.Node のメソッド): DOM オブジェクト.
                                                             (line   28)
* writing;''values'':                    式文 expression statement.
                                                             (line   16)
* WrongDocumentErr:                      例外<24>.           (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 1029)
* WSTOPSIG() (os モジュール):            プロセス管理.       (line 1183)
* wstring_at() (ctypes モジュール):      ユーティリティー関数.
                                                             (line  265)
* WTERMSIG() (os モジュール):            プロセス管理.       (line 1192)
* WUNTRACED (os モジュール):             プロセス管理.       (line 1041)
* WWW:                                   インターネットプロトコルとサポート.
                                                             (line    6)
* WWW <1>:                               urllib parse --- URL を構成要素に解析する.
                                                             (line    8)
* WWW <2>:                               urllib robotparser --- robots txt 用のパーサー.
                                                             (line    8)
* WWW;サーバ:                            http server --- HTTP サーバー.
                                                             (line    8)
* X (re モジュール):                     フラグ.             (line  122)
* X_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* X509 certificate:                      SSL contexts.       (line  833)
* xatom() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line  482)
* XATTR_CREATE (os モジュール):          Linux 拡張属性.     (line   93)
* XATTR_REPLACE (os モジュール):         Linux 拡張属性.     (line   98)
* XATTR_SIZE_MAX (os モジュール):        Linux 拡張属性.     (line   88)
* 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  274)
* xmlcharrefreplace_errors() (codecs モジュール): エラーハンドラ.
                                                             (line  165)
* xmlcharrefreplace;error handler's name: エラーハンドラ.    (line   52)
* XmlDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  340)
* 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  283)
* 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)
* xview() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  317)
* ycor() (turtle モジュール):            Turtle の状態を知る.
                                                             (line   44)
* year (datetime.date の属性):           date objects.       (line  147)
* year (datetime.datetime の属性):       datetime objects.   (line  309)
* yeardatescalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  123)
* yeardays2calendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  130)
* yeardayscalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  137)
* YES (tkinter.messagebox モジュール):   tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  157)
* YESEXPR (locale モジュール):           locale --- 国際化サービス.
                                                             (line  281)
* YESNO (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  181)
* YESNOCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  186)
* Yield (ast のクラス):                  関数およびクラス定義.
                                                             (line  123)
* YIELD_VALUE (opcode):                  Python バイトコード命令.
                                                             (line  413)
* yield;expression:                      Yield 式.           (line    6)
* yield;yield from (in What's New):      PEP 3151 OS および IO 例外階層の手直し.
                                                             (line   85)
* yield;例:                              ジェネレータ-イテレータメソッド.
                                                             (line   80)
* YieldFrom (ast のクラス):              関数およびクラス定義.
                                                             (line  123)
* yiq_to_rgb() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   32)
* yview() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  322)
* Z_BEST_COMPRESSION (zlib モジュール):  zlib --- gzip 互換の圧縮.
                                                             (line  362)
* Z_BEST_SPEED (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  358)
* Z_BLOCK (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  428)
* Z_DEFAULT_COMPRESSION (zlib モジュール): zlib --- gzip 互換の圧縮.
                                                             (line  366)
* Z_DEFAULT_STRATEGY (zlib モジュール):  zlib --- gzip 互換の圧縮.
                                                             (line  371)
* Z_FILTERED (zlib モジュール):          zlib --- gzip 互換の圧縮.
                                                             (line  375)
* Z_FINISH (zlib モジュール):            zlib --- gzip 互換の圧縮.
                                                             (line  423)
* Z_FIXED (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  393)
* Z_FULL_FLUSH (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  418)
* Z_HUFFMAN_ONLY (zlib モジュール):      zlib --- gzip 互換の圧縮.
                                                             (line  379)
* Z_NO_COMPRESSION (zlib モジュール):    zlib --- gzip 互換の圧縮.
                                                             (line  352)
* Z_NO_FLUSH (zlib モジュール):          zlib --- gzip 互換の圧縮.
                                                             (line  403)
* Z_PARTIAL_FLUSH (zlib モジュール):     zlib --- gzip 互換の圧縮.
                                                             (line  409)
* Z_RLE (zlib モジュール):               zlib --- gzip 互換の圧縮.
                                                             (line  383)
* Z_SYNC_FLUSH (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  413)
* Z_TREES (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  437)
* z;文字列のフォーマットで:              Format specification mini-language.
                                                             (line   92)
* Z85_ALPHABET (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line  431)
* z85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line  152)
* z85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line  132)
* Zen of Python:                         用語集<2>.          (line 1882)
* ZeroDivisionError:                     具象例外.           (line  497)
* zfill() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  757)
* zfill() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  757)
* zfill() (str のメソッド):              文字列メソッド<2>.  (line  957)
* 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   61)
* ZipInfo (zipfile のクラス):            zipfile --- ZIP アーカイブの処理.
                                                             (line   67)
* ZLIB_RUNTIME_VERSION (zlib モジュール): zlib --- gzip 互換の圧縮.
                                                             (line  456)
* ZLIB_VERSION (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  449)
* ZLIBNG_VERSION (zlib モジュール):      zlib --- gzip 互換の圧縮.
                                                             (line  463)
* ZoneInfo (zoneinfo のクラス):          ZoneInfo クラス.    (line    6)
* ZoneInfoNotFoundError:                 例外と警告.         (line    6)
* zscore() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line  120)
* zstd_version_info (compression.zstd モジュール): その他<3>.
                                                             (line   32)
* ZstdCompressor (compression.zstd のクラス): メモリ上での圧縮と展開.
                                                             (line   50)
* ZstdDecompressor (compression.zstd のクラス): メモリ上での圧縮と展開.
                                                             (line  156)
* ZstdDict (compression.zstd のクラス):  Zstandard dictionaries.
                                                             (line   53)
* ZstdError:                             例外<9>.            (line    6)
* ZstdFile (compression.zstd のクラス):  圧縮ファイルへの読み書き.
                                                             (line   49)
* イテレータプロトコル:                  イテレータ型.       (line    6)
* イベントスケジューリング:              sched --- イベントスケジューラー.
                                                             (line    8)
* インタプリタ:                          トップレベル要素.   (line    6)
* インデックス操作:                      シーケンス型 sequence.
                                                             (line    6)
* インデント:                            インデント.         (line    6)
* エスケープシーケンス:                  Formal grammar.     (line   28)
* エポック:                              time --- 時刻データへのアクセスと変換.
                                                             (line   20)
* エポックからの秒数:                    time --- 時刻データへのアクセスと変換.
                                                             (line   24)
* エラー:                                例外<2>.            (line    6)
* エラー;logging:                        logging --- Python 用のログ記録手段.
                                                             (line    8)
* エラー処理:                            例外<2>.            (line    6)
* オブジェクト;Capsule:                  カプセル<2>.        (line    6)
* オブジェクト;None:                     None オブジェクト.  (line    6)
* オブジェクト;コード:                   セルオブジェクト cell object.
                                                             (line   58)
* オブジェクト;比較する:                 比較<2>.            (line   42)
* オブジェクトの値:                      オブジェクト、値、および型.
                                                             (line   10)
* オブジェクトの同一性:                  オブジェクト、値、および型.
                                                             (line   10)
* オブジェクトの型:                      オブジェクト、値、および型.
                                                             (line   10)
* カンマ:                                丸括弧形式 parenthesized form.
                                                             (line   19)
* キー:                                  辞書表示.           (line    6)
* キー <1>:                              用語集<2>.          (line  973)
* キーワード:                            キーワード 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)
* キーワード;lazy:                       import 文.          (line    6)
* キーワード;yield:                      Yield 式.           (line    6)
* クラス:                                用語集<2>.          (line  273)
* クラス;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   22)
* コマンドラインオプション; -build:      クロスコンパイルのオプション.
                                                             (line   12)
* コマンドラインオプション; -c:          インターフェイスオプション.
                                                             (line   34)
* コマンドラインオプション; -check-hash-based-pycs: その他のオプション.
                                                             (line   28)
* コマンドラインオプション; -d:          その他のオプション. (line   42)
* コマンドラインオプション; -disable-epoll: 一般的なオプション.
                                                             (line  295)
* コマンドラインオプション; -disable-gil: 一般的なオプション.
                                                             (line  244)
* コマンドラインオプション; -disable-ipv6: 一般的なオプション.
                                                             (line   17)
* コマンドラインオプション; -disable-safety: Security Options.
                                                             (line   57)
* コマンドラインオプション; -disable-test-modules: インストールオプション.
                                                             (line   25)
* コマンドラインオプション; -E:          その他のオプション. (line   50)
* コマンドラインオプション; -enable-big-digits: 一般的なオプション.
                                                             (line   22)
* コマンドラインオプション; -enable-bolt: パフォーマンスに関するオプション.
                                                             (line   62)
* コマンドラインオプション; -enable-experimental-jit: 一般的なオプション.
                                                             (line  256)
* コマンドラインオプション; -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  205)
* コマンドラインオプション; -enable-pystats: 一般的なオプション.
                                                             (line  150)
* コマンドラインオプション; -enable-shared: リンカのオプション<2>.
                                                             (line    6)
* コマンドラインオプション; -enable-slower-safety: Security Options.
                                                             (line   76)
* コマンドラインオプション; -enable-static-libpython-for-interpreter: リンカのオプション<2>.
                                                             (line   18)
* コマンドラインオプション; -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   57)
* コマンドラインオプション; -I:          その他のオプション. (line   78)
* コマンドラインオプション; -m:          インターフェイスオプション.
                                                             (line   51)
* コマンドラインオプション; -O:          その他のオプション. (line   90)
* コマンドラインオプション; -OO:         その他のオプション. (line  100)
* コマンドラインオプション; -P:          その他のオプション. (line  109)
* コマンドラインオプション; -prefix:     インストールオプション.
                                                             (line    6)
* コマンドラインオプション; -q:          その他のオプション. (line  128)
* コマンドラインオプション; -R:          その他のオプション. (line  135)
* コマンドラインオプション; -s:          その他のオプション. (line  161)
* コマンドラインオプション; -S:          その他のオプション. (line  173)
* コマンドラインオプション; -u:          その他のオプション. (line  180)
* コマンドラインオプション; -V:          一般オプション.     (line   33)
* コマンドラインオプション; -v:          その他のオプション. (line  190)
* コマンドラインオプション; -version:    一般オプション.     (line   33)
* コマンドラインオプション; -W:          その他のオプション. (line  203)
* コマンドラインオプション; -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   38)
* コマンドラインオプション; -with-libm:  Libraries options.  (line   33)
* コマンドラインオプション; -with-libs:  Libraries options.  (line    6)
* コマンドラインオプション; -with-lto:   パフォーマンスに関するオプション.
                                                             (line   46)
* コマンドラインオプション; -with-memory-sanitizer: Debug options.
                                                             (line   69)
* コマンドラインオプション; -with-missing-stdlib-config: 一般的なオプション.
                                                             (line  128)
* コマンドラインオプション; -with-openssl: Libraries options.
                                                             (line   43)
* コマンドラインオプション; -with-openssl-rpath: Libraries options.
                                                             (line   49)
* コマンドラインオプション; -with-pkg-config: 一般的なオプション.
                                                             (line  115)
* コマンドラインオプション; -with-platlibdir: 一般的なオプション.
                                                             (line   92)
* コマンドラインオプション; -with-pydebug: Debug options.    (line    6)
* コマンドラインオプション; -with-pymalloc-hugepages: パフォーマンスに関するオプション.
                                                             (line  165)
* コマンドラインオプション; -with-readline: Libraries options.
                                                             (line   15)
* コマンドラインオプション; -with-ssl-default-suites: Security Options.
                                                             (line   40)
* コマンドラインオプション; -with-strict-overflow: パフォーマンスに関するオプション.
                                                             (line  209)
* コマンドラインオプション; -with-suffix: 一般的なオプション.
                                                             (line   33)
* コマンドラインオプション; -with-system-expat: Libraries options.
                                                             (line   10)
* コマンドラインオプション; -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  195)
* コマンドラインオプション; -without-frame-pointers: パフォーマンスに関するオプション.
                                                             (line  114)
* コマンドラインオプション; -without-mimalloc: パフォーマンスに関するオプション.
                                                             (line  148)
* コマンドラインオプション; -without-pymalloc: パフォーマンスに関するオプション.
                                                             (line  158)
* コマンドラインオプション; -without-readline: Libraries options.
                                                             (line   25)
* コマンドラインオプション; -without-remote-debug: パフォーマンスに関するオプション.
                                                             (line  214)
* コマンドラインオプション; -without-static-libpython: リンカのオプション<2>.
                                                             (line   11)
* コマンドラインオプション; -x:          その他のオプション. (line  273)
* コマンドラインオプション; -X:          その他のオプション. (line  278)
* コマンドラインオプション; 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   49)
* コマンドラインオプション; LIBLZMA_LIBS: サードパーティ依存関係のオプション.
                                                             (line   51)
* コマンドラインオプション; LIBMPDEC_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   42)
* コマンドラインオプション; LIBMPDEC_LIBS: サードパーティ依存関係のオプション.
                                                             (line   44)
* コマンドラインオプション; LIBREADLINE_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   56)
* コマンドラインオプション; LIBREADLINE_LIBS: サードパーティ依存関係のオプション.
                                                             (line   58)
* コマンドラインオプション; LIBS:        リンカのオプション. (line   10)
* コマンドラインオプション; LIBSQLITE3_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   63)
* コマンドラインオプション; LIBSQLITE3_LIBS: サードパーティ依存関係のオプション.
                                                             (line   65)
* コマンドラインオプション; LIBUUID_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   70)
* コマンドラインオプション; LIBUUID_LIBS: サードパーティ依存関係のオプション.
                                                             (line   72)
* コマンドラインオプション; LIBZSTD_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   77)
* コマンドラインオプション; LIBZSTD_LIBS: サードパーティ依存関係のオプション.
                                                             (line   79)
* コマンドラインオプション; MACHDEP:     リンカのオプション. (line   14)
* コマンドラインオプション; PANEL_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   86)
* コマンドラインオプション; PANEL_LIBS:  サードパーティ依存関係のオプション.
                                                             (line   88)
* コマンドラインオプション; PKG_CONFIG:  一般的なオプション. (line  285)
* コマンドラインオプション; PKG_CONFIG_LIBDIR: 一般的なオプション.
                                                             (line  289)
* コマンドラインオプション; PKG_CONFIG_PATH: 一般的なオプション.
                                                             (line  291)
* コマンドラインオプション; TCLTK_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   95)
* コマンドラインオプション; TCLTK_LIBS:  サードパーティ依存関係のオプション.
                                                             (line   97)
* コマンドラインオプション; ZLIB_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line  101)
* コマンドラインオプション; ZLIB_LIBS:   サードパーティ依存関係のオプション.
                                                             (line  103)
* コメント:                              コメント Comments.  (line    6)
* コルーチン:                            特殊メソッド検索.   (line   72)
* コルーチン <1>:                        Yield 式.           (line   51)
* コルーチン <2>:                        用語集<2>.          (line  386)
* コルーチン;関数:                       コルーチン関数 coroutine function.
                                                             (line    6)
* コンテキスト管理プロトコル:            コンテキストマネージャ型.
                                                             (line    6)
* コンテキスト管理プロトコル <1>:        用語集<2>.          (line  358)
* コンテナ:                              オブジェクト、値、および型.
                                                             (line   65)
* コンテナ <1>:                          カスタムクラス型.   (line   19)
* コンテナ;での反復:                     イテレータ型.       (line    6)
* サブクラス化;変更不能な型:             基本的なカスタマイズ.
                                                             (line    8)
* ジェネレータ:                          用語集<2>.          (line  716)
* ジェネレータ <1>:                      用語集<2>.          (line  716)
* ジェネレータ;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  137)
* データ:                                オブジェクト、値、および型.
                                                             (line    6)
* データ;type:                           標準型の階層.       (line    6)
* データ;表形式:                         csv --- CSV ファイルの読み書き.
                                                             (line    8)
* データベース:                          dbm dumb --- Portable DBM implementation.
                                                             (line    8)
* ディレクトリ;トラバース:               ファイルとディレクトリ.
                                                             (line 2062)
* ディレクトリ;トラバース <1>:           ファイルとディレクトリ.
                                                             (line 2164)
* ディレクトリ;作成:                     ファイルとディレクトリ.
                                                             (line  563)
* ディレクトリ;削除:                     ディレクトリとファイルの操作.
                                                             (line  283)
* ディレクトリ;削除 <1>:                 ファイルとディレクトリ.
                                                             (line  770)
* ディレクトリ;変更:                     ファイルとディレクトリ.
                                                             (line  120)
* ディレクトリ;走査:                     ファイルとディレクトリ.
                                                             (line 2062)
* ディレクトリ;走査 <1>:                 ファイルとディレクトリ.
                                                             (line 2164)
* デストラクタ:                          基本的なカスタマイズ.
                                                             (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 1768)
* ドキュメント文字列:                    Special read-only attributes<2>.
                                                             (line   95)
* バイト:                                変更不能なシーケンス immutable sequence.
                                                             (line   45)
* バイト列リテラル:                      リテラル.           (line   15)
* バイナリモード:                        組み込み関数.       (line 1447)
* パス;操作:                             pathlib --- オブジェクト指向のファイルシステムパス.
                                                             (line   10)
* パス;操作 <1>:                         os path --- 一般的なパス名操作.
                                                             (line    9)
* パス;設定;ファイル:                    Startup entry points start files.
                                                             (line   48)
* パック;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  148)
* ファイル;modes:                        組み込み関数.       (line 1305)
* ファイル;コピー:                       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  259)
* プロセッサー時間 <1>:                  関数<5>.            (line  627)
* ブロック:                              プログラムの構造.   (line    6)
* プロトコル;iterator:                   イテレータ型.       (line    6)
* プロトコル;コンテキスト管理:           コンテキストマネージャ型.
                                                             (line    6)
* ベンチマーク:                          関数<5>.            (line  228)
* ベンチマーク <1>:                      関数<5>.            (line  259)
* ベンチマーク <2>:                      関数<5>.            (line  627)
* ベンチマーク <3>:                      timeit --- 小さなコードスニペットの実行時間計測.
                                                             (line    8)
* マイナス:                              単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   10)
* メソッド:                              用語集<2>.          (line 1136)
* メソッド;call:                         呼び出し call.      (line  137)
* モジュロ:                              二項算術演算 binary arithmetic operation.
                                                             (line   50)
* ユーザー;id:                           プロセスのパラメーター.
                                                             (line  353)
* ユーザー;ID、設定:                     プロセスのパラメーター.
                                                             (line  547)
* ユーザー;実効 ID:                      プロセスのパラメーター.
                                                             (line  208)
* ユーザ定義の;メソッド:                 インスタンスメソッド.
                                                             (line    6)
* ユーザ定義の;関数:                     ユーザ定義関数 user-defined function.
                                                             (line    6)
* ユーザ定義の;関数;call:                呼び出し call.      (line  127)
* リテラル:                              リテラル.           (line    6)
* リテラル <1>:                          リテラル<2>.        (line    6)
* ロケールエンコーディング:              用語集<2>.          (line 1084)
* 三項;operator:                         条件式 Conditional Expressions.
                                                             (line    6)
* 丸括弧形式:                            丸括弧形式 parenthesized form.
                                                             (line    6)
* 乗算:                                  二項算術演算 binary arithmetic operation.
                                                             (line   16)
* 予約語:                                キーワード keyword. (line    6)
* 代入;expression:                       ブール演算 boolean operation.
                                                             (line   33)
* 代入;statement:                        変更可能なシーケンス型 mutable sequence.
                                                             (line    6)
* 代入;statement <1>:                    代入文 assignment statement.
                                                             (line    6)
* 位置引数 (positional argument):        用語集<2>.          (line 1433)
* 例外:                                  例外<2>.            (line    6)
* 例外 <1>:                              raise 文.           (line    6)
* 例外;AssertionError:                   assert 文.          (line   22)
* 例外;AttributeError:                   属性参照.           (line   10)
* 例外;GeneratorExit:                    ジェネレータ-イテレータメソッド.
                                                             (line   63)
* 例外;GeneratorExit <1>:                非同期ジェネレータイテレータメソッド.
                                                             (line   60)
* 例外;ImportError:                      import 文.          (line    6)
* 例外;NameError:                        識別子 identifier、または名前 name.
                                                             (line   11)
* 例外;StopAsyncIteration:               非同期ジェネレータイテレータメソッド.
                                                             (line    9)
* 例外;StopIteration:                    ジェネレータ-イテレータメソッド.
                                                             (line   12)
* 例外;StopIteration <1>:                yield 文.           (line    6)
* 例外;TypeError:                        単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   23)
* 例外;ValueError:                       シフト演算 shifting operation.
                                                             (line   19)
* 例外;ZeroDivisionError:                二項算術演算 binary arithmetic operation.
                                                             (line   37)
* 例外;ハンドラ:                         トレースバック traceback オブジェクト.
                                                             (line    6)
* 例外;連鎖:                             raise 文.           (line   30)
* 例外;連鎖 <1>:                         例外コンテキスト.   (line    6)
* 例外ハンドラ:                          例外<2>.            (line    6)
* 例外を扱う:                            例外<2>.            (line    6)
* 例外を送出する:                        例外<2>.            (line    6)
* 先頭の空白:                            インデント.         (line    6)
* 入力:                                  式入力.             (line    6)
* 内包表記:                              リスト、集合、辞書の表示.
                                                             (line    6)
* 内部型:                                内部型 internal type.
                                                             (line    6)
* 凍結ユーティリティ:                    モジュールのインポート<2>.
                                                             (line  262)
* 到達不能オブジェクト:                  オブジェクト、値、および型.
                                                             (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  175)
* 属性;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  837)
* 永続化:                                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 1676)
* 添字;代入:                             ミュータブルなシーケンス型.
                                                             (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 frozendict.
                                                             (line    6)
* 演算;list;type:                        ミュータブルなシーケンス型.
                                                             (line   16)
* 演算;mapping;types:                    Mapping types --- dict frozendict.
                                                             (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 1629)
* 特殊;属性:                             標準型の階層.       (line   12)
* 環境:                                  名前解決.           (line   12)
* 環境;仮想:                             venv --- 仮想環境の作成.
                                                             (line   10)
* 環境変数; __PYVENV_LAUNCHER__:         PyConfig.           (line  182)
* 環境変数; __PYVENV_LAUNCHER__ <1>:     PyConfig.           (line  728)
* 環境変数; BASECFLAGS:                  Compiler flags.     (line   66)
* 環境変数; BASECPPFLAGS:                Preprocessor flags. (line   22)
* 環境変数; BLDSHARED:                   Linker flags.       (line   70)
* 環境変数; BROWSER:                     webbrowser<2>.      (line    6)
* 環境変数; BROWSER <1>:                 webbrowser<2>.      (line   10)
* 環境変数; BROWSER <2>:                 ライブラリ<29>.     (line  418)
* 環境変数; BROWSER <3>:                 ライブラリ<29>.     (line  422)
* 環境変数; 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  596)
* 環境変数; COLUMNS <1>:                 関数<6>.            (line  597)
* 環境変数; COMPILEALL_OPTS:             Compiler flags.     (line   41)
* 環境変数; COMSPEC:                     プロセス管理.       (line  800)
* 環境変数; 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_EXE_LDFLAGS:       Linker flags.       (line  100)
* 環境変数; CONFIGURE_LDFLAGS:           Linker flags.       (line   13)
* 環境変数; CONFIGURE_LDFLAGS_NODIST:    Linker flags.       (line   38)
* 環境変数; CPPFLAGS:                    新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   57)
* 環境変数; CPPFLAGS <1>:                Preprocessor flags. (line    8)
* 環境変数; CPPFLAGS <2>:                Preprocessor flags. (line   13)
* 環境変数; CPPFLAGS <3>:                Preprocessor flags. (line   18)
* 環境変数; CPPFLAGS <4>:                Linker flags.       (line   50)
* 環境変数; CXX:                         Compiler flags.     (line   12)
* 環境変数; DISPLAY:                     Tkinter モジュール. (line   25)
* 環境変数; EnableControlFlowGuard:      ビルド<43>.         (line   47)
* 環境変数; EXE_LDFLAGS:                 Linker flags.       (line   92)
* 環境変数; EXE_LDFLAGS <1>:             Linker flags.       (line  102)
* 環境変数; EXTRA_CFLAGS:                Compiler flags.     (line   48)
* 環境変数; HOME:                        os path<6>.         (line   15)
* 環境変数; HOME <1>:                    Python API の変更<6>.
                                                             (line  118)
* 環境変数; HOME <2>:                    Windows<48>.        (line   15)
* 環境変数; HOME <3>:                    Windows<48>.        (line   18)
* 環境変数; HOME <4>:                    os path --- 一般的なパス名操作.
                                                             (line  157)
* 環境変数; HOME <5>:                    os path --- 一般的なパス名操作.
                                                             (line  175)
* 環境変数; HOME <6>:                    Tkinter モジュール. (line   64)
* 環境変数; HOMEDRIVE:                   os path --- 一般的なパス名操作.
                                                             (line  164)
* 環境変数; HOMEPATH:                    os path --- 一般的なパス名操作.
                                                             (line  164)
* 環境変数; 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  359)
* 環境変数; LANG <4>:                    locale --- 国際化サービス.
                                                             (line  363)
* 環境変数; 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   64)
* 環境変数; LIBS:                        Linker flags.       (line   57)
* 環境変数; LINES:                       関数<6>.            (line  140)
* 環境変数; LINES <1>:                   関数<6>.            (line  595)
* 環境変数; LINES <2>:                   関数<6>.            (line  597)
* 環境変数; LINKCC:                      Linker flags.       (line    6)
* 環境変数; LOGNAME:                     プロセスのパラメーター.
                                                             (line  258)
* 環境変数; LOGNAME <1>:                 getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   78)
* 環境変数; 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<10>.          (line   14)
* 環境変数; PATH <5>:                    Windows<29>.        (line   55)
* 環境変数; PATH <6>:                    Windows<33>.        (line   14)
* 環境変数; PATH <7>:                    セキュリティ<43>.   (line   16)
* 環境変数; PATH <8>:                    セキュリティ<43>.   (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  125)
* 環境変数; 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  449)
* 環境変数; PATH <40>:                   ディレクトリとファイルの操作.
                                                             (line  454)
* 環境変数; PATH <41>:                   プロセス管理.       (line   45)
* 環境変数; PATH <42>:                   プロセス管理.       (line   87)
* 環境変数; PATH <43>:                   プロセス管理.       (line   90)
* 環境変数; PATH <44>:                   プロセス管理.       (line   93)
* 環境変数; PATH <45>:                   プロセス管理.       (line  565)
* 環境変数; PATH <46>:                   プロセス管理.       (line  653)
* 環境変数; PATH <47>:                   プロセス管理.       (line  655)
* 環境変数; PATH <48>:                   プロセス管理.       (line  657)
* 環境変数; 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>:                   Python の埋め込み<2>.
                                                             (line   26)
* 環境変数; PATH <57>:                   Python の埋め込み<2>.
                                                             (line   34)
* 環境変数; PATH <58>:                   Python のスクリプトを Unix で実行可能にするにはどうしますか？.
                                                             (line   20)
* 環境変数; PATH <59>:                   Python のスクリプトを Unix で実行可能にするにはどうしますか？.
                                                             (line   26)
* 環境変数; PATHEXT:                     その他の改善<2>.    (line   30)
* 環境変数; PATHEXT <1>:                 ライブラリ<140>.    (line  138)
* 環境変数; PATHEXT <2>:                 Installing without UI.
                                                             (line   78)
* 環境変数; PATHEXT <3>:                 Installing without UI.
                                                             (line   83)
* 環境変数; PATHEXT <4>:                 ディレクトリとファイルの操作.
                                                             (line  464)
* 環境変数; PIP_USER:                    Windows<50>.        (line  102)
* 環境変数; PROFILE_TASK:                ビルド<23>.         (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_EXE_LDFLAGS:         Linker flags.       (line   95)
* 環境変数; PY_CORE_EXE_LDFLAGS <1>:     Linker flags.       (line  107)
* 環境変数; PY_CORE_LDFLAGS:             Linker flags.       (line   86)
* 環境変数; PY_CORE_LDFLAGS <1>:         Linker flags.       (line   96)
* 環境変数; PY_CPPFLAGS:                 Preprocessor flags. (line   26)
* 環境変数; PY_LDFLAGS:                  Linker flags.       (line   76)
* 環境変数; PY_LDFLAGS_NODIST:           Linker flags.       (line   80)
* 環境変数; PY_STDMODULE_CFLAGS:         Compiler flags.     (line  112)
* 環境変数; PYLAUNCHER_ALLOW_INSTALL:    Windows<17>.        (line   24)
* 環境変数; PYLAUNCHER_ALLOW_INSTALL <1>: Windows<31>.       (line   15)
* 環境変数; PYTHON_BASIC_COMPLETER:      Default interactive shell.
                                                             (line    7)
* 環境変数; PYTHON_BASIC_COMPLETER <1>:  環境変数.           (line  579)
* 環境変数; PYTHON_BASIC_REPL:           Default interactive shell<2>.
                                                             (line    7)
* 環境変数; PYTHON_BASIC_REPL <1>:       改善された対話的インタープリタ.
                                                             (line   28)
* 環境変数; PYTHON_BASIC_REPL <2>:       ライブラリ<2>.      (line  103)
* 環境変数; PYTHON_BASIC_REPL <3>:       ライブラリ<51>.     (line   52)
* 環境変数; PYTHON_BASIC_REPL <4>:       ライブラリ<51>.     (line   55)
* 環境変数; PYTHON_BASIC_REPL <5>:       Core and Builtins<54>.
                                                             (line   13)
* 環境変数; PYTHON_BASIC_REPL <6>:       対話モード<2>.      (line   21)
* 環境変数; PYTHON_BASIC_REPL <7>:       環境変数.           (line  570)
* 環境変数; PYTHON_BASIC_REPL <8>:       使用例<2>.          (line   79)
* 環境変数; PYTHON_BASIC_REPL <9>:       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  562)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS: ライブラリ<29>.   (line  368)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <1>: その他のオプション.
                                                             (line  453)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <2>: 環境変数.     (line  618)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <3>: sys --- システム固有のパラメーターと関数.
                                                             (line  630)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <4>: Concurrent safety of Context Managers.
                                                             (line   41)
* 環境変数; PYTHON_CPU_COUNT:            os<4>.              (line   11)
* 環境変数; PYTHON_CPU_COUNT <1>:        その他のオプション. (line  413)
* 環境変数; PYTHON_CPU_COUNT <2>:        環境変数.           (line  538)
* 環境変数; PYTHON_CPU_COUNT <3>:        雑多なシステム情報. (line   45)
* 環境変数; PYTHON_CPU_COUNT <4>:        雑多なシステム情報. (line   66)
* 環境変数; PYTHON_CPU_COUNT <5>:        その他<5>.          (line   32)
* 環境変数; PYTHON_CPU_COUNT <6>:        PyConfig.           (line  521)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG: PEP 768 安全な外部デバッガインターフェース.
                                                             (line   39)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <1>: その他のオプション.
                                                             (line  404)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <2>: 環境変数.       (line  525)
* 環境変数; 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<65>.
                                                             (line  105)
* 環境変数; PYTHON_FROZEN_MODULES <2>:   その他のオプション. (line  372)
* 環境変数; PYTHON_FROZEN_MODULES <3>:   環境変数.           (line  548)
* 環境変数; PYTHON_FROZEN_MODULES <4>:   PyConfig.           (line  419)
* 環境変数; PYTHON_GIL:                  フリースレッドの CPython.
                                                             (line   23)
* 環境変数; PYTHON_GIL <1>:              フリースレッドの CPython.
                                                             (line   37)
* 環境変数; PYTHON_GIL <2>:              Core and Builtins<50>.
                                                             (line   50)
* 環境変数; PYTHON_GIL <3>:              その他のオプション. (line  435)
* 環境変数; PYTHON_GIL <4>:              環境変数.           (line  595)
* 環境変数; PYTHON_GIL <5>:              sys --- システム固有のパラメーターと関数.
                                                             (line  623)
* 環境変数; PYTHON_GIL <6>:              The global interpreter lock in free-threaded Python.
                                                             (line    7)
* 環境変数; PYTHON_GIL <7>:              用語集<2>.          (line  789)
* 環境変数; PYTHON_HISTORY:              その他の言語変更.   (line   57)
* 環境変数; PYTHON_HISTORY <1>:          ライブラリ<67>.     (line  544)
* 環境変数; PYTHON_HISTORY <2>:          環境変数.           (line  587)
* 環境変数; PYTHON_JIT:                  Binary releases for the experimental just-in-time compiler.
                                                             (line    8)
* 環境変数; PYTHON_JIT <1>:              環境変数.           (line  637)
* 環境変数; PYTHON_JIT <2>:              一般的なオプション. (line  264)
* 環境変数; PYTHON_JIT <3>:              一般的なオプション. (line  267)
* 環境変数; PYTHON_JIT <4>:              一般的なオプション. (line  272)
* 環境変数; PYTHON_JIT <5>:              sys --- システム固有のパラメーターと関数.
                                                             (line 1341)
* 環境変数; PYTHON_LAZY_IMPORTS:         PEP 810 Explicit lazy imports.
                                                             (line   55)
* 環境変数; PYTHON_LAZY_IMPORTS <1>:     その他のオプション. (line  477)
* 環境変数; PYTHON_LAZY_IMPORTS <2>:     環境変数.           (line  656)
* 環境変数; PYTHON_LAZY_IMPORTS <3>:     Compatibility via __lazy_modules__.
                                                             (line   43)
* 環境変数; 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_PATHCONFIG_WARNINGS:  Core and Builtins<4>.
                                                             (line   35)
* 環境変数; PYTHON_PATHCONFIG_WARNINGS <1>: その他のオプション.
                                                             (line  461)
* 環境変数; PYTHON_PATHCONFIG_WARNINGS <2>: 環境変数.        (line  628)
* 環境変数; PYTHON_PERF_JIT_SUPPORT:     その他の言語変更.   (line   52)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <1>: その他のオプション. (line  391)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <2>: 環境変数.           (line  512)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <3>: PyConfig.           (line  904)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <4>: How to work without frame pointers.
                                                             (line   14)
* 環境変数; PYTHON_PRESITE:              Core and Builtins<2>.
                                                             (line  143)
* 環境変数; PYTHON_PRESITE <1>:          その他のオプション. (line  425)
* 環境変数; PYTHON_PRESITE <2>:          デバッグモード変数. (line   25)
* 環境変数; PYTHON_PRESITE <3>:          PyConfig.           (line  799)
* 環境変数; PYTHON_PRESITE=package.module: Core and Builtins<65>.
                                                             (line  154)
* 環境変数; PYTHON_PYMALLOC_HUGEPAGES:   Build changes<2>.   (line   24)
* 環境変数; PYTHON_PYMALLOC_HUGEPAGES <1>: 環境変数.         (line  354)
* 環境変数; PYTHON_PYMALLOC_HUGEPAGES <2>: パフォーマンスに関するオプション.
                                                             (line  174)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT: Core and Builtins<31>.
                                                             (line  134)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <1>: その他のオプション.
                                                             (line  445)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <2>: 環境変数.     (line  607)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <3>: sys --- システム固有のパラメーターと関数.
                                                             (line  626)
* 環境変数; PYTHON_TLBC:                 その他のオプション. (line  469)
* 環境変数; PYTHON_TLBC <1>:             環境変数.           (line  645)
* 環境変数; PYTHONASYNCIODEBUG:          環境変数.           (line  287)
* 環境変数; 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  160)
* 環境変数; PYTHONBREAKPOINT <3>:        sys --- システム固有のパラメーターと関数.
                                                             (line  288)
* 環境変数; PYTHONBREAKPOINT <4>:        sys --- システム固有のパラメーターと関数.
                                                             (line  302)
* 環境変数; PYTHONBREAKPOINT <5>:        sys --- システム固有のパラメーターと関数.
                                                             (line  307)
* 環境変数; PYTHONCASEOK:                Python API の変更<5>.
                                                             (line   29)
* 環境変数; PYTHONCASEOK <1>:            PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み.
                                                             (line   17)
* 環境変数; PYTHONCASEOK <2>:            ライブラリ<158>.    (line  144)
* 環境変数; PYTHONCASEOK <3>:            環境変数.           (line  130)
* 環境変数; PYTHONCASEOK <4>:            組み込み関数.       (line 2284)
* 環境変数; PYTHONCOERCECLOCALE:         PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   12)
* 環境変数; PYTHONCOERCECLOCALE <1>:     環境変数.           (line  402)
* 環境変数; PYTHONCOERCECLOCALE <2>:     一般的なオプション. (line   89)
* 環境変数; PYTHONCOERCECLOCALE <3>:     Python UTF-8 Mode.  (line   59)
* 環境変数; PYTHONCOERCECLOCALE <4>:     Python Configuration.
                                                             (line   15)
* 環境変数; PYTHONDEBUG:                 その他のオプション. (line   44)
* 環境変数; PYTHONDEBUG <1>:             環境変数.           (line   93)
* 環境変数; PYTHONDEBUG <2>:             Python デバッグビルド.
                                                             (line   20)
* 環境変数; PYTHONDEBUG <3>:             グローバルな設定変数.
                                                             (line   38)
* 環境変数; PYTHONDEBUG <4>:             PyConfig.           (line  690)
* 環境変数; PYTHONDEVMODE:               Python Development Mode -X dev.
                                                             (line    6)
* 環境変数; PYTHONDEVMODE <1>:           その他のオプション. (line  331)
* 環境変数; PYTHONDEVMODE <2>:           環境変数.           (line  459)
* 環境変数; PYTHONDEVMODE <3>:           Python 開発モード.  (line   14)
* 環境変数; PYTHONDEVMODE <4>:           PyConfig.           (line  295)
* 環境変数; PYTHONDONTWRITEBYTECODE:     インタプリタの変更<2>.
                                                             (line   15)
* 環境変数; PYTHONDONTWRITEBYTECODE <1>: 新しいモジュールと改良されたモジュール<2>.
                                                             (line  636)
* 環境変数; PYTHONDONTWRITEBYTECODE <2>: その他のオプション. (line   25)
* 環境変数; PYTHONDONTWRITEBYTECODE <3>: 環境変数.           (line  136)
* 環境変数; PYTHONDONTWRITEBYTECODE <4>: sys --- システム固有のパラメーターと関数.
                                                             (line  373)
* 環境変数; PYTHONDONTWRITEBYTECODE <5>: グローバルな設定変数.
                                                             (line   52)
* 環境変数; PYTHONDONTWRITEBYTECODE <6>: PyConfig.           (line 1003)
* 環境変数; PYTHONDONTWRITEBYTECODE <7>: pyc ファイルを作るにはどうしますか？.
                                                             (line   19)
* 環境変数; PYTHONDUMPREFS:              デバッグビルドとリリースビルドのABI 共通化.
                                                             (line   15)
* 環境変数; PYTHONDUMPREFS <1>:          ビルド<60>.         (line   54)
* 環境変数; PYTHONDUMPREFS <2>:          デバッグモード変数. (line    6)
* 環境変数; PYTHONDUMPREFS <3>:          Debug options.      (line   22)
* 環境変数; PYTHONDUMPREFS <4>:          Debug options.      (line   24)
* 環境変数; PYTHONDUMPREFS <5>:          PyConfig.           (line  306)
* 環境変数; PYTHONDUMPREFSFILE:          Core and Builtins<116>.
                                                             (line   16)
* 環境変数; PYTHONDUMPREFSFILE <1>:      デバッグモード変数. (line   14)
* 環境変数; PYTHONDUMPREFSFILE <2>:      PyConfig.           (line  318)
* 環境変数; PYTHONEXECUTABLE:            環境変数.           (line  220)
* 環境変数; PYTHONEXECUTABLE <1>:        PyConfig.           (line  725)
* 環境変数; PYTHONFAULTHANDLER:          faulthandler<6>.    (line   12)
* 環境変数; PYTHONFAULTHANDLER <1>:      その他のオプション. (line  283)
* 環境変数; PYTHONFAULTHANDLER <2>:      環境変数.           (line  251)
* 環境変数; PYTHONFAULTHANDLER <3>:      Python 開発モードの影響.
                                                             (line   59)
* 環境変数; PYTHONFAULTHANDLER <4>:      faulthandler --- Python トレースバックをダンプする.
                                                             (line   15)
* 環境変数; PYTHONFAULTHANDLER <5>:      PyConfig.           (line  355)
* 環境変数; PYTHONHASHSEED:              組み込みの関数と型. (line   18)
* 環境変数; PYTHONHASHSEED <1>:          Python コードの移植.
                                                             (line    7)
* 環境変数; PYTHONHASHSEED <2>:          Core and Builtins<173>.
                                                             (line   30)
* 環境変数; PYTHONHASHSEED <3>:          その他のオプション. (line  137)
* 環境変数; PYTHONHASHSEED <4>:          その他のオプション. (line  154)
* 環境変数; PYTHONHASHSEED <5>:          環境変数.           (line  151)
* 環境変数; PYTHONHASHSEED <6>:          環境変数.           (line  156)
* 環境変数; PYTHONHASHSEED <7>:          基本的なカスタマイズ.
                                                             (line  310)
* 環境変数; PYTHONHASHSEED <8>:          グローバルな設定変数.
                                                             (line   75)
* 環境変数; PYTHONHASHSEED <9>:          グローバルな設定変数.
                                                             (line   78)
* 環境変数; PYTHONHASHSEED <10>:         PyConfig.           (line  435)
* 環境変数; PYTHONHOME:                  Removed C APIs<2>.  (line   68)
* 環境変数; PYTHONHOME <1>:              Pending removal in Python 3 15<2>.
                                                             (line   51)
* 環境変数; PYTHONHOME <2>:              Deprecated C APIs<4>.
                                                             (line   22)
* 環境変数; PYTHONHOME <3>:              Pending removal in Python 3 15<4>.
                                                             (line   51)
* 環境変数; PYTHONHOME <4>:              Pending removal in Python 3 15<6>.
                                                             (line   51)
* 環境変数; PYTHONHOME <5>:              概要 -- リリースハイライト<9>.
                                                             (line  106)
* 環境変数; PYTHONHOME <6>:              その他のオプション. (line   53)
* 環境変数; PYTHONHOME <7>:              環境変数.           (line   10)
* 環境変数; PYTHONHOME <8>:              環境変数.           (line   18)
* 環境変数; PYTHONHOME <9>:              環境変数.           (line   20)
* 環境変数; PYTHONHOME <10>:             環境変数.           (line   37)
* 環境変数; PYTHONHOME <11>:             モジュールの検索.   (line   28)
* 環境変数; PYTHONHOME <12>:             モジュールの検索.   (line   43)
* 環境変数; PYTHONHOME <13>:             モジュールの検索.   (line   78)
* 環境変数; PYTHONHOME <14>:             iOS プロジェクトに Python を追加する.
                                                             (line   91)
* 環境変数; PYTHONHOME <15>:             test support script_helper --- Utilities for the Python execution tests.
                                                             (line   25)
* 環境変数; PYTHONHOME <16>:             sys path モジュール検索パスの初期化.
                                                             (line   30)
* 環境変数; PYTHONHOME <17>:             sys path モジュール検索パスの初期化.
                                                             (line   56)
* 環境変数; PYTHONHOME <18>:             Virtual Environments.
                                                             (line   19)
* 環境変数; PYTHONHOME <19>:             Python の埋め込み<2>.
                                                             (line   34)
* 環境変数; PYTHONHOME <20>:             Python の埋め込み<2>.
                                                             (line   41)
* 環境変数; PYTHONHOME <21>:             グローバルな設定変数.
                                                             (line   90)
* 環境変数; PYTHONHOME <22>:             プロセスワイドのパラメータ.
                                                             (line  166)
* 環境変数; PYTHONHOME <23>:             PyConfig.           (line  443)
* 環境変数; PYTHONHOME <24>:             PyConfig.           (line  445)
* 環境変数; PYTHONHOME <25>:             Pending removal in Python 3 15<8>.
                                                             (line   51)
* 環境変数; PYTHONINSPECT:               その他の変更と修正<2>.
                                                             (line   13)
* 環境変数; PYTHONINSPECT <1>:           Core and Builtins<6>.
                                                             (line   77)
* 環境変数; PYTHONINSPECT <2>:           その他のオプション. (line   75)
* 環境変数; PYTHONINSPECT <3>:           環境変数.           (line  102)
* 環境変数; PYTHONINSPECT <4>:           グローバルな設定変数.
                                                             (line  107)
* 環境変数; PYTHONINSPECT <5>:           PyConfig.           (line  474)
* 環境変数; PYTHONINTMAXSTRDIGITS:       Core and Builtins<82>.
                                                             (line   74)
* 環境変数; PYTHONINTMAXSTRDIGITS <1>:   その他のオプション. (line  305)
* 環境変数; PYTHONINTMAXSTRDIGITS <2>:   環境変数.           (line  168)
* 環境変数; PYTHONINTMAXSTRDIGITS <3>:   上限値を設定する.   (line    9)
* 環境変数; PYTHONINTMAXSTRDIGITS <4>:   上限値を設定する.   (line   16)
* 環境変数; PYTHONINTMAXSTRDIGITS <5>:   sys --- システム固有のパラメーターと関数.
                                                             (line 1260)
* 環境変数; PYTHONINTMAXSTRDIGITS <6>:   PyConfig.           (line  505)
* 環境変数; PYTHONIOENCODING:            その他の改善<2>.    (line   75)
* 環境変数; PYTHONIOENCODING <1>:        インタプリタの変更<2>.
                                                             (line   22)
* 環境変数; PYTHONIOENCODING <2>:        環境変数.           (line  176)
* 環境変数; PYTHONIOENCODING <3>:        環境変数.           (line  439)
* 環境変数; PYTHONIOENCODING <4>:        Python UTF-8 Mode.  (line   33)
* 環境変数; PYTHONIOENCODING <5>:        sys --- システム固有のパラメーターと関数.
                                                             (line 2096)
* 環境変数; PYTHONIOENCODING <6>:        PyConfig.           (line  858)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING: sys.              (line    7)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <1>: Pending removal in Python 3 16.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <2>: Pending removal in Python 3 16<2>.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <3>: New Deprecations.
                                                             (line  131)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <4>: Pending removal in Python 3 16<4>.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <5>: Pending removal in Python 3 16<6>.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <6>: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更.
                                                             (line   18)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <7>: Windows<19>.  (line   37)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <8>: 環境変数.     (line  378)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <9>: グローバルな設定変数.
                                                             (line  149)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <10>: PyPreConfig. (line  123)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <11>: Pending removal in Python 3 16<8>.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO:    PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更.
                                                             (line   12)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <1>: 環境変数.          (line  190)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <2>: 環境変数.          (line  389)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <3>: sys --- システム固有のパラメーターと関数.
                                                             (line 2100)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <4>: グローバルな設定変数.
                                                             (line  167)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <5>: PyConfig.          (line  558)
* 環境変数; PYTHONMALLOC:                PYTHONMALLOC 環境変数.
                                                             (line    6)
* 環境変数; PYTHONMALLOC <1>:            C API の変更<13>.   (line    9)
* 環境変数; PYTHONMALLOC <2>:            Core and Builtins<193>.
                                                             (line   90)
* 環境変数; PYTHONMALLOC <3>:            環境変数.           (line  294)
* 環境変数; PYTHONMALLOC <4>:            環境変数.           (line  345)
* 環境変数; PYTHONMALLOC <5>:            パフォーマンスに関するオプション.
                                                             (line  156)
* 環境変数; PYTHONMALLOC <6>:            パフォーマンスに関するオプション.
                                                             (line  163)
* 環境変数; PYTHONMALLOC <7>:            Python 開発モードの影響.
                                                             (line   46)
* 環境変数; PYTHONMALLOC <8>:            Python 開発モードの影響.
                                                             (line   50)
* 環境変数; PYTHONMALLOC <9>:            概要<4>.            (line   75)
* 環境変数; PYTHONMALLOC <10>:           Default Memory Allocators.
                                                             (line   32)
* 環境変数; PYTHONMALLOC <11>:           Debug hooks on the Python memory allocators.
                                                             (line   11)
* 環境変数; PYTHONMALLOC <12>:           pymalloc アロケータ.
                                                             (line   31)
* 環境変数; PYTHONMALLOC <13>:           The mimalloc allocator.
                                                             (line   24)
* 環境変数; PYTHONMALLOCSTATS:           Core and Builtins<193>.
                                                             (line   96)
* 環境変数; PYTHONMALLOCSTATS <1>:       環境変数.           (line  338)
* 環境変数; PYTHONMALLOCSTATS <2>:       PyConfig.           (line  574)
* 環境変数; PYTHONMALLOCSTATS <3>:       概要<4>.            (line   78)
* 環境変数; PYTHONNODEBUGRANGES:         PEP 657 トレースバックのエラー位置の詳細化.
                                                             (line   61)
* 環境変数; PYTHONNODEBUGRANGES <1>:     その他のオプション. (line  360)
* 環境変数; PYTHONNODEBUGRANGES <2>:     環境変数.           (line  489)
* 環境変数; PYTHONNODEBUGRANGES <3>:     Methods on code objects.
                                                             (line   40)
* 環境変数; PYTHONNODEBUGRANGES <4>:     PyConfig.           (line  248)
* 環境変数; PYTHONNOUSERSITE:            PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   30)
* 環境変数; PYTHONNOUSERSITE <1>:        その他のオプション. (line  166)
* 環境変数; PYTHONNOUSERSITE <2>:        環境変数.           (line  194)
* 環境変数; PYTHONNOUSERSITE <3>:        環境変数.           (line  212)
* 環境変数; PYTHONNOUSERSITE <4>:        モジュールの内容<7>.
                                                             (line   15)
* 環境変数; PYTHONNOUSERSITE <5>:        sys path モジュール検索パスの初期化.
                                                             (line   66)
* 環境変数; PYTHONNOUSERSITE <6>:        グローバルな設定変数.
                                                             (line  200)
* 環境変数; PYTHONNOUSERSITE <7>:        PyConfig.           (line  956)
* 環境変数; PYTHONOPTIMIZE:              その他のオプション. (line   95)
* 環境変数; PYTHONOPTIMIZE <1>:          環境変数.           (line   74)
* 環境変数; PYTHONOPTIMIZE <2>:          グローバルな設定変数.
                                                             (line  211)
* 環境変数; PYTHONOPTIMIZE <3>:          PyConfig.           (line  642)
* 環境変数; 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   52)
* 環境変数; 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 1495)
* 環境変数; PYTHONPATH <19>:             sys --- システム固有のパラメーターと関数.
                                                             (line 1501)
* 環境変数; 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  607)
* 環境変数; PYTHONPERFSUPPORT:           その他の言語変更<2>.
                                                             (line   84)
* 環境変数; PYTHONPERFSUPPORT <1>:       その他のオプション. (line  380)
* 環境変数; PYTHONPERFSUPPORT <2>:       環境変数.           (line  500)
* 環境変数; PYTHONPERFSUPPORT <3>:       PyConfig.           (line  900)
* 環境変数; PYTHONPERFSUPPORT <4>:       How to enable perf profiling support.
                                                             (line    7)
* 環境変数; PYTHONPLATLIBDIR:            Core and Builtins<152>.
                                                             (line   47)
* 環境変数; PYTHONPLATLIBDIR <1>:        環境変数.           (line   54)
* 環境変数; PYTHONPLATLIBDIR <2>:        sys path モジュール検索パスの初期化.
                                                             (line   51)
* 環境変数; PYTHONPLATLIBDIR <3>:        PyConfig.           (line  586)
* 環境変数; PYTHONPROFILEIMPORTTIME:     その他の言語変更<7>.
                                                             (line   47)
* 環境変数; PYTHONPROFILEIMPORTTIME <1>: Core and Builtins<175>.
                                                             (line   66)
* 環境変数; PYTHONPROFILEIMPORTTIME <2>: その他のオプション. (line  321)
* 環境変数; PYTHONPROFILEIMPORTTIME <3>: 環境変数.           (line  275)
* 環境変数; PYTHONPROFILEIMPORTTIME <4>: PyConfig.           (line  457)
* 環境変数; PYTHONPYCACHEPREFIX:         コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム.
                                                             (line    8)
* 環境変数; PYTHONPYCACHEPREFIX <1>:     Core and Builtins<166>.
                                                             (line  402)
* 環境変数; PYTHONPYCACHEPREFIX <2>:     その他のオプション. (line  344)
* 環境変数; PYTHONPYCACHEPREFIX <3>:     環境変数.           (line  142)
* 環境変数; PYTHONPYCACHEPREFIX <4>:     sys --- システム固有のパラメーターと関数.
                                                             (line  420)
* 環境変数; PYTHONPYCACHEPREFIX <5>:     PyConfig.           (line  747)
* 環境変数; PYTHONREGRTEST_UNICODE_GUARD: テスト<33>.        (line   13)
* 環境変数; PYTHONSAFEPATH:              概要 -- リリースハイライト<4>.
                                                             (line   27)
* 環境変数; PYTHONSAFEPATH <1>:          その他の言語変更<3>.
                                                             (line   37)
* 環境変数; PYTHONSAFEPATH <2>:          セキュリティ<27>.   (line    6)
* 環境変数; PYTHONSAFEPATH <3>:          その他のオプション. (line  123)
* 環境変数; PYTHONSAFEPATH <4>:          環境変数.           (line   46)
* 環境変数; PYTHONSAFEPATH <5>:          sys --- システム固有のパラメーターと関数.
                                                             (line 1513)
* 環境変数; PYTHONSAFEPATH <6>:          セキュリティで考慮すべき点<6>.
                                                             (line   47)
* 環境変数; PYTHONSAFEPATH <7>:          PyConfig.           (line  161)
* 環境変数; PYTHONSTARTUP:               Default interactive shell<2>.
                                                             (line   15)
* 環境変数; PYTHONSTARTUP <1>:           sys<14>.            (line   16)
* 環境変数; PYTHONSTARTUP <2>:           sys<14>.            (line   21)
* 環境変数; PYTHONSTARTUP <3>:           ライブラリ<2>.      (line  404)
* 環境変数; PYTHONSTARTUP <4>:           ライブラリ<6>.      (line  148)
* 環境変数; PYTHONSTARTUP <5>:           Core and Builtins<19>.
                                                             (line   33)
* 環境変数; 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   71)
* 環境変数; 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 1272)
* 環境変数; PYTHONSTARTUP <18>:          readline の設定.    (line   12)
* 環境変数; PYTHONTRACEMALLOC:           その他のオプション. (line  300)
* 環境変数; PYTHONTRACEMALLOC <1>:       環境変数.           (line  262)
* 環境変数; PYTHONTRACEMALLOC <2>:       tracemalloc --- メモリ割り当ての追跡.
                                                             (line   23)
* 環境変数; PYTHONTRACEMALLOC <3>:       tracemalloc --- メモリ割り当ての追跡.
                                                             (line   30)
* 環境変数; PYTHONTRACEMALLOC <4>:       関数<11>.           (line   90)
* 環境変数; PYTHONTRACEMALLOC <5>:       PyConfig.           (line  886)
* 環境変数; PYTHONTZPATH:                Environment configuration.
                                                             (line   11)
* 環境変数; PYTHONTZPATH <1>:            例外と警告.         (line   14)
* 環境変数; PYTHONUNBUFFERED:            Core and Builtins<159>.
                                                             (line  107)
* 環境変数; PYTHONUNBUFFERED <1>:        その他のオプション. (line  185)
* 環境変数; PYTHONUNBUFFERED <2>:        環境変数.           (line  119)
* 環境変数; PYTHONUNBUFFERED <3>:        sys --- システム固有のパラメーターと関数.
                                                             (line 2107)
* 環境変数; PYTHONUNBUFFERED <4>:        グローバルな設定変数.
                                                             (line  239)
* 環境変数; PYTHONUNBUFFERED <5>:        PyConfig.           (line  208)
* 環境変数; PYTHONUOPS:                  Core and Builtins<66>.
                                                             (line   27)
* 環境変数; PYTHONUOPS <1>:              Core and Builtins<66>.
                                                             (line  179)
* 環境変数; PYTHONUOPS <2>:              Core and Builtins<66>.
                                                             (line  258)
* 環境変数; PYTHONUOPS <3>:              Core and Builtins<66>.
                                                             (line  317)
* 環境変数; PYTHONUOPS <4>:              Core and Builtins<66>.
                                                             (line  381)
* 環境変数; PYTHONUSERBASE:              PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   23)
* 環境変数; PYTHONUSERBASE <1>:          環境変数.           (line  205)
* 環境変数; PYTHONUSERBASE <2>:          モジュールの内容<7>.
                                                             (line   41)
* 環境変数; PYTHONUSERBASE <3>:          モジュールの内容<7>.
                                                             (line   83)
* 環境変数; PYTHONUSERBASE <4>:          sys path モジュール検索パスの初期化.
                                                             (line   64)
* 環境変数; PYTHONUSERSITE:              test support script_helper --- Utilities for the Python execution tests.
                                                             (line   26)
* 環境変数; PYTHONUTF8:                  Other language changes<2>.
                                                             (line   22)
* 環境変数; PYTHONUTF8 <1>:              PEP 540 強制 UTF-8 実行モード.
                                                             (line    6)
* 環境変数; PYTHONUTF8 <2>:              その他のオプション. (line  338)
* 環境変数; PYTHONUTF8 <3>:              環境変数.           (line  449)
* 環境変数; PYTHONUTF8 <4>:              環境変数.           (line  468)
* 環境変数; PYTHONUTF8 <5>:              UTF-8 モード.       (line   24)
* 環境変数; PYTHONUTF8 <6>:              Python UTF-8 Mode.  (line    9)
* 環境変数; PYTHONUTF8 <7>:              Python UTF-8 Mode.  (line   52)
* 環境変数; PYTHONUTF8 <8>:              sys --- システム固有のパラメーターと関数.
                                                             (line 2098)
* 環境変数; PYTHONUTF8 <9>:              PyPreConfig.        (line  152)
* 環境変数; PYTHONUTF8 <10>:             Python Configuration.
                                                             (line   14)
* 環境変数; PYTHONVERBOSE:               その他のオプション. (line  201)
* 環境変数; PYTHONVERBOSE <1>:           環境変数.           (line  124)
* 環境変数; PYTHONVERBOSE <2>:           グローバルな設定変数.
                                                             (line  256)
* 環境変数; PYTHONVERBOSE <3>:           PyConfig.           (line  973)
* 環境変数; PYTHONWARNDEFAULTENCODING:   Optional EncodingWarning and encoding="locale" option.
                                                             (line   19)
* 環境変数; PYTHONWARNDEFAULTENCODING <1>: ライブラリ<126>.  (line   45)
* 環境変数; PYTHONWARNDEFAULTENCODING <2>: その他のオプション.
                                                             (line  350)
* 環境変数; PYTHONWARNDEFAULTENCODING <3>: 環境変数.         (line  479)
* 環境変数; PYTHONWARNDEFAULTENCODING <4>: Opt-in EncodingWarning.
                                                             (line    9)
* 環境変数; PYTHONWARNINGS:              Other language changes<2>.
                                                             (line   58)
* 環境変数; PYTHONWARNINGS <1>:          warnings<4>.        (line   21)
* 環境変数; PYTHONWARNINGS <2>:          その他の言語変更<12>.
                                                             (line  157)
* 環境変数; PYTHONWARNINGS <3>:          Deprecation Warnings の扱いの変更.
                                                             (line   23)
* 環境変数; PYTHONWARNINGS <4>:          インタプリタの変更. (line    6)
* 環境変数; PYTHONWARNINGS <5>:          ライブラリ<15>.     (line  285)
* 環境変数; PYTHONWARNINGS <6>:          ドキュメント<28>.   (line   67)
* 環境変数; PYTHONWARNINGS <7>:          その他のオプション. (line  261)
* 環境変数; PYTHONWARNINGS <8>:          環境変数.           (line  226)
* 環境変数; PYTHONWARNINGS <9>:          Python 開発モードの影響.
                                                             (line   30)
* 環境変数; PYTHONWARNINGS <10>:         警告フィルタ.       (line   49)
* 環境変数; PYTHONWARNINGS <11>:         警告フィルタ.       (line   60)
* 環境変数; PYTHONWARNINGS <12>:         Describing Warning Filters.
                                                             (line    7)
* 環境変数; PYTHONWARNINGS <13>:         Describing Warning Filters.
                                                             (line   21)
* 環境変数; PYTHONWARNINGS <14>:         デフォルトの警告フィルタ.
                                                             (line    7)
* 環境変数; PYTHONWARNINGS <15>:         PyConfig.           (line  992)
* 環境変数; SOURCE_DATE_EPOCH:           zipfile.            (line   11)
* 環境変数; SOURCE_DATE_EPOCH <1>:       py_compile<3>.      (line    7)
* 環境変数; SOURCE_DATE_EPOCH <2>:       ライブラリ<167>.    (line  451)
* 環境変数; SOURCE_DATE_EPOCH <3>:       ビルド<68>.         (line   15)
* 環境変数; SOURCE_DATE_EPOCH <4>:       ZipFile objects.    (line  347)
* 環境変数; 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>:       コマンドラインでの使用<10>.
                                                             (line   94)
* 環境変数; SSLKEYLOGFILE:               コンテキストの作成. (line   34)
* 環境変数; SSLKEYLOGFILE <1>:           コンテキストの作成. (line   83)
* 環境変数; TEMP:                        tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  327)
* 環境変数; TERM:                        関数<6>.            (line  488)
* 環境変数; TERM <1>:                    関数<6>.            (line  513)
* 環境変数; TMP:                         tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  329)
* 環境変数; TMPDIR:                      ライブラリ<15>.     (line 1028)
* 環境変数; TMPDIR <1>:                  テスト<32>.         (line   68)
* 環境変数; TMPDIR <2>:                  tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  325)
* 環境変数; TZ:                          関数<5>.            (line  651)
* 環境変数; TZ <1>:                      関数<5>.            (line  652)
* 環境変数; TZ <2>:                      関数<5>.            (line  660)
* 環境変数; TZ <3>:                      関数<5>.            (line  664)
* 環境変数; TZ <4>:                      関数<5>.            (line  666)
* 環境変数; TZ <5>:                      関数<5>.            (line  729)
* 環境変数; USER:                        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   78)
* 環境変数; USERNAME:                    os path --- 一般的なパス名操作.
                                                             (line  166)
* 環境変数; USERNAME <1>:                プロセスのパラメーター.
                                                             (line  259)
* 環境変数; USERNAME <2>:                getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   78)
* 環境変数; USERPROFILE:                 os path<6>.         (line   14)
* 環境変数; USERPROFILE <1>:             Python API の変更<6>.
                                                             (line  117)
* 環境変数; USERPROFILE <2>:             Windows<48>.        (line   15)
* 環境変数; USERPROFILE <3>:             os path --- 一般的なパス名操作.
                                                             (line  163)
* 環境変数;削除:                         プロセスのパラメーター.
                                                             (line  608)
* 環境変数;設定:                         プロセスのパラメーター.
                                                             (line  372)
* 監査イベント:                          Debugging and profiling.
                                                             (line   11)
* 直列化;オブジェクト:                   pickle --- Python オブジェクトの直列化.
                                                             (line    8)
* 真理値;value:                          真理値判定.         (line    6)
* 空の;list:                             リスト表示.         (line    6)
* 空の;tuple:                            変更不能なシーケンス immutable sequence.
                                                             (line   35)
* 空の;tuple <1>:                        丸括弧形式 parenthesized form.
                                                             (line   14)
* 空白:                                  インデント.         (line    6)
* 空白;in printf-style formatting:       printf 形式の文字列書式化.
                                                             (line   68)
* 空白;in printf-style formatting <1>:   printf 形式での bytes の書式化.
                                                             (line   61)
* 空白;文字列のフォーマットで:           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   16)
* 組み込み関数;abs:                      数値型をエミュレートする.
                                                             (line  118)
* 組み込み関数;abs <1>:                  数値型プロトコル number protocol.
                                                             (line   92)
* 組み込み関数;ascii:                    オブジェクトプロトコル object protocol.
                                                             (line  389)
* 組み込み関数;bytes:                    基本的なカスタマイズ.
                                                             (line  144)
* 組み込み関数;bytes <1>:                オブジェクトプロトコル object protocol.
                                                             (line  413)
* 組み込み関数;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   81)
* 組み込み関数;eval <4>:                 PrettyPrinter objects.
                                                             (line   91)
* 組み込み関数;exec:                     global 文.          (line   23)
* 組み込み関数;exec <1>:                 組み込み関数.       (line  637)
* 組み込み関数;exec <2>:                 コードオブジェクト<2>.
                                                             (line   17)
* 組み込み関数;hash:                     基本的なカスタマイズ.
                                                             (line  236)
* 組み込み関数;hash <1>:                 イミュータブルなシーケンス型.
                                                             (line    6)
* 組み込み関数;hash <2>:                 オブジェクトプロトコル object protocol.
                                                             (line  468)
* 組み込み関数;hash <3>:                 PyTypeObject スロット.
                                                             (line  460)
* 組み込み関数;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 frozendict.
                                                             (line    6)
* 組み込み関数;len <6>:                  オブジェクトプロトコル object protocol.
                                                             (line  513)
* 組み込み関数;len <7>:                  シーケンス型プロトコル sequence protocol.
                                                             (line   16)
* 組み込み関数;len <8>:                  マップ型プロトコル mapping protocol.
                                                             (line   19)
* 組み込み関数;len <9>:                  リストオブジェクト. (line   42)
* 組み込み関数;len <10>:                 Dictionary objects. (line  349)
* 組み込み関数;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  376)
* 組み込み関数;repr <3>:                 PyTypeObject スロット.
                                                             (line  394)
* 組み込み関数;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  495)
* 組み込み関数;クラスメソッド:           Implementing functions and methods.
                                                             (line  196)
* 組み込み関数;コンパイル:               global 文.          (line   23)
* 組み込み関数;コンパイル <1>:           コードオブジェクト<2>.
                                                             (line    6)
* 組み込み関数;コンパイル <2>:           標準的なインタプリタ型.
                                                             (line   57)
* 組み込み関数;コンパイル <3>:           モジュールのインポート<2>.
                                                             (line  115)
* 組み込み関数;浮動小数点数:             数値型をエミュレートする.
                                                             (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  204)
* 結合;演算:                             共通のシーケンス演算.
                                                             (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  666)
* 関数;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: Top348
Ref: contents doc551
Ref: 13e551
Node: What's New in Python321890
Ref: whatsnew/index doc321999
Ref: 13f321999
Ref: whatsnew/index python-documentation-contents321999
Ref: 140321999
Ref: whatsnew/index what-s-new-in-python321999
Ref: 141321999
Ref: whatsnew/index whatsnew-index321999
Ref: 142321999
Node: What's new in Python 3 16323703
Ref: whatsnew/3 16 doc323819
Ref: 143323819
Ref: whatsnew/3 16 what-s-new-in-python-3-16323819
Ref: 144323819
Node: Summary --- release highlights324547
Ref: whatsnew/3 16 summary-release-highlights324660
Ref: 146324660
Node: New features324733
Ref: whatsnew/3 16 new-features324877
Ref: 147324877
Node: Other language changes324916
Ref: whatsnew/3 16 other-language-changes325041
Ref: 148325041
Node: New modules325100
Ref: whatsnew/3 16 new-modules325229
Ref: 149325229
Node: Improved modules325282
Ref: whatsnew/3 16 improved-modules325402
Ref: 14a325402
Node: os325466
Ref: whatsnew/3 16 os325521
Ref: 14b325521
Ref: os-Footnote-1325787
Node: Optimizations325843
Ref: whatsnew/3 16 optimizations325959
Ref: 14d325959
Node: module_name326026
Ref: whatsnew/3 16 module-name326087
Ref: 14e326087
Node: Removed326139
Ref: whatsnew/3 16 removed326249
Ref: 14f326249
Node: annotationlib326416
Ref: whatsnew/3 16 annotationlib326489
Ref: 150326489
Node: asyncio326761
Ref: whatsnew/3 16 asyncio326852
Ref: 153326852
Node: functools327042
Ref: whatsnew/3 16 functools327127
Ref: 155327127
Node: logging327338
Ref: whatsnew/3 16 logging327425
Ref: 157327425
Node: mimetypes327644
Ref: whatsnew/3 16 mimetypes327728
Ref: 158327728
Node: shutil327932
Ref: whatsnew/3 16 shutil328017
Ref: 15b328017
Ref: shutil-Footnote-1328295
Node: symtable328351
Ref: whatsnew/3 16 symtable328430
Ref: 15c328430
Node: sys328567
Ref: whatsnew/3 16 sys328649
Ref: 15d328649
Ref: sys-Footnote-1328956
Node: sysconfig329012
Ref: whatsnew/3 16 sysconfig329093
Ref: 15f329093
Ref: sysconfig-Footnote-1329407
Node: tarfile329463
Ref: whatsnew/3 16 tarfile329532
Ref: 161329532
Node: Deprecated329685
Ref: whatsnew/3 16 deprecated329804
Ref: 162329804
Node: Porting to Python 3 16330526
Ref: whatsnew/3 16 porting-to-python-3-16330651
Ref: 163330651
Node: Build changes330817
Ref: whatsnew/3 16 build-changes330945
Ref: 164330945
Ref: Build changes-Footnote-1331568
Ref: Build changes-Footnote-2331612
Node: C API changes331668
Ref: whatsnew/3 16 c-api-changes331765
Ref: 165331765
Node: New features<2>331945
Ref: whatsnew/3 16 id1332044
Ref: 166332044
Node: Porting to Python 3 16<2>332100
Ref: whatsnew/3 16 id2332225
Ref: 167332225
Node: Deprecated C APIs332301
Ref: whatsnew/3 16 deprecated-c-apis332425
Ref: 168332425
Node: Removed C APIs332491
Ref: whatsnew/3 16 removed-c-apis332581
Ref: 169332581
Node: What's new in Python 3 15332630
Ref: whatsnew/3 15 doc332780
Ref: 16a332780
Ref: whatsnew/3 15 translation-repo332780
Ref: 16b332780
Ref: whatsnew/3 15 what-s-new-in-python-3-15332780
Ref: 16c332780
Node: Summary -- Release highlights333704
Ref: whatsnew/3 15 summary-release-highlights333819
Ref: 16d333819
Ref: Summary -- Release highlights-Footnote-1335336
Ref: Summary -- Release highlights-Footnote-2335378
Ref: Summary -- Release highlights-Footnote-3335420
Ref: Summary -- Release highlights-Footnote-4335462
Ref: Summary -- Release highlights-Footnote-5335504
Ref: Summary -- Release highlights-Footnote-6335546
Ref: Summary -- Release highlights-Footnote-7335588
Ref: Summary -- Release highlights-Footnote-8335630
Ref: Summary -- Release highlights-Footnote-9335672
Ref: Summary -- Release highlights-Footnote-10335714
Ref: Summary -- Release highlights-Footnote-11335757
Ref: Summary -- Release highlights-Footnote-12335800
Ref: Summary -- Release highlights-Footnote-13335843
Ref: Summary -- Release highlights-Footnote-14335886
Ref: Summary -- Release highlights-Footnote-15335929
Ref: Summary -- Release highlights-Footnote-16335972
Ref: Summary -- Release highlights-Footnote-17336015
Node: New features<3>336058
Ref: whatsnew/3 15 new-features336207
Ref: 180336207
Node: PEP 810 Explicit lazy imports337172
Ref: whatsnew/3 15 pep-810-explicit-lazy-imports337298
Ref: 181337298
Ref: whatsnew/3 15 whatsnew315-lazy-imports337298
Ref: 16e337298
Ref: PEP 810 Explicit lazy imports-Footnote-1342371
Ref: PEP 810 Explicit lazy imports-Footnote-2342413
Node: PEP 814 Add frozendict built-in type342469
Ref: whatsnew/3 15 pep-814-add-frozendict-built-in-type342638
Ref: 18b342638
Ref: whatsnew/3 15 whatsnew315-frozendict342638
Ref: 16f342638
Ref: PEP 814 Add frozendict built-in type-Footnote-1344442
Ref: PEP 814 Add frozendict built-in type-Footnote-2344484
Node: PEP 661 Add sentinel built-in type344540
Ref: whatsnew/3 15 pep-661-add-sentinel-built-in-type344717
Ref: 195344717
Ref: whatsnew/3 15 whatsnew315-sentinel344717
Ref: 170344717
Ref: PEP 661 Add sentinel built-in type-Footnote-1345221
Ref: PEP 661 Add sentinel built-in type-Footnote-2345277
Node: PEP 799 A dedicated profiling package345319
Ref: whatsnew/3 15 pep-799-a-dedicated-profiling-package345512
Ref: 197345512
Ref: whatsnew/3 15 whatsnew315-profiling-package345512
Ref: 171345512
Ref: PEP 799 A dedicated profiling package-Footnote-1346227
Ref: PEP 799 A dedicated profiling package-Footnote-2346269
Node: Tachyon High frequency statistical sampling profiler346325
Ref: whatsnew/3 15 tachyon-high-frequency-statistical-sampling-profiler346525
Ref: 198346525
Ref: whatsnew/3 15 whatsnew315-sampling-profiler346525
Ref: 172346525
Ref: Tachyon High frequency statistical sampling profiler-Footnote-1352200
Ref: Tachyon High frequency statistical sampling profiler-Footnote-2352237
Ref: Tachyon High frequency statistical sampling profiler-Footnote-3352293
Node: PEP 831 Frame pointers enabled by default352349
Ref: whatsnew/3 15 pep-831-frame-pointers-enabled-by-default352547
Ref: 199352547
Ref: whatsnew/3 15 whatsnew315-frame-pointers352547
Ref: 173352547
Ref: PEP 831 Frame pointers enabled by default-Footnote-1353986
Ref: PEP 831 Frame pointers enabled by default-Footnote-2354042
Node: PEP 798 Unpacking in comprehensions354084
Ref: whatsnew/3 15 pep-798-unpacking-in-comprehensions354273
Ref: 19a354273
Ref: whatsnew/3 15 whatsnew315-unpacking-in-comprehensions354273
Ref: 174354273
Ref: PEP 798 Unpacking in comprehensions-Footnote-1355742
Ref: PEP 798 Unpacking in comprehensions-Footnote-2355784
Ref: PEP 798 Unpacking in comprehensions-Footnote-3355826
Node: PEP 829 Package startup configuration files355882
Ref: whatsnew/3 15 pep-829-package-startup-configuration-files356076
Ref: 19d356076
Ref: whatsnew/3 15 whatsnew315-startup-files356076
Ref: 176356076
Ref: PEP 829 Package startup configuration files-Footnote-1357158
Node: PEP 803 -- Stable ABI for free-threaded builds357214
Ref: whatsnew/3 15 pep-803-stable-abi-for-free-threaded-builds357431
Ref: 1a1357431
Ref: whatsnew/3 15 whatsnew315-abi3t357431
Ref: 17a357431
Ref: PEP 803 -- Stable ABI for free-threaded builds-Footnote-1359235
Ref: PEP 803 -- Stable ABI for free-threaded builds-Footnote-2359277
Ref: PEP 803 -- Stable ABI for free-threaded builds-Footnote-3359319
Ref: PEP 803 -- Stable ABI for free-threaded builds-Footnote-4359361
Node: PEP 788 Protecting the C API from interpreter finalization359403
Ref: whatsnew/3 15 pep-788-protecting-the-c-api-from-interpreter-finalization359600
Ref: 1aa359600
Ref: whatsnew/3 15 whatsnew315-c-api-interpreter-finalization359600
Ref: 17b359600
Ref: PEP 788 Protecting the C API from interpreter finalization-Footnote-1361009
Ref: PEP 788 Protecting the C API from interpreter finalization-Footnote-2361051
Node: Improved error messages361107
Ref: whatsnew/3 15 improved-error-messages361249
Ref: 1b3361249
Ref: whatsnew/3 15 whatsnew315-improved-error-messages361249
Ref: 17e361249
Ref: Improved error messages-Footnote-1364704
Ref: Improved error messages-Footnote-2364760
Ref: Improved error messages-Footnote-3364816
Node: Other language changes<2>364872
Ref: whatsnew/3 15 other-language-changes365017
Ref: 1b6365017
Ref: whatsnew/3 15 whatsnew315-utf8-default365076
Ref: 175365076
Ref: whatsnew/3 15 whatsnew315-color-interpreter-help366333
Ref: 1b9366333
Ref: whatsnew/3 15 whatsnew315-color-exceptions366528
Ref: 1bb366528
Ref: whatsnew/3 15 whatsnew315-more-color366715
Ref: 17f366715
Ref: whatsnew/3 15 whatsnew315-bytearray-take-bytes368489
Ref: 1cf368489
Ref: Other language changes<2>-Footnote-1373814
Ref: Other language changes<2>-Footnote-2373858
Ref: Other language changes<2>-Footnote-3373892
Ref: Other language changes<2>-Footnote-4373934
Ref: Other language changes<2>-Footnote-5373990
Ref: Other language changes<2>-Footnote-6374046
Ref: Other language changes<2>-Footnote-7374102
Ref: Other language changes<2>-Footnote-8374157
Ref: Other language changes<2>-Footnote-9374213
Ref: Other language changes<2>-Footnote-10374269
Ref: Other language changes<2>-Footnote-11374325
Ref: Other language changes<2>-Footnote-12374382
Ref: Other language changes<2>-Footnote-13374439
Ref: Other language changes<2>-Footnote-14374495
Ref: Other language changes<2>-Footnote-15374551
Ref: Other language changes<2>-Footnote-16374608
Ref: Other language changes<2>-Footnote-17374665
Ref: Other language changes<2>-Footnote-18374722
Ref: Other language changes<2>-Footnote-19374779
Ref: Other language changes<2>-Footnote-20374836
Node: Default interactive shell374892
Ref: whatsnew/3 15 default-interactive-shell375036
Ref: 1e0375036
Ref: whatsnew/3 15 whatsnew315-pyrepl-completion375101
Ref: 1c2375101
Ref: Default interactive shell-Footnote-1375451
Ref: Default interactive shell-Footnote-2375500
Node: New modules<2>375556
Ref: whatsnew/3 15 new-modules375694
Ref: 1e2375694
Node: math integer375771
Ref: whatsnew/3 15 math-integer375834
Ref: 1e3375834
Ref: math integer-Footnote-1376060
Ref: math integer-Footnote-2376102
Node: Improved modules<2>376157
Ref: whatsnew/3 15 improved-modules376286
Ref: 1e4376286
Node: argparse377247
Ref: whatsnew/3 15 argparse377325
Ref: 1e5377325
Ref: whatsnew/3 15 whatsnew315-color-argparse377778
Ref: 1bc377778
Ref: argparse-Footnote-1378222
Ref: argparse-Footnote-2378278
Ref: argparse-Footnote-3378334
Ref: argparse-Footnote-4378390
Node: array378446
Ref: whatsnew/3 15 array378536
Ref: 1e8378536
Ref: array-Footnote-1379191
Ref: array-Footnote-2379247
Ref: array-Footnote-3379303
Ref: array-Footnote-4379359
Node: ast379415
Ref: whatsnew/3 15 ast379507
Ref: 1eb379507
Ref: whatsnew/3 15 whatsnew315-color-ast379532
Ref: 1bd379532
Ref: ast-Footnote-1380034
Ref: ast-Footnote-2380090
Node: asyncio<2>380146
Ref: whatsnew/3 15 asyncio380239
Ref: 1ee380239
Ref: asyncio<2>-Footnote-1380723
Node: base64380779
Ref: whatsnew/3 15 base64380877
Ref: 1f0380877
Ref: base64-Footnote-1382313
Ref: base64-Footnote-2382369
Ref: base64-Footnote-3382424
Ref: base64-Footnote-4382480
Ref: base64-Footnote-5382536
Ref: base64-Footnote-6382592
Ref: base64-Footnote-7382648
Node: binascii382704
Ref: whatsnew/3 15 binascii382800
Ref: 200382800
Ref: binascii-Footnote-1384145
Ref: binascii-Footnote-2384201
Ref: binascii-Footnote-3384257
Ref: binascii-Footnote-4384312
Ref: binascii-Footnote-5384368
Ref: binascii-Footnote-6384424
Ref: binascii-Footnote-7384480
Ref: binascii-Footnote-8384536
Node: calendar384592
Ref: whatsnew/3 15 calendar384693
Ref: 20b384693
Ref: whatsnew/3 15 whatsnew315-color-calendar384728
Ref: 1be384728
Ref: calendar-Footnote-1385438
Ref: calendar-Footnote-2385494
Ref: calendar-Footnote-3385550
Node: collections385606
Ref: whatsnew/3 15 collections385717
Ref: 20e385717
Ref: collections-Footnote-1386024
Node: concurrent futures386080
Ref: whatsnew/3 15 concurrent-futures386193
Ref: 210386193
Ref: concurrent futures-Footnote-1386573
Node: contextlib386629
Ref: whatsnew/3 15 contextlib386742
Ref: 212386742
Ref: contextlib-Footnote-1387690
Ref: contextlib-Footnote-2387746
Node: dataclasses387802
Ref: whatsnew/3 15 dataclasses387900
Ref: 21b387900
Node: dbm388042
Ref: whatsnew/3 15 dbm388137
Ref: 21c388137
Ref: dbm-Footnote-1388427
Node: difflib388483
Ref: whatsnew/3 15 difflib388572
Ref: 21d388572
Ref: whatsnew/3 15 whatsnew315-color-difflib388607
Ref: 1bf388607
Ref: difflib-Footnote-1389102
Ref: difflib-Footnote-2389158
Node: email389214
Ref: whatsnew/3 15 email389312
Ref: 220389312
Ref: email-Footnote-1389753
Node: faulthandler389809
Ref: whatsnew/3 15 faulthandler389912
Ref: 223389912
Ref: faulthandler-Footnote-1390270
Node: functools<2>390326
Ref: whatsnew/3 15 functools390426
Ref: 228390426
Ref: functools<2>-Footnote-1390862
Ref: functools<2>-Footnote-2390918
Node: gc390974
Ref: whatsnew/3 15 gc391069
Ref: 22b391069
Ref: gc-Footnote-1391455
Node: hashlib391511
Ref: whatsnew/3 15 hashlib391605
Ref: 22c391605
Ref: hashlib-Footnote-1392097
Node: http client392153
Ref: whatsnew/3 15 http-client392256
Ref: 22d392256
Ref: http client-Footnote-1392653
Node: http server392709
Ref: whatsnew/3 15 http-server392812
Ref: 230392812
Ref: whatsnew/3 15 whatsnew315-color-http-server392855
Ref: 1c0392855
Ref: http server-Footnote-1393833
Ref: http server-Footnote-2393889
Ref: http server-Footnote-3393945
Ref: http server-Footnote-4394001
Node: inspect394057
Ref: whatsnew/3 15 inspect394153
Ref: 236394153
Ref: inspect-Footnote-1394380
Node: json394436
Ref: whatsnew/3 15 json394527
Ref: 238394527
Ref: json-Footnote-1395065
Node: locale395121
Ref: whatsnew/3 15 locale395209
Ref: 23b395209
Ref: locale-Footnote-1395662
Ref: locale-Footnote-2395718
Node: math395774
Ref: whatsnew/3 15 math395870
Ref: 23f395870
Ref: math-Footnote-1396239
Ref: math-Footnote-2396295
Node: mimetypes<2>396351
Ref: whatsnew/3 15 mimetypes396445
Ref: 245396445
Ref: mimetypes<2>-Footnote-1397017
Ref: mimetypes<2>-Footnote-2397073
Ref: mimetypes<2>-Footnote-3397129
Ref: mimetypes<2>-Footnote-4397185
Ref: mimetypes<2>-Footnote-5397241
Ref: mimetypes<2>-Footnote-6397297
Ref: mimetypes<2>-Footnote-7397353
Ref: mimetypes<2>-Footnote-8397409
Ref: mimetypes<2>-Footnote-9397465
Ref: mimetypes<2>-Footnote-10397521
Node: mmap397578
Ref: whatsnew/3 15 mmap397673
Ref: 246397673
Ref: mmap-Footnote-1398192
Ref: mmap-Footnote-2398247
Ref: mmap-Footnote-3398302
Node: os<2>398358
Ref: whatsnew/3 15 os398448
Ref: 249398448
Ref: os<2>-Footnote-1399026
Ref: os<2>-Footnote-2399081
Node: os path399136
Ref: whatsnew/3 15 os-path399225
Ref: 24c399225
Ref: os path-Footnote-1399756
Ref: os path-Footnote-2399811
Node: pdb399866
Ref: whatsnew/3 15 pdb399956
Ref: 250399956
Ref: pdb-Footnote-1400150
Node: pickle400206
Ref: whatsnew/3 15 pickle400300
Ref: 251400300
Ref: pickle-Footnote-1400509
Node: pickletools400564
Ref: whatsnew/3 15 pickletools400661
Ref: 252400661
Ref: whatsnew/3 15 whatsnew315-color-pickletools400704
Ref: 1c1400704
Ref: pickletools-Footnote-1400964
Node: pprint401020
Ref: whatsnew/3 15 pprint401113
Ref: 253401113
Ref: pprint-Footnote-1401614
Ref: pprint-Footnote-2401670
Ref: pprint-Footnote-3401726
Node: re401782
Ref: whatsnew/3 15 re401872
Ref: 255401872
Ref: re-Footnote-1402563
Node: resource402618
Ref: whatsnew/3 15 resource402708
Ref: 25a402708
Ref: resource-Footnote-1403007
Node: shelve403063
Ref: whatsnew/3 15 shelve403157
Ref: 260403157
Ref: shelve-Footnote-1403585
Ref: shelve-Footnote-2403641
Node: socket403696
Ref: whatsnew/3 15 socket403789
Ref: 261403789
Ref: socket-Footnote-1403984
Node: sqlite3404039
Ref: whatsnew/3 15 sqlite3404129
Ref: 262404129
Ref: whatsnew/3 15 whatsnew315-color-sqlite3404332
Ref: 1c3404332
Ref: sqlite3-Footnote-1404756
Ref: sqlite3-Footnote-2404812
Ref: sqlite3-Footnote-3404868
Node: ssl404924
Ref: whatsnew/3 15 ssl405018
Ref: 264405018
Ref: ssl-Footnote-1407830
Ref: ssl-Footnote-2407889
Ref: ssl-Footnote-3407945
Ref: ssl-Footnote-4408001
Ref: ssl-Footnote-5408057
Node: subprocess408113
Ref: whatsnew/3 15 subprocess408211
Ref: 271408211
Ref: subprocess-Footnote-1408977
Node: symtable<2>409032
Ref: whatsnew/3 15 symtable409133
Ref: 276409133
Ref: symtable<2>-Footnote-1409363
Node: sys<2>409419
Ref: whatsnew/3 15 sys409524
Ref: 279409524
Ref: sys<2>-Footnote-1409727
Node: sys monitoring409783
Ref: whatsnew/3 15 sys-monitoring409887
Ref: 27b409887
Ref: sys monitoring-Footnote-1410483
Node: tarfile<2>410539
Ref: whatsnew/3 15 tarfile410646
Ref: 283410646
Ref: tarfile<2>-Footnote-1411979
Ref: tarfile<2>-Footnote-2412035
Ref: tarfile<2>-Footnote-3412090
Ref: tarfile<2>-Footnote-4412146
Ref: tarfile<2>-Footnote-5412202
Ref: tarfile<2>-Footnote-6412257
Ref: tarfile<2>-Footnote-7412313
Ref: tarfile<2>-Footnote-8412369
Ref: tarfile<2>-Footnote-9412424
Node: threading412479
Ref: whatsnew/3 15 threading412578
Ref: 289412578
Ref: threading-Footnote-1412891
Node: timeit412947
Ref: whatsnew/3 15 timeit413043
Ref: 28d413043
Ref: whatsnew/3 15 whatsnew315-color-timeit413076
Ref: 1c4413076
Ref: timeit-Footnote-1413755
Ref: timeit-Footnote-2413811
Ref: timeit-Footnote-3413867
Node: tkinter413922
Ref: whatsnew/3 15 tkinter414017
Ref: 28f414017
Ref: tkinter-Footnote-1415220
Ref: tkinter-Footnote-2415276
Ref: tkinter-Footnote-3415332
Ref: tkinter-Footnote-4415388
Node: tokenize415443
Ref: whatsnew/3 15 tokenize415539
Ref: 290415539
Ref: whatsnew/3 15 whatsnew315-color-tokenize415576
Ref: 1c5415576
Ref: tokenize-Footnote-1415846
Node: tomllib415902
Ref: whatsnew/3 15 tomllib415996
Ref: 292415996
Ref: whatsnew/3 15 whatsnew315-tomllib-1-1-0415996
Ref: 293415996
Ref: tomllib-Footnote-1417171
Ref: tomllib-Footnote-2417236
Node: types417292
Ref: whatsnew/3 15 official-toml-changelog417384
Ref: 294417384
Ref: whatsnew/3 15 types417384
Ref: 295417384
Ref: types-Footnote-1417665
Node: typing417707
Ref: whatsnew/3 15 typing417803
Ref: 299417803
Ref: whatsnew/3 15 whatsnew315-typeform417836
Ref: 178417836
Ref: whatsnew/3 15 whatsnew315-typeddict418578
Ref: 177418578
Ref: typing-Footnote-1420314
Ref: typing-Footnote-2420356
Ref: typing-Footnote-3420412
Ref: typing-Footnote-4420454
Ref: typing-Footnote-5420510
Ref: typing-Footnote-6420566
Ref: typing-Footnote-7420622
Ref: typing-Footnote-8420664
Node: unicodedata420720
Ref: whatsnew/3 15 unicodedata420819
Ref: 2a1420819
Ref: unicodedata-Footnote-1421864
Ref: unicodedata-Footnote-2421910
Ref: unicodedata-Footnote-3421966
Ref: unicodedata-Footnote-4422012
Ref: unicodedata-Footnote-5422067
Ref: unicodedata-Footnote-6422151
Node: unittest422206
Ref: whatsnew/3 15 unittest422311
Ref: 2a9422311
Ref: unittest-Footnote-1422855
Ref: unittest-Footnote-2422911
Node: urllib parse422967
Ref: whatsnew/3 15 urllib-parse423065
Ref: 2ad423065
Ref: urllib parse-Footnote-1423555
Node: venv423610
Ref: whatsnew/3 15 venv423708
Ref: 2b3423708
Ref: venv-Footnote-1424168
Node: warnings424224
Ref: whatsnew/3 15 warnings424314
Ref: 2b5424314
Ref: warnings-Footnote-1424875
Node: wave424931
Ref: whatsnew/3 15 wave425027
Ref: 2b7425027
Ref: wave-Footnote-1425768
Node: webbrowser425823
Ref: whatsnew/3 15 webbrowser425914
Ref: 2bc425914
Ref: webbrowser-Footnote-1426558
Node: xml426614
Ref: whatsnew/3 15 xml426718
Ref: 2bd426718
Ref: xml-Footnote-1427164
Ref: xml-Footnote-2427220
Node: xml parsers expat427276
Ref: whatsnew/3 15 xml-parsers-expat427374
Ref: 2c0427374
Ref: xml parsers expat-Footnote-1428091
Ref: xml parsers expat-Footnote-2428146
Ref: xml parsers expat-Footnote-3428206
Node: zlib428261
Ref: whatsnew/3 15 zlib428347
Ref: 2c6428347
Ref: zlib-Footnote-1428702
Ref: zlib-Footnote-2428758
Node: Optimizations<2>428814
Ref: whatsnew/3 15 optimizations428939
Ref: 2c9428939
Ref: Optimizations<2>-Footnote-1429331
Node: base64 & binascii429387
Ref: whatsnew/3 15 base64-binascii429469
Ref: 2cb429469
Ref: base64 & binascii-Footnote-1430233
Ref: base64 & binascii-Footnote-2430289
Ref: base64 & binascii-Footnote-3430345
Node: csv430401
Ref: whatsnew/3 15 csv430513
Ref: 2cc430513
Ref: csv-Footnote-1430733
Node: Upgraded JIT compiler430789
Ref: whatsnew/3 15 upgraded-jit-compiler430875
Ref: 2ce430875
Ref: whatsnew/3 15 whatsnew315-jit430875
Ref: 17c430875
Ref: Upgraded JIT compiler-Footnote-1435694
Ref: Upgraded JIT compiler-Footnote-2435742
Ref: Upgraded JIT compiler-Footnote-3435795
Ref: Upgraded JIT compiler-Footnote-4435848
Ref: Upgraded JIT compiler-Footnote-5435920
Ref: Upgraded JIT compiler-Footnote-6435976
Ref: Upgraded JIT compiler-Footnote-7436032
Ref: Upgraded JIT compiler-Footnote-8436088
Ref: Upgraded JIT compiler-Footnote-9436144
Ref: Upgraded JIT compiler-Footnote-10436199
Ref: Upgraded JIT compiler-Footnote-11436256
Ref: Upgraded JIT compiler-Footnote-12436313
Ref: Upgraded JIT compiler-Footnote-13436370
Ref: Upgraded JIT compiler-Footnote-14436427
Ref: Upgraded JIT compiler-Footnote-15436484
Ref: Upgraded JIT compiler-Footnote-16436541
Ref: Upgraded JIT compiler-Footnote-17436598
Ref: Upgraded JIT compiler-Footnote-18436655
Ref: Upgraded JIT compiler-Footnote-19436712
Ref: Upgraded JIT compiler-Footnote-20436769
Ref: Upgraded JIT compiler-Footnote-21436826
Ref: Upgraded JIT compiler-Footnote-22436883
Ref: Upgraded JIT compiler-Footnote-23436940
Node: Removed<2>436997
Ref: whatsnew/3 15 removed437116
Ref: 2d1437116
Node: ast<2>437474
Ref: whatsnew/3 15 id1437551
Ref: 2d2437551
Ref: ast<2>-Footnote-1438011
Ref: ast<2>-Footnote-2438067
Node: collections abc438123
Ref: whatsnew/3 15 collections-abc438215
Ref: 2d5438215
Node: ctypes438495
Ref: whatsnew/3 15 ctypes438589
Ref: 2d7438589
Ref: ctypes-Footnote-1439130
Ref: ctypes-Footnote-2439186
Node: datetime439242
Ref: whatsnew/3 15 datetime439325
Ref: 2dc439325
Ref: datetime-Footnote-1439668
Node: glob439723
Ref: whatsnew/3 15 glob439814
Ref: 2de439814
Ref: glob-Footnote-1440155
Node: http server<2>440211
Ref: whatsnew/3 15 id2440313
Ref: 2e0440313
Ref: http server<2>-Footnote-1440632
Node: importlib resources440688
Ref: whatsnew/3 15 importlib-resources440793
Ref: 2e1440793
Ref: importlib resources-Footnote-1441048
Node: pathlib441104
Ref: whatsnew/3 15 pathlib441203
Ref: 2e3441203
Ref: pathlib-Footnote-1441689
Ref: pathlib-Footnote-2441744
Node: platform441800
Ref: whatsnew/3 15 platform441885
Ref: 2e6441885
Ref: platform-Footnote-1442113
Node: sre_*442169
Ref: whatsnew/3 15 sre442259
Ref: 2e7442259
Ref: sre_*-Footnote-1442460
Node: sysconfig<2>442516
Ref: whatsnew/3 15 sysconfig442610
Ref: 2e8442610
Ref: sysconfig<2>-Footnote-1442827
Node: threading<2>442882
Ref: whatsnew/3 15 id3442979
Ref: 2ea442979
Ref: threading<2>-Footnote-1443273
Node: types<2>443329
Ref: whatsnew/3 15 id4443423
Ref: 2ec443423
Ref: types<2>-Footnote-1443665
Ref: types<2>-Footnote-2443707
Node: typing<2>443763
Ref: whatsnew/3 15 id5443852
Ref: 2ee443852
Ref: typing<2>-Footnote-1444867
Ref: typing<2>-Footnote-2444923
Ref: typing<2>-Footnote-3444979
Node: wave<2>445035
Ref: whatsnew/3 15 id6445125
Ref: 2f1445125
Ref: wave<2>-Footnote-1445444
Node: zipimport445500
Ref: whatsnew/3 15 zipimport445572
Ref: 2f4445572
Ref: zipimport-Footnote-1445831
Node: Deprecated<2>445887
Ref: whatsnew/3 15 deprecated446006
Ref: 2f6446006
Node: New deprecations446463
Ref: whatsnew/3 15 new-deprecations446568
Ref: 2f7446568
Ref: New deprecations-Footnote-1453272
Ref: New deprecations-Footnote-2453328
Ref: New deprecations-Footnote-3453384
Ref: New deprecations-Footnote-4453440
Ref: New deprecations-Footnote-5453496
Ref: New deprecations-Footnote-6453552
Ref: New deprecations-Footnote-7453607
Ref: New deprecations-Footnote-8453663
Ref: New deprecations-Footnote-9453719
Ref: New deprecations-Footnote-10453775
Node: Pending removal in Python 3 16453831
Ref: whatsnew/3 15 pending-removal-in-python-3-16453975
Ref: 30a453975
Ref: Pending removal in Python 3 16-Footnote-1458233
Ref: Pending removal in Python 3 16-Footnote-2458289
Ref: Pending removal in Python 3 16-Footnote-3458345
Ref: Pending removal in Python 3 16-Footnote-4458401
Node: Pending removal in Python 3 17458456
Ref: whatsnew/3 15 pending-removal-in-python-3-17458614
Ref: 318458614
Ref: Pending removal in Python 3 17-Footnote-1462215
Ref: Pending removal in Python 3 17-Footnote-2462270
Ref: Pending removal in Python 3 17-Footnote-3462328
Ref: Pending removal in Python 3 17-Footnote-4462383
Ref: Pending removal in Python 3 17-Footnote-5462439
Ref: Pending removal in Python 3 17-Footnote-6462495
Ref: Pending removal in Python 3 17-Footnote-7462553
Node: Pending removal in Python 3 18462608
Ref: whatsnew/3 15 pending-removal-in-python-3-18462766
Ref: 31e462766
Ref: Pending removal in Python 3 18-Footnote-1463496
Ref: Pending removal in Python 3 18-Footnote-2463551
Ref: Pending removal in Python 3 18-Footnote-3463606
Ref: Pending removal in Python 3 18-Footnote-4463648
Node: Pending removal in Python 3 19463704
Ref: whatsnew/3 15 pending-removal-in-python-3-19463862
Ref: 31f463862
Node: Pending removal in Python 3 20465656
Ref: whatsnew/3 15 pending-removal-in-python-3-20465818
Ref: 323465818
Ref: Pending removal in Python 3 20-Footnote-1467999
Ref: Pending removal in Python 3 20-Footnote-2468055
Ref: Pending removal in Python 3 20-Footnote-3468110
Ref: Pending removal in Python 3 20-Footnote-4468152
Node: Pending removal in future versions468208
Ref: whatsnew/3 15 pending-removal-in-future-versions468357
Ref: 324468357
Ref: Pending removal in future versions-Footnote-1475971
Ref: Pending removal in future versions-Footnote-2476026
Ref: Pending removal in future versions-Footnote-3476082
Ref: Pending removal in future versions-Footnote-4476138
Ref: Pending removal in future versions-Footnote-5476194
Ref: Pending removal in future versions-Footnote-6476249
Ref: Pending removal in future versions-Footnote-7476304
Node: Soft deprecations476360
Ref: whatsnew/3 15 soft-deprecations476470
Ref: 34e476470
Ref: Soft deprecations-Footnote-1477594
Ref: Soft deprecations-Footnote-2477649
Node: C API changes<2>477705
Ref: whatsnew/3 15 c-api-changes477830
Ref: 34f477830
Node: New features<4>478015
Ref: whatsnew/3 15 id7478106
Ref: 350478106
Ref: whatsnew/3 15 whatsnew315-pybyteswriter479587
Ref: 179479587
Ref: New features<4>-Footnote-1484018
Ref: New features<4>-Footnote-2484074
Ref: New features<4>-Footnote-3484130
Ref: New features<4>-Footnote-4484186
Ref: New features<4>-Footnote-5484242
Ref: New features<4>-Footnote-6484298
Ref: New features<4>-Footnote-7484354
Ref: New features<4>-Footnote-8484396
Ref: New features<4>-Footnote-9484452
Ref: New features<4>-Footnote-10484508
Ref: New features<4>-Footnote-11484565
Ref: New features<4>-Footnote-12484622
Ref: New features<4>-Footnote-13484665
Ref: New features<4>-Footnote-14484722
Ref: New features<4>-Footnote-15484779
Ref: New features<4>-Footnote-16484836
Ref: New features<4>-Footnote-17484879
Ref: New features<4>-Footnote-18484936
Ref: New features<4>-Footnote-19484993
Ref: New features<4>-Footnote-20485050
Ref: New features<4>-Footnote-21485107
Node: Changed C APIs485164
Ref: whatsnew/3 15 changed-c-apis485281
Ref: 3a3485281
Ref: Changed C APIs-Footnote-1485828
Ref: Changed C APIs-Footnote-2485884
Node: Removed C APIs<2>485940
Ref: whatsnew/3 15 removed-c-apis486062
Ref: 3a8486062
Ref: Removed C APIs<2>-Footnote-1488914
Ref: Removed C APIs<2>-Footnote-2488970
Ref: Removed C APIs<2>-Footnote-3489026
Ref: Removed C APIs<2>-Footnote-4489078
Ref: Removed C APIs<2>-Footnote-5489134
Ref: Removed C APIs<2>-Footnote-6489190
Ref: Removed C APIs<2>-Footnote-7489242
Node: Deprecated C APIs<2>489298
Ref: whatsnew/3 15 deprecated-c-apis489397
Ref: 3b6489397
Ref: whatsnew/3 15 pythoncapi-compat-project-link489397
Ref: 3b7489397
Ref: Deprecated C APIs<2>-Footnote-1492931
Ref: Deprecated C APIs<2>-Footnote-2492973
Ref: Deprecated C APIs<2>-Footnote-3493029
Ref: Deprecated C APIs<2>-Footnote-4493085
Ref: Deprecated C APIs<2>-Footnote-5493141
Ref: Deprecated C APIs<2>-Footnote-6493197
Ref: Deprecated C APIs<2>-Footnote-7493253
Ref: Deprecated C APIs<2>-Footnote-8493309
Ref: Deprecated C APIs<2>-Footnote-9493365
Ref: Deprecated C APIs<2>-Footnote-10493421
Ref: Deprecated C APIs<2>-Footnote-11493478
Node: Build changes<2>493535
Ref: whatsnew/3 15 build-changes493669
Ref: 3dd493669
Ref: whatsnew/3 15 whatsnew315-windows-tail-calling-interpreter495798
Ref: 17d495798
Ref: Build changes<2>-Footnote-1496598
Ref: Build changes<2>-Footnote-2496654
Ref: Build changes<2>-Footnote-3496696
Ref: Build changes<2>-Footnote-4496752
Ref: Build changes<2>-Footnote-5496807
Ref: Build changes<2>-Footnote-6496863
Ref: Build changes<2>-Footnote-7496905
Ref: Build changes<2>-Footnote-8496961
Ref: Build changes<2>-Footnote-9497063
Ref: Build changes<2>-Footnote-10497113
Node: Porting to Python 3 15497170
Ref: whatsnew/3 15 porting-to-python-3-15497279
Ref: 3e5497279
Ref: Porting to Python 3 15-Footnote-1500089
Ref: Porting to Python 3 15-Footnote-2500145
Ref: Porting to Python 3 15-Footnote-3500201
Ref: Porting to Python 3 15-Footnote-4500257
Ref: Porting to Python 3 15-Footnote-5500313
Ref: Porting to Python 3 15-Footnote-6500368
Node: What's new in Python 3 14500424
Ref: whatsnew/3 14 doc500574
Ref: 3f5500574
Ref: whatsnew/3 14 translation-repo500574
Ref: 3f6500574
Ref: whatsnew/3 14 what-s-new-in-python-3-14500574
Ref: 3f7500574
Ref: What's new in Python 3 14-Footnote-1501509
Node: 概要 -- リリースハイライト501551
Ref: whatsnew/3 14 summary-release-highlights501674
Ref: 3f8501674
Ref: 概要 -- リリースハイライト-Footnote-1505342
Ref: 概要 -- リリースハイライト-Footnote-2505384
Ref: 概要 -- リリースハイライト-Footnote-3505426
Ref: 概要 -- リリースハイライト-Footnote-4505468
Ref: 概要 -- リリースハイライト-Footnote-5505510
Ref: 概要 -- リリースハイライト-Footnote-6505552
Ref: 概要 -- リリースハイライト-Footnote-7505594
Ref: 概要 -- リリースハイライト-Footnote-8505636
Ref: 概要 -- リリースハイライト-Footnote-9505678
Ref: 概要 -- リリースハイライト-Footnote-10505720
Ref: 概要 -- リリースハイライト-Footnote-11505763
Ref: 概要 -- リリースハイライト-Footnote-12505813
Ref: 概要 -- リリースハイライト-Footnote-13505856
Node: 新しい機能505899
Ref: whatsnew/3 14 new-features506056
Ref: 40e506056
Node: PEP 649 と PEP 749 アノテーションの遅延評価506896
Ref: whatsnew/3 14 pep-649-pep-749-deferred-evaluation-of-annotations507087
Ref: 40f507087
Ref: whatsnew/3 14 whatsnew314-deferred-annotations507087
Ref: 3fa507087
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-1509626
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-2509668
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-3509724
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-4509766
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-5509808
Node: PEP 734 複数インタープリタ機能が標準ライブラリに追加509850
Ref: whatsnew/3 14 pep-734-multiple-interpreters-in-the-standard-library510097
Ref: 416510097
Ref: whatsnew/3 14 whatsnew314-multiple-interpreters510097
Ref: 3fb510097
Ref: PEP 734 複数インタープリタ機能が標準ライブラリに追加-Footnote-1515617
Ref: PEP 734 複数インタープリタ機能が標準ライブラリに追加-Footnote-2515659
Ref: PEP 734 複数インタープリタ機能が標準ライブラリに追加-Footnote-3515715
Node: PEP 750 テンプレート文字列リテラル515757
Ref: whatsnew/3 14 pep-750-template-string-literals516007
Ref: 41b516007
Ref: whatsnew/3 14 whatsnew314-template-string-literals516007
Ref: 3f9516007
Ref: PEP 750 テンプレート文字列リテラル-Footnote-1519409
Ref: PEP 750 テンプレート文字列リテラル-Footnote-2519465
Node: PEP 768 安全な外部デバッガインターフェース519507
Ref: whatsnew/3 14 pep-768-safe-external-debugger-interface519713
Ref: 41e519713
Ref: whatsnew/3 14 whatsnew314-remote-debugging519713
Ref: 403519713
Ref: PEP 768 安全な外部デバッガインターフェース-Footnote-1522248
Ref: PEP 768 安全な外部デバッガインターフェース-Footnote-2522304
Node: 新しいインタープリタ522346
Ref: whatsnew/3 14 a-new-type-of-interpreter522536
Ref: 422522536
Ref: whatsnew/3 14 whatsnew314-tail-call-interpreter522536
Ref: 2cf522536
Ref: 新しいインタープリタ-Footnote-1524472
Ref: 新しいインタープリタ-Footnote-2524520
Node: Free-threaded mode improvements524576
Ref: whatsnew/3 14 free-threaded-mode-improvements524740
Ref: 424524740
Ref: whatsnew/3 14 whatsnew314-free-threaded-cpython524740
Ref: 404524740
Ref: Free-threaded mode improvements-Footnote-1527064
Ref: Free-threaded mode improvements-Footnote-2527106
Node: エラーメッセージの改善527148
Ref: whatsnew/3 14 improved-error-messages527331
Ref: 42b527331
Ref: whatsnew/3 14 whatsnew314-improved-error-messages527331
Ref: 405527331
Ref: エラーメッセージの改善-Footnote-1531930
Ref: エラーメッセージの改善-Footnote-2531986
Ref: エラーメッセージの改善-Footnote-3532042
Ref: エラーメッセージの改善-Footnote-4532098
Ref: エラーメッセージの改善-Footnote-5532153
Ref: エラーメッセージの改善-Footnote-6532209
Ref: エラーメッセージの改善-Footnote-7532265
Ref: エラーメッセージの改善-Footnote-8532321
Ref: エラーメッセージの改善-Footnote-9532377
Ref: エラーメッセージの改善-Footnote-10532433
Node: PEP 784 Zstandard support in the standard library532490
Ref: whatsnew/3 14 pep-784-zstandard-support-in-the-standard-library532676
Ref: 433532676
Ref: whatsnew/3 14 whatsnew314-zstandard532676
Ref: 3fd532676
Ref: PEP 784 Zstandard support in the standard library-Footnote-1534317
Ref: PEP 784 Zstandard support in the standard library-Footnote-2534358
Ref: PEP 784 Zstandard support in the standard library-Footnote-3534414
Node: Asyncio introspection capabilities534456
Ref: whatsnew/3 14 asyncio-introspection-capabilities534641
Ref: 434534641
Ref: whatsnew/3 14 whatsnew314-asyncio-introspection534641
Ref: 3fc534641
Ref: Asyncio introspection capabilities-Footnote-1540276
Node: Concurrent safe warnings control540331
Ref: whatsnew/3 14 concurrent-safe-warnings-control540458
Ref: 435540458
Ref: whatsnew/3 14 whatsnew314-concurrent-warnings-control540458
Ref: 407540458
Ref: Concurrent safe warnings control-Footnote-1541134
Node: Other language changes<3>541190
Ref: whatsnew/3 14 other-language-changes541334
Ref: 437541334
Ref: Other language changes<3>-Footnote-1542851
Ref: Other language changes<3>-Footnote-2542907
Ref: Other language changes<3>-Footnote-3542962
Ref: Other language changes<3>-Footnote-4543018
Ref: Other language changes<3>-Footnote-5543074
Node: Built-ins543130
Ref: whatsnew/3 14 built-ins543240
Ref: 43a543240
Ref: Built-ins-Footnote-1545418
Ref: Built-ins-Footnote-2545474
Ref: Built-ins-Footnote-3545529
Ref: Built-ins-Footnote-4545584
Ref: Built-ins-Footnote-5545640
Ref: Built-ins-Footnote-6545696
Ref: Built-ins-Footnote-7545752
Ref: Built-ins-Footnote-8545808
Ref: Built-ins-Footnote-9545864
Node: コマンドラインと環境545920
Ref: whatsnew/3 14 command-line-and-environment546100
Ref: 44b546100
Ref: コマンドラインと環境-Footnote-1546935
Ref: コマンドラインと環境-Footnote-2546991
Ref: コマンドラインと環境-Footnote-3547047
Ref: コマンドラインと環境-Footnote-4547079
Node: PEP 758 Allow except and except* expressions without brackets547135
Ref: whatsnew/3 14 pep-758-allow-except-and-except-expressions-without-brackets547344
Ref: 44d547344
Ref: whatsnew/3 14 whatsnew314-bracketless-except547344
Ref: 401547344
Ref: PEP 758 Allow except and except* expressions without brackets-Footnote-1547942
Ref: PEP 758 Allow except and except* expressions without brackets-Footnote-2547984
Node: PEP 765 Control flow in finally blocks548040
Ref: whatsnew/3 14 pep-765-control-flow-in-finally-blocks548237
Ref: 450548237
Ref: whatsnew/3 14 whatsnew314-finally-syntaxwarning548237
Ref: 402548237
Ref: whatsnew/3 14 incremental-garbage-collection549391
Ref: 454549391
Ref: PEP 765 Control flow in finally blocks-Footnote-1549429
Ref: PEP 765 Control flow in finally blocks-Footnote-2549471
Node: Garbage collection549527
Ref: whatsnew/3 14 garbage-collection549691
Ref: 455549691
Ref: whatsnew/3 14 whatsnew314-incremental-gc549691
Ref: 406549691
Ref: Garbage collection-Footnote-1550884
Ref: Garbage collection-Footnote-2550940
Node: Default interactive shell<2>550996
Ref: whatsnew/3 14 default-interactive-shell551113
Ref: 457551113
Ref: whatsnew/3 14 whatsnew314-pyrepl-highlighting551182
Ref: 408551182
Ref: Default interactive shell<2>-Footnote-1552451
Ref: Default interactive shell<2>-Footnote-2552507
Node: 新しいモジュール552562
Ref: whatsnew/3 14 new-modules552710
Ref: 45b552710
Ref: 新しいモジュール-Footnote-1553892
Ref: 新しいモジュール-Footnote-2553948
Ref: 新しいモジュール-Footnote-3554004
Ref: 新しいモジュール-Footnote-4554060
Node: Improved modules<3>554116
Ref: whatsnew/3 14 improved-modules554248
Ref: 45c554248
Node: argparse<2>555458
Ref: whatsnew/3 14 argparse555540
Ref: 45d555540
Ref: argparse<2>-Footnote-1556413
Ref: argparse<2>-Footnote-2556468
Ref: argparse<2>-Footnote-3556524
Node: ast<3>556580
Ref: whatsnew/3 14 ast556681
Ref: 45f556681
Ref: ast<3>-Footnote-1557645
Ref: ast<3>-Footnote-2557700
Ref: ast<3>-Footnote-3557756
Ref: ast<3>-Footnote-4557812
Ref: ast<3>-Footnote-5557868
Ref: ast<3>-Footnote-6557924
Node: asyncio<3>557980
Ref: whatsnew/3 14 asyncio558081
Ref: 466558081
Ref: asyncio<3>-Footnote-1559212
Ref: asyncio<3>-Footnote-2559268
Node: calendar<2>559323
Ref: whatsnew/3 14 calendar559439
Ref: 46e559439
Ref: whatsnew/3 14 whatsnew314-color-calendar559474
Ref: 46f559474
Ref: calendar<2>-Footnote-1559757
Node: concurrent futures<2>559813
Ref: whatsnew/3 14 concurrent-futures559931
Ref: 470559931
Ref: whatsnew/3 14 whatsnew314-concurrent-futures-interp-pool559986
Ref: 41a559986
Ref: whatsnew/3 14 whatsnew314-concurrent-futures-start-method560409
Ref: 472560409
Ref: concurrent futures<2>-Footnote-1561877
Ref: concurrent futures<2>-Footnote-2561933
Ref: concurrent futures<2>-Footnote-3561988
Ref: concurrent futures<2>-Footnote-4562044
Node: configparser562099
Ref: whatsnew/3 14 configparser562217
Ref: 47b562217
Ref: configparser-Footnote-1562612
Node: contextvars562668
Ref: whatsnew/3 14 contextvars562774
Ref: 47e562774
Ref: contextvars-Footnote-1562992
Node: ctypes<2>563048
Ref: whatsnew/3 14 ctypes563148
Ref: 481563148
Ref: ctypes<2>-Footnote-1565626
Ref: ctypes<2>-Footnote-2565681
Ref: ctypes<2>-Footnote-3565736
Ref: ctypes<2>-Footnote-4565792
Ref: ctypes<2>-Footnote-5565848
Ref: ctypes<2>-Footnote-6565904
Ref: ctypes<2>-Footnote-7565960
Ref: ctypes<2>-Footnote-8566015
Ref: ctypes<2>-Footnote-9566071
Ref: ctypes<2>-Footnote-10566127
Ref: ctypes<2>-Footnote-11566184
Node: curses566241
Ref: whatsnew/3 14 curses566341
Ref: 48f566341
Ref: curses-Footnote-1566643
Node: datetime<2>566699
Ref: whatsnew/3 14 datetime566797
Ref: 492566797
Ref: datetime<2>-Footnote-1567046
Node: decimal567101
Ref: whatsnew/3 14 decimal567203
Ref: 496567203
Ref: decimal-Footnote-1567633
Ref: decimal-Footnote-2567689
Node: difflib<2>567744
Ref: whatsnew/3 14 difflib567838
Ref: 499567838
Ref: difflib<2>-Footnote-1568081
Node: dis568137
Ref: whatsnew/3 14 dis568229
Ref: 49a568229
Ref: dis-Footnote-1568953
Ref: dis-Footnote-2569009
Node: errno569065
Ref: whatsnew/3 14 errno569162
Ref: 4a2569162
Ref: errno-Footnote-1569336
Node: faulthandler<2>569392
Ref: whatsnew/3 14 faulthandler569493
Ref: 4a4569493
Ref: faulthandler<2>-Footnote-1569839
Node: fnmatch569895
Ref: whatsnew/3 14 fnmatch570000
Ref: 4a7570000
Ref: fnmatch-Footnote-1570215
Node: fractions570270
Ref: whatsnew/3 14 fractions570372
Ref: 4a9570372
Ref: fractions-Footnote-1570787
Ref: fractions-Footnote-2570842
Node: functools<3>570898
Ref: whatsnew/3 14 functools570999
Ref: 4ab570999
Ref: functools<3>-Footnote-1571529
Ref: functools<3>-Footnote-2571585
Node: getopt571641
Ref: whatsnew/3 14 getopt571740
Ref: 4b0571740
Ref: getopt-Footnote-1572069
Ref: getopt-Footnote-2572125
Node: getpass572181
Ref: whatsnew/3 14 getpass572276
Ref: 4b1572276
Ref: getpass-Footnote-1572647
Node: graphlib572702
Ref: whatsnew/3 14 graphlib572796
Ref: 4b3572796
Ref: graphlib-Footnote-1573042
Node: heapq573098
Ref: whatsnew/3 14 heapq573189
Ref: 4b5573189
Node: hmac573530
Ref: whatsnew/3 14 hmac573617
Ref: 4bb573617
Ref: hmac-Footnote-1573969
Ref: hmac-Footnote-2574028
Ref: hmac-Footnote-3574076
Node: http574131
Ref: whatsnew/3 14 http574220
Ref: 4bc574220
Ref: http-Footnote-1575081
Ref: http-Footnote-2575137
Node: imaplib575192
Ref: whatsnew/3 14 imaplib575287
Ref: 4c1575287
Ref: imaplib-Footnote-1575508
Ref: imaplib-Footnote-2575567
Node: inspect<2>575622
Ref: whatsnew/3 14 inspect575715
Ref: 4c3575715
Ref: inspect<2>-Footnote-1576393
Ref: inspect<2>-Footnote-2576449
Ref: inspect<2>-Footnote-3576505
Node: io576561
Ref: whatsnew/3 14 io576654
Ref: 4c9576654
Ref: io-Footnote-1577194
Ref: io-Footnote-2577250
Node: json<2>577306
Ref: whatsnew/3 14 json577398
Ref: 4d0577398
Ref: json<2>-Footnote-1578184
Ref: json<2>-Footnote-2578240
Ref: json<2>-Footnote-3578296
Node: linecache578352
Ref: whatsnew/3 14 linecache578458
Ref: 4d3578458
Ref: linecache-Footnote-1578659
Node: logging handlers578715
Ref: whatsnew/3 14 logging-handlers578821
Ref: 4d5578821
Ref: logging handlers-Footnote-1579240
Ref: logging handlers-Footnote-2579296
Node: math<2>579352
Ref: whatsnew/3 14 math579461
Ref: 4d8579461
Ref: math<2>-Footnote-1579680
Node: mimetypes<3>579736
Ref: whatsnew/3 14 mimetypes579844
Ref: 4d9579844
Ref: mimetypes<3>-Footnote-1583131
Ref: mimetypes<3>-Footnote-2583186
Ref: mimetypes<3>-Footnote-3583245
Ref: mimetypes<3>-Footnote-4583304
Ref: mimetypes<3>-Footnote-5583363
Ref: mimetypes<3>-Footnote-6583422
Ref: mimetypes<3>-Footnote-7583481
Ref: mimetypes<3>-Footnote-8583540
Ref: mimetypes<3>-Footnote-9583599
Ref: mimetypes<3>-Footnote-10583658
Ref: mimetypes<3>-Footnote-11583718
Ref: mimetypes<3>-Footnote-12583778
Ref: mimetypes<3>-Footnote-13583838
Ref: mimetypes<3>-Footnote-14583898
Ref: mimetypes<3>-Footnote-15583958
Ref: mimetypes<3>-Footnote-16584018
Ref: mimetypes<3>-Footnote-17584106
Ref: mimetypes<3>-Footnote-18584206
Ref: mimetypes<3>-Footnote-19584261
Ref: mimetypes<3>-Footnote-20584317
Ref: mimetypes<3>-Footnote-21584374
Ref: mimetypes<3>-Footnote-22584430
Ref: mimetypes<3>-Footnote-23584486
Node: multiprocessing584543
Ref: whatsnew/3 14 multiprocessing584652
Ref: 4db584652
Ref: whatsnew/3 14 whatsnew314-multiprocessing-start-method584703
Ref: 4dc584703
Ref: multiprocessing-Footnote-1586821
Ref: multiprocessing-Footnote-2586876
Ref: multiprocessing-Footnote-3586931
Ref: multiprocessing-Footnote-4586987
Ref: multiprocessing-Footnote-5587043
Node: operator587099
Ref: whatsnew/3 14 operator587201
Ref: 4e7587201
Ref: operator-Footnote-1587597
Node: os<3>587653
Ref: whatsnew/3 14 os587750
Ref: 4ea587750
Ref: os<3>-Footnote-1588459
Ref: os<3>-Footnote-2588515
Ref: os<3>-Footnote-3588571
Node: os path<2>588627
Ref: whatsnew/3 14 os-path588726
Ref: 4f3588726
Ref: os path<2>-Footnote-1589117
Node: pathlib<2>589172
Ref: whatsnew/3 14 pathlib589272
Ref: 4f4589272
Ref: pathlib<2>-Footnote-1590260
Ref: pathlib<2>-Footnote-2590315
Node: pdb<2>590371
Ref: whatsnew/3 14 pdb590470
Ref: 4fe590470
Ref: pdb<2>-Footnote-1593622
Ref: pdb<2>-Footnote-2593678
Ref: pdb<2>-Footnote-3593734
Ref: pdb<2>-Footnote-4593790
Ref: pdb<2>-Footnote-5593846
Ref: pdb<2>-Footnote-6593902
Ref: pdb<2>-Footnote-7593958
Ref: pdb<2>-Footnote-8594014
Ref: pdb<2>-Footnote-9594070
Ref: pdb<2>-Footnote-10594126
Node: pickle<2>594183
Ref: whatsnew/3 14 pickle594296
Ref: 509594296
Ref: pickle<2>-Footnote-1594667
Node: プラットフォーム594723
Ref: whatsnew/3 14 platform594835
Ref: 50b594835
Ref: プラットフォーム-Footnote-1595105
Node: pydoc595161
Ref: whatsnew/3 14 pydoc595269
Ref: 50d595269
Ref: pydoc-Footnote-1595518
Node: re<2>595574
Ref: whatsnew/3 14 re595667
Ref: 50e595667
Ref: re<2>-Footnote-1596208
Ref: re<2>-Footnote-2596264
Node: socket<2>596320
Ref: whatsnew/3 14 socket596414
Ref: 50f596414
Ref: socket<2>-Footnote-1597651
Ref: socket<2>-Footnote-2597707
Ref: socket<2>-Footnote-3597763
Ref: socket<2>-Footnote-4597818
Ref: socket<2>-Footnote-5597874
Ref: socket<2>-Footnote-6597929
Ref: socket<2>-Footnote-7597985
Ref: socket<2>-Footnote-8598041
Node: ssl<2>598097
Ref: whatsnew/3 14 ssl598192
Ref: 514598192
Ref: ssl<2>-Footnote-1598462
Node: struct598518
Ref: whatsnew/3 14 struct598615
Ref: 516598615
Ref: struct-Footnote-1598906
Node: symtable<3>598962
Ref: whatsnew/3 14 symtable599059
Ref: 517599059
Ref: symtable<3>-Footnote-1599358
Node: sys<3>599414
Ref: whatsnew/3 14 sys599522
Ref: 51c599522
Ref: sys<3>-Footnote-1600817
Ref: sys<3>-Footnote-2600873
Ref: sys<3>-Footnote-3600929
Ref: sys<3>-Footnote-4600985
Ref: sys<3>-Footnote-5601041
Node: sys monitoring<2>601097
Ref: whatsnew/3 14 sys-monitoring601206
Ref: 521601206
Ref: sys monitoring<2>-Footnote-1601491
Node: sysconfig<3>601547
Ref: whatsnew/3 14 sysconfig601660
Ref: 524601660
Ref: sysconfig<3>-Footnote-1601859
Node: tarfile<3>601915
Ref: whatsnew/3 14 tarfile602023
Ref: 526602023
Ref: tarfile<3>-Footnote-1603125
Ref: tarfile<3>-Footnote-2603181
Ref: tarfile<3>-Footnote-3603236
Ref: tarfile<3>-Footnote-4603292
Ref: tarfile<3>-Footnote-5603348
Ref: tarfile<3>-Footnote-6603403
Ref: tarfile<3>-Footnote-7603459
Ref: tarfile<3>-Footnote-8603515
Node: threading<3>603570
Ref: whatsnew/3 14 threading603676
Ref: 527603676
Ref: threading<3>-Footnote-1603932
Node: tkinter<2>603987
Ref: whatsnew/3 14 tkinter604089
Ref: 528604089
Ref: tkinter<2>-Footnote-1604481
Ref: tkinter<2>-Footnote-2604537
Node: turtle604593
Ref: whatsnew/3 14 turtle604691
Ref: 529604691
Ref: turtle-Footnote-1604966
Node: types<3>605022
Ref: whatsnew/3 14 types605119
Ref: 52d605119
Ref: types<3>-Footnote-1605366
Node: typing<3>605422
Ref: whatsnew/3 14 typing605527
Ref: 530605527
Ref: whatsnew/3 14 whatsnew314-typing-union605560
Ref: 52f605560
Ref: typing<3>-Footnote-1608612
Ref: typing<3>-Footnote-2608654
Node: unicodedata<2>608710
Ref: whatsnew/3 14 unicodedata608818
Ref: 532608818
Node: unittest<2>608924
Ref: whatsnew/3 14 unittest609029
Ref: 533609029
Ref: whatsnew/3 14 whatsnew314-color-unittest609066
Ref: 534609066
Ref: unittest<2>-Footnote-1610232
Ref: unittest<2>-Footnote-2610288
Ref: unittest<2>-Footnote-3610343
Node: urllib610398
Ref: whatsnew/3 14 urllib610493
Ref: 53f610493
Ref: urllib-Footnote-1611959
Ref: urllib-Footnote-2612018
Ref: urllib-Footnote-3612074
Node: uuid612130
Ref: whatsnew/3 14 uuid612227
Ref: 544612227
Ref: uuid-Footnote-1612868
Ref: uuid-Footnote-2612927
Ref: uuid-Footnote-3612982
Ref: uuid-Footnote-4613041
Ref: uuid-Footnote-5613097
Node: webbrowser<2>613153
Ref: whatsnew/3 14 webbrowser613251
Ref: 54b613251
Node: zipfile613603
Ref: whatsnew/3 14 zipfile613688
Ref: 54c613688
Ref: zipfile-Footnote-1614182
Ref: zipfile-Footnote-2614238
Node: 最適化614293
Ref: whatsnew/3 14 optimizations614407
Ref: 550614407
Ref: 最適化-Footnote-1615683
Node: asyncio<4>615739
Ref: whatsnew/3 14 id2615813
Ref: 554615813
Ref: asyncio<4>-Footnote-1616569
Ref: asyncio<4>-Footnote-2616625
Node: base64<2>616681
Ref: whatsnew/3 14 base64616767
Ref: 555616767
Ref: base64<2>-Footnote-1616990
Node: bdb617046
Ref: whatsnew/3 14 bdb617132
Ref: 556617132
Ref: bdb-Footnote-1617441
Node: difflib<3>617497
Ref: whatsnew/3 14 id3617579
Ref: 558617579
Ref: difflib<3>-Footnote-1617790
Node: gc<2>617846
Ref: whatsnew/3 14 gc617930
Ref: 55a617930
Ref: gc<2>-Footnote-1619908
Ref: gc<2>-Footnote-2619964
Node: io<2>620020
Ref: whatsnew/3 14 id4620104
Ref: 55f620104
Ref: io<2>-Footnote-1620400
Ref: io<2>-Footnote-2620456
Node: pathlib<3>620511
Ref: whatsnew/3 14 id5620596
Ref: 560620596
Ref: pathlib<3>-Footnote-1620849
Node: pdb<3>620905
Ref: whatsnew/3 14 id6620993
Ref: 562620993
Ref: pdb<3>-Footnote-1621504
Node: textwrap621560
Ref: whatsnew/3 14 textwrap621645
Ref: 565621645
Node: uuid<2>621946
Ref: whatsnew/3 14 id7622032
Ref: 567622032
Ref: uuid<2>-Footnote-1622452
Ref: uuid<2>-Footnote-2622508
Node: zlib<2>622564
Ref: whatsnew/3 14 zlib622633
Ref: 56b622633
Ref: zlib<2>-Footnote-1623284
Ref: zlib<2>-Footnote-2623327
Node: 削除623382
Ref: whatsnew/3 14 removed623486
Ref: 56c623486
Node: argparse<3>623736
Ref: whatsnew/3 14 id8623805
Ref: 56d623805
Ref: argparse<3>-Footnote-1624599
Ref: argparse<3>-Footnote-2624655
Node: ast<4>624711
Ref: whatsnew/3 14 id9624799
Ref: 56f624799
Ref: ast<4>-Footnote-1625878
Ref: ast<4>-Footnote-2625934
Node: asyncio<5>625990
Ref: whatsnew/3 14 id10626075
Ref: 572626075
Ref: asyncio<5>-Footnote-1628880
Ref: asyncio<5>-Footnote-2628936
Node: email<2>628992
Ref: whatsnew/3 14 email629084
Ref: 575629084
Ref: email<2>-Footnote-1629345
Node: importlib abc629401
Ref: whatsnew/3 14 importlib-abc629492
Ref: 577629492
Ref: importlib abc-Footnote-1629920
Node: itertools629975
Ref: whatsnew/3 14 itertools630068
Ref: 57a630068
Ref: itertools-Footnote-1630381
Node: pathlib<4>630437
Ref: whatsnew/3 14 id11630524
Ref: 57b630524
Ref: pathlib<4>-Footnote-1631048
Ref: pathlib<4>-Footnote-2631103
Node: pkgutil631158
Ref: whatsnew/3 14 pkgutil631239
Ref: 57e631239
Ref: pkgutil-Footnote-1631485
Node: pty631540
Ref: whatsnew/3 14 pty631621
Ref: 57f631621
Ref: pty-Footnote-1631899
Node: sqlite3<2>631955
Ref: whatsnew/3 14 sqlite3632038
Ref: 581632038
Ref: sqlite3<2>-Footnote-1632626
Ref: sqlite3<2>-Footnote-2632682
Ref: sqlite3<2>-Footnote-3632738
Node: urllib<2>632794
Ref: whatsnew/3 14 id12632865
Ref: 585632865
Ref: urllib<2>-Footnote-1633577
Ref: urllib<2>-Footnote-2633633
Node: 非推奨633688
Ref: whatsnew/3 14 deprecated633818
Ref: 589633818
Node: New deprecations<2>634387
Ref: whatsnew/3 14 new-deprecations634491
Ref: 58a634491
Ref: New deprecations<2>-Footnote-1640570
Ref: New deprecations<2>-Footnote-2640626
Ref: New deprecations<2>-Footnote-3640682
Ref: New deprecations<2>-Footnote-4640737
Ref: New deprecations<2>-Footnote-5640793
Ref: New deprecations<2>-Footnote-6640849
Ref: New deprecations<2>-Footnote-7640905
Ref: New deprecations<2>-Footnote-8640961
Ref: New deprecations<2>-Footnote-9641017
Ref: New deprecations<2>-Footnote-10641073
Ref: New deprecations<2>-Footnote-11641130
Ref: New deprecations<2>-Footnote-12641186
Ref: New deprecations<2>-Footnote-13641243
Ref: New deprecations<2>-Footnote-14641300
Ref: New deprecations<2>-Footnote-15641357
Ref: New deprecations<2>-Footnote-16641400
Ref: New deprecations<2>-Footnote-17641457
Ref: New deprecations<2>-Footnote-18641514
Ref: New deprecations<2>-Footnote-19641571
Ref: New deprecations<2>-Footnote-20641628
Node: Pending removal in Python 3 15641685
Ref: whatsnew/3 14 pending-removal-in-python-3-15641831
Ref: 591641831
Ref: Pending removal in Python 3 15-Footnote-1645981
Ref: Pending removal in Python 3 15-Footnote-2646036
Ref: Pending removal in Python 3 15-Footnote-3646091
Ref: Pending removal in Python 3 15-Footnote-4646133
Ref: Pending removal in Python 3 15-Footnote-5646189
Node: Pending removal in Python 3 16<2>646245
Ref: whatsnew/3 14 pending-removal-in-python-3-16646405
Ref: 595646405
Ref: Pending removal in Python 3 16<2>-Footnote-1650663
Ref: Pending removal in Python 3 16<2>-Footnote-2650719
Ref: Pending removal in Python 3 16<2>-Footnote-3650775
Ref: Pending removal in Python 3 16<2>-Footnote-4650831
Node: Pending removal in Python 3 17<2>650886
Ref: whatsnew/3 14 pending-removal-in-python-3-17651049
Ref: 596651049
Ref: Pending removal in Python 3 17<2>-Footnote-1654650
Ref: Pending removal in Python 3 17<2>-Footnote-2654705
Ref: Pending removal in Python 3 17<2>-Footnote-3654763
Ref: Pending removal in Python 3 17<2>-Footnote-4654818
Ref: Pending removal in Python 3 17<2>-Footnote-5654874
Ref: Pending removal in Python 3 17<2>-Footnote-6654930
Ref: Pending removal in Python 3 17<2>-Footnote-7654988
Node: Pending removal in Python 3 18<2>655043
Ref: whatsnew/3 14 pending-removal-in-python-3-18655206
Ref: 597655206
Ref: Pending removal in Python 3 18<2>-Footnote-1655936
Ref: Pending removal in Python 3 18<2>-Footnote-2655991
Ref: Pending removal in Python 3 18<2>-Footnote-3656046
Ref: Pending removal in Python 3 18<2>-Footnote-4656088
Node: Pending removal in Python 3 19<2>656144
Ref: whatsnew/3 14 pending-removal-in-python-3-19656307
Ref: 598656307
Node: Pending removal in Python 3 20<2>658101
Ref: whatsnew/3 14 pending-removal-in-python-3-20658268
Ref: 599658268
Ref: Pending removal in Python 3 20<2>-Footnote-1660449
Ref: Pending removal in Python 3 20<2>-Footnote-2660505
Ref: Pending removal in Python 3 20<2>-Footnote-3660560
Ref: Pending removal in Python 3 20<2>-Footnote-4660602
Node: Pending removal in future versions<2>660658
Ref: whatsnew/3 14 pending-removal-in-future-versions660783
Ref: 59a660783
Ref: Pending removal in future versions<2>-Footnote-1668397
Ref: Pending removal in future versions<2>-Footnote-2668452
Ref: Pending removal in future versions<2>-Footnote-3668508
Ref: Pending removal in future versions<2>-Footnote-4668564
Ref: Pending removal in future versions<2>-Footnote-5668620
Ref: Pending removal in future versions<2>-Footnote-6668675
Ref: Pending removal in future versions<2>-Footnote-7668730
Node: CPython バイトコードの変更668786
Ref: whatsnew/3 14 cpython-bytecode-changes668926
Ref: 59b668926
Ref: CPython バイトコードの変更-Footnote-1670838
Ref: CPython バイトコードの変更-Footnote-2670894
Ref: CPython バイトコードの変更-Footnote-3670950
Ref: CPython バイトコードの変更-Footnote-4671006
Ref: CPython バイトコードの変更-Footnote-5671062
Ref: CPython バイトコードの変更-Footnote-6671118
Ref: CPython バイトコードの変更-Footnote-7671174
Node: Pseudo-instructions671230
Ref: whatsnew/3 14 pseudo-instructions671321
Ref: 5a7671321
Ref: Pseudo-instructions-Footnote-1672953
Ref: Pseudo-instructions-Footnote-2673009
Ref: Pseudo-instructions-Footnote-3673065
Ref: Pseudo-instructions-Footnote-4673121
Ref: Pseudo-instructions-Footnote-5673177
Ref: Pseudo-instructions-Footnote-6673233
Ref: Pseudo-instructions-Footnote-7673289
Node: C API changes<3>673345
Ref: whatsnew/3 14 c-api-changes673492
Ref: 5ac673492
Node: Python configuration C API673712
Ref: whatsnew/3 14 python-configuration-c-api673825
Ref: 5ad673825
Ref: whatsnew/3 14 whatsnew314-capi-config673825
Ref: 409673825
Ref: Python configuration C API-Footnote-1675150
Ref: Python configuration C API-Footnote-2675192
Ref: Python configuration C API-Footnote-3675234
Ref: Python configuration C API-Footnote-4675290
Ref: Python configuration C API-Footnote-5675332
Node: New features in the C API675374
Ref: whatsnew/3 14 new-features-in-the-c-api675517
Ref: 5b2675517
Ref: New features in the C API-Footnote-1682668
Ref: New features in the C API-Footnote-2682724
Ref: New features in the C API-Footnote-3682780
Ref: New features in the C API-Footnote-4682836
Ref: New features in the C API-Footnote-5682892
Ref: New features in the C API-Footnote-6682948
Ref: New features in the C API-Footnote-7683004
Ref: New features in the C API-Footnote-8683060
Ref: New features in the C API-Footnote-9683116
Ref: New features in the C API-Footnote-10683172
Ref: New features in the C API-Footnote-11683229
Ref: New features in the C API-Footnote-12683286
Ref: New features in the C API-Footnote-13683329
Ref: New features in the C API-Footnote-14683386
Ref: New features in the C API-Footnote-15683443
Ref: New features in the C API-Footnote-16683500
Ref: New features in the C API-Footnote-17683557
Ref: New features in the C API-Footnote-18683614
Ref: New features in the C API-Footnote-19683671
Ref: New features in the C API-Footnote-20683728
Ref: New features in the C API-Footnote-21683785
Ref: New features in the C API-Footnote-22683851
Ref: New features in the C API-Footnote-23683908
Ref: New features in the C API-Footnote-24683951
Ref: New features in the C API-Footnote-25684008
Node: Limited C API changes684065
Ref: whatsnew/3 14 limited-c-api-changes684199
Ref: 5fb684199
Ref: Limited C API changes-Footnote-1684845
Ref: Limited C API changes-Footnote-2684901
Ref: Limited C API changes-Footnote-3684957
Node: Removed C APIs<3>685012
Ref: whatsnew/3 14 removed-c-apis685141
Ref: 600685141
Ref: whatsnew/3 14 whatsnew314-c-api-removed685141
Ref: 601685141
Ref: Removed C APIs<3>-Footnote-1686170
Ref: Removed C APIs<3>-Footnote-2686226
Ref: Removed C APIs<3>-Footnote-3686282
Ref: Removed C APIs<3>-Footnote-4686324
Ref: Removed C APIs<3>-Footnote-5686380
Ref: Removed C APIs<3>-Footnote-6686436
Node: Deprecated C APIs<3>686492
Ref: whatsnew/3 14 deprecated-c-apis686591
Ref: 606686591
Ref: whatsnew/3 14 whatsnew314-c-api-deprecated686591
Ref: 607686591
Ref: Deprecated C APIs<3>-Footnote-1688212
Ref: Deprecated C APIs<3>-Footnote-2688268
Ref: Deprecated C APIs<3>-Footnote-3688324
Ref: Deprecated C APIs<3>-Footnote-4688379
Node: Pending removal in Python 3 15<2>688435
Ref: whatsnew/3 14 id13688567
Ref: 60d688567
Ref: Pending removal in Python 3 15<2>-Footnote-1694990
Ref: Pending removal in Python 3 15<2>-Footnote-2695043
Node: Pending removal in Python 3 16<3>695096
Ref: whatsnew/3 14 id14695270
Ref: 639695270
Node: Pending removal in Python 3 18<3>695393
Ref: whatsnew/3 14 id15695571
Ref: 63a695571
Ref: Pending removal in Python 3 18<3>-Footnote-1698246
Ref: Pending removal in Python 3 18<3>-Footnote-2698299
Node: Pending removal in future versions<3>698355
Ref: whatsnew/3 14 id16698491
Ref: 640698491
Node: Build changes<3>700330
Ref: whatsnew/3 14 build-changes700464
Ref: 65c700464
Ref: whatsnew/3 14 whatsnew314-build-changes700464
Ref: 40a700464
Ref: Build changes<3>-Footnote-1702988
Ref: Build changes<3>-Footnote-2703030
Ref: Build changes<3>-Footnote-3703079
Ref: Build changes<3>-Footnote-4703160
Ref: Build changes<3>-Footnote-5703216
Ref: Build changes<3>-Footnote-6703272
Ref: Build changes<3>-Footnote-7703328
Ref: Build changes<3>-Footnote-8703378
Ref: Build changes<3>-Footnote-9703434
Ref: Build changes<3>-Footnote-10703476
Ref: Build changes<3>-Footnote-11703533
Ref: Build changes<3>-Footnote-12703590
Ref: Build changes<3>-Footnote-13703647
Ref: Build changes<3>-Footnote-14703703
Ref: Build changes<3>-Footnote-15703760
Node: build-details json703817
Ref: whatsnew/3 14 build-details-json703930
Ref: 661703930
Ref: whatsnew/3 14 whatsnew314-build-details703930
Ref: 662703930
Ref: build-details json-Footnote-1704679
Node: Discontinuation of PGP signatures704721
Ref: whatsnew/3 14 discontinuation-of-pgp-signatures704887
Ref: 664704887
Ref: whatsnew/3 14 whatsnew314-no-more-pgp704887
Ref: 40c704887
Ref: Discontinuation of PGP signatures-Footnote-1705323
Ref: Discontinuation of PGP signatures-Footnote-2705383
Ref: Discontinuation of PGP signatures-Footnote-3705417
Node: Free-threaded Python is officially supported705459
Ref: whatsnew/3 14 free-threaded-python-is-officially-supported705665
Ref: 665705665
Ref: whatsnew/3 14 whatsnew314-free-threaded-now-supported705665
Ref: 40b705665
Ref: Free-threaded Python is officially supported-Footnote-1706765
Ref: Free-threaded Python is officially supported-Footnote-2706808
Ref: Free-threaded Python is officially supported-Footnote-3706851
Ref: Free-threaded Python is officially supported-Footnote-4706893
Node: Binary releases for the experimental just-in-time compiler706940
Ref: whatsnew/3 14 binary-releases-for-the-experimental-just-in-time-compiler707104
Ref: 666707104
Ref: whatsnew/3 14 whatsnew314-jit-compiler707104
Ref: 40d707104
Ref: Binary releases for the experimental just-in-time compiler-Footnote-1708642
Node: Porting to Python 3 14708684
Ref: whatsnew/3 14 porting-to-python-3-14708827
Ref: 400708827
Node: Python API の変更709183
Ref: whatsnew/3 14 changes-in-the-python-api709313
Ref: 66b709313
Ref: Python API の変更-Footnote-1711707
Ref: Python API の変更-Footnote-2711763
Ref: Python API の変更-Footnote-3711818
Node: Changes in annotations PEP 649 and PEP 749711874
Ref: whatsnew/3 14 changes-in-annotations-pep-649-and-pep-749712028
Ref: 66f712028
Ref: whatsnew/3 14 whatsnew314-porting-annotations712028
Ref: 415712028
Node: Implications for annotated code712593
Ref: whatsnew/3 14 implications-for-annotated-code712755
Ref: 670712755
Node: Implications for readers of __annotations__713546
Ref: whatsnew/3 14 implications-for-readers-of-annotations713732
Ref: 671713732
Ref: Implications for readers of __annotations__-Footnote-1714553
Node: Related changes714605
Ref: whatsnew/3 14 related-changes714794
Ref: 674714794
Node: from __future__ import annotations715838
Ref: whatsnew/3 14 from-future-import-annotations715975
Ref: 676715975
Ref: from __future__ import annotations-Footnote-1716644
Node: C API の変更716686
Ref: whatsnew/3 14 changes-in-the-c-api716811
Ref: 678716811
Ref: whatsnew/3 14 whatsnew314-refcount717742
Ref: 553717742
Ref: C API の変更-Footnote-1719938
Ref: C API の変更-Footnote-2719994
Ref: C API の変更-Footnote-3720050
Node: Notable changes in 3 14 5720103
Ref: whatsnew/3 14 notable-changes-in-3-14-5720221
Ref: 67e720221
Ref: whatsnew/3 14 pythoncapi-compat-project720221
Ref: 67f720221
Node: gc<3>720311
Ref: whatsnew/3 14 id19720378
Ref: 680720378
Ref: gc<3>-Footnote-1720741
Node: What's New In Python 3 13720797
Ref: whatsnew/3 13 doc720947
Ref: 681720947
Ref: whatsnew/3 13 translation-repo720947
Ref: 682720947
Ref: whatsnew/3 13 what-s-new-in-python-3-13720947
Ref: 683720947
Ref: What's New In Python 3 13-Footnote-1721857
Node: 概要 -- リリースハイライト<2>721899
Ref: whatsnew/3 13 summary-release-highlights722028
Ref: 684722028
Ref: 概要 -- リリースハイライト<2>-Footnote-1731259
Ref: 概要 -- リリースハイライト<2>-Footnote-2731301
Ref: 概要 -- リリースハイライト<2>-Footnote-3731343
Ref: 概要 -- リリースハイライト<2>-Footnote-4731385
Ref: 概要 -- リリースハイライト<2>-Footnote-5731427
Ref: 概要 -- リリースハイライト<2>-Footnote-6731469
Ref: 概要 -- リリースハイライト<2>-Footnote-7731511
Ref: 概要 -- リリースハイライト<2>-Footnote-8731541
Ref: 概要 -- リリースハイライト<2>-Footnote-9731581
Ref: 概要 -- リリースハイライト<2>-Footnote-10731623
Ref: 概要 -- リリースハイライト<2>-Footnote-11731666
Ref: 概要 -- リリースハイライト<2>-Footnote-12731709
Ref: 概要 -- リリースハイライト<2>-Footnote-13731752
Ref: 概要 -- リリースハイライト<2>-Footnote-14731795
Ref: 概要 -- リリースハイライト<2>-Footnote-15731838
Ref: 概要 -- リリースハイライト<2>-Footnote-16731888
Ref: 概要 -- リリースハイライト<2>-Footnote-17731931
Ref: 概要 -- リリースハイライト<2>-Footnote-18731981
Ref: 概要 -- リリースハイライト<2>-Footnote-19732031
Node: 新しい機能<2>732074
Ref: whatsnew/3 13 new-features732236
Ref: 6a1732236
Node: 改善された対話的インタープリタ732662
Ref: whatsnew/3 13 a-better-interactive-interpreter732807
Ref: 6a2732807
Ref: whatsnew/3 13 whatsnew313-better-interactive-interpreter732807
Ref: 685732807
Ref: 改善された対話的インタープリタ-Footnote-1734722
Ref: 改善された対話的インタープリタ-Footnote-2734748
Node: エラーメッセージの改善<2>734804
Ref: whatsnew/3 13 improved-error-messages734990
Ref: 6a7734990
Ref: whatsnew/3 13 whatsnew313-improved-error-messages734990
Ref: 68b734990
Ref: エラーメッセージの改善<2>-Footnote-1737897
Ref: エラーメッセージの改善<2>-Footnote-2737927
Ref: エラーメッセージの改善<2>-Footnote-3737960
Ref: エラーメッセージの改善<2>-Footnote-4738016
Ref: エラーメッセージの改善<2>-Footnote-5738071
Node: フリースレッドの CPython738127
Ref: whatsnew/3 13 free-threaded-cpython738313
Ref: 6a8738313
Ref: whatsnew/3 13 whatsnew313-free-threaded-cpython738313
Ref: 686738313
Ref: フリースレッドの CPython-Footnote-1742474
Ref: フリースレッドの CPython-Footnote-2742516
Node: 実験的な Just-in-time JIT コンパイラ742569
Ref: whatsnew/3 13 an-experimental-just-in-time-jit-compiler742756
Ref: 6b0742756
Ref: whatsnew/3 13 whatsnew313-jit-compiler742756
Ref: 687742756
Ref: 実験的な Just-in-time JIT コンパイラ-Footnote-1745494
Ref: 実験的な Just-in-time JIT コンパイラ-Footnote-2745566
Node: Defined mutation semantics for locals745608
Ref: whatsnew/3 13 defined-mutation-semantics-for-locals745791
Ref: 6b2745791
Ref: whatsnew/3 13 whatsnew313-locals-semantics745791
Ref: 688745791
Ref: Defined mutation semantics for locals-Footnote-1748402
Ref: Defined mutation semantics for locals-Footnote-2748444
Ref: Defined mutation semantics for locals-Footnote-3748486
Node: Support for mobile platforms748541
Ref: whatsnew/3 13 support-for-mobile-platforms748670
Ref: 6b7748670
Ref: whatsnew/3 13 whatsnew313-platform-support748670
Ref: 69f748670
Ref: Support for mobile platforms-Footnote-1749711
Ref: Support for mobile platforms-Footnote-2749753
Ref: Support for mobile platforms-Footnote-3749795
Ref: Support for mobile platforms-Footnote-4749851
Ref: Support for mobile platforms-Footnote-5749893
Ref: Support for mobile platforms-Footnote-6749935
Ref: Support for mobile platforms-Footnote-7749991
Ref: Support for mobile platforms-Footnote-8750033
Node: その他の言語変更750075
Ref: whatsnew/3 13 other-language-changes750221
Ref: 6b8750221
Ref: その他の言語変更-Footnote-1755042
Ref: その他の言語変更-Footnote-2755097
Ref: その他の言語変更-Footnote-3755153
Ref: その他の言語変更-Footnote-4755209
Ref: その他の言語変更-Footnote-5755265
Ref: その他の言語変更-Footnote-6755321
Ref: その他の言語変更-Footnote-7755377
Ref: その他の言語変更-Footnote-8755426
Ref: その他の言語変更-Footnote-9755482
Ref: その他の言語変更-Footnote-10755537
Ref: その他の言語変更-Footnote-11755594
Ref: その他の言語変更-Footnote-12755651
Ref: その他の言語変更-Footnote-13755708
Ref: その他の言語変更-Footnote-14755765
Ref: その他の言語変更-Footnote-15755822
Ref: その他の言語変更-Footnote-16755879
Ref: その他の言語変更-Footnote-17755936
Ref: その他の言語変更-Footnote-18755992
Node: 新たなモジュール756049
Ref: whatsnew/3 13 new-modules756207
Ref: 6c7756207
Ref: 新たなモジュール-Footnote-1756449
Node: 改良されたモジュール756505
Ref: whatsnew/3 13 improved-modules756651
Ref: 6c8756651
Node: argparse<4>757687
Ref: whatsnew/3 13 argparse757780
Ref: 6c9757780
Ref: argparse<4>-Footnote-1758103
Node: 配列758158
Ref: whatsnew/3 13 array758266
Ref: 6ca758266
Ref: 配列-Footnote-1758702
Ref: 配列-Footnote-2758757
Node: ast<5>758813
Ref: whatsnew/3 13 ast758920
Ref: 6ce758920
Ref: ast<5>-Footnote-1760480
Ref: ast<5>-Footnote-2760536
Ref: ast<5>-Footnote-3760592
Ref: ast<5>-Footnote-4760648
Node: asyncio<6>760704
Ref: whatsnew/3 13 asyncio760814
Ref: 6d1760814
Ref: asyncio<6>-Footnote-1764574
Ref: asyncio<6>-Footnote-2764629
Ref: asyncio<6>-Footnote-3764685
Ref: asyncio<6>-Footnote-4764741
Ref: asyncio<6>-Footnote-5764797
Ref: asyncio<6>-Footnote-6764853
Ref: asyncio<6>-Footnote-7764908
Ref: asyncio<6>-Footnote-8764964
Ref: asyncio<6>-Footnote-9765020
Node: base64<3>765076
Ref: whatsnew/3 13 base64765190
Ref: 6e4765190
Ref: base64<3>-Footnote-1765485
Ref: base64<3>-Footnote-2765525
Node: compileall765580
Ref: whatsnew/3 13 compileall765705
Ref: 6e5765705
Ref: compileall-Footnote-1765997
Node: concurrent futures<3>766053
Ref: whatsnew/3 13 concurrent-futures766184
Ref: 6e8766184
Ref: concurrent futures<3>-Footnote-1766492
Node: configparser<2>766548
Ref: whatsnew/3 13 configparser766673
Ref: 6e9766673
Ref: configparser<2>-Footnote-1767003
Node: copy767058
Ref: whatsnew/3 13 copy767171
Ref: 6eb767171
Ref: copy-Footnote-1768082
Node: ctypes<3>768138
Ref: whatsnew/3 13 ctypes768242
Ref: 6f2768242
Ref: ctypes<3>-Footnote-1769175
Ref: ctypes<3>-Footnote-2769231
Node: dbm<2>769287
Ref: whatsnew/3 13 dbm769393
Ref: 6f4769393
Ref: dbm<2>-Footnote-1769847
Ref: dbm<2>-Footnote-2769903
Node: dis<2>769959
Ref: whatsnew/3 13 dis770063
Ref: 6f5770063
Ref: dis<2>-Footnote-1770811
Ref: dis<2>-Footnote-2770867
Node: doctest770923
Ref: whatsnew/3 13 doctest771029
Ref: 6f8771029
Ref: whatsnew/3 13 whatsnew313-doctest771029
Ref: 68d771029
Ref: doctest-Footnote-1771672
Ref: doctest-Footnote-2771702
Ref: doctest-Footnote-3771735
Ref: doctest-Footnote-4771791
Node: email<3>771847
Ref: whatsnew/3 13 email771951
Ref: 6fc771951
Ref: email<3>-Footnote-1773083
Ref: email<3>-Footnote-2773139
Ref: email<3>-Footnote-3773195
Node: enum773251
Ref: whatsnew/3 13 enum773360
Ref: 700773360
Node: fractions<2>773493
Ref: whatsnew/3 13 fractions773601
Ref: 703773601
Ref: fractions<2>-Footnote-1773919
Node: glob<2>773975
Ref: whatsnew/3 13 glob774088
Ref: 705774088
Ref: glob<2>-Footnote-1774337
Node: importlib774392
Ref: whatsnew/3 13 importlib774498
Ref: 707774498
Ref: importlib-Footnote-1775399
Ref: importlib-Footnote-2775455
Node: io<3>775511
Ref: whatsnew/3 13 io775619
Ref: 70f775619
Ref: io<3>-Footnote-1776045
Node: ipaddress776100
Ref: whatsnew/3 13 ipaddress776211
Ref: 714776211
Ref: ipaddress-Footnote-1776670
Ref: ipaddress-Footnote-2776726
Node: itertools<2>776782
Ref: whatsnew/3 13 itertools776895
Ref: 71a776895
Ref: itertools<2>-Footnote-1777195
Node: marshal777251
Ref: whatsnew/3 13 marshal777362
Ref: 71c777362
Ref: marshal-Footnote-1777697
Node: math<3>777753
Ref: whatsnew/3 13 math777864
Ref: 71d777864
Ref: math<3>-Footnote-1778355
Node: mimetypes<4>778410
Ref: whatsnew/3 13 mimetypes778521
Ref: 71f778521
Ref: mimetypes<4>-Footnote-1778838
Node: mmap<2>778893
Ref: whatsnew/3 13 mmap779015
Ref: 722779015
Ref: mmap<2>-Footnote-1779828
Ref: mmap<2>-Footnote-2779884
Ref: mmap<2>-Footnote-3779940
Node: multiprocessing<2>779995
Ref: whatsnew/3 13 multiprocessing780110
Ref: 725780110
Ref: multiprocessing<2>-Footnote-1780414
Node: os<4>780470
Ref: whatsnew/3 13 os780588
Ref: 726780588
Ref: os<4>-Footnote-1783054
Ref: os<4>-Footnote-2783110
Ref: os<4>-Footnote-3783166
Ref: os<4>-Footnote-4783220
Ref: os<4>-Footnote-5783276
Ref: os<4>-Footnote-6783331
Ref: os<4>-Footnote-7783387
Ref: os<4>-Footnote-8783442
Ref: os<4>-Footnote-9783498
Ref: os<4>-Footnote-10783554
Node: os path<3>783611
Ref: whatsnew/3 13 os-path783721
Ref: 738783721
Ref: os path<3>-Footnote-1784344
Ref: os path<3>-Footnote-2784399
Ref: os path<3>-Footnote-3784454
Node: pathlib<5>784509
Ref: whatsnew/3 13 pathlib784620
Ref: 73a784620
Ref: pathlib<5>-Footnote-1786134
Ref: pathlib<5>-Footnote-2786189
Ref: pathlib<5>-Footnote-3786245
Ref: pathlib<5>-Footnote-4786300
Ref: pathlib<5>-Footnote-5786355
Ref: pathlib<5>-Footnote-6786410
Ref: pathlib<5>-Footnote-7786466
Node: pdb<4>786522
Ref: whatsnew/3 13 pdb786628
Ref: 745786628
Ref: pdb<4>-Footnote-1787763
Ref: pdb<4>-Footnote-2787819
Ref: pdb<4>-Footnote-3787875
Ref: pdb<4>-Footnote-4787931
Ref: pdb<4>-Footnote-5787987
Node: queue788043
Ref: whatsnew/3 13 queue788145
Ref: 749788145
Ref: queue-Footnote-1788380
Node: random788436
Ref: whatsnew/3 13 random788537
Ref: 74c788537
Ref: random-Footnote-1788711
Node: re<3>788767
Ref: whatsnew/3 13 re788872
Ref: 74d788872
Node: shutil<2>789031
Ref: whatsnew/3 13 shutil789134
Ref: 74f789134
Ref: shutil<2>-Footnote-1789362
Node: site789417
Ref: whatsnew/3 13 site789525
Ref: 751789525
Ref: site-Footnote-1789776
Node: sqlite3<3>789832
Ref: whatsnew/3 13 sqlite3789937
Ref: 753789937
Ref: sqlite3<3>-Footnote-1790378
Ref: sqlite3<3>-Footnote-2790434
Node: ssl<3>790489
Ref: whatsnew/3 13 ssl790600
Ref: 757790600
Ref: ssl<3>-Footnote-1791291
Ref: ssl<3>-Footnote-2791350
Node: statistics791406
Ref: whatsnew/3 13 statistics791520
Ref: 759791520
Ref: statistics-Footnote-1792029
Ref: statistics-Footnote-2792085
Node: subprocess<2>792141
Ref: whatsnew/3 13 subprocess792255
Ref: 75c792255
Ref: whatsnew/3 13 whatsnew313-subprocess792255
Ref: 75d792255
Ref: subprocess<2>-Footnote-1793195
Node: sys<4>793251
Ref: whatsnew/3 13 sys793363
Ref: 75f793363
Ref: sys<4>-Footnote-1793652
Node: tempfile793707
Ref: whatsnew/3 13 tempfile793810
Ref: 761793810
Ref: tempfile-Footnote-1794155
Ref: tempfile-Footnote-2794210
Node: time794266
Ref: whatsnew/3 13 time794373
Ref: 762794373
Ref: time-Footnote-1795021
Ref: time-Footnote-2795076
Node: tkinter<3>795131
Ref: whatsnew/3 13 tkinter795239
Ref: 765795239
Ref: tkinter<3>-Footnote-1797503
Ref: tkinter<3>-Footnote-2797558
Ref: tkinter<3>-Footnote-3797613
Ref: tkinter<3>-Footnote-4797668
Ref: tkinter<3>-Footnote-5797723
Ref: tkinter<3>-Footnote-6797778
Ref: tkinter<3>-Footnote-7797833
Ref: tkinter<3>-Footnote-8797889
Ref: tkinter<3>-Footnote-9797945
Node: traceback798001
Ref: whatsnew/3 13 traceback798113
Ref: 768798113
Ref: traceback-Footnote-1798843
Ref: traceback-Footnote-2798899
Node: types<4>798955
Ref: whatsnew/3 13 types799066
Ref: 76e799066
Ref: types<4>-Footnote-1799391
Node: typing<4>799447
Ref: whatsnew/3 13 typing799563
Ref: 76f799563
Ref: typing<4>-Footnote-1800549
Ref: typing<4>-Footnote-2800591
Ref: typing<4>-Footnote-3800633
Ref: typing<4>-Footnote-4800689
Ref: typing<4>-Footnote-5800745
Ref: typing<4>-Footnote-6800801
Node: unicodedata<3>800856
Ref: whatsnew/3 13 unicodedata800971
Ref: 776800971
Ref: unicodedata<3>-Footnote-1801159
Ref: unicodedata<3>-Footnote-2801215
Node: venv<2>801271
Ref: whatsnew/3 13 venv801388
Ref: 777801388
Ref: venv<2>-Footnote-1801880
Node: warnings<2>801936
Ref: whatsnew/3 13 warnings802045
Ref: 77a802045
Ref: warnings<2>-Footnote-1802509
Ref: warnings<2>-Footnote-2802551
Node: xml<2>802607
Ref: whatsnew/3 13 xml802721
Ref: 77c802721
Ref: xml<2>-Footnote-1803487
Ref: xml<2>-Footnote-2803543
Ref: xml<2>-Footnote-3803599
Node: zipimport<2>803654
Ref: whatsnew/3 13 zipimport803748
Ref: 781803748
Ref: zipimport<2>-Footnote-1803952
Ref: zipimport<2>-Footnote-2804014
Node: 最適化<2>804069
Ref: whatsnew/3 13 optimizations804215
Ref: 782804215
Ref: 最適化<2>-Footnote-1805411
Ref: 最適化<2>-Footnote-2805467
Ref: 最適化<2>-Footnote-3805523
Node: Removed Modules And APIs805579
Ref: whatsnew/3 13 removed-modules-and-apis805711
Ref: 784805711
Node: PEP 594 Remove "dead batteries" from the standard library806228
Ref: whatsnew/3 13 pep-594-remove-dead-batteries-from-the-standard-library806359
Ref: 785806359
Ref: whatsnew/3 13 whatsnew313-pep594806359
Ref: 689806359
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-1811617
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-2811659
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-3811707
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-4811753
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-5811802
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-6811846
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-7811890
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-8811937
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-9811986
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-10812027
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-11812074
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-12812121
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-13812164
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-14812212
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-15812262
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-16812326
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-17812370
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-18812415
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-19812463
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-20812514
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-21812566
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-22812608
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-23812660
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-24812702
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-25812752
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-26812796
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-27812841
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-28812889
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-29812940
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-30812986
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-31813036
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-32813082
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-33813126
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-34813180
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-35813227
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-36813278
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-37813335
Node: 2to3813392
Ref: whatsnew/3 13 to3813540
Ref: 788813540
Ref: 2to3-Footnote-1813767
Node: builtins813823
Ref: whatsnew/3 13 builtins813929
Ref: 789813929
Ref: builtins-Footnote-1814666
Ref: builtins-Footnote-2814721
Ref: builtins-Footnote-3814776
Node: configparser<3>814831
Ref: whatsnew/3 13 id3814951
Ref: 78b814951
Ref: configparser<3>-Footnote-1815235
Node: importlib metadata815291
Ref: whatsnew/3 13 importlib-metadata815412
Ref: 78c815412
Ref: importlib metadata-Footnote-1815669
Node: locale<2>815725
Ref: whatsnew/3 13 locale815837
Ref: 78f815837
Ref: locale<2>-Footnote-1816100
Node: opcode816156
Ref: whatsnew/3 13 opcode816258
Ref: 790816258
Ref: opcode-Footnote-1816883
Ref: opcode-Footnote-2816939
Node: optparse816995
Ref: whatsnew/3 13 optparse817098
Ref: 791817098
Ref: optparse-Footnote-1817886
Node: pathlib<6>817942
Ref: whatsnew/3 13 id4818044
Ref: 792818044
Ref: pathlib<6>-Footnote-1818322
Node: re<4>818377
Ref: whatsnew/3 13 id5818482
Ref: 793818482
Ref: re<4>-Footnote-1818748
Node: tkinter tix818804
Ref: whatsnew/3 13 tkinter-tix818908
Ref: 794818908
Ref: tkinter tix-Footnote-1819183
Node: turtle<2>819238
Ref: whatsnew/3 13 turtle819346
Ref: 795819346
Ref: turtle<2>-Footnote-1819624
Node: typing<5>819680
Ref: whatsnew/3 13 id6819788
Ref: 796819788
Ref: typing<5>-Footnote-1820274
Ref: typing<5>-Footnote-2820329
Node: unittest<3>820385
Ref: whatsnew/3 13 unittest820493
Ref: 797820493
Ref: unittest<3>-Footnote-1821195
Ref: unittest<3>-Footnote-2821251
Node: urllib<3>821307
Ref: whatsnew/3 13 urllib821419
Ref: 79c821419
Ref: urllib<3>-Footnote-1822024
Node: webbrowser<3>822080
Ref: whatsnew/3 13 webbrowser822172
Ref: 79e822172
Ref: webbrowser<3>-Footnote-1822663
Ref: webbrowser<3>-Footnote-2822719
Node: New Deprecations822775
Ref: whatsnew/3 13 new-deprecations822919
Ref: 7a0822919
Ref: New Deprecations-Footnote-1831556
Ref: New Deprecations-Footnote-2831611
Ref: New Deprecations-Footnote-3831666
Ref: New Deprecations-Footnote-4831722
Ref: New Deprecations-Footnote-5831778
Ref: New Deprecations-Footnote-6831833
Ref: New Deprecations-Footnote-7831889
Ref: New Deprecations-Footnote-8831944
Ref: New Deprecations-Footnote-9832000
Ref: New Deprecations-Footnote-10832056
Ref: New Deprecations-Footnote-11832113
Ref: New Deprecations-Footnote-12832169
Ref: New Deprecations-Footnote-13832225
Ref: New Deprecations-Footnote-14832281
Ref: New Deprecations-Footnote-15832338
Ref: New Deprecations-Footnote-16832394
Ref: New Deprecations-Footnote-17832451
Ref: New Deprecations-Footnote-18832508
Ref: New Deprecations-Footnote-19832565
Ref: New Deprecations-Footnote-20832621
Ref: New Deprecations-Footnote-21832678
Ref: New Deprecations-Footnote-22832735
Ref: New Deprecations-Footnote-23832792
Ref: New Deprecations-Footnote-24832849
Ref: New Deprecations-Footnote-25832906
Ref: New Deprecations-Footnote-26832963
Ref: New Deprecations-Footnote-27833020
Node: Pending removal in Python 3 14833077
Ref: whatsnew/3 13 pending-removal-in-python-3-14833202
Ref: 7ac833202
Ref: Pending removal in Python 3 14-Footnote-1837420
Ref: Pending removal in Python 3 14-Footnote-2837475
Ref: Pending removal in Python 3 14-Footnote-3837530
Ref: Pending removal in Python 3 14-Footnote-4837585
Ref: Pending removal in Python 3 14-Footnote-5837640
Ref: Pending removal in Python 3 14-Footnote-6837696
Ref: Pending removal in Python 3 14-Footnote-7837751
Ref: Pending removal in Python 3 14-Footnote-8837806
Ref: Pending removal in Python 3 14-Footnote-9837862
Ref: Pending removal in Python 3 14-Footnote-10837917
Ref: Pending removal in Python 3 14-Footnote-11837973
Node: Pending removal in Python 3 15<3>838029
Ref: whatsnew/3 13 pending-removal-in-python-3-15838196
Ref: 7b1838196
Ref: Pending removal in Python 3 15<3>-Footnote-1842346
Ref: Pending removal in Python 3 15<3>-Footnote-2842401
Ref: Pending removal in Python 3 15<3>-Footnote-3842456
Ref: Pending removal in Python 3 15<3>-Footnote-4842498
Ref: Pending removal in Python 3 15<3>-Footnote-5842554
Node: Pending removal in Python 3 16<4>842610
Ref: whatsnew/3 13 pending-removal-in-python-3-16842780
Ref: 7b2842780
Ref: Pending removal in Python 3 16<4>-Footnote-1847038
Ref: Pending removal in Python 3 16<4>-Footnote-2847094
Ref: Pending removal in Python 3 16<4>-Footnote-3847150
Ref: Pending removal in Python 3 16<4>-Footnote-4847206
Node: Pending removal in Python 3 17<3>847261
Ref: whatsnew/3 13 pending-removal-in-python-3-17847431
Ref: 7b3847431
Ref: Pending removal in Python 3 17<3>-Footnote-1851032
Ref: Pending removal in Python 3 17<3>-Footnote-2851087
Ref: Pending removal in Python 3 17<3>-Footnote-3851145
Ref: Pending removal in Python 3 17<3>-Footnote-4851200
Ref: Pending removal in Python 3 17<3>-Footnote-5851256
Ref: Pending removal in Python 3 17<3>-Footnote-6851312
Ref: Pending removal in Python 3 17<3>-Footnote-7851370
Node: Pending removal in Python 3 18<4>851425
Ref: whatsnew/3 13 pending-removal-in-python-3-18851595
Ref: 7b4851595
Ref: Pending removal in Python 3 18<4>-Footnote-1852325
Ref: Pending removal in Python 3 18<4>-Footnote-2852380
Ref: Pending removal in Python 3 18<4>-Footnote-3852435
Ref: Pending removal in Python 3 18<4>-Footnote-4852477
Node: Pending removal in Python 3 19<3>852533
Ref: whatsnew/3 13 pending-removal-in-python-3-19852703
Ref: 7b5852703
Node: Pending removal in Python 3 20<3>854497
Ref: whatsnew/3 13 pending-removal-in-python-3-20854671
Ref: 7b6854671
Ref: Pending removal in Python 3 20<3>-Footnote-1856852
Ref: Pending removal in Python 3 20<3>-Footnote-2856908
Ref: Pending removal in Python 3 20<3>-Footnote-3856963
Ref: Pending removal in Python 3 20<3>-Footnote-4857005
Node: Pending removal in future versions<4>857061
Ref: whatsnew/3 13 pending-removal-in-future-versions857193
Ref: 7b7857193
Ref: Pending removal in future versions<4>-Footnote-1864807
Ref: Pending removal in future versions<4>-Footnote-2864862
Ref: Pending removal in future versions<4>-Footnote-3864918
Ref: Pending removal in future versions<4>-Footnote-4864974
Ref: Pending removal in future versions<4>-Footnote-5865030
Ref: Pending removal in future versions<4>-Footnote-6865085
Ref: Pending removal in future versions<4>-Footnote-7865140
Node: CPython Bytecode Changes865196
Ref: whatsnew/3 13 cpython-bytecode-changes865334
Ref: 7b8865334
Ref: CPython Bytecode Changes-Footnote-1865775
Node: C API の変更<2>865831
Ref: whatsnew/3 13 c-api-changes865966
Ref: 7bb865966
Node: 新しい機能<3>866202
Ref: whatsnew/3 13 id7866301
Ref: 7bc866301
Ref: 新しい機能<3>-Footnote-1877212
Ref: 新しい機能<3>-Footnote-2877254
Ref: 新しい機能<3>-Footnote-3877310
Ref: 新しい機能<3>-Footnote-4877366
Ref: 新しい機能<3>-Footnote-5877422
Ref: 新しい機能<3>-Footnote-6877478
Ref: 新しい機能<3>-Footnote-7877534
Ref: 新しい機能<3>-Footnote-8877590
Ref: 新しい機能<3>-Footnote-9877646
Ref: 新しい機能<3>-Footnote-10877702
Ref: 新しい機能<3>-Footnote-11877759
Ref: 新しい機能<3>-Footnote-12877816
Ref: 新しい機能<3>-Footnote-13877872
Ref: 新しい機能<3>-Footnote-14877929
Ref: 新しい機能<3>-Footnote-15877986
Ref: 新しい機能<3>-Footnote-16878043
Ref: 新しい機能<3>-Footnote-17878100
Ref: 新しい機能<3>-Footnote-18878157
Ref: 新しい機能<3>-Footnote-19878214
Ref: 新しい機能<3>-Footnote-20878271
Ref: 新しい機能<3>-Footnote-21878327
Ref: 新しい機能<3>-Footnote-22878384
Ref: 新しい機能<3>-Footnote-23878441
Ref: 新しい機能<3>-Footnote-24878495
Ref: 新しい機能<3>-Footnote-25878552
Ref: 新しい機能<3>-Footnote-26878608
Ref: 新しい機能<3>-Footnote-27878664
Ref: 新しい機能<3>-Footnote-28878721
Ref: 新しい機能<3>-Footnote-29878778
Ref: 新しい機能<3>-Footnote-30878835
Ref: 新しい機能<3>-Footnote-31878892
Ref: 新しい機能<3>-Footnote-32878949
Node: Changed C APIs<2>879006
Ref: whatsnew/3 13 changed-c-apis879135
Ref: 81d879135
Ref: Changed C APIs<2>-Footnote-1881730
Ref: Changed C APIs<2>-Footnote-2881785
Ref: Changed C APIs<2>-Footnote-3881841
Ref: Changed C APIs<2>-Footnote-4881897
Ref: Changed C APIs<2>-Footnote-5881953
Ref: Changed C APIs<2>-Footnote-6881995
Ref: Changed C APIs<2>-Footnote-7882051
Ref: Changed C APIs<2>-Footnote-8882107
Node: Limited C API Changes882163
Ref: whatsnew/3 13 limited-c-api-changes882291
Ref: 829882291
Ref: Limited C API Changes-Footnote-1882994
Ref: Limited C API Changes-Footnote-2883049
Ref: Limited C API Changes-Footnote-3883105
Node: Removed C APIs<4>883161
Ref: whatsnew/3 13 removed-c-apis883292
Ref: 830883292
Ref: Removed C APIs<4>-Footnote-1889618
Ref: Removed C APIs<4>-Footnote-2889674
Ref: Removed C APIs<4>-Footnote-3889729
Ref: Removed C APIs<4>-Footnote-4889785
Ref: Removed C APIs<4>-Footnote-5889827
Ref: Removed C APIs<4>-Footnote-6889883
Ref: Removed C APIs<4>-Footnote-7889939
Ref: Removed C APIs<4>-Footnote-8889995
Ref: Removed C APIs<4>-Footnote-9890048
Ref: Removed C APIs<4>-Footnote-10890104
Ref: Removed C APIs<4>-Footnote-11890147
Ref: Removed C APIs<4>-Footnote-12890204
Ref: Removed C APIs<4>-Footnote-13890261
Ref: Removed C APIs<4>-Footnote-14890318
Node: Deprecated C APIs<4>890375
Ref: whatsnew/3 13 deprecated-c-apis890476
Ref: 842890476
Ref: Deprecated C APIs<4>-Footnote-1893131
Ref: Deprecated C APIs<4>-Footnote-2893187
Ref: Deprecated C APIs<4>-Footnote-3893229
Ref: Deprecated C APIs<4>-Footnote-4893285
Ref: Deprecated C APIs<4>-Footnote-5893340
Ref: Deprecated C APIs<4>-Footnote-6893396
Ref: Deprecated C APIs<4>-Footnote-7893449
Node: Pending removal in Python 3 14<2>893505
Ref: whatsnew/3 13 id8893637
Ref: 843893637
Ref: Pending removal in Python 3 14<2>-Footnote-1893957
Ref: Pending removal in Python 3 14<2>-Footnote-2893999
Ref: Pending removal in Python 3 14<2>-Footnote-3894055
Node: Pending removal in Python 3 15<4>894110
Ref: whatsnew/3 13 id9894284
Ref: 845894284
Ref: Pending removal in Python 3 15<4>-Footnote-1900707
Ref: Pending removal in Python 3 15<4>-Footnote-2900760
Node: Pending removal in Python 3 16<5>900813
Ref: whatsnew/3 13 id10900987
Ref: 846900987
Node: Pending removal in Python 3 18<5>901110
Ref: whatsnew/3 13 id11901288
Ref: 847901288
Ref: Pending removal in Python 3 18<5>-Footnote-1903963
Ref: Pending removal in Python 3 18<5>-Footnote-2904016
Node: Pending removal in future versions<5>904072
Ref: whatsnew/3 13 id12904208
Ref: 848904208
Node: Build Changes906049
Ref: whatsnew/3 13 build-changes906182
Ref: 849906182
Ref: whatsnew/3 13 pythoncapi-compat-project906182
Ref: 84a906182
Ref: Build Changes-Footnote-1908755
Ref: Build Changes-Footnote-2908797
Ref: Build Changes-Footnote-3908853
Ref: Build Changes-Footnote-4908895
Ref: Build Changes-Footnote-5908951
Ref: Build Changes-Footnote-6908993
Ref: Build Changes-Footnote-7909049
Ref: Build Changes-Footnote-8909091
Ref: Build Changes-Footnote-9909147
Ref: Build Changes-Footnote-10909202
Ref: Build Changes-Footnote-11909259
Ref: Build Changes-Footnote-12909316
Ref: Build Changes-Footnote-13909364
Ref: Build Changes-Footnote-14909421
Ref: Build Changes-Footnote-15909478
Ref: Build Changes-Footnote-16909535
Node: Porting to Python 3 13909591
Ref: whatsnew/3 13 porting-to-python-3-13909729
Ref: 68a909729
Node: Python API の変更<2>910036
Ref: whatsnew/3 13 changes-in-the-python-api910145
Ref: 84c910145
Ref: whatsnew/3 13 pep667-porting-notes-py910203
Ref: 6b5910203
Ref: Python API の変更<2>-Footnote-1913738
Ref: Python API の変更<2>-Footnote-2913780
Ref: Python API の変更<2>-Footnote-3913822
Ref: Python API の変更<2>-Footnote-4913864
Ref: Python API の変更<2>-Footnote-5913906
Ref: Python API の変更<2>-Footnote-6913962
Ref: Python API の変更<2>-Footnote-7914018
Ref: Python API の変更<2>-Footnote-8914073
Node: C API の変更<3>914129
Ref: whatsnew/3 13 changes-in-the-c-api914238
Ref: 852914238
Ref: whatsnew/3 13 pep667-porting-notes-c916880
Ref: 6b6916880
Ref: C API の変更<3>-Footnote-1920634
Ref: C API の変更<3>-Footnote-2920690
Ref: C API の変更<3>-Footnote-3920746
Ref: C API の変更<3>-Footnote-4920802
Ref: C API の変更<3>-Footnote-5920857
Ref: C API の変更<3>-Footnote-6920913
Node: Regression Test Changes920966
Ref: whatsnew/3 13 regression-test-changes921082
Ref: 858921082
Ref: Regression Test Changes-Footnote-1921523
Node: What's New In Python 3 12921579
Ref: whatsnew/3 12 doc921729
Ref: 85a921729
Ref: whatsnew/3 12 translation-repo921729
Ref: 85b921729
Ref: whatsnew/3 12 what-s-new-in-python-3-12921729
Ref: 85c921729
Ref: What's New In Python 3 12-Footnote-1922815
Node: 概要 -- リリースハイライト<3>922857
Ref: whatsnew/3 12 summary-release-highlights922986
Ref: 85d922986
Ref: 概要 -- リリースハイライト<3>-Footnote-1928544
Ref: 概要 -- リリースハイライト<3>-Footnote-2928592
Ref: 概要 -- リリースハイライト<3>-Footnote-3928634
Ref: 概要 -- リリースハイライト<3>-Footnote-4928676
Ref: 概要 -- リリースハイライト<3>-Footnote-5928735
Ref: 概要 -- リリースハイライト<3>-Footnote-6928814
Node: 新しい機能<4>928869
Ref: whatsnew/3 12 new-features929049
Ref: 872929049
Node: PEP 695 型パラメータの構文929768
Ref: whatsnew/3 12 pep-695-type-parameter-syntax929909
Ref: 873929909
Ref: whatsnew/3 12 whatsnew312-pep695929909
Ref: 85f929909
Ref: PEP 695 型パラメータの構文-Footnote-1933091
Ref: PEP 695 型パラメータの構文-Footnote-2933133
Ref: PEP 695 型パラメータの構文-Footnote-3933175
Ref: PEP 695 型パラメータの構文-Footnote-4933217
Node: PEP 701 f-strings の構文的な形式化933273
Ref: whatsnew/3 12 pep-701-syntactic-formalization-of-f-strings933465
Ref: 878933465
Ref: whatsnew/3 12 whatsnew312-pep701933465
Ref: 862933465
Ref: PEP 701 f-strings の構文的な形式化-Footnote-1938728
Ref: PEP 701 f-strings の構文的な形式化-Footnote-2938770
Ref: PEP 701 f-strings の構文的な形式化-Footnote-3938812
Ref: PEP 701 f-strings の構文的な形式化-Footnote-4938854
Node: PEP 684 インタープリタごとの GIL938910
Ref: whatsnew/3 12 pep-684-a-per-interpreter-gil939113
Ref: 87a939113
Ref: whatsnew/3 12 whatsnew312-pep684939113
Ref: 863939113
Ref: PEP 684 インタープリタごとの GIL-Footnote-1940405
Ref: PEP 684 インタープリタごとの GIL-Footnote-2940447
Ref: PEP 684 インタープリタごとの GIL-Footnote-3940489
Node: PEP 669 CPython の低影響モニタリング940545
Ref: whatsnew/3 12 pep-669-low-impact-monitoring-for-cpython940776
Ref: 87c940776
Ref: whatsnew/3 12 whatsnew312-pep669940776
Ref: 864940776
Ref: PEP 669 CPython の低影響モニタリング-Footnote-1941518
Ref: PEP 669 CPython の低影響モニタリング-Footnote-2941560
Node: PEP 688 バッファプロトコルを Python で利用可能にする941616
Ref: whatsnew/3 12 pep-688-making-the-buffer-protocol-accessible-in-python941846
Ref: 87d941846
Ref: whatsnew/3 12 whatsnew312-pep688941846
Ref: 866941846
Ref: PEP 688 バッファプロトコルを Python で利用可能にする-Footnote-1942626
Ref: PEP 688 バッファプロトコルを Python で利用可能にする-Footnote-2942668
Node: PEP 709 内包表記のインライン化942724
Ref: whatsnew/3 12 pep-709-comprehension-inlining942944
Ref: 880942944
Ref: whatsnew/3 12 whatsnew312-pep709942944
Ref: 86b942944
Ref: PEP 709 内包表記のインライン化-Footnote-1944737
Ref: PEP 709 内包表記のインライン化-Footnote-2944779
Node: エラーメッセージの改善<3>944821
Ref: whatsnew/3 12 improved-error-messages944962
Ref: 865944962
Ref: エラーメッセージの改善<3>-Footnote-1947322
Ref: エラーメッセージの改善<3>-Footnote-2947377
Ref: エラーメッセージの改善<3>-Footnote-3947432
Ref: エラーメッセージの改善<3>-Footnote-4947487
Node: 型ヒントに関連する新しい機能947542
Ref: whatsnew/3 12 new-features-related-to-type-hints947709
Ref: 881947709
Ref: 型ヒントに関連する新しい機能-Footnote-1948148
Node: PEP 692 Using TypedDict for more precise **kwargs typing948190
Ref: whatsnew/3 12 pep-692-using-typeddict-for-more-precise-kwargs-typing948378
Ref: 882948378
Ref: whatsnew/3 12 whatsnew312-pep692948378
Ref: 86c948378
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-1949100
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-2949142
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-3949184
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-4949226
Node: PEP 698 Override Decorator for Static Typing949282
Ref: whatsnew/3 12 pep-698-override-decorator-for-static-typing949470
Ref: 883949470
Ref: whatsnew/3 12 whatsnew312-pep698949470
Ref: 86e949470
Ref: PEP 698 Override Decorator for Static Typing-Footnote-1950474
Ref: PEP 698 Override Decorator for Static Typing-Footnote-2950516
Node: その他の言語変更<2>950572
Ref: whatsnew/3 12 other-language-changes950748
Ref: 884950748
Ref: その他の言語変更<2>-Footnote-1955409
Ref: その他の言語変更<2>-Footnote-2955464
Ref: その他の言語変更<2>-Footnote-3955519
Ref: その他の言語変更<2>-Footnote-4955574
Ref: その他の言語変更<2>-Footnote-5955616
Ref: その他の言語変更<2>-Footnote-6955672
Ref: その他の言語変更<2>-Footnote-7955714
Ref: その他の言語変更<2>-Footnote-8955769
Ref: その他の言語変更<2>-Footnote-9955825
Ref: その他の言語変更<2>-Footnote-10955880
Ref: その他の言語変更<2>-Footnote-11955936
Ref: その他の言語変更<2>-Footnote-12955992
Ref: その他の言語変更<2>-Footnote-13956049
Ref: その他の言語変更<2>-Footnote-14956106
Ref: その他の言語変更<2>-Footnote-15956162
Ref: その他の言語変更<2>-Footnote-16956205
Ref: その他の言語変更<2>-Footnote-17956261
Node: 新たなモジュール<2>956317
Ref: whatsnew/3 12 new-modules956484
Ref: 88d956484
Node: 改良されたモジュール<2>956551
Ref: whatsnew/3 12 improved-modules956703
Ref: 88e956703
Node: array<2>957469
Ref: whatsnew/3 12 array957566
Ref: 88f957566
Ref: array<2>-Footnote-1957794
Node: asyncio<7>957849
Ref: whatsnew/3 12 asyncio957966
Ref: 890957966
Ref: asyncio<7>-Footnote-1959929
Ref: asyncio<7>-Footnote-2959984
Ref: asyncio<7>-Footnote-3960040
Ref: asyncio<7>-Footnote-4960096
Ref: asyncio<7>-Footnote-5960152
Ref: asyncio<7>-Footnote-6960207
Ref: asyncio<7>-Footnote-7960262
Ref: asyncio<7>-Footnote-8960317
Ref: asyncio<7>-Footnote-9960373
Ref: asyncio<7>-Footnote-10960429
Node: calendar<3>960485
Ref: whatsnew/3 12 calendar960600
Ref: 897960600
Ref: calendar<3>-Footnote-1960852
Node: csv<2>960908
Ref: whatsnew/3 12 csv961019
Ref: 89a961019
Node: dis<3>961253
Ref: whatsnew/3 12 dis961365
Ref: 89f961365
Ref: dis<3>-Footnote-1961975
Ref: dis<3>-Footnote-2962030
Node: fractions<3>962085
Ref: whatsnew/3 12 fractions962213
Ref: 8a2962213
Ref: fractions<3>-Footnote-1962435
Node: importlib resources<2>962491
Ref: whatsnew/3 12 importlib-resources962623
Ref: 8a3962623
Ref: importlib resources<2>-Footnote-1962995
Ref: importlib resources<2>-Footnote-2963050
Node: inspect<3>963106
Ref: whatsnew/3 12 inspect963238
Ref: 8a5963238
Ref: inspect<3>-Footnote-1964008
Ref: inspect<3>-Footnote-2964063
Ref: inspect<3>-Footnote-3964118
Node: itertools<3>964174
Ref: whatsnew/3 12 itertools964291
Ref: 8ab964291
Ref: itertools<3>-Footnote-1964556
Node: math<4>964611
Ref: whatsnew/3 12 math964723
Ref: 8ac964723
Ref: math<4>-Footnote-1965141
Ref: math<4>-Footnote-2965197
Node: os<5>965252
Ref: whatsnew/3 12 os965362
Ref: 8af965362
Ref: os<5>-Footnote-1966707
Ref: os<5>-Footnote-2966762
Ref: os<5>-Footnote-3966817
Ref: os<5>-Footnote-4966873
Node: os path<4>966928
Ref: whatsnew/3 12 os-path967041
Ref: 8b7967041
Ref: os path<4>-Footnote-1967406
Ref: os path<4>-Footnote-2967461
Node: pathlib<7>967517
Ref: whatsnew/3 12 pathlib967652
Ref: 8ba967652
Ref: pathlib<7>-Footnote-1968947
Ref: pathlib<7>-Footnote-2969002
Ref: pathlib<7>-Footnote-3969057
Node: プラットフォーム<2>969112
Ref: whatsnew/3 12 platform969243
Ref: 8c2969243
Ref: プラットフォーム<2>-Footnote-1969612
Node: pdb<5>969667
Ref: whatsnew/3 12 pdb969797
Ref: 8c3969797
Ref: pdb<5>-Footnote-1970070
Node: random<2>970126
Ref: whatsnew/3 12 random970238
Ref: 8c4970238
Ref: random<2>-Footnote-1970543
Ref: random<2>-Footnote-2970598
Node: shutil<3>970654
Ref: whatsnew/3 12 shutil970770
Ref: 8c7970770
Ref: shutil<3>-Footnote-1972200
Ref: shutil<3>-Footnote-2972255
Ref: shutil<3>-Footnote-3972311
Ref: shutil<3>-Footnote-4972367
Ref: shutil<3>-Footnote-5972423
Node: sqlite3<4>972479
Ref: whatsnew/3 12 sqlite3972599
Ref: 8ca972599
Ref: sqlite3<4>-Footnote-1973546
Ref: sqlite3<4>-Footnote-2973601
Ref: sqlite3<4>-Footnote-3973643
Ref: sqlite3<4>-Footnote-4973698
Ref: sqlite3<4>-Footnote-5973754
Node: statistics<2>973810
Ref: whatsnew/3 12 statistics973927
Ref: 8d0973927
Ref: statistics<2>-Footnote-1974207
Node: sys<5>974262
Ref: whatsnew/3 12 sys974380
Ref: 8d2974380
Ref: sys<5>-Footnote-1975930
Ref: sys<5>-Footnote-2975986
Ref: sys<5>-Footnote-3976041
Ref: sys<5>-Footnote-4976097
Node: tempfile<2>976153
Ref: whatsnew/3 12 tempfile976270
Ref: 8da976270
Ref: tempfile<2>-Footnote-1976662
Node: threading<4>976717
Ref: whatsnew/3 12 threading976838
Ref: 8dc976838
Ref: threading<4>-Footnote-1977187
Node: tkinter<4>977242
Ref: whatsnew/3 12 tkinter977363
Ref: 8df977363
Ref: tkinter<4>-Footnote-1977859
Node: tokenize<2>977914
Ref: whatsnew/3 12 tokenize978031
Ref: 8e0978031
Ref: tokenize<2>-Footnote-1978386
Ref: tokenize<2>-Footnote-2978428
Node: types<5>978484
Ref: whatsnew/3 12 types978600
Ref: 8e2978600
Ref: types<5>-Footnote-1978912
Node: typing<6>978968
Ref: whatsnew/3 12 typing979087
Ref: 8e5979087
Ref: whatsnew/3 12 whatsnew-typing-py312979087
Ref: 8e6979087
Ref: typing<6>-Footnote-1981658
Ref: typing<6>-Footnote-2981714
Ref: typing<6>-Footnote-3981769
Ref: typing<6>-Footnote-4981825
Ref: typing<6>-Footnote-5981881
Node: unicodedata<4>981936
Ref: whatsnew/3 12 unicodedata982058
Ref: 8ea982058
Ref: unicodedata<4>-Footnote-1982256
Node: unittest<4>982311
Ref: whatsnew/3 12 unittest982431
Ref: 8eb982431
Ref: unittest<4>-Footnote-1983215
Node: uuid<3>983270
Ref: whatsnew/3 12 uuid983367
Ref: 8ec983367
Ref: uuid<3>-Footnote-1983530
Node: 最適化<3>983585
Ref: whatsnew/3 12 optimizations983748
Ref: 8ed983748
Ref: 最適化<3>-Footnote-1985189
Ref: 最適化<3>-Footnote-2985231
Ref: 最適化<3>-Footnote-3985286
Ref: 最適化<3>-Footnote-4985341
Ref: 最適化<3>-Footnote-5985397
Ref: 最適化<3>-Footnote-6985452
Ref: 最適化<3>-Footnote-7985508
Ref: 最適化<3>-Footnote-8985550
Ref: 最適化<3>-Footnote-9985606
Node: CPython バイトコードの変更<2>985662
Ref: whatsnew/3 12 cpython-bytecode-changes985807
Ref: 8f1985807
Ref: CPython バイトコードの変更<2>-Footnote-1987838
Ref: CPython バイトコードの変更<2>-Footnote-2987893
Ref: CPython バイトコードの変更<2>-Footnote-3987949
Ref: CPython バイトコードの変更<2>-Footnote-4988004
Ref: CPython バイトコードの変更<2>-Footnote-5988059
Ref: CPython バイトコードの変更<2>-Footnote-6988114
Ref: CPython バイトコードの変更<2>-Footnote-7988170
Ref: CPython バイトコードの変更<2>-Footnote-8988225
Ref: CPython バイトコードの変更<2>-Footnote-9988281
Ref: CPython バイトコードの変更<2>-Footnote-10988323
Ref: CPython バイトコードの変更<2>-Footnote-11988380
Ref: CPython バイトコードの変更<2>-Footnote-12988436
Ref: CPython バイトコードの変更<2>-Footnote-13988479
Ref: CPython バイトコードの変更<2>-Footnote-14988536
Ref: CPython バイトコードの変更<2>-Footnote-15988593
Node: Demos and Tools988650
Ref: whatsnew/3 12 demos-and-tools988795
Ref: 8fd988795
Ref: Demos and Tools-Footnote-1989248
Ref: Demos and Tools-Footnote-2989296
Ref: Demos and Tools-Footnote-3989351
Ref: Demos and Tools-Footnote-4989399
Node: 非推奨<2>989454
Ref: whatsnew/3 12 deprecated989570
Ref: 8fe989570
Ref: 非推奨<2>-Footnote-11000856
Ref: 非推奨<2>-Footnote-21000911
Ref: 非推奨<2>-Footnote-31000966
Ref: 非推奨<2>-Footnote-41001021
Ref: 非推奨<2>-Footnote-51001076
Ref: 非推奨<2>-Footnote-61001132
Ref: 非推奨<2>-Footnote-71001188
Ref: 非推奨<2>-Footnote-81001246
Ref: 非推奨<2>-Footnote-91001301
Ref: 非推奨<2>-Footnote-101001357
Ref: 非推奨<2>-Footnote-111001413
Ref: 非推奨<2>-Footnote-121001469
Ref: 非推奨<2>-Footnote-131001526
Ref: 非推奨<2>-Footnote-141001582
Ref: 非推奨<2>-Footnote-151001638
Ref: 非推奨<2>-Footnote-161001694
Ref: 非推奨<2>-Footnote-171001750
Ref: 非推奨<2>-Footnote-181001853
Ref: 非推奨<2>-Footnote-191001910
Ref: 非推奨<2>-Footnote-201001966
Ref: 非推奨<2>-Footnote-211002023
Ref: 非推奨<2>-Footnote-221002080
Ref: 非推奨<2>-Footnote-231002136
Ref: 非推奨<2>-Footnote-241002192
Ref: 非推奨<2>-Footnote-251002248
Ref: 非推奨<2>-Footnote-261002304
Ref: 非推奨<2>-Footnote-271002360
Ref: 非推奨<2>-Footnote-281002416
Ref: 非推奨<2>-Footnote-291002473
Ref: 非推奨<2>-Footnote-301002516
Node: Pending removal in Python 3 131002573
Ref: whatsnew/3 12 pending-removal-in-python-3-131002694
Ref: 90d1002694
Ref: Pending removal in Python 3 13-Footnote-11003787
Ref: Pending removal in Python 3 13-Footnote-21003829
Ref: Pending removal in Python 3 13-Footnote-31003884
Ref: Pending removal in Python 3 13-Footnote-41003939
Ref: Pending removal in Python 3 13-Footnote-51003994
Ref: Pending removal in Python 3 13-Footnote-61004049
Ref: Pending removal in Python 3 13-Footnote-71004104
Ref: Pending removal in Python 3 13-Footnote-81004159
Ref: Pending removal in Python 3 13-Footnote-91004214
Ref: Pending removal in Python 3 13-Footnote-101004269
Ref: Pending removal in Python 3 13-Footnote-111004325
Node: Pending removal in Python 3 14<3>1004381
Ref: whatsnew/3 12 pending-removal-in-python-3-141004544
Ref: 90e1004544
Ref: Pending removal in Python 3 14<3>-Footnote-11008764
Ref: Pending removal in Python 3 14<3>-Footnote-21008819
Ref: Pending removal in Python 3 14<3>-Footnote-31008874
Ref: Pending removal in Python 3 14<3>-Footnote-41008929
Ref: Pending removal in Python 3 14<3>-Footnote-51008984
Ref: Pending removal in Python 3 14<3>-Footnote-61009040
Ref: Pending removal in Python 3 14<3>-Footnote-71009095
Ref: Pending removal in Python 3 14<3>-Footnote-81009150
Ref: Pending removal in Python 3 14<3>-Footnote-91009206
Ref: Pending removal in Python 3 14<3>-Footnote-101009261
Ref: Pending removal in Python 3 14<3>-Footnote-111009317
Node: Pending removal in Python 3 15<5>1009373
Ref: whatsnew/3 12 pending-removal-in-python-3-151009539
Ref: 90f1009539
Ref: Pending removal in Python 3 15<5>-Footnote-11013691
Ref: Pending removal in Python 3 15<5>-Footnote-21013746
Ref: Pending removal in Python 3 15<5>-Footnote-31013801
Ref: Pending removal in Python 3 15<5>-Footnote-41013843
Ref: Pending removal in Python 3 15<5>-Footnote-51013899
Node: Pending removal in Python 3 16<6>1013955
Ref: whatsnew/3 12 pending-removal-in-python-3-161014121
Ref: 9101014121
Ref: Pending removal in Python 3 16<6>-Footnote-11018381
Ref: Pending removal in Python 3 16<6>-Footnote-21018437
Ref: Pending removal in Python 3 16<6>-Footnote-31018493
Ref: Pending removal in Python 3 16<6>-Footnote-41018549
Node: Pending removal in Python 3 17<4>1018604
Ref: whatsnew/3 12 pending-removal-in-python-3-171018770
Ref: 9111018770
Ref: Pending removal in Python 3 17<4>-Footnote-11022373
Ref: Pending removal in Python 3 17<4>-Footnote-21022428
Ref: Pending removal in Python 3 17<4>-Footnote-31022486
Ref: Pending removal in Python 3 17<4>-Footnote-41022541
Ref: Pending removal in Python 3 17<4>-Footnote-51022597
Ref: Pending removal in Python 3 17<4>-Footnote-61022653
Ref: Pending removal in Python 3 17<4>-Footnote-71022711
Node: Pending removal in Python 3 19<4>1022766
Ref: whatsnew/3 12 pending-removal-in-python-3-191022932
Ref: 9121022932
Node: Pending removal in Python 3 20<4>1024728
Ref: whatsnew/3 12 pending-removal-in-python-3-201024898
Ref: 9131024898
Ref: Pending removal in Python 3 20<4>-Footnote-11027081
Ref: Pending removal in Python 3 20<4>-Footnote-21027137
Ref: Pending removal in Python 3 20<4>-Footnote-31027192
Ref: Pending removal in Python 3 20<4>-Footnote-41027234
Node: Pending removal in future versions<6>1027290
Ref: whatsnew/3 12 pending-removal-in-future-versions1027418
Ref: 9141027418
Ref: Pending removal in future versions<6>-Footnote-11035034
Ref: Pending removal in future versions<6>-Footnote-21035089
Ref: Pending removal in future versions<6>-Footnote-31035145
Ref: Pending removal in future versions<6>-Footnote-41035201
Ref: Pending removal in future versions<6>-Footnote-51035257
Ref: Pending removal in future versions<6>-Footnote-61035312
Ref: Pending removal in future versions<6>-Footnote-71035367
Node: 削除<2>1035423
Ref: whatsnew/3 12 removed1035548
Ref: 9151035548
Ref: whatsnew/3 12 whatsnew312-removed1035548
Ref: 9161035548
Node: asynchat and asyncore1035992
Ref: whatsnew/3 12 asynchat-and-asyncore1036083
Ref: 9171036083
Ref: asynchat and asyncore-Footnote-11036399
Ref: asynchat and asyncore-Footnote-21036441
Node: configparser<4>1036496
Ref: whatsnew/3 12 configparser1036605
Ref: 9181036605
Ref: configparser<4>-Footnote-11037262
Node: distutils1037317
Ref: whatsnew/3 12 distutils1037414
Ref: 91b1037414
Ref: whatsnew/3 12 whatsnew312-removed-distutils1037414
Ref: 91c1037414
Ref: distutils-Footnote-11037843
Ref: distutils-Footnote-21037885
Node: ensurepip1037940
Ref: whatsnew/3 12 ensurepip1038029
Ref: 91d1038029
Ref: ensurepip-Footnote-11039050
Node: enum<2>1039105
Ref: whatsnew/3 12 enum1039191
Ref: 91e1039191
Ref: enum<2>-Footnote-11039425
Node: ftplib1039480
Ref: whatsnew/3 12 ftplib1039561
Ref: 91f1039561
Ref: ftplib-Footnote-11039802
Node: gzip1039857
Ref: whatsnew/3 12 gzip1039941
Ref: 9201039941
Ref: gzip-Footnote-11040337
Node: hashlib<2>1040392
Ref: whatsnew/3 12 hashlib1040482
Ref: 9221040482
Ref: hashlib<2>-Footnote-11040901
Ref: hashlib<2>-Footnote-21040943
Node: importlib<2>1040998
Ref: whatsnew/3 12 importlib1041087
Ref: 9241041087
Ref: importlib<2>-Footnote-11041977
Ref: importlib<2>-Footnote-21042032
Ref: importlib<2>-Footnote-31042087
Ref: importlib<2>-Footnote-41042142
Ref: importlib<2>-Footnote-51042197
Node: imp1042252
Ref: whatsnew/3 12 imp1042336
Ref: 9251042336
Ref: whatsnew/3 12 whatsnew312-removed-imp1042336
Ref: 9261042336
Ref: imp-Footnote-11046483
Node: io<4>1046538
Ref: whatsnew/3 12 io1046619
Ref: 92f1046619
Ref: io<4>-Footnote-11047032
Node: locale<3>1047087
Ref: whatsnew/3 12 locale1047170
Ref: 9311047170
Ref: locale<3>-Footnote-11047438
Node: smtpd1047493
Ref: whatsnew/3 12 smtpd1047581
Ref: 9331047581
Ref: smtpd-Footnote-11047935
Ref: smtpd-Footnote-21047977
Ref: smtpd-Footnote-31048020
Node: sqlite3<5>1048075
Ref: whatsnew/3 12 id21048160
Ref: 9341048160
Ref: sqlite3<5>-Footnote-11048894
Node: ssl<4>1048949
Ref: whatsnew/3 12 ssl1049040
Ref: 9351049040
Ref: ssl<4>-Footnote-11050097
Ref: ssl<4>-Footnote-21050152
Ref: ssl<4>-Footnote-31050207
Ref: ssl<4>-Footnote-41050263
Node: unittest<5>1050318
Ref: whatsnew/3 12 id31050412
Ref: 9391050412
Ref: whatsnew/3 12 unittest-testcase-removed-aliases1050514
Ref: 8711050514
Ref: unittest<5>-Footnote-11055291
Node: webbrowser<4>1055346
Ref: whatsnew/3 12 webbrowser1055455
Ref: 9451055455
Ref: webbrowser<4>-Footnote-11055762
Node: xml etree ElementTree1055818
Ref: whatsnew/3 12 xml-etree-elementtree1055928
Ref: 9461055928
Ref: xml etree ElementTree-Footnote-11056391
Node: zipimport<3>1056446
Ref: whatsnew/3 12 zipimport1056552
Ref: 9481056552
Ref: zipimport<3>-Footnote-11056887
Ref: zipimport<3>-Footnote-21056929
Node: その他1056984
Ref: whatsnew/3 12 others1057060
Ref: 9491057060
Ref: その他-Footnote-11058066
Ref: その他-Footnote-21058120
Ref: その他-Footnote-31058175
Ref: その他-Footnote-41058230
Ref: その他-Footnote-51058285
Node: Python 3 12 への移植1058340
Ref: whatsnew/3 12 porting-to-python-3-121058469
Ref: 94a1058469
Ref: whatsnew/3 12 whatsnew312-porting-to-python3121058469
Ref: 8e11058469
Node: Python API の変更<3>1058737
Ref: whatsnew/3 12 changes-in-the-python-api1058821
Ref: 94b1058821
Ref: Python API の変更<3>-Footnote-11065094
Ref: Python API の変更<3>-Footnote-21065149
Ref: Python API の変更<3>-Footnote-31065204
Ref: Python API の変更<3>-Footnote-41065247
Ref: Python API の変更<3>-Footnote-51065302
Ref: Python API の変更<3>-Footnote-61065357
Ref: Python API の変更<3>-Footnote-71065412
Ref: Python API の変更<3>-Footnote-81065468
Ref: Python API の変更<3>-Footnote-91065510
Ref: Python API の変更<3>-Footnote-101065552
Ref: Python API の変更<3>-Footnote-111065595
Node: Build Changes<2>1065652
Ref: whatsnew/3 12 build-changes1065790
Ref: 9561065790
Ref: Build Changes<2>-Footnote-11067474
Ref: Build Changes<2>-Footnote-21067529
Ref: Build Changes<2>-Footnote-31067584
Ref: Build Changes<2>-Footnote-41067639
Ref: Build Changes<2>-Footnote-51067694
Ref: Build Changes<2>-Footnote-61067749
Node: C API の変更<4>1067804
Ref: whatsnew/3 12 c-api-changes1067909
Ref: 9571067909
Node: 新しい機能<5>1068107
Ref: whatsnew/3 12 id41068216
Ref: 9581068216
Ref: whatsnew/3 12 whatsnew312-pep6971068262
Ref: 8691068262
Ref: whatsnew/3 12 whatsnew312-pep6831074404
Ref: 86a1074404
Ref: 新しい機能<5>-Footnote-11076145
Ref: 新しい機能<5>-Footnote-21076187
Ref: 新しい機能<5>-Footnote-31076229
Ref: 新しい機能<5>-Footnote-41076285
Ref: 新しい機能<5>-Footnote-51076327
Ref: 新しい機能<5>-Footnote-61076383
Ref: 新しい機能<5>-Footnote-71076438
Ref: 新しい機能<5>-Footnote-81076493
Ref: 新しい機能<5>-Footnote-91076548
Ref: 新しい機能<5>-Footnote-101076603
Ref: 新しい機能<5>-Footnote-111076659
Ref: 新しい機能<5>-Footnote-121076715
Ref: 新しい機能<5>-Footnote-131076771
Ref: 新しい機能<5>-Footnote-141076827
Ref: 新しい機能<5>-Footnote-151076883
Ref: 新しい機能<5>-Footnote-161076940
Ref: 新しい機能<5>-Footnote-171076997
Ref: 新しい機能<5>-Footnote-181077054
Ref: 新しい機能<5>-Footnote-191077111
Ref: 新しい機能<5>-Footnote-201077154
Ref: 新しい機能<5>-Footnote-211077210
Ref: 新しい機能<5>-Footnote-221077253
Ref: 新しい機能<5>-Footnote-231077310
Node: Python 3 12 への移植<2>1077367
Ref: whatsnew/3 12 id51077497
Ref: 97b1077497
Ref: Python 3 12 への移植<2>-Footnote-11084940
Ref: Python 3 12 への移植<2>-Footnote-21084995
Ref: Python 3 12 への移植<2>-Footnote-31085050
Ref: Python 3 12 への移植<2>-Footnote-41085105
Ref: Python 3 12 への移植<2>-Footnote-51085160
Ref: Python 3 12 への移植<2>-Footnote-61085215
Ref: Python 3 12 への移植<2>-Footnote-71085270
Ref: Python 3 12 への移植<2>-Footnote-81085326
Node: 非推奨<3>1085382
Ref: whatsnew/3 12 id61085503
Ref: 9901085503
Ref: 非推奨<3>-Footnote-11090906
Ref: 非推奨<3>-Footnote-21090948
Ref: 非推奨<3>-Footnote-31091004
Ref: 非推奨<3>-Footnote-41091059
Ref: 非推奨<3>-Footnote-51091114
Ref: 非推奨<3>-Footnote-61091169
Ref: 非推奨<3>-Footnote-71091225
Ref: 非推奨<3>-Footnote-81091281
Node: Pending removal in Python 3 14<4>1091337
Ref: whatsnew/3 12 id71091461
Ref: 99a1091461
Ref: Pending removal in Python 3 14<4>-Footnote-11091781
Ref: Pending removal in Python 3 14<4>-Footnote-21091823
Ref: Pending removal in Python 3 14<4>-Footnote-31091879
Node: Pending removal in Python 3 15<6>1091934
Ref: whatsnew/3 12 id81092100
Ref: 99b1092100
Ref: Pending removal in Python 3 15<6>-Footnote-11098523
Ref: Pending removal in Python 3 15<6>-Footnote-21098576
Node: Pending removal in Python 3 16<7>1098629
Ref: whatsnew/3 12 id91098799
Ref: 99c1098799
Node: Pending removal in future versions<7>1098922
Ref: whatsnew/3 12 id101099050
Ref: 99d1099050
Node: 削除<3>1100889
Ref: whatsnew/3 12 id111100974
Ref: 99e1100974
Ref: 削除<3>-Footnote-11101825
Ref: 削除<3>-Footnote-21101880
Ref: 削除<3>-Footnote-31101922
Node: What's New In Python 3 111101977
Ref: whatsnew/3 11 doc1102127
Ref: 99f1102127
Ref: whatsnew/3 11 translation-repo1102127
Ref: 9a01102127
Ref: whatsnew/3 11 what-s-new-in-python-3-111102127
Ref: 9a11102127
Node: 概要 -- リリースハイライト<4>1103429
Ref: whatsnew/3 11 summary-release-highlights1103558
Ref: 9a21103558
Ref: whatsnew/3 11 whatsnew311-summary1103558
Ref: 9a31103558
Ref: 概要 -- リリースハイライト<4>-Footnote-11105354
Ref: 概要 -- リリースハイライト<4>-Footnote-21105396
Ref: 概要 -- リリースハイライト<4>-Footnote-31105421
Ref: 概要 -- リリースハイライト<4>-Footnote-41105463
Ref: 概要 -- リリースハイライト<4>-Footnote-51105505
Node: 新しい機能<6>1105547
Ref: whatsnew/3 11 new-features1105730
Ref: 9b31105730
Ref: whatsnew/3 11 whatsnew311-features1105730
Ref: 9b41105730
Node: PEP 657 トレースバックのエラー位置の詳細化1106183
Ref: whatsnew/3 11 pep-657-fine-grained-error-locations-in-tracebacks1106343
Ref: 9b51106343
Ref: whatsnew/3 11 whatsnew311-pep6571106343
Ref: 9a71106343
Ref: PEP 657 トレースバックのエラー位置の詳細化-Footnote-11109442
Ref: PEP 657 トレースバックのエラー位置の詳細化-Footnote-21109484
Node: PEP 654 例外グループと except*1109549
Ref: whatsnew/3 11 pep-654-exception-groups-and-except1109771
Ref: 9bb1109771
Ref: whatsnew/3 11 whatsnew311-pep6541109771
Ref: 9a51109771
Ref: PEP 654 例外グループと except*-Footnote-11110619
Ref: PEP 654 例外グループと except*-Footnote-21110661
Ref: PEP 654 例外グループと except*-Footnote-31110703
Node: PEP 678 ノートによって例外を充実させる1110768
Ref: whatsnew/3 11 pep-678-exceptions-can-be-enriched-with-notes1110970
Ref: 9bc1110970
Ref: whatsnew/3 11 whatsnew311-pep6781110970
Ref: 9a61110970
Ref: PEP 678 ノートによって例外を充実させる-Footnote-11111620
Ref: PEP 678 ノートによって例外を充実させる-Footnote-21111662
Node: Windows py exe ランチャーの改善1111727
Ref: whatsnew/3 11 whatsnew311-windows-launcher1111883
Ref: 9bf1111883
Ref: whatsnew/3 11 windows-py-exe-launcher-improvements1111883
Ref: 9c01111883
Ref: whatsnew/3 11 new-feat-related-type-hints-3111113318
Ref: 9c21113318
Ref: Windows py exe ランチャーの改善-Footnote-11113356
Ref: Windows py exe ランチャーの改善-Footnote-21113398
Node: 型ヒントに関連する新しい機能<2>1113429
Ref: whatsnew/3 11 new-features-related-to-type-hints1113599
Ref: 9c31113599
Ref: whatsnew/3 11 whatsnew311-typing-features1113599
Ref: 9c41113599
Ref: 型ヒントに関連する新しい機能<2>-Footnote-11114255
Node: PEP 646 Variadic generics1114297
Ref: whatsnew/3 11 pep-646-variadic-generics1114483
Ref: 9c51114483
Ref: whatsnew/3 11 whatsnew311-pep6461114483
Ref: 9ab1114483
Ref: PEP 646 Variadic generics-Footnote-11115483
Ref: PEP 646 Variadic generics-Footnote-21115525
Ref: PEP 646 Variadic generics-Footnote-31115567
Ref: PEP 646 Variadic generics-Footnote-41115609
Node: PEP 655 Marking individual TypedDict items as required or not-required1115674
Ref: whatsnew/3 11 pep-655-marking-individual-typeddict-items-as-required-or-not-required1115885
Ref: 9c61115885
Ref: whatsnew/3 11 whatsnew311-pep6551115885
Ref: 9ac1115885
Ref: PEP 655 Marking individual TypedDict items as required or not-required-Footnote-11117133
Ref: PEP 655 Marking individual TypedDict items as required or not-required-Footnote-21117175
Node: PEP 673 Self 型1117240
Ref: whatsnew/3 11 pep-673-self-type1117463
Ref: 9c91117463
Ref: whatsnew/3 11 whatsnew311-pep6731117463
Ref: 9ad1117463
Ref: PEP 673 Self 型-Footnote-11118532
Ref: PEP 673 Self 型-Footnote-21118613
Ref: PEP 673 Self 型-Footnote-31118655
Node: PEP 675 Arbitrary literal string type1118720
Ref: whatsnew/3 11 pep-675-arbitrary-literal-string-type1118902
Ref: 9cc1118902
Ref: whatsnew/3 11 whatsnew311-pep6751118902
Ref: 9ae1118902
Ref: PEP 675 Arbitrary literal string type-Footnote-11120324
Ref: PEP 675 Arbitrary literal string type-Footnote-21120366
Node: PEP 681 Data class transforms1120431
Ref: whatsnew/3 11 pep-681-data-class-transforms1120626
Ref: 9ce1120626
Ref: whatsnew/3 11 whatsnew311-pep6811120626
Ref: 9af1120626
Ref: PEP 681 Data class transforms-Footnote-11121681
Ref: PEP 681 Data class transforms-Footnote-21121723
Node: PEP 563 may not be the future1121778
Ref: whatsnew/3 11 pep-563-may-not-be-the-future1121927
Ref: 9cf1121927
Ref: whatsnew/3 11 whatsnew311-pep563-deferred1121927
Ref: 9d01121927
Ref: PEP 563 may not be the future-Footnote-11122322
Ref: PEP 563 may not be the future-Footnote-21122364
Node: その他の言語変更<3>1122475
Ref: whatsnew/3 11 other-language-changes1122666
Ref: 9d11122666
Ref: whatsnew/3 11 whatsnew311-other-lang-changes1122666
Ref: 9d21122666
Ref: whatsnew/3 11 whatsnew311-pythonsafepath1124465
Ref: 9aa1124465
Ref: その他の言語変更<3>-Footnote-11125811
Ref: その他の言語変更<3>-Footnote-21125876
Ref: その他の言語変更<3>-Footnote-31125941
Ref: その他の言語変更<3>-Footnote-41126006
Ref: その他の言語変更<3>-Footnote-51126071
Ref: その他の言語変更<3>-Footnote-61126126
Ref: その他の言語変更<3>-Footnote-71126191
Ref: その他の言語変更<3>-Footnote-81126246
Ref: その他の言語変更<3>-Footnote-91126288
Ref: その他の言語変更<3>-Footnote-101126343
Node: その他の CPython の実装の変更1126399
Ref: whatsnew/3 11 other-cpython-implementation-changes1126572
Ref: 9e11126572
Ref: whatsnew/3 11 whatsnew311-other-implementation-changes1126572
Ref: 9e21126572
Ref: その他の CPython の実装の変更-Footnote-11129820
Ref: その他の CPython の実装の変更-Footnote-21129885
Ref: その他の CPython の実装の変更-Footnote-31129927
Ref: その他の CPython の実装の変更-Footnote-41129992
Ref: その他の CPython の実装の変更-Footnote-51130057
Ref: その他の CPython の実装の変更-Footnote-61130122
Ref: その他の CPython の実装の変更-Footnote-71130187
Ref: その他の CPython の実装の変更-Footnote-81130252
Node: 新たなモジュール<3>1130308
Ref: whatsnew/3 11 new-modules1130487
Ref: 9f21130487
Ref: whatsnew/3 11 whatsnew311-new-modules1130487
Ref: 9f31130487
Ref: 新たなモジュール<3>-Footnote-11130854
Ref: 新たなモジュール<3>-Footnote-21130879
Ref: 新たなモジュール<3>-Footnote-31130921
Ref: 新たなモジュール<3>-Footnote-41130986
Ref: 新たなモジュール<3>-Footnote-51131028
Node: 改良されたモジュール<3>1131093
Ref: whatsnew/3 11 improved-modules1131245
Ref: 9f41131245
Ref: whatsnew/3 11 whatsnew311-improved-modules1131245
Ref: 9f51131245
Node: asyncio<8>1132100
Ref: whatsnew/3 11 asyncio1132202
Ref: 9f61132202
Ref: whatsnew/3 11 whatsnew311-asyncio1132202
Ref: 9f71132202
Ref: asyncio<8>-Footnote-11134120
Ref: asyncio<8>-Footnote-21134175
Ref: asyncio<8>-Footnote-31134230
Ref: asyncio<8>-Footnote-41134285
Ref: asyncio<8>-Footnote-51134340
Ref: asyncio<8>-Footnote-61134405
Node: contextlib<2>1134470
Ref: whatsnew/3 11 contextlib1134599
Ref: a041134599
Ref: whatsnew/3 11 whatsnew311-contextlib1134599
Ref: a051134599
Ref: contextlib<2>-Footnote-11134914
Node: データクラス1134979
Ref: whatsnew/3 11 dataclasses1135109
Ref: a081135109
Ref: whatsnew/3 11 whatsnew311-dataclasses1135109
Ref: a091135109
Ref: データクラス-Footnote-11135459
Node: datetime<3>1135524
Ref: whatsnew/3 11 datetime1135648
Ref: a0a1135648
Ref: whatsnew/3 11 whatsnew311-datetime1135648
Ref: a0b1135648
Ref: datetime<3>-Footnote-11136187
Ref: datetime<3>-Footnote-21136242
Node: enum<3>1136297
Ref: whatsnew/3 11 enum1136408
Ref: a101136408
Ref: whatsnew/3 11 whatsnew311-enum1136408
Ref: a111136408
Node: fcntl1139052
Ref: whatsnew/3 11 fcntl1139164
Ref: a291139164
Ref: whatsnew/3 11 whatsnew311-fcntl1139164
Ref: a2a1139164
Node: fractions<4>1139399
Ref: whatsnew/3 11 fractions1139516
Ref: a2b1139516
Ref: whatsnew/3 11 whatsnew311-fractions1139516
Ref: a2c1139516
Ref: fractions<4>-Footnote-11139934
Ref: fractions<4>-Footnote-21139976
Ref: fractions<4>-Footnote-31140041
Node: functools<4>1140106
Ref: whatsnew/3 11 functools1140225
Ref: a2d1140225
Ref: whatsnew/3 11 whatsnew311-functools1140225
Ref: a2e1140225
Ref: functools<4>-Footnote-11141297
Node: gzip<2>1141362
Ref: whatsnew/3 11 gzip1141479
Ref: a301141479
Ref: whatsnew/3 11 whatsnew311-gzip1141479
Ref: a311141479
Ref: gzip<2>-Footnote-11142176
Node: hashlib<3>1142232
Ref: whatsnew/3 11 hashlib1142354
Ref: a341142354
Ref: whatsnew/3 11 whatsnew311-hashlib1142354
Ref: a351142354
Ref: hashlib<3>-Footnote-11143175
Ref: hashlib<3>-Footnote-21143207
Ref: hashlib<3>-Footnote-31143272
Ref: hashlib<3>-Footnote-41143337
Node: IDLE と idelelib1143392
Ref: whatsnew/3 11 idle-and-idlelib1143517
Ref: a391143517
Ref: whatsnew/3 11 whatsnew311-idle1143517
Ref: a3a1143517
Ref: IDLE と idelelib-Footnote-11143852
Ref: IDLE と idelelib-Footnote-21143917
Node: inspect<4>1143972
Ref: whatsnew/3 11 inspect1144096
Ref: a3b1144096
Ref: whatsnew/3 11 whatsnew311-inspect1144096
Ref: a3c1144096
Ref: inspect<4>-Footnote-11145183
Ref: inspect<4>-Footnote-21145248
Ref: inspect<4>-Footnote-31145313
Ref: inspect<4>-Footnote-41145355
Node: locale<4>1145410
Ref: whatsnew/3 11 locale1145527
Ref: a481145527
Ref: whatsnew/3 11 whatsnew311-locale1145527
Ref: a491145527
Node: logging<2>1145754
Ref: whatsnew/3 11 logging1145868
Ref: a4c1145868
Ref: whatsnew/3 11 whatsnew311-logging1145868
Ref: a4d1145868
Ref: logging<2>-Footnote-11146534
Ref: logging<2>-Footnote-21146589
Node: math<5>1146644
Ref: whatsnew/3 11 math1146760
Ref: a531146760
Ref: whatsnew/3 11 whatsnew311-math1146760
Ref: a541146760
Ref: math<5>-Footnote-11147533
Ref: math<5>-Footnote-21147598
Ref: math<5>-Footnote-31147663
Ref: math<5>-Footnote-41147728
Node: operator<2>1147793
Ref: whatsnew/3 11 operator1147904
Ref: a591147904
Ref: whatsnew/3 11 whatsnew311-operator1147904
Ref: a5a1147904
Ref: operator<2>-Footnote-11148166
Node: os<6>1148231
Ref: whatsnew/3 11 os1148345
Ref: a5b1148345
Ref: whatsnew/3 11 whatsnew311-os1148345
Ref: a5c1148345
Ref: os<6>-Footnote-11148594
Node: pathlib<8>1148659
Ref: whatsnew/3 11 pathlib1148767
Ref: a5d1148767
Ref: whatsnew/3 11 whatsnew311-pathlib1148767
Ref: a5e1148767
Ref: pathlib<8>-Footnote-11149088
Ref: pathlib<8>-Footnote-21149153
Node: re<5>1149218
Ref: whatsnew/3 11 re1149330
Ref: a611149330
Ref: whatsnew/3 11 whatsnew311-re1149330
Ref: a621149330
Ref: re<5>-Footnote-11149632
Node: shutil<4>1149698
Ref: whatsnew/3 11 shutil1149809
Ref: a631149809
Ref: whatsnew/3 11 whatsnew311-shutil1149809
Ref: a641149809
Ref: shutil<4>-Footnote-11150003
Node: socket<3>1150068
Ref: whatsnew/3 11 socket1150184
Ref: a651150184
Ref: whatsnew/3 11 whatsnew311-socket1150184
Ref: a661150184
Ref: socket<3>-Footnote-11150597
Ref: socket<3>-Footnote-21150662
Node: sqlite3<6>1150727
Ref: whatsnew/3 11 sqlite31150840
Ref: a681150840
Ref: whatsnew/3 11 whatsnew311-sqlite31150840
Ref: a691150840
Ref: sqlite3<6>-Footnote-11153184
Ref: sqlite3<6>-Footnote-21153249
Ref: sqlite3<6>-Footnote-31153314
Ref: sqlite3<6>-Footnote-41153379
Ref: sqlite3<6>-Footnote-51153444
Ref: sqlite3<6>-Footnote-61153509
Ref: sqlite3<6>-Footnote-71153574
Ref: sqlite3<6>-Footnote-81153639
Ref: sqlite3<6>-Footnote-91153704
Ref: sqlite3<6>-Footnote-101153769
Ref: sqlite3<6>-Footnote-111153835
Node: string1153901
Ref: whatsnew/3 11 string1154011
Ref: a781154011
Ref: whatsnew/3 11 whatsnew311-string1154011
Ref: a791154011
Ref: string-Footnote-11154336
Node: sys<6>1154391
Ref: whatsnew/3 11 sys1154503
Ref: a7d1154503
Ref: whatsnew/3 11 whatsnew311-sys1154503
Ref: a7e1154503
Ref: sys<6>-Footnote-11155196
Ref: sys<6>-Footnote-21155261
Ref: sys<6>-Footnote-31155326
Node: sysconfig<4>1155381
Ref: whatsnew/3 11 sysconfig1155498
Ref: a821155498
Ref: whatsnew/3 11 whatsnew311-sysconfig1155498
Ref: a831155498
Ref: sysconfig<4>-Footnote-11156311
Node: tempfile<3>1156376
Ref: whatsnew/3 11 tempfile1156499
Ref: a851156499
Ref: whatsnew/3 11 whatsnew311-tempfile1156499
Ref: a861156499
Ref: tempfile<3>-Footnote-11156908
Node: threading<5>1156963
Ref: whatsnew/3 11 threading1157081
Ref: a8a1157081
Ref: whatsnew/3 11 whatsnew311-threading1157081
Ref: a8b1157081
Ref: threading<5>-Footnote-11157586
Node: time<2>1157651
Ref: whatsnew/3 11 time1157768
Ref: a8f1157768
Ref: whatsnew/3 11 whatsnew311-time1157768
Ref: a901157768
Ref: time<2>-Footnote-11158569
Ref: time<2>-Footnote-21158634
Ref: time<2>-Footnote-31158731
Ref: time<2>-Footnote-41158796
Node: tkinter<5>1158861
Ref: whatsnew/3 11 tkinter1158978
Ref: a921158978
Ref: whatsnew/3 11 whatsnew311-tkinter1158978
Ref: a931158978
Ref: tkinter<5>-Footnote-11159261
Node: traceback<2>1159316
Ref: whatsnew/3 11 traceback1159435
Ref: a941159435
Ref: whatsnew/3 11 whatsnew311-traceback1159435
Ref: a951159435
Ref: traceback<2>-Footnote-11159927
Ref: traceback<2>-Footnote-21159992
Node: typing<7>1160057
Ref: whatsnew/3 11 typing1160180
Ref: a981160180
Ref: whatsnew/3 11 whatsnew311-typing1160180
Ref: a991160180
Ref: typing<7>-Footnote-11163474
Ref: typing<7>-Footnote-21163529
Ref: typing<7>-Footnote-31163584
Ref: typing<7>-Footnote-41163639
Ref: typing<7>-Footnote-51163694
Ref: typing<7>-Footnote-61163759
Ref: typing<7>-Footnote-71163814
Ref: typing<7>-Footnote-81163869
Ref: typing<7>-Footnote-91163924
Ref: typing<7>-Footnote-101163979
Ref: typing<7>-Footnote-111164035
Ref: typing<7>-Footnote-121164091
Ref: typing<7>-Footnote-131164147
Ref: typing<7>-Footnote-141164203
Ref: typing<7>-Footnote-151164259
Node: unicodedata<5>1164315
Ref: whatsnew/3 11 unicodedata1164437
Ref: aa71164437
Ref: whatsnew/3 11 whatsnew311-unicodedata1164437
Ref: aa81164437
Ref: unicodedata<5>-Footnote-11164636
Node: unittest<6>1164701
Ref: whatsnew/3 11 unittest1164821
Ref: aa91164821
Ref: whatsnew/3 11 whatsnew311-unittest1164821
Ref: aaa1164821
Ref: unittest<6>-Footnote-11165223
Node: venv<3>1165288
Ref: whatsnew/3 11 venv1165405
Ref: aaf1165405
Ref: whatsnew/3 11 whatsnew311-venv1165405
Ref: ab01165405
Ref: venv<3>-Footnote-11166028
Node: warnings<3>1166093
Ref: whatsnew/3 11 warnings1166209
Ref: ab11166209
Ref: whatsnew/3 11 whatsnew311-warnings1166209
Ref: ab21166209
Ref: warnings<3>-Footnote-11166540
Node: zipfile<2>1166605
Ref: whatsnew/3 11 whatsnew311-zipfile1166705
Ref: ab41166705
Ref: whatsnew/3 11 zipfile1166705
Ref: ab51166705
Ref: zipfile<2>-Footnote-11167294
Ref: zipfile<2>-Footnote-21167359
Ref: zipfile<2>-Footnote-31167414
Node: 最適化<4>1167469
Ref: whatsnew/3 11 optimizations1167608
Ref: whatsnew/3 11 whatsnew311-optimizations1167608
Ref: abd1167608
Ref: 最適化<4>-Footnote-11170007
Ref: 最適化<4>-Footnote-21170072
Ref: 最適化<4>-Footnote-31170127
Ref: 最適化<4>-Footnote-41170182
Ref: 最適化<4>-Footnote-51170237
Ref: 最適化<4>-Footnote-61170302
Ref: 最適化<4>-Footnote-71170357
Ref: 最適化<4>-Footnote-81170422
Ref: 最適化<4>-Footnote-91170477
Node: Faster CPython1170542
Ref: whatsnew/3 11 faster-cpython1170686
Ref: ac81170686
Ref: whatsnew/3 11 whatsnew311-faster-cpython1170686
Ref: 9a41170686
Ref: Faster CPython-Footnote-11171267
Ref: Faster CPython-Footnote-21171333
Node: Faster Startup1171381
Ref: whatsnew/3 11 faster-startup1171469
Ref: acb1171469
Ref: whatsnew/3 11 whatsnew311-faster-startup1171469
Ref: ac91171469
Node: Frozen imports / Static code objects1171567
Ref: whatsnew/3 11 frozen-imports-static-code-objects1171654
Ref: acc1171654
Ref: whatsnew/3 11 whatsnew311-faster-imports1171654
Ref: acd1171654
Node: Faster Runtime1172499
Ref: whatsnew/3 11 faster-runtime1172600
Ref: acf1172600
Ref: whatsnew/3 11 whatsnew311-faster-runtime1172600
Ref: aca1172600
Node: Cheaper lazy Python frames1172839
Ref: whatsnew/3 11 cheaper-lazy-python-frames1172954
Ref: ad01172954
Ref: whatsnew/3 11 whatsnew311-lazy-python-frames1172954
Ref: ad11172954
Ref: whatsnew/3 11 inline-calls1173897
Ref: ad51173897
Ref: Cheaper lazy Python frames-Footnote-11173935
Node: Inlined Python function calls1174000
Ref: whatsnew/3 11 inlined-python-function-calls1174165
Ref: ad61174165
Ref: whatsnew/3 11 whatsnew311-inline-calls1174165
Ref: ad71174165
Ref: Inlined Python function calls-Footnote-11175113
Node: PEP 659 Specializing Adaptive Interpreter1175178
Ref: whatsnew/3 11 pep-659-specializing-adaptive-interpreter1175308
Ref: ad81175308
Ref: whatsnew/3 11 whatsnew311-pep6591175308
Ref: 6b11175308
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-11182716
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-21182758
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-31182800
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-41182925
Node: Misc1183150
Ref: whatsnew/3 11 misc1183240
Ref: ad91183240
Ref: whatsnew/3 11 whatsnew311-faster-cpython-misc1183240
Ref: ada1183240
Ref: Misc-Footnote-11184247
Ref: Misc-Footnote-21184312
Ref: Misc-Footnote-31184377
Ref: Misc-Footnote-41184442
Ref: Misc-Footnote-51184507
Ref: Misc-Footnote-61184578
Node: FAQ1184633
Ref: whatsnew/3 11 faq1184714
Ref: adc1184714
Ref: whatsnew/3 11 whatsnew311-faster-cpython-faq1184714
Ref: add1184714
Node: How should I write my code to utilize these speedups?1185005
Ref: whatsnew/3 11 faster-cpython-faq-my-code1185141
Ref: ade1185141
Ref: whatsnew/3 11 how-should-i-write-my-code-to-utilize-these-speedups1185141
Ref: adf1185141
Node: Will CPython 3 11 use more memory?1185434
Ref: whatsnew/3 11 faster-cpython-faq-memory1185623
Ref: ae01185623
Ref: whatsnew/3 11 will-cpython-3-11-use-more-memory1185623
Ref: ae11185623
Node: I don't see any speedups in my workload Why?1185884
Ref: whatsnew/3 11 faster-cpython-ymmv1186044
Ref: ae21186044
Ref: whatsnew/3 11 i-don-t-see-any-speedups-in-my-workload-why1186044
Ref: ae31186044
Node: Is there a JIT compiler?1186628
Ref: whatsnew/3 11 faster-cpython-jit1186745
Ref: ae41186745
Ref: whatsnew/3 11 is-there-a-jit-compiler1186745
Ref: ae51186745
Node: About1186863
Ref: whatsnew/3 11 about1186931
Ref: ae61186931
Ref: whatsnew/3 11 whatsnew311-faster-cpython-about1186931
Ref: ae71186931
Node: CPython バイトコードの変更<3>1187240
Ref: whatsnew/3 11 cpython-bytecode-changes1187384
Ref: ae91187384
Ref: whatsnew/3 11 whatsnew311-bytecode-changes1187384
Ref: aea1187384
Node: New opcodes1187944
Ref: whatsnew/3 11 new-opcodes1188055
Ref: aec1188055
Ref: whatsnew/3 11 whatsnew311-added-opcodes1188055
Ref: aed1188055
Ref: New opcodes-Footnote-11188868
Node: Replaced opcodes1188910
Ref: whatsnew/3 11 replaced-opcodes1189053
Ref: af61189053
Ref: whatsnew/3 11 whatsnew311-replaced-opcodes1189053
Ref: af71189053
Ref: whatsnew/3 11 whatsnew311-changed-opcodes1191771
Ref: afe1191771
Ref: whatsnew/3 11 whatsnew311-removed-opcodes1191771
Ref: aff1191771
Ref: Replaced opcodes-Footnote-11191807
Node: Changed/removed opcodes1192025
Ref: whatsnew/3 11 changed-removed-opcodes1192148
Ref: b001192148
Ref: whatsnew/3 11 whatsnew311-changed-removed-opcodes1192148
Ref: b011192148
Ref: whatsnew/3 11 whatsnew311-deprecated1192736
Ref: b041192736
Ref: Changed/removed opcodes-Footnote-11192773
Node: 非推奨<4>1192828
Ref: whatsnew/3 11 deprecated1192988
Ref: b051192988
Ref: whatsnew/3 11 whatsnew311-python-api-deprecated1192988
Ref: b061192988
Ref: whatsnew/3 11 whatsnew311-deprecated-language1193145
Ref: b081193145
Node: Language/Builtins1193219
Ref: whatsnew/3 11 language-builtins1193309
Ref: b091193309
Ref: whatsnew/3 11 whatsnew311-deprecated-builtins1193309
Ref: b0a1193309
Ref: Language/Builtins-Footnote-11194526
Ref: Language/Builtins-Footnote-21194591
Ref: Language/Builtins-Footnote-31194646
Ref: Language/Builtins-Footnote-41194701
Node: モジュール1194766
Ref: whatsnew/3 11 modules1194881
Ref: b0b1194881
Ref: whatsnew/3 11 whatsnew311-deprecated-modules1194881
Ref: b0c1194881
Ref: whatsnew/3 11 whatsnew311-pep5941194927
Ref: 9b01194927
Ref: モジュール-Footnote-11197137
Ref: モジュール-Footnote-21197179
Ref: モジュール-Footnote-31197244
Ref: モジュール-Footnote-41197299
Ref: モジュール-Footnote-51197364
Ref: モジュール-Footnote-61197406
Ref: モジュール-Footnote-71197471
Node: Standard Library1197536
Ref: whatsnew/3 11 standard-library1197625
Ref: b0d1197625
Ref: whatsnew/3 11 whatsnew311-deprecated-stdlib1197625
Ref: b0e1197625
Ref: whatsnew/3 11 whatsnew311-pending-removal1202482
Ref: b131202482
Ref: Standard Library-Footnote-11202519
Ref: Standard Library-Footnote-21202584
Ref: Standard Library-Footnote-31202649
Ref: Standard Library-Footnote-41202704
Ref: Standard Library-Footnote-51202759
Ref: Standard Library-Footnote-61202814
Ref: Standard Library-Footnote-71202869
Ref: Standard Library-Footnote-81202934
Ref: Standard Library-Footnote-91202989
Ref: Standard Library-Footnote-101203044
Ref: Standard Library-Footnote-111203110
Ref: Standard Library-Footnote-121203175
Node: Pending Removal in Python 3 121203231
Ref: whatsnew/3 11 pending-removal-in-python-3-121203362
Ref: b141203362
Ref: whatsnew/3 11 whatsnew311-python-api-pending-removal1203362
Ref: b151203362
Ref: whatsnew/3 11 whatsnew311-removed1209114
Ref: b191209114
Node: 削除<4>1209114
Ref: whatsnew/3 11 removed1209255
Ref: b1a1209255
Ref: whatsnew/3 11 whatsnew311-python-api-removed1209255
Ref: b1b1209255
Ref: whatsnew/3 11 whatsnew311-porting1213909
Ref: b271213909
Ref: 削除<4>-Footnote-11213946
Ref: 削除<4>-Footnote-21214011
Ref: 削除<4>-Footnote-31214076
Ref: 削除<4>-Footnote-41214141
Ref: 削除<4>-Footnote-51214206
Ref: 削除<4>-Footnote-61214271
Ref: 削除<4>-Footnote-71214336
Ref: 削除<4>-Footnote-81214401
Ref: 削除<4>-Footnote-91214466
Ref: 削除<4>-Footnote-101214531
Ref: 削除<4>-Footnote-111214597
Ref: 削除<4>-Footnote-121214663
Ref: 削除<4>-Footnote-131214729
Ref: 削除<4>-Footnote-141214795
Ref: 削除<4>-Footnote-151214837
Node: Porting to Python 3 111214891
Ref: whatsnew/3 11 porting-to-python-3-111215018
Ref: b281215018
Ref: whatsnew/3 11 whatsnew311-python-api-porting1215018
Ref: b291215018
Ref: Porting to Python 3 11-Footnote-11218059
Ref: Porting to Python 3 11-Footnote-21218124
Ref: Porting to Python 3 11-Footnote-31218179
Ref: Porting to Python 3 11-Footnote-41218244
Ref: Porting to Python 3 11-Footnote-51218309
Ref: Porting to Python 3 11-Footnote-61218374
Ref: Porting to Python 3 11-Footnote-71218439
Ref: Porting to Python 3 11-Footnote-81218504
Node: Build Changes<3>1218569
Ref: whatsnew/3 11 build-changes1218705
Ref: b331218705
Ref: whatsnew/3 11 whatsnew311-build-changes1218705
Ref: b341218705
Ref: Build Changes<3>-Footnote-11222933
Ref: Build Changes<3>-Footnote-21222975
Ref: Build Changes<3>-Footnote-31223024
Ref: Build Changes<3>-Footnote-41223057
Ref: Build Changes<3>-Footnote-51223089
Ref: Build Changes<3>-Footnote-61223115
Ref: Build Changes<3>-Footnote-71223144
Ref: Build Changes<3>-Footnote-81223199
Ref: Build Changes<3>-Footnote-91223254
Ref: Build Changes<3>-Footnote-101223309
Ref: Build Changes<3>-Footnote-111223353
Ref: Build Changes<3>-Footnote-121223437
Ref: Build Changes<3>-Footnote-131223503
Ref: Build Changes<3>-Footnote-141223569
Ref: Build Changes<3>-Footnote-151223635
Ref: Build Changes<3>-Footnote-161223683
Ref: Build Changes<3>-Footnote-171223749
Ref: Build Changes<3>-Footnote-181223815
Ref: Build Changes<3>-Footnote-191223843
Ref: Build Changes<3>-Footnote-201223909
Ref: Build Changes<3>-Footnote-211223972
Ref: Build Changes<3>-Footnote-221224000
Ref: Build Changes<3>-Footnote-231224066
Ref: Build Changes<3>-Footnote-241224132
Ref: Build Changes<3>-Footnote-251224198
Ref: Build Changes<3>-Footnote-261224264
Ref: Build Changes<3>-Footnote-271224314
Ref: Build Changes<3>-Footnote-281224380
Ref: Build Changes<3>-Footnote-291224446
Ref: Build Changes<3>-Footnote-301224512
Ref: Build Changes<3>-Footnote-311224578
Ref: Build Changes<3>-Footnote-321224644
Ref: Build Changes<3>-Footnote-331224710
Node: C API の変更<5>1224776
Ref: whatsnew/3 11 c-api-changes1224927
Ref: b371224927
Ref: whatsnew/3 11 whatsnew311-c-api1224927
Ref: b381224927
Node: 新しい機能<7>1225190
Ref: whatsnew/3 11 id51225297
Ref: b391225297
Ref: whatsnew/3 11 whatsnew311-c-api-new-features1225297
Ref: b3a1225297
Ref: 新しい機能<7>-Footnote-11228148
Ref: 新しい機能<7>-Footnote-21228213
Ref: 新しい機能<7>-Footnote-31228278
Ref: 新しい機能<7>-Footnote-41228343
Ref: 新しい機能<7>-Footnote-51228408
Ref: 新しい機能<7>-Footnote-61228473
Ref: 新しい機能<7>-Footnote-71228538
Ref: 新しい機能<7>-Footnote-81228603
Ref: 新しい機能<7>-Footnote-91228668
Node: Porting to Python 3 11<2>1228723
Ref: whatsnew/3 11 id61228851
Ref: b5b1228851
Ref: whatsnew/3 11 whatsnew311-c-api-porting1228851
Ref: b2a1228851
Ref: whatsnew/3 11 whatsnew311-pep6701228916
Ref: 9b21228916
Ref: whatsnew/3 11 pyframeobject-3-11-hiding1236331
Ref: b6c1236331
Ref: Porting to Python 3 11<2>-Footnote-11242288
Ref: Porting to Python 3 11<2>-Footnote-21242351
Ref: Porting to Python 3 11<2>-Footnote-31242393
Ref: Porting to Python 3 11<2>-Footnote-41242448
Ref: Porting to Python 3 11<2>-Footnote-51242513
Ref: Porting to Python 3 11<2>-Footnote-61242578
Ref: Porting to Python 3 11<2>-Footnote-71242643
Ref: Porting to Python 3 11<2>-Footnote-81242685
Ref: Porting to Python 3 11<2>-Footnote-91242750
Ref: Porting to Python 3 11<2>-Footnote-101242805
Ref: Porting to Python 3 11<2>-Footnote-111242861
Ref: Porting to Python 3 11<2>-Footnote-121242927
Ref: Porting to Python 3 11<2>-Footnote-131242970
Ref: Porting to Python 3 11<2>-Footnote-141243036
Ref: Porting to Python 3 11<2>-Footnote-151243102
Ref: Porting to Python 3 11<2>-Footnote-161243168
Ref: Porting to Python 3 11<2>-Footnote-171243234
Ref: Porting to Python 3 11<2>-Footnote-181243300
Ref: Porting to Python 3 11<2>-Footnote-191243366
Ref: Porting to Python 3 11<2>-Footnote-201243422
Ref: Porting to Python 3 11<2>-Footnote-211243475
Ref: Porting to Python 3 11<2>-Footnote-221243541
Ref: Porting to Python 3 11<2>-Footnote-231243607
Ref: Porting to Python 3 11<2>-Footnote-241243660
Node: 非推奨<5>1243693
Ref: whatsnew/3 11 id71243836
Ref: b751243836
Ref: whatsnew/3 11 whatsnew311-c-api-deprecated1243836
Ref: b071243836
Ref: 非推奨<5>-Footnote-11244800
Ref: 非推奨<5>-Footnote-21244842
Ref: 非推奨<5>-Footnote-31244897
Node: Pending Removal in Python 3 12<2>1244962
Ref: whatsnew/3 11 id81245089
Ref: b771245089
Ref: whatsnew/3 11 whatsnew311-c-api-pending-removal1245089
Ref: b161245089
Node: 削除<5>1245839
Ref: whatsnew/3 11 id91245945
Ref: b791245945
Ref: whatsnew/3 11 whatsnew311-c-api-removed1245945
Ref: b1c1245945
Ref: whatsnew/3 11 whatsnew311-pep6241248195
Ref: 9b11248195
Ref: 削除<5>-Footnote-11249155
Ref: 削除<5>-Footnote-21249220
Ref: 削除<5>-Footnote-31249285
Ref: 削除<5>-Footnote-41249350
Ref: 削除<5>-Footnote-51249415
Ref: 削除<5>-Footnote-61249480
Ref: 削除<5>-Footnote-71249545
Ref: 削除<5>-Footnote-81249610
Ref: 削除<5>-Footnote-91249675
Ref: 削除<5>-Footnote-101249740
Ref: 削除<5>-Footnote-111249783
Ref: 削除<5>-Footnote-121249843
Node: Python 3 11 4での重要な変更点1249909
Ref: whatsnew/3 11 notable-changes-in-3-11-41250081
Ref: b801250081
Node: tarfile<4>1250197
Ref: whatsnew/3 11 tarfile1250281
Ref: b811250281
Ref: tarfile<4>-Footnote-11250885
Node: Python 3 11 5での重要な変更点1250927
Ref: whatsnew/3 11 notable-changes-in-3-11-51251072
Ref: b821251072
Node: OpenSSL1251177
Ref: whatsnew/3 11 openssl1251258
Ref: b831251258
Node: What's New In Python 3 101251377
Ref: whatsnew/3 10 doc1251526
Ref: b841251526
Ref: whatsnew/3 10 translation-repo1251526
Ref: b851251526
Ref: whatsnew/3 10 what-s-new-in-python-3-101251526
Ref: b861251526
Node: 概要 -- リリースハイライト<5>1252743
Ref: whatsnew/3 10 summary-release-highlights1252872
Ref: b871252872
Ref: 概要 -- リリースハイライト<5>-Footnote-11254142
Ref: 概要 -- リリースハイライト<5>-Footnote-21254184
Ref: 概要 -- リリースハイライト<5>-Footnote-31254226
Ref: 概要 -- リリースハイライト<5>-Footnote-41254268
Ref: 概要 -- リリースハイライト<5>-Footnote-51254333
Ref: 概要 -- リリースハイライト<5>-Footnote-61254375
Ref: 概要 -- リリースハイライト<5>-Footnote-71254417
Ref: 概要 -- リリースハイライト<5>-Footnote-81254459
Ref: 概要 -- リリースハイライト<5>-Footnote-91254501
Ref: 概要 -- リリースハイライト<5>-Footnote-101254543
Ref: 概要 -- リリースハイライト<5>-Footnote-111254586
Ref: 概要 -- リリースハイライト<5>-Footnote-121254629
Ref: 概要 -- リリースハイライト<5>-Footnote-131254672
Ref: 概要 -- リリースハイライト<5>-Footnote-141254715
Ref: 概要 -- リリースハイライト<5>-Footnote-151254758
Node: 新しい機能<8>1254801
Ref: whatsnew/3 10 new-features1254984
Ref: b881254984
Node: カッコ内のコンテキストマネージャー1255467
Ref: whatsnew/3 10 parenthesized-context-managers1255618
Ref: b891255618
Ref: whatsnew/3 10 whatsnew310-pep5631255618
Ref: b8a1255618
Ref: カッコ内のコンテキストマネージャー-Footnote-11257032
Ref: カッコ内のコンテキストマネージャー-Footnote-21257074
Ref: カッコ内のコンテキストマネージャー-Footnote-31257139
Node: エラーメッセージの改善<4>1257204
Ref: whatsnew/3 10 better-error-messages1257441
Ref: b8b1257441
Node: SyntaxErrors1257599
Ref: whatsnew/3 10 syntaxerrors1257710
Ref: b8c1257710
Ref: SyntaxErrors-Footnote-11263721
Ref: SyntaxErrors-Footnote-21263786
Ref: SyntaxErrors-Footnote-31263851
Ref: SyntaxErrors-Footnote-41263916
Ref: SyntaxErrors-Footnote-51263981
Ref: SyntaxErrors-Footnote-61264046
Ref: SyntaxErrors-Footnote-71264111
Ref: SyntaxErrors-Footnote-81264176
Ref: SyntaxErrors-Footnote-91264241
Ref: SyntaxErrors-Footnote-101264306
Ref: SyntaxErrors-Footnote-111264372
Node: IndentationErrors1264438
Ref: whatsnew/3 10 indentationerrors1264573
Ref: b8d1264573
Node: AttributeErrors1265043
Ref: whatsnew/3 10 attributeerrors1265176
Ref: b8e1265176
Ref: AttributeErrors-Footnote-11265926
Node: NameErrors1265991
Ref: whatsnew/3 10 nameerrors1266098
Ref: b8f1266098
Ref: NameErrors-Footnote-11266908
Node: PEP 626 デバッグおよびその他のツール用の正確な行番号。1266973
Ref: whatsnew/3 10 pep-626-precise-line-numbers-for-debugging-and-other-tools1267197
Ref: b901267197
Node: PEP 634 構造的パターンマッチ1267912
Ref: whatsnew/3 10 pep-634-structural-pattern-matching1268153
Ref: b921268153
Node: 構文と演算1269022
Ref: whatsnew/3 10 syntax-and-operations1269148
Ref: b931269148
Node: 宣言的なアプローチ1270370
Ref: whatsnew/3 10 declarative-approach1270551
Ref: b941270551
Node: 単純パターン リテラルとのマッチ1272044
Ref: whatsnew/3 10 simple-pattern-match-to-a-literal1272264
Ref: b951272264
Node: ワイルドカードがないときの振る舞い1273916
Ref: whatsnew/3 10 behavior-without-the-wildcard1274050
Ref: b961274050
Node: リテラルと変数を組み合わせたパターン1274816
Ref: whatsnew/3 10 patterns-with-a-literal-and-variable1275033
Ref: b971275033
Node: パターンとクラス1276244
Ref: whatsnew/3 10 patterns-and-classes1276442
Ref: b981276442
Node: 位置パラメータを用いたパターン1277501
Ref: whatsnew/3 10 patterns-with-positional-parameters1277607
Ref: b991277607
Node: ネストしたパターン1278236
Ref: whatsnew/3 10 nested-patterns1278425
Ref: b9a1278425
Node: 複雑なパターンとワイルドカード1279207
Ref: whatsnew/3 10 complex-patterns-and-the-wildcard1279381
Ref: b9b1279381
Node: ガード1280114
Ref: whatsnew/3 10 guard1280288
Ref: b9c1280288
Node: その他の主要な機能1280832
Ref: whatsnew/3 10 other-key-features1280952
Ref: b9d1280952
Ref: その他の主要な機能-Footnote-11283869
Ref: その他の主要な機能-Footnote-21283911
Ref: その他の主要な機能-Footnote-31283953
Node: Optional EncodingWarning and encoding="locale" option1283995
Ref: whatsnew/3 10 optional-encodingwarning-and-encoding-locale-option1284150
Ref: b9e1284150
Ref: whatsnew/3 10 whatsnew310-pep5971284150
Ref: b9f1284150
Node: 型ヒントに関連する新しい機能<3>1285050
Ref: whatsnew/3 10 new-feat-related-type-hints1285220
Ref: ba31285220
Ref: whatsnew/3 10 new-features-related-to-type-hints1285220
Ref: ba41285220
Ref: 型ヒントに関連する新しい機能<3>-Footnote-11285723
Node: PEP 604 New Type Union Operator1285765
Ref: whatsnew/3 10 pep-604-new-type-union-operator1285928
Ref: ba51285928
Ref: PEP 604 New Type Union Operator-Footnote-11286997
Ref: PEP 604 New Type Union Operator-Footnote-21287039
Ref: PEP 604 New Type Union Operator-Footnote-31287104
Node: PEP 612 Parameter Specification Variables1287169
Ref: whatsnew/3 10 pep-612-parameter-specification-variables1287358
Ref: ba71287358
Ref: PEP 612 Parameter Specification Variables-Footnote-11288639
Ref: PEP 612 Parameter Specification Variables-Footnote-21288681
Ref: PEP 612 Parameter Specification Variables-Footnote-31288723
Ref: PEP 612 Parameter Specification Variables-Footnote-41288788
Node: PEP 613 TypeAlias1288853
Ref: whatsnew/3 10 pep-613-typealias1289043
Ref: bac1289043
Ref: PEP 613 TypeAlias-Footnote-11289896
Ref: PEP 613 TypeAlias-Footnote-21289938
Ref: PEP 613 TypeAlias-Footnote-31289980
Node: PEP 647 User-Defined Type Guards1290045
Ref: whatsnew/3 10 pep-647-user-defined-type-guards1290185
Ref: bae1290185
Ref: PEP 647 User-Defined Type Guards-Footnote-11290665
Ref: PEP 647 User-Defined Type Guards-Footnote-21290707
Node: その他の言語変更<4>1290772
Ref: whatsnew/3 10 other-language-changes1290951
Ref: baf1290951
Ref: その他の言語変更<4>-Footnote-11295653
Ref: その他の言語変更<4>-Footnote-21295718
Ref: その他の言語変更<4>-Footnote-31295783
Ref: その他の言語変更<4>-Footnote-41295825
Ref: その他の言語変更<4>-Footnote-51295890
Ref: その他の言語変更<4>-Footnote-61295955
Ref: その他の言語変更<4>-Footnote-71296020
Ref: その他の言語変更<4>-Footnote-81296085
Ref: その他の言語変更<4>-Footnote-91296150
Ref: その他の言語変更<4>-Footnote-101296192
Ref: その他の言語変更<4>-Footnote-111296258
Ref: その他の言語変更<4>-Footnote-121296324
Ref: その他の言語変更<4>-Footnote-131296390
Ref: その他の言語変更<4>-Footnote-141296456
Ref: その他の言語変更<4>-Footnote-151296522
Ref: その他の言語変更<4>-Footnote-161296588
Node: 新たなモジュール<4>1296654
Ref: whatsnew/3 10 new-modules1296821
Ref: bbc1296821
Node: 改良されたモジュール<4>1296888
Ref: whatsnew/3 10 improved-modules1297040
Ref: bbd1297040
Node: asyncio<9>1298316
Ref: whatsnew/3 10 asyncio1298416
Ref: bbe1298416
Ref: asyncio<9>-Footnote-11298594
Node: argparse<5>1298659
Ref: whatsnew/3 10 argparse1298776
Ref: bc01298776
Ref: argparse<5>-Footnote-11299058
Node: array<3>1299122
Ref: whatsnew/3 10 array1299252
Ref: bc11299252
Ref: array<3>-Footnote-11299494
Node: asynchat asyncore smtpd1299559
Ref: whatsnew/3 10 asynchat-asyncore-smtpd1299687
Ref: bc31299687
Node: base64<4>1299947
Ref: whatsnew/3 10 base641300073
Ref: bc41300073
Node: bdb<2>1300240
Ref: whatsnew/3 10 bdb1300349
Ref: bc51300349
Ref: bdb<2>-Footnote-11300518
Node: bisect1300583
Ref: whatsnew/3 10 bisect1300689
Ref: bc61300689
Ref: bisect-Footnote-11300906
Node: codecs1300970
Ref: whatsnew/3 10 codecs1301088
Ref: bc71301088
Ref: codecs-Footnote-11301285
Node: collections abc<2>1301350
Ref: whatsnew/3 10 collections-abc1301475
Ref: bc91301475
Ref: collections abc<2>-Footnote-11302372
Node: contextlib<3>1302437
Ref: whatsnew/3 10 contextlib1302565
Ref: bcc1302565
Ref: contextlib<3>-Footnote-11303087
Ref: contextlib<3>-Footnote-21303152
Node: curses<2>1303217
Ref: whatsnew/3 10 curses1303348
Ref: bcf1303348
Ref: curses<2>-Footnote-11304045
Ref: curses<2>-Footnote-21304110
Node: データクラス<2>1304175
Ref: whatsnew/3 10 dataclasses1304305
Ref: bd51304305
Node: __slots__1304404
Ref: whatsnew/3 10 slots1304499
Ref: bd61304499
Ref: __slots__-Footnote-11304701
Node: Keyword-only fields1304766
Ref: whatsnew/3 10 keyword-only-fields1304861
Ref: bd71304861
Ref: Keyword-only fields-Footnote-11306334
Node: distutils<2>1306399
Ref: whatsnew/3 10 distutils1306530
Ref: bd81306530
Ref: whatsnew/3 10 distutils-deprecated1306530
Ref: b171306530
Ref: distutils<2>-Footnote-11307438
Ref: distutils<2>-Footnote-21307480
Node: doctest<2>1307545
Ref: whatsnew/3 10 doctest1307679
Ref: bd91307679
Ref: doctest<2>-Footnote-11307883
Node: エンコーディング1307948
Ref: whatsnew/3 10 encodings1308077
Ref: bda1308077
Ref: エンコーディング-Footnote-11308295
Node: enum<4>1308360
Ref: whatsnew/3 10 enum1308488
Ref: enum<4>-Footnote-11308961
Ref: enum<4>-Footnote-21309026
Node: fileinput1309091
Ref: whatsnew/3 10 fileinput1309210
Ref: bdc1309210
Ref: fileinput-Footnote-11309641
Ref: fileinput-Footnote-21309706
Node: faulthandler<3>1309770
Ref: whatsnew/3 10 faulthandler1309887
Ref: bdf1309887
Ref: faulthandler<3>-Footnote-11310129
Node: gc<4>1310194
Ref: whatsnew/3 10 gc1310309
Ref: be01310309
Ref: gc<4>-Footnote-11310534
Node: glob<3>1310599
Ref: whatsnew/3 10 glob1310709
Ref: be41310709
Ref: glob<3>-Footnote-11310973
Node: hashlib<4>1311038
Ref: whatsnew/3 10 hashlib1311150
Ref: be61311150
Ref: hashlib<4>-Footnote-11311693
Ref: hashlib<4>-Footnote-21311735
Ref: hashlib<4>-Footnote-31311800
Ref: hashlib<4>-Footnote-41311865
Node: hmac<2>1311930
Ref: whatsnew/3 10 hmac1312055
Ref: be71312055
Ref: hmac<2>-Footnote-11312239
Node: IDLE と idelelib<2>1312304
Ref: whatsnew/3 10 idle-and-idlelib1312440
Ref: be81312440
Ref: IDLE と idelelib<2>-Footnote-11314507
Ref: IDLE と idelelib<2>-Footnote-21314572
Ref: IDLE と idelelib<2>-Footnote-31314637
Ref: IDLE と idelelib<2>-Footnote-41314702
Ref: IDLE と idelelib<2>-Footnote-51314767
Ref: IDLE と idelelib<2>-Footnote-61314832
Ref: IDLE と idelelib<2>-Footnote-71314897
Ref: IDLE と idelelib<2>-Footnote-81314962
Node: importlib metadata<2>1315017
Ref: whatsnew/3 10 importlib-metadata1315156
Ref: bec1315156
Ref: importlib metadata<2>-Footnote-11315750
Node: inspect<5>1315823
Ref: whatsnew/3 10 inspect1315954
Ref: bef1315954
Ref: inspect<5>-Footnote-11317151
Ref: inspect<5>-Footnote-21317216
Node: itertools<4>1317281
Ref: whatsnew/3 10 itertools1317403
Ref: bf11317403
Ref: itertools<4>-Footnote-11317569
Node: linecache<2>1317634
Ref: whatsnew/3 10 linecache1317751
Ref: bf31317751
Ref: linecache<2>-Footnote-11317959
Node: os<7>1318024
Ref: whatsnew/3 10 os1318139
Ref: bf41318139
Ref: os<7>-Footnote-11318878
Ref: os<7>-Footnote-21318943
Ref: os<7>-Footnote-31319008
Ref: os<7>-Footnote-41319073
Node: os path<5>1319138
Ref: whatsnew/3 10 os-path1319251
Ref: bfb1319251
Ref: os path<5>-Footnote-11319560
Node: pathlib<9>1319625
Ref: whatsnew/3 10 pathlib1319760
Ref: bfc1319760
Ref: pathlib<9>-Footnote-11320469
Ref: pathlib<9>-Footnote-21320534
Ref: pathlib<9>-Footnote-31320599
Ref: pathlib<9>-Footnote-41320664
Node: プラットフォーム<3>1320729
Ref: whatsnew/3 10 platform1320863
Ref: c021320863
Ref: プラットフォーム<3>-Footnote-11321156
Ref: プラットフォーム<3>-Footnote-21321229
Node: pprint<2>1321294
Ref: whatsnew/3 10 pprint1321428
Ref: c041321428
Ref: pprint<2>-Footnote-11321762
Ref: pprint<2>-Footnote-21321827
Node: py_compile1321892
Ref: whatsnew/3 10 py-compile1322005
Ref: c061322005
Ref: py_compile-Footnote-11322213
Node: pyclbr1322278
Ref: whatsnew/3 10 pyclbr1322391
Ref: c071322391
Ref: pyclbr-Footnote-11322735
Node: shelve<2>1322800
Ref: whatsnew/3 10 shelve1322916
Ref: c0a1322916
Ref: shelve<2>-Footnote-11323189
Node: statistics<3>1323254
Ref: whatsnew/3 10 statistics1323371
Ref: c0c1323371
Ref: statistics<3>-Footnote-11323624
Node: site<2>1323689
Ref: whatsnew/3 10 site1323806
Ref: c0f1323806
Ref: site<2>-Footnote-11324004
Node: socket<4>1324069
Ref: whatsnew/3 10 socket1324179
Ref: c101324179
Ref: socket<4>-Footnote-11324625
Ref: socket<4>-Footnote-21324690
Ref: socket<4>-Footnote-31324755
Node: ssl<5>1324820
Ref: whatsnew/3 10 ssl1324933
Ref: c131324933
Ref: ssl<5>-Footnote-11326772
Ref: ssl<5>-Footnote-21326814
Ref: ssl<5>-Footnote-31326879
Ref: ssl<5>-Footnote-41326944
Ref: ssl<5>-Footnote-51327009
Ref: ssl<5>-Footnote-61327074
Ref: ssl<5>-Footnote-71327139
Ref: ssl<5>-Footnote-81327204
Ref: ssl<5>-Footnote-91327269
Ref: ssl<5>-Footnote-101327334
Ref: ssl<5>-Footnote-111327400
Ref: ssl<5>-Footnote-121327466
Ref: ssl<5>-Footnote-131327532
Ref: ssl<5>-Footnote-141327598
Ref: ssl<5>-Footnote-151327664
Node: sqlite3<7>1327730
Ref: whatsnew/3 10 sqlite31327840
Ref: c1a1327840
Ref: sqlite3<7>-Footnote-11328076
Node: sys<7>1328141
Ref: whatsnew/3 10 sys1328252
Ref: c1c1328252
Ref: sys<7>-Footnote-11328637
Ref: sys<7>-Footnote-21328702
Node: _thread1328767
Ref: whatsnew/3 10 thread1328880
Ref: c1f1328880
Ref: _thread-Footnote-11329136
Node: threading<6>1329201
Ref: whatsnew/3 10 threading1329320
Ref: c211329320
Ref: threading<6>-Footnote-11329862
Ref: threading<6>-Footnote-21329927
Node: traceback<3>1329992
Ref: whatsnew/3 10 traceback1330112
Ref: c281330112
Ref: traceback<3>-Footnote-11330440
Node: types<6>1330505
Ref: whatsnew/3 10 types1330622
Ref: c2c1330622
Ref: types<6>-Footnote-11330931
Node: typing<8>1330996
Ref: whatsnew/3 10 typing1331112
Ref: c301331112
Ref: typing<8>-Footnote-11333345
Ref: typing<8>-Footnote-21333387
Ref: typing<8>-Footnote-31333452
Ref: typing<8>-Footnote-41333517
Ref: typing<8>-Footnote-51333582
Node: unittest<7>1333647
Ref: whatsnew/3 10 unittest1333770
Ref: c331333770
Ref: unittest<7>-Footnote-11333986
Node: urllib parse<2>1334051
Ref: whatsnew/3 10 urllib-parse1334171
Ref: c351334171
Ref: urllib parse<2>-Footnote-11335320
Ref: urllib parse<2>-Footnote-21335385
Ref: urllib parse<2>-Footnote-31335444
Node: xml<3>1335499
Ref: whatsnew/3 10 xml1335620
Ref: c361335620
Ref: xml<3>-Footnote-11335836
Node: zipimport<4>1335901
Ref: whatsnew/3 10 zipimport1335998
Ref: c381335998
Ref: zipimport<4>-Footnote-11336378
Ref: zipimport<4>-Footnote-21336420
Ref: zipimport<4>-Footnote-31336485
Node: 最適化<5>1336550
Ref: whatsnew/3 10 optimizations1336687
Ref: c3c1336687
Ref: 最適化<5>-Footnote-11340156
Ref: 最適化<5>-Footnote-21340221
Ref: 最適化<5>-Footnote-31340286
Ref: 最適化<5>-Footnote-41340351
Ref: 最適化<5>-Footnote-51340416
Ref: 最適化<5>-Footnote-61340481
Ref: 最適化<5>-Footnote-71340602
Ref: 最適化<5>-Footnote-81340667
Ref: 最適化<5>-Footnote-91340732
Ref: 最適化<5>-Footnote-101340797
Ref: 最適化<5>-Footnote-111340863
Ref: 最適化<5>-Footnote-121340929
Ref: 最適化<5>-Footnote-131340972
Ref: 最適化<5>-Footnote-141341038
Ref: 最適化<5>-Footnote-151341104
Ref: 最適化<5>-Footnote-161341170
Ref: 最適化<5>-Footnote-171341236
Ref: 最適化<5>-Footnote-181341302
Node: 非推奨<6>1341368
Ref: whatsnew/3 10 deprecated1341481
Ref: c421341481
Ref: whatsnew/3 10 whatsnew310-deprecated1341481
Ref: c181341481
Ref: 非推奨<6>-Footnote-11350930
Ref: 非推奨<6>-Footnote-21350995
Ref: 非推奨<6>-Footnote-31351060
Ref: 非推奨<6>-Footnote-41351125
Ref: 非推奨<6>-Footnote-51351190
Ref: 非推奨<6>-Footnote-61351255
Ref: 非推奨<6>-Footnote-71351320
Ref: 非推奨<6>-Footnote-81351385
Ref: 非推奨<6>-Footnote-91351450
Ref: 非推奨<6>-Footnote-101351515
Ref: 非推奨<6>-Footnote-111351581
Ref: 非推奨<6>-Footnote-121351647
Ref: 非推奨<6>-Footnote-131351713
Ref: 非推奨<6>-Footnote-141351779
Ref: 非推奨<6>-Footnote-151351838
Ref: 非推奨<6>-Footnote-161351904
Ref: 非推奨<6>-Footnote-171351960
Ref: 非推奨<6>-Footnote-181352026
Ref: 非推奨<6>-Footnote-191352092
Ref: 非推奨<6>-Footnote-201352158
Node: 削除<6>1352224
Ref: whatsnew/3 10 removed1352347
Ref: c4f1352347
Ref: whatsnew/3 10 whatsnew310-removed1352347
Ref: c501352347
Ref: 削除<6>-Footnote-11355578
Ref: 削除<6>-Footnote-21355643
Ref: 削除<6>-Footnote-31355708
Ref: 削除<6>-Footnote-41355773
Ref: 削除<6>-Footnote-51355838
Ref: 削除<6>-Footnote-61355903
Ref: 削除<6>-Footnote-71355968
Node: Porting to Python 3 101356033
Ref: whatsnew/3 10 porting-to-python-3-101356182
Ref: c551356182
Node: Changes in the Python syntax1356522
Ref: whatsnew/3 10 changes-in-the-python-syntax1356641
Ref: c561356641
Ref: Changes in the Python syntax-Footnote-11357236
Node: Python API の変更<4>1357301
Ref: whatsnew/3 10 changes-in-the-python-api1357447
Ref: c571357447
Ref: whatsnew/3 10 changes-python-api1357447
Ref: c541357447
Ref: Python API の変更<4>-Footnote-11360351
Ref: Python API の変更<4>-Footnote-21360416
Ref: Python API の変更<4>-Footnote-31360481
Ref: Python API の変更<4>-Footnote-41360546
Ref: Python API の変更<4>-Footnote-51360611
Ref: Python API の変更<4>-Footnote-61360676
Node: C API の変更<6>1360741
Ref: whatsnew/3 10 changes-in-the-c-api1360850
Ref: c5e1360850
Node: CPython バイトコードの変更<4>1363309
Ref: whatsnew/3 10 cpython-bytecode-changes1363465
Ref: c641363465
Ref: CPython バイトコードの変更<4>-Footnote-11363775
Node: Build Changes<4>1363840
Ref: whatsnew/3 10 build-changes1363992
Ref: c651363992
Ref: Build Changes<4>-Footnote-11366452
Ref: Build Changes<4>-Footnote-21366494
Ref: Build Changes<4>-Footnote-31366559
Ref: Build Changes<4>-Footnote-41366624
Ref: Build Changes<4>-Footnote-51366689
Ref: Build Changes<4>-Footnote-61366754
Ref: Build Changes<4>-Footnote-71366819
Ref: Build Changes<4>-Footnote-81366884
Ref: Build Changes<4>-Footnote-91366949
Ref: Build Changes<4>-Footnote-101367014
Ref: Build Changes<4>-Footnote-111367080
Node: C API の変更<7>1367146
Ref: whatsnew/3 10 c-api-changes1367294
Ref: c6a1367294
Node: PEP 652 Maintaining the Stable ABI1367563
Ref: whatsnew/3 10 pep-652-maintaining-the-stable-abi1367679
Ref: c6b1367679
Ref: PEP 652 Maintaining the Stable ABI-Footnote-11368120
Ref: PEP 652 Maintaining the Stable ABI-Footnote-21368162
Node: 新しい機能<9>1368227
Ref: whatsnew/3 10 id11368377
Ref: c6c1368377
Ref: 新しい機能<9>-Footnote-11373003
Ref: 新しい機能<9>-Footnote-21373068
Ref: 新しい機能<9>-Footnote-31373133
Ref: 新しい機能<9>-Footnote-41373198
Ref: 新しい機能<9>-Footnote-51373263
Ref: 新しい機能<9>-Footnote-61373328
Ref: 新しい機能<9>-Footnote-71373393
Ref: 新しい機能<9>-Footnote-81373460
Ref: 新しい機能<9>-Footnote-91373525
Ref: 新しい機能<9>-Footnote-101373590
Ref: 新しい機能<9>-Footnote-111373656
Ref: 新しい機能<9>-Footnote-121373722
Ref: 新しい機能<9>-Footnote-131373788
Ref: 新しい機能<9>-Footnote-141373854
Ref: 新しい機能<9>-Footnote-151373920
Ref: 新しい機能<9>-Footnote-161373986
Ref: 新しい機能<9>-Footnote-171374052
Ref: 新しい機能<9>-Footnote-181374118
Node: Porting to Python 3 10<2>1374184
Ref: whatsnew/3 10 id21374312
Ref: c811374312
Ref: Porting to Python 3 10<2>-Footnote-11377952
Ref: Porting to Python 3 10<2>-Footnote-21377994
Ref: Porting to Python 3 10<2>-Footnote-31378059
Ref: Porting to Python 3 10<2>-Footnote-41378124
Ref: Porting to Python 3 10<2>-Footnote-51378189
Ref: Porting to Python 3 10<2>-Footnote-61378254
Ref: Porting to Python 3 10<2>-Footnote-71378319
Ref: Porting to Python 3 10<2>-Footnote-81378384
Ref: Porting to Python 3 10<2>-Footnote-91378449
Ref: Porting to Python 3 10<2>-Footnote-101378514
Ref: Porting to Python 3 10<2>-Footnote-111378580
Node: 非推奨<7>1378646
Ref: whatsnew/3 10 id31378765
Ref: c871378765
Ref: 非推奨<7>-Footnote-11379059
Node: 削除<7>1379124
Ref: whatsnew/3 10 id41379209
Ref: c891379209
Ref: 削除<7>-Footnote-11384209
Ref: 削除<7>-Footnote-21384274
Ref: 削除<7>-Footnote-31384316
Ref: 削除<7>-Footnote-41384381
Ref: 削除<7>-Footnote-51384446
Ref: 削除<7>-Footnote-61384511
Ref: 削除<7>-Footnote-71384576
Ref: 削除<7>-Footnote-81384641
Ref: 削除<7>-Footnote-91384706
Ref: 削除<7>-Footnote-101384748
Ref: 削除<7>-Footnote-111384814
Ref: 削除<7>-Footnote-121384880
Ref: 削除<7>-Footnote-131384946
Ref: 削除<7>-Footnote-141385012
Ref: 削除<7>-Footnote-151385078
Ref: 削除<7>-Footnote-161385144
Node: Notable security feature in 3 10 71385210
Ref: whatsnew/3 10 notable-security-feature-in-3-10-71385376
Ref: c961385376
Ref: Notable security feature in 3 10 7-Footnote-11386106
Node: Notable security feature in 3 10 81386162
Ref: whatsnew/3 10 notable-security-feature-in-3-10-81386336
Ref: c971386336
Ref: Notable security feature in 3 10 8-Footnote-11386758
Node: Notable changes in 3 10 121386813
Ref: whatsnew/3 10 notable-changes-in-3-10-121386944
Ref: c981386944
Node: tarfile<5>1387046
Ref: whatsnew/3 10 tarfile1387119
Ref: c991387119
Ref: tarfile<5>-Footnote-11387723
Node: What's New In Python 3 91387765
Ref: whatsnew/3 9 doc1387913
Ref: c9a1387913
Ref: whatsnew/3 9 translation-repo1387913
Ref: c9b1387913
Ref: whatsnew/3 9 what-s-new-in-python-3-91387913
Ref: c9c1387913
Ref: What's New In Python 3 9-Footnote-11389395
Node: 概要 -- リリースハイライト<6>1389437
Ref: whatsnew/3 9 summary-release-highlights1389627
Ref: c9d1389627
Ref: 概要 -- リリースハイライト<6>-Footnote-11391990
Ref: 概要 -- リリースハイライト<6>-Footnote-21392032
Ref: 概要 -- リリースハイライト<6>-Footnote-31392074
Ref: 概要 -- リリースハイライト<6>-Footnote-41392116
Ref: 概要 -- リリースハイライト<6>-Footnote-51392158
Ref: 概要 -- リリースハイライト<6>-Footnote-61392200
Ref: 概要 -- リリースハイライト<6>-Footnote-71392242
Ref: 概要 -- リリースハイライト<6>-Footnote-81392284
Ref: 概要 -- リリースハイライト<6>-Footnote-91392326
Ref: 概要 -- リリースハイライト<6>-Footnote-101392368
Node: コード中の非推奨警告 DeprecationWarning をチェックして下さい1392411
Ref: whatsnew/3 9 you-should-check-for-deprecationwarning-in-your-code1392629
Ref: c9e1392629
Node: 新しい機能<10>1394771
Ref: whatsnew/3 9 new-features1394976
Ref: ca21394976
Node: 辞書のマージと更新演算子1395330
Ref: whatsnew/3 9 dictionary-merge-update-operators1395491
Ref: ca31395491
Ref: 辞書のマージと更新演算子-Footnote-11396307
Ref: 辞書のマージと更新演算子-Footnote-21396349
Node: prefixとsuffixを削除する新しい文字列メソッド1396414
Ref: whatsnew/3 9 new-string-methods-to-remove-prefixes-and-suffixes1396666
Ref: ca41396666
Ref: prefixとsuffixを削除する新しい文字列メソッド-Footnote-11397216
Ref: prefixとsuffixを削除する新しい文字列メソッド-Footnote-21397258
Node: 標準コレクション型の型ヒントにおける総称型 generics の使用1397323
Ref: whatsnew/3 9 type-hinting-generics-in-standard-collections1397560
Ref: ca71397560
Ref: 標準コレクション型の型ヒントにおける総称型 generics の使用-Footnote-11398428
Ref: 標準コレクション型の型ヒントにおける総称型 generics の使用-Footnote-21398470
Node: 新しいパーサー1398535
Ref: whatsnew/3 9 new-parser1398703
Ref: ca81398703
Ref: 新しいパーサー-Footnote-11399774
Ref: 新しいパーサー-Footnote-21399822
Ref: 新しいパーサー-Footnote-31399887
Ref: 新しいパーサー-Footnote-41399929
Node: その他の言語変更<5>1399994
Ref: whatsnew/3 9 other-language-changes1400146
Ref: ca91400146
Ref: その他の言語変更<5>-Footnote-11403244
Ref: その他の言語変更<5>-Footnote-21403309
Ref: その他の言語変更<5>-Footnote-31403374
Ref: その他の言語変更<5>-Footnote-41403439
Ref: その他の言語変更<5>-Footnote-51403504
Ref: その他の言語変更<5>-Footnote-61403546
Ref: その他の言語変更<5>-Footnote-71403611
Ref: その他の言語変更<5>-Footnote-81403676
Ref: その他の言語変更<5>-Footnote-91403741
Ref: その他の言語変更<5>-Footnote-101403806
Ref: その他の言語変更<5>-Footnote-111403872
Node: 新たなモジュール<5>1403938
Ref: whatsnew/3 9 new-modules1404104
Ref: cb31404104
Node: zoneinfo1404207
Ref: whatsnew/3 9 zoneinfo1404299
Ref: cb41404299
Ref: zoneinfo-Footnote-11405519
Ref: zoneinfo-Footnote-21405560
Node: graphlib<2>1405602
Ref: whatsnew/3 9 graphlib1405694
Ref: cb61405694
Ref: graphlib<2>-Footnote-11406018
Node: 改良されたモジュール<5>1406083
Ref: whatsnew/3 9 improved-modules1406234
Ref: cb81406234
Node: ast<6>1407099
Ref: whatsnew/3 9 ast1407195
Ref: cb91407195
Ref: ast<6>-Footnote-11407857
Ref: ast<6>-Footnote-21407922
Ref: ast<6>-Footnote-31407987
Node: asyncio<10>1408052
Ref: whatsnew/3 9 asyncio1408170
Ref: cbb1408170
Ref: asyncio<10>-Footnote-11409931
Ref: asyncio<10>-Footnote-21409996
Ref: asyncio<10>-Footnote-31410061
Ref: asyncio<10>-Footnote-41410126
Ref: asyncio<10>-Footnote-51410191
Ref: asyncio<10>-Footnote-61410256
Node: compileall<2>1410321
Ref: whatsnew/3 9 compileall1410454
Ref: cc01410454
Ref: compileall<2>-Footnote-11411034
Ref: compileall<2>-Footnote-21411099
Node: concurrent futures<4>1411164
Ref: whatsnew/3 9 concurrent-futures1411295
Ref: cc11411295
Ref: concurrent futures<4>-Footnote-11412174
Ref: concurrent futures<4>-Footnote-21412239
Ref: concurrent futures<4>-Footnote-31412304
Node: curses<3>1412369
Ref: whatsnew/3 9 curses1412498
Ref: cc31412498
Ref: curses<3>-Footnote-11412812
Node: datetime<4>1412877
Ref: whatsnew/3 9 datetime1412997
Ref: cc81412997
Ref: datetime<4>-Footnote-11413315
Node: distutils<3>1413380
Ref: whatsnew/3 9 distutils1413499
Ref: ccb1413499
Ref: distutils<3>-Footnote-11413750
Node: fcntl<2>1413815
Ref: whatsnew/3 9 fcntl1413932
Ref: ccc1413932
Ref: fcntl<2>-Footnote-11414139
Node: ftplib<2>1414204
Ref: whatsnew/3 9 ftplib1414314
Ref: ccd1414314
Ref: ftplib<2>-Footnote-11414604
Node: gc<5>1414669
Ref: whatsnew/3 9 gc1414781
Ref: cd01414781
Ref: gc<5>-Footnote-11415319
Ref: gc<5>-Footnote-21415384
Node: hashlib<5>1415449
Ref: whatsnew/3 9 hashlib1415559
Ref: cd21415559
Ref: hashlib<5>-Footnote-11416068
Ref: hashlib<5>-Footnote-21416133
Node: http<2>1416198
Ref: whatsnew/3 9 http1416323
Ref: cd31416323
Ref: http<2>-Footnote-11416595
Ref: http<2>-Footnote-21416660
Node: IDLE と idelelib<3>1416725
Ref: whatsnew/3 9 idle-and-idlelib1416850
Ref: cd51416850
Ref: IDLE と idelelib<3>-Footnote-11418059
Ref: IDLE と idelelib<3>-Footnote-21418123
Ref: IDLE と idelelib<3>-Footnote-31418188
Ref: IDLE と idelelib<3>-Footnote-41418253
Ref: IDLE と idelelib<3>-Footnote-51418318
Ref: IDLE と idelelib<3>-Footnote-61418383
Ref: IDLE と idelelib<3>-Footnote-71418448
Node: imaplib<2>1418513
Ref: whatsnew/3 9 imaplib1418643
Ref: cd61418643
Ref: imaplib<2>-Footnote-11419464
Ref: imaplib<2>-Footnote-21419529
Node: importlib<3>1419594
Ref: whatsnew/3 9 importlib1419714
Ref: cdc1419714
Ref: importlib<3>-Footnote-11420506
Ref: importlib<3>-Footnote-21420571
Ref: importlib<3>-Footnote-31420636
Node: inspect<6>1420701
Ref: whatsnew/3 9 inspect1420823
Ref: cde1420823
Ref: inspect<6>-Footnote-11421069
Ref: inspect<6>-Footnote-21421134
Node: ipaddress<2>1421199
Ref: whatsnew/3 9 ipaddress1421316
Ref: ce01421316
Ref: ipaddress<2>-Footnote-11421881
Ref: ipaddress<2>-Footnote-21421946
Node: math<6>1422011
Ref: whatsnew/3 9 math1422136
Ref: ce21422136
Ref: math<6>-Footnote-11422852
Ref: math<6>-Footnote-21422917
Ref: math<6>-Footnote-31422982
Ref: math<6>-Footnote-41423047
Ref: math<6>-Footnote-51423112
Node: multiprocessing<3>1423177
Ref: whatsnew/3 9 multiprocessing1423297
Ref: ce61423297
Ref: multiprocessing<3>-Footnote-11423553
Node: nntplib1423618
Ref: whatsnew/3 9 nntplib1423736
Ref: ce91423736
Ref: nntplib-Footnote-11424020
Node: os<8>1424085
Ref: whatsnew/3 9 os1424196
Ref: cea1424196
Ref: os<8>-Footnote-11425009
Ref: os<8>-Footnote-21425074
Ref: os<8>-Footnote-31425139
Ref: os<8>-Footnote-41425204
Ref: os<8>-Footnote-51425269
Ref: os<8>-Footnote-61425334
Node: pathlib<10>1425399
Ref: whatsnew/3 9 pathlib1425509
Ref: cef1425509
Ref: pathlib<10>-Footnote-11425723
Node: pdb<6>1425788
Ref: whatsnew/3 9 pdb1425899
Ref: cf21425899
Ref: pdb<6>-Footnote-11426087
Node: poplib1426152
Ref: whatsnew/3 9 poplib1426261
Ref: cf31426261
Ref: poplib-Footnote-11426555
Node: pprint<3>1426620
Ref: whatsnew/3 9 pprint1426731
Ref: cf61426731
Ref: pprint<3>-Footnote-11426927
Node: pydoc<2>1426992
Ref: whatsnew/3 9 pydoc1427106
Ref: cf71427106
Ref: pydoc<2>-Footnote-11427373
Node: random<3>1427438
Ref: whatsnew/3 9 random1427549
Ref: cf91427549
Ref: random<3>-Footnote-11427750
Node: signal1427815
Ref: whatsnew/3 9 signal1427925
Ref: cfb1427925
Ref: signal-Footnote-11428155
Node: smtplib1428220
Ref: whatsnew/3 9 smtplib1428330
Ref: cfd1428330
Ref: smtplib-Footnote-11428742
Ref: smtplib-Footnote-21428807
Node: socket<5>1428872
Ref: whatsnew/3 9 socket1428983
Ref: d011428983
Ref: socket<5>-Footnote-11429569
Ref: socket<5>-Footnote-21429634
Ref: socket<5>-Footnote-31429699
Node: time<3>1429764
Ref: whatsnew/3 9 time1429874
Ref: d061429874
Ref: time<3>-Footnote-11430204
Node: sys<8>1430269
Ref: whatsnew/3 9 sys1430381
Ref: d081430381
Ref: sys<8>-Footnote-11431046
Ref: sys<8>-Footnote-21431113
Node: tracemalloc1431178
Ref: whatsnew/3 9 tracemalloc1431292
Ref: d0a1431292
Ref: tracemalloc-Footnote-11431576
Node: typing<9>1431641
Ref: whatsnew/3 9 typing1431763
Ref: d0c1431763
Ref: typing<9>-Footnote-11432119
Node: unicodedata<6>1432161
Ref: whatsnew/3 9 unicodedata1432279
Ref: d0e1432279
Ref: unicodedata<6>-Footnote-11432457
Node: venv<4>1432522
Ref: whatsnew/3 9 venv1432637
Ref: d0f1432637
Ref: venv<4>-Footnote-11433099
Node: xml<4>1433164
Ref: whatsnew/3 9 xml1433256
Ref: d101433256
Ref: xml<4>-Footnote-11433614
Node: 最適化<6>1433679
Ref: whatsnew/3 9 optimizations1433815
Ref: d111433815
Ref: 最適化<6>-Footnote-11439565
Ref: 最適化<6>-Footnote-21439630
Ref: 最適化<6>-Footnote-31439695
Ref: 最適化<6>-Footnote-41439760
Ref: 最適化<6>-Footnote-51439825
Ref: 最適化<6>-Footnote-61439867
Ref: 最適化<6>-Footnote-71439932
Ref: 最適化<6>-Footnote-81439996
Ref: 最適化<6>-Footnote-91440061
Ref: 最適化<6>-Footnote-101440126
Ref: 最適化<6>-Footnote-111440192
Ref: 最適化<6>-Footnote-121440321
Node: 非推奨<8>1440370
Ref: whatsnew/3 9 deprecated1440482
Ref: d161440482
Ref: 非推奨<8>-Footnote-11445579
Ref: 非推奨<8>-Footnote-21445644
Ref: 非推奨<8>-Footnote-31445709
Ref: 非推奨<8>-Footnote-41445774
Ref: 非推奨<8>-Footnote-51445839
Ref: 非推奨<8>-Footnote-61445904
Ref: 非推奨<8>-Footnote-71445969
Ref: 非推奨<8>-Footnote-81446034
Ref: 非推奨<8>-Footnote-91446099
Ref: 非推奨<8>-Footnote-101446164
Ref: 非推奨<8>-Footnote-111446230
Ref: 非推奨<8>-Footnote-121446296
Ref: 非推奨<8>-Footnote-131446362
Ref: 非推奨<8>-Footnote-141446428
Ref: 非推奨<8>-Footnote-151446494
Ref: 非推奨<8>-Footnote-161446537
Ref: 非推奨<8>-Footnote-171446577
Ref: 非推奨<8>-Footnote-181446616
Ref: 非推奨<8>-Footnote-191446682
Node: 削除<8>1446748
Ref: whatsnew/3 9 removed1446870
Ref: d181446870
Ref: whatsnew/3 9 removed-in-python-391446870
Ref: ca11446870
Ref: 削除<8>-Footnote-11453010
Ref: 削除<8>-Footnote-21453075
Ref: 削除<8>-Footnote-31453140
Ref: 削除<8>-Footnote-41453205
Ref: 削除<8>-Footnote-51453270
Ref: 削除<8>-Footnote-61453335
Ref: 削除<8>-Footnote-71453400
Ref: 削除<8>-Footnote-81453465
Ref: 削除<8>-Footnote-91453530
Ref: 削除<8>-Footnote-101453595
Ref: 削除<8>-Footnote-111453661
Ref: 削除<8>-Footnote-121453704
Ref: 削除<8>-Footnote-131453770
Ref: 削除<8>-Footnote-141453836
Ref: 削除<8>-Footnote-151453902
Ref: 削除<8>-Footnote-161453968
Ref: 削除<8>-Footnote-171454034
Ref: 削除<8>-Footnote-181454100
Ref: 削除<8>-Footnote-191454166
Ref: 削除<8>-Footnote-201454232
Ref: 削除<8>-Footnote-211454298
Ref: 削除<8>-Footnote-221454364
Node: Python 3 9への移植1454430
Ref: whatsnew/3 9 porting-to-python-3-91454556
Ref: d261454556
Node: Python API の変更<5>1454938
Ref: whatsnew/3 9 changes-in-the-python-api1455047
Ref: d271455047
Ref: Python API の変更<5>-Footnote-11459216
Ref: Python API の変更<5>-Footnote-21459281
Ref: Python API の変更<5>-Footnote-31459346
Ref: Python API の変更<5>-Footnote-41459411
Ref: Python API の変更<5>-Footnote-51459470
Ref: Python API の変更<5>-Footnote-61459535
Ref: Python API の変更<5>-Footnote-71459600
Ref: Python API の変更<5>-Footnote-81459665
Ref: Python API の変更<5>-Footnote-91459730
Ref: Python API の変更<5>-Footnote-101459795
Ref: Python API の変更<5>-Footnote-111459861
Node: C API の変更<8>1459927
Ref: whatsnew/3 9 changes-in-the-c-api1460083
Ref: d321460083
Ref: C API の変更<8>-Footnote-11462197
Ref: C API の変更<8>-Footnote-21462262
Ref: C API の変更<8>-Footnote-31462327
Node: CPython バイトコードの変更<5>1462392
Ref: whatsnew/3 9 cpython-bytecode-changes1462516
Ref: d341462516
Ref: CPython バイトコードの変更<5>-Footnote-11463321
Ref: CPython バイトコードの変更<5>-Footnote-21463386
Node: Build Changes<5>1463451
Ref: whatsnew/3 9 build-changes1463586
Ref: d371463586
Ref: Build Changes<5>-Footnote-11465994
Ref: Build Changes<5>-Footnote-21466061
Ref: Build Changes<5>-Footnote-31466126
Ref: Build Changes<5>-Footnote-41466191
Ref: Build Changes<5>-Footnote-51466256
Ref: Build Changes<5>-Footnote-61466321
Ref: Build Changes<5>-Footnote-71466386
Ref: Build Changes<5>-Footnote-81466451
Node: C API の変更<9>1466516
Ref: whatsnew/3 9 c-api-changes1466666
Ref: d391466666
Node: 新しい機能<11>1466834
Ref: whatsnew/3 9 id11466942
Ref: d3a1466942
Ref: 新しい機能<11>-Footnote-11469960
Ref: 新しい機能<11>-Footnote-21470002
Ref: 新しい機能<11>-Footnote-31470067
Ref: 新しい機能<11>-Footnote-41470132
Ref: 新しい機能<11>-Footnote-51470197
Ref: 新しい機能<11>-Footnote-61470262
Ref: 新しい機能<11>-Footnote-71470327
Ref: 新しい機能<11>-Footnote-81470392
Ref: 新しい機能<11>-Footnote-91470457
Ref: 新しい機能<11>-Footnote-101470522
Ref: 新しい機能<11>-Footnote-111470588
Ref: 新しい機能<11>-Footnote-121470654
Node: Python 3 9への移植<2>1470720
Ref: whatsnew/3 9 id21470846
Ref: d451470846
Ref: Python 3 9への移植<2>-Footnote-11474667
Ref: Python 3 9への移植<2>-Footnote-21474709
Ref: Python 3 9への移植<2>-Footnote-31474774
Ref: Python 3 9への移植<2>-Footnote-41474839
Ref: Python 3 9への移植<2>-Footnote-51474903
Ref: Python 3 9への移植<2>-Footnote-61474968
Ref: Python 3 9への移植<2>-Footnote-71475033
Ref: Python 3 9への移植<2>-Footnote-81475075
Ref: Python 3 9への移植<2>-Footnote-91475140
Ref: Python 3 9への移植<2>-Footnote-101475205
Ref: Python 3 9への移植<2>-Footnote-111475271
Node: 削除<9>1475337
Ref: whatsnew/3 9 id31475435
Ref: d581475435
Ref: 削除<9>-Footnote-11479372
Ref: 削除<9>-Footnote-21479437
Ref: 削除<9>-Footnote-31479502
Ref: 削除<9>-Footnote-41479567
Ref: 削除<9>-Footnote-51479632
Ref: 削除<9>-Footnote-61479697
Ref: 削除<9>-Footnote-71479762
Ref: 削除<9>-Footnote-81479827
Ref: 削除<9>-Footnote-91479892
Ref: 削除<9>-Footnote-101479957
Ref: 削除<9>-Footnote-111480023
Ref: 削除<9>-Footnote-121480066
Ref: 削除<9>-Footnote-131480132
Node: Python 3 9 1 での重要な変更点1480198
Ref: whatsnew/3 9 notable-changes-in-python-3-9-11480369
Ref: d5b1480369
Node: typing<10>1480618
Ref: whatsnew/3 9 id41480774
Ref: d5c1480774
Ref: typing<10>-Footnote-11481971
Ref: typing<10>-Footnote-21482013
Node: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート1482078
Ref: whatsnew/3 9 macos-11-0-big-sur-and-apple-silicon-mac-support1482234
Ref: d5d1482234
Ref: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート-Footnote-11483060
Node: Python 3 9 2 での重要な変更点1483125
Ref: whatsnew/3 9 notable-changes-in-python-3-9-21483315
Ref: d5e1483315
Node: collections abc<3>1483480
Ref: whatsnew/3 9 collections-abc1483596
Ref: d5f1483596
Ref: collections abc<3>-Footnote-11484557
Node: urllib parse<3>1484622
Ref: whatsnew/3 9 urllib-parse1484738
Ref: d601484738
Ref: urllib parse<3>-Footnote-11485422
Node: Python 3 9 3 での重要な変更点1485487
Ref: whatsnew/3 9 notable-changes-in-python-3-9-31485676
Ref: d611485676
Ref: Python 3 9 3 での重要な変更点-Footnote-11486151
Node: Python 3 9 5での重要な変更点1486206
Ref: whatsnew/3 9 notable-changes-in-python-3-9-51486392
Ref: d621486392
Node: urllib parse<4>1486516
Ref: whatsnew/3 9 id51486604
Ref: d631486604
Ref: urllib parse<4>-Footnote-11487133
Ref: urllib parse<4>-Footnote-21487192
Node: Notable security feature in 3 9 141487247
Ref: whatsnew/3 9 notable-security-feature-in-3-9-141487421
Ref: d641487421
Ref: Notable security feature in 3 9 14-Footnote-11488151
Node: Notable changes in 3 9 171488207
Ref: whatsnew/3 9 notable-changes-in-3-9-171488336
Ref: d651488336
Node: tarfile<6>1488436
Ref: whatsnew/3 9 tarfile1488508
Ref: d661488508
Ref: tarfile<6>-Footnote-11489112
Node: What's New In Python 3 81489154
Ref: whatsnew/3 8 doc1489301
Ref: d671489301
Ref: whatsnew/3 8 translation-repo1489301
Ref: d681489301
Ref: whatsnew/3 8 what-s-new-in-python-3-81489301
Ref: d691489301
Node: 概要 -- リリースハイライト<7>1490758
Ref: whatsnew/3 8 summary-release-highlights1490887
Ref: d6a1490887
Node: 新しい機能<12>1490963
Ref: whatsnew/3 8 new-features1491128
Ref: d6b1491128
Node: 代入式1491830
Ref: whatsnew/3 8 assignment-expressions1491922
Ref: d6c1491922
Ref: 代入式-Footnote-11493642
Ref: 代入式-Footnote-21493739
Ref: 代入式-Footnote-31493781
Node: 位置専用引数1493846
Ref: whatsnew/3 8 positional-only-parameters1494061
Ref: d6d1494061
Ref: 位置専用引数-Footnote-11496988
Ref: 位置専用引数-Footnote-21497050
Ref: 位置専用引数-Footnote-31497092
Node: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム1497157
Ref: whatsnew/3 8 parallel-filesystem-cache-for-compiled-bytecode-files1497424
Ref: d6f1497424
Ref: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム-Footnote-11498356
Node: デバッグビルドとリリースビルドのABI 共通化1498421
Ref: whatsnew/3 8 debug-build-uses-the-same-abi-as-release-build1498727
Ref: d721498727
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-11501743
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-21501808
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-31501873
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-41501938
Node: f-string での = を用いたオブジェクトの表現1502003
Ref: whatsnew/3 8 bpo-36817-whatsnew1502242
Ref: d741502242
Ref: whatsnew/3 8 f-strings-support-for-self-documenting-expressions-and-debugging1502242
Ref: d751502242
Ref: f-string での = を用いたオブジェクトの表現-Footnote-11503455
Node: PEP 578 Pythonランタイムの監査フック1503520
Ref: whatsnew/3 8 pep-578-python-runtime-audit-hooks1503728
Ref: d761503728
Ref: PEP 578 Pythonランタイムの監査フック-Footnote-11504381
Node: PEP 587 Python 初期化設定1504423
Ref: whatsnew/3 8 pep-587-python-initialization-configuration1504628
Ref: d771504628
Ref: PEP 587 Python 初期化設定-Footnote-11506617
Ref: PEP 587 Python 初期化設定-Footnote-21506659
Ref: PEP 587 Python 初期化設定-Footnote-31506701
Node: PEP 590 Vectorcall a fast calling protocol for CPython1506766
Ref: whatsnew/3 8 pep-590-vectorcall-a-fast-calling-protocol-for-cpython1507003
Ref: d921507003
Ref: PEP 590 Vectorcall a fast calling protocol for CPython-Footnote-11507650
Ref: PEP 590 Vectorcall a fast calling protocol for CPython-Footnote-21507692
Node: Pickle プロトコルバージョン 5 による帯域外データバッファ1507757
Ref: whatsnew/3 8 pickle-protocol-5-with-out-of-band-data-buffers1507955
Ref: d931507955
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-11508811
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-21508853
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-31508895
Node: その他の言語変更<6>1508960
Ref: whatsnew/3 8 other-language-changes1509112
Ref: d941509112
Ref: その他の言語変更<6>-Footnote-11517243
Ref: その他の言語変更<6>-Footnote-21517308
Ref: その他の言語変更<6>-Footnote-31517373
Ref: その他の言語変更<6>-Footnote-41517438
Ref: その他の言語変更<6>-Footnote-51517503
Ref: その他の言語変更<6>-Footnote-61517568
Ref: その他の言語変更<6>-Footnote-71517633
Ref: その他の言語変更<6>-Footnote-81517698
Ref: その他の言語変更<6>-Footnote-91517763
Ref: その他の言語変更<6>-Footnote-101517828
Ref: その他の言語変更<6>-Footnote-111517894
Ref: その他の言語変更<6>-Footnote-121517962
Ref: その他の言語変更<6>-Footnote-131518028
Ref: その他の言語変更<6>-Footnote-141518098
Ref: その他の言語変更<6>-Footnote-151518158
Ref: その他の言語変更<6>-Footnote-161518224
Ref: その他の言語変更<6>-Footnote-171518290
Node: 新たなモジュール<6>1518356
Ref: whatsnew/3 8 new-modules1518522
Ref: d9d1518522
Ref: 新たなモジュール<6>-Footnote-11519728
Node: 改良されたモジュール<6>1519793
Ref: whatsnew/3 8 improved-modules1519944
Ref: d9e1519944
Node: ast<7>1521007
Ref: whatsnew/3 8 ast1521103
Ref: d9f1521103
Ref: ast<7>-Footnote-11522335
Ref: ast<7>-Footnote-21522400
Ref: ast<7>-Footnote-31522442
Ref: ast<7>-Footnote-41522484
Ref: ast<7>-Footnote-51522526
Node: asyncio<11>1522591
Ref: whatsnew/3 8 asyncio1522707
Ref: da11522707
Ref: asyncio<11>-Footnote-11526361
Ref: asyncio<11>-Footnote-21526426
Ref: asyncio<11>-Footnote-31526491
Ref: asyncio<11>-Footnote-41526556
Ref: asyncio<11>-Footnote-51526621
Ref: asyncio<11>-Footnote-61526686
Ref: asyncio<11>-Footnote-71526751
Ref: asyncio<11>-Footnote-81526816
Ref: asyncio<11>-Footnote-91526881
Ref: asyncio<11>-Footnote-101526934
Node: builtins<2>1527000
Ref: whatsnew/3 8 builtins1527124
Ref: da71527124
Ref: builtins<2>-Footnote-11527712
Node: collections<2>1527777
Ref: whatsnew/3 8 collections1527898
Ref: da81527898
Ref: collections<2>-Footnote-11528490
Node: cProfile1528555
Ref: whatsnew/3 8 cprofile1528671
Ref: daa1528671
Ref: cProfile-Footnote-11529111
Node: csv<3>1529176
Ref: whatsnew/3 8 csv1529287
Ref: dac1529287
Ref: csv<3>-Footnote-11529688
Node: curses<4>1529753
Ref: whatsnew/3 8 curses1529865
Ref: dae1529865
Ref: curses<4>-Footnote-11530128
Node: ctypes<4>1530193
Ref: whatsnew/3 8 ctypes1530310
Ref: db01530310
Ref: ctypes<4>-Footnote-11530957
Node: datetime<5>1531022
Ref: whatsnew/3 8 datetime1531142
Ref: db31531142
Ref: datetime<5>-Footnote-11531575
Node: functools<5>1531640
Ref: whatsnew/3 8 functools1531756
Ref: db61531756
Ref: functools<5>-Footnote-11533445
Ref: functools<5>-Footnote-21533510
Ref: functools<5>-Footnote-31533575
Node: gc<6>1533640
Ref: whatsnew/3 8 gc1533752
Ref: dba1533752
Ref: gc<6>-Footnote-11534038
Node: gettext1534103
Ref: whatsnew/3 8 gettext1534210
Ref: dbb1534210
Ref: gettext-Footnote-11534452
Node: gzip<3>1534516
Ref: whatsnew/3 8 gzip1534638
Ref: dbd1534638
Ref: gzip<3>-Footnote-11535169
Ref: gzip<3>-Footnote-21535234
Node: IDLE と idelelib<4>1535298
Ref: whatsnew/3 8 idle-and-idlelib1535423
Ref: dbf1535423
Ref: IDLE と idelelib<4>-Footnote-11537423
Ref: IDLE と idelelib<4>-Footnote-21537490
Ref: IDLE と idelelib<4>-Footnote-31537554
Ref: IDLE と idelelib<4>-Footnote-41537619
Ref: IDLE と idelelib<4>-Footnote-51537684
Ref: IDLE と idelelib<4>-Footnote-61537749
Ref: IDLE と idelelib<4>-Footnote-71537813
Ref: IDLE と idelelib<4>-Footnote-81537878
Node: inspect<7>1537943
Ref: whatsnew/3 8 inspect1538066
Ref: dc01538066
Ref: inspect<7>-Footnote-11538907
Node: io<5>1538972
Ref: whatsnew/3 8 io1539087
Ref: dc11539087
Ref: io<5>-Footnote-11539435
Node: itertools<5>1539500
Ref: whatsnew/3 8 itertools1539614
Ref: dc21539614
Ref: itertools<5>-Footnote-11540019
Node: json tool1540084
Ref: whatsnew/3 8 json-tool1540203
Ref: dc41540203
Ref: json tool-Footnote-11540455
Node: logging<3>1540520
Ref: whatsnew/3 8 logging1540634
Ref: dc51540634
Ref: logging<3>-Footnote-11541349
Node: math<7>1541414
Ref: whatsnew/3 8 math1541526
Ref: dc71541526
Ref: math<7>-Footnote-11543467
Ref: math<7>-Footnote-21543532
Ref: math<7>-Footnote-31543597
Ref: math<7>-Footnote-41543662
Ref: math<7>-Footnote-51543727
Ref: math<7>-Footnote-61543792
Ref: math<7>-Footnote-71543857
Ref: math<7>-Footnote-81543922
Node: mmap<3>1543987
Ref: whatsnew/3 8 mmap1544107
Ref: dcd1544107
Ref: mmap<3>-Footnote-11544337
Node: multiprocessing<4>1544402
Ref: whatsnew/3 8 multiprocessing1544520
Ref: dcf1544520
Ref: multiprocessing<4>-Footnote-11544824
Ref: multiprocessing<4>-Footnote-21544889
Node: os<9>1544954
Ref: whatsnew/3 8 os1545075
Ref: dd01545075
Ref: os<9>-Footnote-11546586
Ref: os<9>-Footnote-21546651
Ref: os<9>-Footnote-31546716
Node: os path<6>1546781
Ref: whatsnew/3 8 os-path1546895
Ref: dd51546895
Ref: os path<6>-Footnote-11547918
Ref: os path<6>-Footnote-21547983
Ref: os path<6>-Footnote-31548048
Node: pathlib<11>1548113
Ref: whatsnew/3 8 pathlib1548231
Ref: ddd1548231
Ref: pathlib<11>-Footnote-11549140
Ref: pathlib<11>-Footnote-21549205
Node: pickle<3>1549270
Ref: whatsnew/3 8 pickle1549386
Ref: de51549386
Ref: pickle<3>-Footnote-11549724
Node: plistlib1549789
Ref: whatsnew/3 8 plistlib1549903
Ref: de81549903
Ref: plistlib-Footnote-11550141
Node: pprint<4>1550206
Ref: whatsnew/3 8 pprint1550324
Ref: dea1550324
Ref: pprint<4>-Footnote-11551389
Node: py_compile<2>1551454
Ref: whatsnew/3 8 py-compile1551569
Ref: dec1551569
Ref: py_compile<2>-Footnote-11551758
Node: shlex1551823
Ref: whatsnew/3 8 shlex1551938
Ref: dee1551938
Ref: shlex-Footnote-11552142
Node: shutil<5>1552207
Ref: whatsnew/3 8 shutil1552318
Ref: df01552318
Ref: shutil<5>-Footnote-11552971
Ref: shutil<5>-Footnote-21553036
Ref: shutil<5>-Footnote-31553101
Node: socket<6>1553166
Ref: whatsnew/3 8 socket1553278
Ref: df21553278
Ref: socket<6>-Footnote-11553853
Ref: socket<6>-Footnote-21553918
Node: ssl<6>1553983
Ref: whatsnew/3 8 ssl1554099
Ref: df81554099
Ref: ssl<6>-Footnote-11554361
Node: statistics<4>1554426
Ref: whatsnew/3 8 statistics1554539
Ref: dfb1554539
Ref: statistics<4>-Footnote-11556268
Ref: statistics<4>-Footnote-21556333
Ref: statistics<4>-Footnote-31556398
Ref: statistics<4>-Footnote-41556463
Ref: statistics<4>-Footnote-51556528
Node: sys<9>1556593
Ref: whatsnew/3 8 sys1556710
Ref: e011556710
Ref: sys<9>-Footnote-11557149
Node: tarfile<7>1557214
Ref: whatsnew/3 8 tarfile1557330
Ref: e021557330
Ref: tarfile<7>-Footnote-11557748
Node: threading<7>1557813
Ref: whatsnew/3 8 threading1557934
Ref: e031557934
Ref: threading<7>-Footnote-11558659
Ref: threading<7>-Footnote-21558726
Node: tokenize<3>1558791
Ref: whatsnew/3 8 tokenize1558912
Ref: e071558912
Ref: tokenize<3>-Footnote-11559238
Node: tkinter<6>1559303
Ref: whatsnew/3 8 tkinter1559419
Ref: e081559419
Ref: tkinter<6>-Footnote-11559962
Ref: tkinter<6>-Footnote-21560027
Ref: tkinter<6>-Footnote-31560092
Node: time<4>1560157
Ref: whatsnew/3 8 time1560272
Ref: e091560272
Ref: time<4>-Footnote-11560451
Node: typing<11>1560516
Ref: whatsnew/3 8 typing1560635
Ref: e0b1560635
Ref: typing<11>-Footnote-11562101
Ref: typing<11>-Footnote-21562143
Ref: typing<11>-Footnote-31562185
Ref: typing<11>-Footnote-41562227
Node: unicodedata<7>1562269
Ref: whatsnew/3 8 unicodedata1562392
Ref: e0e1562392
Ref: unicodedata<7>-Footnote-11562821
Ref: unicodedata<7>-Footnote-21562883
Ref: unicodedata<7>-Footnote-31562948
Node: unittest<8>1563013
Ref: whatsnew/3 8 unittest1563133
Ref: e101563133
Ref: unittest<8>-Footnote-11564455
Ref: unittest<8>-Footnote-21564520
Ref: unittest<8>-Footnote-31564585
Ref: unittest<8>-Footnote-41564650
Node: venv<5>1564715
Ref: whatsnew/3 8 venv1564828
Ref: e171564828
Ref: venv<5>-Footnote-11565080
Node: weakref1565145
Ref: whatsnew/3 8 weakref1565253
Ref: e181565253
Ref: weakref-Footnote-11565546
Node: xml<5>1565611
Ref: whatsnew/3 8 xml1565718
Ref: e1a1565718
Ref: xml<5>-Footnote-11566874
Ref: xml<5>-Footnote-21566939
Ref: xml<5>-Footnote-31567004
Ref: xml<5>-Footnote-41567069
Ref: xml<5>-Footnote-51567134
Node: xmlrpc1567199
Ref: whatsnew/3 8 xmlrpc1567290
Ref: e1e1567290
Ref: xmlrpc-Footnote-11567682
Node: 最適化<7>1567747
Ref: whatsnew/3 8 optimizations1567908
Ref: e201567908
Ref: 最適化<7>-Footnote-11572250
Ref: 最適化<7>-Footnote-21572315
Ref: 最適化<7>-Footnote-31572380
Ref: 最適化<7>-Footnote-41572445
Ref: 最適化<7>-Footnote-51572510
Ref: 最適化<7>-Footnote-61572575
Ref: 最適化<7>-Footnote-71572640
Ref: 最適化<7>-Footnote-81572705
Ref: 最適化<7>-Footnote-91572770
Ref: 最適化<7>-Footnote-101572835
Ref: 最適化<7>-Footnote-111572901
Ref: 最適化<7>-Footnote-121572967
Ref: 最適化<7>-Footnote-131573033
Node: ビルドならびに C API の変更1573099
Ref: whatsnew/3 8 build-and-c-api-changes1573239
Ref: e2b1573239
Ref: ビルドならびに C API の変更-Footnote-11578820
Ref: ビルドならびに C API の変更-Footnote-21578885
Ref: ビルドならびに C API の変更-Footnote-31578950
Ref: ビルドならびに C API の変更-Footnote-41579015
Ref: ビルドならびに C API の変更-Footnote-51579080
Ref: ビルドならびに C API の変更-Footnote-61579145
Ref: ビルドならびに C API の変更-Footnote-71579210
Ref: ビルドならびに C API の変更-Footnote-81579275
Ref: ビルドならびに C API の変更-Footnote-91579340
Ref: ビルドならびに C API の変更-Footnote-101579405
Ref: ビルドならびに C API の変更-Footnote-111579471
Ref: ビルドならびに C API の変更-Footnote-121579537
Node: 非推奨<9>1579603
Ref: whatsnew/3 8 deprecated1579753
Ref: e351579753
Ref: 非推奨<9>-Footnote-11585610
Ref: 非推奨<9>-Footnote-21585675
Ref: 非推奨<9>-Footnote-31585740
Ref: 非推奨<9>-Footnote-41585805
Ref: 非推奨<9>-Footnote-51585869
Ref: 非推奨<9>-Footnote-61585934
Ref: 非推奨<9>-Footnote-71585999
Ref: 非推奨<9>-Footnote-81586064
Ref: 非推奨<9>-Footnote-91586129
Ref: 非推奨<9>-Footnote-101586194
Ref: 非推奨<9>-Footnote-111586260
Ref: 非推奨<9>-Footnote-121586326
Ref: 非推奨<9>-Footnote-131586392
Node: API と機能の削除1586458
Ref: whatsnew/3 8 api-and-feature-removals1586594
Ref: e4c1586594
Ref: API と機能の削除-Footnote-11589402
Ref: API と機能の削除-Footnote-21589457
Ref: API と機能の削除-Footnote-31589522
Ref: API と機能の削除-Footnote-41589587
Ref: API と機能の削除-Footnote-51589652
Ref: API と機能の削除-Footnote-61589717
Ref: API と機能の削除-Footnote-71589782
Ref: API と機能の削除-Footnote-81589847
Ref: API と機能の削除-Footnote-91589912
Ref: API と機能の削除-Footnote-101589977
Ref: API と機能の削除-Footnote-111590043
Node: Python 3 8 への移植1590109
Ref: whatsnew/3 8 porting-to-python-3-81590269
Ref: e4f1590269
Node: Python の挙動の変更1590723
Ref: whatsnew/3 8 changes-in-python-behavior1590840
Ref: e501590840
Ref: Python の挙動の変更-Footnote-11593197
Ref: Python の挙動の変更-Footnote-21593262
Ref: Python の挙動の変更-Footnote-31593327
Ref: Python の挙動の変更-Footnote-41593392
Ref: Python の挙動の変更-Footnote-51593457
Ref: Python の挙動の変更-Footnote-61593522
Node: Python API の変更<6>1593587
Ref: whatsnew/3 8 changes-in-the-python-api1593732
Ref: e541593732
Ref: whatsnew/3 8 bpo-36085-whatsnew1600748
Ref: e681600748
Ref: Python API の変更<6>-Footnote-11602396
Ref: Python API の変更<6>-Footnote-21602438
Ref: Python API の変更<6>-Footnote-31602503
Ref: Python API の変更<6>-Footnote-41602568
Ref: Python API の変更<6>-Footnote-51602633
Ref: Python API の変更<6>-Footnote-61602698
Ref: Python API の変更<6>-Footnote-71602763
Ref: Python API の変更<6>-Footnote-81602828
Ref: Python API の変更<6>-Footnote-91602893
Ref: Python API の変更<6>-Footnote-101602958
Ref: Python API の変更<6>-Footnote-111603024
Ref: Python API の変更<6>-Footnote-121603090
Ref: Python API の変更<6>-Footnote-131603156
Ref: Python API の変更<6>-Footnote-141603222
Ref: Python API の変更<6>-Footnote-151603288
Ref: Python API の変更<6>-Footnote-161603354
Ref: Python API の変更<6>-Footnote-171603420
Ref: Python API の変更<6>-Footnote-181603485
Ref: Python API の変更<6>-Footnote-191603551
Ref: Python API の変更<6>-Footnote-201603617
Ref: Python API の変更<6>-Footnote-211603683
Ref: Python API の変更<6>-Footnote-221603749
Ref: Python API の変更<6>-Footnote-231603815
Ref: Python API の変更<6>-Footnote-241603881
Ref: Python API の変更<6>-Footnote-251603947
Ref: Python API の変更<6>-Footnote-261604013
Ref: Python API の変更<6>-Footnote-271604079
Node: C API の変更<10>1604122
Ref: whatsnew/3 8 changes-in-the-c-api1604280
Ref: e6a1604280
Ref: C API の変更<10>-Footnote-11610076
Ref: C API の変更<10>-Footnote-21610141
Ref: C API の変更<10>-Footnote-31610206
Ref: C API の変更<10>-Footnote-41610271
Ref: C API の変更<10>-Footnote-51610336
Ref: C API の変更<10>-Footnote-61610401
Ref: C API の変更<10>-Footnote-71610466
Ref: C API の変更<10>-Footnote-81610531
Node: CPython バイトコードの変更<6>1610596
Ref: whatsnew/3 8 cpython-bytecode-changes1610749
Ref: e721610749
Ref: CPython バイトコードの変更<6>-Footnote-11612087
Ref: CPython バイトコードの変更<6>-Footnote-21612152
Ref: CPython バイトコードの変更<6>-Footnote-31612217
Ref: CPython バイトコードの変更<6>-Footnote-41612259
Node: Demos and Tools<2>1612324
Ref: whatsnew/3 8 demos-and-tools1612449
Ref: e761612449
Ref: Demos and Tools<2>-Footnote-11615744
Ref: Demos and Tools<2>-Footnote-21615809
Ref: Demos and Tools<2>-Footnote-31615937
Node: Python3 8 1 での重要な変更点1615985
Ref: whatsnew/3 8 notable-changes-in-python-3-8-11616159
Ref: e771616159
Ref: Python3 8 1 での重要な変更点-Footnote-11616722
Node: Python3 8 2 での重要な変更点1616787
Ref: whatsnew/3 8 notable-changes-in-python-3-8-21616969
Ref: e781616969
Ref: Python3 8 2 での重要な変更点-Footnote-11617293
Node: Notable changes in Python 3 8 31617348
Ref: whatsnew/3 8 notable-changes-in-python-3-8-31617530
Ref: e791617530
Ref: Notable changes in Python 3 8 3-Footnote-11617917
Node: Python3 8 8 での重要な変更点1617972
Ref: whatsnew/3 8 notable-changes-in-python-3-8-81618149
Ref: e7a1618149
Ref: Python3 8 8 での重要な変更点-Footnote-11618869
Node: Notable changes in Python 3 8 91618934
Ref: whatsnew/3 8 notable-changes-in-python-3-8-91619112
Ref: e7b1619112
Ref: Notable changes in Python 3 8 9-Footnote-11619583
Node: Notable changes in Python 3 8 101619638
Ref: whatsnew/3 8 notable-changes-in-python-3-8-101619815
Ref: e7c1619815
Node: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>1620043
Ref: whatsnew/3 8 macos-11-0-big-sur-and-apple-silicon-mac-support1620178
Ref: e7d1620178
Ref: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>-Footnote-11621168
Node: Notable changes in Python 3 8 10<2>1621223
Ref: whatsnew/3 8 id11621401
Ref: e7e1621401
Node: urllib parse<5>1621525
Ref: whatsnew/3 8 urllib-parse1621612
Ref: e7f1621612
Ref: urllib parse<5>-Footnote-11622142
Ref: urllib parse<5>-Footnote-21622201
Node: Notable changes in Python 3 8 121622266
Ref: whatsnew/3 8 notable-changes-in-python-3-8-121622446
Ref: e801622446
Node: Python API の変更<7>1622586
Ref: whatsnew/3 8 id21622678
Ref: e811622678
Ref: Python API の変更<7>-Footnote-11623276
Node: Notable security feature in 3 8 141623341
Ref: whatsnew/3 8 notable-security-feature-in-3-8-141623511
Ref: e821623511
Ref: Notable security feature in 3 8 14-Footnote-11624241
Node: Notable changes in 3 8 171624297
Ref: whatsnew/3 8 notable-changes-in-3-8-171624426
Ref: e831624426
Node: tarfile<8>1624526
Ref: whatsnew/3 8 id31624598
Ref: e841624598
Ref: tarfile<8>-Footnote-11625202
Node: What's New In Python 3 71625244
Ref: whatsnew/3 7 doc1625391
Ref: e851625391
Ref: whatsnew/3 7 translation-repo1625391
Ref: e861625391
Ref: whatsnew/3 7 what-s-new-in-python-3-71625391
Ref: e871625391
Node: 概要 -- リリースハイライト<8>1627059
Ref: whatsnew/3 7 summary-release-highlights1627188
Ref: e881627188
Ref: 概要 -- リリースハイライト<8>-Footnote-11629808
Ref: 概要 -- リリースハイライト<8>-Footnote-21629888
Ref: 概要 -- リリースハイライト<8>-Footnote-31629924
Ref: 概要 -- リリースハイライト<8>-Footnote-41629960
Node: 新しい機能<13>1629996
Ref: whatsnew/3 7 new-features1630161
Ref: e9c1630161
Node: PEP 563 アノテーションの遅延評価1631519
Ref: whatsnew/3 7 pep-563-postponed-evaluation-of-annotations1631675
Ref: e9d1631675
Ref: whatsnew/3 7 whatsnew37-pep5631631675
Ref: e891631675
Ref: PEP 563 アノテーションの遅延評価-Footnote-11633920
Ref: PEP 563 アノテーションの遅延評価-Footnote-21633962
Ref: PEP 563 アノテーションの遅延評価-Footnote-31634004
Node: PEP 538 レガシーな C ロケールの抑圧1634046
Ref: whatsnew/3 7 pep-538-legacy-c-locale-coercion1634247
Ref: e9e1634247
Ref: whatsnew/3 7 whatsnew37-pep5381634247
Ref: e931634247
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-11637413
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-21637455
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-31637497
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-41637539
Node: PEP 540 強制 UTF-8 実行モード1637581
Ref: whatsnew/3 7 pep-540-forced-utf-8-runtime-mode1637772
Ref: ea11637772
Ref: whatsnew/3 7 whatsnew37-pep5401637772
Ref: e941637772
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-11639344
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-21639386
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-31639428
Node: PEP 553 組み込みの breakpoint1639470
Ref: whatsnew/3 7 pep-553-built-in-breakpoint1639688
Ref: ea21639688
Ref: whatsnew/3 7 whatsnew37-pep5531639688
Ref: e8d1639688
Ref: PEP 553 組み込みの breakpoint-Footnote-11640588
Node: PEP 539 スレッドローカルストレージのための新しい C API1640630
Ref: whatsnew/3 7 pep-539-new-c-api-for-thread-local-storage1640880
Ref: ea51640880
Ref: whatsnew/3 7 whatsnew37-pep5391640880
Ref: e981640880
Ref: PEP 539 スレッドローカルストレージのための新しい C API-Footnote-11642411
Ref: PEP 539 スレッドローカルストレージのための新しい C API-Footnote-21642453
Node: PEP 562 モジュール属性へのアクセスのカスタマイズ1642495
Ref: whatsnew/3 7 pep-562-customization-of-access-to-module-attributes1642776
Ref: ea91642776
Ref: whatsnew/3 7 whatsnew37-pep5621642776
Ref: e8e1642776
Ref: PEP 562 モジュール属性へのアクセスのカスタマイズ-Footnote-11643401
Node: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数1643443
Ref: whatsnew/3 7 pep-564-new-time-functions-with-nanosecond-resolution1643693
Ref: eac1643693
Ref: whatsnew/3 7 whatsnew37-pep5641643693
Ref: e921643693
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-11644800
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-21644842
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-31644919
Node: PEP 565 Show DeprecationWarning in __main__1644961
Ref: whatsnew/3 7 pep-565-show-deprecationwarning-in-main1645242
Ref: eb31645242
Ref: whatsnew/3 7 whatsnew37-pep5651645242
Ref: e971645242
Ref: PEP 565 Show DeprecationWarning in __main__-Footnote-11647168
Node: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート1647210
Ref: whatsnew/3 7 pep-560-core-support-for-typing-module-and-generic-types1647454
Ref: eb41647454
Ref: whatsnew/3 7 whatsnew37-pep5601647454
Ref: e8f1647454
Ref: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート-Footnote-11648500
Ref: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート-Footnote-21648542
Node: PEP 552 Hash-based pyc Files1648584
Ref: whatsnew/3 7 pep-552-hash-based-pyc-files1648826
Ref: eb61648826
Ref: whatsnew/3 7 whatsnew37-pep5521648826
Ref: e951648826
Ref: PEP 552 Hash-based pyc Files-Footnote-11650514
Ref: PEP 552 Hash-based pyc Files-Footnote-21650555
Ref: PEP 552 Hash-based pyc Files-Footnote-31650597
Node: PEP 545 Python Documentation Translations1650639
Ref: whatsnew/3 7 pep-545-python-documentation-translations1650812
Ref: eb71650812
Ref: whatsnew/3 7 whatsnew37-pep5451650812
Ref: e991650812
Ref: PEP 545 Python Documentation Translations-Footnote-11651401
Ref: PEP 545 Python Documentation Translations-Footnote-21651443
Node: Python Development Mode -X dev1651485
Ref: whatsnew/3 7 python-development-mode-x-dev1651621
Ref: eb81651621
Ref: whatsnew/3 7 whatsnew37-devmode1651621
Ref: e961651621
Node: その他の言語変更<7>1652077
Ref: whatsnew/3 7 other-language-changes1652229
Ref: eba1652229
Ref: その他の言語変更<7>-Footnote-11654619
Ref: その他の言語変更<7>-Footnote-21654684
Ref: その他の言語変更<7>-Footnote-31654749
Ref: その他の言語変更<7>-Footnote-41654814
Ref: その他の言語変更<7>-Footnote-51654879
Ref: その他の言語変更<7>-Footnote-61654944
Ref: その他の言語変更<7>-Footnote-71655009
Ref: その他の言語変更<7>-Footnote-81655074
Ref: その他の言語変更<7>-Footnote-91655139
Ref: その他の言語変更<7>-Footnote-101655204
Node: 新たなモジュール<7>1655270
Ref: whatsnew/3 7 new-modules1655436
Ref: ec01655436
Node: contextvars<2>1655626
Ref: whatsnew/3 7 contextvars1655734
Ref: ec11655734
Ref: whatsnew/3 7 whatsnew37-pep5671655734
Ref: e8a1655734
Ref: contextvars<2>-Footnote-11656464
Node: データクラス<3>1656506
Ref: whatsnew/3 7 dataclasses1656645
Ref: ec31656645
Ref: whatsnew/3 7 whatsnew37-pep5571656645
Ref: e8b1656645
Ref: データクラス<3>-Footnote-11657443
Node: importlib resources<3>1657485
Ref: whatsnew/3 7 importlib-resources1657601
Ref: ec61657601
Ref: whatsnew/3 7 whatsnew37-importlib-resources1657601
Ref: e8c1657601
Ref: importlib resources<3>-Footnote-11658335
Ref: importlib resources<3>-Footnote-21658400
Node: 改良されたモジュール<7>1658462
Ref: whatsnew/3 7 improved-modules1658620
Ref: ec71658620
Node: argparse<6>1660120
Ref: whatsnew/3 7 argparse1660221
Ref: ec81660221
Ref: argparse<6>-Footnote-11660457
Node: asyncio<12>1660522
Ref: whatsnew/3 7 asyncio1660643
Ref: eca1660643
Ref: whatsnew/3 7 whatsnew37-asyncio1660643
Ref: e911660643
Ref: asyncio<12>-Footnote-11666930
Ref: asyncio<12>-Footnote-21666995
Ref: asyncio<12>-Footnote-31667037
Ref: asyncio<12>-Footnote-41667102
Ref: asyncio<12>-Footnote-51667167
Ref: asyncio<12>-Footnote-61667232
Ref: asyncio<12>-Footnote-71667297
Ref: asyncio<12>-Footnote-81667362
Ref: asyncio<12>-Footnote-91667427
Ref: asyncio<12>-Footnote-101667492
Ref: asyncio<12>-Footnote-111667558
Ref: asyncio<12>-Footnote-121667624
Ref: asyncio<12>-Footnote-131667690
Ref: asyncio<12>-Footnote-141667756
Ref: asyncio<12>-Footnote-151667822
Ref: asyncio<12>-Footnote-161667888
Ref: asyncio<12>-Footnote-171667954
Ref: asyncio<12>-Footnote-181668020
Ref: asyncio<12>-Footnote-191668086
Ref: asyncio<12>-Footnote-201668152
Ref: asyncio<12>-Footnote-211668218
Ref: asyncio<12>-Footnote-221668284
Ref: asyncio<12>-Footnote-231668350
Ref: asyncio<12>-Footnote-241668416
Node: binascii<2>1668482
Ref: whatsnew/3 7 binascii1668603
Ref: ee71668603
Ref: binascii<2>-Footnote-11668882
Node: calendar<4>1668947
Ref: whatsnew/3 7 calendar1669071
Ref: ee91669071
Ref: calendar<4>-Footnote-11669370
Node: collections<3>1669435
Ref: whatsnew/3 7 collections1669561
Ref: eea1669561
Ref: collections<3>-Footnote-11669795
Node: compileall<3>1669860
Ref: whatsnew/3 7 compileall1669996
Ref: eeb1669996
Ref: compileall<3>-Footnote-11670395
Node: concurrent futures<5>1670460
Ref: whatsnew/3 7 concurrent-futures1670595
Ref: eed1670595
Ref: concurrent futures<5>-Footnote-11671125
Ref: concurrent futures<5>-Footnote-21671190
Node: contextlib<4>1671255
Ref: whatsnew/3 7 contextlib1671388
Ref: eee1671388
Ref: contextlib<4>-Footnote-11671920
Ref: contextlib<4>-Footnote-21671985
Ref: contextlib<4>-Footnote-31672050
Ref: contextlib<4>-Footnote-41672115
Node: cProfile<2>1672180
Ref: whatsnew/3 7 cprofile1672297
Ref: ef01672297
Ref: cProfile<2>-Footnote-11672520
Node: crypt1672585
Ref: whatsnew/3 7 crypt1672700
Ref: ef11672700
Ref: crypt-Footnote-11673023
Ref: crypt-Footnote-21673088
Node: datetime<6>1673153
Ref: whatsnew/3 7 datetime1673263
Ref: ef21673263
Ref: datetime<6>-Footnote-11673676
Ref: datetime<6>-Footnote-21673741
Node: dbm<3>1673805
Ref: whatsnew/3 7 dbm1673920
Ref: ef41673920
Node: decimal<2>1674067
Ref: whatsnew/3 7 decimal1674177
Ref: ef51674177
Ref: decimal<2>-Footnote-11674400
Node: dis<4>1674465
Ref: whatsnew/3 7 dis1674581
Ref: ef61674581
Ref: dis<4>-Footnote-11674986
Node: distutils<4>1675051
Ref: whatsnew/3 7 distutils1675164
Ref: ef71675164
Ref: distutils<4>-Footnote-11675414
Node: enum<5>1675479
Ref: whatsnew/3 7 enum1675598
Ref: ef81675598
Ref: enum<5>-Footnote-11676274
Ref: enum<5>-Footnote-21676339
Node: functools<6>1676404
Ref: whatsnew/3 7 functools1676516
Ref: efa1676516
Ref: functools<6>-Footnote-11676747
Node: gc<7>1676812
Ref: whatsnew/3 7 gc1676924
Ref: efb1676924
Ref: gc<7>-Footnote-11677465
Node: hmac<3>1677530
Ref: whatsnew/3 7 hmac1677644
Ref: eff1677644
Ref: hmac<3>-Footnote-11677909
Node: http client<2>1677974
Ref: whatsnew/3 7 http-client1678097
Ref: f021678097
Ref: http client<2>-Footnote-11678356
Node: http server<3>1678421
Ref: whatsnew/3 7 http-server1678553
Ref: f031678553
Ref: http server<3>-Footnote-11679438
Ref: http server<3>-Footnote-21679503
Ref: http server<3>-Footnote-31679568
Node: idlelib と IDLE1679633
Ref: whatsnew/3 7 idlelib-and-idle1679763
Ref: f061679763
Ref: idlelib と IDLE-Footnote-11682816
Ref: idlelib と IDLE-Footnote-21682881
Ref: idlelib と IDLE-Footnote-31682948
Ref: idlelib と IDLE-Footnote-41683013
Ref: idlelib と IDLE-Footnote-51683078
Ref: idlelib と IDLE-Footnote-61683143
Ref: idlelib と IDLE-Footnote-71683208
Ref: idlelib と IDLE-Footnote-81683273
Ref: idlelib と IDLE-Footnote-91683338
Ref: idlelib と IDLE-Footnote-101683403
Ref: idlelib と IDLE-Footnote-111683471
Ref: idlelib と IDLE-Footnote-121683536
Ref: idlelib と IDLE-Footnote-131683602
Node: importlib<4>1683668
Ref: whatsnew/3 7 importlib1683789
Ref: f071683789
Ref: importlib<4>-Footnote-11684678
Ref: importlib<4>-Footnote-21684743
Ref: importlib<4>-Footnote-31684808
Node: io<6>1684873
Ref: whatsnew/3 7 io1684990
Ref: f091684990
Ref: io<6>-Footnote-11685257
Ref: io<6>-Footnote-21685322
Node: ipaddress<3>1685387
Ref: whatsnew/3 7 ipaddress1685504
Ref: f0b1685504
Ref: ipaddress<3>-Footnote-11685826
Node: itertools<6>1685891
Ref: whatsnew/3 7 itertools1686012
Ref: f0c1686012
Ref: itertools<6>-Footnote-11686251
Node: locale<5>1686316
Ref: whatsnew/3 7 locale1686435
Ref: f0e1686435
Ref: locale<5>-Footnote-11686851
Node: logging<4>1686916
Ref: whatsnew/3 7 logging1687030
Ref: f0f1687030
Ref: logging<4>-Footnote-11687594
Ref: logging<4>-Footnote-21687659
Ref: logging<4>-Footnote-31687724
Node: math<8>1687789
Ref: whatsnew/3 7 math1687906
Ref: f131687906
Ref: math<8>-Footnote-11688133
Node: mimetypes<5>1688198
Ref: whatsnew/3 7 mimetypes1688311
Ref: f151688311
Ref: mimetypes<5>-Footnote-11688528
Node: msilib1688593
Ref: whatsnew/3 7 msilib1688717
Ref: f161688717
Ref: msilib-Footnote-11688914
Node: multiprocessing<5>1688979
Ref: whatsnew/3 7 multiprocessing1689097
Ref: f171689097
Ref: multiprocessing<5>-Footnote-11689752
Ref: multiprocessing<5>-Footnote-21689817
Ref: multiprocessing<5>-Footnote-31689882
Node: os<10>1689947
Ref: whatsnew/3 7 os1690070
Ref: f1b1690070
Ref: os<10>-Footnote-11691370
Ref: os<10>-Footnote-21691435
Ref: os<10>-Footnote-31691500
Ref: os<10>-Footnote-41691565
Ref: os<10>-Footnote-51691630
Ref: os<10>-Footnote-61691695
Ref: os<10>-Footnote-71691760
Node: pathlib<12>1691825
Ref: whatsnew/3 7 pathlib1691936
Ref: f261691936
Ref: pathlib<12>-Footnote-11692198
Node: pdb<7>1692263
Ref: whatsnew/3 7 pdb1692381
Ref: f271692381
Ref: pdb<7>-Footnote-11692793
Ref: pdb<7>-Footnote-21692858
Node: py_compile<3>1692923
Ref: whatsnew/3 7 py-compile1693038
Ref: f281693038
Ref: py_compile<3>-Footnote-11693490
Ref: py_compile<3>-Footnote-21693531
Node: pydoc<3>1693596
Ref: whatsnew/3 7 pydoc1693713
Ref: f291693713
Ref: pydoc<3>-Footnote-11693939
Node: queue<2>1694004
Ref: whatsnew/3 7 queue1694113
Ref: f2a1694113
Ref: queue<2>-Footnote-11694298
Node: re<6>1694363
Ref: whatsnew/3 7 re1694473
Ref: f2c1694473
Ref: re<6>-Footnote-11695557
Ref: re<6>-Footnote-21695622
Ref: re<6>-Footnote-31695687
Ref: re<6>-Footnote-41695752
Ref: re<6>-Footnote-51695817
Node: signal<2>1695882
Ref: whatsnew/3 7 signal1695993
Ref: f301695993
Ref: signal<2>-Footnote-11696314
Node: socket<7>1696379
Ref: whatsnew/3 7 socket1696497
Ref: f321696497
Ref: socket<7>-Footnote-11697605
Ref: socket<7>-Footnote-21697670
Ref: socket<7>-Footnote-31697735
Ref: socket<7>-Footnote-41697800
Ref: socket<7>-Footnote-51697865
Ref: socket<7>-Footnote-61697930
Node: socketserver1697995
Ref: whatsnew/3 7 socketserver1698114
Ref: f381698114
Node: sqlite3<8>1698600
Ref: whatsnew/3 7 sqlite31698716
Ref: f3c1698716
Ref: sqlite3<8>-Footnote-11699160
Ref: sqlite3<8>-Footnote-21699225
Node: ssl<7>1699290
Ref: whatsnew/3 7 ssl1699403
Ref: f3e1699403
Ref: ssl<7>-Footnote-11702700
Ref: ssl<7>-Footnote-21702765
Ref: ssl<7>-Footnote-31702830
Ref: ssl<7>-Footnote-41702895
Ref: ssl<7>-Footnote-51702960
Ref: ssl<7>-Footnote-61703025
Ref: ssl<7>-Footnote-71703090
Ref: ssl<7>-Footnote-81703155
Ref: ssl<7>-Footnote-91703220
Ref: ssl<7>-Footnote-101703285
Ref: ssl<7>-Footnote-111703351
Ref: ssl<7>-Footnote-121703417
Ref: ssl<7>-Footnote-131703483
Ref: ssl<7>-Footnote-141703549
Node: string<2>1703605
Ref: whatsnew/3 7 string1703721
Ref: f471703721
Ref: string<2>-Footnote-11704000
Node: subprocess<3>1704067
Ref: whatsnew/3 7 subprocess1704184
Ref: f481704184
Ref: subprocess<3>-Footnote-11705506
Ref: subprocess<3>-Footnote-21705571
Ref: subprocess<3>-Footnote-31705636
Ref: subprocess<3>-Footnote-41705701
Node: sys<10>1705766
Ref: whatsnew/3 7 sys1705881
Ref: f4c1705881
Ref: sys<10>-Footnote-11706623
Ref: sys<10>-Footnote-21706688
Ref: sys<10>-Footnote-31706753
Node: time<5>1706818
Ref: whatsnew/3 7 time1706930
Ref: f501706930
Ref: time<5>-Footnote-11708141
Ref: time<5>-Footnote-21708183
Node: tkinter<7>1708248
Ref: whatsnew/3 7 tkinter1708367
Ref: f561708367
Ref: tkinter<7>-Footnote-11708550
Node: tracemalloc<2>1708615
Ref: whatsnew/3 7 tracemalloc1708735
Ref: f581708735
Ref: tracemalloc<2>-Footnote-11709203
Node: types<7>1709268
Ref: whatsnew/3 7 types1709392
Ref: f5b1709392
Ref: types<7>-Footnote-11709909
Ref: types<7>-Footnote-21709974
Ref: types<7>-Footnote-31710039
Ref: types<7>-Footnote-41710081
Node: unicodedata<8>1710146
Ref: whatsnew/3 7 unicodedata1710267
Ref: f601710267
Ref: unicodedata<8>-Footnote-11710472
Node: unittest<9>1710528
Ref: whatsnew/3 7 unittest1710654
Ref: f611710654
Ref: unittest<9>-Footnote-11711061
Node: unittest mock1711126
Ref: whatsnew/3 7 unittest-mock1711253
Ref: f621711253
Ref: unittest mock-Footnote-11711773
Ref: unittest mock-Footnote-21711838
Node: urllib parse<6>1711903
Ref: whatsnew/3 7 urllib-parse1712021
Ref: f651712021
Ref: urllib parse<6>-Footnote-11712336
Ref: urllib parse<6>-Footnote-21712395
Ref: urllib parse<6>-Footnote-31712454
Node: uu1712519
Ref: whatsnew/3 7 uu1712631
Ref: f671712631
Ref: uu-Footnote-11712897
Node: uuid<4>1712962
Ref: whatsnew/3 7 uuid1713070
Ref: f681713070
Ref: uuid<4>-Footnote-11713712
Ref: uuid<4>-Footnote-21713777
Node: warnings<4>1713842
Ref: whatsnew/3 7 warnings1713954
Ref: f6c1713954
Ref: warnings<4>-Footnote-11715381
Ref: warnings<4>-Footnote-21715446
Ref: warnings<4>-Footnote-31715511
Ref: warnings<4>-Footnote-41715576
Node: xml<6>1715641
Ref: whatsnew/3 7 xml1715755
Ref: f6d1715755
Ref: xml<6>-Footnote-11716041
Node: xml etree1716096
Ref: whatsnew/3 7 xml-etree1716212
Ref: f6e1716212
Ref: xml etree-Footnote-11716555
Node: xmlrpc server1716620
Ref: whatsnew/3 7 xmlrpc-server1716736
Ref: f701716736
Ref: xmlrpc server-Footnote-11716949
Node: zipapp1717013
Ref: whatsnew/3 7 zipapp1717130
Ref: f711717130
Ref: zipapp-Footnote-11717656
Ref: zipapp-Footnote-21717721
Node: zipfile<3>1717786
Ref: whatsnew/3 7 zipfile1717881
Ref: f731717881
Ref: zipfile<3>-Footnote-11718248
Ref: zipfile<3>-Footnote-21718313
Node: C API の変更<11>1718378
Ref: whatsnew/3 7 c-api-changes1718525
Ref: f741718525
Ref: C API の変更<11>-Footnote-11723058
Ref: C API の変更<11>-Footnote-21723123
Ref: C API の変更<11>-Footnote-31723188
Ref: C API の変更<11>-Footnote-41723253
Ref: C API の変更<11>-Footnote-51723318
Ref: C API の変更<11>-Footnote-61723383
Ref: C API の変更<11>-Footnote-71723448
Ref: C API の変更<11>-Footnote-81723513
Ref: C API の変更<11>-Footnote-91723578
Ref: C API の変更<11>-Footnote-101723643
Ref: C API の変更<11>-Footnote-111723709
Ref: C API の変更<11>-Footnote-121723775
Ref: C API の変更<11>-Footnote-131723841
Ref: C API の変更<11>-Footnote-141723907
Ref: C API の変更<11>-Footnote-151723973
Ref: C API の変更<11>-Footnote-161724038
Ref: C API の変更<11>-Footnote-171724104
Ref: C API の変更<11>-Footnote-181724170
Ref: C API の変更<11>-Footnote-191724236
Ref: C API の変更<11>-Footnote-201724302
Node: Build Changes<6>1724368
Ref: whatsnew/3 7 build-changes1724494
Ref: f8d1724494
Ref: Build Changes<6>-Footnote-11725629
Ref: Build Changes<6>-Footnote-21725694
Ref: Build Changes<6>-Footnote-31725759
Node: 最適化<8>1725824
Ref: whatsnew/3 7 optimizations1725973
Ref: f8e1725973
Ref: whatsnew/3 7 whatsnew37-perf1725973
Ref: e9a1725973
Ref: whatsnew/3 7 whatsnew37-asyncio-perf1726658
Ref: ecb1726658
Ref: 最適化<8>-Footnote-11731234
Ref: 最適化<8>-Footnote-21731299
Ref: 最適化<8>-Footnote-31731364
Ref: 最適化<8>-Footnote-41731429
Ref: 最適化<8>-Footnote-51731494
Ref: 最適化<8>-Footnote-61731559
Ref: 最適化<8>-Footnote-71731624
Ref: 最適化<8>-Footnote-81731689
Ref: 最適化<8>-Footnote-91731754
Ref: 最適化<8>-Footnote-101731819
Ref: 最適化<8>-Footnote-111731885
Ref: 最適化<8>-Footnote-121731951
Ref: 最適化<8>-Footnote-131732017
Ref: 最適化<8>-Footnote-141732083
Ref: 最適化<8>-Footnote-151732149
Ref: 最適化<8>-Footnote-161732215
Ref: 最適化<8>-Footnote-171732281
Ref: 最適化<8>-Footnote-181732347
Ref: 最適化<8>-Footnote-191732413
Ref: 最適化<8>-Footnote-201732479
Ref: 最適化<8>-Footnote-211732545
Ref: 最適化<8>-Footnote-221732611
Ref: 最適化<8>-Footnote-231732677
Ref: 最適化<8>-Footnote-241732743
Ref: 最適化<8>-Footnote-251732809
Ref: 最適化<8>-Footnote-261732875
Ref: 最適化<8>-Footnote-271732941
Ref: 最適化<8>-Footnote-281733007
Ref: 最適化<8>-Footnote-291733073
Ref: 最適化<8>-Footnote-301733139
Node: その他の CPython の実装の変更<2>1733205
Ref: whatsnew/3 7 other-cpython-implementation-changes1733367
Ref: f9e1733367
Ref: その他の CPython の実装の変更<2>-Footnote-11734770
Ref: その他の CPython の実装の変更<2>-Footnote-21734835
Ref: その他の CPython の実装の変更<2>-Footnote-31734900
Ref: その他の CPython の実装の変更<2>-Footnote-41734965
Ref: その他の CPython の実装の変更<2>-Footnote-51735030
Node: 非推奨の Python の挙動1735095
Ref: whatsnew/3 7 deprecated-python-behavior1735304
Ref: fa11735304
Ref: 非推奨の Python の挙動-Footnote-11736412
Ref: 非推奨の Python の挙動-Footnote-21736477
Node: 非推奨の Python モジュール、関数、メソッド1736542
Ref: whatsnew/3 7 deprecated-python-modules-functions-and-methods1736751
Ref: fa31736751
Node: aifc1737166
Ref: whatsnew/3 7 aifc1737286
Ref: fa41737286
Ref: aifc-Footnote-11737508
Node: asyncio<13>1737573
Ref: whatsnew/3 7 id21737716
Ref: fa51737716
Ref: whatsnew/3 7 whatsnew37-asyncio-deprecated1737716
Ref: ee61737716
Ref: asyncio<13>-Footnote-11738243
Ref: asyncio<13>-Footnote-21738308
Node: collections<4>1738373
Ref: whatsnew/3 7 id31738518
Ref: fa61738518
Ref: collections<4>-Footnote-11738899
Node: dbm<4>1738964
Ref: whatsnew/3 7 id41739105
Ref: fa71739105
Ref: dbm<4>-Footnote-11739508
Node: enum<6>1739573
Ref: whatsnew/3 7 id51739710
Ref: fa81739710
Ref: enum<6>-Footnote-11740168
Node: gettext<2>1740233
Ref: whatsnew/3 7 gettext1740376
Ref: fa91740376
Ref: gettext<2>-Footnote-11740623
Node: importlib<5>1740688
Ref: whatsnew/3 7 id61740833
Ref: faa1740833
Ref: importlib<5>-Footnote-11741345
Node: locale<6>1741410
Ref: whatsnew/3 7 id71741552
Ref: fac1741552
Ref: locale<6>-Footnote-11741757
Node: macpath1741822
Ref: whatsnew/3 7 macpath1741964
Ref: fad1741964
Ref: macpath-Footnote-11742156
Node: threading<8>1742220
Ref: whatsnew/3 7 threading1742362
Ref: fae1742362
Ref: threading<8>-Footnote-11742662
Node: socket<8>1742727
Ref: whatsnew/3 7 id81742868
Ref: faf1742868
Ref: socket<8>-Footnote-11743215
Node: ssl<8>1743280
Ref: whatsnew/3 7 id91743414
Ref: fb01743414
Ref: ssl<8>-Footnote-11743628
Node: sunau1743693
Ref: whatsnew/3 7 sunau1743825
Ref: fb11743825
Ref: sunau-Footnote-11744053
Node: sys<11>1744118
Ref: whatsnew/3 7 id101744251
Ref: fb21744251
Ref: sys<11>-Footnote-11744570
Node: wave<3>1744635
Ref: whatsnew/3 7 wave1744754
Ref: fb31744754
Ref: wave<3>-Footnote-11744984
Node: C API の非推奨の関数ならびに型1745049
Ref: whatsnew/3 7 deprecated-functions-and-types-of-the-c-api1745286
Ref: fb41745286
Ref: C API の非推奨の関数ならびに型-Footnote-11745932
Ref: C API の非推奨の関数ならびに型-Footnote-21745997
Node: サポート対象プラットフォームからの除外1746062
Ref: whatsnew/3 7 id111746265
Ref: fb51746265
Ref: whatsnew/3 7 platform-support-removals1746265
Ref: f411746265
Ref: サポート対象プラットフォームからの除外-Footnote-11747755
Ref: サポート対象プラットフォームからの除外-Footnote-21747822
Node: API と機能の削除<2>1747902
Ref: whatsnew/3 7 api-and-feature-removals1748078
Ref: fb61748078
Ref: API と機能の削除<2>-Footnote-11750977
Ref: API と機能の削除<2>-Footnote-21751042
Ref: API と機能の削除<2>-Footnote-31751107
Node: Module Removals1751172
Ref: whatsnew/3 7 module-removals1751311
Ref: fba1751311
Ref: Module Removals-Footnote-11751648
Node: Windows-only Changes1751713
Ref: whatsnew/3 7 windows-only-changes1751850
Ref: fbb1751850
Ref: Windows-only Changes-Footnote-11752729
Ref: Windows-only Changes-Footnote-21752794
Node: Python 3 7 への移植1752859
Ref: whatsnew/3 7 porting-to-python-3-71753018
Ref: fbc1753018
Ref: whatsnew/3 7 porting-to-python-371753018
Ref: e9b1753018
Node: Python の挙動の変更<2>1753600
Ref: whatsnew/3 7 changes-in-python-behavior1753720
Ref: fbd1753720
Ref: Python の挙動の変更<2>-Footnote-11755599
Ref: Python の挙動の変更<2>-Footnote-21755664
Ref: Python の挙動の変更<2>-Footnote-31755706
Ref: Python の挙動の変更<2>-Footnote-41755771
Ref: Python の挙動の変更<2>-Footnote-51755836
Ref: Python の挙動の変更<2>-Footnote-61755901
Node: Python API の変更<8>1755966
Ref: whatsnew/3 7 changes-in-the-python-api1756114
Ref: fc01756114
Ref: Python API の変更<8>-Footnote-11765640
Ref: Python API の変更<8>-Footnote-21765705
Ref: Python API の変更<8>-Footnote-31765770
Ref: Python API の変更<8>-Footnote-41765835
Ref: Python API の変更<8>-Footnote-51765900
Ref: Python API の変更<8>-Footnote-61765965
Ref: Python API の変更<8>-Footnote-71766030
Ref: Python API の変更<8>-Footnote-81766095
Ref: Python API の変更<8>-Footnote-91766160
Ref: Python API の変更<8>-Footnote-101766225
Ref: Python API の変更<8>-Footnote-111766291
Ref: Python API の変更<8>-Footnote-121766357
Ref: Python API の変更<8>-Footnote-131766423
Ref: Python API の変更<8>-Footnote-141766489
Ref: Python API の変更<8>-Footnote-151766532
Ref: Python API の変更<8>-Footnote-161766598
Ref: Python API の変更<8>-Footnote-171766664
Ref: Python API の変更<8>-Footnote-181766730
Ref: Python API の変更<8>-Footnote-191766796
Ref: Python API の変更<8>-Footnote-201766862
Ref: Python API の変更<8>-Footnote-211766928
Ref: Python API の変更<8>-Footnote-221766994
Ref: Python API の変更<8>-Footnote-231767060
Ref: Python API の変更<8>-Footnote-241767126
Ref: Python API の変更<8>-Footnote-251767192
Ref: Python API の変更<8>-Footnote-261767258
Ref: Python API の変更<8>-Footnote-271767324
Ref: Python API の変更<8>-Footnote-281767390
Ref: Python API の変更<8>-Footnote-291767456
Ref: Python API の変更<8>-Footnote-301767522
Node: C API の変更<12>1767588
Ref: whatsnew/3 7 changes-in-the-c-api1767746
Ref: fe01767746
Ref: C API の変更<12>-Footnote-11768371
Node: CPython バイトコードの変更<7>1768436
Ref: whatsnew/3 7 cpython-bytecode-changes1768594
Ref: fe11768594
Ref: CPython バイトコードの変更<7>-Footnote-11768949
Ref: CPython バイトコードの変更<7>-Footnote-21769014
Node: Windows-only Changes<2>1769079
Ref: whatsnew/3 7 id121769260
Ref: fe21769260
Ref: Windows-only Changes<2>-Footnote-11769592
Node: その他の CPython の実装の変更<3>1769657
Ref: whatsnew/3 7 id131769791
Ref: fe41769791
Ref: その他の CPython の実装の変更<3>-Footnote-11772113
Ref: その他の CPython の実装の変更<3>-Footnote-21772155
Ref: その他の CPython の実装の変更<3>-Footnote-31772220
Node: Python 3 7 1 での重要な変更点1772285
Ref: whatsnew/3 7 notable-changes-in-python-3-7-11772461
Ref: fe51772461
Ref: Python 3 7 1 での重要な変更点-Footnote-11773400
Ref: Python 3 7 1 での重要な変更点-Footnote-21773465
Ref: Python 3 7 1 での重要な変更点-Footnote-31773530
Node: Python 3 7 2 での重要な変更点1773595
Ref: whatsnew/3 7 notable-changes-in-python-3-7-21773785
Ref: fe81773785
Node: Python 3 7 6 での重要な変更点1774286
Ref: whatsnew/3 7 notable-changes-in-python-3-7-61774477
Ref: fe91774477
Ref: Python 3 7 6 での重要な変更点-Footnote-11775044
Node: Python 3 7 10 での重要な変更点1775109
Ref: whatsnew/3 7 notable-changes-in-python-3-7-101775295
Ref: fea1775295
Ref: Python 3 7 10 での重要な変更点-Footnote-11776021
Node: Notable changes in Python 3 7 111776086
Ref: whatsnew/3 7 notable-changes-in-python-3-7-111776269
Ref: feb1776269
Ref: Notable changes in Python 3 7 11-Footnote-11777188
Ref: Notable changes in Python 3 7 11-Footnote-21777243
Node: Notable security feature in 3 7 141777298
Ref: whatsnew/3 7 notable-security-feature-in-3-7-141777434
Ref: fec1777434
Ref: Notable security feature in 3 7 14-Footnote-11778166
Node: What's New In Python 3 61778222
Ref: whatsnew/3 6 doc1778369
Ref: fed1778369
Ref: whatsnew/3 6 translation-repo1778369
Ref: fee1778369
Ref: whatsnew/3 6 what-s-new-in-python-3-61778369
Ref: fef1778369
Ref: What's New In Python 3 6-Footnote-11779822
Ref: What's New In Python 3 6-Footnote-21779882
Node: 概要 -- リリースハイライト<9>1779924
Ref: whatsnew/3 6 summary-release-highlights1780053
Ref: ff01780053
Ref: 概要 -- リリースハイライト<9>-Footnote-11784897
Ref: 概要 -- リリースハイライト<9>-Footnote-21784977
Ref: 概要 -- リリースハイライト<9>-Footnote-31785067
Node: 新しい機能<14>1785109
Ref: whatsnew/3 6 new-features1785274
Ref: 10041785274
Ref: whatsnew/3 6 pypy-dict-implementation1785274
Ref: 10051785274
Node: PEP 498 フォーマット済み文字列リテラル1786947
Ref: whatsnew/3 6 pep-498-formatted-string-literals1787109
Ref: 10061787109
Ref: whatsnew/3 6 whatsnew36-pep4981787109
Ref: ff11787109
Ref: PEP 498 フォーマット済み文字列リテラル-Footnote-11788231
Ref: PEP 498 フォーマット済み文字列リテラル-Footnote-21788273
Node: PEP 526 変数アノテーションの文法1788315
Ref: whatsnew/3 6 pep-526-syntax-for-variable-annotations1788539
Ref: 10071788539
Ref: whatsnew/3 6 whatsnew36-pep5261788539
Ref: ff31788539
Ref: PEP 526 変数アノテーションの文法-Footnote-11789935
Ref: PEP 526 変数アノテーションの文法-Footnote-21789977
Ref: PEP 526 変数アノテーションの文法-Footnote-31790019
Ref: PEP 526 変数アノテーションの文法-Footnote-41790054
Node: PEP 515 数値リテラル内のアンダースコア1790095
Ref: whatsnew/3 6 pep-515-underscores-in-numeric-literals1790301
Ref: 10081790301
Ref: whatsnew/3 6 whatsnew36-pep5151790301
Ref: ff21790301
Ref: PEP 515 数値リテラル内のアンダースコア-Footnote-11791487
Ref: PEP 515 数値リテラル内のアンダースコア-Footnote-21791529
Node: PEP 525 非同期ジェネレータ1791571
Ref: whatsnew/3 6 pep-525-asynchronous-generators1791762
Ref: 10091791762
Ref: whatsnew/3 6 whatsnew36-pep5251791762
Ref: ff41791762
Ref: PEP 525 非同期ジェネレータ-Footnote-11792684
Ref: PEP 525 非同期ジェネレータ-Footnote-21792726
Node: PEP 530 非同期内包表記1792768
Ref: whatsnew/3 6 pep-530-asynchronous-comprehensions1792953
Ref: 100a1792953
Ref: whatsnew/3 6 whatsnew36-pep5301792953
Ref: ff51792953
Ref: PEP 530 非同期内包表記-Footnote-11793532
Ref: PEP 530 非同期内包表記-Footnote-21793574
Node: PEP 487 Simpler customization of class creation1793616
Ref: whatsnew/3 6 pep-487-simpler-customization-of-class-creation1793807
Ref: 100b1793807
Ref: whatsnew/3 6 whatsnew36-pep4871793807
Ref: ff81793807
Ref: PEP 487 Simpler customization of class creation-Footnote-11794892
Node: PEP 487 記述子プロトコルの改善1794934
Ref: whatsnew/3 6 pep-487-descriptor-protocol-enhancements1795158
Ref: 100e1795158
Ref: whatsnew/3 6 whatsnew36-pep487-descriptors1795158
Ref: 100f1795158
Ref: PEP 487 記述子プロトコルの改善-Footnote-11796382
Ref: PEP 487 記述子プロトコルの改善-Footnote-21796424
Node: PEP 519 ファイルシステムパスプロトコルの追加1796466
Ref: whatsnew/3 6 pep-519-adding-a-file-system-path-protocol1796681
Ref: 10121796681
Ref: whatsnew/3 6 whatsnew36-pep5191796681
Ref: ffd1796681
Ref: PEP 519 ファイルシステムパスプロトコルの追加-Footnote-11799514
Node: PEP 495 地域時間の曖昧さ回避1799556
Ref: whatsnew/3 6 pep-495-local-time-disambiguation1799816
Ref: 10181799816
Ref: whatsnew/3 6 whatsnew36-pep4951799816
Ref: ffe1799816
Ref: PEP 495 地域時間の曖昧さ回避-Footnote-11801337
Ref: PEP 495 地域時間の曖昧さ回避-Footnote-21801379
Node: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更1801421
Ref: whatsnew/3 6 pep-529-change-windows-filesystem-encoding-to-utf-81801696
Ref: 101a1801696
Ref: whatsnew/3 6 whatsnew36-pep5291801696
Ref: 10021801696
Ref: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更-Footnote-11802775
Node: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更1802817
Ref: whatsnew/3 6 pep-528-change-windows-console-encoding-to-utf-81803104
Ref: 101c1803104
Ref: whatsnew/3 6 whatsnew36-pep5281803104
Ref: 10011803104
Ref: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更-Footnote-11803871
Node: PEP 520 クラス属性の定義の順番を保持1803913
Ref: whatsnew/3 6 pep-520-preserving-class-attribute-definition-order1804161
Ref: 101e1804161
Ref: whatsnew/3 6 whatsnew36-pep5201804161
Ref: ff91804161
Ref: PEP 520 クラス属性の定義の順番を保持-Footnote-11804778
Node: PEP 468 キーワード引数の順番の保持1804820
Ref: whatsnew/3 6 pep-468-preserving-keyword-argument-order1805012
Ref: 10211805012
Ref: whatsnew/3 6 whatsnew36-pep4681805012
Ref: ffa1805012
Ref: PEP 468 キーワード引数の順番の保持-Footnote-11805426
Node: 新たな dict 実装1805468
Ref: whatsnew/3 6 new-dict-implementation1805661
Ref: 10221805661
Ref: whatsnew/3 6 whatsnew36-compactdict1805661
Ref: ff71805661
Ref: 新たな dict 実装-Footnote-11806628
Ref: 新たな dict 実装-Footnote-21806708
Ref: 新たな dict 実装-Footnote-31806798
Ref: 新たな dict 実装-Footnote-41806863
Node: PEP 523 CPython にフレーム評価 API を追加1806943
Ref: whatsnew/3 6 pep-523-adding-a-frame-evaluation-api-to-cpython1807114
Ref: 10231807114
Ref: whatsnew/3 6 whatsnew36-pep5231807114
Ref: 10241807114
Ref: PEP 523 CPython にフレーム評価 API を追加-Footnote-11808273
Ref: PEP 523 CPython にフレーム評価 API を追加-Footnote-21808315
Node: PYTHONMALLOC 環境変数1808357
Ref: whatsnew/3 6 pythonmalloc-environment-variable1808543
Ref: 10251808543
Ref: whatsnew/3 6 whatsnew36-pythonmalloc1808543
Ref: ffc1808543
Ref: PYTHONMALLOC 環境変数-Footnote-11811955
Ref: PYTHONMALLOC 環境変数-Footnote-21812020
Node: DTrace and SystemTap probing support1812085
Ref: whatsnew/3 6 dtrace-and-systemtap-probing-support1812211
Ref: 102d1812211
Ref: whatsnew/3 6 whatsnew36-tracing1812211
Ref: ffb1812211
Ref: DTrace and SystemTap probing support-Footnote-11813126
Node: その他の言語変更<8>1813191
Ref: whatsnew/3 6 other-language-changes1813343
Ref: 102f1813343
Ref: その他の言語変更<8>-Footnote-11814742
Ref: その他の言語変更<8>-Footnote-21814807
Ref: その他の言語変更<8>-Footnote-31814872
Ref: その他の言語変更<8>-Footnote-41814937
Node: 新たなモジュール<8>1815002
Ref: whatsnew/3 6 new-modules1815168
Ref: 10331815168
Node: secrets1815247
Ref: whatsnew/3 6 secrets1815318
Ref: 10341815318
Ref: whatsnew/3 6 whatsnew36-pep5061815318
Ref: ff61815318
Ref: secrets-Footnote-11815992
Node: 改良されたモジュール<8>1816034
Ref: whatsnew/3 6 improved-modules1816185
Ref: 10351816185
Node: array<4>1817774
Ref: whatsnew/3 6 array1817867
Ref: 10361817867
Ref: array<4>-Footnote-11818162
Node: ast<8>1818227
Ref: whatsnew/3 6 ast1818340
Ref: 10371818340
Ref: ast<8>-Footnote-11818591
Node: asyncio<14>1818656
Ref: whatsnew/3 6 asyncio1818772
Ref: 10381818772
Ref: asyncio<14>-Footnote-11822246
Ref: asyncio<14>-Footnote-21822311
Ref: asyncio<14>-Footnote-31822356
Ref: asyncio<14>-Footnote-41822421
Ref: asyncio<14>-Footnote-51822486
Ref: asyncio<14>-Footnote-61822551
Ref: asyncio<14>-Footnote-71822616
Ref: asyncio<14>-Footnote-81822681
Ref: asyncio<14>-Footnote-91822746
Ref: asyncio<14>-Footnote-101822811
Ref: asyncio<14>-Footnote-111822877
Ref: asyncio<14>-Footnote-121822943
Node: binascii<3>1823009
Ref: whatsnew/3 6 binascii1823124
Ref: 10421823124
Ref: binascii<3>-Footnote-11823411
Node: cmath1823476
Ref: whatsnew/3 6 cmath1823594
Ref: 10431823594
Ref: cmath-Footnote-11824117
Ref: cmath-Footnote-21824182
Ref: cmath-Footnote-31824224
Node: collections<5>1824289
Ref: whatsnew/3 6 collections1824417
Ref: 104a1824417
Ref: collections<5>-Footnote-11825529
Ref: collections<5>-Footnote-21825594
Ref: collections<5>-Footnote-31825659
Ref: collections<5>-Footnote-41825724
Ref: collections<5>-Footnote-51825789
Ref: collections<5>-Footnote-61825854
Node: concurrent futures<6>1825919
Ref: whatsnew/3 6 concurrent-futures1826055
Ref: 104f1826055
Ref: concurrent futures<6>-Footnote-11826388
Node: contextlib<5>1826453
Ref: whatsnew/3 6 contextlib1826586
Ref: 10501826586
Ref: contextlib<5>-Footnote-11827086
Node: datetime<7>1827151
Ref: whatsnew/3 6 datetime1827273
Ref: 10531827273
Ref: datetime<7>-Footnote-11828301
Ref: datetime<7>-Footnote-21828366
Ref: datetime<7>-Footnote-31828431
Ref: datetime<7>-Footnote-41828496
Node: decimal<3>1828561
Ref: whatsnew/3 6 decimal1828682
Ref: 10581828682
Ref: decimal<3>-Footnote-11829098
Node: distutils<5>1829163
Ref: whatsnew/3 6 distutils1829281
Ref: 105a1829281
Ref: distutils<5>-Footnote-11829657
Node: email<4>1829722
Ref: whatsnew/3 6 email1829857
Ref: 105b1829857
Ref: email<4>-Footnote-11830778
Ref: email<4>-Footnote-21830843
Ref: email<4>-Footnote-31830908
Node: エンコーディング<2>1830973
Ref: whatsnew/3 6 encodings1831103
Ref: 105f1831103
Ref: エンコーディング<2>-Footnote-11831422
Node: enum<7>1831487
Ref: whatsnew/3 6 enum1831624
Ref: 10601831624
Ref: enum<7>-Footnote-11832386
Node: faulthandler<4>1832451
Ref: whatsnew/3 6 faulthandler1832573
Ref: 10631832573
Ref: faulthandler<4>-Footnote-11832838
Node: fileinput<2>1832903
Ref: whatsnew/3 6 fileinput1833028
Ref: 10641833028
Ref: fileinput<2>-Footnote-11833219
Node: hashlib<6>1833284
Ref: whatsnew/3 6 hashlib1833408
Ref: 10661833408
Ref: hashlib<6>-Footnote-11834466
Ref: hashlib<6>-Footnote-21834531
Ref: hashlib<6>-Footnote-31834596
Ref: hashlib<6>-Footnote-41834661
Node: http client<3>1834726
Ref: whatsnew/3 6 http-client1834857
Ref: 106d1834857
Ref: http client<3>-Footnote-11835121
Node: idlelib と IDLE<2>1835186
Ref: whatsnew/3 6 idlelib-and-idle1835319
Ref: 10701835319
Ref: idlelib と IDLE<2>-Footnote-11838803
Ref: idlelib と IDLE<2>-Footnote-21838868
Ref: idlelib と IDLE<2>-Footnote-31838933
Ref: idlelib と IDLE<2>-Footnote-41839000
Ref: idlelib と IDLE<2>-Footnote-51839065
Ref: idlelib と IDLE<2>-Footnote-61839130
Ref: idlelib と IDLE<2>-Footnote-71839195
Ref: idlelib と IDLE<2>-Footnote-81839260
Ref: idlelib と IDLE<2>-Footnote-91839325
Ref: idlelib と IDLE<2>-Footnote-101839390
Ref: idlelib と IDLE<2>-Footnote-111839456
Node: importlib<6>1839524
Ref: whatsnew/3 6 importlib1839653
Ref: 10711839653
Ref: importlib<6>-Footnote-11840480
Node: inspect<8>1840545
Ref: whatsnew/3 6 inspect1840662
Ref: 10771840662
Ref: inspect<8>-Footnote-11841439
Ref: inspect<8>-Footnote-21841504
Node: json<3>1841569
Ref: whatsnew/3 6 json1841684
Ref: 10781841684
Ref: json<3>-Footnote-11842009
Node: logging<5>1842074
Ref: whatsnew/3 6 logging1842186
Ref: 10791842186
Ref: logging<5>-Footnote-11842519
Node: math<9>1842584
Ref: whatsnew/3 6 math1842707
Ref: 107b1842707
Ref: math<9>-Footnote-11842941
Ref: math<9>-Footnote-21843006
Node: multiprocessing<6>1843048
Ref: whatsnew/3 6 multiprocessing1843167
Ref: 107c1843167
Ref: multiprocessing<6>-Footnote-11843398
Node: os<11>1843462
Ref: whatsnew/3 6 os1843585
Ref: 107d1843585
Ref: os<11>-Footnote-11844583
Ref: os<11>-Footnote-21844648
Ref: os<11>-Footnote-31844690
Node: pathlib<13>1844732
Ref: whatsnew/3 6 pathlib1844843
Ref: 10801844843
Ref: pathlib<13>-Footnote-11845122
Node: pdb<8>1845187
Ref: whatsnew/3 6 pdb1845301
Ref: 10811845301
Node: pickle<4>1845541
Ref: whatsnew/3 6 pickle1845658
Ref: 10821845658
Ref: pickle<4>-Footnote-11845977
Node: pickletools<2>1846042
Ref: whatsnew/3 6 pickletools1846161
Ref: 10831846161
Ref: pickletools<2>-Footnote-11846392
Node: pydoc<4>1846457
Ref: whatsnew/3 6 pydoc1846576
Ref: 10851846576
Ref: pydoc<4>-Footnote-11846972
Ref: pydoc<4>-Footnote-21847036
Node: random<4>1847101
Ref: whatsnew/3 6 random1847211
Ref: 10861847211
Ref: random<4>-Footnote-11847469
Node: re<7>1847534
Ref: whatsnew/3 6 re1847644
Ref: 10881847644
Ref: re<7>-Footnote-11848358
Ref: re<7>-Footnote-21848424
Ref: re<7>-Footnote-31848489
Node: readline1848554
Ref: whatsnew/3 6 readline1848666
Ref: 108a1848666
Ref: readline-Footnote-11848900
Node: rlcompleter1848965
Ref: whatsnew/3 6 rlcompleter1849080
Ref: 108c1849080
Ref: rlcompleter-Footnote-11849386
Ref: rlcompleter-Footnote-21849451
Node: shlex<2>1849516
Ref: whatsnew/3 6 shlex1849630
Ref: 108d1849630
Ref: shlex<2>-Footnote-11849924
Node: site<3>1849991
Ref: whatsnew/3 6 site1850104
Ref: 10901850104
Ref: site<3>-Footnote-11850370
Node: sqlite3<9>1850435
Ref: whatsnew/3 6 sqlite31850549
Ref: 10911850549
Ref: sqlite3<9>-Footnote-11850768
Node: socket<9>1850833
Ref: whatsnew/3 6 socket1850955
Ref: 10931850955
Ref: socket<9>-Footnote-11851920
Ref: socket<9>-Footnote-21851985
Ref: socket<9>-Footnote-31852050
Ref: socket<9>-Footnote-41852115
Ref: socket<9>-Footnote-51852180
Node: socketserver<2>1852245
Ref: whatsnew/3 6 socketserver1852363
Ref: 109a1852363
Ref: socketserver<2>-Footnote-11853003
Ref: socketserver<2>-Footnote-21853068
Node: ssl<9>1853133
Ref: whatsnew/3 6 ssl1853255
Ref: 109e1853255
Ref: ssl<9>-Footnote-11854688
Ref: ssl<9>-Footnote-21854753
Ref: ssl<9>-Footnote-31854818
Ref: ssl<9>-Footnote-41854883
Ref: ssl<9>-Footnote-51854948
Ref: ssl<9>-Footnote-61855013
Ref: ssl<9>-Footnote-71855078
Ref: ssl<9>-Footnote-81855143
Node: statistics<5>1855198
Ref: whatsnew/3 6 statistics1855314
Ref: 10a21855314
Ref: statistics<5>-Footnote-11855504
Node: struct<2>1855569
Ref: whatsnew/3 6 struct1855692
Ref: 10a41855692
Ref: struct<2>-Footnote-11855925
Node: subprocess<4>1855990
Ref: whatsnew/3 6 subprocess1856107
Ref: 10a51856107
Ref: subprocess<4>-Footnote-11856802
Ref: subprocess<4>-Footnote-21856867
Node: sys<12>1856931
Ref: whatsnew/3 6 sys1857048
Ref: 10a61857048
Ref: sys<12>-Footnote-11857653
Ref: sys<12>-Footnote-21857718
Node: telnetlib1857783
Ref: whatsnew/3 6 telnetlib1857894
Ref: 10a91857894
Ref: telnetlib-Footnote-11858071
Node: time<6>1858136
Ref: whatsnew/3 6 time1858249
Ref: 10aa1858249
Node: timeit<2>1858391
Ref: whatsnew/3 6 timeit1858505
Ref: 10ac1858505
Ref: timeit<2>-Footnote-11858965
Ref: timeit<2>-Footnote-21859029
Node: tkinter<8>1859094
Ref: whatsnew/3 6 tkinter1859213
Ref: 10ae1859213
Ref: tkinter<8>-Footnote-11859659
Node: traceback<4>1859724
Ref: whatsnew/3 6 traceback1859848
Ref: 10af1859848
Ref: whatsnew/3 6 whatsnew36-traceback1859848
Ref: 10321859848
Ref: traceback<4>-Footnote-11860483
Node: tracemalloc<3>1860548
Ref: whatsnew/3 6 tracemalloc1860672
Ref: 10b01860672
Ref: tracemalloc<3>-Footnote-11861036
Node: typing<12>1861101
Ref: whatsnew/3 6 typing1861227
Ref: 10b21861227
Ref: whatsnew/3 6 whatsnew36-typing1861227
Ref: fff1861227
Ref: typing<12>-Footnote-11862886
Ref: typing<12>-Footnote-21862936
Ref: typing<12>-Footnote-31863001
Ref: typing<12>-Footnote-41863066
Ref: typing<12>-Footnote-51863108
Ref: typing<12>-Footnote-61863158
Ref: typing<12>-Footnote-71863210
Node: unicodedata<9>1863262
Ref: whatsnew/3 6 unicodedata1863390
Ref: 10b61863390
Ref: unicodedata<9>-Footnote-11863580
Node: unittest mock<2>1863631
Ref: whatsnew/3 6 unittest-mock1863763
Ref: 10b71863763
Ref: unittest mock<2>-Footnote-11864315
Ref: unittest mock<2>-Footnote-21864380
Node: urllib request1864445
Ref: whatsnew/3 6 urllib-request1864581
Ref: 10bb1864581
Ref: urllib request-Footnote-11864956
Node: urllib robotparser1865021
Ref: whatsnew/3 6 urllib-robotparser1865148
Ref: 10bd1865148
Ref: urllib robotparser-Footnote-11865396
Node: venv<6>1865461
Ref: whatsnew/3 6 venv1865585
Ref: 10bf1865585
Ref: venv<6>-Footnote-11865913
Node: warnings<5>1865978
Ref: whatsnew/3 6 warnings1866090
Ref: 10c01866090
Ref: warnings<5>-Footnote-11867365
Ref: warnings<5>-Footnote-21867430
Node: winreg1867495
Ref: whatsnew/3 6 winreg1867608
Ref: 10c11867608
Ref: winreg-Footnote-11867784
Node: winsound1867849
Ref: whatsnew/3 6 winsound1867964
Ref: 10c31867964
Ref: winsound-Footnote-11868168
Node: xmlrpc client1868233
Ref: whatsnew/3 6 xmlrpc-client1868352
Ref: 10c71868352
Ref: xmlrpc client-Footnote-11868647
Node: zipfile<4>1868712
Ref: whatsnew/3 6 zipfile1868830
Ref: 10c81868830
Ref: zipfile<4>-Footnote-11869362
Ref: zipfile<4>-Footnote-21869427
Node: zlib<3>1869492
Ref: whatsnew/3 6 zlib1869588
Ref: 10cb1869588
Ref: zlib<3>-Footnote-11869847
Ref: zlib<3>-Footnote-21869912
Node: 最適化<9>1869977
Ref: whatsnew/3 6 optimizations1870141
Ref: 10cd1870141
Ref: 最適化<9>-Footnote-11874003
Ref: 最適化<9>-Footnote-21874068
Ref: 最適化<9>-Footnote-31874133
Ref: 最適化<9>-Footnote-41874198
Ref: 最適化<9>-Footnote-51874263
Ref: 最適化<9>-Footnote-61874328
Ref: 最適化<9>-Footnote-71874393
Ref: 最適化<9>-Footnote-81874458
Ref: 最適化<9>-Footnote-91874523
Ref: 最適化<9>-Footnote-101874588
Ref: 最適化<9>-Footnote-111874654
Ref: 最適化<9>-Footnote-121874720
Ref: 最適化<9>-Footnote-131874786
Ref: 最適化<9>-Footnote-141874852
Ref: 最適化<9>-Footnote-151874918
Ref: 最適化<9>-Footnote-161874984
Ref: 最適化<9>-Footnote-171875050
Ref: 最適化<9>-Footnote-181875116
Ref: 最適化<9>-Footnote-191875182
Ref: 最適化<9>-Footnote-201875248
Ref: 最適化<9>-Footnote-211875314
Node: ビルドならびに C API の変更<2>1875380
Ref: whatsnew/3 6 build-and-c-api-changes1875529
Ref: 10d21875529
Ref: ビルドならびに C API の変更<2>-Footnote-11878011
Ref: ビルドならびに C API の変更<2>-Footnote-21878053
Ref: ビルドならびに C API の変更<2>-Footnote-31878118
Ref: ビルドならびに C API の変更<2>-Footnote-41878183
Ref: ビルドならびに C API の変更<2>-Footnote-51878248
Ref: ビルドならびに C API の変更<2>-Footnote-61878312
Ref: ビルドならびに C API の変更<2>-Footnote-71878377
Ref: ビルドならびに C API の変更<2>-Footnote-81878442
Ref: ビルドならびに C API の変更<2>-Footnote-91878507
Ref: ビルドならびに C API の変更<2>-Footnote-101878572
Node: その他の改善1878638
Ref: whatsnew/3 6 other-improvements1878788
Ref: 10d81878788
Node: 非推奨<10>1879167
Ref: whatsnew/3 6 deprecated1879287
Ref: 10da1879287
Node: 新たなキーワード1879665
Ref: whatsnew/3 6 new-keywords1879774
Ref: 10db1879774
Ref: 新たなキーワード-Footnote-11880276
Node: 非推奨の Python 挙動1880318
Ref: whatsnew/3 6 deprecated-python-behavior1880498
Ref: 10dc1880498
Ref: 非推奨の Python 挙動-Footnote-11881712
Ref: 非推奨の Python 挙動-Footnote-21881777
Ref: 非推奨の Python 挙動-Footnote-31881842
Node: 非推奨の Python モジュール、関数、メソッド<2>1881907
Ref: whatsnew/3 6 deprecated-python-modules-functions-and-methods1882069
Ref: 10de1882069
Node: asynchat1882387
Ref: whatsnew/3 6 asynchat1882511
Ref: 10df1882511
Ref: asynchat-Footnote-11882697
Node: asyncore1882762
Ref: whatsnew/3 6 asyncore1882901
Ref: 10e01882901
Ref: asyncore-Footnote-11883087
Node: dbm<5>1883152
Ref: whatsnew/3 6 dbm1883295
Ref: 10e11883295
Ref: dbm<5>-Footnote-11883657
Node: distutils<6>1883722
Ref: whatsnew/3 6 id21883860
Ref: 10e21883860
Ref: distutils<6>-Footnote-11884192
Node: grp1884257
Ref: whatsnew/3 6 grp1884401
Ref: 10e31884401
Ref: grp-Footnote-11884610
Node: importlib<7>1884675
Ref: whatsnew/3 6 id31884813
Ref: 10e51884813
Node: os<12>1885447
Ref: whatsnew/3 6 id41885587
Ref: 10e81885587
Ref: os<12>-Footnote-11885883
Ref: os<12>-Footnote-21885948
Node: re<8>1886013
Ref: whatsnew/3 6 id51886148
Ref: 10e91886148
Ref: re<8>-Footnote-11886476
Node: ssl<10>1886541
Ref: whatsnew/3 6 id61886680
Ref: 10ea1886680
Ref: ssl<10>-Footnote-11887540
Ref: ssl<10>-Footnote-21887605
Ref: ssl<10>-Footnote-31887670
Node: tkinter<9>1887735
Ref: whatsnew/3 6 id71887876
Ref: 10eb1887876
Node: venv<7>1888032
Ref: whatsnew/3 6 id81888157
Ref: 10ec1888157
Ref: whatsnew/3 6 whatsnew36-venv1888157
Ref: 10ed1888157
Ref: venv<7>-Footnote-11888510
Node: xml<7>1888575
Ref: whatsnew/3 6 xml1888756
Ref: 10ee1888756
Ref: xml<7>-Footnote-11889062
Node: C API の非推奨の関数ならびに型<2>1889117
Ref: whatsnew/3 6 deprecated-functions-and-types-of-the-c-api1889272
Ref: 10ef1889272
Node: 非推奨のビルドオプション1889610
Ref: whatsnew/3 6 deprecated-build-options1889750
Ref: 10f11889750
Node: 削除<10>1890205
Ref: whatsnew/3 6 removed1890330
Ref: 10f21890330
Node: API と機能の削除<3>1890422
Ref: whatsnew/3 6 api-and-feature-removals1890494
Ref: 10f31890494
Ref: API と機能の削除<3>-Footnote-11892590
Ref: API と機能の削除<3>-Footnote-21892655
Node: Python 3 6 への移植1892733
Ref: whatsnew/3 6 porting-to-python-3-61892876
Ref: 10f61892876
Node: 'python' コマンドの挙動の変更1893307
Ref: whatsnew/3 6 changes-in-python-command-behavior1893438
Ref: 10f71893438
Ref: 'python' コマンドの挙動の変更-Footnote-11893912
Node: Python API の変更<9>1893977
Ref: whatsnew/3 6 changes-in-the-python-api1894136
Ref: 10f81894136
Ref: Python API の変更<9>-Footnote-11904303
Ref: Python API の変更<9>-Footnote-21904367
Ref: Python API の変更<9>-Footnote-31904409
Ref: Python API の変更<9>-Footnote-41904474
Ref: Python API の変更<9>-Footnote-51904539
Ref: Python API の変更<9>-Footnote-61904604
Ref: Python API の変更<9>-Footnote-71904669
Ref: Python API の変更<9>-Footnote-81904734
Ref: Python API の変更<9>-Footnote-91904799
Ref: Python API の変更<9>-Footnote-101904864
Ref: Python API の変更<9>-Footnote-111904930
Ref: Python API の変更<9>-Footnote-121904973
Ref: Python API の変更<9>-Footnote-131905039
Ref: Python API の変更<9>-Footnote-141905105
Ref: Python API の変更<9>-Footnote-151905171
Ref: Python API の変更<9>-Footnote-161905237
Ref: Python API の変更<9>-Footnote-171905302
Ref: Python API の変更<9>-Footnote-181905368
Ref: Python API の変更<9>-Footnote-191905434
Ref: Python API の変更<9>-Footnote-201905500
Node: C API の変更<13>1905566
Ref: whatsnew/3 6 changes-in-the-c-api1905724
Ref: 11071905724
Ref: C API の変更<13>-Footnote-11906364
Ref: C API の変更<13>-Footnote-21906429
Node: CPython バイトコードの変更<8>1906493
Ref: whatsnew/3 6 cpython-bytecode-changes1906619
Ref: 11091906619
Ref: CPython バイトコードの変更<8>-Footnote-11908259
Ref: CPython バイトコードの変更<8>-Footnote-21908324
Ref: CPython バイトコードの変更<8>-Footnote-31908389
Ref: CPython バイトコードの変更<8>-Footnote-41908454
Ref: CPython バイトコードの変更<8>-Footnote-51908519
Ref: CPython バイトコードの変更<8>-Footnote-61908584
Ref: CPython バイトコードの変更<8>-Footnote-71908649
Ref: CPython バイトコードの変更<8>-Footnote-81908714
Ref: CPython バイトコードの変更<8>-Footnote-91908779
Node: Notable changes in Python 3 6 21908844
Ref: whatsnew/3 6 notable-changes-in-python-3-6-21909008
Ref: 110f1909008
Node: New make regen-all build target1909174
Ref: whatsnew/3 6 new-make-regen-all-build-target1909316
Ref: 11101909316
Ref: New make regen-all build target-Footnote-11910107
Ref: New make regen-all build target-Footnote-21910175
Node: Removal of make touch build target1910240
Ref: whatsnew/3 6 removal-of-make-touch-build-target1910382
Ref: 11111910382
Ref: Removal of make touch build target-Footnote-11910821
Node: Notable changes in Python 3 6 41910886
Ref: whatsnew/3 6 notable-changes-in-python-3-6-41911058
Ref: 11121911058
Ref: Notable changes in Python 3 6 4-Footnote-11911433
Ref: Notable changes in Python 3 6 4-Footnote-21911498
Node: Notable changes in Python 3 6 51911563
Ref: whatsnew/3 6 notable-changes-in-python-3-6-51911735
Ref: 11131911735
Ref: Notable changes in Python 3 6 5-Footnote-11912040
Node: Notable changes in Python 3 6 71912105
Ref: whatsnew/3 6 notable-changes-in-python-3-6-71912278
Ref: 11141912278
Ref: Notable changes in Python 3 6 7-Footnote-11912789
Ref: Notable changes in Python 3 6 7-Footnote-21912844
Node: Notable changes in Python 3 6 101912909
Ref: whatsnew/3 6 notable-changes-in-python-3-6-101913083
Ref: 11151913083
Ref: Notable changes in Python 3 6 10-Footnote-11913648
Node: Notable changes in Python 3 6 131913713
Ref: whatsnew/3 6 notable-changes-in-python-3-6-131913888
Ref: 11161913888
Ref: Notable changes in Python 3 6 13-Footnote-11914610
Node: Notable changes in Python 3 6 141914675
Ref: whatsnew/3 6 notable-changes-in-python-3-6-141914809
Ref: 11171914809
Ref: Notable changes in Python 3 6 14-Footnote-11915728
Ref: Notable changes in Python 3 6 14-Footnote-21915783
Node: What's New In Python 3 51915838
Ref: whatsnew/3 5 doc1915985
Ref: 11181915985
Ref: whatsnew/3 5 translation-repo1915985
Ref: 11191915985
Ref: whatsnew/3 5 what-s-new-in-python-3-51915985
Ref: 111a1915985
Ref: What's New In Python 3 5-Footnote-11917054
Ref: What's New In Python 3 5-Footnote-21917114
Node: 概要 -- リリースハイライト<10>1917156
Ref: whatsnew/3 5 summary-release-highlights1917286
Ref: 111b1917286
Ref: 概要 -- リリースハイライト<10>-Footnote-11921958
Ref: 概要 -- リリースハイライト<10>-Footnote-21922022
Ref: 概要 -- リリースハイライト<10>-Footnote-31922087
Ref: 概要 -- リリースハイライト<10>-Footnote-41922152
Ref: 概要 -- リリースハイライト<10>-Footnote-51922217
Ref: 概要 -- リリースハイライト<10>-Footnote-61922282
Ref: 概要 -- リリースハイライト<10>-Footnote-71922347
Node: 新しい機能<15>1922412
Ref: whatsnew/3 5 new-features1922578
Ref: 112e1922578
Node: PEP 492 - コルーチン、 async と await 構文1923770
Ref: whatsnew/3 5 pep-492-coroutines-with-async-and-await-syntax1923935
Ref: 112f1923935
Ref: whatsnew/3 5 whatsnew-pep-4921923935
Ref: 111c1923935
Ref: PEP 492 - コルーチン、 async と await 構文-Footnote-11927347
Ref: PEP 492 - コルーチン、 async と await 構文-Footnote-21927389
Node: PEP 465 - 行列の乗算専用の中置演算子1927431
Ref: whatsnew/3 5 pep-465-a-dedicated-infix-operator-for-matrix-multiplication1927660
Ref: 11351927660
Ref: whatsnew/3 5 whatsnew-pep-4651927660
Ref: 111d1927660
Ref: PEP 465 - 行列の乗算専用の中置演算子-Footnote-11929129
Ref: PEP 465 - 行列の乗算専用の中置演算子-Footnote-21929171
Node: PEP 448 - 追加可能なアンパックへの一般化1929213
Ref: whatsnew/3 5 pep-448-additional-unpacking-generalizations1929466
Ref: 11391929466
Ref: whatsnew/3 5 whatsnew-pep-4481929466
Ref: 111e1929466
Ref: PEP 448 - 追加可能なアンパックへの一般化-Footnote-11930664
Ref: PEP 448 - 追加可能なアンパックへの一般化-Footnote-21930706
Node: PEP 461 - bytes および bytearray のパーセント書式化サポート1930748
Ref: whatsnew/3 5 pep-461-percent-formatting-support-for-bytes-and-bytearray1930974
Ref: 113d1930974
Ref: whatsnew/3 5 whatsnew-pep-4611930974
Ref: 11211930974
Ref: PEP 461 - bytes および bytearray のパーセント書式化サポート-Footnote-11932711
Ref: PEP 461 - bytes および bytearray のパーセント書式化サポート-Footnote-21932753
Node: PEP 484 - 型ヒント1932795
Ref: whatsnew/3 5 pep-484-type-hints1933051
Ref: 113f1933051
Ref: whatsnew/3 5 whatsnew-pep-4841933051
Ref: 111f1933051
Ref: PEP 484 - 型ヒント-Footnote-11934810
Ref: PEP 484 - 型ヒント-Footnote-21934852
Ref: PEP 484 - 型ヒント-Footnote-31934894
Ref: PEP 484 - 型ヒント-Footnote-41934924
Ref: PEP 484 - 型ヒント-Footnote-51934966
Node: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ1935008
Ref: whatsnew/3 5 pep-471-os-scandir-function-a-better-and-faster-directory-iterator1935251
Ref: 11401935251
Ref: whatsnew/3 5 whatsnew-pep-4711935251
Ref: 112a1935251
Ref: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ-Footnote-11936796
Ref: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ-Footnote-21936838
Node: PEP 475 EINTR で失敗したシステムコールの再試行1936880
Ref: whatsnew/3 5 pep-475-retry-system-calls-failing-with-eintr1937166
Ref: 11421937166
Ref: whatsnew/3 5 whatsnew-pep-4751937166
Ref: 11431937166
Ref: PEP 475 EINTR で失敗したシステムコールの再試行-Footnote-11940687
Ref: PEP 475 EINTR で失敗したシステムコールの再試行-Footnote-21940729
Node: PEP 479 ジェネレータ内の StopIteration の処理の変更1940771
Ref: whatsnew/3 5 pep-479-change-stopiteration-handling-inside-generators1941025
Ref: 11691941025
Ref: whatsnew/3 5 whatsnew-pep-4791941025
Ref: 10dd1941025
Ref: PEP 479 ジェネレータ内の StopIteration の処理の変更-Footnote-11943320
Ref: PEP 479 ジェネレータ内の StopIteration の処理の変更-Footnote-21943362
Node: PEP 485 近似的に等しいことを調べる関数1943404
Ref: whatsnew/3 5 pep-485-a-function-for-testing-approximate-equality1943656
Ref: 116b1943656
Ref: whatsnew/3 5 whatsnew-pep-4851943656
Ref: 116c1943656
Ref: PEP 485 近似的に等しいことを調べる関数-Footnote-11944844
Ref: PEP 485 近似的に等しいことを調べる関数-Footnote-21944886
Node: PEP 486 Python ランチャーが仮想環境を認識する1944928
Ref: whatsnew/3 5 pep-486-make-the-python-launcher-aware-of-virtual-environments1945148
Ref: 116f1945148
Ref: whatsnew/3 5 whatsnew-pep-4861945148
Ref: 11701945148
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-11945797
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-21945839
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-31945881
Node: PEP 488 PYO ファイルの廃止1945923
Ref: whatsnew/3 5 pep-488-elimination-of-pyo-files1946140
Ref: 11711946140
Ref: whatsnew/3 5 whatsnew-pep-4881946140
Ref: 11261946140
Ref: PEP 488 PYO ファイルの廃止-Footnote-11947273
Ref: PEP 488 PYO ファイルの廃止-Footnote-21947315
Node: PEP 489 拡張モジュールの多段階初期化1947357
Ref: whatsnew/3 5 pep-489-multi-phase-extension-module-initialization1947505
Ref: 11731947505
Ref: whatsnew/3 5 whatsnew-pep-4891947505
Ref: 11271947505
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-11948394
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-21948436
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-31948478
Node: その他の言語変更<9>1948520
Ref: whatsnew/3 5 other-language-changes1948672
Ref: 11741948672
Ref: その他の言語変更<9>-Footnote-11949931
Ref: その他の言語変更<9>-Footnote-21949996
Ref: その他の言語変更<9>-Footnote-31950061
Ref: その他の言語変更<9>-Footnote-41950126
Ref: その他の言語変更<9>-Footnote-51950191
Ref: その他の言語変更<9>-Footnote-61950256
Ref: その他の言語変更<9>-Footnote-71950321
Node: 新たなモジュール<9>1950386
Ref: whatsnew/3 5 new-modules1950552
Ref: 11761950552
Node: typing<13>1950662
Ref: whatsnew/3 5 typing1950754
Ref: 11771950754
Node: zipapp<2>1950968
Ref: whatsnew/3 5 whatsnew-zipapp1951060
Ref: 11201951060
Ref: whatsnew/3 5 zipapp1951060
Ref: 11781951060
Ref: zipapp<2>-Footnote-11951992
Ref: zipapp<2>-Footnote-21952034
Ref: zipapp<2>-Footnote-31952101
Ref: zipapp<2>-Footnote-41952166
Node: 改良されたモジュール<9>1952208
Ref: whatsnew/3 5 improved-modules1952392
Ref: 11791952392
Node: argparse<7>1954147
Ref: whatsnew/3 5 argparse1954248
Ref: 117a1954248
Ref: argparse<7>-Footnote-11954628
Node: asyncio<15>1954693
Ref: whatsnew/3 5 asyncio1954806
Ref: 117d1954806
Ref: asyncio<15>-Footnote-11958669
Ref: asyncio<15>-Footnote-21958734
Ref: asyncio<15>-Footnote-31958799
Node: bz21958844
Ref: whatsnew/3 5 bz21958949
Ref: 11861958949
Ref: bz2-Footnote-11959270
Node: cgi1959335
Ref: whatsnew/3 5 cgi1959437
Ref: 11881959437
Ref: cgi-Footnote-11959634
Node: cmath<2>1959699
Ref: whatsnew/3 5 cmath1959807
Ref: 11891959807
Ref: cmath<2>-Footnote-11960055
Node: コード1960120
Ref: whatsnew/3 5 code1960239
Ref: 118a1960239
Ref: コード-Footnote-11960558
Node: collections<6>1960623
Ref: whatsnew/3 5 collections1960752
Ref: 118c1960752
Ref: whatsnew/3 5 whatsnew-ordereddict1960795
Ref: 11281960795
Ref: collections<6>-Footnote-11962210
Ref: collections<6>-Footnote-21962275
Ref: collections<6>-Footnote-31962340
Ref: collections<6>-Footnote-41962405
Ref: collections<6>-Footnote-51962470
Node: collections abc<4>1962535
Ref: whatsnew/3 5 collections-abc1962668
Ref: 11961962668
Ref: collections abc<4>-Footnote-11963404
Ref: collections abc<4>-Footnote-21963469
Ref: collections abc<4>-Footnote-31963534
Ref: collections abc<4>-Footnote-41963599
Node: compileall<4>1963647
Ref: whatsnew/3 5 compileall1963787
Ref: 119c1963787
Ref: compileall<4>-Footnote-11964666
Ref: compileall<4>-Footnote-21964731
Ref: compileall<4>-Footnote-31964796
Node: concurrent futures<7>1964861
Ref: whatsnew/3 5 concurrent-futures1964998
Ref: 119f1964998
Ref: concurrent futures<7>-Footnote-11965500
Ref: concurrent futures<7>-Footnote-21965565
Node: configparser<5>1965630
Ref: whatsnew/3 5 configparser1965767
Ref: 11a01965767
Ref: configparser<5>-Footnote-11966746
Node: contextlib<6>1966811
Ref: whatsnew/3 5 contextlib1966933
Ref: 11a11966933
Ref: contextlib<6>-Footnote-11967624
Node: csv<4>1967689
Ref: whatsnew/3 5 csv1967805
Ref: 11a41967805
Ref: csv<4>-Footnote-11968053
Node: curses<5>1968118
Ref: whatsnew/3 5 curses1968227
Ref: 11a61968227
Ref: curses<5>-Footnote-11968520
Node: dbm<6>1968584
Ref: whatsnew/3 5 dbm1968697
Ref: 11aa1968697
Ref: dbm<6>-Footnote-11968902
Node: difflib<4>1968967
Ref: whatsnew/3 5 difflib1969083
Ref: 11ab1969083
Ref: difflib<4>-Footnote-11969623
Ref: difflib<4>-Footnote-21969687
Node: distutils<7>1969752
Ref: whatsnew/3 5 distutils1969872
Ref: 11ae1969872
Ref: distutils<7>-Footnote-11970325
Ref: distutils<7>-Footnote-21970389
Node: doctest<3>1970454
Ref: whatsnew/3 5 doctest1970572
Ref: 11af1970572
Ref: doctest<3>-Footnote-11970952
Node: email<5>1971017
Ref: whatsnew/3 5 email1971130
Ref: 11b21971130
Ref: email<5>-Footnote-11972248
Ref: email<5>-Footnote-21972313
Ref: email<5>-Footnote-31972378
Ref: email<5>-Footnote-41972437
Ref: email<5>-Footnote-51972496
Ref: email<5>-Footnote-61972561
Node: enum<8>1972626
Ref: whatsnew/3 5 enum1972744
Ref: 11b71972744
Ref: enum<8>-Footnote-11973182
Node: faulthandler<5>1973247
Ref: whatsnew/3 5 faulthandler1973369
Ref: 11b81973369
Ref: faulthandler<5>-Footnote-11973728
Node: functools<7>1973793
Ref: whatsnew/3 5 functools1973915
Ref: 11b91973915
Ref: whatsnew/3 5 whatsnew-lrucache1973956
Ref: 112b1973956
Ref: functools<7>-Footnote-11974206
Node: glob<4>1974271
Ref: whatsnew/3 5 glob1974385
Ref: 11ba1974385
Ref: glob<4>-Footnote-11974677
Node: gzip<4>1974742
Ref: whatsnew/3 5 gzip1974852
Ref: 11bb1974852
Ref: gzip<4>-Footnote-11975111
Node: heapq<2>1975176
Ref: whatsnew/3 5 heapq1975286
Ref: 11bc1975286
Ref: heapq<2>-Footnote-11975930
Node: http<3>1975995
Ref: whatsnew/3 5 http1976112
Ref: 11bf1976112
Ref: http<3>-Footnote-11976397
Node: http client<4>1976462
Ref: whatsnew/3 5 http-client1976590
Ref: 11c01976590
Ref: http client<4>-Footnote-11977339
Node: idlelib と IDLE<3>1977403
Ref: whatsnew/3 5 idlelib-and-idle1977534
Ref: 11c41977534
Node: imaplib<3>1978066
Ref: whatsnew/3 5 imaplib1978189
Ref: 11c51978189
Ref: imaplib<3>-Footnote-11979127
Ref: imaplib<3>-Footnote-21979191
Ref: imaplib<3>-Footnote-31979250
Ref: imaplib<3>-Footnote-41979309
Ref: imaplib<3>-Footnote-51979368
Ref: imaplib<3>-Footnote-61979433
Node: imghdr1979498
Ref: whatsnew/3 5 imghdr1979614
Ref: 11c81979614
Ref: imghdr-Footnote-11979904
Ref: imghdr-Footnote-21979936
Ref: imghdr-Footnote-31980001
Ref: imghdr-Footnote-41980044
Node: importlib<8>1980109
Ref: whatsnew/3 5 importlib1980225
Ref: 11c91980225
Ref: importlib<8>-Footnote-11981066
Ref: importlib<8>-Footnote-21981131
Ref: importlib<8>-Footnote-31981196
Node: inspect<9>1981261
Ref: whatsnew/3 5 inspect1981376
Ref: 11cc1981376
Ref: inspect<9>-Footnote-11982941
Ref: inspect<9>-Footnote-21983006
Ref: inspect<9>-Footnote-31983071
Ref: inspect<9>-Footnote-41983136
Ref: inspect<9>-Footnote-51983201
Ref: inspect<9>-Footnote-61983266
Ref: inspect<9>-Footnote-71983331
Ref: inspect<9>-Footnote-81983396
Node: io<7>1983461
Ref: whatsnew/3 5 io1983576
Ref: 11d21983576
Ref: io<7>-Footnote-11983877
Node: ipaddress<4>1983942
Ref: whatsnew/3 5 ipaddress1984054
Ref: 11d61984054
Ref: ipaddress<4>-Footnote-11985091
Ref: ipaddress<4>-Footnote-21985156
Node: json<4>1985221
Ref: whatsnew/3 5 json1985340
Ref: 11d81985340
Ref: json<4>-Footnote-11985843
Ref: json<4>-Footnote-21985908
Node: linecache<3>1985973
Ref: whatsnew/3 5 linecache1986089
Ref: 11da1986089
Ref: linecache<3>-Footnote-11986502
Node: locale<7>1986567
Ref: whatsnew/3 5 locale1986686
Ref: 11dc1986686
Ref: locale<7>-Footnote-11987254
Node: logging<6>1987319
Ref: whatsnew/3 5 logging1987430
Ref: 11de1987430
Ref: logging<6>-Footnote-11988407
Ref: logging<6>-Footnote-21988472
Node: lzma1988537
Ref: whatsnew/3 5 lzma1988647
Ref: 11e41988647
Ref: lzma-Footnote-11988912
Node: math<10>1988977
Ref: whatsnew/3 5 math1989095
Ref: 11e61989095
Ref: math<10>-Footnote-11989672
Ref: math<10>-Footnote-21989737
Ref: math<10>-Footnote-31989802
Node: multiprocessing<7>1989867
Ref: whatsnew/3 5 multiprocessing1989992
Ref: 11e71989992
Ref: multiprocessing<7>-Footnote-11990314
Node: operator<3>1990379
Ref: whatsnew/3 5 operator1990502
Ref: 11e91990502
Ref: operator<3>-Footnote-11990936
Ref: operator<3>-Footnote-21991001
Node: os<13>1991066
Ref: whatsnew/3 5 os1991182
Ref: 11ee1991182
Ref: os<13>-Footnote-11993232
Ref: os<13>-Footnote-21993297
Ref: os<13>-Footnote-31993362
Ref: os<13>-Footnote-41993427
Ref: os<13>-Footnote-51993492
Ref: os<13>-Footnote-61993557
Node: pathlib<14>1993622
Ref: whatsnew/3 5 pathlib1993736
Ref: 11f41993736
Ref: pathlib<14>-Footnote-11995215
Ref: pathlib<14>-Footnote-21995280
Ref: pathlib<14>-Footnote-31995345
Ref: pathlib<14>-Footnote-41995410
Ref: pathlib<14>-Footnote-51995475
Node: pickle<5>1995540
Ref: whatsnew/3 5 pickle1995657
Ref: 11fb1995657
Ref: pickle<5>-Footnote-11995975
Node: poplib<2>1996040
Ref: whatsnew/3 5 poplib1996151
Ref: 11fc1996151
Ref: poplib<2>-Footnote-11996396
Ref: poplib<2>-Footnote-21996455
Node: re<9>1996520
Ref: whatsnew/3 5 re1996633
Ref: 11fe1996633
Ref: re<9>-Footnote-11997876
Ref: re<9>-Footnote-21997940
Ref: re<9>-Footnote-31998005
Ref: re<9>-Footnote-41998072
Node: readline<2>1998137
Ref: whatsnew/3 5 readline1998250
Ref: 12041998250
Ref: readline<2>-Footnote-11998516
Node: selectors1998581
Ref: whatsnew/3 5 selectors1998698
Ref: 12061998698
Ref: selectors-Footnote-11998920
Node: shutil<6>1998985
Ref: whatsnew/3 5 shutil1999100
Ref: 12071999100
Ref: shutil<6>-Footnote-11999581
Ref: shutil<6>-Footnote-21999646
Node: signal<3>1999710
Ref: whatsnew/3 5 signal1999824
Ref: 12081999824
Ref: signal<3>-Footnote-12000334
Ref: signal<3>-Footnote-22000399
Node: smtpd<2>2000464
Ref: whatsnew/3 5 smtpd2000579
Ref: 12092000579
Ref: smtpd<2>-Footnote-12002217
Ref: smtpd<2>-Footnote-22002282
Ref: smtpd<2>-Footnote-32002341
Ref: smtpd<2>-Footnote-42002406
Ref: smtpd<2>-Footnote-52002465
Ref: smtpd<2>-Footnote-62002530
Node: smtplib<2>2002595
Ref: whatsnew/3 5 smtplib2002707
Ref: 120a2002707
Ref: smtplib<2>-Footnote-12003334
Ref: smtplib<2>-Footnote-22003399
Ref: smtplib<2>-Footnote-32003464
Ref: smtplib<2>-Footnote-42003523
Node: sndhdr2003588
Ref: whatsnew/3 5 sndhdr2003702
Ref: 120f2003702
Ref: sndhdr-Footnote-12003907
Node: socket<10>2003972
Ref: whatsnew/3 5 socket2004083
Ref: 12102004083
Ref: socket<10>-Footnote-12005059
Ref: socket<10>-Footnote-22005124
Ref: socket<10>-Footnote-32005189
Ref: socket<10>-Footnote-42005254
Node: ssl<11>2005319
Ref: whatsnew/3 5 ssl2005435
Ref: 12142005435
Node: メモリ BIO サポート2005579
Ref: whatsnew/3 5 memory-bio-support2005704
Ref: 12152005704
Ref: whatsnew/3 5 whatsnew-sslmemorybio2005704
Ref: 11292005704
Ref: メモリ BIO サポート-Footnote-12006593
Node: Application-Layer Protocol Negotiation Support2006658
Ref: whatsnew/3 5 application-layer-protocol-negotiation-support2006810
Ref: 12172006810
Ref: Application-Layer Protocol Negotiation Support-Footnote-12007520
Ref: Application-Layer Protocol Negotiation Support-Footnote-22007585
Node: その他の変更2007644
Ref: whatsnew/3 5 other-changes2007761
Ref: 121b2007761
Ref: その他の変更-Footnote-12009359
Ref: その他の変更-Footnote-22009424
Ref: その他の変更-Footnote-32009489
Ref: その他の変更-Footnote-42009554
Ref: その他の変更-Footnote-52009613
Ref: その他の変更-Footnote-62009678
Ref: その他の変更-Footnote-72009743
Ref: その他の変更-Footnote-82009808
Node: sqlite3<10>2009873
Ref: whatsnew/3 5 sqlite32009992
Ref: 12242009992
Ref: sqlite3<10>-Footnote-12010324
Ref: sqlite3<10>-Footnote-22010389
Node: subprocess<5>2010454
Ref: whatsnew/3 5 subprocess2010573
Ref: 12262010573
Ref: whatsnew/3 5 whatsnew-subprocess2010573
Ref: 112c2010573
Ref: subprocess<5>-Footnote-12011670
Node: sys<13>2011735
Ref: whatsnew/3 5 sys2011855
Ref: 12282011855
Ref: sys<13>-Footnote-12012507
Ref: sys<13>-Footnote-22012572
Node: sysconfig<5>2012637
Ref: whatsnew/3 5 sysconfig2012754
Ref: 12292012754
Ref: sysconfig<5>-Footnote-12012989
Node: tarfile<9>2013054
Ref: whatsnew/3 5 tarfile2013176
Ref: 122a2013176
Ref: tarfile<9>-Footnote-12014113
Ref: tarfile<9>-Footnote-22014178
Ref: tarfile<9>-Footnote-32014243
Node: threading<9>2014308
Ref: whatsnew/3 5 threading2014425
Ref: 122e2014425
Ref: threading<9>-Footnote-12014719
Node: time<7>2014784
Ref: whatsnew/3 5 time2014900
Ref: 12302014900
Ref: time<7>-Footnote-12015099
Node: timeit<3>2015164
Ref: whatsnew/3 5 timeit2015279
Ref: 12312015279
Ref: timeit<3>-Footnote-12015829
Ref: timeit<3>-Footnote-22015894
Node: tkinter<10>2015958
Ref: whatsnew/3 5 tkinter2016078
Ref: 12332016078
Ref: tkinter<10>-Footnote-12016412
Node: traceback<5>2016477
Ref: whatsnew/3 5 traceback2016596
Ref: 12342016596
Ref: whatsnew/3 5 whatsnew-traceback2016596
Ref: 112d2016596
Ref: traceback<5>-Footnote-12017196
Ref: traceback<5>-Footnote-22017261
Ref: traceback<5>-Footnote-32017326
Node: types<8>2017391
Ref: whatsnew/3 5 types2017514
Ref: 123b2017514
Ref: types<8>-Footnote-12018062
Ref: types<8>-Footnote-22018127
Node: unicodedata<10>2018192
Ref: whatsnew/3 5 unicodedata2018315
Ref: 123e2018315
Ref: unicodedata<10>-Footnote-12018469
Node: unittest<10>2018520
Ref: whatsnew/3 5 unittest2018651
Ref: 123f2018651
Ref: unittest<10>-Footnote-12019448
Ref: unittest<10>-Footnote-22019513
Ref: unittest<10>-Footnote-32019578
Node: unittest mock<3>2019643
Ref: whatsnew/3 5 unittest-mock2019768
Ref: 12412019768
Ref: unittest mock<3>-Footnote-12020727
Ref: unittest mock<3>-Footnote-22020792
Ref: unittest mock<3>-Footnote-32020857
Ref: unittest mock<3>-Footnote-42020922
Ref: unittest mock<3>-Footnote-52020987
Ref: unittest mock<3>-Footnote-62021052
Node: urllib<4>2021117
Ref: whatsnew/3 5 urllib2021237
Ref: 12472021237
Ref: urllib<4>-Footnote-12022402
Ref: urllib<4>-Footnote-22022467
Ref: urllib<4>-Footnote-32022531
Ref: urllib<4>-Footnote-42022596
Ref: urllib<4>-Footnote-52022661
Ref: urllib<4>-Footnote-62022720
Ref: urllib<4>-Footnote-72022779
Ref: urllib<4>-Footnote-82022838
Node: wsgiref2022903
Ref: whatsnew/3 5 wsgiref2023016
Ref: 124b2023016
Ref: wsgiref-Footnote-12023257
Node: xmlrpc<2>2023321
Ref: whatsnew/3 5 xmlrpc2023432
Ref: 124d2023432
Ref: xmlrpc<2>-Footnote-12023905
Ref: xmlrpc<2>-Footnote-22023970
Node: xml sax2024035
Ref: whatsnew/3 5 xml-sax2024149
Ref: 124e2024149
Ref: xml sax-Footnote-12024560
Ref: xml sax-Footnote-22024624
Node: zipfile<5>2024689
Ref: whatsnew/3 5 zipfile2024785
Ref: 12512024785
Ref: zipfile<5>-Footnote-12025159
Ref: zipfile<5>-Footnote-22025224
Node: その他のモジュールレベルの変更2025289
Ref: whatsnew/3 5 other-module-level-changes2025459
Ref: 12522025459
Ref: その他のモジュールレベルの変更-Footnote-12025811
Node: 最適化<10>2025876
Ref: whatsnew/3 5 optimizations2026053
Ref: 12532026053
Ref: 最適化<10>-Footnote-12029287
Ref: 最適化<10>-Footnote-22029352
Ref: 最適化<10>-Footnote-32029417
Ref: 最適化<10>-Footnote-42029482
Ref: 最適化<10>-Footnote-52029547
Ref: 最適化<10>-Footnote-62029612
Ref: 最適化<10>-Footnote-72029677
Ref: 最適化<10>-Footnote-82029742
Ref: 最適化<10>-Footnote-92029807
Ref: 最適化<10>-Footnote-102029872
Ref: 最適化<10>-Footnote-112029938
Ref: 最適化<10>-Footnote-122030004
Ref: 最適化<10>-Footnote-132030070
Ref: 最適化<10>-Footnote-142030136
Ref: 最適化<10>-Footnote-152030202
Ref: 最適化<10>-Footnote-162030268
Ref: 最適化<10>-Footnote-172030334
Ref: 最適化<10>-Footnote-182030400
Ref: 最適化<10>-Footnote-192030466
Ref: 最適化<10>-Footnote-202030532
Node: ビルドならびに C API の変更<3>2030598
Ref: whatsnew/3 5 build-and-c-api-changes2030743
Ref: 12602030743
Ref: ビルドならびに C API の変更<3>-Footnote-12035209
Ref: ビルドならびに C API の変更<3>-Footnote-22035274
Ref: ビルドならびに C API の変更<3>-Footnote-32035339
Ref: ビルドならびに C API の変更<3>-Footnote-42035404
Ref: ビルドならびに C API の変更<3>-Footnote-52035469
Ref: ビルドならびに C API の変更<3>-Footnote-62035534
Ref: ビルドならびに C API の変更<3>-Footnote-72035576
Ref: ビルドならびに C API の変更<3>-Footnote-82035641
Ref: ビルドならびに C API の変更<3>-Footnote-92035706
Ref: ビルドならびに C API の変更<3>-Footnote-102035748
Node: 非推奨<11>2035854
Ref: whatsnew/3 5 deprecated2035996
Ref: 12692035996
Node: 新たなキーワード<2>2036354
Ref: whatsnew/3 5 new-keywords2036472
Ref: 126a2036472
Ref: 新たなキーワード<2>-Footnote-12036844
Node: 非推奨の Python の挙動<2>2036886
Ref: whatsnew/3 5 deprecated-python-behavior2037073
Ref: 126b2037073
Node: サポートされないオペレーティングシステム2037550
Ref: whatsnew/3 5 unsupported-operating-systems2037772
Ref: 126c2037772
Ref: サポートされないオペレーティングシステム-Footnote-12038124
Node: 非推奨の Python モジュール、関数、メソッド<3>2038166
Ref: whatsnew/3 5 deprecated-python-modules-functions-and-methods2038347
Ref: 126d2038347
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-12041601
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-22041666
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-32041730
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-42041795
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-52041860
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-62041925
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-72041990
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-82042055
Node: 削除<11>2042120
Ref: whatsnew/3 5 removed2042245
Ref: 12722042245
Node: API と機能の削除<4>2042337
Ref: whatsnew/3 5 api-and-feature-removals2042409
Ref: 12732042409
Ref: API と機能の削除<4>-Footnote-12043422
Ref: API と機能の削除<4>-Footnote-22043486
Node: Python 3 5 への移植2043551
Ref: whatsnew/3 5 porting-to-python-3-52043694
Ref: 12742043694
Node: Python の挙動の変更<3>2044062
Ref: whatsnew/3 5 changes-in-python-behavior2044183
Ref: 12752044183
Node: Python API の変更<10>2044959
Ref: whatsnew/3 5 changes-in-the-python-api2045108
Ref: 12762045108
Ref: Python API の変更<10>-Footnote-12054265
Ref: Python API の変更<10>-Footnote-22054307
Ref: Python API の変更<10>-Footnote-32054372
Ref: Python API の変更<10>-Footnote-42054437
Ref: Python API の変更<10>-Footnote-52054502
Ref: Python API の変更<10>-Footnote-62054567
Ref: Python API の変更<10>-Footnote-72054632
Ref: Python API の変更<10>-Footnote-82054697
Ref: Python API の変更<10>-Footnote-92054750
Ref: Python API の変更<10>-Footnote-102054815
Ref: Python API の変更<10>-Footnote-112054881
Ref: Python API の変更<10>-Footnote-122054947
Ref: Python API の変更<10>-Footnote-132055013
Ref: Python API の変更<10>-Footnote-142055073
Ref: Python API の変更<10>-Footnote-152055138
Ref: Python API の変更<10>-Footnote-162055181
Ref: Python API の変更<10>-Footnote-172055241
Ref: Python API の変更<10>-Footnote-182055307
Ref: Python API の変更<10>-Footnote-192055373
Ref: Python API の変更<10>-Footnote-202055439
Node: C API の変更<14>2055504
Ref: whatsnew/3 5 changes-in-the-c-api2055616
Ref: 127e2055616
Ref: C API の変更<14>-Footnote-12056922
Ref: C API の変更<14>-Footnote-22056987
Ref: C API の変更<14>-Footnote-32057052
Node: Notable changes in Python 3 5 42057094
Ref: whatsnew/3 5 notable-changes-in-python-3-5-42057218
Ref: 12822057218
Node: New make regen-all build target<2>2057457
Ref: whatsnew/3 5 new-make-regen-all-build-target2057605
Ref: 12832057605
Ref: New make regen-all build target<2>-Footnote-12058396
Ref: New make regen-all build target<2>-Footnote-22058464
Node: Removal of make touch build target<2>2058529
Ref: whatsnew/3 5 removal-of-make-touch-build-target2058677
Ref: 12842058677
Ref: Removal of make touch build target<2>-Footnote-12059116
Node: What's New In Python 3 42059181
Ref: whatsnew/3 4 doc2059328
Ref: 12852059328
Ref: whatsnew/3 4 translation-repo2059328
Ref: 12862059328
Ref: whatsnew/3 4 what-s-new-in-python-3-42059328
Ref: 12872059328
Ref: What's New In Python 3 4-Footnote-12060198
Ref: What's New In Python 3 4-Footnote-22060257
Node: 概要 -- リリースハイライト<11>2060299
Ref: whatsnew/3 4 summary-release-highlights2060429
Ref: 12882060429
Ref: 概要 -- リリースハイライト<11>-Footnote-12065883
Ref: 概要 -- リリースハイライト<11>-Footnote-22065925
Ref: 概要 -- リリースハイライト<11>-Footnote-32065967
Ref: 概要 -- リリースハイライト<11>-Footnote-42066032
Ref: 概要 -- リリースハイライト<11>-Footnote-52066074
Ref: 概要 -- リリースハイライト<11>-Footnote-62066139
Ref: 概要 -- リリースハイライト<11>-Footnote-72066181
Ref: 概要 -- リリースハイライト<11>-Footnote-82066223
Ref: 概要 -- リリースハイライト<11>-Footnote-92066265
Ref: 概要 -- リリースハイライト<11>-Footnote-102066307
Ref: 概要 -- リリースハイライト<11>-Footnote-112066350
Ref: 概要 -- リリースハイライト<11>-Footnote-122066393
Ref: 概要 -- リリースハイライト<11>-Footnote-132066436
Ref: 概要 -- リリースハイライト<11>-Footnote-142066479
Ref: 概要 -- リリースハイライト<11>-Footnote-152066522
Ref: 概要 -- リリースハイライト<11>-Footnote-162066587
Ref: 概要 -- リリースハイライト<11>-Footnote-172066653
Ref: 概要 -- リリースハイライト<11>-Footnote-182066696
Ref: 概要 -- リリースハイライト<11>-Footnote-192066739
Ref: 概要 -- リリースハイライト<11>-Footnote-202066805
Ref: 概要 -- リリースハイライト<11>-Footnote-212066851
Ref: 概要 -- リリースハイライト<11>-Footnote-222066894
Ref: 概要 -- リリースハイライト<11>-Footnote-232066937
Ref: 概要 -- リリースハイライト<11>-Footnote-242067003
Ref: 概要 -- リリースハイライト<11>-Footnote-252067046
Node: 新しい機能<16>2067089
Ref: whatsnew/3 4 new-features2067256
Ref: 12a32067256
Node: PEP 453 Python インストール時の PIP の明示的なブートストラッピング2067845
Ref: whatsnew/3 4 pep-453-explicit-bootstrapping-of-pip-in-python-installations2068064
Ref: 12a42068064
Ref: whatsnew/3 4 whatsnew-pep-4532068064
Ref: 12892068064
Node: デフォルトでの pip のブートストラッピング2068348
Ref: whatsnew/3 4 bootstrapping-pip-by-default2068569
Ref: 12a52068569
Ref: デフォルトでの pip のブートストラッピング-Footnote-12072413
Ref: デフォルトでの pip のブートストラッピング-Footnote-22072455
Node: ドキュメントの変更2072542
Ref: whatsnew/3 4 documentation-changes2072763
Ref: 12a82072763
Ref: ドキュメントの変更-Footnote-12073917
Ref: ドキュメントの変更-Footnote-22073954
Node: PEP 446 新規作成されたファイル記述子は継承不可2073996
Ref: whatsnew/3 4 pep-446-newly-created-file-descriptors-are-non-inheritable2074245
Ref: 12ac2074245
Ref: whatsnew/3 4 whatsnew-pep-4462074245
Ref: 128a2074245
Ref: PEP 446 新規作成されたファイル記述子は継承不可-Footnote-12075483
Ref: PEP 446 新規作成されたファイル記述子は継承不可-Footnote-22075525
Node: Codec 処理の改良2075567
Ref: whatsnew/3 4 codec-handling-improvements2075789
Ref: 128c2075789
Ref: whatsnew/3 4 improvements-to-codec-handling2075789
Ref: 12b42075789
Ref: Codec 処理の改良-Footnote-12081070
Ref: Codec 処理の改良-Footnote-22081148
Ref: Codec 処理の改良-Footnote-32081212
Ref: Codec 処理の改良-Footnote-42081277
Ref: Codec 処理の改良-Footnote-52081342
Node: PEP 451 インポートシステムのための ModuleSpec 型2081407
Ref: whatsnew/3 4 pep-451-a-modulespec-type-for-the-import-system2081592
Ref: 12b92081592
Ref: whatsnew/3 4 whatsnew-pep-4512081592
Ref: 128d2081592
Ref: PEP 451 インポートシステムのための ModuleSpec 型-Footnote-12082805
Ref: PEP 451 インポートシステムのための ModuleSpec 型-Footnote-22082847
Node: その他の言語変更<10>2082927
Ref: whatsnew/3 4 other-language-changes2083082
Ref: 12bb2083082
Ref: その他の言語変更<10>-Footnote-12086446
Ref: その他の言語変更<10>-Footnote-22086511
Ref: その他の言語変更<10>-Footnote-32086576
Ref: その他の言語変更<10>-Footnote-42086641
Ref: その他の言語変更<10>-Footnote-52086708
Ref: その他の言語変更<10>-Footnote-62086773
Ref: その他の言語変更<10>-Footnote-72086838
Ref: その他の言語変更<10>-Footnote-82086903
Ref: その他の言語変更<10>-Footnote-92086968
Ref: その他の言語変更<10>-Footnote-102087033
Ref: その他の言語変更<10>-Footnote-112087099
Ref: その他の言語変更<10>-Footnote-122087165
Ref: その他の言語変更<10>-Footnote-132087208
Node: 新たなモジュール<10>2087274
Ref: whatsnew/3 4 new-modules2087434
Ref: 12c12087434
Node: asyncio<16>2087680
Ref: whatsnew/3 4 asyncio2087777
Ref: 12c22087777
Ref: whatsnew/3 4 whatsnew-asyncio2087777
Ref: 128f2087777
Ref: asyncio<16>-Footnote-12088686
Ref: asyncio<16>-Footnote-22088728
Ref: asyncio<16>-Footnote-32088770
Node: ensurepip<2>2088812
Ref: whatsnew/3 4 ensurepip2088925
Ref: 12c32088925
Ref: whatsnew/3 4 whatsnew-ensurepip2088925
Ref: 12902088925
Ref: ensurepip<2>-Footnote-12090696
Node: enum<9>2090738
Ref: whatsnew/3 4 enum2090851
Ref: 12c42090851
Ref: whatsnew/3 4 whatsnew-enum2090851
Ref: 12912090851
Ref: enum<9>-Footnote-12091529
Ref: enum<9>-Footnote-22091571
Node: pathlib<15>2091613
Ref: whatsnew/3 4 pathlib2091726
Ref: 12c52091726
Ref: whatsnew/3 4 whatsnew-pathlib2091726
Ref: 12922091726
Ref: pathlib<15>-Footnote-12092531
Node: selectors<2>2092573
Ref: whatsnew/3 4 selectors2092692
Ref: 12c62092692
Ref: whatsnew/3 4 whatsnew-selectors2092692
Ref: 12932092692
Ref: selectors<2>-Footnote-12093020
Node: statistics<6>2093062
Ref: whatsnew/3 4 statistics2093184
Ref: 12c72093184
Ref: whatsnew/3 4 whatsnew-statistics2093184
Ref: 12942093184
Ref: statistics<6>-Footnote-12093696
Ref: statistics<6>-Footnote-22093738
Node: tracemalloc<4>2093780
Ref: whatsnew/3 4 tracemalloc2093881
Ref: 12c82093881
Ref: whatsnew/3 4 whatsnew-tracemalloc2093881
Ref: 12952093881
Ref: tracemalloc<4>-Footnote-12094763
Ref: tracemalloc<4>-Footnote-22094805
Node: 改良されたモジュール<10>2094847
Ref: whatsnew/3 4 improved-modules2095014
Ref: 12c92095014
Node: abc2096418
Ref: whatsnew/3 4 abc2096508
Ref: 12ca2096508
Ref: abc-Footnote-12097220
Ref: abc-Footnote-22097285
Node: aifc<2>2097350
Ref: whatsnew/3 4 aifc2097460
Ref: 12ce2097460
Ref: aifc<2>-Footnote-12098070
Ref: aifc<2>-Footnote-22098135
Ref: aifc<2>-Footnote-32098200
Node: argparse<8>2098264
Ref: whatsnew/3 4 argparse2098378
Ref: 12cf2098378
Ref: argparse<8>-Footnote-12098679
Node: audioop2098744
Ref: whatsnew/3 4 audioop2098860
Ref: 12d02098860
Ref: audioop-Footnote-12099384
Ref: audioop-Footnote-22099449
Ref: audioop-Footnote-32099514
Node: base64<5>2099579
Ref: whatsnew/3 4 base642099698
Ref: 12d12099698
Ref: base64<5>-Footnote-12100689
Ref: base64<5>-Footnote-22100754
Node: collections<7>2100819
Ref: whatsnew/3 4 collections2100939
Ref: 12d32100939
Ref: collections<7>-Footnote-12101386
Node: colorsys2101451
Ref: whatsnew/3 4 colorsys2101575
Ref: 12d52101575
Ref: colorsys-Footnote-12101949
Ref: colorsys-Footnote-22102020
Node: contextlib<7>2102085
Ref: whatsnew/3 4 contextlib2102201
Ref: 12d62102201
Ref: contextlib<7>-Footnote-12103865
Ref: contextlib<7>-Footnote-22103930
Ref: contextlib<7>-Footnote-32103995
Node: dbm<7>2104060
Ref: whatsnew/3 4 dbm2104174
Ref: 12da2104174
Ref: dbm<7>-Footnote-12104588
Node: dis<5>2104653
Ref: whatsnew/3 4 dis2104764
Ref: 12dc2104764
Ref: dis<5>-Footnote-12108017
Ref: dis<5>-Footnote-22108082
Ref: dis<5>-Footnote-32108147
Ref: dis<5>-Footnote-42108212
Node: doctest<4>2108292
Ref: whatsnew/3 4 doctest2108405
Ref: 12e12108405
Ref: doctest<4>-Footnote-12109434
Ref: doctest<4>-Footnote-22109499
Ref: doctest<4>-Footnote-32109564
Node: email<6>2109628
Ref: whatsnew/3 4 email2109742
Ref: 12e52109742
Ref: whatsnew/3 4 whatsnew-email-contentmanager2111212
Ref: 12992111212
Ref: email<6>-Footnote-12112397
Ref: email<6>-Footnote-22112462
Ref: email<6>-Footnote-32112527
Ref: email<6>-Footnote-42112592
Node: filecmp2112657
Ref: whatsnew/3 4 filecmp2112773
Ref: 12ed2112773
Ref: filecmp-Footnote-12113557
Ref: filecmp-Footnote-22113622
Node: functools<8>2113687
Ref: whatsnew/3 4 functools2113800
Ref: 12f12113800
Ref: whatsnew/3 4 whatsnew-singledispatch2114356
Ref: 12962114356
Ref: functools<8>-Footnote-12115898
Ref: functools<8>-Footnote-22115962
Ref: functools<8>-Footnote-32116004
Ref: functools<8>-Footnote-42116069
Node: gc<8>2116134
Ref: whatsnew/3 4 gc2116247
Ref: 12f32116247
Ref: gc<8>-Footnote-12116538
Node: glob<5>2116603
Ref: whatsnew/3 4 glob2116714
Ref: 12f42116714
Ref: glob<5>-Footnote-12117057
Node: hashlib<7>2117121
Ref: whatsnew/3 4 hashlib2117234
Ref: 12f62117234
Ref: hashlib<7>-Footnote-12118071
Ref: hashlib<7>-Footnote-22118116
Ref: hashlib<7>-Footnote-32118181
Node: hmac<4>2118246
Ref: whatsnew/3 4 hmac2118356
Ref: 12f82118356
Ref: hmac<4>-Footnote-12119612
Ref: hmac<4>-Footnote-22119677
Ref: hmac<4>-Footnote-32119742
Ref: hmac<4>-Footnote-42119784
Node: html2119849
Ref: whatsnew/3 4 html2119956
Ref: 12fd2119956
Ref: html-Footnote-12120841
Ref: html-Footnote-22120905
Ref: html-Footnote-32120970
Node: http<4>2121035
Ref: whatsnew/3 4 http2121154
Ref: 12fe2121154
Ref: http<4>-Footnote-12122332
Ref: http<4>-Footnote-22122397
Node: idlelib と IDLE<4>2122462
Ref: whatsnew/3 4 idlelib-and-idle2122589
Ref: 13012122589
Node: importlib<9>2123121
Ref: whatsnew/3 4 importlib2123252
Ref: 13022123252
Ref: importlib<9>-Footnote-12125652
Ref: importlib<9>-Footnote-22125717
Ref: importlib<9>-Footnote-32125782
Ref: importlib<9>-Footnote-42125847
Ref: importlib<9>-Footnote-52125912
Ref: importlib<9>-Footnote-62125977
Ref: importlib<9>-Footnote-72126042
Ref: importlib<9>-Footnote-82126084
Node: inspect<10>2126149
Ref: whatsnew/3 4 inspect2126273
Ref: 13092126273
Ref: inspect<10>-Footnote-12128695
Ref: inspect<10>-Footnote-22128760
Ref: inspect<10>-Footnote-32128825
Ref: inspect<10>-Footnote-42128890
Ref: inspect<10>-Footnote-52128955
Ref: inspect<10>-Footnote-62129020
Ref: inspect<10>-Footnote-72129085
Node: ipaddress<5>2129163
Ref: whatsnew/3 4 ipaddress2129285
Ref: 130d2129285
Ref: ipaddress<5>-Footnote-12130063
Node: logging<7>2130128
Ref: whatsnew/3 4 logging2130249
Ref: 130f2130249
Ref: logging<7>-Footnote-12131588
Ref: logging<7>-Footnote-22131652
Ref: logging<7>-Footnote-32131707
Ref: logging<7>-Footnote-42131772
Node: marshal<2>2131837
Ref: whatsnew/3 4 marshal2131953
Ref: 13152131953
Ref: whatsnew/3 4 whatsnew-marshal-32131953
Ref: 128e2131953
Ref: marshal<2>-Footnote-12132819
Ref: marshal<2>-Footnote-22132884
Node: mmap<4>2132949
Ref: whatsnew/3 4 mmap2133073
Ref: 13162133073
Ref: mmap<4>-Footnote-12133246
Node: multiprocessing<8>2133310
Ref: whatsnew/3 4 multiprocessing2133435
Ref: 13172133435
Ref: whatsnew/3 4 whatsnew-multiprocessing-no-fork2133488
Ref: 12982133488
Ref: multiprocessing<8>-Footnote-12135864
Ref: multiprocessing<8>-Footnote-22135928
Ref: multiprocessing<8>-Footnote-32135993
Ref: multiprocessing<8>-Footnote-42136057
Node: operator<4>2136122
Ref: whatsnew/3 4 operator2136246
Ref: 131b2136246
Ref: operator<4>-Footnote-12136857
Ref: operator<4>-Footnote-22136899
Ref: operator<4>-Footnote-32136964
Node: os<14>2137029
Ref: whatsnew/3 4 os2137141
Ref: 131d2137141
Ref: os<14>-Footnote-12138842
Ref: os<14>-Footnote-22138907
Ref: os<14>-Footnote-32138972
Ref: os<14>-Footnote-42139036
Node: pdb<9>2139101
Ref: whatsnew/3 4 pdb2139211
Ref: 13232139211
Ref: pdb<9>-Footnote-12140529
Ref: pdb<9>-Footnote-22140594
Node: pickle<6>2140659
Ref: whatsnew/3 4 pickle2140774
Ref: 13262140774
Ref: whatsnew/3 4 whatsnew-protocol-42140774
Ref: 12972140774
Ref: pickle<6>-Footnote-12141370
Node: plistlib<2>2141412
Ref: whatsnew/3 4 plistlib2141530
Ref: 13272141530
Ref: plistlib<2>-Footnote-12142067
Node: poplib<3>2142132
Ref: whatsnew/3 4 poplib2142250
Ref: 132a2142250
Ref: poplib<3>-Footnote-12142706
Node: pprint<5>2142770
Ref: whatsnew/3 4 pprint2142883
Ref: 132d2142883
Ref: pprint<5>-Footnote-12143620
Ref: pprint<5>-Footnote-22143685
Node: pty<2>2143750
Ref: whatsnew/3 4 pty2143862
Ref: 13302143862
Node: pydoc<5>2144095
Ref: whatsnew/3 4 pydoc2144204
Ref: 13322144204
Ref: pydoc<5>-Footnote-12145473
Ref: pydoc<5>-Footnote-22145538
Node: re<10>2145603
Ref: whatsnew/3 4 re2145717
Ref: 13332145717
Ref: re<10>-Footnote-12146535
Ref: re<10>-Footnote-22146600
Ref: re<10>-Footnote-32146665
Node: resource<2>2146730
Ref: whatsnew/3 4 resource2146842
Ref: 13382146842
Ref: resource<2>-Footnote-12147745
Ref: resource<2>-Footnote-22147810
Ref: resource<2>-Footnote-32147875
Node: select2147940
Ref: whatsnew/3 4 select2148055
Ref: 13412148055
Ref: select-Footnote-12148666
Ref: select-Footnote-22148731
Node: shelve<3>2148796
Ref: whatsnew/3 4 shelve2148909
Ref: 13482148909
Ref: shelve<3>-Footnote-12149247
Node: shutil<7>2149312
Ref: whatsnew/3 4 shutil2149427
Ref: 134a2149427
Ref: shutil<7>-Footnote-12149916
Node: smtpd<3>2149983
Ref: whatsnew/3 4 smtpd2150099
Ref: 134d2150099
Ref: smtpd<3>-Footnote-12150459
Node: smtplib<3>2150524
Ref: whatsnew/3 4 smtplib2150641
Ref: 134e2150641
Ref: smtplib<3>-Footnote-12151127
Node: socket<11>2151191
Ref: whatsnew/3 4 socket2151311
Ref: 13502151311
Ref: socket<11>-Footnote-12152249
Ref: socket<11>-Footnote-22152314
Node: sqlite3<11>2152378
Ref: whatsnew/3 4 sqlite32152495
Ref: 13542152495
Ref: sqlite3<11>-Footnote-12152897
Ref: sqlite3<11>-Footnote-22152937
Node: ssl<12>2153002
Ref: whatsnew/3 4 ssl2153113
Ref: 13552153113
Ref: whatsnew/3 4 whatsnew-tls-11-122153142
Ref: 129b2153142
Ref: whatsnew/3 4 whatsnew34-sslcontext2153472
Ref: 129e2153472
Ref: whatsnew/3 4 whatsnew34-win-cert-store2156726
Ref: 129c2156726
Ref: whatsnew/3 4 whatsnew34-sni2157080
Ref: 129d2157080
Ref: ssl<12>-Footnote-12157575
Ref: ssl<12>-Footnote-22157640
Ref: ssl<12>-Footnote-32157705
Ref: ssl<12>-Footnote-42157770
Ref: ssl<12>-Footnote-52157835
Ref: ssl<12>-Footnote-62157900
Ref: ssl<12>-Footnote-72157964
Ref: ssl<12>-Footnote-82158029
Ref: ssl<12>-Footnote-92158094
Ref: ssl<12>-Footnote-102158158
Node: stat2158224
Ref: whatsnew/3 4 stat2158333
Ref: 13672158333
Ref: stat-Footnote-12158808
Ref: stat-Footnote-22158873
Node: struct<3>2158938
Ref: whatsnew/3 4 struct2159053
Ref: 136c2159053
Ref: struct<3>-Footnote-12159488
Node: subprocess<6>2159553
Ref: whatsnew/3 4 subprocess2159672
Ref: 136f2159672
Ref: subprocess<6>-Footnote-12160232
Ref: subprocess<6>-Footnote-22160297
Node: sunau<2>2160362
Ref: whatsnew/3 4 sunau2160479
Ref: 13732160479
Ref: sunau<2>-Footnote-12161263
Ref: sunau<2>-Footnote-22161328
Ref: sunau<2>-Footnote-32161393
Ref: sunau<2>-Footnote-42161458
Node: sys<14>2161522
Ref: whatsnew/3 4 sys2161637
Ref: 13742161637
Ref: sys<14>-Footnote-12163271
Ref: sys<14>-Footnote-22163336
Node: tarfile<10>2163400
Ref: whatsnew/3 4 tarfile2163518
Ref: 13782163518
Ref: tarfile<10>-Footnote-12163939
Node: textwrap<2>2164004
Ref: whatsnew/3 4 textwrap2164128
Ref: 137a2164128
Ref: textwrap<2>-Footnote-12165006
Ref: textwrap<2>-Footnote-22165071
Node: threading<10>2165136
Ref: whatsnew/3 4 threading2165261
Ref: 137f2165261
Ref: threading<10>-Footnote-12165659
Node: traceback<6>2165724
Ref: whatsnew/3 4 traceback2165846
Ref: 13812165846
Ref: traceback<6>-Footnote-12166237
Node: types<9>2166304
Ref: whatsnew/3 4 types2166422
Ref: 13832166422
Ref: types<9>-Footnote-12166933
Node: urllib<5>2166998
Ref: whatsnew/3 4 urllib2167116
Ref: 13842167116
Ref: urllib<5>-Footnote-12168853
Ref: urllib<5>-Footnote-22168918
Ref: urllib<5>-Footnote-32168983
Ref: urllib<5>-Footnote-42169048
Ref: urllib<5>-Footnote-52169113
Ref: urllib<5>-Footnote-62169178
Node: unittest<11>2169243
Ref: whatsnew/3 4 unittest2169360
Ref: 138e2169360
Ref: unittest<11>-Footnote-12173387
Ref: unittest<11>-Footnote-22173452
Ref: unittest<11>-Footnote-32173517
Ref: unittest<11>-Footnote-42173582
Ref: unittest<11>-Footnote-52173647
Ref: unittest<11>-Footnote-62173712
Ref: unittest<11>-Footnote-72173777
Ref: unittest<11>-Footnote-82173842
Ref: unittest<11>-Footnote-92173907
Node: venv<8>2173972
Ref: whatsnew/3 4 venv2174087
Ref: 13962174087
Ref: venv<8>-Footnote-12174754
Ref: venv<8>-Footnote-22174819
Ref: venv<8>-Footnote-32174884
Node: wave<4>2174926
Ref: whatsnew/3 4 wave2175039
Ref: 13972175039
Ref: wave<4>-Footnote-12175831
Ref: wave<4>-Footnote-22175896
Ref: wave<4>-Footnote-32175961
Ref: wave<4>-Footnote-42176025
Node: weakref<2>2176089
Ref: whatsnew/3 4 weakref2176207
Ref: 139c2176207
Ref: weakref<2>-Footnote-12176990
Ref: weakref<2>-Footnote-22177055
Ref: weakref<2>-Footnote-32177120
Node: xml etree<2>2177185
Ref: whatsnew/3 4 xml-etree2177306
Ref: 13a02177306
Ref: xml etree<2>-Footnote-12178208
Ref: xml etree<2>-Footnote-22178273
Node: zipfile<6>2178338
Ref: whatsnew/3 4 zipfile2178440
Ref: 13a52178440
Ref: zipfile<6>-Footnote-12179115
Ref: zipfile<6>-Footnote-22179180
Node: CPython の実装の変更2179245
Ref: whatsnew/3 4 cpython-implementation-changes2179397
Ref: 13a82179397
Node: PEP 445 CPython のメモリアロケータのカスタマイズ2180069
Ref: whatsnew/3 4 pep-445-customization-of-cpython-memory-allocators2180276
Ref: 13a92180276
Ref: whatsnew/3 4 whatsnew-pep-4452180276
Ref: 12a12180276
Ref: PEP 445 CPython のメモリアロケータのカスタマイズ-Footnote-12180787
Ref: PEP 445 CPython のメモリアロケータのカスタマイズ-Footnote-22180829
Node: PEP 442 オブジェクトの安全なファイナライゼーション2180871
Ref: whatsnew/3 4 pep-442-safe-object-finalization2181155
Ref: 13aa2181155
Ref: whatsnew/3 4 whatsnew-pep-4422181155
Ref: 12a02181155
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-12182376
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-22182418
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-32182483
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-42182549
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-52182605
Node: PEP 456 安全で取り換え可能なハッシュアルゴリズム2182647
Ref: whatsnew/3 4 pep-456-secure-and-interchangeable-hash-algorithm2182890
Ref: 13ac2182890
Ref: whatsnew/3 4 whatsnew-pep-4562182890
Ref: 129a2182890
Ref: PEP 456 安全で取り換え可能なハッシュアルゴリズム-Footnote-12184137
Ref: PEP 456 安全で取り換え可能なハッシュアルゴリズム-Footnote-22184179
Node: PEP 436 Argument Clinic2184244
Ref: whatsnew/3 4 pep-436-argument-clinic2184462
Ref: 13ae2184462
Ref: whatsnew/3 4 whatsnew-pep-4362184462
Ref: 12a22184462
Ref: PEP 436 Argument Clinic-Footnote-12185988
Ref: PEP 436 Argument Clinic-Footnote-22186030
Node: その他のビルド並びに C API の変更2186072
Ref: whatsnew/3 4 other-build-and-c-api-changes2186243
Ref: 13af2186243
Ref: その他のビルド並びに C API の変更-Footnote-12188807
Ref: その他のビルド並びに C API の変更-Footnote-22188872
Ref: その他のビルド並びに C API の変更-Footnote-32188914
Ref: その他のビルド並びに C API の変更-Footnote-42188979
Ref: その他のビルド並びに C API の変更-Footnote-52189046
Ref: その他のビルド並びに C API の変更-Footnote-62189110
Ref: その他のビルド並びに C API の変更-Footnote-72189175
Ref: その他のビルド並びに C API の変更-Footnote-82189248
Ref: その他のビルド並びに C API の変更-Footnote-92189312
Ref: その他のビルド並びに C API の変更-Footnote-102189377
Node: その他の改善<2>2189443
Ref: whatsnew/3 4 other-improvements2189609
Ref: 13b32189609
Ref: whatsnew/3 4 other-improvements-3-42189609
Ref: 13b42189609
Ref: whatsnew/3 4 whatsnew-isolated-mode2189660
Ref: 128b2189660
Ref: その他の改善<2>-Footnote-12194646
Ref: その他の改善<2>-Footnote-22194711
Ref: その他の改善<2>-Footnote-32194775
Ref: その他の改善<2>-Footnote-42194840
Ref: その他の改善<2>-Footnote-52194905
Ref: その他の改善<2>-Footnote-62194970
Ref: その他の改善<2>-Footnote-72195035
Ref: その他の改善<2>-Footnote-82195130
Ref: その他の改善<2>-Footnote-92195181
Ref: その他の改善<2>-Footnote-102195246
Ref: その他の改善<2>-Footnote-112195312
Ref: その他の改善<2>-Footnote-122195366
Ref: その他の改善<2>-Footnote-132195432
Ref: その他の改善<2>-Footnote-142195498
Ref: その他の改善<2>-Footnote-152195541
Ref: その他の改善<2>-Footnote-162195607
Ref: その他の改善<2>-Footnote-172195673
Ref: その他の改善<2>-Footnote-182195739
Ref: その他の改善<2>-Footnote-192195805
Ref: その他の改善<2>-Footnote-202195848
Ref: その他の改善<2>-Footnote-212195914
Ref: その他の改善<2>-Footnote-222195980
Ref: その他の改善<2>-Footnote-232196046
Node: 大幅な最適化2196112
Ref: whatsnew/3 4 significant-optimizations2196223
Ref: 13b92196223
Ref: 大幅な最適化-Footnote-12199690
Ref: 大幅な最適化-Footnote-22199755
Ref: 大幅な最適化-Footnote-32199820
Ref: 大幅な最適化-Footnote-42199885
Ref: 大幅な最適化-Footnote-52199950
Ref: 大幅な最適化-Footnote-62200015
Ref: 大幅な最適化-Footnote-72200080
Ref: 大幅な最適化-Footnote-82200144
Ref: 大幅な最適化-Footnote-92200209
Ref: 大幅な最適化-Footnote-102200274
Ref: 大幅な最適化-Footnote-112200340
Ref: 大幅な最適化-Footnote-122200406
Ref: 大幅な最適化-Footnote-132200472
Node: 非推奨<12>2200538
Ref: whatsnew/3 4 deprecated2200666
Ref: 13bd2200666
Ref: whatsnew/3 4 deprecated-3-42200666
Ref: 12ba2200666
Node: Python API の非推奨項目2201204
Ref: whatsnew/3 4 deprecations-in-the-python-api2201310
Ref: 13be2201310
Node: 非推奨の機能2205562
Ref: whatsnew/3 4 deprecated-features2205668
Ref: 13c22205668
Ref: 非推奨の機能-Footnote-12206235
Ref: 非推奨の機能-Footnote-22206300
Node: 削除<12>2206365
Ref: whatsnew/3 4 removed2206490
Ref: 13c42206490
Node: サポートされなくなったオペレーティングシステム2206677
Ref: whatsnew/3 4 operating-systems-no-longer-supported2206827
Ref: 13c52206827
Ref: サポートされなくなったオペレーティングシステム-Footnote-12207290
Ref: サポートされなくなったオペレーティングシステム-Footnote-22207355
Ref: サポートされなくなったオペレーティングシステム-Footnote-32207410
Ref: サポートされなくなったオペレーティングシステム-Footnote-42207475
Node: API と機能の削除<5>2207540
Ref: whatsnew/3 4 api-and-feature-removals2207717
Ref: 13c62207717
Ref: API と機能の削除<5>-Footnote-12211624
Ref: API と機能の削除<5>-Footnote-22211660
Ref: API と機能の削除<5>-Footnote-32211718
Ref: API と機能の削除<5>-Footnote-42211769
Ref: API と機能の削除<5>-Footnote-52211834
Ref: API と機能の削除<5>-Footnote-62211899
Ref: API と機能の削除<5>-Footnote-72211964
Ref: API と機能の削除<5>-Footnote-82212029
Ref: API と機能の削除<5>-Footnote-92212093
Node: コードの整理2212158
Ref: whatsnew/3 4 code-cleanups2212257
Ref: 13c82212257
Ref: コードの整理-Footnote-12213073
Node: Python 3 4 への移植2213138
Ref: whatsnew/3 4 porting-to-python-3-42213265
Ref: 13c92213265
Node: 'python' コマンドの挙動の変更<2>2213659
Ref: whatsnew/3 4 changes-in-python-command-behavior2213794
Ref: 13ca2213794
Ref: 'python' コマンドの挙動の変更<2>-Footnote-12215231
Node: Python API の変更<11>2215296
Ref: whatsnew/3 4 changes-in-the-python-api2215459
Ref: 12bf2215459
Ref: Python API の変更<11>-Footnote-12233057
Ref: Python API の変更<11>-Footnote-22233122
Ref: Python API の変更<11>-Footnote-32233187
Ref: Python API の変更<11>-Footnote-42233252
Ref: Python API の変更<11>-Footnote-52233307
Ref: Python API の変更<11>-Footnote-62233372
Ref: Python API の変更<11>-Footnote-72233437
Ref: Python API の変更<11>-Footnote-82233502
Ref: Python API の変更<11>-Footnote-92233567
Ref: Python API の変更<11>-Footnote-102233632
Ref: Python API の変更<11>-Footnote-112233697
Ref: Python API の変更<11>-Footnote-122233763
Ref: Python API の変更<11>-Footnote-132233829
Ref: Python API の変更<11>-Footnote-142233895
Ref: Python API の変更<11>-Footnote-152233961
Ref: Python API の変更<11>-Footnote-162234027
Ref: Python API の変更<11>-Footnote-172234093
Ref: Python API の変更<11>-Footnote-182234159
Ref: Python API の変更<11>-Footnote-192234225
Ref: Python API の変更<11>-Footnote-202234291
Ref: Python API の変更<11>-Footnote-212234357
Ref: Python API の変更<11>-Footnote-222234423
Ref: Python API の変更<11>-Footnote-232234489
Ref: Python API の変更<11>-Footnote-242234555
Ref: Python API の変更<11>-Footnote-252234621
Ref: Python API の変更<11>-Footnote-262234686
Node: C API の変更<15>2234752
Ref: whatsnew/3 4 changes-in-the-c-api2234864
Ref: 13d92234864
Ref: C API の変更<15>-Footnote-12237015
Ref: C API の変更<15>-Footnote-22237080
Node: 3 4 3 の変更2237145
Ref: whatsnew/3 4 changed-in-3-4-32237253
Ref: 13df2237253
Node: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化2237516
Ref: whatsnew/3 4 pep-4762237669
Ref: 13e02237669
Ref: whatsnew/3 4 pep-476-enabling-certificate-verification-by-default-for-stdlib-http-clients2237669
Ref: 13e12237669
Node: What's New In Python 3 32238887
Ref: whatsnew/3 3 doc2239034
Ref: 13e22239034
Ref: whatsnew/3 3 translation-repo2239034
Ref: 13e32239034
Ref: whatsnew/3 3 what-s-new-in-python-3-32239034
Ref: 13e42239034
Ref: What's New In Python 3 3-Footnote-12241249
Ref: What's New In Python 3 3-Footnote-22241308
Node: 概要 -- リリースハイライト<12>2241350
Ref: whatsnew/3 3 summary-release-highlights2241481
Ref: 13e52241481
Node: PEP 405 仮想環境2243067
Ref: whatsnew/3 3 pep-4052243254
Ref: 13e72243254
Ref: whatsnew/3 3 pep-405-virtual-environments2243254
Ref: 13ef2243254
Ref: PEP 405 仮想環境-Footnote-12244458
Node: PEP 420 暗黙的な名前空間パッケージ2244500
Ref: whatsnew/3 3 pep-420-implicit-namespace-packages2244742
Ref: 13f02244742
Ref: PEP 420 暗黙的な名前空間パッケージ-Footnote-12245326
Ref: PEP 420 暗黙的な名前空間パッケージ-Footnote-22245368
Node: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント2245410
Ref: whatsnew/3 3 pep-3118-new-memoryview-implementation-and-buffer-protocol-documentation2245667
Ref: 13f12245667
Ref: whatsnew/3 3 pep-3118-update2245667
Ref: 13f22245667
Ref: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント-Footnote-12247300
Node: フィーチャー2247342
Ref: whatsnew/3 3 features2247515
Ref: 13f52247515
Ref: フィーチャー-Footnote-12248667
Node: API の変更2248732
Ref: whatsnew/3 3 api-changes2248905
Ref: 13fa2248905
Ref: API の変更-Footnote-12250345
Ref: API の変更-Footnote-22250410
Node: PEP 393 文字列の柔軟な表現2250452
Ref: whatsnew/3 3 pep-3932250701
Ref: 13ea2250701
Ref: whatsnew/3 3 pep-393-flexible-string-representation2250701
Ref: 14012250701
Ref: PEP 393 文字列の柔軟な表現-Footnote-12252153
Node: 機能性2252195
Ref: whatsnew/3 3 functionality2252321
Ref: 14022252321
Ref: 機能性-Footnote-12254218
Ref: 機能性-Footnote-22254260
Node: 性能およびリソース使用量2254325
Ref: whatsnew/3 3 performance-and-resource-usage2254451
Ref: 14042254451
Ref: 性能およびリソース使用量-Footnote-12256244
Node: PEP 397 Windows の Python ランチャ2256286
Ref: whatsnew/3 3 pep-3972256488
Ref: 14052256488
Ref: whatsnew/3 3 pep-397-python-launcher-for-windows2256488
Ref: 14062256488
Ref: PEP 397 Windows の Python ランチャ-Footnote-12258536
Ref: PEP 397 Windows の Python ランチャ-Footnote-22258600
Node: PEP 3151 OS および IO 例外階層の手直し2258642
Ref: whatsnew/3 3 pep-31512258859
Ref: 13e82258859
Ref: whatsnew/3 3 pep-3151-reworking-the-os-and-io-exception-hierarchy2258859
Ref: 14082258859
Ref: PEP 3151 OS および IO 例外階層の手直し-Footnote-12261526
Node: PEP 380 サブジェネレータへの委譲構文2261568
Ref: whatsnew/3 3 pep-3802261787
Ref: 13e62261787
Ref: whatsnew/3 3 pep-380-syntax-for-delegating-to-a-subgenerator2261787
Ref: 14162261787
Ref: PEP 380 サブジェネレータへの委譲構文-Footnote-12264712
Node: PEP 409 例外コンテキストの抑制2264754
Ref: whatsnew/3 3 pep-409-suppressing-exception-context2264971
Ref: 14192264971
Ref: PEP 409 例外コンテキストの抑制-Footnote-12267298
Node: PEP 414 明示的なユニコードリテラル2267340
Ref: whatsnew/3 3 pep-414-explicit-unicode-literals2267546
Ref: 141a2267546
Ref: PEP 414 明示的なユニコードリテラル-Footnote-12268433
Node: PEP 3155 クラスと関数の正規名2268475
Ref: whatsnew/3 3 pep-3155-qualified-name-for-classes-and-functions2268666
Ref: 141b2268666
Ref: PEP 3155 クラスと関数の正規名-Footnote-12270294
Node: PEP 412 キー共有辞書2270336
Ref: whatsnew/3 3 pep-4122270527
Ref: 13eb2270527
Ref: whatsnew/3 3 pep-412-key-sharing-dictionary2270527
Ref: 141e2270527
Ref: PEP 412 キー共有辞書-Footnote-12271072
Node: PEP 362 関数シグニチャオブジェクト2271114
Ref: whatsnew/3 3 pep-362-function-signature-object2271302
Ref: 141f2271302
Ref: PEP 362 関数シグニチャオブジェクト-Footnote-12272527
Node: PEP 421 sys implementation の追加2272569
Ref: whatsnew/3 3 pep-421-adding-sys-implementation2272784
Ref: 14212272784
Ref: PEP 421 sys implementation の追加-Footnote-12274337
Node: SimpleNamespace2274379
Ref: whatsnew/3 3 simplenamespace2274467
Ref: 14222274467
Ref: SimpleNamespace-Footnote-12275216
Node: インポート実装としての importlib の使用2275258
Ref: whatsnew/3 3 importlib2275454
Ref: 13e92275454
Ref: whatsnew/3 3 using-importlib-as-the-implementation-of-import2275454
Ref: 14232275454
Ref: インポート実装としての importlib の使用-Footnote-12277047
Ref: インポート実装としての importlib の使用-Footnote-22277111
Ref: インポート実装としての importlib の使用-Footnote-32277176
Ref: インポート実装としての importlib の使用-Footnote-42277241
Ref: インポート実装としての importlib の使用-Footnote-52277306
Node: 新たな API2277348
Ref: whatsnew/3 3 new-apis2277481
Ref: 14262277481
Node: 目に見える変化2279726
Ref: whatsnew/3 3 visible-changes2279859
Ref: 142d2279859
Ref: 目に見える変化-Footnote-12282471
Ref: 目に見える変化-Footnote-22282513
Node: その他の言語変更<11>2282555
Ref: whatsnew/3 3 other-language-changes2282751
Ref: 142e2282751
Ref: その他の言語変更<11>-Footnote-12285258
Ref: その他の言語変更<11>-Footnote-22285323
Ref: その他の言語変更<11>-Footnote-32285388
Ref: その他の言語変更<11>-Footnote-42285453
Ref: その他の言語変更<11>-Footnote-52285518
Ref: その他の言語変更<11>-Footnote-62285583
Ref: その他の言語変更<11>-Footnote-72285648
Ref: その他の言語変更<11>-Footnote-82285713
Node: 細粒度のインポートロック2285778
Ref: whatsnew/3 3 a-finer-grained-import-lock2285948
Ref: 14312285948
Ref: 細粒度のインポートロック-Footnote-12286825
Node: 組み込みの関数と型2286889
Ref: whatsnew/3 3 builtin-functions-and-types2287059
Ref: 14322287059
Ref: 組み込みの関数と型-Footnote-12288636
Node: 新たなモジュール<11>2288700
Ref: whatsnew/3 3 new-modules2288868
Ref: 14352288868
Node: faulthandler<6>2289014
Ref: whatsnew/3 3 faulthandler2289115
Ref: 14362289115
Node: ipaddress<6>2290096
Ref: whatsnew/3 3 ipaddress2290213
Ref: 143d2290213
Ref: ipaddress<6>-Footnote-12290669
Node: lzma<2>2290711
Ref: whatsnew/3 3 lzma2290804
Ref: 143e2290804
Ref: lzma<2>-Footnote-12291118
Node: 改良されたモジュール<11>2291182
Ref: whatsnew/3 3 improved-modules2291336
Ref: 143f2291336
Node: abc<2>2292696
Ref: whatsnew/3 3 abc2292790
Ref: 14402292790
Ref: abc<2>-Footnote-12294024
Ref: abc<2>-Footnote-22294089
Node: array<5>2294154
Ref: whatsnew/3 3 array2294266
Ref: 14462294266
Ref: array<5>-Footnote-12294500
Node: base64<6>2294567
Ref: whatsnew/3 3 base642294684
Ref: 14472294684
Ref: base64<6>-Footnote-12295092
Node: binascii<4>2295157
Ref: whatsnew/3 3 binascii2295272
Ref: 14482295272
Ref: binascii<4>-Footnote-12295581
Node: bz2<2>2295646
Ref: whatsnew/3 3 bz22295761
Ref: 14492295761
Ref: bz2<2>-Footnote-12296938
Ref: bz2<2>-Footnote-22297002
Node: codecs<2>2297066
Ref: whatsnew/3 3 codecs2297184
Ref: 144c2297184
Ref: codecs<2>-Footnote-12298985
Ref: codecs<2>-Footnote-22299050
Ref: codecs<2>-Footnote-32299115
Node: collections<8>2299180
Ref: whatsnew/3 3 collections2299305
Ref: 144d2299305
Ref: collections<8>-Footnote-12300253
Ref: collections<8>-Footnote-22300318
Ref: collections<8>-Footnote-32300383
Ref: collections<8>-Footnote-42300448
Node: contextlib<8>2300513
Ref: whatsnew/3 3 contextlib2300637
Ref: 144e2300637
Ref: contextlib<8>-Footnote-12301457
Node: crypt<2>2301522
Ref: whatsnew/3 3 crypt2301641
Ref: 144f2301641
Ref: crypt<2>-Footnote-12301845
Node: curses<6>2301910
Ref: whatsnew/3 3 curses2302027
Ref: 14502302027
Ref: curses<6>-Footnote-12303491
Ref: curses<6>-Footnote-22303556
Ref: curses<6>-Footnote-32303620
Node: datetime<8>2303685
Ref: whatsnew/3 3 datetime2303804
Ref: 14552303804
Ref: datetime<8>-Footnote-12304760
Node: decimal<4>2304825
Ref: whatsnew/3 3 decimal2304943
Ref: 14572304943
Ref: whatsnew/3 3 new-decimal2304943
Ref: 13ec2304943
Ref: decimal<4>-Footnote-12306696
Node: フィーチャー<2>2306760
Ref: whatsnew/3 3 id12306853
Ref: 14582306853
Node: API の変更<2>2307373
Ref: whatsnew/3 3 id22307466
Ref: 145d2307466
Node: email<7>2310890
Ref: whatsnew/3 3 email2311006
Ref: 146f2311006
Ref: whatsnew/3 3 new-email2311006
Ref: 13ed2311006
Node: ポリシーフレームワーク2311173
Ref: whatsnew/3 3 policy-framework2311310
Ref: 14702311310
Node: 新規ヘッダ API を伴った暫定ポリシー2315174
Ref: whatsnew/3 3 provisional-policy-with-new-header-api2315344
Ref: 14742315344
Node: その他のAPIの変更2320925
Ref: whatsnew/3 3 other-api-changes2321053
Ref: 147a2321053
Node: ftplib<3>2322232
Ref: whatsnew/3 3 ftplib2322350
Ref: 14802322350
Ref: ftplib<3>-Footnote-12323532
Ref: ftplib<3>-Footnote-22323596
Ref: ftplib<3>-Footnote-32323661
Node: functools<9>2323726
Ref: whatsnew/3 3 functools2323841
Ref: 14862323841
Ref: functools<9>-Footnote-12324285
Node: gc<9>2324350
Ref: whatsnew/3 3 gc2324463
Ref: 14872324463
Node: hmac<5>2324681
Ref: whatsnew/3 3 hmac2324789
Ref: 14892324789
Ref: hmac<5>-Footnote-12325118
Ref: hmac<5>-Footnote-22325176
Node: http<5>2325241
Ref: whatsnew/3 3 http2325351
Ref: 148b2325351
Ref: http<5>-Footnote-12326239
Ref: http<5>-Footnote-22326303
Ref: http<5>-Footnote-32326368
Node: html<2>2326433
Ref: whatsnew/3 3 html2326546
Ref: 14912326546
Ref: html<2>-Footnote-12327558
Ref: html<2>-Footnote-22327623
Ref: html<2>-Footnote-32327688
Ref: html<2>-Footnote-42327753
Ref: html<2>-Footnote-52327818
Ref: html<2>-Footnote-62327883
Ref: html<2>-Footnote-72327950
Ref: html<2>-Footnote-82328016
Ref: html<2>-Footnote-92328081
Ref: html<2>-Footnote-102328146
Ref: html<2>-Footnote-112328214
Ref: html<2>-Footnote-122328281
Ref: html<2>-Footnote-132328347
Ref: html<2>-Footnote-142328413
Ref: html<2>-Footnote-152328478
Ref: html<2>-Footnote-162328544
Node: imaplib<4>2328610
Ref: whatsnew/3 3 imaplib2328727
Ref: 14932328727
Ref: imaplib<4>-Footnote-12329042
Node: inspect<11>2329106
Ref: whatsnew/3 3 inspect2329221
Ref: 14942329221
Ref: inspect<11>-Footnote-12330229
Ref: inspect<11>-Footnote-22330294
Node: io<8>2330359
Ref: whatsnew/3 3 io2330476
Ref: 14972330476
Ref: io<8>-Footnote-12331161
Node: itertools<7>2331226
Ref: whatsnew/3 3 itertools2331342
Ref: 14982331342
Node: logging<8>2331542
Ref: whatsnew/3 3 logging2331661
Ref: 14992331661
Node: math<11>2332190
Ref: whatsnew/3 3 math2332304
Ref: 149b2332304
Ref: math<11>-Footnote-12332568
Node: mmap<5>2332633
Ref: whatsnew/3 3 mmap2332755
Ref: 149d2332755
Ref: mmap<5>-Footnote-12333166
Node: multiprocessing<9>2333231
Ref: whatsnew/3 3 multiprocessing2333355
Ref: 149f2333355
Ref: multiprocessing<9>-Footnote-12334789
Ref: multiprocessing<9>-Footnote-22334854
Ref: multiprocessing<9>-Footnote-32334918
Ref: multiprocessing<9>-Footnote-42334982
Node: nntplib<2>2335047
Ref: whatsnew/3 3 nntplib2335170
Ref: 14a82335170
Ref: nntplib<2>-Footnote-12335730
Node: os<15>2335794
Ref: whatsnew/3 3 os2335906
Ref: 14a92335906
Ref: os<15>-Footnote-12345093
Ref: os<15>-Footnote-22345158
Ref: os<15>-Footnote-32345222
Ref: os<15>-Footnote-42345287
Ref: os<15>-Footnote-52345352
Ref: os<15>-Footnote-62345417
Ref: os<15>-Footnote-72345481
Ref: os<15>-Footnote-82345546
Ref: os<15>-Footnote-92345611
Ref: os<15>-Footnote-102345676
Ref: os<15>-Footnote-112345741
Node: pdb<10>2345807
Ref: whatsnew/3 3 pdb2345918
Ref: 14e12345918
Ref: pdb<10>-Footnote-12346260
Node: pickle<7>2346325
Ref: whatsnew/3 3 pickle2346438
Ref: 14e22346438
Ref: pickle<7>-Footnote-12346757
Node: pydoc<6>2346822
Ref: whatsnew/3 3 pydoc2346934
Ref: 14e42346934
Node: re<11>2347133
Ref: whatsnew/3 3 re2347241
Ref: 14e52347241
Ref: re<11>-Footnote-12347465
Node: sched2347529
Ref: whatsnew/3 3 sched2347638
Ref: 14e62347638
Ref: sched-Footnote-12349416
Ref: sched-Footnote-22349481
Ref: sched-Footnote-32349545
Ref: sched-Footnote-42349610
Ref: sched-Footnote-52349675
Node: select<2>2349740
Ref: whatsnew/3 3 select2349851
Ref: 14eb2349851
Ref: select<2>-Footnote-12350227
Node: shlex<3>2350291
Ref: whatsnew/3 3 shlex2350406
Ref: 14ec2350406
Node: shutil<8>2350713
Ref: whatsnew/3 3 shutil2350828
Ref: 14ed2350828
Ref: shutil<8>-Footnote-12353404
Ref: shutil<8>-Footnote-22353469
Ref: shutil<8>-Footnote-32353534
Ref: shutil<8>-Footnote-42353599
Ref: shutil<8>-Footnote-52353664
Ref: shutil<8>-Footnote-62353729
Ref: shutil<8>-Footnote-72353794
Ref: shutil<8>-Footnote-82353858
Node: signal<4>2353922
Ref: whatsnew/3 3 signal2354037
Ref: 14f02354037
Ref: signal<4>-Footnote-12355537
Node: smtpd<4>2355601
Ref: whatsnew/3 3 smtpd2355717
Ref: 14f72355717
Ref: smtpd<4>-Footnote-12356200
Ref: smtpd<4>-Footnote-22356259
Ref: smtpd<4>-Footnote-32356318
Node: smtplib<4>2356382
Ref: whatsnew/3 3 smtplib2356499
Ref: 14f82356499
Ref: smtplib<4>-Footnote-12357471
Ref: smtplib<4>-Footnote-22357536
Ref: smtplib<4>-Footnote-32357601
Node: socket<12>2357665
Ref: whatsnew/3 3 socket2357789
Ref: 14fa2357789
Ref: socket<12>-Footnote-12359166
Ref: socket<12>-Footnote-22359230
Ref: socket<12>-Footnote-32359295
Ref: socket<12>-Footnote-42359384
Ref: socket<12>-Footnote-52359449
Node: socketserver<3>2359514
Ref: whatsnew/3 3 socketserver2359639
Ref: 14fd2359639
Ref: socketserver<3>-Footnote-12360122
Node: sqlite3<12>2360187
Ref: whatsnew/3 3 sqlite32360309
Ref: 15012360309
Ref: sqlite3<12>-Footnote-12360659
Node: ssl<13>2360724
Ref: whatsnew/3 3 ssl2360838
Ref: 15022360838
Ref: ssl<13>-Footnote-12363518
Ref: ssl<13>-Footnote-22363583
Ref: ssl<13>-Footnote-32363648
Ref: ssl<13>-Footnote-42363713
Ref: ssl<13>-Footnote-52363778
Ref: ssl<13>-Footnote-62363843
Ref: ssl<13>-Footnote-72363902
Ref: ssl<13>-Footnote-82363967
Ref: ssl<13>-Footnote-92364032
Ref: ssl<13>-Footnote-102364097
Ref: ssl<13>-Footnote-112364163
Ref: ssl<13>-Footnote-122364229
Node: stat<2>2364295
Ref: whatsnew/3 3 stat2364407
Ref: 150a2364407
Ref: stat<2>-Footnote-12364764
Node: struct<4>2364829
Ref: whatsnew/3 3 struct2364947
Ref: 150c2364947
Ref: struct<4>-Footnote-12365196
Node: subprocess<7>2365260
Ref: whatsnew/3 3 subprocess2365378
Ref: 150d2365378
Ref: subprocess<7>-Footnote-12365796
Ref: subprocess<7>-Footnote-22365860
Node: sys<15>2365924
Ref: whatsnew/3 3 sys2366044
Ref: 150f2366044
Ref: sys<15>-Footnote-12366325
Node: tarfile<11>2366390
Ref: whatsnew/3 3 tarfile2366508
Ref: 15112366508
Ref: tarfile<11>-Footnote-12366781
Node: tempfile<4>2366845
Ref: whatsnew/3 3 tempfile2366967
Ref: 15122366967
Ref: tempfile<4>-Footnote-12367194
Node: textwrap<3>2367258
Ref: whatsnew/3 3 textwrap2367382
Ref: 15132367382
Ref: textwrap<3>-Footnote-12367693
Node: threading<11>2367758
Ref: whatsnew/3 3 threading2367878
Ref: 15142367878
Ref: threading<11>-Footnote-12369094
Ref: threading<11>-Footnote-22369159
Node: time<8>2369223
Ref: whatsnew/3 3 time2369341
Ref: 151b2369341
Ref: time<8>-Footnote-12370526
Ref: time<8>-Footnote-22370568
Node: types<10>2370633
Ref: whatsnew/3 3 types2370750
Ref: 15202370750
Ref: types<10>-Footnote-12371140
Ref: types<10>-Footnote-22371205
Ref: types<10>-Footnote-32371247
Node: unittest<12>2371312
Ref: whatsnew/3 3 unittest2371431
Ref: 15232371431
Ref: unittest<12>-Footnote-12371967
Node: urllib<6>2372032
Ref: whatsnew/3 3 urllib2372155
Ref: 15262372155
Ref: urllib<6>-Footnote-12372597
Node: webbrowser<5>2372664
Ref: whatsnew/3 3 webbrowser2372799
Ref: 15282372799
Ref: webbrowser<5>-Footnote-12373394
Ref: webbrowser<5>-Footnote-22373459
Node: xml etree ElementTree<2>2373524
Ref: whatsnew/3 3 xml-etree-elementtree2373657
Ref: 15292373657
Node: zlib<4>2374176
Ref: whatsnew/3 3 zlib2374287
Ref: 152a2374287
Ref: zlib<4>-Footnote-12374763
Ref: zlib<4>-Footnote-22374828
Node: 最適化<11>2374893
Ref: whatsnew/3 3 optimizations2375059
Ref: 152d2375059
Ref: 最適化<11>-Footnote-12375989
Ref: 最適化<11>-Footnote-22376031
Ref: 最適化<11>-Footnote-32376096
Ref: 最適化<11>-Footnote-42376161
Node: ビルドならびに C API の変更<4>2376226
Ref: whatsnew/3 3 build-and-c-api-changes2376371
Ref: 13ff2376371
Ref: ビルドならびに C API の変更<4>-Footnote-12378355
Ref: ビルドならびに C API の変更<4>-Footnote-22378397
Ref: ビルドならびに C API の変更<4>-Footnote-32378439
Node: 非推奨<13>2378504
Ref: whatsnew/3 3 deprecated2378659
Ref: 15432378659
Node: サポートされないオペレーティングシステム<2>2379097
Ref: whatsnew/3 3 unsupported-operating-systems2379281
Ref: 15442379281
Node: 非推奨の Python モジュール、関数、メソッド<4>2379770
Ref: whatsnew/3 3 deprecated-python-modules-functions-and-methods2380008
Ref: 15452380008
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-12382870
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-22382934
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-32382976
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-42383041
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-52383106
Node: C API の非推奨の関数ならびに型<3>2383171
Ref: whatsnew/3 3 deprecated-functions-and-types-of-the-c-api2383367
Ref: 15492383367
Ref: C API の非推奨の関数ならびに型<3>-Footnote-12386418
Node: 非推奨の機能<2>2386460
Ref: whatsnew/3 3 deprecated-features2386585
Ref: 15532386585
Node: Python 3 3 への移植2386834
Ref: whatsnew/3 3 porting-to-python-3-32386940
Ref: 15542386940
Node: Python コードの移植2387286
Ref: whatsnew/3 3 porting-python-code2387400
Ref: 14252387400
Ref: whatsnew/3 3 portingpythoncode2387400
Ref: 15552387400
Ref: Python コードの移植-Footnote-12396478
Ref: Python コードの移植-Footnote-22396543
Ref: Python コードの移植-Footnote-32396608
Ref: Python コードの移植-Footnote-42396673
Ref: Python コードの移植-Footnote-52396715
Ref: Python コードの移植-Footnote-62396757
Ref: Python コードの移植-Footnote-72396821
Ref: Python コードの移植-Footnote-82396888
Ref: Python コードの移植-Footnote-92396953
Ref: Python コードの移植-Footnote-102397017
Node: C コードの移植2397083
Ref: whatsnew/3 3 porting-c-code2397226
Ref: 14002397226
Ref: C コードの移植-Footnote-12399012
Node: C 拡張のビルド2399054
Ref: whatsnew/3 3 building-c-extensions2399214
Ref: 15642399214
Ref: C 拡張のビルド-Footnote-12399913
Node: コマンドラインスイッチの変更2399978
Ref: whatsnew/3 3 command-line-switch-changes2400109
Ref: 15652400109
Ref: コマンドラインスイッチの変更-Footnote-12400858
Ref: コマンドラインスイッチの変更-Footnote-22400923
Node: What's New In Python 3 22400988
Ref: whatsnew/3 2 doc2401135
Ref: 15672401135
Ref: whatsnew/3 2 translation-repo2401135
Ref: 15682401135
Ref: whatsnew/3 2 what-s-new-in-python-3-22401135
Ref: 15692401135
Ref: What's New In Python 3 2-Footnote-12402740
Ref: What's New In Python 3 2-Footnote-22402839
Node: PEP 384 安定 ABI の定義2402881
Ref: whatsnew/3 2 pep-384-defining-a-stable-abi2403038
Ref: 156a2403038
Ref: PEP 384 安定 ABI の定義-Footnote-12404457
Node: PEP 389 argparse コマンドライン解析モジュール2404499
Ref: whatsnew/3 2 pep-389-argparse-command-line-parsing-module2404708
Ref: 156b2404708
Ref: PEP 389 argparse コマンドライン解析モジュール-Footnote-12409357
Node: PEP 391 logging の辞書ベースの設定2409399
Ref: whatsnew/3 2 pep-391-dictionary-based-configuration-for-logging2409623
Ref: 156d2409623
Ref: PEP 391 logging の辞書ベースの設定-Footnote-12412007
Node: PEP 3148 concurrent futures モジュール2412049
Ref: whatsnew/3 2 pep-3148-the-concurrent-futures-module2412263
Ref: 156f2412263
Ref: PEP 3148 concurrent futures モジュール-Footnote-12415948
Node: PEP 3147 PYC リポジトリーディレクトリ2415990
Ref: whatsnew/3 2 pep-3147-pyc-repository-directories2416229
Ref: 15732416229
Ref: PEP 3147 PYC リポジトリーディレクトリ-Footnote-12419910
Ref: PEP 3147 PYC リポジトリーディレクトリ-Footnote-22419981
Node: PEP 3149 ABI バージョンでタグ付けされた so ファイル2420023
Ref: whatsnew/3 2 pep-3149-abi-version-tagged-so-files2420270
Ref: 15752420270
Ref: PEP 3149 ABI バージョンでタグ付けされた so ファイル-Footnote-12421922
Node: PEP 3333 Python Web Server Gateway Interface v1 0 12421964
Ref: whatsnew/3 2 pep-3333-python-web-server-gateway-interface-v1-0-12422190
Ref: 15762422190
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-12425309
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-22425368
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-32425427
Node: その他の言語変更<12>2425469
Ref: whatsnew/3 2 other-language-changes2425714
Ref: 15782425714
Ref: その他の言語変更<12>-Footnote-12436099
Ref: その他の言語変更<12>-Footnote-22436163
Ref: その他の言語変更<12>-Footnote-32436227
Ref: その他の言語変更<12>-Footnote-42436294
Ref: その他の言語変更<12>-Footnote-52436358
Ref: その他の言語変更<12>-Footnote-62436422
Ref: その他の言語変更<12>-Footnote-72436486
Ref: その他の言語変更<12>-Footnote-82436550
Ref: その他の言語変更<12>-Footnote-92436614
Ref: その他の言語変更<12>-Footnote-102436678
Ref: その他の言語変更<12>-Footnote-112436744
Ref: その他の言語変更<12>-Footnote-122436811
Ref: その他の言語変更<12>-Footnote-132436876
Ref: その他の言語変更<12>-Footnote-142436941
Ref: その他の言語変更<12>-Footnote-152437007
Ref: その他の言語変更<12>-Footnote-162437073
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール2437138
Ref: whatsnew/3 2 new-improved-and-deprecated-modules2437362
Ref: 15852437362
Node: email<8>2439713
Ref: whatsnew/3 2 email2439865
Ref: 15862439865
Ref: email<8>-Footnote-12442429
Ref: email<8>-Footnote-22442488
Ref: email<8>-Footnote-32442552
Node: elementtree2442617
Ref: whatsnew/3 2 elementtree2442791
Ref: 158e2442791
Ref: elementtree-Footnote-12444421
Ref: elementtree-Footnote-22444521
Node: functools<10>2444585
Ref: whatsnew/3 2 functools2444763
Ref: 15952444763
Ref: functools<10>-Footnote-12448663
Ref: functools<10>-Footnote-22448746
Ref: functools<10>-Footnote-32448825
Ref: functools<10>-Footnote-42448890
Ref: functools<10>-Footnote-52448955
Ref: functools<10>-Footnote-62449019
Ref: functools<10>-Footnote-72449083
Node: itertools<8>2449147
Ref: whatsnew/3 2 itertools2449328
Ref: 159a2449328
Ref: itertools<8>-Footnote-12450103
Ref: itertools<8>-Footnote-22450145
Node: collections<9>2450175
Ref: whatsnew/3 2 collections2450356
Ref: 159c2450356
Ref: collections<9>-Footnote-12452995
Ref: collections<9>-Footnote-22453055
Node: threading<12>2453131
Ref: whatsnew/3 2 threading2453317
Ref: 15a12453317
Ref: threading<12>-Footnote-12456728
Ref: threading<12>-Footnote-22456789
Ref: threading<12>-Footnote-32456888
Ref: threading<12>-Footnote-42456960
Node: datetime と time2457024
Ref: whatsnew/3 2 datetime-and-time2457204
Ref: 15a52457204
Ref: datetime と time-Footnote-12460254
Ref: datetime と time-Footnote-22460321
Ref: datetime と time-Footnote-32460385
Ref: datetime と time-Footnote-42460449
Ref: datetime と time-Footnote-52460513
Ref: datetime と time-Footnote-62460580
Ref: datetime と time-Footnote-72460644
Node: math<12>2460709
Ref: whatsnew/3 2 math2460882
Ref: 15a92460882
Ref: math<12>-Footnote-12462838
Ref: math<12>-Footnote-22462914
Node: abc<3>2462999
Ref: whatsnew/3 2 abc2463160
Ref: 15ae2463160
Ref: abc<3>-Footnote-12463843
Node: io<9>2463907
Ref: whatsnew/3 2 io2464067
Ref: 15af2464067
Ref: io<9>-Footnote-12465327
Node: reprlib2465391
Ref: whatsnew/3 2 reprlib2465555
Ref: 15b12465555
Ref: reprlib-Footnote-12466535
Ref: reprlib-Footnote-22466599
Node: logging<9>2466663
Ref: whatsnew/3 2 logging2466828
Ref: 15b32466828
Node: csv<5>2468952
Ref: whatsnew/3 2 csv2469123
Ref: 15bb2469123
Ref: csv<5>-Footnote-12470098
Ref: csv<5>-Footnote-22470162
Node: contextlib<9>2470229
Ref: whatsnew/3 2 contextlib2470411
Ref: 15bf2470411
Ref: contextlib<9>-Footnote-12473312
Node: decimal と fractions2473376
Ref: whatsnew/3 2 decimal-and-fractions2473555
Ref: 15c02473555
Ref: decimal と fractions-Footnote-12476138
Ref: decimal と fractions-Footnote-22476202
Ref: decimal と fractions-Footnote-32476266
Ref: decimal と fractions-Footnote-42476330
Ref: decimal と fractions-Footnote-52476394
Ref: decimal と fractions-Footnote-62476458
Node: ftp2476522
Ref: whatsnew/3 2 ftp2476693
Ref: 15c42476693
Ref: ftp-Footnote-12478398
Ref: ftp-Footnote-22478462
Ref: ftp-Footnote-32478526
Ref: ftp-Footnote-42478590
Node: popen2478654
Ref: whatsnew/3 2 popen2478813
Ref: 15c52478813
Ref: popen-Footnote-12479140
Ref: popen-Footnote-22479204
Node: select<3>2479269
Ref: whatsnew/3 2 select2479441
Ref: 15c62479441
Ref: select<3>-Footnote-12479876
Node: gzip と zipfile2479940
Ref: whatsnew/3 2 gzip-and-zipfile2480118
Ref: 15c82480118
Ref: gzip と zipfile-Footnote-12481859
Ref: gzip と zipfile-Footnote-22481923
Ref: gzip と zipfile-Footnote-32481987
Ref: gzip と zipfile-Footnote-42482054
Ref: gzip と zipfile-Footnote-52482118
Ref: gzip と zipfile-Footnote-62482182
Node: tarfile<12>2482246
Ref: whatsnew/3 2 tarfile2482425
Ref: 15cc2482425
Ref: tarfile<12>-Footnote-12484271
Node: hashlib<8>2484335
Ref: whatsnew/3 2 hashlib2484504
Ref: 15cf2484504
Ref: hashlib<8>-Footnote-12485343
Node: ast<9>2485407
Ref: whatsnew/3 2 ast2485571
Ref: 15d02485571
Node: os<16>2486708
Ref: whatsnew/3 2 os2486871
Ref: 15d12486871
Node: shutil<9>2487790
Ref: whatsnew/3 2 shutil2487958
Ref: 15d42487958
Node: sqlite3<13>2490730
Ref: whatsnew/3 2 sqlite32490899
Ref: 15d62490899
Ref: sqlite3<13>-Footnote-12491664
Node: html<3>2491728
Ref: whatsnew/3 2 html2491898
Ref: 15d72491898
Node: socket<13>2492271
Ref: whatsnew/3 2 socket2492437
Ref: 15d82492437
Ref: socket<13>-Footnote-12493646
Ref: socket<13>-Footnote-22493710
Ref: socket<13>-Footnote-32493774
Node: ssl<14>2493835
Ref: whatsnew/3 2 ssl2493998
Ref: 15da2493998
Ref: ssl<14>-Footnote-12496469
Ref: ssl<14>-Footnote-22496528
Ref: ssl<14>-Footnote-32496600
Ref: ssl<14>-Footnote-42496659
Ref: ssl<14>-Footnote-52496723
Ref: ssl<14>-Footnote-62496787
Ref: ssl<14>-Footnote-72496851
Ref: ssl<14>-Footnote-82496915
Ref: ssl<14>-Footnote-92496979
Ref: ssl<14>-Footnote-102497043
Node: nntp2497108
Ref: whatsnew/3 2 nntp2497273
Ref: 15de2497273
Ref: nntp-Footnote-12497828
Ref: nntp-Footnote-22497892
Node: certificates2497956
Ref: whatsnew/3 2 certificates2498124
Ref: 15df2498124
Ref: certificates-Footnote-12498799
Node: imaplib<5>2498863
Ref: whatsnew/3 2 imaplib2499041
Ref: 15e12499041
Ref: imaplib<5>-Footnote-12499331
Node: http client<5>2499395
Ref: whatsnew/3 2 http-client2499573
Ref: 15e32499573
Ref: http client<5>-Footnote-12501583
Node: unittest<13>2501648
Ref: whatsnew/3 2 unittest2501825
Ref: 15e52501825
Ref: unittest<13>-Footnote-12506894
Ref: unittest<13>-Footnote-22506959
Ref: unittest<13>-Footnote-32507023
Node: random<5>2507087
Ref: whatsnew/3 2 random2507259
Ref: 15e92507259
Ref: random<5>-Footnote-12507986
Node: poplib<4>2508050
Ref: whatsnew/3 2 poplib2508221
Ref: 15ec2508221
Ref: poplib<4>-Footnote-12508698
Node: asyncore<2>2508762
Ref: whatsnew/3 2 asyncore2508935
Ref: 15ed2508935
Ref: asyncore<2>-Footnote-12509390
Node: tempfile<5>2509454
Ref: whatsnew/3 2 tempfile2509629
Ref: 15ee2509629
Ref: tempfile<5>-Footnote-12510095
Node: inspect<12>2510159
Ref: whatsnew/3 2 inspect2510331
Ref: 15f02510331
Ref: inspect<12>-Footnote-12512210
Node: pydoc<7>2512275
Ref: whatsnew/3 2 pydoc2512442
Ref: 15f22512442
Ref: pydoc<7>-Footnote-12512761
Node: dis<6>2512825
Ref: whatsnew/3 2 dis2512987
Ref: 15f32512987
Ref: dis<6>-Footnote-12515362
Node: dbm<8>2515426
Ref: whatsnew/3 2 dbm2515589
Ref: 15f52515589
Ref: dbm<8>-Footnote-12515778
Node: ctypes<5>2515842
Ref: whatsnew/3 2 ctypes2516006
Ref: 15f62516006
Node: site<4>2516157
Ref: whatsnew/3 2 site2516327
Ref: 15f82516327
Ref: site<4>-Footnote-12517734
Node: sysconfig<6>2517798
Ref: whatsnew/3 2 sysconfig2517966
Ref: 15fc2517966
Node: pdb<11>2520425
Ref: whatsnew/3 2 pdb2520601
Ref: 15ff2520601
Node: configparser<6>2521768
Ref: whatsnew/3 2 configparser2521947
Ref: 16002521947
Node: urllib parse<7>2525123
Ref: whatsnew/3 2 urllib-parse2525302
Ref: 16012525302
Ref: urllib parse<7>-Footnote-12527588
Ref: urllib parse<7>-Footnote-22527647
Ref: urllib parse<7>-Footnote-32527690
Ref: urllib parse<7>-Footnote-42527754
Ref: urllib parse<7>-Footnote-52527818
Node: mailbox2527882
Ref: whatsnew/3 2 mailbox2528056
Ref: 16042528056
Ref: mailbox-Footnote-12530091
Node: turtledemo2530155
Ref: whatsnew/3 2 turtledemo2530305
Ref: 160b2530305
Ref: turtledemo-Footnote-12530742
Node: マルチスレッディング2530807
Ref: whatsnew/3 2 multi-threading2531016
Ref: 160c2531016
Ref: マルチスレッディング-Footnote-12532862
Ref: マルチスレッディング-Footnote-22532941
Ref: マルチスレッディング-Footnote-32533005
Ref: マルチスレッディング-Footnote-42533071
Node: 最適化<12>2533135
Ref: whatsnew/3 2 optimizations2533277
Ref: 160e2533277
Ref: 最適化<12>-Footnote-12536798
Ref: 最適化<12>-Footnote-22536862
Ref: 最適化<12>-Footnote-32536926
Ref: 最適化<12>-Footnote-42536990
Ref: 最適化<12>-Footnote-52537036
Ref: 最適化<12>-Footnote-62537100
Ref: 最適化<12>-Footnote-72537164
Ref: 最適化<12>-Footnote-82537229
Ref: 最適化<12>-Footnote-92537293
Ref: 最適化<12>-Footnote-102537357
Ref: 最適化<12>-Footnote-112537422
Ref: 最適化<12>-Footnote-122537487
Ref: 最適化<12>-Footnote-132537552
Ref: 最適化<12>-Footnote-142537620
Ref: 最適化<12>-Footnote-152537685
Ref: 最適化<12>-Footnote-162537751
Node: Unicode 文字列型2537816
Ref: whatsnew/3 2 unicode2537934
Ref: 16132537934
Ref: Unicode 文字列型-Footnote-12538508
Ref: Unicode 文字列型-Footnote-22538559
Ref: Unicode 文字列型-Footnote-32538603
Node: Codecs2538675
Ref: whatsnew/3 2 codecs2538798
Ref: 16142538798
Ref: Codecs-Footnote-12540075
Node: ドキュメント2540142
Ref: whatsnew/3 2 documentation2540249
Ref: 16152540249
Ref: ドキュメント-Footnote-12542381
Ref: ドキュメント-Footnote-22542431
Ref: ドキュメント-Footnote-32542500
Ref: ドキュメント-Footnote-42542576
Ref: ドキュメント-Footnote-52542640
Node: IDLE2542704
Ref: whatsnew/3 2 idle2542829
Ref: 16192542829
Ref: IDLE-Footnote-12543319
Ref: IDLE-Footnote-22543383
Node: コードリポジトリ2543447
Ref: whatsnew/3 2 code-repository2543594
Ref: 161a2543594
Ref: コードリポジトリ-Footnote-12544299
Ref: コードリポジトリ-Footnote-22544338
Ref: コードリポジトリ-Footnote-32544380
Ref: コードリポジトリ-Footnote-42544434
Node: ビルドならびに C API の変更<5>2544478
Ref: whatsnew/3 2 build-and-c-api-changes2544644
Ref: 161b2544644
Ref: ビルドならびに C API の変更<5>-Footnote-12549487
Ref: ビルドならびに C API の変更<5>-Footnote-22549552
Ref: ビルドならびに C API の変更<5>-Footnote-32549616
Ref: ビルドならびに C API の変更<5>-Footnote-42549680
Ref: ビルドならびに C API の変更<5>-Footnote-52549744
Ref: ビルドならびに C API の変更<5>-Footnote-62549808
Ref: ビルドならびに C API の変更<5>-Footnote-72549872
Ref: ビルドならびに C API の変更<5>-Footnote-82549936
Ref: ビルドならびに C API の変更<5>-Footnote-92550000
Ref: ビルドならびに C API の変更<5>-Footnote-102550064
Ref: ビルドならびに C API の変更<5>-Footnote-112550129
Ref: ビルドならびに C API の変更<5>-Footnote-122550194
Ref: ビルドならびに C API の変更<5>-Footnote-132550259
Ref: ビルドならびに C API の変更<5>-Footnote-142550324
Ref: ビルドならびに C API の変更<5>-Footnote-152550407
Node: Python 3 2 への移植2550508
Ref: whatsnew/3 2 porting-to-python-3-22550641
Ref: 16242550641
Ref: Python 3 2 への移植-Footnote-12558889
Ref: Python 3 2 への移植-Footnote-22558953
Ref: Python 3 2 への移植-Footnote-32559017
Ref: Python 3 2 への移植-Footnote-42559062
Ref: Python 3 2 への移植-Footnote-52559127
Ref: Python 3 2 への移植-Footnote-62559192
Ref: Python 3 2 への移植-Footnote-72559257
Node: What's New In Python 3 12559321
Ref: whatsnew/3 1 doc2559468
Ref: 16342559468
Ref: whatsnew/3 1 translation-repo2559468
Ref: 16352559468
Ref: whatsnew/3 1 what-s-new-in-python-3-12559468
Ref: 16362559468
Node: PEP 372 順序付き辞書2560264
Ref: whatsnew/3 1 pep-372-ordered-dictionaries2560408
Ref: 16372560408
Ref: PEP 372 順序付き辞書-Footnote-12563264
Ref: PEP 372 順序付き辞書-Footnote-22563292
Node: PEP 378 1000区切りのための書式指定子2563334
Ref: whatsnew/3 1 pep-378-format-specifier-for-thousands-separator2563515
Ref: 16382563515
Ref: PEP 378 1000区切りのための書式指定子-Footnote-12564984
Node: その他の言語変更<13>2565026
Ref: whatsnew/3 1 other-language-changes2565271
Ref: 16392565271
Ref: その他の言語変更<13>-Footnote-12570382
Ref: その他の言語変更<13>-Footnote-22570449
Ref: その他の言語変更<13>-Footnote-32570513
Ref: その他の言語変更<13>-Footnote-42570577
Ref: その他の言語変更<13>-Footnote-52570641
Ref: その他の言語変更<13>-Footnote-62570686
Ref: その他の言語変更<13>-Footnote-72570750
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>2570814
Ref: whatsnew/3 1 new-improved-and-deprecated-modules2571024
Ref: 163a2571024
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-12581340
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-22581407
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-32581471
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-42581513
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-52581577
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-62581641
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-72581705
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-82581747
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-92581811
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-102581875
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-112581940
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-122582005
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-132582070
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-142582135
Node: 最適化<13>2582200
Ref: whatsnew/3 1 optimizations2582389
Ref: 164a2582389
Ref: 最適化<13>-Footnote-12584560
Ref: 最適化<13>-Footnote-22584602
Ref: 最適化<13>-Footnote-32584666
Ref: 最適化<13>-Footnote-42584730
Ref: 最適化<13>-Footnote-52584794
Ref: 最適化<13>-Footnote-62584820
Ref: 最適化<13>-Footnote-72584884
Node: IDLE<2>2584948
Ref: whatsnew/3 1 idle2585087
Ref: 164b2585087
Ref: IDLE<2>-Footnote-12585371
Node: ビルドならびに C API の変更<6>2585435
Ref: whatsnew/3 1 build-and-c-api-changes2585584
Ref: 164c2585584
Ref: ビルドならびに C API の変更<6>-Footnote-12588343
Ref: ビルドならびに C API の変更<6>-Footnote-22588407
Ref: ビルドならびに C API の変更<6>-Footnote-32588471
Ref: ビルドならびに C API の変更<6>-Footnote-42588535
Ref: ビルドならびに C API の変更<6>-Footnote-52588599
Node: Python 3 1 への移植2588663
Ref: whatsnew/3 1 porting-to-python-3-12588796
Ref: 16502588796
Node: What's New In Python 3 02590095
Ref: whatsnew/3 0 doc2590242
Ref: 16512590242
Ref: whatsnew/3 0 translation-repo2590242
Ref: 16522590242
Ref: whatsnew/3 0 what-s-new-in-python-3-02590242
Ref: 16532590242
Node: よくある悩みの種2592388
Ref: whatsnew/3 0 common-stumbling-blocks2592506
Ref: 16542592506
Node: print関数2592866
Ref: whatsnew/3 0 print-is-a-function2592998
Ref: 16552592998
Ref: print関数-Footnote-12594818
Node: リストからビューおよびイテレータへ2594860
Ref: whatsnew/3 0 views-and-iterators-instead-of-lists2595013
Ref: 16562595013
Node: 順序比較2597319
Ref: whatsnew/3 0 ordering-comparisons2597467
Ref: 16592597467
Node: 整数2599107
Ref: whatsnew/3 0 integers2599272
Ref: 165b2599272
Ref: 整数-Footnote-12600591
Ref: 整数-Footnote-22600633
Node: Unicode 対 8 ビット、ではなく、テキスト対データに2600675
Ref: whatsnew/3 0 text-vs-data-instead-of-unicode-vs-8-bit2600819
Ref: 165c2600819
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-12609740
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-22609782
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-32609824
Node: 構文の変更の概要2609866
Ref: whatsnew/3 0 overview-of-syntax-changes2610028
Ref: 165f2610028
Node: 新たな構文2610285
Ref: whatsnew/3 0 new-syntax2610391
Ref: 16602610391
Ref: 新たな構文-Footnote-12614021
Ref: 新たな構文-Footnote-22614063
Ref: 新たな構文-Footnote-32614105
Ref: 新たな構文-Footnote-42614147
Ref: 新たな構文-Footnote-52614189
Node: 変更された構文2614231
Ref: whatsnew/3 0 changed-syntax2614367
Ref: 16632614367
Ref: 変更された構文-Footnote-12616374
Ref: 変更された構文-Footnote-22616416
Ref: 変更された構文-Footnote-32616458
Ref: 変更された構文-Footnote-42616500
Node: 削除された操作2616542
Ref: whatsnew/3 0 removed-syntax2616654
Ref: 16642616654
Ref: 削除された操作-Footnote-12618373
Ref: 削除された操作-Footnote-22618415
Node: Python 2 6 で既にあった変更2618457
Ref: whatsnew/3 0 changes-already-present-in-python-2-62618619
Ref: 16662618619
Node: ライブラリの変更2623490
Ref: whatsnew/3 0 library-changes2623679
Ref: 16792623679
Ref: ライブラリの変更-Footnote-12630312
Ref: ライブラリの変更-Footnote-22630354
Ref: ライブラリの変更-Footnote-32630396
Ref: ライブラリの変更-Footnote-42630438
Ref: ライブラリの変更-Footnote-52630480
Ref: ライブラリの変更-Footnote-62630522
Node: PEP 3101 文字列整形の新たなアプローチ2630564
Ref: whatsnew/3 0 pep-3101-a-new-approach-to-string-formatting2630742
Ref: 167e2630742
Ref: PEP 3101 文字列整形の新たなアプローチ-Footnote-12631314
Node: 例外に関する変更2631356
Ref: whatsnew/3 0 changes-to-exceptions2631531
Ref: 167f2631531
Ref: 例外に関する変更-Footnote-12635355
Ref: 例外に関する変更-Footnote-22635397
Ref: 例外に関する変更-Footnote-32635439
Ref: 例外に関する変更-Footnote-42635481
Ref: 例外に関する変更-Footnote-52635523
Node: その他の変更<2>2635565
Ref: whatsnew/3 0 miscellaneous-other-changes2635729
Ref: 16832635729
Node: 演算子と特殊メソッド2635838
Ref: whatsnew/3 0 operators-and-special-methods2635947
Ref: 16842635947
Ref: 演算子と特殊メソッド-Footnote-12637722
Node: 組み込み2637764
Ref: whatsnew/3 0 builtins2637873
Ref: 16902637873
Ref: 組み込み-Footnote-12640682
Ref: 組み込み-Footnote-22640724
Ref: 組み込み-Footnote-32640766
Node: ビルドならびに C API の変更<7>2640826
Ref: whatsnew/3 0 build-and-c-api-changes2640972
Ref: 16962640972
Ref: ビルドならびに C API の変更<7>-Footnote-12642145
Ref: ビルドならびに C API の変更<7>-Footnote-22642187
Ref: ビルドならびに C API の変更<7>-Footnote-32642229
Node: 性能2642271
Ref: whatsnew/3 0 performance2642419
Ref: 16982642419
Node: Python 3 0 への移植2642855
Ref: whatsnew/3 0 porting-to-python-3-02642954
Ref: 16992642954
Node: What's New in Python 2 72645632
Ref: whatsnew/2 7 doc2645779
Ref: 169b2645779
Ref: whatsnew/2 7 translation-repo2645779
Ref: 169c2645779
Ref: whatsnew/2 7 what-s-new-in-python-2-72645779
Ref: 169d2645779
Node: Python 2 x の今後2648686
Ref: whatsnew/2 7 the-future-for-python-2-x2648815
Ref: 169e2648815
Ref: whatsnew/2 7 whatsnew27-python312648815
Ref: 169f2648815
Ref: Python 2 x の今後-Footnote-12653091
Ref: Python 2 x の今後-Footnote-22653133
Node: Deprecation Warnings の扱いの変更2653170
Ref: whatsnew/2 7 changes-to-the-handling-of-deprecation-warnings2653328
Ref: 16a12653328
Ref: Deprecation Warnings の扱いの変更-Footnote-12655130
Node: Python 3 1 の機能2655194
Ref: whatsnew/2 7 python-3-1-features2655382
Ref: 16a22655382
Node: PEP 372 collections に順序付き辞書を追加2657696
Ref: whatsnew/2 7 pep-03722657896
Ref: 16a32657896
Ref: whatsnew/2 7 pep-372-adding-an-ordered-dictionary-to-collections2657896
Ref: 16a62657896
Ref: PEP 372 collections に順序付き辞書を追加-Footnote-12661718
Ref: PEP 372 collections に順序付き辞書を追加-Footnote-22661746
Node: PEP 378 1000区切りのための書式指定子<2>2661788
Ref: whatsnew/2 7 pep-03782662040
Ref: 16a42662040
Ref: whatsnew/2 7 pep-378-format-specifier-for-thousands-separator2662040
Ref: 16a82662040
Ref: PEP 378 1000区切りのための書式指定子<2>-Footnote-12663760
Node: PEP 389 コマンドライン解析のための argparse モジュール2663802
Ref: whatsnew/2 7 pep-389-the-argparse-module-for-parsing-command-lines2664050
Ref: 16a92664050
Ref: PEP 389 コマンドライン解析のための argparse モジュール-Footnote-12668431
Node: PEP 391 logging の辞書ベースの設定<2>2668473
Ref: whatsnew/2 7 pep-391-dictionary-based-configuration-for-logging2668690
Ref: 16aa2668690
Ref: PEP 391 logging の辞書ベースの設定<2>-Footnote-12672881
Node: PEP 3106 辞書 View2672923
Ref: whatsnew/2 7 pep-3106-dictionary-views2673106
Ref: 16b12673106
Ref: PEP 3106 辞書 View-Footnote-12675358
Ref: PEP 3106 辞書 View-Footnote-22675400
Node: PEP 3137 memoryview オブジェクト2675464
Ref: whatsnew/2 7 pep-3137-the-memoryview-object2675629
Ref: 16b22675629
Ref: PEP 3137 memoryview オブジェクト-Footnote-12677443
Ref: PEP 3137 memoryview オブジェクト-Footnote-22677485
Node: その他の言語変更<14>2677549
Ref: whatsnew/2 7 other-language-changes2677751
Ref: 16b32677751
Ref: その他の言語変更<14>-Footnote-12689071
Ref: その他の言語変更<14>-Footnote-22689135
Ref: その他の言語変更<14>-Footnote-32689199
Ref: その他の言語変更<14>-Footnote-42689263
Ref: その他の言語変更<14>-Footnote-52689327
Ref: その他の言語変更<14>-Footnote-62689391
Ref: その他の言語変更<14>-Footnote-72689455
Ref: その他の言語変更<14>-Footnote-82689519
Ref: その他の言語変更<14>-Footnote-92689583
Ref: その他の言語変更<14>-Footnote-102689647
Ref: その他の言語変更<14>-Footnote-112689712
Ref: その他の言語変更<14>-Footnote-122689777
Ref: その他の言語変更<14>-Footnote-132689842
Ref: その他の言語変更<14>-Footnote-142689907
Ref: その他の言語変更<14>-Footnote-152689975
Ref: その他の言語変更<14>-Footnote-162690040
Ref: その他の言語変更<14>-Footnote-172690105
Ref: その他の言語変更<14>-Footnote-182690170
Ref: その他の言語変更<14>-Footnote-192690238
Ref: その他の言語変更<14>-Footnote-202690303
Ref: その他の言語変更<14>-Footnote-212690368
Ref: その他の言語変更<14>-Footnote-222690433
Ref: その他の言語変更<14>-Footnote-232690498
Ref: その他の言語変更<14>-Footnote-242690563
Node: インタプリタの変更2690628
Ref: whatsnew/2 7 interpreter-changes2690742
Ref: 16b72690742
Ref: whatsnew/2 7 new-27-interpreter2690742
Ref: 16b82690742
Ref: インタプリタの変更-Footnote-12691449
Node: 最適化<14>2691513
Ref: whatsnew/2 7 optimizations2691627
Ref: 16b92691627
Ref: 最適化<14>-Footnote-12696971
Ref: 最適化<14>-Footnote-22697035
Ref: 最適化<14>-Footnote-32697099
Ref: 最適化<14>-Footnote-42697163
Ref: 最適化<14>-Footnote-52697227
Ref: 最適化<14>-Footnote-62697291
Ref: 最適化<14>-Footnote-72697358
Ref: 最適化<14>-Footnote-82697422
Ref: 最適化<14>-Footnote-92697486
Ref: 最適化<14>-Footnote-102697550
Ref: 最適化<14>-Footnote-112697615
Ref: 最適化<14>-Footnote-122697680
Ref: 最適化<14>-Footnote-132697745
Node: 新しいモジュールと改良されたモジュール2697810
Ref: whatsnew/2 7 new-and-improved-modules2698014
Ref: 16bb2698014
Ref: 新しいモジュールと改良されたモジュール-Footnote-12738452
Ref: 新しいモジュールと改良されたモジュール-Footnote-22738516
Ref: 新しいモジュールと改良されたモジュール-Footnote-32738580
Ref: 新しいモジュールと改良されたモジュール-Footnote-42738633
Ref: 新しいモジュールと改良されたモジュール-Footnote-52738697
Ref: 新しいモジュールと改良されたモジュール-Footnote-62738761
Ref: 新しいモジュールと改良されたモジュール-Footnote-72738828
Ref: 新しいモジュールと改良されたモジュール-Footnote-82738892
Ref: 新しいモジュールと改良されたモジュール-Footnote-92738956
Ref: 新しいモジュールと改良されたモジュール-Footnote-102739020
Ref: 新しいモジュールと改良されたモジュール-Footnote-112739085
Ref: 新しいモジュールと改良されたモジュール-Footnote-122739150
Ref: 新しいモジュールと改良されたモジュール-Footnote-132739215
Ref: 新しいモジュールと改良されたモジュール-Footnote-142739255
Ref: 新しいモジュールと改良されたモジュール-Footnote-152739320
Ref: 新しいモジュールと改良されたモジュール-Footnote-162739385
Ref: 新しいモジュールと改良されたモジュール-Footnote-172739450
Ref: 新しいモジュールと改良されたモジュール-Footnote-182739515
Ref: 新しいモジュールと改良されたモジュール-Footnote-192739580
Ref: 新しいモジュールと改良されたモジュール-Footnote-202739645
Ref: 新しいモジュールと改良されたモジュール-Footnote-212739710
Ref: 新しいモジュールと改良されたモジュール-Footnote-222739775
Ref: 新しいモジュールと改良されたモジュール-Footnote-232739840
Ref: 新しいモジュールと改良されたモジュール-Footnote-242739905
Ref: 新しいモジュールと改良されたモジュール-Footnote-252739970
Ref: 新しいモジュールと改良されたモジュール-Footnote-262740035
Ref: 新しいモジュールと改良されたモジュール-Footnote-272740103
Ref: 新しいモジュールと改良されたモジュール-Footnote-282740168
Ref: 新しいモジュールと改良されたモジュール-Footnote-292740233
Ref: 新しいモジュールと改良されたモジュール-Footnote-302740298
Ref: 新しいモジュールと改良されたモジュール-Footnote-312740363
Ref: 新しいモジュールと改良されたモジュール-Footnote-322740428
Ref: 新しいモジュールと改良されたモジュール-Footnote-332740493
Ref: 新しいモジュールと改良されたモジュール-Footnote-342740558
Ref: 新しいモジュールと改良されたモジュール-Footnote-352740623
Ref: 新しいモジュールと改良されたモジュール-Footnote-362740688
Ref: 新しいモジュールと改良されたモジュール-Footnote-372740753
Ref: 新しいモジュールと改良されたモジュール-Footnote-382740818
Ref: 新しいモジュールと改良されたモジュール-Footnote-392740883
Ref: 新しいモジュールと改良されたモジュール-Footnote-402740948
Ref: 新しいモジュールと改良されたモジュール-Footnote-412741013
Ref: 新しいモジュールと改良されたモジュール-Footnote-422741078
Ref: 新しいモジュールと改良されたモジュール-Footnote-432741143
Ref: 新しいモジュールと改良されたモジュール-Footnote-442741208
Ref: 新しいモジュールと改良されたモジュール-Footnote-452741273
Ref: 新しいモジュールと改良されたモジュール-Footnote-462741338
Ref: 新しいモジュールと改良されたモジュール-Footnote-472741403
Ref: 新しいモジュールと改良されたモジュール-Footnote-482741468
Ref: 新しいモジュールと改良されたモジュール-Footnote-492741536
Ref: 新しいモジュールと改良されたモジュール-Footnote-502741601
Ref: 新しいモジュールと改良されたモジュール-Footnote-512741666
Ref: 新しいモジュールと改良されたモジュール-Footnote-522741731
Ref: 新しいモジュールと改良されたモジュール-Footnote-532741796
Ref: 新しいモジュールと改良されたモジュール-Footnote-542741861
Ref: 新しいモジュールと改良されたモジュール-Footnote-552741926
Ref: 新しいモジュールと改良されたモジュール-Footnote-562741991
Ref: 新しいモジュールと改良されたモジュール-Footnote-572742056
Ref: 新しいモジュールと改良されたモジュール-Footnote-582742121
Ref: 新しいモジュールと改良されたモジュール-Footnote-592742186
Ref: 新しいモジュールと改良されたモジュール-Footnote-602742251
Ref: 新しいモジュールと改良されたモジュール-Footnote-612742316
Ref: 新しいモジュールと改良されたモジュール-Footnote-622742381
Ref: 新しいモジュールと改良されたモジュール-Footnote-632742446
Ref: 新しいモジュールと改良されたモジュール-Footnote-642742511
Ref: 新しいモジュールと改良されたモジュール-Footnote-652742576
Ref: 新しいモジュールと改良されたモジュール-Footnote-662742641
Ref: 新しいモジュールと改良されたモジュール-Footnote-672742706
Ref: 新しいモジュールと改良されたモジュール-Footnote-682742771
Ref: 新しいモジュールと改良されたモジュール-Footnote-692742836
Ref: 新しいモジュールと改良されたモジュール-Footnote-702742882
Ref: 新しいモジュールと改良されたモジュール-Footnote-712742947
Ref: 新しいモジュールと改良されたモジュール-Footnote-722743012
Ref: 新しいモジュールと改良されたモジュール-Footnote-732743066
Ref: 新しいモジュールと改良されたモジュール-Footnote-742743131
Ref: 新しいモジュールと改良されたモジュール-Footnote-752743196
Ref: 新しいモジュールと改良されたモジュール-Footnote-762743261
Ref: 新しいモジュールと改良されたモジュール-Footnote-772743326
Ref: 新しいモジュールと改良されたモジュール-Footnote-782743391
Ref: 新しいモジュールと改良されたモジュール-Footnote-792743459
Ref: 新しいモジュールと改良されたモジュール-Footnote-802743524
Ref: 新しいモジュールと改良されたモジュール-Footnote-812743589
Ref: 新しいモジュールと改良されたモジュール-Footnote-822743654
Ref: 新しいモジュールと改良されたモジュール-Footnote-832743719
Ref: 新しいモジュールと改良されたモジュール-Footnote-842743784
Ref: 新しいモジュールと改良されたモジュール-Footnote-852743849
Ref: 新しいモジュールと改良されたモジュール-Footnote-862743917
Ref: 新しいモジュールと改良されたモジュール-Footnote-872743985
Ref: 新しいモジュールと改良されたモジュール-Footnote-882744050
Ref: 新しいモジュールと改良されたモジュール-Footnote-892744110
Ref: 新しいモジュールと改良されたモジュール-Footnote-902744170
Ref: 新しいモジュールと改良されたモジュール-Footnote-912744235
Ref: 新しいモジュールと改良されたモジュール-Footnote-922744300
Ref: 新しいモジュールと改良されたモジュール-Footnote-932744365
Ref: 新しいモジュールと改良されたモジュール-Footnote-942744430
Ref: 新しいモジュールと改良されたモジュール-Footnote-952744495
Ref: 新しいモジュールと改良されたモジュール-Footnote-962744560
Ref: 新しいモジュールと改良されたモジュール-Footnote-972744625
Node: 新しいモジュール importlib2744690
Ref: whatsnew/2 7 importlib-section2744861
Ref: 16a52744861
Ref: whatsnew/2 7 new-module-importlib2744861
Ref: 16e52744861
Node: 新しいモジュール sysconfig2746574
Ref: whatsnew/2 7 new-module-sysconfig2746797
Ref: 16e62746797
Node: ttk Tk のテーマ付きウィジェット2748499
Ref: whatsnew/2 7 ttk-themed-widgets-for-tk2748727
Ref: 16e82748727
Ref: ttk Tk のテーマ付きウィジェット-Footnote-12749974
Ref: ttk Tk のテーマ付きウィジェット-Footnote-22750038
Node: 更新されたモジュール unittest2750102
Ref: whatsnew/2 7 unittest-section2750342
Ref: 16e92750342
Ref: whatsnew/2 7 updated-module-unittest2750342
Ref: 16ea2750342
Ref: 更新されたモジュール unittest-Footnote-12761011
Ref: 更新されたモジュール unittest-Footnote-22761055
Ref: 更新されたモジュール unittest-Footnote-32761082
Ref: 更新されたモジュール unittest-Footnote-42761119
Ref: 更新されたモジュール unittest-Footnote-52761183
Ref: 更新されたモジュール unittest-Footnote-62761247
Ref: 更新されたモジュール unittest-Footnote-72761314
Ref: 更新されたモジュール unittest-Footnote-82761378
Ref: 更新されたモジュール unittest-Footnote-92761442
Ref: 更新されたモジュール unittest-Footnote-102761506
Ref: 更新されたモジュール unittest-Footnote-112761571
Ref: 更新されたモジュール unittest-Footnote-122761636
Ref: 更新されたモジュール unittest-Footnote-132761701
Ref: 更新されたモジュール unittest-Footnote-142761766
Ref: 更新されたモジュール unittest-Footnote-152761831
Node: 更新されたモジュール ElementTree 1 32761896
Ref: whatsnew/2 7 elementtree-section2762084
Ref: 17052762084
Ref: whatsnew/2 7 updated-module-elementtree-1-32762084
Ref: 17062762084
Ref: 更新されたモジュール ElementTree 1 3-Footnote-12766366
Node: ビルドならびに C API の変更<8>2766430
Ref: whatsnew/2 7 build-and-c-api-changes2766633
Ref: 17092766633
Ref: ビルドならびに C API の変更<8>-Footnote-12776224
Ref: ビルドならびに C API の変更<8>-Footnote-22776337
Ref: ビルドならびに C API の変更<8>-Footnote-32776401
Ref: ビルドならびに C API の変更<8>-Footnote-42776465
Ref: ビルドならびに C API の変更<8>-Footnote-52776529
Ref: ビルドならびに C API の変更<8>-Footnote-62776593
Ref: ビルドならびに C API の変更<8>-Footnote-72776657
Ref: ビルドならびに C API の変更<8>-Footnote-82776721
Ref: ビルドならびに C API の変更<8>-Footnote-92776776
Ref: ビルドならびに C API の変更<8>-Footnote-102776840
Ref: ビルドならびに C API の変更<8>-Footnote-112776905
Ref: ビルドならびに C API の変更<8>-Footnote-122776970
Ref: ビルドならびに C API の変更<8>-Footnote-132777035
Ref: ビルドならびに C API の変更<8>-Footnote-142777103
Ref: ビルドならびに C API の変更<8>-Footnote-152777171
Ref: ビルドならびに C API の変更<8>-Footnote-162777236
Ref: ビルドならびに C API の変更<8>-Footnote-172777301
Ref: ビルドならびに C API の変更<8>-Footnote-182777366
Ref: ビルドならびに C API の変更<8>-Footnote-192777431
Ref: ビルドならびに C API の変更<8>-Footnote-202777496
Ref: ビルドならびに C API の変更<8>-Footnote-212777564
Ref: ビルドならびに C API の変更<8>-Footnote-222777629
Node: カプセル2777694
Ref: whatsnew/2 7 capsules2777824
Ref: 17142777824
Ref: whatsnew/2 7 whatsnew27-capsules2777824
Ref: 17152777824
Ref: カプセル-Footnote-12780080
Node: ポート特有の変更 Windows2780144
Ref: whatsnew/2 7 port-specific-changes-windows2780316
Ref: 17182780316
Ref: ポート特有の変更 Windows-Footnote-12782146
Ref: ポート特有の変更 Windows-Footnote-22782210
Ref: ポート特有の変更 Windows-Footnote-32782274
Ref: ポート特有の変更 Windows-Footnote-42782338
Ref: ポート特有の変更 Windows-Footnote-52782405
Ref: ポート特有の変更 Windows-Footnote-62782469
Node: ポート特有の変更 Mac OS X2782533
Ref: whatsnew/2 7 port-specific-changes-mac-os-x2782725
Ref: 17242782725
Ref: ポート特有の変更 Mac OS X-Footnote-12783787
Ref: ポート特有の変更 Mac OS X-Footnote-22783851
Node: ポート特有の変更 FreeBSD2783916
Ref: whatsnew/2 7 port-specific-changes-freebsd2784067
Ref: 17252784067
Ref: ポート特有の変更 FreeBSD-Footnote-12784471
Node: その他の変更と修正2784535
Ref: whatsnew/2 7 other-changes-and-fixes2784704
Ref: 17262784704
Ref: その他の変更と修正-Footnote-12787359
Ref: その他の変更と修正-Footnote-22787423
Ref: その他の変更と修正-Footnote-32787490
Ref: その他の変更と修正-Footnote-42787554
Ref: その他の変更と修正-Footnote-52787618
Node: Python 2 7 への移植2787682
Ref: whatsnew/2 7 porting-to-python-2-72787879
Ref: 17282787879
Ref: Python 2 7 への移植-Footnote-12793947
Ref: Python 2 7 への移植-Footnote-22794011
Ref: Python 2 7 への移植-Footnote-32794075
Ref: Python 2 7 への移植-Footnote-42794139
Ref: Python 2 7 への移植-Footnote-52794203
Ref: Python 2 7 への移植-Footnote-62794267
Ref: Python 2 7 への移植-Footnote-72794331
Ref: Python 2 7 への移植-Footnote-82794395
Ref: Python 2 7 への移植-Footnote-92794459
Ref: Python 2 7 への移植-Footnote-102794523
Ref: Python 2 7 への移植-Footnote-112794588
Ref: Python 2 7 への移植-Footnote-122794653
Ref: Python 2 7 への移植-Footnote-132794718
Ref: Python 2 7 への移植-Footnote-142794778
Node: Python 2 7 メンテナンスリリースで追加された新機能2794843
Ref: whatsnew/2 7 new-features-added-to-python-2-7-maintenance-releases2795019
Ref: 17292795019
Ref: whatsnew/2 7 py27-maintenance-enhancements2795019
Ref: 16a02795019
Node: デバッグモード用の2つの新しい環境変数2796867
Ref: whatsnew/2 7 two-new-environment-variables-for-debug-mode2797121
Ref: 172a2797121
Ref: デバッグモード用の2つの新しい環境変数-Footnote-12797806
Ref: デバッグモード用の2つの新しい環境変数-Footnote-22797871
Node: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い2797936
Ref: whatsnew/2 7 pep-434-idle-enhancement-exception-for-all-branches2798272
Ref: 172b2798272
Ref: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い-Footnote-12798967
Node: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張2799009
Ref: whatsnew/2 7 pep-466-network-security-enhancements-for-python-2-72799352
Ref: 172c2799352
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-12802186
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-22802228
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-32802270
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-42802335
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-52802400
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-62802442
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-72802507
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-82802572
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-92802627
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-102802669
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-112802735
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-122802801
Node: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート2802867
Ref: whatsnew/2 7 pep-477-backport-ensurepip-pep-453-to-python-2-72803229
Ref: 172f2803229
Ref: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート-Footnote-12803884
Ref: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート-Footnote-22803926
Node: デフォルトでの pip のブートストラッピング<2>2803968
Ref: whatsnew/2 7 bootstrapping-pip-by-default2804168
Ref: 17302804168
Ref: デフォルトでの pip のブートストラッピング<2>-Footnote-12806247
Ref: デフォルトでの pip のブートストラッピング<2>-Footnote-22806289
Node: ドキュメントの変更<2>2806379
Ref: whatsnew/2 7 documentation-changes2806579
Ref: 17312806579
Ref: ドキュメントの変更<2>-Footnote-12807735
Ref: ドキュメントの変更<2>-Footnote-22807772
Node: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>2807814
Ref: whatsnew/2 7 pep-476-enabling-certificate-verification-by-default-for-stdlib-http-clients2808160
Ref: 17322808160
Ref: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>-Footnote-12809312
Node: PEP 493 HTTPS verification migration tools for Python 2 72809354
Ref: whatsnew/2 7 pep-493-https-verification-migration-tools-for-python-2-72809672
Ref: 17332809672
Ref: PEP 493 HTTPS verification migration tools for Python 2 7-Footnote-12810830
Node: New make regen-all build target<3>2810872
Ref: whatsnew/2 7 new-make-regen-all-build-target2811123
Ref: 17342811123
Ref: New make regen-all build target<3>-Footnote-12811915
Ref: New make regen-all build target<3>-Footnote-22811983
Node: Removal of make touch build target<3>2812048
Ref: whatsnew/2 7 removal-of-make-touch-build-target2812233
Ref: 17352812233
Ref: Removal of make touch build target<3>-Footnote-12812675
Node: 謝辞2812740
Ref: whatsnew/2 7 acknowledgements2812884
Ref: 17362812884
Ref: whatsnew/2 7 acks272812884
Ref: 17372812884
Node: What's New in Python 2 62813176
Ref: whatsnew/2 6 doc2813323
Ref: 17382813323
Ref: whatsnew/2 6 translation-repo2813323
Ref: 17392813323
Ref: whatsnew/2 6 what-s-new-in-python-2-62813323
Ref: 173a2813323
Ref: whatsnew/2 6 whats-new-in-2-62813323
Ref: 16672813323
Ref: What's New in Python 2 6-Footnote-12816850
Node: Python 3 02816892
Ref: whatsnew/2 6 python-3-02817008
Ref: 173b2817008
Ref: Python 3 0-Footnote-12819379
Ref: Python 3 0-Footnote-22819421
Node: 開発プロセスに関する変更2819463
Ref: whatsnew/2 6 changes-to-the-development-process2819624
Ref: 173c2819624
Node: 新しい課題トラッカー Roundup2820318
Ref: whatsnew/2 6 new-issue-tracker-roundup2820535
Ref: 173d2820535
Ref: 新しい課題トラッカー Roundup-Footnote-12822969
Ref: 新しい課題トラッカー Roundup-Footnote-22823018
Ref: 新しい課題トラッカー Roundup-Footnote-32823049
Ref: 新しい課題トラッカー Roundup-Footnote-42823089
Ref: 新しい課題トラッカー Roundup-Footnote-52823124
Node: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText2823162
Ref: whatsnew/2 6 new-documentation-format-restructuredtext-using-sphinx2823379
Ref: 173e2823379
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-12826550
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-22826609
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-32826658
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-42826694
Node: PEP 343 "with" ステートメント2826734
Ref: whatsnew/2 6 pep-03432826956
Ref: 16682826956
Ref: whatsnew/2 6 pep-343-the-with-statement2826956
Ref: 173f2826956
Node: コンテキストマネージャを書く2830682
Ref: whatsnew/2 6 new-26-context-managers2830832
Ref: 16692830832
Ref: whatsnew/2 6 writing-context-managers2830832
Ref: 17412830832
Node: contextlib モジュール2836063
Ref: whatsnew/2 6 new-module-contextlib2836213
Ref: 166a2836213
Ref: whatsnew/2 6 the-contextlib-module2836213
Ref: 17422836213
Ref: contextlib モジュール-Footnote-12839076
Node: PEP 366 メインモジュールからの明示的相対インポート2839118
Ref: whatsnew/2 6 pep-03662839363
Ref: 166b2839363
Ref: whatsnew/2 6 pep-366-explicit-relative-imports-from-a-main-module2839363
Ref: 17432839363
Node: PEP 370 ユーザごとの site-packages ディレクトリ2840212
Ref: whatsnew/2 6 pep-03702840460
Ref: 166c2840460
Ref: whatsnew/2 6 pep-370-per-user-site-packages-directory2840460
Ref: 17452840460
Ref: PEP 370 ユーザごとの site-packages ディレクトリ-Footnote-12842106
Node: PEP 371 multiprocessing パッケージ2842148
Ref: whatsnew/2 6 pep-03712842379
Ref: 166d2842379
Ref: whatsnew/2 6 pep-371-the-multiprocessing-package2842379
Ref: 17492842379
Ref: PEP 371 multiprocessing パッケージ-Footnote-12847825
Node: PEP 3101 進化版文字列フォーマッティング2847867
Ref: whatsnew/2 6 pep-31012848072
Ref: 166e2848072
Ref: whatsnew/2 6 pep-3101-advanced-string-formatting2848072
Ref: 17532848072
Ref: PEP 3101 進化版文字列フォーマッティング-Footnote-12854175
Node: PEP 3105 print を関数にする2854217
Ref: whatsnew/2 6 pep-31052854413
Ref: 166f2854413
Ref: whatsnew/2 6 pep-3105-print-as-a-function2854413
Ref: 17552854413
Ref: PEP 3105 print を関数にする-Footnote-12855697
Node: PEP 3110 例外処理の変更2855739
Ref: whatsnew/2 6 pep-31102855911
Ref: 16702855911
Ref: whatsnew/2 6 pep-3110-exception-handling-changes2855911
Ref: 17562855911
Ref: PEP 3110 例外処理の変更-Footnote-12857764
Node: PEP 3112 バイトリテラル2857806
Ref: whatsnew/2 6 pep-31122857983
Ref: 16712857983
Ref: whatsnew/2 6 pep-3112-byte-literals2857983
Ref: 17572857983
Ref: PEP 3112 バイトリテラル-Footnote-12861555
Node: PEP 3116 新しい I/O ライブラリ2861597
Ref: whatsnew/2 6 pep-31162861789
Ref: 16722861789
Ref: whatsnew/2 6 pep-3116-new-i-o-library2861789
Ref: 17632861789
Ref: PEP 3116 新しい I/O ライブラリ-Footnote-12865868
Node: PEP 3118 改訂版バッファプロトコル2865910
Ref: whatsnew/2 6 pep-31182866102
Ref: 16732866102
Ref: whatsnew/2 6 pep-3118-revised-buffer-protocol2866102
Ref: 176d2866102
Ref: PEP 3118 改訂版バッファプロトコル-Footnote-12868653
Node: PEP 3119 抽象基底クラス2868695
Ref: whatsnew/2 6 pep-31192868900
Ref: 16742868900
Ref: whatsnew/2 6 pep-3119-abstract-base-classes2868900
Ref: 17712868900
Ref: PEP 3119 抽象基底クラス-Footnote-12874726
Node: PEP 3127 整数リテラルのサポートと文法2874768
Ref: whatsnew/2 6 pep-31272874961
Ref: 16752874961
Ref: whatsnew/2 6 pep-3127-integer-literal-support-and-syntax2874961
Ref: 17732874961
Ref: PEP 3127 整数リテラルのサポートと文法-Footnote-12876565
Node: PEP 3129 クラスデコレータ2876607
Ref: whatsnew/2 6 pep-31292876797
Ref: 16762876797
Ref: whatsnew/2 6 pep-3129-class-decorators2876797
Ref: 17742876797
Ref: PEP 3129 クラスデコレータ-Footnote-12877271
Node: PEP 3141 数値の型階層2877313
Ref: whatsnew/2 6 pep-31412877480
Ref: 16772877480
Ref: whatsnew/2 6 pep-3141-a-type-hierarchy-for-numbers2877480
Ref: 17752877480
Ref: PEP 3141 数値の型階層-Footnote-12880018
Ref: PEP 3141 数値の型階層-Footnote-22880060
Ref: PEP 3141 数値の型階層-Footnote-32880158
Node: fractions モジュール2880264
Ref: whatsnew/2 6 the-fractions-module2880353
Ref: 17792880353
Node: その他の言語変更<15>2882100
Ref: whatsnew/2 6 other-language-changes2882294
Ref: 177a2882294
Ref: その他の言語変更<15>-Footnote-12892515
Ref: その他の言語変更<15>-Footnote-22892582
Ref: その他の言語変更<15>-Footnote-32892646
Ref: その他の言語変更<15>-Footnote-42892713
Ref: その他の言語変更<15>-Footnote-52892777
Ref: その他の言語変更<15>-Footnote-62892841
Ref: その他の言語変更<15>-Footnote-72892905
Ref: その他の言語変更<15>-Footnote-82892969
Ref: その他の言語変更<15>-Footnote-92893033
Ref: その他の言語変更<15>-Footnote-102893097
Ref: その他の言語変更<15>-Footnote-112893162
Ref: その他の言語変更<15>-Footnote-122893227
Ref: その他の言語変更<15>-Footnote-132893295
Ref: その他の言語変更<15>-Footnote-142893363
Ref: その他の言語変更<15>-Footnote-152893431
Ref: その他の言語変更<15>-Footnote-162893499
Node: 最適化<15>2893567
Ref: whatsnew/2 6 optimizations2893684
Ref: 17822893684
Ref: 最適化<15>-Footnote-12897534
Ref: 最適化<15>-Footnote-22897601
Ref: 最適化<15>-Footnote-32897668
Ref: 最適化<15>-Footnote-42897732
Node: インタプリタの変更<2>2897796
Ref: whatsnew/2 6 interpreter-changes2897913
Ref: 17842897913
Ref: whatsnew/2 6 new-26-interpreter2897913
Ref: 17852897913
Node: 新しいモジュールと改良されたモジュール<2>2899735
Ref: whatsnew/2 6 new-and-improved-modules2899920
Ref: 17882899920
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-12953539
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-22953606
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-32953659
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-42953723
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-52953789
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-62953853
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-72953920
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-82953984
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-92954038
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-102954105
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-112954173
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-122954241
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-132954306
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-142954371
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-152954438
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-162954503
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-172954571
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-182954636
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-192954704
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-202954772
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-212954840
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-222954907
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-232954975
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-242955043
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-252955108
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-262955173
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-272955241
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-282955309
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-292955376
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-302955441
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-312955506
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-322955571
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-332955636
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-342955701
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-352955766
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-362955831
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-372955891
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-382955958
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-392956018
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-402956085
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-412956150
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-422956217
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-432956285
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-442956350
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-452956415
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-462956480
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-472956548
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-482956613
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-492956678
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-502956746
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-512956811
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-522956879
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-532956944
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-542957012
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-552957077
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-562957145
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-572957210
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-582957278
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-592957346
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-602957411
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-612957476
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-622957543
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-632957611
Node: ast モジュール2957679
Ref: whatsnew/2 6 the-ast-module2957830
Ref: 179d2957830
Node: The future_builtins module2960816
Ref: whatsnew/2 6 the-future-builtins-module2961032
Ref: 179e2961032
Node: json モジュール JavaScript オブジェクト記法2962320
Ref: whatsnew/2 6 the-json-module-javascript-object-notation2962575
Ref: 17a02962575
Node: plistlib モジュール プロパティリストパーサ2963884
Ref: whatsnew/2 6 the-plistlib-module-a-property-list-parser2964129
Ref: 17a12964129
Node: ctypes の強化2965645
Ref: whatsnew/2 6 ctypes-enhancements2965859
Ref: 17a22965859
Ref: ctypes の強化-Footnote-12968057
Ref: ctypes の強化-Footnote-22968124
Node: SSL サポートの改善2968188
Ref: whatsnew/2 6 improved-ssl-support2968335
Ref: 17a32968335
Ref: SSL サポートの改善-Footnote-12969677
Node: 非推奨と削除2969710
Ref: whatsnew/2 6 deprecations-and-removals2969907
Ref: 17a42969907
Ref: 非推奨と削除-Footnote-12971902
Node: ビルドならびに C API の変更<9>2971944
Ref: whatsnew/2 6 build-and-c-api-changes2972104
Ref: 17a62972104
Ref: ビルドならびに C API の変更<9>-Footnote-12980603
Ref: ビルドならびに C API の変更<9>-Footnote-22980658
Ref: ビルドならびに C API の変更<9>-Footnote-32980713
Ref: ビルドならびに C API の変更<9>-Footnote-42980777
Ref: ビルドならびに C API の変更<9>-Footnote-52980844
Ref: ビルドならびに C API の変更<9>-Footnote-62980908
Ref: ビルドならびに C API の変更<9>-Footnote-72980972
Node: ポート特有の変更 Windows<2>2981039
Ref: whatsnew/2 6 port-specific-changes-windows2981196
Ref: 17ac2981196
Ref: ポート特有の変更 Windows<2>-Footnote-12983818
Ref: ポート特有の変更 Windows<2>-Footnote-22983884
Ref: ポート特有の変更 Windows<2>-Footnote-32983951
Node: ポート特有の変更 Mac OS X<2>2984015
Ref: whatsnew/2 6 port-specific-changes-mac-os-x2984210
Ref: 17b12984210
Ref: ポート特有の変更 Mac OS X<2>-Footnote-12985528
Node: ポート特有の変更 IRIX2985595
Ref: whatsnew/2 6 port-specific-changes-irix2985746
Ref: 17b22985746
Node: Python 2 6 への移植2986263
Ref: whatsnew/2 6 porting-to-python-2-62986414
Ref: 17b32986414
Ref: Python 2 6 への移植-Footnote-12991179
Ref: Python 2 6 への移植-Footnote-22991246
Ref: Python 2 6 への移植-Footnote-32991313
Node: 謝辞<2>2991380
Ref: whatsnew/2 6 acknowledgements2991482
Ref: 17b52991482
Ref: whatsnew/2 6 acks2991482
Ref: 17b62991482
Node: What's New in Python 2 52991792
Ref: whatsnew/2 5 doc2991939
Ref: 17b72991939
Ref: whatsnew/2 5 translation-repo2991939
Ref: 17b82991939
Ref: whatsnew/2 5 what-s-new-in-python-2-52991939
Ref: 17b92991939
Ref: What's New in Python 2 5-Footnote-12996441
Node: PEP 308 条件式 Conditional Expressions2996483
Ref: whatsnew/2 5 pep-3082996623
Ref: 17ba2996623
Ref: whatsnew/2 5 pep-308-conditional-expressions2996623
Ref: 17bf2996623
Ref: PEP 308 条件式 Conditional Expressions-Footnote-13000678
Ref: PEP 308 条件式 Conditional Expressions-Footnote-23000720
Node: PEP 309 関数の部分適用3000762
Ref: whatsnew/2 5 pep-3093000961
Ref: 17c03000961
Ref: whatsnew/2 5 pep-309-partial-function-application3000961
Ref: 17c13000961
Ref: PEP 309 関数の部分適用-Footnote-13004897
Node: PEP 314 Metadata for Python Software Packages v1 13004939
Ref: whatsnew/2 5 pep-3143005150
Ref: 17c23005150
Ref: whatsnew/2 5 pep-314-metadata-for-python-software-packages-v1-13005150
Ref: 17c33005150
Ref: PEP 314 Metadata for Python Software Packages v1 1-Footnote-13007415
Node: PEP 328 絶対インポート、相対インポート3007457
Ref: whatsnew/2 5 pep-3283007703
Ref: 17bd3007703
Ref: whatsnew/2 5 pep-328-absolute-and-relative-imports3007703
Ref: 17c43007703
Ref: PEP 328 絶対インポート、相対インポート-Footnote-13013004
Ref: PEP 328 絶対インポート、相対インポート-Footnote-23013046
Node: PEP 338 - モジュールをスクリプトとして実行する3013088
Ref: whatsnew/2 5 pep-3383013323
Ref: 17c53013323
Ref: whatsnew/2 5 pep-338-executing-modules-as-scripts3013323
Ref: 17c63013323
Ref: PEP 338 - モジュールをスクリプトとして実行する-Footnote-13014514
Node: PEP 341 try/except/finally の一体化3014556
Ref: whatsnew/2 5 pep-3413014776
Ref: 17be3014776
Ref: whatsnew/2 5 pep-341-unified-try-except-finally3014776
Ref: 17c73014776
Ref: PEP 341 try/except/finally の一体化-Footnote-13016914
Node: PEP 342 ジェネレータの新機能3016956
Ref: whatsnew/2 5 pep-3423017151
Ref: 17bc3017151
Ref: whatsnew/2 5 pep-342-new-generator-features3017151
Ref: 17c83017151
Ref: PEP 342 ジェネレータの新機能-Footnote-13024725
Ref: PEP 342 ジェネレータの新機能-Footnote-23024767
Ref: PEP 342 ジェネレータの新機能-Footnote-33024809
Ref: PEP 342 ジェネレータの新機能-Footnote-43024851
Ref: PEP 342 ジェネレータの新機能-Footnote-53024893
Node: PEP 343 "with" ステートメント<2>3024935
Ref: whatsnew/2 5 pep-3433025135
Ref: 17bb3025135
Ref: whatsnew/2 5 pep-343-the-with-statement3025135
Ref: 17c93025135
Node: コンテキストマネージャを書く<2>3028724
Ref: whatsnew/2 5 new-25-context-managers3028883
Ref: 17ca3028883
Ref: whatsnew/2 5 writing-context-managers3028883
Ref: 17cb3028883
Node: contextlib モジュール<2>3034399
Ref: whatsnew/2 5 contextlibmod3034558
Ref: 17cc3034558
Ref: whatsnew/2 5 the-contextlib-module3034558
Ref: 17cd3034558
Ref: contextlib モジュール<2>-Footnote-13037484
Node: PEP 352 例外の新スタイルクラス化3037526
Ref: whatsnew/2 5 pep-3523037729
Ref: 17ce3037729
Ref: whatsnew/2 5 pep-352-exceptions-as-new-style-classes3037729
Ref: 17cf3037729
Ref: PEP 352 例外の新スタイルクラス化-Footnote-13041564
Node: PEP 353 添え字型に ssize_t を使う3041606
Ref: whatsnew/2 5 pep-3533041802
Ref: 17d03041802
Ref: whatsnew/2 5 pep-353-using-ssize-t-as-the-index-type3041802
Ref: 17d13041802
Ref: PEP 353 添え字型に ssize_t を使う-Footnote-13045290
Ref: PEP 353 添え字型に ssize_t を使う-Footnote-23045332
Node: PEP 357 '__index__' メソッド3045374
Ref: whatsnew/2 5 pep-3573045554
Ref: 17d33045554
Ref: whatsnew/2 5 pep-357-the-index-method3045554
Ref: 17d43045554
Ref: PEP 357 '__index__' メソッド-Footnote-13047586
Node: その他の言語変更<16>3047628
Ref: whatsnew/2 5 other-lang3047857
Ref: 17d73047857
Ref: whatsnew/2 5 other-language-changes3047857
Ref: 17d83047857
Ref: その他の言語変更<16>-Footnote-13057152
Node: 対話的なインタプリタの変更3057194
Ref: whatsnew/2 5 interactive3057320
Ref: 17de3057320
Ref: whatsnew/2 5 interactive-interpreter-changes3057320
Ref: 17df3057320
Node: 最適化<16>3058394
Ref: whatsnew/2 5 optimizations3058520
Ref: 17e13058520
Ref: whatsnew/2 5 opts3058520
Ref: 17e23058520
Node: 新たなモジュール、改良されたモジュール、削除されたモジュール3062857
Ref: whatsnew/2 5 modules3063095
Ref: 17e33063095
Ref: whatsnew/2 5 new-improved-and-removed-modules3063095
Ref: 17e43063095
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-13092794
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-23092836
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-33092895
Node: ctypes パッケージ3092954
Ref: whatsnew/2 5 module-ctypes3093139
Ref: 17ee3093139
Ref: whatsnew/2 5 the-ctypes-package3093139
Ref: 17ef3093139
Node: ElementTree パッケージ3096775
Ref: whatsnew/2 5 module-etree3096992
Ref: 17f03096992
Ref: whatsnew/2 5 the-elementtree-package3096992
Ref: 17f13096992
Node: hashlib パッケージ3103029
Ref: whatsnew/2 5 module-hashlib3103247
Ref: 17f23103247
Ref: whatsnew/2 5 the-hashlib-package3103247
Ref: 17f33103247
Node: sqlite3 パッケージ3104979
Ref: whatsnew/2 5 module-sqlite3105193
Ref: 17f43105193
Ref: whatsnew/2 5 the-sqlite3-package3105193
Ref: 17f53105193
Ref: sqlite3 パッケージ-Footnote-13110261
Ref: sqlite3 パッケージ-Footnote-23110303
Node: wsgiref パッケージ3110345
Ref: whatsnew/2 5 module-wsgiref3110527
Ref: 17f63110527
Ref: whatsnew/2 5 the-wsgiref-package3110527
Ref: 17f73110527
Ref: wsgiref パッケージ-Footnote-13111661
Ref: wsgiref パッケージ-Footnote-23111703
Node: ビルドならびに C API の変更<10>3111745
Ref: whatsnew/2 5 build-and-c-api-changes3111978
Ref: 17f83111978
Ref: whatsnew/2 5 build-api3111978
Ref: 17f93111978
Ref: ビルドならびに C API の変更<10>-Footnote-13119287
Ref: ビルドならびに C API の変更<10>-Footnote-23119329
Ref: ビルドならびに C API の変更<10>-Footnote-33119371
Node: ポート特有の変更3119413
Ref: whatsnew/2 5 port-specific-changes3119515
Ref: 18053119515
Ref: whatsnew/2 5 ports3119515
Ref: 18063119515
Ref: ポート特有の変更-Footnote-13120286
Node: Python 2 5 への移植3120350
Ref: whatsnew/2 5 porting3120502
Ref: 18073120502
Ref: whatsnew/2 5 porting-to-python-2-53120502
Ref: 18083120502
Ref: Python 2 5 への移植-Footnote-13123788
Node: 謝辞<3>3123830
Ref: whatsnew/2 5 acknowledgements3123932
Ref: 18093123932
Node: What's New in Python 2 43124404
Ref: whatsnew/2 4 doc3124551
Ref: 180a3124551
Ref: whatsnew/2 4 translation-repo3124551
Ref: 180b3124551
Ref: whatsnew/2 4 what-s-new-in-python-2-43124551
Ref: 180c3124551
Node: PEP 218 ビルトインの集合オブジェクト3127237
Ref: whatsnew/2 4 pep-218-built-in-set-objects3127407
Ref: 180d3127407
Ref: PEP 218 ビルトインの集合オブジェクト-Footnote-13130048
Node: PEP 237 長整数と整数を一体化していく3130090
Ref: whatsnew/2 4 pep-237-unifying-long-integers-and-integers3130298
Ref: 180e3130298
Ref: PEP 237 長整数と整数を一体化していく-Footnote-13131591
Node: PEP 289 ジェネレータ式3131633
Ref: whatsnew/2 4 pep-289-generator-expressions3131849
Ref: 180f3131849
Ref: PEP 289 ジェネレータ式-Footnote-13134590
Node: PEP 292 より単純な文字列置換 string substitution3134632
Ref: whatsnew/2 4 pep-292-simpler-string-substitutions3134854
Ref: 18103134854
Ref: PEP 292 より単純な文字列置換 string substitution-Footnote-13137197
Node: PEP 318 関数とメソッドのためのデコレータ3137239
Ref: whatsnew/2 4 pep-318-decorators-for-functions-and-methods3137470
Ref: 18113137470
Ref: PEP 318 関数とメソッドのためのデコレータ-Footnote-13143172
Ref: PEP 318 関数とメソッドのためのデコレータ-Footnote-23143214
Node: PEP 322 逆順のイテレーション3143256
Ref: whatsnew/2 4 pep-322-reverse-iteration3143473
Ref: 18133143473
Ref: PEP 322 逆順のイテレーション-Footnote-13144624
Node: PEP 324 新しい subprocess モジュール3144666
Ref: whatsnew/2 4 pep-324-new-subprocess-module3144855
Ref: 18143144855
Ref: PEP 324 新しい subprocess モジュール-Footnote-13149299
Node: PEP 327 Decimal データ型3149341
Ref: whatsnew/2 4 pep-327-decimal-data-type3149533
Ref: 18163149533
Node: なぜ Decimal が必要なのか?3150107
Ref: whatsnew/2 4 why-is-decimal-needed3150226
Ref: 18173150226
Node: Decimal 型3153096
Ref: whatsnew/2 4 the-decimal-type3153235
Ref: 18183153235
Node: Context 型3156735
Ref: whatsnew/2 4 the-context-type3156831
Ref: 18193156831
Ref: Context 型-Footnote-13160077
Ref: Context 型-Footnote-23160119
Node: PEP 328 マルチラインインポート3160202
Ref: whatsnew/2 4 pep-328-multi-line-imports3160403
Ref: 181a3160403
Ref: PEP 328 マルチラインインポート-Footnote-13162218
Node: PEP 331 Locale に依存しない Float/String 変換3162260
Ref: whatsnew/2 4 pep-331-locale-independent-float-string-conversions3162461
Ref: 181b3162461
Ref: PEP 331 Locale に依存しない Float/String 変換-Footnote-13164379
Ref: PEP 331 Locale に依存しない Float/String 変換-Footnote-23164469
Node: その他の言語変更<17>3164511
Ref: whatsnew/2 4 other-language-changes3164761
Ref: 181c3164761
Ref: その他の言語変更<17>-Footnote-13172867
Ref: その他の言語変更<17>-Footnote-23172909
Ref: その他の言語変更<17>-Footnote-33172951
Ref: その他の言語変更<17>-Footnote-43172993
Ref: その他の言語変更<17>-Footnote-53173035
Ref: その他の言語変更<17>-Footnote-63173077
Node: 最適化<17>3173119
Ref: whatsnew/2 4 optimizations3173197
Ref: 181e3173197
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>3175933
Ref: whatsnew/2 4 new-improved-and-deprecated-modules3176171
Ref: 181f3176171
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>-Footnote-13196871
Node: cookielib3196930
Ref: whatsnew/2 4 cookielib3197085
Ref: 18233197085
Node: doctest<5>3198173
Ref: whatsnew/2 4 doctest3198328
Ref: 18243198328
Node: ビルドならびに C API の変更<11>3201468
Ref: whatsnew/2 4 build-and-c-api-changes3201701
Ref: 182a3201701
Node: ポート特有の変更<2>3204444
Ref: whatsnew/2 4 port-specific-changes3204549
Ref: 18313204549
Node: Python 2 4 への移植3204725
Ref: whatsnew/2 4 porting-to-python-2-43204877
Ref: 18323204877
Node: 謝辞<4>3207289
Ref: whatsnew/2 4 acknowledgements3207391
Ref: 18343207391
Ref: whatsnew/2 4 acks3207391
Ref: 18353207391
Node: What's New in Python 2 33207692
Ref: whatsnew/2 3 doc3207839
Ref: 18363207839
Ref: whatsnew/2 3 translation-repo3207839
Ref: 18373207839
Ref: whatsnew/2 3 what-s-new-in-python-2-33207839
Ref: 18383207839
Node: PEP 218 標準の集合データ型3211843
Ref: whatsnew/2 3 pep-218-a-standard-set-datatype3211983
Ref: 183a3211983
Ref: PEP 218 標準の集合データ型-Footnote-13215516
Node: PEP 255 単純なジェネレータ3215558
Ref: whatsnew/2 3 pep-255-simple-generators3215760
Ref: 183f3215760
Ref: whatsnew/2 3 section-generators3215760
Ref: 18403215760
Ref: PEP 255 単純なジェネレータ-Footnote-13225160
Ref: PEP 255 単純なジェネレータ-Footnote-23225202
Node: PEP 263 ソースコードのエンコーディング3225244
Ref: whatsnew/2 3 pep-263-source-code-encodings3225483
Ref: 18413225483
Ref: whatsnew/2 3 section-encodings3225483
Ref: 18423225483
Ref: PEP 263 ソースコードのエンコーディング-Footnote-13227148
Node: PEP 273 Zip アーカイブからモジュールをインポートする3227190
Ref: whatsnew/2 3 pep-273-importing-modules-from-zip-archives3227455
Ref: 18433227455
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-13229899
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-23229941
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-33229983
Node: PEP 277 Windows NT での Unicode ファイル名サポート3230025
Ref: whatsnew/2 3 pep-277-unicode-file-name-support-for-windows-nt3230275
Ref: 18453230275
Ref: PEP 277 Windows NT での Unicode ファイル名サポート-Footnote-13232321
Node: PEP 278 Universal Newline サポート3232363
Ref: whatsnew/2 3 pep-278-universal-newline-support3232558
Ref: 18473232558
Ref: PEP 278 Universal Newline サポート-Footnote-13234441
Node: PEP 279 enumerate3234483
Ref: whatsnew/2 3 pep-279-enumerate3234652
Ref: 18483234652
Ref: whatsnew/2 3 section-enumerate3234652
Ref: 18493234652
Ref: PEP 279 enumerate-Footnote-13235620
Node: PEP 282 ロギングパッケージ3235662
Ref: whatsnew/2 3 pep-282-the-logging-package3235812
Ref: 184a3235812
Ref: PEP 282 ロギングパッケージ-Footnote-13241241
Ref: PEP 282 ロギングパッケージ-Footnote-23241283
Node: PEP 285 Boolean 型3241325
Ref: whatsnew/2 3 pep-285-a-boolean-type3241523
Ref: 18503241523
Ref: whatsnew/2 3 section-bool3241523
Ref: 18513241523
Ref: PEP 285 Boolean 型-Footnote-13244471
Ref: PEP 285 Boolean 型-Footnote-23244513
Node: PEP 293 コーデックエラーを処理するコールバック3244555
Ref: whatsnew/2 3 pep-293-codec-error-handling-callbacks3244800
Ref: 18523244800
Ref: PEP 293 コーデックエラーを処理するコールバック-Footnote-13246734
Node: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ3246776
Ref: whatsnew/2 3 pep-301-package-index-and-metadata-for-distutils3247043
Ref: 18553247043
Ref: whatsnew/2 3 section-pep3013247043
Ref: 18563247043
Ref: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ-Footnote-13248920
Ref: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ-Footnote-23248956
Node: PEP 302 新たなインポートフック3248998
Ref: whatsnew/2 3 pep-302-new-import-hooks3249244
Ref: 18573249244
Ref: whatsnew/2 3 section-pep3023249244
Ref: 18443249244
Ref: PEP 302 新たなインポートフック-Footnote-13252979
Ref: PEP 302 新たなインポートフック-Footnote-23253021
Ref: PEP 302 新たなインポートフック-Footnote-33253063
Node: PEP 305 カンマ区切り形式ファイル3253105
Ref: whatsnew/2 3 pep-305-comma-separated-files3253299
Ref: 18583253299
Ref: whatsnew/2 3 section-pep3053253299
Ref: 18593253299
Ref: PEP 305 カンマ区切り形式ファイル-Footnote-13255093
Node: PEP 307 Pickle の機能拡張3255135
Ref: whatsnew/2 3 pep-307-pickle-enhancements3255306
Ref: 185a3255306
Ref: whatsnew/2 3 section-pep3073255306
Ref: 185b3255306
Ref: PEP 307 Pickle の機能拡張-Footnote-13257612
Ref: PEP 307 Pickle の機能拡張-Footnote-23257654
Ref: PEP 307 Pickle の機能拡張-Footnote-33257696
Node: 拡張スライス3257738
Ref: whatsnew/2 3 extended-slices3257893
Ref: 185e3257893
Ref: whatsnew/2 3 section-slices3257893
Ref: 185f3257893
Node: その他の言語変更<18>3261951
Ref: whatsnew/2 3 other-language-changes3262166
Ref: 18603262166
Ref: その他の言語変更<18>-Footnote-13271182
Node: 文字列に関する変更3271255
Ref: whatsnew/2 3 string-changes3271369
Ref: 18663271369
Node: 最適化<18>3274116
Ref: whatsnew/2 3 optimizations3274230
Ref: 186b3274230
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>3275681
Ref: whatsnew/2 3 new-improved-and-deprecated-modules3275938
Ref: 186d3275938
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>-Footnote-13303707
Node: 日付時刻型3303747
Ref: whatsnew/2 3 date-time-type3303922
Ref: 18813303922
Node: optparse モジュール3306827
Ref: whatsnew/2 3 the-optparse-module3307002
Ref: 18843307002
Node: Pymalloc 特殊化されたオブジェクトアロケータ3309559
Ref: whatsnew/2 3 pymalloc-a-specialized-object-allocator3309829
Ref: 18873309829
Ref: whatsnew/2 3 section-pymalloc3309829
Ref: 18883309829
Node: ビルドならびに C API の変更<12>3314939
Ref: whatsnew/2 3 build-and-c-api-changes3315149
Ref: 188a3315149
Node: ポート特有の変更<3>3319306
Ref: whatsnew/2 3 port-specific-changes3319411
Ref: 18903319411
Node: その他の変更と修正<2>3320640
Ref: whatsnew/2 3 other-changes-and-fixes3320813
Ref: 18913320813
Ref: whatsnew/2 3 section-other3320813
Ref: 186c3320813
Node: Python 2 3 への移植3323922
Ref: whatsnew/2 3 porting-to-python-2-33324063
Ref: 18943324063
Node: 謝辞<5>3328345
Ref: whatsnew/2 3 acknowledgements3328447
Ref: 18953328447
Ref: whatsnew/2 3 acks3328447
Ref: 18963328447
Node: What's New in Python 2 23329036
Ref: whatsnew/2 2 doc3329183
Ref: 18973329183
Ref: whatsnew/2 2 translation-repo3329183
Ref: 18983329183
Ref: whatsnew/2 2 what-s-new-in-python-2-23329183
Ref: 18993329183
Node: はじめに3330099
Ref: whatsnew/2 2 introduction3330237
Ref: 189a3330237
Ref: はじめに-Footnote-13331448
Ref: はじめに-Footnote-23331497
Node: PEP 252 と PEP 253 型とクラスについての変更3331546
Ref: whatsnew/2 2 peps-252-and-253-type-and-class-changes3331716
Ref: 189b3331716
Node: 旧と新クラス3335885
Ref: whatsnew/2 2 old-and-new-classes3336023
Ref: 189e3336023
Ref: 旧と新クラス-Footnote-13338949
Node: デスクリプタ3338991
Ref: whatsnew/2 2 descriptors3339178
Ref: 189f3339178
Node: 多重継承 ダイヤモンドルール3343402
Ref: whatsnew/2 2 multiple-inheritance-the-diamond-rule3343589
Ref: 18a13343589
Ref: 多重継承 ダイヤモンドルール-Footnote-13346615
Node: 属性アクセス3346657
Ref: whatsnew/2 2 attribute-access3346841
Ref: 18a23346841
Node: 関連リンク3350832
Ref: whatsnew/2 2 related-links3350967
Ref: 18a43350967
Ref: whatsnew/2 2 sect-rellinks3350967
Ref: 189d3350967
Ref: 関連リンク-Footnote-13352934
Ref: 関連リンク-Footnote-23352976
Ref: 関連リンク-Footnote-33353018
Ref: 関連リンク-Footnote-43353060
Ref: 関連リンク-Footnote-53353102
Node: PEP 234 イテレータ3353144
Ref: whatsnew/2 2 pep-234-iterators3353340
Ref: 18a63353340
Ref: PEP 234 イテレータ-Footnote-13358733
Node: PEP 255 単純なジェネレータ<2>3358775
Ref: whatsnew/2 2 pep-255-simple-generators3358968
Ref: 18a93358968
Ref: PEP 255 単純なジェネレータ<2>-Footnote-13368249
Ref: PEP 255 単純なジェネレータ<2>-Footnote-23368291
Node: PEP 237 長整数と整数を一体化していく<2>3368333
Ref: whatsnew/2 2 pep-237-unifying-long-integers-and-integers3368547
Ref: 18aa3368547
Ref: PEP 237 長整数と整数を一体化していく<2>-Footnote-13371021
Node: PEP 238 除算演算子を変更していく3371063
Ref: whatsnew/2 2 pep-238-changing-the-division-operator3371256
Ref: 18ab3371256
Ref: PEP 238 除算演算子を変更していく-Footnote-13375913
Ref: PEP 238 除算演算子を変更していく-Footnote-23375955
Ref: PEP 238 除算演算子を変更していく-Footnote-33375997
Node: Unicode の変更3376039
Ref: whatsnew/2 2 unicode-changes3376214
Ref: 18ad3376214
Ref: Unicode の変更-Footnote-13379469
Ref: Unicode の変更-Footnote-23379511
Node: PEP 227 入れ子状のスコープ3379553
Ref: whatsnew/2 2 pep-227-nested-scopes3379744
Ref: 18ae3379744
Ref: PEP 227 入れ子状のスコープ-Footnote-13384851
Node: 新しいモジュールと改良されたモジュール<3>3384893
Ref: whatsnew/2 2 new-and-improved-modules3385103
Ref: 18af3385103
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-13392390
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-23392449
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-33392508
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-43392567
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-53392626
Node: インタプリタの変更と修正3392684
Ref: whatsnew/2 2 interpreter-changes-and-fixes3392889
Ref: 18b43392889
Node: その他の変更と修正<3>3398489
Ref: whatsnew/2 2 other-changes-and-fixes3398643
Ref: 18c43398643
Ref: その他の変更と修正<3>-Footnote-13406422
Node: 謝辞<6>3406464
Ref: whatsnew/2 2 acknowledgements3406573
Ref: 18c73406573
Node: What's New in Python 2 13407140
Ref: whatsnew/2 1 doc3407287
Ref: 18c83407287
Ref: whatsnew/2 1 translation-repo3407287
Ref: 18c93407287
Ref: whatsnew/2 1 what-s-new-in-python-2-13407287
Ref: 18ca3407287
Node: はじめに<2>3408598
Ref: whatsnew/2 1 introduction3408721
Ref: 18cb3408721
Node: PEP 227 入れ子状のスコープ<2>3409911
Ref: whatsnew/2 1 pep-227-nested-scopes3410071
Ref: 18cc3410071
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-13415288
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-23415330
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-33415372
Node: PEP 236 __future__ 指示文3415414
Ref: whatsnew/2 1 pep-236-future-directives3415579
Ref: 18cd3415579
Ref: PEP 236 __future__ 指示文-Footnote-13417204
Node: PEP 207 拡張比較3417246
Ref: whatsnew/2 1 pep-207-rich-comparisons3417408
Ref: 18ce3417408
Ref: PEP 207 拡張比較-Footnote-13421021
Ref: PEP 207 拡張比較-Footnote-23421063
Node: PEP 230 警告フレームワーク3421105
Ref: whatsnew/2 1 pep-230-warning-framework3421277
Ref: 18d03421277
Ref: PEP 230 警告フレームワーク-Footnote-13425106
Ref: PEP 230 警告フレームワーク-Footnote-23425148
Node: PEP 229 新しいビルドシステム3425190
Ref: whatsnew/2 1 pep-229-new-build-system3425359
Ref: 18d23425359
Ref: PEP 229 新しいビルドシステム-Footnote-13428152
Node: PEP 205 弱参照3428194
Ref: whatsnew/2 1 pep-205-weak-references3428351
Ref: 18d33428351
Ref: PEP 205 弱参照-Footnote-13431920
Node: PEP 232 関数の属性3431962
Ref: whatsnew/2 1 pep-232-function-attributes3432185
Ref: 18d43432185
Ref: PEP 232 関数の属性-Footnote-13433708
Node: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み3433750
Ref: whatsnew/2 1 pep-235-importing-modules-on-case-insensitive-platforms3433995
Ref: 18d53433995
Node: PEP 217 対話モード用 Display Hook3435269
Ref: whatsnew/2 1 pep-217-interactive-display-hook3435526
Ref: 18d63435526
Ref: PEP 217 対話モード用 Display Hook-Footnote-13436511
Node: PEP 208 新しい型強制モデル3436553
Ref: whatsnew/2 1 pep-208-new-coercion-model3436780
Ref: 18d83436780
Ref: PEP 208 新しい型強制モデル-Footnote-13438734
Node: PEP 241 Pythonソフトウェアパッケージのためのメタデータ3438776
Ref: whatsnew/2 1 pep-241-metadata-in-python-packages3439024
Ref: 18d93439024
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-13441861
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-23441903
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-33441945
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-43441987
Node: 新しいモジュールと改良されたモジュール<4>3442029
Ref: whatsnew/2 1 new-and-improved-modules3442272
Ref: 18da3442272
Node: その他の変更と修正<4>3449299
Ref: whatsnew/2 1 other-changes-and-fixes3449477
Ref: 18db3449477
Node: 謝辞<7>3456285
Ref: whatsnew/2 1 acknowledgements3456394
Ref: 18df3456394
Node: What's New in Python 2 03456683
Ref: whatsnew/2 0 doc3456818
Ref: 18e03456818
Ref: whatsnew/2 0 translation-repo3456818
Ref: 18e13456818
Ref: whatsnew/2 0 what-s-new-in-python-2-03456818
Ref: 18e23456818
Node: はじめに<3>3457772
Ref: whatsnew/2 0 introduction3457890
Ref: 18e33457890
Node: Python 1 6 はいかがですか?3459077
Ref: whatsnew/2 0 what-about-python-1-63459231
Ref: 18e43459231
Node: 新しい開発プロセス3460923
Ref: whatsnew/2 0 new-development-process3461085
Ref: 18e53461085
Ref: 新しい開発プロセス-Footnote-13467998
Ref: 新しい開発プロセス-Footnote-23468040
Ref: 新しい開発プロセス-Footnote-33468082
Node: Unicode 文字列型<2>3468124
Ref: whatsnew/2 0 unicode3468277
Ref: 18e63468277
Ref: Unicode 文字列型<2>-Footnote-13476873
Node: リストの内包表記3476915
Ref: whatsnew/2 0 list-comprehensions3477074
Ref: 18e73477074
Node: 累算代入 Augmented Assignment3481502
Ref: whatsnew/2 0 augmented-assignment3481659
Ref: 18e83481659
Node: 文字列メソッド3483264
Ref: whatsnew/2 0 string-methods3483442
Ref: 18e93483442
Node: 循環参照のガベージコレクション3485493
Ref: whatsnew/2 0 garbage-collection-of-cycles3485671
Ref: 18ea3485671
Node: その他の言語コアの変更3490603
Ref: whatsnew/2 0 other-core-changes3490783
Ref: 18eb3490783
Node: 言語のマイナー変更3491137
Ref: whatsnew/2 0 minor-language-changes3491273
Ref: 18ec3491273
Node: ビルトイン関数の変更3496831
Ref: whatsnew/2 0 changes-to-built-in-functions3496967
Ref: 18f03496967
Node: Python 2 0 への移植3499848
Ref: whatsnew/2 0 porting-to-2-03500025
Ref: 18f13500025
Node: 拡張と埋め込みについての変更3506213
Ref: whatsnew/2 0 extending-embedding-changes3506409
Ref: 18f33506409
Node: Distutils モジュールの簡単インストール3511897
Ref: whatsnew/2 0 distutils-making-modules-easy-to-install3512089
Ref: 18f83512089
Node: XML モジュール3516032
Ref: whatsnew/2 0 xml-modules3516212
Ref: 18f93516212
Node: SAX2 サポート3517127
Ref: whatsnew/2 0 sax2-support3517225
Ref: 18fa3517225
Node: DOM サポート3519083
Ref: whatsnew/2 0 dom-support3519208
Ref: 18fe3519208
Node: PyXML との関係3522276
Ref: whatsnew/2 0 relationship-to-pyxml3522375
Ref: 18ff3522375
Node: 更新されたモジュール3523850
Ref: whatsnew/2 0 module-changes3524005
Ref: 19003524005
Node: 新しいモジュール<2>3526710
Ref: whatsnew/2 0 new-modules3526860
Ref: 19013526860
Node: IDLE の改善3531559
Ref: whatsnew/2 0 idle-improvements3531748
Ref: 19023531748
Node: 削除されたモジュール、非推奨となったモジュール3533464
Ref: whatsnew/2 0 deleted-and-deprecated-modules3533635
Ref: 19033533635
Node: 謝辞<8>3534434
Ref: whatsnew/2 0 acknowledgements3534582
Ref: 19043534582
Ref: 謝辞<8>-Footnote-13535215
Ref: 謝辞<8>-Footnote-23535279
Node: 変更履歴3535319
Ref: whatsnew/changelog doc3535421
Ref: 19053535421
Ref: whatsnew/changelog changelog3535421
Ref: 1453535421
Ref: whatsnew/changelog id13535421
Ref: 19063535421
Ref: whatsnew/changelog translation-repo3535421
Ref: 19073535421
Node: Python next3541362
Ref: whatsnew/changelog python-next3541451
Ref: 19083541451
Node: Windows3541643
Ref: whatsnew/changelog windows3541716
Ref: 19093541716
Ref: Windows-Footnote-13542234
Ref: Windows-Footnote-23542290
Ref: Windows-Footnote-33542346
Ref: Windows-Footnote-43542402
Node: テスト3542444
Ref: whatsnew/changelog tests3542544
Ref: 190a3542544
Ref: テスト-Footnote-13542757
Node: セキュリティ3542813
Ref: whatsnew/changelog security3542921
Ref: 190b3542921
Ref: セキュリティ-Footnote-13544503
Ref: セキュリティ-Footnote-23544559
Ref: セキュリティ-Footnote-33544595
Ref: セキュリティ-Footnote-43544651
Ref: セキュリティ-Footnote-53544706
Ref: セキュリティ-Footnote-63544762
Ref: セキュリティ-Footnote-73544804
Ref: セキュリティ-Footnote-83544860
Node: ライブラリ3544916
Ref: whatsnew/changelog library3545032
Ref: 190c3545032
Ref: ライブラリ-Footnote-13551098
Ref: ライブラリ-Footnote-23551154
Ref: ライブラリ-Footnote-33551210
Ref: ライブラリ-Footnote-43551265
Ref: ライブラリ-Footnote-53551321
Ref: ライブラリ-Footnote-63551377
Ref: ライブラリ-Footnote-73551433
Ref: ライブラリ-Footnote-83551489
Ref: ライブラリ-Footnote-93551545
Ref: ライブラリ-Footnote-103551601
Ref: ライブラリ-Footnote-113551658
Ref: ライブラリ-Footnote-123551715
Ref: ライブラリ-Footnote-133551772
Ref: ライブラリ-Footnote-143551829
Ref: ライブラリ-Footnote-153551886
Ref: ライブラリ-Footnote-163551943
Ref: ライブラリ-Footnote-173552000
Ref: ライブラリ-Footnote-183552057
Ref: ライブラリ-Footnote-193552114
Ref: ライブラリ-Footnote-203552171
Ref: ライブラリ-Footnote-213552228
Ref: ライブラリ-Footnote-223552285
Ref: ライブラリ-Footnote-233552342
Ref: ライブラリ-Footnote-243552399
Ref: ライブラリ-Footnote-253552456
Ref: ライブラリ-Footnote-263552513
Ref: ライブラリ-Footnote-273552570
Ref: ライブラリ-Footnote-283552627
Ref: ライブラリ-Footnote-293552684
Ref: ライブラリ-Footnote-303552741
Ref: ライブラリ-Footnote-313552798
Ref: ライブラリ-Footnote-323552854
Ref: ライブラリ-Footnote-333552911
Ref: ライブラリ-Footnote-343552971
Node: Core and Builtins3553037
Ref: whatsnew/changelog core-and-builtins3553140
Ref: 19123553140
Ref: Core and Builtins-Footnote-13554493
Ref: Core and Builtins-Footnote-23554549
Ref: Core and Builtins-Footnote-33554605
Ref: Core and Builtins-Footnote-43554661
Ref: Core and Builtins-Footnote-53554717
Ref: Core and Builtins-Footnote-63554773
Ref: Core and Builtins-Footnote-73554829
Ref: Core and Builtins-Footnote-83554885
Ref: Core and Builtins-Footnote-93554941
Ref: Core and Builtins-Footnote-103554997
Node: C API3555053
Ref: whatsnew/changelog c-api3555150
Ref: 19133555150
Ref: C API-Footnote-13555608
Ref: C API-Footnote-23555664
Node: ビルド3555720
Ref: whatsnew/changelog build3555791
Ref: 19183555791
Ref: ビルド-Footnote-13555994
Node: Python 3 15 0 beta 13556050
Ref: whatsnew/changelog python-3-15-0-beta-13556169
Ref: 19193556169
Node: セキュリティ<2>3556559
Ref: whatsnew/changelog id23556666
Ref: 191a3556666
Ref: セキュリティ<2>-Footnote-13559477
Ref: セキュリティ<2>-Footnote-23559533
Ref: セキュリティ<2>-Footnote-33559589
Ref: セキュリティ<2>-Footnote-43559625
Ref: セキュリティ<2>-Footnote-53559681
Ref: セキュリティ<2>-Footnote-63559736
Ref: セキュリティ<2>-Footnote-73559792
Ref: セキュリティ<2>-Footnote-83559848
Ref: セキュリティ<2>-Footnote-93559904
Ref: セキュリティ<2>-Footnote-103559960
Ref: セキュリティ<2>-Footnote-113560017
Ref: セキュリティ<2>-Footnote-123560074
Ref: セキュリティ<2>-Footnote-133560131
Ref: セキュリティ<2>-Footnote-143560188
Node: Core and Builtins<2>3560245
Ref: whatsnew/changelog id43560379
Ref: 191e3560379
Ref: Core and Builtins<2>-Footnote-13570219
Ref: Core and Builtins<2>-Footnote-23570275
Ref: Core and Builtins<2>-Footnote-33570331
Ref: Core and Builtins<2>-Footnote-43570387
Ref: Core and Builtins<2>-Footnote-53570443
Ref: Core and Builtins<2>-Footnote-63570499
Ref: Core and Builtins<2>-Footnote-73570555
Ref: Core and Builtins<2>-Footnote-83570611
Ref: Core and Builtins<2>-Footnote-93570667
Ref: Core and Builtins<2>-Footnote-103570722
Ref: Core and Builtins<2>-Footnote-113570779
Ref: Core and Builtins<2>-Footnote-123570836
Ref: Core and Builtins<2>-Footnote-133570893
Ref: Core and Builtins<2>-Footnote-143570950
Ref: Core and Builtins<2>-Footnote-153570993
Ref: Core and Builtins<2>-Footnote-163571050
Ref: Core and Builtins<2>-Footnote-173571107
Ref: Core and Builtins<2>-Footnote-183571164
Ref: Core and Builtins<2>-Footnote-193571221
Ref: Core and Builtins<2>-Footnote-203571278
Ref: Core and Builtins<2>-Footnote-213571335
Ref: Core and Builtins<2>-Footnote-223571392
Ref: Core and Builtins<2>-Footnote-233571449
Ref: Core and Builtins<2>-Footnote-243571506
Ref: Core and Builtins<2>-Footnote-253571563
Ref: Core and Builtins<2>-Footnote-263571620
Ref: Core and Builtins<2>-Footnote-273571677
Ref: Core and Builtins<2>-Footnote-283571734
Ref: Core and Builtins<2>-Footnote-293571791
Ref: Core and Builtins<2>-Footnote-303571848
Ref: Core and Builtins<2>-Footnote-313571905
Ref: Core and Builtins<2>-Footnote-323571962
Ref: Core and Builtins<2>-Footnote-333572019
Ref: Core and Builtins<2>-Footnote-343572076
Ref: Core and Builtins<2>-Footnote-353572132
Ref: Core and Builtins<2>-Footnote-363572189
Ref: Core and Builtins<2>-Footnote-373572246
Ref: Core and Builtins<2>-Footnote-383572303
Ref: Core and Builtins<2>-Footnote-393572360
Ref: Core and Builtins<2>-Footnote-403572417
Ref: Core and Builtins<2>-Footnote-413572474
Ref: Core and Builtins<2>-Footnote-423572531
Ref: Core and Builtins<2>-Footnote-433572588
Ref: Core and Builtins<2>-Footnote-443572645
Ref: Core and Builtins<2>-Footnote-453572702
Ref: Core and Builtins<2>-Footnote-463572759
Ref: Core and Builtins<2>-Footnote-473572815
Ref: Core and Builtins<2>-Footnote-483572872
Ref: Core and Builtins<2>-Footnote-493572929
Ref: Core and Builtins<2>-Footnote-503572986
Ref: Core and Builtins<2>-Footnote-513573043
Ref: Core and Builtins<2>-Footnote-523573100
Ref: Core and Builtins<2>-Footnote-533573157
Ref: Core and Builtins<2>-Footnote-543573200
Node: ライブラリ<2>3573257
Ref: whatsnew/changelog id53573391
Ref: 19213573391
Ref: ライブラリ<2>-Footnote-13596127
Ref: ライブラリ<2>-Footnote-23596183
Ref: ライブラリ<2>-Footnote-33596239
Ref: ライブラリ<2>-Footnote-43596295
Ref: ライブラリ<2>-Footnote-53596351
Ref: ライブラリ<2>-Footnote-63596407
Ref: ライブラリ<2>-Footnote-73596463
Ref: ライブラリ<2>-Footnote-83596519
Ref: ライブラリ<2>-Footnote-93596575
Ref: ライブラリ<2>-Footnote-103596631
Ref: ライブラリ<2>-Footnote-113596688
Ref: ライブラリ<2>-Footnote-123596745
Ref: ライブラリ<2>-Footnote-133596802
Ref: ライブラリ<2>-Footnote-143596859
Ref: ライブラリ<2>-Footnote-153596916
Ref: ライブラリ<2>-Footnote-163596973
Ref: ライブラリ<2>-Footnote-173597030
Ref: ライブラリ<2>-Footnote-183597087
Ref: ライブラリ<2>-Footnote-193597144
Ref: ライブラリ<2>-Footnote-203597201
Ref: ライブラリ<2>-Footnote-213597258
Ref: ライブラリ<2>-Footnote-223597315
Ref: ライブラリ<2>-Footnote-233597372
Ref: ライブラリ<2>-Footnote-243597429
Ref: ライブラリ<2>-Footnote-253597486
Ref: ライブラリ<2>-Footnote-263597543
Ref: ライブラリ<2>-Footnote-273597600
Ref: ライブラリ<2>-Footnote-283597656
Ref: ライブラリ<2>-Footnote-293597713
Ref: ライブラリ<2>-Footnote-303597770
Ref: ライブラリ<2>-Footnote-313597827
Ref: ライブラリ<2>-Footnote-323597884
Ref: ライブラリ<2>-Footnote-333597941
Ref: ライブラリ<2>-Footnote-343597998
Ref: ライブラリ<2>-Footnote-353598055
Ref: ライブラリ<2>-Footnote-363598112
Ref: ライブラリ<2>-Footnote-373598169
Ref: ライブラリ<2>-Footnote-383598226
Ref: ライブラリ<2>-Footnote-393598286
Ref: ライブラリ<2>-Footnote-403598343
Ref: ライブラリ<2>-Footnote-413598400
Ref: ライブラリ<2>-Footnote-423598457
Ref: ライブラリ<2>-Footnote-433598514
Ref: ライブラリ<2>-Footnote-443598571
Ref: ライブラリ<2>-Footnote-453598628
Ref: ライブラリ<2>-Footnote-463598685
Ref: ライブラリ<2>-Footnote-473598742
Ref: ライブラリ<2>-Footnote-483598799
Ref: ライブラリ<2>-Footnote-493598856
Ref: ライブラリ<2>-Footnote-503598913
Ref: ライブラリ<2>-Footnote-513598970
Ref: ライブラリ<2>-Footnote-523599027
Ref: ライブラリ<2>-Footnote-533599070
Ref: ライブラリ<2>-Footnote-543599127
Ref: ライブラリ<2>-Footnote-553599170
Ref: ライブラリ<2>-Footnote-563599227
Ref: ライブラリ<2>-Footnote-573599284
Ref: ライブラリ<2>-Footnote-583599341
Ref: ライブラリ<2>-Footnote-593599398
Ref: ライブラリ<2>-Footnote-603599455
Ref: ライブラリ<2>-Footnote-613599512
Ref: ライブラリ<2>-Footnote-623599569
Ref: ライブラリ<2>-Footnote-633599626
Ref: ライブラリ<2>-Footnote-643599683
Ref: ライブラリ<2>-Footnote-653599740
Ref: ライブラリ<2>-Footnote-663599797
Ref: ライブラリ<2>-Footnote-673599854
Ref: ライブラリ<2>-Footnote-683599911
Ref: ライブラリ<2>-Footnote-693599968
Ref: ライブラリ<2>-Footnote-703600025
Ref: ライブラリ<2>-Footnote-713600082
Ref: ライブラリ<2>-Footnote-723600139
Ref: ライブラリ<2>-Footnote-733600196
Ref: ライブラリ<2>-Footnote-743600253
Ref: ライブラリ<2>-Footnote-753600310
Ref: ライブラリ<2>-Footnote-763600367
Ref: ライブラリ<2>-Footnote-773600424
Ref: ライブラリ<2>-Footnote-783600481
Ref: ライブラリ<2>-Footnote-793600538
Ref: ライブラリ<2>-Footnote-803600595
Ref: ライブラリ<2>-Footnote-813600652
Ref: ライブラリ<2>-Footnote-823600709
Ref: ライブラリ<2>-Footnote-833600766
Ref: ライブラリ<2>-Footnote-843600823
Ref: ライブラリ<2>-Footnote-853600880
Ref: ライブラリ<2>-Footnote-863600937
Ref: ライブラリ<2>-Footnote-873600994
Ref: ライブラリ<2>-Footnote-883601051
Ref: ライブラリ<2>-Footnote-893601108
Ref: ライブラリ<2>-Footnote-903601165
Ref: ライブラリ<2>-Footnote-913601222
Ref: ライブラリ<2>-Footnote-923601279
Ref: ライブラリ<2>-Footnote-933601336
Ref: ライブラリ<2>-Footnote-943601393
Ref: ライブラリ<2>-Footnote-953601450
Ref: ライブラリ<2>-Footnote-963601506
Ref: ライブラリ<2>-Footnote-973601563
Ref: ライブラリ<2>-Footnote-983601620
Ref: ライブラリ<2>-Footnote-993601677
Ref: ライブラリ<2>-Footnote-1003601734
Ref: ライブラリ<2>-Footnote-1013601792
Ref: ライブラリ<2>-Footnote-1023601850
Ref: ライブラリ<2>-Footnote-1033601908
Ref: ライブラリ<2>-Footnote-1043601966
Ref: ライブラリ<2>-Footnote-1053602023
Ref: ライブラリ<2>-Footnote-1063602081
Ref: ライブラリ<2>-Footnote-1073602139
Ref: ライブラリ<2>-Footnote-1083602197
Ref: ライブラリ<2>-Footnote-1093602255
Ref: ライブラリ<2>-Footnote-1103602313
Ref: ライブラリ<2>-Footnote-1113602371
Ref: ライブラリ<2>-Footnote-1123602429
Ref: ライブラリ<2>-Footnote-1133602487
Ref: ライブラリ<2>-Footnote-1143602545
Ref: ライブラリ<2>-Footnote-1153602606
Ref: ライブラリ<2>-Footnote-1163602663
Ref: ライブラリ<2>-Footnote-1173602724
Ref: ライブラリ<2>-Footnote-1183602781
Ref: ライブラリ<2>-Footnote-1193602842
Ref: ライブラリ<2>-Footnote-1203602899
Ref: ライブラリ<2>-Footnote-1213602957
Ref: ライブラリ<2>-Footnote-1223603014
Node: ドキュメント<2>3603071
Ref: whatsnew/changelog documentation3603197
Ref: 19353603197
Ref: ドキュメント<2>-Footnote-13603713
Ref: ドキュメント<2>-Footnote-23603769
Node: テスト<2>3603825
Ref: whatsnew/changelog id63603945
Ref: 19373603945
Ref: テスト<2>-Footnote-13604217
Ref: テスト<2>-Footnote-23604273
Node: ビルド<2>3604329
Ref: whatsnew/changelog id73604438
Ref: 19383604438
Ref: ビルド<2>-Footnote-13607043
Ref: ビルド<2>-Footnote-23607099
Ref: ビルド<2>-Footnote-33607155
Ref: ビルド<2>-Footnote-43607211
Ref: ビルド<2>-Footnote-53607267
Ref: ビルド<2>-Footnote-63607323
Ref: ビルド<2>-Footnote-73607379
Ref: ビルド<2>-Footnote-83607435
Ref: ビルド<2>-Footnote-93607491
Ref: ビルド<2>-Footnote-103607547
Ref: ビルド<2>-Footnote-113607604
Ref: ビルド<2>-Footnote-123607661
Ref: ビルド<2>-Footnote-133607718
Ref: ビルド<2>-Footnote-143607775
Node: Windows<2>3607832
Ref: whatsnew/changelog id83607934
Ref: 193a3607934
Ref: Windows<2>-Footnote-13608405
Ref: Windows<2>-Footnote-23608461
Ref: Windows<2>-Footnote-33608517
Node: macOS3608573
Ref: whatsnew/changelog macos3608670
Ref: 193b3608670
Ref: macOS-Footnote-13608992
Ref: macOS-Footnote-23609048
Node: IDLE<3>3609104
Ref: whatsnew/changelog idle3609199
Ref: 193c3609199
Ref: IDLE<3>-Footnote-13609639
Ref: IDLE<3>-Footnote-23609694
Ref: IDLE<3>-Footnote-33609750
Node: C API<2>3609805
Ref: whatsnew/changelog id93609886
Ref: 193d3609886
Ref: C API<2>-Footnote-13611843
Ref: C API<2>-Footnote-23611899
Ref: C API<2>-Footnote-33611955
Ref: C API<2>-Footnote-43612011
Ref: C API<2>-Footnote-53612053
Ref: C API<2>-Footnote-63612109
Ref: C API<2>-Footnote-73612151
Ref: C API<2>-Footnote-83612207
Ref: C API<2>-Footnote-93612263
Ref: C API<2>-Footnote-103612319
Ref: C API<2>-Footnote-113612362
Ref: C API<2>-Footnote-123612419
Ref: C API<2>-Footnote-133612476
Node: Python 3 15 0 alpha 83612533
Ref: whatsnew/changelog python-3-15-0-alpha-83612662
Ref: 19413612662
Node: セキュリティ<3>3613062
Ref: whatsnew/changelog id103613170
Ref: 19423613170
Ref: セキュリティ<3>-Footnote-13613762
Ref: セキュリティ<3>-Footnote-23613818
Ref: セキュリティ<3>-Footnote-33613873
Ref: セキュリティ<3>-Footnote-43613929
Ref: セキュリティ<3>-Footnote-53613984
Node: Core and Builtins<3>3614040
Ref: whatsnew/changelog id113614175
Ref: 19453614175
Ref: Core and Builtins<3>-Footnote-13622826
Ref: Core and Builtins<3>-Footnote-23622882
Ref: Core and Builtins<3>-Footnote-33622935
Ref: Core and Builtins<3>-Footnote-43622991
Ref: Core and Builtins<3>-Footnote-53623047
Ref: Core and Builtins<3>-Footnote-63623103
Ref: Core and Builtins<3>-Footnote-73623159
Ref: Core and Builtins<3>-Footnote-83623215
Ref: Core and Builtins<3>-Footnote-93623271
Ref: Core and Builtins<3>-Footnote-103623327
Ref: Core and Builtins<3>-Footnote-113623384
Ref: Core and Builtins<3>-Footnote-123623441
Ref: Core and Builtins<3>-Footnote-133623498
Ref: Core and Builtins<3>-Footnote-143623555
Ref: Core and Builtins<3>-Footnote-153623612
Ref: Core and Builtins<3>-Footnote-163623669
Ref: Core and Builtins<3>-Footnote-173623726
Ref: Core and Builtins<3>-Footnote-183623783
Ref: Core and Builtins<3>-Footnote-193623840
Ref: Core and Builtins<3>-Footnote-203623897
Ref: Core and Builtins<3>-Footnote-213623954
Ref: Core and Builtins<3>-Footnote-223624011
Ref: Core and Builtins<3>-Footnote-233624068
Ref: Core and Builtins<3>-Footnote-243624125
Ref: Core and Builtins<3>-Footnote-253624182
Ref: Core and Builtins<3>-Footnote-263624239
Ref: Core and Builtins<3>-Footnote-273624296
Ref: Core and Builtins<3>-Footnote-283624353
Ref: Core and Builtins<3>-Footnote-293624410
Ref: Core and Builtins<3>-Footnote-303624467
Ref: Core and Builtins<3>-Footnote-313624524
Ref: Core and Builtins<3>-Footnote-323624581
Ref: Core and Builtins<3>-Footnote-333624638
Ref: Core and Builtins<3>-Footnote-343624695
Ref: Core and Builtins<3>-Footnote-353624752
Ref: Core and Builtins<3>-Footnote-363624809
Ref: Core and Builtins<3>-Footnote-373624866
Ref: Core and Builtins<3>-Footnote-383624923
Ref: Core and Builtins<3>-Footnote-393624980
Ref: Core and Builtins<3>-Footnote-403625037
Ref: Core and Builtins<3>-Footnote-413625094
Ref: Core and Builtins<3>-Footnote-423625151
Ref: Core and Builtins<3>-Footnote-433625208
Ref: Core and Builtins<3>-Footnote-443625262
Ref: Core and Builtins<3>-Footnote-453625319
Ref: Core and Builtins<3>-Footnote-463625376
Ref: Core and Builtins<3>-Footnote-473625433
Ref: Core and Builtins<3>-Footnote-483625490
Ref: Core and Builtins<3>-Footnote-493625546
Ref: Core and Builtins<3>-Footnote-503625603
Ref: Core and Builtins<3>-Footnote-513625660
Ref: Core and Builtins<3>-Footnote-523625717
Ref: Core and Builtins<3>-Footnote-533625774
Ref: Core and Builtins<3>-Footnote-543625831
Node: ライブラリ<3>3625888
Ref: whatsnew/changelog id123626023
Ref: 194a3626023
Ref: ライブラリ<3>-Footnote-13641915
Ref: ライブラリ<3>-Footnote-23641971
Ref: ライブラリ<3>-Footnote-33642027
Ref: ライブラリ<3>-Footnote-43642082
Ref: ライブラリ<3>-Footnote-53642138
Ref: ライブラリ<3>-Footnote-63642194
Ref: ライブラリ<3>-Footnote-73642250
Ref: ライブラリ<3>-Footnote-83642306
Ref: ライブラリ<3>-Footnote-93642362
Ref: ライブラリ<3>-Footnote-103642407
Ref: ライブラリ<3>-Footnote-113642464
Ref: ライブラリ<3>-Footnote-123642521
Ref: ライブラリ<3>-Footnote-133642578
Ref: ライブラリ<3>-Footnote-143642635
Ref: ライブラリ<3>-Footnote-153642692
Ref: ライブラリ<3>-Footnote-163642749
Ref: ライブラリ<3>-Footnote-173642806
Ref: ライブラリ<3>-Footnote-183642863
Ref: ライブラリ<3>-Footnote-193642920
Ref: ライブラリ<3>-Footnote-203642977
Ref: ライブラリ<3>-Footnote-213643034
Ref: ライブラリ<3>-Footnote-223643091
Ref: ライブラリ<3>-Footnote-233643148
Ref: ライブラリ<3>-Footnote-243643205
Ref: ライブラリ<3>-Footnote-253643262
Ref: ライブラリ<3>-Footnote-263643319
Ref: ライブラリ<3>-Footnote-273643376
Ref: ライブラリ<3>-Footnote-283643433
Ref: ライブラリ<3>-Footnote-293643470
Ref: ライブラリ<3>-Footnote-303643527
Ref: ライブラリ<3>-Footnote-313643584
Ref: ライブラリ<3>-Footnote-323643641
Ref: ライブラリ<3>-Footnote-333643698
Ref: ライブラリ<3>-Footnote-343643752
Ref: ライブラリ<3>-Footnote-353643809
Ref: ライブラリ<3>-Footnote-363643866
Ref: ライブラリ<3>-Footnote-373643923
Ref: ライブラリ<3>-Footnote-383643980
Ref: ライブラリ<3>-Footnote-393644037
Ref: ライブラリ<3>-Footnote-403644091
Ref: ライブラリ<3>-Footnote-413644145
Ref: ライブラリ<3>-Footnote-423644202
Ref: ライブラリ<3>-Footnote-433644259
Ref: ライブラリ<3>-Footnote-443644316
Ref: ライブラリ<3>-Footnote-453644373
Ref: ライブラリ<3>-Footnote-463644430
Ref: ライブラリ<3>-Footnote-473644484
Ref: ライブラリ<3>-Footnote-483644541
Ref: ライブラリ<3>-Footnote-493644598
Ref: ライブラリ<3>-Footnote-503644655
Ref: ライブラリ<3>-Footnote-513644712
Ref: ライブラリ<3>-Footnote-523644769
Ref: ライブラリ<3>-Footnote-533644826
Ref: ライブラリ<3>-Footnote-543644883
Ref: ライブラリ<3>-Footnote-553644940
Ref: ライブラリ<3>-Footnote-563644997
Ref: ライブラリ<3>-Footnote-573645054
Ref: ライブラリ<3>-Footnote-583645111
Ref: ライブラリ<3>-Footnote-593645168
Ref: ライブラリ<3>-Footnote-603645228
Ref: ライブラリ<3>-Footnote-613645285
Ref: ライブラリ<3>-Footnote-623645342
Ref: ライブラリ<3>-Footnote-633645399
Ref: ライブラリ<3>-Footnote-643645456
Ref: ライブラリ<3>-Footnote-653645513
Ref: ライブラリ<3>-Footnote-663645570
Ref: ライブラリ<3>-Footnote-673645627
Ref: ライブラリ<3>-Footnote-683645684
Ref: ライブラリ<3>-Footnote-693645741
Ref: ライブラリ<3>-Footnote-703645798
Ref: ライブラリ<3>-Footnote-713645855
Ref: ライブラリ<3>-Footnote-723645912
Ref: ライブラリ<3>-Footnote-733645969
Ref: ライブラリ<3>-Footnote-743646026
Ref: ライブラリ<3>-Footnote-753646083
Ref: ライブラリ<3>-Footnote-763646140
Ref: ライブラリ<3>-Footnote-773646197
Ref: ライブラリ<3>-Footnote-783646253
Ref: ライブラリ<3>-Footnote-793646309
Node: ドキュメント<3>3646375
Ref: whatsnew/changelog id143646502
Ref: 19583646502
Ref: ドキュメント<3>-Footnote-13646923
Ref: ドキュメント<3>-Footnote-23646979
Ref: ドキュメント<3>-Footnote-33647035
Node: テスト<3>3647081
Ref: whatsnew/changelog id153647202
Ref: 19593647202
Ref: テスト<3>-Footnote-13647628
Ref: テスト<3>-Footnote-23647684
Node: ビルド<3>3647740
Ref: whatsnew/changelog id163647850
Ref: 195a3647850
Ref: ビルド<3>-Footnote-13649448
Ref: ビルド<3>-Footnote-23649504
Ref: ビルド<3>-Footnote-33649560
Ref: ビルド<3>-Footnote-43649616
Ref: ビルド<3>-Footnote-53649672
Ref: ビルド<3>-Footnote-63649728
Ref: ビルド<3>-Footnote-73649784
Ref: ビルド<3>-Footnote-83649840
Ref: ビルド<3>-Footnote-93649896
Ref: ビルド<3>-Footnote-103649952
Ref: ビルド<3>-Footnote-113650009
Node: Windows<3>3650065
Ref: whatsnew/changelog id173650171
Ref: 195c3650171
Ref: Windows<3>-Footnote-13650362
Node: macOS<2>3650418
Ref: whatsnew/changelog id183650523
Ref: 195d3650523
Ref: macOS<2>-Footnote-13650705
Node: Tools/Demos3650761
Ref: whatsnew/changelog tools-demos3650864
Ref: 195e3650864
Ref: Tools/Demos-Footnote-13651355
Ref: Tools/Demos-Footnote-23651411
Ref: Tools/Demos-Footnote-33651467
Ref: Tools/Demos-Footnote-43651513
Node: C API<3>3651569
Ref: whatsnew/changelog id193651655
Ref: 195f3651655
Ref: C API<3>-Footnote-13652917
Ref: C API<3>-Footnote-23652973
Ref: C API<3>-Footnote-33653029
Ref: C API<3>-Footnote-43653085
Ref: C API<3>-Footnote-53653141
Node: Python 3 15 0 alpha 73653197
Ref: whatsnew/changelog python-3-15-0-alpha-73653327
Ref: 19603653327
Node: Windows<4>3653692
Ref: whatsnew/changelog id203653781
Ref: 19613653781
Ref: Windows<4>-Footnote-13654140
Ref: Windows<4>-Footnote-23654196
Ref: Windows<4>-Footnote-33654252
Node: テスト<4>3654308
Ref: whatsnew/changelog id213654427
Ref: 19623654427
Ref: テスト<4>-Footnote-13654874
Ref: テスト<4>-Footnote-23654930
Node: セキュリティ<4>3654986
Ref: whatsnew/changelog id223655113
Ref: 19633655113
Ref: セキュリティ<4>-Footnote-13655533
Ref: セキュリティ<4>-Footnote-23655589
Ref: セキュリティ<4>-Footnote-33655644
Node: ライブラリ<4>3655700
Ref: whatsnew/changelog id233655836
Ref: 19653655836
Ref: ライブラリ<4>-Footnote-13665836
Ref: ライブラリ<4>-Footnote-23665892
Ref: ライブラリ<4>-Footnote-33665948
Ref: ライブラリ<4>-Footnote-43666004
Ref: ライブラリ<4>-Footnote-53666060
Ref: ライブラリ<4>-Footnote-63666116
Ref: ライブラリ<4>-Footnote-73666172
Ref: ライブラリ<4>-Footnote-83666228
Ref: ライブラリ<4>-Footnote-93666284
Ref: ライブラリ<4>-Footnote-103666339
Ref: ライブラリ<4>-Footnote-113666396
Ref: ライブラリ<4>-Footnote-123666453
Ref: ライブラリ<4>-Footnote-133666509
Ref: ライブラリ<4>-Footnote-143666594
Ref: ライブラリ<4>-Footnote-153666651
Ref: ライブラリ<4>-Footnote-163666694
Ref: ライブラリ<4>-Footnote-173666751
Ref: ライブラリ<4>-Footnote-183666808
Ref: ライブラリ<4>-Footnote-193666865
Ref: ライブラリ<4>-Footnote-203666922
Ref: ライブラリ<4>-Footnote-213666978
Ref: ライブラリ<4>-Footnote-223667035
Ref: ライブラリ<4>-Footnote-233667092
Ref: ライブラリ<4>-Footnote-243667149
Ref: ライブラリ<4>-Footnote-253667206
Ref: ライブラリ<4>-Footnote-263667263
Ref: ライブラリ<4>-Footnote-273667320
Ref: ライブラリ<4>-Footnote-283667377
Ref: ライブラリ<4>-Footnote-293667434
Ref: ライブラリ<4>-Footnote-303667491
Ref: ライブラリ<4>-Footnote-313667548
Ref: ライブラリ<4>-Footnote-323667605
Ref: ライブラリ<4>-Footnote-333667662
Ref: ライブラリ<4>-Footnote-343667719
Ref: ライブラリ<4>-Footnote-353667779
Ref: ライブラリ<4>-Footnote-363667835
Ref: ライブラリ<4>-Footnote-373667891
Ref: ライブラリ<4>-Footnote-383667948
Ref: ライブラリ<4>-Footnote-393668005
Ref: ライブラリ<4>-Footnote-403668062
Ref: ライブラリ<4>-Footnote-413668119
Ref: ライブラリ<4>-Footnote-423668176
Ref: ライブラリ<4>-Footnote-433668233
Ref: ライブラリ<4>-Footnote-443668290
Ref: ライブラリ<4>-Footnote-453668347
Ref: ライブラリ<4>-Footnote-463668404
Ref: ライブラリ<4>-Footnote-473668461
Ref: ライブラリ<4>-Footnote-483668517
Ref: ライブラリ<4>-Footnote-493668574
Ref: ライブラリ<4>-Footnote-503668631
Ref: ライブラリ<4>-Footnote-513668688
Ref: ライブラリ<4>-Footnote-523668745
Ref: ライブラリ<4>-Footnote-533668802
Ref: ライブラリ<4>-Footnote-543668859
Ref: ライブラリ<4>-Footnote-553668916
Ref: ライブラリ<4>-Footnote-563668973
Ref: ライブラリ<4>-Footnote-573669029
Ref: ライブラリ<4>-Footnote-583669095
Ref: ライブラリ<4>-Footnote-593669161
Ref: ライブラリ<4>-Footnote-603669227
Ref: ライブラリ<4>-Footnote-613669292
Node: ドキュメント<4>3669358
Ref: whatsnew/changelog id243669493
Ref: 196f3669493
Ref: ドキュメント<4>-Footnote-13670053
Ref: ドキュメント<4>-Footnote-23670109
Ref: ドキュメント<4>-Footnote-33670165
Node: Core and Builtins<4>3670221
Ref: whatsnew/changelog id253670346
Ref: 19723670346
Ref: Core and Builtins<4>-Footnote-13676660
Ref: Core and Builtins<4>-Footnote-23676716
Ref: Core and Builtins<4>-Footnote-33676769
Ref: Core and Builtins<4>-Footnote-43676825
Ref: Core and Builtins<4>-Footnote-53676881
Ref: Core and Builtins<4>-Footnote-63676937
Ref: Core and Builtins<4>-Footnote-73676993
Ref: Core and Builtins<4>-Footnote-83677046
Ref: Core and Builtins<4>-Footnote-93677102
Ref: Core and Builtins<4>-Footnote-103677158
Ref: Core and Builtins<4>-Footnote-113677215
Ref: Core and Builtins<4>-Footnote-123677272
Ref: Core and Builtins<4>-Footnote-133677329
Ref: Core and Builtins<4>-Footnote-143677386
Ref: Core and Builtins<4>-Footnote-153677443
Ref: Core and Builtins<4>-Footnote-163677500
Ref: Core and Builtins<4>-Footnote-173677557
Ref: Core and Builtins<4>-Footnote-183677614
Ref: Core and Builtins<4>-Footnote-193677671
Ref: Core and Builtins<4>-Footnote-203677728
Ref: Core and Builtins<4>-Footnote-213677785
Ref: Core and Builtins<4>-Footnote-223677842
Ref: Core and Builtins<4>-Footnote-233677899
Ref: Core and Builtins<4>-Footnote-243677956
Ref: Core and Builtins<4>-Footnote-253678013
Ref: Core and Builtins<4>-Footnote-263678070
Ref: Core and Builtins<4>-Footnote-273678127
Ref: Core and Builtins<4>-Footnote-283678184
Ref: Core and Builtins<4>-Footnote-293678241
Ref: Core and Builtins<4>-Footnote-303678298
Ref: Core and Builtins<4>-Footnote-313678355
Ref: Core and Builtins<4>-Footnote-323678412
Ref: Core and Builtins<4>-Footnote-333678469
Ref: Core and Builtins<4>-Footnote-343678526
Ref: Core and Builtins<4>-Footnote-353678583
Ref: Core and Builtins<4>-Footnote-363678640
Ref: Core and Builtins<4>-Footnote-373678697
Ref: Core and Builtins<4>-Footnote-383678754
Ref: Core and Builtins<4>-Footnote-393678811
Ref: Core and Builtins<4>-Footnote-403678854
Ref: Core and Builtins<4>-Footnote-413678911
Ref: Core and Builtins<4>-Footnote-423678954
Ref: Core and Builtins<4>-Footnote-433679011
Ref: Core and Builtins<4>-Footnote-443679068
Node: C API<4>3679124
Ref: whatsnew/changelog id263679240
Ref: 19773679240
Ref: C API<4>-Footnote-13680625
Ref: C API<4>-Footnote-23680681
Ref: C API<4>-Footnote-33680737
Ref: C API<4>-Footnote-43680793
Ref: C API<4>-Footnote-53680849
Ref: C API<4>-Footnote-63680905
Node: ビルド<4>3680961
Ref: whatsnew/changelog id273681048
Ref: 197b3681048
Ref: ビルド<4>-Footnote-13681601
Ref: ビルド<4>-Footnote-23681657
Ref: ビルド<4>-Footnote-33681713
Ref: ビルド<4>-Footnote-43681769
Ref: ビルド<4>-Footnote-53681825
Node: Python 3 15 0 alpha 63681881
Ref: whatsnew/changelog python-3-15-0-alpha-63682011
Ref: 197c3682011
Node: macOS<3>3682367
Ref: whatsnew/changelog id283682452
Ref: 197d3682452
Ref: macOS<3>-Footnote-13682785
Ref: macOS<3>-Footnote-23682841
Ref: macOS<3>-Footnote-33682897
Node: Windows<5>3682953
Ref: whatsnew/changelog id293683059
Ref: 197e3683059
Ref: Windows<5>-Footnote-13683290
Node: テスト<5>3683345
Ref: whatsnew/changelog id303683464
Ref: 197f3683464
Ref: テスト<5>-Footnote-13684016
Ref: テスト<5>-Footnote-23684072
Node: セキュリティ<5>3684127
Ref: whatsnew/changelog id313684254
Ref: 19803684254
Ref: セキュリティ<5>-Footnote-13685486
Ref: セキュリティ<5>-Footnote-23685542
Ref: セキュリティ<5>-Footnote-33685598
Ref: セキュリティ<5>-Footnote-43685654
Ref: セキュリティ<5>-Footnote-53685710
Ref: セキュリティ<5>-Footnote-63685766
Ref: セキュリティ<5>-Footnote-73685822
Ref: セキュリティ<5>-Footnote-83685878
Node: ライブラリ<5>3685934
Ref: whatsnew/changelog id323686056
Ref: 19813686056
Ref: ライブラリ<5>-Footnote-13695796
Ref: ライブラリ<5>-Footnote-23695852
Ref: ライブラリ<5>-Footnote-33695908
Ref: ライブラリ<5>-Footnote-43695964
Ref: ライブラリ<5>-Footnote-53696020
Ref: ライブラリ<5>-Footnote-63696075
Ref: ライブラリ<5>-Footnote-73696131
Ref: ライブラリ<5>-Footnote-83696187
Ref: ライブラリ<5>-Footnote-93696223
Ref: ライブラリ<5>-Footnote-103696279
Ref: ライブラリ<5>-Footnote-113696336
Ref: ライブラリ<5>-Footnote-123696393
Ref: ライブラリ<5>-Footnote-133696450
Ref: ライブラリ<5>-Footnote-143696507
Ref: ライブラリ<5>-Footnote-153696564
Ref: ライブラリ<5>-Footnote-163696621
Ref: ライブラリ<5>-Footnote-173696678
Ref: ライブラリ<5>-Footnote-183696735
Ref: ライブラリ<5>-Footnote-193696792
Ref: ライブラリ<5>-Footnote-203696849
Ref: ライブラリ<5>-Footnote-213696906
Ref: ライブラリ<5>-Footnote-223696963
Ref: ライブラリ<5>-Footnote-233697020
Ref: ライブラリ<5>-Footnote-243697076
Ref: ライブラリ<5>-Footnote-253697133
Ref: ライブラリ<5>-Footnote-263697190
Ref: ライブラリ<5>-Footnote-273697247
Ref: ライブラリ<5>-Footnote-283697304
Ref: ライブラリ<5>-Footnote-293697361
Ref: ライブラリ<5>-Footnote-303697418
Ref: ライブラリ<5>-Footnote-313697475
Ref: ライブラリ<5>-Footnote-323697532
Ref: ライブラリ<5>-Footnote-333697589
Ref: ライブラリ<5>-Footnote-343697646
Ref: ライブラリ<5>-Footnote-353697703
Ref: ライブラリ<5>-Footnote-363697760
Ref: ライブラリ<5>-Footnote-373697817
Ref: ライブラリ<5>-Footnote-383697874
Ref: ライブラリ<5>-Footnote-393697931
Ref: ライブラリ<5>-Footnote-403697988
Ref: ライブラリ<5>-Footnote-413698045
Ref: ライブラリ<5>-Footnote-423698102
Ref: ライブラリ<5>-Footnote-433698159
Ref: ライブラリ<5>-Footnote-443698216
Ref: ライブラリ<5>-Footnote-453698273
Ref: ライブラリ<5>-Footnote-463698330
Ref: ライブラリ<5>-Footnote-473698387
Ref: ライブラリ<5>-Footnote-483698444
Ref: ライブラリ<5>-Footnote-493698501
Ref: ライブラリ<5>-Footnote-503698557
Node: IDLE<4>3698613
Ref: whatsnew/changelog id343698734
Ref: 198b3698734
Ref: IDLE<4>-Footnote-13698883
Node: Core and Builtins<5>3698939
Ref: whatsnew/changelog id353699050
Ref: 198c3699050
Ref: Core and Builtins<5>-Footnote-13704708
Ref: Core and Builtins<5>-Footnote-23704764
Ref: Core and Builtins<5>-Footnote-33704820
Ref: Core and Builtins<5>-Footnote-43704876
Ref: Core and Builtins<5>-Footnote-53704932
Ref: Core and Builtins<5>-Footnote-63704988
Ref: Core and Builtins<5>-Footnote-73705044
Ref: Core and Builtins<5>-Footnote-83705100
Ref: Core and Builtins<5>-Footnote-93705156
Ref: Core and Builtins<5>-Footnote-103705212
Ref: Core and Builtins<5>-Footnote-113705269
Ref: Core and Builtins<5>-Footnote-123705326
Ref: Core and Builtins<5>-Footnote-133705383
Ref: Core and Builtins<5>-Footnote-143705440
Ref: Core and Builtins<5>-Footnote-153705497
Ref: Core and Builtins<5>-Footnote-163705554
Ref: Core and Builtins<5>-Footnote-173705611
Ref: Core and Builtins<5>-Footnote-183705668
Ref: Core and Builtins<5>-Footnote-193705725
Ref: Core and Builtins<5>-Footnote-203705782
Ref: Core and Builtins<5>-Footnote-213705839
Ref: Core and Builtins<5>-Footnote-223705896
Ref: Core and Builtins<5>-Footnote-233705953
Ref: Core and Builtins<5>-Footnote-243706010
Ref: Core and Builtins<5>-Footnote-253706067
Ref: Core and Builtins<5>-Footnote-263706124
Ref: Core and Builtins<5>-Footnote-273706181
Ref: Core and Builtins<5>-Footnote-283706238
Ref: Core and Builtins<5>-Footnote-293706295
Ref: Core and Builtins<5>-Footnote-303706352
Ref: Core and Builtins<5>-Footnote-313706409
Ref: Core and Builtins<5>-Footnote-323706466
Ref: Core and Builtins<5>-Footnote-333706509
Ref: Core and Builtins<5>-Footnote-343706566
Ref: Core and Builtins<5>-Footnote-353706623
Ref: Core and Builtins<5>-Footnote-363706680
Node: C API<5>3706737
Ref: whatsnew/changelog id363706853
Ref: 198f3706853
Ref: C API<5>-Footnote-13707368
Ref: C API<5>-Footnote-23707424
Node: ビルド<5>3707480
Ref: whatsnew/changelog id373707567
Ref: 19933707567
Ref: ビルド<5>-Footnote-13708636
Ref: ビルド<5>-Footnote-23708692
Ref: ビルド<5>-Footnote-33708748
Ref: ビルド<5>-Footnote-43708804
Ref: ビルド<5>-Footnote-53708860
Ref: ビルド<5>-Footnote-63708916
Node: Python 3 15 0 alpha 53708972
Ref: whatsnew/changelog python-3-15-0-alpha-53709102
Ref: 19943709102
Node: Windows<6>3709426
Ref: whatsnew/changelog id383709517
Ref: 19953709517
Ref: Windows<6>-Footnote-13709831
Ref: Windows<6>-Footnote-23709887
Node: Tools/Demos<2>3709943
Ref: whatsnew/changelog id393710055
Ref: 19963710055
Ref: Tools/Demos<2>-Footnote-13710274
Node: テスト<6>3710330
Ref: whatsnew/changelog id403710450
Ref: 19973710450
Ref: テスト<6>-Footnote-13710837
Ref: テスト<6>-Footnote-23710893
Ref: テスト<6>-Footnote-33710949
Node: ライブラリ<6>3711014
Ref: whatsnew/changelog id413711141
Ref: 19983711141
Ref: ライブラリ<6>-Footnote-13720177
Ref: ライブラリ<6>-Footnote-23720233
Ref: ライブラリ<6>-Footnote-33720289
Ref: ライブラリ<6>-Footnote-43720345
Ref: ライブラリ<6>-Footnote-53720400
Ref: ライブラリ<6>-Footnote-63720456
Ref: ライブラリ<6>-Footnote-73720512
Ref: ライブラリ<6>-Footnote-83720568
Ref: ライブラリ<6>-Footnote-93720624
Ref: ライブラリ<6>-Footnote-103720680
Ref: ライブラリ<6>-Footnote-113720737
Ref: ライブラリ<6>-Footnote-123720794
Ref: ライブラリ<6>-Footnote-133720851
Ref: ライブラリ<6>-Footnote-143720908
Ref: ライブラリ<6>-Footnote-153720965
Ref: ライブラリ<6>-Footnote-163721022
Ref: ライブラリ<6>-Footnote-173721079
Ref: ライブラリ<6>-Footnote-183721136
Ref: ライブラリ<6>-Footnote-193721193
Ref: ライブラリ<6>-Footnote-203721250
Ref: ライブラリ<6>-Footnote-213721307
Ref: ライブラリ<6>-Footnote-223721364
Ref: ライブラリ<6>-Footnote-233721421
Ref: ライブラリ<6>-Footnote-243721478
Ref: ライブラリ<6>-Footnote-253721535
Ref: ライブラリ<6>-Footnote-263721592
Ref: ライブラリ<6>-Footnote-273721649
Ref: ライブラリ<6>-Footnote-283721706
Ref: ライブラリ<6>-Footnote-293721763
Ref: ライブラリ<6>-Footnote-303721820
Ref: ライブラリ<6>-Footnote-313721877
Ref: ライブラリ<6>-Footnote-323721934
Ref: ライブラリ<6>-Footnote-333721991
Ref: ライブラリ<6>-Footnote-343722047
Ref: ライブラリ<6>-Footnote-353722094
Ref: ライブラリ<6>-Footnote-363722151
Ref: ライブラリ<6>-Footnote-373722208
Ref: ライブラリ<6>-Footnote-383722265
Ref: ライブラリ<6>-Footnote-393722322
Ref: ライブラリ<6>-Footnote-403722379
Ref: ライブラリ<6>-Footnote-413722436
Ref: ライブラリ<6>-Footnote-423722493
Ref: ライブラリ<6>-Footnote-433722550
Ref: ライブラリ<6>-Footnote-443722607
Ref: ライブラリ<6>-Footnote-453722664
Ref: ライブラリ<6>-Footnote-463722720
Ref: ライブラリ<6>-Footnote-473722777
Ref: ライブラリ<6>-Footnote-483722834
Ref: ライブラリ<6>-Footnote-493722891
Ref: ライブラリ<6>-Footnote-503722948
Node: ドキュメント<5>3723005
Ref: whatsnew/changelog id423723140
Ref: 19a73723140
Ref: ドキュメント<5>-Footnote-13723293
Node: Core and Builtins<6>3723349
Ref: whatsnew/changelog id433723474
Ref: 19a93723474
Ref: Core and Builtins<6>-Footnote-13728627
Ref: Core and Builtins<6>-Footnote-23728683
Ref: Core and Builtins<6>-Footnote-33728739
Ref: Core and Builtins<6>-Footnote-43728795
Ref: Core and Builtins<6>-Footnote-53728851
Ref: Core and Builtins<6>-Footnote-63728907
Ref: Core and Builtins<6>-Footnote-73728963
Ref: Core and Builtins<6>-Footnote-83729019
Ref: Core and Builtins<6>-Footnote-93729075
Ref: Core and Builtins<6>-Footnote-103729131
Ref: Core and Builtins<6>-Footnote-113729188
Ref: Core and Builtins<6>-Footnote-123729245
Ref: Core and Builtins<6>-Footnote-133729302
Ref: Core and Builtins<6>-Footnote-143729359
Ref: Core and Builtins<6>-Footnote-153729416
Ref: Core and Builtins<6>-Footnote-163729473
Ref: Core and Builtins<6>-Footnote-173729530
Ref: Core and Builtins<6>-Footnote-183729587
Ref: Core and Builtins<6>-Footnote-193729644
Ref: Core and Builtins<6>-Footnote-203729701
Ref: Core and Builtins<6>-Footnote-213729758
Ref: Core and Builtins<6>-Footnote-223729815
Ref: Core and Builtins<6>-Footnote-233729872
Ref: Core and Builtins<6>-Footnote-243729929
Ref: Core and Builtins<6>-Footnote-253729986
Ref: Core and Builtins<6>-Footnote-263730043
Ref: Core and Builtins<6>-Footnote-273730100
Ref: Core and Builtins<6>-Footnote-283730157
Ref: Core and Builtins<6>-Footnote-293730214
Ref: Core and Builtins<6>-Footnote-303730270
Ref: Core and Builtins<6>-Footnote-313730326
Ref: Core and Builtins<6>-Footnote-323730383
Ref: Core and Builtins<6>-Footnote-333730440
Ref: Core and Builtins<6>-Footnote-343730497
Ref: Core and Builtins<6>-Footnote-353730554
Node: C API<6>3730611
Ref: whatsnew/changelog id443730706
Ref: 19b03730706
Ref: C API<6>-Footnote-13730948
Node: Python 3 15 0 alpha 43731004
Ref: whatsnew/changelog python-3-15-0-alpha-43731134
Ref: 19b23731134
Node: テスト<7>3731340
Ref: whatsnew/changelog id453731437
Ref: 19b33731437
Ref: テスト<7>-Footnote-13731608
Node: ライブラリ<7>3731664
Ref: whatsnew/changelog id463731790
Ref: 19b43731790
Ref: ライブラリ<7>-Footnote-13735929
Ref: ライブラリ<7>-Footnote-23735985
Ref: ライブラリ<7>-Footnote-33736041
Ref: ライブラリ<7>-Footnote-43736096
Ref: ライブラリ<7>-Footnote-53736152
Ref: ライブラリ<7>-Footnote-63736208
Ref: ライブラリ<7>-Footnote-73736264
Ref: ライブラリ<7>-Footnote-83736320
Ref: ライブラリ<7>-Footnote-93736376
Ref: ライブラリ<7>-Footnote-103736432
Ref: ライブラリ<7>-Footnote-113736488
Ref: ライブラリ<7>-Footnote-123736545
Ref: ライブラリ<7>-Footnote-133736602
Ref: ライブラリ<7>-Footnote-143736659
Ref: ライブラリ<7>-Footnote-153736716
Ref: ライブラリ<7>-Footnote-163736773
Ref: ライブラリ<7>-Footnote-173736830
Ref: ライブラリ<7>-Footnote-183736887
Ref: ライブラリ<7>-Footnote-193736944
Node: Core and Builtins<7>3737001
Ref: whatsnew/changelog id473737106
Ref: 19be3737106
Ref: Core and Builtins<7>-Footnote-13738801
Ref: Core and Builtins<7>-Footnote-23738857
Ref: Core and Builtins<7>-Footnote-33738913
Ref: Core and Builtins<7>-Footnote-43738969
Ref: Core and Builtins<7>-Footnote-53739025
Ref: Core and Builtins<7>-Footnote-63739081
Ref: Core and Builtins<7>-Footnote-73739137
Ref: Core and Builtins<7>-Footnote-83739193
Ref: Core and Builtins<7>-Footnote-93739249
Ref: Core and Builtins<7>-Footnote-103739305
Ref: Core and Builtins<7>-Footnote-113739362
Ref: Core and Builtins<7>-Footnote-123739419
Ref: Core and Builtins<7>-Footnote-133739476
Ref: Core and Builtins<7>-Footnote-143739533
Node: Python 3 15 0 alpha 33739590
Ref: whatsnew/changelog python-3-15-0-alpha-33739720
Ref: 19c03739720
Node: Tools/Demos<3>3740093
Ref: whatsnew/changelog id483740186
Ref: 19c13740186
Ref: Tools/Demos<3>-Footnote-13740527
Node: テスト<8>3740583
Ref: whatsnew/changelog id493740706
Ref: 19c23740706
Ref: テスト<8>-Footnote-13741133
Ref: テスト<8>-Footnote-23741189
Node: セキュリティ<6>3741245
Ref: whatsnew/changelog id503741372
Ref: 19c33741372
Ref: セキュリティ<6>-Footnote-13742544
Ref: セキュリティ<6>-Footnote-23742600
Ref: セキュリティ<6>-Footnote-33742655
Ref: セキュリティ<6>-Footnote-43742711
Node: ライブラリ<8>3742767
Ref: whatsnew/changelog id513742903
Ref: 19c43742903
Ref: ライブラリ<8>-Footnote-13759029
Ref: ライブラリ<8>-Footnote-23759085
Ref: ライブラリ<8>-Footnote-33759141
Ref: ライブラリ<8>-Footnote-43759196
Ref: ライブラリ<8>-Footnote-53759251
Ref: ライブラリ<8>-Footnote-63759307
Ref: ライブラリ<8>-Footnote-73759362
Ref: ライブラリ<8>-Footnote-83759418
Ref: ライブラリ<8>-Footnote-93759474
Ref: ライブラリ<8>-Footnote-103759530
Ref: ライブラリ<8>-Footnote-113759587
Ref: ライブラリ<8>-Footnote-123759644
Ref: ライブラリ<8>-Footnote-133759701
Ref: ライブラリ<8>-Footnote-143759758
Ref: ライブラリ<8>-Footnote-153759815
Ref: ライブラリ<8>-Footnote-163759872
Ref: ライブラリ<8>-Footnote-173759929
Ref: ライブラリ<8>-Footnote-183759986
Ref: ライブラリ<8>-Footnote-193760043
Ref: ライブラリ<8>-Footnote-203760100
Ref: ライブラリ<8>-Footnote-213760157
Ref: ライブラリ<8>-Footnote-223760214
Ref: ライブラリ<8>-Footnote-233760270
Ref: ライブラリ<8>-Footnote-243760327
Ref: ライブラリ<8>-Footnote-253760384
Ref: ライブラリ<8>-Footnote-263760441
Ref: ライブラリ<8>-Footnote-273760498
Ref: ライブラリ<8>-Footnote-283760554
Ref: ライブラリ<8>-Footnote-293760611
Ref: ライブラリ<8>-Footnote-303760668
Ref: ライブラリ<8>-Footnote-313760724
Ref: ライブラリ<8>-Footnote-323760781
Ref: ライブラリ<8>-Footnote-333760838
Ref: ライブラリ<8>-Footnote-343760895
Ref: ライブラリ<8>-Footnote-353760952
Ref: ライブラリ<8>-Footnote-363761009
Ref: ライブラリ<8>-Footnote-373761066
Ref: ライブラリ<8>-Footnote-383761122
Ref: ライブラリ<8>-Footnote-393761178
Ref: ライブラリ<8>-Footnote-403761235
Ref: ライブラリ<8>-Footnote-413761292
Ref: ライブラリ<8>-Footnote-423761349
Ref: ライブラリ<8>-Footnote-433761406
Ref: ライブラリ<8>-Footnote-443761463
Ref: ライブラリ<8>-Footnote-453761520
Ref: ライブラリ<8>-Footnote-463761577
Ref: ライブラリ<8>-Footnote-473761634
Ref: ライブラリ<8>-Footnote-483761691
Ref: ライブラリ<8>-Footnote-493761747
Ref: ライブラリ<8>-Footnote-503761804
Ref: ライブラリ<8>-Footnote-513761861
Ref: ライブラリ<8>-Footnote-523761918
Ref: ライブラリ<8>-Footnote-533761975
Ref: ライブラリ<8>-Footnote-543762032
Ref: ライブラリ<8>-Footnote-553762089
Ref: ライブラリ<8>-Footnote-563762146
Ref: ライブラリ<8>-Footnote-573762203
Ref: ライブラリ<8>-Footnote-583762260
Ref: ライブラリ<8>-Footnote-593762317
Ref: ライブラリ<8>-Footnote-603762374
Ref: ライブラリ<8>-Footnote-613762431
Ref: ライブラリ<8>-Footnote-623762487
Ref: ライブラリ<8>-Footnote-633762544
Ref: ライブラリ<8>-Footnote-643762600
Ref: ライブラリ<8>-Footnote-653762657
Ref: ライブラリ<8>-Footnote-663762713
Ref: ライブラリ<8>-Footnote-673762770
Ref: ライブラリ<8>-Footnote-683762827
Ref: ライブラリ<8>-Footnote-693762884
Ref: ライブラリ<8>-Footnote-703762941
Ref: ライブラリ<8>-Footnote-713762998
Ref: ライブラリ<8>-Footnote-723763054
Ref: ライブラリ<8>-Footnote-733763111
Ref: ライブラリ<8>-Footnote-743763168
Ref: ライブラリ<8>-Footnote-753763224
Ref: ライブラリ<8>-Footnote-763763281
Ref: ライブラリ<8>-Footnote-773763338
Ref: ライブラリ<8>-Footnote-783763395
Ref: ライブラリ<8>-Footnote-793763452
Node: ドキュメント<6>3763518
Ref: whatsnew/changelog id523763653
Ref: 19d63763653
Ref: ドキュメント<6>-Footnote-13763950
Ref: ドキュメント<6>-Footnote-23764006
Node: Core and Builtins<8>3764071
Ref: whatsnew/changelog id533764196
Ref: 19d83764196
Ref: Core and Builtins<8>-Footnote-13771164
Ref: Core and Builtins<8>-Footnote-23771220
Ref: Core and Builtins<8>-Footnote-33771276
Ref: Core and Builtins<8>-Footnote-43771332
Ref: Core and Builtins<8>-Footnote-53771388
Ref: Core and Builtins<8>-Footnote-63771444
Ref: Core and Builtins<8>-Footnote-73771500
Ref: Core and Builtins<8>-Footnote-83771556
Ref: Core and Builtins<8>-Footnote-93771612
Ref: Core and Builtins<8>-Footnote-103771668
Ref: Core and Builtins<8>-Footnote-113771725
Ref: Core and Builtins<8>-Footnote-123771782
Ref: Core and Builtins<8>-Footnote-133771839
Ref: Core and Builtins<8>-Footnote-143771896
Ref: Core and Builtins<8>-Footnote-153771953
Ref: Core and Builtins<8>-Footnote-163772010
Ref: Core and Builtins<8>-Footnote-173772067
Ref: Core and Builtins<8>-Footnote-183772124
Ref: Core and Builtins<8>-Footnote-193772180
Ref: Core and Builtins<8>-Footnote-203772237
Ref: Core and Builtins<8>-Footnote-213772293
Ref: Core and Builtins<8>-Footnote-223772350
Ref: Core and Builtins<8>-Footnote-233772407
Ref: Core and Builtins<8>-Footnote-243772464
Ref: Core and Builtins<8>-Footnote-253772521
Ref: Core and Builtins<8>-Footnote-263772578
Ref: Core and Builtins<8>-Footnote-273772635
Ref: Core and Builtins<8>-Footnote-283772692
Ref: Core and Builtins<8>-Footnote-293772749
Ref: Core and Builtins<8>-Footnote-303772806
Ref: Core and Builtins<8>-Footnote-313772863
Ref: Core and Builtins<8>-Footnote-323772906
Ref: Core and Builtins<8>-Footnote-333772963
Ref: Core and Builtins<8>-Footnote-343773020
Ref: Core and Builtins<8>-Footnote-353773077
Ref: Core and Builtins<8>-Footnote-363773133
Ref: Core and Builtins<8>-Footnote-373773190
Ref: Core and Builtins<8>-Footnote-383773247
Ref: Core and Builtins<8>-Footnote-393773304
Ref: Core and Builtins<8>-Footnote-403773361
Ref: Core and Builtins<8>-Footnote-413773418
Ref: Core and Builtins<8>-Footnote-423773475
Node: C API<7>3773532
Ref: whatsnew/changelog id543773648
Ref: 19d93773648
Ref: C API<7>-Footnote-13775399
Ref: C API<7>-Footnote-23775455
Ref: C API<7>-Footnote-33775511
Ref: C API<7>-Footnote-43775567
Ref: C API<7>-Footnote-53775623
Ref: C API<7>-Footnote-63775679
Ref: C API<7>-Footnote-73775735
Ref: C API<7>-Footnote-83775791
Ref: C API<7>-Footnote-93775847
Ref: C API<7>-Footnote-103775903
Node: ビルド<6>3775960
Ref: whatsnew/changelog id553776047
Ref: 19dc3776047
Ref: ビルド<6>-Footnote-13778443
Ref: ビルド<6>-Footnote-23778499
Ref: ビルド<6>-Footnote-33778555
Ref: ビルド<6>-Footnote-43778611
Ref: ビルド<6>-Footnote-53778667
Ref: ビルド<6>-Footnote-63778723
Ref: ビルド<6>-Footnote-73778779
Ref: ビルド<6>-Footnote-83778835
Ref: ビルド<6>-Footnote-93778891
Ref: ビルド<6>-Footnote-103778947
Ref: ビルド<6>-Footnote-113779004
Ref: ビルド<6>-Footnote-123779061
Ref: ビルド<6>-Footnote-133779104
Node: Python 3 15 0 alpha 23779161
Ref: whatsnew/changelog python-3-15-0-alpha-23779291
Ref: 19de3779291
Node: Windows<7>3780062
Ref: whatsnew/changelog id563780153
Ref: 19df3780153
Ref: Windows<7>-Footnote-13780285
Node: Tools/Demos<4>3780341
Ref: whatsnew/changelog id573780453
Ref: 19e03780453
Ref: Tools/Demos<4>-Footnote-13780890
Ref: Tools/Demos<4>-Footnote-23780946
Ref: Tools/Demos<4>-Footnote-33781002
Ref: Tools/Demos<4>-Footnote-43781058
Node: テスト<9>3781114
Ref: whatsnew/changelog id583781237
Ref: 19e13781237
Ref: テスト<9>-Footnote-13781760
Ref: テスト<9>-Footnote-23781816
Ref: テスト<9>-Footnote-33781872
Node: セキュリティ<7>3781928
Ref: whatsnew/changelog id593782055
Ref: 19e23782055
Ref: セキュリティ<7>-Footnote-13782578
Ref: セキュリティ<7>-Footnote-23782634
Ref: セキュリティ<7>-Footnote-33782690
Node: ライブラリ<9>3782746
Ref: whatsnew/changelog id603782881
Ref: 19e33782881
Ref: ライブラリ<9>-Footnote-13798307
Ref: ライブラリ<9>-Footnote-23798363
Ref: ライブラリ<9>-Footnote-33798419
Ref: ライブラリ<9>-Footnote-43798475
Ref: ライブラリ<9>-Footnote-53798531
Ref: ライブラリ<9>-Footnote-63798587
Ref: ライブラリ<9>-Footnote-73798643
Ref: ライブラリ<9>-Footnote-83798698
Ref: ライブラリ<9>-Footnote-93798753
Ref: ライブラリ<9>-Footnote-103798809
Ref: ライブラリ<9>-Footnote-113798866
Ref: ライブラリ<9>-Footnote-123798923
Ref: ライブラリ<9>-Footnote-133798979
Ref: ライブラリ<9>-Footnote-143799036
Ref: ライブラリ<9>-Footnote-153799093
Ref: ライブラリ<9>-Footnote-163799150
Ref: ライブラリ<9>-Footnote-173799207
Ref: ライブラリ<9>-Footnote-183799264
Ref: ライブラリ<9>-Footnote-193799321
Ref: ライブラリ<9>-Footnote-203799378
Ref: ライブラリ<9>-Footnote-213799435
Ref: ライブラリ<9>-Footnote-223799492
Ref: ライブラリ<9>-Footnote-233799549
Ref: ライブラリ<9>-Footnote-243799606
Ref: ライブラリ<9>-Footnote-253799663
Ref: ライブラリ<9>-Footnote-263799720
Ref: ライブラリ<9>-Footnote-273799777
Ref: ライブラリ<9>-Footnote-283799834
Ref: ライブラリ<9>-Footnote-293799891
Ref: ライブラリ<9>-Footnote-303799948
Ref: ライブラリ<9>-Footnote-313800005
Ref: ライブラリ<9>-Footnote-323800062
Ref: ライブラリ<9>-Footnote-333800119
Ref: ライブラリ<9>-Footnote-343800176
Ref: ライブラリ<9>-Footnote-353800233
Ref: ライブラリ<9>-Footnote-363800290
Ref: ライブラリ<9>-Footnote-373800347
Ref: ライブラリ<9>-Footnote-383800404
Ref: ライブラリ<9>-Footnote-393800461
Ref: ライブラリ<9>-Footnote-403800518
Ref: ライブラリ<9>-Footnote-413800575
Ref: ライブラリ<9>-Footnote-423800632
Ref: ライブラリ<9>-Footnote-433800689
Ref: ライブラリ<9>-Footnote-443800746
Ref: ライブラリ<9>-Footnote-453800803
Ref: ライブラリ<9>-Footnote-463800860
Ref: ライブラリ<9>-Footnote-473800916
Ref: ライブラリ<9>-Footnote-483800972
Ref: ライブラリ<9>-Footnote-493801029
Ref: ライブラリ<9>-Footnote-503801086
Ref: ライブラリ<9>-Footnote-513801133
Ref: ライブラリ<9>-Footnote-523801190
Ref: ライブラリ<9>-Footnote-533801247
Ref: ライブラリ<9>-Footnote-543801304
Ref: ライブラリ<9>-Footnote-553801361
Ref: ライブラリ<9>-Footnote-563801418
Ref: ライブラリ<9>-Footnote-573801475
Ref: ライブラリ<9>-Footnote-583801532
Ref: ライブラリ<9>-Footnote-593801589
Ref: ライブラリ<9>-Footnote-603801646
Ref: ライブラリ<9>-Footnote-613801720
Ref: ライブラリ<9>-Footnote-623801777
Ref: ライブラリ<9>-Footnote-633801833
Ref: ライブラリ<9>-Footnote-643801890
Ref: ライブラリ<9>-Footnote-653801947
Ref: ライブラリ<9>-Footnote-663802004
Ref: ライブラリ<9>-Footnote-673802060
Ref: ライブラリ<9>-Footnote-683802117
Ref: ライブラリ<9>-Footnote-693802174
Ref: ライブラリ<9>-Footnote-703802230
Ref: ライブラリ<9>-Footnote-713802287
Ref: ライブラリ<9>-Footnote-723802330
Ref: ライブラリ<9>-Footnote-733802387
Ref: ライブラリ<9>-Footnote-743802444
Ref: ライブラリ<9>-Footnote-753802501
Ref: ライブラリ<9>-Footnote-763802557
Ref: ライブラリ<9>-Footnote-773802614
Ref: ライブラリ<9>-Footnote-783802671
Ref: ライブラリ<9>-Footnote-793802727
Ref: ライブラリ<9>-Footnote-803802784
Ref: ライブラリ<9>-Footnote-813802840
Ref: ライブラリ<9>-Footnote-823802897
Ref: ライブラリ<9>-Footnote-833802954
Ref: ライブラリ<9>-Footnote-843803011
Ref: ライブラリ<9>-Footnote-853803068
Ref: ライブラリ<9>-Footnote-863803125
Ref: ライブラリ<9>-Footnote-873803182
Ref: ライブラリ<9>-Footnote-883803239
Ref: ライブラリ<9>-Footnote-893803296
Ref: ライブラリ<9>-Footnote-903803353
Ref: ライブラリ<9>-Footnote-913803410
Ref: ライブラリ<9>-Footnote-923803467
Ref: ライブラリ<9>-Footnote-933803524
Ref: ライブラリ<9>-Footnote-943803580
Node: Core and Builtins<9>3803623
Ref: whatsnew/changelog id613803756
Ref: 19f23803756
Ref: Core and Builtins<9>-Footnote-13804856
Ref: Core and Builtins<9>-Footnote-23804912
Ref: Core and Builtins<9>-Footnote-33804968
Ref: Core and Builtins<9>-Footnote-43805024
Ref: Core and Builtins<9>-Footnote-53805080
Ref: Core and Builtins<9>-Footnote-63805136
Node: ライブラリ<10>3805192
Ref: whatsnew/changelog id623805328
Ref: 19f43805328
Ref: ライブラリ<10>-Footnote-13805538
Node: Core and Builtins<10>3805594
Ref: whatsnew/changelog id633805729
Ref: 19f53805729
Ref: Core and Builtins<10>-Footnote-13806087
Ref: Core and Builtins<10>-Footnote-23806143
Node: ライブラリ<11>3806199
Ref: whatsnew/changelog id643806336
Ref: 19f63806336
Ref: ライブラリ<11>-Footnote-13806555
Node: Core and Builtins<11>3806611
Ref: whatsnew/changelog id653806746
Ref: 19f73806746
Ref: Core and Builtins<11>-Footnote-13806951
Node: ライブラリ<12>3807007
Ref: whatsnew/changelog id663807144
Ref: 19f83807144
Ref: ライブラリ<12>-Footnote-13807430
Node: Core and Builtins<12>3807485
Ref: whatsnew/changelog id673807620
Ref: 19f93807620
Ref: Core and Builtins<12>-Footnote-13809166
Ref: Core and Builtins<12>-Footnote-23809222
Ref: Core and Builtins<12>-Footnote-33809278
Ref: Core and Builtins<12>-Footnote-43809334
Ref: Core and Builtins<12>-Footnote-53809390
Ref: Core and Builtins<12>-Footnote-63809446
Ref: Core and Builtins<12>-Footnote-73809502
Ref: Core and Builtins<12>-Footnote-83809558
Ref: Core and Builtins<12>-Footnote-93809614
Node: ライブラリ<13>3809670
Ref: whatsnew/changelog id683809807
Ref: 19fb3809807
Ref: ライブラリ<13>-Footnote-13810265
Node: Core and Builtins<13>3810321
Ref: whatsnew/changelog id693810456
Ref: 19fd3810456
Ref: Core and Builtins<13>-Footnote-13811169
Ref: Core and Builtins<13>-Footnote-23811225
Ref: Core and Builtins<13>-Footnote-33811281
Node: ライブラリ<14>3811337
Ref: whatsnew/changelog id703811474
Ref: 19ff3811474
Ref: ライブラリ<14>-Footnote-13811817
Node: Core and Builtins<14>3811873
Ref: whatsnew/changelog id713811997
Ref: 1a033811997
Ref: Core and Builtins<14>-Footnote-13816769
Ref: Core and Builtins<14>-Footnote-23816825
Ref: Core and Builtins<14>-Footnote-33816881
Ref: Core and Builtins<14>-Footnote-43816937
Ref: Core and Builtins<14>-Footnote-53816993
Ref: Core and Builtins<14>-Footnote-63817049
Ref: Core and Builtins<14>-Footnote-73817105
Ref: Core and Builtins<14>-Footnote-83817161
Ref: Core and Builtins<14>-Footnote-93817217
Ref: Core and Builtins<14>-Footnote-103817273
Ref: Core and Builtins<14>-Footnote-113817330
Ref: Core and Builtins<14>-Footnote-123817387
Ref: Core and Builtins<14>-Footnote-133817444
Ref: Core and Builtins<14>-Footnote-143817501
Ref: Core and Builtins<14>-Footnote-153817558
Ref: Core and Builtins<14>-Footnote-163817615
Ref: Core and Builtins<14>-Footnote-173817672
Ref: Core and Builtins<14>-Footnote-183817729
Ref: Core and Builtins<14>-Footnote-193817786
Ref: Core and Builtins<14>-Footnote-203817843
Ref: Core and Builtins<14>-Footnote-213817900
Ref: Core and Builtins<14>-Footnote-223817957
Ref: Core and Builtins<14>-Footnote-233818000
Ref: Core and Builtins<14>-Footnote-243818057
Ref: Core and Builtins<14>-Footnote-253818114
Ref: Core and Builtins<14>-Footnote-263818171
Ref: Core and Builtins<14>-Footnote-273818228
Ref: Core and Builtins<14>-Footnote-283818285
Ref: Core and Builtins<14>-Footnote-293818342
Ref: Core and Builtins<14>-Footnote-303818399
Node: C API<8>3818456
Ref: whatsnew/changelog id723818573
Ref: 1a043818573
Ref: C API<8>-Footnote-13820076
Ref: C API<8>-Footnote-23820132
Ref: C API<8>-Footnote-33820188
Ref: C API<8>-Footnote-43820244
Ref: C API<8>-Footnote-53820300
Ref: C API<8>-Footnote-63820356
Ref: C API<8>-Footnote-73820412
Ref: C API<8>-Footnote-83820454
Ref: C API<8>-Footnote-93820510
Ref: C API<8>-Footnote-103820566
Node: ビルド<7>3820623
Ref: whatsnew/changelog id733820710
Ref: 1a063820710
Ref: ビルド<7>-Footnote-13821543
Ref: ビルド<7>-Footnote-23821599
Ref: ビルド<7>-Footnote-33821655
Ref: ビルド<7>-Footnote-43821711
Ref: ビルド<7>-Footnote-53821767
Ref: ビルド<7>-Footnote-63821823
Ref: ビルド<7>-Footnote-73821879
Node: Python 3 15 0 alpha 13821935
Ref: whatsnew/changelog python-3-15-0-alpha-13822064
Ref: 1a073822064
Node: macOS<4>3823593
Ref: whatsnew/changelog id743823678
Ref: 1a083823678
Ref: macOS<4>-Footnote-13824276
Ref: macOS<4>-Footnote-23824332
Ref: macOS<4>-Footnote-33824388
Ref: macOS<4>-Footnote-43824444
Ref: macOS<4>-Footnote-53824500
Node: Windows<8>3824556
Ref: whatsnew/changelog id753824664
Ref: 1a093824664
Ref: Windows<8>-Footnote-13827162
Ref: Windows<8>-Footnote-23827218
Ref: Windows<8>-Footnote-33827274
Ref: Windows<8>-Footnote-43827330
Ref: Windows<8>-Footnote-53827386
Ref: Windows<8>-Footnote-63827442
Ref: Windows<8>-Footnote-73827498
Ref: Windows<8>-Footnote-83827554
Ref: Windows<8>-Footnote-93827610
Ref: Windows<8>-Footnote-103827665
Ref: Windows<8>-Footnote-113827722
Ref: Windows<8>-Footnote-123827779
Ref: Windows<8>-Footnote-133827836
Ref: Windows<8>-Footnote-143827893
Ref: Windows<8>-Footnote-153827950
Ref: Windows<8>-Footnote-163828007
Ref: Windows<8>-Footnote-173828064
Node: Tools/Demos<5>3828121
Ref: whatsnew/changelog id763828234
Ref: 1a0c3828234
Ref: Tools/Demos<5>-Footnote-13830245
Ref: Tools/Demos<5>-Footnote-23830301
Ref: Tools/Demos<5>-Footnote-33830357
Ref: Tools/Demos<5>-Footnote-43830413
Ref: Tools/Demos<5>-Footnote-53830469
Ref: Tools/Demos<5>-Footnote-63830525
Ref: Tools/Demos<5>-Footnote-73830581
Ref: Tools/Demos<5>-Footnote-83830644
Ref: Tools/Demos<5>-Footnote-93830700
Ref: Tools/Demos<5>-Footnote-103830756
Ref: Tools/Demos<5>-Footnote-113830813
Ref: Tools/Demos<5>-Footnote-123830870
Ref: Tools/Demos<5>-Footnote-133830927
Node: テスト<10>3830984
Ref: whatsnew/changelog id773831108
Ref: 1a0d3831108
Ref: テスト<10>-Footnote-13832883
Ref: テスト<10>-Footnote-23832939
Ref: テスト<10>-Footnote-33832995
Ref: テスト<10>-Footnote-43833051
Ref: テスト<10>-Footnote-53833107
Ref: テスト<10>-Footnote-63833163
Ref: テスト<10>-Footnote-73833219
Ref: テスト<10>-Footnote-83833275
Ref: テスト<10>-Footnote-93833313
Ref: テスト<10>-Footnote-103833369
Ref: テスト<10>-Footnote-113833426
Ref: テスト<10>-Footnote-123833483
Ref: テスト<10>-Footnote-133833540
Node: セキュリティ<8>3833597
Ref: whatsnew/changelog id783833726
Ref: 1a0e3833726
Ref: セキュリティ<8>-Footnote-13837565
Ref: セキュリティ<8>-Footnote-23837621
Ref: セキュリティ<8>-Footnote-33837677
Ref: セキュリティ<8>-Footnote-43837733
Ref: セキュリティ<8>-Footnote-53837789
Ref: セキュリティ<8>-Footnote-63837845
Ref: セキュリティ<8>-Footnote-73837901
Ref: セキュリティ<8>-Footnote-83837957
Ref: セキュリティ<8>-Footnote-93838013
Ref: セキュリティ<8>-Footnote-103838069
Ref: セキュリティ<8>-Footnote-113838126
Ref: セキュリティ<8>-Footnote-123838183
Ref: セキュリティ<8>-Footnote-133838239
Ref: セキュリティ<8>-Footnote-143838295
Ref: セキュリティ<8>-Footnote-153838351
Ref: セキュリティ<8>-Footnote-163838408
Ref: セキュリティ<8>-Footnote-173838465
Node: ライブラリ<15>3838522
Ref: whatsnew/changelog id793838645
Ref: 1a113838645
Ref: ライブラリ<15>-Footnote-13899990
Ref: ライブラリ<15>-Footnote-23900046
Ref: ライブラリ<15>-Footnote-33900094
Ref: ライブラリ<15>-Footnote-43900150
Ref: ライブラリ<15>-Footnote-53900206
Ref: ライブラリ<15>-Footnote-63900262
Ref: ライブラリ<15>-Footnote-73900318
Ref: ライブラリ<15>-Footnote-83900374
Ref: ライブラリ<15>-Footnote-93900430
Ref: ライブラリ<15>-Footnote-103900486
Ref: ライブラリ<15>-Footnote-113900543
Ref: ライブラリ<15>-Footnote-123900599
Ref: ライブラリ<15>-Footnote-133900656
Ref: ライブラリ<15>-Footnote-143900713
Ref: ライブラリ<15>-Footnote-153900770
Ref: ライブラリ<15>-Footnote-163900827
Ref: ライブラリ<15>-Footnote-173900867
Ref: ライブラリ<15>-Footnote-183900909
Ref: ライブラリ<15>-Footnote-193900966
Ref: ライブラリ<15>-Footnote-203901022
Ref: ライブラリ<15>-Footnote-213901083
Ref: ライブラリ<15>-Footnote-223901140
Ref: ライブラリ<15>-Footnote-233901197
Ref: ライブラリ<15>-Footnote-243901253
Ref: ライブラリ<15>-Footnote-253901309
Ref: ライブラリ<15>-Footnote-263901365
Ref: ライブラリ<15>-Footnote-273901422
Ref: ライブラリ<15>-Footnote-283901479
Ref: ライブラリ<15>-Footnote-293901536
Ref: ライブラリ<15>-Footnote-303901593
Ref: ライブラリ<15>-Footnote-313901650
Ref: ライブラリ<15>-Footnote-323901707
Ref: ライブラリ<15>-Footnote-333901764
Ref: ライブラリ<15>-Footnote-343901821
Ref: ライブラリ<15>-Footnote-353901878
Ref: ライブラリ<15>-Footnote-363901935
Ref: ライブラリ<15>-Footnote-373901992
Ref: ライブラリ<15>-Footnote-383902049
Ref: ライブラリ<15>-Footnote-393902106
Ref: ライブラリ<15>-Footnote-403902163
Ref: ライブラリ<15>-Footnote-413902220
Ref: ライブラリ<15>-Footnote-423902277
Ref: ライブラリ<15>-Footnote-433902334
Ref: ライブラリ<15>-Footnote-443902391
Ref: ライブラリ<15>-Footnote-453902448
Ref: ライブラリ<15>-Footnote-463902505
Ref: ライブラリ<15>-Footnote-473902562
Ref: ライブラリ<15>-Footnote-483902619
Ref: ライブラリ<15>-Footnote-493902676
Ref: ライブラリ<15>-Footnote-503902733
Ref: ライブラリ<15>-Footnote-513902789
Ref: ライブラリ<15>-Footnote-523902846
Ref: ライブラリ<15>-Footnote-533902903
Ref: ライブラリ<15>-Footnote-543902960
Ref: ライブラリ<15>-Footnote-553903017
Ref: ライブラリ<15>-Footnote-563903074
Ref: ライブラリ<15>-Footnote-573903131
Ref: ライブラリ<15>-Footnote-583903188
Ref: ライブラリ<15>-Footnote-593903244
Ref: ライブラリ<15>-Footnote-603903301
Ref: ライブラリ<15>-Footnote-613903357
Ref: ライブラリ<15>-Footnote-623903414
Ref: ライブラリ<15>-Footnote-633903471
Ref: ライブラリ<15>-Footnote-643903528
Ref: ライブラリ<15>-Footnote-653903585
Ref: ライブラリ<15>-Footnote-663903642
Ref: ライブラリ<15>-Footnote-673903698
Ref: ライブラリ<15>-Footnote-683903755
Ref: ライブラリ<15>-Footnote-693903812
Ref: ライブラリ<15>-Footnote-703903869
Ref: ライブラリ<15>-Footnote-713903926
Ref: ライブラリ<15>-Footnote-723903982
Ref: ライブラリ<15>-Footnote-733904039
Ref: ライブラリ<15>-Footnote-743904095
Ref: ライブラリ<15>-Footnote-753904152
Ref: ライブラリ<15>-Footnote-763904209
Ref: ライブラリ<15>-Footnote-773904266
Ref: ライブラリ<15>-Footnote-783904323
Ref: ライブラリ<15>-Footnote-793904380
Ref: ライブラリ<15>-Footnote-803904423
Ref: ライブラリ<15>-Footnote-813904480
Ref: ライブラリ<15>-Footnote-823904537
Ref: ライブラリ<15>-Footnote-833904593
Ref: ライブラリ<15>-Footnote-843904650
Ref: ライブラリ<15>-Footnote-853904707
Ref: ライブラリ<15>-Footnote-863904764
Ref: ライブラリ<15>-Footnote-873904807
Ref: ライブラリ<15>-Footnote-883904864
Ref: ライブラリ<15>-Footnote-893904946
Ref: ライブラリ<15>-Footnote-903905002
Ref: ライブラリ<15>-Footnote-913905059
Ref: ライブラリ<15>-Footnote-923905116
Ref: ライブラリ<15>-Footnote-933905173
Ref: ライブラリ<15>-Footnote-943905230
Ref: ライブラリ<15>-Footnote-953905286
Ref: ライブラリ<15>-Footnote-963905343
Ref: ライブラリ<15>-Footnote-973905400
Ref: ライブラリ<15>-Footnote-983905457
Ref: ライブラリ<15>-Footnote-993905513
Ref: ライブラリ<15>-Footnote-1003905570
Ref: ライブラリ<15>-Footnote-1013905628
Ref: ライブラリ<15>-Footnote-1023905686
Ref: ライブラリ<15>-Footnote-1033905744
Ref: ライブラリ<15>-Footnote-1043905802
Ref: ライブラリ<15>-Footnote-1053905860
Ref: ライブラリ<15>-Footnote-1063905918
Ref: ライブラリ<15>-Footnote-1073905976
Ref: ライブラリ<15>-Footnote-1083906034
Ref: ライブラリ<15>-Footnote-1093906091
Ref: ライブラリ<15>-Footnote-1103906148
Ref: ライブラリ<15>-Footnote-1113906206
Ref: ライブラリ<15>-Footnote-1123906264
Ref: ライブラリ<15>-Footnote-1133906322
Ref: ライブラリ<15>-Footnote-1143906380
Ref: ライブラリ<15>-Footnote-1153906438
Ref: ライブラリ<15>-Footnote-1163906496
Ref: ライブラリ<15>-Footnote-1173906554
Ref: ライブラリ<15>-Footnote-1183906612
Ref: ライブラリ<15>-Footnote-1193906670
Ref: ライブラリ<15>-Footnote-1203906727
Ref: ライブラリ<15>-Footnote-1213906784
Ref: ライブラリ<15>-Footnote-1223906842
Ref: ライブラリ<15>-Footnote-1233906900
Ref: ライブラリ<15>-Footnote-1243906958
Ref: ライブラリ<15>-Footnote-1253907016
Ref: ライブラリ<15>-Footnote-1263907074
Ref: ライブラリ<15>-Footnote-1273907132
Ref: ライブラリ<15>-Footnote-1283907190
Ref: ライブラリ<15>-Footnote-1293907248
Ref: ライブラリ<15>-Footnote-1303907306
Ref: ライブラリ<15>-Footnote-1313907364
Ref: ライブラリ<15>-Footnote-1323907422
Ref: ライブラリ<15>-Footnote-1333907480
Ref: ライブラリ<15>-Footnote-1343907538
Ref: ライブラリ<15>-Footnote-1353907595
Ref: ライブラリ<15>-Footnote-1363907653
Ref: ライブラリ<15>-Footnote-1373907711
Ref: ライブラリ<15>-Footnote-1383907769
Ref: ライブラリ<15>-Footnote-1393907827
Ref: ライブラリ<15>-Footnote-1403907885
Ref: ライブラリ<15>-Footnote-1413907943
Ref: ライブラリ<15>-Footnote-1423908001
Ref: ライブラリ<15>-Footnote-1433908058
Ref: ライブラリ<15>-Footnote-1443908116
Ref: ライブラリ<15>-Footnote-1453908174
Ref: ライブラリ<15>-Footnote-1463908232
Ref: ライブラリ<15>-Footnote-1473908290
Ref: ライブラリ<15>-Footnote-1483908350
Ref: ライブラリ<15>-Footnote-1493908402
Ref: ライブラリ<15>-Footnote-1503908460
Ref: ライブラリ<15>-Footnote-1513908518
Ref: ライブラリ<15>-Footnote-1523908576
Ref: ライブラリ<15>-Footnote-1533908620
Ref: ライブラリ<15>-Footnote-1543908677
Ref: ライブラリ<15>-Footnote-1553908735
Ref: ライブラリ<15>-Footnote-1563908793
Ref: ライブラリ<15>-Footnote-1573908850
Ref: ライブラリ<15>-Footnote-1583908908
Ref: ライブラリ<15>-Footnote-1593908966
Ref: ライブラリ<15>-Footnote-1603909024
Ref: ライブラリ<15>-Footnote-1613909082
Ref: ライブラリ<15>-Footnote-1623909139
Ref: ライブラリ<15>-Footnote-1633909197
Ref: ライブラリ<15>-Footnote-1643909255
Ref: ライブラリ<15>-Footnote-1653909313
Ref: ライブラリ<15>-Footnote-1663909371
Ref: ライブラリ<15>-Footnote-1673909429
Ref: ライブラリ<15>-Footnote-1683909487
Ref: ライブラリ<15>-Footnote-1693909545
Ref: ライブラリ<15>-Footnote-1703909603
Ref: ライブラリ<15>-Footnote-1713909661
Ref: ライブラリ<15>-Footnote-1723909719
Ref: ライブラリ<15>-Footnote-1733909776
Ref: ライブラリ<15>-Footnote-1743909833
Ref: ライブラリ<15>-Footnote-1753909891
Ref: ライブラリ<15>-Footnote-1763909949
Ref: ライブラリ<15>-Footnote-1773910006
Ref: ライブラリ<15>-Footnote-1783910064
Ref: ライブラリ<15>-Footnote-1793910122
Ref: ライブラリ<15>-Footnote-1803910179
Ref: ライブラリ<15>-Footnote-1813910237
Ref: ライブラリ<15>-Footnote-1823910295
Ref: ライブラリ<15>-Footnote-1833910353
Ref: ライブラリ<15>-Footnote-1843910411
Ref: ライブラリ<15>-Footnote-1853910469
Ref: ライブラリ<15>-Footnote-1863910521
Ref: ライブラリ<15>-Footnote-1873910567
Ref: ライブラリ<15>-Footnote-1883910625
Ref: ライブラリ<15>-Footnote-1893910683
Ref: ライブラリ<15>-Footnote-1903910741
Ref: ライブラリ<15>-Footnote-1913910799
Ref: ライブラリ<15>-Footnote-1923910857
Ref: ライブラリ<15>-Footnote-1933910914
Ref: ライブラリ<15>-Footnote-1943910972
Ref: ライブラリ<15>-Footnote-1953911030
Ref: ライブラリ<15>-Footnote-1963911088
Ref: ライブラリ<15>-Footnote-1973911146
Ref: ライブラリ<15>-Footnote-1983911204
Ref: ライブラリ<15>-Footnote-1993911262
Ref: ライブラリ<15>-Footnote-2003911320
Ref: ライブラリ<15>-Footnote-2013911378
Ref: ライブラリ<15>-Footnote-2023911436
Ref: ライブラリ<15>-Footnote-2033911493
Ref: ライブラリ<15>-Footnote-2043911551
Ref: ライブラリ<15>-Footnote-2053911609
Ref: ライブラリ<15>-Footnote-2063911667
Ref: ライブラリ<15>-Footnote-2073911725
Ref: ライブラリ<15>-Footnote-2083911783
Ref: ライブラリ<15>-Footnote-2093911841
Ref: ライブラリ<15>-Footnote-2103911899
Ref: ライブラリ<15>-Footnote-2113911957
Ref: ライブラリ<15>-Footnote-2123912015
Ref: ライブラリ<15>-Footnote-2133912073
Ref: ライブラリ<15>-Footnote-2143912131
Ref: ライブラリ<15>-Footnote-2153912189
Ref: ライブラリ<15>-Footnote-2163912247
Ref: ライブラリ<15>-Footnote-2173912305
Ref: ライブラリ<15>-Footnote-2183912363
Ref: ライブラリ<15>-Footnote-2193912440
Ref: ライブラリ<15>-Footnote-2203912498
Ref: ライブラリ<15>-Footnote-2213912556
Ref: ライブラリ<15>-Footnote-2223912614
Ref: ライブラリ<15>-Footnote-2233912672
Ref: ライブラリ<15>-Footnote-2243912730
Ref: ライブラリ<15>-Footnote-2253912788
Ref: ライブラリ<15>-Footnote-2263912846
Ref: ライブラリ<15>-Footnote-2273912904
Ref: ライブラリ<15>-Footnote-2283912962
Ref: ライブラリ<15>-Footnote-2293913020
Ref: ライブラリ<15>-Footnote-2303913078
Ref: ライブラリ<15>-Footnote-2313913136
Ref: ライブラリ<15>-Footnote-2323913180
Ref: ライブラリ<15>-Footnote-2333913238
Ref: ライブラリ<15>-Footnote-2343913296
Ref: ライブラリ<15>-Footnote-2353913354
Ref: ライブラリ<15>-Footnote-2363913412
Ref: ライブラリ<15>-Footnote-2373913470
Ref: ライブラリ<15>-Footnote-2383913528
Ref: ライブラリ<15>-Footnote-2393913586
Ref: ライブラリ<15>-Footnote-2403913644
Ref: ライブラリ<15>-Footnote-2413913702
Ref: ライブラリ<15>-Footnote-2423913760
Ref: ライブラリ<15>-Footnote-2433913818
Ref: ライブラリ<15>-Footnote-2443913876
Ref: ライブラリ<15>-Footnote-2453913934
Ref: ライブラリ<15>-Footnote-2463913992
Ref: ライブラリ<15>-Footnote-2473914053
Ref: ライブラリ<15>-Footnote-2483914111
Ref: ライブラリ<15>-Footnote-2493914169
Ref: ライブラリ<15>-Footnote-2503914227
Ref: ライブラリ<15>-Footnote-2513914284
Ref: ライブラリ<15>-Footnote-2523914342
Ref: ライブラリ<15>-Footnote-2533914400
Ref: ライブラリ<15>-Footnote-2543914458
Ref: ライブラリ<15>-Footnote-2553914516
Ref: ライブラリ<15>-Footnote-2563914574
Ref: ライブラリ<15>-Footnote-2573914632
Ref: ライブラリ<15>-Footnote-2583914689
Ref: ライブラリ<15>-Footnote-2593914747
Ref: ライブラリ<15>-Footnote-2603914804
Ref: ライブラリ<15>-Footnote-2613914861
Ref: ライブラリ<15>-Footnote-2623914918
Ref: ライブラリ<15>-Footnote-2633914976
Ref: ライブラリ<15>-Footnote-2643915033
Ref: ライブラリ<15>-Footnote-2653915090
Ref: ライブラリ<15>-Footnote-2663915148
Ref: ライブラリ<15>-Footnote-2673915206
Ref: ライブラリ<15>-Footnote-2683915264
Ref: ライブラリ<15>-Footnote-2693915322
Ref: ライブラリ<15>-Footnote-2703915380
Ref: ライブラリ<15>-Footnote-2713915437
Ref: ライブラリ<15>-Footnote-2723915495
Ref: ライブラリ<15>-Footnote-2733915553
Ref: ライブラリ<15>-Footnote-2743915611
Ref: ライブラリ<15>-Footnote-2753915669
Ref: ライブラリ<15>-Footnote-2763915727
Ref: ライブラリ<15>-Footnote-2773915785
Ref: ライブラリ<15>-Footnote-2783915843
Ref: ライブラリ<15>-Footnote-2793915901
Ref: ライブラリ<15>-Footnote-2803915959
Ref: ライブラリ<15>-Footnote-2813916017
Ref: ライブラリ<15>-Footnote-2823916075
Ref: ライブラリ<15>-Footnote-2833916132
Ref: ライブラリ<15>-Footnote-2843916190
Ref: ライブラリ<15>-Footnote-2853916248
Ref: ライブラリ<15>-Footnote-2863916306
Ref: ライブラリ<15>-Footnote-2873916364
Ref: ライブラリ<15>-Footnote-2883916422
Ref: ライブラリ<15>-Footnote-2893916480
Ref: ライブラリ<15>-Footnote-2903916538
Ref: ライブラリ<15>-Footnote-2913916596
Ref: ライブラリ<15>-Footnote-2923916654
Ref: ライブラリ<15>-Footnote-2933916712
Ref: ライブラリ<15>-Footnote-2943916770
Ref: ライブラリ<15>-Footnote-2953916828
Ref: ライブラリ<15>-Footnote-2963916886
Ref: ライブラリ<15>-Footnote-2973916944
Ref: ライブラリ<15>-Footnote-2983917001
Ref: ライブラリ<15>-Footnote-2993917059
Ref: ライブラリ<15>-Footnote-3003917117
Ref: ライブラリ<15>-Footnote-3013917175
Ref: ライブラリ<15>-Footnote-3023917233
Ref: ライブラリ<15>-Footnote-3033917291
Ref: ライブラリ<15>-Footnote-3043917349
Ref: ライブラリ<15>-Footnote-3053917407
Ref: ライブラリ<15>-Footnote-3063917465
Ref: ライブラリ<15>-Footnote-3073917522
Ref: ライブラリ<15>-Footnote-3083917580
Ref: ライブラリ<15>-Footnote-3093917624
Ref: ライブラリ<15>-Footnote-3103917682
Ref: ライブラリ<15>-Footnote-3113917740
Ref: ライブラリ<15>-Footnote-3123917798
Ref: ライブラリ<15>-Footnote-3133917856
Ref: ライブラリ<15>-Footnote-3143917914
Ref: ライブラリ<15>-Footnote-3153917972
Ref: ライブラリ<15>-Footnote-3163918030
Ref: ライブラリ<15>-Footnote-3173918088
Ref: ライブラリ<15>-Footnote-3183918146
Ref: ライブラリ<15>-Footnote-3193918204
Ref: ライブラリ<15>-Footnote-3203918262
Ref: ライブラリ<15>-Footnote-3213918320
Ref: ライブラリ<15>-Footnote-3223918377
Ref: ライブラリ<15>-Footnote-3233918435
Ref: ライブラリ<15>-Footnote-3243918493
Ref: ライブラリ<15>-Footnote-3253918551
Ref: ライブラリ<15>-Footnote-3263918609
Ref: ライブラリ<15>-Footnote-3273918667
Ref: ライブラリ<15>-Footnote-3283918725
Ref: ライブラリ<15>-Footnote-3293918783
Ref: ライブラリ<15>-Footnote-3303918840
Ref: ライブラリ<15>-Footnote-3313918897
Ref: ライブラリ<15>-Footnote-3323918955
Ref: ライブラリ<15>-Footnote-3333919013
Ref: ライブラリ<15>-Footnote-3343919070
Ref: ライブラリ<15>-Footnote-3353919128
Ref: ライブラリ<15>-Footnote-3363919186
Ref: ライブラリ<15>-Footnote-3373919244
Ref: ライブラリ<15>-Footnote-3383919302
Ref: ライブラリ<15>-Footnote-3393919359
Ref: ライブラリ<15>-Footnote-3403919417
Ref: ライブラリ<15>-Footnote-3413919475
Ref: ライブラリ<15>-Footnote-3423919533
Ref: ライブラリ<15>-Footnote-3433919591
Ref: ライブラリ<15>-Footnote-3443919649
Ref: ライブラリ<15>-Footnote-3453919706
Ref: ライブラリ<15>-Footnote-3463919764
Ref: ライブラリ<15>-Footnote-3473919821
Ref: ライブラリ<15>-Footnote-3483919879
Ref: ライブラリ<15>-Footnote-3493919937
Ref: ライブラリ<15>-Footnote-3503919995
Ref: ライブラリ<15>-Footnote-3513920053
Ref: ライブラリ<15>-Footnote-3523920110
Ref: ライブラリ<15>-Footnote-3533920167
Ref: ライブラリ<15>-Footnote-3543920224
Ref: ライブラリ<15>-Footnote-3553920281
Ref: ライブラリ<15>-Footnote-3563920338
Ref: ライブラリ<15>-Footnote-3573920395
Ref: ライブラリ<15>-Footnote-3583920462
Ref: ライブラリ<15>-Footnote-3593920529
Ref: ライブラリ<15>-Footnote-3603920586
Ref: ライブラリ<15>-Footnote-3613920653
Ref: ライブラリ<15>-Footnote-3623920720
Node: IDLE<5>3920787
Ref: whatsnew/changelog id803920910
Ref: 1a663920910
Ref: IDLE<5>-Footnote-13921189
Ref: IDLE<5>-Footnote-23921244
Node: ドキュメント<7>3921300
Ref: whatsnew/changelog id813921425
Ref: 1a673921425
Ref: ドキュメント<7>-Footnote-13921866
Ref: ドキュメント<7>-Footnote-23921922
Ref: ドキュメント<7>-Footnote-33921978
Node: Core and Builtins<15>3922043
Ref: whatsnew/changelog id823922180
Ref: 1a683922180
Ref: Core and Builtins<15>-Footnote-13923961
Ref: Core and Builtins<15>-Footnote-23924017
Ref: Core and Builtins<15>-Footnote-33924073
Ref: Core and Builtins<15>-Footnote-43924129
Ref: Core and Builtins<15>-Footnote-53924185
Ref: Core and Builtins<15>-Footnote-63924241
Ref: Core and Builtins<15>-Footnote-73924296
Ref: Core and Builtins<15>-Footnote-83924352
Ref: Core and Builtins<15>-Footnote-93924408
Ref: Core and Builtins<15>-Footnote-103924464
Ref: Core and Builtins<15>-Footnote-113924520
Node: ライブラリ<16>3924563
Ref: whatsnew/changelog id833924700
Ref: 1a693924700
Ref: ライブラリ<16>-Footnote-13924884
Node: Core and Builtins<16>3924940
Ref: whatsnew/changelog id843925075
Ref: 1a6a3925075
Ref: Core and Builtins<16>-Footnote-13926732
Ref: Core and Builtins<16>-Footnote-23926788
Ref: Core and Builtins<16>-Footnote-33926844
Ref: Core and Builtins<16>-Footnote-43926900
Ref: Core and Builtins<16>-Footnote-53926955
Ref: Core and Builtins<16>-Footnote-63927011
Ref: Core and Builtins<16>-Footnote-73927067
Ref: Core and Builtins<16>-Footnote-83927123
Ref: Core and Builtins<16>-Footnote-93927179
Ref: Core and Builtins<16>-Footnote-103927235
Node: ライブラリ<17>3927292
Ref: whatsnew/changelog id853927429
Ref: 1a6e3927429
Ref: ライブラリ<17>-Footnote-13927636
Node: Core and Builtins<17>3927692
Ref: whatsnew/changelog id863927827
Ref: 1a6f3927827
Ref: Core and Builtins<17>-Footnote-13928870
Ref: Core and Builtins<17>-Footnote-23928926
Ref: Core and Builtins<17>-Footnote-33928982
Ref: Core and Builtins<17>-Footnote-43929038
Ref: Core and Builtins<17>-Footnote-53929094
Ref: Core and Builtins<17>-Footnote-63929149
Node: ライブラリ<18>3929204
Ref: whatsnew/changelog id873929341
Ref: 1a713929341
Ref: ライブラリ<18>-Footnote-13929524
Node: Core and Builtins<18>3929580
Ref: whatsnew/changelog id883929715
Ref: 1a723929715
Ref: Core and Builtins<18>-Footnote-13930286
Ref: Core and Builtins<18>-Footnote-23930342
Ref: Core and Builtins<18>-Footnote-33930397
Node: ライブラリ<19>3930453
Ref: whatsnew/changelog id893930590
Ref: 1a733930590
Ref: ライブラリ<19>-Footnote-13930950
Ref: ライブラリ<19>-Footnote-23931006
Node: Core and Builtins<19>3931062
Ref: whatsnew/changelog id903931197
Ref: 1a743931197
Ref: Core and Builtins<19>-Footnote-13936772
Ref: Core and Builtins<19>-Footnote-23936828
Ref: Core and Builtins<19>-Footnote-33936884
Ref: Core and Builtins<19>-Footnote-43936940
Ref: Core and Builtins<19>-Footnote-53936996
Ref: Core and Builtins<19>-Footnote-63937052
Ref: Core and Builtins<19>-Footnote-73937108
Ref: Core and Builtins<19>-Footnote-83937164
Ref: Core and Builtins<19>-Footnote-93937220
Ref: Core and Builtins<19>-Footnote-103937276
Ref: Core and Builtins<19>-Footnote-113937332
Ref: Core and Builtins<19>-Footnote-123937389
Ref: Core and Builtins<19>-Footnote-133937446
Ref: Core and Builtins<19>-Footnote-143937503
Ref: Core and Builtins<19>-Footnote-153937560
Ref: Core and Builtins<19>-Footnote-163937617
Ref: Core and Builtins<19>-Footnote-173937673
Ref: Core and Builtins<19>-Footnote-183937730
Ref: Core and Builtins<19>-Footnote-193937787
Ref: Core and Builtins<19>-Footnote-203937844
Ref: Core and Builtins<19>-Footnote-213937901
Ref: Core and Builtins<19>-Footnote-223937958
Ref: Core and Builtins<19>-Footnote-233938015
Ref: Core and Builtins<19>-Footnote-243938071
Ref: Core and Builtins<19>-Footnote-253938128
Ref: Core and Builtins<19>-Footnote-263938185
Ref: Core and Builtins<19>-Footnote-273938242
Ref: Core and Builtins<19>-Footnote-283938299
Ref: Core and Builtins<19>-Footnote-293938356
Node: ライブラリ<20>3938412
Ref: whatsnew/changelog id913938549
Ref: 1a753938549
Ref: ライブラリ<20>-Footnote-13938858
Ref: ライブラリ<20>-Footnote-23938914
Node: Core and Builtins<20>3938970
Ref: whatsnew/changelog id923939105
Ref: 1a763939105
Ref: Core and Builtins<20>-Footnote-13939394
Ref: Core and Builtins<20>-Footnote-23939450
Node: ライブラリ<21>3939506
Ref: whatsnew/changelog id933939643
Ref: 1a773939643
Ref: ライブラリ<21>-Footnote-13939816
Node: Core and Builtins<21>3939872
Ref: whatsnew/changelog id943940007
Ref: 1a783940007
Ref: Core and Builtins<21>-Footnote-13940359
Node: ライブラリ<22>3940415
Ref: whatsnew/changelog id953940552
Ref: 1a793940552
Ref: ライブラリ<22>-Footnote-13940738
Node: Core and Builtins<22>3940794
Ref: whatsnew/changelog id963940929
Ref: 1a7a3940929
Ref: Core and Builtins<22>-Footnote-13946248
Ref: Core and Builtins<22>-Footnote-23946304
Ref: Core and Builtins<22>-Footnote-33946360
Ref: Core and Builtins<22>-Footnote-43946416
Ref: Core and Builtins<22>-Footnote-53946472
Ref: Core and Builtins<22>-Footnote-63946528
Ref: Core and Builtins<22>-Footnote-73946584
Ref: Core and Builtins<22>-Footnote-83946626
Ref: Core and Builtins<22>-Footnote-93946681
Ref: Core and Builtins<22>-Footnote-103946737
Ref: Core and Builtins<22>-Footnote-113946794
Ref: Core and Builtins<22>-Footnote-123946851
Ref: Core and Builtins<22>-Footnote-133946908
Ref: Core and Builtins<22>-Footnote-143946965
Ref: Core and Builtins<22>-Footnote-153947021
Ref: Core and Builtins<22>-Footnote-163947078
Ref: Core and Builtins<22>-Footnote-173947135
Ref: Core and Builtins<22>-Footnote-183947192
Ref: Core and Builtins<22>-Footnote-193947249
Ref: Core and Builtins<22>-Footnote-203947306
Ref: Core and Builtins<22>-Footnote-213947363
Ref: Core and Builtins<22>-Footnote-223947420
Ref: Core and Builtins<22>-Footnote-233947477
Ref: Core and Builtins<22>-Footnote-243947533
Ref: Core and Builtins<22>-Footnote-253947590
Ref: Core and Builtins<22>-Footnote-263947647
Ref: Core and Builtins<22>-Footnote-273947704
Ref: Core and Builtins<22>-Footnote-283947761
Ref: Core and Builtins<22>-Footnote-293947818
Ref: Core and Builtins<22>-Footnote-303947875
Node: ライブラリ<23>3947932
Ref: whatsnew/changelog id973948069
Ref: 1a7c3948069
Ref: ライブラリ<23>-Footnote-13948490
Ref: ライブラリ<23>-Footnote-23948546
Node: Core and Builtins<23>3948602
Ref: whatsnew/changelog id983948737
Ref: 1a7d3948737
Ref: Core and Builtins<23>-Footnote-13949878
Ref: Core and Builtins<23>-Footnote-23949934
Ref: Core and Builtins<23>-Footnote-33949990
Ref: Core and Builtins<23>-Footnote-43950046
Ref: Core and Builtins<23>-Footnote-53950102
Ref: Core and Builtins<23>-Footnote-63950158
Ref: Core and Builtins<23>-Footnote-73950214
Ref: Core and Builtins<23>-Footnote-83950270
Node: ライブラリ<24>3950326
Ref: whatsnew/changelog id993950463
Ref: 1a7e3950463
Ref: ライブラリ<24>-Footnote-13950659
Node: Core and Builtins<24>3950715
Ref: whatsnew/changelog id1003950850
Ref: 1a7f3950850
Ref: Core and Builtins<24>-Footnote-13951366
Ref: Core and Builtins<24>-Footnote-23951422
Ref: Core and Builtins<24>-Footnote-33951478
Ref: Core and Builtins<24>-Footnote-43951520
Node: ライブラリ<25>3951576
Ref: whatsnew/changelog id1013951713
Ref: 1a803951713
Ref: ライブラリ<25>-Footnote-13951915
Node: Core and Builtins<25>3951971
Ref: whatsnew/changelog id1023952106
Ref: 1a813952106
Ref: Core and Builtins<25>-Footnote-13953185
Ref: Core and Builtins<25>-Footnote-23953241
Ref: Core and Builtins<25>-Footnote-33953297
Ref: Core and Builtins<25>-Footnote-43953353
Ref: Core and Builtins<25>-Footnote-53953409
Ref: Core and Builtins<25>-Footnote-63953465
Ref: Core and Builtins<25>-Footnote-73953521
Ref: Core and Builtins<25>-Footnote-83953577
Node: ライブラリ<26>3953633
Ref: whatsnew/changelog id1033953770
Ref: 1a823953770
Ref: ライブラリ<26>-Footnote-13954000
Node: Core and Builtins<26>3954056
Ref: whatsnew/changelog id1043954191
Ref: 1a833954191
Ref: Core and Builtins<26>-Footnote-13958419
Ref: Core and Builtins<26>-Footnote-23958475
Ref: Core and Builtins<26>-Footnote-33958531
Ref: Core and Builtins<26>-Footnote-43958587
Ref: Core and Builtins<26>-Footnote-53958643
Ref: Core and Builtins<26>-Footnote-63958699
Ref: Core and Builtins<26>-Footnote-73958755
Ref: Core and Builtins<26>-Footnote-83958811
Ref: Core and Builtins<26>-Footnote-93958867
Ref: Core and Builtins<26>-Footnote-103958922
Ref: Core and Builtins<26>-Footnote-113958979
Ref: Core and Builtins<26>-Footnote-123959035
Ref: Core and Builtins<26>-Footnote-133959092
Ref: Core and Builtins<26>-Footnote-143959149
Ref: Core and Builtins<26>-Footnote-153959206
Ref: Core and Builtins<26>-Footnote-163959263
Ref: Core and Builtins<26>-Footnote-173959320
Ref: Core and Builtins<26>-Footnote-183959377
Ref: Core and Builtins<26>-Footnote-193959434
Ref: Core and Builtins<26>-Footnote-203959491
Ref: Core and Builtins<26>-Footnote-213959548
Ref: Core and Builtins<26>-Footnote-223959605
Ref: Core and Builtins<26>-Footnote-233959662
Ref: Core and Builtins<26>-Footnote-243959705
Ref: Core and Builtins<26>-Footnote-253959762
Ref: Core and Builtins<26>-Footnote-263959819
Ref: Core and Builtins<26>-Footnote-273959876
Ref: Core and Builtins<26>-Footnote-283959933
Ref: Core and Builtins<26>-Footnote-293959990
Ref: Core and Builtins<26>-Footnote-303960047
Ref: Core and Builtins<26>-Footnote-313960104
Ref: Core and Builtins<26>-Footnote-323960161
Ref: Core and Builtins<26>-Footnote-333960218
Node: ライブラリ<27>3960263
Ref: whatsnew/changelog id1053960400
Ref: 1a853960400
Ref: ライブラリ<27>-Footnote-13960600
Node: Core and Builtins<27>3960656
Ref: whatsnew/changelog id1063960791
Ref: 1a863960791
Ref: Core and Builtins<27>-Footnote-13961849
Ref: Core and Builtins<27>-Footnote-23961905
Ref: Core and Builtins<27>-Footnote-33961961
Ref: Core and Builtins<27>-Footnote-43962017
Ref: Core and Builtins<27>-Footnote-53962073
Ref: Core and Builtins<27>-Footnote-63962129
Node: ライブラリ<28>3962185
Ref: whatsnew/changelog id1073962322
Ref: 1a873962322
Ref: ライブラリ<28>-Footnote-13962509
Node: Core and Builtins<28>3962565
Ref: whatsnew/changelog id1083962689
Ref: 1a883962689
Ref: Core and Builtins<28>-Footnote-13962881
Node: C API<9>3962937
Ref: whatsnew/changelog id1093963054
Ref: 1a893963054
Ref: C API<9>-Footnote-13968857
Ref: C API<9>-Footnote-23968913
Ref: C API<9>-Footnote-33968969
Ref: C API<9>-Footnote-43969025
Ref: C API<9>-Footnote-53969081
Ref: C API<9>-Footnote-63969137
Ref: C API<9>-Footnote-73969179
Ref: C API<9>-Footnote-83969235
Ref: C API<9>-Footnote-93969291
Ref: C API<9>-Footnote-103969347
Ref: C API<9>-Footnote-113969404
Ref: C API<9>-Footnote-123969461
Ref: C API<9>-Footnote-133969518
Ref: C API<9>-Footnote-143969575
Ref: C API<9>-Footnote-153969632
Ref: C API<9>-Footnote-163969689
Ref: C API<9>-Footnote-173969746
Ref: C API<9>-Footnote-183969803
Ref: C API<9>-Footnote-193969860
Ref: C API<9>-Footnote-203969917
Ref: C API<9>-Footnote-213969974
Ref: C API<9>-Footnote-223970031
Ref: C API<9>-Footnote-233970088
Ref: C API<9>-Footnote-243970145
Ref: C API<9>-Footnote-253970202
Ref: C API<9>-Footnote-263970259
Ref: C API<9>-Footnote-273970316
Ref: C API<9>-Footnote-283970373
Ref: C API<9>-Footnote-293970430
Ref: C API<9>-Footnote-303970487
Ref: C API<9>-Footnote-313970544
Node: ビルド<8>3970601
Ref: whatsnew/changelog id1103970688
Ref: 1a913970688
Ref: ビルド<8>-Footnote-13973995
Ref: ビルド<8>-Footnote-23974051
Ref: ビルド<8>-Footnote-33974107
Ref: ビルド<8>-Footnote-43974162
Ref: ビルド<8>-Footnote-53974218
Ref: ビルド<8>-Footnote-63974274
Ref: ビルド<8>-Footnote-73974330
Ref: ビルド<8>-Footnote-83974386
Ref: ビルド<8>-Footnote-93974442
Ref: ビルド<8>-Footnote-103974498
Ref: ビルド<8>-Footnote-113974555
Ref: ビルド<8>-Footnote-123974612
Ref: ビルド<8>-Footnote-133974669
Ref: ビルド<8>-Footnote-143974712
Ref: ビルド<8>-Footnote-153974769
Ref: ビルド<8>-Footnote-163974816
Ref: ビルド<8>-Footnote-173974873
Ref: ビルド<8>-Footnote-183974916
Ref: ビルド<8>-Footnote-193974973
Ref: ビルド<8>-Footnote-203975030
Ref: ビルド<8>-Footnote-213975087
Ref: ビルド<8>-Footnote-223975144
Ref: ビルド<8>-Footnote-233975201
Node: Python 3 14 0 beta 13975258
Ref: whatsnew/changelog python-3-14-0-beta-13975387
Ref: 1a923975387
Node: Windows<9>3976012
Ref: whatsnew/changelog id1113976102
Ref: 1a933976102
Ref: Windows<9>-Footnote-13976434
Ref: Windows<9>-Footnote-23976490
Node: Tools/Demos<6>3976546
Ref: whatsnew/changelog id1123976658
Ref: 1a943976658
Ref: Tools/Demos<6>-Footnote-13976975
Ref: Tools/Demos<6>-Footnote-23977031
Node: テスト<11>3977087
Ref: whatsnew/changelog id1133977210
Ref: 1a953977210
Ref: テスト<11>-Footnote-13978188
Ref: テスト<11>-Footnote-23978244
Ref: テスト<11>-Footnote-33978299
Ref: テスト<11>-Footnote-43978355
Ref: テスト<11>-Footnote-53978411
Node: セキュリティ<9>3978467
Ref: whatsnew/changelog id1143978595
Ref: 1a963978595
Ref: セキュリティ<9>-Footnote-13979117
Node: ライブラリ<29>3979173
Ref: whatsnew/changelog id1153979295
Ref: 1a973979295
Ref: ライブラリ<29>-Footnote-13998658
Ref: ライブラリ<29>-Footnote-23998714
Ref: ライブラリ<29>-Footnote-33998770
Ref: ライブラリ<29>-Footnote-43998826
Ref: ライブラリ<29>-Footnote-53998882
Ref: ライブラリ<29>-Footnote-63998938
Ref: ライブラリ<29>-Footnote-73998994
Ref: ライブラリ<29>-Footnote-83999050
Ref: ライブラリ<29>-Footnote-93999106
Ref: ライブラリ<29>-Footnote-103999162
Ref: ライブラリ<29>-Footnote-113999219
Ref: ライブラリ<29>-Footnote-123999276
Ref: ライブラリ<29>-Footnote-133999333
Ref: ライブラリ<29>-Footnote-143999390
Ref: ライブラリ<29>-Footnote-153999447
Ref: ライブラリ<29>-Footnote-163999504
Ref: ライブラリ<29>-Footnote-173999561
Ref: ライブラリ<29>-Footnote-183999618
Ref: ライブラリ<29>-Footnote-193999675
Ref: ライブラリ<29>-Footnote-203999732
Ref: ライブラリ<29>-Footnote-213999789
Ref: ライブラリ<29>-Footnote-223999846
Ref: ライブラリ<29>-Footnote-233999903
Ref: ライブラリ<29>-Footnote-243999960
Ref: ライブラリ<29>-Footnote-254000017
Ref: ライブラリ<29>-Footnote-264000074
Ref: ライブラリ<29>-Footnote-274000131
Ref: ライブラリ<29>-Footnote-284000188
Ref: ライブラリ<29>-Footnote-294000245
Ref: ライブラリ<29>-Footnote-304000302
Ref: ライブラリ<29>-Footnote-314000359
Ref: ライブラリ<29>-Footnote-324000416
Ref: ライブラリ<29>-Footnote-334000472
Ref: ライブラリ<29>-Footnote-344000529
Ref: ライブラリ<29>-Footnote-354000586
Ref: ライブラリ<29>-Footnote-364000643
Ref: ライブラリ<29>-Footnote-374000700
Ref: ライブラリ<29>-Footnote-384000757
Ref: ライブラリ<29>-Footnote-394000814
Ref: ライブラリ<29>-Footnote-404000871
Ref: ライブラリ<29>-Footnote-414000928
Ref: ライブラリ<29>-Footnote-424000985
Ref: ライブラリ<29>-Footnote-434001042
Ref: ライブラリ<29>-Footnote-444001099
Ref: ライブラリ<29>-Footnote-454001156
Ref: ライブラリ<29>-Footnote-464001213
Ref: ライブラリ<29>-Footnote-474001270
Ref: ライブラリ<29>-Footnote-484001326
Ref: ライブラリ<29>-Footnote-494001383
Ref: ライブラリ<29>-Footnote-504001440
Ref: ライブラリ<29>-Footnote-514001497
Ref: ライブラリ<29>-Footnote-524001553
Ref: ライブラリ<29>-Footnote-534001610
Ref: ライブラリ<29>-Footnote-544001667
Ref: ライブラリ<29>-Footnote-554001724
Ref: ライブラリ<29>-Footnote-564001781
Ref: ライブラリ<29>-Footnote-574001838
Ref: ライブラリ<29>-Footnote-584001895
Ref: ライブラリ<29>-Footnote-594001952
Ref: ライブラリ<29>-Footnote-604002009
Ref: ライブラリ<29>-Footnote-614002066
Ref: ライブラリ<29>-Footnote-624002123
Ref: ライブラリ<29>-Footnote-634002180
Ref: ライブラリ<29>-Footnote-644002237
Ref: ライブラリ<29>-Footnote-654002294
Ref: ライブラリ<29>-Footnote-664002351
Ref: ライブラリ<29>-Footnote-674002408
Ref: ライブラリ<29>-Footnote-684002465
Ref: ライブラリ<29>-Footnote-694002522
Ref: ライブラリ<29>-Footnote-704002579
Ref: ライブラリ<29>-Footnote-714002639
Ref: ライブラリ<29>-Footnote-724002696
Ref: ライブラリ<29>-Footnote-734002753
Ref: ライブラリ<29>-Footnote-744002809
Ref: ライブラリ<29>-Footnote-754002866
Ref: ライブラリ<29>-Footnote-764002923
Ref: ライブラリ<29>-Footnote-774002980
Ref: ライブラリ<29>-Footnote-784003037
Ref: ライブラリ<29>-Footnote-794003094
Ref: ライブラリ<29>-Footnote-804003150
Ref: ライブラリ<29>-Footnote-814003207
Ref: ライブラリ<29>-Footnote-824003264
Ref: ライブラリ<29>-Footnote-834003320
Ref: ライブラリ<29>-Footnote-844003377
Ref: ライブラリ<29>-Footnote-854003434
Ref: ライブラリ<29>-Footnote-864003491
Ref: ライブラリ<29>-Footnote-874003548
Ref: ライブラリ<29>-Footnote-884003605
Ref: ライブラリ<29>-Footnote-894003661
Ref: ライブラリ<29>-Footnote-904003718
Ref: ライブラリ<29>-Footnote-914003775
Ref: ライブラリ<29>-Footnote-924003832
Ref: ライブラリ<29>-Footnote-934003889
Ref: ライブラリ<29>-Footnote-944003946
Ref: ライブラリ<29>-Footnote-954004003
Ref: ライブラリ<29>-Footnote-964004060
Ref: ライブラリ<29>-Footnote-974004117
Ref: ライブラリ<29>-Footnote-984004174
Ref: ライブラリ<29>-Footnote-994004231
Ref: ライブラリ<29>-Footnote-1004004288
Ref: ライブラリ<29>-Footnote-1014004345
Ref: ライブラリ<29>-Footnote-1024004403
Ref: ライブラリ<29>-Footnote-1034004461
Ref: ライブラリ<29>-Footnote-1044004518
Ref: ライブラリ<29>-Footnote-1054004576
Ref: ライブラリ<29>-Footnote-1064004634
Ref: ライブラリ<29>-Footnote-1074004701
Node: IDLE<6>4004758
Ref: whatsnew/changelog id1164004880
Ref: 1aa44004880
Ref: IDLE<6>-Footnote-14005020
Node: ドキュメント<8>4005076
Ref: whatsnew/changelog id1174005200
Ref: 1aa54005200
Ref: ドキュメント<8>-Footnote-14005563
Ref: ドキュメント<8>-Footnote-24005619
Node: Core and Builtins<29>4005675
Ref: whatsnew/changelog id1184005811
Ref: 1aa74005811
Ref: Core and Builtins<29>-Footnote-14007441
Ref: Core and Builtins<29>-Footnote-24007497
Ref: Core and Builtins<29>-Footnote-34007553
Ref: Core and Builtins<29>-Footnote-44007609
Ref: Core and Builtins<29>-Footnote-54007665
Ref: Core and Builtins<29>-Footnote-64007720
Ref: Core and Builtins<29>-Footnote-74007776
Ref: Core and Builtins<29>-Footnote-84007832
Node: ライブラリ<30>4007888
Ref: whatsnew/changelog id1194008024
Ref: 1aa94008024
Ref: ライブラリ<30>-Footnote-14008237
Ref: ライブラリ<30>-Footnote-24008293
Node: Core and Builtins<30>4008335
Ref: whatsnew/changelog id1204008469
Ref: 1aaa4008469
Ref: Core and Builtins<30>-Footnote-14011022
Ref: Core and Builtins<30>-Footnote-24011078
Ref: Core and Builtins<30>-Footnote-34011134
Ref: Core and Builtins<30>-Footnote-44011190
Ref: Core and Builtins<30>-Footnote-54011246
Ref: Core and Builtins<30>-Footnote-64011302
Ref: Core and Builtins<30>-Footnote-74011358
Ref: Core and Builtins<30>-Footnote-84011414
Ref: Core and Builtins<30>-Footnote-94011470
Ref: Core and Builtins<30>-Footnote-104011526
Ref: Core and Builtins<30>-Footnote-114011583
Ref: Core and Builtins<30>-Footnote-124011626
Ref: Core and Builtins<30>-Footnote-134011683
Ref: Core and Builtins<30>-Footnote-144011740
Ref: Core and Builtins<30>-Footnote-154011783
Ref: Core and Builtins<30>-Footnote-164011840
Ref: Core and Builtins<30>-Footnote-174011897
Ref: Core and Builtins<30>-Footnote-184011954
Node: ライブラリ<31>4012011
Ref: whatsnew/changelog id1214012147
Ref: 1aac4012147
Ref: ライブラリ<31>-Footnote-14012337
Node: Core and Builtins<31>4012393
Ref: whatsnew/changelog id1224012527
Ref: 1aad4012527
Ref: Core and Builtins<31>-Footnote-14019394
Ref: Core and Builtins<31>-Footnote-24019450
Ref: Core and Builtins<31>-Footnote-34019506
Ref: Core and Builtins<31>-Footnote-44019562
Ref: Core and Builtins<31>-Footnote-54019618
Ref: Core and Builtins<31>-Footnote-64019674
Ref: Core and Builtins<31>-Footnote-74019730
Ref: Core and Builtins<31>-Footnote-84019786
Ref: Core and Builtins<31>-Footnote-94019842
Ref: Core and Builtins<31>-Footnote-104019898
Ref: Core and Builtins<31>-Footnote-114019955
Ref: Core and Builtins<31>-Footnote-124020012
Ref: Core and Builtins<31>-Footnote-134020069
Ref: Core and Builtins<31>-Footnote-144020126
Ref: Core and Builtins<31>-Footnote-154020183
Ref: Core and Builtins<31>-Footnote-164020240
Ref: Core and Builtins<31>-Footnote-174020297
Ref: Core and Builtins<31>-Footnote-184020354
Ref: Core and Builtins<31>-Footnote-194020411
Ref: Core and Builtins<31>-Footnote-204020468
Ref: Core and Builtins<31>-Footnote-214020525
Ref: Core and Builtins<31>-Footnote-224020582
Ref: Core and Builtins<31>-Footnote-234020639
Ref: Core and Builtins<31>-Footnote-244020696
Ref: Core and Builtins<31>-Footnote-254020753
Ref: Core and Builtins<31>-Footnote-264020810
Ref: Core and Builtins<31>-Footnote-274020867
Ref: Core and Builtins<31>-Footnote-284020924
Ref: Core and Builtins<31>-Footnote-294020981
Ref: Core and Builtins<31>-Footnote-304021038
Ref: Core and Builtins<31>-Footnote-314021095
Ref: Core and Builtins<31>-Footnote-324021151
Ref: Core and Builtins<31>-Footnote-334021208
Ref: Core and Builtins<31>-Footnote-344021265
Ref: Core and Builtins<31>-Footnote-354021322
Ref: Core and Builtins<31>-Footnote-364021379
Node: ライブラリ<32>4021436
Ref: whatsnew/changelog id1234021560
Ref: 1ab04021560
Ref: ライブラリ<32>-Footnote-14021727
Node: C API<10>4021782
Ref: whatsnew/changelog id1244021897
Ref: 1ab14021897
Ref: C API<10>-Footnote-14024777
Ref: C API<10>-Footnote-24024833
Ref: C API<10>-Footnote-34024889
Ref: C API<10>-Footnote-44024945
Ref: C API<10>-Footnote-54025001
Ref: C API<10>-Footnote-64025057
Ref: C API<10>-Footnote-74025113
Ref: C API<10>-Footnote-84025169
Ref: C API<10>-Footnote-94025225
Ref: C API<10>-Footnote-104025281
Ref: C API<10>-Footnote-114025338
Ref: C API<10>-Footnote-124025395
Ref: C API<10>-Footnote-134025452
Node: ビルド<9>4025508
Ref: whatsnew/changelog id1254025595
Ref: 1ab34025595
Ref: ビルド<9>-Footnote-14026857
Ref: ビルド<9>-Footnote-24026913
Ref: ビルド<9>-Footnote-34026969
Ref: ビルド<9>-Footnote-44027025
Ref: ビルド<9>-Footnote-54027081
Ref: ビルド<9>-Footnote-64027137
Ref: ビルド<9>-Footnote-74027193
Ref: ビルド<9>-Footnote-84027249
Node: Python 3 14 0 alpha 74027305
Ref: whatsnew/changelog python-3-14-0-alpha-74027434
Ref: 1ab44027434
Node: macOS<5>4027945
Ref: whatsnew/changelog id1264028031
Ref: 1ab54028031
Ref: macOS<5>-Footnote-14028334
Ref: macOS<5>-Footnote-24028390
Ref: macOS<5>-Footnote-34028446
Node: Windows<10>4028502
Ref: whatsnew/changelog id1274028611
Ref: 1ab64028611
Ref: Windows<10>-Footnote-14029171
Ref: Windows<10>-Footnote-24029227
Ref: Windows<10>-Footnote-34029283
Ref: Windows<10>-Footnote-44029338
Node: Tools/Demos<7>4029394
Ref: whatsnew/changelog id1284029508
Ref: 1ab74029508
Ref: Tools/Demos<7>-Footnote-14029830
Ref: Tools/Demos<7>-Footnote-24029886
Node: テスト<12>4029942
Ref: whatsnew/changelog id1294030067
Ref: 1ab84030067
Ref: テスト<12>-Footnote-14030457
Ref: テスト<12>-Footnote-24030513
Node: セキュリティ<10>4030569
Ref: whatsnew/changelog id1304030699
Ref: 1aba4030699
Ref: セキュリティ<10>-Footnote-14031427
Ref: セキュリティ<10>-Footnote-24031483
Ref: セキュリティ<10>-Footnote-34031539
Node: ライブラリ<33>4031595
Ref: whatsnew/changelog id1314031733
Ref: 1abb4031733
Ref: ライブラリ<33>-Footnote-14039959
Ref: ライブラリ<33>-Footnote-24040015
Ref: ライブラリ<33>-Footnote-34040071
Ref: ライブラリ<33>-Footnote-44040127
Ref: ライブラリ<33>-Footnote-54040183
Ref: ライブラリ<33>-Footnote-64040239
Ref: ライブラリ<33>-Footnote-74040294
Ref: ライブラリ<33>-Footnote-84040350
Ref: ライブラリ<33>-Footnote-94040406
Ref: ライブラリ<33>-Footnote-104040462
Ref: ライブラリ<33>-Footnote-114040519
Ref: ライブラリ<33>-Footnote-124040576
Ref: ライブラリ<33>-Footnote-134040633
Ref: ライブラリ<33>-Footnote-144040690
Ref: ライブラリ<33>-Footnote-154040747
Ref: ライブラリ<33>-Footnote-164040804
Ref: ライブラリ<33>-Footnote-174040861
Ref: ライブラリ<33>-Footnote-184040918
Ref: ライブラリ<33>-Footnote-194040974
Ref: ライブラリ<33>-Footnote-204041031
Ref: ライブラリ<33>-Footnote-214041088
Ref: ライブラリ<33>-Footnote-224041145
Ref: ライブラリ<33>-Footnote-234041202
Ref: ライブラリ<33>-Footnote-244041259
Ref: ライブラリ<33>-Footnote-254041316
Ref: ライブラリ<33>-Footnote-264041373
Ref: ライブラリ<33>-Footnote-274041430
Ref: ライブラリ<33>-Footnote-284041486
Ref: ライブラリ<33>-Footnote-294041543
Ref: ライブラリ<33>-Footnote-304041599
Ref: ライブラリ<33>-Footnote-314041656
Ref: ライブラリ<33>-Footnote-324041713
Ref: ライブラリ<33>-Footnote-334041770
Ref: ライブラリ<33>-Footnote-344041827
Ref: ライブラリ<33>-Footnote-354041884
Ref: ライブラリ<33>-Footnote-364041941
Ref: ライブラリ<33>-Footnote-374041997
Ref: ライブラリ<33>-Footnote-384042054
Ref: ライブラリ<33>-Footnote-394042111
Ref: ライブラリ<33>-Footnote-404042168
Ref: ライブラリ<33>-Footnote-414042225
Ref: ライブラリ<33>-Footnote-424042282
Ref: ライブラリ<33>-Footnote-434042339
Ref: ライブラリ<33>-Footnote-444042396
Ref: ライブラリ<33>-Footnote-454042468
Ref: ライブラリ<33>-Footnote-464042525
Ref: ライブラリ<33>-Footnote-474042582
Ref: ライブラリ<33>-Footnote-484042639
Ref: ライブラリ<33>-Footnote-494042695
Ref: ライブラリ<33>-Footnote-504042752
Node: ドキュメント<9>4042818
Ref: whatsnew/changelog id1324042955
Ref: 1ac44042955
Ref: ドキュメント<9>-Footnote-14043158
Node: Core and Builtins<32>4043214
Ref: whatsnew/changelog id1334043351
Ref: 1ac54043351
Ref: Core and Builtins<32>-Footnote-14046731
Ref: Core and Builtins<32>-Footnote-24046787
Ref: Core and Builtins<32>-Footnote-34046843
Ref: Core and Builtins<32>-Footnote-44046899
Ref: Core and Builtins<32>-Footnote-54046955
Ref: Core and Builtins<32>-Footnote-64046997
Ref: Core and Builtins<32>-Footnote-74047053
Ref: Core and Builtins<32>-Footnote-84047109
Ref: Core and Builtins<32>-Footnote-94047151
Ref: Core and Builtins<32>-Footnote-104047207
Ref: Core and Builtins<32>-Footnote-114047264
Ref: Core and Builtins<32>-Footnote-124047321
Ref: Core and Builtins<32>-Footnote-134047378
Ref: Core and Builtins<32>-Footnote-144047435
Ref: Core and Builtins<32>-Footnote-154047492
Ref: Core and Builtins<32>-Footnote-164047549
Ref: Core and Builtins<32>-Footnote-174047606
Ref: Core and Builtins<32>-Footnote-184047663
Ref: Core and Builtins<32>-Footnote-194047720
Ref: Core and Builtins<32>-Footnote-204047777
Ref: Core and Builtins<32>-Footnote-214047834
Ref: Core and Builtins<32>-Footnote-224047891
Ref: Core and Builtins<32>-Footnote-234047948
Ref: Core and Builtins<32>-Footnote-244048004
Node: ライブラリ<34>4048061
Ref: whatsnew/changelog id1344048198
Ref: 1ac74048198
Ref: ライブラリ<34>-Footnote-14048412
Ref: ライブラリ<34>-Footnote-24048467
Node: Core and Builtins<33>4048526
Ref: whatsnew/changelog id1354048651
Ref: 1ac84048651
Ref: Core and Builtins<33>-Footnote-14049298
Ref: Core and Builtins<33>-Footnote-24049354
Ref: Core and Builtins<33>-Footnote-34049410
Ref: Core and Builtins<33>-Footnote-44049466
Ref: Core and Builtins<33>-Footnote-54049522
Node: C API<11>4049578
Ref: whatsnew/changelog id1364049697
Ref: 1ac94049697
Ref: C API<11>-Footnote-14049953
Ref: C API<11>-Footnote-24050009
Node: ビルド<10>4050065
Ref: whatsnew/changelog id1374050154
Ref: 1aca4050154
Ref: ビルド<10>-Footnote-14051020
Ref: ビルド<10>-Footnote-24051076
Ref: ビルド<10>-Footnote-34051132
Ref: ビルド<10>-Footnote-44051188
Ref: ビルド<10>-Footnote-54051244
Ref: ビルド<10>-Footnote-64051300
Node: Python 3 14 0 alpha 64051356
Ref: whatsnew/changelog python-3-14-0-alpha-64051486
Ref: 1acb4051486
Node: macOS<6>4052079
Ref: whatsnew/changelog id1384052165
Ref: 1acc4052165
Ref: macOS<6>-Footnote-14052363
Node: Windows<11>4052419
Ref: whatsnew/changelog id1394052528
Ref: 1acd4052528
Ref: Windows<11>-Footnote-14052716
Ref: Windows<11>-Footnote-24052772
Node: Tools/Demos<8>4052839
Ref: whatsnew/changelog id1404052953
Ref: 1ace4052953
Ref: Tools/Demos<8>-Footnote-14053712
Ref: Tools/Demos<8>-Footnote-24053768
Ref: Tools/Demos<8>-Footnote-34053823
Ref: Tools/Demos<8>-Footnote-44053879
Ref: Tools/Demos<8>-Footnote-54053935
Ref: Tools/Demos<8>-Footnote-64053991
Ref: Tools/Demos<8>-Footnote-74054047
Node: テスト<13>4054103
Ref: whatsnew/changelog id1414054228
Ref: 1acf4054228
Ref: テスト<13>-Footnote-14054950
Ref: テスト<13>-Footnote-24055006
Ref: テスト<13>-Footnote-34055062
Ref: テスト<13>-Footnote-44055118
Ref: テスト<13>-Footnote-54055174
Node: セキュリティ<11>4055230
Ref: whatsnew/changelog id1424055360
Ref: 1ad04055360
Ref: セキュリティ<11>-Footnote-14055700
Node: ライブラリ<35>4055756
Ref: whatsnew/changelog id1434055895
Ref: 1ad14055895
Ref: ライブラリ<35>-Footnote-14068587
Ref: ライブラリ<35>-Footnote-24068643
Ref: ライブラリ<35>-Footnote-34068699
Ref: ライブラリ<35>-Footnote-44068755
Ref: ライブラリ<35>-Footnote-54068811
Ref: ライブラリ<35>-Footnote-64068866
Ref: ライブラリ<35>-Footnote-74068921
Ref: ライブラリ<35>-Footnote-84068976
Ref: ライブラリ<35>-Footnote-94069031
Ref: ライブラリ<35>-Footnote-104069087
Ref: ライブラリ<35>-Footnote-114069144
Ref: ライブラリ<35>-Footnote-124069201
Ref: ライブラリ<35>-Footnote-134069258
Ref: ライブラリ<35>-Footnote-144069315
Ref: ライブラリ<35>-Footnote-154069372
Ref: ライブラリ<35>-Footnote-164069429
Ref: ライブラリ<35>-Footnote-174069486
Ref: ライブラリ<35>-Footnote-184069543
Ref: ライブラリ<35>-Footnote-194069599
Ref: ライブラリ<35>-Footnote-204069656
Ref: ライブラリ<35>-Footnote-214069713
Ref: ライブラリ<35>-Footnote-224069769
Ref: ライブラリ<35>-Footnote-234069826
Ref: ライブラリ<35>-Footnote-244069883
Ref: ライブラリ<35>-Footnote-254069940
Ref: ライブラリ<35>-Footnote-264069997
Ref: ライブラリ<35>-Footnote-274070054
Ref: ライブラリ<35>-Footnote-284070111
Ref: ライブラリ<35>-Footnote-294070167
Ref: ライブラリ<35>-Footnote-304070224
Ref: ライブラリ<35>-Footnote-314070281
Ref: ライブラリ<35>-Footnote-324070338
Ref: ライブラリ<35>-Footnote-334070395
Ref: ライブラリ<35>-Footnote-344070452
Ref: ライブラリ<35>-Footnote-354070509
Ref: ライブラリ<35>-Footnote-364070566
Ref: ライブラリ<35>-Footnote-374070623
Ref: ライブラリ<35>-Footnote-384070680
Ref: ライブラリ<35>-Footnote-394070737
Ref: ライブラリ<35>-Footnote-404070793
Ref: ライブラリ<35>-Footnote-414070850
Ref: ライブラリ<35>-Footnote-424070907
Ref: ライブラリ<35>-Footnote-434070964
Ref: ライブラリ<35>-Footnote-444071021
Ref: ライブラリ<35>-Footnote-454071077
Ref: ライブラリ<35>-Footnote-464071134
Ref: ライブラリ<35>-Footnote-474071191
Ref: ライブラリ<35>-Footnote-484071248
Ref: ライブラリ<35>-Footnote-494071304
Ref: ライブラリ<35>-Footnote-504071361
Ref: ライブラリ<35>-Footnote-514071418
Ref: ライブラリ<35>-Footnote-524071475
Ref: ライブラリ<35>-Footnote-534071532
Ref: ライブラリ<35>-Footnote-544071588
Ref: ライブラリ<35>-Footnote-554071645
Ref: ライブラリ<35>-Footnote-564071702
Ref: ライブラリ<35>-Footnote-574071759
Ref: ライブラリ<35>-Footnote-584071816
Ref: ライブラリ<35>-Footnote-594071873
Ref: ライブラリ<35>-Footnote-604071930
Ref: ライブラリ<35>-Footnote-614071987
Ref: ライブラリ<35>-Footnote-624072044
Ref: ライブラリ<35>-Footnote-634072101
Ref: ライブラリ<35>-Footnote-644072157
Ref: ライブラリ<35>-Footnote-654072214
Ref: ライブラリ<35>-Footnote-664072271
Ref: ライブラリ<35>-Footnote-674072327
Ref: ライブラリ<35>-Footnote-684072387
Ref: ライブラリ<35>-Footnote-694072443
Ref: ライブラリ<35>-Footnote-704072503
Ref: ライブラリ<35>-Footnote-714072560
Ref: ライブラリ<35>-Footnote-724072617
Node: ドキュメント<10>4072673
Ref: whatsnew/changelog id1444072811
Ref: 1ad94072811
Ref: ドキュメント<10>-Footnote-14073270
Ref: ドキュメント<10>-Footnote-24073326
Ref: ドキュメント<10>-Footnote-34073382
Node: Core and Builtins<34>4073437
Ref: whatsnew/changelog id1454073575
Ref: 1add4073575
Ref: Core and Builtins<34>-Footnote-14078137
Ref: Core and Builtins<34>-Footnote-24078193
Ref: Core and Builtins<34>-Footnote-34078249
Ref: Core and Builtins<34>-Footnote-44078305
Ref: Core and Builtins<34>-Footnote-54078361
Ref: Core and Builtins<34>-Footnote-64078417
Ref: Core and Builtins<34>-Footnote-74078473
Ref: Core and Builtins<34>-Footnote-84078529
Ref: Core and Builtins<34>-Footnote-94078585
Ref: Core and Builtins<34>-Footnote-104078641
Ref: Core and Builtins<34>-Footnote-114078698
Ref: Core and Builtins<34>-Footnote-124078755
Ref: Core and Builtins<34>-Footnote-134078812
Ref: Core and Builtins<34>-Footnote-144078869
Ref: Core and Builtins<34>-Footnote-154078926
Ref: Core and Builtins<34>-Footnote-164078983
Ref: Core and Builtins<34>-Footnote-174079040
Ref: Core and Builtins<34>-Footnote-184079097
Ref: Core and Builtins<34>-Footnote-194079154
Ref: Core and Builtins<34>-Footnote-204079211
Ref: Core and Builtins<34>-Footnote-214079268
Ref: Core and Builtins<34>-Footnote-224079327
Ref: Core and Builtins<34>-Footnote-234079384
Ref: Core and Builtins<34>-Footnote-244079441
Ref: Core and Builtins<34>-Footnote-254079498
Ref: Core and Builtins<34>-Footnote-264079555
Ref: Core and Builtins<34>-Footnote-274079612
Ref: Core and Builtins<34>-Footnote-284079669
Ref: Core and Builtins<34>-Footnote-294079726
Ref: Core and Builtins<34>-Footnote-304079769
Ref: Core and Builtins<34>-Footnote-314079826
Ref: Core and Builtins<34>-Footnote-324079882
Node: ライブラリ<36>4079939
Ref: whatsnew/changelog id1464080076
Ref: 1adf4080076
Ref: ライブラリ<36>-Footnote-14080230
Node: Core and Builtins<35>4080286
Ref: whatsnew/changelog id1474080421
Ref: 1ae04080421
Ref: Core and Builtins<35>-Footnote-14083107
Ref: Core and Builtins<35>-Footnote-24083163
Ref: Core and Builtins<35>-Footnote-34083219
Ref: Core and Builtins<35>-Footnote-44083275
Ref: Core and Builtins<35>-Footnote-54083331
Ref: Core and Builtins<35>-Footnote-64083387
Ref: Core and Builtins<35>-Footnote-74083443
Ref: Core and Builtins<35>-Footnote-84083499
Ref: Core and Builtins<35>-Footnote-94083555
Ref: Core and Builtins<35>-Footnote-104083611
Ref: Core and Builtins<35>-Footnote-114083668
Ref: Core and Builtins<35>-Footnote-124083725
Ref: Core and Builtins<35>-Footnote-134083781
Ref: Core and Builtins<35>-Footnote-144083838
Node: ライブラリ<37>4083895
Ref: whatsnew/changelog id1484084032
Ref: 1ae24084032
Ref: ライブラリ<37>-Footnote-14084304
Node: Core and Builtins<36>4084360
Ref: whatsnew/changelog id1494084485
Ref: 1ae34084485
Ref: Core and Builtins<36>-Footnote-14084682
Node: C API<12>4084747
Ref: whatsnew/changelog id1504084866
Ref: 1ae44084866
Ref: C API<12>-Footnote-14087238
Ref: C API<12>-Footnote-24087294
Ref: C API<12>-Footnote-34087350
Ref: C API<12>-Footnote-44087406
Ref: C API<12>-Footnote-54087459
Node: ビルド<11>4087514
Ref: whatsnew/changelog id1514087603
Ref: 1ae64087603
Ref: ビルド<11>-Footnote-14088729
Ref: ビルド<11>-Footnote-24088785
Ref: ビルド<11>-Footnote-34088841
Ref: ビルド<11>-Footnote-44088897
Ref: ビルド<11>-Footnote-54088953
Ref: ビルド<11>-Footnote-64089009
Ref: ビルド<11>-Footnote-74089065
Node: Python 3 14 0 alpha 54089120
Ref: whatsnew/changelog python-3-14-0-alpha-54089250
Ref: 1ae74089250
Node: macOS<7>4089876
Ref: whatsnew/changelog id1524089965
Ref: 1ae84089965
Ref: macOS<7>-Footnote-14090096
Node: Tools/Demos<9>4090151
Ref: whatsnew/changelog id1534090262
Ref: 1ae94090262
Ref: Tools/Demos<9>-Footnote-14090561
Ref: Tools/Demos<9>-Footnote-24090617
Node: テスト<14>4090673
Ref: whatsnew/changelog id1544090798
Ref: 1aea4090798
Ref: テスト<14>-Footnote-14091535
Ref: テスト<14>-Footnote-24091591
Ref: テスト<14>-Footnote-34091647
Node: セキュリティ<12>4091703
Ref: whatsnew/changelog id1554091833
Ref: 1aeb4091833
Ref: セキュリティ<12>-Footnote-14093402
Ref: セキュリティ<12>-Footnote-24093458
Ref: セキュリティ<12>-Footnote-34093519
Ref: セキュリティ<12>-Footnote-44093575
Ref: セキュリティ<12>-Footnote-54093630
Node: ライブラリ<38>4093686
Ref: whatsnew/changelog id1564093810
Ref: 1aec4093810
Ref: ライブラリ<38>-Footnote-14105446
Ref: ライブラリ<38>-Footnote-24105502
Ref: ライブラリ<38>-Footnote-34105558
Ref: ライブラリ<38>-Footnote-44105614
Ref: ライブラリ<38>-Footnote-54105670
Ref: ライブラリ<38>-Footnote-64105726
Ref: ライブラリ<38>-Footnote-74105782
Ref: ライブラリ<38>-Footnote-84105838
Ref: ライブラリ<38>-Footnote-94105894
Ref: ライブラリ<38>-Footnote-104105950
Ref: ライブラリ<38>-Footnote-114106007
Ref: ライブラリ<38>-Footnote-124106064
Ref: ライブラリ<38>-Footnote-134106121
Ref: ライブラリ<38>-Footnote-144106178
Ref: ライブラリ<38>-Footnote-154106235
Ref: ライブラリ<38>-Footnote-164106292
Ref: ライブラリ<38>-Footnote-174106349
Ref: ライブラリ<38>-Footnote-184106406
Ref: ライブラリ<38>-Footnote-194106463
Ref: ライブラリ<38>-Footnote-204106520
Ref: ライブラリ<38>-Footnote-214106577
Ref: ライブラリ<38>-Footnote-224106634
Ref: ライブラリ<38>-Footnote-234106690
Ref: ライブラリ<38>-Footnote-244106747
Ref: ライブラリ<38>-Footnote-254106804
Ref: ライブラリ<38>-Footnote-264106861
Ref: ライブラリ<38>-Footnote-274106918
Ref: ライブラリ<38>-Footnote-284106975
Ref: ライブラリ<38>-Footnote-294107032
Ref: ライブラリ<38>-Footnote-304107089
Ref: ライブラリ<38>-Footnote-314107146
Ref: ライブラリ<38>-Footnote-324107203
Ref: ライブラリ<38>-Footnote-334107260
Ref: ライブラリ<38>-Footnote-344107317
Ref: ライブラリ<38>-Footnote-354107374
Ref: ライブラリ<38>-Footnote-364107431
Ref: ライブラリ<38>-Footnote-374107488
Ref: ライブラリ<38>-Footnote-384107545
Ref: ライブラリ<38>-Footnote-394107602
Ref: ライブラリ<38>-Footnote-404107659
Ref: ライブラリ<38>-Footnote-414107716
Ref: ライブラリ<38>-Footnote-424107773
Ref: ライブラリ<38>-Footnote-434107830
Ref: ライブラリ<38>-Footnote-444107887
Ref: ライブラリ<38>-Footnote-454107944
Ref: ライブラリ<38>-Footnote-464108001
Ref: ライブラリ<38>-Footnote-474108058
Ref: ライブラリ<38>-Footnote-484108118
Ref: ライブラリ<38>-Footnote-494108174
Ref: ライブラリ<38>-Footnote-504108231
Ref: ライブラリ<38>-Footnote-514108287
Ref: ライブラリ<38>-Footnote-524108344
Ref: ライブラリ<38>-Footnote-534108401
Ref: ライブラリ<38>-Footnote-544108458
Ref: ライブラリ<38>-Footnote-554108515
Ref: ライブラリ<38>-Footnote-564108572
Ref: ライブラリ<38>-Footnote-574108629
Ref: ライブラリ<38>-Footnote-584108686
Ref: ライブラリ<38>-Footnote-594108743
Ref: ライブラリ<38>-Footnote-604108800
Ref: ライブラリ<38>-Footnote-614108857
Ref: ライブラリ<38>-Footnote-624108914
Ref: ライブラリ<38>-Footnote-634108970
Ref: ライブラリ<38>-Footnote-644109027
Ref: ライブラリ<38>-Footnote-654109084
Ref: ライブラリ<38>-Footnote-664109141
Ref: ライブラリ<38>-Footnote-674109197
Ref: ライブラリ<38>-Footnote-684109254
Ref: ライブラリ<38>-Footnote-694109311
Ref: ライブラリ<38>-Footnote-704109367
Node: IDLE<7>4109433
Ref: whatsnew/changelog id1574109557
Ref: 1af54109557
Ref: IDLE<7>-Footnote-14109779
Node: ドキュメント<11>4109835
Ref: whatsnew/changelog id1584109961
Ref: 1af64109961
Ref: ドキュメント<11>-Footnote-14110390
Ref: ドキュメント<11>-Footnote-24110446
Node: Core and Builtins<37>4110501
Ref: whatsnew/changelog id1594110639
Ref: 1af84110639
Ref: Core and Builtins<37>-Footnote-14111749
Ref: Core and Builtins<37>-Footnote-24111805
Ref: Core and Builtins<37>-Footnote-34111861
Ref: Core and Builtins<37>-Footnote-44111917
Ref: Core and Builtins<37>-Footnote-54111973
Ref: Core and Builtins<37>-Footnote-64112029
Ref: Core and Builtins<37>-Footnote-74112085
Ref: Core and Builtins<37>-Footnote-84112141
Ref: Core and Builtins<37>-Footnote-94112197
Node: ライブラリ<39>4112253
Ref: whatsnew/changelog id1604112390
Ref: 1afb4112390
Ref: ライブラリ<39>-Footnote-14112600
Node: Core and Builtins<38>4112656
Ref: whatsnew/changelog id1614112791
Ref: 1afc4112791
Ref: Core and Builtins<38>-Footnote-14117345
Ref: Core and Builtins<38>-Footnote-24117401
Ref: Core and Builtins<38>-Footnote-34117457
Ref: Core and Builtins<38>-Footnote-44117513
Ref: Core and Builtins<38>-Footnote-54117569
Ref: Core and Builtins<38>-Footnote-64117625
Ref: Core and Builtins<38>-Footnote-74117681
Ref: Core and Builtins<38>-Footnote-84117737
Ref: Core and Builtins<38>-Footnote-94117793
Ref: Core and Builtins<38>-Footnote-104117849
Ref: Core and Builtins<38>-Footnote-114117906
Ref: Core and Builtins<38>-Footnote-124117963
Ref: Core and Builtins<38>-Footnote-134118020
Ref: Core and Builtins<38>-Footnote-144118077
Ref: Core and Builtins<38>-Footnote-154118134
Ref: Core and Builtins<38>-Footnote-164118191
Ref: Core and Builtins<38>-Footnote-174118248
Ref: Core and Builtins<38>-Footnote-184118305
Ref: Core and Builtins<38>-Footnote-194118362
Ref: Core and Builtins<38>-Footnote-204118419
Ref: Core and Builtins<38>-Footnote-214118476
Ref: Core and Builtins<38>-Footnote-224118533
Ref: Core and Builtins<38>-Footnote-234118590
Ref: Core and Builtins<38>-Footnote-244118647
Node: ライブラリ<40>4118704
Ref: whatsnew/changelog id1624118841
Ref: 1b054118841
Ref: ライブラリ<40>-Footnote-14119113
Node: Core and Builtins<39>4119169
Ref: whatsnew/changelog id1634119304
Ref: 1b064119304
Ref: Core and Builtins<39>-Footnote-14119589
Node: ライブラリ<41>4119645
Ref: whatsnew/changelog id1644119770
Ref: 1b074119770
Ref: ライブラリ<41>-Footnote-14119960
Node: C API<13>4120016
Ref: whatsnew/changelog id1654120133
Ref: 1b084120133
Ref: C API<13>-Footnote-14123329
Ref: C API<13>-Footnote-24123385
Ref: C API<13>-Footnote-34123440
Ref: C API<13>-Footnote-44123495
Ref: C API<13>-Footnote-54123551
Ref: C API<13>-Footnote-64123607
Ref: C API<13>-Footnote-74123649
Ref: C API<13>-Footnote-84123705
Ref: C API<13>-Footnote-94123747
Ref: C API<13>-Footnote-104123803
Ref: C API<13>-Footnote-114123860
Ref: C API<13>-Footnote-124123917
Ref: C API<13>-Footnote-134123971
Ref: C API<13>-Footnote-144124028
Ref: C API<13>-Footnote-154124085
Node: ビルド<12>4124128
Ref: whatsnew/changelog id1664124217
Ref: 1b0b4124217
Ref: ビルド<12>-Footnote-14124554
Ref: ビルド<12>-Footnote-24124610
Node: Python 3 14 0 alpha 44124666
Ref: whatsnew/changelog python-3-14-0-alpha-44124796
Ref: 1b0c4124796
Node: macOS<8>4125274
Ref: whatsnew/changelog id1674125364
Ref: 1b0d4125364
Ref: macOS<8>-Footnote-14125568
Node: Tools/Demos<10>4125624
Ref: whatsnew/changelog id1684125736
Ref: 1b0e4125736
Ref: Tools/Demos<10>-Footnote-14125988
Node: テスト<15>4126044
Ref: whatsnew/changelog id1694126167
Ref: 1b0f4126167
Ref: テスト<15>-Footnote-14126415
Node: ライブラリ<42>4126471
Ref: whatsnew/changelog id1704126600
Ref: 1b104126600
Ref: ライブラリ<42>-Footnote-14135150
Ref: ライブラリ<42>-Footnote-24135206
Ref: ライブラリ<42>-Footnote-34135261
Ref: ライブラリ<42>-Footnote-44135317
Ref: ライブラリ<42>-Footnote-54135373
Ref: ライブラリ<42>-Footnote-64135429
Ref: ライブラリ<42>-Footnote-74135485
Ref: ライブラリ<42>-Footnote-84135541
Ref: ライブラリ<42>-Footnote-94135597
Ref: ライブラリ<42>-Footnote-104135653
Ref: ライブラリ<42>-Footnote-114135710
Ref: ライブラリ<42>-Footnote-124135767
Ref: ライブラリ<42>-Footnote-134135824
Ref: ライブラリ<42>-Footnote-144135880
Ref: ライブラリ<42>-Footnote-154135937
Ref: ライブラリ<42>-Footnote-164135994
Ref: ライブラリ<42>-Footnote-174136051
Ref: ライブラリ<42>-Footnote-184136108
Ref: ライブラリ<42>-Footnote-194136165
Ref: ライブラリ<42>-Footnote-204136222
Ref: ライブラリ<42>-Footnote-214136279
Ref: ライブラリ<42>-Footnote-224136336
Ref: ライブラリ<42>-Footnote-234136392
Ref: ライブラリ<42>-Footnote-244136449
Ref: ライブラリ<42>-Footnote-254136506
Ref: ライブラリ<42>-Footnote-264136554
Ref: ライブラリ<42>-Footnote-274136599
Ref: ライブラリ<42>-Footnote-284136656
Ref: ライブラリ<42>-Footnote-294136713
Ref: ライブラリ<42>-Footnote-304136770
Ref: ライブラリ<42>-Footnote-314136826
Ref: ライブラリ<42>-Footnote-324136883
Ref: ライブラリ<42>-Footnote-334136939
Ref: ライブラリ<42>-Footnote-344136996
Ref: ライブラリ<42>-Footnote-354137053
Ref: ライブラリ<42>-Footnote-364137110
Ref: ライブラリ<42>-Footnote-374137167
Ref: ライブラリ<42>-Footnote-384137224
Ref: ライブラリ<42>-Footnote-394137281
Ref: ライブラリ<42>-Footnote-404137338
Ref: ライブラリ<42>-Footnote-414137395
Ref: ライブラリ<42>-Footnote-424137452
Ref: ライブラリ<42>-Footnote-434137509
Ref: ライブラリ<42>-Footnote-444137566
Ref: ライブラリ<42>-Footnote-454137623
Node: Core and Builtins<40>4137679
Ref: whatsnew/changelog id1714137814
Ref: 1b154137814
Ref: Core and Builtins<40>-Footnote-14138626
Ref: Core and Builtins<40>-Footnote-24138682
Ref: Core and Builtins<40>-Footnote-34138738
Ref: Core and Builtins<40>-Footnote-44138794
Ref: Core and Builtins<40>-Footnote-54138850
Node: ライブラリ<43>4138906
Ref: whatsnew/changelog id1724139043
Ref: 1b164139043
Ref: ライブラリ<43>-Footnote-14139306
Ref: ライブラリ<43>-Footnote-24139362
Node: Core and Builtins<41>4139421
Ref: whatsnew/changelog id1734139556
Ref: 1b174139556
Ref: Core and Builtins<41>-Footnote-14140651
Ref: Core and Builtins<41>-Footnote-24140707
Ref: Core and Builtins<41>-Footnote-34140763
Ref: Core and Builtins<41>-Footnote-44140819
Ref: Core and Builtins<41>-Footnote-54140875
Node: ライブラリ<44>4140931
Ref: whatsnew/changelog id1744141068
Ref: 1b194141068
Ref: ライブラリ<44>-Footnote-14141346
Node: Core and Builtins<42>4141402
Ref: whatsnew/changelog id1754141527
Ref: 1b1a4141527
Ref: Core and Builtins<42>-Footnote-14142988
Ref: Core and Builtins<42>-Footnote-24143044
Ref: Core and Builtins<42>-Footnote-34143099
Ref: Core and Builtins<42>-Footnote-44143155
Ref: Core and Builtins<42>-Footnote-54143235
Ref: Core and Builtins<42>-Footnote-64143291
Ref: Core and Builtins<42>-Footnote-74143347
Ref: Core and Builtins<42>-Footnote-84143403
Node: C API<14>4143459
Ref: whatsnew/changelog id1764143578
Ref: 1b1d4143578
Ref: C API<14>-Footnote-14144383
Ref: C API<14>-Footnote-24144439
Ref: C API<14>-Footnote-34144495
Ref: C API<14>-Footnote-44144551
Node: ビルド<13>4144607
Ref: whatsnew/changelog id1774144696
Ref: 1b1f4144696
Ref: ビルド<13>-Footnote-14146208
Ref: ビルド<13>-Footnote-24146264
Ref: ビルド<13>-Footnote-34146320
Ref: ビルド<13>-Footnote-44146376
Ref: ビルド<13>-Footnote-54146432
Ref: ビルド<13>-Footnote-64146487
Ref: ビルド<13>-Footnote-74146543
Ref: ビルド<13>-Footnote-84146599
Ref: ビルド<13>-Footnote-94146655
Ref: ビルド<13>-Footnote-104146703
Node: Python 3 14 0 alpha 34146760
Ref: whatsnew/changelog python-3-14-0-alpha-34146890
Ref: 1b204146890
Node: Windows<12>4147381
Ref: whatsnew/changelog id1784147474
Ref: 1b214147474
Ref: Windows<12>-Footnote-14147873
Ref: Windows<12>-Footnote-24147929
Node: Tools/Demos<11>4147985
Ref: whatsnew/changelog id1794148100
Ref: 1b224148100
Ref: Tools/Demos<11>-Footnote-14148289
Node: テスト<16>4148345
Ref: whatsnew/changelog id1804148471
Ref: 1b234148471
Ref: テスト<16>-Footnote-14149145
Ref: テスト<16>-Footnote-24149201
Ref: テスト<16>-Footnote-34149257
Ref: テスト<16>-Footnote-44149313
Ref: テスト<16>-Footnote-54149369
Node: セキュリティ<13>4149425
Ref: whatsnew/changelog id1814149555
Ref: 1b244149555
Ref: セキュリティ<13>-Footnote-14149899
Node: ライブラリ<45>4149955
Ref: whatsnew/changelog id1824150094
Ref: 1b254150094
Ref: ライブラリ<45>-Footnote-14160652
Ref: ライブラリ<45>-Footnote-24160708
Ref: ライブラリ<45>-Footnote-34160764
Ref: ライブラリ<45>-Footnote-44160820
Ref: ライブラリ<45>-Footnote-54160876
Ref: ライブラリ<45>-Footnote-64160932
Ref: ライブラリ<45>-Footnote-74160988
Ref: ライブラリ<45>-Footnote-84161044
Ref: ライブラリ<45>-Footnote-94161100
Ref: ライブラリ<45>-Footnote-104161155
Ref: ライブラリ<45>-Footnote-114161212
Ref: ライブラリ<45>-Footnote-124161269
Ref: ライブラリ<45>-Footnote-134161326
Ref: ライブラリ<45>-Footnote-144161383
Ref: ライブラリ<45>-Footnote-154161440
Ref: ライブラリ<45>-Footnote-164161497
Ref: ライブラリ<45>-Footnote-174161554
Ref: ライブラリ<45>-Footnote-184161610
Ref: ライブラリ<45>-Footnote-194161667
Ref: ライブラリ<45>-Footnote-204161724
Ref: ライブラリ<45>-Footnote-214161781
Ref: ライブラリ<45>-Footnote-224161838
Ref: ライブラリ<45>-Footnote-234161895
Ref: ライブラリ<45>-Footnote-244161952
Ref: ライブラリ<45>-Footnote-254162009
Ref: ライブラリ<45>-Footnote-264162066
Ref: ライブラリ<45>-Footnote-274162123
Ref: ライブラリ<45>-Footnote-284162180
Ref: ライブラリ<45>-Footnote-294162237
Ref: ライブラリ<45>-Footnote-304162294
Ref: ライブラリ<45>-Footnote-314162351
Ref: ライブラリ<45>-Footnote-324162408
Ref: ライブラリ<45>-Footnote-334162465
Ref: ライブラリ<45>-Footnote-344162522
Ref: ライブラリ<45>-Footnote-354162579
Ref: ライブラリ<45>-Footnote-364162636
Ref: ライブラリ<45>-Footnote-374162693
Ref: ライブラリ<45>-Footnote-384162750
Ref: ライブラリ<45>-Footnote-394162807
Ref: ライブラリ<45>-Footnote-404162864
Ref: ライブラリ<45>-Footnote-414162921
Ref: ライブラリ<45>-Footnote-424162978
Ref: ライブラリ<45>-Footnote-434163035
Ref: ライブラリ<45>-Footnote-444163092
Ref: ライブラリ<45>-Footnote-454163149
Ref: ライブラリ<45>-Footnote-464163206
Ref: ライブラリ<45>-Footnote-474163262
Ref: ライブラリ<45>-Footnote-484163319
Ref: ライブラリ<45>-Footnote-494163376
Ref: ライブラリ<45>-Footnote-504163433
Ref: ライブラリ<45>-Footnote-514163490
Ref: ライブラリ<45>-Footnote-524163546
Ref: ライブラリ<45>-Footnote-534163603
Ref: ライブラリ<45>-Footnote-544163659
Ref: ライブラリ<45>-Footnote-554163716
Ref: ライブラリ<45>-Footnote-564163773
Ref: ライブラリ<45>-Footnote-574163832
Ref: ライブラリ<45>-Footnote-584163892
Ref: ライブラリ<45>-Footnote-594163949
Ref: ライブラリ<45>-Footnote-604164006
Ref: ライブラリ<45>-Footnote-614164063
Ref: ライブラリ<45>-Footnote-624164119
Ref: ライブラリ<45>-Footnote-634164175
Node: ドキュメント<12>4164231
Ref: whatsnew/changelog id1834164369
Ref: 1b2d4164369
Ref: ドキュメント<12>-Footnote-14164563
Node: Core and Builtins<43>4164619
Ref: whatsnew/changelog id1844164757
Ref: 1b2f4164757
Ref: Core and Builtins<43>-Footnote-14166309
Ref: Core and Builtins<43>-Footnote-24166365
Ref: Core and Builtins<43>-Footnote-34166421
Ref: Core and Builtins<43>-Footnote-44166477
Ref: Core and Builtins<43>-Footnote-54166533
Ref: Core and Builtins<43>-Footnote-64166589
Ref: Core and Builtins<43>-Footnote-74166645
Ref: Core and Builtins<43>-Footnote-84166701
Ref: Core and Builtins<43>-Footnote-94166757
Ref: Core and Builtins<43>-Footnote-104166813
Node: ライブラリ<46>4166870
Ref: whatsnew/changelog id1854167007
Ref: 1b314167007
Ref: ライブラリ<46>-Footnote-14167597
Node: Core and Builtins<44>4167653
Ref: whatsnew/changelog id1864167778
Ref: 1b324167778
Ref: Core and Builtins<44>-Footnote-14170540
Ref: Core and Builtins<44>-Footnote-24170596
Ref: Core and Builtins<44>-Footnote-34170652
Ref: Core and Builtins<44>-Footnote-44170708
Ref: Core and Builtins<44>-Footnote-54170764
Ref: Core and Builtins<44>-Footnote-64170820
Ref: Core and Builtins<44>-Footnote-74170876
Ref: Core and Builtins<44>-Footnote-84170932
Ref: Core and Builtins<44>-Footnote-94170988
Ref: Core and Builtins<44>-Footnote-104171044
Ref: Core and Builtins<44>-Footnote-114171101
Ref: Core and Builtins<44>-Footnote-124171158
Ref: Core and Builtins<44>-Footnote-134171215
Ref: Core and Builtins<44>-Footnote-144171272
Ref: Core and Builtins<44>-Footnote-154171328
Ref: Core and Builtins<44>-Footnote-164171385
Node: C API<15>4171442
Ref: whatsnew/changelog id1874171561
Ref: 1b374171561
Ref: C API<15>-Footnote-14173907
Ref: C API<15>-Footnote-24173963
Ref: C API<15>-Footnote-34174019
Ref: C API<15>-Footnote-44174075
Ref: C API<15>-Footnote-54174131
Ref: C API<15>-Footnote-64174187
Ref: C API<15>-Footnote-74174243
Ref: C API<15>-Footnote-84174299
Ref: C API<15>-Footnote-94174355
Ref: C API<15>-Footnote-104174397
Node: ビルド<14>4174454
Ref: whatsnew/changelog id1884174543
Ref: 1b3d4174543
Ref: ビルド<14>-Footnote-14175095
Ref: ビルド<14>-Footnote-24175151
Ref: ビルド<14>-Footnote-34175207
Ref: ビルド<14>-Footnote-44175263
Ref: ビルド<14>-Footnote-54175319
Node: Python 3 14 0 alpha 24175375
Ref: whatsnew/changelog python-3-14-0-alpha-24175505
Ref: 1b3e4175505
Node: Windows<13>4176120
Ref: whatsnew/changelog id1894176213
Ref: 1b3f4176213
Ref: Windows<13>-Footnote-14177319
Ref: Windows<13>-Footnote-24177375
Ref: Windows<13>-Footnote-34177431
Ref: Windows<13>-Footnote-44177487
Ref: Windows<13>-Footnote-54177543
Ref: Windows<13>-Footnote-64177599
Ref: Windows<13>-Footnote-74177655
Ref: Windows<13>-Footnote-84177711
Ref: Windows<13>-Footnote-94177767
Node: Tools/Demos<12>4177823
Ref: whatsnew/changelog id1904177938
Ref: 1b404177938
Ref: Tools/Demos<12>-Footnote-14178274
Ref: Tools/Demos<12>-Footnote-24178330
Node: テスト<17>4178386
Ref: whatsnew/changelog id1914178512
Ref: 1b414178512
Ref: テスト<17>-Footnote-14178917
Ref: テスト<17>-Footnote-24178973
Ref: テスト<17>-Footnote-34179029
Node: セキュリティ<14>4179085
Ref: whatsnew/changelog id1924179215
Ref: 1b424179215
Ref: セキュリティ<14>-Footnote-14179350
Node: ライブラリ<47>4179406
Ref: whatsnew/changelog id1934179545
Ref: 1b434179545
Ref: ライブラリ<47>-Footnote-14197819
Ref: ライブラリ<47>-Footnote-24197874
Ref: ライブラリ<47>-Footnote-34197930
Ref: ライブラリ<47>-Footnote-44197985
Ref: ライブラリ<47>-Footnote-54198041
Ref: ライブラリ<47>-Footnote-64198097
Ref: ライブラリ<47>-Footnote-74198153
Ref: ライブラリ<47>-Footnote-84198209
Ref: ライブラリ<47>-Footnote-94198265
Ref: ライブラリ<47>-Footnote-104198321
Ref: ライブラリ<47>-Footnote-114198378
Ref: ライブラリ<47>-Footnote-124198435
Ref: ライブラリ<47>-Footnote-134198492
Ref: ライブラリ<47>-Footnote-144198549
Ref: ライブラリ<47>-Footnote-154198606
Ref: ライブラリ<47>-Footnote-164198663
Ref: ライブラリ<47>-Footnote-174198720
Ref: ライブラリ<47>-Footnote-184198777
Ref: ライブラリ<47>-Footnote-194198834
Ref: ライブラリ<47>-Footnote-204198891
Ref: ライブラリ<47>-Footnote-214198948
Ref: ライブラリ<47>-Footnote-224199005
Ref: ライブラリ<47>-Footnote-234199061
Ref: ライブラリ<47>-Footnote-244199121
Ref: ライブラリ<47>-Footnote-254199178
Ref: ライブラリ<47>-Footnote-264199235
Ref: ライブラリ<47>-Footnote-274199292
Ref: ライブラリ<47>-Footnote-284199349
Ref: ライブラリ<47>-Footnote-294199406
Ref: ライブラリ<47>-Footnote-304199463
Ref: ライブラリ<47>-Footnote-314199520
Ref: ライブラリ<47>-Footnote-324199577
Ref: ライブラリ<47>-Footnote-334199634
Ref: ライブラリ<47>-Footnote-344199691
Ref: ライブラリ<47>-Footnote-354199748
Ref: ライブラリ<47>-Footnote-364199805
Ref: ライブラリ<47>-Footnote-374199862
Ref: ライブラリ<47>-Footnote-384199919
Ref: ライブラリ<47>-Footnote-394199976
Ref: ライブラリ<47>-Footnote-404200033
Ref: ライブラリ<47>-Footnote-414200090
Ref: ライブラリ<47>-Footnote-424200147
Ref: ライブラリ<47>-Footnote-434200204
Ref: ライブラリ<47>-Footnote-444200261
Ref: ライブラリ<47>-Footnote-454200318
Ref: ライブラリ<47>-Footnote-464200375
Ref: ライブラリ<47>-Footnote-474200432
Ref: ライブラリ<47>-Footnote-484200492
Ref: ライブラリ<47>-Footnote-494200549
Ref: ライブラリ<47>-Footnote-504200606
Ref: ライブラリ<47>-Footnote-514200663
Ref: ライブラリ<47>-Footnote-524200720
Ref: ライブラリ<47>-Footnote-534200777
Ref: ライブラリ<47>-Footnote-544200834
Ref: ライブラリ<47>-Footnote-554200891
Ref: ライブラリ<47>-Footnote-564200948
Ref: ライブラリ<47>-Footnote-574201005
Ref: ライブラリ<47>-Footnote-584201062
Ref: ライブラリ<47>-Footnote-594201118
Ref: ライブラリ<47>-Footnote-604201175
Ref: ライブラリ<47>-Footnote-614201232
Ref: ライブラリ<47>-Footnote-624201289
Ref: ライブラリ<47>-Footnote-634201346
Ref: ライブラリ<47>-Footnote-644201403
Ref: ライブラリ<47>-Footnote-654201460
Ref: ライブラリ<47>-Footnote-664201516
Ref: ライブラリ<47>-Footnote-674201573
Ref: ライブラリ<47>-Footnote-684201630
Ref: ライブラリ<47>-Footnote-694201687
Ref: ライブラリ<47>-Footnote-704201744
Ref: ライブラリ<47>-Footnote-714201801
Ref: ライブラリ<47>-Footnote-724201858
Ref: ライブラリ<47>-Footnote-734201915
Ref: ライブラリ<47>-Footnote-744201972
Ref: ライブラリ<47>-Footnote-754202029
Ref: ライブラリ<47>-Footnote-764202086
Ref: ライブラリ<47>-Footnote-774202143
Ref: ライブラリ<47>-Footnote-784202200
Ref: ライブラリ<47>-Footnote-794202256
Ref: ライブラリ<47>-Footnote-804202313
Ref: ライブラリ<47>-Footnote-814202370
Ref: ライブラリ<47>-Footnote-824202427
Ref: ライブラリ<47>-Footnote-834202470
Ref: ライブラリ<47>-Footnote-844202526
Ref: ライブラリ<47>-Footnote-854202582
Ref: ライブラリ<47>-Footnote-864202638
Ref: ライブラリ<47>-Footnote-874202695
Ref: ライブラリ<47>-Footnote-884202751
Ref: ライブラリ<47>-Footnote-894202808
Ref: ライブラリ<47>-Footnote-904202864
Ref: ライブラリ<47>-Footnote-914202924
Ref: ライブラリ<47>-Footnote-924202981
Ref: ライブラリ<47>-Footnote-934203038
Ref: ライブラリ<47>-Footnote-944203095
Ref: ライブラリ<47>-Footnote-954203151
Ref: ライブラリ<47>-Footnote-964203208
Ref: ライブラリ<47>-Footnote-974203265
Ref: ライブラリ<47>-Footnote-984203321
Ref: ライブラリ<47>-Footnote-994203378
Ref: ライブラリ<47>-Footnote-1004203435
Ref: ライブラリ<47>-Footnote-1014203493
Ref: ライブラリ<47>-Footnote-1024203550
Ref: ライブラリ<47>-Footnote-1034203617
Node: ドキュメント<13>4203674
Ref: whatsnew/changelog id1944203812
Ref: 1b4f4203812
Ref: ドキュメント<13>-Footnote-14204364
Ref: ドキュメント<13>-Footnote-24204420
Ref: ドキュメント<13>-Footnote-34204476
Node: Core and Builtins<45>4204531
Ref: whatsnew/changelog id1954204669
Ref: 1b504204669
Ref: Core and Builtins<45>-Footnote-14205238
Ref: Core and Builtins<45>-Footnote-24205294
Ref: Core and Builtins<45>-Footnote-34205350
Node: ライブラリ<48>4205406
Ref: whatsnew/changelog id1964205543
Ref: 1b514205543
Ref: ライブラリ<48>-Footnote-14205820
Node: Core and Builtins<46>4205876
Ref: whatsnew/changelog id1974206011
Ref: 1b524206011
Ref: Core and Builtins<46>-Footnote-14206433
Ref: Core and Builtins<46>-Footnote-24206489
Node: ライブラリ<49>4206545
Ref: whatsnew/changelog id1984206682
Ref: 1b534206682
Ref: ライブラリ<49>-Footnote-14206995
Node: Core and Builtins<47>4207051
Ref: whatsnew/changelog id1994207186
Ref: 1b544207186
Ref: Core and Builtins<47>-Footnote-14211871
Ref: Core and Builtins<47>-Footnote-24211927
Ref: Core and Builtins<47>-Footnote-34211983
Ref: Core and Builtins<47>-Footnote-44212039
Ref: Core and Builtins<47>-Footnote-54212095
Ref: Core and Builtins<47>-Footnote-64212151
Ref: Core and Builtins<47>-Footnote-74212207
Ref: Core and Builtins<47>-Footnote-84212263
Ref: Core and Builtins<47>-Footnote-94212319
Ref: Core and Builtins<47>-Footnote-104212374
Ref: Core and Builtins<47>-Footnote-114212431
Ref: Core and Builtins<47>-Footnote-124212488
Ref: Core and Builtins<47>-Footnote-134212545
Ref: Core and Builtins<47>-Footnote-144212602
Ref: Core and Builtins<47>-Footnote-154212659
Ref: Core and Builtins<47>-Footnote-164212716
Ref: Core and Builtins<47>-Footnote-174212773
Ref: Core and Builtins<47>-Footnote-184212830
Ref: Core and Builtins<47>-Footnote-194212887
Ref: Core and Builtins<47>-Footnote-204212944
Ref: Core and Builtins<47>-Footnote-214213001
Ref: Core and Builtins<47>-Footnote-224213058
Ref: Core and Builtins<47>-Footnote-234213115
Ref: Core and Builtins<47>-Footnote-244213172
Ref: Core and Builtins<47>-Footnote-254213229
Ref: Core and Builtins<47>-Footnote-264213286
Ref: Core and Builtins<47>-Footnote-274213343
Node: ライブラリ<50>4213400
Ref: whatsnew/changelog id2004213525
Ref: 1b564213525
Ref: ライブラリ<50>-Footnote-14213884
Ref: ライブラリ<50>-Footnote-24213940
Node: C API<16>4213996
Ref: whatsnew/changelog id2014214113
Ref: 1b574214113
Ref: C API<16>-Footnote-14215124
Ref: C API<16>-Footnote-24215180
Ref: C API<16>-Footnote-34215236
Ref: C API<16>-Footnote-44215292
Ref: C API<16>-Footnote-54215348
Ref: C API<16>-Footnote-64215390
Ref: C API<16>-Footnote-74215446
Node: ビルド<15>4215502
Ref: whatsnew/changelog id2024215591
Ref: 1b584215591
Ref: ビルド<15>-Footnote-14217208
Ref: ビルド<15>-Footnote-24217264
Ref: ビルド<15>-Footnote-34217320
Ref: ビルド<15>-Footnote-44217376
Ref: ビルド<15>-Footnote-54217431
Ref: ビルド<15>-Footnote-64217487
Ref: ビルド<15>-Footnote-74217543
Ref: ビルド<15>-Footnote-84217599
Ref: ビルド<15>-Footnote-94217655
Ref: ビルド<15>-Footnote-104217711
Ref: ビルド<15>-Footnote-114217777
Ref: ビルド<15>-Footnote-124217833
Ref: ビルド<15>-Footnote-134217890
Node: Python 3 14 0 alpha 14217947
Ref: whatsnew/changelog python-3-14-0-alpha-14218076
Ref: 1b594218076
Node: macOS<9>4219107
Ref: whatsnew/changelog id2034219193
Ref: 1b5a4219193
Ref: macOS<9>-Footnote-14219501
Ref: macOS<9>-Footnote-24219557
Ref: macOS<9>-Footnote-34219613
Node: Windows<14>4219669
Ref: whatsnew/changelog id2044219779
Ref: 1b5b4219779
Ref: Windows<14>-Footnote-14221607
Ref: Windows<14>-Footnote-24221663
Ref: Windows<14>-Footnote-34221719
Ref: Windows<14>-Footnote-44221775
Ref: Windows<14>-Footnote-54221831
Ref: Windows<14>-Footnote-64221887
Ref: Windows<14>-Footnote-74221943
Ref: Windows<14>-Footnote-84221999
Ref: Windows<14>-Footnote-94222055
Ref: Windows<14>-Footnote-104222111
Ref: Windows<14>-Footnote-114222168
Ref: Windows<14>-Footnote-124222225
Ref: Windows<14>-Footnote-134222282
Ref: Windows<14>-Footnote-144222339
Ref: Windows<14>-Footnote-154222396
Ref: Windows<14>-Footnote-164222453
Node: Tools/Demos<13>4222509
Ref: whatsnew/changelog id2054222624
Ref: 1b5c4222624
Ref: Tools/Demos<13>-Footnote-14222830
Node: テスト<18>4222886
Ref: whatsnew/changelog id2064223012
Ref: 1b5d4223012
Ref: テスト<18>-Footnote-14226093
Ref: テスト<18>-Footnote-24226149
Ref: テスト<18>-Footnote-34226205
Ref: テスト<18>-Footnote-44226261
Ref: テスト<18>-Footnote-54226317
Ref: テスト<18>-Footnote-64226373
Ref: テスト<18>-Footnote-74226429
Ref: テスト<18>-Footnote-84226484
Ref: テスト<18>-Footnote-94226539
Ref: テスト<18>-Footnote-104226595
Ref: テスト<18>-Footnote-114226652
Ref: テスト<18>-Footnote-124226709
Ref: テスト<18>-Footnote-134226766
Ref: テスト<18>-Footnote-144226823
Ref: テスト<18>-Footnote-154226880
Ref: テスト<18>-Footnote-164226937
Ref: テスト<18>-Footnote-174226994
Ref: テスト<18>-Footnote-184227051
Node: セキュリティ<15>4227108
Ref: whatsnew/changelog id2074227238
Ref: 1b614227238
Ref: セキュリティ<15>-Footnote-14229563
Ref: セキュリティ<15>-Footnote-24229619
Ref: セキュリティ<15>-Footnote-34229675
Ref: セキュリティ<15>-Footnote-44229731
Ref: セキュリティ<15>-Footnote-54229787
Ref: セキュリティ<15>-Footnote-64229843
Ref: セキュリティ<15>-Footnote-74229899
Ref: セキュリティ<15>-Footnote-84229955
Ref: セキュリティ<15>-Footnote-94230011
Ref: セキュリティ<15>-Footnote-104230067
Ref: セキュリティ<15>-Footnote-114230124
Ref: セキュリティ<15>-Footnote-124230181
Ref: セキュリティ<15>-Footnote-134230238
Ref: セキュリティ<15>-Footnote-144230295
Node: ライブラリ<51>4230351
Ref: whatsnew/changelog id2084230475
Ref: 1b624230475
Ref: ライブラリ<51>-Footnote-14285633
Ref: ライブラリ<51>-Footnote-24285689
Ref: ライブラリ<51>-Footnote-34285745
Ref: ライブラリ<51>-Footnote-44285800
Ref: ライブラリ<51>-Footnote-54285856
Ref: ライブラリ<51>-Footnote-64285911
Ref: ライブラリ<51>-Footnote-74285967
Ref: ライブラリ<51>-Footnote-84286023
Ref: ライブラリ<51>-Footnote-94286079
Ref: ライブラリ<51>-Footnote-104286135
Ref: ライブラリ<51>-Footnote-114286191
Ref: ライブラリ<51>-Footnote-124286248
Ref: ライブラリ<51>-Footnote-134286305
Ref: ライブラリ<51>-Footnote-144286362
Ref: ライブラリ<51>-Footnote-154286419
Ref: ライブラリ<51>-Footnote-164286476
Ref: ライブラリ<51>-Footnote-174286532
Ref: ライブラリ<51>-Footnote-184286589
Ref: ライブラリ<51>-Footnote-194286645
Ref: ライブラリ<51>-Footnote-204286702
Ref: ライブラリ<51>-Footnote-214286745
Ref: ライブラリ<51>-Footnote-224286802
Ref: ライブラリ<51>-Footnote-234286859
Ref: ライブラリ<51>-Footnote-244286915
Ref: ライブラリ<51>-Footnote-254286972
Ref: ライブラリ<51>-Footnote-264287028
Ref: ライブラリ<51>-Footnote-274287085
Ref: ライブラリ<51>-Footnote-284287141
Ref: ライブラリ<51>-Footnote-294287198
Ref: ライブラリ<51>-Footnote-304287255
Ref: ライブラリ<51>-Footnote-314287311
Ref: ライブラリ<51>-Footnote-324287368
Ref: ライブラリ<51>-Footnote-334287425
Ref: ライブラリ<51>-Footnote-344287482
Ref: ライブラリ<51>-Footnote-354287538
Ref: ライブラリ<51>-Footnote-364287595
Ref: ライブラリ<51>-Footnote-374287652
Ref: ライブラリ<51>-Footnote-384287708
Ref: ライブラリ<51>-Footnote-394287765
Ref: ライブラリ<51>-Footnote-404287821
Ref: ライブラリ<51>-Footnote-414287878
Ref: ライブラリ<51>-Footnote-424287935
Ref: ライブラリ<51>-Footnote-434287992
Ref: ライブラリ<51>-Footnote-444288048
Ref: ライブラリ<51>-Footnote-454288105
Ref: ライブラリ<51>-Footnote-464288162
Ref: ライブラリ<51>-Footnote-474288218
Ref: ライブラリ<51>-Footnote-484288275
Ref: ライブラリ<51>-Footnote-494288332
Ref: ライブラリ<51>-Footnote-504288389
Ref: ライブラリ<51>-Footnote-514288446
Ref: ライブラリ<51>-Footnote-524288503
Ref: ライブラリ<51>-Footnote-534288560
Ref: ライブラリ<51>-Footnote-544288616
Ref: ライブラリ<51>-Footnote-554288673
Ref: ライブラリ<51>-Footnote-564288729
Ref: ライブラリ<51>-Footnote-574288785
Ref: ライブラリ<51>-Footnote-584288841
Ref: ライブラリ<51>-Footnote-594288898
Ref: ライブラリ<51>-Footnote-604288954
Ref: ライブラリ<51>-Footnote-614289011
Ref: ライブラリ<51>-Footnote-624289068
Ref: ライブラリ<51>-Footnote-634289125
Ref: ライブラリ<51>-Footnote-644289181
Ref: ライブラリ<51>-Footnote-654289237
Ref: ライブラリ<51>-Footnote-664289293
Ref: ライブラリ<51>-Footnote-674289350
Ref: ライブラリ<51>-Footnote-684289407
Ref: ライブラリ<51>-Footnote-694289464
Ref: ライブラリ<51>-Footnote-704289521
Ref: ライブラリ<51>-Footnote-714289578
Ref: ライブラリ<51>-Footnote-724289635
Ref: ライブラリ<51>-Footnote-734289692
Ref: ライブラリ<51>-Footnote-744289749
Ref: ライブラリ<51>-Footnote-754289806
Ref: ライブラリ<51>-Footnote-764289862
Ref: ライブラリ<51>-Footnote-774289919
Ref: ライブラリ<51>-Footnote-784289976
Ref: ライブラリ<51>-Footnote-794290033
Ref: ライブラリ<51>-Footnote-804290090
Ref: ライブラリ<51>-Footnote-814290147
Ref: ライブラリ<51>-Footnote-824290204
Ref: ライブラリ<51>-Footnote-834290261
Ref: ライブラリ<51>-Footnote-844290318
Ref: ライブラリ<51>-Footnote-854290375
Ref: ライブラリ<51>-Footnote-864290432
Ref: ライブラリ<51>-Footnote-874290504
Ref: ライブラリ<51>-Footnote-884290561
Ref: ライブラリ<51>-Footnote-894290618
Ref: ライブラリ<51>-Footnote-904290675
Ref: ライブラリ<51>-Footnote-914290732
Ref: ライブラリ<51>-Footnote-924290789
Ref: ライブラリ<51>-Footnote-934290846
Ref: ライブラリ<51>-Footnote-944290903
Ref: ライブラリ<51>-Footnote-954290959
Ref: ライブラリ<51>-Footnote-964291016
Ref: ライブラリ<51>-Footnote-974291073
Ref: ライブラリ<51>-Footnote-984291129
Ref: ライブラリ<51>-Footnote-994291186
Ref: ライブラリ<51>-Footnote-1004291243
Ref: ライブラリ<51>-Footnote-1014291301
Ref: ライブラリ<51>-Footnote-1024291359
Ref: ライブラリ<51>-Footnote-1034291416
Ref: ライブラリ<51>-Footnote-1044291474
Ref: ライブラリ<51>-Footnote-1054291532
Ref: ライブラリ<51>-Footnote-1064291590
Ref: ライブラリ<51>-Footnote-1074291648
Ref: ライブラリ<51>-Footnote-1084291706
Ref: ライブラリ<51>-Footnote-1094291764
Ref: ライブラリ<51>-Footnote-1104291822
Ref: ライブラリ<51>-Footnote-1114291880
Ref: ライブラリ<51>-Footnote-1124291938
Ref: ライブラリ<51>-Footnote-1134291996
Ref: ライブラリ<51>-Footnote-1144292054
Ref: ライブラリ<51>-Footnote-1154292112
Ref: ライブラリ<51>-Footnote-1164292170
Ref: ライブラリ<51>-Footnote-1174292228
Ref: ライブラリ<51>-Footnote-1184292286
Ref: ライブラリ<51>-Footnote-1194292344
Ref: ライブラリ<51>-Footnote-1204292402
Ref: ライブラリ<51>-Footnote-1214292460
Ref: ライブラリ<51>-Footnote-1224292518
Ref: ライブラリ<51>-Footnote-1234292576
Ref: ライブラリ<51>-Footnote-1244292634
Ref: ライブラリ<51>-Footnote-1254292692
Ref: ライブラリ<51>-Footnote-1264292749
Ref: ライブラリ<51>-Footnote-1274292807
Ref: ライブラリ<51>-Footnote-1284292865
Ref: ライブラリ<51>-Footnote-1294292922
Ref: ライブラリ<51>-Footnote-1304292980
Ref: ライブラリ<51>-Footnote-1314293038
Ref: ライブラリ<51>-Footnote-1324293096
Ref: ライブラリ<51>-Footnote-1334293154
Ref: ライブラリ<51>-Footnote-1344293212
Ref: ライブラリ<51>-Footnote-1354293270
Ref: ライブラリ<51>-Footnote-1364293328
Ref: ライブラリ<51>-Footnote-1374293386
Ref: ライブラリ<51>-Footnote-1384293444
Ref: ライブラリ<51>-Footnote-1394293488
Ref: ライブラリ<51>-Footnote-1404293546
Ref: ライブラリ<51>-Footnote-1414293604
Ref: ライブラリ<51>-Footnote-1424293662
Ref: ライブラリ<51>-Footnote-1434293720
Ref: ライブラリ<51>-Footnote-1444293778
Ref: ライブラリ<51>-Footnote-1454293836
Ref: ライブラリ<51>-Footnote-1464293893
Ref: ライブラリ<51>-Footnote-1474293951
Ref: ライブラリ<51>-Footnote-1484294009
Ref: ライブラリ<51>-Footnote-1494294067
Ref: ライブラリ<51>-Footnote-1504294125
Ref: ライブラリ<51>-Footnote-1514294182
Ref: ライブラリ<51>-Footnote-1524294240
Ref: ライブラリ<51>-Footnote-1534294298
Ref: ライブラリ<51>-Footnote-1544294356
Ref: ライブラリ<51>-Footnote-1554294414
Ref: ライブラリ<51>-Footnote-1564294472
Ref: ライブラリ<51>-Footnote-1574294530
Ref: ライブラリ<51>-Footnote-1584294588
Ref: ライブラリ<51>-Footnote-1594294645
Ref: ライブラリ<51>-Footnote-1604294702
Ref: ライブラリ<51>-Footnote-1614294760
Ref: ライブラリ<51>-Footnote-1624294818
Ref: ライブラリ<51>-Footnote-1634294876
Ref: ライブラリ<51>-Footnote-1644294934
Ref: ライブラリ<51>-Footnote-1654294992
Ref: ライブラリ<51>-Footnote-1664295050
Ref: ライブラリ<51>-Footnote-1674295108
Ref: ライブラリ<51>-Footnote-1684295165
Ref: ライブラリ<51>-Footnote-1694295223
Ref: ライブラリ<51>-Footnote-1704295281
Ref: ライブラリ<51>-Footnote-1714295339
Ref: ライブラリ<51>-Footnote-1724295397
Ref: ライブラリ<51>-Footnote-1734295455
Ref: ライブラリ<51>-Footnote-1744295513
Ref: ライブラリ<51>-Footnote-1754295571
Ref: ライブラリ<51>-Footnote-1764295629
Ref: ライブラリ<51>-Footnote-1774295686
Ref: ライブラリ<51>-Footnote-1784295744
Ref: ライブラリ<51>-Footnote-1794295802
Ref: ライブラリ<51>-Footnote-1804295860
Ref: ライブラリ<51>-Footnote-1814295918
Ref: ライブラリ<51>-Footnote-1824295976
Ref: ライブラリ<51>-Footnote-1834296034
Ref: ライブラリ<51>-Footnote-1844296092
Ref: ライブラリ<51>-Footnote-1854296149
Ref: ライブラリ<51>-Footnote-1864296207
Ref: ライブラリ<51>-Footnote-1874296265
Ref: ライブラリ<51>-Footnote-1884296323
Ref: ライブラリ<51>-Footnote-1894296381
Ref: ライブラリ<51>-Footnote-1904296439
Ref: ライブラリ<51>-Footnote-1914296497
Ref: ライブラリ<51>-Footnote-1924296555
Ref: ライブラリ<51>-Footnote-1934296613
Ref: ライブラリ<51>-Footnote-1944296670
Ref: ライブラリ<51>-Footnote-1954296728
Ref: ライブラリ<51>-Footnote-1964296786
Ref: ライブラリ<51>-Footnote-1974296844
Ref: ライブラリ<51>-Footnote-1984296902
Ref: ライブラリ<51>-Footnote-1994296960
Ref: ライブラリ<51>-Footnote-2004297018
Ref: ライブラリ<51>-Footnote-2014297076
Ref: ライブラリ<51>-Footnote-2024297134
Ref: ライブラリ<51>-Footnote-2034297192
Ref: ライブラリ<51>-Footnote-2044297250
Ref: ライブラリ<51>-Footnote-2054297308
Ref: ライブラリ<51>-Footnote-2064297366
Ref: ライブラリ<51>-Footnote-2074297423
Ref: ライブラリ<51>-Footnote-2084297481
Ref: ライブラリ<51>-Footnote-2094297539
Ref: ライブラリ<51>-Footnote-2104297583
Ref: ライブラリ<51>-Footnote-2114297627
Ref: ライブラリ<51>-Footnote-2124297685
Ref: ライブラリ<51>-Footnote-2134297743
Ref: ライブラリ<51>-Footnote-2144297800
Ref: ライブラリ<51>-Footnote-2154297858
Ref: ライブラリ<51>-Footnote-2164297916
Ref: ライブラリ<51>-Footnote-2174297960
Ref: ライブラリ<51>-Footnote-2184298018
Ref: ライブラリ<51>-Footnote-2194298076
Ref: ライブラリ<51>-Footnote-2204298134
Ref: ライブラリ<51>-Footnote-2214298192
Ref: ライブラリ<51>-Footnote-2224298249
Ref: ライブラリ<51>-Footnote-2234298307
Ref: ライブラリ<51>-Footnote-2244298365
Ref: ライブラリ<51>-Footnote-2254298423
Ref: ライブラリ<51>-Footnote-2264298481
Ref: ライブラリ<51>-Footnote-2274298539
Ref: ライブラリ<51>-Footnote-2284298597
Ref: ライブラリ<51>-Footnote-2294298655
Ref: ライブラリ<51>-Footnote-2304298713
Ref: ライブラリ<51>-Footnote-2314298771
Ref: ライブラリ<51>-Footnote-2324298829
Ref: ライブラリ<51>-Footnote-2334298887
Ref: ライブラリ<51>-Footnote-2344298945
Ref: ライブラリ<51>-Footnote-2354299003
Ref: ライブラリ<51>-Footnote-2364299060
Ref: ライブラリ<51>-Footnote-2374299118
Ref: ライブラリ<51>-Footnote-2384299176
Ref: ライブラリ<51>-Footnote-2394299233
Ref: ライブラリ<51>-Footnote-2404299291
Ref: ライブラリ<51>-Footnote-2414299349
Ref: ライブラリ<51>-Footnote-2424299407
Ref: ライブラリ<51>-Footnote-2434299465
Ref: ライブラリ<51>-Footnote-2444299522
Ref: ライブラリ<51>-Footnote-2454299580
Ref: ライブラリ<51>-Footnote-2464299637
Ref: ライブラリ<51>-Footnote-2474299694
Ref: ライブラリ<51>-Footnote-2484299752
Ref: ライブラリ<51>-Footnote-2494299809
Ref: ライブラリ<51>-Footnote-2504299867
Ref: ライブラリ<51>-Footnote-2514299925
Ref: ライブラリ<51>-Footnote-2524299983
Ref: ライブラリ<51>-Footnote-2534300041
Ref: ライブラリ<51>-Footnote-2544300099
Ref: ライブラリ<51>-Footnote-2554300157
Ref: ライブラリ<51>-Footnote-2564300215
Ref: ライブラリ<51>-Footnote-2574300273
Ref: ライブラリ<51>-Footnote-2584300331
Ref: ライブラリ<51>-Footnote-2594300388
Ref: ライブラリ<51>-Footnote-2604300446
Ref: ライブラリ<51>-Footnote-2614300504
Ref: ライブラリ<51>-Footnote-2624300562
Ref: ライブラリ<51>-Footnote-2634300620
Ref: ライブラリ<51>-Footnote-2644300678
Ref: ライブラリ<51>-Footnote-2654300736
Ref: ライブラリ<51>-Footnote-2664300794
Ref: ライブラリ<51>-Footnote-2674300852
Ref: ライブラリ<51>-Footnote-2684300910
Ref: ライブラリ<51>-Footnote-2694300968
Ref: ライブラリ<51>-Footnote-2704301026
Ref: ライブラリ<51>-Footnote-2714301084
Ref: ライブラリ<51>-Footnote-2724301142
Ref: ライブラリ<51>-Footnote-2734301200
Ref: ライブラリ<51>-Footnote-2744301258
Ref: ライブラリ<51>-Footnote-2754301315
Ref: ライブラリ<51>-Footnote-2764301372
Ref: ライブラリ<51>-Footnote-2774301429
Ref: ライブラリ<51>-Footnote-2784301487
Ref: ライブラリ<51>-Footnote-2794301545
Ref: ライブラリ<51>-Footnote-2804301603
Ref: ライブラリ<51>-Footnote-2814301661
Ref: ライブラリ<51>-Footnote-2824301719
Ref: ライブラリ<51>-Footnote-2834301777
Ref: ライブラリ<51>-Footnote-2844301835
Ref: ライブラリ<51>-Footnote-2854301893
Ref: ライブラリ<51>-Footnote-2864301951
Ref: ライブラリ<51>-Footnote-2874302009
Ref: ライブラリ<51>-Footnote-2884302067
Ref: ライブラリ<51>-Footnote-2894302125
Ref: ライブラリ<51>-Footnote-2904302183
Ref: ライブラリ<51>-Footnote-2914302240
Ref: ライブラリ<51>-Footnote-2924302298
Ref: ライブラリ<51>-Footnote-2934302355
Ref: ライブラリ<51>-Footnote-2944302413
Ref: ライブラリ<51>-Footnote-2954302471
Ref: ライブラリ<51>-Footnote-2964302529
Ref: ライブラリ<51>-Footnote-2974302587
Ref: ライブラリ<51>-Footnote-2984302645
Ref: ライブラリ<51>-Footnote-2994302703
Ref: ライブラリ<51>-Footnote-3004302761
Ref: ライブラリ<51>-Footnote-3014302819
Ref: ライブラリ<51>-Footnote-3024302877
Ref: ライブラリ<51>-Footnote-3034302935
Ref: ライブラリ<51>-Footnote-3044303019
Ref: ライブラリ<51>-Footnote-3054303077
Ref: ライブラリ<51>-Footnote-3064303135
Ref: ライブラリ<51>-Footnote-3074303193
Ref: ライブラリ<51>-Footnote-3084303251
Ref: ライブラリ<51>-Footnote-3094303309
Ref: ライブラリ<51>-Footnote-3104303367
Ref: ライブラリ<51>-Footnote-3114303425
Ref: ライブラリ<51>-Footnote-3124303483
Ref: ライブラリ<51>-Footnote-3134303541
Ref: ライブラリ<51>-Footnote-3144303599
Ref: ライブラリ<51>-Footnote-3154303657
Ref: ライブラリ<51>-Footnote-3164303714
Ref: ライブラリ<51>-Footnote-3174303772
Ref: ライブラリ<51>-Footnote-3184303829
Ref: ライブラリ<51>-Footnote-3194303887
Ref: ライブラリ<51>-Footnote-3204303954
Ref: ライブラリ<51>-Footnote-3214304021
Ref: ライブラリ<51>-Footnote-3224304088
Ref: ライブラリ<51>-Footnote-3234304155
Ref: ライブラリ<51>-Footnote-3244304212
Node: IDLE<8>4304279
Ref: whatsnew/changelog id2094304403
Ref: 1b934304403
Ref: IDLE<8>-Footnote-14305257
Ref: IDLE<8>-Footnote-24305313
Ref: IDLE<8>-Footnote-34305369
Ref: IDLE<8>-Footnote-44305425
Ref: IDLE<8>-Footnote-54305480
Ref: IDLE<8>-Footnote-64305536
Node: ドキュメント<14>4305592
Ref: whatsnew/changelog id2104305718
Ref: 1b944305718
Ref: ドキュメント<14>-Footnote-14308227
Ref: ドキュメント<14>-Footnote-24308283
Ref: ドキュメント<14>-Footnote-34308339
Ref: ドキュメント<14>-Footnote-44308395
Ref: ドキュメント<14>-Footnote-54308451
Ref: ドキュメント<14>-Footnote-64308507
Ref: ドキュメント<14>-Footnote-74308563
Ref: ドキュメント<14>-Footnote-84308618
Ref: ドキュメント<14>-Footnote-94308674
Ref: ドキュメント<14>-Footnote-104308730
Ref: ドキュメント<14>-Footnote-114308787
Ref: ドキュメント<14>-Footnote-124308844
Ref: ドキュメント<14>-Footnote-134308901
Node: Core and Builtins<48>4308967
Ref: whatsnew/changelog id2114309105
Ref: 1b9c4309105
Ref: Core and Builtins<48>-Footnote-14309842
Ref: Core and Builtins<48>-Footnote-24309898
Ref: Core and Builtins<48>-Footnote-34309954
Ref: Core and Builtins<48>-Footnote-44310010
Node: ライブラリ<52>4310066
Ref: whatsnew/changelog id2124310203
Ref: 1b9e4310203
Ref: ライブラリ<52>-Footnote-14310440
Node: Core and Builtins<49>4310496
Ref: whatsnew/changelog id2134310631
Ref: 1b9f4310631
Ref: Core and Builtins<49>-Footnote-14314778
Ref: Core and Builtins<49>-Footnote-24314834
Ref: Core and Builtins<49>-Footnote-34314890
Ref: Core and Builtins<49>-Footnote-44314946
Ref: Core and Builtins<49>-Footnote-54315002
Ref: Core and Builtins<49>-Footnote-64315058
Ref: Core and Builtins<49>-Footnote-74315114
Ref: Core and Builtins<49>-Footnote-84315170
Ref: Core and Builtins<49>-Footnote-94315226
Ref: Core and Builtins<49>-Footnote-104315282
Ref: Core and Builtins<49>-Footnote-114315339
Ref: Core and Builtins<49>-Footnote-124315396
Ref: Core and Builtins<49>-Footnote-134315453
Ref: Core and Builtins<49>-Footnote-144315509
Ref: Core and Builtins<49>-Footnote-154315566
Ref: Core and Builtins<49>-Footnote-164315623
Ref: Core and Builtins<49>-Footnote-174315680
Ref: Core and Builtins<49>-Footnote-184315737
Ref: Core and Builtins<49>-Footnote-194315794
Ref: Core and Builtins<49>-Footnote-204315851
Ref: Core and Builtins<49>-Footnote-214315908
Ref: Core and Builtins<49>-Footnote-224315964
Ref: Core and Builtins<49>-Footnote-234316021
Ref: Core and Builtins<49>-Footnote-244316078
Node: ライブラリ<53>4316135
Ref: whatsnew/changelog id2144316272
Ref: 1ba14316272
Ref: ライブラリ<53>-Footnote-14316515
Node: Core and Builtins<50>4316571
Ref: whatsnew/changelog id2154316706
Ref: 1ba34316706
Ref: Core and Builtins<50>-Footnote-14324509
Ref: Core and Builtins<50>-Footnote-24324565
Ref: Core and Builtins<50>-Footnote-34324621
Ref: Core and Builtins<50>-Footnote-44324677
Ref: Core and Builtins<50>-Footnote-54324733
Ref: Core and Builtins<50>-Footnote-64324789
Ref: Core and Builtins<50>-Footnote-74324845
Ref: Core and Builtins<50>-Footnote-84324901
Ref: Core and Builtins<50>-Footnote-94324957
Ref: Core and Builtins<50>-Footnote-104325013
Ref: Core and Builtins<50>-Footnote-114325070
Ref: Core and Builtins<50>-Footnote-124325127
Ref: Core and Builtins<50>-Footnote-134325184
Ref: Core and Builtins<50>-Footnote-144325241
Ref: Core and Builtins<50>-Footnote-154325298
Ref: Core and Builtins<50>-Footnote-164325355
Ref: Core and Builtins<50>-Footnote-174325412
Ref: Core and Builtins<50>-Footnote-184325469
Ref: Core and Builtins<50>-Footnote-194325526
Ref: Core and Builtins<50>-Footnote-204325583
Ref: Core and Builtins<50>-Footnote-214325640
Ref: Core and Builtins<50>-Footnote-224325697
Ref: Core and Builtins<50>-Footnote-234325754
Ref: Core and Builtins<50>-Footnote-244325811
Ref: Core and Builtins<50>-Footnote-254325868
Ref: Core and Builtins<50>-Footnote-264325925
Ref: Core and Builtins<50>-Footnote-274325982
Ref: Core and Builtins<50>-Footnote-284326039
Ref: Core and Builtins<50>-Footnote-294326096
Ref: Core and Builtins<50>-Footnote-304326153
Ref: Core and Builtins<50>-Footnote-314326210
Ref: Core and Builtins<50>-Footnote-324326267
Ref: Core and Builtins<50>-Footnote-334326324
Ref: Core and Builtins<50>-Footnote-344326381
Ref: Core and Builtins<50>-Footnote-354326438
Ref: Core and Builtins<50>-Footnote-364326495
Ref: Core and Builtins<50>-Footnote-374326552
Ref: Core and Builtins<50>-Footnote-384326609
Ref: Core and Builtins<50>-Footnote-394326666
Ref: Core and Builtins<50>-Footnote-404326723
Ref: Core and Builtins<50>-Footnote-414326780
Ref: Core and Builtins<50>-Footnote-424326837
Ref: Core and Builtins<50>-Footnote-434326894
Ref: Core and Builtins<50>-Footnote-444326951
Ref: Core and Builtins<50>-Footnote-454327008
Ref: Core and Builtins<50>-Footnote-464327065
Node: ライブラリ<54>4327121
Ref: whatsnew/changelog id2164327258
Ref: 1ba74327258
Ref: ライブラリ<54>-Footnote-14327466
Node: Core and Builtins<51>4327522
Ref: whatsnew/changelog id2174327657
Ref: 1ba84327657
Ref: Core and Builtins<51>-Footnote-14330559
Ref: Core and Builtins<51>-Footnote-24330615
Ref: Core and Builtins<51>-Footnote-34330671
Ref: Core and Builtins<51>-Footnote-44330727
Ref: Core and Builtins<51>-Footnote-54330783
Ref: Core and Builtins<51>-Footnote-64330839
Ref: Core and Builtins<51>-Footnote-74330895
Ref: Core and Builtins<51>-Footnote-84330951
Ref: Core and Builtins<51>-Footnote-94331007
Ref: Core and Builtins<51>-Footnote-104331063
Ref: Core and Builtins<51>-Footnote-114331120
Ref: Core and Builtins<51>-Footnote-124331177
Ref: Core and Builtins<51>-Footnote-134331234
Ref: Core and Builtins<51>-Footnote-144331291
Ref: Core and Builtins<51>-Footnote-154331348
Ref: Core and Builtins<51>-Footnote-164331405
Ref: Core and Builtins<51>-Footnote-174331462
Ref: Core and Builtins<51>-Footnote-184331519
Node: ライブラリ<55>4331576
Ref: whatsnew/changelog id2184331713
Ref: 1bac4331713
Ref: ライブラリ<55>-Footnote-14331979
Node: Core and Builtins<52>4332035
Ref: whatsnew/changelog id2194332170
Ref: 1bad4332170
Ref: Core and Builtins<52>-Footnote-14334953
Ref: Core and Builtins<52>-Footnote-24335009
Ref: Core and Builtins<52>-Footnote-34335065
Ref: Core and Builtins<52>-Footnote-44335121
Ref: Core and Builtins<52>-Footnote-54335177
Ref: Core and Builtins<52>-Footnote-64335233
Ref: Core and Builtins<52>-Footnote-74335289
Ref: Core and Builtins<52>-Footnote-84335344
Ref: Core and Builtins<52>-Footnote-94335400
Ref: Core and Builtins<52>-Footnote-104335456
Ref: Core and Builtins<52>-Footnote-114335513
Ref: Core and Builtins<52>-Footnote-124335570
Ref: Core and Builtins<52>-Footnote-134335627
Ref: Core and Builtins<52>-Footnote-144335684
Ref: Core and Builtins<52>-Footnote-154335741
Node: ライブラリ<56>4335798
Ref: whatsnew/changelog id2204335935
Ref: 1bae4335935
Ref: ライブラリ<56>-Footnote-14336197
Node: Core and Builtins<53>4336253
Ref: whatsnew/changelog id2214336388
Ref: 1baf4336388
Ref: Core and Builtins<53>-Footnote-14336912
Ref: Core and Builtins<53>-Footnote-24336968
Node: ライブラリ<57>4337024
Ref: whatsnew/changelog id2224337161
Ref: 1bb04337161
Ref: ライブラリ<57>-Footnote-14337447
Node: Core and Builtins<54>4337503
Ref: whatsnew/changelog id2234337638
Ref: 1bb14337638
Ref: Core and Builtins<54>-Footnote-14344877
Ref: Core and Builtins<54>-Footnote-24344933
Ref: Core and Builtins<54>-Footnote-34344989
Ref: Core and Builtins<54>-Footnote-44345045
Ref: Core and Builtins<54>-Footnote-54345100
Ref: Core and Builtins<54>-Footnote-64345156
Ref: Core and Builtins<54>-Footnote-74345212
Ref: Core and Builtins<54>-Footnote-84345268
Ref: Core and Builtins<54>-Footnote-94345324
Ref: Core and Builtins<54>-Footnote-104345380
Ref: Core and Builtins<54>-Footnote-114345436
Ref: Core and Builtins<54>-Footnote-124345493
Ref: Core and Builtins<54>-Footnote-134345550
Ref: Core and Builtins<54>-Footnote-144345607
Ref: Core and Builtins<54>-Footnote-154345664
Ref: Core and Builtins<54>-Footnote-164345721
Ref: Core and Builtins<54>-Footnote-174345778
Ref: Core and Builtins<54>-Footnote-184345835
Ref: Core and Builtins<54>-Footnote-194345878
Ref: Core and Builtins<54>-Footnote-204345935
Ref: Core and Builtins<54>-Footnote-214345992
Ref: Core and Builtins<54>-Footnote-224346049
Ref: Core and Builtins<54>-Footnote-234346106
Ref: Core and Builtins<54>-Footnote-244346163
Ref: Core and Builtins<54>-Footnote-254346220
Ref: Core and Builtins<54>-Footnote-264346277
Ref: Core and Builtins<54>-Footnote-274346334
Ref: Core and Builtins<54>-Footnote-284346391
Ref: Core and Builtins<54>-Footnote-294346448
Ref: Core and Builtins<54>-Footnote-304346505
Ref: Core and Builtins<54>-Footnote-314346562
Ref: Core and Builtins<54>-Footnote-324346619
Ref: Core and Builtins<54>-Footnote-334346676
Ref: Core and Builtins<54>-Footnote-344346733
Ref: Core and Builtins<54>-Footnote-354346776
Ref: Core and Builtins<54>-Footnote-364346833
Ref: Core and Builtins<54>-Footnote-374346890
Ref: Core and Builtins<54>-Footnote-384346947
Ref: Core and Builtins<54>-Footnote-394347004
Ref: Core and Builtins<54>-Footnote-404347061
Ref: Core and Builtins<54>-Footnote-414347104
Ref: Core and Builtins<54>-Footnote-424347161
Ref: Core and Builtins<54>-Footnote-434347218
Ref: Core and Builtins<54>-Footnote-444347275
Ref: Core and Builtins<54>-Footnote-454347332
Ref: Core and Builtins<54>-Footnote-464347389
Ref: Core and Builtins<54>-Footnote-474347446
Ref: Core and Builtins<54>-Footnote-484347503
Ref: Core and Builtins<54>-Footnote-494347560
Ref: Core and Builtins<54>-Footnote-504347617
Node: ライブラリ<58>4347660
Ref: whatsnew/changelog id2244347797
Ref: 1bb54347797
Ref: ライブラリ<58>-Footnote-14348035
Node: Core and Builtins<55>4348091
Ref: whatsnew/changelog id2254348216
Ref: 1bb74348216
Ref: Core and Builtins<55>-Footnote-14349245
Ref: Core and Builtins<55>-Footnote-24349301
Ref: Core and Builtins<55>-Footnote-34349357
Ref: Core and Builtins<55>-Footnote-44349413
Ref: Core and Builtins<55>-Footnote-54349469
Ref: Core and Builtins<55>-Footnote-64349525
Ref: Core and Builtins<55>-Footnote-74349580
Ref: Core and Builtins<55>-Footnote-84349635
Node: C API<17>4349700
Ref: whatsnew/changelog id2264349819
Ref: 1bb84349819
Ref: C API<17>-Footnote-14361611
Ref: C API<17>-Footnote-24361667
Ref: C API<17>-Footnote-34361723
Ref: C API<17>-Footnote-44361779
Ref: C API<17>-Footnote-54361821
Ref: C API<17>-Footnote-64361863
Ref: C API<17>-Footnote-74361919
Ref: C API<17>-Footnote-84361975
Ref: C API<17>-Footnote-94362017
Ref: C API<17>-Footnote-104362059
Ref: C API<17>-Footnote-114362116
Ref: C API<17>-Footnote-124362173
Ref: C API<17>-Footnote-134362230
Ref: C API<17>-Footnote-144362287
Ref: C API<17>-Footnote-154362330
Ref: C API<17>-Footnote-164362387
Ref: C API<17>-Footnote-174362444
Ref: C API<17>-Footnote-184362501
Ref: C API<17>-Footnote-194362558
Ref: C API<17>-Footnote-204362615
Ref: C API<17>-Footnote-214362672
Ref: C API<17>-Footnote-224362729
Ref: C API<17>-Footnote-234362786
Ref: C API<17>-Footnote-244362843
Ref: C API<17>-Footnote-254362899
Ref: C API<17>-Footnote-264362956
Ref: C API<17>-Footnote-274363013
Ref: C API<17>-Footnote-284363070
Ref: C API<17>-Footnote-294363127
Ref: C API<17>-Footnote-304363184
Ref: C API<17>-Footnote-314363241
Ref: C API<17>-Footnote-324363298
Ref: C API<17>-Footnote-334363355
Ref: C API<17>-Footnote-344363411
Ref: C API<17>-Footnote-354363468
Ref: C API<17>-Footnote-364363525
Ref: C API<17>-Footnote-374363582
Ref: C API<17>-Footnote-384363639
Ref: C API<17>-Footnote-394363696
Ref: C API<17>-Footnote-404363753
Ref: C API<17>-Footnote-414363810
Ref: C API<17>-Footnote-424363867
Ref: C API<17>-Footnote-434363924
Ref: C API<17>-Footnote-444363981
Ref: C API<17>-Footnote-454364038
Ref: C API<17>-Footnote-464364095
Ref: C API<17>-Footnote-474364152
Ref: C API<17>-Footnote-484364209
Ref: C API<17>-Footnote-494364266
Ref: C API<17>-Footnote-504364323
Ref: C API<17>-Footnote-514364380
Ref: C API<17>-Footnote-524364436
Ref: C API<17>-Footnote-534364492
Node: ビルド<16>4364558
Ref: whatsnew/changelog id2274364647
Ref: 1bc24364647
Ref: ビルド<16>-Footnote-14369208
Ref: ビルド<16>-Footnote-24369264
Ref: ビルド<16>-Footnote-34369320
Ref: ビルド<16>-Footnote-44369376
Ref: ビルド<16>-Footnote-54369432
Ref: ビルド<16>-Footnote-64369488
Ref: ビルド<16>-Footnote-74369544
Ref: ビルド<16>-Footnote-84369600
Ref: ビルド<16>-Footnote-94369656
Ref: ビルド<16>-Footnote-104369712
Ref: ビルド<16>-Footnote-114369769
Ref: ビルド<16>-Footnote-124369826
Ref: ビルド<16>-Footnote-134369883
Ref: ビルド<16>-Footnote-144369940
Ref: ビルド<16>-Footnote-154369997
Ref: ビルド<16>-Footnote-164370054
Ref: ビルド<16>-Footnote-174370111
Ref: ビルド<16>-Footnote-184370168
Ref: ビルド<16>-Footnote-194370225
Ref: ビルド<16>-Footnote-204370282
Ref: ビルド<16>-Footnote-214370339
Ref: ビルド<16>-Footnote-224370396
Ref: ビルド<16>-Footnote-234370453
Ref: ビルド<16>-Footnote-244370510
Ref: ビルド<16>-Footnote-254370567
Ref: ビルド<16>-Footnote-264370624
Ref: ビルド<16>-Footnote-274370681
Ref: ビルド<16>-Footnote-284370738
Ref: ビルド<16>-Footnote-294370795
Ref: ビルド<16>-Footnote-304370852
Ref: ビルド<16>-Footnote-314370909
Ref: ビルド<16>-Footnote-324370966
Node: Python 3 13 0 beta 14371023
Ref: whatsnew/changelog python-3-13-0-beta-14371152
Ref: 1bc44371152
Node: セキュリティ<16>4371618
Ref: whatsnew/changelog id2284371727
Ref: 1bc54371727
Ref: セキュリティ<16>-Footnote-14372136
Ref: セキュリティ<16>-Footnote-24372192
Node: Core and Builtins<56>4372248
Ref: whatsnew/changelog id2294372385
Ref: 1bc64372385
Ref: Core and Builtins<56>-Footnote-14373527
Ref: Core and Builtins<56>-Footnote-24373583
Ref: Core and Builtins<56>-Footnote-34373639
Node: ライブラリ<59>4373695
Ref: whatsnew/changelog id2304373831
Ref: 1bc74373831
Ref: ライブラリ<59>-Footnote-14374168
Node: Core and Builtins<57>4374223
Ref: whatsnew/changelog id2314374357
Ref: 1bc84374357
Ref: Core and Builtins<57>-Footnote-14382416
Ref: Core and Builtins<57>-Footnote-24382472
Ref: Core and Builtins<57>-Footnote-34382528
Ref: Core and Builtins<57>-Footnote-44382584
Ref: Core and Builtins<57>-Footnote-54382640
Ref: Core and Builtins<57>-Footnote-64382696
Ref: Core and Builtins<57>-Footnote-74382752
Ref: Core and Builtins<57>-Footnote-84382808
Ref: Core and Builtins<57>-Footnote-94382864
Ref: Core and Builtins<57>-Footnote-104382920
Ref: Core and Builtins<57>-Footnote-114382977
Ref: Core and Builtins<57>-Footnote-124383033
Ref: Core and Builtins<57>-Footnote-134383090
Ref: Core and Builtins<57>-Footnote-144383147
Ref: Core and Builtins<57>-Footnote-154383204
Ref: Core and Builtins<57>-Footnote-164383261
Ref: Core and Builtins<57>-Footnote-174383318
Ref: Core and Builtins<57>-Footnote-184383375
Ref: Core and Builtins<57>-Footnote-194383432
Ref: Core and Builtins<57>-Footnote-204383489
Ref: Core and Builtins<57>-Footnote-214383546
Ref: Core and Builtins<57>-Footnote-224383603
Ref: Core and Builtins<57>-Footnote-234383660
Ref: Core and Builtins<57>-Footnote-244383717
Ref: Core and Builtins<57>-Footnote-254383774
Ref: Core and Builtins<57>-Footnote-264383831
Ref: Core and Builtins<57>-Footnote-274383888
Ref: Core and Builtins<57>-Footnote-284383945
Ref: Core and Builtins<57>-Footnote-294384002
Ref: Core and Builtins<57>-Footnote-304384059
Ref: Core and Builtins<57>-Footnote-314384116
Ref: Core and Builtins<57>-Footnote-324384173
Ref: Core and Builtins<57>-Footnote-334384230
Ref: Core and Builtins<57>-Footnote-344384273
Ref: Core and Builtins<57>-Footnote-354384330
Ref: Core and Builtins<57>-Footnote-364384387
Ref: Core and Builtins<57>-Footnote-374384444
Ref: Core and Builtins<57>-Footnote-384384501
Ref: Core and Builtins<57>-Footnote-394384558
Ref: Core and Builtins<57>-Footnote-404384601
Ref: Core and Builtins<57>-Footnote-414384657
Ref: Core and Builtins<57>-Footnote-424384714
Ref: Core and Builtins<57>-Footnote-434384770
Ref: Core and Builtins<57>-Footnote-444384826
Node: ライブラリ<60>4384883
Ref: whatsnew/changelog id2324385020
Ref: 1bca4385020
Ref: ライブラリ<60>-Footnote-14401289
Ref: ライブラリ<60>-Footnote-24401345
Ref: ライブラリ<60>-Footnote-34401401
Ref: ライブラリ<60>-Footnote-44401457
Ref: ライブラリ<60>-Footnote-54401513
Ref: ライブラリ<60>-Footnote-64401569
Ref: ライブラリ<60>-Footnote-74401625
Ref: ライブラリ<60>-Footnote-84401681
Ref: ライブラリ<60>-Footnote-94401737
Ref: ライブラリ<60>-Footnote-104401793
Ref: ライブラリ<60>-Footnote-114401850
Ref: ライブラリ<60>-Footnote-124401907
Ref: ライブラリ<60>-Footnote-134401964
Ref: ライブラリ<60>-Footnote-144402021
Ref: ライブラリ<60>-Footnote-154402064
Ref: ライブラリ<60>-Footnote-164402121
Ref: ライブラリ<60>-Footnote-174402178
Ref: ライブラリ<60>-Footnote-184402235
Ref: ライブラリ<60>-Footnote-194402292
Ref: ライブラリ<60>-Footnote-204402349
Ref: ライブラリ<60>-Footnote-214402406
Ref: ライブラリ<60>-Footnote-224402463
Ref: ライブラリ<60>-Footnote-234402520
Ref: ライブラリ<60>-Footnote-244402577
Ref: ライブラリ<60>-Footnote-254402633
Ref: ライブラリ<60>-Footnote-264402690
Ref: ライブラリ<60>-Footnote-274402747
Ref: ライブラリ<60>-Footnote-284402804
Ref: ライブラリ<60>-Footnote-294402861
Ref: ライブラリ<60>-Footnote-304402918
Ref: ライブラリ<60>-Footnote-314402975
Ref: ライブラリ<60>-Footnote-324403018
Ref: ライブラリ<60>-Footnote-334403075
Ref: ライブラリ<60>-Footnote-344403132
Ref: ライブラリ<60>-Footnote-354403189
Ref: ライブラリ<60>-Footnote-364403245
Ref: ライブラリ<60>-Footnote-374403305
Ref: ライブラリ<60>-Footnote-384403361
Ref: ライブラリ<60>-Footnote-394403418
Ref: ライブラリ<60>-Footnote-404403475
Ref: ライブラリ<60>-Footnote-414403532
Ref: ライブラリ<60>-Footnote-424403588
Ref: ライブラリ<60>-Footnote-434403644
Ref: ライブラリ<60>-Footnote-444403687
Ref: ライブラリ<60>-Footnote-454403744
Ref: ライブラリ<60>-Footnote-464403801
Ref: ライブラリ<60>-Footnote-474403858
Ref: ライブラリ<60>-Footnote-484403915
Ref: ライブラリ<60>-Footnote-494403972
Ref: ライブラリ<60>-Footnote-504404029
Ref: ライブラリ<60>-Footnote-514404086
Ref: ライブラリ<60>-Footnote-524404143
Ref: ライブラリ<60>-Footnote-534404200
Ref: ライブラリ<60>-Footnote-544404257
Ref: ライブラリ<60>-Footnote-554404314
Ref: ライブラリ<60>-Footnote-564404371
Ref: ライブラリ<60>-Footnote-574404428
Ref: ライブラリ<60>-Footnote-584404485
Ref: ライブラリ<60>-Footnote-594404542
Ref: ライブラリ<60>-Footnote-604404599
Ref: ライブラリ<60>-Footnote-614404656
Ref: ライブラリ<60>-Footnote-624404713
Ref: ライブラリ<60>-Footnote-634404756
Ref: ライブラリ<60>-Footnote-644404813
Ref: ライブラリ<60>-Footnote-654404870
Ref: ライブラリ<60>-Footnote-664404927
Ref: ライブラリ<60>-Footnote-674404984
Ref: ライブラリ<60>-Footnote-684405027
Ref: ライブラリ<60>-Footnote-694405083
Ref: ライブラリ<60>-Footnote-704405139
Ref: ライブラリ<60>-Footnote-714405196
Ref: ライブラリ<60>-Footnote-724405253
Ref: ライブラリ<60>-Footnote-734405310
Ref: ライブラリ<60>-Footnote-744405366
Ref: ライブラリ<60>-Footnote-754405422
Ref: ライブラリ<60>-Footnote-764405479
Ref: ライブラリ<60>-Footnote-774405536
Ref: ライブラリ<60>-Footnote-784405593
Ref: ライブラリ<60>-Footnote-794405650
Ref: ライブラリ<60>-Footnote-804405706
Ref: ライブラリ<60>-Footnote-814405763
Ref: ライブラリ<60>-Footnote-824405820
Ref: ライブラリ<60>-Footnote-834405876
Ref: ライブラリ<60>-Footnote-844405933
Ref: ライブラリ<60>-Footnote-854405990
Ref: ライブラリ<60>-Footnote-864406046
Ref: ライブラリ<60>-Footnote-874406102
Ref: ライブラリ<60>-Footnote-884406168
Ref: ライブラリ<60>-Footnote-894406234
Ref: ライブラリ<60>-Footnote-904406300
Ref: ライブラリ<60>-Footnote-914406366
Node: ドキュメント<15>4406432
Ref: whatsnew/changelog id2334406561
Ref: 1bd64406561
Ref: ドキュメント<15>-Footnote-14406747
Node: ビルド<17>4406803
Ref: whatsnew/changelog id2344406924
Ref: 1bd74406924
Ref: ビルド<17>-Footnote-14407868
Ref: ビルド<17>-Footnote-24407924
Ref: ビルド<17>-Footnote-34407980
Ref: ビルド<17>-Footnote-44408036
Ref: ビルド<17>-Footnote-54408092
Ref: ビルド<17>-Footnote-64408148
Node: Windows<15>4408204
Ref: whatsnew/changelog id2354408312
Ref: 1bd84408312
Ref: Windows<15>-Footnote-14409351
Ref: Windows<15>-Footnote-24409407
Ref: Windows<15>-Footnote-34409463
Ref: Windows<15>-Footnote-44409519
Ref: Windows<15>-Footnote-54409575
Ref: Windows<15>-Footnote-64409631
Ref: Windows<15>-Footnote-74409686
Node: macOS<10>4409742
Ref: whatsnew/changelog id2364409844
Ref: 1bd94409844
Ref: macOS<10>-Footnote-14410288
Ref: macOS<10>-Footnote-24410344
Ref: macOS<10>-Footnote-34410400
Ref: macOS<10>-Footnote-44410456
Node: IDLE<9>4410511
Ref: whatsnew/changelog id2374410611
Ref: 1bda4410611
Ref: IDLE<9>-Footnote-14410752
Node: C API<18>4410817
Ref: whatsnew/changelog id2384410899
Ref: 1bdb4410899
Ref: C API<18>-Footnote-14412178
Ref: C API<18>-Footnote-24412234
Ref: C API<18>-Footnote-34412290
Ref: C API<18>-Footnote-44412346
Ref: C API<18>-Footnote-54412402
Ref: C API<18>-Footnote-64412458
Ref: C API<18>-Footnote-74412513
Node: Python 3 13 0 alpha 64412569
Ref: whatsnew/changelog python-3-13-0-alpha-64412698
Ref: 1be34412698
Node: Core and Builtins<58>4413111
Ref: whatsnew/changelog id2394413218
Ref: 1be44413218
Ref: Core and Builtins<58>-Footnote-14417877
Ref: Core and Builtins<58>-Footnote-24417933
Ref: Core and Builtins<58>-Footnote-34417989
Ref: Core and Builtins<58>-Footnote-44418045
Ref: Core and Builtins<58>-Footnote-54418101
Ref: Core and Builtins<58>-Footnote-64418157
Ref: Core and Builtins<58>-Footnote-74418213
Ref: Core and Builtins<58>-Footnote-84418269
Ref: Core and Builtins<58>-Footnote-94418324
Ref: Core and Builtins<58>-Footnote-104418371
Ref: Core and Builtins<58>-Footnote-114418428
Ref: Core and Builtins<58>-Footnote-124418485
Ref: Core and Builtins<58>-Footnote-134418542
Ref: Core and Builtins<58>-Footnote-144418599
Ref: Core and Builtins<58>-Footnote-154418656
Ref: Core and Builtins<58>-Footnote-164418713
Ref: Core and Builtins<58>-Footnote-174418770
Ref: Core and Builtins<58>-Footnote-184418827
Ref: Core and Builtins<58>-Footnote-194418884
Node: ライブラリ<61>4418941
Ref: whatsnew/changelog id2404419078
Ref: 1be74419078
Ref: ライブラリ<61>-Footnote-14419435
Ref: ライブラリ<61>-Footnote-24419491
Node: Core and Builtins<59>4419546
Ref: whatsnew/changelog id2414419681
Ref: 1be84419681
Ref: Core and Builtins<59>-Footnote-14419910
Node: ライブラリ<62>4419975
Ref: whatsnew/changelog id2424420113
Ref: 1be94420113
Ref: ライブラリ<62>-Footnote-14430896
Ref: ライブラリ<62>-Footnote-24430952
Ref: ライブラリ<62>-Footnote-34431008
Ref: ライブラリ<62>-Footnote-44431064
Ref: ライブラリ<62>-Footnote-54431120
Ref: ライブラリ<62>-Footnote-64431176
Ref: ライブラリ<62>-Footnote-74431232
Ref: ライブラリ<62>-Footnote-84431288
Ref: ライブラリ<62>-Footnote-94431344
Ref: ライブラリ<62>-Footnote-104431400
Ref: ライブラリ<62>-Footnote-114431457
Ref: ライブラリ<62>-Footnote-124431513
Ref: ライブラリ<62>-Footnote-134431569
Ref: ライブラリ<62>-Footnote-144431626
Ref: ライブラリ<62>-Footnote-154431683
Ref: ライブラリ<62>-Footnote-164431739
Ref: ライブラリ<62>-Footnote-174431796
Ref: ライブラリ<62>-Footnote-184431853
Ref: ライブラリ<62>-Footnote-194431910
Ref: ライブラリ<62>-Footnote-204431967
Ref: ライブラリ<62>-Footnote-214432024
Ref: ライブラリ<62>-Footnote-224432081
Ref: ライブラリ<62>-Footnote-234432138
Ref: ライブラリ<62>-Footnote-244432195
Ref: ライブラリ<62>-Footnote-254432252
Ref: ライブラリ<62>-Footnote-264432309
Ref: ライブラリ<62>-Footnote-274432365
Ref: ライブラリ<62>-Footnote-284432422
Ref: ライブラリ<62>-Footnote-294432479
Ref: ライブラリ<62>-Footnote-304432535
Ref: ライブラリ<62>-Footnote-314432592
Ref: ライブラリ<62>-Footnote-324432649
Ref: ライブラリ<62>-Footnote-334432705
Ref: ライブラリ<62>-Footnote-344432762
Ref: ライブラリ<62>-Footnote-354432830
Ref: ライブラリ<62>-Footnote-364432886
Ref: ライブラリ<62>-Footnote-374432943
Ref: ライブラリ<62>-Footnote-384433000
Ref: ライブラリ<62>-Footnote-394433057
Ref: ライブラリ<62>-Footnote-404433114
Ref: ライブラリ<62>-Footnote-414433170
Ref: ライブラリ<62>-Footnote-424433226
Ref: ライブラリ<62>-Footnote-434433282
Ref: ライブラリ<62>-Footnote-444433339
Ref: ライブラリ<62>-Footnote-454433396
Ref: ライブラリ<62>-Footnote-464433453
Ref: ライブラリ<62>-Footnote-474433510
Ref: ライブラリ<62>-Footnote-484433566
Ref: ライブラリ<62>-Footnote-494433622
Ref: ライブラリ<62>-Footnote-504433679
Ref: ライブラリ<62>-Footnote-514433736
Ref: ライブラリ<62>-Footnote-524433793
Ref: ライブラリ<62>-Footnote-534433850
Ref: ライブラリ<62>-Footnote-544433907
Ref: ライブラリ<62>-Footnote-554433963
Ref: ライブラリ<62>-Footnote-564434020
Ref: ライブラリ<62>-Footnote-574434077
Ref: ライブラリ<62>-Footnote-584434134
Ref: ライブラリ<62>-Footnote-594434190
Ref: ライブラリ<62>-Footnote-604434246
Ref: ライブラリ<62>-Footnote-614434312
Ref: ライブラリ<62>-Footnote-624434378
Ref: ライブラリ<62>-Footnote-634434444
Ref: ライブラリ<62>-Footnote-644434500
Node: ドキュメント<16>4434566
Ref: whatsnew/changelog id2434434696
Ref: 1bf14434696
Ref: ドキュメント<16>-Footnote-14435113
Ref: ドキュメント<16>-Footnote-24435169
Ref: ドキュメント<16>-Footnote-34435225
Node: テスト<19>4435280
Ref: whatsnew/changelog id2444435404
Ref: 1bf24435404
Ref: テスト<19>-Footnote-14436515
Ref: テスト<19>-Footnote-24436570
Ref: テスト<19>-Footnote-34436626
Ref: テスト<19>-Footnote-44436682
Ref: テスト<19>-Footnote-54436738
Ref: テスト<19>-Footnote-64436794
Ref: テスト<19>-Footnote-74436850
Node: ビルド<18>4436906
Ref: whatsnew/changelog id2454437019
Ref: 1bf34437019
Ref: ビルド<18>-Footnote-14437302
Ref: ビルド<18>-Footnote-24437358
Ref: ビルド<18>-Footnote-34437414
Node: Windows<16>4437469
Ref: whatsnew/changelog id2464437578
Ref: 1bf44437578
Ref: Windows<16>-Footnote-14439038
Ref: Windows<16>-Footnote-24439094
Ref: Windows<16>-Footnote-34439150
Ref: Windows<16>-Footnote-44439205
Ref: Windows<16>-Footnote-54439261
Ref: Windows<16>-Footnote-64439316
Node: C API<19>4439372
Ref: whatsnew/changelog id2474439459
Ref: 1bf64439459
Ref: C API<19>-Footnote-14442722
Ref: C API<19>-Footnote-24442778
Ref: C API<19>-Footnote-34442820
Ref: C API<19>-Footnote-44442875
Ref: C API<19>-Footnote-54442931
Ref: C API<19>-Footnote-64442987
Ref: C API<19>-Footnote-74443043
Ref: C API<19>-Footnote-84443099
Ref: C API<19>-Footnote-94443155
Ref: C API<19>-Footnote-104443211
Ref: C API<19>-Footnote-114443268
Ref: C API<19>-Footnote-124443325
Ref: C API<19>-Footnote-134443382
Ref: C API<19>-Footnote-144443439
Ref: C API<19>-Footnote-154443482
Ref: C API<19>-Footnote-164443539
Ref: C API<19>-Footnote-174443596
Ref: C API<19>-Footnote-184443652
Ref: C API<19>-Footnote-194443709
Node: Python 3 13 0 alpha 54443766
Ref: whatsnew/changelog python-3-13-0-alpha-54443896
Ref: 1bf84443896
Node: セキュリティ<17>4444509
Ref: whatsnew/changelog id2484444619
Ref: 1bf94444619
Ref: セキュリティ<17>-Footnote-14445448
Ref: セキュリティ<17>-Footnote-24445504
Ref: セキュリティ<17>-Footnote-34445560
Node: Core and Builtins<60>4445616
Ref: whatsnew/changelog id2494445754
Ref: 1bfa4445754
Ref: Core and Builtins<60>-Footnote-14447134
Ref: Core and Builtins<60>-Footnote-24447190
Ref: Core and Builtins<60>-Footnote-34447246
Ref: Core and Builtins<60>-Footnote-44447288
Ref: Core and Builtins<60>-Footnote-54447344
Ref: Core and Builtins<60>-Footnote-64447400
Ref: Core and Builtins<60>-Footnote-74447456
Ref: Core and Builtins<60>-Footnote-84447512
Ref: Core and Builtins<60>-Footnote-94447568
Ref: Core and Builtins<60>-Footnote-104447624
Ref: Core and Builtins<60>-Footnote-114447681
Ref: Core and Builtins<60>-Footnote-124447738
Node: ライブラリ<63>4447795
Ref: whatsnew/changelog id2504447932
Ref: 1bfb4447932
Ref: ライブラリ<63>-Footnote-14448191
Node: Core and Builtins<61>4448247
Ref: whatsnew/changelog id2514448382
Ref: 1bfc4448382
Ref: Core and Builtins<61>-Footnote-14448624
Node: ライブラリ<64>4448680
Ref: whatsnew/changelog id2524448817
Ref: 1bfd4448817
Ref: ライブラリ<64>-Footnote-14449083
Node: Core and Builtins<62>4449139
Ref: whatsnew/changelog id2534449274
Ref: 1bfe4449274
Ref: Core and Builtins<62>-Footnote-14450103
Ref: Core and Builtins<62>-Footnote-24450159
Ref: Core and Builtins<62>-Footnote-34450215
Node: ライブラリ<65>4450270
Ref: whatsnew/changelog id2544450408
Ref: 1bff4450408
Ref: ライブラリ<65>-Footnote-14462195
Ref: ライブラリ<65>-Footnote-24462251
Ref: ライブラリ<65>-Footnote-34462307
Ref: ライブラリ<65>-Footnote-44462363
Ref: ライブラリ<65>-Footnote-54462419
Ref: ライブラリ<65>-Footnote-64462461
Ref: ライブラリ<65>-Footnote-74462517
Ref: ライブラリ<65>-Footnote-84462573
Ref: ライブラリ<65>-Footnote-94462629
Ref: ライブラリ<65>-Footnote-104462684
Ref: ライブラリ<65>-Footnote-114462740
Ref: ライブラリ<65>-Footnote-124462796
Ref: ライブラリ<65>-Footnote-134462852
Ref: ライブラリ<65>-Footnote-144462908
Ref: ライブラリ<65>-Footnote-154462965
Ref: ライブラリ<65>-Footnote-164463022
Ref: ライブラリ<65>-Footnote-174463078
Ref: ライブラリ<65>-Footnote-184463134
Ref: ライブラリ<65>-Footnote-194463191
Ref: ライブラリ<65>-Footnote-204463247
Ref: ライブラリ<65>-Footnote-214463304
Ref: ライブラリ<65>-Footnote-224463361
Ref: ライブラリ<65>-Footnote-234463418
Ref: ライブラリ<65>-Footnote-244463475
Ref: ライブラリ<65>-Footnote-254463531
Ref: ライブラリ<65>-Footnote-264463587
Ref: ライブラリ<65>-Footnote-274463644
Ref: ライブラリ<65>-Footnote-284463701
Ref: ライブラリ<65>-Footnote-294463758
Ref: ライブラリ<65>-Footnote-304463815
Ref: ライブラリ<65>-Footnote-314463872
Ref: ライブラリ<65>-Footnote-324463929
Ref: ライブラリ<65>-Footnote-334463986
Ref: ライブラリ<65>-Footnote-344464043
Ref: ライブラリ<65>-Footnote-354464100
Ref: ライブラリ<65>-Footnote-364464157
Ref: ライブラリ<65>-Footnote-374464200
Ref: ライブラリ<65>-Footnote-384464257
Ref: ライブラリ<65>-Footnote-394464314
Ref: ライブラリ<65>-Footnote-404464371
Ref: ライブラリ<65>-Footnote-414464428
Ref: ライブラリ<65>-Footnote-424464485
Ref: ライブラリ<65>-Footnote-434464542
Ref: ライブラリ<65>-Footnote-444464599
Ref: ライブラリ<65>-Footnote-454464656
Ref: ライブラリ<65>-Footnote-464464713
Ref: ライブラリ<65>-Footnote-474464770
Ref: ライブラリ<65>-Footnote-484464826
Ref: ライブラリ<65>-Footnote-494464883
Ref: ライブラリ<65>-Footnote-504464940
Ref: ライブラリ<65>-Footnote-514464996
Ref: ライブラリ<65>-Footnote-524465052
Ref: ライブラリ<65>-Footnote-534465109
Ref: ライブラリ<65>-Footnote-544465165
Ref: ライブラリ<65>-Footnote-554465222
Ref: ライブラリ<65>-Footnote-564465278
Ref: ライブラリ<65>-Footnote-574465335
Ref: ライブラリ<65>-Footnote-584465392
Ref: ライブラリ<65>-Footnote-594465448
Ref: ライブラリ<65>-Footnote-604465504
Ref: ライブラリ<65>-Footnote-614465560
Ref: ライブラリ<65>-Footnote-624465626
Ref: ライブラリ<65>-Footnote-634465692
Ref: ライブラリ<65>-Footnote-644465758
Ref: ライブラリ<65>-Footnote-654465824
Ref: ライブラリ<65>-Footnote-664465890
Ref: ライブラリ<65>-Footnote-674465956
Node: ドキュメント<17>4466022
Ref: whatsnew/changelog id2554466152
Ref: 1c084466152
Ref: ドキュメント<17>-Footnote-14466408
Ref: ドキュメント<17>-Footnote-24466464
Ref: ドキュメント<17>-Footnote-34466520
Node: テスト<20>4466576
Ref: whatsnew/changelog id2564466700
Ref: 1c094466700
Ref: テスト<20>-Footnote-14467896
Ref: テスト<20>-Footnote-24467951
Ref: テスト<20>-Footnote-34468006
Ref: テスト<20>-Footnote-44468062
Ref: テスト<20>-Footnote-54468118
Ref: テスト<20>-Footnote-64468174
Ref: テスト<20>-Footnote-74468230
Ref: テスト<20>-Footnote-84468286
Ref: テスト<20>-Footnote-94468342
Node: ビルド<19>4468398
Ref: whatsnew/changelog id2574468511
Ref: 1c0a4468511
Ref: ビルド<19>-Footnote-14469424
Ref: ビルド<19>-Footnote-24469480
Ref: ビルド<19>-Footnote-34469535
Ref: ビルド<19>-Footnote-44469591
Ref: ビルド<19>-Footnote-54469646
Ref: ビルド<19>-Footnote-64469702
Ref: ビルド<19>-Footnote-74469758
Ref: ビルド<19>-Footnote-84469814
Ref: ビルド<19>-Footnote-94469870
Node: Windows<17>4469926
Ref: whatsnew/changelog id2584470035
Ref: 1c0b4470035
Ref: Windows<17>-Footnote-14471119
Ref: Windows<17>-Footnote-24471175
Ref: Windows<17>-Footnote-34471231
Ref: Windows<17>-Footnote-44471287
Node: macOS<11>4471343
Ref: whatsnew/changelog id2594471447
Ref: 1c0c4471447
Ref: macOS<11>-Footnote-14471579
Node: IDLE<10>4471635
Ref: whatsnew/changelog id2604471743
Ref: 1c0d4471743
Ref: IDLE<10>-Footnote-14471927
Node: Tools/Demos<14>4471982
Ref: whatsnew/changelog id2614472090
Ref: 1c0e4472090
Ref: Tools/Demos<14>-Footnote-14472333
Ref: Tools/Demos<14>-Footnote-24472389
Node: C API<20>4472454
Ref: whatsnew/changelog id2624472545
Ref: 1c0f4472545
Ref: C API<20>-Footnote-14473116
Ref: C API<20>-Footnote-24473172
Node: Python 3 13 0 alpha 44473228
Ref: whatsnew/changelog python-3-13-0-alpha-44473358
Ref: 1c144473358
Node: セキュリティ<18>4473803
Ref: whatsnew/changelog id2634473913
Ref: 1c154473913
Ref: セキュリティ<18>-Footnote-14474189
Ref: セキュリティ<18>-Footnote-24474245
Node: Core and Builtins<63>4474301
Ref: whatsnew/changelog id2644474439
Ref: 1c164474439
Ref: Core and Builtins<63>-Footnote-14479741
Ref: Core and Builtins<63>-Footnote-24479797
Ref: Core and Builtins<63>-Footnote-34479853
Ref: Core and Builtins<63>-Footnote-44479909
Ref: Core and Builtins<63>-Footnote-54479965
Ref: Core and Builtins<63>-Footnote-64480021
Ref: Core and Builtins<63>-Footnote-74480077
Ref: Core and Builtins<63>-Footnote-84480133
Ref: Core and Builtins<63>-Footnote-94480189
Ref: Core and Builtins<63>-Footnote-104480245
Ref: Core and Builtins<63>-Footnote-114480301
Ref: Core and Builtins<63>-Footnote-124480358
Ref: Core and Builtins<63>-Footnote-134480415
Ref: Core and Builtins<63>-Footnote-144480472
Ref: Core and Builtins<63>-Footnote-154480529
Ref: Core and Builtins<63>-Footnote-164480586
Ref: Core and Builtins<63>-Footnote-174480643
Ref: Core and Builtins<63>-Footnote-184480700
Ref: Core and Builtins<63>-Footnote-194480757
Ref: Core and Builtins<63>-Footnote-204480814
Ref: Core and Builtins<63>-Footnote-214480871
Ref: Core and Builtins<63>-Footnote-224480928
Ref: Core and Builtins<63>-Footnote-234480985
Ref: Core and Builtins<63>-Footnote-244481042
Ref: Core and Builtins<63>-Footnote-254481099
Ref: Core and Builtins<63>-Footnote-264481156
Ref: Core and Builtins<63>-Footnote-274481213
Ref: Core and Builtins<63>-Footnote-284481276
Ref: Core and Builtins<63>-Footnote-294481333
Ref: Core and Builtins<63>-Footnote-304481389
Node: ライブラリ<66>4481446
Ref: whatsnew/changelog id2654481584
Ref: 1c194481584
Ref: ライブラリ<66>-Footnote-14495521
Ref: ライブラリ<66>-Footnote-24495577
Ref: ライブラリ<66>-Footnote-34495633
Ref: ライブラリ<66>-Footnote-44495689
Ref: ライブラリ<66>-Footnote-54495745
Ref: ライブラリ<66>-Footnote-64495801
Ref: ライブラリ<66>-Footnote-74495857
Ref: ライブラリ<66>-Footnote-84495913
Ref: ライブラリ<66>-Footnote-94495968
Ref: ライブラリ<66>-Footnote-104496023
Ref: ライブラリ<66>-Footnote-114496080
Ref: ライブラリ<66>-Footnote-124496136
Ref: ライブラリ<66>-Footnote-134496193
Ref: ライブラリ<66>-Footnote-144496249
Ref: ライブラリ<66>-Footnote-154496306
Ref: ライブラリ<66>-Footnote-164496363
Ref: ライブラリ<66>-Footnote-174496420
Ref: ライブラリ<66>-Footnote-184496477
Ref: ライブラリ<66>-Footnote-194496534
Ref: ライブラリ<66>-Footnote-204496590
Ref: ライブラリ<66>-Footnote-214496647
Ref: ライブラリ<66>-Footnote-224496704
Ref: ライブラリ<66>-Footnote-234496760
Ref: ライブラリ<66>-Footnote-244496817
Ref: ライブラリ<66>-Footnote-254496874
Ref: ライブラリ<66>-Footnote-264496930
Ref: ライブラリ<66>-Footnote-274496986
Ref: ライブラリ<66>-Footnote-284497042
Ref: ライブラリ<66>-Footnote-294497099
Ref: ライブラリ<66>-Footnote-304497155
Ref: ライブラリ<66>-Footnote-314497212
Ref: ライブラリ<66>-Footnote-324497269
Ref: ライブラリ<66>-Footnote-334497326
Ref: ライブラリ<66>-Footnote-344497383
Ref: ライブラリ<66>-Footnote-354497440
Ref: ライブラリ<66>-Footnote-364497497
Ref: ライブラリ<66>-Footnote-374497553
Ref: ライブラリ<66>-Footnote-384497610
Ref: ライブラリ<66>-Footnote-394497667
Ref: ライブラリ<66>-Footnote-404497724
Ref: ライブラリ<66>-Footnote-414497781
Ref: ライブラリ<66>-Footnote-424497838
Ref: ライブラリ<66>-Footnote-434497882
Ref: ライブラリ<66>-Footnote-444497939
Ref: ライブラリ<66>-Footnote-454497996
Ref: ライブラリ<66>-Footnote-464498053
Ref: ライブラリ<66>-Footnote-474498110
Ref: ライブラリ<66>-Footnote-484498166
Ref: ライブラリ<66>-Footnote-494498223
Ref: ライブラリ<66>-Footnote-504498280
Ref: ライブラリ<66>-Footnote-514498336
Ref: ライブラリ<66>-Footnote-524498393
Ref: ライブラリ<66>-Footnote-534498450
Ref: ライブラリ<66>-Footnote-544498506
Ref: ライブラリ<66>-Footnote-554498563
Ref: ライブラリ<66>-Footnote-564498620
Ref: ライブラリ<66>-Footnote-574498677
Ref: ライブラリ<66>-Footnote-584498733
Ref: ライブラリ<66>-Footnote-594498790
Ref: ライブラリ<66>-Footnote-604498846
Ref: ライブラリ<66>-Footnote-614498903
Ref: ライブラリ<66>-Footnote-624498960
Ref: ライブラリ<66>-Footnote-634499017
Ref: ライブラリ<66>-Footnote-644499073
Ref: ライブラリ<66>-Footnote-654499129
Ref: ライブラリ<66>-Footnote-664499186
Ref: ライブラリ<66>-Footnote-674499243
Ref: ライブラリ<66>-Footnote-684499299
Ref: ライブラリ<66>-Footnote-694499355
Ref: ライブラリ<66>-Footnote-704499412
Ref: ライブラリ<66>-Footnote-714499469
Ref: ライブラリ<66>-Footnote-724499526
Ref: ライブラリ<66>-Footnote-734499582
Ref: ライブラリ<66>-Footnote-744499639
Ref: ライブラリ<66>-Footnote-754499695
Ref: ライブラリ<66>-Footnote-764499752
Ref: ライブラリ<66>-Footnote-774499808
Node: ドキュメント<18>4499874
Ref: whatsnew/changelog id2664500004
Ref: 1c284500004
Ref: ドキュメント<18>-Footnote-14500579
Ref: ドキュメント<18>-Footnote-24500635
Node: テスト<21>4500691
Ref: whatsnew/changelog id2674500815
Ref: 1c294500815
Ref: テスト<21>-Footnote-14501212
Ref: テスト<21>-Footnote-24501268
Node: ビルド<20>4501324
Ref: whatsnew/changelog id2684501437
Ref: 1c2a4501437
Ref: ビルド<20>-Footnote-14501980
Ref: ビルド<20>-Footnote-24502036
Ref: ビルド<20>-Footnote-34502092
Ref: ビルド<20>-Footnote-44502148
Node: Windows<18>4502204
Ref: whatsnew/changelog id2694502313
Ref: 1c2b4502313
Ref: Windows<18>-Footnote-14503066
Ref: Windows<18>-Footnote-24503122
Ref: Windows<18>-Footnote-34503178
Ref: Windows<18>-Footnote-44503234
Ref: Windows<18>-Footnote-54503290
Ref: Windows<18>-Footnote-64503346
Ref: Windows<18>-Footnote-74503402
Node: macOS<12>4503457
Ref: whatsnew/changelog id2704503561
Ref: 1c2c4503561
Ref: macOS<12>-Footnote-14504100
Ref: macOS<12>-Footnote-24504156
Ref: macOS<12>-Footnote-34504212
Ref: macOS<12>-Footnote-44504268
Node: IDLE<11>4504323
Ref: whatsnew/changelog id2714504431
Ref: 1c2e4504431
Ref: IDLE<11>-Footnote-14504758
Ref: IDLE<11>-Footnote-24504813
Node: Tools/Demos<15>4504869
Ref: whatsnew/changelog id2724504977
Ref: 1c2f4504977
Ref: Tools/Demos<15>-Footnote-14505588
Ref: Tools/Demos<15>-Footnote-24505644
Ref: Tools/Demos<15>-Footnote-34505700
Node: C API<21>4505756
Ref: whatsnew/changelog id2734505847
Ref: 1c314505847
Ref: C API<21>-Footnote-14507791
Ref: C API<21>-Footnote-24507847
Ref: C API<21>-Footnote-34507903
Ref: C API<21>-Footnote-44507959
Ref: C API<21>-Footnote-54508015
Ref: C API<21>-Footnote-64508071
Ref: C API<21>-Footnote-74508127
Node: Python 3 13 0 alpha 34508183
Ref: whatsnew/changelog python-3-13-0-alpha-34508313
Ref: 1c344508313
Node: セキュリティ<19>4508726
Ref: whatsnew/changelog id2744508836
Ref: 1c354508836
Ref: セキュリティ<19>-Footnote-14509139
Ref: セキュリティ<19>-Footnote-24509195
Node: Core and Builtins<64>4509251
Ref: whatsnew/changelog id2754509389
Ref: 1c364509389
Ref: Core and Builtins<64>-Footnote-14516768
Ref: Core and Builtins<64>-Footnote-24516824
Ref: Core and Builtins<64>-Footnote-34516880
Ref: Core and Builtins<64>-Footnote-44516936
Ref: Core and Builtins<64>-Footnote-54516992
Ref: Core and Builtins<64>-Footnote-64517047
Ref: Core and Builtins<64>-Footnote-74517089
Ref: Core and Builtins<64>-Footnote-84517145
Ref: Core and Builtins<64>-Footnote-94517201
Ref: Core and Builtins<64>-Footnote-104517257
Ref: Core and Builtins<64>-Footnote-114517314
Ref: Core and Builtins<64>-Footnote-124517370
Ref: Core and Builtins<64>-Footnote-134517427
Ref: Core and Builtins<64>-Footnote-144517484
Ref: Core and Builtins<64>-Footnote-154517541
Ref: Core and Builtins<64>-Footnote-164517598
Ref: Core and Builtins<64>-Footnote-174517655
Ref: Core and Builtins<64>-Footnote-184517712
Ref: Core and Builtins<64>-Footnote-194517769
Ref: Core and Builtins<64>-Footnote-204517826
Ref: Core and Builtins<64>-Footnote-214517883
Ref: Core and Builtins<64>-Footnote-224517940
Ref: Core and Builtins<64>-Footnote-234517997
Ref: Core and Builtins<64>-Footnote-244518054
Ref: Core and Builtins<64>-Footnote-254518110
Ref: Core and Builtins<64>-Footnote-264518167
Ref: Core and Builtins<64>-Footnote-274518224
Ref: Core and Builtins<64>-Footnote-284518280
Ref: Core and Builtins<64>-Footnote-294518337
Ref: Core and Builtins<64>-Footnote-304518394
Ref: Core and Builtins<64>-Footnote-314518451
Ref: Core and Builtins<64>-Footnote-324518508
Ref: Core and Builtins<64>-Footnote-334518565
Ref: Core and Builtins<64>-Footnote-344518621
Ref: Core and Builtins<64>-Footnote-354518678
Ref: Core and Builtins<64>-Footnote-364518735
Ref: Core and Builtins<64>-Footnote-374518792
Ref: Core and Builtins<64>-Footnote-384518849
Ref: Core and Builtins<64>-Footnote-394518905
Ref: Core and Builtins<64>-Footnote-404518962
Ref: Core and Builtins<64>-Footnote-414519019
Ref: Core and Builtins<64>-Footnote-424519076
Ref: Core and Builtins<64>-Footnote-434519132
Ref: Core and Builtins<64>-Footnote-444519198
Ref: Core and Builtins<64>-Footnote-454519264
Ref: Core and Builtins<64>-Footnote-464519307
Node: ライブラリ<67>4519373
Ref: whatsnew/changelog id2764519511
Ref: 1c3b4519511
Ref: ライブラリ<67>-Footnote-14544695
Ref: ライブラリ<67>-Footnote-24544751
Ref: ライブラリ<67>-Footnote-34544807
Ref: ライブラリ<67>-Footnote-44544863
Ref: ライブラリ<67>-Footnote-54544919
Ref: ライブラリ<67>-Footnote-64544975
Ref: ライブラリ<67>-Footnote-74545031
Ref: ライブラリ<67>-Footnote-84545087
Ref: ライブラリ<67>-Footnote-94545143
Ref: ライブラリ<67>-Footnote-104545199
Ref: ライブラリ<67>-Footnote-114545255
Ref: ライブラリ<67>-Footnote-124545312
Ref: ライブラリ<67>-Footnote-134545369
Ref: ライブラリ<67>-Footnote-144545426
Ref: ライブラリ<67>-Footnote-154545483
Ref: ライブラリ<67>-Footnote-164545540
Ref: ライブラリ<67>-Footnote-174545597
Ref: ライブラリ<67>-Footnote-184545654
Ref: ライブラリ<67>-Footnote-194545711
Ref: ライブラリ<67>-Footnote-204545768
Ref: ライブラリ<67>-Footnote-214545824
Ref: ライブラリ<67>-Footnote-224545881
Ref: ライブラリ<67>-Footnote-234545937
Ref: ライブラリ<67>-Footnote-244545994
Ref: ライブラリ<67>-Footnote-254546051
Ref: ライブラリ<67>-Footnote-264546108
Ref: ライブラリ<67>-Footnote-274546165
Ref: ライブラリ<67>-Footnote-284546222
Ref: ライブラリ<67>-Footnote-294546279
Ref: ライブラリ<67>-Footnote-304546336
Ref: ライブラリ<67>-Footnote-314546393
Ref: ライブラリ<67>-Footnote-324546450
Ref: ライブラリ<67>-Footnote-334546506
Ref: ライブラリ<67>-Footnote-344546563
Ref: ライブラリ<67>-Footnote-354546620
Ref: ライブラリ<67>-Footnote-364546677
Ref: ライブラリ<67>-Footnote-374546733
Ref: ライブラリ<67>-Footnote-384546790
Ref: ライブラリ<67>-Footnote-394546847
Ref: ライブラリ<67>-Footnote-404546904
Ref: ライブラリ<67>-Footnote-414546961
Ref: ライブラリ<67>-Footnote-424547018
Ref: ライブラリ<67>-Footnote-434547075
Ref: ライブラリ<67>-Footnote-444547132
Ref: ライブラリ<67>-Footnote-454547189
Ref: ライブラリ<67>-Footnote-464547246
Ref: ライブラリ<67>-Footnote-474547302
Ref: ライブラリ<67>-Footnote-484547359
Ref: ライブラリ<67>-Footnote-494547415
Ref: ライブラリ<67>-Footnote-504547472
Ref: ライブラリ<67>-Footnote-514547529
Ref: ライブラリ<67>-Footnote-524547586
Ref: ライブラリ<67>-Footnote-534547643
Ref: ライブラリ<67>-Footnote-544547700
Ref: ライブラリ<67>-Footnote-554547757
Ref: ライブラリ<67>-Footnote-564547813
Ref: ライブラリ<67>-Footnote-574547870
Ref: ライブラリ<67>-Footnote-584547926
Ref: ライブラリ<67>-Footnote-594547982
Ref: ライブラリ<67>-Footnote-604548038
Ref: ライブラリ<67>-Footnote-614548095
Ref: ライブラリ<67>-Footnote-624548152
Ref: ライブラリ<67>-Footnote-634548208
Ref: ライブラリ<67>-Footnote-644548264
Ref: ライブラリ<67>-Footnote-654548321
Ref: ライブラリ<67>-Footnote-664548378
Ref: ライブラリ<67>-Footnote-674548435
Ref: ライブラリ<67>-Footnote-684548492
Ref: ライブラリ<67>-Footnote-694548549
Ref: ライブラリ<67>-Footnote-704548606
Ref: ライブラリ<67>-Footnote-714548662
Ref: ライブラリ<67>-Footnote-724548719
Ref: ライブラリ<67>-Footnote-734548776
Ref: ライブラリ<67>-Footnote-744548833
Ref: ライブラリ<67>-Footnote-754548890
Ref: ライブラリ<67>-Footnote-764548947
Ref: ライブラリ<67>-Footnote-774549004
Ref: ライブラリ<67>-Footnote-784549060
Ref: ライブラリ<67>-Footnote-794549117
Ref: ライブラリ<67>-Footnote-804549174
Ref: ライブラリ<67>-Footnote-814549231
Ref: ライブラリ<67>-Footnote-824549287
Ref: ライブラリ<67>-Footnote-834549344
Ref: ライブラリ<67>-Footnote-844549401
Ref: ライブラリ<67>-Footnote-854549458
Ref: ライブラリ<67>-Footnote-864549515
Ref: ライブラリ<67>-Footnote-874549571
Ref: ライブラリ<67>-Footnote-884549628
Ref: ライブラリ<67>-Footnote-894549684
Ref: ライブラリ<67>-Footnote-904549741
Ref: ライブラリ<67>-Footnote-914549798
Ref: ライブラリ<67>-Footnote-924549855
Ref: ライブラリ<67>-Footnote-934549912
Ref: ライブラリ<67>-Footnote-944549969
Ref: ライブラリ<67>-Footnote-954550025
Ref: ライブラリ<67>-Footnote-964550082
Ref: ライブラリ<67>-Footnote-974550138
Ref: ライブラリ<67>-Footnote-984550195
Ref: ライブラリ<67>-Footnote-994550251
Ref: ライブラリ<67>-Footnote-1004550307
Ref: ライブラリ<67>-Footnote-1014550364
Ref: ライブラリ<67>-Footnote-1024550422
Ref: ライブラリ<67>-Footnote-1034550480
Ref: ライブラリ<67>-Footnote-1044550538
Ref: ライブラリ<67>-Footnote-1054550596
Ref: ライブラリ<67>-Footnote-1064550653
Ref: ライブラリ<67>-Footnote-1074550710
Ref: ライブラリ<67>-Footnote-1084550768
Ref: ライブラリ<67>-Footnote-1094550826
Ref: ライブラリ<67>-Footnote-1104550884
Ref: ライブラリ<67>-Footnote-1114550941
Ref: ライブラリ<67>-Footnote-1124550999
Ref: ライブラリ<67>-Footnote-1134551057
Ref: ライブラリ<67>-Footnote-1144551114
Ref: ライブラリ<67>-Footnote-1154551172
Ref: ライブラリ<67>-Footnote-1164551216
Ref: ライブラリ<67>-Footnote-1174551274
Ref: ライブラリ<67>-Footnote-1184551331
Ref: ライブラリ<67>-Footnote-1194551388
Ref: ライブラリ<67>-Footnote-1204551445
Ref: ライブラリ<67>-Footnote-1214551512
Ref: ライブラリ<67>-Footnote-1224551579
Ref: ライブラリ<67>-Footnote-1234551646
Ref: ライブラリ<67>-Footnote-1244551713
Ref: ライブラリ<67>-Footnote-1254551780
Ref: ライブラリ<67>-Footnote-1264551847
Ref: ライブラリ<67>-Footnote-1274551914
Ref: ライブラリ<67>-Footnote-1284551981
Ref: ライブラリ<67>-Footnote-1294552048
Ref: ライブラリ<67>-Footnote-1304552115
Ref: ライブラリ<67>-Footnote-1314552182
Ref: ライブラリ<67>-Footnote-1324552249
Ref: ライブラリ<67>-Footnote-1334552316
Ref: ライブラリ<67>-Footnote-1344552383
Node: ドキュメント<19>4552450
Ref: whatsnew/changelog id2774552580
Ref: 1c554552580
Ref: ドキュメント<19>-Footnote-14553150
Ref: ドキュメント<19>-Footnote-24553206
Ref: ドキュメント<19>-Footnote-34553262
Ref: ドキュメント<19>-Footnote-44553317
Node: テスト<22>4553375
Ref: whatsnew/changelog id2784553499
Ref: 1c564553499
Ref: テスト<22>-Footnote-14555449
Ref: テスト<22>-Footnote-24555505
Ref: テスト<22>-Footnote-34555561
Ref: テスト<22>-Footnote-44555617
Ref: テスト<22>-Footnote-54555672
Ref: テスト<22>-Footnote-64555728
Ref: テスト<22>-Footnote-74555784
Ref: テスト<22>-Footnote-84555840
Ref: テスト<22>-Footnote-94555896
Ref: テスト<22>-Footnote-104555952
Node: ビルド<21>4556018
Ref: whatsnew/changelog id2794556131
Ref: 1c574556131
Ref: ビルド<21>-Footnote-14557380
Ref: ビルド<21>-Footnote-24557436
Ref: ビルド<21>-Footnote-34557492
Ref: ビルド<21>-Footnote-44557548
Ref: ビルド<21>-Footnote-54557604
Ref: ビルド<21>-Footnote-64557660
Ref: ビルド<21>-Footnote-74557716
Ref: ビルド<21>-Footnote-84557781
Node: Windows<19>4557846
Ref: whatsnew/changelog id2804557955
Ref: 1c584557955
Ref: Windows<19>-Footnote-14559791
Ref: Windows<19>-Footnote-24559847
Ref: Windows<19>-Footnote-34559903
Ref: Windows<19>-Footnote-44559959
Ref: Windows<19>-Footnote-54560015
Ref: Windows<19>-Footnote-64560070
Ref: Windows<19>-Footnote-74560125
Ref: Windows<19>-Footnote-84560181
Ref: Windows<19>-Footnote-94560237
Ref: Windows<19>-Footnote-104560292
Ref: Windows<19>-Footnote-114560348
Node: macOS<13>4560414
Ref: whatsnew/changelog id2814560518
Ref: 1c594560518
Ref: macOS<13>-Footnote-14562915
Ref: macOS<13>-Footnote-24562971
Ref: macOS<13>-Footnote-34563027
Ref: macOS<13>-Footnote-44563083
Ref: macOS<13>-Footnote-54563138
Ref: macOS<13>-Footnote-64563193
Ref: macOS<13>-Footnote-74563248
Ref: macOS<13>-Footnote-84563304
Ref: macOS<13>-Footnote-94563360
Ref: macOS<13>-Footnote-104563416
Ref: macOS<13>-Footnote-114563473
Ref: macOS<13>-Footnote-124563530
Node: IDLE<12>4563587
Ref: whatsnew/changelog id2824563689
Ref: 1c5a4563689
Ref: IDLE<12>-Footnote-14564265
Ref: IDLE<12>-Footnote-24564320
Ref: IDLE<12>-Footnote-34564376
Ref: IDLE<12>-Footnote-44564432
Ref: IDLE<12>-Footnote-54564488
Ref: IDLE<12>-Footnote-64564544
Node: C API<22>4564609
Ref: whatsnew/changelog id2834564693
Ref: 1c5b4564693
Ref: C API<22>-Footnote-14565408
Ref: C API<22>-Footnote-24565464
Ref: C API<22>-Footnote-34565520
Ref: C API<22>-Footnote-44565576
Node: Python 3 13 0 alpha 24565631
Ref: whatsnew/changelog python-3-13-0-alpha-24565761
Ref: 1c5c4565761
Node: Core and Builtins<65>4566114
Ref: whatsnew/changelog id2844566221
Ref: 1c5d4566221
Ref: Core and Builtins<65>-Footnote-14574042
Ref: Core and Builtins<65>-Footnote-24574098
Ref: Core and Builtins<65>-Footnote-34574154
Ref: Core and Builtins<65>-Footnote-44574210
Ref: Core and Builtins<65>-Footnote-54574266
Ref: Core and Builtins<65>-Footnote-64574322
Ref: Core and Builtins<65>-Footnote-74574378
Ref: Core and Builtins<65>-Footnote-84574434
Ref: Core and Builtins<65>-Footnote-94574489
Ref: Core and Builtins<65>-Footnote-104574544
Ref: Core and Builtins<65>-Footnote-114574600
Ref: Core and Builtins<65>-Footnote-124574657
Ref: Core and Builtins<65>-Footnote-134574714
Ref: Core and Builtins<65>-Footnote-144574771
Ref: Core and Builtins<65>-Footnote-154574828
Ref: Core and Builtins<65>-Footnote-164574885
Ref: Core and Builtins<65>-Footnote-174574942
Ref: Core and Builtins<65>-Footnote-184574999
Ref: Core and Builtins<65>-Footnote-194575056
Ref: Core and Builtins<65>-Footnote-204575113
Ref: Core and Builtins<65>-Footnote-214575170
Ref: Core and Builtins<65>-Footnote-224575227
Ref: Core and Builtins<65>-Footnote-234575284
Ref: Core and Builtins<65>-Footnote-244575341
Ref: Core and Builtins<65>-Footnote-254575398
Ref: Core and Builtins<65>-Footnote-264575455
Ref: Core and Builtins<65>-Footnote-274575512
Ref: Core and Builtins<65>-Footnote-284575569
Ref: Core and Builtins<65>-Footnote-294575626
Ref: Core and Builtins<65>-Footnote-304575682
Ref: Core and Builtins<65>-Footnote-314575738
Ref: Core and Builtins<65>-Footnote-324575795
Ref: Core and Builtins<65>-Footnote-334575852
Ref: Core and Builtins<65>-Footnote-344575909
Ref: Core and Builtins<65>-Footnote-354575966
Ref: Core and Builtins<65>-Footnote-364576023
Ref: Core and Builtins<65>-Footnote-374576080
Ref: Core and Builtins<65>-Footnote-384576137
Ref: Core and Builtins<65>-Footnote-394576194
Ref: Core and Builtins<65>-Footnote-404576251
Ref: Core and Builtins<65>-Footnote-414576308
Ref: Core and Builtins<65>-Footnote-424576365
Ref: Core and Builtins<65>-Footnote-434576422
Ref: Core and Builtins<65>-Footnote-444576478
Ref: Core and Builtins<65>-Footnote-454576544
Ref: Core and Builtins<65>-Footnote-464576601
Ref: Core and Builtins<65>-Footnote-474576667
Ref: Core and Builtins<65>-Footnote-484576724
Ref: Core and Builtins<65>-Footnote-494576781
Ref: Core and Builtins<65>-Footnote-504576838
Node: ライブラリ<68>4576904
Ref: whatsnew/changelog id2854577033
Ref: 1c604577033
Ref: ライブラリ<68>-Footnote-14587603
Ref: ライブラリ<68>-Footnote-24587659
Ref: ライブラリ<68>-Footnote-34587715
Ref: ライブラリ<68>-Footnote-44587771
Ref: ライブラリ<68>-Footnote-54587827
Ref: ライブラリ<68>-Footnote-64587883
Ref: ライブラリ<68>-Footnote-74587939
Ref: ライブラリ<68>-Footnote-84587995
Ref: ライブラリ<68>-Footnote-94588051
Ref: ライブラリ<68>-Footnote-104588107
Ref: ライブラリ<68>-Footnote-114588164
Ref: ライブラリ<68>-Footnote-124588220
Ref: ライブラリ<68>-Footnote-134588277
Ref: ライブラリ<68>-Footnote-144588334
Ref: ライブラリ<68>-Footnote-154588391
Ref: ライブラリ<68>-Footnote-164588448
Ref: ライブラリ<68>-Footnote-174588505
Ref: ライブラリ<68>-Footnote-184588562
Ref: ライブラリ<68>-Footnote-194588619
Ref: ライブラリ<68>-Footnote-204588675
Ref: ライブラリ<68>-Footnote-214588732
Ref: ライブラリ<68>-Footnote-224588789
Ref: ライブラリ<68>-Footnote-234588845
Ref: ライブラリ<68>-Footnote-244588902
Ref: ライブラリ<68>-Footnote-254588958
Ref: ライブラリ<68>-Footnote-264589015
Ref: ライブラリ<68>-Footnote-274589072
Ref: ライブラリ<68>-Footnote-284589129
Ref: ライブラリ<68>-Footnote-294589186
Ref: ライブラリ<68>-Footnote-304589243
Ref: ライブラリ<68>-Footnote-314589300
Ref: ライブラリ<68>-Footnote-324589357
Ref: ライブラリ<68>-Footnote-334589414
Ref: ライブラリ<68>-Footnote-344589471
Ref: ライブラリ<68>-Footnote-354589528
Ref: ライブラリ<68>-Footnote-364589585
Ref: ライブラリ<68>-Footnote-374589642
Ref: ライブラリ<68>-Footnote-384589699
Ref: ライブラリ<68>-Footnote-394589755
Ref: ライブラリ<68>-Footnote-404589811
Ref: ライブラリ<68>-Footnote-414589868
Ref: ライブラリ<68>-Footnote-424589925
Ref: ライブラリ<68>-Footnote-434589982
Ref: ライブラリ<68>-Footnote-444590038
Ref: ライブラリ<68>-Footnote-454590094
Ref: ライブラリ<68>-Footnote-464590151
Ref: ライブラリ<68>-Footnote-474590208
Ref: ライブラリ<68>-Footnote-484590265
Ref: ライブラリ<68>-Footnote-494590322
Ref: ライブラリ<68>-Footnote-504590378
Ref: ライブラリ<68>-Footnote-514590435
Ref: ライブラリ<68>-Footnote-524590492
Ref: ライブラリ<68>-Footnote-534590549
Ref: ライブラリ<68>-Footnote-544590605
Ref: ライブラリ<68>-Footnote-554590661
Ref: ライブラリ<68>-Footnote-564590717
Ref: ライブラリ<68>-Footnote-574590774
Ref: ライブラリ<68>-Footnote-584590831
Ref: ライブラリ<68>-Footnote-594590887
Ref: ライブラリ<68>-Footnote-604590943
Ref: ライブラリ<68>-Footnote-614591028
Ref: ライブラリ<68>-Footnote-624591084
Node: テスト<23>4591140
Ref: whatsnew/changelog id2864591261
Ref: 1c6f4591261
Ref: テスト<23>-Footnote-14592852
Ref: テスト<23>-Footnote-24592908
Ref: テスト<23>-Footnote-34592964
Ref: テスト<23>-Footnote-44593020
Ref: テスト<23>-Footnote-54593076
Ref: テスト<23>-Footnote-64593132
Ref: テスト<23>-Footnote-74593188
Ref: テスト<23>-Footnote-84593244
Node: ビルド<22>4593300
Ref: whatsnew/changelog id2874593413
Ref: 1c704593413
Ref: ビルド<22>-Footnote-14594404
Ref: ビルド<22>-Footnote-24594459
Ref: ビルド<22>-Footnote-34594515
Ref: ビルド<22>-Footnote-44594565
Ref: ビルド<22>-Footnote-54594621
Ref: ビルド<22>-Footnote-64594677
Node: Windows<20>4594732
Ref: whatsnew/changelog id2884594841
Ref: 1c714594841
Ref: Windows<20>-Footnote-14595296
Ref: Windows<20>-Footnote-24595352
Ref: Windows<20>-Footnote-34595408
Node: macOS<14>4595464
Ref: whatsnew/changelog id2894595568
Ref: 1c734595568
Ref: macOS<14>-Footnote-14596499
Ref: macOS<14>-Footnote-24596554
Ref: macOS<14>-Footnote-34596610
Ref: macOS<14>-Footnote-44596666
Ref: macOS<14>-Footnote-54596721
Node: IDLE<13>4596776
Ref: whatsnew/changelog id2904596884
Ref: 1c744596884
Ref: IDLE<13>-Footnote-14597222
Node: Tools/Demos<16>4597287
Ref: whatsnew/changelog id2914597395
Ref: 1c754597395
Ref: Tools/Demos<16>-Footnote-14597752
Node: C API<23>4597808
Ref: whatsnew/changelog id2924597899
Ref: 1c764597899
Ref: C API<23>-Footnote-14603265
Ref: C API<23>-Footnote-24603321
Ref: C API<23>-Footnote-34603377
Ref: C API<23>-Footnote-44603433
Ref: C API<23>-Footnote-54603489
Ref: C API<23>-Footnote-64603545
Ref: C API<23>-Footnote-74603601
Ref: C API<23>-Footnote-84603657
Ref: C API<23>-Footnote-94603713
Ref: C API<23>-Footnote-104603769
Ref: C API<23>-Footnote-114603826
Ref: C API<23>-Footnote-124603869
Ref: C API<23>-Footnote-134603926
Ref: C API<23>-Footnote-144603983
Ref: C API<23>-Footnote-154604040
Ref: C API<23>-Footnote-164604097
Ref: C API<23>-Footnote-174604154
Ref: C API<23>-Footnote-184604210
Ref: C API<23>-Footnote-194604266
Ref: C API<23>-Footnote-204604323
Node: Python 3 13 0 alpha 14604379
Ref: whatsnew/changelog python-3-13-0-alpha-14604508
Ref: 1c774604508
Node: セキュリティ<20>4604953
Ref: whatsnew/changelog id2934605063
Ref: 1c784605063
Ref: セキュリティ<20>-Footnote-14606345
Ref: セキュリティ<20>-Footnote-24606401
Ref: セキュリティ<20>-Footnote-34606457
Ref: セキュリティ<20>-Footnote-44606513
Ref: セキュリティ<20>-Footnote-54606569
Ref: セキュリティ<20>-Footnote-64606625
Ref: セキュリティ<20>-Footnote-74606680
Node: Core and Builtins<66>4606736
Ref: whatsnew/changelog id2944606874
Ref: 1c794606874
Ref: Core and Builtins<66>-Footnote-14637605
Ref: Core and Builtins<66>-Footnote-24637661
Ref: Core and Builtins<66>-Footnote-34637717
Ref: Core and Builtins<66>-Footnote-44637773
Ref: Core and Builtins<66>-Footnote-54637829
Ref: Core and Builtins<66>-Footnote-64637885
Ref: Core and Builtins<66>-Footnote-74637941
Ref: Core and Builtins<66>-Footnote-84637997
Ref: Core and Builtins<66>-Footnote-94638053
Ref: Core and Builtins<66>-Footnote-104638109
Ref: Core and Builtins<66>-Footnote-114638166
Ref: Core and Builtins<66>-Footnote-124638223
Ref: Core and Builtins<66>-Footnote-134638280
Ref: Core and Builtins<66>-Footnote-144638337
Ref: Core and Builtins<66>-Footnote-154638394
Ref: Core and Builtins<66>-Footnote-164638451
Ref: Core and Builtins<66>-Footnote-174638508
Ref: Core and Builtins<66>-Footnote-184638565
Ref: Core and Builtins<66>-Footnote-194638622
Ref: Core and Builtins<66>-Footnote-204638679
Ref: Core and Builtins<66>-Footnote-214638736
Ref: Core and Builtins<66>-Footnote-224638793
Ref: Core and Builtins<66>-Footnote-234638850
Ref: Core and Builtins<66>-Footnote-244638907
Ref: Core and Builtins<66>-Footnote-254638964
Ref: Core and Builtins<66>-Footnote-264639021
Ref: Core and Builtins<66>-Footnote-274639078
Ref: Core and Builtins<66>-Footnote-284639135
Ref: Core and Builtins<66>-Footnote-294639192
Ref: Core and Builtins<66>-Footnote-304639249
Ref: Core and Builtins<66>-Footnote-314639306
Ref: Core and Builtins<66>-Footnote-324639363
Ref: Core and Builtins<66>-Footnote-334639420
Ref: Core and Builtins<66>-Footnote-344639477
Ref: Core and Builtins<66>-Footnote-354639534
Ref: Core and Builtins<66>-Footnote-364639591
Ref: Core and Builtins<66>-Footnote-374639648
Ref: Core and Builtins<66>-Footnote-384639705
Ref: Core and Builtins<66>-Footnote-394639762
Ref: Core and Builtins<66>-Footnote-404639819
Ref: Core and Builtins<66>-Footnote-414639876
Ref: Core and Builtins<66>-Footnote-424639933
Ref: Core and Builtins<66>-Footnote-434639990
Ref: Core and Builtins<66>-Footnote-444640047
Ref: Core and Builtins<66>-Footnote-454640103
Ref: Core and Builtins<66>-Footnote-464640160
Ref: Core and Builtins<66>-Footnote-474640217
Ref: Core and Builtins<66>-Footnote-484640274
Ref: Core and Builtins<66>-Footnote-494640331
Ref: Core and Builtins<66>-Footnote-504640388
Ref: Core and Builtins<66>-Footnote-514640445
Ref: Core and Builtins<66>-Footnote-524640502
Ref: Core and Builtins<66>-Footnote-534640559
Ref: Core and Builtins<66>-Footnote-544640616
Ref: Core and Builtins<66>-Footnote-554640673
Ref: Core and Builtins<66>-Footnote-564640730
Ref: Core and Builtins<66>-Footnote-574640787
Ref: Core and Builtins<66>-Footnote-584640844
Ref: Core and Builtins<66>-Footnote-594640901
Ref: Core and Builtins<66>-Footnote-604640958
Ref: Core and Builtins<66>-Footnote-614641015
Ref: Core and Builtins<66>-Footnote-624641072
Ref: Core and Builtins<66>-Footnote-634641129
Ref: Core and Builtins<66>-Footnote-644641186
Ref: Core and Builtins<66>-Footnote-654641242
Ref: Core and Builtins<66>-Footnote-664641299
Ref: Core and Builtins<66>-Footnote-674641356
Ref: Core and Builtins<66>-Footnote-684641412
Ref: Core and Builtins<66>-Footnote-694641469
Ref: Core and Builtins<66>-Footnote-704641526
Ref: Core and Builtins<66>-Footnote-714641583
Ref: Core and Builtins<66>-Footnote-724641640
Ref: Core and Builtins<66>-Footnote-734641697
Ref: Core and Builtins<66>-Footnote-744641753
Ref: Core and Builtins<66>-Footnote-754641810
Ref: Core and Builtins<66>-Footnote-764641867
Ref: Core and Builtins<66>-Footnote-774641924
Ref: Core and Builtins<66>-Footnote-784641981
Ref: Core and Builtins<66>-Footnote-794642038
Ref: Core and Builtins<66>-Footnote-804642095
Ref: Core and Builtins<66>-Footnote-814642152
Ref: Core and Builtins<66>-Footnote-824642209
Ref: Core and Builtins<66>-Footnote-834642266
Ref: Core and Builtins<66>-Footnote-844642323
Ref: Core and Builtins<66>-Footnote-854642366
Ref: Core and Builtins<66>-Footnote-864642423
Ref: Core and Builtins<66>-Footnote-874642480
Ref: Core and Builtins<66>-Footnote-884642537
Ref: Core and Builtins<66>-Footnote-894642593
Ref: Core and Builtins<66>-Footnote-904642650
Ref: Core and Builtins<66>-Footnote-914642707
Ref: Core and Builtins<66>-Footnote-924642764
Ref: Core and Builtins<66>-Footnote-934642821
Ref: Core and Builtins<66>-Footnote-944642878
Ref: Core and Builtins<66>-Footnote-954642935
Ref: Core and Builtins<66>-Footnote-964642992
Ref: Core and Builtins<66>-Footnote-974643049
Ref: Core and Builtins<66>-Footnote-984643106
Ref: Core and Builtins<66>-Footnote-994643163
Ref: Core and Builtins<66>-Footnote-1004643220
Ref: Core and Builtins<66>-Footnote-1014643278
Ref: Core and Builtins<66>-Footnote-1024643336
Ref: Core and Builtins<66>-Footnote-1034643394
Ref: Core and Builtins<66>-Footnote-1044643452
Ref: Core and Builtins<66>-Footnote-1054643510
Ref: Core and Builtins<66>-Footnote-1064643568
Ref: Core and Builtins<66>-Footnote-1074643625
Ref: Core and Builtins<66>-Footnote-1084643682
Ref: Core and Builtins<66>-Footnote-1094643740
Ref: Core and Builtins<66>-Footnote-1104643798
Ref: Core and Builtins<66>-Footnote-1114643856
Ref: Core and Builtins<66>-Footnote-1124643914
Ref: Core and Builtins<66>-Footnote-1134643972
Ref: Core and Builtins<66>-Footnote-1144644030
Ref: Core and Builtins<66>-Footnote-1154644088
Ref: Core and Builtins<66>-Footnote-1164644146
Ref: Core and Builtins<66>-Footnote-1174644204
Ref: Core and Builtins<66>-Footnote-1184644262
Ref: Core and Builtins<66>-Footnote-1194644320
Ref: Core and Builtins<66>-Footnote-1204644378
Ref: Core and Builtins<66>-Footnote-1214644435
Ref: Core and Builtins<66>-Footnote-1224644493
Ref: Core and Builtins<66>-Footnote-1234644551
Ref: Core and Builtins<66>-Footnote-1244644608
Ref: Core and Builtins<66>-Footnote-1254644666
Ref: Core and Builtins<66>-Footnote-1264644724
Ref: Core and Builtins<66>-Footnote-1274644782
Ref: Core and Builtins<66>-Footnote-1284644840
Ref: Core and Builtins<66>-Footnote-1294644898
Ref: Core and Builtins<66>-Footnote-1304644956
Ref: Core and Builtins<66>-Footnote-1314645014
Ref: Core and Builtins<66>-Footnote-1324645072
Ref: Core and Builtins<66>-Footnote-1334645130
Ref: Core and Builtins<66>-Footnote-1344645188
Ref: Core and Builtins<66>-Footnote-1354645246
Ref: Core and Builtins<66>-Footnote-1364645304
Ref: Core and Builtins<66>-Footnote-1374645362
Ref: Core and Builtins<66>-Footnote-1384645420
Ref: Core and Builtins<66>-Footnote-1394645478
Ref: Core and Builtins<66>-Footnote-1404645536
Ref: Core and Builtins<66>-Footnote-1414645594
Ref: Core and Builtins<66>-Footnote-1424645652
Ref: Core and Builtins<66>-Footnote-1434645710
Ref: Core and Builtins<66>-Footnote-1444645768
Ref: Core and Builtins<66>-Footnote-1454645825
Ref: Core and Builtins<66>-Footnote-1464645883
Ref: Core and Builtins<66>-Footnote-1474645941
Ref: Core and Builtins<66>-Footnote-1484645998
Ref: Core and Builtins<66>-Footnote-1494646056
Ref: Core and Builtins<66>-Footnote-1504646114
Ref: Core and Builtins<66>-Footnote-1514646172
Ref: Core and Builtins<66>-Footnote-1524646230
Ref: Core and Builtins<66>-Footnote-1534646288
Ref: Core and Builtins<66>-Footnote-1544646346
Ref: Core and Builtins<66>-Footnote-1554646404
Ref: Core and Builtins<66>-Footnote-1564646462
Ref: Core and Builtins<66>-Footnote-1574646520
Ref: Core and Builtins<66>-Footnote-1584646578
Ref: Core and Builtins<66>-Footnote-1594646636
Ref: Core and Builtins<66>-Footnote-1604646694
Ref: Core and Builtins<66>-Footnote-1614646752
Ref: Core and Builtins<66>-Footnote-1624646810
Ref: Core and Builtins<66>-Footnote-1634646868
Ref: Core and Builtins<66>-Footnote-1644646926
Ref: Core and Builtins<66>-Footnote-1654646984
Ref: Core and Builtins<66>-Footnote-1664647042
Ref: Core and Builtins<66>-Footnote-1674647100
Ref: Core and Builtins<66>-Footnote-1684647157
Ref: Core and Builtins<66>-Footnote-1694647214
Ref: Core and Builtins<66>-Footnote-1704647271
Ref: Core and Builtins<66>-Footnote-1714647329
Node: ライブラリ<69>4647386
Ref: whatsnew/changelog id2954647524
Ref: 1c8b4647524
Ref: ライブラリ<69>-Footnote-14695843
Ref: ライブラリ<69>-Footnote-24695899
Ref: ライブラリ<69>-Footnote-34695955
Ref: ライブラリ<69>-Footnote-44696011
Ref: ライブラリ<69>-Footnote-54696066
Ref: ライブラリ<69>-Footnote-64696122
Ref: ライブラリ<69>-Footnote-74696178
Ref: ライブラリ<69>-Footnote-84696234
Ref: ライブラリ<69>-Footnote-94696289
Ref: ライブラリ<69>-Footnote-104696345
Ref: ライブラリ<69>-Footnote-114696401
Ref: ライブラリ<69>-Footnote-124696458
Ref: ライブラリ<69>-Footnote-134696515
Ref: ライブラリ<69>-Footnote-144696572
Ref: ライブラリ<69>-Footnote-154696629
Ref: ライブラリ<69>-Footnote-164696686
Ref: ライブラリ<69>-Footnote-174696743
Ref: ライブラリ<69>-Footnote-184696800
Ref: ライブラリ<69>-Footnote-194696857
Ref: ライブラリ<69>-Footnote-204696914
Ref: ライブラリ<69>-Footnote-214696971
Ref: ライブラリ<69>-Footnote-224697028
Ref: ライブラリ<69>-Footnote-234697085
Ref: ライブラリ<69>-Footnote-244697142
Ref: ライブラリ<69>-Footnote-254697185
Ref: ライブラリ<69>-Footnote-264697241
Ref: ライブラリ<69>-Footnote-274697298
Ref: ライブラリ<69>-Footnote-284697355
Ref: ライブラリ<69>-Footnote-294697412
Ref: ライブラリ<69>-Footnote-304697469
Ref: ライブラリ<69>-Footnote-314697526
Ref: ライブラリ<69>-Footnote-324697583
Ref: ライブラリ<69>-Footnote-334697640
Ref: ライブラリ<69>-Footnote-344697697
Ref: ライブラリ<69>-Footnote-354697754
Ref: ライブラリ<69>-Footnote-364697811
Ref: ライブラリ<69>-Footnote-374697868
Ref: ライブラリ<69>-Footnote-384697924
Ref: ライブラリ<69>-Footnote-394697981
Ref: ライブラリ<69>-Footnote-404698038
Ref: ライブラリ<69>-Footnote-414698095
Ref: ライブラリ<69>-Footnote-424698152
Ref: ライブラリ<69>-Footnote-434698209
Ref: ライブラリ<69>-Footnote-444698266
Ref: ライブラリ<69>-Footnote-454698323
Ref: ライブラリ<69>-Footnote-464698380
Ref: ライブラリ<69>-Footnote-474698437
Ref: ライブラリ<69>-Footnote-484698494
Ref: ライブラリ<69>-Footnote-494698551
Ref: ライブラリ<69>-Footnote-504698608
Ref: ライブラリ<69>-Footnote-514698664
Ref: ライブラリ<69>-Footnote-524698721
Ref: ライブラリ<69>-Footnote-534698777
Ref: ライブラリ<69>-Footnote-544698834
Ref: ライブラリ<69>-Footnote-554698891
Ref: ライブラリ<69>-Footnote-564698948
Ref: ライブラリ<69>-Footnote-574699005
Ref: ライブラリ<69>-Footnote-584699062
Ref: ライブラリ<69>-Footnote-594699119
Ref: ライブラリ<69>-Footnote-604699176
Ref: ライブラリ<69>-Footnote-614699233
Ref: ライブラリ<69>-Footnote-624699290
Ref: ライブラリ<69>-Footnote-634699347
Ref: ライブラリ<69>-Footnote-644699404
Ref: ライブラリ<69>-Footnote-654699461
Ref: ライブラリ<69>-Footnote-664699518
Ref: ライブラリ<69>-Footnote-674699575
Ref: ライブラリ<69>-Footnote-684699632
Ref: ライブラリ<69>-Footnote-694699689
Ref: ライブラリ<69>-Footnote-704699745
Ref: ライブラリ<69>-Footnote-714699802
Ref: ライブラリ<69>-Footnote-724699859
Ref: ライブラリ<69>-Footnote-734699916
Ref: ライブラリ<69>-Footnote-744699973
Ref: ライブラリ<69>-Footnote-754700030
Ref: ライブラリ<69>-Footnote-764700086
Ref: ライブラリ<69>-Footnote-774700143
Ref: ライブラリ<69>-Footnote-784700200
Ref: ライブラリ<69>-Footnote-794700257
Ref: ライブラリ<69>-Footnote-804700314
Ref: ライブラリ<69>-Footnote-814700371
Ref: ライブラリ<69>-Footnote-824700428
Ref: ライブラリ<69>-Footnote-834700485
Ref: ライブラリ<69>-Footnote-844700541
Ref: ライブラリ<69>-Footnote-854700597
Ref: ライブラリ<69>-Footnote-864700653
Ref: ライブラリ<69>-Footnote-874700709
Ref: ライブラリ<69>-Footnote-884700766
Ref: ライブラリ<69>-Footnote-894700823
Ref: ライブラリ<69>-Footnote-904700880
Ref: ライブラリ<69>-Footnote-914700937
Ref: ライブラリ<69>-Footnote-924700994
Ref: ライブラリ<69>-Footnote-934701050
Ref: ライブラリ<69>-Footnote-944701107
Ref: ライブラリ<69>-Footnote-954701164
Ref: ライブラリ<69>-Footnote-964701221
Ref: ライブラリ<69>-Footnote-974701277
Ref: ライブラリ<69>-Footnote-984701334
Ref: ライブラリ<69>-Footnote-994701391
Ref: ライブラリ<69>-Footnote-1004701448
Ref: ライブラリ<69>-Footnote-1014701506
Ref: ライブラリ<69>-Footnote-1024701564
Ref: ライブラリ<69>-Footnote-1034701622
Ref: ライブラリ<69>-Footnote-1044701680
Ref: ライブラリ<69>-Footnote-1054701738
Ref: ライブラリ<69>-Footnote-1064701796
Ref: ライブラリ<69>-Footnote-1074701854
Ref: ライブラリ<69>-Footnote-1084701911
Ref: ライブラリ<69>-Footnote-1094701969
Ref: ライブラリ<69>-Footnote-1104702026
Ref: ライブラリ<69>-Footnote-1114702084
Ref: ライブラリ<69>-Footnote-1124702141
Ref: ライブラリ<69>-Footnote-1134702198
Ref: ライブラリ<69>-Footnote-1144702255
Ref: ライブラリ<69>-Footnote-1154702313
Ref: ライブラリ<69>-Footnote-1164702371
Ref: ライブラリ<69>-Footnote-1174702429
Ref: ライブラリ<69>-Footnote-1184702487
Ref: ライブラリ<69>-Footnote-1194702545
Ref: ライブラリ<69>-Footnote-1204702603
Ref: ライブラリ<69>-Footnote-1214702661
Ref: ライブラリ<69>-Footnote-1224702719
Ref: ライブラリ<69>-Footnote-1234702777
Ref: ライブラリ<69>-Footnote-1244702835
Ref: ライブラリ<69>-Footnote-1254702893
Ref: ライブラリ<69>-Footnote-1264702951
Ref: ライブラリ<69>-Footnote-1274703009
Ref: ライブラリ<69>-Footnote-1284703067
Ref: ライブラリ<69>-Footnote-1294703125
Ref: ライブラリ<69>-Footnote-1304703183
Ref: ライブラリ<69>-Footnote-1314703241
Ref: ライブラリ<69>-Footnote-1324703299
Ref: ライブラリ<69>-Footnote-1334703357
Ref: ライブラリ<69>-Footnote-1344703415
Ref: ライブラリ<69>-Footnote-1354703473
Ref: ライブラリ<69>-Footnote-1364703530
Ref: ライブラリ<69>-Footnote-1374703588
Ref: ライブラリ<69>-Footnote-1384703646
Ref: ライブラリ<69>-Footnote-1394703704
Ref: ライブラリ<69>-Footnote-1404703762
Ref: ライブラリ<69>-Footnote-1414703820
Ref: ライブラリ<69>-Footnote-1424703878
Ref: ライブラリ<69>-Footnote-1434703936
Ref: ライブラリ<69>-Footnote-1444703994
Ref: ライブラリ<69>-Footnote-1454704052
Ref: ライブラリ<69>-Footnote-1464704110
Ref: ライブラリ<69>-Footnote-1474704168
Ref: ライブラリ<69>-Footnote-1484704226
Ref: ライブラリ<69>-Footnote-1494704284
Ref: ライブラリ<69>-Footnote-1504704341
Ref: ライブラリ<69>-Footnote-1514704399
Ref: ライブラリ<69>-Footnote-1524704456
Ref: ライブラリ<69>-Footnote-1534704514
Ref: ライブラリ<69>-Footnote-1544704572
Ref: ライブラリ<69>-Footnote-1554704630
Ref: ライブラリ<69>-Footnote-1564704688
Ref: ライブラリ<69>-Footnote-1574704746
Ref: ライブラリ<69>-Footnote-1584704804
Ref: ライブラリ<69>-Footnote-1594704862
Ref: ライブラリ<69>-Footnote-1604704920
Ref: ライブラリ<69>-Footnote-1614704978
Ref: ライブラリ<69>-Footnote-1624705036
Ref: ライブラリ<69>-Footnote-1634705094
Ref: ライブラリ<69>-Footnote-1644705152
Ref: ライブラリ<69>-Footnote-1654705210
Ref: ライブラリ<69>-Footnote-1664705268
Ref: ライブラリ<69>-Footnote-1674705325
Ref: ライブラリ<69>-Footnote-1684705382
Ref: ライブラリ<69>-Footnote-1694705440
Ref: ライブラリ<69>-Footnote-1704705498
Ref: ライブラリ<69>-Footnote-1714705556
Ref: ライブラリ<69>-Footnote-1724705614
Ref: ライブラリ<69>-Footnote-1734705658
Ref: ライブラリ<69>-Footnote-1744705716
Ref: ライブラリ<69>-Footnote-1754705774
Ref: ライブラリ<69>-Footnote-1764705832
Ref: ライブラリ<69>-Footnote-1774705890
Ref: ライブラリ<69>-Footnote-1784705948
Ref: ライブラリ<69>-Footnote-1794706006
Ref: ライブラリ<69>-Footnote-1804706064
Ref: ライブラリ<69>-Footnote-1814706122
Ref: ライブラリ<69>-Footnote-1824706180
Ref: ライブラリ<69>-Footnote-1834706238
Ref: ライブラリ<69>-Footnote-1844706296
Ref: ライブラリ<69>-Footnote-1854706354
Ref: ライブラリ<69>-Footnote-1864706412
Ref: ライブラリ<69>-Footnote-1874706470
Ref: ライブラリ<69>-Footnote-1884706528
Ref: ライブラリ<69>-Footnote-1894706586
Ref: ライブラリ<69>-Footnote-1904706644
Ref: ライブラリ<69>-Footnote-1914706702
Ref: ライブラリ<69>-Footnote-1924706760
Ref: ライブラリ<69>-Footnote-1934706818
Ref: ライブラリ<69>-Footnote-1944706876
Ref: ライブラリ<69>-Footnote-1954706934
Ref: ライブラリ<69>-Footnote-1964706992
Ref: ライブラリ<69>-Footnote-1974707050
Ref: ライブラリ<69>-Footnote-1984707107
Ref: ライブラリ<69>-Footnote-1994707165
Ref: ライブラリ<69>-Footnote-2004707223
Ref: ライブラリ<69>-Footnote-2014707281
Ref: ライブラリ<69>-Footnote-2024707339
Ref: ライブラリ<69>-Footnote-2034707397
Ref: ライブラリ<69>-Footnote-2044707455
Ref: ライブラリ<69>-Footnote-2054707513
Ref: ライブラリ<69>-Footnote-2064707570
Ref: ライブラリ<69>-Footnote-2074707628
Ref: ライブラリ<69>-Footnote-2084707686
Ref: ライブラリ<69>-Footnote-2094707744
Ref: ライブラリ<69>-Footnote-2104707802
Ref: ライブラリ<69>-Footnote-2114707859
Ref: ライブラリ<69>-Footnote-2124707917
Ref: ライブラリ<69>-Footnote-2134707975
Ref: ライブラリ<69>-Footnote-2144708033
Ref: ライブラリ<69>-Footnote-2154708091
Ref: ライブラリ<69>-Footnote-2164708149
Ref: ライブラリ<69>-Footnote-2174708207
Ref: ライブラリ<69>-Footnote-2184708265
Ref: ライブラリ<69>-Footnote-2194708309
Ref: ライブラリ<69>-Footnote-2204708367
Ref: ライブラリ<69>-Footnote-2214708411
Ref: ライブラリ<69>-Footnote-2224708469
Ref: ライブラリ<69>-Footnote-2234708513
Ref: ライブラリ<69>-Footnote-2244708571
Ref: ライブラリ<69>-Footnote-2254708615
Ref: ライブラリ<69>-Footnote-2264708673
Ref: ライブラリ<69>-Footnote-2274708717
Ref: ライブラリ<69>-Footnote-2284708775
Ref: ライブラリ<69>-Footnote-2294708819
Ref: ライブラリ<69>-Footnote-2304708877
Ref: ライブラリ<69>-Footnote-2314708935
Ref: ライブラリ<69>-Footnote-2324708979
Ref: ライブラリ<69>-Footnote-2334709037
Ref: ライブラリ<69>-Footnote-2344709081
Ref: ライブラリ<69>-Footnote-2354709139
Ref: ライブラリ<69>-Footnote-2364709197
Ref: ライブラリ<69>-Footnote-2374709255
Ref: ライブラリ<69>-Footnote-2384709313
Ref: ライブラリ<69>-Footnote-2394709357
Ref: ライブラリ<69>-Footnote-2404709415
Ref: ライブラリ<69>-Footnote-2414709459
Ref: ライブラリ<69>-Footnote-2424709506
Ref: ライブラリ<69>-Footnote-2434709563
Ref: ライブラリ<69>-Footnote-2444709621
Ref: ライブラリ<69>-Footnote-2454709665
Ref: ライブラリ<69>-Footnote-2464709723
Ref: ライブラリ<69>-Footnote-2474709767
Ref: ライブラリ<69>-Footnote-2484709825
Ref: ライブラリ<69>-Footnote-2494709869
Ref: ライブラリ<69>-Footnote-2504709927
Ref: ライブラリ<69>-Footnote-2514709971
Ref: ライブラリ<69>-Footnote-2524710029
Ref: ライブラリ<69>-Footnote-2534710073
Ref: ライブラリ<69>-Footnote-2544710131
Ref: ライブラリ<69>-Footnote-2554710189
Ref: ライブラリ<69>-Footnote-2564710247
Ref: ライブラリ<69>-Footnote-2574710305
Ref: ライブラリ<69>-Footnote-2584710362
Ref: ライブラリ<69>-Footnote-2594710420
Ref: ライブラリ<69>-Footnote-2604710464
Ref: ライブラリ<69>-Footnote-2614710522
Ref: ライブラリ<69>-Footnote-2624710580
Ref: ライブラリ<69>-Footnote-2634710638
Ref: ライブラリ<69>-Footnote-2644710696
Ref: ライブラリ<69>-Footnote-2654710740
Ref: ライブラリ<69>-Footnote-2664710798
Ref: ライブラリ<69>-Footnote-2674710842
Ref: ライブラリ<69>-Footnote-2684710900
Ref: ライブラリ<69>-Footnote-2694710944
Ref: ライブラリ<69>-Footnote-2704711002
Ref: ライブラリ<69>-Footnote-2714711046
Ref: ライブラリ<69>-Footnote-2724711104
Ref: ライブラリ<69>-Footnote-2734711161
Ref: ライブラリ<69>-Footnote-2744711219
Ref: ライブラリ<69>-Footnote-2754711277
Ref: ライブラリ<69>-Footnote-2764711335
Ref: ライブラリ<69>-Footnote-2774711393
Ref: ライブラリ<69>-Footnote-2784711451
Ref: ライブラリ<69>-Footnote-2794711509
Ref: ライブラリ<69>-Footnote-2804711567
Ref: ライブラリ<69>-Footnote-2814711625
Ref: ライブラリ<69>-Footnote-2824711683
Ref: ライブラリ<69>-Footnote-2834711741
Ref: ライブラリ<69>-Footnote-2844711798
Ref: ライブラリ<69>-Footnote-2854711856
Ref: ライブラリ<69>-Footnote-2864711914
Ref: ライブラリ<69>-Footnote-2874711972
Ref: ライブラリ<69>-Footnote-2884712029
Ref: ライブラリ<69>-Footnote-2894712087
Ref: ライブラリ<69>-Footnote-2904712144
Ref: ライブラリ<69>-Footnote-2914712201
Ref: ライブラリ<69>-Footnote-2924712258
Ref: ライブラリ<69>-Footnote-2934712315
Ref: ライブラリ<69>-Footnote-2944712372
Ref: ライブラリ<69>-Footnote-2954712429
Ref: ライブラリ<69>-Footnote-2964712486
Ref: ライブラリ<69>-Footnote-2974712553
Ref: ライブラリ<69>-Footnote-2984712614
Ref: ライブラリ<69>-Footnote-2994712681
Ref: ライブラリ<69>-Footnote-3004712725
Ref: ライブラリ<69>-Footnote-3014712792
Ref: ライブラリ<69>-Footnote-3024712859
Ref: ライブラリ<69>-Footnote-3034712926
Ref: ライブラリ<69>-Footnote-3044712993
Node: ドキュメント<20>4713060
Ref: whatsnew/changelog id2964713190
Ref: 1c9f4713190
Ref: ドキュメント<20>-Footnote-14715146
Ref: ドキュメント<20>-Footnote-24715202
Ref: ドキュメント<20>-Footnote-34715258
Ref: ドキュメント<20>-Footnote-44715314
Ref: ドキュメント<20>-Footnote-54715370
Ref: ドキュメント<20>-Footnote-64715426
Ref: ドキュメント<20>-Footnote-74715482
Ref: ドキュメント<20>-Footnote-84715538
Ref: ドキュメント<20>-Footnote-94715594
Ref: ドキュメント<20>-Footnote-104715649
Ref: ドキュメント<20>-Footnote-114715705
Ref: ドキュメント<20>-Footnote-124715762
Ref: ドキュメント<20>-Footnote-134715818
Ref: ドキュメント<20>-Footnote-144715875
Node: テスト<24>4715932
Ref: whatsnew/changelog id2974716056
Ref: 1ca04716056
Ref: テスト<24>-Footnote-14729192
Ref: テスト<24>-Footnote-24729248
Ref: テスト<24>-Footnote-34729304
Ref: テスト<24>-Footnote-44729360
Ref: テスト<24>-Footnote-54729416
Ref: テスト<24>-Footnote-64729471
Ref: テスト<24>-Footnote-74729527
Ref: テスト<24>-Footnote-84729583
Ref: テスト<24>-Footnote-94729639
Ref: テスト<24>-Footnote-104729695
Ref: テスト<24>-Footnote-114729752
Ref: テスト<24>-Footnote-124729809
Ref: テスト<24>-Footnote-134729866
Ref: テスト<24>-Footnote-144729923
Ref: テスト<24>-Footnote-154729980
Ref: テスト<24>-Footnote-164730037
Ref: テスト<24>-Footnote-174730094
Ref: テスト<24>-Footnote-184730151
Ref: テスト<24>-Footnote-194730208
Ref: テスト<24>-Footnote-204730265
Ref: テスト<24>-Footnote-214730322
Ref: テスト<24>-Footnote-224730379
Ref: テスト<24>-Footnote-234730436
Ref: テスト<24>-Footnote-244730493
Ref: テスト<24>-Footnote-254730550
Ref: テスト<24>-Footnote-264730607
Ref: テスト<24>-Footnote-274730664
Ref: テスト<24>-Footnote-284730721
Ref: テスト<24>-Footnote-294730778
Ref: テスト<24>-Footnote-304730835
Ref: テスト<24>-Footnote-314730892
Ref: テスト<24>-Footnote-324730949
Ref: テスト<24>-Footnote-334731006
Ref: テスト<24>-Footnote-344731050
Ref: テスト<24>-Footnote-354731106
Ref: テスト<24>-Footnote-364731163
Ref: テスト<24>-Footnote-374731219
Ref: テスト<24>-Footnote-384731275
Ref: テスト<24>-Footnote-394731332
Ref: テスト<24>-Footnote-404731389
Ref: テスト<24>-Footnote-414731446
Ref: テスト<24>-Footnote-424731503
Ref: テスト<24>-Footnote-434731560
Ref: テスト<24>-Footnote-444731617
Ref: テスト<24>-Footnote-454731674
Ref: テスト<24>-Footnote-464731731
Ref: テスト<24>-Footnote-474731788
Ref: テスト<24>-Footnote-484731845
Ref: テスト<24>-Footnote-494731902
Ref: テスト<24>-Footnote-504731959
Ref: テスト<24>-Footnote-514732016
Ref: テスト<24>-Footnote-524732073
Ref: テスト<24>-Footnote-534732130
Ref: テスト<24>-Footnote-544732187
Ref: テスト<24>-Footnote-554732244
Ref: テスト<24>-Footnote-564732301
Ref: テスト<24>-Footnote-574732358
Ref: テスト<24>-Footnote-584732414
Ref: テスト<24>-Footnote-594732471
Node: ビルド<23>4732527
Ref: whatsnew/changelog id2984732640
Ref: 1ca24732640
Ref: ビルド<23>-Footnote-14736631
Ref: ビルド<23>-Footnote-24736687
Ref: ビルド<23>-Footnote-34736743
Ref: ビルド<23>-Footnote-44736799
Ref: ビルド<23>-Footnote-54736855
Ref: ビルド<23>-Footnote-64736911
Ref: ビルド<23>-Footnote-74736967
Ref: ビルド<23>-Footnote-84737022
Ref: ビルド<23>-Footnote-94737078
Ref: ビルド<23>-Footnote-104737134
Ref: ビルド<23>-Footnote-114737190
Ref: ビルド<23>-Footnote-124737247
Ref: ビルド<23>-Footnote-134737304
Ref: ビルド<23>-Footnote-144737361
Ref: ビルド<23>-Footnote-154737418
Ref: ビルド<23>-Footnote-164737474
Ref: ビルド<23>-Footnote-174737531
Ref: ビルド<23>-Footnote-184737588
Ref: ビルド<23>-Footnote-194737645
Ref: ビルド<23>-Footnote-204737702
Ref: ビルド<23>-Footnote-214737758
Ref: ビルド<23>-Footnote-224737815
Ref: ビルド<23>-Footnote-234737871
Ref: ビルド<23>-Footnote-244737928
Node: Windows<21>4737985
Ref: whatsnew/changelog id2994738094
Ref: 1ca44738094
Ref: Windows<21>-Footnote-14740599
Ref: Windows<21>-Footnote-24740655
Ref: Windows<21>-Footnote-34740711
Ref: Windows<21>-Footnote-44740766
Ref: Windows<21>-Footnote-54740822
Ref: Windows<21>-Footnote-64740878
Ref: Windows<21>-Footnote-74740933
Ref: Windows<21>-Footnote-84740989
Ref: Windows<21>-Footnote-94741045
Ref: Windows<21>-Footnote-104741101
Ref: Windows<21>-Footnote-114741158
Ref: Windows<21>-Footnote-124741214
Ref: Windows<21>-Footnote-134741271
Node: macOS<15>4741328
Ref: whatsnew/changelog id3004741432
Ref: 1ca54741432
Ref: macOS<15>-Footnote-14741696
Ref: macOS<15>-Footnote-24741752
Ref: macOS<15>-Footnote-34741808
Node: IDLE<14>4741863
Ref: whatsnew/changelog id3014741971
Ref: 1ca64741971
Ref: IDLE<14>-Footnote-14742160
Node: Tools/Demos<17>4742216
Ref: whatsnew/changelog id3024742324
Ref: 1ca74742324
Ref: Tools/Demos<17>-Footnote-14744838
Ref: Tools/Demos<17>-Footnote-24744894
Ref: Tools/Demos<17>-Footnote-34744950
Ref: Tools/Demos<17>-Footnote-44745012
Ref: Tools/Demos<17>-Footnote-54745101
Ref: Tools/Demos<17>-Footnote-64745157
Ref: Tools/Demos<17>-Footnote-74745251
Ref: Tools/Demos<17>-Footnote-84745307
Ref: Tools/Demos<17>-Footnote-94745363
Ref: Tools/Demos<17>-Footnote-104745418
Ref: Tools/Demos<17>-Footnote-114745514
Ref: Tools/Demos<17>-Footnote-124745571
Ref: Tools/Demos<17>-Footnote-134745628
Ref: Tools/Demos<17>-Footnote-144745685
Ref: Tools/Demos<17>-Footnote-154745742
Ref: Tools/Demos<17>-Footnote-164745799
Ref: Tools/Demos<17>-Footnote-174745856
Ref: Tools/Demos<17>-Footnote-184745912
Node: C API<24>4746010
Ref: whatsnew/changelog id3034746101
Ref: 1ca84746101
Ref: C API<24>-Footnote-14760937
Ref: C API<24>-Footnote-24760992
Ref: C API<24>-Footnote-34761048
Ref: C API<24>-Footnote-44761104
Ref: C API<24>-Footnote-54761160
Ref: C API<24>-Footnote-64761216
Ref: C API<24>-Footnote-74761272
Ref: C API<24>-Footnote-84761327
Ref: C API<24>-Footnote-94761383
Ref: C API<24>-Footnote-104761439
Ref: C API<24>-Footnote-114761496
Ref: C API<24>-Footnote-124761553
Ref: C API<24>-Footnote-134761610
Ref: C API<24>-Footnote-144761667
Ref: C API<24>-Footnote-154761724
Ref: C API<24>-Footnote-164761781
Ref: C API<24>-Footnote-174761838
Ref: C API<24>-Footnote-184761895
Ref: C API<24>-Footnote-194761952
Ref: C API<24>-Footnote-204762009
Ref: C API<24>-Footnote-214762066
Ref: C API<24>-Footnote-224762123
Ref: C API<24>-Footnote-234762180
Ref: C API<24>-Footnote-244762237
Ref: C API<24>-Footnote-254762294
Ref: C API<24>-Footnote-264762351
Ref: C API<24>-Footnote-274762408
Ref: C API<24>-Footnote-284762465
Ref: C API<24>-Footnote-294762522
Ref: C API<24>-Footnote-304762579
Ref: C API<24>-Footnote-314762636
Ref: C API<24>-Footnote-324762693
Ref: C API<24>-Footnote-334762736
Ref: C API<24>-Footnote-344762793
Ref: C API<24>-Footnote-354762850
Ref: C API<24>-Footnote-364762907
Ref: C API<24>-Footnote-374762964
Ref: C API<24>-Footnote-384763021
Ref: C API<24>-Footnote-394763078
Ref: C API<24>-Footnote-404763135
Ref: C API<24>-Footnote-414763192
Ref: C API<24>-Footnote-424763249
Ref: C API<24>-Footnote-434763306
Ref: C API<24>-Footnote-444763363
Ref: C API<24>-Footnote-454763420
Ref: C API<24>-Footnote-464763477
Ref: C API<24>-Footnote-474763534
Ref: C API<24>-Footnote-484763591
Ref: C API<24>-Footnote-494763648
Ref: C API<24>-Footnote-504763704
Ref: C API<24>-Footnote-514763761
Ref: C API<24>-Footnote-524763818
Ref: C API<24>-Footnote-534763875
Ref: C API<24>-Footnote-544763932
Ref: C API<24>-Footnote-554763989
Ref: C API<24>-Footnote-564764046
Ref: C API<24>-Footnote-574764103
Ref: C API<24>-Footnote-584764160
Ref: C API<24>-Footnote-594764226
Node: Python 3 12 0 beta 14764292
Ref: whatsnew/changelog python-3-12-0-beta-14764421
Ref: 1cb34764421
Node: セキュリティ<21>4764988
Ref: whatsnew/changelog id3044765095
Ref: 1cb44765095
Ref: セキュリティ<21>-Footnote-14765928
Ref: セキュリティ<21>-Footnote-24765983
Ref: セキュリティ<21>-Footnote-34766039
Ref: セキュリティ<21>-Footnote-44766094
Ref: セキュリティ<21>-Footnote-54766150
Node: ライブラリ<70>4766206
Ref: whatsnew/changelog id3054766343
Ref: 1cb54766343
Ref: ライブラリ<70>-Footnote-14766571
Node: Core and Builtins<67>4766627
Ref: whatsnew/changelog id3064766761
Ref: 1cb64766761
Ref: Core and Builtins<67>-Footnote-14773167
Ref: Core and Builtins<67>-Footnote-24773223
Ref: Core and Builtins<67>-Footnote-34773279
Ref: Core and Builtins<67>-Footnote-44773321
Ref: Core and Builtins<67>-Footnote-54773377
Ref: Core and Builtins<67>-Footnote-64773433
Ref: Core and Builtins<67>-Footnote-74773489
Ref: Core and Builtins<67>-Footnote-84773531
Ref: Core and Builtins<67>-Footnote-94773587
Ref: Core and Builtins<67>-Footnote-104773643
Ref: Core and Builtins<67>-Footnote-114773699
Ref: Core and Builtins<67>-Footnote-124773755
Ref: Core and Builtins<67>-Footnote-134773812
Ref: Core and Builtins<67>-Footnote-144773869
Ref: Core and Builtins<67>-Footnote-154773912
Ref: Core and Builtins<67>-Footnote-164773969
Ref: Core and Builtins<67>-Footnote-174774026
Ref: Core and Builtins<67>-Footnote-184774083
Ref: Core and Builtins<67>-Footnote-194774140
Ref: Core and Builtins<67>-Footnote-204774197
Ref: Core and Builtins<67>-Footnote-214774254
Ref: Core and Builtins<67>-Footnote-224774311
Ref: Core and Builtins<67>-Footnote-234774368
Ref: Core and Builtins<67>-Footnote-244774425
Ref: Core and Builtins<67>-Footnote-254774482
Node: ライブラリ<71>4774525
Ref: whatsnew/changelog id3074774661
Ref: 1cb74774661
Ref: ライブラリ<71>-Footnote-14775095
Ref: ライブラリ<71>-Footnote-24775151
Node: Core and Builtins<68>4775207
Ref: whatsnew/changelog id3084775341
Ref: 1cb84775341
Ref: Core and Builtins<68>-Footnote-14779378
Ref: Core and Builtins<68>-Footnote-24779434
Ref: Core and Builtins<68>-Footnote-34779490
Ref: Core and Builtins<68>-Footnote-44779546
Ref: Core and Builtins<68>-Footnote-54779602
Ref: Core and Builtins<68>-Footnote-64779658
Ref: Core and Builtins<68>-Footnote-74779714
Ref: Core and Builtins<68>-Footnote-84779770
Ref: Core and Builtins<68>-Footnote-94779825
Ref: Core and Builtins<68>-Footnote-104779881
Ref: Core and Builtins<68>-Footnote-114779937
Ref: Core and Builtins<68>-Footnote-124779993
Ref: Core and Builtins<68>-Footnote-134780036
Ref: Core and Builtins<68>-Footnote-144780093
Ref: Core and Builtins<68>-Footnote-154780150
Ref: Core and Builtins<68>-Footnote-164780207
Ref: Core and Builtins<68>-Footnote-174780263
Ref: Core and Builtins<68>-Footnote-184780320
Ref: Core and Builtins<68>-Footnote-194780377
Ref: Core and Builtins<68>-Footnote-204780420
Ref: Core and Builtins<68>-Footnote-214780476
Ref: Core and Builtins<68>-Footnote-224780533
Ref: Core and Builtins<68>-Footnote-234780576
Ref: Core and Builtins<68>-Footnote-244780632
Ref: Core and Builtins<68>-Footnote-254780675
Ref: Core and Builtins<68>-Footnote-264780731
Ref: Core and Builtins<68>-Footnote-274780787
Node: ライブラリ<72>4780853
Ref: whatsnew/changelog id3094780990
Ref: 1cb94780990
Ref: ライブラリ<72>-Footnote-14804589
Ref: ライブラリ<72>-Footnote-24804654
Ref: ライブラリ<72>-Footnote-34804710
Ref: ライブラリ<72>-Footnote-44804752
Ref: ライブラリ<72>-Footnote-54804808
Ref: ライブラリ<72>-Footnote-64804864
Ref: ライブラリ<72>-Footnote-74804920
Ref: ライブラリ<72>-Footnote-84804976
Ref: ライブラリ<72>-Footnote-94805031
Ref: ライブラリ<72>-Footnote-104805087
Ref: ライブラリ<72>-Footnote-114805144
Ref: ライブラリ<72>-Footnote-124805201
Ref: ライブラリ<72>-Footnote-134805258
Ref: ライブラリ<72>-Footnote-144805315
Ref: ライブラリ<72>-Footnote-154805372
Ref: ライブラリ<72>-Footnote-164805429
Ref: ライブラリ<72>-Footnote-174805486
Ref: ライブラリ<72>-Footnote-184805562
Ref: ライブラリ<72>-Footnote-194805619
Ref: ライブラリ<72>-Footnote-204805676
Ref: ライブラリ<72>-Footnote-214805732
Ref: ライブラリ<72>-Footnote-224805789
Ref: ライブラリ<72>-Footnote-234805855
Ref: ライブラリ<72>-Footnote-244805912
Ref: ライブラリ<72>-Footnote-254805968
Ref: ライブラリ<72>-Footnote-264806024
Ref: ライブラリ<72>-Footnote-274806081
Ref: ライブラリ<72>-Footnote-284806138
Ref: ライブラリ<72>-Footnote-294806195
Ref: ライブラリ<72>-Footnote-304806252
Ref: ライブラリ<72>-Footnote-314806309
Ref: ライブラリ<72>-Footnote-324806366
Ref: ライブラリ<72>-Footnote-334806423
Ref: ライブラリ<72>-Footnote-344806466
Ref: ライブラリ<72>-Footnote-354806523
Ref: ライブラリ<72>-Footnote-364806580
Ref: ライブラリ<72>-Footnote-374806637
Ref: ライブラリ<72>-Footnote-384806694
Ref: ライブラリ<72>-Footnote-394806750
Ref: ライブラリ<72>-Footnote-404806807
Ref: ライブラリ<72>-Footnote-414806863
Ref: ライブラリ<72>-Footnote-424806920
Ref: ライブラリ<72>-Footnote-434806977
Ref: ライブラリ<72>-Footnote-444807034
Ref: ライブラリ<72>-Footnote-454807091
Ref: ライブラリ<72>-Footnote-464807148
Ref: ライブラリ<72>-Footnote-474807205
Ref: ライブラリ<72>-Footnote-484807261
Ref: ライブラリ<72>-Footnote-494807317
Ref: ライブラリ<72>-Footnote-504807374
Ref: ライブラリ<72>-Footnote-514807431
Ref: ライブラリ<72>-Footnote-524807488
Ref: ライブラリ<72>-Footnote-534807545
Ref: ライブラリ<72>-Footnote-544807601
Ref: ライブラリ<72>-Footnote-554807658
Ref: ライブラリ<72>-Footnote-564807714
Ref: ライブラリ<72>-Footnote-574807771
Ref: ライブラリ<72>-Footnote-584807828
Ref: ライブラリ<72>-Footnote-594807884
Ref: ライブラリ<72>-Footnote-604807940
Ref: ライブラリ<72>-Footnote-614807997
Ref: ライブラリ<72>-Footnote-624808054
Ref: ライブラリ<72>-Footnote-634808110
Ref: ライブラリ<72>-Footnote-644808167
Ref: ライブラリ<72>-Footnote-654808224
Ref: ライブラリ<72>-Footnote-664808281
Ref: ライブラリ<72>-Footnote-674808338
Ref: ライブラリ<72>-Footnote-684808395
Ref: ライブラリ<72>-Footnote-694808452
Ref: ライブラリ<72>-Footnote-704808509
Ref: ライブラリ<72>-Footnote-714808566
Ref: ライブラリ<72>-Footnote-724808623
Ref: ライブラリ<72>-Footnote-734808680
Ref: ライブラリ<72>-Footnote-744808737
Ref: ライブラリ<72>-Footnote-754808794
Ref: ライブラリ<72>-Footnote-764808851
Ref: ライブラリ<72>-Footnote-774808908
Ref: ライブラリ<72>-Footnote-784808965
Ref: ライブラリ<72>-Footnote-794809008
Ref: ライブラリ<72>-Footnote-804809065
Ref: ライブラリ<72>-Footnote-814809122
Ref: ライブラリ<72>-Footnote-824809165
Ref: ライブラリ<72>-Footnote-834809221
Ref: ライブラリ<72>-Footnote-844809277
Ref: ライブラリ<72>-Footnote-854809334
Ref: ライブラリ<72>-Footnote-864809391
Ref: ライブラリ<72>-Footnote-874809448
Ref: ライブラリ<72>-Footnote-884809505
Ref: ライブラリ<72>-Footnote-894809562
Ref: ライブラリ<72>-Footnote-904809605
Ref: ライブラリ<72>-Footnote-914809662
Ref: ライブラリ<72>-Footnote-924809705
Ref: ライブラリ<72>-Footnote-934809761
Ref: ライブラリ<72>-Footnote-944809818
Ref: ライブラリ<72>-Footnote-954809875
Ref: ライブラリ<72>-Footnote-964809918
Ref: ライブラリ<72>-Footnote-974809975
Ref: ライブラリ<72>-Footnote-984810032
Ref: ライブラリ<72>-Footnote-994810089
Ref: ライブラリ<72>-Footnote-1004810145
Ref: ライブラリ<72>-Footnote-1014810203
Ref: ライブラリ<72>-Footnote-1024810261
Ref: ライブラリ<72>-Footnote-1034810319
Ref: ライブラリ<72>-Footnote-1044810377
Ref: ライブラリ<72>-Footnote-1054810435
Ref: ライブラリ<72>-Footnote-1064810493
Ref: ライブラリ<72>-Footnote-1074810550
Ref: ライブラリ<72>-Footnote-1084810607
Ref: ライブラリ<72>-Footnote-1094810665
Ref: ライブラリ<72>-Footnote-1104810709
Ref: ライブラリ<72>-Footnote-1114810766
Ref: ライブラリ<72>-Footnote-1124810824
Ref: ライブラリ<72>-Footnote-1134810882
Ref: ライブラリ<72>-Footnote-1144810939
Ref: ライブラリ<72>-Footnote-1154810996
Ref: ライブラリ<72>-Footnote-1164811053
Ref: ライブラリ<72>-Footnote-1174811111
Ref: ライブラリ<72>-Footnote-1184811169
Ref: ライブラリ<72>-Footnote-1194811226
Ref: ライブラリ<72>-Footnote-1204811283
Ref: ライブラリ<72>-Footnote-1214811340
Ref: ライブラリ<72>-Footnote-1224811397
Ref: ライブラリ<72>-Footnote-1234811454
Ref: ライブラリ<72>-Footnote-1244811511
Ref: ライブラリ<72>-Footnote-1254811568
Ref: ライブラリ<72>-Footnote-1264811625
Ref: ライブラリ<72>-Footnote-1274811682
Ref: ライブラリ<72>-Footnote-1284811739
Ref: ライブラリ<72>-Footnote-1294811796
Ref: ライブラリ<72>-Footnote-1304811853
Ref: ライブラリ<72>-Footnote-1314811910
Ref: ライブラリ<72>-Footnote-1324811967
Ref: ライブラリ<72>-Footnote-1334812024
Ref: ライブラリ<72>-Footnote-1344812091
Ref: ライブラリ<72>-Footnote-1354812158
Ref: ライブラリ<72>-Footnote-1364812225
Ref: ライブラリ<72>-Footnote-1374812292
Ref: ライブラリ<72>-Footnote-1384812359
Ref: ライブラリ<72>-Footnote-1394812426
Ref: ライブラリ<72>-Footnote-1404812493
Node: ドキュメント<21>4812560
Ref: whatsnew/changelog id3104812689
Ref: 1cc24812689
Ref: ドキュメント<21>-Footnote-14813466
Ref: ドキュメント<21>-Footnote-24813521
Ref: ドキュメント<21>-Footnote-34813577
Ref: ドキュメント<21>-Footnote-44813619
Ref: ドキュメント<21>-Footnote-54813674
Ref: ドキュメント<21>-Footnote-64813729
Node: テスト<25>4813784
Ref: whatsnew/changelog id3114813907
Ref: 1cc34813907
Ref: テスト<25>-Footnote-14814819
Ref: テスト<25>-Footnote-24814875
Ref: テスト<25>-Footnote-34814931
Ref: テスト<25>-Footnote-44814986
Ref: テスト<25>-Footnote-54815042
Ref: テスト<25>-Footnote-64815098
Node: ビルド<24>4815153
Ref: whatsnew/changelog id3124815265
Ref: 1cc44815265
Ref: ビルド<24>-Footnote-14816854
Ref: ビルド<24>-Footnote-24816910
Ref: ビルド<24>-Footnote-34816965
Ref: ビルド<24>-Footnote-44817021
Ref: ビルド<24>-Footnote-54817077
Ref: ビルド<24>-Footnote-64817133
Ref: ビルド<24>-Footnote-74817188
Ref: ビルド<24>-Footnote-84817243
Ref: ビルド<24>-Footnote-94817299
Node: Windows<22>4817354
Ref: whatsnew/changelog id3134817462
Ref: 1cc54817462
Ref: Windows<22>-Footnote-14818317
Ref: Windows<22>-Footnote-24818373
Ref: Windows<22>-Footnote-34818428
Ref: Windows<22>-Footnote-44818484
Ref: Windows<22>-Footnote-54818540
Ref: Windows<22>-Footnote-64818596
Node: macOS<16>4818651
Ref: whatsnew/changelog id3144818754
Ref: 1cc64818754
Ref: macOS<16>-Footnote-14819558
Ref: macOS<16>-Footnote-24819613
Ref: macOS<16>-Footnote-34819669
Ref: macOS<16>-Footnote-44819725
Ref: macOS<16>-Footnote-54819781
Ref: macOS<16>-Footnote-64819836
Node: IDLE<15>4819892
Ref: whatsnew/changelog id3154819999
Ref: 1cc74819999
Ref: IDLE<15>-Footnote-14820283
Ref: IDLE<15>-Footnote-24820339
Ref: IDLE<15>-Footnote-34820395
Node: Tools/Demos<18>4820450
Ref: whatsnew/changelog id3164820557
Ref: 1cc84820557
Ref: Tools/Demos<18>-Footnote-14820817
Node: C API<25>4820873
Ref: whatsnew/changelog id3174820963
Ref: 1cc94820963
Ref: C API<25>-Footnote-14823951
Ref: C API<25>-Footnote-24824007
Ref: C API<25>-Footnote-34824063
Ref: C API<25>-Footnote-44824119
Ref: C API<25>-Footnote-54824175
Ref: C API<25>-Footnote-64824231
Ref: C API<25>-Footnote-74824287
Ref: C API<25>-Footnote-84824329
Ref: C API<25>-Footnote-94824385
Ref: C API<25>-Footnote-104824441
Ref: C API<25>-Footnote-114824497
Node: Python 3 12 0 alpha 74824553
Ref: whatsnew/changelog python-3-12-0-alpha-74824682
Ref: 1cd04824682
Node: Core and Builtins<69>4825199
Ref: whatsnew/changelog id3184825306
Ref: 1cd14825306
Ref: Core and Builtins<69>-Footnote-14826634
Ref: Core and Builtins<69>-Footnote-24826690
Ref: Core and Builtins<69>-Footnote-34826745
Ref: Core and Builtins<69>-Footnote-44826801
Ref: Core and Builtins<69>-Footnote-54826857
Ref: Core and Builtins<69>-Footnote-64826913
Ref: Core and Builtins<69>-Footnote-74826969
Ref: Core and Builtins<69>-Footnote-84827025
Ref: Core and Builtins<69>-Footnote-94827081
Ref: Core and Builtins<69>-Footnote-104827137
Node: ライブラリ<73>4827193
Ref: whatsnew/changelog id3194827330
Ref: 1cd24827330
Ref: ライブラリ<73>-Footnote-14827648
Node: Core and Builtins<70>4827704
Ref: whatsnew/changelog id3204827833
Ref: 1cd34827833
Ref: Core and Builtins<70>-Footnote-14829153
Ref: Core and Builtins<70>-Footnote-24829209
Ref: Core and Builtins<70>-Footnote-34829265
Ref: Core and Builtins<70>-Footnote-44829321
Ref: Core and Builtins<70>-Footnote-54829363
Ref: Core and Builtins<70>-Footnote-64829419
Ref: Core and Builtins<70>-Footnote-74829475
Ref: Core and Builtins<70>-Footnote-84829531
Node: ビルド<25>4829587
Ref: whatsnew/changelog id3214829718
Ref: 1cd44829718
Ref: ビルド<25>-Footnote-14829903
Node: Core and Builtins<71>4829959
Ref: whatsnew/changelog id3224830088
Ref: 1cd54830088
Ref: Core and Builtins<71>-Footnote-14830288
Node: ライブラリ<74>4830344
Ref: whatsnew/changelog id3234830482
Ref: 1cd64830482
Ref: ライブラリ<74>-Footnote-14838422
Ref: ライブラリ<74>-Footnote-24838489
Ref: ライブラリ<74>-Footnote-34838531
Ref: ライブラリ<74>-Footnote-44838587
Ref: ライブラリ<74>-Footnote-54838643
Ref: ライブラリ<74>-Footnote-64838699
Ref: ライブラリ<74>-Footnote-74838755
Ref: ライブラリ<74>-Footnote-84838811
Ref: ライブラリ<74>-Footnote-94838867
Ref: ライブラリ<74>-Footnote-104838923
Ref: ライブラリ<74>-Footnote-114838980
Ref: ライブラリ<74>-Footnote-124839037
Ref: ライブラリ<74>-Footnote-134839094
Ref: ライブラリ<74>-Footnote-144839151
Ref: ライブラリ<74>-Footnote-154839208
Ref: ライブラリ<74>-Footnote-164839264
Ref: ライブラリ<74>-Footnote-174839320
Ref: ライブラリ<74>-Footnote-184839376
Ref: ライブラリ<74>-Footnote-194839433
Ref: ライブラリ<74>-Footnote-204839490
Ref: ライブラリ<74>-Footnote-214839547
Ref: ライブラリ<74>-Footnote-224839604
Ref: ライブラリ<74>-Footnote-234839661
Ref: ライブラリ<74>-Footnote-244839718
Ref: ライブラリ<74>-Footnote-254839774
Ref: ライブラリ<74>-Footnote-264839831
Ref: ライブラリ<74>-Footnote-274839887
Ref: ライブラリ<74>-Footnote-284839944
Ref: ライブラリ<74>-Footnote-294840001
Ref: ライブラリ<74>-Footnote-304840058
Ref: ライブラリ<74>-Footnote-314840114
Ref: ライブラリ<74>-Footnote-324840171
Ref: ライブラリ<74>-Footnote-334840228
Ref: ライブラリ<74>-Footnote-344840285
Ref: ライブラリ<74>-Footnote-354840341
Ref: ライブラリ<74>-Footnote-364840398
Ref: ライブラリ<74>-Footnote-374840454
Ref: ライブラリ<74>-Footnote-384840510
Ref: ライブラリ<74>-Footnote-394840566
Ref: ライブラリ<74>-Footnote-404840622
Ref: ライブラリ<74>-Footnote-414840678
Ref: ライブラリ<74>-Footnote-424840734
Ref: ライブラリ<74>-Footnote-434840790
Node: ドキュメント<22>4840856
Ref: whatsnew/changelog id3244840986
Ref: 1cda4840986
Ref: ドキュメント<22>-Footnote-14841189
Node: テスト<26>4841245
Ref: whatsnew/changelog id3254841369
Ref: 1cdb4841369
Ref: テスト<26>-Footnote-14841731
Ref: テスト<26>-Footnote-24841787
Ref: テスト<26>-Footnote-34841843
Node: ビルド<26>4841899
Ref: whatsnew/changelog id3264842012
Ref: 1cdc4842012
Ref: ビルド<26>-Footnote-14842263
Ref: ビルド<26>-Footnote-24842319
Node: Windows<23>4842375
Ref: whatsnew/changelog id3274842490
Ref: 1cdd4842490
Ref: Windows<23>-Footnote-14842790
Ref: Windows<23>-Footnote-24842846
Node: Tools/Demos<19>4842901
Ref: whatsnew/changelog id3284843012
Ref: 1cde4843012
Ref: Tools/Demos<19>-Footnote-14843147
Node: C API<26>4843203
Ref: whatsnew/changelog id3294843294
Ref: 1cdf4843294
Ref: C API<26>-Footnote-14843510
Node: Python 3 12 0 alpha 64843566
Ref: whatsnew/changelog python-3-12-0-alpha-64843696
Ref: 1ce04843696
Node: セキュリティ<22>4844091
Ref: whatsnew/changelog id3304844201
Ref: 1ce14844201
Ref: セキュリティ<22>-Footnote-14845153
Ref: セキュリティ<22>-Footnote-24845208
Ref: セキュリティ<22>-Footnote-34845264
Ref: セキュリティ<22>-Footnote-44845319
Ref: セキュリティ<22>-Footnote-54845374
Ref: セキュリティ<22>-Footnote-64845429
Ref: セキュリティ<22>-Footnote-74845490
Ref: セキュリティ<22>-Footnote-84845545
Ref: セキュリティ<22>-Footnote-94845593
Node: Core and Builtins<72>4845649
Ref: whatsnew/changelog id3314845787
Ref: 1ce24845787
Ref: Core and Builtins<72>-Footnote-14849416
Ref: Core and Builtins<72>-Footnote-24849472
Ref: Core and Builtins<72>-Footnote-34849528
Ref: Core and Builtins<72>-Footnote-44849584
Ref: Core and Builtins<72>-Footnote-54849640
Ref: Core and Builtins<72>-Footnote-64849696
Ref: Core and Builtins<72>-Footnote-74849752
Ref: Core and Builtins<72>-Footnote-84849808
Ref: Core and Builtins<72>-Footnote-94849864
Ref: Core and Builtins<72>-Footnote-104849920
Ref: Core and Builtins<72>-Footnote-114849977
Ref: Core and Builtins<72>-Footnote-124850034
Ref: Core and Builtins<72>-Footnote-134850090
Ref: Core and Builtins<72>-Footnote-144850147
Ref: Core and Builtins<72>-Footnote-154850204
Ref: Core and Builtins<72>-Footnote-164850260
Ref: Core and Builtins<72>-Footnote-174850316
Ref: Core and Builtins<72>-Footnote-184850373
Ref: Core and Builtins<72>-Footnote-194850430
Ref: Core and Builtins<72>-Footnote-204850487
Ref: Core and Builtins<72>-Footnote-214850544
Ref: Core and Builtins<72>-Footnote-224850601
Node: ライブラリ<75>4850657
Ref: whatsnew/changelog id3324850795
Ref: 1ce54850795
Ref: ライブラリ<75>-Footnote-14856614
Ref: ライブラリ<75>-Footnote-24856670
Ref: ライブラリ<75>-Footnote-34856726
Ref: ライブラリ<75>-Footnote-44856781
Ref: ライブラリ<75>-Footnote-54856836
Ref: ライブラリ<75>-Footnote-64856892
Ref: ライブラリ<75>-Footnote-74856948
Ref: ライブラリ<75>-Footnote-84857004
Ref: ライブラリ<75>-Footnote-94857060
Ref: ライブラリ<75>-Footnote-104857127
Ref: ライブラリ<75>-Footnote-114857183
Ref: ライブラリ<75>-Footnote-124857267
Ref: ライブラリ<75>-Footnote-134857324
Ref: ライブラリ<75>-Footnote-144857380
Ref: ライブラリ<75>-Footnote-154857437
Ref: ライブラリ<75>-Footnote-164857493
Ref: ライブラリ<75>-Footnote-174857549
Ref: ライブラリ<75>-Footnote-184857606
Ref: ライブラリ<75>-Footnote-194857663
Ref: ライブラリ<75>-Footnote-204857720
Ref: ライブラリ<75>-Footnote-214857777
Ref: ライブラリ<75>-Footnote-224857834
Ref: ライブラリ<75>-Footnote-234857891
Ref: ライブラリ<75>-Footnote-244857948
Ref: ライブラリ<75>-Footnote-254858004
Ref: ライブラリ<75>-Footnote-264858061
Ref: ライブラリ<75>-Footnote-274858104
Ref: ライブラリ<75>-Footnote-284858160
Ref: ライブラリ<75>-Footnote-294858217
Ref: ライブラリ<75>-Footnote-304858274
Ref: ライブラリ<75>-Footnote-314858317
Ref: ライブラリ<75>-Footnote-324858374
Ref: ライブラリ<75>-Footnote-334858430
Ref: ライブラリ<75>-Footnote-344858473
Ref: ライブラリ<75>-Footnote-354858529
Ref: ライブラリ<75>-Footnote-364858585
Node: ドキュメント<23>4858651
Ref: whatsnew/changelog id3334858781
Ref: 1ced4858781
Ref: ドキュメント<23>-Footnote-14859094
Ref: ドキュメント<23>-Footnote-24859149
Node: テスト<27>4859204
Ref: whatsnew/changelog id3344859328
Ref: 1cef4859328
Ref: テスト<27>-Footnote-14859905
Ref: テスト<27>-Footnote-24859961
Ref: テスト<27>-Footnote-34860016
Node: ビルド<27>4860071
Ref: whatsnew/changelog id3354860184
Ref: 1cf04860184
Ref: ビルド<27>-Footnote-14860868
Ref: ビルド<27>-Footnote-24860923
Ref: ビルド<27>-Footnote-34860978
Ref: ビルド<27>-Footnote-44861034
Node: Windows<24>4861089
Ref: whatsnew/changelog id3364861198
Ref: 1cf24861198
Ref: Windows<24>-Footnote-14862217
Ref: Windows<24>-Footnote-24862273
Ref: Windows<24>-Footnote-34862329
Ref: Windows<24>-Footnote-44862385
Ref: Windows<24>-Footnote-54862441
Ref: Windows<24>-Footnote-64862497
Ref: Windows<24>-Footnote-74862553
Ref: Windows<24>-Footnote-84862609
Node: macOS<17>4862665
Ref: whatsnew/changelog id3374862770
Ref: 1cf34862770
Ref: macOS<17>-Footnote-14862900
Node: C API<27>4862956
Ref: whatsnew/changelog id3384863041
Ref: 1cf44863041
Ref: C API<27>-Footnote-14864136
Ref: C API<27>-Footnote-24864192
Ref: C API<27>-Footnote-34864247
Ref: C API<27>-Footnote-44864303
Ref: C API<27>-Footnote-54864358
Node: Python 3 12 0 alpha 54864400
Ref: whatsnew/changelog python-3-12-0-alpha-54864530
Ref: 1cf54864530
Node: セキュリティ<23>4864885
Ref: whatsnew/changelog id3394864995
Ref: 1cf64864995
Ref: セキュリティ<23>-Footnote-14865387
Ref: セキュリティ<23>-Footnote-24865442
Node: Core and Builtins<73>4865490
Ref: whatsnew/changelog id3414865628
Ref: 1cf74865628
Ref: Core and Builtins<73>-Footnote-14868525
Ref: Core and Builtins<73>-Footnote-24868580
Ref: Core and Builtins<73>-Footnote-34868635
Ref: Core and Builtins<73>-Footnote-44868691
Ref: Core and Builtins<73>-Footnote-54868747
Ref: Core and Builtins<73>-Footnote-64868803
Ref: Core and Builtins<73>-Footnote-74868859
Ref: Core and Builtins<73>-Footnote-84868915
Ref: Core and Builtins<73>-Footnote-94868971
Ref: Core and Builtins<73>-Footnote-104869027
Ref: Core and Builtins<73>-Footnote-114869084
Ref: Core and Builtins<73>-Footnote-124869141
Ref: Core and Builtins<73>-Footnote-134869198
Ref: Core and Builtins<73>-Footnote-144869255
Ref: Core and Builtins<73>-Footnote-154869311
Ref: Core and Builtins<73>-Footnote-164869368
Node: ライブラリ<76>4869425
Ref: whatsnew/changelog id3424869563
Ref: 1cfa4869563
Ref: ライブラリ<76>-Footnote-14874821
Ref: ライブラリ<76>-Footnote-24874886
Ref: ライブラリ<76>-Footnote-34874942
Ref: ライブラリ<76>-Footnote-44874998
Ref: ライブラリ<76>-Footnote-54875054
Ref: ライブラリ<76>-Footnote-64875110
Ref: ライブラリ<76>-Footnote-74875166
Ref: ライブラリ<76>-Footnote-84875221
Ref: ライブラリ<76>-Footnote-94875263
Ref: ライブラリ<76>-Footnote-104875319
Ref: ライブラリ<76>-Footnote-114875376
Ref: ライブラリ<76>-Footnote-124875433
Ref: ライブラリ<76>-Footnote-134875489
Ref: ライブラリ<76>-Footnote-144875546
Ref: ライブラリ<76>-Footnote-154875603
Ref: ライブラリ<76>-Footnote-164875660
Ref: ライブラリ<76>-Footnote-174875716
Ref: ライブラリ<76>-Footnote-184875773
Ref: ライブラリ<76>-Footnote-194875830
Ref: ライブラリ<76>-Footnote-204875886
Ref: ライブラリ<76>-Footnote-214875942
Ref: ライブラリ<76>-Footnote-224875998
Ref: ライブラリ<76>-Footnote-234876054
Ref: ライブラリ<76>-Footnote-244876110
Ref: ライブラリ<76>-Footnote-254876166
Ref: ライブラリ<76>-Footnote-264876222
Ref: ライブラリ<76>-Footnote-274876278
Ref: ライブラリ<76>-Footnote-284876344
Ref: ライブラリ<76>-Footnote-294876410
Ref: ライブラリ<76>-Footnote-304876476
Node: ドキュメント<24>4876532
Ref: whatsnew/changelog id3434876662
Ref: 1d034876662
Ref: ドキュメント<24>-Footnote-14876951
Node: テスト<28>4877006
Ref: whatsnew/changelog id3444877130
Ref: 1d044877130
Ref: テスト<28>-Footnote-14877297
Node: ビルド<28>4877353
Ref: whatsnew/changelog id3454877466
Ref: 1d054877466
Ref: ビルド<28>-Footnote-14878910
Ref: ビルド<28>-Footnote-24878966
Ref: ビルド<28>-Footnote-34879022
Ref: ビルド<28>-Footnote-44879077
Ref: ビルド<28>-Footnote-54879133
Ref: ビルド<28>-Footnote-64879175
Ref: ビルド<28>-Footnote-74879231
Ref: ビルド<28>-Footnote-84879287
Ref: ビルド<28>-Footnote-94879342
Ref: ビルド<28>-Footnote-104879397
Node: Windows<25>4879453
Ref: whatsnew/changelog id3464879544
Ref: 1d064879544
Ref: Windows<25>-Footnote-14880794
Ref: Windows<25>-Footnote-24880850
Ref: Windows<25>-Footnote-34880906
Ref: Windows<25>-Footnote-44880961
Ref: Windows<25>-Footnote-54881017
Ref: Windows<25>-Footnote-64881072
Ref: Windows<25>-Footnote-74881128
Node: Python 3 12 0 alpha 44881184
Ref: whatsnew/changelog python-3-12-0-alpha-44881314
Ref: 1d074881314
Node: Core and Builtins<74>4881863
Ref: whatsnew/changelog id3474881970
Ref: 1d084881970
Ref: Core and Builtins<74>-Footnote-14883866
Ref: Core and Builtins<74>-Footnote-24883922
Ref: Core and Builtins<74>-Footnote-34883977
Ref: Core and Builtins<74>-Footnote-44884032
Ref: Core and Builtins<74>-Footnote-54884088
Ref: Core and Builtins<74>-Footnote-64884144
Ref: Core and Builtins<74>-Footnote-74884200
Ref: Core and Builtins<74>-Footnote-84884256
Ref: Core and Builtins<74>-Footnote-94884312
Ref: Core and Builtins<74>-Footnote-104884368
Ref: Core and Builtins<74>-Footnote-114884424
Ref: Core and Builtins<74>-Footnote-124884467
Ref: Core and Builtins<74>-Footnote-134884524
Node: ライブラリ<77>4884581
Ref: whatsnew/changelog id3484884718
Ref: 1d0a4884718
Ref: ライブラリ<77>-Footnote-14884918
Node: Core and Builtins<75>4884974
Ref: whatsnew/changelog id3494885109
Ref: 1d0c4885109
Ref: Core and Builtins<75>-Footnote-14887842
Ref: Core and Builtins<75>-Footnote-24887898
Ref: Core and Builtins<75>-Footnote-34887954
Ref: Core and Builtins<75>-Footnote-44888009
Ref: Core and Builtins<75>-Footnote-54888065
Ref: Core and Builtins<75>-Footnote-64888120
Ref: Core and Builtins<75>-Footnote-74888176
Ref: Core and Builtins<75>-Footnote-84888231
Ref: Core and Builtins<75>-Footnote-94888286
Ref: Core and Builtins<75>-Footnote-104888341
Ref: Core and Builtins<75>-Footnote-114888398
Ref: Core and Builtins<75>-Footnote-124888455
Ref: Core and Builtins<75>-Footnote-134888512
Ref: Core and Builtins<75>-Footnote-144888569
Ref: Core and Builtins<75>-Footnote-154888625
Ref: Core and Builtins<75>-Footnote-164888681
Ref: Core and Builtins<75>-Footnote-174888737
Ref: Core and Builtins<75>-Footnote-184888793
Node: ライブラリ<78>4888849
Ref: whatsnew/changelog id3504888986
Ref: 1d0e4888986
Ref: ライブラリ<78>-Footnote-14889135
Node: Core and Builtins<76>4889190
Ref: whatsnew/changelog id3514889325
Ref: 1d104889325
Ref: Core and Builtins<76>-Footnote-14889600
Node: ライブラリ<79>4889665
Ref: whatsnew/changelog id3524889803
Ref: 1d114889803
Ref: ライブラリ<79>-Footnote-14900081
Ref: ライブラリ<79>-Footnote-24900137
Ref: ライブラリ<79>-Footnote-34900193
Ref: ライブラリ<79>-Footnote-44900249
Ref: ライブラリ<79>-Footnote-54900305
Ref: ライブラリ<79>-Footnote-64900360
Ref: ライブラリ<79>-Footnote-74900415
Ref: ライブラリ<79>-Footnote-84900471
Ref: ライブラリ<79>-Footnote-94900527
Ref: ライブラリ<79>-Footnote-104900582
Ref: ライブラリ<79>-Footnote-114900639
Ref: ライブラリ<79>-Footnote-124900695
Ref: ライブラリ<79>-Footnote-134900752
Ref: ライブラリ<79>-Footnote-144900808
Ref: ライブラリ<79>-Footnote-154900864
Ref: ライブラリ<79>-Footnote-164900921
Ref: ライブラリ<79>-Footnote-174900978
Ref: ライブラリ<79>-Footnote-184901035
Ref: ライブラリ<79>-Footnote-194901092
Ref: ライブラリ<79>-Footnote-204901149
Ref: ライブラリ<79>-Footnote-214901206
Ref: ライブラリ<79>-Footnote-224901263
Ref: ライブラリ<79>-Footnote-234901319
Ref: ライブラリ<79>-Footnote-244901376
Ref: ライブラリ<79>-Footnote-254901433
Ref: ライブラリ<79>-Footnote-264901490
Ref: ライブラリ<79>-Footnote-274901546
Ref: ライブラリ<79>-Footnote-284901603
Ref: ライブラリ<79>-Footnote-294901660
Ref: ライブラリ<79>-Footnote-304901717
Ref: ライブラリ<79>-Footnote-314901774
Ref: ライブラリ<79>-Footnote-324901840
Ref: ライブラリ<79>-Footnote-334901897
Ref: ライブラリ<79>-Footnote-344901953
Ref: ライブラリ<79>-Footnote-354902009
Ref: ライブラリ<79>-Footnote-364902065
Ref: ライブラリ<79>-Footnote-374902121
Ref: ライブラリ<79>-Footnote-384902177
Ref: ライブラリ<79>-Footnote-394902233
Ref: ライブラリ<79>-Footnote-404902289
Ref: ライブラリ<79>-Footnote-414902345
Ref: ライブラリ<79>-Footnote-424902401
Ref: ライブラリ<79>-Footnote-434902444
Ref: ライブラリ<79>-Footnote-444902500
Ref: ライブラリ<79>-Footnote-454902556
Ref: ライブラリ<79>-Footnote-464902612
Ref: ライブラリ<79>-Footnote-474902668
Ref: ライブラリ<79>-Footnote-484902724
Ref: ライブラリ<79>-Footnote-494902780
Ref: ライブラリ<79>-Footnote-504902836
Ref: ライブラリ<79>-Footnote-514902892
Ref: ライブラリ<79>-Footnote-524902948
Ref: ライブラリ<79>-Footnote-534903004
Ref: ライブラリ<79>-Footnote-544903060
Ref: ライブラリ<79>-Footnote-554903126
Ref: ライブラリ<79>-Footnote-564903192
Node: ドキュメント<25>4903258
Ref: whatsnew/changelog id3534903388
Ref: 1d1b4903388
Ref: ドキュメント<25>-Footnote-14903976
Ref: ドキュメント<25>-Footnote-24904032
Ref: ドキュメント<25>-Footnote-34904088
Node: テスト<29>4904153
Ref: whatsnew/changelog id3544904277
Ref: 1d1d4904277
Ref: テスト<29>-Footnote-14904729
Ref: テスト<29>-Footnote-24904785
Ref: テスト<29>-Footnote-34904841
Node: ビルド<29>4904896
Ref: whatsnew/changelog id3554905009
Ref: 1d1e4905009
Ref: ビルド<29>-Footnote-14905901
Ref: ビルド<29>-Footnote-24905957
Ref: ビルド<29>-Footnote-34906012
Node: Windows<26>4906077
Ref: whatsnew/changelog id3564906186
Ref: 1d1f4906186
Ref: Windows<26>-Footnote-14907113
Ref: Windows<26>-Footnote-24907169
Ref: Windows<26>-Footnote-34907224
Ref: Windows<26>-Footnote-44907279
Ref: Windows<26>-Footnote-54907334
Ref: Windows<26>-Footnote-64907399
Node: macOS<18>4907464
Ref: whatsnew/changelog id3574907575
Ref: 1d224907575
Ref: macOS<18>-Footnote-14907859
Ref: macOS<18>-Footnote-24907915
Node: Tools/Demos<20>4907971
Ref: whatsnew/changelog id3584908080
Ref: 1d234908080
Ref: Tools/Demos<20>-Footnote-14908456
Ref: Tools/Demos<20>-Footnote-24908521
Node: C API<28>4908577
Ref: whatsnew/changelog id3594908668
Ref: 1d244908668
Ref: C API<28>-Footnote-14909237
Ref: C API<28>-Footnote-24909292
Ref: C API<28>-Footnote-34909347
Node: Python 3 12 0 alpha 34909402
Ref: whatsnew/changelog python-3-12-0-alpha-34909532
Ref: 1d254909532
Node: セキュリティ<24>4910046
Ref: whatsnew/changelog id3604910156
Ref: 1d264910156
Ref: セキュリティ<24>-Footnote-14910730
Ref: セキュリティ<24>-Footnote-24910786
Node: Core and Builtins<77>4910841
Ref: whatsnew/changelog id3614910979
Ref: 1d274910979
Ref: Core and Builtins<77>-Footnote-14912299
Ref: Core and Builtins<77>-Footnote-24912354
Ref: Core and Builtins<77>-Footnote-34912409
Ref: Core and Builtins<77>-Footnote-44912464
Ref: Core and Builtins<77>-Footnote-54912519
Ref: Core and Builtins<77>-Footnote-64912574
Ref: Core and Builtins<77>-Footnote-74912629
Node: ライブラリ<80>4912684
Ref: whatsnew/changelog id3624912821
Ref: 1d284912821
Ref: ライブラリ<80>-Footnote-14913167
Ref: ライブラリ<80>-Footnote-24913222
Node: Core and Builtins<78>4913277
Ref: whatsnew/changelog id3634913412
Ref: 1d294913412
Ref: Core and Builtins<78>-Footnote-14915217
Ref: Core and Builtins<78>-Footnote-24915272
Ref: Core and Builtins<78>-Footnote-34915327
Ref: Core and Builtins<78>-Footnote-44915382
Ref: Core and Builtins<78>-Footnote-54915437
Ref: Core and Builtins<78>-Footnote-64915492
Ref: Core and Builtins<78>-Footnote-74915547
Ref: Core and Builtins<78>-Footnote-84915612
Ref: Core and Builtins<78>-Footnote-94915677
Node: ライブラリ<81>4915742
Ref: whatsnew/changelog id3644915880
Ref: 1d2a4915880
Ref: ライブラリ<81>-Footnote-14922134
Ref: ライブラリ<81>-Footnote-24922190
Ref: ライブラリ<81>-Footnote-34922245
Ref: ライブラリ<81>-Footnote-44922300
Ref: ライブラリ<81>-Footnote-54922355
Ref: ライブラリ<81>-Footnote-64922410
Ref: ライブラリ<81>-Footnote-74922465
Ref: ライブラリ<81>-Footnote-84922520
Ref: ライブラリ<81>-Footnote-94922575
Ref: ライブラリ<81>-Footnote-104922630
Ref: ライブラリ<81>-Footnote-114922686
Ref: ライブラリ<81>-Footnote-124922742
Ref: ライブラリ<81>-Footnote-134922798
Ref: ライブラリ<81>-Footnote-144922854
Ref: ライブラリ<81>-Footnote-154922910
Ref: ライブラリ<81>-Footnote-164922966
Ref: ライブラリ<81>-Footnote-174923022
Ref: ライブラリ<81>-Footnote-184923078
Ref: ライブラリ<81>-Footnote-194923134
Ref: ライブラリ<81>-Footnote-204923190
Ref: ライブラリ<81>-Footnote-214923246
Ref: ライブラリ<81>-Footnote-224923302
Ref: ライブラリ<81>-Footnote-234923358
Ref: ライブラリ<81>-Footnote-244923414
Ref: ライブラリ<81>-Footnote-254923470
Ref: ライブラリ<81>-Footnote-264923526
Ref: ライブラリ<81>-Footnote-274923582
Ref: ライブラリ<81>-Footnote-284923638
Ref: ライブラリ<81>-Footnote-294923694
Ref: ライブラリ<81>-Footnote-304923750
Ref: ライブラリ<81>-Footnote-314923806
Ref: ライブラリ<81>-Footnote-324923872
Ref: ライブラリ<81>-Footnote-334923938
Ref: ライブラリ<81>-Footnote-344924004
Node: ドキュメント<26>4924070
Ref: whatsnew/changelog id3654924200
Ref: 1d2d4924200
Ref: ドキュメント<26>-Footnote-14924975
Ref: ドキュメント<26>-Footnote-24925030
Ref: ドキュメント<26>-Footnote-34925082
Ref: ドキュメント<26>-Footnote-44925106
Ref: ドキュメント<26>-Footnote-54925161
Ref: ドキュメント<26>-Footnote-64925216
Ref: ドキュメント<26>-Footnote-74925271
Node: テスト<30>4925336
Ref: whatsnew/changelog id3664925460
Ref: 1d2e4925460
Ref: テスト<30>-Footnote-14926240
Ref: テスト<30>-Footnote-24926295
Ref: テスト<30>-Footnote-34926350
Ref: テスト<30>-Footnote-44926405
Ref: テスト<30>-Footnote-54926460
Ref: テスト<30>-Footnote-64926515
Node: ビルド<30>4926570
Ref: whatsnew/changelog id3674926683
Ref: 1d2f4926683
Ref: ビルド<30>-Footnote-14927652
Ref: ビルド<30>-Footnote-24927707
Ref: ビルド<30>-Footnote-34927762
Ref: ビルド<30>-Footnote-44927817
Ref: ビルド<30>-Footnote-54927872
Node: Windows<27>4927927
Ref: whatsnew/changelog id3684928036
Ref: 1d304928036
Ref: Windows<27>-Footnote-14928565
Ref: Windows<27>-Footnote-24928620
Ref: Windows<27>-Footnote-34928675
Ref: Windows<27>-Footnote-44928730
Node: macOS<19>4928795
Ref: whatsnew/changelog id3694928906
Ref: 1d314928906
Ref: macOS<19>-Footnote-14929176
Ref: macOS<19>-Footnote-24929231
Node: Tools/Demos<21>4929286
Ref: whatsnew/changelog id3704929395
Ref: 1d324929395
Ref: Tools/Demos<21>-Footnote-14929887
Node: C API<29>4929942
Ref: whatsnew/changelog id3714930033
Ref: 1d334930033
Ref: C API<29>-Footnote-14930854
Ref: C API<29>-Footnote-24930909
Ref: C API<29>-Footnote-34930964
Node: Python 3 12 0 alpha 24931019
Ref: whatsnew/changelog python-3-12-0-alpha-24931149
Ref: 1d354931149
Node: セキュリティ<25>4931616
Ref: whatsnew/changelog id3724931726
Ref: 1d364931726
Ref: セキュリティ<25>-Footnote-14932869
Ref: セキュリティ<25>-Footnote-24932924
Ref: セキュリティ<25>-Footnote-34932983
Ref: セキュリティ<25>-Footnote-44933042
Ref: セキュリティ<25>-Footnote-54933101
Node: Core and Builtins<79>4933156
Ref: whatsnew/changelog id3734933288
Ref: 1d374933288
Ref: Core and Builtins<79>-Footnote-14939989
Ref: Core and Builtins<79>-Footnote-24940044
Ref: Core and Builtins<79>-Footnote-34940099
Ref: Core and Builtins<79>-Footnote-44940154
Ref: Core and Builtins<79>-Footnote-54940209
Ref: Core and Builtins<79>-Footnote-64940264
Ref: Core and Builtins<79>-Footnote-74940319
Ref: Core and Builtins<79>-Footnote-84940374
Ref: Core and Builtins<79>-Footnote-94940429
Ref: Core and Builtins<79>-Footnote-104940484
Ref: Core and Builtins<79>-Footnote-114940540
Ref: Core and Builtins<79>-Footnote-124940596
Ref: Core and Builtins<79>-Footnote-134940652
Ref: Core and Builtins<79>-Footnote-144940708
Ref: Core and Builtins<79>-Footnote-154940764
Ref: Core and Builtins<79>-Footnote-164940820
Ref: Core and Builtins<79>-Footnote-174940876
Ref: Core and Builtins<79>-Footnote-184940932
Ref: Core and Builtins<79>-Footnote-194940988
Ref: Core and Builtins<79>-Footnote-204941044
Ref: Core and Builtins<79>-Footnote-214941100
Ref: Core and Builtins<79>-Footnote-224941156
Ref: Core and Builtins<79>-Footnote-234941212
Ref: Core and Builtins<79>-Footnote-244941268
Ref: Core and Builtins<79>-Footnote-254941311
Ref: Core and Builtins<79>-Footnote-264941367
Ref: Core and Builtins<79>-Footnote-274941423
Node: ビルド<31>4941479
Ref: whatsnew/changelog id3744941610
Ref: 1d3e4941610
Ref: ビルド<31>-Footnote-14941800
Node: Core and Builtins<80>4941855
Ref: whatsnew/changelog id3754941984
Ref: 1d3f4941984
Ref: Core and Builtins<80>-Footnote-14943121
Ref: Core and Builtins<80>-Footnote-24943176
Ref: Core and Builtins<80>-Footnote-34943231
Ref: Core and Builtins<80>-Footnote-44943286
Ref: Core and Builtins<80>-Footnote-54943341
Ref: Core and Builtins<80>-Footnote-64943396
Node: ライブラリ<82>4943451
Ref: whatsnew/changelog id3764943589
Ref: 1d424943589
Ref: ライブラリ<82>-Footnote-14949493
Ref: ライブラリ<82>-Footnote-24949548
Ref: ライブラリ<82>-Footnote-34949603
Ref: ライブラリ<82>-Footnote-44949658
Ref: ライブラリ<82>-Footnote-54949713
Ref: ライブラリ<82>-Footnote-64949768
Ref: ライブラリ<82>-Footnote-74949823
Ref: ライブラリ<82>-Footnote-84949878
Ref: ライブラリ<82>-Footnote-94949933
Ref: ライブラリ<82>-Footnote-104949988
Ref: ライブラリ<82>-Footnote-114950044
Ref: ライブラリ<82>-Footnote-124950100
Ref: ライブラリ<82>-Footnote-134950156
Ref: ライブラリ<82>-Footnote-144950199
Ref: ライブラリ<82>-Footnote-154950255
Ref: ライブラリ<82>-Footnote-164950311
Ref: ライブラリ<82>-Footnote-174950367
Ref: ライブラリ<82>-Footnote-184950423
Ref: ライブラリ<82>-Footnote-194950479
Ref: ライブラリ<82>-Footnote-204950535
Ref: ライブラリ<82>-Footnote-214950591
Ref: ライブラリ<82>-Footnote-224950647
Ref: ライブラリ<82>-Footnote-234950703
Ref: ライブラリ<82>-Footnote-244950759
Ref: ライブラリ<82>-Footnote-254950815
Ref: ライブラリ<82>-Footnote-264950871
Ref: ライブラリ<82>-Footnote-274950927
Ref: ライブラリ<82>-Footnote-284950983
Ref: ライブラリ<82>-Footnote-294951039
Ref: ライブラリ<82>-Footnote-304951095
Ref: ライブラリ<82>-Footnote-314951151
Ref: ライブラリ<82>-Footnote-324951207
Ref: ライブラリ<82>-Footnote-334951250
Ref: ライブラリ<82>-Footnote-344951306
Ref: ライブラリ<82>-Footnote-354951362
Ref: ライブラリ<82>-Footnote-364951418
Ref: ライブラリ<82>-Footnote-374951474
Ref: ライブラリ<82>-Footnote-384951517
Ref: ライブラリ<82>-Footnote-394951573
Ref: ライブラリ<82>-Footnote-404951629
Ref: ライブラリ<82>-Footnote-414951695
Ref: ライブラリ<82>-Footnote-424951761
Node: ドキュメント<27>4951827
Ref: whatsnew/changelog id3774951957
Ref: 1d474951957
Ref: ドキュメント<27>-Footnote-14952279
Ref: ドキュメント<27>-Footnote-24952334
Node: テスト<31>4952389
Ref: whatsnew/changelog id3784952513
Ref: 1d484952513
Ref: テスト<31>-Footnote-14953406
Ref: テスト<31>-Footnote-24953461
Ref: テスト<31>-Footnote-34953516
Ref: テスト<31>-Footnote-44953571
Ref: テスト<31>-Footnote-54953626
Node: ビルド<32>4953691
Ref: whatsnew/changelog id3794953804
Ref: 1d494953804
Ref: ビルド<32>-Footnote-14955489
Ref: ビルド<32>-Footnote-24955544
Ref: ビルド<32>-Footnote-34955599
Ref: ビルド<32>-Footnote-44955654
Ref: ビルド<32>-Footnote-54955709
Ref: ビルド<32>-Footnote-64955764
Ref: ビルド<32>-Footnote-74955819
Ref: ビルド<32>-Footnote-84955909
Ref: ビルド<32>-Footnote-94955964
Ref: ビルド<32>-Footnote-104956019
Node: Windows<28>4956075
Ref: whatsnew/changelog id3804956184
Ref: 1d4b4956184
Ref: Windows<28>-Footnote-14956877
Ref: Windows<28>-Footnote-24956932
Ref: Windows<28>-Footnote-34956988
Ref: Windows<28>-Footnote-44957043
Ref: Windows<28>-Footnote-54957098
Ref: Windows<28>-Footnote-64957153
Node: macOS<20>4957208
Ref: whatsnew/changelog id3814957313
Ref: 1d4c4957313
Ref: macOS<20>-Footnote-14957444
Node: C API<30>4957499
Ref: whatsnew/changelog id3824957584
Ref: 1d4d4957584
Ref: C API<30>-Footnote-14959649
Ref: C API<30>-Footnote-24959704
Ref: C API<30>-Footnote-34959759
Ref: C API<30>-Footnote-44959814
Ref: C API<30>-Footnote-54959869
Ref: C API<30>-Footnote-64959924
Ref: C API<30>-Footnote-74959979
Node: Python 3 12 0 alpha 14960034
Ref: whatsnew/changelog python-3-12-0-alpha-14960163
Ref: 1d4f4960163
Node: セキュリティ<26>4961364
Ref: whatsnew/changelog id3834961474
Ref: 1d504961474
Ref: セキュリティ<26>-Footnote-14963321
Ref: セキュリティ<26>-Footnote-24963376
Ref: セキュリティ<26>-Footnote-34963431
Ref: セキュリティ<26>-Footnote-44963503
Ref: セキュリティ<26>-Footnote-54963559
Ref: セキュリティ<26>-Footnote-64963614
Ref: セキュリティ<26>-Footnote-74963669
Ref: セキュリティ<26>-Footnote-84963724
Node: Core and Builtins<81>4963779
Ref: whatsnew/changelog id3844963917
Ref: 1d514963917
Ref: Core and Builtins<81>-Footnote-14965193
Ref: Core and Builtins<81>-Footnote-24965248
Ref: Core and Builtins<81>-Footnote-34965303
Ref: Core and Builtins<81>-Footnote-44965358
Ref: Core and Builtins<81>-Footnote-54965413
Ref: Core and Builtins<81>-Footnote-64965468
Ref: Core and Builtins<81>-Footnote-74965523
Ref: Core and Builtins<81>-Footnote-84965578
Node: ライブラリ<83>4965633
Ref: whatsnew/changelog id3854965770
Ref: 1d524965770
Ref: ライブラリ<83>-Footnote-14966048
Ref: ライブラリ<83>-Footnote-24966103
Node: Core and Builtins<82>4966158
Ref: whatsnew/changelog id3864966293
Ref: 1d534966293
Ref: Core and Builtins<82>-Footnote-14969732
Ref: Core and Builtins<82>-Footnote-24969787
Ref: Core and Builtins<82>-Footnote-34969842
Ref: Core and Builtins<82>-Footnote-44969897
Ref: Core and Builtins<82>-Footnote-54969952
Ref: Core and Builtins<82>-Footnote-64970007
Ref: Core and Builtins<82>-Footnote-74970062
Ref: Core and Builtins<82>-Footnote-84970117
Ref: Core and Builtins<82>-Footnote-94970172
Ref: Core and Builtins<82>-Footnote-104970227
Ref: Core and Builtins<82>-Footnote-114970283
Ref: Core and Builtins<82>-Footnote-124970339
Ref: Core and Builtins<82>-Footnote-134970395
Ref: Core and Builtins<82>-Footnote-144970451
Ref: Core and Builtins<82>-Footnote-154970507
Ref: Core and Builtins<82>-Footnote-164970563
Ref: Core and Builtins<82>-Footnote-174970619
Node: ライブラリ<84>4970675
Ref: whatsnew/changelog id3874970812
Ref: 1d584970812
Ref: ライブラリ<84>-Footnote-14970959
Node: Core and Builtins<83>4971014
Ref: whatsnew/changelog id3884971149
Ref: 1d594971149
Ref: Core and Builtins<83>-Footnote-14972876
Ref: Core and Builtins<83>-Footnote-24972931
Ref: Core and Builtins<83>-Footnote-34972986
Ref: Core and Builtins<83>-Footnote-44973041
Ref: Core and Builtins<83>-Footnote-54973096
Ref: Core and Builtins<83>-Footnote-64973151
Ref: Core and Builtins<83>-Footnote-74973206
Ref: Core and Builtins<83>-Footnote-84973261
Ref: Core and Builtins<83>-Footnote-94973316
Ref: Core and Builtins<83>-Footnote-104973371
Ref: Core and Builtins<83>-Footnote-114973427
Node: ライブラリ<85>4973483
Ref: whatsnew/changelog id3894973620
Ref: 1d5a4973620
Ref: ライブラリ<85>-Footnote-14973839
Ref: ライブラリ<85>-Footnote-24973894
Node: Core and Builtins<84>4973949
Ref: whatsnew/changelog id3904974084
Ref: 1d5b4974084
Ref: Core and Builtins<84>-Footnote-14983325
Ref: Core and Builtins<84>-Footnote-24983380
Ref: Core and Builtins<84>-Footnote-34983435
Ref: Core and Builtins<84>-Footnote-44983490
Ref: Core and Builtins<84>-Footnote-54983545
Ref: Core and Builtins<84>-Footnote-64983600
Ref: Core and Builtins<84>-Footnote-74983655
Ref: Core and Builtins<84>-Footnote-84983697
Ref: Core and Builtins<84>-Footnote-94983752
Ref: Core and Builtins<84>-Footnote-104983807
Ref: Core and Builtins<84>-Footnote-114983863
Ref: Core and Builtins<84>-Footnote-124983919
Ref: Core and Builtins<84>-Footnote-134983975
Ref: Core and Builtins<84>-Footnote-144984031
Ref: Core and Builtins<84>-Footnote-154984087
Ref: Core and Builtins<84>-Footnote-164984143
Ref: Core and Builtins<84>-Footnote-174984199
Ref: Core and Builtins<84>-Footnote-184984255
Ref: Core and Builtins<84>-Footnote-194984311
Ref: Core and Builtins<84>-Footnote-204984367
Ref: Core and Builtins<84>-Footnote-214984423
Ref: Core and Builtins<84>-Footnote-224984479
Ref: Core and Builtins<84>-Footnote-234984535
Ref: Core and Builtins<84>-Footnote-244984591
Ref: Core and Builtins<84>-Footnote-254984647
Ref: Core and Builtins<84>-Footnote-264984703
Ref: Core and Builtins<84>-Footnote-274984759
Ref: Core and Builtins<84>-Footnote-284984815
Ref: Core and Builtins<84>-Footnote-294984871
Ref: Core and Builtins<84>-Footnote-304984927
Ref: Core and Builtins<84>-Footnote-314984983
Ref: Core and Builtins<84>-Footnote-324985039
Ref: Core and Builtins<84>-Footnote-334985095
Ref: Core and Builtins<84>-Footnote-344985151
Ref: Core and Builtins<84>-Footnote-354985207
Ref: Core and Builtins<84>-Footnote-364985263
Ref: Core and Builtins<84>-Footnote-374985319
Ref: Core and Builtins<84>-Footnote-384985375
Ref: Core and Builtins<84>-Footnote-394985431
Ref: Core and Builtins<84>-Footnote-404985487
Ref: Core and Builtins<84>-Footnote-414985543
Ref: Core and Builtins<84>-Footnote-424985599
Ref: Core and Builtins<84>-Footnote-434985655
Ref: Core and Builtins<84>-Footnote-444985711
Ref: Core and Builtins<84>-Footnote-454985767
Ref: Core and Builtins<84>-Footnote-464985823
Node: ライブラリ<86>4985879
Ref: whatsnew/changelog id3914986016
Ref: 1d5d4986016
Ref: ライブラリ<86>-Footnote-14986221
Node: Core and Builtins<85>4986276
Ref: whatsnew/changelog id3924986411
Ref: 1d604986411
Ref: Core and Builtins<85>-Footnote-14986879
Ref: Core and Builtins<85>-Footnote-24986934
Node: ライブラリ<87>4986989
Ref: whatsnew/changelog id3934987126
Ref: 1d614987126
Ref: ライブラリ<87>-Footnote-14987418
Node: Core and Builtins<86>4987473
Ref: whatsnew/changelog id3944987608
Ref: 1d624987608
Ref: Core and Builtins<86>-Footnote-14987804
Node: ライブラリ<88>4987859
Ref: whatsnew/changelog id3954987996
Ref: 1d634987996
Ref: ライブラリ<88>-Footnote-14988450
Ref: ライブラリ<88>-Footnote-24988505
Node: Core and Builtins<87>4988560
Ref: whatsnew/changelog id3964988695
Ref: 1d644988695
Ref: Core and Builtins<87>-Footnote-14994175
Ref: Core and Builtins<87>-Footnote-24994230
Ref: Core and Builtins<87>-Footnote-34994285
Ref: Core and Builtins<87>-Footnote-44994340
Ref: Core and Builtins<87>-Footnote-54994395
Ref: Core and Builtins<87>-Footnote-64994450
Ref: Core and Builtins<87>-Footnote-74994505
Ref: Core and Builtins<87>-Footnote-84994560
Ref: Core and Builtins<87>-Footnote-94994615
Ref: Core and Builtins<87>-Footnote-104994670
Ref: Core and Builtins<87>-Footnote-114994726
Ref: Core and Builtins<87>-Footnote-124994782
Ref: Core and Builtins<87>-Footnote-134994825
Ref: Core and Builtins<87>-Footnote-144994881
Ref: Core and Builtins<87>-Footnote-154994937
Ref: Core and Builtins<87>-Footnote-164994993
Ref: Core and Builtins<87>-Footnote-174995049
Ref: Core and Builtins<87>-Footnote-184995105
Ref: Core and Builtins<87>-Footnote-194995161
Ref: Core and Builtins<87>-Footnote-204995217
Ref: Core and Builtins<87>-Footnote-214995273
Ref: Core and Builtins<87>-Footnote-224995329
Ref: Core and Builtins<87>-Footnote-234995385
Ref: Core and Builtins<87>-Footnote-244995441
Ref: Core and Builtins<87>-Footnote-254995497
Ref: Core and Builtins<87>-Footnote-264995553
Ref: Core and Builtins<87>-Footnote-274995609
Ref: Core and Builtins<87>-Footnote-284995665
Ref: Core and Builtins<87>-Footnote-294995721
Ref: Core and Builtins<87>-Footnote-304995777
Ref: Core and Builtins<87>-Footnote-314995833
Ref: Core and Builtins<87>-Footnote-324995889
Ref: Core and Builtins<87>-Footnote-334995945
Ref: Core and Builtins<87>-Footnote-344996001
Node: ライブラリ<89>4996057
Ref: whatsnew/changelog id3974996194
Ref: 1d654996194
Ref: ライブラリ<89>-Footnote-14996640
Node: Core and Builtins<88>4996695
Ref: whatsnew/changelog id3984996830
Ref: 1d664996830
Ref: Core and Builtins<88>-Footnote-15002076
Ref: Core and Builtins<88>-Footnote-25002131
Ref: Core and Builtins<88>-Footnote-35002186
Ref: Core and Builtins<88>-Footnote-45002241
Ref: Core and Builtins<88>-Footnote-55002296
Ref: Core and Builtins<88>-Footnote-65002351
Ref: Core and Builtins<88>-Footnote-75002406
Ref: Core and Builtins<88>-Footnote-85002461
Ref: Core and Builtins<88>-Footnote-95002516
Ref: Core and Builtins<88>-Footnote-105002571
Ref: Core and Builtins<88>-Footnote-115002627
Ref: Core and Builtins<88>-Footnote-125002683
Ref: Core and Builtins<88>-Footnote-135002739
Ref: Core and Builtins<88>-Footnote-145002795
Ref: Core and Builtins<88>-Footnote-155002851
Ref: Core and Builtins<88>-Footnote-165002907
Ref: Core and Builtins<88>-Footnote-175002963
Ref: Core and Builtins<88>-Footnote-185003019
Ref: Core and Builtins<88>-Footnote-195003075
Ref: Core and Builtins<88>-Footnote-205003135
Ref: Core and Builtins<88>-Footnote-215003191
Ref: Core and Builtins<88>-Footnote-225003247
Ref: Core and Builtins<88>-Footnote-235003303
Ref: Core and Builtins<88>-Footnote-245003359
Ref: Core and Builtins<88>-Footnote-255003415
Ref: Core and Builtins<88>-Footnote-265003471
Ref: Core and Builtins<88>-Footnote-275003527
Ref: Core and Builtins<88>-Footnote-285003583
Ref: Core and Builtins<88>-Footnote-295003639
Ref: Core and Builtins<88>-Footnote-305003695
Ref: Core and Builtins<88>-Footnote-315003751
Ref: Core and Builtins<88>-Footnote-325003807
Node: ライブラリ<90>5003863
Ref: whatsnew/changelog id3995004000
Ref: 1d675004000
Ref: ライブラリ<90>-Footnote-15004172
Node: Core and Builtins<89>5004227
Ref: whatsnew/changelog id4005004362
Ref: 1d685004362
Ref: Core and Builtins<89>-Footnote-15004816
Ref: Core and Builtins<89>-Footnote-25004871
Node: ライブラリ<91>5004926
Ref: whatsnew/changelog id4015005063
Ref: 1d695005063
Ref: ライブラリ<91>-Footnote-15005227
Node: Core and Builtins<90>5005282
Ref: whatsnew/changelog id4025005417
Ref: 1d6a5005417
Ref: Core and Builtins<90>-Footnote-15006281
Ref: Core and Builtins<90>-Footnote-25006336
Ref: Core and Builtins<90>-Footnote-35006391
Ref: Core and Builtins<90>-Footnote-45006446
Ref: Core and Builtins<90>-Footnote-55006511
Ref: Core and Builtins<90>-Footnote-65006576
Node: ライブラリ<92>5006641
Ref: whatsnew/changelog id4035006779
Ref: 1d6b5006779
Ref: ライブラリ<92>-Footnote-15049966
Ref: ライブラリ<92>-Footnote-25050021
Ref: ライブラリ<92>-Footnote-35050076
Ref: ライブラリ<92>-Footnote-45050131
Ref: ライブラリ<92>-Footnote-55050186
Ref: ライブラリ<92>-Footnote-65050241
Ref: ライブラリ<92>-Footnote-75050296
Ref: ライブラリ<92>-Footnote-85050351
Ref: ライブラリ<92>-Footnote-95050406
Ref: ライブラリ<92>-Footnote-105050461
Ref: ライブラリ<92>-Footnote-115050517
Ref: ライブラリ<92>-Footnote-125050573
Ref: ライブラリ<92>-Footnote-135050629
Ref: ライブラリ<92>-Footnote-145050685
Ref: ライブラリ<92>-Footnote-155050741
Ref: ライブラリ<92>-Footnote-165050797
Ref: ライブラリ<92>-Footnote-175050853
Ref: ライブラリ<92>-Footnote-185050909
Ref: ライブラリ<92>-Footnote-195050965
Ref: ライブラリ<92>-Footnote-205051025
Ref: ライブラリ<92>-Footnote-215051081
Ref: ライブラリ<92>-Footnote-225051137
Ref: ライブラリ<92>-Footnote-235051193
Ref: ライブラリ<92>-Footnote-245051249
Ref: ライブラリ<92>-Footnote-255051305
Ref: ライブラリ<92>-Footnote-265051361
Ref: ライブラリ<92>-Footnote-275051417
Ref: ライブラリ<92>-Footnote-285051473
Ref: ライブラリ<92>-Footnote-295051529
Ref: ライブラリ<92>-Footnote-305051585
Ref: ライブラリ<92>-Footnote-315051641
Ref: ライブラリ<92>-Footnote-325051697
Ref: ライブラリ<92>-Footnote-335051753
Ref: ライブラリ<92>-Footnote-345051809
Ref: ライブラリ<92>-Footnote-355051865
Ref: ライブラリ<92>-Footnote-365051921
Ref: ライブラリ<92>-Footnote-375051977
Ref: ライブラリ<92>-Footnote-385052033
Ref: ライブラリ<92>-Footnote-395052089
Ref: ライブラリ<92>-Footnote-405052145
Ref: ライブラリ<92>-Footnote-415052201
Ref: ライブラリ<92>-Footnote-425052257
Ref: ライブラリ<92>-Footnote-435052313
Ref: ライブラリ<92>-Footnote-445052369
Ref: ライブラリ<92>-Footnote-455052425
Ref: ライブラリ<92>-Footnote-465052481
Ref: ライブラリ<92>-Footnote-475052537
Ref: ライブラリ<92>-Footnote-485052593
Ref: ライブラリ<92>-Footnote-495052649
Ref: ライブラリ<92>-Footnote-505052705
Ref: ライブラリ<92>-Footnote-515052761
Ref: ライブラリ<92>-Footnote-525052817
Ref: ライブラリ<92>-Footnote-535052873
Ref: ライブラリ<92>-Footnote-545052929
Ref: ライブラリ<92>-Footnote-555052985
Ref: ライブラリ<92>-Footnote-565053041
Ref: ライブラリ<92>-Footnote-575053097
Ref: ライブラリ<92>-Footnote-585053153
Ref: ライブラリ<92>-Footnote-595053209
Ref: ライブラリ<92>-Footnote-605053265
Ref: ライブラリ<92>-Footnote-615053321
Ref: ライブラリ<92>-Footnote-625053377
Ref: ライブラリ<92>-Footnote-635053433
Ref: ライブラリ<92>-Footnote-645053489
Ref: ライブラリ<92>-Footnote-655053545
Ref: ライブラリ<92>-Footnote-665053601
Ref: ライブラリ<92>-Footnote-675053657
Ref: ライブラリ<92>-Footnote-685053723
Ref: ライブラリ<92>-Footnote-695053779
Ref: ライブラリ<92>-Footnote-705053835
Ref: ライブラリ<92>-Footnote-715053891
Ref: ライブラリ<92>-Footnote-725053947
Ref: ライブラリ<92>-Footnote-735054003
Ref: ライブラリ<92>-Footnote-745054059
Ref: ライブラリ<92>-Footnote-755054115
Ref: ライブラリ<92>-Footnote-765054171
Ref: ライブラリ<92>-Footnote-775054227
Ref: ライブラリ<92>-Footnote-785054283
Ref: ライブラリ<92>-Footnote-795054339
Ref: ライブラリ<92>-Footnote-805054395
Ref: ライブラリ<92>-Footnote-815054451
Ref: ライブラリ<92>-Footnote-825054507
Ref: ライブラリ<92>-Footnote-835054563
Ref: ライブラリ<92>-Footnote-845054619
Ref: ライブラリ<92>-Footnote-855054675
Ref: ライブラリ<92>-Footnote-865054731
Ref: ライブラリ<92>-Footnote-875054787
Ref: ライブラリ<92>-Footnote-885054843
Ref: ライブラリ<92>-Footnote-895054899
Ref: ライブラリ<92>-Footnote-905054955
Ref: ライブラリ<92>-Footnote-915055011
Ref: ライブラリ<92>-Footnote-925055067
Ref: ライブラリ<92>-Footnote-935055123
Ref: ライブラリ<92>-Footnote-945055179
Ref: ライブラリ<92>-Footnote-955055235
Ref: ライブラリ<92>-Footnote-965055291
Ref: ライブラリ<92>-Footnote-975055347
Ref: ライブラリ<92>-Footnote-985055403
Ref: ライブラリ<92>-Footnote-995055459
Ref: ライブラリ<92>-Footnote-1005055515
Ref: ライブラリ<92>-Footnote-1015055572
Ref: ライブラリ<92>-Footnote-1025055629
Ref: ライブラリ<92>-Footnote-1035055686
Ref: ライブラリ<92>-Footnote-1045055743
Ref: ライブラリ<92>-Footnote-1055055800
Ref: ライブラリ<92>-Footnote-1065055857
Ref: ライブラリ<92>-Footnote-1075055914
Ref: ライブラリ<92>-Footnote-1085055971
Ref: ライブラリ<92>-Footnote-1095056028
Ref: ライブラリ<92>-Footnote-1105056085
Ref: ライブラリ<92>-Footnote-1115056142
Ref: ライブラリ<92>-Footnote-1125056199
Ref: ライブラリ<92>-Footnote-1135056256
Ref: ライブラリ<92>-Footnote-1145056313
Ref: ライブラリ<92>-Footnote-1155056370
Ref: ライブラリ<92>-Footnote-1165056427
Ref: ライブラリ<92>-Footnote-1175056484
Ref: ライブラリ<92>-Footnote-1185056541
Ref: ライブラリ<92>-Footnote-1195056598
Ref: ライブラリ<92>-Footnote-1205056655
Ref: ライブラリ<92>-Footnote-1215056712
Ref: ライブラリ<92>-Footnote-1225056769
Ref: ライブラリ<92>-Footnote-1235056826
Ref: ライブラリ<92>-Footnote-1245056870
Ref: ライブラリ<92>-Footnote-1255056927
Ref: ライブラリ<92>-Footnote-1265056984
Ref: ライブラリ<92>-Footnote-1275057041
Ref: ライブラリ<92>-Footnote-1285057098
Ref: ライブラリ<92>-Footnote-1295057155
Ref: ライブラリ<92>-Footnote-1305057212
Ref: ライブラリ<92>-Footnote-1315057269
Ref: ライブラリ<92>-Footnote-1325057326
Ref: ライブラリ<92>-Footnote-1335057383
Ref: ライブラリ<92>-Footnote-1345057440
Ref: ライブラリ<92>-Footnote-1355057497
Ref: ライブラリ<92>-Footnote-1365057554
Ref: ライブラリ<92>-Footnote-1375057611
Ref: ライブラリ<92>-Footnote-1385057668
Ref: ライブラリ<92>-Footnote-1395057725
Ref: ライブラリ<92>-Footnote-1405057783
Ref: ライブラリ<92>-Footnote-1415057840
Ref: ライブラリ<92>-Footnote-1425057897
Ref: ライブラリ<92>-Footnote-1435057941
Ref: ライブラリ<92>-Footnote-1445057998
Ref: ライブラリ<92>-Footnote-1455058055
Ref: ライブラリ<92>-Footnote-1465058112
Ref: ライブラリ<92>-Footnote-1475058169
Ref: ライブラリ<92>-Footnote-1485058226
Ref: ライブラリ<92>-Footnote-1495058283
Ref: ライブラリ<92>-Footnote-1505058340
Ref: ライブラリ<92>-Footnote-1515058397
Ref: ライブラリ<92>-Footnote-1525058454
Ref: ライブラリ<92>-Footnote-1535058511
Ref: ライブラリ<92>-Footnote-1545058568
Ref: ライブラリ<92>-Footnote-1555058625
Ref: ライブラリ<92>-Footnote-1565058682
Ref: ライブラリ<92>-Footnote-1575058739
Ref: ライブラリ<92>-Footnote-1585058796
Ref: ライブラリ<92>-Footnote-1595058853
Ref: ライブラリ<92>-Footnote-1605058910
Ref: ライブラリ<92>-Footnote-1615058967
Ref: ライブラリ<92>-Footnote-1625059024
Ref: ライブラリ<92>-Footnote-1635059068
Ref: ライブラリ<92>-Footnote-1645059125
Ref: ライブラリ<92>-Footnote-1655059182
Ref: ライブラリ<92>-Footnote-1665059239
Ref: ライブラリ<92>-Footnote-1675059296
Ref: ライブラリ<92>-Footnote-1685059353
Ref: ライブラリ<92>-Footnote-1695059410
Ref: ライブラリ<92>-Footnote-1705059467
Ref: ライブラリ<92>-Footnote-1715059524
Ref: ライブラリ<92>-Footnote-1725059581
Ref: ライブラリ<92>-Footnote-1735059638
Ref: ライブラリ<92>-Footnote-1745059695
Ref: ライブラリ<92>-Footnote-1755059752
Ref: ライブラリ<92>-Footnote-1765059809
Ref: ライブラリ<92>-Footnote-1775059866
Ref: ライブラリ<92>-Footnote-1785059923
Ref: ライブラリ<92>-Footnote-1795059980
Ref: ライブラリ<92>-Footnote-1805060037
Ref: ライブラリ<92>-Footnote-1815060094
Ref: ライブラリ<92>-Footnote-1825060138
Ref: ライブラリ<92>-Footnote-1835060195
Ref: ライブラリ<92>-Footnote-1845060252
Ref: ライブラリ<92>-Footnote-1855060309
Ref: ライブラリ<92>-Footnote-1865060366
Ref: ライブラリ<92>-Footnote-1875060423
Ref: ライブラリ<92>-Footnote-1885060480
Ref: ライブラリ<92>-Footnote-1895060537
Ref: ライブラリ<92>-Footnote-1905060594
Ref: ライブラリ<92>-Footnote-1915060651
Ref: ライブラリ<92>-Footnote-1925060708
Ref: ライブラリ<92>-Footnote-1935060765
Ref: ライブラリ<92>-Footnote-1945060822
Ref: ライブラリ<92>-Footnote-1955060879
Ref: ライブラリ<92>-Footnote-1965060936
Ref: ライブラリ<92>-Footnote-1975060993
Ref: ライブラリ<92>-Footnote-1985061050
Ref: ライブラリ<92>-Footnote-1995061107
Ref: ライブラリ<92>-Footnote-2005061164
Ref: ライブラリ<92>-Footnote-2015061221
Ref: ライブラリ<92>-Footnote-2025061278
Ref: ライブラリ<92>-Footnote-2035061335
Ref: ライブラリ<92>-Footnote-2045061392
Ref: ライブラリ<92>-Footnote-2055061449
Ref: ライブラリ<92>-Footnote-2065061506
Ref: ライブラリ<92>-Footnote-2075061563
Ref: ライブラリ<92>-Footnote-2085061620
Ref: ライブラリ<92>-Footnote-2095061677
Ref: ライブラリ<92>-Footnote-2105061734
Ref: ライブラリ<92>-Footnote-2115061791
Ref: ライブラリ<92>-Footnote-2125061848
Ref: ライブラリ<92>-Footnote-2135061905
Ref: ライブラリ<92>-Footnote-2145061962
Ref: ライブラリ<92>-Footnote-2155062019
Ref: ライブラリ<92>-Footnote-2165062076
Ref: ライブラリ<92>-Footnote-2175062133
Ref: ライブラリ<92>-Footnote-2185062190
Ref: ライブラリ<92>-Footnote-2195062247
Ref: ライブラリ<92>-Footnote-2205062304
Ref: ライブラリ<92>-Footnote-2215062361
Ref: ライブラリ<92>-Footnote-2225062418
Ref: ライブラリ<92>-Footnote-2235062475
Ref: ライブラリ<92>-Footnote-2245062532
Ref: ライブラリ<92>-Footnote-2255062589
Ref: ライブラリ<92>-Footnote-2265062646
Ref: ライブラリ<92>-Footnote-2275062713
Ref: ライブラリ<92>-Footnote-2285062780
Ref: ライブラリ<92>-Footnote-2295062847
Ref: ライブラリ<92>-Footnote-2305062904
Ref: ライブラリ<92>-Footnote-2315062971
Ref: ライブラリ<92>-Footnote-2325063038
Ref: ライブラリ<92>-Footnote-2335063105
Ref: ライブラリ<92>-Footnote-2345063172
Ref: ライブラリ<92>-Footnote-2355063239
Ref: ライブラリ<92>-Footnote-2365063306
Ref: ライブラリ<92>-Footnote-2375063373
Ref: ライブラリ<92>-Footnote-2385063440
Ref: ライブラリ<92>-Footnote-2395063507
Ref: ライブラリ<92>-Footnote-2405063574
Ref: ライブラリ<92>-Footnote-2415063641
Ref: ライブラリ<92>-Footnote-2425063708
Ref: ライブラリ<92>-Footnote-2435063775
Ref: ライブラリ<92>-Footnote-2445063842
Ref: ライブラリ<92>-Footnote-2455063909
Ref: ライブラリ<92>-Footnote-2465063976
Ref: ライブラリ<92>-Footnote-2475064043
Ref: ライブラリ<92>-Footnote-2485064110
Ref: ライブラリ<92>-Footnote-2495064177
Ref: ライブラリ<92>-Footnote-2505064244
Ref: ライブラリ<92>-Footnote-2515064311
Ref: ライブラリ<92>-Footnote-2525064378
Ref: ライブラリ<92>-Footnote-2535064445
Ref: ライブラリ<92>-Footnote-2545064512
Node: ドキュメント<28>5064579
Ref: whatsnew/changelog id4045064709
Ref: 1d855064709
Ref: ドキュメント<28>-Footnote-15068472
Ref: ドキュメント<28>-Footnote-25068527
Ref: ドキュメント<28>-Footnote-35068582
Ref: ドキュメント<28>-Footnote-45068628
Ref: ドキュメント<28>-Footnote-55068683
Ref: ドキュメント<28>-Footnote-65068738
Ref: ドキュメント<28>-Footnote-75068793
Ref: ドキュメント<28>-Footnote-85068848
Ref: ドキュメント<28>-Footnote-95068903
Ref: ドキュメント<28>-Footnote-105068958
Ref: ドキュメント<28>-Footnote-115069014
Ref: ドキュメント<28>-Footnote-125069070
Ref: ドキュメント<28>-Footnote-135069126
Ref: ドキュメント<28>-Footnote-145069182
Ref: ドキュメント<28>-Footnote-155069225
Ref: ドキュメント<28>-Footnote-165069281
Ref: ドキュメント<28>-Footnote-175069337
Ref: ドキュメント<28>-Footnote-185069393
Ref: ドキュメント<28>-Footnote-195069449
Ref: ドキュメント<28>-Footnote-205069505
Ref: ドキュメント<28>-Footnote-215069561
Ref: ドキュメント<28>-Footnote-225069617
Ref: ドキュメント<28>-Footnote-235069673
Ref: ドキュメント<28>-Footnote-245069739
Ref: ドキュメント<28>-Footnote-255069805
Ref: ドキュメント<28>-Footnote-265069871
Ref: ドキュメント<28>-Footnote-275069937
Node: テスト<32>5070003
Ref: whatsnew/changelog id4055070127
Ref: 1d8c5070127
Ref: テスト<32>-Footnote-15075508
Ref: テスト<32>-Footnote-25075563
Ref: テスト<32>-Footnote-35075618
Ref: テスト<32>-Footnote-45075673
Ref: テスト<32>-Footnote-55075728
Ref: テスト<32>-Footnote-65075815
Ref: テスト<32>-Footnote-75075870
Ref: テスト<32>-Footnote-85075925
Ref: テスト<32>-Footnote-95075980
Ref: テスト<32>-Footnote-105076035
Ref: テスト<32>-Footnote-115076091
Ref: テスト<32>-Footnote-125076147
Ref: テスト<32>-Footnote-135076203
Ref: テスト<32>-Footnote-145076259
Ref: テスト<32>-Footnote-155076315
Ref: テスト<32>-Footnote-165076371
Ref: テスト<32>-Footnote-175076427
Ref: テスト<32>-Footnote-185076483
Ref: テスト<32>-Footnote-195076539
Ref: テスト<32>-Footnote-205076595
Ref: テスト<32>-Footnote-215076651
Ref: テスト<32>-Footnote-225076707
Ref: テスト<32>-Footnote-235076763
Ref: テスト<32>-Footnote-245076819
Ref: テスト<32>-Footnote-255076875
Ref: テスト<32>-Footnote-265076931
Ref: テスト<32>-Footnote-275076987
Ref: テスト<32>-Footnote-285077043
Ref: テスト<32>-Footnote-295077099
Ref: テスト<32>-Footnote-305077155
Ref: テスト<32>-Footnote-315077211
Ref: テスト<32>-Footnote-325077267
Ref: テスト<32>-Footnote-335077323
Ref: テスト<32>-Footnote-345077379
Ref: テスト<32>-Footnote-355077435
Ref: テスト<32>-Footnote-365077491
Node: ビルド<33>5077557
Ref: whatsnew/changelog id4065077670
Ref: 1d905077670
Ref: ビルド<33>-Footnote-15083157
Ref: ビルド<33>-Footnote-25083212
Ref: ビルド<33>-Footnote-35083267
Ref: ビルド<33>-Footnote-45083322
Ref: ビルド<33>-Footnote-55083377
Ref: ビルド<33>-Footnote-65083432
Ref: ビルド<33>-Footnote-75083487
Ref: ビルド<33>-Footnote-85083542
Ref: ビルド<33>-Footnote-95083597
Ref: ビルド<33>-Footnote-105083652
Ref: ビルド<33>-Footnote-115083708
Ref: ビルド<33>-Footnote-125083764
Ref: ビルド<33>-Footnote-135083820
Ref: ビルド<33>-Footnote-145083876
Ref: ビルド<33>-Footnote-155083932
Ref: ビルド<33>-Footnote-165083988
Ref: ビルド<33>-Footnote-175084031
Ref: ビルド<33>-Footnote-185084087
Ref: ビルド<33>-Footnote-195084143
Ref: ビルド<33>-Footnote-205084199
Ref: ビルド<33>-Footnote-215084255
Ref: ビルド<33>-Footnote-225084311
Ref: ビルド<33>-Footnote-235084367
Ref: ビルド<33>-Footnote-245084423
Ref: ビルド<33>-Footnote-255084479
Ref: ビルド<33>-Footnote-265084535
Ref: ビルド<33>-Footnote-275084591
Ref: ビルド<33>-Footnote-285084647
Ref: ビルド<33>-Footnote-295084703
Ref: ビルド<33>-Footnote-305084759
Ref: ビルド<33>-Footnote-315084815
Ref: ビルド<33>-Footnote-325084858
Ref: ビルド<33>-Footnote-335084914
Ref: ビルド<33>-Footnote-345084970
Ref: ビルド<33>-Footnote-355085026
Ref: ビルド<33>-Footnote-365085082
Node: Windows<29>5085148
Ref: whatsnew/changelog id4075085257
Ref: 1d915085257
Ref: Windows<29>-Footnote-15089660
Ref: Windows<29>-Footnote-25089715
Ref: Windows<29>-Footnote-35089770
Ref: Windows<29>-Footnote-45089825
Ref: Windows<29>-Footnote-55089880
Ref: Windows<29>-Footnote-65089935
Ref: Windows<29>-Footnote-75089990
Ref: Windows<29>-Footnote-85090045
Ref: Windows<29>-Footnote-95090100
Ref: Windows<29>-Footnote-105090155
Ref: Windows<29>-Footnote-115090211
Ref: Windows<29>-Footnote-125090267
Ref: Windows<29>-Footnote-135090323
Ref: Windows<29>-Footnote-145090379
Ref: Windows<29>-Footnote-155090435
Ref: Windows<29>-Footnote-165090491
Ref: Windows<29>-Footnote-175090547
Ref: Windows<29>-Footnote-185090603
Ref: Windows<29>-Footnote-195090659
Ref: Windows<29>-Footnote-205090715
Ref: Windows<29>-Footnote-215090771
Ref: Windows<29>-Footnote-225090827
Ref: Windows<29>-Footnote-235090883
Ref: Windows<29>-Footnote-245090939
Ref: Windows<29>-Footnote-255090995
Ref: Windows<29>-Footnote-265091051
Ref: Windows<29>-Footnote-275091117
Ref: Windows<29>-Footnote-285091173
Ref: Windows<29>-Footnote-295091239
Node: macOS<21>5091305
Ref: whatsnew/changelog id4085091409
Ref: 1d925091409
Ref: macOS<21>-Footnote-15091959
Node: IDLE<16>5092014
Ref: whatsnew/changelog id4095092122
Ref: 1d935092122
Ref: IDLE<16>-Footnote-15093035
Ref: IDLE<16>-Footnote-25093090
Ref: IDLE<16>-Footnote-35093145
Ref: IDLE<16>-Footnote-45093200
Ref: IDLE<16>-Footnote-55093255
Ref: IDLE<16>-Footnote-65093310
Ref: IDLE<16>-Footnote-75093365
Node: Tools/Demos<22>5093420
Ref: whatsnew/changelog id4105093528
Ref: 1d945093528
Ref: Tools/Demos<22>-Footnote-15095039
Ref: Tools/Demos<22>-Footnote-25095094
Ref: Tools/Demos<22>-Footnote-35095149
Ref: Tools/Demos<22>-Footnote-45095197
Ref: Tools/Demos<22>-Footnote-55095252
Ref: Tools/Demos<22>-Footnote-65095300
Ref: Tools/Demos<22>-Footnote-75095355
Ref: Tools/Demos<22>-Footnote-85095410
Ref: Tools/Demos<22>-Footnote-95095465
Ref: Tools/Demos<22>-Footnote-105095520
Ref: Tools/Demos<22>-Footnote-115095576
Ref: Tools/Demos<22>-Footnote-125095632
Node: C API<31>5095688
Ref: whatsnew/changelog id4125095779
Ref: 1d955095779
Ref: C API<31>-Footnote-15103305
Ref: C API<31>-Footnote-25103360
Ref: C API<31>-Footnote-35103415
Ref: C API<31>-Footnote-45103470
Ref: C API<31>-Footnote-55103525
Ref: C API<31>-Footnote-65103580
Ref: C API<31>-Footnote-75103635
Ref: C API<31>-Footnote-85103690
Ref: C API<31>-Footnote-95103745
Ref: C API<31>-Footnote-105103800
Ref: C API<31>-Footnote-115103856
Ref: C API<31>-Footnote-125103912
Ref: C API<31>-Footnote-135103968
Ref: C API<31>-Footnote-145104024
Ref: C API<31>-Footnote-155104080
Ref: C API<31>-Footnote-165104136
Ref: C API<31>-Footnote-175104192
Ref: C API<31>-Footnote-185104248
Ref: C API<31>-Footnote-195104304
Ref: C API<31>-Footnote-205104360
Ref: C API<31>-Footnote-215104416
Ref: C API<31>-Footnote-225104472
Ref: C API<31>-Footnote-235104528
Ref: C API<31>-Footnote-245104584
Ref: C API<31>-Footnote-255104640
Ref: C API<31>-Footnote-265104696
Ref: C API<31>-Footnote-275104752
Ref: C API<31>-Footnote-285104808
Ref: C API<31>-Footnote-295104864
Ref: C API<31>-Footnote-305104920
Ref: C API<31>-Footnote-315104976
Ref: C API<31>-Footnote-325105032
Ref: C API<31>-Footnote-335105088
Ref: C API<31>-Footnote-345105144
Node: Python 3 11 0 beta 15105210
Ref: whatsnew/changelog python-3-11-0-beta-15105339
Ref: 1d975105339
Node: セキュリティ<27>5105920
Ref: whatsnew/changelog id4135106029
Ref: 1d985106029
Ref: セキュリティ<27>-Footnote-15106342
Node: Core and Builtins<91>5106397
Ref: whatsnew/changelog id4145106534
Ref: 1d995106534
Ref: Core and Builtins<91>-Footnote-15113177
Ref: Core and Builtins<91>-Footnote-25113232
Ref: Core and Builtins<91>-Footnote-35113297
Ref: Core and Builtins<91>-Footnote-45113352
Ref: Core and Builtins<91>-Footnote-55113417
Ref: Core and Builtins<91>-Footnote-65113472
Ref: Core and Builtins<91>-Footnote-75113527
Ref: Core and Builtins<91>-Footnote-85113582
Ref: Core and Builtins<91>-Footnote-95113637
Ref: Core and Builtins<91>-Footnote-105113692
Ref: Core and Builtins<91>-Footnote-115113748
Ref: Core and Builtins<91>-Footnote-125113804
Ref: Core and Builtins<91>-Footnote-135113860
Ref: Core and Builtins<91>-Footnote-145113916
Ref: Core and Builtins<91>-Footnote-155113959
Ref: Core and Builtins<91>-Footnote-165114015
Ref: Core and Builtins<91>-Footnote-175114071
Ref: Core and Builtins<91>-Footnote-185114127
Ref: Core and Builtins<91>-Footnote-195114183
Ref: Core and Builtins<91>-Footnote-205114239
Ref: Core and Builtins<91>-Footnote-215114295
Ref: Core and Builtins<91>-Footnote-225114361
Ref: Core and Builtins<91>-Footnote-235114417
Ref: Core and Builtins<91>-Footnote-245114473
Ref: Core and Builtins<91>-Footnote-255114529
Ref: Core and Builtins<91>-Footnote-265114585
Ref: Core and Builtins<91>-Footnote-275114641
Ref: Core and Builtins<91>-Footnote-285114697
Ref: Core and Builtins<91>-Footnote-295114753
Ref: Core and Builtins<91>-Footnote-305114809
Ref: Core and Builtins<91>-Footnote-315114865
Ref: Core and Builtins<91>-Footnote-325114921
Ref: Core and Builtins<91>-Footnote-335114964
Ref: Core and Builtins<91>-Footnote-345115020
Ref: Core and Builtins<91>-Footnote-355115076
Ref: Core and Builtins<91>-Footnote-365115132
Ref: Core and Builtins<91>-Footnote-375115198
Ref: Core and Builtins<91>-Footnote-385115254
Ref: Core and Builtins<91>-Footnote-395115310
Ref: Core and Builtins<91>-Footnote-405115376
Node: ライブラリ<93>5115442
Ref: whatsnew/changelog id4155115578
Ref: 1d9c5115578
Ref: ライブラリ<93>-Footnote-15116056
Node: Core and Builtins<92>5116121
Ref: whatsnew/changelog id4165116249
Ref: 1d9d5116249
Ref: Core and Builtins<92>-Footnote-15118024
Ref: Core and Builtins<92>-Footnote-25118089
Ref: Core and Builtins<92>-Footnote-35118154
Ref: Core and Builtins<92>-Footnote-45118219
Ref: Core and Builtins<92>-Footnote-55118284
Ref: Core and Builtins<92>-Footnote-65118349
Ref: Core and Builtins<92>-Footnote-75118414
Ref: Core and Builtins<92>-Footnote-85118479
Ref: Core and Builtins<92>-Footnote-95118544
Node: ビルド<34>5118609
Ref: whatsnew/changelog id4175118739
Ref: 1da15118739
Ref: ビルド<34>-Footnote-15118871
Node: Core and Builtins<93>5118936
Ref: whatsnew/changelog id4185119064
Ref: 1da25119064
Ref: Core and Builtins<93>-Footnote-15119888
Ref: Core and Builtins<93>-Footnote-25119953
Ref: Core and Builtins<93>-Footnote-35120018
Node: ライブラリ<94>5120083
Ref: whatsnew/changelog id4195120220
Ref: 1da35120220
Ref: ライブラリ<94>-Footnote-15137752
Ref: ライブラリ<94>-Footnote-25137807
Ref: ライブラリ<94>-Footnote-35137862
Ref: ライブラリ<94>-Footnote-45137917
Ref: ライブラリ<94>-Footnote-55137972
Ref: ライブラリ<94>-Footnote-65138027
Ref: ライブラリ<94>-Footnote-75138082
Ref: ライブラリ<94>-Footnote-85138137
Ref: ライブラリ<94>-Footnote-95138192
Ref: ライブラリ<94>-Footnote-105138247
Ref: ライブラリ<94>-Footnote-115138303
Ref: ライブラリ<94>-Footnote-125138359
Ref: ライブラリ<94>-Footnote-135138415
Ref: ライブラリ<94>-Footnote-145138471
Ref: ライブラリ<94>-Footnote-155138527
Ref: ライブラリ<94>-Footnote-165138583
Ref: ライブラリ<94>-Footnote-175138639
Ref: ライブラリ<94>-Footnote-185138695
Ref: ライブラリ<94>-Footnote-195138751
Ref: ライブラリ<94>-Footnote-205138807
Ref: ライブラリ<94>-Footnote-215138863
Ref: ライブラリ<94>-Footnote-225138919
Ref: ライブラリ<94>-Footnote-235138975
Ref: ライブラリ<94>-Footnote-245139031
Ref: ライブラリ<94>-Footnote-255139097
Ref: ライブラリ<94>-Footnote-265139153
Ref: ライブラリ<94>-Footnote-275139209
Ref: ライブラリ<94>-Footnote-285139252
Ref: ライブラリ<94>-Footnote-295139308
Ref: ライブラリ<94>-Footnote-305139364
Ref: ライブラリ<94>-Footnote-315139420
Ref: ライブラリ<94>-Footnote-325139476
Ref: ライブラリ<94>-Footnote-335139519
Ref: ライブラリ<94>-Footnote-345139575
Ref: ライブラリ<94>-Footnote-355139631
Ref: ライブラリ<94>-Footnote-365139687
Ref: ライブラリ<94>-Footnote-375139743
Ref: ライブラリ<94>-Footnote-385139799
Ref: ライブラリ<94>-Footnote-395139855
Ref: ライブラリ<94>-Footnote-405139911
Ref: ライブラリ<94>-Footnote-415139967
Ref: ライブラリ<94>-Footnote-425140023
Ref: ライブラリ<94>-Footnote-435140079
Ref: ライブラリ<94>-Footnote-445140135
Ref: ライブラリ<94>-Footnote-455140191
Ref: ライブラリ<94>-Footnote-465140247
Ref: ライブラリ<94>-Footnote-475140303
Ref: ライブラリ<94>-Footnote-485140359
Ref: ライブラリ<94>-Footnote-495140415
Ref: ライブラリ<94>-Footnote-505140471
Ref: ライブラリ<94>-Footnote-515140527
Ref: ライブラリ<94>-Footnote-525140583
Ref: ライブラリ<94>-Footnote-535140639
Ref: ライブラリ<94>-Footnote-545140695
Ref: ライブラリ<94>-Footnote-555140751
Ref: ライブラリ<94>-Footnote-565140807
Ref: ライブラリ<94>-Footnote-575140873
Ref: ライブラリ<94>-Footnote-585140929
Ref: ライブラリ<94>-Footnote-595140985
Ref: ライブラリ<94>-Footnote-605141041
Ref: ライブラリ<94>-Footnote-615141097
Ref: ライブラリ<94>-Footnote-625141153
Ref: ライブラリ<94>-Footnote-635141209
Ref: ライブラリ<94>-Footnote-645141265
Ref: ライブラリ<94>-Footnote-655141321
Ref: ライブラリ<94>-Footnote-665141377
Ref: ライブラリ<94>-Footnote-675141420
Ref: ライブラリ<94>-Footnote-685141476
Ref: ライブラリ<94>-Footnote-695141532
Ref: ライブラリ<94>-Footnote-705141588
Ref: ライブラリ<94>-Footnote-715141644
Ref: ライブラリ<94>-Footnote-725141700
Ref: ライブラリ<94>-Footnote-735141756
Ref: ライブラリ<94>-Footnote-745141812
Ref: ライブラリ<94>-Footnote-755141868
Ref: ライブラリ<94>-Footnote-765141934
Ref: ライブラリ<94>-Footnote-775141990
Ref: ライブラリ<94>-Footnote-785142046
Ref: ライブラリ<94>-Footnote-795142102
Ref: ライブラリ<94>-Footnote-805142168
Ref: ライブラリ<94>-Footnote-815142234
Ref: ライブラリ<94>-Footnote-825142277
Ref: ライブラリ<94>-Footnote-835142343
Ref: ライブラリ<94>-Footnote-845142409
Ref: ライブラリ<94>-Footnote-855142475
Ref: ライブラリ<94>-Footnote-865142541
Ref: ライブラリ<94>-Footnote-875142607
Ref: ライブラリ<94>-Footnote-885142673
Ref: ライブラリ<94>-Footnote-895142739
Ref: ライブラリ<94>-Footnote-905142805
Ref: ライブラリ<94>-Footnote-915142871
Ref: ライブラリ<94>-Footnote-925142937
Ref: ライブラリ<94>-Footnote-935143003
Ref: ライブラリ<94>-Footnote-945143069
Ref: ライブラリ<94>-Footnote-955143135
Ref: ライブラリ<94>-Footnote-965143201
Ref: ライブラリ<94>-Footnote-975143267
Ref: ライブラリ<94>-Footnote-985143333
Ref: ライブラリ<94>-Footnote-995143399
Ref: ライブラリ<94>-Footnote-1005143465
Ref: ライブラリ<94>-Footnote-1015143532
Ref: ライブラリ<94>-Footnote-1025143599
Ref: ライブラリ<94>-Footnote-1035143666
Ref: ライブラリ<94>-Footnote-1045143733
Ref: ライブラリ<94>-Footnote-1055143800
Ref: ライブラリ<94>-Footnote-1065143867
Ref: ライブラリ<94>-Footnote-1075143934
Ref: ライブラリ<94>-Footnote-1085144001
Ref: ライブラリ<94>-Footnote-1095144068
Ref: ライブラリ<94>-Footnote-1105144135
Ref: ライブラリ<94>-Footnote-1115144202
Ref: ライブラリ<94>-Footnote-1125144269
Ref: ライブラリ<94>-Footnote-1135144336
Ref: ライブラリ<94>-Footnote-1145144403
Ref: ライブラリ<94>-Footnote-1155144470
Ref: ライブラリ<94>-Footnote-1165144537
Ref: ライブラリ<94>-Footnote-1175144604
Ref: ライブラリ<94>-Footnote-1185144671
Ref: ライブラリ<94>-Footnote-1195144738
Ref: ライブラリ<94>-Footnote-1205144805
Node: ドキュメント<29>5144872
Ref: whatsnew/changelog id4205145001
Ref: 1db05145001
Ref: ドキュメント<29>-Footnote-15146547
Ref: ドキュメント<29>-Footnote-25146602
Ref: ドキュメント<29>-Footnote-35146657
Ref: ドキュメント<29>-Footnote-45146712
Ref: ドキュメント<29>-Footnote-55146767
Ref: ドキュメント<29>-Footnote-65146832
Ref: ドキュメント<29>-Footnote-75146897
Ref: ドキュメント<29>-Footnote-85146962
Ref: ドキュメント<29>-Footnote-95147027
Ref: ドキュメント<29>-Footnote-105147069
Ref: ドキュメント<29>-Footnote-115147112
Ref: ドキュメント<29>-Footnote-125147178
Ref: ドキュメント<29>-Footnote-135147244
Ref: ドキュメント<29>-Footnote-145147309
Node: テスト<33>5147375
Ref: whatsnew/changelog id4215147498
Ref: 1db25147498
Ref: テスト<33>-Footnote-15148845
Ref: テスト<33>-Footnote-25148900
Ref: テスト<33>-Footnote-35148955
Ref: テスト<33>-Footnote-45149010
Ref: テスト<33>-Footnote-55149065
Ref: テスト<33>-Footnote-65149120
Ref: テスト<33>-Footnote-75149185
Ref: テスト<33>-Footnote-85149250
Node: ビルド<35>5149315
Ref: whatsnew/changelog id4225149427
Ref: 1db55149427
Ref: ビルド<35>-Footnote-15150061
Ref: ビルド<35>-Footnote-25150116
Ref: ビルド<35>-Footnote-35150171
Ref: ビルド<35>-Footnote-45150236
Node: Windows<30>5150301
Ref: whatsnew/changelog id4235150409
Ref: 1db65150409
Ref: Windows<30>-Footnote-15151031
Ref: Windows<30>-Footnote-25151096
Ref: Windows<30>-Footnote-35151161
Ref: Windows<30>-Footnote-45151226
Ref: Windows<30>-Footnote-55151291
Node: macOS<22>5151356
Ref: whatsnew/changelog id4245151466
Ref: 1db75151466
Ref: macOS<22>-Footnote-15151598
Node: Tools/Demos<23>5151663
Ref: whatsnew/changelog id4255151771
Ref: 1db85151771
Ref: Tools/Demos<23>-Footnote-15152330
Ref: Tools/Demos<23>-Footnote-25152385
Ref: Tools/Demos<23>-Footnote-35152440
Node: C API<32>5152495
Ref: whatsnew/changelog id4265152585
Ref: 1db95152585
Ref: C API<32>-Footnote-15154740
Ref: C API<32>-Footnote-25154795
Ref: C API<32>-Footnote-35154850
Ref: C API<32>-Footnote-45154905
Ref: C API<32>-Footnote-55154960
Ref: C API<32>-Footnote-65155015
Ref: C API<32>-Footnote-75155057
Ref: C API<32>-Footnote-85155112
Ref: C API<32>-Footnote-95155167
Ref: C API<32>-Footnote-105155232
Ref: C API<32>-Footnote-115155298
Ref: C API<32>-Footnote-125155364
Ref: C API<32>-Footnote-135155430
Node: Python 3 11 0 alpha 75155496
Ref: whatsnew/changelog python-3-11-0-alpha-75155625
Ref: 1dbc5155625
Node: Core and Builtins<94>5156174
Ref: whatsnew/changelog id4275156281
Ref: 1dbd5156281
Ref: Core and Builtins<94>-Footnote-15159555
Ref: Core and Builtins<94>-Footnote-25159620
Ref: Core and Builtins<94>-Footnote-35159685
Ref: Core and Builtins<94>-Footnote-45159750
Ref: Core and Builtins<94>-Footnote-55159815
Ref: Core and Builtins<94>-Footnote-65159880
Ref: Core and Builtins<94>-Footnote-75159945
Ref: Core and Builtins<94>-Footnote-85160010
Ref: Core and Builtins<94>-Footnote-95160075
Ref: Core and Builtins<94>-Footnote-105160140
Ref: Core and Builtins<94>-Footnote-115160206
Ref: Core and Builtins<94>-Footnote-125160272
Ref: Core and Builtins<94>-Footnote-135160338
Ref: Core and Builtins<94>-Footnote-145160404
Ref: Core and Builtins<94>-Footnote-155160470
Ref: Core and Builtins<94>-Footnote-165160536
Ref: Core and Builtins<94>-Footnote-175160602
Node: ライブラリ<95>5160668
Ref: whatsnew/changelog id4285160805
Ref: 1dbf5160805
Ref: ライブラリ<95>-Footnote-15161095
Node: Core and Builtins<95>5161160
Ref: whatsnew/changelog id4295161295
Ref: 1dc05161295
Ref: Core and Builtins<95>-Footnote-15162146
Ref: Core and Builtins<95>-Footnote-25162211
Ref: Core and Builtins<95>-Footnote-35162276
Ref: Core and Builtins<95>-Footnote-45162341
Ref: Core and Builtins<95>-Footnote-55162406
Node: ライブラリ<96>5162471
Ref: whatsnew/changelog id4305162608
Ref: 1dc15162608
Ref: ライブラリ<96>-Footnote-15162830
Node: Core and Builtins<96>5162895
Ref: whatsnew/changelog id4315163030
Ref: 1dc35163030
Ref: Core and Builtins<96>-Footnote-15164294
Ref: Core and Builtins<96>-Footnote-25164359
Ref: Core and Builtins<96>-Footnote-35164424
Ref: Core and Builtins<96>-Footnote-45164489
Ref: Core and Builtins<96>-Footnote-55164554
Ref: Core and Builtins<96>-Footnote-65164619
Ref: Core and Builtins<96>-Footnote-75164684
Ref: Core and Builtins<96>-Footnote-85164749
Ref: Core and Builtins<96>-Footnote-95164814
Node: ライブラリ<97>5164879
Ref: whatsnew/changelog id4325165017
Ref: 1dc55165017
Ref: ライブラリ<97>-Footnote-15179204
Ref: ライブラリ<97>-Footnote-25179269
Ref: ライブラリ<97>-Footnote-35179334
Ref: ライブラリ<97>-Footnote-45179399
Ref: ライブラリ<97>-Footnote-55179464
Ref: ライブラリ<97>-Footnote-65179529
Ref: ライブラリ<97>-Footnote-75179593
Ref: ライブラリ<97>-Footnote-85179658
Ref: ライブラリ<97>-Footnote-95179723
Ref: ライブラリ<97>-Footnote-105179788
Ref: ライブラリ<97>-Footnote-115179854
Ref: ライブラリ<97>-Footnote-125179920
Ref: ライブラリ<97>-Footnote-135179986
Ref: ライブラリ<97>-Footnote-145180052
Ref: ライブラリ<97>-Footnote-155180095
Ref: ライブラリ<97>-Footnote-165180161
Ref: ライブラリ<97>-Footnote-175180227
Ref: ライブラリ<97>-Footnote-185180293
Ref: ライブラリ<97>-Footnote-195180336
Ref: ライブラリ<97>-Footnote-205180402
Ref: ライブラリ<97>-Footnote-215180468
Ref: ライブラリ<97>-Footnote-225180534
Ref: ライブラリ<97>-Footnote-235180577
Ref: ライブラリ<97>-Footnote-245180643
Ref: ライブラリ<97>-Footnote-255180709
Ref: ライブラリ<97>-Footnote-265180775
Ref: ライブラリ<97>-Footnote-275180841
Ref: ライブラリ<97>-Footnote-285180907
Ref: ライブラリ<97>-Footnote-295180973
Ref: ライブラリ<97>-Footnote-305181040
Ref: ライブラリ<97>-Footnote-315181106
Ref: ライブラリ<97>-Footnote-325181172
Ref: ライブラリ<97>-Footnote-335181238
Ref: ライブラリ<97>-Footnote-345181304
Ref: ライブラリ<97>-Footnote-355181347
Ref: ライブラリ<97>-Footnote-365181413
Ref: ライブラリ<97>-Footnote-375181479
Ref: ライブラリ<97>-Footnote-385181544
Ref: ライブラリ<97>-Footnote-395181610
Ref: ライブラリ<97>-Footnote-405181676
Ref: ライブラリ<97>-Footnote-415181742
Ref: ライブラリ<97>-Footnote-425181808
Ref: ライブラリ<97>-Footnote-435181851
Ref: ライブラリ<97>-Footnote-445181917
Ref: ライブラリ<97>-Footnote-455181983
Ref: ライブラリ<97>-Footnote-465182049
Ref: ライブラリ<97>-Footnote-475182115
Ref: ライブラリ<97>-Footnote-485182181
Ref: ライブラリ<97>-Footnote-495182247
Ref: ライブラリ<97>-Footnote-505182313
Ref: ライブラリ<97>-Footnote-515182379
Ref: ライブラリ<97>-Footnote-525182445
Ref: ライブラリ<97>-Footnote-535182511
Ref: ライブラリ<97>-Footnote-545182577
Ref: ライブラリ<97>-Footnote-555182643
Ref: ライブラリ<97>-Footnote-565182709
Ref: ライブラリ<97>-Footnote-575182775
Ref: ライブラリ<97>-Footnote-585182841
Ref: ライブラリ<97>-Footnote-595182907
Ref: ライブラリ<97>-Footnote-605182950
Ref: ライブラリ<97>-Footnote-615183017
Ref: ライブラリ<97>-Footnote-625183083
Ref: ライブラリ<97>-Footnote-635183149
Ref: ライブラリ<97>-Footnote-645183215
Ref: ライブラリ<97>-Footnote-655183281
Ref: ライブラリ<97>-Footnote-665183347
Ref: ライブラリ<97>-Footnote-675183413
Ref: ライブラリ<97>-Footnote-685183479
Ref: ライブラリ<97>-Footnote-695183545
Ref: ライブラリ<97>-Footnote-705183611
Ref: ライブラリ<97>-Footnote-715183677
Ref: ライブラリ<97>-Footnote-725183743
Ref: ライブラリ<97>-Footnote-735183809
Ref: ライブラリ<97>-Footnote-745183875
Ref: ライブラリ<97>-Footnote-755183941
Ref: ライブラリ<97>-Footnote-765184007
Ref: ライブラリ<97>-Footnote-775184073
Ref: ライブラリ<97>-Footnote-785184139
Ref: ライブラリ<97>-Footnote-795184205
Ref: ライブラリ<97>-Footnote-805184271
Ref: ライブラリ<97>-Footnote-815184337
Ref: ライブラリ<97>-Footnote-825184403
Ref: ライブラリ<97>-Footnote-835184469
Ref: ライブラリ<97>-Footnote-845184512
Ref: ライブラリ<97>-Footnote-855184578
Ref: ライブラリ<97>-Footnote-865184644
Ref: ライブラリ<97>-Footnote-875184710
Ref: ライブラリ<97>-Footnote-885184776
Node: ドキュメント<30>5184842
Ref: whatsnew/changelog id4335184972
Ref: 1dd25184972
Ref: ドキュメント<30>-Footnote-15186118
Ref: ドキュメント<30>-Footnote-25186183
Ref: ドキュメント<30>-Footnote-35186248
Ref: ドキュメント<30>-Footnote-45186290
Ref: ドキュメント<30>-Footnote-55186355
Ref: ドキュメント<30>-Footnote-65186420
Ref: ドキュメント<30>-Footnote-75186485
Ref: ドキュメント<30>-Footnote-85186550
Node: テスト<34>5186615
Ref: whatsnew/changelog id4345186739
Ref: 1dd55186739
Ref: テスト<34>-Footnote-15187707
Ref: テスト<34>-Footnote-25187772
Ref: テスト<34>-Footnote-35187837
Ref: テスト<34>-Footnote-45187902
Ref: テスト<34>-Footnote-55187967
Ref: テスト<34>-Footnote-65188032
Ref: テスト<34>-Footnote-75188097
Ref: テスト<34>-Footnote-85188162
Node: ビルド<36>5188204
Ref: whatsnew/changelog id4355188317
Ref: 1dd65188317
Ref: ビルド<36>-Footnote-15189608
Ref: ビルド<36>-Footnote-25189673
Ref: ビルド<36>-Footnote-35189738
Ref: ビルド<36>-Footnote-45189803
Ref: ビルド<36>-Footnote-55189868
Ref: ビルド<36>-Footnote-65189933
Ref: ビルド<36>-Footnote-75189998
Ref: ビルド<36>-Footnote-85190063
Ref: ビルド<36>-Footnote-95190128
Node: Windows<31>5190193
Ref: whatsnew/changelog id4365190302
Ref: 1dd85190302
Ref: Windows<31>-Footnote-15191490
Ref: Windows<31>-Footnote-25191555
Ref: Windows<31>-Footnote-35191611
Ref: Windows<31>-Footnote-45191676
Ref: Windows<31>-Footnote-55191741
Ref: Windows<31>-Footnote-65191783
Ref: Windows<31>-Footnote-75191848
Ref: Windows<31>-Footnote-85191913
Ref: Windows<31>-Footnote-95191978
Ref: Windows<31>-Footnote-105192033
Ref: Windows<31>-Footnote-115192090
Ref: Windows<31>-Footnote-125192156
Node: macOS<23>5192213
Ref: whatsnew/changelog id4375192324
Ref: 1dd95192324
Ref: macOS<23>-Footnote-15192662
Ref: macOS<23>-Footnote-25192727
Node: Tools/Demos<24>5192792
Ref: whatsnew/changelog id4385192901
Ref: 1dda5192901
Ref: Tools/Demos<24>-Footnote-15193104
Node: C API<33>5193169
Ref: whatsnew/changelog id4395193260
Ref: 1ddb5193260
Ref: C API<33>-Footnote-15195519
Ref: C API<33>-Footnote-25195584
Ref: C API<33>-Footnote-35195649
Ref: C API<33>-Footnote-45195714
Ref: C API<33>-Footnote-55195779
Ref: C API<33>-Footnote-65195844
Ref: C API<33>-Footnote-75195909
Ref: C API<33>-Footnote-85195974
Node: Python 3 11 0 alpha 65196039
Ref: whatsnew/changelog python-3-11-0-alpha-65196169
Ref: 1dde5196169
Node: Core and Builtins<97>5196771
Ref: whatsnew/changelog id4405196878
Ref: 1ddf5196878
Ref: Core and Builtins<97>-Footnote-15200240
Ref: Core and Builtins<97>-Footnote-25200305
Ref: Core and Builtins<97>-Footnote-35200370
Ref: Core and Builtins<97>-Footnote-45200435
Ref: Core and Builtins<97>-Footnote-55200500
Ref: Core and Builtins<97>-Footnote-65200565
Ref: Core and Builtins<97>-Footnote-75200630
Ref: Core and Builtins<97>-Footnote-85200695
Ref: Core and Builtins<97>-Footnote-95200760
Ref: Core and Builtins<97>-Footnote-105200825
Ref: Core and Builtins<97>-Footnote-115200891
Ref: Core and Builtins<97>-Footnote-125200957
Ref: Core and Builtins<97>-Footnote-135201023
Ref: Core and Builtins<97>-Footnote-145201089
Ref: Core and Builtins<97>-Footnote-155201155
Ref: Core and Builtins<97>-Footnote-165201221
Ref: Core and Builtins<97>-Footnote-175201287
Ref: Core and Builtins<97>-Footnote-185201353
Ref: Core and Builtins<97>-Footnote-195201419
Ref: Core and Builtins<97>-Footnote-205201485
Ref: Core and Builtins<97>-Footnote-215201551
Ref: Core and Builtins<97>-Footnote-225201617
Ref: Core and Builtins<97>-Footnote-235201683
Ref: Core and Builtins<97>-Footnote-245201749
Ref: Core and Builtins<97>-Footnote-255201815
Ref: Core and Builtins<97>-Footnote-265201881
Node: ライブラリ<98>5201947
Ref: whatsnew/changelog id4415202084
Ref: 1de35202084
Ref: ライブラリ<98>-Footnote-15202228
Node: Core and Builtins<98>5202293
Ref: whatsnew/changelog id4425202428
Ref: 1de45202428
Ref: Core and Builtins<98>-Footnote-15204515
Ref: Core and Builtins<98>-Footnote-25204580
Ref: Core and Builtins<98>-Footnote-35204645
Ref: Core and Builtins<98>-Footnote-45204710
Ref: Core and Builtins<98>-Footnote-55204775
Ref: Core and Builtins<98>-Footnote-65204840
Ref: Core and Builtins<98>-Footnote-75204905
Ref: Core and Builtins<98>-Footnote-85204970
Ref: Core and Builtins<98>-Footnote-95205035
Ref: Core and Builtins<98>-Footnote-105205100
Ref: Core and Builtins<98>-Footnote-115205166
Node: ライブラリ<99>5205232
Ref: whatsnew/changelog id4435205369
Ref: 1de55205369
Ref: ライブラリ<99>-Footnote-15205640
Node: Core and Builtins<99>5205705
Ref: whatsnew/changelog id4445205841
Ref: 1de65205841
Ref: Core and Builtins<99>-Footnote-15206443
Ref: Core and Builtins<99>-Footnote-25206508
Ref: Core and Builtins<99>-Footnote-35206573
Ref: Core and Builtins<99>-Footnote-45206638
Node: ライブラリ<100>5206703
Ref: whatsnew/changelog id4455206842
Ref: 1de75206842
Ref: ライブラリ<100>-Footnote-15207146
Ref: ライブラリ<100>-Footnote-25207211
Node: Core and Builtins<100>5207276
Ref: whatsnew/changelog id4465207414
Ref: 1de85207414
Ref: Core and Builtins<100>-Footnote-15208113
Ref: Core and Builtins<100>-Footnote-25208178
Ref: Core and Builtins<100>-Footnote-35208243
Node: ライブラリ<101>5208308
Ref: whatsnew/changelog id4475208448
Ref: 1deb5208448
Ref: ライブラリ<101>-Footnote-15216646
Ref: ライブラリ<101>-Footnote-25216711
Ref: ライブラリ<101>-Footnote-35216776
Ref: ライブラリ<101>-Footnote-45216841
Ref: ライブラリ<101>-Footnote-55216906
Ref: ライブラリ<101>-Footnote-65216971
Ref: ライブラリ<101>-Footnote-75217036
Ref: ライブラリ<101>-Footnote-85217101
Ref: ライブラリ<101>-Footnote-95217166
Ref: ライブラリ<101>-Footnote-105217231
Ref: ライブラリ<101>-Footnote-115217297
Ref: ライブラリ<101>-Footnote-125217363
Ref: ライブラリ<101>-Footnote-135217429
Ref: ライブラリ<101>-Footnote-145217495
Ref: ライブラリ<101>-Footnote-155217561
Ref: ライブラリ<101>-Footnote-165217627
Ref: ライブラリ<101>-Footnote-175217693
Ref: ライブラリ<101>-Footnote-185217759
Ref: ライブラリ<101>-Footnote-195217825
Ref: ライブラリ<101>-Footnote-205217891
Ref: ライブラリ<101>-Footnote-215217957
Ref: ライブラリ<101>-Footnote-225218023
Ref: ライブラリ<101>-Footnote-235218089
Ref: ライブラリ<101>-Footnote-245218155
Ref: ライブラリ<101>-Footnote-255218221
Ref: ライブラリ<101>-Footnote-265218287
Ref: ライブラリ<101>-Footnote-275218353
Ref: ライブラリ<101>-Footnote-285218419
Ref: ライブラリ<101>-Footnote-295218485
Ref: ライブラリ<101>-Footnote-305218551
Ref: ライブラリ<101>-Footnote-315218617
Ref: ライブラリ<101>-Footnote-325218683
Ref: ライブラリ<101>-Footnote-335218749
Ref: ライブラリ<101>-Footnote-345218815
Ref: ライブラリ<101>-Footnote-355218858
Ref: ライブラリ<101>-Footnote-365218924
Ref: ライブラリ<101>-Footnote-375218990
Ref: ライブラリ<101>-Footnote-385219056
Ref: ライブラリ<101>-Footnote-395219122
Ref: ライブラリ<101>-Footnote-405219188
Ref: ライブラリ<101>-Footnote-415219254
Ref: ライブラリ<101>-Footnote-425219320
Ref: ライブラリ<101>-Footnote-435219386
Ref: ライブラリ<101>-Footnote-445219452
Ref: ライブラリ<101>-Footnote-455219518
Ref: ライブラリ<101>-Footnote-465219584
Ref: ライブラリ<101>-Footnote-475219650
Ref: ライブラリ<101>-Footnote-485219716
Node: ドキュメント<31>5219782
Ref: whatsnew/changelog id4485219913
Ref: 1df65219913
Ref: ドキュメント<31>-Footnote-15220136
Node: テスト<35>5220201
Ref: whatsnew/changelog id4495220325
Ref: 1df75220325
Ref: テスト<35>-Footnote-15221301
Ref: テスト<35>-Footnote-25221366
Ref: テスト<35>-Footnote-35221431
Ref: テスト<35>-Footnote-45221496
Ref: テスト<35>-Footnote-55221561
Node: ビルド<37>5221626
Ref: whatsnew/changelog id4505221739
Ref: 1df85221739
Ref: ビルド<37>-Footnote-15223172
Ref: ビルド<37>-Footnote-25223237
Ref: ビルド<37>-Footnote-35223302
Ref: ビルド<37>-Footnote-45223367
Ref: ビルド<37>-Footnote-55223432
Ref: ビルド<37>-Footnote-65223497
Ref: ビルド<37>-Footnote-75223562
Node: Windows<32>5223627
Ref: whatsnew/changelog id4515223735
Ref: 1df95223735
Ref: Windows<32>-Footnote-15224395
Ref: Windows<32>-Footnote-25224460
Ref: Windows<32>-Footnote-35224525
Node: IDLE<17>5224590
Ref: whatsnew/changelog id4525224694
Ref: 1dfa5224694
Ref: IDLE<17>-Footnote-15224976
Ref: IDLE<17>-Footnote-25225041
Node: C API<34>5225106
Ref: whatsnew/changelog id4535225190
Ref: 1dfb5225190
Ref: C API<34>-Footnote-15226135
Ref: C API<34>-Footnote-25226200
Ref: C API<34>-Footnote-35226265
Ref: C API<34>-Footnote-45226330
Ref: C API<34>-Footnote-55226395
Node: Python 3 11 0 alpha 55226460
Ref: whatsnew/changelog python-3-11-0-alpha-55226590
Ref: 1dfc5226590
Node: Core and Builtins<101>5227159
Ref: whatsnew/changelog id4545227268
Ref: 1dfd5227268
Ref: Core and Builtins<101>-Footnote-15231193
Ref: Core and Builtins<101>-Footnote-25231258
Ref: Core and Builtins<101>-Footnote-35231323
Ref: Core and Builtins<101>-Footnote-45231388
Ref: Core and Builtins<101>-Footnote-55231453
Ref: Core and Builtins<101>-Footnote-65231518
Ref: Core and Builtins<101>-Footnote-75231583
Ref: Core and Builtins<101>-Footnote-85231648
Ref: Core and Builtins<101>-Footnote-95231713
Ref: Core and Builtins<101>-Footnote-105231778
Ref: Core and Builtins<101>-Footnote-115231844
Ref: Core and Builtins<101>-Footnote-125231910
Ref: Core and Builtins<101>-Footnote-135231976
Ref: Core and Builtins<101>-Footnote-145232019
Ref: Core and Builtins<101>-Footnote-155232085
Ref: Core and Builtins<101>-Footnote-165232151
Ref: Core and Builtins<101>-Footnote-175232217
Ref: Core and Builtins<101>-Footnote-185232283
Ref: Core and Builtins<101>-Footnote-195232349
Node: ライブラリ<102>5232415
Ref: whatsnew/changelog id4555232555
Ref: 1dff5232555
Ref: ライブラリ<102>-Footnote-15232784
Node: Core and Builtins<102>5232849
Ref: whatsnew/changelog id4565232987
Ref: 1e005232987
Ref: Core and Builtins<102>-Footnote-15233722
Ref: Core and Builtins<102>-Footnote-25233787
Ref: Core and Builtins<102>-Footnote-35233852
Ref: Core and Builtins<102>-Footnote-45233917
Node: ライブラリ<103>5233982
Ref: whatsnew/changelog id4575234113
Ref: 1e015234113
Ref: ライブラリ<103>-Footnote-15234252
Node: ビルド<38>5234317
Ref: whatsnew/changelog id4585234448
Ref: 1e025234448
Ref: ビルド<38>-Footnote-15234580
Node: Core and Builtins<103>5234645
Ref: whatsnew/changelog id4595234776
Ref: 1e035234776
Ref: Core and Builtins<103>-Footnote-15235076
Node: ライブラリ<104>5235141
Ref: whatsnew/changelog id4605235281
Ref: 1e045235281
Ref: ライブラリ<104>-Footnote-15241231
Ref: ライブラリ<104>-Footnote-25241296
Ref: ライブラリ<104>-Footnote-35241361
Ref: ライブラリ<104>-Footnote-45241426
Ref: ライブラリ<104>-Footnote-55241491
Ref: ライブラリ<104>-Footnote-65241556
Ref: ライブラリ<104>-Footnote-75241621
Ref: ライブラリ<104>-Footnote-85241686
Ref: ライブラリ<104>-Footnote-95241751
Ref: ライブラリ<104>-Footnote-105241816
Ref: ライブラリ<104>-Footnote-115241882
Ref: ライブラリ<104>-Footnote-125241948
Ref: ライブラリ<104>-Footnote-135242014
Ref: ライブラリ<104>-Footnote-145242080
Ref: ライブラリ<104>-Footnote-155242146
Ref: ライブラリ<104>-Footnote-165242212
Ref: ライブラリ<104>-Footnote-175242278
Ref: ライブラリ<104>-Footnote-185242344
Ref: ライブラリ<104>-Footnote-195242410
Ref: ライブラリ<104>-Footnote-205242476
Ref: ライブラリ<104>-Footnote-215242542
Ref: ライブラリ<104>-Footnote-225242608
Ref: ライブラリ<104>-Footnote-235242674
Ref: ライブラリ<104>-Footnote-245242740
Ref: ライブラリ<104>-Footnote-255242806
Ref: ライブラリ<104>-Footnote-265242872
Ref: ライブラリ<104>-Footnote-275242938
Ref: ライブラリ<104>-Footnote-285243004
Ref: ライブラリ<104>-Footnote-295243070
Ref: ライブラリ<104>-Footnote-305243136
Ref: ライブラリ<104>-Footnote-315243202
Ref: ライブラリ<104>-Footnote-325243268
Ref: ライブラリ<104>-Footnote-335243334
Ref: ライブラリ<104>-Footnote-345243400
Ref: ライブラリ<104>-Footnote-355243466
Ref: ライブラリ<104>-Footnote-365243532
Ref: ライブラリ<104>-Footnote-375243598
Node: ドキュメント<32>5243664
Ref: whatsnew/changelog id4615243795
Ref: 1e095243795
Ref: ドキュメント<32>-Footnote-15243988
Node: テスト<36>5244053
Ref: whatsnew/changelog id4625244177
Ref: 1e0a5244177
Ref: テスト<36>-Footnote-15246328
Ref: テスト<36>-Footnote-25246393
Ref: テスト<36>-Footnote-35246458
Ref: テスト<36>-Footnote-45246523
Ref: テスト<36>-Footnote-55246588
Ref: テスト<36>-Footnote-65246653
Ref: テスト<36>-Footnote-75246718
Ref: テスト<36>-Footnote-85246783
Ref: テスト<36>-Footnote-95246848
Ref: テスト<36>-Footnote-105246913
Ref: テスト<36>-Footnote-115246979
Node: ビルド<39>5247045
Ref: whatsnew/changelog id4635247158
Ref: 1e0b5247158
Ref: ビルド<39>-Footnote-15248895
Ref: ビルド<39>-Footnote-25248960
Ref: ビルド<39>-Footnote-35249025
Ref: ビルド<39>-Footnote-45249090
Ref: ビルド<39>-Footnote-55249155
Ref: ビルド<39>-Footnote-65249220
Ref: ビルド<39>-Footnote-75249285
Ref: ビルド<39>-Footnote-85249350
Ref: ビルド<39>-Footnote-95249415
Ref: ビルド<39>-Footnote-105249480
Node: Windows<33>5249546
Ref: whatsnew/changelog id4645249655
Ref: 1e0c5249655
Ref: Windows<33>-Footnote-15250185
Ref: Windows<33>-Footnote-25250250
Ref: Windows<33>-Footnote-35250315
Node: macOS<24>5250380
Ref: whatsnew/changelog id4655250484
Ref: 1e0d5250484
Ref: macOS<24>-Footnote-15250616
Node: IDLE<18>5250681
Ref: whatsnew/changelog id4665250783
Ref: 1e0e5250783
Ref: IDLE<18>-Footnote-15251172
Node: C API<35>5251237
Ref: whatsnew/changelog id4675251321
Ref: 1e0f5251321
Ref: C API<35>-Footnote-15252214
Ref: C API<35>-Footnote-25252279
Ref: C API<35>-Footnote-35252344
Ref: C API<35>-Footnote-45252409
Ref: C API<35>-Footnote-55252474
Node: Python 3 11 0 alpha 45252539
Ref: whatsnew/changelog python-3-11-0-alpha-45252669
Ref: 1e105252669
Node: Core and Builtins<104>5253281
Ref: whatsnew/changelog id4685253390
Ref: 1e115253390
Ref: Core and Builtins<104>-Footnote-15255582
Ref: Core and Builtins<104>-Footnote-25255647
Ref: Core and Builtins<104>-Footnote-35255712
Ref: Core and Builtins<104>-Footnote-45255777
Ref: Core and Builtins<104>-Footnote-55255842
Ref: Core and Builtins<104>-Footnote-65255907
Ref: Core and Builtins<104>-Footnote-75255972
Ref: Core and Builtins<104>-Footnote-85256037
Ref: Core and Builtins<104>-Footnote-95256102
Ref: Core and Builtins<104>-Footnote-105256167
Ref: Core and Builtins<104>-Footnote-115256233
Node: ライブラリ<105>5256299
Ref: whatsnew/changelog id4695256439
Ref: 1e125256439
Ref: ライブラリ<105>-Footnote-15256639
Node: Core and Builtins<105>5256704
Ref: whatsnew/changelog id4705256842
Ref: 1e135256842
Ref: Core and Builtins<105>-Footnote-15257567
Ref: Core and Builtins<105>-Footnote-25257632
Ref: Core and Builtins<105>-Footnote-35257697
Ref: Core and Builtins<105>-Footnote-45257762
Ref: Core and Builtins<105>-Footnote-55257827
Node: ライブラリ<106>5257892
Ref: whatsnew/changelog id4715258032
Ref: 1e145258032
Ref: ライブラリ<106>-Footnote-15258187
Node: Core and Builtins<106>5258252
Ref: whatsnew/changelog id4725258390
Ref: 1e155258390
Ref: Core and Builtins<106>-Footnote-15260939
Ref: Core and Builtins<106>-Footnote-25261004
Ref: Core and Builtins<106>-Footnote-35261069
Ref: Core and Builtins<106>-Footnote-45261134
Ref: Core and Builtins<106>-Footnote-55261199
Ref: Core and Builtins<106>-Footnote-65261264
Ref: Core and Builtins<106>-Footnote-75261329
Ref: Core and Builtins<106>-Footnote-85261394
Ref: Core and Builtins<106>-Footnote-95261459
Ref: Core and Builtins<106>-Footnote-105261524
Ref: Core and Builtins<106>-Footnote-115261590
Ref: Core and Builtins<106>-Footnote-125261656
Ref: Core and Builtins<106>-Footnote-135261722
Ref: Core and Builtins<106>-Footnote-145261788
Ref: Core and Builtins<106>-Footnote-155261854
Node: ライブラリ<107>5261920
Ref: whatsnew/changelog id4735262060
Ref: 1e175262060
Ref: ライブラリ<107>-Footnote-15262243
Node: Core and Builtins<107>5262308
Ref: whatsnew/changelog id4745262446
Ref: 1e185262446
Ref: Core and Builtins<107>-Footnote-15263723
Ref: Core and Builtins<107>-Footnote-25263788
Ref: Core and Builtins<107>-Footnote-35263853
Ref: Core and Builtins<107>-Footnote-45263918
Ref: Core and Builtins<107>-Footnote-55263983
Ref: Core and Builtins<107>-Footnote-65264025
Ref: Core and Builtins<107>-Footnote-75264090
Node: ライブラリ<108>5264155
Ref: whatsnew/changelog id4755264295
Ref: 1e195264295
Ref: ライブラリ<108>-Footnote-15271571
Ref: ライブラリ<108>-Footnote-25271636
Ref: ライブラリ<108>-Footnote-35271701
Ref: ライブラリ<108>-Footnote-45271766
Ref: ライブラリ<108>-Footnote-55271831
Ref: ライブラリ<108>-Footnote-65271896
Ref: ライブラリ<108>-Footnote-75271961
Ref: ライブラリ<108>-Footnote-85272026
Ref: ライブラリ<108>-Footnote-95272091
Ref: ライブラリ<108>-Footnote-105272156
Ref: ライブラリ<108>-Footnote-115272222
Ref: ライブラリ<108>-Footnote-125272288
Ref: ライブラリ<108>-Footnote-135272354
Ref: ライブラリ<108>-Footnote-145272420
Ref: ライブラリ<108>-Footnote-155272486
Ref: ライブラリ<108>-Footnote-165272552
Ref: ライブラリ<108>-Footnote-175272618
Ref: ライブラリ<108>-Footnote-185272684
Ref: ライブラリ<108>-Footnote-195272750
Ref: ライブラリ<108>-Footnote-205272816
Ref: ライブラリ<108>-Footnote-215272882
Ref: ライブラリ<108>-Footnote-225272948
Ref: ライブラリ<108>-Footnote-235273014
Ref: ライブラリ<108>-Footnote-245273080
Ref: ライブラリ<108>-Footnote-255273146
Ref: ライブラリ<108>-Footnote-265273212
Ref: ライブラリ<108>-Footnote-275273278
Ref: ライブラリ<108>-Footnote-285273344
Ref: ライブラリ<108>-Footnote-295273410
Ref: ライブラリ<108>-Footnote-305273476
Ref: ライブラリ<108>-Footnote-315273542
Ref: ライブラリ<108>-Footnote-325273608
Ref: ライブラリ<108>-Footnote-335273674
Ref: ライブラリ<108>-Footnote-345273740
Ref: ライブラリ<108>-Footnote-355273806
Ref: ライブラリ<108>-Footnote-365273872
Ref: ライブラリ<108>-Footnote-375273938
Ref: ライブラリ<108>-Footnote-385274004
Ref: ライブラリ<108>-Footnote-395274070
Ref: ライブラリ<108>-Footnote-405274136
Ref: ライブラリ<108>-Footnote-415274202
Ref: ライブラリ<108>-Footnote-425274268
Ref: ライブラリ<108>-Footnote-435274334
Ref: ライブラリ<108>-Footnote-445274400
Node: ドキュメント<33>5274466
Ref: whatsnew/changelog id4765274597
Ref: 1e1e5274597
Ref: ドキュメント<33>-Footnote-15275098
Ref: ドキュメント<33>-Footnote-25275163
Ref: ドキュメント<33>-Footnote-35275228
Ref: ドキュメント<33>-Footnote-45275293
Node: テスト<37>5275358
Ref: whatsnew/changelog id4775275482
Ref: 1e215275482
Ref: テスト<37>-Footnote-15276417
Ref: テスト<37>-Footnote-25276482
Ref: テスト<37>-Footnote-35276547
Ref: テスト<37>-Footnote-45276612
Ref: テスト<37>-Footnote-55276677
Ref: テスト<37>-Footnote-65276742
Ref: テスト<37>-Footnote-75276807
Ref: テスト<37>-Footnote-85276872
Node: ビルド<40>5276937
Ref: whatsnew/changelog id4785277050
Ref: 1e225277050
Ref: ビルド<40>-Footnote-15279118
Ref: ビルド<40>-Footnote-25279183
Ref: ビルド<40>-Footnote-35279248
Ref: ビルド<40>-Footnote-45279313
Ref: ビルド<40>-Footnote-55279378
Ref: ビルド<40>-Footnote-65279443
Ref: ビルド<40>-Footnote-75279508
Ref: ビルド<40>-Footnote-85279573
Ref: ビルド<40>-Footnote-95279638
Ref: ビルド<40>-Footnote-105279703
Ref: ビルド<40>-Footnote-115279769
Ref: ビルド<40>-Footnote-125279835
Node: Windows<34>5279901
Ref: whatsnew/changelog id4795280010
Ref: 1e235280010
Ref: Windows<34>-Footnote-15280231
Node: macOS<25>5280296
Ref: whatsnew/changelog id4805280401
Ref: 1e245280401
Ref: macOS<25>-Footnote-15280641
Node: C API<36>5280706
Ref: whatsnew/changelog id4815280791
Ref: 1e255280791
Ref: C API<36>-Footnote-15282046
Ref: C API<36>-Footnote-25282111
Ref: C API<36>-Footnote-35282176
Ref: C API<36>-Footnote-45282241
Ref: C API<36>-Footnote-55282306
Node: Python 3 11 0 alpha 35282371
Ref: whatsnew/changelog python-3-11-0-alpha-35282501
Ref: 1e275282501
Node: Core and Builtins<108>5282938
Ref: whatsnew/changelog id4825283047
Ref: 1e285283047
Ref: Core and Builtins<108>-Footnote-15285628
Ref: Core and Builtins<108>-Footnote-25285693
Ref: Core and Builtins<108>-Footnote-35285758
Ref: Core and Builtins<108>-Footnote-45285823
Ref: Core and Builtins<108>-Footnote-55285888
Ref: Core and Builtins<108>-Footnote-65285953
Ref: Core and Builtins<108>-Footnote-75286018
Ref: Core and Builtins<108>-Footnote-85286083
Ref: Core and Builtins<108>-Footnote-95286148
Ref: Core and Builtins<108>-Footnote-105286213
Ref: Core and Builtins<108>-Footnote-115286279
Ref: Core and Builtins<108>-Footnote-125286345
Node: ライブラリ<109>5286411
Ref: whatsnew/changelog id4835286551
Ref: 1e2a5286551
Ref: ライブラリ<109>-Footnote-15286735
Node: Core and Builtins<109>5286800
Ref: whatsnew/changelog id4845286938
Ref: 1e2b5286938
Ref: Core and Builtins<109>-Footnote-15289956
Ref: Core and Builtins<109>-Footnote-25290021
Ref: Core and Builtins<109>-Footnote-35290086
Ref: Core and Builtins<109>-Footnote-45290151
Ref: Core and Builtins<109>-Footnote-55290216
Ref: Core and Builtins<109>-Footnote-65290281
Ref: Core and Builtins<109>-Footnote-75290346
Ref: Core and Builtins<109>-Footnote-85290411
Ref: Core and Builtins<109>-Footnote-95290476
Ref: Core and Builtins<109>-Footnote-105290518
Ref: Core and Builtins<109>-Footnote-115290584
Ref: Core and Builtins<109>-Footnote-125290650
Ref: Core and Builtins<109>-Footnote-135290716
Ref: Core and Builtins<109>-Footnote-145290782
Ref: Core and Builtins<109>-Footnote-155290848
Ref: Core and Builtins<109>-Footnote-165290914
Ref: Core and Builtins<109>-Footnote-175290980
Ref: Core and Builtins<109>-Footnote-185291046
Ref: Core and Builtins<109>-Footnote-195291112
Ref: Core and Builtins<109>-Footnote-205291178
Ref: Core and Builtins<109>-Footnote-215291244
Node: ライブラリ<110>5291310
Ref: whatsnew/changelog id4855291450
Ref: 1e2c5291450
Ref: ライブラリ<110>-Footnote-15297426
Ref: ライブラリ<110>-Footnote-25297491
Ref: ライブラリ<110>-Footnote-35297556
Ref: ライブラリ<110>-Footnote-45297621
Ref: ライブラリ<110>-Footnote-55297686
Ref: ライブラリ<110>-Footnote-65297751
Ref: ライブラリ<110>-Footnote-75297816
Ref: ライブラリ<110>-Footnote-85297881
Ref: ライブラリ<110>-Footnote-95297946
Ref: ライブラリ<110>-Footnote-105298011
Ref: ライブラリ<110>-Footnote-115298077
Ref: ライブラリ<110>-Footnote-125298143
Ref: ライブラリ<110>-Footnote-135298209
Ref: ライブラリ<110>-Footnote-145298275
Ref: ライブラリ<110>-Footnote-155298341
Ref: ライブラリ<110>-Footnote-165298407
Ref: ライブラリ<110>-Footnote-175298473
Ref: ライブラリ<110>-Footnote-185298539
Ref: ライブラリ<110>-Footnote-195298605
Ref: ライブラリ<110>-Footnote-205298671
Ref: ライブラリ<110>-Footnote-215298737
Ref: ライブラリ<110>-Footnote-225298803
Ref: ライブラリ<110>-Footnote-235298869
Ref: ライブラリ<110>-Footnote-245298935
Ref: ライブラリ<110>-Footnote-255299001
Ref: ライブラリ<110>-Footnote-265299067
Ref: ライブラリ<110>-Footnote-275299133
Ref: ライブラリ<110>-Footnote-285299199
Ref: ライブラリ<110>-Footnote-295299265
Ref: ライブラリ<110>-Footnote-305299331
Ref: ライブラリ<110>-Footnote-315299397
Ref: ライブラリ<110>-Footnote-325299440
Ref: ライブラリ<110>-Footnote-335299506
Ref: ライブラリ<110>-Footnote-345299572
Ref: ライブラリ<110>-Footnote-355299638
Ref: ライブラリ<110>-Footnote-365299704
Node: ドキュメント<34>5299770
Ref: whatsnew/changelog id4865299901
Ref: 1e2e5299901
Ref: ドキュメント<34>-Footnote-15301213
Ref: ドキュメント<34>-Footnote-25301278
Ref: ドキュメント<34>-Footnote-35301343
Ref: ドキュメント<34>-Footnote-45301408
Ref: ドキュメント<34>-Footnote-55301473
Ref: ドキュメント<34>-Footnote-65301538
Ref: ドキュメント<34>-Footnote-75301603
Ref: ドキュメント<34>-Footnote-85301668
Ref: ドキュメント<34>-Footnote-95301733
Node: テスト<38>5301798
Ref: whatsnew/changelog id4875301922
Ref: 1e2f5301922
Ref: テスト<38>-Footnote-15302734
Ref: テスト<38>-Footnote-25302799
Ref: テスト<38>-Footnote-35302864
Ref: テスト<38>-Footnote-45302929
Ref: テスト<38>-Footnote-55302994
Ref: テスト<38>-Footnote-65303059
Node: ビルド<41>5303124
Ref: whatsnew/changelog id4885303237
Ref: 1e305303237
Ref: ビルド<41>-Footnote-15309037
Ref: ビルド<41>-Footnote-25309102
Ref: ビルド<41>-Footnote-35309167
Ref: ビルド<41>-Footnote-45309232
Ref: ビルド<41>-Footnote-55309297
Ref: ビルド<41>-Footnote-65309362
Ref: ビルド<41>-Footnote-75309427
Ref: ビルド<41>-Footnote-85309492
Ref: ビルド<41>-Footnote-95309557
Ref: ビルド<41>-Footnote-105309622
Ref: ビルド<41>-Footnote-115309688
Ref: ビルド<41>-Footnote-125309754
Ref: ビルド<41>-Footnote-135309820
Ref: ビルド<41>-Footnote-145309886
Ref: ビルド<41>-Footnote-155309952
Ref: ビルド<41>-Footnote-165310018
Ref: ビルド<41>-Footnote-175310084
Ref: ビルド<41>-Footnote-185310150
Ref: ビルド<41>-Footnote-195310216
Ref: ビルド<41>-Footnote-205310282
Ref: ビルド<41>-Footnote-215310348
Ref: ビルド<41>-Footnote-225310414
Ref: ビルド<41>-Footnote-235310480
Ref: ビルド<41>-Footnote-245310546
Ref: ビルド<41>-Footnote-255310612
Ref: ビルド<41>-Footnote-265310678
Ref: ビルド<41>-Footnote-275310744
Ref: ビルド<41>-Footnote-285310810
Ref: ビルド<41>-Footnote-295310876
Ref: ビルド<41>-Footnote-305310942
Ref: ビルド<41>-Footnote-315311008
Ref: ビルド<41>-Footnote-325311074
Ref: ビルド<41>-Footnote-335311140
Node: Windows<35>5311206
Ref: whatsnew/changelog id4895311315
Ref: 1e315311315
Ref: Windows<35>-Footnote-15312496
Ref: Windows<35>-Footnote-25312561
Ref: Windows<35>-Footnote-35312626
Ref: Windows<35>-Footnote-45312691
Ref: Windows<35>-Footnote-55312756
Ref: Windows<35>-Footnote-65312821
Node: macOS<26>5312886
Ref: whatsnew/changelog id4905312991
Ref: 1e325312991
Ref: macOS<26>-Footnote-15313141
Node: C API<37>5313206
Ref: whatsnew/changelog id4915313291
Ref: 1e335313291
Ref: C API<37>-Footnote-15313498
Node: Python 3 11 0 alpha 25313563
Ref: whatsnew/changelog python-3-11-0-alpha-25313693
Ref: 1e345313693
Node: Core and Builtins<110>5314065
Ref: whatsnew/changelog id4925314174
Ref: 1e355314174
Ref: Core and Builtins<110>-Footnote-15319534
Ref: Core and Builtins<110>-Footnote-25319599
Ref: Core and Builtins<110>-Footnote-35319664
Ref: Core and Builtins<110>-Footnote-45319729
Ref: Core and Builtins<110>-Footnote-55319794
Ref: Core and Builtins<110>-Footnote-65319859
Ref: Core and Builtins<110>-Footnote-75319924
Ref: Core and Builtins<110>-Footnote-85319989
Ref: Core and Builtins<110>-Footnote-95320054
Ref: Core and Builtins<110>-Footnote-105320119
Ref: Core and Builtins<110>-Footnote-115320185
Ref: Core and Builtins<110>-Footnote-125320251
Ref: Core and Builtins<110>-Footnote-135320317
Ref: Core and Builtins<110>-Footnote-145320383
Ref: Core and Builtins<110>-Footnote-155320449
Ref: Core and Builtins<110>-Footnote-165320515
Ref: Core and Builtins<110>-Footnote-175320581
Ref: Core and Builtins<110>-Footnote-185320647
Ref: Core and Builtins<110>-Footnote-195320713
Ref: Core and Builtins<110>-Footnote-205320779
Ref: Core and Builtins<110>-Footnote-215320822
Ref: Core and Builtins<110>-Footnote-225320888
Ref: Core and Builtins<110>-Footnote-235320954
Ref: Core and Builtins<110>-Footnote-245321020
Ref: Core and Builtins<110>-Footnote-255321086
Ref: Core and Builtins<110>-Footnote-265321152
Node: ライブラリ<111>5321195
Ref: whatsnew/changelog id4935321335
Ref: 1e375321335
Ref: ライブラリ<111>-Footnote-15328900
Ref: ライブラリ<111>-Footnote-25328965
Ref: ライブラリ<111>-Footnote-35329030
Ref: ライブラリ<111>-Footnote-45329095
Ref: ライブラリ<111>-Footnote-55329160
Ref: ライブラリ<111>-Footnote-65329225
Ref: ライブラリ<111>-Footnote-75329290
Ref: ライブラリ<111>-Footnote-85329355
Ref: ライブラリ<111>-Footnote-95329420
Ref: ライブラリ<111>-Footnote-105329485
Ref: ライブラリ<111>-Footnote-115329551
Ref: ライブラリ<111>-Footnote-125329617
Ref: ライブラリ<111>-Footnote-135329683
Ref: ライブラリ<111>-Footnote-145329749
Ref: ライブラリ<111>-Footnote-155329815
Ref: ライブラリ<111>-Footnote-165329881
Ref: ライブラリ<111>-Footnote-175329947
Ref: ライブラリ<111>-Footnote-185330013
Ref: ライブラリ<111>-Footnote-195330079
Ref: ライブラリ<111>-Footnote-205330145
Ref: ライブラリ<111>-Footnote-215330211
Ref: ライブラリ<111>-Footnote-225330277
Ref: ライブラリ<111>-Footnote-235330343
Ref: ライブラリ<111>-Footnote-245330409
Ref: ライブラリ<111>-Footnote-255330475
Ref: ライブラリ<111>-Footnote-265330541
Ref: ライブラリ<111>-Footnote-275330607
Ref: ライブラリ<111>-Footnote-285330673
Ref: ライブラリ<111>-Footnote-295330739
Ref: ライブラリ<111>-Footnote-305330805
Ref: ライブラリ<111>-Footnote-315330871
Ref: ライブラリ<111>-Footnote-325330937
Ref: ライブラリ<111>-Footnote-335331003
Ref: ライブラリ<111>-Footnote-345331069
Ref: ライブラリ<111>-Footnote-355331135
Ref: ライブラリ<111>-Footnote-365331201
Ref: ライブラリ<111>-Footnote-375331267
Ref: ライブラリ<111>-Footnote-385331333
Ref: ライブラリ<111>-Footnote-395331399
Ref: ライブラリ<111>-Footnote-405331465
Ref: ライブラリ<111>-Footnote-415331531
Ref: ライブラリ<111>-Footnote-425331597
Ref: ライブラリ<111>-Footnote-435331663
Ref: ライブラリ<111>-Footnote-445331723
Ref: ライブラリ<111>-Footnote-455331789
Node: ドキュメント<35>5331855
Ref: whatsnew/changelog id4945331986
Ref: 1e3c5331986
Ref: ドキュメント<35>-Footnote-15333468
Ref: ドキュメント<35>-Footnote-25333533
Ref: ドキュメント<35>-Footnote-35333598
Ref: ドキュメント<35>-Footnote-45333663
Ref: ドキュメント<35>-Footnote-55333728
Ref: ドキュメント<35>-Footnote-65333793
Ref: ドキュメント<35>-Footnote-75333858
Ref: ドキュメント<35>-Footnote-85333923
Ref: ドキュメント<35>-Footnote-95333988
Ref: ドキュメント<35>-Footnote-105334030
Ref: ドキュメント<35>-Footnote-115334096
Node: テスト<39>5334162
Ref: whatsnew/changelog id4955334286
Ref: 1e3e5334286
Ref: テスト<39>-Footnote-15336557
Ref: テスト<39>-Footnote-25336622
Ref: テスト<39>-Footnote-35336687
Ref: テスト<39>-Footnote-45336752
Ref: テスト<39>-Footnote-55336817
Ref: テスト<39>-Footnote-65336882
Ref: テスト<39>-Footnote-75336947
Ref: テスト<39>-Footnote-85337012
Ref: テスト<39>-Footnote-95337077
Ref: テスト<39>-Footnote-105337142
Ref: テスト<39>-Footnote-115337208
Ref: テスト<39>-Footnote-125337274
Ref: テスト<39>-Footnote-135337340
Node: ビルド<42>5337406
Ref: whatsnew/changelog id4965337519
Ref: 1e3f5337519
Ref: ビルド<42>-Footnote-15340199
Ref: ビルド<42>-Footnote-25340264
Ref: ビルド<42>-Footnote-35340329
Ref: ビルド<42>-Footnote-45340394
Ref: ビルド<42>-Footnote-55340459
Ref: ビルド<42>-Footnote-65340524
Ref: ビルド<42>-Footnote-75340589
Ref: ビルド<42>-Footnote-85340654
Ref: ビルド<42>-Footnote-95340719
Ref: ビルド<42>-Footnote-105340784
Ref: ビルド<42>-Footnote-115340850
Ref: ビルド<42>-Footnote-125340916
Ref: ビルド<42>-Footnote-135340982
Ref: ビルド<42>-Footnote-145341048
Ref: ビルド<42>-Footnote-155341114
Node: Windows<36>5341180
Ref: whatsnew/changelog id4975341289
Ref: 1e405341289
Ref: Windows<36>-Footnote-15341844
Ref: Windows<36>-Footnote-25341909
Ref: Windows<36>-Footnote-35341974
Node: macOS<27>5342039
Ref: whatsnew/changelog id4985342143
Ref: 1e415342143
Ref: macOS<27>-Footnote-15342404
Node: IDLE<19>5342469
Ref: whatsnew/changelog id4995342571
Ref: 1e425342571
Ref: IDLE<19>-Footnote-15342724
Node: C API<38>5342789
Ref: whatsnew/changelog id5005342873
Ref: 1e435342873
Ref: C API<38>-Footnote-15346593
Ref: C API<38>-Footnote-25346658
Ref: C API<38>-Footnote-35346723
Ref: C API<38>-Footnote-45346788
Ref: C API<38>-Footnote-55346853
Ref: C API<38>-Footnote-65346918
Ref: C API<38>-Footnote-75346983
Ref: C API<38>-Footnote-85347048
Ref: C API<38>-Footnote-95347113
Ref: C API<38>-Footnote-105347178
Ref: C API<38>-Footnote-115347244
Ref: C API<38>-Footnote-125347310
Ref: C API<38>-Footnote-135347376
Ref: C API<38>-Footnote-145347442
Node: Python 3 11 0 alpha 15347508
Ref: whatsnew/changelog python-3-11-0-alpha-15347637
Ref: 1e445347637
Node: セキュリティ<28>5348858
Ref: whatsnew/changelog id5015348969
Ref: 1e455348969
Ref: セキュリティ<28>-Footnote-15350338
Ref: セキュリティ<28>-Footnote-25350403
Ref: セキュリティ<28>-Footnote-35350468
Ref: セキュリティ<28>-Footnote-45350533
Ref: セキュリティ<28>-Footnote-55350598
Ref: セキュリティ<28>-Footnote-65350653
Ref: セキュリティ<28>-Footnote-75350718
Node: Core and Builtins<111>5350783
Ref: whatsnew/changelog id5025350923
Ref: 1e475350923
Ref: Core and Builtins<111>-Footnote-15352027
Ref: Core and Builtins<111>-Footnote-25352092
Ref: Core and Builtins<111>-Footnote-35352157
Ref: Core and Builtins<111>-Footnote-45352222
Ref: Core and Builtins<111>-Footnote-55352287
Ref: Core and Builtins<111>-Footnote-65352352
Node: ライブラリ<112>5352417
Ref: whatsnew/changelog id5035352557
Ref: 1e495352557
Ref: ライブラリ<112>-Footnote-15353060
Ref: ライブラリ<112>-Footnote-25353125
Node: Core and Builtins<112>5353190
Ref: whatsnew/changelog id5045353328
Ref: 1e4c5353328
Ref: Core and Builtins<112>-Footnote-15353509
Node: ライブラリ<113>5353574
Ref: whatsnew/changelog id5055353714
Ref: 1e4d5353714
Ref: ライブラリ<113>-Footnote-15353978
Node: Core and Builtins<113>5354043
Ref: whatsnew/changelog id5065354181
Ref: 1e4e5354181
Ref: Core and Builtins<113>-Footnote-15356995
Ref: Core and Builtins<113>-Footnote-25357060
Ref: Core and Builtins<113>-Footnote-35357125
Ref: Core and Builtins<113>-Footnote-45357192
Ref: Core and Builtins<113>-Footnote-55357257
Ref: Core and Builtins<113>-Footnote-65357322
Ref: Core and Builtins<113>-Footnote-75357387
Ref: Core and Builtins<113>-Footnote-85357452
Ref: Core and Builtins<113>-Footnote-95357517
Node: ライブラリ<114>5357582
Ref: whatsnew/changelog id5075357722
Ref: 1e4f5357722
Ref: ライブラリ<114>-Footnote-15358006
Node: Core and Builtins<114>5358071
Ref: whatsnew/changelog id5085358209
Ref: 1e505358209
Ref: Core and Builtins<114>-Footnote-15358668
Ref: Core and Builtins<114>-Footnote-25358733
Ref: Core and Builtins<114>-Footnote-35358798
Node: ライブラリ<115>5358863
Ref: whatsnew/changelog id5095359003
Ref: 1e515359003
Ref: ライブラリ<115>-Footnote-15359353
Node: Core and Builtins<115>5359418
Ref: whatsnew/changelog id5105359556
Ref: 1e525359556
Ref: Core and Builtins<115>-Footnote-15360570
Ref: Core and Builtins<115>-Footnote-25360635
Ref: Core and Builtins<115>-Footnote-35360700
Ref: Core and Builtins<115>-Footnote-45360765
Ref: Core and Builtins<115>-Footnote-55360830
Node: ライブラリ<116>5360895
Ref: whatsnew/changelog id5115361035
Ref: 1e535361035
Ref: ライブラリ<116>-Footnote-15361244
Node: Core and Builtins<116>5361309
Ref: whatsnew/changelog id5125361447
Ref: 1e545361447
Ref: Core and Builtins<116>-Footnote-15366477
Ref: Core and Builtins<116>-Footnote-25366542
Ref: Core and Builtins<116>-Footnote-35366607
Ref: Core and Builtins<116>-Footnote-45366672
Ref: Core and Builtins<116>-Footnote-55366737
Ref: Core and Builtins<116>-Footnote-65366802
Ref: Core and Builtins<116>-Footnote-75366867
Ref: Core and Builtins<116>-Footnote-85366932
Ref: Core and Builtins<116>-Footnote-95366997
Ref: Core and Builtins<116>-Footnote-105367062
Ref: Core and Builtins<116>-Footnote-115367128
Ref: Core and Builtins<116>-Footnote-125367194
Ref: Core and Builtins<116>-Footnote-135367260
Ref: Core and Builtins<116>-Footnote-145367326
Ref: Core and Builtins<116>-Footnote-155367392
Ref: Core and Builtins<116>-Footnote-165367458
Ref: Core and Builtins<116>-Footnote-175367524
Ref: Core and Builtins<116>-Footnote-185367590
Ref: Core and Builtins<116>-Footnote-195367656
Ref: Core and Builtins<116>-Footnote-205367722
Ref: Core and Builtins<116>-Footnote-215367788
Ref: Core and Builtins<116>-Footnote-225367854
Ref: Core and Builtins<116>-Footnote-235367920
Ref: Core and Builtins<116>-Footnote-245367986
Ref: Core and Builtins<116>-Footnote-255368052
Ref: Core and Builtins<116>-Footnote-265368118
Ref: Core and Builtins<116>-Footnote-275368184
Ref: Core and Builtins<116>-Footnote-285368250
Ref: Core and Builtins<116>-Footnote-295368316
Ref: Core and Builtins<116>-Footnote-305368382
Ref: Core and Builtins<116>-Footnote-315368448
Ref: Core and Builtins<116>-Footnote-325368514
Node: ライブラリ<117>5368580
Ref: whatsnew/changelog id5135368720
Ref: 1e565368720
Ref: ライブラリ<117>-Footnote-15368998
Node: Core and Builtins<117>5369063
Ref: whatsnew/changelog id5145369201
Ref: 1e575369201
Ref: Core and Builtins<117>-Footnote-15371043
Ref: Core and Builtins<117>-Footnote-25371108
Ref: Core and Builtins<117>-Footnote-35371173
Ref: Core and Builtins<117>-Footnote-45371238
Ref: Core and Builtins<117>-Footnote-55371303
Ref: Core and Builtins<117>-Footnote-65371368
Ref: Core and Builtins<117>-Footnote-75371433
Ref: Core and Builtins<117>-Footnote-85371498
Ref: Core and Builtins<117>-Footnote-95371563
Node: ライブラリ<118>5371628
Ref: whatsnew/changelog id5155371768
Ref: 1e585371768
Ref: ライブラリ<118>-Footnote-15372105
Node: Core and Builtins<118>5372170
Ref: whatsnew/changelog id5165372308
Ref: 1e595372308
Ref: Core and Builtins<118>-Footnote-15372841
Ref: Core and Builtins<118>-Footnote-25372906
Ref: Core and Builtins<118>-Footnote-35372948
Node: ライブラリ<119>5373013
Ref: whatsnew/changelog id5175373153
Ref: 1e5a5373153
Ref: ライブラリ<119>-Footnote-15373474
Node: Core and Builtins<119>5373539
Ref: whatsnew/changelog id5185373677
Ref: 1e5b5373677
Ref: Core and Builtins<119>-Footnote-15377437
Ref: Core and Builtins<119>-Footnote-25377502
Ref: Core and Builtins<119>-Footnote-35377544
Ref: Core and Builtins<119>-Footnote-45377609
Ref: Core and Builtins<119>-Footnote-55377674
Ref: Core and Builtins<119>-Footnote-65377739
Ref: Core and Builtins<119>-Footnote-75377804
Ref: Core and Builtins<119>-Footnote-85377869
Ref: Core and Builtins<119>-Footnote-95377934
Ref: Core and Builtins<119>-Footnote-105377999
Ref: Core and Builtins<119>-Footnote-115378065
Ref: Core and Builtins<119>-Footnote-125378131
Ref: Core and Builtins<119>-Footnote-135378197
Ref: Core and Builtins<119>-Footnote-145378263
Ref: Core and Builtins<119>-Footnote-155378329
Ref: Core and Builtins<119>-Footnote-165378395
Ref: Core and Builtins<119>-Footnote-175378461
Ref: Core and Builtins<119>-Footnote-185378527
Ref: Core and Builtins<119>-Footnote-195378593
Ref: Core and Builtins<119>-Footnote-205378659
Ref: Core and Builtins<119>-Footnote-215378725
Ref: Core and Builtins<119>-Footnote-225378791
Node: ライブラリ<120>5378857
Ref: whatsnew/changelog id5195378997
Ref: 1e5c5378997
Ref: ライブラリ<120>-Footnote-15379262
Node: Core and Builtins<120>5379327
Ref: whatsnew/changelog id5205379465
Ref: 1e5d5379465
Ref: Core and Builtins<120>-Footnote-15385119
Ref: Core and Builtins<120>-Footnote-25385184
Ref: Core and Builtins<120>-Footnote-35385249
Ref: Core and Builtins<120>-Footnote-45385314
Ref: Core and Builtins<120>-Footnote-55385379
Ref: Core and Builtins<120>-Footnote-65385444
Ref: Core and Builtins<120>-Footnote-75385509
Ref: Core and Builtins<120>-Footnote-85385574
Ref: Core and Builtins<120>-Footnote-95385639
Ref: Core and Builtins<120>-Footnote-105385704
Ref: Core and Builtins<120>-Footnote-115385770
Ref: Core and Builtins<120>-Footnote-125385836
Ref: Core and Builtins<120>-Footnote-135385902
Ref: Core and Builtins<120>-Footnote-145385968
Ref: Core and Builtins<120>-Footnote-155386034
Ref: Core and Builtins<120>-Footnote-165386100
Ref: Core and Builtins<120>-Footnote-175386166
Ref: Core and Builtins<120>-Footnote-185386232
Ref: Core and Builtins<120>-Footnote-195386298
Ref: Core and Builtins<120>-Footnote-205386364
Ref: Core and Builtins<120>-Footnote-215386430
Ref: Core and Builtins<120>-Footnote-225386496
Ref: Core and Builtins<120>-Footnote-235386562
Ref: Core and Builtins<120>-Footnote-245386628
Ref: Core and Builtins<120>-Footnote-255386694
Ref: Core and Builtins<120>-Footnote-265386760
Ref: Core and Builtins<120>-Footnote-275386826
Ref: Core and Builtins<120>-Footnote-285386892
Ref: Core and Builtins<120>-Footnote-295386958
Ref: Core and Builtins<120>-Footnote-305387024
Node: ライブラリ<121>5387090
Ref: whatsnew/changelog id5215387230
Ref: 1e5e5387230
Ref: ライブラリ<121>-Footnote-15427004
Ref: ライブラリ<121>-Footnote-25427069
Ref: ライブラリ<121>-Footnote-35427134
Ref: ライブラリ<121>-Footnote-45427199
Ref: ライブラリ<121>-Footnote-55427266
Ref: ライブラリ<121>-Footnote-65427331
Ref: ライブラリ<121>-Footnote-75427396
Ref: ライブラリ<121>-Footnote-85427461
Ref: ライブラリ<121>-Footnote-95427526
Ref: ライブラリ<121>-Footnote-105427591
Ref: ライブラリ<121>-Footnote-115427657
Ref: ライブラリ<121>-Footnote-125427723
Ref: ライブラリ<121>-Footnote-135427789
Ref: ライブラリ<121>-Footnote-145427855
Ref: ライブラリ<121>-Footnote-155427921
Ref: ライブラリ<121>-Footnote-165427987
Ref: ライブラリ<121>-Footnote-175428053
Ref: ライブラリ<121>-Footnote-185428119
Ref: ライブラリ<121>-Footnote-195428185
Ref: ライブラリ<121>-Footnote-205428251
Ref: ライブラリ<121>-Footnote-215428317
Ref: ライブラリ<121>-Footnote-225428383
Ref: ライブラリ<121>-Footnote-235428449
Ref: ライブラリ<121>-Footnote-245428515
Ref: ライブラリ<121>-Footnote-255428581
Ref: ライブラリ<121>-Footnote-265428647
Ref: ライブラリ<121>-Footnote-275428713
Ref: ライブラリ<121>-Footnote-285428779
Ref: ライブラリ<121>-Footnote-295428845
Ref: ライブラリ<121>-Footnote-305428911
Ref: ライブラリ<121>-Footnote-315428977
Ref: ライブラリ<121>-Footnote-325429043
Ref: ライブラリ<121>-Footnote-335429109
Ref: ライブラリ<121>-Footnote-345429175
Ref: ライブラリ<121>-Footnote-355429241
Ref: ライブラリ<121>-Footnote-365429284
Ref: ライブラリ<121>-Footnote-375429350
Ref: ライブラリ<121>-Footnote-385429416
Ref: ライブラリ<121>-Footnote-395429482
Ref: ライブラリ<121>-Footnote-405429548
Ref: ライブラリ<121>-Footnote-415429614
Ref: ライブラリ<121>-Footnote-425429680
Ref: ライブラリ<121>-Footnote-435429746
Ref: ライブラリ<121>-Footnote-445429812
Ref: ライブラリ<121>-Footnote-455429878
Ref: ライブラリ<121>-Footnote-465429944
Ref: ライブラリ<121>-Footnote-475430010
Ref: ライブラリ<121>-Footnote-485430076
Ref: ライブラリ<121>-Footnote-495430142
Ref: ライブラリ<121>-Footnote-505430208
Ref: ライブラリ<121>-Footnote-515430274
Ref: ライブラリ<121>-Footnote-525430340
Ref: ライブラリ<121>-Footnote-535430406
Ref: ライブラリ<121>-Footnote-545430472
Ref: ライブラリ<121>-Footnote-555430538
Ref: ライブラリ<121>-Footnote-565430604
Ref: ライブラリ<121>-Footnote-575430670
Ref: ライブラリ<121>-Footnote-585430736
Ref: ライブラリ<121>-Footnote-595430802
Ref: ライブラリ<121>-Footnote-605430868
Ref: ライブラリ<121>-Footnote-615430934
Ref: ライブラリ<121>-Footnote-625431000
Ref: ライブラリ<121>-Footnote-635431066
Ref: ライブラリ<121>-Footnote-645431132
Ref: ライブラリ<121>-Footnote-655431198
Ref: ライブラリ<121>-Footnote-665431264
Ref: ライブラリ<121>-Footnote-675431330
Ref: ライブラリ<121>-Footnote-685431396
Ref: ライブラリ<121>-Footnote-695431462
Ref: ライブラリ<121>-Footnote-705431528
Ref: ライブラリ<121>-Footnote-715431594
Ref: ライブラリ<121>-Footnote-725431660
Ref: ライブラリ<121>-Footnote-735431726
Ref: ライブラリ<121>-Footnote-745431792
Ref: ライブラリ<121>-Footnote-755431858
Ref: ライブラリ<121>-Footnote-765431924
Ref: ライブラリ<121>-Footnote-775431990
Ref: ライブラリ<121>-Footnote-785432056
Ref: ライブラリ<121>-Footnote-795432122
Ref: ライブラリ<121>-Footnote-805432188
Ref: ライブラリ<121>-Footnote-815432254
Ref: ライブラリ<121>-Footnote-825432320
Ref: ライブラリ<121>-Footnote-835432386
Ref: ライブラリ<121>-Footnote-845432452
Ref: ライブラリ<121>-Footnote-855432518
Ref: ライブラリ<121>-Footnote-865432584
Ref: ライブラリ<121>-Footnote-875432650
Ref: ライブラリ<121>-Footnote-885432716
Ref: ライブラリ<121>-Footnote-895432782
Ref: ライブラリ<121>-Footnote-905432848
Ref: ライブラリ<121>-Footnote-915432914
Ref: ライブラリ<121>-Footnote-925432980
Ref: ライブラリ<121>-Footnote-935433046
Ref: ライブラリ<121>-Footnote-945433112
Ref: ライブラリ<121>-Footnote-955433178
Ref: ライブラリ<121>-Footnote-965433244
Ref: ライブラリ<121>-Footnote-975433310
Ref: ライブラリ<121>-Footnote-985433376
Ref: ライブラリ<121>-Footnote-995433442
Ref: ライブラリ<121>-Footnote-1005433508
Ref: ライブラリ<121>-Footnote-1015433575
Ref: ライブラリ<121>-Footnote-1025433642
Ref: ライブラリ<121>-Footnote-1035433709
Ref: ライブラリ<121>-Footnote-1045433776
Ref: ライブラリ<121>-Footnote-1055433843
Ref: ライブラリ<121>-Footnote-1065433910
Ref: ライブラリ<121>-Footnote-1075433977
Ref: ライブラリ<121>-Footnote-1085434044
Ref: ライブラリ<121>-Footnote-1095434111
Ref: ライブラリ<121>-Footnote-1105434178
Ref: ライブラリ<121>-Footnote-1115434245
Ref: ライブラリ<121>-Footnote-1125434312
Ref: ライブラリ<121>-Footnote-1135434379
Ref: ライブラリ<121>-Footnote-1145434446
Ref: ライブラリ<121>-Footnote-1155434513
Ref: ライブラリ<121>-Footnote-1165434580
Ref: ライブラリ<121>-Footnote-1175434647
Ref: ライブラリ<121>-Footnote-1185434714
Ref: ライブラリ<121>-Footnote-1195434781
Ref: ライブラリ<121>-Footnote-1205434848
Ref: ライブラリ<121>-Footnote-1215434915
Ref: ライブラリ<121>-Footnote-1225434982
Ref: ライブラリ<121>-Footnote-1235435049
Ref: ライブラリ<121>-Footnote-1245435116
Ref: ライブラリ<121>-Footnote-1255435183
Ref: ライブラリ<121>-Footnote-1265435250
Ref: ライブラリ<121>-Footnote-1275435317
Ref: ライブラリ<121>-Footnote-1285435384
Ref: ライブラリ<121>-Footnote-1295435451
Ref: ライブラリ<121>-Footnote-1305435518
Ref: ライブラリ<121>-Footnote-1315435585
Ref: ライブラリ<121>-Footnote-1325435652
Ref: ライブラリ<121>-Footnote-1335435719
Ref: ライブラリ<121>-Footnote-1345435786
Ref: ライブラリ<121>-Footnote-1355435853
Ref: ライブラリ<121>-Footnote-1365435920
Ref: ライブラリ<121>-Footnote-1375435987
Ref: ライブラリ<121>-Footnote-1385436054
Ref: ライブラリ<121>-Footnote-1395436121
Ref: ライブラリ<121>-Footnote-1405436188
Ref: ライブラリ<121>-Footnote-1415436255
Ref: ライブラリ<121>-Footnote-1425436322
Ref: ライブラリ<121>-Footnote-1435436389
Ref: ライブラリ<121>-Footnote-1445436456
Ref: ライブラリ<121>-Footnote-1455436523
Ref: ライブラリ<121>-Footnote-1465436590
Ref: ライブラリ<121>-Footnote-1475436657
Ref: ライブラリ<121>-Footnote-1485436723
Ref: ライブラリ<121>-Footnote-1495436790
Ref: ライブラリ<121>-Footnote-1505436857
Ref: ライブラリ<121>-Footnote-1515436918
Ref: ライブラリ<121>-Footnote-1525436985
Ref: ライブラリ<121>-Footnote-1535437052
Ref: ライブラリ<121>-Footnote-1545437119
Ref: ライブラリ<121>-Footnote-1555437186
Ref: ライブラリ<121>-Footnote-1565437253
Ref: ライブラリ<121>-Footnote-1575437320
Ref: ライブラリ<121>-Footnote-1585437387
Ref: ライブラリ<121>-Footnote-1595437454
Ref: ライブラリ<121>-Footnote-1605437498
Ref: ライブラリ<121>-Footnote-1615437565
Ref: ライブラリ<121>-Footnote-1625437632
Ref: ライブラリ<121>-Footnote-1635437699
Ref: ライブラリ<121>-Footnote-1645437766
Ref: ライブラリ<121>-Footnote-1655437833
Ref: ライブラリ<121>-Footnote-1665437900
Ref: ライブラリ<121>-Footnote-1675437967
Ref: ライブラリ<121>-Footnote-1685438034
Ref: ライブラリ<121>-Footnote-1695438101
Ref: ライブラリ<121>-Footnote-1705438168
Ref: ライブラリ<121>-Footnote-1715438235
Ref: ライブラリ<121>-Footnote-1725438302
Ref: ライブラリ<121>-Footnote-1735438369
Ref: ライブラリ<121>-Footnote-1745438436
Ref: ライブラリ<121>-Footnote-1755438503
Ref: ライブラリ<121>-Footnote-1765438570
Ref: ライブラリ<121>-Footnote-1775438637
Ref: ライブラリ<121>-Footnote-1785438704
Ref: ライブラリ<121>-Footnote-1795438771
Ref: ライブラリ<121>-Footnote-1805438838
Ref: ライブラリ<121>-Footnote-1815438905
Ref: ライブラリ<121>-Footnote-1825438972
Ref: ライブラリ<121>-Footnote-1835439039
Ref: ライブラリ<121>-Footnote-1845439106
Ref: ライブラリ<121>-Footnote-1855439173
Ref: ライブラリ<121>-Footnote-1865439240
Ref: ライブラリ<121>-Footnote-1875439307
Ref: ライブラリ<121>-Footnote-1885439374
Ref: ライブラリ<121>-Footnote-1895439441
Ref: ライブラリ<121>-Footnote-1905439508
Ref: ライブラリ<121>-Footnote-1915439575
Ref: ライブラリ<121>-Footnote-1925439642
Ref: ライブラリ<121>-Footnote-1935439709
Ref: ライブラリ<121>-Footnote-1945439776
Ref: ライブラリ<121>-Footnote-1955439843
Ref: ライブラリ<121>-Footnote-1965439909
Ref: ライブラリ<121>-Footnote-1975439976
Ref: ライブラリ<121>-Footnote-1985440043
Ref: ライブラリ<121>-Footnote-1995440110
Ref: ライブラリ<121>-Footnote-2005440177
Ref: ライブラリ<121>-Footnote-2015440244
Ref: ライブラリ<121>-Footnote-2025440311
Ref: ライブラリ<121>-Footnote-2035440378
Ref: ライブラリ<121>-Footnote-2045440445
Ref: ライブラリ<121>-Footnote-2055440512
Ref: ライブラリ<121>-Footnote-2065440579
Ref: ライブラリ<121>-Footnote-2075440646
Ref: ライブラリ<121>-Footnote-2085440713
Ref: ライブラリ<121>-Footnote-2095440780
Node: ドキュメント<36>5440847
Ref: whatsnew/changelog id5225440978
Ref: 1e755440978
Ref: ドキュメント<36>-Footnote-15447270
Ref: ドキュメント<36>-Footnote-25447335
Ref: ドキュメント<36>-Footnote-35447400
Ref: ドキュメント<36>-Footnote-45447465
Ref: ドキュメント<36>-Footnote-55447530
Ref: ドキュメント<36>-Footnote-65447595
Ref: ドキュメント<36>-Footnote-75447647
Ref: ドキュメント<36>-Footnote-85447712
Ref: ドキュメント<36>-Footnote-95447777
Ref: ドキュメント<36>-Footnote-105447836
Ref: ドキュメント<36>-Footnote-115447902
Ref: ドキュメント<36>-Footnote-125447968
Ref: ドキュメント<36>-Footnote-135448034
Ref: ドキュメント<36>-Footnote-145448100
Ref: ドキュメント<36>-Footnote-155448166
Ref: ドキュメント<36>-Footnote-165448232
Ref: ドキュメント<36>-Footnote-175448298
Ref: ドキュメント<36>-Footnote-185448364
Ref: ドキュメント<36>-Footnote-195448430
Ref: ドキュメント<36>-Footnote-205448496
Ref: ドキュメント<36>-Footnote-215448562
Ref: ドキュメント<36>-Footnote-225448628
Ref: ドキュメント<36>-Footnote-235448694
Ref: ドキュメント<36>-Footnote-245448760
Ref: ドキュメント<36>-Footnote-255448826
Ref: ドキュメント<36>-Footnote-265448892
Ref: ドキュメント<36>-Footnote-275448958
Ref: ドキュメント<36>-Footnote-285449024
Ref: ドキュメント<36>-Footnote-295449090
Ref: ドキュメント<36>-Footnote-305449156
Ref: ドキュメント<36>-Footnote-315449222
Ref: ドキュメント<36>-Footnote-325449288
Ref: ドキュメント<36>-Footnote-335449354
Ref: ドキュメント<36>-Footnote-345449420
Ref: ドキュメント<36>-Footnote-355449486
Ref: ドキュメント<36>-Footnote-365449552
Ref: ドキュメント<36>-Footnote-375449618
Ref: ドキュメント<36>-Footnote-385449684
Ref: ドキュメント<36>-Footnote-395449750
Ref: ドキュメント<36>-Footnote-405449816
Ref: ドキュメント<36>-Footnote-415449882
Ref: ドキュメント<36>-Footnote-425449948
Node: テスト<40>5450014
Ref: whatsnew/changelog id5235450138
Ref: 1e775450138
Ref: テスト<40>-Footnote-15455991
Ref: テスト<40>-Footnote-25456056
Ref: テスト<40>-Footnote-35456121
Ref: テスト<40>-Footnote-45456186
Ref: テスト<40>-Footnote-55456251
Ref: テスト<40>-Footnote-65456316
Ref: テスト<40>-Footnote-75456381
Ref: テスト<40>-Footnote-85456446
Ref: テスト<40>-Footnote-95456511
Ref: テスト<40>-Footnote-105456576
Ref: テスト<40>-Footnote-115456642
Ref: テスト<40>-Footnote-125456708
Ref: テスト<40>-Footnote-135456774
Ref: テスト<40>-Footnote-145456840
Ref: テスト<40>-Footnote-155456906
Ref: テスト<40>-Footnote-165456972
Ref: テスト<40>-Footnote-175457038
Ref: テスト<40>-Footnote-185457104
Ref: テスト<40>-Footnote-195457170
Ref: テスト<40>-Footnote-205457236
Ref: テスト<40>-Footnote-215457302
Ref: テスト<40>-Footnote-225457368
Ref: テスト<40>-Footnote-235457434
Ref: テスト<40>-Footnote-245457500
Ref: テスト<40>-Footnote-255457566
Ref: テスト<40>-Footnote-265457632
Ref: テスト<40>-Footnote-275457698
Ref: テスト<40>-Footnote-285457764
Ref: テスト<40>-Footnote-295457830
Ref: テスト<40>-Footnote-305457896
Ref: テスト<40>-Footnote-315457962
Ref: テスト<40>-Footnote-325458028
Ref: テスト<40>-Footnote-335458094
Ref: テスト<40>-Footnote-345458160
Ref: テスト<40>-Footnote-355458226
Node: ビルド<43>5458292
Ref: whatsnew/changelog id5245458405
Ref: 1e7a5458405
Ref: ビルド<43>-Footnote-15460483
Ref: ビルド<43>-Footnote-25460548
Ref: ビルド<43>-Footnote-35460613
Ref: ビルド<43>-Footnote-45460678
Ref: ビルド<43>-Footnote-55460743
Ref: ビルド<43>-Footnote-65460808
Ref: ビルド<43>-Footnote-75460873
Ref: ビルド<43>-Footnote-85460938
Ref: ビルド<43>-Footnote-95461003
Ref: ビルド<43>-Footnote-105461068
Ref: ビルド<43>-Footnote-115461134
Node: Windows<37>5461200
Ref: whatsnew/changelog id5255461309
Ref: 1e7b5461309
Ref: Windows<37>-Footnote-15462419
Ref: Windows<37>-Footnote-25462484
Ref: Windows<37>-Footnote-35462549
Ref: Windows<37>-Footnote-45462614
Ref: Windows<37>-Footnote-55462679
Ref: Windows<37>-Footnote-65462744
Ref: Windows<37>-Footnote-75462809
Ref: Windows<37>-Footnote-85462874
Ref: Windows<37>-Footnote-95462939
Node: macOS<28>5463004
Ref: whatsnew/changelog id5265463108
Ref: 1e7d5463108
Ref: macOS<28>-Footnote-15464256
Ref: macOS<28>-Footnote-25464321
Ref: macOS<28>-Footnote-35464386
Ref: macOS<28>-Footnote-45464451
Ref: macOS<28>-Footnote-55464516
Ref: macOS<28>-Footnote-65464581
Ref: macOS<28>-Footnote-75464646
Node: IDLE<20>5464711
Ref: whatsnew/changelog id5275464819
Ref: 1e7e5464819
Ref: IDLE<20>-Footnote-15466335
Ref: IDLE<20>-Footnote-25466400
Ref: IDLE<20>-Footnote-35466465
Ref: IDLE<20>-Footnote-45466530
Ref: IDLE<20>-Footnote-55466595
Ref: IDLE<20>-Footnote-65466660
Ref: IDLE<20>-Footnote-75466725
Ref: IDLE<20>-Footnote-85466790
Ref: IDLE<20>-Footnote-95466855
Node: Tools/Demos<25>5466920
Ref: whatsnew/changelog id5285467028
Ref: 1e7f5467028
Ref: Tools/Demos<25>-Footnote-15467824
Ref: Tools/Demos<25>-Footnote-25467889
Ref: Tools/Demos<25>-Footnote-35467954
Ref: Tools/Demos<25>-Footnote-45468019
Ref: Tools/Demos<25>-Footnote-55468084
Ref: Tools/Demos<25>-Footnote-65468149
Node: C API<39>5468214
Ref: whatsnew/changelog id5295468305
Ref: 1e805468305
Ref: C API<39>-Footnote-15474145
Ref: C API<39>-Footnote-25474210
Ref: C API<39>-Footnote-35474275
Ref: C API<39>-Footnote-45474340
Ref: C API<39>-Footnote-55474405
Ref: C API<39>-Footnote-65474470
Ref: C API<39>-Footnote-75474535
Ref: C API<39>-Footnote-85474600
Ref: C API<39>-Footnote-95474665
Ref: C API<39>-Footnote-105474730
Ref: C API<39>-Footnote-115474796
Ref: C API<39>-Footnote-125474862
Ref: C API<39>-Footnote-135474928
Ref: C API<39>-Footnote-145474994
Ref: C API<39>-Footnote-155475060
Ref: C API<39>-Footnote-165475126
Ref: C API<39>-Footnote-175475192
Ref: C API<39>-Footnote-185475258
Ref: C API<39>-Footnote-195475324
Ref: C API<39>-Footnote-205475390
Ref: C API<39>-Footnote-215475433
Ref: C API<39>-Footnote-225475499
Ref: C API<39>-Footnote-235475565
Ref: C API<39>-Footnote-245475631
Ref: C API<39>-Footnote-255475674
Ref: C API<39>-Footnote-265475717
Node: Python 3 10 0 beta 15475783
Ref: whatsnew/changelog python-3-10-0-beta-15475912
Ref: 1e825475912
Node: セキュリティ<29>5476500
Ref: whatsnew/changelog id5305476610
Ref: 1e835476610
Ref: セキュリティ<29>-Footnote-15479548
Ref: セキュリティ<29>-Footnote-25479613
Ref: セキュリティ<29>-Footnote-35479678
Ref: セキュリティ<29>-Footnote-45479743
Ref: セキュリティ<29>-Footnote-55479808
Ref: セキュリティ<29>-Footnote-65479873
Ref: セキュリティ<29>-Footnote-75479938
Ref: セキュリティ<29>-Footnote-85480003
Ref: セキュリティ<29>-Footnote-95480068
Ref: セキュリティ<29>-Footnote-105480133
Ref: セキュリティ<29>-Footnote-115480199
Node: Core and Builtins<121>5480265
Ref: whatsnew/changelog id5315480404
Ref: 1e865480404
Ref: Core and Builtins<121>-Footnote-15481758
Ref: Core and Builtins<121>-Footnote-25481823
Ref: Core and Builtins<121>-Footnote-35481888
Ref: Core and Builtins<121>-Footnote-45481953
Ref: Core and Builtins<121>-Footnote-55482018
Ref: Core and Builtins<121>-Footnote-65482083
Ref: Core and Builtins<121>-Footnote-75482148
Node: ライブラリ<122>5482213
Ref: whatsnew/changelog id5325482352
Ref: 1e885482352
Ref: ライブラリ<122>-Footnote-15482628
Ref: ライブラリ<122>-Footnote-25482693
Node: Core and Builtins<122>5482758
Ref: whatsnew/changelog id5335482895
Ref: 1e895482895
Ref: Core and Builtins<122>-Footnote-15486912
Ref: Core and Builtins<122>-Footnote-25486977
Ref: Core and Builtins<122>-Footnote-35487042
Ref: Core and Builtins<122>-Footnote-45487107
Ref: Core and Builtins<122>-Footnote-55487172
Ref: Core and Builtins<122>-Footnote-65487214
Ref: Core and Builtins<122>-Footnote-75487279
Ref: Core and Builtins<122>-Footnote-85487344
Ref: Core and Builtins<122>-Footnote-95487409
Ref: Core and Builtins<122>-Footnote-105487474
Ref: Core and Builtins<122>-Footnote-115487540
Ref: Core and Builtins<122>-Footnote-125487606
Ref: Core and Builtins<122>-Footnote-135487672
Ref: Core and Builtins<122>-Footnote-145487738
Ref: Core and Builtins<122>-Footnote-155487804
Ref: Core and Builtins<122>-Footnote-165487870
Ref: Core and Builtins<122>-Footnote-175487936
Ref: Core and Builtins<122>-Footnote-185488002
Ref: Core and Builtins<122>-Footnote-195488068
Ref: Core and Builtins<122>-Footnote-205488134
Ref: Core and Builtins<122>-Footnote-215488200
Ref: Core and Builtins<122>-Footnote-225488266
Node: ライブラリ<123>5488332
Ref: whatsnew/changelog id5345488471
Ref: 1e8c5488471
Ref: ライブラリ<123>-Footnote-15488673
Node: Core and Builtins<123>5488738
Ref: whatsnew/changelog id5355488875
Ref: 1e8d5488875
Ref: Core and Builtins<123>-Footnote-15489528
Ref: Core and Builtins<123>-Footnote-25489593
Ref: Core and Builtins<123>-Footnote-35489658
Node: ライブラリ<124>5489723
Ref: whatsnew/changelog id5365489862
Ref: 1e8e5489862
Ref: ライブラリ<124>-Footnote-15506624
Ref: ライブラリ<124>-Footnote-25506689
Ref: ライブラリ<124>-Footnote-35506754
Ref: ライブラリ<124>-Footnote-45506819
Ref: ライブラリ<124>-Footnote-55506884
Ref: ライブラリ<124>-Footnote-65506949
Ref: ライブラリ<124>-Footnote-75507014
Ref: ライブラリ<124>-Footnote-85507079
Ref: ライブラリ<124>-Footnote-95507144
Ref: ライブラリ<124>-Footnote-105507209
Ref: ライブラリ<124>-Footnote-115507275
Ref: ライブラリ<124>-Footnote-125507341
Ref: ライブラリ<124>-Footnote-135507407
Ref: ライブラリ<124>-Footnote-145507473
Ref: ライブラリ<124>-Footnote-155507539
Ref: ライブラリ<124>-Footnote-165507605
Ref: ライブラリ<124>-Footnote-175507671
Ref: ライブラリ<124>-Footnote-185507737
Ref: ライブラリ<124>-Footnote-195507803
Ref: ライブラリ<124>-Footnote-205507869
Ref: ライブラリ<124>-Footnote-215507935
Ref: ライブラリ<124>-Footnote-225508001
Ref: ライブラリ<124>-Footnote-235508044
Ref: ライブラリ<124>-Footnote-245508110
Ref: ライブラリ<124>-Footnote-255508176
Ref: ライブラリ<124>-Footnote-265508242
Ref: ライブラリ<124>-Footnote-275508308
Ref: ライブラリ<124>-Footnote-285508374
Ref: ライブラリ<124>-Footnote-295508440
Ref: ライブラリ<124>-Footnote-305508506
Ref: ライブラリ<124>-Footnote-315508572
Ref: ライブラリ<124>-Footnote-325508638
Ref: ライブラリ<124>-Footnote-335508704
Ref: ライブラリ<124>-Footnote-345508770
Ref: ライブラリ<124>-Footnote-355508836
Ref: ライブラリ<124>-Footnote-365508902
Ref: ライブラリ<124>-Footnote-375508968
Ref: ライブラリ<124>-Footnote-385509034
Ref: ライブラリ<124>-Footnote-395509100
Ref: ライブラリ<124>-Footnote-405509166
Ref: ライブラリ<124>-Footnote-415509232
Ref: ライブラリ<124>-Footnote-425509298
Ref: ライブラリ<124>-Footnote-435509341
Ref: ライブラリ<124>-Footnote-445509407
Ref: ライブラリ<124>-Footnote-455509473
Ref: ライブラリ<124>-Footnote-465509529
Ref: ライブラリ<124>-Footnote-475509595
Ref: ライブラリ<124>-Footnote-485509661
Ref: ライブラリ<124>-Footnote-495509727
Ref: ライブラリ<124>-Footnote-505509793
Ref: ライブラリ<124>-Footnote-515509859
Ref: ライブラリ<124>-Footnote-525509925
Ref: ライブラリ<124>-Footnote-535509991
Ref: ライブラリ<124>-Footnote-545510056
Ref: ライブラリ<124>-Footnote-555510122
Ref: ライブラリ<124>-Footnote-565510188
Ref: ライブラリ<124>-Footnote-575510254
Ref: ライブラリ<124>-Footnote-585510319
Ref: ライブラリ<124>-Footnote-595510385
Ref: ライブラリ<124>-Footnote-605510451
Ref: ライブラリ<124>-Footnote-615510517
Ref: ライブラリ<124>-Footnote-625510583
Ref: ライブラリ<124>-Footnote-635510649
Ref: ライブラリ<124>-Footnote-645510715
Ref: ライブラリ<124>-Footnote-655510781
Ref: ライブラリ<124>-Footnote-665510847
Ref: ライブラリ<124>-Footnote-675510913
Ref: ライブラリ<124>-Footnote-685510979
Ref: ライブラリ<124>-Footnote-695511022
Ref: ライブラリ<124>-Footnote-705511088
Ref: ライブラリ<124>-Footnote-715511154
Ref: ライブラリ<124>-Footnote-725511220
Ref: ライブラリ<124>-Footnote-735511286
Ref: ライブラリ<124>-Footnote-745511352
Ref: ライブラリ<124>-Footnote-755511418
Ref: ライブラリ<124>-Footnote-765511484
Ref: ライブラリ<124>-Footnote-775511550
Ref: ライブラリ<124>-Footnote-785511616
Ref: ライブラリ<124>-Footnote-795511682
Ref: ライブラリ<124>-Footnote-805511748
Ref: ライブラリ<124>-Footnote-815511814
Ref: ライブラリ<124>-Footnote-825511880
Ref: ライブラリ<124>-Footnote-835511946
Node: ドキュメント<37>5512012
Ref: whatsnew/changelog id5375512142
Ref: 1e945512142
Ref: ドキュメント<37>-Footnote-15513154
Ref: ドキュメント<37>-Footnote-25513219
Ref: ドキュメント<37>-Footnote-35513284
Ref: ドキュメント<37>-Footnote-45513349
Ref: ドキュメント<37>-Footnote-55513414
Ref: ドキュメント<37>-Footnote-65513479
Ref: ドキュメント<37>-Footnote-75513544
Node: テスト<41>5513609
Ref: whatsnew/changelog id5385513732
Ref: 1e955513732
Ref: テスト<41>-Footnote-15514814
Ref: テスト<41>-Footnote-25514879
Ref: テスト<41>-Footnote-35514944
Ref: テスト<41>-Footnote-45515009
Ref: テスト<41>-Footnote-55515074
Node: ビルド<44>5515139
Ref: whatsnew/changelog id5395515251
Ref: 1e965515251
Ref: ビルド<44>-Footnote-15515518
Ref: ビルド<44>-Footnote-25515583
Ref: ビルド<44>-Footnote-35515648
Node: Windows<38>5515690
Ref: whatsnew/changelog id5405515798
Ref: 1e975515798
Ref: Windows<38>-Footnote-15517141
Ref: Windows<38>-Footnote-25517206
Ref: Windows<38>-Footnote-35517271
Ref: Windows<38>-Footnote-45517336
Ref: Windows<38>-Footnote-55517401
Ref: Windows<38>-Footnote-65517466
Ref: Windows<38>-Footnote-75517531
Ref: Windows<38>-Footnote-85517596
Ref: Windows<38>-Footnote-95517661
Node: macOS<29>5517726
Ref: whatsnew/changelog id5415517829
Ref: 1e9b5517829
Ref: macOS<29>-Footnote-15519129
Ref: macOS<29>-Footnote-25519194
Ref: macOS<29>-Footnote-35519259
Ref: macOS<29>-Footnote-45519324
Ref: macOS<29>-Footnote-55519389
Ref: macOS<29>-Footnote-65519454
Node: IDLE<21>5519519
Ref: whatsnew/changelog id5425519620
Ref: 1e9c5519620
Ref: IDLE<21>-Footnote-15520416
Ref: IDLE<21>-Footnote-25520481
Ref: IDLE<21>-Footnote-35520546
Ref: IDLE<21>-Footnote-45520611
Ref: IDLE<21>-Footnote-55520676
Node: C API<40>5520741
Ref: whatsnew/changelog id5435520824
Ref: 1e9d5520824
Ref: C API<40>-Footnote-15523073
Ref: C API<40>-Footnote-25523138
Ref: C API<40>-Footnote-35523203
Ref: C API<40>-Footnote-45523268
Ref: C API<40>-Footnote-55523333
Ref: C API<40>-Footnote-65523398
Ref: C API<40>-Footnote-75523463
Ref: C API<40>-Footnote-85523528
Ref: C API<40>-Footnote-95523593
Ref: C API<40>-Footnote-105523635
Node: Python 3 10 0 alpha 75523701
Ref: whatsnew/changelog python-3-10-0-alpha-75523830
Ref: 1e9e5523830
Node: セキュリティ<30>5524311
Ref: whatsnew/changelog id5445524422
Ref: 1e9f5524422
Ref: セキュリティ<30>-Footnote-15525520
Ref: セキュリティ<30>-Footnote-25525585
Ref: セキュリティ<30>-Footnote-35525640
Ref: セキュリティ<30>-Footnote-45525705
Node: Core and Builtins<124>5525770
Ref: whatsnew/changelog id5455525910
Ref: 1ea05525910
Ref: Core and Builtins<124>-Footnote-15526530
Ref: Core and Builtins<124>-Footnote-25526595
Ref: Core and Builtins<124>-Footnote-35526660
Ref: Core and Builtins<124>-Footnote-45526725
Node: ライブラリ<125>5526790
Ref: whatsnew/changelog id5465526930
Ref: 1ea15526930
Ref: ライブラリ<125>-Footnote-15527119
Node: Core and Builtins<125>5527184
Ref: whatsnew/changelog id5475527322
Ref: 1ea25527322
Ref: Core and Builtins<125>-Footnote-15531201
Ref: Core and Builtins<125>-Footnote-25531266
Ref: Core and Builtins<125>-Footnote-35531331
Ref: Core and Builtins<125>-Footnote-45531396
Ref: Core and Builtins<125>-Footnote-55531438
Ref: Core and Builtins<125>-Footnote-65531503
Ref: Core and Builtins<125>-Footnote-75531568
Ref: Core and Builtins<125>-Footnote-85531633
Ref: Core and Builtins<125>-Footnote-95531698
Ref: Core and Builtins<125>-Footnote-105531763
Ref: Core and Builtins<125>-Footnote-115531829
Ref: Core and Builtins<125>-Footnote-125531895
Ref: Core and Builtins<125>-Footnote-135531961
Ref: Core and Builtins<125>-Footnote-145532027
Ref: Core and Builtins<125>-Footnote-155532093
Ref: Core and Builtins<125>-Footnote-165532159
Ref: Core and Builtins<125>-Footnote-175532225
Ref: Core and Builtins<125>-Footnote-185532268
Ref: Core and Builtins<125>-Footnote-195532334
Node: ライブラリ<126>5532400
Ref: whatsnew/changelog id5485532540
Ref: 1ea35532540
Ref: ライブラリ<126>-Footnote-15540219
Ref: ライブラリ<126>-Footnote-25540284
Ref: ライブラリ<126>-Footnote-35540349
Ref: ライブラリ<126>-Footnote-45540414
Ref: ライブラリ<126>-Footnote-55540479
Ref: ライブラリ<126>-Footnote-65540544
Ref: ライブラリ<126>-Footnote-75540609
Ref: ライブラリ<126>-Footnote-85540674
Ref: ライブラリ<126>-Footnote-95540739
Ref: ライブラリ<126>-Footnote-105540804
Ref: ライブラリ<126>-Footnote-115540870
Ref: ライブラリ<126>-Footnote-125540936
Ref: ライブラリ<126>-Footnote-135541002
Ref: ライブラリ<126>-Footnote-145541068
Ref: ライブラリ<126>-Footnote-155541134
Ref: ライブラリ<126>-Footnote-165541177
Ref: ライブラリ<126>-Footnote-175541243
Ref: ライブラリ<126>-Footnote-185541309
Ref: ライブラリ<126>-Footnote-195541375
Ref: ライブラリ<126>-Footnote-205541441
Ref: ライブラリ<126>-Footnote-215541507
Ref: ライブラリ<126>-Footnote-225541573
Ref: ライブラリ<126>-Footnote-235541639
Ref: ライブラリ<126>-Footnote-245541705
Ref: ライブラリ<126>-Footnote-255541771
Ref: ライブラリ<126>-Footnote-265541853
Ref: ライブラリ<126>-Footnote-275541919
Ref: ライブラリ<126>-Footnote-285541985
Ref: ライブラリ<126>-Footnote-295542051
Ref: ライブラリ<126>-Footnote-305542117
Ref: ライブラリ<126>-Footnote-315542183
Ref: ライブラリ<126>-Footnote-325542249
Ref: ライブラリ<126>-Footnote-335542315
Ref: ライブラリ<126>-Footnote-345542381
Ref: ライブラリ<126>-Footnote-355542447
Ref: ライブラリ<126>-Footnote-365542513
Ref: ライブラリ<126>-Footnote-375542579
Ref: ライブラリ<126>-Footnote-385542645
Ref: ライブラリ<126>-Footnote-395542711
Ref: ライブラリ<126>-Footnote-405542777
Ref: ライブラリ<126>-Footnote-415542843
Ref: ライブラリ<126>-Footnote-425542909
Ref: ライブラリ<126>-Footnote-435542975
Ref: ライブラリ<126>-Footnote-445543041
Ref: ライブラリ<126>-Footnote-455543107
Node: ドキュメント<38>5543173
Ref: whatsnew/changelog id5495543304
Ref: 1eab5543304
Ref: ドキュメント<38>-Footnote-15544002
Ref: ドキュメント<38>-Footnote-25544067
Ref: ドキュメント<38>-Footnote-35544132
Ref: ドキュメント<38>-Footnote-45544197
Node: テスト<42>5544262
Ref: whatsnew/changelog id5505544386
Ref: 1eac5544386
Ref: テスト<42>-Footnote-15544694
Ref: テスト<42>-Footnote-25544759
Node: ビルド<45>5544824
Ref: whatsnew/changelog id5515544937
Ref: 1ead5544937
Ref: ビルド<45>-Footnote-15545913
Ref: ビルド<45>-Footnote-25545978
Ref: ビルド<45>-Footnote-35546043
Ref: ビルド<45>-Footnote-45546108
Ref: ビルド<45>-Footnote-55546173
Ref: ビルド<45>-Footnote-65546238
Node: Windows<39>5546303
Ref: whatsnew/changelog id5525546411
Ref: 1eae5546411
Ref: Windows<39>-Footnote-15546601
Node: IDLE<22>5546666
Ref: whatsnew/changelog id5535546770
Ref: 1eaf5546770
Ref: IDLE<22>-Footnote-15547013
Node: C API<41>5547078
Ref: whatsnew/changelog id5545547162
Ref: 1eb05547162
Ref: C API<41>-Footnote-15550628
Ref: C API<41>-Footnote-25550693
Ref: C API<41>-Footnote-35550758
Ref: C API<41>-Footnote-45550823
Ref: C API<41>-Footnote-55550888
Ref: C API<41>-Footnote-65550953
Ref: C API<41>-Footnote-75551018
Ref: C API<41>-Footnote-85551083
Ref: C API<41>-Footnote-95551148
Node: Python 3 10 0 alpha 65551190
Ref: whatsnew/changelog python-3-10-0-alpha-65551320
Ref: 1eb15551320
Node: セキュリティ<31>5551907
Ref: whatsnew/changelog id5555552018
Ref: 1eb25552018
Ref: セキュリティ<31>-Footnote-15552278
Node: Core and Builtins<126>5552343
Ref: whatsnew/changelog id5565552483
Ref: 1eb35552483
Ref: Core and Builtins<126>-Footnote-15554128
Ref: Core and Builtins<126>-Footnote-25554193
Ref: Core and Builtins<126>-Footnote-35554258
Ref: Core and Builtins<126>-Footnote-45554300
Ref: Core and Builtins<126>-Footnote-55554365
Ref: Core and Builtins<126>-Footnote-65554430
Ref: Core and Builtins<126>-Footnote-75554495
Ref: Core and Builtins<126>-Footnote-85554560
Node: ライブラリ<127>5554625
Ref: whatsnew/changelog id5575554765
Ref: 1eb45554765
Ref: ライブラリ<127>-Footnote-15555472
Node: Core and Builtins<127>5555537
Ref: whatsnew/changelog id5585555675
Ref: 1eb55555675
Ref: Core and Builtins<127>-Footnote-15556365
Ref: Core and Builtins<127>-Footnote-25556430
Ref: Core and Builtins<127>-Footnote-35556495
Ref: Core and Builtins<127>-Footnote-45556560
Ref: Core and Builtins<127>-Footnote-55556625
Node: ライブラリ<128>5556667
Ref: whatsnew/changelog id5595556807
Ref: 1eb65556807
Ref: ライブラリ<128>-Footnote-15557228
Node: Core and Builtins<128>5557293
Ref: whatsnew/changelog id5605557431
Ref: 1eb75557431
Ref: Core and Builtins<128>-Footnote-15557744
Node: ライブラリ<129>5557809
Ref: whatsnew/changelog id5615557949
Ref: 1eb85557949
Ref: ライブラリ<129>-Footnote-15560796
Ref: ライブラリ<129>-Footnote-25560861
Ref: ライブラリ<129>-Footnote-35560926
Ref: ライブラリ<129>-Footnote-45560991
Ref: ライブラリ<129>-Footnote-55561056
Ref: ライブラリ<129>-Footnote-65561121
Ref: ライブラリ<129>-Footnote-75561186
Ref: ライブラリ<129>-Footnote-85561251
Ref: ライブラリ<129>-Footnote-95561316
Ref: ライブラリ<129>-Footnote-105561381
Ref: ライブラリ<129>-Footnote-115561447
Ref: ライブラリ<129>-Footnote-125561513
Ref: ライブラリ<129>-Footnote-135561579
Ref: ライブラリ<129>-Footnote-145561645
Ref: ライブラリ<129>-Footnote-155561711
Ref: ライブラリ<129>-Footnote-165561777
Node: ドキュメント<39>5561843
Ref: whatsnew/changelog id5625561974
Ref: 1ebc5561974
Ref: ドキュメント<39>-Footnote-15562320
Ref: ドキュメント<39>-Footnote-25562385
Ref: ドキュメント<39>-Footnote-35562450
Node: テスト<43>5562492
Ref: whatsnew/changelog id5635562616
Ref: 1ebd5562616
Ref: テスト<43>-Footnote-15562812
Node: ビルド<46>5562877
Ref: whatsnew/changelog id5645562990
Ref: 1ebe5562990
Ref: ビルド<46>-Footnote-15564062
Ref: ビルド<46>-Footnote-25564127
Ref: ビルド<46>-Footnote-35564192
Ref: ビルド<46>-Footnote-45564257
Ref: ビルド<46>-Footnote-55564322
Node: Windows<40>5564387
Ref: whatsnew/changelog id5655564496
Ref: 1ebf5564496
Ref: Windows<40>-Footnote-15564662
Node: macOS<30>5564727
Ref: whatsnew/changelog id5665564831
Ref: 1ec15564831
Ref: macOS<30>-Footnote-15564974
Node: IDLE<23>5565039
Ref: whatsnew/changelog id5675565141
Ref: 1ec25565141
Ref: IDLE<23>-Footnote-15565411
Node: C API<42>5565476
Ref: whatsnew/changelog id5685565560
Ref: 1ec35565560
Ref: C API<42>-Footnote-15567314
Ref: C API<42>-Footnote-25567379
Ref: C API<42>-Footnote-35567444
Ref: C API<42>-Footnote-45567509
Ref: C API<42>-Footnote-55567574
Ref: C API<42>-Footnote-65567639
Ref: C API<42>-Footnote-75567704
Ref: C API<42>-Footnote-85567769
Ref: C API<42>-Footnote-95567834
Node: Python 3 10 0 alpha 55567899
Ref: whatsnew/changelog python-3-10-0-alpha-55568029
Ref: 1ecb5568029
Node: セキュリティ<32>5568530
Ref: whatsnew/changelog id5695568641
Ref: 1ecc5568641
Ref: セキュリティ<32>-Footnote-15568877
Node: Core and Builtins<129>5568942
Ref: whatsnew/changelog id5705569082
Ref: 1ecf5569082
Ref: Core and Builtins<129>-Footnote-15571208
Ref: Core and Builtins<129>-Footnote-25571273
Ref: Core and Builtins<129>-Footnote-35571338
Ref: Core and Builtins<129>-Footnote-45571403
Ref: Core and Builtins<129>-Footnote-55571468
Ref: Core and Builtins<129>-Footnote-65571533
Ref: Core and Builtins<129>-Footnote-75571598
Ref: Core and Builtins<129>-Footnote-85571663
Ref: Core and Builtins<129>-Footnote-95571728
Ref: Core and Builtins<129>-Footnote-105571793
Ref: Core and Builtins<129>-Footnote-115571859
Ref: Core and Builtins<129>-Footnote-125571925
Node: ライブラリ<130>5571991
Ref: whatsnew/changelog id5715572131
Ref: 1ed05572131
Ref: ライブラリ<130>-Footnote-15572366
Node: Core and Builtins<130>5572431
Ref: whatsnew/changelog id5725572569
Ref: 1ed15572569
Ref: Core and Builtins<130>-Footnote-15572908
Ref: Core and Builtins<130>-Footnote-25572973
Node: ライブラリ<131>5573038
Ref: whatsnew/changelog id5735573178
Ref: 1ed25573178
Ref: ライブラリ<131>-Footnote-15578113
Ref: ライブラリ<131>-Footnote-25578178
Ref: ライブラリ<131>-Footnote-35578243
Ref: ライブラリ<131>-Footnote-45578308
Ref: ライブラリ<131>-Footnote-55578373
Ref: ライブラリ<131>-Footnote-65578438
Ref: ライブラリ<131>-Footnote-75578503
Ref: ライブラリ<131>-Footnote-85578568
Ref: ライブラリ<131>-Footnote-95578633
Ref: ライブラリ<131>-Footnote-105578698
Ref: ライブラリ<131>-Footnote-115578764
Ref: ライブラリ<131>-Footnote-125578830
Ref: ライブラリ<131>-Footnote-135578896
Ref: ライブラリ<131>-Footnote-145578962
Ref: ライブラリ<131>-Footnote-155579028
Ref: ライブラリ<131>-Footnote-165579094
Ref: ライブラリ<131>-Footnote-175579160
Ref: ライブラリ<131>-Footnote-185579226
Ref: ライブラリ<131>-Footnote-195579269
Ref: ライブラリ<131>-Footnote-205579335
Ref: ライブラリ<131>-Footnote-215579401
Ref: ライブラリ<131>-Footnote-225579467
Ref: ライブラリ<131>-Footnote-235579533
Ref: ライブラリ<131>-Footnote-245579601
Ref: ライブラリ<131>-Footnote-255579644
Ref: ライブラリ<131>-Footnote-265579710
Ref: ライブラリ<131>-Footnote-275579776
Ref: ライブラリ<131>-Footnote-285579842
Ref: ライブラリ<131>-Footnote-295579908
Ref: ライブラリ<131>-Footnote-305579974
Ref: ライブラリ<131>-Footnote-315580040
Ref: ライブラリ<131>-Footnote-325580106
Ref: ライブラリ<131>-Footnote-335580172
Ref: ライブラリ<131>-Footnote-345580238
Node: ドキュメント<40>5580304
Ref: whatsnew/changelog id5745580435
Ref: 1ed35580435
Ref: ドキュメント<40>-Footnote-15580767
Ref: ドキュメント<40>-Footnote-25580832
Node: テスト<44>5580897
Ref: whatsnew/changelog id5755581021
Ref: 1ed45581021
Ref: テスト<44>-Footnote-15581382
Ref: テスト<44>-Footnote-25581447
Node: ビルド<47>5581512
Ref: whatsnew/changelog id5765581625
Ref: 1ed55581625
Ref: ビルド<47>-Footnote-15582823
Ref: ビルド<47>-Footnote-25582888
Ref: ビルド<47>-Footnote-35582953
Ref: ビルド<47>-Footnote-45583018
Ref: ビルド<47>-Footnote-55583083
Node: Windows<41>5583148
Ref: whatsnew/changelog id5775583257
Ref: 1ed65583257
Ref: Windows<41>-Footnote-15583470
Ref: Windows<41>-Footnote-25583535
Node: macOS<31>5583600
Ref: whatsnew/changelog id5785583704
Ref: 1ed75583704
Ref: macOS<31>-Footnote-15583953
Node: IDLE<24>5584018
Ref: whatsnew/changelog id5795584120
Ref: 1ed85584120
Ref: IDLE<24>-Footnote-15584684
Ref: IDLE<24>-Footnote-25584749
Ref: IDLE<24>-Footnote-35584814
Ref: IDLE<24>-Footnote-45584879
Node: C API<43>5584944
Ref: whatsnew/changelog id5805585028
Ref: 1ed95585028
Ref: C API<43>-Footnote-15585634
Ref: C API<43>-Footnote-25585699
Node: Python 3 10 0 alpha 45585764
Ref: whatsnew/changelog python-3-10-0-alpha-45585894
Ref: 1edb5585894
Node: Core and Builtins<131>5586425
Ref: whatsnew/changelog id5815586534
Ref: 1edc5586534
Ref: Core and Builtins<131>-Footnote-15588006
Ref: Core and Builtins<131>-Footnote-25588071
Ref: Core and Builtins<131>-Footnote-35588136
Ref: Core and Builtins<131>-Footnote-45588201
Ref: Core and Builtins<131>-Footnote-55588266
Ref: Core and Builtins<131>-Footnote-65588331
Ref: Core and Builtins<131>-Footnote-75588396
Ref: Core and Builtins<131>-Footnote-85588461
Ref: Core and Builtins<131>-Footnote-95588526
Ref: Core and Builtins<131>-Footnote-105588591
Node: ライブラリ<132>5588657
Ref: whatsnew/changelog id5825588797
Ref: 1edd5588797
Ref: ライブラリ<132>-Footnote-15589073
Node: Core and Builtins<132>5589138
Ref: whatsnew/changelog id5835589276
Ref: 1ede5589276
Ref: Core and Builtins<132>-Footnote-15589553
Node: ライブラリ<133>5589618
Ref: whatsnew/changelog id5845589758
Ref: 1ee05589758
Ref: ライブラリ<133>-Footnote-15591019
Ref: ライブラリ<133>-Footnote-25591084
Ref: ライブラリ<133>-Footnote-35591126
Ref: ライブラリ<133>-Footnote-45591191
Ref: ライブラリ<133>-Footnote-55591256
Ref: ライブラリ<133>-Footnote-65591321
Ref: ライブラリ<133>-Footnote-75591388
Node: Core and Builtins<133>5591430
Ref: whatsnew/changelog id5855591568
Ref: 1ee15591568
Ref: Core and Builtins<133>-Footnote-15592023
Ref: Core and Builtins<133>-Footnote-25592088
Node: ライブラリ<134>5592153
Ref: whatsnew/changelog id5865592293
Ref: 1ee25592293
Ref: ライブラリ<134>-Footnote-15601118
Ref: ライブラリ<134>-Footnote-25601183
Ref: ライブラリ<134>-Footnote-35601248
Ref: ライブラリ<134>-Footnote-45601313
Ref: ライブラリ<134>-Footnote-55601378
Ref: ライブラリ<134>-Footnote-65601443
Ref: ライブラリ<134>-Footnote-75601508
Ref: ライブラリ<134>-Footnote-85601550
Ref: ライブラリ<134>-Footnote-95601592
Ref: ライブラリ<134>-Footnote-105601657
Ref: ライブラリ<134>-Footnote-115601723
Ref: ライブラリ<134>-Footnote-125601789
Ref: ライブラリ<134>-Footnote-135601855
Ref: ライブラリ<134>-Footnote-145601921
Ref: ライブラリ<134>-Footnote-155601987
Ref: ライブラリ<134>-Footnote-165602053
Ref: ライブラリ<134>-Footnote-175602119
Ref: ライブラリ<134>-Footnote-185602185
Ref: ライブラリ<134>-Footnote-195602250
Ref: ライブラリ<134>-Footnote-205602318
Ref: ライブラリ<134>-Footnote-215602361
Ref: ライブラリ<134>-Footnote-225602427
Ref: ライブラリ<134>-Footnote-235602493
Ref: ライブラリ<134>-Footnote-245602559
Ref: ライブラリ<134>-Footnote-255602625
Ref: ライブラリ<134>-Footnote-265602691
Ref: ライブラリ<134>-Footnote-275602757
Ref: ライブラリ<134>-Footnote-285602823
Ref: ライブラリ<134>-Footnote-295602889
Ref: ライブラリ<134>-Footnote-305602955
Ref: ライブラリ<134>-Footnote-315603021
Ref: ライブラリ<134>-Footnote-325603087
Ref: ライブラリ<134>-Footnote-335603130
Ref: ライブラリ<134>-Footnote-345603196
Ref: ライブラリ<134>-Footnote-355603262
Ref: ライブラリ<134>-Footnote-365603328
Ref: ライブラリ<134>-Footnote-375603394
Ref: ライブラリ<134>-Footnote-385603460
Ref: ライブラリ<134>-Footnote-395603526
Ref: ライブラリ<134>-Footnote-405603592
Ref: ライブラリ<134>-Footnote-415603658
Ref: ライブラリ<134>-Footnote-425603724
Ref: ライブラリ<134>-Footnote-435603790
Ref: ライブラリ<134>-Footnote-445603856
Ref: ライブラリ<134>-Footnote-455603922
Ref: ライブラリ<134>-Footnote-465603988
Ref: ライブラリ<134>-Footnote-475604054
Ref: ライブラリ<134>-Footnote-485604122
Ref: ライブラリ<134>-Footnote-495604165
Ref: ライブラリ<134>-Footnote-505604231
Ref: ライブラリ<134>-Footnote-515604297
Ref: ライブラリ<134>-Footnote-525604363
Ref: ライブラリ<134>-Footnote-535604429
Ref: ライブラリ<134>-Footnote-545604495
Ref: ライブラリ<134>-Footnote-555604561
Ref: ライブラリ<134>-Footnote-565604627
Ref: ライブラリ<134>-Footnote-575604693
Ref: ライブラリ<134>-Footnote-585604759
Node: ドキュメント<41>5604825
Ref: whatsnew/changelog id5875604956
Ref: 1ee85604956
Ref: ドキュメント<41>-Footnote-15605276
Ref: ドキュメント<41>-Footnote-25605341
Node: テスト<45>5605406
Ref: whatsnew/changelog id5885605530
Ref: 1eea5605530
Ref: テスト<45>-Footnote-15606312
Ref: テスト<45>-Footnote-25606377
Ref: テスト<45>-Footnote-35606442
Ref: テスト<45>-Footnote-45606507
Ref: テスト<45>-Footnote-55606572
Ref: テスト<45>-Footnote-65606637
Ref: テスト<45>-Footnote-75606702
Ref: テスト<45>-Footnote-85606767
Node: ビルド<48>5606832
Ref: whatsnew/changelog id5895606943
Ref: 1eeb5606943
Ref: ビルド<48>-Footnote-15607913
Ref: ビルド<48>-Footnote-25607978
Ref: ビルド<48>-Footnote-35608043
Ref: ビルド<48>-Footnote-45608108
Ref: ビルド<48>-Footnote-55608173
Ref: ビルド<48>-Footnote-65608238
Node: macOS<32>5608303
Ref: whatsnew/changelog id5905608416
Ref: 1eec5608416
Ref: macOS<32>-Footnote-15608736
Ref: macOS<32>-Footnote-25608801
Ref: macOS<32>-Footnote-35608866
Node: Tools/Demos<26>5608931
Ref: whatsnew/changelog id5915609040
Ref: 1eed5609040
Ref: Tools/Demos<26>-Footnote-15609366
Ref: Tools/Demos<26>-Footnote-25609431
Node: C API<44>5609496
Ref: whatsnew/changelog id5925609587
Ref: 1eee5609587
Ref: C API<44>-Footnote-15610430
Ref: C API<44>-Footnote-25610495
Ref: C API<44>-Footnote-35610560
Ref: C API<44>-Footnote-45610627
Ref: C API<44>-Footnote-55610692
Node: Python 3 10 0 alpha 35610757
Ref: whatsnew/changelog python-3-10-0-alpha-35610887
Ref: 1eef5610887
Node: セキュリティ<33>5611595
Ref: whatsnew/changelog id5935611706
Ref: 1ef05611706
Ref: セキュリティ<33>-Footnote-15611960
Node: Core and Builtins<134>5612025
Ref: whatsnew/changelog id5945612165
Ref: 1ef15612165
Ref: Core and Builtins<134>-Footnote-15613783
Ref: Core and Builtins<134>-Footnote-25613848
Ref: Core and Builtins<134>-Footnote-35613913
Ref: Core and Builtins<134>-Footnote-45613978
Ref: Core and Builtins<134>-Footnote-55614043
Node: ライブラリ<135>5614108
Ref: whatsnew/changelog id5955614248
Ref: 1ef25614248
Ref: ライブラリ<135>-Footnote-15614485
Ref: ライブラリ<135>-Footnote-25614552
Node: Core and Builtins<135>5614594
Ref: whatsnew/changelog id5965614732
Ref: 1ef35614732
Ref: Core and Builtins<135>-Footnote-15616575
Ref: Core and Builtins<135>-Footnote-25616640
Ref: Core and Builtins<135>-Footnote-35616705
Ref: Core and Builtins<135>-Footnote-45616770
Ref: Core and Builtins<135>-Footnote-55616835
Ref: Core and Builtins<135>-Footnote-65616900
Ref: Core and Builtins<135>-Footnote-75616965
Ref: Core and Builtins<135>-Footnote-85617030
Ref: Core and Builtins<135>-Footnote-95617095
Ref: Core and Builtins<135>-Footnote-105617160
Node: ライブラリ<136>5617226
Ref: whatsnew/changelog id5975617366
Ref: 1ef45617366
Ref: ライブラリ<136>-Footnote-15617514
Node: Core and Builtins<136>5617579
Ref: whatsnew/changelog id5985617717
Ref: 1ef55617717
Ref: Core and Builtins<136>-Footnote-15617943
Node: ライブラリ<137>5618008
Ref: whatsnew/changelog id5995618148
Ref: 1ef65618148
Ref: ライブラリ<137>-Footnote-15618295
Node: Core and Builtins<137>5618360
Ref: whatsnew/changelog id6005618498
Ref: 1ef75618498
Ref: Core and Builtins<137>-Footnote-15619083
Ref: Core and Builtins<137>-Footnote-25619148
Ref: Core and Builtins<137>-Footnote-35619213
Node: ライブラリ<138>5619278
Ref: whatsnew/changelog id6015619418
Ref: 1ef85619418
Ref: ライブラリ<138>-Footnote-15630487
Ref: ライブラリ<138>-Footnote-25630551
Ref: ライブラリ<138>-Footnote-35630616
Ref: ライブラリ<138>-Footnote-45630681
Ref: ライブラリ<138>-Footnote-55630746
Ref: ライブラリ<138>-Footnote-65630811
Ref: ライブラリ<138>-Footnote-75630876
Ref: ライブラリ<138>-Footnote-85630941
Ref: ライブラリ<138>-Footnote-95631006
Ref: ライブラリ<138>-Footnote-105631071
Ref: ライブラリ<138>-Footnote-115631137
Ref: ライブラリ<138>-Footnote-125631203
Ref: ライブラリ<138>-Footnote-135631269
Ref: ライブラリ<138>-Footnote-145631335
Ref: ライブラリ<138>-Footnote-155631401
Ref: ライブラリ<138>-Footnote-165631467
Ref: ライブラリ<138>-Footnote-175631533
Ref: ライブラリ<138>-Footnote-185631599
Ref: ライブラリ<138>-Footnote-195631665
Ref: ライブラリ<138>-Footnote-205631731
Ref: ライブラリ<138>-Footnote-215631797
Ref: ライブラリ<138>-Footnote-225631863
Ref: ライブラリ<138>-Footnote-235631929
Ref: ライブラリ<138>-Footnote-245631997
Ref: ライブラリ<138>-Footnote-255632063
Ref: ライブラリ<138>-Footnote-265632129
Ref: ライブラリ<138>-Footnote-275632172
Ref: ライブラリ<138>-Footnote-285632238
Ref: ライブラリ<138>-Footnote-295632304
Ref: ライブラリ<138>-Footnote-305632370
Ref: ライブラリ<138>-Footnote-315632436
Ref: ライブラリ<138>-Footnote-325632502
Ref: ライブラリ<138>-Footnote-335632568
Ref: ライブラリ<138>-Footnote-345632634
Ref: ライブラリ<138>-Footnote-355632700
Ref: ライブラリ<138>-Footnote-365632766
Ref: ライブラリ<138>-Footnote-375632832
Ref: ライブラリ<138>-Footnote-385632898
Ref: ライブラリ<138>-Footnote-395632964
Ref: ライブラリ<138>-Footnote-405633030
Ref: ライブラリ<138>-Footnote-415633096
Ref: ライブラリ<138>-Footnote-425633162
Ref: ライブラリ<138>-Footnote-435633228
Ref: ライブラリ<138>-Footnote-445633294
Ref: ライブラリ<138>-Footnote-455633360
Ref: ライブラリ<138>-Footnote-465633426
Ref: ライブラリ<138>-Footnote-475633492
Ref: ライブラリ<138>-Footnote-485633558
Ref: ライブラリ<138>-Footnote-495633624
Ref: ライブラリ<138>-Footnote-505633690
Ref: ライブラリ<138>-Footnote-515633756
Ref: ライブラリ<138>-Footnote-525633822
Ref: ライブラリ<138>-Footnote-535633888
Ref: ライブラリ<138>-Footnote-545633954
Ref: ライブラリ<138>-Footnote-555634020
Ref: ライブラリ<138>-Footnote-565634086
Ref: ライブラリ<138>-Footnote-575634152
Ref: ライブラリ<138>-Footnote-585634218
Ref: ライブラリ<138>-Footnote-595634284
Ref: ライブラリ<138>-Footnote-605634350
Ref: ライブラリ<138>-Footnote-615634416
Ref: ライブラリ<138>-Footnote-625634482
Ref: ライブラリ<138>-Footnote-635634548
Ref: ライブラリ<138>-Footnote-645634614
Ref: ライブラリ<138>-Footnote-655634680
Node: ドキュメント<42>5634746
Ref: whatsnew/changelog id6025634877
Ref: 1efd5634877
Ref: ドキュメント<42>-Footnote-15635349
Ref: ドキュメント<42>-Footnote-25635414
Ref: ドキュメント<42>-Footnote-35635479
Node: テスト<46>5635544
Ref: whatsnew/changelog id6035635668
Ref: 1efe5635668
Ref: テスト<46>-Footnote-15636881
Ref: テスト<46>-Footnote-25636946
Ref: テスト<46>-Footnote-35637011
Ref: テスト<46>-Footnote-45637076
Ref: テスト<46>-Footnote-55637141
Ref: テスト<46>-Footnote-65637206
Ref: テスト<46>-Footnote-75637271
Ref: テスト<46>-Footnote-85637336
Ref: テスト<46>-Footnote-95637401
Ref: テスト<46>-Footnote-105637466
Ref: テスト<46>-Footnote-115637532
Ref: テスト<46>-Footnote-125637598
Node: ビルド<49>5637664
Ref: whatsnew/changelog id6045637777
Ref: 1eff5637777
Ref: ビルド<49>-Footnote-15638921
Ref: ビルド<49>-Footnote-25638986
Ref: ビルド<49>-Footnote-35639051
Ref: ビルド<49>-Footnote-45639116
Ref: ビルド<49>-Footnote-55639181
Ref: ビルド<49>-Footnote-65639246
Ref: ビルド<49>-Footnote-75639311
Node: Windows<42>5639376
Ref: whatsnew/changelog id6055639485
Ref: 1f005639485
Ref: Windows<42>-Footnote-15639779
Ref: Windows<42>-Footnote-25639844
Node: macOS<33>5639909
Ref: whatsnew/changelog id6065640013
Ref: 1f015640013
Ref: macOS<33>-Footnote-15640951
Ref: macOS<33>-Footnote-25641016
Ref: macOS<33>-Footnote-35641081
Ref: macOS<33>-Footnote-45641146
Ref: macOS<33>-Footnote-55641211
Node: IDLE<25>5641276
Ref: whatsnew/changelog id6075641384
Ref: 1f025641384
Ref: IDLE<25>-Footnote-15641806
Ref: IDLE<25>-Footnote-25641871
Ref: IDLE<25>-Footnote-35641936
Node: Tools/Demos<27>5642001
Ref: whatsnew/changelog id6085642109
Ref: 1f035642109
Ref: Tools/Demos<27>-Footnote-15642511
Ref: Tools/Demos<27>-Footnote-25642576
Node: C API<45>5642641
Ref: whatsnew/changelog id6095642732
Ref: 1f045642732
Ref: C API<45>-Footnote-15647464
Ref: C API<45>-Footnote-25647529
Ref: C API<45>-Footnote-35647596
Ref: C API<45>-Footnote-45647638
Ref: C API<45>-Footnote-55647705
Ref: C API<45>-Footnote-65647747
Ref: C API<45>-Footnote-75647814
Ref: C API<45>-Footnote-85647856
Ref: C API<45>-Footnote-95647923
Ref: C API<45>-Footnote-105647965
Ref: C API<45>-Footnote-115648033
Ref: C API<45>-Footnote-125648076
Ref: C API<45>-Footnote-135648144
Ref: C API<45>-Footnote-145648187
Ref: C API<45>-Footnote-155648255
Ref: C API<45>-Footnote-165648298
Ref: C API<45>-Footnote-175648364
Ref: C API<45>-Footnote-185648432
Ref: C API<45>-Footnote-195648475
Ref: C API<45>-Footnote-205648543
Ref: C API<45>-Footnote-215648586
Ref: C API<45>-Footnote-225648654
Ref: C API<45>-Footnote-235648697
Ref: C API<45>-Footnote-245648765
Ref: C API<45>-Footnote-255648808
Ref: C API<45>-Footnote-265648874
Ref: C API<45>-Footnote-275648940
Ref: C API<45>-Footnote-285649006
Ref: C API<45>-Footnote-295649072
Ref: C API<45>-Footnote-305649138
Ref: C API<45>-Footnote-315649204
Ref: C API<45>-Footnote-325649270
Ref: C API<45>-Footnote-335649338
Ref: C API<45>-Footnote-345649404
Ref: C API<45>-Footnote-355649470
Ref: C API<45>-Footnote-365649536
Node: Python 3 10 0 alpha 25649602
Ref: whatsnew/changelog python-3-10-0-alpha-25649732
Ref: 1f065649732
Node: セキュリティ<34>5650233
Ref: whatsnew/changelog id6105650344
Ref: 1f075650344
Ref: セキュリティ<34>-Footnote-15650834
Ref: セキュリティ<34>-Footnote-25650899
Node: Core and Builtins<138>5650964
Ref: whatsnew/changelog id6115651104
Ref: 1f085651104
Ref: Core and Builtins<138>-Footnote-15654443
Ref: Core and Builtins<138>-Footnote-25654508
Ref: Core and Builtins<138>-Footnote-35654573
Ref: Core and Builtins<138>-Footnote-45654638
Ref: Core and Builtins<138>-Footnote-55654703
Ref: Core and Builtins<138>-Footnote-65654768
Ref: Core and Builtins<138>-Footnote-75654833
Ref: Core and Builtins<138>-Footnote-85654898
Ref: Core and Builtins<138>-Footnote-95654963
Ref: Core and Builtins<138>-Footnote-105655028
Ref: Core and Builtins<138>-Footnote-115655094
Ref: Core and Builtins<138>-Footnote-125655160
Ref: Core and Builtins<138>-Footnote-135655226
Ref: Core and Builtins<138>-Footnote-145655292
Ref: Core and Builtins<138>-Footnote-155655358
Ref: Core and Builtins<138>-Footnote-165655424
Ref: Core and Builtins<138>-Footnote-175655490
Ref: Core and Builtins<138>-Footnote-185655556
Node: ライブラリ<139>5655622
Ref: whatsnew/changelog id6125655762
Ref: 1f0b5655762
Ref: ライブラリ<139>-Footnote-15656077
Node: Core and Builtins<139>5656142
Ref: whatsnew/changelog id6135656280
Ref: 1f0c5656280
Ref: Core and Builtins<139>-Footnote-15656614
Ref: Core and Builtins<139>-Footnote-25656679
Node: ライブラリ<140>5656721
Ref: whatsnew/changelog id6145656861
Ref: 1f0d5656861
Ref: ライブラリ<140>-Footnote-15663895
Ref: ライブラリ<140>-Footnote-25663960
Ref: ライブラリ<140>-Footnote-35664025
Ref: ライブラリ<140>-Footnote-45664090
Ref: ライブラリ<140>-Footnote-55664155
Ref: ライブラリ<140>-Footnote-65664220
Ref: ライブラリ<140>-Footnote-75664285
Ref: ライブラリ<140>-Footnote-85664327
Ref: ライブラリ<140>-Footnote-95664392
Ref: ライブラリ<140>-Footnote-105664457
Ref: ライブラリ<140>-Footnote-115664523
Ref: ライブラリ<140>-Footnote-125664589
Ref: ライブラリ<140>-Footnote-135664655
Ref: ライブラリ<140>-Footnote-145664721
Ref: ライブラリ<140>-Footnote-155664787
Ref: ライブラリ<140>-Footnote-165664853
Ref: ライブラリ<140>-Footnote-175664919
Ref: ライブラリ<140>-Footnote-185664985
Ref: ライブラリ<140>-Footnote-195665051
Ref: ライブラリ<140>-Footnote-205665117
Ref: ライブラリ<140>-Footnote-215665183
Ref: ライブラリ<140>-Footnote-225665249
Ref: ライブラリ<140>-Footnote-235665315
Ref: ライブラリ<140>-Footnote-245665381
Ref: ライブラリ<140>-Footnote-255665447
Ref: ライブラリ<140>-Footnote-265665490
Ref: ライブラリ<140>-Footnote-275665556
Ref: ライブラリ<140>-Footnote-285665622
Ref: ライブラリ<140>-Footnote-295665688
Ref: ライブラリ<140>-Footnote-305665754
Ref: ライブラリ<140>-Footnote-315665820
Ref: ライブラリ<140>-Footnote-325665886
Ref: ライブラリ<140>-Footnote-335665952
Ref: ライブラリ<140>-Footnote-345666018
Ref: ライブラリ<140>-Footnote-355666084
Ref: ライブラリ<140>-Footnote-365666150
Ref: ライブラリ<140>-Footnote-375666215
Ref: ライブラリ<140>-Footnote-385666281
Ref: ライブラリ<140>-Footnote-395666347
Ref: ライブラリ<140>-Footnote-405666413
Ref: ライブラリ<140>-Footnote-415666479
Node: ドキュメント<43>5666545
Ref: whatsnew/changelog id6155666676
Ref: 1f105666676
Ref: ドキュメント<43>-Footnote-15667528
Ref: ドキュメント<43>-Footnote-25667593
Ref: ドキュメント<43>-Footnote-35667658
Ref: ドキュメント<43>-Footnote-45667723
Ref: ドキュメント<43>-Footnote-55667788
Ref: ドキュメント<43>-Footnote-65667853
Node: テスト<47>5667918
Ref: whatsnew/changelog id6165668042
Ref: 1f135668042
Ref: テスト<47>-Footnote-15668684
Ref: テスト<47>-Footnote-25668749
Ref: テスト<47>-Footnote-35668814
Ref: テスト<47>-Footnote-45668879
Node: ビルド<50>5668944
Ref: whatsnew/changelog id6175669057
Ref: 1f145669057
Ref: ビルド<50>-Footnote-15669326
Node: Windows<43>5669391
Ref: whatsnew/changelog id6185669500
Ref: 1f155669500
Ref: Windows<43>-Footnote-15669976
Ref: Windows<43>-Footnote-25670041
Ref: Windows<43>-Footnote-35670106
Ref: Windows<43>-Footnote-45670171
Ref: Windows<43>-Footnote-55670236
Node: macOS<34>5670301
Ref: whatsnew/changelog id6195670405
Ref: 1f165670405
Ref: macOS<34>-Footnote-15670557
Node: IDLE<26>5670622
Ref: whatsnew/changelog id6205670724
Ref: 1f175670724
Ref: IDLE<26>-Footnote-15671335
Ref: IDLE<26>-Footnote-25671400
Ref: IDLE<26>-Footnote-35671465
Node: C API<46>5671530
Ref: whatsnew/changelog id6215671614
Ref: 1f185671614
Ref: C API<46>-Footnote-15672947
Ref: C API<46>-Footnote-25673012
Ref: C API<46>-Footnote-35673077
Ref: C API<46>-Footnote-45673142
Ref: C API<46>-Footnote-55673207
Ref: C API<46>-Footnote-65673272
Ref: C API<46>-Footnote-75673337
Ref: C API<46>-Footnote-85673402
Node: Python 3 10 0 alpha 15673467
Ref: whatsnew/changelog python-3-10-0-alpha-15673595
Ref: 1f1a5673595
Node: セキュリティ<35>5675214
Ref: whatsnew/changelog id6225675325
Ref: 1f1b5675325
Ref: セキュリティ<35>-Footnote-15676242
Ref: セキュリティ<35>-Footnote-25676307
Ref: セキュリティ<35>-Footnote-35676372
Ref: セキュリティ<35>-Footnote-45676428
Ref: セキュリティ<35>-Footnote-55676493
Ref: セキュリティ<35>-Footnote-65676558
Ref: セキュリティ<35>-Footnote-75676614
Ref: セキュリティ<35>-Footnote-85676679
Node: Core and Builtins<140>5676744
Ref: whatsnew/changelog id6235676884
Ref: 1f1c5676884
Ref: Core and Builtins<140>-Footnote-15677576
Ref: Core and Builtins<140>-Footnote-25677641
Ref: Core and Builtins<140>-Footnote-35677706
Ref: Core and Builtins<140>-Footnote-45677748
Ref: Core and Builtins<140>-Footnote-55677813
Ref: Core and Builtins<140>-Footnote-65677878
Node: ライブラリ<141>5677920
Ref: whatsnew/changelog id6245678060
Ref: 1f1d5678060
Ref: ライブラリ<141>-Footnote-15678254
Ref: ライブラリ<141>-Footnote-25678321
Node: Core and Builtins<141>5678363
Ref: whatsnew/changelog id6255678501
Ref: 1f1e5678501
Ref: Core and Builtins<141>-Footnote-15678889
Ref: Core and Builtins<141>-Footnote-25678954
Node: ライブラリ<142>5679019
Ref: whatsnew/changelog id6265679159
Ref: 1f1f5679159
Ref: ライブラリ<142>-Footnote-15679791
Ref: ライブラリ<142>-Footnote-25679858
Ref: ライブラリ<142>-Footnote-35679900
Ref: ライブラリ<142>-Footnote-45679967
Ref: ライブラリ<142>-Footnote-55680009
Ref: ライブラリ<142>-Footnote-65680076
Ref: ライブラリ<142>-Footnote-75680118
Ref: ライブラリ<142>-Footnote-85680185
Ref: ライブラリ<142>-Footnote-95680227
Node: Core and Builtins<142>5680294
Ref: whatsnew/changelog id6275680432
Ref: 1f205680432
Ref: Core and Builtins<142>-Footnote-15680691
Node: ライブラリ<143>5680756
Ref: whatsnew/changelog id6285680896
Ref: 1f215680896
Ref: ライブラリ<143>-Footnote-15681326
Ref: ライブラリ<143>-Footnote-25681393
Ref: ライブラリ<143>-Footnote-35681435
Ref: ライブラリ<143>-Footnote-45681502
Ref: ライブラリ<143>-Footnote-55681544
Ref: ライブラリ<143>-Footnote-65681611
Node: Core and Builtins<143>5681653
Ref: whatsnew/changelog id6295681791
Ref: 1f225681791
Ref: Core and Builtins<143>-Footnote-15682045
Node: ライブラリ<144>5682110
Ref: whatsnew/changelog id6305682250
Ref: 1f235682250
Ref: ライブラリ<144>-Footnote-15682561
Node: Core and Builtins<144>5682626
Ref: whatsnew/changelog id6315682764
Ref: 1f245682764
Ref: Core and Builtins<144>-Footnote-15683207
Ref: Core and Builtins<144>-Footnote-25683272
Node: ライブラリ<145>5683337
Ref: whatsnew/changelog id6325683477
Ref: 1f255683477
Ref: ライブラリ<145>-Footnote-15683678
Ref: ライブラリ<145>-Footnote-25683745
Node: Core and Builtins<145>5683787
Ref: whatsnew/changelog id6335683925
Ref: 1f265683925
Ref: Core and Builtins<145>-Footnote-15684397
Node: ライブラリ<146>5684462
Ref: whatsnew/changelog id6345684602
Ref: 1f275684602
Ref: ライブラリ<146>-Footnote-15684774
Node: Core and Builtins<146>5684839
Ref: whatsnew/changelog id6355684977
Ref: 1f285684977
Ref: Core and Builtins<146>-Footnote-15685174
Node: ライブラリ<147>5685241
Ref: whatsnew/changelog id6365685381
Ref: 1f295685381
Ref: ライブラリ<147>-Footnote-15685587
Ref: ライブラリ<147>-Footnote-25685654
Node: Core and Builtins<147>5685696
Ref: whatsnew/changelog id6375685834
Ref: 1f2a5685834
Ref: Core and Builtins<147>-Footnote-15686310
Ref: Core and Builtins<147>-Footnote-25686375
Ref: Core and Builtins<147>-Footnote-35686440
Node: ライブラリ<148>5686505
Ref: whatsnew/changelog id6385686645
Ref: 1f2b5686645
Ref: ライブラリ<148>-Footnote-15686877
Ref: ライブラリ<148>-Footnote-25686944
Node: Core and Builtins<148>5686986
Ref: whatsnew/changelog id6395687124
Ref: 1f2c5687124
Ref: Core and Builtins<148>-Footnote-15688572
Ref: Core and Builtins<148>-Footnote-25688637
Ref: Core and Builtins<148>-Footnote-35688702
Ref: Core and Builtins<148>-Footnote-45688767
Ref: Core and Builtins<148>-Footnote-55688832
Ref: Core and Builtins<148>-Footnote-65688897
Ref: Core and Builtins<148>-Footnote-75688962
Ref: Core and Builtins<148>-Footnote-85689027
Ref: Core and Builtins<148>-Footnote-95689092
Ref: Core and Builtins<148>-Footnote-105689157
Ref: Core and Builtins<148>-Footnote-115689223
Node: ライブラリ<149>5689291
Ref: whatsnew/changelog id6405689431
Ref: 1f2d5689431
Ref: ライブラリ<149>-Footnote-15689586
Node: Core and Builtins<149>5689653
Ref: whatsnew/changelog id6415689791
Ref: 1f2e5689791
Ref: Core and Builtins<149>-Footnote-15690360
Ref: Core and Builtins<149>-Footnote-25690425
Node: ライブラリ<150>5690490
Ref: whatsnew/changelog id6425690630
Ref: 1f2f5690630
Ref: ライブラリ<150>-Footnote-15690871
Ref: ライブラリ<150>-Footnote-25690938
Node: Core and Builtins<150>5691005
Ref: whatsnew/changelog id6435691143
Ref: 1f305691143
Ref: Core and Builtins<150>-Footnote-15693107
Ref: Core and Builtins<150>-Footnote-25693172
Ref: Core and Builtins<150>-Footnote-35693237
Ref: Core and Builtins<150>-Footnote-45693302
Ref: Core and Builtins<150>-Footnote-55693367
Ref: Core and Builtins<150>-Footnote-65693432
Ref: Core and Builtins<150>-Footnote-75693497
Ref: Core and Builtins<150>-Footnote-85693562
Ref: Core and Builtins<150>-Footnote-95693627
Ref: Core and Builtins<150>-Footnote-105693692
Ref: Core and Builtins<150>-Footnote-115693758
Ref: Core and Builtins<150>-Footnote-125693824
Ref: Core and Builtins<150>-Footnote-135693890
Node: ライブラリ<151>5693956
Ref: whatsnew/changelog id6445694096
Ref: 1f315694096
Ref: ライブラリ<151>-Footnote-15694258
Node: Core and Builtins<151>5694323
Ref: whatsnew/changelog id6455694461
Ref: 1f325694461
Ref: Core and Builtins<151>-Footnote-15695577
Ref: Core and Builtins<151>-Footnote-25695642
Ref: Core and Builtins<151>-Footnote-35695707
Ref: Core and Builtins<151>-Footnote-45695749
Ref: Core and Builtins<151>-Footnote-55695816
Ref: Core and Builtins<151>-Footnote-65695881
Ref: Core and Builtins<151>-Footnote-75695946
Ref: Core and Builtins<151>-Footnote-85696013
Node: ライブラリ<152>5696078
Ref: whatsnew/changelog id6465696218
Ref: 1f335696218
Ref: ライブラリ<152>-Footnote-15696443
Ref: ライブラリ<152>-Footnote-25696508
Node: Core and Builtins<152>5696550
Ref: whatsnew/changelog id6475696688
Ref: 1f345696688
Ref: Core and Builtins<152>-Footnote-15701602
Ref: Core and Builtins<152>-Footnote-25701667
Ref: Core and Builtins<152>-Footnote-35701732
Ref: Core and Builtins<152>-Footnote-45701797
Ref: Core and Builtins<152>-Footnote-55701862
Ref: Core and Builtins<152>-Footnote-65701927
Ref: Core and Builtins<152>-Footnote-75701992
Ref: Core and Builtins<152>-Footnote-85702057
Ref: Core and Builtins<152>-Footnote-95702122
Ref: Core and Builtins<152>-Footnote-105702187
Ref: Core and Builtins<152>-Footnote-115702253
Ref: Core and Builtins<152>-Footnote-125702319
Ref: Core and Builtins<152>-Footnote-135702385
Ref: Core and Builtins<152>-Footnote-145702453
Ref: Core and Builtins<152>-Footnote-155702519
Ref: Core and Builtins<152>-Footnote-165702585
Ref: Core and Builtins<152>-Footnote-175702651
Ref: Core and Builtins<152>-Footnote-185702717
Ref: Core and Builtins<152>-Footnote-195702783
Ref: Core and Builtins<152>-Footnote-205702849
Ref: Core and Builtins<152>-Footnote-215702915
Ref: Core and Builtins<152>-Footnote-225702981
Ref: Core and Builtins<152>-Footnote-235703047
Ref: Core and Builtins<152>-Footnote-245703113
Ref: Core and Builtins<152>-Footnote-255703179
Ref: Core and Builtins<152>-Footnote-265703245
Node: ライブラリ<153>5703310
Ref: whatsnew/changelog id6485703450
Ref: 1f395703450
Ref: ライブラリ<153>-Footnote-15703678
Ref: ライブラリ<153>-Footnote-25703745
Node: Core and Builtins<153>5703812
Ref: whatsnew/changelog id6495703950
Ref: 1f3a5703950
Ref: Core and Builtins<153>-Footnote-15704537
Ref: Core and Builtins<153>-Footnote-25704602
Node: ライブラリ<154>5704667
Ref: whatsnew/changelog id6505704807
Ref: 1f3b5704807
Ref: ライブラリ<154>-Footnote-15705186
Node: Core and Builtins<154>5705251
Ref: whatsnew/changelog id6515705389
Ref: 1f3c5705389
Ref: Core and Builtins<154>-Footnote-15705733
Ref: Core and Builtins<154>-Footnote-25705798
Node: ライブラリ<155>5705863
Ref: whatsnew/changelog id6525706003
Ref: 1f3d5706003
Ref: ライブラリ<155>-Footnote-15728143
Ref: ライブラリ<155>-Footnote-25728208
Ref: ライブラリ<155>-Footnote-35728273
Ref: ライブラリ<155>-Footnote-45728338
Ref: ライブラリ<155>-Footnote-55728403
Ref: ライブラリ<155>-Footnote-65728468
Ref: ライブラリ<155>-Footnote-75728533
Ref: ライブラリ<155>-Footnote-85728598
Ref: ライブラリ<155>-Footnote-95728663
Ref: ライブラリ<155>-Footnote-105728728
Ref: ライブラリ<155>-Footnote-115728794
Ref: ライブラリ<155>-Footnote-125728860
Ref: ライブラリ<155>-Footnote-135728926
Ref: ライブラリ<155>-Footnote-145728992
Ref: ライブラリ<155>-Footnote-155729058
Ref: ライブラリ<155>-Footnote-165729124
Ref: ライブラリ<155>-Footnote-175729177
Ref: ライブラリ<155>-Footnote-185729243
Ref: ライブラリ<155>-Footnote-195729309
Ref: ライブラリ<155>-Footnote-205729375
Ref: ライブラリ<155>-Footnote-215729443
Ref: ライブラリ<155>-Footnote-225729486
Ref: ライブラリ<155>-Footnote-235729554
Ref: ライブラリ<155>-Footnote-245729597
Ref: ライブラリ<155>-Footnote-255729663
Ref: ライブラリ<155>-Footnote-265729729
Ref: ライブラリ<155>-Footnote-275729795
Ref: ライブラリ<155>-Footnote-285729861
Ref: ライブラリ<155>-Footnote-295729927
Ref: ライブラリ<155>-Footnote-305729993
Ref: ライブラリ<155>-Footnote-315730059
Ref: ライブラリ<155>-Footnote-325730125
Ref: ライブラリ<155>-Footnote-335730191
Ref: ライブラリ<155>-Footnote-345730257
Ref: ライブラリ<155>-Footnote-355730323
Ref: ライブラリ<155>-Footnote-365730389
Ref: ライブラリ<155>-Footnote-375730455
Ref: ライブラリ<155>-Footnote-385730521
Ref: ライブラリ<155>-Footnote-395730587
Ref: ライブラリ<155>-Footnote-405730653
Ref: ライブラリ<155>-Footnote-415730719
Ref: ライブラリ<155>-Footnote-425730785
Ref: ライブラリ<155>-Footnote-435730851
Ref: ライブラリ<155>-Footnote-445730917
Ref: ライブラリ<155>-Footnote-455730983
Ref: ライブラリ<155>-Footnote-465731049
Ref: ライブラリ<155>-Footnote-475731115
Ref: ライブラリ<155>-Footnote-485731181
Ref: ライブラリ<155>-Footnote-495731247
Ref: ライブラリ<155>-Footnote-505731313
Ref: ライブラリ<155>-Footnote-515731379
Ref: ライブラリ<155>-Footnote-525731445
Ref: ライブラリ<155>-Footnote-535731511
Ref: ライブラリ<155>-Footnote-545731577
Ref: ライブラリ<155>-Footnote-555731643
Ref: ライブラリ<155>-Footnote-565731709
Ref: ライブラリ<155>-Footnote-575731775
Ref: ライブラリ<155>-Footnote-585731832
Ref: ライブラリ<155>-Footnote-595731898
Ref: ライブラリ<155>-Footnote-605731964
Ref: ライブラリ<155>-Footnote-615732030
Ref: ライブラリ<155>-Footnote-625732096
Ref: ライブラリ<155>-Footnote-635732162
Ref: ライブラリ<155>-Footnote-645732228
Ref: ライブラリ<155>-Footnote-655732294
Ref: ライブラリ<155>-Footnote-665732360
Ref: ライブラリ<155>-Footnote-675732426
Ref: ライブラリ<155>-Footnote-685732492
Ref: ライブラリ<155>-Footnote-695732558
Ref: ライブラリ<155>-Footnote-705732624
Ref: ライブラリ<155>-Footnote-715732690
Ref: ライブラリ<155>-Footnote-725732756
Ref: ライブラリ<155>-Footnote-735732822
Ref: ライブラリ<155>-Footnote-745732888
Ref: ライブラリ<155>-Footnote-755732954
Ref: ライブラリ<155>-Footnote-765733020
Ref: ライブラリ<155>-Footnote-775733086
Ref: ライブラリ<155>-Footnote-785733152
Ref: ライブラリ<155>-Footnote-795733218
Ref: ライブラリ<155>-Footnote-805733284
Ref: ライブラリ<155>-Footnote-815733350
Ref: ライブラリ<155>-Footnote-825733416
Ref: ライブラリ<155>-Footnote-835733482
Ref: ライブラリ<155>-Footnote-845733548
Ref: ライブラリ<155>-Footnote-855733614
Ref: ライブラリ<155>-Footnote-865733680
Ref: ライブラリ<155>-Footnote-875733746
Ref: ライブラリ<155>-Footnote-885733812
Ref: ライブラリ<155>-Footnote-895733878
Ref: ライブラリ<155>-Footnote-905733944
Ref: ライブラリ<155>-Footnote-915734010
Ref: ライブラリ<155>-Footnote-925734076
Ref: ライブラリ<155>-Footnote-935734142
Ref: ライブラリ<155>-Footnote-945734208
Ref: ライブラリ<155>-Footnote-955734274
Ref: ライブラリ<155>-Footnote-965734340
Ref: ライブラリ<155>-Footnote-975734406
Ref: ライブラリ<155>-Footnote-985734472
Ref: ライブラリ<155>-Footnote-995734538
Ref: ライブラリ<155>-Footnote-1005734604
Ref: ライブラリ<155>-Footnote-1015734671
Ref: ライブラリ<155>-Footnote-1025734738
Ref: ライブラリ<155>-Footnote-1035734805
Ref: ライブラリ<155>-Footnote-1045734872
Ref: ライブラリ<155>-Footnote-1055734939
Ref: ライブラリ<155>-Footnote-1065735006
Ref: ライブラリ<155>-Footnote-1075735073
Ref: ライブラリ<155>-Footnote-1085735140
Ref: ライブラリ<155>-Footnote-1095735207
Ref: ライブラリ<155>-Footnote-1105735274
Ref: ライブラリ<155>-Footnote-1115735341
Ref: ライブラリ<155>-Footnote-1125735408
Ref: ライブラリ<155>-Footnote-1135735475
Ref: ライブラリ<155>-Footnote-1145735542
Ref: ライブラリ<155>-Footnote-1155735609
Ref: ライブラリ<155>-Footnote-1165735676
Ref: ライブラリ<155>-Footnote-1175735743
Ref: ライブラリ<155>-Footnote-1185735810
Ref: ライブラリ<155>-Footnote-1195735877
Ref: ライブラリ<155>-Footnote-1205735944
Ref: ライブラリ<155>-Footnote-1215736010
Ref: ライブラリ<155>-Footnote-1225736077
Ref: ライブラリ<155>-Footnote-1235736144
Ref: ライブラリ<155>-Footnote-1245736211
Ref: ライブラリ<155>-Footnote-1255736278
Ref: ライブラリ<155>-Footnote-1265736322
Ref: ライブラリ<155>-Footnote-1275736389
Ref: ライブラリ<155>-Footnote-1285736456
Ref: ライブラリ<155>-Footnote-1295736523
Ref: ライブラリ<155>-Footnote-1305736590
Ref: ライブラリ<155>-Footnote-1315736657
Ref: ライブラリ<155>-Footnote-1325736724
Ref: ライブラリ<155>-Footnote-1335736791
Ref: ライブラリ<155>-Footnote-1345736858
Ref: ライブラリ<155>-Footnote-1355736925
Ref: ライブラリ<155>-Footnote-1365736992
Ref: ライブラリ<155>-Footnote-1375737059
Ref: ライブラリ<155>-Footnote-1385737126
Ref: ライブラリ<155>-Footnote-1395737193
Ref: ライブラリ<155>-Footnote-1405737260
Ref: ライブラリ<155>-Footnote-1415737327
Ref: ライブラリ<155>-Footnote-1425737394
Ref: ライブラリ<155>-Footnote-1435737461
Ref: ライブラリ<155>-Footnote-1445737528
Ref: ライブラリ<155>-Footnote-1455737595
Ref: ライブラリ<155>-Footnote-1465737662
Ref: ライブラリ<155>-Footnote-1475737729
Ref: ライブラリ<155>-Footnote-1485737796
Ref: ライブラリ<155>-Footnote-1495737863
Ref: ライブラリ<155>-Footnote-1505737930
Ref: ライブラリ<155>-Footnote-1515737997
Ref: ライブラリ<155>-Footnote-1525738064
Ref: ライブラリ<155>-Footnote-1535738131
Ref: ライブラリ<155>-Footnote-1545738198
Node: ドキュメント<44>5738265
Ref: whatsnew/changelog id6535738396
Ref: 1f435738396
Ref: ドキュメント<44>-Footnote-15740159
Ref: ドキュメント<44>-Footnote-25740224
Ref: ドキュメント<44>-Footnote-35740266
Ref: ドキュメント<44>-Footnote-45740331
Ref: ドキュメント<44>-Footnote-55740396
Ref: ドキュメント<44>-Footnote-65740461
Ref: ドキュメント<44>-Footnote-75740526
Ref: ドキュメント<44>-Footnote-85740591
Ref: ドキュメント<44>-Footnote-95740656
Ref: ドキュメント<44>-Footnote-105740721
Ref: ドキュメント<44>-Footnote-115740787
Ref: ドキュメント<44>-Footnote-125740853
Ref: ドキュメント<44>-Footnote-135740919
Ref: ドキュメント<44>-Footnote-145740985
Node: テスト<48>5741051
Ref: whatsnew/changelog id6545741175
Ref: 1f455741175
Ref: テスト<48>-Footnote-15743331
Ref: テスト<48>-Footnote-25743396
Ref: テスト<48>-Footnote-35743461
Ref: テスト<48>-Footnote-45743526
Ref: テスト<48>-Footnote-55743591
Ref: テスト<48>-Footnote-65743656
Ref: テスト<48>-Footnote-75743721
Ref: テスト<48>-Footnote-85743786
Ref: テスト<48>-Footnote-95743851
Ref: テスト<48>-Footnote-105743916
Ref: テスト<48>-Footnote-115743982
Ref: テスト<48>-Footnote-125744048
Ref: テスト<48>-Footnote-135744114
Ref: テスト<48>-Footnote-145744180
Ref: テスト<48>-Footnote-155744246
Ref: テスト<48>-Footnote-165744312
Node: ビルド<51>5744378
Ref: whatsnew/changelog id6555744491
Ref: 1f485744491
Ref: ビルド<51>-Footnote-15745417
Ref: ビルド<51>-Footnote-25745482
Ref: ビルド<51>-Footnote-35745547
Ref: ビルド<51>-Footnote-45745612
Ref: ビルド<51>-Footnote-55745677
Ref: ビルド<51>-Footnote-65745742
Node: Windows<44>5745807
Ref: whatsnew/changelog id6565745916
Ref: 1f495745916
Ref: Windows<44>-Footnote-15747681
Ref: Windows<44>-Footnote-25747746
Ref: Windows<44>-Footnote-35747811
Ref: Windows<44>-Footnote-45747876
Ref: Windows<44>-Footnote-55747941
Ref: Windows<44>-Footnote-65748006
Ref: Windows<44>-Footnote-75748071
Ref: Windows<44>-Footnote-85748136
Ref: Windows<44>-Footnote-95748201
Ref: Windows<44>-Footnote-105748266
Ref: Windows<44>-Footnote-115748332
Ref: Windows<44>-Footnote-125748398
Ref: Windows<44>-Footnote-135748464
Ref: Windows<44>-Footnote-145748530
Node: macOS<35>5748596
Ref: whatsnew/changelog id6575748700
Ref: 1f4a5748700
Ref: macOS<35>-Footnote-15749591
Ref: macOS<35>-Footnote-25749656
Ref: macOS<35>-Footnote-35749721
Ref: macOS<35>-Footnote-45749786
Ref: macOS<35>-Footnote-55749851
Ref: macOS<35>-Footnote-65749916
Node: IDLE<27>5749981
Ref: whatsnew/changelog id6585750083
Ref: 1f4b5750083
Ref: IDLE<27>-Footnote-15751240
Ref: IDLE<27>-Footnote-25751305
Ref: IDLE<27>-Footnote-35751370
Ref: IDLE<27>-Footnote-45751435
Ref: IDLE<27>-Footnote-55751500
Ref: IDLE<27>-Footnote-65751565
Ref: IDLE<27>-Footnote-75751630
Ref: IDLE<27>-Footnote-85751695
Ref: IDLE<27>-Footnote-95751760
Ref: IDLE<27>-Footnote-105751825
Ref: IDLE<27>-Footnote-115751891
Node: C API<47>5751957
Ref: whatsnew/changelog id6595752041
Ref: 1f4c5752041
Ref: C API<47>-Footnote-15757211
Ref: C API<47>-Footnote-25757276
Ref: C API<47>-Footnote-35757341
Ref: C API<47>-Footnote-45757406
Ref: C API<47>-Footnote-55757471
Ref: C API<47>-Footnote-65757536
Ref: C API<47>-Footnote-75757601
Ref: C API<47>-Footnote-85757666
Ref: C API<47>-Footnote-95757731
Ref: C API<47>-Footnote-105757796
Ref: C API<47>-Footnote-115757862
Ref: C API<47>-Footnote-125757928
Ref: C API<47>-Footnote-135757994
Ref: C API<47>-Footnote-145758060
Ref: C API<47>-Footnote-155758126
Ref: C API<47>-Footnote-165758192
Ref: C API<47>-Footnote-175758258
Ref: C API<47>-Footnote-185758324
Ref: C API<47>-Footnote-195758390
Ref: C API<47>-Footnote-205758456
Ref: C API<47>-Footnote-215758499
Ref: C API<47>-Footnote-225758565
Ref: C API<47>-Footnote-235758631
Ref: C API<47>-Footnote-245758697
Ref: C API<47>-Footnote-255758763
Ref: C API<47>-Footnote-265758829
Ref: C API<47>-Footnote-275758895
Ref: C API<47>-Footnote-285758961
Ref: C API<47>-Footnote-295759027
Node: Python 3 9 0 beta 15759093
Ref: whatsnew/changelog python-3-9-0-beta-15759220
Ref: 1f565759220
Node: セキュリティ<36>5759648
Ref: whatsnew/changelog id6605759757
Ref: 1f575759757
Ref: セキュリティ<36>-Footnote-15759975
Node: Core and Builtins<155>5760040
Ref: whatsnew/changelog id6615760178
Ref: 1f585760178
Ref: Core and Builtins<155>-Footnote-15762721
Ref: Core and Builtins<155>-Footnote-25762786
Ref: Core and Builtins<155>-Footnote-35762851
Ref: Core and Builtins<155>-Footnote-45762916
Ref: Core and Builtins<155>-Footnote-55762981
Ref: Core and Builtins<155>-Footnote-65763046
Ref: Core and Builtins<155>-Footnote-75763088
Ref: Core and Builtins<155>-Footnote-85763153
Ref: Core and Builtins<155>-Footnote-95763218
Ref: Core and Builtins<155>-Footnote-105763285
Ref: Core and Builtins<155>-Footnote-115763328
Ref: Core and Builtins<155>-Footnote-125763394
Ref: Core and Builtins<155>-Footnote-135763462
Ref: Core and Builtins<155>-Footnote-145763505
Ref: Core and Builtins<155>-Footnote-155763571
Ref: Core and Builtins<155>-Footnote-165763637
Ref: Core and Builtins<155>-Footnote-175763703
Ref: Core and Builtins<155>-Footnote-185763769
Ref: Core and Builtins<155>-Footnote-195763837
Ref: Core and Builtins<155>-Footnote-205763880
Ref: Core and Builtins<155>-Footnote-215763946
Ref: Core and Builtins<155>-Footnote-225764012
Ref: Core and Builtins<155>-Footnote-235764078
Ref: Core and Builtins<155>-Footnote-245764144
Node: ライブラリ<156>5764210
Ref: whatsnew/changelog id6625764348
Ref: 1f5a5764348
Ref: ライブラリ<156>-Footnote-15771742
Ref: ライブラリ<156>-Footnote-25771807
Ref: ライブラリ<156>-Footnote-35771872
Ref: ライブラリ<156>-Footnote-45771937
Ref: ライブラリ<156>-Footnote-55772002
Ref: ライブラリ<156>-Footnote-65772067
Ref: ライブラリ<156>-Footnote-75772132
Ref: ライブラリ<156>-Footnote-85772197
Ref: ライブラリ<156>-Footnote-95772262
Ref: ライブラリ<156>-Footnote-105772327
Ref: ライブラリ<156>-Footnote-115772393
Ref: ライブラリ<156>-Footnote-125772459
Ref: ライブラリ<156>-Footnote-135772525
Ref: ライブラリ<156>-Footnote-145772591
Ref: ライブラリ<156>-Footnote-155772657
Ref: ライブラリ<156>-Footnote-165772700
Ref: ライブラリ<156>-Footnote-175772766
Ref: ライブラリ<156>-Footnote-185772832
Ref: ライブラリ<156>-Footnote-195772898
Ref: ライブラリ<156>-Footnote-205772964
Ref: ライブラリ<156>-Footnote-215773030
Ref: ライブラリ<156>-Footnote-225773096
Ref: ライブラリ<156>-Footnote-235773162
Ref: ライブラリ<156>-Footnote-245773228
Ref: ライブラリ<156>-Footnote-255773294
Ref: ライブラリ<156>-Footnote-265773360
Ref: ライブラリ<156>-Footnote-275773426
Ref: ライブラリ<156>-Footnote-285773492
Ref: ライブラリ<156>-Footnote-295773558
Ref: ライブラリ<156>-Footnote-305773624
Ref: ライブラリ<156>-Footnote-315773690
Ref: ライブラリ<156>-Footnote-325773756
Ref: ライブラリ<156>-Footnote-335773822
Ref: ライブラリ<156>-Footnote-345773888
Ref: ライブラリ<156>-Footnote-355773954
Ref: ライブラリ<156>-Footnote-365774020
Ref: ライブラリ<156>-Footnote-375774086
Ref: ライブラリ<156>-Footnote-385774152
Ref: ライブラリ<156>-Footnote-395774218
Ref: ライブラリ<156>-Footnote-405774284
Ref: ライブラリ<156>-Footnote-415774350
Ref: ライブラリ<156>-Footnote-425774416
Ref: ライブラリ<156>-Footnote-435774482
Ref: ライブラリ<156>-Footnote-445774548
Ref: ライブラリ<156>-Footnote-455774614
Ref: ライブラリ<156>-Footnote-465774680
Ref: ライブラリ<156>-Footnote-475774746
Ref: ライブラリ<156>-Footnote-485774812
Ref: ライブラリ<156>-Footnote-495774878
Ref: ライブラリ<156>-Footnote-505774944
Node: ドキュメント<45>5775010
Ref: whatsnew/changelog id6635775139
Ref: 1f5f5775139
Ref: ドキュメント<45>-Footnote-15775809
Ref: ドキュメント<45>-Footnote-25775874
Ref: ドキュメント<45>-Footnote-35775939
Ref: ドキュメント<45>-Footnote-45776004
Ref: ドキュメント<45>-Footnote-55776069
Node: テスト<49>5776134
Ref: whatsnew/changelog id6645776256
Ref: 1f605776256
Ref: テスト<49>-Footnote-15776616
Ref: テスト<49>-Footnote-25776681
Node: ビルド<52>5776746
Ref: whatsnew/changelog id6655776857
Ref: 1f615776857
Ref: ビルド<52>-Footnote-15777202
Ref: ビルド<52>-Footnote-25777267
Node: Windows<45>5777332
Ref: whatsnew/changelog id6665777439
Ref: 1f625777439
Ref: Windows<45>-Footnote-15777892
Ref: Windows<45>-Footnote-25777957
Ref: Windows<45>-Footnote-35778022
Node: macOS<36>5778087
Ref: whatsnew/changelog id6675778196
Ref: 1f635778196
Ref: macOS<36>-Footnote-15778819
Ref: macOS<36>-Footnote-25778884
Node: Tools/Demos<28>5778949
Ref: whatsnew/changelog id6685779056
Ref: 1f645779056
Ref: Tools/Demos<28>-Footnote-15779541
Ref: Tools/Demos<28>-Footnote-25779606
Ref: Tools/Demos<28>-Footnote-35779671
Node: C API<48>5779736
Ref: whatsnew/changelog id6695779825
Ref: 1f655779825
Ref: C API<48>-Footnote-15781851
Ref: C API<48>-Footnote-25781916
Ref: C API<48>-Footnote-35781981
Ref: C API<48>-Footnote-45782046
Ref: C API<48>-Footnote-55782111
Ref: C API<48>-Footnote-65782176
Ref: C API<48>-Footnote-75782241
Ref: C API<48>-Footnote-85782306
Ref: C API<48>-Footnote-95782371
Ref: C API<48>-Footnote-105782436
Ref: C API<48>-Footnote-115782502
Node: Python 3 9 0 alpha 65782545
Ref: whatsnew/changelog python-3-9-0-alpha-65782671
Ref: 1f665782671
Node: セキュリティ<37>5783119
Ref: whatsnew/changelog id6705783229
Ref: 1f675783229
Ref: セキュリティ<37>-Footnote-15783891
Ref: セキュリティ<37>-Footnote-25783956
Ref: セキュリティ<37>-Footnote-35784021
Ref: セキュリティ<37>-Footnote-45784086
Node: Core and Builtins<156>5784141
Ref: whatsnew/changelog id6715784280
Ref: 1f685784280
Ref: Core and Builtins<156>-Footnote-15788054
Ref: Core and Builtins<156>-Footnote-25788119
Ref: Core and Builtins<156>-Footnote-35788184
Ref: Core and Builtins<156>-Footnote-45788249
Ref: Core and Builtins<156>-Footnote-55788314
Ref: Core and Builtins<156>-Footnote-65788379
Ref: Core and Builtins<156>-Footnote-75788444
Ref: Core and Builtins<156>-Footnote-85788509
Ref: Core and Builtins<156>-Footnote-95788574
Ref: Core and Builtins<156>-Footnote-105788639
Ref: Core and Builtins<156>-Footnote-115788682
Ref: Core and Builtins<156>-Footnote-125788748
Ref: Core and Builtins<156>-Footnote-135788816
Ref: Core and Builtins<156>-Footnote-145788859
Ref: Core and Builtins<156>-Footnote-155788927
Ref: Core and Builtins<156>-Footnote-165788970
Ref: Core and Builtins<156>-Footnote-175789038
Ref: Core and Builtins<156>-Footnote-185789081
Ref: Core and Builtins<156>-Footnote-195789147
Ref: Core and Builtins<156>-Footnote-205789213
Ref: Core and Builtins<156>-Footnote-215789281
Ref: Core and Builtins<156>-Footnote-225789349
Ref: Core and Builtins<156>-Footnote-235789415
Ref: Core and Builtins<156>-Footnote-245789483
Ref: Core and Builtins<156>-Footnote-255789526
Ref: Core and Builtins<156>-Footnote-265789594
Ref: Core and Builtins<156>-Footnote-275789637
Ref: Core and Builtins<156>-Footnote-285789703
Ref: Core and Builtins<156>-Footnote-295789769
Ref: Core and Builtins<156>-Footnote-305789812
Ref: Core and Builtins<156>-Footnote-315789878
Ref: Core and Builtins<156>-Footnote-325789944
Ref: Core and Builtins<156>-Footnote-335790010
Node: ライブラリ<157>5790053
Ref: whatsnew/changelog id6725790192
Ref: 1f695790192
Ref: ライブラリ<157>-Footnote-15800444
Ref: ライブラリ<157>-Footnote-25800509
Ref: ライブラリ<157>-Footnote-35800574
Ref: ライブラリ<157>-Footnote-45800639
Ref: ライブラリ<157>-Footnote-55800704
Ref: ライブラリ<157>-Footnote-65800769
Ref: ライブラリ<157>-Footnote-75800811
Ref: ライブラリ<157>-Footnote-85800876
Ref: ライブラリ<157>-Footnote-95800941
Ref: ライブラリ<157>-Footnote-105801006
Ref: ライブラリ<157>-Footnote-115801072
Ref: ライブラリ<157>-Footnote-125801138
Ref: ライブラリ<157>-Footnote-135801204
Ref: ライブラリ<157>-Footnote-145801270
Ref: ライブラリ<157>-Footnote-155801336
Ref: ライブラリ<157>-Footnote-165801402
Ref: ライブラリ<157>-Footnote-175801468
Ref: ライブラリ<157>-Footnote-185801534
Ref: ライブラリ<157>-Footnote-195801600
Ref: ライブラリ<157>-Footnote-205801666
Ref: ライブラリ<157>-Footnote-215801732
Ref: ライブラリ<157>-Footnote-225801798
Ref: ライブラリ<157>-Footnote-235801864
Ref: ライブラリ<157>-Footnote-245801930
Ref: ライブラリ<157>-Footnote-255801996
Ref: ライブラリ<157>-Footnote-265802062
Ref: ライブラリ<157>-Footnote-275802128
Ref: ライブラリ<157>-Footnote-285802194
Ref: ライブラリ<157>-Footnote-295802260
Ref: ライブラリ<157>-Footnote-305802326
Ref: ライブラリ<157>-Footnote-315802392
Ref: ライブラリ<157>-Footnote-325802458
Ref: ライブラリ<157>-Footnote-335802524
Ref: ライブラリ<157>-Footnote-345802590
Ref: ライブラリ<157>-Footnote-355802656
Ref: ライブラリ<157>-Footnote-365802722
Ref: ライブラリ<157>-Footnote-375802788
Ref: ライブラリ<157>-Footnote-385802854
Ref: ライブラリ<157>-Footnote-395802920
Ref: ライブラリ<157>-Footnote-405802986
Ref: ライブラリ<157>-Footnote-415803052
Ref: ライブラリ<157>-Footnote-425803118
Ref: ライブラリ<157>-Footnote-435803184
Ref: ライブラリ<157>-Footnote-445803250
Ref: ライブラリ<157>-Footnote-455803316
Ref: ライブラリ<157>-Footnote-465803382
Ref: ライブラリ<157>-Footnote-475803448
Ref: ライブラリ<157>-Footnote-485803514
Ref: ライブラリ<157>-Footnote-495803557
Ref: ライブラリ<157>-Footnote-505803623
Ref: ライブラリ<157>-Footnote-515803666
Ref: ライブラリ<157>-Footnote-525803732
Ref: ライブラリ<157>-Footnote-535803798
Ref: ライブラリ<157>-Footnote-545803864
Ref: ライブラリ<157>-Footnote-555803907
Ref: ライブラリ<157>-Footnote-565803973
Ref: ライブラリ<157>-Footnote-575804039
Ref: ライブラリ<157>-Footnote-585804105
Ref: ライブラリ<157>-Footnote-595804171
Ref: ライブラリ<157>-Footnote-605804237
Ref: ライブラリ<157>-Footnote-615804303
Node: ドキュメント<46>5804369
Ref: whatsnew/changelog id6735804499
Ref: 1f6c5804499
Ref: ドキュメント<46>-Footnote-15805084
Ref: ドキュメント<46>-Footnote-25805149
Ref: ドキュメント<46>-Footnote-35805214
Ref: ドキュメント<46>-Footnote-45805279
Node: テスト<50>5805344
Ref: whatsnew/changelog id6745805467
Ref: 1f6f5805467
Ref: テスト<50>-Footnote-15806553
Ref: テスト<50>-Footnote-25806618
Ref: テスト<50>-Footnote-35806683
Ref: テスト<50>-Footnote-45806748
Ref: テスト<50>-Footnote-55806813
Ref: テスト<50>-Footnote-65806878
Ref: テスト<50>-Footnote-75806943
Ref: テスト<50>-Footnote-85807002
Ref: テスト<50>-Footnote-95807067
Node: ビルド<53>5807131
Ref: whatsnew/changelog id6755807243
Ref: 1f715807243
Ref: ビルド<53>-Footnote-15807661
Ref: ビルド<53>-Footnote-25807726
Ref: ビルド<53>-Footnote-35807791
Node: Windows<46>5807856
Ref: whatsnew/changelog id6765807964
Ref: 1f725807964
Ref: Windows<46>-Footnote-15808177
Ref: Windows<46>-Footnote-25808242
Node: macOS<37>5808306
Ref: whatsnew/changelog id6775808409
Ref: 1f735808409
Ref: macOS<37>-Footnote-15808865
Ref: macOS<37>-Footnote-25808930
Node: IDLE<28>5808995
Ref: whatsnew/changelog id6785809102
Ref: 1f745809102
Ref: IDLE<28>-Footnote-15809446
Ref: IDLE<28>-Footnote-25809511
Node: Tools/Demos<29>5809576
Ref: whatsnew/changelog id6795809683
Ref: 1f755809683
Ref: Tools/Demos<29>-Footnote-15810150
Ref: Tools/Demos<29>-Footnote-25810215
Ref: Tools/Demos<29>-Footnote-35810280
Node: C API<49>5810345
Ref: whatsnew/changelog id6805810435
Ref: 1f765810435
Ref: C API<49>-Footnote-15812410
Ref: C API<49>-Footnote-25812475
Ref: C API<49>-Footnote-35812540
Ref: C API<49>-Footnote-45812605
Ref: C API<49>-Footnote-55812670
Ref: C API<49>-Footnote-65812735
Ref: C API<49>-Footnote-75812800
Ref: C API<49>-Footnote-85812865
Ref: C API<49>-Footnote-95812930
Node: Python 3 9 0 alpha 55812995
Ref: whatsnew/changelog python-3-9-0-alpha-55813122
Ref: 1f775813122
Node: セキュリティ<38>5813570
Ref: whatsnew/changelog id6815813680
Ref: 1f785813680
Ref: セキュリティ<38>-Footnote-15813978
Ref: セキュリティ<38>-Footnote-25814043
Node: Core and Builtins<157>5814099
Ref: whatsnew/changelog id6825814238
Ref: 1f795814238
Ref: Core and Builtins<157>-Footnote-15820083
Ref: Core and Builtins<157>-Footnote-25820148
Ref: Core and Builtins<157>-Footnote-35820215
Ref: Core and Builtins<157>-Footnote-45820257
Ref: Core and Builtins<157>-Footnote-55820324
Ref: Core and Builtins<157>-Footnote-65820366
Ref: Core and Builtins<157>-Footnote-75820431
Ref: Core and Builtins<157>-Footnote-85820496
Ref: Core and Builtins<157>-Footnote-95820563
Ref: Core and Builtins<157>-Footnote-105820630
Ref: Core and Builtins<157>-Footnote-115820673
Ref: Core and Builtins<157>-Footnote-125820739
Ref: Core and Builtins<157>-Footnote-135820782
Ref: Core and Builtins<157>-Footnote-145820848
Ref: Core and Builtins<157>-Footnote-155820914
Ref: Core and Builtins<157>-Footnote-165820957
Ref: Core and Builtins<157>-Footnote-175821025
Ref: Core and Builtins<157>-Footnote-185821068
Ref: Core and Builtins<157>-Footnote-195821134
Ref: Core and Builtins<157>-Footnote-205821200
Ref: Core and Builtins<157>-Footnote-215821266
Ref: Core and Builtins<157>-Footnote-225821332
Ref: Core and Builtins<157>-Footnote-235821375
Ref: Core and Builtins<157>-Footnote-245821441
Ref: Core and Builtins<157>-Footnote-255821507
Ref: Core and Builtins<157>-Footnote-265821573
Ref: Core and Builtins<157>-Footnote-275821639
Ref: Core and Builtins<157>-Footnote-285821705
Ref: Core and Builtins<157>-Footnote-295821771
Ref: Core and Builtins<157>-Footnote-305821837
Ref: Core and Builtins<157>-Footnote-315821903
Ref: Core and Builtins<157>-Footnote-325821971
Ref: Core and Builtins<157>-Footnote-335822014
Ref: Core and Builtins<157>-Footnote-345822080
Ref: Core and Builtins<157>-Footnote-355822123
Ref: Core and Builtins<157>-Footnote-365822189
Ref: Core and Builtins<157>-Footnote-375822257
Ref: Core and Builtins<157>-Footnote-385822300
Ref: Core and Builtins<157>-Footnote-395822366
Ref: Core and Builtins<157>-Footnote-405822432
Ref: Core and Builtins<157>-Footnote-415822498
Ref: Core and Builtins<157>-Footnote-425822564
Node: ライブラリ<158>5822630
Ref: whatsnew/changelog id6835822769
Ref: 1f7a5822769
Ref: ライブラリ<158>-Footnote-15831899
Ref: ライブラリ<158>-Footnote-25831964
Ref: ライブラリ<158>-Footnote-35832029
Ref: ライブラリ<158>-Footnote-45832094
Ref: ライブラリ<158>-Footnote-55832159
Ref: ライブラリ<158>-Footnote-65832224
Ref: ライブラリ<158>-Footnote-75832289
Ref: ライブラリ<158>-Footnote-85832354
Ref: ライブラリ<158>-Footnote-95832419
Ref: ライブラリ<158>-Footnote-105832484
Ref: ライブラリ<158>-Footnote-115832550
Ref: ライブラリ<158>-Footnote-125832616
Ref: ライブラリ<158>-Footnote-135832659
Ref: ライブラリ<158>-Footnote-145832725
Ref: ライブラリ<158>-Footnote-155832791
Ref: ライブラリ<158>-Footnote-165832857
Ref: ライブラリ<158>-Footnote-175832900
Ref: ライブラリ<158>-Footnote-185832966
Ref: ライブラリ<158>-Footnote-195833032
Ref: ライブラリ<158>-Footnote-205833098
Ref: ライブラリ<158>-Footnote-215833164
Ref: ライブラリ<158>-Footnote-225833230
Ref: ライブラリ<158>-Footnote-235833296
Ref: ライブラリ<158>-Footnote-245833362
Ref: ライブラリ<158>-Footnote-255833428
Ref: ライブラリ<158>-Footnote-265833494
Ref: ライブラリ<158>-Footnote-275833560
Ref: ライブラリ<158>-Footnote-285833626
Ref: ライブラリ<158>-Footnote-295833692
Ref: ライブラリ<158>-Footnote-305833758
Ref: ライブラリ<158>-Footnote-315833824
Ref: ライブラリ<158>-Footnote-325833890
Ref: ライブラリ<158>-Footnote-335833933
Ref: ライブラリ<158>-Footnote-345833999
Ref: ライブラリ<158>-Footnote-355834065
Ref: ライブラリ<158>-Footnote-365834131
Ref: ライブラリ<158>-Footnote-375834197
Ref: ライブラリ<158>-Footnote-385834263
Ref: ライブラリ<158>-Footnote-395834329
Ref: ライブラリ<158>-Footnote-405834372
Ref: ライブラリ<158>-Footnote-415834438
Ref: ライブラリ<158>-Footnote-425834504
Ref: ライブラリ<158>-Footnote-435834570
Ref: ライブラリ<158>-Footnote-445834636
Ref: ライブラリ<158>-Footnote-455834702
Ref: ライブラリ<158>-Footnote-465834768
Ref: ライブラリ<158>-Footnote-475834834
Ref: ライブラリ<158>-Footnote-485834900
Ref: ライブラリ<158>-Footnote-495834966
Ref: ライブラリ<158>-Footnote-505835032
Ref: ライブラリ<158>-Footnote-515835098
Ref: ライブラリ<158>-Footnote-525835164
Ref: ライブラリ<158>-Footnote-535835230
Ref: ライブラリ<158>-Footnote-545835296
Node: ドキュメント<47>5835362
Ref: whatsnew/changelog id6845835492
Ref: 1f805835492
Ref: ドキュメント<47>-Footnote-15836131
Ref: ドキュメント<47>-Footnote-25836196
Ref: ドキュメント<47>-Footnote-35836238
Ref: ドキュメント<47>-Footnote-45836303
Ref: ドキュメント<47>-Footnote-55836368
Ref: ドキュメント<47>-Footnote-65836433
Ref: ドキュメント<47>-Footnote-75836498
Node: テスト<51>5836563
Ref: whatsnew/changelog id6855836686
Ref: 1f815836686
Ref: テスト<51>-Footnote-15837369
Ref: テスト<51>-Footnote-25837434
Ref: テスト<51>-Footnote-35837499
Ref: テスト<51>-Footnote-45837564
Node: ビルド<54>5837629
Ref: whatsnew/changelog id6865837741
Ref: 1f825837741
Ref: ビルド<54>-Footnote-15838616
Ref: ビルド<54>-Footnote-25838681
Ref: ビルド<54>-Footnote-35838746
Node: Windows<47>5838813
Ref: whatsnew/changelog id6875838921
Ref: 1f835838921
Ref: Windows<47>-Footnote-15839803
Ref: Windows<47>-Footnote-25839868
Ref: Windows<47>-Footnote-35839933
Ref: Windows<47>-Footnote-45839998
Ref: Windows<47>-Footnote-55840063
Ref: Windows<47>-Footnote-65840128
Node: macOS<38>5840193
Ref: whatsnew/changelog id6885840296
Ref: 1f845840296
Ref: macOS<38>-Footnote-15840426
Node: IDLE<29>5840491
Ref: whatsnew/changelog id6895840598
Ref: 1f855840598
Ref: IDLE<29>-Footnote-15841152
Ref: IDLE<29>-Footnote-25841217
Ref: IDLE<29>-Footnote-35841282
Ref: IDLE<29>-Footnote-45841347
Node: Tools/Demos<30>5841412
Ref: whatsnew/changelog id6905841519
Ref: 1f865841519
Ref: Tools/Demos<30>-Footnote-15842048
Ref: Tools/Demos<30>-Footnote-25842113
Node: C API<50>5842178
Ref: whatsnew/changelog id6915842268
Ref: 1f875842268
Ref: C API<50>-Footnote-15845812
Ref: C API<50>-Footnote-25845877
Ref: C API<50>-Footnote-35845942
Ref: C API<50>-Footnote-45846007
Ref: C API<50>-Footnote-55846072
Ref: C API<50>-Footnote-65846137
Ref: C API<50>-Footnote-75846202
Ref: C API<50>-Footnote-85846267
Ref: C API<50>-Footnote-95846332
Ref: C API<50>-Footnote-105846397
Ref: C API<50>-Footnote-115846463
Ref: C API<50>-Footnote-125846529
Ref: C API<50>-Footnote-135846595
Ref: C API<50>-Footnote-145846661
Ref: C API<50>-Footnote-155846727
Ref: C API<50>-Footnote-165846793
Ref: C API<50>-Footnote-175846859
Node: Python 3 9 0 alpha 45846925
Ref: whatsnew/changelog python-3-9-0-alpha-45847052
Ref: 1f8c5847052
Node: セキュリティ<39>5847445
Ref: whatsnew/changelog id6925847555
Ref: 1f8d5847555
Ref: セキュリティ<39>-Footnote-15847980
Ref: セキュリティ<39>-Footnote-25848045
Ref: セキュリティ<39>-Footnote-35848110
Node: Core and Builtins<158>5848175
Ref: whatsnew/changelog id6935848314
Ref: 1f8e5848314
Ref: Core and Builtins<158>-Footnote-15851717
Ref: Core and Builtins<158>-Footnote-25851782
Ref: Core and Builtins<158>-Footnote-35851847
Ref: Core and Builtins<158>-Footnote-45851912
Ref: Core and Builtins<158>-Footnote-55851977
Ref: Core and Builtins<158>-Footnote-65852042
Ref: Core and Builtins<158>-Footnote-75852107
Ref: Core and Builtins<158>-Footnote-85852172
Ref: Core and Builtins<158>-Footnote-95852239
Ref: Core and Builtins<158>-Footnote-105852281
Ref: Core and Builtins<158>-Footnote-115852349
Ref: Core and Builtins<158>-Footnote-125852392
Ref: Core and Builtins<158>-Footnote-135852458
Ref: Core and Builtins<158>-Footnote-145852524
Ref: Core and Builtins<158>-Footnote-155852590
Ref: Core and Builtins<158>-Footnote-165852656
Ref: Core and Builtins<158>-Footnote-175852722
Ref: Core and Builtins<158>-Footnote-185852790
Ref: Core and Builtins<158>-Footnote-195852833
Ref: Core and Builtins<158>-Footnote-205852901
Ref: Core and Builtins<158>-Footnote-215852944
Ref: Core and Builtins<158>-Footnote-225853012
Ref: Core and Builtins<158>-Footnote-235853055
Ref: Core and Builtins<158>-Footnote-245853121
Ref: Core and Builtins<158>-Footnote-255853187
Ref: Core and Builtins<158>-Footnote-265853253
Ref: Core and Builtins<158>-Footnote-275853319
Ref: Core and Builtins<158>-Footnote-285853385
Ref: Core and Builtins<158>-Footnote-295853451
Node: ライブラリ<159>5853517
Ref: whatsnew/changelog id6945853656
Ref: 1f905853656
Ref: ライブラリ<159>-Footnote-15859838
Ref: ライブラリ<159>-Footnote-25859903
Ref: ライブラリ<159>-Footnote-35859968
Ref: ライブラリ<159>-Footnote-45860033
Ref: ライブラリ<159>-Footnote-55860098
Ref: ライブラリ<159>-Footnote-65860163
Ref: ライブラリ<159>-Footnote-75860228
Ref: ライブラリ<159>-Footnote-85860293
Ref: ライブラリ<159>-Footnote-95860358
Ref: ライブラリ<159>-Footnote-105860423
Ref: ライブラリ<159>-Footnote-115860489
Ref: ライブラリ<159>-Footnote-125860555
Ref: ライブラリ<159>-Footnote-135860621
Ref: ライブラリ<159>-Footnote-145860687
Ref: ライブラリ<159>-Footnote-155860753
Ref: ライブラリ<159>-Footnote-165860819
Ref: ライブラリ<159>-Footnote-175860901
Ref: ライブラリ<159>-Footnote-185860967
Ref: ライブラリ<159>-Footnote-195861033
Ref: ライブラリ<159>-Footnote-205861099
Ref: ライブラリ<159>-Footnote-215861165
Ref: ライブラリ<159>-Footnote-225861231
Ref: ライブラリ<159>-Footnote-235861297
Ref: ライブラリ<159>-Footnote-245861363
Ref: ライブラリ<159>-Footnote-255861429
Ref: ライブラリ<159>-Footnote-265861495
Ref: ライブラリ<159>-Footnote-275861561
Ref: ライブラリ<159>-Footnote-285861604
Ref: ライブラリ<159>-Footnote-295861670
Ref: ライブラリ<159>-Footnote-305861736
Ref: ライブラリ<159>-Footnote-315861802
Ref: ライブラリ<159>-Footnote-325861868
Ref: ライブラリ<159>-Footnote-335861934
Ref: ライブラリ<159>-Footnote-345862000
Ref: ライブラリ<159>-Footnote-355862066
Ref: ライブラリ<159>-Footnote-365862132
Ref: ライブラリ<159>-Footnote-375862198
Ref: ライブラリ<159>-Footnote-385862264
Ref: ライブラリ<159>-Footnote-395862330
Node: ドキュメント<48>5862396
Ref: whatsnew/changelog id6955862526
Ref: 1f915862526
Ref: ドキュメント<48>-Footnote-15863561
Ref: ドキュメント<48>-Footnote-25863626
Ref: ドキュメント<48>-Footnote-35863691
Ref: ドキュメント<48>-Footnote-45863756
Ref: ドキュメント<48>-Footnote-55863821
Ref: ドキュメント<48>-Footnote-65863886
Ref: ドキュメント<48>-Footnote-75863951
Node: テスト<52>5864015
Ref: whatsnew/changelog id6965864138
Ref: 1f925864138
Ref: テスト<52>-Footnote-15864477
Ref: テスト<52>-Footnote-25864542
Node: ビルド<55>5864607
Ref: whatsnew/changelog id6975864719
Ref: 1f935864719
Ref: ビルド<55>-Footnote-15864854
Node: Windows<48>5864919
Ref: whatsnew/changelog id6985865026
Ref: 1f945865026
Ref: Windows<48>-Footnote-15865834
Ref: Windows<48>-Footnote-25865899
Ref: Windows<48>-Footnote-35865964
Ref: Windows<48>-Footnote-45866029
Ref: Windows<48>-Footnote-55866094
Ref: Windows<48>-Footnote-65866159
Node: IDLE<30>5866224
Ref: whatsnew/changelog id6995866327
Ref: 1f955866327
Ref: IDLE<30>-Footnote-15866874
Ref: IDLE<30>-Footnote-25866939
Ref: IDLE<30>-Footnote-35867004
Ref: IDLE<30>-Footnote-45867069
Ref: IDLE<30>-Footnote-55867134
Node: C API<51>5867199
Ref: whatsnew/changelog id7005867282
Ref: 1f965867282
Ref: C API<51>-Footnote-15869941
Ref: C API<51>-Footnote-25870006
Ref: C API<51>-Footnote-35870071
Ref: C API<51>-Footnote-45870136
Ref: C API<51>-Footnote-55870201
Ref: C API<51>-Footnote-65870266
Ref: C API<51>-Footnote-75870331
Ref: C API<51>-Footnote-85870396
Ref: C API<51>-Footnote-95870461
Ref: C API<51>-Footnote-105870526
Ref: C API<51>-Footnote-115870592
Ref: C API<51>-Footnote-125870658
Node: Python 3 9 0 alpha 35870724
Ref: whatsnew/changelog python-3-9-0-alpha-35870851
Ref: 1f9b5870851
Node: Core and Builtins<159>5871146
Ref: whatsnew/changelog id7015871254
Ref: 1f9c5871254
Ref: Core and Builtins<159>-Footnote-15875340
Ref: Core and Builtins<159>-Footnote-25875405
Ref: Core and Builtins<159>-Footnote-35875470
Ref: Core and Builtins<159>-Footnote-45875535
Ref: Core and Builtins<159>-Footnote-55875600
Ref: Core and Builtins<159>-Footnote-65875665
Ref: Core and Builtins<159>-Footnote-75875730
Ref: Core and Builtins<159>-Footnote-85875795
Ref: Core and Builtins<159>-Footnote-95875860
Ref: Core and Builtins<159>-Footnote-105875925
Ref: Core and Builtins<159>-Footnote-115875991
Ref: Core and Builtins<159>-Footnote-125876059
Ref: Core and Builtins<159>-Footnote-135876102
Ref: Core and Builtins<159>-Footnote-145876168
Ref: Core and Builtins<159>-Footnote-155876234
Ref: Core and Builtins<159>-Footnote-165876300
Ref: Core and Builtins<159>-Footnote-175876366
Ref: Core and Builtins<159>-Footnote-185876432
Ref: Core and Builtins<159>-Footnote-195876498
Ref: Core and Builtins<159>-Footnote-205876564
Ref: Core and Builtins<159>-Footnote-215876630
Ref: Core and Builtins<159>-Footnote-225876696
Ref: Core and Builtins<159>-Footnote-235876762
Ref: Core and Builtins<159>-Footnote-245876828
Node: ライブラリ<160>5876894
Ref: whatsnew/changelog id7025877033
Ref: 1fa05877033
Ref: ライブラリ<160>-Footnote-15886636
Ref: ライブラリ<160>-Footnote-25886701
Ref: ライブラリ<160>-Footnote-35886766
Ref: ライブラリ<160>-Footnote-45886831
Ref: ライブラリ<160>-Footnote-55886896
Ref: ライブラリ<160>-Footnote-65886961
Ref: ライブラリ<160>-Footnote-75887026
Ref: ライブラリ<160>-Footnote-85887091
Ref: ライブラリ<160>-Footnote-95887156
Ref: ライブラリ<160>-Footnote-105887221
Ref: ライブラリ<160>-Footnote-115887287
Ref: ライブラリ<160>-Footnote-125887353
Ref: ライブラリ<160>-Footnote-135887419
Ref: ライブラリ<160>-Footnote-145887485
Ref: ライブラリ<160>-Footnote-155887551
Ref: ライブラリ<160>-Footnote-165887617
Ref: ライブラリ<160>-Footnote-175887683
Ref: ライブラリ<160>-Footnote-185887749
Ref: ライブラリ<160>-Footnote-195887815
Ref: ライブラリ<160>-Footnote-205887881
Ref: ライブラリ<160>-Footnote-215887947
Ref: ライブラリ<160>-Footnote-225888013
Ref: ライブラリ<160>-Footnote-235888079
Ref: ライブラリ<160>-Footnote-245888145
Ref: ライブラリ<160>-Footnote-255888211
Ref: ライブラリ<160>-Footnote-265888277
Ref: ライブラリ<160>-Footnote-275888343
Ref: ライブラリ<160>-Footnote-285888409
Ref: ライブラリ<160>-Footnote-295888475
Ref: ライブラリ<160>-Footnote-305888541
Ref: ライブラリ<160>-Footnote-315888607
Ref: ライブラリ<160>-Footnote-325888673
Ref: ライブラリ<160>-Footnote-335888739
Ref: ライブラリ<160>-Footnote-345888805
Ref: ライブラリ<160>-Footnote-355888871
Ref: ライブラリ<160>-Footnote-365888937
Ref: ライブラリ<160>-Footnote-375889003
Ref: ライブラリ<160>-Footnote-385889069
Ref: ライブラリ<160>-Footnote-395889135
Ref: ライブラリ<160>-Footnote-405889201
Ref: ライブラリ<160>-Footnote-415889267
Ref: ライブラリ<160>-Footnote-425889333
Ref: ライブラリ<160>-Footnote-435889399
Ref: ライブラリ<160>-Footnote-445889465
Ref: ライブラリ<160>-Footnote-455889531
Ref: ライブラリ<160>-Footnote-465889597
Ref: ライブラリ<160>-Footnote-475889663
Ref: ライブラリ<160>-Footnote-485889729
Ref: ライブラリ<160>-Footnote-495889795
Ref: ライブラリ<160>-Footnote-505889861
Ref: ライブラリ<160>-Footnote-515889927
Ref: ライブラリ<160>-Footnote-525889993
Ref: ライブラリ<160>-Footnote-535890059
Node: ドキュメント<49>5890125
Ref: whatsnew/changelog id7035890255
Ref: 1fa15890255
Ref: ドキュメント<49>-Footnote-15890867
Ref: ドキュメント<49>-Footnote-25890932
Ref: ドキュメント<49>-Footnote-35890997
Node: ビルド<56>5891061
Ref: whatsnew/changelog id7045891179
Ref: 1fa35891179
Ref: ビルド<56>-Footnote-15891710
Ref: ビルド<56>-Footnote-25891775
Ref: ビルド<56>-Footnote-35891840
Node: IDLE<31>5891905
Ref: whatsnew/changelog id7055892010
Ref: 1fa45892010
Ref: IDLE<31>-Footnote-15892431
Ref: IDLE<31>-Footnote-25892496
Ref: IDLE<31>-Footnote-35892561
Node: C API<52>5892626
Ref: whatsnew/changelog id7065892709
Ref: 1fa55892709
Ref: C API<52>-Footnote-15893474
Ref: C API<52>-Footnote-25893539
Node: Python 3 9 0 alpha 25893604
Ref: whatsnew/changelog python-3-9-0-alpha-25893731
Ref: 1fa65893731
Node: セキュリティ<40>5894144
Ref: whatsnew/changelog id7075894254
Ref: 1fa75894254
Ref: セキュリティ<40>-Footnote-15895141
Ref: セキュリティ<40>-Footnote-25895206
Ref: セキュリティ<40>-Footnote-35895271
Ref: セキュリティ<40>-Footnote-45895336
Node: Core and Builtins<160>5895401
Ref: whatsnew/changelog id7085895540
Ref: 1fa85895540
Ref: Core and Builtins<160>-Footnote-15899209
Ref: Core and Builtins<160>-Footnote-25899274
Ref: Core and Builtins<160>-Footnote-35899339
Ref: Core and Builtins<160>-Footnote-45899404
Ref: Core and Builtins<160>-Footnote-55899469
Ref: Core and Builtins<160>-Footnote-65899534
Ref: Core and Builtins<160>-Footnote-75899599
Ref: Core and Builtins<160>-Footnote-85899664
Ref: Core and Builtins<160>-Footnote-95899729
Ref: Core and Builtins<160>-Footnote-105899794
Ref: Core and Builtins<160>-Footnote-115899860
Ref: Core and Builtins<160>-Footnote-125899926
Ref: Core and Builtins<160>-Footnote-135899992
Ref: Core and Builtins<160>-Footnote-145900058
Ref: Core and Builtins<160>-Footnote-155900124
Ref: Core and Builtins<160>-Footnote-165900190
Ref: Core and Builtins<160>-Footnote-175900256
Ref: Core and Builtins<160>-Footnote-185900322
Ref: Core and Builtins<160>-Footnote-195900388
Ref: Core and Builtins<160>-Footnote-205900454
Node: ライブラリ<161>5900520
Ref: whatsnew/changelog id7095900659
Ref: 1fa95900659
Ref: ライブラリ<161>-Footnote-15908450
Ref: ライブラリ<161>-Footnote-25908515
Ref: ライブラリ<161>-Footnote-35908580
Ref: ライブラリ<161>-Footnote-45908645
Ref: ライブラリ<161>-Footnote-55908710
Ref: ライブラリ<161>-Footnote-65908775
Ref: ライブラリ<161>-Footnote-75908840
Ref: ライブラリ<161>-Footnote-85908905
Ref: ライブラリ<161>-Footnote-95908970
Ref: ライブラリ<161>-Footnote-105909035
Ref: ライブラリ<161>-Footnote-115909101
Ref: ライブラリ<161>-Footnote-125909167
Ref: ライブラリ<161>-Footnote-135909233
Ref: ライブラリ<161>-Footnote-145909299
Ref: ライブラリ<161>-Footnote-155909365
Ref: ライブラリ<161>-Footnote-165909431
Ref: ライブラリ<161>-Footnote-175909497
Ref: ライブラリ<161>-Footnote-185909563
Ref: ライブラリ<161>-Footnote-195909629
Ref: ライブラリ<161>-Footnote-205909695
Ref: ライブラリ<161>-Footnote-215909761
Ref: ライブラリ<161>-Footnote-225909827
Ref: ライブラリ<161>-Footnote-235909893
Ref: ライブラリ<161>-Footnote-245909959
Ref: ライブラリ<161>-Footnote-255910025
Ref: ライブラリ<161>-Footnote-265910091
Ref: ライブラリ<161>-Footnote-275910157
Ref: ライブラリ<161>-Footnote-285910223
Ref: ライブラリ<161>-Footnote-295910289
Ref: ライブラリ<161>-Footnote-305910355
Ref: ライブラリ<161>-Footnote-315910421
Ref: ライブラリ<161>-Footnote-325910487
Ref: ライブラリ<161>-Footnote-335910553
Ref: ライブラリ<161>-Footnote-345910619
Ref: ライブラリ<161>-Footnote-355910685
Ref: ライブラリ<161>-Footnote-365910751
Ref: ライブラリ<161>-Footnote-375910817
Ref: ライブラリ<161>-Footnote-385910883
Ref: ライブラリ<161>-Footnote-395910949
Ref: ライブラリ<161>-Footnote-405911015
Node: ドキュメント<50>5911081
Ref: whatsnew/changelog id7105911211
Ref: 1faa5911211
Ref: ドキュメント<50>-Footnote-15911799
Ref: ドキュメント<50>-Footnote-25911864
Ref: ドキュメント<50>-Footnote-35911929
Node: テスト<53>5911994
Ref: whatsnew/changelog id7115912117
Ref: 1fab5912117
Ref: テスト<53>-Footnote-15914689
Ref: テスト<53>-Footnote-25914754
Ref: テスト<53>-Footnote-35914819
Ref: テスト<53>-Footnote-45914884
Ref: テスト<53>-Footnote-55914949
Ref: テスト<53>-Footnote-65915014
Ref: テスト<53>-Footnote-75915079
Ref: テスト<53>-Footnote-85915144
Ref: テスト<53>-Footnote-95915209
Ref: テスト<53>-Footnote-105915274
Ref: テスト<53>-Footnote-115915340
Ref: テスト<53>-Footnote-125915406
Ref: テスト<53>-Footnote-135915472
Node: ビルド<57>5915538
Ref: whatsnew/changelog id7125915650
Ref: 1faf5915650
Ref: ビルド<57>-Footnote-15916053
Ref: ビルド<57>-Footnote-25916118
Node: Windows<49>5916183
Ref: whatsnew/changelog id7135916291
Ref: 1fb05916291
Ref: Windows<49>-Footnote-15916532
Ref: Windows<49>-Footnote-25916597
Node: macOS<39>5916662
Ref: whatsnew/changelog id7145916765
Ref: 1fb15916765
Ref: macOS<39>-Footnote-15917073
Node: IDLE<32>5917138
Ref: whatsnew/changelog id7155917239
Ref: 1fb25917239
Ref: IDLE<32>-Footnote-15917830
Ref: IDLE<32>-Footnote-25917895
Ref: IDLE<32>-Footnote-35917960
Ref: IDLE<32>-Footnote-45918025
Node: C API<53>5918090
Ref: whatsnew/changelog id7165918173
Ref: 1fb35918173
Ref: C API<53>-Footnote-15918707
Ref: C API<53>-Footnote-25918772
Ref: C API<53>-Footnote-35918837
Node: Python 3 9 0 alpha 15918902
Ref: whatsnew/changelog python-3-9-0-alpha-15919028
Ref: 1fb45919028
Node: セキュリティ<41>5919473
Ref: whatsnew/changelog id7175919583
Ref: 1fb55919583
Ref: セキュリティ<41>-Footnote-15921918
Ref: セキュリティ<41>-Footnote-25921983
Ref: セキュリティ<41>-Footnote-35922048
Ref: セキュリティ<41>-Footnote-45922113
Ref: セキュリティ<41>-Footnote-55922178
Ref: セキュリティ<41>-Footnote-65922243
Ref: セキュリティ<41>-Footnote-75922308
Ref: セキュリティ<41>-Footnote-85922364
Ref: セキュリティ<41>-Footnote-95922429
Ref: セキュリティ<41>-Footnote-105922494
Ref: セキュリティ<41>-Footnote-115922560
Ref: セキュリティ<41>-Footnote-125922626
Ref: セキュリティ<41>-Footnote-135922692
Ref: セキュリティ<41>-Footnote-145922758
Ref: セキュリティ<41>-Footnote-155922824
Node: Core and Builtins<161>5922890
Ref: whatsnew/changelog id7185923029
Ref: 1fb85923029
Ref: Core and Builtins<161>-Footnote-15938542
Ref: Core and Builtins<161>-Footnote-25938607
Ref: Core and Builtins<161>-Footnote-35938672
Ref: Core and Builtins<161>-Footnote-45938737
Ref: Core and Builtins<161>-Footnote-55938802
Ref: Core and Builtins<161>-Footnote-65938867
Ref: Core and Builtins<161>-Footnote-75938932
Ref: Core and Builtins<161>-Footnote-85938997
Ref: Core and Builtins<161>-Footnote-95939062
Ref: Core and Builtins<161>-Footnote-105939127
Ref: Core and Builtins<161>-Footnote-115939193
Ref: Core and Builtins<161>-Footnote-125939259
Ref: Core and Builtins<161>-Footnote-135939325
Ref: Core and Builtins<161>-Footnote-145939391
Ref: Core and Builtins<161>-Footnote-155939457
Ref: Core and Builtins<161>-Footnote-165939523
Ref: Core and Builtins<161>-Footnote-175939589
Ref: Core and Builtins<161>-Footnote-185939655
Ref: Core and Builtins<161>-Footnote-195939721
Ref: Core and Builtins<161>-Footnote-205939787
Ref: Core and Builtins<161>-Footnote-215939830
Ref: Core and Builtins<161>-Footnote-225939896
Ref: Core and Builtins<161>-Footnote-235939962
Ref: Core and Builtins<161>-Footnote-245940028
Ref: Core and Builtins<161>-Footnote-255940094
Ref: Core and Builtins<161>-Footnote-265940160
Ref: Core and Builtins<161>-Footnote-275940226
Ref: Core and Builtins<161>-Footnote-285940292
Ref: Core and Builtins<161>-Footnote-295940358
Ref: Core and Builtins<161>-Footnote-305940424
Ref: Core and Builtins<161>-Footnote-315940490
Ref: Core and Builtins<161>-Footnote-325940556
Ref: Core and Builtins<161>-Footnote-335940622
Ref: Core and Builtins<161>-Footnote-345940688
Ref: Core and Builtins<161>-Footnote-355940754
Ref: Core and Builtins<161>-Footnote-365940820
Ref: Core and Builtins<161>-Footnote-375940886
Ref: Core and Builtins<161>-Footnote-385940952
Ref: Core and Builtins<161>-Footnote-395941018
Ref: Core and Builtins<161>-Footnote-405941084
Ref: Core and Builtins<161>-Footnote-415941149
Ref: Core and Builtins<161>-Footnote-425941215
Ref: Core and Builtins<161>-Footnote-435941281
Ref: Core and Builtins<161>-Footnote-445941347
Ref: Core and Builtins<161>-Footnote-455941413
Ref: Core and Builtins<161>-Footnote-465941479
Ref: Core and Builtins<161>-Footnote-475941545
Ref: Core and Builtins<161>-Footnote-485941611
Ref: Core and Builtins<161>-Footnote-495941677
Ref: Core and Builtins<161>-Footnote-505941743
Ref: Core and Builtins<161>-Footnote-515941809
Ref: Core and Builtins<161>-Footnote-525941875
Ref: Core and Builtins<161>-Footnote-535941941
Ref: Core and Builtins<161>-Footnote-545941984
Ref: Core and Builtins<161>-Footnote-555942050
Ref: Core and Builtins<161>-Footnote-565942116
Ref: Core and Builtins<161>-Footnote-575942182
Ref: Core and Builtins<161>-Footnote-585942248
Ref: Core and Builtins<161>-Footnote-595942314
Ref: Core and Builtins<161>-Footnote-605942380
Ref: Core and Builtins<161>-Footnote-615942446
Ref: Core and Builtins<161>-Footnote-625942512
Ref: Core and Builtins<161>-Footnote-635942578
Ref: Core and Builtins<161>-Footnote-645942644
Ref: Core and Builtins<161>-Footnote-655942710
Ref: Core and Builtins<161>-Footnote-665942776
Ref: Core and Builtins<161>-Footnote-675942842
Ref: Core and Builtins<161>-Footnote-685942908
Ref: Core and Builtins<161>-Footnote-695942974
Ref: Core and Builtins<161>-Footnote-705943040
Ref: Core and Builtins<161>-Footnote-715943106
Ref: Core and Builtins<161>-Footnote-725943172
Ref: Core and Builtins<161>-Footnote-735943238
Ref: Core and Builtins<161>-Footnote-745943304
Ref: Core and Builtins<161>-Footnote-755943370
Ref: Core and Builtins<161>-Footnote-765943436
Ref: Core and Builtins<161>-Footnote-775943502
Ref: Core and Builtins<161>-Footnote-785943568
Ref: Core and Builtins<161>-Footnote-795943634
Ref: Core and Builtins<161>-Footnote-805943700
Ref: Core and Builtins<161>-Footnote-815943766
Ref: Core and Builtins<161>-Footnote-825943832
Ref: Core and Builtins<161>-Footnote-835943898
Ref: Core and Builtins<161>-Footnote-845943964
Ref: Core and Builtins<161>-Footnote-855944030
Ref: Core and Builtins<161>-Footnote-865944096
Ref: Core and Builtins<161>-Footnote-875944162
Ref: Core and Builtins<161>-Footnote-885944228
Ref: Core and Builtins<161>-Footnote-895944294
Ref: Core and Builtins<161>-Footnote-905944360
Ref: Core and Builtins<161>-Footnote-915944426
Ref: Core and Builtins<161>-Footnote-925944492
Ref: Core and Builtins<161>-Footnote-935944558
Ref: Core and Builtins<161>-Footnote-945944624
Node: ライブラリ<162>5944690
Ref: whatsnew/changelog id7195944829
Ref: 1fba5944829
Ref: ライブラリ<162>-Footnote-15984216
Ref: ライブラリ<162>-Footnote-25984281
Ref: ライブラリ<162>-Footnote-35984346
Ref: ライブラリ<162>-Footnote-45984411
Ref: ライブラリ<162>-Footnote-55984476
Ref: ライブラリ<162>-Footnote-65984541
Ref: ライブラリ<162>-Footnote-75984606
Ref: ライブラリ<162>-Footnote-85984671
Ref: ライブラリ<162>-Footnote-95984736
Ref: ライブラリ<162>-Footnote-105984801
Ref: ライブラリ<162>-Footnote-115984867
Ref: ライブラリ<162>-Footnote-125984933
Ref: ライブラリ<162>-Footnote-135984999
Ref: ライブラリ<162>-Footnote-145985065
Ref: ライブラリ<162>-Footnote-155985131
Ref: ライブラリ<162>-Footnote-165985197
Ref: ライブラリ<162>-Footnote-175985263
Ref: ライブラリ<162>-Footnote-185985329
Ref: ライブラリ<162>-Footnote-195985395
Ref: ライブラリ<162>-Footnote-205985461
Ref: ライブラリ<162>-Footnote-215985527
Ref: ライブラリ<162>-Footnote-225985593
Ref: ライブラリ<162>-Footnote-235985659
Ref: ライブラリ<162>-Footnote-245985725
Ref: ライブラリ<162>-Footnote-255985791
Ref: ライブラリ<162>-Footnote-265985857
Ref: ライブラリ<162>-Footnote-275985923
Ref: ライブラリ<162>-Footnote-285985989
Ref: ライブラリ<162>-Footnote-295986055
Ref: ライブラリ<162>-Footnote-305986121
Ref: ライブラリ<162>-Footnote-315986187
Ref: ライブラリ<162>-Footnote-325986253
Ref: ライブラリ<162>-Footnote-335986319
Ref: ライブラリ<162>-Footnote-345986385
Ref: ライブラリ<162>-Footnote-355986451
Ref: ライブラリ<162>-Footnote-365986517
Ref: ライブラリ<162>-Footnote-375986583
Ref: ライブラリ<162>-Footnote-385986649
Ref: ライブラリ<162>-Footnote-395986715
Ref: ライブラリ<162>-Footnote-405986781
Ref: ライブラリ<162>-Footnote-415986847
Ref: ライブラリ<162>-Footnote-425986913
Ref: ライブラリ<162>-Footnote-435986979
Ref: ライブラリ<162>-Footnote-445987045
Ref: ライブラリ<162>-Footnote-455987111
Ref: ライブラリ<162>-Footnote-465987177
Ref: ライブラリ<162>-Footnote-475987243
Ref: ライブラリ<162>-Footnote-485987309
Ref: ライブラリ<162>-Footnote-495987375
Ref: ライブラリ<162>-Footnote-505987441
Ref: ライブラリ<162>-Footnote-515987507
Ref: ライブラリ<162>-Footnote-525987573
Ref: ライブラリ<162>-Footnote-535987639
Ref: ライブラリ<162>-Footnote-545987705
Ref: ライブラリ<162>-Footnote-555987771
Ref: ライブラリ<162>-Footnote-565987837
Ref: ライブラリ<162>-Footnote-575987903
Ref: ライブラリ<162>-Footnote-585987969
Ref: ライブラリ<162>-Footnote-595988035
Ref: ライブラリ<162>-Footnote-605988101
Ref: ライブラリ<162>-Footnote-615988167
Ref: ライブラリ<162>-Footnote-625988233
Ref: ライブラリ<162>-Footnote-635988299
Ref: ライブラリ<162>-Footnote-645988364
Ref: ライブラリ<162>-Footnote-655988430
Ref: ライブラリ<162>-Footnote-665988496
Ref: ライブラリ<162>-Footnote-675988562
Ref: ライブラリ<162>-Footnote-685988628
Ref: ライブラリ<162>-Footnote-695988694
Ref: ライブラリ<162>-Footnote-705988760
Ref: ライブラリ<162>-Footnote-715988826
Ref: ライブラリ<162>-Footnote-725988892
Ref: ライブラリ<162>-Footnote-735988958
Ref: ライブラリ<162>-Footnote-745989024
Ref: ライブラリ<162>-Footnote-755989090
Ref: ライブラリ<162>-Footnote-765989156
Ref: ライブラリ<162>-Footnote-775989264
Ref: ライブラリ<162>-Footnote-785989330
Ref: ライブラリ<162>-Footnote-795989396
Ref: ライブラリ<162>-Footnote-805989462
Ref: ライブラリ<162>-Footnote-815989528
Ref: ライブラリ<162>-Footnote-825989594
Ref: ライブラリ<162>-Footnote-835989660
Ref: ライブラリ<162>-Footnote-845989726
Ref: ライブラリ<162>-Footnote-855989792
Ref: ライブラリ<162>-Footnote-865989858
Ref: ライブラリ<162>-Footnote-875989924
Ref: ライブラリ<162>-Footnote-885989990
Ref: ライブラリ<162>-Footnote-895990056
Ref: ライブラリ<162>-Footnote-905990122
Ref: ライブラリ<162>-Footnote-915990188
Ref: ライブラリ<162>-Footnote-925990254
Ref: ライブラリ<162>-Footnote-935990320
Ref: ライブラリ<162>-Footnote-945990386
Ref: ライブラリ<162>-Footnote-955990452
Ref: ライブラリ<162>-Footnote-965990518
Ref: ライブラリ<162>-Footnote-975990584
Ref: ライブラリ<162>-Footnote-985990650
Ref: ライブラリ<162>-Footnote-995990716
Ref: ライブラリ<162>-Footnote-1005990782
Ref: ライブラリ<162>-Footnote-1015990849
Ref: ライブラリ<162>-Footnote-1025990916
Ref: ライブラリ<162>-Footnote-1035990983
Ref: ライブラリ<162>-Footnote-1045991050
Ref: ライブラリ<162>-Footnote-1055991117
Ref: ライブラリ<162>-Footnote-1065991184
Ref: ライブラリ<162>-Footnote-1075991251
Ref: ライブラリ<162>-Footnote-1085991317
Ref: ライブラリ<162>-Footnote-1095991384
Ref: ライブラリ<162>-Footnote-1105991451
Ref: ライブラリ<162>-Footnote-1115991518
Ref: ライブラリ<162>-Footnote-1125991585
Ref: ライブラリ<162>-Footnote-1135991652
Ref: ライブラリ<162>-Footnote-1145991719
Ref: ライブラリ<162>-Footnote-1155991786
Ref: ライブラリ<162>-Footnote-1165991853
Ref: ライブラリ<162>-Footnote-1175991920
Ref: ライブラリ<162>-Footnote-1185991987
Ref: ライブラリ<162>-Footnote-1195992054
Ref: ライブラリ<162>-Footnote-1205992121
Ref: ライブラリ<162>-Footnote-1215992188
Ref: ライブラリ<162>-Footnote-1225992255
Ref: ライブラリ<162>-Footnote-1235992322
Ref: ライブラリ<162>-Footnote-1245992389
Ref: ライブラリ<162>-Footnote-1255992456
Ref: ライブラリ<162>-Footnote-1265992523
Ref: ライブラリ<162>-Footnote-1275992590
Ref: ライブラリ<162>-Footnote-1285992657
Ref: ライブラリ<162>-Footnote-1295992724
Ref: ライブラリ<162>-Footnote-1305992791
Ref: ライブラリ<162>-Footnote-1315992858
Ref: ライブラリ<162>-Footnote-1325992925
Ref: ライブラリ<162>-Footnote-1335992992
Ref: ライブラリ<162>-Footnote-1345993059
Ref: ライブラリ<162>-Footnote-1355993126
Ref: ライブラリ<162>-Footnote-1365993193
Ref: ライブラリ<162>-Footnote-1375993270
Ref: ライブラリ<162>-Footnote-1385993337
Ref: ライブラリ<162>-Footnote-1395993404
Ref: ライブラリ<162>-Footnote-1405993471
Ref: ライブラリ<162>-Footnote-1415993538
Ref: ライブラリ<162>-Footnote-1425993605
Ref: ライブラリ<162>-Footnote-1435993672
Ref: ライブラリ<162>-Footnote-1445993739
Ref: ライブラリ<162>-Footnote-1455993806
Ref: ライブラリ<162>-Footnote-1465993873
Ref: ライブラリ<162>-Footnote-1475993940
Ref: ライブラリ<162>-Footnote-1485994007
Ref: ライブラリ<162>-Footnote-1495994074
Ref: ライブラリ<162>-Footnote-1505994141
Ref: ライブラリ<162>-Footnote-1515994208
Ref: ライブラリ<162>-Footnote-1525994275
Ref: ライブラリ<162>-Footnote-1535994342
Ref: ライブラリ<162>-Footnote-1545994409
Ref: ライブラリ<162>-Footnote-1555994476
Ref: ライブラリ<162>-Footnote-1565994543
Ref: ライブラリ<162>-Footnote-1575994610
Ref: ライブラリ<162>-Footnote-1585994677
Ref: ライブラリ<162>-Footnote-1595994744
Ref: ライブラリ<162>-Footnote-1605994811
Ref: ライブラリ<162>-Footnote-1615994878
Ref: ライブラリ<162>-Footnote-1625994945
Ref: ライブラリ<162>-Footnote-1635995012
Ref: ライブラリ<162>-Footnote-1645995079
Ref: ライブラリ<162>-Footnote-1655995146
Ref: ライブラリ<162>-Footnote-1665995213
Ref: ライブラリ<162>-Footnote-1675995280
Ref: ライブラリ<162>-Footnote-1685995347
Ref: ライブラリ<162>-Footnote-1695995414
Ref: ライブラリ<162>-Footnote-1705995481
Ref: ライブラリ<162>-Footnote-1715995548
Ref: ライブラリ<162>-Footnote-1725995615
Ref: ライブラリ<162>-Footnote-1735995659
Ref: ライブラリ<162>-Footnote-1745995726
Ref: ライブラリ<162>-Footnote-1755995793
Ref: ライブラリ<162>-Footnote-1765995860
Ref: ライブラリ<162>-Footnote-1775995927
Ref: ライブラリ<162>-Footnote-1785995994
Ref: ライブラリ<162>-Footnote-1795996061
Ref: ライブラリ<162>-Footnote-1805996128
Ref: ライブラリ<162>-Footnote-1815996195
Ref: ライブラリ<162>-Footnote-1825996262
Ref: ライブラリ<162>-Footnote-1835996329
Ref: ライブラリ<162>-Footnote-1845996396
Ref: ライブラリ<162>-Footnote-1855996463
Ref: ライブラリ<162>-Footnote-1865996530
Ref: ライブラリ<162>-Footnote-1875996597
Ref: ライブラリ<162>-Footnote-1885996664
Ref: ライブラリ<162>-Footnote-1895996731
Ref: ライブラリ<162>-Footnote-1905996798
Ref: ライブラリ<162>-Footnote-1915996865
Ref: ライブラリ<162>-Footnote-1925996932
Ref: ライブラリ<162>-Footnote-1935996999
Ref: ライブラリ<162>-Footnote-1945997066
Ref: ライブラリ<162>-Footnote-1955997133
Ref: ライブラリ<162>-Footnote-1965997200
Ref: ライブラリ<162>-Footnote-1975997267
Ref: ライブラリ<162>-Footnote-1985997334
Ref: ライブラリ<162>-Footnote-1995997401
Ref: ライブラリ<162>-Footnote-2005997468
Ref: ライブラリ<162>-Footnote-2015997535
Ref: ライブラリ<162>-Footnote-2025997602
Ref: ライブラリ<162>-Footnote-2035997669
Ref: ライブラリ<162>-Footnote-2045997736
Ref: ライブラリ<162>-Footnote-2055997803
Ref: ライブラリ<162>-Footnote-2065997870
Ref: ライブラリ<162>-Footnote-2075997937
Ref: ライブラリ<162>-Footnote-2085998004
Ref: ライブラリ<162>-Footnote-2095998071
Ref: ライブラリ<162>-Footnote-2105998138
Ref: ライブラリ<162>-Footnote-2115998205
Ref: ライブラリ<162>-Footnote-2125998272
Ref: ライブラリ<162>-Footnote-2135998339
Ref: ライブラリ<162>-Footnote-2145998406
Ref: ライブラリ<162>-Footnote-2155998473
Ref: ライブラリ<162>-Footnote-2165998540
Ref: ライブラリ<162>-Footnote-2175998607
Ref: ライブラリ<162>-Footnote-2185998674
Ref: ライブラリ<162>-Footnote-2195998741
Ref: ライブラリ<162>-Footnote-2205998808
Ref: ライブラリ<162>-Footnote-2215998875
Ref: ライブラリ<162>-Footnote-2225998942
Ref: ライブラリ<162>-Footnote-2235999009
Ref: ライブラリ<162>-Footnote-2245999076
Ref: ライブラリ<162>-Footnote-2255999143
Ref: ライブラリ<162>-Footnote-2265999210
Ref: ライブラリ<162>-Footnote-2275999277
Ref: ライブラリ<162>-Footnote-2285999344
Ref: ライブラリ<162>-Footnote-2295999411
Ref: ライブラリ<162>-Footnote-2305999478
Ref: ライブラリ<162>-Footnote-2315999545
Ref: ライブラリ<162>-Footnote-2325999612
Ref: ライブラリ<162>-Footnote-2335999679
Ref: ライブラリ<162>-Footnote-2345999746
Ref: ライブラリ<162>-Footnote-2355999813
Ref: ライブラリ<162>-Footnote-2365999880
Ref: ライブラリ<162>-Footnote-2375999947
Ref: ライブラリ<162>-Footnote-2386000014
Ref: ライブラリ<162>-Footnote-2396000081
Ref: ライブラリ<162>-Footnote-2406000147
Ref: ライブラリ<162>-Footnote-2416000214
Ref: ライブラリ<162>-Footnote-2426000281
Ref: ライブラリ<162>-Footnote-2436000348
Ref: ライブラリ<162>-Footnote-2446000415
Ref: ライブラリ<162>-Footnote-2456000482
Ref: ライブラリ<162>-Footnote-2466000549
Ref: ライブラリ<162>-Footnote-2476000616
Ref: ライブラリ<162>-Footnote-2486000683
Ref: ライブラリ<162>-Footnote-2496000750
Ref: ライブラリ<162>-Footnote-2506000817
Ref: ライブラリ<162>-Footnote-2516000884
Ref: ライブラリ<162>-Footnote-2526000951
Ref: ライブラリ<162>-Footnote-2536001018
Node: ドキュメント<51>6001084
Ref: whatsnew/changelog id7206001214
Ref: 1fc66001214
Ref: ドキュメント<51>-Footnote-16005669
Ref: ドキュメント<51>-Footnote-26005734
Ref: ドキュメント<51>-Footnote-36005799
Ref: ドキュメント<51>-Footnote-46005864
Ref: ドキュメント<51>-Footnote-56005929
Ref: ドキュメント<51>-Footnote-66005994
Ref: ドキュメント<51>-Footnote-76006059
Ref: ドキュメント<51>-Footnote-86006124
Ref: ドキュメント<51>-Footnote-96006189
Ref: ドキュメント<51>-Footnote-106006254
Ref: ドキュメント<51>-Footnote-116006320
Ref: ドキュメント<51>-Footnote-126006386
Ref: ドキュメント<51>-Footnote-136006452
Ref: ドキュメント<51>-Footnote-146006518
Ref: ドキュメント<51>-Footnote-156006584
Ref: ドキュメント<51>-Footnote-166006650
Ref: ドキュメント<51>-Footnote-176006716
Ref: ドキュメント<51>-Footnote-186006782
Ref: ドキュメント<51>-Footnote-196006848
Ref: ドキュメント<51>-Footnote-206006914
Ref: ドキュメント<51>-Footnote-216006980
Ref: ドキュメント<51>-Footnote-226007046
Ref: ドキュメント<51>-Footnote-236007112
Ref: ドキュメント<51>-Footnote-246007178
Ref: ドキュメント<51>-Footnote-256007244
Ref: ドキュメント<51>-Footnote-266007310
Ref: ドキュメント<51>-Footnote-276007376
Ref: ドキュメント<51>-Footnote-286007442
Ref: ドキュメント<51>-Footnote-296007508
Ref: ドキュメント<51>-Footnote-306007574
Ref: ドキュメント<51>-Footnote-316007640
Ref: ドキュメント<51>-Footnote-326007706
Ref: ドキュメント<51>-Footnote-336007772
Ref: ドキュメント<51>-Footnote-346007838
Ref: ドキュメント<51>-Footnote-356007904
Node: テスト<54>6007970
Ref: whatsnew/changelog id7216008093
Ref: 1fc86008093
Ref: テスト<54>-Footnote-16016179
Ref: テスト<54>-Footnote-26016244
Ref: テスト<54>-Footnote-36016309
Ref: テスト<54>-Footnote-46016374
Ref: テスト<54>-Footnote-56016439
Ref: テスト<54>-Footnote-66016504
Ref: テスト<54>-Footnote-76016569
Ref: テスト<54>-Footnote-86016634
Ref: テスト<54>-Footnote-96016699
Ref: テスト<54>-Footnote-106016764
Ref: テスト<54>-Footnote-116016830
Ref: テスト<54>-Footnote-126016896
Ref: テスト<54>-Footnote-136016962
Ref: テスト<54>-Footnote-146017028
Ref: テスト<54>-Footnote-156017094
Ref: テスト<54>-Footnote-166017160
Ref: テスト<54>-Footnote-176017226
Ref: テスト<54>-Footnote-186017292
Ref: テスト<54>-Footnote-196017358
Ref: テスト<54>-Footnote-206017424
Ref: テスト<54>-Footnote-216017490
Ref: テスト<54>-Footnote-226017556
Ref: テスト<54>-Footnote-236017622
Ref: テスト<54>-Footnote-246017688
Ref: テスト<54>-Footnote-256017754
Ref: テスト<54>-Footnote-266017820
Ref: テスト<54>-Footnote-276017886
Ref: テスト<54>-Footnote-286017952
Ref: テスト<54>-Footnote-296018018
Ref: テスト<54>-Footnote-306018084
Ref: テスト<54>-Footnote-316018150
Ref: テスト<54>-Footnote-326018216
Ref: テスト<54>-Footnote-336018282
Ref: テスト<54>-Footnote-346018348
Ref: テスト<54>-Footnote-356018414
Ref: テスト<54>-Footnote-366018480
Ref: テスト<54>-Footnote-376018546
Ref: テスト<54>-Footnote-386018612
Ref: テスト<54>-Footnote-396018678
Ref: テスト<54>-Footnote-406018744
Ref: テスト<54>-Footnote-416018810
Ref: テスト<54>-Footnote-426018876
Ref: テスト<54>-Footnote-436018942
Ref: テスト<54>-Footnote-446019008
Ref: テスト<54>-Footnote-456019074
Ref: テスト<54>-Footnote-466019140
Ref: テスト<54>-Footnote-476019206
Ref: テスト<54>-Footnote-486019272
Node: ビルド<58>6019338
Ref: whatsnew/changelog id7226019450
Ref: 1fce6019450
Ref: ビルド<58>-Footnote-16023256
Ref: ビルド<58>-Footnote-26023321
Ref: ビルド<58>-Footnote-36023386
Ref: ビルド<58>-Footnote-46023451
Ref: ビルド<58>-Footnote-56023516
Ref: ビルド<58>-Footnote-66023581
Ref: ビルド<58>-Footnote-76023646
Ref: ビルド<58>-Footnote-86023711
Ref: ビルド<58>-Footnote-96023776
Ref: ビルド<58>-Footnote-106023841
Ref: ビルド<58>-Footnote-116023907
Ref: ビルド<58>-Footnote-126023973
Ref: ビルド<58>-Footnote-136024039
Ref: ビルド<58>-Footnote-146024105
Ref: ビルド<58>-Footnote-156024171
Ref: ビルド<58>-Footnote-166024237
Node: Windows<50>6024303
Ref: whatsnew/changelog id7236024411
Ref: 1fd06024411
Ref: Windows<50>-Footnote-16029313
Ref: Windows<50>-Footnote-26029378
Ref: Windows<50>-Footnote-36029443
Ref: Windows<50>-Footnote-46029508
Ref: Windows<50>-Footnote-56029573
Ref: Windows<50>-Footnote-66029638
Ref: Windows<50>-Footnote-76029703
Ref: Windows<50>-Footnote-86029768
Ref: Windows<50>-Footnote-96029833
Ref: Windows<50>-Footnote-106029898
Ref: Windows<50>-Footnote-116029964
Ref: Windows<50>-Footnote-126030030
Ref: Windows<50>-Footnote-136030096
Ref: Windows<50>-Footnote-146030162
Ref: Windows<50>-Footnote-156030228
Ref: Windows<50>-Footnote-166030294
Ref: Windows<50>-Footnote-176030360
Ref: Windows<50>-Footnote-186030426
Ref: Windows<50>-Footnote-196030492
Ref: Windows<50>-Footnote-206030558
Ref: Windows<50>-Footnote-216030624
Ref: Windows<50>-Footnote-226030690
Ref: Windows<50>-Footnote-236030756
Ref: Windows<50>-Footnote-246030821
Ref: Windows<50>-Footnote-256030886
Ref: Windows<50>-Footnote-266030952
Ref: Windows<50>-Footnote-276031018
Ref: Windows<50>-Footnote-286031084
Ref: Windows<50>-Footnote-296031150
Ref: Windows<50>-Footnote-306031216
Ref: Windows<50>-Footnote-316031282
Ref: Windows<50>-Footnote-326031348
Ref: Windows<50>-Footnote-336031414
Ref: Windows<50>-Footnote-346031480
Ref: Windows<50>-Footnote-356031546
Ref: Windows<50>-Footnote-366031612
Ref: Windows<50>-Footnote-376031678
Ref: Windows<50>-Footnote-386031744
Ref: Windows<50>-Footnote-396031810
Ref: Windows<50>-Footnote-406031876
Ref: Windows<50>-Footnote-416031942
Ref: Windows<50>-Footnote-426032008
Node: macOS<40>6032074
Ref: whatsnew/changelog id7246032177
Ref: 1fd36032177
Ref: macOS<40>-Footnote-16033010
Ref: macOS<40>-Footnote-26033075
Ref: macOS<40>-Footnote-36033140
Ref: macOS<40>-Footnote-46033205
Ref: macOS<40>-Footnote-56033270
Ref: macOS<40>-Footnote-66033335
Node: IDLE<33>6033400
Ref: whatsnew/changelog id7256033507
Ref: 1fd46033507
Ref: IDLE<33>-Footnote-16038209
Ref: IDLE<33>-Footnote-26038274
Ref: IDLE<33>-Footnote-36038338
Ref: IDLE<33>-Footnote-46038403
Ref: IDLE<33>-Footnote-56038468
Ref: IDLE<33>-Footnote-66038533
Ref: IDLE<33>-Footnote-76038598
Ref: IDLE<33>-Footnote-86038663
Ref: IDLE<33>-Footnote-96038728
Ref: IDLE<33>-Footnote-106038793
Ref: IDLE<33>-Footnote-116038859
Ref: IDLE<33>-Footnote-126038925
Ref: IDLE<33>-Footnote-136038991
Ref: IDLE<33>-Footnote-146039057
Ref: IDLE<33>-Footnote-156039123
Ref: IDLE<33>-Footnote-166039189
Ref: IDLE<33>-Footnote-176039255
Ref: IDLE<33>-Footnote-186039321
Ref: IDLE<33>-Footnote-196039387
Ref: IDLE<33>-Footnote-206039453
Ref: IDLE<33>-Footnote-216039519
Ref: IDLE<33>-Footnote-226039585
Ref: IDLE<33>-Footnote-236039651
Ref: IDLE<33>-Footnote-246039717
Ref: IDLE<33>-Footnote-256039783
Ref: IDLE<33>-Footnote-266039849
Ref: IDLE<33>-Footnote-276039915
Ref: IDLE<33>-Footnote-286039981
Ref: IDLE<33>-Footnote-296040047
Ref: IDLE<33>-Footnote-306040112
Node: Tools/Demos<31>6040178
Ref: whatsnew/changelog id7266040285
Ref: 1fd56040285
Ref: Tools/Demos<31>-Footnote-16041280
Ref: Tools/Demos<31>-Footnote-26041345
Ref: Tools/Demos<31>-Footnote-36041410
Ref: Tools/Demos<31>-Footnote-46041475
Ref: Tools/Demos<31>-Footnote-56041540
Ref: Tools/Demos<31>-Footnote-66041605
Ref: Tools/Demos<31>-Footnote-76041670
Ref: Tools/Demos<31>-Footnote-86041735
Node: C API<54>6041800
Ref: whatsnew/changelog id7276041890
Ref: 1fd76041890
Ref: C API<54>-Footnote-16047270
Ref: C API<54>-Footnote-26047335
Ref: C API<54>-Footnote-36047400
Ref: C API<54>-Footnote-46047465
Ref: C API<54>-Footnote-56047530
Ref: C API<54>-Footnote-66047595
Ref: C API<54>-Footnote-76047660
Ref: C API<54>-Footnote-86047725
Ref: C API<54>-Footnote-96047790
Ref: C API<54>-Footnote-106047855
Ref: C API<54>-Footnote-116047921
Ref: C API<54>-Footnote-126047987
Ref: C API<54>-Footnote-136048053
Ref: C API<54>-Footnote-146048119
Ref: C API<54>-Footnote-156048162
Ref: C API<54>-Footnote-166048228
Ref: C API<54>-Footnote-176048294
Ref: C API<54>-Footnote-186048360
Ref: C API<54>-Footnote-196048426
Ref: C API<54>-Footnote-206048492
Ref: C API<54>-Footnote-216048558
Ref: C API<54>-Footnote-226048624
Ref: C API<54>-Footnote-236048690
Ref: C API<54>-Footnote-246048756
Ref: C API<54>-Footnote-256048822
Ref: C API<54>-Footnote-266048888
Ref: C API<54>-Footnote-276048954
Ref: C API<54>-Footnote-286049020
Ref: C API<54>-Footnote-296049086
Ref: C API<54>-Footnote-306049152
Ref: C API<54>-Footnote-316049218
Ref: C API<54>-Footnote-326049284
Ref: C API<54>-Footnote-336049350
Ref: C API<54>-Footnote-346049416
Node: Python 3 8 0 beta 16049482
Ref: whatsnew/changelog python-3-8-0-beta-16049608
Ref: 1fda6049608
Node: セキュリティ<42>6050051
Ref: whatsnew/changelog id7286050160
Ref: 1fdb6050160
Ref: セキュリティ<42>-Footnote-16050768
Ref: セキュリティ<42>-Footnote-26050833
Ref: セキュリティ<42>-Footnote-36050888
Ref: セキュリティ<42>-Footnote-46050953
Node: Core and Builtins<162>6051018
Ref: whatsnew/changelog id7296051156
Ref: 1fdc6051156
Ref: Core and Builtins<162>-Footnote-16059196
Ref: Core and Builtins<162>-Footnote-26059261
Ref: Core and Builtins<162>-Footnote-36059326
Ref: Core and Builtins<162>-Footnote-46059391
Ref: Core and Builtins<162>-Footnote-56059456
Ref: Core and Builtins<162>-Footnote-66059521
Ref: Core and Builtins<162>-Footnote-76059586
Ref: Core and Builtins<162>-Footnote-86059651
Ref: Core and Builtins<162>-Footnote-96059716
Ref: Core and Builtins<162>-Footnote-106059781
Ref: Core and Builtins<162>-Footnote-116059847
Ref: Core and Builtins<162>-Footnote-126059913
Ref: Core and Builtins<162>-Footnote-136059979
Ref: Core and Builtins<162>-Footnote-146060045
Ref: Core and Builtins<162>-Footnote-156060111
Ref: Core and Builtins<162>-Footnote-166060177
Ref: Core and Builtins<162>-Footnote-176060243
Ref: Core and Builtins<162>-Footnote-186060309
Ref: Core and Builtins<162>-Footnote-196060374
Ref: Core and Builtins<162>-Footnote-206060440
Ref: Core and Builtins<162>-Footnote-216060506
Ref: Core and Builtins<162>-Footnote-226060572
Ref: Core and Builtins<162>-Footnote-236060637
Ref: Core and Builtins<162>-Footnote-246060703
Ref: Core and Builtins<162>-Footnote-256060769
Ref: Core and Builtins<162>-Footnote-266060835
Ref: Core and Builtins<162>-Footnote-276060901
Ref: Core and Builtins<162>-Footnote-286060967
Ref: Core and Builtins<162>-Footnote-296061033
Ref: Core and Builtins<162>-Footnote-306061099
Ref: Core and Builtins<162>-Footnote-316061165
Ref: Core and Builtins<162>-Footnote-326061231
Ref: Core and Builtins<162>-Footnote-336061297
Ref: Core and Builtins<162>-Footnote-346061363
Ref: Core and Builtins<162>-Footnote-356061429
Ref: Core and Builtins<162>-Footnote-366061495
Ref: Core and Builtins<162>-Footnote-376061561
Ref: Core and Builtins<162>-Footnote-386061627
Ref: Core and Builtins<162>-Footnote-396061693
Ref: Core and Builtins<162>-Footnote-406061759
Ref: Core and Builtins<162>-Footnote-416061825
Ref: Core and Builtins<162>-Footnote-426061891
Ref: Core and Builtins<162>-Footnote-436061957
Ref: Core and Builtins<162>-Footnote-446062023
Node: ライブラリ<163>6062089
Ref: whatsnew/changelog id7306062227
Ref: 1fdf6062227
Ref: ライブラリ<163>-Footnote-16080431
Ref: ライブラリ<163>-Footnote-26080496
Ref: ライブラリ<163>-Footnote-36080561
Ref: ライブラリ<163>-Footnote-46080626
Ref: ライブラリ<163>-Footnote-56080691
Ref: ライブラリ<163>-Footnote-66080756
Ref: ライブラリ<163>-Footnote-76080821
Ref: ライブラリ<163>-Footnote-86080886
Ref: ライブラリ<163>-Footnote-96080951
Ref: ライブラリ<163>-Footnote-106081016
Ref: ライブラリ<163>-Footnote-116081082
Ref: ライブラリ<163>-Footnote-126081148
Ref: ライブラリ<163>-Footnote-136081214
Ref: ライブラリ<163>-Footnote-146081280
Ref: ライブラリ<163>-Footnote-156081346
Ref: ライブラリ<163>-Footnote-166081412
Ref: ライブラリ<163>-Footnote-176081478
Ref: ライブラリ<163>-Footnote-186081544
Ref: ライブラリ<163>-Footnote-196081610
Ref: ライブラリ<163>-Footnote-206081676
Ref: ライブラリ<163>-Footnote-216081742
Ref: ライブラリ<163>-Footnote-226081808
Ref: ライブラリ<163>-Footnote-236081874
Ref: ライブラリ<163>-Footnote-246081940
Ref: ライブラリ<163>-Footnote-256082008
Ref: ライブラリ<163>-Footnote-266082074
Ref: ライブラリ<163>-Footnote-276082140
Ref: ライブラリ<163>-Footnote-286082206
Ref: ライブラリ<163>-Footnote-296082272
Ref: ライブラリ<163>-Footnote-306082338
Ref: ライブラリ<163>-Footnote-316082404
Ref: ライブラリ<163>-Footnote-326082470
Ref: ライブラリ<163>-Footnote-336082536
Ref: ライブラリ<163>-Footnote-346082602
Ref: ライブラリ<163>-Footnote-356082668
Ref: ライブラリ<163>-Footnote-366082734
Ref: ライブラリ<163>-Footnote-376082800
Ref: ライブラリ<163>-Footnote-386082866
Ref: ライブラリ<163>-Footnote-396082932
Ref: ライブラリ<163>-Footnote-406082998
Ref: ライブラリ<163>-Footnote-416083064
Ref: ライブラリ<163>-Footnote-426083130
Ref: ライブラリ<163>-Footnote-436083196
Ref: ライブラリ<163>-Footnote-446083262
Ref: ライブラリ<163>-Footnote-456083328
Ref: ライブラリ<163>-Footnote-466083394
Ref: ライブラリ<163>-Footnote-476083460
Ref: ライブラリ<163>-Footnote-486083526
Ref: ライブラリ<163>-Footnote-496083592
Ref: ライブラリ<163>-Footnote-506083658
Ref: ライブラリ<163>-Footnote-516083724
Ref: ライブラリ<163>-Footnote-526083790
Ref: ライブラリ<163>-Footnote-536083856
Ref: ライブラリ<163>-Footnote-546083922
Ref: ライブラリ<163>-Footnote-556083988
Ref: ライブラリ<163>-Footnote-566084054
Ref: ライブラリ<163>-Footnote-576084120
Ref: ライブラリ<163>-Footnote-586084186
Ref: ライブラリ<163>-Footnote-596084252
Ref: ライブラリ<163>-Footnote-606084318
Ref: ライブラリ<163>-Footnote-616084384
Ref: ライブラリ<163>-Footnote-626084450
Ref: ライブラリ<163>-Footnote-636084516
Ref: ライブラリ<163>-Footnote-646084582
Ref: ライブラリ<163>-Footnote-656084648
Ref: ライブラリ<163>-Footnote-666084714
Ref: ライブラリ<163>-Footnote-676084780
Ref: ライブラリ<163>-Footnote-686084846
Ref: ライブラリ<163>-Footnote-696084911
Ref: ライブラリ<163>-Footnote-706084977
Ref: ライブラリ<163>-Footnote-716085042
Ref: ライブラリ<163>-Footnote-726085108
Ref: ライブラリ<163>-Footnote-736085174
Ref: ライブラリ<163>-Footnote-746085240
Ref: ライブラリ<163>-Footnote-756085306
Ref: ライブラリ<163>-Footnote-766085372
Ref: ライブラリ<163>-Footnote-776085438
Ref: ライブラリ<163>-Footnote-786085504
Ref: ライブラリ<163>-Footnote-796085570
Ref: ライブラリ<163>-Footnote-806085636
Ref: ライブラリ<163>-Footnote-816085702
Ref: ライブラリ<163>-Footnote-826085768
Ref: ライブラリ<163>-Footnote-836085834
Ref: ライブラリ<163>-Footnote-846085900
Ref: ライブラリ<163>-Footnote-856085966
Ref: ライブラリ<163>-Footnote-866086032
Ref: ライブラリ<163>-Footnote-876086098
Ref: ライブラリ<163>-Footnote-886086164
Ref: ライブラリ<163>-Footnote-896086230
Ref: ライブラリ<163>-Footnote-906086296
Ref: ライブラリ<163>-Footnote-916086362
Ref: ライブラリ<163>-Footnote-926086428
Ref: ライブラリ<163>-Footnote-936086494
Ref: ライブラリ<163>-Footnote-946086560
Ref: ライブラリ<163>-Footnote-956086626
Ref: ライブラリ<163>-Footnote-966086692
Ref: ライブラリ<163>-Footnote-976086758
Ref: ライブラリ<163>-Footnote-986086824
Ref: ライブラリ<163>-Footnote-996086890
Ref: ライブラリ<163>-Footnote-1006086956
Ref: ライブラリ<163>-Footnote-1016087023
Ref: ライブラリ<163>-Footnote-1026087090
Ref: ライブラリ<163>-Footnote-1036087157
Ref: ライブラリ<163>-Footnote-1046087224
Ref: ライブラリ<163>-Footnote-1056087291
Ref: ライブラリ<163>-Footnote-1066087358
Ref: ライブラリ<163>-Footnote-1076087425
Node: ドキュメント<52>6087492
Ref: whatsnew/changelog id7316087621
Ref: 1fe46087621
Ref: ドキュメント<52>-Footnote-16089701
Ref: ドキュメント<52>-Footnote-26089766
Ref: ドキュメント<52>-Footnote-36089831
Ref: ドキュメント<52>-Footnote-46089896
Ref: ドキュメント<52>-Footnote-56089961
Ref: ドキュメント<52>-Footnote-66090026
Ref: ドキュメント<52>-Footnote-76090091
Ref: ドキュメント<52>-Footnote-86090156
Ref: ドキュメント<52>-Footnote-96090221
Ref: ドキュメント<52>-Footnote-106090286
Ref: ドキュメント<52>-Footnote-116090352
Ref: ドキュメント<52>-Footnote-126090418
Ref: ドキュメント<52>-Footnote-136090484
Ref: ドキュメント<52>-Footnote-146090550
Node: テスト<55>6090616
Ref: whatsnew/changelog id7326090738
Ref: 1fe56090738
Ref: テスト<55>-Footnote-16092375
Ref: テスト<55>-Footnote-26092440
Ref: テスト<55>-Footnote-36092505
Ref: テスト<55>-Footnote-46092570
Ref: テスト<55>-Footnote-56092635
Ref: テスト<55>-Footnote-66092700
Ref: テスト<55>-Footnote-76092765
Ref: テスト<55>-Footnote-86092830
Ref: テスト<55>-Footnote-96092895
Ref: テスト<55>-Footnote-106092960
Node: ビルド<59>6093026
Ref: whatsnew/changelog id7336093137
Ref: 1fe76093137
Ref: ビルド<59>-Footnote-16094533
Ref: ビルド<59>-Footnote-26094598
Node: Windows<51>6094663
Ref: whatsnew/changelog id7346094770
Ref: 1fe86094770
Ref: Windows<51>-Footnote-16095202
Ref: Windows<51>-Footnote-26095267
Ref: Windows<51>-Footnote-36095332
Ref: Windows<51>-Footnote-46095397
Node: macOS<41>6095462
Ref: whatsnew/changelog id7356095564
Ref: 1fe96095564
Ref: macOS<41>-Footnote-16095866
Node: IDLE<34>6095931
Ref: whatsnew/changelog id7366096037
Ref: 1fea6096037
Ref: IDLE<34>-Footnote-16096639
Ref: IDLE<34>-Footnote-26096704
Ref: IDLE<34>-Footnote-36096769
Ref: IDLE<34>-Footnote-46096834
Ref: IDLE<34>-Footnote-56096899
Ref: IDLE<34>-Footnote-66096964
Node: Tools/Demos<32>6097029
Ref: whatsnew/changelog id7376097135
Ref: 1feb6097135
Ref: Tools/Demos<32>-Footnote-16097334
Node: C API<55>6097399
Ref: whatsnew/changelog id7386097488
Ref: 1fec6097488
Ref: C API<55>-Footnote-16098824
Ref: C API<55>-Footnote-26098889
Ref: C API<55>-Footnote-36098931
Ref: C API<55>-Footnote-46098996
Ref: C API<55>-Footnote-56099061
Ref: C API<55>-Footnote-66099126
Ref: C API<55>-Footnote-76099168
Ref: C API<55>-Footnote-86099233
Ref: C API<55>-Footnote-96099298
Node: Python 3 8 0 alpha 46099363
Ref: whatsnew/changelog python-3-8-0-alpha-46099489
Ref: 1fee6099489
Node: セキュリティ<43>6099934
Ref: whatsnew/changelog id7396100044
Ref: 1fef6100044
Ref: セキュリティ<43>-Footnote-16100937
Ref: セキュリティ<43>-Footnote-26101002
Ref: セキュリティ<43>-Footnote-36101067
Ref: セキュリティ<43>-Footnote-46101122
Node: Core and Builtins<163>6101187
Ref: whatsnew/changelog id7406101326
Ref: 1ff06101326
Ref: Core and Builtins<163>-Footnote-16104594
Ref: Core and Builtins<163>-Footnote-26104659
Ref: Core and Builtins<163>-Footnote-36104724
Ref: Core and Builtins<163>-Footnote-46104789
Ref: Core and Builtins<163>-Footnote-56104854
Ref: Core and Builtins<163>-Footnote-66104919
Ref: Core and Builtins<163>-Footnote-76104984
Ref: Core and Builtins<163>-Footnote-86105049
Ref: Core and Builtins<163>-Footnote-96105114
Ref: Core and Builtins<163>-Footnote-106105156
Ref: Core and Builtins<163>-Footnote-116105222
Ref: Core and Builtins<163>-Footnote-126105288
Ref: Core and Builtins<163>-Footnote-136105354
Ref: Core and Builtins<163>-Footnote-146105420
Ref: Core and Builtins<163>-Footnote-156105486
Ref: Core and Builtins<163>-Footnote-166105552
Ref: Core and Builtins<163>-Footnote-176105618
Ref: Core and Builtins<163>-Footnote-186105684
Ref: Core and Builtins<163>-Footnote-196105750
Ref: Core and Builtins<163>-Footnote-206105816
Node: ライブラリ<164>6105882
Ref: whatsnew/changelog id7416106021
Ref: 1ff16106021
Ref: ライブラリ<164>-Footnote-16115320
Ref: ライブラリ<164>-Footnote-26115385
Ref: ライブラリ<164>-Footnote-36115450
Ref: ライブラリ<164>-Footnote-46115515
Ref: ライブラリ<164>-Footnote-56115582
Ref: ライブラリ<164>-Footnote-66115647
Ref: ライブラリ<164>-Footnote-76115712
Ref: ライブラリ<164>-Footnote-86115777
Ref: ライブラリ<164>-Footnote-96115842
Ref: ライブラリ<164>-Footnote-106115907
Ref: ライブラリ<164>-Footnote-116115973
Ref: ライブラリ<164>-Footnote-126116039
Ref: ライブラリ<164>-Footnote-136116105
Ref: ライブラリ<164>-Footnote-146116171
Ref: ライブラリ<164>-Footnote-156116237
Ref: ライブラリ<164>-Footnote-166116303
Ref: ライブラリ<164>-Footnote-176116369
Ref: ライブラリ<164>-Footnote-186116435
Ref: ライブラリ<164>-Footnote-196116501
Ref: ライブラリ<164>-Footnote-206116567
Ref: ライブラリ<164>-Footnote-216116633
Ref: ライブラリ<164>-Footnote-226116699
Ref: ライブラリ<164>-Footnote-236116765
Ref: ライブラリ<164>-Footnote-246116831
Ref: ライブラリ<164>-Footnote-256116897
Ref: ライブラリ<164>-Footnote-266116963
Ref: ライブラリ<164>-Footnote-276117029
Ref: ライブラリ<164>-Footnote-286117095
Ref: ライブラリ<164>-Footnote-296117161
Ref: ライブラリ<164>-Footnote-306117227
Ref: ライブラリ<164>-Footnote-316117293
Ref: ライブラリ<164>-Footnote-326117359
Ref: ライブラリ<164>-Footnote-336117425
Ref: ライブラリ<164>-Footnote-346117491
Ref: ライブラリ<164>-Footnote-356117557
Ref: ライブラリ<164>-Footnote-366117623
Ref: ライブラリ<164>-Footnote-376117689
Ref: ライブラリ<164>-Footnote-386117755
Ref: ライブラリ<164>-Footnote-396117821
Ref: ライブラリ<164>-Footnote-406117887
Ref: ライブラリ<164>-Footnote-416117953
Ref: ライブラリ<164>-Footnote-426118019
Ref: ライブラリ<164>-Footnote-436118085
Ref: ライブラリ<164>-Footnote-446118151
Ref: ライブラリ<164>-Footnote-456118217
Ref: ライブラリ<164>-Footnote-466118283
Ref: ライブラリ<164>-Footnote-476118349
Ref: ライブラリ<164>-Footnote-486118415
Ref: ライブラリ<164>-Footnote-496118481
Ref: ライブラリ<164>-Footnote-506118547
Ref: ライブラリ<164>-Footnote-516118613
Ref: ライブラリ<164>-Footnote-526118679
Ref: ライブラリ<164>-Footnote-536118745
Ref: ライブラリ<164>-Footnote-546118811
Node: ドキュメント<53>6118877
Ref: whatsnew/changelog id7426119007
Ref: 1ff56119007
Ref: ドキュメント<53>-Footnote-16120442
Ref: ドキュメント<53>-Footnote-26120507
Ref: ドキュメント<53>-Footnote-36120572
Ref: ドキュメント<53>-Footnote-46120637
Ref: ドキュメント<53>-Footnote-56120702
Ref: ドキュメント<53>-Footnote-66120741
Ref: ドキュメント<53>-Footnote-76120806
Ref: ドキュメント<53>-Footnote-86120871
Ref: ドキュメント<53>-Footnote-96120936
Ref: ドキュメント<53>-Footnote-106121001
Ref: ドキュメント<53>-Footnote-116121067
Ref: ドキュメント<53>-Footnote-126121133
Node: テスト<56>6121199
Ref: whatsnew/changelog id7436121322
Ref: 1ff66121322
Ref: テスト<56>-Footnote-16123578
Ref: テスト<56>-Footnote-26123643
Ref: テスト<56>-Footnote-36123708
Ref: テスト<56>-Footnote-46123773
Ref: テスト<56>-Footnote-56123838
Ref: テスト<56>-Footnote-66123903
Ref: テスト<56>-Footnote-76123968
Ref: テスト<56>-Footnote-86124033
Ref: テスト<56>-Footnote-96124098
Ref: テスト<56>-Footnote-106124163
Ref: テスト<56>-Footnote-116124229
Ref: テスト<56>-Footnote-126124295
Ref: テスト<56>-Footnote-136124361
Ref: テスト<56>-Footnote-146124427
Ref: テスト<56>-Footnote-156124493
Node: ビルド<60>6124559
Ref: whatsnew/changelog id7446124671
Ref: 1ff86124671
Ref: ビルド<60>-Footnote-16127835
Ref: ビルド<60>-Footnote-26127900
Ref: ビルド<60>-Footnote-36127965
Ref: ビルド<60>-Footnote-46128030
Ref: ビルド<60>-Footnote-56128095
Ref: ビルド<60>-Footnote-66128160
Ref: ビルド<60>-Footnote-76128225
Ref: ビルド<60>-Footnote-86128290
Ref: ビルド<60>-Footnote-96128355
Ref: ビルド<60>-Footnote-106128420
Ref: ビルド<60>-Footnote-116128486
Ref: ビルド<60>-Footnote-126128552
Ref: ビルド<60>-Footnote-136128618
Node: Windows<52>6128684
Ref: whatsnew/changelog id7456128792
Ref: 1ff96128792
Ref: Windows<52>-Footnote-16131440
Ref: Windows<52>-Footnote-26131505
Ref: Windows<52>-Footnote-36131570
Ref: Windows<52>-Footnote-46131635
Ref: Windows<52>-Footnote-56131700
Ref: Windows<52>-Footnote-66131765
Ref: Windows<52>-Footnote-76131830
Ref: Windows<52>-Footnote-86131895
Ref: Windows<52>-Footnote-96131960
Ref: Windows<52>-Footnote-106132025
Ref: Windows<52>-Footnote-116132091
Ref: Windows<52>-Footnote-126132157
Node: macOS<42>6132223
Ref: whatsnew/changelog id7466132326
Ref: 1ffa6132326
Ref: macOS<42>-Footnote-16132640
Ref: macOS<42>-Footnote-26132705
Node: IDLE<35>6132770
Ref: whatsnew/changelog id7476132877
Ref: 1ffb6132877
Ref: IDLE<35>-Footnote-16133120
Node: Tools/Demos<33>6133185
Ref: whatsnew/changelog id7486133292
Ref: 1ffc6133292
Ref: Tools/Demos<33>-Footnote-16133446
Node: C API<56>6133511
Ref: whatsnew/changelog id7496133601
Ref: 1ffd6133601
Ref: C API<56>-Footnote-16135605
Ref: C API<56>-Footnote-26135670
Ref: C API<56>-Footnote-36135735
Ref: C API<56>-Footnote-46135800
Ref: C API<56>-Footnote-56135865
Ref: C API<56>-Footnote-66135930
Node: Python 3 8 0 alpha 36135995
Ref: whatsnew/changelog python-3-8-0-alpha-36136122
Ref: 20006136122
Node: セキュリティ<44>6136547
Ref: whatsnew/changelog id7506136657
Ref: 20016136657
Ref: セキュリティ<44>-Footnote-16137233
Ref: セキュリティ<44>-Footnote-26137298
Node: Core and Builtins<164>6137363
Ref: whatsnew/changelog id7516137502
Ref: 20036137502
Ref: Core and Builtins<164>-Footnote-16141083
Ref: Core and Builtins<164>-Footnote-26141148
Ref: Core and Builtins<164>-Footnote-36141213
Ref: Core and Builtins<164>-Footnote-46141278
Ref: Core and Builtins<164>-Footnote-56141343
Ref: Core and Builtins<164>-Footnote-66141408
Ref: Core and Builtins<164>-Footnote-76141473
Ref: Core and Builtins<164>-Footnote-86141538
Ref: Core and Builtins<164>-Footnote-96141603
Ref: Core and Builtins<164>-Footnote-106141668
Ref: Core and Builtins<164>-Footnote-116141734
Ref: Core and Builtins<164>-Footnote-126141800
Ref: Core and Builtins<164>-Footnote-136141866
Ref: Core and Builtins<164>-Footnote-146141932
Ref: Core and Builtins<164>-Footnote-156141998
Ref: Core and Builtins<164>-Footnote-166142064
Ref: Core and Builtins<164>-Footnote-176142130
Ref: Core and Builtins<164>-Footnote-186142196
Ref: Core and Builtins<164>-Footnote-196142262
Ref: Core and Builtins<164>-Footnote-206142328
Ref: Core and Builtins<164>-Footnote-216142394
Ref: Core and Builtins<164>-Footnote-226142460
Node: ライブラリ<165>6142526
Ref: whatsnew/changelog id7526142665
Ref: 20056142665
Ref: ライブラリ<165>-Footnote-16148245
Ref: ライブラリ<165>-Footnote-26148310
Ref: ライブラリ<165>-Footnote-36148375
Ref: ライブラリ<165>-Footnote-46148440
Ref: ライブラリ<165>-Footnote-56148505
Ref: ライブラリ<165>-Footnote-66148570
Ref: ライブラリ<165>-Footnote-76148635
Ref: ライブラリ<165>-Footnote-86148700
Ref: ライブラリ<165>-Footnote-96148765
Ref: ライブラリ<165>-Footnote-106148830
Ref: ライブラリ<165>-Footnote-116148896
Ref: ライブラリ<165>-Footnote-126148962
Ref: ライブラリ<165>-Footnote-136149028
Ref: ライブラリ<165>-Footnote-146149094
Ref: ライブラリ<165>-Footnote-156149160
Ref: ライブラリ<165>-Footnote-166149226
Ref: ライブラリ<165>-Footnote-176149292
Ref: ライブラリ<165>-Footnote-186149358
Ref: ライブラリ<165>-Footnote-196149424
Ref: ライブラリ<165>-Footnote-206149490
Ref: ライブラリ<165>-Footnote-216149556
Ref: ライブラリ<165>-Footnote-226149622
Ref: ライブラリ<165>-Footnote-236149688
Ref: ライブラリ<165>-Footnote-246149754
Ref: ライブラリ<165>-Footnote-256149820
Ref: ライブラリ<165>-Footnote-266149886
Ref: ライブラリ<165>-Footnote-276149952
Ref: ライブラリ<165>-Footnote-286150018
Ref: ライブラリ<165>-Footnote-296150084
Ref: ライブラリ<165>-Footnote-306150150
Ref: ライブラリ<165>-Footnote-316150216
Ref: ライブラリ<165>-Footnote-326150282
Ref: ライブラリ<165>-Footnote-336150348
Ref: ライブラリ<165>-Footnote-346150414
Ref: ライブラリ<165>-Footnote-356150480
Ref: ライブラリ<165>-Footnote-366150546
Ref: ライブラリ<165>-Footnote-376150612
Node: ドキュメント<54>6150678
Ref: whatsnew/changelog id7536150808
Ref: 20076150808
Ref: ドキュメント<54>-Footnote-16151383
Ref: ドキュメント<54>-Footnote-26151448
Ref: ドキュメント<54>-Footnote-36151513
Node: テスト<57>6151578
Ref: whatsnew/changelog id7546151701
Ref: 20086151701
Ref: テスト<57>-Footnote-16152218
Ref: テスト<57>-Footnote-26152283
Ref: テスト<57>-Footnote-36152348
Node: ビルド<61>6152413
Ref: whatsnew/changelog id7556152525
Ref: 20096152525
Ref: ビルド<61>-Footnote-16153050
Ref: ビルド<61>-Footnote-26153115
Ref: ビルド<61>-Footnote-36153180
Ref: ビルド<61>-Footnote-46153245
Node: Windows<53>6153310
Ref: whatsnew/changelog id7566153417
Ref: 200a6153417
Ref: Windows<53>-Footnote-16153866
Ref: Windows<53>-Footnote-26153931
Ref: Windows<53>-Footnote-36153996
Node: IDLE<36>6154061
Ref: whatsnew/changelog id7576154170
Ref: 200b6154170
Ref: IDLE<36>-Footnote-16155279
Ref: IDLE<36>-Footnote-26155344
Ref: IDLE<36>-Footnote-36155409
Ref: IDLE<36>-Footnote-46155474
Ref: IDLE<36>-Footnote-56155539
Ref: IDLE<36>-Footnote-66155604
Ref: IDLE<36>-Footnote-76155669
Ref: IDLE<36>-Footnote-86155734
Ref: IDLE<36>-Footnote-96155799
Node: Tools/Demos<34>6155864
Ref: whatsnew/changelog id7586155971
Ref: 200c6155971
Ref: Tools/Demos<34>-Footnote-16156184
Ref: Tools/Demos<34>-Footnote-26156249
Node: C API<57>6156314
Ref: whatsnew/changelog id7596156404
Ref: 200d6156404
Ref: C API<57>-Footnote-16156792
Ref: C API<57>-Footnote-26156857
Node: Python 3 8 0 alpha 26156922
Ref: whatsnew/changelog python-3-8-0-alpha-26157049
Ref: 200e6157049
Node: Core and Builtins<165>6157348
Ref: whatsnew/changelog id7606157456
Ref: 200f6157456
Ref: Core and Builtins<165>-Footnote-16160596
Ref: Core and Builtins<165>-Footnote-26160661
Ref: Core and Builtins<165>-Footnote-36160726
Ref: Core and Builtins<165>-Footnote-46160791
Ref: Core and Builtins<165>-Footnote-56160856
Ref: Core and Builtins<165>-Footnote-66160923
Ref: Core and Builtins<165>-Footnote-76160988
Ref: Core and Builtins<165>-Footnote-86161053
Ref: Core and Builtins<165>-Footnote-96161118
Ref: Core and Builtins<165>-Footnote-106161183
Ref: Core and Builtins<165>-Footnote-116161249
Ref: Core and Builtins<165>-Footnote-126161315
Ref: Core and Builtins<165>-Footnote-136161381
Ref: Core and Builtins<165>-Footnote-146161447
Ref: Core and Builtins<165>-Footnote-156161513
Ref: Core and Builtins<165>-Footnote-166161579
Ref: Core and Builtins<165>-Footnote-176161645
Node: ライブラリ<166>6161711
Ref: whatsnew/changelog id7616161850
Ref: 20106161850
Ref: ライブラリ<166>-Footnote-16165564
Ref: ライブラリ<166>-Footnote-26165629
Ref: ライブラリ<166>-Footnote-36165694
Ref: ライブラリ<166>-Footnote-46165759
Ref: ライブラリ<166>-Footnote-56165824
Ref: ライブラリ<166>-Footnote-66165889
Ref: ライブラリ<166>-Footnote-76165954
Ref: ライブラリ<166>-Footnote-86166019
Ref: ライブラリ<166>-Footnote-96166084
Ref: ライブラリ<166>-Footnote-106166149
Ref: ライブラリ<166>-Footnote-116166215
Ref: ライブラリ<166>-Footnote-126166281
Ref: ライブラリ<166>-Footnote-136166347
Ref: ライブラリ<166>-Footnote-146166413
Ref: ライブラリ<166>-Footnote-156166479
Ref: ライブラリ<166>-Footnote-166166545
Ref: ライブラリ<166>-Footnote-176166611
Node: ドキュメント<55>6166677
Ref: whatsnew/changelog id7626166807
Ref: 20126166807
Ref: ドキュメント<55>-Footnote-16167187
Ref: ドキュメント<55>-Footnote-26167252
Ref: ドキュメント<55>-Footnote-36167317
Node: テスト<58>6167382
Ref: whatsnew/changelog id7636167503
Ref: 20136167503
Ref: テスト<58>-Footnote-16168873
Ref: テスト<58>-Footnote-26168938
Ref: テスト<58>-Footnote-36169003
Ref: テスト<58>-Footnote-46169068
Ref: テスト<58>-Footnote-56169133
Ref: テスト<58>-Footnote-66169198
Ref: テスト<58>-Footnote-76169263
Ref: テスト<58>-Footnote-86169328
Node: Windows<54>6169393
Ref: whatsnew/changelog id7646169500
Ref: 20146169500
Ref: Windows<54>-Footnote-16170097
Ref: Windows<54>-Footnote-26170162
Ref: Windows<54>-Footnote-36170227
Ref: Windows<54>-Footnote-46170292
Ref: Windows<54>-Footnote-56170357
Node: IDLE<37>6170422
Ref: whatsnew/changelog id7656170507
Ref: 20156170507
Ref: IDLE<37>-Footnote-16170811
Ref: IDLE<37>-Footnote-26170876
Ref: IDLE<37>-Footnote-36170941
Node: Python 3 8 0 alpha 16171006
Ref: whatsnew/changelog python-3-8-0-alpha-16171131
Ref: 20166171131
Node: セキュリティ<45>6171576
Ref: whatsnew/changelog id7666171686
Ref: 20176171686
Ref: セキュリティ<45>-Footnote-16174032
Ref: セキュリティ<45>-Footnote-26174097
Ref: セキュリティ<45>-Footnote-36174152
Ref: セキュリティ<45>-Footnote-46174217
Ref: セキュリティ<45>-Footnote-56174282
Ref: セキュリティ<45>-Footnote-66174347
Ref: セキュリティ<45>-Footnote-76174412
Ref: セキュリティ<45>-Footnote-86174468
Ref: セキュリティ<45>-Footnote-96174533
Ref: セキュリティ<45>-Footnote-106174598
Ref: セキュリティ<45>-Footnote-116174664
Ref: セキュリティ<45>-Footnote-126174730
Ref: セキュリティ<45>-Footnote-136174786
Ref: セキュリティ<45>-Footnote-146174852
Ref: セキュリティ<45>-Footnote-156174918
Ref: セキュリティ<45>-Footnote-166174974
Ref: セキュリティ<45>-Footnote-176175030
Node: Core and Builtins<166>6175096
Ref: whatsnew/changelog id7676175235
Ref: 20186175235
Ref: Core and Builtins<166>-Footnote-16201280
Ref: Core and Builtins<166>-Footnote-26201345
Ref: Core and Builtins<166>-Footnote-36201410
Ref: Core and Builtins<166>-Footnote-46201475
Ref: Core and Builtins<166>-Footnote-56201540
Ref: Core and Builtins<166>-Footnote-66201605
Ref: Core and Builtins<166>-Footnote-76201670
Ref: Core and Builtins<166>-Footnote-86201735
Ref: Core and Builtins<166>-Footnote-96201800
Ref: Core and Builtins<166>-Footnote-106201865
Ref: Core and Builtins<166>-Footnote-116201931
Ref: Core and Builtins<166>-Footnote-126201997
Ref: Core and Builtins<166>-Footnote-136202063
Ref: Core and Builtins<166>-Footnote-146202129
Ref: Core and Builtins<166>-Footnote-156202195
Ref: Core and Builtins<166>-Footnote-166202261
Ref: Core and Builtins<166>-Footnote-176202327
Ref: Core and Builtins<166>-Footnote-186202393
Ref: Core and Builtins<166>-Footnote-196202459
Ref: Core and Builtins<166>-Footnote-206202525
Ref: Core and Builtins<166>-Footnote-216202591
Ref: Core and Builtins<166>-Footnote-226202657
Ref: Core and Builtins<166>-Footnote-236202723
Ref: Core and Builtins<166>-Footnote-246202789
Ref: Core and Builtins<166>-Footnote-256202855
Ref: Core and Builtins<166>-Footnote-266202898
Ref: Core and Builtins<166>-Footnote-276202964
Ref: Core and Builtins<166>-Footnote-286203030
Ref: Core and Builtins<166>-Footnote-296203096
Ref: Core and Builtins<166>-Footnote-306203162
Ref: Core and Builtins<166>-Footnote-316203228
Ref: Core and Builtins<166>-Footnote-326203294
Ref: Core and Builtins<166>-Footnote-336203360
Ref: Core and Builtins<166>-Footnote-346203426
Ref: Core and Builtins<166>-Footnote-356203492
Ref: Core and Builtins<166>-Footnote-366203558
Ref: Core and Builtins<166>-Footnote-376203624
Ref: Core and Builtins<166>-Footnote-386203690
Ref: Core and Builtins<166>-Footnote-396203756
Ref: Core and Builtins<166>-Footnote-406203822
Ref: Core and Builtins<166>-Footnote-416203888
Ref: Core and Builtins<166>-Footnote-426203954
Ref: Core and Builtins<166>-Footnote-436204020
Ref: Core and Builtins<166>-Footnote-446204086
Ref: Core and Builtins<166>-Footnote-456204152
Ref: Core and Builtins<166>-Footnote-466204218
Ref: Core and Builtins<166>-Footnote-476204284
Ref: Core and Builtins<166>-Footnote-486204350
Ref: Core and Builtins<166>-Footnote-496204416
Ref: Core and Builtins<166>-Footnote-506204482
Ref: Core and Builtins<166>-Footnote-516204548
Ref: Core and Builtins<166>-Footnote-526204614
Ref: Core and Builtins<166>-Footnote-536204680
Ref: Core and Builtins<166>-Footnote-546204746
Ref: Core and Builtins<166>-Footnote-556204812
Ref: Core and Builtins<166>-Footnote-566204878
Ref: Core and Builtins<166>-Footnote-576204944
Ref: Core and Builtins<166>-Footnote-586205010
Ref: Core and Builtins<166>-Footnote-596205076
Ref: Core and Builtins<166>-Footnote-606205141
Ref: Core and Builtins<166>-Footnote-616205207
Ref: Core and Builtins<166>-Footnote-626205273
Ref: Core and Builtins<166>-Footnote-636205339
Ref: Core and Builtins<166>-Footnote-646205405
Ref: Core and Builtins<166>-Footnote-656205471
Ref: Core and Builtins<166>-Footnote-666205537
Ref: Core and Builtins<166>-Footnote-676205603
Ref: Core and Builtins<166>-Footnote-686205669
Ref: Core and Builtins<166>-Footnote-696205735
Ref: Core and Builtins<166>-Footnote-706205801
Ref: Core and Builtins<166>-Footnote-716205867
Ref: Core and Builtins<166>-Footnote-726205933
Ref: Core and Builtins<166>-Footnote-736205999
Ref: Core and Builtins<166>-Footnote-746206065
Ref: Core and Builtins<166>-Footnote-756206131
Ref: Core and Builtins<166>-Footnote-766206197
Ref: Core and Builtins<166>-Footnote-776206263
Ref: Core and Builtins<166>-Footnote-786206329
Ref: Core and Builtins<166>-Footnote-796206395
Ref: Core and Builtins<166>-Footnote-806206461
Ref: Core and Builtins<166>-Footnote-816206527
Ref: Core and Builtins<166>-Footnote-826206593
Ref: Core and Builtins<166>-Footnote-836206659
Ref: Core and Builtins<166>-Footnote-846206725
Ref: Core and Builtins<166>-Footnote-856206791
Ref: Core and Builtins<166>-Footnote-866206857
Ref: Core and Builtins<166>-Footnote-876206923
Ref: Core and Builtins<166>-Footnote-886206989
Ref: Core and Builtins<166>-Footnote-896207055
Ref: Core and Builtins<166>-Footnote-906207121
Ref: Core and Builtins<166>-Footnote-916207187
Ref: Core and Builtins<166>-Footnote-926207253
Ref: Core and Builtins<166>-Footnote-936207319
Ref: Core and Builtins<166>-Footnote-946207385
Ref: Core and Builtins<166>-Footnote-956207451
Ref: Core and Builtins<166>-Footnote-966207517
Ref: Core and Builtins<166>-Footnote-976207585
Ref: Core and Builtins<166>-Footnote-986207651
Ref: Core and Builtins<166>-Footnote-996207717
Ref: Core and Builtins<166>-Footnote-1006207783
Ref: Core and Builtins<166>-Footnote-1016207850
Ref: Core and Builtins<166>-Footnote-1026207917
Ref: Core and Builtins<166>-Footnote-1036207984
Ref: Core and Builtins<166>-Footnote-1046208051
Ref: Core and Builtins<166>-Footnote-1056208118
Ref: Core and Builtins<166>-Footnote-1066208185
Ref: Core and Builtins<166>-Footnote-1076208252
Ref: Core and Builtins<166>-Footnote-1086208319
Ref: Core and Builtins<166>-Footnote-1096208386
Ref: Core and Builtins<166>-Footnote-1106208453
Ref: Core and Builtins<166>-Footnote-1116208520
Ref: Core and Builtins<166>-Footnote-1126208587
Ref: Core and Builtins<166>-Footnote-1136208654
Ref: Core and Builtins<166>-Footnote-1146208721
Ref: Core and Builtins<166>-Footnote-1156208788
Ref: Core and Builtins<166>-Footnote-1166208855
Ref: Core and Builtins<166>-Footnote-1176208922
Ref: Core and Builtins<166>-Footnote-1186208989
Ref: Core and Builtins<166>-Footnote-1196209056
Ref: Core and Builtins<166>-Footnote-1206209123
Ref: Core and Builtins<166>-Footnote-1216209190
Ref: Core and Builtins<166>-Footnote-1226209257
Ref: Core and Builtins<166>-Footnote-1236209324
Ref: Core and Builtins<166>-Footnote-1246209391
Ref: Core and Builtins<166>-Footnote-1256209458
Ref: Core and Builtins<166>-Footnote-1266209525
Ref: Core and Builtins<166>-Footnote-1276209592
Ref: Core and Builtins<166>-Footnote-1286209659
Ref: Core and Builtins<166>-Footnote-1296209726
Ref: Core and Builtins<166>-Footnote-1306209793
Ref: Core and Builtins<166>-Footnote-1316209860
Ref: Core and Builtins<166>-Footnote-1326209927
Ref: Core and Builtins<166>-Footnote-1336209994
Ref: Core and Builtins<166>-Footnote-1346210061
Ref: Core and Builtins<166>-Footnote-1356210128
Ref: Core and Builtins<166>-Footnote-1366210195
Ref: Core and Builtins<166>-Footnote-1376210262
Ref: Core and Builtins<166>-Footnote-1386210329
Ref: Core and Builtins<166>-Footnote-1396210396
Ref: Core and Builtins<166>-Footnote-1406210463
Ref: Core and Builtins<166>-Footnote-1416210530
Ref: Core and Builtins<166>-Footnote-1426210597
Ref: Core and Builtins<166>-Footnote-1436210664
Ref: Core and Builtins<166>-Footnote-1446210731
Ref: Core and Builtins<166>-Footnote-1456210798
Ref: Core and Builtins<166>-Footnote-1466210865
Ref: Core and Builtins<166>-Footnote-1476210932
Ref: Core and Builtins<166>-Footnote-1486210999
Ref: Core and Builtins<166>-Footnote-1496211066
Ref: Core and Builtins<166>-Footnote-1506211133
Ref: Core and Builtins<166>-Footnote-1516211200
Ref: Core and Builtins<166>-Footnote-1526211267
Ref: Core and Builtins<166>-Footnote-1536211334
Ref: Core and Builtins<166>-Footnote-1546211401
Ref: Core and Builtins<166>-Footnote-1556211468
Ref: Core and Builtins<166>-Footnote-1566211535
Ref: Core and Builtins<166>-Footnote-1576211602
Ref: Core and Builtins<166>-Footnote-1586211669
Ref: Core and Builtins<166>-Footnote-1596211736
Ref: Core and Builtins<166>-Footnote-1606211803
Ref: Core and Builtins<166>-Footnote-1616211870
Ref: Core and Builtins<166>-Footnote-1626211937
Node: ライブラリ<167>6212004
Ref: whatsnew/changelog id7686212143
Ref: 201e6212143
Ref: ライブラリ<167>-Footnote-16283025
Ref: ライブラリ<167>-Footnote-26283090
Ref: ライブラリ<167>-Footnote-36283155
Ref: ライブラリ<167>-Footnote-46283220
Ref: ライブラリ<167>-Footnote-56283285
Ref: ライブラリ<167>-Footnote-66283350
Ref: ライブラリ<167>-Footnote-76283415
Ref: ライブラリ<167>-Footnote-86283480
Ref: ライブラリ<167>-Footnote-96283545
Ref: ライブラリ<167>-Footnote-106283610
Ref: ライブラリ<167>-Footnote-116283676
Ref: ライブラリ<167>-Footnote-126283742
Ref: ライブラリ<167>-Footnote-136283808
Ref: ライブラリ<167>-Footnote-146283874
Ref: ライブラリ<167>-Footnote-156283940
Ref: ライブラリ<167>-Footnote-166284006
Ref: ライブラリ<167>-Footnote-176284072
Ref: ライブラリ<167>-Footnote-186284138
Ref: ライブラリ<167>-Footnote-196284204
Ref: ライブラリ<167>-Footnote-206284270
Ref: ライブラリ<167>-Footnote-216284336
Ref: ライブラリ<167>-Footnote-226284402
Ref: ライブラリ<167>-Footnote-236284468
Ref: ライブラリ<167>-Footnote-246284534
Ref: ライブラリ<167>-Footnote-256284600
Ref: ライブラリ<167>-Footnote-266284666
Ref: ライブラリ<167>-Footnote-276284732
Ref: ライブラリ<167>-Footnote-286284798
Ref: ライブラリ<167>-Footnote-296284864
Ref: ライブラリ<167>-Footnote-306284930
Ref: ライブラリ<167>-Footnote-316284996
Ref: ライブラリ<167>-Footnote-326285062
Ref: ライブラリ<167>-Footnote-336285128
Ref: ライブラリ<167>-Footnote-346285194
Ref: ライブラリ<167>-Footnote-356285260
Ref: ライブラリ<167>-Footnote-366285326
Ref: ライブラリ<167>-Footnote-376285392
Ref: ライブラリ<167>-Footnote-386285458
Ref: ライブラリ<167>-Footnote-396285524
Ref: ライブラリ<167>-Footnote-406285590
Ref: ライブラリ<167>-Footnote-416285656
Ref: ライブラリ<167>-Footnote-426285722
Ref: ライブラリ<167>-Footnote-436285788
Ref: ライブラリ<167>-Footnote-446285854
Ref: ライブラリ<167>-Footnote-456285920
Ref: ライブラリ<167>-Footnote-466285986
Ref: ライブラリ<167>-Footnote-476286052
Ref: ライブラリ<167>-Footnote-486286118
Ref: ライブラリ<167>-Footnote-496286184
Ref: ライブラリ<167>-Footnote-506286250
Ref: ライブラリ<167>-Footnote-516286316
Ref: ライブラリ<167>-Footnote-526286382
Ref: ライブラリ<167>-Footnote-536286448
Ref: ライブラリ<167>-Footnote-546286514
Ref: ライブラリ<167>-Footnote-556286580
Ref: ライブラリ<167>-Footnote-566286646
Ref: ライブラリ<167>-Footnote-576286712
Ref: ライブラリ<167>-Footnote-586286778
Ref: ライブラリ<167>-Footnote-596286844
Ref: ライブラリ<167>-Footnote-606286910
Ref: ライブラリ<167>-Footnote-616286976
Ref: ライブラリ<167>-Footnote-626287042
Ref: ライブラリ<167>-Footnote-636287108
Ref: ライブラリ<167>-Footnote-646287174
Ref: ライブラリ<167>-Footnote-656287240
Ref: ライブラリ<167>-Footnote-666287306
Ref: ライブラリ<167>-Footnote-676287372
Ref: ライブラリ<167>-Footnote-686287438
Ref: ライブラリ<167>-Footnote-696287504
Ref: ライブラリ<167>-Footnote-706287570
Ref: ライブラリ<167>-Footnote-716287636
Ref: ライブラリ<167>-Footnote-726287702
Ref: ライブラリ<167>-Footnote-736287768
Ref: ライブラリ<167>-Footnote-746287834
Ref: ライブラリ<167>-Footnote-756287900
Ref: ライブラリ<167>-Footnote-766287966
Ref: ライブラリ<167>-Footnote-776288032
Ref: ライブラリ<167>-Footnote-786288098
Ref: ライブラリ<167>-Footnote-796288164
Ref: ライブラリ<167>-Footnote-806288230
Ref: ライブラリ<167>-Footnote-816288296
Ref: ライブラリ<167>-Footnote-826288362
Ref: ライブラリ<167>-Footnote-836288428
Ref: ライブラリ<167>-Footnote-846288494
Ref: ライブラリ<167>-Footnote-856288560
Ref: ライブラリ<167>-Footnote-866288626
Ref: ライブラリ<167>-Footnote-876288692
Ref: ライブラリ<167>-Footnote-886288758
Ref: ライブラリ<167>-Footnote-896288824
Ref: ライブラリ<167>-Footnote-906288890
Ref: ライブラリ<167>-Footnote-916288956
Ref: ライブラリ<167>-Footnote-926289022
Ref: ライブラリ<167>-Footnote-936289088
Ref: ライブラリ<167>-Footnote-946289148
Ref: ライブラリ<167>-Footnote-956289214
Ref: ライブラリ<167>-Footnote-966289280
Ref: ライブラリ<167>-Footnote-976289346
Ref: ライブラリ<167>-Footnote-986289412
Ref: ライブラリ<167>-Footnote-996289478
Ref: ライブラリ<167>-Footnote-1006289544
Ref: ライブラリ<167>-Footnote-1016289611
Ref: ライブラリ<167>-Footnote-1026289678
Ref: ライブラリ<167>-Footnote-1036289745
Ref: ライブラリ<167>-Footnote-1046289812
Ref: ライブラリ<167>-Footnote-1056289879
Ref: ライブラリ<167>-Footnote-1066289946
Ref: ライブラリ<167>-Footnote-1076290013
Ref: ライブラリ<167>-Footnote-1086290080
Ref: ライブラリ<167>-Footnote-1096290147
Ref: ライブラリ<167>-Footnote-1106290214
Ref: ライブラリ<167>-Footnote-1116290281
Ref: ライブラリ<167>-Footnote-1126290348
Ref: ライブラリ<167>-Footnote-1136290415
Ref: ライブラリ<167>-Footnote-1146290482
Ref: ライブラリ<167>-Footnote-1156290549
Ref: ライブラリ<167>-Footnote-1166290616
Ref: ライブラリ<167>-Footnote-1176290683
Ref: ライブラリ<167>-Footnote-1186290750
Ref: ライブラリ<167>-Footnote-1196290817
Ref: ライブラリ<167>-Footnote-1206290884
Ref: ライブラリ<167>-Footnote-1216290951
Ref: ライブラリ<167>-Footnote-1226291018
Ref: ライブラリ<167>-Footnote-1236291085
Ref: ライブラリ<167>-Footnote-1246291152
Ref: ライブラリ<167>-Footnote-1256291219
Ref: ライブラリ<167>-Footnote-1266291285
Ref: ライブラリ<167>-Footnote-1276291352
Ref: ライブラリ<167>-Footnote-1286291419
Ref: ライブラリ<167>-Footnote-1296291486
Ref: ライブラリ<167>-Footnote-1306291553
Ref: ライブラリ<167>-Footnote-1316291620
Ref: ライブラリ<167>-Footnote-1326291687
Ref: ライブラリ<167>-Footnote-1336291754
Ref: ライブラリ<167>-Footnote-1346291821
Ref: ライブラリ<167>-Footnote-1356291888
Ref: ライブラリ<167>-Footnote-1366291955
Ref: ライブラリ<167>-Footnote-1376292021
Ref: ライブラリ<167>-Footnote-1386292088
Ref: ライブラリ<167>-Footnote-1396292155
Ref: ライブラリ<167>-Footnote-1406292222
Ref: ライブラリ<167>-Footnote-1416292289
Ref: ライブラリ<167>-Footnote-1426292356
Ref: ライブラリ<167>-Footnote-1436292423
Ref: ライブラリ<167>-Footnote-1446292490
Ref: ライブラリ<167>-Footnote-1456292557
Ref: ライブラリ<167>-Footnote-1466292624
Ref: ライブラリ<167>-Footnote-1476292691
Ref: ライブラリ<167>-Footnote-1486292758
Ref: ライブラリ<167>-Footnote-1496292825
Ref: ライブラリ<167>-Footnote-1506292892
Ref: ライブラリ<167>-Footnote-1516292959
Ref: ライブラリ<167>-Footnote-1526293026
Ref: ライブラリ<167>-Footnote-1536293093
Ref: ライブラリ<167>-Footnote-1546293160
Ref: ライブラリ<167>-Footnote-1556293226
Ref: ライブラリ<167>-Footnote-1566293293
Ref: ライブラリ<167>-Footnote-1576293360
Ref: ライブラリ<167>-Footnote-1586293427
Ref: ライブラリ<167>-Footnote-1596293494
Ref: ライブラリ<167>-Footnote-1606293561
Ref: ライブラリ<167>-Footnote-1616293628
Ref: ライブラリ<167>-Footnote-1626293672
Ref: ライブラリ<167>-Footnote-1636293739
Ref: ライブラリ<167>-Footnote-1646293806
Ref: ライブラリ<167>-Footnote-1656293873
Ref: ライブラリ<167>-Footnote-1666293939
Ref: ライブラリ<167>-Footnote-1676294006
Ref: ライブラリ<167>-Footnote-1686294073
Ref: ライブラリ<167>-Footnote-1696294140
Ref: ライブラリ<167>-Footnote-1706294207
Ref: ライブラリ<167>-Footnote-1716294274
Ref: ライブラリ<167>-Footnote-1726294341
Ref: ライブラリ<167>-Footnote-1736294408
Ref: ライブラリ<167>-Footnote-1746294475
Ref: ライブラリ<167>-Footnote-1756294541
Ref: ライブラリ<167>-Footnote-1766294608
Ref: ライブラリ<167>-Footnote-1776294675
Ref: ライブラリ<167>-Footnote-1786294742
Ref: ライブラリ<167>-Footnote-1796294809
Ref: ライブラリ<167>-Footnote-1806294876
Ref: ライブラリ<167>-Footnote-1816294942
Ref: ライブラリ<167>-Footnote-1826295009
Ref: ライブラリ<167>-Footnote-1836295076
Ref: ライブラリ<167>-Footnote-1846295143
Ref: ライブラリ<167>-Footnote-1856295210
Ref: ライブラリ<167>-Footnote-1866295277
Ref: ライブラリ<167>-Footnote-1876295344
Ref: ライブラリ<167>-Footnote-1886295411
Ref: ライブラリ<167>-Footnote-1896295478
Ref: ライブラリ<167>-Footnote-1906295545
Ref: ライブラリ<167>-Footnote-1916295612
Ref: ライブラリ<167>-Footnote-1926295679
Ref: ライブラリ<167>-Footnote-1936295746
Ref: ライブラリ<167>-Footnote-1946295813
Ref: ライブラリ<167>-Footnote-1956295880
Ref: ライブラリ<167>-Footnote-1966295947
Ref: ライブラリ<167>-Footnote-1976296014
Ref: ライブラリ<167>-Footnote-1986296081
Ref: ライブラリ<167>-Footnote-1996296148
Ref: ライブラリ<167>-Footnote-2006296215
Ref: ライブラリ<167>-Footnote-2016296282
Ref: ライブラリ<167>-Footnote-2026296349
Ref: ライブラリ<167>-Footnote-2036296417
Ref: ライブラリ<167>-Footnote-2046296484
Ref: ライブラリ<167>-Footnote-2056296551
Ref: ライブラリ<167>-Footnote-2066296618
Ref: ライブラリ<167>-Footnote-2076296685
Ref: ライブラリ<167>-Footnote-2086296752
Ref: ライブラリ<167>-Footnote-2096296819
Ref: ライブラリ<167>-Footnote-2106296886
Ref: ライブラリ<167>-Footnote-2116296953
Ref: ライブラリ<167>-Footnote-2126297020
Ref: ライブラリ<167>-Footnote-2136297087
Ref: ライブラリ<167>-Footnote-2146297131
Ref: ライブラリ<167>-Footnote-2156297198
Ref: ライブラリ<167>-Footnote-2166297265
Ref: ライブラリ<167>-Footnote-2176297332
Ref: ライブラリ<167>-Footnote-2186297399
Ref: ライブラリ<167>-Footnote-2196297466
Ref: ライブラリ<167>-Footnote-2206297533
Ref: ライブラリ<167>-Footnote-2216297600
Ref: ライブラリ<167>-Footnote-2226297667
Ref: ライブラリ<167>-Footnote-2236297734
Ref: ライブラリ<167>-Footnote-2246297801
Ref: ライブラリ<167>-Footnote-2256297868
Ref: ライブラリ<167>-Footnote-2266297935
Ref: ライブラリ<167>-Footnote-2276298002
Ref: ライブラリ<167>-Footnote-2286298069
Ref: ライブラリ<167>-Footnote-2296298136
Ref: ライブラリ<167>-Footnote-2306298203
Ref: ライブラリ<167>-Footnote-2316298270
Ref: ライブラリ<167>-Footnote-2326298337
Ref: ライブラリ<167>-Footnote-2336298404
Ref: ライブラリ<167>-Footnote-2346298471
Ref: ライブラリ<167>-Footnote-2356298538
Ref: ライブラリ<167>-Footnote-2366298605
Ref: ライブラリ<167>-Footnote-2376298672
Ref: ライブラリ<167>-Footnote-2386298739
Ref: ライブラリ<167>-Footnote-2396298806
Ref: ライブラリ<167>-Footnote-2406298873
Ref: ライブラリ<167>-Footnote-2416298940
Ref: ライブラリ<167>-Footnote-2426299007
Ref: ライブラリ<167>-Footnote-2436299074
Ref: ライブラリ<167>-Footnote-2446299141
Ref: ライブラリ<167>-Footnote-2456299208
Ref: ライブラリ<167>-Footnote-2466299275
Ref: ライブラリ<167>-Footnote-2476299342
Ref: ライブラリ<167>-Footnote-2486299409
Ref: ライブラリ<167>-Footnote-2496299476
Ref: ライブラリ<167>-Footnote-2506299543
Ref: ライブラリ<167>-Footnote-2516299610
Ref: ライブラリ<167>-Footnote-2526299677
Ref: ライブラリ<167>-Footnote-2536299744
Ref: ライブラリ<167>-Footnote-2546299811
Ref: ライブラリ<167>-Footnote-2556299878
Ref: ライブラリ<167>-Footnote-2566299945
Ref: ライブラリ<167>-Footnote-2576300012
Ref: ライブラリ<167>-Footnote-2586300079
Ref: ライブラリ<167>-Footnote-2596300146
Ref: ライブラリ<167>-Footnote-2606300213
Ref: ライブラリ<167>-Footnote-2616300279
Ref: ライブラリ<167>-Footnote-2626300346
Ref: ライブラリ<167>-Footnote-2636300413
Ref: ライブラリ<167>-Footnote-2646300480
Ref: ライブラリ<167>-Footnote-2656300547
Ref: ライブラリ<167>-Footnote-2666300614
Ref: ライブラリ<167>-Footnote-2676300681
Ref: ライブラリ<167>-Footnote-2686300748
Ref: ライブラリ<167>-Footnote-2696300815
Ref: ライブラリ<167>-Footnote-2706300882
Ref: ライブラリ<167>-Footnote-2716300949
Ref: ライブラリ<167>-Footnote-2726301016
Ref: ライブラリ<167>-Footnote-2736301083
Ref: ライブラリ<167>-Footnote-2746301150
Ref: ライブラリ<167>-Footnote-2756301217
Ref: ライブラリ<167>-Footnote-2766301284
Ref: ライブラリ<167>-Footnote-2776301351
Ref: ライブラリ<167>-Footnote-2786301418
Ref: ライブラリ<167>-Footnote-2796301485
Ref: ライブラリ<167>-Footnote-2806301552
Ref: ライブラリ<167>-Footnote-2816301619
Ref: ライブラリ<167>-Footnote-2826301686
Ref: ライブラリ<167>-Footnote-2836301753
Ref: ライブラリ<167>-Footnote-2846301820
Ref: ライブラリ<167>-Footnote-2856301887
Ref: ライブラリ<167>-Footnote-2866301954
Ref: ライブラリ<167>-Footnote-2876302021
Ref: ライブラリ<167>-Footnote-2886302088
Ref: ライブラリ<167>-Footnote-2896302155
Ref: ライブラリ<167>-Footnote-2906302222
Ref: ライブラリ<167>-Footnote-2916302289
Ref: ライブラリ<167>-Footnote-2926302356
Ref: ライブラリ<167>-Footnote-2936302423
Ref: ライブラリ<167>-Footnote-2946302490
Ref: ライブラリ<167>-Footnote-2956302557
Ref: ライブラリ<167>-Footnote-2966302624
Ref: ライブラリ<167>-Footnote-2976302691
Ref: ライブラリ<167>-Footnote-2986302758
Ref: ライブラリ<167>-Footnote-2996302825
Ref: ライブラリ<167>-Footnote-3006302892
Ref: ライブラリ<167>-Footnote-3016302959
Ref: ライブラリ<167>-Footnote-3026303026
Ref: ライブラリ<167>-Footnote-3036303093
Ref: ライブラリ<167>-Footnote-3046303160
Ref: ライブラリ<167>-Footnote-3056303227
Ref: ライブラリ<167>-Footnote-3066303294
Ref: ライブラリ<167>-Footnote-3076303361
Ref: ライブラリ<167>-Footnote-3086303428
Ref: ライブラリ<167>-Footnote-3096303495
Ref: ライブラリ<167>-Footnote-3106303562
Ref: ライブラリ<167>-Footnote-3116303629
Ref: ライブラリ<167>-Footnote-3126303696
Ref: ライブラリ<167>-Footnote-3136303763
Ref: ライブラリ<167>-Footnote-3146303830
Ref: ライブラリ<167>-Footnote-3156303897
Ref: ライブラリ<167>-Footnote-3166303964
Ref: ライブラリ<167>-Footnote-3176304031
Ref: ライブラリ<167>-Footnote-3186304098
Ref: ライブラリ<167>-Footnote-3196304165
Ref: ライブラリ<167>-Footnote-3206304232
Ref: ライブラリ<167>-Footnote-3216304299
Ref: ライブラリ<167>-Footnote-3226304366
Ref: ライブラリ<167>-Footnote-3236304433
Ref: ライブラリ<167>-Footnote-3246304500
Ref: ライブラリ<167>-Footnote-3256304567
Ref: ライブラリ<167>-Footnote-3266304634
Ref: ライブラリ<167>-Footnote-3276304701
Ref: ライブラリ<167>-Footnote-3286304768
Ref: ライブラリ<167>-Footnote-3296304836
Ref: ライブラリ<167>-Footnote-3306304903
Ref: ライブラリ<167>-Footnote-3316304970
Ref: ライブラリ<167>-Footnote-3326305037
Ref: ライブラリ<167>-Footnote-3336305104
Ref: ライブラリ<167>-Footnote-3346305171
Ref: ライブラリ<167>-Footnote-3356305238
Ref: ライブラリ<167>-Footnote-3366305305
Ref: ライブラリ<167>-Footnote-3376305372
Ref: ライブラリ<167>-Footnote-3386305439
Ref: ライブラリ<167>-Footnote-3396305506
Ref: ライブラリ<167>-Footnote-3406305573
Ref: ライブラリ<167>-Footnote-3416305640
Ref: ライブラリ<167>-Footnote-3426305707
Ref: ライブラリ<167>-Footnote-3436305774
Ref: ライブラリ<167>-Footnote-3446305841
Ref: ライブラリ<167>-Footnote-3456305908
Ref: ライブラリ<167>-Footnote-3466305952
Ref: ライブラリ<167>-Footnote-3476306019
Ref: ライブラリ<167>-Footnote-3486306086
Ref: ライブラリ<167>-Footnote-3496306153
Ref: ライブラリ<167>-Footnote-3506306197
Ref: ライブラリ<167>-Footnote-3516306264
Ref: ライブラリ<167>-Footnote-3526306331
Ref: ライブラリ<167>-Footnote-3536306398
Ref: ライブラリ<167>-Footnote-3546306465
Ref: ライブラリ<167>-Footnote-3556306532
Ref: ライブラリ<167>-Footnote-3566306599
Ref: ライブラリ<167>-Footnote-3576306666
Ref: ライブラリ<167>-Footnote-3586306733
Ref: ライブラリ<167>-Footnote-3596306800
Ref: ライブラリ<167>-Footnote-3606306867
Ref: ライブラリ<167>-Footnote-3616306934
Ref: ライブラリ<167>-Footnote-3626307001
Ref: ライブラリ<167>-Footnote-3636307068
Ref: ライブラリ<167>-Footnote-3646307135
Ref: ライブラリ<167>-Footnote-3656307202
Ref: ライブラリ<167>-Footnote-3666307269
Ref: ライブラリ<167>-Footnote-3676307336
Ref: ライブラリ<167>-Footnote-3686307403
Ref: ライブラリ<167>-Footnote-3696307470
Ref: ライブラリ<167>-Footnote-3706307537
Ref: ライブラリ<167>-Footnote-3716307604
Ref: ライブラリ<167>-Footnote-3726307671
Ref: ライブラリ<167>-Footnote-3736307738
Ref: ライブラリ<167>-Footnote-3746307805
Ref: ライブラリ<167>-Footnote-3756307872
Ref: ライブラリ<167>-Footnote-3766307939
Ref: ライブラリ<167>-Footnote-3776308006
Ref: ライブラリ<167>-Footnote-3786308073
Ref: ライブラリ<167>-Footnote-3796308140
Ref: ライブラリ<167>-Footnote-3806308207
Ref: ライブラリ<167>-Footnote-3816308274
Ref: ライブラリ<167>-Footnote-3826308341
Ref: ライブラリ<167>-Footnote-3836308408
Ref: ライブラリ<167>-Footnote-3846308475
Ref: ライブラリ<167>-Footnote-3856308542
Ref: ライブラリ<167>-Footnote-3866308609
Ref: ライブラリ<167>-Footnote-3876308676
Ref: ライブラリ<167>-Footnote-3886308743
Ref: ライブラリ<167>-Footnote-3896308810
Ref: ライブラリ<167>-Footnote-3906308877
Ref: ライブラリ<167>-Footnote-3916308944
Ref: ライブラリ<167>-Footnote-3926309011
Ref: ライブラリ<167>-Footnote-3936309078
Ref: ライブラリ<167>-Footnote-3946309145
Ref: ライブラリ<167>-Footnote-3956309212
Ref: ライブラリ<167>-Footnote-3966309279
Ref: ライブラリ<167>-Footnote-3976309346
Ref: ライブラリ<167>-Footnote-3986309413
Ref: ライブラリ<167>-Footnote-3996309480
Ref: ライブラリ<167>-Footnote-4006309547
Ref: ライブラリ<167>-Footnote-4016309614
Ref: ライブラリ<167>-Footnote-4026309681
Ref: ライブラリ<167>-Footnote-4036309748
Ref: ライブラリ<167>-Footnote-4046309815
Ref: ライブラリ<167>-Footnote-4056309882
Ref: ライブラリ<167>-Footnote-4066309949
Ref: ライブラリ<167>-Footnote-4076310016
Ref: ライブラリ<167>-Footnote-4086310083
Ref: ライブラリ<167>-Footnote-4096310150
Ref: ライブラリ<167>-Footnote-4106310217
Ref: ライブラリ<167>-Footnote-4116310284
Ref: ライブラリ<167>-Footnote-4126310351
Ref: ライブラリ<167>-Footnote-4136310418
Ref: ライブラリ<167>-Footnote-4146310485
Ref: ライブラリ<167>-Footnote-4156310552
Ref: ライブラリ<167>-Footnote-4166310619
Ref: ライブラリ<167>-Footnote-4176310686
Ref: ライブラリ<167>-Footnote-4186310753
Ref: ライブラリ<167>-Footnote-4196310820
Ref: ライブラリ<167>-Footnote-4206310887
Ref: ライブラリ<167>-Footnote-4216310954
Ref: ライブラリ<167>-Footnote-4226311021
Ref: ライブラリ<167>-Footnote-4236311087
Ref: ライブラリ<167>-Footnote-4246311154
Ref: ライブラリ<167>-Footnote-4256311221
Ref: ライブラリ<167>-Footnote-4266311288
Ref: ライブラリ<167>-Footnote-4276311355
Ref: ライブラリ<167>-Footnote-4286311422
Ref: ライブラリ<167>-Footnote-4296311489
Ref: ライブラリ<167>-Footnote-4306311556
Ref: ライブラリ<167>-Footnote-4316311623
Ref: ライブラリ<167>-Footnote-4326311690
Ref: ライブラリ<167>-Footnote-4336311757
Ref: ライブラリ<167>-Footnote-4346311824
Ref: ライブラリ<167>-Footnote-4356311891
Ref: ライブラリ<167>-Footnote-4366311958
Ref: ライブラリ<167>-Footnote-4376312025
Node: ドキュメント<56>6312092
Ref: whatsnew/changelog id7696312222
Ref: 20336312222
Ref: ドキュメント<56>-Footnote-16318907
Ref: ドキュメント<56>-Footnote-26318972
Ref: ドキュメント<56>-Footnote-36319037
Ref: ドキュメント<56>-Footnote-46319102
Ref: ドキュメント<56>-Footnote-56319167
Ref: ドキュメント<56>-Footnote-66319232
Ref: ドキュメント<56>-Footnote-76319297
Ref: ドキュメント<56>-Footnote-86319362
Ref: ドキュメント<56>-Footnote-96319427
Ref: ドキュメント<56>-Footnote-106319492
Ref: ドキュメント<56>-Footnote-116319558
Ref: ドキュメント<56>-Footnote-126319624
Ref: ドキュメント<56>-Footnote-136319690
Ref: ドキュメント<56>-Footnote-146319756
Ref: ドキュメント<56>-Footnote-156319822
Ref: ドキュメント<56>-Footnote-166319888
Ref: ドキュメント<56>-Footnote-176319954
Ref: ドキュメント<56>-Footnote-186320020
Ref: ドキュメント<56>-Footnote-196320086
Ref: ドキュメント<56>-Footnote-206320152
Ref: ドキュメント<56>-Footnote-216320218
Ref: ドキュメント<56>-Footnote-226320284
Ref: ドキュメント<56>-Footnote-236320350
Ref: ドキュメント<56>-Footnote-246320393
Ref: ドキュメント<56>-Footnote-256320459
Ref: ドキュメント<56>-Footnote-266320525
Ref: ドキュメント<56>-Footnote-276320591
Ref: ドキュメント<56>-Footnote-286320657
Ref: ドキュメント<56>-Footnote-296320723
Ref: ドキュメント<56>-Footnote-306320766
Ref: ドキュメント<56>-Footnote-316320832
Ref: ドキュメント<56>-Footnote-326320898
Ref: ドキュメント<56>-Footnote-336320964
Ref: ドキュメント<56>-Footnote-346321030
Ref: ドキュメント<56>-Footnote-356321096
Ref: ドキュメント<56>-Footnote-366321162
Ref: ドキュメント<56>-Footnote-376321228
Ref: ドキュメント<56>-Footnote-386321294
Ref: ドキュメント<56>-Footnote-396321360
Ref: ドキュメント<56>-Footnote-406321426
Ref: ドキュメント<56>-Footnote-416321492
Ref: ドキュメント<56>-Footnote-426321558
Ref: ドキュメント<56>-Footnote-436321624
Ref: ドキュメント<56>-Footnote-446321690
Ref: ドキュメント<56>-Footnote-456321756
Ref: ドキュメント<56>-Footnote-466321822
Ref: ドキュメント<56>-Footnote-476321888
Ref: ドキュメント<56>-Footnote-486321954
Ref: ドキュメント<56>-Footnote-496322020
Ref: ドキュメント<56>-Footnote-506322086
Ref: ドキュメント<56>-Footnote-516322151
Ref: ドキュメント<56>-Footnote-526322217
Ref: ドキュメント<56>-Footnote-536322283
Ref: ドキュメント<56>-Footnote-546322349
Ref: ドキュメント<56>-Footnote-556322415
Ref: ドキュメント<56>-Footnote-566322481
Ref: ドキュメント<56>-Footnote-576322546
Ref: ドキュメント<56>-Footnote-586322612
Ref: ドキュメント<56>-Footnote-596322678
Node: テスト<59>6322744
Ref: whatsnew/changelog id7706322867
Ref: 20356322867
Ref: テスト<59>-Footnote-16330464
Ref: テスト<59>-Footnote-26330529
Ref: テスト<59>-Footnote-36330594
Ref: テスト<59>-Footnote-46330659
Ref: テスト<59>-Footnote-56330724
Ref: テスト<59>-Footnote-66330789
Ref: テスト<59>-Footnote-76330854
Ref: テスト<59>-Footnote-86330919
Ref: テスト<59>-Footnote-96330984
Ref: テスト<59>-Footnote-106331049
Ref: テスト<59>-Footnote-116331115
Ref: テスト<59>-Footnote-126331181
Ref: テスト<59>-Footnote-136331247
Ref: テスト<59>-Footnote-146331313
Ref: テスト<59>-Footnote-156331379
Ref: テスト<59>-Footnote-166331445
Ref: テスト<59>-Footnote-176331511
Ref: テスト<59>-Footnote-186331577
Ref: テスト<59>-Footnote-196331643
Ref: テスト<59>-Footnote-206331709
Ref: テスト<59>-Footnote-216331775
Ref: テスト<59>-Footnote-226331841
Ref: テスト<59>-Footnote-236331907
Ref: テスト<59>-Footnote-246331973
Ref: テスト<59>-Footnote-256332039
Ref: テスト<59>-Footnote-266332105
Ref: テスト<59>-Footnote-276332171
Ref: テスト<59>-Footnote-286332237
Ref: テスト<59>-Footnote-296332303
Ref: テスト<59>-Footnote-306332369
Ref: テスト<59>-Footnote-316332435
Ref: テスト<59>-Footnote-326332501
Ref: テスト<59>-Footnote-336332567
Ref: テスト<59>-Footnote-346332633
Ref: テスト<59>-Footnote-356332699
Ref: テスト<59>-Footnote-366332765
Ref: テスト<59>-Footnote-376332831
Ref: テスト<59>-Footnote-386332897
Ref: テスト<59>-Footnote-396332963
Ref: テスト<59>-Footnote-406333029
Ref: テスト<59>-Footnote-416333095
Ref: テスト<59>-Footnote-426333161
Ref: テスト<59>-Footnote-436333227
Ref: テスト<59>-Footnote-446333293
Ref: テスト<59>-Footnote-456333359
Ref: テスト<59>-Footnote-466333425
Ref: テスト<59>-Footnote-476333491
Ref: テスト<59>-Footnote-486333557
Node: ビルド<62>6333623
Ref: whatsnew/changelog id7716333735
Ref: 20366333735
Ref: ビルド<62>-Footnote-16338850
Ref: ビルド<62>-Footnote-26338915
Ref: ビルド<62>-Footnote-36338980
Ref: ビルド<62>-Footnote-46339045
Ref: ビルド<62>-Footnote-56339110
Ref: ビルド<62>-Footnote-66339175
Ref: ビルド<62>-Footnote-76339240
Ref: ビルド<62>-Footnote-86339305
Ref: ビルド<62>-Footnote-96339370
Ref: ビルド<62>-Footnote-106339435
Ref: ビルド<62>-Footnote-116339501
Ref: ビルド<62>-Footnote-126339567
Ref: ビルド<62>-Footnote-136339633
Ref: ビルド<62>-Footnote-146339699
Ref: ビルド<62>-Footnote-156339765
Ref: ビルド<62>-Footnote-166339831
Ref: ビルド<62>-Footnote-176339897
Ref: ビルド<62>-Footnote-186339963
Ref: ビルド<62>-Footnote-196340029
Ref: ビルド<62>-Footnote-206340095
Ref: ビルド<62>-Footnote-216340161
Ref: ビルド<62>-Footnote-226340227
Ref: ビルド<62>-Footnote-236340293
Ref: ビルド<62>-Footnote-246340358
Ref: ビルド<62>-Footnote-256340424
Ref: ビルド<62>-Footnote-266340490
Ref: ビルド<62>-Footnote-276340556
Ref: ビルド<62>-Footnote-286340622
Ref: ビルド<62>-Footnote-296340688
Ref: ビルド<62>-Footnote-306340754
Ref: ビルド<62>-Footnote-316340820
Ref: ビルド<62>-Footnote-326340886
Ref: ビルド<62>-Footnote-336340952
Ref: ビルド<62>-Footnote-346341018
Ref: ビルド<62>-Footnote-356341084
Ref: ビルド<62>-Footnote-366341150
Ref: ビルド<62>-Footnote-376341216
Node: Windows<55>6341282
Ref: whatsnew/changelog id7726341390
Ref: 20386341390
Ref: Windows<55>-Footnote-16345799
Ref: Windows<55>-Footnote-26345864
Ref: Windows<55>-Footnote-36345929
Ref: Windows<55>-Footnote-46345994
Ref: Windows<55>-Footnote-56346059
Ref: Windows<55>-Footnote-66346124
Ref: Windows<55>-Footnote-76346189
Ref: Windows<55>-Footnote-86346254
Ref: Windows<55>-Footnote-96346319
Ref: Windows<55>-Footnote-106346384
Ref: Windows<55>-Footnote-116346450
Ref: Windows<55>-Footnote-126346516
Ref: Windows<55>-Footnote-136346582
Ref: Windows<55>-Footnote-146346648
Ref: Windows<55>-Footnote-156346714
Ref: Windows<55>-Footnote-166346780
Ref: Windows<55>-Footnote-176346846
Ref: Windows<55>-Footnote-186346912
Ref: Windows<55>-Footnote-196346978
Ref: Windows<55>-Footnote-206347044
Ref: Windows<55>-Footnote-216347110
Ref: Windows<55>-Footnote-226347176
Ref: Windows<55>-Footnote-236347242
Ref: Windows<55>-Footnote-246347308
Ref: Windows<55>-Footnote-256347374
Ref: Windows<55>-Footnote-266347440
Ref: Windows<55>-Footnote-276347506
Ref: Windows<55>-Footnote-286347572
Ref: Windows<55>-Footnote-296347638
Ref: Windows<55>-Footnote-306347704
Ref: Windows<55>-Footnote-316347770
Ref: Windows<55>-Footnote-326347836
Ref: Windows<55>-Footnote-336347902
Ref: Windows<55>-Footnote-346347968
Ref: Windows<55>-Footnote-356348034
Ref: Windows<55>-Footnote-366348100
Ref: Windows<55>-Footnote-376348166
Ref: Windows<55>-Footnote-386348232
Ref: Windows<55>-Footnote-396348298
Ref: Windows<55>-Footnote-406348364
Node: macOS<43>6348429
Ref: whatsnew/changelog id7736348532
Ref: 20396348532
Ref: macOS<43>-Footnote-16350137
Ref: macOS<43>-Footnote-26350202
Ref: macOS<43>-Footnote-36350267
Ref: macOS<43>-Footnote-46350332
Ref: macOS<43>-Footnote-56350397
Ref: macOS<43>-Footnote-66350462
Ref: macOS<43>-Footnote-76350527
Ref: macOS<43>-Footnote-86350592
Ref: macOS<43>-Footnote-96350657
Ref: macOS<43>-Footnote-106350722
Node: IDLE<38>6350788
Ref: whatsnew/changelog id7746350895
Ref: 203a6350895
Ref: IDLE<38>-Footnote-16359257
Ref: IDLE<38>-Footnote-26359322
Ref: IDLE<38>-Footnote-36359387
Ref: IDLE<38>-Footnote-46359452
Ref: IDLE<38>-Footnote-56359517
Ref: IDLE<38>-Footnote-66359582
Ref: IDLE<38>-Footnote-76359647
Ref: IDLE<38>-Footnote-86359712
Ref: IDLE<38>-Footnote-96359777
Ref: IDLE<38>-Footnote-106359842
Ref: IDLE<38>-Footnote-116359908
Ref: IDLE<38>-Footnote-126359974
Ref: IDLE<38>-Footnote-136360040
Ref: IDLE<38>-Footnote-146360106
Ref: IDLE<38>-Footnote-156360172
Ref: IDLE<38>-Footnote-166360238
Ref: IDLE<38>-Footnote-176360304
Ref: IDLE<38>-Footnote-186360370
Ref: IDLE<38>-Footnote-196360436
Ref: IDLE<38>-Footnote-206360502
Ref: IDLE<38>-Footnote-216360568
Ref: IDLE<38>-Footnote-226360634
Ref: IDLE<38>-Footnote-236360700
Ref: IDLE<38>-Footnote-246360766
Ref: IDLE<38>-Footnote-256360832
Ref: IDLE<38>-Footnote-266360898
Ref: IDLE<38>-Footnote-276360964
Ref: IDLE<38>-Footnote-286361032
Ref: IDLE<38>-Footnote-296361098
Ref: IDLE<38>-Footnote-306361164
Ref: IDLE<38>-Footnote-316361230
Ref: IDLE<38>-Footnote-326361296
Ref: IDLE<38>-Footnote-336361362
Ref: IDLE<38>-Footnote-346361428
Ref: IDLE<38>-Footnote-356361494
Ref: IDLE<38>-Footnote-366361560
Ref: IDLE<38>-Footnote-376361626
Ref: IDLE<38>-Footnote-386361692
Ref: IDLE<38>-Footnote-396361758
Ref: IDLE<38>-Footnote-406361824
Ref: IDLE<38>-Footnote-416361890
Ref: IDLE<38>-Footnote-426361956
Ref: IDLE<38>-Footnote-436362022
Ref: IDLE<38>-Footnote-446362088
Ref: IDLE<38>-Footnote-456362154
Ref: IDLE<38>-Footnote-466362220
Ref: IDLE<38>-Footnote-476362286
Ref: IDLE<38>-Footnote-486362352
Ref: IDLE<38>-Footnote-496362418
Ref: IDLE<38>-Footnote-506362484
Ref: IDLE<38>-Footnote-516362550
Ref: IDLE<38>-Footnote-526362616
Ref: IDLE<38>-Footnote-536362682
Ref: IDLE<38>-Footnote-546362748
Ref: IDLE<38>-Footnote-556362814
Ref: IDLE<38>-Footnote-566362880
Ref: IDLE<38>-Footnote-576362946
Ref: IDLE<38>-Footnote-586363012
Ref: IDLE<38>-Footnote-596363078
Node: Tools/Demos<35>6363144
Ref: whatsnew/changelog id7756363251
Ref: 203b6363251
Ref: Tools/Demos<35>-Footnote-16364896
Ref: Tools/Demos<35>-Footnote-26364961
Ref: Tools/Demos<35>-Footnote-36365026
Ref: Tools/Demos<35>-Footnote-46365091
Ref: Tools/Demos<35>-Footnote-56365156
Ref: Tools/Demos<35>-Footnote-66365221
Ref: Tools/Demos<35>-Footnote-76365286
Ref: Tools/Demos<35>-Footnote-86365351
Ref: Tools/Demos<35>-Footnote-96365416
Ref: Tools/Demos<35>-Footnote-106365481
Ref: Tools/Demos<35>-Footnote-116365547
Ref: Tools/Demos<35>-Footnote-126365613
Node: C API<58>6365679
Ref: whatsnew/changelog id7766365769
Ref: 203c6365769
Ref: C API<58>-Footnote-16369186
Ref: C API<58>-Footnote-26369251
Ref: C API<58>-Footnote-36369316
Ref: C API<58>-Footnote-46369381
Ref: C API<58>-Footnote-56369446
Ref: C API<58>-Footnote-66369511
Ref: C API<58>-Footnote-76369576
Ref: C API<58>-Footnote-86369641
Ref: C API<58>-Footnote-96369706
Ref: C API<58>-Footnote-106369771
Ref: C API<58>-Footnote-116369837
Ref: C API<58>-Footnote-126369903
Ref: C API<58>-Footnote-136369969
Ref: C API<58>-Footnote-146370035
Ref: C API<58>-Footnote-156370101
Ref: C API<58>-Footnote-166370167
Ref: C API<58>-Footnote-176370233
Ref: C API<58>-Footnote-186370299
Ref: C API<58>-Footnote-196370365
Ref: C API<58>-Footnote-206370431
Ref: C API<58>-Footnote-216370497
Ref: C API<58>-Footnote-226370563
Node: Python 3 7 0 final6370629
Ref: whatsnew/changelog python-3-7-0-final6370766
Ref: 20456370766
Node: ライブラリ<168>6370920
Ref: whatsnew/changelog id7776371013
Ref: 20466371013
Ref: ライブラリ<168>-Footnote-16371194
Node: C API<59>6371259
Ref: whatsnew/changelog id7786371352
Ref: 20486371352
Ref: C API<59>-Footnote-16371563
Node: Python 3 7 0 release candidate 16371628
Ref: whatsnew/changelog python-3-7-0-release-candidate-16371764
Ref: 20496371764
Node: Core and Builtins<167>6372087
Ref: whatsnew/changelog id7796372207
Ref: 204a6372207
Ref: Core and Builtins<167>-Footnote-16372849
Ref: Core and Builtins<167>-Footnote-26372914
Ref: Core and Builtins<167>-Footnote-36372979
Ref: Core and Builtins<167>-Footnote-46373044
Node: ライブラリ<169>6373109
Ref: whatsnew/changelog id7806373260
Ref: 204b6373260
Ref: ライブラリ<169>-Footnote-16374967
Ref: ライブラリ<169>-Footnote-26375032
Ref: ライブラリ<169>-Footnote-36375097
Ref: ライブラリ<169>-Footnote-46375162
Ref: ライブラリ<169>-Footnote-56375227
Ref: ライブラリ<169>-Footnote-66375292
Ref: ライブラリ<169>-Footnote-76375357
Ref: ライブラリ<169>-Footnote-86375422
Ref: ライブラリ<169>-Footnote-96375487
Ref: ライブラリ<169>-Footnote-106375552
Ref: ライブラリ<169>-Footnote-116375618
Ref: ライブラリ<169>-Footnote-126375684
Ref: ライブラリ<169>-Footnote-136375750
Node: ドキュメント<57>6375816
Ref: whatsnew/changelog id7816375958
Ref: 204c6375958
Ref: ドキュメント<57>-Footnote-16376465
Ref: ドキュメント<57>-Footnote-26376530
Ref: ドキュメント<57>-Footnote-36376572
Ref: ドキュメント<57>-Footnote-46376637
Node: ビルド<63>6376702
Ref: whatsnew/changelog id7826376835
Ref: 204d6376835
Ref: ビルド<63>-Footnote-16377102
Node: Windows<56>6377166
Ref: whatsnew/changelog id7836377285
Ref: 204e6377285
Ref: Windows<56>-Footnote-16377442
Node: IDLE<39>6377507
Ref: whatsnew/changelog id7846377604
Ref: 204f6377604
Ref: IDLE<39>-Footnote-16378824
Ref: IDLE<39>-Footnote-26378889
Ref: IDLE<39>-Footnote-36378954
Ref: IDLE<39>-Footnote-46379019
Ref: IDLE<39>-Footnote-56379084
Ref: IDLE<39>-Footnote-66379149
Node: Python 3 7 0 beta 56379214
Ref: whatsnew/changelog python-3-7-0-beta-56379351
Ref: 20506379351
Node: Core and Builtins<168>6379672
Ref: whatsnew/changelog id7856379779
Ref: 20516379779
Ref: Core and Builtins<168>-Footnote-16381291
Ref: Core and Builtins<168>-Footnote-26381356
Ref: Core and Builtins<168>-Footnote-36381421
Ref: Core and Builtins<168>-Footnote-46381486
Ref: Core and Builtins<168>-Footnote-56381551
Ref: Core and Builtins<168>-Footnote-66381616
Ref: Core and Builtins<168>-Footnote-76381681
Ref: Core and Builtins<168>-Footnote-86381746
Ref: Core and Builtins<168>-Footnote-96381811
Node: ライブラリ<170>6381876
Ref: whatsnew/changelog id7866382014
Ref: 20526382014
Ref: ライブラリ<170>-Footnote-16387617
Ref: ライブラリ<170>-Footnote-26387682
Ref: ライブラリ<170>-Footnote-36387747
Ref: ライブラリ<170>-Footnote-46387812
Ref: ライブラリ<170>-Footnote-56387877
Ref: ライブラリ<170>-Footnote-66387942
Ref: ライブラリ<170>-Footnote-76388007
Ref: ライブラリ<170>-Footnote-86388072
Ref: ライブラリ<170>-Footnote-96388137
Ref: ライブラリ<170>-Footnote-106388202
Ref: ライブラリ<170>-Footnote-116388268
Ref: ライブラリ<170>-Footnote-126388334
Ref: ライブラリ<170>-Footnote-136388400
Ref: ライブラリ<170>-Footnote-146388466
Ref: ライブラリ<170>-Footnote-156388532
Ref: ライブラリ<170>-Footnote-166388598
Ref: ライブラリ<170>-Footnote-176388664
Ref: ライブラリ<170>-Footnote-186388730
Ref: ライブラリ<170>-Footnote-196388796
Ref: ライブラリ<170>-Footnote-206388862
Ref: ライブラリ<170>-Footnote-216388928
Ref: ライブラリ<170>-Footnote-226388994
Ref: ライブラリ<170>-Footnote-236389060
Ref: ライブラリ<170>-Footnote-246389126
Ref: ライブラリ<170>-Footnote-256389192
Ref: ライブラリ<170>-Footnote-266389258
Ref: ライブラリ<170>-Footnote-276389324
Ref: ライブラリ<170>-Footnote-286389390
Ref: ライブラリ<170>-Footnote-296389456
Ref: ライブラリ<170>-Footnote-306389522
Ref: ライブラリ<170>-Footnote-316389588
Ref: ライブラリ<170>-Footnote-326389654
Ref: ライブラリ<170>-Footnote-336389720
Ref: ライブラリ<170>-Footnote-346389786
Ref: ライブラリ<170>-Footnote-356389852
Ref: ライブラリ<170>-Footnote-366389918
Ref: ライブラリ<170>-Footnote-376389984
Ref: ライブラリ<170>-Footnote-386390050
Node: ドキュメント<58>6390116
Ref: whatsnew/changelog id7876390245
Ref: 20536390245
Ref: ドキュメント<58>-Footnote-16390719
Ref: ドキュメント<58>-Footnote-26390784
Ref: ドキュメント<58>-Footnote-36390849
Ref: ドキュメント<58>-Footnote-46390891
Ref: ドキュメント<58>-Footnote-56390956
Ref: ドキュメント<58>-Footnote-66391021
Node: テスト<60>6391086
Ref: whatsnew/changelog id7886391208
Ref: 20546391208
Ref: テスト<60>-Footnote-16391562
Ref: テスト<60>-Footnote-26391627
Node: ビルド<64>6391692
Ref: whatsnew/changelog id7896391801
Ref: 20556391801
Ref: ビルド<64>-Footnote-16392285
Ref: ビルド<64>-Footnote-26392350
Ref: ビルド<64>-Footnote-36392415
Node: macOS<44>6392480
Ref: whatsnew/changelog id7906392584
Ref: 20566392584
Ref: macOS<44>-Footnote-16392824
Node: IDLE<40>6392889
Ref: whatsnew/changelog id7916392971
Ref: 20576392971
Ref: IDLE<40>-Footnote-16393248
Ref: IDLE<40>-Footnote-26393313
Ref: IDLE<40>-Footnote-36393378
Node: Python 3 7 0 beta 46393443
Ref: whatsnew/changelog python-3-7-0-beta-46393567
Ref: 20586393567
Node: Core and Builtins<169>6393944
Ref: whatsnew/changelog id7926394051
Ref: 20596394051
Ref: Core and Builtins<169>-Footnote-16395177
Ref: Core and Builtins<169>-Footnote-26395242
Ref: Core and Builtins<169>-Footnote-36395307
Ref: Core and Builtins<169>-Footnote-46395372
Ref: Core and Builtins<169>-Footnote-56395437
Ref: Core and Builtins<169>-Footnote-66395502
Ref: Core and Builtins<169>-Footnote-76395567
Node: ライブラリ<171>6395632
Ref: whatsnew/changelog id7936395770
Ref: 205a6395770
Ref: ライブラリ<171>-Footnote-16398611
Ref: ライブラリ<171>-Footnote-26398676
Ref: ライブラリ<171>-Footnote-36398741
Ref: ライブラリ<171>-Footnote-46398806
Ref: ライブラリ<171>-Footnote-56398872
Ref: ライブラリ<171>-Footnote-66398937
Ref: ライブラリ<171>-Footnote-76399002
Ref: ライブラリ<171>-Footnote-86399067
Ref: ライブラリ<171>-Footnote-96399132
Ref: ライブラリ<171>-Footnote-106399197
Ref: ライブラリ<171>-Footnote-116399263
Ref: ライブラリ<171>-Footnote-126399329
Ref: ライブラリ<171>-Footnote-136399395
Ref: ライブラリ<171>-Footnote-146399461
Ref: ライブラリ<171>-Footnote-156399527
Ref: ライブラリ<171>-Footnote-166399593
Ref: ライブラリ<171>-Footnote-176399659
Ref: ライブラリ<171>-Footnote-186399702
Ref: ライブラリ<171>-Footnote-196399768
Ref: ライブラリ<171>-Footnote-206399834
Ref: ライブラリ<171>-Footnote-216399900
Ref: ライブラリ<171>-Footnote-226399966
Node: ドキュメント<59>6400032
Ref: whatsnew/changelog id7946400161
Ref: 205b6400161
Ref: ドキュメント<59>-Footnote-16400916
Ref: ドキュメント<59>-Footnote-26400981
Ref: ドキュメント<59>-Footnote-36401046
Ref: ドキュメント<59>-Footnote-46401111
Ref: ドキュメント<59>-Footnote-56401176
Ref: ドキュメント<59>-Footnote-66401240
Node: テスト<61>6401305
Ref: whatsnew/changelog id7956401427
Ref: 205c6401427
Ref: テスト<61>-Footnote-16401648
Node: ビルド<65>6401713
Ref: whatsnew/changelog id7966401824
Ref: 205d6401824
Ref: ビルド<65>-Footnote-16402519
Ref: ビルド<65>-Footnote-26402584
Ref: ビルド<65>-Footnote-36402649
Ref: ビルド<65>-Footnote-46402714
Ref: ビルド<65>-Footnote-56402779
Node: Windows<57>6402844
Ref: whatsnew/changelog id7976402951
Ref: 205e6402951
Ref: Windows<57>-Footnote-16403092
Node: macOS<45>6403157
Ref: whatsnew/changelog id7986403259
Ref: 205f6403259
Ref: macOS<45>-Footnote-16403400
Node: IDLE<41>6403465
Ref: whatsnew/changelog id7996403571
Ref: 20606403571
Ref: IDLE<41>-Footnote-16404149
Ref: IDLE<41>-Footnote-26404214
Node: Tools/Demos<36>6404279
Ref: whatsnew/changelog id8006404367
Ref: 20616404367
Ref: Tools/Demos<36>-Footnote-16404971
Ref: Tools/Demos<36>-Footnote-26405036
Ref: Tools/Demos<36>-Footnote-36405101
Ref: Tools/Demos<36>-Footnote-46405166
Node: Python 3 7 0 beta 36405231
Ref: whatsnew/changelog python-3-7-0-beta-36405355
Ref: 20626405355
Node: セキュリティ<46>6405798
Ref: whatsnew/changelog id8016405907
Ref: 20636405907
Ref: セキュリティ<46>-Footnote-16406553
Ref: セキュリティ<46>-Footnote-26406618
Ref: セキュリティ<46>-Footnote-36406673
Ref: セキュリティ<46>-Footnote-46406738
Ref: セキュリティ<46>-Footnote-56406803
Ref: セキュリティ<46>-Footnote-66406858
Node: Core and Builtins<170>6406913
Ref: whatsnew/changelog id8026407051
Ref: 20646407051
Ref: Core and Builtins<170>-Footnote-16408247
Ref: Core and Builtins<170>-Footnote-26408312
Ref: Core and Builtins<170>-Footnote-36408377
Ref: Core and Builtins<170>-Footnote-46408442
Ref: Core and Builtins<170>-Footnote-56408507
Ref: Core and Builtins<170>-Footnote-66408572
Ref: Core and Builtins<170>-Footnote-76408637
Node: ライブラリ<172>6408702
Ref: whatsnew/changelog id8036408840
Ref: 20656408840
Ref: ライブラリ<172>-Footnote-16412894
Ref: ライブラリ<172>-Footnote-26412959
Ref: ライブラリ<172>-Footnote-36413024
Ref: ライブラリ<172>-Footnote-46413089
Ref: ライブラリ<172>-Footnote-56413154
Ref: ライブラリ<172>-Footnote-66413219
Ref: ライブラリ<172>-Footnote-76413284
Ref: ライブラリ<172>-Footnote-86413349
Ref: ライブラリ<172>-Footnote-96413414
Ref: ライブラリ<172>-Footnote-106413479
Ref: ライブラリ<172>-Footnote-116413545
Ref: ライブラリ<172>-Footnote-126413611
Ref: ライブラリ<172>-Footnote-136413677
Ref: ライブラリ<172>-Footnote-146413743
Ref: ライブラリ<172>-Footnote-156413809
Ref: ライブラリ<172>-Footnote-166413875
Ref: ライブラリ<172>-Footnote-176413941
Ref: ライブラリ<172>-Footnote-186414007
Ref: ライブラリ<172>-Footnote-196414073
Ref: ライブラリ<172>-Footnote-206414139
Ref: ライブラリ<172>-Footnote-216414205
Ref: ライブラリ<172>-Footnote-226414271
Ref: ライブラリ<172>-Footnote-236414337
Ref: ライブラリ<172>-Footnote-246414403
Ref: ライブラリ<172>-Footnote-256414469
Ref: ライブラリ<172>-Footnote-266414535
Ref: ライブラリ<172>-Footnote-276414601
Node: ドキュメント<60>6414667
Ref: whatsnew/changelog id8046414796
Ref: 20666414796
Ref: ドキュメント<60>-Footnote-16415437
Ref: ドキュメント<60>-Footnote-26415502
Ref: ドキュメント<60>-Footnote-36415567
Ref: ドキュメント<60>-Footnote-46415632
Ref: ドキュメント<60>-Footnote-56415697
Node: テスト<62>6415762
Ref: whatsnew/changelog id8056415884
Ref: 20676415884
Ref: テスト<62>-Footnote-16416222
Ref: テスト<62>-Footnote-26416287
Ref: テスト<62>-Footnote-36416352
Node: ビルド<66>6416417
Ref: whatsnew/changelog id8066416528
Ref: 20686416528
Ref: ビルド<66>-Footnote-16416670
Node: Windows<58>6416735
Ref: whatsnew/changelog id8076416842
Ref: 20696416842
Ref: Windows<58>-Footnote-16417121
Ref: Windows<58>-Footnote-26417186
Node: macOS<46>6417251
Ref: whatsnew/changelog id8086417353
Ref: 206a6417353
Ref: macOS<46>-Footnote-16417785
Node: IDLE<42>6417850
Ref: whatsnew/changelog id8096417956
Ref: 206b6417956
Ref: IDLE<42>-Footnote-16418670
Ref: IDLE<42>-Footnote-26418735
Node: Tools/Demos<37>6418800
Ref: whatsnew/changelog id8106418906
Ref: 206c6418906
Ref: Tools/Demos<37>-Footnote-16419136
Node: C API<60>6419201
Ref: whatsnew/changelog id8116419290
Ref: 206d6419290
Ref: C API<60>-Footnote-16419674
Ref: C API<60>-Footnote-26419739
Node: Python 3 7 0 beta 26419804
Ref: whatsnew/changelog python-3-7-0-beta-26419928
Ref: 206e6419928
Node: セキュリティ<47>6420351
Ref: whatsnew/changelog id8126420460
Ref: 206f6420460
Ref: セキュリティ<47>-Footnote-16420659
Node: Core and Builtins<171>6420724
Ref: whatsnew/changelog id8136420862
Ref: 20706420862
Ref: Core and Builtins<171>-Footnote-16421693
Ref: Core and Builtins<171>-Footnote-26421758
Ref: Core and Builtins<171>-Footnote-36421823
Ref: Core and Builtins<171>-Footnote-46421888
Ref: Core and Builtins<171>-Footnote-56421953
Ref: Core and Builtins<171>-Footnote-66422018
Ref: Core and Builtins<171>-Footnote-76422083
Node: ライブラリ<173>6422148
Ref: whatsnew/changelog id8146422286
Ref: 20716422286
Ref: ライブラリ<173>-Footnote-16428693
Ref: ライブラリ<173>-Footnote-26428758
Ref: ライブラリ<173>-Footnote-36428823
Ref: ライブラリ<173>-Footnote-46428888
Ref: ライブラリ<173>-Footnote-56428953
Ref: ライブラリ<173>-Footnote-66429018
Ref: ライブラリ<173>-Footnote-76429083
Ref: ライブラリ<173>-Footnote-86429148
Ref: ライブラリ<173>-Footnote-96429213
Ref: ライブラリ<173>-Footnote-106429278
Ref: ライブラリ<173>-Footnote-116429344
Ref: ライブラリ<173>-Footnote-126429410
Ref: ライブラリ<173>-Footnote-136429476
Ref: ライブラリ<173>-Footnote-146429542
Ref: ライブラリ<173>-Footnote-156429608
Ref: ライブラリ<173>-Footnote-166429674
Ref: ライブラリ<173>-Footnote-176429740
Ref: ライブラリ<173>-Footnote-186429806
Ref: ライブラリ<173>-Footnote-196429872
Ref: ライブラリ<173>-Footnote-206429938
Ref: ライブラリ<173>-Footnote-216430004
Ref: ライブラリ<173>-Footnote-226430070
Ref: ライブラリ<173>-Footnote-236430136
Ref: ライブラリ<173>-Footnote-246430202
Ref: ライブラリ<173>-Footnote-256430268
Ref: ライブラリ<173>-Footnote-266430334
Ref: ライブラリ<173>-Footnote-276430400
Ref: ライブラリ<173>-Footnote-286430466
Ref: ライブラリ<173>-Footnote-296430532
Ref: ライブラリ<173>-Footnote-306430598
Ref: ライブラリ<173>-Footnote-316430664
Ref: ライブラリ<173>-Footnote-326430730
Ref: ライブラリ<173>-Footnote-336430796
Ref: ライブラリ<173>-Footnote-346430862
Node: ドキュメント<61>6430928
Ref: whatsnew/changelog id8156431057
Ref: 20726431057
Ref: ドキュメント<61>-Footnote-16432012
Ref: ドキュメント<61>-Footnote-26432077
Ref: ドキュメント<61>-Footnote-36432142
Ref: ドキュメント<61>-Footnote-46432207
Ref: ドキュメント<61>-Footnote-56432272
Ref: ドキュメント<61>-Footnote-66432337
Ref: ドキュメント<61>-Footnote-76432401
Ref: ドキュメント<61>-Footnote-86432466
Node: テスト<63>6432531
Ref: whatsnew/changelog id8166432653
Ref: 20736432653
Ref: テスト<63>-Footnote-16432801
Node: ビルド<67>6432866
Ref: whatsnew/changelog id8176432977
Ref: 20746432977
Ref: ビルド<67>-Footnote-16433123
Node: Windows<59>6433188
Ref: whatsnew/changelog id8186433295
Ref: 20756433295
Ref: Windows<59>-Footnote-16434031
Ref: Windows<59>-Footnote-26434096
Ref: Windows<59>-Footnote-36434161
Ref: Windows<59>-Footnote-46434226
Ref: Windows<59>-Footnote-56434291
Ref: Windows<59>-Footnote-66434356
Node: macOS<47>6434421
Ref: whatsnew/changelog id8196434523
Ref: 20766434523
Ref: macOS<47>-Footnote-16434658
Node: IDLE<43>6434723
Ref: whatsnew/changelog id8206434829
Ref: 20776434829
Ref: IDLE<43>-Footnote-16435664
Ref: IDLE<43>-Footnote-26435729
Ref: IDLE<43>-Footnote-36435794
Ref: IDLE<43>-Footnote-46435859
Ref: IDLE<43>-Footnote-56435924
Ref: IDLE<43>-Footnote-66435989
Node: Tools/Demos<38>6436054
Ref: whatsnew/changelog id8216436142
Ref: 20786436142
Ref: Tools/Demos<38>-Footnote-16436361
Node: Python 3 7 0 beta 16436426
Ref: whatsnew/changelog python-3-7-0-beta-16436551
Ref: 20796436551
Node: Core and Builtins<172>6436898
Ref: whatsnew/changelog id8226437005
Ref: 207a6437005
Ref: Core and Builtins<172>-Footnote-16440419
Ref: Core and Builtins<172>-Footnote-26440484
Ref: Core and Builtins<172>-Footnote-36440549
Ref: Core and Builtins<172>-Footnote-46440614
Ref: Core and Builtins<172>-Footnote-56440679
Ref: Core and Builtins<172>-Footnote-66440744
Ref: Core and Builtins<172>-Footnote-76440809
Ref: Core and Builtins<172>-Footnote-86440874
Ref: Core and Builtins<172>-Footnote-96440939
Ref: Core and Builtins<172>-Footnote-106440981
Ref: Core and Builtins<172>-Footnote-116441047
Ref: Core and Builtins<172>-Footnote-126441113
Ref: Core and Builtins<172>-Footnote-136441179
Ref: Core and Builtins<172>-Footnote-146441245
Ref: Core and Builtins<172>-Footnote-156441311
Ref: Core and Builtins<172>-Footnote-166441377
Ref: Core and Builtins<172>-Footnote-176441443
Ref: Core and Builtins<172>-Footnote-186441509
Ref: Core and Builtins<172>-Footnote-196441552
Ref: Core and Builtins<172>-Footnote-206441618
Ref: Core and Builtins<172>-Footnote-216441684
Ref: Core and Builtins<172>-Footnote-226441750
Ref: Core and Builtins<172>-Footnote-236441816
Node: ライブラリ<174>6441882
Ref: whatsnew/changelog id8236442020
Ref: 207b6442020
Ref: ライブラリ<174>-Footnote-16449380
Ref: ライブラリ<174>-Footnote-26449445
Ref: ライブラリ<174>-Footnote-36449510
Ref: ライブラリ<174>-Footnote-46449575
Ref: ライブラリ<174>-Footnote-56449640
Ref: ライブラリ<174>-Footnote-66449705
Ref: ライブラリ<174>-Footnote-76449770
Ref: ライブラリ<174>-Footnote-86449835
Ref: ライブラリ<174>-Footnote-96449900
Ref: ライブラリ<174>-Footnote-106449965
Ref: ライブラリ<174>-Footnote-116450031
Ref: ライブラリ<174>-Footnote-126450097
Ref: ライブラリ<174>-Footnote-136450163
Ref: ライブラリ<174>-Footnote-146450229
Ref: ライブラリ<174>-Footnote-156450295
Ref: ライブラリ<174>-Footnote-166450361
Ref: ライブラリ<174>-Footnote-176450427
Ref: ライブラリ<174>-Footnote-186450493
Ref: ライブラリ<174>-Footnote-196450536
Ref: ライブラリ<174>-Footnote-206450602
Ref: ライブラリ<174>-Footnote-216450668
Ref: ライブラリ<174>-Footnote-226450734
Ref: ライブラリ<174>-Footnote-236450800
Ref: ライブラリ<174>-Footnote-246450866
Ref: ライブラリ<174>-Footnote-256450932
Ref: ライブラリ<174>-Footnote-266450998
Ref: ライブラリ<174>-Footnote-276451064
Ref: ライブラリ<174>-Footnote-286451130
Ref: ライブラリ<174>-Footnote-296451196
Ref: ライブラリ<174>-Footnote-306451262
Ref: ライブラリ<174>-Footnote-316451328
Ref: ライブラリ<174>-Footnote-326451394
Ref: ライブラリ<174>-Footnote-336451460
Ref: ライブラリ<174>-Footnote-346451526
Ref: ライブラリ<174>-Footnote-356451592
Ref: ライブラリ<174>-Footnote-366451658
Ref: ライブラリ<174>-Footnote-376451724
Ref: ライブラリ<174>-Footnote-386451790
Ref: ライブラリ<174>-Footnote-396451856
Ref: ライブラリ<174>-Footnote-406451922
Ref: ライブラリ<174>-Footnote-416451988
Ref: ライブラリ<174>-Footnote-426452054
Ref: ライブラリ<174>-Footnote-436452120
Ref: ライブラリ<174>-Footnote-446452186
Ref: ライブラリ<174>-Footnote-456452252
Ref: ライブラリ<174>-Footnote-466452318
Ref: ライブラリ<174>-Footnote-476452384
Node: ドキュメント<62>6452450
Ref: whatsnew/changelog id8246452579
Ref: 207c6452579
Ref: ドキュメント<62>-Footnote-16453124
Ref: ドキュメント<62>-Footnote-26453189
Ref: ドキュメント<62>-Footnote-36453254
Node: テスト<64>6453319
Ref: whatsnew/changelog id8256453441
Ref: 207d6453441
Ref: テスト<64>-Footnote-16454354
Ref: テスト<64>-Footnote-26454419
Ref: テスト<64>-Footnote-36454484
Ref: テスト<64>-Footnote-46454549
Ref: テスト<64>-Footnote-56454614
Ref: テスト<64>-Footnote-66454679
Node: ビルド<68>6454744
Ref: whatsnew/changelog id8266454855
Ref: 207e6454855
Ref: ビルド<68>-Footnote-16455463
Ref: ビルド<68>-Footnote-26455528
Ref: ビルド<68>-Footnote-36455593
Ref: ビルド<68>-Footnote-46455658
Node: Windows<60>6455723
Ref: whatsnew/changelog id8276455830
Ref: 207f6455830
Ref: Windows<60>-Footnote-16456211
Ref: Windows<60>-Footnote-26456276
Ref: Windows<60>-Footnote-36456341
Node: macOS<48>6456406
Ref: whatsnew/changelog id8286456509
Ref: 20806456509
Ref: macOS<48>-Footnote-16457031
Ref: macOS<48>-Footnote-26457096
Node: C API<61>6457161
Ref: whatsnew/changelog id8296457244
Ref: 20816457244
Ref: C API<61>-Footnote-16457562
Ref: C API<61>-Footnote-26457627
Node: Python 3 7 0 alpha 46457692
Ref: whatsnew/changelog python-3-7-0-alpha-46457818
Ref: 20826457818
Node: Core and Builtins<173>6458151
Ref: whatsnew/changelog id8306458259
Ref: 20836458259
Ref: Core and Builtins<173>-Footnote-16461760
Ref: Core and Builtins<173>-Footnote-26461825
Ref: Core and Builtins<173>-Footnote-36461890
Ref: Core and Builtins<173>-Footnote-46461955
Ref: Core and Builtins<173>-Footnote-56462020
Ref: Core and Builtins<173>-Footnote-66462085
Ref: Core and Builtins<173>-Footnote-76462150
Ref: Core and Builtins<173>-Footnote-86462215
Ref: Core and Builtins<173>-Footnote-96462280
Ref: Core and Builtins<173>-Footnote-106462345
Ref: Core and Builtins<173>-Footnote-116462411
Ref: Core and Builtins<173>-Footnote-126462477
Ref: Core and Builtins<173>-Footnote-136462543
Ref: Core and Builtins<173>-Footnote-146462609
Ref: Core and Builtins<173>-Footnote-156462675
Ref: Core and Builtins<173>-Footnote-166462741
Ref: Core and Builtins<173>-Footnote-176462807
Ref: Core and Builtins<173>-Footnote-186462873
Ref: Core and Builtins<173>-Footnote-196462939
Ref: Core and Builtins<173>-Footnote-206462982
Ref: Core and Builtins<173>-Footnote-216463048
Ref: Core and Builtins<173>-Footnote-226463091
Ref: Core and Builtins<173>-Footnote-236463157
Ref: Core and Builtins<173>-Footnote-246463200
Ref: Core and Builtins<173>-Footnote-256463266
Ref: Core and Builtins<173>-Footnote-266463332
Ref: Core and Builtins<173>-Footnote-276463375
Node: ライブラリ<175>6463441
Ref: whatsnew/changelog id8316463580
Ref: 20856463580
Ref: ライブラリ<175>-Footnote-16471570
Ref: ライブラリ<175>-Footnote-26471635
Ref: ライブラリ<175>-Footnote-36471700
Ref: ライブラリ<175>-Footnote-46471765
Ref: ライブラリ<175>-Footnote-56471830
Ref: ライブラリ<175>-Footnote-66471895
Ref: ライブラリ<175>-Footnote-76471960
Ref: ライブラリ<175>-Footnote-86472025
Ref: ライブラリ<175>-Footnote-96472090
Ref: ライブラリ<175>-Footnote-106472155
Ref: ライブラリ<175>-Footnote-116472221
Ref: ライブラリ<175>-Footnote-126472287
Ref: ライブラリ<175>-Footnote-136472353
Ref: ライブラリ<175>-Footnote-146472419
Ref: ライブラリ<175>-Footnote-156472485
Ref: ライブラリ<175>-Footnote-166472551
Ref: ライブラリ<175>-Footnote-176472617
Ref: ライブラリ<175>-Footnote-186472683
Ref: ライブラリ<175>-Footnote-196472749
Ref: ライブラリ<175>-Footnote-206472815
Ref: ライブラリ<175>-Footnote-216472881
Ref: ライブラリ<175>-Footnote-226472947
Ref: ライブラリ<175>-Footnote-236473013
Ref: ライブラリ<175>-Footnote-246473079
Ref: ライブラリ<175>-Footnote-256473145
Ref: ライブラリ<175>-Footnote-266473211
Ref: ライブラリ<175>-Footnote-276473277
Ref: ライブラリ<175>-Footnote-286473343
Ref: ライブラリ<175>-Footnote-296473409
Ref: ライブラリ<175>-Footnote-306473475
Ref: ライブラリ<175>-Footnote-316473541
Ref: ライブラリ<175>-Footnote-326473607
Ref: ライブラリ<175>-Footnote-336473673
Ref: ライブラリ<175>-Footnote-346473739
Ref: ライブラリ<175>-Footnote-356473805
Ref: ライブラリ<175>-Footnote-366473871
Ref: ライブラリ<175>-Footnote-376473937
Ref: ライブラリ<175>-Footnote-386474003
Ref: ライブラリ<175>-Footnote-396474069
Ref: ライブラリ<175>-Footnote-406474135
Ref: ライブラリ<175>-Footnote-416474201
Ref: ライブラリ<175>-Footnote-426474267
Ref: ライブラリ<175>-Footnote-436474333
Ref: ライブラリ<175>-Footnote-446474399
Ref: ライブラリ<175>-Footnote-456474465
Ref: ライブラリ<175>-Footnote-466474531
Ref: ライブラリ<175>-Footnote-476474597
Ref: ライブラリ<175>-Footnote-486474663
Ref: ライブラリ<175>-Footnote-496474729
Ref: ライブラリ<175>-Footnote-506474795
Ref: ライブラリ<175>-Footnote-516474861
Ref: ライブラリ<175>-Footnote-526474927
Ref: ライブラリ<175>-Footnote-536474993
Ref: ライブラリ<175>-Footnote-546475059
Node: ドキュメント<63>6475125
Ref: whatsnew/changelog id8326475255
Ref: 20866475255
Ref: ドキュメント<63>-Footnote-16475429
Node: テスト<65>6475494
Ref: whatsnew/changelog id8336475615
Ref: 20876475615
Ref: テスト<65>-Footnote-16476015
Ref: テスト<65>-Footnote-26476080
Node: Windows<61>6476145
Ref: whatsnew/changelog id8346476259
Ref: 20886476259
Ref: Windows<61>-Footnote-16476458
Node: Tools/Demos<39>6476523
Ref: whatsnew/changelog id8356476633
Ref: 20896476633
Ref: Tools/Demos<39>-Footnote-16476915
Node: C API<62>6476980
Ref: whatsnew/changelog id8366477070
Ref: 208a6477070
Ref: C API<62>-Footnote-16477712
Ref: C API<62>-Footnote-26477777
Ref: C API<62>-Footnote-36477842
Ref: C API<62>-Footnote-46477907
Node: Python 3 7 0 alpha 36477972
Ref: whatsnew/changelog python-3-7-0-alpha-36478099
Ref: 208b6478099
Node: Core and Builtins<174>6478498
Ref: whatsnew/changelog id8376478606
Ref: 208c6478606
Ref: Core and Builtins<174>-Footnote-16483727
Ref: Core and Builtins<174>-Footnote-26483792
Ref: Core and Builtins<174>-Footnote-36483857
Ref: Core and Builtins<174>-Footnote-46483922
Ref: Core and Builtins<174>-Footnote-56483987
Ref: Core and Builtins<174>-Footnote-66484052
Ref: Core and Builtins<174>-Footnote-76484117
Ref: Core and Builtins<174>-Footnote-86484182
Ref: Core and Builtins<174>-Footnote-96484247
Ref: Core and Builtins<174>-Footnote-106484312
Ref: Core and Builtins<174>-Footnote-116484378
Ref: Core and Builtins<174>-Footnote-126484444
Ref: Core and Builtins<174>-Footnote-136484510
Ref: Core and Builtins<174>-Footnote-146484576
Ref: Core and Builtins<174>-Footnote-156484642
Ref: Core and Builtins<174>-Footnote-166484708
Ref: Core and Builtins<174>-Footnote-176484774
Ref: Core and Builtins<174>-Footnote-186484840
Ref: Core and Builtins<174>-Footnote-196484906
Ref: Core and Builtins<174>-Footnote-206484972
Ref: Core and Builtins<174>-Footnote-216485038
Ref: Core and Builtins<174>-Footnote-226485104
Node: ライブラリ<176>6485170
Ref: whatsnew/changelog id8386485309
Ref: 208d6485309
Ref: ライブラリ<176>-Footnote-16501330
Ref: ライブラリ<176>-Footnote-26501395
Ref: ライブラリ<176>-Footnote-36501460
Ref: ライブラリ<176>-Footnote-46501525
Ref: ライブラリ<176>-Footnote-56501590
Ref: ライブラリ<176>-Footnote-66501655
Ref: ライブラリ<176>-Footnote-76501720
Ref: ライブラリ<176>-Footnote-86501785
Ref: ライブラリ<176>-Footnote-96501850
Ref: ライブラリ<176>-Footnote-106501915
Ref: ライブラリ<176>-Footnote-116501981
Ref: ライブラリ<176>-Footnote-126502047
Ref: ライブラリ<176>-Footnote-136502113
Ref: ライブラリ<176>-Footnote-146502179
Ref: ライブラリ<176>-Footnote-156502245
Ref: ライブラリ<176>-Footnote-166502311
Ref: ライブラリ<176>-Footnote-176502377
Ref: ライブラリ<176>-Footnote-186502443
Ref: ライブラリ<176>-Footnote-196502509
Ref: ライブラリ<176>-Footnote-206502575
Ref: ライブラリ<176>-Footnote-216502641
Ref: ライブラリ<176>-Footnote-226502707
Ref: ライブラリ<176>-Footnote-236502773
Ref: ライブラリ<176>-Footnote-246502839
Ref: ライブラリ<176>-Footnote-256502905
Ref: ライブラリ<176>-Footnote-266502973
Ref: ライブラリ<176>-Footnote-276503039
Ref: ライブラリ<176>-Footnote-286503105
Ref: ライブラリ<176>-Footnote-296503171
Ref: ライブラリ<176>-Footnote-306503237
Ref: ライブラリ<176>-Footnote-316503303
Ref: ライブラリ<176>-Footnote-326503369
Ref: ライブラリ<176>-Footnote-336503412
Ref: ライブラリ<176>-Footnote-346503478
Ref: ライブラリ<176>-Footnote-356503544
Ref: ライブラリ<176>-Footnote-366503610
Ref: ライブラリ<176>-Footnote-376503676
Ref: ライブラリ<176>-Footnote-386503742
Ref: ライブラリ<176>-Footnote-396503808
Ref: ライブラリ<176>-Footnote-406503874
Ref: ライブラリ<176>-Footnote-416503940
Ref: ライブラリ<176>-Footnote-426504006
Ref: ライブラリ<176>-Footnote-436504072
Ref: ライブラリ<176>-Footnote-446504138
Ref: ライブラリ<176>-Footnote-456504204
Ref: ライブラリ<176>-Footnote-466504270
Ref: ライブラリ<176>-Footnote-476504335
Ref: ライブラリ<176>-Footnote-486504401
Ref: ライブラリ<176>-Footnote-496504467
Ref: ライブラリ<176>-Footnote-506504533
Ref: ライブラリ<176>-Footnote-516504599
Ref: ライブラリ<176>-Footnote-526504665
Ref: ライブラリ<176>-Footnote-536504731
Ref: ライブラリ<176>-Footnote-546504797
Ref: ライブラリ<176>-Footnote-556504863
Ref: ライブラリ<176>-Footnote-566504929
Ref: ライブラリ<176>-Footnote-576504995
Ref: ライブラリ<176>-Footnote-586505061
Ref: ライブラリ<176>-Footnote-596505127
Ref: ライブラリ<176>-Footnote-606505193
Ref: ライブラリ<176>-Footnote-616505259
Ref: ライブラリ<176>-Footnote-626505325
Ref: ライブラリ<176>-Footnote-636505368
Ref: ライブラリ<176>-Footnote-646505434
Ref: ライブラリ<176>-Footnote-656505500
Ref: ライブラリ<176>-Footnote-666505566
Ref: ライブラリ<176>-Footnote-676505632
Ref: ライブラリ<176>-Footnote-686505698
Ref: ライブラリ<176>-Footnote-696505764
Ref: ライブラリ<176>-Footnote-706505830
Ref: ライブラリ<176>-Footnote-716505896
Ref: ライブラリ<176>-Footnote-726505962
Ref: ライブラリ<176>-Footnote-736506028
Ref: ライブラリ<176>-Footnote-746506094
Ref: ライブラリ<176>-Footnote-756506160
Ref: ライブラリ<176>-Footnote-766506226
Ref: ライブラリ<176>-Footnote-776506292
Ref: ライブラリ<176>-Footnote-786506358
Ref: ライブラリ<176>-Footnote-796506424
Ref: ライブラリ<176>-Footnote-806506490
Ref: ライブラリ<176>-Footnote-816506556
Ref: ライブラリ<176>-Footnote-826506622
Ref: ライブラリ<176>-Footnote-836506665
Ref: ライブラリ<176>-Footnote-846506731
Ref: ライブラリ<176>-Footnote-856506797
Ref: ライブラリ<176>-Footnote-866506863
Ref: ライブラリ<176>-Footnote-876506929
Ref: ライブラリ<176>-Footnote-886506995
Ref: ライブラリ<176>-Footnote-896507061
Ref: ライブラリ<176>-Footnote-906507127
Ref: ライブラリ<176>-Footnote-916507193
Ref: ライブラリ<176>-Footnote-926507259
Ref: ライブラリ<176>-Footnote-936507325
Ref: ライブラリ<176>-Footnote-946507391
Ref: ライブラリ<176>-Footnote-956507457
Ref: ライブラリ<176>-Footnote-966507523
Ref: ライブラリ<176>-Footnote-976507589
Ref: ライブラリ<176>-Footnote-986507655
Node: ドキュメント<64>6507721
Ref: whatsnew/changelog id8396507851
Ref: 20926507851
Ref: ドキュメント<64>-Footnote-16508038
Node: テスト<66>6508103
Ref: whatsnew/changelog id8406508226
Ref: 20936508226
Ref: テスト<66>-Footnote-16509437
Ref: テスト<66>-Footnote-26509502
Ref: テスト<66>-Footnote-36509567
Ref: テスト<66>-Footnote-46509632
Ref: テスト<66>-Footnote-56509697
Ref: テスト<66>-Footnote-66509762
Ref: テスト<66>-Footnote-76509827
Node: ビルド<69>6509892
Ref: whatsnew/changelog id8416510004
Ref: 20946510004
Ref: ビルド<69>-Footnote-16511223
Ref: ビルド<69>-Footnote-26511288
Ref: ビルド<69>-Footnote-36511353
Ref: ビルド<69>-Footnote-46511418
Ref: ビルド<69>-Footnote-56511483
Ref: ビルド<69>-Footnote-66511548
Ref: ビルド<69>-Footnote-76511613
Ref: ビルド<69>-Footnote-86511678
Ref: ビルド<69>-Footnote-96511743
Ref: ビルド<69>-Footnote-106511808
Ref: ビルド<69>-Footnote-116511874
Ref: ビルド<69>-Footnote-126511940
Node: Windows<62>6512006
Ref: whatsnew/changelog id8426512114
Ref: 20956512114
Ref: Windows<62>-Footnote-16512647
Ref: Windows<62>-Footnote-26512711
Ref: Windows<62>-Footnote-36512776
Ref: Windows<62>-Footnote-46512841
Node: macOS<49>6512906
Ref: whatsnew/changelog id8436513009
Ref: 20966513009
Ref: macOS<49>-Footnote-16513143
Node: IDLE<44>6513208
Ref: whatsnew/changelog id8446513315
Ref: 20976513315
Ref: IDLE<44>-Footnote-16515396
Ref: IDLE<44>-Footnote-26515461
Ref: IDLE<44>-Footnote-36515526
Ref: IDLE<44>-Footnote-46515591
Ref: IDLE<44>-Footnote-56515656
Ref: IDLE<44>-Footnote-66515721
Ref: IDLE<44>-Footnote-76515786
Ref: IDLE<44>-Footnote-86515851
Node: Tools/Demos<40>6515916
Ref: whatsnew/changelog id8456516023
Ref: 20986516023
Ref: Tools/Demos<40>-Footnote-16516553
Ref: Tools/Demos<40>-Footnote-26516618
Node: C API<63>6516683
Ref: whatsnew/changelog id8466516773
Ref: 20996516773
Ref: C API<63>-Footnote-16517899
Ref: C API<63>-Footnote-26517964
Ref: C API<63>-Footnote-36518029
Ref: C API<63>-Footnote-46518094
Ref: C API<63>-Footnote-56518159
Ref: C API<63>-Footnote-66518224
Node: Python 3 7 0 alpha 26518289
Ref: whatsnew/changelog python-3-7-0-alpha-26518416
Ref: 209a6518416
Node: Core and Builtins<175>6518711
Ref: whatsnew/changelog id8476518819
Ref: 209b6518819
Ref: Core and Builtins<175>-Footnote-16523000
Ref: Core and Builtins<175>-Footnote-26523065
Ref: Core and Builtins<175>-Footnote-36523130
Ref: Core and Builtins<175>-Footnote-46523195
Ref: Core and Builtins<175>-Footnote-56523260
Ref: Core and Builtins<175>-Footnote-66523325
Ref: Core and Builtins<175>-Footnote-76523390
Ref: Core and Builtins<175>-Footnote-86523455
Ref: Core and Builtins<175>-Footnote-96523520
Ref: Core and Builtins<175>-Footnote-106523585
Ref: Core and Builtins<175>-Footnote-116523651
Ref: Core and Builtins<175>-Footnote-126523717
Ref: Core and Builtins<175>-Footnote-136523783
Ref: Core and Builtins<175>-Footnote-146523849
Ref: Core and Builtins<175>-Footnote-156523915
Ref: Core and Builtins<175>-Footnote-166523981
Ref: Core and Builtins<175>-Footnote-176524047
Ref: Core and Builtins<175>-Footnote-186524113
Ref: Core and Builtins<175>-Footnote-196524179
Ref: Core and Builtins<175>-Footnote-206524245
Ref: Core and Builtins<175>-Footnote-216524288
Ref: Core and Builtins<175>-Footnote-226524354
Ref: Core and Builtins<175>-Footnote-236524420
Ref: Core and Builtins<175>-Footnote-246524486
Ref: Core and Builtins<175>-Footnote-256524552
Ref: Core and Builtins<175>-Footnote-266524618
Ref: Core and Builtins<175>-Footnote-276524684
Node: ライブラリ<177>6524727
Ref: whatsnew/changelog id8486524866
Ref: 209c6524866
Ref: ライブラリ<177>-Footnote-16528905
Ref: ライブラリ<177>-Footnote-26528970
Ref: ライブラリ<177>-Footnote-36529035
Ref: ライブラリ<177>-Footnote-46529100
Ref: ライブラリ<177>-Footnote-56529165
Ref: ライブラリ<177>-Footnote-66529230
Ref: ライブラリ<177>-Footnote-76529295
Ref: ライブラリ<177>-Footnote-86529360
Ref: ライブラリ<177>-Footnote-96529425
Ref: ライブラリ<177>-Footnote-106529490
Ref: ライブラリ<177>-Footnote-116529556
Ref: ライブラリ<177>-Footnote-126529622
Ref: ライブラリ<177>-Footnote-136529688
Ref: ライブラリ<177>-Footnote-146529754
Ref: ライブラリ<177>-Footnote-156529820
Ref: ライブラリ<177>-Footnote-166529886
Ref: ライブラリ<177>-Footnote-176529952
Ref: ライブラリ<177>-Footnote-186530018
Ref: ライブラリ<177>-Footnote-196530084
Ref: ライブラリ<177>-Footnote-206530150
Ref: ライブラリ<177>-Footnote-216530216
Ref: ライブラリ<177>-Footnote-226530282
Ref: ライブラリ<177>-Footnote-236530348
Ref: ライブラリ<177>-Footnote-246530414
Ref: ライブラリ<177>-Footnote-256530480
Ref: ライブラリ<177>-Footnote-266530546
Node: ドキュメント<65>6530612
Ref: whatsnew/changelog id8496530742
Ref: 209d6530742
Ref: ドキュメント<65>-Footnote-16531137
Ref: ドキュメント<65>-Footnote-26531202
Node: ビルド<70>6531267
Ref: whatsnew/changelog id8506531385
Ref: 209e6531385
Ref: ビルド<70>-Footnote-16532013
Ref: ビルド<70>-Footnote-26532078
Ref: ビルド<70>-Footnote-36532143
Ref: ビルド<70>-Footnote-46532208
Ref: ビルド<70>-Footnote-56532273
Ref: ビルド<70>-Footnote-66532338
Node: IDLE<45>6532403
Ref: whatsnew/changelog id8516532508
Ref: 209f6532508
Ref: IDLE<45>-Footnote-16533810
Ref: IDLE<45>-Footnote-26533875
Ref: IDLE<45>-Footnote-36533940
Ref: IDLE<45>-Footnote-46534005
Ref: IDLE<45>-Footnote-56534070
Ref: IDLE<45>-Footnote-66534135
Node: C API<64>6534202
Ref: whatsnew/changelog id8526534285
Ref: 20a06534285
Ref: C API<64>-Footnote-16535009
Ref: C API<64>-Footnote-26535074
Ref: C API<64>-Footnote-36535139
Ref: C API<64>-Footnote-46535204
Node: Python 3 7 0 alpha 16535246
Ref: whatsnew/changelog python-3-7-0-alpha-16535371
Ref: 20a16535371
Node: セキュリティ<48>6535796
Ref: whatsnew/changelog id8536535906
Ref: 20a26535906
Ref: セキュリティ<48>-Footnote-16537570
Ref: セキュリティ<48>-Footnote-26537635
Ref: セキュリティ<48>-Footnote-36537700
Ref: セキュリティ<48>-Footnote-46537765
Ref: セキュリティ<48>-Footnote-56537830
Ref: セキュリティ<48>-Footnote-66537895
Ref: セキュリティ<48>-Footnote-76537950
Ref: セキュリティ<48>-Footnote-86538005
Ref: セキュリティ<48>-Footnote-96538060
Ref: セキュリティ<48>-Footnote-106538115
Ref: セキュリティ<48>-Footnote-116538171
Ref: セキュリティ<48>-Footnote-126538227
Ref: セキュリティ<48>-Footnote-136538293
Ref: セキュリティ<48>-Footnote-146538359
Ref: セキュリティ<48>-Footnote-156538415
Node: Core and Builtins<176>6538471
Ref: whatsnew/changelog id8546538610
Ref: 20a36538610
Ref: Core and Builtins<176>-Footnote-16559414
Ref: Core and Builtins<176>-Footnote-26559479
Ref: Core and Builtins<176>-Footnote-36559544
Ref: Core and Builtins<176>-Footnote-46559609
Ref: Core and Builtins<176>-Footnote-56559674
Ref: Core and Builtins<176>-Footnote-66559739
Ref: Core and Builtins<176>-Footnote-76559804
Ref: Core and Builtins<176>-Footnote-86559869
Ref: Core and Builtins<176>-Footnote-96559934
Ref: Core and Builtins<176>-Footnote-106559999
Ref: Core and Builtins<176>-Footnote-116560065
Ref: Core and Builtins<176>-Footnote-126560131
Ref: Core and Builtins<176>-Footnote-136560197
Ref: Core and Builtins<176>-Footnote-146560263
Ref: Core and Builtins<176>-Footnote-156560329
Ref: Core and Builtins<176>-Footnote-166560395
Ref: Core and Builtins<176>-Footnote-176560461
Ref: Core and Builtins<176>-Footnote-186560527
Ref: Core and Builtins<176>-Footnote-196560593
Ref: Core and Builtins<176>-Footnote-206560659
Ref: Core and Builtins<176>-Footnote-216560725
Ref: Core and Builtins<176>-Footnote-226560791
Ref: Core and Builtins<176>-Footnote-236560857
Ref: Core and Builtins<176>-Footnote-246560923
Ref: Core and Builtins<176>-Footnote-256560989
Ref: Core and Builtins<176>-Footnote-266561055
Ref: Core and Builtins<176>-Footnote-276561121
Ref: Core and Builtins<176>-Footnote-286561187
Ref: Core and Builtins<176>-Footnote-296561253
Ref: Core and Builtins<176>-Footnote-306561319
Ref: Core and Builtins<176>-Footnote-316561385
Ref: Core and Builtins<176>-Footnote-326561451
Ref: Core and Builtins<176>-Footnote-336561517
Ref: Core and Builtins<176>-Footnote-346561583
Ref: Core and Builtins<176>-Footnote-356561649
Ref: Core and Builtins<176>-Footnote-366561692
Ref: Core and Builtins<176>-Footnote-376561758
Ref: Core and Builtins<176>-Footnote-386561824
Ref: Core and Builtins<176>-Footnote-396561890
Ref: Core and Builtins<176>-Footnote-406561956
Ref: Core and Builtins<176>-Footnote-416562022
Ref: Core and Builtins<176>-Footnote-426562088
Ref: Core and Builtins<176>-Footnote-436562154
Ref: Core and Builtins<176>-Footnote-446562220
Ref: Core and Builtins<176>-Footnote-456562286
Ref: Core and Builtins<176>-Footnote-466562352
Ref: Core and Builtins<176>-Footnote-476562418
Ref: Core and Builtins<176>-Footnote-486562484
Ref: Core and Builtins<176>-Footnote-496562550
Ref: Core and Builtins<176>-Footnote-506562616
Ref: Core and Builtins<176>-Footnote-516562682
Ref: Core and Builtins<176>-Footnote-526562748
Ref: Core and Builtins<176>-Footnote-536562814
Ref: Core and Builtins<176>-Footnote-546562880
Ref: Core and Builtins<176>-Footnote-556562946
Ref: Core and Builtins<176>-Footnote-566563012
Ref: Core and Builtins<176>-Footnote-576563078
Ref: Core and Builtins<176>-Footnote-586563144
Ref: Core and Builtins<176>-Footnote-596563210
Ref: Core and Builtins<176>-Footnote-606563276
Ref: Core and Builtins<176>-Footnote-616563342
Ref: Core and Builtins<176>-Footnote-626563408
Ref: Core and Builtins<176>-Footnote-636563474
Ref: Core and Builtins<176>-Footnote-646563540
Ref: Core and Builtins<176>-Footnote-656563606
Ref: Core and Builtins<176>-Footnote-666563672
Ref: Core and Builtins<176>-Footnote-676563738
Ref: Core and Builtins<176>-Footnote-686563804
Ref: Core and Builtins<176>-Footnote-696563870
Ref: Core and Builtins<176>-Footnote-706563936
Ref: Core and Builtins<176>-Footnote-716564002
Ref: Core and Builtins<176>-Footnote-726564068
Ref: Core and Builtins<176>-Footnote-736564134
Ref: Core and Builtins<176>-Footnote-746564200
Ref: Core and Builtins<176>-Footnote-756564266
Ref: Core and Builtins<176>-Footnote-766564332
Ref: Core and Builtins<176>-Footnote-776564398
Ref: Core and Builtins<176>-Footnote-786564464
Ref: Core and Builtins<176>-Footnote-796564530
Ref: Core and Builtins<176>-Footnote-806564596
Ref: Core and Builtins<176>-Footnote-816564662
Ref: Core and Builtins<176>-Footnote-826564728
Ref: Core and Builtins<176>-Footnote-836564794
Ref: Core and Builtins<176>-Footnote-846564860
Ref: Core and Builtins<176>-Footnote-856564926
Ref: Core and Builtins<176>-Footnote-866564992
Ref: Core and Builtins<176>-Footnote-876565058
Ref: Core and Builtins<176>-Footnote-886565124
Ref: Core and Builtins<176>-Footnote-896565190
Ref: Core and Builtins<176>-Footnote-906565256
Ref: Core and Builtins<176>-Footnote-916565299
Ref: Core and Builtins<176>-Footnote-926565365
Ref: Core and Builtins<176>-Footnote-936565431
Ref: Core and Builtins<176>-Footnote-946565497
Ref: Core and Builtins<176>-Footnote-956565563
Ref: Core and Builtins<176>-Footnote-966565629
Ref: Core and Builtins<176>-Footnote-976565695
Ref: Core and Builtins<176>-Footnote-986565761
Ref: Core and Builtins<176>-Footnote-996565827
Ref: Core and Builtins<176>-Footnote-1006565893
Ref: Core and Builtins<176>-Footnote-1016565960
Ref: Core and Builtins<176>-Footnote-1026566027
Ref: Core and Builtins<176>-Footnote-1036566094
Ref: Core and Builtins<176>-Footnote-1046566161
Ref: Core and Builtins<176>-Footnote-1056566228
Ref: Core and Builtins<176>-Footnote-1066566295
Ref: Core and Builtins<176>-Footnote-1076566362
Ref: Core and Builtins<176>-Footnote-1086566429
Ref: Core and Builtins<176>-Footnote-1096566496
Ref: Core and Builtins<176>-Footnote-1106566563
Ref: Core and Builtins<176>-Footnote-1116566630
Ref: Core and Builtins<176>-Footnote-1126566697
Ref: Core and Builtins<176>-Footnote-1136566764
Ref: Core and Builtins<176>-Footnote-1146566831
Ref: Core and Builtins<176>-Footnote-1156566898
Ref: Core and Builtins<176>-Footnote-1166566965
Ref: Core and Builtins<176>-Footnote-1176567032
Ref: Core and Builtins<176>-Footnote-1186567099
Ref: Core and Builtins<176>-Footnote-1196567166
Ref: Core and Builtins<176>-Footnote-1206567233
Ref: Core and Builtins<176>-Footnote-1216567300
Ref: Core and Builtins<176>-Footnote-1226567367
Ref: Core and Builtins<176>-Footnote-1236567434
Ref: Core and Builtins<176>-Footnote-1246567501
Ref: Core and Builtins<176>-Footnote-1256567568
Ref: Core and Builtins<176>-Footnote-1266567635
Ref: Core and Builtins<176>-Footnote-1276567702
Ref: Core and Builtins<176>-Footnote-1286567769
Ref: Core and Builtins<176>-Footnote-1296567836
Ref: Core and Builtins<176>-Footnote-1306567903
Ref: Core and Builtins<176>-Footnote-1316567970
Ref: Core and Builtins<176>-Footnote-1326568037
Ref: Core and Builtins<176>-Footnote-1336568104
Ref: Core and Builtins<176>-Footnote-1346568171
Ref: Core and Builtins<176>-Footnote-1356568238
Ref: Core and Builtins<176>-Footnote-1366568305
Ref: Core and Builtins<176>-Footnote-1376568372
Ref: Core and Builtins<176>-Footnote-1386568439
Ref: Core and Builtins<176>-Footnote-1396568506
Ref: Core and Builtins<176>-Footnote-1406568573
Ref: Core and Builtins<176>-Footnote-1416568640
Ref: Core and Builtins<176>-Footnote-1426568707
Ref: Core and Builtins<176>-Footnote-1436568774
Ref: Core and Builtins<176>-Footnote-1446568841
Ref: Core and Builtins<176>-Footnote-1456568908
Ref: Core and Builtins<176>-Footnote-1466568975
Ref: Core and Builtins<176>-Footnote-1476569042
Ref: Core and Builtins<176>-Footnote-1486569109
Node: ライブラリ<178>6569176
Ref: whatsnew/changelog id8556569315
Ref: 20a46569315
Ref: ライブラリ<178>-Footnote-16615824
Ref: ライブラリ<178>-Footnote-26615889
Ref: ライブラリ<178>-Footnote-36615954
Ref: ライブラリ<178>-Footnote-46616019
Ref: ライブラリ<178>-Footnote-56616084
Ref: ライブラリ<178>-Footnote-66616149
Ref: ライブラリ<178>-Footnote-76616214
Ref: ライブラリ<178>-Footnote-86616279
Ref: ライブラリ<178>-Footnote-96616344
Ref: ライブラリ<178>-Footnote-106616409
Ref: ライブラリ<178>-Footnote-116616475
Ref: ライブラリ<178>-Footnote-126616541
Ref: ライブラリ<178>-Footnote-136616607
Ref: ライブラリ<178>-Footnote-146616673
Ref: ライブラリ<178>-Footnote-156616739
Ref: ライブラリ<178>-Footnote-166616805
Ref: ライブラリ<178>-Footnote-176616871
Ref: ライブラリ<178>-Footnote-186616937
Ref: ライブラリ<178>-Footnote-196617003
Ref: ライブラリ<178>-Footnote-206617069
Ref: ライブラリ<178>-Footnote-216617135
Ref: ライブラリ<178>-Footnote-226617203
Ref: ライブラリ<178>-Footnote-236617269
Ref: ライブラリ<178>-Footnote-246617335
Ref: ライブラリ<178>-Footnote-256617401
Ref: ライブラリ<178>-Footnote-266617467
Ref: ライブラリ<178>-Footnote-276617510
Ref: ライブラリ<178>-Footnote-286617576
Ref: ライブラリ<178>-Footnote-296617642
Ref: ライブラリ<178>-Footnote-306617708
Ref: ライブラリ<178>-Footnote-316617774
Ref: ライブラリ<178>-Footnote-326617840
Ref: ライブラリ<178>-Footnote-336617906
Ref: ライブラリ<178>-Footnote-346617972
Ref: ライブラリ<178>-Footnote-356618037
Ref: ライブラリ<178>-Footnote-366618103
Ref: ライブラリ<178>-Footnote-376618169
Ref: ライブラリ<178>-Footnote-386618235
Ref: ライブラリ<178>-Footnote-396618301
Ref: ライブラリ<178>-Footnote-406618366
Ref: ライブラリ<178>-Footnote-416618432
Ref: ライブラリ<178>-Footnote-426618498
Ref: ライブラリ<178>-Footnote-436618564
Ref: ライブラリ<178>-Footnote-446618630
Ref: ライブラリ<178>-Footnote-456618696
Ref: ライブラリ<178>-Footnote-466618762
Ref: ライブラリ<178>-Footnote-476618828
Ref: ライブラリ<178>-Footnote-486618894
Ref: ライブラリ<178>-Footnote-496618960
Ref: ライブラリ<178>-Footnote-506619026
Ref: ライブラリ<178>-Footnote-516619092
Ref: ライブラリ<178>-Footnote-526619158
Ref: ライブラリ<178>-Footnote-536619223
Ref: ライブラリ<178>-Footnote-546619289
Ref: ライブラリ<178>-Footnote-556619355
Ref: ライブラリ<178>-Footnote-566619421
Ref: ライブラリ<178>-Footnote-576619487
Ref: ライブラリ<178>-Footnote-586619553
Ref: ライブラリ<178>-Footnote-596619619
Ref: ライブラリ<178>-Footnote-606619685
Ref: ライブラリ<178>-Footnote-616619751
Ref: ライブラリ<178>-Footnote-626619817
Ref: ライブラリ<178>-Footnote-636619883
Ref: ライブラリ<178>-Footnote-646619949
Ref: ライブラリ<178>-Footnote-656620015
Ref: ライブラリ<178>-Footnote-666620081
Ref: ライブラリ<178>-Footnote-676620147
Ref: ライブラリ<178>-Footnote-686620213
Ref: ライブラリ<178>-Footnote-696620279
Ref: ライブラリ<178>-Footnote-706620345
Ref: ライブラリ<178>-Footnote-716620411
Ref: ライブラリ<178>-Footnote-726620477
Ref: ライブラリ<178>-Footnote-736620542
Ref: ライブラリ<178>-Footnote-746620608
Ref: ライブラリ<178>-Footnote-756620674
Ref: ライブラリ<178>-Footnote-766620740
Ref: ライブラリ<178>-Footnote-776620806
Ref: ライブラリ<178>-Footnote-786620872
Ref: ライブラリ<178>-Footnote-796620938
Ref: ライブラリ<178>-Footnote-806621004
Ref: ライブラリ<178>-Footnote-816621070
Ref: ライブラリ<178>-Footnote-826621136
Ref: ライブラリ<178>-Footnote-836621202
Ref: ライブラリ<178>-Footnote-846621268
Ref: ライブラリ<178>-Footnote-856621334
Ref: ライブラリ<178>-Footnote-866621400
Ref: ライブラリ<178>-Footnote-876621466
Ref: ライブラリ<178>-Footnote-886621532
Ref: ライブラリ<178>-Footnote-896621598
Ref: ライブラリ<178>-Footnote-906621664
Ref: ライブラリ<178>-Footnote-916621730
Ref: ライブラリ<178>-Footnote-926621796
Ref: ライブラリ<178>-Footnote-936621862
Ref: ライブラリ<178>-Footnote-946621928
Ref: ライブラリ<178>-Footnote-956621994
Ref: ライブラリ<178>-Footnote-966622060
Ref: ライブラリ<178>-Footnote-976622126
Ref: ライブラリ<178>-Footnote-986622192
Ref: ライブラリ<178>-Footnote-996622258
Ref: ライブラリ<178>-Footnote-1006622324
Ref: ライブラリ<178>-Footnote-1016622391
Ref: ライブラリ<178>-Footnote-1026622458
Ref: ライブラリ<178>-Footnote-1036622525
Ref: ライブラリ<178>-Footnote-1046622592
Ref: ライブラリ<178>-Footnote-1056622659
Ref: ライブラリ<178>-Footnote-1066622726
Ref: ライブラリ<178>-Footnote-1076622793
Ref: ライブラリ<178>-Footnote-1086622860
Ref: ライブラリ<178>-Footnote-1096622927
Ref: ライブラリ<178>-Footnote-1106622994
Ref: ライブラリ<178>-Footnote-1116623061
Ref: ライブラリ<178>-Footnote-1126623128
Ref: ライブラリ<178>-Footnote-1136623195
Ref: ライブラリ<178>-Footnote-1146623262
Ref: ライブラリ<178>-Footnote-1156623329
Ref: ライブラリ<178>-Footnote-1166623396
Ref: ライブラリ<178>-Footnote-1176623462
Ref: ライブラリ<178>-Footnote-1186623529
Ref: ライブラリ<178>-Footnote-1196623596
Ref: ライブラリ<178>-Footnote-1206623663
Ref: ライブラリ<178>-Footnote-1216623730
Ref: ライブラリ<178>-Footnote-1226623797
Ref: ライブラリ<178>-Footnote-1236623864
Ref: ライブラリ<178>-Footnote-1246623931
Ref: ライブラリ<178>-Footnote-1256623998
Ref: ライブラリ<178>-Footnote-1266624065
Ref: ライブラリ<178>-Footnote-1276624132
Ref: ライブラリ<178>-Footnote-1286624199
Ref: ライブラリ<178>-Footnote-1296624266
Ref: ライブラリ<178>-Footnote-1306624333
Ref: ライブラリ<178>-Footnote-1316624400
Ref: ライブラリ<178>-Footnote-1326624467
Ref: ライブラリ<178>-Footnote-1336624534
Ref: ライブラリ<178>-Footnote-1346624601
Ref: ライブラリ<178>-Footnote-1356624668
Ref: ライブラリ<178>-Footnote-1366624735
Ref: ライブラリ<178>-Footnote-1376624802
Ref: ライブラリ<178>-Footnote-1386624869
Ref: ライブラリ<178>-Footnote-1396624936
Ref: ライブラリ<178>-Footnote-1406625003
Ref: ライブラリ<178>-Footnote-1416625070
Ref: ライブラリ<178>-Footnote-1426625137
Ref: ライブラリ<178>-Footnote-1436625204
Ref: ライブラリ<178>-Footnote-1446625271
Ref: ライブラリ<178>-Footnote-1456625338
Ref: ライブラリ<178>-Footnote-1466625405
Ref: ライブラリ<178>-Footnote-1476625471
Ref: ライブラリ<178>-Footnote-1486625538
Ref: ライブラリ<178>-Footnote-1496625605
Ref: ライブラリ<178>-Footnote-1506625672
Ref: ライブラリ<178>-Footnote-1516625739
Ref: ライブラリ<178>-Footnote-1526625806
Ref: ライブラリ<178>-Footnote-1536625873
Ref: ライブラリ<178>-Footnote-1546625940
Ref: ライブラリ<178>-Footnote-1556626007
Ref: ライブラリ<178>-Footnote-1566626074
Ref: ライブラリ<178>-Footnote-1576626141
Ref: ライブラリ<178>-Footnote-1586626208
Ref: ライブラリ<178>-Footnote-1596626275
Ref: ライブラリ<178>-Footnote-1606626342
Ref: ライブラリ<178>-Footnote-1616626409
Ref: ライブラリ<178>-Footnote-1626626476
Ref: ライブラリ<178>-Footnote-1636626543
Ref: ライブラリ<178>-Footnote-1646626610
Ref: ライブラリ<178>-Footnote-1656626677
Ref: ライブラリ<178>-Footnote-1666626744
Ref: ライブラリ<178>-Footnote-1676626811
Ref: ライブラリ<178>-Footnote-1686626878
Ref: ライブラリ<178>-Footnote-1696626945
Ref: ライブラリ<178>-Footnote-1706627011
Ref: ライブラリ<178>-Footnote-1716627078
Ref: ライブラリ<178>-Footnote-1726627145
Ref: ライブラリ<178>-Footnote-1736627212
Ref: ライブラリ<178>-Footnote-1746627279
Ref: ライブラリ<178>-Footnote-1756627346
Ref: ライブラリ<178>-Footnote-1766627413
Ref: ライブラリ<178>-Footnote-1776627480
Ref: ライブラリ<178>-Footnote-1786627547
Ref: ライブラリ<178>-Footnote-1796627614
Ref: ライブラリ<178>-Footnote-1806627681
Ref: ライブラリ<178>-Footnote-1816627747
Ref: ライブラリ<178>-Footnote-1826627814
Ref: ライブラリ<178>-Footnote-1836627881
Ref: ライブラリ<178>-Footnote-1846627948
Ref: ライブラリ<178>-Footnote-1856628015
Ref: ライブラリ<178>-Footnote-1866628082
Ref: ライブラリ<178>-Footnote-1876628148
Ref: ライブラリ<178>-Footnote-1886628215
Ref: ライブラリ<178>-Footnote-1896628282
Ref: ライブラリ<178>-Footnote-1906628349
Ref: ライブラリ<178>-Footnote-1916628416
Ref: ライブラリ<178>-Footnote-1926628483
Ref: ライブラリ<178>-Footnote-1936628550
Ref: ライブラリ<178>-Footnote-1946628617
Ref: ライブラリ<178>-Footnote-1956628684
Ref: ライブラリ<178>-Footnote-1966628751
Ref: ライブラリ<178>-Footnote-1976628818
Ref: ライブラリ<178>-Footnote-1986628885
Ref: ライブラリ<178>-Footnote-1996628952
Ref: ライブラリ<178>-Footnote-2006629019
Ref: ライブラリ<178>-Footnote-2016629086
Ref: ライブラリ<178>-Footnote-2026629153
Ref: ライブラリ<178>-Footnote-2036629220
Ref: ライブラリ<178>-Footnote-2046629287
Ref: ライブラリ<178>-Footnote-2056629354
Ref: ライブラリ<178>-Footnote-2066629421
Ref: ライブラリ<178>-Footnote-2076629488
Ref: ライブラリ<178>-Footnote-2086629555
Ref: ライブラリ<178>-Footnote-2096629622
Ref: ライブラリ<178>-Footnote-2106629689
Ref: ライブラリ<178>-Footnote-2116629756
Ref: ライブラリ<178>-Footnote-2126629823
Ref: ライブラリ<178>-Footnote-2136629890
Ref: ライブラリ<178>-Footnote-2146629957
Ref: ライブラリ<178>-Footnote-2156630024
Ref: ライブラリ<178>-Footnote-2166630091
Ref: ライブラリ<178>-Footnote-2176630158
Ref: ライブラリ<178>-Footnote-2186630225
Ref: ライブラリ<178>-Footnote-2196630292
Ref: ライブラリ<178>-Footnote-2206630359
Ref: ライブラリ<178>-Footnote-2216630426
Ref: ライブラリ<178>-Footnote-2226630493
Ref: ライブラリ<178>-Footnote-2236630560
Ref: ライブラリ<178>-Footnote-2246630627
Ref: ライブラリ<178>-Footnote-2256630693
Ref: ライブラリ<178>-Footnote-2266630760
Ref: ライブラリ<178>-Footnote-2276630827
Ref: ライブラリ<178>-Footnote-2286630894
Ref: ライブラリ<178>-Footnote-2296630961
Ref: ライブラリ<178>-Footnote-2306631028
Ref: ライブラリ<178>-Footnote-2316631095
Ref: ライブラリ<178>-Footnote-2326631162
Ref: ライブラリ<178>-Footnote-2336631229
Ref: ライブラリ<178>-Footnote-2346631296
Ref: ライブラリ<178>-Footnote-2356631363
Ref: ライブラリ<178>-Footnote-2366631430
Ref: ライブラリ<178>-Footnote-2376631497
Ref: ライブラリ<178>-Footnote-2386631564
Ref: ライブラリ<178>-Footnote-2396631631
Ref: ライブラリ<178>-Footnote-2406631698
Ref: ライブラリ<178>-Footnote-2416631765
Ref: ライブラリ<178>-Footnote-2426631832
Ref: ライブラリ<178>-Footnote-2436631899
Ref: ライブラリ<178>-Footnote-2446631966
Ref: ライブラリ<178>-Footnote-2456632033
Ref: ライブラリ<178>-Footnote-2466632100
Ref: ライブラリ<178>-Footnote-2476632167
Ref: ライブラリ<178>-Footnote-2486632234
Ref: ライブラリ<178>-Footnote-2496632301
Ref: ライブラリ<178>-Footnote-2506632368
Ref: ライブラリ<178>-Footnote-2516632435
Ref: ライブラリ<178>-Footnote-2526632502
Ref: ライブラリ<178>-Footnote-2536632569
Ref: ライブラリ<178>-Footnote-2546632636
Ref: ライブラリ<178>-Footnote-2556632703
Ref: ライブラリ<178>-Footnote-2566632770
Ref: ライブラリ<178>-Footnote-2576632837
Ref: ライブラリ<178>-Footnote-2586632904
Ref: ライブラリ<178>-Footnote-2596632971
Ref: ライブラリ<178>-Footnote-2606633038
Ref: ライブラリ<178>-Footnote-2616633105
Ref: ライブラリ<178>-Footnote-2626633172
Ref: ライブラリ<178>-Footnote-2636633239
Ref: ライブラリ<178>-Footnote-2646633306
Ref: ライブラリ<178>-Footnote-2656633373
Ref: ライブラリ<178>-Footnote-2666633440
Ref: ライブラリ<178>-Footnote-2676633507
Ref: ライブラリ<178>-Footnote-2686633574
Ref: ライブラリ<178>-Footnote-2696633641
Ref: ライブラリ<178>-Footnote-2706633708
Ref: ライブラリ<178>-Footnote-2716633775
Ref: ライブラリ<178>-Footnote-2726633842
Ref: ライブラリ<178>-Footnote-2736633898
Ref: ライブラリ<178>-Footnote-2746633965
Ref: ライブラリ<178>-Footnote-2756634032
Ref: ライブラリ<178>-Footnote-2766634099
Ref: ライブラリ<178>-Footnote-2776634166
Ref: ライブラリ<178>-Footnote-2786634233
Ref: ライブラリ<178>-Footnote-2796634300
Ref: ライブラリ<178>-Footnote-2806634367
Ref: ライブラリ<178>-Footnote-2816634434
Ref: ライブラリ<178>-Footnote-2826634501
Ref: ライブラリ<178>-Footnote-2836634568
Ref: ライブラリ<178>-Footnote-2846634635
Ref: ライブラリ<178>-Footnote-2856634702
Ref: ライブラリ<178>-Footnote-2866634769
Ref: ライブラリ<178>-Footnote-2876634836
Ref: ライブラリ<178>-Footnote-2886634903
Ref: ライブラリ<178>-Footnote-2896634970
Ref: ライブラリ<178>-Footnote-2906635037
Ref: ライブラリ<178>-Footnote-2916635104
Ref: ライブラリ<178>-Footnote-2926635171
Ref: ライブラリ<178>-Footnote-2936635238
Ref: ライブラリ<178>-Footnote-2946635305
Ref: ライブラリ<178>-Footnote-2956635372
Ref: ライブラリ<178>-Footnote-2966635439
Ref: ライブラリ<178>-Footnote-2976635506
Ref: ライブラリ<178>-Footnote-2986635573
Ref: ライブラリ<178>-Footnote-2996635640
Ref: ライブラリ<178>-Footnote-3006635707
Ref: ライブラリ<178>-Footnote-3016635774
Ref: ライブラリ<178>-Footnote-3026635841
Ref: ライブラリ<178>-Footnote-3036635908
Ref: ライブラリ<178>-Footnote-3046635975
Ref: ライブラリ<178>-Footnote-3056636042
Ref: ライブラリ<178>-Footnote-3066636109
Ref: ライブラリ<178>-Footnote-3076636176
Ref: ライブラリ<178>-Footnote-3086636243
Ref: ライブラリ<178>-Footnote-3096636310
Ref: ライブラリ<178>-Footnote-3106636377
Ref: ライブラリ<178>-Footnote-3116636444
Ref: ライブラリ<178>-Footnote-3126636511
Ref: ライブラリ<178>-Footnote-3136636578
Ref: ライブラリ<178>-Footnote-3146636645
Ref: ライブラリ<178>-Footnote-3156636712
Ref: ライブラリ<178>-Footnote-3166636779
Ref: ライブラリ<178>-Footnote-3176636846
Ref: ライブラリ<178>-Footnote-3186636913
Ref: ライブラリ<178>-Footnote-3196636980
Ref: ライブラリ<178>-Footnote-3206637047
Ref: ライブラリ<178>-Footnote-3216637114
Ref: ライブラリ<178>-Footnote-3226637181
Ref: ライブラリ<178>-Footnote-3236637248
Ref: ライブラリ<178>-Footnote-3246637315
Ref: ライブラリ<178>-Footnote-3256637382
Ref: ライブラリ<178>-Footnote-3266637449
Node: ドキュメント<66>6637516
Ref: whatsnew/changelog id8566637646
Ref: 20a56637646
Ref: ドキュメント<66>-Footnote-16639814
Ref: ドキュメント<66>-Footnote-26639879
Ref: ドキュメント<66>-Footnote-36639944
Ref: ドキュメント<66>-Footnote-46640009
Ref: ドキュメント<66>-Footnote-56640074
Ref: ドキュメント<66>-Footnote-66640139
Ref: ドキュメント<66>-Footnote-76640204
Ref: ドキュメント<66>-Footnote-86640269
Ref: ドキュメント<66>-Footnote-96640334
Ref: ドキュメント<66>-Footnote-106640399
Ref: ドキュメント<66>-Footnote-116640465
Ref: ドキュメント<66>-Footnote-126640531
Ref: ドキュメント<66>-Footnote-136640597
Ref: ドキュメント<66>-Footnote-146640663
Ref: ドキュメント<66>-Footnote-156640729
Ref: ドキュメント<66>-Footnote-166640795
Ref: ドキュメント<66>-Footnote-176640838
Node: テスト<67>6640904
Ref: whatsnew/changelog id8576641027
Ref: 20a86641027
Ref: テスト<67>-Footnote-16643778
Ref: テスト<67>-Footnote-26643843
Ref: テスト<67>-Footnote-36643908
Ref: テスト<67>-Footnote-46643973
Ref: テスト<67>-Footnote-56644038
Ref: テスト<67>-Footnote-66644103
Ref: テスト<67>-Footnote-76644168
Ref: テスト<67>-Footnote-86644233
Ref: テスト<67>-Footnote-96644298
Ref: テスト<67>-Footnote-106644363
Ref: テスト<67>-Footnote-116644429
Ref: テスト<67>-Footnote-126644495
Ref: テスト<67>-Footnote-136644561
Ref: テスト<67>-Footnote-146644627
Ref: テスト<67>-Footnote-156644693
Ref: テスト<67>-Footnote-166644759
Ref: テスト<67>-Footnote-176644825
Ref: テスト<67>-Footnote-186644891
Ref: テスト<67>-Footnote-196644957
Node: ビルド<71>6645023
Ref: whatsnew/changelog id8586645135
Ref: 20a96645135
Ref: ビルド<71>-Footnote-16649893
Ref: ビルド<71>-Footnote-26649958
Ref: ビルド<71>-Footnote-36650023
Ref: ビルド<71>-Footnote-46650088
Ref: ビルド<71>-Footnote-56650130
Ref: ビルド<71>-Footnote-66650195
Ref: ビルド<71>-Footnote-76650260
Ref: ビルド<71>-Footnote-86650325
Ref: ビルド<71>-Footnote-96650390
Ref: ビルド<71>-Footnote-106650455
Ref: ビルド<71>-Footnote-116650521
Ref: ビルド<71>-Footnote-126650587
Ref: ビルド<71>-Footnote-136650653
Ref: ビルド<71>-Footnote-146650719
Ref: ビルド<71>-Footnote-156650785
Ref: ビルド<71>-Footnote-166650851
Ref: ビルド<71>-Footnote-176650917
Ref: ビルド<71>-Footnote-186650983
Ref: ビルド<71>-Footnote-196651049
Ref: ビルド<71>-Footnote-206651115
Ref: ビルド<71>-Footnote-216651181
Ref: ビルド<71>-Footnote-226651247
Ref: ビルド<71>-Footnote-236651313
Ref: ビルド<71>-Footnote-246651379
Ref: ビルド<71>-Footnote-256651445
Ref: ビルド<71>-Footnote-266651511
Ref: ビルド<71>-Footnote-276651577
Ref: ビルド<71>-Footnote-286651643
Ref: ビルド<71>-Footnote-296651709
Ref: ビルド<71>-Footnote-306651775
Ref: ビルド<71>-Footnote-316651841
Ref: ビルド<71>-Footnote-326651907
Ref: ビルド<71>-Footnote-336651973
Ref: ビルド<71>-Footnote-346652039
Ref: ビルド<71>-Footnote-356652105
Ref: ビルド<71>-Footnote-366652171
Ref: ビルド<71>-Footnote-376652237
Node: Windows<63>6652303
Ref: whatsnew/changelog id8596652410
Ref: 20aa6652410
Ref: Windows<63>-Footnote-16654896
Ref: Windows<63>-Footnote-26654961
Ref: Windows<63>-Footnote-36655026
Ref: Windows<63>-Footnote-46655091
Ref: Windows<63>-Footnote-56655156
Ref: Windows<63>-Footnote-66655221
Ref: Windows<63>-Footnote-76655286
Ref: Windows<63>-Footnote-86655351
Ref: Windows<63>-Footnote-96655416
Ref: Windows<63>-Footnote-106655481
Ref: Windows<63>-Footnote-116655547
Ref: Windows<63>-Footnote-126655613
Ref: Windows<63>-Footnote-136655679
Ref: Windows<63>-Footnote-146655745
Ref: Windows<63>-Footnote-156655811
Ref: Windows<63>-Footnote-166655877
Ref: Windows<63>-Footnote-176655943
Ref: Windows<63>-Footnote-186656009
Ref: Windows<63>-Footnote-196656075
Ref: Windows<63>-Footnote-206656141
Ref: Windows<63>-Footnote-216656207
Ref: Windows<63>-Footnote-226656273
Ref: Windows<63>-Footnote-236656339
Ref: Windows<63>-Footnote-246656405
Ref: Windows<63>-Footnote-256656471
Node: IDLE<46>6656537
Ref: whatsnew/changelog id8606656646
Ref: 20ab6656646
Ref: IDLE<46>-Footnote-16666555
Ref: IDLE<46>-Footnote-26666620
Ref: IDLE<46>-Footnote-36666685
Ref: IDLE<46>-Footnote-46666750
Ref: IDLE<46>-Footnote-56666815
Ref: IDLE<46>-Footnote-66666880
Ref: IDLE<46>-Footnote-76666945
Ref: IDLE<46>-Footnote-86667010
Ref: IDLE<46>-Footnote-96667075
Ref: IDLE<46>-Footnote-106667140
Ref: IDLE<46>-Footnote-116667206
Ref: IDLE<46>-Footnote-126667272
Ref: IDLE<46>-Footnote-136667338
Ref: IDLE<46>-Footnote-146667404
Ref: IDLE<46>-Footnote-156667470
Ref: IDLE<46>-Footnote-166667536
Ref: IDLE<46>-Footnote-176667602
Ref: IDLE<46>-Footnote-186667668
Ref: IDLE<46>-Footnote-196667734
Ref: IDLE<46>-Footnote-206667800
Ref: IDLE<46>-Footnote-216667866
Ref: IDLE<46>-Footnote-226667932
Ref: IDLE<46>-Footnote-236667998
Ref: IDLE<46>-Footnote-246668064
Ref: IDLE<46>-Footnote-256668130
Ref: IDLE<46>-Footnote-266668196
Ref: IDLE<46>-Footnote-276668262
Ref: IDLE<46>-Footnote-286668328
Ref: IDLE<46>-Footnote-296668394
Ref: IDLE<46>-Footnote-306668460
Ref: IDLE<46>-Footnote-316668526
Ref: IDLE<46>-Footnote-326668592
Ref: IDLE<46>-Footnote-336668658
Ref: IDLE<46>-Footnote-346668724
Ref: IDLE<46>-Footnote-356668789
Ref: IDLE<46>-Footnote-366668855
Ref: IDLE<46>-Footnote-376668921
Ref: IDLE<46>-Footnote-386668987
Ref: IDLE<46>-Footnote-396669053
Ref: IDLE<46>-Footnote-406669119
Ref: IDLE<46>-Footnote-416669185
Ref: IDLE<46>-Footnote-426669251
Ref: IDLE<46>-Footnote-436669317
Ref: IDLE<46>-Footnote-446669382
Ref: IDLE<46>-Footnote-456669448
Ref: IDLE<46>-Footnote-466669514
Ref: IDLE<46>-Footnote-476669580
Ref: IDLE<46>-Footnote-486669646
Ref: IDLE<46>-Footnote-496669712
Ref: IDLE<46>-Footnote-506669778
Ref: IDLE<46>-Footnote-516669844
Node: Tools/Demos<41>6669910
Ref: whatsnew/changelog id8616670017
Ref: 20ac6670017
Ref: Tools/Demos<41>-Footnote-16671499
Ref: Tools/Demos<41>-Footnote-26671564
Ref: Tools/Demos<41>-Footnote-36671606
Ref: Tools/Demos<41>-Footnote-46671671
Ref: Tools/Demos<41>-Footnote-56671736
Ref: Tools/Demos<41>-Footnote-66671801
Ref: Tools/Demos<41>-Footnote-76671866
Ref: Tools/Demos<41>-Footnote-86671931
Node: C API<65>6671996
Ref: whatsnew/changelog id8626672086
Ref: 20ad6672086
Ref: C API<65>-Footnote-16675140
Ref: C API<65>-Footnote-26675205
Ref: C API<65>-Footnote-36675270
Ref: C API<65>-Footnote-46675335
Ref: C API<65>-Footnote-56675400
Ref: C API<65>-Footnote-66675464
Ref: C API<65>-Footnote-76675529
Ref: C API<65>-Footnote-86675594
Ref: C API<65>-Footnote-96675659
Ref: C API<65>-Footnote-106675724
Ref: C API<65>-Footnote-116675790
Ref: C API<65>-Footnote-126675856
Ref: C API<65>-Footnote-136675922
Ref: C API<65>-Footnote-146675988
Ref: C API<65>-Footnote-156676054
Node: Python 3 6 6 final6676120
Ref: whatsnew/changelog python-3-6-6-final6676257
Ref: 20ae6676257
Node: Python 3 6 6 release candidate 16676385
Ref: whatsnew/changelog python-3-6-6-release-candidate-16676520
Ref: 20af6676520
Node: Core and Builtins<177>6676943
Ref: whatsnew/changelog id8636677063
Ref: 20b06677063
Ref: Core and Builtins<177>-Footnote-16678641
Ref: Core and Builtins<177>-Footnote-26678706
Ref: Core and Builtins<177>-Footnote-36678771
Ref: Core and Builtins<177>-Footnote-46678836
Ref: Core and Builtins<177>-Footnote-56678901
Ref: Core and Builtins<177>-Footnote-66678966
Ref: Core and Builtins<177>-Footnote-76679031
Ref: Core and Builtins<177>-Footnote-86679096
Ref: Core and Builtins<177>-Footnote-96679161
Ref: Core and Builtins<177>-Footnote-106679226
Ref: Core and Builtins<177>-Footnote-116679292
Ref: Core and Builtins<177>-Footnote-126679358
Node: ライブラリ<179>6679424
Ref: whatsnew/changelog id8646679575
Ref: 20b16679575
Ref: ライブラリ<179>-Footnote-16685053
Ref: ライブラリ<179>-Footnote-26685118
Ref: ライブラリ<179>-Footnote-36685183
Ref: ライブラリ<179>-Footnote-46685248
Ref: ライブラリ<179>-Footnote-56685313
Ref: ライブラリ<179>-Footnote-66685378
Ref: ライブラリ<179>-Footnote-76685443
Ref: ライブラリ<179>-Footnote-86685508
Ref: ライブラリ<179>-Footnote-96685573
Ref: ライブラリ<179>-Footnote-106685638
Ref: ライブラリ<179>-Footnote-116685704
Ref: ライブラリ<179>-Footnote-126685770
Ref: ライブラリ<179>-Footnote-136685836
Ref: ライブラリ<179>-Footnote-146685902
Ref: ライブラリ<179>-Footnote-156685968
Ref: ライブラリ<179>-Footnote-166686034
Ref: ライブラリ<179>-Footnote-176686100
Ref: ライブラリ<179>-Footnote-186686166
Ref: ライブラリ<179>-Footnote-196686232
Ref: ライブラリ<179>-Footnote-206686298
Ref: ライブラリ<179>-Footnote-216686364
Ref: ライブラリ<179>-Footnote-226686431
Ref: ライブラリ<179>-Footnote-236686497
Ref: ライブラリ<179>-Footnote-246686563
Ref: ライブラリ<179>-Footnote-256686629
Ref: ライブラリ<179>-Footnote-266686695
Ref: ライブラリ<179>-Footnote-276686761
Ref: ライブラリ<179>-Footnote-286686827
Ref: ライブラリ<179>-Footnote-296686870
Ref: ライブラリ<179>-Footnote-306686936
Ref: ライブラリ<179>-Footnote-316687002
Ref: ライブラリ<179>-Footnote-326687068
Ref: ライブラリ<179>-Footnote-336687134
Ref: ライブラリ<179>-Footnote-346687200
Ref: ライブラリ<179>-Footnote-356687266
Ref: ライブラリ<179>-Footnote-366687332
Ref: ライブラリ<179>-Footnote-376687398
Ref: ライブラリ<179>-Footnote-386687464
Ref: ライブラリ<179>-Footnote-396687530
Node: ドキュメント<67>6687596
Ref: whatsnew/changelog id8656687738
Ref: 20b26687738
Ref: ドキュメント<67>-Footnote-16689233
Ref: ドキュメント<67>-Footnote-26689298
Ref: ドキュメント<67>-Footnote-36689363
Ref: ドキュメント<67>-Footnote-46689428
Ref: ドキュメント<67>-Footnote-56689493
Ref: ドキュメント<67>-Footnote-66689558
Ref: ドキュメント<67>-Footnote-76689623
Ref: ドキュメント<67>-Footnote-86689688
Ref: ドキュメント<67>-Footnote-96689753
Ref: ドキュメント<67>-Footnote-106689818
Ref: ドキュメント<67>-Footnote-116689884
Ref: ドキュメント<67>-Footnote-126689950
Ref: ドキュメント<67>-Footnote-136690015
Node: テスト<68>6690081
Ref: whatsnew/changelog id8666690216
Ref: 20b36690216
Ref: テスト<68>-Footnote-16690443
Ref: テスト<68>-Footnote-26690508
Node: ビルド<72>6690573
Ref: whatsnew/changelog id8676690697
Ref: 20b46690697
Ref: ビルド<72>-Footnote-16691499
Ref: ビルド<72>-Footnote-26691563
Ref: ビルド<72>-Footnote-36691628
Ref: ビルド<72>-Footnote-46691693
Ref: ビルド<72>-Footnote-56691758
Node: Windows<64>6691823
Ref: whatsnew/changelog id8686691943
Ref: 20b56691943
Ref: Windows<64>-Footnote-16692080
Node: macOS<50>6692145
Ref: whatsnew/changelog id8696692260
Ref: 20b66692260
Ref: macOS<50>-Footnote-16692401
Node: IDLE<47>6692466
Ref: whatsnew/changelog id8706692585
Ref: 20b76692585
Ref: IDLE<47>-Footnote-16694640
Ref: IDLE<47>-Footnote-26694705
Ref: IDLE<47>-Footnote-36694770
Ref: IDLE<47>-Footnote-46694835
Ref: IDLE<47>-Footnote-56694900
Ref: IDLE<47>-Footnote-66694965
Ref: IDLE<47>-Footnote-76695030
Ref: IDLE<47>-Footnote-86695095
Ref: IDLE<47>-Footnote-96695160
Ref: IDLE<47>-Footnote-106695225
Ref: IDLE<47>-Footnote-116695291
Ref: IDLE<47>-Footnote-126695357
Node: Tools/Demos<42>6695423
Ref: whatsnew/changelog id8716695542
Ref: 20b86695542
Ref: Tools/Demos<42>-Footnote-16696293
Ref: Tools/Demos<42>-Footnote-26696358
Ref: Tools/Demos<42>-Footnote-36696423
Ref: Tools/Demos<42>-Footnote-46696488
Ref: Tools/Demos<42>-Footnote-56696553
Node: C API<66>6696618
Ref: whatsnew/changelog id8726696720
Ref: 20b96696720
Ref: C API<66>-Footnote-16696933
Node: Python 3 6 5 final6696998
Ref: whatsnew/changelog python-3-6-5-final6697147
Ref: 20ba6697147
Node: テスト<69>6697296
Ref: whatsnew/changelog id8736697386
Ref: 20bb6697386
Ref: テスト<69>-Footnote-16697545
Node: ビルド<73>6697610
Ref: whatsnew/changelog id8746697700
Ref: 20bc6697700
Ref: ビルド<73>-Footnote-16697842
Node: Python 3 6 5 release candidate 16697907
Ref: whatsnew/changelog python-3-6-5-release-candidate-16698042
Ref: 20bd6698042
Node: セキュリティ<49>6698511
Ref: whatsnew/changelog id8756698633
Ref: 20be6698633
Ref: セキュリティ<49>-Footnote-16699078
Ref: セキュリティ<49>-Footnote-26699143
Ref: セキュリティ<49>-Footnote-36699208
Ref: セキュリティ<49>-Footnote-46699263
Node: Core and Builtins<178>6699318
Ref: whatsnew/changelog id8766699469
Ref: 20bf6699469
Ref: Core and Builtins<178>-Footnote-16701631
Ref: Core and Builtins<178>-Footnote-26701696
Ref: Core and Builtins<178>-Footnote-36701761
Ref: Core and Builtins<178>-Footnote-46701826
Ref: Core and Builtins<178>-Footnote-56701891
Ref: Core and Builtins<178>-Footnote-66701956
Ref: Core and Builtins<178>-Footnote-76702021
Ref: Core and Builtins<178>-Footnote-86702086
Ref: Core and Builtins<178>-Footnote-96702151
Ref: Core and Builtins<178>-Footnote-106702216
Ref: Core and Builtins<178>-Footnote-116702282
Ref: Core and Builtins<178>-Footnote-126702348
Ref: Core and Builtins<178>-Footnote-136702414
Ref: Core and Builtins<178>-Footnote-146702480
Node: ライブラリ<180>6702546
Ref: whatsnew/changelog id8776702697
Ref: 20c06702697
Ref: ライブラリ<180>-Footnote-16708611
Ref: ライブラリ<180>-Footnote-26708676
Ref: ライブラリ<180>-Footnote-36708741
Ref: ライブラリ<180>-Footnote-46708806
Ref: ライブラリ<180>-Footnote-56708871
Ref: ライブラリ<180>-Footnote-66708936
Ref: ライブラリ<180>-Footnote-76709001
Ref: ライブラリ<180>-Footnote-86709066
Ref: ライブラリ<180>-Footnote-96709131
Ref: ライブラリ<180>-Footnote-106709196
Ref: ライブラリ<180>-Footnote-116709262
Ref: ライブラリ<180>-Footnote-126709328
Ref: ライブラリ<180>-Footnote-136709394
Ref: ライブラリ<180>-Footnote-146709460
Ref: ライブラリ<180>-Footnote-156709526
Ref: ライブラリ<180>-Footnote-166709592
Ref: ライブラリ<180>-Footnote-176709658
Ref: ライブラリ<180>-Footnote-186709724
Ref: ライブラリ<180>-Footnote-196709790
Ref: ライブラリ<180>-Footnote-206709856
Ref: ライブラリ<180>-Footnote-216709922
Ref: ライブラリ<180>-Footnote-226709988
Ref: ライブラリ<180>-Footnote-236710054
Ref: ライブラリ<180>-Footnote-246710120
Ref: ライブラリ<180>-Footnote-256710186
Ref: ライブラリ<180>-Footnote-266710252
Ref: ライブラリ<180>-Footnote-276710318
Ref: ライブラリ<180>-Footnote-286710384
Ref: ライブラリ<180>-Footnote-296710450
Ref: ライブラリ<180>-Footnote-306710516
Ref: ライブラリ<180>-Footnote-316710582
Ref: ライブラリ<180>-Footnote-326710648
Ref: ライブラリ<180>-Footnote-336710714
Ref: ライブラリ<180>-Footnote-346710780
Ref: ライブラリ<180>-Footnote-356710846
Ref: ライブラリ<180>-Footnote-366710912
Ref: ライブラリ<180>-Footnote-376710978
Ref: ライブラリ<180>-Footnote-386711044
Ref: ライブラリ<180>-Footnote-396711110
Ref: ライブラリ<180>-Footnote-406711176
Node: ドキュメント<68>6711242
Ref: whatsnew/changelog id8786711384
Ref: 20c16711384
Ref: ドキュメント<68>-Footnote-16712224
Ref: ドキュメント<68>-Footnote-26712289
Ref: ドキュメント<68>-Footnote-36712354
Ref: ドキュメント<68>-Footnote-46712418
Ref: ドキュメント<68>-Footnote-56712483
Ref: ドキュメント<68>-Footnote-66712548
Node: テスト<70>6712613
Ref: whatsnew/changelog id8796712748
Ref: 20c26712748
Ref: テスト<70>-Footnote-16713414
Ref: テスト<70>-Footnote-26713479
Ref: テスト<70>-Footnote-36713544
Ref: テスト<70>-Footnote-46713609
Node: ビルド<74>6713674
Ref: whatsnew/changelog id8806713798
Ref: 20c36713798
Ref: ビルド<74>-Footnote-16713992
Node: Windows<65>6714057
Ref: whatsnew/changelog id8816714177
Ref: 20c46714177
Ref: Windows<65>-Footnote-16715127
Ref: Windows<65>-Footnote-26715192
Ref: Windows<65>-Footnote-36715257
Ref: Windows<65>-Footnote-46715322
Ref: Windows<65>-Footnote-56715387
Ref: Windows<65>-Footnote-66715452
Ref: Windows<65>-Footnote-76715517
Ref: Windows<65>-Footnote-86715582
Node: macOS<51>6715647
Ref: whatsnew/changelog id8826715762
Ref: 20c56715762
Ref: macOS<51>-Footnote-16716155
Node: IDLE<48>6716220
Ref: whatsnew/changelog id8836716339
Ref: 20c66716339
Ref: IDLE<48>-Footnote-16717821
Ref: IDLE<48>-Footnote-26717886
Ref: IDLE<48>-Footnote-36717951
Ref: IDLE<48>-Footnote-46718016
Ref: IDLE<48>-Footnote-56718081
Ref: IDLE<48>-Footnote-66718146
Ref: IDLE<48>-Footnote-76718211
Ref: IDLE<48>-Footnote-86718276
Node: Tools/Demos<43>6718341
Ref: whatsnew/changelog id8846718460
Ref: 20c76718460
Ref: Tools/Demos<43>-Footnote-16718880
Ref: Tools/Demos<43>-Footnote-26718945
Node: C API<67>6719010
Ref: whatsnew/changelog id8856719112
Ref: 20c86719112
Ref: C API<67>-Footnote-16719362
Node: Python 3 6 4 final6719427
Ref: whatsnew/changelog python-3-6-4-final6719576
Ref: 20c96719576
Node: Python 3 6 4 release candidate 16719725
Ref: whatsnew/changelog python-3-6-4-release-candidate-16719860
Ref: 20ca6719860
Node: Core and Builtins<179>6720283
Ref: whatsnew/changelog id8866720403
Ref: 20cb6720403
Ref: Core and Builtins<179>-Footnote-16725121
Ref: Core and Builtins<179>-Footnote-26725186
Ref: Core and Builtins<179>-Footnote-36725251
Ref: Core and Builtins<179>-Footnote-46725316
Ref: Core and Builtins<179>-Footnote-56725381
Ref: Core and Builtins<179>-Footnote-66725446
Ref: Core and Builtins<179>-Footnote-76725511
Ref: Core and Builtins<179>-Footnote-86725576
Ref: Core and Builtins<179>-Footnote-96725641
Ref: Core and Builtins<179>-Footnote-106725706
Ref: Core and Builtins<179>-Footnote-116725772
Ref: Core and Builtins<179>-Footnote-126725838
Ref: Core and Builtins<179>-Footnote-136725904
Ref: Core and Builtins<179>-Footnote-146725970
Ref: Core and Builtins<179>-Footnote-156726036
Ref: Core and Builtins<179>-Footnote-166726102
Ref: Core and Builtins<179>-Footnote-176726168
Ref: Core and Builtins<179>-Footnote-186726234
Ref: Core and Builtins<179>-Footnote-196726300
Ref: Core and Builtins<179>-Footnote-206726366
Ref: Core and Builtins<179>-Footnote-216726432
Ref: Core and Builtins<179>-Footnote-226726498
Ref: Core and Builtins<179>-Footnote-236726564
Ref: Core and Builtins<179>-Footnote-246726630
Node: ライブラリ<181>6726696
Ref: whatsnew/changelog id8876726847
Ref: 20cc6726847
Ref: ライブラリ<181>-Footnote-16734169
Ref: ライブラリ<181>-Footnote-26734234
Ref: ライブラリ<181>-Footnote-36734299
Ref: ライブラリ<181>-Footnote-46734364
Ref: ライブラリ<181>-Footnote-56734429
Ref: ライブラリ<181>-Footnote-66734494
Ref: ライブラリ<181>-Footnote-76734559
Ref: ライブラリ<181>-Footnote-86734624
Ref: ライブラリ<181>-Footnote-96734689
Ref: ライブラリ<181>-Footnote-106734754
Ref: ライブラリ<181>-Footnote-116734820
Ref: ライブラリ<181>-Footnote-126734886
Ref: ライブラリ<181>-Footnote-136734952
Ref: ライブラリ<181>-Footnote-146735018
Ref: ライブラリ<181>-Footnote-156735084
Ref: ライブラリ<181>-Footnote-166735150
Ref: ライブラリ<181>-Footnote-176735215
Ref: ライブラリ<181>-Footnote-186735281
Ref: ライブラリ<181>-Footnote-196735347
Ref: ライブラリ<181>-Footnote-206735413
Ref: ライブラリ<181>-Footnote-216735479
Ref: ライブラリ<181>-Footnote-226735545
Ref: ライブラリ<181>-Footnote-236735611
Ref: ライブラリ<181>-Footnote-246735677
Ref: ライブラリ<181>-Footnote-256735743
Ref: ライブラリ<181>-Footnote-266735809
Ref: ライブラリ<181>-Footnote-276735875
Ref: ライブラリ<181>-Footnote-286735941
Ref: ライブラリ<181>-Footnote-296736007
Ref: ライブラリ<181>-Footnote-306736073
Ref: ライブラリ<181>-Footnote-316736139
Ref: ライブラリ<181>-Footnote-326736205
Ref: ライブラリ<181>-Footnote-336736271
Ref: ライブラリ<181>-Footnote-346736337
Ref: ライブラリ<181>-Footnote-356736403
Ref: ライブラリ<181>-Footnote-366736469
Ref: ライブラリ<181>-Footnote-376736535
Ref: ライブラリ<181>-Footnote-386736601
Ref: ライブラリ<181>-Footnote-396736667
Ref: ライブラリ<181>-Footnote-406736733
Ref: ライブラリ<181>-Footnote-416736799
Ref: ライブラリ<181>-Footnote-426736865
Ref: ライブラリ<181>-Footnote-436736931
Ref: ライブラリ<181>-Footnote-446736997
Ref: ライブラリ<181>-Footnote-456737063
Ref: ライブラリ<181>-Footnote-466737129
Ref: ライブラリ<181>-Footnote-476737195
Ref: ライブラリ<181>-Footnote-486737261
Ref: ライブラリ<181>-Footnote-496737327
Ref: ライブラリ<181>-Footnote-506737393
Ref: ライブラリ<181>-Footnote-516737459
Ref: ライブラリ<181>-Footnote-526737525
Node: ドキュメント<69>6737591
Ref: whatsnew/changelog id8886737733
Ref: 20cd6737733
Ref: ドキュメント<69>-Footnote-16738226
Ref: ドキュメント<69>-Footnote-26738291
Ref: ドキュメント<69>-Footnote-36738356
Node: テスト<71>6738421
Ref: whatsnew/changelog id8896738556
Ref: 20ce6738556
Ref: テスト<71>-Footnote-16739239
Ref: テスト<71>-Footnote-26739304
Ref: テスト<71>-Footnote-36739369
Ref: テスト<71>-Footnote-46739434
Node: ビルド<75>6739499
Ref: whatsnew/changelog id8906739623
Ref: 20cf6739623
Ref: ビルド<75>-Footnote-16740532
Ref: ビルド<75>-Footnote-26740597
Ref: ビルド<75>-Footnote-36740662
Ref: ビルド<75>-Footnote-46740727
Ref: ビルド<75>-Footnote-56740792
Ref: ビルド<75>-Footnote-66740857
Ref: ビルド<75>-Footnote-76740922
Ref: ビルド<75>-Footnote-86740987
Ref: ビルド<75>-Footnote-96741052
Node: Windows<66>6741117
Ref: whatsnew/changelog id8916741237
Ref: 20d06741237
Ref: Windows<66>-Footnote-16741555
Ref: Windows<66>-Footnote-26741619
Node: macOS<52>6741684
Ref: whatsnew/changelog id8926741799
Ref: 20d16741799
Ref: macOS<52>-Footnote-16741933
Node: IDLE<49>6741998
Ref: whatsnew/changelog id8936742117
Ref: 20d26742117
Ref: IDLE<49>-Footnote-16745438
Ref: IDLE<49>-Footnote-26745503
Ref: IDLE<49>-Footnote-36745568
Ref: IDLE<49>-Footnote-46745633
Ref: IDLE<49>-Footnote-56745698
Ref: IDLE<49>-Footnote-66745763
Ref: IDLE<49>-Footnote-76745828
Ref: IDLE<49>-Footnote-86745893
Ref: IDLE<49>-Footnote-96745958
Ref: IDLE<49>-Footnote-106746023
Ref: IDLE<49>-Footnote-116746089
Ref: IDLE<49>-Footnote-126746155
Ref: IDLE<49>-Footnote-136746221
Ref: IDLE<49>-Footnote-146746287
Node: Tools/Demos<44>6746355
Ref: whatsnew/changelog id8946746474
Ref: 20d36746474
Ref: Tools/Demos<44>-Footnote-16746762
Node: C API<68>6746827
Ref: whatsnew/changelog id8956746929
Ref: 20d46746929
Ref: C API<68>-Footnote-16747657
Ref: C API<68>-Footnote-26747722
Ref: C API<68>-Footnote-36747787
Ref: C API<68>-Footnote-46747852
Node: Python 3 6 3 final6747917
Ref: whatsnew/changelog python-3-6-3-final6748066
Ref: 20d56748066
Node: ライブラリ<182>6748228
Ref: whatsnew/changelog id8966748325
Ref: 20d66748325
Ref: ライブラリ<182>-Footnote-16748538
Node: ビルド<76>6748603
Ref: whatsnew/changelog id8976748700
Ref: 20d76748700
Ref: ビルド<76>-Footnote-16748996
Ref: ビルド<76>-Footnote-26749061
Node: Python 3 6 3 release candidate 16749126
Ref: whatsnew/changelog python-3-6-3-release-candidate-16749261
Ref: 20d86749261
Node: セキュリティ<50>6749690
Ref: whatsnew/changelog id8986749812
Ref: 20d96749812
Ref: セキュリティ<50>-Footnote-16750132
Ref: セキュリティ<50>-Footnote-26750197
Node: Core and Builtins<180>6750262
Ref: whatsnew/changelog id8996750413
Ref: 20da6750413
Ref: Core and Builtins<180>-Footnote-16753931
Ref: Core and Builtins<180>-Footnote-26753996
Ref: Core and Builtins<180>-Footnote-36754061
Ref: Core and Builtins<180>-Footnote-46754126
Ref: Core and Builtins<180>-Footnote-56754191
Ref: Core and Builtins<180>-Footnote-66754256
Ref: Core and Builtins<180>-Footnote-76754321
Ref: Core and Builtins<180>-Footnote-86754386
Ref: Core and Builtins<180>-Footnote-96754451
Ref: Core and Builtins<180>-Footnote-106754516
Ref: Core and Builtins<180>-Footnote-116754582
Ref: Core and Builtins<180>-Footnote-126754648
Ref: Core and Builtins<180>-Footnote-136754714
Ref: Core and Builtins<180>-Footnote-146754780
Ref: Core and Builtins<180>-Footnote-156754846
Ref: Core and Builtins<180>-Footnote-166754912
Ref: Core and Builtins<180>-Footnote-176754978
Ref: Core and Builtins<180>-Footnote-186755044
Ref: Core and Builtins<180>-Footnote-196755110
Ref: Core and Builtins<180>-Footnote-206755176
Ref: Core and Builtins<180>-Footnote-216755242
Ref: Core and Builtins<180>-Footnote-226755308
Node: ライブラリ<183>6755374
Ref: whatsnew/changelog id9006755525
Ref: 20db6755525
Ref: ライブラリ<183>-Footnote-16761523
Ref: ライブラリ<183>-Footnote-26761588
Ref: ライブラリ<183>-Footnote-36761653
Ref: ライブラリ<183>-Footnote-46761718
Ref: ライブラリ<183>-Footnote-56761783
Ref: ライブラリ<183>-Footnote-66761848
Ref: ライブラリ<183>-Footnote-76761913
Ref: ライブラリ<183>-Footnote-86761978
Ref: ライブラリ<183>-Footnote-96762043
Ref: ライブラリ<183>-Footnote-106762108
Ref: ライブラリ<183>-Footnote-116762174
Ref: ライブラリ<183>-Footnote-126762240
Ref: ライブラリ<183>-Footnote-136762306
Ref: ライブラリ<183>-Footnote-146762372
Ref: ライブラリ<183>-Footnote-156762438
Ref: ライブラリ<183>-Footnote-166762503
Ref: ライブラリ<183>-Footnote-176762569
Ref: ライブラリ<183>-Footnote-186762635
Ref: ライブラリ<183>-Footnote-196762678
Ref: ライブラリ<183>-Footnote-206762744
Ref: ライブラリ<183>-Footnote-216762810
Ref: ライブラリ<183>-Footnote-226762876
Ref: ライブラリ<183>-Footnote-236762942
Ref: ライブラリ<183>-Footnote-246763008
Ref: ライブラリ<183>-Footnote-256763074
Ref: ライブラリ<183>-Footnote-266763140
Ref: ライブラリ<183>-Footnote-276763206
Ref: ライブラリ<183>-Footnote-286763272
Ref: ライブラリ<183>-Footnote-296763338
Ref: ライブラリ<183>-Footnote-306763404
Ref: ライブラリ<183>-Footnote-316763470
Ref: ライブラリ<183>-Footnote-326763536
Ref: ライブラリ<183>-Footnote-336763602
Ref: ライブラリ<183>-Footnote-346763668
Ref: ライブラリ<183>-Footnote-356763734
Ref: ライブラリ<183>-Footnote-366763800
Ref: ライブラリ<183>-Footnote-376763866
Ref: ライブラリ<183>-Footnote-386763932
Ref: ライブラリ<183>-Footnote-396763998
Ref: ライブラリ<183>-Footnote-406764064
Ref: ライブラリ<183>-Footnote-416764130
Ref: ライブラリ<183>-Footnote-426764196
Node: ドキュメント<70>6764262
Ref: whatsnew/changelog id9016764404
Ref: 20dc6764404
Ref: ドキュメント<70>-Footnote-16764831
Ref: ドキュメント<70>-Footnote-26764896
Ref: ドキュメント<70>-Footnote-36764961
Node: テスト<72>6765026
Ref: whatsnew/changelog id9026765161
Ref: 20dd6765161
Ref: テスト<72>-Footnote-16765867
Ref: テスト<72>-Footnote-26765932
Ref: テスト<72>-Footnote-36765997
Ref: テスト<72>-Footnote-46766062
Node: ビルド<77>6766127
Ref: whatsnew/changelog id9036766251
Ref: 20de6766251
Ref: ビルド<77>-Footnote-16766429
Node: Windows<67>6766494
Ref: whatsnew/changelog id9046766613
Ref: 20df6766613
Ref: Windows<67>-Footnote-16767121
Ref: Windows<67>-Footnote-26767186
Ref: Windows<67>-Footnote-36767251
Ref: Windows<67>-Footnote-46767316
Node: IDLE<50>6767381
Ref: whatsnew/changelog id9056767502
Ref: 20e06767502
Ref: IDLE<50>-Footnote-16776247
Ref: IDLE<50>-Footnote-26776312
Ref: IDLE<50>-Footnote-36776377
Ref: IDLE<50>-Footnote-46776442
Ref: IDLE<50>-Footnote-56776507
Ref: IDLE<50>-Footnote-66776572
Ref: IDLE<50>-Footnote-76776637
Ref: IDLE<50>-Footnote-86776702
Ref: IDLE<50>-Footnote-96776767
Ref: IDLE<50>-Footnote-106776832
Ref: IDLE<50>-Footnote-116776898
Ref: IDLE<50>-Footnote-126776964
Ref: IDLE<50>-Footnote-136777030
Ref: IDLE<50>-Footnote-146777096
Ref: IDLE<50>-Footnote-156777162
Ref: IDLE<50>-Footnote-166777228
Ref: IDLE<50>-Footnote-176777294
Ref: IDLE<50>-Footnote-186777360
Ref: IDLE<50>-Footnote-196777426
Ref: IDLE<50>-Footnote-206777492
Ref: IDLE<50>-Footnote-216777558
Ref: IDLE<50>-Footnote-226777624
Ref: IDLE<50>-Footnote-236777690
Ref: IDLE<50>-Footnote-246777756
Ref: IDLE<50>-Footnote-256777822
Ref: IDLE<50>-Footnote-266777888
Ref: IDLE<50>-Footnote-276777954
Ref: IDLE<50>-Footnote-286778020
Ref: IDLE<50>-Footnote-296778086
Ref: IDLE<50>-Footnote-306778152
Ref: IDLE<50>-Footnote-316778218
Ref: IDLE<50>-Footnote-326778284
Ref: IDLE<50>-Footnote-336778350
Ref: IDLE<50>-Footnote-346778416
Ref: IDLE<50>-Footnote-356778481
Ref: IDLE<50>-Footnote-366778547
Ref: IDLE<50>-Footnote-376778613
Ref: IDLE<50>-Footnote-386778679
Ref: IDLE<50>-Footnote-396778745
Ref: IDLE<50>-Footnote-406778811
Ref: IDLE<50>-Footnote-416778877
Ref: IDLE<50>-Footnote-426778943
Ref: IDLE<50>-Footnote-436779009
Node: Tools/Demos<45>6779074
Ref: whatsnew/changelog id9066779175
Ref: 20e16779175
Ref: Tools/Demos<45>-Footnote-16779733
Ref: Tools/Demos<45>-Footnote-26779798
Node: Python 3 6 2 final6779840
Ref: whatsnew/changelog python-3-6-2-final6779989
Ref: 20e26779989
Node: Python 3 6 2 release candidate 26780110
Ref: whatsnew/changelog python-3-6-2-release-candidate-26780259
Ref: 20e36780259
Node: セキュリティ<51>6780426
Ref: whatsnew/changelog id9076780517
Ref: 20e46780517
Ref: セキュリティ<51>-Footnote-16781652
Ref: セキュリティ<51>-Footnote-26781717
Ref: セキュリティ<51>-Footnote-36781782
Ref: セキュリティ<51>-Footnote-46781837
Ref: セキュリティ<51>-Footnote-56781892
Ref: セキュリティ<51>-Footnote-66781947
Ref: セキュリティ<51>-Footnote-76782002
Ref: セキュリティ<51>-Footnote-86782057
Ref: セキュリティ<51>-Footnote-96782112
Node: Python 3 6 2 release candidate 16782177
Ref: whatsnew/changelog python-3-6-2-release-candidate-16782326
Ref: 20e56782326
Node: セキュリティ<52>6782775
Ref: whatsnew/changelog id9086782897
Ref: 20e66782897
Ref: セキュリティ<52>-Footnote-16783184
Ref: セキュリティ<52>-Footnote-26783249
Ref: セキュリティ<52>-Footnote-36783304
Node: Core and Builtins<181>6783359
Ref: whatsnew/changelog id9096783510
Ref: 20e76783510
Ref: Core and Builtins<181>-Footnote-16785484
Ref: Core and Builtins<181>-Footnote-26785549
Ref: Core and Builtins<181>-Footnote-36785614
Ref: Core and Builtins<181>-Footnote-46785679
Ref: Core and Builtins<181>-Footnote-56785744
Ref: Core and Builtins<181>-Footnote-66785809
Ref: Core and Builtins<181>-Footnote-76785874
Ref: Core and Builtins<181>-Footnote-86785939
Ref: Core and Builtins<181>-Footnote-96786004
Ref: Core and Builtins<181>-Footnote-106786069
Ref: Core and Builtins<181>-Footnote-116786135
Ref: Core and Builtins<181>-Footnote-126786201
Ref: Core and Builtins<181>-Footnote-136786267
Ref: Core and Builtins<181>-Footnote-146786333
Ref: Core and Builtins<181>-Footnote-156786399
Node: ライブラリ<184>6786465
Ref: whatsnew/changelog id9106786602
Ref: 20e86786602
Ref: ライブラリ<184>-Footnote-16795011
Ref: ライブラリ<184>-Footnote-26795076
Ref: ライブラリ<184>-Footnote-36795141
Ref: ライブラリ<184>-Footnote-46795206
Ref: ライブラリ<184>-Footnote-56795271
Ref: ライブラリ<184>-Footnote-66795336
Ref: ライブラリ<184>-Footnote-76795401
Ref: ライブラリ<184>-Footnote-86795466
Ref: ライブラリ<184>-Footnote-96795531
Ref: ライブラリ<184>-Footnote-106795596
Ref: ライブラリ<184>-Footnote-116795662
Ref: ライブラリ<184>-Footnote-126795728
Ref: ライブラリ<184>-Footnote-136795794
Ref: ライブラリ<184>-Footnote-146795860
Ref: ライブラリ<184>-Footnote-156795926
Ref: ライブラリ<184>-Footnote-166795992
Ref: ライブラリ<184>-Footnote-176796058
Ref: ライブラリ<184>-Footnote-186796124
Ref: ライブラリ<184>-Footnote-196796190
Ref: ライブラリ<184>-Footnote-206796256
Ref: ライブラリ<184>-Footnote-216796322
Ref: ライブラリ<184>-Footnote-226796388
Ref: ライブラリ<184>-Footnote-236796454
Ref: ライブラリ<184>-Footnote-246796520
Ref: ライブラリ<184>-Footnote-256796586
Ref: ライブラリ<184>-Footnote-266796652
Ref: ライブラリ<184>-Footnote-276796718
Ref: ライブラリ<184>-Footnote-286796784
Ref: ライブラリ<184>-Footnote-296796850
Ref: ライブラリ<184>-Footnote-306796916
Ref: ライブラリ<184>-Footnote-316796982
Ref: ライブラリ<184>-Footnote-326797048
Ref: ライブラリ<184>-Footnote-336797114
Ref: ライブラリ<184>-Footnote-346797180
Ref: ライブラリ<184>-Footnote-356797246
Ref: ライブラリ<184>-Footnote-366797312
Ref: ライブラリ<184>-Footnote-376797378
Ref: ライブラリ<184>-Footnote-386797444
Ref: ライブラリ<184>-Footnote-396797510
Ref: ライブラリ<184>-Footnote-406797576
Ref: ライブラリ<184>-Footnote-416797642
Ref: ライブラリ<184>-Footnote-426797708
Ref: ライブラリ<184>-Footnote-436797774
Ref: ライブラリ<184>-Footnote-446797840
Ref: ライブラリ<184>-Footnote-456797906
Ref: ライブラリ<184>-Footnote-466797972
Ref: ライブラリ<184>-Footnote-476798038
Ref: ライブラリ<184>-Footnote-486798104
Ref: ライブラリ<184>-Footnote-496798170
Ref: ライブラリ<184>-Footnote-506798236
Ref: ライブラリ<184>-Footnote-516798302
Ref: ライブラリ<184>-Footnote-526798368
Ref: ライブラリ<184>-Footnote-536798434
Ref: ライブラリ<184>-Footnote-546798500
Ref: ライブラリ<184>-Footnote-556798566
Ref: ライブラリ<184>-Footnote-566798631
Ref: ライブラリ<184>-Footnote-576798697
Ref: ライブラリ<184>-Footnote-586798763
Ref: ライブラリ<184>-Footnote-596798829
Ref: ライブラリ<184>-Footnote-606798895
Node: IDLE<51>6798961
Ref: whatsnew/changelog id9116799085
Ref: 20e96799085
Ref: IDLE<51>-Footnote-16800088
Ref: IDLE<51>-Footnote-26800153
Ref: IDLE<51>-Footnote-36800218
Ref: IDLE<51>-Footnote-46800283
Ref: IDLE<51>-Footnote-56800348
Ref: IDLE<51>-Footnote-66800413
Node: C API<69>6800478
Ref: whatsnew/changelog id9126800595
Ref: 20ea6800595
Ref: C API<69>-Footnote-16800783
Node: ビルド<78>6800848
Ref: whatsnew/changelog id9136800979
Ref: 20eb6800979
Ref: ビルド<78>-Footnote-16801789
Ref: ビルド<78>-Footnote-26801854
Ref: ビルド<78>-Footnote-36801919
Ref: ビルド<78>-Footnote-46801984
Ref: ビルド<78>-Footnote-56802049
Node: ドキュメント<71>6802114
Ref: whatsnew/changelog id9146802251
Ref: 20ec6802251
Ref: ドキュメント<71>-Footnote-16802984
Ref: ドキュメント<71>-Footnote-26803049
Ref: ドキュメント<71>-Footnote-36803114
Node: Tools/Demos<46>6803179
Ref: whatsnew/changelog id9156803316
Ref: 20ed6803316
Ref: Tools/Demos<46>-Footnote-16803506
Node: テスト<73>6803571
Ref: whatsnew/changelog id9166803697
Ref: 20ee6803697
Ref: テスト<73>-Footnote-16804357
Ref: テスト<73>-Footnote-26804422
Node: Windows<68>6804487
Ref: whatsnew/changelog id9176804589
Ref: 20ef6804589
Ref: Windows<68>-Footnote-16805033
Ref: Windows<68>-Footnote-26805098
Node: Python 3 6 1 final6805163
Ref: whatsnew/changelog python-3-6-1-final6805312
Ref: 20f06805312
Node: Core and Builtins<182>6805478
Ref: whatsnew/changelog id9186805577
Ref: 20f16805577
Ref: Core and Builtins<182>-Footnote-16806194
Ref: Core and Builtins<182>-Footnote-26806259
Node: ビルド<79>6806324
Ref: whatsnew/changelog id9196806423
Ref: 20f26806423
Ref: ビルド<79>-Footnote-16806610
Node: Python 3 6 1 release candidate 16806675
Ref: whatsnew/changelog python-3-6-1-release-candidate-16806810
Ref: 20f36806810
Node: Core and Builtins<183>6807181
Ref: whatsnew/changelog id9206807301
Ref: 20f46807301
Ref: Core and Builtins<183>-Footnote-16810133
Ref: Core and Builtins<183>-Footnote-26810198
Ref: Core and Builtins<183>-Footnote-36810263
Ref: Core and Builtins<183>-Footnote-46810328
Ref: Core and Builtins<183>-Footnote-56810393
Ref: Core and Builtins<183>-Footnote-66810458
Ref: Core and Builtins<183>-Footnote-76810523
Ref: Core and Builtins<183>-Footnote-86810588
Ref: Core and Builtins<183>-Footnote-96810653
Ref: Core and Builtins<183>-Footnote-106810718
Ref: Core and Builtins<183>-Footnote-116810784
Ref: Core and Builtins<183>-Footnote-126810850
Ref: Core and Builtins<183>-Footnote-136810916
Ref: Core and Builtins<183>-Footnote-146810982
Ref: Core and Builtins<183>-Footnote-156811048
Ref: Core and Builtins<183>-Footnote-166811114
Ref: Core and Builtins<183>-Footnote-176811180
Ref: Core and Builtins<183>-Footnote-186811246
Ref: Core and Builtins<183>-Footnote-196811312
Ref: Core and Builtins<183>-Footnote-206811378
Ref: Core and Builtins<183>-Footnote-216811444
Ref: Core and Builtins<183>-Footnote-226811510
Node: ライブラリ<185>6811576
Ref: whatsnew/changelog id9216811713
Ref: 20f56811713
Ref: ライブラリ<185>-Footnote-16817359
Ref: ライブラリ<185>-Footnote-26817424
Ref: ライブラリ<185>-Footnote-36817489
Ref: ライブラリ<185>-Footnote-46817554
Ref: ライブラリ<185>-Footnote-56817619
Ref: ライブラリ<185>-Footnote-66817684
Ref: ライブラリ<185>-Footnote-76817749
Ref: ライブラリ<185>-Footnote-86817814
Ref: ライブラリ<185>-Footnote-96817879
Ref: ライブラリ<185>-Footnote-106817944
Ref: ライブラリ<185>-Footnote-116818010
Ref: ライブラリ<185>-Footnote-126818076
Ref: ライブラリ<185>-Footnote-136818142
Ref: ライブラリ<185>-Footnote-146818208
Ref: ライブラリ<185>-Footnote-156818274
Ref: ライブラリ<185>-Footnote-166818340
Ref: ライブラリ<185>-Footnote-176818406
Ref: ライブラリ<185>-Footnote-186818472
Ref: ライブラリ<185>-Footnote-196818538
Ref: ライブラリ<185>-Footnote-206818604
Ref: ライブラリ<185>-Footnote-216818670
Ref: ライブラリ<185>-Footnote-226818736
Ref: ライブラリ<185>-Footnote-236818802
Ref: ライブラリ<185>-Footnote-246818868
Ref: ライブラリ<185>-Footnote-256818934
Ref: ライブラリ<185>-Footnote-266819000
Ref: ライブラリ<185>-Footnote-276819066
Ref: ライブラリ<185>-Footnote-286819109
Ref: ライブラリ<185>-Footnote-296819175
Ref: ライブラリ<185>-Footnote-306819241
Ref: ライブラリ<185>-Footnote-316819307
Ref: ライブラリ<185>-Footnote-326819373
Ref: ライブラリ<185>-Footnote-336819439
Ref: ライブラリ<185>-Footnote-346819505
Ref: ライブラリ<185>-Footnote-356819571
Ref: ライブラリ<185>-Footnote-366819636
Ref: ライブラリ<185>-Footnote-376819702
Ref: ライブラリ<185>-Footnote-386819768
Ref: ライブラリ<185>-Footnote-396819834
Ref: ライブラリ<185>-Footnote-406819900
Ref: ライブラリ<185>-Footnote-416819966
Ref: ライブラリ<185>-Footnote-426820032
Ref: ライブラリ<185>-Footnote-436820098
Ref: ライブラリ<185>-Footnote-446820164
Node: IDLE<52>6820230
Ref: whatsnew/changelog id9226820356
Ref: 20f66820356
Ref: IDLE<52>-Footnote-16820643
Ref: IDLE<52>-Footnote-26820708
Node: Windows<69>6820773
Ref: whatsnew/changelog id9236820888
Ref: 20f76820888
Ref: Windows<69>-Footnote-16821535
Ref: Windows<69>-Footnote-26821600
Ref: Windows<69>-Footnote-36821665
Ref: Windows<69>-Footnote-46821730
Ref: Windows<69>-Footnote-56821795
Ref: Windows<69>-Footnote-66821837
Ref: Windows<69>-Footnote-76821902
Ref: Windows<69>-Footnote-86821967
Node: C API<70>6822032
Ref: whatsnew/changelog id9246822161
Ref: 20f86822161
Ref: C API<70>-Footnote-16822987
Ref: C API<70>-Footnote-26823052
Ref: C API<70>-Footnote-36823117
Node: ドキュメント<72>6823182
Ref: whatsnew/changelog id9256823313
Ref: 20f96823313
Ref: ドキュメント<72>-Footnote-16823854
Ref: ドキュメント<72>-Footnote-26823919
Ref: ドキュメント<72>-Footnote-36823984
Ref: ドキュメント<72>-Footnote-46824049
Node: テスト<74>6824114
Ref: whatsnew/changelog id9266824249
Ref: 20fa6824249
Ref: テスト<74>-Footnote-16825239
Ref: テスト<74>-Footnote-26825304
Ref: テスト<74>-Footnote-36825369
Ref: テスト<74>-Footnote-46825434
Ref: テスト<74>-Footnote-56825499
Node: ビルド<80>6825564
Ref: whatsnew/changelog id9276825668
Ref: 20fb6825668
Ref: ビルド<80>-Footnote-16826934
Ref: ビルド<80>-Footnote-26826999
Ref: ビルド<80>-Footnote-36827064
Ref: ビルド<80>-Footnote-46827129
Ref: ビルド<80>-Footnote-56827194
Ref: ビルド<80>-Footnote-66827259
Ref: ビルド<80>-Footnote-76827324
Ref: ビルド<80>-Footnote-86827389
Ref: ビルド<80>-Footnote-96827454
Ref: ビルド<80>-Footnote-106827519
Node: Python 3 6 0 final6827585
Ref: whatsnew/changelog python-3-6-0-final6827734
Ref: 20fc6827734
Node: Python 3 6 0 release candidate 26827855
Ref: whatsnew/changelog python-3-6-0-release-candidate-26828004
Ref: 20fd6828004
Node: Core and Builtins<184>6828254
Ref: whatsnew/changelog id9286828369
Ref: 20fe6828369
Ref: Core and Builtins<184>-Footnote-16828754
Ref: Core and Builtins<184>-Footnote-26828819
Node: Tools/Demos<47>6828884
Ref: whatsnew/changelog id9296829019
Ref: 20ff6829019
Ref: Tools/Demos<47>-Footnote-16829153
Node: Windows<70>6829218
Ref: whatsnew/changelog id9306829344
Ref: 21006829344
Ref: Windows<70>-Footnote-16829470
Node: ビルド<81>6829535
Ref: whatsnew/changelog id9316829637
Ref: 21016829637
Ref: ビルド<81>-Footnote-16829797
Node: Python 3 6 0 release candidate 16829862
Ref: whatsnew/changelog python-3-6-0-release-candidate-16830012
Ref: 21026830012
Node: Core and Builtins<185>6830317
Ref: whatsnew/changelog id9326830437
Ref: 21036830437
Ref: Core and Builtins<185>-Footnote-16831244
Ref: Core and Builtins<185>-Footnote-26831309
Ref: Core and Builtins<185>-Footnote-36831374
Ref: Core and Builtins<185>-Footnote-46831439
Node: ライブラリ<186>6831504
Ref: whatsnew/changelog id9336831642
Ref: 21046831642
Ref: ライブラリ<186>-Footnote-16832692
Ref: ライブラリ<186>-Footnote-26832757
Ref: ライブラリ<186>-Footnote-36832822
Ref: ライブラリ<186>-Footnote-46832887
Ref: ライブラリ<186>-Footnote-56832952
Ref: ライブラリ<186>-Footnote-66833017
Node: C API<71>6833082
Ref: whatsnew/changelog id9346833220
Ref: 21056833220
Ref: C API<71>-Footnote-16833378
Node: ドキュメント<73>6833443
Ref: whatsnew/changelog id9356833576
Ref: 21066833576
Ref: ドキュメント<73>-Footnote-16833918
Ref: ドキュメント<73>-Footnote-26833983
Node: Tools/Demos<48>6834025
Ref: whatsnew/changelog id9366834140
Ref: 21076834140
Ref: Tools/Demos<48>-Footnote-16834304
Node: Python 3 6 0 beta 46834369
Ref: whatsnew/changelog python-3-6-0-beta-46834506
Ref: 21086834506
Node: Core and Builtins<186>6834789
Ref: whatsnew/changelog id9376834896
Ref: 21096834896
Ref: Core and Builtins<186>-Footnote-16836444
Ref: Core and Builtins<186>-Footnote-26836509
Ref: Core and Builtins<186>-Footnote-36836574
Ref: Core and Builtins<186>-Footnote-46836639
Ref: Core and Builtins<186>-Footnote-56836704
Ref: Core and Builtins<186>-Footnote-66836769
Ref: Core and Builtins<186>-Footnote-76836834
Ref: Core and Builtins<186>-Footnote-86836899
Ref: Core and Builtins<186>-Footnote-96836964
Ref: Core and Builtins<186>-Footnote-106837029
Ref: Core and Builtins<186>-Footnote-116837095
Node: ライブラリ<187>6837161
Ref: whatsnew/changelog id9386837299
Ref: 210a6837299
Ref: ライブラリ<187>-Footnote-16839308
Ref: ライブラリ<187>-Footnote-26839373
Ref: ライブラリ<187>-Footnote-36839438
Ref: ライブラリ<187>-Footnote-46839503
Ref: ライブラリ<187>-Footnote-56839568
Ref: ライブラリ<187>-Footnote-66839633
Ref: ライブラリ<187>-Footnote-76839698
Ref: ライブラリ<187>-Footnote-86839763
Ref: ライブラリ<187>-Footnote-96839828
Ref: ライブラリ<187>-Footnote-106839893
Ref: ライブラリ<187>-Footnote-116839959
Ref: ライブラリ<187>-Footnote-126840025
Ref: ライブラリ<187>-Footnote-136840091
Ref: ライブラリ<187>-Footnote-146840157
Ref: ライブラリ<187>-Footnote-156840223
Ref: ライブラリ<187>-Footnote-166840289
Ref: ライブラリ<187>-Footnote-176840355
Ref: ライブラリ<187>-Footnote-186840421
Node: ドキュメント<74>6840487
Ref: whatsnew/changelog id9396840616
Ref: 210b6840616
Ref: ドキュメント<74>-Footnote-16840771
Node: テスト<75>6840836
Ref: whatsnew/changelog id9406840958
Ref: 210c6840958
Ref: テスト<75>-Footnote-16841225
Ref: テスト<75>-Footnote-26841290
Node: ビルド<82>6841355
Ref: whatsnew/changelog id9416841446
Ref: 210d6841446
Ref: ビルド<82>-Footnote-16841806
Ref: ビルド<82>-Footnote-26841871
Ref: ビルド<82>-Footnote-36841936
Node: Python 3 6 0 beta 36842001
Ref: whatsnew/changelog python-3-6-0-beta-36842125
Ref: 210e6842125
Node: Core and Builtins<187>6842386
Ref: whatsnew/changelog id9426842493
Ref: 210f6842493
Ref: Core and Builtins<187>-Footnote-16843396
Ref: Core and Builtins<187>-Footnote-26843461
Ref: Core and Builtins<187>-Footnote-36843526
Ref: Core and Builtins<187>-Footnote-46843591
Ref: Core and Builtins<187>-Footnote-56843656
Ref: Core and Builtins<187>-Footnote-66843721
Ref: Core and Builtins<187>-Footnote-76843786
Node: ライブラリ<188>6843851
Ref: whatsnew/changelog id9436843978
Ref: 21106843978
Ref: ライブラリ<188>-Footnote-16847011
Ref: ライブラリ<188>-Footnote-26847076
Ref: ライブラリ<188>-Footnote-36847141
Ref: ライブラリ<188>-Footnote-46847206
Ref: ライブラリ<188>-Footnote-56847271
Ref: ライブラリ<188>-Footnote-66847336
Ref: ライブラリ<188>-Footnote-76847401
Ref: ライブラリ<188>-Footnote-86847466
Ref: ライブラリ<188>-Footnote-96847531
Ref: ライブラリ<188>-Footnote-106847596
Ref: ライブラリ<188>-Footnote-116847662
Ref: ライブラリ<188>-Footnote-126847728
Ref: ライブラリ<188>-Footnote-136847794
Ref: ライブラリ<188>-Footnote-146847860
Ref: ライブラリ<188>-Footnote-156847926
Ref: ライブラリ<188>-Footnote-166847992
Ref: ライブラリ<188>-Footnote-176848058
Ref: ライブラリ<188>-Footnote-186848124
Ref: ライブラリ<188>-Footnote-196848190
Ref: ライブラリ<188>-Footnote-206848256
Ref: ライブラリ<188>-Footnote-216848322
Ref: ライブラリ<188>-Footnote-226848388
Ref: ライブラリ<188>-Footnote-236848454
Ref: ライブラリ<188>-Footnote-246848520
Node: Windows<71>6848586
Ref: whatsnew/changelog id9446848704
Ref: 21116848704
Ref: Windows<71>-Footnote-16848848
Node: ビルド<83>6848913
Ref: whatsnew/changelog id9456849024
Ref: 21126849024
Ref: ビルド<83>-Footnote-16849348
Ref: ビルド<83>-Footnote-26849413
Ref: ビルド<83>-Footnote-36849478
Node: テスト<76>6849543
Ref: whatsnew/changelog id9466849634
Ref: 21136849634
Ref: テスト<76>-Footnote-16849894
Ref: テスト<76>-Footnote-26849959
Node: Python 3 6 0 beta 26850024
Ref: whatsnew/changelog python-3-6-0-beta-26850148
Ref: 21146850148
Node: Core and Builtins<188>6850429
Ref: whatsnew/changelog id9476850536
Ref: 21156850536
Ref: Core and Builtins<188>-Footnote-16853269
Ref: Core and Builtins<188>-Footnote-26853334
Ref: Core and Builtins<188>-Footnote-36853399
Ref: Core and Builtins<188>-Footnote-46853464
Ref: Core and Builtins<188>-Footnote-56853529
Ref: Core and Builtins<188>-Footnote-66853594
Ref: Core and Builtins<188>-Footnote-76853659
Ref: Core and Builtins<188>-Footnote-86853724
Ref: Core and Builtins<188>-Footnote-96853789
Ref: Core and Builtins<188>-Footnote-106853854
Ref: Core and Builtins<188>-Footnote-116853920
Ref: Core and Builtins<188>-Footnote-126853986
Ref: Core and Builtins<188>-Footnote-136854052
Ref: Core and Builtins<188>-Footnote-146854118
Ref: Core and Builtins<188>-Footnote-156854184
Ref: Core and Builtins<188>-Footnote-166854250
Ref: Core and Builtins<188>-Footnote-176854316
Ref: Core and Builtins<188>-Footnote-186854382
Ref: Core and Builtins<188>-Footnote-196854448
Ref: Core and Builtins<188>-Footnote-206854514
Ref: Core and Builtins<188>-Footnote-216854580
Ref: Core and Builtins<188>-Footnote-226854646
Ref: Core and Builtins<188>-Footnote-236854712
Node: ライブラリ<189>6854778
Ref: whatsnew/changelog id9486854905
Ref: 21166854905
Ref: ライブラリ<189>-Footnote-16860696
Ref: ライブラリ<189>-Footnote-26860761
Ref: ライブラリ<189>-Footnote-36860826
Ref: ライブラリ<189>-Footnote-46860891
Ref: ライブラリ<189>-Footnote-56860956
Ref: ライブラリ<189>-Footnote-66861021
Ref: ライブラリ<189>-Footnote-76861086
Ref: ライブラリ<189>-Footnote-86861151
Ref: ライブラリ<189>-Footnote-96861216
Ref: ライブラリ<189>-Footnote-106861281
Ref: ライブラリ<189>-Footnote-116861347
Ref: ライブラリ<189>-Footnote-126861413
Ref: ライブラリ<189>-Footnote-136861479
Ref: ライブラリ<189>-Footnote-146861545
Ref: ライブラリ<189>-Footnote-156861611
Ref: ライブラリ<189>-Footnote-166861677
Ref: ライブラリ<189>-Footnote-176861743
Ref: ライブラリ<189>-Footnote-186861809
Ref: ライブラリ<189>-Footnote-196861875
Ref: ライブラリ<189>-Footnote-206861941
Ref: ライブラリ<189>-Footnote-216862007
Ref: ライブラリ<189>-Footnote-226862073
Ref: ライブラリ<189>-Footnote-236862139
Ref: ライブラリ<189>-Footnote-246862205
Ref: ライブラリ<189>-Footnote-256862271
Ref: ライブラリ<189>-Footnote-266862337
Ref: ライブラリ<189>-Footnote-276862403
Ref: ライブラリ<189>-Footnote-286862469
Ref: ライブラリ<189>-Footnote-296862535
Ref: ライブラリ<189>-Footnote-306862601
Ref: ライブラリ<189>-Footnote-316862667
Ref: ライブラリ<189>-Footnote-326862733
Ref: ライブラリ<189>-Footnote-336862799
Ref: ライブラリ<189>-Footnote-346862865
Ref: ライブラリ<189>-Footnote-356862931
Ref: ライブラリ<189>-Footnote-366862997
Ref: ライブラリ<189>-Footnote-376863063
Ref: ライブラリ<189>-Footnote-386863129
Ref: ライブラリ<189>-Footnote-396863195
Ref: ライブラリ<189>-Footnote-406863261
Ref: ライブラリ<189>-Footnote-416863327
Ref: ライブラリ<189>-Footnote-426863393
Ref: ライブラリ<189>-Footnote-436863459
Ref: ライブラリ<189>-Footnote-446863525
Ref: ライブラリ<189>-Footnote-456863591
Ref: ライブラリ<189>-Footnote-466863657
Ref: ライブラリ<189>-Footnote-476863723
Ref: ライブラリ<189>-Footnote-486863789
Node: Windows<72>6863855
Ref: whatsnew/changelog id9496863969
Ref: 21176863969
Ref: Windows<72>-Footnote-16864780
Ref: Windows<72>-Footnote-26864845
Ref: Windows<72>-Footnote-36864910
Ref: Windows<72>-Footnote-46864975
Ref: Windows<72>-Footnote-56865040
Ref: Windows<72>-Footnote-66865105
Ref: Windows<72>-Footnote-76865170
Ref: Windows<72>-Footnote-86865235
Ref: Windows<72>-Footnote-96865300
Ref: Windows<72>-Footnote-106865365
Node: C API<72>6865431
Ref: whatsnew/changelog id9506865538
Ref: 21186865538
Ref: C API<72>-Footnote-16865792
Node: ビルド<84>6865857
Ref: whatsnew/changelog id9516865966
Ref: 21196865966
Ref: ビルド<84>-Footnote-16866397
Ref: ビルド<84>-Footnote-26866462
Ref: ビルド<84>-Footnote-36866527
Node: テスト<77>6866592
Ref: whatsnew/changelog id9526866683
Ref: 211a6866683
Ref: テスト<77>-Footnote-16866825
Node: Python 3 6 0 beta 16866890
Ref: whatsnew/changelog python-3-6-0-beta-16867015
Ref: 211b6867015
Node: Core and Builtins<189>6867346
Ref: whatsnew/changelog id9536867453
Ref: 211c6867453
Ref: Core and Builtins<189>-Footnote-16873620
Ref: Core and Builtins<189>-Footnote-26873685
Ref: Core and Builtins<189>-Footnote-36873750
Ref: Core and Builtins<189>-Footnote-46873815
Ref: Core and Builtins<189>-Footnote-56873857
Ref: Core and Builtins<189>-Footnote-66873922
Ref: Core and Builtins<189>-Footnote-76873987
Ref: Core and Builtins<189>-Footnote-86874052
Ref: Core and Builtins<189>-Footnote-96874117
Ref: Core and Builtins<189>-Footnote-106874182
Ref: Core and Builtins<189>-Footnote-116874248
Ref: Core and Builtins<189>-Footnote-126874314
Ref: Core and Builtins<189>-Footnote-136874380
Ref: Core and Builtins<189>-Footnote-146874423
Ref: Core and Builtins<189>-Footnote-156874489
Ref: Core and Builtins<189>-Footnote-166874555
Ref: Core and Builtins<189>-Footnote-176874598
Ref: Core and Builtins<189>-Footnote-186874664
Ref: Core and Builtins<189>-Footnote-196874707
Ref: Core and Builtins<189>-Footnote-206874773
Ref: Core and Builtins<189>-Footnote-216874839
Ref: Core and Builtins<189>-Footnote-226874905
Ref: Core and Builtins<189>-Footnote-236874971
Ref: Core and Builtins<189>-Footnote-246875037
Ref: Core and Builtins<189>-Footnote-256875103
Ref: Core and Builtins<189>-Footnote-266875169
Ref: Core and Builtins<189>-Footnote-276875235
Ref: Core and Builtins<189>-Footnote-286875278
Ref: Core and Builtins<189>-Footnote-296875344
Ref: Core and Builtins<189>-Footnote-306875410
Ref: Core and Builtins<189>-Footnote-316875476
Ref: Core and Builtins<189>-Footnote-326875542
Ref: Core and Builtins<189>-Footnote-336875608
Ref: Core and Builtins<189>-Footnote-346875674
Ref: Core and Builtins<189>-Footnote-356875740
Ref: Core and Builtins<189>-Footnote-366875806
Ref: Core and Builtins<189>-Footnote-376875872
Ref: Core and Builtins<189>-Footnote-386875938
Ref: Core and Builtins<189>-Footnote-396876004
Ref: Core and Builtins<189>-Footnote-406876070
Ref: Core and Builtins<189>-Footnote-416876136
Ref: Core and Builtins<189>-Footnote-426876202
Ref: Core and Builtins<189>-Footnote-436876268
Ref: Core and Builtins<189>-Footnote-446876334
Ref: Core and Builtins<189>-Footnote-456876400
Ref: Core and Builtins<189>-Footnote-466876466
Ref: Core and Builtins<189>-Footnote-476876509
Node: ライブラリ<190>6876575
Ref: whatsnew/changelog id9546876699
Ref: 211d6876699
Ref: ライブラリ<190>-Footnote-16887654
Ref: ライブラリ<190>-Footnote-26887719
Ref: ライブラリ<190>-Footnote-36887784
Ref: ライブラリ<190>-Footnote-46887849
Ref: ライブラリ<190>-Footnote-56887914
Ref: ライブラリ<190>-Footnote-66887979
Ref: ライブラリ<190>-Footnote-76888044
Ref: ライブラリ<190>-Footnote-86888109
Ref: ライブラリ<190>-Footnote-96888174
Ref: ライブラリ<190>-Footnote-106888239
Ref: ライブラリ<190>-Footnote-116888305
Ref: ライブラリ<190>-Footnote-126888371
Ref: ライブラリ<190>-Footnote-136888437
Ref: ライブラリ<190>-Footnote-146888503
Ref: ライブラリ<190>-Footnote-156888569
Ref: ライブラリ<190>-Footnote-166888635
Ref: ライブラリ<190>-Footnote-176888701
Ref: ライブラリ<190>-Footnote-186888769
Ref: ライブラリ<190>-Footnote-196888835
Ref: ライブラリ<190>-Footnote-206888901
Ref: ライブラリ<190>-Footnote-216888967
Ref: ライブラリ<190>-Footnote-226889033
Ref: ライブラリ<190>-Footnote-236889099
Ref: ライブラリ<190>-Footnote-246889165
Ref: ライブラリ<190>-Footnote-256889231
Ref: ライブラリ<190>-Footnote-266889298
Ref: ライブラリ<190>-Footnote-276889364
Ref: ライブラリ<190>-Footnote-286889430
Ref: ライブラリ<190>-Footnote-296889496
Ref: ライブラリ<190>-Footnote-306889562
Ref: ライブラリ<190>-Footnote-316889628
Ref: ライブラリ<190>-Footnote-326889694
Ref: ライブラリ<190>-Footnote-336889760
Ref: ライブラリ<190>-Footnote-346889826
Ref: ライブラリ<190>-Footnote-356889892
Ref: ライブラリ<190>-Footnote-366889958
Ref: ライブラリ<190>-Footnote-376890024
Ref: ライブラリ<190>-Footnote-386890090
Ref: ライブラリ<190>-Footnote-396890156
Ref: ライブラリ<190>-Footnote-406890222
Ref: ライブラリ<190>-Footnote-416890288
Ref: ライブラリ<190>-Footnote-426890354
Ref: ライブラリ<190>-Footnote-436890397
Ref: ライブラリ<190>-Footnote-446890463
Ref: ライブラリ<190>-Footnote-456890506
Ref: ライブラリ<190>-Footnote-466890572
Ref: ライブラリ<190>-Footnote-476890638
Ref: ライブラリ<190>-Footnote-486890704
Ref: ライブラリ<190>-Footnote-496890770
Ref: ライブラリ<190>-Footnote-506890836
Ref: ライブラリ<190>-Footnote-516890902
Ref: ライブラリ<190>-Footnote-526890968
Ref: ライブラリ<190>-Footnote-536891034
Ref: ライブラリ<190>-Footnote-546891090
Ref: ライブラリ<190>-Footnote-556891156
Ref: ライブラリ<190>-Footnote-566891222
Ref: ライブラリ<190>-Footnote-576891288
Ref: ライブラリ<190>-Footnote-586891354
Ref: ライブラリ<190>-Footnote-596891420
Ref: ライブラリ<190>-Footnote-606891486
Ref: ライブラリ<190>-Footnote-616891552
Ref: ライブラリ<190>-Footnote-626891618
Ref: ライブラリ<190>-Footnote-636891684
Ref: ライブラリ<190>-Footnote-646891750
Ref: ライブラリ<190>-Footnote-656891816
Ref: ライブラリ<190>-Footnote-666891882
Ref: ライブラリ<190>-Footnote-676891948
Ref: ライブラリ<190>-Footnote-686892014
Ref: ライブラリ<190>-Footnote-696892080
Ref: ライブラリ<190>-Footnote-706892146
Ref: ライブラリ<190>-Footnote-716892212
Ref: ライブラリ<190>-Footnote-726892278
Ref: ライブラリ<190>-Footnote-736892344
Ref: ライブラリ<190>-Footnote-746892410
Ref: ライブラリ<190>-Footnote-756892476
Ref: ライブラリ<190>-Footnote-766892542
Ref: ライブラリ<190>-Footnote-776892607
Ref: ライブラリ<190>-Footnote-786892672
Ref: ライブラリ<190>-Footnote-796892738
Ref: ライブラリ<190>-Footnote-806892804
Ref: ライブラリ<190>-Footnote-816892869
Ref: ライブラリ<190>-Footnote-826892935
Node: IDLE<53>6893001
Ref: whatsnew/changelog id9556893112
Ref: 211e6893112
Ref: IDLE<53>-Footnote-16893868
Ref: IDLE<53>-Footnote-26893933
Ref: IDLE<53>-Footnote-36893998
Ref: IDLE<53>-Footnote-46894063
Ref: IDLE<53>-Footnote-56894128
Ref: IDLE<53>-Footnote-66894193
Node: C API<73>6894258
Ref: whatsnew/changelog id9566894362
Ref: 211f6894362
Ref: C API<73>-Footnote-16894634
Ref: C API<73>-Footnote-26894699
Node: テスト<78>6894764
Ref: whatsnew/changelog id9576894873
Ref: 21206894873
Ref: テスト<78>-Footnote-16895394
Ref: テスト<78>-Footnote-26895459
Ref: テスト<78>-Footnote-36895524
Ref: テスト<78>-Footnote-46895589
Node: ビルド<85>6895654
Ref: whatsnew/changelog id9586895769
Ref: 21216895769
Ref: ビルド<85>-Footnote-16897157
Ref: ビルド<85>-Footnote-26897222
Ref: ビルド<85>-Footnote-36897287
Ref: ビルド<85>-Footnote-46897352
Ref: ビルド<85>-Footnote-56897417
Ref: ビルド<85>-Footnote-66897482
Ref: ビルド<85>-Footnote-76897547
Ref: ビルド<85>-Footnote-86897612
Ref: ビルド<85>-Footnote-96897677
Ref: ビルド<85>-Footnote-106897742
Ref: ビルド<85>-Footnote-116897808
Node: Tools/Demos<49>6897874
Ref: whatsnew/changelog id9596897987
Ref: 21226897987
Ref: Tools/Demos<49>-Footnote-16898262
Node: Windows<73>6898327
Ref: whatsnew/changelog id9606898418
Ref: 21236898418
Ref: Windows<73>-Footnote-16899385
Ref: Windows<73>-Footnote-26899450
Ref: Windows<73>-Footnote-36899515
Ref: Windows<73>-Footnote-46899579
Ref: Windows<73>-Footnote-56899644
Ref: Windows<73>-Footnote-66899709
Ref: Windows<73>-Footnote-76899773
Ref: Windows<73>-Footnote-86899838
Ref: Windows<73>-Footnote-96899903
Ref: Windows<73>-Footnote-106899968
Ref: Windows<73>-Footnote-116900034
Node: Python 3 6 0 alpha 46900100
Ref: whatsnew/changelog python-3-6-0-alpha-46900226
Ref: 21246900226
Node: Core and Builtins<190>6900507
Ref: whatsnew/changelog id9616900615
Ref: 21256900615
Ref: Core and Builtins<190>-Footnote-16902559
Ref: Core and Builtins<190>-Footnote-26902624
Ref: Core and Builtins<190>-Footnote-36902689
Ref: Core and Builtins<190>-Footnote-46902754
Ref: Core and Builtins<190>-Footnote-56902819
Ref: Core and Builtins<190>-Footnote-66902884
Ref: Core and Builtins<190>-Footnote-76902949
Ref: Core and Builtins<190>-Footnote-86903014
Ref: Core and Builtins<190>-Footnote-96903079
Ref: Core and Builtins<190>-Footnote-106903143
Ref: Core and Builtins<190>-Footnote-116903209
Ref: Core and Builtins<190>-Footnote-126903275
Ref: Core and Builtins<190>-Footnote-136903341
Ref: Core and Builtins<190>-Footnote-146903407
Node: ライブラリ<191>6903450
Ref: whatsnew/changelog id9626903575
Ref: 21266903575
Ref: ライブラリ<191>-Footnote-16908077
Ref: ライブラリ<191>-Footnote-26908142
Ref: ライブラリ<191>-Footnote-36908184
Ref: ライブラリ<191>-Footnote-46908249
Ref: ライブラリ<191>-Footnote-56908314
Ref: ライブラリ<191>-Footnote-66908379
Ref: ライブラリ<191>-Footnote-76908444
Ref: ライブラリ<191>-Footnote-86908509
Ref: ライブラリ<191>-Footnote-96908574
Ref: ライブラリ<191>-Footnote-106908639
Ref: ライブラリ<191>-Footnote-116908705
Ref: ライブラリ<191>-Footnote-126908748
Ref: ライブラリ<191>-Footnote-136908814
Ref: ライブラリ<191>-Footnote-146908880
Ref: ライブラリ<191>-Footnote-156908946
Ref: ライブラリ<191>-Footnote-166909012
Ref: ライブラリ<191>-Footnote-176909077
Ref: ライブラリ<191>-Footnote-186909143
Ref: ライブラリ<191>-Footnote-196909209
Ref: ライブラリ<191>-Footnote-206909275
Ref: ライブラリ<191>-Footnote-216909341
Ref: ライブラリ<191>-Footnote-226909407
Ref: ライブラリ<191>-Footnote-236909473
Ref: ライブラリ<191>-Footnote-246909539
Ref: ライブラリ<191>-Footnote-256909605
Ref: ライブラリ<191>-Footnote-266909671
Ref: ライブラリ<191>-Footnote-276909737
Ref: ライブラリ<191>-Footnote-286909803
Ref: ライブラリ<191>-Footnote-296909862
Ref: ライブラリ<191>-Footnote-306909927
Ref: ライブラリ<191>-Footnote-316909993
Ref: ライブラリ<191>-Footnote-326910059
Ref: ライブラリ<191>-Footnote-336910125
Ref: ライブラリ<191>-Footnote-346910168
Ref: ライブラリ<191>-Footnote-356910234
Ref: ライブラリ<191>-Footnote-366910299
Ref: ライブラリ<191>-Footnote-376910365
Ref: ライブラリ<191>-Footnote-386910431
Ref: ライブラリ<191>-Footnote-396910497
Node: IDLE<54>6910563
Ref: whatsnew/changelog id9636910679
Ref: 21276910679
Ref: IDLE<54>-Footnote-16911999
Ref: IDLE<54>-Footnote-26912064
Ref: IDLE<54>-Footnote-36912129
Ref: IDLE<54>-Footnote-46912194
Ref: IDLE<54>-Footnote-56912259
Ref: IDLE<54>-Footnote-66912324
Ref: IDLE<54>-Footnote-76912389
Ref: IDLE<54>-Footnote-86912454
Node: テスト<79>6912519
Ref: whatsnew/changelog id9646912626
Ref: 21286912626
Ref: テスト<79>-Footnote-16913218
Ref: テスト<79>-Footnote-26913283
Ref: テスト<79>-Footnote-36913348
Ref: テスト<79>-Footnote-46913413
Node: Windows<74>6913478
Ref: whatsnew/changelog id9656913590
Ref: 21296913590
Ref: Windows<74>-Footnote-16913966
Ref: Windows<74>-Footnote-26914031
Ref: Windows<74>-Footnote-36914096
Ref: Windows<74>-Footnote-46914138
Ref: Windows<74>-Footnote-56914203
Node: ビルド<86>6914268
Ref: whatsnew/changelog id9666914358
Ref: 212a6914358
Ref: ビルド<86>-Footnote-16915262
Ref: ビルド<86>-Footnote-26915327
Ref: ビルド<86>-Footnote-36915392
Ref: ビルド<86>-Footnote-46915457
Ref: ビルド<86>-Footnote-56915522
Ref: ビルド<86>-Footnote-66915587
Node: Python 3 6 0 alpha 36915652
Ref: whatsnew/changelog python-3-6-0-alpha-36915779
Ref: 212b6915779
Node: セキュリティ<53>6916180
Ref: whatsnew/changelog id9676916290
Ref: 212c6916290
Ref: セキュリティ<53>-Footnote-16916682
Ref: セキュリティ<53>-Footnote-26916747
Node: Core and Builtins<191>6916812
Ref: whatsnew/changelog id9686916951
Ref: 212d6916951
Ref: Core and Builtins<191>-Footnote-16917698
Ref: Core and Builtins<191>-Footnote-26917763
Ref: Core and Builtins<191>-Footnote-36917828
Ref: Core and Builtins<191>-Footnote-46917893
Node: ライブラリ<192>6917958
Ref: whatsnew/changelog id9696918083
Ref: 212e6918083
Ref: ライブラリ<192>-Footnote-16922177
Ref: ライブラリ<192>-Footnote-26922242
Ref: ライブラリ<192>-Footnote-36922307
Ref: ライブラリ<192>-Footnote-46922372
Ref: ライブラリ<192>-Footnote-56922437
Ref: ライブラリ<192>-Footnote-66922502
Ref: ライブラリ<192>-Footnote-76922567
Ref: ライブラリ<192>-Footnote-86922632
Ref: ライブラリ<192>-Footnote-96922697
Ref: ライブラリ<192>-Footnote-106922762
Ref: ライブラリ<192>-Footnote-116922828
Ref: ライブラリ<192>-Footnote-126922894
Ref: ライブラリ<192>-Footnote-136922960
Ref: ライブラリ<192>-Footnote-146923026
Ref: ライブラリ<192>-Footnote-156923092
Ref: ライブラリ<192>-Footnote-166923158
Ref: ライブラリ<192>-Footnote-176923224
Ref: ライブラリ<192>-Footnote-186923290
Ref: ライブラリ<192>-Footnote-196923356
Ref: ライブラリ<192>-Footnote-206923422
Ref: ライブラリ<192>-Footnote-216923488
Ref: ライブラリ<192>-Footnote-226923531
Ref: ライブラリ<192>-Footnote-236923597
Ref: ライブラリ<192>-Footnote-246923663
Ref: ライブラリ<192>-Footnote-256923728
Ref: ライブラリ<192>-Footnote-266923794
Node: IDLE<55>6923860
Ref: whatsnew/changelog id9706923972
Ref: 212f6923972
Ref: IDLE<55>-Footnote-16925628
Ref: IDLE<55>-Footnote-26925693
Ref: IDLE<55>-Footnote-36925758
Ref: IDLE<55>-Footnote-46925823
Ref: IDLE<55>-Footnote-56925888
Ref: IDLE<55>-Footnote-66925953
Ref: IDLE<55>-Footnote-76926018
Ref: IDLE<55>-Footnote-86926083
Ref: IDLE<55>-Footnote-96926148
Ref: IDLE<55>-Footnote-106926213
Node: C API<74>6926279
Ref: whatsnew/changelog id9716926384
Ref: 21306926384
Ref: C API<74>-Footnote-16926624
Node: ビルド<87>6926689
Ref: whatsnew/changelog id9726926801
Ref: 21316926801
Ref: ビルド<87>-Footnote-16927777
Ref: ビルド<87>-Footnote-26927842
Ref: ビルド<87>-Footnote-36927907
Ref: ビルド<87>-Footnote-46927972
Ref: ビルド<87>-Footnote-56928037
Node: Tools/Demos<50>6928102
Ref: whatsnew/changelog id9736928227
Ref: 21326928227
Ref: Tools/Demos<50>-Footnote-16928511
Ref: Tools/Demos<50>-Footnote-26928576
Node: ドキュメント<75>6928641
Ref: whatsnew/changelog id9746928766
Ref: 21336928766
Ref: ドキュメント<75>-Footnote-16929147
Ref: ドキュメント<75>-Footnote-26929212
Node: テスト<80>6929277
Ref: whatsnew/changelog id9756929378
Ref: 21346929378
Ref: テスト<80>-Footnote-16929551
Node: Python 3 6 0 alpha 26929616
Ref: whatsnew/changelog python-3-6-0-alpha-26929743
Ref: 21356929743
Node: セキュリティ<54>6930168
Ref: whatsnew/changelog id9766930278
Ref: 21366930278
Ref: セキュリティ<54>-Footnote-16930783
Ref: セキュリティ<54>-Footnote-26930848
Ref: セキュリティ<54>-Footnote-36930903
Ref: セキュリティ<54>-Footnote-46930958
Node: Core and Builtins<192>6931023
Ref: whatsnew/changelog id9776931162
Ref: 21376931162
Ref: Core and Builtins<192>-Footnote-16932794
Ref: Core and Builtins<192>-Footnote-26932859
Ref: Core and Builtins<192>-Footnote-36932924
Ref: Core and Builtins<192>-Footnote-46932989
Ref: Core and Builtins<192>-Footnote-56933054
Ref: Core and Builtins<192>-Footnote-66933119
Ref: Core and Builtins<192>-Footnote-76933161
Ref: Core and Builtins<192>-Footnote-86933226
Ref: Core and Builtins<192>-Footnote-96933291
Ref: Core and Builtins<192>-Footnote-106933356
Ref: Core and Builtins<192>-Footnote-116933422
Ref: Core and Builtins<192>-Footnote-126933488
Node: ライブラリ<193>6933554
Ref: whatsnew/changelog id9786933679
Ref: 21386933679
Ref: ライブラリ<193>-Footnote-16938889
Ref: ライブラリ<193>-Footnote-26938954
Ref: ライブラリ<193>-Footnote-36939019
Ref: ライブラリ<193>-Footnote-46939084
Ref: ライブラリ<193>-Footnote-56939149
Ref: ライブラリ<193>-Footnote-66939214
Ref: ライブラリ<193>-Footnote-76939279
Ref: ライブラリ<193>-Footnote-86939344
Ref: ライブラリ<193>-Footnote-96939409
Ref: ライブラリ<193>-Footnote-106939451
Ref: ライブラリ<193>-Footnote-116939517
Ref: ライブラリ<193>-Footnote-126939583
Ref: ライブラリ<193>-Footnote-136939649
Ref: ライブラリ<193>-Footnote-146939692
Ref: ライブラリ<193>-Footnote-156939758
Ref: ライブラリ<193>-Footnote-166939801
Ref: ライブラリ<193>-Footnote-176939844
Ref: ライブラリ<193>-Footnote-186939910
Ref: ライブラリ<193>-Footnote-196939976
Ref: ライブラリ<193>-Footnote-206940042
Ref: ライブラリ<193>-Footnote-216940108
Ref: ライブラリ<193>-Footnote-226940174
Ref: ライブラリ<193>-Footnote-236940240
Ref: ライブラリ<193>-Footnote-246940306
Ref: ライブラリ<193>-Footnote-256940372
Ref: ライブラリ<193>-Footnote-266940438
Ref: ライブラリ<193>-Footnote-276940504
Ref: ライブラリ<193>-Footnote-286940570
Ref: ライブラリ<193>-Footnote-296940636
Ref: ライブラリ<193>-Footnote-306940702
Ref: ライブラリ<193>-Footnote-316940768
Ref: ライブラリ<193>-Footnote-326940834
Ref: ライブラリ<193>-Footnote-336940900
Ref: ライブラリ<193>-Footnote-346940966
Ref: ライブラリ<193>-Footnote-356941032
Node: IDLE<56>6941098
Ref: whatsnew/changelog id9796941223
Ref: 21396941223
Ref: IDLE<56>-Footnote-16943862
Ref: IDLE<56>-Footnote-26943926
Ref: IDLE<56>-Footnote-36943991
Ref: IDLE<56>-Footnote-46944056
Ref: IDLE<56>-Footnote-56944121
Ref: IDLE<56>-Footnote-66944186
Ref: IDLE<56>-Footnote-76944251
Ref: IDLE<56>-Footnote-86944316
Ref: IDLE<56>-Footnote-96944381
Ref: IDLE<56>-Footnote-106944446
Ref: IDLE<56>-Footnote-116944512
Ref: IDLE<56>-Footnote-126944578
Ref: IDLE<56>-Footnote-136944644
Ref: IDLE<56>-Footnote-146944710
Ref: IDLE<56>-Footnote-156944776
Ref: IDLE<56>-Footnote-166944842
Ref: IDLE<56>-Footnote-176944908
Ref: IDLE<56>-Footnote-186944974
Ref: IDLE<56>-Footnote-196945040
Node: ドキュメント<76>6945106
Ref: whatsnew/changelog id9806945224
Ref: 213a6945224
Ref: ドキュメント<76>-Footnote-16945671
Ref: ドキュメント<76>-Footnote-26945736
Ref: ドキュメント<76>-Footnote-36945801
Ref: ドキュメント<76>-Footnote-46945843
Node: テスト<81>6945908
Ref: whatsnew/changelog id9816946029
Ref: 213b6946029
Ref: テスト<81>-Footnote-16946414
Ref: テスト<81>-Footnote-26946479
Node: Windows<75>6946544
Ref: whatsnew/changelog id9826946656
Ref: 213c6946656
Ref: Windows<75>-Footnote-16947066
Ref: Windows<75>-Footnote-26947131
Node: ビルド<88>6947196
Ref: whatsnew/changelog id9836947304
Ref: 213d6947304
Ref: ビルド<88>-Footnote-16947586
Ref: ビルド<88>-Footnote-26947651
Node: C API<75>6947716
Ref: whatsnew/changelog id9846947828
Ref: 213e6947828
Ref: C API<75>-Footnote-16948066
Ref: C API<75>-Footnote-26948131
Ref: C API<75>-Footnote-36948173
Node: Tools/Demos<51>6948238
Ref: whatsnew/changelog id9856948328
Ref: 213f6948328
Ref: Tools/Demos<51>-Footnote-16948526
Node: Python 3 6 0 alpha 16948591
Ref: whatsnew/changelog python-3-6-0-alpha-16948716
Ref: 21406948716
Node: セキュリティ<55>6949141
Ref: whatsnew/changelog id9866949251
Ref: 21416949251
Ref: セキュリティ<55>-Footnote-16949756
Ref: セキュリティ<55>-Footnote-26949821
Ref: セキュリティ<55>-Footnote-36949886
Node: Core and Builtins<193>6949951
Ref: whatsnew/changelog id9876950090
Ref: 21426950090
Ref: Core and Builtins<193>-Footnote-16963237
Ref: Core and Builtins<193>-Footnote-26963302
Ref: Core and Builtins<193>-Footnote-36963367
Ref: Core and Builtins<193>-Footnote-46963432
Ref: Core and Builtins<193>-Footnote-56963497
Ref: Core and Builtins<193>-Footnote-66963562
Ref: Core and Builtins<193>-Footnote-76963627
Ref: Core and Builtins<193>-Footnote-86963692
Ref: Core and Builtins<193>-Footnote-96963757
Ref: Core and Builtins<193>-Footnote-106963822
Ref: Core and Builtins<193>-Footnote-116963888
Ref: Core and Builtins<193>-Footnote-126963954
Ref: Core and Builtins<193>-Footnote-136964020
Ref: Core and Builtins<193>-Footnote-146964086
Ref: Core and Builtins<193>-Footnote-156964152
Ref: Core and Builtins<193>-Footnote-166964218
Ref: Core and Builtins<193>-Footnote-176964261
Ref: Core and Builtins<193>-Footnote-186964327
Ref: Core and Builtins<193>-Footnote-196964393
Ref: Core and Builtins<193>-Footnote-206964459
Ref: Core and Builtins<193>-Footnote-216964525
Ref: Core and Builtins<193>-Footnote-226964591
Ref: Core and Builtins<193>-Footnote-236964657
Ref: Core and Builtins<193>-Footnote-246964700
Ref: Core and Builtins<193>-Footnote-256964766
Ref: Core and Builtins<193>-Footnote-266964832
Ref: Core and Builtins<193>-Footnote-276964898
Ref: Core and Builtins<193>-Footnote-286964964
Ref: Core and Builtins<193>-Footnote-296965030
Ref: Core and Builtins<193>-Footnote-306965096
Ref: Core and Builtins<193>-Footnote-316965162
Ref: Core and Builtins<193>-Footnote-326965228
Ref: Core and Builtins<193>-Footnote-336965294
Ref: Core and Builtins<193>-Footnote-346965360
Ref: Core and Builtins<193>-Footnote-356965426
Ref: Core and Builtins<193>-Footnote-366965492
Ref: Core and Builtins<193>-Footnote-376965557
Ref: Core and Builtins<193>-Footnote-386965623
Ref: Core and Builtins<193>-Footnote-396965689
Ref: Core and Builtins<193>-Footnote-406965755
Ref: Core and Builtins<193>-Footnote-416965821
Ref: Core and Builtins<193>-Footnote-426965887
Ref: Core and Builtins<193>-Footnote-436965953
Ref: Core and Builtins<193>-Footnote-446966019
Ref: Core and Builtins<193>-Footnote-456966085
Ref: Core and Builtins<193>-Footnote-466966151
Ref: Core and Builtins<193>-Footnote-476966217
Ref: Core and Builtins<193>-Footnote-486966283
Ref: Core and Builtins<193>-Footnote-496966349
Ref: Core and Builtins<193>-Footnote-506966415
Ref: Core and Builtins<193>-Footnote-516966481
Ref: Core and Builtins<193>-Footnote-526966547
Ref: Core and Builtins<193>-Footnote-536966612
Ref: Core and Builtins<193>-Footnote-546966678
Ref: Core and Builtins<193>-Footnote-556966744
Ref: Core and Builtins<193>-Footnote-566966810
Ref: Core and Builtins<193>-Footnote-576966876
Ref: Core and Builtins<193>-Footnote-586966942
Ref: Core and Builtins<193>-Footnote-596967008
Ref: Core and Builtins<193>-Footnote-606967074
Ref: Core and Builtins<193>-Footnote-616967140
Ref: Core and Builtins<193>-Footnote-626967206
Ref: Core and Builtins<193>-Footnote-636967272
Ref: Core and Builtins<193>-Footnote-646967338
Ref: Core and Builtins<193>-Footnote-656967404
Ref: Core and Builtins<193>-Footnote-666967470
Ref: Core and Builtins<193>-Footnote-676967536
Ref: Core and Builtins<193>-Footnote-686967602
Ref: Core and Builtins<193>-Footnote-696967668
Ref: Core and Builtins<193>-Footnote-706967734
Ref: Core and Builtins<193>-Footnote-716967800
Ref: Core and Builtins<193>-Footnote-726967866
Ref: Core and Builtins<193>-Footnote-736967932
Ref: Core and Builtins<193>-Footnote-746967998
Ref: Core and Builtins<193>-Footnote-756968064
Ref: Core and Builtins<193>-Footnote-766968130
Ref: Core and Builtins<193>-Footnote-776968196
Ref: Core and Builtins<193>-Footnote-786968262
Ref: Core and Builtins<193>-Footnote-796968327
Ref: Core and Builtins<193>-Footnote-806968393
Ref: Core and Builtins<193>-Footnote-816968436
Ref: Core and Builtins<193>-Footnote-826968502
Ref: Core and Builtins<193>-Footnote-836968568
Ref: Core and Builtins<193>-Footnote-846968634
Ref: Core and Builtins<193>-Footnote-856968700
Ref: Core and Builtins<193>-Footnote-866968766
Ref: Core and Builtins<193>-Footnote-876968832
Node: ライブラリ<194>6968898
Ref: whatsnew/changelog id9886969023
Ref: 21446969023
Ref: ライブラリ<194>-Footnote-16999954
Ref: ライブラリ<194>-Footnote-27000019
Ref: ライブラリ<194>-Footnote-37000084
Ref: ライブラリ<194>-Footnote-47000149
Ref: ライブラリ<194>-Footnote-57000214
Ref: ライブラリ<194>-Footnote-67000279
Ref: ライブラリ<194>-Footnote-77000344
Ref: ライブラリ<194>-Footnote-87000409
Ref: ライブラリ<194>-Footnote-97000474
Ref: ライブラリ<194>-Footnote-107000539
Ref: ライブラリ<194>-Footnote-117000605
Ref: ライブラリ<194>-Footnote-127000671
Ref: ライブラリ<194>-Footnote-137000737
Ref: ライブラリ<194>-Footnote-147000803
Ref: ライブラリ<194>-Footnote-157000869
Ref: ライブラリ<194>-Footnote-167000935
Ref: ライブラリ<194>-Footnote-177001001
Ref: ライブラリ<194>-Footnote-187001067
Ref: ライブラリ<194>-Footnote-197001110
Ref: ライブラリ<194>-Footnote-207001176
Ref: ライブラリ<194>-Footnote-217001242
Ref: ライブラリ<194>-Footnote-227001308
Ref: ライブラリ<194>-Footnote-237001374
Ref: ライブラリ<194>-Footnote-247001440
Ref: ライブラリ<194>-Footnote-257001506
Ref: ライブラリ<194>-Footnote-267001572
Ref: ライブラリ<194>-Footnote-277001638
Ref: ライブラリ<194>-Footnote-287001704
Ref: ライブラリ<194>-Footnote-297001770
Ref: ライブラリ<194>-Footnote-307001836
Ref: ライブラリ<194>-Footnote-317001902
Ref: ライブラリ<194>-Footnote-327001968
Ref: ライブラリ<194>-Footnote-337002034
Ref: ライブラリ<194>-Footnote-347002100
Ref: ライブラリ<194>-Footnote-357002166
Ref: ライブラリ<194>-Footnote-367002232
Ref: ライブラリ<194>-Footnote-377002298
Ref: ライブラリ<194>-Footnote-387002364
Ref: ライブラリ<194>-Footnote-397002430
Ref: ライブラリ<194>-Footnote-407002496
Ref: ライブラリ<194>-Footnote-417002562
Ref: ライブラリ<194>-Footnote-427002628
Ref: ライブラリ<194>-Footnote-437002694
Ref: ライブラリ<194>-Footnote-447002760
Ref: ライブラリ<194>-Footnote-457002826
Ref: ライブラリ<194>-Footnote-467002892
Ref: ライブラリ<194>-Footnote-477002958
Ref: ライブラリ<194>-Footnote-487003024
Ref: ライブラリ<194>-Footnote-497003090
Ref: ライブラリ<194>-Footnote-507003156
Ref: ライブラリ<194>-Footnote-517003222
Ref: ライブラリ<194>-Footnote-527003288
Ref: ライブラリ<194>-Footnote-537003354
Ref: ライブラリ<194>-Footnote-547003420
Ref: ライブラリ<194>-Footnote-557003486
Ref: ライブラリ<194>-Footnote-567003552
Ref: ライブラリ<194>-Footnote-577003618
Ref: ライブラリ<194>-Footnote-587003684
Ref: ライブラリ<194>-Footnote-597003750
Ref: ライブラリ<194>-Footnote-607003816
Ref: ライブラリ<194>-Footnote-617003882
Ref: ライブラリ<194>-Footnote-627003948
Ref: ライブラリ<194>-Footnote-637004014
Ref: ライブラリ<194>-Footnote-647004080
Ref: ライブラリ<194>-Footnote-657004146
Ref: ライブラリ<194>-Footnote-667004212
Ref: ライブラリ<194>-Footnote-677004278
Ref: ライブラリ<194>-Footnote-687004344
Ref: ライブラリ<194>-Footnote-697004410
Ref: ライブラリ<194>-Footnote-707004476
Ref: ライブラリ<194>-Footnote-717004542
Ref: ライブラリ<194>-Footnote-727004608
Ref: ライブラリ<194>-Footnote-737004674
Ref: ライブラリ<194>-Footnote-747004740
Ref: ライブラリ<194>-Footnote-757004806
Ref: ライブラリ<194>-Footnote-767004872
Ref: ライブラリ<194>-Footnote-777004938
Ref: ライブラリ<194>-Footnote-787005004
Ref: ライブラリ<194>-Footnote-797005070
Ref: ライブラリ<194>-Footnote-807005136
Ref: ライブラリ<194>-Footnote-817005201
Ref: ライブラリ<194>-Footnote-827005267
Ref: ライブラリ<194>-Footnote-837005333
Ref: ライブラリ<194>-Footnote-847005399
Ref: ライブラリ<194>-Footnote-857005465
Ref: ライブラリ<194>-Footnote-867005531
Ref: ライブラリ<194>-Footnote-877005597
Ref: ライブラリ<194>-Footnote-887005663
Ref: ライブラリ<194>-Footnote-897005729
Ref: ライブラリ<194>-Footnote-907005795
Ref: ライブラリ<194>-Footnote-917005861
Ref: ライブラリ<194>-Footnote-927005927
Ref: ライブラリ<194>-Footnote-937005993
Ref: ライブラリ<194>-Footnote-947006059
Ref: ライブラリ<194>-Footnote-957006125
Ref: ライブラリ<194>-Footnote-967006191
Ref: ライブラリ<194>-Footnote-977006257
Ref: ライブラリ<194>-Footnote-987006323
Ref: ライブラリ<194>-Footnote-997006389
Ref: ライブラリ<194>-Footnote-1007006455
Ref: ライブラリ<194>-Footnote-1017006522
Ref: ライブラリ<194>-Footnote-1027006589
Ref: ライブラリ<194>-Footnote-1037006656
Ref: ライブラリ<194>-Footnote-1047006723
Ref: ライブラリ<194>-Footnote-1057006790
Ref: ライブラリ<194>-Footnote-1067006857
Ref: ライブラリ<194>-Footnote-1077006924
Ref: ライブラリ<194>-Footnote-1087006991
Ref: ライブラリ<194>-Footnote-1097007058
Ref: ライブラリ<194>-Footnote-1107007125
Ref: ライブラリ<194>-Footnote-1117007192
Ref: ライブラリ<194>-Footnote-1127007259
Ref: ライブラリ<194>-Footnote-1137007326
Ref: ライブラリ<194>-Footnote-1147007393
Ref: ライブラリ<194>-Footnote-1157007460
Ref: ライブラリ<194>-Footnote-1167007527
Ref: ライブラリ<194>-Footnote-1177007594
Ref: ライブラリ<194>-Footnote-1187007661
Ref: ライブラリ<194>-Footnote-1197007728
Ref: ライブラリ<194>-Footnote-1207007795
Ref: ライブラリ<194>-Footnote-1217007862
Ref: ライブラリ<194>-Footnote-1227007929
Ref: ライブラリ<194>-Footnote-1237007996
Ref: ライブラリ<194>-Footnote-1247008063
Ref: ライブラリ<194>-Footnote-1257008130
Ref: ライブラリ<194>-Footnote-1267008197
Ref: ライブラリ<194>-Footnote-1277008264
Ref: ライブラリ<194>-Footnote-1287008331
Ref: ライブラリ<194>-Footnote-1297008398
Ref: ライブラリ<194>-Footnote-1307008465
Ref: ライブラリ<194>-Footnote-1317008532
Ref: ライブラリ<194>-Footnote-1327008599
Ref: ライブラリ<194>-Footnote-1337008666
Ref: ライブラリ<194>-Footnote-1347008733
Ref: ライブラリ<194>-Footnote-1357008800
Ref: ライブラリ<194>-Footnote-1367008867
Ref: ライブラリ<194>-Footnote-1377008934
Ref: ライブラリ<194>-Footnote-1387009001
Ref: ライブラリ<194>-Footnote-1397009068
Ref: ライブラリ<194>-Footnote-1407009135
Ref: ライブラリ<194>-Footnote-1417009202
Ref: ライブラリ<194>-Footnote-1427009269
Ref: ライブラリ<194>-Footnote-1437009336
Ref: ライブラリ<194>-Footnote-1447009403
Ref: ライブラリ<194>-Footnote-1457009469
Ref: ライブラリ<194>-Footnote-1467009536
Ref: ライブラリ<194>-Footnote-1477009603
Ref: ライブラリ<194>-Footnote-1487009670
Ref: ライブラリ<194>-Footnote-1497009737
Ref: ライブラリ<194>-Footnote-1507009804
Ref: ライブラリ<194>-Footnote-1517009870
Ref: ライブラリ<194>-Footnote-1527009937
Ref: ライブラリ<194>-Footnote-1537010004
Ref: ライブラリ<194>-Footnote-1547010071
Ref: ライブラリ<194>-Footnote-1557010138
Ref: ライブラリ<194>-Footnote-1567010205
Ref: ライブラリ<194>-Footnote-1577010272
Ref: ライブラリ<194>-Footnote-1587010339
Ref: ライブラリ<194>-Footnote-1597010406
Ref: ライブラリ<194>-Footnote-1607010473
Ref: ライブラリ<194>-Footnote-1617010539
Ref: ライブラリ<194>-Footnote-1627010606
Ref: ライブラリ<194>-Footnote-1637010673
Ref: ライブラリ<194>-Footnote-1647010740
Ref: ライブラリ<194>-Footnote-1657010807
Ref: ライブラリ<194>-Footnote-1667010874
Ref: ライブラリ<194>-Footnote-1677010941
Ref: ライブラリ<194>-Footnote-1687011008
Ref: ライブラリ<194>-Footnote-1697011075
Ref: ライブラリ<194>-Footnote-1707011142
Ref: ライブラリ<194>-Footnote-1717011209
Ref: ライブラリ<194>-Footnote-1727011276
Ref: ライブラリ<194>-Footnote-1737011343
Ref: ライブラリ<194>-Footnote-1747011410
Ref: ライブラリ<194>-Footnote-1757011477
Ref: ライブラリ<194>-Footnote-1767011544
Ref: ライブラリ<194>-Footnote-1777011611
Ref: ライブラリ<194>-Footnote-1787011678
Ref: ライブラリ<194>-Footnote-1797011745
Ref: ライブラリ<194>-Footnote-1807011812
Ref: ライブラリ<194>-Footnote-1817011879
Ref: ライブラリ<194>-Footnote-1827011946
Ref: ライブラリ<194>-Footnote-1837012013
Ref: ライブラリ<194>-Footnote-1847012080
Ref: ライブラリ<194>-Footnote-1857012147
Ref: ライブラリ<194>-Footnote-1867012214
Ref: ライブラリ<194>-Footnote-1877012281
Ref: ライブラリ<194>-Footnote-1887012348
Ref: ライブラリ<194>-Footnote-1897012415
Ref: ライブラリ<194>-Footnote-1907012482
Ref: ライブラリ<194>-Footnote-1917012549
Ref: ライブラリ<194>-Footnote-1927012616
Ref: ライブラリ<194>-Footnote-1937012683
Ref: ライブラリ<194>-Footnote-1947012750
Ref: ライブラリ<194>-Footnote-1957012817
Ref: ライブラリ<194>-Footnote-1967012884
Ref: ライブラリ<194>-Footnote-1977012951
Ref: ライブラリ<194>-Footnote-1987013018
Ref: ライブラリ<194>-Footnote-1997013085
Ref: ライブラリ<194>-Footnote-2007013152
Ref: ライブラリ<194>-Footnote-2017013219
Ref: ライブラリ<194>-Footnote-2027013286
Ref: ライブラリ<194>-Footnote-2037013353
Ref: ライブラリ<194>-Footnote-2047013420
Ref: ライブラリ<194>-Footnote-2057013487
Ref: ライブラリ<194>-Footnote-2067013554
Ref: ライブラリ<194>-Footnote-2077013621
Ref: ライブラリ<194>-Footnote-2087013688
Ref: ライブラリ<194>-Footnote-2097013754
Ref: ライブラリ<194>-Footnote-2107013820
Ref: ライブラリ<194>-Footnote-2117013887
Ref: ライブラリ<194>-Footnote-2127013954
Ref: ライブラリ<194>-Footnote-2137014021
Ref: ライブラリ<194>-Footnote-2147014088
Ref: ライブラリ<194>-Footnote-2157014155
Ref: ライブラリ<194>-Footnote-2167014222
Ref: ライブラリ<194>-Footnote-2177014289
Ref: ライブラリ<194>-Footnote-2187014356
Ref: ライブラリ<194>-Footnote-2197014423
Ref: ライブラリ<194>-Footnote-2207014490
Ref: ライブラリ<194>-Footnote-2217014557
Ref: ライブラリ<194>-Footnote-2227014624
Ref: ライブラリ<194>-Footnote-2237014691
Ref: ライブラリ<194>-Footnote-2247014758
Node: IDLE<57>7014825
Ref: whatsnew/changelog id9897014950
Ref: 21467014950
Ref: IDLE<57>-Footnote-17020481
Ref: IDLE<57>-Footnote-27020546
Ref: IDLE<57>-Footnote-37020611
Ref: IDLE<57>-Footnote-47020676
Ref: IDLE<57>-Footnote-57020741
Ref: IDLE<57>-Footnote-67020806
Ref: IDLE<57>-Footnote-77020871
Ref: IDLE<57>-Footnote-87020936
Ref: IDLE<57>-Footnote-97021001
Ref: IDLE<57>-Footnote-107021066
Ref: IDLE<57>-Footnote-117021132
Ref: IDLE<57>-Footnote-127021198
Ref: IDLE<57>-Footnote-137021264
Ref: IDLE<57>-Footnote-147021330
Ref: IDLE<57>-Footnote-157021396
Ref: IDLE<57>-Footnote-167021462
Ref: IDLE<57>-Footnote-177021528
Ref: IDLE<57>-Footnote-187021594
Ref: IDLE<57>-Footnote-197021660
Ref: IDLE<57>-Footnote-207021726
Ref: IDLE<57>-Footnote-217021792
Ref: IDLE<57>-Footnote-227021858
Ref: IDLE<57>-Footnote-237021924
Ref: IDLE<57>-Footnote-247021990
Ref: IDLE<57>-Footnote-257022056
Ref: IDLE<57>-Footnote-267022122
Ref: IDLE<57>-Footnote-277022188
Ref: IDLE<57>-Footnote-287022254
Node: ドキュメント<77>7022320
Ref: whatsnew/changelog id9907022438
Ref: 21477022438
Ref: ドキュメント<77>-Footnote-17023226
Ref: ドキュメント<77>-Footnote-27023291
Ref: ドキュメント<77>-Footnote-37023355
Ref: ドキュメント<77>-Footnote-47023420
Ref: ドキュメント<77>-Footnote-57023485
Node: テスト<82>7023550
Ref: whatsnew/changelog id9917023673
Ref: 21487023673
Ref: テスト<82>-Footnote-17025421
Ref: テスト<82>-Footnote-27025486
Ref: テスト<82>-Footnote-37025551
Ref: テスト<82>-Footnote-47025616
Ref: テスト<82>-Footnote-57025681
Ref: テスト<82>-Footnote-67025746
Ref: テスト<82>-Footnote-77025811
Ref: テスト<82>-Footnote-87025876
Ref: テスト<82>-Footnote-97025941
Ref: テスト<82>-Footnote-107026006
Ref: テスト<82>-Footnote-117026072
Ref: テスト<82>-Footnote-127026138
Ref: テスト<82>-Footnote-137026204
Node: ビルド<89>7026270
Ref: whatsnew/changelog id9927026382
Ref: 21497026382
Ref: ビルド<89>-Footnote-17029111
Ref: ビルド<89>-Footnote-27029176
Ref: ビルド<89>-Footnote-37029241
Ref: ビルド<89>-Footnote-47029306
Ref: ビルド<89>-Footnote-57029371
Ref: ビルド<89>-Footnote-67029436
Ref: ビルド<89>-Footnote-77029501
Ref: ビルド<89>-Footnote-87029566
Ref: ビルド<89>-Footnote-97029631
Ref: ビルド<89>-Footnote-107029696
Ref: ビルド<89>-Footnote-117029762
Ref: ビルド<89>-Footnote-127029828
Ref: ビルド<89>-Footnote-137029894
Ref: ビルド<89>-Footnote-147029960
Ref: ビルド<89>-Footnote-157030026
Ref: ビルド<89>-Footnote-167030092
Ref: ビルド<89>-Footnote-177030158
Ref: ビルド<89>-Footnote-187030224
Ref: ビルド<89>-Footnote-197030290
Node: Windows<76>7030356
Ref: whatsnew/changelog id9937030470
Ref: 214a7030470
Ref: Windows<76>-Footnote-17031116
Ref: Windows<76>-Footnote-27031181
Ref: Windows<76>-Footnote-37031246
Ref: Windows<76>-Footnote-47031311
Ref: Windows<76>-Footnote-57031376
Ref: Windows<76>-Footnote-67031441
Node: Tools/Demos<52>7031506
Ref: whatsnew/changelog id9947031616
Ref: 214b7031616
Ref: Tools/Demos<52>-Footnote-17032402
Ref: Tools/Demos<52>-Footnote-27032467
Ref: Tools/Demos<52>-Footnote-37032532
Ref: Tools/Demos<52>-Footnote-47032597
Ref: Tools/Demos<52>-Footnote-57032662
Ref: Tools/Demos<52>-Footnote-67032727
Node: C API<76>7032792
Ref: whatsnew/changelog id9957032882
Ref: 214c7032882
Ref: C API<76>-Footnote-17033371
Ref: C API<76>-Footnote-27033436
Node: Python 3 5 5 final7033501
Ref: whatsnew/changelog python-3-5-5-final7033638
Ref: 214d7033638
Node: Python 3 5 5 release candidate 17033766
Ref: whatsnew/changelog python-3-5-5-release-candidate-17033901
Ref: 214e7033901
Node: セキュリティ<56>7034154
Ref: whatsnew/changelog id9967034276
Ref: 214f7034276
Ref: セキュリティ<56>-Footnote-17035559
Ref: セキュリティ<56>-Footnote-27035624
Ref: セキュリティ<56>-Footnote-37035689
Ref: セキュリティ<56>-Footnote-47035754
Ref: セキュリティ<56>-Footnote-57035819
Ref: セキュリティ<56>-Footnote-67035877
Node: Core and Builtins<194>7035942
Ref: whatsnew/changelog id9977036093
Ref: 21507036093
Ref: Core and Builtins<194>-Footnote-17036316
Node: ライブラリ<195>7036381
Ref: whatsnew/changelog id9987036501
Ref: 21517036501
Ref: ライブラリ<195>-Footnote-17037039
Ref: ライブラリ<195>-Footnote-27037104
Node: Python 3 5 4 final7037169
Ref: whatsnew/changelog python-3-5-4-final7037318
Ref: 21527037318
Node: ライブラリ<196>7037452
Ref: whatsnew/changelog id9997037527
Ref: 21537037527
Ref: ライブラリ<196>-Footnote-17037736
Node: Python 3 5 4 release candidate 17037801
Ref: whatsnew/changelog python-3-5-4-release-candidate-17037936
Ref: 21547037936
Node: セキュリティ<57>7038337
Ref: whatsnew/changelog id10007038459
Ref: 21557038459
Ref: セキュリティ<57>-Footnote-17039797
Ref: セキュリティ<57>-Footnote-27039862
Ref: セキュリティ<57>-Footnote-37039927
Ref: セキュリティ<57>-Footnote-47039982
Ref: セキュリティ<57>-Footnote-57040037
Ref: セキュリティ<57>-Footnote-67040092
Ref: セキュリティ<57>-Footnote-77040147
Ref: セキュリティ<57>-Footnote-87040202
Ref: セキュリティ<57>-Footnote-97040257
Ref: セキュリティ<57>-Footnote-107040322
Ref: セキュリティ<57>-Footnote-117040388
Ref: セキュリティ<57>-Footnote-127040444
Node: Core and Builtins<195>7040500
Ref: whatsnew/changelog id10017040651
Ref: 21567040651
Ref: Core and Builtins<195>-Footnote-17042908
Ref: Core and Builtins<195>-Footnote-27042973
Ref: Core and Builtins<195>-Footnote-37043038
Ref: Core and Builtins<195>-Footnote-47043103
Ref: Core and Builtins<195>-Footnote-57043168
Ref: Core and Builtins<195>-Footnote-67043233
Ref: Core and Builtins<195>-Footnote-77043298
Ref: Core and Builtins<195>-Footnote-87043363
Ref: Core and Builtins<195>-Footnote-97043428
Ref: Core and Builtins<195>-Footnote-107043493
Ref: Core and Builtins<195>-Footnote-117043559
Ref: Core and Builtins<195>-Footnote-127043625
Ref: Core and Builtins<195>-Footnote-137043691
Ref: Core and Builtins<195>-Footnote-147043757
Ref: Core and Builtins<195>-Footnote-157043823
Node: ライブラリ<197>7043889
Ref: whatsnew/changelog id10027044040
Ref: 21577044040
Ref: ライブラリ<197>-Footnote-17054214
Ref: ライブラリ<197>-Footnote-27054279
Ref: ライブラリ<197>-Footnote-37054344
Ref: ライブラリ<197>-Footnote-47054409
Ref: ライブラリ<197>-Footnote-57054474
Ref: ライブラリ<197>-Footnote-67054539
Ref: ライブラリ<197>-Footnote-77054604
Ref: ライブラリ<197>-Footnote-87054669
Ref: ライブラリ<197>-Footnote-97054734
Ref: ライブラリ<197>-Footnote-107054799
Ref: ライブラリ<197>-Footnote-117054865
Ref: ライブラリ<197>-Footnote-127054931
Ref: ライブラリ<197>-Footnote-137054997
Ref: ライブラリ<197>-Footnote-147055063
Ref: ライブラリ<197>-Footnote-157055129
Ref: ライブラリ<197>-Footnote-167055195
Ref: ライブラリ<197>-Footnote-177055261
Ref: ライブラリ<197>-Footnote-187055327
Ref: ライブラリ<197>-Footnote-197055393
Ref: ライブラリ<197>-Footnote-207055459
Ref: ライブラリ<197>-Footnote-217055525
Ref: ライブラリ<197>-Footnote-227055591
Ref: ライブラリ<197>-Footnote-237055657
Ref: ライブラリ<197>-Footnote-247055723
Ref: ライブラリ<197>-Footnote-257055789
Ref: ライブラリ<197>-Footnote-267055855
Ref: ライブラリ<197>-Footnote-277055921
Ref: ライブラリ<197>-Footnote-287055987
Ref: ライブラリ<197>-Footnote-297056053
Ref: ライブラリ<197>-Footnote-307056119
Ref: ライブラリ<197>-Footnote-317056185
Ref: ライブラリ<197>-Footnote-327056251
Ref: ライブラリ<197>-Footnote-337056317
Ref: ライブラリ<197>-Footnote-347056383
Ref: ライブラリ<197>-Footnote-357056449
Ref: ライブラリ<197>-Footnote-367056515
Ref: ライブラリ<197>-Footnote-377056581
Ref: ライブラリ<197>-Footnote-387056647
Ref: ライブラリ<197>-Footnote-397056713
Ref: ライブラリ<197>-Footnote-407056779
Ref: ライブラリ<197>-Footnote-417056845
Ref: ライブラリ<197>-Footnote-427056911
Ref: ライブラリ<197>-Footnote-437056977
Ref: ライブラリ<197>-Footnote-447057043
Ref: ライブラリ<197>-Footnote-457057109
Ref: ライブラリ<197>-Footnote-467057175
Ref: ライブラリ<197>-Footnote-477057241
Ref: ライブラリ<197>-Footnote-487057307
Ref: ライブラリ<197>-Footnote-497057373
Ref: ライブラリ<197>-Footnote-507057439
Ref: ライブラリ<197>-Footnote-517057505
Ref: ライブラリ<197>-Footnote-527057571
Ref: ライブラリ<197>-Footnote-537057637
Ref: ライブラリ<197>-Footnote-547057703
Ref: ライブラリ<197>-Footnote-557057768
Ref: ライブラリ<197>-Footnote-567057834
Ref: ライブラリ<197>-Footnote-577057900
Ref: ライブラリ<197>-Footnote-587057966
Ref: ライブラリ<197>-Footnote-597058032
Ref: ライブラリ<197>-Footnote-607058098
Ref: ライブラリ<197>-Footnote-617058164
Ref: ライブラリ<197>-Footnote-627058230
Ref: ライブラリ<197>-Footnote-637058296
Ref: ライブラリ<197>-Footnote-647058362
Ref: ライブラリ<197>-Footnote-657058428
Ref: ライブラリ<197>-Footnote-667058494
Ref: ライブラリ<197>-Footnote-677058560
Ref: ライブラリ<197>-Footnote-687058626
Ref: ライブラリ<197>-Footnote-697058692
Ref: ライブラリ<197>-Footnote-707058758
Ref: ライブラリ<197>-Footnote-717058824
Ref: ライブラリ<197>-Footnote-727058890
Ref: ライブラリ<197>-Footnote-737058956
Ref: ライブラリ<197>-Footnote-747059022
Node: ドキュメント<78>7059088
Ref: whatsnew/changelog id10037059230
Ref: 21587059230
Ref: ドキュメント<78>-Footnote-17059946
Ref: ドキュメント<78>-Footnote-27060011
Ref: ドキュメント<78>-Footnote-37060076
Ref: ドキュメント<78>-Footnote-47060141
Ref: ドキュメント<78>-Footnote-57060206
Ref: ドキュメント<78>-Footnote-67060271
Node: テスト<83>7060336
Ref: whatsnew/changelog id10047060471
Ref: 21597060471
Ref: テスト<83>-Footnote-17062555
Ref: テスト<83>-Footnote-27062620
Ref: テスト<83>-Footnote-37062685
Ref: テスト<83>-Footnote-47062750
Ref: テスト<83>-Footnote-57062815
Ref: テスト<83>-Footnote-67062880
Ref: テスト<83>-Footnote-77062945
Ref: テスト<83>-Footnote-87063010
Ref: テスト<83>-Footnote-97063075
Node: ビルド<90>7063140
Ref: whatsnew/changelog id10057063264
Ref: 215a7063264
Ref: ビルド<90>-Footnote-17063783
Ref: ビルド<90>-Footnote-27063848
Ref: ビルド<90>-Footnote-37063913
Node: Windows<77>7063978
Ref: whatsnew/changelog id10067064098
Ref: 215b7064098
Ref: Windows<77>-Footnote-17064358
Ref: Windows<77>-Footnote-27064423
Node: C API<77>7064488
Ref: whatsnew/changelog id10077064586
Ref: 215c7064586
Ref: C API<77>-Footnote-17065195
Ref: C API<77>-Footnote-27065260
Node: Python 3 5 3 final7065325
Ref: whatsnew/changelog python-3-5-3-final7065474
Ref: 215d7065474
Node: Python 3 5 3 release candidate 17065621
Ref: whatsnew/changelog python-3-5-3-release-candidate-17065756
Ref: 215e7065756
Node: セキュリティ<58>7066207
Ref: whatsnew/changelog id10087066329
Ref: 215f7066329
Ref: セキュリティ<58>-Footnote-17066723
Ref: セキュリティ<58>-Footnote-27066788
Node: Core and Builtins<196>7066853
Ref: whatsnew/changelog id10097067004
Ref: 21607067004
Ref: Core and Builtins<196>-Footnote-17072436
Ref: Core and Builtins<196>-Footnote-27072501
Ref: Core and Builtins<196>-Footnote-37072566
Ref: Core and Builtins<196>-Footnote-47072631
Ref: Core and Builtins<196>-Footnote-57072696
Ref: Core and Builtins<196>-Footnote-67072761
Ref: Core and Builtins<196>-Footnote-77072826
Ref: Core and Builtins<196>-Footnote-87072891
Ref: Core and Builtins<196>-Footnote-97072956
Ref: Core and Builtins<196>-Footnote-107073021
Ref: Core and Builtins<196>-Footnote-117073087
Ref: Core and Builtins<196>-Footnote-127073153
Ref: Core and Builtins<196>-Footnote-137073219
Ref: Core and Builtins<196>-Footnote-147073285
Ref: Core and Builtins<196>-Footnote-157073351
Ref: Core and Builtins<196>-Footnote-167073417
Ref: Core and Builtins<196>-Footnote-177073483
Ref: Core and Builtins<196>-Footnote-187073549
Ref: Core and Builtins<196>-Footnote-197073615
Ref: Core and Builtins<196>-Footnote-207073681
Ref: Core and Builtins<196>-Footnote-217073747
Ref: Core and Builtins<196>-Footnote-227073813
Ref: Core and Builtins<196>-Footnote-237073879
Ref: Core and Builtins<196>-Footnote-247073945
Ref: Core and Builtins<196>-Footnote-257074011
Ref: Core and Builtins<196>-Footnote-267074077
Ref: Core and Builtins<196>-Footnote-277074143
Ref: Core and Builtins<196>-Footnote-287074209
Ref: Core and Builtins<196>-Footnote-297074275
Ref: Core and Builtins<196>-Footnote-307074341
Ref: Core and Builtins<196>-Footnote-317074407
Ref: Core and Builtins<196>-Footnote-327074473
Ref: Core and Builtins<196>-Footnote-337074539
Ref: Core and Builtins<196>-Footnote-347074605
Ref: Core and Builtins<196>-Footnote-357074671
Ref: Core and Builtins<196>-Footnote-367074737
Ref: Core and Builtins<196>-Footnote-377074803
Ref: Core and Builtins<196>-Footnote-387074869
Ref: Core and Builtins<196>-Footnote-397074935
Ref: Core and Builtins<196>-Footnote-407075001
Ref: Core and Builtins<196>-Footnote-417075067
Ref: Core and Builtins<196>-Footnote-427075133
Ref: Core and Builtins<196>-Footnote-437075199
Node: ライブラリ<198>7075265
Ref: whatsnew/changelog id10107075402
Ref: 21617075402
Ref: ライブラリ<198>-Footnote-17091345
Ref: ライブラリ<198>-Footnote-27091410
Ref: ライブラリ<198>-Footnote-37091475
Ref: ライブラリ<198>-Footnote-47091540
Ref: ライブラリ<198>-Footnote-57091605
Ref: ライブラリ<198>-Footnote-67091669
Ref: ライブラリ<198>-Footnote-77091734
Ref: ライブラリ<198>-Footnote-87091799
Ref: ライブラリ<198>-Footnote-97091864
Ref: ライブラリ<198>-Footnote-107091929
Ref: ライブラリ<198>-Footnote-117091995
Ref: ライブラリ<198>-Footnote-127092061
Ref: ライブラリ<198>-Footnote-137092127
Ref: ライブラリ<198>-Footnote-147092193
Ref: ライブラリ<198>-Footnote-157092259
Ref: ライブラリ<198>-Footnote-167092325
Ref: ライブラリ<198>-Footnote-177092391
Ref: ライブラリ<198>-Footnote-187092457
Ref: ライブラリ<198>-Footnote-197092523
Ref: ライブラリ<198>-Footnote-207092589
Ref: ライブラリ<198>-Footnote-217092655
Ref: ライブラリ<198>-Footnote-227092721
Ref: ライブラリ<198>-Footnote-237092787
Ref: ライブラリ<198>-Footnote-247092853
Ref: ライブラリ<198>-Footnote-257092919
Ref: ライブラリ<198>-Footnote-267092985
Ref: ライブラリ<198>-Footnote-277093051
Ref: ライブラリ<198>-Footnote-287093117
Ref: ライブラリ<198>-Footnote-297093183
Ref: ライブラリ<198>-Footnote-307093249
Ref: ライブラリ<198>-Footnote-317093315
Ref: ライブラリ<198>-Footnote-327093381
Ref: ライブラリ<198>-Footnote-337093449
Ref: ライブラリ<198>-Footnote-347093515
Ref: ライブラリ<198>-Footnote-357093581
Ref: ライブラリ<198>-Footnote-367093647
Ref: ライブラリ<198>-Footnote-377093713
Ref: ライブラリ<198>-Footnote-387093779
Ref: ライブラリ<198>-Footnote-397093845
Ref: ライブラリ<198>-Footnote-407093911
Ref: ライブラリ<198>-Footnote-417093977
Ref: ライブラリ<198>-Footnote-427094043
Ref: ライブラリ<198>-Footnote-437094109
Ref: ライブラリ<198>-Footnote-447094175
Ref: ライブラリ<198>-Footnote-457094241
Ref: ライブラリ<198>-Footnote-467094307
Ref: ライブラリ<198>-Footnote-477094373
Ref: ライブラリ<198>-Footnote-487094439
Ref: ライブラリ<198>-Footnote-497094505
Ref: ライブラリ<198>-Footnote-507094571
Ref: ライブラリ<198>-Footnote-517094637
Ref: ライブラリ<198>-Footnote-527094703
Ref: ライブラリ<198>-Footnote-537094769
Ref: ライブラリ<198>-Footnote-547094835
Ref: ライブラリ<198>-Footnote-557094901
Ref: ライブラリ<198>-Footnote-567094967
Ref: ライブラリ<198>-Footnote-577095033
Ref: ライブラリ<198>-Footnote-587095099
Ref: ライブラリ<198>-Footnote-597095165
Ref: ライブラリ<198>-Footnote-607095231
Ref: ライブラリ<198>-Footnote-617095287
Ref: ライブラリ<198>-Footnote-627095353
Ref: ライブラリ<198>-Footnote-637095419
Ref: ライブラリ<198>-Footnote-647095485
Ref: ライブラリ<198>-Footnote-657095551
Ref: ライブラリ<198>-Footnote-667095617
Ref: ライブラリ<198>-Footnote-677095683
Ref: ライブラリ<198>-Footnote-687095749
Ref: ライブラリ<198>-Footnote-697095815
Ref: ライブラリ<198>-Footnote-707095881
Ref: ライブラリ<198>-Footnote-717095947
Ref: ライブラリ<198>-Footnote-727096013
Ref: ライブラリ<198>-Footnote-737096078
Ref: ライブラリ<198>-Footnote-747096144
Ref: ライブラリ<198>-Footnote-757096210
Ref: ライブラリ<198>-Footnote-767096276
Ref: ライブラリ<198>-Footnote-777096342
Ref: ライブラリ<198>-Footnote-787096408
Ref: ライブラリ<198>-Footnote-797096474
Ref: ライブラリ<198>-Footnote-807096540
Ref: ライブラリ<198>-Footnote-817096599
Ref: ライブラリ<198>-Footnote-827096665
Ref: ライブラリ<198>-Footnote-837096731
Ref: ライブラリ<198>-Footnote-847096797
Ref: ライブラリ<198>-Footnote-857096863
Ref: ライブラリ<198>-Footnote-867096929
Ref: ライブラリ<198>-Footnote-877096995
Ref: ライブラリ<198>-Footnote-887097061
Ref: ライブラリ<198>-Footnote-897097127
Ref: ライブラリ<198>-Footnote-907097193
Ref: ライブラリ<198>-Footnote-917097259
Ref: ライブラリ<198>-Footnote-927097325
Ref: ライブラリ<198>-Footnote-937097391
Ref: ライブラリ<198>-Footnote-947097457
Ref: ライブラリ<198>-Footnote-957097523
Ref: ライブラリ<198>-Footnote-967097589
Ref: ライブラリ<198>-Footnote-977097655
Ref: ライブラリ<198>-Footnote-987097698
Ref: ライブラリ<198>-Footnote-997097764
Ref: ライブラリ<198>-Footnote-1007097830
Ref: ライブラリ<198>-Footnote-1017097897
Ref: ライブラリ<198>-Footnote-1027097964
Ref: ライブラリ<198>-Footnote-1037098031
Ref: ライブラリ<198>-Footnote-1047098098
Ref: ライブラリ<198>-Footnote-1057098165
Ref: ライブラリ<198>-Footnote-1067098232
Ref: ライブラリ<198>-Footnote-1077098299
Ref: ライブラリ<198>-Footnote-1087098366
Ref: ライブラリ<198>-Footnote-1097098433
Ref: ライブラリ<198>-Footnote-1107098500
Ref: ライブラリ<198>-Footnote-1117098567
Ref: ライブラリ<198>-Footnote-1127098634
Ref: ライブラリ<198>-Footnote-1137098701
Ref: ライブラリ<198>-Footnote-1147098768
Ref: ライブラリ<198>-Footnote-1157098835
Ref: ライブラリ<198>-Footnote-1167098902
Ref: ライブラリ<198>-Footnote-1177098969
Ref: ライブラリ<198>-Footnote-1187099036
Ref: ライブラリ<198>-Footnote-1197099103
Ref: ライブラリ<198>-Footnote-1207099170
Ref: ライブラリ<198>-Footnote-1217099237
Ref: ライブラリ<198>-Footnote-1227099304
Ref: ライブラリ<198>-Footnote-1237099371
Ref: ライブラリ<198>-Footnote-1247099438
Ref: ライブラリ<198>-Footnote-1257099505
Ref: ライブラリ<198>-Footnote-1267099572
Node: IDLE<58>7099639
Ref: whatsnew/changelog id10117099763
Ref: 21627099763
Ref: IDLE<58>-Footnote-17101004
Ref: IDLE<58>-Footnote-27101069
Ref: IDLE<58>-Footnote-37101134
Ref: IDLE<58>-Footnote-47101199
Ref: IDLE<58>-Footnote-57101264
Ref: IDLE<58>-Footnote-67101329
Ref: IDLE<58>-Footnote-77101394
Ref: IDLE<58>-Footnote-87101459
Node: C API<78>7101524
Ref: whatsnew/changelog id10127101650
Ref: 21637101650
Ref: C API<78>-Footnote-17101982
Ref: C API<78>-Footnote-27102047
Node: ドキュメント<79>7102112
Ref: whatsnew/changelog id10137102243
Ref: 21647102243
Ref: ドキュメント<79>-Footnote-17102400
Node: テスト<84>7102465
Ref: whatsnew/changelog id10147102602
Ref: 21657102602
Ref: テスト<84>-Footnote-17103296
Ref: テスト<84>-Footnote-27103361
Ref: テスト<84>-Footnote-37103426
Ref: テスト<84>-Footnote-47103491
Ref: テスト<84>-Footnote-57103556
Ref: テスト<84>-Footnote-67103621
Node: Tools/Demos<53>7103686
Ref: whatsnew/changelog id10157103812
Ref: 21667103812
Ref: Tools/Demos<53>-Footnote-17104292
Ref: Tools/Demos<53>-Footnote-27104357
Ref: Tools/Demos<53>-Footnote-37104422
Node: Windows<78>7104487
Ref: whatsnew/changelog id10167104613
Ref: 21677104613
Ref: Windows<78>-Footnote-17105115
Ref: Windows<78>-Footnote-27105180
Ref: Windows<78>-Footnote-37105245
Ref: Windows<78>-Footnote-47105310
Ref: Windows<78>-Footnote-57105375
Node: ビルド<91>7105440
Ref: whatsnew/changelog id10177105542
Ref: 21687105542
Ref: ビルド<91>-Footnote-17108242
Ref: ビルド<91>-Footnote-27108307
Ref: ビルド<91>-Footnote-37108372
Ref: ビルド<91>-Footnote-47108437
Ref: ビルド<91>-Footnote-57108502
Ref: ビルド<91>-Footnote-67108567
Ref: ビルド<91>-Footnote-77108632
Ref: ビルド<91>-Footnote-87108697
Ref: ビルド<91>-Footnote-97108762
Ref: ビルド<91>-Footnote-107108827
Ref: ビルド<91>-Footnote-117108893
Ref: ビルド<91>-Footnote-127108959
Ref: ビルド<91>-Footnote-137109025
Ref: ビルド<91>-Footnote-147109091
Ref: ビルド<91>-Footnote-157109157
Ref: ビルド<91>-Footnote-167109223
Ref: ビルド<91>-Footnote-177109289
Ref: ビルド<91>-Footnote-187109355
Ref: ビルド<91>-Footnote-197109421
Ref: ビルド<91>-Footnote-207109487
Ref: ビルド<91>-Footnote-217109553
Ref: ビルド<91>-Footnote-227109619
Node: Python 3 5 2 final7109685
Ref: whatsnew/changelog python-3-5-2-final7109834
Ref: 21697109834
Node: Core and Builtins<197>7110020
Ref: whatsnew/changelog id10187110119
Ref: 216a7110119
Ref: Core and Builtins<197>-Footnote-17110279
Node: テスト<85>7110344
Ref: whatsnew/changelog id10197110460
Ref: 216b7110460
Ref: テスト<85>-Footnote-17110625
Node: IDLE<59>7110690
Ref: whatsnew/changelog id10207110775
Ref: 216c7110775
Ref: IDLE<59>-Footnote-17110931
Node: Python 3 5 2 release candidate 17110996
Ref: whatsnew/changelog python-3-5-2-release-candidate-17111131
Ref: 216d7111131
Node: セキュリティ<59>7111562
Ref: whatsnew/changelog id10217111684
Ref: 216e7111684
Ref: セキュリティ<59>-Footnote-17112607
Ref: セキュリティ<59>-Footnote-27112672
Ref: セキュリティ<59>-Footnote-37112727
Ref: セキュリティ<59>-Footnote-47112782
Ref: セキュリティ<59>-Footnote-57112847
Ref: セキュリティ<59>-Footnote-67112912
Ref: セキュリティ<59>-Footnote-77112977
Node: Core and Builtins<198>7113042
Ref: whatsnew/changelog id10227113193
Ref: 216f7113193
Ref: Core and Builtins<198>-Footnote-17119034
Ref: Core and Builtins<198>-Footnote-27119099
Ref: Core and Builtins<198>-Footnote-37119164
Ref: Core and Builtins<198>-Footnote-47119229
Ref: Core and Builtins<198>-Footnote-57119294
Ref: Core and Builtins<198>-Footnote-67119359
Ref: Core and Builtins<198>-Footnote-77119424
Ref: Core and Builtins<198>-Footnote-87119489
Ref: Core and Builtins<198>-Footnote-97119554
Ref: Core and Builtins<198>-Footnote-107119619
Ref: Core and Builtins<198>-Footnote-117119685
Ref: Core and Builtins<198>-Footnote-127119751
Ref: Core and Builtins<198>-Footnote-137119817
Ref: Core and Builtins<198>-Footnote-147119883
Ref: Core and Builtins<198>-Footnote-157119949
Ref: Core and Builtins<198>-Footnote-167120015
Ref: Core and Builtins<198>-Footnote-177120081
Ref: Core and Builtins<198>-Footnote-187120146
Ref: Core and Builtins<198>-Footnote-197120212
Ref: Core and Builtins<198>-Footnote-207120278
Ref: Core and Builtins<198>-Footnote-217120344
Ref: Core and Builtins<198>-Footnote-227120410
Ref: Core and Builtins<198>-Footnote-237120476
Ref: Core and Builtins<198>-Footnote-247120542
Ref: Core and Builtins<198>-Footnote-257120608
Ref: Core and Builtins<198>-Footnote-267120674
Ref: Core and Builtins<198>-Footnote-277120740
Ref: Core and Builtins<198>-Footnote-287120806
Ref: Core and Builtins<198>-Footnote-297120872
Ref: Core and Builtins<198>-Footnote-307120938
Ref: Core and Builtins<198>-Footnote-317121004
Ref: Core and Builtins<198>-Footnote-327121047
Ref: Core and Builtins<198>-Footnote-337121113
Ref: Core and Builtins<198>-Footnote-347121179
Ref: Core and Builtins<198>-Footnote-357121245
Ref: Core and Builtins<198>-Footnote-367121311
Ref: Core and Builtins<198>-Footnote-377121377
Ref: Core and Builtins<198>-Footnote-387121443
Node: ライブラリ<199>7121509
Ref: whatsnew/changelog id10237121646
Ref: 21707121646
Ref: ライブラリ<199>-Footnote-17138407
Ref: ライブラリ<199>-Footnote-27138472
Ref: ライブラリ<199>-Footnote-37138537
Ref: ライブラリ<199>-Footnote-47138579
Ref: ライブラリ<199>-Footnote-57138644
Ref: ライブラリ<199>-Footnote-67138709
Ref: ライブラリ<199>-Footnote-77138774
Ref: ライブラリ<199>-Footnote-87138839
Ref: ライブラリ<199>-Footnote-97138904
Ref: ライブラリ<199>-Footnote-107138969
Ref: ライブラリ<199>-Footnote-117139035
Ref: ライブラリ<199>-Footnote-127139101
Ref: ライブラリ<199>-Footnote-137139167
Ref: ライブラリ<199>-Footnote-147139233
Ref: ライブラリ<199>-Footnote-157139299
Ref: ライブラリ<199>-Footnote-167139365
Ref: ライブラリ<199>-Footnote-177139431
Ref: ライブラリ<199>-Footnote-187139497
Ref: ライブラリ<199>-Footnote-197139563
Ref: ライブラリ<199>-Footnote-207139629
Ref: ライブラリ<199>-Footnote-217139695
Ref: ライブラリ<199>-Footnote-227139761
Ref: ライブラリ<199>-Footnote-237139827
Ref: ライブラリ<199>-Footnote-247139893
Ref: ライブラリ<199>-Footnote-257139959
Ref: ライブラリ<199>-Footnote-267140025
Ref: ライブラリ<199>-Footnote-277140091
Ref: ライブラリ<199>-Footnote-287140157
Ref: ライブラリ<199>-Footnote-297140223
Ref: ライブラリ<199>-Footnote-307140289
Ref: ライブラリ<199>-Footnote-317140355
Ref: ライブラリ<199>-Footnote-327140421
Ref: ライブラリ<199>-Footnote-337140487
Ref: ライブラリ<199>-Footnote-347140553
Ref: ライブラリ<199>-Footnote-357140619
Ref: ライブラリ<199>-Footnote-367140685
Ref: ライブラリ<199>-Footnote-377140751
Ref: ライブラリ<199>-Footnote-387140817
Ref: ライブラリ<199>-Footnote-397140883
Ref: ライブラリ<199>-Footnote-407140949
Ref: ライブラリ<199>-Footnote-417141015
Ref: ライブラリ<199>-Footnote-427141081
Ref: ライブラリ<199>-Footnote-437141147
Ref: ライブラリ<199>-Footnote-447141213
Ref: ライブラリ<199>-Footnote-457141279
Ref: ライブラリ<199>-Footnote-467141345
Ref: ライブラリ<199>-Footnote-477141411
Ref: ライブラリ<199>-Footnote-487141477
Ref: ライブラリ<199>-Footnote-497141543
Ref: ライブラリ<199>-Footnote-507141609
Ref: ライブラリ<199>-Footnote-517141675
Ref: ライブラリ<199>-Footnote-527141741
Ref: ライブラリ<199>-Footnote-537141807
Ref: ライブラリ<199>-Footnote-547141873
Ref: ライブラリ<199>-Footnote-557141939
Ref: ライブラリ<199>-Footnote-567142005
Ref: ライブラリ<199>-Footnote-577142071
Ref: ライブラリ<199>-Footnote-587142137
Ref: ライブラリ<199>-Footnote-597142203
Ref: ライブラリ<199>-Footnote-607142269
Ref: ライブラリ<199>-Footnote-617142335
Ref: ライブラリ<199>-Footnote-627142400
Ref: ライブラリ<199>-Footnote-637142466
Ref: ライブラリ<199>-Footnote-647142532
Ref: ライブラリ<199>-Footnote-657142598
Ref: ライブラリ<199>-Footnote-667142664
Ref: ライブラリ<199>-Footnote-677142730
Ref: ライブラリ<199>-Footnote-687142796
Ref: ライブラリ<199>-Footnote-697142862
Ref: ライブラリ<199>-Footnote-707142928
Ref: ライブラリ<199>-Footnote-717142994
Ref: ライブラリ<199>-Footnote-727143060
Ref: ライブラリ<199>-Footnote-737143126
Ref: ライブラリ<199>-Footnote-747143192
Ref: ライブラリ<199>-Footnote-757143258
Ref: ライブラリ<199>-Footnote-767143324
Ref: ライブラリ<199>-Footnote-777143390
Ref: ライブラリ<199>-Footnote-787143456
Ref: ライブラリ<199>-Footnote-797143522
Ref: ライブラリ<199>-Footnote-807143588
Ref: ライブラリ<199>-Footnote-817143654
Ref: ライブラリ<199>-Footnote-827143720
Ref: ライブラリ<199>-Footnote-837143786
Ref: ライブラリ<199>-Footnote-847143852
Ref: ライブラリ<199>-Footnote-857143918
Ref: ライブラリ<199>-Footnote-867143984
Ref: ライブラリ<199>-Footnote-877144050
Ref: ライブラリ<199>-Footnote-887144116
Ref: ライブラリ<199>-Footnote-897144182
Ref: ライブラリ<199>-Footnote-907144248
Ref: ライブラリ<199>-Footnote-917144314
Ref: ライブラリ<199>-Footnote-927144380
Ref: ライブラリ<199>-Footnote-937144446
Ref: ライブラリ<199>-Footnote-947144512
Ref: ライブラリ<199>-Footnote-957144578
Ref: ライブラリ<199>-Footnote-967144644
Ref: ライブラリ<199>-Footnote-977144710
Ref: ライブラリ<199>-Footnote-987144776
Ref: ライブラリ<199>-Footnote-997144842
Ref: ライブラリ<199>-Footnote-1007144908
Ref: ライブラリ<199>-Footnote-1017144975
Ref: ライブラリ<199>-Footnote-1027145041
Ref: ライブラリ<199>-Footnote-1037145108
Ref: ライブラリ<199>-Footnote-1047145175
Ref: ライブラリ<199>-Footnote-1057145242
Ref: ライブラリ<199>-Footnote-1067145309
Ref: ライブラリ<199>-Footnote-1077145376
Ref: ライブラリ<199>-Footnote-1087145443
Ref: ライブラリ<199>-Footnote-1097145510
Ref: ライブラリ<199>-Footnote-1107145577
Ref: ライブラリ<199>-Footnote-1117145644
Ref: ライブラリ<199>-Footnote-1127145711
Ref: ライブラリ<199>-Footnote-1137145778
Ref: ライブラリ<199>-Footnote-1147145845
Ref: ライブラリ<199>-Footnote-1157145912
Ref: ライブラリ<199>-Footnote-1167145979
Ref: ライブラリ<199>-Footnote-1177146046
Ref: ライブラリ<199>-Footnote-1187146113
Ref: ライブラリ<199>-Footnote-1197146180
Ref: ライブラリ<199>-Footnote-1207146247
Node: IDLE<60>7146314
Ref: whatsnew/changelog id10247146451
Ref: 21717146451
Ref: IDLE<60>-Footnote-17148786
Ref: IDLE<60>-Footnote-27148850
Ref: IDLE<60>-Footnote-37148915
Ref: IDLE<60>-Footnote-47148980
Ref: IDLE<60>-Footnote-57149045
Ref: IDLE<60>-Footnote-67149110
Ref: IDLE<60>-Footnote-77149175
Ref: IDLE<60>-Footnote-87149240
Ref: IDLE<60>-Footnote-97149305
Ref: IDLE<60>-Footnote-107149370
Ref: IDLE<60>-Footnote-117149436
Ref: IDLE<60>-Footnote-127149502
Ref: IDLE<60>-Footnote-137149568
Ref: IDLE<60>-Footnote-147149634
Ref: IDLE<60>-Footnote-157149700
Node: ドキュメント<80>7149766
Ref: whatsnew/changelog id10257149896
Ref: 21727149896
Ref: ドキュメント<80>-Footnote-17150856
Ref: ドキュメント<80>-Footnote-27150921
Ref: ドキュメント<80>-Footnote-37150986
Ref: ドキュメント<80>-Footnote-47151028
Ref: ドキュメント<80>-Footnote-57151093
Ref: ドキュメント<80>-Footnote-67151157
Ref: ドキュメント<80>-Footnote-77151222
Ref: ドキュメント<80>-Footnote-87151287
Node: テスト<86>7151352
Ref: whatsnew/changelog id10267151487
Ref: 21737151487
Ref: テスト<86>-Footnote-17152367
Ref: テスト<86>-Footnote-27152432
Ref: テスト<86>-Footnote-37152497
Ref: テスト<86>-Footnote-47152562
Ref: テスト<86>-Footnote-57152627
Ref: テスト<86>-Footnote-67152692
Ref: テスト<86>-Footnote-77152757
Node: ビルド<92>7152822
Ref: whatsnew/changelog id10277152946
Ref: 21747152946
Ref: ビルド<92>-Footnote-17155475
Ref: ビルド<92>-Footnote-27155540
Ref: ビルド<92>-Footnote-37155605
Ref: ビルド<92>-Footnote-47155670
Ref: ビルド<92>-Footnote-57155735
Ref: ビルド<92>-Footnote-67155800
Ref: ビルド<92>-Footnote-77155865
Ref: ビルド<92>-Footnote-87155930
Ref: ビルド<92>-Footnote-97155995
Ref: ビルド<92>-Footnote-107156060
Ref: ビルド<92>-Footnote-117156126
Ref: ビルド<92>-Footnote-127156192
Ref: ビルド<92>-Footnote-137156258
Ref: ビルド<92>-Footnote-147156324
Ref: ビルド<92>-Footnote-157156390
Ref: ビルド<92>-Footnote-167156456
Ref: ビルド<92>-Footnote-177156522
Node: Windows<79>7156588
Ref: whatsnew/changelog id10287156714
Ref: 21757156714
Ref: Windows<79>-Footnote-17157422
Ref: Windows<79>-Footnote-27157487
Ref: Windows<79>-Footnote-37157552
Ref: Windows<79>-Footnote-47157617
Ref: Windows<79>-Footnote-57157682
Ref: Windows<79>-Footnote-67157747
Node: Tools/Demos<54>7157812
Ref: whatsnew/changelog id10297157916
Ref: 21767157916
Ref: Tools/Demos<54>-Footnote-17158538
Ref: Tools/Demos<54>-Footnote-27158603
Ref: Tools/Demos<54>-Footnote-37158668
Ref: Tools/Demos<54>-Footnote-47158733
Node: Python 3 5 1 final7158798
Ref: whatsnew/changelog python-3-5-1-final7158947
Ref: 21777158947
Node: Core and Builtins<199>7159111
Ref: whatsnew/changelog id10307159208
Ref: 21787159208
Ref: Core and Builtins<199>-Footnote-17159394
Node: Windows<80>7159459
Ref: whatsnew/changelog id10317159556
Ref: 21797159556
Ref: Windows<80>-Footnote-17159748
Node: Python 3 5 1 release candidate 17159813
Ref: whatsnew/changelog python-3-5-1-release-candidate-17159948
Ref: 217a7159948
Node: Core and Builtins<200>7160333
Ref: whatsnew/changelog id10327160453
Ref: 217b7160453
Ref: Core and Builtins<200>-Footnote-17163591
Ref: Core and Builtins<200>-Footnote-27163656
Ref: Core and Builtins<200>-Footnote-37163721
Ref: Core and Builtins<200>-Footnote-47163786
Ref: Core and Builtins<200>-Footnote-57163851
Ref: Core and Builtins<200>-Footnote-67163916
Ref: Core and Builtins<200>-Footnote-77163981
Ref: Core and Builtins<200>-Footnote-87164046
Ref: Core and Builtins<200>-Footnote-97164111
Ref: Core and Builtins<200>-Footnote-107164176
Ref: Core and Builtins<200>-Footnote-117164242
Ref: Core and Builtins<200>-Footnote-127164308
Ref: Core and Builtins<200>-Footnote-137164374
Ref: Core and Builtins<200>-Footnote-147164440
Ref: Core and Builtins<200>-Footnote-157164506
Ref: Core and Builtins<200>-Footnote-167164572
Ref: Core and Builtins<200>-Footnote-177164638
Ref: Core and Builtins<200>-Footnote-187164704
Ref: Core and Builtins<200>-Footnote-197164770
Node: ライブラリ<200>7164836
Ref: whatsnew/changelog id10337164973
Ref: 217c7164973
Ref: ライブラリ<200>-Footnote-17175324
Ref: ライブラリ<200>-Footnote-27175389
Ref: ライブラリ<200>-Footnote-37175454
Ref: ライブラリ<200>-Footnote-47175519
Ref: ライブラリ<200>-Footnote-57175583
Ref: ライブラリ<200>-Footnote-67175648
Ref: ライブラリ<200>-Footnote-77175713
Ref: ライブラリ<200>-Footnote-87175778
Ref: ライブラリ<200>-Footnote-97175843
Ref: ライブラリ<200>-Footnote-107175908
Ref: ライブラリ<200>-Footnote-117175974
Ref: ライブラリ<200>-Footnote-127176040
Ref: ライブラリ<200>-Footnote-137176106
Ref: ライブラリ<200>-Footnote-147176172
Ref: ライブラリ<200>-Footnote-157176238
Ref: ライブラリ<200>-Footnote-167176304
Ref: ライブラリ<200>-Footnote-177176370
Ref: ライブラリ<200>-Footnote-187176436
Ref: ライブラリ<200>-Footnote-197176502
Ref: ライブラリ<200>-Footnote-207176568
Ref: ライブラリ<200>-Footnote-217176634
Ref: ライブラリ<200>-Footnote-227176700
Ref: ライブラリ<200>-Footnote-237176766
Ref: ライブラリ<200>-Footnote-247176832
Ref: ライブラリ<200>-Footnote-257176898
Ref: ライブラリ<200>-Footnote-267176964
Ref: ライブラリ<200>-Footnote-277177030
Ref: ライブラリ<200>-Footnote-287177096
Ref: ライブラリ<200>-Footnote-297177162
Ref: ライブラリ<200>-Footnote-307177228
Ref: ライブラリ<200>-Footnote-317177294
Ref: ライブラリ<200>-Footnote-327177360
Ref: ライブラリ<200>-Footnote-337177426
Ref: ライブラリ<200>-Footnote-347177492
Ref: ライブラリ<200>-Footnote-357177558
Ref: ライブラリ<200>-Footnote-367177624
Ref: ライブラリ<200>-Footnote-377177690
Ref: ライブラリ<200>-Footnote-387177756
Ref: ライブラリ<200>-Footnote-397177822
Ref: ライブラリ<200>-Footnote-407177888
Ref: ライブラリ<200>-Footnote-417177954
Ref: ライブラリ<200>-Footnote-427178020
Ref: ライブラリ<200>-Footnote-437178086
Ref: ライブラリ<200>-Footnote-447178152
Ref: ライブラリ<200>-Footnote-457178218
Ref: ライブラリ<200>-Footnote-467178284
Ref: ライブラリ<200>-Footnote-477178350
Ref: ライブラリ<200>-Footnote-487178416
Ref: ライブラリ<200>-Footnote-497178482
Ref: ライブラリ<200>-Footnote-507178548
Ref: ライブラリ<200>-Footnote-517178614
Ref: ライブラリ<200>-Footnote-527178680
Ref: ライブラリ<200>-Footnote-537178746
Ref: ライブラリ<200>-Footnote-547178812
Ref: ライブラリ<200>-Footnote-557178878
Ref: ライブラリ<200>-Footnote-567178944
Ref: ライブラリ<200>-Footnote-577179010
Ref: ライブラリ<200>-Footnote-587179076
Ref: ライブラリ<200>-Footnote-597179142
Ref: ライブラリ<200>-Footnote-607179208
Ref: ライブラリ<200>-Footnote-617179274
Ref: ライブラリ<200>-Footnote-627179340
Ref: ライブラリ<200>-Footnote-637179406
Ref: ライブラリ<200>-Footnote-647179472
Ref: ライブラリ<200>-Footnote-657179538
Ref: ライブラリ<200>-Footnote-667179604
Ref: ライブラリ<200>-Footnote-677179670
Ref: ライブラリ<200>-Footnote-687179736
Ref: ライブラリ<200>-Footnote-697179802
Ref: ライブラリ<200>-Footnote-707179868
Node: IDLE<61>7179934
Ref: whatsnew/changelog id10347180071
Ref: 217d7180071
Ref: IDLE<61>-Footnote-17184990
Ref: IDLE<61>-Footnote-27185055
Ref: IDLE<61>-Footnote-37185120
Ref: IDLE<61>-Footnote-47185185
Ref: IDLE<61>-Footnote-57185250
Ref: IDLE<61>-Footnote-67185315
Ref: IDLE<61>-Footnote-77185380
Ref: IDLE<61>-Footnote-87185445
Ref: IDLE<61>-Footnote-97185510
Ref: IDLE<61>-Footnote-107185575
Ref: IDLE<61>-Footnote-117185641
Ref: IDLE<61>-Footnote-127185707
Ref: IDLE<61>-Footnote-137185773
Ref: IDLE<61>-Footnote-147185839
Ref: IDLE<61>-Footnote-157185905
Ref: IDLE<61>-Footnote-167185971
Ref: IDLE<61>-Footnote-177186037
Ref: IDLE<61>-Footnote-187186103
Ref: IDLE<61>-Footnote-197186169
Ref: IDLE<61>-Footnote-207186235
Ref: IDLE<61>-Footnote-217186301
Ref: IDLE<61>-Footnote-227186367
Ref: IDLE<61>-Footnote-237186433
Ref: IDLE<61>-Footnote-247186499
Ref: IDLE<61>-Footnote-257186565
Node: ドキュメント<81>7186631
Ref: whatsnew/changelog id10357186761
Ref: 217e7186761
Ref: ドキュメント<81>-Footnote-17187838
Ref: ドキュメント<81>-Footnote-27187903
Ref: ドキュメント<81>-Footnote-37187968
Ref: ドキュメント<81>-Footnote-47188033
Ref: ドキュメント<81>-Footnote-57188098
Ref: ドキュメント<81>-Footnote-67188163
Node: テスト<87>7188228
Ref: whatsnew/changelog id10367188363
Ref: 217f7188363
Ref: テスト<87>-Footnote-17188877
Ref: テスト<87>-Footnote-27188942
Ref: テスト<87>-Footnote-37189007
Node: ビルド<93>7189072
Ref: whatsnew/changelog id10377189196
Ref: 21807189196
Ref: ビルド<93>-Footnote-17189628
Ref: ビルド<93>-Footnote-27189693
Ref: ビルド<93>-Footnote-37189758
Node: Windows<81>7189823
Ref: whatsnew/changelog id10387189949
Ref: 21817189949
Ref: Windows<81>-Footnote-17191224
Ref: Windows<81>-Footnote-27191289
Ref: Windows<81>-Footnote-37191354
Ref: Windows<81>-Footnote-47191419
Ref: Windows<81>-Footnote-57191484
Ref: Windows<81>-Footnote-67191549
Ref: Windows<81>-Footnote-77191614
Ref: Windows<81>-Footnote-87191679
Ref: Windows<81>-Footnote-97191744
Ref: Windows<81>-Footnote-107191809
Ref: Windows<81>-Footnote-117191875
Ref: Windows<81>-Footnote-127191941
Ref: Windows<81>-Footnote-137192007
Ref: Windows<81>-Footnote-147192073
Node: Tools/Demos<55>7192139
Ref: whatsnew/changelog id10397192243
Ref: 21827192243
Ref: Tools/Demos<55>-Footnote-17192393
Node: Python 3 5 0 final7192458
Ref: whatsnew/changelog python-3-5-0-final7192607
Ref: 21837192607
Node: ビルド<94>7192730
Ref: whatsnew/changelog id10407192798
Ref: 21847192798
Ref: ビルド<94>-Footnote-17192981
Node: Python 3 5 0 release candidate 47193046
Ref: whatsnew/changelog python-3-5-0-release-candidate-47193195
Ref: 21857193195
Node: ライブラリ<201>7193387
Ref: whatsnew/changelog id10417193498
Ref: 21867193498
Ref: ライブラリ<201>-Footnote-17193640
Node: ビルド<95>7193705
Ref: whatsnew/changelog id10427193816
Ref: 21877193816
Ref: ビルド<95>-Footnote-17194005
Node: Python 3 5 0 release candidate 37194070
Ref: whatsnew/changelog python-3-5-0-release-candidate-37194233
Ref: 21887194233
Node: Core and Builtins<201>7194442
Ref: whatsnew/changelog id10437194562
Ref: 21897194562
Ref: Core and Builtins<201>-Footnote-17194932
Ref: Core and Builtins<201>-Footnote-27194997
Ref: Core and Builtins<201>-Footnote-37195062
Ref: Core and Builtins<201>-Footnote-47195127
Node: ライブラリ<202>7195169
Ref: whatsnew/changelog id10447195289
Ref: 218a7195289
Ref: ライブラリ<202>-Footnote-17196076
Ref: ライブラリ<202>-Footnote-27196141
Ref: ライブラリ<202>-Footnote-37196206
Ref: ライブラリ<202>-Footnote-47196271
Ref: ライブラリ<202>-Footnote-57196336
Node: Python 3 5 0 release candidate 27196401
Ref: whatsnew/changelog python-3-5-0-release-candidate-27196564
Ref: 218b7196564
Node: Core and Builtins<202>7196773
Ref: whatsnew/changelog id10457196893
Ref: 218c7196893
Ref: Core and Builtins<202>-Footnote-17197435
Ref: Core and Builtins<202>-Footnote-27197500
Ref: Core and Builtins<202>-Footnote-37197565
Node: ライブラリ<203>7197630
Ref: whatsnew/changelog id10467197750
Ref: 218d7197750
Ref: ライブラリ<203>-Footnote-17198040
Ref: ライブラリ<203>-Footnote-27198105
Ref: ライブラリ<203>-Footnote-37198170
Node: Python 3 5 0 release candidate 17198235
Ref: whatsnew/changelog python-3-5-0-release-candidate-17198385
Ref: 218e7198385
Node: Core and Builtins<203>7198686
Ref: whatsnew/changelog id10477198806
Ref: 218f7198806
Ref: Core and Builtins<203>-Footnote-17198986
Node: ライブラリ<204>7199051
Ref: whatsnew/changelog id10487199188
Ref: 21907199188
Ref: ライブラリ<204>-Footnote-17200777
Ref: ライブラリ<204>-Footnote-27200842
Ref: ライブラリ<204>-Footnote-37200907
Ref: ライブラリ<204>-Footnote-47200972
Ref: ライブラリ<204>-Footnote-57201036
Ref: ライブラリ<204>-Footnote-67201101
Ref: ライブラリ<204>-Footnote-77201166
Ref: ライブラリ<204>-Footnote-87201231
Ref: ライブラリ<204>-Footnote-97201296
Ref: ライブラリ<204>-Footnote-107201361
Ref: ライブラリ<204>-Footnote-117201427
Ref: ライブラリ<204>-Footnote-127201493
Ref: ライブラリ<204>-Footnote-137201559
Ref: ライブラリ<204>-Footnote-147201625
Ref: ライブラリ<204>-Footnote-157201691
Node: IDLE<62>7201757
Ref: whatsnew/changelog id10497201894
Ref: 21917201894
Ref: IDLE<62>-Footnote-17202643
Ref: IDLE<62>-Footnote-27202708
Ref: IDLE<62>-Footnote-37202773
Ref: IDLE<62>-Footnote-47202838
Node: ドキュメント<82>7202903
Ref: whatsnew/changelog id10507203033
Ref: 21927203033
Ref: ドキュメント<82>-Footnote-17203699
Ref: ドキュメント<82>-Footnote-27203764
Ref: ドキュメント<82>-Footnote-37203829
Ref: ドキュメント<82>-Footnote-47203894
Node: テスト<88>7203959
Ref: whatsnew/changelog id10517204072
Ref: 21937204072
Ref: テスト<88>-Footnote-17204317
Node: Python 3 5 0 beta 47204382
Ref: whatsnew/changelog python-3-5-0-beta-47204519
Ref: 21947204519
Node: Core and Builtins<204>7204730
Ref: whatsnew/changelog id10527204837
Ref: 21957204837
Ref: Core and Builtins<204>-Footnote-17205640
Ref: Core and Builtins<204>-Footnote-27205705
Ref: Core and Builtins<204>-Footnote-37205770
Ref: Core and Builtins<204>-Footnote-47205812
Ref: Core and Builtins<204>-Footnote-57205877
Ref: Core and Builtins<204>-Footnote-67205942
Ref: Core and Builtins<204>-Footnote-77206007
Ref: Core and Builtins<204>-Footnote-87206072
Node: ライブラリ<205>7206137
Ref: whatsnew/changelog id10537206266
Ref: 21967206266
Ref: ライブラリ<205>-Footnote-17208548
Ref: ライブラリ<205>-Footnote-27208613
Ref: ライブラリ<205>-Footnote-37208678
Ref: ライブラリ<205>-Footnote-47208743
Ref: ライブラリ<205>-Footnote-57208808
Ref: ライブラリ<205>-Footnote-67208873
Ref: ライブラリ<205>-Footnote-77208938
Ref: ライブラリ<205>-Footnote-87209003
Ref: ライブラリ<205>-Footnote-97209068
Ref: ライブラリ<205>-Footnote-107209133
Ref: ライブラリ<205>-Footnote-117209199
Ref: ライブラリ<205>-Footnote-127209265
Ref: ライブラリ<205>-Footnote-137209331
Ref: ライブラリ<205>-Footnote-147209397
Ref: ライブラリ<205>-Footnote-157209463
Ref: ライブラリ<205>-Footnote-167209529
Ref: ライブラリ<205>-Footnote-177209595
Ref: ライブラリ<205>-Footnote-187209661
Ref: ライブラリ<205>-Footnote-197209727
Node: ビルド<96>7209793
Ref: whatsnew/changelog id10547209891
Ref: 21977209891
Ref: ビルド<96>-Footnote-17210061
Node: Python 3 5 0 beta 37210126
Ref: whatsnew/changelog python-3-5-0-beta-37210250
Ref: 21987210250
Node: Core and Builtins<205>7210535
Ref: whatsnew/changelog id10557210642
Ref: 21997210642
Ref: Core and Builtins<205>-Footnote-17211955
Ref: Core and Builtins<205>-Footnote-27212020
Ref: Core and Builtins<205>-Footnote-37212085
Ref: Core and Builtins<205>-Footnote-47212150
Ref: Core and Builtins<205>-Footnote-57212192
Ref: Core and Builtins<205>-Footnote-67212257
Node: ライブラリ<206>7212322
Ref: whatsnew/changelog id10567212451
Ref: 219a7212451
Ref: ライブラリ<206>-Footnote-17214410
Ref: ライブラリ<206>-Footnote-27214475
Ref: ライブラリ<206>-Footnote-37214540
Ref: ライブラリ<206>-Footnote-47214605
Ref: ライブラリ<206>-Footnote-57214670
Ref: ライブラリ<206>-Footnote-67214735
Ref: ライブラリ<206>-Footnote-77214800
Ref: ライブラリ<206>-Footnote-87214865
Ref: ライブラリ<206>-Footnote-97214930
Ref: ライブラリ<206>-Footnote-107214995
Ref: ライブラリ<206>-Footnote-117215061
Ref: ライブラリ<206>-Footnote-127215127
Ref: ライブラリ<206>-Footnote-137215193
Ref: ライブラリ<206>-Footnote-147215259
Ref: ライブラリ<206>-Footnote-157215325
Ref: ライブラリ<206>-Footnote-167215391
Ref: ライブラリ<206>-Footnote-177215457
Ref: ライブラリ<206>-Footnote-187215523
Node: テスト<89>7215589
Ref: whatsnew/changelog id10577215718
Ref: 219b7215718
Ref: テスト<89>-Footnote-17216005
Ref: テスト<89>-Footnote-27216070
Node: ドキュメント<83>7216135
Ref: whatsnew/changelog id10587216257
Ref: 219c7216257
Ref: ドキュメント<83>-Footnote-17216601
Ref: ドキュメント<83>-Footnote-27216666
Node: ビルド<97>7216731
Ref: whatsnew/changelog id10597216831
Ref: 219d7216831
Ref: ビルド<97>-Footnote-17217001
Node: Python 3 5 0 beta 27217066
Ref: whatsnew/changelog python-3-5-0-beta-27217190
Ref: 219e7217190
Node: Core and Builtins<206>7217373
Ref: whatsnew/changelog id10607217480
Ref: 219f7217480
Ref: Core and Builtins<206>-Footnote-17218233
Ref: Core and Builtins<206>-Footnote-27218298
Ref: Core and Builtins<206>-Footnote-37218363
Ref: Core and Builtins<206>-Footnote-47218428
Ref: Core and Builtins<206>-Footnote-57218493
Node: ライブラリ<207>7218558
Ref: whatsnew/changelog id10617218665
Ref: 21a07218665
Ref: ライブラリ<207>-Footnote-17219383
Ref: ライブラリ<207>-Footnote-27219448
Ref: ライブラリ<207>-Footnote-37219513
Ref: ライブラリ<207>-Footnote-47219555
Ref: ライブラリ<207>-Footnote-57219619
Ref: ライブラリ<207>-Footnote-67219684
Ref: ライブラリ<207>-Footnote-77219749
Node: Python 3 5 0 beta 17219814
Ref: whatsnew/changelog python-3-5-0-beta-17219939
Ref: 21a17219939
Node: Core and Builtins<207>7220246
Ref: whatsnew/changelog id10627220353
Ref: 21a27220353
Ref: Core and Builtins<207>-Footnote-17222226
Ref: Core and Builtins<207>-Footnote-27222291
Ref: Core and Builtins<207>-Footnote-37222356
Ref: Core and Builtins<207>-Footnote-47222421
Ref: Core and Builtins<207>-Footnote-57222486
Ref: Core and Builtins<207>-Footnote-67222551
Ref: Core and Builtins<207>-Footnote-77222616
Ref: Core and Builtins<207>-Footnote-87222681
Ref: Core and Builtins<207>-Footnote-97222746
Ref: Core and Builtins<207>-Footnote-107222811
Ref: Core and Builtins<207>-Footnote-117222876
Ref: Core and Builtins<207>-Footnote-127222942
Ref: Core and Builtins<207>-Footnote-137223008
Ref: Core and Builtins<207>-Footnote-147223074
Ref: Core and Builtins<207>-Footnote-157223140
Ref: Core and Builtins<207>-Footnote-167223206
Ref: Core and Builtins<207>-Footnote-177223272
Ref: Core and Builtins<207>-Footnote-187223337
Ref: Core and Builtins<207>-Footnote-197223403
Node: ライブラリ<208>7223469
Ref: whatsnew/changelog id10637223593
Ref: 21a37223593
Ref: ライブラリ<208>-Footnote-17231240
Ref: ライブラリ<208>-Footnote-27231305
Ref: ライブラリ<208>-Footnote-37231370
Ref: ライブラリ<208>-Footnote-47231435
Ref: ライブラリ<208>-Footnote-57231500
Ref: ライブラリ<208>-Footnote-67231565
Ref: ライブラリ<208>-Footnote-77231630
Ref: ライブラリ<208>-Footnote-87231695
Ref: ライブラリ<208>-Footnote-97231760
Ref: ライブラリ<208>-Footnote-107231825
Ref: ライブラリ<208>-Footnote-117231890
Ref: ライブラリ<208>-Footnote-127231956
Ref: ライブラリ<208>-Footnote-137232022
Ref: ライブラリ<208>-Footnote-147232088
Ref: ライブラリ<208>-Footnote-157232153
Ref: ライブラリ<208>-Footnote-167232219
Ref: ライブラリ<208>-Footnote-177232285
Ref: ライブラリ<208>-Footnote-187232351
Ref: ライブラリ<208>-Footnote-197232417
Ref: ライブラリ<208>-Footnote-207232483
Ref: ライブラリ<208>-Footnote-217232549
Ref: ライブラリ<208>-Footnote-227232615
Ref: ライブラリ<208>-Footnote-237232681
Ref: ライブラリ<208>-Footnote-247232747
Ref: ライブラリ<208>-Footnote-257232813
Ref: ライブラリ<208>-Footnote-267232878
Ref: ライブラリ<208>-Footnote-277232944
Ref: ライブラリ<208>-Footnote-287233010
Ref: ライブラリ<208>-Footnote-297233076
Ref: ライブラリ<208>-Footnote-307233142
Ref: ライブラリ<208>-Footnote-317233208
Ref: ライブラリ<208>-Footnote-327233274
Ref: ライブラリ<208>-Footnote-337233340
Ref: ライブラリ<208>-Footnote-347233406
Ref: ライブラリ<208>-Footnote-357233472
Ref: ライブラリ<208>-Footnote-367233538
Ref: ライブラリ<208>-Footnote-377233604
Ref: ライブラリ<208>-Footnote-387233670
Ref: ライブラリ<208>-Footnote-397233736
Ref: ライブラリ<208>-Footnote-407233802
Ref: ライブラリ<208>-Footnote-417233868
Ref: ライブラリ<208>-Footnote-427233933
Ref: ライブラリ<208>-Footnote-437233999
Ref: ライブラリ<208>-Footnote-447234065
Ref: ライブラリ<208>-Footnote-457234131
Ref: ライブラリ<208>-Footnote-467234197
Ref: ライブラリ<208>-Footnote-477234263
Ref: ライブラリ<208>-Footnote-487234329
Ref: ライブラリ<208>-Footnote-497234395
Ref: ライブラリ<208>-Footnote-507234461
Ref: ライブラリ<208>-Footnote-517234527
Ref: ライブラリ<208>-Footnote-527234593
Ref: ライブラリ<208>-Footnote-537234659
Ref: ライブラリ<208>-Footnote-547234725
Ref: ライブラリ<208>-Footnote-557234791
Ref: ライブラリ<208>-Footnote-567234857
Node: IDLE<63>7234923
Ref: whatsnew/changelog id10647235038
Ref: 21a47235038
Ref: IDLE<63>-Footnote-17235207
Node: テスト<90>7235272
Ref: whatsnew/changelog id10657235389
Ref: 21a57235389
Ref: テスト<90>-Footnote-17235688
Ref: テスト<90>-Footnote-27235753
Node: ドキュメント<84>7235817
Ref: whatsnew/changelog id10667235941
Ref: 21a67235941
Ref: ドキュメント<84>-Footnote-17236352
Ref: ドキュメント<84>-Footnote-27236417
Ref: ドキュメント<84>-Footnote-37236482
Node: Tools/Demos<56>7236547
Ref: whatsnew/changelog id10677236649
Ref: 21a77236649
Ref: Tools/Demos<56>-Footnote-17237158
Ref: Tools/Demos<56>-Footnote-27237223
Ref: Tools/Demos<56>-Footnote-37237288
Ref: Tools/Demos<56>-Footnote-47237353
Node: Python 3 5 0 alpha 47237418
Ref: whatsnew/changelog python-3-5-0-alpha-47237544
Ref: 21a87237544
Node: Core and Builtins<208>7237837
Ref: whatsnew/changelog id10687237945
Ref: 21a97237945
Ref: Core and Builtins<208>-Footnote-17239310
Ref: Core and Builtins<208>-Footnote-27239375
Ref: Core and Builtins<208>-Footnote-37239417
Ref: Core and Builtins<208>-Footnote-47239482
Ref: Core and Builtins<208>-Footnote-57239547
Ref: Core and Builtins<208>-Footnote-67239589
Ref: Core and Builtins<208>-Footnote-77239654
Ref: Core and Builtins<208>-Footnote-87239719
Ref: Core and Builtins<208>-Footnote-97239784
Ref: Core and Builtins<208>-Footnote-107239849
Ref: Core and Builtins<208>-Footnote-117239915
Node: ライブラリ<209>7239981
Ref: whatsnew/changelog id10697240111
Ref: 21aa7240111
Ref: ライブラリ<209>-Footnote-17246812
Ref: ライブラリ<209>-Footnote-27246877
Ref: ライブラリ<209>-Footnote-37246942
Ref: ライブラリ<209>-Footnote-47247006
Ref: ライブラリ<209>-Footnote-57247071
Ref: ライブラリ<209>-Footnote-67247136
Ref: ライブラリ<209>-Footnote-77247200
Ref: ライブラリ<209>-Footnote-87247265
Ref: ライブラリ<209>-Footnote-97247330
Ref: ライブラリ<209>-Footnote-107247395
Ref: ライブラリ<209>-Footnote-117247461
Ref: ライブラリ<209>-Footnote-127247527
Ref: ライブラリ<209>-Footnote-137247593
Ref: ライブラリ<209>-Footnote-147247659
Ref: ライブラリ<209>-Footnote-157247725
Ref: ライブラリ<209>-Footnote-167247791
Ref: ライブラリ<209>-Footnote-177247857
Ref: ライブラリ<209>-Footnote-187247923
Ref: ライブラリ<209>-Footnote-197247989
Ref: ライブラリ<209>-Footnote-207248055
Ref: ライブラリ<209>-Footnote-217248121
Ref: ライブラリ<209>-Footnote-227248187
Ref: ライブラリ<209>-Footnote-237248253
Ref: ライブラリ<209>-Footnote-247248319
Ref: ライブラリ<209>-Footnote-257248385
Ref: ライブラリ<209>-Footnote-267248451
Ref: ライブラリ<209>-Footnote-277248517
Ref: ライブラリ<209>-Footnote-287248583
Ref: ライブラリ<209>-Footnote-297248649
Ref: ライブラリ<209>-Footnote-307248715
Ref: ライブラリ<209>-Footnote-317248780
Ref: ライブラリ<209>-Footnote-327248846
Ref: ライブラリ<209>-Footnote-337248912
Ref: ライブラリ<209>-Footnote-347248978
Ref: ライブラリ<209>-Footnote-357249044
Ref: ライブラリ<209>-Footnote-367249110
Ref: ライブラリ<209>-Footnote-377249176
Ref: ライブラリ<209>-Footnote-387249242
Ref: ライブラリ<209>-Footnote-397249308
Ref: ライブラリ<209>-Footnote-407249374
Ref: ライブラリ<209>-Footnote-417249440
Ref: ライブラリ<209>-Footnote-427249506
Ref: ライブラリ<209>-Footnote-437249549
Ref: ライブラリ<209>-Footnote-447249615
Ref: ライブラリ<209>-Footnote-457249681
Ref: ライブラリ<209>-Footnote-467249747
Ref: ライブラリ<209>-Footnote-477249813
Ref: ライブラリ<209>-Footnote-487249879
Node: ビルド<98>7249945
Ref: whatsnew/changelog id10707250066
Ref: 21ab7250066
Ref: ビルド<98>-Footnote-17250348
Ref: ビルド<98>-Footnote-27250413
Node: テスト<91>7250478
Ref: whatsnew/changelog id10717250594
Ref: 21ac7250594
Ref: テスト<91>-Footnote-17250900
Ref: テスト<91>-Footnote-27250965
Node: Tools/Demos<57>7251030
Ref: whatsnew/changelog id10727251142
Ref: 21ad7251142
Ref: Tools/Demos<57>-Footnote-17252166
Ref: Tools/Demos<57>-Footnote-27252231
Ref: Tools/Demos<57>-Footnote-37252296
Ref: Tools/Demos<57>-Footnote-47252361
Ref: Tools/Demos<57>-Footnote-57252426
Ref: Tools/Demos<57>-Footnote-67252491
Node: C API<79>7252556
Ref: whatsnew/changelog id10737252646
Ref: 21ae7252646
Ref: C API<79>-Footnote-17252801
Node: Python 3 5 0 alpha 37252866
Ref: whatsnew/changelog python-3-5-0-alpha-37252993
Ref: 21af7252993
Node: Core and Builtins<209>7253266
Ref: whatsnew/changelog id10747253374
Ref: 21b07253374
Ref: Core and Builtins<209>-Footnote-17254168
Ref: Core and Builtins<209>-Footnote-27254233
Ref: Core and Builtins<209>-Footnote-37254298
Ref: Core and Builtins<209>-Footnote-47254363
Ref: Core and Builtins<209>-Footnote-57254428
Ref: Core and Builtins<209>-Footnote-67254493
Node: ライブラリ<210>7254558
Ref: whatsnew/changelog id10757254688
Ref: 21b17254688
Ref: ライブラリ<210>-Footnote-17261111
Ref: ライブラリ<210>-Footnote-27261176
Ref: ライブラリ<210>-Footnote-37261241
Ref: ライブラリ<210>-Footnote-47261306
Ref: ライブラリ<210>-Footnote-57261371
Ref: ライブラリ<210>-Footnote-67261436
Ref: ライブラリ<210>-Footnote-77261501
Ref: ライブラリ<210>-Footnote-87261566
Ref: ライブラリ<210>-Footnote-97261631
Ref: ライブラリ<210>-Footnote-107261696
Ref: ライブラリ<210>-Footnote-117261762
Ref: ライブラリ<210>-Footnote-127261828
Ref: ライブラリ<210>-Footnote-137261894
Ref: ライブラリ<210>-Footnote-147261960
Ref: ライブラリ<210>-Footnote-157262025
Ref: ライブラリ<210>-Footnote-167262091
Ref: ライブラリ<210>-Footnote-177262157
Ref: ライブラリ<210>-Footnote-187262223
Ref: ライブラリ<210>-Footnote-197262289
Ref: ライブラリ<210>-Footnote-207262355
Ref: ライブラリ<210>-Footnote-217262421
Ref: ライブラリ<210>-Footnote-227262487
Ref: ライブラリ<210>-Footnote-237262553
Ref: ライブラリ<210>-Footnote-247262619
Ref: ライブラリ<210>-Footnote-257262685
Ref: ライブラリ<210>-Footnote-267262751
Ref: ライブラリ<210>-Footnote-277262817
Ref: ライブラリ<210>-Footnote-287262883
Ref: ライブラリ<210>-Footnote-297262949
Ref: ライブラリ<210>-Footnote-307263015
Ref: ライブラリ<210>-Footnote-317263080
Ref: ライブラリ<210>-Footnote-327263146
Ref: ライブラリ<210>-Footnote-337263212
Ref: ライブラリ<210>-Footnote-347263278
Ref: ライブラリ<210>-Footnote-357263343
Ref: ライブラリ<210>-Footnote-367263409
Ref: ライブラリ<210>-Footnote-377263475
Ref: ライブラリ<210>-Footnote-387263541
Ref: ライブラリ<210>-Footnote-397263607
Ref: ライブラリ<210>-Footnote-407263673
Ref: ライブラリ<210>-Footnote-417263739
Ref: ライブラリ<210>-Footnote-427263805
Node: ビルド<99>7263871
Ref: whatsnew/changelog id10767263992
Ref: 21b27263992
Ref: ビルド<99>-Footnote-17264142
Node: テスト<92>7264207
Ref: whatsnew/changelog id10777264323
Ref: 21b37264323
Ref: テスト<92>-Footnote-17264553
Ref: テスト<92>-Footnote-27264618
Node: Tools/Demos<58>7264683
Ref: whatsnew/changelog id10787264777
Ref: 21b47264777
Ref: Tools/Demos<58>-Footnote-17265046
Node: Python 3 5 0 alpha 27265111
Ref: whatsnew/changelog python-3-5-0-alpha-27265238
Ref: 21b57265238
Node: Core and Builtins<210>7265496
Ref: whatsnew/changelog id10797265604
Ref: 21b67265604
Ref: Core and Builtins<210>-Footnote-17265902
Node: ライブラリ<211>7265967
Ref: whatsnew/changelog id10807266098
Ref: 21b77266098
Ref: ライブラリ<211>-Footnote-17270402
Ref: ライブラリ<211>-Footnote-27270467
Ref: ライブラリ<211>-Footnote-37270509
Ref: ライブラリ<211>-Footnote-47270574
Ref: ライブラリ<211>-Footnote-57270639
Ref: ライブラリ<211>-Footnote-67270704
Ref: ライブラリ<211>-Footnote-77270769
Ref: ライブラリ<211>-Footnote-87270834
Ref: ライブラリ<211>-Footnote-97270899
Ref: ライブラリ<211>-Footnote-107270963
Ref: ライブラリ<211>-Footnote-117271029
Ref: ライブラリ<211>-Footnote-127271095
Ref: ライブラリ<211>-Footnote-137271161
Ref: ライブラリ<211>-Footnote-147271227
Ref: ライブラリ<211>-Footnote-157271293
Ref: ライブラリ<211>-Footnote-167271359
Ref: ライブラリ<211>-Footnote-177271424
Ref: ライブラリ<211>-Footnote-187271491
Ref: ライブラリ<211>-Footnote-197271556
Ref: ライブラリ<211>-Footnote-207271622
Ref: ライブラリ<211>-Footnote-217271687
Ref: ライブラリ<211>-Footnote-227271753
Ref: ライブラリ<211>-Footnote-237271819
Ref: ライブラリ<211>-Footnote-247271885
Ref: ライブラリ<211>-Footnote-257271951
Ref: ライブラリ<211>-Footnote-267272017
Ref: ライブラリ<211>-Footnote-277272083
Ref: ライブラリ<211>-Footnote-287272149
Ref: ライブラリ<211>-Footnote-297272215
Ref: ライブラリ<211>-Footnote-307272281
Ref: ライブラリ<211>-Footnote-317272347
Ref: ライブラリ<211>-Footnote-327272413
Ref: ライブラリ<211>-Footnote-337272479
Ref: ライブラリ<211>-Footnote-347272545
Ref: ライブラリ<211>-Footnote-357272611
Ref: ライブラリ<211>-Footnote-367272677
Ref: ライブラリ<211>-Footnote-377272743
Node: ビルド<100>7272809
Ref: whatsnew/changelog id10817272927
Ref: 21b87272927
Ref: ビルド<100>-Footnote-17273199
Ref: ビルド<100>-Footnote-27273264
Node: C API<80>7273329
Ref: whatsnew/changelog id10827273438
Ref: 21b97273438
Ref: C API<80>-Footnote-17273620
Node: Windows<82>7273685
Ref: whatsnew/changelog id10837273771
Ref: 21ba7273771
Ref: Windows<82>-Footnote-17274068
Ref: Windows<82>-Footnote-27274133
Ref: Windows<82>-Footnote-37274175
Node: Python 3 5 0 alpha 17274240
Ref: whatsnew/changelog python-3-5-0-alpha-17274338
Ref: 21bb7274338
Node: Core and Builtins<211>7274720
Ref: whatsnew/changelog id10847274828
Ref: 21bc7274828
Ref: Core and Builtins<211>-Footnote-17284671
Ref: Core and Builtins<211>-Footnote-27284736
Ref: Core and Builtins<211>-Footnote-37284801
Ref: Core and Builtins<211>-Footnote-47284866
Ref: Core and Builtins<211>-Footnote-57284931
Ref: Core and Builtins<211>-Footnote-67284996
Ref: Core and Builtins<211>-Footnote-77285061
Ref: Core and Builtins<211>-Footnote-87285126
Ref: Core and Builtins<211>-Footnote-97285191
Ref: Core and Builtins<211>-Footnote-107285256
Ref: Core and Builtins<211>-Footnote-117285322
Ref: Core and Builtins<211>-Footnote-127285388
Ref: Core and Builtins<211>-Footnote-137285454
Ref: Core and Builtins<211>-Footnote-147285520
Ref: Core and Builtins<211>-Footnote-157285586
Ref: Core and Builtins<211>-Footnote-167285652
Ref: Core and Builtins<211>-Footnote-177285718
Ref: Core and Builtins<211>-Footnote-187285784
Ref: Core and Builtins<211>-Footnote-197285850
Ref: Core and Builtins<211>-Footnote-207285916
Ref: Core and Builtins<211>-Footnote-217285982
Ref: Core and Builtins<211>-Footnote-227286048
Ref: Core and Builtins<211>-Footnote-237286114
Ref: Core and Builtins<211>-Footnote-247286180
Ref: Core and Builtins<211>-Footnote-257286246
Ref: Core and Builtins<211>-Footnote-267286312
Ref: Core and Builtins<211>-Footnote-277286378
Ref: Core and Builtins<211>-Footnote-287286444
Ref: Core and Builtins<211>-Footnote-297286510
Ref: Core and Builtins<211>-Footnote-307286576
Ref: Core and Builtins<211>-Footnote-317286642
Ref: Core and Builtins<211>-Footnote-327286708
Ref: Core and Builtins<211>-Footnote-337286774
Ref: Core and Builtins<211>-Footnote-347286842
Ref: Core and Builtins<211>-Footnote-357286908
Ref: Core and Builtins<211>-Footnote-367286974
Ref: Core and Builtins<211>-Footnote-377287040
Ref: Core and Builtins<211>-Footnote-387287106
Ref: Core and Builtins<211>-Footnote-397287172
Ref: Core and Builtins<211>-Footnote-407287238
Ref: Core and Builtins<211>-Footnote-417287304
Ref: Core and Builtins<211>-Footnote-427287370
Ref: Core and Builtins<211>-Footnote-437287436
Ref: Core and Builtins<211>-Footnote-447287502
Ref: Core and Builtins<211>-Footnote-457287568
Ref: Core and Builtins<211>-Footnote-467287634
Ref: Core and Builtins<211>-Footnote-477287700
Ref: Core and Builtins<211>-Footnote-487287766
Ref: Core and Builtins<211>-Footnote-497287832
Ref: Core and Builtins<211>-Footnote-507287898
Ref: Core and Builtins<211>-Footnote-517287964
Ref: Core and Builtins<211>-Footnote-527288030
Ref: Core and Builtins<211>-Footnote-537288096
Ref: Core and Builtins<211>-Footnote-547288162
Ref: Core and Builtins<211>-Footnote-557288228
Ref: Core and Builtins<211>-Footnote-567288294
Ref: Core and Builtins<211>-Footnote-577288360
Ref: Core and Builtins<211>-Footnote-587288426
Ref: Core and Builtins<211>-Footnote-597288492
Ref: Core and Builtins<211>-Footnote-607288558
Ref: Core and Builtins<211>-Footnote-617288624
Ref: Core and Builtins<211>-Footnote-627288690
Ref: Core and Builtins<211>-Footnote-637288756
Ref: Core and Builtins<211>-Footnote-647288822
Ref: Core and Builtins<211>-Footnote-657288888
Ref: Core and Builtins<211>-Footnote-667288954
Ref: Core and Builtins<211>-Footnote-677289019
Ref: Core and Builtins<211>-Footnote-687289085
Ref: Core and Builtins<211>-Footnote-697289151
Ref: Core and Builtins<211>-Footnote-707289217
Ref: Core and Builtins<211>-Footnote-717289283
Ref: Core and Builtins<211>-Footnote-727289349
Ref: Core and Builtins<211>-Footnote-737289414
Node: ライブラリ<212>7289480
Ref: whatsnew/changelog id10857289605
Ref: 21bd7289605
Ref: ライブラリ<212>-Footnote-17341920
Ref: ライブラリ<212>-Footnote-27341985
Ref: ライブラリ<212>-Footnote-37342050
Ref: ライブラリ<212>-Footnote-47342115
Ref: ライブラリ<212>-Footnote-57342180
Ref: ライブラリ<212>-Footnote-67342245
Ref: ライブラリ<212>-Footnote-77342310
Ref: ライブラリ<212>-Footnote-87342375
Ref: ライブラリ<212>-Footnote-97342440
Ref: ライブラリ<212>-Footnote-107342505
Ref: ライブラリ<212>-Footnote-117342571
Ref: ライブラリ<212>-Footnote-127342637
Ref: ライブラリ<212>-Footnote-137342703
Ref: ライブラリ<212>-Footnote-147342769
Ref: ライブラリ<212>-Footnote-157342835
Ref: ライブラリ<212>-Footnote-167342901
Ref: ライブラリ<212>-Footnote-177342967
Ref: ライブラリ<212>-Footnote-187343033
Ref: ライブラリ<212>-Footnote-197343099
Ref: ライブラリ<212>-Footnote-207343165
Ref: ライブラリ<212>-Footnote-217343231
Ref: ライブラリ<212>-Footnote-227343297
Ref: ライブラリ<212>-Footnote-237343363
Ref: ライブラリ<212>-Footnote-247343429
Ref: ライブラリ<212>-Footnote-257343495
Ref: ライブラリ<212>-Footnote-267343561
Ref: ライブラリ<212>-Footnote-277343627
Ref: ライブラリ<212>-Footnote-287343693
Ref: ライブラリ<212>-Footnote-297343759
Ref: ライブラリ<212>-Footnote-307343825
Ref: ライブラリ<212>-Footnote-317343891
Ref: ライブラリ<212>-Footnote-327343957
Ref: ライブラリ<212>-Footnote-337344023
Ref: ライブラリ<212>-Footnote-347344089
Ref: ライブラリ<212>-Footnote-357344155
Ref: ライブラリ<212>-Footnote-367344221
Ref: ライブラリ<212>-Footnote-377344287
Ref: ライブラリ<212>-Footnote-387344353
Ref: ライブラリ<212>-Footnote-397344419
Ref: ライブラリ<212>-Footnote-407344485
Ref: ライブラリ<212>-Footnote-417344551
Ref: ライブラリ<212>-Footnote-427344617
Ref: ライブラリ<212>-Footnote-437344683
Ref: ライブラリ<212>-Footnote-447344749
Ref: ライブラリ<212>-Footnote-457344815
Ref: ライブラリ<212>-Footnote-467344881
Ref: ライブラリ<212>-Footnote-477344947
Ref: ライブラリ<212>-Footnote-487345013
Ref: ライブラリ<212>-Footnote-497345079
Ref: ライブラリ<212>-Footnote-507345145
Ref: ライブラリ<212>-Footnote-517345211
Ref: ライブラリ<212>-Footnote-527345277
Ref: ライブラリ<212>-Footnote-537345343
Ref: ライブラリ<212>-Footnote-547345409
Ref: ライブラリ<212>-Footnote-557345475
Ref: ライブラリ<212>-Footnote-567345543
Ref: ライブラリ<212>-Footnote-577345609
Ref: ライブラリ<212>-Footnote-587345675
Ref: ライブラリ<212>-Footnote-597345741
Ref: ライブラリ<212>-Footnote-607345807
Ref: ライブラリ<212>-Footnote-617345873
Ref: ライブラリ<212>-Footnote-627345929
Ref: ライブラリ<212>-Footnote-637345995
Ref: ライブラリ<212>-Footnote-647346061
Ref: ライブラリ<212>-Footnote-657346127
Ref: ライブラリ<212>-Footnote-667346193
Ref: ライブラリ<212>-Footnote-677346259
Ref: ライブラリ<212>-Footnote-687346325
Ref: ライブラリ<212>-Footnote-697346391
Ref: ライブラリ<212>-Footnote-707346457
Ref: ライブラリ<212>-Footnote-717346523
Ref: ライブラリ<212>-Footnote-727346589
Ref: ライブラリ<212>-Footnote-737346655
Ref: ライブラリ<212>-Footnote-747346721
Ref: ライブラリ<212>-Footnote-757346787
Ref: ライブラリ<212>-Footnote-767346853
Ref: ライブラリ<212>-Footnote-777346919
Ref: ライブラリ<212>-Footnote-787346985
Ref: ライブラリ<212>-Footnote-797347051
Ref: ライブラリ<212>-Footnote-807347117
Ref: ライブラリ<212>-Footnote-817347183
Ref: ライブラリ<212>-Footnote-827347249
Ref: ライブラリ<212>-Footnote-837347315
Ref: ライブラリ<212>-Footnote-847347381
Ref: ライブラリ<212>-Footnote-857347447
Ref: ライブラリ<212>-Footnote-867347513
Ref: ライブラリ<212>-Footnote-877347579
Ref: ライブラリ<212>-Footnote-887347645
Ref: ライブラリ<212>-Footnote-897347711
Ref: ライブラリ<212>-Footnote-907347777
Ref: ライブラリ<212>-Footnote-917347843
Ref: ライブラリ<212>-Footnote-927347909
Ref: ライブラリ<212>-Footnote-937347975
Ref: ライブラリ<212>-Footnote-947348041
Ref: ライブラリ<212>-Footnote-957348107
Ref: ライブラリ<212>-Footnote-967348173
Ref: ライブラリ<212>-Footnote-977348238
Ref: ライブラリ<212>-Footnote-987348304
Ref: ライブラリ<212>-Footnote-997348370
Ref: ライブラリ<212>-Footnote-1007348436
Ref: ライブラリ<212>-Footnote-1017348502
Ref: ライブラリ<212>-Footnote-1027348569
Ref: ライブラリ<212>-Footnote-1037348636
Ref: ライブラリ<212>-Footnote-1047348703
Ref: ライブラリ<212>-Footnote-1057348770
Ref: ライブラリ<212>-Footnote-1067348837
Ref: ライブラリ<212>-Footnote-1077348904
Ref: ライブラリ<212>-Footnote-1087348970
Ref: ライブラリ<212>-Footnote-1097349036
Ref: ライブラリ<212>-Footnote-1107349103
Ref: ライブラリ<212>-Footnote-1117349170
Ref: ライブラリ<212>-Footnote-1127349237
Ref: ライブラリ<212>-Footnote-1137349304
Ref: ライブラリ<212>-Footnote-1147349371
Ref: ライブラリ<212>-Footnote-1157349438
Ref: ライブラリ<212>-Footnote-1167349505
Ref: ライブラリ<212>-Footnote-1177349572
Ref: ライブラリ<212>-Footnote-1187349639
Ref: ライブラリ<212>-Footnote-1197349706
Ref: ライブラリ<212>-Footnote-1207349773
Ref: ライブラリ<212>-Footnote-1217349840
Ref: ライブラリ<212>-Footnote-1227349909
Ref: ライブラリ<212>-Footnote-1237349976
Ref: ライブラリ<212>-Footnote-1247350043
Ref: ライブラリ<212>-Footnote-1257350110
Ref: ライブラリ<212>-Footnote-1267350177
Ref: ライブラリ<212>-Footnote-1277350244
Ref: ライブラリ<212>-Footnote-1287350311
Ref: ライブラリ<212>-Footnote-1297350378
Ref: ライブラリ<212>-Footnote-1307350445
Ref: ライブラリ<212>-Footnote-1317350512
Ref: ライブラリ<212>-Footnote-1327350579
Ref: ライブラリ<212>-Footnote-1337350646
Ref: ライブラリ<212>-Footnote-1347350713
Ref: ライブラリ<212>-Footnote-1357350780
Ref: ライブラリ<212>-Footnote-1367350847
Ref: ライブラリ<212>-Footnote-1377350914
Ref: ライブラリ<212>-Footnote-1387350981
Ref: ライブラリ<212>-Footnote-1397351048
Ref: ライブラリ<212>-Footnote-1407351115
Ref: ライブラリ<212>-Footnote-1417351182
Ref: ライブラリ<212>-Footnote-1427351249
Ref: ライブラリ<212>-Footnote-1437351315
Ref: ライブラリ<212>-Footnote-1447351381
Ref: ライブラリ<212>-Footnote-1457351448
Ref: ライブラリ<212>-Footnote-1467351515
Ref: ライブラリ<212>-Footnote-1477351582
Ref: ライブラリ<212>-Footnote-1487351649
Ref: ライブラリ<212>-Footnote-1497351716
Ref: ライブラリ<212>-Footnote-1507351783
Ref: ライブラリ<212>-Footnote-1517351850
Ref: ライブラリ<212>-Footnote-1527351917
Ref: ライブラリ<212>-Footnote-1537351984
Ref: ライブラリ<212>-Footnote-1547352051
Ref: ライブラリ<212>-Footnote-1557352118
Ref: ライブラリ<212>-Footnote-1567352185
Ref: ライブラリ<212>-Footnote-1577352252
Ref: ライブラリ<212>-Footnote-1587352318
Ref: ライブラリ<212>-Footnote-1597352385
Ref: ライブラリ<212>-Footnote-1607352452
Ref: ライブラリ<212>-Footnote-1617352519
Ref: ライブラリ<212>-Footnote-1627352586
Ref: ライブラリ<212>-Footnote-1637352653
Ref: ライブラリ<212>-Footnote-1647352720
Ref: ライブラリ<212>-Footnote-1657352787
Ref: ライブラリ<212>-Footnote-1667352854
Ref: ライブラリ<212>-Footnote-1677352921
Ref: ライブラリ<212>-Footnote-1687352988
Ref: ライブラリ<212>-Footnote-1697353055
Ref: ライブラリ<212>-Footnote-1707353122
Ref: ライブラリ<212>-Footnote-1717353189
Ref: ライブラリ<212>-Footnote-1727353256
Ref: ライブラリ<212>-Footnote-1737353323
Ref: ライブラリ<212>-Footnote-1747353390
Ref: ライブラリ<212>-Footnote-1757353457
Ref: ライブラリ<212>-Footnote-1767353524
Ref: ライブラリ<212>-Footnote-1777353591
Ref: ライブラリ<212>-Footnote-1787353658
Ref: ライブラリ<212>-Footnote-1797353725
Ref: ライブラリ<212>-Footnote-1807353792
Ref: ライブラリ<212>-Footnote-1817353859
Ref: ライブラリ<212>-Footnote-1827353926
Ref: ライブラリ<212>-Footnote-1837353993
Ref: ライブラリ<212>-Footnote-1847354060
Ref: ライブラリ<212>-Footnote-1857354127
Ref: ライブラリ<212>-Footnote-1867354194
Ref: ライブラリ<212>-Footnote-1877354261
Ref: ライブラリ<212>-Footnote-1887354328
Ref: ライブラリ<212>-Footnote-1897354394
Ref: ライブラリ<212>-Footnote-1907354461
Ref: ライブラリ<212>-Footnote-1917354528
Ref: ライブラリ<212>-Footnote-1927354595
Ref: ライブラリ<212>-Footnote-1937354662
Ref: ライブラリ<212>-Footnote-1947354729
Ref: ライブラリ<212>-Footnote-1957354796
Ref: ライブラリ<212>-Footnote-1967354863
Ref: ライブラリ<212>-Footnote-1977354929
Ref: ライブラリ<212>-Footnote-1987354996
Ref: ライブラリ<212>-Footnote-1997355063
Ref: ライブラリ<212>-Footnote-2007355130
Ref: ライブラリ<212>-Footnote-2017355197
Ref: ライブラリ<212>-Footnote-2027355264
Ref: ライブラリ<212>-Footnote-2037355331
Ref: ライブラリ<212>-Footnote-2047355397
Ref: ライブラリ<212>-Footnote-2057355464
Ref: ライブラリ<212>-Footnote-2067355531
Ref: ライブラリ<212>-Footnote-2077355598
Ref: ライブラリ<212>-Footnote-2087355665
Ref: ライブラリ<212>-Footnote-2097355732
Ref: ライブラリ<212>-Footnote-2107355799
Ref: ライブラリ<212>-Footnote-2117355866
Ref: ライブラリ<212>-Footnote-2127355933
Ref: ライブラリ<212>-Footnote-2137356000
Ref: ライブラリ<212>-Footnote-2147356067
Ref: ライブラリ<212>-Footnote-2157356134
Ref: ライブラリ<212>-Footnote-2167356201
Ref: ライブラリ<212>-Footnote-2177356268
Ref: ライブラリ<212>-Footnote-2187356335
Ref: ライブラリ<212>-Footnote-2197356402
Ref: ライブラリ<212>-Footnote-2207356469
Ref: ライブラリ<212>-Footnote-2217356536
Ref: ライブラリ<212>-Footnote-2227356603
Ref: ライブラリ<212>-Footnote-2237356670
Ref: ライブラリ<212>-Footnote-2247356737
Ref: ライブラリ<212>-Footnote-2257356803
Ref: ライブラリ<212>-Footnote-2267356869
Ref: ライブラリ<212>-Footnote-2277356936
Ref: ライブラリ<212>-Footnote-2287357003
Ref: ライブラリ<212>-Footnote-2297357070
Ref: ライブラリ<212>-Footnote-2307357137
Ref: ライブラリ<212>-Footnote-2317357204
Ref: ライブラリ<212>-Footnote-2327357271
Ref: ライブラリ<212>-Footnote-2337357338
Ref: ライブラリ<212>-Footnote-2347357405
Ref: ライブラリ<212>-Footnote-2357357472
Ref: ライブラリ<212>-Footnote-2367357539
Ref: ライブラリ<212>-Footnote-2377357606
Ref: ライブラリ<212>-Footnote-2387357673
Ref: ライブラリ<212>-Footnote-2397357740
Ref: ライブラリ<212>-Footnote-2407357807
Ref: ライブラリ<212>-Footnote-2417357874
Ref: ライブラリ<212>-Footnote-2427357941
Ref: ライブラリ<212>-Footnote-2437358008
Ref: ライブラリ<212>-Footnote-2447358075
Ref: ライブラリ<212>-Footnote-2457358142
Ref: ライブラリ<212>-Footnote-2467358208
Ref: ライブラリ<212>-Footnote-2477358275
Ref: ライブラリ<212>-Footnote-2487358342
Ref: ライブラリ<212>-Footnote-2497358409
Ref: ライブラリ<212>-Footnote-2507358476
Ref: ライブラリ<212>-Footnote-2517358543
Ref: ライブラリ<212>-Footnote-2527358610
Ref: ライブラリ<212>-Footnote-2537358677
Ref: ライブラリ<212>-Footnote-2547358744
Ref: ライブラリ<212>-Footnote-2557358811
Ref: ライブラリ<212>-Footnote-2567358878
Ref: ライブラリ<212>-Footnote-2577358945
Ref: ライブラリ<212>-Footnote-2587359012
Ref: ライブラリ<212>-Footnote-2597359079
Ref: ライブラリ<212>-Footnote-2607359146
Ref: ライブラリ<212>-Footnote-2617359213
Ref: ライブラリ<212>-Footnote-2627359280
Ref: ライブラリ<212>-Footnote-2637359347
Ref: ライブラリ<212>-Footnote-2647359414
Ref: ライブラリ<212>-Footnote-2657359481
Ref: ライブラリ<212>-Footnote-2667359548
Ref: ライブラリ<212>-Footnote-2677359615
Ref: ライブラリ<212>-Footnote-2687359682
Ref: ライブラリ<212>-Footnote-2697359749
Ref: ライブラリ<212>-Footnote-2707359816
Ref: ライブラリ<212>-Footnote-2717359883
Ref: ライブラリ<212>-Footnote-2727359950
Ref: ライブラリ<212>-Footnote-2737360017
Ref: ライブラリ<212>-Footnote-2747360084
Ref: ライブラリ<212>-Footnote-2757360151
Ref: ライブラリ<212>-Footnote-2767360218
Ref: ライブラリ<212>-Footnote-2777360285
Ref: ライブラリ<212>-Footnote-2787360351
Ref: ライブラリ<212>-Footnote-2797360418
Ref: ライブラリ<212>-Footnote-2807360485
Ref: ライブラリ<212>-Footnote-2817360552
Ref: ライブラリ<212>-Footnote-2827360619
Ref: ライブラリ<212>-Footnote-2837360686
Ref: ライブラリ<212>-Footnote-2847360753
Ref: ライブラリ<212>-Footnote-2857360820
Ref: ライブラリ<212>-Footnote-2867360887
Ref: ライブラリ<212>-Footnote-2877360954
Ref: ライブラリ<212>-Footnote-2887361021
Ref: ライブラリ<212>-Footnote-2897361088
Ref: ライブラリ<212>-Footnote-2907361132
Ref: ライブラリ<212>-Footnote-2917361199
Ref: ライブラリ<212>-Footnote-2927361266
Ref: ライブラリ<212>-Footnote-2937361333
Ref: ライブラリ<212>-Footnote-2947361400
Ref: ライブラリ<212>-Footnote-2957361467
Ref: ライブラリ<212>-Footnote-2967361534
Ref: ライブラリ<212>-Footnote-2977361601
Ref: ライブラリ<212>-Footnote-2987361668
Ref: ライブラリ<212>-Footnote-2997361735
Ref: ライブラリ<212>-Footnote-3007361802
Ref: ライブラリ<212>-Footnote-3017361869
Ref: ライブラリ<212>-Footnote-3027361936
Ref: ライブラリ<212>-Footnote-3037362003
Ref: ライブラリ<212>-Footnote-3047362070
Ref: ライブラリ<212>-Footnote-3057362137
Ref: ライブラリ<212>-Footnote-3067362204
Ref: ライブラリ<212>-Footnote-3077362271
Ref: ライブラリ<212>-Footnote-3087362338
Ref: ライブラリ<212>-Footnote-3097362405
Ref: ライブラリ<212>-Footnote-3107362472
Ref: ライブラリ<212>-Footnote-3117362539
Ref: ライブラリ<212>-Footnote-3127362606
Ref: ライブラリ<212>-Footnote-3137362673
Ref: ライブラリ<212>-Footnote-3147362740
Ref: ライブラリ<212>-Footnote-3157362807
Ref: ライブラリ<212>-Footnote-3167362873
Ref: ライブラリ<212>-Footnote-3177362940
Ref: ライブラリ<212>-Footnote-3187363007
Ref: ライブラリ<212>-Footnote-3197363074
Ref: ライブラリ<212>-Footnote-3207363141
Ref: ライブラリ<212>-Footnote-3217363208
Ref: ライブラリ<212>-Footnote-3227363275
Ref: ライブラリ<212>-Footnote-3237363342
Ref: ライブラリ<212>-Footnote-3247363409
Ref: ライブラリ<212>-Footnote-3257363476
Ref: ライブラリ<212>-Footnote-3267363543
Ref: ライブラリ<212>-Footnote-3277363610
Ref: ライブラリ<212>-Footnote-3287363677
Ref: ライブラリ<212>-Footnote-3297363744
Ref: ライブラリ<212>-Footnote-3307363811
Ref: ライブラリ<212>-Footnote-3317363878
Ref: ライブラリ<212>-Footnote-3327363945
Ref: ライブラリ<212>-Footnote-3337364012
Ref: ライブラリ<212>-Footnote-3347364079
Ref: ライブラリ<212>-Footnote-3357364146
Ref: ライブラリ<212>-Footnote-3367364212
Ref: ライブラリ<212>-Footnote-3377364279
Ref: ライブラリ<212>-Footnote-3387364346
Ref: ライブラリ<212>-Footnote-3397364403
Ref: ライブラリ<212>-Footnote-3407364470
Ref: ライブラリ<212>-Footnote-3417364537
Ref: ライブラリ<212>-Footnote-3427364604
Ref: ライブラリ<212>-Footnote-3437364671
Ref: ライブラリ<212>-Footnote-3447364738
Ref: ライブラリ<212>-Footnote-3457364805
Ref: ライブラリ<212>-Footnote-3467364872
Ref: ライブラリ<212>-Footnote-3477364939
Ref: ライブラリ<212>-Footnote-3487365006
Ref: ライブラリ<212>-Footnote-3497365073
Ref: ライブラリ<212>-Footnote-3507365140
Ref: ライブラリ<212>-Footnote-3517365207
Ref: ライブラリ<212>-Footnote-3527365274
Ref: ライブラリ<212>-Footnote-3537365341
Ref: ライブラリ<212>-Footnote-3547365408
Ref: ライブラリ<212>-Footnote-3557365475
Ref: ライブラリ<212>-Footnote-3567365542
Ref: ライブラリ<212>-Footnote-3577365609
Ref: ライブラリ<212>-Footnote-3587365676
Ref: ライブラリ<212>-Footnote-3597365743
Ref: ライブラリ<212>-Footnote-3607365810
Ref: ライブラリ<212>-Footnote-3617365877
Ref: ライブラリ<212>-Footnote-3627365944
Ref: ライブラリ<212>-Footnote-3637366011
Ref: ライブラリ<212>-Footnote-3647366078
Ref: ライブラリ<212>-Footnote-3657366145
Ref: ライブラリ<212>-Footnote-3667366212
Ref: ライブラリ<212>-Footnote-3677366279
Ref: ライブラリ<212>-Footnote-3687366346
Ref: ライブラリ<212>-Footnote-3697366413
Ref: ライブラリ<212>-Footnote-3707366480
Ref: ライブラリ<212>-Footnote-3717366547
Ref: ライブラリ<212>-Footnote-3727366614
Ref: ライブラリ<212>-Footnote-3737366680
Ref: ライブラリ<212>-Footnote-3747366747
Ref: ライブラリ<212>-Footnote-3757366814
Ref: ライブラリ<212>-Footnote-3767366881
Ref: ライブラリ<212>-Footnote-3777366948
Ref: ライブラリ<212>-Footnote-3787367015
Ref: ライブラリ<212>-Footnote-3797367082
Ref: ライブラリ<212>-Footnote-3807367149
Ref: ライブラリ<212>-Footnote-3817367216
Ref: ライブラリ<212>-Footnote-3827367283
Ref: ライブラリ<212>-Footnote-3837367350
Ref: ライブラリ<212>-Footnote-3847367417
Ref: ライブラリ<212>-Footnote-3857367484
Ref: ライブラリ<212>-Footnote-3867367550
Ref: ライブラリ<212>-Footnote-3877367617
Ref: ライブラリ<212>-Footnote-3887367684
Ref: ライブラリ<212>-Footnote-3897367751
Ref: ライブラリ<212>-Footnote-3907367818
Ref: ライブラリ<212>-Footnote-3917367883
Ref: ライブラリ<212>-Footnote-3927367950
Ref: ライブラリ<212>-Footnote-3937368017
Ref: ライブラリ<212>-Footnote-3947368084
Ref: ライブラリ<212>-Footnote-3957368151
Ref: ライブラリ<212>-Footnote-3967368218
Ref: ライブラリ<212>-Footnote-3977368285
Ref: ライブラリ<212>-Footnote-3987368352
Node: IDLE<64>7368419
Ref: whatsnew/changelog id10867368536
Ref: 21be7368536
Ref: IDLE<64>-Footnote-17372018
Ref: IDLE<64>-Footnote-27372083
Ref: IDLE<64>-Footnote-37372148
Ref: IDLE<64>-Footnote-47372212
Ref: IDLE<64>-Footnote-57372277
Ref: IDLE<64>-Footnote-67372341
Ref: IDLE<64>-Footnote-77372406
Ref: IDLE<64>-Footnote-87372471
Ref: IDLE<64>-Footnote-97372536
Ref: IDLE<64>-Footnote-107372601
Ref: IDLE<64>-Footnote-117372667
Ref: IDLE<64>-Footnote-127372733
Ref: IDLE<64>-Footnote-137372799
Ref: IDLE<64>-Footnote-147372865
Ref: IDLE<64>-Footnote-157372931
Ref: IDLE<64>-Footnote-167372997
Ref: IDLE<64>-Footnote-177373063
Ref: IDLE<64>-Footnote-187373129
Ref: IDLE<64>-Footnote-197373195
Ref: IDLE<64>-Footnote-207373261
Ref: IDLE<64>-Footnote-217373327
Ref: IDLE<64>-Footnote-227373393
Ref: IDLE<64>-Footnote-237373459
Ref: IDLE<64>-Footnote-247373502
Ref: IDLE<64>-Footnote-257373568
Ref: IDLE<64>-Footnote-267373634
Node: ビルド<101>7373700
Ref: whatsnew/changelog id10877373806
Ref: 21bf7373806
Ref: ビルド<101>-Footnote-17377219
Ref: ビルド<101>-Footnote-27377284
Ref: ビルド<101>-Footnote-37377349
Ref: ビルド<101>-Footnote-47377414
Ref: ビルド<101>-Footnote-57377479
Ref: ビルド<101>-Footnote-67377544
Ref: ビルド<101>-Footnote-77377609
Ref: ビルド<101>-Footnote-87377674
Ref: ビルド<101>-Footnote-97377739
Ref: ビルド<101>-Footnote-107377804
Ref: ビルド<101>-Footnote-117377870
Ref: ビルド<101>-Footnote-127377936
Ref: ビルド<101>-Footnote-137378002
Ref: ビルド<101>-Footnote-147378068
Ref: ビルド<101>-Footnote-157378134
Ref: ビルド<101>-Footnote-167378200
Ref: ビルド<101>-Footnote-177378266
Ref: ビルド<101>-Footnote-187378332
Ref: ビルド<101>-Footnote-197378398
Ref: ビルド<101>-Footnote-207378464
Ref: ビルド<101>-Footnote-217378530
Ref: ビルド<101>-Footnote-227378596
Ref: ビルド<101>-Footnote-237378662
Ref: ビルド<101>-Footnote-247378728
Ref: ビルド<101>-Footnote-257378794
Ref: ビルド<101>-Footnote-267378860
Node: C API<81>7378926
Ref: whatsnew/changelog id10887379046
Ref: 21c07379046
Ref: C API<81>-Footnote-17380411
Ref: C API<81>-Footnote-27380476
Ref: C API<81>-Footnote-37380541
Ref: C API<81>-Footnote-47380606
Ref: C API<81>-Footnote-57380671
Ref: C API<81>-Footnote-67380736
Ref: C API<81>-Footnote-77380801
Node: ドキュメント<85>7380866
Ref: whatsnew/changelog id10897380985
Ref: 21c17380985
Ref: ドキュメント<85>-Footnote-17382796
Ref: ドキュメント<85>-Footnote-27382861
Ref: ドキュメント<85>-Footnote-37382926
Ref: ドキュメント<85>-Footnote-47382991
Ref: ドキュメント<85>-Footnote-57383056
Ref: ドキュメント<85>-Footnote-67383120
Ref: ドキュメント<85>-Footnote-77383185
Ref: ドキュメント<85>-Footnote-87383250
Ref: ドキュメント<85>-Footnote-97383315
Ref: ドキュメント<85>-Footnote-107383380
Ref: ドキュメント<85>-Footnote-117383446
Node: テスト<93>7383512
Ref: whatsnew/changelog id10907383637
Ref: 21c27383637
Ref: テスト<93>-Footnote-17387833
Ref: テスト<93>-Footnote-27387898
Ref: テスト<93>-Footnote-37387963
Ref: テスト<93>-Footnote-47388028
Ref: テスト<93>-Footnote-57388093
Ref: テスト<93>-Footnote-67388158
Ref: テスト<93>-Footnote-77388223
Ref: テスト<93>-Footnote-87388288
Ref: テスト<93>-Footnote-97388353
Ref: テスト<93>-Footnote-107388418
Ref: テスト<93>-Footnote-117388484
Ref: テスト<93>-Footnote-127388550
Ref: テスト<93>-Footnote-137388616
Ref: テスト<93>-Footnote-147388682
Ref: テスト<93>-Footnote-157388747
Ref: テスト<93>-Footnote-167388813
Ref: テスト<93>-Footnote-177388879
Ref: テスト<93>-Footnote-187388945
Ref: テスト<93>-Footnote-197389011
Ref: テスト<93>-Footnote-207389077
Ref: テスト<93>-Footnote-217389143
Ref: テスト<93>-Footnote-227389209
Ref: テスト<93>-Footnote-237389275
Ref: テスト<93>-Footnote-247389341
Ref: テスト<93>-Footnote-257389407
Ref: テスト<93>-Footnote-267389473
Ref: テスト<93>-Footnote-277389539
Ref: テスト<93>-Footnote-287389605
Ref: テスト<93>-Footnote-297389671
Ref: テスト<93>-Footnote-307389737
Ref: テスト<93>-Footnote-317389803
Ref: テスト<93>-Footnote-327389869
Ref: テスト<93>-Footnote-337389935
Ref: テスト<93>-Footnote-347390001
Ref: テスト<93>-Footnote-357390067
Ref: テスト<93>-Footnote-367390133
Ref: テスト<93>-Footnote-377390199
Node: Tools/Demos<59>7390265
Ref: whatsnew/changelog id10917390379
Ref: 21c37390379
Ref: Tools/Demos<59>-Footnote-17392041
Ref: Tools/Demos<59>-Footnote-27392106
Ref: Tools/Demos<59>-Footnote-37392171
Ref: Tools/Demos<59>-Footnote-47392236
Ref: Tools/Demos<59>-Footnote-57392301
Ref: Tools/Demos<59>-Footnote-67392366
Ref: Tools/Demos<59>-Footnote-77392431
Ref: Tools/Demos<59>-Footnote-87392496
Ref: Tools/Demos<59>-Footnote-97392561
Ref: Tools/Demos<59>-Footnote-107392626
Ref: Tools/Demos<59>-Footnote-117392669
Ref: Tools/Demos<59>-Footnote-127392735
Ref: Tools/Demos<59>-Footnote-137392801
Node: Windows<83>7392867
Ref: whatsnew/changelog id10927392959
Ref: 21c47392959
Ref: Windows<83>-Footnote-17394166
Ref: Windows<83>-Footnote-27394231
Ref: Windows<83>-Footnote-37394296
Ref: Windows<83>-Footnote-47394361
Ref: Windows<83>-Footnote-57394426
Ref: Windows<83>-Footnote-67394491
Ref: Windows<83>-Footnote-77394556
Node: Python チュートリアル7394621
Ref: tutorial/index doc7394764
Ref: 21c57394764
Ref: tutorial/index the-python-tutorial7394764
Ref: 21c67394764
Ref: tutorial/index translation-repo7394764
Ref: 21c77394764
Ref: tutorial/index tutorial-index7394764
Ref: 21c87394764
Node: やる気を高めよう7398583
Ref: tutorial/appetite doc7398715
Ref: 21cc7398715
Ref: tutorial/appetite tut-intro7398715
Ref: 21cd7398715
Ref: tutorial/appetite whetting-your-appetite7398715
Ref: 21ce7398715
Node: Python インタプリタを使う7404964
Ref: tutorial/interpreter doc7405140
Ref: 21cf7405140
Ref: tutorial/interpreter translation-repo7405140
Ref: 21d07405140
Ref: tutorial/interpreter tut-using7405140
Ref: 21d17405140
Ref: tutorial/interpreter using-the-python-interpreter7405140
Ref: 21d27405140
Node: インタプリタを起動する7405296
Ref: tutorial/interpreter invoking-the-interpreter7405442
Ref: 21d37405442
Ref: tutorial/interpreter tut-invoking7405442
Ref: 21d47405442
Ref: インタプリタを起動する-Footnote-17409308
Node: 引数の受け渡し7409580
Ref: tutorial/interpreter argument-passing7409695
Ref: 21d87409695
Ref: tutorial/interpreter tut-argpassing7409695
Ref: 21d97409695
Node: 対話モード7410888
Ref: tutorial/interpreter interactive-mode7411003
Ref: 21da7411003
Ref: tutorial/interpreter tut-interactive7411003
Ref: 65d7411003
Node: インタプリタとその環境7412436
Ref: tutorial/interpreter the-interpreter-and-its-environment7412582
Ref: 21db7412582
Ref: tutorial/interpreter tut-interp7412582
Ref: 21dc7412582
Node: ソースコードの文字コード7412703
Ref: tutorial/interpreter source-code-encoding7412809
Ref: 21dd7412809
Ref: tutorial/interpreter tut-source-encoding7412809
Ref: 21de7412809
Node: 形式ばらない Python の紹介7414522
Ref: tutorial/introduction doc7414710
Ref: 21e07414710
Ref: tutorial/introduction an-informal-introduction-to-python7414710
Ref: 21e17414710
Ref: tutorial/introduction translation-repo7414710
Ref: 21e27414710
Ref: tutorial/introduction tut-informal7414710
Ref: 21e37414710
Node: Python を電卓として使う7416192
Ref: tutorial/introduction tut-calculator7416340
Ref: 21e47416340
Ref: tutorial/introduction using-python-as-a-calculator7416340
Ref: 21e57416340
Node: 数7416725
Ref: tutorial/introduction numbers7416817
Ref: 21e67416817
Ref: tutorial/introduction tut-numbers7416817
Ref: 21e77416817
Ref: 数-Footnote-17420223
Node: テキスト7420461
Ref: tutorial/introduction text7420579
Ref: 21e97420579
Ref: tutorial/introduction tut-strings7420579
Ref: 21ea7420579
Ref: テキスト-Footnote-17430609
Node: リスト型 list7430998
Ref: tutorial/introduction lists7431104
Ref: 21ee7431104
Ref: tutorial/introduction tut-lists7431104
Ref: 21ef7431104
Node: プログラミングへの第一歩7434845
Ref: tutorial/introduction first-steps-towards-programming7434993
Ref: 21f17434993
Ref: tutorial/introduction tut-firststeps7434993
Ref: 21f27434993
Ref: プログラミングへの第一歩-Footnote-17438895
Node: その他の制御フローツール7438952
Ref: tutorial/controlflow doc7439121
Ref: 21f37439121
Ref: tutorial/controlflow more-control-flow-tools7439121
Ref: 21f47439121
Ref: tutorial/controlflow translation-repo7439121
Ref: 21f57439121
Ref: tutorial/controlflow tut-morecontrol7439121
Ref: 21f67439121
Node: if 文7439645
Ref: tutorial/controlflow if-statements7439740
Ref: 21f77439740
Ref: tutorial/controlflow tut-if7439740
Ref: 21f87439740
Node: for 文7440817
Ref: tutorial/controlflow for-statements7440933
Ref: 21fa7440933
Ref: tutorial/controlflow tut-for7440933
Ref: 21fb7440933
Node: range 関数7442609
Ref: tutorial/controlflow the-range-function7442744
Ref: 21fc7442744
Ref: tutorial/controlflow tut-range7442744
Ref: 21fd7442744
Node: break 文と continue 文7445249
Ref: tutorial/controlflow break-and-continue-statements7445398
Ref: 22007445398
Ref: tutorial/controlflow tut-break7445398
Ref: 22017445398
Ref: tutorial/controlflow tut-for-else7446517
Ref: 22027446517
Node: ループの else 節7446518
Ref: tutorial/controlflow break-and-continue-statements-and-else-clauses-on-loops7446663
Ref: 22037446663
Ref: tutorial/controlflow else-clauses-on-loops7446663
Ref: 22047446663
Node: pass 文7449122
Ref: tutorial/controlflow pass-statements7449251
Ref: 22067449251
Ref: tutorial/controlflow tut-pass7449251
Ref: 22077449251
Node: match 文7450580
Ref: tutorial/controlflow match-statements7450709
Ref: 22097450709
Ref: tutorial/controlflow tut-match7450709
Ref: 21f97450709
Ref: match 文-Footnote-17458515
Node: 関数を定義する7458557
Ref: tutorial/controlflow defining-functions7458714
Ref: 220a7458714
Ref: tutorial/controlflow tut-functions7458714
Ref: 220b7458714
Ref: 関数を定義する-Footnote-17465407
Node: 関数定義についてもう少し7465812
Ref: tutorial/controlflow more-on-defining-functions7466000
Ref: 220e7466000
Ref: tutorial/controlflow tut-defining7466000
Ref: 220f7466000
Node: デフォルトの引数値7466515
Ref: tutorial/controlflow default-argument-values7466645
Ref: 22107466645
Ref: tutorial/controlflow tut-defaultargs7466645
Ref: 22117466645
Node: キーワード引数7468989
Ref: tutorial/controlflow keyword-arguments7469152
Ref: 22127469152
Ref: tutorial/controlflow tut-keywordargs7469152
Ref: 22137469152
Node: 特殊なパラメータ7473307
Ref: tutorial/controlflow special-parameters7473464
Ref: 22157473464
Node: 位置またはキーワード引数7474811
Ref: tutorial/controlflow positional-or-keyword-arguments7474938
Ref: 22167474938
Node: 位置専用引数<2>7475146
Ref: tutorial/controlflow positional-only-parameters7475309
Ref: 22177475309
Node: キーワード専用引数7475977
Ref: tutorial/controlflow keyword-only-arguments7476116
Ref: 22187476116
Node: 関数の例7476419
Ref: tutorial/controlflow function-examples7476543
Ref: 22197476543
Node: 要約7479865
Ref: tutorial/controlflow recap7479953
Ref: 221a7479953
Node: 任意引数リスト7481014
Ref: tutorial/controlflow arbitrary-argument-lists7481183
Ref: 221b7481183
Ref: tutorial/controlflow tut-arbitraryargs7481183
Ref: 221c7481183
Node: 引数リストのアンパック7482271
Ref: tutorial/controlflow tut-unpacking-arguments7482428
Ref: 221d7482428
Ref: tutorial/controlflow unpacking-argument-lists7482428
Ref: 221e7482428
Node: ラムダ式7483857
Ref: tutorial/controlflow lambda-expressions7484032
Ref: 221f7484032
Ref: tutorial/controlflow tut-lambda7484032
Ref: 22207484032
Node: ドキュメンテーション文字列7485409
Ref: tutorial/controlflow documentation-strings7485581
Ref: 22217485581
Ref: tutorial/controlflow tut-docstrings7485581
Ref: 220c7485581
Node: 関数のアノテーション7487225
Ref: tutorial/controlflow function-annotations7487376
Ref: 22227487376
Ref: tutorial/controlflow tut-annotations7487376
Ref: 22237487376
Ref: 関数のアノテーション-Footnote-17488804
Ref: 関数のアノテーション-Footnote-27488846
Node: 間奏曲 コーディングスタイル7488888
Ref: tutorial/controlflow intermezzo-coding-style7489046
Ref: 22267489046
Ref: tutorial/controlflow tut-codingstyle7489046
Ref: 22277489046
Ref: 間奏曲 コーディングスタイル-Footnote-17491852
Node: データ構造7491894
Ref: tutorial/datastructures doc7492046
Ref: 22297492046
Ref: tutorial/datastructures data-structures7492046
Ref: 222a7492046
Ref: tutorial/datastructures translation-repo7492046
Ref: 222b7492046
Ref: tutorial/datastructures tut-structures7492046
Ref: 21ff7492046
Node: リスト型についてもう少し7492500
Ref: tutorial/datastructures more-on-lists7492604
Ref: 222c7492604
Ref: tutorial/datastructures tut-morelists7492604
Ref: 222d7492604
Ref: リスト型についてもう少し-Footnote-17497374
Node: リストをスタックとして使う7497572
Ref: tutorial/datastructures tut-lists-as-stacks7497729
Ref: 222f7497729
Ref: tutorial/datastructures using-lists-as-stacks7497729
Ref: 22307497729
Node: リストをキューとして使う7498550
Ref: tutorial/datastructures tut-lists-as-queues7498743
Ref: 22327498743
Ref: tutorial/datastructures using-lists-as-queues7498743
Ref: 22337498743
Node: リストの内包表記<2>7500194
Ref: tutorial/datastructures list-comprehensions7500387
Ref: 22347500387
Ref: tutorial/datastructures tut-listcomps7500387
Ref: 22357500387
Node: ネストしたリストの内包表記7504135
Ref: tutorial/datastructures nested-list-comprehensions7504334
Ref: 22367504334
Node: Unpacking in Lists and List Comprehensions7506202
Ref: tutorial/datastructures unpacking-in-lists-and-list-comprehensions7506365
Ref: 22377506365
Node: del 文7507997
Ref: tutorial/datastructures the-del-statement7508137
Ref: 22387508137
Ref: tutorial/datastructures tut-del7508137
Ref: 22397508137
Node: タプルとシーケンス7509146
Ref: tutorial/datastructures tuples-and-sequences7509259
Ref: 223a7509259
Ref: tutorial/datastructures tut-tuples7509259
Ref: 22147509259
Node: 集合型7513182
Ref: tutorial/datastructures sets7513308
Ref: 223c7513308
Ref: tutorial/datastructures tut-sets7513308
Ref: 223d7513308
Node: 辞書型 dictionary7515686
Ref: tutorial/datastructures dictionaries7515812
Ref: 223f7515812
Ref: tutorial/datastructures tut-dictionaries7515812
Ref: 22407515812
Node: ループのテクニック7520443
Ref: tutorial/datastructures looping-techniques7520590
Ref: 22427520590
Ref: tutorial/datastructures tut-loopidioms7520590
Ref: 21fe7520590
Node: 条件についてもう少し7523636
Ref: tutorial/datastructures more-on-conditions7523805
Ref: 22437523805
Ref: tutorial/datastructures tut-conditions7523805
Ref: 22447523805
Node: シーケンスとその他の型の比較7526489
Ref: tutorial/datastructures comparing-sequences-and-other-types7526622
Ref: 22467526622
Ref: tutorial/datastructures tut-comparing7526622
Ref: 22477526622
Node: モジュール<2>7528658
Ref: tutorial/modules doc7528789
Ref: 22487528789
Ref: tutorial/modules modules7528789
Ref: 22497528789
Ref: tutorial/modules translation-repo7528789
Ref: 224a7528789
Ref: tutorial/modules tut-modules7528789
Ref: 224b7528789
Node: モジュールについてもうすこし7532165
Ref: tutorial/modules more-on-modules7532292
Ref: 224e7532292
Ref: tutorial/modules tut-moremodules7532292
Ref: 224f7532292
Ref: モジュールについてもうすこし-Footnote-17536834
Node: モジュールをスクリプトとして実行する7537054
Ref: tutorial/modules executing-modules-as-scripts7537223
Ref: 22507537223
Ref: tutorial/modules tut-modulesasscripts7537223
Ref: 22517537223
Node: モジュール検索パス7538451
Ref: tutorial/modules the-module-search-path7538676
Ref: 22527538676
Ref: tutorial/modules tut-searchpath7538676
Ref: 22537538676
Node: "コンパイル" された Python ファイル7540865
Ref: tutorial/modules compiled-python-files7541027
Ref: 22567541027
Ref: tutorial/modules tut-pycache7541027
Ref: ace7541027
Ref: "コンパイル" された Python ファイル-Footnote-17544571
Node: 標準モジュール7544613
Ref: tutorial/modules standard-modules7544759
Ref: 22577544759
Ref: tutorial/modules tut-standardmodules7544759
Ref: 22557544759
Node: dir 関数7546510
Ref: tutorial/modules the-dir-function7546629
Ref: 22587546629
Ref: tutorial/modules tut-dir7546629
Ref: 22597546629
Node: パッケージ7551344
Ref: tutorial/modules packages7551433
Ref: 225a7551433
Ref: tutorial/modules tut-packages7551433
Ref: 225b7551433
Node: パッケージから * を import する7557327
Ref: tutorial/modules importing-from-a-package7557453
Ref: 225c7557453
Ref: tutorial/modules tut-pkg-import-star7557453
Ref: 225d7557453
Node: パッケージ内参照7562184
Ref: tutorial/modules id27562364
Ref: 225e7562364
Ref: tutorial/modules intra-package-references7562364
Ref: 225f7562364
Node: 複数ディレクトリ中のパッケージ7563626
Ref: tutorial/modules packages-in-multiple-directories7563756
Ref: 22607563756
Node: 入力と出力7564605
Ref: tutorial/inputoutput doc7564739
Ref: 22627564739
Ref: tutorial/inputoutput input-and-output7564739
Ref: 22637564739
Ref: tutorial/inputoutput translation-repo7564739
Ref: 22647564739
Ref: tutorial/inputoutput tut-io7564739
Ref: 22657564739
Node: 出力を見やすくフォーマットする7565173
Ref: tutorial/inputoutput fancier-output-formatting7565312
Ref: 22667565312
Ref: tutorial/inputoutput tut-formatting7565312
Ref: 22677565312
Node: フォーマット済み文字列リテラル7570236
Ref: tutorial/inputoutput formatted-string-literals7570404
Ref: 226a7570404
Ref: tutorial/inputoutput tut-f-strings7570404
Ref: 22697570404
Node: 文字列の format メソッド7572798
Ref: tutorial/inputoutput the-string-format-method7573020
Ref: 226b7573020
Ref: tutorial/inputoutput tut-string-format7573020
Ref: 226c7573020
Node: 文字列の手作業でのフォーマット7576157
Ref: tutorial/inputoutput manual-string-formatting7576367
Ref: 226d7576367
Node: 古い文字列書式設定方法7578335
Ref: tutorial/inputoutput old-string-formatting7578504
Ref: 22717578504
Node: ファイルを読み書きする7579162
Ref: tutorial/inputoutput reading-and-writing-files7579301
Ref: 22727579301
Ref: tutorial/inputoutput tut-files7579301
Ref: 22737579301
Node: ファイルオブジェクトのメソッド7583551
Ref: tutorial/inputoutput methods-of-file-objects7583725
Ref: 22747583725
Ref: tutorial/inputoutput tut-filemethods7583725
Ref: 22757583725
Node: json による構造化されたデータの保存7588718
Ref: tutorial/inputoutput saving-structured-data-with-json7588892
Ref: 22777588892
Ref: tutorial/inputoutput tut-json7588892
Ref: 22787588892
Ref: json による構造化されたデータの保存-Footnote-17592737
Node: エラーと例外7592762
Ref: tutorial/errors doc7592887
Ref: 227c7592887
Ref: tutorial/errors errors-and-exceptions7592887
Ref: 227d7592887
Ref: tutorial/errors translation-repo7592887
Ref: 227e7592887
Ref: tutorial/errors tut-errors7592887
Ref: 227f7592887
Node: 構文エラー7593671
Ref: tutorial/errors syntax-errors7593756
Ref: 22807593756
Ref: tutorial/errors tut-syntaxerrors7593756
Ref: 22817593756
Node: 例外7594796
Ref: tutorial/errors exceptions7594911
Ref: 22827594911
Ref: tutorial/errors tut-exceptions7594911
Ref: 22837594911
Node: 例外を処理する7597282
Ref: tutorial/errors handling-exceptions7597403
Ref: 22847597403
Ref: tutorial/errors tut-handling7597403
Ref: 22057597403
Node: 例外を送出する7605221
Ref: tutorial/errors raising-exceptions7605351
Ref: 22857605351
Ref: tutorial/errors tut-raising7605351
Ref: 22867605351
Node: 例外の連鎖7606751
Ref: tutorial/errors exception-chaining7606884
Ref: 22877606884
Ref: tutorial/errors tut-exception-chaining7606884
Ref: 22887606884
Node: ユーザー定義例外7609177
Ref: tutorial/errors tut-userexceptions7609331
Ref: 22897609331
Ref: tutorial/errors user-defined-exceptions7609331
Ref: 228a7609331
Node: クリーンアップ動作を定義する7610391
Ref: tutorial/errors defining-clean-up-actions7610569
Ref: 228b7610569
Ref: tutorial/errors tut-cleanup7610569
Ref: 228c7610569
Ref: クリーンアップ動作を定義する-Footnote-17614614
Ref: クリーンアップ動作を定義する-Footnote-27614656
Node: 定義済みクリーンアップ処理7614698
Ref: tutorial/errors predefined-clean-up-actions7614900
Ref: 228d7614900
Ref: tutorial/errors tut-cleanup-with7614900
Ref: 228e7614900
Node: 複数の関連しない例外の送出と処理7616198
Ref: tutorial/errors raising-and-handling-multiple-unrelated-exceptions7616403
Ref: 228f7616403
Ref: tutorial/errors tut-exception-groups7616403
Ref: 22907616403
Node: ノートによって例外を充実させる7620157
Ref: tutorial/errors enriching-exceptions-with-notes7620314
Ref: 22917620314
Ref: tutorial/errors tut-exception-notes7620314
Ref: 22927620314
Node: クラス7623334
Ref: tutorial/classes doc7623478
Ref: 22937623478
Ref: tutorial/classes classes7623478
Ref: 22947623478
Ref: tutorial/classes translation-repo7623478
Ref: 22957623478
Ref: tutorial/classes tut-classes7623478
Ref: 220d7623478
Node: 名前とオブジェクトについて7626878
Ref: tutorial/classes a-word-about-names-and-objects7627009
Ref: 22977627009
Ref: tutorial/classes tut-object7627009
Ref: 22987627009
Node: Python のスコープと名前空間7628332
Ref: tutorial/classes python-scopes-and-namespaces7628487
Ref: 22997628487
Ref: tutorial/classes tut-scopes7628487
Ref: 224d7628487
Ref: Python のスコープと名前空間-Footnote-17636723
Node: スコープと名前空間の例7637259
Ref: tutorial/classes scopes-and-namespaces-example7637366
Ref: 229b7637366
Ref: tutorial/classes tut-scopeexample7637366
Ref: 229c7637366
Node: クラス初見7638854
Ref: tutorial/classes a-first-look-at-classes7638994
Ref: 229d7638994
Ref: tutorial/classes tut-firstclasses7638994
Ref: 22287638994
Node: クラス定義の構文7639387
Ref: tutorial/classes class-definition-syntax7639499
Ref: 229e7639499
Ref: tutorial/classes tut-classdefinition7639499
Ref: 229f7639499
Node: クラスオブジェクト7641442
Ref: tutorial/classes class-objects7641599
Ref: 22a07641599
Ref: tutorial/classes tut-classobjects7641599
Ref: 22a17641599
Node: インスタンスオブジェクト7644532
Ref: tutorial/classes instance-objects7644695
Ref: 22a37644695
Ref: tutorial/classes tut-instanceobjects7644695
Ref: 22a47644695
Node: メソッドオブジェクト7646524
Ref: tutorial/classes method-objects7646696
Ref: 22a57646696
Ref: tutorial/classes tut-methodobjects7646696
Ref: 22a67646696
Node: クラスとインスタンス変数7649181
Ref: tutorial/classes class-and-instance-variables7649308
Ref: 22a77649308
Ref: tutorial/classes tut-class-and-instance-variables7649308
Ref: 22a87649308
Node: いろいろな注意点7651557
Ref: tutorial/classes random-remarks7651666
Ref: 22a97651666
Ref: tutorial/classes tut-remarks7651666
Ref: 22aa7651666
Node: 継承7656817
Ref: tutorial/classes inheritance7656935
Ref: 22ab7656935
Ref: tutorial/classes tut-inheritance7656935
Ref: 22ac7656935
Node: 多重継承7660797
Ref: tutorial/classes multiple-inheritance7660852
Ref: 22ad7660852
Ref: tutorial/classes tut-multiple7660852
Ref: 22ae7660852
Node: プライベート変数7663451
Ref: tutorial/classes private-variables7663566
Ref: 22b07663566
Ref: tutorial/classes tut-private7663566
Ref: 22967663566
Node: 残りのはしばし7667055
Ref: tutorial/classes odds-and-ends7667188
Ref: 22b27667188
Ref: tutorial/classes tut-odds7667188
Ref: 22b37667188
Node: イテレータ iterator7668627
Ref: tutorial/classes iterators7668764
Ref: 22b67668764
Ref: tutorial/classes tut-iterators7668764
Ref: 22b77668764
Node: ジェネレータ generator7671547
Ref: tutorial/classes generators7671684
Ref: 22b97671684
Ref: tutorial/classes tut-generators7671684
Ref: 22ba7671684
Node: ジェネレータ式7673622
Ref: tutorial/classes generator-expressions7673726
Ref: 22bd7673726
Ref: tutorial/classes tut-genexps7673726
Ref: 22be7673726
Node: Brief tour of the standard library7675543
Ref: tutorial/stdlib doc7675715
Ref: 22bf7675715
Ref: tutorial/stdlib brief-tour-of-the-standard-library7675715
Ref: 22c07675715
Ref: tutorial/stdlib translation-repo7675715
Ref: 22c17675715
Ref: tutorial/stdlib tut-brieftour7675715
Ref: 22c27675715
Node: Operating system interface7676107
Ref: tutorial/stdlib operating-system-interface7676227
Ref: 22c37676227
Ref: tutorial/stdlib tut-os-interface7676227
Ref: 22c47676227
Node: File wildcards7677753
Ref: tutorial/stdlib file-wildcards7677904
Ref: 22c57677904
Ref: tutorial/stdlib tut-file-wildcards7677904
Ref: 22c67677904
Node: Command-line arguments7678218
Ref: tutorial/stdlib command-line-arguments7678391
Ref: 22c77678391
Ref: tutorial/stdlib tut-command-line-arguments7678391
Ref: 22c87678391
Node: Error output redirection and program termination7679765
Ref: tutorial/stdlib error-output-redirection-and-program-termination7679947
Ref: 22c97679947
Ref: tutorial/stdlib tut-stderr7679947
Ref: 22ca7679947
Node: String pattern matching7680561
Ref: tutorial/stdlib string-pattern-matching7680727
Ref: 22cb7680727
Ref: tutorial/stdlib tut-string-pattern-matching7680727
Ref: 22cc7680727
Node: 数学7681427
Ref: tutorial/stdlib mathematics7681560
Ref: 22cd7681560
Ref: tutorial/stdlib tut-mathematics7681560
Ref: 22ce7681560
Node: Internet access7682900
Ref: tutorial/stdlib internet-access7683025
Ref: 22cf7683025
Ref: tutorial/stdlib tut-internet-access7683025
Ref: 22d07683025
Node: Dates and times7684227
Ref: tutorial/stdlib dates-and-times7684362
Ref: 22d17684362
Ref: tutorial/stdlib tut-dates-and-times7684362
Ref: 22d27684362
Node: Data compression7685344
Ref: tutorial/stdlib data-compression7685487
Ref: 22d37685487
Ref: tutorial/stdlib tut-data-compression7685487
Ref: 22d47685487
Node: Performance measurement7686058
Ref: tutorial/stdlib performance-measurement7686201
Ref: 22d57686201
Ref: tutorial/stdlib tut-performance-measurement7686201
Ref: 22d67686201
Node: Quality control7687350
Ref: tutorial/stdlib quality-control7687495
Ref: 22d77687495
Ref: tutorial/stdlib tut-quality-control7687495
Ref: 22d87687495
Node: Batteries included7689397
Ref: tutorial/stdlib batteries-included7689510
Ref: 22d97689510
Ref: tutorial/stdlib tut-batteries-included7689510
Ref: 22da7689510
Ref: Batteries included-Footnote-17691929
Node: Brief tour of the standard library --- part II7691988
Ref: tutorial/stdlib2 doc7692181
Ref: 22db7692181
Ref: tutorial/stdlib2 brief-tour-of-the-standard-library-part-ii7692181
Ref: 22dc7692181
Ref: tutorial/stdlib2 translation-repo7692181
Ref: 22dd7692181
Ref: tutorial/stdlib2 tut-brieftourtwo7692181
Ref: 22de7692181
Node: Output formatting7692826
Ref: tutorial/stdlib2 output-formatting7692962
Ref: 22df7692962
Ref: tutorial/stdlib2 tut-output-formatting7692962
Ref: 22e07692962
Node: 文字列テンプレート7695579
Ref: tutorial/stdlib2 templating7695763
Ref: 22e17695763
Ref: tutorial/stdlib2 tut-templating7695763
Ref: 22e27695763
Node: Working with binary data record layouts7699120
Ref: tutorial/stdlib2 tut-binary-formats7699320
Ref: 22e57699320
Ref: tutorial/stdlib2 working-with-binary-data-record-layouts7699320
Ref: 22e67699320
Node: マルチスレッディング<2>7700691
Ref: tutorial/stdlib2 multi-threading7700876
Ref: 22e77700876
Ref: tutorial/stdlib2 tut-multi-threading7700876
Ref: 22e87700876
Node: ログ記録7703308
Ref: tutorial/stdlib2 logging7703469
Ref: 22e97703469
Ref: tutorial/stdlib2 tut-logging7703469
Ref: 22ea7703469
Node: Weak references7705045
Ref: tutorial/stdlib2 tut-weak-references7705201
Ref: 22f17705201
Ref: tutorial/stdlib2 weak-references7705201
Ref: 22f27705201
Node: Tools for working with lists7707364
Ref: tutorial/stdlib2 tools-for-working-with-lists7707541
Ref: 22f37707541
Ref: tutorial/stdlib2 tut-list-tools7707541
Ref: 22f47707541
Node: Decimal floating-point arithmetic7710490
Ref: tutorial/stdlib2 decimal-floating-point-arithmetic7710643
Ref: 22f57710643
Ref: tutorial/stdlib2 tut-decimal-fp7710643
Ref: 22f67710643
Node: 仮想環境とパッケージ7712988
Ref: tutorial/venv doc7713162
Ref: 22f77713162
Ref: tutorial/venv translation-repo7713162
Ref: 22f87713162
Ref: tutorial/venv tut-venv7713162
Ref: 22f97713162
Ref: tutorial/venv virtual-environments-and-packages7713162
Ref: 22fa7713162
Node: はじめに<4>7713336
Ref: tutorial/venv introduction7713448
Ref: 22fb7713448
Node: 仮想環境の作成7715258
Ref: tutorial/venv creating-virtual-environments7715416
Ref: 22fd7715416
Node: pip を使ったパッケージ管理7717766
Ref: tutorial/venv managing-packages-with-pip7717900
Ref: 22fe7717900
Ref: pip を使ったパッケージ管理-Footnote-17722471
Ref: pip を使ったパッケージ管理-Footnote-27722496
Node: さあ何を？7722574
Ref: tutorial/whatnow doc7722735
Ref: 22ff7722735
Ref: tutorial/whatnow translation-repo7722735
Ref: 23007722735
Ref: tutorial/whatnow tut-whatnow7722735
Ref: 23017722735
Ref: tutorial/whatnow what-now7722735
Ref: 23027722735
Ref: さあ何を？-Footnote-17727008
Node: 対話入力編集と履歴置換7727151
Ref: tutorial/interactive doc7727327
Ref: 23047727327
Ref: tutorial/interactive interactive-input-editing-and-history-substitution7727327
Ref: 23057727327
Ref: tutorial/interactive translation-repo7727327
Ref: 23067727327
Ref: tutorial/interactive tut-interacting7727327
Ref: 21d77727327
Ref: 対話入力編集と履歴置換-Footnote-17728023
Node: タブ補完と履歴編集7728084
Ref: tutorial/interactive tab-completion-and-history-editing7728229
Ref: 23077728229
Ref: tutorial/interactive tut-keybindings7728229
Ref: 23087728229
Node: 対話的インタープリタの代替7729322
Ref: tutorial/interactive alternatives-to-the-interactive-interpreter7729467
Ref: 23097729467
Ref: tutorial/interactive tut-commentary7729467
Ref: 230a7729467
Ref: 対話的インタープリタの代替-Footnote-17730664
Ref: 対話的インタープリタの代替-Footnote-27730693
Node: 浮動小数点演算、その問題と制限7730734
Ref: tutorial/floatingpoint doc7730901
Ref: 230c7730901
Ref: tutorial/floatingpoint floating-point-arithmetic-issues-and-limitations7730901
Ref: 230d7730901
Ref: tutorial/floatingpoint translation-repo7730901
Ref: 230e7730901
Ref: tutorial/floatingpoint tut-fp-issues7730901
Ref: 230f7730901
Ref: 浮動小数点演算、その問題と制限-Footnote-17742086
Ref: 浮動小数点演算、その問題と制限-Footnote-27742164
Node: 表現エラー7742215
Ref: tutorial/floatingpoint representation-error7742312
Ref: 23127742312
Ref: tutorial/floatingpoint tut-fp-error7742312
Ref: 23137742312
Node: 付録7746387
Ref: tutorial/appendix doc7746512
Ref: 23147746512
Ref: tutorial/appendix appendix7746512
Ref: 23157746512
Ref: tutorial/appendix translation-repo7746512
Ref: 23167746512
Ref: tutorial/appendix tut-appendix7746512
Ref: 23177746512
Node: 対話モード<2>7746584
Ref: tutorial/appendix interactive-mode7746645
Ref: 23187746645
Ref: tutorial/appendix tut-interac7746645
Ref: 6a67746645
Node: エラー処理7747964
Ref: tutorial/appendix error-handling7748081
Ref: 23197748081
Ref: tutorial/appendix tut-error7748081
Ref: 231a7748081
Ref: エラー処理-Footnote-17749462
Node: 実行可能な Python スクリプト7749569
Ref: tutorial/appendix executable-python-scripts7749743
Ref: 231b7749743
Ref: tutorial/appendix tut-scripts7749743
Ref: 21df7749743
Node: 対話モード用の起動時実行ファイル7751308
Ref: tutorial/appendix the-interactive-startup-file7751503
Ref: 231c7751503
Ref: tutorial/appendix tut-startup7751503
Ref: 231d7751503
Node: カスタマイズ用モジュール7753600
Ref: tutorial/appendix the-customization-modules7753748
Ref: 231e7753748
Ref: tutorial/appendix tut-customize7753748
Ref: 231f7753748
Node: Python のセットアップと利用7754998
Ref: using/index doc7755152
Ref: 23207755152
Ref: using/index python-setup-and-usage7755152
Ref: 23217755152
Ref: using/index translation-repo7755152
Ref: 23227755152
Ref: using/index using-index7755152
Ref: 23237755152
Node: コマンドラインと環境<2>7755754
Ref: using/cmdline doc7755919
Ref: 23247755919
Ref: using/cmdline command-line-and-environment7755919
Ref: 23257755919
Ref: using/cmdline using-on-general7755919
Ref: 1fb77755919
Node: コマンドライン7756323
Ref: using/cmdline command-line7756435
Ref: 23277756435
Ref: using/cmdline using-on-cmdline7756435
Ref: 13b57756435
Node: インターフェイスオプション7756932
Ref: using/cmdline interface-options7757059
Ref: 23287757059
Ref: using/cmdline using-on-interface-options7757059
Ref: 23297757059
Ref: using/cmdline cmdoption-c7758751
Ref: 44c7758751
Ref: using/cmdline cmdoption-m7759609
Ref: 4d17759609
Ref: using/cmdline cmdarg-dash7762626
Ref: 232a7762626
Ref: using/cmdline cmdarg-script7763179
Ref: 232b7763179
Ref: インターフェイスオプション-Footnote-17765424
Node: 一般オプション7765466
Ref: using/cmdline generic-options7765629
Ref: 232c7765629
Ref: using/cmdline using-on-generic-options7765629
Ref: 232d7765629
Ref: using/cmdline cmdoption-07765683
Ref: 17e07765683
Ref: using/cmdline cmdoption-h7765698
Ref: 232e7765698
Ref: using/cmdline cmdoption-help7765713
Ref: 9ec7765713
Ref: using/cmdline cmdoption-help-env7765848
Ref: 9ee7765848
Ref: using/cmdline cmdoption-help-xoptions7765989
Ref: 9ef7765989
Ref: using/cmdline cmdoption-help-all7766138
Ref: 9f07766138
Ref: using/cmdline cmdoption-V7766240
Ref: 6ad7766240
Ref: using/cmdline cmdoption-version7766255
Ref: 10d97766255
Node: その他のオプション7766640
Ref: using/cmdline miscellaneous-options7766776
Ref: 232f7766776
Ref: using/cmdline using-on-misc-options7766776
Ref: 13b67766776
Ref: using/cmdline cmdoption-b7766840
Ref: 2f97766840
Ref: using/cmdline cmdoption-B7767614
Ref: 17867767614
Ref: using/cmdline cmdoption-check-hash-based-pycs7767865
Ref: 23307767865
Ref: using/cmdline cmdoption-d7768584
Ref: 23317768584
Ref: using/cmdline cmdoption-E7768815
Ref: d2b7768815
Ref: using/cmdline cmdoption-i7769039
Ref: 18937769039
Ref: using/cmdline cmdoption-I7769765
Ref: d2c7769765
Ref: using/cmdline cmdoption-O7770265
Ref: 4387770265
Ref: using/cmdline cmdoption-OO7770680
Ref: 11727770680
Ref: using/cmdline cmdoption-P7771012
Ref: 9a87771012
Ref: using/cmdline cmdoption-q7771673
Ref: 19b57771673
Ref: using/cmdline cmdoption-R7771840
Ref: 20847771840
Ref: using/cmdline cmdoption-s7772987
Ref: 17477772987
Ref: using/cmdline cmdoption-S7773280
Ref: 15667773280
Ref: using/cmdline cmdoption-u7773667
Ref: 1f9e7773667
Ref: using/cmdline cmdoption-v7773972
Ref: 17dd7773972
Ref: using/cmdline using-on-warnings7774673
Ref: 23377774673
Ref: using/cmdline cmdoption-W7774673
Ref: 1cb7774673
Ref: using/cmdline cmdoption-x7777900
Ref: 23397777900
Ref: using/cmdline cmdoption-X7778106
Ref: 1837778106
Ref: その他のオプション-Footnote-17787961
Ref: その他のオプション-Footnote-27788003
Ref: その他のオプション-Footnote-37788045
Ref: その他のオプション-Footnote-47788087
Ref: その他のオプション-Footnote-57788129
Ref: その他のオプション-Footnote-67788171
Ref: その他のオプション-Footnote-77788213
Ref: その他のオプション-Footnote-87788255
Node: 色の制御7788287
Ref: using/cmdline controlling-color7788393
Ref: 233f7788393
Ref: using/cmdline using-on-controlling-color7788393
Ref: 1ba7788393
Ref: 色の制御-Footnote-17789680
Ref: 色の制御-Footnote-27789713
Node: 環境変数7789743
Ref: using/cmdline environment-variables7789855
Ref: 23407789855
Ref: using/cmdline using-on-envvars7789855
Ref: 9ed7789855
Ref: using/cmdline envvar-PYTHONHOME7790174
Ref: 3b57790174
Ref: using/cmdline envvar-PYTHONPATH7790932
Ref: 13cb7790932
Ref: using/cmdline envvar-PYTHONSAFEPATH7792357
Ref: 9a97792357
Ref: using/cmdline envvar-PYTHONPLATLIBDIR7792582
Ref: 1f377792582
Ref: using/cmdline envvar-PYTHONSTARTUP7792746
Ref: 45a7792746
Ref: using/cmdline envvar-PYTHONOPTIMIZE7793577
Ref: 23337793577
Ref: using/cmdline envvar-PYTHONBREAKPOINT7793848
Ref: ea47793848
Ref: using/cmdline envvar-PYTHONDEBUG7794451
Ref: 23327794451
Ref: using/cmdline envvar-PYTHONINSPECT7794826
Ref: 18927794826
Ref: using/cmdline envvar-PYTHONUNBUFFERED7795554
Ref: 1f9f7795554
Ref: using/cmdline envvar-PYTHONVERBOSE7795728
Ref: 23367795728
Ref: using/cmdline envvar-PYTHONCASEOK7795999
Ref: d2a7795999
Ref: using/cmdline envvar-PYTHONDONTWRITEBYTECODE7796237
Ref: 17877796237
Ref: using/cmdline envvar-PYTHONPYCACHEPREFIX7796557
Ref: d707796557
Ref: using/cmdline envvar-PYTHONHASHSEED7796892
Ref: 14347796892
Ref: using/cmdline envvar-PYTHONINTMAXSTRDIGITS7797736
Ref: 1d577797736
Ref: using/cmdline envvar-PYTHONIOENCODING7797966
Ref: 13b87797966
Ref: using/cmdline envvar-PYTHONNOUSERSITE7798923
Ref: 17487798923
Ref: using/cmdline envvar-PYTHONUSERBASE7799229
Ref: 17467799229
Ref: using/cmdline envvar-PYTHONEXECUTABLE7799699
Ref: 23457799699
Ref: using/cmdline envvar-PYTHONWARNINGS7799958
Ref: 1cc7799958
Ref: using/cmdline envvar-PYTHONFAULTHANDLER7801057
Ref: 143c7801057
Ref: using/cmdline envvar-PYTHONTRACEMALLOC7801500
Ref: 233b7801500
Ref: using/cmdline envvar-PYTHONPROFILEIMPORTTIME7802063
Ref: ebf7802063
Ref: using/cmdline envvar-PYTHONASYNCIODEBUG7802544
Ref: 23467802544
Ref: using/cmdline envvar-PYTHONMALLOC7802791
Ref: 10267802791
Ref: using/cmdline envvar-PYTHONMALLOCSTATS7804539
Ref: 21437804539
Ref: using/cmdline envvar-PYTHON_PYMALLOC_HUGEPAGES7805242
Ref: 3e27805242
Ref: using/cmdline envvar-PYTHONLEGACYWINDOWSFSENCODING7806349
Ref: 15e7806349
Ref: using/cmdline envvar-PYTHONLEGACYWINDOWSSTDIO7806789
Ref: 101d7806789
Ref: using/cmdline envvar-PYTHONCOERCECLOCALE7807254
Ref: e9f7807254
Ref: using/cmdline envvar-PYTHONDEVMODE7810011
Ref: eb97810011
Ref: using/cmdline envvar-PYTHONUTF87810350
Ref: 1b87810350
Ref: using/cmdline envvar-PYTHONWARNDEFAULTENCODING7810638
Ref: ba17810638
Ref: using/cmdline envvar-PYTHONNODEBUGRANGES7810957
Ref: 9ba7810957
Ref: using/cmdline envvar-PYTHONPERFSUPPORT7811418
Ref: 8897811418
Ref: using/cmdline envvar-PYTHON_PERF_JIT_SUPPORT7811832
Ref: 6be7811832
Ref: using/cmdline envvar-PYTHON_DISABLE_REMOTE_DEBUG7812285
Ref: 4207812285
Ref: using/cmdline envvar-PYTHON_CPU_COUNT7812745
Ref: 7277812745
Ref: using/cmdline envvar-PYTHON_FROZEN_MODULES7813038
Ref: 6bc7813038
Ref: using/cmdline envvar-PYTHON_COLORS7813675
Ref: 68e7813675
Ref: using/cmdline envvar-PYTHON_BASIC_REPL7813929
Ref: 4597813929
Ref: using/cmdline envvar-PYTHON_BASIC_COMPLETER7814219
Ref: 1e17814219
Ref: using/cmdline envvar-PYTHON_HISTORY7814458
Ref: 6bf7814458
Ref: using/cmdline envvar-PYTHON_GIL7814699
Ref: 6ac7814699
Ref: using/cmdline envvar-PYTHON_THREAD_INHERIT_CONTEXT7815140
Ref: 1aaf7815140
Ref: using/cmdline envvar-PYTHON_CONTEXT_AWARE_WARNINGS7815602
Ref: 1aa37815602
Ref: using/cmdline envvar-PYTHON_PATHCONFIG_WARNINGS7815990
Ref: 19737815990
Ref: using/cmdline envvar-PYTHON_JIT7816326
Ref: 6677816326
Ref: using/cmdline envvar-PYTHON_TLBC7816571
Ref: 233d7816571
Ref: using/cmdline envvar-PYTHON_LAZY_IMPORTS7816914
Ref: 1847816914
Ref: 環境変数-Footnote-17817421
Ref: 環境変数-Footnote-27817463
Ref: 環境変数-Footnote-37817505
Ref: 環境変数-Footnote-47817582
Ref: 環境変数-Footnote-57817736
Ref: 環境変数-Footnote-67817778
Ref: 環境変数-Footnote-77817820
Node: デバッグモード変数7817862
Ref: using/cmdline debug-mode-variables7817938
Ref: 234d7817938
Ref: using/cmdline envvar-PYTHONDUMPREFS7818002
Ref: d737818002
Ref: using/cmdline envvar-PYTHONDUMPREFSFILE7818297
Ref: 1e557818297
Ref: using/cmdline envvar-PYTHON_PRESITE7818645
Ref: 19207818645
Node: Unix プラットフォームで Python を使う7819472
Ref: using/unix doc7819668
Ref: 234e7819668
Ref: using/unix translation-repo7819668
Ref: 234f7819668
Ref: using/unix using-on-unix7819668
Ref: 23507819668
Ref: using/unix using-python-on-unix-platforms7819668
Ref: 23517819668
Node: 最新バージョンの Python の取得とインストール7819969
Ref: using/unix getting-and-installing-the-latest-version-of-python7820145
Ref: 23527820145
Node: Linux7820310
Ref: using/unix on-linux7820442
Ref: 23537820442
Node: IDLE のインストール7821402
Ref: using/unix installing-idle7821470
Ref: 23547821470
Ref: using/unix installing-idle-on-linux7821470
Ref: 23557821470
Node: FreeBSD と OpenBSD7821993
Ref: using/unix on-freebsd-and-openbsd7822125
Ref: 23567822125
Node: Python のビルド7822801
Ref: using/unix building-python7823029
Ref: 23577823029
Ref: using/unix building-python-on-unix7823029
Ref: 12a77823029
Ref: Python のビルド-Footnote-17824150
Ref: Python のビルド-Footnote-27824218
Ref: Python のビルド-Footnote-37824267
Ref: Python のビルド-Footnote-47824330
Node: Python に関係するパスとファイル7824393
Ref: using/unix python-related-paths-and-files7824571
Ref: 235a7824571
Node: その他<2>7826194
Ref: using/unix miscellaneous7826376
Ref: 235d7826376
Node: カスタムの OpenSSL7827158
Ref: using/unix custom-openssl7827288
Ref: 235e7827288
Ref: using/unix unix-custom-openssl7827288
Ref: 235f7827288
Node: Python を構成する7828917
Ref: using/configure doc7829108
Ref: 23607829108
Ref: using/configure configure-python7829108
Ref: 23617829108
Ref: using/configure translation-repo7829108
Ref: 23627829108
Node: ビルド要件7829312
Ref: using/configure build-requirements7829422
Ref: 23587829422
Ref: using/configure id17829422
Ref: 23637829422
Ref: ビルド要件-Footnote-17830455
Ref: ビルド要件-Footnote-27830498
Ref: ビルド要件-Footnote-37830581
Ref: ビルド要件-Footnote-47830628
Ref: ビルド要件-Footnote-57830685
Ref: ビルド要件-Footnote-67830727
Node: オプションのモジュールの要件7830769
Ref: using/configure optional-module-requirements7830863
Ref: 23647830863
Ref: using/configure requirements-for-optional-modules7830863
Ref: 23657830863
Ref: オプションのモジュールの要件-Footnote-17836514
Ref: オプションのモジュールの要件-Footnote-27836552
Ref: オプションのモジュールの要件-Footnote-37836591
Ref: オプションのモジュールの要件-Footnote-47836623
Ref: オプションのモジュールの要件-Footnote-57836680
Ref: オプションのモジュールの要件-Footnote-67836789
Ref: オプションのモジュールの要件-Footnote-77836850
Ref: オプションのモジュールの要件-Footnote-87836892
Ref: オプションのモジュールの要件-Footnote-97836993
Ref: オプションのモジュールの要件-Footnote-107837037
Ref: オプションのモジュールの要件-Footnote-117837160
Ref: オプションのモジュールの要件-Footnote-127837215
Ref: オプションのモジュールの要件-Footnote-137837418
Ref: オプションのモジュールの要件-Footnote-147837456
Ref: オプションのモジュールの要件-Footnote-157837663
Ref: オプションのモジュールの要件-Footnote-167837692
Ref: オプションのモジュールの要件-Footnote-177837727
Ref: オプションのモジュールの要件-Footnote-187837757
Ref: オプションのモジュールの要件-Footnote-197837799
Ref: オプションのモジュールの要件-Footnote-207837890
Node: 生成されるファイル7837927
Ref: using/configure generated-files7838070
Ref: 236a7838070
Node: 構成スクリプト7838555
Ref: using/configure configure-script7838640
Ref: 236b7838640
Ref: 構成スクリプト-Footnote-17839499
Ref: 構成スクリプト-Footnote-27839541
Ref: 構成スクリプト-Footnote-37839587
Node: Configureオプション7839649
Ref: using/configure configure-options7839805
Ref: 23597839805
Ref: using/configure id127839805
Ref: 236c7839805
Node: 一般的なオプション7840656
Ref: using/configure general-options7840788
Ref: 236d7840788
Ref: using/configure cmdoption-enable-loadable-sqlite-extensions7840852
Ref: 236e7840852
Ref: using/configure cmdoption-disable-ipv67841209
Ref: 236f7841209
Ref: using/configure cmdoption-enable-big-digits7841416
Ref: b367841416
Ref: using/configure cmdoption-with-suffix7841814
Ref: 23707841814
Ref: using/configure cmdoption-with-tzpath7842456
Ref: 23717842456
Ref: using/configure cmdoption-without-decimal-contextvar7842979
Ref: 23747842979
Ref: using/configure cmdoption-with-dbmliborder7843454
Ref: 23767843454
Ref: using/configure cmdoption-without-c-locale-coercion7843811
Ref: 23777843811
Ref: using/configure cmdoption-with-platlibdir7844148
Ref: 19dd7844148
Ref: using/configure cmdoption-with-wheel-pkg-dir7844464
Ref: c677844464
Ref: using/configure cmdoption-with-pkg-config7845081
Ref: 23787845081
Ref: using/configure cmdoption-with-missing-stdlib-config7845538
Ref: 3de7845538
Ref: using/configure cmdoption-enable-pystats7846476
Ref: 1d557846476
Ref: using/configure free-threading-build7848823
Ref: 23797848823
Ref: using/configure cmdoption-disable-gil7848823
Ref: 6ab7848823
Ref: using/configure c Py_GIL_DISABLED7848850
Ref: 193f7848850
Ref: using/configure cmdoption-enable-experimental-jit7849182
Ref: 6687849182
Ref: using/configure cmdoption-arg-PKG_CONFIG7850367
Ref: 237a7850367
Ref: using/configure cmdoption-arg-PKG_CONFIG_LIBDIR7850431
Ref: 237b7850431
Ref: using/configure cmdoption-arg-PKG_CONFIG_PATH7850462
Ref: 237c7850462
Ref: using/configure cmdoption-disable-epoll7850523
Ref: 195b7850523
Ref: 一般的なオプション-Footnote-17850926
Ref: 一般的なオプション-Footnote-27850968
Ref: 一般的なオプション-Footnote-37851010
Ref: 一般的なオプション-Footnote-47851062
Node: C コンパイラのオプション7851115
Ref: using/configure c-compiler-options7851283
Ref: 237d7851283
Ref: using/configure cmdoption-arg-CC7851361
Ref: 237e7851361
Ref: using/configure cmdoption-arg-CFLAGS7851419
Ref: 237f7851419
Ref: using/configure cmdoption-arg-CPP7851478
Ref: 23807851478
Ref: using/configure cmdoption-arg-CPPFLAGS7851543
Ref: 23817851543
Node: リンカのオプション7851639
Ref: using/configure linker-options7851831
Ref: 23827851831
Ref: using/configure cmdoption-arg-LDFLAGS7851895
Ref: 23837851895
Ref: using/configure cmdoption-arg-LIBS7851982
Ref: 23847851982
Ref: using/configure cmdoption-arg-MACHDEP7852068
Ref: 23857852068
Node: サードパーティ依存関係のオプション7852153
Ref: using/configure configure-options-for-dependencies7852337
Ref: 23697852337
Ref: using/configure options-for-third-party-dependencies7852337
Ref: 23867852337
Ref: using/configure cmdoption-arg-BZIP2_CFLAGS7852465
Ref: 23877852465
Ref: using/configure cmdoption-arg-BZIP2_LIBS7852491
Ref: 23887852491
Ref: using/configure cmdoption-arg-CURSES_CFLAGS7852646
Ref: 23897852646
Ref: using/configure cmdoption-arg-CURSES_LIBS7852673
Ref: 238a7852673
Ref: using/configure cmdoption-arg-GDBM_CFLAGS7852843
Ref: 238b7852843
Ref: using/configure cmdoption-arg-GDBM_LIBS7852868
Ref: 238c7852868
Ref: using/configure cmdoption-arg-LIBEDIT_CFLAGS7852941
Ref: 238d7852941
Ref: using/configure cmdoption-arg-LIBEDIT_LIBS7852969
Ref: 238e7852969
Ref: using/configure cmdoption-arg-LIBFFI_CFLAGS7853118
Ref: 238f7853118
Ref: using/configure cmdoption-arg-LIBFFI_LIBS7853145
Ref: 23907853145
Ref: using/configure cmdoption-arg-LIBMPDEC_CFLAGS7853290
Ref: 23917853290
Ref: using/configure cmdoption-arg-LIBMPDEC_LIBS7853319
Ref: 23927853319
Ref: using/configure cmdoption-arg-LIBLZMA_CFLAGS7853469
Ref: 23937853469
Ref: using/configure cmdoption-arg-LIBLZMA_LIBS7853497
Ref: 23947853497
Ref: using/configure cmdoption-arg-LIBREADLINE_CFLAGS7853642
Ref: 23957853642
Ref: using/configure cmdoption-arg-LIBREADLINE_LIBS7853674
Ref: 23967853674
Ref: using/configure cmdoption-arg-LIBSQLITE3_CFLAGS7853831
Ref: 23977853831
Ref: using/configure cmdoption-arg-LIBSQLITE3_LIBS7853862
Ref: 23987853862
Ref: using/configure cmdoption-arg-LIBUUID_CFLAGS7854016
Ref: 23997854016
Ref: using/configure cmdoption-arg-LIBUUID_LIBS7854044
Ref: 239a7854044
Ref: using/configure cmdoption-arg-LIBZSTD_CFLAGS7854190
Ref: 239b7854190
Ref: using/configure cmdoption-arg-LIBZSTD_LIBS7854218
Ref: 239c7854218
Ref: using/configure cmdoption-arg-PANEL_CFLAGS7854404
Ref: 239d7854404
Ref: using/configure cmdoption-arg-PANEL_LIBS7854430
Ref: 239e7854430
Ref: using/configure cmdoption-arg-TCLTK_CFLAGS7854675
Ref: 239f7854675
Ref: using/configure cmdoption-arg-TCLTK_LIBS7854701
Ref: 23a07854701
Ref: using/configure cmdoption-arg-ZLIB_CFLAGS7854799
Ref: 23a17854799
Ref: using/configure cmdoption-arg-ZLIB_LIBS7854824
Ref: 23a27854824
Node: WebAssembly オプション7854966
Ref: using/configure webassembly-options7855156
Ref: 23a37855156
Ref: using/configure cmdoption-enable-wasm-dynamic-linking7855224
Ref: 1dd77855224
Ref: using/configure cmdoption-enable-wasm-pthreads7855608
Ref: 1da87855608
Node: インストールオプション7855734
Ref: using/configure install-options7855921
Ref: 23a47855921
Ref: using/configure cmdoption-prefix7855995
Ref: 235b7855995
Ref: using/configure cmdoption-exec-prefix7856482
Ref: 235c7856482
Ref: using/configure cmdoption-disable-test-modules7856783
Ref: c667856783
Ref: using/configure cmdoption-with-ensurepip7857100
Ref: 23a57857100
Node: パフォーマンスに関するオプション7857592
Ref: using/configure performance-options7857780
Ref: 23a67857780
Ref: using/configure cmdoption-enable-optimizations7858078
Ref: c3d7858078
Ref: using/configure envvar-PROFILE_TASK7859230
Ref: 1ca37859230
Ref: using/configure cmdoption-with-lto7859553
Ref: b357859553
Ref: using/configure cmdoption-enable-bolt7860079
Ref: 23a77860079
Ref: using/configure cmdoption-arg-BOLT_APPLY_FLAGS7861146
Ref: 23a87861146
Ref: using/configure cmdoption-arg-BOLT_INSTRUMENT_FLAGS7861282
Ref: 23a97861282
Ref: using/configure cmdoption-with-computed-gotos7861410
Ref: 23aa7861410
Ref: using/configure cmdoption-with-tail-call-interp7861542
Ref: 4237861542
Ref: using/configure cmdoption-without-frame-pointers7861948
Ref: 3e47861948
Ref: using/configure cmdoption-without-mimalloc7863270
Ref: 23ab7863270
Ref: using/configure cmdoption-without-pymalloc7863587
Ref: 23ac7863587
Ref: using/configure cmdoption-with-pymalloc-hugepages7863784
Ref: 3e07863784
Ref: using/configure cmdoption-without-doc-strings7865106
Ref: 23ad7865106
Ref: using/configure cmdoption-enable-profiling7865401
Ref: 23ae7865401
Ref: using/configure cmdoption-with-strict-overflow7865509
Ref: 1cf17865509
Ref: using/configure cmdoption-without-remote-debug7865664
Ref: 4217865664
Ref: using/configure c Py_REMOTE_DEBUG7866110
Ref: 23af7866110
Ref: パフォーマンスに関するオプション-Footnote-17866482
Ref: パフォーマンスに関するオプション-Footnote-27866542
Ref: パフォーマンスに関するオプション-Footnote-37866590
Ref: パフォーマンスに関するオプション-Footnote-47866664
Ref: パフォーマンスに関するオプション-Footnote-57866706
Ref: パフォーマンスに関するオプション-Footnote-67866783
Ref: パフォーマンスに関するオプション-Footnote-77866937
Ref: パフォーマンスに関するオプション-Footnote-87866979
Node: Python デバッグビルド7867021
Ref: using/configure debug-build7867189
Ref: 3e37867189
Ref: using/configure python-debug-build7867189
Ref: 23b07867189
Node: Debug options7869591
Ref: using/configure debug-options7869741
Ref: 23b17869741
Ref: using/configure cmdoption-with-pydebug7869786
Ref: 8597869786
Ref: using/configure cmdoption-with-trace-refs7869920
Ref: 82e7869920
Ref: using/configure cmdoption-with-assertions7870569
Ref: 8267870569
Ref: using/configure cmdoption-with-valgrind7870955
Ref: 23b37870955
Ref: using/configure cmdoption-with-dtrace7871031
Ref: 23b47871031
Ref: using/configure cmdoption-with-address-sanitizer7871202
Ref: 23b57871202
Ref: using/configure cmdoption-with-memory-sanitizer7871572
Ref: 23b67871572
Ref: using/configure cmdoption-with-undefined-behavior-sanitizer7871726
Ref: 23b77871726
Ref: using/configure cmdoption-with-thread-sanitizer7871907
Ref: 23b87871907
Node: リンカのオプション<2>7872050
Ref: using/configure id137872189
Ref: 23b97872189
Ref: using/configure cmdoption-enable-shared7872255
Ref: c3e7872255
Ref: using/configure cmdoption-without-static-libpython7872369
Ref: c687872369
Ref: using/configure cmdoption-enable-static-libpython-for-interpreter7872557
Ref: 19397872557
Node: Libraries options7873146
Ref: using/configure libraries-options7873288
Ref: 23ba7873288
Ref: using/configure cmdoption-with-libs7873343
Ref: 23bb7873343
Ref: using/configure cmdoption-with-system-expat7873436
Ref: 1d4a7873436
Ref: using/configure cmdoption-with-readline7873567
Ref: 23677873567
Ref: using/configure cmdoption-without-readline7873813
Ref: 23bc7873813
Ref: using/configure cmdoption-with-libm7873996
Ref: 23bd7873996
Ref: using/configure cmdoption-with-libc7874115
Ref: 23be7874115
Ref: using/configure cmdoption-with-openssl7874231
Ref: 23bf7874231
Ref: using/configure cmdoption-with-openssl-rpath7874328
Ref: c697874328
Node: Security Options7874666
Ref: using/configure security-options7874802
Ref: 23c07874802
Ref: using/configure cmdoption-with-hash-algorithm7874855
Ref: 23c17874855
Ref: using/configure cmdoption-with-builtin-hashlib-hashes7875180
Ref: 23687875180
Ref: using/configure cmdoption-with-ssl-default-suites7875481
Ref: 23c27875481
Ref: using/configure cmdoption-disable-safety7875966
Ref: 65f7875966
Ref: using/configure cmdoption-enable-slower-safety7876660
Ref: 6607876660
Ref: Security Options-Footnote-17877328
Ref: Security Options-Footnote-27877484
Ref: Security Options-Footnote-37877696
Ref: Security Options-Footnote-47877916
Ref: Security Options-Footnote-57878072
Node: macOS のオプション7878287
Ref: using/configure macos-options7878428
Ref: 23c37878428
Ref: using/configure cmdoption-enable-universalsdk7878523
Ref: d387878523
Ref: using/configure cmdoption-07878558
Ref: 23c47878558
Ref: using/configure cmdoption-enable-framework7878821
Ref: 23c57878821
Ref: using/configure cmdoption-17878853
Ref: 23c67878853
Ref: using/configure cmdoption-with-universal-archs7879131
Ref: 23c77879131
Ref: using/configure cmdoption-with-framework-name7879985
Ref: 23c87879985
Ref: using/configure cmdoption-with-app-store-compliance7880231
Ref: 1bc37880231
Ref: using/configure cmdoption-27880272
Ref: 23c97880272
Ref: macOS のオプション-Footnote-17880976
Ref: macOS のオプション-Footnote-27881043
Node: iOS のオプション7881141
Ref: using/configure ios-options7881308
Ref: 23ca7881308
Ref: using/configure cmdoption-37881399
Ref: 23cb7881399
Ref: using/configure cmdoption-47881592
Ref: 23cc7881592
Ref: iOS のオプション-Footnote-17881764
Node: クロスコンパイルのオプション7881831
Ref: using/configure cross-compiling-options7881965
Ref: 23cd7881965
Ref: using/configure cmdoption-build7882522
Ref: 23ce7882522
Ref: using/configure cmdoption-host7882672
Ref: 23cf7882672
Ref: using/configure cmdoption-with-build-python7882841
Ref: 23d07882841
Ref: using/configure cmdoption-arg-CONFIG_SITE7883005
Ref: 23d17883005
Ref: using/configure cmdoption-arg-HOSTRUNNER7883292
Ref: 23d27883292
Node: Python ビルドシステム7883681
Ref: using/configure python-build-system7883835
Ref: 23d37883835
Node: ビルドシステムの主要なファイル7884037
Ref: using/configure main-files-of-the-build-system7884186
Ref: 23d47884186
Node: 主要なビルドステップ7884623
Ref: using/configure main-build-steps7884802
Ref: 23d57884802
Node: Main Makefile targets7885200
Ref: using/configure main-makefile-targets7885346
Ref: 23d67885346
Node: make7885583
Ref: using/configure make7885667
Ref: 23d77885667
Node: make platform7887108
Ref: using/configure make-platform7887217
Ref: 23d87887217
Node: make profile-opt7887533
Ref: using/configure make-profile-opt7887648
Ref: 23d97887648
Node: make clean7887916
Ref: using/configure make-clean7888032
Ref: 23da7888032
Node: make distclean7888092
Ref: using/configure make-distclean7888204
Ref: 23db7888204
Ref: make distclean-Footnote-17888449
Node: make install7888868
Ref: using/configure make-install7888979
Ref: 23dc7888979
Node: make test7889070
Ref: using/configure make-test7889174
Ref: 23dd7889174
Node: make ci7889533
Ref: using/configure make-ci7889642
Ref: 23de7889642
Node: make buildbottest7889786
Ref: using/configure make-buildbottest7889900
Ref: 23df7889900
Node: make regen-all7890098
Ref: using/configure make-regen-all7890196
Ref: 23e07890196
Node: C extensions7890497
Ref: using/configure c-extensions7890604
Ref: 23e17890604
Node: Compiler and linker flags7892272
Ref: using/configure compiler-and-linker-flags7892393
Ref: 23e27892393
Node: Preprocessor flags7892626
Ref: using/configure preprocessor-flags7892729
Ref: 23e37892729
Ref: using/configure envvar-CONFIGURE_CPPFLAGS7892784
Ref: 23e47892784
Ref: using/configure envvar-CPPFLAGS7892941
Ref: 18717892941
Ref: using/configure envvar-BASECPPFLAGS7893308
Ref: 23e57893308
Ref: using/configure envvar-PY_CPPFLAGS7893368
Ref: 23e67893368
Node: Compiler flags7893613
Ref: using/configure compiler-flags7893737
Ref: 23e77893737
Ref: using/configure envvar-CC7893784
Ref: 186e7893784
Ref: using/configure envvar-CXX7893883
Ref: 23e87893883
Ref: using/configure envvar-CFLAGS7893969
Ref: 186f7893969
Ref: using/configure envvar-CFLAGS_NODIST7894034
Ref: 23e97894034
Ref: using/configure envvar-COMPILEALL_OPTS7894832
Ref: 23ea7894832
Ref: using/configure envvar-EXTRA_CFLAGS7895032
Ref: 23eb7895032
Ref: using/configure envvar-CONFIGURE_CFLAGS7895094
Ref: 23ec7895094
Ref: using/configure envvar-CONFIGURE_CFLAGS_NODIST7895247
Ref: 23ed7895247
Ref: using/configure envvar-BASECFLAGS7895414
Ref: 23ee7895414
Ref: using/configure envvar-OPT7895471
Ref: 23b27895471
Ref: using/configure envvar-CFLAGS_ALIASING7895520
Ref: 23ef7895520
Ref: using/configure envvar-CFLAGS_CEVAL7895667
Ref: 23f07895667
Ref: using/configure envvar-CCSHARED7895780
Ref: 23f17895780
Ref: using/configure envvar-CFLAGSFORSHARED7895921
Ref: 23f27895921
Ref: using/configure envvar-PY_CFLAGS7896134
Ref: 23f37896134
Ref: using/configure envvar-PY_CFLAGS_NODIST7896257
Ref: 23f47896257
Ref: using/configure envvar-PY_STDMODULE_CFLAGS7896421
Ref: 23f57896421
Ref: using/configure envvar-PY_CORE_CFLAGS7896644
Ref: 23f67896644
Ref: using/configure envvar-PY_BUILTIN_MODULE_CFLAGS7896767
Ref: 23f77896767
Ref: using/configure envvar-PURIFY7897035
Ref: 23f87897035
Ref: Compiler flags-Footnote-17897197
Node: Linker flags7897252
Ref: using/configure linker-flags7897349
Ref: 23f97897349
Ref: using/configure envvar-LINKCC7897392
Ref: 23fa7897392
Ref: using/configure envvar-CONFIGURE_LDFLAGS7897545
Ref: 23fb7897545
Ref: using/configure envvar-LDFLAGS_NODIST7897884
Ref: 23fc7897884
Ref: using/configure envvar-CONFIGURE_LDFLAGS_NODIST7898473
Ref: 23fd7898473
Ref: using/configure envvar-LDFLAGS7898642
Ref: 18707898642
Ref: using/configure envvar-LIBS7899112
Ref: 23fe7899112
Ref: using/configure envvar-LDSHARED7899255
Ref: 23ff7899255
Ref: using/configure envvar-BLDSHARED7899371
Ref: 24007899371
Ref: using/configure envvar-PY_LDFLAGS7899508
Ref: 24017899508
Ref: using/configure envvar-PY_LDFLAGS_NODIST7899592
Ref: 24027899592
Ref: using/configure envvar-PY_CORE_LDFLAGS7899725
Ref: 24037899725
Ref: using/configure envvar-EXE_LDFLAGS7899855
Ref: 24047899855
Ref: using/configure envvar-CONFIGURE_EXE_LDFLAGS7900113
Ref: 24067900113
Ref: using/configure envvar-PY_CORE_EXE_LDFLAGS7900277
Ref: 24057900277
Ref: Linker flags-Footnote-17900516
Node: Windows で Python を使う7900571
Ref: using/windows doc7900739
Ref: 24077900739
Ref: using/windows translation-repo7900739
Ref: 24087900739
Ref: using/windows using-on-windows7900739
Ref: e717900739
Ref: using/windows using-python-on-windows7900739
Ref: 24097900739
Ref: using/windows pymanager7903183
Ref: 240d7903183
Ref: using/windows windows-store7903183
Ref: 21d57903183
Ref: using/windows setting-envvars7903183
Ref: 21d67903183
Ref: using/windows windows-path-mod7903183
Ref: 14077903183
Ref: Windows で Python を使う-Footnote-17903724
Ref: Windows で Python を使う-Footnote-27903766
Node: Python install manager7903821
Ref: using/windows launcher7903953
Ref: 9c17903953
Ref: using/windows python-install-manager7903953
Ref: 240e7903953
Node: Installation7904348
Ref: using/windows installation7904449
Ref: 240f7904449
Ref: Installation-Footnote-17906425
Ref: Installation-Footnote-27906480
Node: 基本的な使い方7906522
Ref: using/windows basic-use7906644
Ref: 24117906644
Node: Command help7910830
Ref: using/windows command-help7910956
Ref: 24157910956
Node: Listing runtimes7911833
Ref: using/windows listing-runtimes7911957
Ref: 24167911957
Node: Installing runtimes7913856
Ref: using/windows installing-runtimes7913984
Ref: 24177913984
Node: Offline installs7916525
Ref: using/windows offline-installs7916658
Ref: 241a7916658
Ref: using/windows pymanager-offline7916658
Ref: 24187916658
Node: Uninstalling runtimes7917862
Ref: using/windows uninstalling-runtimes7917989
Ref: 241b7917989
Node: Configuration7919149
Ref: using/windows configuration7919273
Ref: 241c7919273
Ref: using/windows pymanager-config7919273
Ref: 24137919273
Ref: using/windows envvar-PYTHON_MANAGER_DEFAULT7921089
Ref: 24127921089
Ref: using/windows envvar-PYTHON_MANAGER_AUTOMATIC_INSTALL7923216
Ref: 24197923216
Node: Shebang lines7931144
Ref: using/windows pymanager-shebang7931268
Ref: 24147931268
Ref: using/windows shebang-lines7931268
Ref: 241d7931268
Ref: Shebang lines-Footnote-17934823
Node: Advanced installation7934891
Ref: using/windows advanced-installation7935030
Ref: 241e7935030
Ref: using/windows pymanager-advancedinstall7935030
Ref: 24107935030
Ref: Advanced installation-Footnote-17939507
Ref: Advanced installation-Footnote-27939583
Ref: Advanced installation-Footnote-37939662
Ref: Advanced installation-Footnote-47939749
Node: Administrative configuration7939839
Ref: using/windows administrative-configuration7939998
Ref: 24207939998
Ref: using/windows pymanager-admin-config7939998
Ref: 241f7939998
Node: Installing free-threaded binaries7947762
Ref: using/windows install-freethreaded-windows7947916
Ref: 6a97947916
Ref: using/windows installing-free-threaded-binaries7947916
Ref: 24227947916
Node: Index signatures7948530
Ref: using/windows pymanager-index-signatures7948671
Ref: 24217948671
Node: Troubleshooting7952736
Ref: using/windows pymanager-troubleshoot7952835
Ref: 240a7952835
Ref: using/windows troubleshooting7952835
Ref: 24237952835
Ref: Troubleshooting-Footnote-17965667
Ref: Troubleshooting-Footnote-27965718
Ref: Troubleshooting-Footnote-37965786
Node: 埋め込み可能なパッケージ7965854
Ref: using/windows the-embeddable-package7966020
Ref: 24247966020
Ref: using/windows windows-embeddable7966020
Ref: 240c7966020
Node: Python application7968164
Ref: using/windows python-application7968286
Ref: 24257968286
Node: Python の埋め込み7970448
Ref: using/windows embedding-python7970570
Ref: 24267970570
Node: nuget org パッケージ7971627
Ref: using/windows the-nuget-org-packages7971789
Ref: 24277971789
Ref: using/windows windows-nuget7971789
Ref: 240b7971789
Ref: nuget org パッケージ-Footnote-17975016
Ref: nuget org パッケージ-Footnote-27975047
Ref: nuget org パッケージ-Footnote-37975093
Ref: nuget org パッケージ-Footnote-47975142
Node: フリースレッドパッケージ Free-threaded packages7975193
Ref: using/windows free-threaded-packages7975314
Ref: 24287975314
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-17975935
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-27975994
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-37976056
Node: 別のバンドル7976120
Ref: using/windows alternative-bundles7976272
Ref: 24297976272
Ref: 別のバンドル-Footnote-17977579
Ref: 別のバンドル-Footnote-27977632
Ref: 別のバンドル-Footnote-37977675
Ref: 別のバンドル-Footnote-47977727
Ref: 別のバンドル-Footnote-57977894
Node: Supported Windows versions7977931
Ref: using/windows supported-windows-versions7978090
Ref: 242a7978090
Ref: Supported Windows versions-Footnote-17978520
Node: Removing the MAX_PATH limitation7978562
Ref: using/windows max-path7978718
Ref: 10037978718
Ref: using/windows removing-the-max-path-limitation7978718
Ref: 242b7978718
Node: UTF-8 モード7979610
Ref: using/windows utf-8-mode7979764
Ref: 242c7979764
Ref: using/windows win-utf8-mode7979764
Ref: 242d7979764
Ref: UTF-8 モード-Footnote-17981412
Ref: UTF-8 モード-Footnote-27981454
Ref: UTF-8 モード-Footnote-37981496
Node: モジュールの検索7981538
Ref: using/windows finding-modules7981684
Ref: 242e7981684
Ref: using/windows windows-finding-modules7981684
Ref: fe37981684
Node: 追加のモジュール7987897
Ref: using/windows additional-modules7988074
Ref: 242f7988074
Node: PyWin327988593
Ref: using/windows pywin327988679
Ref: 24317988679
Ref: PyWin32-Footnote-17989350
Ref: PyWin32-Footnote-27989392
Ref: PyWin32-Footnote-37989481
Ref: PyWin32-Footnote-47989550
Ref: PyWin32-Footnote-57989644
Ref: PyWin32-Footnote-67989703
Node: cx_Freeze7989753
Ref: using/windows cx-freeze7989839
Ref: 24327989839
Ref: cx_Freeze-Footnote-17990113
Node: Windows 上で Python をコンパイルする7990165
Ref: using/windows compiling-python-on-windows7990347
Ref: 24337990347
Ref: Windows 上で Python をコンパイルする-Footnote-17991302
Ref: Windows 上で Python をコンパイルする-Footnote-27991351
Node: The full installer deprecated7991414
Ref: using/windows the-full-installer-deprecated7991610
Ref: 24357991610
Ref: using/windows windows-full7991610
Ref: 24367991610
Node: インストール手順7992166
Ref: using/windows installation-steps7992300
Ref: 24377992300
Node: Removing the MAX_PATH limitation<2>7995434
Ref: using/windows id27995598
Ref: 24397995598
Node: Installing without UI7996698
Ref: using/windows install-quiet-option7996868
Ref: 9ea7996868
Ref: using/windows installing-without-ui7996868
Ref: 243a7996868
Node: Installing without downloading8009452
Ref: using/windows install-layout-option8009617
Ref: 24388009617
Ref: using/windows installing-without-downloading8009617
Ref: 243b8009617
Node: インストール後の変更8011107
Ref: using/windows modifying-an-install8011287
Ref: 243c8011287
Node: Installing free-threaded binaries<2>8012640
Ref: using/windows id38012781
Ref: 243d8012781
Ref: Installing free-threaded binaries<2>-Footnote-18014528
Node: Python launcher for Windows deprecated8014570
Ref: using/windows python-launcher-for-windows-deprecated8014711
Ref: 243e8014711
Ref: Python launcher for Windows deprecated-Footnote-18016020
Node: 最初に8016062
Ref: using/windows getting-started8016171
Ref: 243f8016171
Node: コマンドラインから起動する8016423
Ref: using/windows from-the-command-line8016550
Ref: 24408016550
Ref: コマンドラインから起動する-Footnote-18019587
Node: 仮想環境 Virtual environments8019629
Ref: using/windows virtual-environments8019798
Ref: 24418019798
Node: スクリプトから起動する8020468
Ref: using/windows from-a-script8020643
Ref: 24428020643
Node: ファイルの関連付けから起動する8022040
Ref: using/windows from-file-associations8022173
Ref: 24438022173
Node: Shebang lines<2>8022894
Ref: using/windows id48023036
Ref: 24448023036
Node: シェバン行の引数8027772
Ref: using/windows arguments-in-shebang-lines8027923
Ref: 24468027923
Node: カスタマイズ8028304
Ref: using/windows customization8028445
Ref: 24478028445
Node: INI ファイルによるカスタマイズ8028619
Ref: using/windows customization-via-ini-files8028786
Ref: 24488028786
Ref: using/windows launcher-ini8028786
Ref: 24458028786
Node: デフォルトのPythonバージョンのカスタマイズ8029707
Ref: using/windows customizing-default-python-versions8029874
Ref: 24498029874
Node: 診断8034719
Ref: using/windows diagnostics8034843
Ref: 244a8034843
Node: Dry run8035321
Ref: using/windows dry-run8035444
Ref: 244b8035444
Node: Install on demand8035878
Ref: using/windows install-on-demand8036007
Ref: 244c8036007
Node: Return codes8036590
Ref: using/windows return-codes8036703
Ref: 244d8036703
Node: macOS で Python を使う8038458
Ref: using/mac doc8038632
Ref: 244e8038632
Ref: using/mac translation-repo8038632
Ref: 244f8038632
Ref: using/mac using-on-mac8038632
Ref: 24508038632
Ref: using/mac using-python-on-macos8038632
Ref: 24518038632
Ref: using/mac getting-osx8039347
Ref: 24538039347
Ref: macOS で Python を使う-Footnote-18039643
Node: Using Python for macOS from python org8039685
Ref: using/mac getting-and-installing-macpython8039820
Ref: 24548039820
Ref: using/mac using-python-for-macos-from-python-org8039820
Ref: 24558039820
Node: インストール手順<2>8040028
Ref: using/mac installation-steps8040176
Ref: 24568040176
Ref: インストール手順<2>-Footnote-18045303
Ref: インストール手順<2>-Footnote-28045345
Ref: インストール手順<2>-Footnote-38045393
Ref: インストール手順<2>-Footnote-48045448
Ref: インストール手順<2>-Footnote-58045495
Node: Python スクリプトの実行方法8045544
Ref: using/mac how-to-run-a-python-script8045692
Ref: 24578045692
Node: Alternative Distributions8047695
Ref: using/mac alternative-bundles8047892
Ref: 24528047892
Ref: using/mac alternative-distributions8047892
Ref: 24598047892
Ref: Alternative Distributions-Footnote-18048966
Ref: Alternative Distributions-Footnote-28049019
Ref: Alternative Distributions-Footnote-38049062
Ref: Alternative Distributions-Footnote-48049086
Node: 追加の Python パッケージのインストール8049119
Ref: using/mac installing-additional-python-packages8049303
Ref: 245a8049303
Ref: using/mac mac-package-manager8049303
Ref: 245b8049303
Ref: using/mac osx-gui-scripts8049474
Ref: 245c8049474
Ref: 追加の Python パッケージのインストール-Footnote-18049512
Node: GUI プログラミング8049591
Ref: using/mac gui-programming8049771
Ref: 245d8049771
Ref: using/mac gui-programming-on-the-mac8049771
Ref: 245e8049771
Ref: GUI プログラミング-Footnote-18050747
Ref: GUI プログラミング-Footnote-28050788
Ref: GUI プログラミング-Footnote-38050828
Ref: GUI プログラミング-Footnote-48050869
Ref: GUI プログラミング-Footnote-58050923
Ref: GUI プログラミング-Footnote-68050948
Ref: GUI プログラミング-Footnote-78050984
Ref: GUI プログラミング-Footnote-88051012
Node: 高度なトピック8051041
Ref: using/mac advanced-topics8051186
Ref: 245f8051186
Node: フリースレッドバイナリ Free-threaded Binaries のインストール8051532
Ref: using/mac install-freethreaded-macos8051710
Ref: 6aa8051710
Ref: using/mac installing-free-threaded-binaries8051710
Ref: 24608051710
Ref: フリースレッドバイナリ Free-threaded Binaries のインストール-Footnote-18056890
Node: Installing using the command line8056932
Ref: using/mac installing-using-the-command-line8057159
Ref: 24628057159
Node: Python アプリケーションの配布8059963
Ref: using/mac distributing-python-applications8060146
Ref: 24638060146
Ref: using/mac distributing-python-applications-on-the-mac8060146
Ref: 24648060146
Ref: Python アプリケーションの配布-Footnote-18060818
Ref: Python アプリケーションの配布-Footnote-28060859
Ref: Python アプリケーションの配布-Footnote-38060900
Ref: Python アプリケーションの配布-Footnote-48060928
Node: App Store コンプライアンス8060961
Ref: using/mac app-store-compliance8061102
Ref: 24658061102
Ref: App Store コンプライアンス-Footnote-18062228
Node: 他のリソース8062322
Ref: using/mac other-resources8062433
Ref: 24668062433
Ref: 他のリソース-Footnote-18062699
Ref: 他のリソース-Footnote-28062742
Node: Android で Python を使う8062811
Ref: using/android doc8062981
Ref: 24678062981
Ref: using/android translation-repo8062981
Ref: 24688062981
Ref: using/android using-android8062981
Ref: 24698062981
Ref: using/android using-python-on-android8062981
Ref: 246a8062981
Node: Android アプリに Python を追加する8064843
Ref: using/android adding-python-to-an-android-app8065018
Ref: 246d8065018
Ref: Android アプリに Python を追加する-Footnote-18066700
Ref: Android アプリに Python を追加する-Footnote-28066738
Ref: Android アプリに Python を追加する-Footnote-38066779
Ref: Android アプリに Python を追加する-Footnote-48066815
Ref: Android アプリに Python を追加する-Footnote-58066882
Ref: Android アプリに Python を追加する-Footnote-68066913
Ref: Android アプリに Python を追加する-Footnote-78066981
Ref: Android アプリに Python を追加する-Footnote-88067031
Ref: Android アプリに Python を追加する-Footnote-98067101
Ref: Android アプリに Python を追加する-Footnote-108067191
Ref: Android アプリに Python を追加する-Footnote-118067314
Node: Android 向けの Python パッケージをビルドする8067415
Ref: using/android building-a-python-package-for-android8067590
Ref: 246e8067590
Ref: Android 向けの Python パッケージをビルドする-Footnote-18068003
Node: iOS で Python を使う8068069
Ref: using/ios doc8068232
Ref: 246f8068232
Ref: using/ios translation-repo8068232
Ref: 24708068232
Ref: using/ios using-ios8068232
Ref: 24718068232
Ref: using/ios using-python-on-ios8068232
Ref: 24728068232
Ref: iOS で Python を使う-Footnote-18070463
Ref: iOS で Python を使う-Footnote-28070491
Node: iOS ランタイムでの Python8070516
Ref: using/ios python-at-runtime-on-ios8070657
Ref: 24738070657
Node: iOS のバージョン互換性8070936
Ref: using/ios ios-version-compatibility8071078
Ref: 24748071078
Node: プラットフォームの識別8071804
Ref: using/ios platform-identification8071994
Ref: 24758071994
Node: 標準ライブラリの利用可能性8072847
Ref: using/ios standard-library-availability8073039
Ref: 24788073039
Node: バイナリ拡張モジュール8073338
Ref: using/ios binary-extension-modules8073533
Ref: 24798073533
Node: コンパイラスタブバイナリ8077351
Ref: using/ios compiler-stub-binaries8077498
Ref: 247d8077498
Node: iOS での Python のインストール8079397
Ref: using/ios installing-python-on-ios8079584
Ref: 247e8079584
Node: iOS アプリビルド用のツール8079812
Ref: using/ios tools-for-building-ios-apps8079982
Ref: 247f8079982
Node: iOS プロジェクトに Python を追加する8081050
Ref: using/ios adding-ios8081263
Ref: 247a8081263
Ref: using/ios adding-python-to-an-ios-project8081263
Ref: 24808081263
Ref: iOS プロジェクトに Python を追加する-Footnote-18087977
Ref: iOS プロジェクトに Python を追加する-Footnote-28088022
Node: Python パッケージのテスト8088094
Ref: using/ios testing-a-python-package8088261
Ref: 24828088261
Ref: Python パッケージのテスト-Footnote-18091346
Ref: Python パッケージのテスト-Footnote-28091416
Node: App Store コンプライアンス<2>8091488
Ref: using/ios app-store-compliance8091634
Ref: 24838091634
Node: 標準ライブラリ内の互換性のないコード8092238
Ref: using/ios incompatible-code-in-the-standard-library8092411
Ref: 24848092411
Ref: 標準ライブラリ内の互換性のないコード-Footnote-18093277
Node: プライバシーマニフェスト8093371
Ref: using/ios privacy-manifests8093544
Ref: 24858093544
Ref: プライバシーマニフェスト-Footnote-18094309
Node: エディタと IDE8094382
Ref: using/editors doc8094508
Ref: 24868094508
Ref: using/editors editors8094508
Ref: 24588094508
Ref: using/editors editors-and-ides8094508
Ref: 24878094508
Ref: using/editors translation-repo8094508
Ref: 24888094508
Ref: エディタと IDE-Footnote-18094954
Node: IDLE --- Python のエディタとシェル8094996
Ref: using/editors idle-python-editor-and-shell8095126
Ref: 24898095126
Node: Other Editors and IDEs8095478
Ref: using/editors other-editors-and-ides8095608
Ref: 248a8095608
Ref: Other Editors and IDEs-Footnote-18095893
Ref: Other Editors and IDEs-Footnote-28095944
Node: Python 言語リファレンス8096015
Ref: reference/index doc8096169
Ref: 248b8096169
Ref: reference/index reference-index8096169
Ref: 3ff8096169
Ref: reference/index the-python-language-reference8096169
Ref: 248c8096169
Ref: reference/index translation-repo8096169
Ref: 248d8096169
Node: はじめに<5>8097662
Ref: reference/introduction doc8097766
Ref: 248e8097766
Ref: reference/introduction id18097766
Ref: 248f8097766
Ref: reference/introduction introduction8097766
Ref: 24908097766
Node: 別のPythonの実装8100336
Ref: reference/introduction alternate-implementations8100457
Ref: 24918100457
Ref: reference/introduction implementations8100457
Ref: 23268100457
Ref: 別のPythonの実装-Footnote-18103333
Ref: 別のPythonの実装-Footnote-28103365
Ref: 別のPythonの実装-Footnote-38103402
Ref: 別のPythonの実装-Footnote-48103434
Node: 本マニュアルにおける表記法8103460
Ref: reference/introduction id28103581
Ref: 24928103581
Ref: reference/introduction notation8103581
Ref: 24938103581
Ref: reference/introduction grammar-token-notation-name8103787
Ref: 24948103787
Ref: reference/introduction grammar-token-notation-letter8103870
Ref: 24958103870
Ref: reference/introduction grammar-token-notation-digit8103905
Ref: 24968103905
Ref: reference/introduction lexical-lookaheads8106643
Ref: 249d8106643
Ref: reference/introduction grammar-token-notation-literal8107228
Ref: 249e8107228
Ref: reference/introduction grammar-token-notation-alt-literal8107482
Ref: 249f8107482
Ref: 本マニュアルにおける表記法-Footnote-18107753
Ref: 本マニュアルにおける表記法-Footnote-28107825
Ref: 本マニュアルにおける表記法-Footnote-38107890
Node: Lexical and Syntactic definitions8107932
Ref: reference/introduction lexical-and-syntactic-definitions8108041
Ref: 24a08108041
Ref: reference/introduction notation-lexical-vs-syntactic8108041
Ref: 249c8108041
Node: 字句解析8109066
Ref: reference/lexical_analysis doc8109197
Ref: 24a58109197
Ref: reference/lexical_analysis lexical8109197
Ref: 24a48109197
Ref: reference/lexical_analysis lexical-analysis8109197
Ref: 24a68109197
Ref: reference/lexical_analysis translation-repo8109197
Ref: 24a78109197
Node: 行構造8113971
Ref: reference/lexical_analysis id18114062
Ref: 24b28114062
Ref: reference/lexical_analysis line-structure8114062
Ref: 24aa8114062
Node: 論理行 logical line8114569
Ref: reference/lexical_analysis id28114669
Ref: 24b38114669
Ref: reference/lexical_analysis logical-lines8114669
Ref: 24b48114669
Node: 物理行 physical line8115112
Ref: reference/lexical_analysis id38115242
Ref: 24b68115242
Ref: reference/lexical_analysis physical-lines8115242
Ref: 24b78115242
Ref: reference/lexical_analysis grammar-token-python-grammar-newline8115966
Ref: 24b88115966
Ref: 物理行 physical line-Footnote-18116065
Node: コメント Comments8116118
Ref: reference/lexical_analysis comments8116268
Ref: 24ad8116268
Ref: reference/lexical_analysis id58116268
Ref: 24b98116268
Node: エンコード宣言 encoding declaration8116646
Ref: reference/lexical_analysis encoding-declarations8116794
Ref: 24ba8116794
Ref: reference/lexical_analysis encodings8116794
Ref: 24a88116794
Ref: reference/lexical_analysis lexical-source-character8118256
Ref: 24a98118256
Ref: reference/lexical_analysis grammar-token-python-grammar-source_character8118478
Ref: 24bb8118478
Node: 明示的な行継続8118540
Ref: reference/lexical_analysis explicit-joining8118691
Ref: 24ac8118691
Ref: reference/lexical_analysis explicit-line-joining8118691
Ref: 24bc8118691
Node: 非明示的な行継続8120080
Ref: reference/lexical_analysis implicit-joining8120195
Ref: 24b58120195
Ref: reference/lexical_analysis implicit-line-joining8120195
Ref: 24bd8120195
Node: 空行8121224
Ref: reference/lexical_analysis blank-lines8121333
Ref: 24be8121333
Ref: reference/lexical_analysis id68121333
Ref: 24bf8121333
Node: インデント8121812
Ref: reference/lexical_analysis id78121921
Ref: 24c08121921
Ref: reference/lexical_analysis indentation8121921
Ref: 24ab8121921
Node: トークン間の空白8125963
Ref: reference/lexical_analysis whitespace8126076
Ref: 24a28126076
Ref: reference/lexical_analysis whitespace-between-tokens8126076
Ref: 24c28126076
Ref: reference/lexical_analysis grammar-token-python-grammar-whitespace8126299
Ref: 24c38126299
Node: End marker8126640
Ref: reference/lexical_analysis end-marker8126729
Ref: 24c48126729
Ref: reference/lexical_analysis endmarker-token8126729
Ref: 24b18126729
Node: その他のトークン8126872
Ref: reference/lexical_analysis id88127002
Ref: 24c68127002
Ref: reference/lexical_analysis other-tokens8127002
Ref: 24c78127002
Node: Names identifiers and keywords8127608
Ref: reference/lexical_analysis identifiers8127741
Ref: 24af8127741
Ref: reference/lexical_analysis names-identifiers-and-keywords8127741
Ref: 24cb8127741
Ref: reference/lexical_analysis grammar-token-python-grammar-NAME8128481
Ref: 24cd8128481
Ref: reference/lexical_analysis grammar-token-python-grammar-name_start8128553
Ref: 24ce8128553
Ref: reference/lexical_analysis grammar-token-python-grammar-name_continue8128625
Ref: 24cf8128625
Ref: reference/lexical_analysis grammar-token-python-grammar-identifier8128668
Ref: 24d08128668
Node: キーワード keyword8129098
Ref: reference/lexical_analysis id98129221
Ref: 24d18129221
Ref: reference/lexical_analysis keywords8129221
Ref: 24988129221
Node: ソフトキーワード8129839
Ref: reference/lexical_analysis id108130030
Ref: 24d28130030
Ref: reference/lexical_analysis soft-keywords8130030
Ref: bea8130030
Node: 予約済みの識別子種 reserved classes of identifiers8130856
Ref: reference/lexical_analysis id-classes8131053
Ref: 24d38131053
Ref: reference/lexical_analysis reserved-classes-of-identifiers8131053
Ref: 24d48131053
Node: Non-ASCII characters in names8133506
Ref: reference/lexical_analysis lexical-names-nonascii8133670
Ref: 24cc8133670
Ref: reference/lexical_analysis non-ascii-characters-in-names8133670
Ref: 24d68133670
Ref: Non-ASCII characters in names-Footnote-18137227
Ref: Non-ASCII characters in names-Footnote-28137284
Ref: Non-ASCII characters in names-Footnote-38137330
Ref: Non-ASCII characters in names-Footnote-48137376
Ref: Non-ASCII characters in names-Footnote-58137453
Ref: Non-ASCII characters in names-Footnote-68137516
Ref: Non-ASCII characters in names-Footnote-78137579
Ref: Non-ASCII characters in names-Footnote-88137621
Node: リテラル8137663
Ref: reference/lexical_analysis id118137814
Ref: 24d78137814
Ref: reference/lexical_analysis literals8137814
Ref: 24d88137814
Node: 文字列およびバイト列リテラル8138219
Ref: reference/lexical_analysis string-and-bytes-literals8138358
Ref: 24da8138358
Ref: reference/lexical_analysis strings8138358
Ref: 24ae8138358
Node: Triple-quoted strings8139539
Ref: reference/lexical_analysis triple-quoted-strings8139663
Ref: 24db8139663
Node: String prefixes8140292
Ref: reference/lexical_analysis string-prefixes8140439
Ref: 24dc8140439
Ref: String prefixes-Footnote-18141694
Node: Formal grammar8141736
Ref: reference/lexical_analysis formal-grammar8141878
Ref: 24df8141878
Ref: reference/lexical_analysis grammar-token-python-grammar-STRING8142172
Ref: 24e08142172
Ref: reference/lexical_analysis grammar-token-python-grammar-stringprefix8142251
Ref: 24e18142251
Ref: reference/lexical_analysis grammar-token-python-grammar-stringcontent8142325
Ref: 24e28142325
Ref: reference/lexical_analysis grammar-token-python-grammar-stringitem8142569
Ref: 24e48142569
Ref: reference/lexical_analysis grammar-token-python-grammar-stringchar8142646
Ref: 24e58142646
Ref: reference/lexical_analysis grammar-token-python-grammar-longstringitem8142733
Ref: 24e38142733
Ref: reference/lexical_analysis grammar-token-python-grammar-stringescapeseq8142789
Ref: 24e68142789
Node: Escape sequences8143009
Ref: reference/lexical_analysis escape-sequences8143150
Ref: 8798143150
Ref: reference/lexical_analysis id128143150
Ref: 24e78143150
Node: Ignored end of line8147062
Ref: reference/lexical_analysis ignored-end-of-line8147161
Ref: 24ee8147161
Ref: reference/lexical_analysis string-escape-ignore8147161
Ref: 24e88147161
Node: Escaped characters8147581
Ref: reference/lexical_analysis escaped-characters8147704
Ref: 24f08147704
Ref: reference/lexical_analysis string-escape-escaped-char8147704
Ref: 24e98147704
Node: Octal character8148129
Ref: reference/lexical_analysis octal-character8148254
Ref: 24f18148254
Ref: reference/lexical_analysis string-escape-oct8148254
Ref: 24ea8148254
Node: Hexadecimal character8148933
Ref: reference/lexical_analysis hexadecimal-character8149063
Ref: 24f28149063
Ref: reference/lexical_analysis string-escape-hex8149063
Ref: 24eb8149063
Node: Named Unicode character8149462
Ref: reference/lexical_analysis named-unicode-character8149607
Ref: 24f38149607
Ref: reference/lexical_analysis string-escape-named8149607
Ref: 24ec8149607
Ref: Named Unicode character-Footnote-18150005
Node: Hexadecimal Unicode characters8150071
Ref: reference/lexical_analysis hexadecimal-unicode-characters8150224
Ref: 24f48150224
Ref: reference/lexical_analysis string-escape-long-hex8150224
Ref: 24ed8150224
Node: Unrecognized escape sequences8150689
Ref: reference/lexical_analysis unrecognized-escape-sequences8150810
Ref: 24f58150810
Node: Bytes literals8151542
Ref: reference/lexical_analysis bytes-literal8151688
Ref: 24dd8151688
Ref: reference/lexical_analysis bytes-literals8151688
Ref: 24f68151688
Node: Raw string literals8152337
Ref: reference/lexical_analysis raw-string-literals8152476
Ref: 24f78152476
Ref: reference/lexical_analysis raw-strings8152476
Ref: 24de8152476
Ref: reference/lexical_analysis f-strings8153793
Ref: 4418153793
Node: f-strings8153793
Ref: reference/lexical_analysis formatted-string-literals8153927
Ref: 24f88153927
Ref: reference/lexical_analysis id138153927
Ref: 24f98153927
Ref: reference/lexical_analysis t-strings8158962
Ref: 1a708158962
Ref: f-strings-Footnote-18158998
Ref: f-strings-Footnote-28159040
Node: t-strings8159082
Ref: reference/lexical_analysis id148159225
Ref: 24fc8159225
Ref: reference/lexical_analysis template-string-literals8159225
Ref: 24fd8159225
Node: Formal grammar for f-strings8159579
Ref: reference/lexical_analysis formal-grammar-for-f-strings8159704
Ref: 24ff8159704
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring8161111
Ref: 25038161111
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_START8161210
Ref: 25048161210
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_END8161290
Ref: 25068161290
Ref: reference/lexical_analysis grammar-token-python-grammar-fstringprefix8161336
Ref: 25078161336
Ref: reference/lexical_analysis grammar-token-python-grammar-f_debug_specifier8161401
Ref: 25098161401
Ref: reference/lexical_analysis grammar-token-python-grammar-f_quote8161430
Ref: 25088161430
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_middle8161503
Ref: 25058161503
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_MIDDLE8161611
Ref: 250b8161611
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_replacement_field8161855
Ref: 250a8161855
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_conversion8162052
Ref: 250d8162052
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_full_format_spec8162109
Ref: 250e8162109
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_format_spec8162188
Ref: 250f8162188
Ref: reference/lexical_analysis grammar-token-python-grammar-f_expression8162301
Ref: 250c8162301
Ref: reference/lexical_analysis grammar-token-python-grammar-tstring8162931
Ref: 25138162931
Node: 数値リテラル8163050
Ref: reference/lexical_analysis numbers8163201
Ref: 24b08163201
Ref: reference/lexical_analysis numeric-literals8163201
Ref: 25148163201
Ref: reference/lexical_analysis grammar-token-python-grammar-NUMBER8163391
Ref: 25158163391
Node: 整数リテラル8164024
Ref: reference/lexical_analysis integer-literals8164129
Ref: 25198164129
Ref: reference/lexical_analysis integers8164129
Ref: 251a8164129
Ref: reference/lexical_analysis grammar-token-python-grammar-integer8165583
Ref: 25168165583
Ref: reference/lexical_analysis grammar-token-python-grammar-decinteger8165731
Ref: 251b8165731
Ref: reference/lexical_analysis grammar-token-python-grammar-bininteger8165804
Ref: 251c8165804
Ref: reference/lexical_analysis grammar-token-python-grammar-octinteger8165870
Ref: 251d8165870
Ref: reference/lexical_analysis grammar-token-python-grammar-hexinteger8165936
Ref: 251e8165936
Ref: reference/lexical_analysis grammar-token-python-grammar-zerointeger8166002
Ref: 251f8166002
Ref: reference/lexical_analysis grammar-token-python-grammar-nonzerodigit8166039
Ref: 25208166039
Ref: reference/lexical_analysis grammar-token-python-grammar-digit8166068
Ref: 25218166068
Ref: reference/lexical_analysis grammar-token-python-grammar-bindigit8166097
Ref: 25228166097
Ref: reference/lexical_analysis grammar-token-python-grammar-octdigit8166126
Ref: 25238166126
Ref: reference/lexical_analysis grammar-token-python-grammar-hexdigit8166155
Ref: 25248166155
Node: Floating-point literals8166366
Ref: reference/lexical_analysis floating8166509
Ref: 25258166509
Ref: reference/lexical_analysis floating-point-literals8166509
Ref: 25268166509
Ref: reference/lexical_analysis grammar-token-python-grammar-floatnumber8167982
Ref: 25178167982
Ref: reference/lexical_analysis grammar-token-python-grammar-digitpart8168202
Ref: 25288168202
Ref: reference/lexical_analysis grammar-token-python-grammar-exponent8168265
Ref: 25298168265
Node: 虚数 imaginary リテラル8168477
Ref: reference/lexical_analysis imaginary8168593
Ref: 252a8168593
Ref: reference/lexical_analysis imaginary-literals8168593
Ref: 252b8168593
Ref: reference/lexical_analysis grammar-token-python-grammar-imagnumber8170121
Ref: 25188170121
Ref: reference/lexical_analysis delimiters8170202
Ref: 249a8170202
Ref: reference/lexical_analysis operators8170202
Ref: 249b8170202
Node: Operators and delimiters8170203
Ref: reference/lexical_analysis lexical-ellipsis8170303
Ref: 24d98170303
Ref: reference/lexical_analysis operators-and-delimiters8170303
Ref: 252c8170303
Ref: reference/lexical_analysis grammar-token-python-grammar-OP8170593
Ref: 252e8170593
Ref: reference/lexical_analysis grammar-token-python-grammar-assignment_operator8170811
Ref: 252f8170811
Ref: reference/lexical_analysis grammar-token-python-grammar-bitwise_operator8170969
Ref: 25308170969
Ref: reference/lexical_analysis grammar-token-python-grammar-comparison_operator8171039
Ref: 25318171039
Ref: reference/lexical_analysis grammar-token-python-grammar-enclosing_delimiter8171109
Ref: 25328171109
Ref: reference/lexical_analysis grammar-token-python-grammar-other_delimiter8171178
Ref: 25338171178
Ref: reference/lexical_analysis grammar-token-python-grammar-arithmetic_operator8171248
Ref: 25348171248
Ref: reference/lexical_analysis grammar-token-python-grammar-other_op8171325
Ref: 25358171325
Node: データモデル8172374
Ref: reference/datamodel doc8172505
Ref: 25388172505
Ref: reference/datamodel data-model8172505
Ref: 25398172505
Ref: reference/datamodel datamodel8172505
Ref: 1f6d8172505
Ref: reference/datamodel translation-repo8172505
Ref: 253a8172505
Node: オブジェクト、値、および型8172669
Ref: reference/datamodel objects8172790
Ref: 253b8172790
Ref: reference/datamodel objects-values-and-types8172790
Ref: 253c8172790
Ref: オブジェクト、値、および型-Footnote-18179126
Node: 標準型の階層8179401
Ref: reference/datamodel the-standard-type-hierarchy8179552
Ref: 253d8179552
Ref: reference/datamodel types8179552
Ref: 253e8179552
Node: None8181133
Ref: reference/datamodel none8181215
Ref: 253f8181215
Node: NotImplemented8181697
Ref: reference/datamodel notimplemented8181796
Ref: 25408181796
Node: Ellipsis8182707
Ref: reference/datamodel ellipsis8182816
Ref: 25428182816
Node: numbers Number8183156
Ref: reference/datamodel numbers-number8183278
Ref: 25438183278
Node: numbers Integral 整数8184784
Ref: reference/datamodel numbers-integral8184892
Ref: 25448184892
Node: numbers Real float 実数8186222
Ref: reference/datamodel datamodel-float8186362
Ref: 25278186362
Ref: reference/datamodel numbers-real-float8186362
Ref: 25458186362
Node: numbers Complex complex8186963
Ref: reference/datamodel numbers-complex-complex8187071
Ref: 25468187071
Node: シーケンス型 sequence8187451
Ref: reference/datamodel datamodel-sequences8187577
Ref: 25478187577
Ref: reference/datamodel sequences8187577
Ref: 25488187577
Node: 変更不能なシーケンス immutable sequence8189575
Ref: reference/datamodel immutable-sequences8189747
Ref: 25498189747
Node: 変更可能なシーケンス型 mutable sequence8192182
Ref: reference/datamodel mutable-sequences8192354
Ref: 254b8192354
Node: 集合型<2>8193786
Ref: reference/datamodel set-types8193924
Ref: 254c8193924
Node: マッピング型 mapping8195469
Ref: reference/datamodel datamodel-mappings8195615
Ref: 254e8195615
Ref: reference/datamodel mappings8195615
Ref: 254f8195615
Node: 辞書型 dictionary<2>8196321
Ref: reference/datamodel dictionaries8196407
Ref: 25508196407
Node: 呼び出し可能型 callable type8198105
Ref: reference/datamodel callable-types8198257
Ref: 25518198257
Node: ユーザ定義関数 user-defined function8199141
Ref: reference/datamodel user-defined-funcs8199295
Ref: 7a18199295
Ref: reference/datamodel user-defined-functions8199295
Ref: 25528199295
Node: Special read-only attributes8199742
Ref: reference/datamodel special-read-only-attributes8199886
Ref: 25538199886
Ref: reference/datamodel function __builtins__8200286
Ref: 25548200286
Ref: reference/datamodel function __globals__8200732
Ref: 168d8200732
Ref: reference/datamodel function __closure__8201237
Ref: 168a8201237
Node: Special writable attributes8202057
Ref: reference/datamodel special-writable-attributes8202201
Ref: 25578202201
Ref: reference/datamodel function __doc__8202658
Ref: 15978202658
Ref: reference/datamodel function __name__8203021
Ref: 168e8203021
Ref: reference/datamodel function __qualname__8203315
Ref: 25588203315
Ref: reference/datamodel function __module__8203762
Ref: 25598203762
Ref: reference/datamodel function __defaults__8204120
Ref: 168b8204120
Ref: reference/datamodel function __code__8204614
Ref: 7a28204614
Ref: reference/datamodel function __dict__8204908
Ref: 168c8204908
Ref: reference/datamodel function __annotations__8205294
Ref: 15968205294
Ref: reference/datamodel function __annotate__8206178
Ref: 255b8206178
Ref: reference/datamodel function __kwdefaults__8206735
Ref: 13d48206735
Ref: reference/datamodel function __type_params__8207047
Ref: 255c8207047
Ref: Special writable attributes-Footnote-18208076
Node: インスタンスメソッド8208118
Ref: reference/datamodel id28208324
Ref: 255e8208324
Ref: reference/datamodel instance-methods8208324
Ref: 22b58208324
Ref: reference/datamodel method __self__8208658
Ref: 17818208658
Ref: reference/datamodel method __func__8208961
Ref: 16b68208961
Ref: reference/datamodel method __doc__8209181
Ref: 25608209181
Ref: reference/datamodel method __name__8209673
Ref: 25618209673
Ref: reference/datamodel method __module__8209971
Ref: 25628209971
Ref: reference/datamodel method-binding8210540
Ref: 255f8210540
Node: ジェネレータ関数 generator function8212008
Ref: reference/datamodel generator-functions8212211
Ref: 25638212211
Node: コルーチン関数 coroutine function8213016
Ref: reference/datamodel coroutine-functions8213254
Ref: 25648213254
Node: 非同期ジェネレータ関数 asynchronous generator function8213830
Ref: reference/datamodel asynchronous-generator-functions8214061
Ref: 25668214061
Node: 組み込み関数 built-in function8215158
Ref: reference/datamodel built-in-functions8215389
Ref: 25678215389
Ref: reference/datamodel builtin-functions8215389
Ref: 255d8215389
Node: 組み込みメソッド built-in method8216209
Ref: reference/datamodel built-in-methods8216387
Ref: 25688216387
Ref: reference/datamodel builtin-methods8216387
Ref: 25698216387
Node: クラス<2>8216920
Ref: reference/datamodel classes8217092
Ref: 256a8217092
Ref: reference/datamodel id38217092
Ref: 256b8217092
Node: クラスのインスタンス8217446
Ref: reference/datamodel class-instances8217569
Ref: 256c8217569
Node: モジュール<3>8217796
Ref: reference/datamodel module-objects8217946
Ref: 256d8217946
Ref: reference/datamodel modules8217946
Ref: 256e8217946
Node: Import-related attributes on module objects8219020
Ref: reference/datamodel import-mod-attrs8219170
Ref: 25708219170
Ref: reference/datamodel import-related-attributes-on-module-objects8219170
Ref: 25718219170
Ref: reference/datamodel module __name__8220807
Ref: 17448220807
Ref: reference/datamodel module __spec__8221146
Ref: 25738221146
Ref: reference/datamodel module __package__8221403
Ref: 5938221403
Ref: reference/datamodel module __loader__8223511
Ref: 30b8223511
Ref: reference/datamodel module __path__8224743
Ref: 22618224743
Ref: reference/datamodel module __file__8225198
Ref: 25788225198
Ref: Import-related attributes on module objects-Footnote-18226337
Node: Other writable attributes on module objects8226379
Ref: reference/datamodel other-writable-attributes-on-module-objects8226557
Ref: 25798226557
Ref: reference/datamodel module __doc__8226780
Ref: 1e068226780
Ref: reference/datamodel module __annotations__8226929
Ref: 257a8226929
Ref: reference/datamodel module __annotate__8227278
Ref: 257b8227278
Ref: reference/datamodel module __lazy_modules__8227507
Ref: 18a8227507
Ref: Other writable attributes on module objects-Footnote-18228193
Node: Module dictionaries8228235
Ref: reference/datamodel module-dictionaries8228361
Ref: 257e8228361
Ref: reference/datamodel module __dict__8228489
Ref: 257f8228489
Node: カスタムクラス型8229150
Ref: reference/datamodel class-attrs-and-methods8229307
Ref: 25808229307
Ref: reference/datamodel custom-classes8229307
Ref: 25818229307
Node: Special attributes8231038
Ref: reference/datamodel special-attributes8231141
Ref: 25828231141
Ref: reference/datamodel type __name__8231513
Ref: 18638231513
Ref: reference/datamodel type __qualname__8231804
Ref: 25838231804
Ref: reference/datamodel type __module__8232115
Ref: 8118232115
Ref: reference/datamodel type __dict__8232344
Ref: 101f8232344
Ref: reference/datamodel type __bases__8232749
Ref: 18648232749
Ref: reference/datamodel type __base__8233255
Ref: 25848233255
Ref: reference/datamodel type __doc__8233787
Ref: 22a28233787
Ref: reference/datamodel type __annotations__8234112
Ref: 1a848234112
Ref: reference/datamodel type __annotate__8236585
Ref: 1aae8236585
Ref: reference/datamodel type __type_params__8237142
Ref: 25868237142
Ref: reference/datamodel type __static_attributes__8237657
Ref: 68f8237657
Ref: reference/datamodel type __firstlineno__8238201
Ref: 6908238201
Ref: reference/datamodel type __mro__8238856
Ref: 25888238856
Ref: Special attributes-Footnote-18239199
Ref: Special attributes-Footnote-28239260
Node: Special methods8239302
Ref: reference/datamodel special-methods8239405
Ref: 25898239405
Ref: reference/datamodel type mro8239578
Ref: 258a8239578
Ref: reference/datamodel type __subclasses__8239817
Ref: 97d8239817
Node: クラスインスタンス class instance8240173
Ref: reference/datamodel id48240374
Ref: 258b8240374
Node: Special attributes<2>8242140
Ref: reference/datamodel id58242240
Ref: 258e8242240
Ref: reference/datamodel object __class__8242297
Ref: 18658242297
Ref: reference/datamodel object __dict__8242400
Ref: 1ca8242400
Node: I/O オブジェクト ファイルオブジェクトの別名8242650
Ref: reference/datamodel i-o-objects-also-known-as-file-objects8242850
Ref: 258f8242850
Ref: reference/datamodel file read8244006
Ref: 25928244006
Ref: reference/datamodel file write8244179
Ref: 25938244179
Ref: reference/datamodel file close8244251
Ref: 25948244251
Node: 内部型 internal type8244339
Ref: reference/datamodel internal-types8244488
Ref: 25958244488
Node: コードオブジェクト8245322
Ref: reference/datamodel code-objects8245455
Ref: 6f18245455
Ref: reference/datamodel id68245455
Ref: 25968245455
Node: Special read-only attributes<2>8246527
Ref: reference/datamodel id78246654
Ref: 25978246654
Ref: reference/datamodel codeobject co_name8246764
Ref: 25988246764
Ref: reference/datamodel codeobject co_qualname8246956
Ref: 25998246956
Ref: reference/datamodel codeobject co_argcount8247294
Ref: 259a8247294
Ref: reference/datamodel codeobject co_posonlyargcount8247787
Ref: 259b8247787
Ref: reference/datamodel codeobject co_kwonlyargcount8248184
Ref: 259c8248184
Ref: reference/datamodel codeobject co_nlocals8248572
Ref: 259d8248572
Ref: reference/datamodel codeobject co_varnames8248885
Ref: 259e8248885
Ref: reference/datamodel codeobject co_cellvars8249281
Ref: 259f8249281
Ref: reference/datamodel codeobject co_freevars8249773
Ref: 25568249773
Ref: reference/datamodel codeobject co_code8250524
Ref: 25a18250524
Ref: reference/datamodel codeobject co_consts8250839
Ref: 1ade8250839
Ref: reference/datamodel codeobject co_names8251156
Ref: 25a28251156
Ref: reference/datamodel codeobject co_filename8251474
Ref: 17278251474
Ref: reference/datamodel codeobject co_firstlineno8251756
Ref: 25a38251756
Ref: reference/datamodel codeobject co_stacksize8251974
Ref: 25a48251974
Ref: reference/datamodel codeobject co_flags8252183
Ref: 1b1b8252183
Node: Methods on code objects8253364
Ref: reference/datamodel methods-on-code-objects8253491
Ref: 25a88253491
Ref: reference/datamodel codeobject co_positions8253558
Ref: 9b78253558
Ref: reference/datamodel codeobject co_lines8255113
Ref: 3358255113
Ref: reference/datamodel codeobject replace8256744
Ref: 25a98256744
Ref: Methods on code objects-Footnote-18257037
Node: フレーム frame オブジェクト8257079
Ref: reference/datamodel frame-objects8257271
Ref: ad28257271
Ref: reference/datamodel id88257271
Ref: 25aa8257271
Node: Special read-only attributes<3>8257666
Ref: reference/datamodel id98257810
Ref: 25ab8257810
Ref: reference/datamodel frame f_back8257914
Ref: b708257914
Ref: reference/datamodel frame f_code8258244
Ref: 25ac8258244
Ref: reference/datamodel frame f_locals8258773
Ref: 2988258773
Ref: reference/datamodel frame f_globals8259515
Ref: 25ad8259515
Ref: reference/datamodel frame f_builtins8259815
Ref: 25ae8259815
Ref: reference/datamodel frame f_lasti8260121
Ref: c628260121
Ref: reference/datamodel frame f_generator8260538
Ref: 25af8260538
Node: Special writable attributes<2>8260995
Ref: reference/datamodel id108261168
Ref: 25b08261168
Ref: reference/datamodel frame f_trace8261271
Ref: 25b18261271
Ref: reference/datamodel frame f_trace_lines8261817
Ref: f9f8261817
Ref: reference/datamodel frame f_trace_opcodes8262144
Ref: fa08262144
Ref: reference/datamodel frame f_lineno8262750
Ref: b918262750
Node: Frame object methods8263294
Ref: reference/datamodel frame-object-methods8263427
Ref: 25b28263427
Ref: reference/datamodel frame clear8263566
Ref: 78a8263566
Node: トレースバック traceback オブジェクト8264261
Ref: reference/datamodel id118264463
Ref: 25b38264463
Ref: reference/datamodel traceback-objects8264463
Ref: ebe8264463
Ref: reference/datamodel traceback tb_frame8265844
Ref: 25b48265844
Ref: reference/datamodel traceback tb_lineno8266490
Ref: 25b58266490
Ref: reference/datamodel traceback tb_lasti8266710
Ref: 25b68266710
Ref: reference/datamodel traceback tb_next8267074
Ref: ebd8267074
Node: スライス slice オブジェクト8267365
Ref: reference/datamodel slice-objects8267581
Ref: 25b78267581
Ref: reference/datamodel slice indices8268479
Ref: 13d38268479
Node: 静的メソッド static method オブジェクト8269120
Ref: reference/datamodel static-method-objects8269325
Ref: 25bc8269325
Node: クラスメソッドオブジェクト8270293
Ref: reference/datamodel class-method-objects8270452
Ref: 25bd8270452
Node: 特殊メソッド名8270920
Ref: reference/datamodel special-method-names8271047
Ref: 25be8271047
Ref: reference/datamodel specialnames8271047
Ref: 10308271047
Ref: 特殊メソッド名-Footnote-18273492
Node: 基本的なカスタマイズ8273832
Ref: reference/datamodel basic-customization8273977
Ref: 25c08273977
Ref: reference/datamodel customization8273977
Ref: 25c18273977
Ref: reference/datamodel object __new__8274046
Ref: 9878274046
Ref: reference/datamodel object __init__8276125
Ref: 3068276125
Ref: reference/datamodel object __del__8277239
Ref: 13ab8277239
Ref: reference/datamodel object __repr__8281230
Ref: 1c78281230
Ref: reference/datamodel object __str__8282324
Ref: a148282324
Ref: reference/datamodel object __bytes__8283088
Ref: 9e48283088
Ref: reference/datamodel object __format__8283350
Ref: a158283350
Ref: reference/datamodel richcmpfuncs8284851
Ref: 25c28284851
Ref: reference/datamodel object __lt__8284851
Ref: 165a8284851
Ref: reference/datamodel object __le__8284897
Ref: 16c48284897
Ref: reference/datamodel object __eq__8284943
Ref: ec48284943
Ref: reference/datamodel object __ne__8284989
Ref: 18cf8284989
Ref: reference/datamodel object __gt__8285035
Ref: 16c58285035
Ref: reference/datamodel object __ge__8285081
Ref: 16c68285081
Ref: reference/datamodel object __hash__8288355
Ref: ec58288355
Ref: reference/datamodel object __bool__8293645
Ref: 168f8293645
Node: 属性値アクセスをカスタマイズする8294151
Ref: reference/datamodel attribute-access8294347
Ref: 25c38294347
Ref: reference/datamodel customizing-attribute-access8294347
Ref: 25c48294347
Ref: reference/datamodel object __getattr__8294681
Ref: 8e88294681
Ref: reference/datamodel object __getattribute__8295965
Ref: f948295965
Ref: reference/datamodel object __setattr__8297342
Ref: 258c8297342
Ref: reference/datamodel object __delattr__8298199
Ref: 258d8298199
Ref: reference/datamodel object __dir__8298732
Ref: 19568298732
Node: モジュールの属性値アクセスをカスタマイズする8299175
Ref: reference/datamodel customizing-module-attribute-access8299374
Ref: 25c68299374
Ref: reference/datamodel module __getattr__8299503
Ref: eaa8299503
Ref: reference/datamodel module __dir__8299543
Ref: eab8299543
Ref: reference/datamodel module __class__8300513
Ref: 25c78300513
Ref: モジュールの属性値アクセスをカスタマイズする-Footnote-18302014
Node: デスクリプタ descriptor の実装8302056
Ref: reference/datamodel descriptors8302297
Ref: 10118302297
Ref: reference/datamodel implementing-descriptors8302297
Ref: 25c88302297
Ref: reference/datamodel object __get__8302874
Ref: 18a08302874
Ref: reference/datamodel object __set__8303993
Ref: 25c98303993
Ref: reference/datamodel object __delete__8304462
Ref: 1b838304462
Ref: reference/datamodel object __objclass__8304722
Ref: 25cb8304722
Ref: デスクリプタ descriptor の実装-Footnote-18305289
Node: デスクリプタの呼び出し8305331
Ref: reference/datamodel descriptor-invocation8305518
Ref: 25ca8305518
Ref: reference/datamodel invoking-descriptors8305518
Ref: 25cc8305518
Node: __slots__<2>8309752
Ref: reference/datamodel id138309891
Ref: 25cd8309891
Ref: reference/datamodel slots8309891
Ref: 1d88309891
Ref: reference/datamodel object __slots__8310391
Ref: 18a38310391
Ref: reference/datamodel datamodel-note-slots8310828
Ref: 25ce8310828
Node: クラス生成をカスタマイズする8314753
Ref: reference/datamodel class-customization8314988
Ref: 100d8314988
Ref: reference/datamodel customizing-class-creation8314988
Ref: 25d08314988
Ref: reference/datamodel object __init_subclass__8315654
Ref: a278315654
Ref: reference/datamodel object __set_name__8317337
Ref: 10108317337
Node: メタクラス8318407
Ref: reference/datamodel id148318535
Ref: 25d18318535
Ref: reference/datamodel metaclasses8318535
Ref: 25d28318535
Node: MRO エントリの解決8319774
Ref: reference/datamodel resolving-mro-entries8319944
Ref: 25d38319944
Ref: reference/datamodel object __mro_entries__8320006
Ref: eb58320006
Ref: MRO エントリの解決-Footnote-18321015
Node: 適切なメタクラスの決定8321057
Ref: reference/datamodel determining-the-appropriate-metaclass8321245
Ref: 25d48321245
Ref: reference/datamodel metaclass-determination8321245
Ref: 25d58321245
Node: クラスの名前空間の準備8322444
Ref: reference/datamodel prepare8322631
Ref: 10208322631
Ref: reference/datamodel preparing-the-class-namespace8322631
Ref: 25d68322631
Ref: クラスの名前空間の準備-Footnote-18323674
Node: クラス本体の実行8323716
Ref: reference/datamodel executing-the-class-body8323906
Ref: 25d78323906
Node: クラスオブジェクトの作成8324876
Ref: reference/datamodel class-object-creation8325057
Ref: 100c8325057
Ref: reference/datamodel creating-the-class-object8325057
Ref: 25d88325057
Ref: クラスオブジェクトの作成-Footnote-18328212
Node: メタクラスの用途8328254
Ref: reference/datamodel uses-for-metaclasses8328402
Ref: 25d98328402
Node: インスタンスのカスタマイズとサブクラスチェック8328844
Ref: reference/datamodel customizing-instance-and-subclass-checks8329079
Ref: 25da8329079
Ref: reference/datamodel type __instancecheck__8329688
Ref: 25db8329688
Ref: reference/datamodel type __subclasscheck__8330000
Ref: 25dc8330000
Ref: インスタンスのカスタマイズとサブクラスチェック-Footnote-18331128
Node: ジェネリック型をエミュレートする8331170
Ref: reference/datamodel emulating-generic-types8331426
Ref: 25dd8331426
Ref: reference/datamodel object __class_getitem__8332435
Ref: b268332435
Ref: ジェネリック型をエミュレートする-Footnote-18332956
Node: The purpose of __class_getitem__8332998
Ref: reference/datamodel the-purpose-of-class-getitem8333160
Ref: 25df8333160
Node: __class_getitem__ versus __getitem__8334051
Ref: reference/datamodel class-getitem-versus-getitem8334213
Ref: 25e18334213
Ref: reference/datamodel classgetitem-versus-getitem8334213
Ref: 25e28334213
Ref: __class_getitem__ versus __getitem__-Footnote-18337571
Node: 呼び出し可能オブジェクトをエミュレートする8337613
Ref: reference/datamodel emulating-callable-objects8337839
Ref: 25e58337839
Ref: reference/datamodel id158337839
Ref: 25e68337839
Ref: reference/datamodel object __call__8337965
Ref: 9668337965
Node: コンテナをエミュレートする8338270
Ref: reference/datamodel emulating-container-types8338484
Ref: 25e78338484
Ref: reference/datamodel sequence-types8338484
Ref: 25e88338484
Ref: reference/datamodel object __len__8340935
Ref: 19aa8340935
Ref: reference/datamodel object __length_hint__8341668
Ref: 12c08341668
Ref: reference/datamodel object __getitem__8342206
Ref: 78d8342206
Ref: reference/datamodel object __setitem__8344189
Ref: 16858344189
Ref: reference/datamodel object __delitem__8344844
Ref: 16868344844
Ref: reference/datamodel object __missing__8345384
Ref: 157b8345384
Ref: reference/datamodel object __iter__8345658
Ref: 10318345658
Ref: reference/datamodel object __reversed__8346156
Ref: 104d8346156
Ref: reference/datamodel object __contains__8347339
Ref: 17728347339
Node: 数値型をエミュレートする8348140
Ref: reference/datamodel emulating-numeric-types8348334
Ref: 25fb8348334
Ref: reference/datamodel numeric-types8348334
Ref: 25fc8348334
Ref: reference/datamodel object __add__8348772
Ref: 25f18348772
Ref: reference/datamodel object __sub__8348819
Ref: 25fd8348819
Ref: reference/datamodel object __mul__8348866
Ref: 25f48348866
Ref: reference/datamodel object __matmul__8348913
Ref: 11368348913
Ref: reference/datamodel object __truediv__8348963
Ref: 12448348963
Ref: reference/datamodel object __floordiv__8349014
Ref: 18ac8349014
Ref: reference/datamodel object __mod__8349066
Ref: 25fe8349066
Ref: reference/datamodel object __divmod__8349113
Ref: 12458349113
Ref: reference/datamodel object __pow__8349163
Ref: bb58349163
Ref: reference/datamodel object __lshift__8349220
Ref: 25ff8349220
Ref: reference/datamodel object __rshift__8349270
Ref: 26008349270
Ref: reference/datamodel object __and__8349320
Ref: 26018349320
Ref: reference/datamodel object __xor__8349367
Ref: 26028349367
Ref: reference/datamodel object __or__8349414
Ref: 26038349414
Ref: reference/datamodel object __radd__8350380
Ref: 25f28350380
Ref: reference/datamodel object __rsub__8350428
Ref: 26048350428
Ref: reference/datamodel object __rmul__8350476
Ref: 25f58350476
Ref: reference/datamodel object __rmatmul__8350524
Ref: 11378350524
Ref: reference/datamodel object __rtruediv__8350575
Ref: 26058350575
Ref: reference/datamodel object __rfloordiv__8350627
Ref: 26068350627
Ref: reference/datamodel object __rmod__8350680
Ref: 11928350680
Ref: reference/datamodel object __rdivmod__8350728
Ref: 26078350728
Ref: reference/datamodel object __rpow__8350779
Ref: 4498350779
Ref: reference/datamodel object __rlshift__8350837
Ref: 26088350837
Ref: reference/datamodel object __rrshift__8350888
Ref: 26098350888
Ref: reference/datamodel object __rand__8350939
Ref: 260a8350939
Ref: reference/datamodel object __rxor__8350987
Ref: 260b8350987
Ref: reference/datamodel object __ror__8351035
Ref: 260c8351035
Ref: reference/datamodel object __iadd__8352834
Ref: 25f38352834
Ref: reference/datamodel object __isub__8352882
Ref: 260d8352882
Ref: reference/datamodel object __imul__8352930
Ref: 25f68352930
Ref: reference/datamodel object __imatmul__8352978
Ref: 11388352978
Ref: reference/datamodel object __itruediv__8353029
Ref: 260e8353029
Ref: reference/datamodel object __ifloordiv__8353081
Ref: 260f8353081
Ref: reference/datamodel object __imod__8353134
Ref: 26108353134
Ref: reference/datamodel object __ipow__8353182
Ref: bb48353182
Ref: reference/datamodel object __ilshift__8353240
Ref: 26118353240
Ref: reference/datamodel object __irshift__8353291
Ref: 26128353291
Ref: reference/datamodel object __iand__8353342
Ref: 26138353342
Ref: reference/datamodel object __ixor__8353390
Ref: 26148353390
Ref: reference/datamodel object __ior__8353438
Ref: 26158353438
Ref: reference/datamodel object __neg__8354648
Ref: 26178354648
Ref: reference/datamodel object __pos__8354688
Ref: 26188354688
Ref: reference/datamodel object __abs__8354728
Ref: 26198354728
Ref: reference/datamodel object __invert__8354768
Ref: 261a8354768
Ref: reference/datamodel object __complex__8354937
Ref: 9e38354937
Ref: reference/datamodel object __int__8354981
Ref: 4438354981
Ref: reference/datamodel object __float__8355021
Ref: d968355021
Ref: reference/datamodel object __index__8355261
Ref: 4448355261
Ref: reference/datamodel object __round__8356118
Ref: 261b8356118
Ref: reference/datamodel object __trunc__8356171
Ref: 4428356171
Ref: reference/datamodel object __floor__8356213
Ref: 261c8356213
Ref: reference/datamodel object __ceil__8356255
Ref: 261d8356255
Ref: 数値型をエミュレートする-Footnote-18356893
Ref: 数値型をエミュレートする-Footnote-28357207
Ref: 数値型をエミュレートする-Footnote-38357418
Node: with文とコンテキストマネージャ8357594
Ref: reference/datamodel context-managers8357815
Ref: 25918357815
Ref: reference/datamodel with-statement-context-managers8357815
Ref: 261f8357815
Ref: reference/datamodel object __enter__8358889
Ref: 9cb8358889
Ref: reference/datamodel object __exit__8359149
Ref: 16ba8359149
Ref: with文とコンテキストマネージャ-Footnote-18360246
Node: クラスパターンマッチの位置引数のカスタマイズ8360288
Ref: reference/datamodel class-pattern-matching8360495
Ref: 26218360495
Ref: reference/datamodel customizing-positional-arguments-in-class-pattern-matching8360495
Ref: 26228360495
Ref: reference/datamodel object __match_args__8360978
Ref: 1e8b8360978
Ref: クラスパターンマッチの位置引数のカスタマイズ-Footnote-18362053
Node: Emulating buffer types8362095
Ref: reference/datamodel emulating-buffer-types8362270
Ref: 26238362270
Ref: reference/datamodel python-buffer-protocol8362270
Ref: 26248362270
Ref: reference/datamodel object __buffer__8362727
Ref: 87e8362727
Ref: reference/datamodel object __release_buffer__8363643
Ref: 1c8a8363643
Ref: Emulating buffer types-Footnote-18364629
Node: Annotations8364671
Ref: reference/datamodel annotations8364804
Ref: 26268364804
Ref: reference/datamodel object __annotations__8365006
Ref: 6728365006
Ref: reference/datamodel object __annotate__8365425
Ref: 1bb48365425
Ref: Annotations-Footnote-18366771
Node: 特殊メソッド検索8366813
Ref: reference/datamodel special-lookup8366915
Ref: 25c58366915
Ref: reference/datamodel special-method-lookup8366915
Ref: 26278366915
Node: コルーチン8369959
Ref: reference/datamodel coroutines8370059
Ref: 26288370059
Node: 待機可能オブジェクト Awaitable Object8370499
Ref: reference/datamodel awaitable-objects8370640
Ref: 26298370640
Ref: reference/datamodel object __await__8371265
Ref: 11328371265
Ref: 待機可能オブジェクト Awaitable Object-Footnote-18372170
Node: コルーチンオブジェクト8372212
Ref: reference/datamodel coroutine-objects8372408
Ref: 25658372408
Ref: reference/datamodel id198372408
Ref: 262a8372408
Ref: reference/datamodel coroutine send8373595
Ref: 262d8373595
Ref: reference/datamodel coroutine throw8374130
Ref: 9098374130
Ref: reference/datamodel coroutine close8375052
Ref: 262e8375052
Node: 非同期イテレータ Asynchronous Iterator8375825
Ref: reference/datamodel async-iterators8376045
Ref: 11348376045
Ref: reference/datamodel asynchronous-iterators8376045
Ref: 262f8376045
Ref: reference/datamodel object __aiter__8376410
Ref: fbf8376410
Ref: reference/datamodel object __anext__8376544
Ref: 1ac68376544
Node: 非同期コンテキストマネージャ Asynchronous Context Manager8377578
Ref: reference/datamodel async-context-managers8377756
Ref: 9f88377756
Ref: reference/datamodel asynchronous-context-managers8377756
Ref: 26308377756
Ref: reference/datamodel object __aenter__8378274
Ref: 26318378274
Ref: reference/datamodel object __aexit__8378439
Ref: 1bcc8378439
Node: 実行モデル8378942
Ref: reference/executionmodel doc8379088
Ref: 26328379088
Ref: reference/executionmodel execmodel8379088
Ref: 26338379088
Ref: reference/executionmodel execution-model8379088
Ref: 26348379088
Ref: reference/executionmodel translation-repo8379088
Ref: 26358379088
Node: プログラムの構造8379295
Ref: reference/executionmodel prog-structure8379420
Ref: 26368379420
Ref: reference/executionmodel structure-of-a-program8379420
Ref: 26378379420
Node: 名前づけと束縛 naming and binding8380941
Ref: reference/executionmodel naming8381084
Ref: 25558381084
Ref: reference/executionmodel naming-and-binding8381084
Ref: 26388381084
Node: 名前の束縛8381344
Ref: reference/executionmodel bind-names8381457
Ref: 26398381457
Ref: reference/executionmodel binding-of-names8381457
Ref: 263a8381457
Node: 名前解決8383421
Ref: reference/executionmodel resolution-of-names8383560
Ref: 263d8383560
Ref: reference/executionmodel resolve-names8383560
Ref: 263e8383560
Node: Annotation scopes8388077
Ref: reference/executionmodel annotation-scopes8388216
Ref: 6ba8388216
Ref: reference/executionmodel id18388216
Ref: 26408388216
Ref: Annotation scopes-Footnote-18390950
Ref: Annotation scopes-Footnote-28390992
Ref: Annotation scopes-Footnote-38391034
Ref: Annotation scopes-Footnote-48391076
Node: Lazy evaluation8391118
Ref: reference/executionmodel id28391281
Ref: 26428391281
Ref: reference/executionmodel lazy-evaluation8391281
Ref: 8778391281
Node: 組み込みと制限付きの実行8393029
Ref: reference/executionmodel builtins-and-restricted-execution8393208
Ref: 26438393208
Ref: reference/executionmodel restrict-exec8393208
Ref: 26448393208
Node: 動的な機能とのやりとり8394292
Ref: reference/executionmodel dynamic-features8394447
Ref: 26458394447
Ref: reference/executionmodel interaction-with-dynamic-features8394447
Ref: 26468394447
Ref: 動的な機能とのやりとり-Footnote-18395373
Node: 例外<2>8395554
Ref: reference/executionmodel exceptions8395691
Ref: 26478395691
Ref: reference/executionmodel id48395691
Ref: 26488395691
Node: Runtime Components8398665
Ref: reference/executionmodel execcomponents8398753
Ref: 26498398753
Ref: reference/executionmodel runtime-components8398753
Ref: 264a8398753
Node: General Computing Model8398867
Ref: reference/executionmodel general-computing-model8398974
Ref: 264b8398974
Node: Python Runtime Model8401883
Ref: reference/executionmodel python-runtime-model8401990
Ref: 264c8401990
Ref: Python Runtime Model-Footnote-18407377
Node: インポートシステム8407436
Ref: reference/import doc8407578
Ref: 264d8407578
Ref: reference/import importsystem8407578
Ref: 256f8407578
Ref: reference/import the-import-system8407578
Ref: 264e8407578
Ref: reference/import translation-repo8407578
Ref: 264f8407578
Ref: インポートシステム-Footnote-18410912
Ref: インポートシステム-Footnote-28410981
Ref: インポートシステム-Footnote-38411023
Node: importlib<10>8411065
Ref: reference/import importlib8411169
Ref: 26518411169
Node: パッケージ<2>8411653
Ref: reference/import packages8411772
Ref: 26528411772
Node: 通常のパッケージ8413830
Ref: reference/import regular-packages8413945
Ref: 26538413945
Node: 名前空間パッケージ8415537
Ref: reference/import namespace-packages8415652
Ref: 26558415652
Ref: reference/import reference-namespace-package8415652
Ref: 26568415652
Ref: 名前空間パッケージ-Footnote-18417589
Node: 検索8417631
Ref: reference/import searching8417746
Ref: 26588417746
Node: モジュールキャッシュ8418827
Ref: reference/import the-module-cache8418942
Ref: 26598418942
Node: ファインダーとローダー8421212
Ref: reference/import finders-and-loaders8421360
Ref: 265a8421360
Ref: reference/import id28421360
Ref: 265b8421360
Node: インポートフック8424255
Ref: reference/import import-hooks8424385
Ref: 26608424385
Node: メタパス8425631
Ref: reference/import the-meta-path8425719
Ref: 26618425719
Node: ロード8429614
Ref: reference/import loading8429747
Ref: 26638429747
Ref: ロード-Footnote-18433334
Node: ローダー8433848
Ref: reference/import loaders8433936
Ref: 26648433936
Node: サブモジュール8438550
Ref: reference/import submodules8438659
Ref: 26658438659
Node: Module specs8440334
Ref: reference/import id48440461
Ref: 26668440461
Ref: reference/import module-specs8440461
Ref: 25758440461
Node: __path__ attributes on modules8441796
Ref: reference/import package-path-rules8441925
Ref: 25768441925
Ref: reference/import path-attributes-on-modules8441925
Ref: 26698441925
Ref: __path__ attributes on modules-Footnote-18443246
Ref: __path__ attributes on modules-Footnote-28443288
Node: モジュールの repr8443330
Ref: reference/import module-reprs8443501
Ref: 266a8443501
Node: キャッシュされたバイトコードの無効化8445422
Ref: reference/import cached-bytecode-invalidation8445554
Ref: 266b8445554
Ref: reference/import pyc-invalidation8445554
Ref: 9e88445554
Node: パスベース・ファインダー8446934
Ref: reference/import the-path-based-finder8447115
Ref: 266c8447115
Node: パスエントリ・ファインダー8450801
Ref: reference/import path-entry-finders8450979
Ref: 266e8450979
Node: パスエントリ・ファインダー・プロトコル8457051
Ref: reference/import path-entry-finder-protocol8457229
Ref: 26708457229
Node: 標準のインポートシステムを置き換える8460479
Ref: reference/import replacing-the-standard-import-system8460675
Ref: 26718460675
Node: Package Relative Imports8461753
Ref: reference/import package-relative-imports8461949
Ref: 26728461949
Ref: reference/import relativeimports8461949
Ref: 26738461949
Node: __main__ に対する特別な考慮8463152
Ref: reference/import import-dunder-main8463306
Ref: 26748463306
Ref: reference/import special-considerations-for-main8463306
Ref: 26758463306
Node: __main__ __spec__8464129
Ref: reference/import id58464219
Ref: 26768464219
Ref: reference/import main-spec8464219
Ref: 26688464219
Node: 参考資料8466388
Ref: reference/import references8466509
Ref: 26778466509
Ref: 参考資料-Footnote-18468143
Ref: 参考資料-Footnote-28468195
Ref: 参考資料-Footnote-38468237
Ref: 参考資料-Footnote-48468279
Ref: 参考資料-Footnote-58468321
Ref: 参考資料-Footnote-68468363
Ref: 参考資料-Footnote-78468405
Ref: 参考資料-Footnote-88468447
Ref: 参考資料-Footnote-98468489
Ref: 参考資料-Footnote-108468531
Node: 式 expression8468574
Ref: reference/expressions doc8468727
Ref: 26788468727
Ref: reference/expressions expressions8468727
Ref: 25368468727
Ref: reference/expressions id18468727
Ref: 26798468727
Ref: reference/expressions translation-repo8468727
Ref: 267a8468727
Ref: reference/expressions grammar-token-python-grammar-name8469061
Ref: 267b8469061
Node: 算術変換 arithmetic conversion8470337
Ref: reference/expressions arithmetic-conversions8470463
Ref: 267c8470463
Ref: reference/expressions conversions8470463
Ref: 267d8470463
Node: アトム、原子的要素 atom8471044
Ref: reference/expressions atoms8471194
Ref: 267f8471194
Ref: reference/expressions id28471194
Ref: 26808471194
Ref: reference/expressions grammar-token-python-grammar-atom8471507
Ref: 26818471507
Ref: reference/expressions grammar-token-python-grammar-enclosure8471684
Ref: 26838471684
Node: Built-in constants8472320
Ref: reference/expressions atom-singletons8472459
Ref: 268a8472459
Ref: reference/expressions built-in-constants8472459
Ref: 268b8472459
Node: 識別子 identifier、または名前 name8473106
Ref: reference/expressions atom-identifiers8473269
Ref: 24d58473269
Ref: reference/expressions identifiers-names8473269
Ref: 268d8473269
Ref: reference/expressions private-name-mangling8473939
Ref: 22b18473939
Node: Private name mangling8473975
Ref: reference/expressions id38474076
Ref: 268e8474076
Node: リテラル<2>8475855
Ref: reference/expressions atom-literals8476034
Ref: 268f8476034
Ref: reference/expressions literals8476034
Ref: 26908476034
Ref: reference/expressions grammar-token-python-grammar-literal8477182
Ref: 26828477182
Node: Literals and object identity8477379
Ref: reference/expressions literals-and-object-identity8477512
Ref: 26948477512
Node: 文字列リテラルの結合 concatenation8479327
Ref: reference/expressions string-concatenation8479460
Ref: 24ef8479460
Ref: reference/expressions string-literal-concatenation8479460
Ref: 26968479460
Ref: reference/expressions grammar-token-python-grammar-strings8480892
Ref: 26938480892
Node: 丸括弧形式 parenthesized form8480977
Ref: reference/expressions parenthesized8481149
Ref: 26978481149
Ref: reference/expressions parenthesized-forms8481149
Ref: 26988481149
Ref: reference/expressions grammar-token-python-grammar-parenth_form8481325
Ref: 26848481325
Node: リスト、集合、辞書の表示8482484
Ref: reference/expressions comprehensions8482656
Ref: 9d38482656
Ref: reference/expressions displays-for-lists-sets-and-dictionaries8482656
Ref: 269a8482656
Ref: reference/expressions grammar-token-python-grammar-comprehension8483172
Ref: 269b8483172
Ref: reference/expressions grammar-token-python-grammar-comp_for8483247
Ref: 269d8483247
Ref: reference/expressions grammar-token-python-grammar-comp_iter8483359
Ref: 26a08483359
Ref: reference/expressions grammar-token-python-grammar-comp_if8483424
Ref: 26a18483424
Ref: リスト、集合、辞書の表示-Footnote-18486447
Node: リスト表示8486489
Ref: reference/expressions list-displays8486639
Ref: 26a28486639
Ref: reference/expressions lists8486639
Ref: 26a38486639
Ref: reference/expressions grammar-token-python-grammar-list_display8486807
Ref: 26858486807
Node: 集合表示8487393
Ref: reference/expressions set8487519
Ref: 26a58487519
Ref: reference/expressions set-displays8487519
Ref: 26a68487519
Ref: reference/expressions grammar-token-python-grammar-set_display8487687
Ref: 26878487687
Node: 辞書表示8488343
Ref: reference/expressions dict8488478
Ref: 113c8488478
Ref: reference/expressions dictionary-displays8488478
Ref: 26a78488478
Ref: reference/expressions grammar-token-python-grammar-dict_display8488626
Ref: 26868488626
Ref: reference/expressions grammar-token-python-grammar-dict_item_list8488723
Ref: 26a88488723
Ref: reference/expressions grammar-token-python-grammar-dict_comprehension8488807
Ref: 26a98488807
Ref: reference/expressions grammar-token-python-grammar-dict_item8488877
Ref: 26aa8488877
Ref: 辞書表示-Footnote-18491483
Ref: 辞書表示-Footnote-28491525
Node: ジェネレータ式<2>8491567
Ref: reference/expressions generator-expressions8491699
Ref: 26ab8491699
Ref: reference/expressions genexpr8491699
Ref: 26ac8491699
Ref: reference/expressions grammar-token-python-grammar-generator_expression8491885
Ref: 26888491885
Node: Yield 式8494269
Ref: reference/expressions yield-expressions8494380
Ref: 26ad8494380
Ref: reference/expressions yieldexpr8494380
Ref: 26ae8494380
Ref: reference/expressions grammar-token-python-grammar-yield_atom8494418
Ref: 26898494418
Ref: reference/expressions grammar-token-python-grammar-yield_from8494479
Ref: 26af8494479
Ref: reference/expressions grammar-token-python-grammar-yield_expression8494540
Ref: 25128494540
Ref: Yield 式-Footnote-18500202
Ref: Yield 式-Footnote-28500244
Ref: Yield 式-Footnote-38500286
Ref: Yield 式-Footnote-48500328
Ref: Yield 式-Footnote-58500370
Node: ジェネレータ-イテレータメソッド8500412
Ref: reference/expressions generator-iterator-methods8500522
Ref: 26b38500522
Ref: reference/expressions generator-methods8500522
Ref: 262c8500522
Ref: reference/expressions generator __next__8500976
Ref: 22bc8500976
Ref: reference/expressions generator send8501769
Ref: 14188501769
Ref: reference/expressions generator throw8502429
Ref: 90a8502429
Ref: reference/expressions generator close8503788
Ref: 19bf8503788
Node: 使用例8504794
Ref: reference/expressions examples8504981
Ref: 26b48504981
Node: 非同期ジェネレータ関数 asynchronous generator function<2>8506092
Ref: reference/expressions asynchronous-generator-functions8506287
Ref: 26b28506287
Ref: reference/expressions id48506287
Ref: 26b58506287
Ref: 非同期ジェネレータ関数 asynchronous generator function<2>-Footnote-18510285
Node: 非同期ジェネレータイテレータメソッド8510365
Ref: reference/expressions asynchronous-generator-iterator-methods8510542
Ref: 26b78510542
Ref: reference/expressions asynchronous-generator-methods8510542
Ref: 26b88510542
Ref: reference/expressions agen __anext__8510818
Ref: 26b68510818
Ref: reference/expressions agen asend8511774
Ref: caf8511774
Ref: reference/expressions agen athrow8512623
Ref: 90b8512623
Ref: reference/expressions agen aclose8513520
Ref: cae8513520
Node: プライマリ8514519
Ref: reference/expressions id58514644
Ref: 26b98514644
Ref: reference/expressions primaries8514644
Ref: 26ba8514644
Ref: reference/expressions grammar-token-python-grammar-primary8514811
Ref: 26bb8514811
Node: 属性参照8515020
Ref: reference/expressions attribute-references8515119
Ref: 26bf8515119
Ref: reference/expressions id68515119
Ref: 26c08515119
Ref: reference/expressions grammar-token-python-grammar-attributeref8515251
Ref: 26bc8515251
Node: Subscriptions and slicings8516065
Ref: reference/expressions subscriptions8516190
Ref: 25b88516190
Ref: reference/expressions subscriptions-and-slicings8516190
Ref: 26c18516190
Node: スライス表記 slicing8518895
Ref: reference/expressions id78519019
Ref: 26c28519019
Ref: reference/expressions slicings8519019
Ref: 26c38519019
Node: Comma-separated subscripts8520540
Ref: reference/expressions comma-separated-subscripts8520696
Ref: 26c58520696
Node: "Starred" subscriptions8521546
Ref: reference/expressions starred-subscriptions8521703
Ref: 26c68521703
Ref: "Starred" subscriptions-Footnote-18522415
Node: Formal subscription grammar8522457
Ref: reference/expressions formal-subscription-grammar8522579
Ref: 26c78522579
Ref: reference/expressions grammar-token-python-grammar-subscription8522652
Ref: 26bd8522652
Ref: reference/expressions grammar-token-python-grammar-subscript8522727
Ref: 26c88522727
Ref: reference/expressions grammar-token-python-grammar-single_subscript8522811
Ref: 26c98522811
Ref: reference/expressions grammar-token-python-grammar-proper_slice8522897
Ref: 26cb8522897
Ref: reference/expressions grammar-token-python-grammar-tuple_subscript8523007
Ref: 26ca8523007
Node: 呼び出し call8523295
Ref: reference/expressions calls8523399
Ref: 113a8523399
Ref: reference/expressions id88523399
Ref: 26cc8523399
Ref: reference/expressions grammar-token-python-grammar-call8523667
Ref: 26be8523667
Ref: reference/expressions grammar-token-python-grammar-argument_list8523787
Ref: 26ce8523787
Ref: reference/expressions grammar-token-python-grammar-positional_arguments8524117
Ref: 26cf8524117
Ref: reference/expressions grammar-token-python-grammar-positional_item8524209
Ref: 26d28524209
Ref: reference/expressions grammar-token-python-grammar-starred_and_keywords8524300
Ref: 26d08524300
Ref: reference/expressions grammar-token-python-grammar-keywords_arguments8524477
Ref: 26d18524477
Ref: reference/expressions grammar-token-python-grammar-keyword_item8524656
Ref: 26d38524656
Ref: 呼び出し call-Footnote-18532987
Node: Await 式8533029
Ref: reference/expressions await8533152
Ref: 4398533152
Ref: reference/expressions await-expression8533152
Ref: 26d48533152
Ref: reference/expressions grammar-token-python-grammar-await_expr8533355
Ref: 26d58533355
Node: べき乗演算 power operator8533425
Ref: reference/expressions power8533614
Ref: 26d68533614
Ref: reference/expressions the-power-operator8533614
Ref: 26d78533614
Ref: reference/expressions grammar-token-python-grammar-power8533930
Ref: 26d88533930
Node: 単項算術演算とビット単位演算 unary arithmetic and bitwise operation8535337
Ref: reference/expressions unary8535563
Ref: 26918535563
Ref: reference/expressions unary-arithmetic-and-bitwise-operations8535563
Ref: 26da8535563
Ref: reference/expressions grammar-token-python-grammar-u_expr8535829
Ref: 26d98535829
Node: 二項算術演算 binary arithmetic operation8536655
Ref: reference/expressions binary8536885
Ref: 26928536885
Ref: reference/expressions binary-arithmetic-operations8536885
Ref: 26db8536885
Ref: reference/expressions grammar-token-python-grammar-m_expr8537351
Ref: 26dc8537351
Ref: reference/expressions grammar-token-python-grammar-a_expr8537641
Ref: 26dd8537641
Ref: 二項算術演算 binary arithmetic operation-Footnote-18541970
Ref: 二項算術演算 binary arithmetic operation-Footnote-28542784
Node: シフト演算 shifting operation8543129
Ref: reference/expressions shifting8543339
Ref: 26df8543339
Ref: reference/expressions shifting-operations8543339
Ref: 26e08543339
Ref: reference/expressions grammar-token-python-grammar-shift_expr8543505
Ref: 26e18543505
Node: ビット単位演算の二項演算 binary bitwise operation8544276
Ref: reference/expressions binary-bitwise-operations8544446
Ref: 26e28544446
Ref: reference/expressions bitwise8544446
Ref: 26e38544446
Ref: reference/expressions grammar-token-python-grammar-and_expr8544683
Ref: 26e48544683
Ref: reference/expressions grammar-token-python-grammar-xor_expr8544774
Ref: 26e58544774
Ref: reference/expressions grammar-token-python-grammar-or_expr8544861
Ref: 25118544861
Node: 比較8545581
Ref: reference/expressions comparisons8545750
Ref: 26e68545750
Ref: reference/expressions id118545750
Ref: 26e78545750
Ref: reference/expressions grammar-token-python-grammar-comparison8546115
Ref: 26e88546115
Ref: reference/expressions grammar-token-python-grammar-comp_operator8546207
Ref: 26e98546207
Node: 値の比較8547551
Ref: reference/expressions expressions-value-comparisons8547633
Ref: 1e368547633
Ref: reference/expressions value-comparisons8547633
Ref: 26ea8547633
Ref: reference/expressions in8556959
Ref: 32b8556959
Ref: reference/expressions not-in8556959
Ref: a258556959
Ref: 値の比較-Footnote-18556997
Ref: 値の比較-Footnote-28557039
Node: 所属検査演算8558456
Ref: reference/expressions membership-test-details8558565
Ref: 25fa8558565
Ref: reference/expressions membership-test-operations8558565
Ref: 26eb8558565
Ref: reference/expressions is8560740
Ref: 32c8560740
Node: 同一性の比較8560740
Ref: reference/expressions identity-comparisons8560828
Ref: 26ec8560828
Ref: reference/expressions is-not8560828
Ref: 26ed8560828
Ref: reference/expressions booleans8561311
Ref: 26ee8561311
Ref: reference/expressions and8561311
Ref: 3278561311
Ref: reference/expressions or8561311
Ref: 32d8561311
Ref: 同一性の比較-Footnote-18561349
Node: ブール演算 boolean operation8561748
Ref: reference/expressions boolean-operations8561868
Ref: 26ef8561868
Ref: reference/expressions not8561868
Ref: 26f08561868
Ref: reference/expressions grammar-token-python-grammar-or_test8561950
Ref: 269f8561950
Ref: reference/expressions grammar-token-python-grammar-and_test8562037
Ref: 26f18562037
Ref: reference/expressions grammar-token-python-grammar-not_test8562126
Ref: 26f28562126
Node: 代入式<2>8563717
Ref: reference/expressions assignment-expressions8563864
Ref: 26f38563864
Ref: reference/expressions id148563864
Ref: 26f48563864
Ref: reference/expressions grammar-token-python-grammar-assignment_expression8563896
Ref: 26418563896
Ref: 代入式<2>-Footnote-18564975
Node: 条件式 Conditional Expressions8565017
Ref: reference/expressions conditional-expressions8565147
Ref: 26f58565147
Ref: reference/expressions if-expr8565147
Ref: 42d8565147
Ref: reference/expressions grammar-token-python-grammar-conditional_expression8565231
Ref: 25108565231
Ref: reference/expressions grammar-token-python-grammar-expression8565339
Ref: 4318565339
Ref: reference/expressions lambdas8565935
Ref: 26f78565935
Ref: 条件式 Conditional Expressions-Footnote-18565973
Node: ラムダ lambda8566015
Ref: reference/expressions id158566148
Ref: 26f88566148
Ref: reference/expressions lambda8566148
Ref: 16578566148
Ref: reference/expressions grammar-token-python-grammar-lambda_expr8566198
Ref: 26f68566198
Node: 式のリスト8566864
Ref: reference/expressions expression-lists8566976
Ref: 26fa8566976
Ref: reference/expressions exprlists8566976
Ref: 113b8566976
Ref: reference/expressions grammar-token-python-grammar-starred_expression8567018
Ref: 26998567018
Ref: reference/expressions grammar-token-python-grammar-flexible_expression8567099
Ref: 269c8567099
Ref: reference/expressions grammar-token-python-grammar-flexible_expression_list8567199
Ref: 26a48567199
Ref: reference/expressions grammar-token-python-grammar-starred_expression_list8567309
Ref: 26fb8567309
Ref: reference/expressions grammar-token-python-grammar-expression_list8567417
Ref: 26fc8567417
Ref: reference/expressions grammar-token-python-grammar-yield_list8567507
Ref: 26b08567507
Ref: 式のリスト-Footnote-18568833
Ref: 式のリスト-Footnote-28568875
Node: 評価順序8568917
Ref: reference/expressions evalorder8569037
Ref: 26fd8569037
Ref: reference/expressions evaluation-order8569037
Ref: 26fe8569037
Node: 演算子の優先順位8569559
Ref: reference/expressions operator-precedence8569655
Ref: 26ff8569655
Ref: reference/expressions operator-summary8569655
Ref: 27008569655
Ref: 演算子の優先順位-Footnote-18574320
Ref: 演算子の優先順位-Footnote-28574540
Node: 単純文 simple statement8574660
Ref: reference/simple_stmts doc8574814
Ref: 27018574814
Ref: reference/simple_stmts simple8574814
Ref: 27028574814
Ref: reference/simple_stmts simple-statements8574814
Ref: 27038574814
Ref: reference/simple_stmts translation-repo8574814
Ref: 27048574814
Ref: reference/simple_stmts grammar-token-python-grammar-simple_stmt8575102
Ref: 27058575102
Node: 式文 expression statement8576243
Ref: reference/simple_stmts expression-statements8576372
Ref: 27178576372
Ref: reference/simple_stmts exprstmts8576372
Ref: 27188576372
Ref: reference/simple_stmts grammar-token-python-grammar-expression_stmt8576890
Ref: 27068576890
Node: 代入文 assignment statement8577394
Ref: reference/simple_stmts assignment8577542
Ref: 263b8577542
Ref: reference/simple_stmts assignment-statements8577542
Ref: 27198577542
Ref: reference/simple_stmts grammar-token-python-grammar-assignment_stmt8577776
Ref: 27088577776
Ref: reference/simple_stmts grammar-token-python-grammar-target_list8577896
Ref: 269e8577896
Ref: reference/simple_stmts grammar-token-python-grammar-target8577971
Ref: 271a8577971
Ref: reference/simple_stmts attr-target-note8582404
Ref: 271b8582404
Ref: 代入文 assignment statement-Footnote-18586762
Node: 累算代入文 augmented assignment statement8586804
Ref: reference/simple_stmts augassign8586979
Ref: 271c8586979
Ref: reference/simple_stmts augmented-assignment-statements8586979
Ref: 271d8586979
Ref: reference/simple_stmts grammar-token-python-grammar-augmented_assignment_stmt8587191
Ref: 27098587191
Ref: reference/simple_stmts grammar-token-python-grammar-augtarget8587328
Ref: 271e8587328
Ref: reference/simple_stmts grammar-token-python-grammar-augop8587440
Ref: 271f8587440
Node: 注釈付き代入文 annotated assignment statements8589248
Ref: reference/simple_stmts annassign8589423
Ref: 27208589423
Ref: reference/simple_stmts annotated-assignment-statements8589423
Ref: 27218589423
Ref: reference/simple_stmts grammar-token-python-grammar-annotated_assignment_stmt8589703
Ref: 270a8589703
Ref: 注釈付き代入文 annotated assignment statements-Footnote-18592007
Ref: 注釈付き代入文 annotated assignment statements-Footnote-28592049
Node: assert 文8592091
Ref: reference/simple_stmts assert8592223
Ref: d358592223
Ref: reference/simple_stmts the-assert-statement8592223
Ref: 27228592223
Ref: reference/simple_stmts grammar-token-python-grammar-assert_stmt8592406
Ref: 27078592406
Node: pass 文<2>8593550
Ref: reference/simple_stmts pass8593662
Ref: 42e8593662
Ref: reference/simple_stmts the-pass-statement8593662
Ref: 27238593662
Ref: reference/simple_stmts grammar-token-python-grammar-pass_stmt8593700
Ref: 270b8593700
Node: del 文<2>8594137
Ref: reference/simple_stmts del8594249
Ref: 1d3c8594249
Ref: reference/simple_stmts the-del-statement8594249
Ref: 27248594249
Ref: reference/simple_stmts grammar-token-python-grammar-del_stmt8594285
Ref: 270c8594285
Node: return 文8595426
Ref: reference/simple_stmts return8595536
Ref: 4528595536
Ref: reference/simple_stmts the-return-statement8595536
Ref: 27258595536
Ref: reference/simple_stmts grammar-token-python-grammar-return_stmt8595578
Ref: 270d8595578
Node: yield 文8596895
Ref: reference/simple_stmts the-yield-statement8597004
Ref: 27268597004
Ref: reference/simple_stmts yield8597004
Ref: d978597004
Ref: reference/simple_stmts grammar-token-python-grammar-yield_stmt8597044
Ref: 270e8597044
Node: raise 文8597907
Ref: reference/simple_stmts raise8598015
Ref: 9e98598015
Ref: reference/simple_stmts the-raise-statement8598015
Ref: 27278598015
Ref: reference/simple_stmts grammar-token-python-grammar-raise_stmt8598055
Ref: 270f8598055
Node: break 文8602426
Ref: reference/simple_stmts break8602537
Ref: 42f8602537
Ref: reference/simple_stmts the-break-statement8602537
Ref: 272a8602537
Ref: reference/simple_stmts grammar-token-python-grammar-break_stmt8602577
Ref: 27108602577
Node: continue 文8603383
Ref: reference/simple_stmts continue8603495
Ref: 4308603495
Ref: reference/simple_stmts the-continue-statement8603495
Ref: 272b8603495
Ref: reference/simple_stmts grammar-token-python-grammar-continue_stmt8603543
Ref: 27118603543
Ref: reference/simple_stmts import8604099
Ref: 9df8604099
Node: import 文8604101
Ref: reference/simple_stmts from8604214
Ref: 16658604214
Ref: reference/simple_stmts the-import-statement8604214
Ref: 272c8604214
Ref: reference/simple_stmts grammar-token-python-grammar-import_stmt8604258
Ref: 27128604258
Ref: reference/simple_stmts grammar-token-python-grammar-module8604928
Ref: 272d8604928
Ref: reference/simple_stmts grammar-token-python-grammar-relative_module8605005
Ref: 272e8605005
Ref: reference/simple_stmts module __all__8609213
Ref: 10fa8609213
Ref: reference/simple_stmts lazy-imports8611952
Ref: 257c8611952
Ref: import 文-Footnote-18612078
Node: Lazy imports8612135
Ref: reference/simple_stmts id18612230
Ref: 272f8612230
Ref: reference/simple_stmts lazy8612230
Ref: 1828612230
Ref: Lazy imports-Footnote-18614007
Node: Compatibility via __lazy_modules__8614049
Ref: reference/simple_stmts compatibility-via-lazy-modules8614132
Ref: 27308614132
Ref: reference/simple_stmts lazy-modules-compat8614132
Ref: 257d8614132
Node: future 文 future statement8616104
Ref: reference/simple_stmts future8616199
Ref: 6778616199
Ref: reference/simple_stmts future-statements8616199
Ref: 27318616199
Ref: reference/simple_stmts grammar-token-python-grammar-future_stmt8616842
Ref: 27138616842
Ref: reference/simple_stmts grammar-token-python-grammar-feature8617210
Ref: 27328617210
Ref: future 文 future statement-Footnote-18620674
Ref: future 文 future statement-Footnote-28620716
Node: global 文8620758
Ref: reference/simple_stmts global8620871
Ref: 6bb8620871
Ref: reference/simple_stmts the-global-statement8620871
Ref: 27338620871
Ref: reference/simple_stmts grammar-token-python-grammar-global_stmt8620915
Ref: 27148620915
Node: nonlocal 文8622436
Ref: reference/simple_stmts nonlocal8622557
Ref: 16618622557
Ref: reference/simple_stmts the-nonlocal-statement8622557
Ref: 27348622557
Ref: reference/simple_stmts grammar-token-python-grammar-nonlocal_stmt8622605
Ref: 27158622605
Ref: nonlocal 文-Footnote-18623785
Node: The type statement8623827
Ref: reference/simple_stmts the-type-statement8623929
Ref: 27358623929
Ref: reference/simple_stmts type8623929
Ref: 8608623929
Ref: reference/simple_stmts grammar-token-python-grammar-type_stmt8623990
Ref: 27168623990
Ref: The type statement-Footnote-18625308
Node: 複合文 compound statement8625350
Ref: reference/compound_stmts doc8625514
Ref: 27378625514
Ref: reference/compound_stmts compound8625514
Ref: 27388625514
Ref: reference/compound_stmts compound-statements8625514
Ref: 27398625514
Ref: reference/compound_stmts translation-repo8625514
Ref: 273a8625514
Ref: reference/compound_stmts grammar-token-python-grammar-compound_stmt8627690
Ref: 273b8627690
Ref: reference/compound_stmts grammar-token-python-grammar-suite8628193
Ref: 27478628193
Ref: reference/compound_stmts grammar-token-python-grammar-statement8628292
Ref: 27498628292
Ref: reference/compound_stmts grammar-token-python-grammar-stmt_list8628372
Ref: 27488628372
Ref: reference/compound_stmts if8629014
Ref: 32a8629014
Ref: reference/compound_stmts elif8629014
Ref: 42c8629014
Node: if 文<2>8629267
Ref: reference/compound_stmts else8629359
Ref: 3288629359
Ref: reference/compound_stmts the-if-statement8629359
Ref: 274a8629359
Ref: reference/compound_stmts grammar-token-python-grammar-if_stmt8629471
Ref: 273c8629471
Node: while 文8630222
Ref: reference/compound_stmts the-while-statement8630333
Ref: 274b8630333
Ref: reference/compound_stmts while8630333
Ref: 1ba58630333
Ref: reference/compound_stmts grammar-token-python-grammar-while_stmt8630480
Ref: 273d8630480
Node: for 文<2>8631251
Ref: reference/compound_stmts for8631360
Ref: 3298631360
Ref: reference/compound_stmts the-for-statement8631360
Ref: 274c8631360
Ref: reference/compound_stmts grammar-token-python-grammar-for_stmt8631623
Ref: 273e8631623
Node: try 文8633709
Ref: reference/compound_stmts the-try-statement8633817
Ref: 274d8633817
Ref: reference/compound_stmts try8633817
Ref: adb8633817
Ref: reference/compound_stmts grammar-token-python-grammar-try_stmt8633991
Ref: 273f8633991
Ref: reference/compound_stmts grammar-token-python-grammar-try1_stmt8634080
Ref: 274e8634080
Ref: reference/compound_stmts grammar-token-python-grammar-try2_stmt8634331
Ref: 274f8634331
Ref: reference/compound_stmts grammar-token-python-grammar-try3_stmt8634584
Ref: 27508634584
Ref: try 文-Footnote-18635140
Node: except 節8635182
Ref: reference/compound_stmts except8635256
Ref: 44e8635256
Ref: reference/compound_stmts except-clause8635256
Ref: 27518635256
Ref: except 節-Footnote-18639159
Node: except* 節8639374
Ref: reference/compound_stmts except-star8639465
Ref: 44f8639465
Ref: reference/compound_stmts id28639465
Ref: 27528639465
Node: else 節8642468
Ref: reference/compound_stmts else-clause8642560
Ref: 27538642560
Ref: reference/compound_stmts except-else8642560
Ref: 27548642560
Node: finally 節8642999
Ref: reference/compound_stmts finally8643071
Ref: 4538643071
Ref: reference/compound_stmts finally-clause8643071
Ref: 27558643071
Ref: reference/compound_stmts with8645025
Ref: 2158645025
Ref: finally 節-Footnote-18645061
Node: with 文8645103
Ref: reference/compound_stmts as8645213
Ref: 27568645213
Ref: reference/compound_stmts the-with-statement8645213
Ref: 27578645213
Ref: reference/compound_stmts grammar-token-python-grammar-with_stmt8645705
Ref: 27408645705
Ref: reference/compound_stmts grammar-token-python-grammar-with_stmt_contents8645843
Ref: 27588645843
Ref: reference/compound_stmts grammar-token-python-grammar-with_item8645921
Ref: 27598645921
Ref: reference/compound_stmts match8649742
Ref: 1df8649742
Ref: with 文-Footnote-18649778
Node: match 文<2>8649820
Ref: reference/compound_stmts case8649935
Ref: 275a8649935
Ref: reference/compound_stmts the-match-statement8649935
Ref: 275b8649935
Ref: reference/compound_stmts grammar-token-python-grammar-match_stmt8650084
Ref: 27418650084
Ref: reference/compound_stmts grammar-token-python-grammar-subject_expr8650188
Ref: 275c8650188
Ref: reference/compound_stmts grammar-token-python-grammar-case_block8650346
Ref: 275d8650346
Ref: match 文<2>-Footnote-18651506
Ref: match 文<2>-Footnote-28651548
Node: 概要8651590
Ref: reference/compound_stmts overview8651666
Ref: 27608651666
Node: ガード<2>8654947
Ref: reference/compound_stmts guards8655071
Ref: 27628655071
Ref: reference/compound_stmts grammar-token-python-grammar-guard8655105
Ref: 275f8655105
Node: 論駁不可能なケースブロック8656665
Ref: reference/compound_stmts irrefutable-case8656795
Ref: 27638656795
Ref: reference/compound_stmts irrefutable-case-blocks8656795
Ref: 27648656795
Node: パターン8657876
Ref: reference/compound_stmts patterns8657985
Ref: 27688657985
Ref: reference/compound_stmts grammar-token-python-grammar-patterns8658362
Ref: 275e8658362
Ref: reference/compound_stmts grammar-token-python-grammar-pattern8658441
Ref: 276a8658441
Ref: reference/compound_stmts grammar-token-python-grammar-closed_pattern8658512
Ref: 276d8658512
Node: OR パターン8659759
Ref: reference/compound_stmts id38659847
Ref: 27768659847
Ref: reference/compound_stmts or-patterns8659847
Ref: 27668659847
Ref: reference/compound_stmts grammar-token-python-grammar-or_pattern8659998
Ref: 276c8659998
Node: AS パターン8660948
Ref: reference/compound_stmts as-patterns8661069
Ref: 27658661069
Ref: reference/compound_stmts id48661069
Ref: 27778661069
Ref: reference/compound_stmts grammar-token-python-grammar-as_pattern8661272
Ref: 276b8661272
Node: リテラルパターン8661813
Ref: reference/compound_stmts id58661946
Ref: 27788661946
Ref: reference/compound_stmts literal-patterns8661946
Ref: 27798661946
Ref: reference/compound_stmts grammar-token-python-grammar-literal_pattern8662120
Ref: 276e8662120
Ref: reference/compound_stmts grammar-token-python-grammar-signed_number8662432
Ref: 277a8662432
Node: キャプチャパターン8663248
Ref: reference/compound_stmts capture-patterns8663399
Ref: 27678663399
Ref: reference/compound_stmts id68663399
Ref: 277c8663399
Ref: reference/compound_stmts grammar-token-python-grammar-capture_pattern8663557
Ref: 276f8663557
Ref: キャプチャパターン-Footnote-18664559
Node: ワイルドカードパターン8664601
Ref: reference/compound_stmts id78664743
Ref: 277d8664743
Ref: reference/compound_stmts wildcard-patterns8664743
Ref: beb8664743
Ref: reference/compound_stmts grammar-token-python-grammar-wildcard_pattern8664952
Ref: 27708664952
Node: 値パターン8665373
Ref: reference/compound_stmts id88665512
Ref: 277e8665512
Ref: reference/compound_stmts value-patterns8665512
Ref: 277f8665512
Ref: reference/compound_stmts grammar-token-python-grammar-value_pattern8665642
Ref: 27718665642
Ref: reference/compound_stmts grammar-token-python-grammar-attr8665680
Ref: 27808665680
Ref: reference/compound_stmts grammar-token-python-grammar-name_or_attr8665735
Ref: 27818665735
Node: グループパターン8666547
Ref: reference/compound_stmts group-patterns8666680
Ref: 27828666680
Ref: reference/compound_stmts id98666680
Ref: 27838666680
Ref: reference/compound_stmts grammar-token-python-grammar-group_pattern8666892
Ref: 27728666892
Node: シーケンスパターン8667001
Ref: reference/compound_stmts id108667146
Ref: 27848667146
Ref: reference/compound_stmts sequence-patterns8667146
Ref: 27858667146
Ref: reference/compound_stmts grammar-token-python-grammar-sequence_pattern8667362
Ref: 27738667362
Ref: reference/compound_stmts grammar-token-python-grammar-open_sequence_pattern8667513
Ref: 27698667513
Ref: reference/compound_stmts grammar-token-python-grammar-maybe_sequence_pattern8667616
Ref: 27868667616
Ref: reference/compound_stmts grammar-token-python-grammar-maybe_star_pattern8667687
Ref: 27878667687
Ref: reference/compound_stmts grammar-token-python-grammar-star_pattern8667765
Ref: 27888667765
Ref: シーケンスパターン-Footnote-18670814
Node: マッピングパターン8671535
Ref: reference/compound_stmts id128671677
Ref: 27898671677
Ref: reference/compound_stmts mapping-patterns8671677
Ref: 278a8671677
Ref: reference/compound_stmts grammar-token-python-grammar-mapping_pattern8671872
Ref: 27748671872
Ref: reference/compound_stmts grammar-token-python-grammar-items_pattern8671935
Ref: 278b8671935
Ref: reference/compound_stmts grammar-token-python-grammar-key_value_pattern8672002
Ref: 278c8672002
Ref: reference/compound_stmts grammar-token-python-grammar-double_star_pattern8672174
Ref: 278d8672174
Ref: マッピングパターン-Footnote-18673825
Node: クラスパターン8674299
Ref: reference/compound_stmts class-patterns8674405
Ref: 278e8674405
Ref: reference/compound_stmts id148674405
Ref: 278f8674405
Ref: reference/compound_stmts grammar-token-python-grammar-class_pattern8674557
Ref: 27758674557
Ref: reference/compound_stmts grammar-token-python-grammar-pattern_arguments8674655
Ref: 27908674655
Ref: reference/compound_stmts grammar-token-python-grammar-positional_patterns8674808
Ref: 27918674808
Ref: reference/compound_stmts grammar-token-python-grammar-keyword_patterns8674860
Ref: 27928674860
Ref: reference/compound_stmts grammar-token-python-grammar-keyword_pattern8674920
Ref: 27938674920
Ref: reference/compound_stmts function8678990
Ref: 22248678990
Ref: クラスパターン-Footnote-18679026
Ref: クラスパターン-Footnote-28679068
Node: 関数定義8679110
Ref: reference/compound_stmts def8679232
Ref: 18128679232
Ref: reference/compound_stmts function-definitions8679232
Ref: 27948679232
Ref: reference/compound_stmts grammar-token-python-grammar-funcdef8679389
Ref: 27428679389
Ref: reference/compound_stmts grammar-token-python-grammar-decorators8679625
Ref: 27958679625
Ref: reference/compound_stmts grammar-token-python-grammar-decorator8679681
Ref: 27978679681
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list8679760
Ref: 26f98679760
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list_no_posonly8679981
Ref: 27998679981
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list_starargs8680188
Ref: 279a8680188
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_star_kwargs8680513
Ref: 279c8680513
Ref: reference/compound_stmts grammar-token-python-grammar-parameter8680579
Ref: 279d8680579
Ref: reference/compound_stmts grammar-token-python-grammar-star_parameter8680664
Ref: 279b8680664
Ref: reference/compound_stmts grammar-token-python-grammar-defparameter8680755
Ref: 27988680755
Ref: reference/compound_stmts grammar-token-python-grammar-funcname8680839
Ref: 27968680839
Ref: 関数定義-Footnote-18688570
Ref: 関数定義-Footnote-28688767
Ref: 関数定義-Footnote-38688809
Ref: 関数定義-Footnote-48688851
Ref: 関数定義-Footnote-58688893
Ref: 関数定義-Footnote-68688935
Ref: 関数定義-Footnote-78688977
Ref: 関数定義-Footnote-88689019
Ref: 関数定義-Footnote-98689061
Ref: 関数定義-Footnote-108689103
Node: クラス定義8689146
Ref: reference/compound_stmts class8689274
Ref: 16918689274
Ref: reference/compound_stmts class-definitions8689274
Ref: 279f8689274
Ref: reference/compound_stmts grammar-token-python-grammar-classdef8689427
Ref: 27438689427
Ref: reference/compound_stmts grammar-token-python-grammar-inheritance8689579
Ref: 27a18689579
Ref: reference/compound_stmts grammar-token-python-grammar-classname8689634
Ref: 27a08689634
Ref: クラス定義-Footnote-18693747
Ref: クラス定義-Footnote-28693934
Ref: クラス定義-Footnote-38693976
Ref: クラス定義-Footnote-48694018
Ref: クラス定義-Footnote-58694060
Node: Multiple inheritance8694102
Ref: reference/compound_stmts id178694174
Ref: 27a28694174
Ref: reference/compound_stmts multiple-inheritance8694174
Ref: 22af8694174
Node: コルーチン<2>8698927
Ref: reference/compound_stmts async8699063
Ref: b1e8699063
Ref: reference/compound_stmts coroutines8699063
Ref: 27a48699063
Node: コルーチン関数定義8699205
Ref: reference/compound_stmts async-def8699309
Ref: 9d48699309
Ref: reference/compound_stmts coroutine-function-definition8699309
Ref: 27a58699309
Ref: reference/compound_stmts grammar-token-python-grammar-async_funcdef8699373
Ref: 27468699373
Node: async for 文8700395
Ref: reference/compound_stmts async-for8700522
Ref: e748700522
Ref: reference/compound_stmts the-async-for-statement8700522
Ref: 27a68700522
Ref: reference/compound_stmts grammar-token-python-grammar-async_for_stmt8700574
Ref: 27458700574
Node: async with 文8701618
Ref: reference/compound_stmts async-with8701709
Ref: 2168701709
Ref: reference/compound_stmts the-async-with-statement8701709
Ref: 27a78701709
Ref: reference/compound_stmts grammar-token-python-grammar-async_with_stmt8701763
Ref: 27448701763
Ref: async with 文-Footnote-18702981
Node: Type parameter lists8703023
Ref: reference/compound_stmts type-parameter-lists8703158
Ref: 27a88703158
Ref: reference/compound_stmts type-params8703158
Ref: 7ab8703158
Ref: reference/compound_stmts grammar-token-python-grammar-type_params8703327
Ref: 27368703327
Ref: reference/compound_stmts grammar-token-python-grammar-type_param8703409
Ref: 27a98703409
Ref: reference/compound_stmts grammar-token-python-grammar-typevar8703502
Ref: 27aa8703502
Ref: reference/compound_stmts grammar-token-python-grammar-typevartuple8703605
Ref: 27ab8703605
Ref: reference/compound_stmts grammar-token-python-grammar-paramspec8703682
Ref: 27ac8703682
Ref: Type parameter lists-Footnote-18708060
Node: Generic functions8708102
Ref: reference/compound_stmts generic-functions8708200
Ref: 8748708200
Ref: reference/compound_stmts id188708200
Ref: 27ae8708200
Node: Generic classes8710004
Ref: reference/compound_stmts generic-classes8710131
Ref: 25878710131
Ref: reference/compound_stmts id198710131
Ref: 27af8710131
Node: Generic type aliases8711273
Ref: reference/compound_stmts generic-type-aliases8711374
Ref: 8768711374
Ref: reference/compound_stmts id208711374
Ref: 27b08711374
Node: Annotations<2>8712178
Ref: reference/compound_stmts annotations8712286
Ref: 279e8712286
Ref: reference/compound_stmts id218712286
Ref: 27b18712286
Ref: Annotations<2>-Footnote-18714134
Node: トップレベル要素8714176
Ref: reference/toplevel_components doc8714335
Ref: 27b28714335
Ref: reference/toplevel_components top-level8714335
Ref: 27b38714335
Ref: reference/toplevel_components top-level-components8714335
Ref: 27b48714335
Ref: reference/toplevel_components translation-repo8714335
Ref: 27b58714335
Node: 完全な Python プログラム8714868
Ref: reference/toplevel_components complete-python-programs8714988
Ref: 27b68714988
Ref: reference/toplevel_components programs8714988
Ref: 26678714988
Node: ファイル入力8716962
Ref: reference/toplevel_components file-input8717106
Ref: 27b78717106
Ref: reference/toplevel_components id18717106
Ref: 27b88717106
Ref: reference/toplevel_components grammar-token-python-grammar-file_input8717235
Ref: 27b98717235
Node: 対話的入力8717605
Ref: reference/toplevel_components interactive8717726
Ref: 27ba8717726
Ref: reference/toplevel_components interactive-input8717726
Ref: 27bb8717726
Ref: reference/toplevel_components grammar-token-python-grammar-interactive_input8717850
Ref: 27bc8717850
Node: 式入力8718209
Ref: reference/toplevel_components expression-input8718303
Ref: 27bd8718303
Ref: reference/toplevel_components id28718303
Ref: 27be8718303
Ref: reference/toplevel_components grammar-token-python-grammar-eval_input8718536
Ref: 27bf8718536
Node: 完全な文法仕様8718602
Ref: reference/grammar doc8718724
Ref: 277b8718724
Ref: reference/grammar full-grammar-specification8718724
Ref: 27c08718724
Ref: reference/grammar id18718724
Ref: 27c18718724
Ref: reference/grammar translation-repo8718724
Ref: 27c28718724
Ref: 完全な文法仕様-Footnote-18802394
Node: Python 標準ライブラリ8802466
Ref: library/index doc8802632
Ref: 27c38802632
Ref: library/index library-index8802632
Ref: 3fe8802632
Ref: library/index the-python-standard-library8802632
Ref: 27c48802632
Ref: library/index translation-repo8802632
Ref: 27c58802632
Ref: Python 標準ライブラリ-Footnote-18806356
Node: はじめに<6>8806381
Ref: library/intro doc8806488
Ref: 27c68806488
Ref: library/intro introduction8806488
Ref: 27c78806488
Ref: library/intro library-intro8806488
Ref: 27c88806488
Node: 利用可能性について8810494
Ref: library/intro availability8810573
Ref: 234c8810573
Ref: library/intro notes-on-availability8810573
Ref: 27c98810573
Node: WebAssembly プラットフォーム8811563
Ref: library/intro wasm-availability8811708
Ref: 1d868811708
Ref: library/intro webassembly-platforms8811708
Ref: 27ca8811708
Ref: library/intro mobile-availability8814815
Ref: 246c8814815
Ref: WebAssembly プラットフォーム-Footnote-18814852
Ref: WebAssembly プラットフォーム-Footnote-28814885
Ref: WebAssembly プラットフォーム-Footnote-38814917
Ref: WebAssembly プラットフォーム-Footnote-48814943
Ref: WebAssembly プラットフォーム-Footnote-58814975
Ref: WebAssembly プラットフォーム-Footnote-68815001
Ref: WebAssembly プラットフォーム-Footnote-78815031
Ref: WebAssembly プラットフォーム-Footnote-88815060
Ref: WebAssembly プラットフォーム-Footnote-98815090
Node: モバイルプラットフォーム8815150
Ref: library/intro ios-availability8815295
Ref: 27cb8815295
Ref: library/intro mobile-platforms8815295
Ref: 27cc8815295
Ref: モバイルプラットフォーム-Footnote-18818147
Node: 組み込み関数8818213
Ref: library/functions doc8818347
Ref: 27cd8818347
Ref: library/functions built-in-funcs8818347
Ref: 16168818347
Ref: library/functions built-in-functions8818347
Ref: 27ce8818347
Ref: library/functions translation-repo8818347
Ref: 27cf8818347
Ref: library/functions abs8821839
Ref: 229a8821839
Ref: library/functions aiter8822112
Ref: bb68822112
Ref: library/functions all8822469
Ref: 17da8822469
Ref: library/functions anext8822829
Ref: bb78822829
Ref: library/functions any8823814
Ref: 17d98823814
Ref: library/functions ascii8824188
Ref: 179f8824188
Ref: library/functions bin8824620
Ref: 16628824620
Ref: library/functions bool8825615
Ref: 5f68825615
Ref: library/functions breakpoint8826480
Ref: 5008826480
Ref: library/functions func-bytearray8828132
Ref: 20a78828132
Ref: library/functions func-bytes8829894
Ref: 20a68829894
Ref: library/functions callable8830893
Ref: 15848830893
Ref: library/functions chr8831683
Ref: 1c178831683
Ref: library/functions classmethod8832142
Ref: 6a08832142
Ref: library/functions compile8834346
Ref: 1d38834346
Ref: library/functions complex8839877
Ref: 3308839877
Ref: library/functions grammar-token-float-complexvalue8841501
Ref: 27e18841501
Ref: library/functions delattr8843678
Ref: 1b58843678
Ref: library/functions func-dict8844258
Ref: 27d08844258
Ref: library/functions dir8844860
Ref: a288844860
Ref: library/functions divmod8848156
Ref: d6e8848156
Ref: library/functions enumerate8848972
Ref: 18398848972
Ref: library/functions func-eval8850044
Ref: 27e58850044
Ref: library/functions eval8850044
Ref: 18f8850044
Ref: library/functions exec8853667
Ref: 1908853667
Ref: library/functions filter8858166
Ref: c3f8858166
Ref: library/functions float8859155
Ref: 32f8859155
Ref: library/functions grammar-token-float-sign8860154
Ref: 27e38860154
Ref: library/functions grammar-token-float-infinity8860189
Ref: 27e78860189
Ref: library/functions grammar-token-float-nan8860233
Ref: 27e88860233
Ref: library/functions grammar-token-float-digit8860264
Ref: 27e98860264
Ref: library/functions grammar-token-float-digitpart8860363
Ref: 27ea8860363
Ref: library/functions grammar-token-float-number8860435
Ref: 27eb8860435
Ref: library/functions grammar-token-float-exponent8860543
Ref: 27ec8860543
Ref: library/functions grammar-token-float-floatnumber8860623
Ref: 27ed8860623
Ref: library/functions grammar-token-float-absfloatvalue8860692
Ref: 27e48860692
Ref: library/functions grammar-token-float-floatvalue8860785
Ref: 27e28860785
Ref: library/functions format8862303
Ref: 4408862303
Ref: library/functions func-frozenset8863555
Ref: 27d18863555
Ref: library/functions getattr8864175
Ref: f938864175
Ref: library/functions globals8865379
Ref: 1e208865379
Ref: library/functions hasattr8865689
Ref: 8e78865689
Ref: library/functions hash8866110
Ref: 9e78866110
Ref: library/functions help8866782
Ref: cad8866782
Ref: library/functions hex8868246
Ref: 16898868246
Ref: library/functions id8869504
Ref: 17db8869504
Ref: library/functions input8870048
Ref: 16928870048
Ref: library/functions int8871081
Ref: 32e8871081
Ref: library/functions isinstance8875296
Ref: 2fb8875296
Ref: library/functions issubclass8876490
Ref: 2fc8876490
Ref: library/functions iter8877104
Ref: bb88877104
Ref: library/functions len8878950
Ref: a248878950
Ref: library/functions func-list8879408
Ref: 27d28879408
Ref: library/functions locals8879699
Ref: 2968879699
Ref: library/functions map8882878
Ref: 4458882878
Ref: library/functions max8883854
Ref: 12bd8883854
Ref: library/functions func-memoryview8885454
Ref: 27d38885454
Ref: library/functions min8885687
Ref: 12bc8885687
Ref: library/functions next8887274
Ref: bb98887274
Ref: library/functions object8887694
Ref: e518887694
Ref: library/functions oct8888328
Ref: 16888888328
Ref: library/functions open8889282
Ref: 3338889282
Ref: library/functions filemodes8891434
Ref: 27f18891434
Ref: library/functions open-newline-parameter8896752
Ref: b2b8896752
Ref: library/functions ord8902995
Ref: 254a8902995
Ref: library/functions pow8903556
Ref: 4488903556
Ref: library/functions print8906029
Ref: 13248906029
Ref: library/functions property8907671
Ref: 6c18907671
Ref: library/functions property getter8909504
Ref: 1c018909504
Ref: library/functions property setter8909533
Ref: 1c028909533
Ref: library/functions property deleter8909562
Ref: 1c038909562
Ref: library/functions property __name__8910976
Ref: 6c08910976
Ref: library/functions func-range8911159
Ref: 27d48911159
Ref: library/functions repr8911481
Ref: 4628911481
Ref: library/functions reversed8912661
Ref: c408912661
Ref: library/functions round8913130
Ref: 16948913130
Ref: library/functions func-set8914741
Ref: 27d58914741
Ref: library/functions setattr8915334
Ref: 27d68915334
Ref: library/functions sentinel8916694
Ref: 1968916694
Ref: library/functions sentinel __name__8918374
Ref: 27f68918374
Ref: library/functions sentinel __module__8918436
Ref: 27f78918436
Ref: library/functions slice8918563
Ref: 1db8918563
Ref: library/functions slice start8919166
Ref: 25b98919166
Ref: library/functions slice stop8919192
Ref: 25ba8919192
Ref: library/functions slice step8919217
Ref: 25bb8919217
Ref: library/functions sorted8919874
Ref: f908919874
Ref: library/functions staticmethod8922119
Ref: 66d8922119
Ref: library/functions func-str8924283
Ref: 27d78924283
Ref: library/functions sum8924802
Ref: 8868924802
Ref: library/functions super8926098
Ref: 44a8926098
Ref: library/functions func-tuple8931603
Ref: 27d88931603
Ref: library/functions type8931896
Ref: 1918931896
Ref: library/functions vars8934124
Ref: 20308934124
Ref: library/functions zip8935409
Ref: 4468935409
Ref: library/functions import__8940305
Ref: caa8940305
Ref: 組み込み関数-Footnote-18944485
Ref: 組み込み関数-Footnote-28944738
Ref: 組み込み関数-Footnote-38944780
Ref: 組み込み関数-Footnote-48944822
Ref: 組み込み関数-Footnote-58944864
Ref: 組み込み関数-Footnote-68944906
Ref: 組み込み関数-Footnote-78944983
Ref: 組み込み関数-Footnote-88945031
Ref: 組み込み関数-Footnote-98945073
Node: 組み込み定数8945115
Ref: library/constants doc8945249
Ref: 27f98945249
Ref: library/constants built-in-constants8945249
Ref: 27fa8945249
Ref: library/constants built-in-consts8945249
Ref: 268c8945249
Ref: library/constants translation-repo8945249
Ref: 27fb8945249
Ref: library/constants False8945377
Ref: ef98945377
Ref: library/constants True8945533
Ref: fd08945533
Ref: library/constants None8945687
Ref: a6a8945687
Ref: library/constants NotImplemented8946046
Ref: 4478946046
Ref: library/constants Ellipsis8948172
Ref: 25378948172
Ref: library/constants debug__8948518
Ref: bbb8948518
Node: site モジュールで追加される定数8949134
Ref: library/constants constants-added-by-the-site-module8949233
Ref: 27fc8949233
Ref: library/constants site-consts8949233
Ref: 27fd8949233
Ref: library/constants quit8949723
Ref: 27fe8949723
Ref: library/constants exit8949755
Ref: 27ff8949755
Ref: library/constants copyright8950324
Ref: 19a48950324
Ref: library/constants credits8950349
Ref: 19a58950349
Ref: library/constants license8950542
Ref: 19a38950542
Node: 組み込み型8950859
Ref: library/stdtypes doc8950993
Ref: 28008950993
Ref: library/stdtypes bltin-types8950993
Ref: 28018950993
Ref: library/stdtypes built-in-types8950993
Ref: 28028950993
Ref: library/stdtypes translation-repo8950993
Ref: 28038950993
Node: 真理値判定8953042
Ref: library/stdtypes truth8953148
Ref: 1aa08953148
Ref: library/stdtypes truth-value-testing8953148
Ref: 28048953148
Ref: 真理値判定-Footnote-18954532
Node: ブール演算 --- and or not8954732
Ref: library/stdtypes boolean8954856
Ref: 28058954856
Ref: library/stdtypes boolean-operations-and-or-not8954856
Ref: 28068954856
Node: 比較<2>8956329
Ref: library/stdtypes comparisons8956465
Ref: 28078956465
Ref: library/stdtypes stdcomparisons8956465
Ref: 28088956465
Node: 数値型 int float complex8959390
Ref: library/stdtypes numeric-types-int-float-complex8959521
Ref: 28098959521
Ref: library/stdtypes typesnumeric8959521
Ref: 21e88959521
Ref: library/stdtypes stdtypes-mixed-arithmetic8961252
Ref: 267e8961252
Ref: 数値型 int float complex-Footnote-18969056
Ref: 数値型 int float complex-Footnote-28969206
Node: 整数型におけるビット単位演算8969283
Ref: library/stdtypes bitstring-ops8969440
Ref: 280b8969440
Ref: library/stdtypes bitwise-operations-on-integer-types8969440
Ref: 280c8969440
Node: 整数型における追加のメソッド8972017
Ref: library/stdtypes additional-methods-on-integer-types8972234
Ref: 280d8972234
Ref: library/stdtypes int bit_length8972489
Ref: 280e8972489
Ref: library/stdtypes int bit_count8973397
Ref: bb08973397
Ref: library/stdtypes int to_bytes8973797
Ref: 1e488973797
Ref: library/stdtypes int from_bytes8976189
Ref: 19af8976189
Ref: library/stdtypes int as_integer_ratio8978308
Ref: d958978308
Ref: library/stdtypes int is_integer8978638
Ref: 1d098978638
Node: 浮動小数点数に対する追加のメソッド8978870
Ref: library/stdtypes additional-methods-on-float8979087
Ref: 28118979087
Ref: library/stdtypes float from_number8979387
Ref: 43e8979387
Ref: library/stdtypes float as_integer_ratio8980109
Ref: 23108980109
Ref: library/stdtypes float is_integer8980466
Ref: 28108980466
Ref: library/stdtypes float hex8981236
Ref: 23118981236
Ref: library/stdtypes float fromhex8981460
Ref: 28128981460
Node: 複素数に対する追加のメソッド8983284
Ref: library/stdtypes additional-methods-on-complex8983486
Ref: 28138983486
Ref: library/stdtypes complex from_number8983770
Ref: 43f8983770
Node: 数値型のハッシュ化8984340
Ref: library/stdtypes hashing-of-numeric-types8984482
Ref: 28158984482
Ref: library/stdtypes numeric-hash8984482
Ref: 28168984482
Ref: library/stdtypes bltin-boolean-values8989123
Ref: 28188989123
Node: ブーリアン型 - bool8989124
Ref: library/stdtypes boolean-type-bool8989264
Ref: 28198989264
Ref: library/stdtypes typebool8989264
Ref: 27d98989264
Node: イテレータ型8990800
Ref: library/stdtypes iterator-types8990952
Ref: 281a8990952
Ref: library/stdtypes typeiter8990952
Ref: 27ef8990952
Ref: library/stdtypes container __iter__8991564
Ref: 22b88991564
Ref: library/stdtypes iterator __iter__8992579
Ref: 22bb8992579
Ref: library/stdtypes iterator __next__8993024
Ref: 16878993024
Node: ジェネレータ型8994032
Ref: library/stdtypes generator-types8994108
Ref: 281b8994108
Ref: library/stdtypes id38994108
Ref: 281c8994108
Node: シーケンス型 --- list tuple range8994782
Ref: library/stdtypes sequence-types-list-tuple-range8994954
Ref: 281d8994954
Ref: library/stdtypes typesseq8994954
Ref: 223b8994954
Node: 共通のシーケンス演算8995601
Ref: library/stdtypes common-sequence-operations8995758
Ref: 281e8995758
Ref: library/stdtypes typesseq-common8995758
Ref: 281f8995758
Ref: library/stdtypes list count9005334
Ref: 177e9005334
Ref: library/stdtypes sequence count9005334
Ref: 25ec9005334
Ref: library/stdtypes list index9005454
Ref: 177d9005454
Ref: library/stdtypes sequence index9005454
Ref: 1baa9005454
Ref: 共通のシーケンス演算-Footnote-19006133
Node: イミュータブルなシーケンス型9006284
Ref: library/stdtypes immutable-sequence-types9006489
Ref: 28239006489
Ref: library/stdtypes typesseq-immutable9006489
Ref: 28249006489
Node: ミュータブルなシーケンス型9007217
Ref: library/stdtypes mutable-sequence-types9007412
Ref: 28259007412
Ref: library/stdtypes typesseq-mutable9007412
Ref: 27da9007412
Ref: library/stdtypes bytearray append9011386
Ref: 175e9011386
Ref: library/stdtypes sequence append9011386
Ref: 25ea9011386
Ref: library/stdtypes bytearray clear9011557
Ref: 28269011557
Ref: library/stdtypes sequence clear9011557
Ref: 25eb9011557
Ref: library/stdtypes bytearray copy9011721
Ref: 28279011721
Ref: library/stdtypes sequence copy9011721
Ref: 28289011721
Ref: library/stdtypes bytearray extend9012066
Ref: 19ac9012066
Ref: library/stdtypes sequence extend9012066
Ref: 25ed9012066
Ref: library/stdtypes bytearray insert9012271
Ref: 28299012271
Ref: library/stdtypes sequence insert9012271
Ref: 25ee9012271
Ref: library/stdtypes bytearray pop9012458
Ref: 175f9012458
Ref: library/stdtypes sequence pop9012458
Ref: 25ef9012458
Ref: library/stdtypes bytearray remove9012646
Ref: 282a9012646
Ref: library/stdtypes sequence remove9012646
Ref: 1bab9012646
Ref: library/stdtypes bytearray reverse9012878
Ref: 17609012878
Ref: library/stdtypes sequence reverse9012878
Ref: 25f09012878
Node: リスト型 list<2>9013121
Ref: library/stdtypes lists9013292
Ref: 282b9013292
Ref: library/stdtypes typesseq-list9013292
Ref: 222e9013292
Ref: library/stdtypes list9013583
Ref: 4e09013583
Ref: library/stdtypes list sort9014998
Ref: f919014998
Node: タプル型 tuple9018061
Ref: library/stdtypes tuples9018198
Ref: 282d9018198
Ref: library/stdtypes typesseq-tuple9018198
Ref: 27619018198
Ref: library/stdtypes tuple9018723
Ref: 1d99018723
Node: range9020600
Ref: library/stdtypes ranges9020708
Ref: 282e9020708
Ref: library/stdtypes typesseq-range9020708
Ref: 27f59020708
Ref: library/stdtypes range9020918
Ref: d139020918
Ref: library/stdtypes range start9023197
Ref: 282f9023197
Ref: library/stdtypes range stop9023316
Ref: 28309023316
Ref: library/stdtypes range step9023374
Ref: 28319023374
Ref: range-Footnote-19025748
Node: Text and Binary Sequence Type Methods Summary9025834
Ref: library/stdtypes text-and-binary-sequence-type-methods-summary9026026
Ref: 28329026026
Ref: library/stdtypes text-methods-summary9026026
Ref: 28339026026
Node: テキストシーケンス型 --- str9037035
Ref: library/stdtypes text-sequence-type-str9037249
Ref: 285e9037249
Ref: library/stdtypes textseq9037249
Ref: 21ec9037249
Ref: library/stdtypes str9039544
Ref: 1ea9039544
Node: 文字列メソッド<2>9042493
Ref: library/stdtypes id59042636
Ref: 28619042636
Ref: library/stdtypes string-methods9042636
Ref: 21ed9042636
Ref: library/stdtypes str capitalize9043671
Ref: 28509043671
Ref: library/stdtypes str casefold9044158
Ref: 11939044158
Ref: library/stdtypes str center9044988
Ref: 22709044988
Ref: library/stdtypes str count9045457
Ref: 1bb29045457
Ref: library/stdtypes str encode9046189
Ref: cab9046189
Ref: library/stdtypes str endswith9047739
Ref: 127d9047739
Ref: library/stdtypes str expandtabs9048529
Ref: 28599048529
Ref: library/stdtypes str find9049764
Ref: 125c9049764
Ref: library/stdtypes str format9050575
Ref: a179050575
Ref: library/stdtypes str format_map9052606
Ref: 11949052606
Ref: library/stdtypes str index9053171
Ref: 1be59053171
Ref: library/stdtypes str isalnum9053720
Ref: 28439053720
Ref: library/stdtypes str isalpha9054272
Ref: 283d9054272
Ref: library/stdtypes str isascii9055091
Ref: ebb9055091
Ref: library/stdtypes str isdecimal9055456
Ref: 283f9055456
Ref: library/stdtypes str isdigit9056077
Ref: 28409056077
Ref: library/stdtypes str isidentifier9056683
Ref: 1f599056683
Ref: library/stdtypes str islower9057316
Ref: 28459057316
Ref: library/stdtypes str isnumeric9057590
Ref: 28429057590
Ref: library/stdtypes str isprintable9058542
Ref: 11959058542
Ref: library/stdtypes str isspace9059596
Ref: 284b9059596
Ref: library/stdtypes str istitle9060391
Ref: 28499060391
Ref: library/stdtypes str isupper9061020
Ref: 28479061020
Ref: library/stdtypes meth-str-join9061485
Ref: 28659061485
Ref: library/stdtypes str join9061485
Ref: 28219061485
Ref: library/stdtypes str ljust9062009
Ref: 226f9062009
Ref: library/stdtypes str lower9062578
Ref: 19869062578
Ref: library/stdtypes str lstrip9062927
Ref: 18689062927
Ref: library/stdtypes str maketrans9063864
Ref: 1929063864
Ref: library/stdtypes str partition9064844
Ref: 125f9064844
Ref: library/stdtypes str removeprefix9065594
Ref: ca59065594
Ref: library/stdtypes str removesuffix9066029
Ref: ca69066029
Ref: library/stdtypes str replace9066493
Ref: 6c69066493
Ref: library/stdtypes str rfind9067113
Ref: 125d9067113
Ref: library/stdtypes str rindex9067614
Ref: 16119067614
Ref: library/stdtypes str rjust9068193
Ref: 226e9068193
Ref: library/stdtypes str rpartition9068798
Ref: 16129068798
Ref: library/stdtypes str rsplit9069551
Ref: 160f9069551
Ref: library/stdtypes str rstrip9070124
Ref: 18699070124
Ref: library/stdtypes str split9070977
Ref: 125e9070977
Ref: library/stdtypes str splitlines9073284
Ref: 16109073284
Ref: library/stdtypes str startswith9076041
Ref: 127c9076041
Ref: library/stdtypes str strip9076781
Ref: 18679076781
Ref: library/stdtypes str swapcase9077928
Ref: 28549077928
Ref: library/stdtypes str title9078384
Ref: 28529078384
Ref: library/stdtypes str translate9079765
Ref: 199a9079765
Ref: library/stdtypes str upper9081306
Ref: 284e9081306
Ref: library/stdtypes str zfill9081884
Ref: 186a9081884
Ref: 文字列メソッド<2>-Footnote-19082446
Ref: 文字列メソッド<2>-Footnote-29082530
Ref: 文字列メソッド<2>-Footnote-39082614
Ref: 文字列メソッド<2>-Footnote-49082871
Ref: 文字列メソッド<2>-Footnote-59083128
Ref: 文字列メソッド<2>-Footnote-69083385
Ref: 文字列メソッド<2>-Footnote-79083469
Ref: 文字列メソッド<2>-Footnote-89083726
Node: Formatted String Literals f-strings9083810
Ref: library/stdtypes formatted-string-literals-f-strings9083996
Ref: 28679083996
Ref: library/stdtypes stdtypes-fstrings9083996
Ref: 24fa9083996
Node: Debug specifier9085202
Ref: library/stdtypes debug-specifier9085318
Ref: 28689085318
Node: Conversion specifier9085906
Ref: library/stdtypes conversion-specifier9086047
Ref: 28699086047
Node: Format specifier9087031
Ref: library/stdtypes format-specifier9087148
Ref: 286a9087148
Node: Template String Literals t-strings9087915
Ref: library/stdtypes stdtypes-tstrings9088111
Ref: 24fe9088111
Ref: library/stdtypes template-string-literals-t-strings9088111
Ref: 286b9088111
Node: printf 形式の文字列書式化9089981
Ref: library/stdtypes old-string-formatting9090133
Ref: abe9090133
Ref: library/stdtypes printf-style-string-formatting9090133
Ref: 286d9090133
Ref: printf 形式の文字列書式化-Footnote-19100974
Ref: printf 形式の文字列書式化-Footnote-29101190
Node: バイナリシーケンス型 --- bytes bytearray memoryview9101232
Ref: library/stdtypes binary-sequence-types-bytes-bytearray-memoryview9101437
Ref: 286e9101437
Ref: library/stdtypes binaryseq9101437
Ref: 27dc9101437
Node: バイトオブジェクト9102328
Ref: library/stdtypes bytes-objects9102490
Ref: 286f9102490
Ref: library/stdtypes typebytes9102490
Ref: 27de9102490
Ref: library/stdtypes bytes9102931
Ref: 1d29102931
Ref: library/stdtypes bytes fromhex9105861
Ref: 43b9105861
Ref: library/stdtypes bytes hex9106856
Ref: 11229106856
Node: bytearray オブジェクト9108969
Ref: library/stdtypes bytearray-objects9109169
Ref: 28709109169
Ref: library/stdtypes typebytearray9109169
Ref: 27dd9109169
Ref: library/stdtypes bytearray9109359
Ref: 1d19109359
Ref: library/stdtypes bytearray fromhex9110627
Ref: 43c9110627
Ref: library/stdtypes bytearray hex9111667
Ref: 11239111667
Ref: library/stdtypes bytearray resize9112359
Ref: 19499112359
Ref: library/stdtypes bytearray take_bytes9113352
Ref: 1d09113352
Node: bytes と bytearray の操作9115227
Ref: library/stdtypes bytes-and-bytearray-operations9115438
Ref: 28729115438
Ref: library/stdtypes bytes-methods9115438
Ref: 27db9115438
Ref: library/stdtypes bytes count9117113
Ref: 1bb39117113
Ref: library/stdtypes bytearray count9117165
Ref: 19b69117165
Ref: library/stdtypes bytes removeprefix9117944
Ref: 28739117944
Ref: library/stdtypes bytearray removeprefix9117993
Ref: 28749117993
Ref: library/stdtypes bytes removesuffix9118726
Ref: 28759118726
Ref: library/stdtypes bytearray removesuffix9118775
Ref: 28769118775
Ref: library/stdtypes bytes decode9119539
Ref: cac9119539
Ref: library/stdtypes bytearray decode9119606
Ref: 28779119606
Ref: library/stdtypes bytes endswith9121316
Ref: 28379121316
Ref: library/stdtypes bytearray endswith9121374
Ref: 175b9121374
Ref: library/stdtypes bytes find9122011
Ref: 1dec9122011
Ref: library/stdtypes bytearray find9122062
Ref: 175c9122062
Ref: library/stdtypes bytes index9123196
Ref: 28349123196
Ref: library/stdtypes bytearray index9123248
Ref: 19b79123248
Ref: library/stdtypes bytes join9123763
Ref: 28229123763
Ref: library/stdtypes bytearray join9123806
Ref: 28789123806
Ref: library/stdtypes bytes maketrans9124314
Ref: 162e9124314
Ref: library/stdtypes bytearray maketrans9124369
Ref: 162f9124369
Ref: library/stdtypes bytes partition9124843
Ref: 283b9124843
Ref: library/stdtypes bytearray partition9124886
Ref: 28799124886
Ref: library/stdtypes bytes replace9125567
Ref: 1de9125567
Ref: library/stdtypes bytearray replace9125623
Ref: 287a9125623
Ref: library/stdtypes bytes rfind9126443
Ref: 1ded9126443
Ref: library/stdtypes bytearray rfind9126495
Ref: 175d9126495
Ref: library/stdtypes bytes rindex9127181
Ref: 28359127181
Ref: library/stdtypes bytearray rindex9127234
Ref: 19b89127234
Ref: library/stdtypes bytes rpartition9127758
Ref: 283c9127758
Ref: library/stdtypes bytearray rpartition9127802
Ref: 287b9127802
Ref: library/stdtypes bytes startswith9128463
Ref: 28369128463
Ref: library/stdtypes bytearray startswith9128523
Ref: 175a9128523
Ref: library/stdtypes bytes translate9129162
Ref: 198e9129162
Ref: library/stdtypes bytearray translate9129219
Ref: 16b59129219
Ref: library/stdtypes bytes center9130545
Ref: 28589130545
Ref: library/stdtypes bytearray center9130602
Ref: 287c9130602
Ref: library/stdtypes bytes ljust9131234
Ref: 28569131234
Ref: library/stdtypes bytearray ljust9131290
Ref: 287d9131290
Ref: library/stdtypes bytes lstrip9131918
Ref: 285c9131918
Ref: library/stdtypes bytearray lstrip9131965
Ref: 287e9131965
Ref: library/stdtypes bytes rjust9133300
Ref: 28579133300
Ref: library/stdtypes bytearray rjust9133356
Ref: 287f9133356
Ref: library/stdtypes bytes rsplit9133984
Ref: 28399133984
Ref: library/stdtypes bytearray rsplit9134039
Ref: 19bb9134039
Ref: library/stdtypes bytes rstrip9134675
Ref: 285d9134675
Ref: library/stdtypes bytearray rstrip9134722
Ref: 28809134722
Ref: library/stdtypes bytes split9136039
Ref: 28389136039
Ref: library/stdtypes bytearray split9136093
Ref: 19ba9136093
Ref: library/stdtypes bytes strip9138317
Ref: 285b9138317
Ref: library/stdtypes bytearray strip9138363
Ref: 28819138363
Ref: library/stdtypes bytes capitalize9139737
Ref: 28519139737
Ref: library/stdtypes bytearray capitalize9139775
Ref: 28829139775
Ref: library/stdtypes bytes expandtabs9140284
Ref: 285a9140284
Ref: library/stdtypes bytearray expandtabs9140331
Ref: 28839140331
Ref: library/stdtypes bytes isalnum9142054
Ref: 28449142054
Ref: library/stdtypes bytearray isalnum9142089
Ref: 28849142089
Ref: library/stdtypes bytes isalpha9142742
Ref: 283e9142742
Ref: library/stdtypes bytearray isalpha9142777
Ref: 28859142777
Ref: library/stdtypes bytes isascii9143322
Ref: 28869143322
Ref: library/stdtypes bytearray isascii9143357
Ref: 28879143357
Ref: library/stdtypes bytes isdigit9143670
Ref: 28419143670
Ref: library/stdtypes bytearray isdigit9143705
Ref: 28889143705
Ref: library/stdtypes bytes islower9144147
Ref: 28469144147
Ref: library/stdtypes bytearray islower9144182
Ref: 28899144182
Ref: library/stdtypes bytes isspace9144864
Ref: 284c9144864
Ref: library/stdtypes bytearray isspace9144899
Ref: 288a9144899
Ref: library/stdtypes bytes istitle9145379
Ref: 284a9145379
Ref: library/stdtypes bytearray istitle9145414
Ref: 288b9145414
Ref: library/stdtypes bytes isupper9145900
Ref: 28489145900
Ref: library/stdtypes bytearray isupper9145935
Ref: 288c9145935
Ref: library/stdtypes bytes lower9146617
Ref: 284d9146617
Ref: library/stdtypes bytearray lower9146650
Ref: 288d9146650
Ref: library/stdtypes bytes splitlines9147414
Ref: 283a9147414
Ref: library/stdtypes bytearray splitlines9147466
Ref: 288e9147466
Ref: library/stdtypes bytes swapcase9148635
Ref: 28559148635
Ref: library/stdtypes bytearray swapcase9148671
Ref: 288f9148671
Ref: library/stdtypes bytes title9149808
Ref: 28539149808
Ref: library/stdtypes bytearray title9149841
Ref: 28909149841
Ref: library/stdtypes bytes upper9151870
Ref: 284f9151870
Ref: library/stdtypes bytearray upper9151903
Ref: 28919151903
Ref: library/stdtypes bytes zfill9152667
Ref: 28929152667
Ref: library/stdtypes bytearray zfill9152708
Ref: 28939152708
Node: printf 形式での bytes の書式化9153498
Ref: library/stdtypes bytes-formatting9153699
Ref: 113e9153699
Ref: library/stdtypes printf-style-bytes-formatting9153699
Ref: 28949153699
Ref: printf 形式での bytes の書式化-Footnote-19164679
Ref: printf 形式での bytes の書式化-Footnote-29164895
Ref: printf 形式での bytes の書式化-Footnote-39164937
Node: メモリビュー9164979
Ref: library/stdtypes memory-views9165142
Ref: 28959165142
Ref: library/stdtypes typememoryview9165142
Ref: 27f09165142
Ref: library/stdtypes memoryview9165441
Ref: 1dd9165441
Ref: library/stdtypes memoryview __eq__9170175
Ref: 28989170175
Ref: library/stdtypes memoryview tobytes9172326
Ref: 28999172326
Ref: library/stdtypes memoryview hex9173788
Ref: 11249173788
Ref: library/stdtypes memoryview tolist9174461
Ref: 28969174461
Ref: library/stdtypes memoryview toreadonly9175108
Ref: 289a9175108
Ref: library/stdtypes memoryview release9175776
Ref: 157c9175776
Ref: library/stdtypes memoryview cast9177353
Ref: 13f89177353
Ref: library/stdtypes memoryview count9180939
Ref: 1b369180939
Ref: library/stdtypes memoryview index9181069
Ref: 1b359181069
Ref: library/stdtypes memoryview obj9181430
Ref: 289b9181430
Ref: library/stdtypes memoryview nbytes9181681
Ref: 289c9181681
Ref: library/stdtypes memoryview readonly9182785
Ref: 289d9182785
Ref: library/stdtypes memoryview format9182896
Ref: 13f79182896
Ref: library/stdtypes memoryview itemsize9183647
Ref: 28979183647
Ref: library/stdtypes memoryview ndim9184025
Ref: 13fb9184025
Ref: library/stdtypes memoryview shape9184135
Ref: 13fc9184135
Ref: library/stdtypes memoryview strides9184455
Ref: 13fd9184455
Ref: library/stdtypes memoryview suboffsets9184852
Ref: 13fe9184852
Ref: library/stdtypes memoryview c_contiguous9185030
Ref: 289e9185030
Ref: library/stdtypes memoryview f_contiguous9185245
Ref: 289f9185245
Ref: library/stdtypes memoryview contiguous9185464
Ref: 28a09185464
Ref: メモリビュー-Footnote-19185856
Node: set（集合）型 --- set frozenset9185898
Ref: library/stdtypes set-types-set-frozenset9186098
Ref: 28a19186098
Ref: library/stdtypes types-set9186098
Ref: 223e9186098
Ref: library/stdtypes set9187944
Ref: 4329187944
Ref: library/stdtypes frozenset9187980
Ref: 9d99187980
Ref: library/stdtypes frozenset isdisjoint9189238
Ref: 28a39189238
Ref: library/stdtypes set isdisjoint9189288
Ref: 28a49189288
Ref: library/stdtypes frozenset issubset9189549
Ref: 28a59189549
Ref: library/stdtypes set issubset9189597
Ref: 28a69189597
Ref: library/stdtypes frozenset issuperset9189918
Ref: 28a79189918
Ref: library/stdtypes set issuperset9189968
Ref: 1da09189968
Ref: library/stdtypes frozenset union9190291
Ref: 183b9190291
Ref: library/stdtypes set union9190335
Ref: 28a89190335
Ref: library/stdtypes frozenset intersection9190491
Ref: 183c9190491
Ref: library/stdtypes set intersection9190542
Ref: 1d9f9190542
Ref: library/stdtypes frozenset difference9190717
Ref: 28a99190717
Ref: library/stdtypes set difference9190766
Ref: 28aa9190766
Ref: library/stdtypes frozenset symmetric_difference9190972
Ref: 28ab9190972
Ref: library/stdtypes set symmetric_difference9191032
Ref: 28ac9191032
Ref: library/stdtypes frozenset copy9191233
Ref: 28ad9191233
Ref: library/stdtypes set copy9191269
Ref: 28ae9191269
Ref: library/stdtypes set update9193860
Ref: 28af9193860
Ref: library/stdtypes set intersection_update9194007
Ref: 183d9194007
Ref: library/stdtypes set difference_update9194202
Ref: 28b09194202
Ref: library/stdtypes set symmetric_difference_update9194367
Ref: 183e9194367
Ref: library/stdtypes set add9194571
Ref: 254d9194571
Ref: library/stdtypes set remove9194658
Ref: 28a29194658
Ref: library/stdtypes set discard9194848
Ref: 28b19194848
Ref: library/stdtypes set pop9194966
Ref: 28b29194966
Ref: library/stdtypes set clear9195139
Ref: 28b39195139
Node: Mapping types --- dict frozendict9195817
Ref: library/stdtypes mapping-types-dict-frozendict9195992
Ref: 28b59195992
Ref: library/stdtypes typesmapping9195992
Ref: e909195992
Ref: library/stdtypes dict9196967
Ref: 1939196967
Ref: library/stdtypes dict clear9202989
Ref: 19759202989
Ref: library/stdtypes dict copy9203079
Ref: f929203079
Ref: library/stdtypes dict fromkeys9203165
Ref: 4e19203165
Ref: library/stdtypes dict get9203927
Ref: 22419203927
Ref: library/stdtypes dict items9204324
Ref: bb39204324
Ref: library/stdtypes dict keys9204551
Ref: bb19204551
Ref: library/stdtypes dict pop9204751
Ref: 7e49204751
Ref: library/stdtypes dict popitem9205127
Ref: 18de9205127
Ref: library/stdtypes dict setdefault9206084
Ref: 14309206084
Ref: library/stdtypes dict update9206403
Ref: 181d9206403
Ref: library/stdtypes dict values9207153
Ref: bb29207153
Node: 辞書ビューオブジェクト9209268
Ref: library/stdtypes dict-views9209399
Ref: 28b69209399
Ref: library/stdtypes dictionary-view-objects9209399
Ref: 28b89209399
Node: Frozen dictionaries9213688
Ref: library/stdtypes frozen-dictionaries9213819
Ref: 28ba9213819
Ref: library/stdtypes frozendict9213878
Ref: 18d9213878
Node: コンテキストマネージャ型9215000
Ref: library/stdtypes context-manager-types9215221
Ref: 28bb9215221
Ref: library/stdtypes typecontextmanager9215221
Ref: 26209215221
Ref: library/stdtypes contextmanager __enter__9215683
Ref: 28bc9215683
Ref: library/stdtypes contextmanager __exit__9216944
Ref: 28bd9216944
Node: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン9220029
Ref: library/stdtypes type-annotation-types-generic-alias-union9220244
Ref: 28be9220244
Node: ジェネリックエイリアス型9220626
Ref: library/stdtypes generic-alias-type9220799
Ref: 28bf9220799
Ref: library/stdtypes types-genericalias9220799
Ref: aa49220799
Node: 標準ジェネリッククラス9227044
Ref: library/stdtypes standard-generic-classes9227208
Ref: 28c19227208
Node: GenericAlias オブジェクトの特別な属性9229747
Ref: library/stdtypes special-attributes-of-genericalias-objects9229911
Ref: 28ce9229911
Ref: library/stdtypes genericalias __origin__9230155
Ref: 28cf9230155
Ref: library/stdtypes genericalias __args__9230372
Ref: 28c09230372
Ref: library/stdtypes genericalias __parameters__9230669
Ref: 28d09230669
Ref: library/stdtypes genericalias __unpacked__9231346
Ref: 28d19231346
Ref: GenericAlias オブジェクトの特別な属性-Footnote-19232465
Ref: GenericAlias オブジェクトの特別な属性-Footnote-29232507
Node: Union 型9232549
Ref: library/stdtypes types-union9232722
Ref: ba69232722
Ref: library/stdtypes union-type9232722
Ref: 28d29232722
Ref: Union 型-Footnote-19236806
Node: その他の組み込み型9236848
Ref: library/stdtypes other-built-in-types9237039
Ref: 28d39237039
Ref: library/stdtypes typesother9237039
Ref: 28d49237039
Node: モジュール<4>9237652
Ref: library/stdtypes modules9237788
Ref: 28d59237788
Ref: library/stdtypes typesmodules9237788
Ref: 28d69237788
Node: クラスおよびクラスインスタンス9239315
Ref: library/stdtypes classes-and-class-instances9239466
Ref: 28d79239466
Ref: library/stdtypes typesobjects9239466
Ref: 28d89239466
Node: 関数9239711
Ref: library/stdtypes functions9239856
Ref: 28d99239856
Ref: library/stdtypes typesfunctions9239856
Ref: 28da9239856
Node: メソッド9240425
Ref: library/stdtypes methods9240555
Ref: 28db9240555
Ref: library/stdtypes typesmethods9240555
Ref: 28dc9240555
Node: コードオブジェクト<2>9242835
Ref: library/stdtypes bltin-code-objects9242980
Ref: 28dd9242980
Ref: library/stdtypes code-objects9242980
Ref: 28de9242980
Node: 型オブジェクト9244071
Ref: library/stdtypes bltin-type-objects9244228
Ref: 27f89244228
Ref: library/stdtypes type-objects9244228
Ref: 28df9244228
Node: ヌルオブジェクト9244691
Ref: library/stdtypes bltin-null-object9244845
Ref: 28e09244845
Ref: library/stdtypes the-null-object9244845
Ref: 28e19244845
Node: Ellipsis オブジェクト9245285
Ref: library/stdtypes bltin-ellipsis-object9245451
Ref: 22089245451
Ref: library/stdtypes the-ellipsis-object9245451
Ref: 28e29245451
Ref: Ellipsis オブジェクト-Footnote-19246671
Node: NotImplemented オブジェクト9246756
Ref: library/stdtypes bltin-notimplemented-object9246922
Ref: 28e59246922
Ref: library/stdtypes the-notimplemented-object9246922
Ref: 28e69246922
Node: 内部オブジェクト9247436
Ref: library/stdtypes internal-objects9247566
Ref: 28e79247566
Ref: library/stdtypes typesinternal9247566
Ref: 28e89247566
Node: 特殊属性9247845
Ref: library/stdtypes special-attributes9247999
Ref: 28e99247999
Ref: library/stdtypes specialattrs9247999
Ref: 28ea9247999
Ref: library/stdtypes definition __name__9248269
Ref: 141d9248269
Ref: library/stdtypes definition __qualname__9248429
Ref: 141c9248429
Ref: library/stdtypes definition __module__9248638
Ref: 28eb9248638
Ref: library/stdtypes definition __doc__9248747
Ref: cf89248747
Ref: library/stdtypes definition __type_params__9248870
Ref: 27ad9248870
Node: 整数と文字列の変換での長さ制限9249128
Ref: library/stdtypes int-max-str-digits9249246
Ref: 9f19249246
Ref: library/stdtypes integer-string-conversion-length-limitation9249246
Ref: 28ec9249246
Ref: 整数と文字列の変換での長さ制限-Footnote-19252343
Node: 影響のあるAPI9252399
Ref: library/stdtypes affected-apis9252532
Ref: 28ed9252532
Node: 上限値を設定する9253567
Ref: library/stdtypes configuring-the-limit9253721
Ref: 28ee9253721
Node: 推奨設定9256866
Ref: library/stdtypes recommended-configuration9256993
Ref: 28f19256993
Node: 組み込み例外9258133
Ref: library/exceptions doc9258273
Ref: 28f29258273
Ref: library/exceptions bltin-exceptions9258273
Ref: 1e3d9258273
Ref: library/exceptions built-in-exceptions9258273
Ref: 28f39258273
Ref: library/exceptions translation-repo9258273
Ref: 28f49258273
Node: 例外コンテキスト9260433
Ref: library/exceptions exception-context9260557
Ref: 28f59260557
Ref: library/exceptions BaseException __context__9260728
Ref: 16819260728
Ref: library/exceptions BaseException __cause__9260769
Ref: 16829260769
Ref: library/exceptions BaseException __suppress_context__9260808
Ref: 27299260808
Node: 組み込み例外から継承する9262715
Ref: library/exceptions inheriting-from-built-in-exceptions9262863
Ref: 28f69262863
Ref: 組み込み例外から継承する-Footnote-19263725
Node: 基底クラス9263798
Ref: library/exceptions base-classes9263934
Ref: 28f79263934
Ref: library/exceptions BaseException9264060
Ref: 9bd9264060
Ref: library/exceptions BaseException args9264508
Ref: 9779264508
Ref: library/exceptions BaseException with_traceback9264936
Ref: 27289264936
Ref: library/exceptions BaseException __traceback__9265842
Ref: 16809265842
Ref: library/exceptions BaseException add_note9266034
Ref: 9be9266034
Ref: library/exceptions BaseException __notes__9266386
Ref: 28f89266386
Ref: library/exceptions Exception9266620
Ref: da29266620
Ref: library/exceptions ArithmeticError9266842
Ref: 28f99266842
Ref: library/exceptions BufferError9267079
Ref: 19b99267079
Ref: library/exceptions LookupError9267214
Ref: 25f99267214
Ref: 基底クラス-Footnote-19267588
Node: 具象例外9267630
Ref: library/exceptions concrete-exceptions9267736
Ref: 28fb9267736
Ref: library/exceptions AssertionError9267830
Ref: a9c9267830
Ref: library/exceptions AttributeError9267932
Ref: 1b49267932
Ref: library/exceptions AttributeError name9268337
Ref: 28fc9268337
Ref: library/exceptions AttributeError obj9268435
Ref: 28fd9268435
Ref: library/exceptions EOFError9268648
Ref: 16939268648
Ref: library/exceptions FloatingPointError9268934
Ref: 28fa9268934
Ref: library/exceptions GeneratorExit9269009
Ref: 17809269009
Ref: library/exceptions ImportError9269432
Ref: 1c89269432
Ref: library/exceptions ImportError name9269851
Ref: 19239269851
Ref: library/exceptions ImportError path9269943
Ref: 28fe9269943
Ref: library/exceptions ModuleNotFoundError9270155
Ref: 1c99270155
Ref: library/exceptions ImportCycleError9270471
Ref: 28ff9270471
Ref: library/exceptions IndexError9270685
Ref: 18ed9270685
Ref: library/exceptions KeyError9271005
Ref: 7e59271005
Ref: library/exceptions KeyboardInterrupt9271164
Ref: d9a9271164
Ref: library/exceptions MemoryError9272083
Ref: 191d9272083
Ref: library/exceptions NameError9272820
Ref: 66c9272820
Ref: library/exceptions NameError name9273247
Ref: 29019273247
Ref: library/exceptions NotImplementedError9273434
Ref: 5a19273434
Ref: library/exceptions OSError9274497
Ref: 5439274497
Ref: library/exceptions OSError errno9275710
Ref: 19ea9275710
Ref: library/exceptions OSError winerror9275818
Ref: 29039275818
Ref: library/exceptions OSError strerror9276441
Ref: 29049276441
Ref: library/exceptions OSError filename9276677
Ref: 29059276677
Ref: library/exceptions OSError filename29276706
Ref: 29069276706
Ref: library/exceptions OverflowError9277826
Ref: c5b9277826
Ref: library/exceptions PythonFinalizationError9278407
Ref: 6919278407
Ref: library/exceptions RecursionError9279472
Ref: 11259279472
Ref: library/exceptions ReferenceError9279838
Ref: 18c59279838
Ref: library/exceptions RuntimeError9280242
Ref: 3179280242
Ref: library/exceptions StopIteration9280461
Ref: fbe9280461
Ref: library/exceptions StopIteration value9280738
Ref: 262b9280738
Ref: library/exceptions StopAsyncIteration9282134
Ref: 201d9282134
Ref: library/exceptions SyntaxError9282402
Ref: 1899282402
Ref: library/exceptions SyntaxError filename9282975
Ref: 29079282975
Ref: library/exceptions SyntaxError lineno9283071
Ref: 29089283071
Ref: library/exceptions SyntaxError offset9283264
Ref: 29099283264
Ref: library/exceptions SyntaxError text9283442
Ref: 290a9283442
Ref: library/exceptions SyntaxError end_lineno9283534
Ref: 290b9283534
Ref: library/exceptions SyntaxError end_offset9283740
Ref: 290c9283740
Ref: library/exceptions IndentationError9284368
Ref: 18ef9284368
Ref: library/exceptions TabError9284555
Ref: 9559284555
Ref: library/exceptions SystemError9284768
Ref: 3f19284768
Ref: library/exceptions SystemExit9285665
Ref: 10fb9285665
Ref: library/exceptions SystemExit code9287022
Ref: 290e9287022
Ref: library/exceptions TypeError9287192
Ref: 29c9287192
Ref: library/exceptions UnboundLocalError9288235
Ref: 18ee9288235
Ref: library/exceptions UnicodeError9288502
Ref: 67c9288502
Ref: library/exceptions UnicodeError encoding9288987
Ref: 290f9288987
Ref: library/exceptions UnicodeError reason9289095
Ref: 29109289095
Ref: library/exceptions UnicodeError object9289198
Ref: 1b3a9289198
Ref: library/exceptions UnicodeError start9289348
Ref: 1b009289348
Ref: library/exceptions UnicodeError end9289619
Ref: 1b019289619
Ref: library/exceptions UnicodeEncodeError9289894
Ref: a6c9289894
Ref: library/exceptions UnicodeDecodeError9290080
Ref: ddb9290080
Ref: library/exceptions UnicodeTranslateError9290263
Ref: 1b3b9290263
Ref: library/exceptions ValueError9290443
Ref: 15a9290443
Ref: library/exceptions ZeroDivisionError9290703
Ref: d159290703
Ref: library/exceptions EnvironmentError9291113
Ref: 140a9291113
Ref: library/exceptions IOError9291143
Ref: 14099291143
Ref: library/exceptions WindowsError9291164
Ref: 140b9291164
Ref: 具象例外-Footnote-19291295
Ref: 具象例外-Footnote-29291337
Node: OS 例外9291379
Ref: library/exceptions os-exceptions9291437
Ref: 29029291437
Ref: library/exceptions BlockingIOError9291604
Ref: 4ca9291604
Ref: library/exceptions BlockingIOError characters_written9292086
Ref: 29159292086
Ref: library/exceptions ChildProcessError9292338
Ref: 140e9292338
Ref: library/exceptions ConnectionError9292503
Ref: 11c39292503
Ref: library/exceptions BrokenPipeError9292773
Ref: 14129292773
Ref: library/exceptions ConnectionAbortedError9293163
Ref: 14139293163
Ref: library/exceptions ConnectionRefusedError9293414
Ref: 14149293414
Ref: library/exceptions ConnectionResetError9293665
Ref: 14159293665
Ref: library/exceptions FileExistsError9293910
Ref: 13cd9293910
Ref: library/exceptions FileNotFoundError9294116
Ref: 24f9294116
Ref: library/exceptions InterruptedError9294309
Ref: 11459294309
Ref: library/exceptions IsADirectoryError9294856
Ref: 140f9294856
Ref: library/exceptions NotADirectoryError9295084
Ref: 14109295084
Ref: library/exceptions PermissionError9295542
Ref: 10fd9295542
Ref: library/exceptions ProcessLookupError9295969
Ref: 14119295969
Ref: library/exceptions TimeoutError9296140
Ref: c129296140
Ref: OS 例外-Footnote-19296548
Ref: OS 例外-Footnote-29296590
Node: 警告9296632
Ref: library/exceptions warning-categories-as-exceptions9296741
Ref: 29239296741
Ref: library/exceptions warnings9296741
Ref: 29249296741
Ref: library/exceptions Warning9296933
Ref: 29269296933
Ref: library/exceptions UserWarning9297006
Ref: 29279297006
Ref: library/exceptions DeprecationWarning9297116
Ref: 2d49297116
Ref: library/exceptions PendingDeprecationWarning9297594
Ref: c9f9297594
Ref: library/exceptions SyntaxWarning9298299
Ref: 4519298299
Ref: library/exceptions RuntimeWarning9298544
Ref: 6e39298544
Ref: library/exceptions FutureWarning9298660
Ref: 84d9298660
Ref: library/exceptions ImportWarning9298881
Ref: 90c9298881
Ref: library/exceptions UnicodeWarning9299203
Ref: 17dc9299203
Ref: library/exceptions EncodingWarning9299294
Ref: 233c9299294
Ref: library/exceptions BytesWarning9299513
Ref: 2fa9299513
Ref: library/exceptions ResourceWarning9299644
Ref: 7549299644
Ref: 警告-Footnote-19299990
Ref: 警告-Footnote-29300032
Ref: 警告-Footnote-39300074
Node: 例外グループ9300116
Ref: library/exceptions exception-groups9300237
Ref: 29289300237
Ref: library/exceptions lib-exception-groups9300237
Ref: 29299300237
Ref: library/exceptions ExceptionGroup9300675
Ref: 6de9300675
Ref: library/exceptions BaseExceptionGroup9300715
Ref: 76d9300715
Ref: library/exceptions BaseExceptionGroup message9302019
Ref: 292a9302019
Ref: library/exceptions BaseExceptionGroup exceptions9302146
Ref: 292b9302146
Ref: library/exceptions BaseExceptionGroup subgroup9302342
Ref: 1c5f9302342
Ref: library/exceptions BaseExceptionGroup split9303703
Ref: 1b189303703
Ref: library/exceptions BaseExceptionGroup derive9303971
Ref: 1c5e9303971
Node: 例外のクラス階層9307057
Ref: library/exceptions exception-hierarchy9307163
Ref: 292c9307163
Node: Thread Safety Guarantees9310104
Ref: library/threadsafety doc9310259
Ref: 292d9310259
Ref: library/threadsafety thread-safety-guarantees9310259
Ref: 292e9310259
Ref: library/threadsafety threadsafety9310259
Ref: 292f9310259
Ref: library/threadsafety translation-repo9310259
Ref: 29309310259
Node: Thread safety levels9310941
Ref: library/threadsafety thread-safety-levels9311061
Ref: 29329311061
Ref: library/threadsafety threadsafety-levels9311061
Ref: 29339311061
Node: Incompatible9311383
Ref: library/threadsafety incompatible9311471
Ref: 29349311471
Ref: library/threadsafety threadsafety-level-incompatible9311471
Ref: 29359311471
Node: Compatible9311998
Ref: library/threadsafety compatible9312119
Ref: 29369312119
Ref: library/threadsafety threadsafety-level-compatible9312119
Ref: 29379312119
Node: Safe on distinct objects9312675
Ref: library/threadsafety safe-on-distinct-objects9312806
Ref: 293b9312806
Ref: library/threadsafety threadsafety-level-distinct9312806
Ref: 293c9312806
Node: Safe on shared objects9313413
Ref: library/threadsafety safe-on-shared-objects9313540
Ref: 293d9313540
Ref: library/threadsafety threadsafety-level-shared9313540
Ref: 293e9313540
Node: Atomic9314063
Ref: library/threadsafety atomic9314157
Ref: 29429314157
Ref: library/threadsafety threadsafety-level-atomic9314157
Ref: 29439314157
Node: Thread safety for list objects9314522
Ref: library/threadsafety thread-safety-for-list-objects9314681
Ref: 29459314681
Ref: library/threadsafety thread-safety-list9314681
Ref: 282c9314681
Node: Thread safety for dict objects9318079
Ref: library/threadsafety thread-safety-dict9318247
Ref: 28b79318247
Ref: library/threadsafety thread-safety-for-dict-objects9318247
Ref: 29479318247
Node: Thread safety for set objects9322450
Ref: library/threadsafety thread-safety-for-set-objects9322623
Ref: 29489322623
Ref: library/threadsafety thread-safety-set9322623
Ref: 28b49322623
Node: Thread safety for bytearray objects9326431
Ref: library/threadsafety thread-safety-bytearray9326610
Ref: 28719326610
Ref: library/threadsafety thread-safety-for-bytearray-objects9326610
Ref: 29499326610
Node: Thread safety for memoryview objects9329371
Ref: library/threadsafety thread-safety-for-memoryview-objects9329512
Ref: 294a9329512
Ref: library/threadsafety thread-safety-memoryview9329512
Ref: 26259329512
Ref: library/text stringservices9331437
Ref: 28609331437
Node: テキスト処理サービス9331437
Ref: library/text doc9331601
Ref: 294b9331601
Ref: library/text text-processing-services9331601
Ref: 294c9331601
Ref: library/text textservices9331601
Ref: 28629331601
Ref: library/text translation-repo9331601
Ref: 294d9331601
Node: string --- 一般的な文字列操作9332992
Ref: library/string doc9333183
Ref: 294f9333183
Ref: library/string module-string9333183
Ref: db9333183
Ref: library/string string-common-string-operations9333183
Ref: 29509333183
Ref: string --- 一般的な文字列操作-Footnote-19333685
Node: 文字列定数9333761
Ref: library/string string-constants9333884
Ref: 29519333884
Ref: library/string string ascii_letters9334006
Ref: 167d9334006
Ref: library/string string ascii_lowercase9334199
Ref: 29529334199
Ref: library/string string ascii_uppercase9334356
Ref: 29539334356
Ref: library/string string digits9334513
Ref: 29549334513
Ref: library/string string hexdigits9334588
Ref: 29559334588
Ref: library/string string octdigits9334678
Ref: 29569334678
Ref: library/string string punctuation9334754
Ref: 29579334754
Ref: library/string string printable9334971
Ref: 1af79334971
Ref: library/string string whitespace9335440
Ref: 29589335440
Ref: 文字列定数-Footnote-19335798
Node: Custom string formatting9335844
Ref: library/string custom-string-formatting9335996
Ref: 29599335996
Ref: library/string string-formatting9335996
Ref: 285f9335996
Ref: library/string string Formatter9336433
Ref: 126e9336433
Ref: library/string string Formatter format9336548
Ref: fc39336548
Ref: library/string string Formatter vformat9336993
Ref: 295a9336993
Ref: library/string string Formatter parse9337908
Ref: 295b9337908
Ref: library/string string Formatter get_field9338877
Ref: 295c9338877
Ref: library/string string Formatter get_value9339508
Ref: 295d9339508
Ref: library/string string Formatter check_unused_args9340995
Ref: 295e9340995
Ref: library/string string Formatter format_field9341688
Ref: 295f9341688
Ref: library/string string Formatter convert_field9342000
Ref: 29609342000
Ref: Custom string formatting-Footnote-19342410
Ref: Custom string formatting-Footnote-29342452
Node: Format string syntax9342494
Ref: library/string format-string-syntax9342657
Ref: 29619342657
Ref: library/string formatstrings9342657
Ref: 17549342657
Ref: library/string grammar-token-format-string-replacement_field9343606
Ref: 29629343606
Ref: library/string grammar-token-format-string-field_name9343725
Ref: 29639343725
Ref: library/string grammar-token-format-string-arg_name9343843
Ref: 29669343843
Ref: library/string grammar-token-format-string-attribute_name9343915
Ref: 29679343915
Ref: library/string grammar-token-format-string-element_index9343963
Ref: 29689343963
Ref: library/string grammar-token-format-string-index_string9344035
Ref: 29699344035
Ref: library/string grammar-token-format-string-conversion9344095
Ref: 29649344095
Ref: library/string grammar-token-format-string-format_spec9344135
Ref: 29659344135
Ref: library/string formatstrings-conversion9346920
Ref: 296b9346920
Node: Format specification mini-language9348980
Ref: library/string format-specification-mini-language9349095
Ref: 296d9349095
Ref: library/string formatspec9349095
Ref: 7049349095
Ref: library/string grammar-token-format-spec-format_spec9350099
Ref: 296a9350099
Ref: library/string grammar-token-format-spec-options9350205
Ref: 296e9350205
Ref: library/string grammar-token-format-spec-fill9350309
Ref: 29719350309
Ref: library/string grammar-token-format-spec-align9350355
Ref: 29729350355
Ref: library/string grammar-token-format-spec-sign9350407
Ref: 29739350407
Ref: library/string grammar-token-format-spec-width_and_precision9350453
Ref: 296f9350453
Ref: library/string grammar-token-format-spec-width_with_grouping9350556
Ref: 29749350556
Ref: library/string grammar-token-format-spec-precision_with_grouping9350630
Ref: 29759350630
Ref: library/string grammar-token-format-spec-width9350740
Ref: 29769350740
Ref: library/string grammar-token-format-spec-precision9350790
Ref: 29789350790
Ref: library/string grammar-token-format-spec-grouping9350840
Ref: 29779350840
Ref: library/string grammar-token-format-spec-type9350880
Ref: 29709350880
Ref: Format specification mini-language-Footnote-19367063
Ref: Format specification mini-language-Footnote-29367105
Ref: Format specification mini-language-Footnote-39367147
Node: 書式指定例9367189
Ref: library/string format-examples9367304
Ref: 297a9367304
Ref: library/string formatexamples9367304
Ref: 296c9367304
Node: Template strings $-strings9372356
Ref: library/string template-strings-pep2929372513
Ref: 297b9372513
Ref: library/string template-strings-strings9372513
Ref: 297c9372513
Ref: library/string string Template9375070
Ref: a7c9375070
Ref: library/string string Template substitute9375216
Ref: 22e39375216
Ref: library/string string Template safe_substitute9375889
Ref: 22e49375889
Ref: library/string string Template is_valid9377122
Ref: a7b9377122
Ref: library/string string Template get_identifiers9377358
Ref: a7a9377358
Ref: library/string string Template template9377738
Ref: 297e9377738
Ref: Template strings $-strings-Footnote-19382862
Ref: Template strings $-strings-Footnote-29382904
Node: ヘルパー関数9382956
Ref: library/string helper-functions9383084
Ref: 297f9383084
Ref: library/string string capwords9383133
Ref: 28669383133
Node: string templatelib --- テンプレート文字列リテラルのサポート9383762
Ref: library/string templatelib doc9383987
Ref: 29809383987
Ref: library/string templatelib module-string templatelib9383987
Ref: dc9383987
Ref: library/string templatelib string-templatelib-support-for-template-string-literals9383987
Ref: 29819383987
Ref: library/string templatelib translation-repo9383987
Ref: 29829383987
Ref: string templatelib --- テンプレート文字列リテラルのサポート-Footnote-19384567
Ref: string templatelib --- テンプレート文字列リテラルのサポート-Footnote-29384646
Node: テンプレート文字列9384688
Ref: library/string templatelib id19384841
Ref: 29839384841
Ref: library/string templatelib template-strings9384841
Ref: 297d9384841
Node: 型9385552
Ref: library/string templatelib types9385735
Ref: 29849385735
Ref: library/string templatelib string templatelib Template9385759
Ref: 41c9385759
Ref: library/string templatelib string templatelib Template strings9387262
Ref: 29859387262
Ref: library/string templatelib string templatelib Template interpolations9388226
Ref: 29869388226
Ref: library/string templatelib string templatelib Template values9388806
Ref: 29879388806
Ref: library/string templatelib string templatelib Template __new__9389336
Ref: 29889389336
Ref: library/string templatelib string templatelib Interpolation9393163
Ref: 41d9393163
Ref: library/string templatelib string templatelib Interpolation value9394009
Ref: 29899394009
Ref: library/string templatelib string templatelib Interpolation expression9394181
Ref: 298a9394181
Ref: library/string templatelib string templatelib Interpolation conversion9395032
Ref: 286c9395032
Ref: library/string templatelib string templatelib Interpolation format_spec9395797
Ref: 298c9395797
Ref: library/string templatelib string templatelib Interpolation __new__9396708
Ref: 298d9396708
Node: ヘルパー関数<2>9397478
Ref: library/string templatelib helper-functions9397625
Ref: 298e9397625
Ref: library/string templatelib string templatelib convert9397674
Ref: 298b9397674
Node: re --- 正規表現操作9398272
Ref: library/re doc9398495
Ref: 298f9398495
Ref: library/re module-re9398495
Ref: c19398495
Ref: library/re re-regular-expression-operations9398495
Ref: 29909398495
Ref: library/re translation-repo9398495
Ref: 29919398495
Ref: re --- 正規表現操作-Footnote-19401591
Ref: re --- 正規表現操作-Footnote-29401651
Node: Regular expression syntax9401691
Ref: library/re re-syntax9401811
Ref: b119401811
Ref: library/re regular-expression-syntax9401811
Ref: 29929401811
Ref: library/re re-conditional-expression9426436
Ref: 1d459426436
Ref: library/re re-special-sequences9427307
Ref: 299f9427307
Ref: Regular expression syntax-Footnote-19434817
Ref: Regular expression syntax-Footnote-29434859
Node: モジュールの内容9434931
Ref: library/re contents-of-module-re9435086
Ref: 299e9435086
Ref: library/re module-contents9435086
Ref: 29a09435086
Node: フラグ9435567
Ref: library/re flags9435655
Ref: 29a19435655
Ref: library/re re RegexFlag9435862
Ref: a239435862
Ref: library/re re A9436034
Ref: 29979436034
Ref: library/re re ASCII9436054
Ref: a229436054
Ref: library/re re DEBUG9436789
Ref: 29a29436789
Ref: library/re re I9436963
Ref: 29989436963
Ref: library/re re IGNORECASE9436983
Ref: 1cba9436983
Ref: library/re re L9438055
Ref: 29999438055
Ref: library/re re LOCALE9438075
Ref: f2d9438075
Ref: library/re re M9439170
Ref: 299a9439170
Ref: library/re re MULTILINE9439190
Ref: 29969439190
Ref: library/re re NOFLAG9439791
Ref: 29a39439791
Ref: library/re re S9440206
Ref: 299b9440206
Ref: library/re re DOTALL9440226
Ref: 29959440226
Ref: library/re re U9440547
Ref: 299c9440547
Ref: library/re re UNICODE9440567
Ref: f2e9440567
Ref: library/re re X9440868
Ref: 299d9440868
Ref: library/re re VERBOSE9440888
Ref: 29a49440888
Node: 関数<2>9442131
Ref: library/re functions9442237
Ref: 29a59442237
Ref: library/re re compile9442266
Ref: f979442266
Ref: library/re re search9443511
Ref: 15e89443511
Ref: library/re re prefixmatch9444197
Ref: 2569444197
Ref: library/re re match9445379
Ref: 2589445379
Ref: library/re re fullmatch9445920
Ref: 13349445920
Ref: library/re re split9446494
Ref: 7a69446494
Ref: library/re re findall9448991
Ref: 13d69448991
Ref: library/re re finditer9450260
Ref: 18b29450260
Ref: library/re re sub9450995
Ref: 7a79450995
Ref: library/re re subn9455287
Ref: 7a89455287
Ref: library/re re escape9455685
Ref: fcc9455685
Ref: library/re re purge9457312
Ref: 29a89457312
Node: 例外<3>9457398
Ref: library/re exceptions9457486
Ref: 29a99457486
Ref: library/re re PatternError9457515
Ref: 74e9457515
Ref: library/re re PatternError msg9457965
Ref: 11ff9457965
Ref: library/re re PatternError pattern9458071
Ref: 12009458071
Ref: library/re re PatternError pos9458148
Ref: 12019458148
Ref: library/re re PatternError lineno9458312
Ref: 12029458312
Ref: library/re re PatternError colno9458423
Ref: 12039458423
Node: Regular expression objects9458768
Ref: library/re re-objects9458911
Ref: 13369458911
Ref: library/re regular-expression-objects9458911
Ref: 29aa9458911
Ref: library/re re Pattern9458982
Ref: 196e9458982
Ref: library/re re Pattern search9459281
Ref: 29a69459281
Ref: library/re re Pattern prefixmatch9461012
Ref: 2579461012
Ref: library/re re Pattern match9462396
Ref: 2599462396
Ref: library/re re Pattern fullmatch9462937
Ref: 13359462937
Ref: library/re re Pattern split9463810
Ref: 29ab9463810
Ref: library/re re Pattern findall9463975
Ref: 29ac9463975
Ref: library/re re Pattern finditer9464285
Ref: 29ad9464285
Ref: library/re re Pattern sub9464597
Ref: 29ae9464597
Ref: library/re re Pattern subn9464761
Ref: 29af9464761
Ref: library/re re Pattern flags9464927
Ref: 29b09464927
Ref: library/re re Pattern groups9465286
Ref: 29b19465286
Ref: library/re re Pattern groupindex9465384
Ref: 29b29465384
Ref: library/re re Pattern pattern9465681
Ref: 29b39465681
Node: Match objects9466059
Ref: library/re id39466205
Ref: 29b49466205
Ref: library/re match-objects9466205
Ref: 13379466205
Ref: library/re re Match9466573
Ref: 10899466573
Ref: library/re re Match expand9466859
Ref: 29b59466859
Ref: library/re re Match group9467499
Ref: 13d79467499
Ref: library/re re Match __getitem__9469858
Ref: 29b69469858
Ref: library/re re Match groups9470603
Ref: 13d89470603
Ref: library/re re Match groupdict9471569
Ref: 29b79471569
Ref: library/re re Match start9472079
Ref: 29b89472079
Ref: library/re re Match end9472119
Ref: 29b99472119
Ref: library/re re Match span9473418
Ref: 29ba9473418
Ref: library/re re Match pos9473721
Ref: 29bb9473721
Ref: library/re re Match endpos9474007
Ref: 29bc9474007
Ref: library/re re Match lastindex9474290
Ref: 29bd9474290
Ref: library/re re Match lastgroup9474740
Ref: 29be9474740
Ref: library/re re Match re9474974
Ref: 29bf9474974
Ref: library/re re Match string9475198
Ref: 29c09475198
Node: Regular expression examples9475535
Ref: library/re re-examples9475646
Ref: 16179475646
Ref: library/re regular-expression-examples9475646
Ref: 29c19475646
Node: Checking for a pair9476087
Ref: library/re checking-for-a-pair9476212
Ref: 29c29476212
Node: scanf をシミュレートする9478605
Ref: library/re simulating-scanf9478760
Ref: 29c39478760
Node: search vs prefixmatch9480909
Ref: library/re search-vs-match9481065
Ref: 29a79481065
Ref: library/re search-vs-prefixmatch9481065
Ref: 29c49481065
Node: prefixmatch vs match9482566
Ref: library/re id49482707
Ref: 29c59482707
Ref: library/re prefixmatch-vs-match9482707
Ref: 3059482707
Node: Making a phonebook9484088
Ref: library/re making-a-phonebook9484220
Ref: 29c69484220
Node: Text munging9486680
Ref: library/re text-munging9486811
Ref: 29c79486811
Node: Finding all adverbs9487720
Ref: library/re finding-all-adverbs9487872
Ref: 29c89487872
Node: Finding all adverbs and their positions9488388
Ref: library/re finding-all-adverbs-and-their-positions9488547
Ref: 29c99488547
Node: Raw string notation9489271
Ref: library/re raw-string-notation9489430
Ref: 29ca9489430
Node: Writing a tokenizer9490499
Ref: library/re writing-a-tokenizer9490610
Ref: 29cb9490610
Ref: library/re frie099494104
Ref: 29939494104
Ref: Writing a tokenizer-Footnote-19494420
Node: difflib --- 差分の計算の補助9494475
Ref: library/difflib doc9494676
Ref: 29cc9494676
Ref: library/difflib difflib-helpers-for-computing-deltas9494676
Ref: 29cd9494676
Ref: library/difflib module-difflib9494676
Ref: 3a9494676
Ref: library/difflib translation-repo9494676
Ref: 29ce9494676
Ref: library/difflib difflib Differ9497875
Ref: 29cf9497875
Ref: library/difflib difflib HtmlDiff9499201
Ref: 21f9499201
Ref: library/difflib difflib HtmlDiff __init__9499724
Ref: 29d09499724
Ref: library/difflib difflib HtmlDiff make_file9500775
Ref: 11ac9500775
Ref: library/difflib difflib HtmlDiff make_table9502921
Ref: 29d29502921
Ref: library/difflib difflib context_diff9503409
Ref: 1bb69503409
Ref: library/difflib difflib get_close_matches9505781
Ref: 199e9505781
Ref: library/difflib difflib ndiff9507142
Ref: 29d19507142
Ref: library/difflib difflib restore9508900
Ref: 29d69508900
Ref: library/difflib difflib unified_diff9509774
Ref: 21e9509774
Ref: library/difflib difflib diff_bytes9512256
Ref: 11ad9512256
Ref: library/difflib difflib IS_LINE_JUNK9513515
Ref: 5599513515
Ref: library/difflib difflib IS_CHARACTER_JUNK9513891
Ref: 29d59513891
Ref: difflib --- 差分の計算の補助-Footnote-19514661
Ref: difflib --- 差分の計算の補助-Footnote-29514728
Node: SequenceMatcher objects9514808
Ref: library/difflib sequence-matcher9514937
Ref: 29d89514937
Ref: library/difflib sequencematcher-objects9514937
Ref: 29d99514937
Ref: library/difflib difflib SequenceMatcher9515107
Ref: 13c79515107
Ref: library/difflib difflib SequenceMatcher set_seqs9517148
Ref: 29da9517148
Ref: library/difflib difflib SequenceMatcher set_seq19517701
Ref: 29dc9517701
Ref: library/difflib difflib SequenceMatcher set_seq29517889
Ref: 29db9517889
Ref: library/difflib difflib SequenceMatcher find_longest_match9518077
Ref: 1f5e9518077
Ref: library/difflib difflib SequenceMatcher get_matching_blocks9520616
Ref: 29dd9520616
Ref: library/difflib difflib SequenceMatcher get_opcodes9521705
Ref: 29de9521705
Ref: library/difflib difflib SequenceMatcher get_grouped_opcodes9523816
Ref: 29df9523816
Ref: library/difflib difflib SequenceMatcher ratio9524358
Ref: 29e09524358
Ref: library/difflib difflib SequenceMatcher quick_ratio9525629
Ref: 29e19525629
Ref: library/difflib difflib SequenceMatcher real_quick_ratio9525749
Ref: 29e29525749
Node: SequenceMatcher examples9526300
Ref: library/difflib id19526452
Ref: 29e39526452
Ref: library/difflib sequencematcher-examples9526452
Ref: 29e49526452
Ref: SequenceMatcher examples-Footnote-19528218
Node: Differ objects9528295
Ref: library/difflib differ-objects9528438
Ref: 29e59528438
Ref: library/difflib id29528438
Ref: 29e69528438
Ref: library/difflib difflib Differ compare9530397
Ref: 29d79530397
Node: Differ example9531170
Ref: library/difflib differ-example9531345
Ref: 29e79531345
Ref: library/difflib differ-examples9531345
Ref: 29e89531345
Node: difflib のコマンドラインインターフェース9533824
Ref: library/difflib a-command-line-interface-to-difflib9533998
Ref: 29e99533998
Ref: library/difflib difflib-interface9533998
Ref: 29d49533998
Node: ndiff example9536654
Ref: library/difflib ndiff-example9536805
Ref: 29ea9536805
Node: textwrap --- テキストの折り返しと詰め込み9540455
Ref: library/textwrap doc9540673
Ref: 29eb9540673
Ref: library/textwrap module-textwrap9540673
Ref: f59540673
Ref: library/textwrap textwrap-text-wrapping-and-filling9540673
Ref: 29ec9540673
Ref: library/textwrap translation-repo9540673
Ref: 29ed9540673
Ref: library/textwrap textwrap wrap9541219
Ref: 187f9541219
Ref: library/textwrap textwrap fill9542093
Ref: 187e9542093
Ref: library/textwrap textwrap shorten9542802
Ref: 137e9542802
Ref: library/textwrap textwrap dedent9544264
Ref: 5669544264
Ref: library/textwrap textwrap indent9545658
Ref: 7839545658
Ref: library/textwrap textwrap TextWrapper9547287
Ref: 137b9547287
Ref: library/textwrap textwrap TextWrapper width9548129
Ref: 29f49548129
Ref: library/textwrap textwrap TextWrapper expand_tabs9548457
Ref: 29f09548457
Ref: library/textwrap textwrap TextWrapper tabsize9548723
Ref: 29ef9548723
Ref: library/textwrap textwrap TextWrapper replace_whitespace9549025
Ref: 29f29549025
Ref: library/textwrap textwrap TextWrapper drop_whitespace9550030
Ref: 29f19550030
Ref: library/textwrap textwrap TextWrapper initial_indent9550494
Ref: 29f59550494
Ref: library/textwrap textwrap TextWrapper subsequent_indent9550748
Ref: 29f69550748
Ref: library/textwrap textwrap TextWrapper fix_sentence_endings9551041
Ref: 29f79551041
Ref: library/textwrap textwrap TextWrapper break_long_words9552409
Ref: 29f39552409
Ref: library/textwrap textwrap TextWrapper break_on_hyphens9552940
Ref: 29f89552940
Ref: library/textwrap textwrap TextWrapper max_lines9553614
Ref: 137c9553614
Ref: library/textwrap textwrap TextWrapper placeholder9553916
Ref: 137d9553916
Ref: library/textwrap textwrap TextWrapper wrap9554258
Ref: 29ee9554258
Ref: library/textwrap textwrap TextWrapper fill9554725
Ref: 29f99554725
Ref: textwrap --- テキストの折り返しと詰め込み-Footnote-19554956
Node: unicodedata --- Unicode データベース9555024
Ref: library/unicodedata doc9555260
Ref: 29fa9555260
Ref: library/unicodedata module-unicodedata9555260
Ref: 10e9555260
Ref: library/unicodedata translation-repo9555260
Ref: 29fb9555260
Ref: library/unicodedata unicodedata-unicode-database9555260
Ref: 29fc9555260
Ref: library/unicodedata unicodedata lookup9556009
Ref: 142f9556009
Ref: library/unicodedata unicodedata name9556665
Ref: 29fd9556665
Ref: library/unicodedata unicodedata decimal9557061
Ref: 29fe9557061
Ref: library/unicodedata unicodedata digit9557478
Ref: 29ff9557478
Ref: library/unicodedata unicodedata numeric9557792
Ref: 161c9557792
Ref: library/unicodedata unicodedata category9558094
Ref: 2a009558094
Ref: library/unicodedata unicodedata bidirectional9558498
Ref: 19699558498
Ref: library/unicodedata unicodedata combining9558961
Ref: 2a019558961
Ref: library/unicodedata unicodedata east_asian_width9559270
Ref: 2a029559270
Ref: library/unicodedata unicodedata block9559498
Ref: 2a89559498
Ref: library/unicodedata unicodedata mirrored9559706
Ref: 2a039559706
Ref: library/unicodedata unicodedata isxidstart9560036
Ref: 2a29560036
Ref: library/unicodedata unicodedata isxidcontinue9560430
Ref: 2a39560430
Ref: library/unicodedata unicodedata decomposition9560841
Ref: 19679560841
Ref: library/unicodedata unicodedata grapheme_cluster_break9561143
Ref: 2a59561143
Ref: library/unicodedata unicodedata indic_conjunct_break9561314
Ref: 2a69561314
Ref: library/unicodedata unicodedata extended_pictographic9561481
Ref: 2a79561481
Ref: library/unicodedata unicodedata normalize9561679
Ref: ac79561679
Ref: library/unicodedata unicodedata is_normalized9563690
Ref: e0f9563690
Ref: library/unicodedata unicodedata iter_graphemes9563937
Ref: 2a49563937
Ref: library/unicodedata unicodedata unidata_version9564636
Ref: 2a049564636
Ref: library/unicodedata unicodedata ucd_3_2_09564777
Ref: 17ec9564777
Ref: unicodedata --- Unicode データベース-Footnote-19565097
Ref: unicodedata --- Unicode データベース-Footnote-29565147
Ref: unicodedata --- Unicode データベース-Footnote-39565193
Ref: unicodedata --- Unicode データベース-Footnote-49565265
Ref: unicodedata --- Unicode データベース-Footnote-59565340
Ref: unicodedata --- Unicode データベース-Footnote-69565410
Ref: unicodedata --- Unicode データベース-Footnote-79565474
Ref: unicodedata --- Unicode データベース-Footnote-89565554
Ref: unicodedata --- Unicode データベース-Footnote-99565600
Ref: unicodedata --- Unicode データベース-Footnote-109565684
Ref: unicodedata --- Unicode データベース-Footnote-119565731
Ref: unicodedata --- Unicode データベース-Footnote-129565778
Node: stringprep --- インターネットの文字列調製9565825
Ref: library/stringprep doc9566059
Ref: 2a059566059
Ref: library/stringprep module-stringprep9566059
Ref: dd9566059
Ref: library/stringprep stringprep-internet-string-preparation9566059
Ref: 2a069566059
Ref: library/stringprep translation-repo9566059
Ref: 2a079566059
Ref: library/stringprep stringprep in_table_a19568347
Ref: 2a089568347
Ref: library/stringprep stringprep in_table_b19568549
Ref: 2a099568549
Ref: library/stringprep stringprep map_table_b29568746
Ref: 2a0a9568746
Ref: library/stringprep stringprep map_table_b39568942
Ref: 2a0b9568942
Ref: library/stringprep stringprep in_table_c119569139
Ref: 2a0c9569139
Ref: library/stringprep stringprep in_table_c129569279
Ref: 2a0d9569279
Ref: library/stringprep stringprep in_table_c11_c129569429
Ref: 2a0e9569429
Ref: library/stringprep stringprep in_table_c219569608
Ref: 2a0f9569608
Ref: library/stringprep stringprep in_table_c229569742
Ref: 2a109569742
Ref: library/stringprep stringprep in_table_c21_c229569880
Ref: 2a119569880
Ref: library/stringprep stringprep in_table_c39570053
Ref: 2a129570053
Ref: library/stringprep stringprep in_table_c49570190
Ref: 2a139570190
Ref: library/stringprep stringprep in_table_c59570365
Ref: 2a149570365
Ref: library/stringprep stringprep in_table_c69570508
Ref: 2a159570508
Ref: library/stringprep stringprep in_table_c79570663
Ref: 2a169570663
Ref: library/stringprep stringprep in_table_c89570838
Ref: 2a179570838
Ref: library/stringprep stringprep in_table_c99571002
Ref: 2a189571002
Ref: library/stringprep stringprep in_table_d19571127
Ref: 2a199571127
Ref: library/stringprep stringprep in_table_d29571304
Ref: 2a1a9571304
Ref: stringprep --- インターネットの文字列調製-Footnote-19571503
Ref: stringprep --- インターネットの文字列調製-Footnote-29571573
Ref: stringprep --- インターネットの文字列調製-Footnote-39571632
Node: readline --- GNU readline のインターフェース9571691
Ref: library/readline doc9571927
Ref: 2a1b9571927
Ref: library/readline module-readline9571927
Ref: c29571927
Ref: library/readline readline-gnu-readline-interface9571927
Ref: 2a1c9571927
Ref: library/readline translation-repo9571927
Ref: 2a1d9571927
Ref: library/readline readline backend9574491
Ref: 1c4e9574491
Ref: readline --- GNU readline のインターフェース-Footnote-19574858
Node: 初期化ファイル9574943
Ref: library/readline init-file9575078
Ref: 2a1e9575078
Ref: library/readline readline parse_and_bind9575222
Ref: 2a1f9575222
Ref: library/readline readline read_init_file9575404
Ref: 1a009575404
Node: 行バッファ9575878
Ref: library/readline line-buffer9576040
Ref: 2a209576040
Ref: library/readline readline get_line_buffer9576138
Ref: 2a219576138
Ref: library/readline readline insert_text9576290
Ref: 2a229576290
Ref: library/readline readline redisplay9576501
Ref: 187d9576501
Node: 履歴ファイル9576705
Ref: library/readline history-file9576861
Ref: 2a239576861
Ref: library/readline readline read_history_file9576967
Ref: 1a019576967
Ref: library/readline readline write_history_file9577393
Ref: 1a029577393
Ref: library/readline readline append_history_file9577843
Ref: 12059577843
Ref: library/readline readline get_history_length9578441
Ref: 2a249578441
Ref: library/readline readline set_history_length9578487
Ref: 1b609578487
Node: 履歴リスト9578851
Ref: library/readline history-list9579007
Ref: 2a259579007
Ref: library/readline readline clear_history9579123
Ref: 2a269579123
Ref: library/readline readline get_current_history_length9579372
Ref: 187c9579372
Ref: library/readline readline get_history_item9579593
Ref: 187b9579593
Ref: library/readline readline remove_history_item9579804
Ref: 2a279579804
Ref: library/readline readline replace_history_item9580025
Ref: 2a289580025
Ref: library/readline readline add_history9580257
Ref: 2a299580257
Ref: library/readline readline set_auto_history9580442
Ref: 108b9580442
Node: 開始フック9580900
Ref: library/readline startup-hooks9581044
Ref: 2a2a9581044
Ref: library/readline readline set_startup_hook9581088
Ref: 2a2b9581088
Ref: library/readline readline set_pre_input_hook9581493
Ref: 2a2c9581493
Ref: library/readline readline get_pre_input_hook9582066
Ref: 19d49582066
Node: 補完9582354
Ref: library/readline completion9582495
Ref: 2a2d9582495
Ref: library/readline readline-completion9582495
Ref: 2a2e9582495
Ref: library/readline readline set_completer9582966
Ref: 2a2f9582966
Ref: library/readline readline get_completer9583937
Ref: 2a309583937
Ref: library/readline readline get_completion_type9584107
Ref: 2a319584107
Ref: library/readline readline get_begidx9584308
Ref: 1eb99584308
Ref: library/readline readline get_endidx9584346
Ref: 1eba9584346
Ref: library/readline readline set_completer_delims9584792
Ref: 1c519584792
Ref: library/readline readline get_completer_delims9584846
Ref: 2a329584846
Ref: library/readline readline set_completion_display_matches_hook9585168
Ref: 2a339585168
Node: 使用例<2>9585758
Ref: library/readline example9585875
Ref: 2a349585875
Ref: library/readline readline-example9585875
Ref: 2a359585875
Node: rlcompleter --- GNU readline の補完機能9588848
Ref: library/rlcompleter doc9589021
Ref: 2a379589021
Ref: library/rlcompleter module-rlcompleter9589021
Ref: c59589021
Ref: library/rlcompleter rlcompleter-completion-function-for-gnu-readline9589021
Ref: 2a389589021
Ref: library/rlcompleter translation-repo9589021
Ref: 2a399589021
Ref: library/rlcompleter completer-objects9590552
Ref: 2a3b9590552
Ref: library/rlcompleter rlcompleter Completer9590552
Ref: 1f3f9590552
Ref: library/rlcompleter rlcompleter Completer complete9590670
Ref: 2a3a9590670
Ref: rlcompleter --- GNU readline の補完機能-Footnote-19591741
Node: バイナリデータ処理9591812
Ref: library/binary doc9591964
Ref: 2a3c9591964
Ref: library/binary binary-data-services9591964
Ref: 2a3d9591964
Ref: library/binary binaryservices9591964
Ref: 294e9591964
Ref: library/binary translation-repo9591964
Ref: 2a3e9591964
Node: struct --- バイト列をパックされたバイナリデータとして解釈する9593108
Ref: library/struct doc9593317
Ref: 2a3f9593317
Ref: library/struct struct-interpret-bytes-as-packed-binary-data9593317
Ref: 2a409593317
Ref: library/struct module-struct9593485
Ref: de9593485
Ref: struct --- バイト列をパックされたバイナリデータとして解釈する-Footnote-19595311
Node: 関数と例外9595377
Ref: library/struct functions-and-exceptions9595539
Ref: 2a439595539
Ref: library/struct struct error9595658
Ref: 16dd9595658
Ref: library/struct struct pack9595808
Ref: 16309595808
Ref: library/struct struct pack_into9596127
Ref: 19879596127
Ref: library/struct struct unpack9596457
Ref: 1aa29596457
Ref: library/struct struct unpack_from9596935
Ref: 2a449596935
Ref: library/struct struct iter_unpack9597430
Ref: 136d9597430
Ref: library/struct struct calcsize9598082
Ref: 1fb99598082
Node: 書式文字列9598310
Ref: library/struct format-strings9598505
Ref: 2a459598505
Ref: library/struct struct-format-strings9598505
Ref: 2a419598505
Node: バイトオーダ、サイズ、アラインメント9599121
Ref: library/struct byte-order-size-and-alignment9599246
Ref: 2a479599246
Ref: library/struct struct-alignment9599246
Ref: 2a429599246
Ref: library/struct type-codes9603858
Ref: 2a469603858
Ref: バイトオーダ、サイズ、アラインメント-Footnote-19603895
Node: Type Codes9603949
Ref: library/struct format-characters9604095
Ref: 13f69604095
Ref: library/struct id19604095
Ref: 2a499604095
Ref: Type Codes-Footnote-19618467
Ref: Type Codes-Footnote-29618564
Ref: Type Codes-Footnote-39618625
Node: 使用例<3>9618701
Ref: library/struct examples9618784
Ref: 2a4b9618784
Ref: library/struct struct-examples9618784
Ref: 2a489618784
Node: アプリケーション9621401
Ref: library/struct applications9621593
Ref: 2a4c9621593
Ref: library/struct id29621593
Ref: 2a4d9621593
Node: Native Formats9622105
Ref: library/struct native-formats9622205
Ref: 2a509622205
Ref: library/struct struct-native-formats9622205
Ref: 2a4e9622205
Node: Standard Formats9623349
Ref: library/struct standard-formats9623449
Ref: 2a519623449
Ref: library/struct struct-standard-formats9623449
Ref: 2a4f9623449
Node: クラス<3>9624888
Ref: library/struct classes9625056
Ref: 2a529625056
Ref: library/struct struct-objects9625056
Ref: 2a539625056
Ref: library/struct struct Struct9625148
Ref: 3079625148
Ref: library/struct struct Struct pack9626022
Ref: 2a549626022
Ref: library/struct struct Struct pack_into9626282
Ref: 2a569626282
Ref: library/struct struct Struct unpack9626490
Ref: 2a579626490
Ref: library/struct struct Struct unpack_from9626770
Ref: 2a589626770
Ref: library/struct struct Struct iter_unpack9627122
Ref: 136e9627122
Ref: library/struct struct Struct format9627445
Ref: fc99627445
Ref: library/struct struct Struct size9627727
Ref: 2a559627727
Node: codecs --- codec レジストリと基底クラス9628103
Ref: library/codecs doc9628312
Ref: 2a599628312
Ref: library/codecs codecs-codec-registry-and-base-classes9628312
Ref: 2a5a9628312
Ref: library/codecs module-codecs9628312
Ref: 1c9628312
Ref: library/codecs translation-repo9628312
Ref: 2a5b9628312
Ref: library/codecs codecs encode9629497
Ref: 12b59629497
Ref: library/codecs codecs decode9630209
Ref: 12b69630209
Ref: library/codecs codecs charmap_build9630889
Ref: 2a5d9630889
Ref: library/codecs codecs lookup9631417
Ref: d319631417
Ref: library/codecs codecs CodecInfo9632336
Ref: 1c919632336
Ref: library/codecs codecs CodecInfo name9632668
Ref: 2a5e9632668
Ref: library/codecs codecs CodecInfo encode9632748
Ref: 2a5f9632748
Ref: library/codecs codecs CodecInfo decode9632775
Ref: 2a609632775
Ref: library/codecs codecs CodecInfo incrementalencoder9633326
Ref: 2a639633326
Ref: library/codecs codecs CodecInfo incrementaldecoder9633365
Ref: 2a649633365
Ref: library/codecs codecs CodecInfo streamwriter9633866
Ref: 2a679633866
Ref: library/codecs codecs CodecInfo streamreader9633899
Ref: 2a689633899
Ref: library/codecs codecs getencoder9634581
Ref: 2a6b9634581
Ref: library/codecs codecs getdecoder9634862
Ref: 2a6c9634862
Ref: library/codecs codecs getincrementalencoder9635140
Ref: 2a6d9635140
Ref: library/codecs codecs getincrementaldecoder9635574
Ref: 2a6e9635574
Ref: library/codecs codecs getreader9636002
Ref: 2a6f9636002
Ref: library/codecs codecs getwriter9636325
Ref: 2a709636325
Ref: library/codecs codecs register9636786
Ref: 2a719636786
Ref: library/codecs codecs unregister9637166
Ref: bc89637166
Ref: library/codecs codecs open9637789
Ref: 3349637789
Ref: library/codecs codecs EncodedFile9639684
Ref: 2a739639684
Ref: library/codecs codecs iterencode9640865
Ref: 2a749640865
Ref: library/codecs codecs iterdecode9641563
Ref: 2a759641563
Ref: library/codecs codecs readbuffer_encode9642338
Ref: 2a769642338
Ref: library/codecs codecs BOM9642886
Ref: 2a779642886
Ref: library/codecs codecs BOM_BE9642912
Ref: 2a789642912
Ref: library/codecs codecs BOM_LE9642941
Ref: 2a799642941
Ref: library/codecs codecs BOM_UTF89642970
Ref: 2a7a9642970
Ref: library/codecs codecs BOM_UTF169643001
Ref: 2a7b9643001
Ref: library/codecs codecs BOM_UTF16_BE9643033
Ref: 2a7c9643033
Ref: library/codecs codecs BOM_UTF16_LE9643068
Ref: 2a7d9643068
Ref: library/codecs codecs BOM_UTF329643103
Ref: 2a7e9643103
Ref: library/codecs codecs BOM_UTF32_BE9643135
Ref: 2a7f9643135
Ref: library/codecs codecs BOM_UTF32_LE9643170
Ref: 2a809643170
Ref: codecs --- codec レジストリと基底クラス-Footnote-19644649
Node: Codec 基底クラス9644715
Ref: library/codecs codec-base-classes9644867
Ref: 2a5c9644867
Ref: library/codecs id19644867
Ref: 2a819644867
Ref: library/codecs surrogateescape9645659
Ref: 2a829645659
Node: エラーハンドラ9645867
Ref: library/codecs error-handlers9646006
Ref: 1d8b9646006
Ref: library/codecs id29646006
Ref: 2a839646006
Ref: library/codecs codecs register_error9651308
Ref: 18539651308
Ref: library/codecs codecs lookup_error9653204
Ref: 18549653204
Ref: library/codecs codecs strict_errors9653543
Ref: 2a849653543
Ref: library/codecs codecs ignore_errors9653716
Ref: 2a859653716
Ref: library/codecs codecs replace_errors9653913
Ref: 1b029653913
Ref: library/codecs codecs backslashreplace_errors9654164
Ref: 1b039654164
Ref: library/codecs codecs xmlcharrefreplace_errors9654634
Ref: 1b049654634
Ref: library/codecs codecs namereplace_errors9654999
Ref: 2a869654999
Ref: エラーハンドラ-Footnote-19655563
Node: ステートレスなエンコードとデコード9655605
Ref: library/codecs codec-objects9655810
Ref: 2a629655810
Ref: library/codecs stateless-encoding-and-decoding9655810
Ref: 2a879655810
Ref: library/codecs codecs Codec9656140
Ref: 2a889656140
Ref: library/codecs codecs Codec encode9656169
Ref: 19cd9656169
Ref: library/codecs codecs Codec decode9657299
Ref: 2a619657299
Node: インクリメンタルなエンコードとデコード9658877
Ref: library/codecs incremental-encoding-and-decoding9659109
Ref: 2a899659109
Node: IncrementalEncoder オブジェクト9660319
Ref: library/codecs incremental-encoder-objects9660496
Ref: 2a8b9660496
Ref: library/codecs incrementalencoder-objects9660496
Ref: 2a8c9660496
Ref: library/codecs codecs IncrementalEncoder9660931
Ref: 2a659660931
Ref: library/codecs codecs IncrementalEncoder encode9661984
Ref: 19ce9661984
Ref: library/codecs codecs IncrementalEncoder reset9662390
Ref: 2a8d9662390
Ref: library/codecs codecs IncrementalEncoder getstate9662763
Ref: 2a8e9662763
Ref: library/codecs codecs IncrementalEncoder setstate9663239
Ref: 2a8f9663239
Node: IncrementalDecoder オブジェクト9663488
Ref: library/codecs incremental-decoder-objects9663665
Ref: 2a909663665
Ref: library/codecs incrementaldecoder-objects9663665
Ref: 2a919663665
Ref: library/codecs codecs IncrementalDecoder9664094
Ref: 2a669664094
Ref: library/codecs codecs IncrementalDecoder decode9665144
Ref: 2a8a9665144
Ref: library/codecs codecs IncrementalDecoder reset9666017
Ref: 2a929666017
Ref: library/codecs codecs IncrementalDecoder getstate9666116
Ref: 2a939666116
Ref: library/codecs codecs IncrementalDecoder setstate9667249
Ref: 2a949667249
Node: ストリームのエンコードとデコード9667495
Ref: library/codecs stream-encoding-and-decoding9667667
Ref: 2a959667667
Node: StreamWriter オブジェクト9668162
Ref: library/codecs stream-writer-objects9668318
Ref: 2a969668318
Ref: library/codecs streamwriter-objects9668318
Ref: 2a979668318
Ref: library/codecs codecs StreamWriter9668698
Ref: 2a699668698
Ref: library/codecs codecs StreamWriter write9669954
Ref: 2a989669954
Ref: library/codecs codecs StreamWriter writelines9670086
Ref: 2a999670086
Ref: library/codecs codecs StreamWriter reset9670398
Ref: 2a9a9670398
Node: StreamReader オブジェクト9671021
Ref: library/codecs stream-reader-objects9671223
Ref: 2a9b9671223
Ref: library/codecs streamreader-objects9671223
Ref: 2a9c9671223
Ref: library/codecs codecs StreamReader9671603
Ref: 2a6a9671603
Ref: library/codecs codecs StreamReader read9672972
Ref: 2a9d9672972
Ref: library/codecs codecs StreamReader readline9674636
Ref: 2a9e9674636
Ref: library/codecs codecs StreamReader readlines9675061
Ref: 2a9f9675061
Ref: library/codecs codecs StreamReader reset9675574
Ref: 2aa09675574
Node: StreamReaderWriter オブジェクト9676140
Ref: library/codecs stream-reader-writer9676343
Ref: 2aa19676343
Ref: library/codecs streamreaderwriter-objects9676343
Ref: 2aa29676343
Ref: library/codecs codecs StreamReaderWriter9676698
Ref: 2a729676698
Node: StreamRecoder オブジェクト9677574
Ref: library/codecs stream-recoder-objects9677737
Ref: 2aa39677737
Ref: library/codecs streamrecoder-objects9677737
Ref: 2aa49677737
Ref: library/codecs codecs StreamRecoder9678171
Ref: 1fe29678171
Node: エンコーディングと Unicode9679637
Ref: library/codecs encodings-and-unicode9679828
Ref: 2aa59679828
Ref: library/codecs encodings-overview9679828
Ref: 2aa69679828
Ref: エンコーディングと Unicode-Footnote-19688103
Node: 標準エンコーディング9688145
Ref: library/codecs id39688355
Ref: 2aa79688355
Ref: library/codecs standard-encodings9688355
Ref: 11759688355
Ref: 標準エンコーディング-Footnote-19711771
Node: Python 特有のエンコーディング9711849
Ref: library/codecs python-specific-encodings9712055
Ref: 2aa89712055
Node: テキストエンコーディング9713068
Ref: library/codecs text-encodings9713226
Ref: 2aa99713226
Ref: テキストエンコーディング-Footnote-19717288
Ref: テキストエンコーディング-Footnote-29717347
Node: バイナリ変換 Binary Transforms9717406
Ref: library/codecs binary-transforms9717599
Ref: 12b79717599
Ref: library/codecs id49717599
Ref: 2aaa9717599
Ref: バイナリ変換 Binary Transforms-Footnote-19721673
Node: Standalone Codec Functions9721879
Ref: library/codecs id69722070
Ref: 2aae9722070
Ref: library/codecs standalone-codec-functions9722070
Ref: 2aaf9722070
Ref: library/codecs codecs codecs escape_encode9722484
Ref: 2ab09722484
Ref: library/codecs codecs codecs escape_decode9722857
Ref: 2ab19722857
Node: テキスト変換 Text Transforms9723181
Ref: library/codecs id79723327
Ref: 2ab29723327
Ref: library/codecs text-transforms9723327
Ref: 12b89723327
Node: encodings --- Encodings package9724373
Ref: library/codecs encodings-encodings-package9724614
Ref: 2ab39724614
Ref: library/codecs module-encodings9724614
Ref: 549724614
Ref: library/codecs encodings normalize_encoding9724752
Ref: 31b9724752
Ref: library/codecs encodings search_function9725332
Ref: 19509725332
Ref: library/codecs encodings win32_code_page_search_function9726028
Ref: 2ab49726028
Ref: library/codecs encodings CodecRegistryError9726411
Ref: 2ab59726411
Node: encodings idna --- Internationalized Domain Names in Applications9726507
Ref: library/codecs encodings-idna-internationalized-domain-names-in-applications9726748
Ref: 2ab69726748
Ref: library/codecs module-encodings idna9726748
Ref: 559726748
Ref: library/codecs encodings idna nameprep9730050
Ref: 2ab79730050
Ref: library/codecs encodings idna ToASCII9730277
Ref: 2ab89730277
Ref: library/codecs encodings idna ToUnicode9730466
Ref: 2ab99730466
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-19730630
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-29730689
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-39730748
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-49730807
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-59730866
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-69730905
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-79730976
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-89731035
Node: encodings mbcs --- Windows ANSI codepage9731094
Ref: library/codecs encodings-mbcs-windows-ansi-codepage9731358
Ref: 2aba9731358
Ref: library/codecs module-encodings mbcs9731358
Ref: 569731358
Node: encodings utf_8_sig --- UTF-8 codec with BOM signature9731832
Ref: library/codecs encodings-utf-8-sig-utf-8-codec-with-bom-signature9732022
Ref: 2abb9732022
Ref: library/codecs module-encodings utf_8_sig9732022
Ref: 579732022
Node: データ型9732666
Ref: library/datatypes doc9732818
Ref: 2abc9732818
Ref: library/datatypes data-types9732818
Ref: 2abd9732818
Ref: library/datatypes datatypes9732818
Ref: 2abe9732818
Ref: library/datatypes translation-repo9732818
Ref: 2abf9732818
Node: datetime --- 基本的な日付と時間の型9734934
Ref: library/datetime doc9735089
Ref: 2ac09735089
Ref: library/datetime datetime-basic-date-and-time-types9735089
Ref: 2ac19735089
Ref: library/datetime module-datetime9735089
Ref: 339735089
Ref: datetime --- 基本的な日付と時間の型-Footnote-19736608
Ref: datetime --- 基本的な日付と時間の型-Footnote-29736676
Ref: datetime --- 基本的な日付と時間の型-Footnote-39736727
Node: Aware and naive objects9736770
Ref: library/datetime aware-and-naive-objects9736891
Ref: 2ac39736891
Ref: library/datetime datetime-naive-aware9736891
Ref: 2ac49736891
Ref: Aware and naive objects-Footnote-19739395
Node: 定数9739453
Ref: library/datetime constants9739598
Ref: 2ac59739598
Ref: library/datetime datetime MINYEAR9739705
Ref: 2ac69739705
Ref: library/datetime datetime MAXYEAR9739912
Ref: 2ac79739912
Ref: library/datetime datetime UTC9740122
Ref: 9019740122
Node: Available types9740279
Ref: library/datetime available-types9740418
Ref: 2ac89740418
Node: Common properties9742534
Ref: library/datetime common-properties9742654
Ref: 2ad99742654
Node: Determining if an object is aware or naive9743240
Ref: library/datetime determining-if-an-object-is-aware-or-naive9743360
Ref: 2ada9743360
Node: timedelta objects9744392
Ref: library/datetime datetime-timedelta9744537
Ref: 2adb9744537
Ref: library/datetime timedelta-objects9744537
Ref: 2adc9744537
Ref: library/datetime datetime timedelta9744773
Ref: d989744773
Ref: library/datetime datetime timedelta min9747996
Ref: 2add9747996
Ref: library/datetime datetime timedelta max9748144
Ref: 2ade9748144
Ref: library/datetime datetime timedelta resolution9748356
Ref: 2adf9748356
Ref: library/datetime datetime timedelta days9748825
Ref: 2ae09748825
Ref: library/datetime datetime timedelta seconds9748919
Ref: 2ae19748919
Ref: library/datetime datetime timedelta microseconds9749448
Ref: 2ae29749448
Ref: library/datetime datetime timedelta total_seconds9756100
Ref: 16bf9756100
Ref: timedelta objects-Footnote-19756753
Node: Examples of usage timedelta9756833
Ref: library/datetime examples-of-usage-timedelta9756914
Ref: 2ae39756914
Node: date objects9757840
Ref: library/datetime date-objects9757986
Ref: 2ae49757986
Ref: library/datetime datetime-date9757986
Ref: 2ae59757986
Ref: library/datetime datetime date9758326
Ref: 4949758326
Ref: library/datetime datetime date today9758853
Ref: 18829758853
Ref: library/datetime datetime date fromtimestamp9759016
Ref: f969759016
Ref: library/datetime datetime date fromordinal9760347
Ref: f959760347
Ref: library/datetime datetime date fromisoformat9760750
Ref: a0d9760750
Ref: library/datetime datetime date fromisocalendar9761770
Ref: db49761770
Ref: library/datetime datetime date strptime9762056
Ref: 4939762056
Ref: library/datetime datetime date min9763521
Ref: 2ae69763521
Ref: library/datetime datetime date max9763627
Ref: 2ae79763627
Ref: library/datetime datetime date resolution9763738
Ref: 2ae89763738
Ref: library/datetime datetime date year9763930
Ref: 2ac99763930
Ref: library/datetime datetime date month9764058
Ref: 2aca9764058
Ref: library/datetime datetime date day9764144
Ref: 2acb9764144
Ref: library/datetime datetime date replace9767386
Ref: 1c209767386
Ref: library/datetime datetime date timetuple9767873
Ref: 2ae99767873
Ref: library/datetime datetime date toordinal9768376
Ref: 2aea9768376
Ref: library/datetime datetime date weekday9768678
Ref: 2aeb9768678
Ref: library/datetime datetime date isoweekday9768955
Ref: 2aec9768955
Ref: library/datetime datetime date isocalendar9769265
Ref: cc99769265
Ref: library/datetime datetime date isoformat9770513
Ref: 2aed9770513
Ref: library/datetime datetime date __str__9770747
Ref: 2aee9770747
Ref: library/datetime datetime date ctime9770908
Ref: 2aef9770908
Ref: library/datetime datetime date strftime9771472
Ref: 10569771472
Ref: library/datetime datetime date __format__9771823
Ref: 2af19771823
Ref: date objects-Footnote-19772377
Ref: date objects-Footnote-29772776
Node: Examples of usage date9773014
Ref: library/datetime examples-of-usage-date9773085
Ref: 2af29773085
Node: datetime objects9775004
Ref: library/datetime datetime-datetime9775145
Ref: 2af39775145
Ref: library/datetime datetime-objects9775145
Ref: 2af49775145
Ref: library/datetime datetime datetime9775677
Ref: 6ed9775677
Ref: library/datetime datetime datetime today9776665
Ref: 2af59776665
Ref: library/datetime datetime datetime now9777110
Ref: 8ff9777110
Ref: library/datetime datetime datetime utcnow9778194
Ref: 3369778194
Ref: library/datetime datetime datetime fromtimestamp9779267
Ref: 9009779267
Ref: library/datetime datetime datetime utcfromtimestamp9781664
Ref: 3379781664
Ref: library/datetime datetime datetime fromordinal9783976
Ref: 2af69783976
Ref: library/datetime datetime datetime combine9784479
Ref: 10579784479
Ref: library/datetime datetime datetime fromisoformat9785297
Ref: a0f9785297
Ref: library/datetime datetime datetime fromisocalendar9787514
Ref: db59787514
Ref: library/datetime datetime datetime strptime9787911
Ref: 2dd9787911
Ref: library/datetime datetime datetime min9789446
Ref: 1d829789446
Ref: library/datetime datetime datetime max9789595
Ref: 2af79789595
Ref: library/datetime datetime datetime resolution9789769
Ref: 2af89789769
Ref: library/datetime datetime datetime year9789989
Ref: 2ad19789989
Ref: library/datetime datetime datetime month9790121
Ref: 2ad29790121
Ref: library/datetime datetime datetime day9790211
Ref: 2ad39790211
Ref: library/datetime datetime datetime hour9790318
Ref: 2ad49790318
Ref: library/datetime datetime datetime minute9790395
Ref: 2ad59790395
Ref: library/datetime datetime datetime second9790474
Ref: 2ad69790474
Ref: library/datetime datetime datetime microsecond9790553
Ref: 2ad79790553
Ref: library/datetime datetime datetime tzinfo9790642
Ref: 2ad89790642
Ref: library/datetime datetime datetime fold9790871
Ref: 10199790871
Ref: library/datetime datetime datetime date9796296
Ref: 2af99796296
Ref: library/datetime datetime datetime time9796417
Ref: 2afa9796417
Ref: library/datetime datetime datetime timetz9796816
Ref: 2afb9796816
Ref: library/datetime datetime datetime replace9797201
Ref: 18839797201
Ref: library/datetime datetime datetime astimezone9797923
Ref: d999797923
Ref: library/datetime datetime datetime utcoffset9801206
Ref: 2afc9801206
Ref: library/datetime datetime datetime dst9801740
Ref: 2afd9801740
Ref: library/datetime datetime datetime tzname9802262
Ref: 2aff9802262
Ref: library/datetime datetime datetime timetuple9802591
Ref: 2b009802591
Ref: library/datetime datetime datetime utctimetuple9803584
Ref: 2b029803584
Ref: library/datetime datetime datetime toordinal9804872
Ref: 2b039804872
Ref: library/datetime datetime datetime timestamp9805040
Ref: 14569805040
Ref: library/datetime datetime datetime weekday9806937
Ref: 2b049806937
Ref: library/datetime datetime datetime isoweekday9807175
Ref: 2b059807175
Ref: library/datetime datetime datetime isocalendar9807445
Ref: cca9807445
Ref: library/datetime datetime datetime isoformat9807659
Ref: ef39807659
Ref: library/datetime datetime datetime __str__9810954
Ref: 2b069810954
Ref: library/datetime datetime datetime ctime9811103
Ref: 2b079811103
Ref: library/datetime datetime datetime strftime9811829
Ref: 10559811829
Ref: library/datetime datetime datetime __format__9812125
Ref: 2b089812125
Node: Examples of usage datetime9812665
Ref: library/datetime examples-of-usage-datetime9812744
Ref: 2b099812744
Node: time objects9817232
Ref: library/datetime datetime-time9817375
Ref: 2b0a9817375
Ref: library/datetime time-objects9817375
Ref: 2b0b9817375
Ref: library/datetime datetime time9817663
Ref: 4959817663
Ref: library/datetime datetime time min9818490
Ref: 2b0c9818490
Ref: library/datetime datetime time max9818606
Ref: 2b0d9818606
Ref: library/datetime datetime time resolution9818738
Ref: 2b0e9818738
Ref: library/datetime datetime time hour9819071
Ref: 2acc9819071
Ref: library/datetime datetime time minute9819144
Ref: 2acd9819144
Ref: library/datetime datetime time second9819219
Ref: 2ace9819219
Ref: library/datetime datetime time microsecond9819294
Ref: 2acf9819294
Ref: library/datetime datetime time tzinfo9819379
Ref: 2ad09819379
Ref: library/datetime datetime time fold9819600
Ref: 10549819600
Ref: library/datetime datetime time fromisoformat9821417
Ref: a0e9821417
Ref: library/datetime datetime time strptime9823064
Ref: 1a269823064
Ref: library/datetime datetime time replace9823752
Ref: 1c219823752
Ref: library/datetime datetime time isoformat9824394
Ref: 2b0f9824394
Ref: library/datetime datetime time __str__9826729
Ref: 2b119826729
Ref: library/datetime datetime time strftime9826841
Ref: 1d169826841
Ref: library/datetime datetime time __format__9827115
Ref: 2b129827115
Ref: library/datetime datetime time utcoffset9827572
Ref: 2b109827572
Ref: library/datetime datetime time dst9828102
Ref: 2b139828102
Ref: library/datetime datetime time tzname9828620
Ref: 2b149828620
Ref: time objects-Footnote-19829042
Node: Examples of usage time9829107
Ref: library/datetime examples-of-usage-time9829178
Ref: 2b159829178
Node: tzinfo objects9830053
Ref: library/datetime datetime-tzinfo9830196
Ref: 2b169830196
Ref: library/datetime tzinfo-objects9830196
Ref: 2b179830196
Ref: library/datetime datetime tzinfo9830253
Ref: 9dd9830253
Ref: library/datetime datetime tzinfo utcoffset9832204
Ref: 2b189832204
Ref: library/datetime datetime tzinfo dst9833870
Ref: 2b199833870
Ref: library/datetime datetime tzinfo tzname9836879
Ref: 2b1a9836879
Ref: library/datetime datetime tzinfo fromutc9839122
Ref: 2afe9839122
Ref: tzinfo objects-Footnote-19853019
Node: timezone objects9853059
Ref: library/datetime datetime-timezone9853220
Ref: 2b1b9853220
Ref: library/datetime timezone-objects9853220
Ref: 2b1c9853220
Ref: library/datetime datetime timezone9853770
Ref: 147f9853770
Ref: library/datetime datetime timezone utcoffset9854607
Ref: 2b1d9854607
Ref: library/datetime datetime timezone tzname9855068
Ref: 2b1e9855068
Ref: library/datetime datetime timezone dst9855910
Ref: 2b1f9855910
Ref: library/datetime datetime timezone fromutc9855990
Ref: 2b209855990
Ref: library/datetime datetime timezone utc9856273
Ref: a0c9856273
Node: strftime and strptime behavior9856370
Ref: library/datetime strftime-and-strptime-behavior9856508
Ref: 2b219856508
Ref: library/datetime strftime-strptime-behavior9856508
Ref: 1d719856508
Ref: library/datetime format-codes9858434
Ref: 2ac29858434
Node: strftime and strptime format codes9858543
Ref: library/datetime strftime-and-strptime-format-codes9858669
Ref: 2b229858669
Ref: strftime and strptime format codes-Footnote-19873140
Node: Technical detail9873188
Ref: library/datetime technical-detail9873314
Ref: 2b239873314
Node: zoneinfo --- IANA タイムゾーンのサポート9882835
Ref: library/zoneinfo doc9883063
Ref: 2b249883063
Ref: library/zoneinfo module-zoneinfo9883063
Ref: 13d9883063
Ref: library/zoneinfo translation-repo9883063
Ref: 2b259883063
Ref: library/zoneinfo zoneinfo-iana-time-zone-support9883063
Ref: 2b269883063
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-19884504
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-29884569
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-39884611
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-49884652
Node: ZoneInfo を使用する9884693
Ref: library/zoneinfo using-zoneinfo9884832
Ref: 2b279884832
Ref: ZoneInfo を使用する-Footnote-19886843
Node: データソース9886885
Ref: library/zoneinfo data-sources9887051
Ref: 2b289887051
Ref: データソース-Footnote-19887741
Node: Configuring the data sources9887782
Ref: library/zoneinfo configuring-the-data-sources9887865
Ref: 2b299887865
Ref: library/zoneinfo zoneinfo-data-configuration9887865
Ref: 2b2a9887865
Node: Compile-time configuration9888618
Ref: library/zoneinfo compile-time-configuration9888743
Ref: 2b2d9888743
Ref: library/zoneinfo zoneinfo-data-compile-time-config9888743
Ref: 23739888743
Node: Environment configuration9889473
Ref: library/zoneinfo environment-configuration9889628
Ref: 2b2e9889628
Ref: library/zoneinfo zoneinfo-data-environment-var9889628
Ref: 2b2b9889628
Ref: library/zoneinfo envvar-PYTHONTZPATH9889947
Ref: 2b2f9889947
Node: Runtime configuration9890600
Ref: library/zoneinfo runtime-configuration9890720
Ref: 2b319890720
Ref: library/zoneinfo zoneinfo-data-runtime-config9890720
Ref: 2b2c9890720
Node: ZoneInfo クラス9891088
Ref: library/zoneinfo the-zoneinfo-class9891239
Ref: 2b329891239
Ref: library/zoneinfo zoneinfo ZoneInfo9891299
Ref: cb59891299
Ref: library/zoneinfo zoneinfo ZoneInfo from_file9892264
Ref: 199f9892264
Ref: library/zoneinfo zoneinfo ZoneInfo no_cache9893031
Ref: 2b349893031
Ref: library/zoneinfo zoneinfo ZoneInfo clear_cache9893770
Ref: 19559893770
Ref: library/zoneinfo zoneinfo ZoneInfo key9894572
Ref: 2b359894572
Node: 文字列表現9895423
Ref: library/zoneinfo string-representations9895522
Ref: 2b379895522
Node: Pickle serialization9896319
Ref: library/zoneinfo pickle-serialization9896418
Ref: 2b389896418
Ref: library/zoneinfo pickling9896418
Ref: 2b339896418
Node: 関数<3>9898813
Ref: library/zoneinfo functions9898953
Ref: 2b399898953
Ref: library/zoneinfo zoneinfo available_timezones9898984
Ref: 1f5b9898984
Ref: library/zoneinfo zoneinfo reset_tzpath9899974
Ref: 1a1f9899974
Node: Globals9900665
Ref: library/zoneinfo globals9900802
Ref: 2b3a9900802
Ref: library/zoneinfo zoneinfo TZPATH9900837
Ref: 23729900837
Node: 例外と警告9901615
Ref: library/zoneinfo exceptions-and-warnings9901734
Ref: 2b3b9901734
Ref: library/zoneinfo zoneinfo ZoneInfoNotFoundError9901780
Ref: 1a2f9901780
Ref: library/zoneinfo zoneinfo InvalidTZPathWarning9902008
Ref: 2b309902008
Node: calendar --- 一般的なカレンダーに関係する機能群9902182
Ref: library/calendar doc9902404
Ref: 2b3c9902404
Ref: library/calendar calendar-general-calendar-related-functions9902404
Ref: 2b3d9902404
Ref: library/calendar module-calendar9902404
Ref: 159902404
Ref: library/calendar translation-repo9902404
Ref: 2b3e9902404
Ref: library/calendar calendar Calendar9903892
Ref: 2b409903892
Ref: library/calendar calendar Calendar firstweekday9904585
Ref: 2b439904585
Ref: library/calendar calendar Calendar getfirstweekday9904825
Ref: 2b459904825
Ref: library/calendar calendar Calendar setfirstweekday9905014
Ref: 2b449905014
Ref: library/calendar calendar Calendar iterweekdays9905239
Ref: 2b469905239
Ref: library/calendar calendar Calendar itermonthdates9905493
Ref: fdc9905493
Ref: library/calendar calendar Calendar itermonthdays9905923
Ref: 2b479905923
Ref: library/calendar calendar Calendar itermonthdays29906314
Ref: 2b489906314
Ref: library/calendar calendar Calendar itermonthdays39906669
Ref: fdd9906669
Ref: library/calendar calendar Calendar itermonthdays49907057
Ref: fde9907057
Ref: library/calendar calendar Calendar monthdatescalendar9907465
Ref: 2b499907465
Ref: library/calendar calendar Calendar monthdays2calendar9907698
Ref: 2b4a9907698
Ref: library/calendar calendar Calendar monthdayscalendar9907938
Ref: 2b4b9907938
Ref: library/calendar calendar Calendar yeardatescalendar9908141
Ref: 2b4c9908141
Ref: library/calendar calendar Calendar yeardays2calendar9908587
Ref: 2b4d9908587
Ref: library/calendar calendar Calendar yeardayscalendar9908947
Ref: 2b4e9908947
Ref: library/calendar calendar TextCalendar9909256
Ref: 1a5e9909256
Ref: library/calendar calendar TextCalendar prweek9909508
Ref: 2b4f9909508
Ref: library/calendar calendar TextCalendar formatday9909671
Ref: 2b519909671
Ref: library/calendar calendar TextCalendar formatweek9909985
Ref: 2b509909985
Ref: library/calendar calendar TextCalendar formatweekday9910336
Ref: 2b529910336
Ref: library/calendar calendar TextCalendar formatweekheader9910646
Ref: 2b539910646
Ref: library/calendar calendar TextCalendar formatmonth9910926
Ref: 2b549910926
Ref: library/calendar calendar TextCalendar formatmonthname9911401
Ref: 2b559911401
Ref: library/calendar calendar TextCalendar prmonth9911809
Ref: 2b569911809
Ref: library/calendar calendar TextCalendar formatyear9911987
Ref: 2b579911987
Ref: library/calendar calendar TextCalendar pryear9912574
Ref: 2b589912574
Ref: library/calendar calendar HTMLCalendar9912747
Ref: 20d9912747
Ref: library/calendar calendar HTMLCalendar formatmonth9912974
Ref: 2b599912974
Ref: library/calendar calendar HTMLCalendar formatyear9913285
Ref: 2b5a9913285
Ref: library/calendar calendar HTMLCalendar formatyearpage9913556
Ref: 2b5b9913556
Ref: library/calendar calendar HTMLCalendar formatmonthname9914059
Ref: 2b5c9914059
Ref: library/calendar calendar HTMLCalendar cssclasses9914439
Ref: 2b5d9914439
Ref: library/calendar calendar HTMLCalendar cssclass_noday9914853
Ref: 2b5e9914853
Ref: library/calendar calendar HTMLCalendar cssclasses_weekday_head9915014
Ref: 2b5f9915014
Ref: library/calendar calendar HTMLCalendar cssclass_month_head9915229
Ref: 2b609915229
Ref: library/calendar calendar HTMLCalendar cssclass_month9915430
Ref: 2b619915430
Ref: library/calendar calendar HTMLCalendar cssclass_year9915637
Ref: 2b629915637
Ref: library/calendar calendar HTMLCalendar cssclass_year_head9915850
Ref: 2b639915850
Ref: library/calendar calendar LocaleTextCalendar9916759
Ref: b2e9916759
Ref: library/calendar calendar LocaleHTMLCalendar9917004
Ref: b2f9917004
Ref: library/calendar calendar setfirstweekday9917659
Ref: 2b3f9917659
Ref: library/calendar calendar firstweekday9918168
Ref: 2b699918168
Ref: library/calendar calendar isleap9918282
Ref: 2b6a9918282
Ref: library/calendar calendar leapdays9918437
Ref: 2b6b9918437
Ref: library/calendar calendar weekday9918710
Ref: 2b6c9918710
Ref: library/calendar calendar weekheader9918923
Ref: 2b6d9918923
Ref: library/calendar calendar monthrange9919097
Ref: 2b6e9919097
Ref: library/calendar calendar monthcalendar9919267
Ref: 2b6f9919267
Ref: library/calendar calendar prmonth9919573
Ref: 2b709919573
Ref: library/calendar calendar month9919742
Ref: 1b469919742
Ref: library/calendar calendar prcal9919941
Ref: 2b719919941
Ref: library/calendar calendar calendar9920103
Ref: 2b729920103
Ref: library/calendar calendar timegm9920326
Ref: 2b739920326
Ref: library/calendar calendar day_name9920778
Ref: 2b749920778
Ref: library/calendar calendar day_abbr9921082
Ref: 2b759921082
Ref: library/calendar calendar MONDAY9921366
Ref: 2b419921366
Ref: library/calendar calendar TUESDAY9921397
Ref: 2b649921397
Ref: library/calendar calendar WEDNESDAY9921429
Ref: 2b659921429
Ref: library/calendar calendar THURSDAY9921463
Ref: 2b669921463
Ref: library/calendar calendar FRIDAY9921496
Ref: 2b679921496
Ref: library/calendar calendar SATURDAY9921527
Ref: 2b689921527
Ref: library/calendar calendar SUNDAY9921560
Ref: 2b429921560
Ref: library/calendar calendar Day9921725
Ref: 8999921725
Ref: library/calendar calendar month_name9921976
Ref: 2b769921976
Ref: library/calendar calendar month_abbr9922890
Ref: 2b779922890
Ref: library/calendar calendar standalone_month_name9923635
Ref: 1a5f9923635
Ref: library/calendar calendar standalone_month_abbr9923900
Ref: 1a609923900
Ref: library/calendar calendar JANUARY9924177
Ref: 3319924177
Ref: library/calendar calendar FEBRUARY9924209
Ref: 3329924209
Ref: library/calendar calendar MARCH9924242
Ref: 2b789924242
Ref: library/calendar calendar APRIL9924272
Ref: 2b799924272
Ref: library/calendar calendar MAY9924302
Ref: 2b7a9924302
Ref: library/calendar calendar JUNE9924330
Ref: 2b7b9924330
Ref: library/calendar calendar JULY9924359
Ref: 2b7c9924359
Ref: library/calendar calendar AUGUST9924388
Ref: 2b7d9924388
Ref: library/calendar calendar SEPTEMBER9924419
Ref: 2b7e9924419
Ref: library/calendar calendar OCTOBER9924453
Ref: 2b7f9924453
Ref: library/calendar calendar NOVEMBER9924485
Ref: 2b809924485
Ref: library/calendar calendar DECEMBER9924518
Ref: 2b819924518
Ref: library/calendar calendar Month9924691
Ref: 8989924691
Ref: library/calendar calendar IllegalMonthError9925009
Ref: 19369925009
Ref: library/calendar calendar IllegalMonthError month9925392
Ref: 2b829925392
Ref: library/calendar calendar IllegalWeekdayError9925456
Ref: 2b839925456
Ref: library/calendar calendar IllegalWeekdayError weekday9925634
Ref: 2b849925634
Ref: calendar --- 一般的なカレンダーに関係する機能群-Footnote-19926064
Node: コマンドラインでの使用9926132
Ref: library/calendar calendar-cli9926266
Ref: 20c9926266
Ref: library/calendar command-line-usage9926266
Ref: 2b859926266
Ref: library/calendar cmdoption-calendar-help9929035
Ref: 2b869929035
Ref: library/calendar cmdoption-calendar-h9929035
Ref: 2b879929035
Ref: library/calendar cmdoption-calendar-locale9929123
Ref: 2b889929123
Ref: library/calendar cmdoption-calendar-L9929123
Ref: 2b899929123
Ref: library/calendar cmdoption-calendar-encoding9929243
Ref: 2b8a9929243
Ref: library/calendar cmdoption-calendar-e9929243
Ref: 2b8b9929243
Ref: library/calendar cmdoption-calendar-type9929400
Ref: 2b8c9929400
Ref: library/calendar cmdoption-calendar-t9929400
Ref: 2b8d9929400
Ref: library/calendar cmdoption-calendar-first-weekday9929522
Ref: 2b8e9929522
Ref: library/calendar cmdoption-calendar-f9929522
Ref: 2b8f9929522
Ref: library/calendar cmdoption-calendar-arg-year9929724
Ref: 2b909929724
Ref: library/calendar cmdoption-calendar-arg-month9929815
Ref: 2b919929815
Ref: library/calendar cmdoption-calendar-width9930032
Ref: 2b929930032
Ref: library/calendar cmdoption-calendar-w9930032
Ref: 2b939930032
Ref: library/calendar cmdoption-calendar-lines9930230
Ref: 2b949930230
Ref: library/calendar cmdoption-calendar-l9930230
Ref: 2b959930230
Ref: library/calendar cmdoption-calendar-spacing9930421
Ref: 2b969930421
Ref: library/calendar cmdoption-calendar-s9930421
Ref: 2b979930421
Ref: library/calendar cmdoption-calendar-months9930564
Ref: 2b989930564
Ref: library/calendar cmdoption-calendar-m9930564
Ref: 2b999930564
Ref: library/calendar cmdoption-calendar-css9931036
Ref: 2b9a9931036
Ref: library/calendar cmdoption-calendar-c9931036
Ref: 2b9b9931036
Node: collections --- コンテナデータ型9931233
Ref: library/collections doc9931460
Ref: 2b9c9931460
Ref: library/collections collections-container-datatypes9931460
Ref: 2b9d9931460
Ref: library/collections module-collections9931460
Ref: 1e9931460
Ref: library/collections translation-repo9931460
Ref: 2b9e9931460
Ref: collections --- コンテナデータ型-Footnote-19933853
Node: ChainMap オブジェクト9933934
Ref: library/collections chainmap-objects9934073
Ref: 2b9f9934073
Ref: library/collections collections ChainMap9934572
Ref: fdf9934572
Ref: library/collections collections ChainMap maps9935902
Ref: 2ba09935902
Ref: library/collections collections ChainMap new_child9936392
Ref: 12d49936392
Ref: library/collections collections ChainMap parents9937511
Ref: 2ba19937511
Ref: ChainMap オブジェクト-Footnote-19939929
Ref: ChainMap オブジェクト-Footnote-29939971
Ref: ChainMap オブジェクト-Footnote-39940018
Ref: ChainMap オブジェクト-Footnote-49940113
Ref: ChainMap オブジェクト-Footnote-59940192
Ref: ChainMap オブジェクト-Footnote-69940289
Node: ChainMap の例とレシピ9940342
Ref: library/collections chainmap-examples-and-recipes9940433
Ref: 2ba29940433
Node: Counter オブジェクト9943647
Ref: library/collections counter-objects9943819
Ref: 2ba39943819
Ref: library/collections collections Counter9944574
Ref: 20f9944574
Ref: library/collections collections Counter elements9947066
Ref: 16bd9947066
Ref: library/collections collections Counter most_common9947533
Ref: 16bc9947533
Ref: library/collections collections Counter subtract9948054
Ref: 159d9948054
Ref: library/collections collections Counter total9948741
Ref: 2ba49948741
Ref: library/collections collections Counter fromkeys9949101
Ref: 2ba59949101
Ref: library/collections collections Counter update9949273
Ref: 19a09949273
Ref: Counter オブジェクト-Footnote-19955628
Ref: Counter オブジェクト-Footnote-29955707
Ref: Counter オブジェクト-Footnote-39955754
Node: deque オブジェクト9955847
Ref: library/collections deque-objects9956022
Ref: 2ba69956022
Ref: library/collections collections deque9956091
Ref: 9db9956091
Ref: library/collections collections deque append9958048
Ref: 2ba79958048
Ref: library/collections collections deque appendleft9958143
Ref: 2ba89958143
Ref: library/collections collections deque clear9958241
Ref: 2ba99958241
Ref: library/collections collections deque copy9958358
Ref: 118f9958358
Ref: library/collections collections deque count9958480
Ref: 159f9958480
Ref: library/collections collections deque extend9958618
Ref: 2baa9958618
Ref: library/collections collections deque extendleft9958793
Ref: 2bab9958793
Ref: library/collections collections deque index9959084
Ref: 118d9959084
Ref: library/collections collections deque insert9959372
Ref: 118e9959372
Ref: library/collections collections deque pop9959679
Ref: 2bac9959679
Ref: library/collections collections deque popleft9959919
Ref: 2bad9959919
Ref: library/collections collections deque remove9960163
Ref: 1ee49960163
Ref: library/collections collections deque reverse9960371
Ref: 15a09960371
Ref: library/collections collections deque rotate9960531
Ref: 1ea59960531
Ref: library/collections collections deque maxlen9961097
Ref: 16be9961097
Node: deque のレシピ9963926
Ref: library/collections deque-recipes9964005
Ref: 2bae9964005
Ref: deque のレシピ-Footnote-19966851
Node: defaultdict オブジェクト9966912
Ref: library/collections defaultdict-objects9967141
Ref: 2baf9967141
Ref: library/collections collections defaultdict9967222
Ref: 157a9967222
Ref: library/collections collections defaultdict __missing__9968338
Ref: 2bb19968338
Ref: library/collections collections defaultdict default_factory9969920
Ref: 2bb09969920
Ref: defaultdict オブジェクト-Footnote-19970450
Node: defaultdict の使用例9970492
Ref: library/collections defaultdict-examples9970583
Ref: 2bb29970583
Node: namedtuple 名前付きフィールドを持つタプルのファクトリ関数9973475
Ref: library/collections namedtuple-factory-function-for-tuples-with-named-fields9973710
Ref: 2bb39973710
Ref: library/collections collections namedtuple9974264
Ref: 1da9974264
Ref: library/collections collections somenamedtuple _make9979223
Ref: 2bb59979223
Ref: library/collections collections somenamedtuple _asdict9979483
Ref: da99979483
Ref: library/collections collections somenamedtuple _replace9980293
Ref: 2bb69980293
Ref: library/collections collections somenamedtuple _fields9981028
Ref: 2bb79981028
Ref: library/collections collections somenamedtuple _field_defaults9981597
Ref: 2bb49981597
Node: OrderedDict オブジェクト9984932
Ref: library/collections ordereddict-objects9985164
Ref: 2bb89985164
Ref: library/collections collections OrderedDict9988165
Ref: 9da9988165
Ref: library/collections collections OrderedDict popitem9988519
Ref: 16a79988519
Ref: library/collections collections OrderedDict move_to_end9988820
Ref: 159e9988820
Ref: library/collections collections-ordereddict-eq9989692
Ref: 1b7f9989692
Ref: OrderedDict オブジェクト-Footnote-19990744
Ref: OrderedDict オブジェクト-Footnote-29990786
Node: OrderedDict の例とレシピ9990828
Ref: library/collections ordereddict-examples-and-recipes9990925
Ref: 2bba9990925
Node: UserDict オブジェクト9993979
Ref: library/collections userdict-objects9994158
Ref: 2bbb9994158
Ref: library/collections collections UserDict9994640
Ref: 194e9994640
Ref: library/collections collections UserDict data9995244
Ref: 2bbc9995244
Ref: library/collections collections UserDict popitem9995460
Ref: 192d9995460
Node: UserList オブジェクト9995808
Ref: library/collections userlist-objects9995986
Ref: 2bbd9995986
Ref: library/collections collections UserList9996713
Ref: 189c9996713
Ref: library/collections collections UserList data9997466
Ref: 2bbe9997466
Node: UserString オブジェクト9998531
Ref: library/collections userstring-objects9998673
Ref: 2bbf9998673
Ref: library/collections collections UserString9999166
Ref: 11909999166
Ref: library/collections collections UserString data9999858
Ref: 2bc09999858
Node: collections abc --- コンテナの抽象基底クラス10000212
Ref: library/collections abc doc10000421
Ref: 2bc110000421
Ref: library/collections abc collections-abc-abstract-base-classes-for-containers10000421
Ref: 2bc210000421
Ref: library/collections abc module-collections abc10000421
Ref: 1f10000421
Ref: library/collections abc translation-repo10000421
Ref: 2bc310000421
Ref: collections abc --- コンテナの抽象基底クラス-Footnote-110005020
Ref: collections abc --- コンテナの抽象基底クラス-Footnote-210005097
Node: コレクション抽象基底クラス10005139
Ref: library/collections abc collections-abstract-base-classes10005341
Ref: c5210005341
Ref: library/collections abc id110005341
Ref: 2bc410005341
Ref: コレクション抽象基底クラス-Footnote-110015157
Ref: コレクション抽象基底クラス-Footnote-210015690
Ref: コレクション抽象基底クラス-Footnote-310016223
Ref: コレクション抽象基底クラス-Footnote-410016756
Ref: コレクション抽象基底クラス-Footnote-510017232
Ref: コレクション抽象基底クラス-Footnote-610017765
Ref: コレクション抽象基底クラス-Footnote-710018298
Ref: コレクション抽象基底クラス-Footnote-810018831
Ref: コレクション抽象基底クラス-Footnote-910019364
Ref: コレクション抽象基底クラス-Footnote-1010019897
Ref: コレクション抽象基底クラス-Footnote-1110020431
Ref: コレクション抽象基底クラス-Footnote-1210020965
Ref: コレクション抽象基底クラス-Footnote-1310021499
Ref: コレクション抽象基底クラス-Footnote-1410022033
Ref: コレクション抽象基底クラス-Footnote-1510022567
Ref: コレクション抽象基底クラス-Footnote-1610023101
Node: コレクションの抽象基底クラス -- 詳細な説明10023635
Ref: library/collections abc collections-abstract-base-classes-detailed-descriptions10023861
Ref: 2bc610023861
Ref: library/collections abc collections abc Container10023981
Ref: 28c410023981
Ref: library/collections abc collections abc Hashable10024111
Ref: 90710024111
Ref: library/collections abc collections abc Sized10024235
Ref: 90810024235
Ref: library/collections abc collections abc Callable10024356
Ref: bca10024356
Ref: library/collections abc collections abc Iterable10024675
Ref: 28c210024675
Ref: library/collections abc collections abc Collection10025298
Ref: 104b10025298
Ref: library/collections abc collections abc Iterator10025450
Ref: 28c310025450
Ref: library/collections abc collections abc Reversible10025688
Ref: 104c10025688
Ref: library/collections abc collections abc Generator10025867
Ref: 119710025867
Ref: library/collections abc collections abc Sequence10026376
Ref: 158210026376
Ref: library/collections abc collections abc MutableSequence10026416
Ref: 6cc10026416
Ref: library/collections abc collections abc ByteString10026463
Ref: 2d610026463
Ref: library/collections abc collections abc ByteString index10027171
Ref: 2bc810027171
Ref: library/collections abc collections abc Set10028586
Ref: 28b910028586
Ref: library/collections abc collections abc MutableSet10028621
Ref: 28c510028621
Ref: library/collections abc collections abc Mapping10028751
Ref: ca010028751
Ref: library/collections abc collections abc MutableMapping10028790
Ref: 146a10028790
Ref: library/collections abc collections abc MappingView10028965
Ref: 28c610028965
Ref: library/collections abc collections abc ItemsView10029008
Ref: 28c810029008
Ref: library/collections abc collections abc KeysView10029049
Ref: 28c710029049
Ref: library/collections abc collections abc ValuesView10029089
Ref: 28c910029089
Ref: library/collections abc collections abc Awaitable10029222
Ref: 119810029222
Ref: library/collections abc collections abc Coroutine10030067
Ref: 119910030067
Ref: library/collections abc collections abc AsyncIterable10031296
Ref: 119b10031296
Ref: library/collections abc collections abc AsyncIterator10031525
Ref: 119a10031525
Ref: library/collections abc collections abc AsyncGenerator10031780
Ref: 104e10031780
Ref: library/collections abc collections abc Buffer10032186
Ref: 31a10032186
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-110032465
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-210032507
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-310032565
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-410032607
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-510032649
Node: 例とレシピ10032691
Ref: library/collections abc examples-and-recipes10032869
Ref: 2bc910032869
Ref: 例とレシピ-Footnote-110036330
Ref: 例とレシピ-Footnote-210036383
Node: heapq --- ヒープキューアルゴリズム10036425
Ref: library/heapq doc10036638
Ref: 2bca10036638
Ref: library/heapq heapq-heap-queue-algorithm10036638
Ref: 2bcb10036638
Ref: library/heapq module-heapq10036638
Ref: 6c10036638
Ref: library/heapq translation-repo10036638
Ref: 2bcc10036638
Ref: library/heapq heapq heapify10039087
Ref: 2bcd10039087
Ref: library/heapq heapq heappush10039189
Ref: 187410039189
Ref: library/heapq heapq heappop10039319
Ref: 187510039319
Ref: library/heapq heapq heappushpop10039589
Ref: 2bce10039589
Ref: library/heapq heapq heapreplace10039913
Ref: 2bcf10039913
Ref: library/heapq heapq heapify_max10040944
Ref: 4b610040944
Ref: library/heapq heapq heappush_max10041079
Ref: 4b710041079
Ref: library/heapq heapq heappop_max10041251
Ref: 4b810041251
Ref: library/heapq heapq heappushpop_max10041568
Ref: 4ba10041568
Ref: library/heapq heapq heapreplace_max10041887
Ref: 4b910041887
Ref: library/heapq heapq merge10042422
Ref: 11bd10042422
Ref: library/heapq heapq nlargest10043954
Ref: 2bd010043954
Ref: library/heapq heapq nsmallest10044433
Ref: 2bd110044433
Ref: heapq --- ヒープキューアルゴリズム-Footnote-110045457
Node: 基本的な例10045522
Ref: library/heapq basic-examples10045647
Ref: 2bd210045647
Ref: 基本的な例-Footnote-110046724
Node: Other Applications10046818
Ref: library/heapq other-applications10046985
Ref: 2bd310046985
Ref: Other Applications-Footnote-110048245
Ref: Other Applications-Footnote-210048290
Node: 優先度キュー実装の注釈10048345
Ref: library/heapq priority-queue-implementation-notes10048503
Ref: 2bd410048503
Ref: 優先度キュー実装の注釈-Footnote-110051942
Node: 理論10052054
Ref: library/heapq theory10052185
Ref: 2bd510052185
Ref: 理論-Footnote-110057741
Node: bisect --- 配列二分法アルゴリズム10058656
Ref: library/bisect doc10058847
Ref: 2bd610058847
Ref: library/bisect bisect-array-bisection-algorithm10058847
Ref: 2bd710058847
Ref: library/bisect module-bisect10058847
Ref: 1210058847
Ref: library/bisect translation-repo10058847
Ref: 2bd810058847
Ref: library/bisect bisect-functions10060367
Ref: 2bda10060367
Ref: library/bisect bisect bisect_left10060409
Ref: 2bdb10060409
Ref: library/bisect bisect bisect_right10061821
Ref: 2bdc10061821
Ref: library/bisect bisect bisect10061893
Ref: 2bdd10061893
Ref: library/bisect bisect insort_left10062547
Ref: 2bd910062547
Ref: library/bisect bisect insort_right10063243
Ref: 2bde10063243
Ref: library/bisect bisect insort10063315
Ref: 2bdf10063315
Ref: bisect --- 配列二分法アルゴリズム-Footnote-110064273
Node: パフォーマンスに関するメモ10064339
Ref: library/bisect performance-notes10064501
Ref: 2be010064501
Ref: パフォーマンスに関するメモ-Footnote-110066022
Ref: パフォーマンスに関するメモ-Footnote-210066077
Node: ソート済みリストの探索10066147
Ref: library/bisect searching-sorted-lists10066330
Ref: 2be110066330
Node: 使用例<4>10067679
Ref: library/bisect examples10067814
Ref: 2be210067814
Ref: library/bisect bisect-example10067848
Ref: 2be310067848
Node: array --- 効率的な数値配列10070534
Ref: library/array doc10070706
Ref: 2be410070706
Ref: library/array array-efficient-arrays-of-numeric-values10070706
Ref: 2be510070706
Ref: library/array module-array10070706
Ref: 810070706
Ref: library/array translation-repo10070706
Ref: 2be610070706
Ref: library/array array typecodes10077501
Ref: 1e910077501
Ref: library/array array array10077743
Ref: 6cb10077743
Ref: library/array array array typecode10079039
Ref: 2bea10079039
Ref: library/array array array itemsize10079141
Ref: 2be710079141
Ref: library/array array array append10079258
Ref: 2beb10079258
Ref: library/array array array buffer_info10079389
Ref: 2bec10079389
Ref: library/array array array byteswap10080870
Ref: 2bed10080870
Ref: library/array array array count10081358
Ref: 2bee10081358
Ref: library/array array array extend10081468
Ref: 2be910081468
Ref: library/array array array frombytes10082066
Ref: 162b10082066
Ref: library/array array array fromfile10082487
Ref: 167a10082487
Ref: library/array array array fromlist10082939
Ref: 198510082939
Ref: library/array array array fromunicode10083206
Ref: 2be810083206
Ref: library/array array array index10083572
Ref: bc210083572
Ref: library/array array array insert10084048
Ref: 2bef10084048
Ref: library/array array array pop10084264
Ref: 2bf010084264
Ref: library/array array array remove10084565
Ref: 2bf110084565
Ref: library/array array array clear10084673
Ref: 6cd10084673
Ref: library/array array array reverse10084787
Ref: 2bf210084787
Ref: library/array array array tobytes10084882
Ref: 162a10084882
Ref: library/array array array tofile10085239
Ref: 167b10085239
Ref: library/array array array tolist10085404
Ref: 2bf310085404
Ref: library/array array array tounicode10085522
Ref: 2bf410085522
Ref: array --- 効率的な数値配列-Footnote-110086830
Ref: array --- 効率的な数値配列-Footnote-210086891
Ref: array --- 効率的な数値配列-Footnote-310086988
Node: weakref --- Weak references10087015
Ref: library/weakref doc10087198
Ref: 2bf510087198
Ref: library/weakref mod-weakref10087198
Ref: 12be10087198
Ref: library/weakref module-weakref10087198
Ref: 11d10087198
Ref: library/weakref translation-repo10087198
Ref: 2bf610087198
Ref: library/weakref weakref-weak-references10087198
Ref: 2bf710087198
Ref: library/weakref weakref ref10092129
Ref: 139e10092129
Ref: library/weakref weakref ref __callback__10094309
Ref: 139f10094309
Ref: library/weakref weakref proxy10094753
Ref: e1910094753
Ref: library/weakref weakref getweakrefcount10096164
Ref: 2bf910096164
Ref: library/weakref weakref getweakrefs10096292
Ref: 2bfa10096292
Ref: library/weakref weakref WeakKeyDictionary10096458
Ref: 1b6310096458
Ref: library/weakref weakref WeakKeyDictionary keyrefs10098596
Ref: 2bfb10098596
Ref: library/weakref weakref WeakValueDictionary10098727
Ref: 1b6410098727
Ref: library/weakref weakref WeakValueDictionary valuerefs10099249
Ref: 2bfc10099249
Ref: library/weakref weakref WeakSet10099381
Ref: 9dc10099381
Ref: library/weakref weakref WeakMethod10099568
Ref: 139d10099568
Ref: library/weakref weakref finalize10100752
Ref: e4210100752
Ref: library/weakref weakref finalize __call__10102465
Ref: 2bfd10102465
Ref: library/weakref weakref finalize detach10102682
Ref: 2bfe10102682
Ref: library/weakref weakref finalize peek10102889
Ref: 2bff10102889
Ref: library/weakref weakref finalize alive10103064
Ref: 2c0010103064
Ref: library/weakref weakref finalize atexit10103228
Ref: 2c0110103228
Ref: library/weakref weakref ReferenceType10103831
Ref: 1d7a10103831
Ref: library/weakref weakref ProxyType10103939
Ref: 1d7b10103939
Ref: library/weakref weakref CallableProxyType10104076
Ref: 1d7c10104076
Ref: library/weakref weakref ProxyTypes10104215
Ref: 2c0210104215
Ref: weakref --- Weak references-Footnote-110104963
Ref: weakref --- Weak references-Footnote-210105030
Ref: weakref --- Weak references-Footnote-310105072
Ref: weakref --- Weak references-Footnote-410105114
Node: 弱参照オブジェクト10105156
Ref: library/weakref weak-reference-objects10105268
Ref: 2c0310105268
Ref: library/weakref weakref-objects10105268
Ref: 2c0410105268
Node: 使用例<5>10108399
Ref: library/weakref example10108559
Ref: 2c0510108559
Ref: library/weakref weakref-example10108559
Ref: 2c0610108559
Node: ファイナライザオブジェクト10109234
Ref: library/weakref finalize-examples10109408
Ref: 2c0710109408
Ref: library/weakref finalizer-objects10109408
Ref: 2c0810109408
Node: Comparing finalizers with __del__ methods10111355
Ref: library/weakref comparing-finalizers-with-del-methods10111508
Ref: 2c0910111508
Node: types --- 動的な型生成と組み込み型の名前10114464
Ref: library/types doc10114667
Ref: 2c0a10114667
Ref: library/types module-types10114667
Ref: 10c10114667
Ref: library/types translation-repo10114667
Ref: 2c0b10114667
Ref: library/types types-dynamic-type-creation-and-names-for-built-in-types10114667
Ref: 2c0c10114667
Ref: types --- 動的な型生成と組み込み型の名前-Footnote-110115648
Node: 動的な型生成10115713
Ref: library/types dynamic-type-creation10115865
Ref: 2c0d10115865
Ref: library/types types new_class10115916
Ref: 152110115916
Ref: library/types types prepare_class10116740
Ref: 152210116740
Ref: library/types types resolve_bases10118080
Ref: f5f10118080
Ref: library/types types get_original_bases10118639
Ref: 8e310118639
Ref: 動的な型生成-Footnote-110120234
Ref: 動的な型生成-Footnote-210120276
Ref: 動的な型生成-Footnote-310120318
Ref: 動的な型生成-Footnote-410120360
Node: 標準的なインタプリタ型10120402
Ref: library/types standard-interpreter-types10120611
Ref: 2c0e10120611
Ref: library/types types NoneType10121394
Ref: c2e10121394
Ref: library/types types FunctionType10121493
Ref: c5d10121493
Ref: library/types types LambdaType10121527
Ref: 2c0f10121527
Ref: library/types types GeneratorType10121978
Ref: 1bd410121978
Ref: library/types types CoroutineType10122159
Ref: 123d10122159
Ref: library/types types AsyncGeneratorType10122338
Ref: 2c1010122338
Ref: library/types types CodeType10122569
Ref: 2ed10122569
Ref: library/types types CellType10123190
Ref: 2c1110123190
Ref: library/types types MethodType10123371
Ref: 1d9e10123371
Ref: library/types types BuiltinFunctionType10123492
Ref: 2c1210123492
Ref: library/types types BuiltinMethodType10123533
Ref: 2c1310123533
Ref: library/types types WrapperDescriptorType10123822
Ref: f5c10123822
Ref: library/types types MethodWrapperType10124045
Ref: a3f10124045
Ref: library/types types NotImplementedType10124253
Ref: c2f10124253
Ref: library/types types MethodDescriptorType10124372
Ref: f5d10124372
Ref: library/types types ClassMethodDescriptorType10124534
Ref: f5e10124534
Ref: library/types types ModuleType10124726
Ref: 11cb10124726
Ref: library/types types EllipsisType10125533
Ref: c2d10125533
Ref: library/types types GenericAlias10125641
Ref: bcb10125641
Ref: library/types types UnionType10126599
Ref: 52e10126599
Ref: library/types types TracebackType10126806
Ref: ebc10126806
Ref: library/types types FrameType10127170
Ref: 1e0510127170
Ref: library/types types FrameLocalsProxyType10127328
Ref: 29710127328
Ref: library/types types LazyImportType10127545
Ref: 18810127545
Ref: library/types types GetSetDescriptorType10127900
Ref: 2c1410127900
Ref: library/types types MemberDescriptorType10128272
Ref: 2c1510128272
Ref: library/types types MappingProxyType10129163
Ref: 19410129163
Ref: library/types types MappingProxyType copy10130481
Ref: 2c1610130481
Ref: library/types types MappingProxyType get10130591
Ref: 2c1710130591
Ref: library/types types MappingProxyType items10131045
Ref: 2c1810131045
Ref: library/types types MappingProxyType keys10131223
Ref: 2c1910131223
Ref: library/types types MappingProxyType values10131354
Ref: 2c1a10131354
Ref: library/types types CapsuleType10131764
Ref: 2c1b10131764
Ref: 標準的なインタプリタ型-Footnote-110131910
Ref: 標準的なインタプリタ型-Footnote-210131952
Ref: 標準的なインタプリタ型-Footnote-310131994
Ref: 標準的なインタプリタ型-Footnote-410132036
Node: 追加のユーティリティクラスと関数10132078
Ref: library/types additional-utility-classes-and-functions10132311
Ref: 2c1d10132311
Ref: library/types types SimpleNamespace10132412
Ref: 6f010132412
Ref: library/types types DynamicClassAttribute10134578
Ref: a2010134578
Node: コルーチンユーティリティ関数10135440
Ref: library/types coroutine-utility-functions10135631
Ref: 2c1e10135631
Ref: library/types types coroutine10135722
Ref: 123c10135722
Node: copy --- 浅いコピーおよび深いコピー操作10136825
Ref: library/copy doc10137036
Ref: 2c1f10137036
Ref: library/copy copy-shallow-and-deep-copy-operations10137036
Ref: 2c2010137036
Ref: library/copy module-copy10137036
Ref: 2910137036
Ref: library/copy translation-repo10137036
Ref: 2c2110137036
Ref: library/copy copy copy10137889
Ref: 94710137889
Ref: library/copy copy deepcopy10137981
Ref: f2f10137981
Ref: library/copy copy replace10138082
Ref: 46110138082
Ref: library/copy copy Error10138264
Ref: 2c2210138264
Ref: library/copy shallow-vs-deep-copy10138348
Ref: 21f010138348
Ref: library/copy object __copy__10141001
Ref: 1a6c10141001
Ref: library/copy object __deepcopy__10141138
Ref: 192a10141138
Ref: library/copy object __replace__10141848
Ref: 69210141848
Ref: copy --- 浅いコピーおよび深いコピー操作-Footnote-110142287
Node: pprint --- データの整形表示10142351
Ref: library/pprint doc10142549
Ref: 2c2310142549
Ref: library/pprint module-pprint10142549
Ref: b310142549
Ref: library/pprint pprint-data-pretty-printer10142549
Ref: 2c2410142549
Ref: library/pprint translation-repo10142549
Ref: 2c2510142549
Ref: pprint --- データの整形表示-Footnote-110143765
Node: 関数<4>10143831
Ref: library/pprint functions10143942
Ref: 2c2610143942
Ref: library/pprint pprint-functions10143942
Ref: 2c2710143942
Ref: library/pprint pprint pp10143973
Ref: deb10143973
Ref: library/pprint pprint pprint10146864
Ref: c0510146864
Ref: library/pprint pprint pformat10147252
Ref: 132f10147252
Ref: library/pprint pprint isreadable10147705
Ref: 2c2810147705
Ref: library/pprint pprint isrecursive10148054
Ref: 2c2910148054
Ref: library/pprint pprint saferepr10148357
Ref: 2c2a10148357
Node: PrettyPrinter objects10149006
Ref: library/pprint id110149138
Ref: 2c2b10149138
Ref: library/pprint prettyprinter-objects10149138
Ref: 2c2c10149138
Ref: library/pprint pprint PrettyPrinter10149201
Ref: 132e10149201
Ref: library/pprint pprint PrettyPrinter pformat10151680
Ref: 2c2d10151680
Ref: library/pprint pprint PrettyPrinter pprint10151929
Ref: 2c2e10151929
Ref: library/pprint pprint PrettyPrinter isreadable10152382
Ref: 2c2f10152382
Ref: library/pprint pprint PrettyPrinter isrecursive10152899
Ref: 2c3010152899
Ref: library/pprint pprint PrettyPrinter format10153291
Ref: 1efb10153291
Node: 使用例<6>10154669
Ref: library/pprint example10154783
Ref: 2c3110154783
Ref: library/pprint pprint-example10154783
Ref: 2c3210154783
Ref: 使用例<6>-Footnote-110161627
Node: reprlib --- もう一つの repr の実装10161652
Ref: library/reprlib doc10161829
Ref: 2c3310161829
Ref: library/reprlib module-reprlib10161829
Ref: c310161829
Ref: library/reprlib reprlib-alternate-repr-implementation10161829
Ref: 2c3410161829
Ref: library/reprlib translation-repo10161829
Ref: 2c3510161829
Ref: library/reprlib reprlib Repr10162438
Ref: 2c3610162438
Ref: library/reprlib reprlib aRepr10163494
Ref: 2c3810163494
Ref: library/reprlib reprlib repr10163827
Ref: 2c3910163827
Ref: library/reprlib reprlib recursive_repr10164260
Ref: 15b210164260
Ref: reprlib --- もう一つの repr の実装-Footnote-110165094
Node: Reprオブジェクト10165161
Ref: library/reprlib id110165320
Ref: 2c3710165320
Ref: library/reprlib repr-objects10165320
Ref: 2c3b10165320
Ref: library/reprlib reprlib Repr fillvalue10165632
Ref: 2c3c10165632
Ref: library/reprlib reprlib Repr maxlevel10165781
Ref: 2c3d10165781
Ref: library/reprlib reprlib Repr maxdict10165905
Ref: 2c3e10165905
Ref: library/reprlib reprlib Repr maxlist10165933
Ref: 2c3f10165933
Ref: library/reprlib reprlib Repr maxtuple10165961
Ref: 2c4010165961
Ref: library/reprlib reprlib Repr maxset10165990
Ref: 2c4110165990
Ref: library/reprlib reprlib Repr maxfrozenset10166017
Ref: 2c4210166017
Ref: library/reprlib reprlib Repr maxdeque10166050
Ref: 2c4310166050
Ref: library/reprlib reprlib Repr maxarray10166079
Ref: 2c4410166079
Ref: library/reprlib reprlib Repr maxlong10166369
Ref: 2c4510166369
Ref: library/reprlib reprlib Repr maxstring10166538
Ref: 2c4610166538
Ref: library/reprlib reprlib Repr maxother10166960
Ref: 2c4710166960
Ref: library/reprlib reprlib Repr indent10167332
Ref: 2c4810167332
Ref: library/reprlib reprlib Repr repr10168813
Ref: 2c3a10168813
Ref: library/reprlib reprlib Repr repr110168985
Ref: 2c4910168985
Node: Reprオブジェクトをサブクラス化する10170048
Ref: library/reprlib subclassing-repr-objects10170207
Ref: 2c4a10170207
Ref: library/reprlib subclassing-reprs10170207
Ref: 2c4b10170207
Node: enum --- 列挙型のサポート10170939
Ref: library/enum doc10171130
Ref: 2c4c10171130
Ref: library/enum enum-support-for-enumerations10171130
Ref: 2c4d10171130
Ref: library/enum module-enum10171130
Ref: 5910171130
Ref: library/enum translation-repo10171130
Ref: 2c4e10171130
Ref: enum --- 列挙型のサポート-Footnote-110173353
Node: モジュールの内容<2>10173417
Ref: library/enum module-contents10173538
Ref: 2c5310173538
Node: データ型<2>10177710
Ref: library/enum data-types10177864
Ref: 2c5610177864
Ref: library/enum enum EnumType10177905
Ref: 70210177905
Ref: library/enum enum EnumType __call__10178605
Ref: 2c5810178605
Ref: library/enum enum EnumType __contains__10179918
Ref: 2c5910179918
Ref: library/enum enum EnumType __dir__10180404
Ref: 2c5a10180404
Ref: library/enum enum EnumType __getitem__10180807
Ref: 2c5b10180807
Ref: library/enum enum EnumType __iter__10181034
Ref: 2c5c10181034
Ref: library/enum enum EnumType __len__10181233
Ref: 2c5d10181233
Ref: library/enum enum EnumType __members__10181370
Ref: 2c5e10181370
Ref: library/enum enum EnumType __reversed__10181494
Ref: 2c5f10181494
Ref: library/enum enum Enum10181723
Ref: a2610181723
Ref: library/enum enum Enum name10181819
Ref: 2c6010181819
Ref: library/enum enum Enum value10181984
Ref: 2c6110181984
Ref: library/enum enum Enum _name_10182926
Ref: 2c6310182926
Ref: library/enum enum Enum _value_10182985
Ref: 2c6410182985
Ref: library/enum enum Enum _order_10183083
Ref: 2c6510183083
Ref: library/enum enum Enum _ignore_10184095
Ref: 2c6610184095
Ref: library/enum enum Enum __dir__10184512
Ref: 1e1a10184512
Ref: library/enum enum Enum _generate_next_value_10185387
Ref: 2c6810185387
Ref: library/enum enum Enum __init__10186911
Ref: 2c6910186911
Ref: library/enum enum Enum __init_subclass__10187420
Ref: 2c6a10187420
Ref: library/enum enum Enum _missing_10187628
Ref: 2c6b10187628
Ref: library/enum enum Enum __new__10188623
Ref: 2c6210188623
Ref: library/enum enum Enum __repr__10189354
Ref: 1d1810189354
Ref: library/enum enum Enum __str__10190217
Ref: a1810190217
Ref: library/enum enum Enum __format__10190984
Ref: a1610190984
Ref: library/enum enum Enum _add_alias_10192056
Ref: 2c6c10192056
Ref: library/enum enum Enum _add_value_alias_10192410
Ref: 2c6d10192410
Ref: library/enum enum IntEnum10192830
Ref: 10a110192830
Ref: library/enum enum StrEnum10193997
Ref: a1210193997
Ref: library/enum enum Flag10195504
Ref: a1910195504
Ref: library/enum enum Flag __contains__10195791
Ref: 2c6f10195791
Ref: library/enum enum Flag __or__10197371
Ref: 2c7010197371
Ref: library/enum enum Flag __and__10197590
Ref: 2c7110197590
Ref: library/enum enum Flag __xor__10197866
Ref: 2c7210197866
Ref: library/enum enum Flag _numeric_repr_10198457
Ref: 2c7310198457
Ref: library/enum enum IntFlag10198983
Ref: 106110198983
Ref: library/enum enum ReprEnum10200751
Ref: a1310200751
Ref: library/enum enum EnumCheck10201320
Ref: a1c10201320
Ref: library/enum enum EnumCheck UNIQUE10201599
Ref: 2c7410201599
Ref: library/enum enum EnumCheck CONTINUOUS10202122
Ref: 2c7510202122
Ref: library/enum enum EnumCheck NAMED_FLAGS10202653
Ref: 2c7610202653
Ref: library/enum enum FlagBoundary10203633
Ref: a1a10203633
Ref: library/enum enum FlagBoundary STRICT10203782
Ref: 2c7710203782
Ref: library/enum enum FlagBoundary CONFORM10204439
Ref: 2c7810204439
Ref: library/enum enum FlagBoundary EJECT10204908
Ref: 2c7910204908
Ref: library/enum enum FlagBoundary KEEP10205348
Ref: 2c7a10205348
Ref: library/enum enum EnumDict10205875
Ref: 70110205875
Ref: library/enum enum EnumDict member_names10206606
Ref: 2c7b10206606
Node: __dunder__ 名のサポート10206848
Ref: library/enum enum-dunder-sunder10206965
Ref: 2c7c10206965
Ref: library/enum supported-dunder-names10206965
Ref: 2c7d10206965
Node: _sunder_ 名のサポート10207454
Ref: library/enum supported-sunder-names10207571
Ref: 2c7e10207571
Ref: _sunder_ 名のサポート-Footnote-110209241
Node: Utilities and decorators10209328
Ref: library/enum ipython-s-rich-display10209461
Ref: 2c7f10209461
Ref: library/enum utilities-and-decorators10209461
Ref: 2c8010209461
Ref: library/enum enum auto10209530
Ref: 106210209530
Ref: library/enum enum property10211279
Ref: a1f10211279
Ref: library/enum enum unique10211803
Ref: 2c5510211803
Ref: library/enum enum verify10212455
Ref: a1b10212455
Ref: library/enum enum member10212731
Ref: a1d10212731
Ref: library/enum enum nonmember10212889
Ref: a1e10212889
Ref: library/enum enum global_enum10213053
Ref: a2110213053
Ref: library/enum enum show_flag_values10213423
Ref: 19eb10213423
Ref: library/enum enum bin10213599
Ref: 19a810213599
Node: 注釈10214080
Ref: library/enum notes10214189
Ref: 2c5410214189
Node: graphlib --- グラフ構造を操作する機能10215284
Ref: library/graphlib doc10215424
Ref: 2c8110215424
Ref: library/graphlib graphlib-functionality-to-operate-with-graph-like-structures10215424
Ref: 2c8210215424
Ref: library/graphlib module-graphlib10215424
Ref: 6810215424
Ref: library/graphlib translation-repo10215424
Ref: 2c8310215424
Ref: library/graphlib graphlib TopologicalSorter10215643
Ref: cb710215643
Ref: library/graphlib graphlib TopologicalSorter add10219408
Ref: 2c8410219408
Ref: library/graphlib graphlib TopologicalSorter prepare10220330
Ref: 4b410220330
Ref: library/graphlib graphlib TopologicalSorter is_active10221164
Ref: 2c8510221164
Ref: library/graphlib graphlib TopologicalSorter done10222102
Ref: 2c8710222102
Ref: library/graphlib graphlib TopologicalSorter get_ready10222787
Ref: 2c8610222787
Ref: library/graphlib graphlib TopologicalSorter static_order10223391
Ref: 2c8810223391
Ref: graphlib --- グラフ構造を操作する機能-Footnote-110224922
Node: 例外<4>10224990
Ref: library/graphlib exceptions10225085
Ref: 2c8a10225085
Ref: library/graphlib graphlib CycleError10225184
Ref: 2c8910225184
Node: 数値と数学モジュール10225853
Ref: library/numeric doc10226026
Ref: 2c8b10226026
Ref: library/numeric numeric10226026
Ref: 2c8c10226026
Ref: library/numeric numeric-and-mathematical-modules10226026
Ref: 2c8d10226026
Ref: library/numeric translation-repo10226026
Ref: 2c8e10226026
Node: numbers --- 数の抽象基底クラス10227321
Ref: library/numbers doc10227457
Ref: 2c8f10227457
Ref: library/numbers module-numbers10227457
Ref: a210227457
Ref: library/numbers numbers-numeric-abstract-base-classes10227457
Ref: 2c9010227457
Ref: library/numbers numbers Number10227883
Ref: 2c9110227883
Ref: numbers --- 数の抽象基底クラス-Footnote-110228190
Ref: numbers --- 数の抽象基底クラス-Footnote-210228257
Node: 数値塔10228299
Ref: library/numbers the-numeric-tower10228420
Ref: 2c9210228420
Ref: library/numbers numbers Complex10228456
Ref: 281410228456
Ref: library/numbers numbers Complex real10228980
Ref: 2c9310228980
Ref: library/numbers numbers Complex imag10229084
Ref: 2c9410229084
Ref: library/numbers numbers Complex conjugate10229188
Ref: 2c9510229188
Ref: library/numbers numbers Real10229376
Ref: 280a10229376
Ref: library/numbers numbers Rational10229936
Ref: 167810229936
Ref: library/numbers numbers Rational numerator10230382
Ref: 2c9610230382
Ref: library/numbers numbers Rational denominator10230474
Ref: 2c9710230474
Ref: library/numbers numbers Integral10230570
Ref: 261e10230570
Node: Notes for type implementers10231038
Ref: library/numbers notes-for-type-implementers10231159
Ref: 2c9810231159
Node: さらに数のABCを追加する10232003
Ref: library/numbers adding-more-numeric-abcs10232130
Ref: 2c9910232130
Node: 算術演算の実装10232640
Ref: library/numbers id110232767
Ref: 2c9a10232767
Ref: library/numbers implementing-the-arithmetic-operations10232767
Ref: 254110232767
Node: math --- 数学関数10237707
Ref: library/math doc10237907
Ref: 2c9b10237907
Ref: library/math math-mathematical-functions10237907
Ref: 2c9c10237907
Ref: library/math module-math10237907
Ref: 9110237907
Ref: library/math translation-repo10237907
Ref: 2c9d10237907
Ref: math --- 数学関数-Footnote-110252268
Ref: math --- 数学関数-Footnote-210252321
Ref: math --- 数学関数-Footnote-310252374
Ref: math --- 数学関数-Footnote-410252427
Node: Floating point arithmetic10252480
Ref: library/math floating-point-arithmetic10252609
Ref: 2cae10252609
Ref: library/math math ceil10252680
Ref: 177710252680
Ref: library/math math fabs10252943
Ref: 2c9e10252943
Ref: library/math math floor10253014
Ref: 177610253014
Ref: library/math math fma10253276
Ref: 71e10253276
Ref: library/math math fmax10253961
Ref: 24210253961
Ref: library/math math fmin10254425
Ref: 24310254425
Ref: library/math math fmod10254890
Ref: 26de10254890
Ref: library/math math modf10255922
Ref: 2c9f10255922
Ref: library/math math remainder10256386
Ref: f1410256386
Ref: library/math math trunc10257551
Ref: 177810257551
Node: Floating point manipulation functions10258528
Ref: library/math floating-point-manipulation-functions10258709
Ref: 2caf10258709
Ref: library/math math copysign10258804
Ref: 178c10258804
Ref: library/math math frexp10259086
Ref: 2ca010259086
Ref: library/math math isclose10259829
Ref: 116d10259829
Ref: library/math math isfinite10261460
Ref: 15aa10261460
Ref: library/math math isnormal10261719
Ref: 24010261719
Ref: library/math math issubnormal10261962
Ref: 24110261962
Ref: library/math math isinf10262217
Ref: 178a10262217
Ref: library/math math isnan10262388
Ref: 178b10262388
Ref: library/math math ldexp10262564
Ref: 1a5d10262564
Ref: library/math math nextafter10262710
Ref: 8ae10262710
Ref: library/math math signbit10263426
Ref: 24410263426
Ref: library/math math ulp10263651
Ref: ce510263651
Ref: Floating point manipulation functions-Footnote-110264894
Node: Power exponential and logarithmic functions10264936
Ref: library/math power-exponential-and-logarithmic-functions10265123
Ref: 2cb110265123
Ref: library/math math cbrt10265232
Ref: a5610265232
Ref: library/math math exp10265332
Ref: 16cd10265332
Ref: library/math math exp210265567
Ref: a5510265567
Ref: library/math math expm110265666
Ref: 15ab10265666
Ref: library/math math log10266276
Ref: 187810266276
Ref: library/math math log1p10266544
Ref: 179110266544
Ref: library/math math log210266749
Ref: 149c10266749
Ref: library/math math log1010267155
Ref: 19fc10267155
Ref: library/math math pow10267328
Ref: a5710267328
Ref: library/math math sqrt10268311
Ref: dcc10268311
Ref: Power exponential and logarithmic functions-Footnote-110268418
Node: Summation and product functions10268477
Ref: library/math summation-and-product-functions10268639
Ref: 2cb210268639
Ref: library/math math dist10268722
Ref: dc810268722
Ref: library/math math fsum10269124
Ref: 178d10269124
Ref: library/math math hypot10269880
Ref: dc910269880
Ref: library/math math prod10270740
Ref: dca10270740
Ref: library/math math sumprod10271142
Ref: 8ad10271142
Ref: Summation and product functions-Footnote-110271617
Node: 角度変換10271722
Ref: library/math angular-conversion10271853
Ref: 2cb310271853
Ref: library/math math degrees10271894
Ref: 2ca110271894
Ref: library/math math radians10271987
Ref: 2ca210271987
Node: 三角関数10272080
Ref: library/math trigonometric-functions10272195
Ref: 2cb410272195
Ref: library/math math acos10272236
Ref: 2ca310272236
Ref: library/math math asin10272371
Ref: 2ca410272371
Ref: library/math math atan10272518
Ref: 2ca510272518
Ref: library/math math atan210272665
Ref: 2ca610272665
Ref: library/math math cos10273298
Ref: 187710273298
Ref: library/math math sin10273377
Ref: 187610273377
Ref: library/math math tan10273456
Ref: 2ca710273456
Node: 双曲線関数10273535
Ref: library/math hyperbolic-functions10273650
Ref: 2cb510273650
Ref: library/math math acosh10273809
Ref: 178e10273809
Ref: library/math math asinh10273890
Ref: 178f10273890
Ref: library/math math atanh10273971
Ref: 179010273971
Ref: library/math math cosh10274052
Ref: 2ca810274052
Ref: library/math math sinh10274129
Ref: 2ca910274129
Ref: library/math math tanh10274206
Ref: 2caa10274206
Ref: 双曲線関数-Footnote-110274319
Node: 特殊関数10274378
Ref: library/math special-functions10274507
Ref: 2cb610274507
Ref: library/math math erf10274548
Ref: f9c10274548
Ref: library/math math erfc10274966
Ref: f9d10274966
Ref: library/math math gamma10275268
Ref: 15ac10275268
Ref: library/math math lgamma10275379
Ref: 15ad10275379
Ref: 特殊関数-Footnote-110275549
Ref: 特殊関数-Footnote-210275625
Ref: 特殊関数-Footnote-310275696
Ref: 特殊関数-Footnote-410275772
Ref: 特殊関数-Footnote-510275858
Node: Number-theoretic functions10275943
Ref: library/math number-theoretic-functions10276066
Ref: 2cb710276066
Ref: library/math math comb10276303
Ref: ac210276303
Ref: library/math math factorial10276614
Ref: d1710276614
Ref: library/math math gcd10276797
Ref: ce310276797
Ref: library/math math isqrt10276989
Ref: dcb10276989
Ref: library/math math lcm10277211
Ref: ce410277211
Ref: library/math math perm10277421
Ref: ac310277421
Node: 定数<2>10278282
Ref: library/math constants10278384
Ref: 2cbe10278384
Ref: library/math math pi10278417
Ref: 2cab10278417
Ref: library/math math e10278528
Ref: 2cac10278528
Ref: library/math math tau10278646
Ref: 2cad10278646
Ref: library/math math inf10279028
Ref: 104510279028
Ref: library/math math nan10279237
Ref: a5810279237
Ref: 定数<2>-Footnote-110281329
Ref: 定数<2>-Footnote-210281365
Ref: 定数<2>-Footnote-310281393
Node: math integer --- integer-specific mathematics functions10281440
Ref: library/math integer doc10281638
Ref: 2cbf10281638
Ref: library/math integer math-integer-integer-specific-mathematics-functions10281638
Ref: 2cc010281638
Ref: library/math integer module-math integer10281638
Ref: 9210281638
Ref: library/math integer translation-repo10281638
Ref: 2cc110281638
Ref: library/math integer math integer comb10282218
Ref: 2cb810282218
Ref: library/math integer math integer factorial10282713
Ref: 2cb910282713
Ref: library/math integer math integer gcd10282814
Ref: 2cba10282814
Ref: library/math integer math integer isqrt10283197
Ref: 2cbb10283197
Ref: library/math integer math integer lcm10283701
Ref: 2cbc10283701
Ref: library/math integer math integer perm10284084
Ref: 2cbd10284084
Node: cmath --- 複素数用の数学関数10284537
Ref: library/cmath doc10284773
Ref: 2cc210284773
Ref: library/cmath cmath-mathematical-functions-for-complex-numbers10284773
Ref: 2cc310284773
Ref: library/cmath module-cmath10284773
Ref: 1910284773
Ref: library/cmath translation-repo10284773
Ref: 2cc410284773
Node: 極座標変換10293072
Ref: library/cmath conversions-to-and-from-polar-coordinates10293197
Ref: 2cdd10293197
Ref: library/cmath cmath phase10293917
Ref: 2cc610293917
Ref: library/cmath cmath polar10294659
Ref: 2cc710294659
Ref: library/cmath cmath rect10294915
Ref: 2cc810294915
Node: 指数関数と対数関数10295097
Ref: library/cmath power-and-logarithmic-functions10295246
Ref: 2cde10295246
Ref: library/cmath cmath exp10295312
Ref: 2cc910295312
Ref: library/cmath cmath log10295434
Ref: 2cca10295434
Ref: library/cmath cmath log1010295679
Ref: 2ccb10295679
Ref: library/cmath cmath sqrt10295811
Ref: 2cc510295811
Node: 三角関数<2>10295936
Ref: library/cmath trigonometric-functions10296088
Ref: 2cdf10296088
Ref: library/cmath cmath acos10296129
Ref: 2ccc10296129
Ref: library/cmath cmath asin10296348
Ref: 2ccd10296348
Ref: library/cmath cmath atan10296472
Ref: 2cce10296472
Ref: library/cmath cmath cos10296719
Ref: 2ccf10296719
Ref: library/cmath cmath sin10296781
Ref: 2cd010296781
Ref: library/cmath cmath tan10296841
Ref: 2cd110296841
Node: 双曲線関数<2>10296904
Ref: library/cmath hyperbolic-functions10297041
Ref: 2ce010297041
Ref: library/cmath cmath acosh10297087
Ref: 2cd210297087
Ref: library/cmath cmath asinh10297252
Ref: 2cd310297252
Ref: library/cmath cmath atanh10297512
Ref: 2cd410297512
Ref: library/cmath cmath cosh10297761
Ref: 2cd510297761
Ref: library/cmath cmath sinh10297835
Ref: 2cd610297835
Ref: library/cmath cmath tanh10297907
Ref: 2cd710297907
Node: 類別関数10297982
Ref: library/cmath classification-functions10298113
Ref: 2ce110298113
Ref: library/cmath cmath isfinite10298154
Ref: 2cd810298154
Ref: library/cmath cmath isinf10298329
Ref: 2cd910298329
Ref: library/cmath cmath isnan10298481
Ref: 2cda10298481
Ref: library/cmath cmath isclose10298627
Ref: 116e10298627
Ref: 類別関数-Footnote-110300285
Node: 定数<3>10300327
Ref: library/cmath constants10300431
Ref: 2ce210300431
Ref: library/cmath cmath pi10300462
Ref: 2cdb10300462
Ref: library/cmath cmath e10300550
Ref: 2cdc10300550
Ref: library/cmath cmath tau10300645
Ref: 104410300645
Ref: library/cmath cmath inf10300757
Ref: 104610300757
Ref: library/cmath cmath infj10300900
Ref: 104810300900
Ref: library/cmath cmath nan10301081
Ref: 104710301081
Ref: library/cmath cmath nanj10301257
Ref: 104910301257
Node: decimal --- 10進固定小数点と浮動小数点の演算10302821
Ref: library/decimal doc10303025
Ref: 2ce310303025
Ref: library/decimal decimal-decimal-fixed-point-and-floating-point-arithmetic10303025
Ref: 2ce410303025
Ref: library/decimal module-decimal10303025
Ref: 3910303025
Ref: library/decimal translation-repo10303025
Ref: 2ce510303025
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-110309545
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-210309612
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-310309675
Node: Quick-start tutorial10309729
Ref: library/decimal decimal-tutorial10309880
Ref: 145b10309880
Ref: library/decimal quick-start-tutorial10309880
Ref: 2cf510309880
Node: Decimal オブジェクト10318510
Ref: library/decimal decimal-decimal10318696
Ref: 2cf810318696
Ref: library/decimal decimal-objects10318696
Ref: 2cf910318696
Ref: library/decimal decimal Decimal10318763
Ref: 1cd10318763
Ref: library/decimal decimal Decimal adjusted10324828
Ref: 2cfa10324828
Ref: library/decimal decimal Decimal as_integer_ratio10325185
Ref: 105910325185
Ref: library/decimal decimal Decimal as_tuple10325681
Ref: 2cfb10325681
Ref: library/decimal decimal Decimal canonical10325870
Ref: 2cfc10325870
Ref: library/decimal decimal Decimal compare10326186
Ref: 2cfd10326186
Ref: library/decimal decimal Decimal compare_signal10326666
Ref: 2cfe10326666
Ref: library/decimal decimal Decimal compare_total10327102
Ref: 2cff10327102
Ref: library/decimal decimal Decimal compare_total_mag10328475
Ref: 2d0010328475
Ref: library/decimal decimal Decimal conjugate10329214
Ref: 2d0110329214
Ref: library/decimal decimal Decimal copy_abs10329387
Ref: 2d0210329387
Ref: library/decimal decimal Decimal copy_negate10329626
Ref: 2d0310329626
Ref: library/decimal decimal Decimal copy_sign10329874
Ref: 2d0410329874
Ref: library/decimal decimal Decimal exp10330520
Ref: 146810330520
Ref: library/decimal decimal Decimal from_float10330944
Ref: 15c110330944
Ref: library/decimal decimal Decimal from_number10332170
Ref: 49710332170
Ref: library/decimal decimal Decimal fma10332719
Ref: 2d0510332719
Ref: library/decimal decimal Decimal is_canonical10333011
Ref: 2d0610333011
Ref: library/decimal decimal Decimal is_finite10333374
Ref: 2d0710333374
Ref: library/decimal decimal Decimal is_infinite10333554
Ref: 2d0810333554
Ref: library/decimal decimal Decimal is_nan10333743
Ref: 2d0910333743
Ref: library/decimal decimal Decimal is_normal10333941
Ref: 2d0a10333941
Ref: library/decimal decimal Decimal is_qnan10334223
Ref: 2d0b10334223
Ref: library/decimal decimal Decimal is_signed10334394
Ref: 2d0c10334394
Ref: library/decimal decimal Decimal is_snan10334666
Ref: 2d0d10334666
Ref: library/decimal decimal Decimal is_subnormal10334837
Ref: 2d0e10334837
Ref: library/decimal decimal Decimal is_zero10335038
Ref: 2d0f10335038
Ref: library/decimal decimal Decimal ln10335225
Ref: 146910335225
Ref: library/decimal decimal Decimal log1010335438
Ref: 2d1010335438
Ref: library/decimal decimal Decimal logb10335641
Ref: 2d1110335641
Ref: library/decimal decimal Decimal logical_and10336090
Ref: 2d1210336090
Ref: library/decimal decimal Decimal logical_invert10336362
Ref: 2d1410336362
Ref: library/decimal decimal Decimal logical_or10336541
Ref: 2d1510336541
Ref: library/decimal decimal Decimal logical_xor10336809
Ref: 2d1610336809
Ref: library/decimal decimal Decimal max10337088
Ref: 2d1710337088
Ref: library/decimal decimal Decimal max_mag10337496
Ref: 2d1810337496
Ref: library/decimal decimal Decimal min10337667
Ref: 2d1910337667
Ref: library/decimal decimal Decimal min_mag10338075
Ref: 2d1a10338075
Ref: library/decimal decimal Decimal next_minus10338246
Ref: 2d1b10338246
Ref: library/decimal decimal Decimal next_plus10338539
Ref: 2d1c10338539
Ref: library/decimal decimal Decimal next_toward10338831
Ref: 2d1d10338831
Ref: library/decimal decimal Decimal normalize10339196
Ref: 2d1e10339196
Ref: library/decimal decimal Decimal number_class10340248
Ref: 2d1f10340248
Ref: library/decimal decimal Decimal quantize10341307
Ref: 146e10341307
Ref: library/decimal decimal Decimal radix10342860
Ref: 2d2110342860
Ref: library/decimal decimal Decimal remainder_near10343113
Ref: 2d2210343113
Ref: library/decimal decimal Decimal rotate10344005
Ref: 2d2310344005
Ref: library/decimal decimal Decimal same_quantum10344697
Ref: 2d2410344697
Ref: library/decimal decimal Decimal scaleb10345284
Ref: 2d2510345284
Ref: library/decimal decimal Decimal shift10345631
Ref: 2d2610345631
Ref: library/decimal decimal Decimal sqrt10346318
Ref: 2d2710346318
Ref: library/decimal decimal Decimal to_eng_string10346425
Ref: 2d2810346425
Ref: library/decimal decimal Decimal to_integral10346975
Ref: 2d2910346975
Ref: library/decimal decimal Decimal to_integral_exact10347240
Ref: 2d2b10347240
Ref: library/decimal decimal Decimal to_integral_value10347861
Ref: 2d2a10347861
Node: 論理引数10350443
Ref: library/decimal logical-operands10350518
Ref: 2d2c10350518
Ref: library/decimal logical-operands-label10350518
Ref: 2d1310350518
Node: Context オブジェクト10350934
Ref: library/decimal context-objects10351109
Ref: 2d2d10351109
Ref: library/decimal decimal-context10351109
Ref: 297910351109
Ref: library/decimal decimal getcontext10351679
Ref: 1b7010351679
Ref: library/decimal decimal setcontext10351802
Ref: 2cf610351802
Ref: library/decimal decimal localcontext10352085
Ref: 174010352085
Ref: library/decimal decimal IEEEContext10353621
Ref: 49810353621
Ref: library/decimal decimal BasicContext10354141
Ref: 146210354141
Ref: library/decimal decimal ExtendedContext10354756
Ref: 146310354756
Ref: library/decimal decimal DefaultContext10355582
Ref: 146110355582
Ref: library/decimal decimal Context10357092
Ref: 146d10357092
Ref: library/decimal decimal Context prec10357592
Ref: 2d2f10357592
Ref: library/decimal decimal Context rounding10357762
Ref: 2d3010357762
Ref: library/decimal decimal Context traps10357884
Ref: 146c10357884
Ref: library/decimal decimal Context flags10357910
Ref: 146b10357910
Ref: library/decimal decimal Context Emin10358064
Ref: 146510358064
Ref: library/decimal decimal Context Emax10358089
Ref: 146410358089
Ref: library/decimal decimal Context capitals10358323
Ref: 2d3210358323
Ref: library/decimal decimal Context clamp10358558
Ref: 155c10358558
Ref: library/decimal decimal Context clear_flags10360473
Ref: 2cf710360473
Ref: library/decimal decimal Context clear_traps10360578
Ref: 2d3310360578
Ref: library/decimal decimal Context copy10360719
Ref: 2d3410360719
Ref: library/decimal decimal Context copy_decimal10360808
Ref: 2d3510360808
Ref: library/decimal decimal Context create_decimal10360927
Ref: 146710360927
Ref: library/decimal decimal Context create_decimal_from_float10362501
Ref: 2d3610362501
Ref: library/decimal decimal Context Etiny10363372
Ref: 2d2010363372
Ref: library/decimal decimal Context Etop10363645
Ref: 2d3710363645
Ref: library/decimal decimal Context abs10364350
Ref: 2d3810364350
Ref: library/decimal decimal Context add10364431
Ref: 2d3910364431
Ref: library/decimal decimal Context canonical10364517
Ref: 16c010364517
Ref: library/decimal decimal Context compare10364626
Ref: 2d3a10364626
Ref: library/decimal decimal Context compare_signal10364728
Ref: 2d3b10364728
Ref: library/decimal decimal Context compare_total10364852
Ref: 2d3c10364852
Ref: library/decimal decimal Context compare_total_mag10364984
Ref: 2d3d10364984
Ref: library/decimal decimal Context copy_abs10365138
Ref: 2d3e10365138
Ref: library/decimal decimal Context copy_negate10365254
Ref: 2d3f10365254
Ref: library/decimal decimal Context copy_sign10365364
Ref: 2d4010365364
Ref: library/decimal decimal Context divide10365468
Ref: 2d4110365468
Ref: library/decimal decimal Context divide_int10365569
Ref: 2d4210365569
Ref: library/decimal decimal Context divmod10365698
Ref: 2d4310365698
Ref: library/decimal decimal Context exp10365826
Ref: 2d4410365826
Ref: library/decimal decimal Context fma10365904
Ref: 2d4510365904
Ref: library/decimal decimal Context is_canonical10366019
Ref: 16c110366019
Ref: library/decimal decimal Context is_finite10366195
Ref: 2d4610366195
Ref: library/decimal decimal Context is_infinite10366354
Ref: 2d4710366354
Ref: library/decimal decimal Context is_nan10366515
Ref: 2d4810366515
Ref: library/decimal decimal Context is_normal10366682
Ref: 2d4910366682
Ref: library/decimal decimal Context is_qnan10366846
Ref: 2d4a10366846
Ref: library/decimal decimal Context is_signed10367010
Ref: 2d4b10367010
Ref: library/decimal decimal Context is_snan10367174
Ref: 2d4c10367174
Ref: library/decimal decimal Context is_subnormal10367338
Ref: 2d4d10367338
Ref: library/decimal decimal Context is_zero10367508
Ref: 2d4e10367508
Ref: library/decimal decimal Context ln10367668
Ref: 2d4f10367668
Ref: library/decimal decimal Context log1010367768
Ref: 2d5010367768
Ref: library/decimal decimal Context logb10367858
Ref: 2d5110367858
Ref: library/decimal decimal Context logical_and10367968
Ref: 2d5210367968
Ref: library/decimal decimal Context logical_invert10368090
Ref: 2d5310368090
Ref: library/decimal decimal Context logical_or10368191
Ref: 2d5410368191
Ref: library/decimal decimal Context logical_xor10368311
Ref: 2d5510368311
Ref: library/decimal decimal Context max10368433
Ref: 2d5610368433
Ref: library/decimal decimal Context max_mag10368558
Ref: 2d5710368558
Ref: library/decimal decimal Context min10368672
Ref: 2d5810368672
Ref: library/decimal decimal Context min_mag10368797
Ref: 2d5910368797
Ref: library/decimal decimal Context minus10368911
Ref: 2d5a10368911
Ref: library/decimal decimal Context multiply10369036
Ref: 2d5b10369036
Ref: library/decimal decimal Context next_minus10369127
Ref: 2d5c10369127
Ref: library/decimal decimal Context next_plus10369245
Ref: 2d5d10369245
Ref: library/decimal decimal Context next_toward10369362
Ref: 2d5e10369362
Ref: library/decimal decimal Context normalize10369489
Ref: 2d5f10369489
Ref: library/decimal decimal Context number_class10369588
Ref: 2d6010369588
Ref: library/decimal decimal Context plus10369699
Ref: 2d6110369699
Ref: library/decimal decimal Context power10369965
Ref: 2d6210369965
Ref: library/decimal decimal Context quantize10372013
Ref: 2d6310372013
Ref: library/decimal decimal Context radix10372143
Ref: 2d6410372143
Ref: library/decimal decimal Context remainder10372243
Ref: 2d6510372243
Ref: library/decimal decimal Context remainder_near10372443
Ref: 2d6610372443
Ref: library/decimal decimal Context rotate10372709
Ref: 2d6710372709
Ref: library/decimal decimal Context same_quantum10372816
Ref: 2d6810372816
Ref: library/decimal decimal Context scaleb10372966
Ref: 2d6910372966
Ref: library/decimal decimal Context shift10373109
Ref: 2d6a10373109
Ref: library/decimal decimal Context sqrt10373218
Ref: 2d6b10373218
Ref: library/decimal decimal Context subtract10373324
Ref: 2d6c10373324
Ref: library/decimal decimal Context to_eng_string10373421
Ref: 2d6d10373421
Ref: library/decimal decimal Context to_integral_exact10373848
Ref: 2d6e10373848
Ref: library/decimal decimal Context to_sci_string10373951
Ref: 2d6f10373951
Node: 定数<4>10374062
Ref: library/decimal constants10374226
Ref: 2d7010374226
Ref: library/decimal decimal-rounding-modes10374226
Ref: 2d7110374226
Ref: library/decimal decimal SPEC_VERSION10374257
Ref: 30910374257
Ref: library/decimal decimal MAX_PREC10374996
Ref: 145e10374996
Ref: library/decimal decimal MAX_EMAX10375222
Ref: 145f10375222
Ref: library/decimal decimal MIN_EMIN10375448
Ref: 146010375448
Ref: library/decimal decimal MIN_ETINY10375676
Ref: 2d7210375676
Ref: library/decimal decimal IEEE_CONTEXT_MAX_BITS10375886
Ref: 2d2e10375886
Ref: library/decimal decimal HAVE_THREADS10376019
Ref: 145c10376019
Ref: library/decimal decimal HAVE_CONTEXTVAR10376229
Ref: 237510376229
Node: 丸めモード10376597
Ref: library/decimal rounding-modes10376747
Ref: 2d3110376747
Ref: library/decimal decimal ROUND_CEILING10376793
Ref: 2ce610376793
Ref: library/decimal decimal ROUND_DOWN10376877
Ref: 2ce710376877
Ref: library/decimal decimal ROUND_FLOOR10376949
Ref: 2ce810376949
Ref: library/decimal decimal ROUND_HALF_DOWN10377032
Ref: 2ce910377032
Ref: library/decimal decimal ROUND_HALF_EVEN10377148
Ref: 2cea10377148
Ref: library/decimal decimal ROUND_HALF_UP10377270
Ref: 2ceb10377270
Ref: library/decimal decimal ROUND_UP10377396
Ref: 2cec10377396
Ref: library/decimal decimal ROUND_05UP10377478
Ref: 2ced10377478
Node: シグナル10377676
Ref: library/decimal decimal-signals10377837
Ref: 145a10377837
Ref: library/decimal signals10377837
Ref: 2d7310377837
Ref: library/decimal decimal Clamped10378820
Ref: 2cee10378820
Ref: library/decimal decimal DecimalException10379282
Ref: 2d7410379282
Ref: library/decimal decimal DivisionByZero10379435
Ref: 2cef10379435
Ref: library/decimal decimal Inexact10379862
Ref: 2cf010379862
Ref: library/decimal decimal InvalidOperation10380289
Ref: 146610380289
Ref: library/decimal decimal Overflow10380917
Ref: 2cf310380917
Ref: library/decimal decimal Rounded10381571
Ref: 2cf110381571
Ref: library/decimal decimal Subnormal10382124
Ref: 2cf210382124
Ref: library/decimal decimal Underflow10382480
Ref: 2cf410382480
Ref: library/decimal decimal FloatOperation10382846
Ref: 145910382846
Node: Floating-point notes10384360
Ref: library/decimal decimal-notes10384536
Ref: 2d7510384536
Ref: library/decimal floating-point-notes10384536
Ref: 2d7610384536
Node: 精度を上げて丸め誤差を抑制する10384671
Ref: library/decimal mitigating-round-off-error-with-increased-precision10384791
Ref: 2d7710384791
Node: 特殊値10386541
Ref: library/decimal special-values10386661
Ref: 2d7810386661
Node: スレッドを使った処理10390508
Ref: library/decimal decimal-threads10390681
Ref: 2d7910390681
Ref: library/decimal working-with-threads10390681
Ref: 2d7a10390681
Node: レシピ10392646
Ref: library/decimal decimal-recipes10392810
Ref: 2d7b10392810
Ref: library/decimal recipes10392810
Ref: 2d7c10392810
Node: Decimal FAQ10397697
Ref: library/decimal decimal-faq10397822
Ref: 2d7d10397822
Ref: library/decimal id110397822
Ref: 2d7e10397822
Ref: Decimal FAQ-Footnote-110406933
Ref: Decimal FAQ-Footnote-210407000
Ref: Decimal FAQ-Footnote-310407031
Ref: Decimal FAQ-Footnote-410407089
Ref: Decimal FAQ-Footnote-510407192
Node: fractions --- 有理数10407309
Ref: library/fractions doc10407514
Ref: 2d7f10407514
Ref: library/fractions fractions-rational-numbers10407514
Ref: 2d8010407514
Ref: library/fractions module-fractions10407514
Ref: 6010407514
Ref: library/fractions translation-repo10407514
Ref: 2d8110407514
Ref: library/fractions fractions Fraction10407881
Ref: 1ce10407881
Ref: library/fractions fractions Fraction numerator10412567
Ref: 2d8310412567
Ref: library/fractions fractions Fraction denominator10412664
Ref: 2d8410412664
Ref: library/fractions fractions Fraction as_integer_ratio10412791
Ref: 2d8510412791
Ref: library/fractions fractions Fraction is_integer10413040
Ref: 2d8610413040
Ref: library/fractions fractions Fraction from_float10413172
Ref: 15c210413172
Ref: library/fractions fractions Fraction from_decimal10413661
Ref: 15c310413661
Ref: library/fractions fractions Fraction from_number10414081
Ref: 4aa10414081
Ref: library/fractions fractions Fraction limit_denominator10414449
Ref: 2d8210414449
Ref: library/fractions fractions Fraction __floor__10415351
Ref: 1d1510415351
Ref: library/fractions fractions Fraction __ceil__10415664
Ref: 1d1410415664
Ref: library/fractions fractions Fraction __round__10415872
Ref: 1d1310415872
Ref: library/fractions fractions Fraction __format__10416391
Ref: 2d8710416391
Ref: fractions --- 有理数-Footnote-110418712
Ref: fractions --- 有理数-Footnote-210418781
Node: random --- 疑似乱数を生成する10418823
Ref: library/random doc10419005
Ref: 2d8810419005
Ref: library/random module-random10419005
Ref: c010419005
Ref: library/random random-generate-pseudo-random-numbers10419005
Ref: 2d8910419005
Ref: library/random translation-repo10419005
Ref: 2d8a10419005
Ref: random --- 疑似乱数を生成する-Footnote-110422897
Ref: random --- 疑似乱数を生成する-Footnote-210422963
Node: 保守 bookkeeping 関数10423053
Ref: library/random bookkeeping-functions10423186
Ref: 2d8c10423186
Ref: library/random random seed10423257
Ref: 162d10423257
Ref: library/random random getstate10424660
Ref: 2d8d10424660
Ref: library/random random setstate10424919
Ref: 2d8e10424919
Node: バイト列用の関数10425204
Ref: library/random functions-for-bytes10425364
Ref: 2d8f10425364
Ref: library/random random randbytes10425425
Ref: 1a5610425425
Node: 整数用の関数10425769
Ref: library/random functions-for-integers10425931
Ref: 2d9110425931
Ref: library/random random randrange10425982
Ref: c4510425982
Ref: library/random random randint10427169
Ref: 15ea10427169
Ref: library/random random getrandbits10427351
Ref: 13bb10427351
Node: シーケンス用の関数10427950
Ref: library/random functions-for-sequences10428110
Ref: 2d9210428110
Ref: library/random random choice10428176
Ref: 15eb10428176
Ref: library/random random choices10428381
Ref: 108710428381
Ref: library/random random shuffle10430855
Ref: b3110430855
Ref: library/random random sample10431772
Ref: b3010431772
Node: Discrete distributions10433735
Ref: library/random discrete-distributions10433889
Ref: 2d9310433889
Ref: library/random random binomialvariate10434013
Ref: 8c510434013
Ref: Discrete distributions-Footnote-110434576
Node: 実数分布10434640
Ref: library/random id110434782
Ref: 2d9410434782
Ref: library/random real-valued-distributions10434782
Ref: 2d9510434782
Ref: library/random random random10435129
Ref: b3210435129
Ref: library/random random uniform10435256
Ref: 2d9610435256
Ref: library/random random triangular10435634
Ref: 2d9710435634
Ref: library/random random betavariate10436047
Ref: 2d9810436047
Ref: library/random random expovariate10436261
Ref: 8c610436261
Ref: library/random random gammavariate10436728
Ref: 2d9910436728
Ref: library/random random gauss10437219
Ref: 1df010437219
Ref: library/random random lognormvariate10438008
Ref: 2d9a10438008
Ref: library/random random normalvariate10438345
Ref: 1df110438345
Ref: library/random random vonmisesvariate10438591
Ref: 2d9b10438591
Ref: library/random random paretovariate10438976
Ref: 2d9c10438976
Ref: library/random random weibullvariate10439097
Ref: 2d9d10439097
Node: 他の生成器10439266
Ref: library/random alternative-generator10439407
Ref: 2d9e10439407
Ref: library/random random Random10439453
Ref: 1e7210439453
Ref: library/random random Random seed10440024
Ref: 1f7d10440024
Ref: library/random random Random getstate10440203
Ref: 2d9f10440203
Ref: library/random random Random setstate10440373
Ref: 2da010440373
Ref: library/random random Random random10440548
Ref: 2da110440548
Ref: library/random random Random getrandbits10440802
Ref: 2da210440802
Ref: library/random random Random randbytes10440979
Ref: cfa10440979
Ref: library/random random SystemRandom10441152
Ref: 2d8b10441152
Node: 再現性について10441820
Ref: library/random notes-on-reproducibility10441961
Ref: 2da310441961
Node: 使用例<7>10442842
Ref: library/random examples10442980
Ref: 2da410442980
Ref: library/random random-examples10442980
Ref: 159b10442980
Ref: 使用例<7>-Footnote-110448393
Ref: 使用例<7>-Footnote-210448514
Ref: 使用例<7>-Footnote-310448560
Ref: 使用例<7>-Footnote-410448641
Ref: 使用例<7>-Footnote-510448693
Ref: 使用例<7>-Footnote-610448748
Ref: 使用例<7>-Footnote-710448816
Ref: 使用例<7>-Footnote-810448852
Ref: 使用例<7>-Footnote-910448922
Node: レシピ<2>10448958
Ref: library/random recipes10449111
Ref: 2da510449111
Ref: レシピ<2>-Footnote-110452881
Ref: レシピ<2>-Footnote-210452930
Node: コマンドラインでの使用<2>10452998
Ref: library/random command-line-usage10453166
Ref: 2da610453166
Ref: library/random random-cli10453166
Ref: 69410453166
Ref: library/random cmdoption-random-h10453476
Ref: 2da710453476
Ref: library/random cmdoption-random-help10453476
Ref: 2da810453476
Ref: library/random cmdoption-random-c10453564
Ref: 2da910453564
Ref: library/random cmdoption-random-choice10453599
Ref: 2daa10453599
Ref: library/random cmdoption-random-i10453730
Ref: 2dab10453730
Ref: library/random cmdoption-random-integer10453749
Ref: 2dac10453749
Ref: library/random cmdoption-random-f10453898
Ref: 2dad10453898
Ref: library/random cmdoption-random-float10453917
Ref: 2dae10453917
Node: コマンドラインの例10454333
Ref: library/random command-line-example10454480
Ref: 2daf10454480
Ref: library/random random-cli-example10454480
Ref: 2db010454480
Node: statistics --- 数学的統計関数10455334
Ref: library/statistics doc10455484
Ref: 2db110455484
Ref: library/statistics module-statistics10455484
Ref: da10455484
Ref: library/statistics statistics-mathematical-statistics-functions10455484
Ref: 2db210455484
Ref: library/statistics translation-repo10455484
Ref: 2db310455484
Ref: statistics --- 数学的統計関数-Footnote-110458160
Ref: statistics --- 数学的統計関数-Footnote-210458230
Ref: statistics --- 数学的統計関数-Footnote-310458256
Node: 平均及び中心位置の測度10458283
Ref: library/statistics averages-and-measures-of-central-location10458413
Ref: 2db410458413
Node: 分散の測度10460248
Ref: library/statistics measures-of-spread10460415
Ref: 2db910460415
Node: 2入力間の関係の統計10461042
Ref: library/statistics statistics-for-relations-between-two-inputs10461191
Ref: 2dbb10461191
Node: 関数の詳細10461708
Ref: library/statistics function-details10461851
Ref: 2dbc10461851
Ref: library/statistics statistics mean10462067
Ref: ac410462067
Ref: library/statistics statistics fmean10463692
Ref: dfc10463692
Ref: library/statistics statistics geometric_mean10464683
Ref: dfd10464683
Ref: library/statistics statistics harmonic_mean10465373
Ref: 10a310465373
Ref: library/statistics statistics kde10466955
Ref: 75a10466955
Ref: library/statistics statistics kde_random10468834
Ref: 75b10468834
Ref: library/statistics statistics median10469884
Ref: 2db510469884
Ref: library/statistics statistics median_low10471045
Ref: 2db610471045
Ref: library/statistics statistics median_high10471771
Ref: 2db710471771
Ref: library/statistics statistics median_grouped10472491
Ref: 2db810472491
Ref: library/statistics statistics mode10474396
Ref: e5810474396
Ref: library/statistics statistics multimode10475961
Ref: dfe10475961
Ref: library/statistics statistics pstdev10476383
Ref: 19e610476383
Ref: library/statistics statistics pvariance10476662
Ref: 2dba10476662
Ref: library/statistics statistics stdev10478955
Ref: ac610478955
Ref: library/statistics statistics variance10479239
Ref: ac510479239
Ref: library/statistics statistics quantiles10481595
Ref: dff10481595
Ref: library/statistics statistics covariance10484579
Ref: c0d10484579
Ref: library/statistics statistics correlation10485204
Ref: 8d110485204
Ref: library/statistics statistics linear_regression10487301
Ref: c0e10487301
Ref: 関数の詳細-Footnote-110489904
Ref: 関数の詳細-Footnote-210489952
Ref: 関数の詳細-Footnote-310489998
Ref: 関数の詳細-Footnote-410490053
Ref: 関数の詳細-Footnote-510490149
Ref: 関数の詳細-Footnote-610490207
Ref: 関数の詳細-Footnote-710490279
Ref: 関数の詳細-Footnote-810490330
Ref: 関数の詳細-Footnote-910490400
Ref: 関数の詳細-Footnote-1010490481
Ref: 関数の詳細-Footnote-1110490554
Ref: 関数の詳細-Footnote-1210490618
Node: 例外<5>10490676
Ref: library/statistics exceptions10490820
Ref: 2dbe10490820
Ref: library/statistics statistics StatisticsError10490891
Ref: 2dbd10490891
Node: NormalDist オブジェクト10491006
Ref: library/statistics normaldist-objects10491153
Ref: 2dbf10491153
Ref: library/statistics statistics NormalDist10491559
Ref: e0010491559
Ref: library/statistics statistics NormalDist mean10491849
Ref: 2dc010491849
Ref: library/statistics statistics NormalDist median10491970
Ref: 2dc110491970
Ref: library/statistics statistics NormalDist mode10492084
Ref: 2dc210492084
Ref: library/statistics statistics NormalDist stdev10492184
Ref: 2dc310492184
Ref: library/statistics statistics NormalDist variance10492309
Ref: 2dc410492309
Ref: library/statistics statistics NormalDist from_samples10492475
Ref: 2dc510492475
Ref: library/statistics statistics NormalDist samples10493089
Ref: 2dc610493089
Ref: library/statistics statistics NormalDist pdf10493715
Ref: 2dc710493715
Ref: library/statistics statistics NormalDist cdf10494318
Ref: 1a9b10494318
Ref: library/statistics statistics NormalDist inv_cdf10494567
Ref: 2dc810494567
Ref: library/statistics statistics NormalDist overlap10495012
Ref: 2dc910495012
Ref: library/statistics statistics NormalDist quantiles10495274
Ref: 2dca10495274
Ref: library/statistics statistics NormalDist zscore10495735
Ref: 2dcb10495735
Ref: NormalDist オブジェクト-Footnote-110497147
Ref: NormalDist オブジェクト-Footnote-210497211
Ref: NormalDist オブジェクト-Footnote-310497271
Ref: NormalDist オブジェクト-Footnote-410497325
Ref: NormalDist オブジェクト-Footnote-510497382
Ref: NormalDist オブジェクト-Footnote-610497436
Ref: NormalDist オブジェクト-Footnote-710497481
Ref: NormalDist オブジェクト-Footnote-810497537
Ref: NormalDist オブジェクト-Footnote-910497594
Ref: NormalDist オブジェクト-Footnote-1010497641
Ref: NormalDist オブジェクト-Footnote-1110497709
Ref: NormalDist オブジェクト-Footnote-1210497781
Ref: NormalDist オブジェクト-Footnote-1310497838
Ref: NormalDist オブジェクト-Footnote-1410497973
Ref: NormalDist オブジェクト-Footnote-1510498020
Ref: NormalDist オブジェクト-Footnote-1610498098
Node: 例とレシピ<2>10498183
Ref: library/statistics examples-and-recipes10498312
Ref: 2dcc10498312
Node: Classic probability problems10498511
Ref: library/statistics classic-probability-problems10498637
Ref: 2dcd10498637
Ref: Classic probability problems-Footnote-110499466
Ref: Classic probability problems-Footnote-210499537
Ref: Classic probability problems-Footnote-310499584
Node: Monte Carlo inputs for simulations10499629
Ref: library/statistics monte-carlo-inputs-for-simulations10499800
Ref: 2dce10499800
Ref: Monte Carlo inputs for simulations-Footnote-110500490
Node: Approximating binomial distributions10500547
Ref: library/statistics approximating-binomial-distributions10500715
Ref: 2dcf10500715
Ref: Approximating binomial distributions-Footnote-110502147
Node: Naive bayesian classifier10502211
Ref: library/statistics naive-bayesian-classifier10502336
Ref: 2dd010502336
Ref: Naive bayesian classifier-Footnote-110504229
Ref: Naive bayesian classifier-Footnote-210504313
Ref: Naive bayesian classifier-Footnote-310504369
Node: 関数型プログラミング用モジュール10504439
Ref: library/functional doc10504651
Ref: 2dd110504651
Ref: library/functional functional-programming-modules10504651
Ref: 2dd210504651
Ref: library/functional translation-repo10504651
Ref: 2dd310504651
Node: itertools --- 効率的なループ用のイテレータ生成関数群10505388
Ref: library/itertools doc10505627
Ref: 2dd410505627
Ref: library/itertools itertools-functions-creating-iterators-for-efficient-looping10505627
Ref: 2dd510505627
Ref: library/itertools module-itertools10505627
Ref: 8410505627
Node: Itertool関数10516753
Ref: library/itertools itertool-functions10516903
Ref: 2dd910516903
Ref: library/itertools itertools-functions10516903
Ref: 2dda10516903
Ref: library/itertools itertools accumulate10517133
Ref: dc310517133
Ref: library/itertools itertools batched10519618
Ref: 71b10519618
Ref: library/itertools itertools chain10521180
Ref: 19b10521180
Ref: library/itertools itertools chain from_iterable10521660
Ref: 19c10521660
Ref: library/itertools itertools combinations10522155
Ref: 16cb10522155
Ref: library/itertools itertools combinations_with_replacement10523780
Ref: 163b10523780
Ref: library/itertools itertools compress10525379
Ref: 163c10525379
Ref: library/itertools itertools count10525877
Ref: 163d10525877
Ref: library/itertools itertools cycle10526738
Ref: 1a6110526738
Ref: library/itertools itertools dropwhile10527442
Ref: 2dd610527442
Ref: library/itertools itertools filterfalse10528150
Ref: 27e610528150
Ref: library/itertools itertools groupby10528736
Ref: 194b10528736
Ref: library/itertools itertools islice10531708
Ref: f0d10531708
Ref: library/itertools itertools pairwise10533484
Ref: bf210533484
Ref: library/itertools itertools permutations10534108
Ref: 198210534108
Ref: library/itertools itertools product10536204
Ref: 16cc10536204
Ref: library/itertools itertools repeat10538098
Ref: 1aa110538098
Ref: library/itertools itertools starmap10538809
Ref: 14a310538809
Ref: library/itertools itertools takewhile10539446
Ref: 2dd710539446
Ref: library/itertools itertools tee10540250
Ref: 2dd810540250
Ref: library/itertools itertools zip_longest10543126
Ref: 165810543126
Ref: Itertool関数-Footnote-110544635
Ref: Itertool関数-Footnote-210544709
Ref: Itertool関数-Footnote-310544764
Ref: Itertool関数-Footnote-410544820
Node: Itertools レシピ10544918
Ref: library/itertools id110545068
Ref: 2ddc10545068
Ref: library/itertools itertools-recipes10545068
Ref: 161810545068
Ref: Itertools レシピ-Footnote-110561145
Ref: Itertools レシピ-Footnote-210561194
Node: functools --- 高階関数と呼び出し可能オブジェクトの操作10561265
Ref: library/functools doc10561556
Ref: 2ddd10561556
Ref: library/functools functools-higher-order-functions-and-operations-on-callable-objects10561556
Ref: 2dde10561556
Ref: library/functools module-functools10561556
Ref: 6210561556
Ref: library/functools translation-repo10561556
Ref: 2ddf10561556
Ref: library/functools functools cache10562082
Ref: 1a2810562082
Ref: library/functools functools cached_property10563568
Ref: 95310563568
Ref: library/functools functools cmp_to_key10567515
Ref: 159810567515
Ref: library/functools functools lru_cache10568764
Ref: db710568764
Ref: library/functools functools lru_cache cache_info10571673
Ref: 2de110571673
Ref: library/functools functools lru_cache cache_clear10571938
Ref: 2de210571938
Ref: library/functools functools total_ordering10574847
Ref: 12f210574847
Ref: library/functools functools Placeholder10577384
Ref: 4ac10577384
Ref: library/functools functools partial10577616
Ref: 4ad10577616
Ref: library/functools functools partialmethod10580871
Ref: 4ae10580871
Ref: library/functools functools reduce10582919
Ref: 15610582919
Ref: library/functools functools singledispatch10584320
Ref: a2f10584320
Ref: library/functools functools singledispatch register10584952
Ref: 2de310584952
Ref: library/functools functools singledispatchmethod10591013
Ref: 22910591013
Ref: library/functools functools update_wrapper10592868
Ref: 13cf10592868
Ref: library/functools functools wraps10595759
Ref: 130c10595759
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-110597090
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-210597159
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-310597209
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-410597251
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-510597343
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-610597397
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-710597457
Node: partial オブジェクト10597522
Ref: library/functools id110597659
Ref: 2de510597659
Ref: library/functools partial-objects10597659
Ref: 4af10597659
Ref: library/functools functools partial func10597953
Ref: 2de610597953
Ref: library/functools functools partial args10598203
Ref: 2de710598203
Ref: library/functools functools partial keywords10598401
Ref: 2de810598401
Node: operator --- 関数形式の標準演算子10598832
Ref: library/operator doc10599043
Ref: 2de910599043
Ref: library/operator module-operator10599043
Ref: a310599043
Ref: library/operator operator-standard-operators-as-functions10599043
Ref: 2dea10599043
Ref: library/operator translation-repo10599043
Ref: 2deb10599043
Ref: library/operator operator lt10600010
Ref: 2dec10600010
Ref: library/operator operator le10600044
Ref: 2ded10600044
Ref: library/operator operator eq10600078
Ref: 2dee10600078
Ref: library/operator operator ne10600112
Ref: 2def10600112
Ref: library/operator operator ge10600146
Ref: 2df010600146
Ref: library/operator operator gt10600180
Ref: 2df110600180
Ref: library/operator operator __lt__10600214
Ref: 2df210600214
Ref: library/operator operator __le__10600252
Ref: 2df310600252
Ref: library/operator operator __eq__10600290
Ref: 2df410600290
Ref: library/operator operator __ne__10600328
Ref: 2df510600328
Ref: library/operator operator __ge__10600366
Ref: 2df610600366
Ref: library/operator operator __gt__10600404
Ref: 2df710600404
Ref: library/operator operator not_10601191
Ref: 2df810601191
Ref: library/operator operator __not__10601226
Ref: 2df910601226
Ref: library/operator operator truth10601637
Ref: 2dfa10601637
Ref: library/operator operator is_10601888
Ref: 2dfb10601888
Ref: library/operator operator is_not10602013
Ref: 2dfc10602013
Ref: library/operator operator is_none10602145
Ref: 4e810602145
Ref: library/operator operator is_not_none10602265
Ref: 4e910602265
Ref: library/operator operator abs10602477
Ref: 2dfd10602477
Ref: library/operator operator __abs__10602511
Ref: 2dfe10602511
Ref: library/operator operator add10602593
Ref: 2dff10602593
Ref: library/operator operator __add__10602628
Ref: 2e0010602628
Ref: library/operator operator and_10602743
Ref: 2e0110602743
Ref: library/operator operator __and__10602779
Ref: 2e0210602779
Ref: library/operator operator floordiv10602883
Ref: 2e0310602883
Ref: library/operator operator __floordiv__10602923
Ref: 2e0410602923
Ref: library/operator operator index10603006
Ref: 1ee710603006
Ref: library/operator operator __index__10603040
Ref: 2e0510603040
Ref: library/operator operator inv10603371
Ref: 2e0610603371
Ref: library/operator operator invert10603405
Ref: 2e0710603405
Ref: library/operator operator __inv__10603442
Ref: 2e0810603442
Ref: library/operator operator __invert__10603480
Ref: 2e0910603480
Ref: library/operator operator lshift10603606
Ref: 2e0a10603606
Ref: library/operator operator __lshift__10603644
Ref: 2e0b10603644
Ref: library/operator operator mod10603745
Ref: 2e0c10603745
Ref: library/operator operator __mod__10603780
Ref: 2e0d10603780
Ref: library/operator operator mul10603857
Ref: 2ddb10603857
Ref: library/operator operator __mul__10603892
Ref: 2e0e10603892
Ref: library/operator operator matmul10604007
Ref: 11ec10604007
Ref: library/operator operator __matmul__10604045
Ref: 2e0f10604045
Ref: library/operator operator neg10604153
Ref: 2e1010604153
Ref: library/operator operator __neg__10604187
Ref: 2e1110604187
Ref: library/operator operator or_10604277
Ref: 2e1210604277
Ref: library/operator operator __or__10604312
Ref: 2e1310604312
Ref: library/operator operator pos10604415
Ref: 2e1410604415
Ref: library/operator operator __pos__10604449
Ref: 2e1510604449
Ref: library/operator operator pow10604539
Ref: 2e1610604539
Ref: library/operator operator __pow__10604574
Ref: 2e1710604574
Ref: library/operator operator rshift10604690
Ref: 2e1810604690
Ref: library/operator operator __rshift__10604728
Ref: 2e1910604728
Ref: library/operator operator sub10604829
Ref: 2e1a10604829
Ref: library/operator operator __sub__10604864
Ref: 2e1b10604864
Ref: library/operator operator truediv10604941
Ref: 2e1c10604941
Ref: library/operator operator __truediv__10604980
Ref: 2e1d10604980
Ref: library/operator operator xor10605166
Ref: 2e1e10605166
Ref: library/operator operator __xor__10605201
Ref: 2e1f10605201
Ref: library/operator operator concat10605465
Ref: 2e2010605465
Ref: library/operator operator __concat__10605503
Ref: 2e2110605503
Ref: library/operator operator contains10605630
Ref: cb010605630
Ref: library/operator operator __contains__10605670
Ref: 2e2210605670
Ref: library/operator operator countOf10605846
Ref: cb210605846
Ref: library/operator operator delitem10605950
Ref: 2e2310605950
Ref: library/operator operator __delitem__10605989
Ref: 2e2410605989
Ref: library/operator operator getitem10606097
Ref: 2e2510606097
Ref: library/operator operator __getitem__10606136
Ref: 2e2610606136
Ref: library/operator operator indexOf10606241
Ref: cb110606241
Ref: library/operator operator setitem10606366
Ref: 2e2710606366
Ref: library/operator operator __setitem__10606408
Ref: 2e2810606408
Ref: library/operator operator length_hint10606527
Ref: 131c10606527
Ref: library/operator operator call10606948
Ref: 1e3810606948
Ref: library/operator operator __call__10607003
Ref: 2e2910607003
Ref: library/operator operator attrgetter10607426
Ref: 11ea10607426
Ref: library/operator operator itemgetter10608884
Ref: e2a10608884
Ref: library/operator operator methodcaller10610938
Ref: 11eb10610938
Ref: operator --- 関数形式の標準演算子-Footnote-110611931
Node: 演算子から関数への対応表10611999
Ref: library/operator mapping-operators-to-functions10612161
Ref: 2e2a10612161
Ref: library/operator operator-map10612161
Ref: 2e2b10612161
Node: インプレース in-place 演算子10620150
Ref: library/operator in-place-operators10620312
Ref: 2e2c10620312
Ref: library/operator operator iadd10621827
Ref: 2e2e10621827
Ref: library/operator operator __iadd__10621863
Ref: 2e2f10621863
Ref: library/operator operator iand10621967
Ref: 2e3010621967
Ref: library/operator operator __iand__10622003
Ref: 2e3110622003
Ref: library/operator operator iconcat10622107
Ref: 2e3210622107
Ref: library/operator operator __iconcat__10622146
Ref: 2e3310622146
Ref: library/operator operator ifloordiv10622308
Ref: 2e3410622308
Ref: library/operator operator __ifloordiv__10622349
Ref: 2e3510622349
Ref: library/operator operator ilshift10622464
Ref: 2e3610622464
Ref: library/operator operator __ilshift__10622503
Ref: 2e3710622503
Ref: library/operator operator imod10622614
Ref: 2e3810622614
Ref: library/operator operator __imod__10622650
Ref: 2e3910622650
Ref: library/operator operator imul10622754
Ref: 2e3a10622754
Ref: library/operator operator __imul__10622790
Ref: 2e3b10622790
Ref: library/operator operator imatmul10622894
Ref: 11ed10622894
Ref: library/operator operator __imatmul__10622933
Ref: 2e3c10622933
Ref: library/operator operator ior10623071
Ref: 2e3d10623071
Ref: library/operator operator __ior__10623106
Ref: 2e3e10623106
Ref: library/operator operator ipow10623208
Ref: 2e3f10623208
Ref: library/operator operator __ipow__10623244
Ref: 2e4010623244
Ref: library/operator operator irshift10623349
Ref: 2e4110623349
Ref: library/operator operator __irshift__10623388
Ref: 2e4210623388
Ref: library/operator operator isub10623499
Ref: 2e4310623499
Ref: library/operator operator __isub__10623535
Ref: 2e4410623535
Ref: library/operator operator itruediv10623639
Ref: 2e4510623639
Ref: library/operator operator __itruediv__10623679
Ref: 2e4610623679
Ref: library/operator operator ixor10623791
Ref: 2e4710623791
Ref: library/operator operator __ixor__10623827
Ref: 2e4810623827
Node: ファイルとディレクトリへのアクセス10623931
Ref: library/filesys doc10624134
Ref: 2e4910624134
Ref: library/filesys file-and-directory-access10624134
Ref: 2e4a10624134
Ref: library/filesys filesys10624134
Ref: 2e4b10624134
Ref: library/filesys translation-repo10624134
Ref: 2e4c10624134
Node: pathlib --- オブジェクト指向のファイルシステムパス10625568
Ref: library/pathlib doc10625773
Ref: 2e4d10625773
Ref: library/pathlib module-pathlib10625773
Ref: a810625773
Ref: library/pathlib pathlib-object-oriented-filesystem-paths10625773
Ref: 2e4e10625773
Ref: pathlib --- オブジェクト指向のファイルシステムパス-Footnote-110628556
Ref: pathlib --- オブジェクト指向のファイルシステムパス-Footnote-210628621
Node: 基本的な使い方<2>10628663
Ref: library/pathlib basic-use10628811
Ref: 2e5210628811
Node: 例外<6>10629920
Ref: library/pathlib exceptions10630089
Ref: 2e5310630089
Ref: library/pathlib pathlib UnsupportedOperation10630120
Ref: 73b10630120
Node: 純粋パス10630374
Ref: library/pathlib id110630531
Ref: 2e5410630531
Ref: library/pathlib pure-paths10630531
Ref: 2e4f10630531
Ref: library/pathlib pathlib PurePath10630833
Ref: 8bb10630833
Ref: library/pathlib pathlib PurePosixPath10633818
Ref: 2e5510633818
Ref: library/pathlib pathlib PureWindowsPath10634151
Ref: 1c9a10634151
Ref: 純粋パス-Footnote-110634987
Node: 全般的な性質10635046
Ref: library/pathlib general-properties10635131
Ref: 2e5610635131
Node: 演算子10636294
Ref: library/pathlib operators10636427
Ref: 2e5710636427
Node: 個別の構成要素へのアクセス10638394
Ref: library/pathlib accessing-individual-parts10638539
Ref: 2e5810638539
Ref: library/pathlib pathlib PurePath parts10638735
Ref: 2e5910638735
Node: メソッドとプロパティ10639195
Ref: library/pathlib methods-and-properties10639322
Ref: 2e5a10639322
Ref: library/pathlib pathlib PurePath parser10639468
Ref: 73e10639468
Ref: library/pathlib pathlib PurePath drive10639690
Ref: 2e5b10639690
Ref: library/pathlib pathlib PurePath root10640155
Ref: 2e5c10640155
Ref: library/pathlib pathlib PurePath anchor10641343
Ref: 2e5d10641343
Ref: library/pathlib pathlib PurePath parents10641734
Ref: bfd10641734
Ref: library/pathlib pathlib PurePath parent10642314
Ref: 1cc010642314
Ref: library/pathlib pathlib PurePath name10643287
Ref: 2e5e10643287
Ref: library/pathlib pathlib PurePath suffix10643726
Ref: 1b8a10643726
Ref: library/pathlib pathlib PurePath suffixes10644236
Ref: 1b8b10644236
Ref: library/pathlib pathlib PurePath stem10644679
Ref: 2e5f10644679
Ref: library/pathlib pathlib PurePath as_posix10645101
Ref: 2e6010645101
Ref: library/pathlib pathlib PurePath is_absolute10645389
Ref: 1cbf10645389
Ref: library/pathlib pathlib PurePath is_relative_to10646052
Ref: 57d10646052
Ref: library/pathlib pathlib PurePath joinpath10646841
Ref: 2e6110646841
Ref: library/pathlib pathlib PurePath full_match10647460
Ref: 73d10647460
Ref: library/pathlib pathlib PurePath match10648448
Ref: 8c110648448
Ref: library/pathlib pathlib PurePath relative_to10649433
Ref: 57c10649433
Ref: library/pathlib pathlib PurePath with_name10651830
Ref: 1c8d10651830
Ref: library/pathlib pathlib PurePath with_stem10652607
Ref: 1c0410652607
Ref: library/pathlib pathlib PurePath with_suffix10653688
Ref: 1b8910653688
Ref: library/pathlib pathlib PurePath with_segments10654588
Ref: 8bc10654588
Ref: メソッドとプロパティ-Footnote-110655530
Node: 具象パス10655622
Ref: library/pathlib concrete-paths10655786
Ref: 2e5010655786
Ref: library/pathlib id210655786
Ref: 2e6310655786
Ref: library/pathlib pathlib Path10656123
Ref: 4f510656123
Ref: library/pathlib pathlib PosixPath10656570
Ref: 2e6410656570
Ref: library/pathlib pathlib WindowsPath10657148
Ref: 2e5110657148
Node: URIのパースと生成10658982
Ref: library/pathlib parsing-and-generating-uris10659088
Ref: 2e6510659088
Ref: library/pathlib pathlib Path from_uri10659364
Ref: 73c10659364
Ref: library/pathlib pathlib Path as_uri10660703
Ref: 58e10660703
Ref: URIのパースと生成-Footnote-110661384
Node: パスの展開と解決10661443
Ref: library/pathlib expanding-and-resolving-paths10661618
Ref: 2e6710661618
Ref: library/pathlib pathlib Path home10661681
Ref: 11f710661681
Ref: library/pathlib pathlib Path expanduser10662114
Ref: 11f610662114
Ref: library/pathlib pathlib Path cwd10662602
Ref: 1cbe10662602
Ref: library/pathlib pathlib Path absolute10662851
Ref: 1c4d10662851
Ref: library/pathlib pathlib Path resolve10663204
Ref: 1c9210663204
Ref: library/pathlib pathlib Path readlink10664463
Ref: cf010664463
Node: ファイルの種類とステータスを問い合わせる10665021
Ref: library/pathlib querying-file-type-and-status10665208
Ref: 2e6810665208
Ref: library/pathlib pathlib Path stat10666153
Ref: c0010666153
Ref: library/pathlib pathlib Path lstat10666955
Ref: 2e6910666955
Ref: library/pathlib pathlib Path exists10667214
Ref: dde10667214
Ref: library/pathlib pathlib Path is_file10668063
Ref: 74110668063
Ref: library/pathlib pathlib Path is_dir10668707
Ref: 74210668707
Ref: library/pathlib pathlib Path is_symlink10669374
Ref: de010669374
Ref: library/pathlib pathlib Path is_junction10669728
Ref: 8c010669728
Ref: library/pathlib pathlib Path is_mount10670027
Ref: ddf10670027
Ref: library/pathlib pathlib Path is_socket10671034
Ref: de410671034
Ref: library/pathlib pathlib Path is_fifo10671346
Ref: de310671346
Ref: library/pathlib pathlib Path is_block_device10671640
Ref: de110671640
Ref: library/pathlib pathlib Path is_char_device10671960
Ref: de210671960
Ref: library/pathlib pathlib Path samefile10672287
Ref: 11f510672287
Ref: library/pathlib pathlib Path info10672989
Ref: 4fa10672989
Node: ファイルを読み書きする<2>10674234
Ref: library/pathlib reading-and-writing-files10674424
Ref: 2e6a10674424
Ref: library/pathlib pathlib Path open10674502
Ref: 2e6b10674502
Ref: library/pathlib pathlib Path read_text10674875
Ref: 11f910674875
Ref: library/pathlib pathlib Path read_bytes10675471
Ref: 56110675471
Ref: library/pathlib pathlib Path write_text10675800
Ref: 11f810675800
Ref: library/pathlib pathlib Path write_bytes10676524
Ref: 11fa10676524
Node: ディレクトリを読む10677013
Ref: library/pathlib reading-directories10677185
Ref: 2e6c10677185
Ref: library/pathlib pathlib Path iterdir10677253
Ref: 4fd10677253
Ref: library/pathlib pathlib Path glob10678265
Ref: 73f10678265
Ref: library/pathlib pathlib Path rglob10680958
Ref: 74010680958
Ref: library/pathlib pathlib Path walk10682197
Ref: 8bd10682197
Node: ファイルとディレクトリの作成10687206
Ref: library/pathlib creating-files-and-directories10687369
Ref: 2e6e10687369
Ref: library/pathlib pathlib Path touch10687462
Ref: 2e6f10687462
Ref: library/pathlib pathlib Path mkdir10688193
Ref: 2e410688193
Ref: library/pathlib pathlib Path symlink_to10689959
Ref: bff10689959
Ref: library/pathlib pathlib Path hardlink_to10691387
Ref: bfe10691387
Node: Copying moving and deleting10691907
Ref: library/pathlib copying-moving-and-deleting10692076
Ref: 2e7010692076
Ref: library/pathlib pathlib Path copy10692155
Ref: 4f610692155
Ref: library/pathlib pathlib Path copy_into10693314
Ref: 4f710693314
Ref: library/pathlib pathlib Path rename10693697
Ref: 1ad410693697
Ref: library/pathlib pathlib Path replace10694944
Ref: 2e7110694944
Ref: library/pathlib pathlib Path move10695670
Ref: 4f810695670
Ref: library/pathlib pathlib Path move_into10696353
Ref: 4f910696353
Ref: library/pathlib pathlib Path unlink10696609
Ref: 1fe310696609
Ref: library/pathlib pathlib Path rmdir10697273
Ref: 2e6d10697273
Node: パーミッションと所有者10697424
Ref: library/pathlib permissions-and-ownership10697542
Ref: 2e7210697542
Ref: library/pathlib pathlib Path owner10697620
Ref: 74310697620
Ref: library/pathlib pathlib Path group10698479
Ref: 74410698479
Ref: library/pathlib pathlib Path chmod10699341
Ref: c0110699341
Ref: library/pathlib pathlib Path lchmod10700149
Ref: 2e7310700149
Node: Pattern language10700423
Ref: library/pathlib pathlib-pattern-language10700607
Ref: 2e6210700607
Ref: library/pathlib pattern-language10700607
Ref: 2e7410700607
Node: glob モジュールとの比較10703162
Ref: library/pathlib comparison-to-the-glob-module10703373
Ref: 2e7510703373
Node: os と os path モジュールの比較10704802
Ref: library/pathlib comparison-to-the-os-and-os-path-modules10705012
Ref: 2e7610705012
Node: 対応するツール10707172
Ref: library/pathlib corresponding-tools10707269
Ref: 2e7710707269
Ref: 対応するツール-Footnote-110712584
Ref: 対応するツール-Footnote-210712892
Ref: 対応するツール-Footnote-310713072
Ref: 対応するツール-Footnote-410713294
Node: プロトコル10713526
Ref: library/pathlib module-pathlib types10713695
Ref: a910713695
Ref: library/pathlib protocols10713695
Ref: 2e7a10713695
Ref: library/pathlib pathlib types PathInfo10713840
Ref: 4fb10713840
Ref: library/pathlib pathlib types PathInfo exists10714036
Ref: 2e7b10714036
Ref: library/pathlib pathlib types PathInfo is_dir10714391
Ref: 2e7c10714391
Ref: library/pathlib pathlib types PathInfo is_file10714906
Ref: 2e7d10714906
Ref: library/pathlib pathlib types PathInfo is_symlink10715421
Ref: 2e7e10715421
Node: os path --- 一般的なパス名操作10715648
Ref: library/os path doc10715900
Ref: 2e7f10715900
Ref: library/os path module-os path10715900
Ref: a610715900
Ref: library/os path os-path-common-pathname-manipulations10715900
Ref: 2e8010715900
Ref: library/os path translation-repo10715900
Ref: 2e8110715900
Ref: library/os path os path abspath10718342
Ref: 16d410718342
Ref: library/os path os path basename10718763
Ref: 2e7910718763
Ref: library/os path os path commonpath10719377
Ref: 33c10719377
Ref: library/os path os path commonprefix10720000
Ref: 33b10720000
Ref: library/os path os path dirname10721322
Ref: 2e7810721322
Ref: library/os path os path exists10721667
Ref: dd610721667
Ref: library/os path os path lexists10722554
Ref: dd710722554
Ref: library/os path os path expanduser10722896
Ref: ddc10722896
Ref: library/os path os path expandvars10724314
Ref: 179210724314
Ref: library/os path os path getatime10724951
Ref: 2e8310724951
Ref: library/os path os path getmtime10725255
Ref: 2e8410725255
Ref: library/os path os path getctime10725683
Ref: 2e8510725683
Ref: library/os path os path getsize10726323
Ref: 2e8610726323
Ref: library/os path os path isabs10726674
Ref: 73910726674
Ref: library/os path os path isfile10727230
Ref: dd910727230
Ref: library/os path os path isdir10727685
Ref: dd810727685
Ref: library/os path os path isjunction10728141
Ref: 8b810728141
Ref: library/os path os path islink10728409
Ref: dd410728409
Ref: library/os path os path ismount10728863
Ref: dda10728863
Ref: library/os path os path isdevdrive10729932
Ref: 1beb10729932
Ref: library/os path os path isreserved10730776
Ref: 2e510730776
Ref: library/os path os path join10731634
Ref: 1a6210731634
Ref: library/os path os path normcase10733135
Ref: 2e8710733135
Ref: library/os path os path normpath10733591
Ref: 16d310733591
Ref: library/os path os path realpath10734682
Ref: 24d10734682
Ref: library/os path os path ALL_BUT_LAST10737221
Ref: 2e8810737221
Ref: library/os path os path ALLOW_MISSING10737369
Ref: 24e10737369
Ref: library/os path os path relpath10737518
Ref: 8bf10737518
Ref: library/os path os path samefile10738195
Ref: 132010738195
Ref: library/os path os path sameopenfile10738931
Ref: 2e8a10738931
Ref: library/os path os path samestat10739304
Ref: 131f10739304
Ref: library/os path os path split10739848
Ref: 2e8210739848
Ref: library/os path os path splitdrive10740710
Ref: fb810740710
Ref: library/os path os path splitroot10741704
Ref: 8b910741704
Ref: library/os path os path splitext10742975
Ref: 1b8c10742975
Ref: library/os path os path supports_unicode_filenames10743990
Ref: 184610743990
Ref: os path --- 一般的なパス名操作-Footnote-110744223
Ref: os path --- 一般的なパス名操作-Footnote-210744294
Ref: os path --- 一般的なパス名操作-Footnote-310744363
Ref: os path --- 一般的なパス名操作-Footnote-410744429
Ref: os path --- 一般的なパス名操作-Footnote-510744484
Ref: os path --- 一般的なパス名操作-Footnote-610744576
Node: stat --- stat の結果を解釈する10744668
Ref: library/stat doc10744905
Ref: 2e8b10744905
Ref: library/stat module-stat10744905
Ref: d910744905
Ref: library/stat stat-interpreting-stat-results10744905
Ref: 2e8c10744905
Ref: library/stat translation-repo10744905
Ref: 2e8d10744905
Ref: library/stat stat S_ISDIR10745623
Ref: 2e8e10745623
Ref: library/stat stat S_ISCHR10745759
Ref: 2e8f10745759
Ref: library/stat stat S_ISBLK10745934
Ref: 2e9010745934
Ref: library/stat stat S_ISREG10746106
Ref: 2e9110746106
Ref: library/stat stat S_ISFIFO10746242
Ref: 2e9210746242
Ref: library/stat stat S_ISLNK10746397
Ref: 2e9310746397
Ref: library/stat stat S_ISSOCK10746548
Ref: 2e9410746548
Ref: library/stat stat S_ISDOOR10746679
Ref: 1fbb10746679
Ref: library/stat stat S_ISPORT10746832
Ref: 1fbc10746832
Ref: library/stat stat S_ISWHT10747000
Ref: 1fbd10747000
Ref: library/stat stat S_IMODE10747279
Ref: 2e9510747279
Ref: library/stat stat S_IFMT10747726
Ref: 2e9610747726
Ref: library/stat stat filemode10749331
Ref: 150b10749331
Ref: library/stat stat ST_MODE10749880
Ref: 136810749880
Ref: library/stat stat ST_INO10749947
Ref: 2e9710749947
Ref: library/stat stat ST_DEV10750001
Ref: 2e9810750001
Ref: library/stat stat ST_NLINK10750076
Ref: 2e9910750076
Ref: library/stat stat ST_UID10750157
Ref: 2e9a10750157
Ref: library/stat stat ST_GID10750234
Ref: 2e9b10750234
Ref: library/stat stat ST_SIZE10750314
Ref: 2e9c10750314
Ref: library/stat stat ST_ATIME10750469
Ref: 2e9d10750469
Ref: library/stat stat ST_MTIME10750542
Ref: 2e9e10750542
Ref: library/stat stat ST_CTIME10750612
Ref: 2e9f10750612
Ref: library/stat stat S_IFSOCK10752066
Ref: 2ea010752066
Ref: library/stat stat S_IFLNK10752118
Ref: 2ea110752118
Ref: library/stat stat S_IFREG10752184
Ref: 2ea210752184
Ref: library/stat stat S_IFBLK10752244
Ref: 2ea310752244
Ref: library/stat stat S_IFDIR10752307
Ref: 2ea410752307
Ref: library/stat stat S_IFCHR10752364
Ref: 2ea510752364
Ref: library/stat stat S_IFIFO10752433
Ref: 2ea610752433
Ref: library/stat stat S_IFDOOR10752476
Ref: 136910752476
Ref: library/stat stat S_IFPORT10752550
Ref: 136a10752550
Ref: library/stat stat S_IFWHT10752639
Ref: 136b10752639
Ref: library/stat stat S_ISUID10753071
Ref: 2ea710753071
Ref: library/stat stat S_ISGID10753138
Ref: 2ea810753138
Ref: library/stat stat S_ISVTX10754020
Ref: 2eab10754020
Ref: library/stat stat S_IRWXU10754431
Ref: 2eac10754431
Ref: library/stat stat S_IRUSR10754524
Ref: 2ead10754524
Ref: library/stat stat S_IWUSR10754611
Ref: 2eae10754611
Ref: library/stat stat S_IXUSR10754698
Ref: 2eaf10754698
Ref: library/stat stat S_IRWXG10754782
Ref: 2eb010754782
Ref: library/stat stat S_IRGRP10754863
Ref: 2eb110754863
Ref: library/stat stat S_IWGRP10754950
Ref: 2eb210754950
Ref: library/stat stat S_IXGRP10755037
Ref: 2ea910755037
Ref: library/stat stat S_IRWXO10755121
Ref: 2eb310755121
Ref: library/stat stat S_IROTH10755218
Ref: 2eb410755218
Ref: library/stat stat S_IWOTH10755302
Ref: 2eb510755302
Ref: library/stat stat S_IXOTH10755386
Ref: 2eb610755386
Ref: library/stat stat S_ENFMT10755467
Ref: 2eaa10755467
Ref: library/stat stat S_IREAD10755784
Ref: 2eb710755784
Ref: library/stat stat S_IWRITE10755874
Ref: 2eb810755874
Ref: library/stat stat S_IEXEC10755965
Ref: 2eb910755965
Ref: library/stat stat UF_SETTABLE10756152
Ref: 2eba10756152
Ref: library/stat stat UF_NODUMP10756245
Ref: 2ebb10756245
Ref: library/stat stat UF_IMMUTABLE10756319
Ref: 2ebc10756319
Ref: library/stat stat UF_APPEND10756396
Ref: 2ebd10756396
Ref: library/stat stat UF_OPAQUE10756476
Ref: 2ebe10756476
Ref: library/stat stat UF_NOUNLINK10756637
Ref: 2ebf10756637
Ref: library/stat stat UF_COMPRESSED10756728
Ref: 2ec010756728
Ref: library/stat stat UF_TRACKED10756829
Ref: 2ec110756829
Ref: library/stat stat UF_DATAVAULT10756935
Ref: 2ec210756935
Ref: library/stat stat UF_HIDDEN10757072
Ref: 2ec310757072
Ref: library/stat stat SF_SETTABLE10757180
Ref: 2ec410757180
Ref: library/stat stat SF_SUPPORTED10757280
Ref: 2ec510757280
Ref: library/stat stat SF_SYNTHETIC10757419
Ref: 2ec610757419
Ref: library/stat stat SF_ARCHIVED10757568
Ref: 2ec710757568
Ref: library/stat stat SF_IMMUTABLE10757677
Ref: 2ec810757677
Ref: library/stat stat SF_APPEND10757754
Ref: 2ec910757754
Ref: library/stat stat SF_RESTRICTED10757834
Ref: 2eca10757834
Ref: library/stat stat SF_NOUNLINK10757961
Ref: 2ecb10757961
Ref: library/stat stat SF_SNAPSHOT10758052
Ref: 2ecc10758052
Ref: library/stat stat SF_FIRMLINK10758158
Ref: 2ecd10758158
Ref: library/stat stat SF_DATALESS10758264
Ref: 2ece10758264
Ref: library/stat stat FILE_ATTRIBUTE_ARCHIVE10758789
Ref: 2ecf10758789
Ref: library/stat stat FILE_ATTRIBUTE_COMPRESSED10758832
Ref: 2ed010758832
Ref: library/stat stat FILE_ATTRIBUTE_DEVICE10758878
Ref: 2ed110758878
Ref: library/stat stat FILE_ATTRIBUTE_DIRECTORY10758920
Ref: 2ed210758920
Ref: library/stat stat FILE_ATTRIBUTE_ENCRYPTED10758965
Ref: 2ed310758965
Ref: library/stat stat FILE_ATTRIBUTE_HIDDEN10759010
Ref: 2ed410759010
Ref: library/stat stat FILE_ATTRIBUTE_INTEGRITY_STREAM10759052
Ref: 2ed510759052
Ref: library/stat stat FILE_ATTRIBUTE_NORMAL10759104
Ref: 2ed610759104
Ref: library/stat stat FILE_ATTRIBUTE_NOT_CONTENT_INDEXED10759146
Ref: 2ed710759146
Ref: library/stat stat FILE_ATTRIBUTE_NO_SCRUB_DATA10759201
Ref: 2ed810759201
Ref: library/stat stat FILE_ATTRIBUTE_OFFLINE10759250
Ref: 2ed910759250
Ref: library/stat stat FILE_ATTRIBUTE_READONLY10759293
Ref: 2eda10759293
Ref: library/stat stat FILE_ATTRIBUTE_REPARSE_POINT10759337
Ref: 2edb10759337
Ref: library/stat stat FILE_ATTRIBUTE_SPARSE_FILE10759386
Ref: 2edc10759386
Ref: library/stat stat FILE_ATTRIBUTE_SYSTEM10759433
Ref: 2edd10759433
Ref: library/stat stat FILE_ATTRIBUTE_TEMPORARY10759475
Ref: 2ede10759475
Ref: library/stat stat FILE_ATTRIBUTE_VIRTUAL10759520
Ref: 2edf10759520
Ref: library/stat stat IO_REPARSE_TAG_SYMLINK10759834
Ref: 2ee010759834
Ref: library/stat stat IO_REPARSE_TAG_MOUNT_POINT10759877
Ref: 2ee110759877
Ref: library/stat stat IO_REPARSE_TAG_APPEXECLINK10759924
Ref: 2ee210759924
Ref: library/stat stat STATX_ATTR_COMPRESSED10760291
Ref: 2ee510760291
Ref: library/stat stat STATX_ATTR_IMMUTABLE10760333
Ref: 2ee610760333
Ref: library/stat stat STATX_ATTR_APPEND10760374
Ref: 2ee710760374
Ref: library/stat stat STATX_ATTR_NODUMP10760412
Ref: 2ee810760412
Ref: library/stat stat STATX_ATTR_ENCRYPTED10760450
Ref: 2ee910760450
Ref: library/stat stat STATX_ATTR_AUTOMOUNT10760491
Ref: 2eea10760491
Ref: library/stat stat STATX_ATTR_MOUNT_ROOT10760532
Ref: 2eeb10760532
Ref: library/stat stat STATX_ATTR_VERITY10760574
Ref: 2eec10760574
Ref: library/stat stat STATX_ATTR_DAX10760612
Ref: 2eed10760612
Ref: library/stat stat STATX_ATTR_WRITE_ATOMIC10760647
Ref: 2eee10760647
Ref: stat --- stat の結果を解釈する-Footnote-110760757
Ref: stat --- stat の結果を解釈する-Footnote-210760821
Ref: stat --- stat の結果を解釈する-Footnote-310760868
Ref: stat --- stat の結果を解釈する-Footnote-410760948
Node: filecmp --- ファイルとディレクトリの比較10760993
Ref: library/filecmp doc10761252
Ref: 2eef10761252
Ref: library/filecmp filecmp-file-and-directory-comparisons10761252
Ref: 2ef010761252
Ref: library/filecmp module-filecmp10761252
Ref: 5d10761252
Ref: library/filecmp translation-repo10761252
Ref: 2ef110761252
Ref: library/filecmp filecmp cmp10761728
Ref: 1c0510761728
Ref: library/filecmp filecmp cmpfiles10762711
Ref: 1b7c10762711
Ref: library/filecmp filecmp clear_cache10763937
Ref: 12ee10763937
Ref: filecmp --- ファイルとディレクトリの比較-Footnote-110764275
Node: dircmp クラス10764342
Ref: library/filecmp dircmp-objects10764449
Ref: 2ef210764449
Ref: library/filecmp the-dircmp-class10764449
Ref: 2ef310764449
Ref: library/filecmp filecmp dircmp10764507
Ref: 12f010764507
Ref: library/filecmp filecmp dircmp report10765202
Ref: 2ef410765202
Ref: library/filecmp filecmp dircmp report_partial_closure10765320
Ref: 2ef510765320
Ref: library/filecmp filecmp dircmp report_full_closure10765522
Ref: 2ef610765522
Ref: library/filecmp filecmp dircmp left10766173
Ref: 2ef710766173
Ref: library/filecmp filecmp dircmp right10766243
Ref: 2ef810766243
Ref: library/filecmp filecmp dircmp left_list10766314
Ref: 2ef910766314
Ref: library/filecmp filecmp dircmp right_list10766496
Ref: 2efa10766496
Ref: library/filecmp filecmp dircmp common10766679
Ref: 2efb10766679
Ref: library/filecmp filecmp dircmp left_only10766820
Ref: 2efc10766820
Ref: library/filecmp filecmp dircmp right_only10766936
Ref: 2efd10766936
Ref: library/filecmp filecmp dircmp common_dirs10767053
Ref: 2efe10767053
Ref: library/filecmp filecmp dircmp common_files10767167
Ref: 2eff10767167
Ref: library/filecmp filecmp dircmp common_funny10767270
Ref: 2f0010767270
Ref: library/filecmp filecmp dircmp same_files10767491
Ref: 2f0110767491
Ref: library/filecmp filecmp dircmp diff_files10767667
Ref: 2f0210767667
Ref: library/filecmp filecmp dircmp funny_files10767857
Ref: 2f0310767857
Ref: library/filecmp filecmp dircmp subdirs10767986
Ref: 1ef910767986
Ref: library/filecmp filecmp DEFAULT_IGNORES10768418
Ref: 12ef10768418
Node: tempfile --- 一時ファイルやディレクトリの作成10769181
Ref: library/tempfile doc10769455
Ref: 2f0410769455
Ref: library/tempfile module-tempfile10769455
Ref: e910769455
Ref: library/tempfile tempfile-generate-temporary-files-and-directories10769455
Ref: 2f0510769455
Ref: library/tempfile translation-repo10769455
Ref: 2f0610769455
Ref: library/tempfile tempfile TemporaryFile10771000
Ref: 1a2d10771000
Ref: library/tempfile tempfile NamedTemporaryFile10773856
Ref: 8db10773856
Ref: library/tempfile tempfile SpooledTemporaryFile10777732
Ref: a8710777732
Ref: library/tempfile tempfile SpooledTemporaryFile rollover10778348
Ref: 2f0910778348
Ref: library/tempfile tempfile TemporaryDirectory10779690
Ref: 15ef10779690
Ref: library/tempfile tempfile TemporaryDirectory name10780358
Ref: 2f0a10780358
Ref: library/tempfile tempfile TemporaryDirectory cleanup10780763
Ref: 2f0b10780763
Ref: library/tempfile tempfile mkstemp10782111
Ref: 2f0710782111
Ref: library/tempfile tempfile mkdtemp10785920
Ref: 73510785920
Ref: library/tempfile tempfile gettempdir10787487
Ref: 1ea810787487
Ref: library/tempfile tempfile gettempdirb10788912
Ref: 1ea910788912
Ref: library/tempfile tempfile gettempprefix10789058
Ref: 2f0c10789058
Ref: library/tempfile tempfile gettempprefixb10789267
Ref: 2f0d10789267
Ref: library/tempfile tempfile tempdir10789847
Ref: 1ea710789847
Ref: tempfile --- 一時ファイルやディレクトリの作成-Footnote-110791025
Node: 使用例<8>10791093
Ref: library/tempfile examples10791239
Ref: 2f0e10791239
Ref: library/tempfile tempfile-examples10791239
Ref: 2f0810791239
Node: 非推奨の関数と変数10792628
Ref: library/tempfile deprecated-functions-and-variables10792774
Ref: 2f0f10792774
Ref: library/tempfile tempfile-mktemp-deprecated10792774
Ref: 2f1010792774
Ref: library/tempfile tempfile mktemp10793555
Ref: 1e4610793555
Node: glob --- Unix 形式のパス名のパターン展開10794969
Ref: library/glob doc10795245
Ref: 2f1110795245
Ref: library/glob glob-unix-style-pathname-pattern-expansion10795245
Ref: 2f1210795245
Ref: library/glob module-glob10795245
Ref: 6710795245
Ref: library/glob translation-repo10795245
Ref: 2f1310795245
Ref: library/glob glob glob10796458
Ref: 2df10796458
Ref: library/glob glob iglob10799690
Ref: be510799690
Ref: library/glob glob escape10801045
Ref: 12f510801045
Ref: library/glob glob translate10801556
Ref: 70610801556
Ref: glob --- Unix 形式のパス名のパターン展開-Footnote-110803496
Node: 使用例<9>10803560
Ref: library/glob examples10803662
Ref: 2f1410803662
Node: fnmatch --- Unix のファイル名パターンマッチ10804981
Ref: library/fnmatch doc10805261
Ref: 2f1510805261
Ref: library/fnmatch fnmatch-unix-filename-pattern-matching10805261
Ref: 2f1610805261
Ref: library/fnmatch module-fnmatch10805261
Ref: 5f10805261
Ref: library/fnmatch translation-repo10805261
Ref: 2f1710805261
Ref: library/fnmatch fnmatch fnmatch10807539
Ref: 1e6a10807539
Ref: library/fnmatch fnmatch fnmatchcase10808429
Ref: 1e6b10808429
Ref: library/fnmatch fnmatch filter10808755
Ref: 1e6c10808755
Ref: library/fnmatch fnmatch filterfalse10809048
Ref: 4a810809048
Ref: library/fnmatch fnmatch translate10809387
Ref: 1a9910809387
Ref: fnmatch --- Unix のファイル名パターンマッチ-Footnote-110810039
Node: linecache --- テキストラインへのランダムアクセス10810106
Ref: library/linecache doc10810374
Ref: 2f1810810374
Ref: library/linecache linecache-random-access-to-text-lines10810374
Ref: 2f1910810374
Ref: library/linecache module-linecache10810374
Ref: 8810810374
Ref: library/linecache translation-repo10810374
Ref: 2f1a10810374
Ref: library/linecache linecache getline10811336
Ref: 4d410811336
Ref: library/linecache linecache clearcache10812595
Ref: 2f1c10812595
Ref: library/linecache linecache checkcache10812848
Ref: 1b2a10812848
Ref: library/linecache linecache lazycache10813253
Ref: 11db10813253
Ref: linecache --- テキストラインへのランダムアクセス-Footnote-110813940
Ref: linecache --- テキストラインへのランダムアクセス-Footnote-210814009
Node: shutil --- 高水準のファイル操作10814051
Ref: library/shutil doc10814254
Ref: 2f1d10814254
Ref: library/shutil module-shutil10814254
Ref: cd10814254
Ref: library/shutil shutil-high-level-file-operations10814254
Ref: 2f1e10814254
Ref: library/shutil translation-repo10814254
Ref: 2f1f10814254
Ref: shutil --- 高水準のファイル操作-Footnote-110815646
Node: ディレクトリとファイルの操作10815712
Ref: library/shutil directory-and-files-operations10815865
Ref: 2f2010815865
Ref: library/shutil file-operations10815865
Ref: 2f2110815865
Ref: library/shutil shutil copyfileobj10815956
Ref: e2510815956
Ref: library/shutil shutil copyfile10817181
Ref: e2110817181
Ref: library/shutil shutil SpecialFileError10819402
Ref: 16d510819402
Ref: library/shutil shutil SameFileError10819587
Ref: 134c10819587
Ref: library/shutil shutil copymode10819757
Ref: 1c4b10819757
Ref: library/shutil shutil copystat10820937
Ref: 14ef10820937
Ref: library/shutil shutil copy10823573
Ref: e2210823573
Ref: library/shutil shutil copy210825690
Ref: e2310825690
Ref: library/shutil shutil ignore_patterns10827835
Ref: 2f2210827835
Ref: library/shutil shutil copytree10828207
Ref: df110828207
Ref: library/shutil shutil rmtree10832571
Ref: 33d10832571
Ref: library/shutil shutil rmtree avoids_symlink_attacks10835997
Ref: 2f2310835997
Ref: library/shutil shutil move10836473
Ref: e2410836473
Ref: library/shutil shutil disk_usage10838905
Ref: 14ee10838905
Ref: library/shutil shutil chown10839818
Ref: 75010839818
Ref: library/shutil shutil which10840614
Ref: 8c910840614
Ref: library/shutil shutil Error10843347
Ref: 134b10843347
Node: プラットフォーム依存の効率的なコピー操作10843704
Ref: library/shutil platform-dependent-efficient-copy-operations10843867
Ref: 2f2510843867
Ref: library/shutil shutil-platform-dependent-efficient-copy-operations10843867
Ref: e2610843867
Ref: プラットフォーム依存の効率的なコピー操作-Footnote-110845809
Ref: プラットフォーム依存の効率的なコピー操作-Footnote-210845874
Node: copytree の例10845922
Ref: library/shutil copytree-example10846107
Ref: 2f2610846107
Ref: library/shutil shutil-copytree-example10846107
Ref: 2f2710846107
Node: rmtree の例10846809
Ref: library/shutil rmtree-example10846925
Ref: 2f2810846925
Ref: library/shutil shutil-rmtree-example10846925
Ref: 2f2410846925
Node: アーカイブ化操作10847600
Ref: library/shutil archiving-operations10847804
Ref: 15d510847804
Ref: library/shutil id110847804
Ref: 2f2910847804
Ref: library/shutil shutil make_archive10848214
Ref: 8c810848214
Ref: library/shutil shutil get_archive_formats10851291
Ref: 2f2c10851291
Ref: library/shutil shutil register_archive_format10852577
Ref: 2f2b10852577
Ref: library/shutil shutil unregister_archive_format10854137
Ref: 2f2d10854137
Ref: library/shutil shutil unpack_archive10854337
Ref: 88710854337
Ref: library/shutil shutil register_unpack_format10856666
Ref: 2f2e10856666
Ref: library/shutil shutil unregister_unpack_format10857709
Ref: 2f3110857709
Ref: library/shutil shutil get_unpack_formats10857884
Ref: 2f3010857884
Ref: アーカイブ化操作-Footnote-110859298
Node: アーカイブ化の例10859340
Ref: library/shutil archiving-example10859479
Ref: 2f3210859479
Ref: library/shutil shutil-archiving-example10859479
Ref: 2f3310859479
Node: base_dir を使ったアーカイブ化の例10860654
Ref: library/shutil archiving-example-with-base-dir10860793
Ref: 2f3410860793
Ref: library/shutil shutil-archiving-example-with-basedir10860793
Ref: 2f2a10860793
Node: 出力ターミナルのサイズの取得10862073
Ref: library/shutil querying-the-size-of-the-output-terminal10862226
Ref: 2f3510862226
Ref: library/shutil shutil get_terminal_size10862317
Ref: 14c410862317
Ref: 出力ターミナルのサイズの取得-Footnote-110864310
Node: データの永続化10864393
Ref: library/persistence doc10864581
Ref: 2f3810864581
Ref: library/persistence data-persistence10864581
Ref: 2f3910864581
Ref: library/persistence persistence10864581
Ref: 2f3a10864581
Ref: library/persistence translation-repo10864581
Ref: 2f3b10864581
Node: pickle --- Python オブジェクトの直列化10865914
Ref: library/pickle doc10866081
Ref: 2f3c10866081
Ref: library/pickle module-pickle10866081
Ref: ab10866081
Ref: library/pickle pickle-python-object-serialization10866081
Ref: 2f3d10866081
Ref: pickle --- Python オブジェクトの直列化-Footnote-110868294
Ref: pickle --- Python オブジェクトの直列化-Footnote-210868360
Node: 他の Python モジュールとの関係10868457
Ref: library/pickle relationship-to-other-python-modules10868625
Ref: 2f3f10868625
Node: marshal との比較10868774
Ref: library/pickle comparison-with-marshal10868898
Ref: 2f4010868898
Node: json との比較10870226
Ref: library/pickle comparison-with-json10870350
Ref: 2f3e10870350
Ref: library/pickle id210870350
Ref: 2f4110870350
Ref: json との比較-Footnote-110871768
Node: データストリームの形式10871793
Ref: library/pickle data-stream-format10872009
Ref: 2f4310872009
Ref: library/pickle pickle-protocols10872009
Ref: 50a10872009
Ref: データストリームの形式-Footnote-110875746
Ref: データストリームの形式-Footnote-210875788
Ref: データストリームの形式-Footnote-310875830
Node: モジュールインターフェース10875872
Ref: library/pickle module-interface10876089
Ref: 2f4610876089
Ref: library/pickle pickle HIGHEST_PROTOCOL10876675
Ref: 185d10876675
Ref: library/pickle pickle DEFAULT_PROTOCOL10877004
Ref: c0b10877004
Ref: library/pickle pickle dump10877803
Ref: 2f4710877803
Ref: library/pickle pickle dumps10878391
Ref: 185c10878391
Ref: library/pickle pickle load10878891
Ref: 10ce10878891
Ref: library/pickle pickle loads10879821
Ref: 10cf10879821
Ref: library/pickle pickle PickleError10880723
Ref: 2f4810880723
Ref: library/pickle pickle PicklingError10880867
Ref: 1b7910880867
Ref: library/pickle pickle UnpicklingError10881263
Ref: 2f4a10881263
Ref: library/pickle pickle Pickler10881904
Ref: de610881904
Ref: library/pickle pickle Pickler dump10884204
Ref: 203210884204
Ref: library/pickle pickle Pickler persistent_id10884426
Ref: 1b4710884426
Ref: library/pickle pickle Pickler dispatch_table10885508
Ref: 14e310885508
Ref: library/pickle pickle Pickler reducer_override10886976
Ref: de710886976
Ref: library/pickle pickle Pickler fast10887899
Ref: 2f5010887899
Ref: library/pickle pickle Pickler clear_memo10888566
Ref: 2f5210888566
Ref: library/pickle pickle Unpickler10888901
Ref: 199910888901
Ref: library/pickle pickle Unpickler load10891818
Ref: 2f5310891818
Ref: library/pickle pickle Unpickler persistent_load10892217
Ref: 1b4e10892217
Ref: library/pickle pickle Unpickler find_class10892949
Ref: 19d510892949
Ref: library/pickle pickle PickleBuffer10893953
Ref: 192910893953
Ref: library/pickle pickle PickleBuffer raw10894861
Ref: 2f5510894861
Ref: library/pickle pickle PickleBuffer release10895301
Ref: 2f5610895301
Ref: モジュールインターフェース-Footnote-110895501
Node: pickle 化、非 pickle 化できるもの10895543
Ref: library/pickle pickle-picklable10895768
Ref: 2f4910895768
Ref: library/pickle what-can-be-pickled-and-unpickled10895768
Ref: 2f5710895768
Ref: pickle 化、非 pickle 化できるもの-Footnote-110899420
Ref: pickle 化、非 pickle 化できるもの-Footnote-210899607
Node: クラスインスタンスの pickle 化10899759
Ref: library/pickle pickle-inst10900041
Ref: 2f4210900041
Ref: library/pickle pickling-class-instances10900041
Ref: 2f5810900041
Ref: library/pickle object __getnewargs_ex__10901363
Ref: 2f5910901363
Ref: library/pickle object __getnewargs__10902291
Ref: 119110902291
Ref: library/pickle object __getstate__10903031
Ref: 9d810903031
Ref: library/pickle object __setstate__10904381
Ref: d9c10904381
Ref: library/pickle object __reduce__10906972
Ref: d9b10906972
Ref: library/pickle object __reduce_ex__10911007
Ref: 1b9d10911007
Ref: クラスインスタンスの pickle 化-Footnote-110911874
Node: 外部オブジェクトの永続化10912008
Ref: library/pickle persistence-of-external-objects10912161
Ref: 2f5b10912161
Ref: library/pickle pickle-persistent10912161
Ref: 2f4c10912161
Ref: 外部オブジェクトの永続化-Footnote-110916930
Node: ディスパッチテーブル10917258
Ref: library/pickle dispatch-tables10917462
Ref: 2f5c10917462
Ref: library/pickle pickle-dispatch10917462
Ref: 2f4e10917462
Node: 状態を持つオブジェクトの扱い10919035
Ref: library/pickle handling-stateful-objects10919194
Ref: 2f5d10919194
Ref: library/pickle pickle-state10919194
Ref: 2f5a10919194
Node: 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ10921499
Ref: library/pickle custom-reduction-for-types-functions-and-other-objects10921778
Ref: 2f5e10921778
Ref: library/pickle reducer-override10921778
Ref: 2f4f10921778
Node: アウトオブバウンドバッファ10924253
Ref: library/pickle out-of-band-buffers10924527
Ref: 2f5f10924527
Ref: library/pickle pickle-oob10924527
Ref: 2f4b10924527
Node: 生産者 API10925431
Ref: library/pickle provider-api10925542
Ref: 2f6010925542
Node: 消費者 API10926273
Ref: library/pickle consumer-api10926406
Ref: 2f6110926406
Node: 使用例<10>10928092
Ref: library/pickle example10928203
Ref: 2f6210928203
Ref: 使用例<10>-Footnote-110931073
Node: グローバル変数を制限する10931115
Ref: library/pickle pickle-restrict10931302
Ref: 2f5410931302
Ref: library/pickle restricting-globals10931302
Ref: 2f6310931302
Node: 性能<2>10934675
Ref: library/pickle performance10934836
Ref: 2f6410934836
Node: 使用例<11>10935095
Ref: library/pickle examples10935268
Ref: 2f6510935268
Ref: library/pickle pickle-example10935268
Ref: 2f6610935268
Node: コマンドライン・インターフェース10936096
Ref: library/pickle command-line-interface10936251
Ref: 2f6710936251
Ref: library/pickle pickle-cli10936251
Ref: 2f6810936251
Ref: library/pickle cmdoption-pickle-arg-pickle_file10936774
Ref: 2f6a10936774
Node: copyreg --- pickle サポート関数を登録する10937423
Ref: library/copyreg doc10937647
Ref: 2f6b10937647
Ref: library/copyreg copyreg-register-pickle-support-functions10937647
Ref: 2f6c10937647
Ref: library/copyreg module-copyreg10937647
Ref: 2a10937647
Ref: library/copyreg translation-repo10937647
Ref: 2f6d10937647
Ref: library/copyreg copyreg constructor10938245
Ref: 2f6e10938245
Ref: library/copyreg copyreg pickle10938541
Ref: 2f4d10938541
Ref: copyreg --- pickle サポート関数を登録する-Footnote-110939511
Node: 使用例<12>10939578
Ref: library/copyreg example10939680
Ref: 2f6f10939680
Node: shelve --- Python オブジェクトの永続化10940262
Ref: library/shelve doc10940506
Ref: 2f7010940506
Ref: library/shelve module-shelve10940506
Ref: cb10940506
Ref: library/shelve shelve-python-object-persistence10940506
Ref: 2f7110940506
Ref: library/shelve translation-repo10940506
Ref: 2f7210940506
Ref: library/shelve shelve open10941285
Ref: 1c9610941285
Ref: library/shelve shelve-security10944950
Ref: 2f7710944950
Ref: library/shelve shelve Shelf sync10945469
Ref: 2f7410945469
Ref: library/shelve shelve Shelf reorganize10945835
Ref: 2f7810945835
Ref: library/shelve shelve Shelf close10946032
Ref: 2f7510946032
Ref: shelve --- Python オブジェクトの永続化-Footnote-110946513
Ref: shelve --- Python オブジェクトの永続化-Footnote-210946579
Node: 制限事項10946684
Ref: library/shelve restrictions10946803
Ref: 2f7910946803
Ref: library/shelve shelve Shelf10948446
Ref: 134910948446
Ref: library/shelve shelve BsdDbShelf10950557
Ref: 28cc10950557
Ref: library/shelve shelve DbfilenameShelf10951439
Ref: 28cd10951439
Ref: 制限事項-Footnote-110952221
Node: 使用例<13>10952274
Ref: library/shelve example10952411
Ref: 2f7a10952411
Ref: library/shelve shelve-example10952411
Ref: 2f7310952411
Node: 例外<7>10953982
Ref: library/shelve exceptions10954098
Ref: 2f7b10954098
Ref: library/shelve shelve ShelveError10954129
Ref: 2f7610954129
Node: marshal --- 内部使用向けの Python オブジェクト直列化10954700
Ref: library/marshal doc10954956
Ref: 2f7c10954956
Ref: library/marshal marshal-internal-python-object-serialization10954956
Ref: 2f7d10954956
Ref: library/marshal module-marshal10954956
Ref: 9010954956
Ref: library/marshal translation-repo10954956
Ref: 2f7e10954956
Ref: library/marshal marshal dump10958364
Ref: 2f8010958364
Ref: library/marshal marshal load10959381
Ref: 200410959381
Ref: library/marshal marshal dumps10960453
Ref: 125910960453
Ref: library/marshal marshal loads10961217
Ref: 2f8110961217
Ref: library/marshal marshal version10962039
Ref: 2f7f10962039
Ref: marshal --- 内部使用向けの Python オブジェクト直列化-Footnote-110963418
Node: dbm --- Unix "データベース" へのインターフェース10963962
Ref: library/dbm doc10964249
Ref: 2f8210964249
Ref: library/dbm dbm-interfaces-to-unix-databases10964249
Ref: 2f8310964249
Ref: library/dbm module-dbm10964249
Ref: 3410964249
Ref: library/dbm translation-repo10964249
Ref: 2f8410964249
Ref: library/dbm dbm error10965104
Ref: 2f8510965104
Ref: library/dbm dbm whichdb10965576
Ref: 2f8610965576
Ref: library/dbm dbm open10966275
Ref: 12db10966275
Ref: dbm --- Unix "データベース" へのインターフェース-Footnote-110970238
Ref: dbm --- Unix "データベース" へのインターフェース-Footnote-210970310
Node: dbm sqlite3 --- SQLite backend for dbm10970363
Ref: library/dbm dbm-sqlite3-sqlite-backend-for-dbm10970543
Ref: 2f8710970543
Ref: library/dbm module-dbm sqlite310970543
Ref: 3810970543
Ref: library/dbm dbm sqlite3 open10971243
Ref: 2f8810971243
Ref: library/dbm dbm sqlite3 sqlite3 close10972371
Ref: 2f8910972371
Ref: library/dbm dbm sqlite3 sqlite3 reorganize10972450
Ref: 2f8a10972450
Ref: dbm sqlite3 --- SQLite backend for dbm-Footnote-110973081
Node: dbm gnu --- GNU database manager10973152
Ref: library/dbm dbm-gnu-gnu-database-manager10973374
Ref: 2f8b10973374
Ref: library/dbm module-dbm gnu10973374
Ref: 3610973374
Ref: library/dbm dbm gnu error10974145
Ref: e6410974145
Ref: library/dbm dbm gnu open_flags10974342
Ref: 2f8c10974342
Ref: library/dbm dbm gnu open10974465
Ref: 202d10974465
Ref: library/dbm dbm gnu gdbm close10976641
Ref: 2f8d10976641
Ref: library/dbm dbm gnu gdbm firstkey10976715
Ref: 2f8e10976715
Ref: library/dbm dbm gnu gdbm nextkey10977053
Ref: 2f8f10977053
Ref: library/dbm dbm gnu gdbm reorganize10977537
Ref: 2f9010977537
Ref: library/dbm dbm gnu gdbm sync10978228
Ref: 2f9110978228
Ref: dbm gnu --- GNU database manager-Footnote-110978501
Node: dbm ndbm --- New Database Manager10978568
Ref: library/dbm dbm-ndbm-new-database-manager10978792
Ref: 2f9210978792
Ref: library/dbm module-dbm ndbm10978792
Ref: 3710978792
Ref: library/dbm dbm ndbm error10979875
Ref: e6510979875
Ref: library/dbm dbm ndbm library10980074
Ref: 2f9310980074
Ref: library/dbm dbm ndbm open10980159
Ref: 202e10980159
Ref: library/dbm dbm ndbm ndbm close10981751
Ref: 2f9410981751
Ref: dbm ndbm --- New Database Manager-Footnote-110981861
Node: dbm dumb --- Portable DBM implementation10981929
Ref: library/dbm dbm-dumb-portable-dbm-implementation10982112
Ref: 2f9510982112
Ref: library/dbm module-dbm dumb10982112
Ref: 3510982112
Ref: library/dbm dbm dumb error10982869
Ref: e6310982869
Ref: library/dbm dbm dumb open10983068
Ref: e6010983068
Ref: library/dbm dbm dumb dumbdbm close10985375
Ref: 2f9610985375
Ref: library/dbm dbm dumb dumbdbm reorganize10985447
Ref: 2f9710985447
Ref: library/dbm dbm dumb dumbdbm sync10985933
Ref: 2f9810985933
Ref: dbm dumb --- Portable DBM implementation-Footnote-110986151
Node: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース10986219
Ref: library/sqlite3 doc10986429
Ref: 2f9910986429
Ref: library/sqlite3 module-sqlite310986429
Ref: d710986429
Ref: library/sqlite3 sqlite3-db-api-2-0-interface-for-sqlite-databases10986429
Ref: 2f9a10986429
Ref: library/sqlite3 translation-repo10986429
Ref: 2f9b10986429
Ref: library/sqlite3 sqlite3-intro10986633
Ref: 2f9c10986633
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-110988783
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-210988848
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-310988890
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-410988918
Node: チュートリアル10988960
Ref: library/sqlite3 sqlite3-tutorial10989124
Ref: 2f9d10989124
Ref: library/sqlite3 tutorial10989124
Ref: 2fa110989124
Ref: チュートリアル-Footnote-110996756
Ref: チュートリアル-Footnote-210996813
Ref: チュートリアル-Footnote-310996872
Ref: チュートリアル-Footnote-410996921
Ref: チュートリアル-Footnote-510996967
Node: リファレンス10997019
Ref: library/sqlite3 reference10997216
Ref: 2fab10997216
Ref: library/sqlite3 sqlite3-reference10997216
Ref: 2f9e10997216
Ref: library/sqlite3 sqlite3-module-contents10997267
Ref: 2fac10997267
Node: モジュール関数10997838
Ref: library/sqlite3 module-functions10997944
Ref: 2fad10997944
Ref: library/sqlite3 sqlite3-module-functions10997944
Ref: 2fae10997944
Ref: library/sqlite3 sqlite3 connect10998000
Ref: 3e710998000
Ref: library/sqlite3 sqlite3 complete_statement11003326
Ref: 2fb711003326
Ref: library/sqlite3 sqlite3 enable_callback_tracebacks11004341
Ref: 2fb811004341
Ref: library/sqlite3 sqlite3 register_adapter11005181
Ref: 2fb911005181
Ref: library/sqlite3 sqlite3 register_converter11005656
Ref: 2fb011005656
Ref: モジュール関数-Footnote-111006500
Ref: モジュール関数-Footnote-211006543
Ref: モジュール関数-Footnote-311006585
Node: モジュール定数11006662
Ref: library/sqlite3 module-constants11006806
Ref: 2fbb11006806
Ref: library/sqlite3 sqlite3-module-constants11006806
Ref: 2fbc11006806
Ref: library/sqlite3 sqlite3 LEGACY_TRANSACTION_CONTROL11006862
Ref: 2fb511006862
Ref: library/sqlite3 sqlite3 PARSE_DECLTYPES11007242
Ref: 2fb111007242
Ref: library/sqlite3 sqlite3 PARSE_COLNAMES11008353
Ref: 2fb211008353
Ref: library/sqlite3 sqlite3 SQLITE_OK11008999
Ref: 2fbd11008999
Ref: library/sqlite3 sqlite3 SQLITE_DENY11009032
Ref: 2fbe11009032
Ref: library/sqlite3 sqlite3 SQLITE_IGNORE11009067
Ref: 2fbf11009067
Ref: library/sqlite3 sqlite3 apilevel11009654
Ref: 2fc011009654
Ref: library/sqlite3 sqlite3 paramstyle11009861
Ref: 2fc111009861
Ref: library/sqlite3 sqlite3 sqlite_version11010266
Ref: 58211010266
Ref: library/sqlite3 sqlite3 sqlite_version_info11010420
Ref: 58311010420
Ref: library/sqlite3 sqlite3 SQLITE_KEYWORDS11010601
Ref: 1a5711010601
Ref: library/sqlite3 sqlite3 threadsafety11010825
Ref: a7111010825
Ref: library/sqlite3 sqlite3-dbconfig-constants11013747
Ref: 2fc211013747
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DEFENSIVE11013747
Ref: 2fc311013747
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DQS_DDL11013796
Ref: 2fc411013796
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DQS_DML11013843
Ref: 2fc511013843
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_FKEY11013890
Ref: 2fc611013890
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER11013941
Ref: 2fc711013941
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION11014002
Ref: 2fc811014002
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_QPSG11014063
Ref: 2fc911014063
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_TRIGGER11014114
Ref: 2fca11014114
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_VIEW11014168
Ref: 2fcb11014168
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_LEGACY_ALTER_TABLE11014219
Ref: 2fcc11014219
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_LEGACY_FILE_FORMAT11014277
Ref: 2fcd11014277
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE11014335
Ref: 2fce11014335
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_RESET_DATABASE11014391
Ref: 2fcf11014391
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_TRIGGER_EQP11014445
Ref: 2fd011014445
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_TRUSTED_SCHEMA11014496
Ref: 2fd111014496
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_WRITABLE_SCHEMA11014550
Ref: 2fd211014550
Ref: モジュール定数-Footnote-111015254
Ref: モジュール定数-Footnote-211015297
Ref: モジュール定数-Footnote-311015352
Node: Connection オブジェクト11015403
Ref: library/sqlite3 connection-objects11015551
Ref: 2fd311015551
Ref: library/sqlite3 sqlite3-connection-objects11015551
Ref: 2fd411015551
Ref: library/sqlite3 sqlite3 Connection11015624
Ref: 3e611015624
Ref: library/sqlite3 sqlite3 Connection cursor11016502
Ref: 2fa211016502
Ref: library/sqlite3 sqlite3 Connection blobopen11016981
Ref: a7611016981
Ref: library/sqlite3 sqlite3 Connection commit11018443
Ref: 2fa611018443
Ref: library/sqlite3 sqlite3 Connection rollback11018973
Ref: 2fd611018973
Ref: library/sqlite3 sqlite3 Connection close11019516
Ref: 75511019516
Ref: library/sqlite3 sqlite3 Connection execute11020112
Ref: 2fd711020112
Ref: library/sqlite3 sqlite3 Connection executemany11020407
Ref: 2fd811020407
Ref: library/sqlite3 sqlite3 Connection executescript11020713
Ref: 2fd911020713
Ref: library/sqlite3 sqlite3 Connection create_function11021009
Ref: 3e811021009
Ref: library/sqlite3 sqlite3 Connection create_aggregate11022983
Ref: 3e911022983
Ref: library/sqlite3 sqlite3 Connection create_window_function11024952
Ref: a7511024952
Ref: library/sqlite3 sqlite3 Connection create_collation11028466
Ref: a6b11028466
Ref: library/sqlite3 sqlite3 Connection interrupt11030221
Ref: 2fdd11030221
Ref: library/sqlite3 sqlite3 Connection set_authorizer11030552
Ref: 3ea11030552
Ref: library/sqlite3 sqlite3 Connection set_progress_handler11032528
Ref: 3eb11032528
Ref: library/sqlite3 sqlite3 Connection set_trace_callback11033474
Ref: 3ec11033474
Ref: library/sqlite3 sqlite3 Connection enable_load_extension11034997
Ref: c1b11034997
Ref: library/sqlite3 sqlite3 Connection load_extension11037754
Ref: 8cd11037754
Ref: library/sqlite3 sqlite3 Connection iterdump11039007
Ref: 75611039007
Ref: library/sqlite3 sqlite3 Connection backup11040138
Ref: f3d11040138
Ref: library/sqlite3 sqlite3 Connection getlimit11043035
Ref: a7011043035
Ref: library/sqlite3 sqlite3 Connection setlimit11043831
Ref: a6f11043831
Ref: library/sqlite3 sqlite3 Connection getconfig11045173
Ref: 8ce11045173
Ref: library/sqlite3 sqlite3 Connection setconfig11045500
Ref: 8cf11045500
Ref: library/sqlite3 sqlite3 Connection serialize11046045
Ref: a7311046045
Ref: library/sqlite3 sqlite3 Connection deserialize11047048
Ref: a7411047048
Ref: library/sqlite3 sqlite3 Connection autocommit11048512
Ref: 8cb11048512
Ref: library/sqlite3 sqlite3 Connection in_transaction11050410
Ref: 2fe011050410
Ref: library/sqlite3 sqlite3 Connection isolation_level11050794
Ref: 2fb311050794
Ref: library/sqlite3 sqlite3 Connection row_factory11052038
Ref: 1bcf11052038
Ref: library/sqlite3 sqlite3 Connection text_factory11052736
Ref: 2fe211052736
Ref: library/sqlite3 sqlite3 Connection total_changes11053275
Ref: 2fe311053275
Ref: Connection オブジェクト-Footnote-111053510
Ref: Connection オブジェクト-Footnote-211053556
Ref: Connection オブジェクト-Footnote-311053621
Ref: Connection オブジェクト-Footnote-411053680
Ref: Connection オブジェクト-Footnote-511053739
Ref: Connection オブジェクト-Footnote-611053781
Ref: Connection オブジェクト-Footnote-711053823
Ref: Connection オブジェクト-Footnote-811053915
Ref: Connection オブジェクト-Footnote-911053957
Ref: Connection オブジェクト-Footnote-1011054049
Node: Cursor オブジェクト11054150
Ref: library/sqlite3 cursor-objects11054299
Ref: 2fe411054299
Ref: library/sqlite3 sqlite3-cursor-objects11054299
Ref: 2fe511054299
Ref: library/sqlite3 sqlite3 Cursor11055162
Ref: 2fa311055162
Ref: library/sqlite3 sqlite3 Cursor execute11055289
Ref: 7ae11055289
Ref: library/sqlite3 sqlite3 Cursor executemany11057096
Ref: 7af11057096
Ref: library/sqlite3 sqlite3 Cursor executescript11058774
Ref: 2fda11058774
Ref: library/sqlite3 sqlite3 Cursor fetchone11059766
Ref: 2fa411059766
Ref: library/sqlite3 sqlite3 Cursor fetchmany11060157
Ref: 1a0f11060157
Ref: library/sqlite3 sqlite3 Cursor fetchall11061276
Ref: 2fa711061276
Ref: library/sqlite3 sqlite3 Cursor close11061659
Ref: 2fe611061659
Ref: library/sqlite3 sqlite3 Cursor setinputsizes11062044
Ref: 2fe711062044
Ref: library/sqlite3 sqlite3 Cursor setoutputsize11062172
Ref: 2fe811062172
Ref: library/sqlite3 sqlite3 Cursor arraysize11062312
Ref: 1a1011062312
Ref: library/sqlite3 sqlite3 Cursor connection11062731
Ref: 2fe911062731
Ref: library/sqlite3 sqlite3 Cursor description11063281
Ref: 1aed11063281
Ref: library/sqlite3 sqlite3 Cursor lastrowid11063729
Ref: 109211063729
Ref: library/sqlite3 sqlite3 Cursor rowcount11064494
Ref: 1d7d11064494
Ref: library/sqlite3 sqlite3 Cursor row_factory11065080
Ref: 2fe111065080
Ref: library/sqlite3 sqlite3-columns-by-name11066164
Ref: 2fea11066164
Ref: Cursor オブジェクト-Footnote-111066200
Ref: Cursor オブジェクト-Footnote-211066257
Node: Row オブジェクト11066308
Ref: library/sqlite3 row-objects11066451
Ref: 2feb11066451
Ref: library/sqlite3 sqlite3-row-objects11066451
Ref: 2fec11066451
Ref: library/sqlite3 sqlite3 Row11066510
Ref: 122511066510
Ref: library/sqlite3 sqlite3 Row keys11067239
Ref: 2fed11067239
Node: Blob オブジェクト11067606
Ref: library/sqlite3 blob-objects11067758
Ref: 2fee11067758
Ref: library/sqlite3 sqlite3-blob-objects11067758
Ref: 2fef11067758
Ref: library/sqlite3 sqlite3 Blob11067819
Ref: a7711067819
Ref: library/sqlite3 sqlite3 Blob close11069159
Ref: 2ff011069159
Ref: library/sqlite3 sqlite3 Blob read11069457
Ref: 2ff111069457
Ref: library/sqlite3 sqlite3 Blob write11070022
Ref: 2ff211070022
Ref: library/sqlite3 sqlite3 Blob tell11070332
Ref: 2ff311070332
Ref: library/sqlite3 sqlite3 Blob seek11070467
Ref: 2ff411070467
Node: PrepareProtocol オブジェクト11070897
Ref: library/sqlite3 prepareprotocol-objects11071036
Ref: 2ff511071036
Ref: library/sqlite3 sqlite3 PrepareProtocol11071119
Ref: 1d8711071119
Ref: PrepareProtocol オブジェクト-Footnote-111071505
Node: 例外<8>11071547
Ref: library/sqlite3 exceptions11071687
Ref: 2ff711071687
Ref: library/sqlite3 sqlite3-exceptions11071687
Ref: 2ff811071687
Ref: library/sqlite3 sqlite3 Warning11071796
Ref: 1dcf11071796
Ref: library/sqlite3 sqlite3 Error11072198
Ref: 1e3b11072198
Ref: library/sqlite3 sqlite3 Error sqlite_errorcode11072616
Ref: a6d11072616
Ref: library/sqlite3 sqlite3 Error sqlite_errorname11072750
Ref: a6e11072750
Ref: library/sqlite3 sqlite3 InterfaceError11072896
Ref: a7211072896
Ref: library/sqlite3 sqlite3 DatabaseError11073221
Ref: 2fde11073221
Ref: library/sqlite3 sqlite3 DataError11073644
Ref: 1e6711073644
Ref: library/sqlite3 sqlite3 OperationalError11073921
Ref: 1e6811073921
Ref: library/sqlite3 sqlite3 IntegrityError11074333
Ref: 2ff911074333
Ref: library/sqlite3 sqlite3 InternalError11074612
Ref: 2ffa11074612
Ref: library/sqlite3 sqlite3 ProgrammingError11074962
Ref: 58411074962
Ref: library/sqlite3 sqlite3 NotSupportedError11075378
Ref: 2fdc11075378
Ref: 例外<8>-Footnote-111075940
Ref: 例外<8>-Footnote-211075982
Ref: 例外<8>-Footnote-311076022
Node: SQLite と Python の型11076062
Ref: library/sqlite3 sqlite-and-python-types11076262
Ref: 2ffb11076262
Ref: library/sqlite3 sqlite3-types11076262
Ref: 2faf11076262
Node: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨11078366
Ref: library/sqlite3 default-adapters-and-converters-deprecated11078608
Ref: 2ffc11078608
Ref: library/sqlite3 sqlite3-default-converters11078608
Ref: 90211078608
Ref: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨-Footnote-111080408
Node: コマンドライン・インターフェース<2>11080455
Ref: library/sqlite3 command-line-interface11080664
Ref: 2ffd11080664
Ref: library/sqlite3 sqlite3-cli11080664
Ref: 26311080664
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-h11081153
Ref: 2ffe11081153
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-help11081153
Ref: 2fff11081153
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-v11081209
Ref: 300011081209
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-version11081209
Ref: 300111081209
Node: ハウツー・ガイド11081338
Ref: library/sqlite3 how-to-guides11081520
Ref: 300211081520
Ref: library/sqlite3 sqlite3-howtos11081520
Ref: 2f9f11081520
Node: プレースホルダを使用して SQL クエリに値を結び付ける方法11082311
Ref: library/sqlite3 how-to-use-placeholders-to-bind-values-in-sql-queries11082522
Ref: 300311082522
Ref: library/sqlite3 sqlite3-placeholders11082522
Ref: 7b011082522
Ref: プレースホルダを使用して SQL クエリに値を結び付ける方法-Footnote-111085444
Ref: プレースホルダを使用して SQL クエリに値を結び付ける方法-Footnote-211085496
Node: カスタム Python 型を SQLite 値に適合させる方法11085538
Ref: library/sqlite3 how-to-adapt-custom-python-types-to-sqlite-values11085815
Ref: 300411085815
Ref: library/sqlite3 sqlite3-adapters11085815
Ref: 2fa811085815
Node: 適合可能オブジェクトの書き方11087073
Ref: library/sqlite3 how-to-write-adaptable-objects11087301
Ref: 300511087301
Ref: library/sqlite3 sqlite3-conform11087301
Ref: 2ff611087301
Node: 適合用呼び出し可能オブジェクト adapter callables の登録方法11088312
Ref: library/sqlite3 how-to-register-adapter-callables11088540
Ref: 300611088540
Node: SQLite 値をカスタム Python 型に変換する方法11089300
Ref: library/sqlite3 how-to-convert-sqlite-values-to-custom-python-types11089539
Ref: 300711089539
Ref: library/sqlite3 sqlite3-converters11089539
Ref: 2fa911089539
Node: 適合関数と変換関数のレシピ集11092492
Ref: library/sqlite3 adapter-and-converter-recipes11092736
Ref: 300811092736
Ref: library/sqlite3 sqlite3-adapter-converter-recipes11092736
Ref: 90311092736
Node: 接続 connection ショートカット・メソッドの使い方11094200
Ref: library/sqlite3 how-to-use-connection-shortcut-methods11094450
Ref: 300911094450
Ref: library/sqlite3 sqlite3-connection-shortcuts11094450
Ref: 2fd511094450
Node: 接続 connection コンテキストマネージャの使い方11095911
Ref: library/sqlite3 how-to-use-the-connection-context-manager11096145
Ref: 300a11096145
Ref: library/sqlite3 sqlite3-connection-context-manager11096145
Ref: 1d8811096145
Node: SQLite URI の操作方法11098296
Ref: library/sqlite3 how-to-work-with-sqlite-uris11098518
Ref: 300b11098518
Ref: library/sqlite3 sqlite3-uri-tricks11098518
Ref: 2fb611098518
Ref: SQLite URI の操作方法-Footnote-111099976
Node: 行工場 row factories の作成方法と使用方法11100016
Ref: library/sqlite3 how-to-create-and-use-row-factories11100213
Ref: 300c11100213
Ref: library/sqlite3 sqlite3-howto-row-factory11100213
Ref: 2faa11100213
Node: How to handle non-UTF-8 text encodings11103752
Ref: library/sqlite3 how-to-handle-non-utf-8-text-encodings11103914
Ref: 300d11103914
Ref: library/sqlite3 sqlite3-howto-encoding11103914
Ref: 2fdf11103914
Ref: How to handle non-UTF-8 text encodings-Footnote-111105246
Node: 説明11105295
Ref: library/sqlite3 explanation11105450
Ref: 300e11105450
Ref: library/sqlite3 sqlite3-explanation11105450
Ref: 2fa011105450
Ref: library/sqlite3 sqlite3-transaction-control11105483
Ref: 300f11105483
Node: トランザクション制御11105528
Ref: library/sqlite3 sqlite3-controlling-transactions11105601
Ref: 2fa511105601
Ref: library/sqlite3 transaction-control11105601
Ref: 301011105601
Node: autocommit 属性に依るトランザクション制御11106215
Ref: library/sqlite3 sqlite3-transaction-control-autocommit11106408
Ref: 8cc11106408
Ref: library/sqlite3 transaction-control-via-the-autocommit-attribute11106408
Ref: 301111106408
Ref: autocommit 属性に依るトランザクション制御-Footnote-111108878
Ref: autocommit 属性に依るトランザクション制御-Footnote-211108920
Ref: autocommit 属性に依るトランザクション制御-Footnote-311109012
Node: isolation_level 属性に依るトランザクション制御11109054
Ref: library/sqlite3 sqlite3-transaction-control-isolation-level11109247
Ref: 2fb411109247
Ref: library/sqlite3 transaction-control-via-the-isolation-level-attribute11109247
Ref: 301211109247
Ref: isolation_level 属性に依るトランザクション制御-Footnote-111112051
Ref: isolation_level 属性に依るトランザクション制御-Footnote-211112151
Node: データ圧縮とアーカイブ11112243
Ref: library/archiving doc11112410
Ref: 2f4411112410
Ref: library/archiving archiving11112410
Ref: 301311112410
Ref: library/archiving data-compression-and-archiving11112410
Ref: 301411112410
Ref: library/archiving translation-repo11112410
Ref: 301511112410
Node: compression パッケージ11113443
Ref: library/compression doc11113618
Ref: 301611113618
Ref: library/compression module-compression11113618
Ref: 2211113618
Ref: library/compression the-compression-package11113618
Ref: 301711113618
Node: compression zstd --- Compression compatible with the Zstandard format11114467
Ref: library/compression zstd doc11114680
Ref: 301811114680
Ref: library/compression zstd compression-zstd-compression-compatible-with-the-zstandard-format11114680
Ref: 301911114680
Ref: library/compression zstd module-compression zstd11114680
Ref: 2311114680
Ref: library/compression zstd translation-repo11114680
Ref: 301a11114680
Ref: compression zstd --- Compression compatible with the Zstandard format-Footnote-111116731
Ref: compression zstd --- Compression compatible with the Zstandard format-Footnote-211116817
Node: 例外<9>11116884
Ref: library/compression zstd exceptions11117044
Ref: 302611117044
Ref: library/compression zstd compression zstd ZstdError11117075
Ref: 302711117075
Node: 圧縮ファイルへの読み書き11117257
Ref: library/compression zstd reading-and-writing-compressed-files11117459
Ref: 302811117459
Ref: library/compression zstd compression zstd open11117540
Ref: 301b11117540
Ref: library/compression zstd compression zstd ZstdFile11119739
Ref: 301c11119739
Ref: library/compression zstd compression zstd ZstdFile peek11121923
Ref: 302a11121923
Ref: library/compression zstd compression zstd ZstdFile mode11122592
Ref: 302b11122592
Ref: library/compression zstd compression zstd ZstdFile name11122702
Ref: 302c11122702
Node: メモリ上での圧縮と展開11122871
Ref: library/compression zstd compressing-and-decompressing-data-in-memory11123086
Ref: 302e11123086
Ref: library/compression zstd compression zstd compress11123162
Ref: 301e11123162
Ref: library/compression zstd compression zstd decompress11124373
Ref: 301f11124373
Ref: library/compression zstd compression zstd ZstdCompressor11125202
Ref: 301d11125202
Ref: library/compression zstd compression zstd ZstdCompressor compress11126531
Ref: 303111126531
Ref: library/compression zstd compression zstd ZstdCompressor flush11127544
Ref: 303211127544
Ref: library/compression zstd compression zstd ZstdCompressor set_pledged_input_size11127935
Ref: 303611127935
Ref: library/compression zstd compression zstd ZstdCompressor CONTINUE11129241
Ref: 303311129241
Ref: library/compression zstd compression zstd ZstdCompressor FLUSH_BLOCK11129494
Ref: 303411129494
Ref: library/compression zstd compression zstd ZstdCompressor FLUSH_FRAME11129795
Ref: 303511129795
Ref: library/compression zstd compression zstd ZstdCompressor last_mode11130007
Ref: 303811130007
Ref: library/compression zstd compression zstd ZstdDecompressor11130371
Ref: 192c11130371
Ref: library/compression zstd compression zstd ZstdDecompressor decompress11131603
Ref: 303911131603
Ref: library/compression zstd compression zstd ZstdDecompressor eof11133128
Ref: 303c11133128
Ref: library/compression zstd compression zstd ZstdDecompressor unused_data11133243
Ref: 303b11133243
Ref: library/compression zstd compression zstd ZstdDecompressor needs_input11133442
Ref: 303a11133442
Node: Zstandard dictionaries11133622
Ref: library/compression zstd zstandard-dictionaries11133827
Ref: 303d11133827
Ref: library/compression zstd compression zstd train_dict11133892
Ref: 302011133892
Ref: library/compression zstd compression zstd finalize_dict11134985
Ref: 302111134985
Ref: library/compression zstd compression zstd ZstdDict11136126
Ref: 302211136126
Ref: library/compression zstd compression zstd ZstdDict dict_content11139423
Ref: 303e11139423
Ref: library/compression zstd compression zstd ZstdDict dict_id11139735
Ref: 303f11139735
Ref: library/compression zstd compression zstd ZstdDict as_digested_dict11140355
Ref: 304111140355
Ref: library/compression zstd compression zstd ZstdDict as_undigested_dict11140445
Ref: 304211140445
Node: Advanced parameter control11140540
Ref: library/compression zstd advanced-parameter-control11140724
Ref: 304311140724
Ref: library/compression zstd compression zstd CompressionParameter11140797
Ref: 302311140797
Ref: library/compression zstd compression zstd CompressionParameter bounds11141624
Ref: 303011141624
Ref: library/compression zstd compression zstd CompressionParameter compression_level11142098
Ref: 302f11142098
Ref: library/compression zstd compression zstd CompressionParameter window_log11142664
Ref: 304411142664
Ref: library/compression zstd compression zstd CompressionParameter hash_log11143102
Ref: 304611143102
Ref: library/compression zstd compression zstd CompressionParameter chain_log11143497
Ref: 304811143497
Ref: library/compression zstd compression zstd CompressionParameter search_log11144013
Ref: 304a11144013
Ref: library/compression zstd compression zstd CompressionParameter min_match11144346
Ref: 304b11144346
Ref: library/compression zstd compression zstd CompressionParameter target_length11144915
Ref: 304d11144915
Ref: library/compression zstd compression zstd CompressionParameter strategy11145568
Ref: 305011145568
Ref: library/compression zstd compression zstd CompressionParameter enable_long_distance_matching11145858
Ref: 305111145858
Ref: library/compression zstd compression zstd CompressionParameter ldm_hash_log11146538
Ref: 305211146538
Ref: library/compression zstd compression zstd CompressionParameter ldm_min_match11146834
Ref: 305311146834
Ref: library/compression zstd compression zstd CompressionParameter ldm_bucket_size_log11147080
Ref: 305411147080
Ref: library/compression zstd compression zstd CompressionParameter ldm_hash_rate_log11147392
Ref: 305511147392
Ref: library/compression zstd compression zstd CompressionParameter content_size_flag11147763
Ref: 303711147763
Ref: library/compression zstd compression zstd CompressionParameter checksum_flag11148896
Ref: 305611148896
Ref: library/compression zstd compression zstd CompressionParameter dict_id_flag11149309
Ref: 305711149309
Ref: library/compression zstd compression zstd CompressionParameter nb_workers11149581
Ref: 305811149581
Ref: library/compression zstd compression zstd CompressionParameter job_size11150004
Ref: 305911150004
Ref: library/compression zstd compression zstd CompressionParameter overlap_log11150364
Ref: 305a11150364
Ref: library/compression zstd compression zstd DecompressionParameter11151018
Ref: 302411151018
Ref: library/compression zstd compression zstd DecompressionParameter bounds11151754
Ref: 305b11151754
Ref: library/compression zstd compression zstd DecompressionParameter window_log_max11152044
Ref: 305c11152044
Ref: library/compression zstd compression zstd Strategy11152420
Ref: 302511152420
Ref: library/compression zstd compression zstd Strategy fast11152906
Ref: 304911152906
Ref: library/compression zstd compression zstd Strategy dfast11152932
Ref: 304711152932
Ref: library/compression zstd compression zstd Strategy greedy11152959
Ref: 305d11152959
Ref: library/compression zstd compression zstd Strategy lazy11152987
Ref: 305e11152987
Ref: library/compression zstd compression zstd Strategy lazy211153013
Ref: 305f11153013
Ref: library/compression zstd compression zstd Strategy btlazy211153040
Ref: 306011153040
Ref: library/compression zstd compression zstd Strategy btopt11153069
Ref: 304c11153069
Ref: library/compression zstd compression zstd Strategy btultra11153096
Ref: 304e11153096
Ref: library/compression zstd compression zstd Strategy btultra211153125
Ref: 304f11153125
Node: その他<3>11153155
Ref: library/compression zstd miscellaneous11153330
Ref: 306111153330
Ref: library/compression zstd compression zstd get_frame_info11153366
Ref: 304011153366
Ref: library/compression zstd compression zstd FrameInfo11153598
Ref: 306211153598
Ref: library/compression zstd compression zstd FrameInfo decompressed_size11153686
Ref: 306311153686
Ref: library/compression zstd compression zstd FrameInfo dictionary_id11153788
Ref: 306411153788
Ref: library/compression zstd compression zstd COMPRESSION_LEVEL_DEFAULT11154149
Ref: 304511154149
Ref: library/compression zstd compression zstd zstd_version_info11154268
Ref: 306511154268
Node: 使用例<14>11154421
Ref: library/compression zstd examples11154561
Ref: 306611154561
Node: zlib --- gzip 互換の圧縮11155980
Ref: library/zlib doc11156207
Ref: 306711156207
Ref: library/zlib module-zlib11156207
Ref: 13c11156207
Ref: library/zlib translation-repo11156207
Ref: 306811156207
Ref: library/zlib zlib-compression-compatible-with-gzip11156207
Ref: 306911156207
Ref: library/zlib zlib error11157178
Ref: 306a11157178
Ref: library/zlib zlib adler3211157287
Ref: 1dd311157287
Ref: library/zlib zlib adler32_combine11158329
Ref: 2c711158329
Ref: library/zlib zlib compress11158920
Ref: a3311158920
Ref: library/zlib compress-wbits11159461
Ref: 306f11159461
Ref: library/zlib zlib compressobj11160713
Ref: 1a1c11160713
Ref: library/zlib zlib crc3211162751
Ref: 1c3711162751
Ref: library/zlib zlib crc32_combine11163690
Ref: 2c811163690
Ref: library/zlib zlib decompress11164259
Ref: 10cc11164259
Ref: library/zlib decompress-wbits11164693
Ref: 307711164693
Ref: library/zlib zlib decompressobj11166556
Ref: 1a1d11166556
Ref: library/zlib zlib Compress compress11167745
Ref: 307811167745
Ref: library/zlib zlib Compress flush11168255
Ref: 307911168255
Ref: library/zlib zlib Compress copy11169034
Ref: 308011169034
Ref: library/zlib zlib Decompress unused_data11169473
Ref: 308111169473
Ref: library/zlib zlib Decompress unconsumed_tail11169955
Ref: 308211169955
Ref: library/zlib zlib Decompress eof11170532
Ref: 152b11170532
Ref: library/zlib zlib Decompress decompress11170866
Ref: 308311170866
Ref: library/zlib zlib Decompress flush11172185
Ref: 308411172185
Ref: library/zlib zlib Decompress copy11172711
Ref: 308511172711
Ref: library/zlib zlib DEFLATED11173297
Ref: 307111173297
Ref: library/zlib zlib MAX_WBITS11173365
Ref: 307011173365
Ref: library/zlib zlib DEF_MEM_LEVEL11173549
Ref: 308611173549
Ref: library/zlib zlib DEF_BUF_SIZE11173640
Ref: 308711173640
Ref: library/zlib zlib Z_NO_COMPRESSION11173734
Ref: 306d11173734
Ref: library/zlib zlib Z_BEST_SPEED11173849
Ref: 306b11173849
Ref: library/zlib zlib Z_BEST_COMPRESSION11173960
Ref: 306c11173960
Ref: library/zlib zlib Z_DEFAULT_COMPRESSION11174076
Ref: 306e11174076
Ref: library/zlib zlib Z_DEFAULT_STRATEGY11174264
Ref: 307211174264
Ref: library/zlib zlib Z_FILTERED11174357
Ref: 307311174357
Ref: library/zlib zlib Z_HUFFMAN_ONLY11174462
Ref: 307411174462
Ref: library/zlib zlib Z_RLE11174558
Ref: 307511174558
Ref: library/zlib zlib Z_FIXED11174799
Ref: 307611174799
Ref: library/zlib zlib Z_NO_FLUSH11175032
Ref: 307a11175032
Ref: library/zlib zlib Z_PARTIAL_FLUSH11175149
Ref: 307b11175149
Ref: library/zlib zlib Z_SYNC_FLUSH11175247
Ref: 307c11175247
Ref: library/zlib zlib Z_FULL_FLUSH11175381
Ref: 307d11175381
Ref: library/zlib zlib Z_FINISH11175505
Ref: 307f11175505
Ref: library/zlib zlib Z_BLOCK11175626
Ref: 307e11175626
Ref: library/zlib zlib Z_TREES11175848
Ref: 308811175848
Ref: library/zlib zlib ZLIB_VERSION11176239
Ref: 308911176239
Ref: library/zlib zlib ZLIB_RUNTIME_VERSION11176585
Ref: 152c11176585
Ref: library/zlib zlib ZLIBNG_VERSION11176770
Ref: 308a11176770
Ref: zlib --- gzip 互換の圧縮-Footnote-111177701
Ref: zlib --- gzip 互換の圧縮-Footnote-211177730
Ref: zlib --- gzip 互換の圧縮-Footnote-311177771
Node: gzip --- gzip ファイルのサポート11177824
Ref: library/gzip doc11178017
Ref: 308b11178017
Ref: library/gzip gzip-support-for-gzip-files11178017
Ref: 308c11178017
Ref: library/gzip module-gzip11178017
Ref: 6a11178017
Ref: library/gzip translation-repo11178017
Ref: 308d11178017
Ref: library/gzip gzip open11179400
Ref: 308e11179400
Ref: library/gzip gzip BadGzipFile11181580
Ref: dbe11181580
Ref: library/gzip gzip GzipFile11181830
Ref: 84f11181830
Ref: library/gzip gzip GzipFile peek11185740
Ref: 15c911185740
Ref: library/gzip gzip GzipFile mode11186320
Ref: 309111186320
Ref: library/gzip gzip GzipFile mtime11186542
Ref: 308f11186542
Ref: library/gzip gzip GzipFile name11186882
Ref: 92111186882
Ref: library/gzip gzip compress11188610
Ref: a3211188610
Ref: library/gzip gzip decompress11190042
Ref: 15ca11190042
Ref: gzip --- gzip ファイルのサポート-Footnote-111190786
Node: 使い方の例11190850
Ref: library/gzip examples-of-usage11191003
Ref: 309311191003
Ref: library/gzip gzip-usage-examples11191003
Ref: 309411191003
Ref: 使い方の例-Footnote-111192116
Node: コマンドライン・インターフェース<3>11192169
Ref: library/gzip command-line-interface11192322
Ref: 309511192322
Ref: library/gzip gzip-cli11192322
Ref: 309611192322
Node: コマンドラインオプション11192791
Ref: library/gzip command-line-options11192915
Ref: 309711192915
Ref: library/gzip cmdoption-gzip-arg-file11192996
Ref: 309811192996
Ref: library/gzip cmdoption-gzip-fast11193080
Ref: 309911193080
Ref: library/gzip cmdoption-gzip-best11193167
Ref: 309a11193167
Ref: library/gzip cmdoption-gzip-d11193254
Ref: 309b11193254
Ref: library/gzip cmdoption-gzip-decompress11193254
Ref: 309c11193254
Ref: library/gzip cmdoption-gzip-h11193317
Ref: 309d11193317
Ref: library/gzip cmdoption-gzip-help11193317
Ref: 309e11193317
Node: bz2 --- bzip2 圧縮のサポート11193390
Ref: library/bz2 doc11193607
Ref: 309f11193607
Ref: library/bz2 bz2-support-for-bzip2-compression11193607
Ref: 30a011193607
Ref: library/bz2 module-bz211193607
Ref: 1411193607
Ref: library/bz2 translation-repo11193607
Ref: 30a111193607
Ref: bz2 --- bzip2 圧縮のサポート-Footnote-111194820
Node: ファイルの圧縮/解凍11194883
Ref: library/bz2 de-compression-of-files11195019
Ref: 30a211195019
Ref: library/bz2 bz2 open11195087
Ref: 144a11195087
Ref: library/bz2 bz2 BZ2File11196935
Ref: c4111196935
Ref: library/bz2 bz2 BZ2File peek11198729
Ref: 30a311198729
Ref: library/bz2 bz2 BZ2File fileno11199455
Ref: 30a411199455
Ref: library/bz2 bz2 BZ2File readable11199585
Ref: 30a511199585
Ref: library/bz2 bz2 BZ2File seekable11199713
Ref: 30a611199713
Ref: library/bz2 bz2 BZ2File writable11199835
Ref: 30a711199835
Ref: library/bz2 bz2 BZ2File read111199963
Ref: 30a811199963
Ref: library/bz2 bz2 BZ2File readinto11200288
Ref: 30a911200288
Ref: library/bz2 bz2 BZ2File mode11200447
Ref: 30aa11200447
Ref: library/bz2 bz2 BZ2File name11200591
Ref: 30ab11200591
Node: 逐次圧縮および展開11202199
Ref: library/bz2 incremental-de-compression11202363
Ref: 30ac11202363
Ref: library/bz2 bz2 BZ2Compressor11202429
Ref: 1cec11202429
Ref: library/bz2 bz2 BZ2Compressor compress11202907
Ref: 30ad11202907
Ref: library/bz2 bz2 BZ2Compressor flush11203407
Ref: 30ae11203407
Ref: library/bz2 bz2 BZ2Decompressor11203720
Ref: 191c11203720
Ref: library/bz2 bz2 BZ2Decompressor decompress11204517
Ref: 118711204517
Ref: library/bz2 bz2 BZ2Decompressor eof11206125
Ref: 30b111206125
Ref: library/bz2 bz2 BZ2Decompressor unused_data11206273
Ref: 30b011206273
Ref: library/bz2 bz2 BZ2Decompressor needs_input11206538
Ref: 30af11206538
Node: 一括圧縮/解凍11206789
Ref: library/bz2 one-shot-de-compression11206943
Ref: 30b211206943
Ref: library/bz2 bz2 compress11206996
Ref: 2aab11206996
Ref: library/bz2 bz2 decompress11207417
Ref: 144b11207417
Node: 使い方の例<2>11207847
Ref: library/bz2 bz2-usage-examples11207965
Ref: 30b311207965
Ref: library/bz2 examples-of-usage11207965
Ref: 30b411207965
Node: lzma --- LZMA アルゴリズムを使用した圧縮11211037
Ref: library/lzma doc11211253
Ref: 30b511211253
Ref: library/lzma lzma-compression-using-the-lzma-algorithm11211253
Ref: 30b611211253
Ref: library/lzma module-lzma11211253
Ref: 8d11211253
Ref: library/lzma translation-repo11211253
Ref: 30b711211253
Ref: library/lzma lzma LZMAError11212577
Ref: 30b811212577
Ref: lzma --- LZMA アルゴリズムを使用した圧縮-Footnote-111213070
Node: 圧縮ファイルへの読み書き<2>11213134
Ref: library/lzma reading-and-writing-compressed-files11213308
Ref: 30b911213308
Ref: library/lzma lzma open11213389
Ref: 30ba11213389
Ref: library/lzma lzma LZMAFile11215673
Ref: 13ba11215673
Ref: library/lzma lzma LZMAFile peek11218156
Ref: 30bb11218156
Ref: library/lzma lzma LZMAFile mode11218878
Ref: 30bc11218878
Ref: library/lzma lzma LZMAFile name11219022
Ref: 30bd11219022
Node: メモリ上での圧縮と展開<2>11219603
Ref: library/lzma compressing-and-decompressing-data-in-memory11219798
Ref: 30be11219798
Ref: library/lzma lzma LZMACompressor11219874
Ref: 1ceb11219874
Ref: library/lzma lzma LZMACompressor compress11223781
Ref: 30c111223781
Ref: library/lzma lzma LZMACompressor flush11224342
Ref: 30c211224342
Ref: library/lzma lzma LZMADecompressor11224666
Ref: 191b11224666
Ref: library/lzma lzma LZMADecompressor decompress11226476
Ref: 11e511226476
Ref: library/lzma lzma LZMADecompressor check11228084
Ref: 30c611228084
Ref: library/lzma lzma LZMADecompressor eof11228442
Ref: 30c711228442
Ref: library/lzma lzma LZMADecompressor unused_data11228557
Ref: 30c511228557
Ref: library/lzma lzma LZMADecompressor needs_input11228775
Ref: 30c411228775
Ref: library/lzma lzma compress11229026
Ref: 30bf11229026
Ref: library/lzma lzma decompress11229438
Ref: 30c311229438
Node: その他<4>11229991
Ref: library/lzma miscellaneous11230192
Ref: 30c811230192
Ref: library/lzma lzma is_check_supported11230228
Ref: 30c911230228
Node: カスタムフィルタチェインの指定11230687
Ref: library/lzma filter-chain-specs11230865
Ref: 30c011230865
Ref: library/lzma specifying-custom-filter-chains11230865
Ref: 30ca11230865
Node: 使用例<15>11234096
Ref: library/lzma examples11234253
Ref: 30cb11234253
Node: zipfile --- ZIP アーカイブの処理11235683
Ref: library/zipfile doc11235922
Ref: 30cc11235922
Ref: library/zipfile module-zipfile11235922
Ref: 13a11235922
Ref: library/zipfile translation-repo11235922
Ref: 30cd11235922
Ref: library/zipfile zipfile-work-with-zip-archives11235922
Ref: 30ce11235922
Ref: library/zipfile zipfile BadZipFile11237439
Ref: 1d8411237439
Ref: library/zipfile zipfile BadZipfile11237586
Ref: 30cf11237586
Ref: library/zipfile zipfile LargeZipFile11237802
Ref: 30d011237802
Ref: library/zipfile zipfile ZipInfo11238626
Ref: 54e11238626
Ref: library/zipfile zipfile ZipInfo _for_archive11239573
Ref: 54d11239573
Ref: library/zipfile zipfile is_zipfile11239857
Ref: 16e411239857
Ref: library/zipfile zipfile ZIP_STORED11240315
Ref: 30d511240315
Ref: library/zipfile zipfile ZIP_DEFLATED11240493
Ref: 30d611240493
Ref: library/zipfile zipfile ZIP_BZIP211240662
Ref: 30d711240662
Ref: library/zipfile zipfile ZIP_LZMA11240846
Ref: 30d811240846
Ref: library/zipfile zipfile ZIP_ZSTANDARD11241029
Ref: 30d911241029
Ref: zipfile --- ZIP アーカイブの処理-Footnote-111242576
Ref: zipfile --- ZIP アーカイブの処理-Footnote-211242641
Ref: zipfile --- ZIP アーカイブの処理-Footnote-311242709
Ref: zipfile --- ZIP アーカイブの処理-Footnote-411242777
Node: ZipFile objects11242818
Ref: library/zipfile id111242931
Ref: 30da11242931
Ref: library/zipfile zipfile-objects11242931
Ref: 30d111242931
Ref: library/zipfile zipfile ZipFile11242982
Ref: ab611242982
Ref: library/zipfile zipfile ZipFile close11249164
Ref: 30db11249164
Ref: library/zipfile zipfile ZipFile getinfo11249468
Ref: 30d211249468
Ref: library/zipfile zipfile ZipFile infolist11249800
Ref: 30d311249800
Ref: library/zipfile zipfile ZipFile namelist11250142
Ref: 30dc11250142
Ref: library/zipfile zipfile ZipFile open11250251
Ref: 85011250251
Ref: library/zipfile zipfile ZipFile extract11253295
Ref: 30df11253295
Ref: library/zipfile zipfile ZipFile extractall11254942
Ref: 30e011254942
Ref: library/zipfile zipfile ZipFile printdir11256235
Ref: 30e111256235
Ref: library/zipfile zipfile ZipFile setpassword11256356
Ref: 30e211256356
Ref: library/zipfile zipfile ZipFile read11256499
Ref: 30de11256499
Ref: library/zipfile zipfile ZipFile testzip11257457
Ref: 30e311257457
Ref: library/zipfile zipfile ZipFile write11257831
Ref: 110611257831
Ref: library/zipfile zipfile ZipFile writestr11259814
Ref: 54f11259814
Ref: library/zipfile zipfile ZipFile mkdir11261751
Ref: ab711261751
Ref: library/zipfile zipfile ZipFile filename11262292
Ref: 30e411262292
Ref: library/zipfile zipfile ZipFile debug11262366
Ref: 30e511262366
Ref: library/zipfile zipfile ZipFile comment11262685
Ref: 30e611262685
Node: Path objects11263133
Ref: library/zipfile id211263272
Ref: 30e711263272
Ref: library/zipfile path-objects11263272
Ref: 30e811263272
Ref: library/zipfile zipfile Path11263317
Ref: abb11263317
Ref: library/zipfile zipfile Path name11264474
Ref: 30e911264474
Ref: library/zipfile zipfile Path open11264532
Ref: 1a3311264532
Ref: library/zipfile zipfile Path iterdir11265428
Ref: 30ea11265428
Ref: library/zipfile zipfile Path is_dir11265518
Ref: 30eb11265518
Ref: library/zipfile zipfile Path is_file11265623
Ref: 30ec11265623
Ref: library/zipfile zipfile Path is_symlink11265724
Ref: 30ed11265724
Ref: library/zipfile zipfile Path exists11265980
Ref: 30ee11265980
Ref: library/zipfile zipfile Path suffix11266114
Ref: ab911266114
Ref: library/zipfile zipfile Path stem11266323
Ref: ab811266323
Ref: library/zipfile zipfile Path suffixes11266462
Ref: aba11266462
Ref: library/zipfile zipfile Path read_text11266629
Ref: 1cfc11266629
Ref: library/zipfile zipfile Path read_bytes11267218
Ref: 30ef11267218
Ref: library/zipfile zipfile Path joinpath11267294
Ref: 30f011267294
Ref: Path objects-Footnote-111267957
Node: PyZipFile objects11267996
Ref: library/zipfile id311268135
Ref: 30f111268135
Ref: library/zipfile pyzipfile-objects11268135
Ref: 30f211268135
Ref: library/zipfile zipfile PyZipFile11268362
Ref: 13a611268362
Ref: library/zipfile zipfile PyZipFile writepy11268787
Ref: 13a711268787
Node: ZipInfo objects11272081
Ref: library/zipfile id411272259
Ref: 30f311272259
Ref: library/zipfile zipinfo-objects11272259
Ref: 30d411272259
Ref: library/zipfile zipfile ZipInfo from_file11272707
Ref: 10c911272707
Ref: library/zipfile zipfile ZipInfo is_dir11273860
Ref: 10ca11273860
Ref: library/zipfile zipfile ZipInfo filename11274103
Ref: 30f411274103
Ref: library/zipfile zipfile ZipInfo date_time11274182
Ref: 30f511274182
Ref: library/zipfile zipfile ZipInfo compress_type11275776
Ref: 30f611275776
Ref: library/zipfile zipfile ZipInfo comment11275863
Ref: 30f711275863
Ref: library/zipfile zipfile ZipInfo extra11275979
Ref: 30f811275979
Ref: library/zipfile zipfile ZipInfo create_system11276229
Ref: 30f911276229
Ref: library/zipfile zipfile ZipInfo create_version11276347
Ref: 30fa11276347
Ref: library/zipfile zipfile ZipInfo extract_version11276457
Ref: 30fb11276457
Ref: library/zipfile zipfile ZipInfo reserved11276583
Ref: 30fc11276583
Ref: library/zipfile zipfile ZipInfo flag_bits11276677
Ref: 30fd11276677
Ref: library/zipfile zipfile ZipInfo volume11276746
Ref: 30fe11276746
Ref: library/zipfile zipfile ZipInfo internal_attr11276832
Ref: 30ff11276832
Ref: library/zipfile zipfile ZipInfo external_attr11276892
Ref: 310011276892
Ref: library/zipfile zipfile ZipInfo header_offset11276964
Ref: 310111276964
Ref: library/zipfile zipfile ZipInfo CRC11277063
Ref: 310211277063
Ref: library/zipfile zipfile ZipInfo compress_size11277154
Ref: 310311277154
Ref: library/zipfile zipfile ZipInfo file_size11277235
Ref: 30dd11277235
Ref: ZipInfo objects-Footnote-111277351
Node: コマンドライン・インターフェース<4>11277419
Ref: library/zipfile command-line-interface11277602
Ref: 310411277602
Ref: library/zipfile zipfile-commandline11277602
Ref: 310511277602
Node: コマンドラインオプション<2>11278552
Ref: library/zipfile command-line-options11278679
Ref: 310911278679
Ref: library/zipfile cmdoption-zipfile-l11278760
Ref: 310811278760
Ref: library/zipfile cmdoption-zipfile-list11278785
Ref: 310a11278785
Ref: library/zipfile cmdoption-zipfile-c11278875
Ref: 310611278875
Ref: library/zipfile cmdoption-zipfile-create11278924
Ref: 310b11278924
Ref: library/zipfile cmdoption-zipfile-e11279044
Ref: 310711279044
Ref: library/zipfile cmdoption-zipfile-extract11279082
Ref: 310c11279082
Ref: library/zipfile cmdoption-zipfile-t11279200
Ref: 310d11279200
Ref: library/zipfile cmdoption-zipfile-test11279225
Ref: 310e11279225
Ref: library/zipfile cmdoption-zipfile-metadata-encoding11279306
Ref: 310f11279306
Node: Decompression pitfalls11279479
Ref: library/zipfile decompression-pitfalls11279638
Ref: 311011279638
Node: From file itself11279921
Ref: library/zipfile from-file-itself11280028
Ref: 311111280028
Node: File system limitations11280207
Ref: library/zipfile file-system-limitations11280344
Ref: 311211280344
Node: Resources limitations11280646
Ref: library/zipfile resources-limitations11280779
Ref: 311311280779
Ref: library/zipfile zipfile-resources-limitations11280779
Ref: 311411280779
Ref: Resources limitations-Footnote-111281066
Node: Interruption11281113
Ref: library/zipfile interruption11281254
Ref: 311511281254
Node: Default behaviors of extraction11281460
Ref: library/zipfile default-behaviors-of-extraction11281571
Ref: 311611281571
Node: tarfile --- tar アーカイブファイルの読み書き11281836
Ref: library/tarfile doc11282013
Ref: 311711282013
Ref: library/tarfile module-tarfile11282013
Ref: e711282013
Ref: library/tarfile tarfile-read-and-write-tar-archive-files11282013
Ref: 311811282013
Ref: library/tarfile translation-repo11282013
Ref: 311911282013
Ref: library/tarfile tarfile open11284504
Ref: 122b11284504
Ref: library/tarfile tarfile is_tarfile11294517
Ref: 1df311294517
Ref: library/tarfile tarfile TarError11294926
Ref: 311e11294926
Ref: library/tarfile tarfile ReadError11295007
Ref: 1e6511295007
Ref: library/tarfile tarfile CompressionError11295170
Ref: 311c11295170
Ref: library/tarfile tarfile StreamError11295356
Ref: 311f11295356
Ref: library/tarfile tarfile ExtractError11295523
Ref: 312011295523
Ref: library/tarfile tarfile HeaderError11295766
Ref: 312111295766
Ref: library/tarfile tarfile FilterError11295933
Ref: 312311295933
Ref: library/tarfile tarfile FilterError tarinfo11296028
Ref: 312511296028
Ref: library/tarfile tarfile AbsolutePathError11296167
Ref: 312711296167
Ref: library/tarfile tarfile OutsideDestinationError11296272
Ref: 312811296272
Ref: library/tarfile tarfile SpecialFileError11296400
Ref: 312911296400
Ref: library/tarfile tarfile AbsoluteLinkError11296518
Ref: 312a11296518
Ref: library/tarfile tarfile LinkOutsideDestinationError11296630
Ref: 312b11296630
Ref: library/tarfile tarfile LinkFallbackError11296778
Ref: 28711296778
Ref: library/tarfile tarfile ENCODING11297198
Ref: 312c11297198
Ref: library/tarfile tarfile REGTYPE11297398
Ref: 312d11297398
Ref: library/tarfile tarfile AREGTYPE11297429
Ref: 312e11297429
Ref: library/tarfile tarfile LNKTYPE11297501
Ref: 313011297501
Ref: library/tarfile tarfile SYMTYPE11297581
Ref: 313111297581
Ref: library/tarfile tarfile CHRTYPE11297653
Ref: 313211297653
Ref: library/tarfile tarfile BLKTYPE11297736
Ref: 313311297736
Ref: library/tarfile tarfile DIRTYPE11297815
Ref: 313411297815
Ref: library/tarfile tarfile FIFOTYPE11297883
Ref: 313511297883
Ref: library/tarfile tarfile CONTTYPE11297962
Ref: 313611297962
Ref: library/tarfile tarfile GNUTYPE_LONGNAME11298037
Ref: 313711298037
Ref: library/tarfile tarfile GNUTYPE_LONGLINK11298121
Ref: 313811298121
Ref: library/tarfile tarfile GNUTYPE_SPARSE11298205
Ref: 313911298205
Ref: library/tarfile tarfile USTAR_FORMAT11298488
Ref: 313b11298488
Ref: library/tarfile tarfile GNU_FORMAT11298574
Ref: 313c11298574
Ref: library/tarfile tarfile PAX_FORMAT11298645
Ref: 313d11298645
Ref: library/tarfile tarfile DEFAULT_FORMAT11298727
Ref: 313e11298727
Ref: tarfile --- tar アーカイブファイルの読み書き-Footnote-111299811
Ref: tarfile --- tar アーカイブファイルの読み書き-Footnote-211299878
Node: TarFile オブジェクト11299950
Ref: library/tarfile id111300106
Ref: 313f11300106
Ref: library/tarfile tarfile-objects11300106
Ref: 311b11300106
Ref: library/tarfile tarfile TarFile11301441
Ref: 15cd11301441
Ref: library/tarfile tarfile TarFile open11305795
Ref: 1df411305795
Ref: library/tarfile tarfile TarFile getmember11306045
Ref: 1e0711306045
Ref: library/tarfile tarfile TarFile getmembers11306467
Ref: 122d11306467
Ref: library/tarfile tarfile TarFile getnames11306704
Ref: 314111306704
Ref: library/tarfile tarfile TarFile list11306896
Ref: 122c11306896
Ref: library/tarfile tarfile TarFile next11307435
Ref: 314211307435
Ref: library/tarfile tarfile TarFile extractall11307759
Ref: 28511307759
Ref: library/tarfile tarfile TarFile extract11310093
Ref: 28611310093
Ref: library/tarfile tarfile TarFile extractfile11311722
Ref: 314311311722
Ref: library/tarfile tarfile TarFile errorlevel11312665
Ref: 28811312665
Ref: library/tarfile tarfile TarFile extraction_filter11313596
Ref: 314411313596
Ref: library/tarfile tarfile TarFile add11314880
Ref: fb711314880
Ref: library/tarfile tarfile TarFile addfile11316217
Ref: 1bd111316217
Ref: library/tarfile tarfile TarFile gettarinfo11316738
Ref: 314511316738
Ref: library/tarfile tarfile TarFile close11318218
Ref: 314811318218
Ref: library/tarfile tarfile TarFile pax_headers11318417
Ref: 314911318417
Node: TarInfo オブジェクト11318559
Ref: library/tarfile id211318742
Ref: 314a11318742
Ref: library/tarfile tarinfo-objects11318742
Ref: 312611318742
Ref: library/tarfile tarfile TarInfo11320133
Ref: 15ce11320133
Ref: library/tarfile tarfile TarInfo frombuf11320242
Ref: 312211320242
Ref: library/tarfile tarfile TarInfo fromtarfile11320519
Ref: 314c11320519
Ref: library/tarfile tarfile TarInfo tobuf11320773
Ref: 314d11320773
Ref: library/tarfile tarfile TarInfo name11321320
Ref: 314711321320
Ref: library/tarfile tarfile TarInfo size11321412
Ref: 314611321412
Ref: library/tarfile tarfile TarInfo mtime11321498
Ref: 314e11321498
Ref: library/tarfile tarfile TarInfo mode11321865
Ref: 315111321865
Ref: library/tarfile tarfile TarInfo type11322144
Ref: 312f11322144
Ref: library/tarfile tarfile TarInfo linkname11322688
Ref: 315211322688
Ref: library/tarfile tarfile TarInfo uid11323135
Ref: 315311323135
Ref: library/tarfile tarfile TarInfo gid11323445
Ref: 315411323445
Ref: library/tarfile tarfile TarInfo uname11323755
Ref: 315511323755
Ref: library/tarfile tarfile TarInfo gname11324067
Ref: 315611324067
Ref: library/tarfile tarfile TarInfo chksum11324379
Ref: 315711324379
Ref: library/tarfile tarfile TarInfo devmajor11324450
Ref: 315811324450
Ref: library/tarfile tarfile TarInfo devminor11324527
Ref: 315911324527
Ref: library/tarfile tarfile TarInfo offset11324604
Ref: 315a11324604
Ref: library/tarfile tarfile TarInfo offset_data11324686
Ref: 315b11324686
Ref: library/tarfile tarfile TarInfo sparse11324774
Ref: 315c11324774
Ref: library/tarfile tarfile TarInfo pax_headers11324838
Ref: 315d11324838
Ref: library/tarfile tarfile TarInfo replace11324976
Ref: 314b11324976
Ref: library/tarfile tarfile TarInfo isfile11325710
Ref: 315e11325710
Ref: library/tarfile tarfile TarInfo isreg11325836
Ref: 315f11325836
Ref: library/tarfile tarfile TarInfo isdir11325919
Ref: 316011325919
Ref: library/tarfile tarfile TarInfo issym11326028
Ref: 316111326028
Ref: library/tarfile tarfile TarInfo islnk11326146
Ref: 316211326146
Ref: library/tarfile tarfile TarInfo ischr11326255
Ref: 316311326255
Ref: library/tarfile tarfile TarInfo isblk11326376
Ref: 316411326376
Ref: library/tarfile tarfile TarInfo isfifo11326491
Ref: 316511326491
Ref: library/tarfile tarfile TarInfo isdev11326588
Ref: 316611326588
Node: Extraction filters11326775
Ref: library/tarfile extraction-filters11326977
Ref: 316711326977
Ref: library/tarfile tarfile-extraction-filter11326977
Ref: 88811326977
Ref: Extraction filters-Footnote-111330185
Node: Default named filters11330227
Ref: library/tarfile default-named-filters11330325
Ref: 316911330325
Ref: library/tarfile tarfile fully_trusted_filter11330489
Ref: 311a11330489
Ref: library/tarfile tarfile tar_filter11330638
Ref: 316811330638
Ref: library/tarfile tarfile data_filter11331446
Ref: 28411331446
Node: Filter errors11333304
Ref: library/tarfile filter-errors11333441
Ref: 316a11333441
Ref: library/tarfile tarfile-extraction-refuse11333441
Ref: 312411333441
Node: Hints for further verification11333801
Ref: library/tarfile hints-for-further-verification11333949
Ref: 316b11333949
Ref: library/tarfile tarfile-further-verification11333949
Ref: 2f2f11333949
Node: Supporting older Python versions11335688
Ref: library/tarfile supporting-older-python-versions11335857
Ref: 316c11335857
Node: Stateful extraction filter example11337417
Ref: library/tarfile stateful-extraction-filter-example11337547
Ref: 316d11337547
Node: コマンドラインインターフェイス11338339
Ref: library/tarfile command-line-interface11338528
Ref: 316e11338528
Ref: library/tarfile tarfile-commandline11338528
Ref: 137911338528
Node: コマンドラインオプション<3>11339680
Ref: library/tarfile command-line-options11339801
Ref: 317211339801
Ref: library/tarfile cmdoption-tarfile-l11339884
Ref: 317111339884
Ref: library/tarfile cmdoption-tarfile-list11339909
Ref: 317311339909
Ref: library/tarfile cmdoption-tarfile-c11339999
Ref: 316f11339999
Ref: library/tarfile cmdoption-tarfile-create11340048
Ref: 317411340048
Ref: library/tarfile cmdoption-tarfile-e11340168
Ref: 317011340168
Ref: library/tarfile cmdoption-tarfile-extract11340208
Ref: 317511340208
Ref: library/tarfile cmdoption-tarfile-t11340380
Ref: 317611340380
Ref: library/tarfile cmdoption-tarfile-test11340405
Ref: 317711340405
Ref: library/tarfile cmdoption-tarfile-v11340486
Ref: 317811340486
Ref: library/tarfile cmdoption-tarfile-verbose11340486
Ref: 317911340486
Ref: library/tarfile cmdoption-tarfile-filter11340547
Ref: 317a11340547
Node: 使用例<16>11340782
Ref: library/tarfile examples11341000
Ref: 317b11341000
Ref: library/tarfile tar-examples11341000
Ref: 311d11341000
Node: Reading examples11341090
Ref: library/tarfile reading-examples11341181
Ref: 317c11341181
Node: Writing examples11342367
Ref: library/tarfile writing-examples11342458
Ref: 317d11342458
Node: サポートしている tar フォーマット11343673
Ref: library/tarfile supported-tar-formats11343872
Ref: 317e11343872
Ref: library/tarfile tar-formats11343872
Ref: 313a11343872
Node: Unicode に関する問題11346375
Ref: library/tarfile tar-unicode11346552
Ref: 314011346552
Ref: library/tarfile unicode-issues11346552
Ref: 317f11346552
Node: ファイルフォーマット11349294
Ref: library/fileformats doc11349467
Ref: 318111349467
Ref: library/fileformats file-formats11349467
Ref: 318211349467
Ref: library/fileformats fileformats11349467
Ref: 318311349467
Ref: library/fileformats translation-repo11349467
Ref: 318411349467
Node: csv --- CSV ファイルの読み書き11350155
Ref: library/csv doc11350320
Ref: 318511350320
Ref: library/csv csv-csv-file-reading-and-writing11350320
Ref: 318611350320
Ref: library/csv module-csv11350320
Ref: 2c11350320
Ref: csv --- CSV ファイルの読み書き-Footnote-111352743
Ref: csv --- CSV ファイルの読み書き-Footnote-211352806
Ref: csv --- CSV ファイルの読み書き-Footnote-311352865
Node: モジュールコンテンツ11352907
Ref: library/csv csv-contents11353066
Ref: 318711353066
Ref: library/csv module-contents11353066
Ref: 318811353066
Ref: library/csv csv reader11353192
Ref: 89d11353192
Ref: library/csv csv writer11354987
Ref: 89e11354987
Ref: library/csv csv register_dialect11357207
Ref: 1b7211357207
Ref: library/csv csv unregister_dialect11357798
Ref: 1dae11357798
Ref: library/csv csv get_dialect11358041
Ref: 1dad11358041
Ref: library/csv csv list_dialects11358311
Ref: 1daf11358311
Ref: library/csv csv field_size_limit11358415
Ref: 1dac11358415
Ref: library/csv csv DictReader11358735
Ref: dad11358735
Ref: library/csv csv DictWriter11360927
Ref: 15bd11360927
Ref: library/csv csv Dialect11362817
Ref: 1a5c11362817
Ref: library/csv csv excel11363760
Ref: 318c11363760
Ref: library/csv csv excel_tab11364013
Ref: 318d11364013
Ref: library/csv csv unix_dialect11364284
Ref: 15bc11364284
Ref: library/csv csv Sniffer11364695
Ref: 318e11364695
Ref: library/csv csv Sniffer sniff11364938
Ref: 2cd11364938
Ref: library/csv csv Sniffer has_header11365338
Ref: 1e6d11365338
Ref: library/csv csv-constants11366546
Ref: 318f11366546
Ref: library/csv csv QUOTE_ALL11366601
Ref: 319011366601
Ref: library/csv csv QUOTE_MINIMAL11366765
Ref: 319111366765
Ref: library/csv csv QUOTE_NONNUMERIC11367084
Ref: 1b7e11367084
Ref: library/csv csv QUOTE_NONE11367770
Ref: 319211367770
Ref: library/csv csv QUOTE_NOTNULL11368419
Ref: 89b11368419
Ref: library/csv csv QUOTE_STRINGS11368862
Ref: 89c11368862
Ref: library/csv csv Error11369390
Ref: 318b11369390
Ref: モジュールコンテンツ-Footnote-111369549
Ref: モジュールコンテンツ-Footnote-211369893
Node: Dialect クラスと書式化パラメータ11370237
Ref: library/csv csv-fmt-params11370430
Ref: 318a11370430
Ref: library/csv dialects-and-formatting-parameters11370430
Ref: 319311370430
Ref: library/csv csv Dialect delimiter11371229
Ref: 319411371229
Ref: library/csv csv Dialect doublequote11371410
Ref: 319511371410
Ref: library/csv csv Dialect escapechar11372107
Ref: 319611372107
Ref: library/csv csv Dialect lineterminator11372839
Ref: 319711372839
Ref: library/csv csv Dialect quotechar11373314
Ref: 319811373314
Ref: library/csv csv Dialect quoting11373827
Ref: 319911373827
Ref: library/csv csv Dialect skipinitialspace11374139
Ref: 319a11374139
Ref: library/csv csv Dialect strict11374424
Ref: 319b11374424
Node: reader オブジェクト11374608
Ref: library/csv id311374796
Ref: 319c11374796
Ref: library/csv reader-objects11374796
Ref: 318911374796
Ref: library/csv csv csvreader __next__11375075
Ref: 319d11375075
Ref: library/csv csv csvreader dialect11375615
Ref: 319e11375615
Ref: library/csv csv csvreader line_num11375731
Ref: 319f11375731
Ref: library/csv csv DictReader fieldnames11376047
Ref: 31a011376047
Node: writer オブジェクト11376311
Ref: library/csv writer-objects11376468
Ref: 31a111376468
Ref: library/csv csv csvwriter writerow11377388
Ref: 11a511377388
Ref: library/csv csv csvwriter writerows11377826
Ref: 31a211377826
Ref: library/csv csv csvwriter dialect11378178
Ref: 31a311378178
Ref: library/csv csv DictWriter writeheader11378380
Ref: 15be11378380
Node: 使用例<17>11378907
Ref: library/csv csv-examples11379030
Ref: 31a411379030
Ref: library/csv examples11379030
Ref: 31a511379030
Node: configparser --- 設定ファイルのパーサー11381311
Ref: library/configparser doc11381523
Ref: 31a611381523
Ref: library/configparser configparser-configuration-file-parser11381523
Ref: 31a711381523
Ref: library/configparser module-configparser11381523
Ref: 2611381523
Ref: library/configparser translation-repo11381523
Ref: 31a811381523
Ref: configparser --- 設定ファイルのパーサー-Footnote-111383461
Node: クイックスタート11383533
Ref: library/configparser quick-start11383686
Ref: 31a911383686
Ref: クイックスタート-Footnote-111387712
Ref: クイックスタート-Footnote-211387950
Node: サポートされるデータ型11388188
Ref: library/configparser supported-datatypes11388359
Ref: 31ad11388359
Ref: サポートされるデータ型-Footnote-111389883
Ref: サポートされるデータ型-Footnote-211390121
Node: 代替値11390359
Ref: library/configparser fallback-values11390549
Ref: 31b111390549
Node: サポートするINI ファイルの構造11392108
Ref: library/configparser supported-ini-file-structure11392281
Ref: 31aa11392281
Ref: サポートするINI ファイルの構造-Footnote-111395100
Ref: サポートするINI ファイルの構造-Footnote-211395338
Ref: サポートするINI ファイルの構造-Footnote-311395576
Ref: サポートするINI ファイルの構造-Footnote-411395814
Ref: サポートするINI ファイルの構造-Footnote-511396052
Node: Unnamed Sections11396290
Ref: library/configparser id1011396466
Ref: 31b311396466
Ref: library/configparser unnamed-sections11396466
Ref: 31b411396466
Node: 値の補間11396946
Ref: library/configparser interpolation-of-values11397118
Ref: 31b511397118
Ref: library/configparser configparser BasicInterpolation11397405
Ref: b0f11397405
Ref: library/configparser configparser ExtendedInterpolation11398822
Ref: b1011398822
Ref: 値の補間-Footnote-111400452
Node: マップ型プロトコルアクセス11400690
Ref: library/configparser mapping-protocol-access11400900
Ref: 31ab11400900
Ref: マップ型プロトコルアクセス-Footnote-111404351
Node: パーサーの振る舞いをカスタマイズする11404589
Ref: library/configparser customizing-parser-behaviour11404813
Ref: 31ac11404813
Ref: library/configparser configparser ConfigParser BOOLEAN_STATES11416512
Ref: 31b811416512
Ref: library/configparser configparser ConfigParser SECTCRE11418914
Ref: 31b211418914
Node: レガシーな API の例11420373
Ref: library/configparser legacy-api-examples11420589
Ref: 31b911420589
Node: ConfigParser オブジェクト11424489
Ref: library/configparser configparser-objects11424685
Ref: 31ba11424685
Ref: library/configparser id1311424685
Ref: 31bb11424685
Ref: library/configparser configparser ConfigParser11424764
Ref: 6ea11424764
Ref: library/configparser configparser ConfigParser defaults11430584
Ref: 31be11430584
Ref: library/configparser configparser ConfigParser sections11430716
Ref: 31bf11430716
Ref: library/configparser configparser ConfigParser add_section11430889
Ref: 162711430889
Ref: library/configparser configparser ConfigParser has_section11431581
Ref: 31c011431581
Ref: library/configparser configparser ConfigParser options11431768
Ref: 31c111431768
Ref: library/configparser configparser ConfigParser has_option11431925
Ref: 31c211431925
Ref: library/configparser configparser ConfigParser read11432321
Ref: 182011432321
Ref: library/configparser configparser ConfigParser read_file11434553
Ref: 91a11434553
Ref: library/configparser configparser ConfigParser read_string11435107
Ref: 31b711435107
Ref: library/configparser configparser ConfigParser read_dict11435555
Ref: 31b611435555
Ref: library/configparser configparser ConfigParser get11436393
Ref: 162511436393
Ref: library/configparser configparser ConfigParser getint11437378
Ref: 31af11437378
Ref: library/configparser configparser ConfigParser getfloat11437706
Ref: 31b011437706
Ref: library/configparser configparser ConfigParser getboolean11438016
Ref: 31ae11438016
Ref: library/configparser configparser ConfigParser items11438747
Ref: 31c311438747
Ref: library/configparser configparser ConfigParser set11439544
Ref: 162611439544
Ref: library/configparser configparser ConfigParser write11439976
Ref: 47c11439976
Ref: library/configparser configparser ConfigParser remove_option11440977
Ref: 31c511440977
Ref: library/configparser configparser ConfigParser remove_section11441393
Ref: 31c611441393
Ref: library/configparser configparser ConfigParser optionxform11441661
Ref: 31bc11441661
Ref: library/configparser configparser UNNAMED_SECTION11442863
Ref: 19bd11442863
Ref: library/configparser configparser MAX_INTERPOLATION_DEPTH11443039
Ref: 31c711443039
Node: RawConfigParser オブジェクト11443277
Ref: library/configparser id1511443457
Ref: 31c811443457
Ref: library/configparser rawconfigparser-objects11443457
Ref: 31c911443457
Ref: library/configparser configparser RawConfigParser11443542
Ref: 131311443542
Ref: library/configparser configparser RawConfigParser add_section11445021
Ref: 31ca11445021
Ref: library/configparser configparser RawConfigParser set11445865
Ref: 31cc11445865
Node: 例外<10>11446995
Ref: library/configparser exceptions11447135
Ref: 31cd11447135
Ref: library/configparser configparser Error11447168
Ref: 31ce11447168
Ref: library/configparser configparser NoSectionError11447262
Ref: 31c411447262
Ref: library/configparser configparser DuplicateSectionError11447394
Ref: 162811447394
Ref: library/configparser configparser DuplicateOptionError11447807
Ref: 162911447807
Ref: library/configparser configparser NoOptionError11448252
Ref: 31cf11448252
Ref: library/configparser configparser InterpolationError11448428
Ref: 31d011448428
Ref: library/configparser configparser InterpolationDepthError11448573
Ref: 31d111448573
Ref: library/configparser configparser InterpolationMissingOptionError11448862
Ref: 31d211448862
Ref: library/configparser configparser InterpolationSyntaxError11449085
Ref: 31d311449085
Ref: library/configparser configparser MissingSectionHeaderError11449332
Ref: 31d411449332
Ref: library/configparser configparser ParsingError11449511
Ref: 91911449511
Ref: library/configparser configparser MultilineContinuationError11449845
Ref: 31bd11449845
Ref: library/configparser configparser UnnamedSectionDisabledError11450032
Ref: 31cb11450032
Ref: library/configparser configparser InvalidWriteError11450225
Ref: 47d11450225
Node: tomllib --- TOML ファイルの解析11450669
Ref: library/tomllib doc11450879
Ref: 31d511450879
Ref: library/tomllib module-tomllib11450879
Ref: 10511450879
Ref: library/tomllib tomllib-parse-toml-files11450879
Ref: 31d611450879
Ref: library/tomllib translation-repo11450879
Ref: 31d711450879
Ref: library/tomllib tomllib load11452267
Ref: 31d811452267
Ref: library/tomllib tomllib loads11453295
Ref: 1b6611453295
Ref: library/tomllib tomllib TOMLDecodeError11453809
Ref: 1b4811453809
Ref: library/tomllib tomllib TOMLDecodeError msg11453956
Ref: 31da11453956
Ref: library/tomllib tomllib TOMLDecodeError doc11454062
Ref: 31db11454062
Ref: library/tomllib tomllib TOMLDecodeError pos11454150
Ref: 31dc11454150
Ref: library/tomllib tomllib TOMLDecodeError lineno11454241
Ref: 31dd11454241
Ref: library/tomllib tomllib TOMLDecodeError colno11454314
Ref: 31de11454314
Ref: tomllib --- TOML ファイルの解析-Footnote-111454784
Ref: tomllib --- TOML ファイルの解析-Footnote-211454848
Ref: tomllib --- TOML ファイルの解析-Footnote-311454876
Ref: tomllib --- TOML ファイルの解析-Footnote-411454918
Node: 使用例<18>11454960
Ref: library/tomllib examples11455066
Ref: 31df11455066
Node: 変換表11455433
Ref: library/tomllib conversion-table11455539
Ref: 31e011455539
Ref: library/tomllib toml-to-py-table11455575
Ref: 31d911455575
Node: netrc --- netrc ファイルの処理11457096
Ref: library/netrc doc11457317
Ref: 31e111457317
Ref: library/netrc module-netrc11457317
Ref: 9f11457317
Ref: library/netrc netrc-netrc-file-processing11457317
Ref: 31e211457317
Ref: library/netrc translation-repo11457317
Ref: 31e311457317
Ref: library/netrc netrc netrc11457714
Ref: 1e8f11457714
Ref: library/netrc netrc NetrcParseError11459816
Ref: 31e411459816
Ref: library/netrc netrc NetrcParseError msg11460069
Ref: 31e511460069
Ref: library/netrc netrc NetrcParseError filename11460148
Ref: 31e611460148
Ref: library/netrc netrc NetrcParseError lineno11460223
Ref: 31e711460223
Ref: netrc --- netrc ファイルの処理-Footnote-111460377
Node: netrc オブジェクト11460442
Ref: library/netrc id111460540
Ref: 31e811460540
Ref: library/netrc netrc-objects11460540
Ref: 31e911460540
Ref: library/netrc netrc netrc authenticators11460688
Ref: 31ea11460688
Ref: library/netrc netrc netrc __repr__11461144
Ref: 31eb11461144
Ref: library/netrc netrc netrc hosts11461516
Ref: 31ec11461516
Ref: library/netrc netrc netrc macros11461775
Ref: 31ed11461775
Node: plistlib --- Apple plist ファイルを生成・解析する11461886
Ref: library/plistlib doc11462060
Ref: 31ee11462060
Ref: library/plistlib module-plistlib11462060
Ref: b011462060
Ref: library/plistlib plistlib-generate-and-parse-apple-plist-files11462060
Ref: 31ef11462060
Ref: library/plistlib translation-repo11462060
Ref: 31f011462060
Ref: library/plistlib plistlib load11464016
Ref: d1e11464016
Ref: library/plistlib plistlib loads11465519
Ref: d1f11465519
Ref: library/plistlib plistlib dump11465967
Ref: d2011465967
Ref: library/plistlib plistlib dumps11467638
Ref: d2111467638
Ref: library/plistlib plistlib UID11468037
Ref: de911468037
Ref: library/plistlib plistlib UID data11468298
Ref: 31f111468298
Ref: library/plistlib plistlib FMT_XML11468483
Ref: 132811468483
Ref: library/plistlib plistlib FMT_BINARY11468589
Ref: 132911468589
Ref: library/plistlib plistlib InvalidFileException11468751
Ref: 1f0e11468751
Ref: plistlib --- Apple plist ファイルを生成・解析する-Footnote-111468939
Ref: plistlib --- Apple plist ファイルを生成・解析する-Footnote-211469007
Node: 使用例<19>11469106
Ref: library/plistlib examples11469217
Ref: 31f211469217
Node: 暗号関連のサービス11470083
Ref: library/crypto doc11470277
Ref: 31f311470277
Ref: library/crypto crypto11470277
Ref: 31f411470277
Ref: library/crypto cryptographic-services11470277
Ref: 31f511470277
Ref: library/crypto translation-repo11470277
Ref: 31f611470277
Node: hashlib --- セキュアハッシュとメッセージダイジェスト11471017
Ref: library/hashlib doc11471228
Ref: 31f711471228
Ref: library/hashlib hashlib-secure-hashes-and-message-digests11471228
Ref: 31f811471228
Ref: library/hashlib module-hashlib11471228
Ref: 6b11471228
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-111472228
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-211472295
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-311472352
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-411472402
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-511472472
Node: ハッシュアルゴリズム11472531
Ref: library/hashlib hash-algorithms11472688
Ref: 31f911472688
Ref: library/hashlib id111472688
Ref: 31fa11472688
Ref: library/hashlib hashlib-usedforsecurity11475009
Ref: 320311475009
Ref: ハッシュアルゴリズム-Footnote-111476025
Ref: ハッシュアルゴリズム-Footnote-211476133
Node: 使用法11476180
Ref: library/hashlib usage11476367
Ref: 320411476367
Node: コンストラクタ11477127
Ref: library/hashlib constructors11477290
Ref: 320511477290
Ref: library/hashlib hashlib new11477346
Ref: 2fd11477346
Ref: library/hashlib hashlib md511477985
Ref: 2fe11477985
Ref: library/hashlib hashlib sha111478047
Ref: 31fe11478047
Ref: library/hashlib hashlib sha22411478110
Ref: 31ff11478110
Ref: library/hashlib hashlib sha25611478175
Ref: 2ff11478175
Ref: library/hashlib hashlib sha38411478240
Ref: 320011478240
Ref: library/hashlib hashlib sha51211478305
Ref: 320111478305
Ref: library/hashlib hashlib sha3_22411478370
Ref: 106711478370
Ref: library/hashlib hashlib sha3_25611478437
Ref: 106811478437
Ref: library/hashlib hashlib sha3_38411478504
Ref: 106911478504
Ref: library/hashlib hashlib sha3_51211478571
Ref: 106a11478571
Node: 属性11478735
Ref: library/hashlib attributes11478901
Ref: 320611478901
Ref: library/hashlib hashlib algorithms_guaranteed11478992
Ref: 172d11478992
Ref: library/hashlib hashlib algorithms_available11479538
Ref: 172e11479538
Node: Hash Objects11480011
Ref: library/hashlib hash-objects11480189
Ref: 320711480189
Ref: library/hashlib hashlib hash digest_size11480361
Ref: 320811480361
Ref: library/hashlib hashlib hash block_size11480446
Ref: 320911480446
Ref: library/hashlib hashlib hash name11480644
Ref: 12f711480644
Ref: library/hashlib hashlib hash update11481217
Ref: 31fb11481217
Ref: library/hashlib hashlib hash digest11481604
Ref: 31fc11481604
Ref: library/hashlib hashlib hash hexdigest11481893
Ref: 31fd11481893
Ref: library/hashlib hashlib hash copy11482153
Ref: 320a11482153
Node: SHAKE 可変長ダイジェスト11482414
Ref: library/hashlib shake-variable-length-digests11482616
Ref: 320b11482616
Ref: library/hashlib hashlib shake_12811482694
Ref: 106b11482694
Ref: library/hashlib hashlib shake_25611482762
Ref: 106c11482762
Ref: library/hashlib hashlib shake digest11483093
Ref: 202711483093
Ref: library/hashlib hashlib shake hexdigest11483373
Ref: 202811483373
Node: ファイルのハッシュ化11483801
Ref: library/hashlib file-hashing11484000
Ref: 320c11484000
Ref: library/hashlib hashlib file_digest11484171
Ref: a3811484171
Node: 鍵導出11485877
Ref: library/hashlib key-derivation11486049
Ref: 320d11486049
Ref: library/hashlib hashlib pbkdf2_hmac11486494
Ref: 92311486494
Ref: library/hashlib hashlib scrypt11488537
Ref: 100011488537
Ref: 鍵導出-Footnote-111489442
Ref: 鍵導出-Footnote-211489504
Ref: 鍵導出-Footnote-311489591
Ref: 鍵導出-Footnote-411489702
Node: BLAKE211489761
Ref: library/hashlib blake211489894
Ref: 320e11489894
Ref: library/hashlib hashlib-blake211489894
Ref: 320f11489894
Ref: BLAKE2-Footnote-111490649
Ref: BLAKE2-Footnote-211490680
Ref: BLAKE2-Footnote-311490739
Node: ハッシュオブジェクトの作成11490817
Ref: library/hashlib creating-hash-objects11490917
Ref: 321011490917
Ref: library/hashlib hashlib blake2b11491123
Ref: a3611491123
Ref: library/hashlib hashlib blake2s11491360
Ref: a3711491360
Ref: ハッシュオブジェクトの作成-Footnote-111494540
Node: 定数<5>11494591
Ref: library/hashlib constants11494713
Ref: 321111494713
Ref: library/hashlib hashlib blake2b SALT_SIZE11494746
Ref: 321211494746
Ref: library/hashlib hashlib blake2s SALT_SIZE11494780
Ref: 321311494780
Ref: library/hashlib hashlib blake2b PERSON_SIZE11494885
Ref: 321411494885
Ref: library/hashlib hashlib blake2s PERSON_SIZE11494921
Ref: 321511494921
Ref: library/hashlib hashlib blake2b MAX_KEY_SIZE11495031
Ref: 321611495031
Ref: library/hashlib hashlib blake2s MAX_KEY_SIZE11495068
Ref: 321711495068
Ref: library/hashlib hashlib blake2b MAX_DIGEST_SIZE11495122
Ref: 321811495122
Ref: library/hashlib hashlib blake2s MAX_DIGEST_SIZE11495162
Ref: 321911495162
Node: 使用例<20>11495270
Ref: library/hashlib examples11495368
Ref: 321a11495368
Node: 簡単なハッシュ化11495562
Ref: library/hashlib simple-hashing11495673
Ref: 321b11495673
Node: Using different digest sizes11497139
Ref: library/hashlib using-different-digest-sizes11497272
Ref: 321c11497272
Node: Keyed hashing11498517
Ref: library/hashlib keyed-hashing11498644
Ref: 321d11498644
Ref: Keyed hashing-Footnote-111500651
Node: Randomized hashing11500694
Ref: library/hashlib randomized-hashing11500808
Ref: 321e11500808
Ref: Randomized hashing-Footnote-111503410
Ref: Randomized hashing-Footnote-211503462
Node: Personalization11503497
Ref: library/hashlib personalization11503616
Ref: 321f11503616
Ref: Personalization-Footnote-111505634
Node: ツリーモード11505704
Ref: library/hashlib tree-mode11505796
Ref: 322011505796
Node: クレジット11507120
Ref: library/hashlib credits11507200
Ref: 322111507200
Ref: library/hashlib hashlib-seealso11508938
Ref: 320211508938
Ref: クレジット-Footnote-111510075
Ref: クレジット-Footnote-211510106
Ref: クレジット-Footnote-311510167
Ref: クレジット-Footnote-411510245
Ref: クレジット-Footnote-511510282
Ref: クレジット-Footnote-611510325
Node: hmac --- メッセージ認証のための鍵付きハッシュ化11510368
Ref: library/hmac doc11510654
Ref: 322211510654
Ref: library/hmac hmac-keyed-hashing-for-message-authentication11510654
Ref: 322311510654
Ref: library/hmac module-hmac11510654
Ref: 6d11510654
Ref: library/hmac translation-repo11510654
Ref: 322411510654
Ref: library/hmac hmac new11511143
Ref: e6911511143
Ref: library/hmac hmac digest11512116
Ref: f0011512116
Ref: library/hmac hmac HMAC11512850
Ref: f0111512850
Ref: library/hmac hmac HMAC update11512952
Ref: 12f911512952
Ref: library/hmac hmac HMAC digest11513457
Ref: 322511513457
Ref: library/hmac hmac HMAC hexdigest11514124
Ref: 322611514124
Ref: library/hmac hmac HMAC copy11514722
Ref: 19c811514722
Ref: library/hmac hmac HMAC digest_size11515087
Ref: 12fc11515087
Ref: library/hmac hmac HMAC block_size11515184
Ref: 12fa11515184
Ref: library/hmac hmac HMAC name11515335
Ref: 12fb11515335
Ref: library/hmac hmac compare_digest11515694
Ref: 148a11515694
Ref: hmac --- メッセージ認証のための鍵付きハッシュ化-Footnote-111516858
Ref: hmac --- メッセージ認証のための鍵付きハッシュ化-Footnote-211516922
Node: secrets --- 機密を扱うために安全な乱数を生成する11516981
Ref: library/secrets doc11517186
Ref: 322711517186
Ref: library/secrets module-secrets11517186
Ref: c811517186
Ref: library/secrets secrets-generate-secure-random-numbers-for-managing-secrets11517186
Ref: 322811517186
Ref: library/secrets translation-repo11517186
Ref: 322911517186
Ref: secrets --- 機密を扱うために安全な乱数を生成する-Footnote-111518043
Ref: secrets --- 機密を扱うために安全な乱数を生成する-Footnote-211518110
Node: 乱数11518152
Ref: library/secrets random-numbers11518291
Ref: 322a11518291
Ref: library/secrets secrets SystemRandom11518441
Ref: 322b11518441
Ref: library/secrets secrets choice11518702
Ref: 322c11518702
Ref: library/secrets secrets randbelow11518830
Ref: 322d11518830
Ref: library/secrets secrets randbits11518975
Ref: 322e11518975
Node: トークンの生成11519084
Ref: library/secrets generating-tokens11519250
Ref: 322f11519250
Ref: library/secrets secrets token_bytes11519465
Ref: 2d9011519465
Ref: library/secrets secrets token_hex11519775
Ref: 1d4311519775
Ref: library/secrets secrets token_urlsafe11520132
Ref: 323111520132
Node: トークンは何バイト使うべきか？11520595
Ref: library/secrets how-many-bytes-should-tokens-use11520698
Ref: 323211520698
Ref: library/secrets secrets DEFAULT_ENTROPY11521622
Ref: 323011521622
Ref: トークンは何バイト使うべきか？-Footnote-111521884
Node: その他の関数11521941
Ref: library/secrets other-functions11522140
Ref: 323311522140
Ref: library/secrets secrets compare_digest11522191
Ref: 323411522191
Ref: その他の関数-Footnote-111522663
Node: レシピとベストプラクティス11522720
Ref: library/secrets recipes-and-best-practices11522889
Ref: 323511522889
Ref: レシピとベストプラクティス-Footnote-111524854
Ref: レシピとベストプラクティス-Footnote-211524910
Node: 汎用オペレーティングシステムサービス11524940
Ref: library/allos doc11525164
Ref: 323611525164
Ref: library/allos allos11525164
Ref: 323711525164
Ref: library/allos generic-operating-system-services11525164
Ref: 323811525164
Ref: library/allos translation-repo11525164
Ref: 323911525164
Node: os --- 雑多なオペレーティングシステムインターフェース11526722
Ref: library/os doc11526944
Ref: 323a11526944
Ref: library/os module-os11526944
Ref: a511526944
Ref: library/os os-miscellaneous-operating-system-interfaces11526944
Ref: 323b11526944
Ref: library/os os error11529705
Ref: 323d11529705
Ref: library/os os name11529812
Ref: 323e11529812
Ref: library/os os-filenames11530384
Ref: 318011530384
Ref: os --- 雑多なオペレーティングシステムインターフェース-Footnote-111530813
Node: ファイル名、コマンドライン引数、および環境変数11530875
Ref: library/os file-names-command-line-arguments-and-environment-variables11531083
Ref: 323f11531083
Ref: library/os filesystem-encoding11531083
Ref: 2e6611531083
Node: Python UTF-8 Mode11532946
Ref: library/os python-utf-8-mode11533196
Ref: 324011533196
Ref: library/os utf8-mode11533196
Ref: a4b11533196
Ref: Python UTF-8 Mode-Footnote-111536035
Ref: Python UTF-8 Mode-Footnote-211536077
Node: プロセスのパラメーター11536119
Ref: library/os os-procinfo11536339
Ref: 324111536339
Ref: library/os process-parameters11536339
Ref: 324211536339
Ref: library/os os ctermid11536592
Ref: 324311536592
Ref: library/os os environ11536753
Ref: 4ec11536753
Ref: library/os os environb11539158
Ref: 4ed11539158
Ref: library/os os reload_environ11539804
Ref: 4eb11539804
Ref: library/os os fsencode11540875
Ref: 101711540875
Ref: library/os os fsdecode11541430
Ref: 101611541430
Ref: library/os os fspath11541983
Ref: 101511541983
Ref: library/os os PathLike11542529
Ref: 101311542529
Ref: library/os os PathLike __fspath__11542742
Ref: 101411542742
Ref: library/os os getenv11543067
Ref: 324411543067
Ref: library/os os getenvb11543991
Ref: 15d311543991
Ref: library/os os get_exec_path11544797
Ref: 324611544797
Ref: library/os os getegid11545249
Ref: 324711545249
Ref: library/os os geteuid11545518
Ref: 1d8e11545518
Ref: library/os os getgid11545668
Ref: 324811545668
Ref: library/os os getgrouplist11545923
Ref: 14d511545923
Ref: library/os os getgroups11546319
Ref: 324911546319
Ref: library/os os getlogin11547539
Ref: 1a1411547539
Ref: library/os os getpgid11548054
Ref: 324b11548054
Ref: library/os os getpgrp11548329
Ref: 324c11548329
Ref: library/os os getpid11548473
Ref: 323c11548473
Ref: library/os os getppid11548671
Ref: 1bf511548671
Ref: library/os os getpriority11549171
Ref: 14c011549171
Ref: library/os os PRIO_PROCESS11549991
Ref: 324d11549991
Ref: library/os os PRIO_PGRP11550022
Ref: 324e11550022
Ref: library/os os PRIO_USER11550050
Ref: 324f11550050
Ref: library/os os PRIO_DARWIN_THREAD11550257
Ref: 325011550257
Ref: library/os os PRIO_DARWIN_PROCESS11550294
Ref: 325111550294
Ref: library/os os PRIO_DARWIN_BG11550332
Ref: 325211550332
Ref: library/os os PRIO_DARWIN_NONUI11550365
Ref: 325311550365
Ref: library/os os getresuid11550571
Ref: 16cf11550571
Ref: library/os os getresgid11550857
Ref: 16ce11550857
Ref: library/os os getuid11551143
Ref: 1a3111551143
Ref: library/os os initgroups11551398
Ref: 16d211551398
Ref: library/os os putenv11551721
Ref: 4ee11551721
Ref: library/os os setegid11553184
Ref: 325511553184
Ref: library/os os seteuid11553360
Ref: 325611553360
Ref: library/os os setgid11553536
Ref: 325711553536
Ref: library/os os setgroups11553704
Ref: 324a11553704
Ref: library/os os setns11554564
Ref: 1d5e11554564
Ref: library/os os setpgrp11556077
Ref: 325911556077
Ref: library/os os setpgid11556374
Ref: 325a11556374
Ref: library/os os setpriority11556720
Ref: 14c111556720
Ref: library/os os setregid11557723
Ref: 325b11557723
Ref: library/os os setresgid11557931
Ref: 16d011557931
Ref: library/os os setresuid11558211
Ref: 16d111558211
Ref: library/os os setreuid11558488
Ref: 325c11558488
Ref: library/os os getsid11558696
Ref: 325d11558696
Ref: library/os os setsid11558928
Ref: 1fc911558928
Ref: library/os os setuid11559154
Ref: 325e11559154
Ref: library/os os strerror11559319
Ref: 325f11559319
Ref: library/os os supports_bytes_environ11559621
Ref: 15d211559621
Ref: library/os os umask11559832
Ref: 326011559832
Ref: library/os os uname11560067
Ref: 14d711560067
Ref: library/os os unsetenv11561695
Ref: 4ef11561695
Ref: library/os os unshare11562665
Ref: 1d5f11562665
Ref: library/os os-unshare-clone-flags11563368
Ref: 325811563368
Ref: library/os os CLONE_FILES11563538
Ref: 326211563538
Ref: library/os os CLONE_FS11563568
Ref: 326311563568
Ref: library/os os CLONE_NEWCGROUP11563595
Ref: 326411563595
Ref: library/os os CLONE_NEWIPC11563629
Ref: 326511563629
Ref: library/os os CLONE_NEWNET11563660
Ref: 326611563660
Ref: library/os os CLONE_NEWNS11563691
Ref: 326711563691
Ref: library/os os CLONE_NEWPID11563721
Ref: 326811563721
Ref: library/os os CLONE_NEWTIME11563752
Ref: 326911563752
Ref: library/os os CLONE_NEWUSER11563784
Ref: 326a11563784
Ref: library/os os CLONE_NEWUTS11563816
Ref: 326b11563816
Ref: library/os os CLONE_SIGHAND11563847
Ref: 326c11563847
Ref: library/os os CLONE_SYSVSEM11563879
Ref: 326d11563879
Ref: library/os os CLONE_THREAD11563911
Ref: 326e11563911
Ref: library/os os CLONE_VM11563942
Ref: 326f11563942
Ref: プロセスのパラメーター-Footnote-111564006
Ref: プロセスのパラメーター-Footnote-211564048
Ref: プロセスのパラメーター-Footnote-311564090
Ref: プロセスのパラメーター-Footnote-411564135
Ref: プロセスのパラメーター-Footnote-511564185
Ref: プロセスのパラメーター-Footnote-611564232
Node: ファイルオブジェクトの生成11564279
Ref: library/os file-object-creation11564512
Ref: 327011564512
Ref: library/os os-newstreams11564512
Ref: 327111564512
Ref: library/os os fdopen11564795
Ref: 259011564795
Node: ファイル記述子の操作11565193
Ref: library/os file-descriptor-operations11565426
Ref: 327211565426
Ref: library/os os-fd-ops11565426
Ref: 327311565426
Ref: library/os os close11566599
Ref: f3511566599
Ref: library/os os closerange11567181
Ref: 327411567181
Ref: library/os os copy_file_range11567546
Ref: 1af411567546
Ref: library/os os device_encoding11569264
Ref: 1e4b11569264
Ref: library/os os dup11569813
Ref: 1fd111569813
Ref: library/os os dup211570339
Ref: f2411570339
Ref: library/os os fchmod11570991
Ref: 73311570991
Ref: library/os os fchown11571682
Ref: 114711571682
Ref: library/os os fdatasync11572399
Ref: 114811572399
Ref: library/os os fpathconf11572707
Ref: 327611572707
Ref: library/os os fstat11573933
Ref: 114911573933
Ref: library/os os fstatvfs11574219
Ref: 114a11574219
Ref: library/os os fsync11574561
Ref: 114b11574561
Ref: library/os os ftruncate11575149
Ref: 114c11575149
Ref: library/os os get_blocking11575682
Ref: 11f011575682
Ref: library/os os grantpt11576397
Ref: 1c2511576397
Ref: library/os os isatty11576782
Ref: 1e4a11576782
Ref: library/os os lockf11577044
Ref: 14d411577044
Ref: library/os os F_LOCK11577758
Ref: 327811577758
Ref: library/os os F_TLOCK11577783
Ref: 327911577783
Ref: library/os os F_ULOCK11577809
Ref: 327a11577809
Ref: library/os os F_TEST11577835
Ref: 327b11577835
Ref: library/os os login_tty11578004
Ref: 1cea11578004
Ref: library/os os lseek11578364
Ref: 14d811578364
Ref: library/os os SEEK_SET11579214
Ref: 164711579214
Ref: library/os os SEEK_CUR11579241
Ref: 164811579241
Ref: library/os os SEEK_END11579268
Ref: 164911579268
Ref: library/os os SEEK_HOLE11579852
Ref: 327c11579852
Ref: library/os os SEEK_DATA11579880
Ref: 327d11579880
Ref: library/os os open11580612
Ref: 114f11580612
Ref: library/os os O_RDONLY11583111
Ref: 327e11583111
Ref: library/os os O_WRONLY11583138
Ref: 327f11583138
Ref: library/os os O_RDWR11583165
Ref: 328111583165
Ref: library/os os O_APPEND11583190
Ref: 328211583190
Ref: library/os os O_CREAT11583217
Ref: 328311583217
Ref: library/os os O_EXCL11583243
Ref: 1a2e11583243
Ref: library/os os O_TRUNC11583268
Ref: 328411583268
Ref: library/os os O_DSYNC11583368
Ref: 328511583368
Ref: library/os os O_RSYNC11583394
Ref: 328611583394
Ref: library/os os O_SYNC11583420
Ref: 328711583420
Ref: library/os os O_NDELAY11583445
Ref: 328811583445
Ref: library/os os O_NONBLOCK11583472
Ref: 11f211583472
Ref: library/os os O_NOCTTY11583501
Ref: 328911583501
Ref: library/os os O_CLOEXEC11583528
Ref: 143311583528
Ref: library/os os O_BINARY11583719
Ref: 328011583719
Ref: library/os os O_NOINHERIT11583746
Ref: 328a11583746
Ref: library/os os O_SHORT_LIVED11583776
Ref: 328b11583776
Ref: library/os os O_TEMPORARY11583808
Ref: 328c11583808
Ref: library/os os O_RANDOM11583838
Ref: 328d11583838
Ref: library/os os O_SEQUENTIAL11583865
Ref: 328e11583865
Ref: library/os os O_TEXT11583896
Ref: 328f11583896
Ref: library/os os O_EVTONLY11583986
Ref: bf711583986
Ref: library/os os O_FSYNC11584014
Ref: bf811584014
Ref: library/os os O_SYMLINK11584040
Ref: bf911584040
Ref: library/os os O_NOFOLLOW_ANY11584068
Ref: bfa11584068
Ref: library/os os O_ASYNC11584295
Ref: 329011584295
Ref: library/os os O_DIRECT11584321
Ref: 329111584321
Ref: library/os os O_DIRECTORY11584348
Ref: 329211584348
Ref: library/os os O_NOFOLLOW11584378
Ref: 329311584378
Ref: library/os os O_NOATIME11584407
Ref: 329411584407
Ref: library/os os O_PATH11584435
Ref: 132111584435
Ref: library/os os O_TMPFILE11584460
Ref: 132211584460
Ref: library/os os O_SHLOCK11584488
Ref: 17e711584488
Ref: library/os os O_EXLOCK11584515
Ref: 17e811584515
Ref: library/os os openpty11584923
Ref: 329511584923
Ref: library/os os pipe11585438
Ref: 1d8111585438
Ref: library/os os pipe211585850
Ref: 14aa11585850
Ref: library/os os posix_fallocate11586288
Ref: 115111586288
Ref: library/os os posix_fadvise11586590
Ref: 115011586590
Ref: library/os os POSIX_FADV_NORMAL11587334
Ref: 329611587334
Ref: library/os os POSIX_FADV_SEQUENTIAL11587370
Ref: 329711587370
Ref: library/os os POSIX_FADV_RANDOM11587410
Ref: 329811587410
Ref: library/os os POSIX_FADV_NOREUSE11587446
Ref: 329911587446
Ref: library/os os POSIX_FADV_WILLNEED11587483
Ref: 329a11587483
Ref: library/os os POSIX_FADV_DONTNEED11587521
Ref: 329b11587521
Ref: library/os os pread11587793
Ref: f2011587793
Ref: library/os os posix_openpt11588242
Ref: 1c2411588242
Ref: library/os os preadv11588841
Ref: f1e11588841
Ref: library/os os RWF_NOWAIT11590216
Ref: 329d11590216
Ref: library/os os RWF_HIPRI11590789
Ref: 329c11590789
Ref: library/os os RWF_DONTCACHE11591345
Ref: 1a1611591345
Ref: library/os os RWF_ATOMIC11591486
Ref: 199c11591486
Ref: library/os os ptsname11591681
Ref: 1c2711591681
Ref: library/os os pwrite11592224
Ref: f2311592224
Ref: library/os os pwritev11592572
Ref: f2111592572
Ref: library/os os RWF_DSYNC11593822
Ref: 329e11593822
Ref: library/os os RWF_SYNC11594189
Ref: 329f11594189
Ref: library/os os RWF_APPEND11594554
Ref: 1f4111594554
Ref: library/os os read11595117
Ref: 115211595117
Ref: library/os os readinto11596227
Ref: 4f211596227
Ref: library/os os sendfile11597444
Ref: ed711597444
Ref: library/os os SF_NODISKIO11599452
Ref: 32a011599452
Ref: library/os os SF_MNOWAIT11599482
Ref: 32a111599482
Ref: library/os os SF_SYNC11599511
Ref: 32a211599511
Ref: library/os os SF_NOCACHE11599733
Ref: 32a311599733
Ref: library/os os set_blocking11600020
Ref: 11f111600020
Ref: library/os os splice11600758
Ref: bf611600758
Ref: library/os os SPLICE_F_MOVE11603177
Ref: 32a411603177
Ref: library/os os SPLICE_F_NONBLOCK11603209
Ref: 32a511603209
Ref: library/os os SPLICE_F_MORE11603245
Ref: 32a611603245
Ref: library/os os readv11603307
Ref: f1f11603307
Ref: library/os os tcgetpgrp11604064
Ref: 32a711604064
Ref: library/os os tcsetpgrp11604333
Ref: 32a811604333
Ref: library/os os ttyname11604624
Ref: 32a911604624
Ref: library/os os unlockpt11604921
Ref: 1c2611604921
Ref: library/os os write11605298
Ref: 115811605298
Ref: library/os os writev11606292
Ref: f2211606292
Ref: ファイル記述子の操作-Footnote-111607196
Ref: ファイル記述子の操作-Footnote-211607238
Ref: ファイル記述子の操作-Footnote-311607282
Ref: ファイル記述子の操作-Footnote-411607345
Ref: ファイル記述子の操作-Footnote-511607387
Ref: ファイル記述子の操作-Footnote-611607433
Node: ターミナルのサイズの問い合わせ11607475
Ref: library/os querying-the-size-of-a-terminal11607626
Ref: 32aa11607626
Ref: library/os terminal-size11607626
Ref: 32ab11607626
Ref: library/os os get_terminal_size11607745
Ref: 14c311607745
Ref: library/os os terminal_size11608464
Ref: 2f3711608464
Ref: library/os os terminal_size columns11608627
Ref: 32ac11608627
Ref: library/os os terminal_size lines11608729
Ref: 32ad11608729
Node: ファイル記述子の継承11608829
Ref: library/os fd-inheritance11608980
Ref: 12ad11608980
Ref: library/os inheritance-of-file-descriptors11608980
Ref: 32ae11608980
Ref: library/os os get_inheritable11610479
Ref: 12ae11610479
Ref: library/os os set_inheritable11610643
Ref: 12af11610643
Ref: library/os os get_handle_inheritable11610813
Ref: 12b011610813
Ref: library/os os set_handle_inheritable11611020
Ref: 12b111611020
Node: ファイルとディレクトリ11611228
Ref: library/os files-and-directories11611440
Ref: 32af11611440
Ref: library/os os-file-dir11611440
Ref: 324511611440
Ref: library/os path-fd11611667
Ref: f1d11611667
Ref: library/os dir-fd11612755
Ref: 14ab11612755
Ref: library/os follow-symlinks11613507
Ref: 14ac11613507
Ref: library/os os access11614132
Ref: 14ad11614132
Ref: library/os os F_OK11617628
Ref: 32b011617628
Ref: library/os os R_OK11617651
Ref: 32b111617651
Ref: library/os os W_OK11617674
Ref: 32b211617674
Ref: library/os os X_OK11617697
Ref: 32b311617697
Ref: library/os os chdir11617961
Ref: a0711617961
Ref: library/os os chflags11618950
Ref: 14ae11618950
Ref: library/os os chmod11620232
Ref: 73211620232
Ref: library/os os chown11622572
Ref: 14af11622572
Ref: library/os os chroot11623885
Ref: 1f8f11623885
Ref: library/os os fchdir11624188
Ref: 114611624188
Ref: library/os os getcwd11624716
Ref: 1b4511624716
Ref: library/os os getcwdb11624821
Ref: e5511624821
Ref: library/os os lchflags11625257
Ref: 32b511625257
Ref: library/os os lchmod11625864
Ref: 73111625864
Ref: library/os os lchown11626911
Ref: 32b611626911
Ref: library/os os link11627551
Ref: 14b011627551
Ref: library/os os listdir11628530
Ref: 14bb11628530
Ref: library/os os listdrives11630620
Ref: 8b311630620
Ref: library/os os listmounts11631254
Ref: 8b511631254
Ref: library/os os listvolumes11632096
Ref: 8b411632096
Ref: library/os os lstat11632817
Ref: 8b611632817
Ref: library/os os mkdir11634105
Ref: 73411634105
Ref: library/os mkdir-modebits11634424
Ref: 32b711634424
Ref: library/os os makedirs11635963
Ref: 24b11635963
Ref: library/os os mkfifo11638676
Ref: 114d11638676
Ref: library/os os mknod11639915
Ref: 114e11639915
Ref: library/os os major11640887
Ref: 1b9011640887
Ref: library/os os minor11641073
Ref: 1b9111641073
Ref: library/os os makedev11641259
Ref: 1b9211641259
Ref: library/os os NODEV11641430
Ref: 1a1911641430
Ref: library/os os pathconf11641511
Ref: 14bc11641511
Ref: library/os os pathconf_names11642844
Ref: 32ba11642844
Ref: library/os os readlink11643271
Ref: cf111643271
Ref: library/os os remove11644992
Ref: 14b111644992
Ref: library/os os removedirs11646112
Ref: 32bb11646112
Ref: library/os os rename11647248
Ref: 14b211647248
Ref: library/os os renames11649083
Ref: 32bc11649083
Ref: library/os os replace11650036
Ref: 14b311650036
Ref: library/os os rmdir11651211
Ref: 14b411651211
Ref: library/os os scandir11651979
Ref: e2711651979
Ref: library/os os scandir close11654200
Ref: 107e11654200
Ref: library/os os DirEntry11656136
Ref: 8b111656136
Ref: library/os os DirEntry name11657715
Ref: 32be11657715
Ref: library/os os DirEntry path11658119
Ref: 1c1f11658119
Ref: library/os os DirEntry inode11658840
Ref: 1c7211658840
Ref: library/os os DirEntry is_dir11659341
Ref: 32bd11659341
Ref: library/os os DirEntry is_file11661464
Ref: 114111661464
Ref: library/os os DirEntry is_symlink11662464
Ref: 32bf11662464
Ref: library/os os DirEntry is_junction11663681
Ref: 8b211663681
Ref: library/os os DirEntry stat11664120
Ref: 1c9011664120
Ref: library/os os stat11666214
Ref: 4fc11666214
Ref: library/os os stat_result11669036
Ref: 187911669036
Ref: library/os os stat_result st_mode11669287
Ref: dd211669287
Ref: library/os os stat_result st_ino11669436
Ref: 32c011669436
Ref: library/os os stat_result st_dev11669685
Ref: 32b911669685
Ref: library/os os stat_result st_nlink11669785
Ref: 32c111669785
Ref: library/os os stat_result st_uid11669854
Ref: 32c211669854
Ref: library/os os stat_result st_gid11669939
Ref: 32c311669939
Ref: library/os os stat_result st_size11670027
Ref: 32c411670027
Ref: library/os os stat_result st_atime11670408
Ref: 32c511670408
Ref: library/os os stat_result st_mtime11670492
Ref: 315011670492
Ref: library/os os stat_result st_ctime11670576
Ref: 32c611670576
Ref: library/os os stat_result st_atime_ns11670953
Ref: 32c711670953
Ref: library/os os stat_result st_mtime_ns11671089
Ref: 32c811671089
Ref: library/os os stat_result st_ctime_ns11671225
Ref: 32c911671225
Ref: library/os os stat_result st_birthtime11671672
Ref: 32ca11671672
Ref: library/os os stat_result st_birthtime_ns11671954
Ref: 32cb11671954
Ref: library/os os stat_result st_blocks11673523
Ref: 32cc11673523
Ref: library/os os stat_result st_blksize11673814
Ref: 32cd11673814
Ref: library/os os stat_result st_rdev11674146
Ref: 1a1811674146
Ref: library/os os stat_result st_flags11674235
Ref: 32ce11674235
Ref: library/os os stat_result st_gen11674539
Ref: 32cf11674539
Ref: library/os os stat_result st_fstype11674690
Ref: f2511674690
Ref: library/os os stat_result st_rsize11674897
Ref: 32d011674897
Ref: library/os os stat_result st_creator11674972
Ref: 32d111674972
Ref: library/os os stat_result st_type11675040
Ref: 32d211675040
Ref: library/os os stat_result st_file_attributes11675173
Ref: 11ef11675173
Ref: library/os os stat_result st_reparse_tag11675553
Ref: dd311675553
Ref: library/os os statx11677966
Ref: 24a11677966
Ref: library/os os statx_result11679007
Ref: 32d611679007
Ref: library/os os statx_result stx_atime11679160
Ref: 32d811679160
Ref: library/os os statx_result stx_atime_ns11679352
Ref: 32da11679352
Ref: library/os os statx_result stx_atomic_write_segments_max11679563
Ref: 32db11679563
Ref: library/os os statx_result stx_atomic_write_unit_max11679931
Ref: 32dd11679931
Ref: library/os os statx_result stx_atomic_write_unit_max_opt11680293
Ref: 32de11680293
Ref: library/os os statx_result stx_atomic_write_unit_min11680679
Ref: 32df11680679
Ref: library/os os statx_result stx_attributes11681041
Ref: 2ee311681041
Ref: library/os os statx_result stx_attributes_mask11681185
Ref: 2ee411681185
Ref: library/os os statx_result stx_blksize11681352
Ref: 32e011681352
Ref: library/os os statx_result stx_blocks11681685
Ref: 32e111681685
Ref: library/os os statx_result stx_btime11681979
Ref: 32e411681979
Ref: library/os os statx_result stx_btime_ns11682172
Ref: 32e611682172
Ref: library/os os statx_result stx_ctime11682386
Ref: 32e711682386
Ref: library/os os statx_result stx_ctime_ns11682593
Ref: 32e911682593
Ref: library/os os statx_result stx_dev11682831
Ref: 32ea11682831
Ref: library/os os statx_result stx_dev_major11682932
Ref: 32eb11682932
Ref: library/os os statx_result stx_dev_minor11683033
Ref: 32ec11683033
Ref: library/os os statx_result stx_dio_mem_align11683134
Ref: 32ed11683134
Ref: library/os os statx_result stx_dio_offset_align11683475
Ref: 32ef11683475
Ref: library/os os statx_result stx_dio_read_offset_align11683817
Ref: 32f011683817
Ref: library/os os statx_result stx_gid11684181
Ref: 32f211684181
Ref: library/os os statx_result stx_ino11684375
Ref: 32f411684375
Ref: library/os os statx_result stx_mask11684540
Ref: 32d711684540
Ref: library/os os statx_result stx_mnt_id11684723
Ref: 32f611684723
Ref: library/os os statx_result stx_mode11685025
Ref: 32f811685025
Ref: library/os os statx_result stx_mtime11685294
Ref: 32f911685294
Ref: library/os os statx_result stx_mtime_ns11685486
Ref: 32fb11685486
Ref: library/os os statx_result stx_nlink11685697
Ref: 32fc11685697
Ref: library/os os statx_result stx_rdev11685874
Ref: 32fe11685874
Ref: library/os os statx_result stx_rdev_major11685964
Ref: 32ff11685964
Ref: library/os os statx_result stx_rdev_minor11686060
Ref: 330011686060
Ref: library/os os statx_result stx_size11686156
Ref: 32e211686156
Ref: library/os os statx_result stx_subvol11686615
Ref: 330211686615
Ref: library/os os statx_result stx_uid11686922
Ref: 330411686922
Ref: library/os os STATX_TYPE11687271
Ref: 32d311687271
Ref: library/os os STATX_MODE11687300
Ref: 330611687300
Ref: library/os os STATX_NLINK11687329
Ref: 32fd11687329
Ref: library/os os STATX_UID11687359
Ref: 330511687359
Ref: library/os os STATX_GID11687387
Ref: 32f311687387
Ref: library/os os STATX_ATIME11687415
Ref: 32d911687415
Ref: library/os os STATX_MTIME11687445
Ref: 32fa11687445
Ref: library/os os STATX_CTIME11687475
Ref: 32e811687475
Ref: library/os os STATX_INO11687505
Ref: 32f511687505
Ref: library/os os STATX_SIZE11687533
Ref: 330111687533
Ref: library/os os STATX_BLOCKS11687562
Ref: 32e311687562
Ref: library/os os STATX_BASIC_STATS11687593
Ref: 330711687593
Ref: library/os os STATX_BTIME11687629
Ref: 32e511687629
Ref: library/os os STATX_MNT_ID11687659
Ref: 32f711687659
Ref: library/os os STATX_DIOALIGN11687690
Ref: 32ee11687690
Ref: library/os os STATX_MNT_ID_UNIQUE11687723
Ref: 330811687723
Ref: library/os os STATX_SUBVOL11687761
Ref: 330311687761
Ref: library/os os STATX_WRITE_ATOMIC11687792
Ref: 32dc11687792
Ref: library/os os STATX_DIO_READ_ALIGN11687829
Ref: 32f111687829
Ref: library/os os AT_STATX_FORCE_SYNC11688171
Ref: 32d411688171
Ref: library/os os AT_STATX_DONT_SYNC11688551
Ref: 330911688551
Ref: library/os os AT_STATX_SYNC_AS_STAT11688809
Ref: 330a11688809
Ref: library/os os AT_NO_AUTOMOUNT11689349
Ref: 32d511689349
Ref: library/os os statvfs11689706
Ref: 14bd11689706
Ref: library/os os supports_dir_fd11692286
Ref: 14b811692286
Ref: library/os os supports_effective_ids11693486
Ref: 14bf11693486
Ref: library/os os supports_fd11694270
Ref: 14be11694270
Ref: library/os os supports_follow_symlinks11695094
Ref: 14b911695094
Ref: library/os os symlink11696226
Ref: 14b511696226
Ref: library/os os sync11698688
Ref: 14d311698688
Ref: library/os os truncate11698870
Ref: 11f311698870
Ref: library/os os unlink11699548
Ref: 14b611699548
Ref: library/os os utime11700174
Ref: 14b711700174
Ref: library/os os walk11702722
Ref: 8be11702722
Ref: library/os os fwalk11709218
Ref: f1c11709218
Ref: library/os os memfd_create11712159
Ref: dd111712159
Ref: library/os os MFD_CLOEXEC11713020
Ref: 330b11713020
Ref: library/os os MFD_ALLOW_SEALING11713050
Ref: 330c11713050
Ref: library/os os MFD_HUGETLB11713086
Ref: 330d11713086
Ref: library/os os MFD_HUGE_SHIFT11713116
Ref: 330e11713116
Ref: library/os os MFD_HUGE_MASK11713149
Ref: 330f11713149
Ref: library/os os MFD_HUGE_64KB11713181
Ref: 331011713181
Ref: library/os os MFD_HUGE_512KB11713213
Ref: 331111713213
Ref: library/os os MFD_HUGE_1MB11713246
Ref: 331211713246
Ref: library/os os MFD_HUGE_2MB11713277
Ref: 331311713277
Ref: library/os os MFD_HUGE_8MB11713308
Ref: 331411713308
Ref: library/os os MFD_HUGE_16MB11713339
Ref: 331511713339
Ref: library/os os MFD_HUGE_32MB11713371
Ref: 331611713371
Ref: library/os os MFD_HUGE_256MB11713403
Ref: 331711713403
Ref: library/os os MFD_HUGE_512MB11713436
Ref: 331811713436
Ref: library/os os MFD_HUGE_1GB11713469
Ref: 331911713469
Ref: library/os os MFD_HUGE_2GB11713500
Ref: 331a11713500
Ref: library/os os MFD_HUGE_16GB11713531
Ref: 331b11713531
Ref: library/os os eventfd11713789
Ref: bf511713789
Ref: library/os os eventfd_read11715833
Ref: 331c11715833
Ref: library/os os eventfd_write11716118
Ref: 331d11716118
Ref: library/os os EFD_CLOEXEC11716415
Ref: 1d7511716415
Ref: library/os os EFD_NONBLOCK11716605
Ref: 1d7611716605
Ref: library/os os EFD_SEMAPHORE11716813
Ref: 1d7711716813
Ref: ファイルとディレクトリ-Footnote-111717179
Ref: ファイルとディレクトリ-Footnote-211717225
Ref: ファイルとディレクトリ-Footnote-311717267
Ref: ファイルとディレクトリ-Footnote-411717332
Ref: ファイルとディレクトリ-Footnote-511717412
Ref: ファイルとディレクトリ-Footnote-611717494
Ref: ファイルとディレクトリ-Footnote-711717583
Ref: ファイルとディレクトリ-Footnote-811717672
Ref: ファイルとディレクトリ-Footnote-911717730
Ref: ファイルとディレクトリ-Footnote-1011717775
Ref: ファイルとディレクトリ-Footnote-1111717821
Node: Timer File Descriptors11717869
Ref: library/os os-timerfd11717988
Ref: 69311717988
Ref: library/os timer-file-descriptors11717988
Ref: 331e11717988
Ref: library/os os timerfd_create11718200
Ref: 72811718200
Ref: library/os os timerfd_settime11720850
Ref: 72911720850
Ref: library/os os timerfd_settime_ns11723545
Ref: 72a11723545
Ref: library/os os timerfd_gettime11723894
Ref: 72b11723894
Ref: library/os os timerfd_gettime_ns11724474
Ref: 72c11724474
Ref: library/os os TFD_NONBLOCK11724700
Ref: 72d11724700
Ref: library/os os TFD_CLOEXEC11725068
Ref: 72e11725068
Ref: library/os os TFD_TIMER_ABSTIME11725358
Ref: 72f11725358
Ref: library/os os TFD_TIMER_CANCEL_ON_SET11725748
Ref: 73011725748
Ref: Timer File Descriptors-Footnote-111726164
Ref: Timer File Descriptors-Footnote-211726218
Ref: Timer File Descriptors-Footnote-311726272
Ref: Timer File Descriptors-Footnote-411726327
Ref: Timer File Descriptors-Footnote-511726379
Ref: Timer File Descriptors-Footnote-611726432
Ref: Timer File Descriptors-Footnote-711726476
Node: Linux 拡張属性11726531
Ref: library/os linux-extended-attributes11726650
Ref: 332011726650
Ref: library/os os getxattr11726794
Ref: 14c511726794
Ref: library/os os listxattr11727577
Ref: 14c611727577
Ref: library/os os removexattr11728572
Ref: 14c711728572
Ref: library/os os setxattr11729386
Ref: 14c811729386
Ref: library/os os XATTR_SIZE_MAX11730764
Ref: 332311730764
Ref: library/os os XATTR_CREATE11730914
Ref: 332211730914
Ref: library/os os XATTR_REPLACE11731113
Ref: 332111731113
Node: プロセス管理11731325
Ref: library/os os-process11731558
Ref: 332411731558
Ref: library/os process-management11731558
Ref: 332511731558
Ref: library/os os abort11732402
Ref: 332711732402
Ref: library/os os add_dll_directory11732786
Ref: db211732786
Ref: library/os os execl11733975
Ref: 332611733975
Ref: library/os os execle11734023
Ref: 332811734023
Ref: library/os os execlp11734077
Ref: 332911734077
Ref: library/os os execlpe11734126
Ref: 332a11734126
Ref: library/os os execv11734181
Ref: 325411734181
Ref: library/os os execve11734218
Ref: 14ba11734218
Ref: library/os os execvp11734261
Ref: 332b11734261
Ref: library/os os execvpe11734299
Ref: 332c11734299
Ref: library/os os _exit11738100
Ref: 290d11738100
Ref: library/os os EX_OK11739087
Ref: 332d11739087
Ref: library/os os EX_USAGE11739326
Ref: 332e11739326
Ref: library/os os EX_DATAERR11739539
Ref: 332f11739539
Ref: library/os os EX_NOINPUT11739691
Ref: 333011739691
Ref: library/os os EX_NOUSER11739900
Ref: 333111739900
Ref: library/os os EX_NOHOST11740069
Ref: 333211740069
Ref: library/os os EX_UNAVAILABLE11740235
Ref: 333311740235
Ref: library/os os EX_SOFTWARE11740406
Ref: 333411740406
Ref: library/os os EX_OSERR11740577
Ref: 333511740577
Ref: library/os os EX_OSFILE11740825
Ref: 333611740825
Ref: library/os os EX_CANTCREAT11741066
Ref: 333711741066
Ref: library/os os EX_IOERR11741262
Ref: 333811741262
Ref: library/os os EX_TEMPFAIL11741441
Ref: 333911741441
Ref: library/os os EX_PROTOCOL11741795
Ref: 333a11741795
Ref: library/os os EX_NOPERM11741990
Ref: 333b11741990
Ref: library/os os EX_CONFIG11742216
Ref: 333c11742216
Ref: library/os os EX_NOTFOUND11742364
Ref: 333d11742364
Ref: library/os os fork11742521
Ref: 6c311742521
Ref: library/os os forkpty11744716
Ref: 6c411744716
Ref: library/os os kill11746127
Ref: 172111746127
Ref: library/os os killpg11747139
Ref: 1fca11747139
Ref: library/os os nice11747443
Ref: 14c211747443
Ref: library/os os pidfd_open11747642
Ref: 27311747642
Ref: library/os os PIDFD_NONBLOCK11748054
Ref: 8b011748054
Ref: library/os os pidfd_getfd11748510
Ref: 14c11748510
Ref: library/os os plock11749033
Ref: 333e11749033
Ref: library/os os popen11749339
Ref: 58c11749339
Ref: library/os os posix_spawn11751828
Ref: 73611751828
Ref: library/os os POSIX_SPAWN_OPEN11753184
Ref: 333f11753184
Ref: library/os os POSIX_SPAWN_CLOSE11753374
Ref: 334011753374
Ref: library/os os POSIX_SPAWN_DUP211753514
Ref: 334111753514
Ref: library/os os POSIX_SPAWN_CLOSEFROM11753669
Ref: 73711753669
Ref: library/os os posix_spawnp11756604
Ref: 196a11756604
Ref: library/os os register_at_fork11757387
Ref: 33a11757387
Ref: library/os os spawnl11758837
Ref: 58d11758837
Ref: library/os os spawnle11758880
Ref: 334211758880
Ref: library/os os spawnlp11758929
Ref: 334311758929
Ref: library/os os spawnlpe11758973
Ref: 334411758973
Ref: library/os os spawnv11759023
Ref: 334511759023
Ref: library/os os spawnve11759067
Ref: 334611759067
Ref: library/os os spawnvp11759117
Ref: 334711759117
Ref: library/os os spawnvpe11759162
Ref: 334811759162
Ref: library/os os P_NOWAIT11763719
Ref: 334911763719
Ref: library/os os P_NOWAITO11763746
Ref: 334b11763746
Ref: library/os os P_WAIT11764094
Ref: 334a11764094
Ref: library/os os P_DETACH11764513
Ref: 334c11764513
Ref: library/os os P_OVERLAY11764540
Ref: 334d11764540
Ref: library/os os startfile11765158
Ref: 1e9811765158
Ref: library/os os system11767818
Ref: 181511767818
Ref: library/os os times11769729
Ref: 14d611769729
Ref: library/os os wait11770872
Ref: 115511770872
Ref: library/os os waitid11771955
Ref: 115611771955
Ref: library/os os waitpid11773400
Ref: 115711773400
Ref: library/os os wait311776320
Ref: 115311776320
Ref: library/os os wait411777055
Ref: 115411777055
Ref: library/os os P_PID11777744
Ref: 334e11777744
Ref: library/os os P_PGID11777768
Ref: 334f11777768
Ref: library/os os P_ALL11777793
Ref: 335011777793
Ref: library/os os P_PIDFD11777817
Ref: ced11777817
Ref: library/os os WCONTINUED11778583
Ref: 335311778583
Ref: library/os os WEXITED11778941
Ref: 335111778941
Ref: library/os os WSTOPPED11779314
Ref: 335211779314
Ref: library/os os WUNTRACED11779665
Ref: 335811779665
Ref: library/os os WNOHANG11780080
Ref: 335411780080
Ref: library/os os WNOWAIT11780386
Ref: 335511780386
Ref: library/os os CLD_EXITED11780756
Ref: 335711780756
Ref: library/os os CLD_KILLED11780785
Ref: ceb11780785
Ref: library/os os CLD_DUMPED11780814
Ref: 335911780814
Ref: library/os os CLD_TRAPPED11780843
Ref: 335a11780843
Ref: library/os os CLD_STOPPED11780873
Ref: cec11780873
Ref: library/os os CLD_CONTINUED11780903
Ref: 335b11780903
Ref: library/os os waitstatus_to_exitcode11781248
Ref: cee11781248
Ref: library/os os WCOREDUMP11783104
Ref: 336211783104
Ref: library/os os WIFCONTINUED11783490
Ref: 336311783490
Ref: library/os os WIFSTOPPED11783875
Ref: 336011783875
Ref: library/os os WIFSIGNALED11784462
Ref: 335e11784462
Ref: library/os os WIFEXITED11784740
Ref: 335c11784740
Ref: library/os os WEXITSTATUS11785128
Ref: 335d11785128
Ref: library/os os WSTOPSIG11785411
Ref: 336111785411
Ref: library/os os WTERMSIG11785704
Ref: 335f11785704
Ref: プロセス管理-Footnote-111786037
Ref: プロセス管理-Footnote-211786109
Ref: プロセス管理-Footnote-311786152
Ref: プロセス管理-Footnote-411786202
Ref: プロセス管理-Footnote-511786248
Ref: プロセス管理-Footnote-611786299
Ref: プロセス管理-Footnote-711786344
Ref: プロセス管理-Footnote-811786396
Ref: プロセス管理-Footnote-911786505
Ref: プロセス管理-Footnote-1011786547
Node: スケジューラーへのインターフェイス11786594
Ref: library/os interface-to-the-scheduler11786821
Ref: 336511786821
Ref: library/os os-scheduling-policy11787381
Ref: 336611787381
Ref: library/os os SCHED_OTHER11787381
Ref: 336711787381
Ref: library/os os SCHED_BATCH11787482
Ref: 336811787482
Ref: library/os os SCHED_DEADLINE11787693
Ref: 4f011787693
Ref: library/os os SCHED_IDLE11787817
Ref: 336911787817
Ref: library/os os SCHED_NORMAL11787971
Ref: 4f111787971
Ref: library/os os SCHED_SPORADIC11788073
Ref: 336a11788073
Ref: library/os os SCHED_FIFO11788204
Ref: 336b11788204
Ref: library/os os SCHED_RR11788319
Ref: 336c11788319
Ref: library/os os SCHED_RESET_ON_FORK11788426
Ref: 336d11788426
Ref: library/os os sched_param11788787
Ref: 1b4a11788787
Ref: library/os os sched_param sched_priority11789179
Ref: 336e11789179
Ref: library/os os sched_get_priority_min11789308
Ref: 14ca11789308
Ref: library/os os sched_get_priority_max11789519
Ref: 14c911789519
Ref: library/os os sched_setscheduler11789730
Ref: 14d111789730
Ref: library/os os sched_getscheduler11790132
Ref: 14cd11790132
Ref: library/os os sched_setparam11790438
Ref: 14d011790438
Ref: library/os os sched_getparam11790737
Ref: 14cc11790737
Ref: library/os os sched_rr_get_interval11791011
Ref: 14ce11791011
Ref: library/os os sched_yield11791232
Ref: 14d211791232
Ref: library/os os sched_setaffinity11791350
Ref: 14cf11791350
Ref: library/os os sched_getaffinity11791637
Ref: 14cb11791637
Ref: スケジューラーへのインターフェイス-Footnote-111791966
Node: 雑多なシステム情報11792017
Ref: library/os miscellaneous-system-information11792235
Ref: 336f11792235
Ref: library/os os-path11792235
Ref: 337011792235
Ref: library/os os confstr11792303
Ref: 1b2b11792303
Ref: library/os os confstr_names11793469
Ref: 337111793469
Ref: library/os os cpu_count11793844
Ref: 6e711793844
Ref: library/os os getloadavg11794340
Ref: 1b5f11794340
Ref: library/os os process_cpu_count11794635
Ref: 6e611794635
Ref: library/os os sysconf11795238
Ref: 1b2c11795238
Ref: library/os os sysconf_names11795733
Ref: 337211795733
Ref: library/os os curdir11796472
Ref: 2e8911796472
Ref: library/os os pardir11796743
Ref: 32b811796743
Ref: library/os os sep11797012
Ref: a5f11797012
Ref: library/os os altsep11797632
Ref: a6011797632
Ref: library/os os extsep11798084
Ref: 337311798084
Ref: library/os os pathsep11798296
Ref: 234111798296
Ref: library/os os defpath11798649
Ref: 1ff211798649
Ref: library/os os linesep11798918
Ref: 27f411798918
Ref: library/os os devnull11799543
Ref: 202111799543
Ref: library/os os RTLD_LAZY11799783
Ref: 14d911799783
Ref: library/os os RTLD_NOW11799811
Ref: 14da11799811
Ref: library/os os RTLD_GLOBAL11799838
Ref: 14db11799838
Ref: library/os os RTLD_LOCAL11799868
Ref: 14dc11799868
Ref: library/os os RTLD_NODELETE11799897
Ref: 14dd11799897
Ref: library/os os RTLD_NOLOAD11799929
Ref: 14de11799929
Ref: library/os os RTLD_DEEPBIND11799959
Ref: 14df11799959
Ref: 雑多なシステム情報-Footnote-111800318
Node: 乱数<2>11800364
Ref: library/os random-numbers11800522
Ref: 337411800522
Ref: library/os os getrandom11800555
Ref: 107f11800555
Ref: library/os os urandom11801575
Ref: 93611801575
Ref: library/os os GRND_NONBLOCK11804527
Ref: 337611804527
Ref: library/os os GRND_RANDOM11805145
Ref: 337511805145
Ref: 乱数<2>-Footnote-111805425
Ref: 乱数<2>-Footnote-211805488
Node: io --- ストリームを扱うコアツール11805530
Ref: library/io doc11805812
Ref: 337711805812
Ref: library/io io-core-tools-for-working-with-streams11805812
Ref: 337811805812
Ref: library/io module-io11805812
Ref: 8211805812
Ref: library/io translation-repo11805812
Ref: 337911805812
Ref: io --- ストリームを扱うコアツール-Footnote-111806218
Node: 概要<2>11806280
Ref: library/io io-overview11806394
Ref: 27f211806394
Ref: library/io overview11806394
Ref: 337a11806394
Node: テキスト I/O11807856
Ref: library/io text-i-o11807943
Ref: 337b11807943
Node: バイナリ I/O11809075
Ref: library/io binary-i-o11809178
Ref: 337c11809178
Node: Raw I/O11810326
Ref: library/io raw-i-o11810404
Ref: 337d11810404
Node: Text Encoding11811032
Ref: library/io io-text-encoding11811206
Ref: ba211811206
Ref: library/io text-encoding11811206
Ref: 337e11811206
Ref: Text Encoding-Footnote-111812374
Node: Opt-in EncodingWarning11812416
Ref: library/io io-encoding-warning11812488
Ref: 1b711812488
Ref: library/io opt-in-encodingwarning11812488
Ref: 337f11812488
Ref: Opt-in EncodingWarning-Footnote-111813304
Node: 高水準のモジュールインターフェイス11813346
Ref: library/io high-level-module-interface11813526
Ref: 338011813526
Ref: library/io io DEFAULT_BUFFER_SIZE11813632
Ref: 1c6411813632
Ref: library/io io open11813945
Ref: 93011813945
Ref: library/io io open_code11814374
Ref: 196411814374
Ref: library/io io text_encoding11815073
Ref: 1c6311815073
Ref: library/io io BlockingIOError11816204
Ref: 338111816204
Ref: library/io io UnsupportedOperation11816350
Ref: 19e911816350
Node: クラス階層11816735
Ref: library/io class-hierarchy11816915
Ref: 338211816915
Node: I/O 基底クラス11822278
Ref: library/io i-o-base-classes11822376
Ref: 338311822376
Ref: library/io io IOBase11822430
Ref: 71011822430
Ref: library/io io IOBase close11824732
Ref: 71111824732
Ref: library/io io IOBase closed11825333
Ref: 201c11825333
Ref: library/io io IOBase fileno11825448
Ref: 19d211825448
Ref: library/io io IOBase flush11825758
Ref: 1a1a11825758
Ref: library/io io IOBase isatty11825994
Ref: 227611825994
Ref: library/io io IOBase readable11826197
Ref: 176611826197
Ref: library/io io IOBase readline11826365
Ref: 16e311826365
Ref: library/io io IOBase readlines11826854
Ref: 29d311826854
Ref: library/io io IOBase seek11827587
Ref: 164611827587
Ref: library/io io IOBase seekable11828567
Ref: 176811828567
Ref: library/io io IOBase tell11828913
Ref: 176511828913
Ref: library/io io IOBase truncate11829005
Ref: 16ca11829005
Ref: library/io io IOBase writable11829848
Ref: 176711829848
Ref: library/io io IOBase writelines11830055
Ref: 199d11830055
Ref: library/io io IOBase __del__11830327
Ref: 338411830327
Ref: library/io io RawIOBase11830625
Ref: 149011830625
Ref: library/io io RawIOBase read11831290
Ref: 11d411831290
Ref: library/io io RawIOBase readall11832288
Ref: 19e811832288
Ref: library/io io RawIOBase readinto11832503
Ref: 11d511832503
Ref: library/io io RawIOBase write11832960
Ref: 176411832960
Ref: library/io io BufferedIOBase11833794
Ref: a8811833794
Ref: library/io io BufferedIOBase raw11835100
Ref: 176911835100
Ref: library/io io BufferedIOBase detach11835407
Ref: 302911835407
Ref: library/io io BufferedIOBase read11835944
Ref: 16e211835944
Ref: library/io io BufferedIOBase read111837232
Ref: 309211837232
Ref: library/io io BufferedIOBase readinto11837824
Ref: 1ad811837824
Ref: library/io io BufferedIOBase readinto111838571
Ref: 11d311838571
Ref: library/io io BufferedIOBase write11839227
Ref: 109d11839227
Ref: I/O 基底クラス-Footnote-111840417
Ref: I/O 基底クラス-Footnote-211840459
Node: 生ファイルI/O11840501
Ref: library/io raw-file-i-o11840641
Ref: 338511840641
Ref: library/io io FileIO11840695
Ref: 16c911840695
Ref: library/io io FileIO mode11843599
Ref: 19f011843599
Ref: library/io io FileIO name11843691
Ref: 302d11843691
Node: バッファ付きストリーム11843860
Ref: library/io buffered-streams11844000
Ref: 338611844000
Ref: library/io io BytesIO11844218
Ref: 125811844218
Ref: library/io io BytesIO getbuffer11844904
Ref: 15b011844904
Ref: library/io io BytesIO getvalue11845596
Ref: 309011845596
Ref: library/io io BytesIO read111845714
Ref: 338711845714
Ref: library/io io BytesIO readinto111845964
Ref: 338811845964
Ref: library/io io BufferedReader11846163
Ref: 15cb11846163
Ref: library/io io BufferedReader peek11847308
Ref: 338911847308
Ref: library/io io BufferedReader read11847614
Ref: 338a11847614
Ref: library/io io BufferedReader read111847759
Ref: 198911847759
Ref: library/io io BufferedWriter11847992
Ref: 176a11847992
Ref: library/io io BufferedWriter flush11849396
Ref: 338b11849396
Ref: library/io io BufferedWriter write11849659
Ref: 338c11849659
Ref: library/io io BufferedRandom11850022
Ref: 176b11850022
Ref: library/io io BufferedRWPair11850824
Ref: 176c11850824
Node: テキスト I/O<2>11851937
Ref: library/io id111852050
Ref: 338d11852050
Ref: library/io io TextIOBase11852101
Ref: a8911852101
Ref: library/io io TextIOBase encoding11852461
Ref: 338e11852461
Ref: library/io io TextIOBase errors11852700
Ref: 16c811852700
Ref: library/io io TextIOBase newlines11852803
Ref: 338f11852803
Ref: library/io io TextIOBase buffer11853113
Ref: 165d11853113
Ref: library/io io TextIOBase detach11853399
Ref: 19c611853399
Ref: library/io io TextIOBase read11853978
Ref: 227911853978
Ref: library/io io TextIOBase readline11854240
Ref: 22b411854240
Ref: library/io io TextIOBase seek11854524
Ref: 339011854524
Ref: library/io io TextIOBase tell11855509
Ref: 339111855509
Ref: library/io io TextIOBase write11855735
Ref: 226811855735
Ref: library/io io TextIOWrapper11855890
Ref: ba011855890
Ref: library/io io TextIOWrapper line_buffering11860642
Ref: 339211860642
Ref: library/io io TextIOWrapper write_through11860738
Ref: 339311860738
Ref: library/io io TextIOWrapper reconfigure11860908
Ref: f0a11860908
Ref: library/io io TextIOWrapper seek11861997
Ref: 339411861997
Ref: library/io io TextIOWrapper tell11862918
Ref: 19e711862918
Ref: library/io io StringIO11863147
Ref: 12d811863147
Ref: library/io io StringIO getvalue11864479
Ref: 339511864479
Ref: library/io io IncrementalNewlineDecoder11865136
Ref: 196811865136
Node: Static Typing11865333
Ref: library/io static-typing11865471
Ref: 339611865471
Ref: library/io io Reader11865714
Ref: 4cb11865714
Ref: library/io io Reader read11865964
Ref: 339711865964
Ref: library/io io Writer11866363
Ref: 4cc11866363
Ref: library/io io Writer write11866618
Ref: 339811866618
Node: 性能<3>11867032
Ref: library/io performance11867146
Ref: 339a11867146
Node: バイナリ I/O<2>11867475
Ref: library/io id211867568
Ref: 339b11867568
Node: テキスト I/O<3>11868549
Ref: library/io id311868684
Ref: 339c11868684
Node: マルチスレッディング<3>11869296
Ref: library/io multi-threading11869436
Ref: 339d11869436
Ref: マルチスレッディング<3>-Footnote-111870160
Node: リエントラント性11870204
Ref: library/io reentrancy11870316
Ref: 339e11870316
Node: time --- 時刻データへのアクセスと変換11871373
Ref: library/time doc11871622
Ref: 339f11871622
Ref: library/time module-time11871622
Ref: f711871622
Ref: library/time time-time-access-and-conversions11871622
Ref: 33a011871622
Ref: library/time translation-repo11871622
Ref: 33a111871622
Ref: library/time epoch11872600
Ref: 314f11872600
Ref: time --- 時刻データへのアクセスと変換-Footnote-111878017
Ref: time --- 時刻データへのアクセスと変換-Footnote-211878067
Ref: time --- 時刻データへのアクセスと変換-Footnote-311878132
Node: 関数<5>11878190
Ref: library/time functions11878314
Ref: 33a411878314
Ref: library/time time-functions11878314
Ref: 33a511878314
Ref: library/time time asctime11878345
Ref: 15a611878345
Ref: library/time time pthread_getcpuclockid11879030
Ref: f5511879030
Ref: library/time time clock_getres11879672
Ref: 151d11879672
Ref: library/time time clock_gettime11879994
Ref: 151e11879994
Ref: library/time time clock_gettime_ns11880427
Ref: ead11880427
Ref: library/time time clock_settime11880656
Ref: 151f11880656
Ref: library/time time clock_settime_ns11881181
Ref: eae11881181
Ref: library/time time ctime11881439
Ref: 2af011881439
Ref: library/time time get_clock_info11882176
Ref: 151c11882176
Ref: library/time time gmtime11883514
Ref: 157e11883514
Ref: library/time time localtime11884252
Ref: 18b111884252
Ref: library/time time mktime11885078
Ref: 15a711885078
Ref: library/time time monotonic11886027
Ref: 76311886027
Ref: library/time time monotonic_ns11887164
Ref: eaf11887164
Ref: library/time time perf_counter11887339
Ref: e4d11887339
Ref: library/time time perf_counter_ns11888283
Ref: eb011888283
Ref: library/time time process_time11888464
Ref: e4e11888464
Ref: library/time time process_time_ns11889007
Ref: eb111889007
Ref: library/time time sleep11889188
Ref: a9111889188
Ref: library/time time strftime11891493
Ref: 15a811891493
Ref: library/time leap-second11899588
Ref: 33a711899588
Ref: library/time time strptime11901061
Ref: 17e511901061
Ref: library/time time struct_time11903268
Ref: 10ab11903268
Ref: library/time time struct_time tm_year11903985
Ref: 18b011903985
Ref: library/time time struct_time tm_mon11904249
Ref: 33a811904249
Ref: library/time time struct_time tm_mday11904518
Ref: 33a911904518
Ref: library/time time struct_time tm_hour11904786
Ref: 33aa11904786
Ref: library/time time struct_time tm_min11905053
Ref: 33ab11905053
Ref: library/time time struct_time tm_sec11905321
Ref: 33ac11905321
Ref: library/time time struct_time tm_wday11905800
Ref: 33ad11905800
Ref: library/time time struct_time tm_yday11906074
Ref: 33ae11906074
Ref: library/time time struct_time tm_isdst11906344
Ref: 2b0111906344
Ref: library/time time struct_time tm_zone11906726
Ref: 33a311906726
Ref: library/time time struct_time tm_gmtoff11907007
Ref: 33a211907007
Ref: library/time time time11907867
Ref: 76411907867
Ref: library/time time time_ns11909796
Ref: eb211909796
Ref: library/time time thread_time11910008
Ref: d0711910008
Ref: library/time time thread_time_ns11910692
Ref: f5411910692
Ref: library/time time tzset11910871
Ref: 33af11910871
Ref: 関数<5>-Footnote-111915580
Ref: 関数<5>-Footnote-211915641
Ref: 関数<5>-Footnote-311915740
Ref: 関数<5>-Footnote-411915782
Ref: 関数<5>-Footnote-511916563
Ref: 関数<5>-Footnote-611917344
Ref: 関数<5>-Footnote-711917394
Ref: 関数<5>-Footnote-811917453
Ref: 関数<5>-Footnote-911918234
Ref: 関数<5>-Footnote-1011918282
Ref: 関数<5>-Footnote-1111918333
Ref: 関数<5>-Footnote-1211918382
Node: Clock ID Constants11918429
Ref: library/time clock-id-constants11918580
Ref: 33b011918580
Ref: library/time time-clock-id-constants11918580
Ref: 331f11918580
Ref: library/time time CLOCK_BOOTTIME11918742
Ref: f5111918742
Ref: library/time time CLOCK_HIGHRES11919225
Ref: 33b111919225
Ref: library/time time CLOCK_MONOTONIC11919602
Ref: a8d11919602
Ref: library/time time CLOCK_MONOTONIC_RAW11919836
Ref: 33b211919836
Ref: library/time time CLOCK_MONOTONIC_RAW_APPROX11920148
Ref: 33b311920148
Ref: library/time time CLOCK_PROCESS_CPUTIME_ID11920415
Ref: 33b411920415
Ref: library/time time CLOCK_PROF11920605
Ref: f5211920605
Ref: library/time time CLOCK_TAI11920806
Ref: 1f6a11920806
Ref: library/time time CLOCK_THREAD_CPUTIME_ID11921106
Ref: 33b511921106
Ref: library/time time CLOCK_UPTIME11921281
Ref: f5311921281
Ref: library/time time CLOCK_UPTIME_RAW11921569
Ref: e0a11921569
Ref: library/time time CLOCK_UPTIME_RAW_APPROX11921873
Ref: 33b611921873
Ref: library/time time CLOCK_REALTIME11922227
Ref: a8e11922227
Ref: Clock ID Constants-Footnote-111922489
Node: Timezone Constants11922616
Ref: library/time time-timezone-constants11922749
Ref: 33b711922749
Ref: library/time timezone-constants11922749
Ref: 33b811922749
Ref: library/time time altzone11922806
Ref: 33b911922806
Ref: library/time time daylight11923252
Ref: 33ba11923252
Ref: library/time time timezone11923428
Ref: 33bb11923428
Ref: library/time time tzname11923795
Ref: 33bc11923795
Node: logging --- Python 用のログ記録手段11925290
Ref: library/logging doc11925539
Ref: 33bd11925539
Ref: library/logging logging-logging-facility-for-python11925539
Ref: 33be11925539
Ref: library/logging module-logging11925539
Ref: 8a11925539
Ref: library/logging translation-repo11925539
Ref: 33bf11925539
Ref: logging --- Python 用のログ記録手段-Footnote-111930183
Node: ロガーオブジェクト11930260
Ref: library/logging logger11930397
Ref: 33c011930397
Ref: library/logging logger-objects11930397
Ref: 33c111930397
Ref: library/logging logging Logger11931921
Ref: f1011931921
Ref: library/logging logging Logger name11931952
Ref: 33c211931952
Ref: library/logging logging Logger level11932236
Ref: 33c311932236
Ref: library/logging logging Logger parent11932676
Ref: 33c411932676
Ref: library/logging logging Logger propagate11933030
Ref: 184d11933030
Ref: library/logging logging Logger handlers11935585
Ref: 33c511935585
Ref: library/logging logging Logger disabled11936143
Ref: 33c811936143
Ref: library/logging logging Logger setLevel11936563
Ref: 184b11936563
Ref: library/logging logging Logger isEnabledFor11938949
Ref: 16b011938949
Ref: library/logging logging Logger getEffectiveLevel11939401
Ref: 33ca11939401
Ref: library/logging logging Logger getChild11940018
Ref: 16ae11940018
Ref: library/logging logging Logger getChildren11940593
Ref: 1d6f11940593
Ref: library/logging logging Logger debug11941348
Ref: 11e211941348
Ref: library/logging logging Logger info11948024
Ref: 22eb11948024
Ref: library/logging logging Logger warning11948254
Ref: 1c9911948254
Ref: library/logging logging Logger error11948752
Ref: 33cd11948752
Ref: library/logging logging Logger critical11948984
Ref: 11e111948984
Ref: library/logging logging Logger log11949222
Ref: 11df11949222
Ref: library/logging logging Logger exception11949489
Ref: 11e011949489
Ref: library/logging logging Logger addFilter11949891
Ref: 33ce11949891
Ref: library/logging logging Logger removeFilter11950022
Ref: 33cf11950022
Ref: library/logging logging Logger filter11950162
Ref: 33d011950162
Ref: library/logging logging Logger addHandler11950751
Ref: 33c611950751
Ref: library/logging logging Logger removeHandler11950879
Ref: 33c711950879
Ref: library/logging logging Logger findCaller11951016
Ref: 33d111951016
Ref: library/logging logging Logger handle11952060
Ref: 33d211952060
Ref: library/logging logging Logger makeRecord11952670
Ref: 33d311952670
Ref: library/logging logging Logger hasHandlers11953013
Ref: 33d411953013
Node: ロギングレベル11953818
Ref: library/logging levels11953994
Ref: a4f11953994
Ref: library/logging logging-levels11953994
Ref: 33d511953994
Ref: library/logging logging NOTSET11954765
Ref: 33c911954765
Ref: library/logging logging DEBUG11955603
Ref: 22ec11955603
Ref: library/logging logging INFO11955973
Ref: 22ed11955973
Ref: library/logging logging WARNING11956222
Ref: 22ee11956222
Ref: library/logging logging ERROR11956820
Ref: 22ef11956820
Ref: library/logging logging CRITICAL11957101
Ref: 22f011957101
Node: ハンドラオブジェクト11957328
Ref: library/logging handler11957513
Ref: 33d611957513
Ref: library/logging handler-objects11957513
Ref: 33d711957513
Ref: library/logging logging Handler11957998
Ref: 184e11957998
Ref: library/logging logging Handler __init__11958030
Ref: 33d811958030
Ref: library/logging logging Handler createLock11958396
Ref: 33d911958396
Ref: library/logging logging Handler acquire11958644
Ref: 33da11958644
Ref: library/logging logging Handler release11958788
Ref: 33db11958788
Ref: library/logging logging Handler setLevel11958915
Ref: 33dc11958915
Ref: library/logging logging Handler setFormatter11959654
Ref: 33dd11959654
Ref: library/logging logging Handler addFilter11959841
Ref: 33de11959841
Ref: library/logging logging Handler removeFilter11959975
Ref: 33df11959975
Ref: library/logging logging Handler filter11960115
Ref: 33e011960115
Ref: library/logging logging Handler flush11960640
Ref: 33e111960640
Ref: library/logging logging Handler close11960882
Ref: 33e211960882
Ref: library/logging logging Handler handle11961225
Ref: 33e311961225
Ref: library/logging logging Handler handleError11961536
Ref: 33e411961536
Ref: library/logging logging Handler format11962601
Ref: 33e611962601
Ref: library/logging logging Handler emit11962906
Ref: 33e511962906
Node: フォーマッタオブジェクト11965337
Ref: library/logging formatter-objects11965531
Ref: 33e711965531
Ref: library/logging id111965531
Ref: 33e811965531
Ref: library/logging logging Formatter11965612
Ref: 184f11965612
Ref: library/logging logging Formatter format11968337
Ref: 33eb11968337
Ref: library/logging logging Formatter formatTime11970131
Ref: 33e911970131
Ref: library/logging logging Formatter formatException11973152
Ref: 33ec11973152
Ref: library/logging logging Formatter formatStack11973521
Ref: 33ed11973521
Ref: library/logging logging BufferingFormatter11973906
Ref: 33ee11973906
Ref: library/logging logging BufferingFormatter formatHeader11974444
Ref: 33ef11974444
Ref: library/logging logging BufferingFormatter formatFooter11974928
Ref: 33f011974928
Ref: library/logging logging BufferingFormatter format11975356
Ref: 33f111975356
Node: フィルタオブジェクト11975885
Ref: library/logging filter11976077
Ref: 33f211976077
Ref: library/logging filter-objects11976077
Ref: 33f311976077
Ref: library/logging logging Filter11976795
Ref: 15ba11976795
Ref: library/logging logging Filter filter11977216
Ref: 33f411977216
Node: LogRecord オブジェクト11980536
Ref: library/logging log-record11980708
Ref: 33f711980708
Ref: library/logging logrecord-objects11980708
Ref: 33f811980708
Ref: library/logging logging LogRecord11981107
Ref: 139411981107
Ref: library/logging logging LogRecord getMessage11984005
Ref: 33fb11984005
Node: LogRecord 属性11985865
Ref: library/logging id211986039
Ref: 33fe11986039
Ref: library/logging logrecord-attributes11986039
Ref: 33cb11986039
Node: LoggerAdapter オブジェクト11995839
Ref: library/logging logger-adapter11996009
Ref: 33ff11996009
Ref: library/logging loggeradapter-objects11996009
Ref: 340011996009
Ref: library/logging logging LoggerAdapter11996358
Ref: 16af11996358
Ref: library/logging logging LoggerAdapter process11996926
Ref: 340211996926
Ref: library/logging logging LoggerAdapter manager11997480
Ref: 340311997480
Ref: library/logging logging LoggerAdapter _log11997620
Ref: 340411997620
Node: スレッドセーフ性11999004
Ref: library/logging thread-safety11999191
Ref: 340511999191
Node: モジュールレベルの関数12000135
Ref: library/logging module-level-functions12000320
Ref: 340612000320
Ref: library/logging logging getLogger12000508
Ref: d2e12000508
Ref: library/logging logging getLoggerClass12001410
Ref: 340712001410
Ref: library/logging logging getLogRecordFactory12002020
Ref: 33fc12002020
Ref: library/logging logging debug12002597
Ref: 33cc12002597
Ref: library/logging logging info12003725
Ref: 33f512003725
Ref: library/logging logging warning12003993
Ref: 33912003993
Ref: library/logging logging error12004506
Ref: 340912004506
Ref: library/logging logging critical12004775
Ref: 340a12004775
Ref: library/logging logging exception12005050
Ref: 184c12005050
Ref: library/logging logging log12005467
Ref: 340b12005467
Ref: library/logging logging disable12005746
Ref: 340c12005746
Ref: library/logging logging addLevelName12007121
Ref: 340d12007121
Ref: library/logging logging getLevelNamesMapping12007974
Ref: a4e12007974
Ref: library/logging logging getLevelName12008399
Ref: 340f12008399
Ref: library/logging logging getHandlerByName12010231
Ref: 1d7f12010231
Ref: library/logging logging getHandlerNames12010463
Ref: 1c9312010463
Ref: library/logging logging makeLogRecord12010629
Ref: 33f912010629
Ref: library/logging logging basicConfig12011026
Ref: dc612011026
Ref: library/logging logging shutdown12018197
Ref: 341012018197
Ref: library/logging logging setLoggerClass12018872
Ref: 340812018872
Ref: library/logging logging setLogRecordFactory12019782
Ref: 33fd12019782
Ref: モジュールレベルの関数-Footnote-112021294
Node: モジュールレベル属性12021359
Ref: library/logging module-level-attributes12021556
Ref: 341112021556
Ref: library/logging logging lastResort12021629
Ref: 15b912021629
Ref: library/logging logging raiseExceptions12022452
Ref: 15b812022452
Node: warnings モジュールとの統合12023042
Ref: library/logging integration-with-the-warnings-module12023197
Ref: 341212023197
Ref: library/logging logging captureWarnings12023405
Ref: 341312023405
Ref: warnings モジュールとの統合-Footnote-112025036
Ref: warnings モジュールとの統合-Footnote-212025078
Node: logging config --- ログ記録の環境設定12025131
Ref: library/logging config doc12025377
Ref: 341412025377
Ref: library/logging config logging-config-logging-configuration12025377
Ref: 341512025377
Ref: library/logging config module-logging config12025377
Ref: 8b12025377
Ref: library/logging config translation-repo12025377
Ref: 341612025377
Ref: logging config --- ログ記録の環境設定-Footnote-112026208
Node: 環境設定のための関数12026282
Ref: library/logging config configuration-functions12026443
Ref: 341712026443
Ref: library/logging config logging-config-api12026443
Ref: 16ab12026443
Ref: library/logging config logging config dictConfig12026878
Ref: 156e12026878
Ref: library/logging config logging config fileConfig12029125
Ref: f1212029125
Ref: library/logging config logging config listen12032375
Ref: 131412032375
Ref: library/logging config logging-eval-security12034595
Ref: 341b12034595
Ref: library/logging config logging config stopListening12036798
Ref: 341a12036798
Node: セキュリティで考慮すべき点12037073
Ref: library/logging config security-considerations12037273
Ref: 341c12037273
Node: 環境設定辞書スキーマ12038425
Ref: library/logging config configuration-dictionary-schema12038628
Ref: 341e12038628
Ref: library/logging config logging-config-dictschema12038628
Ref: 341812038628
Node: 辞書スキーマの詳細12039923
Ref: library/logging config dictionary-schema-details12040038
Ref: 342012040038
Ref: library/logging config logging-config-dictschema-formatters12041134
Ref: 342112041134
Node: 増分設定12047112
Ref: library/logging config incremental-configuration12047263
Ref: 342312047263
Ref: library/logging config logging-config-dict-incremental12047263
Ref: 342212047263
Node: オブジェクトの接続12049011
Ref: library/logging config logging-config-dict-connections12049168
Ref: 341f12049168
Ref: library/logging config object-connections12049168
Ref: 342412049168
Node: ユーザ定義オブジェクト12051973
Ref: library/logging config logging-config-dict-userdef12052145
Ref: 341d12052145
Ref: library/logging config user-defined-objects12052145
Ref: 342512052145
Node: ハンドラの設定順序12057853
Ref: library/logging config handler-config-dict-order12058040
Ref: 342612058040
Ref: library/logging config handler-configuration-order12058040
Ref: 342712058040
Node: 外部オブジェクトへのアクセス12059344
Ref: library/logging config access-to-external-objects12059540
Ref: 342812059540
Ref: library/logging config logging-config-dict-externalobj12059540
Ref: 342912059540
Node: 内部オブジェクトへのアクセス12061029
Ref: library/logging config access-to-internal-objects12061252
Ref: 342a12061252
Ref: library/logging config logging-config-dict-internalobj12061252
Ref: 342b12061252
Node: インポート解決とカスタムインポーター12065136
Ref: library/logging config import-resolution-and-custom-importers12065359
Ref: 342d12065359
Ref: library/logging config logging-import-resolution12065359
Ref: 342e12065359
Node: Configuring QueueHandler and QueueListener12066632
Ref: library/logging config configure-queue12066804
Ref: 1b7d12066804
Ref: library/logging config configuring-queuehandler-and-queuelistener12066804
Ref: 342f12066804
Node: 環境設定ファイルの書式12070037
Ref: library/logging config configuration-file-format12070192
Ref: 343412070192
Ref: library/logging config logging-config-fileformat12070192
Ref: 341912070192
Node: logging handlers --- ログ記録ハンドラー12079213
Ref: library/logging handlers doc12079492
Ref: 343512079492
Ref: library/logging handlers logging-handlers-logging-handlers12079492
Ref: 343612079492
Ref: library/logging handlers module-logging handlers12079492
Ref: 8c12079492
Ref: library/logging handlers translation-repo12079492
Ref: 343712079492
Ref: logging handlers --- ログ記録ハンドラー-Footnote-112080799
Node: StreamHandler12080876
Ref: library/logging handlers stream-handler12080994
Ref: 343812080994
Ref: library/logging handlers streamhandler12080994
Ref: 343912080994
Ref: library/logging handlers logging StreamHandler12081449
Ref: 15b712081449
Ref: library/logging handlers logging StreamHandler emit12081791
Ref: 343a12081791
Ref: library/logging handlers logging StreamHandler flush12082259
Ref: 343c12082259
Ref: library/logging handlers logging StreamHandler setStream12082653
Ref: f1112082653
Ref: library/logging handlers logging StreamHandler terminator12083161
Ref: 343b12083161
Node: FileHandler12083723
Ref: library/logging handlers file-handler12083861
Ref: 343d12083861
Ref: library/logging handlers filehandler12083861
Ref: 343e12083861
Ref: library/logging handlers logging FileHandler12084161
Ref: 1e6912084161
Ref: library/logging handlers logging FileHandler close12085035
Ref: 344012085035
Ref: library/logging handlers logging FileHandler emit12085110
Ref: 343f12085110
Ref: FileHandler-Footnote-112085514
Node: NullHandler12085579
Ref: library/logging handlers null-handler12085722
Ref: 344112085722
Ref: library/logging handlers nullhandler12085722
Ref: 344212085722
Ref: library/logging handlers logging NullHandler12086035
Ref: 163e12086035
Ref: library/logging handlers logging NullHandler emit12086160
Ref: 344312086160
Ref: library/logging handlers logging NullHandler handle12086252
Ref: 344412086252
Ref: library/logging handlers logging NullHandler createLock12086346
Ref: 344512086346
Node: WatchedFileHandler12086712
Ref: library/logging handlers watched-file-handler12086863
Ref: 344712086863
Ref: library/logging handlers watchedfilehandler12086863
Ref: 344812086863
Ref: library/logging handlers logging handlers WatchedFileHandler12088255
Ref: 344912088255
Ref: library/logging handlers logging handlers WatchedFileHandler reopenIfNeeded12089141
Ref: 107a12089141
Ref: library/logging handlers logging handlers WatchedFileHandler emit12089506
Ref: 344a12089506
Node: BaseRotatingHandler12089752
Ref: library/logging handlers base-rotating-handler12089911
Ref: 344b12089911
Ref: library/logging handlers baserotatinghandler12089911
Ref: 344c12089911
Ref: library/logging handlers logging handlers BaseRotatingHandler12090294
Ref: 344d12090294
Ref: library/logging handlers logging handlers BaseRotatingHandler namer12090505
Ref: 344e12090505
Ref: library/logging handlers logging handlers BaseRotatingHandler rotator12092730
Ref: 345112092730
Ref: library/logging handlers logging handlers BaseRotatingHandler rotation_filename12093047
Ref: 344f12093047
Ref: library/logging handlers logging handlers BaseRotatingHandler rotate12093788
Ref: 345212093788
Node: RotatingFileHandler12095413
Ref: library/logging handlers rotating-file-handler12095578
Ref: 345412095578
Ref: library/logging handlers rotatingfilehandler12095578
Ref: 345512095578
Ref: library/logging handlers logging handlers RotatingFileHandler12095765
Ref: 1b7812095765
Ref: library/logging handlers logging handlers RotatingFileHandler doRollover12098483
Ref: 345712098483
Ref: library/logging handlers logging handlers RotatingFileHandler emit12098596
Ref: 345612098596
Ref: library/logging handlers logging handlers RotatingFileHandler shouldRollover12098762
Ref: 345812098762
Node: TimedRotatingFileHandler12098916
Ref: library/logging handlers timed-rotating-file-handler12099075
Ref: 345912099075
Ref: library/logging handlers timedrotatingfilehandler12099075
Ref: 345a12099075
Ref: library/logging handlers logging handlers TimedRotatingFileHandler12099304
Ref: 131012099304
Ref: library/logging handlers logging handlers TimedRotatingFileHandler doRollover12105324
Ref: 345c12105324
Ref: library/logging handlers logging handlers TimedRotatingFileHandler emit12105437
Ref: 345b12105437
Ref: library/logging handlers logging handlers TimedRotatingFileHandler getFilesToDelete12105612
Ref: 345012105612
Ref: library/logging handlers logging handlers TimedRotatingFileHandler shouldRollover12105933
Ref: 345d12105933
Node: SocketHandler12106103
Ref: library/logging handlers socket-handler12106258
Ref: 345e12106258
Ref: library/logging handlers sockethandler12106258
Ref: 345f12106258
Ref: library/logging handlers logging handlers SocketHandler12106467
Ref: 131112106467
Ref: library/logging handlers logging handlers SocketHandler close12106976
Ref: 346012106976
Ref: library/logging handlers logging handlers SocketHandler emit12107051
Ref: 346112107051
Ref: library/logging handlers logging handlers SocketHandler handleError12107584
Ref: 346212107584
Ref: library/logging handlers logging handlers SocketHandler makeSocket12107866
Ref: 346312107866
Ref: library/logging handlers logging handlers SocketHandler makePickle12108175
Ref: 346412108175
Ref: library/logging handlers logging handlers SocketHandler send12109210
Ref: 346512109210
Ref: library/logging handlers logging handlers SocketHandler createSocket12109626
Ref: a5212109626
Node: DatagramHandler12111003
Ref: library/logging handlers datagram-handler12111147
Ref: 346612111147
Ref: library/logging handlers datagramhandler12111147
Ref: 346712111147
Ref: library/logging handlers logging handlers DatagramHandler12111380
Ref: 131212111380
Ref: library/logging handlers logging handlers DatagramHandler emit12112707
Ref: 346812112707
Ref: library/logging handlers logging handlers DatagramHandler makeSocket12113240
Ref: 346912113240
Ref: library/logging handlers logging handlers DatagramHandler send12113487
Ref: 346a12113487
Node: SysLogHandler12113770
Ref: library/logging handlers syslog-handler12113918
Ref: 346b12113918
Ref: library/logging handlers sysloghandler12113918
Ref: 346c12113918
Ref: library/logging handlers logging handlers SysLogHandler12114119
Ref: a5112114119
Ref: library/logging handlers logging handlers SysLogHandler close12116844
Ref: 346d12116844
Ref: library/logging handlers logging handlers SysLogHandler createSocket12116940
Ref: a5012116940
Ref: library/logging handlers logging handlers SysLogHandler emit12117395
Ref: 346e12117395
Ref: library/logging handlers logging handlers SysLogHandler encodePriority12119837
Ref: 346f12119837
Ref: library/logging handlers logging handlers SysLogHandler mapPriority12124004
Ref: 347012124004
Ref: SysLogHandler-Footnote-112124646
Ref: SysLogHandler-Footnote-212124701
Ref: SysLogHandler-Footnote-312124766
Ref: SysLogHandler-Footnote-412124825
Node: NTEventLogHandler12124890
Ref: library/logging handlers nt-eventlog-handler12125034
Ref: 347112125034
Ref: library/logging handlers nteventloghandler12125034
Ref: 347212125034
Ref: library/logging handlers logging handlers NTEventLogHandler12125362
Ref: 19a612125362
Ref: library/logging handlers logging handlers NTEventLogHandler close12126571
Ref: 347312126571
Ref: library/logging handlers logging handlers NTEventLogHandler emit12127157
Ref: 347412127157
Ref: library/logging handlers logging handlers NTEventLogHandler getEventCategory12127357
Ref: 347512127357
Ref: library/logging handlers logging handlers NTEventLogHandler getEventType12127687
Ref: 347612127687
Ref: library/logging handlers logging handlers NTEventLogHandler getMessageID12128425
Ref: 347712128425
Node: SMTPHandler12128930
Ref: library/logging handlers smtp-handler12129074
Ref: 347812129074
Ref: library/logging handlers smtphandler12129074
Ref: 347912129074
Ref: library/logging handlers logging handlers SMTPHandler12129266
Ref: 1af212129266
Ref: library/logging handlers logging handlers SMTPHandler emit12130892
Ref: 347a12130892
Ref: library/logging handlers logging handlers SMTPHandler getSubject12131020
Ref: 347b12131020
Node: MemoryHandler12131219
Ref: library/logging handlers memory-handler12131357
Ref: 347c12131357
Ref: library/logging handlers memoryhandler12131357
Ref: 347d12131357
Ref: library/logging handlers logging handlers BufferingHandler12132221
Ref: 347e12132221
Ref: library/logging handlers logging handlers BufferingHandler emit12132459
Ref: 347f12132459
Ref: library/logging handlers logging handlers BufferingHandler flush12132714
Ref: 348112132714
Ref: library/logging handlers logging handlers BufferingHandler shouldFlush12132950
Ref: 348012132950
Ref: library/logging handlers logging handlers MemoryHandler12133239
Ref: 342c12133239
Ref: library/logging handlers logging handlers MemoryHandler close12134360
Ref: 348312134360
Ref: library/logging handlers logging handlers MemoryHandler flush12134533
Ref: 348412134533
Ref: library/logging handlers logging handlers MemoryHandler setTarget12134840
Ref: 348212134840
Ref: library/logging handlers logging handlers MemoryHandler shouldFlush12134964
Ref: 348512134964
Node: HTTPHandler12135157
Ref: library/logging handlers http-handler12135296
Ref: 348612135296
Ref: library/logging handlers httphandler12135296
Ref: 348712135296
Ref: library/logging handlers logging handlers HTTPHandler12135523
Ref: 11e312135523
Ref: library/logging handlers logging handlers HTTPHandler mapLogRecord12136655
Ref: 348812136655
Ref: library/logging handlers logging handlers HTTPHandler emit12137226
Ref: 348912137226
Node: QueueHandler12138188
Ref: library/logging handlers queue-handler12138327
Ref: 348a12138327
Ref: library/logging handlers queuehandler12138327
Ref: 348b12138327
Ref: library/logging handlers logging handlers QueueHandler12139236
Ref: 1d7e12139236
Ref: library/logging handlers logging handlers QueueHandler emit12140620
Ref: 348e12140620
Ref: library/logging handlers logging handlers QueueHandler prepare12141122
Ref: 348f12141122
Ref: library/logging handlers logging handlers QueueHandler enqueue12143971
Ref: 348c12143971
Ref: library/logging handlers logging handlers QueueHandler listener12144299
Ref: 343012144299
Node: QueueListener12144594
Ref: library/logging handlers queue-listener12144713
Ref: 349012144713
Ref: library/logging handlers queuelistener12144713
Ref: 349112144713
Ref: library/logging handlers logging handlers QueueListener12145896
Ref: 4d612145896
Ref: library/logging handlers logging handlers QueueListener dequeue12147848
Ref: 349212147848
Ref: library/logging handlers logging handlers QueueListener prepare12148294
Ref: 349312148294
Ref: library/logging handlers logging handlers QueueListener handle12148746
Ref: 349412148746
Ref: library/logging handlers logging handlers QueueListener start12149080
Ref: 4d712149080
Ref: library/logging handlers logging handlers QueueListener stop12149444
Ref: 349512149444
Ref: library/logging handlers logging handlers QueueListener enqueue_sentinel12149854
Ref: 349612149854
Node: platform --- 実行中プラットフォームの固有情報を参照する12150518
Ref: library/platform doc12150801
Ref: 349712150801
Ref: library/platform module-platform12150801
Ref: af12150801
Ref: library/platform platform-access-to-underlying-platform-s-identifying-data12150801
Ref: 349812150801
Ref: library/platform translation-repo12150801
Ref: 349912150801
Ref: platform --- 実行中プラットフォームの固有情報を参照する-Footnote-112151491
Node: Cross platform12151559
Ref: library/platform cross-platform12151711
Ref: 349a12151711
Ref: library/platform platform architecture12151760
Ref: 1c2d12151760
Ref: library/platform platform machine12153419
Ref: 349b12153419
Ref: library/platform platform node12153662
Ref: 349c12153662
Ref: library/platform platform platform12153879
Ref: 1ce612153879
Ref: library/platform platform processor12155078
Ref: 349e12155078
Ref: library/platform platform python_build12155468
Ref: 349f12155468
Ref: library/platform platform python_compiler12155618
Ref: 34a012155618
Ref: library/platform platform python_branch12155774
Ref: 34a112155774
Ref: library/platform platform python_implementation12155937
Ref: 34a212155937
Ref: library/platform platform python_revision12156133
Ref: 34a312156133
Ref: library/platform platform python_version12156301
Ref: 34a412156301
Ref: library/platform platform python_version_tuple12156570
Ref: 34a512156570
Ref: library/platform platform release12156859
Ref: 34a612156859
Ref: library/platform platform system12157051
Ref: 247712157051
Ref: library/platform platform system_alias12157486
Ref: 349d12157486
Ref: library/platform platform version12157774
Ref: 34a712157774
Ref: library/platform platform uname12158099
Ref: 202012158099
Ref: library/platform platform invalidate_caches12158924
Ref: 50c12158924
Node: Windows platform12159243
Ref: library/platform windows-platform12159418
Ref: 34a812159418
Ref: library/platform platform win32_ver12159471
Ref: 1f5d12159471
Ref: library/platform platform win32_edition12160300
Ref: 34a912160300
Ref: library/platform platform win32_is_iot12160631
Ref: 34aa12160631
Node: macOS platform12160858
Ref: library/platform macos-platform12161031
Ref: 34ab12161031
Ref: library/platform platform mac_ver12161080
Ref: 202212161080
Node: iOS platform12161478
Ref: library/platform ios-platform12161649
Ref: 34ac12161649
Ref: library/platform platform ios_ver12161694
Ref: 247612161694
Node: Unix platforms12162659
Ref: library/platform unix-platforms12162831
Ref: 34ad12162831
Ref: library/platform platform libc_ver12162880
Ref: 1a2112162880
Node: Linux platforms12163675
Ref: library/platform linux-platforms12163851
Ref: 34ae12163851
Ref: library/platform platform freedesktop_os_release12163902
Ref: c0312163902
Ref: Linux platforms-Footnote-112165395
Node: Android platform12165468
Ref: library/platform android-platform12165666
Ref: 34af12165666
Ref: library/platform platform android_ver12165719
Ref: 1bef12165719
Ref: Android platform-Footnote-112166898
Ref: Android platform-Footnote-212166977
Ref: Android platform-Footnote-312167048
Ref: Android platform-Footnote-412167120
Node: コマンドラインでの使用<3>12167194
Ref: library/platform command-line-usage12167368
Ref: 34b012167368
Ref: library/platform platform-cli12167368
Ref: 34b112167368
Ref: library/platform cmdoption-platform-terse12167664
Ref: 34b212167664
Ref: library/platform cmdoption-platform-nonaliased12167854
Ref: 34b312167854
Node: errno --- 標準の errno システムシンボル12168248
Ref: library/errno doc12168534
Ref: 34b412168534
Ref: library/errno errno-standard-errno-system-symbols12168534
Ref: 34b512168534
Ref: library/errno module-errno12168534
Ref: 5a12168534
Ref: library/errno translation-repo12168534
Ref: 34b612168534
Ref: library/errno errno errorcode12169032
Ref: 34b712169032
Ref: library/errno errno EPERM12169771
Ref: 1d7312169771
Ref: library/errno errno ENOENT12169903
Ref: 291d12169903
Ref: library/errno errno ESRCH12170039
Ref: 292112170039
Ref: library/errno errno EINTR12170166
Ref: 114412170166
Ref: library/errno errno EIO12170299
Ref: 34b812170299
Ref: library/errno errno ENXIO12170363
Ref: 34b912170363
Ref: library/errno errno E2BIG12170500
Ref: 34ba12170500
Ref: library/errno errno ENOEXEC12170588
Ref: 34bb12170588
Ref: library/errno errno EBADF12170684
Ref: d2912170684
Ref: library/errno errno ECHILD12170779
Ref: 291612170779
Ref: library/errno errno EAGAIN12170909
Ref: 291112170909
Ref: library/errno errno ENOMEM12171027
Ref: 34bc12171027
Ref: library/errno errno EACCES12171112
Ref: 292012171112
Ref: library/errno errno EFAULT12171239
Ref: 34bd12171239
Ref: library/errno errno ENOTBLK12171316
Ref: 34be12171316
Ref: library/errno errno EBUSY12171416
Ref: 34bf12171416
Ref: library/errno errno EEXIST12171534
Ref: 291c12171534
Ref: library/errno errno EXDEV12171655
Ref: 327512171655
Ref: library/errno errno ENODEV12171752
Ref: 34c012171752
Ref: library/errno errno ENOTDIR12171850
Ref: 291f12171850
Ref: library/errno errno EISDIR12171979
Ref: 291e12171979
Ref: library/errno errno EINVAL12172105
Ref: 1fe012172105
Ref: library/errno errno ENFILE12172181
Ref: 34c112172181
Ref: library/errno errno EMFILE12172299
Ref: 34c212172299
Ref: library/errno errno ENOTTY12172399
Ref: 34c312172399
Ref: library/errno errno ETXTBSY12172493
Ref: 34c412172493
Ref: library/errno errno EFBIG12172589
Ref: 34c512172589
Ref: library/errno errno ENOSPC12172674
Ref: 34c612172674
Ref: library/errno errno ESPIPE12172778
Ref: 34c712172778
Ref: library/errno errno EROFS12172853
Ref: 34c812172853
Ref: library/errno errno EMLINK12172966
Ref: 34c912172966
Ref: library/errno errno EPIPE12173046
Ref: 291712173046
Ref: library/errno errno EDOM12173166
Ref: 34ca12173166
Ref: library/errno errno ERANGE12173297
Ref: 34cb12173297
Ref: library/errno errno EDEADLK12173424
Ref: 34cc12173424
Ref: library/errno errno ENAMETOOLONG12173541
Ref: 34cd12173541
Ref: library/errno errno ENOLCK12173637
Ref: 34ce12173637
Ref: library/errno errno ENOSYS12173752
Ref: 1d7412173752
Ref: library/errno errno ENOTEMPTY12173851
Ref: 34cf12173851
Ref: library/errno errno ELOOP12173957
Ref: 34d012173957
Ref: library/errno errno EWOULDBLOCK12174098
Ref: 291312174098
Ref: library/errno errno ENOMSG12174233
Ref: 34d112174233
Ref: library/errno errno EIDRM12174352
Ref: 34d212174352
Ref: library/errno errno ECHRNG12174441
Ref: 34d312174441
Ref: library/errno errno EL2NSYNC12174552
Ref: 34d412174552
Ref: library/errno errno EL3HLT12174662
Ref: 34d512174662
Ref: library/errno errno EL3RST12174748
Ref: 34d612174748
Ref: library/errno errno ELNRNG12174839
Ref: 34d712174839
Ref: library/errno errno EUNATCH12174947
Ref: 34d812174947
Ref: library/errno errno ENOCSI12175077
Ref: 34d912175077
Ref: library/errno errno EL2HLT12175173
Ref: 34da12175173
Ref: library/errno errno EBADE12175259
Ref: 34db12175259
Ref: library/errno errno EBADR12175334
Ref: 34dc12175334
Ref: library/errno errno EXFULL12175428
Ref: 34dd12175428
Ref: library/errno errno ENOANO12175513
Ref: 34de12175513
Ref: library/errno errno EBADRQC12175584
Ref: 34df12175584
Ref: library/errno errno EBADSLT12175683
Ref: 34e012175683
Ref: library/errno errno EDEADLOCK12175762
Ref: 34e112175762
Ref: library/errno errno EBFONT12175902
Ref: 34e212175902
Ref: library/errno errno ENOSTR12176015
Ref: 34e312176015
Ref: library/errno errno ENODATA12176118
Ref: 34e412176118
Ref: library/errno errno ETIME12176217
Ref: 34e512176217
Ref: library/errno errno ENOSR12176286
Ref: 34e612176286
Ref: library/errno errno ENONET12176399
Ref: 34e712176399
Ref: library/errno errno ENOPKG12176518
Ref: 34e812176518
Ref: library/errno errno EREMOTE12176635
Ref: 34e912176635
Ref: library/errno errno ENOLINK12176724
Ref: 34ea12176724
Ref: library/errno errno EADV12176815
Ref: 34eb12176815
Ref: library/errno errno ESRMNT12176892
Ref: 34ec12176892
Ref: library/errno errno ECOMM12176967
Ref: 34ed12176967
Ref: library/errno errno EPROTO12177065
Ref: 34ee12177065
Ref: library/errno errno EMULTIHOP12177148
Ref: 34ef12177148
Ref: library/errno errno EDOTDOT12177241
Ref: 34f012177241
Ref: library/errno errno EBADMSG12177327
Ref: 34f112177327
Ref: library/errno errno EOVERFLOW12177430
Ref: 34f212177430
Ref: library/errno errno ENOTUNIQ12177577
Ref: 34f312177577
Ref: library/errno errno EBADFD12177701
Ref: 34f412177701
Ref: library/errno errno EREMCHG12177813
Ref: 34f512177813
Ref: library/errno errno ELIBACC12177920
Ref: 34f612177920
Ref: library/errno errno ELIBBAD12178063
Ref: 34f712178063
Ref: library/errno errno ELIBSCN12178204
Ref: 34f812178204
Ref: library/errno errno ELIBMAX12178331
Ref: 34f912178331
Ref: library/errno errno ELIBEXEC12178483
Ref: 34fa12178483
Ref: library/errno errno EILSEQ12178632
Ref: 34fb12178632
Ref: library/errno errno ERESTART12178719
Ref: 34fc12178719
Ref: library/errno errno ESTRPIPE12178880
Ref: 34fd12178880
Ref: library/errno errno EUSERS12178981
Ref: 34fe12178981
Ref: library/errno errno ENOTSOCK12179061
Ref: 34ff12179061
Ref: library/errno errno EDESTADDRREQ12179183
Ref: 350012179183
Ref: library/errno errno EMSGSIZE12179289
Ref: 350112179289
Ref: library/errno errno EPROTOTYPE12179379
Ref: 350212179379
Ref: library/errno errno ENOPROTOOPT12179514
Ref: 350312179514
Ref: library/errno errno EPROTONOSUPPORT12179619
Ref: 350412179619
Ref: library/errno errno ESOCKTNOSUPPORT12179740
Ref: 350512179740
Ref: library/errno errno EOPNOTSUPP12179864
Ref: 350612179864
Ref: library/errno errno ENOTSUP12180023
Ref: 350712180023
Ref: library/errno errno EPFNOSUPPORT12180111
Ref: 350812180111
Ref: library/errno errno EAFNOSUPPORT12180253
Ref: 350912180253
Ref: library/errno errno EADDRINUSE12180421
Ref: 350a12180421
Ref: library/errno errno EADDRNOTAVAIL12180516
Ref: 350b12180516
Ref: library/errno errno ENETDOWN12180655
Ref: 350c12180655
Ref: library/errno errno ENETUNREACH12180756
Ref: 1ff712180756
Ref: library/errno errno ENETRESET12180864
Ref: 350d12180864
Ref: library/errno errno ECONNABORTED12181023
Ref: 291912181023
Ref: library/errno errno ECONNRESET12181178
Ref: 291b12181178
Ref: library/errno errno ENOBUFS12181321
Ref: 1d8d12181321
Ref: library/errno errno EISCONN12181425
Ref: 350e12181425
Ref: library/errno errno ENOTCONN12181557
Ref: 350f12181557
Ref: library/errno errno ESHUTDOWN12181675
Ref: 291812181675
Ref: library/errno errno ETOOMANYREFS12181833
Ref: 351012181833
Ref: library/errno errno ETIMEDOUT12181964
Ref: 292212181964
Ref: library/errno errno ECONNREFUSED12182093
Ref: 291a12182093
Ref: library/errno errno EHOSTDOWN12182234
Ref: 351112182234
Ref: library/errno errno EHOSTUNREACH12182336
Ref: 351212182336
Ref: library/errno errno EHWPOISON12182436
Ref: 4a312182436
Ref: library/errno errno EALREADY12182535
Ref: 291212182535
Ref: library/errno errno EINPROGRESS12182675
Ref: 291412182675
Ref: library/errno errno ESTALE12182814
Ref: 351312182814
Ref: library/errno errno EUCLEAN12182918
Ref: 351412182918
Ref: library/errno errno ENOTNAM12183024
Ref: 351512183024
Ref: library/errno errno ENAVAIL12183142
Ref: 351612183142
Ref: library/errno errno EISNAM12183253
Ref: 351712183253
Ref: library/errno errno EREMOTEIO12183342
Ref: 351812183342
Ref: library/errno errno EDQUOT12183432
Ref: 351912183432
Ref: library/errno errno EQFULL12183527
Ref: 351a12183527
Ref: library/errno errno ENOMEDIUM12183622
Ref: 351b12183622
Ref: library/errno errno EMEDIUMTYPE12183676
Ref: 351c12183676
Ref: library/errno errno ENOKEY12183734
Ref: 351d12183734
Ref: library/errno errno EKEYEXPIRED12183796
Ref: 351e12183796
Ref: library/errno errno EKEYREVOKED12183852
Ref: 351f12183852
Ref: library/errno errno EKEYREJECTED12183913
Ref: 352012183913
Ref: library/errno errno ERFKILL12183982
Ref: 352112183982
Ref: library/errno errno ELOCKUNMAPPED12184056
Ref: 352212184056
Ref: library/errno errno ENOTACTIVE12184123
Ref: 352312184123
Ref: library/errno errno EAUTH12184185
Ref: 352412184185
Ref: library/errno errno EBADARCH12184268
Ref: 352512184268
Ref: library/errno errno EBADEXEC12184360
Ref: 352612184360
Ref: library/errno errno EBADMACHO12184460
Ref: 352712184460
Ref: library/errno errno EDEVERR12184548
Ref: 352812184548
Ref: library/errno errno EFTYPE12184625
Ref: 352912184625
Ref: library/errno errno ENEEDAUTH12184722
Ref: 352a12184722
Ref: library/errno errno ENOATTR12184807
Ref: 352b12184807
Ref: library/errno errno ENOPOLICY12184891
Ref: 352c12184891
Ref: library/errno errno EPROCLIM12184974
Ref: 352d12184974
Ref: library/errno errno EPROCUNAVAIL12185058
Ref: 352e12185058
Ref: library/errno errno EPROGMISMATCH12185153
Ref: 352f12185153
Ref: library/errno errno EPROGUNAVAIL12185245
Ref: 353012185245
Ref: library/errno errno EPWROFF12185335
Ref: 353112185335
Ref: library/errno errno EBADRPC12185419
Ref: 353212185419
Ref: library/errno errno ERPCMISMATCH12185501
Ref: 353312185501
Ref: library/errno errno ESHLIBVERS12185588
Ref: 353412185588
Ref: library/errno errno ENOTCAPABLE12185687
Ref: 1d5c12185687
Ref: library/errno errno ECANCELED12185905
Ref: 1a2212185905
Ref: library/errno errno EOWNERDEAD12185990
Ref: 353512185990
Ref: library/errno errno ENOTRECOVERABLE12186068
Ref: 353612186068
Node: ctypes --- Python 用の外部関数ライブラリ12186162
Ref: library/ctypes doc12186363
Ref: 353712186363
Ref: library/ctypes ctypes-a-foreign-function-library-for-python12186363
Ref: 353812186363
Ref: library/ctypes module-ctypes12186363
Ref: 2d12186363
Ref: library/ctypes translation-repo12186363
Ref: 353912186363
Ref: ctypes --- Python 用の外部関数ライブラリ-Footnote-112187161
Node: ctypes チュートリアル12187224
Ref: library/ctypes ctypes-ctypes-tutorial12187373
Ref: 353a12187373
Ref: library/ctypes ctypes-tutorial12187373
Ref: 353b12187373
Node: 動的リンクライブラリをロードする12188924
Ref: library/ctypes ctypes-loading-dynamic-link-libraries12189097
Ref: 353e12189097
Ref: library/ctypes loading-dynamic-link-libraries12189097
Ref: 353f12189097
Node: ロードしたdllから関数にアクセスする12191666
Ref: library/ctypes accessing-functions-from-loaded-dlls12191869
Ref: 354412191869
Ref: library/ctypes ctypes-accessing-functions-from-loaded-dlls12191869
Ref: 354512191869
Node: 関数を呼び出す12194400
Ref: library/ctypes calling-functions12194573
Ref: 354612194573
Ref: library/ctypes ctypes-calling-functions12194573
Ref: 354712194573
Node: 基本データ型12197081
Ref: library/ctypes ctypes-fundamental-data-types12197230
Ref: 2a4a12197230
Ref: library/ctypes fundamental-data-types12197230
Ref: 354812197230
Node: 続・関数を呼び出す12211401
Ref: library/ctypes calling-functions-continued12211555
Ref: 355e12211555
Ref: library/ctypes ctypes-calling-functions-continued12211555
Ref: 355f12211555
Node: Calling variadic functions12212717
Ref: library/ctypes calling-variadic-functions12212907
Ref: 356012212907
Ref: library/ctypes ctypes-calling-variadic-functions12212907
Ref: 356112212907
Node: 自作のデータ型とともに関数を呼び出す12213602
Ref: library/ctypes calling-functions-with-your-own-custom-data-types12213832
Ref: 356212213832
Ref: library/ctypes ctypes-calling-functions-with-own-custom-data-types12213832
Ref: 356312213832
Node: 要求される引数の型を指定する 関数プロトタイプ12214721
Ref: library/ctypes ctypes-specifying-required-argument-types12214940
Ref: 356412214940
Ref: library/ctypes specifying-the-required-argument-types-function-prototypes12214940
Ref: 356512214940
Node: 戻り値の型12216848
Ref: library/ctypes ctypes-return-types12217077
Ref: 356712217077
Ref: library/ctypes return-types12217077
Ref: 356812217077
Node: ポインタを渡す または、パラメータの参照渡し12220316
Ref: library/ctypes ctypes-passing-pointers12220499
Ref: 356b12220499
Ref: library/ctypes passing-pointers-or-passing-parameters-by-reference12220499
Ref: 356c12220499
Node: 構造体と共用体12221699
Ref: library/ctypes ctypes-structures-unions12221914
Ref: 356e12221914
Ref: library/ctypes structures-and-unions12221914
Ref: 356f12221914
Ref: library/ctypes ctypes-structureunion-alignment-byte-order12224180
Ref: 357012224180
Node: Structure/union layout alignment and byte order12224500
Ref: library/ctypes structure-union-layout-alignment-and-byte-order12224708
Ref: 357112224708
Node: 構造体と共用体におけるビットフィールド12225660
Ref: library/ctypes bit-fields-in-structures-and-unions12225856
Ref: 357412225856
Ref: library/ctypes ctypes-bit-fields-in-structures-unions12225856
Ref: 48212225856
Node: 配列<2>12226883
Ref: library/ctypes arrays12227044
Ref: 357512227044
Ref: library/ctypes ctypes-arrays12227044
Ref: 357612227044
Node: ポインタ12228475
Ref: library/ctypes ctypes-pointers12228608
Ref: 357712228608
Ref: library/ctypes pointers12228608
Ref: 357812228608
Node: Thread safety without the GIL12231584
Ref: library/ctypes ctypes-thread-safety12231717
Ref: 357a12231717
Ref: library/ctypes thread-safety-without-the-gil12231717
Ref: 357b12231717
Node: 型変換12232724
Ref: library/ctypes ctypes-type-conversions12232857
Ref: 357c12232857
Ref: library/ctypes type-conversions12232857
Ref: 357d12232857
Node: 不完全型12235688
Ref: library/ctypes ctypes-incomplete-types12235816
Ref: 58b12235816
Ref: library/ctypes incomplete-types12235816
Ref: 357f12235816
Node: コールバック関数12237512
Ref: library/ctypes callback-functions12237691
Ref: 358012237691
Ref: library/ctypes ctypes-callback-functions12237691
Ref: 358112237691
Node: dllからエクスポートされた値へアクセスする12242047
Ref: library/ctypes accessing-values-exported-from-dlls12242232
Ref: 358412242232
Ref: library/ctypes ctypes-accessing-values-exported-from-dlls12242232
Ref: 358512242232
Node: びっくり仰天12245454
Ref: library/ctypes ctypes-surprises12245645
Ref: 358812245645
Ref: library/ctypes surprises12245645
Ref: 358912245645
Node: 可変サイズのデータ型12248371
Ref: library/ctypes ctypes-variable-sized-data-types12248493
Ref: 358a12248493
Ref: library/ctypes variable-sized-data-types12248493
Ref: 358b12248493
Node: ctypesリファレンス12250118
Ref: library/ctypes ctypes-ctypes-reference12250267
Ref: 358d12250267
Ref: library/ctypes ctypes-reference12250267
Ref: 358e12250267
Node: 共有ライブラリをロードする12250696
Ref: library/ctypes ctypes-loading-shared-libraries12250841
Ref: 358f12250841
Ref: library/ctypes loading-shared-libraries12250841
Ref: 359012250841
Ref: library/ctypes ctypes CDLL12251072
Ref: db112251072
Ref: library/ctypes ctypes CDLL _handle12257045
Ref: 359112257045
Ref: library/ctypes ctypes CDLL _name12257164
Ref: 359212257164
Ref: library/ctypes ctypes OleDLL12257266
Ref: 1d0012257266
Ref: library/ctypes ctypes WinDLL12257934
Ref: 1d0112257934
Ref: library/ctypes ctypes PyDLL12258196
Ref: 1d0212258196
Ref: library/ctypes ctypes RTLD_GLOBAL12258612
Ref: 359a12258612
Ref: library/ctypes ctypes RTLD_LOCAL12258823
Ref: 359b12258823
Ref: library/ctypes ctypes DEFAULT_MODE12259012
Ref: 359c12259012
Ref: library/ctypes ctypes LibraryLoader12259507
Ref: 359d12259507
Ref: library/ctypes ctypes LibraryLoader LoadLibrary12260015
Ref: 354312260015
Ref: library/ctypes ctypes cdll12260354
Ref: 354012260354
Ref: library/ctypes ctypes windll12260452
Ref: 354112260452
Ref: library/ctypes ctypes oledll12260583
Ref: 354212260583
Ref: library/ctypes ctypes pydll12260714
Ref: 359e12260714
Ref: library/ctypes ctypes pythonapi12260815
Ref: 359412260815
Ref: 共有ライブラリをロードする-Footnote-112261794
Ref: 共有ライブラリをロードする-Footnote-212261840
Ref: 共有ライブラリをロードする-Footnote-312261945
Ref: 共有ライブラリをロードする-Footnote-412262050
Ref: 共有ライブラリをロードする-Footnote-512262096
Ref: 共有ライブラリをロードする-Footnote-612262201
Node: 共有ライブラリを見つける12262296
Ref: library/ctypes ctypes-finding-shared-libraries12262481
Ref: 359312262481
Ref: library/ctypes finding-shared-libraries12262481
Ref: 359f12262481
Ref: library/ctypes ctypes util find_library12263644
Ref: 110212263644
Ref: library/ctypes ctypes util find_msvcrt12265923
Ref: 35a012265923
Node: Listing loaded shared libraries12266567
Ref: library/ctypes ctypes-listing-loaded-shared-libraries12266725
Ref: 35a112266725
Ref: library/ctypes listing-loaded-shared-libraries12266725
Ref: 35a212266725
Node: 外部関数12267614
Ref: library/ctypes ctypes-foreign-functions12267760
Ref: 35a312267760
Ref: library/ctypes foreign-functions12267760
Ref: 35a412267760
Ref: library/ctypes ctypes _CFuncPtr12268442
Ref: 1b1212268442
Ref: library/ctypes ctypes _CFuncPtr restype12268855
Ref: 356912268855
Ref: library/ctypes ctypes _CFuncPtr argtypes12269554
Ref: 1a2012269554
Ref: library/ctypes ctypes _CFuncPtr errcheck12270778
Ref: 356a12270778
Node: 関数プロトタイプ12272602
Ref: library/ctypes ctypes-function-prototypes12272747
Ref: 35a512272747
Ref: library/ctypes function-prototypes12272747
Ref: 35a612272747
Ref: library/ctypes ctypes CFUNCTYPE12273461
Ref: 358212273461
Ref: library/ctypes ctypes WINFUNCTYPE12274032
Ref: 358312274032
Ref: library/ctypes ctypes PYFUNCTYPE12274414
Ref: 35a712274414
Node: ユーティリティー関数12280755
Ref: library/ctypes ctypes-utility-functions12280903
Ref: 35a812280903
Ref: library/ctypes utility-functions12280903
Ref: 35a912280903
Ref: library/ctypes ctypes addressof12280976
Ref: 35aa12280976
Ref: library/ctypes ctypes alignment12281293
Ref: 35ab12281293
Ref: library/ctypes ctypes byref12281505
Ref: 356d12281505
Ref: library/ctypes ctypes CopyComPointer12282150
Ref: 48712282150
Ref: library/ctypes ctypes cast12282746
Ref: 357e12282746
Ref: library/ctypes ctypes create_string_buffer12283132
Ref: 355d12283132
Ref: library/ctypes ctypes create_unicode_buffer12284690
Ref: 1fc312284690
Ref: library/ctypes ctypes DllCanUnloadNow12285286
Ref: 35ac12285286
Ref: library/ctypes ctypes DllGetClassObject12285559
Ref: 35ad12285559
Ref: library/ctypes ctypes util dllist12285842
Ref: 48a12285842
Ref: library/ctypes ctypes FormatError12286417
Ref: 35ae12286417
Ref: library/ctypes ctypes GetLastError12286698
Ref: 198412286698
Ref: library/ctypes ctypes get_errno12286994
Ref: 359512286994
Ref: library/ctypes ctypes get_last_error12287265
Ref: 359712287265
Ref: library/ctypes ctypes memmove12287583
Ref: 35af12287583
Ref: library/ctypes ctypes memset12287906
Ref: 35b012287906
Ref: library/ctypes ctypes POINTER12288254
Ref: 48b12288254
Ref: library/ctypes ctypes pointer12288916
Ref: 1c7b12288916
Ref: library/ctypes ctypes resize12289256
Ref: 358c12289256
Ref: library/ctypes ctypes set_errno12289683
Ref: 359612289683
Ref: library/ctypes ctypes set_last_error12290039
Ref: 359812290039
Ref: library/ctypes ctypes sizeof12290423
Ref: 35b112290423
Ref: library/ctypes ctypes string_at12290644
Ref: 48912290644
Ref: library/ctypes ctypes WinError12290957
Ref: 35b212290957
Ref: library/ctypes ctypes wstring_at12291472
Ref: 35b312291472
Ref: library/ctypes ctypes memoryview_at12291831
Ref: 48812291831
Node: データ型<3>12292801
Ref: library/ctypes ctypes-data-types12292946
Ref: 35b512292946
Ref: library/ctypes data-types12292946
Ref: 35b612292946
Ref: library/ctypes ctypes _CData12292989
Ref: 35b712292989
Ref: library/ctypes ctypes _CData from_buffer12293836
Ref: 35b912293836
Ref: library/ctypes ctypes _CData from_buffer_copy12294659
Ref: 35ba12294659
Ref: library/ctypes ctypes _CData from_address12295367
Ref: 35b412295367
Ref: library/ctypes ctypes _CData from_param12295797
Ref: 356612295797
Ref: library/ctypes ctypes _CData in_dll12296435
Ref: 358612296435
Ref: library/ctypes ctypes _CData __pointer_type__12296835
Ref: 48c12296835
Ref: library/ctypes ctypes _CData _b_base_12297167
Ref: 35bb12297167
Ref: library/ctypes ctypes _CData _b_needsfree_12297568
Ref: 35bc12297568
Ref: library/ctypes ctypes _CData _objects12297862
Ref: 35b812297862
Node: 基本データ型<2>12298290
Ref: library/ctypes ctypes-fundamental-data-types-212298426
Ref: 35bd12298426
Ref: library/ctypes id112298426
Ref: 35be12298426
Ref: library/ctypes ctypes _SimpleCData12298479
Ref: 35bf12298479
Ref: library/ctypes ctypes _SimpleCData value12299074
Ref: 35c012299074
Ref: library/ctypes ctypes _SimpleCData _type_12299814
Ref: 2d812299814
Ref: library/ctypes ctypes c_byte12301434
Ref: 1cfe12301434
Ref: library/ctypes ctypes c_char12301711
Ref: 354a12301711
Ref: library/ctypes ctypes c_char_p12301998
Ref: 1c7c12301998
Ref: library/ctypes ctypes c_double12302418
Ref: 1ecd12302418
Ref: library/ctypes ctypes c_longdouble12302598
Ref: 1ece12302598
Ref: library/ctypes ctypes c_float12302923
Ref: 355b12302923
Ref: library/ctypes ctypes c_double_complex12303101
Ref: 2da12303101
Ref: library/ctypes ctypes c_float_complex12303307
Ref: 2d912303307
Ref: library/ctypes ctypes c_longdouble_complex12303511
Ref: 2db12303511
Ref: library/ctypes ctypes c_int12303726
Ref: 353c12303726
Ref: library/ctypes ctypes c_int812304081
Ref: 354e12304081
Ref: library/ctypes ctypes c_int1612304206
Ref: 354f12304206
Ref: library/ctypes ctypes c_int3212304357
Ref: 355012304357
Ref: library/ctypes ctypes c_int6412304506
Ref: 355112304506
Ref: library/ctypes ctypes c_long12304660
Ref: 353d12304660
Ref: library/ctypes ctypes c_longlong12304891
Ref: 355812304891
Ref: library/ctypes ctypes c_short12305176
Ref: 354c12305176
Ref: library/ctypes ctypes c_size_t12305409
Ref: 355a12305409
Ref: library/ctypes ctypes c_ssize_t12305545
Ref: 15f712305545
Ref: library/ctypes ctypes c_time_t12305796
Ref: 1d8012305796
Ref: library/ctypes ctypes c_ubyte12305952
Ref: 1cff12305952
Ref: library/ctypes ctypes c_uint12306237
Ref: 355212306237
Ref: library/ctypes ctypes c_uint812306609
Ref: 355312306609
Ref: library/ctypes ctypes c_uint1612306738
Ref: 355412306738
Ref: library/ctypes ctypes c_uint3212306893
Ref: 355512306893
Ref: library/ctypes ctypes c_uint6412307046
Ref: 355612307046
Ref: library/ctypes ctypes c_ulong12307204
Ref: 355712307204
Ref: library/ctypes ctypes c_ulonglong12307438
Ref: 355912307438
Ref: library/ctypes ctypes c_ushort12307726
Ref: 354d12307726
Ref: library/ctypes ctypes c_void_p12307962
Ref: 1c7e12307962
Ref: library/ctypes ctypes c_wchar12308168
Ref: 354b12308168
Ref: library/ctypes ctypes c_wchar_p12308492
Ref: 1c7d12308492
Ref: library/ctypes ctypes c_bool12308750
Ref: 354912308750
Ref: library/ctypes ctypes HRESULT12309029
Ref: 359912309029
Ref: library/ctypes ctypes py_object12309221
Ref: 48d12309221
Ref: library/ctypes ctypes-wintypes12309508
Ref: 355c12309508
Ref: 基本データ型<2>-Footnote-112309776
Node: 構造化データ型12309873
Ref: library/ctypes ctypes-structured-data-types12310015
Ref: 35c112310015
Ref: library/ctypes structured-data-types12310015
Ref: 35c212310015
Ref: library/ctypes ctypes Union12310073
Ref: 48412310073
Ref: library/ctypes ctypes BigEndianUnion12310341
Ref: 1dd012310341
Ref: library/ctypes ctypes LittleEndianUnion12310540
Ref: 1dd112310540
Ref: library/ctypes ctypes BigEndianStructure12310742
Ref: 357212310742
Ref: library/ctypes ctypes LittleEndianStructure12310916
Ref: 357312310916
Ref: library/ctypes ctypes Structure12311334
Ref: 48312311334
Ref: library/ctypes ctypes Structure _fields_12311793
Ref: 1b6f12311793
Ref: library/ctypes ctypes Structure _pack_12314010
Ref: 32012314010
Ref: library/ctypes ctypes Structure _align_12315106
Ref: 6f312315106
Ref: library/ctypes ctypes Structure _layout_12315939
Ref: 32112315939
Ref: library/ctypes ctypes Structure _anonymous_12317218
Ref: 35c312317218
Ref: library/ctypes ctypes CField12319977
Ref: 48512319977
Ref: library/ctypes ctypes CField name12321142
Ref: 35c412321142
Ref: library/ctypes ctypes CField type12321211
Ref: 35c512321211
Ref: library/ctypes ctypes CField offset12321298
Ref: 35c612321298
Ref: library/ctypes ctypes CField byte_offset12321325
Ref: 35c712321325
Ref: library/ctypes ctypes CField byte_size12321530
Ref: 35c912321530
Ref: library/ctypes ctypes CField size12321755
Ref: 35ca12321755
Ref: library/ctypes ctypes CField is_bitfield12322069
Ref: 35cc12322069
Ref: library/ctypes ctypes CField bit_offset12322141
Ref: 35c812322141
Ref: library/ctypes ctypes CField bit_size12322172
Ref: 35cb12322172
Ref: library/ctypes ctypes CField is_anonymous12322686
Ref: 35cd12322686
Node: 配列とポインタ12322883
Ref: library/ctypes arrays-and-pointers12323014
Ref: 35ce12323014
Ref: library/ctypes ctypes-arrays-pointers12323014
Ref: 35cf12323014
Ref: library/ctypes ctypes Array12323072
Ref: 201a12323072
Ref: library/ctypes ctypes Array _length_12323596
Ref: 35d012323596
Ref: library/ctypes ctypes Array _type_12323849
Ref: 35d112323849
Ref: library/ctypes ctypes ARRAY12324097
Ref: 7a312324097
Ref: library/ctypes ctypes _Pointer12324358
Ref: 35d212324358
Ref: library/ctypes ctypes _Pointer _type_12325250
Ref: 1a9a12325250
Ref: library/ctypes ctypes _Pointer contents12325332
Ref: 357912325332
Node: 例外<11>12325565
Ref: library/ctypes ctypes-exceptions12325666
Ref: 35d312325666
Ref: library/ctypes exceptions12325666
Ref: 35d412325666
Ref: library/ctypes ctypes ArgumentError12325699
Ref: 35d512325699
Ref: library/ctypes ctypes COMError12325863
Ref: 48612325863
Ref: library/ctypes ctypes COMError hresult12325979
Ref: 35d612325979
Ref: library/ctypes ctypes COMError text12326066
Ref: 35d712326066
Ref: library/ctypes ctypes COMError details12326122
Ref: 35d812326122
Node: コマンドラインインターフェースライブラリ12326645
Ref: library/cmdlinelibs doc12326854
Ref: 35d912326854
Ref: library/cmdlinelibs cmdlinelibs12326854
Ref: 35da12326854
Ref: library/cmdlinelibs command-line-interface-libraries12326854
Ref: 35db12326854
Ref: library/cmdlinelibs translation-repo12326854
Ref: 35dc12326854
Node: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー12328368
Ref: library/argparse doc12328618
Ref: 35dd12328618
Ref: library/argparse argparse-parser-for-command-line-options-arguments-and-subcommands12328618
Ref: 35de12328618
Ref: library/argparse module-argparse12328618
Ref: 712328618
Ref: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー-Footnote-112331932
Node: ArgumentParser オブジェクト12332000
Ref: library/argparse argumentparser-objects12332204
Ref: 35e312332204
Ref: library/argparse argparse ArgumentParser12332285
Ref: 1e712332285
Node: prog12335968
Ref: library/argparse id112336056
Ref: 35f112336056
Ref: library/argparse prog12336056
Ref: 45e12336056
Node: usage12337787
Ref: library/argparse usage12337895
Ref: 35e412337895
Node: description12338968
Ref: library/argparse description12339078
Ref: 35e512339078
Ref: library/argparse id212339078
Ref: 35f312339078
Node: epilog12339651
Ref: library/argparse epilog12339763
Ref: 35e612339763
Node: parents12340559
Ref: library/argparse parents12340675
Ref: 35e712340675
Node: formatter_class12342413
Ref: library/argparse formatter-class12342535
Ref: 35e812342535
Ref: library/argparse id312342535
Ref: 35f412342535
Ref: library/argparse argparse RawDescriptionHelpFormatter12342826
Ref: 35f512342826
Ref: library/argparse argparse RawTextHelpFormatter12342878
Ref: 35f612342878
Ref: library/argparse argparse ArgumentDefaultsHelpFormatter12342923
Ref: 1e6612342923
Ref: library/argparse argparse MetavarTypeHelpFormatter12342977
Ref: 35f712342977
Node: prefix_chars12346456
Ref: library/argparse prefix-chars12346592
Ref: 35e912346592
Node: fromfile_prefix_chars12347365
Ref: library/argparse fromfile-prefix-chars12347502
Ref: 35ea12347502
Node: argument_default12349603
Ref: library/argparse argument-default12349740
Ref: 35eb12349740
Node: allow_abbrev12350727
Ref: library/argparse allow-abbrev12350859
Ref: 117b12350859
Ref: library/argparse id412350859
Ref: 35fc12350859
Node: conflict_handler12351547
Ref: library/argparse conflict-handler12351671
Ref: 35ec12351671
Node: add_help12353489
Ref: library/argparse add-help12353614
Ref: 35ed12353614
Node: exit_on_error12354866
Ref: library/argparse exit-on-error12354991
Ref: 35ee12354991
Node: suggest_on_error12355903
Ref: library/argparse suggest-on-error12356025
Ref: 35ef12356025
Node: color12357085
Ref: library/argparse color12357185
Ref: 35f012357185
Ref: color-Footnote-112358892
Node: add_argument メソッド12358947
Ref: library/argparse the-add-argument-method12359183
Ref: 35fd12359183
Ref: library/argparse argparse ArgumentParser add_argument12359256
Ref: 3f412359256
Node: name または flags12361382
Ref: library/argparse id512361479
Ref: 360312361479
Ref: library/argparse name-or-flags12361479
Ref: 35fe12361479
Node: action12363595
Ref: library/argparse action12363706
Ref: 1b6512363706
Ref: library/argparse id612363706
Ref: 360412363706
Node: nargs12370372
Ref: library/argparse id712370468
Ref: 360612370468
Ref: library/argparse nargs12370468
Ref: 195712370468
Node: const12374516
Ref: library/argparse const12374613
Ref: 1b6c12374613
Ref: library/argparse id812374613
Ref: 360812374613
Node: default12376036
Ref: library/argparse default12376132
Ref: 1b6b12376132
Ref: library/argparse id912376132
Ref: 360912376132
Node: type12378806
Ref: library/argparse argparse-type12378904
Ref: 360a12378904
Ref: library/argparse type12378904
Ref: 35f812378904
Node: choices12382622
Ref: library/argparse choices12382721
Ref: 1b6712382721
Ref: library/argparse id1012382721
Ref: 360c12382721
Node: required12384939
Ref: library/argparse id1112385038
Ref: 360d12385038
Ref: library/argparse required12385038
Ref: 35ff12385038
Node: help12386082
Ref: library/argparse help12386181
Ref: 360012386181
Ref: library/argparse id1212386181
Ref: 360e12386181
Node: metavar12387861
Ref: library/argparse id1312387956
Ref: 360f12387956
Ref: library/argparse metavar12387956
Ref: 360112387956
Node: dest12390233
Ref: library/argparse dest12390334
Ref: 35f912390334
Ref: library/argparse id1412390334
Ref: 361012390334
Node: deprecated12392411
Ref: library/argparse deprecated12392521
Ref: 360212392521
Ref: library/argparse id1512392521
Ref: 361112392521
Node: Action クラス12393433
Ref: library/argparse action-classes12393530
Ref: 361212393530
Ref: library/argparse argparse Action12393824
Ref: 1da712393824
Ref: library/argparse argparse Action __call__12394722
Ref: 361312394722
Ref: library/argparse argparse Action format_usage12396022
Ref: 361412396022
Ref: library/argparse argparse BooleanOptionalAction12396336
Ref: 1e612396336
Node: parse_args メソッド12397298
Ref: library/argparse the-parse-args-method12397534
Ref: 361512397534
Ref: library/argparse argparse ArgumentParser parse_args12397603
Ref: 35e112397603
Node: オプション値の文法12398643
Ref: library/argparse option-value-syntax12398754
Ref: 361812398754
Node: 不正な引数12400444
Ref: library/argparse invalid-arguments12400581
Ref: 361912400581
Node: - を含む引数12401610
Ref: library/argparse arguments-containing12401772
Ref: 361a12401772
Node: 引数の短縮形 先頭文字でのマッチング12403941
Ref: library/argparse argument-abbreviations-prefix-matching12404103
Ref: 361b12404103
Ref: library/argparse prefix-matching12404103
Ref: 117c12404103
Node: sys argv 以外12405140
Ref: library/argparse args12405313
Ref: 361612405313
Ref: library/argparse beyond-sys-argv12405313
Ref: 361c12405313
Node: Namespace オブジェクト12406273
Ref: library/argparse namespace12406385
Ref: 361712406385
Ref: library/argparse the-namespace-object12406385
Ref: 361d12406385
Ref: library/argparse argparse Namespace12406458
Ref: 35e212406458
Node: その他のユーティリティ12407747
Ref: library/argparse other-utilities12407968
Ref: 361e12407968
Node: Subcommands12408361
Ref: library/argparse subcommands12408478
Ref: 361f12408478
Ref: library/argparse argparse ArgumentParser add_subparsers12408523
Ref: fda12408523
Ref: library/argparse argparse _SubParsersAction add_parser12417186
Ref: 35f212417186
Node: FileType オブジェクト12418560
Ref: library/argparse filetype-objects12418704
Ref: 362012418704
Ref: library/argparse argparse FileType12418775
Ref: 32612418775
Node: 引数グループ12420795
Ref: library/argparse argument-groups12420940
Ref: 362112420940
Ref: library/argparse argparse ArgumentParser add_argument_group12420993
Ref: 32512420993
Node: 相互排他12424003
Ref: library/argparse mutual-exclusion12424154
Ref: 362212424154
Ref: library/argparse argparse ArgumentParser add_mutually_exclusive_group12424197
Ref: 56e12424197
Node: パーサーのデフォルト値12426946
Ref: library/argparse parser-defaults12427097
Ref: 362312427097
Ref: library/argparse argparse ArgumentParser set_defaults12427175
Ref: 35fb12427175
Ref: library/argparse argparse ArgumentParser get_default12428561
Ref: 362412428561
Node: ヘルプの表示12428946
Ref: library/argparse printing-help12429097
Ref: 362512429097
Ref: library/argparse argparse ArgumentParser print_usage12429421
Ref: 362612429421
Ref: library/argparse argparse ArgumentParser print_help12429703
Ref: 362712429703
Ref: library/argparse argparse ArgumentParser format_usage12430140
Ref: 1fbf12430140
Ref: library/argparse argparse ArgumentParser format_help12430347
Ref: 362812430347
Node: 部分解析12430587
Ref: library/argparse partial-parsing12430744
Ref: 362912430744
Ref: library/argparse argparse ArgumentParser parse_known_args12430787
Ref: 362a12430787
Node: ファイル解析のカスタマイズ12432036
Ref: library/argparse customizing-file-parsing12432193
Ref: 362b12432193
Ref: library/argparse argparse ArgumentParser convert_arg_line_to_args12432281
Ref: 35fa12432281
Node: 終了メソッド12433419
Ref: library/argparse exiting-methods12433591
Ref: 362c12433591
Ref: library/argparse argparse ArgumentParser exit12433644
Ref: 362d12433644
Ref: library/argparse argparse ArgumentParser error12434213
Ref: 362e12434213
Node: 混在した引数の解析12434418
Ref: library/argparse intermixed-parsing12434586
Ref: 362f12434586
Ref: library/argparse argparse ArgumentParser parse_intermixed_args12434654
Ref: ec912434654
Ref: library/argparse argparse ArgumentParser parse_known_intermixed_args12434748
Ref: 363012434748
Node: Registering custom types or actions12436543
Ref: library/argparse registering-custom-types-or-actions12436684
Ref: 363112436684
Ref: library/argparse argparse ArgumentParser register12436777
Ref: 360512436777
Node: 例外<12>12438249
Ref: library/argparse exceptions12438438
Ref: 363212438438
Ref: library/argparse argparse ArgumentError12438471
Ref: 363312438471
Ref: library/argparse argparse ArgumentTypeError12438768
Ref: 360b12438768
Node: Argparse チュートリアル12439081
Ref: howto/argparse doc12439202
Ref: 363412439202
Ref: howto/argparse argparse-tutorial12439202
Ref: 35e012439202
Ref: howto/argparse id112439202
Ref: 363512439202
Node: コンセプト12440544
Ref: howto/argparse concepts12440641
Ref: 363612440641
Node: 基礎12443306
Ref: howto/argparse the-basics12443433
Ref: 363712443433
Node: 位置引数の入門12444860
Ref: howto/argparse introducing-positional-arguments12444995
Ref: 363812444995
Node: Optional引数の導入12448689
Ref: howto/argparse introducing-optional-arguments12448856
Ref: 363912448856
Node: 短いオプション12452488
Ref: howto/argparse short-options12452569
Ref: 363a12452569
Node: 位置引数とOptional引数の併用12453480
Ref: howto/argparse combining-positional-and-optional-arguments12453656
Ref: 363b12453656
Node: もうちょっとだけ学ぶ12462706
Ref: howto/argparse getting-a-little-more-advanced12462898
Ref: 363c12462898
Node: 多義性のある引数の指定12464993
Ref: howto/argparse id212465129
Ref: 363d12465129
Ref: howto/argparse specifying-ambiguous-arguments12465129
Ref: 360712465129
Node: 競合するオプション12466175
Ref: howto/argparse conflicting-options12466311
Ref: 363e12466311
Node: argparse の出力を翻訳するには12469740
Ref: howto/argparse how-to-translate-the-argparse-output12469916
Ref: 363f12469916
Ref: argparse の出力を翻訳するには-Footnote-112472076
Node: Custom type converters12472109
Ref: howto/argparse custom-type-converters12472261
Ref: 364112472261
Node: 結び12474023
Ref: howto/argparse conclusion12474127
Ref: 364212474127
Ref: howto/argparse-optparse upgrading-optparse-code12474535
Ref: 156c12474535
Node: Migrating optparse code to argparse12474535
Ref: howto/argparse-optparse doc12474656
Ref: 364312474656
Ref: howto/argparse-optparse migrating-optparse-code12474656
Ref: 364412474656
Ref: howto/argparse-optparse migrating-optparse-code-to-argparse12474656
Ref: 364512474656
Ref: howto/argparse-optparse translation-repo12474656
Ref: 364612474656
Node: optparse --- Parser for command line options12478034
Ref: library/optparse doc12478350
Ref: 364c12478350
Ref: library/optparse module-optparse12478350
Ref: a412478350
Ref: library/optparse optparse-parser-for-command-line-options12478350
Ref: 364d12478350
Ref: library/optparse translation-repo12478350
Ref: 364e12478350
Ref: optparse --- Parser for command line options-Footnote-112478874
Node: Choosing an argument parsing library12478942
Ref: library/optparse choosing-an-argument-parser12479083
Ref: 35df12479083
Ref: library/optparse choosing-an-argument-parsing-library12479083
Ref: 364f12479083
Ref: Choosing an argument parsing library-Footnote-112484692
Ref: Choosing an argument parsing library-Footnote-212484732
Ref: Choosing an argument parsing library-Footnote-312484772
Node: はじめに<7>12484820
Ref: library/optparse introduction12484976
Ref: 365012484976
Node: 背景12487477
Ref: library/optparse background12487621
Ref: 365112487621
Ref: library/optparse optparse-background12487621
Ref: 365212487621
Node: 用語集12488197
Ref: library/optparse optparse-terminology12488285
Ref: 365312488285
Ref: library/optparse terminology12488285
Ref: 365412488285
Node: オプションとは何か12492781
Ref: library/optparse optparse-what-options-for12492902
Ref: 365512492902
Ref: library/optparse what-are-options-for12492902
Ref: 365612492902
Node: 位置引数とは何か12495475
Ref: library/optparse optparse-what-positional-arguments-for12495578
Ref: 365712495578
Ref: library/optparse what-are-positional-arguments-for12495578
Ref: 365812495578
Node: チュートリアル<2>12497305
Ref: library/optparse optparse-tutorial12497461
Ref: 365912497461
Ref: library/optparse tutorial12497461
Ref: 365a12497461
Node: オプション・アクションを理解する12500648
Ref: library/optparse optparse-understanding-option-actions12500787
Ref: 365f12500787
Ref: library/optparse understanding-option-actions12500787
Ref: 366012500787
Node: store アクション12501379
Ref: library/optparse optparse-store-action12501574
Ref: 366212501574
Ref: library/optparse the-store-action12501574
Ref: 366312501574
Node: ブール値 フラグ オプションの処理12503974
Ref: library/optparse handling-boolean-flag-options12504148
Ref: 366412504148
Ref: library/optparse optparse-handling-boolean-options12504148
Ref: 366512504148
Node: その他のアクション12505104
Ref: library/optparse optparse-other-actions12505275
Ref: 366612505275
Ref: library/optparse other-actions12505275
Ref: 366712505275
Node: デフォルト値12505872
Ref: library/optparse default-values12506014
Ref: 366b12506014
Ref: library/optparse optparse-default-values12506014
Ref: 366c12506014
Node: ヘルプの生成12508312
Ref: library/optparse generating-help12508457
Ref: 366d12508457
Ref: library/optparse optparse-generating-help12508457
Ref: 366e12508457
Node: オプションをグループ化する12512941
Ref: library/optparse grouping-options12513035
Ref: 366f12513035
Ref: library/optparse optparse OptionGroup12513495
Ref: 367012513495
Ref: library/optparse optparse OptionParser get_option_group12517191
Ref: 367112517191
Node: バージョン番号の出力12517533
Ref: library/optparse optparse-printing-version-string12517687
Ref: 367212517687
Ref: library/optparse printing-a-version-string12517687
Ref: 367312517687
Ref: library/optparse optparse OptionParser print_version12518596
Ref: 367412518596
Ref: library/optparse optparse OptionParser get_version12519058
Ref: 367612519058
Node: How optparse handles errors12519234
Ref: library/optparse how-optparse-handles-errors12519400
Ref: 367712519400
Ref: library/optparse optparse-how-optparse-handles-errors12519400
Ref: 367812519400
Node: 全てをつなぎ合わせる12521541
Ref: library/optparse optparse-putting-it-all-together12521668
Ref: 367912521668
Ref: library/optparse putting-it-all-together12521668
Ref: 367a12521668
Node: リファレンスガイド12522583
Ref: library/optparse optparse-reference-guide12522772
Ref: 366912522772
Ref: library/optparse reference-guide12522772
Ref: 367b12522772
Node: parserを作る12523220
Ref: library/optparse creating-the-parser12523344
Ref: 367c12523344
Ref: library/optparse optparse-creating-parser12523344
Ref: 367d12523344
Ref: library/optparse optparse OptionParser12523473
Ref: 188512523473
Node: パーザへのオプション追加12526987
Ref: library/optparse optparse-populating-parser12527144
Ref: 367f12527144
Ref: library/optparse populating-the-parser12527144
Ref: 368012527144
Node: オプションの定義12528721
Ref: library/optparse defining-options12528884
Ref: 368212528884
Ref: library/optparse optparse-defining-options12528884
Ref: 368312528884
Ref: library/optparse optparse OptionParser add_option12529479
Ref: 364712529479
Ref: library/optparse optparse Values12531956
Ref: 364912531956
Node: オプション属性12533279
Ref: library/optparse option-attributes12533451
Ref: 368612533451
Ref: library/optparse optparse-option-attributes12533451
Ref: 368712533451
Ref: library/optparse optparse Option12533509
Ref: 368112533509
Ref: library/optparse optparse Option action12534126
Ref: 365b12534126
Ref: library/optparse optparse Option type12534350
Ref: 365c12534350
Ref: library/optparse optparse Option dest12534639
Ref: 365d12534639
Ref: library/optparse optparse Option default12534979
Ref: 368912534979
Ref: library/optparse optparse Option nargs12535212
Ref: 368b12535212
Ref: library/optparse optparse Option const12535448
Ref: 366812535448
Ref: library/optparse optparse Option choices12535547
Ref: 368c12535547
Ref: library/optparse optparse Option callback12535705
Ref: 368d12535705
Ref: library/optparse optparse Option callback_args12536079
Ref: 368e12536079
Ref: library/optparse optparse Option callback_kwargs12536115
Ref: 368f12536115
Ref: library/optparse optparse Option help12536306
Ref: 365e12536306
Ref: library/optparse optparse Option metavar12536776
Ref: 369012536776
Node: 標準的なオプション・アクション12537046
Ref: library/optparse optparse-standard-option-actions12537221
Ref: 368412537221
Ref: library/optparse standard-option-actions12537221
Ref: 369112537221
Node: 標準のオプション型12546098
Ref: library/optparse optparse-standard-option-types12546273
Ref: 368812546273
Ref: library/optparse standard-option-types12546273
Ref: 369212546273
Node: 引数を解析する12548020
Ref: library/optparse optparse-parsing-arguments12548204
Ref: 368512548204
Ref: library/optparse parsing-arguments12548204
Ref: 369312548204
Ref: library/optparse optparse OptionParser parse_args12548424
Ref: 188612548424
Node: オプション解析器への問い合わせと操作12550099
Ref: library/optparse optparse-querying-manipulating-option-parser12550283
Ref: 369412550283
Ref: library/optparse querying-and-manipulating-your-option-parser12550283
Ref: 369512550283
Ref: library/optparse optparse OptionParser disable_interspersed_args12550687
Ref: 364812550687
Ref: library/optparse optparse OptionParser enable_interspersed_args12551736
Ref: 369612551736
Ref: library/optparse optparse OptionParser get_option12552058
Ref: 369712552058
Ref: library/optparse optparse OptionParser has_option12552300
Ref: 369812552300
Ref: library/optparse optparse OptionParser remove_option12552512
Ref: 369912552512
Node: オプション間の衝突12553045
Ref: library/optparse conflicts-between-options12553229
Ref: 369a12553229
Ref: library/optparse optparse-conflicts-between-options12553229
Ref: 367e12553229
Node: クリーンアップ12555953
Ref: library/optparse cleanup12556107
Ref: 369c12556107
Ref: library/optparse optparse-cleanup12556107
Ref: 369d12556107
Node: その他のメソッド12556735
Ref: library/optparse optparse-other-methods12556853
Ref: 369e12556853
Ref: library/optparse other-methods12556853
Ref: 369f12556853
Ref: library/optparse optparse OptionParser set_usage12557007
Ref: 36a012557007
Ref: library/optparse optparse OptionParser print_usage12557411
Ref: 367512557411
Ref: library/optparse optparse OptionParser get_usage12557818
Ref: 36a112557818
Ref: library/optparse optparse OptionParser set_defaults12558008
Ref: 368a12558008
Node: オプション処理コールバック12559458
Ref: library/optparse option-callbacks12559641
Ref: 36a212559641
Ref: library/optparse optparse-option-callbacks12559641
Ref: 366a12559641
Node: callbackオプションの定義12561299
Ref: library/optparse defining-a-callback-option12561479
Ref: 36a312561479
Ref: library/optparse optparse-defining-callback-option12561479
Ref: 36a412561479
Node: コールバック関数はどのように呼び出されるか12563818
Ref: library/optparse how-callbacks-are-called12564052
Ref: 36a512564052
Ref: library/optparse optparse-how-callbacks-called12564052
Ref: 36a612564052
Node: コールバック中で例外を送出する12567220
Ref: library/optparse optparse-raising-errors-in-callback12567482
Ref: 36a712567482
Ref: library/optparse raising-errors-in-a-callback12567482
Ref: 36a812567482
Node: コールバックの例 1 ありふれたコールバック12567974
Ref: library/optparse callback-example-1-trivial-callback12568245
Ref: 36a912568245
Ref: library/optparse optparse-callback-example-112568245
Ref: 36aa12568245
Node: コールバックの例 2 オプションの順番をチェックする12568778
Ref: library/optparse callback-example-2-check-option-order12569086
Ref: 36ab12569086
Ref: library/optparse optparse-callback-example-212569086
Ref: 36ac12569086
Node: コールバックの例 3 オプションの順番をチェックする 汎用的12569742
Ref: library/optparse callback-example-3-check-option-order-generalized12570053
Ref: 36ad12570053
Ref: library/optparse optparse-callback-example-312570053
Ref: 36ae12570053
Node: コールバックの例 4 任意の条件をチェックする12570993
Ref: library/optparse callback-example-4-check-arbitrary-condition12571270
Ref: 36af12571270
Ref: library/optparse optparse-callback-example-412571270
Ref: 36b012571270
Node: コールバックの例5 固定引数12572174
Ref: library/optparse callback-example-5-fixed-arguments12572413
Ref: 36b112572413
Ref: library/optparse optparse-callback-example-512572413
Ref: 36b212572413
Node: コールバックの例6 可変個の引数12573647
Ref: library/optparse callback-example-6-variable-arguments12573814
Ref: 36b312573814
Ref: library/optparse optparse-callback-example-612573814
Ref: 36b412573814
Node: Extending optparse12576057
Ref: library/optparse extending-optparse12576223
Ref: 36b512576223
Ref: library/optparse optparse-extending-optparse12576223
Ref: 366112576223
Node: 新しい型の追加12576575
Ref: library/optparse adding-new-types12576693
Ref: 36b612576693
Ref: library/optparse optparse-adding-new-types12576693
Ref: 36b712576693
Ref: library/optparse optparse Option TYPES12576978
Ref: 36b812576978
Ref: library/optparse optparse Option TYPE_CHECKER12577223
Ref: 36b912577223
Node: 新しいアクションの追加12580673
Ref: library/optparse adding-new-actions12580791
Ref: 36ba12580791
Ref: library/optparse optparse-adding-new-actions12580791
Ref: 36bb12580791
Ref: library/optparse optparse Option ACTIONS12582207
Ref: 36bc12582207
Ref: library/optparse optparse Option STORE_ACTIONS12582335
Ref: 36bd12582335
Ref: library/optparse optparse Option TYPED_ACTIONS12582441
Ref: 36be12582441
Ref: library/optparse optparse Option ALWAYS_TYPED_ACTIONS12582547
Ref: 36bf12582547
Node: 例外<13>12586365
Ref: library/optparse exceptions12586483
Ref: 36c012586483
Ref: library/optparse optparse OptionError12586516
Ref: 364a12586516
Ref: library/optparse optparse OptionConflictError12586654
Ref: 369b12586654
Ref: library/optparse optparse OptionValueError12586779
Ref: 364b12586779
Ref: library/optparse optparse BadOptionError12586899
Ref: 36c112586899
Ref: library/optparse optparse AmbiguousOptionError12587001
Ref: 36c212587001
Node: getpass --- 可搬性のあるパスワード入力機構12587111
Ref: library/getpass doc12587404
Ref: 36c312587404
Ref: library/getpass getpass-portable-password-input12587404
Ref: 36c412587404
Ref: library/getpass module-getpass12587404
Ref: 6512587404
Ref: library/getpass translation-repo12587404
Ref: 36c512587404
Ref: library/getpass getpass getpass12587900
Ref: 4b212587900
Ref: library/getpass getpass GetPassWarning12590525
Ref: 36c612590525
Ref: library/getpass getpass getuser12590689
Ref: 84e12590689
Ref: getpass --- 可搬性のあるパスワード入力機構-Footnote-112591505
Ref: getpass --- 可搬性のあるパスワード入力機構-Footnote-212591572
Node: fileinput --- 複数の入力ストリームをまたいだ行を反復する12591652
Ref: library/fileinput doc12591954
Ref: 36c712591954
Ref: library/fileinput fileinput-iterate-over-lines-from-multiple-input-streams12591954
Ref: 36c812591954
Ref: library/fileinput module-fileinput12591954
Ref: 5e12591954
Ref: library/fileinput translation-repo12591954
Ref: 36c912591954
Ref: library/fileinput fileinput input12595038
Ref: bdd12595038
Ref: library/fileinput fileinput filename12596547
Ref: 36ca12596547
Ref: library/fileinput fileinput fileno12596720
Ref: 17e612596720
Ref: library/fileinput fileinput lineno12596993
Ref: 36cb12596993
Ref: library/fileinput fileinput filelineno12597289
Ref: 36cc12597289
Ref: library/fileinput fileinput isfirstline12597592
Ref: 36cd12597592
Ref: library/fileinput fileinput isstdin12597773
Ref: 36ce12597773
Ref: library/fileinput fileinput nextfile12597973
Ref: 36cf12597973
Ref: library/fileinput fileinput close12598734
Ref: 36d012598734
Ref: library/fileinput fileinput FileInput12598942
Ref: b2312598942
Ref: library/fileinput fileinput hook_compressed12602578
Ref: bde12602578
Ref: library/fileinput fileinput hook_encoded12603493
Ref: 106512603493
Ref: fileinput --- 複数の入力ストリームをまたいだ行を反復する-Footnote-112604177
Node: curses --- 文字セル表示のターミナル処理12604246
Ref: library/curses doc12604547
Ref: 36d112604547
Ref: library/curses curses-terminal-handling-for-character-cell-displays12604547
Ref: 36d212604547
Ref: library/curses module-curses12604547
Ref: 2e12604547
Ref: library/curses translation-repo12604547
Ref: 36d312604547
Ref: curses --- 文字セル表示のターミナル処理-Footnote-112606915
Node: 関数<6>12606978
Ref: library/curses curses-functions12607111
Ref: 36d512607111
Ref: library/curses functions12607111
Ref: 36d612607111
Ref: library/curses curses error12607200
Ref: 1a3612607200
Ref: library/curses curses assume_default_colors12607662
Ref: 49012607662
Ref: library/curses curses baudrate12608286
Ref: 1a3712608286
Ref: library/curses curses beep12608823
Ref: 36d812608823
Ref: library/curses curses can_change_color12608906
Ref: 36d912608906
Ref: library/curses curses cbreak12609100
Ref: 1a3812609100
Ref: library/curses curses color_content12609816
Ref: bd012609816
Ref: library/curses curses color_pair12610289
Ref: 36da12610289
Ref: library/curses curses curs_set12610677
Ref: 36de12610677
Ref: library/curses curses def_prog_mode12611262
Ref: 36df12611262
Ref: library/curses curses def_shell_mode12611673
Ref: 36e112611673
Ref: library/curses curses delay_output12612120
Ref: 36e312612120
Ref: library/curses curses doupdate12612225
Ref: 36e412612225
Ref: library/curses curses echo12613379
Ref: 1a3912613379
Ref: library/curses curses endwin12613574
Ref: 36e512613574
Ref: library/curses curses erasechar12613698
Ref: 36e612613698
Ref: library/curses curses filter12614060
Ref: 36e712614060
Ref: library/curses curses flash12614865
Ref: 36e812614865
Ref: library/curses curses flushinp12615171
Ref: 36e912615171
Ref: library/curses curses getmouse12615468
Ref: 36ea12615468
Ref: library/curses curses getsyx12616740
Ref: 36f412616740
Ref: library/curses curses getwin12616995
Ref: 36f512616995
Ref: library/curses curses has_colors12617251
Ref: 36f712617251
Ref: library/curses curses has_extended_color_support12617430
Ref: bd412617430
Ref: library/curses curses has_ic12617817
Ref: 36f812617817
Ref: library/curses curses has_il12618107
Ref: 36f912618107
Ref: library/curses curses has_key12618394
Ref: 36fa12618394
Ref: library/curses curses halfdelay12618572
Ref: 36fb12618572
Ref: library/curses curses init_color12619110
Ref: bd112619110
Ref: library/curses curses init_pair12619857
Ref: bd212619857
Ref: library/curses curses initscr12620657
Ref: 1a3b12620657
Ref: library/curses curses is_term_resized12621032
Ref: 36fd12621032
Ref: library/curses curses isendwin12621266
Ref: 36fe12621266
Ref: library/curses curses keyname12621494
Ref: 36ff12621494
Ref: library/curses curses killchar12622153
Ref: 370012622153
Ref: library/curses curses longname12622423
Ref: 1a3a12622423
Ref: library/curses curses meta12622770
Ref: 370112622770
Ref: library/curses curses mouseinterval12622977
Ref: 370212622977
Ref: library/curses curses mousemask12623319
Ref: 370312623319
Ref: library/curses curses napms12623902
Ref: 1b4912623902
Ref: library/curses curses newpad12623984
Ref: 370412623984
Ref: library/curses curses newwin12625305
Ref: 370512625305
Ref: library/curses curses nl12625695
Ref: 1a3c12625695
Ref: library/curses curses nocbreak12626010
Ref: 36fc12626010
Ref: library/curses curses noecho12626174
Ref: 370612626174
Ref: library/curses curses nonl12626303
Ref: 370712626303
Ref: library/curses curses noqiflush12626908
Ref: 370812626908
Ref: library/curses curses noraw12627387
Ref: 370912627387
Ref: library/curses curses pair_content12627545
Ref: bd312627545
Ref: library/curses curses pair_number12627790
Ref: 36dd12627790
Ref: library/curses curses putp12627976
Ref: 370a12627976
Ref: library/curses curses qiflush12628257
Ref: 370b12628257
Ref: library/curses curses raw12628563
Ref: 1a3d12628563
Ref: library/curses curses reset_prog_mode12628896
Ref: 36e012628896
Ref: library/curses curses reset_shell_mode12629078
Ref: 36e212629078
Ref: library/curses curses resetty12629260
Ref: 370c12629260
Ref: library/curses curses resize_term12629415
Ref: 1b6a12629415
Ref: library/curses curses resizeterm12630059
Ref: 1b6912630059
Ref: library/curses curses savetty12630367
Ref: 370d12630367
Ref: library/curses curses get_escdelay12630530
Ref: cc412630530
Ref: library/curses curses set_escdelay12630657
Ref: cc512630657
Ref: library/curses curses get_tabsize12630956
Ref: cc612630956
Ref: library/curses curses set_tabsize12631081
Ref: cc712631081
Ref: library/curses curses setsyx12631295
Ref: 370e12631295
Ref: library/curses curses setupterm12631526
Ref: 370f12631526
Ref: library/curses curses start_color12631989
Ref: 371012631989
Ref: library/curses curses termattrs12632760
Ref: 1a3e12632760
Ref: library/curses curses termname12633041
Ref: 1a3f12633041
Ref: library/curses curses tigetflag12633219
Ref: 371312633219
Ref: library/curses curses tigetnum12633567
Ref: 371412633567
Ref: library/curses curses tigetstr12633909
Ref: 371512633909
Ref: library/curses curses tparm12634216
Ref: 371612634216
Ref: library/curses curses typeahead12634684
Ref: 371712634684
Ref: library/curses curses unctrl12635433
Ref: 1a4012635433
Ref: library/curses curses ungetch12635715
Ref: 371812635715
Ref: library/curses curses update_lines_cols12636001
Ref: 11a712636001
Ref: library/curses curses unget_wch12636198
Ref: 145412636198
Ref: library/curses curses ungetmouse12636518
Ref: 371912636518
Ref: library/curses curses use_env12636722
Ref: 371a12636722
Ref: library/curses curses use_default_colors12637363
Ref: 49112637363
Ref: library/curses curses wrapper12637465
Ref: e4612637465
Node: Window オブジェクト12638519
Ref: library/curses curses-window-objects12638670
Ref: 1a4412638670
Ref: library/curses window-objects12638670
Ref: 371b12638670
Ref: library/curses curses window12638735
Ref: 145112638735
Ref: library/curses curses window addch12638913
Ref: 1a4512638913
Ref: library/curses curses window addnstr12639593
Ref: 1a4612639593
Ref: library/curses curses window addstr12639889
Ref: 1a4712639889
Ref: library/curses curses window attroff12640925
Ref: 371c12640925
Ref: library/curses curses window attron12641131
Ref: 371d12641131
Ref: library/curses curses window attrset12641272
Ref: 371e12641272
Ref: library/curses curses window bkgd12641447
Ref: 371f12641447
Ref: library/curses curses window bkgdset12641940
Ref: 372012641940
Ref: library/curses curses window border12642552
Ref: 1a4812642552
Ref: library/curses curses window box12644701
Ref: 1a4912644701
Ref: library/curses curses window chgat12644992
Ref: 1a4a12644992
Ref: library/curses curses window clear12645640
Ref: 372812645640
Ref: library/curses curses window clearok12645856
Ref: 372a12645856
Ref: library/curses curses window clrtobot12646022
Ref: 372b12646022
Ref: library/curses curses window clrtoeol12646252
Ref: 372c12646252
Ref: library/curses curses window cursyncup12646354
Ref: 372d12646354
Ref: library/curses curses window delch12646535
Ref: 372e12646535
Ref: library/curses curses window deleteln12646632
Ref: 372f12646632
Ref: library/curses curses window derwin12646788
Ref: 373012646788
Ref: library/curses curses window echochar12647268
Ref: 373212647268
Ref: library/curses curses window enclose12647457
Ref: 1ea612647457
Ref: library/curses curses window encoding12647979
Ref: 145212647979
Ref: library/curses curses window erase12648487
Ref: 372912648487
Ref: library/curses curses window getbegyx12648568
Ref: 373312648568
Ref: library/curses curses window getbkgd12648677
Ref: 1a4b12648677
Ref: library/curses curses window getch12648811
Ref: 1a5012648811
Ref: library/curses curses window get_wch12649272
Ref: 145312649272
Ref: library/curses curses window getkey12649629
Ref: 373412649629
Ref: library/curses curses window getmaxyx12650021
Ref: 373512650021
Ref: library/curses curses window getparyx12650152
Ref: 373612650152
Ref: library/curses curses window getstr12650395
Ref: 1a5412650395
Ref: library/curses curses window getyx12650773
Ref: 373712650773
Ref: library/curses curses window hline12650945
Ref: 373812650945
Ref: library/curses curses window idcok12651157
Ref: 373912651157
Ref: library/curses curses window idlok12651561
Ref: 373a12651561
Ref: library/curses curses window immedok12651755
Ref: 373b12651755
Ref: library/curses curses window inch12652269
Ref: 1a4c12652269
Ref: library/curses curses window insch12652469
Ref: 373c12652469
Ref: library/curses curses window insdelln12652702
Ref: 373d12652702
Ref: library/curses curses window insertln12653177
Ref: 373e12653177
Ref: library/curses curses window insnstr12653336
Ref: 1a4e12653336
Ref: library/curses curses window insstr12653918
Ref: 1a4d12653918
Ref: library/curses curses window instr12654378
Ref: 1a5312654378
Ref: library/curses curses window is_linetouched12654916
Ref: 373f12654916
Ref: library/curses curses window is_wintouched12655303
Ref: 374012655303
Ref: library/curses curses window keypad12655568
Ref: 374112655568
Ref: library/curses curses window leaveok12655839
Ref: 374212655839
Ref: library/curses curses window move12656286
Ref: 374312656286
Ref: library/curses curses window mvderwin12656397
Ref: 374412656397
Ref: library/curses curses window mvwin12656740
Ref: 374512656740
Ref: library/curses curses window nodelay12656882
Ref: 374612656882
Ref: library/curses curses window notimeout12657030
Ref: 374712657030
Ref: library/curses curses window noutrefresh12657384
Ref: 1a4212657384
Ref: library/curses curses window overlay12657777
Ref: 374812657777
Ref: library/curses curses window overwrite12658514
Ref: 374912658514
Ref: library/curses curses window putwin12659256
Ref: 36f612659256
Ref: library/curses curses window redrawln12659551
Ref: 374a12659551
Ref: library/curses curses window redrawwin12659820
Ref: 374b12659820
Ref: library/curses curses window refresh12660010
Ref: 1a4112660010
Ref: library/curses curses window resize12661243
Ref: 374c12661243
Ref: library/curses curses window scroll12661591
Ref: 374d12661591
Ref: library/curses curses window scrollok12661736
Ref: 374e12661736
Ref: library/curses curses window setscrreg12662376
Ref: 374f12662376
Ref: library/curses curses window standend12662573
Ref: 375012662573
Ref: library/curses curses window standout12662772
Ref: 375112662772
Ref: library/curses curses window subpad12662860
Ref: 375212662860
Ref: library/curses curses window subwin12663146
Ref: 373112663146
Ref: library/curses curses window syncdown12663571
Ref: 375312663571
Ref: library/curses curses window syncok12663922
Ref: 375412663922
Ref: library/curses curses window syncup12664121
Ref: 375512664121
Ref: library/curses curses window timeout12664287
Ref: 375612664287
Ref: library/curses curses window touchline12664899
Ref: 372712664899
Ref: library/curses curses window touchwin12665251
Ref: 375712665251
Ref: library/curses curses window untouchwin12665419
Ref: 375812665419
Ref: library/curses curses window vline12665628
Ref: 1d1c12665628
Ref: Window オブジェクト-Footnote-112665899
Node: 定数<6>12665942
Ref: library/curses constants12666075
Ref: 375912666075
Ref: library/curses curses ERR12666167
Ref: 375a12666167
Ref: library/curses curses OK12666350
Ref: 375b12666350
Ref: library/curses curses version12666531
Ref: 375c12666531
Ref: library/curses curses ncurses_version12666631
Ref: daf12666631
Ref: library/curses curses COLORS12667055
Ref: 371112667055
Ref: library/curses curses COLOR_PAIRS12667216
Ref: 371212667216
Ref: library/curses curses COLS12667387
Ref: 11a912667387
Ref: library/curses curses LINES12667653
Ref: 11a812667653
Ref: library/curses curses A_ALTCHARSET12668218
Ref: 375d12668218
Ref: library/curses curses A_BLINK12668327
Ref: 375e12668327
Ref: library/curses curses A_BOLD12668434
Ref: 375f12668434
Ref: library/curses curses A_DIM12668541
Ref: 376012668541
Ref: library/curses curses A_INVIS12668654
Ref: 376112668654
Ref: library/curses curses A_ITALIC12668755
Ref: 376212668755
Ref: library/curses curses A_NORMAL12668843
Ref: 36d712668843
Ref: library/curses curses A_PROTECT12668922
Ref: 376312668922
Ref: library/curses curses A_REVERSE12669000
Ref: 36dc12669000
Ref: library/curses curses A_STANDOUT12669162
Ref: 36db12669162
Ref: library/curses curses A_UNDERLINE12669241
Ref: 376412669241
Ref: library/curses curses A_HORIZONTAL12669320
Ref: 376512669320
Ref: library/curses curses A_LEFT12669418
Ref: 376612669418
Ref: library/curses curses A_LOW12669524
Ref: 376712669524
Ref: library/curses curses A_RIGHT12669632
Ref: 376812669632
Ref: library/curses curses A_TOP12669738
Ref: 376912669738
Ref: library/curses curses A_VERTICAL12669831
Ref: 376a12669831
Ref: library/curses curses A_ATTRIBUTES12670240
Ref: 376b12670240
Ref: library/curses curses A_CHARTEXT12670336
Ref: 376c12670336
Ref: library/curses curses A_COLOR12670448
Ref: 376d12670448
Ref: library/curses curses KEY_MIN12670916
Ref: 376e12670916
Ref: library/curses curses KEY_BREAK12671015
Ref: 376f12671015
Ref: library/curses curses KEY_DOWN12671146
Ref: 377012671146
Ref: library/curses curses KEY_UP12671249
Ref: 377112671249
Ref: library/curses curses KEY_LEFT12671356
Ref: 377212671356
Ref: library/curses curses KEY_RIGHT12671445
Ref: 377312671445
Ref: library/curses curses KEY_HOME12671536
Ref: 377412671536
Ref: library/curses curses KEY_BACKSPACE12671661
Ref: 377512671661
Ref: library/curses curses KEY_F012671797
Ref: 377612671797
Ref: library/curses curses KEY_Fn12671999
Ref: 377712671999
Ref: library/curses curses KEY_DL12672133
Ref: 377812672133
Ref: library/curses curses KEY_IL12672252
Ref: 377912672252
Ref: library/curses curses KEY_DC12672371
Ref: 377a12672371
Ref: library/curses curses KEY_IC12672493
Ref: 377b12672493
Ref: library/curses curses KEY_EIC12672644
Ref: 377c12672644
Ref: library/curses curses KEY_CLEAR12672761
Ref: 377d12672761
Ref: library/curses curses KEY_EOS12672854
Ref: 377e12672854
Ref: library/curses curses KEY_EOL12672977
Ref: 377f12672977
Ref: library/curses curses KEY_SF12673093
Ref: 378012673093
Ref: library/curses curses KEY_SR12673216
Ref: 378112673216
Ref: library/curses curses KEY_NPAGE12673341
Ref: 378212673341
Ref: library/curses curses KEY_PPAGE12673434
Ref: 378312673434
Ref: library/curses curses KEY_STAB12673543
Ref: 378412673543
Ref: library/curses curses KEY_CTAB12673651
Ref: 378512673651
Ref: library/curses curses KEY_CATAB12673749
Ref: 378612673749
Ref: library/curses curses KEY_ENTER12673848
Ref: 378712673848
Ref: library/curses curses KEY_SRESET12673959
Ref: 378812673959
Ref: library/curses curses KEY_RESET12674153
Ref: 378912674153
Ref: library/curses curses KEY_PRINT12674285
Ref: 378a12674285
Ref: library/curses curses KEY_LL12674379
Ref: 378b12674379
Ref: library/curses curses KEY_A112674527
Ref: 378c12674527
Ref: library/curses curses KEY_A312674653
Ref: 378d12674653
Ref: library/curses curses KEY_B212674779
Ref: 378e12674779
Ref: library/curses curses KEY_C112674905
Ref: 378f12674905
Ref: library/curses curses KEY_C312675031
Ref: 379012675031
Ref: library/curses curses KEY_BTAB12675159
Ref: 379112675159
Ref: library/curses curses KEY_BEG12675262
Ref: 379212675262
Ref: library/curses curses KEY_CANCEL12675355
Ref: 379312675355
Ref: library/curses curses KEY_CLOSE12675445
Ref: 379412675445
Ref: library/curses curses KEY_COMMAND12675528
Ref: 379512675528
Ref: library/curses curses KEY_COPY12675628
Ref: 379612675628
Ref: library/curses curses KEY_CREATE12675724
Ref: 379712675724
Ref: library/curses curses KEY_END12675820
Ref: 379812675820
Ref: library/curses curses KEY_EXIT12675929
Ref: 379912675929
Ref: library/curses curses KEY_FIND12676038
Ref: 379a12676038
Ref: library/curses curses KEY_HELP12676147
Ref: 379b12676147
Ref: library/curses curses KEY_MARK12676259
Ref: 379c12676259
Ref: library/curses curses KEY_MESSAGE12676355
Ref: 379d12676355
Ref: library/curses curses KEY_MOVE12676462
Ref: 379e12676462
Ref: library/curses curses KEY_NEXT12676571
Ref: 379f12676571
Ref: library/curses curses KEY_OPEN12676680
Ref: 37a012676680
Ref: library/curses curses KEY_OPTIONS12676773
Ref: 37a112676773
Ref: library/curses curses KEY_PREVIOUS12676854
Ref: 37a212676854
Ref: library/curses curses KEY_REDO12676949
Ref: 37a312676949
Ref: library/curses curses KEY_REFERENCE12677048
Ref: 37a412677048
Ref: library/curses curses KEY_REFRESH12677126
Ref: 37a512677126
Ref: library/curses curses KEY_REPLACE12677208
Ref: 37a612677208
Ref: library/curses curses KEY_RESTART12677290
Ref: 37a712677290
Ref: library/curses curses KEY_RESUME12677375
Ref: 37a812677375
Ref: library/curses curses KEY_SAVE12677472
Ref: 37a912677472
Ref: library/curses curses KEY_SBEG12677581
Ref: 37aa12677581
Ref: library/curses curses KEY_SCANCEL12677680
Ref: 37ab12677680
Ref: library/curses curses KEY_SCOMMAND12677768
Ref: 37ac12677768
Ref: library/curses curses KEY_SCOPY12677857
Ref: 37ad12677857
Ref: library/curses curses KEY_SCREATE12677943
Ref: 37ae12677943
Ref: library/curses curses KEY_SDC12678046
Ref: 37af12678046
Ref: library/curses curses KEY_SDL12678169
Ref: 37b012678169
Ref: library/curses curses KEY_SELECT12678277
Ref: 37b112678277
Ref: library/curses curses KEY_SEND12678374
Ref: 37b212678374
Ref: library/curses curses KEY_SEOL12678489
Ref: 37b312678489
Ref: library/curses curses KEY_SEXIT12678595
Ref: 37b412678595
Ref: library/curses curses KEY_SFIND12678681
Ref: 37b512678681
Ref: library/curses curses KEY_SHELP12678767
Ref: 37b612678767
Ref: library/curses curses KEY_SHOME12678853
Ref: 37b712678853
Ref: library/curses curses KEY_SIC12678954
Ref: 37b812678954
Ref: library/curses curses KEY_SLEFT12679056
Ref: 37b912679056
Ref: library/curses curses KEY_SMESSAGE12679148
Ref: 37ba12679148
Ref: library/curses curses KEY_SMOVE12679237
Ref: 37bb12679237
Ref: library/curses curses KEY_SNEXT12679323
Ref: 37bc12679323
Ref: library/curses curses KEY_SOPTIONS12679409
Ref: 37bd12679409
Ref: library/curses curses KEY_SPREVIOUS12679498
Ref: 37be12679498
Ref: library/curses curses KEY_SPRINT12679584
Ref: 37bf12679584
Ref: library/curses curses KEY_SREDO12679671
Ref: 37c012679671
Ref: library/curses curses KEY_SREPLACE12679757
Ref: 37c112679757
Ref: library/curses curses KEY_SRIGHT12679846
Ref: 37c212679846
Ref: library/curses curses KEY_SRSUME12679939
Ref: 37c312679939
Ref: library/curses curses KEY_SSAVE12680027
Ref: 37c412680027
Ref: library/curses curses KEY_SSUSPEND12680113
Ref: 37c512680113
Ref: library/curses curses KEY_SUNDO12680202
Ref: 37c612680202
Ref: library/curses curses KEY_SUSPEND12680288
Ref: 37c712680288
Ref: library/curses curses KEY_UNDO12680392
Ref: 37c812680392
Ref: library/curses curses KEY_MOUSE12680491
Ref: 36eb12680491
Ref: library/curses curses KEY_RESIZE12680584
Ref: 37c912680584
Ref: library/curses curses KEY_MAX12680695
Ref: 37ca12680695
Ref: library/curses curses-acs-codes12681879
Ref: 37cb12681879
Ref: library/curses curses ACS_BBSS12682543
Ref: 37cc12682543
Ref: library/curses curses ACS_BLOCK12682625
Ref: 37cd12682625
Ref: library/curses curses ACS_BOARD12682710
Ref: 37ce12682710
Ref: library/curses curses ACS_BSBS12682795
Ref: 37cf12682795
Ref: library/curses curses ACS_BSSB12682877
Ref: 37d012682877
Ref: library/curses curses ACS_BSSS12682959
Ref: 37d112682959
Ref: library/curses curses ACS_BTEE12683053
Ref: 37d212683053
Ref: library/curses curses ACS_BULLET12683138
Ref: 37d312683138
Ref: library/curses curses ACS_CKBOARD12683216
Ref: 37d412683216
Ref: library/curses curses ACS_DARROW12683322
Ref: 37d512683322
Ref: library/curses curses ACS_DEGREE12683401
Ref: 37d612683401
Ref: library/curses curses ACS_DIAMOND12683474
Ref: 37d712683474
Ref: library/curses curses ACS_GEQUAL12683556
Ref: 37d812683556
Ref: library/curses curses ACS_HLINE12683641
Ref: 372212683641
Ref: library/curses curses ACS_LANTERN12683714
Ref: 37d912683714
Ref: library/curses curses ACS_LARROW12683812
Ref: 37da12683812
Ref: library/curses curses ACS_LEQUAL12683891
Ref: 37db12683891
Ref: library/curses curses ACS_LLCORNER12683976
Ref: 372512683976
Ref: library/curses curses ACS_LRCORNER12684049
Ref: 372612684049
Ref: library/curses curses ACS_LTEE12684122
Ref: 37dc12684122
Ref: library/curses curses ACS_NEQUAL12684207
Ref: 37dd12684207
Ref: library/curses curses ACS_PI12684294
Ref: 37de12684294
Ref: library/curses curses ACS_PLMINUS12684385
Ref: 37df12684385
Ref: library/curses curses ACS_PLUS12684476
Ref: 37e012684476
Ref: library/curses curses ACS_RARROW12684558
Ref: 37e112684558
Ref: library/curses curses ACS_RTEE12684637
Ref: 37e212684637
Ref: library/curses curses ACS_S112684736
Ref: 37e312684736
Ref: library/curses curses ACS_S312684852
Ref: 37e412684852
Ref: library/curses curses ACS_S712684968
Ref: 37e512684968
Ref: library/curses curses ACS_S912685084
Ref: 37e612685084
Ref: library/curses curses ACS_SBBS12685186
Ref: 37e712685186
Ref: library/curses curses ACS_SBSB12685268
Ref: 37e812685268
Ref: library/curses curses ACS_SBSS12685350
Ref: 37e912685350
Ref: library/curses curses ACS_SSBB12685444
Ref: 37ea12685444
Ref: library/curses curses ACS_SSBS12685526
Ref: 37eb12685526
Ref: library/curses curses ACS_SSSB12685620
Ref: 37ec12685620
Ref: library/curses curses ACS_SSSS12685714
Ref: 37ed12685714
Ref: library/curses curses ACS_STERLING12685826
Ref: 37ee12685826
Ref: library/curses curses ACS_TTEE12685923
Ref: 37ef12685923
Ref: library/curses curses ACS_UARROW12686008
Ref: 37f012686008
Ref: library/curses curses ACS_ULCORNER12686087
Ref: 372312686087
Ref: library/curses curses ACS_URCORNER12686160
Ref: 372412686160
Ref: library/curses curses ACS_VLINE12686233
Ref: 372112686233
Ref: library/curses curses BUTTONn_PRESSED12686628
Ref: 36ec12686628
Ref: library/curses curses BUTTONn_RELEASED12686776
Ref: 36ed12686776
Ref: library/curses curses BUTTONn_CLICKED12686923
Ref: 36ee12686923
Ref: library/curses curses BUTTONn_DOUBLE_CLICKED12687047
Ref: 36ef12687047
Ref: library/curses curses BUTTONn_TRIPLE_CLICKED12687162
Ref: 36f012687162
Ref: library/curses curses BUTTON_SHIFT12687297
Ref: 36f112687297
Ref: library/curses curses BUTTON_CTRL12687460
Ref: 36f212687460
Ref: library/curses curses BUTTON_ALT12687625
Ref: 36f312687625
Ref: library/curses curses COLOR_BLACK12688102
Ref: 37f112688102
Ref: library/curses curses COLOR_BLUE12688171
Ref: 37f212688171
Ref: library/curses curses COLOR_CYAN12688240
Ref: 37f312688240
Ref: library/curses curses COLOR_GREEN12688342
Ref: 37f412688342
Ref: library/curses curses COLOR_MAGENTA12688411
Ref: 37f512688411
Ref: library/curses curses COLOR_RED12688510
Ref: 37f612688510
Ref: library/curses curses COLOR_WHITE12688579
Ref: 37f712688579
Ref: library/curses curses COLOR_YELLOW12688648
Ref: 37f812688648
Node: curses textpad --- Text input widget for curses programs12688706
Ref: library/curses curses-textpad-text-input-widget-for-curses-programs12688986
Ref: 37f912688986
Ref: library/curses module-curses textpad12688986
Ref: 3112688986
Ref: library/curses curses textpad rectangle12689565
Ref: 37fb12689565
Node: Textbox オブジェクト12690422
Ref: library/curses curses-textpad-objects12690541
Ref: 37fc12690541
Ref: library/curses textbox-objects12690541
Ref: 37fd12690541
Ref: library/curses curses textpad Textbox12690724
Ref: 37fa12690724
Ref: library/curses curses textpad Textbox edit12691399
Ref: 37ff12691399
Ref: library/curses curses textpad Textbox do_command12692203
Ref: 380012692203
Ref: library/curses curses textpad Textbox gather12696601
Ref: 380112696601
Ref: library/curses curses textpad Textbox stripspaces12696853
Ref: 37fe12696853
Node: curses ascii --- ASCII 文字のユーティリティー12697397
Ref: library/curses ascii doc12697687
Ref: 380212697687
Ref: library/curses ascii curses-ascii-utilities-for-ascii-characters12697687
Ref: 380312697687
Ref: library/curses ascii module-curses ascii12697687
Ref: 2f12697687
Ref: library/curses ascii translation-repo12697687
Ref: 380412697687
Ref: library/curses ascii curses ascii NUL12698295
Ref: 380512698295
Ref: library/curses ascii curses ascii SOH12698338
Ref: 380612698338
Ref: library/curses ascii curses ascii STX12698441
Ref: 380712698441
Ref: library/curses ascii curses ascii ETX12698511
Ref: 380812698511
Ref: library/curses ascii curses ascii EOT12698581
Ref: 380912698581
Ref: library/curses ascii curses ascii ENQ12698657
Ref: 380a12698657
Ref: library/curses ascii curses ascii ACK12698772
Ref: 380b12698772
Ref: library/curses ascii curses ascii BEL12698836
Ref: 380c12698836
Ref: library/curses ascii curses ascii BS12698894
Ref: 380d12698894
Ref: library/curses ascii curses ascii TAB12698960
Ref: 380e12698960
Ref: library/curses ascii curses ascii HT12699018
Ref: 380f12699018
Ref: library/curses ascii curses ascii LF12699111
Ref: 381012699111
Ref: library/curses ascii curses ascii NL12699168
Ref: 381112699168
Ref: library/curses ascii curses ascii VT12699254
Ref: 381212699254
Ref: library/curses ascii curses ascii FF12699317
Ref: 381312699317
Ref: library/curses ascii curses ascii CR12699374
Ref: 381412699374
Ref: library/curses ascii curses ascii SO12699431
Ref: 381512699431
Ref: library/curses ascii curses ascii SI12699533
Ref: 381612699533
Ref: library/curses ascii curses ascii DLE12699635
Ref: 381712699635
Ref: library/curses ascii curses ascii DC112699726
Ref: 381812699726
Ref: library/curses ascii curses ascii DC212699826
Ref: 381912699826
Ref: library/curses ascii curses ascii DC312699931
Ref: 381a12699931
Ref: library/curses ascii curses ascii DC412700032
Ref: 381b12700032
Ref: library/curses ascii curses ascii NAK12700098
Ref: 381c12700098
Ref: library/curses ascii curses ascii SYN12700162
Ref: 381d12700162
Ref: library/curses ascii curses ascii ETB12700226
Ref: 381e12700226
Ref: library/curses ascii curses ascii CAN12700302
Ref: 381f12700302
Ref: library/curses ascii curses ascii EM12700378
Ref: 382012700378
Ref: library/curses ascii curses ascii SUB12700441
Ref: 382112700441
Ref: library/curses ascii curses ascii ESC12700505
Ref: 382212700505
Ref: library/curses ascii curses ascii FS12700578
Ref: 382312700578
Ref: library/curses ascii curses ascii GS12700656
Ref: 382412700656
Ref: library/curses ascii curses ascii RS12700734
Ref: 382512700734
Ref: library/curses ascii curses ascii US12700845
Ref: 382612700845
Ref: library/curses ascii curses ascii SP12700917
Ref: 382712700917
Ref: library/curses ascii curses ascii DEL12700980
Ref: 382812700980
Ref: library/curses ascii curses ascii isalnum12701443
Ref: 382912701443
Ref: library/curses ascii curses ascii isalpha12701593
Ref: 382a12701593
Ref: library/curses ascii curses ascii isascii12701757
Ref: 382b12701757
Ref: library/curses ascii curses ascii isblank12701884
Ref: 382c12701884
Ref: library/curses ascii curses ascii iscntrl12702022
Ref: 382d12702022
Ref: library/curses ascii curses ascii isdigit12702168
Ref: 382e12702168
Ref: library/curses ascii curses ascii isgraph12702371
Ref: 382f12702371
Ref: library/curses ascii curses ascii islower12702489
Ref: 383012702489
Ref: library/curses ascii curses ascii isprint12702582
Ref: 383112702582
Ref: library/curses ascii curses ascii ispunct12702708
Ref: 383212702708
Ref: library/curses ascii curses ascii isspace12702844
Ref: 383312702844
Ref: library/curses ascii curses ascii isupper12703024
Ref: 383412703024
Ref: library/curses ascii curses ascii isxdigit12703117
Ref: 383512703117
Ref: library/curses ascii curses ascii isctrl12703266
Ref: 383612703266
Ref: library/curses ascii curses ascii ismeta12703389
Ref: 383712703389
Ref: library/curses ascii curses ascii ascii12704166
Ref: 383812704166
Ref: library/curses ascii curses ascii ctrl12704285
Ref: 383912704285
Ref: library/curses ascii curses ascii alt12704449
Ref: 383a12704449
Ref: library/curses ascii curses ascii unctrl12704738
Ref: 383b12704738
Ref: library/curses ascii curses ascii controlnames12705424
Ref: 383c12705424
Ref: curses ascii --- ASCII 文字のユーティリティー-Footnote-112705699
Node: curses panel --- curses のためのパネルスタック拡張12705771
Ref: library/curses panel doc12706076
Ref: 383d12706076
Ref: library/curses panel curses-panel-a-panel-stack-extension-for-curses12706076
Ref: 383e12706076
Ref: library/curses panel module-curses panel12706076
Ref: 3012706076
Ref: library/curses panel translation-repo12706076
Ref: 383f12706076
Node: 関数<7>12706717
Ref: library/curses panel cursespanel-functions12706859
Ref: 384012706859
Ref: library/curses panel functions12706859
Ref: 384112706859
Ref: library/curses panel curses panel bottom_panel12706954
Ref: 384212706954
Ref: library/curses panel curses panel new_panel12707069
Ref: 1a1b12707069
Ref: library/curses panel curses panel top_panel12707503
Ref: 384312707503
Ref: library/curses panel curses panel update_panels12707615
Ref: 384412707615
Node: Panel オブジェクト12707895
Ref: library/curses panel curses-panel-objects12708037
Ref: 384512708037
Ref: library/curses panel panel-objects12708037
Ref: 384612708037
Ref: library/curses panel curses panel Panel above12708516
Ref: 384712708516
Ref: library/curses panel curses panel Panel below12708617
Ref: 384812708617
Ref: library/curses panel curses panel Panel bottom12708718
Ref: 384912708718
Ref: library/curses panel curses panel Panel hidden12708823
Ref: 384a12708823
Ref: library/curses panel curses panel Panel hide12709005
Ref: 384b12709005
Ref: library/curses panel curses panel Panel move12709207
Ref: 384c12709207
Ref: library/curses panel curses panel Panel replace12709319
Ref: 384d12709319
Ref: library/curses panel curses panel Panel set_userptr12709444
Ref: 384e12709444
Ref: library/curses panel curses panel Panel show12709728
Ref: 384f12709728
Ref: library/curses panel curses panel Panel top12709825
Ref: 385012709825
Ref: library/curses panel curses panel Panel userptr12709927
Ref: 385112709927
Ref: library/curses panel curses panel Panel window12710065
Ref: 385212710065
Node: cmd --- 行指向のコマンドインタープリターのサポート12710197
Ref: library/cmd doc12710437
Ref: 385312710437
Ref: library/cmd cmd-support-for-line-oriented-command-interpreters12710437
Ref: 385412710437
Ref: library/cmd module-cmd12710437
Ref: 1a12710437
Ref: library/cmd translation-repo12710437
Ref: 385512710437
Ref: library/cmd cmd Cmd12711056
Ref: 1a9812711056
Ref: cmd --- 行指向のコマンドインタープリターのサポート-Footnote-112713011
Node: Cmdオブジェクト12713074
Ref: library/cmd cmd-objects12713222
Ref: 385712713222
Ref: library/cmd id112713222
Ref: 385812713222
Ref: library/cmd cmd Cmd cmdloop12713356
Ref: 385912713356
Ref: library/cmd cmd Cmd do_help12715681
Ref: 1c5212715681
Ref: library/cmd cmd Cmd onecmd12716220
Ref: 385c12716220
Ref: library/cmd cmd Cmd emptyline12716817
Ref: 385f12716817
Ref: library/cmd cmd Cmd default12717103
Ref: 385e12717103
Ref: library/cmd cmd Cmd completedefault12717388
Ref: 386012717388
Ref: library/cmd cmd Cmd columnize12717616
Ref: 1e1f12717616
Ref: library/cmd cmd Cmd precmd12717858
Ref: 385d12717858
Ref: library/cmd cmd Cmd postcmd12718515
Ref: 385b12718515
Ref: library/cmd cmd Cmd preloop12719218
Ref: 386112719218
Ref: library/cmd cmd Cmd postloop12719519
Ref: 386212719519
Ref: library/cmd cmd Cmd prompt12719947
Ref: 386312719947
Ref: library/cmd cmd Cmd identchars12720041
Ref: 386412720041
Ref: library/cmd cmd Cmd lastcmd12720157
Ref: 386512720157
Ref: library/cmd cmd Cmd cmdqueue12720237
Ref: 386612720237
Ref: library/cmd cmd Cmd intro12720590
Ref: 385a12720590
Ref: library/cmd cmd Cmd doc_header12720826
Ref: 386712720826
Ref: library/cmd cmd Cmd misc_header12720978
Ref: 386812720978
Ref: library/cmd cmd Cmd undoc_header12721197
Ref: 386912721197
Ref: library/cmd cmd Cmd ruler12721413
Ref: 386a12721413
Ref: library/cmd cmd Cmd use_rawinput12721663
Ref: 385612721663
Node: Cmd の例12722139
Ref: library/cmd cmd-example12722287
Ref: 386b12722287
Ref: library/cmd id212722287
Ref: 386c12722287
Node: 並行実行12727660
Ref: library/concurrency doc12727863
Ref: 386e12727863
Ref: library/concurrency concurrency12727863
Ref: 386f12727863
Ref: library/concurrency concurrent-execution12727863
Ref: 387012727863
Ref: library/concurrency translation-repo12727863
Ref: 387112727863
Node: threading --- スレッドベースの並列処理12729367
Ref: library/threading doc12729531
Ref: 387212729531
Ref: library/threading module-threading12729531
Ref: f612729531
Ref: library/threading threading-thread-based-parallelism12729531
Ref: 387312729531
Ref: threading --- スレッドベースの並列処理-Footnote-112730399
Node: はじめに<8>12730468
Ref: library/threading introduction12730613
Ref: 387412730613
Ref: はじめに<8>-Footnote-112733688
Node: GIL and performance considerations12733745
Ref: library/threading gil-and-performance-considerations12733920
Ref: 387512733920
Ref: GIL and performance considerations-Footnote-112734711
Node: リファレンス<2>12734753
Ref: library/threading reference12734978
Ref: 387612734978
Ref: library/threading threading active_count12735095
Ref: 34712735095
Ref: library/threading threading current_thread12735385
Ref: 34612735385
Ref: library/threading threading excepthook12735775
Ref: c2712735775
Ref: library/threading threading __excepthook__12737150
Ref: c2612737150
Ref: library/threading threading get_ident12737427
Ref: 151a12737427
Ref: library/threading threading get_native_id12737945
Ref: e0512737945
Ref: library/threading threading enumerate12738581
Ref: 1e7012738581
Ref: library/threading threading main_thread12739096
Ref: 138012739096
Ref: library/threading threading settrace12739355
Ref: c2412739355
Ref: library/threading threading settrace_all_threads12739612
Ref: 8dd12739612
Ref: library/threading threading gettrace12739967
Ref: c2212739967
Ref: library/threading threading setprofile12740124
Ref: c2512740124
Ref: library/threading threading setprofile_all_threads12740388
Ref: 8de12740388
Ref: library/threading threading getprofile12740750
Ref: c2312740750
Ref: library/threading threading stack_size12740923
Ref: 387712740923
Ref: library/threading threading TIMEOUT_MAX12742665
Ref: 387812742665
Node: Thread-local data12744299
Ref: library/threading thread-local-data12744397
Ref: 387912744397
Ref: library/threading threading local12747494
Ref: 1aa612747494
Node: Thread objects12747593
Ref: library/threading id112747712
Ref: 387a12747712
Ref: library/threading thread-objects12747712
Ref: 387b12747712
Ref: library/threading threading Thread12751595
Ref: 42712751595
Ref: library/threading threading Thread start12754223
Ref: 42912754223
Ref: library/threading threading Thread run12755079
Ref: e0412755079
Ref: library/threading meth-thread-join12756023
Ref: 387c12756023
Ref: library/threading threading Thread join12756023
Ref: 15a312756023
Ref: library/threading threading Thread name12757901
Ref: 34512757901
Ref: library/threading threading Thread getName12758762
Ref: 387e12758762
Ref: library/threading threading Thread setName12758796
Ref: 34412758796
Ref: library/threading threading Thread ident12759021
Ref: 33a612759021
Ref: library/threading threading Thread native_id12759507
Ref: e0612759507
Ref: library/threading threading Thread is_alive12760322
Ref: d1c12760322
Ref: library/threading threading Thread daemon12760754
Ref: 34312760754
Ref: library/threading threading Thread isDaemon12761547
Ref: 387f12761547
Ref: library/threading threading Thread setDaemon12761582
Ref: 34212761582
Node: Lock objects12761811
Ref: library/threading id212761926
Ref: 388012761926
Ref: library/threading lock-objects12761926
Ref: 388112761926
Ref: library/threading threading Lock12763972
Ref: 1a3012763972
Ref: library/threading threading Lock acquire12764531
Ref: a8c12764531
Ref: library/threading threading Lock release12766363
Ref: 167c12766363
Ref: library/threading threading Lock locked12767104
Ref: 388312767104
Node: RLock objects12767204
Ref: library/threading id312767322
Ref: 388412767322
Ref: library/threading rlock-objects12767322
Ref: 388512767322
Ref: library/threading threading RLock12768880
Ref: 2eb12768880
Ref: library/threading threading RLock acquire12769623
Ref: 122f12769623
Ref: library/threading threading RLock release12771760
Ref: 388612771760
Ref: library/threading threading RLock locked12772740
Ref: 1a5212772740
Node: Condition objects12772898
Ref: library/threading condition-objects12773021
Ref: 388712773021
Ref: library/threading id412773021
Ref: 388812773021
Ref: library/threading threading Condition12777059
Ref: 151512777059
Ref: library/threading threading Condition acquire12777834
Ref: 388912777834
Ref: library/threading threading Condition release12778097
Ref: 388a12778097
Ref: library/threading threading Condition locked12778326
Ref: 388c12778326
Ref: library/threading threading Condition wait12778484
Ref: 1e7c12778484
Ref: library/threading threading Condition wait_for12780516
Ref: 388b12780516
Ref: library/threading threading Condition notify12781823
Ref: 1d8312781823
Ref: library/threading threading Condition notify_all12783059
Ref: 34012783059
Node: Semaphore objects12783570
Ref: library/threading id512783697
Ref: 388d12783697
Ref: library/threading semaphore-objects12783697
Ref: 388e12783697
Ref: library/threading threading Semaphore12784583
Ref: 151612784583
Ref: library/threading threading Semaphore acquire12785513
Ref: 160d12785513
Ref: library/threading threading Semaphore release12787076
Ref: 388f12787076
Ref: library/threading threading BoundedSemaphore12787645
Ref: 151712787645
Node: Semaphore example12788421
Ref: library/threading semaphore-example12788544
Ref: 389012788544
Ref: library/threading semaphore-examples12788544
Ref: 389112788544
Node: Event objects12789566
Ref: library/threading event-objects12789685
Ref: 389212789685
Ref: library/threading id612789685
Ref: 389312789685
Ref: library/threading threading Event12790254
Ref: 151812790254
Ref: library/threading threading Event is_set12790867
Ref: 34112790867
Ref: library/threading threading Event set12791067
Ref: 389412791067
Ref: library/threading threading Event clear12791431
Ref: 389512791431
Ref: library/threading threading Event wait12791774
Ref: 16e012791774
Node: Timer objects12792536
Ref: library/threading id712792653
Ref: 389612792653
Ref: library/threading timer-objects12792653
Ref: 389712792653
Ref: library/threading threading Timer12793434
Ref: 151912793434
Ref: library/threading threading Timer cancel12793935
Ref: 389812793935
Node: Barrier objects12794175
Ref: library/threading barrier-objects12794270
Ref: 389912794270
Ref: library/threading threading Barrier12795391
Ref: 15a212795391
Ref: library/threading threading Barrier wait12795892
Ref: 389a12795892
Ref: library/threading threading Barrier reset12797361
Ref: 389b12797361
Ref: library/threading threading Barrier abort12797970
Ref: 389c12797970
Ref: library/threading threading Barrier parties12798684
Ref: 389d12798684
Ref: library/threading threading Barrier n_waiting12798788
Ref: 389e12798788
Ref: library/threading threading Barrier broken12798891
Ref: 389f12798891
Ref: library/threading threading BrokenBarrierError12799014
Ref: 15a412799014
Node: with 文でのロック・条件変数・セマフォの使い方12799241
Ref: library/threading using-locks-conditions-and-semaphores-in-the-with-statement12799456
Ref: 38a012799456
Ref: library/threading with-locks12799456
Ref: 388212799456
Node: Iterator synchronization12800351
Ref: library/threading iterator-synchronization12800536
Ref: 38a112800536
Ref: library/threading threading serialize_iterator12801619
Ref: 28a12801619
Ref: library/threading threading synchronized_iterator12803129
Ref: 28b12803129
Ref: library/threading threading concurrent_tee12804184
Ref: 28c12804184
Node: multiprocessing --- プロセスベースの並列処理12805866
Ref: library/multiprocessing doc12806133
Ref: 38a212806133
Ref: library/multiprocessing module-multiprocessing12806133
Ref: 9812806133
Ref: library/multiprocessing multiprocessing-process-based-parallelism12806133
Ref: 38a312806133
Ref: library/multiprocessing translation-repo12806133
Ref: 38a412806133
Ref: multiprocessing --- プロセスベースの並列処理-Footnote-112806787
Node: はじめに<9>12806860
Ref: library/multiprocessing introduction12806998
Ref: 38a512806998
Node: Process クラス12809081
Ref: library/multiprocessing the-process-class12809192
Ref: 38a612809192
Node: コンテキストと開始方式12810747
Ref: library/multiprocessing contexts-and-start-methods12810912
Ref: 38a812810912
Ref: library/multiprocessing multiprocessing-start-methods12810912
Ref: 47412810912
Ref: library/multiprocessing multiprocessing-start-method-spawn12811105
Ref: 47612811105
Ref: library/multiprocessing multiprocessing-start-method-fork12811726
Ref: 47512811726
Ref: library/multiprocessing multiprocessing-start-method-forkserver12812864
Ref: 47312812864
Ref: コンテキストと開始方式-Footnote-112817330
Ref: コンテキストと開始方式-Footnote-212817395
Node: プロセス間でのオブジェクト交換12817450
Ref: library/multiprocessing exchanging-objects-between-processes12817622
Ref: 38aa12817622
Node: プロセス間の同期12819874
Ref: library/multiprocessing synchronization-between-processes12820049
Ref: 38ac12820049
Node: プロセス間での状態の共有12820800
Ref: library/multiprocessing sharing-state-between-processes12820975
Ref: 38ad12820975
Node: ワーカープロセスのプールを使用12825252
Ref: library/multiprocessing using-a-pool-of-workers12825394
Ref: 38b512825394
Node: リファレンス<3>12829115
Ref: library/multiprocessing reference12829301
Ref: 38b612829301
Node: Global start method12829986
Ref: library/multiprocessing global-start-method12830098
Ref: 38b712830098
Ref: library/multiprocessing id112830098
Ref: 38b812830098
Node: Process クラスと例外12830715
Ref: library/multiprocessing process-and-exceptions12830869
Ref: 38b912830869
Ref: library/multiprocessing multiprocessing Process12830946
Ref: 4e512830946
Ref: library/multiprocessing multiprocessing Process run12834225
Ref: 38a912834225
Ref: library/multiprocessing multiprocessing Process start12835261
Ref: 174a12835261
Ref: library/multiprocessing multiprocessing Process join12835627
Ref: 174c12835627
Ref: library/multiprocessing multiprocessing Process name12836621
Ref: 38ba12836621
Ref: library/multiprocessing multiprocessing Process is_alive12837233
Ref: 174b12837233
Ref: library/multiprocessing multiprocessing Process daemon12837546
Ref: 38bb12837546
Ref: library/multiprocessing multiprocessing Process pid12838838
Ref: 38be12838838
Ref: library/multiprocessing multiprocessing Process exitcode12838987
Ref: 38bd12838987
Ref: library/multiprocessing multiprocessing Process authkey12839584
Ref: 38bf12839584
Ref: library/multiprocessing multiprocessing Process sentinel12840164
Ref: 14a212840164
Ref: library/multiprocessing multiprocessing Process interrupt12840826
Ref: 4e412840826
Ref: library/multiprocessing multiprocessing Process terminate12841731
Ref: 1a9f12841731
Ref: library/multiprocessing multiprocessing Process kill12842775
Ref: f1912842775
Ref: library/multiprocessing multiprocessing Process close12842939
Ref: f1812842939
Ref: library/multiprocessing multiprocessing ProcessError12844362
Ref: 38c112844362
Ref: library/multiprocessing multiprocessing BufferTooShort12844466
Ref: 38c212844466
Ref: library/multiprocessing multiprocessing AuthenticationError12844829
Ref: 38c312844829
Ref: library/multiprocessing multiprocessing TimeoutError12844942
Ref: 38c412844942
Ref: Process クラスと例外-Footnote-112845147
Node: パイプ Pipe とキュー Queue12845203
Ref: library/multiprocessing pipes-and-queues12845350
Ref: 38c512845350
Ref: library/multiprocessing multiprocessing Pipe12850473
Ref: 38ab12850473
Ref: library/multiprocessing multiprocessing Queue12851051
Ref: 1da412851051
Ref: library/multiprocessing multiprocessing Queue qsize12851940
Ref: 38d012851940
Ref: library/multiprocessing multiprocessing Queue empty12852315
Ref: 1b9a12852315
Ref: library/multiprocessing multiprocessing Queue full12852675
Ref: 38d112852675
Ref: library/multiprocessing multiprocessing Queue put12852947
Ref: 202a12852947
Ref: library/multiprocessing multiprocessing Queue put_nowait12853958
Ref: 38d212853958
Ref: library/multiprocessing multiprocessing Queue get12854051
Ref: 202b12854051
Ref: library/multiprocessing multiprocessing Queue get_nowait12854988
Ref: 38cd12854988
Ref: library/multiprocessing multiprocessing Queue close12855290
Ref: 1da512855290
Ref: library/multiprocessing multiprocessing Queue join_thread12855755
Ref: 38d312855755
Ref: library/multiprocessing multiprocessing Queue cancel_join_thread12856558
Ref: 38ce12856558
Ref: library/multiprocessing multiprocessing SimpleQueue12858137
Ref: ce712858137
Ref: library/multiprocessing multiprocessing SimpleQueue close12858435
Ref: ce812858435
Ref: library/multiprocessing multiprocessing SimpleQueue empty12858752
Ref: 1b9b12858752
Ref: library/multiprocessing multiprocessing SimpleQueue get12858990
Ref: 38d412858990
Ref: library/multiprocessing multiprocessing SimpleQueue put12859084
Ref: 38d512859084
Ref: library/multiprocessing multiprocessing JoinableQueue12859171
Ref: 38c612859171
Ref: library/multiprocessing multiprocessing JoinableQueue task_done12859557
Ref: 38c912859557
Ref: library/multiprocessing multiprocessing JoinableQueue join12860474
Ref: 38d612860474
Ref: パイプ Pipe とキュー Queue-Footnote-112861085
Node: その他<5>12861149
Ref: library/multiprocessing miscellaneous12861302
Ref: 38d712861302
Ref: library/multiprocessing multiprocessing active_children12861340
Ref: 38d812861340
Ref: library/multiprocessing multiprocessing cpu_count12861629
Ref: 131e12861629
Ref: library/multiprocessing multiprocessing current_process12862374
Ref: 38d912862374
Ref: library/multiprocessing multiprocessing parent_process12862610
Ref: 38da12862610
Ref: library/multiprocessing multiprocessing freeze_support12862880
Ref: 195412862880
Ref: library/multiprocessing multiprocessing get_all_start_methods12863953
Ref: 131812863953
Ref: library/multiprocessing multiprocessing get_context12864316
Ref: 4dd12864316
Ref: library/multiprocessing multiprocessing get_start_method12864966
Ref: 131912864966
Ref: library/multiprocessing multiprocessing set_executable12865794
Ref: 1dab12865794
Ref: library/multiprocessing multiprocessing set_forkserver_preload12866415
Ref: 198a12866415
Ref: library/multiprocessing multiprocessing set_start_method12867657
Ref: 4de12867657
Ref: その他<5>-Footnote-112868817
Node: Connection オブジェクト<2>12868882
Ref: library/multiprocessing connection-objects12869026
Ref: 38db12869026
Ref: library/multiprocessing multiprocessing connection Connection12869542
Ref: 14a112869542
Ref: library/multiprocessing multiprocessing connection Connection send12869596
Ref: 38dd12869596
Ref: library/multiprocessing multiprocessing connection Connection recv12870053
Ref: 38de12870053
Ref: library/multiprocessing multiprocessing connection Connection fileno12870426
Ref: 38df12870426
Ref: library/multiprocessing multiprocessing connection Connection close12870565
Ref: 38e012870565
Ref: library/multiprocessing multiprocessing connection Connection poll12870777
Ref: 38e112870777
Ref: library/multiprocessing multiprocessing connection Connection send_bytes12871428
Ref: 38e212871428
Ref: library/multiprocessing multiprocessing connection Connection recv_bytes12871918
Ref: 38e312871918
Ref: library/multiprocessing multiprocessing connection Connection recv_bytes_into12872749
Ref: 38e412872749
Ref: library/multiprocessing multiprocessing-recv-pickle-security12874650
Ref: 38e512874650
Node: 同期プリミティブ12875523
Ref: library/multiprocessing synchronization-primitives12875687
Ref: 38e612875687
Ref: library/multiprocessing multiprocessing Barrier12876211
Ref: 38b412876211
Ref: library/multiprocessing multiprocessing BoundedSemaphore12876535
Ref: 38b212876535
Ref: library/multiprocessing multiprocessing BoundedSemaphore locked12877065
Ref: 38e812877065
Ref: library/multiprocessing multiprocessing Condition12877374
Ref: 38b312877374
Ref: library/multiprocessing multiprocessing Event12877858
Ref: 1e1c12877858
Ref: library/multiprocessing multiprocessing Lock12878081
Ref: 1a9c12878081
Ref: library/multiprocessing multiprocessing Lock acquire12879362
Ref: 38e712879362
Ref: library/multiprocessing multiprocessing Lock release12881081
Ref: 38e912881081
Ref: library/multiprocessing multiprocessing Lock locked12881541
Ref: 1abd12881541
Ref: library/multiprocessing multiprocessing RLock12881699
Ref: 1a9d12881699
Ref: library/multiprocessing multiprocessing RLock acquire12882812
Ref: 38ea12882812
Ref: library/multiprocessing multiprocessing RLock release12885060
Ref: 38eb12885060
Ref: library/multiprocessing multiprocessing RLock locked12886446
Ref: 1abe12886446
Ref: library/multiprocessing multiprocessing Semaphore12886604
Ref: 38b112886604
Ref: library/multiprocessing multiprocessing Semaphore get_value12887117
Ref: 38ec12887117
Ref: library/multiprocessing multiprocessing Semaphore locked12887363
Ref: 38ed12887363
Ref: 同期プリミティブ-Footnote-112888295
Node: 共有 ctypes オブジェクト12888359
Ref: library/multiprocessing shared-ctypes-objects12888509
Ref: 38ee12888509
Ref: library/multiprocessing multiprocessing Value12888731
Ref: 38ae12888731
Ref: library/multiprocessing multiprocessing Array12890529
Ref: 38af12890529
Node: The multiprocessing sharedctypes module12892319
Ref: library/multiprocessing module-multiprocessing sharedctypes12892427
Ref: 9e12892427
Ref: library/multiprocessing the-multiprocessing-sharedctypes-module12892427
Ref: 38ef12892427
Ref: library/multiprocessing multiprocessing sharedctypes RawArray12893221
Ref: 1a5912893221
Ref: library/multiprocessing multiprocessing sharedctypes RawValue12894285
Ref: 1a5b12894285
Ref: library/multiprocessing multiprocessing sharedctypes Array12895301
Ref: 1a5812895301
Ref: library/multiprocessing multiprocessing sharedctypes Value12896405
Ref: 1a5a12896405
Ref: library/multiprocessing multiprocessing sharedctypes copy12897504
Ref: 38f012897504
Ref: library/multiprocessing multiprocessing sharedctypes synchronized12897702
Ref: 11e812897702
Node: マネージャー12901389
Ref: library/multiprocessing managers12901539
Ref: 38f112901539
Ref: library/multiprocessing multiprocessing-managers12901539
Ref: 38ca12901539
Ref: library/multiprocessing multiprocessing Manager12902055
Ref: 4e312902055
Ref: library/multiprocessing module-multiprocessing managers12902517
Ref: 9b12902517
Ref: library/multiprocessing multiprocessing managers BaseManager12902754
Ref: 38f212902754
Ref: library/multiprocessing multiprocessing managers BaseManager start12904550
Ref: 38f312904550
Ref: library/multiprocessing multiprocessing managers BaseManager get_server12904856
Ref: 38f512904856
Ref: library/multiprocessing multiprocessing managers BaseManager connect12905469
Ref: 38f712905469
Ref: library/multiprocessing multiprocessing managers BaseManager shutdown12905785
Ref: 38f412905785
Ref: library/multiprocessing multiprocessing managers BaseManager register12906111
Ref: 38f812906111
Ref: library/multiprocessing multiprocessing managers BaseManager address12909089
Ref: 38f612909089
Ref: library/multiprocessing multiprocessing managers SyncManager12909910
Ref: 1ad712909910
Ref: library/multiprocessing multiprocessing managers SyncManager Barrier12910391
Ref: 38fb12910391
Ref: library/multiprocessing multiprocessing managers SyncManager BoundedSemaphore12910620
Ref: 38fc12910620
Ref: library/multiprocessing multiprocessing managers SyncManager Condition12910813
Ref: 38fd12910813
Ref: library/multiprocessing multiprocessing managers SyncManager Event12911282
Ref: 38fe12911282
Ref: library/multiprocessing multiprocessing managers SyncManager Lock12911446
Ref: 175012911446
Ref: library/multiprocessing multiprocessing managers SyncManager Namespace12911608
Ref: 38ff12911608
Ref: library/multiprocessing multiprocessing managers SyncManager Queue12911770
Ref: 343312911770
Ref: library/multiprocessing multiprocessing managers SyncManager RLock12911939
Ref: 175112911939
Ref: library/multiprocessing multiprocessing managers SyncManager Semaphore12912102
Ref: 175212912102
Ref: library/multiprocessing multiprocessing managers SyncManager Array12912281
Ref: 390012912281
Ref: library/multiprocessing multiprocessing managers SyncManager Value12912404
Ref: 390112912404
Ref: library/multiprocessing multiprocessing managers SyncManager dict12912569
Ref: 390212912569
Ref: library/multiprocessing multiprocessing managers SyncManager list12912799
Ref: 390312912799
Ref: library/multiprocessing multiprocessing managers SyncManager set12912990
Ref: 4e212912990
Ref: library/multiprocessing multiprocessing managers Namespace12913573
Ref: 38b012913573
Node: カスタマイズされたマネージャー12914601
Ref: library/multiprocessing customized-managers12914755
Ref: 390412914755
Node: リモートマネージャーを使用する12915662
Ref: library/multiprocessing using-a-remote-manager12915816
Ref: 390512915816
Node: Proxy オブジェクト12918292
Ref: library/multiprocessing multiprocessing-proxy-objects12918431
Ref: 4df12918431
Ref: library/multiprocessing proxy-objects12918431
Ref: 390612918431
Ref: library/multiprocessing multiprocessing managers BaseProxy12922407
Ref: 38f912922407
Ref: library/multiprocessing multiprocessing managers BaseProxy _callmethod12922576
Ref: 38fa12922576
Ref: library/multiprocessing multiprocessing managers BaseProxy _getvalue12924342
Ref: 390712924342
Ref: library/multiprocessing multiprocessing managers BaseProxy __repr__12924515
Ref: 390812924515
Ref: library/multiprocessing multiprocessing managers BaseProxy __str__12924638
Ref: 390912924638
Node: クリーンアップ<2>12924803
Ref: library/multiprocessing cleanup12924888
Ref: 390a12924888
Node: プロセスプール12925367
Ref: library/multiprocessing module-multiprocessing pool12925521
Ref: 9c12925521
Ref: library/multiprocessing process-pools12925521
Ref: 390b12925521
Ref: library/multiprocessing multiprocessing pool Pool12925699
Ref: 131a12925699
Ref: library/multiprocessing multiprocessing pool Pool apply12929050
Ref: 174e12929050
Ref: library/multiprocessing multiprocessing pool Pool apply_async12929501
Ref: 174f12929501
Ref: library/multiprocessing multiprocessing pool Pool map12930648
Ref: 14a412930648
Ref: library/multiprocessing multiprocessing pool Pool map_async12931581
Ref: 14a512931581
Ref: library/multiprocessing multiprocessing pool Pool imap12932731
Ref: 390f12932731
Ref: library/multiprocessing multiprocessing pool Pool imap_unordered12933606
Ref: 391012933606
Ref: library/multiprocessing multiprocessing pool Pool starmap12933969
Ref: 14a612933969
Ref: library/multiprocessing multiprocessing pool Pool starmap_async12934415
Ref: 14a712934415
Ref: library/multiprocessing multiprocessing pool Pool close12934906
Ref: 390c12934906
Ref: library/multiprocessing multiprocessing pool Pool terminate12935124
Ref: 390d12935124
Ref: library/multiprocessing multiprocessing pool Pool join12935412
Ref: 391112935412
Ref: library/multiprocessing multiprocessing pool AsyncResult12936103
Ref: 390e12936103
Ref: library/multiprocessing multiprocessing pool AsyncResult get12936273
Ref: 391212936273
Ref: library/multiprocessing multiprocessing pool AsyncResult wait12936711
Ref: 391312936711
Ref: library/multiprocessing multiprocessing pool AsyncResult ready12936838
Ref: 391412936838
Ref: library/multiprocessing multiprocessing pool AsyncResult successful12936952
Ref: 391512936952
Node: リスナーとクライアント12938322
Ref: library/multiprocessing listeners-and-clients12938464
Ref: 391612938464
Ref: library/multiprocessing module-multiprocessing connection12938464
Ref: 9912938464
Ref: library/multiprocessing multiprocessing-listeners-clients12938464
Ref: 38dc12938464
Ref: library/multiprocessing multiprocessing connection deliver_challenge12939048
Ref: 391712939048
Ref: library/multiprocessing multiprocessing connection answer_challenge12939556
Ref: 391812939556
Ref: library/multiprocessing multiprocessing connection Client12939950
Ref: 391912939950
Ref: library/multiprocessing multiprocessing connection Listener12940810
Ref: 1c4a12940810
Ref: library/multiprocessing multiprocessing connection Listener accept12942937
Ref: 1c0712942937
Ref: library/multiprocessing multiprocessing connection Listener close12943286
Ref: 391b12943286
Ref: library/multiprocessing multiprocessing connection Listener address12943750
Ref: 391c12943750
Ref: library/multiprocessing multiprocessing connection Listener last_accepted12943857
Ref: 391d12943857
Ref: library/multiprocessing multiprocessing connection wait12944484
Ref: 14a012944484
Node: アドレスフォーマット12948849
Ref: library/multiprocessing address-formats12948949
Ref: 391e12948949
Ref: library/multiprocessing multiprocessing-address-formats12948949
Ref: 391a12948949
Node: 認証キー12949857
Ref: library/multiprocessing authentication-keys12949993
Ref: 391f12949993
Ref: library/multiprocessing multiprocessing-auth-keys12949993
Ref: 38c012949993
Node: ログ記録<2>12952159
Ref: library/multiprocessing logging12952294
Ref: 392012952294
Ref: library/multiprocessing multiprocessing get_logger12952661
Ref: 348d12952661
Ref: library/multiprocessing multiprocessing log_to_stderr12953235
Ref: 392112953235
Node: The multiprocessing dummy module12954505
Ref: library/multiprocessing module-multiprocessing dummy12954619
Ref: 9a12954619
Ref: library/multiprocessing the-multiprocessing-dummy-module12954619
Ref: 392212954619
Ref: library/multiprocessing multiprocessing pool ThreadPool12955129
Ref: 1ee912955129
Node: プログラミングガイドライン12956913
Ref: library/multiprocessing multiprocessing-programming12957097
Ref: 38a712957097
Ref: library/multiprocessing programming-guidelines12957097
Ref: 392312957097
Node: すべての開始方式について12957395
Ref: library/multiprocessing all-start-methods12957568
Ref: 392412957568
Ref: library/multiprocessing multiprocessing-programming-spawn12964736
Ref: 38bc12964736
Ref: すべての開始方式について-Footnote-112964773
Ref: すべての開始方式について-Footnote-212964837
Ref: すべての開始方式について-Footnote-312964901
Node: 開始方式が spawn および forkserver の場合12964965
Ref: library/multiprocessing multiprocessing-programming-forkserver12965138
Ref: 47712965138
Ref: library/multiprocessing the-spawn-and-forkserver-start-methods12965138
Ref: 392512965138
Ref: library/multiprocessing multiprocessing-safe-main-import12966054
Ref: 392612966054
Node: 使用例<21>12967562
Ref: library/multiprocessing examples12967716
Ref: 392712967716
Ref: library/multiprocessing multiprocessing-examples12967716
Ref: 38cf12967716
Node: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ12976735
Ref: library/multiprocessing shared_memory doc12976978
Ref: 392812976978
Ref: library/multiprocessing shared_memory module-multiprocessing shared_memory12976978
Ref: 9d12976978
Ref: library/multiprocessing shared_memory multiprocessing-shared-memory-shared-memory-for-direct-access-across-processes12976978
Ref: 392912976978
Ref: library/multiprocessing shared_memory translation-repo12976978
Ref: 392a12976978
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory12978670
Ref: 1c0012978670
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory close12981984
Ref: 392c12981984
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory unlink12982458
Ref: 392d12982458
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory buf12983070
Ref: 392e12983070
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory name12983159
Ref: 392f12983159
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory size12983270
Ref: 393012983270
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager12986360
Ref: 392b12986360
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager SharedMemory12987764
Ref: 393112987764
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager ShareableList12987922
Ref: 393212987922
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList12989783
Ref: 1f6b12989783
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList count12992283
Ref: 393312992283
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList index12992377
Ref: 393412992377
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList format12992533
Ref: 393512992533
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList shm12992687
Ref: 393612992687
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-112995278
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-212995368
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-312995395
Node: concurrent パッケージ12995451
Ref: library/concurrent doc12995682
Ref: 393712995682
Ref: library/concurrent the-concurrent-package12995682
Ref: 393812995682
Ref: library/concurrent translation-repo12995682
Ref: 393912995682
Node: concurrent futures --- 並列タスク実行12995950
Ref: library/concurrent futures doc12996156
Ref: 393a12996156
Ref: library/concurrent futures concurrent-futures-launching-parallel-tasks12996156
Ref: 393b12996156
Ref: library/concurrent futures module-concurrent futures12996156
Ref: 2412996156
Ref: library/concurrent futures translation-repo12996156
Ref: 393c12996156
Ref: concurrent futures --- 並列タスク実行-Footnote-112997629
Ref: concurrent futures --- 並列タスク実行-Footnote-212997715
Ref: concurrent futures --- 並列タスク実行-Footnote-312997802
Node: Executor オブジェクト12997893
Ref: library/concurrent futures executor-objects12998028
Ref: 393f12998028
Ref: library/concurrent futures concurrent futures Executor12998097
Ref: 393d12998097
Ref: library/concurrent futures concurrent futures Executor submit12998346
Ref: e4812998346
Ref: library/concurrent futures concurrent futures Executor map12998852
Ref: 47a12998852
Ref: library/concurrent futures concurrent futures Executor shutdown13000891
Ref: cc213000891
Node: ThreadPoolExecutor13003260
Ref: library/concurrent futures threadpoolexecutor13003427
Ref: 394013003427
Ref: library/concurrent futures concurrent futures ThreadPoolExecutor13004746
Ref: b2c13004746
Node: ThreadPoolExecutor の例13007359
Ref: library/concurrent futures id113007439
Ref: 394213007439
Ref: library/concurrent futures threadpoolexecutor-example13007439
Ref: 157113007439
Node: InterpreterPoolExecutor13008643
Ref: library/concurrent futures interpreterpoolexecutor13008802
Ref: 394313008802
Ref: library/concurrent futures concurrent futures InterpreterPoolExecutor13011516
Ref: 47113011516
Ref: InterpreterPoolExecutor-Footnote-113013504
Node: ProcessPoolExecutor13013546
Ref: library/concurrent futures processpoolexecutor13013712
Ref: 394513013712
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor13014932
Ref: 21113014932
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor terminate_workers13018756
Ref: 47813018756
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor kill_workers13019248
Ref: 47913019248
Ref: ProcessPoolExecutor-Footnote-113019802
Node: ProcessPoolExecutor の例13019858
Ref: library/concurrent futures id213019940
Ref: 394713019940
Ref: library/concurrent futures processpoolexecutor-example13019940
Ref: 157213019940
Node: Future オブジェクト13020842
Ref: library/concurrent futures future-objects13021009
Ref: 394813021009
Ref: library/concurrent futures concurrent futures Future13021296
Ref: 157013021296
Ref: library/concurrent futures concurrent futures Future cancel13021597
Ref: 394913021597
Ref: library/concurrent futures concurrent futures Future cancelled13021902
Ref: 394a13021902
Ref: library/concurrent futures concurrent futures Future running13022035
Ref: 394b13022035
Ref: library/concurrent futures concurrent futures Future done13022189
Ref: 394c13022189
Ref: library/concurrent futures concurrent futures Future result13022343
Ref: 394d13022343
Ref: library/concurrent futures concurrent futures Future exception13023149
Ref: 394e13023149
Ref: library/concurrent futures concurrent futures Future add_done_callback13023982
Ref: 394f13023982
Ref: library/concurrent futures concurrent futures Future set_running_or_notify_cancel13025151
Ref: 395013025151
Ref: library/concurrent futures concurrent futures Future set_result13026408
Ref: 395113026408
Ref: library/concurrent futures concurrent futures Future set_exception13026893
Ref: 395213026893
Node: モジュール関数<2>13027408
Ref: library/concurrent futures module-functions13027571
Ref: 395313027571
Ref: library/concurrent futures concurrent futures wait13027627
Ref: 1e1b13027627
Ref: library/concurrent futures concurrent futures FIRST_COMPLETED13029006
Ref: 395413029006
Ref: library/concurrent futures concurrent futures FIRST_EXCEPTION13029349
Ref: 395513029349
Ref: library/concurrent futures concurrent futures ALL_COMPLETED13029873
Ref: 395613029873
Ref: library/concurrent futures concurrent futures as_completed13030101
Ref: 1bf013030101
Ref: モジュール関数<2>-Footnote-113031110
Node: 例外クラス13031152
Ref: library/concurrent futures exception-classes13031281
Ref: 395713031281
Ref: library/concurrent futures concurrent futures CancelledError13031327
Ref: da313031327
Ref: library/concurrent futures concurrent futures TimeoutError13031445
Ref: 395813031445
Ref: library/concurrent futures concurrent futures BrokenExecutor13031734
Ref: 395913031734
Ref: library/concurrent futures concurrent futures InvalidStateError13031989
Ref: 1b8413031989
Ref: library/concurrent futures concurrent futures thread BrokenThreadPool13032170
Ref: 394113032170
Ref: library/concurrent futures concurrent futures interpreter BrokenInterpreterPool13032427
Ref: 395a13032427
Ref: library/concurrent futures concurrent futures process BrokenProcessPool13032702
Ref: 394613032702
Node: concurrent interpreters --- Multiple interpreters in the same process13033067
Ref: library/concurrent interpreters doc13033286
Ref: 395b13033286
Ref: library/concurrent interpreters concurrent-interpreters-multiple-interpreters-in-the-same-process13033286
Ref: 395c13033286
Ref: library/concurrent interpreters module-concurrent interpreters13033286
Ref: 2513033286
Ref: library/concurrent interpreters translation-repo13033286
Ref: 395d13033286
Ref: library/concurrent interpreters interp-concurrency13034198
Ref: 395e13034198
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-113034883
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-213034964
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-313035006
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-413035048
Node: Key details13035090
Ref: library/concurrent interpreters key-details13035232
Ref: 395f13035232
Ref: library/concurrent interpreters interp-isolation13035416
Ref: 396013035416
Node: はじめに<10>13035525
Ref: library/concurrent interpreters interpreters-intro13035697
Ref: 396113035697
Ref: library/concurrent interpreters introduction13035697
Ref: 396213035697
Node: Multiple Interpreters and Isolation13036547
Ref: library/concurrent interpreters multiple-interpreters-and-isolation13036669
Ref: 396313036669
Node: Running in an Interpreter13037643
Ref: library/concurrent interpreters running-in-an-interpreter13037801
Ref: 396413037801
Ref: library/concurrent interpreters interp-call-in-thread13038303
Ref: 396513038303
Node: Concurrency and Parallelism13038749
Ref: library/concurrent interpreters concurrency-and-parallelism13038906
Ref: 396613038906
Node: Communication Between Interpreters13040479
Ref: library/concurrent interpreters communication-between-interpreters13040628
Ref: 396713040628
Node: "Sharing" Objects13041089
Ref: library/concurrent interpreters interp-object-sharing13041202
Ref: 396913041202
Ref: library/concurrent interpreters sharing-objects13041202
Ref: 396a13041202
Node: リファレンス<4>13042229
Ref: library/concurrent interpreters reference13042414
Ref: 396c13042414
Ref: library/concurrent interpreters concurrent interpreters list_all13042531
Ref: 396d13042531
Ref: library/concurrent interpreters concurrent interpreters get_current13042692
Ref: 396f13042692
Ref: library/concurrent interpreters concurrent interpreters get_main13042839
Ref: 397013042839
Ref: library/concurrent interpreters concurrent interpreters create13043122
Ref: 1a1513043122
Ref: library/concurrent interpreters concurrent interpreters create_queue13043279
Ref: 396813043279
Node: Interpreter objects13043529
Ref: library/concurrent interpreters interpreter-objects13043625
Ref: 397113043625
Ref: library/concurrent interpreters concurrent interpreters Interpreter13043684
Ref: 396e13043684
Ref: library/concurrent interpreters concurrent interpreters Interpreter id13043936
Ref: 397213043936
Ref: library/concurrent interpreters concurrent interpreters Interpreter whence13044027
Ref: 397313044027
Ref: library/concurrent interpreters concurrent interpreters Interpreter is_running13044142
Ref: 397413044142
Ref: library/concurrent interpreters concurrent interpreters Interpreter close13044322
Ref: 19f313044322
Ref: library/concurrent interpreters concurrent interpreters Interpreter prepare_main13044404
Ref: 397513044404
Ref: library/concurrent interpreters concurrent interpreters Interpreter exec13044704
Ref: 397613044704
Ref: library/concurrent interpreters concurrent interpreters Interpreter call13044847
Ref: 397713044847
Ref: library/concurrent interpreters concurrent interpreters Interpreter call_in_thread13045028
Ref: 397813045028
Node: 例外<14>13045170
Ref: library/concurrent interpreters exceptions13045309
Ref: 397913045309
Ref: library/concurrent interpreters concurrent interpreters InterpreterError13045342
Ref: 397a13045342
Ref: library/concurrent interpreters concurrent interpreters InterpreterNotFoundError13045512
Ref: 397b13045512
Ref: library/concurrent interpreters concurrent interpreters ExecutionFailed13045703
Ref: 394413045703
Ref: library/concurrent interpreters concurrent interpreters ExecutionFailed excinfo13045889
Ref: 397c13045889
Ref: library/concurrent interpreters concurrent interpreters NotShareableError13046006
Ref: 397d13046006
Node: Communicating Between Interpreters13046188
Ref: library/concurrent interpreters communicating-between-interpreters13046299
Ref: 397e13046299
Ref: library/concurrent interpreters concurrent interpreters Queue13046390
Ref: 396b13046390
Ref: library/concurrent interpreters concurrent interpreters Queue id13046807
Ref: 397f13046807
Ref: library/concurrent interpreters concurrent interpreters QueueEmptyError13046881
Ref: 398013046881
Ref: library/concurrent interpreters concurrent interpreters QueueFullError13047092
Ref: 398113047092
Node: 基本的な使い方<3>13047295
Ref: library/concurrent interpreters basic-usage13047455
Ref: 398213047455
Node: subprocess --- サブプロセス管理13048123
Ref: library/subprocess doc13048341
Ref: 398313048341
Ref: library/subprocess module-subprocess13048341
Ref: df13048341
Ref: library/subprocess subprocess-subprocess-management13048341
Ref: 398413048341
Ref: library/subprocess translation-repo13048341
Ref: 398513048341
Ref: subprocess --- サブプロセス管理-Footnote-113049599
Ref: subprocess --- サブプロセス管理-Footnote-213049669
Node: Using the subprocess Module13049711
Ref: library/subprocess using-the-subprocess-module13049865
Ref: 398613049865
Ref: library/subprocess subprocess run13050228
Ref: f4913050228
Ref: library/subprocess subprocess CompletedProcess13055625
Ref: 122713055625
Ref: library/subprocess subprocess CompletedProcess args13055760
Ref: 398913055760
Ref: library/subprocess subprocess CompletedProcess returncode13055925
Ref: 398a13055925
Ref: library/subprocess subprocess CompletedProcess stdout13056268
Ref: 398b13056268
Ref: library/subprocess subprocess CompletedProcess stderr13056898
Ref: 398c13056898
Ref: library/subprocess subprocess CompletedProcess check_returncode13057293
Ref: 398d13057293
Ref: library/subprocess subprocess DEVNULL13057491
Ref: 150e13057491
Ref: library/subprocess subprocess PIPE13057756
Ref: f4a13057756
Ref: library/subprocess subprocess STDOUT13058036
Ref: 398813058036
Ref: library/subprocess subprocess SubprocessError13058258
Ref: 398e13058258
Ref: library/subprocess subprocess TimeoutExpired13058417
Ref: 19cc13058417
Ref: library/subprocess subprocess TimeoutExpired cmd13058639
Ref: 398f13058639
Ref: library/subprocess subprocess TimeoutExpired timeout13058739
Ref: 399013058739
Ref: library/subprocess subprocess TimeoutExpired output13058807
Ref: 399113058807
Ref: library/subprocess subprocess TimeoutExpired stdout13059297
Ref: 399213059297
Ref: library/subprocess subprocess TimeoutExpired stderr13059400
Ref: 399313059400
Ref: library/subprocess subprocess CalledProcessError13060035
Ref: 16de13060035
Ref: library/subprocess subprocess CalledProcessError returncode13060400
Ref: 399513060400
Ref: library/subprocess subprocess CalledProcessError cmd13060620
Ref: 399613060620
Ref: library/subprocess subprocess CalledProcessError output13060720
Ref: 399713060720
Ref: library/subprocess subprocess CalledProcessError stdout13060949
Ref: 399813060949
Ref: library/subprocess subprocess CalledProcessError stderr13061052
Ref: 399913061052
Node: よく使われる引数13061449
Ref: library/subprocess frequently-used-arguments13061576
Ref: 398713061576
Ref: library/subprocess id113061576
Ref: 399a13061576
Node: Popen コンストラクター13066491
Ref: library/subprocess popen-constructor13066637
Ref: 399f13066637
Ref: library/subprocess subprocess Popen13067031
Ref: 6c513067031
Ref: Popen コンストラクター-Footnote-113087346
Node: 例外<15>13087406
Ref: library/subprocess exceptions13087519
Ref: 39b013087519
Node: セキュリティで考慮すべき点<2>13088872
Ref: library/subprocess security-considerations13089059
Ref: 399e13089059
Ref: library/subprocess subprocess-security13089059
Ref: 39b113089059
Ref: セキュリティで考慮すべき点<2>-Footnote-113090192
Ref: セキュリティで考慮すべき点<2>-Footnote-213090262
Node: Popen オブジェクト13090318
Ref: library/subprocess popen-objects13090504
Ref: 39b313090504
Ref: library/subprocess subprocess Popen poll13090673
Ref: 39b413090673
Ref: library/subprocess subprocess Popen wait13090895
Ref: 27213090895
Ref: library/subprocess subprocess Popen communicate13092676
Ref: 19cb13092676
Ref: library/subprocess subprocess Popen send_signal13095165
Ref: 179713095165
Ref: library/subprocess subprocess Popen terminate13095588
Ref: 179513095588
Ref: library/subprocess subprocess Popen kill13095813
Ref: 179613095813
Ref: library/subprocess subprocess Popen args13096174
Ref: 39b513096174
Ref: library/subprocess subprocess Popen stdin13096382
Ref: 399b13096382
Ref: library/subprocess subprocess Popen stdout13096818
Ref: 399c13096818
Ref: library/subprocess subprocess Popen stderr13097326
Ref: 399d13097326
Ref: library/subprocess subprocess Popen pid13098189
Ref: 39b613098189
Ref: library/subprocess subprocess Popen returncode13098403
Ref: e5613098403
Node: Windows Popen ヘルパー13099208
Ref: library/subprocess windows-popen-helpers13099371
Ref: 39b713099371
Ref: library/subprocess subprocess STARTUPINFO13099539
Ref: 39a313099539
Ref: library/subprocess subprocess STARTUPINFO dwFlags13100004
Ref: 39b813100004
Ref: library/subprocess subprocess STARTUPINFO hStdInput13100361
Ref: 39b913100361
Ref: library/subprocess subprocess STARTUPINFO hStdOutput13100703
Ref: 39bb13100703
Ref: library/subprocess subprocess STARTUPINFO hStdError13101061
Ref: 39bc13101061
Ref: library/subprocess subprocess STARTUPINFO wShowWindow13101430
Ref: 39bd13101430
Ref: library/subprocess subprocess STARTUPINFO lpAttributeList13102000
Ref: fd113102000
Ref: Windows Popen ヘルパー-Footnote-113103256
Ref: Windows Popen ヘルパー-Footnote-213103328
Ref: Windows Popen ヘルパー-Footnote-313103400
Node: Windows Constants13103489
Ref: library/subprocess windows-constants13103569
Ref: 39c013103569
Ref: library/subprocess subprocess STD_INPUT_HANDLE13103686
Ref: 39c113103686
Ref: library/subprocess subprocess STD_OUTPUT_HANDLE13103855
Ref: 39c213103855
Ref: library/subprocess subprocess STD_ERROR_HANDLE13104039
Ref: 39c313104039
Ref: library/subprocess subprocess SW_HIDE13104225
Ref: 39bf13104225
Ref: library/subprocess subprocess STARTF_USESTDHANDLES13104357
Ref: 39ba13104357
Ref: library/subprocess subprocess STARTF_USESHOWWINDOW13104595
Ref: 39be13104595
Ref: library/subprocess subprocess STARTF_FORCEONFEEDBACK13104751
Ref: 39c413104751
Ref: library/subprocess subprocess STARTF_FORCEOFFFEEDBACK13105050
Ref: 39c513105050
Ref: library/subprocess subprocess CREATE_NEW_CONSOLE13105265
Ref: 39a413105265
Ref: library/subprocess subprocess CREATE_NEW_PROCESS_GROUP13105478
Ref: 39a513105478
Ref: library/subprocess subprocess ABOVE_NORMAL_PRIORITY_CLASS13105895
Ref: 39a613105895
Ref: library/subprocess subprocess BELOW_NORMAL_PRIORITY_CLASS13106106
Ref: 39a713106106
Ref: library/subprocess subprocess HIGH_PRIORITY_CLASS13106316
Ref: 39a813106316
Ref: library/subprocess subprocess IDLE_PRIORITY_CLASS13106509
Ref: 39a913106509
Ref: library/subprocess subprocess NORMAL_PRIORITY_CLASS13106712
Ref: 39aa13106712
Ref: library/subprocess subprocess REALTIME_PRIORITY_CLASS13106920
Ref: 39ab13106920
Ref: library/subprocess subprocess CREATE_NO_WINDOW13107457
Ref: 39ac13107457
Ref: library/subprocess subprocess DETACHED_PROCESS13107646
Ref: 39ad13107646
Ref: library/subprocess subprocess CREATE_DEFAULT_ERROR_MODE13107905
Ref: 39ae13107905
Ref: library/subprocess subprocess CREATE_BREAKAWAY_FROM_JOB13108312
Ref: 39af13108312
Node: 古い高水準 API13108516
Ref: library/subprocess call-function-trio13108707
Ref: 39c613108707
Ref: library/subprocess older-high-level-api13108707
Ref: 39c713108707
Ref: library/subprocess subprocess call13109076
Ref: f4b13109076
Ref: library/subprocess subprocess check_call13110859
Ref: 399413110859
Ref: library/subprocess subprocess check_output13112887
Ref: 137013112887
Node: Replacing Older Functions with the subprocess Module13115880
Ref: library/subprocess replacing-older-functions-with-the-subprocess-module13116087
Ref: 39c813116087
Ref: library/subprocess subprocess-replacements13116087
Ref: 154613116087
Node: Replacing /bin/sh shell command substitution13117366
Ref: library/subprocess replacing-bin-sh-shell-command-substitution13117556
Ref: 39c913117556
Node: シェルのパイプラインを置き換える13117793
Ref: library/subprocess replacing-shell-pipeline13118020
Ref: 39ca13118020
Node: os system を置き換える13118858
Ref: library/subprocess replacing-os-system13119077
Ref: 39cb13119077
Node: os spawn 関数群を置き換える13120064
Ref: library/subprocess replacing-the-os-spawn-family13120253
Ref: 39cc13120253
Node: Replacing os popen13120911
Ref: library/subprocess replacing-os-popen13121063
Ref: 39cd13121063
Node: レガシーなシェル呼び出し関数13121500
Ref: library/subprocess legacy-shell-invocation-functions13121697
Ref: 39ce13121697
Ref: library/subprocess subprocess getstatusoutput13122151
Ref: 137213122151
Ref: library/subprocess subprocess getoutput13123546
Ref: 137113123546
Node: 注釈<2>13124168
Ref: library/subprocess notes13124304
Ref: 39cf13124304
Node: Timeout Behavior13124501
Ref: library/subprocess subprocess-timeout-behavior13124640
Ref: 39d013124640
Ref: library/subprocess timeout-behavior13124640
Ref: 39d113124640
Node: Windows における引数シーケンスから文字列への変換13125427
Ref: library/subprocess converting-an-argument-sequence-to-a-string-on-windows13125601
Ref: 39d213125601
Ref: library/subprocess converting-argument-sequence13125601
Ref: 39a013125601
Node: Disable use of posix_spawn13127114
Ref: library/subprocess disable-posix-spawn13127263
Ref: 39d313127263
Ref: library/subprocess disable-use-of-posix-spawn13127263
Ref: 39d413127263
Node: sched --- イベントスケジューラー13128098
Ref: library/sched doc13128281
Ref: 39d513128281
Ref: library/sched module-sched13128281
Ref: c713128281
Ref: library/sched sched-event-scheduler13128281
Ref: 39d613128281
Ref: library/sched translation-repo13128281
Ref: 39d713128281
Ref: library/sched sched scheduler13128578
Ref: 14e813128578
Ref: sched --- イベントスケジューラー-Footnote-113131069
Node: スケジューラオブジェクト13131134
Ref: library/sched id113131250
Ref: 39d813131250
Ref: library/sched scheduler-objects13131250
Ref: 39d913131250
Ref: library/sched sched scheduler enterabs13131429
Ref: 14ea13131429
Ref: library/sched sched scheduler enter13132620
Ref: 14e913132620
Ref: library/sched sched scheduler cancel13133098
Ref: 1f0f13133098
Ref: library/sched sched scheduler empty13133353
Ref: 39da13133353
Ref: library/sched sched scheduler run13133473
Ref: 14e713133473
Ref: library/sched sched scheduler queue13134987
Ref: 39db13134987
Node: queue --- 同期キュークラス13135317
Ref: library/queue doc13135501
Ref: 39dc13135501
Ref: library/queue module-queue13135501
Ref: be13135501
Ref: library/queue queue-a-synchronized-queue-class13135501
Ref: 39dd13135501
Ref: library/queue translation-repo13135501
Ref: 39de13135501
Ref: library/queue queue Queue13137085
Ref: 174d13137085
Ref: library/queue queue LifoQueue13137491
Ref: 28ca13137491
Ref: library/queue queue PriorityQueue13137901
Ref: 28cb13137901
Ref: library/queue queue SimpleQueue13138988
Ref: f2b13138988
Ref: library/queue queue Empty13139168
Ref: 38cb13139168
Ref: library/queue queue Full13139400
Ref: 38cc13139400
Ref: library/queue queue ShutDown13139634
Ref: 74b13139634
Ref: queue --- 同期キュークラス-Footnote-113139945
Node: キューオブジェクト13140010
Ref: library/queue queue-objects13140147
Ref: 39e113140147
Ref: library/queue queueobjects13140147
Ref: 39e213140147
Ref: library/queue queue Queue qsize13140372
Ref: 39e313140372
Ref: library/queue queue Queue empty13140688
Ref: 39e413140688
Ref: library/queue queue Queue full13141121
Ref: 39e513141121
Ref: library/queue queue Queue put13141554
Ref: 39e013141554
Ref: library/queue queue Queue put_nowait13142425
Ref: 343113142425
Ref: library/queue queue Queue get13142522
Ref: 343213142522
Ref: library/queue queue Queue get_nowait13143792
Ref: 39df13143792
Ref: library/queue queue Queue task_done13144049
Ref: 38c713144049
Ref: library/queue queue Queue join13144851
Ref: 38c813144851
Node: Waiting for task completion13145521
Ref: library/queue waiting-for-task-completion13145639
Ref: 39e613145639
Node: Terminating queues13146296
Ref: library/queue terminating-queues13146414
Ref: 39e713146414
Ref: library/queue queue Queue shutdown13146600
Ref: 74a13146600
Node: SimpleQueue オブジェクト13148011
Ref: library/queue simplequeue-objects13148148
Ref: 39e813148148
Ref: library/queue queue SimpleQueue qsize13148325
Ref: 39e913148325
Ref: library/queue queue SimpleQueue empty13148601
Ref: 39ea13148601
Ref: library/queue queue SimpleQueue put13148894
Ref: 39eb13148894
Ref: library/queue queue SimpleQueue put_nowait13149659
Ref: 39ec13149659
Ref: library/queue queue SimpleQueue get13149847
Ref: 39ed13149847
Ref: library/queue queue SimpleQueue get_nowait13150662
Ref: 39ee13150662
Node: contextvars --- コンテキスト変数13151142
Ref: library/contextvars doc13151323
Ref: 39ef13151323
Ref: library/contextvars contextvars-context-variables13151323
Ref: 39f013151323
Ref: library/contextvars module-contextvars13151323
Ref: 2813151323
Ref: library/contextvars translation-repo13151323
Ref: 39f113151323
Ref: contextvars --- コンテキスト変数-Footnote-113152379
Node: コンテキスト変数13152421
Ref: library/contextvars context-variables13152576
Ref: 39f213152576
Ref: library/contextvars contextvars ContextVar13152639
Ref: 1abc13152639
Ref: library/contextvars contextvars ContextVar name13153591
Ref: 39f413153591
Ref: library/contextvars contextvars ContextVar get13153727
Ref: 39f313153727
Ref: library/contextvars contextvars ContextVar set13154351
Ref: 19ae13154351
Ref: library/contextvars contextvars ContextVar reset13155652
Ref: 39f513155652
Ref: library/contextvars contextvars Token13156243
Ref: 48013156243
Ref: library/contextvars contextvars Token var13156820
Ref: 39f613156820
Ref: library/contextvars contextvars Token old_value13157000
Ref: 39f713157000
Ref: library/contextvars contextvars Token MISSING13157376
Ref: 1a6d13157376
Node: マニュアルでのコンテキスト管理13157514
Ref: library/contextvars manual-context-management13157698
Ref: 39f813157698
Ref: library/contextvars contextvars copy_context13157796
Ref: 387d13157796
Ref: library/contextvars contextvars Context13158408
Ref: 42813158408
Ref: library/contextvars contextvars Context run13160431
Ref: 19ad13160431
Ref: library/contextvars contextvars Context copy13161760
Ref: 39f913161760
Ref: library/contextvars contextvars Context get13162322
Ref: 39fa13162322
Ref: library/contextvars contextvars Context keys13162916
Ref: 39fb13162916
Ref: library/contextvars contextvars Context values13163050
Ref: 39fc13163050
Ref: library/contextvars contextvars Context items13163203
Ref: 39fd13163203
Node: asyncio サポート13163413
Ref: library/contextvars asyncio-support13163564
Ref: 39fe13163564
Node: _thread --- 低水準なスレッド API13165349
Ref: library/_thread doc13165487
Ref: 39ff13165487
Ref: library/_thread module-_thread13165487
Ref: 213165487
Ref: library/_thread thread-low-level-threading-api13165487
Ref: 3a0013165487
Ref: library/_thread translation-repo13165487
Ref: 3a0113165487
Ref: library/_thread thread error13166474
Ref: 3a0213166474
Ref: library/_thread thread LockType13166656
Ref: 3a0313166656
Ref: library/_thread thread start_new_thread13166753
Ref: 6c213166753
Ref: library/_thread thread interrupt_main13167849
Ref: c2013167849
Ref: library/_thread thread exit13168776
Ref: 3a0413168776
Ref: library/_thread thread allocate_lock13168950
Ref: 3a0513168950
Ref: library/_thread thread get_ident13169181
Ref: 3a0613169181
Ref: library/_thread thread get_native_id13169669
Ref: 3a0713169669
Ref: library/_thread thread stack_size13170303
Ref: 199b13170303
Ref: library/_thread thread TIMEOUT_MAX13171974
Ref: 3a0813171974
Ref: library/_thread thread lock acquire13172303
Ref: 3a0913172303
Ref: library/_thread thread lock release13173793
Ref: 3a0a13173793
Ref: library/_thread thread lock locked13174054
Ref: 3a0b13174054
Node: ネットワーク通信とプロセス間通信13175193
Ref: library/ipc doc13175381
Ref: 3a0c13175381
Ref: library/ipc ipc13175381
Ref: 3a0d13175381
Ref: library/ipc networking-and-interprocess-communication13175381
Ref: 3a0e13175381
Ref: library/ipc translation-repo13175381
Ref: 3a0f13175381
Node: asyncio --- 非同期 I/O13176698
Ref: library/asyncio doc13176879
Ref: 3a1013176879
Ref: library/asyncio asyncio-asynchronous-i-o13176879
Ref: 3a1113176879
Ref: library/asyncio module-asyncio13176879
Ref: b13176879
Ref: library/asyncio asyncio-cli13179063
Ref: 3a1c13179063
Node: Runners13180453
Ref: library/asyncio-runner doc13180551
Ref: 3a1d13180551
Ref: library/asyncio-runner runners13180551
Ref: 3a1e13180551
Ref: Runners-Footnote-113181141
Node: 非同期プログラムの実行13181217
Ref: library/asyncio-runner running-an-asyncio-program13181325
Ref: 3a1f13181325
Ref: library/asyncio-runner asyncio run13181401
Ref: 31413181401
Node: Runner context manager13183751
Ref: library/asyncio-runner runner-context-manager13183898
Ref: 3a2113183898
Ref: library/asyncio-runner asyncio Runner13183963
Ref: 31513183963
Ref: library/asyncio-runner asyncio Runner run13185282
Ref: 1b8113185282
Ref: library/asyncio-runner asyncio Runner close13186032
Ref: 3a2213186032
Ref: library/asyncio-runner asyncio Runner get_loop13186260
Ref: 3a2313186260
Node: Handling Keyboard Interruption13186702
Ref: library/asyncio-runner handling-keyboard-interruption13186807
Ref: 3a2413186807
Node: Coroutines and tasks13188315
Ref: library/asyncio-task doc13188437
Ref: 3a2513188437
Ref: library/asyncio-task coroutines-and-tasks13188437
Ref: 3a2613188437
Ref: library/asyncio-task translation-repo13188437
Ref: 3a2713188437
Node: コルーチン<3>13188997
Ref: library/asyncio-task coroutine13189090
Ref: 3a1313189090
Ref: library/asyncio-task coroutines13189090
Ref: 3a2813189090
Ref: コルーチン<3>-Footnote-113192746
Node: Awaitable13192825
Ref: library/asyncio-task asyncio-awaitables13192941
Ref: 3a2913192941
Ref: library/asyncio-task awaitables13192941
Ref: 3a2a13192941
Node: Creating tasks13196110
Ref: library/asyncio-task creating-tasks13196225
Ref: 3a2b13196225
Ref: library/asyncio-task asyncio create_task13196389
Ref: 46913196389
Ref: Creating tasks-Footnote-113199299
Node: Task cancellation13199372
Ref: library/asyncio-task task-cancellation13199489
Ref: 3a2c13199489
Node: Task groups13200584
Ref: library/asyncio-task task-groups13200699
Ref: 3a2d13200699
Ref: library/asyncio-task taskgroups13200699
Ref: 3a2e13200699
Ref: library/asyncio-task asyncio TaskGroup13200866
Ref: 6dd13200866
Ref: library/asyncio-task asyncio TaskGroup create_task13201135
Ref: 46b13201135
Ref: library/asyncio-task asyncio TaskGroup cancel13201757
Ref: 1ef13201757
Node: スリープ13206892
Ref: library/asyncio-task sleeping13207016
Ref: 3a2f13207016
Ref: library/asyncio-task asyncio sleep13207059
Ref: e3713207059
Ref: library/asyncio-task asyncio-example-sleep13207725
Ref: 3a3013207725
Node: Running tasks concurrently13208409
Ref: library/asyncio-task running-tasks-concurrently13208540
Ref: 3a3113208540
Ref: library/asyncio-task asyncio gather13208615
Ref: 9f913208615
Ref: library/asyncio-task asyncio-example-gather13210719
Ref: 3a3213210719
Node: Eager task factory13212930
Ref: library/asyncio-task eager-task-factory13213076
Ref: 3a3313213076
Ref: library/asyncio-task id213213076
Ref: 3a3413213076
Ref: library/asyncio-task asyncio eager_task_factory13213135
Ref: 89213213135
Ref: library/asyncio-task asyncio create_eager_task_factory13214282
Ref: 89313214282
Node: Shielding from cancellation13214953
Ref: library/asyncio-task shielding-from-cancellation13215091
Ref: 3a3513215091
Ref: library/asyncio-task asyncio shield13215168
Ref: e3813215168
Node: タイムアウト13217065
Ref: library/asyncio-task timeouts13217203
Ref: 3a3613217203
Ref: library/asyncio-task asyncio timeout13217256
Ref: 9fa13217256
Ref: library/asyncio-task asyncio Timeout13219022
Ref: 1c6613219022
Ref: library/asyncio-task asyncio Timeout when13219666
Ref: 3a3813219666
Ref: library/asyncio-task asyncio Timeout reschedule13219844
Ref: 3a3713219844
Ref: library/asyncio-task asyncio Timeout expired13219955
Ref: 3a3913219955
Ref: library/asyncio-task asyncio timeout_at13220827
Ref: 1dcc13220827
Ref: library/asyncio-task asyncio wait_for13221469
Ref: 9fb13221469
Ref: library/asyncio-task asyncio-example-waitfor13222503
Ref: 3a3a13222503
Node: Waiting primitives13223405
Ref: library/asyncio-task waiting-primitives13223534
Ref: 3a3b13223534
Ref: library/asyncio-task asyncio wait13223593
Ref: 89613223593
Ref: library/asyncio-task asyncio FIRST_COMPLETED13224917
Ref: 3a3c13224917
Ref: library/asyncio-task asyncio FIRST_EXCEPTION13225260
Ref: 3a3d13225260
Ref: library/asyncio-task asyncio ALL_COMPLETED13225784
Ref: 3a3e13225784
Ref: library/asyncio-task asyncio as_completed13226455
Ref: 6d213226455
Node: Running in threads13229355
Ref: library/asyncio-task running-in-threads13229495
Ref: 3a3f13229495
Ref: library/asyncio-task asyncio to_thread13229554
Ref: cbd13229554
Node: Scheduling from other threads13231848
Ref: library/asyncio-task scheduling-from-other-threads13232000
Ref: 3a4013232000
Ref: library/asyncio-task asyncio run_coroutine_threadsafe13232081
Ref: c5c13232081
Node: イントロスペクション13235614
Ref: library/asyncio-task introspection13235759
Ref: 3a4213235759
Ref: library/asyncio-task asyncio current_task13235832
Ref: 89413235832
Ref: library/asyncio-task asyncio all_tasks13236198
Ref: d2413236198
Ref: library/asyncio-task asyncio iscoroutine13236550
Ref: 89513236550
Node: Task object13236676
Ref: library/asyncio-task asyncio-task-obj13236783
Ref: 3a4313236783
Ref: library/asyncio-task task-object13236783
Ref: 3a4413236783
Ref: library/asyncio-task asyncio Task13236828
Ref: 46713236828
Ref: library/asyncio-task asyncio Task done13240204
Ref: 3a4713240204
Ref: library/asyncio-task asyncio Task result13240511
Ref: 3a4813240511
Ref: library/asyncio-task asyncio Task exception13241100
Ref: 3a4a13241100
Ref: library/asyncio-task asyncio Task add_done_callback13241726
Ref: 3a4b13241726
Ref: library/asyncio-task asyncio Task remove_done_callback13242155
Ref: 3a4c13242155
Ref: library/asyncio-task asyncio Task get_stack13242553
Ref: 3a4d13242553
Ref: library/asyncio-task asyncio Task print_stack13243901
Ref: 1cee13243901
Ref: library/asyncio-task asyncio Task get_coro13244515
Ref: da413244515
Ref: library/asyncio-task asyncio Task get_context13244988
Ref: 3a4e13244988
Ref: library/asyncio-task asyncio Task get_name13245158
Ref: da613245158
Ref: library/asyncio-task asyncio Task set_name13245505
Ref: da513245505
Ref: library/asyncio-task asyncio Task cancel13245909
Ref: 6df13245909
Ref: library/asyncio-task asyncio-example-task-cancel13247401
Ref: 3a4f13247401
Ref: library/asyncio-task asyncio Task cancelled13248699
Ref: 3a4513248699
Ref: library/asyncio-task asyncio Task uncancel13249139
Ref: 6e213249139
Ref: library/asyncio-task asyncio Task cancelling13251444
Ref: 6e113251444
Node: ストリーム13252256
Ref: library/asyncio-stream doc13252398
Ref: 3a5013252398
Ref: library/asyncio-stream asyncio-streams13252398
Ref: 19d013252398
Ref: library/asyncio-stream streams13252398
Ref: 3a5113252398
Ref: library/asyncio-stream translation-repo13252398
Ref: 3a5213252398
Ref: library/asyncio-stream asyncio-example-stream13252869
Ref: 3a5313252869
Ref: library/asyncio-stream asyncio open_connection13253689
Ref: ee013253689
Ref: library/asyncio-stream asyncio start_server13255218
Ref: ee113255218
Ref: library/asyncio-stream asyncio open_unix_connection13257242
Ref: 3a5713257242
Ref: library/asyncio-stream asyncio start_unix_server13258390
Ref: 3a5913258390
Ref: ストリーム-Footnote-113259913
Node: StreamReader13259989
Ref: library/asyncio-stream streamreader13260074
Ref: 3a5a13260074
Ref: library/asyncio-stream asyncio StreamReader13260121
Ref: 196b13260121
Ref: library/asyncio-stream asyncio StreamReader feed_eof13260572
Ref: 3a5b13260572
Ref: library/asyncio-stream asyncio StreamReader read13260657
Ref: 3a5c13260657
Ref: library/asyncio-stream asyncio StreamReader readline13261530
Ref: 3a5d13261530
Ref: library/asyncio-stream asyncio StreamReader readexactly13262005
Ref: 103e13262005
Ref: library/asyncio-stream asyncio StreamReader readuntil13262410
Ref: 6dc13262410
Ref: library/asyncio-stream asyncio StreamReader at_eof13263891
Ref: 3a6013263891
Node: StreamWriter13264053
Ref: library/asyncio-stream streamwriter13264160
Ref: 3a6113264160
Ref: library/asyncio-stream asyncio StreamWriter13264207
Ref: 1c9513264207
Ref: library/asyncio-stream asyncio StreamWriter write13264599
Ref: 3a6213264599
Ref: library/asyncio-stream asyncio StreamWriter writelines13265212
Ref: 3a6313265212
Ref: library/asyncio-stream asyncio StreamWriter close13265768
Ref: 3a5513265768
Ref: library/asyncio-stream asyncio StreamWriter can_write_eof13266092
Ref: 3a6413266092
Ref: library/asyncio-stream asyncio StreamWriter write_eof13266356
Ref: 3a6513266356
Ref: library/asyncio-stream asyncio StreamWriter transport13266560
Ref: 3a6613266560
Ref: library/asyncio-stream asyncio StreamWriter get_extra_info13266666
Ref: 3a6713266666
Ref: library/asyncio-stream asyncio StreamWriter drain13266903
Ref: 1d4613266903
Ref: library/asyncio-stream asyncio StreamWriter start_tls13267656
Ref: 9ff13267656
Ref: library/asyncio-stream asyncio StreamWriter is_closing13268738
Ref: ed513268738
Ref: library/asyncio-stream asyncio StreamWriter wait_closed13268948
Ref: ed413268948
Node: 使用例<22>13269301
Ref: library/asyncio-stream examples13269387
Ref: 3a5413269387
Node: ストリームを使った TCP Echo クライアント13269663
Ref: library/asyncio-stream asyncio-tcp-echo-client-streams13269826
Ref: 3a6813269826
Ref: library/asyncio-stream tcp-echo-client-using-streams13269826
Ref: 3a6913269826
Node: ストリームを使った TCP Echo サーバー13270706
Ref: library/asyncio-stream asyncio-tcp-echo-server-streams13270904
Ref: 3a6b13270904
Ref: library/asyncio-stream tcp-echo-server-using-streams13270904
Ref: 3a6c13270904
Node: HTTP ヘッダーの取得13272013
Ref: library/asyncio-stream get-http-headers13272234
Ref: 3a6e13272234
Node: ストリームを使ってデータを待つオープンソケットの登録13273565
Ref: library/asyncio-stream asyncio-example-create-connection-streams13273728
Ref: 3a6f13273728
Ref: library/asyncio-stream register-an-open-socket-to-wait-for-data-using-streams13273728
Ref: 3a7013273728
Node: 同期プリミティブ<2>13275326
Ref: library/asyncio-sync doc13275466
Ref: 3a7413275466
Ref: library/asyncio-sync asyncio-sync13275466
Ref: 3a1613275466
Ref: library/asyncio-sync synchronization-primitives13275466
Ref: 3a7513275466
Ref: library/asyncio-sync translation-repo13275466
Ref: 3a7613275466
Ref: 同期プリミティブ<2>-Footnote-113276743
Node: Lock13276816
Ref: library/asyncio-sync lock13276898
Ref: 3a7713276898
Ref: library/asyncio-sync asyncio Lock13276929
Ref: e3913276929
Ref: library/asyncio-sync asyncio Lock acquire13277807
Ref: 3a7813277807
Ref: library/asyncio-sync asyncio Lock release13278491
Ref: 3a7913278491
Ref: library/asyncio-sync asyncio Lock locked13278815
Ref: 3a7a13278815
Node: Event13278921
Ref: library/asyncio-sync event13279021
Ref: 3a7b13279021
Ref: library/asyncio-sync asyncio Event13279054
Ref: 57413279054
Ref: library/asyncio-sync asyncio-example-sync-event13279848
Ref: 3a7f13279848
Ref: library/asyncio-sync asyncio Event wait13280503
Ref: 3a7e13280503
Ref: library/asyncio-sync asyncio Event set13280851
Ref: 3a7c13280851
Ref: library/asyncio-sync asyncio Event clear13281088
Ref: 3a7d13281088
Ref: library/asyncio-sync asyncio Event is_set13281323
Ref: 3a8013281323
Node: Condition13281444
Ref: library/asyncio-sync condition13281549
Ref: 3a8113281549
Ref: library/asyncio-sync asyncio Condition13281590
Ref: e3a13281590
Ref: library/asyncio-sync asyncio Condition acquire13283229
Ref: 3a8213283229
Ref: library/asyncio-sync asyncio Condition notify13283501
Ref: 1c1e13283501
Ref: library/asyncio-sync asyncio Condition locked13284049
Ref: 3a8313284049
Ref: library/asyncio-sync asyncio Condition notify_all13284167
Ref: 3a8413284167
Ref: library/asyncio-sync asyncio Condition release13284832
Ref: 3a8513284832
Ref: library/asyncio-sync asyncio Condition wait13285061
Ref: 1c4713285061
Ref: library/asyncio-sync asyncio Condition wait_for13285998
Ref: 3a8613285998
Node: Semaphore13286383
Ref: library/asyncio-sync semaphore13286499
Ref: 3a8713286499
Ref: library/asyncio-sync asyncio Semaphore13286540
Ref: e3b13286540
Ref: library/asyncio-sync asyncio Semaphore acquire13288087
Ref: 1c4813288087
Ref: library/asyncio-sync asyncio Semaphore locked13288485
Ref: 3a8913288485
Ref: library/asyncio-sync asyncio Semaphore release13288609
Ref: 3a8813288609
Node: BoundedSemaphore13289018
Ref: library/asyncio-sync boundedsemaphore13289132
Ref: 3a8a13289132
Ref: library/asyncio-sync asyncio BoundedSemaphore13289187
Ref: e3c13289187
Node: Barrier13289687
Ref: library/asyncio-sync barrier13289783
Ref: 3a8b13289783
Ref: library/asyncio-sync asyncio Barrier13289820
Ref: 9fc13289820
Ref: library/asyncio-sync asyncio-example-barrier13290409
Ref: 3a8d13290409
Ref: library/asyncio-sync asyncio Barrier wait13291309
Ref: 3a8c13291309
Ref: library/asyncio-sync asyncio Barrier reset13292388
Ref: 3a8e13292388
Ref: library/asyncio-sync asyncio Barrier abort13292690
Ref: 3a8f13292690
Ref: library/asyncio-sync asyncio Barrier parties13293009
Ref: 3a9013293009
Ref: library/asyncio-sync asyncio Barrier n_waiting13293099
Ref: 3a9113293099
Ref: library/asyncio-sync asyncio Barrier broken13293219
Ref: 3a9213293219
Ref: library/asyncio-sync asyncio BrokenBarrierError13293342
Ref: 9fd13293342
Node: サブプロセス13293960
Ref: library/asyncio-subprocess doc13294094
Ref: 3a9313294094
Ref: library/asyncio-subprocess asyncio-subprocess13294094
Ref: 3a1413294094
Ref: library/asyncio-subprocess subprocesses13294094
Ref: 3a9413294094
Ref: library/asyncio-subprocess translation-repo13294094
Ref: 3a9513294094
Ref: library/asyncio-subprocess asyncio-example-subprocess-shell13294438
Ref: 3a9613294438
Ref: サブプロセス-Footnote-113296000
Ref: サブプロセス-Footnote-213296079
Node: サブプロセスの生成13296163
Ref: library/asyncio-subprocess creating-subprocesses13296263
Ref: 3a9813296263
Ref: library/asyncio-subprocess asyncio create_subprocess_exec13296331
Ref: e3e13296331
Ref: library/asyncio-subprocess asyncio create_subprocess_shell13297140
Ref: e3f13297140
Ref: サブプロセスの生成-Footnote-113299088
Node: 定数<7>13299158
Ref: library/asyncio-subprocess constants13299306
Ref: 3aa313299306
Ref: library/asyncio-subprocess asyncio subprocess PIPE13299339
Ref: 3aa413299339
Ref: library/asyncio-subprocess asyncio subprocess STDOUT13299798
Ref: 3aa613299798
Ref: library/asyncio-subprocess asyncio subprocess DEVNULL13300006
Ref: 3aa713300006
Node: サブプロセスとやりとりする13300326
Ref: library/asyncio-subprocess interacting-with-subprocesses13300438
Ref: 3aa813300438
Ref: library/asyncio-subprocess asyncio subprocess Process13300853
Ref: 3a9b13300853
Ref: library/asyncio-subprocess asyncio subprocess Process wait13302052
Ref: 3aa913302052
Ref: library/asyncio-subprocess asyncio subprocess Process communicate13302780
Ref: 1cc113302780
Ref: library/asyncio-subprocess asyncio subprocess Process send_signal13304720
Ref: 1b8013304720
Ref: library/asyncio-subprocess asyncio subprocess Process terminate13305156
Ref: 3aac13305156
Ref: library/asyncio-subprocess asyncio subprocess Process kill13305457
Ref: 3aad13305457
Ref: library/asyncio-subprocess asyncio subprocess Process stdin13305763
Ref: 3aa513305763
Ref: library/asyncio-subprocess asyncio subprocess Process stdout13305925
Ref: 3a9913305925
Ref: library/asyncio-subprocess asyncio subprocess Process stderr13306090
Ref: 3a9a13306090
Ref: library/asyncio-subprocess asyncio subprocess Process pid13306594
Ref: 3aae13306594
Ref: library/asyncio-subprocess asyncio subprocess Process returncode13306849
Ref: 3aab13306849
Node: サブプロセスとスレッド13307723
Ref: library/asyncio-subprocess asyncio-subprocess-threads13307854
Ref: 3aaa13307854
Ref: library/asyncio-subprocess subprocess-and-threads13307854
Ref: 3aaf13307854
Node: 使用例<23>13308561
Ref: library/asyncio-subprocess examples13308692
Ref: 3a9713308692
Ref: library/asyncio-subprocess asyncio-example-create-subprocess-exec13308918
Ref: 3ab013308918
Node: キュー13309766
Ref: library/asyncio-queue doc13309883
Ref: 3ab213309883
Ref: library/asyncio-queue asyncio-queues13309883
Ref: 3a1513309883
Ref: library/asyncio-queue queues13309883
Ref: 3ab313309883
Ref: library/asyncio-queue translation-repo13309883
Ref: 3ab413309883
Ref: キュー-Footnote-113310805
Node: Queue13310879
Ref: library/asyncio-queue queue13310966
Ref: 3ab613310966
Ref: library/asyncio-queue asyncio Queue13310999
Ref: e3d13310999
Ref: library/asyncio-queue asyncio Queue maxsize13311830
Ref: 3ab913311830
Ref: library/asyncio-queue asyncio Queue empty13311922
Ref: 3aba13311922
Ref: library/asyncio-queue asyncio Queue full13312072
Ref: 3abb13312072
Ref: library/asyncio-queue asyncio Queue get13312342
Ref: 3ab713312342
Ref: library/asyncio-queue asyncio Queue get_nowait13312689
Ref: 3abc13312689
Ref: library/asyncio-queue asyncio Queue join13312879
Ref: 118313312879
Ref: library/asyncio-queue asyncio Queue put13313522
Ref: 3abe13313522
Ref: library/asyncio-queue asyncio Queue put_nowait13313844
Ref: 3abf13313844
Ref: library/asyncio-queue asyncio Queue qsize13314085
Ref: 3ab813314085
Ref: library/asyncio-queue asyncio Queue shutdown13314172
Ref: 6d813314172
Ref: library/asyncio-queue asyncio Queue task_done13315738
Ref: 118413315738
Node: 優先度付きのキュー13316537
Ref: library/asyncio-queue priority-queue13316647
Ref: 3ac113316647
Ref: library/asyncio-queue asyncio PriorityQueue13316715
Ref: 3ac213316715
Node: LIFO キュー13316998
Ref: library/asyncio-queue lifo-queue13317113
Ref: 3ac313317113
Ref: library/asyncio-queue asyncio LifoQueue13317161
Ref: 3ac413317161
Node: 例外<16>13317349
Ref: library/asyncio-queue exceptions13317450
Ref: 3ac513317450
Ref: library/asyncio-queue asyncio QueueEmpty13317483
Ref: 3abd13317483
Ref: library/asyncio-queue asyncio QueueFull13317654
Ref: 3ac013317654
Ref: library/asyncio-queue asyncio QueueShutDown13317847
Ref: 6d913317847
Node: 使用例<24>13318032
Ref: library/asyncio-queue examples13318110
Ref: 3ab513318110
Ref: library/asyncio-queue asyncio-example-queue-dist13318148
Ref: 3ac613318148
Node: 例外<17>13319956
Ref: library/asyncio-exceptions doc13320079
Ref: 3ac713320079
Ref: library/asyncio-exceptions asyncio-exceptions13320079
Ref: 3ac813320079
Ref: library/asyncio-exceptions exceptions13320079
Ref: 3ac913320079
Ref: library/asyncio-exceptions translation-repo13320079
Ref: 3aca13320079
Ref: library/asyncio-exceptions asyncio TimeoutError13320232
Ref: 1cd713320232
Ref: library/asyncio-exceptions asyncio CancelledError13320534
Ref: 6e013320534
Ref: library/asyncio-exceptions asyncio InvalidStateError13321076
Ref: 3a4913321076
Ref: library/asyncio-exceptions asyncio SendfileNotAvailableError13321425
Ref: 3acb13321425
Ref: library/asyncio-exceptions asyncio IncompleteReadError13321685
Ref: 1efc13321685
Ref: library/asyncio-exceptions asyncio IncompleteReadError expected13321949
Ref: 3acc13321949
Ref: library/asyncio-exceptions asyncio IncompleteReadError partial13322049
Ref: 3a5e13322049
Ref: library/asyncio-exceptions asyncio LimitOverrunError13322198
Ref: 3a5f13322198
Ref: library/asyncio-exceptions asyncio LimitOverrunError consumed13322412
Ref: 3acd13322412
Ref: 例外<17>-Footnote-113322532
Node: Call Graph Introspection13322611
Ref: library/asyncio-graph doc13322735
Ref: 3ace13322735
Ref: library/asyncio-graph asyncio-graph13322735
Ref: 3acf13322735
Ref: library/asyncio-graph call-graph-introspection13322735
Ref: 3ad013322735
Ref: library/asyncio-graph translation-repo13322735
Ref: 3ad113322735
Ref: library/asyncio-graph asyncio print_call_graph13323222
Ref: 46d13323222
Ref: library/asyncio-graph asyncio format_call_graph13325188
Ref: 3ad213325188
Ref: library/asyncio-graph asyncio capture_call_graph13325449
Ref: 46c13325449
Ref: Call Graph Introspection-Footnote-113326672
Node: Low level utility functions13326745
Ref: library/asyncio-graph low-level-utility-functions13326833
Ref: 3ad313326833
Ref: library/asyncio-graph asyncio future_add_to_awaited_by13327350
Ref: 3ad413327350
Ref: library/asyncio-graph asyncio future_discard_from_awaited_by13327821
Ref: 3ad513327821
Node: Event loop13328125
Ref: library/asyncio-eventloop doc13328245
Ref: 3ad613328245
Ref: library/asyncio-eventloop asyncio-event-loop13328245
Ref: 113313328245
Ref: library/asyncio-eventloop event-loop13328245
Ref: 3ad713328245
Ref: library/asyncio-eventloop translation-repo13328245
Ref: 3ad813328245
Ref: library/asyncio-eventloop asyncio get_running_loop13329345
Ref: ed313329345
Ref: library/asyncio-eventloop asyncio get_event_loop13329651
Ref: 57313329651
Ref: library/asyncio-eventloop asyncio set_event_loop13330958
Ref: 1d7213330958
Ref: library/asyncio-eventloop asyncio new_event_loop13331091
Ref: 3a2013331091
Ref: Event loop-Footnote-113332613
Ref: Event loop-Footnote-213332689
Node: Event loop methods13332763
Ref: library/asyncio-eventloop asyncio-event-loop-methods13332853
Ref: 3adf13332853
Ref: library/asyncio-eventloop event-loop-methods13332853
Ref: 3ada13332853
Node: ループの開始と停止13333611
Ref: library/asyncio-eventloop running-and-stopping-the-loop13333747
Ref: 3ae013333747
Ref: library/asyncio-eventloop asyncio loop run_until_complete13333815
Ref: 103a13333815
Ref: library/asyncio-eventloop asyncio loop run_forever13334242
Ref: 3ae113334242
Ref: library/asyncio-eventloop asyncio loop stop13335467
Ref: 103f13335467
Ref: library/asyncio-eventloop asyncio loop is_running13335548
Ref: 3ae213335548
Ref: library/asyncio-eventloop asyncio loop is_closed13335671
Ref: 118013335671
Ref: library/asyncio-eventloop asyncio loop close13335796
Ref: 3ae313335796
Ref: library/asyncio-eventloop asyncio loop shutdown_asyncgens13336485
Ref: 104113336485
Ref: library/asyncio-eventloop asyncio loop shutdown_default_executor13337485
Ref: cbc13337485
Node: コールバックのスケジューリング13338525
Ref: library/asyncio-eventloop scheduling-callbacks13338721
Ref: 3ae413338721
Ref: library/asyncio-eventloop asyncio loop call_soon13338819
Ref: ecc13338819
Ref: library/asyncio-eventloop asyncio loop call_soon_threadsafe13339749
Ref: ecd13339749
Ref: library/asyncio-eventloop asyncio-pass-keywords13340848
Ref: 3ae513340848
Ref: コールバックのスケジューリング-Footnote-113341589
Node: 遅延コールバックのスケジューリング13341631
Ref: library/asyncio-eventloop asyncio-delayed-calls13341826
Ref: 3ae613341826
Ref: library/asyncio-eventloop scheduling-delayed-callbacks13341826
Ref: 3ae713341826
Ref: library/asyncio-eventloop asyncio loop call_later13342215
Ref: ece13342215
Ref: library/asyncio-eventloop asyncio loop call_at13344098
Ref: ecf13344098
Ref: library/asyncio-eventloop asyncio loop time13345378
Ref: 3ae813345378
Ref: 遅延コールバックのスケジューリング-Footnote-113346008
Ref: 遅延コールバックのスケジューリング-Footnote-213346050
Node: Creating futures and tasks13346092
Ref: library/asyncio-eventloop creating-futures-and-tasks13346275
Ref: 3ae913346275
Ref: library/asyncio-eventloop asyncio loop create_future13346350
Ref: 103c13346350
Ref: library/asyncio-eventloop asyncio loop create_task13346872
Ref: 46a13346872
Ref: library/asyncio-eventloop asyncio loop set_task_factory13349024
Ref: 46813349024
Ref: library/asyncio-eventloop asyncio loop get_task_factory13349967
Ref: 118213349967
Node: ネットワーク接続の確立13350162
Ref: library/asyncio-eventloop opening-network-connections13350330
Ref: 3aea13350330
Ref: library/asyncio-eventloop asyncio loop create_connection13350408
Ref: 9fe13350408
Ref: library/asyncio-eventloop asyncio loop create_datagram_endpoint13359163
Ref: b1f13359163
Ref: library/asyncio-eventloop asyncio loop create_unix_connection13364379
Ref: 3a5813364379
Ref: ネットワーク接続の確立-Footnote-113365646
Ref: ネットワーク接続の確立-Footnote-213365705
Node: ネットワークサーバの生成13365764
Ref: library/asyncio-eventloop creating-network-servers13365927
Ref: 3af213365927
Ref: library/asyncio-eventloop loop-create-server13366010
Ref: 3a1713366010
Ref: library/asyncio-eventloop asyncio loop create_server13366010
Ref: edb13366010
Ref: library/asyncio-eventloop asyncio loop create_unix_server13372125
Ref: 6d613372125
Ref: library/asyncio-eventloop asyncio loop connect_accepted_socket13373533
Ref: bbf13373533
Node: ファイルの転送13375456
Ref: library/asyncio-eventloop transferring-files13375597
Ref: 3af413375597
Ref: library/asyncio-eventloop asyncio loop sendfile13375655
Ref: 3af513375655
Node: TLS upgrade13377276
Ref: library/asyncio-eventloop tls-upgrade13377411
Ref: 3af613377411
Ref: library/asyncio-eventloop asyncio loop start_tls13377456
Ref: ed113377456
Node: ファイル記述子の監視13379728
Ref: library/asyncio-eventloop watching-file-descriptors13379899
Ref: 3af713379899
Ref: library/asyncio-eventloop asyncio loop add_reader13379972
Ref: 3a7313379972
Ref: library/asyncio-eventloop asyncio loop remove_reader13380356
Ref: 3af813380356
Ref: library/asyncio-eventloop asyncio loop add_writer13380543
Ref: 3af913380543
Ref: library/asyncio-eventloop asyncio loop remove_writer13381031
Ref: 3afa13381031
Node: ソケットオブジェクトと直接やりとりする13381378
Ref: library/asyncio-eventloop working-with-socket-objects-directly13381541
Ref: 3afc13381541
Ref: library/asyncio-eventloop asyncio loop sock_recv13382104
Ref: fd413382104
Ref: library/asyncio-eventloop asyncio loop sock_recv_into13382861
Ref: ed213382861
Ref: library/asyncio-eventloop asyncio loop sock_recvfrom13383328
Ref: a0113383328
Ref: library/asyncio-eventloop asyncio loop sock_recvfrom_into13383678
Ref: a0213383678
Ref: library/asyncio-eventloop asyncio loop sock_sendall13384064
Ref: fd513384064
Ref: library/asyncio-eventloop asyncio loop sock_sendto13385118
Ref: a0013385118
Ref: library/asyncio-eventloop asyncio loop sock_connect13385443
Ref: 118513385443
Ref: library/asyncio-eventloop asyncio loop sock_accept13386258
Ref: fd613386258
Ref: library/asyncio-eventloop asyncio loop sock_sendfile13387377
Ref: ed613387377
Node: DNS13389233
Ref: library/asyncio-eventloop dns13389396
Ref: 3afd13389396
Ref: library/asyncio-eventloop asyncio loop getaddrinfo13389425
Ref: fd713389425
Ref: library/asyncio-eventloop asyncio loop getnameinfo13389594
Ref: fd813389594
Node: パイプとやりとりする13390595
Ref: library/asyncio-eventloop working-with-pipes13390718
Ref: 3afe13390718
Ref: library/asyncio-eventloop asyncio loop connect_read_pipe13390791
Ref: 3a9f13390791
Ref: library/asyncio-eventloop asyncio loop connect_write_pipe13391642
Ref: 3aa013391642
Node: Unix シグナル13392792
Ref: library/asyncio-eventloop unix-signals13392981
Ref: 3b0113392981
Ref: library/asyncio-eventloop loop-add-signal-handler13393034
Ref: 3a1913393034
Ref: library/asyncio-eventloop asyncio loop add_signal_handler13393034
Ref: 3b0213393034
Ref: library/asyncio-eventloop asyncio loop remove_signal_handler13394156
Ref: 3b0313394156
Node: スレッドまたはプロセスプールでコードを実行する13394566
Ref: library/asyncio-eventloop executing-code-in-thread-or-process-pools13394743
Ref: 3b0413394743
Ref: library/asyncio-eventloop asyncio loop run_in_executor13394881
Ref: cbe13394881
Ref: library/asyncio-eventloop asyncio loop set_default_executor13398081
Ref: b2d13398081
Node: Error handling API13398460
Ref: library/asyncio-eventloop error-handling-api13398653
Ref: 3b0513398653
Ref: library/asyncio-eventloop asyncio loop set_exception_handler13398798
Ref: 3b0613398798
Ref: library/asyncio-eventloop asyncio loop get_exception_handler13399914
Ref: 103d13399914
Ref: library/asyncio-eventloop asyncio loop default_exception_handler13400147
Ref: 3b0813400147
Ref: library/asyncio-eventloop asyncio loop call_exception_handler13400656
Ref: 3b0713400656
Node: デバッグモードの有効化13401974
Ref: library/asyncio-eventloop enabling-debug-mode13402118
Ref: 3b0913402118
Ref: library/asyncio-eventloop asyncio loop get_debug13402196
Ref: 117f13402196
Ref: library/asyncio-eventloop asyncio loop set_debug13402537
Ref: 117e13402537
Ref: library/asyncio-eventloop asyncio loop slow_callback_duration13402845
Ref: 3b0a13402845
Node: Running subprocesses13403170
Ref: library/asyncio-eventloop running-subprocesses13403287
Ref: 3b0b13403287
Ref: library/asyncio-eventloop loop-subprocess-exec13403869
Ref: 3a1813403869
Ref: library/asyncio-eventloop asyncio loop subprocess_exec13403869
Ref: 3a9c13403869
Ref: library/asyncio-eventloop asyncio loop subprocess_shell13408851
Ref: 3a9d13408851
Ref: Running subprocesses-Footnote-113410702
Node: Callback handles13410772
Ref: library/asyncio-eventloop callback-handles13410885
Ref: 3adb13410885
Ref: library/asyncio-eventloop asyncio Handle13410940
Ref: 209013410940
Ref: library/asyncio-eventloop asyncio Handle get_context13411107
Ref: 3b0e13411107
Ref: library/asyncio-eventloop asyncio Handle cancel13411279
Ref: 3b0f13411279
Ref: library/asyncio-eventloop asyncio Handle cancelled13411513
Ref: ee213411513
Ref: library/asyncio-eventloop asyncio TimerHandle13411676
Ref: 1cfb13411676
Ref: library/asyncio-eventloop asyncio TimerHandle when13411895
Ref: edf13411895
Node: Server objects13412225
Ref: library/asyncio-eventloop server-objects13412346
Ref: 3adc13412346
Ref: library/asyncio-eventloop asyncio Server13412670
Ref: eda13412670
Ref: library/asyncio-eventloop asyncio Server close13413516
Ref: 3a5613413516
Ref: library/asyncio-eventloop asyncio Server close_clients13414028
Ref: 6da13414028
Ref: library/asyncio-eventloop asyncio Server abort_clients13414396
Ref: 6db13414396
Ref: library/asyncio-eventloop asyncio Server get_loop13414838
Ref: ed913414838
Ref: library/asyncio-eventloop asyncio Server start_serving13415000
Ref: edc13415000
Ref: library/asyncio-eventloop asyncio Server serve_forever13415806
Ref: edd13415806
Ref: library/asyncio-eventloop asyncio Server is_serving13416895
Ref: ede13416895
Ref: library/asyncio-eventloop asyncio Server wait_closed13417085
Ref: 1c6513417085
Ref: library/asyncio-eventloop asyncio Server sockets13417246
Ref: fd913417246
Ref: library/asyncio-eventloop asyncio-event-loops13417718
Ref: 3b1113417718
Node: Event loop implementations13417718
Ref: library/asyncio-eventloop asyncio-event-loop-implementations13417836
Ref: 3b1213417836
Ref: library/asyncio-eventloop event-loop-implementations13417836
Ref: 3add13417836
Ref: library/asyncio-eventloop asyncio SelectorEventLoop13418124
Ref: 31613418124
Ref: library/asyncio-eventloop asyncio ProactorEventLoop13418752
Ref: a0313418752
Ref: library/asyncio-eventloop asyncio EventLoop13419020
Ref: 1c8c13419020
Ref: library/asyncio-eventloop asyncio AbstractEventLoop13419334
Ref: d2d13419334
Ref: Event loop implementations-Footnote-113419657
Node: 使用例<25>13419736
Ref: library/asyncio-eventloop examples13419831
Ref: 3ade13419831
Node: call_soon を使った Hello World13420613
Ref: library/asyncio-eventloop asyncio-example-lowlevel-helloworld13420750
Ref: 3b1313420750
Ref: library/asyncio-eventloop hello-world-with-call-soon13420750
Ref: 3b1413420750
Node: call_later で現在の日時を表示する13421587
Ref: library/asyncio-eventloop asyncio-example-call-later13421790
Ref: 3b1513421790
Ref: library/asyncio-eventloop display-the-current-date-with-call-later13421790
Ref: 3b1613421790
Node: 読み込みイベント用ファイル記述子の監視13422836
Ref: library/asyncio-eventloop asyncio-example-watch-fd13423072
Ref: 3a7213423072
Ref: library/asyncio-eventloop watch-a-file-descriptor-for-read-events13423072
Ref: 3b1713423072
Node: SIGINT および SIGTERM 用のシグナルハンドラーの設定13424524
Ref: library/asyncio-eventloop asyncio-example-unix-signals13424707
Ref: 3b1813424707
Ref: library/asyncio-eventloop set-signal-handlers-for-sigint-and-sigterm13424707
Ref: 3b1913424707
Node: Future13425667
Ref: library/asyncio-future doc13425802
Ref: 393e13425802
Ref: library/asyncio-future asyncio-futures13425802
Ref: 3a1b13425802
Ref: library/asyncio-future futures13425802
Ref: 3b1a13425802
Ref: library/asyncio-future translation-repo13425802
Ref: 3b1b13425802
Ref: Future-Footnote-113426269
Ref: Future-Footnote-213426345
Node: Future の関数13426426
Ref: library/asyncio-future future-functions13426522
Ref: 3b1c13426522
Ref: library/asyncio-future asyncio isfuture13426574
Ref: 3b1d13426574
Ref: library/asyncio-future asyncio ensure_future13426977
Ref: 103913426977
Ref: library/asyncio-future asyncio wrap_future13428692
Ref: 1e9213428692
Node: Future オブジェクト<2>13429079
Ref: library/asyncio-future asyncio-future-obj13429175
Ref: 3b1e13429175
Ref: library/asyncio-future future-object13429175
Ref: 3b1f13429175
Ref: library/asyncio-future asyncio Future13429242
Ref: f8f13429242
Ref: library/asyncio-future asyncio Future result13430650
Ref: 3b2013430650
Ref: library/asyncio-future asyncio Future set_result13431389
Ref: 3a4613431389
Ref: library/asyncio-future asyncio Future set_exception13431611
Ref: 104013431611
Ref: library/asyncio-future asyncio Future done13431839
Ref: 3b2113431839
Ref: library/asyncio-future asyncio Future cancelled13432221
Ref: 3b2213432221
Ref: library/asyncio-future asyncio Future add_done_callback13432648
Ref: ed013432648
Ref: library/asyncio-future asyncio Future remove_done_callback13434035
Ref: 1b4b13434035
Ref: library/asyncio-future asyncio Future cancel13434340
Ref: 1dc213434340
Ref: library/asyncio-future asyncio Future exception13435030
Ref: 3b2313435030
Ref: library/asyncio-future asyncio Future get_loop13435595
Ref: ed813435595
Ref: library/asyncio-future asyncio-example-future13435764
Ref: 3b2413435764
Ref: Future オブジェクト<2>-Footnote-113438250
Node: トランスポートとプロトコル13438292
Ref: library/asyncio-protocol doc13438429
Ref: 3b2513438429
Ref: library/asyncio-protocol asyncio-transports-protocols13438429
Ref: 3a1a13438429
Ref: library/asyncio-protocol translation-repo13438429
Ref: 3b2613438429
Ref: library/asyncio-protocol transports-and-protocols13438429
Ref: 3b2713438429
Node: トランスポート13441685
Ref: library/asyncio-protocol asyncio-transport13441809
Ref: 3aec13441809
Ref: library/asyncio-protocol transports13441809
Ref: 3b2813441809
Ref: トランスポート-Footnote-113442902
Node: トランスポートのクラス階層構造13442981
Ref: library/asyncio-protocol transports-hierarchy13443120
Ref: 3b2f13443120
Ref: library/asyncio-protocol asyncio BaseTransport13443218
Ref: 3b2a13443218
Ref: library/asyncio-protocol asyncio WriteTransport13443419
Ref: 3b0013443419
Ref: library/asyncio-protocol asyncio ReadTransport13443850
Ref: 3aff13443850
Ref: library/asyncio-protocol asyncio Transport13444222
Ref: 3b2b13444222
Ref: library/asyncio-protocol asyncio DatagramTransport13445100
Ref: 1d4413445100
Ref: library/asyncio-protocol asyncio SubprocessTransport13445411
Ref: 3b0d13445411
Node: 基底トランスポート13445788
Ref: library/asyncio-protocol base-transport13445978
Ref: 3b3013445978
Ref: library/asyncio-protocol asyncio BaseTransport close13446046
Ref: 3aef13446046
Ref: library/asyncio-protocol asyncio BaseTransport is_closing13446688
Ref: 103b13446688
Ref: library/asyncio-protocol asyncio BaseTransport get_extra_info13446841
Ref: e6613446841
Ref: library/asyncio-protocol asyncio BaseTransport set_protocol13449527
Ref: 3b3413449527
Ref: library/asyncio-protocol asyncio BaseTransport get_protocol13449835
Ref: 3b3513449835
Node: 読み出し専用のトランスポート13449933
Ref: library/asyncio-protocol read-only-transports13450120
Ref: 3b3613450120
Ref: library/asyncio-protocol asyncio ReadTransport is_reading13450213
Ref: ee313450213
Ref: library/asyncio-protocol asyncio ReadTransport pause_reading13450388
Ref: ee513450388
Ref: library/asyncio-protocol asyncio ReadTransport resume_reading13450907
Ref: ee413450907
Node: 書き込み専用のトランスポート13451371
Ref: library/asyncio-protocol write-only-transports13451570
Ref: 3b3713451570
Ref: library/asyncio-protocol asyncio WriteTransport abort13451663
Ref: 3b1013451663
Ref: library/asyncio-protocol asyncio WriteTransport can_write_eof13452116
Ref: 3b3813452116
Ref: library/asyncio-protocol asyncio WriteTransport get_write_buffer_size13452371
Ref: 194d13452371
Ref: library/asyncio-protocol asyncio WriteTransport get_write_buffer_limits13452548
Ref: 118113452548
Ref: library/asyncio-protocol asyncio WriteTransport set_write_buffer_limits13452956
Ref: 3b3a13452956
Ref: library/asyncio-protocol asyncio WriteTransport write13454763
Ref: 1a2a13454763
Ref: library/asyncio-protocol asyncio WriteTransport writelines13455026
Ref: 1a2913455026
Ref: library/asyncio-protocol asyncio WriteTransport write_eof13455407
Ref: 3b3913455407
Node: データグラムトランスポート13455890
Ref: library/asyncio-protocol datagram-transports13456098
Ref: 3b3d13456098
Ref: library/asyncio-protocol asyncio DatagramTransport sendto13456186
Ref: 6d713456186
Ref: library/asyncio-protocol asyncio DatagramTransport abort13457021
Ref: 3b3e13457021
Node: サブプロセス化されたトランスポート13457477
Ref: library/asyncio-protocol asyncio-subprocess-transports13457634
Ref: 3aa113457634
Ref: library/asyncio-protocol subprocess-transports13457634
Ref: 3b3f13457634
Ref: library/asyncio-protocol asyncio SubprocessTransport get_pid13457742
Ref: 3b4013457742
Ref: library/asyncio-protocol asyncio SubprocessTransport get_pipe_transport13457863
Ref: 3b4113457863
Ref: library/asyncio-protocol asyncio SubprocessTransport get_returncode13458631
Ref: 3b4213458631
Ref: library/asyncio-protocol asyncio SubprocessTransport kill13458933
Ref: 3b4313458933
Ref: library/asyncio-protocol asyncio SubprocessTransport send_signal13459302
Ref: 3b4513459302
Ref: library/asyncio-protocol asyncio SubprocessTransport terminate13459500
Ref: 3b4413459500
Ref: library/asyncio-protocol asyncio SubprocessTransport close13459936
Ref: 3b4613459936
Node: プロトコル<2>13460279
Ref: library/asyncio-protocol asyncio-protocol13460425
Ref: 3aeb13460425
Ref: library/asyncio-protocol protocols13460425
Ref: 3b2913460425
Ref: プロトコル<2>-Footnote-113461592
Node: 基底プロトコル13461670
Ref: library/asyncio-protocol base-protocols13461779
Ref: 3b4713461779
Ref: library/asyncio-protocol asyncio BaseProtocol13461837
Ref: 3b2c13461837
Ref: library/asyncio-protocol asyncio Protocol13462007
Ref: 3b2d13462007
Ref: library/asyncio-protocol asyncio BufferedProtocol13462184
Ref: e6713462184
Ref: library/asyncio-protocol asyncio DatagramProtocol13462382
Ref: ac113462382
Ref: library/asyncio-protocol asyncio SubprocessProtocol13462533
Ref: 3b0c13462533
Node: 基底プロトコル<2>13462731
Ref: library/asyncio-protocol base-protocol13462885
Ref: 3b4813462885
Ref: library/asyncio-protocol asyncio BaseProtocol connection_made13463410
Ref: 3aed13463410
Ref: library/asyncio-protocol asyncio BaseProtocol connection_lost13463734
Ref: 3b3113463734
Ref: library/asyncio-protocol asyncio BaseProtocol pause_writing13464543
Ref: 3b3b13464543
Ref: library/asyncio-protocol asyncio BaseProtocol resume_writing13464734
Ref: 3b3c13464734
Node: ストリーミングプロトコル13465455
Ref: library/asyncio-protocol streaming-protocols13465654
Ref: 3b4913465654
Ref: library/asyncio-protocol asyncio Protocol data_received13466141
Ref: 1d2013466141
Ref: library/asyncio-protocol asyncio Protocol eof_received13467166
Ref: 3b4a13467166
Node: バッファリングされたストリーミングプロトコル13468306
Ref: library/asyncio-protocol buffered-streaming-protocols13468514
Ref: 3b4b13468514
Ref: library/asyncio-protocol asyncio BufferedProtocol get_buffer13469541
Ref: 3b4c13469541
Ref: library/asyncio-protocol asyncio BufferedProtocol buffer_updated13470255
Ref: 3b4d13470255
Ref: library/asyncio-protocol asyncio BufferedProtocol eof_received13470485
Ref: 3b4e13470485
Node: データグラムプロトコル13471183
Ref: library/asyncio-protocol datagram-protocols13471388
Ref: 3b4f13471388
Ref: library/asyncio-protocol asyncio DatagramProtocol datagram_received13471670
Ref: 3b5013471670
Ref: library/asyncio-protocol asyncio DatagramProtocol error_received13472015
Ref: 3b5113472015
Node: サブプロセスプロトコル13473391
Ref: library/asyncio-protocol asyncio-subprocess-protocols13473521
Ref: 3aa213473521
Ref: library/asyncio-protocol subprocess-protocols13473521
Ref: 3b5213473521
Ref: library/asyncio-protocol asyncio SubprocessProtocol pipe_data_received13473833
Ref: 1d6d13473833
Ref: library/asyncio-protocol asyncio SubprocessProtocol pipe_connection_lost13474207
Ref: 3b5313474207
Ref: library/asyncio-protocol asyncio SubprocessProtocol process_exited13474481
Ref: 1d6c13474481
Node: 使用例<26>13474769
Ref: library/asyncio-protocol examples13474885
Ref: 3b2e13474885
Node: TCP エコーサーバー13475197
Ref: library/asyncio-protocol asyncio-example-tcp-echo-server-protocol13475312
Ref: 3a6d13475312
Ref: library/asyncio-protocol tcp-echo-server13475312
Ref: 3b5413475312
Node: TCP エコークライアント13476711
Ref: library/asyncio-protocol asyncio-example-tcp-echo-client-protocol13476860
Ref: 3a6a13476860
Ref: library/asyncio-protocol tcp-echo-client13476860
Ref: 3b5513476860
Node: UDP エコーサーバー13478547
Ref: library/asyncio-protocol asyncio-udp-echo-server-protocol13478702
Ref: 3af113478702
Ref: library/asyncio-protocol udp-echo-server13478702
Ref: 3b5613478702
Node: UDP エコークライアント13479898
Ref: library/asyncio-protocol asyncio-udp-echo-client-protocol13480055
Ref: 3af013480055
Ref: library/asyncio-protocol udp-echo-client13480055
Ref: 3b5713480055
Node: 既存のソケットへの接続13481666
Ref: library/asyncio-protocol asyncio-example-create-connection13481841
Ref: 3a7113481841
Ref: library/asyncio-protocol connecting-existing-sockets13481841
Ref: 3b5813481841
Node: loop subprocess_exec と SubprocessProtocol13483943
Ref: library/asyncio-protocol asyncio-example-subprocess-proto13484078
Ref: 3ab113484078
Ref: library/asyncio-protocol loop-subprocess-exec-and-subprocessprotocol13484078
Ref: 3b5913484078
Node: ポリシー13486501
Ref: library/asyncio-policy doc13486674
Ref: 3b5a13486674
Ref: library/asyncio-policy asyncio-policies13486674
Ref: 3ad913486674
Ref: library/asyncio-policy policies13486674
Ref: 3b5b13486674
Ref: library/asyncio-policy translation-repo13486674
Ref: 3b5c13486674
Node: ポリシーの取得と設定13487917
Ref: library/asyncio-policy asyncio-policy-get-set13488035
Ref: 3b5d13488035
Ref: library/asyncio-policy getting-and-setting-the-policy13488035
Ref: 3b6113488035
Ref: library/asyncio-policy asyncio get_event_loop_policy13488228
Ref: 31213488228
Ref: library/asyncio-policy asyncio set_event_loop_policy13488492
Ref: 31313488492
Node: ポリシーオブジェクト13488899
Ref: library/asyncio-policy asyncio-policy-objects13489059
Ref: 3b6013489059
Ref: library/asyncio-policy policy-objects13489059
Ref: 3b6213489059
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy13489239
Ref: 30e13489239
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy get_event_loop13489347
Ref: 3b6313489347
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy set_event_loop13489745
Ref: 3b6413489745
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy new_event_loop13489883
Ref: 3b6513489883
Ref: library/asyncio-policy asyncio-policy-builtin13490229
Ref: 3b5e13490229
Ref: library/asyncio-policy asyncio DefaultEventLoopPolicy13490294
Ref: 30f13490294
Ref: library/asyncio-policy asyncio WindowsSelectorEventLoopPolicy13491180
Ref: 31013491180
Ref: library/asyncio-policy asyncio WindowsProactorEventLoopPolicy13491550
Ref: 31113491550
Node: ポリシーのカスタマイズ13491920
Ref: library/asyncio-policy asyncio-custom-policies13492041
Ref: 3b5f13492041
Ref: library/asyncio-policy custom-policies13492041
Ref: 3b6613492041
Node: プラットフォームでのサポート13492758
Ref: library/asyncio-platforms doc13492901
Ref: 3b6713492901
Ref: library/asyncio-platforms asyncio-platform-support13492901
Ref: 3afb13492901
Ref: library/asyncio-platforms platform-support13492901
Ref: 3b6813492901
Ref: library/asyncio-platforms translation-repo13492901
Ref: 3b6913492901
Node: 全てのプラットホーム13493347
Ref: library/asyncio-platforms all-platforms13493476
Ref: 3b6a13493476
Node: Windows<84>13493695
Ref: library/asyncio-platforms windows13493842
Ref: 3b6b13493842
Ref: Windows<84>-Footnote-113496130
Ref: Windows<84>-Footnote-213496214
Ref: Windows<84>-Footnote-313496297
Ref: Windows<84>-Footnote-413496379
Node: Windows におけるサブプロセスのサポート13496444
Ref: library/asyncio-platforms asyncio-windows-subprocess13496545
Ref: 3a9e13496545
Ref: library/asyncio-platforms subprocess-support-on-windows13496545
Ref: 3b6d13496545
Node: macOS<53>13496869
Ref: library/asyncio-platforms macos13496977
Ref: 3b6e13496977
Node: Extending13497833
Ref: library/asyncio-extending doc13497999
Ref: 3b7013497999
Ref: library/asyncio-extending extending13497999
Ref: 3b7113497999
Ref: library/asyncio-extending translation-repo13497999
Ref: 3b7213497999
Node: Writing a Custom Event Loop13498481
Ref: library/asyncio-extending writing-a-custom-event-loop13498599
Ref: 3b7313498599
Node: Future and Task private constructors13499318
Ref: library/asyncio-extending future-and-task-private-constructors13499466
Ref: 3b7413499466
Ref: library/asyncio-extending asyncio Future __init__13500031
Ref: 3b7513500031
Ref: library/asyncio-extending asyncio Task __init__13500171
Ref: 3b7613500171
Node: Task lifetime support13500504
Ref: library/asyncio-extending task-lifetime-support13500616
Ref: 3b7713500616
Ref: library/asyncio-extending asyncio _register_task13500852
Ref: 3b7813500852
Ref: library/asyncio-extending asyncio _unregister_task13501000
Ref: 3b7913501000
Ref: library/asyncio-extending asyncio _enter_task13501178
Ref: 3b7a13501178
Ref: library/asyncio-extending asyncio _leave_task13501437
Ref: 3b7b13501437
Node: 高水準の API インデックス13501662
Ref: library/asyncio-api-index doc13501821
Ref: c5313501821
Ref: library/asyncio-api-index high-level-api-index13501821
Ref: 3b7c13501821
Ref: library/asyncio-api-index translation-repo13501821
Ref: 3b7d13501821
Node: Task13502193
Ref: library/asyncio-api-index tasks13502290
Ref: 3b7e13502290
Node: キュー<2>13507052
Ref: library/asyncio-api-index queues13507179
Ref: 3b7f13507179
Node: サブプロセス<2>13508089
Ref: library/asyncio-api-index subprocesses13508230
Ref: 3b8013508230
Node: ストリーム<2>13508943
Ref: library/asyncio-api-index streams13509078
Ref: 3b8113509078
Node: 同期13510833
Ref: library/asyncio-api-index synchronization13510957
Ref: 3b8213510957
Node: 例外<18>13512517
Ref: library/asyncio-api-index exceptions13512614
Ref: 3b8313512614
Node: 低水準の API インデックス13513519
Ref: library/asyncio-llapi-index doc13513689
Ref: 3b8413513689
Ref: library/asyncio-llapi-index low-level-api-index13513689
Ref: 3b8513513689
Ref: library/asyncio-llapi-index translation-repo13513689
Ref: 3b8613513689
Node: イベントループの取得13514075
Ref: library/asyncio-llapi-index obtaining-the-event-loop13514222
Ref: 3b8713514222
Node: イベントループのメソッド13515518
Ref: library/asyncio-llapi-index event-loop-methods13515698
Ref: 3b8813515698
Node: トランスポート<2>13529672
Ref: library/asyncio-llapi-index transports13529840
Ref: 3b8913529840
Node: プロトコル<3>13537250
Ref: library/asyncio-llapi-index protocols13537418
Ref: 3b8a13537418
Node: イベントループのポリシー13541981
Ref: library/asyncio-llapi-index event-loop-policies13542116
Ref: 3b8b13542116
Node: asyncio での開発13543137
Ref: library/asyncio-dev doc13543263
Ref: 3b8c13543263
Ref: library/asyncio-dev asyncio-dev13543263
Ref: 3b8d13543263
Ref: library/asyncio-dev developing-with-asyncio13543263
Ref: 3b8e13543263
Ref: library/asyncio-dev translation-repo13543263
Ref: 3b8f13543263
Node: デバッグモード13543852
Ref: library/asyncio-dev asyncio-debug-mode13543981
Ref: 234713543981
Ref: library/asyncio-dev debug-mode13543981
Ref: 3b9013543981
Node: 並行処理とマルチスレッド処理13545822
Ref: library/asyncio-dev asyncio-multithreading13545996
Ref: 3a4113545996
Ref: library/asyncio-dev concurrency-and-multithreading13545996
Ref: 3b9213545996
Node: ブロッキングコードの実行13549186
Ref: library/asyncio-dev asyncio-handle-blocking13549354
Ref: 3b9313549354
Ref: library/asyncio-dev running-blocking-code13549354
Ref: 3b9413549354
Node: ログ記録<3>13549995
Ref: library/asyncio-dev asyncio-logger13550178
Ref: 3b9113550178
Ref: library/asyncio-dev logging13550178
Ref: 3b9513550178
Node: 待ち受け処理を伴わないコルーチンの検出13550839
Ref: library/asyncio-dev asyncio-coroutine-not-scheduled13551019
Ref: 3b9713551019
Ref: library/asyncio-dev detect-never-awaited-coroutines13551019
Ref: 3b9813551019
Node: 回収されない例外の検出13552243
Ref: library/asyncio-dev detect-never-retrieved-exceptions13552446
Ref: 3b9913552446
Node: Asynchronous generators best practices13554170
Ref: library/asyncio-dev asynchronous-generators-best-practices13554307
Ref: 3b9a13554307
Node: Close asynchronous generators explicitly13554769
Ref: library/asyncio-dev close-asynchronous-generators-explicitly13554959
Ref: 3b9b13554959
Node: Create asynchronous generators only when the event loop is running13557720
Ref: library/asyncio-dev create-asynchronous-generators-only-when-the-event-loop-is-running13557979
Ref: 3b9d13557979
Node: Avoid concurrent iteration and closure of the same generator13560072
Ref: library/asyncio-dev avoid-concurrent-iteration-and-closure-of-the-same-generator13560282
Ref: 3b9e13560282
Ref: Avoid concurrent iteration and closure of the same generator-Footnote-113562110
Node: socket --- 低水準ネットワークインターフェース13562175
Ref: library/socket doc13562430
Ref: 3b9f13562430
Ref: library/socket module-socket13562430
Ref: d413562430
Ref: library/socket socket-low-level-networking-interface13562430
Ref: 3ba013562430
Ref: library/socket translation-repo13562430
Ref: 3ba113562430
Ref: socket --- 低水準ネットワークインターフェース-Footnote-113564479
Node: ソケットファミリー13564545
Ref: library/socket socket-addresses13564707
Ref: 3ba213564707
Ref: library/socket socket-families13564707
Ref: 3ba313564707
Ref: library/socket host-port13566438
Ref: 3ba413566438
Ref: ソケットファミリー-Footnote-113579327
Ref: ソケットファミリー-Footnote-213579369
Node: モジュールの内容<3>13579414
Ref: library/socket module-contents13579610
Ref: 3bb013579610
Node: 例外<19>13579802
Ref: library/socket exceptions13579894
Ref: 3bb113579894
Ref: library/socket socket error13579925
Ref: 140c13579925
Ref: library/socket socket herror13580165
Ref: 3bb213580165
Ref: library/socket socket gaierror13580884
Ref: 1ce413580884
Ref: library/socket socket timeout13581519
Ref: c1113581519
Ref: 例外<19>-Footnote-113582353
Node: 定数<8>13582395
Ref: library/socket constants13582505
Ref: 3bb413582505
Ref: library/socket socket AF_UNIX13582690
Ref: 1dc913582690
Ref: library/socket socket AF_INET13582720
Ref: 1dc613582720
Ref: library/socket socket AF_INET613582750
Ref: 1dc713582750
Ref: library/socket socket AF_UNSPEC13583070
Ref: 3af313583070
Ref: library/socket socket SOCK_STREAM13583286
Ref: 16ad13583286
Ref: library/socket socket SOCK_DGRAM13583320
Ref: 16ac13583320
Ref: library/socket socket SOCK_RAW13583353
Ref: 3bb513583353
Ref: library/socket socket SOCK_RDM13583384
Ref: 3bb613583384
Ref: library/socket socket SOCK_SEQPACKET13583415
Ref: 3bb713583415
Ref: library/socket socket SOCK_CLOEXEC13583722
Ref: fce13583722
Ref: library/socket socket SOCK_NONBLOCK13583757
Ref: fcd13583757
Ref: library/socket socket-unix-constants13584271
Ref: f3613584271
Ref: library/socket socket SOMAXCONN13584291
Ref: 121313584291
Ref: library/socket socket AF_CAN13587509
Ref: 3ba513587509
Ref: library/socket socket PF_CAN13587538
Ref: 3bb813587538
Ref: library/socket socket CAN_BCM13588013
Ref: 135113588013
Ref: library/socket socket CAN_RAW_FD_FRAMES13588500
Ref: 127b13588500
Ref: library/socket socket CAN_RAW_JOIN_FILTERS13589121
Ref: d0213589121
Ref: library/socket socket CAN_ISOTP13589461
Ref: 3ba613589461
Ref: library/socket socket CAN_J193913589718
Ref: d0313589718
Ref: library/socket socket AF_DIVERT13589959
Ref: 3bb913589959
Ref: library/socket socket PF_DIVERT13589991
Ref: 3bba13589991
Ref: library/socket socket AF_PACKET13590223
Ref: 3bac13590223
Ref: library/socket socket PF_PACKET13590255
Ref: 3bbb13590255
Ref: library/socket socket ETH_P_ALL13590486
Ref: 1d4013590486
Ref: library/socket socket AF_RDS13590842
Ref: 3bbc13590842
Ref: library/socket socket PF_RDS13590871
Ref: 3bbd13590871
Ref: library/socket socket SOL_RDS13590900
Ref: 3bbe13590900
Ref: library/socket socket SIO_RCVALL13591157
Ref: 3bbf13591157
Ref: library/socket socket SIO_KEEPALIVE_VALS13591190
Ref: 3bc013591190
Ref: library/socket socket SIO_LOOPBACK_FAST_PATH13591231
Ref: 109513591231
Ref: library/socket socket AF_ALG13591785
Ref: 109813591785
Ref: library/socket socket SOL_ALG13591814
Ref: 3bc113591814
Ref: library/socket socket AF_VSOCK13591997
Ref: f3713591997
Ref: library/socket socket IOCTL_VM_SOCKETS_GET_LOCAL_CID13592028
Ref: 3bc213592028
Ref: library/socket socket AF_LINK13592256
Ref: 135213592256
Ref: library/socket socket has_ipv613592360
Ref: 3bc313592360
Ref: library/socket socket AF_BLUETOOTH13592505
Ref: 1dc813592505
Ref: library/socket socket BTPROTO_L2CAP13592540
Ref: 51213592540
Ref: library/socket socket BTPROTO_RFCOMM13592576
Ref: 3baa13592576
Ref: library/socket socket BTPROTO_HCI13592613
Ref: 51013592613
Ref: library/socket socket BTPROTO_SCO13592647
Ref: 51113592647
Ref: library/socket socket BDADDR_ANY13592740
Ref: 3bc413592740
Ref: library/socket socket BDADDR_LOCAL13592773
Ref: 3bc513592773
Ref: library/socket socket BDADDR_BREDR13593119
Ref: 3ba713593119
Ref: library/socket socket BDADDR_LE_PUBLIC13593154
Ref: 3ba813593154
Ref: library/socket socket BDADDR_LE_RANDOM13593193
Ref: 3ba913593193
Ref: library/socket socket SOL_RFCOMM13593436
Ref: 3bc613593436
Ref: library/socket socket SOL_L2CAP13593469
Ref: 3bc713593469
Ref: library/socket socket SOL_HCI13593501
Ref: 3bc813593501
Ref: library/socket socket SOL_SCO13593531
Ref: 3bc913593531
Ref: library/socket socket SOL_BLUETOOTH13593561
Ref: 3bca13593561
Ref: library/socket socket L2CAP_LM13593903
Ref: 3bcb13593903
Ref: library/socket socket HCI_FILTER13594475
Ref: 3bcc13594475
Ref: library/socket socket HCI_TIME_STAMP13594508
Ref: 3bcd13594508
Ref: library/socket socket HCI_DATA_DIR13594545
Ref: 3bce13594545
Ref: library/socket socket SO_HCI_EVT_FILTER13594580
Ref: 3bcf13594580
Ref: library/socket socket SO_HCI_PKT_FILTER13594620
Ref: 3bd013594620
Ref: library/socket socket HCI_DEV_NONE13594986
Ref: 3bd113594986
Ref: library/socket socket HCI_CHANNEL_RAW13595207
Ref: 3bab13595207
Ref: library/socket socket HCI_CHANNEL_USER13595245
Ref: 3bd213595245
Ref: library/socket socket HCI_CHANNEL_MONITOR13595284
Ref: 3bd313595284
Ref: library/socket socket HCI_CHANNEL_CONTROL13595326
Ref: 3bd413595326
Ref: library/socket socket HCI_CHANNEL_LOGGING13595368
Ref: 3bd513595368
Ref: library/socket socket AF_QIPCRTR13595570
Ref: 3bad13595570
Ref: library/socket socket SCM_CREDS213595769
Ref: 3bd613595769
Ref: library/socket socket LOCAL_CREDS13595802
Ref: 3bd713595802
Ref: library/socket socket LOCAL_CREDS_PERSISTENT13595836
Ref: 3bd813595836
Ref: library/socket socket SO_INCOMING_CPU13596279
Ref: 3bd913596279
Ref: library/socket socket SO_REUSEPORT_LB13596490
Ref: 1b1413596490
Ref: library/socket socket AF_HYPERV13596704
Ref: 3bae13596704
Ref: library/socket socket HV_PROTOCOL_RAW13596736
Ref: 3bda13596736
Ref: library/socket socket HVSOCKET_CONNECT_TIMEOUT13596774
Ref: 3bdb13596774
Ref: library/socket socket HVSOCKET_CONNECT_TIMEOUT_MAX13596821
Ref: 3bdc13596821
Ref: library/socket socket HVSOCKET_CONNECTED_SUSPEND13596872
Ref: 3bdd13596872
Ref: library/socket socket HVSOCKET_ADDRESS_FLAG_PASSTHRU13596921
Ref: 3bde13596921
Ref: library/socket socket HV_GUID_ZERO13596974
Ref: 3bdf13596974
Ref: library/socket socket HV_GUID_WILDCARD13597009
Ref: 3be013597009
Ref: library/socket socket HV_GUID_BROADCAST13597048
Ref: 3be113597048
Ref: library/socket socket HV_GUID_CHILDREN13597088
Ref: 3be213597088
Ref: library/socket socket HV_GUID_LOOPBACK13597127
Ref: 3be313597127
Ref: library/socket socket HV_GUID_PARENT13597166
Ref: 3be413597166
Ref: library/socket socket-ethernet-types13597355
Ref: 1d4113597355
Ref: library/socket socket ETHERTYPE_ARP13597355
Ref: 3be513597355
Ref: library/socket socket ETHERTYPE_IP13597391
Ref: 3be613597391
Ref: library/socket socket ETHERTYPE_IPV613597426
Ref: 3be713597426
Ref: library/socket socket ETHERTYPE_VLAN13597463
Ref: 3be813597463
Ref: library/socket socket SHUT_RD13597635
Ref: 3be913597635
Ref: library/socket socket SHUT_WR13597665
Ref: 3bea13597665
Ref: library/socket socket SHUT_RDWR13597695
Ref: 3beb13597695
Ref: 定数<8>-Footnote-113597900
Ref: 定数<8>-Footnote-213597952
Ref: 定数<8>-Footnote-313597998
Node: 関数<8>13598078
Ref: library/socket functions13598169
Ref: 3bed13598169
Node: ソケットの作成13598281
Ref: library/socket creating-sockets13598378
Ref: 3bee13598378
Ref: library/socket socket socket13598509
Ref: 115e13598509
Ref: library/socket socket socketpair13601457
Ref: fb913601457
Ref: library/socket socket create_connection13602348
Ref: a6713602348
Ref: library/socket socket create_server13604164
Ref: df313604164
Ref: library/socket socket has_dualstack_ipv613605997
Ref: df413605997
Ref: library/socket socket fromfd13606195
Ref: 3bf013606195
Ref: library/socket socket fromshare13607121
Ref: fca13607121
Ref: library/socket socket SocketType13607439
Ref: 3bf213607439
Node: その他の関数<2>13607597
Ref: library/socket other-functions13607694
Ref: 3bf313607694
Ref: library/socket socket close13607816
Ref: f3413607816
Ref: library/socket socket getaddrinfo13608082
Ref: 194613608082
Ref: library/socket socket getfqdn13612703
Ref: 1d0b13612703
Ref: library/socket socket gethostbyname13613321
Ref: 3bf413613321
Ref: library/socket socket gethostbyname_ex13614154
Ref: 1e9a13614154
Ref: library/socket socket gethostname13614960
Ref: 326113614960
Ref: library/socket socket gethostbyaddr13615496
Ref: 1e9913615496
Ref: library/socket socket getnameinfo13616255
Ref: 1c6113616255
Ref: library/socket socket getprotobyname13617052
Ref: 3bf513617052
Ref: library/socket socket getservbyname13617547
Ref: 3bf613617547
Ref: library/socket socket getservbyport13618158
Ref: 3bf713618158
Ref: library/socket socket ntohl13618737
Ref: 3bf813618737
Ref: library/socket socket ntohs13619140
Ref: c5a13619140
Ref: library/socket socket htonl13619669
Ref: 3bf913619669
Ref: library/socket socket htons13620072
Ref: c5913620072
Ref: library/socket socket inet_aton13620601
Ref: d2f13620601
Ref: library/socket socket inet_ntoa13621594
Ref: 3bfa13621594
Ref: library/socket socket inet_pton13622626
Ref: d3013622626
Ref: library/socket socket inet_ntop13623542
Ref: 135313623542
Ref: library/socket socket CMSG_LEN13624814
Ref: 202513624814
Ref: library/socket socket CMSG_SPACE13625772
Ref: 202413625772
Ref: library/socket socket getdefaulttimeout13626927
Ref: 3bf113626927
Ref: library/socket socket setdefaulttimeout13627321
Ref: 3bb313627321
Ref: library/socket socket sethostname13627713
Ref: 14fc13627713
Ref: library/socket socket if_nameindex13628102
Ref: df513628102
Ref: library/socket socket if_nametoindex13629015
Ref: df613629015
Ref: library/socket socket if_indextoname13629612
Ref: df713629612
Ref: library/socket socket send_fds13630208
Ref: d0413630208
Ref: library/socket socket recv_fds13630684
Ref: d0513630684
Ref: その他の関数<2>-Footnote-113631274
Ref: その他の関数<2>-Footnote-213631327
Ref: その他の関数<2>-Footnote-313631378
Ref: その他の関数<2>-Footnote-413631422
Node: socket オブジェクト13631481
Ref: library/socket id113631695
Ref: 3bfb13631695
Ref: library/socket socket-objects13631695
Ref: 3bef13631695
Ref: library/socket socket socket accept13632189
Ref: 115f13632189
Ref: library/socket socket socket bind13633178
Ref: 148113633178
Ref: library/socket socket socket close13633582
Ref: 10fe13633582
Ref: library/socket socket socket connect13634636
Ref: 116013634636
Ref: library/socket socket socket connect_ex13635933
Ref: 18f213635933
Ref: library/socket socket socket detach13636711
Ref: 15d913636711
Ref: library/socket socket socket dup13637007
Ref: 3bfc13637007
Ref: library/socket socket socket fileno13637312
Ref: 3bfd13637312
Ref: library/socket socket socket get_inheritable13637781
Ref: 12b213637781
Ref: library/socket socket socket getpeername13638119
Ref: 3b3213638119
Ref: library/socket socket socket getsockname13638495
Ref: 51313638495
Ref: library/socket socket socket getsockopt13638784
Ref: 109613638784
Ref: library/socket socket socket getblocking13639542
Ref: f3313639542
Ref: library/socket socket socket gettimeout13639772
Ref: 3bfe13639772
Ref: library/socket socket socket ioctl13640202
Ref: 109413640202
Ref: library/socket socket socket listen13641047
Ref: 121213641047
Ref: library/socket socket socket makefile13641670
Ref: 155d13641670
Ref: library/socket socket socket recv13643138
Ref: 116113643138
Ref: library/socket socket socket recvfrom13643955
Ref: 116213643955
Ref: library/socket socket socket recvmsg13645050
Ref: 116313645050
Ref: library/socket socket socket recvmsg_into13649826
Ref: 14fb13649826
Ref: library/socket socket socket recvfrom_into13651761
Ref: 16d813651761
Ref: library/socket socket socket recv_into13652341
Ref: 16d713652341
Ref: library/socket socket socket send13652964
Ref: 116413652964
Ref: library/socket socket socket sendall13653897
Ref: 116513653897
Ref: library/socket socket socket sendto13655073
Ref: 116613655073
Ref: library/socket socket socket sendmsg13656070
Ref: 89113656070
Ref: library/socket socket socket sendmsg_afalg13658780
Ref: 109913658780
Ref: library/socket socket socket sendfile13659191
Ref: 121113659191
Ref: library/socket socket socket set_inheritable13660356
Ref: 12b313660356
Ref: library/socket socket socket setblocking13660587
Ref: 327713660587
Ref: library/socket socket socket settimeout13661319
Ref: 3baf13661319
Ref: library/socket socket socket setsockopt13662175
Ref: 109713662175
Ref: library/socket socket socket shutdown13663343
Ref: 3bec13663343
Ref: library/socket socket socket share13663754
Ref: fcb13663754
Ref: library/socket socket socket family13665040
Ref: 3c0113665040
Ref: library/socket socket socket type13665107
Ref: fcf13665107
Ref: library/socket socket socket proto13665166
Ref: 3c0213665166
Ref: socket オブジェクト-Footnote-113665268
Ref: socket オブジェクト-Footnote-213665310
Ref: socket オブジェクト-Footnote-313665352
Ref: socket オブジェクト-Footnote-413665402
Ref: socket オブジェクト-Footnote-513665476
Ref: socket オブジェクト-Footnote-613665520
Ref: socket オブジェクト-Footnote-713665562
Ref: socket オブジェクト-Footnote-813665606
Ref: socket オブジェクト-Footnote-913665648
Ref: socket オブジェクト-Footnote-1013665690
Ref: socket オブジェクト-Footnote-1113665735
Ref: socket オブジェクト-Footnote-1213665780
Ref: socket オブジェクト-Footnote-1313665823
Ref: socket オブジェクト-Footnote-1413665866
Ref: socket オブジェクト-Footnote-1513665909
Ref: socket オブジェクト-Footnote-1613665952
Node: ソケットタイムアウトの注意事項13666003
Ref: library/socket notes-on-socket-timeouts13666203
Ref: 3c0313666203
Ref: library/socket socket-timeouts13666203
Ref: 3c0013666203
Node: タイムアウトと connect メソッド13668154
Ref: library/socket timeouts-and-the-connect-method13668328
Ref: 3c0413668328
Node: タイムアウトと accept メソッド13668889
Ref: library/socket timeouts-and-the-accept-method13669063
Ref: 3c0513669063
Node: 使用例<27>13670127
Ref: library/socket example13670293
Ref: 3c0613670293
Ref: library/socket socket-example13670293
Ref: 3c0713670293
Ref: 使用例<27>-Footnote-113678551
Node: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー13678610
Ref: library/ssl doc13678870
Ref: 3c0813678870
Ref: library/ssl module-ssl13678870
Ref: d813678870
Ref: library/ssl ssl-tls-ssl-wrapper-for-socket-objects13678870
Ref: 3c0913678870
Ref: library/ssl translation-repo13678870
Ref: 3c0a13678870
Ref: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー-Footnote-113682431
Ref: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー-Footnote-213682494
Node: Functions constants and exceptions13682536
Ref: library/ssl functions-constants-and-exceptions13682692
Ref: 3c0b13682692
Node: ソケットの作成<2>13682992
Ref: library/ssl socket-creation13683123
Ref: 3c0c13683123
Node: コンテキストの作成13684656
Ref: library/ssl context-creation13684816
Ref: 3c0d13684816
Ref: library/ssl ssl create_default_context13685032
Ref: 69513685032
Ref: コンテキストの作成-Footnote-113689545
Ref: コンテキストの作成-Footnote-213689604
Ref: コンテキストの作成-Footnote-313689649
Node: Signature algorithms13689708
Ref: library/ssl signature-algorithms13689854
Ref: 3c1213689854
Ref: library/ssl ssl get_sigalgs13689915
Ref: 26c13689915
Node: 例外<20>13690453
Ref: library/ssl exceptions13690584
Ref: 3c1313690584
Ref: library/ssl ssl SSLError13690615
Ref: 163313690615
Ref: library/ssl ssl SSLError library13691317
Ref: 150713691317
Ref: library/ssl ssl SSLError reason13691624
Ref: 150813691624
Ref: library/ssl ssl SSLZeroReturnError13691904
Ref: 3c1413691904
Ref: library/ssl ssl SSLWantReadError13692307
Ref: 121d13692307
Ref: library/ssl ssl SSLWantWriteError13692701
Ref: 121e13692701
Ref: library/ssl ssl SSLSyscallError13693096
Ref: 3c1613693096
Ref: library/ssl ssl SSLEOFError13693441
Ref: 192413693441
Ref: library/ssl ssl SSLCertVerificationError13693768
Ref: f3f13693768
Ref: library/ssl ssl SSLCertVerificationError verify_code13693932
Ref: 3c1713693932
Ref: library/ssl ssl SSLCertVerificationError verify_message13694036
Ref: 3c1813694036
Ref: library/ssl ssl CertificateError13694134
Ref: 3c1913694134
Node: 乱数生成13694350
Ref: library/ssl random-generation13694485
Ref: 3c1a13694485
Ref: library/ssl ssl RAND_bytes13694526
Ref: 93713694526
Ref: library/ssl ssl RAND_status13695520
Ref: 1e9313695520
Ref: library/ssl ssl RAND_add13695804
Ref: 3c1b13695804
Ref: 乱数生成-Footnote-113696299
Ref: 乱数生成-Footnote-213696393
Ref: 乱数生成-Footnote-313696531
Node: 証明書の取り扱い13696590
Ref: library/ssl certificate-handling13696724
Ref: 3c1c13696724
Ref: library/ssl ssl cert_time_to_seconds13696785
Ref: 121f13696785
Ref: library/ssl ssl get_server_certificate13697809
Ref: c1913697809
Ref: library/ssl ssl DER_cert_to_PEM_cert13699061
Ref: 3c1e13699061
Ref: library/ssl ssl PEM_cert_to_DER_cert13699292
Ref: 3c1f13699292
Ref: library/ssl ssl get_default_verify_paths13699505
Ref: 135813699505
Ref: library/ssl ssl enum_certificates13700473
Ref: 136313700473
Ref: library/ssl ssl enum_crls13701560
Ref: 136413701560
Ref: 証明書の取り扱い-Footnote-113702280
Node: 定数<9>13702339
Ref: library/ssl constants13702452
Ref: 3c2013702452
Ref: library/ssl ssl CERT_NONE13702664
Ref: 3c2113702664
Ref: library/ssl ssl CERT_OPTIONAL13703302
Ref: 3c2213703302
Ref: library/ssl ssl CERT_REQUIRED13704051
Ref: 3c0f13704051
Ref: library/ssl ssl VerifyMode13705020
Ref: 3c2413705020
Ref: library/ssl ssl VERIFY_DEFAULT13705156
Ref: 135d13705156
Ref: library/ssl ssl VERIFY_CRL_CHECK_LEAF13705484
Ref: 135e13705484
Ref: library/ssl ssl VERIFY_CRL_CHECK_CHAIN13706024
Ref: 135f13706024
Ref: library/ssl ssl VERIFY_X509_STRICT13706310
Ref: 75813706310
Ref: library/ssl ssl VERIFY_ALLOW_PROXY_CERTS13706533
Ref: 1eaa13706533
Ref: library/ssl ssl VERIFY_X509_TRUSTED_FIRST13706717
Ref: 3c2513706717
Ref: library/ssl ssl VERIFY_X509_PARTIAL_CHAIN13707076
Ref: 69613707076
Ref: library/ssl ssl VerifyFlags13707516
Ref: 3c2613707516
Ref: library/ssl ssl PROTOCOL_TLS13707655
Ref: 3c1113707655
Ref: library/ssl ssl PROTOCOL_TLS_CLIENT13708261
Ref: c4c13708261
Ref: library/ssl ssl PROTOCOL_TLS_SERVER13708579
Ref: c4d13708579
Ref: library/ssl ssl PROTOCOL_SSLv2313708799
Ref: 3c2713708799
Ref: library/ssl ssl PROTOCOL_SSLv313709011
Ref: 3c1d13709011
Ref: library/ssl ssl PROTOCOL_TLSv113709725
Ref: 3c2813709725
Ref: library/ssl ssl PROTOCOL_TLSv1_113709957
Ref: 135613709957
Ref: library/ssl ssl PROTOCOL_TLSv1_213710278
Ref: 135713710278
Ref: library/ssl ssl OP_ALL13710601
Ref: 3c2913710601
Ref: library/ssl ssl OP_NO_SSLv213710992
Ref: c1613710992
Ref: library/ssl ssl OP_NO_SSLv313711397
Ref: c1713711397
Ref: library/ssl ssl OP_NO_TLSv113711802
Ref: 3c2a13711802
Ref: library/ssl ssl OP_NO_TLSv1_113712341
Ref: 3c2b13712341
Ref: library/ssl ssl OP_NO_TLSv1_213712850
Ref: 3c2c13712850
Ref: library/ssl ssl OP_NO_TLSv1_313713359
Ref: 1e7113713359
Ref: library/ssl ssl OP_NO_RENEGOTIATION13713956
Ref: 3c2d13713956
Ref: library/ssl ssl OP_CIPHER_SERVER_PREFERENCE13714260
Ref: 150913714260
Ref: library/ssl ssl OP_SINGLE_DH_USE13714584
Ref: 3c2e13714584
Ref: library/ssl ssl OP_SINGLE_ECDH_USE13714844
Ref: 3c2f13714844
Ref: library/ssl ssl OP_ENABLE_MIDDLEBOX_COMPAT13715108
Ref: 3c3013715108
Ref: library/ssl ssl OP_NO_COMPRESSION13715408
Ref: 150613715408
Ref: library/ssl ssl Options13715659
Ref: 3c3113715659
Ref: library/ssl ssl OP_NO_TICKET13715762
Ref: 3c3213715762
Ref: library/ssl ssl OP_IGNORE_UNEXPECTED_EOF13715941
Ref: c1413715941
Ref: library/ssl ssl OP_ENABLE_KTLS13716149
Ref: 1a6313716149
Ref: library/ssl ssl OP_LEGACY_SERVER_CONNECT13716879
Ref: 1d0f13716879
Ref: library/ssl ssl HAS_ALPN13717044
Ref: 121a13717044
Ref: library/ssl ssl HAS_NEVER_CHECK_COMMON_NAME13717294
Ref: 3c3313717294
Ref: library/ssl ssl HAS_ECDH13717537
Ref: 3c3413717537
Ref: library/ssl ssl HAS_SNI13717867
Ref: 3c3513717867
Ref: library/ssl ssl HAS_NPN13718093
Ref: 3c3613718093
Ref: library/ssl ssl HAS_SSLv213718517
Ref: 3c3713718517
Ref: library/ssl ssl HAS_SSLv313718698
Ref: 3c3813718698
Ref: library/ssl ssl HAS_TLSv113718879
Ref: 3c3913718879
Ref: library/ssl ssl HAS_TLSv1_113719060
Ref: f4613719060
Ref: library/ssl ssl HAS_TLSv1_213719243
Ref: 3c3a13719243
Ref: library/ssl ssl HAS_TLSv1_313719426
Ref: 3c3b13719426
Ref: library/ssl ssl HAS_PSK13719609
Ref: 3c3c13719609
Ref: library/ssl ssl HAS_PSK_TLS1313719734
Ref: 26513719734
Ref: library/ssl ssl HAS_PHA13719915
Ref: 51513719915
Ref: library/ssl ssl CHANNEL_BINDING_TYPES13720040
Ref: 3c3d13720040
Ref: library/ssl ssl OPENSSL_VERSION13720324
Ref: 15db13720324
Ref: library/ssl ssl OPENSSL_VERSION_INFO13720576
Ref: 15dc13720576
Ref: library/ssl ssl OPENSSL_VERSION_NUMBER13720802
Ref: 15dd13720802
Ref: library/ssl ssl ALERT_DESCRIPTION_HANDSHAKE_FAILURE13721094
Ref: 3c3e13721094
Ref: library/ssl ssl ALERT_DESCRIPTION_INTERNAL_ERROR13721149
Ref: 3c3f13721149
Ref: library/ssl ssl AlertDescription13721614
Ref: 3c4013721614
Ref: library/ssl ssl Purpose SERVER_AUTH13721776
Ref: 136113721776
Ref: library/ssl ssl Purpose CLIENT_AUTH13722186
Ref: 136213722186
Ref: library/ssl ssl SSLErrorNumber13722596
Ref: 3c4113722596
Ref: library/ssl ssl TLSVersion13722742
Ref: 3c4213722742
Ref: library/ssl ssl TLSVersion MINIMUM_SUPPORTED13722964
Ref: 3c4313722964
Ref: library/ssl ssl TLSVersion MAXIMUM_SUPPORTED13723009
Ref: 3c4413723009
Ref: library/ssl ssl TLSVersion SSLv313723230
Ref: 3c4513723230
Ref: library/ssl ssl TLSVersion TLSv113723263
Ref: 3c4613723263
Ref: library/ssl ssl TLSVersion TLSv1_113723296
Ref: 3c4713723296
Ref: library/ssl ssl TLSVersion TLSv1_213723331
Ref: 3c4813723331
Ref: library/ssl ssl TLSVersion TLSv1_313723366
Ref: 3c4913723366
Ref: 定数<9>-Footnote-113723634
Ref: 定数<9>-Footnote-213723693
Ref: 定数<9>-Footnote-313723752
Ref: 定数<9>-Footnote-413723830
Ref: 定数<9>-Footnote-513723889
Ref: 定数<9>-Footnote-613723948
Node: SSL sockets13724041
Ref: library/ssl ssl-sockets13724218
Ref: 3c4a13724218
Ref: library/ssl ssl SSLSocket13724261
Ref: cbf13724261
Ref: library/ssl ssl SSLSocket read13727403
Ref: 122213727403
Ref: library/ssl ssl SSLSocket write13728532
Ref: 122313728532
Ref: library/ssl ssl SSLSocket do_handshake13730118
Ref: 122113730118
Ref: library/ssl ssl SSLSocket getpeercert13731197
Ref: 136613731197
Ref: library/ssl ssl SSLSocket get_verified_chain13735137
Ref: 1b8e13735137
Ref: library/ssl ssl SSLSocket get_unverified_chain13735452
Ref: 1b8f13735452
Ref: library/ssl ssl SSLSocket cipher13735652
Ref: 3b3313735652
Ref: library/ssl ssl SSLSocket shared_ciphers13735990
Ref: 122013735990
Ref: library/ssl ssl SSLSocket group13736630
Ref: 26813736630
Ref: library/ssl ssl SSLSocket client_sigalg13736833
Ref: 26f13736833
Ref: library/ssl ssl SSLSocket server_sigalg13737131
Ref: 27013737131
Ref: library/ssl ssl SSLSocket compression13737412
Ref: 150513737412
Ref: library/ssl ssl SSLSocket get_channel_binding13737848
Ref: 150413737848
Ref: library/ssl ssl SSLSocket selected_alpn_protocol13738689
Ref: 121913738689
Ref: library/ssl ssl SSLSocket selected_npn_protocol13739230
Ref: c4e13739230
Ref: library/ssl ssl SSLSocket unwrap13739752
Ref: 3c4b13739752
Ref: library/ssl ssl SSLSocket verify_client_post_handshake13740314
Ref: dfa13740314
Ref: library/ssl ssl SSLSocket version13741201
Ref: 121c13741201
Ref: library/ssl ssl SSLSocket pending13741750
Ref: 3c4d13741750
Ref: library/ssl ssl SSLSocket context13741923
Ref: 3c4c13741923
Ref: library/ssl ssl SSLSocket server_side13742053
Ref: 3c4e13742053
Ref: library/ssl ssl SSLSocket server_hostname13742286
Ref: f4213742286
Ref: library/ssl ssl SSLSocket session13742838
Ref: 1b7613742838
Ref: library/ssl ssl SSLSocket session_reused13743317
Ref: 3c4f13743317
Ref: SSL sockets-Footnote-113743422
Ref: SSL sockets-Footnote-213743481
Node: SSL contexts13743540
Ref: library/ssl ssl-contexts13743692
Ref: 3c5013743692
Ref: library/ssl ssl SSLContext13744155
Ref: 33e13744155
Ref: library/ssl ssl SSLContext cert_store_stats13749182
Ref: 135a13749182
Ref: library/ssl ssl SSLContext load_cert_chain13749642
Ref: 79d13749642
Ref: library/ssl ssl SSLContext load_default_certs13751568
Ref: 136013751568
Ref: library/ssl ssl SSLContext load_verify_locations13752561
Ref: 129f13752561
Ref: library/ssl ssl SSLContext get_ca_certs13754352
Ref: 135b13754352
Ref: library/ssl ssl SSLContext get_ciphers13755203
Ref: 10a013755203
Ref: library/ssl ssl SSLContext get_groups13756593
Ref: 26913756593
Ref: library/ssl ssl SSLContext set_default_verify_paths13757459
Ref: 135913757459
Ref: library/ssl ssl SSLContext set_ciphers13758100
Ref: 26b13758100
Ref: library/ssl ssl SSLContext set_ciphersuites13758790
Ref: 26a13758790
Ref: library/ssl ssl SSLContext set_groups13759425
Ref: 26613759425
Ref: library/ssl ssl SSLContext set_client_sigalgs13759839
Ref: 26d13759839
Ref: library/ssl ssl SSLContext set_server_sigalgs13760343
Ref: 26e13760343
Ref: library/ssl ssl SSLContext set_alpn_protocols13760830
Ref: 121813760830
Ref: library/ssl ssl SSLContext set_npn_protocols13761578
Ref: 33f13761578
Ref: library/ssl ssl SSLContext sni_callback13762418
Ref: 1ea413762418
Ref: library/ssl ssl SSLContext set_servername_callback13765388
Ref: 136513765388
Ref: library/ssl ssl SSLContext load_dh_params13766068
Ref: 150313766068
Ref: library/ssl ssl SSLContext set_ecdh_curve13766819
Ref: 26713766819
Ref: library/ssl ssl SSLContext wrap_socket13767747
Ref: 93813767747
Ref: library/ssl ssl SSLContext sslsocket_class13771193
Ref: 3c5213771193
Ref: library/ssl ssl SSLContext wrap_bio13771505
Ref: f4513771505
Ref: library/ssl ssl SSLContext sslobject_class13772296
Ref: 3c5313772296
Ref: library/ssl ssl SSLContext session_stats13772581
Ref: 3c5413772581
Ref: library/ssl ssl SSLContext check_hostname13773052
Ref: 3c2313773052
Ref: library/ssl ssl SSLContext keylog_filename13774581
Ref: 3c1013774581
Ref: library/ssl ssl SSLContext maximum_version13775027
Ref: c4b13775027
Ref: library/ssl ssl SSLContext minimum_version13775869
Ref: c4a13775869
Ref: library/ssl ssl SSLContext num_tickets13776082
Ref: 3c5513776082
Ref: library/ssl ssl SSLContext options13776315
Ref: c1513776315
Ref: library/ssl ssl SSLContext post_handshake_auth13777124
Ref: df913777124
Ref: library/ssl ssl SSLContext protocol13777941
Ref: 3c5613777941
Ref: library/ssl ssl SSLContext hostname_checks_common_name13778113
Ref: f4013778113
Ref: library/ssl ssl SSLContext security_level13778553
Ref: 3c5713778553
Ref: library/ssl ssl SSLContext verify_flags13778728
Ref: 135c13778728
Ref: library/ssl ssl SSLContext verify_mode13779367
Ref: 3c0e13779367
Ref: library/ssl ssl SSLContext set_psk_client_callback13779981
Ref: 3c5813779981
Ref: library/ssl ssl SSLContext set_psk_server_callback13781986
Ref: 3c5913781986
Ref: SSL contexts-Footnote-113783874
Ref: SSL contexts-Footnote-213784028
Ref: SSL contexts-Footnote-313784160
Ref: SSL contexts-Footnote-413784293
Ref: SSL contexts-Footnote-513784447
Ref: SSL contexts-Footnote-613784579
Ref: SSL contexts-Footnote-713784712
Ref: SSL contexts-Footnote-813784789
Ref: SSL contexts-Footnote-913784843
Ref: SSL contexts-Footnote-1013784914
Ref: SSL contexts-Footnote-1113784995
Ref: SSL contexts-Footnote-1213785068
Ref: SSL contexts-Footnote-1313785128
Ref: SSL contexts-Footnote-1413785207
Ref: SSL contexts-Footnote-1513785267
Ref: SSL contexts-Footnote-1613785344
Ref: SSL contexts-Footnote-1713785410
Node: 証明書13785484
Ref: library/ssl certificates13785638
Ref: 3c5a13785638
Ref: library/ssl ssl-certificates13785638
Ref: 3c5113785638
Ref: 証明書-Footnote-113788382
Node: 証明書チェイン13788441
Ref: library/ssl certificate-chains13788529
Ref: 3c5b13788529
Node: CA 証明書13789891
Ref: library/ssl ca-certificates13790027
Ref: 3c5c13790027
Node: 秘密鍵と証明書の組み合わせ13790737
Ref: library/ssl combined-key-and-certificate13790873
Ref: 3c5d13790873
Node: 自己署名証明書13791498
Ref: library/ssl self-signed-certificates13791613
Ref: 3c5e13791613
Node: 使用例<28>13793227
Ref: library/ssl examples13793432
Ref: 3c5f13793432
Node: SSLサポートをテストする13793591
Ref: library/ssl testing-for-ssl-support13793719
Ref: 3c6013793719
Node: クライアントサイドの処理13794135
Ref: library/ssl client-side-operation13794299
Ref: 3c6113794299
Node: サーバサイドの処理13799387
Ref: library/ssl server-side-operation13799509
Ref: 3c6213799509
Node: ノンブロッキングソケットについての注意事項13801834
Ref: library/ssl notes-on-non-blocking-sockets13802048
Ref: 3c6313802048
Ref: library/ssl ssl-nonblocking13802048
Ref: 3c1513802048
Node: Memory BIO support13805840
Ref: library/ssl memory-bio-support13806060
Ref: 3c6413806060
Ref: library/ssl ssl SSLObject13807538
Ref: f4413807538
Ref: library/ssl ssl MemoryBIO13811815
Ref: 121613811815
Ref: library/ssl ssl MemoryBIO pending13811990
Ref: 3c6513811990
Ref: library/ssl ssl MemoryBIO eof13812100
Ref: 3c6613812100
Ref: library/ssl ssl MemoryBIO read13812219
Ref: 3c6713812219
Ref: library/ssl ssl MemoryBIO write13812438
Ref: 3c6813812438
Ref: library/ssl ssl MemoryBIO write_eof13812819
Ref: 3c6913812819
Node: SSL セッション13813179
Ref: library/ssl ssl-session13813378
Ref: 3c6a13813378
Ref: library/ssl ssl SSLSession13813457
Ref: 109f13813457
Ref: library/ssl ssl SSLSession id13813573
Ref: 3c6b13813573
Ref: library/ssl ssl SSLSession time13813597
Ref: 3c6c13813597
Ref: library/ssl ssl SSLSession timeout13813623
Ref: 3c6d13813623
Ref: library/ssl ssl SSLSession ticket_lifetime_hint13813652
Ref: 3c6e13813652
Ref: library/ssl ssl SSLSession has_ticket13813694
Ref: 3c6f13813694
Node: セキュリティで考慮すべき点<3>13813726
Ref: library/ssl security-considerations13813914
Ref: 3c7013813914
Ref: library/ssl ssl-security13813914
Ref: 3aee13813914
Node: 最善のデフォルト値13814096
Ref: library/ssl best-defaults13814229
Ref: 3c7113814229
Node: 手動での設定13815708
Ref: library/ssl manual-settings13815874
Ref: 3c7213815874
Node: 証明書の検証13816018
Ref: library/ssl verifying-certificates13816133
Ref: 3c7313816133
Node: プロトコルのバージョン13817390
Ref: library/ssl protocol-versions13817529
Ref: 3c7413817529
Node: 暗号の選択13818491
Ref: library/ssl cipher-selection13818603
Ref: 3c7513818603
Ref: 暗号の選択-Footnote-113819250
Node: マルチプロセス化13819322
Ref: library/ssl multi-processing13819452
Ref: 3c7613819452
Node: TLS 1 313819981
Ref: library/ssl ssl-tlsv1-313820141
Ref: f4313820141
Ref: library/ssl tls-1-313820141
Ref: 3c7713820141
Ref: TLS 1 3-Footnote-113822682
Ref: TLS 1 3-Footnote-213822748
Ref: TLS 1 3-Footnote-313822807
Ref: TLS 1 3-Footnote-413822866
Ref: TLS 1 3-Footnote-513822925
Ref: TLS 1 3-Footnote-613822984
Ref: TLS 1 3-Footnote-713823043
Ref: TLS 1 3-Footnote-813823119
Ref: TLS 1 3-Footnote-913823178
Node: select --- I/O 完了の待機13823236
Ref: library/select doc13823474
Ref: 3c7813823474
Ref: library/select module-select13823474
Ref: c913823474
Ref: library/select select-waiting-for-i-o-completion13823474
Ref: 3c7913823474
Ref: library/select translation-repo13823474
Ref: 3c7a13823474
Ref: library/select select error13824959
Ref: 140d13824959
Ref: library/select select devpoll13825199
Ref: 134413825199
Ref: library/select select epoll13826034
Ref: 134213826034
Ref: library/select select poll13827955
Ref: 27413827955
Ref: library/select select kqueue13828266
Ref: 27513828266
Ref: library/select select kevent13828657
Ref: 3c7f13828657
Ref: library/select select select13828950
Ref: 115d13828950
Ref: library/select select PIPE_BUF13831937
Ref: 15c713831937
Ref: select --- I/O 完了の待機-Footnote-113832665
Ref: select --- I/O 完了の待機-Footnote-213832707
Ref: select --- I/O 完了の待機-Footnote-313832760
Node: /dev/poll polling objects13832802
Ref: library/select dev-poll-polling-objects13832947
Ref: 3c8113832947
Ref: library/select devpoll-objects13832947
Ref: 3c7b13832947
Ref: library/select select devpoll close13833313
Ref: 134613833313
Ref: library/select select devpoll closed13833459
Ref: 134713833459
Ref: library/select select devpoll fileno13833603
Ref: 134513833603
Ref: library/select select devpoll register13833756
Ref: 3c8213833756
Ref: library/select select devpoll modify13834882
Ref: 3c8313834882
Ref: library/select select devpoll unregister13835096
Ref: 3c8413835096
Ref: library/select select devpoll poll13835555
Ref: 115913835555
Ref: /dev/poll polling objects-Footnote-113837367
Node: Edge and level trigger polling epoll objects13837409
Ref: library/select edge-and-level-trigger-polling-epoll-objects13837578
Ref: 3c8513837578
Ref: library/select epoll-objects13837578
Ref: 3c7c13837578
Ref: library/select select epoll close13840860
Ref: 134313840860
Ref: library/select select epoll closed13840976
Ref: 3c8613840976
Ref: library/select select epoll fileno13841075
Ref: 3c8713841075
Ref: library/select select epoll fromfd13841174
Ref: 3c8813841174
Ref: library/select select epoll register13841275
Ref: 3c8913841275
Ref: library/select select epoll modify13841388
Ref: 3c8a13841388
Ref: library/select select epoll unregister13841484
Ref: d2813841484
Ref: library/select select epoll poll13841725
Ref: 115a13841725
Ref: Edge and level trigger polling epoll objects-Footnote-113842535
Node: Polling objects13842577
Ref: library/select poll-objects13842735
Ref: 3c7d13842735
Ref: library/select polling-objects13842735
Ref: 3c8b13842735
Ref: library/select select poll register13843310
Ref: 3c8c13843310
Ref: library/select select poll modify13845582
Ref: 3c8d13845582
Ref: library/select select poll unregister13845961
Ref: 3c8e13845961
Ref: library/select select poll poll13846447
Ref: 115c13846447
Ref: Polling objects-Footnote-113848387
Node: Kqueue objects13848429
Ref: library/select id113848557
Ref: 3c8f13848557
Ref: library/select kqueue-objects13848557
Ref: 3c7e13848557
Ref: library/select select kqueue close13848606
Ref: 194713848606
Ref: library/select select kqueue closed13848721
Ref: 3c9013848721
Ref: library/select select kqueue fileno13848828
Ref: 3c9113848828
Ref: library/select select kqueue fromfd13848928
Ref: 3c9213848928
Ref: library/select select kqueue control13849061
Ref: 115b13849061
Ref: Kqueue objects-Footnote-113850046
Node: Kevent objects13850088
Ref: library/select id213850192
Ref: 3c9313850192
Ref: library/select kevent-objects13850192
Ref: 3c8013850192
Ref: library/select select kevent ident13850307
Ref: 3c9413850307
Ref: library/select select kevent filter13850695
Ref: 3c9513850695
Ref: library/select select kevent flags13852493
Ref: 3c9613852493
Ref: library/select select kevent fflags13854183
Ref: 3c9713854183
Ref: library/select select kevent data13858030
Ref: 3c9813858030
Ref: library/select select kevent udata13858086
Ref: 3c9913858086
Node: selectors --- 高水準の I/O 多重化13858141
Ref: library/selectors doc13858379
Ref: 3c9a13858379
Ref: library/selectors module-selectors13858379
Ref: ca13858379
Ref: library/selectors selectors-high-level-i-o-multiplexing13858379
Ref: 3c9b13858379
Ref: library/selectors translation-repo13858379
Ref: 3c9c13858379
Ref: selectors --- 高水準の I/O 多重化-Footnote-113858744
Node: はじめに<11>13858813
Ref: library/selectors introduction13858927
Ref: 3c9d13858927
Node: クラス<4>13860798
Ref: library/selectors classes13860934
Ref: 3ca013860934
Ref: library/selectors selectors EVENT_READ13861517
Ref: 3ca113861517
Ref: library/selectors selectors EVENT_WRITE13861609
Ref: 3ca213861609
Ref: library/selectors selectors SelectorKey13861683
Ref: 3ca313861683
Ref: library/selectors selectors SelectorKey fileobj13862061
Ref: 3ca413862061
Ref: library/selectors selectors SelectorKey fd13862156
Ref: 3ca513862156
Ref: library/selectors selectors SelectorKey events13862231
Ref: 3ca613862231
Ref: library/selectors selectors SelectorKey data13862364
Ref: 3ca713862364
Ref: library/selectors selectors BaseSelector13862653
Ref: 3c9e13862653
Ref: library/selectors selectors BaseSelector register13863628
Ref: 3ca813863628
Ref: library/selectors selectors BaseSelector unregister13864540
Ref: 3ca913864540
Ref: library/selectors selectors BaseSelector modify13865375
Ref: f9813865375
Ref: library/selectors selectors BaseSelector select13866120
Ref: 3caa13866120
Ref: library/selectors selectors BaseSelector close13868011
Ref: 3cab13868011
Ref: library/selectors selectors BaseSelector get_key13868292
Ref: 3cac13868292
Ref: library/selectors selectors BaseSelector get_map13868706
Ref: 3cad13868706
Ref: library/selectors selectors DefaultSelector13869118
Ref: 3c9f13869118
Ref: library/selectors selectors SelectSelector13869390
Ref: 3b6c13869390
Ref: library/selectors selectors PollSelector13869506
Ref: f9a13869506
Ref: library/selectors selectors EpollSelector13869617
Ref: f9913869617
Ref: library/selectors selectors EpollSelector fileno13869731
Ref: 3cae13869731
Ref: library/selectors selectors DevpollSelector13869904
Ref: f9b13869904
Ref: library/selectors selectors DevpollSelector fileno13870022
Ref: 3caf13870022
Ref: library/selectors selectors KqueueSelector13870225
Ref: 3b6f13870225
Ref: library/selectors selectors KqueueSelector fileno13870340
Ref: 3cb013870340
Ref: クラス<4>-Footnote-113870549
Node: 使用例<29>13870591
Ref: library/selectors examples13870702
Ref: 3cb113870702
Node: signal --- 非同期イベントにハンドラーを設定する13871727
Ref: library/signal doc13871989
Ref: 3cb213871989
Ref: library/signal module-signal13871989
Ref: ce13871989
Ref: library/signal signal-set-handlers-for-asynchronous-events13871989
Ref: 3cb313871989
Ref: library/signal translation-repo13871989
Ref: 3cb413871989
Ref: signal --- 非同期イベントにハンドラーを設定する-Footnote-113872562
Node: 一般的なルール13872628
Ref: library/signal general-rules13872787
Ref: 3cb513872787
Node: Python のシグナルハンドラの実行13874094
Ref: library/signal execution-of-python-signal-handlers13874231
Ref: 3cb713874231
Node: シグナルとスレッド13875612
Ref: library/signal id113875749
Ref: 3cb913875749
Ref: library/signal signals-and-threads13875749
Ref: 3cba13875749
Node: モジュールの内容<4>13876554
Ref: library/signal module-contents13876735
Ref: 3cbb13876735
Ref: library/signal signal Signals13877354
Ref: 3cbf13877354
Ref: library/signal signal Handlers13877505
Ref: 3cc013877505
Ref: library/signal signal Sigmasks13877676
Ref: 3cc113877676
Ref: library/signal signal SIG_DFL13878086
Ref: 1dcb13878086
Ref: library/signal signal SIG_IGN13878504
Ref: 1dca13878504
Ref: library/signal signal SIGABRT13878662
Ref: 143913878662
Ref: library/signal signal SIGALRM13878736
Ref: 3cc313878736
Ref: library/signal signal SIGBREAK13878849
Ref: 3cc413878849
Ref: library/signal signal SIGBUS13878969
Ref: 143a13878969
Ref: library/signal signal SIGCHLD13879075
Ref: 335613879075
Ref: library/signal signal SIGCLD13879188
Ref: 3cc513879188
Ref: library/signal signal SIGCONT13879317
Ref: 336413879317
Ref: library/signal signal SIGFPE13879441
Ref: 143813879441
Ref: library/signal signal SIGHUP13879677
Ref: 3cc613879677
Ref: library/signal signal SIGILL13879830
Ref: 143b13879830
Ref: library/signal signal SIGINT13879887
Ref: 4e613879887
Ref: library/signal signal SIGKILL13880022
Ref: f1a13880022
Ref: library/signal signal SIGPIPE13880159
Ref: 3cb613880159
Ref: library/signal signal SIGPROF13880325
Ref: 3cc713880325
Ref: library/signal signal SIGQUIT13880426
Ref: 3cc213880426
Ref: library/signal signal SIGSEGV13880524
Ref: 143713880524
Ref: library/signal signal SIGSTOP13880607
Ref: 3cc813880607
Ref: library/signal signal SIGSTKFLT13880729
Ref: 1e1d13880729
Ref: library/signal signal SIGTERM13881074
Ref: 179813881074
Ref: library/signal signal SIGUSR113881131
Ref: 3cc913881131
Ref: library/signal signal SIGUSR213881230
Ref: 3cca13881230
Ref: library/signal signal SIGVTALRM13881329
Ref: 3ccb13881329
Ref: library/signal signal SIGWINCH13881430
Ref: 3ccc13881430
Ref: library/signal signal SIGXCPU13881529
Ref: 3ccd13881529
Ref: library/signal signal CTRL_C_EVENT13882198
Ref: 172213882198
Ref: library/signal signal CTRL_BREAK_EVENT13882461
Ref: 172313882461
Ref: library/signal signal NSIG13882732
Ref: 1da613882732
Ref: library/signal signal ITIMER_REAL13882889
Ref: 3ccf13882889
Ref: library/signal signal ITIMER_VIRTUAL13883088
Ref: 3cd013883088
Ref: library/signal signal ITIMER_PROF13883313
Ref: 3cd113883313
Ref: library/signal signal SIG_BLOCK13883827
Ref: 3cbc13883827
Ref: library/signal signal SIG_UNBLOCK13884032
Ref: 3cbd13884032
Ref: library/signal signal SIG_SETMASK13884245
Ref: 3cbe13884245
Ref: library/signal signal ItimerError13884494
Ref: 3cd213884494
Ref: library/signal signal alarm13885130
Ref: 3cd513885130
Ref: library/signal signal getsignal13886039
Ref: 1c4c13886039
Ref: library/signal signal strsignal13886756
Ref: 202c13886756
Ref: library/signal signal valid_signals13887059
Ref: 3cce13887059
Ref: library/signal signal pause13887305
Ref: 3cd613887305
Ref: library/signal signal raise_signal13887769
Ref: 1daa13887769
Ref: library/signal signal pidfd_send_signal13887905
Ref: cfc13887905
Ref: library/signal signal pthread_kill13888533
Ref: 14f213888533
Ref: library/signal signal pthread_sigmask13889813
Ref: 14f113889813
Ref: library/signal signal setitimer13891670
Ref: 3cd313891670
Ref: library/signal signal getitimer13893008
Ref: 3cd413893008
Ref: library/signal signal set_wakeup_fd13893184
Ref: f3113893184
Ref: library/signal signal siginterrupt13895704
Ref: 14f613895704
Ref: library/signal signal signal13896415
Ref: 14f513896415
Ref: library/signal signal sigpending13898268
Ref: 14f313898268
Ref: library/signal signal sigwait13898803
Ref: 14f413898803
Ref: library/signal signal sigwaitinfo13899464
Ref: 116813899464
Ref: library/signal signal sigtimedwait13900761
Ref: 116713900761
Ref: モジュールの内容<4>-Footnote-113901671
Ref: モジュールの内容<4>-Footnote-213901722
Ref: モジュールの内容<4>-Footnote-313901777
Ref: モジュールの内容<4>-Footnote-413901822
Ref: モジュールの内容<4>-Footnote-513901867
Ref: モジュールの内容<4>-Footnote-613901913
Ref: モジュールの内容<4>-Footnote-713901959
Ref: モジュールの内容<4>-Footnote-813902005
Ref: モジュールの内容<4>-Footnote-913902050
Ref: モジュールの内容<4>-Footnote-1013902096
Ref: モジュールの内容<4>-Footnote-1113902154
Ref: モジュールの内容<4>-Footnote-1213902207
Ref: モジュールの内容<4>-Footnote-1313902259
Ref: モジュールの内容<4>-Footnote-1413902315
Ref: モジュールの内容<4>-Footnote-1513902368
Ref: モジュールの内容<4>-Footnote-1613902415
Ref: モジュールの内容<4>-Footnote-1713902466
Ref: モジュールの内容<4>-Footnote-1813902514
Ref: モジュールの内容<4>-Footnote-1913902566
Ref: モジュールの内容<4>-Footnote-2013902609
Ref: モジュールの内容<4>-Footnote-2113902662
Node: 使用例<30>13902705
Ref: library/signal examples13902880
Ref: 3cd713902880
Ref: library/signal signal-example13902880
Ref: 3cd813902880
Node: Note on SIGPIPE13904093
Ref: library/signal note-on-sigpipe13904279
Ref: 3cd913904279
Ref: Note on SIGPIPE-Footnote-113905726
Node: Note on Signal Handlers and Exceptions13905770
Ref: library/signal handlers-and-exceptions13905934
Ref: 290013905934
Ref: library/signal note-on-signal-handlers-and-exceptions13905934
Ref: 3cda13905934
Node: mmap --- メモリマップファイルのサポート13908525
Ref: library/mmap doc13908738
Ref: 3cdb13908738
Ref: library/mmap mmap-memory-mapped-file-support13908738
Ref: 3cdc13908738
Ref: library/mmap module-mmap13908738
Ref: 9413908738
Ref: library/mmap translation-repo13908738
Ref: 3cdd13908738
Ref: library/mmap mmap mmap13912501
Ref: 24713912501
Ref: library/mmap mmap mmap close13919488
Ref: 3ce113919488
Ref: library/mmap mmap mmap closed13919842
Ref: 3ce213919842
Ref: library/mmap mmap mmap find13919981
Ref: 3ce313919981
Ref: library/mmap mmap mmap flush13920569
Ref: e6213920569
Ref: library/mmap mmap mmap madvise13922170
Ref: dce13922170
Ref: library/mmap mmap mmap move13922744
Ref: 3ce613922744
Ref: library/mmap mmap mmap read13923062
Ref: 149e13923062
Ref: library/mmap mmap mmap read_byte13923677
Ref: 3ce713923677
Ref: library/mmap mmap mmap readline13923844
Ref: 3ce813923844
Ref: library/mmap mmap mmap resize13924075
Ref: 3f013924075
Ref: library/mmap mmap mmap rfind13925039
Ref: 3ce913925039
Ref: library/mmap mmap mmap seek13925628
Ref: 72413925628
Ref: library/mmap mmap mmap seekable13926225
Ref: 72313926225
Ref: library/mmap mmap mmap set_name13926401
Ref: 24813926401
Ref: library/mmap mmap mmap size13926967
Ref: 1a6513926967
Ref: library/mmap mmap mmap tell13927265
Ref: 3cea13927265
Ref: library/mmap mmap mmap write13927366
Ref: 110313927366
Ref: library/mmap mmap mmap write_byte13928270
Ref: 3ceb13928270
Node: MADV_* 定数13928715
Ref: library/mmap madv-constants13928840
Ref: 3cec13928840
Ref: library/mmap madvise-constants13928840
Ref: 3ce513928840
Ref: library/mmap mmap MADV_NORMAL13928885
Ref: 3ced13928885
Ref: library/mmap mmap MADV_RANDOM13928917
Ref: 3cee13928917
Ref: library/mmap mmap MADV_SEQUENTIAL13928949
Ref: 3cef13928949
Ref: library/mmap mmap MADV_WILLNEED13928985
Ref: 3cf013928985
Ref: library/mmap mmap MADV_DONTNEED13929019
Ref: 3cf113929019
Ref: library/mmap mmap MADV_REMOVE13929053
Ref: 3cf213929053
Ref: library/mmap mmap MADV_DONTFORK13929085
Ref: 3cf313929085
Ref: library/mmap mmap MADV_DOFORK13929119
Ref: 3cf413929119
Ref: library/mmap mmap MADV_HWPOISON13929151
Ref: 3cf513929151
Ref: library/mmap mmap MADV_MERGEABLE13929185
Ref: 3cf613929185
Ref: library/mmap mmap MADV_UNMERGEABLE13929220
Ref: 3cf713929220
Ref: library/mmap mmap MADV_SOFT_OFFLINE13929257
Ref: 3cf813929257
Ref: library/mmap mmap MADV_HUGEPAGE13929295
Ref: 3cf913929295
Ref: library/mmap mmap MADV_NOHUGEPAGE13929329
Ref: 3cfa13929329
Ref: library/mmap mmap MADV_DONTDUMP13929365
Ref: 3cfb13929365
Ref: library/mmap mmap MADV_DODUMP13929399
Ref: 3cfc13929399
Ref: library/mmap mmap MADV_FREE13929431
Ref: 3cfd13929431
Ref: library/mmap mmap MADV_NOSYNC13929461
Ref: 3cfe13929461
Ref: library/mmap mmap MADV_AUTOSYNC13929493
Ref: 3cff13929493
Ref: library/mmap mmap MADV_NOCORE13929527
Ref: 3d0013929527
Ref: library/mmap mmap MADV_CORE13929559
Ref: 3d0113929559
Ref: library/mmap mmap MADV_PROTECT13929589
Ref: 3d0213929589
Ref: library/mmap mmap MADV_FREE_REUSABLE13929622
Ref: 3d0313929622
Ref: library/mmap mmap MADV_FREE_REUSE13929661
Ref: 3d0413929661
Node: MAP_* 定数13929906
Ref: library/mmap id113930054
Ref: 3d0513930054
Ref: library/mmap map-constants13930054
Ref: 3ce013930054
Ref: library/mmap mmap MAP_SHARED13930097
Ref: 3cdf13930097
Ref: library/mmap mmap MAP_PRIVATE13930128
Ref: 3cde13930128
Ref: library/mmap mmap MAP_32BIT13930160
Ref: 1c4313930160
Ref: library/mmap mmap MAP_ALIGNED_SUPER13930190
Ref: 1ce713930190
Ref: library/mmap mmap MAP_ANON13930228
Ref: 3d0613930228
Ref: library/mmap mmap MAP_ANONYMOUS13930257
Ref: 3d0713930257
Ref: library/mmap mmap MAP_CONCEAL13930291
Ref: 1ce813930291
Ref: library/mmap mmap MAP_DENYWRITE13930323
Ref: 3d0813930323
Ref: library/mmap mmap MAP_EXECUTABLE13930357
Ref: 3d0913930357
Ref: library/mmap mmap MAP_HASSEMAPHORE13930392
Ref: 1c3e13930392
Ref: library/mmap mmap MAP_JIT13930429
Ref: 1c4013930429
Ref: library/mmap mmap MAP_NOCACHE13930457
Ref: 1c3f13930457
Ref: library/mmap mmap MAP_NOEXTEND13930489
Ref: 1c3d13930489
Ref: library/mmap mmap MAP_NORESERVE13930522
Ref: 1c3c13930522
Ref: library/mmap mmap MAP_POPULATE13930556
Ref: 1f4213930556
Ref: library/mmap mmap MAP_RESILIENT_CODESIGN13930589
Ref: 1c4113930589
Ref: library/mmap mmap MAP_RESILIENT_MEDIA13930632
Ref: 1c4213930632
Ref: library/mmap mmap MAP_STACK13930672
Ref: 3d0a13930672
Ref: library/mmap mmap MAP_TPRO13930702
Ref: 1c4613930702
Ref: library/mmap mmap MAP_TRANSLATED_ALLOW_EXECUTE13930731
Ref: 1c4413930731
Ref: library/mmap mmap MAP_UNIX0313930780
Ref: 1c4513930780
Node: MS_* Constants13931612
Ref: library/mmap id213931738
Ref: 3d0b13931738
Ref: library/mmap ms-constants13931738
Ref: 3ce413931738
Ref: library/mmap mmap MS_SYNC13931787
Ref: 3d0c13931787
Ref: library/mmap mmap MS_ASYNC13931815
Ref: 3d0d13931815
Ref: library/mmap mmap MS_INVALIDATE13931844
Ref: 3d0e13931844
Node: インターネット上のデータの操作13932425
Ref: library/netdata doc13932637
Ref: 3d0f13932637
Ref: library/netdata internet-data-handling13932637
Ref: 3d1013932637
Ref: library/netdata netdata13932637
Ref: 3d1113932637
Ref: library/netdata translation-repo13932637
Ref: 3d1213932637
Node: email --- 電子メールと MIME 処理のためのパッケージ13933797
Ref: library/email doc13934005
Ref: 3d1313934005
Ref: library/email email-an-email-and-mime-handling-package13934005
Ref: 3d1413934005
Ref: library/email module-email13934005
Ref: 3e13934005
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-113940786
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-213940860
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-313940919
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-413940978
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-513941037
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-613941096
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-713941155
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-813941214
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-913941273
Node: email message Representing an email message13941332
Ref: library/email message doc13941523
Ref: 3d1513941523
Ref: library/email message email-message-representing-an-email-message13941523
Ref: 3d1613941523
Ref: library/email message module-email message13941523
Ref: 4713941523
Ref: library/email message email message EmailMessage13943988
Ref: 22113943988
Ref: library/email message email message EmailMessage as_string13944478
Ref: 3d1813944478
Ref: library/email message email message EmailMessage __str__13946426
Ref: 3d1a13946426
Ref: library/email message email message EmailMessage as_bytes13946908
Ref: 3d1b13946908
Ref: library/email message email message EmailMessage __bytes__13948164
Ref: 3d1c13948164
Ref: library/email message email message EmailMessage is_multipart13948346
Ref: 3d1d13948346
Ref: library/email message email message EmailMessage set_unixfrom13949006
Ref: 3d1e13949006
Ref: library/email message email message EmailMessage get_unixfrom13949232
Ref: 3d2013949232
Ref: library/email message email message EmailMessage __len__13950472
Ref: 3d2213950472
Ref: library/email message email message EmailMessage __contains__13950594
Ref: 3d2313950594
Ref: library/email message email message EmailMessage __getitem__13950990
Ref: 3d2413950990
Ref: library/email message email message EmailMessage __setitem__13951711
Ref: 3d2713951711
Ref: library/email message email message EmailMessage __delitem__13952941
Ref: 3d2813952941
Ref: library/email message email message EmailMessage keys13953229
Ref: 3d2113953229
Ref: library/email message email message EmailMessage values13953383
Ref: 3d2913953383
Ref: library/email message email message EmailMessage items13953519
Ref: 3d2a13953519
Ref: library/email message email message EmailMessage get13953707
Ref: 3d2b13953707
Ref: library/email message email message EmailMessage get_all13954061
Ref: 3d2513954061
Ref: library/email message email message EmailMessage add_header13954395
Ref: 3d2c13954395
Ref: library/email message email message EmailMessage replace_header13956480
Ref: 3d2d13956480
Ref: library/email message email message EmailMessage get_content_type13956792
Ref: 3d2e13956792
Ref: library/email message email message EmailMessage get_content_maintype13957672
Ref: 3d3013957672
Ref: library/email message email message EmailMessage get_content_subtype13957920
Ref: 3d3113957920
Ref: library/email message email message EmailMessage get_default_type13958197
Ref: 3d2f13958197
Ref: library/email message email message EmailMessage set_default_type13958574
Ref: 3d3213958574
Ref: library/email message email message EmailMessage set_param13959022
Ref: 3d3313959022
Ref: library/email message email message EmailMessage del_param13960680
Ref: 3d3513960680
Ref: library/email message email message EmailMessage get_filename13961243
Ref: 3d3613961243
Ref: library/email message email message EmailMessage get_boundary13961841
Ref: 3d3813961841
Ref: library/email message email message EmailMessage set_boundary13962302
Ref: 3d3913962302
Ref: library/email message email message EmailMessage get_content_charset13963069
Ref: 3d3b13963069
Ref: library/email message email message EmailMessage get_charsets13963509
Ref: 3d3c13963509
Ref: library/email message email message EmailMessage is_attachment13964392
Ref: 3d3d13964392
Ref: library/email message email message EmailMessage get_content_disposition13964861
Ref: 3d3f13964861
Ref: library/email message email message EmailMessage walk13965342
Ref: 3d4013965342
Ref: library/email message email message EmailMessage get_body13967576
Ref: 3d4113967576
Ref: library/email message email message EmailMessage iter_attachments13969704
Ref: 3d4213969704
Ref: library/email message email message EmailMessage iter_parts13970678
Ref: 3d4313970678
Ref: library/email message email message EmailMessage get_content13970897
Ref: 3d4413970897
Ref: library/email message email message EmailMessage set_content13971313
Ref: 1e7313971313
Ref: library/email message email message EmailMessage make_related13971729
Ref: 3d4713971729
Ref: library/email message email message EmailMessage make_alternative13972223
Ref: 3d4813972223
Ref: library/email message email message EmailMessage make_mixed13972748
Ref: 3d4913972748
Ref: library/email message email message EmailMessage add_related13973293
Ref: 3d4a13973293
Ref: library/email message email message EmailMessage add_alternative13974056
Ref: 3d4c13974056
Ref: library/email message email message EmailMessage add_attachment13974752
Ref: 3d4d13974752
Ref: library/email message email message EmailMessage clear13975743
Ref: 3d4e13975743
Ref: library/email message email message EmailMessage clear_content13975845
Ref: 3d4f13975845
Ref: library/email message email message EmailMessage preamble13976142
Ref: 3d5013976142
Ref: library/email message email message EmailMessage epilogue13977895
Ref: 3d5113977895
Ref: library/email message email message EmailMessage defects13978241
Ref: 3d5213978241
Ref: library/email message email message MIMEPart13978597
Ref: 12eb13978597
Ref: email message Representing an email message-Footnote-113978980
Ref: email message Representing an email message-Footnote-213979053
Ref: email message Representing an email message-Footnote-313979265
Ref: email message Representing an email message-Footnote-413979324
Ref: email message Representing an email message-Footnote-513979383
Ref: email message Representing an email message-Footnote-613979442
Ref: email message Representing an email message-Footnote-713979760
Ref: email message Representing an email message-Footnote-813979819
Ref: email message Representing an email message-Footnote-913979878
Ref: email message Representing an email message-Footnote-1013979937
Ref: email message Representing an email message-Footnote-1113979997
Ref: email message Representing an email message-Footnote-1213980057
Ref: email message Representing an email message-Footnote-1313980117
Ref: email message Representing an email message-Footnote-1413980177
Node: email parser Parsing email messages13980237
Ref: library/email parser doc13980478
Ref: 3d5313980478
Ref: library/email parser email-parser-parsing-email-messages13980478
Ref: 3d5413980478
Ref: library/email parser module-email parser13980478
Ref: 5113980478
Ref: library/email parser translation-repo13980478
Ref: 3d5513980478
Ref: email parser Parsing email messages-Footnote-113982851
Node: FeedParser API13982923
Ref: library/email parser feedparser-api13983028
Ref: 3d5613983028
Ref: library/email parser email parser BytesFeedParser13984612
Ref: 158913984612
Ref: library/email parser email parser BytesFeedParser feed13985858
Ref: 3d5713985858
Ref: library/email parser email parser BytesFeedParser close13986409
Ref: 3d5813986409
Ref: library/email parser email parser FeedParser13986655
Ref: 19ca13986655
Node: Parser API13987162
Ref: library/email parser parser-api13987288
Ref: 3d5913987288
Ref: library/email parser email parser BytesParser13987995
Ref: 158a13987995
Ref: library/email parser email parser BytesParser parse13988689
Ref: 3d5a13988689
Ref: library/email parser email parser BytesParser parsebytes13989785
Ref: 3d5b13989785
Ref: library/email parser email parser BytesHeaderParser13990308
Ref: 147b13990308
Ref: library/email parser email parser Parser13990533
Ref: 155b13990533
Ref: library/email parser email parser Parser parse13990908
Ref: 3d5c13990908
Ref: library/email parser email parser Parser parsestr13991584
Ref: 3d5d13991584
Ref: library/email parser email parser HeaderParser13992170
Ref: 147c13992170
Ref: library/email parser email message_from_bytes13992675
Ref: 158713992675
Ref: library/email parser email message_from_binary_file13993259
Ref: 158813993259
Ref: library/email parser email message_from_string13993843
Ref: 3d5e13993843
Ref: library/email parser email message_from_file13994327
Ref: 3d5f13994327
Ref: Parser API-Footnote-113995192
Ref: Parser API-Footnote-213995251
Node: 追記事項13995310
Ref: library/email parser additional-notes13995413
Ref: 3d6013995413
Node: email generator Generating MIME documents13997184
Ref: library/email generator doc13997409
Ref: 3d6213997409
Ref: library/email generator email-generator-generating-mime-documents13997409
Ref: 3d6313997409
Ref: library/email generator module-email generator13997409
Ref: 4313997409
Ref: library/email generator translation-repo13997409
Ref: 3d6413997409
Ref: library/email generator email generator BytesGenerator13999497
Ref: 158d13999497
Ref: library/email generator email generator BytesGenerator flatten14001450
Ref: 3d6614001450
Ref: library/email generator email generator BytesGenerator clone14003367
Ref: 3d6914003367
Ref: library/email generator email generator BytesGenerator write14003565
Ref: 3d6714003565
Ref: library/email generator email generator Generator14004591
Ref: 158c14004591
Ref: library/email generator email generator Generator flatten14006482
Ref: 3d6a14006482
Ref: library/email generator email generator Generator clone14008390
Ref: 3d6c14008390
Ref: library/email generator email generator Generator write14008565
Ref: 3d6b14008565
Ref: library/email generator email generator DecodedGenerator14009464
Ref: 105c14009464
Ref: email generator Generating MIME documents-Footnote-114010928
Ref: email generator Generating MIME documents-Footnote-214011004
Ref: email generator Generating MIME documents-Footnote-314011511
Ref: email generator Generating MIME documents-Footnote-414011563
Ref: email generator Generating MIME documents-Footnote-514011622
Ref: email generator Generating MIME documents-Footnote-614011674
Node: email policy Policy Objects14011733
Ref: library/email policy doc14011964
Ref: 3d6d14011964
Ref: library/email policy email-policy-policy-objects14011964
Ref: 3d6e14011964
Ref: library/email policy module-email policy14011964
Ref: 5214011964
Ref: library/email policy translation-repo14011964
Ref: 3d6f14011964
Ref: library/email policy email policy Policy14018322
Ref: 147114018322
Ref: library/email policy email policy Policy max_line_length14019149
Ref: 3d1914019149
Ref: library/email policy email policy Policy linesep14019536
Ref: 3d7014019536
Ref: library/email policy email policy Policy cte_type14019803
Ref: 3d6814019803
Ref: library/email policy email policy Policy raise_on_defect14020910
Ref: 3d7214020910
Ref: library/email policy email policy Policy mangle_from_14021154
Ref: 11b314021154
Ref: library/email policy email policy Policy message_factory14021479
Ref: 105d14021479
Ref: library/email policy email policy Policy verify_generated_headers14021756
Ref: 6fd14021756
Ref: library/email policy email policy Policy clone14022595
Ref: 147314022595
Ref: library/email policy email policy Policy handle_defect14023063
Ref: 3d7414023063
Ref: library/email policy email policy Policy register_defect14023561
Ref: 3d7314023561
Ref: library/email policy email policy Policy header_max_count14024273
Ref: 3d7614024273
Ref: library/email policy email policy Policy header_source_parse14025357
Ref: 3d7714025357
Ref: library/email policy email policy Policy header_store_parse14026452
Ref: 3d7814026452
Ref: library/email policy email policy Policy header_fetch_parse14027230
Ref: 3d7914027230
Ref: library/email policy email policy Policy fold14028164
Ref: 3d7a14028164
Ref: library/email policy email policy Policy fold_binary14028981
Ref: 3d7114028981
Ref: library/email policy email policy EmailPolicy14029427
Ref: 147514029427
Ref: library/email policy email policy EmailPolicy utf814030265
Ref: 22214030265
Ref: library/email policy email policy EmailPolicy refold_source14031600
Ref: 3d6514031600
Ref: library/email policy email policy EmailPolicy header_factory14032408
Ref: 3d7b14032408
Ref: library/email policy email policy EmailPolicy content_manager14033019
Ref: 12ea14033019
Ref: library/email policy email policy EmailPolicy header_max_count14033721
Ref: 3d7d14033721
Ref: library/email policy email policy EmailPolicy header_source_parse14033933
Ref: 1b4c14033933
Ref: library/email policy email policy EmailPolicy header_store_parse14034320
Ref: 3d7f14034320
Ref: library/email policy email policy EmailPolicy header_fetch_parse14034807
Ref: 3d8014034807
Ref: library/email policy email policy EmailPolicy fold14035239
Ref: 1c1a14035239
Ref: library/email policy email policy EmailPolicy fold_binary14036404
Ref: 3d8114036404
Ref: library/email policy email policy default14037252
Ref: 147614037252
Ref: library/email policy email policy SMTP14037511
Ref: 147714037511
Ref: library/email policy email policy SMTPUTF814037718
Ref: 193214037718
Ref: library/email policy email policy HTTP14038138
Ref: 3d8214038138
Ref: library/email policy email policy strict14038335
Ref: 3d8314038335
Ref: library/email policy email policy Compat3214039739
Ref: 147214039739
Ref: library/email policy email policy Compat32 mangle_from_14040263
Ref: 3d8414040263
Ref: library/email policy email policy Compat32 header_source_parse14040455
Ref: 1b4d14040455
Ref: library/email policy email policy Compat32 header_store_parse14040842
Ref: 3d8514040842
Ref: library/email policy email policy Compat32 header_fetch_parse14040962
Ref: 3d8614040962
Ref: library/email policy email policy Compat32 fold14041210
Ref: 3d8714041210
Ref: library/email policy email policy Compat32 fold_binary14041559
Ref: 3d8814041559
Ref: library/email policy email policy compat3214042095
Ref: 105e14042095
Ref: email policy Policy Objects-Footnote-114042579
Ref: email policy Policy Objects-Footnote-214042651
Ref: email policy Policy Objects-Footnote-314042710
Ref: email policy Policy Objects-Footnote-414042769
Ref: email policy Policy Objects-Footnote-514042828
Ref: email policy Policy Objects-Footnote-614042887
Ref: email policy Policy Objects-Footnote-714042946
Ref: email policy Policy Objects-Footnote-814043005
Ref: email policy Policy Objects-Footnote-914043075
Ref: email policy Policy Objects-Footnote-1014043134
Ref: email policy Policy Objects-Footnote-1114043194
Ref: email policy Policy Objects-Footnote-1214043254
Ref: email policy Policy Objects-Footnote-1314043314
Ref: email policy Policy Objects-Footnote-1414043374
Ref: email policy Policy Objects-Footnote-1514043414
Ref: email policy Policy Objects-Footnote-1614043455
Ref: email policy Policy Objects-Footnote-1714043515
Node: email errors Exception and Defect classes14043575
Ref: library/email errors doc14043807
Ref: 3d8914043807
Ref: library/email errors email-errors-exception-and-defect-classes14043807
Ref: 3d8a14043807
Ref: library/email errors module-email errors14043807
Ref: 4214043807
Ref: library/email errors translation-repo14043807
Ref: 3d8b14043807
Ref: library/email errors email errors MessageError14044113
Ref: 3d8c14044113
Ref: library/email errors email errors MessageParseError14044407
Ref: 3d8d14044407
Ref: library/email errors email errors HeaderParseError14044681
Ref: 3d3a14044681
Ref: library/email errors email errors BoundaryError14045321
Ref: 3d8e14045321
Ref: library/email errors email errors MultipartConversionError14045398
Ref: 3d8f14045398
Ref: library/email errors email errors HeaderWriteError14045749
Ref: 193114045749
Ref: library/email errors email errors MessageDefect14045878
Ref: 3d7514045878
Ref: library/email errors email errors HeaderDefect14046046
Ref: 3d9214046046
Ref: library/email errors email errors NoBoundaryInMultipartDefect14046831
Ref: 3d9314046831
Ref: library/email errors email errors StartBoundaryNotFoundDefect14046970
Ref: 3d9414046970
Ref: library/email errors email errors CloseBoundaryNotFoundDefect14047112
Ref: 3d9514047112
Ref: library/email errors email errors FirstHeaderLineIsContinuationDefect14047285
Ref: 3d9614047285
Ref: library/email errors email errors MisplacedEnvelopeHeaderDefect14047415
Ref: 3d9714047415
Ref: library/email errors email errors MissingHeaderBodySeparatorDefect14047541
Ref: 3d9814047541
Ref: library/email errors email errors MalformedHeaderDefect14047818
Ref: 3d9914047818
Ref: library/email errors email errors MultipartInvariantViolationDefect14048084
Ref: 3d6114048084
Ref: library/email errors email errors InvalidBase64PaddingDefect14048399
Ref: 3d9a14048399
Ref: library/email errors email errors InvalidBase64CharactersDefect14048640
Ref: 3d9b14048640
Ref: library/email errors email errors InvalidBase64LengthDefect14048893
Ref: 3d9c14048893
Ref: library/email errors email errors InvalidDateDefect14049130
Ref: 3d9d14049130
Ref: email errors Exception and Defect classes-Footnote-114049307
Ref: email errors Exception and Defect classes-Footnote-214049379
Node: email headerregistry Custom Header Objects14049438
Ref: library/email headerregistry doc14049685
Ref: 3d9e14049685
Ref: library/email headerregistry email-headerregistry-custom-header-objects14049685
Ref: 3d9f14049685
Ref: library/email headerregistry module-email headerregistry14049685
Ref: 4514049685
Ref: library/email headerregistry translation-repo14049685
Ref: 3da014049685
Ref: library/email headerregistry email headerregistry BaseHeader14052134
Ref: 3d2614052134
Ref: library/email headerregistry email headerregistry BaseHeader name14052529
Ref: 3da314052529
Ref: library/email headerregistry email headerregistry BaseHeader defects14052812
Ref: 3da414052812
Ref: library/email headerregistry email headerregistry BaseHeader max_count14053303
Ref: 3d7e14053303
Ref: library/email headerregistry email headerregistry BaseHeader fold14053971
Ref: 3da514053971
Ref: library/email headerregistry email headerregistry UnstructuredHeader14056728
Ref: 3da214056728
Ref: library/email headerregistry email headerregistry DateHeader14058187
Ref: 3da614058187
Ref: library/email headerregistry email headerregistry DateHeader datetime14058549
Ref: 3da714058549
Ref: library/email headerregistry email headerregistry AddressHeader14060300
Ref: 3da814060300
Ref: library/email headerregistry email headerregistry AddressHeader groups14060657
Ref: 3da914060657
Ref: library/email headerregistry email headerregistry AddressHeader addresses14061058
Ref: 3dac14061058
Ref: library/email headerregistry email headerregistry SingleAddressHeader14062313
Ref: 3dad14062313
Ref: library/email headerregistry email headerregistry SingleAddressHeader address14062462
Ref: 3dae14062462
Ref: library/email headerregistry email headerregistry MIMEVersionHeader14062994
Ref: 3daf14062994
Ref: library/email headerregistry email headerregistry MIMEVersionHeader version14063390
Ref: 3db014063390
Ref: library/email headerregistry email headerregistry MIMEVersionHeader major14063509
Ref: 3db114063509
Ref: library/email headerregistry email headerregistry MIMEVersionHeader minor14063590
Ref: 3db214063590
Ref: library/email headerregistry email headerregistry ParameterizedMIMEHeader14063671
Ref: 3db314063671
Ref: library/email headerregistry email headerregistry ParameterizedMIMEHeader params14064054
Ref: 3d3414064054
Ref: library/email headerregistry email headerregistry ContentTypeHeader14064287
Ref: 3db414064287
Ref: library/email headerregistry email headerregistry ContentTypeHeader content_type14064448
Ref: 3db514064448
Ref: library/email headerregistry email headerregistry ContentTypeHeader maintype14064554
Ref: 3db614064554
Ref: library/email headerregistry email headerregistry ContentTypeHeader subtype14064584
Ref: 3db714064584
Ref: library/email headerregistry email headerregistry ContentDispositionHeader14064613
Ref: 3db814064613
Ref: library/email headerregistry email headerregistry ContentDispositionHeader content_disposition14064787
Ref: 3db914064787
Ref: library/email headerregistry email headerregistry ContentTransferEncodingHeader14064924
Ref: 3dba14064924
Ref: library/email headerregistry email headerregistry ContentTransferEncodingHeader cte14065057
Ref: 3dbb14065057
Ref: library/email headerregistry email headerregistry HeaderRegistry14065259
Ref: 3da114065259
Ref: library/email headerregistry email headerregistry HeaderRegistry map_to_type14067020
Ref: 3dbc14067020
Ref: library/email headerregistry email headerregistry HeaderRegistry __getitem__14067361
Ref: 3dbd14067361
Ref: library/email headerregistry email headerregistry HeaderRegistry __call__14067490
Ref: 3dbe14067490
Ref: library/email headerregistry email headerregistry Address14068136
Ref: 193314068136
Ref: library/email headerregistry email headerregistry Address display_name14069027
Ref: 3dbf14069027
Ref: library/email headerregistry email headerregistry Address username14069253
Ref: 3dc014069253
Ref: library/email headerregistry email headerregistry Address domain14069374
Ref: 3dc114069374
Ref: library/email headerregistry email headerregistry Address addr_spec14069452
Ref: 3dc214069452
Ref: library/email headerregistry email headerregistry Address __str__14069670
Ref: 3dc314069670
Ref: library/email headerregistry email headerregistry Group14070115
Ref: 3daa14070115
Ref: library/email headerregistry email headerregistry Group display_name14070706
Ref: 3dab14070706
Ref: library/email headerregistry email headerregistry Group addresses14070961
Ref: 3dc414070961
Ref: library/email headerregistry email headerregistry Group __str__14071109
Ref: 3dc514071109
Ref: email headerregistry Custom Header Objects-Footnote-114071568
Ref: email headerregistry Custom Header Objects-Footnote-214071649
Ref: email headerregistry Custom Header Objects-Footnote-314071718
Ref: email headerregistry Custom Header Objects-Footnote-414071777
Ref: email headerregistry Custom Header Objects-Footnote-514071836
Ref: email headerregistry Custom Header Objects-Footnote-614071895
Ref: email headerregistry Custom Header Objects-Footnote-714071954
Ref: email headerregistry Custom Header Objects-Footnote-814072013
Ref: email headerregistry Custom Header Objects-Footnote-914072072
Ref: email headerregistry Custom Header Objects-Footnote-1014072131
Ref: email headerregistry Custom Header Objects-Footnote-1114072191
Ref: email headerregistry Custom Header Objects-Footnote-1214072251
Ref: email headerregistry Custom Header Objects-Footnote-1314072311
Ref: email headerregistry Custom Header Objects-Footnote-1414072371
Ref: email headerregistry Custom Header Objects-Footnote-1514072431
Ref: email headerregistry Custom Header Objects-Footnote-1614072491
Ref: email headerregistry Custom Header Objects-Footnote-1714072551
Node: email contentmanager Managing MIME Content14072611
Ref: library/email contentmanager doc14072832
Ref: 3dc614072832
Ref: library/email contentmanager email-contentmanager-managing-mime-content14072832
Ref: 3dc714072832
Ref: library/email contentmanager module-email contentmanager14072832
Ref: 4014072832
Ref: library/email contentmanager translation-repo14072832
Ref: 3dc814072832
Ref: library/email contentmanager email contentmanager ContentManager14073098
Ref: 3dc914073098
Ref: library/email contentmanager email contentmanager ContentManager get_content14073391
Ref: 3d4514073391
Ref: library/email contentmanager email contentmanager ContentManager set_content14074200
Ref: 3d4614074200
Ref: library/email contentmanager email contentmanager ContentManager add_get_handler14075817
Ref: 3dca14075817
Ref: library/email contentmanager email contentmanager ContentManager add_set_handler14076015
Ref: 3dcc14076015
Ref: email contentmanager Managing MIME Content-Footnote-114076380
Ref: email contentmanager Managing MIME Content-Footnote-214076461
Node: Content Manager Instances14076530
Ref: library/email contentmanager content-manager-instances14076634
Ref: 3dce14076634
Ref: library/email contentmanager email contentmanager raw_data_manager14076969
Ref: 3d7c14076969
Ref: library/email contentmanager email contentmanager get_content14077698
Ref: 3dcb14077698
Ref: library/email contentmanager email contentmanager set_content14078303
Ref: 3dcd14078303
Ref: Content Manager Instances-Footnote-114083118
Node: email 使用例14083177
Ref: library/email examples doc14083445
Ref: 3dcf14083445
Ref: library/email examples email-examples14083445
Ref: 12ec14083445
Ref: library/email examples id114083445
Ref: 3dd014083445
Ref: library/email examples translation-repo14083445
Ref: 3dd114083445
Ref: email 使用例-Footnote-114098563
Ref: email 使用例-Footnote-214098621
Node: email message Message compat32 API を使用した電子メールメッセージの表現14098706
Ref: library/email compat32-message doc14098987
Ref: 3dd214098987
Ref: library/email compat32-message compat32-message14098987
Ref: 3d1714098987
Ref: library/email compat32-message email-message-message-representing-an-email-message-using-the-compat32-api14098987
Ref: 3dd314098987
Ref: library/email compat32-message translation-repo14098987
Ref: 3dd414098987
Ref: library/email compat32-message email message Message14101561
Ref: 78614101561
Ref: library/email compat32-message email message Message as_string14102118
Ref: 12e614102118
Ref: library/email compat32-message email message Message __str__14104398
Ref: 3dd514104398
Ref: library/email compat32-message email message Message as_bytes14104570
Ref: 12e714104570
Ref: library/email compat32-message email message Message __bytes__14106221
Ref: 12e814106221
Ref: library/email compat32-message email message Message is_multipart14106435
Ref: 3d3e14106435
Ref: library/email compat32-message email message Message set_unixfrom14107087
Ref: 3dd614107087
Ref: library/email compat32-message email message Message get_unixfrom14107290
Ref: 3dd714107290
Ref: library/email compat32-message email message Message attach14107512
Ref: 3d4b14107512
Ref: library/email compat32-message email message Message get_payload14108333
Ref: 158b14108333
Ref: library/email compat32-message email message Message set_payload14111216
Ref: 3dd814111216
Ref: library/email compat32-message email message Message set_charset14111811
Ref: 3dd914111811
Ref: library/email compat32-message email message Message get_charset14113862
Ref: 3dda14113862
Ref: library/email compat32-message email message Message __len__14115665
Ref: 3ddc14115665
Ref: library/email compat32-message email message Message __contains__14115787
Ref: 1d1214115787
Ref: library/email compat32-message email message Message __getitem__14116333
Ref: 3ddd14116333
Ref: library/email compat32-message email message Message __setitem__14117023
Ref: 1ac214117023
Ref: library/email compat32-message email message Message __delitem__14117778
Ref: 3ddf14117778
Ref: library/email compat32-message email message Message keys14118066
Ref: 3ddb14118066
Ref: library/email compat32-message email message Message values14118220
Ref: 3de014118220
Ref: library/email compat32-message email message Message items14118356
Ref: 3de114118356
Ref: library/email compat32-message email message Message get14118544
Ref: 3de214118544
Ref: library/email compat32-message email message Message get_all14118890
Ref: 3dde14118890
Ref: library/email compat32-message email message Message add_header14119224
Ref: 1ac314119224
Ref: library/email compat32-message email message Message replace_header14121661
Ref: 3de314121661
Ref: library/email compat32-message email message Message get_content_type14122049
Ref: 3de414122049
Ref: library/email compat32-message email message Message get_content_maintype14123314
Ref: 3de614123314
Ref: library/email compat32-message email message Message get_content_subtype14123562
Ref: 3de714123562
Ref: library/email compat32-message email message Message get_default_type14123839
Ref: 3de514123839
Ref: library/email compat32-message email message Message set_default_type14124216
Ref: 3de814124216
Ref: library/email compat32-message email message Message get_params14124588
Ref: 3de914124588
Ref: library/email compat32-message email message Message get_param14125943
Ref: 3dea14125943
Ref: library/email compat32-message email message Message set_param14128497
Ref: 12e914128497
Ref: library/email compat32-message email message Message del_param14130152
Ref: 3dec14130152
Ref: library/email compat32-message email message Message set_type14130777
Ref: 3ded14130777
Ref: library/email compat32-message email message Message get_filename14131953
Ref: 3dee14131953
Ref: library/email compat32-message email message Message get_boundary14132551
Ref: 3def14132551
Ref: library/email compat32-message email message Message set_boundary14133012
Ref: 3df014133012
Ref: library/email compat32-message email message Message get_content_charset14133978
Ref: 3df114133978
Ref: library/email compat32-message email message Message get_charsets14134725
Ref: 3df214134725
Ref: library/email compat32-message email message Message get_content_disposition14135620
Ref: 11b414135620
Ref: library/email compat32-message email message Message walk14135989
Ref: 3df314135989
Ref: library/email compat32-message email message Message preamble14138431
Ref: 3df414138431
Ref: library/email compat32-message email message Message epilogue14140184
Ref: 3df514140184
Ref: library/email compat32-message email message Message defects14140608
Ref: 3df614140608
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-114141000
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-214141059
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-314141118
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-414141177
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-514141236
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-614141295
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-714141354
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-814141413
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-914141472
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1014141531
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1114141591
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1214141651
Node: email mime Creating email and MIME objects from scratch14141711
Ref: library/email mime doc14142020
Ref: 3df714142020
Ref: library/email mime email-mime-creating-email-and-mime-objects-from-scratch14142020
Ref: 3df814142020
Ref: library/email mime module-email mime14142020
Ref: 4814142020
Ref: library/email mime translation-repo14142020
Ref: 3df914142020
Ref: library/email mime module-email mime base14143864
Ref: 4b14143864
Ref: library/email mime email mime base MIMEBase14143864
Ref: 3dfa14143864
Ref: library/email mime module-email mime nonmultipart14145326
Ref: 4f14145326
Ref: library/email mime email mime nonmultipart MIMENonMultipart14145326
Ref: 3d9014145326
Ref: library/email mime module-email mime multipart14145954
Ref: 4e14145954
Ref: library/email mime email mime multipart MIMEMultipart14145954
Ref: 3dfb14145954
Ref: library/email mime module-email mime application14147752
Ref: 4914147752
Ref: library/email mime email mime application MIMEApplication14147752
Ref: 3dfc14147752
Ref: library/email mime module-email mime audio14149395
Ref: 4a14149395
Ref: library/email mime email mime audio MIMEAudio14149395
Ref: 3dfd14149395
Ref: library/email mime module-email mime image14151264
Ref: 4c14151264
Ref: library/email mime email mime image MIMEImage14151264
Ref: 3d9114151264
Ref: library/email mime module-email mime message14153186
Ref: 4d14153186
Ref: library/email mime email mime message MIMEMessage14153186
Ref: 3dfe14153186
Ref: library/email mime module-email mime text14154224
Ref: 5014154224
Ref: library/email mime email mime text MIMEText14154224
Ref: 11b514154224
Ref: email mime Creating email and MIME objects from scratch-Footnote-114156354
Node: email header 国際化されたヘッダー14156422
Ref: library/email header doc14156677
Ref: 3dff14156677
Ref: library/email header email-header-internationalized-headers14156677
Ref: 3e0014156677
Ref: library/email header module-email header14156677
Ref: 4414156677
Ref: library/email header translation-repo14156677
Ref: 3e0114156677
Ref: library/email header email header Header14159792
Ref: 1e7414159792
Ref: library/email header email header Header append14162209
Ref: 3e0214162209
Ref: library/email header email header Header encode14163937
Ref: 3e0314163937
Ref: library/email header email header Header __str__14165933
Ref: 3e0414165933
Ref: library/email header email header Header __eq__14166532
Ref: 3e0514166532
Ref: library/email header email header Header __ne__14166735
Ref: 3e0614166735
Ref: library/email header email header decode_header14167031
Ref: 147814167031
Ref: library/email header email header make_header14168531
Ref: 147914168531
Ref: email header 国際化されたヘッダー-Footnote-114169569
Ref: email header 国際化されたヘッダー-Footnote-214169641
Ref: email header 国際化されたヘッダー-Footnote-314169700
Ref: email header 国際化されたヘッダー-Footnote-414169758
Ref: email header 国際化されたヘッダー-Footnote-514169817
Ref: email header 国際化されたヘッダー-Footnote-614169876
Ref: email header 国際化されたヘッダー-Footnote-714169935
Ref: email header 国際化されたヘッダー-Footnote-814169994
Ref: email header 国際化されたヘッダー-Footnote-914170053
Ref: email header 国際化されたヘッダー-Footnote-1014170112
Ref: email header 国際化されたヘッダー-Footnote-1114170172
Ref: email header 国際化されたヘッダー-Footnote-1214170232
Ref: email header 国際化されたヘッダー-Footnote-1314170292
Ref: email header 国際化されたヘッダー-Footnote-1414170352
Ref: email header 国際化されたヘッダー-Footnote-1514170412
Node: email charset 文字集合の表現14170472
Ref: library/email charset doc14170705
Ref: 3e0714170705
Ref: library/email charset email-charset-representing-character-sets14170705
Ref: 3e0814170705
Ref: library/email charset module-email charset14170705
Ref: 3f14170705
Ref: library/email charset translation-repo14170705
Ref: 3e0914170705
Ref: library/email charset email charset Charset14171625
Ref: 11b614171625
Ref: library/email charset email charset Charset input_charset14173695
Ref: 3e0a14173695
Ref: library/email charset email charset Charset header_encoding14174032
Ref: 3e0b14174032
Ref: library/email charset email charset Charset body_encoding14174579
Ref: 3e0c14174579
Ref: library/email charset email charset Charset output_charset14174956
Ref: 3e0d14174956
Ref: library/email charset email charset Charset input_codec14175458
Ref: 3e0e14175458
Ref: library/email charset email charset Charset output_codec14175710
Ref: 3e0f14175710
Ref: library/email charset email charset Charset get_body_encoding14176151
Ref: 3e1014176151
Ref: library/email charset email charset Charset get_output_charset14177129
Ref: 3e1114177129
Ref: library/email charset email charset Charset header_encode14177413
Ref: 3e1214177413
Ref: library/email charset email charset Charset header_encode_lines14177680
Ref: 3e1314177680
Ref: library/email charset email charset Charset body_encode14178259
Ref: 3e1414178259
Ref: library/email charset email charset Charset __str__14178691
Ref: 3e1514178691
Ref: library/email charset email charset Charset __eq__14178904
Ref: 3e1614178904
Ref: library/email charset email charset Charset __ne__14179100
Ref: 3e1714179100
Ref: library/email charset email charset add_charset14179450
Ref: 3e1814179450
Ref: library/email charset email charset add_alias14181348
Ref: 3e1a14181348
Ref: library/email charset email charset add_codec14181830
Ref: 3e1914181830
Ref: email charset 文字集合の表現-Footnote-114182256
Node: email encoders エンコーダー14182329
Ref: library/email encoders doc14182554
Ref: 3e1b14182554
Ref: library/email encoders email-encoders-encoders14182554
Ref: 3e1c14182554
Ref: library/email encoders module-email encoders14182554
Ref: 4114182554
Ref: library/email encoders translation-repo14182554
Ref: 3e1d14182554
Ref: library/email encoders email encoders encode_quopri14184601
Ref: 3e1e14184601
Ref: library/email encoders email encoders encode_base6414185055
Ref: 3e1f14185055
Ref: library/email encoders email encoders encode_7or8bit14185622
Ref: 3e2014185622
Ref: library/email encoders email encoders encode_noop14185912
Ref: 3e2114185912
Ref: email encoders エンコーダー-Footnote-114186143
Ref: email encoders エンコーダー-Footnote-214186217
Node: email utils Miscellaneous utilities14186378
Ref: library/email utils doc14186599
Ref: 3e2214186599
Ref: library/email utils email-utils-miscellaneous-utilities14186599
Ref: 3e2314186599
Ref: library/email utils module-email utils14186599
Ref: 5314186599
Ref: library/email utils translation-repo14186599
Ref: 3e2414186599
Ref: library/email utils email utils localtime14186897
Ref: 57614186897
Ref: library/email utils email utils make_msgid14187454
Ref: 3e2514187454
Ref: library/email utils email utils quote14188379
Ref: 3e2614188379
Ref: library/email utils email utils unquote14188671
Ref: 3d3714188671
Ref: library/email utils email utils parseaddr14189041
Ref: 6ff14189041
Ref: library/email utils email utils formataddr14189664
Ref: 155814189664
Ref: library/email utils email utils getaddresses14190411
Ref: 6fe14190411
Ref: library/email utils email utils parsedate14191263
Ref: 3e2714191263
Ref: library/email utils email utils parsedate_tz14192058
Ref: 1e3914192058
Ref: library/email utils email utils parsedate_to_datetime14192637
Ref: 147e14192637
Ref: library/email utils email utils mktime_tz14193520
Ref: 3e2814193520
Ref: library/email utils email utils formatdate14193851
Ref: 182214193851
Ref: library/email utils email utils format_datetime14195007
Ref: 147d14195007
Ref: library/email utils email utils decode_rfc223114195694
Ref: 3e2914195694
Ref: library/email utils email utils encode_rfc223114195813
Ref: 3e2a14195813
Ref: library/email utils email utils collapse_rfc2231_value14196405
Ref: 3deb14196405
Ref: library/email utils email utils decode_params14197744
Ref: 1a4f14197744
Ref: email utils Miscellaneous utilities-Footnote-114198023
Ref: email utils Miscellaneous utilities-Footnote-214198094
Ref: email utils Miscellaneous utilities-Footnote-314198153
Ref: email utils Miscellaneous utilities-Footnote-414198212
Ref: email utils Miscellaneous utilities-Footnote-514198271
Ref: email utils Miscellaneous utilities-Footnote-614198330
Ref: email utils Miscellaneous utilities-Footnote-714198636
Ref: email utils Miscellaneous utilities-Footnote-814198695
Ref: email utils Miscellaneous utilities-Footnote-914198754
Ref: email utils Miscellaneous utilities-Footnote-1014198813
Ref: email utils Miscellaneous utilities-Footnote-1114198873
Ref: email utils Miscellaneous utilities-Footnote-1214198933
Node: email iterators イテレータ14198993
Ref: library/email iterators doc14199172
Ref: 3e2b14199172
Ref: library/email iterators email-iterators-iterators14199172
Ref: 3e2c14199172
Ref: library/email iterators module-email iterators14199172
Ref: 4614199172
Ref: library/email iterators translation-repo14199172
Ref: 3e2d14199172
Ref: library/email iterators email iterators body_line_iterator14199581
Ref: 3e2e14199581
Ref: library/email iterators email iterators typed_subpart_iterator14200356
Ref: 3e2f14200356
Ref: library/email iterators email iterators _structure14201366
Ref: 3e3014201366
Ref: email iterators イテレータ-Footnote-114202996
Node: json --- JSON エンコーダーとデコーダー14203072
Ref: library/json doc14203355
Ref: 3e3114203355
Ref: library/json json-json-encoder-and-decoder14203355
Ref: 3e3214203355
Ref: library/json module-json14203355
Ref: 8514203355
Ref: library/json translation-repo14203355
Ref: 3e3314203355
Ref: json --- JSON エンコーダーとデコーダー-Footnote-114208697
Ref: json --- JSON エンコーダーとデコーダー-Footnote-214208770
Ref: json --- JSON エンコーダーとデコーダー-Footnote-314208795
Ref: json --- JSON エンコーダーとデコーダー-Footnote-414208854
Ref: json --- JSON エンコーダーとデコーダー-Footnote-514208913
Ref: json --- JSON エンコーダーとデコーダー-Footnote-614209000
Ref: json --- JSON エンコーダーとデコーダー-Footnote-714209049
Ref: json --- JSON エンコーダーとデコーダー-Footnote-814209353
Node: 基本的な使い方<4>14209379
Ref: library/json basic-usage14209529
Ref: 3e3414209529
Ref: library/json json dump14209585
Ref: 10ff14209585
Ref: library/json json dumps14214193
Ref: 25414214193
Ref: library/json json load14215142
Ref: 23914215142
Ref: library/json json loads14219472
Ref: 23a14219472
Ref: 基本的な使い方<4>-Footnote-114220306
Node: エンコーダとデコーダ14220338
Ref: library/json encoders-and-decoders14220507
Ref: 3e3814220507
Ref: library/json json JSONDecoder14220578
Ref: 110114220578
Ref: library/json json-to-py-table14220886
Ref: 3e3714220886
Ref: library/json json JSONDecoder decode14224413
Ref: 3e3914224413
Ref: library/json json JSONDecoder raw_decode14224712
Ref: 3e3a14224712
Ref: library/json json JSONEncoder14225173
Ref: 110014225173
Ref: library/json py-to-json-table14225527
Ref: 3e3514225527
Ref: library/json json JSONEncoder default14231178
Ref: 3e3614231178
Ref: library/json json JSONEncoder encode14231978
Ref: 3e3b14231978
Ref: library/json json JSONEncoder iterencode14232219
Ref: 19d314232219
Ref: エンコーダとデコーダ-Footnote-114232559
Node: 例外<21>14232591
Ref: library/json exceptions14232766
Ref: 3e3c14232766
Ref: library/json json JSONDecodeError14232797
Ref: 11d914232797
Ref: library/json json JSONDecodeError msg14232941
Ref: 3e3d14232941
Ref: library/json json JSONDecodeError doc14233047
Ref: 3e3e14233047
Ref: library/json json JSONDecodeError pos14233132
Ref: 3e3f14233132
Ref: library/json json JSONDecodeError lineno14233232
Ref: 3e4014233232
Ref: library/json json JSONDecodeError colno14233305
Ref: 3e4114233305
Node: 標準への準拠と互換性14233405
Ref: library/json standard-compliance-and-interoperability14233601
Ref: 3e4214233601
Ref: 標準への準拠と互換性-Footnote-114234918
Ref: 標準への準拠と互換性-Footnote-214234977
Node: 文字エンコーディング14235064
Ref: library/json character-encodings14235199
Ref: 3e4314235199
Node: 無限および NaN の数値14236923
Ref: library/json infinite-and-nan-number-values14237118
Ref: 3e4414237118
Node: オブジェクト中に重複した名前の扱い14238029
Ref: library/json repeated-names-within-an-object14238263
Ref: 3e4514238263
Node: トップレベルの非オブジェクト、非配列の値の扱い14238950
Ref: library/json top-level-non-object-non-array-values14239170
Ref: 3e4614239170
Ref: トップレベルの非オブジェクト、非配列の値の扱い-Footnote-114240146
Ref: トップレベルの非オブジェクト、非配列の値の扱い-Footnote-214240205
Node: 実装の制限14240264
Ref: library/json implementation-limitations14240424
Ref: 3e4714240424
Node: コマンドライン・インターフェース<5>14241587
Ref: library/json command-line-interface14241764
Ref: 3e4814241764
Ref: library/json json-commandline14241764
Ref: 4d214241764
Ref: library/json module-json tool14241764
Ref: 8614241764
Ref: コマンドライン・インターフェース<5>-Footnote-114243109
Node: コマンドラインオプション<4>14243178
Ref: library/json command-line-options14243305
Ref: 3e4a14243305
Ref: library/json cmdoption-json-arg-infile14243388
Ref: 3e4b14243388
Ref: library/json cmdoption-json-arg-outfile14243933
Ref: 3e4c14243933
Ref: library/json cmdoption-json-sort-keys14244094
Ref: 3e4914244094
Ref: library/json cmdoption-json-no-ensure-ascii14244232
Ref: 3e4d14244232
Ref: library/json cmdoption-json-json-lines14244435
Ref: 3e4e14244435
Ref: library/json cmdoption-json-indent14244582
Ref: 3e4f14244582
Ref: library/json cmdoption-json-tab14244582
Ref: 3e5014244582
Ref: library/json cmdoption-json-no-indent14244582
Ref: 3e5114244582
Ref: library/json cmdoption-json-compact14244582
Ref: 3e5214244582
Ref: library/json cmdoption-json-h14244733
Ref: 3e5314244733
Ref: library/json cmdoption-json-help14244733
Ref: 3e5414244733
Node: mailbox --- 様々な形式のメールボックスを操作する14244819
Ref: library/mailbox doc14245100
Ref: 3e5514245100
Ref: library/mailbox mailbox-manipulate-mailboxes-in-various-formats14245100
Ref: 3e5614245100
Ref: library/mailbox module-mailbox14245100
Ref: 8e14245100
Ref: library/mailbox translation-repo14245100
Ref: 3e5714245100
Ref: mailbox --- 様々な形式のメールボックスを操作する-Footnote-114246208
Node: Mailbox オブジェクト14246275
Ref: library/mailbox id114246439
Ref: 3e5814246439
Ref: library/mailbox mailbox-objects14246439
Ref: 3e5914246439
Ref: library/mailbox mailbox Mailbox14246514
Ref: 160514246514
Ref: library/mailbox mailbox Mailbox add14250808
Ref: 160614250808
Ref: library/mailbox mailbox Mailbox remove14251843
Ref: 3e5a14251843
Ref: library/mailbox mailbox Mailbox __delitem__14251879
Ref: 3e5f14251879
Ref: library/mailbox mailbox Mailbox discard14251920
Ref: 3e5b14251920
Ref: library/mailbox mailbox Mailbox __setitem__14252664
Ref: 3e6014252664
Ref: library/mailbox mailbox Mailbox iterkeys14253774
Ref: 3e6114253774
Ref: library/mailbox mailbox Mailbox keys14253866
Ref: 3e6214253866
Ref: library/mailbox mailbox Mailbox itervalues14254034
Ref: 3e6314254034
Ref: library/mailbox mailbox Mailbox __iter__14254071
Ref: 3e6414254071
Ref: library/mailbox mailbox Mailbox values14254714
Ref: 3e6514254714
Ref: library/mailbox mailbox Mailbox iteritems14254886
Ref: 3e6614254886
Ref: library/mailbox mailbox Mailbox items14255410
Ref: 3e6714255410
Ref: library/mailbox mailbox Mailbox get14255609
Ref: 3e6814255609
Ref: library/mailbox mailbox Mailbox __getitem__14255656
Ref: 3e6914255656
Ref: library/mailbox mailbox Mailbox get_message14256389
Ref: 3e6a14256389
Ref: library/mailbox mailbox Mailbox get_bytes14256729
Ref: 160814256729
Ref: library/mailbox mailbox Mailbox get_string14256997
Ref: 160914256997
Ref: library/mailbox mailbox Mailbox get_file14257399
Ref: 160714257399
Ref: library/mailbox mailbox Mailbox __contains__14258781
Ref: 3e6b14258781
Ref: library/mailbox mailbox Mailbox __len__14258964
Ref: 3e6c14258964
Ref: library/mailbox mailbox Mailbox clear14259074
Ref: 3e6d14259074
Ref: library/mailbox mailbox Mailbox pop14259191
Ref: 3e6e14259191
Ref: library/mailbox mailbox Mailbox popitem14259659
Ref: 3e6f14259659
Ref: library/mailbox mailbox Mailbox update14260309
Ref: 3e7014260309
Ref: library/mailbox mailbox Mailbox flush14261273
Ref: 1bea14261273
Ref: library/mailbox mailbox Mailbox lock14261693
Ref: 3e5c14261693
Ref: library/mailbox mailbox Mailbox unlock14262189
Ref: 3e5d14262189
Ref: library/mailbox mailbox Mailbox close14262310
Ref: 3e5e14262310
Node: Maildir オブジェクト14262739
Ref: library/mailbox mailbox-maildir14262860
Ref: 3e7214262860
Ref: library/mailbox maildir-objects14262860
Ref: 3e7314262860
Ref: library/mailbox mailbox Maildir14262935
Ref: 85114262935
Ref: library/mailbox mailbox Maildir colon14265768
Ref: 3e7514265768
Ref: library/mailbox mailbox Maildir list_folders14266802
Ref: 3e7614266802
Ref: library/mailbox mailbox Maildir get_folder14266908
Ref: 3e7714266908
Ref: library/mailbox mailbox Maildir add_folder14267202
Ref: 3e7914267202
Ref: library/mailbox mailbox Maildir remove_folder14267390
Ref: 3e7a14267390
Ref: library/mailbox mailbox Maildir clean14267692
Ref: 3e7c14267692
Ref: library/mailbox mailbox Maildir get_flags14267991
Ref: 1c6b14267991
Ref: library/mailbox mailbox Maildir set_flags14268798
Ref: 1c6c14268798
Ref: library/mailbox mailbox Maildir add_flag14269553
Ref: 1c6d14269553
Ref: library/mailbox mailbox Maildir remove_flag14270069
Ref: 1c6e14270069
Ref: library/mailbox mailbox Maildir get_info14270596
Ref: 1c6914270596
Ref: library/mailbox mailbox Maildir set_info14271328
Ref: 1c6a14271328
Ref: library/mailbox mailbox Maildir add14272165
Ref: 3e8414272165
Ref: library/mailbox mailbox Maildir __setitem__14272202
Ref: 3e8114272202
Ref: library/mailbox mailbox Maildir update14272252
Ref: 3e8514272252
Ref: library/mailbox mailbox Maildir flush14272731
Ref: 3e8614272731
Ref: library/mailbox mailbox Maildir lock14272906
Ref: 3e8714272906
Ref: library/mailbox mailbox Maildir unlock14272937
Ref: 3e8814272937
Ref: library/mailbox mailbox Maildir close14273127
Ref: 3e8914273127
Ref: library/mailbox mailbox Maildir get_file14273385
Ref: 3e8a14273385
Ref: Maildir オブジェクト-Footnote-114274059
Ref: Maildir オブジェクト-Footnote-214274108
Node: mbox オブジェクト14274152
Ref: library/mailbox mailbox-mbox14274303
Ref: 3e8b14274303
Ref: library/mailbox mbox-objects14274303
Ref: 3e8c14274303
Ref: library/mailbox mailbox mbox14274372
Ref: 1c2214274372
Ref: library/mailbox mailbox mbox get_bytes14276113
Ref: 3e8d14276113
Ref: library/mailbox mailbox mbox get_file14276412
Ref: 3e8e14276412
Ref: library/mailbox mailbox mbox get_string14277000
Ref: 3e8f14277000
Ref: library/mailbox mailbox mbox lock14277300
Ref: 3e9014277300
Ref: library/mailbox mailbox mbox unlock14277331
Ref: 3e9114277331
Ref: mbox オブジェクト-Footnote-114278050
Ref: mbox オブジェクト-Footnote-214278110
Ref: mbox オブジェクト-Footnote-314278162
Node: MH オブジェクト14278240
Ref: library/mailbox mailbox-mh14278389
Ref: 3e9214278389
Ref: library/mailbox mh-objects14278389
Ref: 3e9314278389
Ref: library/mailbox mailbox MH14278454
Ref: 1c5414278454
Ref: library/mailbox mailbox MH list_folders14280575
Ref: 3e9514280575
Ref: library/mailbox mailbox MH get_folder14280681
Ref: 3e9614280681
Ref: library/mailbox mailbox MH add_folder14280960
Ref: 3e9714280960
Ref: library/mailbox mailbox MH remove_folder14281145
Ref: 3e9814281145
Ref: library/mailbox mailbox MH get_sequences14281447
Ref: 3e9914281447
Ref: library/mailbox mailbox MH set_sequences14281661
Ref: 3e9a14281661
Ref: library/mailbox mailbox MH pack14281944
Ref: 3e9b14281944
Ref: library/mailbox mailbox MH remove14282507
Ref: 3e9c14282507
Ref: library/mailbox mailbox MH __delitem__14282543
Ref: 3e9d14282543
Ref: library/mailbox mailbox MH discard14282584
Ref: 3e9e14282584
Ref: library/mailbox mailbox MH lock14282852
Ref: 3e9f14282852
Ref: library/mailbox mailbox MH unlock14282883
Ref: 3ea014282883
Ref: library/mailbox mailbox MH get_file14283354
Ref: 3ea114283354
Ref: library/mailbox mailbox MH flush14283581
Ref: 3ea214283581
Ref: library/mailbox mailbox MH close14283751
Ref: 3ea314283751
Ref: MH オブジェクト-Footnote-114284294
Ref: MH オブジェクト-Footnote-214284330
Node: Babyl オブジェクト14284375
Ref: library/mailbox babyl-objects14284524
Ref: 3ea414284524
Ref: library/mailbox mailbox-babyl14284524
Ref: 3ea514284524
Ref: library/mailbox mailbox Babyl14284595
Ref: 3ea614284595
Ref: library/mailbox mailbox Babyl get_labels14286604
Ref: 3ea814286604
Ref: library/mailbox mailbox Babyl get_file14287296
Ref: 3ea914287296
Ref: library/mailbox mailbox Babyl lock14287929
Ref: 3eaa14287929
Ref: library/mailbox mailbox Babyl unlock14287960
Ref: 3eab14287960
Ref: Babyl オブジェクト-Footnote-114288438
Ref: Babyl オブジェクト-Footnote-214288482
Node: MMDF オブジェクト14288560
Ref: library/mailbox mailbox-mmdf14288679
Ref: 3eac14288679
Ref: library/mailbox mmdf-objects14288679
Ref: 3ead14288679
Ref: library/mailbox mailbox MMDF14288748
Ref: 1c2314288748
Ref: library/mailbox mailbox MMDF get_bytes14290291
Ref: 3eaf14290291
Ref: library/mailbox mailbox MMDF get_file14290590
Ref: 3eb014290590
Ref: library/mailbox mailbox MMDF lock14291178
Ref: 3eb114291178
Ref: library/mailbox mailbox MMDF unlock14291209
Ref: 3eb214291209
Ref: MMDF オブジェクト-Footnote-114291706
Ref: MMDF オブジェクト-Footnote-214291766
Node: Message オブジェクト14291809
Ref: library/mailbox mailbox-message-objects14291992
Ref: 3eb314291992
Ref: library/mailbox message-objects14291992
Ref: 3eb414291992
Ref: library/mailbox mailbox Message14292067
Ref: 160a14292067
Ref: Message オブジェクト-Footnote-114294689
Node: MaildirMessage オブジェクト14294748
Ref: library/mailbox mailbox-maildirmessage14294883
Ref: 3eb514294883
Ref: library/mailbox maildirmessage-objects14294883
Ref: 3eb614294883
Ref: library/mailbox mailbox MaildirMessage14294972
Ref: 3e7414294972
Ref: library/mailbox mailbox MaildirMessage get_subdir14297187
Ref: 3eb714297187
Ref: library/mailbox mailbox MaildirMessage set_subdir14297848
Ref: 3eb814297848
Ref: library/mailbox mailbox MaildirMessage get_flags14298112
Ref: 3e7d14298112
Ref: library/mailbox mailbox MaildirMessage set_flags14298695
Ref: 3e7e14298695
Ref: library/mailbox mailbox MaildirMessage add_flag14298838
Ref: 3e7f14298838
Ref: library/mailbox mailbox MaildirMessage remove_flag14299252
Ref: 3e8014299252
Ref: library/mailbox mailbox MaildirMessage get_date14299606
Ref: 3eb914299606
Ref: library/mailbox mailbox MaildirMessage set_date14299773
Ref: 3eba14299773
Ref: library/mailbox mailbox MaildirMessage get_info14299977
Ref: 3e8214299977
Ref: library/mailbox mailbox MaildirMessage set_info14300249
Ref: 3e8314300249
Node: mboxMessage オブジェクト14303276
Ref: library/mailbox mailbox-mboxmessage14303448
Ref: 3ebb14303448
Ref: library/mailbox mboxmessage-objects14303448
Ref: 3ebc14303448
Ref: library/mailbox mailbox mboxMessage14303531
Ref: 3d1f14303531
Ref: library/mailbox mailbox mboxMessage get_from14305633
Ref: 3ebd14305633
Ref: library/mailbox mailbox mboxMessage set_from14305882
Ref: 3ebe14305882
Ref: library/mailbox mailbox mboxMessage get_flags14306582
Ref: 3ebf14306582
Ref: library/mailbox mailbox mboxMessage set_flags14306925
Ref: 3ec014306925
Ref: library/mailbox mailbox mboxMessage add_flag14307209
Ref: 3ec114307209
Ref: library/mailbox mailbox mboxMessage remove_flag14307508
Ref: 3ec214307508
Node: MHMessage オブジェクト14310821
Ref: library/mailbox mailbox-mhmessage14310991
Ref: 3ec314310991
Ref: library/mailbox mhmessage-objects14310991
Ref: 3ec414310991
Ref: library/mailbox mailbox MHMessage14311072
Ref: 3e9414311072
Ref: library/mailbox mailbox MHMessage get_sequences14312240
Ref: 3ec514312240
Ref: library/mailbox mailbox MHMessage set_sequences14312371
Ref: 3ec614312371
Ref: library/mailbox mailbox MHMessage add_sequence14312511
Ref: 3ec714312511
Ref: library/mailbox mailbox MHMessage remove_sequence14312671
Ref: 3ec814312671
Node: BabylMessage オブジェクト14314758
Ref: library/mailbox babylmessage-objects14314928
Ref: 3ec914314928
Ref: library/mailbox mailbox-babylmessage14314928
Ref: 3eca14314928
Ref: library/mailbox mailbox BabylMessage14315015
Ref: 3ea714315015
Ref: library/mailbox mailbox BabylMessage get_labels14316671
Ref: 3ecb14316671
Ref: library/mailbox mailbox BabylMessage set_labels14316793
Ref: 3ecc14316793
Ref: library/mailbox mailbox BabylMessage add_label14316951
Ref: 3ecd14316951
Ref: library/mailbox mailbox BabylMessage remove_label14317092
Ref: 3ece14317092
Ref: library/mailbox mailbox BabylMessage get_visible14317250
Ref: 3ecf14317250
Ref: library/mailbox mailbox BabylMessage set_visible14317456
Ref: 3ed014317456
Ref: library/mailbox mailbox BabylMessage update_visible14317908
Ref: 3ed114317908
Node: MMDFMessage オブジェクト14320662
Ref: library/mailbox mailbox-mmdfmessage14320795
Ref: 3ed214320795
Ref: library/mailbox mmdfmessage-objects14320795
Ref: 3ed314320795
Ref: library/mailbox mailbox MMDFMessage14320880
Ref: 3eae14320880
Ref: library/mailbox mailbox MMDFMessage get_from14322773
Ref: 3ed414322773
Ref: library/mailbox mailbox MMDFMessage set_from14323022
Ref: 3ed514323022
Ref: library/mailbox mailbox MMDFMessage get_flags14323722
Ref: 3ed614323722
Ref: library/mailbox mailbox MMDFMessage set_flags14324065
Ref: 3ed714324065
Ref: library/mailbox mailbox MMDFMessage add_flag14324349
Ref: 3ed814324349
Ref: library/mailbox mailbox MMDFMessage remove_flag14324648
Ref: 3ed914324648
Node: 例外<22>14327955
Ref: library/mailbox exceptions14328125
Ref: 3eda14328125
Ref: library/mailbox mailbox Error14328247
Ref: 3edb14328247
Ref: library/mailbox mailbox NoSuchMailboxError14328337
Ref: 3e7814328337
Ref: library/mailbox mailbox NotEmptyError14328805
Ref: 3e7b14328805
Ref: library/mailbox mailbox ExternalClashError14329072
Ref: 3e7114329072
Ref: library/mailbox mailbox FormatError14329375
Ref: 3edc14329375
Node: 使用例<31>14329636
Ref: library/mailbox examples14329771
Ref: 3edd14329771
Ref: library/mailbox mailbox-examples14329771
Ref: 3ede14329771
Node: mimetypes --- ファイル名を MIME タイプへマップする14332261
Ref: library/mimetypes doc14332558
Ref: 3edf14332558
Ref: library/mimetypes mimetypes-map-filenames-to-mime-types14332558
Ref: 3ee014332558
Ref: library/mimetypes module-mimetypes14332558
Ref: 9314332558
Ref: library/mimetypes translation-repo14332558
Ref: 3ee114332558
Ref: library/mimetypes mimetypes guess_type14333724
Ref: 72114333724
Ref: library/mimetypes mimetypes guess_file_type14335792
Ref: 72014335792
Ref: library/mimetypes mimetypes guess_all_extensions14336124
Ref: 1e6014336124
Ref: library/mimetypes mimetypes guess_extension14336733
Ref: 3ee314336733
Ref: library/mimetypes mimetypes init14337512
Ref: 3ee214337512
Ref: library/mimetypes mimetypes read_mime_types14338846
Ref: 1f3e14338846
Ref: library/mimetypes mimetypes add_type14339324
Ref: 3ee514339324
Ref: library/mimetypes mimetypes inited14340130
Ref: 3ee614340130
Ref: library/mimetypes mimetypes knownfiles14340344
Ref: 3ee414340344
Ref: library/mimetypes mimetypes suffix_map14340634
Ref: 3ee714340634
Ref: library/mimetypes mimetypes encodings_map14341028
Ref: 3ee814341028
Ref: library/mimetypes mimetypes types_map14341153
Ref: 3ee914341153
Ref: library/mimetypes mimetypes common_types14341259
Ref: 3eea14341259
Ref: mimetypes --- ファイル名を MIME タイプへマップする-Footnote-114341973
Ref: mimetypes --- ファイル名を MIME タイプへマップする-Footnote-214342042
Node: MimeTypes objects14342113
Ref: library/mimetypes id114342277
Ref: 3eeb14342277
Ref: library/mimetypes mimetypes-objects14342277
Ref: 3eec14342277
Ref: library/mimetypes mimetypes MimeTypes14342521
Ref: 18b314342521
Ref: library/mimetypes mimetypes MimeTypes suffix_map14343478
Ref: 3eef14343478
Ref: library/mimetypes mimetypes MimeTypes encodings_map14344046
Ref: 3ef014344046
Ref: library/mimetypes mimetypes MimeTypes types_map14344307
Ref: 3ef114344307
Ref: library/mimetypes mimetypes MimeTypes types_map_inv14344639
Ref: 3ef214344639
Ref: library/mimetypes mimetypes MimeTypes guess_extension14344986
Ref: 3ef314344986
Ref: library/mimetypes mimetypes MimeTypes guess_type14345196
Ref: 202614345196
Ref: library/mimetypes mimetypes MimeTypes guess_file_type14345394
Ref: 3ef414345394
Ref: library/mimetypes mimetypes MimeTypes guess_all_extensions14345614
Ref: 3ef514345614
Ref: library/mimetypes mimetypes MimeTypes read14345828
Ref: 3eed14345828
Ref: library/mimetypes mimetypes MimeTypes readfp14346307
Ref: 3eee14346307
Ref: library/mimetypes mimetypes MimeTypes read_windows_registry14346795
Ref: 3ef614346795
Ref: library/mimetypes mimetypes MimeTypes add_type14347243
Ref: 15914347243
Node: コマンドラインでの使用<4>14348098
Ref: library/mimetypes command-line-usage14348301
Ref: 3ef714348301
Ref: library/mimetypes mimetypes-cli14348301
Ref: 4da14348301
Ref: library/mimetypes cmdoption-mimetypes-h14348561
Ref: 3ef814348561
Ref: library/mimetypes cmdoption-mimetypes-help14348600
Ref: 3ef914348600
Ref: library/mimetypes cmdoption-mimetypes-e14348708
Ref: 3efa14348708
Ref: library/mimetypes cmdoption-mimetypes-extension14348747
Ref: 3efb14348747
Ref: library/mimetypes cmdoption-mimetypes-l14348835
Ref: 3efc14348835
Ref: library/mimetypes cmdoption-mimetypes-lenient14348874
Ref: 3efd14348874
Node: コマンドラインの例<2>14349351
Ref: library/mimetypes command-line-example14349528
Ref: 3efe14349528
Node: base64 --- Base16 Base32 Base64 Base85 データのエンコード14351151
Ref: library/base64 doc14351430
Ref: 3eff14351430
Ref: library/base64 base64-base16-base32-base64-base85-data-encodings14351430
Ref: 3f0014351430
Ref: library/base64 module-base6414351430
Ref: f14351430
Ref: library/base64 translation-repo14351430
Ref: 3f0114351430
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-114353719
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-214353785
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-314353844
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-414353891
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-514353950
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-614354009
Node: RFC 4648 エンコーディング14354068
Ref: library/base64 base64-rfc-464814354244
Ref: 3f0214354244
Ref: library/base64 rfc-4648-encodings14354244
Ref: 3f0514354244
Ref: library/base64 base64 b64encode14354547
Ref: 1f614354547
Ref: library/base64 base64 b64decode14355696
Ref: 1f714355696
Ref: library/base64 base64 standard_b64encode14358346
Ref: 3f0614358346
Ref: library/base64 base64 standard_b64decode14358587
Ref: 3f0714358587
Ref: library/base64 base64 urlsafe_b64encode14358843
Ref: 1f814358843
Ref: library/base64 base64 urlsafe_b64decode14359303
Ref: 1f914359303
Ref: library/base64 base64 b32encode14359984
Ref: 1f214359984
Ref: library/base64 base64 b32decode14360645
Ref: 1f314360645
Ref: library/base64 base64 b32hexencode14362873
Ref: 1f414362873
Ref: library/base64 base64 b32hexdecode14363205
Ref: 1f514363205
Ref: library/base64 base64 b16encode14363859
Ref: 1fa14363859
Ref: library/base64 base64 b16decode14364318
Ref: 1fc14364318
Ref: RFC 4648 エンコーディング-Footnote-114365268
Ref: RFC 4648 エンコーディング-Footnote-214365327
Node: Base85 エンコーディング14365386
Ref: library/base64 base64-base-8514365607
Ref: 3f0314365607
Ref: library/base64 base85-encodings14365607
Ref: 3f0814365607
Ref: library/base64 base64 a85encode14366928
Ref: 12d214366928
Ref: library/base64 base64 a85decode14368233
Ref: 1ff14368233
Ref: library/base64 base64 b85encode14369554
Ref: 1fb14369554
Ref: library/base64 base64 b85decode14370449
Ref: 1fd14370449
Ref: library/base64 base64 z85encode14371098
Ref: 1f114371098
Ref: library/base64 base64 z85decode14371907
Ref: 1fe14371907
Ref: Base85 エンコーディング-Footnote-114372590
Node: レガシーインターフェース14372649
Ref: library/base64 base64-legacy14372879
Ref: 3f0414372879
Ref: library/base64 legacy-interface14372879
Ref: 3f0914372879
Ref: library/base64 base64 decode14372960
Ref: 3f0a14372960
Ref: library/base64 base64 decodebytes14373332
Ref: d2314373332
Ref: library/base64 base64 encode14373651
Ref: 3f0b14373651
Ref: library/base64 base64 encodebytes14374256
Ref: d2214374256
Ref: レガシーインターフェース-Footnote-114374981
Ref: レガシーインターフェース-Footnote-214375040
Node: セキュリティで考慮すべき点<4>14375099
Ref: library/base64 base64-security14375289
Ref: 3f0c14375289
Ref: library/base64 security-considerations14375289
Ref: 3f0d14375289
Ref: セキュリティで考慮すべき点<4>-Footnote-114376428
Ref: セキュリティで考慮すべき点<4>-Footnote-214376487
Ref: セキュリティで考慮すべき点<4>-Footnote-314376546
Ref: セキュリティで考慮すべき点<4>-Footnote-414376593
Node: binascii --- バイナリ と ASCII 間の変換14376633
Ref: library/binascii doc14376922
Ref: 3f0e14376922
Ref: library/binascii binascii-convert-between-binary-and-ascii14376922
Ref: 3f0f14376922
Ref: library/binascii module-binascii14376922
Ref: 1114376922
Ref: library/binascii translation-repo14376922
Ref: 3f1014376922
Ref: library/binascii binascii a2b_uu14378043
Ref: 192614378043
Ref: library/binascii binascii b2a_uu14378418
Ref: ee814378418
Ref: library/binascii binascii a2b_base6414378822
Ref: 20814378822
Ref: library/binascii binascii b2a_base6414381202
Ref: 20714381202
Ref: library/binascii binascii a2b_ascii8514382083
Ref: 20414382083
Ref: library/binascii binascii b2a_ascii8514383977
Ref: 20314383977
Ref: library/binascii binascii a2b_base8514385299
Ref: 20614385299
Ref: library/binascii binascii b2a_base8514386494
Ref: 20514386494
Ref: library/binascii binascii a2b_base3214387285
Ref: 20214387285
Ref: library/binascii binascii b2a_base3214389027
Ref: 20114389027
Ref: library/binascii binascii a2b_qp14389800
Ref: 3f1114389800
Ref: library/binascii binascii b2a_qp14390207
Ref: 3f1214390207
Ref: library/binascii binascii crc_hqx14391351
Ref: b2014391351
Ref: library/binascii binascii crc3214391710
Ref: 1c3814391710
Ref: library/binascii binascii b2a_hex14392549
Ref: 194c14392549
Ref: library/binascii binascii hexlify14392614
Ref: 197614392614
Ref: library/binascii binascii a2b_hex14393836
Ref: 20914393836
Ref: library/binascii binascii unhexlify14393897
Ref: 20a14393897
Ref: library/binascii binascii Error14394699
Ref: 13d214394699
Ref: library/binascii binascii Incomplete14394845
Ref: 3f1314394845
Ref: library/binascii binascii BASE64_ALPHABET14395113
Ref: 3f1414395113
Ref: library/binascii binascii URLSAFE_BASE64_ALPHABET14395236
Ref: 3f1514395236
Ref: library/binascii binascii UU_ALPHABET14395397
Ref: 3f1614395397
Ref: library/binascii binascii CRYPT_ALPHABET14395494
Ref: 3f1714395494
Ref: library/binascii binascii BINHEX_ALPHABET14395660
Ref: 3f1814395660
Ref: library/binascii binascii BASE85_ALPHABET14395812
Ref: 3f1914395812
Ref: library/binascii binascii ASCII85_ALPHABET14395909
Ref: 3f1a14395909
Ref: library/binascii binascii Z85_ALPHABET14396008
Ref: 3f1b14396008
Ref: library/binascii binascii BASE32_ALPHABET14396103
Ref: 3f1c14396103
Ref: library/binascii binascii BASE32HEX_ALPHABET14396227
Ref: 3f1d14396227
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-114396791
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-214396850
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-314396909
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-414396968
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-514397027
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-614397086
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-714397145
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-814397204
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-914397263
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-1014397322
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-1114397382
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-1214397428
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-1314397469
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-1414397529
Node: quopri --- MIME quoted-printable データのエンコードとデコード14397589
Ref: library/quopri doc14397803
Ref: 3f1e14397803
Ref: library/quopri module-quopri14397803
Ref: bf14397803
Ref: library/quopri quopri-encode-and-decode-mime-quoted-printable-data14397803
Ref: 3f1f14397803
Ref: library/quopri translation-repo14397803
Ref: 3f2014397803
Ref: library/quopri quopri decode14398739
Ref: 2aad14398739
Ref: library/quopri quopri encode14399506
Ref: 2aac14399506
Ref: library/quopri quopri decodestring14400433
Ref: 3f2114400433
Ref: library/quopri quopri encodestring14400656
Ref: 3f2214400656
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-114401179
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-214401245
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-314401304
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-414401363
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-514401422
Node: 構造化マークアップツール14401481
Ref: library/markup doc14401696
Ref: 3f2314401696
Ref: library/markup markup14401696
Ref: 3f2414401696
Ref: library/markup structured-markup-processing-tools14401696
Ref: 3f2514401696
Ref: library/markup translation-repo14401696
Ref: 3f2614401696
Node: html --- HyperText Markup Language のサポート14403541
Ref: library/html doc14403734
Ref: 3f2714403734
Ref: library/html html-hypertext-markup-language-support14403734
Ref: 3f2814403734
Ref: library/html module-html14403734
Ref: 6e14403734
Ref: library/html html escape14404062
Ref: 13bc14404062
Ref: library/html html unescape14404643
Ref: d2514404643
Ref: html --- HyperText Markup Language のサポート-Footnote-114405424
Node: html parser --- HTML と XHTML のシンプルなパーサー14405497
Ref: library/html parser doc14405743
Ref: 3f2914405743
Ref: library/html parser html-parser-simple-html-and-xhtml-parser14405743
Ref: 3f2a14405743
Ref: library/html parser module-html parser14405743
Ref: 7014405743
Ref: library/html parser translation-repo14405743
Ref: 3f2b14405743
Ref: library/html parser html parser HTMLParser14406281
Ref: c5114406281
Ref: html parser --- HTML と XHTML のシンプルなパーサー-Footnote-114407963
Node: HTML パーサーアプリケーションの例14408034
Ref: library/html parser example-html-parser-application14408211
Ref: 3f2c14408211
Node: HTMLParser メソッド14409451
Ref: library/html parser htmlparser-methods14409650
Ref: 3f2d14409650
Ref: library/html parser html parser HTMLParser feed14409807
Ref: 3f2e14409807
Ref: library/html parser html parser HTMLParser close14410240
Ref: 1a6414410240
Ref: library/html parser html parser HTMLParser reset14410817
Ref: 3f2f14410817
Ref: library/html parser html parser HTMLParser getpos14411031
Ref: 3f3014411031
Ref: library/html parser html parser HTMLParser get_starttag_text14411141
Ref: 3f3114411141
Ref: library/html parser html parser HTMLParser handle_starttag14411908
Ref: 3f3314411908
Ref: library/html parser html parser HTMLParser handle_endtag14412842
Ref: 3f3414412842
Ref: library/html parser html parser HTMLParser handle_startendtag14413085
Ref: 3f3214413085
Ref: library/html parser html parser HTMLParser handle_data14413581
Ref: 3f3514413581
Ref: library/html parser html parser HTMLParser handle_entityref14413771
Ref: 3f3614413771
Ref: library/html parser html parser HTMLParser handle_charref14414075
Ref: 3f3714414075
Ref: library/html parser html parser HTMLParser handle_comment14414521
Ref: 3f3814414521
Ref: library/html parser html parser HTMLParser handle_decl14415150
Ref: 3f3914415150
Ref: library/html parser html parser HTMLParser handle_pi14415458
Ref: 3f3a14415458
Ref: library/html parser html parser HTMLParser unknown_decl14416180
Ref: 3f3b14416180
Node: 使用例<32>14416594
Ref: library/html parser examples14416737
Ref: 3f3c14416737
Ref: library/html parser htmlparser-examples14416737
Ref: 3f3d14416737
Node: html entities --- HTML 一般実体の定義14420716
Ref: library/html entities doc14420942
Ref: 3f3e14420942
Ref: library/html entities html-entities-definitions-of-html-general-entities14420942
Ref: 3f3f14420942
Ref: library/html entities module-html entities14420942
Ref: 6f14420942
Ref: library/html entities translation-repo14420942
Ref: 3f4014420942
Ref: library/html entities html entities html514421348
Ref: 149214421348
Ref: library/html entities html entities entitydefs14421869
Ref: 3f4314421869
Ref: library/html entities html entities name2codepoint14422031
Ref: 3f4114422031
Ref: library/html entities html entities codepoint2name14422167
Ref: 3f4214422167
Ref: html entities --- HTML 一般実体の定義-Footnote-114422352
Ref: html entities --- HTML 一般実体の定義-Footnote-214422425
Node: XMLを扱うモジュール群14422538
Ref: library/xml doc14422748
Ref: 3f4414422748
Ref: library/xml module-xml14422748
Ref: 12914422748
Ref: library/xml translation-repo14422748
Ref: 3f4514422748
Ref: library/xml xml14422748
Ref: 3f4614422748
Ref: library/xml xml-processing-modules14422748
Ref: 3f4714422748
Ref: library/xml xml is_valid_name14424114
Ref: 2be14424114
Ref: library/xml xml is_valid_text14424640
Ref: 2bf14424640
Ref: library/xml xml-security14425021
Ref: 3f4814425021
Ref: XMLを扱うモジュール群-Footnote-114425084
Node: XML security14425145
Ref: library/xml id114425224
Ref: 3f4914425224
Ref: library/xml xml-vulnerabilities14425224
Ref: 3f4a14425224
Ref: XML security-Footnote-114427977
Ref: XML security-Footnote-214428022
Ref: XML security-Footnote-314428075
Ref: XML security-Footnote-414428128
Ref: XML security-Footnote-514428249
Node: xml etree ElementTree --- ElementTree XML API14428305
Ref: library/xml etree elementtree doc14428532
Ref: 3f4b14428532
Ref: library/xml etree elementtree module-xml etree ElementTree14428532
Ref: 12e14428532
Ref: library/xml etree elementtree translation-repo14428532
Ref: 3f4c14428532
Ref: library/xml etree elementtree xml-etree-elementtree-the-elementtree-xml-api14428532
Ref: 3f4d14428532
Ref: xml etree ElementTree --- ElementTree XML API-Footnote-114429445
Node: チュートリアル<3>14429527
Ref: library/xml etree elementtree tutorial14429660
Ref: 3f4e14429660
Node: XML 木構造と要素14430123
Ref: library/xml etree elementtree xml-tree-and-elements14430228
Ref: 3f4f14430228
Node: XML の解析14430818
Ref: library/xml etree elementtree elementtree-parsing-xml14430978
Ref: 3f5014430978
Ref: library/xml etree elementtree parsing-xml14430978
Ref: 3f5114430978
Node: 非ブロックパースのためのプル API14433876
Ref: library/xml etree elementtree elementtree-pull-parsing14434041
Ref: 13a214434041
Ref: library/xml etree elementtree pull-api-for-non-blocking-parsing14434041
Ref: 3f5314434041
Node: 関心ある要素の検索14436709
Ref: library/xml etree elementtree finding-interesting-elements14436886
Ref: 3f5614436886
Node: XML ファイルの編集14438235
Ref: library/xml etree elementtree modifying-an-xml-file14438385
Ref: 3f5914438385
Node: XML 文書の構築14441489
Ref: library/xml etree elementtree building-xml-documents14441647
Ref: 3f5c14441647
Node: 名前空間のある XML の解析14442024
Ref: library/xml etree elementtree parsing-xml-with-namespaces14442148
Ref: 3f5d14442148
Ref: 名前空間のある XML の解析-Footnote-114444676
Ref: 名前空間のある XML の解析-Footnote-214444728
Node: XPath サポート14444780
Ref: library/xml etree elementtree elementtree-xpath14444943
Ref: f6f14444943
Ref: library/xml etree elementtree xpath-support14444943
Ref: 3f5e14444943
Ref: XPath サポート-Footnote-114445406
Node: 使用例<33>14445442
Ref: library/xml etree elementtree example14445559
Ref: 3f5f14445559
Node: サポートされている XPath 構文14446567
Ref: library/xml etree elementtree supported-xpath-syntax14446684
Ref: 3f6014446684
Node: リファレンス<5>14451889
Ref: library/xml etree elementtree reference14452049
Ref: 3f6114452049
Node: 関数<9>14452133
Ref: library/xml etree elementtree elementtree-functions14452200
Ref: 3f6214452200
Ref: library/xml etree elementtree functions14452200
Ref: 3f6314452200
Ref: library/xml etree elementtree xml etree ElementTree canonicalize14452233
Ref: e1b14452233
Ref: library/xml etree elementtree xml etree ElementTree Comment14454623
Ref: 3f6414454623
Ref: library/xml etree elementtree xml etree ElementTree dump14455444
Ref: 3f6514455444
Ref: library/xml etree elementtree xml etree ElementTree fromstring14456038
Ref: 3f5214456038
Ref: library/xml etree elementtree xml etree ElementTree fromstringlist14456543
Ref: 158f14456543
Ref: library/xml etree elementtree xml etree ElementTree indent14457117
Ref: 3f6714457117
Ref: library/xml etree elementtree xml etree ElementTree iselement14457646
Ref: 3f6814457646
Ref: library/xml etree elementtree xml etree ElementTree iterparse14457933
Ref: 3f214457933
Ref: library/xml etree elementtree xml etree ElementTree parse14460446
Ref: 3f6914460446
Ref: library/xml etree elementtree xml etree ElementTree ProcessingInstruction14460952
Ref: 3f6a14460952
Ref: library/xml etree elementtree xml etree ElementTree register_namespace14461738
Ref: 159014461738
Ref: library/xml etree elementtree xml etree ElementTree SubElement14462309
Ref: 195114462309
Ref: library/xml etree elementtree xml etree ElementTree tostring14463170
Ref: 13a314463170
Ref: library/xml etree elementtree xml etree ElementTree tostringlist14464425
Ref: 13a414464425
Ref: library/xml etree elementtree xml etree ElementTree XML14465904
Ref: 3f6614465904
Ref: library/xml etree elementtree xml etree ElementTree XMLID14466462
Ref: 3f6b14466462
Ref: 関数<9>-Footnote-114467041
Ref: 関数<9>-Footnote-214467082
Ref: 関数<9>-Footnote-314467474
Node: XInclude サポート14467866
Ref: library/xml etree elementtree elementtree-xinclude14468029
Ref: 3f6c14468029
Ref: library/xml etree elementtree xinclude-support14468029
Ref: 3f6d14468029
Ref: XInclude サポート-Footnote-114468405
Node: 使用例<34>14468445
Ref: library/xml etree elementtree id314468516
Ref: 3f6e14468516
Node: リファレンス<6>14470315
Ref: library/xml etree elementtree id414470448
Ref: 3f6f14470448
Node: 関数<10>14470755
Ref: library/xml etree elementtree elementinclude-functions14470858
Ref: 3f7014470858
Ref: library/xml etree elementtree id514470858
Ref: 3f7114470858
Ref: library/xml etree elementtree module-xml etree ElementInclude14470891
Ref: 12d14470891
Ref: library/xml etree elementtree xml etree ElementInclude default_loader14470891
Ref: 3f7214470891
Ref: library/xml etree elementtree xml etree ElementInclude include14471479
Ref: 3f7314471479
Node: Element オブジェクト14472366
Ref: library/xml etree elementtree element-objects14472508
Ref: 3f7414472508
Ref: library/xml etree elementtree elementtree-element-objects14472508
Ref: 3f7514472508
Ref: library/xml etree elementtree xml etree ElementTree Element14472577
Ref: 34b14472577
Ref: library/xml etree elementtree xml etree ElementTree Element tag14473368
Ref: 170714473368
Ref: library/xml etree elementtree xml etree ElementTree Element text14473524
Ref: 3f5714473524
Ref: library/xml etree elementtree xml etree ElementTree Element tail14473549
Ref: 3f7614473549
Ref: library/xml etree elementtree xml etree ElementTree Element attrib14474973
Ref: 3f7714474973
Ref: library/xml etree elementtree xml etree ElementTree Element clear14475553
Ref: 3f7814475553
Ref: library/xml etree elementtree xml etree ElementTree Element get14475780
Ref: 3f5814475780
Ref: library/xml etree elementtree xml etree ElementTree Element items14475990
Ref: 3f7914475990
Ref: library/xml etree elementtree xml etree ElementTree Element keys14476184
Ref: 3f7a14476184
Ref: library/xml etree elementtree xml etree ElementTree Element set14476350
Ref: 3f5a14476350
Ref: library/xml etree elementtree xml etree ElementTree Element append14476553
Ref: 3f5b14476553
Ref: library/xml etree elementtree xml etree ElementTree Element extend14476816
Ref: 159114476816
Ref: library/xml etree elementtree xml etree ElementTree Element find14477038
Ref: 1ac014477038
Ref: library/xml etree elementtree xml etree ElementTree Element findall14477466
Ref: 1ac114477466
Ref: library/xml etree elementtree xml etree ElementTree Element findtext14477891
Ref: 192b14477891
Ref: library/xml etree elementtree xml etree ElementTree Element insert14478501
Ref: 3f7b14478501
Ref: library/xml etree elementtree xml etree ElementTree Element iter14478754
Ref: 170814478754
Ref: library/xml etree elementtree xml etree ElementTree Element iterfind14479367
Ref: 159214479367
Ref: library/xml etree elementtree xml etree ElementTree Element itertext14479846
Ref: 159314479846
Ref: library/xml etree elementtree xml etree ElementTree Element makeelement14480144
Ref: 3f7c14480144
Ref: library/xml etree elementtree xml etree ElementTree Element remove14480426
Ref: 19a214480426
Ref: Element オブジェクト-Footnote-114483284
Node: ElementTree オブジェクト14483327
Ref: library/xml etree elementtree elementtree-elementtree-objects14483483
Ref: 3f7d14483483
Ref: library/xml etree elementtree elementtree-objects14483483
Ref: 3f7e14483483
Ref: library/xml etree elementtree xml etree ElementTree ElementTree14483560
Ref: d1d14483560
Ref: library/xml etree elementtree xml etree ElementTree ElementTree _setroot14483962
Ref: 3f7f14483962
Ref: library/xml etree elementtree xml etree ElementTree ElementTree find14484268
Ref: 3f8014484268
Ref: library/xml etree elementtree xml etree ElementTree ElementTree findall14484427
Ref: 3f8114484427
Ref: library/xml etree elementtree xml etree ElementTree ElementTree findtext14484592
Ref: 3f8214484592
Ref: library/xml etree elementtree xml etree ElementTree ElementTree getroot14484773
Ref: 3f8314484773
Ref: library/xml etree elementtree xml etree ElementTree ElementTree iter14484865
Ref: 3f8414484865
Ref: library/xml etree elementtree xml etree ElementTree ElementTree iterfind14485203
Ref: 3f8514485203
Ref: library/xml etree elementtree xml etree ElementTree ElementTree parse14485403
Ref: 3f8614485403
Ref: library/xml etree elementtree xml etree ElementTree ElementTree write14485887
Ref: e5f14485887
Ref: ElementTree オブジェクト-Footnote-114489140
Node: QName オブジェクト14489532
Ref: library/xml etree elementtree elementtree-qname-objects14489692
Ref: 3f8714489692
Ref: library/xml etree elementtree qname-objects14489692
Ref: 3f8814489692
Ref: library/xml etree elementtree xml etree ElementTree QName14489757
Ref: 3f8914489757
Node: TreeBuilder オブジェクト14490381
Ref: library/xml etree elementtree elementtree-treebuilder-objects14490539
Ref: 3f8a14490539
Ref: library/xml etree elementtree treebuilder-objects14490539
Ref: 3f8b14490539
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder14490616
Ref: e1d14490616
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder close14491796
Ref: 3f8c14491796
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder data14492011
Ref: 3f8d14492011
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder end14492231
Ref: 159414492231
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder start14492394
Ref: 1f7f14492394
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder comment14492620
Ref: 3f8e14492620
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder pi14492824
Ref: 3f8f14492824
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder doctype14493195
Ref: e6114493195
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder start_ns14493575
Ref: 3f9014493575
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder end_ns14493977
Ref: 3f9114493977
Ref: library/xml etree elementtree xml etree ElementTree C14NWriterTarget14494232
Ref: 3f9214494232
Ref: TreeBuilder オブジェクト-Footnote-114494785
Node: XMLParser オブジェクト14494826
Ref: library/xml etree elementtree elementtree-xmlparser-objects14494992
Ref: 3f9314494992
Ref: library/xml etree elementtree xmlparser-objects14494992
Ref: 3f9414494992
Ref: library/xml etree elementtree xml etree ElementTree XMLParser14495065
Ref: e1c14495065
Ref: library/xml etree elementtree xml etree ElementTree XMLParser close14496011
Ref: 3f9614496011
Ref: library/xml etree elementtree xml etree ElementTree XMLParser feed14496321
Ref: 3f9514496321
Ref: library/xml etree elementtree xml etree ElementTree XMLParser flush14496475
Ref: 77d14496475
Ref: XMLParser オブジェクト-Footnote-114499251
Node: XMLPullParser オブジェクト14499643
Ref: library/xml etree elementtree elementtree-xmlpullparser-objects14499789
Ref: 3f9714499789
Ref: library/xml etree elementtree xmlpullparser-objects14499789
Ref: 3f9814499789
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser14499870
Ref: 13a114499870
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser feed14500777
Ref: 3f5414500777
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser flush14500885
Ref: 77e14500885
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser close14501695
Ref: 3f9914501695
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser read_events14502123
Ref: 3f5514502123
Node: 例外<23>14504050
Ref: library/xml etree elementtree exceptions14504159
Ref: 3f9a14504159
Ref: library/xml etree elementtree xml etree ElementTree ParseError14504192
Ref: 163114504192
Ref: library/xml etree elementtree xml etree ElementTree ParseError code14504556
Ref: 3f9b14504556
Ref: library/xml etree elementtree xml etree ElementTree ParseError position14504820
Ref: 3f9c14504820
Node: xml dom --- ドキュメントオブジェクトモデル API14504973
Ref: library/xml dom doc14505216
Ref: 3f9d14505216
Ref: library/xml dom module-xml dom14505216
Ref: 12a14505216
Ref: library/xml dom translation-repo14505216
Ref: 3f9e14505216
Ref: library/xml dom xml-dom-the-document-object-model-api14505216
Ref: 3f9f14505216
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-114510307
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-214510384
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-314510450
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-414510497
Node: モジュールコンテンツ<2>14510543
Ref: library/xml dom module-contents14510711
Ref: 3fa214510711
Ref: library/xml dom xml dom registerDOMImplementation14510835
Ref: 3fa314510835
Ref: library/xml dom xml dom getDOMImplementation14511467
Ref: 3fa014511467
Ref: library/xml dom xml dom EMPTY_NAMESPACE14512564
Ref: 3fa414512564
Ref: library/xml dom xml dom XML_NAMESPACE14512939
Ref: 3fa514512939
Ref: library/xml dom xml dom XMLNS_NAMESPACE14513154
Ref: 3fa614513154
Ref: library/xml dom xml dom XHTML_NAMESPACE14513354
Ref: 3fa714513354
Ref: モジュールコンテンツ<2>-Footnote-114514099
Ref: モジュールコンテンツ<2>-Footnote-214514144
Ref: モジュールコンテンツ<2>-Footnote-314514201
Node: DOM 内のオブジェクト14514239
Ref: library/xml dom dom-objects14514425
Ref: 3fa814514425
Ref: library/xml dom objects-in-the-dom14514425
Ref: 3fa914514425
Node: DOMImplementation オブジェクト14519376
Ref: library/xml dom dom-implementation-objects14519509
Ref: 3faa14519509
Ref: library/xml dom domimplementation-objects14519509
Ref: 3fb314519509
Ref: library/xml dom xml dom DOMImplementation hasFeature14520010
Ref: 3fb414520010
Ref: library/xml dom xml dom DOMImplementation createDocument14520239
Ref: 3fb514520239
Ref: library/xml dom xml dom DOMImplementation createDocumentType14521007
Ref: 3fb614521007
Node: Node オブジェクト14521372
Ref: library/xml dom dom-node-objects14521541
Ref: 3fab14521541
Ref: library/xml dom node-objects14521541
Ref: 3fb714521541
Ref: library/xml dom xml dom Node nodeType14521680
Ref: 3fb814521680
Ref: library/xml dom xml dom Node parentNode14522202
Ref: 3fb914522202
Ref: library/xml dom xml dom Node attributes14522785
Ref: 3fba14522785
Ref: library/xml dom xml dom Node previousSibling14523068
Ref: 3fbb14523068
Ref: library/xml dom xml dom Node nextSibling14523698
Ref: 3fbc14523698
Ref: library/xml dom xml dom Node childNodes14524067
Ref: 3fbd14524067
Ref: library/xml dom xml dom Node firstChild14524229
Ref: 3fbe14524229
Ref: library/xml dom xml dom Node lastChild14524442
Ref: 3fbf14524442
Ref: library/xml dom xml dom Node localName14524654
Ref: 3fc014524654
Ref: library/xml dom xml dom Node prefix14524843
Ref: 3fc114524843
Ref: library/xml dom xml dom Node namespaceURI14525048
Ref: 3fc214525048
Ref: library/xml dom xml dom Node nodeName14525227
Ref: 3fc314525227
Ref: library/xml dom xml dom Node nodeValue14525761
Ref: 3fc414525761
Ref: library/xml dom xml dom Node hasAttributes14526064
Ref: 3fc514526064
Ref: library/xml dom xml dom Node hasChildNodes14526199
Ref: 3fc614526199
Ref: library/xml dom xml dom Node isSameNode14526340
Ref: 3fc714526340
Ref: library/xml dom xml dom Node appendChild14527316
Ref: 3fc814527316
Ref: library/xml dom xml dom Node insertBefore14527579
Ref: 3fc914527579
Ref: library/xml dom xml dom Node removeChild14528034
Ref: 3fca14528034
Ref: library/xml dom xml dom Node replaceChild14528461
Ref: 3fcb14528461
Ref: library/xml dom xml dom Node normalize14528770
Ref: 3fcc14528770
Ref: library/xml dom xml dom Node cloneNode14529104
Ref: 3fcd14529104
Node: NodeList オブジェクト14529336
Ref: library/xml dom dom-nodelist-objects14529500
Ref: 25bf14529500
Ref: library/xml dom nodelist-objects14529500
Ref: 3fce14529500
Ref: library/xml dom xml dom NodeList item14530288
Ref: 3fcf14530288
Ref: library/xml dom xml dom NodeList length14530544
Ref: 3fd014530544
Node: DocumentType オブジェクト14531413
Ref: library/xml dom documenttype-objects14531581
Ref: 3fd114531581
Ref: library/xml dom dom-documenttype-objects14531581
Ref: 3fac14531581
Ref: library/xml dom xml dom DocumentType publicId14532407
Ref: 3fd214532407
Ref: library/xml dom xml dom DocumentType systemId14532630
Ref: 3fd314532630
Ref: library/xml dom xml dom DocumentType internalSubset14532873
Ref: 3fd414532873
Ref: library/xml dom xml dom DocumentType name14533176
Ref: 3fd514533176
Ref: library/xml dom xml dom DocumentType entities14533330
Ref: 3fd614533330
Ref: library/xml dom xml dom DocumentType notations14533828
Ref: 3fd714533828
Node: Document オブジェクト14534301
Ref: library/xml dom document-objects14534471
Ref: 3fd814534471
Ref: library/xml dom dom-document-objects14534471
Ref: 3fad14534471
Ref: library/xml dom xml dom Document documentElement14534811
Ref: 19c514534811
Ref: library/xml dom xml dom Document createElement14534919
Ref: 3fd914534919
Ref: library/xml dom xml dom Document createElementNS14535279
Ref: 3fda14535279
Ref: library/xml dom xml dom Document createTextNode14535742
Ref: 3fdb14535742
Ref: library/xml dom xml dom Document createComment14536040
Ref: 3fdc14536040
Ref: library/xml dom xml dom Document createProcessingInstruction14536337
Ref: 3fdd14536337
Ref: library/xml dom xml dom Document createAttribute14536674
Ref: 3fde14536674
Ref: library/xml dom xml dom Document createAttributeNS14537067
Ref: 3fdf14537067
Ref: library/xml dom xml dom Document getElementsByTagName14537592
Ref: 3fe014537592
Ref: library/xml dom xml dom Document getElementsByTagNameNS14537797
Ref: 3fe114537797
Node: Element オブジェクト<2>14538137
Ref: library/xml dom dom-element-objects14538299
Ref: 3fae14538299
Ref: library/xml dom element-objects14538299
Ref: 3fe214538299
Ref: library/xml dom xml dom Element tagName14538497
Ref: 3fe314538497
Ref: library/xml dom xml dom Element getElementsByTagName14538683
Ref: 3fe414538683
Ref: library/xml dom xml dom Element getElementsByTagNameNS14538826
Ref: 3fe514538826
Ref: library/xml dom xml dom Element hasAttribute14538987
Ref: 3fe614538987
Ref: library/xml dom xml dom Element hasAttributeNS14539151
Ref: 3fe714539151
Ref: library/xml dom xml dom Element getAttribute14539363
Ref: 3fe814539363
Ref: library/xml dom xml dom Element getAttributeNode14539631
Ref: 3fe914539631
Ref: library/xml dom xml dom Element getAttributeNS14539770
Ref: 3fea14539770
Ref: library/xml dom xml dom Element getAttributeNodeNS14540092
Ref: 3feb14540092
Ref: library/xml dom xml dom Element removeAttribute14540281
Ref: 3fec14540281
Ref: library/xml dom xml dom Element removeAttributeNode14540479
Ref: 3fee14540479
Ref: library/xml dom xml dom Element removeAttributeNS14540710
Ref: 3fef14540710
Ref: library/xml dom xml dom Element setAttribute14541013
Ref: 3ff014541013
Ref: library/xml dom xml dom Element setAttributeNode14541125
Ref: 3ff114541125
Ref: library/xml dom xml dom Element setAttributeNodeNS14541531
Ref: 3ff314541531
Ref: library/xml dom xml dom Element setAttributeNS14541982
Ref: 3ff414541982
Node: Attr オブジェクト14542304
Ref: library/xml dom attr-objects14542459
Ref: 3ff514542459
Ref: library/xml dom dom-attr-objects14542459
Ref: 3faf14542459
Ref: library/xml dom xml dom Attr name14542614
Ref: 3ff614542614
Ref: library/xml dom xml dom Attr localName14542776
Ref: 3ff714542776
Ref: library/xml dom xml dom Attr prefix14542922
Ref: 3ff814542922
Ref: library/xml dom xml dom Attr value14543065
Ref: 3ff914543065
Node: NamedNodeMap Objects14543178
Ref: library/xml dom dom-attributelist-objects14543330
Ref: 3ffa14543330
Ref: library/xml dom namednodemap-objects14543330
Ref: 3ffb14543330
Ref: library/xml dom xml dom NamedNodeMap length14543463
Ref: 3ffc14543463
Ref: library/xml dom xml dom NamedNodeMap item14543539
Ref: 3ffd14543539
Node: Comment オブジェクト14544203
Ref: library/xml dom comment-objects14544396
Ref: 3ffe14544396
Ref: library/xml dom dom-comment-objects14544396
Ref: 3fb014544396
Ref: library/xml dom xml dom Comment data14544643
Ref: 3fff14544643
Node: Text オブジェクトおよび CDATASection オブジェクト14544958
Ref: library/xml dom dom-text-objects14545171
Ref: 3fb114545171
Ref: library/xml dom text-and-cdatasection-objects14545171
Ref: 400014545171
Ref: library/xml dom xml dom Text data14545918
Ref: 400114545918
Node: ProcessingInstruction オブジェクト14546542
Ref: library/xml dom dom-pi-objects14546739
Ref: 3fb214546739
Ref: library/xml dom processinginstruction-objects14546739
Ref: 400214546739
Ref: library/xml dom xml dom ProcessingInstruction target14547000
Ref: 400314547000
Ref: library/xml dom xml dom ProcessingInstruction data14547148
Ref: 400414547148
Node: 例外<24>14547258
Ref: library/xml dom dom-exceptions14547382
Ref: 400514547382
Ref: library/xml dom exceptions14547382
Ref: 400614547382
Ref: library/xml dom xml dom DOMException14548221
Ref: 400714548221
Ref: library/xml dom xml dom DomstringSizeErr14548432
Ref: 400814548432
Ref: library/xml dom xml dom HierarchyRequestErr14548766
Ref: 400914548766
Ref: library/xml dom xml dom IndexSizeErr14548907
Ref: 400a14548907
Ref: library/xml dom xml dom InuseAttributeErr14549089
Ref: 3ff214549089
Ref: library/xml dom xml dom InvalidAccessErr14549252
Ref: 400b14549252
Ref: library/xml dom xml dom InvalidCharacterErr14549429
Ref: 400c14549429
Ref: library/xml dom xml dom InvalidModificationErr14549803
Ref: 400d14549803
Ref: library/xml dom xml dom InvalidStateErr14549926
Ref: 400e14549926
Ref: library/xml dom xml dom NamespaceErr14550129
Ref: 400f14550129
Ref: library/xml dom xml dom NotFoundErr14550338
Ref: 3fed14550338
Ref: library/xml dom xml dom NotSupportedErr14550665
Ref: 401014550665
Ref: library/xml dom xml dom NoDataAllowedErr14550835
Ref: 401114550835
Ref: library/xml dom xml dom NoModificationAllowedErr14550988
Ref: 401214550988
Ref: library/xml dom xml dom SyntaxErr14551219
Ref: 401314551219
Ref: library/xml dom xml dom WrongDocumentErr14551335
Ref: 401414551335
Ref: 例外<24>-Footnote-114554422
Node: 適合性14554467
Ref: library/xml dom conformance14554611
Ref: 401514554611
Ref: library/xml dom dom-conformance14554611
Ref: 3fa114554611
Node: 型の対応付け14554891
Ref: library/xml dom dom-type-mapping14554988
Ref: 401614554988
Ref: library/xml dom type-mapping14554988
Ref: 401714554988
Node: アクセサメソッド14555861
Ref: library/xml dom accessor-methods14555958
Ref: 401814555958
Ref: library/xml dom dom-accessor-methods14555958
Ref: 401914555958
Node: xml dom minidom --- 最小限の DOM の実装14558482
Ref: library/xml dom minidom doc14558747
Ref: 401a14558747
Ref: library/xml dom minidom module-xml dom minidom14558747
Ref: 12b14558747
Ref: library/xml dom minidom translation-repo14558747
Ref: 401b14558747
Ref: library/xml dom minidom xml-dom-minidom-minimal-dom-implementation14558747
Ref: 401c14558747
Ref: library/xml dom minidom xml dom minidom parse14560022
Ref: 401d14560022
Ref: library/xml dom minidom xml dom minidom parseString14560789
Ref: 401e14560789
Ref: xml dom minidom --- 最小限の DOM の実装-Footnote-114563549
Ref: xml dom minidom --- 最小限の DOM の実装-Footnote-214563625
Node: DOM オブジェクト14563672
Ref: library/xml dom minidom dom-objects14563796
Ref: 401f14563796
Ref: library/xml dom minidom minidom-objects14563796
Ref: 402014563796
Ref: library/xml dom minidom xml dom minidom Node unlink14564042
Ref: 402114564042
Ref: library/xml dom minidom xml dom minidom Node writexml14565182
Ref: e5c14565182
Ref: library/xml dom minidom xml dom minidom Node toxml14566760
Ref: e5d14566760
Ref: library/xml dom minidom xml dom minidom Node toprettyxml14567808
Ref: e5e14567808
Ref: DOM オブジェクト-Footnote-114568670
Node: DOM の例14569156
Ref: library/xml dom minidom dom-example14569311
Ref: 402214569311
Ref: library/xml dom minidom id214569311
Ref: 402314569311
Node: minidom と DOM 標準14571367
Ref: library/xml dom minidom minidom-and-dom14571491
Ref: 402414571491
Ref: library/xml dom minidom minidom-and-the-dom-standard14571491
Ref: 402514571491
Node: xml dom pulldom --- 部分的な DOM ツリー構築のサポート14574802
Ref: library/xml dom pulldom doc14575050
Ref: 402614575050
Ref: library/xml dom pulldom module-xml dom pulldom14575050
Ref: 12c14575050
Ref: library/xml dom pulldom translation-repo14575050
Ref: 402714575050
Ref: library/xml dom pulldom xml-dom-pulldom-support-for-building-partial-dom-trees14575050
Ref: 402814575050
Ref: library/xml dom pulldom xml dom pulldom PullDOM14577939
Ref: 402a14577939
Ref: library/xml dom pulldom xml dom pulldom SAX2DOM14578080
Ref: 402c14578080
Ref: library/xml dom pulldom xml dom pulldom parse14578221
Ref: 402d14578221
Ref: library/xml dom pulldom xml dom pulldom parseString14578991
Ref: 402f14578991
Ref: library/xml dom pulldom xml dom pulldom default_bufsize14579152
Ref: 403014579152
Ref: xml dom pulldom --- 部分的な DOM ツリー構築のサポート-Footnote-114579541
Node: DOMEventStream オブジェクト14579617
Ref: library/xml dom pulldom domeventstream-objects14579754
Ref: 403114579754
Ref: library/xml dom pulldom id114579754
Ref: 403214579754
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream14579835
Ref: b2114579835
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream getEvent14580033
Ref: 403314580033
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream expandNode14580560
Ref: 402914580560
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream reset14581288
Ref: 403414581288
Node: xml sax --- SAX2 バーサーのサポート14581321
Ref: library/xml sax doc14581580
Ref: 403514581580
Ref: library/xml sax module-xml sax14581580
Ref: 13214581580
Ref: library/xml sax translation-repo14581580
Ref: 403614581580
Ref: library/xml sax xml-sax-support-for-sax2-parsers14581580
Ref: 403714581580
Ref: library/xml sax xml sax make_parser14582838
Ref: 202914582838
Ref: library/xml sax xml sax parse14583520
Ref: 1ff414583520
Ref: library/xml sax xml sax parseString14584402
Ref: 125014584402
Ref: library/xml sax xml sax SAXException14586764
Ref: 403c14586764
Ref: library/xml sax xml sax SAXParseException14587819
Ref: 403a14587819
Ref: library/xml sax xml sax SAXNotRecognizedException14588315
Ref: 403d14588315
Ref: library/xml sax xml sax SAXNotSupportedException14588708
Ref: 403e14588708
Ref: xml sax --- SAX2 バーサーのサポート-Footnote-114589869
Ref: xml sax --- SAX2 バーサーのサポート-Footnote-214589946
Node: SAXException オブジェクト14589981
Ref: library/xml sax sax-exception-objects14590093
Ref: 403f14590093
Ref: library/xml sax saxexception-objects14590093
Ref: 404014590093
Ref: library/xml sax xml sax SAXException getMessage14590269
Ref: 404114590269
Ref: library/xml sax xml sax SAXException getException14590385
Ref: 404214590385
Node: xml sax handler --- SAX ハンドラーの基底クラス14590524
Ref: library/xml sax handler doc14590765
Ref: 404314590765
Ref: library/xml sax handler module-xml sax handler14590765
Ref: 13314590765
Ref: library/xml sax handler translation-repo14590765
Ref: 404414590765
Ref: library/xml sax handler xml-sax-handler-base-classes-for-sax-handlers14590765
Ref: 404514590765
Ref: library/xml sax handler xml sax handler ContentHandler14591475
Ref: 402b14591475
Ref: library/xml sax handler xml sax handler DTDHandler14591798
Ref: 404614591798
Ref: library/xml sax handler xml sax handler EntityResolver14592070
Ref: 404714592070
Ref: library/xml sax handler xml sax handler ErrorHandler14592430
Ref: 403914592430
Ref: library/xml sax handler xml sax handler LexicalHandler14592809
Ref: c3714592809
Ref: library/xml sax handler xml sax handler feature_namespaces14593098
Ref: 404814593098
Ref: library/xml sax handler xml sax handler feature_namespace_prefixes14593498
Ref: 404914593498
Ref: library/xml sax handler xml sax handler feature_string_interning14594026
Ref: 404a14594026
Ref: library/xml sax handler xml sax handler feature_validation14594544
Ref: 404b14594544
Ref: library/xml sax handler xml sax handler feature_external_ges14594975
Ref: 19d714594975
Ref: library/xml sax handler xml sax handler feature_external_pes14595604
Ref: 404c14595604
Ref: library/xml sax handler xml sax handler all_features14596061
Ref: 404d14596061
Ref: library/xml sax handler xml sax handler property_lexical_handler14596137
Ref: 404e14596137
Ref: library/xml sax handler xml sax handler property_declaration_handler14596487
Ref: 404f14596487
Ref: library/xml sax handler xml sax handler property_dom_node14596879
Ref: 405014596879
Ref: library/xml sax handler xml sax handler property_xml_string14597325
Ref: 405114597325
Ref: library/xml sax handler xml sax handler all_properties14597594
Ref: 405214597594
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-114597912
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-214597988
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-314598053
Node: ContentHandler オブジェクト14598104
Ref: library/xml sax handler content-handler-objects14598269
Ref: 405314598269
Ref: library/xml sax handler contenthandler-objects14598269
Ref: 405414598269
Ref: library/xml sax handler xml sax handler ContentHandler setDocumentLocator14598625
Ref: 405514598625
Ref: library/xml sax handler xml sax handler ContentHandler startDocument14599928
Ref: 405614599928
Ref: library/xml sax handler xml sax handler ContentHandler endDocument14600258
Ref: 405714600258
Ref: library/xml sax handler xml sax handler ContentHandler startPrefixMapping14600695
Ref: 405814600695
Ref: library/xml sax handler xml sax handler ContentHandler endPrefixMapping14602056
Ref: 405914602056
Ref: library/xml sax handler xml sax handler ContentHandler startElement14602485
Ref: 18fb14602485
Ref: library/xml sax handler xml sax handler ContentHandler endElement14603102
Ref: 18fc14603102
Ref: library/xml sax handler xml sax handler ContentHandler startElementNS14603348
Ref: 405b14603348
Ref: library/xml sax handler xml sax handler ContentHandler endElementNS14604334
Ref: 405d14604334
Ref: library/xml sax handler xml sax handler ContentHandler characters14604618
Ref: 18fd14604618
Ref: library/xml sax handler xml sax handler ContentHandler ignorableWhitespace14606022
Ref: 405e14606022
Ref: library/xml sax handler xml sax handler ContentHandler processingInstruction14606939
Ref: 405f14606939
Ref: library/xml sax handler xml sax handler ContentHandler skippedEntity14607511
Ref: 406014607511
Node: DTDHandler オブジェクト14608160
Ref: library/xml sax handler dtd-handler-objects14608367
Ref: 406114608367
Ref: library/xml sax handler dtdhandler-objects14608367
Ref: 406214608367
Ref: library/xml sax handler xml sax handler DTDHandler notationDecl14608529
Ref: 406314608529
Ref: library/xml sax handler xml sax handler DTDHandler unparsedEntityDecl14608657
Ref: 406414608657
Node: EntityResolver オブジェクト14608835
Ref: library/xml sax handler entity-resolver-objects14609040
Ref: 406514609040
Ref: library/xml sax handler entityresolver-objects14609040
Ref: 406614609040
Ref: library/xml sax handler xml sax handler EntityResolver resolveEntity14609123
Ref: 406714609123
Node: ErrorHandler オブジェクト14609458
Ref: library/xml sax handler errorhandler-objects14609656
Ref: 406814609656
Ref: library/xml sax handler sax-error-handler14609656
Ref: 406914609656
Ref: library/xml sax handler xml sax handler ErrorHandler error14610320
Ref: 406a14610320
Ref: library/xml sax handler xml sax handler ErrorHandler fatalError14610800
Ref: 406b14610800
Ref: library/xml sax handler xml sax handler ErrorHandler warning14611037
Ref: 406c14611037
Node: LexicalHandler Objects14611455
Ref: library/xml sax handler lexical-handler-objects14611611
Ref: 406d14611611
Ref: library/xml sax handler lexicalhandler-objects14611611
Ref: 406e14611611
Ref: library/xml sax handler xml sax handler LexicalHandler comment14612216
Ref: 406f14612216
Ref: library/xml sax handler xml sax handler LexicalHandler startDTD14612376
Ref: 407014612376
Ref: library/xml sax handler xml sax handler LexicalHandler endDTD14612540
Ref: 407114612540
Ref: library/xml sax handler xml sax handler LexicalHandler startCDATA14612626
Ref: 407214612626
Ref: library/xml sax handler xml sax handler LexicalHandler endCDATA14612826
Ref: 407314612826
Node: xml sax saxutils --- SAX ユーティリティー14612921
Ref: library/xml sax utils doc14613183
Ref: 407414613183
Ref: library/xml sax utils module-xml sax saxutils14613183
Ref: 13414613183
Ref: library/xml sax utils translation-repo14613183
Ref: 407514613183
Ref: library/xml sax utils xml-sax-saxutils-sax-utilities14613183
Ref: 407614613183
Ref: library/xml sax utils xml sax saxutils escape14613593
Ref: 407714613593
Ref: library/xml sax utils xml sax saxutils unescape14614385
Ref: 407814614385
Ref: library/xml sax utils xml sax saxutils quoteattr14614894
Ref: 407914614894
Ref: library/xml sax utils xml sax saxutils XMLGenerator14615855
Ref: 407a14615855
Ref: library/xml sax utils xml sax saxutils XMLFilterBase14616919
Ref: 407b14616919
Ref: library/xml sax utils xml sax saxutils prepare_input_source14617532
Ref: 407c14617532
Ref: xml sax saxutils --- SAX ユーティリティー-Footnote-114618115
Node: xml sax xmlreader --- XML パーサーのインターフェース14618192
Ref: library/xml sax reader doc14618460
Ref: 407e14618460
Ref: library/xml sax reader module-xml sax xmlreader14618460
Ref: 13514618460
Ref: library/xml sax reader translation-repo14618460
Ref: 407f14618460
Ref: library/xml sax reader xml-sax-xmlreader-interface-for-xml-parsers14618460
Ref: 408014618460
Ref: library/xml sax reader xml sax xmlreader XMLReader14619061
Ref: 402e14619061
Ref: library/xml sax reader xml sax xmlreader IncrementalParser14619167
Ref: 408114619167
Ref: library/xml sax reader xml sax xmlreader Locator14620688
Ref: 403b14620688
Ref: library/xml sax reader xml sax xmlreader InputSource14621126
Ref: 124f14621126
Ref: library/xml sax reader xml sax xmlreader AttributesImpl14622092
Ref: 408214622092
Ref: library/xml sax reader xml sax xmlreader AttributesNSImpl14622788
Ref: 408314622788
Ref: xml sax xmlreader --- XML パーサーのインターフェース-Footnote-114623652
Node: XMLReader オブジェクト14623730
Ref: library/xml sax reader id114623905
Ref: 408414623905
Ref: library/xml sax reader xmlreader-objects14623905
Ref: 408514623905
Ref: library/xml sax reader xml sax xmlreader XMLReader parse14624049
Ref: 407d14624049
Ref: library/xml sax reader xml sax xmlreader XMLReader getContentHandler14624843
Ref: 408614624843
Ref: library/xml sax reader xml sax xmlreader XMLReader setContentHandler14624956
Ref: 408714624956
Ref: library/xml sax reader xml sax xmlreader XMLReader getDTDHandler14625184
Ref: 408814625184
Ref: library/xml sax reader xml sax xmlreader XMLReader setDTDHandler14625289
Ref: 408914625289
Ref: library/xml sax reader xml sax xmlreader XMLReader getEntityResolver14625498
Ref: 408a14625498
Ref: library/xml sax reader xml sax xmlreader XMLReader setEntityResolver14625611
Ref: 408b14625611
Ref: library/xml sax reader xml sax xmlreader XMLReader getErrorHandler14625966
Ref: 408c14625966
Ref: library/xml sax reader xml sax xmlreader XMLReader setErrorHandler14626075
Ref: 408d14626075
Ref: library/xml sax reader xml sax xmlreader XMLReader setLocale14626328
Ref: 408e14626328
Ref: library/xml sax reader xml sax xmlreader XMLReader getFeature14626836
Ref: 408f14626836
Ref: library/xml sax reader xml sax xmlreader XMLReader setFeature14627160
Ref: 403814627160
Ref: library/xml sax reader xml sax xmlreader XMLReader getProperty14627550
Ref: 409014627550
Ref: library/xml sax reader xml sax xmlreader XMLReader setProperty14627877
Ref: 409114627877
Node: IncrementalParser オブジェクト14628270
Ref: library/xml sax reader incremental-parser-objects14628480
Ref: 409214628480
Ref: library/xml sax reader incrementalparser-objects14628480
Ref: 409314628480
Ref: library/xml sax reader xml sax xmlreader IncrementalParser feed14628670
Ref: 409414628670
Ref: library/xml sax reader xml sax xmlreader IncrementalParser close14628769
Ref: 409514628769
Ref: library/xml sax reader xml sax xmlreader IncrementalParser reset14629002
Ref: 409614629002
Node: Locator オブジェクト14629340
Ref: library/xml sax reader id214629552
Ref: 409714629552
Ref: library/xml sax reader locator-objects14629552
Ref: 409814629552
Ref: library/xml sax reader xml sax xmlreader Locator getColumnNumber14629705
Ref: 409914629705
Ref: library/xml sax reader xml sax xmlreader Locator getLineNumber14629821
Ref: 409a14629821
Ref: library/xml sax reader xml sax xmlreader Locator getPublicId14629935
Ref: 409b14629935
Ref: library/xml sax reader xml sax xmlreader Locator getSystemId14630047
Ref: 409c14630047
Node: InputSource オブジェクト14630159
Ref: library/xml sax reader input-source-objects14630370
Ref: 409d14630370
Ref: library/xml sax reader inputsource-objects14630370
Ref: 409e14630370
Ref: library/xml sax reader xml sax xmlreader InputSource setPublicId14630447
Ref: 409f14630447
Ref: library/xml sax reader xml sax xmlreader InputSource getPublicId14630573
Ref: 40a014630573
Ref: library/xml sax reader xml sax xmlreader InputSource setSystemId14630694
Ref: 40a114630694
Ref: library/xml sax reader xml sax xmlreader InputSource getSystemId14630826
Ref: 40a214630826
Ref: library/xml sax reader xml sax xmlreader InputSource setEncoding14630953
Ref: 40a314630953
Ref: library/xml sax reader xml sax xmlreader InputSource getEncoding14631446
Ref: 40a414631446
Ref: library/xml sax reader xml sax xmlreader InputSource setByteStream14631572
Ref: 40a514631572
Ref: library/xml sax reader xml sax xmlreader InputSource getByteStream14632162
Ref: 40a614632162
Ref: library/xml sax reader xml sax xmlreader InputSource setCharacterStream14632458
Ref: 40a714632458
Ref: library/xml sax reader xml sax xmlreader InputSource getCharacterStream14632811
Ref: 40a814632811
Node: Attributes インターフェース14632937
Ref: library/xml sax reader attributes-objects14633159
Ref: 405a14633159
Ref: library/xml sax reader the-attributes-interface14633159
Ref: 40a914633159
Ref: library/xml sax reader xml sax xmlreader Attributes getLength14633538
Ref: 40aa14633538
Ref: library/xml sax reader xml sax xmlreader Attributes getNames14633618
Ref: 40ab14633618
Ref: library/xml sax reader xml sax xmlreader Attributes getType14633700
Ref: 40ac14633700
Ref: library/xml sax reader xml sax xmlreader Attributes getValue14633832
Ref: 40ad14633832
Node: AttributesNS インターフェース14633923
Ref: library/xml sax reader attributes-ns-objects14634106
Ref: 405c14634106
Ref: library/xml sax reader the-attributesns-interface14634106
Ref: 40ae14634106
Ref: library/xml sax reader xml sax xmlreader AttributesNS getValueByQName14634577
Ref: 40af14634577
Ref: library/xml sax reader xml sax xmlreader AttributesNS getNameByQName14634672
Ref: 40b014634672
Ref: library/xml sax reader xml sax xmlreader AttributesNS getQNameByName14634828
Ref: 40b114634828
Ref: library/xml sax reader xml sax xmlreader AttributesNS getQNames14634969
Ref: 40b214634969
Node: xml parsers expat --- Expat を使用した高速な XML 解析14635069
Ref: library/pyexpat doc14635279
Ref: 40b314635279
Ref: library/pyexpat module-xml parsers expat14635279
Ref: 12f14635279
Ref: library/pyexpat translation-repo14635279
Ref: 40b414635279
Ref: library/pyexpat xml-parsers-expat-fast-xml-parsing-using-expat14635279
Ref: 40b514635279
Ref: library/pyexpat xml parsers expat ExpatError14636375
Ref: 163214636375
Ref: library/pyexpat xml parsers expat error14636630
Ref: 40b714636630
Ref: library/pyexpat xml parsers expat XMLParserType14636716
Ref: 40b814636716
Ref: library/pyexpat xml parsers expat ErrorString14636916
Ref: 40ba14636916
Ref: library/pyexpat xml parsers expat ParserCreate14637058
Ref: 40b914637058
Ref: library/pyexpat xmlparser-non-root14637820
Ref: 40bb14637820
Ref: xml parsers expat --- Expat を使用した高速な XML 解析-Footnote-114640260
Ref: xml parsers expat --- Expat を使用した高速な XML 解析-Footnote-214640654
Node: XMLParser オブジェクト<2>14640687
Ref: library/pyexpat id214640844
Ref: 40bc14640844
Ref: library/pyexpat xmlparser-objects14640844
Ref: 2c314640844
Ref: library/pyexpat xml parsers expat xmlparser Parse14641002
Ref: 40bd14641002
Ref: library/pyexpat xml parsers expat xmlparser ParseFile14641499
Ref: 40be14641499
Ref: library/pyexpat xml parsers expat xmlparser SetBase14641818
Ref: 40bf14641818
Ref: library/pyexpat xml parsers expat xmlparser GetBase14642271
Ref: 40c314642271
Ref: library/pyexpat xml parsers expat xmlparser GetInputContext14642520
Ref: 40c414642520
Ref: library/pyexpat xml parsers expat xmlparser ExternalEntityParserCreate14642913
Ref: 195214642913
Ref: library/pyexpat xml parsers expat xmlparser SetParamEntityParsing14643538
Ref: 40c714643538
Ref: library/pyexpat xml parsers expat xmlparser UseForeignDTD14643941
Ref: 40c814643941
Ref: library/pyexpat xml parsers expat xmlparser SetReparseDeferralEnabled14645086
Ref: 78014645086
Ref: library/pyexpat xml parsers expat xmlparser GetReparseDeferralEnabled14646537
Ref: 77f14646537
Ref: library/pyexpat xml parsers expat xmlparser SetBillionLaughsAttackProtectionActivationThreshold14646839
Ref: 2c414646839
Ref: library/pyexpat xml parsers expat xmlparser SetBillionLaughsAttackProtectionMaximumAmplification14648001
Ref: 2c514648001
Ref: library/pyexpat xml parsers expat xmlparser SetAllocTrackerActivationThreshold14649876
Ref: 2c114649876
Ref: library/pyexpat xml parsers expat xmlparser SetAllocTrackerMaximumAmplification14650772
Ref: 2c214650772
Ref: library/pyexpat xml parsers expat xmlparser buffer_size14652581
Ref: 191014652581
Ref: library/pyexpat xml parsers expat xmlparser buffer_text14652906
Ref: 187a14652906
Ref: library/pyexpat xml parsers expat xmlparser buffer_used14653452
Ref: 40cd14653452
Ref: library/pyexpat xml parsers expat xmlparser ordered_attributes14653777
Ref: 40c514653777
Ref: library/pyexpat xml parsers expat xmlparser specified_attributes14654400
Ref: 40c614654400
Ref: library/pyexpat xml parsers expat xmlparser ErrorByteIndex14655402
Ref: 40ce14655402
Ref: library/pyexpat xml parsers expat xmlparser ErrorCode14655510
Ref: 40cf14655510
Ref: library/pyexpat xml parsers expat xmlparser ErrorColumnNumber14655759
Ref: 40d014655759
Ref: library/pyexpat xml parsers expat xmlparser ErrorLineNumber14655858
Ref: 40d114655858
Ref: library/pyexpat xml parsers expat xmlparser CurrentByteIndex14656434
Ref: 40d214656434
Ref: library/pyexpat xml parsers expat xmlparser CurrentColumnNumber14656550
Ref: 40d314656550
Ref: library/pyexpat xml parsers expat xmlparser CurrentLineNumber14656657
Ref: 40d414656657
Ref: library/pyexpat xml parsers expat xmlparser XmlDeclHandler14657240
Ref: 40d514657240
Ref: library/pyexpat xml parsers expat xmlparser StartDoctypeDeclHandler14657901
Ref: 40c914657901
Ref: library/pyexpat xml parsers expat xmlparser EndDoctypeDeclHandler14658459
Ref: 40ca14658459
Ref: library/pyexpat xml parsers expat xmlparser ElementDeclHandler14658671
Ref: 194314658671
Ref: library/pyexpat xml parsers expat xmlparser AttlistDeclHandler14658912
Ref: 40d614658912
Ref: library/pyexpat xml parsers expat xmlparser StartElementHandler14659985
Ref: 40d714659985
Ref: library/pyexpat xml parsers expat xmlparser EndElementHandler14660417
Ref: 40d814660417
Ref: library/pyexpat xml parsers expat xmlparser ProcessingInstructionHandler14660541
Ref: 40d914660541
Ref: library/pyexpat xml parsers expat xmlparser CharacterDataHandler14660681
Ref: 190f14660681
Ref: library/pyexpat xml parsers expat xmlparser UnparsedEntityDeclHandler14661346
Ref: 40c214661346
Ref: library/pyexpat xml parsers expat xmlparser EntityDeclHandler14661926
Ref: 40dc14661926
Ref: library/pyexpat xml parsers expat xmlparser NotationDeclHandler14663005
Ref: 40c114663005
Ref: library/pyexpat xml parsers expat xmlparser StartNamespaceDeclHandler14663388
Ref: 40dd14663388
Ref: library/pyexpat xml parsers expat xmlparser EndNamespaceDeclHandler14663707
Ref: 40de14663707
Ref: library/pyexpat xml parsers expat xmlparser CommentHandler14664300
Ref: 40df14664300
Ref: library/pyexpat xml parsers expat xmlparser StartCdataSectionHandler14664526
Ref: 40da14664526
Ref: library/pyexpat xml parsers expat xmlparser EndCdataSectionHandler14664836
Ref: 40db14664836
Ref: library/pyexpat xml parsers expat xmlparser DefaultHandler14664958
Ref: 40e014664958
Ref: library/pyexpat xml parsers expat xmlparser DefaultHandlerExpand14665351
Ref: 40e114665351
Ref: library/pyexpat xml parsers expat xmlparser NotStandaloneHandler14665613
Ref: 40e214665613
Ref: library/pyexpat xml parsers expat xmlparser ExternalEntityRefHandler14666235
Ref: 40c014666235
Ref: XMLParser オブジェクト<2>-Footnote-114668079
Ref: XMLParser オブジェクト<2>-Footnote-214668139
Ref: XMLParser オブジェクト<2>-Footnote-314668199
Ref: XMLParser オブジェクト<2>-Footnote-414668264
Node: ExpatError 例外14668315
Ref: library/pyexpat expaterror-exceptions14668494
Ref: 40e314668494
Ref: library/pyexpat expaterror-objects14668494
Ref: 40b614668494
Ref: library/pyexpat xml parsers expat ExpatError code14668639
Ref: 40e414668639
Ref: library/pyexpat xml parsers expat ExpatError lineno14669397
Ref: 40cb14669397
Ref: library/pyexpat xml parsers expat ExpatError offset14669534
Ref: 40cc14669534
Node: 使用例<35>14669697
Ref: library/pyexpat example14669869
Ref: 40e714669869
Ref: library/pyexpat expat-example14669869
Ref: 40e814669869
Node: 内容モデルの記述14671046
Ref: library/pyexpat content-model-descriptions14671222
Ref: 40e914671222
Ref: library/pyexpat expat-content-models14671222
Ref: 40ea14671222
Ref: library/pyexpat module-xml parsers expat model14671222
Ref: 13114671222
Node: Expat エラー定数14673443
Ref: library/pyexpat expat-error-constants14673597
Ref: 40eb14673597
Ref: library/pyexpat expat-errors14673597
Ref: 40ec14673597
Ref: library/pyexpat module-xml parsers expat errors14673597
Ref: 13014673597
Ref: library/pyexpat xml parsers expat errors codes14674186
Ref: 40e614674186
Ref: library/pyexpat xml parsers expat errors messages14674340
Ref: 40e514674340
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ASYNC_ENTITY14674509
Ref: 40ed14674509
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF14674573
Ref: 40ee14674573
Ref: library/pyexpat xml parsers expat errors XML_ERROR_BAD_CHAR_REF14674806
Ref: 40ef14674806
Ref: library/pyexpat xml parsers expat errors XML_ERROR_BINARY_ENTITY_REF14675003
Ref: 40f014675003
Ref: library/pyexpat xml parsers expat errors XML_ERROR_DUPLICATE_ATTRIBUTE14675229
Ref: 40f114675229
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INCORRECT_ENCODING14675394
Ref: 40f214675394
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INVALID_TOKEN14675464
Ref: 40f314675464
Ref: library/pyexpat xml parsers expat errors XML_ERROR_JUNK_AFTER_DOC_ELEMENT14675732
Ref: 40f414675732
Ref: library/pyexpat xml parsers expat errors XML_ERROR_MISPLACED_XML_PI14675885
Ref: 40f514675885
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_ELEMENTS14676040
Ref: 40f614676040
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_MEMORY14676270
Ref: 40f714676270
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PARAM_ENTITY_REF14676398
Ref: 40f814676398
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PARTIAL_CHAR14676566
Ref: 40f914676566
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RECURSIVE_ENTITY_REF14676691
Ref: 40fa14676691
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SYNTAX14676963
Ref: 40fb14676963
Ref: library/pyexpat xml parsers expat errors XML_ERROR_TAG_MISMATCH14677106
Ref: 40fc14677106
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNCLOSED_TOKEN14677261
Ref: 40fd14677261
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNDEFINED_ENTITY14677491
Ref: 40fe14677491
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNKNOWN_ENCODING14677644
Ref: 40ff14677644
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNCLOSED_CDATA_SECTION14677804
Ref: 410014677804
Ref: library/pyexpat xml parsers expat errors XML_ERROR_EXTERNAL_ENTITY_HANDLING14677938
Ref: 410114677938
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_STANDALONE14678014
Ref: 410214678014
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNEXPECTED_STATE14678311
Ref: 410314678311
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ENTITY_DECLARED_IN_PE14678379
Ref: 410414678379
Ref: library/pyexpat xml parsers expat errors XML_ERROR_FEATURE_REQUIRES_XML_DTD14678452
Ref: 410514678452
Ref: library/pyexpat xml parsers expat errors XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING14678757
Ref: 410614678757
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNBOUND_PREFIX14679100
Ref: 410714679100
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNDECLARING_PREFIX14679287
Ref: 410814679287
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INCOMPLETE_PE14679472
Ref: 410914679472
Ref: library/pyexpat xml parsers expat errors XML_ERROR_XML_DECL14679634
Ref: 410a14679634
Ref: library/pyexpat xml parsers expat errors XML_ERROR_TEXT_DECL14679743
Ref: 410b14679743
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PUBLICID14679889
Ref: 410c14679889
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SUSPENDED14680027
Ref: 410d14680027
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_SUSPENDED14680389
Ref: 410e14680389
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ABORTED14680548
Ref: 410f14680548
Ref: library/pyexpat xml parsers expat errors XML_ERROR_FINISHED14680674
Ref: 411014680674
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SUSPEND_PE14681050
Ref: 411114681050
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_PREFIX_XML14681112
Ref: 411214681112
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_PREFIX_XMLNS14681303
Ref: 411314681303
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_NAMESPACE_URI14681470
Ref: 411414681470
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INVALID_ARGUMENT14681685
Ref: 411514681685
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_BUFFER14681820
Ref: 411614681820
Ref: library/pyexpat xml parsers expat errors XML_ERROR_AMPLIFICATION_LIMIT_BREACH14681948
Ref: 411714681948
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_STARTED14682130
Ref: 1b1314682130
Node: インターネットプロトコルとサポート14682308
Ref: library/internet doc14682511
Ref: 411814682511
Ref: library/internet internet14682511
Ref: 411914682511
Ref: library/internet internet-protocols-and-support14682511
Ref: 411a14682511
Ref: library/internet translation-repo14682511
Ref: 411b14682511
Node: webbrowser --- 便利なウェブブラウザコントローラー14685609
Ref: library/webbrowser doc14685837
Ref: 411c14685837
Ref: library/webbrowser module-webbrowser14685837
Ref: 11e14685837
Ref: library/webbrowser webbrowser-convenient-web-browser-controller14685837
Ref: 411d14685837
Ref: webbrowser --- 便利なウェブブラウザコントローラー-Footnote-114688618
Ref: webbrowser --- 便利なウェブブラウザコントローラー-Footnote-214688688
Node: コマンドライン・インターフェース<6>14688866
Ref: library/webbrowser command-line-interface14689055
Ref: 411e14689055
Ref: library/webbrowser webbrowser-cli14689055
Ref: 411f14689055
Ref: library/webbrowser cmdoption-webbrowser-n14689422
Ref: 412014689422
Ref: library/webbrowser cmdoption-webbrowser-new-window14689422
Ref: 412114689422
Ref: library/webbrowser cmdoption-webbrowser-t14689510
Ref: 412214689510
Ref: library/webbrowser cmdoption-webbrowser-new-tab14689510
Ref: 412314689510
Ref: library/webbrowser webbrowser Error14689795
Ref: 412414689795
Ref: library/webbrowser webbrowser open14689955
Ref: 194414689955
Ref: library/webbrowser webbrowser open_new14691132
Ref: 412514691132
Ref: library/webbrowser webbrowser open_new_tab14691489
Ref: 412614691489
Ref: library/webbrowser webbrowser get14691843
Ref: 412714691843
Ref: library/webbrowser webbrowser register14692136
Ref: 412814692136
Node: Browser controller objects14699968
Ref: library/webbrowser browser-controller-objects14700157
Ref: 412914700157
Ref: library/webbrowser browser-controllers14700157
Ref: 412a14700157
Ref: library/webbrowser webbrowser controller name14700374
Ref: 79f14700374
Ref: library/webbrowser webbrowser controller open14700452
Ref: 412b14700452
Ref: library/webbrowser webbrowser controller open_new14700835
Ref: 412c14700835
Ref: library/webbrowser webbrowser controller open_new_tab14701175
Ref: 412d14701175
Node: wsgiref --- WSGI ユーティリティとリファレンス実装14701472
Ref: library/wsgiref doc14701751
Ref: 412e14701751
Ref: library/wsgiref module-wsgiref14701751
Ref: 12114701751
Ref: library/wsgiref translation-repo14701751
Ref: 412f14701751
Ref: library/wsgiref wsgiref-wsgi-utilities-and-reference-implementation14701751
Ref: 413014701751
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-114704191
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-214704255
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-314704297
Node: wsgiref util -- WSGI environment utilities14704334
Ref: library/wsgiref module-wsgiref util14704532
Ref: 12614704532
Ref: library/wsgiref wsgiref-util-wsgi-environment-utilities14704532
Ref: 413114704532
Ref: library/wsgiref wsgiref util guess_scheme14705167
Ref: 413314705167
Ref: library/wsgiref wsgiref util request_uri14705989
Ref: 413414705989
Ref: library/wsgiref wsgiref util application_uri14706383
Ref: 413514706383
Ref: library/wsgiref wsgiref util shift_path_info14706705
Ref: 413614706705
Ref: library/wsgiref wsgiref util setup_testing_defaults14708820
Ref: 413714708820
Ref: library/wsgiref wsgiref util is_hop_by_hop14710871
Ref: 1c6214710871
Ref: library/wsgiref wsgiref util FileWrapper14711072
Ref: b2214711072
Ref: wsgiref util -- WSGI environment utilities-Footnote-114712409
Ref: wsgiref util -- WSGI environment utilities-Footnote-214712451
Ref: wsgiref util -- WSGI environment utilities-Footnote-314712493
Ref: wsgiref util -- WSGI environment utilities-Footnote-414712535
Ref: wsgiref util -- WSGI environment utilities-Footnote-514712577
Node: wsgiref headers -- WSGI response header tools14712636
Ref: library/wsgiref module-wsgiref headers14712893
Ref: 12314712893
Ref: library/wsgiref wsgiref-headers-wsgi-response-header-tools14712893
Ref: 413a14712893
Ref: library/wsgiref wsgiref headers Headers14713202
Ref: 124c14713202
Ref: library/wsgiref wsgiref headers Headers get_all14715968
Ref: 413b14715968
Ref: library/wsgiref wsgiref headers Headers add_header14716540
Ref: 413c14716540
Ref: wsgiref headers -- WSGI response header tools-Footnote-114718075
Node: wsgiref simple_server -- a simple WSGI HTTP server14718117
Ref: library/wsgiref module-wsgiref simple_server14718377
Ref: 12414718377
Ref: library/wsgiref wsgiref-simple-server-a-simple-wsgi-http-server14718377
Ref: 413d14718377
Ref: library/wsgiref wsgiref simple_server make_server14719195
Ref: 413e14719195
Ref: library/wsgiref wsgiref simple_server demo_app14720136
Ref: 413814720136
Ref: library/wsgiref wsgiref simple_server WSGIServer14720662
Ref: 414014720662
Ref: library/wsgiref wsgiref simple_server WSGIServer set_app14721553
Ref: 414214721553
Ref: library/wsgiref wsgiref simple_server WSGIServer get_app14721760
Ref: 414314721760
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler14722189
Ref: 414414722189
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler get_environ14723027
Ref: 414514723027
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler get_stderr14723618
Ref: 414614723618
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler handle14723838
Ref: 414714723838
Ref: wsgiref simple_server -- a simple WSGI HTTP server-Footnote-114724205
Ref: wsgiref simple_server -- a simple WSGI HTTP server-Footnote-214724247
Node: wsgiref validate --- WSGI conformance checker14724289
Ref: library/wsgiref module-wsgiref validate14724551
Ref: 12714724551
Ref: library/wsgiref wsgiref-validate-wsgi-conformance-checker14724551
Ref: 414814724551
Ref: library/wsgiref wsgiref validate validator14725609
Ref: 414914725609
Ref: wsgiref validate --- WSGI conformance checker-Footnote-114728169
Ref: wsgiref validate --- WSGI conformance checker-Footnote-214728211
Ref: wsgiref validate --- WSGI conformance checker-Footnote-314728270
Node: wsgiref handlers -- server/gateway base classes14728312
Ref: library/wsgiref module-wsgiref handlers14728576
Ref: 12214728576
Ref: library/wsgiref wsgiref-handlers-server-gateway-base-classes14728576
Ref: 414a14728576
Ref: library/wsgiref wsgiref handlers CGIHandler14729050
Ref: 414b14729050
Ref: library/wsgiref wsgiref handlers IISCGIHandler14729939
Ref: 414d14729939
Ref: library/wsgiref wsgiref handlers BaseCGIHandler14731393
Ref: 414c14731393
Ref: library/wsgiref wsgiref handlers SimpleHandler14732467
Ref: 414e14732467
Ref: library/wsgiref wsgiref handlers BaseHandler14733510
Ref: 1fe114733510
Ref: library/wsgiref wsgiref handlers BaseHandler run14734018
Ref: 415414734018
Ref: library/wsgiref wsgiref handlers BaseHandler _write14734528
Ref: 415214734528
Ref: library/wsgiref wsgiref handlers BaseHandler _flush14734988
Ref: 415314734988
Ref: library/wsgiref wsgiref handlers BaseHandler get_stdin14735274
Ref: 414f14735274
Ref: library/wsgiref wsgiref handlers BaseHandler get_stderr14735483
Ref: 415014735483
Ref: library/wsgiref wsgiref handlers BaseHandler add_cgi_vars14735694
Ref: 415114735694
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_multithread14736345
Ref: 415714736345
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_multiprocess14736704
Ref: 415814736704
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_run_once14737065
Ref: 415914737065
Ref: library/wsgiref wsgiref handlers BaseHandler os_environ14737336
Ref: 415a14737336
Ref: library/wsgiref wsgiref handlers BaseHandler server_software14737834
Ref: 415b14737834
Ref: library/wsgiref wsgiref handlers BaseHandler get_scheme14738517
Ref: 415d14738517
Ref: library/wsgiref wsgiref handlers BaseHandler setup_environ14738887
Ref: 415e14738887
Ref: library/wsgiref wsgiref handlers BaseHandler log_exception14739621
Ref: 416014739621
Ref: library/wsgiref wsgiref handlers BaseHandler traceback_limit14740297
Ref: 416114740297
Ref: library/wsgiref wsgiref handlers BaseHandler error_output14740590
Ref: 416214740590
Ref: library/wsgiref wsgiref handlers BaseHandler error_status14742044
Ref: 416314742044
Ref: library/wsgiref wsgiref handlers BaseHandler error_headers14742316
Ref: 416414742316
Ref: library/wsgiref wsgiref handlers BaseHandler error_body14742728
Ref: 416514742728
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_file_wrapper14743207
Ref: 415f14743207
Ref: library/wsgiref wsgiref handlers BaseHandler sendfile14743480
Ref: 416614743480
Ref: library/wsgiref wsgiref handlers BaseHandler origin_server14744136
Ref: 415c14744136
Ref: library/wsgiref wsgiref handlers BaseHandler http_version14744749
Ref: 416714744749
Ref: library/wsgiref wsgiref handlers read_environ14745031
Ref: 157714745031
Ref: wsgiref handlers -- server/gateway base classes-Footnote-114745940
Ref: wsgiref handlers -- server/gateway base classes-Footnote-214745982
Ref: wsgiref handlers -- server/gateway base classes-Footnote-314746024
Ref: wsgiref handlers -- server/gateway base classes-Footnote-414746066
Ref: wsgiref handlers -- server/gateway base classes-Footnote-514746108
Node: wsgiref types -- WSGI types for static type checking14746150
Ref: library/wsgiref module-wsgiref types14746382
Ref: 12514746382
Ref: library/wsgiref wsgiref-types-wsgi-types-for-static-type-checking14746382
Ref: 416814746382
Ref: library/wsgiref wsgiref types StartResponse14746627
Ref: 413f14746627
Ref: library/wsgiref wsgiref types WSGIEnvironment14746769
Ref: 413214746769
Ref: library/wsgiref wsgiref types WSGIApplication14746876
Ref: 416914746876
Ref: library/wsgiref wsgiref types InputStream14746981
Ref: 415514746981
Ref: library/wsgiref wsgiref types ErrorStream14747094
Ref: 415614747094
Ref: library/wsgiref wsgiref types FileWrapper14747207
Ref: 413914747207
Ref: wsgiref types -- WSGI types for static type checking-Footnote-114747451
Ref: wsgiref types -- WSGI types for static type checking-Footnote-214747493
Ref: wsgiref types -- WSGI types for static type checking-Footnote-314747563
Ref: wsgiref types -- WSGI types for static type checking-Footnote-414747605
Ref: wsgiref types -- WSGI types for static type checking-Footnote-514747671
Ref: wsgiref types -- WSGI types for static type checking-Footnote-614747737
Node: 使用例<36>14747821
Ref: library/wsgiref examples14747997
Ref: 416a14747997
Node: urllib --- URL を扱うモジュール群14750824
Ref: library/urllib doc14751105
Ref: 416b14751105
Ref: library/urllib module-urllib14751105
Ref: 11114751105
Ref: library/urllib translation-repo14751105
Ref: 416c14751105
Ref: library/urllib urllib-url-handling-modules14751105
Ref: 416d14751105
Ref: urllib --- URL を扱うモジュール群-Footnote-114751855
Node: urllib request --- URL を開くための大規模なライブラリ14751919
Ref: library/urllib request doc14752186
Ref: 416e14752186
Ref: library/urllib request module-urllib request14752186
Ref: 11414752186
Ref: library/urllib request translation-repo14752186
Ref: 416f14752186
Ref: library/urllib request urllib-request-extensible-library-for-opening-urls14752186
Ref: 417014752186
Ref: library/urllib request urllib request urlopen14753385
Ref: 58614753385
Ref: library/urllib request urllib request install_opener14757818
Ref: 417514757818
Ref: library/urllib request urllib request build_opener14758556
Ref: 58814758556
Ref: library/urllib request urllib request pathname2url14759958
Ref: 54214759958
Ref: library/urllib request urllib request url2pathname14761109
Ref: 54014761109
Ref: library/urllib request urllib request getproxies14763038
Ref: 417114763038
Ref: library/urllib request urllib request Request14764516
Ref: 138614764516
Ref: library/urllib request urllib request OpenerDirector14770151
Ref: 19bc14770151
Ref: library/urllib request urllib request BaseHandler14770482
Ref: 417614770482
Ref: library/urllib request urllib request HTTPDefaultErrorHandler14770751
Ref: 417714770751
Ref: library/urllib request urllib request HTTPRedirectHandler14770997
Ref: 417814770997
Ref: library/urllib request urllib request HTTPCookieProcessor14771106
Ref: 417d14771106
Ref: library/urllib request urllib request ProxyHandler14771229
Ref: 1fc414771229
Ref: library/urllib request urllib request HTTPPasswordMgr14772708
Ref: 417e14772708
Ref: library/urllib request urllib request HTTPPasswordMgrWithDefaultRealm14772861
Ref: 417f14772861
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth14773162
Ref: 124814773162
Ref: library/urllib request urllib request AbstractBasicAuthHandler14773611
Ref: 1e8514773611
Ref: library/urllib request urllib request HTTPBasicAuthHandler14775294
Ref: 418214775294
Ref: library/urllib request urllib request ProxyBasicAuthHandler14775891
Ref: 418314775891
Ref: library/urllib request urllib request AbstractDigestAuthHandler14776359
Ref: 1f7e14776359
Ref: library/urllib request urllib request HTTPDigestAuthHandler14777063
Ref: 418414777063
Ref: library/urllib request urllib request ProxyDigestAuthHandler14778092
Ref: 418514778092
Ref: library/urllib request urllib request HTTPHandler14778561
Ref: 10bc14778561
Ref: library/urllib request urllib request HTTPSHandler14778642
Ref: 15e014778642
Ref: library/urllib request urllib request FileHandler14779012
Ref: 417a14779012
Ref: library/urllib request urllib request DataHandler14779104
Ref: 138514779104
Ref: library/urllib request urllib request FTPHandler14779209
Ref: 417914779209
Ref: library/urllib request urllib request CacheFTPHandler14779288
Ref: 1cbc14779288
Ref: library/urllib request urllib request UnknownHandler14779494
Ref: 417414779494
Ref: library/urllib request urllib request HTTPErrorProcessor14779639
Ref: 417b14779639
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-114780843
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-214780917
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-314780968
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-414781037
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-514781096
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-614781155
Node: Request オブジェクト14781214
Ref: library/urllib request id114781387
Ref: 418614781387
Ref: library/urllib request request-objects14781387
Ref: 418714781387
Ref: library/urllib request urllib request Request full_url14781784
Ref: 138814781784
Ref: library/urllib request urllib request Request type14782161
Ref: 418814782161
Ref: library/urllib request urllib request Request host14782222
Ref: 418914782222
Ref: library/urllib request urllib request Request origin_req_host14782409
Ref: 418a14782409
Ref: library/urllib request urllib request Request selector14782552
Ref: 418b14782552
Ref: library/urllib request urllib request Request data14782754
Ref: 138914782754
Ref: library/urllib request urllib request Request unverifiable14783166
Ref: 418c14783166
Ref: library/urllib request urllib request Request method14783341
Ref: 138714783341
Ref: library/urllib request urllib request Request get_method14784188
Ref: 152714784188
Ref: library/urllib request urllib request Request add_header14784762
Ref: 417c14784762
Ref: library/urllib request urllib request Request add_unredirected_header14785799
Ref: 418d14785799
Ref: library/urllib request urllib request Request has_header14785970
Ref: 418e14785970
Ref: library/urllib request urllib request Request remove_header14786193
Ref: 138b14786193
Ref: library/urllib request urllib request Request get_full_url14786441
Ref: 418f14786441
Ref: library/urllib request urllib request Request set_proxy14786645
Ref: 419014786645
Ref: library/urllib request urllib request Request get_header14786997
Ref: 419114786997
Ref: library/urllib request urllib request Request header_items14787194
Ref: 419214787194
Ref: Request オブジェクト-Footnote-114787626
Node: OpenerDirector オブジェクト14787685
Ref: library/urllib request opener-director-objects14787897
Ref: 419314787897
Ref: library/urllib request openerdirector-objects14787897
Ref: 419414787897
Ref: library/urllib request urllib request OpenerDirector add_handler14788072
Ref: 419514788072
Ref: library/urllib request urllib request OpenerDirector open14789970
Ref: 138a14789970
Ref: library/urllib request urllib request OpenerDirector error14790877
Ref: 419a14790877
Node: BaseHandler オブジェクト14793324
Ref: library/urllib request base-handler-objects14793548
Ref: 419d14793548
Ref: library/urllib request basehandler-objects14793548
Ref: 419e14793548
Ref: library/urllib request urllib request BaseHandler add_parent14793882
Ref: 419f14793882
Ref: library/urllib request urllib request BaseHandler close14794012
Ref: 41a014794012
Ref: library/urllib request urllib request BaseHandler parent14794503
Ref: 41a114794503
Ref: library/urllib request urllib request BaseHandler default_open14794714
Ref: 419b14794714
Ref: library/urllib request protocol-open14795678
Ref: 419614795678
Ref: library/urllib request urllib request BaseHandler unknown_open14796167
Ref: 419c14796167
Ref: library/urllib request urllib request BaseHandler http_error_default14796734
Ref: 41a214796734
Ref: library/urllib request http-error-nnn14797798
Ref: 419714797798
Ref: library/urllib request protocol-request14798557
Ref: 419814798557
Ref: library/urllib request protocol-response14799166
Ref: 419914799166
Node: HTTPRedirectHandler オブジェクト14800007
Ref: library/urllib request http-redirect-handler14800236
Ref: 41a314800236
Ref: library/urllib request httpredirecthandler-objects14800236
Ref: 41a414800236
Ref: library/urllib request urllib request HTTPRedirectHandler redirect_request14800920
Ref: 41a514800920
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30114802381
Ref: 41a614802381
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30214802753
Ref: 41a714802753
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30314802967
Ref: 41a814802967
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30714803185
Ref: 41a914803185
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30814803461
Ref: 41aa14803461
Ref: HTTPRedirectHandler オブジェクト-Footnote-114803802
Ref: HTTPRedirectHandler オブジェクト-Footnote-214803861
Ref: HTTPRedirectHandler オブジェクト-Footnote-314803920
Node: HTTPCookieProcessor オブジェクト14803979
Ref: library/urllib request http-cookie-processor14804209
Ref: 41ab14804209
Ref: library/urllib request httpcookieprocessor-objects14804209
Ref: 41ac14804209
Ref: library/urllib request urllib request HTTPCookieProcessor cookiejar14804393
Ref: 41ad14804393
Node: ProxyHandler オブジェクト14804543
Ref: library/urllib request proxy-handler14804769
Ref: 41af14804769
Ref: library/urllib request proxyhandler-objects14804769
Ref: 41b014804769
Node: HTTPPasswordMgr オブジェクト14805454
Ref: library/urllib request http-password-mgr14805689
Ref: 418014805689
Ref: library/urllib request httppasswordmgr-objects14805689
Ref: 41b114805689
Ref: library/urllib request urllib request HTTPPasswordMgr add_password14805925
Ref: 41b214805925
Ref: library/urllib request urllib request HTTPPasswordMgr find_user_password14806385
Ref: 1dee14806385
Node: HTTPPasswordMgrWithPriorAuth オブジェクト14806967
Ref: library/urllib request http-password-mgr-with-prior-auth14807214
Ref: 418114807214
Ref: library/urllib request httppasswordmgrwithpriorauth-objects14807214
Ref: 41b314807214
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth add_password14807542
Ref: 41b414807542
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth find_user_password14808038
Ref: 41b514808038
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth update_authenticated14808259
Ref: 41b614808259
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth is_authenticated14808486
Ref: 1def14808486
Node: AbstractBasicAuthHandler オブジェクト14808676
Ref: library/urllib request abstract-basic-auth-handler14808928
Ref: 41b714808928
Ref: library/urllib request abstractbasicauthhandler-objects14808928
Ref: 41b814808928
Ref: library/urllib request urllib request AbstractBasicAuthHandler http_error_auth_reqed14809029
Ref: 41b914809029
Node: HTTPBasicAuthHandler オブジェクト14810091
Ref: library/urllib request http-basic-auth-handler14810336
Ref: 41ba14810336
Ref: library/urllib request httpbasicauthhandler-objects14810336
Ref: 41bb14810336
Ref: library/urllib request urllib request HTTPBasicAuthHandler http_error_40114810431
Ref: 41bc14810431
Node: ProxyBasicAuthHandler オブジェクト14810620
Ref: library/urllib request proxy-basic-auth-handler14810866
Ref: 41bd14810866
Ref: library/urllib request proxybasicauthhandler-objects14810866
Ref: 41be14810866
Ref: library/urllib request urllib request ProxyBasicAuthHandler http_error_40714810963
Ref: 41bf14810963
Node: AbstractDigestAuthHandler オブジェクト14811153
Ref: library/urllib request abstract-digest-auth-handler14811400
Ref: 41c014811400
Ref: library/urllib request abstractdigestauthhandler-objects14811400
Ref: 41c114811400
Ref: library/urllib request urllib request AbstractDigestAuthHandler http_error_auth_reqed14811505
Ref: 41c214811505
Node: HTTPDigestAuthHandler オブジェクト14811944
Ref: library/urllib request http-digest-auth-handler14812192
Ref: 41c314812192
Ref: library/urllib request httpdigestauthhandler-objects14812192
Ref: 41c414812192
Ref: library/urllib request urllib request HTTPDigestAuthHandler http_error_40114812289
Ref: 41c514812289
Node: ProxyDigestAuthHandler オブジェクト14812479
Ref: library/urllib request proxy-digest-auth-handler14812713
Ref: 41c614812713
Ref: library/urllib request proxydigestauthhandler-objects14812713
Ref: 41c714812713
Ref: library/urllib request urllib request ProxyDigestAuthHandler http_error_40714812812
Ref: 41c814812812
Node: HTTPHandler オブジェクト14813003
Ref: library/urllib request http-handler-objects14813228
Ref: 41c914813228
Ref: library/urllib request httphandler-objects14813228
Ref: 41ca14813228
Ref: library/urllib request urllib request HTTPHandler http_open14813305
Ref: 41cb14813305
Node: HTTPSHandler オブジェクト14813502
Ref: library/urllib request https-handler-objects14813716
Ref: 41cc14813716
Ref: library/urllib request httpshandler-objects14813716
Ref: 41cd14813716
Ref: library/urllib request urllib request HTTPSHandler https_open14813795
Ref: 41ce14813795
Node: FileHandler オブジェクト14813994
Ref: library/urllib request file-handler-objects14814208
Ref: 41cf14814208
Ref: library/urllib request filehandler-objects14814208
Ref: 41d014814208
Ref: library/urllib request urllib request FileHandler file_open14814285
Ref: 41d114814285
Node: DataHandler オブジェクト14814716
Ref: library/urllib request data-handler-objects14814928
Ref: 41d214814928
Ref: library/urllib request datahandler-objects14814928
Ref: 41d314814928
Ref: library/urllib request urllib request DataHandler data_open14815005
Ref: 41d414815005
Ref: DataHandler オブジェクト-Footnote-114815567
Node: FTPHandler オブジェクト14815626
Ref: library/urllib request ftp-handler-objects14815842
Ref: 41d514815842
Ref: library/urllib request ftphandler-objects14815842
Ref: 41d614815842
Ref: library/urllib request urllib request FTPHandler ftp_open14815917
Ref: 41d714815917
Node: CacheFTPHandler オブジェクト14816139
Ref: library/urllib request cacheftp-handler-objects14816358
Ref: 41d814816358
Ref: library/urllib request cacheftphandler-objects14816358
Ref: 41d914816358
Ref: library/urllib request urllib request CacheFTPHandler setTimeout14816591
Ref: 41da14816591
Ref: library/urllib request urllib request CacheFTPHandler setMaxConns14816707
Ref: 41db14816707
Node: UnknownHandler オブジェクト14816839
Ref: library/urllib request unknown-handler-objects14817066
Ref: 41dc14817066
Ref: library/urllib request unknownhandler-objects14817066
Ref: 41dd14817066
Ref: library/urllib request urllib request UnknownHandler unknown_open14817149
Ref: 41de14817149
Node: HTTPErrorProcessor オブジェクト14817254
Ref: library/urllib request http-error-processor-objects14817460
Ref: 41df14817460
Ref: library/urllib request httperrorprocessor-objects14817460
Ref: 41e014817460
Ref: library/urllib request urllib request HTTPErrorProcessor http_response14817551
Ref: 41e114817551
Ref: library/urllib request urllib request HTTPErrorProcessor https_response14818154
Ref: 41e214818154
Node: 使用例<37>14818349
Ref: library/urllib request examples14818561
Ref: 41e314818561
Ref: library/urllib request urllib-request-examples14818561
Ref: 41e414818561
Ref: library/urllib request urllib-examples14825288
Ref: 41e614825288
Node: レガシーインターフェース<2>14827075
Ref: library/urllib request legacy-interface14827277
Ref: 41e714827277
Ref: library/urllib request urllib request urlretrieve14827581
Ref: 58714827581
Ref: library/urllib request urllib request urlcleanup14830806
Ref: 1fcb14830806
Node: urllib request Restrictions14831005
Ref: library/urllib request urllib-request-restrictions14831185
Ref: 41e914831185
Node: urllib response --- Response classes used by urllib14834537
Ref: library/urllib request module-urllib response14834813
Ref: 11514834813
Ref: library/urllib request urllib-response-response-classes-used-by-urllib14834813
Ref: 41ea14834813
Ref: library/urllib request urllib response addinfourl14835264
Ref: 417214835264
Ref: library/urllib request urllib response addinfourl url14835307
Ref: 1b2714835307
Ref: library/urllib request urllib response addinfourl headers14835485
Ref: 41eb14835485
Ref: library/urllib request urllib response addinfourl status14835624
Ref: 41ec14835624
Ref: library/urllib request urllib response addinfourl geturl14835748
Ref: 41ed14835748
Ref: library/urllib request urllib response addinfourl info14835914
Ref: 41ee14835914
Ref: library/urllib request urllib response addinfourl code14836081
Ref: 41ef14836081
Ref: library/urllib request urllib response addinfourl getcode14836241
Ref: 41f014836241
Node: urllib parse --- URL を構成要素に解析する14836410
Ref: library/urllib parse doc14836692
Ref: 41f114836692
Ref: library/urllib parse module-urllib parse14836692
Ref: 11314836692
Ref: library/urllib parse translation-repo14836692
Ref: 41f214836692
Ref: library/urllib parse urllib-parse-parse-urls-into-components14836692
Ref: 41f314836692
Ref: urllib parse --- URL を構成要素に解析する-Footnote-114838943
Ref: urllib parse --- URL を構成要素に解析する-Footnote-214839015
Ref: urllib parse --- URL を構成要素に解析する-Footnote-314839074
Node: URL の解析14839133
Ref: library/urllib parse url-parsing14839263
Ref: 41f414839263
Ref: library/urllib parse urllib parse urlsplit14839472
Ref: 2ae14839472
Ref: library/urllib parse urllib parse parse_qs14848856
Ref: 59014848856
Ref: library/urllib parse urllib parse parse_qsl14851703
Ref: 58f14851703
Ref: library/urllib parse urllib parse urlunsplit14854200
Ref: 2b114854200
Ref: library/urllib parse urllib parse urlparse14855139
Ref: 2af14855139
Ref: library/urllib parse urllib parse urlunparse14856079
Ref: 2b214856079
Ref: library/urllib parse urllib parse urljoin14857059
Ref: 124a14857059
Ref: library/urllib parse urllib parse urldefrag14858951
Ref: 2b014858951
Ref: library/urllib parse urllib parse unwrap14860699
Ref: 41fb14860699
Ref: URL の解析-Footnote-114861048
Ref: URL の解析-Footnote-214861107
Ref: URL の解析-Footnote-314861173
Ref: URL の解析-Footnote-414861239
Ref: URL の解析-Footnote-514861305
Ref: URL の解析-Footnote-614861371
Ref: URL の解析-Footnote-714861433
Ref: URL の解析-Footnote-814861492
Ref: URL の解析-Footnote-914861551
Ref: URL の解析-Footnote-1014861610
Ref: URL の解析-Footnote-1114861670
Ref: URL の解析-Footnote-1214861730
Ref: URL の解析-Footnote-1314861790
Node: URL parsing security14861857
Ref: library/urllib parse id814862038
Ref: 41fc14862038
Ref: library/urllib parse url-parsing-security14862038
Ref: 41f814862038
Ref: URL parsing security-Footnote-114863569
Ref: URL parsing security-Footnote-214863631
Node: ASCII エンコードバイト列の解析14863690
Ref: library/urllib parse id914863888
Ref: 41fd14863888
Ref: library/urllib parse parsing-ascii-encoded-bytes14863888
Ref: 160314863888
Node: 構造化された解析結果14866439
Ref: library/urllib parse structured-parse-results14866636
Ref: 41fe14866636
Ref: library/urllib parse urlparse-result-object14866636
Ref: 41f714866636
Ref: library/urllib parse urllib parse urllib parse SplitResult geturl14867054
Ref: 41ff14867054
Ref: library/urllib parse urllib parse DefragResult14868455
Ref: 420014868455
Ref: library/urllib parse urllib parse ParseResult14868761
Ref: 41f914868761
Ref: library/urllib parse urllib parse SplitResult14869078
Ref: 41f514869078
Ref: library/urllib parse urllib parse DefragResultBytes14869541
Ref: 420114869541
Ref: library/urllib parse urllib parse ParseResultBytes14869850
Ref: 41fa14869850
Ref: library/urllib parse urllib parse SplitResultBytes14870189
Ref: 41f614870189
Node: URL のクオート14870529
Ref: library/urllib parse url-quoting14870675
Ref: 420214870675
Ref: library/urllib parse urllib parse quote14871126
Ref: f6614871126
Ref: library/urllib parse urllib parse quote_plus14872755
Ref: 160214872755
Ref: library/urllib parse urllib parse quote_from_bytes14873266
Ref: 1d6e14873266
Ref: library/urllib parse urllib parse unquote14873622
Ref: 1d1914873622
Ref: library/urllib parse urllib parse unquote_plus14874587
Ref: 420314874587
Ref: library/urllib parse urllib parse unquote_to_bytes14874999
Ref: 1d1a14874999
Ref: library/urllib parse urllib parse urlencode14875573
Ref: 124914875573
Ref: URL のクオート-Footnote-114880630
Ref: URL のクオート-Footnote-214880689
Ref: URL のクオート-Footnote-314880748
Ref: URL のクオート-Footnote-414880785
Ref: URL のクオート-Footnote-514880844
Ref: URL のクオート-Footnote-614880903
Ref: URL のクオート-Footnote-714880962
Ref: URL のクオート-Footnote-814881021
Ref: URL のクオート-Footnote-914881080
Node: urllib error --- urllib request によって送出される例外クラス14881139
Ref: library/urllib error doc14881422
Ref: 420414881422
Ref: library/urllib error module-urllib error14881422
Ref: 11214881422
Ref: library/urllib error translation-repo14881422
Ref: 420514881422
Ref: library/urllib error urllib-error-exception-classes-raised-by-urllib-request14881422
Ref: 420614881422
Ref: library/urllib error urllib error URLError14881931
Ref: 54114881931
Ref: library/urllib error urllib error URLError reason14882186
Ref: 420714882186
Ref: library/urllib error urllib error HTTPError14882536
Ref: 138c14882536
Ref: library/urllib error urllib error HTTPError url14882995
Ref: 420814882995
Ref: library/urllib error urllib error HTTPError code14883115
Ref: 420914883115
Ref: library/urllib error urllib error HTTPError reason14883391
Ref: 420b14883391
Ref: library/urllib error urllib error HTTPError headers14883557
Ref: 138d14883557
Ref: library/urllib error urllib error HTTPError fp14883784
Ref: 420c14883784
Ref: library/urllib error urllib error ContentTooShortError14883920
Ref: 41e814883920
Ref: library/urllib error urllib error ContentTooShortError content14884226
Ref: 420d14884226
Ref: urllib error --- urllib request によって送出される例外クラス-Footnote-114884382
Ref: urllib error --- urllib request によって送出される例外クラス-Footnote-214884454
Node: urllib robotparser --- robots txt 用のパーサー14884513
Ref: library/urllib robotparser doc14884777
Ref: 420e14884777
Ref: library/urllib robotparser module-urllib robotparser14884777
Ref: 11614884777
Ref: library/urllib robotparser translation-repo14884777
Ref: 420f14884777
Ref: library/urllib robotparser urllib-robotparser-parser-for-robots-txt14884777
Ref: 421014884777
Ref: library/urllib robotparser urllib robotparser RobotFileParser14885306
Ref: 10be14885306
Ref: library/urllib robotparser urllib robotparser RobotFileParser set_url14885487
Ref: 421114885487
Ref: library/urllib robotparser urllib robotparser RobotFileParser read14885616
Ref: 1b1114885616
Ref: library/urllib robotparser urllib robotparser RobotFileParser parse14885729
Ref: 208f14885729
Ref: library/urllib robotparser urllib robotparser RobotFileParser can_fetch14885824
Ref: 421214885824
Ref: library/urllib robotparser urllib robotparser RobotFileParser mtime14886091
Ref: 421314886091
Ref: library/urllib robotparser urllib robotparser RobotFileParser modified14886420
Ref: 421414886420
Ref: library/urllib robotparser urllib robotparser RobotFileParser crawl_delay14886577
Ref: 421514886577
Ref: library/urllib robotparser urllib robotparser RobotFileParser request_rate14887112
Ref: 421614887112
Ref: library/urllib robotparser urllib robotparser RobotFileParser site_maps14887684
Ref: 202f14887684
Ref: urllib robotparser --- robots txt 用のパーサー-Footnote-114888656
Ref: urllib robotparser --- robots txt 用のパーサー-Footnote-214888735
Node: http --- HTTP モジュール群14888794
Ref: library/http doc14889038
Ref: 421714889038
Ref: library/http http-http-modules14889038
Ref: 421814889038
Ref: library/http module-http14889038
Ref: 7114889038
Ref: library/http translation-repo14889038
Ref: 421914889038
Ref: library/http http HTTPStatus14889994
Ref: cd414889994
Ref: http --- HTTP モジュール群-Footnote-114890825
Node: HTTP ステータスコード14890898
Ref: library/http http-status-codes14891046
Ref: 421a14891046
Ref: library/http id114891046
Ref: 421b14891046
Ref: HTTP ステータスコード-Footnote-114905568
Ref: HTTP ステータスコード-Footnote-214905652
Ref: HTTP ステータスコード-Footnote-314905711
Ref: HTTP ステータスコード-Footnote-414905770
Ref: HTTP ステータスコード-Footnote-514905829
Ref: HTTP ステータスコード-Footnote-614905888
Ref: HTTP ステータスコード-Footnote-714905947
Ref: HTTP ステータスコード-Footnote-814906006
Ref: HTTP ステータスコード-Footnote-914906065
Ref: HTTP ステータスコード-Footnote-1014906124
Ref: HTTP ステータスコード-Footnote-1114906184
Ref: HTTP ステータスコード-Footnote-1214906244
Ref: HTTP ステータスコード-Footnote-1314906304
Ref: HTTP ステータスコード-Footnote-1414906364
Ref: HTTP ステータスコード-Footnote-1514906424
Ref: HTTP ステータスコード-Footnote-1614906484
Ref: HTTP ステータスコード-Footnote-1714906544
Ref: HTTP ステータスコード-Footnote-1814906604
Ref: HTTP ステータスコード-Footnote-1914906664
Ref: HTTP ステータスコード-Footnote-2014906724
Ref: HTTP ステータスコード-Footnote-2114906784
Ref: HTTP ステータスコード-Footnote-2214906844
Ref: HTTP ステータスコード-Footnote-2314906904
Ref: HTTP ステータスコード-Footnote-2414906964
Ref: HTTP ステータスコード-Footnote-2514907024
Ref: HTTP ステータスコード-Footnote-2614907084
Ref: HTTP ステータスコード-Footnote-2714907144
Ref: HTTP ステータスコード-Footnote-2814907204
Ref: HTTP ステータスコード-Footnote-2914907264
Ref: HTTP ステータスコード-Footnote-3014907324
Ref: HTTP ステータスコード-Footnote-3114907384
Ref: HTTP ステータスコード-Footnote-3214907444
Ref: HTTP ステータスコード-Footnote-3314907504
Ref: HTTP ステータスコード-Footnote-3414907564
Ref: HTTP ステータスコード-Footnote-3514907624
Ref: HTTP ステータスコード-Footnote-3614907684
Ref: HTTP ステータスコード-Footnote-3714907744
Ref: HTTP ステータスコード-Footnote-3814907804
Ref: HTTP ステータスコード-Footnote-3914907864
Ref: HTTP ステータスコード-Footnote-4014907924
Ref: HTTP ステータスコード-Footnote-4114907984
Ref: HTTP ステータスコード-Footnote-4214908044
Ref: HTTP ステータスコード-Footnote-4314908104
Ref: HTTP ステータスコード-Footnote-4414908164
Ref: HTTP ステータスコード-Footnote-4514908224
Ref: HTTP ステータスコード-Footnote-4614908284
Ref: HTTP ステータスコード-Footnote-4714908344
Ref: HTTP ステータスコード-Footnote-4814908404
Ref: HTTP ステータスコード-Footnote-4914908464
Ref: HTTP ステータスコード-Footnote-5014908524
Ref: HTTP ステータスコード-Footnote-5114908584
Ref: HTTP ステータスコード-Footnote-5214908644
Ref: HTTP ステータスコード-Footnote-5314908704
Ref: HTTP ステータスコード-Footnote-5414908764
Ref: HTTP ステータスコード-Footnote-5514908824
Ref: HTTP ステータスコード-Footnote-5614908884
Ref: HTTP ステータスコード-Footnote-5714908944
Ref: HTTP ステータスコード-Footnote-5814909004
Ref: HTTP ステータスコード-Footnote-5914909064
Ref: HTTP ステータスコード-Footnote-6014909124
Ref: HTTP ステータスコード-Footnote-6114909184
Ref: HTTP ステータスコード-Footnote-6214909244
Ref: HTTP ステータスコード-Footnote-6314909304
Node: HTTP ステータスコードカテゴリ14909364
Ref: library/http http-status-category14909538
Ref: 421c14909538
Ref: library/http http HTTPMethod14911220
Ref: 421d14911220
Ref: HTTP ステータスコードカテゴリ-Footnote-114912071
Ref: HTTP ステータスコードカテゴリ-Footnote-214912130
Ref: HTTP ステータスコードカテゴリ-Footnote-314912189
Ref: HTTP ステータスコードカテゴリ-Footnote-414912248
Ref: HTTP ステータスコードカテゴリ-Footnote-514912307
Node: HTTP メソッド14912366
Ref: library/http http-methods14912502
Ref: 421e14912502
Ref: library/http id214912502
Ref: 421f14912502
Ref: HTTP メソッド-Footnote-114914931
Ref: HTTP メソッド-Footnote-214915004
Ref: HTTP メソッド-Footnote-314915063
Ref: HTTP メソッド-Footnote-414915122
Ref: HTTP メソッド-Footnote-514915181
Ref: HTTP メソッド-Footnote-614915240
Ref: HTTP メソッド-Footnote-714915299
Ref: HTTP メソッド-Footnote-814915358
Ref: HTTP メソッド-Footnote-914915417
Ref: HTTP メソッド-Footnote-1014915476
Node: http client --- HTTP プロトコルクライアント14915536
Ref: library/http client doc14915776
Ref: 422014915776
Ref: library/http client http-client-http-protocol-client14915776
Ref: 422114915776
Ref: library/http client module-http client14915776
Ref: 7214915776
Ref: library/http client translation-repo14915776
Ref: 422214915776
Ref: library/http client http client HTTPConnection14916994
Ref: 22e14916994
Ref: library/http client http client HTTPSConnection14919027
Ref: 22f14919027
Ref: library/http client http client HTTPResponse14921319
Ref: 148e14921319
Ref: library/http client http client parse_headers14921861
Ref: 203414921861
Ref: library/http client http client HTTPException14922824
Ref: 422614922824
Ref: library/http client http client NotConnected14923006
Ref: 422714923006
Ref: library/http client http client InvalidURL14923102
Ref: 422814923102
Ref: library/http client http client UnknownProtocol14923355
Ref: 422914923355
Ref: library/http client http client UnknownTransferEncoding14923454
Ref: 422a14923454
Ref: library/http client http client UnimplementedFileMode14923561
Ref: 422b14923561
Ref: library/http client http client IncompleteRead14923666
Ref: 422c14923666
Ref: library/http client http client ImproperConnectionState14923764
Ref: 422d14923764
Ref: library/http client http client CannotSendRequest14923871
Ref: 422e14923871
Ref: library/http client http client CannotSendHeader14923985
Ref: 422f14923985
Ref: library/http client http client ResponseNotReady14924098
Ref: 423014924098
Ref: library/http client http client BadStatusLine14924211
Ref: 423114924211
Ref: library/http client http client LineTooLong14924412
Ref: 423214924412
Ref: library/http client http client RemoteDisconnected14924587
Ref: 11c214924587
Ref: library/http client http client HTTP_PORT14925102
Ref: 423314925102
Ref: library/http client http client HTTPS_PORT14925219
Ref: 423414925219
Ref: library/http client http client responses14925339
Ref: 423514925339
Ref: http client --- HTTP プロトコルクライアント-Footnote-114925922
Ref: http client --- HTTP プロトコルクライアント-Footnote-214925993
Ref: http client --- HTTP プロトコルクライアント-Footnote-314926044
Node: HTTPConnection オブジェクト14926103
Ref: library/http client httpconnection-objects14926267
Ref: 423614926267
Ref: library/http client id114926267
Ref: 423714926267
Ref: library/http client http client HTTPConnection request14926440
Ref: 106e14926440
Ref: library/http client http client HTTPConnection getresponse14930315
Ref: 11c114930315
Ref: library/http client http client HTTPConnection set_debuglevel14930982
Ref: 423914930982
Ref: library/http client http client HTTPConnection set_tunnel14931392
Ref: 15e414931392
Ref: library/http client http client HTTPConnection get_proxy_response_headers14933122
Ref: 1c9814933122
Ref: library/http client http client HTTPConnection connect14933409
Ref: 423a14933409
Ref: library/http client http client HTTPConnection close14933771
Ref: 423814933771
Ref: library/http client http client HTTPConnection blocksize14933860
Ref: 423b14933860
Ref: library/http client http client HTTPConnection max_response_headers14933994
Ref: 423c14933994
Ref: library/http client http client HTTPConnection putrequest14934406
Ref: 423d14934406
Ref: library/http client http client HTTPConnection putheader14935087
Ref: 423e14935087
Ref: library/http client http client HTTPConnection endheaders14935499
Ref: 106f14935499
Ref: library/http client http client HTTPConnection send14936948
Ref: 423f14936948
Ref: HTTPConnection オブジェクト-Footnote-114937376
Ref: HTTPConnection オブジェクト-Footnote-214937449
Ref: HTTPConnection オブジェクト-Footnote-314937522
Ref: HTTPConnection オブジェクト-Footnote-414937595
Ref: HTTPConnection オブジェクト-Footnote-514937663
Ref: HTTPConnection オブジェクト-Footnote-614937721
Node: HTTPResponse オブジェクト14937780
Ref: library/http client httpresponse-objects14937966
Ref: 424014937966
Ref: library/http client id214937966
Ref: 424114937966
Ref: library/http client http client HTTPResponse read14938539
Ref: 1aef14938539
Ref: library/http client http client HTTPResponse readinto14938669
Ref: 148f14938669
Ref: library/http client http client HTTPResponse getheader14938906
Ref: 424214938906
Ref: library/http client http client HTTPResponse getheaders14939295
Ref: 424314939295
Ref: library/http client http client HTTPResponse fileno14939415
Ref: 424414939415
Ref: library/http client http client HTTPResponse msg14939511
Ref: 422414939511
Ref: library/http client http client HTTPResponse version14939723
Ref: 424514939723
Ref: library/http client http client HTTPResponse url14939898
Ref: 424614939898
Ref: library/http client http client HTTPResponse headers14940074
Ref: 424714940074
Ref: library/http client http client HTTPResponse status14940213
Ref: 424814940213
Ref: library/http client http client HTTPResponse reason14940307
Ref: 417314940307
Ref: library/http client http client HTTPResponse debuglevel14940404
Ref: 424914940404
Ref: library/http client http client HTTPResponse closed14940599
Ref: 424a14940599
Ref: library/http client http client HTTPResponse geturl14940711
Ref: 424b14940711
Ref: library/http client http client HTTPResponse info14940875
Ref: 424c14940875
Ref: library/http client http client HTTPResponse getcode14941041
Ref: 424d14941041
Node: 使用例<38>14941209
Ref: library/http client examples14941392
Ref: 424e14941392
Node: HTTPMessage オブジェクト14944356
Ref: library/http client httpmessage-objects14944499
Ref: 424f14944499
Ref: library/http client id314944499
Ref: 425014944499
Ref: library/http client http client HTTPMessage14944576
Ref: 422314944576
Node: ftplib --- FTP プロトコルクライアント14944842
Ref: library/ftplib doc14945099
Ref: 425114945099
Ref: library/ftplib ftplib-ftp-protocol-client14945099
Ref: 425214945099
Ref: library/ftplib module-ftplib14945099
Ref: 6114945099
Ref: library/ftplib translation-repo14945099
Ref: 425314945099
Ref: ftplib --- FTP プロトコルクライアント-Footnote-114947283
Ref: ftplib --- FTP プロトコルクライアント-Footnote-214947349
Ref: ftplib --- FTP プロトコルクライアント-Footnote-314947407
Node: リファレンス<7>14947466
Ref: library/ftplib ftplib-reference14947572
Ref: 425414947572
Ref: library/ftplib reference14947572
Ref: 425514947572
Node: FTP オブジェクト14947719
Ref: library/ftplib ftp-objects14947834
Ref: 425614947834
Ref: library/ftplib id114947834
Ref: 425714947834
Ref: library/ftplib ftplib FTP14947895
Ref: cce14947895
Ref: library/ftplib ftplib FTP set_debuglevel14950867
Ref: 425914950867
Ref: library/ftplib ftplib FTP connect14951428
Ref: 425814951428
Ref: library/ftplib ftplib FTP getwelcome14952865
Ref: 425a14952865
Ref: library/ftplib ftplib FTP login14953174
Ref: 425b14953174
Ref: library/ftplib ftplib FTP abort14954218
Ref: 425c14954218
Ref: library/ftplib ftplib FTP sendcmd14954427
Ref: 425d14954427
Ref: library/ftplib ftplib FTP voidcmd14954734
Ref: 425e14954734
Ref: library/ftplib ftplib FTP retrbinary14955167
Ref: 426014955167
Ref: library/ftplib ftplib FTP retrlines14956230
Ref: 426214956230
Ref: library/ftplib ftplib FTP set_pasv14956973
Ref: 426314956973
Ref: library/ftplib ftplib FTP storbinary14957187
Ref: 16c314957187
Ref: library/ftplib ftplib FTP storlines14958369
Ref: 426414958369
Ref: library/ftplib ftplib FTP transfercmd14958873
Ref: 426114958873
Ref: library/ftplib ftplib FTP ntransfercmd14960164
Ref: 426514960164
Ref: library/ftplib ftplib FTP mlsd14960550
Ref: 148314960550
Ref: library/ftplib ftplib FTP nlst14961311
Ref: 148414961311
Ref: library/ftplib ftplib FTP dir14961855
Ref: 148514961855
Ref: library/ftplib ftplib FTP rename14962560
Ref: 426614962560
Ref: library/ftplib ftplib FTP delete14962724
Ref: 426714962724
Ref: library/ftplib ftplib FTP cwd14963070
Ref: 426914963070
Ref: library/ftplib ftplib FTP mkd14963184
Ref: 426a14963184
Ref: library/ftplib ftplib FTP pwd14963295
Ref: 426b14963295
Ref: library/ftplib ftplib FTP rmd14963410
Ref: 426c14963410
Ref: library/ftplib ftplib FTP size14963525
Ref: 426d14963525
Ref: library/ftplib ftplib FTP quit14963940
Ref: 426e14963940
Ref: library/ftplib ftplib FTP close14964493
Ref: 426f14964493
Ref: FTP オブジェクト-Footnote-114965103
Ref: FTP オブジェクト-Footnote-214965161
Ref: FTP オブジェクト-Footnote-314965220
Ref: FTP オブジェクト-Footnote-414965278
Node: FTP_TLS オブジェクト14965337
Ref: library/ftplib ftp-tls-objects14965482
Ref: 427014965482
Ref: library/ftplib ftplib FTP_TLS14965551
Ref: ccf14965551
Ref: library/ftplib ftplib FTP_TLS auth14969353
Ref: 427214969353
Ref: library/ftplib ftplib FTP_TLS ccc14969655
Ref: 148214969655
Ref: library/ftplib ftplib FTP_TLS prot_p14969920
Ref: 427114969920
Ref: library/ftplib ftplib FTP_TLS prot_c14970009
Ref: 427314970009
Ref: FTP_TLS オブジェクト-Footnote-114970145
Ref: FTP_TLS オブジェクト-Footnote-214970204
Ref: FTP_TLS オブジェクト-Footnote-314970262
Node: モジュール変数14970321
Ref: library/ftplib module-variables14970435
Ref: 427414970435
Ref: library/ftplib ftplib error_reply14970493
Ref: 425f14970493
Ref: library/ftplib ftplib error_temp14970610
Ref: 427514970610
Ref: library/ftplib ftplib error_perm14970780
Ref: 426814970780
Ref: library/ftplib ftplib error_proto14970947
Ref: 427614970947
Ref: library/ftplib ftplib all_errors14971168
Ref: 427714971168
Node: poplib --- POP3 プロトコルクライアント14971860
Ref: library/poplib doc14972114
Ref: 427814972114
Ref: library/poplib module-poplib14972114
Ref: b114972114
Ref: library/poplib poplib-pop3-protocol-client14972114
Ref: 427914972114
Ref: library/poplib translation-repo14972114
Ref: 427a14972114
Ref: library/poplib poplib POP314973862
Ref: cf414973862
Ref: library/poplib poplib POP3_SSL14975022
Ref: cf514975022
Ref: library/poplib poplib error_proto14976999
Ref: 155a14976999
Ref: poplib --- POP3 プロトコルクライアント-Footnote-114977787
Ref: poplib --- POP3 プロトコルクライアント-Footnote-214977853
Ref: poplib --- POP3 プロトコルクライアント-Footnote-314977912
Ref: poplib --- POP3 プロトコルクライアント-Footnote-414977971
Ref: poplib --- POP3 プロトコルクライアント-Footnote-514978030
Node: POP3 オブジェクト14978092
Ref: library/poplib id114978221
Ref: 427b14978221
Ref: library/poplib pop3-objects14978221
Ref: 427c14978221
Ref: library/poplib poplib POP3 set_debuglevel14978590
Ref: 427d14978590
Ref: library/poplib poplib POP3 getwelcome14979124
Ref: 427e14979124
Ref: library/poplib poplib POP3 capa14979257
Ref: 132b14979257
Ref: library/poplib poplib POP3 user14979488
Ref: 427f14979488
Ref: library/poplib poplib POP3 pass_14979623
Ref: 428014979623
Ref: library/poplib poplib POP3 apop14979919
Ref: 428114979919
Ref: library/poplib poplib POP3 rpop14980074
Ref: 428214980074
Ref: library/poplib poplib POP3 stat14980239
Ref: 428314980239
Ref: library/poplib poplib POP3 list14980428
Ref: 428414980428
Ref: library/poplib poplib POP3 retr14980714
Ref: 428514980714
Ref: library/poplib poplib POP3 dele14980966
Ref: 428614980966
Ref: library/poplib poplib POP3 rset14981406
Ref: 428714981406
Ref: library/poplib poplib POP3 noop14981517
Ref: 428814981517
Ref: library/poplib poplib POP3 quit14981619
Ref: 155914981619
Ref: library/poplib poplib POP3 top14981783
Ref: 428914981783
Ref: library/poplib poplib POP3 uidl14982579
Ref: 428a14982579
Ref: library/poplib poplib POP3 utf814982994
Ref: 11fd14982994
Ref: library/poplib poplib POP3 stls14983288
Ref: 132c14983288
Ref: POP3 オブジェクト-Footnote-114984374
Ref: POP3 オブジェクト-Footnote-214984433
Ref: POP3 オブジェクト-Footnote-314984492
Node: POP3 の例14984551
Ref: library/poplib id214984680
Ref: 428b14984680
Ref: library/poplib pop3-example14984680
Ref: 428c14984680
Node: imaplib --- IMAP4 プロトコルクライアント14985263
Ref: library/imaplib doc14985519
Ref: 428d14985519
Ref: library/imaplib imaplib-imap4-protocol-client14985519
Ref: 428e14985519
Ref: library/imaplib module-imaplib14985519
Ref: 7714985519
Ref: library/imaplib translation-repo14985519
Ref: 428f14985519
Ref: library/imaplib imaplib IMAP414986612
Ref: 32214986612
Ref: library/imaplib imaplib IMAP4 error14987878
Ref: 1a2c14987878
Ref: library/imaplib imaplib IMAP4 abort14988060
Ref: 429014988060
Ref: library/imaplib imaplib IMAP4 readonly14988396
Ref: 429114988396
Ref: library/imaplib imaplib IMAP4_SSL14988957
Ref: cd714988957
Ref: library/imaplib imaplib IMAP4_stream14990576
Ref: cd914990576
Ref: library/imaplib imaplib Internaldate2tuple14990893
Ref: 429214990893
Ref: library/imaplib imaplib Int2AP14991211
Ref: 429314991211
Ref: library/imaplib imaplib ParseFlags14991369
Ref: 429414991369
Ref: library/imaplib imaplib Time2Internaldate14991508
Ref: 429514991508
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-114993030
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-214993097
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-314993156
Node: IMAP4 オブジェクト14993215
Ref: library/imaplib id114993354
Ref: 429614993354
Ref: library/imaplib imap4-objects14993354
Ref: 429714993354
Ref: library/imaplib imaplib IMAP4 append14995183
Ref: 429814995183
Ref: library/imaplib imaplib IMAP4 authenticate14995586
Ref: 429914995586
Ref: library/imaplib imaplib IMAP4 check14996538
Ref: 429a14996538
Ref: library/imaplib imaplib IMAP4 close14996663
Ref: cdb14996663
Ref: library/imaplib imaplib IMAP4 copy14996936
Ref: 429b14996936
Ref: library/imaplib imaplib IMAP4 create14997104
Ref: 429c14997104
Ref: library/imaplib imaplib IMAP4 delete14997235
Ref: 429d14997235
Ref: library/imaplib imaplib IMAP4 deleteacl14997363
Ref: 429e14997363
Ref: library/imaplib imaplib IMAP4 enable14997501
Ref: 11c614997501
Ref: library/imaplib imaplib IMAP4 expunge14997820
Ref: 429f14997820
Ref: library/imaplib imaplib IMAP4 fetch14998198
Ref: 42a014998198
Ref: library/imaplib imaplib IMAP4 getacl14998620
Ref: 42a114998620
Ref: library/imaplib imaplib IMAP4 getannotation14998828
Ref: 42a214998828
Ref: library/imaplib imaplib IMAP4 getquota14999068
Ref: 42a314999068
Ref: library/imaplib imaplib IMAP4 getquotaroot14999305
Ref: 42a414999305
Ref: library/imaplib imaplib IMAP4 idle14999563
Ref: 4c214999563
Ref: library/imaplib imaplib IMAP4 Idler burst15001134
Ref: 42a615001134
Ref: library/imaplib imaplib IMAP4 list15003280
Ref: 42a715003280
Ref: library/imaplib imaplib IMAP4 login15003671
Ref: 42a815003671
Ref: library/imaplib imaplib IMAP4 login_cram_md515003845
Ref: 1a2b15003845
Ref: library/imaplib imaplib IMAP4 logout15004254
Ref: e5715004254
Ref: library/imaplib imaplib IMAP4 lsub15004493
Ref: 42a915004493
Ref: library/imaplib imaplib IMAP4 myrights15005005
Ref: 42aa15005005
Ref: library/imaplib imaplib IMAP4 namespace15005181
Ref: 42ab15005181
Ref: library/imaplib imaplib IMAP4 noop15005290
Ref: 42ac15005290
Ref: library/imaplib imaplib IMAP4 open15005375
Ref: cd815005375
Ref: library/imaplib imaplib IMAP4 partial15006366
Ref: 42b115006366
Ref: library/imaplib imaplib IMAP4 proxyauth15006632
Ref: 42b215006632
Ref: library/imaplib imaplib IMAP4 read15006859
Ref: 42ad15006859
Ref: library/imaplib imaplib IMAP4 readline15007040
Ref: 42ae15007040
Ref: library/imaplib imaplib IMAP4 recent15007210
Ref: 42b315007210
Ref: library/imaplib imaplib IMAP4 rename15007431
Ref: 42b415007431
Ref: library/imaplib imaplib IMAP4 response15007597
Ref: 42a515007597
Ref: library/imaplib imaplib IMAP4 search15007855
Ref: 42b515007855
Ref: library/imaplib imaplib IMAP4 select15008563
Ref: 42b615008563
Ref: library/imaplib imaplib IMAP4 send15008944
Ref: 42af15008944
Ref: library/imaplib imaplib IMAP4 setacl15009247
Ref: 42b715009247
Ref: library/imaplib imaplib IMAP4 setannotation15009457
Ref: 42b815009457
Ref: library/imaplib imaplib IMAP4 setquota15009695
Ref: 42b915009695
Ref: library/imaplib imaplib IMAP4 shutdown15009919
Ref: 42b015009919
Ref: library/imaplib imaplib IMAP4 socket15010182
Ref: 42ba15010182
Ref: library/imaplib imaplib IMAP4 sort15010314
Ref: 42bb15010314
Ref: library/imaplib imaplib IMAP4 starttls15011392
Ref: 15e215011392
Ref: library/imaplib imaplib IMAP4 status15011950
Ref: 42bc15011950
Ref: library/imaplib imaplib IMAP4 store15012079
Ref: 42bd15012079
Ref: library/imaplib imaplib IMAP4 subscribe15013457
Ref: 42be15013457
Ref: library/imaplib imaplib IMAP4 thread15013573
Ref: 42bf15013573
Ref: library/imaplib imaplib IMAP4 uid15014768
Ref: 42c015014768
Ref: library/imaplib imaplib IMAP4 unsubscribe15015173
Ref: 42c115015173
Ref: library/imaplib imaplib IMAP4 unselect15015299
Ref: cda15015299
Ref: library/imaplib imaplib IMAP4 xatom15015702
Ref: 42c215015702
Ref: library/imaplib imaplib IMAP4 PROTOCOL_VERSION15015958
Ref: 42c315015958
Ref: library/imaplib imaplib IMAP4 debug15016133
Ref: 42c415016133
Ref: library/imaplib imaplib IMAP4 utf8_enabled15016365
Ref: 11c715016365
Ref: library/imaplib imaplib IMAP4 file15016610
Ref: 30415016610
Ref: IMAP4 オブジェクト-Footnote-115017032
Ref: IMAP4 オブジェクト-Footnote-215017091
Ref: IMAP4 オブジェクト-Footnote-315017150
Ref: IMAP4 オブジェクト-Footnote-415017209
Ref: IMAP4 オブジェクト-Footnote-515017268
Ref: IMAP4 オブジェクト-Footnote-615017327
Ref: IMAP4 オブジェクト-Footnote-715017386
Ref: IMAP4 オブジェクト-Footnote-815017445
Ref: IMAP4 オブジェクト-Footnote-915017504
Ref: IMAP4 オブジェクト-Footnote-1015017563
Node: IMAP4 の使用例15017623
Ref: library/imaplib id215017762
Ref: 42c515017762
Ref: library/imaplib imap4-example15017762
Ref: 42c615017762
Node: smtplib --- SMTP プロトコルクライアント15018329
Ref: library/smtplib doc15018590
Ref: 42c715018590
Ref: library/smtplib module-smtplib15018590
Ref: d215018590
Ref: library/smtplib smtplib-smtp-protocol-client15018590
Ref: 42c815018590
Ref: library/smtplib translation-repo15018590
Ref: 42c915018590
Ref: library/smtplib smtplib SMTP15019321
Ref: cfe15019321
Ref: library/smtplib smtplib SMTP default_port15021656
Ref: 42cc15021656
Ref: library/smtplib smtplib SMTP_SSL15022249
Ref: cff15022249
Ref: library/smtplib smtplib SMTP_SSL default_port15023257
Ref: 42cd15023257
Ref: library/smtplib smtplib LMTP15024107
Ref: d0015024107
Ref: library/smtplib smtplib SMTPException15025179
Ref: 134f15025179
Ref: library/smtplib smtplib SMTPServerDisconnected15025476
Ref: 42ce15025476
Ref: library/smtplib smtplib SMTPResponseException15025706
Ref: 42cf15025706
Ref: library/smtplib smtplib SMTPResponseException smtp_code15025921
Ref: 42d015025921
Ref: library/smtplib smtplib SMTPResponseException smtp_error15025985
Ref: 42d115025985
Ref: library/smtplib smtplib SMTPSenderRefused15026047
Ref: 42d215026047
Ref: library/smtplib smtplib SMTPRecipientsRefused15026326
Ref: 42d315026326
Ref: library/smtplib smtplib SMTPRecipientsRefused recipients15026408
Ref: 42d415026408
Ref: library/smtplib smtplib SMTPDataError15026595
Ref: 42d515026595
Ref: library/smtplib smtplib SMTPConnectError15026767
Ref: 42ca15026767
Ref: library/smtplib smtplib SMTPHeloError15026902
Ref: 42d615026902
Ref: library/smtplib smtplib SMTPNotSupportedError15027037
Ref: 1fbe15027037
Ref: library/smtplib smtplib SMTPAuthenticationError15027208
Ref: 42d715027208
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-115028101
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-215028168
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-315028226
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-415028285
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-515028344
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-615028402
Node: SMTP オブジェクト15028461
Ref: library/smtplib id115028594
Ref: 42d815028594
Ref: library/smtplib smtp-objects15028594
Ref: 42d915028594
Ref: library/smtplib smtplib SMTP set_debuglevel15028743
Ref: 120c15028743
Ref: library/smtplib smtplib SMTP docmd15029194
Ref: 42da15029194
Ref: library/smtplib smtplib SMTP connect15030138
Ref: 193415030138
Ref: library/smtplib smtplib SMTP helo15031098
Ref: 42db15031098
Ref: library/smtplib smtplib SMTP ehlo15031551
Ref: 42dd15031551
Ref: library/smtplib smtplib SMTP ehlo_or_helo_if_needed15032615
Ref: 42e215032615
Ref: library/smtplib smtplib SMTP has_extn15033082
Ref: 42de15033082
Ref: library/smtplib smtplib SMTP verify15033341
Ref: 42e315033341
Ref: library/smtplib smtplib SMTP login15033868
Ref: 42e415033868
Ref: library/smtplib smtplib SMTP auth15035688
Ref: 120b15035688
Ref: library/smtplib smtplib SMTP starttls15037935
Ref: 14f915037935
Ref: library/smtplib smtplib SMTP sendmail15039630
Ref: 120d15039630
Ref: library/smtplib smtplib SMTP send_message15043563
Ref: 120e15043563
Ref: library/smtplib smtplib SMTP quit15045639
Ref: 42cb15045639
Ref: library/smtplib smtplib SMTP helo_resp15046197
Ref: 42dc15046197
Ref: library/smtplib smtplib SMTP ehlo_resp15046298
Ref: 42df15046298
Ref: library/smtplib smtplib SMTP does_esmtp15046399
Ref: 42e015046399
Ref: library/smtplib smtplib SMTP esmtp_features15046528
Ref: 42e115046528
Ref: SMTP オブジェクト-Footnote-115046713
Ref: SMTP オブジェクト-Footnote-215046771
Ref: SMTP オブジェクト-Footnote-315046830
Ref: SMTP オブジェクト-Footnote-415046889
Ref: SMTP オブジェクト-Footnote-515046947
Ref: SMTP オブジェクト-Footnote-615047005
Node: SMTP 使用例15047064
Ref: library/smtplib id215047197
Ref: 42e515047197
Ref: library/smtplib smtp-example15047197
Ref: 42e615047197
Ref: SMTP 使用例-Footnote-115048681
Node: uuid --- RFC 9562 に基づく UUID オブジェクト15048739
Ref: library/uuid doc15049020
Ref: 42e715049020
Ref: library/uuid module-uuid15049020
Ref: 11915049020
Ref: library/uuid translation-repo15049020
Ref: 42e815049020
Ref: library/uuid uuid-uuid-objects-according-to-rfc-956215049020
Ref: 42e915049020
Ref: library/uuid uuid SafeUUID15050431
Ref: 42eb15050431
Ref: library/uuid uuid SafeUUID safe15050489
Ref: 42ec15050489
Ref: library/uuid uuid SafeUUID unsafe15050610
Ref: 42ed15050610
Ref: library/uuid uuid SafeUUID unknown15050753
Ref: 42ee15050753
Ref: library/uuid uuid UUID15050912
Ref: e2915050912
Ref: library/uuid uuid UUID bytes15053014
Ref: 42f015053014
Ref: library/uuid uuid UUID bytes_le15053184
Ref: 42f115053184
Ref: library/uuid uuid UUID fields15053347
Ref: 42f215053347
Ref: library/uuid uuid UUID time_low15053751
Ref: 42f315053751
Ref: library/uuid uuid UUID time_mid15054035
Ref: 42f415054035
Ref: library/uuid uuid UUID time_hi_version15054325
Ref: 42f515054325
Ref: library/uuid uuid UUID clock_seq_hi_variant15054613
Ref: 42f615054613
Ref: library/uuid uuid UUID clock_seq_low15054895
Ref: 42f715054895
Ref: library/uuid uuid UUID node15055175
Ref: 42f815055175
Ref: library/uuid uuid UUID time15055458
Ref: 42f915055458
Ref: library/uuid uuid UUID clock_seq15056073
Ref: 42fa15056073
Ref: library/uuid uuid UUID hex15056278
Ref: 1ad215056278
Ref: library/uuid uuid UUID int15056364
Ref: 42ef15056364
Ref: library/uuid uuid UUID urn15056429
Ref: 42fb15056429
Ref: library/uuid uuid UUID variant15056507
Ref: 42fc15056507
Ref: library/uuid uuid UUID version15056766
Ref: 430115056766
Ref: library/uuid uuid UUID is_safe15056974
Ref: f6915056974
Ref: library/uuid uuid getnode15057235
Ref: f6a15057235
Ref: library/uuid uuid-factory-functions15058514
Ref: 42ea15058514
Ref: library/uuid uuid uuid115058514
Ref: f6b15058514
Ref: library/uuid uuid uuid315059046
Ref: 56815059046
Ref: library/uuid uuid uuid415059321
Ref: 56a15059321
Ref: library/uuid uuid uuid515059455
Ref: 56915059455
Ref: library/uuid uuid uuid615059733
Ref: 54515059733
Ref: library/uuid uuid uuid715060372
Ref: 54615060372
Ref: library/uuid uuid uuid815060712
Ref: 54715060712
Ref: library/uuid uuid NAMESPACE_DNS15061533
Ref: 430215061533
Ref: library/uuid uuid NAMESPACE_URL15061681
Ref: 430315061681
Ref: library/uuid uuid NAMESPACE_OID15061801
Ref: 430415061801
Ref: library/uuid uuid NAMESPACE_X50015061925
Ref: 430515061925
Ref: library/uuid uuid RESERVED_NCS15062216
Ref: 42fd15062216
Ref: library/uuid uuid RFC_412215062309
Ref: 42fe15062309
Ref: library/uuid uuid RESERVED_MICROSOFT15062516
Ref: 42ff15062516
Ref: library/uuid uuid RESERVED_FUTURE15062624
Ref: 430015062624
Ref: library/uuid uuid NIL15062781
Ref: 54815062781
Ref: library/uuid uuid MAX15062954
Ref: 54915062954
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-115063516
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-215063580
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-315063639
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-415063698
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-515063757
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-615063816
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-715063875
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-815063946
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-915064017
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1015064088
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1115064160
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1215064232
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1315064304
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1415064376
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1515064436
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1615064496
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1715064556
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1815064628
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1915064701
Node: コマンドラインからの使用15064761
Ref: library/uuid command-line-usage15064910
Ref: 430615064910
Ref: library/uuid uuid-cli15064910
Ref: 86815064910
Ref: library/uuid cmdoption-uuid-h15065239
Ref: 430715065239
Ref: library/uuid cmdoption-uuid-help15065239
Ref: 430815065239
Ref: library/uuid cmdoption-uuid-u15065327
Ref: 430915065327
Ref: library/uuid cmdoption-uuid-uuid15065349
Ref: 430a15065349
Ref: library/uuid cmdoption-uuid-n15065564
Ref: 430b15065564
Ref: library/uuid cmdoption-uuid-namespace15065591
Ref: 430c15065591
Ref: library/uuid cmdoption-uuid-N15065903
Ref: 430d15065903
Ref: library/uuid cmdoption-uuid-name15065925
Ref: 430e15065925
Ref: library/uuid cmdoption-uuid-C15066081
Ref: 430f15066081
Ref: library/uuid cmdoption-uuid-count15066102
Ref: 54a15066102
Node: 使用例<39>15066192
Ref: library/uuid example15066370
Ref: 431015066370
Ref: library/uuid uuid-example15066370
Ref: 431115066370
Node: Command-Line Example15068427
Ref: library/uuid command-line-example15068560
Ref: 431215068560
Ref: library/uuid uuid-cli-example15068560
Ref: 431315068560
Node: socketserver --- ネットワークサーバーのフレームワーク15069008
Ref: library/socketserver doc15069272
Ref: 431415069272
Ref: library/socketserver module-socketserver15069272
Ref: d515069272
Ref: library/socketserver socketserver-a-framework-for-network-servers15069272
Ref: 431515069272
Ref: library/socketserver translation-repo15069272
Ref: 431615069272
Ref: library/socketserver socketserver TCPServer15069887
Ref: 16d915069887
Ref: library/socketserver socketserver UDPServer15070499
Ref: 431915070499
Ref: library/socketserver socketserver UnixStreamServer15070806
Ref: 431a15070806
Ref: library/socketserver socketserver UnixDatagramServer15070923
Ref: 431b15070923
Ref: socketserver --- ネットワークサーバーのフレームワーク-Footnote-115073925
Node: サーバ生成に関するノート15073997
Ref: library/socketserver server-creation-notes15074174
Ref: 431e15074174
Ref: library/socketserver socketserver ForkingMixIn15075019
Ref: f3b15075019
Ref: library/socketserver socketserver ThreadingMixIn15075060
Ref: f0515075060
Ref: library/socketserver socketserver ThreadingMixIn block_on_close15075898
Ref: f3a15075898
Ref: library/socketserver socketserver ThreadingMixIn max_children15076287
Ref: 432015076287
Ref: library/socketserver socketserver ThreadingMixIn daemon_threads15076536
Ref: 432115076536
Ref: library/socketserver socketserver ForkingTCPServer15077061
Ref: 432215077061
Ref: library/socketserver socketserver ForkingUDPServer15077106
Ref: 432315077106
Ref: library/socketserver socketserver ThreadingTCPServer15077151
Ref: 432415077151
Ref: library/socketserver socketserver ThreadingUDPServer15077198
Ref: 431f15077198
Ref: library/socketserver socketserver ForkingUnixStreamServer15077245
Ref: 432515077245
Ref: library/socketserver socketserver ForkingUnixDatagramServer15077297
Ref: 432615077297
Ref: library/socketserver socketserver ThreadingUnixStreamServer15077351
Ref: 432715077351
Ref: library/socketserver socketserver ThreadingUnixDatagramServer15077405
Ref: 432815077405
Node: Serverオブジェクト15080470
Ref: library/socketserver server-objects15080679
Ref: 432a15080679
Ref: library/socketserver socketserver BaseServer15080744
Ref: 14fe15080744
Ref: library/socketserver socketserver BaseServer fileno15081157
Ref: 432d15081157
Ref: library/socketserver socketserver BaseServer handle_request15081490
Ref: 16dc15081490
Ref: library/socketserver socketserver BaseServer serve_forever15082197
Ref: 150015082197
Ref: library/socketserver socketserver BaseServer service_actions15082856
Ref: 14ff15082856
Ref: library/socketserver socketserver BaseServer shutdown15083165
Ref: 202315083165
Ref: library/socketserver socketserver BaseServer server_close15083439
Ref: f3915083439
Ref: library/socketserver socketserver BaseServer address_family15083560
Ref: 433115083560
Ref: library/socketserver socketserver BaseServer RequestHandlerClass15083972
Ref: 432c15083972
Ref: library/socketserver socketserver BaseServer server_address15084164
Ref: 432b15084164
Ref: library/socketserver socketserver BaseServer socket15084654
Ref: 433215084654
Ref: library/socketserver socketserver BaseServer allow_reuse_address15084861
Ref: 433315084861
Ref: library/socketserver socketserver BaseServer request_queue_size15085156
Ref: 433415085156
Ref: library/socketserver socketserver BaseServer socket_type15085756
Ref: 433515085756
Ref: library/socketserver socketserver BaseServer timeout15085971
Ref: 16da15085971
Ref: library/socketserver socketserver BaseServer finish_request15086587
Ref: 433615086587
Ref: library/socketserver socketserver BaseServer get_request15086829
Ref: 432e15086829
Ref: library/socketserver socketserver BaseServer handle_error15087130
Ref: 10fc15087130
Ref: library/socketserver socketserver BaseServer handle_timeout15087657
Ref: 16db15087657
Ref: library/socketserver socketserver BaseServer process_request15088148
Ref: 433015088148
Ref: library/socketserver socketserver BaseServer server_activate15088628
Ref: 431815088628
Ref: library/socketserver socketserver BaseServer server_bind15088878
Ref: 431715088878
Ref: library/socketserver socketserver BaseServer verify_request15089111
Ref: 432f15089111
Node: Request Handler Objects15089821
Ref: library/socketserver request-handler-objects15090007
Ref: 433715090007
Ref: library/socketserver socketserver BaseRequestHandler15090076
Ref: 431c15090076
Ref: library/socketserver socketserver BaseRequestHandler setup15090434
Ref: 433815090434
Ref: library/socketserver socketserver BaseRequestHandler handle15090653
Ref: 431d15090653
Ref: library/socketserver socketserver BaseRequestHandler finish15091360
Ref: 433c15091360
Ref: library/socketserver socketserver BaseRequestHandler request15091728
Ref: 433915091728
Ref: library/socketserver socketserver BaseRequestHandler client_address15091865
Ref: 433a15091865
Ref: library/socketserver socketserver BaseRequestHandler server15091987
Ref: 433b15091987
Ref: library/socketserver socketserver StreamRequestHandler15092088
Ref: 109c15092088
Ref: library/socketserver socketserver DatagramRequestHandler15092137
Ref: 432915092137
Ref: library/socketserver socketserver DatagramRequestHandler rfile15092389
Ref: 433d15092389
Ref: library/socketserver socketserver DatagramRequestHandler wfile15092554
Ref: 109b15092554
Node: 使用例<40>15092838
Ref: library/socketserver examples15092991
Ref: 433e15092991
Node: socketserver TCPServer の例15093197
Ref: library/socketserver socketserver-tcpserver-example15093314
Ref: 433f15093314
Node: socketserver UDPServer の例15097242
Ref: library/socketserver socketserver-udpserver-example15097393
Ref: 434015097393
Node: 非同期処理の Mix-in15099001
Ref: library/socketserver asynchronous-mixins15099114
Ref: 434115099114
Node: http server --- HTTP サーバー15101600
Ref: library/http server doc15101847
Ref: 434215101847
Ref: library/http server http-server-http-servers15101847
Ref: 434315101847
Ref: library/http server module-http server15101847
Ref: 7515101847
Ref: library/http server translation-repo15101847
Ref: 434415101847
Ref: library/http server http server HTTPServer15103039
Ref: 414115103039
Ref: library/http server http server ThreadingHTTPServer15103486
Ref: f0415103486
Ref: library/http server http server HTTPSServer15103863
Ref: 4bd15103863
Ref: library/http server http server ThreadingHTTPSServer15105205
Ref: 434615105205
Ref: library/http server http server BaseHTTPRequestHandler15105900
Ref: 23115105900
Ref: library/http server http server BaseHTTPRequestHandler client_address15106928
Ref: 434715106928
Ref: library/http server http server BaseHTTPRequestHandler server15107119
Ref: 434815107119
Ref: library/http server http server BaseHTTPRequestHandler close_connection15107208
Ref: 434915107208
Ref: library/http server http server BaseHTTPRequestHandler requestline15107509
Ref: 434b15107509
Ref: library/http server http server BaseHTTPRequestHandler command15107912
Ref: 434c15107912
Ref: library/http server http server BaseHTTPRequestHandler path15108055
Ref: 434d15108055
Ref: library/http server http server BaseHTTPRequestHandler request_version15108329
Ref: 434e15108329
Ref: library/http server http server BaseHTTPRequestHandler headers15108490
Ref: 422515108490
Ref: library/http server http server BaseHTTPRequestHandler rfile15108917
Ref: 435015108917
Ref: library/http server http server BaseHTTPRequestHandler wfile15109069
Ref: 435115109069
Ref: library/http server http server BaseHTTPRequestHandler server_version15109535
Ref: 435215109535
Ref: library/http server http server BaseHTTPRequestHandler sys_version15109938
Ref: 435315109938
Ref: library/http server http server BaseHTTPRequestHandler error_message_format15110217
Ref: 130015110217
Ref: library/http server http server BaseHTTPRequestHandler error_content_type15110574
Ref: 435515110574
Ref: library/http server http server BaseHTTPRequestHandler protocol_version15110806
Ref: 435615110806
Ref: library/http server http server BaseHTTPRequestHandler MessageClass15111400
Ref: 434f15111400
Ref: library/http server http server BaseHTTPRequestHandler responses15111725
Ref: 420a15111725
Ref: library/http server http server BaseHTTPRequestHandler handle15112319
Ref: 435915112319
Ref: library/http server http server BaseHTTPRequestHandler handle_one_request15112625
Ref: 434a15112625
Ref: library/http server http server BaseHTTPRequestHandler handle_expect_10015112829
Ref: 435a15112829
Ref: library/http server http server BaseHTTPRequestHandler send_error15113363
Ref: 12ff15113363
Ref: library/http server http server BaseHTTPRequestHandler send_response15114504
Ref: 435b15114504
Ref: library/http server http server BaseHTTPRequestHandler send_header15115328
Ref: 435715115328
Ref: library/http server http server BaseHTTPRequestHandler send_response_only15115992
Ref: 435815115992
Ref: library/http server http server BaseHTTPRequestHandler end_headers15116506
Ref: 148c15116506
Ref: library/http server http server BaseHTTPRequestHandler flush_headers15116847
Ref: 148d15116847
Ref: library/http server http server BaseHTTPRequestHandler log_request15117058
Ref: 435d15117058
Ref: library/http server http server BaseHTTPRequestHandler log_error15117448
Ref: 435e15117448
Ref: library/http server http server BaseHTTPRequestHandler log_message15117758
Ref: 435f15117758
Ref: library/http server http server BaseHTTPRequestHandler version_string15118398
Ref: 435415118398
Ref: library/http server http server BaseHTTPRequestHandler date_time_string15118669
Ref: 435c15118669
Ref: library/http server http server BaseHTTPRequestHandler log_date_time_string15119154
Ref: 436015119154
Ref: library/http server http server BaseHTTPRequestHandler address_string15119304
Ref: 436115119304
Ref: library/http server http server SimpleHTTPRequestHandler15119584
Ref: 23515119584
Ref: library/http server http server SimpleHTTPRequestHandler server_version15120552
Ref: 436415120552
Ref: library/http server http server SimpleHTTPRequestHandler default_content_type15120754
Ref: 23315120754
Ref: library/http server http server SimpleHTTPRequestHandler extensions_map15121058
Ref: 436515121058
Ref: library/http server http server SimpleHTTPRequestHandler extra_response_headers15121478
Ref: 436615121478
Ref: library/http server http server SimpleHTTPRequestHandler do_HEAD15122032
Ref: 436315122032
Ref: library/http server http server SimpleHTTPRequestHandler do_GET15122443
Ref: 436215122443
Ref: http server --- HTTP サーバー-Footnote-115125533
Ref: http server --- HTTP サーバー-Footnote-215125604
Ref: http server --- HTTP サーバー-Footnote-315125663
Ref: http server --- HTTP サーバー-Footnote-415125722
Node: コマンドライン・インターフェース<7>15125793
Ref: library/http server command-line-interface15125965
Ref: 436715125965
Ref: library/http server http-server-cli15125965
Ref: 23215125965
Ref: library/http server cmdoption-http server-arg-port15126350
Ref: 436815126350
Ref: library/http server cmdoption-http server-b15126543
Ref: 436915126543
Ref: library/http server cmdoption-http server-bind15126543
Ref: 436a15126543
Ref: library/http server cmdoption-http server-d15126990
Ref: 1a5515126990
Ref: library/http server cmdoption-http server-directory15126990
Ref: 436b15126990
Ref: library/http server cmdoption-http server-p15127293
Ref: 436c15127293
Ref: library/http server cmdoption-http server-protocol15127293
Ref: 436d15127293
Ref: library/http server cmdoption-http server-content-type15127614
Ref: 23415127614
Ref: library/http server cmdoption-http server-tls-cert15127943
Ref: 4be15127943
Ref: library/http server cmdoption-http server-tls-key15128117
Ref: 4bf15128117
Ref: library/http server cmdoption-http server-tls-password-file15128288
Ref: 4c015128288
Ref: library/http server cmdoption-http server-H15128643
Ref: 436e15128643
Ref: library/http server cmdoption-http server-header15128643
Ref: 436f15128643
Node: セキュリティで考慮すべき点<5>15129022
Ref: library/http server http-server-security15129194
Ref: 434515129194
Ref: library/http server security-considerations15129194
Ref: 437015129194
Node: http cookies --- HTTP の状態管理15130156
Ref: library/http cookies doc15130394
Ref: 437115130394
Ref: library/http cookies http-cookies-http-state-management15130394
Ref: 437215130394
Ref: library/http cookies module-http cookies15130394
Ref: 7415130394
Ref: library/http cookies translation-repo15130394
Ref: 437315130394
Ref: library/http cookies http cookies CookieError15131973
Ref: 437415131973
Ref: library/http cookies http cookies BaseCookie15132160
Ref: 437515132160
Ref: library/http cookies http cookies SimpleCookie15132626
Ref: 203115132626
Ref: http cookies --- HTTP の状態管理-Footnote-115133623
Ref: http cookies --- HTTP の状態管理-Footnote-215133695
Ref: http cookies --- HTTP の状態管理-Footnote-315133754
Ref: http cookies --- HTTP の状態管理-Footnote-415133813
Ref: http cookies --- HTTP の状態管理-Footnote-515133872
Node: Cookieオブジェクト15133931
Ref: library/http cookies cookie-objects15134062
Ref: 437915134062
Ref: library/http cookies id115134062
Ref: 437a15134062
Ref: library/http cookies http cookies BaseCookie value_decode15134127
Ref: 437715134127
Ref: library/http cookies http cookies BaseCookie value_encode15134500
Ref: 437815134500
Ref: library/http cookies http cookies BaseCookie output15135114
Ref: 30315135114
Ref: library/http cookies http cookies BaseCookie js_output15135485
Ref: 30115135485
Ref: library/http cookies http cookies BaseCookie load15136089
Ref: 437615136089
Node: Morselオブジェクト15136419
Ref: library/http cookies id215136572
Ref: 437b15136572
Ref: library/http cookies morsel-objects15136572
Ref: 437c15136572
Ref: library/http cookies http cookies Morsel15136637
Ref: fc715136637
Ref: library/http cookies http cookies Morsel expires15136889
Ref: 437d15136889
Ref: library/http cookies http cookies Morsel path15136922
Ref: 437e15136922
Ref: library/http cookies http cookies Morsel comment15136952
Ref: 437f15136952
Ref: library/http cookies http cookies Morsel domain15136985
Ref: 438015136985
Ref: library/http cookies http cookies Morsel secure15137051
Ref: 438115137051
Ref: library/http cookies http cookies Morsel version15137083
Ref: 438215137083
Ref: library/http cookies http cookies Morsel httponly15137116
Ref: 178915137116
Ref: library/http cookies http cookies Morsel samesite15137150
Ref: 438315137150
Ref: library/http cookies http cookies Morsel partitioned15137184
Ref: 438415137184
Ref: library/http cookies http cookies Morsel value15139217
Ref: fc515139217
Ref: library/http cookies http cookies Morsel coded_value15139274
Ref: fc615139274
Ref: library/http cookies http cookies Morsel key15139385
Ref: fc415139385
Ref: library/http cookies http cookies Morsel set15139437
Ref: fc815139437
Ref: library/http cookies http cookies Morsel isReservedKey15139573
Ref: 438515139573
Ref: library/http cookies http cookies Morsel output15139702
Ref: 30215139702
Ref: library/http cookies http cookies Morsel js_output15140104
Ref: 30015140104
Ref: library/http cookies http cookies Morsel OutputString15140704
Ref: 438615140704
Ref: library/http cookies http cookies Morsel update15140906
Ref: 127a15140906
Ref: library/http cookies http cookies Morsel copy15141233
Ref: 127915141233
Ref: library/http cookies http cookies Morsel setdefault15141440
Ref: 438715141440
Ref: Morselオブジェクト-Footnote-115141721
Ref: Morselオブジェクト-Footnote-215141780
Ref: Morselオブジェクト-Footnote-315141839
Ref: Morselオブジェクト-Footnote-415141902
Ref: Morselオブジェクト-Footnote-515141961
Node: 使用例<41>15142020
Ref: library/http cookies cookie-example15142140
Ref: 438815142140
Ref: library/http cookies example15142140
Ref: 438915142140
Node: http cookiejar --- HTTP クライアント用の Cookie 処理15143779
Ref: library/http cookiejar doc15144053
Ref: 438a15144053
Ref: library/http cookiejar http-cookiejar-cookie-handling-for-http-clients15144053
Ref: 438b15144053
Ref: library/http cookiejar module-http cookiejar15144053
Ref: 7315144053
Ref: library/http cookiejar translation-repo15144053
Ref: 438c15144053
Ref: library/http cookiejar http cookiejar LoadError15145653
Ref: 438d15145653
Ref: library/http cookiejar http cookiejar CookieJar15146185
Ref: 41ae15146185
Ref: library/http cookiejar http cookiejar FileCookieJar15146890
Ref: 438e15146890
Ref: library/http cookiejar http cookiejar CookiePolicy15148015
Ref: 438f15148015
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy15148237
Ref: 200215148237
Ref: library/http cookiejar http cookiejar Cookie15150473
Ref: 439415150473
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-115152379
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-215152453
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-315152512
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-415152571
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-515152630
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-615152689
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-715152748
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-815152807
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-915152866
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1015152925
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1115152985
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1215153045
Node: CookieJar および FileCookieJar オブジェクト15153105
Ref: library/http cookiejar cookie-jar-objects15153329
Ref: 439515153329
Ref: library/http cookiejar cookiejar-and-filecookiejar-objects15153329
Ref: 439615153329
Ref: library/http cookiejar http cookiejar CookieJar add_cookie_header15153753
Ref: 439715153753
Ref: library/http cookiejar http cookiejar CookieJar extract_cookies15154909
Ref: 439815154909
Ref: library/http cookiejar http cookiejar CookieJar set_policy15156575
Ref: 439a15156575
Ref: library/http cookiejar http cookiejar CookieJar make_cookies15156709
Ref: 439b15156709
Ref: library/http cookiejar http cookiejar CookieJar set_cookie_if_ok15157090
Ref: 439c15157090
Ref: library/http cookiejar http cookiejar CookieJar set_cookie15157263
Ref: 439d15157263
Ref: library/http cookiejar http cookiejar CookieJar clear15157472
Ref: 439e15157472
Ref: library/http cookiejar http cookiejar CookieJar clear_session_cookies15158199
Ref: 439f15158199
Ref: library/http cookiejar http cookiejar FileCookieJar save15159074
Ref: 43a015159074
Ref: library/http cookiejar http cookiejar FileCookieJar load15160352
Ref: 439015160352
Ref: library/http cookiejar http cookiejar FileCookieJar revert15161174
Ref: 439115161174
Ref: library/http cookiejar http cookiejar FileCookieJar filename15161696
Ref: 43a115161696
Ref: library/http cookiejar http cookiejar FileCookieJar delayload15161883
Ref: 43a215161883
Node: FileCookieJar のサブクラスと web ブラウザとの連携15162573
Ref: library/http cookiejar file-cookie-jar-classes15162837
Ref: 439215162837
Ref: library/http cookiejar filecookiejar-subclasses-and-co-operation-with-web-browsers15162837
Ref: 43a315162837
Ref: library/http cookiejar http cookiejar MozillaCookieJar15163096
Ref: 43a415163096
Ref: library/http cookiejar http cookiejar LWPCookieJar15164206
Ref: 43a515164206
Ref: FileCookieJar のサブクラスと web ブラウザとの連携-Footnote-115164761
Node: CookiePolicy オブジェクト15164820
Ref: library/http cookiejar cookie-policy-objects15165070
Ref: 43a615165070
Ref: library/http cookiejar cookiepolicy-objects15165070
Ref: 43a715165070
Ref: library/http cookiejar http cookiejar CookiePolicy set_ok15165290
Ref: 439915165290
Ref: library/http cookiejar http cookiejar CookiePolicy return_ok15165704
Ref: 43a815165704
Ref: library/http cookiejar http cookiejar CookiePolicy domain_return_ok15166111
Ref: 43a915166111
Ref: library/http cookiejar http cookiejar CookiePolicy path_return_ok15168126
Ref: 43aa15168126
Ref: library/http cookiejar http cookiejar CookiePolicy netscape15168760
Ref: 43ab15168760
Ref: library/http cookiejar http cookiejar CookiePolicy rfc296515168874
Ref: 43ac15168874
Ref: library/http cookiejar http cookiejar CookiePolicy hide_cookie215168990
Ref: 43ad15168990
Ref: CookiePolicy オブジェクト-Footnote-115169801
Ref: CookiePolicy オブジェクト-Footnote-215169860
Node: DefaultCookiePolicy オブジェクト15169919
Ref: library/http cookiejar default-cookie-policy-objects15170132
Ref: 43ae15170132
Ref: library/http cookiejar defaultcookiepolicy-objects15170132
Ref: 43af15170132
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy blocked_domains15173320
Ref: 43b015173320
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy set_blocked_domains15173479
Ref: 43b115173479
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy is_blocked15173614
Ref: 43b215173614
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy allowed_domains15173794
Ref: 43b315173794
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy set_allowed_domains15173979
Ref: 43b415173979
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy is_not_allowed15174141
Ref: 43b515174141
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy rfc2109_as_netscape15174572
Ref: 439315174572
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_domain15175353
Ref: 43b615175353
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_rfc2965_unverifiable15175777
Ref: 43b715175777
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_unverifiable15176285
Ref: 43b815176285
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_domain15176490
Ref: 43b915176490
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_set_initial_dollar15176763
Ref: 43ba15176763
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_set_path15176926
Ref: 43bb15176926
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrictNoDots15177267
Ref: 43bc15177267
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrictNonDomain15177642
Ref: 43bd15177642
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainRFC2965Match15178089
Ref: 43be15178089
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainLiberal15178414
Ref: 43bf15178414
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrict15178597
Ref: 43c015178597
Ref: DefaultCookiePolicy オブジェクト-Footnote-115178754
Ref: DefaultCookiePolicy オブジェクト-Footnote-215178813
Ref: DefaultCookiePolicy オブジェクト-Footnote-315178872
Ref: DefaultCookiePolicy オブジェクト-Footnote-415178931
Ref: DefaultCookiePolicy オブジェクト-Footnote-515178990
Ref: DefaultCookiePolicy オブジェクト-Footnote-615179049
Ref: DefaultCookiePolicy オブジェクト-Footnote-715179108
Node: Cookieオブジェクト<2>15179167
Ref: library/http cookiejar cookie-objects15179362
Ref: 43c115179362
Ref: library/http cookiejar http cookiejar Cookie version15180243
Ref: 43c215180243
Ref: library/http cookiejar http cookiejar Cookie name15180585
Ref: 43c315180585
Ref: library/http cookiejar http cookiejar Cookie value15180656
Ref: 43c415180656
Ref: library/http cookiejar http cookiejar Cookie port15180758
Ref: 43c515180758
Ref: library/http cookiejar http cookiejar Cookie domain15180929
Ref: 43c615180929
Ref: library/http cookiejar http cookiejar Cookie path15181009
Ref: 43c715181009
Ref: library/http cookiejar http cookiejar Cookie secure15181121
Ref: 43c815181121
Ref: library/http cookiejar http cookiejar Cookie expires15181266
Ref: 43c915181266
Ref: library/http cookiejar http cookiejar Cookie discard15181508
Ref: 43cb15181508
Ref: library/http cookiejar http cookiejar Cookie comment15181624
Ref: 43cc15181624
Ref: library/http cookiejar http cookiejar Cookie comment_url15181787
Ref: 43cd15181787
Ref: library/http cookiejar http cookiejar Cookie rfc210915181962
Ref: 43ce15181962
Ref: library/http cookiejar http cookiejar Cookie port_specified15182358
Ref: 43cf15182358
Ref: library/http cookiejar http cookiejar Cookie domain_specified15182590
Ref: 43d015182590
Ref: library/http cookiejar http cookiejar Cookie domain_initial_dot15182736
Ref: 43d115182736
Ref: library/http cookiejar http cookiejar Cookie has_nonstandard_attr15183092
Ref: 43d215183092
Ref: library/http cookiejar http cookiejar Cookie get_nonstandard_attr15183281
Ref: 43d315183281
Ref: library/http cookiejar http cookiejar Cookie set_nonstandard_attr15183523
Ref: 43d415183523
Ref: library/http cookiejar http cookiejar Cookie is_expired15183734
Ref: 43ca15183734
Ref: Cookieオブジェクト<2>-Footnote-115184082
Ref: Cookieオブジェクト<2>-Footnote-215184141
Ref: Cookieオブジェクト<2>-Footnote-315184200
Ref: Cookieオブジェクト<2>-Footnote-415184259
Node: 使用例<42>15184318
Ref: library/http cookiejar examples15184466
Ref: 43d515184466
Ref: 使用例<42>-Footnote-115186111
Node: xmlrpc --- XMLRPC サーバーとクライアントモジュール群15186170
Ref: library/xmlrpc doc15186463
Ref: 43d615186463
Ref: library/xmlrpc module-xmlrpc15186463
Ref: 13615186463
Ref: library/xmlrpc translation-repo15186463
Ref: 43d715186463
Ref: library/xmlrpc xmlrpc-xmlrpc-server-and-client-modules15186463
Ref: 43d815186463
Node: xmlrpc client --- XML-RPC クライアントアクセス15187193
Ref: library/xmlrpc client doc15187475
Ref: 43d915187475
Ref: library/xmlrpc client module-xmlrpc client15187475
Ref: 13715187475
Ref: library/xmlrpc client translation-repo15187475
Ref: 43da15187475
Ref: library/xmlrpc client xmlrpc-client-xml-rpc-client-access15187475
Ref: 43db15187475
Ref: library/xmlrpc client xmlrpc client ServerProxy15188810
Ref: e1f15188810
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-115197780
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-215197853
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-315197947
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-415198003
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-515198062
Node: ServerProxy オブジェクト15198108
Ref: library/xmlrpc client id115198267
Ref: 43df15198267
Ref: library/xmlrpc client serverproxy-objects15198267
Ref: 43e015198267
Ref: library/xmlrpc client xmlrpc client ServerProxy system listMethods15198930
Ref: 43e115198930
Ref: library/xmlrpc client xmlrpc client ServerProxy system methodSignature15199116
Ref: 43e215199116
Ref: library/xmlrpc client xmlrpc client ServerProxy system methodHelp15200234
Ref: 43e315200234
Node: DateTime オブジェクト15201364
Ref: library/xmlrpc client datetime-objects15201557
Ref: 43e415201557
Ref: library/xmlrpc client id215201557
Ref: 43e515201557
Ref: library/xmlrpc client xmlrpc client DateTime15201628
Ref: 179c15201628
Ref: library/xmlrpc client xmlrpc client DateTime decode15202088
Ref: 43e615202088
Ref: library/xmlrpc client xmlrpc client DateTime encode15202227
Ref: 43e715202227
Node: Binary オブジェクト15203396
Ref: library/xmlrpc client binary-objects15203583
Ref: 43e815203583
Ref: library/xmlrpc client id315203583
Ref: 43e915203583
Ref: library/xmlrpc client xmlrpc client Binary15203650
Ref: 43dc15203650
Ref: library/xmlrpc client xmlrpc client Binary data15203858
Ref: 43ea15203858
Ref: library/xmlrpc client xmlrpc client Binary decode15204230
Ref: 43eb15204230
Ref: library/xmlrpc client xmlrpc client Binary encode15204416
Ref: 43ec15204416
Ref: Binary オブジェクト-Footnote-115205789
Node: Fault オブジェクト15205860
Ref: library/xmlrpc client fault-objects15206052
Ref: 43ed15206052
Ref: library/xmlrpc client id415206052
Ref: 43ee15206052
Ref: library/xmlrpc client xmlrpc client Fault15206117
Ref: 43dd15206117
Ref: library/xmlrpc client xmlrpc client Fault faultCode15206303
Ref: 43ef15206303
Ref: library/xmlrpc client xmlrpc client Fault faultString15206382
Ref: 43f015206382
Node: ProtocolError オブジェクト15207345
Ref: library/xmlrpc client protocol-error-objects15207540
Ref: 43f115207540
Ref: library/xmlrpc client protocolerror-objects15207540
Ref: 43f215207540
Ref: library/xmlrpc client xmlrpc client ProtocolError15207621
Ref: 43de15207621
Ref: library/xmlrpc client xmlrpc client ProtocolError url15207930
Ref: 43f315207930
Ref: library/xmlrpc client xmlrpc client ProtocolError errcode15208015
Ref: 43f415208015
Ref: library/xmlrpc client xmlrpc client ProtocolError errmsg15208077
Ref: 43f515208077
Ref: library/xmlrpc client xmlrpc client ProtocolError headers15208168
Ref: 43f615208168
Node: MultiCall オブジェクト15208890
Ref: library/xmlrpc client multicall-objects15209073
Ref: 43f715209073
Ref: library/xmlrpc client xmlrpc client MultiCall15209329
Ref: 43f815209329
Ref: MultiCall オブジェクト-Footnote-115211069
Node: 補助関数15211267
Ref: library/xmlrpc client convenience-functions15211451
Ref: 43f915211451
Ref: library/xmlrpc client xmlrpc client dumps15211494
Ref: 43fa15211494
Ref: library/xmlrpc client xmlrpc client loads15212205
Ref: 17ed15212205
Node: クライアントのサンプル15213263
Ref: library/xmlrpc client example-of-client-usage15213464
Ref: 43fb15213464
Ref: library/xmlrpc client xmlrpc-client-example15213464
Ref: 43fc15213464
Node: クライアントとサーバーの利用例15214833
Ref: library/xmlrpc client example-of-client-and-server-usage15215013
Ref: 43fd15215013
Node: xmlrpc server --- 基本的な XML-RPC サーバー15215196
Ref: library/xmlrpc server doc15215454
Ref: 43ff15215454
Ref: library/xmlrpc server module-xmlrpc server15215454
Ref: 13815215454
Ref: library/xmlrpc server translation-repo15215454
Ref: 440015215454
Ref: library/xmlrpc server xmlrpc-server-basic-xml-rpc-servers15215454
Ref: 440115215454
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer15216355
Ref: 440215216355
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler15218173
Ref: 440315218173
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCRequestHandler15218902
Ref: 16e115218902
Ref: xmlrpc server --- 基本的な XML-RPC サーバー-Footnote-115219468
Node: SimpleXMLRPCServer objects15219541
Ref: library/xmlrpc server simple-xmlrpc-servers15219687
Ref: 440415219687
Ref: library/xmlrpc server simplexmlrpcserver-objects15219687
Ref: 440515219687
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_function15219969
Ref: 440615219969
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_instance15221039
Ref: 440715221039
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_introspection_functions15222921
Ref: 440815222921
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_multicall_functions15223165
Ref: 440915223165
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCRequestHandler rpc_paths15223343
Ref: 440a15223343
Node: SimpleXMLRPCServer example15223882
Ref: library/xmlrpc server id115223971
Ref: 440b15223971
Ref: library/xmlrpc server simplexmlrpcserver-example15223971
Ref: 43fe15223971
Node: CGIXMLRPCRequestHandler15228670
Ref: library/xmlrpc server cgixmlrpcrequesthandler15228853
Ref: 440c15228853
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_function15229091
Ref: 440d15229091
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_instance15230166
Ref: 440e15230166
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_introspection_functions15231172
Ref: 440f15231172
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_multicall_functions15231431
Ref: 441015231431
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler handle_request15231590
Ref: 441115231590
Node: XMLRPC サーバの文書化15232286
Ref: library/xmlrpc server documenting-xmlrpc-server15232466
Ref: 441215232466
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer15232882
Ref: 1fb615232882
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler15233467
Ref: 441315233467
Ref: library/xmlrpc server xmlrpc server DocXMLRPCRequestHandler15233636
Ref: 441415233636
Node: DocXMLRPCServer objects15234057
Ref: library/xmlrpc server doc-xmlrpc-servers15234240
Ref: 441515234240
Ref: library/xmlrpc server docxmlrpcserver-objects15234240
Ref: 441615234240
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_title15234777
Ref: 441715234777
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_name15234998
Ref: 441815234998
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_documentation15235224
Ref: 441915235224
Node: DocCGIXMLRPCRequestHandler15235495
Ref: library/xmlrpc server doccgixmlrpcrequesthandler15235641
Ref: 441a15235641
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_title15236185
Ref: 441b15236185
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_name15236417
Ref: 441c15236417
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_documentation15236654
Ref: 441d15236654
Node: ipaddress --- IPv4/IPv6 操作ライブラリ15236936
Ref: library/ipaddress doc15237129
Ref: 441e15237129
Ref: library/ipaddress ipaddress-ipv4-ipv6-manipulation-library15237129
Ref: 441f15237129
Ref: library/ipaddress module-ipaddress15237129
Ref: 8315237129
Ref: library/ipaddress translation-repo15237129
Ref: 442015237129
Ref: ipaddress --- IPv4/IPv6 操作ライブラリ-Footnote-115238364
Node: 便利なファクトリ関数15238433
Ref: library/ipaddress convenience-factory-functions15238569
Ref: 442215238569
Ref: library/ipaddress ipaddress ip_address15238759
Ref: 442315238759
Ref: library/ipaddress ipaddress ip_network15239431
Ref: 442415239431
Ref: library/ipaddress ipaddress ip_interface15240310
Ref: 442515240310
Node: IP アドレス15241374
Ref: library/ipaddress ip-addresses15241546
Ref: 442615241546
Node: Address オブジェクト15241698
Ref: library/ipaddress address-objects15241815
Ref: 442715241815
Ref: library/ipaddress ipaddress IPv4Address15242338
Ref: 71615242338
Ref: library/ipaddress ipaddress IPv4Address version15243735
Ref: 442915243735
Ref: library/ipaddress ipaddress IPv4Address max_prefixlen15243921
Ref: 442a15243921
Ref: library/ipaddress ipaddress IPv4Address compressed15244364
Ref: 442b15244364
Ref: library/ipaddress ipaddress IPv4Address exploded15244396
Ref: 442c15244396
Ref: library/ipaddress ipaddress IPv4Address packed15244943
Ref: 442d15244943
Ref: library/ipaddress ipaddress IPv4Address reverse_pointer15245197
Ref: 11d715245197
Ref: library/ipaddress ipaddress IPv4Address is_multicast15245744
Ref: 442e15245744
Ref: library/ipaddress ipaddress IPv4Address is_private15245942
Ref: 1bec15245942
Ref: library/ipaddress ipaddress IPv4Address is_global15247600
Ref: 130e15247600
Ref: library/ipaddress ipaddress IPv4Address is_unspecified15248522
Ref: 443015248522
Ref: library/ipaddress ipaddress IPv4Address is_reserved15248681
Ref: 443115248681
Ref: library/ipaddress ipaddress IPv4Address is_loopback15249387
Ref: 443315249387
Ref: library/ipaddress ipaddress IPv4Address is_link_local15249560
Ref: 443415249560
Ref: library/ipaddress ipaddress IPv4Address ipv6_mapped15249730
Ref: 71515249730
Ref: library/ipaddress ipaddress IPv4Address __format__15249905
Ref: 443515249905
Ref: library/ipaddress ipaddress IPv6Address15251161
Ref: 71715251161
Ref: library/ipaddress ipaddress IPv6Address compressed15252642
Ref: 443615252642
Ref: library/ipaddress ipaddress IPv6Address exploded15252992
Ref: 443715252992
Ref: library/ipaddress ipaddress IPv6Address packed15253330
Ref: 443815253330
Ref: library/ipaddress ipaddress IPv6Address reverse_pointer15253358
Ref: 1b7315253358
Ref: library/ipaddress ipaddress IPv6Address version15253395
Ref: 443915253395
Ref: library/ipaddress ipaddress IPv6Address max_prefixlen15253424
Ref: 443a15253424
Ref: library/ipaddress ipaddress IPv6Address is_multicast15253459
Ref: 443b15253459
Ref: library/ipaddress ipaddress IPv6Address is_private15253493
Ref: 1bed15253493
Ref: library/ipaddress ipaddress IPv6Address is_global15253525
Ref: 1bee15253525
Ref: library/ipaddress ipaddress IPv6Address is_unspecified15253589
Ref: 443c15253589
Ref: library/ipaddress ipaddress IPv6Address is_reserved15253625
Ref: 443d15253625
Ref: library/ipaddress ipaddress IPv6Address is_loopback15253658
Ref: 1bd315253658
Ref: library/ipaddress ipaddress IPv6Address is_link_local15253691
Ref: 443e15253691
Ref: library/ipaddress ipaddress IPv6Address is_site_local15253726
Ref: 443215253726
Ref: library/ipaddress ipaddress IPv6Address ipv4_mapped15254249
Ref: 442f15254249
Ref: library/ipaddress ipaddress IPv6Address scope_id15254545
Ref: ce115254545
Ref: library/ipaddress ipaddress IPv6Address sixtofour15254843
Ref: 443f15254843
Ref: library/ipaddress ipaddress IPv6Address teredo15255183
Ref: 444015255183
Ref: library/ipaddress ipaddress IPv6Address __format__15255553
Ref: 444115255553
Ref: Address オブジェクト-Footnote-115255780
Ref: Address オブジェクト-Footnote-215255839
Ref: Address オブジェクト-Footnote-315255898
Ref: Address オブジェクト-Footnote-415256000
Ref: Address オブジェクト-Footnote-515256102
Ref: Address オブジェクト-Footnote-615256204
Ref: Address オブジェクト-Footnote-715256306
Ref: Address オブジェクト-Footnote-815256365
Ref: Address オブジェクト-Footnote-915256424
Ref: Address オブジェクト-Footnote-1015256510
Ref: Address オブジェクト-Footnote-1115256613
Ref: Address オブジェクト-Footnote-1215256673
Ref: Address オブジェクト-Footnote-1315256733
Ref: Address オブジェクト-Footnote-1415256793
Ref: Address オブジェクト-Footnote-1515256853
Ref: Address オブジェクト-Footnote-1615256913
Ref: Address オブジェクト-Footnote-1715256973
Ref: Address オブジェクト-Footnote-1815257033
Ref: Address オブジェクト-Footnote-1915257093
Ref: Address オブジェクト-Footnote-2015257153
Ref: Address オブジェクト-Footnote-2115257213
Ref: Address オブジェクト-Footnote-2215257273
Ref: Address オブジェクト-Footnote-2315257333
Node: 文字列と整数への変換15257393
Ref: library/ipaddress conversion-to-strings-and-integers15257531
Ref: 444215257531
Node: 演算子<2>15258196
Ref: library/ipaddress operators15258299
Ref: 444315258299
Node: 比較演算子15258616
Ref: library/ipaddress comparison-operators15258701
Ref: 444415258701
Node: 算術演算15259280
Ref: library/ipaddress arithmetic-operators15259365
Ref: 444515259365
Node: IP ネットワーク定義15259860
Ref: library/ipaddress ip-network-definitions15260044
Ref: 444615260044
Node: プリフィックス ネットマスク、ホストマスク15260941
Ref: library/ipaddress prefix-net-mask-and-host-mask15261101
Ref: 444715261101
Node: Network オブジェクト15262002
Ref: library/ipaddress network-objects15262183
Ref: 444815262183
Ref: library/ipaddress ipaddress IPv4Network15262771
Ref: 71815262771
Ref: library/ipaddress ipaddress IPv4Network version15265646
Ref: 444a15265646
Ref: library/ipaddress ipaddress IPv4Network max_prefixlen15265675
Ref: 444b15265675
Ref: library/ipaddress ipaddress IPv4Network is_multicast15265829
Ref: 444c15265829
Ref: library/ipaddress ipaddress IPv4Network is_private15265863
Ref: 444d15265863
Ref: library/ipaddress ipaddress IPv4Network is_unspecified15265895
Ref: 444e15265895
Ref: library/ipaddress ipaddress IPv4Network is_reserved15265931
Ref: 444f15265931
Ref: library/ipaddress ipaddress IPv4Network is_loopback15265964
Ref: 445015265964
Ref: library/ipaddress ipaddress IPv4Network is_link_local15265997
Ref: 445115265997
Ref: library/ipaddress ipaddress IPv4Network network_address15266189
Ref: 445215266189
Ref: library/ipaddress ipaddress IPv4Network broadcast_address15266426
Ref: 445315266426
Ref: library/ipaddress ipaddress IPv4Network hostmask15266706
Ref: 445415266706
Ref: library/ipaddress ipaddress IPv4Network netmask15266847
Ref: 445515266847
Ref: library/ipaddress ipaddress IPv4Network with_prefixlen15266987
Ref: 445615266987
Ref: library/ipaddress ipaddress IPv4Network compressed15267023
Ref: 445715267023
Ref: library/ipaddress ipaddress IPv4Network exploded15267055
Ref: 445815267055
Ref: library/ipaddress ipaddress IPv4Network with_netmask15267356
Ref: 445915267356
Ref: library/ipaddress ipaddress IPv4Network with_hostmask15267487
Ref: 445a15267487
Ref: library/ipaddress ipaddress IPv4Network num_addresses15267620
Ref: 445b15267620
Ref: library/ipaddress ipaddress IPv4Network prefixlen15267712
Ref: 445c15267712
Ref: library/ipaddress ipaddress IPv4Network hosts15267812
Ref: 19e415267812
Ref: library/ipaddress ipaddress IPv4Network overlaps15268815
Ref: 445d15268815
Ref: library/ipaddress ipaddress IPv4Network address_exclude15268993
Ref: 445e15268993
Ref: library/ipaddress ipaddress IPv4Network subnets15269605
Ref: 125415269605
Ref: library/ipaddress ipaddress IPv4Network supernet15271159
Ref: 125515271159
Ref: library/ipaddress ipaddress IPv4Network subnet_of15271971
Ref: 445f15271971
Ref: library/ipaddress ipaddress IPv4Network supernet_of15272326
Ref: 446015272326
Ref: library/ipaddress ipaddress IPv4Network compare_networks15272691
Ref: 446115272691
Ref: library/ipaddress ipaddress IPv6Network15273461
Ref: 71915273461
Ref: library/ipaddress ipaddress IPv6Network version15275550
Ref: 446215275550
Ref: library/ipaddress ipaddress IPv6Network max_prefixlen15275579
Ref: 446315275579
Ref: library/ipaddress ipaddress IPv6Network is_multicast15275614
Ref: 446415275614
Ref: library/ipaddress ipaddress IPv6Network is_private15275648
Ref: 446515275648
Ref: library/ipaddress ipaddress IPv6Network is_unspecified15275680
Ref: 446615275680
Ref: library/ipaddress ipaddress IPv6Network is_reserved15275716
Ref: 446715275716
Ref: library/ipaddress ipaddress IPv6Network is_loopback15275749
Ref: 446815275749
Ref: library/ipaddress ipaddress IPv6Network is_link_local15275782
Ref: 446915275782
Ref: library/ipaddress ipaddress IPv6Network network_address15275817
Ref: 446a15275817
Ref: library/ipaddress ipaddress IPv6Network broadcast_address15275854
Ref: 446b15275854
Ref: library/ipaddress ipaddress IPv6Network hostmask15275893
Ref: 446c15275893
Ref: library/ipaddress ipaddress IPv6Network netmask15275923
Ref: 446d15275923
Ref: library/ipaddress ipaddress IPv6Network with_prefixlen15275952
Ref: 446e15275952
Ref: library/ipaddress ipaddress IPv6Network compressed15275988
Ref: 446f15275988
Ref: library/ipaddress ipaddress IPv6Network exploded15276020
Ref: 447015276020
Ref: library/ipaddress ipaddress IPv6Network with_netmask15276050
Ref: 447115276050
Ref: library/ipaddress ipaddress IPv6Network with_hostmask15276084
Ref: 447215276084
Ref: library/ipaddress ipaddress IPv6Network num_addresses15276119
Ref: 447315276119
Ref: library/ipaddress ipaddress IPv6Network prefixlen15276154
Ref: 447415276154
Ref: library/ipaddress ipaddress IPv6Network hosts15276185
Ref: 19e515276185
Ref: library/ipaddress ipaddress IPv6Network overlaps15276641
Ref: 447515276641
Ref: library/ipaddress ipaddress IPv6Network address_exclude15276682
Ref: 447615276682
Ref: library/ipaddress ipaddress IPv6Network subnets15276732
Ref: 447715276732
Ref: library/ipaddress ipaddress IPv6Network supernet15276800
Ref: 447815276800
Ref: library/ipaddress ipaddress IPv6Network subnet_of15276869
Ref: 447915276869
Ref: library/ipaddress ipaddress IPv6Network supernet_of15276911
Ref: 447a15276911
Ref: library/ipaddress ipaddress IPv6Network compare_networks15276955
Ref: 447b15276955
Ref: library/ipaddress ipaddress IPv6Network is_site_local15277123
Ref: 447c15277123
Node: 演算子<3>15277299
Ref: library/ipaddress id115277410
Ref: 447d15277410
Node: 論理演算子15277800
Ref: library/ipaddress logical-operators15277894
Ref: 447e15277894
Node: イテレーション15278090
Ref: library/ipaddress iteration15278250
Ref: 447f15278250
Node: アドレスのコンテナとしてのネットワーク15279095
Ref: library/ipaddress networks-as-containers-of-addresses15279231
Ref: 448015279231
Node: インターフェイスオブジェクト15279775
Ref: library/ipaddress interface-objects15279986
Ref: 448115279986
Ref: library/ipaddress ipaddress IPv4Interface15280208
Ref: 1db315280208
Ref: library/ipaddress ipaddress IPv4Interface ip15280621
Ref: 448215280621
Ref: library/ipaddress ipaddress IPv4Interface network15280867
Ref: 448315280867
Ref: library/ipaddress ipaddress IPv4Interface with_prefixlen15281124
Ref: 448415281124
Ref: library/ipaddress ipaddress IPv4Interface with_netmask15281392
Ref: 448515281392
Ref: library/ipaddress ipaddress IPv4Interface with_hostmask15281665
Ref: 448615281665
Ref: library/ipaddress ipaddress IPv6Interface15281937
Ref: 1db415281937
Ref: library/ipaddress ipaddress IPv6Interface ip15282357
Ref: 448715282357
Ref: library/ipaddress ipaddress IPv6Interface network15282381
Ref: 448815282381
Ref: library/ipaddress ipaddress IPv6Interface with_prefixlen15282410
Ref: 448915282410
Ref: library/ipaddress ipaddress IPv6Interface with_netmask15282446
Ref: 448a15282446
Ref: library/ipaddress ipaddress IPv6Interface with_hostmask15282480
Ref: 448b15282480
Node: 演算子<4>15282674
Ref: library/ipaddress id215282765
Ref: 448c15282765
Node: 論理演算子<2>15283088
Ref: library/ipaddress id315283155
Ref: 448d15283155
Node: その他のモジュールレベル関数15283803
Ref: library/ipaddress other-module-level-functions15284004
Ref: 448e15284004
Ref: library/ipaddress ipaddress v4_int_to_packed15284189
Ref: 448f15284189
Ref: library/ipaddress ipaddress v6_int_to_packed15284768
Ref: 449015284768
Ref: library/ipaddress ipaddress summarize_address_range15285182
Ref: 125615285182
Ref: library/ipaddress ipaddress collapse_addresses15286195
Ref: 125715286195
Ref: library/ipaddress ipaddress get_mixed_type_key15286765
Ref: 449115286765
Node: Custom Exceptions15287482
Ref: library/ipaddress custom-exceptions15287632
Ref: 449215287632
Ref: library/ipaddress ipaddress AddressValueError15287845
Ref: 442815287845
Ref: library/ipaddress ipaddress NetmaskValueError15287945
Ref: 444915287945
Node: マルチメディアサービス15288046
Ref: library/mm doc15288222
Ref: 449315288222
Ref: library/mm mmedia15288222
Ref: 449415288222
Ref: library/mm multimedia-services15288222
Ref: 449515288222
Ref: library/mm translation-repo15288222
Ref: 449615288222
Node: wave --- WAV ファイルの読み書き15288763
Ref: library/wave doc15288916
Ref: 449715288916
Ref: library/wave module-wave15288916
Ref: 11c15288916
Ref: library/wave wave-read-and-write-wav-files15288916
Ref: 449815288916
Ref: library/wave wave open15289641
Ref: d1b15289641
Ref: library/wave wave Error15291154
Ref: 449b15291154
Ref: library/wave wave WAVE_FORMAT_PCM15291314
Ref: 449c15291314
Ref: library/wave wave WAVE_FORMAT_IEEE_FLOAT15291397
Ref: 449d15291397
Ref: library/wave wave WAVE_FORMAT_EXTENSIBLE15291490
Ref: 449e15291490
Ref: wave --- WAV ファイルの読み書き-Footnote-115291694
Node: Wave_read オブジェクト15291758
Ref: library/wave id115291901
Ref: 449f15291901
Ref: library/wave wave-read-objects15291901
Ref: 44a015291901
Ref: library/wave wave Wave_read15291972
Ref: 2f215291972
Ref: library/wave wave Wave_read close15292157
Ref: 449915292157
Ref: library/wave wave Wave_read getnchannels15292354
Ref: 44a115292354
Ref: library/wave wave Wave_read getsampwidth15292531
Ref: 44a215292531
Ref: library/wave wave Wave_read getframerate15292637
Ref: 44a315292637
Ref: library/wave wave Wave_read getnframes15292734
Ref: 44a415292734
Ref: library/wave wave Wave_read getformat15292832
Ref: 2b815292832
Ref: library/wave wave Wave_read getcomptype15293061
Ref: 44a515293061
Ref: library/wave wave Wave_read getcompname15293221
Ref: 44a615293221
Ref: library/wave wave Wave_read getparams15293441
Ref: 139815293441
Ref: library/wave wave Wave_read readframes15293664
Ref: 19cf15293664
Ref: library/wave wave Wave_read rewind15293851
Ref: 44a715293851
Ref: library/wave wave Wave_read setpos15294140
Ref: 44a815294140
Ref: library/wave wave Wave_read tell15294258
Ref: 44a915294258
Node: Wave_write オブジェクト15294362
Ref: library/wave id215294505
Ref: 44aa15294505
Ref: library/wave wave-write-objects15294505
Ref: 139915294505
Ref: library/wave wave Wave_write15294578
Ref: 2f315294578
Ref: library/wave wave Wave_write close15295658
Ref: 449a15295658
Ref: library/wave wave Wave_write setnchannels15296005
Ref: 44ac15296005
Ref: library/wave wave Wave_write getnchannels15296097
Ref: 44ad15296097
Ref: library/wave wave Wave_write setsampwidth15296179
Ref: 44ae15296179
Ref: library/wave wave Wave_write getsampwidth15296422
Ref: 44af15296422
Ref: library/wave wave Wave_write setframerate15296507
Ref: 195315296507
Ref: library/wave wave Wave_write getframerate15296781
Ref: 44b015296781
Ref: library/wave wave Wave_write setnframes15296855
Ref: 44ab15296855
Ref: library/wave wave Wave_write getnframes15297185
Ref: 44b115297185
Ref: library/wave wave Wave_write setcomptype15297284
Ref: 44b215297284
Ref: library/wave wave Wave_write getcomptype15297509
Ref: 44b315297509
Ref: library/wave wave Wave_write getcompname15297603
Ref: 44b415297603
Ref: library/wave wave Wave_write setformat15297702
Ref: 2ba15297702
Ref: library/wave wave Wave_write getformat15298003
Ref: 2b915298003
Ref: library/wave wave Wave_write setparams15298089
Ref: 2bb15298089
Ref: library/wave wave Wave_write getparams15298566
Ref: 44b515298566
Ref: library/wave wave Wave_write tell15298779
Ref: 44b615298779
Ref: library/wave wave Wave_write writeframesraw15299049
Ref: 139a15299049
Ref: library/wave wave Wave_write writeframes15299330
Ref: 139b15299330
Node: colorsys --- 色体系間の変換15300252
Ref: library/colorsys doc15300405
Ref: 44b715300405
Ref: library/colorsys colorsys-conversions-between-color-systems15300405
Ref: 44b815300405
Ref: library/colorsys module-colorsys15300405
Ref: 2015300405
Ref: library/colorsys translation-repo15300405
Ref: 44b915300405
Ref: library/colorsys colorsys rgb_to_yiq15301366
Ref: 44ba15301366
Ref: library/colorsys colorsys yiq_to_rgb15301455
Ref: 44bb15301455
Ref: library/colorsys colorsys rgb_to_hls15301544
Ref: 1c9715301544
Ref: library/colorsys colorsys hls_to_rgb15301633
Ref: 44bc15301633
Ref: library/colorsys colorsys rgb_to_hsv15301722
Ref: 44bd15301722
Ref: library/colorsys colorsys hsv_to_rgb15301811
Ref: 44be15301811
Ref: colorsys --- 色体系間の変換-Footnote-115302128
Node: 国際化15302196
Ref: library/i18n doc15302354
Ref: 44bf15302354
Ref: library/i18n i18n15302354
Ref: 44c015302354
Ref: library/i18n internationalization15302354
Ref: 44c115302354
Ref: library/i18n translation-repo15302354
Ref: 44c215302354
Node: gettext --- 多言語国際化サービス15302902
Ref: library/gettext doc15303031
Ref: 44c315303031
Ref: library/gettext gettext-multilingual-internationalization-services15303031
Ref: 44c415303031
Ref: library/gettext module-gettext15303031
Ref: 6615303031
Ref: gettext --- 多言語国際化サービス-Footnote-115304037
Node: GNU gettext API15304104
Ref: library/gettext gnu-gettext-api15304229
Ref: 44c515304229
Ref: library/gettext gettext bindtextdomain15304768
Ref: 44c615304768
Ref: library/gettext gettext textdomain15305399
Ref: 44c715305399
Ref: library/gettext gettext gettext15305795
Ref: 182115305795
Ref: library/gettext gettext dgettext15306065
Ref: 44c815306065
Ref: library/gettext gettext ngettext15306237
Ref: 44c915306237
Ref: library/gettext gettext dngettext15307204
Ref: 44ca15307204
Ref: library/gettext gettext pgettext15307390
Ref: dbc15307390
Ref: library/gettext gettext dpgettext15307442
Ref: 44cb15307442
Ref: library/gettext gettext npgettext15307503
Ref: 44cc15307503
Ref: library/gettext gettext dnpgettext15307568
Ref: 44cd15307568
Ref: GNU gettext API-Footnote-115308398
Ref: GNU gettext API-Footnote-215308878
Node: クラス形式の API15308943
Ref: library/gettext class-based-api15309128
Ref: 44ce15309128
Ref: library/gettext gettext find15309661
Ref: 44d015309661
Ref: library/gettext gettext translation15311543
Ref: e4015311543
Ref: library/gettext gettext install15313073
Ref: e4115313073
Ref: クラス形式の API-Footnote-115314166
Node: NullTranslations クラス15314261
Ref: library/gettext the-nulltranslations-class15314380
Ref: 44d315314380
Ref: library/gettext gettext NullTranslations15314980
Ref: 44d115314980
Ref: library/gettext gettext NullTranslations _parse15315633
Ref: 44d515315633
Ref: library/gettext gettext NullTranslations add_fallback15316195
Ref: 44d415316195
Ref: library/gettext gettext NullTranslations gettext15316584
Ref: 44d615316584
Ref: library/gettext gettext NullTranslations ngettext15316934
Ref: 44d715316934
Ref: library/gettext gettext NullTranslations pgettext15317331
Ref: 44d815317331
Ref: library/gettext gettext NullTranslations npgettext15317704
Ref: 44d915317704
Ref: library/gettext gettext NullTranslations info15318092
Ref: 44da15318092
Ref: library/gettext gettext NullTranslations charset15318224
Ref: 44db15318224
Ref: library/gettext gettext NullTranslations install15318355
Ref: 44d215318355
Node: GNUTranslations クラス15319631
Ref: library/gettext the-gnutranslations-class15319815
Ref: 44dc15319815
Ref: library/gettext gettext GNUTranslations15321450
Ref: 44cf15321450
Ref: library/gettext gettext GNUTranslations gettext15321588
Ref: 44dd15321588
Ref: library/gettext gettext GNUTranslations ngettext15322127
Ref: 44de15322127
Ref: library/gettext gettext GNUTranslations pgettext15323245
Ref: 44df15323245
Ref: library/gettext gettext GNUTranslations npgettext15323865
Ref: 44e015323865
Ref: GNUTranslations クラス-Footnote-115324720
Node: Solaris メッセージカタログ機構のサポート15324778
Ref: library/gettext solaris-message-catalog-support15324965
Ref: 44e115324965
Node: Catalog コンストラクタ15325342
Ref: library/gettext the-catalog-constructor15325495
Ref: 44e215325495
Node: プログラムやモジュールを国際化する15326294
Ref: library/gettext i18n-howto15326473
Ref: 364015326473
Ref: library/gettext internationalizing-your-programs-and-modules15326473
Ref: 44e315326473
Ref: プログラムやモジュールを国際化する-Footnote-115330881
Ref: プログラムやモジュールを国際化する-Footnote-215330914
Node: モジュールを地域化する15330957
Ref: library/gettext localizing-your-module15331129
Ref: 44e415331129
Node: アプリケーションを地域化する15331873
Ref: library/gettext localizing-your-application15332102
Ref: 44e515332102
Node: 動作中 on the fly に言語を切り替える15332896
Ref: library/gettext changing-languages-on-the-fly15333119
Ref: 44e615333119
Node: 翻訳処理の遅延解決15333896
Ref: library/gettext deferred-translations15334068
Ref: 44e715334068
Node: 謝辞<9>15336529
Ref: library/gettext acknowledgements15336677
Ref: 44e815336677
Node: locale --- 国際化サービス15337108
Ref: library/locale doc15337237
Ref: 44e915337237
Ref: library/locale locale-internationalization-services15337237
Ref: 44ea15337237
Ref: library/locale module-locale15337237
Ref: 8915337237
Ref: library/locale translation-repo15337237
Ref: 44eb15337237
Ref: library/locale locale Error15337934
Ref: 44ec15337934
Ref: library/locale locale setlocale15338081
Ref: 23c15338081
Ref: library/locale locale localeconv15340195
Ref: fc115340195
Ref: library/locale locale nl_langinfo15348603
Ref: 66e15348603
Ref: library/locale locale CODESET15349219
Ref: 44f115349219
Ref: library/locale locale D_T_FMT15349401
Ref: 44f215349401
Ref: library/locale locale D_FMT15349656
Ref: 44f315349656
Ref: library/locale locale T_FMT15349900
Ref: 44f415349900
Ref: library/locale locale T_FMT_AMPM15350144
Ref: 44f515350144
Ref: library/locale locale DAY_115350390
Ref: 44f615350390
Ref: library/locale locale DAY_215350423
Ref: 44f715350423
Ref: library/locale locale DAY_315350456
Ref: 44f815350456
Ref: library/locale locale DAY_415350489
Ref: 44f915350489
Ref: library/locale locale DAY_515350522
Ref: 44fa15350522
Ref: library/locale locale DAY_615350555
Ref: 44fb15350555
Ref: library/locale locale DAY_715350588
Ref: 44fc15350588
Ref: library/locale locale ABDAY_115350936
Ref: 44fd15350936
Ref: library/locale locale ABDAY_215350971
Ref: 44fe15350971
Ref: library/locale locale ABDAY_315351006
Ref: 44ff15351006
Ref: library/locale locale ABDAY_415351041
Ref: 450015351041
Ref: library/locale locale ABDAY_515351076
Ref: 450115351076
Ref: library/locale locale ABDAY_615351111
Ref: 450215351111
Ref: library/locale locale ABDAY_715351146
Ref: 450315351146
Ref: library/locale locale MON_115351265
Ref: 450415351265
Ref: library/locale locale MON_215351298
Ref: 450515351298
Ref: library/locale locale MON_315351331
Ref: 450615351331
Ref: library/locale locale MON_415351364
Ref: 450715351364
Ref: library/locale locale MON_515351397
Ref: 450815351397
Ref: library/locale locale MON_615351430
Ref: 450915351430
Ref: library/locale locale MON_715351463
Ref: 450a15351463
Ref: library/locale locale MON_815351496
Ref: 450b15351496
Ref: library/locale locale MON_915351529
Ref: 450c15351529
Ref: library/locale locale MON_1015351562
Ref: 450d15351562
Ref: library/locale locale MON_1115351596
Ref: 450e15351596
Ref: library/locale locale MON_1215351630
Ref: 450f15351630
Ref: library/locale locale ABMON_115351721
Ref: 451015351721
Ref: library/locale locale ABMON_215351756
Ref: 451115351756
Ref: library/locale locale ABMON_315351791
Ref: 451215351791
Ref: library/locale locale ABMON_415351826
Ref: 451315351826
Ref: library/locale locale ABMON_515351861
Ref: 451415351861
Ref: library/locale locale ABMON_615351896
Ref: 451515351896
Ref: library/locale locale ABMON_715351931
Ref: 451615351931
Ref: library/locale locale ABMON_815351966
Ref: 451715351966
Ref: library/locale locale ABMON_915352001
Ref: 451815352001
Ref: library/locale locale ABMON_1015352036
Ref: 451915352036
Ref: library/locale locale ABMON_1115352072
Ref: 451a15352072
Ref: library/locale locale ABMON_1215352108
Ref: 451b15352108
Ref: library/locale locale RADIXCHAR15352216
Ref: 451c15352216
Ref: library/locale locale THOUSEP15352357
Ref: 451d15352357
Ref: library/locale locale YESEXPR15352511
Ref: 451e15352511
Ref: library/locale locale NOEXPR15352720
Ref: 451f15352720
Ref: library/locale locale CRNCYSTR15353184
Ref: 452015353184
Ref: library/locale locale ERA15353487
Ref: 452115353487
Ref: library/locale locale ERA_D_T_FMT15354316
Ref: 452215354316
Ref: library/locale locale ERA_D_FMT15354603
Ref: 452315354603
Ref: library/locale locale ERA_T_FMT15354872
Ref: 452415354872
Ref: library/locale locale ALT_DIGITS15355141
Ref: 452515355141
Ref: library/locale locale getdefaultlocale15355830
Ref: 23e15355830
Ref: library/locale locale getlocale15357352
Ref: 23d15357352
Ref: library/locale locale getpreferredencoding15358031
Ref: 94c15358031
Ref: library/locale locale getencoding15359443
Ref: a4a15359443
Ref: library/locale locale normalize15360218
Ref: 452915360218
Ref: library/locale locale strcoll15360835
Ref: 452a15360835
Ref: library/locale locale strxfrm15361245
Ref: 1a1715361245
Ref: library/locale locale format_string15361663
Ref: 93215361663
Ref: library/locale locale currency15362426
Ref: 452c15362426
Ref: library/locale locale str15363259
Ref: 452d15363259
Ref: library/locale locale delocalize15363449
Ref: 11dd15363449
Ref: library/locale locale localize15363660
Ref: 191115363660
Ref: library/locale locale atof15363881
Ref: 452e15363881
Ref: library/locale locale atoi15364107
Ref: 452f15364107
Ref: library/locale locale LC_CTYPE15364257
Ref: 452715364257
Ref: library/locale locale LC_COLLATE15364923
Ref: 452b15364923
Ref: library/locale locale LC_TIME15365116
Ref: 453015365116
Ref: library/locale locale LC_MONETARY15365324
Ref: 44f015365324
Ref: library/locale locale LC_MESSAGES15365554
Ref: 453115365554
Ref: library/locale locale LC_NUMERIC15366140
Ref: 44ee15366140
Ref: library/locale locale LC_ALL15366463
Ref: 452615366463
Ref: library/locale locale CHAR_MAX15367097
Ref: 44ef15367097
Ref: locale --- 国際化サービス-Footnote-115367502
Ref: locale --- 国際化サービス-Footnote-215367568
Ref: locale --- 国際化サービス-Footnote-315367666
Ref: locale --- 国際化サービス-Footnote-415367708
Node: ロケールの背景、詳細、ヒント、助言および補足説明15367750
Ref: library/locale background-details-hints-tips-and-caveats15367912
Ref: 453215367912
Node: Locale names15370812
Ref: library/locale locale-name15371069
Ref: 44ed15371069
Ref: library/locale locale-names15371069
Ref: 453315371069
Ref: Locale names-Footnote-115372683
Ref: Locale names-Footnote-215372833
Ref: Locale names-Footnote-315372883
Ref: Locale names-Footnote-415372939
Ref: Locale names-Footnote-515373112
Ref: Locale names-Footnote-615373201
Ref: Locale names-Footnote-715373247
Node: Python 拡張の作者と、Python を埋め込むようなプログラムに関して15373289
Ref: library/locale embedding-locale15373519
Ref: 453415373519
Ref: library/locale for-extension-writers-and-programs-that-embed-python15373519
Ref: 453515373519
Node: メッセージカタログへのアクセス15374450
Ref: library/locale access-to-message-catalogs15374659
Ref: 453615374659
Ref: library/locale locale-gettext15374659
Ref: 453715374659
Ref: library/locale locale gettext15374755
Ref: 453815374755
Ref: library/locale locale dgettext15374792
Ref: 453915374792
Ref: library/locale locale dcgettext15374838
Ref: 453a15374838
Ref: library/locale locale textdomain15374895
Ref: 453b15374895
Ref: library/locale locale bindtextdomain15374938
Ref: 453c15374938
Ref: library/locale locale bind_textdomain_codeset15374990
Ref: 453d15374990
Node: Graphical user interfaces with Tk15376200
Ref: library/tk doc15376340
Ref: 453e15376340
Ref: library/tk graphical-user-interfaces-with-tk15376340
Ref: 453f15376340
Ref: library/tk tkinter15376340
Ref: 454015376340
Ref: library/tk translation-repo15376340
Ref: 454115376340
Ref: Graphical user interfaces with Tk-Footnote-115378912
Node: tkinter --- Tcl/Tk の Python インターフェース15378964
Ref: library/tkinter doc15379152
Ref: 454215379152
Ref: library/tkinter module-tkinter15379152
Ref: f915379152
Ref: library/tkinter tkinter-python-interface-to-tcl-tk15379152
Ref: 454315379152
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-115382931
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-215383008
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-315383036
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-415383076
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-515383133
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-615383160
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-715383197
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-815383295
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-915383347
Node: Architecture15383406
Ref: library/tkinter architecture15383541
Ref: 454415383541
Ref: Architecture-Footnote-115385860
Node: Tkinter モジュール15385900
Ref: library/tkinter tkinter-modules15386067
Ref: 454615386067
Ref: library/tkinter tkinter Tk15386401
Ref: 1bd515386401
Ref: library/tkinter tkinter Tk tk15388531
Ref: 1a1e15388531
Ref: library/tkinter tkinter Tk master15388817
Ref: 454815388817
Ref: library/tkinter tkinter Tk children15389397
Ref: 454915389397
Ref: library/tkinter tkinter Tcl15389607
Ref: 454715389607
Ref: library/tkinter module-_tkinter15391617
Ref: 315391617
Node: Tkinter お助け手帳15392556
Ref: library/tkinter tkinter-life-preserver15392726
Ref: 454a15392726
Node: A Hello World Program15393579
Ref: library/tkinter a-hello-world-program15393690
Ref: 454b15393690
Node: Important Tk Concepts15395143
Ref: library/tkinter important-tk-concepts15395301
Ref: 454c15395301
Node: Understanding How Tkinter Wraps Tcl/Tk15396643
Ref: library/tkinter understanding-how-tkinter-wraps-tcl-tk15396809
Ref: 454d15396809
Node: How do I ? What option does ?15398944
Ref: library/tkinter how-do-i-what-option-does15399127
Ref: 454e15399127
Node: Navigating the Tcl/Tk Reference Manual15400866
Ref: library/tkinter navigating-the-tcl-tk-reference-manual15401002
Ref: 454f15401002
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-115403068
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-215403125
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-315403184
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-415403237
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-515403293
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-615403352
Node: Threading model15403406
Ref: library/tkinter threading-model15403580
Ref: 454515403580
Node: 簡単なリファレンス15406547
Ref: library/tkinter handy-reference15406722
Ref: 455015406722
Node: オプションの設定15407056
Ref: library/tkinter setting-options15407159
Ref: 455115407159
Ref: library/tkinter tkinter-setting-options15407159
Ref: 455215407159
Ref: オプションの設定-Footnote-115411379
Node: Packer15411426
Ref: library/tkinter the-packer15411563
Ref: 455315411563
Node: Packer のオプション15413442
Ref: library/tkinter packer-options15413597
Ref: 455415413597
Node: ウィジェット変数を関連付ける15414412
Ref: library/tkinter coupling-widget-variables15414591
Ref: 455515414591
Node: ウィンドウマネージャ15417115
Ref: library/tkinter the-window-manager15417299
Ref: 455615417299
Node: Tk オプションデータ型15418735
Ref: library/tkinter tk-option-data-types15418904
Ref: 455715418904
Node: バインドとイベント15422802
Ref: library/tkinter bindings-and-events15422962
Ref: 455815422962
Ref: library/tkinter id215422962
Ref: 455915422962
Ref: バインドとイベント-Footnote-115426318
Node: index パラメータ15426364
Ref: library/tkinter the-index-parameter15426500
Ref: 455a15426500
Node: 画像15429121
Ref: library/tkinter images15429221
Ref: 455b15429221
Ref: 画像-Footnote-115430797
Node: ファイルハンドラ15430832
Ref: library/tkinter file-handlers15430983
Ref: 455c15430983
Ref: library/tkinter tkinter-file-handlers15430983
Ref: 455d15430983
Ref: library/tkinter tkinter Widget tk createfilehandler15432241
Ref: 455e15432241
Ref: library/tkinter tkinter Widget tk deletefilehandler15432814
Ref: 455f15432814
Ref: library/tkinter tkinter READABLE15432929
Ref: 456015432929
Ref: library/tkinter tkinter WRITABLE15432962
Ref: 456115432962
Ref: library/tkinter tkinter EXCEPTION15432995
Ref: 456215432995
Node: tkinter colorchooser --- カラー選択ダイアログ15433074
Ref: library/tkinter colorchooser doc15433320
Ref: 456315433320
Ref: library/tkinter colorchooser module-tkinter colorchooser15433320
Ref: fa15433320
Ref: library/tkinter colorchooser tkinter-colorchooser-color-choosing-dialog15433320
Ref: 456415433320
Ref: library/tkinter colorchooser translation-repo15433320
Ref: 456515433320
Ref: library/tkinter colorchooser tkinter colorchooser Chooser15433829
Ref: 456615433829
Ref: library/tkinter colorchooser tkinter colorchooser askcolor15433899
Ref: 456815433899
Ref: tkinter colorchooser --- カラー選択ダイアログ-Footnote-115434381
Node: tkinter font --- Tkinter フォントラッパー15434462
Ref: library/tkinter font doc15434677
Ref: 456915434677
Ref: library/tkinter font module-tkinter font15434677
Ref: fe15434677
Ref: library/tkinter font tkinter-font-tkinter-font-wrapper15434677
Ref: 456a15434677
Ref: library/tkinter font translation-repo15434677
Ref: 456b15434677
Ref: library/tkinter font tkinter font NORMAL15435052
Ref: 456c15435052
Ref: library/tkinter font tkinter font BOLD15435087
Ref: 456d15435087
Ref: library/tkinter font tkinter font ITALIC15435120
Ref: 456e15435120
Ref: library/tkinter font tkinter font ROMAN15435155
Ref: 456f15435155
Ref: library/tkinter font tkinter font Font15435190
Ref: 1ee315435190
Ref: library/tkinter font tkinter font Font actual15436491
Ref: 457015436491
Ref: library/tkinter font tkinter font Font cget15436598
Ref: 457115436598
Ref: library/tkinter font tkinter font Font config15436682
Ref: 457215436682
Ref: library/tkinter font tkinter font Font copy15436767
Ref: 457315436767
Ref: library/tkinter font tkinter font Font measure15436851
Ref: 457415436851
Ref: library/tkinter font tkinter font Font metrics15437116
Ref: 457515437116
Ref: library/tkinter font tkinter font families15437699
Ref: 457615437699
Ref: library/tkinter font tkinter font names15437807
Ref: 457715437807
Ref: library/tkinter font tkinter font nametofont15437895
Ref: 1ee515437895
Ref: tkinter font --- Tkinter フォントラッパー-Footnote-115438127
Node: Tkinter ダイアログ15438199
Ref: library/dialog doc15438420
Ref: 457815438420
Ref: library/dialog tkinter-dialogs15438420
Ref: 457915438420
Ref: library/dialog translation-repo15438420
Ref: 457a15438420
Node: tkinter simpledialog --- Standard Tkinter input dialogs15438790
Ref: library/dialog module-tkinter simpledialog15438959
Ref: 10115438959
Ref: library/dialog tkinter-simpledialog-standard-tkinter-input-dialogs15438959
Ref: 457b15438959
Ref: library/dialog tkinter simpledialog askfloat15439364
Ref: 457c15439364
Ref: library/dialog tkinter simpledialog askinteger15439431
Ref: 1ee615439431
Ref: library/dialog tkinter simpledialog askstring15439500
Ref: 457d15439500
Ref: library/dialog tkinter simpledialog Dialog15439699
Ref: 457e15439699
Ref: library/dialog tkinter simpledialog Dialog body15439828
Ref: 457f15439828
Ref: library/dialog tkinter simpledialog Dialog buttonbox15440036
Ref: 458015440036
Ref: tkinter simpledialog --- Standard Tkinter input dialogs-Footnote-115440290
Node: tkinter filedialog --- File selection dialogs15440371
Ref: library/dialog module-tkinter filedialog15440597
Ref: fd15440597
Ref: library/dialog tkinter-filedialog-file-selection-dialogs15440597
Ref: 458115440597
Ref: tkinter filedialog --- File selection dialogs-Footnote-115441060
Node: ネイティブの読み込み/保存ダイアログ15441139
Ref: library/dialog native-load-save-dialogs15441273
Ref: 458215441273
Ref: library/dialog tkinter filedialog askopenfile15442516
Ref: 458315442516
Ref: library/dialog tkinter filedialog askopenfiles15442584
Ref: 458415442584
Ref: library/dialog tkinter filedialog asksaveasfile15442780
Ref: 458615442780
Ref: library/dialog tkinter filedialog askopenfilename15442950
Ref: 458815442950
Ref: library/dialog tkinter filedialog askopenfilenames15443012
Ref: 458915443012
Ref: library/dialog tkinter filedialog asksaveasfilename15443224
Ref: 458a15443224
Ref: library/dialog tkinter filedialog askdirectory15443370
Ref: 458b15443370
Ref: library/dialog tkinter filedialog Open15443597
Ref: 458515443597
Ref: library/dialog tkinter filedialog SaveAs15443661
Ref: 458715443661
Ref: library/dialog tkinter filedialog Directory15443985
Ref: 458c15443985
Ref: library/dialog tkinter filedialog FileDialog15444223
Ref: 458d15444223
Ref: library/dialog tkinter filedialog FileDialog cancel_command15444334
Ref: 458e15444334
Ref: library/dialog tkinter filedialog FileDialog dirs_double_event15444443
Ref: 458f15444443
Ref: library/dialog tkinter filedialog FileDialog dirs_select_event15444555
Ref: 459015444555
Ref: library/dialog tkinter filedialog FileDialog files_double_event15444660
Ref: 459115444660
Ref: library/dialog tkinter filedialog FileDialog files_select_event15444768
Ref: 459215444768
Ref: library/dialog tkinter filedialog FileDialog filter_command15444876
Ref: 459315444876
Ref: library/dialog tkinter filedialog FileDialog get_filter15444970
Ref: 459415444970
Ref: library/dialog tkinter filedialog FileDialog get_selection15445062
Ref: 459515445062
Ref: library/dialog tkinter filedialog FileDialog go15445152
Ref: 459615445152
Ref: library/dialog tkinter filedialog FileDialog ok_event15445300
Ref: 459715445300
Ref: library/dialog tkinter filedialog FileDialog quit15445393
Ref: 459815445393
Ref: library/dialog tkinter filedialog FileDialog set_filter15445484
Ref: 459915445484
Ref: library/dialog tkinter filedialog FileDialog set_selection15445562
Ref: 459a15445562
Ref: library/dialog tkinter filedialog LoadFileDialog15445663
Ref: 459b15445663
Ref: library/dialog tkinter filedialog LoadFileDialog ok_command15445831
Ref: 459c15445831
Ref: library/dialog tkinter filedialog SaveFileDialog15445978
Ref: 459d15445978
Ref: library/dialog tkinter filedialog SaveFileDialog ok_command15446148
Ref: 459e15446148
Node: tkinter commondialog --- Dialog window templates15446366
Ref: library/dialog module-tkinter commondialog15446528
Ref: fb15446528
Ref: library/dialog tkinter-commondialog-dialog-window-templates15446528
Ref: 459f15446528
Ref: library/dialog tkinter commondialog Dialog15446916
Ref: 456715446916
Ref: library/dialog tkinter commondialog Dialog show15446985
Ref: 45a015446985
Ref: tkinter commondialog --- Dialog window templates-Footnote-115447198
Node: tkinter messagebox --- Tkinter メッセージプロンプト15447279
Ref: library/tkinter messagebox doc15447530
Ref: 45a115447530
Ref: library/tkinter messagebox module-tkinter messagebox15447530
Ref: ff15447530
Ref: library/tkinter messagebox tkinter-messagebox-tkinter-message-prompts15447530
Ref: 45a215447530
Ref: library/tkinter messagebox translation-repo15447530
Ref: 45a315447530
Ref: library/tkinter messagebox tkinter messagebox Message15448250
Ref: 45a815448250
Ref: library/tkinter messagebox tkinter messagebox Message show15450395
Ref: 45ad15450395
Ref: library/tkinter messagebox tkinter messagebox showinfo15450716
Ref: 45ae15450716
Ref: library/tkinter messagebox tkinter messagebox showwarning15450942
Ref: 45af15450942
Ref: library/tkinter messagebox tkinter messagebox showerror15451129
Ref: 45b015451129
Ref: library/tkinter messagebox tkinter messagebox askquestion15451350
Ref: 45b115451350
Ref: library/tkinter messagebox tkinter messagebox askokcancel15451601
Ref: 45b215451601
Ref: library/tkinter messagebox tkinter messagebox askretrycancel15451867
Ref: 45b315451867
Ref: library/tkinter messagebox tkinter messagebox askyesno15452142
Ref: 45b515452142
Ref: library/tkinter messagebox tkinter messagebox askyesnocancel15452380
Ref: 45b615452380
Ref: library/tkinter messagebox messagebox-buttons15452674
Ref: 45a915452674
Ref: library/tkinter messagebox tkinter messagebox ABORT15452702
Ref: 45b715452702
Ref: library/tkinter messagebox tkinter messagebox RETRY15452753
Ref: 45b415452753
Ref: library/tkinter messagebox tkinter messagebox IGNORE15452804
Ref: 45b815452804
Ref: library/tkinter messagebox tkinter messagebox OK15452857
Ref: 45a415452857
Ref: library/tkinter messagebox tkinter messagebox CANCEL15452902
Ref: 45a515452902
Ref: library/tkinter messagebox tkinter messagebox YES15452955
Ref: 45a615452955
Ref: library/tkinter messagebox tkinter messagebox NO15453002
Ref: 45a715453002
Ref: library/tkinter messagebox messagebox-types15453046
Ref: 45ac15453046
Ref: library/tkinter messagebox tkinter messagebox ABORTRETRYIGNORE15453075
Ref: 45b915453075
Ref: library/tkinter messagebox tkinter messagebox OKCANCEL15453379
Ref: 45ba15453379
Ref: library/tkinter messagebox tkinter messagebox RETRYCANCEL15453533
Ref: 45bb15453533
Ref: library/tkinter messagebox tkinter messagebox YESNO15453696
Ref: 45bc15453696
Ref: library/tkinter messagebox tkinter messagebox YESNOCANCEL15453841
Ref: 45bd15453841
Ref: library/tkinter messagebox messagebox-icons15454019
Ref: 45aa15454019
Ref: library/tkinter messagebox tkinter messagebox ERROR15454033
Ref: 45be15454033
Ref: library/tkinter messagebox tkinter messagebox INFO15454084
Ref: 45ab15454084
Ref: library/tkinter messagebox tkinter messagebox QUESTION15454133
Ref: 45bf15454133
Ref: library/tkinter messagebox tkinter messagebox WARNING15454190
Ref: 45c015454190
Ref: tkinter messagebox --- Tkinter メッセージプロンプト-Footnote-115454281
Node: tkinter scrolledtext --- スクロール可能なテキストウィジェット15454360
Ref: library/tkinter scrolledtext doc15454652
Ref: 45c115454652
Ref: library/tkinter scrolledtext module-tkinter scrolledtext15454652
Ref: 10015454652
Ref: library/tkinter scrolledtext tkinter-scrolledtext-scrolled-text-widget15454652
Ref: 45c215454652
Ref: library/tkinter scrolledtext translation-repo15454652
Ref: 45c315454652
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText15455731
Ref: 45c415455731
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText frame15455801
Ref: 45c515455801
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText vbar15455924
Ref: 45c615455924
Ref: tkinter scrolledtext --- スクロール可能なテキストウィジェット-Footnote-115456040
Node: tkinter dnd --- ドラッグアンドドロップのサポート15456121
Ref: library/tkinter dnd doc15456407
Ref: 45c715456407
Ref: library/tkinter dnd module-tkinter dnd15456407
Ref: fc15456407
Ref: library/tkinter dnd tkinter-dnd-drag-and-drop-support15456407
Ref: 45c815456407
Ref: library/tkinter dnd translation-repo15456407
Ref: 45c915456407
Ref: library/tkinter dnd tkinter dnd DndHandler15457951
Ref: 45cb15457951
Ref: library/tkinter dnd tkinter dnd DndHandler cancel15458143
Ref: 45cc15458143
Ref: library/tkinter dnd tkinter dnd DndHandler finish15458232
Ref: 45cd15458232
Ref: library/tkinter dnd tkinter dnd DndHandler on_motion15458332
Ref: 45ce15458332
Ref: library/tkinter dnd tkinter dnd DndHandler on_release15458464
Ref: 45cf15458464
Ref: library/tkinter dnd tkinter dnd dnd_start15458576
Ref: 45ca15458576
Ref: tkinter dnd --- ドラッグアンドドロップのサポート-Footnote-115458771
Node: tkinter ttk --- Tk のテーマ付きウィジェット15458842
Ref: library/tkinter ttk doc15459095
Ref: 45d015459095
Ref: library/tkinter ttk module-tkinter ttk15459095
Ref: 10215459095
Ref: library/tkinter ttk tkinter-ttk-tk-themed-widgets15459095
Ref: 45d115459095
Ref: library/tkinter ttk translation-repo15459095
Ref: 45d215459095
Ref: tkinter ttk --- Tk のテーマ付きウィジェット-Footnote-115460144
Ref: tkinter ttk --- Tk のテーマ付きウィジェット-Footnote-215460215
Node: Ttk を使う15460268
Ref: library/tkinter ttk using-ttk15460404
Ref: 45d315460404
Ref: Ttk を使う-Footnote-115461858
Node: Ttk ウィジェット15461922
Ref: library/tkinter ttk ttk-widgets15462085
Ref: 45d415462085
Node: ウィジェット15463368
Ref: library/tkinter ttk widget15463539
Ref: 45da15463539
Node: 標準オプション15464032
Ref: library/tkinter ttk standard-options15464174
Ref: 45db15464174
Node: スクロール可能ウィジェットのオプション15466163
Ref: library/tkinter ttk scrollable-widget-options15466338
Ref: 45dc15466338
Node: ラベルオプション15467626
Ref: library/tkinter ttk label-options15467804
Ref: 45dd15467804
Node: 互換性オプション15470591
Ref: library/tkinter ttk compatibility-options15470739
Ref: 45de15470739
Node: ウィジェットの状態15471340
Ref: library/tkinter ttk widget-states15471474
Ref: 45e015471474
Node: ttk Widget15473444
Ref: library/tkinter ttk ttk-widget15473545
Ref: 45e115473545
Ref: library/tkinter ttk tkinter ttk Widget15473787
Ref: 45d815473787
Ref: library/tkinter ttk tkinter ttk Widget identify15473822
Ref: 45e215473822
Ref: library/tkinter ttk tkinter ttk Widget instate15474100
Ref: 45e315474100
Ref: library/tkinter ttk tkinter ttk Widget state15474665
Ref: 45df15474665
Node: コンボボックス15475190
Ref: library/tkinter ttk combobox15475346
Ref: 45e415475346
Node: オプション15476182
Ref: library/tkinter ttk options15476282
Ref: 45e515476282
Node: 仮想イベント15478982
Ref: library/tkinter ttk virtual-events15479103
Ref: 45e615479103
Node: ttk Combobox15479322
Ref: library/tkinter ttk ttk-combobox15479419
Ref: 45e715479419
Ref: library/tkinter ttk tkinter ttk Combobox15479466
Ref: 45d515479466
Ref: library/tkinter ttk tkinter ttk Combobox current15479503
Ref: 45e815479503
Ref: library/tkinter ttk tkinter ttk Combobox get15479911
Ref: 45e915479911
Ref: library/tkinter ttk tkinter ttk Combobox set15480008
Ref: 45ea15480008
Node: Spinbox15480116
Ref: library/tkinter ttk spinbox15480272
Ref: 45eb15480272
Node: オプション<2>15481117
Ref: library/tkinter ttk id115481209
Ref: 45ec15481209
Node: 仮想イベント<2>15483629
Ref: library/tkinter ttk id215483741
Ref: 45ed15483741
Node: ttk Spinbox15483951
Ref: library/tkinter ttk ttk-spinbox15484036
Ref: 45ee15484036
Ref: library/tkinter ttk tkinter ttk Spinbox15484081
Ref: f5715484081
Ref: library/tkinter ttk tkinter ttk Spinbox get15484117
Ref: 45ef15484117
Ref: library/tkinter ttk tkinter ttk Spinbox set15484201
Ref: 45f015484201
Node: ノートブック15484290
Ref: library/tkinter ttk notebook15484446
Ref: 45f115484446
Node: オプション<3>15484973
Ref: library/tkinter ttk id315485076
Ref: 45f215485076
Node: タブオプション15486396
Ref: library/tkinter ttk tab-options15486523
Ref: 45f315486523
Node: タブ識別子15488704
Ref: library/tkinter ttk tab-identifiers15488834
Ref: 45f515488834
Node: 仮想イベント<3>15489321
Ref: library/tkinter ttk id415489442
Ref: 45f715489442
Node: ttk Notebook15489628
Ref: library/tkinter ttk ttk-notebook15489725
Ref: 45f815489725
Ref: library/tkinter ttk tkinter ttk Notebook15489772
Ref: 45d615489772
Ref: library/tkinter ttk tkinter ttk Notebook add15489809
Ref: 45f915489809
Ref: library/tkinter ttk tkinter ttk Notebook forget15490216
Ref: 45fa15490216
Ref: library/tkinter ttk tkinter ttk Notebook hide15490432
Ref: 45fb15490432
Ref: library/tkinter ttk tkinter ttk Notebook identify15490812
Ref: 45fc15490812
Ref: library/tkinter ttk tkinter ttk Notebook index15490982
Ref: 45f615490982
Ref: library/tkinter ttk tkinter ttk Notebook insert15491187
Ref: 45fd15491187
Ref: library/tkinter ttk tkinter ttk Notebook select15491704
Ref: 45fe15491704
Ref: library/tkinter ttk tkinter ttk Notebook tab15492139
Ref: 45ff15492139
Ref: library/tkinter ttk tkinter ttk Notebook tabs15492611
Ref: 460015492611
Ref: library/tkinter ttk tkinter ttk Notebook enable_traversal15492742
Ref: 45f415492742
Node: プログレスバー15493926
Ref: library/tkinter ttk progressbar15494090
Ref: 460115494090
Node: オプション<4>15494590
Ref: library/tkinter ttk id515494690
Ref: 460215494690
Node: ttk Progressbar15496707
Ref: library/tkinter ttk ttk-progressbar15496807
Ref: 460315496807
Ref: library/tkinter ttk tkinter ttk Progressbar15496860
Ref: 45d715496860
Ref: library/tkinter ttk tkinter ttk Progressbar start15496900
Ref: 460415496900
Ref: library/tkinter ttk tkinter ttk Progressbar step15497264
Ref: 460515497264
Ref: library/tkinter ttk tkinter ttk Progressbar stop15497499
Ref: 460615497499
Node: セパレータ15497762
Ref: library/tkinter ttk separator15497929
Ref: 460715497929
Node: オプション<5>15498223
Ref: library/tkinter ttk id615498293
Ref: 460815498293
Node: サイズグリップ15498700
Ref: library/tkinter ttk sizegrip15498864
Ref: 460915498864
Node: プラットフォーム固有のメモ15499382
Ref: library/tkinter ttk platform-specific-notes15499494
Ref: 460a15499494
Node: バグ15499864
Ref: library/tkinter ttk bugs15499976
Ref: 460b15499976
Node: ツリービュー15500402
Ref: library/tkinter ttk treeview15500567
Ref: 460c15500567
Node: オプション<6>15502435
Ref: library/tkinter ttk id715502538
Ref: 461015502538
Node: 要素オプション15505325
Ref: library/tkinter ttk item-options15505458
Ref: 461115505458
Node: タグオプション15506690
Ref: library/tkinter ttk tag-options15506823
Ref: 461215506823
Node: カラム識別子15507567
Ref: library/tkinter ttk column-identifiers15507700
Ref: 460d15507700
Node: 仮想イベント<4>15508857
Ref: library/tkinter ttk id815508981
Ref: 461315508981
Node: ttk Treeview15509956
Ref: library/tkinter ttk ttk-treeview15510053
Ref: 461515510053
Ref: library/tkinter ttk tkinter ttk Treeview15510100
Ref: e5a15510100
Ref: library/tkinter ttk tkinter ttk Treeview bbox15510137
Ref: 461615510137
Ref: library/tkinter ttk tkinter ttk Treeview get_children15510762
Ref: 461715510762
Ref: library/tkinter ttk tkinter ttk Treeview set_children15510992
Ref: 461815510992
Ref: library/tkinter ttk tkinter ttk Treeview column15511493
Ref: 461915511493
Ref: library/tkinter ttk tkinter ttk Treeview delete15513217
Ref: 461a15513217
Ref: library/tkinter ttk tkinter ttk Treeview detach15513395
Ref: 461b15513395
Ref: library/tkinter ttk tkinter ttk Treeview exists15513799
Ref: 461c15513799
Ref: library/tkinter ttk tkinter ttk Treeview focus15513932
Ref: 461415513932
Ref: library/tkinter ttk tkinter ttk Treeview heading15514267
Ref: 461d15514267
Ref: library/tkinter ttk tkinter ttk Treeview identify15515512
Ref: 461e15515512
Ref: library/tkinter ttk tkinter ttk Treeview identify_row15516145
Ref: 461f15516145
Ref: library/tkinter ttk tkinter ttk Treeview identify_column15516268
Ref: 462015516268
Ref: library/tkinter ttk tkinter ttk Treeview identify_region15516499
Ref: 462115516499
Ref: library/tkinter ttk tkinter ttk Treeview identify_element15517204
Ref: 462215517204
Ref: library/tkinter ttk tkinter ttk Treeview index15517382
Ref: 462315517382
Ref: library/tkinter ttk tkinter ttk Treeview insert15517520
Ref: 462415517520
Ref: library/tkinter ttk tkinter ttk Treeview item15518528
Ref: 462515518528
Ref: library/tkinter ttk tkinter ttk Treeview move15519059
Ref: 462615519059
Ref: library/tkinter ttk tkinter ttk Treeview next15519566
Ref: 462715519566
Ref: library/tkinter ttk tkinter ttk Treeview parent15519752
Ref: 462815519752
Ref: library/tkinter ttk tkinter ttk Treeview prev15519910
Ref: 462915519910
Ref: library/tkinter ttk tkinter ttk Treeview reattach15520096
Ref: 462a15520096
Ref: library/tkinter ttk tkinter ttk Treeview see15520219
Ref: 462b15520219
Ref: library/tkinter ttk tkinter ttk Treeview selection15520538
Ref: e5915520538
Ref: library/tkinter ttk tkinter ttk Treeview selection_set15520799
Ref: e5b15520799
Ref: library/tkinter ttk tkinter ttk Treeview selection_add15521070
Ref: 462c15521070
Ref: library/tkinter ttk tkinter ttk Treeview selection_remove15521341
Ref: 462d15521341
Ref: library/tkinter ttk tkinter ttk Treeview selection_toggle15521615
Ref: 462e15521615
Ref: library/tkinter ttk tkinter ttk Treeview set15521900
Ref: 462f15521900
Ref: library/tkinter ttk tkinter ttk Treeview tag_bind15522362
Ref: 463015522362
Ref: library/tkinter ttk tkinter ttk Treeview tag_configure15522721
Ref: 463115522721
Ref: library/tkinter ttk tkinter ttk Treeview tag_has15523257
Ref: 463215523257
Ref: library/tkinter ttk tkinter ttk Treeview xview15523670
Ref: 460e15523670
Ref: library/tkinter ttk tkinter ttk Treeview yview15523827
Ref: 460f15523827
Node: Ttk スタイル15523984
Ref: library/tkinter ttk ttk-styling15524119
Ref: 463315524119
Ref: library/tkinter ttk ttkstyling15524119
Ref: 45d915524119
Ref: library/tkinter ttk tkinter ttk Style15524934
Ref: 76715524934
Ref: library/tkinter ttk tkinter ttk Style configure15525065
Ref: 463415525065
Ref: library/tkinter ttk tkinter ttk Style map15525908
Ref: 1efa15525908
Ref: library/tkinter ttk tkinter ttk Style lookup15527429
Ref: 463515527429
Ref: library/tkinter ttk tkinter ttk Style layout15528111
Ref: 463615528111
Ref: library/tkinter ttk tkinter ttk Style element_create15529675
Ref: 76615529675
Ref: library/tkinter ttk tkinter ttk Style element_names15535333
Ref: 463815535333
Ref: library/tkinter ttk tkinter ttk Style element_options15535464
Ref: 463915535464
Ref: library/tkinter ttk tkinter ttk Style theme_create15535592
Ref: 463a15535592
Ref: library/tkinter ttk tkinter ttk Style theme_settings15536134
Ref: 463b15536134
Ref: library/tkinter ttk tkinter ttk Style theme_names15537694
Ref: 463c15537694
Ref: library/tkinter ttk tkinter ttk Style theme_use15537802
Ref: 463d15537802
Ref: Ttk スタイル-Footnote-115538238
Node: レイアウト15538300
Ref: library/tkinter ttk layouts15538368
Ref: 463715538368
Ref: library/tkinter ttk layout15539642
Ref: 463e15539642
Node: IDLE --- Python のエディタとシェル<2>15539643
Ref: library/idle doc15539858
Ref: 463f15539858
Ref: library/idle idle15539858
Ref: 13c315539858
Ref: library/idle idle-python-editor-and-shell15539858
Ref: 464015539858
Ref: library/idle translation-repo15539858
Ref: 464115539858
Ref: IDLE --- Python のエディタとシェル<2>-Footnote-115541551
Node: メニュー15541616
Ref: library/idle menus15541742
Ref: 464215541742
Node: File メニュー Shell ウィンドウ、Editor ウィンドウ15543880
Ref: library/idle file-menu-shell-and-editor15544066
Ref: 464315544066
Node: Edit メニュー Shell ウィンドウ、Editor ウィンドウ15546638
Ref: library/idle edit-menu-shell-and-editor15546899
Ref: 464415546899
Node: Format メニュー Shell ウィンドウ、Editor ウィンドウ15549461
Ref: library/idle format-menu15549703
Ref: 464715549703
Ref: library/idle format-menu-editor-window-only15549703
Ref: 464815549703
Node: Run メニュー Editor ウィンドウのみ15551682
Ref: library/idle run-menu-editor-window-only15551906
Ref: 464a15551906
Ref: library/idle run-module15552010
Ref: 464b15552010
Ref: library/idle run-custom15552731
Ref: 464d15552731
Ref: library/idle check-module15552991
Ref: 464c15552991
Ref: library/idle python-shell15553454
Ref: 464e15553454
Node: Shell メニュー Shell ウィンドウのみ15553556
Ref: library/idle shell-menu-shell-window-only15553760
Ref: 464f15553760
Node: Debug メニュー Shell ウィンドウのみ15554477
Ref: library/idle debug-menu-shell-window-only15554703
Ref: 465015554703
Node: Options メニュー Shell ウィンドウ、Editor ウィンドウ15556126
Ref: library/idle options-menu-shell-and-editor15556372
Ref: 465115556372
Node: Window メニュー Shell ウィンドウ、Editor ウィンドウ15558231
Ref: library/idle window-menu-shell-and-editor15558495
Ref: 465415558495
Node: Help メニュー Shell ウィンドウ、Editor ウィンドウ15558748
Ref: library/idle help-menu-shell-and-editor15558958
Ref: 465515558958
Node: Context menus15560233
Ref: library/idle context-menus15560368
Ref: 465715560368
Node: Editing and Navigation15562173
Ref: library/idle editing-and-navigation15562334
Ref: 465815562334
Ref: library/idle id115562334
Ref: 465915562334
Node: Editor windows15562679
Ref: library/idle editor-windows15562773
Ref: 465a15562773
Node: Key bindings15563387
Ref: library/idle key-bindings15563511
Ref: 465b15563511
Node: 自動的な字下げ15565013
Ref: library/idle automatic-indentation15565138
Ref: 465c15565138
Node: 検索と置換15565884
Ref: library/idle search-and-replace15566015
Ref: 465d15566015
Node: 補完 Completions15566338
Ref: library/idle completions15566478
Ref: 464515566478
Ref: library/idle id215566478
Ref: 465e15566478
Node: 呼び出しヒント Calltips15569117
Ref: library/idle calltips15569254
Ref: 464615569254
Ref: library/idle id315569254
Ref: 465f15569254
Node: Format block15570905
Ref: library/idle format-block15571036
Ref: 464915571036
Ref: library/idle id415571036
Ref: 466015571036
Node: Code Context15571555
Ref: library/idle code-context15571668
Ref: 465315571668
Ref: library/idle id515571668
Ref: 466115571668
Node: Shell window15572556
Ref: library/idle shell-window15572675
Ref: 466215572675
Node: テキストの色15574350
Ref: library/idle text-colors15574448
Ref: 466315574448
Node: Startup and Code Execution15575892
Ref: library/idle startup-and-code-execution15576061
Ref: 466415576061
Node: コマンドラインでの使用<5>15577448
Ref: library/idle command-line-usage15577571
Ref: 466515577571
Ref: library/idle idlelib-cli15577571
Ref: 466615577571
Ref: library/idle cmdoption-idle-c15577821
Ref: 466715577821
Ref: library/idle cmdoption-idle-d15578033
Ref: 466815578033
Ref: library/idle cmdoption-idle-e15578102
Ref: 466915578102
Ref: library/idle cmdoption-idle-h15578147
Ref: 466a15578147
Ref: library/idle cmdoption-idle-i15578235
Ref: 466b15578235
Ref: library/idle cmdoption-idle-r15578278
Ref: 466c15578278
Ref: library/idle cmdoption-idle-s15578351
Ref: 466d15578351
Ref: library/idle cmdoption-idle-t15578526
Ref: 466e15578526
Ref: library/idle cmdoption-idle-015578591
Ref: 466f15578591
Node: Startup failure15579178
Ref: library/idle startup-failure15579327
Ref: 467015579327
Node: Running user code15582501
Ref: library/idle running-user-code15582634
Ref: 467115582634
Node: User output in Shell15585414
Ref: library/idle user-output-in-shell15585563
Ref: 467215585563
Node: Developing tkinter applications15588633
Ref: library/idle developing-tkinter-applications15588813
Ref: 467315588813
Node: サブプロセスを起こさずに起動する15590062
Ref: library/idle running-without-a-subprocess15590213
Ref: 467415590213
Node: Help and Preferences15592280
Ref: library/idle help-and-preferences15592473
Ref: 467515592473
Node: Help sources15592647
Ref: library/idle help-sources15592762
Ref: 465615592762
Ref: library/idle id615592762
Ref: 467615592762
Node: Setting preferences [お好み設定]15593620
Ref: library/idle preferences15593757
Ref: 465215593757
Ref: library/idle setting-preferences15593757
Ref: 467715593757
Node: IDLE on macOS15594795
Ref: library/idle idle-on-macos15594939
Ref: 467815594939
Node: Extensions [拡張]15595198
Ref: library/idle extensions15595296
Ref: 467915595296
Node: idlelib --- implementation of IDLE application15595663
Ref: library/idle idlelib-implementation-of-idle-application15595821
Ref: 467a15595821
Ref: library/idle module-idlelib15595821
Ref: 7615595821
Ref: idlelib --- implementation of IDLE application-Footnote-115596521
Ref: idlelib --- implementation of IDLE application-Footnote-215596585
Node: turtle --- Turtle graphics15596627
Ref: library/turtle doc15596778
Ref: 467b15596778
Ref: library/turtle module-turtle15596778
Ref: 10a15596778
Ref: library/turtle translation-repo15596778
Ref: 467c15596778
Ref: library/turtle turtle-turtle-graphics15596778
Ref: 467d15596778
Ref: turtle --- Turtle graphics-Footnote-115597523
Node: はじめに<12>15597589
Ref: library/turtle introduction15597688
Ref: 467e15597688
Ref: はじめに<12>-Footnote-115598203
Node: Get started15598256
Ref: library/turtle get-started15598388
Ref: 467f15598388
Node: チュートリアル<4>15599636
Ref: library/turtle turtle-tutorial15599758
Ref: 468015599758
Ref: library/turtle tutorial15599758
Ref: 468115599758
Node: Starting a turtle environment15600010
Ref: library/turtle starting-a-turtle-environment15600122
Ref: 468215600122
Node: Basic drawing15600435
Ref: library/turtle basic-drawing15600583
Ref: 468315600583
Node: Pen の制御15601222
Ref: library/turtle pen-control15601315
Ref: 468415601315
Node: The turtle's position15601646
Ref: library/turtle the-turtle-s-position15601739
Ref: 468515601739
Node: Making algorithmic patterns15602178
Ref: library/turtle making-algorithmic-patterns15602288
Ref: 468615602288
Node: How to15603261
Ref: library/turtle how-to15603397
Ref: 468715603397
Ref: library/turtle turtle-how-to15603397
Ref: 468815603397
Node: Get started as quickly as possible15603706
Ref: library/turtle get-started-as-quickly-as-possible15603827
Ref: 468915603827
Ref: library/turtle note15604579
Ref: 468a15604579
Node: Automatically begin and end filling15604847
Ref: library/turtle automatically-begin-and-end-filling15605008
Ref: 468b15605008
Node: Use the turtle module namespace15605585
Ref: library/turtle use-the-turtle-module-namespace15605743
Ref: 468e15605743
Node: Use turtle graphics in a script15606405
Ref: library/turtle use-turtle-graphics-in-a-script15606563
Ref: 468f15606563
Node: Use object-oriented turtle graphics15607255
Ref: library/turtle use-object-oriented-turtle-graphics15607373
Ref: 469015607373
Node: Turtle graphics reference15608593
Ref: library/turtle turtle-graphics-reference15608758
Ref: 469315608758
Node: Turtle のメソッド15609125
Ref: library/turtle turtle-methods15609253
Ref: 469415609253
Node: TurtleScreen/Screen のメソッド15612397
Ref: library/turtle methods-of-turtlescreen-screen15612525
Ref: 46df15612525
Node: RawTurtle/Turtle のメソッドと対応する関数15613976
Ref: library/turtle methods-of-rawturtle-turtle-and-corresponding-functions15614191
Ref: 46fe15614191
Node: Turtle の動き15614656
Ref: library/turtle turtle-motion15614796
Ref: 46ff15614796
Ref: library/turtle turtle forward15614850
Ref: 386d15614850
Ref: library/turtle turtle fd15614891
Ref: 469515614891
Ref: library/turtle turtle back15615360
Ref: 469815615360
Ref: library/turtle turtle bk15615398
Ref: 469715615398
Ref: library/turtle turtle backward15615434
Ref: 469615615434
Ref: library/turtle turtle right15615843
Ref: 469915615843
Ref: library/turtle turtle rt15615879
Ref: 469a15615879
Ref: library/turtle turtle left15616466
Ref: 469b15616466
Ref: library/turtle turtle lt15616501
Ref: 469c15616501
Ref: library/turtle turtle goto15617086
Ref: 469d15617086
Ref: library/turtle turtle setpos15617125
Ref: 469e15617125
Ref: library/turtle turtle setposition15617166
Ref: 469f15617166
Ref: library/turtle turtle teleport15618021
Ref: 1cbb15618021
Ref: library/turtle turtle setx15619036
Ref: 46a015619036
Ref: library/turtle turtle sety15619379
Ref: 46a115619379
Ref: library/turtle turtle setheading15619721
Ref: 46a215619721
Ref: library/turtle turtle seth15619765
Ref: 46a315619765
Ref: library/turtle turtle home15620637
Ref: 46a415620637
Ref: library/turtle turtle circle15621115
Ref: 46a515621115
Ref: library/turtle turtle dot15622658
Ref: 46a615622658
Ref: library/turtle turtle stamp15623392
Ref: 46a715623392
Ref: library/turtle turtle clearstamp15623821
Ref: 46a815623821
Ref: library/turtle turtle clearstamps15624384
Ref: 46a915624384
Ref: library/turtle turtle undo15624987
Ref: 46aa15624987
Ref: library/turtle turtle speed15625379
Ref: 46ab15625379
Node: Turtle の状態を知る15626643
Ref: library/turtle tell-turtle-s-state15626807
Ref: 470115626807
Ref: library/turtle turtle position15626876
Ref: 46ac15626876
Ref: library/turtle turtle pos15626910
Ref: 46ad15626910
Ref: library/turtle turtle towards15627098
Ref: 46ae15627098
Ref: library/turtle turtle xcor15627672
Ref: 46af15627672
Ref: library/turtle turtle ycor15627960
Ref: 46b015627960
Ref: library/turtle turtle heading15628255
Ref: 46b115628255
Ref: library/turtle turtle distance15628569
Ref: 46b215628569
Node: 設定と計測15629267
Ref: library/turtle settings-for-measurement15629431
Ref: 470215629431
Ref: library/turtle turtle degrees15629481
Ref: 46b315629481
Ref: library/turtle turtle radians15630168
Ref: 46b415630168
Node: Pen の制御<2>15630512
Ref: library/turtle id115630672
Ref: 470315630672
Node: 描画状態15630832
Ref: library/turtle drawing-state15630921
Ref: 470415630921
Ref: library/turtle turtle pendown15630966
Ref: 46b515630966
Ref: library/turtle turtle pd15630999
Ref: 46b615630999
Ref: library/turtle turtle down15631027
Ref: 46b715631027
Ref: library/turtle turtle penup15631125
Ref: 46b815631125
Ref: library/turtle turtle pu15631156
Ref: 46b915631156
Ref: library/turtle turtle up15631184
Ref: 46ba15631184
Ref: library/turtle turtle pensize15631283
Ref: 46bb15631283
Ref: library/turtle turtle width15631326
Ref: 46bc15631326
Ref: library/turtle turtle pen15631830
Ref: 46bd15631830
Ref: library/turtle turtle isdown15633754
Ref: 46be15633754
Node: 色の制御<2>15634055
Ref: library/turtle color-control15634168
Ref: 470515634168
Ref: library/turtle turtle pencolor15634213
Ref: 46c015634213
Ref: library/turtle turtle fillcolor15636134
Ref: 46c115636134
Ref: library/turtle turtle color15638004
Ref: 46bf15638004
Node: 塗りつぶし15639618
Ref: library/turtle filling15639746
Ref: 470615639746
Ref: library/turtle turtle filling15639796
Ref: 46c215639796
Ref: library/turtle turtle fill15640056
Ref: 52a15640056
Ref: library/turtle turtle begin_fill15640600
Ref: 468c15640600
Ref: library/turtle turtle end_fill15640698
Ref: 468d15640698
Node: さらなる描画の制御15641286
Ref: library/turtle more-drawing-control15641390
Ref: 470715641390
Ref: library/turtle turtle reset15641460
Ref: 46c315641460
Ref: library/turtle turtle clear15641963
Ref: 46c415641963
Ref: library/turtle turtle write15642233
Ref: 46c515642233
Node: タートルの状態15643063
Ref: library/turtle turtle-state15643235
Ref: 470815643235
Node: 可視性15643333
Ref: library/turtle visibility15643418
Ref: 470915643418
Ref: library/turtle turtle hideturtle15643458
Ref: 46c815643458
Ref: library/turtle turtle ht15643494
Ref: 46c915643494
Ref: library/turtle turtle showturtle15643822
Ref: 46c615643822
Ref: library/turtle turtle st15643858
Ref: 46c715643858
Ref: library/turtle turtle isvisible15643974
Ref: 46ca15643974
Node: 見た目15644304
Ref: library/turtle appearance15644389
Ref: 470a15644389
Ref: library/turtle turtle shape15644429
Ref: 46cb15644429
Ref: library/turtle turtle resizemode15645225
Ref: 46cc15645225
Ref: library/turtle turtle shapesize15646333
Ref: 46cd15646333
Ref: library/turtle turtle turtlesize15646426
Ref: 46ce15646426
Ref: library/turtle turtle shearfactor15647544
Ref: 46cf15647544
Ref: library/turtle turtle tilt15648210
Ref: 46d015648210
Ref: library/turtle turtle tiltangle15648684
Ref: b1215648684
Ref: library/turtle turtle shapetransform15649408
Ref: 46d115649408
Ref: library/turtle turtle get_shapepoly15650438
Ref: 46d215650438
Node: イベントを利用する15650810
Ref: library/turtle using-events15650998
Ref: 470b15650998
Ref: library/turtle turtle onrelease15652057
Ref: 46d415652057
Ref: library/turtle turtle ondrag15653213
Ref: 46d515653213
Node: 特別な Turtle のメソッド15654315
Ref: library/turtle special-turtle-methods15654497
Ref: 470c15654497
Ref: library/turtle turtle poly15654578
Ref: 52b15654578
Ref: library/turtle turtle begin_poly15654922
Ref: 46d615654922
Ref: library/turtle turtle end_poly15655074
Ref: 46d715655074
Ref: library/turtle turtle get_poly15655275
Ref: 46d815655275
Ref: library/turtle turtle clone15655696
Ref: 46d915655696
Ref: library/turtle turtle getturtle15655922
Ref: 46da15655922
Ref: library/turtle turtle getpen15655957
Ref: 46db15655957
Ref: library/turtle turtle getscreen15656260
Ref: 46dc15656260
Ref: library/turtle turtle setundobuffer15656641
Ref: 46dd15656641
Ref: library/turtle turtle undobufferentries15657211
Ref: 46de15657211
Node: Compound shapes15657392
Ref: library/turtle compound-shapes15657538
Ref: 470e15657538
Ref: library/turtle compoundshapes15657538
Ref: 470f15657538
Node: TurtleScreen/Screen のメソッドと対応する関数15658788
Ref: library/turtle methods-of-turtlescreen-screen-and-corresponding-functions15658992
Ref: 471215658992
Node: ウィンドウの制御15659496
Ref: library/turtle window-control15659652
Ref: 471315659652
Ref: library/turtle turtle bgcolor15659717
Ref: 46e015659717
Ref: library/turtle turtle bgpic15661063
Ref: 46e115661063
Ref: library/turtle turtle clearscreen15662102
Ref: 46e215662102
Ref: library/turtle turtle resetscreen15662730
Ref: 46e315662730
Ref: library/turtle turtle screensize15662871
Ref: 46e415662871
Ref: library/turtle turtle setworldcoordinates15664058
Ref: 46e515664058
Node: アニメーションの制御15665074
Ref: library/turtle animation-control15665281
Ref: 471415665281
Ref: library/turtle turtle no_animation15665356
Ref: 52c15665356
Ref: library/turtle turtle delay15665761
Ref: 46e615665761
Ref: library/turtle turtle tracer15666262
Ref: 46e715666262
Ref: library/turtle turtle update15667092
Ref: 46e815667092
Node: スクリーンイベントを利用する15667309
Ref: library/turtle using-screen-events15667510
Ref: 471515667510
Ref: library/turtle turtle listen15667605
Ref: 46e915667605
Ref: library/turtle turtle onkey15667887
Ref: 46ea15667887
Ref: library/turtle turtle onkeyrelease15667926
Ref: 46eb15667926
Ref: library/turtle turtle onkeypress15668695
Ref: 46ec15668695
Ref: library/turtle turtle onclick15669309
Ref: 46d315669309
Ref: library/turtle turtle onscreenclick15669362
Ref: 46ed15669362
Ref: library/turtle turtle ontimer15670774
Ref: 46ee15670774
Ref: library/turtle turtle mainloop15671263
Ref: 46ef15671263
Ref: library/turtle turtle done15671297
Ref: 46f015671297
Node: 入力メソッド15671622
Ref: library/turtle input-methods15671823
Ref: 471615671823
Ref: library/turtle turtle textinput15671878
Ref: 1e9015671878
Ref: library/turtle turtle numinput15672334
Ref: 1e9115672334
Node: 設定と特殊なメソッド15673253
Ref: library/turtle settings-and-special-methods15673486
Ref: 471715673486
Ref: library/turtle turtle mode15673561
Ref: 46f115673561
Ref: library/turtle turtle colormode15674827
Ref: 46f215674827
Ref: library/turtle turtle getcanvas15675566
Ref: 46f315675566
Ref: library/turtle turtle getshapes15675850
Ref: 46f415675850
Ref: library/turtle turtle register_shape15676068
Ref: 46f515676068
Ref: library/turtle turtle addshape15676124
Ref: 46f615676124
Ref: library/turtle turtle turtles15677786
Ref: 46f715677786
Ref: library/turtle turtle window_height15677975
Ref: 46f815677975
Ref: library/turtle turtle window_width15678128
Ref: 46f915678128
Node: Screen 独自のメソッド、TurtleScreen から継承したもの以外15678276
Ref: library/turtle methods-specific-to-screen-not-inherited-from-turtlescreen15678482
Ref: 471815678482
Ref: library/turtle screenspecific15678482
Ref: 471915678482
Ref: library/turtle turtle bye15678637
Ref: 46fa15678637
Ref: library/turtle turtle exitonclick15678759
Ref: 46fb15678759
Ref: library/turtle turtle save15679377
Ref: 1ba215679377
Ref: library/turtle turtle setup15679966
Ref: 46fc15679966
Ref: library/turtle turtle title15681487
Ref: 46fd15681487
Node: Public classes15681811
Ref: library/turtle public-classes15681971
Ref: 471a15681971
Ref: library/turtle turtle RawTurtle15682024
Ref: 471b15682024
Ref: library/turtle turtle RawPen15682065
Ref: 471c15682065
Ref: library/turtle turtle Turtle15682392
Ref: 471e15682392
Ref: library/turtle turtle TurtleScreen15682640
Ref: 470d15682640
Ref: library/turtle turtle Screen15682863
Ref: 469215682863
Ref: library/turtle turtle ScrolledCanvas15683000
Ref: 471d15683000
Ref: library/turtle turtle Shape15683365
Ref: 471015683365
Ref: library/turtle turtle Shape addcomponent15684231
Ref: 471115684231
Ref: library/turtle turtle Vec2D15684850
Ref: 470015684850
Node: 説明<2>15685504
Ref: library/turtle explanation15685626
Ref: 471f15685626
Ref: library/turtle turtle-explanation15685626
Ref: 469115685626
Node: ヘルプと設定15687044
Ref: library/turtle help-and-configuration15687179
Ref: 472015687179
Node: ヘルプの使い方15687355
Ref: library/turtle how-to-use-help15687476
Ref: 472115687476
Node: ドキュメント文字列の翻訳15690027
Ref: library/turtle translation-of-docstrings-into-different-languages15690196
Ref: 472215690196
Ref: library/turtle turtle write_docstringdict15690479
Ref: 472315690479
Node: Screen および Turtle の設定方法15691849
Ref: library/turtle how-to-configure-screen-and-turtles15691988
Ref: 472415691988
Node: turtledemo --- Demo scripts15695201
Ref: library/turtle module-turtledemo15695355
Ref: 10b15695355
Ref: library/turtle turtledemo-demo-scripts15695355
Ref: 472515695355
Node: python 2 6からの変更点15702041
Ref: library/turtle changes-since-python-2-615702205
Ref: 472615702205
Node: python 3 0からの変更点15703240
Ref: library/turtle changes-since-python-3-015703368
Ref: 472715703368
Node: 開発ツール15704478
Ref: library/development doc15704632
Ref: 472815704632
Ref: library/development development15704632
Ref: 472915704632
Ref: library/development development-tools15704632
Ref: 472a15704632
Ref: library/development translation-repo15704632
Ref: 472b15704632
Node: typing --- 型ヒントのサポート15706944
Ref: library/typing doc15707116
Ref: 472c15707116
Ref: library/typing typing-support-for-type-hints15707116
Ref: 472d15707116
Ref: library/typing module-typing15707206
Ref: 10d15707206
Ref: typing --- 型ヒントのサポート-Footnote-115710038
Ref: typing --- 型ヒントのサポート-Footnote-215710104
Ref: typing --- 型ヒントのサポート-Footnote-315710156
Ref: typing --- 型ヒントのサポート-Footnote-415710223
Ref: typing --- 型ヒントのサポート-Footnote-515710280
Node: Python 型システムの仕様15710325
Ref: library/typing relevant-peps15710458
Ref: 472e15710458
Ref: library/typing specification-for-the-python-type-system15710458
Ref: 472f15710458
Ref: Python 型システムの仕様-Footnote-115710699
Node: 型エイリアス15710759
Ref: library/typing id215710908
Ref: 473015710908
Ref: library/typing type-aliases15710908
Ref: 87515710908
Node: NewType15712647
Ref: library/typing distinct15712825
Ref: 473115712825
Ref: library/typing newtype15712825
Ref: 473215712825
Ref: NewType-Footnote-115716569
Node: 呼び出し可能オブジェクトのアノテーション15716611
Ref: library/typing annotating-callable-objects15716789
Ref: 473315716789
Ref: library/typing annotating-callables15716789
Ref: 28e315716789
Ref: 呼び出し可能オブジェクトのアノテーション-Footnote-115720361
Node: ジェネリクス15720403
Ref: library/typing generics15720607
Ref: 25de15720607
Ref: library/typing id315720607
Ref: 473515720607
Node: タプルのアノテーション15722262
Ref: library/typing annotating-tuples15722439
Ref: 28e415722439
Ref: library/typing id415722439
Ref: 473615722439
Node: クラスオブジェクトの型15725148
Ref: library/typing the-type-of-class-objects15725343
Ref: 473715725343
Ref: library/typing type-of-class-objects15725343
Ref: 473815725343
Node: Annotating generators and coroutines15727023
Ref: library/typing annotating-generators-and-coroutines15727227
Ref: 2bc715727227
Ref: library/typing id515727227
Ref: 473a15727227
Node: ユーザー定義のジェネリック型15729799
Ref: library/typing user-defined-generic-types15729977
Ref: 473b15729977
Ref: library/typing user-defined-generics15729977
Ref: 8e415729977
Ref: ユーザー定義のジェネリック型-Footnote-115736074
Node: Any 型15736116
Ref: library/typing the-any-type15736298
Ref: 473d15736298
Node: 名前的部分型 vs 構造的部分型15739247
Ref: library/typing nominal-vs-structural-subtyping15739414
Ref: 473e15739414
Ref: 名前的部分型 vs 構造的部分型-Footnote-115741381
Ref: 名前的部分型 vs 構造的部分型-Footnote-215741423
Ref: 名前的部分型 vs 構造的部分型-Footnote-315741465
Node: モジュールの内容<5>15741507
Ref: library/typing module-contents15741709
Ref: 473f15741709
Node: 特殊型付けプリミティブ15742094
Ref: library/typing special-typing-primitives15742218
Ref: 474015742218
Node: 特殊型15742410
Ref: library/typing special-types15742510
Ref: 474115742510
Ref: library/typing typing Any15742642
Ref: a9f15742642
Ref: library/typing typing AnyStr15743069
Ref: 7aa15743069
Ref: library/typing typing LiteralString15744895
Ref: 9cd15744895
Ref: library/typing typing Never15746148
Ref: a9b15746148
Ref: library/typing typing NoReturn15746176
Ref: 474315746176
Ref: library/typing typing Self15747408
Ref: 9ca15747408
Ref: library/typing typing TypeAlias15749370
Ref: bad15749370
Ref: 特殊型-Footnote-115751003
Ref: 特殊型-Footnote-215751045
Ref: 特殊型-Footnote-315751087
Ref: 特殊型-Footnote-415751137
Ref: 特殊型-Footnote-515751179
Node: 特殊形式15751221
Ref: library/typing special-forms15751369
Ref: 474415751369
Ref: library/typing typing Union15751614
Ref: 34915751614
Ref: library/typing typing Optional15753811
Ref: aa515753811
Ref: library/typing typing Concatenate15754894
Ref: ba815754894
Ref: library/typing typing Literal15757367
Ref: c3115757367
Ref: library/typing typing ClassVar15759688
Ref: 77415759688
Ref: library/typing typing Final15761124
Ref: 77515761124
Ref: library/typing typing Required15761910
Ref: 9c715761910
Ref: library/typing typing NotRequired15762183
Ref: 9c815762183
Ref: library/typing typing ReadOnly15762445
Ref: 69c15762445
Ref: library/typing typing Annotated15762977
Ref: d0d15762977
Ref: library/typing typing TypeForm15768738
Ref: 29a15768738
Ref: library/typing typing TypeIs15769751
Ref: 69d15769751
Ref: library/typing typing TypeGuard15773547
Ref: 69e15773547
Ref: library/typing typing Unpack15775971
Ref: 1bd015775971
Ref: 特殊形式-Footnote-115777681
Ref: 特殊形式-Footnote-215777723
Ref: 特殊形式-Footnote-315777765
Ref: 特殊形式-Footnote-415777807
Ref: 特殊形式-Footnote-515777849
Ref: 特殊形式-Footnote-615777891
Ref: 特殊形式-Footnote-715777933
Ref: 特殊形式-Footnote-815777975
Ref: 特殊形式-Footnote-915778017
Ref: 特殊形式-Footnote-1015778059
Ref: 特殊形式-Footnote-1115778102
Ref: 特殊形式-Footnote-1215778145
Node: Building generic types and type aliases15778188
Ref: library/typing building-generic-types-and-type-aliases15778351
Ref: 474615778351
Ref: library/typing typing Generic15778862
Ref: 1a1215778862
Ref: library/typing typevar15780125
Ref: 473c15780125
Ref: library/typing typing TypeVar15780125
Ref: 29f15780125
Ref: library/typing typing-constrained-typevar15783658
Ref: 474215783658
Ref: library/typing typing TypeVar __name__15784276
Ref: 474715784276
Ref: library/typing typing TypeVar __covariant__15784348
Ref: 474815784348
Ref: library/typing typing TypeVar __contravariant__15784456
Ref: 474915784456
Ref: library/typing typing TypeVar __infer_variance__15784582
Ref: 474a15784582
Ref: library/typing typing TypeVar __bound__15784751
Ref: 474b15784751
Ref: library/typing typing TypeVar evaluate_bound15785114
Ref: 474c15785114
Ref: library/typing typing TypeVar __constraints__15785638
Ref: 474f15785638
Ref: library/typing typing TypeVar evaluate_constraints15786043
Ref: 475015786043
Ref: library/typing typing TypeVar __default__15786585
Ref: 475115786585
Ref: library/typing typing TypeVar evaluate_default15786767
Ref: 475215786767
Ref: library/typing typing TypeVar has_default15787297
Ref: 475315787297
Ref: library/typing typevartuple15787964
Ref: 474515787964
Ref: library/typing typing TypeVarTuple15787964
Ref: 29e15787964
Ref: library/typing typing TypeVarTuple __name__15792324
Ref: 475415792324
Ref: library/typing typing TypeVarTuple __covariant__15792402
Ref: 475515792402
Ref: library/typing typing TypeVarTuple __contravariant__15792565
Ref: 475615792565
Ref: library/typing typing TypeVarTuple __infer_variance__15792736
Ref: 475715792736
Ref: library/typing typing TypeVarTuple __default__15792911
Ref: 475815792911
Ref: library/typing typing TypeVarTuple evaluate_default15793099
Ref: 475915793099
Ref: library/typing typing TypeVarTuple has_default15793629
Ref: 475a15793629
Ref: library/typing typing ParamSpec15794742
Ref: 2a015794742
Ref: library/typing typing ParamSpec args15797270
Ref: 475c15797270
Ref: library/typing typing ParamSpec kwargs15797296
Ref: 475d15797296
Ref: library/typing typing ParamSpec __name__15798060
Ref: 475e15798060
Ref: library/typing typing ParamSpec __covariant__15798142
Ref: 475f15798142
Ref: library/typing typing ParamSpec __contravariant__15798275
Ref: 476015798275
Ref: library/typing typing ParamSpec __infer_variance__15798416
Ref: 476115798416
Ref: library/typing typing ParamSpec __default__15798595
Ref: 476215798595
Ref: library/typing typing ParamSpec evaluate_default15798787
Ref: 476315798787
Ref: library/typing typing ParamSpec has_default15799317
Ref: 476415799317
Ref: library/typing typing ParamSpecArgs15800705
Ref: baa15800705
Ref: library/typing typing ParamSpecKwargs15800741
Ref: bab15800741
Ref: library/typing typing TypeAliasType15801461
Ref: 53115801461
Ref: library/typing typing TypeAliasType __name__15801779
Ref: 476515801779
Ref: library/typing typing TypeAliasType __qualname__15801942
Ref: 476615801942
Ref: library/typing typing TypeAliasType __module__15802237
Ref: 476715802237
Ref: library/typing typing TypeAliasType __type_params__15802552
Ref: 476815802552
Ref: library/typing typing TypeAliasType __value__15802923
Ref: 476915802923
Ref: library/typing typing TypeAliasType evaluate_value15803481
Ref: 476a15803481
Ref: Building generic types and type aliases-Footnote-115804984
Ref: Building generic types and type aliases-Footnote-215805026
Ref: Building generic types and type aliases-Footnote-315805068
Ref: Building generic types and type aliases-Footnote-415805110
Ref: Building generic types and type aliases-Footnote-515805152
Ref: Building generic types and type aliases-Footnote-615805194
Ref: Building generic types and type aliases-Footnote-715805236
Node: Other special directives15805278
Ref: library/typing other-special-directives15805420
Ref: 476b15805420
Ref: library/typing typing NamedTuple15805646
Ref: 2f015805646
Ref: library/typing typing NewType15808732
Ref: 10b515808732
Ref: library/typing typing NewType __module__15809181
Ref: 476c15809181
Ref: library/typing typing NewType __name__15809281
Ref: 476d15809281
Ref: library/typing typing NewType __supertype__15809348
Ref: 476e15809348
Ref: library/typing typing Protocol15809560
Ref: 77215809560
Ref: library/typing typing runtime_checkable15811393
Ref: 86715811393
Ref: library/typing typing TypedDict15814982
Ref: 29b15814982
Ref: library/typing typing TypedDict __total__15821118
Ref: 476f15821118
Ref: library/typing typing TypedDict __required_keys__15822182
Ref: 477015822182
Ref: library/typing typing TypedDict __optional_keys__15822254
Ref: 477115822254
Ref: library/typing typing TypedDict __readonly_keys__15823983
Ref: 477215823983
Ref: library/typing typing TypedDict __mutable_keys__15824225
Ref: 477315824225
Ref: library/typing typing TypedDict __closed__15824469
Ref: 477415824469
Ref: library/typing typing TypedDict __extra_items__15824620
Ref: 477515824620
Ref: Other special directives-Footnote-115825708
Ref: Other special directives-Footnote-215825750
Ref: Other special directives-Footnote-315825792
Ref: Other special directives-Footnote-415825866
Ref: Other special directives-Footnote-515825908
Ref: Other special directives-Footnote-615825950
Node: プロトコル<4>15825992
Ref: library/typing protocols15826164
Ref: 477715826164
Ref: library/typing typing SupportsAbs15826333
Ref: 477815826333
Ref: library/typing typing SupportsBytes15826461
Ref: 9e615826461
Ref: library/typing typing SupportsComplex15826566
Ref: 9e515826566
Ref: library/typing typing SupportsFloat15826675
Ref: 477915826675
Ref: library/typing typing SupportsIndex15826780
Ref: e0d15826780
Ref: library/typing typing SupportsInt15826913
Ref: e0c15826913
Ref: library/typing typing SupportsRound15827014
Ref: 477a15827014
Node: ABCs and Protocols for working with I/O15827146
Ref: library/typing abcs-and-protocols-for-working-with-i-o15827309
Ref: 477b15827309
Ref: library/typing typing-io15827309
Ref: 339915827309
Ref: library/typing typing IO15827410
Ref: 4cd15827410
Ref: library/typing typing TextIO15827444
Ref: 4ce15827444
Ref: library/typing typing BinaryIO15827473
Ref: 4cf15827473
Node: Functions and decorators15828318
Ref: library/typing functions-and-decorators15828484
Ref: 477c15828484
Ref: library/typing typing cast15828555
Ref: 475b15828555
Ref: library/typing typing assert_type15828954
Ref: a9e15828954
Ref: library/typing typing assert_never15830046
Ref: a9a15830046
Ref: library/typing typing reveal_type15831472
Ref: a9d15831472
Ref: library/typing typing dataclass_transform15832667
Ref: 8e915832667
Ref: library/typing overload15838712
Ref: 473415838712
Ref: library/typing typing overload15838712
Ref: 477d15838712
Ref: library/typing typing get_overloads15840261
Ref: aa115840261
Ref: library/typing typing clear_overloads15840937
Ref: aa215840937
Ref: library/typing typing final15841138
Ref: aa015841138
Ref: library/typing typing no_type_check15842440
Ref: aa615842440
Ref: library/typing typing override15842955
Ref: 86f15842955
Ref: library/typing typing disjoint_base15844300
Ref: 29d15844300
Ref: library/typing typing type_check_only15845516
Ref: 477e15845516
Ref: Functions and decorators-Footnote-115846366
Ref: Functions and decorators-Footnote-215846434
Ref: Functions and decorators-Footnote-315846476
Ref: Functions and decorators-Footnote-415846518
Ref: Functions and decorators-Footnote-515846560
Node: Introspection helpers15846602
Ref: library/typing introspection-helpers15846739
Ref: 477f15846739
Ref: library/typing typing get_type_hints15846804
Ref: aa315846804
Ref: library/typing typing get_origin15850238
Ref: 31c15850238
Ref: library/typing typing get_args15851094
Ref: 31d15851094
Ref: library/typing typing get_protocol_members15851732
Ref: 77115851732
Ref: library/typing typing is_protocol15852191
Ref: 77315852191
Ref: library/typing typing is_typeddict15852751
Ref: c3215852751
Ref: library/typing typing ForwardRef15853457
Ref: 1df215853457
Ref: library/typing typing evaluate_forward_ref15854353
Ref: 15215854353
Ref: library/typing typing NoDefault15855253
Ref: 77015855253
Ref: library/typing typing NoExtraItems15855610
Ref: 477615855610
Ref: Introspection helpers-Footnote-115856044
Ref: Introspection helpers-Footnote-215856086
Node: 定数<10>15856128
Ref: library/typing constant15856268
Ref: 478115856268
Ref: library/typing typing TYPE_CHECKING15856301
Ref: 10b415856301
Ref: library/typing generic-concrete-collections15857700
Ref: 478215857700
Ref: 定数<10>-Footnote-115857736
Node: 非推奨のエイリアス15857778
Ref: library/typing deprecated-aliases15857888
Ref: 478315857888
Ref: library/typing id615857888
Ref: 478415857888
Ref: 非推奨のエイリアス-Footnote-115859481
Node: Aliases to built-in types15859523
Ref: library/typing aliases-to-built-in-types15859652
Ref: 478515859652
Ref: library/typing corresponding-to-built-in-types15859652
Ref: 478615859652
Ref: library/typing typing Dict15859725
Ref: 478715859725
Ref: library/typing typing List15860274
Ref: 478815860274
Ref: library/typing typing Set15860846
Ref: 478915860846
Ref: library/typing typing FrozenSet15861394
Ref: 478a15861394
Ref: library/typing typing Tuple15861767
Ref: 478b15861767
Ref: library/typing typing Type15862254
Ref: 473915862254
Ref: Aliases to built-in types-Footnote-115862811
Ref: Aliases to built-in types-Footnote-215862853
Ref: Aliases to built-in types-Footnote-315862895
Ref: Aliases to built-in types-Footnote-415862937
Ref: Aliases to built-in types-Footnote-515862979
Ref: Aliases to built-in types-Footnote-615863021
Node: Aliases to types in collections15863063
Ref: library/typing aliases-to-types-in-collections15863232
Ref: 478c15863232
Ref: library/typing corresponding-to-types-in-collections15863232
Ref: 478d15863232
Ref: library/typing typing DefaultDict15863325
Ref: 478e15863325
Ref: library/typing typing OrderedDict15863786
Ref: 478f15863786
Ref: library/typing typing ChainMap15864245
Ref: 479015864245
Ref: library/typing typing Counter15864692
Ref: 479115864692
Ref: library/typing typing Deque15865114
Ref: 479215865114
Ref: Aliases to types in collections-Footnote-115865558
Ref: Aliases to types in collections-Footnote-215865600
Ref: Aliases to types in collections-Footnote-315865642
Ref: Aliases to types in collections-Footnote-415865684
Ref: Aliases to types in collections-Footnote-515865726
Node: Aliases to other concrete types15865768
Ref: library/typing aliases-to-other-concrete-types15865956
Ref: 479315865956
Ref: library/typing other-concrete-types15865956
Ref: 479415865956
Ref: library/typing typing Pattern15866041
Ref: b1815866041
Ref: library/typing typing Match15866071
Ref: 479515866071
Ref: library/typing typing Text15866679
Ref: 34815866679
Ref: library/typing abstract-base-classes15867490
Ref: 479615867490
Ref: Aliases to other concrete types-Footnote-115867526
Node: Aliases to container ABCs in collections abc15867568
Ref: library/typing aliases-to-container-abcs-in-collections-abc15867772
Ref: 479715867772
Ref: library/typing corresponding-to-collections-in-collections-abc15867772
Ref: 479815867772
Ref: library/typing typing AbstractSet15867891
Ref: 479915867891
Ref: library/typing typing ByteString15868273
Ref: 2ef15868273
Ref: library/typing typing Collection15869349
Ref: 10b315869349
Ref: library/typing typing Container15869794
Ref: 479a15869794
Ref: library/typing typing ItemsView15870183
Ref: 479b15870183
Ref: library/typing typing KeysView15870614
Ref: 479c15870614
Ref: library/typing typing Mapping15871018
Ref: 479d15871018
Ref: library/typing typing MappingView15871420
Ref: 479e15871420
Ref: library/typing typing MutableMapping15871807
Ref: 479f15871807
Ref: library/typing typing MutableSequence15872212
Ref: 47a015872212
Ref: library/typing typing MutableSet15872615
Ref: 47a115872615
Ref: library/typing typing Sequence15873009
Ref: 47a215873009
Ref: library/typing typing ValuesView15873417
Ref: 47a315873417
Ref: Aliases to container ABCs in collections abc-Footnote-115873864
Ref: Aliases to container ABCs in collections abc-Footnote-215873906
Ref: Aliases to container ABCs in collections abc-Footnote-315873964
Ref: Aliases to container ABCs in collections abc-Footnote-415874006
Ref: Aliases to container ABCs in collections abc-Footnote-515874048
Ref: Aliases to container ABCs in collections abc-Footnote-615874090
Ref: Aliases to container ABCs in collections abc-Footnote-715874132
Ref: Aliases to container ABCs in collections abc-Footnote-815874174
Ref: Aliases to container ABCs in collections abc-Footnote-915874216
Ref: Aliases to container ABCs in collections abc-Footnote-1015874258
Ref: Aliases to container ABCs in collections abc-Footnote-1115874301
Ref: Aliases to container ABCs in collections abc-Footnote-1215874344
Ref: Aliases to container ABCs in collections abc-Footnote-1315874387
Node: Aliases to asynchronous ABCs in collections abc15874430
Ref: library/typing aliases-to-asynchronous-abcs-in-collections-abc15874643
Ref: 47a415874643
Ref: library/typing asynchronous-programming15874643
Ref: 47a515874643
Ref: library/typing typing Coroutine15874768
Ref: 1f4415874768
Ref: library/typing typing AsyncGenerator15875425
Ref: 1bce15875425
Ref: library/typing typing AsyncIterable15876183
Ref: 47a615876183
Ref: library/typing typing AsyncIterator15876613
Ref: 47a715876613
Ref: library/typing typing Awaitable15877049
Ref: 47a815877049
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-115877504
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-215877546
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-315877588
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-415877630
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-515877672
Node: Aliases to other ABCs in collections abc15877714
Ref: library/typing aliases-to-other-abcs-in-collections-abc15877909
Ref: 47a915877909
Ref: library/typing corresponding-to-other-types-in-collections-abc15877909
Ref: 47aa15877909
Ref: library/typing typing Iterable15878020
Ref: 47ab15878020
Ref: library/typing typing Iterator15878406
Ref: 47ac15878406
Ref: library/typing typing Callable15878793
Ref: ba915878793
Ref: library/typing typing Generator15879565
Ref: 1bcd15879565
Ref: library/typing typing Hashable15880290
Ref: 90515880290
Ref: library/typing typing Reversible15880532
Ref: 47ad15880532
Ref: library/typing typing Sized15880925
Ref: 90615880925
Ref: Aliases to other ABCs in collections abc-Footnote-115881194
Ref: Aliases to other ABCs in collections abc-Footnote-215881236
Ref: Aliases to other ABCs in collections abc-Footnote-315881278
Ref: Aliases to other ABCs in collections abc-Footnote-415881320
Ref: Aliases to other ABCs in collections abc-Footnote-515881362
Ref: Aliases to other ABCs in collections abc-Footnote-615881404
Node: Aliases to contextlib ABCs15881446
Ref: library/typing aliases-to-contextlib-abcs15881585
Ref: 47ae15881585
Ref: library/typing context-manager-types15881585
Ref: 47af15881585
Ref: library/typing typing ContextManager15881668
Ref: 105215881668
Ref: library/typing typing AsyncContextManager15882509
Ref: 1bcb15882509
Ref: Aliases to contextlib ABCs-Footnote-115883411
Ref: Aliases to contextlib ABCs-Footnote-215883453
Node: メジャーな機能の非推奨時系列15883495
Ref: library/typing deprecation-timeline-of-major-features15883648
Ref: 47b015883648
Ref: メジャーな機能の非推奨時系列-Footnote-115886237
Ref: メジャーな機能の非推奨時系列-Footnote-215886279
Ref: メジャーな機能の非推奨時系列-Footnote-315886334
Ref: メジャーな機能の非推奨時系列-Footnote-415886389
Ref: メジャーな機能の非推奨時系列-Footnote-515886444
Ref: メジャーな機能の非推奨時系列-Footnote-615886486
Node: pydoc --- ドキュメント生成とオンラインヘルプシステム15886542
Ref: library/pydoc doc15886745
Ref: 47b115886745
Ref: library/pydoc module-pydoc15886745
Ref: bd15886745
Ref: library/pydoc pydoc-documentation-generator-and-online-help-system15886745
Ref: 47b215886745
Ref: library/pydoc translation-repo15886745
Ref: 47b315886745
Ref: pydoc --- ドキュメント生成とオンラインヘルプシステム-Footnote-115892831
Node: Python 開発モード15892896
Ref: library/devmode doc15893117
Ref: 47b415893117
Ref: library/devmode devmode15893117
Ref: 71315893117
Ref: library/devmode python-development-mode15893117
Ref: 47b515893117
Ref: library/devmode translation-repo15893117
Ref: 47b615893117
Node: Python 開発モードの影響15893737
Ref: library/devmode effects-of-the-python-development-mode15893858
Ref: 47b715893858
Node: ResourceWarning の例15897634
Ref: library/devmode resourcewarning-example15897797
Ref: 47b815897797
Node: Bad file descriptor error example15899735
Ref: library/devmode bad-file-descriptor-error-example15899858
Ref: 47b915899858
Ref: Bad file descriptor error example-Footnote-115901402
Node: doctest --- 対話型の Python の例をテストする15901467
Ref: library/doctest doc15901670
Ref: 47ba15901670
Ref: library/doctest doctest-test-interactive-python-examples15901670
Ref: 47bb15901670
Ref: library/doctest module-doctest15901670
Ref: 3d15901670
Ref: library/doctest translation-repo15901670
Ref: 47bc15901670
Ref: doctest --- 対話型の Python の例をテストする-Footnote-115906324
Node: 簡単な利用法 docstring 中の実行例をチェックする15906391
Ref: library/doctest doctest-simple-testmod15906637
Ref: 47bd15906637
Ref: library/doctest simple-usage-checking-examples-in-docstrings15906637
Ref: 47be15906637
Node: 簡単な利用法 テキストファイル中の実行例をチェックする15908487
Ref: library/doctest doctest-simple-testfile15908778
Ref: 47c115908778
Ref: library/doctest simple-usage-checking-examples-in-a-text-file15908778
Ref: 47c215908778
Node: コマンドラインでの使用<6>15911360
Ref: library/doctest command-line-usage15911609
Ref: 47c415911609
Ref: library/doctest doctest-cli15911609
Ref: 47bf15911609
Ref: library/doctest cmdoption-doctest-v15911823
Ref: 47c515911823
Ref: library/doctest cmdoption-doctest-verbose15911823
Ref: 47c615911823
Ref: library/doctest cmdoption-doctest-o15912571
Ref: 47c715912571
Ref: library/doctest cmdoption-doctest-option15912571
Ref: 47c815912571
Ref: library/doctest cmdoption-doctest-f15912755
Ref: 47c915912755
Ref: library/doctest cmdoption-doctest-fail-fast15912755
Ref: 47ca15912755
Node: doctest のからくり15912860
Ref: library/doctest doctest-how-it-works15913040
Ref: 47cb15913040
Ref: library/doctest how-it-works15913040
Ref: 47cc15913040
Node: どの docstring が検証されるのか?15914031
Ref: library/doctest doctest-which-docstrings15914204
Ref: 47cd15914204
Ref: library/doctest which-docstrings-are-examined15914204
Ref: 47ce15914204
Ref: library/doctest module __test__15914506
Ref: 47cf15914506
Node: docstring 内の実行例をどのように認識するのか?15916202
Ref: library/doctest doctest-finding-examples15916421
Ref: 47d015916421
Ref: library/doctest how-are-docstring-examples-recognized15916421
Ref: 47d115916421
Node: 実行コンテキストとは何か?15920389
Ref: library/doctest doctest-execution-context15920600
Ref: 47d515920600
Ref: library/doctest what-s-the-execution-context15920600
Ref: 47d615920600
Node: 例外はどう扱えばよいか?15921324
Ref: library/doctest doctest-exceptions15921497
Ref: 47d715921497
Ref: library/doctest what-about-exceptions15921497
Ref: 47d815921497
Ref: library/doctest option-flags-and-directives15927433
Ref: 47d915927433
Ref: 例外はどう扱えばよいか?-Footnote-115927470
Node: オプションフラグ15927745
Ref: library/doctest doctest-options15927913
Ref: 12e215927913
Ref: library/doctest option-flags15927913
Ref: 47da15927913
Ref: library/doctest doctest DONT_ACCEPT_TRUE_FOR_115928766
Ref: 47db15928766
Ref: library/doctest doctest DONT_ACCEPT_BLANKLINE15929707
Ref: 47dc15929707
Ref: library/doctest doctest NORMALIZE_WHITESPACE15930338
Ref: 47d215930338
Ref: library/doctest doctest ELLIPSIS15930948
Ref: 182615930948
Ref: library/doctest doctest IGNORE_EXCEPTION_DETAIL15931583
Ref: 16c215931583
Ref: library/doctest doctest SKIP15933120
Ref: 47dd15933120
Ref: library/doctest doctest COMPARISON_FLAGS15933793
Ref: 47de15933793
Ref: library/doctest doctest REPORT_UDIFF15934021
Ref: 182715934021
Ref: library/doctest doctest REPORT_CDIFF15934262
Ref: 182815934262
Ref: library/doctest doctest REPORT_NDIFF15934503
Ref: 182915934503
Ref: library/doctest doctest REPORT_ONLY_FIRST_FAILURE15935219
Ref: 47df15935219
Ref: library/doctest doctest FAIL_FAST15936092
Ref: 12e315936092
Ref: library/doctest doctest REPORTING_FLAGS15936505
Ref: 47e015936505
Ref: library/doctest doctest register_optionflag15936813
Ref: 47e115936813
Node: ディレクティブ Directives15937393
Ref: library/doctest directives15937536
Ref: 47e415937536
Ref: library/doctest doctest-directives15937536
Ref: 47d315937536
Ref: library/doctest grammar-token-doctest-directive15937872
Ref: 47e515937872
Ref: library/doctest grammar-token-doctest-directive_options15937946
Ref: 47e615937946
Ref: library/doctest grammar-token-doctest-directive_option15938041
Ref: 47e715938041
Ref: library/doctest grammar-token-doctest-on_or_off15938127
Ref: 47e815938127
Ref: library/doctest grammar-token-doctest-directive_option_name15938165
Ref: 47e915938165
Node: 警告<2>15940801
Ref: library/doctest doctest-warnings15940911
Ref: 47ea15940911
Ref: library/doctest warnings15940911
Ref: 47eb15940911
Node: 基本 API15942929
Ref: library/doctest basic-api15943092
Ref: 47ec15943092
Ref: library/doctest doctest-basic-api15943092
Ref: 47c015943092
Ref: library/doctest doctest testfile15943611
Ref: 47c315943611
Ref: library/doctest doctest testmod15949291
Ref: 182515949291
Ref: library/doctest doctest run_docstring_examples15951552
Ref: 47ee15951552
Node: 単体テスト API15952849
Ref: library/doctest doctest-unittest-api15952999
Ref: 47ef15952999
Ref: library/doctest unittest-api15952999
Ref: 47f015952999
Ref: library/doctest doctest DocFileSuite15953821
Ref: 1a3415953821
Ref: library/doctest doctest DocTestSuite15959105
Ref: 11b015959105
Ref: library/doctest doctest set_unittest_reportflags15962979
Ref: 47f315962979
Node: 拡張 API15964240
Ref: library/doctest advanced-api15964392
Ref: 47f415964392
Ref: library/doctest doctest-advanced-api15964392
Ref: 47f515964392
Node: DocTest オブジェクト15966961
Ref: library/doctest doctest-doctest15967069
Ref: 47f715967069
Ref: library/doctest doctest-objects15967069
Ref: 47f815967069
Ref: library/doctest doctest DocTest15967138
Ref: 1c5015967138
Ref: library/doctest doctest DocTest examples15967653
Ref: 47f915967653
Ref: library/doctest doctest DocTest globs15967898
Ref: 47f215967898
Ref: library/doctest doctest DocTest name15968342
Ref: 47fa15968342
Ref: library/doctest doctest DocTest filename15968562
Ref: 47fb15968562
Ref: library/doctest doctest DocTest lineno15968785
Ref: 1a2715968785
Ref: library/doctest doctest DocTest docstring15969083
Ref: 47fc15969083
Node: Example オブジェクト15969373
Ref: library/doctest doctest-example15969522
Ref: 47fd15969522
Ref: library/doctest example-objects15969522
Ref: 47fe15969522
Ref: library/doctest doctest Example15969591
Ref: 47f615969591
Ref: library/doctest doctest Example source15970163
Ref: 47ff15970163
Ref: library/doctest doctest Example want15970427
Ref: 480015970427
Ref: library/doctest doctest Example exc_msg15970919
Ref: 480115970919
Ref: library/doctest doctest Example lineno15971460
Ref: 480215971460
Ref: library/doctest doctest Example indent15971655
Ref: 480315971655
Ref: library/doctest doctest Example options15971856
Ref: 480415971856
Node: DocTestFinder オブジェクト15972267
Ref: library/doctest doctest-doctestfinder15972422
Ref: 480515972422
Ref: library/doctest doctestfinder-objects15972422
Ref: 480615972422
Ref: library/doctest doctest DocTestFinder15972503
Ref: 1bd215972503
Ref: library/doctest doctest DocTestFinder find15974008
Ref: 1c9415974008
Node: DocTestParser オブジェクト15976797
Ref: library/doctest doctest-doctestparser15976945
Ref: 480715976945
Ref: library/doctest doctestparser-objects15976945
Ref: 480815976945
Ref: library/doctest doctest DocTestParser15977026
Ref: 47d415977026
Ref: library/doctest doctest DocTestParser get_doctest15977337
Ref: 480915977337
Ref: library/doctest doctest DocTestParser get_examples15977760
Ref: 480a15977760
Ref: library/doctest doctest DocTestParser parse15978205
Ref: 480b15978205
Node: TestResults objects15978599
Ref: library/doctest testresults-objects15978747
Ref: 480c15978747
Ref: library/doctest doctest TestResults15978808
Ref: 480d15978808
Ref: library/doctest doctest TestResults failed15978864
Ref: 480e15978864
Ref: library/doctest doctest TestResults attempted15978927
Ref: 480f15978927
Ref: library/doctest doctest TestResults skipped15978996
Ref: 6fb15978996
Node: DocTestRunner オブジェクト15979095
Ref: library/doctest doctest-doctestrunner15979243
Ref: 481015979243
Ref: library/doctest doctestrunner-objects15979243
Ref: 481115979243
Ref: library/doctest doctest DocTestRunner15979324
Ref: 47e315979324
Ref: library/doctest doctest DocTestRunner report_skip15982186
Ref: 1a3515982186
Ref: library/doctest doctest DocTestRunner report_start15982682
Ref: 481215982682
Ref: library/doctest doctest DocTestRunner report_success15983267
Ref: 481315983267
Ref: library/doctest doctest DocTestRunner report_failure15983944
Ref: 481515983944
Ref: library/doctest doctest DocTestRunner report_unexpected_exception15984630
Ref: 481415984630
Ref: library/doctest doctest DocTestRunner run15985453
Ref: 6f915985453
Ref: library/doctest doctest DocTestRunner summarize15986650
Ref: 47ed15986650
Ref: library/doctest doctest DocTestRunner tries15987173
Ref: 481615987173
Ref: library/doctest doctest DocTestRunner failures15987241
Ref: 481715987241
Ref: library/doctest doctest DocTestRunner skips15987309
Ref: 6fa15987309
Node: OutputChecker オブジェクト15987409
Ref: library/doctest doctest-outputchecker15987529
Ref: 481815987529
Ref: library/doctest outputchecker-objects15987529
Ref: 481915987529
Ref: library/doctest doctest OutputChecker15987610
Ref: 47e215987610
Ref: library/doctest doctest OutputChecker check_output15988237
Ref: 481a15988237
Ref: library/doctest doctest OutputChecker output_difference15988920
Ref: 481b15988920
Node: デバッグ15989311
Ref: library/doctest debugging15989459
Ref: 481c15989459
Ref: library/doctest doctest-debugging15989459
Ref: 481d15989459
Ref: library/doctest doctest script_from_examples15991980
Ref: 482015991980
Ref: library/doctest doctest testsource15993063
Ref: 482115993063
Ref: library/doctest doctest debug15993886
Ref: 481f15993886
Ref: library/doctest doctest debug_src15995222
Ref: 482315995222
Ref: library/doctest doctest DebugRunner15996337
Ref: 481e15996337
Ref: library/doctest doctest DocTestFailure15997348
Ref: 482515997348
Ref: library/doctest doctest DocTestFailure test15997779
Ref: 482615997779
Ref: library/doctest doctest DocTestFailure example15997928
Ref: 482715997928
Ref: library/doctest doctest DocTestFailure got15998035
Ref: 482815998035
Ref: library/doctest doctest UnexpectedException15998113
Ref: 482415998113
Ref: library/doctest doctest UnexpectedException test15998534
Ref: 482915998534
Ref: library/doctest doctest UnexpectedException example15998688
Ref: 482a15998688
Ref: library/doctest doctest UnexpectedException exc_info15998800
Ref: 482b15998800
Node: アドバイス15998990
Ref: library/doctest doctest-soapbox15999119
Ref: 482c15999119
Ref: library/doctest soapbox15999119
Ref: 482d15999119
Node: unittest --- ユニットテストフレームワーク16003926
Ref: library/unittest doc16004167
Ref: 482e16004167
Ref: library/unittest module-unittest16004167
Ref: 10f16004167
Ref: library/unittest translation-repo16004167
Ref: 482f16004167
Ref: library/unittest unittest-unit-testing-framework16004167
Ref: 483016004167
Ref: unittest --- ユニットテストフレームワーク-Footnote-116008197
Ref: unittest --- ユニットテストフレームワーク-Footnote-216008275
Ref: unittest --- ユニットテストフレームワーク-Footnote-316008368
Ref: unittest --- ユニットテストフレームワーク-Footnote-416008401
Ref: unittest --- ユニットテストフレームワーク-Footnote-516008465
Ref: unittest --- ユニットテストフレームワーク-Footnote-616008523
Ref: unittest --- ユニットテストフレームワーク-Footnote-716008553
Ref: unittest --- ユニットテストフレームワーク-Footnote-816008585
Ref: unittest --- ユニットテストフレームワーク-Footnote-916008629
Node: 基本的な例<2>16008663
Ref: library/unittest basic-example16008830
Ref: 483216008830
Ref: library/unittest unittest-minimal-example16008830
Ref: 483316008830
Node: コマンドラインインターフェイス<2>16012146
Ref: library/unittest command-line-interface16012349
Ref: 483516012349
Ref: library/unittest unittest-command-line-interface16012349
Ref: 12e416012349
Node: コマンドラインオプション<5>16014478
Ref: library/unittest command-line-options16014602
Ref: 483716014602
Ref: library/unittest cmdoption-unittest-b16014767
Ref: 16eb16014767
Ref: library/unittest cmdoption-unittest-buffer16014767
Ref: 483816014767
Ref: library/unittest cmdoption-unittest-c16015118
Ref: 16ec16015118
Ref: library/unittest cmdoption-unittest-catch16015118
Ref: 483916015118
Ref: library/unittest cmdoption-unittest-f16015531
Ref: 16ee16015531
Ref: library/unittest cmdoption-unittest-failfast16015531
Ref: 483b16015531
Ref: library/unittest cmdoption-unittest-k16015641
Ref: 483c16015641
Ref: library/unittest cmdoption-unittest-locals16016593
Ref: 483d16016593
Ref: library/unittest cmdoption-unittest-durations16016682
Ref: 483e16016682
Node: テストディスカバリ16017313
Ref: library/unittest test-discovery16017525
Ref: 483f16017525
Ref: library/unittest unittest-test-discovery16017525
Ref: 483616017525
Ref: library/unittest cmdoption-unittest-discover-v16018716
Ref: 484016018716
Ref: library/unittest cmdoption-unittest-discover-verbose16018716
Ref: 484116018716
Ref: library/unittest cmdoption-unittest-discover-s16018765
Ref: 484216018765
Ref: library/unittest cmdoption-unittest-discover-start-directory16018765
Ref: 484316018765
Ref: library/unittest cmdoption-unittest-discover-p16018897
Ref: 484416018897
Ref: library/unittest cmdoption-unittest-discover-pattern16018897
Ref: 484516018897
Ref: library/unittest cmdoption-unittest-discover-t16019026
Ref: 484616019026
Ref: library/unittest cmdoption-unittest-discover-top-level-directory16019026
Ref: 484716019026
Node: テストコードの構成16021802
Ref: library/unittest organizing-test-code16022002
Ref: 484916022002
Ref: library/unittest organizing-tests16022002
Ref: 483416022002
Node: 既存テストコードの再利用16027587
Ref: library/unittest legacy-unit-tests16027808
Ref: 484a16027808
Ref: library/unittest re-using-old-test-code16027808
Ref: 484b16027808
Node: テストのスキップと予期された失敗16029481
Ref: library/unittest skipping-tests-and-expected-failures16029747
Ref: 484c16029747
Ref: library/unittest unittest-skipping16029747
Ref: 484d16029747
Ref: library/unittest unittest skip16033400
Ref: 1fcd16033400
Ref: library/unittest unittest skipIf16033594
Ref: 485016033594
Ref: library/unittest unittest skipUnless16033741
Ref: 485116033741
Ref: library/unittest unittest expectedFailure16033892
Ref: 484f16033892
Ref: library/unittest unittest SkipTest16034296
Ref: 139216034296
Node: サブテストを利用して繰り返しテストの区別を付ける16035011
Ref: library/unittest distinguishing-test-iterations-using-subtests16035259
Ref: 485216035259
Ref: library/unittest subtests16035259
Ref: 139016035259
Node: クラスと関数16037967
Ref: library/unittest classes-and-functions16038215
Ref: 485316038215
Ref: library/unittest unittest-contents16038215
Ref: 485416038215
Node: テストクラス16038426
Ref: library/unittest test-cases16038535
Ref: 485516038535
Ref: library/unittest testcase-objects16038535
Ref: 485616038535
Ref: library/unittest unittest TestCase16038588
Ref: 53616038588
Ref: library/unittest unittest TestCase setUp16040237
Ref: 16f316040237
Ref: library/unittest unittest TestCase tearDown16040694
Ref: 16f416040694
Ref: library/unittest unittest TestCase setUpClass16041604
Ref: e1616041604
Ref: library/unittest unittest TestCase tearDownClass16042180
Ref: 16f116042180
Ref: library/unittest unittest TestCase run16042776
Ref: 152416042776
Ref: library/unittest unittest TestCase skipTest16043702
Ref: 484e16043702
Ref: library/unittest unittest TestCase subTest16044039
Ref: 138f16044039
Ref: library/unittest unittest TestCase debug16044784
Ref: 1e5f16044784
Ref: library/unittest assert-methods16045022
Ref: 483116045022
Ref: library/unittest unittest TestCase assertEqual16049615
Ref: 93c16049615
Ref: library/unittest unittest TestCase assertNotEqual16050658
Ref: 93d16050658
Ref: library/unittest unittest TestCase assertTrue16050869
Ref: 93a16050869
Ref: library/unittest unittest TestCase assertFalse16050920
Ref: 93b16050920
Ref: library/unittest unittest TestCase assertIs16051674
Ref: 16f516051674
Ref: library/unittest unittest TestCase assertIsNot16051732
Ref: 16f616051732
Ref: library/unittest unittest TestCase assertIsNone16051971
Ref: 164416051971
Ref: library/unittest unittest TestCase assertIsNotNone16052024
Ref: 164516052024
Ref: library/unittest unittest TestCase assertIn16052235
Ref: 16fe16052235
Ref: library/unittest unittest TestCase assertNotIn16052297
Ref: 16ff16052297
Ref: library/unittest unittest TestCase assertIsInstance16052522
Ref: 16f716052522
Ref: library/unittest unittest TestCase assertNotIsInstance16052583
Ref: 16f816052583
Ref: library/unittest unittest TestCase assertIsSubclass16053116
Ref: 53916053116
Ref: library/unittest unittest TestCase assertNotIsSubclass16053184
Ref: 53a16053184
Ref: library/unittest unittest TestCase assertRaises16056561
Ref: 94016056561
Ref: library/unittest unittest TestCase assertRaisesRegex16058787
Ref: 94216058787
Ref: library/unittest unittest TestCase assertWarns16059989
Ref: 2ab16059989
Ref: library/unittest unittest TestCase assertWarnsRegex16062614
Ref: 2ac16062614
Ref: library/unittest unittest TestCase assertLogs16064160
Ref: 2aa16064160
Ref: library/unittest unittest TestCase records16065781
Ref: 485a16065781
Ref: library/unittest unittest TestCase output16065954
Ref: 485b16065954
Ref: library/unittest unittest TestCase assertNoLogs16066676
Ref: c3416066676
Ref: library/unittest unittest TestCase assertAlmostEqual16072011
Ref: 93e16072011
Ref: library/unittest unittest TestCase assertNotAlmostEqual16072115
Ref: 93f16072115
Ref: library/unittest unittest TestCase assertGreater16073427
Ref: 16f916073427
Ref: library/unittest unittest TestCase assertGreaterEqual16073490
Ref: 16fa16073490
Ref: library/unittest unittest TestCase assertLess16073558
Ref: 16fb16073558
Ref: library/unittest unittest TestCase assertLessEqual16073618
Ref: 16fc16073618
Ref: library/unittest unittest TestCase assertRegex16074062
Ref: 94116074062
Ref: library/unittest unittest TestCase assertNotRegex16074121
Ref: 94316074121
Ref: library/unittest unittest TestCase assertCountEqual16075064
Ref: 15e616075064
Ref: library/unittest unittest TestCase assertStartsWith16075926
Ref: 53b16075926
Ref: library/unittest unittest TestCase assertNotStartsWith16075989
Ref: 53c16075989
Ref: library/unittest unittest TestCase assertEndsWith16076254
Ref: 53d16076254
Ref: library/unittest unittest TestCase assertNotEndsWith16076315
Ref: 53e16076315
Ref: library/unittest unittest TestCase assertHasAttr16076574
Ref: 53716076574
Ref: library/unittest unittest TestCase assertNotHasAttr16076634
Ref: 53816076634
Ref: library/unittest type-specific-methods16076817
Ref: 485916076817
Ref: library/unittest unittest TestCase addTypeEqualityFunc16077256
Ref: 170216077256
Ref: library/unittest unittest TestCase assertMultiLineEqual16080383
Ref: 16fd16080383
Ref: library/unittest unittest TestCase assertSequenceEqual16080893
Ref: 164316080893
Ref: library/unittest unittest TestCase assertListEqual16081622
Ref: 164116081622
Ref: library/unittest unittest TestCase assertTupleEqual16081687
Ref: 164216081687
Ref: library/unittest unittest TestCase assertSetEqual16082233
Ref: 163f16082233
Ref: library/unittest unittest TestCase assertDictEqual16082801
Ref: 164016082801
Ref: library/unittest other-methods-and-attrs16083206
Ref: 485d16083206
Ref: library/unittest unittest TestCase fail16083299
Ref: 485e16083299
Ref: library/unittest unittest TestCase failureException16083493
Ref: 485c16083493
Ref: library/unittest unittest TestCase longMessage16083895
Ref: 16ef16083895
Ref: library/unittest unittest TestCase maxDiff16084863
Ref: 15e716084863
Ref: library/unittest unittest TestCase countTestCases16085646
Ref: 485f16085646
Ref: library/unittest unittest TestCase defaultTestResult16085861
Ref: 485816085861
Ref: library/unittest unittest TestCase id16086434
Ref: 486016086434
Ref: library/unittest unittest TestCase shortDescription16086669
Ref: 486116086669
Ref: library/unittest unittest TestCase addCleanup16087371
Ref: e4716087371
Ref: library/unittest unittest TestCase enterContext16088120
Ref: aab16088120
Ref: library/unittest unittest TestCase doCleanups16088455
Ref: 16f216088455
Ref: library/unittest unittest TestCase addClassCleanup16089253
Ref: e1416089253
Ref: library/unittest unittest TestCase enterClassContext16090053
Ref: aac16090053
Ref: library/unittest unittest TestCase doClassCleanups16090410
Ref: 486216090410
Ref: library/unittest unittest IsolatedAsyncioTestCase16091259
Ref: 34a16091259
Ref: library/unittest unittest IsolatedAsyncioTestCase loop_factory16091499
Ref: 486316091499
Ref: library/unittest unittest IsolatedAsyncioTestCase asyncSetUp16091755
Ref: 486416091755
Ref: library/unittest unittest IsolatedAsyncioTestCase asyncTearDown16092357
Ref: 486516092357
Ref: library/unittest unittest IsolatedAsyncioTestCase addAsyncCleanup16093365
Ref: 486616093365
Ref: library/unittest unittest IsolatedAsyncioTestCase enterAsyncContext16093570
Ref: aad16093570
Ref: library/unittest unittest IsolatedAsyncioTestCase run16093937
Ref: 486716093937
Ref: library/unittest unittest FunctionTestCase16095899
Ref: 1c9e16095899
Node: テストのグループ化16096375
Ref: library/unittest grouping-tests16096523
Ref: 486816096523
Ref: library/unittest testsuite-objects16096523
Ref: 486916096523
Ref: library/unittest unittest TestSuite16096591
Ref: 11b116096591
Ref: library/unittest unittest TestSuite addTest16097882
Ref: 486a16097882
Ref: library/unittest unittest TestSuite addTests16098052
Ref: 486b16098052
Ref: library/unittest unittest TestSuite run16098564
Ref: 486c16098564
Ref: library/unittest unittest TestSuite debug16098915
Ref: 486d16098915
Ref: library/unittest unittest TestSuite countTestCases16099261
Ref: 486e16099261
Ref: library/unittest unittest TestSuite __iter__16099494
Ref: 13d516099494
Node: テストのロードと起動16101434
Ref: library/unittest loading-and-running-tests16101555
Ref: 486f16101555
Ref: library/unittest unittest TestLoader16101628
Ref: 79816101628
Ref: library/unittest unittest TestLoader errors16102131
Ref: 124016102131
Ref: library/unittest unittest TestLoader loadTestsFromTestCase16102735
Ref: 79a16102735
Ref: library/unittest unittest TestLoader loadTestsFromModule16103437
Ref: 79916103437
Ref: library/unittest unittest TestLoader loadTestsFromName16105208
Ref: 170016105208
Ref: library/unittest unittest TestLoader loadTestsFromNames16107313
Ref: 487116107313
Ref: library/unittest unittest TestLoader getTestCaseNames16107701
Ref: 79b16107701
Ref: library/unittest unittest TestLoader discover16107988
Ref: 139316107988
Ref: library/unittest unittest TestLoader testMethodPrefix16112288
Ref: 487216112288
Ref: library/unittest unittest TestLoader sortTestMethodsUsing16112628
Ref: 487316112628
Ref: library/unittest unittest TestLoader suiteClass16112845
Ref: 170116112845
Ref: library/unittest unittest TestLoader testNamePatterns16113208
Ref: 487416113208
Ref: library/unittest unittest TestResult16114257
Ref: 152516114257
Ref: library/unittest unittest TestResult errors16115194
Ref: 487516115194
Ref: library/unittest unittest TestResult failures16115487
Ref: 487616115487
Ref: library/unittest unittest TestResult skipped16115835
Ref: 487716115835
Ref: library/unittest unittest TestResult expectedFailures16116071
Ref: 487816116071
Ref: library/unittest unittest TestResult unexpectedSuccesses16116377
Ref: 487916116377
Ref: library/unittest unittest TestResult collectedDurations16116567
Ref: 1ca116116567
Ref: library/unittest unittest TestResult shouldStop16116777
Ref: 487a16116777
Ref: library/unittest unittest TestResult testsRun16116933
Ref: 487c16116933
Ref: library/unittest unittest TestResult buffer16117029
Ref: 487d16117029
Ref: library/unittest unittest TestResult failfast16117601
Ref: 488016117601
Ref: library/unittest unittest TestResult tb_locals16117825
Ref: 488116117825
Ref: library/unittest unittest TestResult wasSuccessful16117976
Ref: 488216117976
Ref: library/unittest unittest TestResult stop16118400
Ref: 487b16118400
Ref: library/unittest unittest TestResult startTest16119541
Ref: 487e16119541
Ref: library/unittest unittest TestResult stopTest16119649
Ref: 487f16119649
Ref: library/unittest unittest TestResult startTestRun16119783
Ref: 170316119783
Ref: library/unittest unittest TestResult stopTestRun16119943
Ref: 170416119943
Ref: library/unittest unittest TestResult addError16120102
Ref: 1e6216120102
Ref: library/unittest unittest TestResult addFailure16120676
Ref: 1e6116120676
Ref: library/unittest unittest TestResult addSuccess16121229
Ref: 488316121229
Ref: library/unittest unittest TestResult addSkip16121420
Ref: 1e6316121420
Ref: library/unittest unittest TestResult addExpectedFailure16121786
Ref: 488416121786
Ref: library/unittest unittest TestResult addUnexpectedSuccess16122291
Ref: 488516122291
Ref: library/unittest unittest TestResult addSubTest16122634
Ref: 1e6416122634
Ref: library/unittest unittest TestResult addDuration16123419
Ref: 1cd916123419
Ref: library/unittest unittest TextTestResult16123671
Ref: 94416123671
Ref: library/unittest unittest defaultTestLoader16124107
Ref: 487016124107
Ref: library/unittest unittest TextTestRunner16124427
Ref: 1cd816124427
Ref: library/unittest unittest TextTestRunner _makeResult16126186
Ref: 488716126186
Ref: library/unittest unittest TextTestRunner run16127072
Ref: 488816127072
Ref: library/unittest unittest main16127560
Ref: 139116127560
Node: load_tests プロトコル16131059
Ref: library/unittest id116131152
Ref: 484816131152
Ref: library/unittest load-tests-protocol16131152
Ref: 47f116131152
Node: クラスとモジュールのフィクスチャ16134469
Ref: library/unittest class-and-module-fixtures16134675
Ref: 485716134675
Node: setUpClass と tearDownClass16137145
Ref: library/unittest setupclass-and-teardownclass16137297
Ref: 488916137297
Node: setUpModule と tearDownModule16138336
Ref: library/unittest setupmodule-and-teardownmodule16138488
Ref: 488a16138488
Ref: library/unittest unittest setUpModule16138570
Ref: e1516138570
Ref: library/unittest unittest addModuleCleanup16139223
Ref: e1316139223
Ref: library/unittest unittest enterModuleContext16139957
Ref: aae16139957
Ref: library/unittest unittest doModuleCleanups16140280
Ref: 1a5116140280
Node: シグナルハンドリング16141070
Ref: library/unittest signal-handling16141249
Ref: 483a16141249
Ref: library/unittest unittest installHandler16142858
Ref: 488b16142858
Ref: library/unittest unittest registerResult16143165
Ref: 488c16143165
Ref: library/unittest unittest removeResult16143766
Ref: 488d16143766
Ref: library/unittest unittest removeHandler16144043
Ref: 16ed16144043
Node: unittest mock --- モックオブジェクトライブラリ16144551
Ref: library/unittest mock doc16144760
Ref: 488e16144760
Ref: library/unittest mock module-unittest mock16144760
Ref: 11016144760
Ref: library/unittest mock translation-repo16144760
Ref: 488f16144760
Ref: library/unittest mock unittest-mock-mock-object-library16144760
Ref: 489016144760
Ref: unittest mock --- モックオブジェクトライブラリ-Footnote-116146608
Ref: unittest mock --- モックオブジェクトライブラリ-Footnote-216146681
Node: クイックガイド16146720
Ref: library/unittest mock quick-guide16146861
Ref: 489116146861
Node: Mock クラス16153135
Ref: library/unittest mock the-mock-class16153292
Ref: 489616153292
Ref: library/unittest mock unittest mock Mock16154579
Ref: e1216154579
Ref: library/unittest mock unittest mock Mock assert_called16158936
Ref: 10b816158936
Ref: library/unittest mock unittest mock Mock assert_called_once16159275
Ref: 10b916159275
Ref: library/unittest mock unittest mock Mock assert_called_with16159949
Ref: 201116159949
Ref: library/unittest mock unittest mock Mock assert_called_once_with16160339
Ref: 489c16160339
Ref: library/unittest mock unittest mock Mock assert_any_call16161058
Ref: 489d16161058
Ref: library/unittest mock unittest mock Mock assert_has_calls16161745
Ref: 1c4916161745
Ref: library/unittest mock unittest mock Mock assert_not_called16162835
Ref: 124216162835
Ref: library/unittest mock unittest mock Mock reset_mock16163352
Ref: 10ba16163352
Ref: library/unittest mock unittest mock Mock mock_add_spec16164998
Ref: 489f16164998
Ref: library/unittest mock unittest mock Mock attach_mock16165408
Ref: 1b8816165408
Ref: library/unittest mock unittest mock Mock configure_mock16165706
Ref: 489b16165706
Ref: library/unittest mock unittest mock Mock __dir__16166994
Ref: 48a116166994
Ref: library/unittest mock unittest mock Mock _get_child_mock16167441
Ref: 48a316167441
Ref: library/unittest mock unittest mock Mock called16168000
Ref: 48a416168000
Ref: library/unittest mock unittest mock Mock call_count16168284
Ref: 19c716168284
Ref: library/unittest mock unittest mock Mock return_value16168611
Ref: 489a16168611
Ref: library/unittest mock unittest mock Mock side_effect16169456
Ref: 489216169456
Ref: library/unittest mock unittest mock Mock call_args16172120
Ref: 1f7c16172120
Ref: library/unittest mock unittest mock Mock call_args_list16174088
Ref: 48a516174088
Ref: library/unittest mock unittest mock Mock method_calls16175339
Ref: 48a016175339
Ref: library/unittest mock unittest mock Mock mock_calls16176166
Ref: 489e16176166
Ref: library/unittest mock unittest mock Mock __class__16177870
Ref: 48a716177870
Ref: library/unittest mock unittest mock NonCallableMock16178707
Ref: 489716178707
Ref: library/unittest mock unittest mock PropertyMock16181584
Ref: 48a816181584
Ref: library/unittest mock unittest mock AsyncMock16183688
Ref: e1116183688
Ref: library/unittest mock unittest mock AsyncMock assert_awaited16186500
Ref: 48a916186500
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_once16187241
Ref: 48aa16187241
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_with16187805
Ref: 48ab16187805
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_once_with16188481
Ref: 48ac16188481
Ref: library/unittest mock unittest mock AsyncMock assert_any_await16189212
Ref: 48ad16189212
Ref: library/unittest mock unittest mock AsyncMock assert_has_awaits16189861
Ref: 48ae16189861
Ref: library/unittest mock unittest mock AsyncMock assert_not_awaited16190962
Ref: 48af16190962
Ref: library/unittest mock unittest mock AsyncMock reset_mock16191143
Ref: 48b016191143
Ref: library/unittest mock unittest mock AsyncMock await_count16191381
Ref: 48b116191381
Ref: library/unittest mock unittest mock AsyncMock await_args16191827
Ref: 48b216191827
Ref: library/unittest mock unittest mock AsyncMock await_args_list16192446
Ref: 1f7b16192446
Ref: library/unittest mock unittest mock ThreadingMock16193158
Ref: 48b316193158
Ref: library/unittest mock unittest mock ThreadingMock wait_until_called16193863
Ref: 48b516193863
Ref: library/unittest mock unittest mock ThreadingMock wait_until_any_call_with16194422
Ref: 48b616194422
Ref: library/unittest mock unittest mock ThreadingMock DEFAULT_TIMEOUT16195027
Ref: 48b416195027
Ref: Mock クラス-Footnote-116195353
Node: 呼び出し16195884
Ref: library/unittest mock calling16195971
Ref: 48b716195971
Node: 属性の削除16199531
Ref: library/unittest mock deleting-attributes16199656
Ref: 48b816199656
Ref: library/unittest mock id216199656
Ref: 48b916199656
Node: Mock の名前と name 属性16200483
Ref: library/unittest mock mock-names-and-the-name-attribute16200635
Ref: 48ba16200635
Node: 属性として設定されるモック16201312
Ref: library/unittest mock attaching-mocks-as-attributes16201440
Ref: 48bb16201440
Node: patcher16203447
Ref: library/unittest mock the-patchers16203625
Ref: 48bc16203625
Node: patch16204378
Ref: library/unittest mock patch16204448
Ref: 48bd16204448
Ref: library/unittest mock unittest mock patch16204648
Ref: 124616204648
Node: patch object16214534
Ref: library/unittest mock patch-object16214623
Ref: 48bf16214623
Ref: library/unittest mock unittest mock patch object16214668
Ref: 1b4416214668
Node: patch dict16216364
Ref: library/unittest mock patch-dict16216462
Ref: 48c016216462
Ref: library/unittest mock unittest mock patch dict16216505
Ref: 1b9916216505
Node: patch multiple16220908
Ref: library/unittest mock patch-multiple16221030
Ref: 48c216221030
Ref: library/unittest mock unittest mock patch multiple16221081
Ref: 48c316221081
Node: patch のメソッド start と stop16224298
Ref: library/unittest mock patch-methods-start-and-stop16224443
Ref: 48c416224443
Ref: library/unittest mock start-and-stop16224443
Ref: 48c516224443
Ref: library/unittest mock unittest mock patch stopall16227328
Ref: 48c616227328
Node: ビルトインをパッチする16227488
Ref: library/unittest mock id416227630
Ref: 48c716227630
Ref: library/unittest mock patch-builtins16227630
Ref: 48c816227630
Node: TEST_PREFIX16228051
Ref: library/unittest mock id516228196
Ref: 48c916228196
Ref: library/unittest mock test-prefix16228196
Ref: 48c116228196
Node: patch デコレータをネストする16229194
Ref: library/unittest mock nesting-patch-decorators16229333
Ref: 48ca16229333
Node: どこにパッチするか16230369
Ref: library/unittest mock id616230566
Ref: 48be16230566
Ref: library/unittest mock where-to-patch16230566
Ref: 489316230566
Node: デスクリプタやプロキシオブジェクトにパッチする16232841
Ref: library/unittest mock patching-descriptors-and-proxy-objects16232990
Ref: 48cb16232990
Ref: デスクリプタやプロキシオブジェクトにパッチする-Footnote-116233656
Node: MagicMock と magic method のサポート16233781
Ref: library/unittest mock magicmock-and-magic-method-support16233957
Ref: 48cc16233957
Node: Magic Method をモックする16234119
Ref: library/unittest mock magic-methods16234248
Ref: 489416234248
Ref: library/unittest mock mocking-magic-methods16234248
Ref: 48cd16234248
Ref: Magic Method をモックする-Footnote-116238499
Ref: Magic Method をモックする-Footnote-216238878
Node: Magic Mock16239002
Ref: library/unittest mock magic-mock16239131
Ref: 48cf16239131
Ref: library/unittest mock unittest mock MagicMock16239301
Ref: 124316239301
Ref: library/unittest mock unittest mock NonCallableMagicMock16239811
Ref: 489816239811
Node: ヘルパー16243546
Ref: library/unittest mock helpers16243772
Ref: 48d016243772
Node: sentinel16243957
Ref: library/unittest mock sentinel16244030
Ref: 48d116244030
Ref: library/unittest mock unittest mock sentinel16244069
Ref: f6316244069
Node: DEFAULT16245530
Ref: library/unittest mock default16245616
Ref: 48d216245616
Ref: library/unittest mock unittest mock DEFAULT16245653
Ref: 489916245653
Node: call16245954
Ref: library/unittest mock call16246047
Ref: 48d316246047
Ref: library/unittest mock unittest mock call16246078
Ref: 1fc216246078
Ref: library/unittest mock unittest mock call call_list16246690
Ref: 48d416246690
Ref: library/unittest mock calls-as-tuples16247850
Ref: 48a616247850
Node: create_autospec16249663
Ref: library/unittest mock create-autospec16249752
Ref: 48d516249752
Ref: library/unittest mock unittest mock create_autospec16249805
Ref: 1b6d16249805
Node: ANY16251348
Ref: library/unittest mock any16251443
Ref: 48d616251443
Ref: library/unittest mock unittest mock ANY16251472
Ref: 1fc016251472
Node: FILTER_DIR16252752
Ref: library/unittest mock filter-dir16252841
Ref: 48d716252841
Ref: library/unittest mock unittest mock FILTER_DIR16252884
Ref: 48a216252884
Node: mock_open16255272
Ref: library/unittest mock mock-open16255376
Ref: 48d816255376
Ref: library/unittest mock unittest mock mock_open16255417
Ref: 139516255417
Ref: mock_open-Footnote-116258574
Node: autospec を使う16258599
Ref: library/unittest mock auto-speccing16258706
Ref: 489516258706
Ref: library/unittest mock autospeccing16258706
Ref: 48d916258706
Ref: autospec を使う-Footnote-116268400
Node: Sealing mocks16268768
Ref: library/unittest mock sealing-mocks16268857
Ref: 48da16268857
Ref: library/unittest mock unittest mock seal16268906
Ref: f6416268906
Node: Order of precedence of side_effect return_value and wraps16269719
Ref: library/unittest mock order-of-precedence-of-side-effect-return-value-and-wraps16269894
Ref: 48db16269894
Node: unittest mock --- 入門16273971
Ref: library/unittest mock-examples doc16274169
Ref: 48dc16274169
Ref: library/unittest mock-examples translation-repo16274169
Ref: 48dd16274169
Ref: library/unittest mock-examples unittest-mock-getting-started16274169
Ref: 48de16274169
Ref: library/unittest mock-examples getting-started16274261
Ref: 48df16274261
Node: Mock を使う16274332
Ref: library/unittest mock-examples using-mock16274432
Ref: 48e016274432
Node: Mock patching methods16274959
Ref: library/unittest mock-examples mock-patching-methods16275074
Ref: 48e116275074
Node: Mock for method calls on an object16276912
Ref: library/unittest mock-examples mock-for-method-calls-on-an-object16277051
Ref: 48e216277051
Node: Mocking classes16278590
Ref: library/unittest mock-examples mocking-classes16278738
Ref: 48e316278738
Node: モックに名前をつける16280010
Ref: library/unittest mock-examples naming-your-mocks16280142
Ref: 48e416280142
Node: Tracking all calls16280682
Ref: library/unittest mock-examples tracking-all-calls16280835
Ref: 48e516280835
Node: Setting return values and attributes16282412
Ref: library/unittest mock-examples setting-return-values-and-attributes16282574
Ref: 48e616282574
Node: モックから例外を発生させる16284214
Ref: library/unittest mock-examples raising-exceptions-with-mocks16284391
Ref: 48e716284391
Node: side_effect の関数と iterable16284835
Ref: library/unittest mock-examples side-effect-functions-and-iterables16285018
Ref: 48e816285018
Node: 非同期イテレータをモックする16286191
Ref: library/unittest mock-examples mocking-asynchronous-iterators16286395
Ref: 48e916286395
Node: 非同期コンテキストマネージャをモックする16287066
Ref: library/unittest mock-examples mocking-asynchronous-context-manager16287276
Ref: 48ea16287276
Node: Creating a mock from an existing object16288306
Ref: library/unittest mock-examples creating-a-mock-from-an-existing-object16288518
Ref: 48eb16288518
Node: Using side_effect to return per file content16290564
Ref: library/unittest mock-examples using-side-effect-to-return-per-file-content16290707
Ref: 48ec16290707
Node: Patch decorators16291558
Ref: library/unittest mock-examples patch-decorators16291683
Ref: 48ed16291683
Node: Further examples16297409
Ref: library/unittest mock-examples further-examples16297511
Ref: 48ee16297511
Ref: library/unittest mock-examples id116297511
Ref: 48ef16297511
Node: chained call をモックする16298220
Ref: library/unittest mock-examples mocking-chained-calls16298334
Ref: 48f016298334
Node: 部分的なモック16302136
Ref: library/unittest mock-examples partial-mocking16302285
Ref: 48f116302285
Ref: 部分的なモック-Footnote-116304572
Node: Mocking a generator method16304673
Ref: library/unittest mock-examples mocking-a-generator-method16304845
Ref: 48f216304845
Ref: Mocking a generator method-Footnote-116306250
Node: 同じパッチを全てのメソッドに適用する16306635
Ref: library/unittest mock-examples applying-the-same-patch-to-every-test-method16306809
Ref: 48f316306809
Node: Mocking unbound methods16309396
Ref: library/unittest mock-examples mocking-unbound-methods16309601
Ref: 48f416309601
Node: モックで複数回の呼び出しをチェックする16311425
Ref: library/unittest mock-examples checking-multiple-calls-with-mock16311618
Ref: 48f516311618
Node: ミュータブルな引数に対処する16313417
Ref: library/unittest mock-examples coping-with-mutable-arguments16313602
Ref: 48f616313602
Node: Nesting patches16318168
Ref: library/unittest mock-examples nesting-patches16318333
Ref: 48f716318333
Node: MagicMock で辞書をモックする16320148
Ref: library/unittest mock-examples mocking-a-dictionary-with-magicmock16320303
Ref: 48f816320303
Node: Mock のサブクラスと属性16322946
Ref: library/unittest mock-examples mock-subclasses-and-their-attributes16323126
Ref: 48f916323126
Ref: Mock のサブクラスと属性-Footnote-116325235
Ref: Mock のサブクラスと属性-Footnote-216325403
Ref: Mock のサブクラスと属性-Footnote-316325461
Node: patch dict で import をモックする16325542
Ref: library/unittest mock-examples mocking-imports-with-patch-dict16325741
Ref: 48fa16325741
Node: Tracking order of calls and less verbose call assertions16328384
Ref: library/unittest mock-examples tracking-order-of-calls-and-less-verbose-call-assertions16328581
Ref: 48fb16328581
Node: More complex argument matching16331914
Ref: library/unittest mock-examples more-complex-argument-matching16332062
Ref: 48fc16332062
Ref: More complex argument matching-Footnote-116335131
Ref: More complex argument matching-Footnote-216335174
Node: test --- Regression tests package for Python16335296
Ref: library/test doc16335486
Ref: 48fd16335486
Ref: library/test module-test16335486
Ref: eb16335486
Ref: library/test test-regression-tests-package-for-python16335486
Ref: 48fe16335486
Ref: library/test translation-repo16335486
Ref: 48ff16335486
Node: Writing Unit Tests for the test package16336971
Ref: library/test writing-tests16337184
Ref: 490016337184
Ref: library/test writing-unit-tests-for-the-test-package16337184
Ref: 490116337184
Node: コマンドラインインターフェースを利用してテストを実行する16343171
Ref: library/test module-test regrtest16343384
Ref: ec16343384
Ref: library/test regrtest16343384
Ref: 13b716343384
Ref: library/test running-tests-using-the-command-line-interface16343384
Ref: 490216343384
Node: test support --- Utilities for the Python test suite16345568
Ref: library/test module-test support16345791
Ref: ed16345791
Ref: library/test test-support-utilities-for-the-python-test-suite16345791
Ref: 490316345791
Ref: library/test test support TestFailed16346303
Ref: 490416346303
Ref: library/test test support ResourceDenied16346577
Ref: 490516346577
Ref: library/test test support verbose16346922
Ref: 490716346922
Ref: library/test test support is_jython16347209
Ref: 490816347209
Ref: library/test test support is_android16347335
Ref: 490916347335
Ref: library/test test support is_emscripten16347432
Ref: 490a16347432
Ref: library/test test support is_wasi16347535
Ref: 490b16347535
Ref: library/test test support is_apple_mobile16347626
Ref: 490c16347626
Ref: library/test test support is_apple16347754
Ref: 490d16347754
Ref: library/test test support unix_shell16347892
Ref: 490e16347892
Ref: library/test test support LOOPBACK_TIMEOUT16348030
Ref: 1fac16348030
Ref: library/test test support INTERNET_TIMEOUT16348657
Ref: 1fad16348657
Ref: library/test test support SHORT_TIMEOUT16349184
Ref: 1e7916349184
Ref: library/test test support LONG_TIMEOUT16349573
Ref: 1fae16349573
Ref: library/test test support PGO16350086
Ref: 491016350086
Ref: library/test test support PIPE_MAX_SIZE16350254
Ref: 491116350254
Ref: library/test test support Py_DEBUG16350443
Ref: 491216350443
Ref: library/test test support SOCK_MAX_SIZE16350653
Ref: 491316350653
Ref: library/test test support TEST_SUPPORT_DIR16350845
Ref: 491416350845
Ref: library/test test support TEST_HOME_DIR16350962
Ref: 491516350962
Ref: library/test test support TEST_DATA_DIR16351087
Ref: 491616351087
Ref: library/test test support MAX_Py_ssize_t16351218
Ref: 491716351218
Ref: library/test test support max_memuse16351370
Ref: 491816351370
Ref: library/test test support real_max_memuse16351603
Ref: 491a16351603
Ref: library/test test support MISSING_C_DOCSTRINGS16351853
Ref: 491b16351853
Ref: library/test test support HAVE_DOCSTRINGS16352145
Ref: 491c16352145
Ref: library/test test support TEST_HTTP_URL16352425
Ref: 491d16352425
Ref: library/test test support ALWAYS_EQ16352558
Ref: 491e16352558
Ref: library/test test support NEVER_EQ16352679
Ref: 491f16352679
Ref: library/test test support LARGEST16352836
Ref: 492016352836
Ref: library/test test support SMALLEST16352975
Ref: 492116352975
Ref: library/test test support busy_retry16353176
Ref: 492216353176
Ref: library/test test support sleeping_retry16353845
Ref: 492316353845
Ref: library/test test support is_resource_enabled16354730
Ref: 492416354730
Ref: library/test test support get_resource_value16355017
Ref: 492516355017
Ref: library/test test support python_is_optimized16355229
Ref: 492616355229
Ref: library/test test support with_pymalloc16355358
Ref: 492716355358
Ref: library/test test support requires16355448
Ref: 490616355448
Ref: library/test test support sortdict16355911
Ref: 492816355911
Ref: library/test test support findfile16356004
Ref: 492916356004
Ref: library/test test support get_pagesize16356559
Ref: 492a16356559
Ref: library/test test support setswitchinterval16356668
Ref: 492b16356668
Ref: library/test test support check_impl_detail16356895
Ref: 492c16356895
Ref: library/test test support set_memlimit16357412
Ref: 491916357412
Ref: library/test test support record_original_stdout16357571
Ref: 492d16357571
Ref: library/test test support get_original_stdout16357738
Ref: 492e16357738
Ref: library/test test support args_from_interpreter_flags16357910
Ref: 492f16357910
Ref: library/test test support optim_args_from_interpreter_flags16358100
Ref: 493016358100
Ref: library/test test support captured_stdin16358283
Ref: 493116358283
Ref: library/test test support captured_stdout16358329
Ref: 493216358329
Ref: library/test test support captured_stderr16358376
Ref: 1fe616358376
Ref: library/test test support disable_faulthandler16359157
Ref: 493316359157
Ref: library/test test support gc_collect16359282
Ref: 493416359282
Ref: library/test test support disable_gc16359619
Ref: 493516359619
Ref: library/test test support swap_attr16359801
Ref: 493616359801
Ref: library/test test support swap_item16360384
Ref: 493716360384
Ref: library/test test support flush_std_streams16360965
Ref: 493816360965
Ref: library/test test support print_warning16361242
Ref: 493916361242
Ref: library/test test support wait_process16361517
Ref: 1f7016361517
Ref: library/test test support calcobjsize16362037
Ref: 493b16362037
Ref: library/test test support calcvobjsize16362271
Ref: 493c16362271
Ref: library/test test support checksizeof16362510
Ref: 493e16362510
Ref: library/test test support anticipate_failure16362682
Ref: 493f16362682
Ref: library/test test support system_must_validate_cert16362996
Ref: 494016362996
Ref: library/test test support run_with_locale16363150
Ref: 494116363150
Ref: library/test test support run_with_tz16363588
Ref: 494216363588
Ref: library/test test support requires_freebsd_version16363751
Ref: 494316363751
Ref: library/test test support requires_linux_version16363966
Ref: 494416363966
Ref: library/test test support requires_mac_version16364176
Ref: 494516364176
Ref: library/test test support requires_gil_enabled16364383
Ref: 494616364383
Ref: library/test test support requires_IEEE_75416364560
Ref: 494716364560
Ref: library/test test support requires_zlib16364670
Ref: 494816364670
Ref: library/test test support requires_gzip16364784
Ref: 494916364784
Ref: library/test test support requires_bz216364897
Ref: 494a16364897
Ref: library/test test support requires_lzma16365008
Ref: 494b16365008
Ref: library/test test support requires_resource16365121
Ref: 494c16365121
Ref: library/test test support requires_docstrings16365247
Ref: 494d16365247
Ref: library/test test support requires_limited_api16365371
Ref: 494e16365371
Ref: library/test test support cpython_only16365512
Ref: 494f16365512
Ref: library/test test support impl_detail16365609
Ref: 495016365609
Ref: library/test test support thread_unsafe16365840
Ref: 495116365840
Ref: library/test test support no_tracing16366041
Ref: 495216366041
Ref: library/test test support refcount_test16366165
Ref: 495316366165
Ref: library/test test support bigmemtest16366470
Ref: 495416366470
Ref: library/test test support bigaddrspacetest16367216
Ref: 495516367216
Ref: library/test test support linked_to_musl16367318
Ref: 495616367318
Ref: library/test test support check_syntax_error16367774
Ref: 495716367774
Ref: library/test test support open_urlresource16368329
Ref: 495816368329
Ref: library/test test support reap_children16368459
Ref: 495916368459
Ref: library/test test support get_attribute16368734
Ref: 495a16368734
Ref: library/test test support catch_unraisable_exception16368898
Ref: 1fcc16368898
Ref: library/test test support load_package_tests16369791
Ref: 495b16369791
Ref: library/test test support detect_api_mismatch16370420
Ref: 495c16370420
Ref: library/test test support patch16370884
Ref: 495d16370884
Ref: library/test test support run_in_subinterp16371221
Ref: 495e16371221
Ref: library/test test support check_free_after_iterating16371392
Ref: 495f16371392
Ref: library/test test support missing_compiler_executable16371550
Ref: 496016371550
Ref: library/test test support check__all__16371873
Ref: 1f4616371873
Ref: library/test test support skip_if_broken_multiprocessing_synchronize16373684
Ref: 1f4716373684
Ref: library/test test support check_disallow_instantiation16373978
Ref: 496116373978
Ref: library/test test support adjust_int_max_str_digits16374187
Ref: 496216374187
Ref: library/test test support SuppressCrashReport16374654
Ref: 496316374654
Ref: library/test test support SaveSignals16375158
Ref: 496516375158
Ref: library/test test support SaveSignals save16375293
Ref: 496616375293
Ref: library/test test support SaveSignals restore16375445
Ref: 496716375445
Ref: library/test test support Matcher16375590
Ref: 496816375590
Ref: library/test test support Matcher matches16375627
Ref: 496916375627
Ref: library/test test support Matcher match_value16375746
Ref: 496a16375746
Ref: test support --- Utilities for the Python test suite-Footnote-116375927
Node: test support socket_helper --- Utilities for socket tests16376007
Ref: library/test module-test support socket_helper16376257
Ref: f216376257
Ref: library/test test-support-socket-helper-utilities-for-socket-tests16376257
Ref: 496b16376257
Ref: library/test test support socket_helper IPV6_ENABLED16376499
Ref: 496c16376499
Ref: library/test test support socket_helper find_unused_port16376635
Ref: 496d16376635
Ref: library/test test support socket_helper bind_port16377943
Ref: 496e16377943
Ref: library/test test support socket_helper bind_unix_socket16378889
Ref: 496f16378889
Ref: library/test test support socket_helper skip_unless_bind_unix_socket16379075
Ref: 497016379075
Ref: library/test test support socket_helper transient_internet16379246
Ref: 490f16379246
Node: test support script_helper --- Utilities for the Python execution tests16379520
Ref: library/test module-test support script_helper16379804
Ref: f116379804
Ref: library/test test-support-script-helper-utilities-for-the-python-execution-tests16379804
Ref: 497116379804
Ref: library/test test support script_helper interpreter_requires_environment16380070
Ref: 497216380070
Ref: library/test test support script_helper run_python_until_end16381043
Ref: 497316381043
Ref: library/test test support script_helper assert_python_ok16381429
Ref: 497416381429
Ref: library/test test support script_helper assert_python_failure16382070
Ref: 497516382070
Ref: library/test test support script_helper spawn_python16382512
Ref: 497616382512
Ref: library/test test support script_helper kill_python16382826
Ref: 497716382826
Ref: library/test test support script_helper make_script16382983
Ref: 497816382983
Ref: library/test test support script_helper make_zip_script16383293
Ref: 497916383293
Ref: library/test test support script_helper make_pkg16383663
Ref: 497a16383663
Ref: library/test test support script_helper make_zip_pkg16383867
Ref: 497b16383867
Node: test support bytecode_helper --- Support tools for testing correct bytecode generation16384398
Ref: library/test module-test support bytecode_helper16384688
Ref: ee16384688
Ref: library/test test-support-bytecode-helper-support-tools-for-testing-correct-bytecode-generation16384688
Ref: 497c16384688
Ref: library/test test support bytecode_helper BytecodeTestCase16385061
Ref: 497d16385061
Ref: library/test test support bytecode_helper BytecodeTestCase get_disassembly_as_string16385224
Ref: 497e16385224
Ref: library/test test support bytecode_helper BytecodeTestCase assertInBytecode16385339
Ref: 497f16385339
Ref: library/test test support bytecode_helper BytecodeTestCase assertNotInBytecode16385525
Ref: 498016385525
Node: test support threading_helper --- Utilities for threading tests16385686
Ref: library/test module-test support threading_helper16385954
Ref: f316385954
Ref: library/test test-support-threading-helper-utilities-for-threading-tests16385954
Ref: 498116385954
Ref: library/test test support threading_helper join_thread16386215
Ref: 498216386215
Ref: library/test test support threading_helper reap_threads16386438
Ref: 498316386438
Ref: library/test test support threading_helper start_threads16386580
Ref: 498416386580
Ref: library/test test support threading_helper threading_cleanup16386989
Ref: 498516386989
Ref: library/test test support threading_helper threading_setup16387228
Ref: 498616387228
Ref: library/test test support threading_helper wait_threads_exit16387357
Ref: 498716387357
Ref: library/test test support threading_helper catch_threading_exception16387541
Ref: 498816387541
Ref: library/test test support threading_helper run_concurrently16388507
Ref: 498916388507
Node: test support os_helper --- Utilities for os tests16388780
Ref: library/test module-test support os_helper16389019
Ref: f016389019
Ref: library/test test-support-os-helper-utilities-for-os-tests16389019
Ref: 498a16389019
Ref: library/test test support os_helper FS_NONASCII16389238
Ref: 498b16389238
Ref: library/test test support os_helper SAVEDCWD16389370
Ref: 498c16389370
Ref: library/test test support os_helper TESTFN16389474
Ref: 498d16389474
Ref: library/test test support os_helper TESTFN_NONASCII16389735
Ref: 498e16389735
Ref: library/test test support os_helper TESTFN_UNENCODABLE16390123
Ref: 498f16390123
Ref: library/test test support os_helper TESTFN_UNDECODABLE16390455
Ref: 499016390455
Ref: library/test test support os_helper TESTFN_UNICODE16390786
Ref: 499116390786
Ref: library/test test support os_helper EnvironmentVarGuard16390902
Ref: 179b16390902
Ref: library/test test support os_helper FakePath16391567
Ref: 499216391567
Ref: library/test test support os_helper EnvironmentVarGuard set16391834
Ref: 499316391834
Ref: library/test test support os_helper EnvironmentVarGuard unset16391969
Ref: 1ab916391969
Ref: library/test test support os_helper can_symlink16392183
Ref: 499416392183
Ref: library/test test support os_helper can_xattr16392386
Ref: 499516392386
Ref: library/test test support os_helper change_cwd16392511
Ref: 499616392511
Ref: library/test test support os_helper create_empty_file16392976
Ref: 499716392976
Ref: library/test test support os_helper fd_count16393129
Ref: 499816393129
Ref: library/test test support os_helper fs_is_case_insensitive16393229
Ref: 499916393229
Ref: library/test test support os_helper make_bad_fd16393388
Ref: 499a16393388
Ref: library/test test support os_helper rmdir16393584
Ref: 499b16393584
Ref: library/test test support os_helper rmtree16393893
Ref: 499c16393893
Ref: library/test test support os_helper skip_unless_symlink16394237
Ref: 499d16394237
Ref: library/test test support os_helper skip_unless_xattr16394421
Ref: 499e16394421
Ref: library/test test support os_helper temp_cwd16394547
Ref: 499f16394547
Ref: library/test test support os_helper temp_dir16395397
Ref: 49a016395397
Ref: library/test test support os_helper temp_umask16395854
Ref: 49a116395854
Ref: library/test test support os_helper unlink16396004
Ref: 49a216396004
Node: test support import_helper --- Utilities for import tests16396250
Ref: library/test module-test support import_helper16396487
Ref: ef16396487
Ref: library/test test-support-import-helper-utilities-for-import-tests16396487
Ref: 49a316396487
Ref: library/test test support import_helper forget16396730
Ref: 49a416396730
Ref: library/test test support import_helper import_fresh_module16396970
Ref: 1e7816396970
Ref: library/test test support import_helper import_module16398877
Ref: 49a516398877
Ref: library/test test support import_helper modules_setup16399611
Ref: 49a616399611
Ref: library/test test support import_helper modules_cleanup16399719
Ref: 49a716399719
Ref: library/test test support import_helper unload16399898
Ref: 49a816399898
Ref: library/test test support import_helper make_legacy_pyc16400015
Ref: 49a916400015
Ref: library/test test support import_helper CleanImport16400365
Ref: 49aa16400365
Ref: library/test test support import_helper DirsOnSysPath16400759
Ref: 49ab16400759
Ref: test support import_helper --- Utilities for import tests-Footnote-116401314
Ref: test support import_helper --- Utilities for import tests-Footnote-216401356
Node: test support warnings_helper --- Utilities for warnings tests16401398
Ref: library/test module-test support warnings_helper16401577
Ref: f416401577
Ref: library/test test-support-warnings-helper-utilities-for-warnings-tests16401577
Ref: 49ac16401577
Ref: library/test test support warnings_helper ignore_warnings16401832
Ref: 49ad16401832
Ref: library/test test support warnings_helper check_no_resource_warning16402346
Ref: 49ae16402346
Ref: library/test test support warnings_helper check_syntax_warning16402631
Ref: 49af16402631
Ref: library/test test support warnings_helper check_warnings16403435
Ref: 49b016403435
Ref: library/test test support warnings_helper WarningsRecorder16406911
Ref: 49b116406911
Node: Debugging and profiling16407154
Ref: library/debug doc16407320
Ref: 49b216407320
Ref: library/debug debugging-and-profiling16407320
Ref: 49b316407320
Ref: library/debug translation-repo16407320
Ref: 49b416407320
Ref: library/audit_events audit-events16407788
Ref: 1e2916407788
Node: 監査イベント表16408560
Ref: library/audit_events doc16408694
Ref: 49b516408694
Ref: library/audit_events audit-events-table16408694
Ref: 49b616408694
Ref: 監査イベント表-Footnote-116469610
Node: bdb --- デバッガーフレームワーク16469652
Ref: library/bdb doc16469858
Ref: 49d816469858
Ref: library/bdb bdb-debugger-framework16469858
Ref: 49d916469858
Ref: library/bdb module-bdb16469858
Ref: 1016469858
Ref: library/bdb translation-repo16469858
Ref: 49da16469858
Ref: library/bdb bdb BdbQuit16470228
Ref: 50716470228
Ref: library/bdb bdb Breakpoint16470399
Ref: 49db16470399
Ref: library/bdb bdb Breakpoint deleteMe16471760
Ref: 49e216471760
Ref: library/bdb bdb Breakpoint enable16472131
Ref: 49e316472131
Ref: library/bdb bdb Breakpoint disable16472231
Ref: 49e416472231
Ref: library/bdb bdb Breakpoint bpformat16472332
Ref: 49e516472332
Ref: library/bdb bdb Breakpoint bpprint16472756
Ref: 49e616472756
Ref: library/bdb bdb Breakpoint file16473041
Ref: 49de16473041
Ref: library/bdb bdb Breakpoint line16473113
Ref: 49e716473113
Ref: library/bdb bdb Breakpoint temporary16473211
Ref: 49e816473211
Ref: library/bdb bdb Breakpoint cond16473316
Ref: 49e116473316
Ref: library/bdb bdb Breakpoint funcname16473414
Ref: 49df16473414
Ref: library/bdb bdb Breakpoint enabled16473554
Ref: 49e916473554
Ref: library/bdb bdb Breakpoint bpbynumber16473637
Ref: 49dc16473637
Ref: library/bdb bdb Breakpoint bplist16473739
Ref: 49dd16473739
Ref: library/bdb bdb Breakpoint ignore16473886
Ref: 49ea16473886
Ref: library/bdb bdb Breakpoint hits16473971
Ref: 49e016473971
Ref: library/bdb bdb Bdb16474070
Ref: 55716474070
Ref: library/bdb bdb Bdb canonic16475923
Ref: 49eb16475923
Ref: library/bdb bdb Bdb start_trace16476308
Ref: 49ec16476308
Ref: library/bdb bdb Bdb stop_trace16476521
Ref: 49ed16476521
Ref: library/bdb bdb Bdb reset16476717
Ref: 49ee16476717
Ref: library/bdb bdb Bdb trace_dispatch16476915
Ref: 49f016476915
Ref: library/bdb bdb Bdb dispatch_line16478371
Ref: 49f116478371
Ref: library/bdb bdb Bdb dispatch_call16478846
Ref: 49f316478846
Ref: library/bdb bdb Bdb dispatch_return16479328
Ref: 49f516479328
Ref: library/bdb bdb Bdb dispatch_exception16479818
Ref: 49f716479818
Ref: library/bdb bdb Bdb is_skipped_module16480559
Ref: 49f916480559
Ref: library/bdb bdb Bdb stop_here16480687
Ref: 49fa16480687
Ref: library/bdb bdb Bdb break_here16480821
Ref: 49fb16480821
Ref: library/bdb bdb Bdb break_anywhere16481135
Ref: 49fd16481135
Ref: library/bdb bdb Bdb user_call16481398
Ref: 49f416481398
Ref: library/bdb bdb Bdb user_line16481705
Ref: 49f216481705
Ref: library/bdb bdb Bdb user_return16481934
Ref: 49f616481934
Ref: library/bdb bdb Bdb user_exception16482140
Ref: 49f816482140
Ref: library/bdb bdb Bdb do_clear16482348
Ref: 49fe16482348
Ref: library/bdb bdb Bdb set_step16482801
Ref: 49ff16482801
Ref: library/bdb bdb Bdb set_next16482897
Ref: 4a0016482897
Ref: library/bdb bdb Bdb set_return16483071
Ref: 4a0116483071
Ref: library/bdb bdb Bdb set_until16483201
Ref: 4a0216483201
Ref: library/bdb bdb Bdb set_trace16483430
Ref: 4a0316483430
Ref: library/bdb bdb Bdb set_continue16483835
Ref: 4a0516483835
Ref: library/bdb bdb Bdb set_quit16484119
Ref: 49ef16484119
Ref: library/bdb bdb Bdb set_break16484636
Ref: 4a0616484636
Ref: library/bdb bdb Bdb clear_break16485082
Ref: 4a0716485082
Ref: library/bdb bdb Bdb clear_bpbynumber16485348
Ref: 4a0816485348
Ref: library/bdb bdb Bdb clear_all_file_breaks16485646
Ref: 4a0916485646
Ref: library/bdb bdb Bdb clear_all_breaks16485899
Ref: 4a0a16485899
Ref: library/bdb bdb Bdb get_bpbynumber16486131
Ref: 4a0b16486131
Ref: library/bdb bdb Bdb get_break16486579
Ref: 4a0c16486579
Ref: library/bdb bdb Bdb get_breaks16486724
Ref: 4a0d16486724
Ref: library/bdb bdb Bdb get_file_breaks16486972
Ref: 4a0e16486972
Ref: library/bdb bdb Bdb get_all_breaks16487204
Ref: 4a0f16487204
Ref: library/bdb bdb Bdb disable_current_event16487540
Ref: 4a1016487540
Ref: library/bdb bdb Bdb restart_events16487815
Ref: 4a1116487815
Ref: library/bdb bdb Bdb get_stack16488379
Ref: 4a1216488379
Ref: library/bdb bdb Bdb format_stack_entry16488676
Ref: 4a1316488676
Ref: library/bdb bdb Bdb run16489310
Ref: 4a1416489310
Ref: library/bdb bdb Bdb runeval16489546
Ref: 4a1516489546
Ref: library/bdb bdb Bdb runctx16489784
Ref: 4a1616489784
Ref: library/bdb bdb Bdb runcall16489956
Ref: e4416489956
Ref: library/bdb bdb checkfuncname16490179
Ref: 4a1716490179
Ref: library/bdb bdb effective16490633
Ref: 49fc16490633
Ref: library/bdb bdb set_trace16491388
Ref: 4a0416491388
Ref: bdb --- デバッガーフレームワーク-Footnote-116491600
Node: faulthandler --- Python トレースバックをダンプする16491663
Ref: library/faulthandler doc16491875
Ref: 4a1816491875
Ref: library/faulthandler faulthandler-dump-the-python-traceback16491875
Ref: 4a1916491875
Ref: library/faulthandler module-faulthandler16491875
Ref: 5b16491875
Ref: library/faulthandler translation-repo16491875
Ref: 4a1a16491875
Node: tracebackのダンプ16495245
Ref: library/faulthandler dumping-the-traceback16495394
Ref: 4a1b16495394
Ref: library/faulthandler faulthandler dump_traceback16495453
Ref: 22516495453
Node: Dumping the C stack16496038
Ref: library/faulthandler dumping-the-c-stack16496232
Ref: 4a1c16496232
Ref: library/faulthandler faulthandler dump_c_stack16496315
Ref: 4a616496315
Node: C Stack Compatibility16496643
Ref: library/faulthandler c-stack-compatibility16496720
Ref: 4a516496720
Ref: library/faulthandler id116496720
Ref: 4a1d16496720
Ref: C Stack Compatibility-Footnote-116497339
Ref: C Stack Compatibility-Footnote-216497388
Node: フォールトハンドラの状態16497435
Ref: library/faulthandler fault-handler-state16497659
Ref: 4a1e16497659
Ref: library/faulthandler faulthandler enable16497740
Ref: 22416497740
Ref: library/faulthandler faulthandler disable16499296
Ref: 4a2016499296
Ref: library/faulthandler faulthandler is_enabled16499522
Ref: 4a2116499522
Node: タイムアウト後にtracebackをダンプする16499644
Ref: library/faulthandler dumping-the-tracebacks-after-a-timeout16499909
Ref: 4a2216499909
Ref: library/faulthandler faulthandler dump_traceback_later16500018
Ref: 22616500018
Ref: library/faulthandler faulthandler cancel_dump_traceback_later16501213
Ref: 4a2316501213
Node: ユーザシグナルに対してtracebackをダンプする16501375
Ref: library/faulthandler dumping-the-traceback-on-a-user-signal16501634
Ref: 4a2416501634
Ref: library/faulthandler faulthandler register16501758
Ref: 22716501758
Ref: library/faulthandler faulthandler unregister16502561
Ref: 4a2516502561
Node: ファイル記述子の問題16502961
Ref: library/faulthandler faulthandler-fd16503182
Ref: 4a1f16503182
Ref: library/faulthandler issue-with-file-descriptors16503182
Ref: 4a2616503182
Node: 使用例<43>16503795
Ref: library/faulthandler example16503947
Ref: 4a2716503947
Node: pdb --- The Python Debugger16507252
Ref: library/pdb doc16507450
Ref: 4a2816507450
Ref: library/pdb debugger16507450
Ref: 4a2916507450
Ref: library/pdb module-pdb16507450
Ref: aa16507450
Ref: library/pdb pdb-the-python-debugger16507450
Ref: 4a2a16507450
Ref: library/pdb translation-repo16507450
Ref: 4a2b16507450
Ref: pdb --- The Python Debugger-Footnote-116509935
Node: コマンドライン・インターフェース<8>16509998
Ref: library/pdb command-line-interface16510139
Ref: 4a2d16510139
Ref: library/pdb pdb-cli16510139
Ref: 56416510139
Ref: library/pdb cmdoption-pdb-c16510943
Ref: 4a2e16510943
Ref: library/pdb cmdoption-pdb-command16510943
Ref: 4a2f16510943
Ref: library/pdb cmdoption-pdb-m16511171
Ref: 4a3116511171
Ref: library/pdb cmdoption-pdb-p16511456
Ref: 4ff16511456
Ref: library/pdb cmdoption-pdb-pid16511456
Ref: 4a3216511456
Ref: library/pdb pdb run16512944
Ref: 482216512944
Ref: library/pdb pdb runeval16513868
Ref: 4a3516513868
Ref: library/pdb pdb runcall16514263
Ref: 4a3616514263
Ref: library/pdb pdb set_trace16514680
Ref: 50116514680
Ref: library/pdb pdb set_trace_async16515428
Ref: 50816515428
Ref: library/pdb pdb post_mortem16515842
Ref: 179316515842
Ref: library/pdb pdb pm16516225
Ref: 74716516225
Ref: library/pdb pdb set_default_backend16516341
Ref: 4a3716516341
Ref: library/pdb pdb get_default_backend16516906
Ref: 4a3816516906
Ref: library/pdb pdb Pdb16517325
Ref: 50216517325
Ref: library/pdb pdb Pdb run16520460
Ref: 4a3916520460
Ref: library/pdb pdb Pdb runeval16520526
Ref: 4a3a16520526
Ref: library/pdb pdb Pdb runcall16520597
Ref: 4a3b16520597
Ref: library/pdb pdb Pdb set_trace16520654
Ref: 50316520654
Ref: コマンドライン・インターフェース<8>-Footnote-116520814
Ref: コマンドライン・インターフェース<8>-Footnote-216520856
Node: Debugger commands16520998
Ref: library/pdb debugger-commands16521139
Ref: 4a3016521139
Ref: library/pdb id216521139
Ref: 4a3c16521139
Ref: library/pdb pdbcommand-help16525273
Ref: 4a3f16525273
Ref: library/pdb pdbcommand-where16525807
Ref: 4a4016525807
Ref: library/pdb pdbcommand-down16526273
Ref: 4a4116526273
Ref: library/pdb pdbcommand-up16526461
Ref: 4a4216526461
Ref: library/pdb pdbcommand-break16526644
Ref: 4a4316526644
Ref: library/pdb pdbcommand-tbreak16527922
Ref: 4a4416527922
Ref: library/pdb pdbcommand-clear16528167
Ref: 4a4516528167
Ref: library/pdb pdbcommand-disable16528645
Ref: 4a4616528645
Ref: library/pdb pdbcommand-enable16529067
Ref: 4a4716529067
Ref: library/pdb pdbcommand-ignore16529182
Ref: 4a4816529182
Ref: library/pdb pdbcommand-condition16529745
Ref: 4a4916529745
Ref: library/pdb pdbcommand-commands16530172
Ref: 50516530172
Ref: library/pdb pdbcommand-step16532077
Ref: 4a3316532077
Ref: library/pdb pdbcommand-next16532286
Ref: 4a3416532286
Ref: library/pdb pdbcommand-until16532706
Ref: 4a4b16532706
Ref: library/pdb pdbcommand-return16533132
Ref: 4a4a16533132
Ref: library/pdb pdbcommand-continue16533222
Ref: 4a2c16533222
Ref: library/pdb pdbcommand-jump16533331
Ref: 4a4c16533331
Ref: library/pdb pdbcommand-list16533792
Ref: 4a3d16533792
Ref: library/pdb pdbcommand-ll16534777
Ref: 4a4e16534777
Ref: library/pdb pdbcommand-args16535014
Ref: 4a4f16535014
Ref: library/pdb pdbcommand-p16535119
Ref: 132516535119
Ref: library/pdb pdbcommand-pp16535476
Ref: 4a5016535476
Ref: library/pdb pdbcommand-whatis16535678
Ref: 4a5116535678
Ref: library/pdb pdbcommand-source16535760
Ref: 4a5216535760
Ref: library/pdb pdbcommand-display16535921
Ref: 50416535921
Ref: library/pdb pdbcommand-undisplay16537454
Ref: 4a5316537454
Ref: library/pdb pdbcommand-interact16537760
Ref: 4a5416537760
Ref: library/pdb debugger-aliases16538677
Ref: 4a3e16538677
Ref: library/pdb pdbcommand-alias16538677
Ref: 4a5516538677
Ref: library/pdb pdbcommand-unalias16539987
Ref: 4a5616539987
Ref: library/pdb pdbcommand-016540080
Ref: 4a5716540080
Ref: library/pdb pdbcommand-run16540567
Ref: 4a5816540567
Ref: library/pdb pdbcommand-restart16540598
Ref: 4a5916540598
Ref: library/pdb pdbcommand-quit16541221
Ref: 4a4d16541221
Ref: library/pdb pdbcommand-debug16541848
Ref: 4a5a16541848
Ref: library/pdb pdbcommand-retval16542036
Ref: 4a5b16542036
Ref: library/pdb pdbcommand-exceptions16542134
Ref: 74816542134
Node: profiling --- Python profilers16543500
Ref: library/profiling doc16543670
Ref: 4a5c16543670
Ref: library/profiling module-profiling16543670
Ref: b516543670
Ref: library/profiling profiling-module16543670
Ref: 4a5d16543670
Ref: library/profiling profiling-python-profilers16543670
Ref: 4a5e16543670
Ref: library/profiling translation-repo16543670
Ref: 4a5f16543670
Ref: profiling --- Python profilers-Footnote-116544053
Node: Introduction to profiling16544120
Ref: library/profiling introduction-to-profiling16544240
Ref: 4a6016544240
Node: Choosing a profiler16545928
Ref: library/profiling choosing-a-profiler16546068
Ref: 4a6116546068
Ref: library/profiling id116546068
Ref: 4a6216546068
Node: When to use statistical sampling16548332
Ref: library/profiling when-to-use-statistical-sampling16548462
Ref: 4a6316548462
Node: When to use deterministic tracing16549821
Ref: library/profiling when-to-use-deterministic-tracing16549951
Ref: 4a6416549951
Node: Quick start16550931
Ref: library/profiling quick-start16551074
Ref: 4a6516551074
Node: Statistical profiling16551321
Ref: library/profiling statistical-profiling16551422
Ref: 4a6616551422
Node: Deterministic profiling16552164
Ref: library/profiling deterministic-profiling16552265
Ref: 4a6716552265
Node: Understanding profile output16552658
Ref: library/profiling profile-output16552802
Ref: 4a6816552802
Ref: library/profiling understanding-profile-output16552802
Ref: 4a6916552802
Node: Legacy compatibility16554611
Ref: library/profiling legacy-compatibility16554735
Ref: 4a6c16554735
Node: profiling tracing --- Deterministic profiler16555899
Ref: library/profiling tracing doc16556052
Ref: 4a6d16556052
Ref: library/profiling tracing module-profiling tracing16556052
Ref: b716556052
Ref: library/profiling tracing profiling-tracing16556052
Ref: 4a6e16556052
Ref: library/profiling tracing profiling-tracing-deterministic-profiler16556052
Ref: 4a6f16556052
Ref: profiling tracing --- Deterministic profiler-Footnote-116557311
Node: What is deterministic profiling?16557387
Ref: library/profiling tracing what-is-deterministic-profiling16557531
Ref: 4a7016557531
Node: Command-line interface16559250
Ref: library/profiling tracing command-line-interface16559430
Ref: 4a7216559430
Ref: library/profiling tracing profiling-tracing-cli16559430
Ref: 4a7316559430
Ref: library/profiling tracing cmdoption-profiling tracing-o16559818
Ref: 4a7416559818
Ref: library/profiling tracing cmdoption-profiling tracing-s16560008
Ref: 4a7516560008
Ref: library/profiling tracing cmdoption-profiling tracing-m16560315
Ref: 4a7716560315
Node: Programmatic usage examples16560588
Ref: library/profiling tracing programmatic-usage-examples16560752
Ref: 4a7816560752
Node: Basic profiling16560970
Ref: library/profiling tracing basic-profiling16561081
Ref: 4a7916561081
Node: Using the Profile class16561438
Ref: library/profiling tracing using-the-profile-class16561549
Ref: 4a7a16561549
Node: Module reference16562223
Ref: library/profiling tracing module-reference16562385
Ref: 4a7b16562385
Ref: library/profiling tracing profiling tracing run16562440
Ref: 4a7c16562440
Ref: library/profiling tracing profiling tracing runctx16563183
Ref: 4a7e16563183
Ref: library/profiling tracing profiling tracing Profile16563562
Ref: 4a7f16563562
Ref: library/profiling tracing profiling tracing Profile enable16564386
Ref: 4a8016564386
Ref: library/profiling tracing profiling tracing Profile disable16564464
Ref: 4a8116564464
Ref: library/profiling tracing profiling tracing Profile create_stats16564542
Ref: 4a8216564542
Ref: library/profiling tracing profiling tracing Profile print_stats16564682
Ref: 4a8316564682
Ref: library/profiling tracing profiling tracing Profile dump_stats16565139
Ref: 4a8416565139
Ref: library/profiling tracing profiling tracing Profile run16565323
Ref: 4a8516565323
Ref: library/profiling tracing profiling tracing Profile runctx16565418
Ref: 4a8616565418
Ref: library/profiling tracing profiling tracing Profile runcall16565574
Ref: 4a8716565574
Node: Using a custom timer16565983
Ref: library/profiling tracing using-a-custom-timer16566129
Ref: 4a8816566129
Node: Limitations16567172
Ref: library/profiling tracing limitations16567293
Ref: 4a8916567293
Node: profiling sampling --- Statistical profiler16568679
Ref: library/profiling sampling doc16568832
Ref: 4a8a16568832
Ref: library/profiling sampling module-profiling sampling16568832
Ref: b616568832
Ref: library/profiling sampling profiling-sampling16568832
Ref: 4a7116568832
Ref: library/profiling sampling profiling-sampling-statistical-profiler16568832
Ref: 4a8b16568832
Ref: library/profiling sampling translation-repo16568832
Ref: 4a8c16568832
Ref: profiling sampling --- Statistical profiler-Footnote-116569873
Node: What is statistical profiling?16569950
Ref: library/profiling sampling what-is-statistical-profiling16570083
Ref: 4a8d16570083
Node: How time is estimated16571003
Ref: library/profiling sampling how-time-is-estimated16571132
Ref: 4a8e16571132
Node: When to use a different approach16572575
Ref: library/profiling sampling when-to-use-a-different-approach16572704
Ref: 4a8f16572704
Node: Quick examples16574983
Ref: library/profiling sampling quick-examples16575133
Ref: 4a9016575133
Node: Commands16576173
Ref: library/profiling sampling commands16576315
Ref: 4a9116576315
Node: The run command16576728
Ref: library/profiling sampling the-run-command16576815
Ref: 4a9216576815
Node: The attach command16577453
Ref: library/profiling sampling the-attach-command16577565
Ref: 4a9316577565
Node: The dump command16578340
Ref: library/profiling sampling dump-command16578455
Ref: 4a9516578455
Ref: library/profiling sampling the-dump-command16578455
Ref: 4a9616578455
Node: The replay command16581309
Ref: library/profiling sampling replay-command16581429
Ref: 4a9716581429
Ref: library/profiling sampling the-replay-command16581429
Ref: 4a9816581429
Node: Profiling in production16582434
Ref: library/profiling sampling profiling-in-production16582559
Ref: 4a9916582559
Node: Platform requirements16583804
Ref: library/profiling sampling platform-requirements16583932
Ref: 4a9a16583932
Ref: library/profiling sampling profiling-permissions16583932
Ref: 4a9416583932
Node: Version compatibility16585083
Ref: library/profiling sampling version-compatibility16585179
Ref: 4a9b16585179
Node: Sampling configuration16585739
Ref: library/profiling sampling sampling-configuration16585882
Ref: 4a9c16585882
Node: Sampling rate and duration16587711
Ref: library/profiling sampling sampling-rate-and-duration16587821
Ref: 4a9d16587821
Node: Thread selection16589017
Ref: library/profiling sampling thread-selection16589149
Ref: 4aa016589149
Node: Blocking mode16589932
Ref: library/profiling sampling blocking-mode16590052
Ref: 4aa216590052
Ref: library/profiling sampling id116590052
Ref: 4aa316590052
Node: Special frames16592082
Ref: library/profiling sampling special-frames16592208
Ref: 4aa516592208
Node: Opcode-aware profiling16593547
Ref: library/profiling sampling opcode-aware-profiling16593680
Ref: 4aa816593680
Node: Real-time statistics16595595
Ref: library/profiling sampling real-time-statistics16595734
Ref: 4aae16595734
Node: Subprocess profiling16596263
Ref: library/profiling sampling subprocess-profiling16596399
Ref: 4ab116596399
Node: Sampling efficiency16599406
Ref: library/profiling sampling id216599513
Ref: 4ab316599513
Ref: library/profiling sampling sampling-efficiency16599513
Ref: 4ab016599513
Node: Profiling modes16600971
Ref: library/profiling sampling profiling-modes16601120
Ref: 4ab416601120
Node: Wall-clock mode16601533
Ref: library/profiling sampling wall-clock-mode16601617
Ref: 4ab516601617
Node: CPU mode16602464
Ref: library/profiling sampling cpu-mode16602594
Ref: 4ab716602594
Node: Comparing wall-clock and CPU profiles16603232
Ref: library/profiling sampling comparing-wall-clock-and-cpu-profiles16603355
Ref: 4ab816603355
Node: GIL mode16604447
Ref: library/profiling sampling gil-mode16604576
Ref: 4ab916604576
Node: Exception mode16606209
Ref: library/profiling sampling exception-mode16606292
Ref: 4aba16606292
Node: Output formats16608810
Ref: library/profiling sampling output-formats16608963
Ref: 4abb16608963
Node: pstats format16609367
Ref: library/profiling sampling pstats-format16609463
Ref: 4abc16609463
Node: Collapsed stacks format16612966
Ref: library/profiling sampling collapsed-stacks-format16613089
Ref: 4ac116613089
Node: Flame graph format16614113
Ref: library/profiling sampling flame-graph-format16614235
Ref: 4ac316614235
Node: Differential flame graphs16616649
Ref: library/profiling sampling differential-flame-graphs16616729
Ref: 4ac416616729
Node: Gecko format16618521
Ref: library/profiling sampling gecko-format16618634
Ref: 4ac516618634
Ref: Gecko format-Footnote-116621056
Ref: Gecko format-Footnote-216621093
Node: Heatmap format16621138
Ref: library/profiling sampling heatmap-format16621246
Ref: 4ac616621246
Node: Binary format16624241
Ref: library/profiling sampling binary-format16624328
Ref: 4ac716624328
Node: Record and replay workflow16625150
Ref: library/profiling sampling record-and-replay-workflow16625297
Ref: 4aca16625297
Node: Live mode16626531
Ref: library/profiling sampling live-mode16626685
Ref: 4acb16626685
Node: Keyboard commands16628361
Ref: library/profiling sampling keyboard-commands16628424
Ref: 4acc16628424
Node: Async-aware profiling16631112
Ref: library/profiling sampling async-aware-profiling16631265
Ref: 4acd16631265
Node: Async modes16632592
Ref: library/profiling sampling async-modes16632707
Ref: 4acf16632707
Node: Task markers and stack reconstruction16633511
Ref: library/profiling sampling task-markers-and-stack-reconstruction16633654
Ref: 4ad116633654
Node: Option restrictions16634624
Ref: library/profiling sampling option-restrictions16634747
Ref: 4ad216634747
Node: Command-line interface<2>16635027
Ref: library/profiling sampling command-line-interface16635162
Ref: 4ad316635162
Node: Global options16635435
Ref: library/profiling sampling global-options16635532
Ref: 4ad416635532
Ref: library/profiling sampling cmdoption-profiling sampling-arg-run16635583
Ref: 4ad516635583
Ref: library/profiling sampling cmdoption-profiling sampling-arg-attach16635649
Ref: 4ad616635649
Ref: library/profiling sampling cmdoption-profiling sampling-arg-dump16635723
Ref: 4ad716635723
Ref: library/profiling sampling cmdoption-profiling sampling-arg-replay16635822
Ref: 4ad816635822
Node: Dump options16635904
Ref: library/profiling sampling dump-options16636026
Ref: 4ad916636026
Ref: library/profiling sampling cmdoption-profiling sampling-a16636132
Ref: 4aa116636132
Ref: library/profiling sampling cmdoption-profiling sampling-all-threads16636132
Ref: 4ada16636132
Ref: library/profiling sampling cmdoption-profiling sampling-native16636246
Ref: 4aa616636246
Ref: library/profiling sampling cmdoption-profiling sampling-no-gc16636325
Ref: 4aa716636325
Ref: library/profiling sampling cmdoption-profiling sampling-opcodes16636409
Ref: 4aa916636409
Ref: library/profiling sampling cmdoption-profiling sampling-async-aware16636481
Ref: 4ace16636481
Ref: library/profiling sampling cmdoption-profiling sampling-async-mode16636597
Ref: 4ad016636597
Ref: library/profiling sampling cmdoption-profiling sampling-blocking16636821
Ref: 4aa416636821
Node: Sampling options16636916
Ref: library/profiling sampling sampling-options16637036
Ref: 4adb16637036
Ref: library/profiling sampling cmdoption-profiling sampling-r16637091
Ref: 4a9e16637091
Ref: library/profiling sampling cmdoption-profiling sampling-sampling-rate16637091
Ref: 4adc16637091
Ref: library/profiling sampling cmdoption-profiling sampling-d16637237
Ref: 4a9f16637237
Ref: library/profiling sampling cmdoption-profiling sampling-duration16637237
Ref: 4add16637237
Ref: library/profiling sampling cmdoption-profiling sampling-016637351
Ref: 4ade16637351
Ref: library/profiling sampling cmdoption-profiling sampling-116637351
Ref: 4adf16637351
Ref: library/profiling sampling cmdoption-profiling sampling-realtime-stats16637434
Ref: 4aaf16637434
Ref: library/profiling sampling cmdoption-profiling sampling-216637516
Ref: 4ae016637516
Ref: library/profiling sampling cmdoption-profiling sampling-316637595
Ref: 4ae116637595
Ref: library/profiling sampling cmdoption-profiling sampling-416637672
Ref: 4ae216637672
Ref: library/profiling sampling cmdoption-profiling sampling-516637756
Ref: 4ae316637756
Ref: library/profiling sampling cmdoption-profiling sampling-subprocesses16638044
Ref: 4ab216638044
Ref: library/profiling sampling cmdoption-profiling sampling-616638208
Ref: 4ae416638208
Node: Mode options16638487
Ref: library/profiling sampling mode-options16638609
Ref: 4ae516638609
Ref: library/profiling sampling cmdoption-profiling sampling-mode16638656
Ref: 4ab616638656
Ref: library/profiling sampling cmdoption-profiling sampling-716638874
Ref: 4ae616638874
Node: Output options16639009
Ref: library/profiling sampling output-options16639137
Ref: 4ae716639137
Ref: library/profiling sampling cmdoption-profiling sampling-pstats16639188
Ref: 4abd16639188
Ref: library/profiling sampling cmdoption-profiling sampling-collapsed16639378
Ref: 4ac216639378
Ref: library/profiling sampling cmdoption-profiling sampling-flamegraph16639473
Ref: 4aab16639473
Ref: library/profiling sampling cmdoption-profiling sampling-diff-flamegraph16639547
Ref: 4ae916639547
Ref: library/profiling sampling cmdoption-profiling sampling-gecko16639677
Ref: 4aad16639677
Ref: library/profiling sampling cmdoption-profiling sampling-heatmap16639753
Ref: 4aac16639753
Ref: library/profiling sampling cmdoption-profiling sampling-binary16639835
Ref: 4ac816639835
Ref: library/profiling sampling cmdoption-profiling sampling-compression16639960
Ref: 4ac916639960
Ref: library/profiling sampling cmdoption-profiling sampling-o16640108
Ref: 4ae816640108
Ref: library/profiling sampling cmdoption-profiling sampling-output16640108
Ref: 4aea16640108
Ref: library/profiling sampling cmdoption-profiling sampling-browser16640514
Ref: 4aeb16640514
Node: pstats display options16640823
Ref: library/profiling sampling pstats-display-options16640958
Ref: 4aec16640958
Ref: library/profiling sampling cmdoption-profiling sampling-sort16641076
Ref: 4abf16641076
Ref: library/profiling sampling cmdoption-profiling sampling-l16641269
Ref: 4ac016641269
Ref: library/profiling sampling cmdoption-profiling sampling-limit16641269
Ref: 4aed16641269
Ref: library/profiling sampling cmdoption-profiling sampling-no-summary16641368
Ref: 4abe16641368
Node: Run command options16641480
Ref: library/profiling sampling run-command-options16641592
Ref: 4aee16641592
Ref: library/profiling sampling cmdoption-profiling sampling-m16641653
Ref: 4aef16641653
Ref: library/profiling sampling cmdoption-profiling sampling-module16641653
Ref: 4af016641653
Ref: library/profiling sampling cmdoption-profiling sampling-live16641746
Ref: 4aaa16641746
Ref: Run command options-Footnote-116642369
Ref: Run command options-Footnote-216642406
Ref: Run command options-Footnote-316642451
Node: pstats --- Statistics for profilers16642502
Ref: library/pstats doc16642710
Ref: 4af116642710
Ref: library/pstats module-pstats16642710
Ref: b816642710
Ref: library/pstats pstats-module16642710
Ref: 4af216642710
Ref: library/pstats pstats-statistics-for-profilers16642710
Ref: 4af316642710
Ref: library/pstats translation-repo16642710
Ref: 4af416642710
Ref: pstats --- Statistics for profilers-Footnote-116643338
Node: Reading and displaying profile data16643404
Ref: library/pstats reading-and-displaying-profile-data16643535
Ref: 4af516643535
Node: Working with statistics16644367
Ref: library/pstats working-with-statistics16644487
Ref: 4af616644487
Node: Filtering output16645340
Ref: library/pstats filtering-output16645497
Ref: 4af816645497
Node: Analyzing call relationships16646196
Ref: library/pstats analyzing-call-relationships16646357
Ref: 4afa16646357
Node: Combining multiple profiles16646789
Ref: library/pstats combining-multiple-profiles16646925
Ref: 4afb16646925
Node: The Stats class16647471
Ref: library/pstats the-stats-class16647636
Ref: 4afc16647636
Ref: library/pstats pstats Stats16647695
Ref: 4a7d16647695
Ref: library/pstats pstats Stats strip_dirs16648344
Ref: 4af716648344
Ref: library/pstats pstats Stats add16648817
Ref: 4afd16648817
Ref: library/pstats pstats Stats dump_stats16649044
Ref: 4afe16649044
Ref: library/pstats pstats Stats sort_stats16649308
Ref: 4a7616649308
Ref: library/pstats pstats Stats reverse_order16653740
Ref: 4b0016653740
Ref: library/pstats pstats Stats print_stats16654026
Ref: 4af916654026
Ref: library/pstats pstats Stats print_callers16654821
Ref: 4a6a16654821
Ref: library/pstats pstats Stats print_callees16655374
Ref: 4a6b16655374
Ref: library/pstats pstats Stats get_stats_profile16655718
Ref: 4b0116655718
Ref: library/pstats pstats SortKey16656076
Ref: 4aff16656076
Ref: library/pstats pstats SortKey CALLS16656188
Ref: 4b0216656188
Ref: library/pstats pstats SortKey CUMULATIVE16656246
Ref: 4b0316656246
Ref: library/pstats pstats SortKey FILENAME16656314
Ref: 4b0416656314
Ref: library/pstats pstats SortKey LINE16656374
Ref: 4b0516656374
Ref: library/pstats pstats SortKey NAME16656432
Ref: 4b0616656432
Ref: library/pstats pstats SortKey NFL16656492
Ref: 4b0716656492
Ref: library/pstats pstats SortKey PCALLS16656591
Ref: 4b0816656591
Ref: library/pstats pstats SortKey STDNAME16656676
Ref: 4b0916656676
Ref: library/pstats pstats SortKey TIME16656764
Ref: 4b0a16656764
Node: Command-line interface<3>16656862
Ref: library/pstats command-line-interface16656983
Ref: 4b0b16656983
Ref: library/pstats pstats-cli16656983
Ref: 4b0c16656983
Node: timeit --- 小さなコードスニペットの実行時間計測16657543
Ref: library/timeit doc16657771
Ref: 4b0d16657771
Ref: library/timeit module-timeit16657771
Ref: f816657771
Ref: library/timeit timeit-measure-execution-time-of-small-code-snippets16657771
Ref: 4b0e16657771
Ref: library/timeit translation-repo16657771
Ref: 4b0f16657771
Ref: timeit --- 小さなコードスニペットの実行時間計測-Footnote-116658709
Node: Basic examples16658775
Ref: library/timeit basic-examples16658916
Ref: 4b1216658916
Node: Python interface16660340
Ref: library/timeit id116660541
Ref: 4b1416660541
Ref: library/timeit python-interface16660541
Ref: 4b1116660541
Ref: library/timeit timeit timeit16660693
Ref: 123216660693
Ref: library/timeit timeit repeat16661208
Ref: 4b1516661208
Ref: library/timeit timeit default_timer16661880
Ref: 4b1716661880
Ref: library/timeit timeit Timer16662264
Ref: 188016662264
Ref: library/timeit timeit Timer timeit16664075
Ref: 10ad16664075
Ref: library/timeit timeit Timer autorange16665421
Ref: 28e16665421
Ref: library/timeit timeit Timer repeat16666328
Ref: 4b1616666328
Ref: library/timeit timeit Timer print_exc16667754
Ref: 4b1816667754
Node: コマンドライン・インターフェース<9>16668472
Ref: library/timeit command-line-interface16668672
Ref: 4b1916668672
Ref: library/timeit timeit-command-line-interface16668672
Ref: 4b1016668672
Ref: library/timeit cmdoption-timeit-n16669008
Ref: 4b1a16669008
Ref: library/timeit cmdoption-timeit-number16669008
Ref: 4b1b16669008
Ref: library/timeit cmdoption-timeit-r16669078
Ref: 4b1c16669078
Ref: library/timeit cmdoption-timeit-repeat16669078
Ref: 4b1d16669078
Ref: library/timeit cmdoption-timeit-s16669167
Ref: 4b1e16669167
Ref: library/timeit cmdoption-timeit-setup16669167
Ref: 4b1f16669167
Ref: library/timeit cmdoption-timeit-p16669269
Ref: 4b2016669269
Ref: library/timeit cmdoption-timeit-process16669269
Ref: 4b2116669269
Ref: library/timeit cmdoption-timeit-u16669513
Ref: 4b2216669513
Ref: library/timeit cmdoption-timeit-unit16669513
Ref: 4b2316669513
Ref: library/timeit cmdoption-timeit-t16669704
Ref: 4b2416669704
Ref: library/timeit cmdoption-timeit-target-time16669704
Ref: 4b2516669704
Ref: library/timeit cmdoption-timeit-v16669882
Ref: 4b2616669882
Ref: library/timeit cmdoption-timeit-verbose16669882
Ref: 4b2716669882
Ref: library/timeit cmdoption-timeit-h16669994
Ref: 4b2816669994
Ref: library/timeit cmdoption-timeit-help16669994
Ref: 4b2916669994
Node: 使用例<44>16671734
Ref: library/timeit examples16671909
Ref: 4b2a16671909
Ref: library/timeit timeit-examples16671909
Ref: 4b1316671909
Node: trace --- Python 文実行のトレースと追跡16675723
Ref: library/trace doc16675962
Ref: 4b2b16675962
Ref: library/trace module-trace16675962
Ref: 10616675962
Ref: library/trace trace-trace-or-track-python-statement-execution16675962
Ref: 4b2c16675962
Ref: library/trace translation-repo16675962
Ref: 4b2d16675962
Ref: trace --- Python 文実行のトレースと追跡-Footnote-116676818
Ref: trace --- Python 文実行のトレースと追跡-Footnote-216676883
Node: コマンドラインからの使用<2>16676924
Ref: library/trace command-line-usage16677104
Ref: 4b2e16677104
Ref: library/trace trace-cli16677104
Ref: 4b2f16677104
Ref: library/trace cmdoption-trace-help16677492
Ref: 4b3016677492
Ref: library/trace cmdoption-trace-version16677561
Ref: 4b3116677561
Node: 主要なオプション16677853
Ref: library/trace main-options16677986
Ref: 4b3216677986
Ref: library/trace cmdoption-trace-c16678358
Ref: 4b3516678358
Ref: library/trace cmdoption-trace-count16678358
Ref: 4b3616678358
Ref: library/trace cmdoption-trace-t16678648
Ref: 4b3416678648
Ref: library/trace cmdoption-trace-trace16678648
Ref: 4b3a16678648
Ref: library/trace cmdoption-trace-l16678728
Ref: 4b3316678728
Ref: library/trace cmdoption-trace-listfuncs16678728
Ref: 4b3b16678728
Ref: library/trace cmdoption-trace-r16678836
Ref: 4b3c16678836
Ref: library/trace cmdoption-trace-report16678836
Ref: 4b3d16678836
Ref: library/trace cmdoption-trace-T16679098
Ref: 4b3e16679098
Ref: library/trace cmdoption-trace-trackcalls16679098
Ref: 4b3f16679098
Node: 修飾的オプション16679231
Ref: library/trace modifiers16679403
Ref: 4b4016679403
Ref: library/trace cmdoption-trace-f16679464
Ref: 4b3816679464
Ref: library/trace cmdoption-trace-file16679464
Ref: 4b4116679464
Ref: library/trace cmdoption-trace-C16679709
Ref: 4b3716679709
Ref: library/trace cmdoption-trace-coverdir16679709
Ref: 4b4216679709
Ref: library/trace cmdoption-trace-m16679970
Ref: 4b4316679970
Ref: library/trace cmdoption-trace-missing16679970
Ref: 4b4416679970
Ref: library/trace cmdoption-trace-s16680117
Ref: 4b4516680117
Ref: library/trace cmdoption-trace-summary16680117
Ref: 4b4616680117
Ref: library/trace cmdoption-trace-R16680338
Ref: 4b3916680338
Ref: library/trace cmdoption-trace-no-report16680338
Ref: 4b4716680338
Ref: library/trace cmdoption-trace-g16680578
Ref: 4b4816680578
Ref: library/trace cmdoption-trace-timing16680578
Ref: 4b4916680578
Node: フィルターオプション16680731
Ref: library/trace filters16680870
Ref: 4b4a16680870
Ref: library/trace cmdoption-trace-ignore-module16681003
Ref: 4b4b16681003
Ref: library/trace cmdoption-trace-ignore-dir16681237
Ref: 4b4c16681237
Node: プログラミングインターフェース16681505
Ref: library/trace programmatic-interface16681685
Ref: 4b4d16681685
Ref: library/trace trace-api16681685
Ref: 4b4e16681685
Ref: library/trace trace Trace16681781
Ref: 4b4f16681781
Ref: library/trace trace Trace run16682846
Ref: 4b5016682846
Ref: library/trace trace Trace runctx16683142
Ref: 4b5116683142
Ref: library/trace trace Trace runfunc16683528
Ref: e4516683528
Ref: library/trace trace Trace results16683777
Ref: 4b5216683777
Ref: library/trace trace CoverageResults16684146
Ref: 4b5316684146
Ref: library/trace trace CoverageResults update16684365
Ref: 4b5416684365
Ref: library/trace trace CoverageResults write_results16684514
Ref: 4b5516684514
Node: tracemalloc --- メモリ割り当ての追跡16686149
Ref: library/tracemalloc doc16686314
Ref: 4b5616686314
Ref: library/tracemalloc module-tracemalloc16686314
Ref: 10816686314
Ref: library/tracemalloc tracemalloc-trace-memory-allocations16686314
Ref: 4b5716686314
Ref: library/tracemalloc translation-repo16686314
Ref: 4b5816686314
Ref: tracemalloc --- メモリ割り当ての追跡-Footnote-116688071
Node: 使用例<45>16688142
Ref: library/tracemalloc examples16688250
Ref: 4b5916688250
Node: 上位10を表示する16688439
Ref: library/tracemalloc display-the-top-1016688539
Ref: 4b5a16688539
Node: 差を計算する16690205
Ref: library/tracemalloc compute-differences16690374
Ref: 4b5c16690374
Node: メモリブロックのトレースバックを取得する16692904
Ref: library/tracemalloc get-the-traceback-of-a-memory-block16693072
Ref: 4b5f16693072
Node: top を整形化する16695799
Ref: library/tracemalloc pretty-top16695940
Ref: 4b6016695940
Node: Record the current and peak size of all traced memory blocks16698499
Ref: library/tracemalloc record-the-current-and-peak-size-of-all-traced-memory-blocks16698618
Ref: 4b6116698618
Node: API16700305
Ref: library/tracemalloc api16700413
Ref: 4b6316700413
Node: 関数<11>16700579
Ref: library/tracemalloc functions16700650
Ref: 4b6416700650
Ref: library/tracemalloc tracemalloc clear_traces16700681
Ref: 4b6516700681
Ref: library/tracemalloc tracemalloc get_object_traceback16700871
Ref: 214516700871
Ref: library/tracemalloc tracemalloc get_traceback_limit16701291
Ref: 4b6616701291
Ref: library/tracemalloc tracemalloc get_traced_memory16701651
Ref: 4b6216701651
Ref: library/tracemalloc tracemalloc reset_peak16701847
Ref: d0b16701847
Ref: library/tracemalloc tracemalloc get_tracemalloc_memory16702486
Ref: 4b6816702486
Ref: library/tracemalloc tracemalloc is_tracing16702679
Ref: 4b6916702679
Ref: library/tracemalloc tracemalloc start16702939
Ref: 233a16702939
Ref: library/tracemalloc tracemalloc stop16704559
Ref: 1aee16704559
Ref: library/tracemalloc tracemalloc take_snapshot16705195
Ref: 4b6716705195
Node: DomainFilter16706038
Ref: library/tracemalloc domainfilter16706124
Ref: 4b6d16706124
Ref: library/tracemalloc tracemalloc DomainFilter16706169
Ref: 10b116706169
Ref: library/tracemalloc tracemalloc DomainFilter inclusive16706339
Ref: 4b6e16706339
Ref: library/tracemalloc tracemalloc DomainFilter domain16706639
Ref: 4b6f16706639
Node: Filter16706744
Ref: library/tracemalloc filter16706825
Ref: 4b7016706825
Ref: library/tracemalloc tracemalloc Filter16706860
Ref: 4b7116706860
Ref: library/tracemalloc tracemalloc Filter domain16707873
Ref: 4b7216707873
Ref: library/tracemalloc tracemalloc Filter inclusive16708144
Ref: 4b7316708144
Ref: library/tracemalloc tracemalloc Filter lineno16708576
Ref: 4b7516708576
Ref: library/tracemalloc tracemalloc Filter filename_pattern16708765
Ref: 4b7416708765
Ref: library/tracemalloc tracemalloc Filter all_frames16708937
Ref: 4b7616708937
Node: Frame16709443
Ref: library/tracemalloc frame16709520
Ref: 4b7816709520
Ref: library/tracemalloc tracemalloc Frame16709553
Ref: 4b7916709553
Ref: library/tracemalloc tracemalloc Frame filename16709754
Ref: 4b7a16709754
Ref: library/tracemalloc tracemalloc Frame lineno16709826
Ref: 4b7b16709826
Node: Snapshot16709890
Ref: library/tracemalloc snapshot16709970
Ref: 4b7c16709970
Ref: library/tracemalloc tracemalloc Snapshot16710009
Ref: 4b6c16710009
Ref: library/tracemalloc tracemalloc Snapshot compare_to16710264
Ref: 4b6b16710264
Ref: library/tracemalloc tracemalloc Snapshot dump16711109
Ref: 4b5d16711109
Ref: library/tracemalloc tracemalloc Snapshot filter_traces16711340
Ref: 4b8316711340
Ref: library/tracemalloc tracemalloc Snapshot load16712025
Ref: 4b5e16712025
Ref: library/tracemalloc tracemalloc Snapshot statistics16712217
Ref: 4b5b16712217
Ref: library/tracemalloc tracemalloc Snapshot traceback_limit16713476
Ref: 4b7716713476
Ref: library/tracemalloc tracemalloc Snapshot traces16713750
Ref: 4b8416713750
Node: Statistic16714129
Ref: library/tracemalloc statistic16714217
Ref: 4b8916714217
Ref: library/tracemalloc tracemalloc Statistic16714258
Ref: 4b8516714258
Ref: library/tracemalloc tracemalloc Statistic count16714535
Ref: 4b8116714535
Ref: library/tracemalloc tracemalloc Statistic size16714613
Ref: 4b8616714613
Ref: library/tracemalloc tracemalloc Statistic traceback16714720
Ref: 4b8716714720
Node: StatisticDiff16714891
Ref: library/tracemalloc statisticdiff16714976
Ref: 4b8a16714976
Ref: library/tracemalloc tracemalloc StatisticDiff16715025
Ref: 4b7d16715025
Ref: library/tracemalloc tracemalloc StatisticDiff count16715368
Ref: 4b8b16715368
Ref: library/tracemalloc tracemalloc StatisticDiff count_diff16715622
Ref: 4b8016715622
Ref: library/tracemalloc tracemalloc StatisticDiff size16715883
Ref: 4b7f16715883
Ref: library/tracemalloc tracemalloc StatisticDiff size_diff16716166
Ref: 4b7e16716166
Ref: library/tracemalloc tracemalloc StatisticDiff traceback16716436
Ref: 4b8216716436
Node: Trace16716614
Ref: library/tracemalloc trace16716699
Ref: 4b8c16716699
Ref: library/tracemalloc tracemalloc Trace16716732
Ref: 4b8816716732
Ref: library/tracemalloc tracemalloc Trace domain16717031
Ref: 4b8d16717031
Ref: library/tracemalloc tracemalloc Trace size16717309
Ref: 4b8e16717309
Ref: library/tracemalloc tracemalloc Trace traceback16717413
Ref: 4b8f16717413
Node: Traceback16717584
Ref: library/tracemalloc traceback16717647
Ref: 4b9016717647
Ref: library/tracemalloc tracemalloc Traceback16717688
Ref: f5916717688
Ref: library/tracemalloc tracemalloc Traceback total_nframe16718611
Ref: 4b6a16718611
Ref: library/tracemalloc tracemalloc Traceback format16718937
Ref: f5a16718937
Node: ソフトウェア・パッケージと配布16720031
Ref: library/distribution doc16720216
Ref: 4b9216720216
Ref: library/distribution software-packaging-and-distribution16720216
Ref: 4b9316720216
Ref: library/distribution translation-repo16720216
Ref: 4b9416720216
Ref: ソフトウェア・パッケージと配布-Footnote-116721055
Node: ensurepip --- pip インストーラーのブートストラップ16721080
Ref: library/ensurepip doc16721267
Ref: 4b9516721267
Ref: library/ensurepip ensurepip-bootstrapping-the-pip-installer16721267
Ref: 4b9616721267
Ref: library/ensurepip module-ensurepip16721267
Ref: 5816721267
Ref: ensurepip --- pip インストーラーのブートストラップ-Footnote-116723644
Ref: ensurepip --- pip インストーラーのブートストラップ-Footnote-216723710
Node: コマンドライン・インターフェース<10>16723752
Ref: library/ensurepip command-line-interface16723935
Ref: 4b9716723935
Ref: library/ensurepip ensurepip-cli16723935
Ref: 4b9816723935
Ref: library/ensurepip cmdoption-ensurepip-root16724953
Ref: 4b9916724953
Ref: library/ensurepip cmdoption-ensurepip-user16725182
Ref: 4b9a16725182
Ref: library/ensurepip cmdoption-ensurepip-altinstall16725670
Ref: 4b9b16725670
Ref: library/ensurepip cmdoption-ensurepip-default-pip16725797
Ref: 4b9c16725797
Node: モジュール API16726050
Ref: library/ensurepip module-api16726233
Ref: 4b9d16726233
Ref: library/ensurepip ensurepip version16726348
Ref: 4b9e16726348
Ref: library/ensurepip ensurepip bootstrap16726559
Ref: 49c216726559
Node: venv --- 仮想環境の作成16728965
Ref: library/venv doc16729229
Ref: 4b9f16729229
Ref: library/venv module-venv16729229
Ref: 11a16729229
Ref: library/venv translation-repo16729229
Ref: 4ba016729229
Ref: library/venv venv-creation-of-virtual-environments16729229
Ref: 4ba116729229
Ref: library/venv venv-def16729432
Ref: 3b116729432
Ref: library/venv venv-intro16729432
Ref: 4ba216729432
Ref: venv --- 仮想環境の作成-Footnote-116731720
Ref: venv --- 仮想環境の作成-Footnote-216731782
Ref: venv --- 仮想環境の作成-Footnote-316731820
Ref: venv --- 仮想環境の作成-Footnote-416731862
Node: 仮想環境の作成<2>16731990
Ref: library/venv creating-virtual-environments16732114
Ref: 4ba516732114
Ref: library/venv venv-cli16733942
Ref: 4ba616733942
Ref: library/venv cmdoption-venv-arg-ENV_DIR16733942
Ref: 4ba716733942
Ref: library/venv cmdoption-venv-system-site-packages16734049
Ref: 4ba816734049
Ref: library/venv cmdoption-venv-symlinks16734171
Ref: 4ba916734171
Ref: library/venv cmdoption-venv-copies16734298
Ref: 4baa16734298
Ref: library/venv cmdoption-venv-clear16734424
Ref: 4bab16734424
Ref: library/venv cmdoption-venv-upgrade16734556
Ref: 4bac16734556
Ref: library/venv cmdoption-venv-without-pip16734699
Ref: 4bad16734699
Ref: library/venv cmdoption-venv-prompt16734832
Ref: 4bae16734832
Ref: library/venv cmdoption-venv-upgrade-deps16734929
Ref: 4baf16734929
Ref: library/venv cmdoption-venv-without-scm-ignore-files16735026
Ref: 4bb016735026
Ref: 仮想環境の作成<2>-Footnote-116737545
Node: 仮想環境のしくみ16737600
Ref: library/venv how-venvs-work16737739
Ref: 4bb116737739
Ref: library/venv venv-explanation16737739
Ref: 87016737739
Node: API<2>16743092
Ref: library/venv api16743236
Ref: 4bb216743236
Ref: library/venv venv-api16743236
Ref: 12a616743236
Ref: library/venv venv EnvBuilder16743533
Ref: 77816743533
Ref: library/venv venv EnvBuilder create16746167
Ref: 4bb416746167
Ref: library/venv venv EnvBuilder ensure_directories16747560
Ref: 4bb516747560
Ref: library/venv venv EnvBuilder create_configuration16751062
Ref: 4bb616751062
Ref: library/venv venv EnvBuilder setup_python16751201
Ref: 4bb716751201
Ref: library/venv venv EnvBuilder setup_scripts16751715
Ref: 4bb816751715
Ref: library/venv venv EnvBuilder upgrade_dependencies16751897
Ref: 4bbb16751897
Ref: library/venv venv EnvBuilder post_setup16752342
Ref: 4bb916752342
Ref: library/venv venv EnvBuilder install_scripts16752688
Ref: 4bba16752688
Ref: library/venv venv EnvBuilder create_git_ignore_file16754246
Ref: 4bb316754246
Ref: library/venv venv create16755347
Ref: 77916755347
Ref: API<2>-Footnote-116756143
Node: EnvBuilder を拡張する例16756188
Ref: library/venv an-example-of-extending-envbuilder16756299
Ref: 4bbc16756299
Ref: EnvBuilder を拡張する例-Footnote-116766507
Node: zipapp --- 実行可能な Python zip アーカイブを管理する16766554
Ref: library/zipapp doc16766743
Ref: 4bbd16766743
Ref: library/zipapp module-zipapp16766743
Ref: 13916766743
Ref: library/zipapp translation-repo16766743
Ref: 4bbe16766743
Ref: library/zipapp zipapp-manage-executable-python-zip-archives16766743
Ref: 4bbf16766743
Ref: zipapp --- 実行可能な Python zip アーカイブを管理する-Footnote-116767744
Node: 基本的な例<3>16767810
Ref: library/zipapp basic-example16767990
Ref: 4bc216767990
Node: コマンドラインインターフェイス<3>16768502
Ref: library/zipapp command-line-interface16768701
Ref: 4bc316768701
Ref: library/zipapp zipapp-command-line-interface16768701
Ref: 4bc016768701
Ref: library/zipapp cmdoption-zipapp-o16769393
Ref: 4bc416769393
Ref: library/zipapp cmdoption-zipapp-output16769393
Ref: 4bc516769393
Ref: library/zipapp cmdoption-zipapp-p16770146
Ref: 4bc616770146
Ref: library/zipapp cmdoption-zipapp-python16770146
Ref: 4bc716770146
Ref: library/zipapp cmdoption-zipapp-m16770477
Ref: 4bc816770477
Ref: library/zipapp cmdoption-zipapp-main16770477
Ref: 4bc916770477
Ref: library/zipapp cmdoption-zipapp-c16771068
Ref: 4bca16771068
Ref: library/zipapp cmdoption-zipapp-compress16771068
Ref: 4bcb16771068
Ref: library/zipapp cmdoption-zipapp-info16771368
Ref: 4bcc16771368
Ref: library/zipapp cmdoption-zipapp-h16771640
Ref: 4bcd16771640
Ref: library/zipapp cmdoption-zipapp-help16771640
Ref: 4bce16771640
Node: Python API16771722
Ref: library/zipapp python-api16771916
Ref: 4bcf16771916
Ref: library/zipapp zipapp-python-api16771916
Ref: 4bc116771916
Ref: library/zipapp zipapp create_archive16772029
Ref: f7216772029
Ref: library/zipapp zipapp get_interpreter16776627
Ref: 4bd016776627
Node: 使用例<46>16777077
Ref: library/zipapp examples16777253
Ref: 4bd116777253
Ref: library/zipapp zipapp-examples16777253
Ref: 4bd216777253
Node: インタープリタの指定16778914
Ref: library/zipapp specifying-the-interpreter16779124
Ref: 4bd316779124
Ref: library/zipapp zipapp-specifying-the-interpreter16779124
Ref: 4bd416779124
Node: Creating Standalone Applications with zipapp16780329
Ref: library/zipapp creating-standalone-applications-with-zipapp16780567
Ref: 4bd516780567
Node: Caveats16782268
Ref: library/zipapp caveats16782356
Ref: 4bd616782356
Node: The Python Zip Application Archive Format16783093
Ref: library/zipapp the-python-zip-application-archive-format16783292
Ref: 4bd716783292
Node: Python ランタイムサービス16785184
Ref: library/python doc16785384
Ref: 4bd816785384
Ref: library/python python16785384
Ref: 4bd916785384
Ref: library/python python-runtime-services16785384
Ref: 4bda16785384
Ref: library/python translation-repo16785384
Ref: 4bdb16785384
Node: sys --- システム固有のパラメーターと関数16787200
Ref: library/sys doc16787391
Ref: 4bdc16787391
Ref: library/sys module-sys16787391
Ref: e216787391
Ref: library/sys sys-system-specific-parameters-and-functions16787391
Ref: 4bdd16787391
Ref: library/sys sys abi_info16787815
Ref: 27a16787815
Ref: library/sys sys abi_info pointer_bits16788506
Ref: 4bde16788506
Ref: library/sys sys abi_info free_threaded16788696
Ref: 4bdf16788696
Ref: library/sys sys abi_info debug16789032
Ref: 4be016789032
Ref: library/sys sys abi_info byteorder16789338
Ref: 4be116789338
Ref: library/sys sys abiflags16789549
Ref: e2c16789549
Ref: library/sys sys addaudithook16789990
Ref: 49b716789990
Ref: library/sys sys argv16792242
Ref: 161e16792242
Ref: library/sys auditing16793435
Ref: 1e8416793435
Ref: library/sys sys audit16793435
Ref: 1b5516793435
Ref: library/sys sys base_exec_prefix16794836
Ref: 3af16794836
Ref: library/sys sys base_prefix16795323
Ref: 3b216795323
Ref: library/sys sys byteorder16795787
Ref: 280f16795787
Ref: library/sys sys builtin_module_names16796096
Ref: 225416796096
Ref: library/sys sys call_tracing16796529
Ref: 1ddc16796529
Ref: library/sys sys copyright16797052
Ref: 4be216797052
Ref: library/sys sys _clear_type_cache16797159
Ref: 34c16797159
Ref: library/sys sys _clear_internal_caches16797724
Ref: 34d16797724
Ref: library/sys sys _current_frames16797964
Ref: 17eb16797964
Ref: library/sys sys _current_exceptions16799145
Ref: 8d716799145
Ref: library/sys sys breakpointhook16799886
Ref: ea316799886
Ref: library/sys sys _debugmallocstats16802537
Ref: 4be316802537
Ref: library/sys sys dllhandle16803057
Ref: 4be416803057
Ref: library/sys sys displayhook16803185
Ref: 18d716803185
Ref: library/sys sys dont_write_bytecode16804877
Ref: 4be516804877
Ref: library/sys sys _emscripten_info16805391
Ref: 1da916805391
Ref: library/sys sys _emscripten_info emscripten_version16805611
Ref: 4be616805611
Ref: library/sys sys _emscripten_info runtime16805771
Ref: 4be716805771
Ref: library/sys sys _emscripten_info pthreads16805926
Ref: 4be816805926
Ref: library/sys sys _emscripten_info shared_memory16806051
Ref: 4be916806051
Ref: library/sys sys pycache_prefix16806249
Ref: d7116806249
Ref: library/sys sys excepthook16807227
Ref: be916807227
Ref: library/sys sys __breakpointhook__16808590
Ref: 4bea16808590
Ref: library/sys sys __displayhook__16808628
Ref: 4beb16808628
Ref: library/sys sys __excepthook__16808663
Ref: 4bec16808663
Ref: library/sys sys __unraisablehook__16808697
Ref: 4bed16808697
Ref: library/sys sys exception16809283
Ref: a8016809283
Ref: library/sys sys exc_info16809754
Ref: a7f16809754
Ref: library/sys sys exec_prefix16810752
Ref: 3b016810752
Ref: library/sys sys executable16812189
Ref: 3b416812189
Ref: library/sys sys exit16812577
Ref: 50616812577
Ref: library/sys sys flags16814336
Ref: a8116814336
Ref: library/sys sys flags debug16814580
Ref: 4bee16814580
Ref: library/sys sys flags inspect16814783
Ref: 19ab16814783
Ref: library/sys sys flags interactive16814988
Ref: 4bef16814988
Ref: library/sys sys flags isolated16815186
Ref: 4bf016815186
Ref: library/sys sys flags optimize16815386
Ref: 4bf116815386
Ref: library/sys sys flags dont_write_bytecode16815624
Ref: 4bf216815624
Ref: library/sys sys flags no_user_site16815818
Ref: 4bf316815818
Ref: library/sys sys flags no_site16816014
Ref: 4bf416816014
Ref: library/sys sys flags ignore_environment16816226
Ref: 4bf516816226
Ref: library/sys sys flags verbose16816415
Ref: 4bf616816415
Ref: library/sys sys flags bytes_warning16816622
Ref: 4bf716816622
Ref: library/sys sys flags quiet16816814
Ref: 4bf816816814
Ref: library/sys sys flags hash_randomization16817028
Ref: 4bf916817028
Ref: library/sys sys flags dev_mode16817219
Ref: 208e16817219
Ref: library/sys sys flags utf8_mode16817522
Ref: 4bfa16817522
Ref: library/sys sys flags safe_path16817727
Ref: 74616817727
Ref: library/sys sys flags int_max_str_digits16817936
Ref: 28ef16817936
Ref: library/sys sys flags warn_default_encoding16818276
Ref: 4bfb16818276
Ref: library/sys sys flags gil16818480
Ref: 4bfc16818480
Ref: library/sys sys flags thread_inherit_context16818730
Ref: 42616818730
Ref: library/sys sys flags context_aware_warnings16819060
Ref: 43616819060
Ref: library/sys sys float_info16820568
Ref: 1fde16820568
Ref: library/sys sys float_info epsilon16821556
Ref: 4bfe16821556
Ref: library/sys sys float_info dig16822359
Ref: 4bff16822359
Ref: library/sys sys float_info mant_dig16822873
Ref: 4c0016822873
Ref: library/sys sys float_info max16823368
Ref: 4c0116823368
Ref: library/sys sys float_info max_exp16823754
Ref: 4c0216823754
Ref: library/sys sys float_info max_10_exp16824257
Ref: 4c0316824257
Ref: library/sys sys float_info min16824758
Ref: 2cb016824758
Ref: library/sys sys float_info min_exp16825570
Ref: 4c0416825570
Ref: library/sys sys float_info min_10_exp16826063
Ref: 4c0516826063
Ref: library/sys sys float_info radix16826460
Ref: 4c0616826460
Ref: library/sys sys float_info rounds16826832
Ref: 4c0716826832
Ref: library/sys sys float_repr_style16829764
Ref: 16b416829764
Ref: library/sys sys getallocatedblocks16830412
Ref: 137516830412
Ref: library/sys sys getunicodeinternedsize16831043
Ref: 4c0816831043
Ref: library/sys sys getandroidapilevel16831186
Ref: f4d16831186
Ref: library/sys sys getdefaultencoding16831532
Ref: 4c0916831532
Ref: library/sys sys getdlopenflags16831703
Ref: 18c616831703
Ref: library/sys sys getfilesystemencoding16832017
Ref: 101b16832017
Ref: library/sys sys getfilesystemencodeerrors16833712
Ref: 10a716833712
Ref: library/sys sys get_int_max_str_digits16834634
Ref: 1a3216834634
Ref: library/sys sys get_lazy_imports16834863
Ref: 18616834863
Ref: library/sys sys get_lazy_imports_filter16835320
Ref: 4c0a16835320
Ref: library/sys sys getrefcount16835715
Ref: 55116835715
Ref: library/sys sys getrecursionlimit16836717
Ref: 8d916836717
Ref: library/sys sys getsizeof16837184
Ref: 1cf916837184
Ref: library/sys sys getswitchinterval16838291
Ref: d1916838291
Ref: library/sys sys _getframe16838469
Ref: ad316838469
Ref: library/sys sys _getframemodulename16839297
Ref: 1cfd16839297
Ref: library/sys sys getobjects16840040
Ref: 51d16840040
Ref: library/sys sys getprofile16841165
Ref: 179916841165
Ref: library/sys sys gettrace16841304
Ref: 179a16841304
Ref: library/sys sys getwindowsversion16841794
Ref: 10a816841794
Ref: library/sys sys get_asyncgen_hooks16844721
Ref: 1ddd16844721
Ref: library/sys sys get_coroutine_origin_tracking_depth16845474
Ref: f4e16845474
Ref: library/sys sys hash_info16845829
Ref: 13ad16845829
Ref: library/sys sys hash_info width16846091
Ref: 4c0c16846091
Ref: library/sys sys hash_info modulus16846178
Ref: 281716846178
Ref: library/sys sys hash_info inf16846277
Ref: 4c0d16846277
Ref: library/sys sys hash_info nan16846371
Ref: 4c0e16846371
Ref: library/sys sys hash_info imag16846452
Ref: 4c0f16846452
Ref: library/sys sys hash_info algorithm16846562
Ref: 4c1016846562
Ref: library/sys sys hash_info hash_bits16846692
Ref: 4c1116846692
Ref: library/sys sys hash_info seed_bits16846791
Ref: 4c1216846791
Ref: library/sys sys hash_info cutoff16846890
Ref: 4c1316846890
Ref: library/sys sys hexversion16847151
Ref: 4c1416847151
Ref: library/sys sys implementation16848160
Ref: 92b16848160
Ref: library/sys sys int_info16851223
Ref: 164d16851223
Ref: library/sys sys int_info bits_per_digit16851415
Ref: 4c1616851415
Ref: library/sys sys int_info sizeof_digit16851601
Ref: 4c1716851601
Ref: library/sys sys int_info default_max_str_digits16851714
Ref: 28f016851714
Ref: library/sys sys int_info str_digits_check_threshold16851900
Ref: 4c1816851900
Ref: library/sys sys __interactivehook__16852300
Ref: 137616852300
Ref: library/sys sys intern16852945
Ref: 169516852945
Ref: library/sys sys _is_gil_enabled16853931
Ref: 4c1916853931
Ref: library/sys sys is_finalizing16854211
Ref: e5316854211
Ref: library/sys sys _jit16854474
Ref: 52016854474
Ref: library/sys sys _jit is_available16854835
Ref: 66916854835
Ref: library/sys sys _jit is_enabled16855205
Ref: 66a16855205
Ref: library/sys sys _jit is_active16855642
Ref: 1aa816855642
Ref: library/sys sys last_exc16856972
Ref: 8d316856972
Ref: library/sys sys _is_immortal16857550
Ref: 51e16857550
Ref: library/sys sys _is_interned16858121
Ref: 76016858121
Ref: library/sys sys last_type16858393
Ref: 8d416858393
Ref: library/sys sys last_value16858422
Ref: 8d516858422
Ref: library/sys sys last_traceback16858452
Ref: 8d616858452
Ref: library/sys sys maxsize16858686
Ref: 158316858686
Ref: library/sys sys maxunicode16858963
Ref: 140316858963
Ref: library/sys sys meta_path16859409
Ref: 10e716859409
Ref: library/sys sys modules16860708
Ref: 19da16860708
Ref: library/sys sys orig_argv16861321
Ref: c1d16861321
Ref: library/sys sys path16861788
Ref: 19f16861788
Ref: library/sys sys path_hooks16863223
Ref: 13d116863223
Ref: library/sys sys path_importer_cache16863681
Ref: 9e016863681
Ref: library/sys sys platform16864197
Ref: 51f16864197
Ref: library/sys sys platlibdir16866882
Ref: 2b416866882
Ref: library/sys sys prefix16867891
Ref: 3b316867891
Ref: library/sys sys ps116868998
Ref: 234216868998
Ref: library/sys sys ps216869021
Ref: 234316869021
Ref: library/sys sys setdlopenflags16869549
Ref: 14e016869549
Ref: library/sys sys set_int_max_str_digits16870151
Ref: 1b3016870151
Ref: library/sys sys set_lazy_imports16870389
Ref: 18516870389
Ref: library/sys sys set_lazy_imports_filter16871279
Ref: 18716871279
Ref: library/sys sys setprofile16872508
Ref: 18b616872508
Ref: library/sys sys setrecursionlimit16875218
Ref: 8d816875218
Ref: library/sys sys setswitchinterval16876195
Ref: d1a16876195
Ref: library/sys sys settrace16876951
Ref: 56316876951
Ref: library/sys sys set_asyncgen_hooks16882002
Ref: 1bc916882002
Ref: library/sys sys set_coroutine_origin_tracking_depth16883142
Ref: f4f16883142
Ref: library/sys sys activate_stack_trampoline16883963
Ref: 88a16883963
Ref: library/sys sys deactivate_stack_trampoline16884418
Ref: 88b16884418
Ref: library/sys sys is_stack_trampoline_active16884672
Ref: 88c16884672
Ref: library/sys sys remote_exec16884857
Ref: 41f16884857
Ref: library/sys sys stdin16886530
Ref: 94f16886530
Ref: library/sys sys stdout16886555
Ref: ea016886555
Ref: library/sys sys stderr16886581
Ref: d0916886581
Ref: library/sys sys __stdin__16890043
Ref: 4c1d16890043
Ref: library/sys sys __stdout__16890072
Ref: 2f3616890072
Ref: library/sys sys __stderr__16890102
Ref: 493a16890102
Ref: library/sys sys stdlib_module_names16891309
Ref: c1e16891309
Ref: library/sys sys thread_info16892049
Ref: 151016892049
Ref: library/sys sys thread_info name16892185
Ref: 4c1e16892185
Ref: library/sys sys thread_info lock16892539
Ref: 4c1f16892539
Ref: library/sys sys thread_info version16892838
Ref: 4c2016892838
Ref: library/sys sys tracebacklimit16893035
Ref: 1b7b16893035
Ref: library/sys sys unraisablehook16893408
Ref: 71216893408
Ref: library/sys sys version16895476
Ref: 6ae16895476
Ref: library/sys sys api_version16895926
Ref: 4c2116895926
Ref: library/sys sys version_info16896225
Ref: 30816896225
Ref: library/sys sys warnoptions16896916
Ref: 3ad16896916
Ref: library/sys sys winver16897133
Ref: 4c2316897133
Ref: library/sys sys _xoptions16897779
Ref: 233e16897779
Ref: library/sys c9916898666
Ref: 4bfd16898666
Ref: sys --- システム固有のパラメーターと関数-Footnote-116898892
Ref: sys --- システム固有のパラメーターと関数-Footnote-216898934
Ref: sys --- システム固有のパラメーターと関数-Footnote-316898976
Ref: sys --- システム固有のパラメーターと関数-Footnote-416899018
Ref: sys --- システム固有のパラメーターと関数-Footnote-516899060
Ref: sys --- システム固有のパラメーターと関数-Footnote-616899165
Ref: sys --- システム固有のパラメーターと関数-Footnote-716899207
Ref: sys --- システム固有のパラメーターと関数-Footnote-816899249
Ref: sys --- システム固有のパラメーターと関数-Footnote-916899291
Ref: sys --- システム固有のパラメーターと関数-Footnote-1016899333
Ref: sys --- システム固有のパラメーターと関数-Footnote-1116899376
Ref: sys --- システム固有のパラメーターと関数-Footnote-1216899419
Ref: sys --- システム固有のパラメーターと関数-Footnote-1316899462
Ref: sys --- システム固有のパラメーターと関数-Footnote-1416899505
Ref: sys --- システム固有のパラメーターと関数-Footnote-1516899548
Ref: sys --- システム固有のパラメーターと関数-Footnote-1616899591
Ref: sys --- システム固有のパラメーターと関数-Footnote-1716899634
Ref: sys --- システム固有のパラメーターと関数-Footnote-1816899677
Ref: sys --- システム固有のパラメーターと関数-Footnote-1916899720
Ref: sys --- システム固有のパラメーターと関数-Footnote-2016899763
Ref: sys --- システム固有のパラメーターと関数-Footnote-2116899844
Ref: sys --- システム固有のパラメーターと関数-Footnote-2216899887
Ref: sys --- システム固有のパラメーターと関数-Footnote-2316899930
Node: sys monitoring --- 実行イベントモニタリング16899973
Ref: library/sys monitoring doc16900242
Ref: 4c2416900242
Ref: library/sys monitoring module-sys monitoring16900242
Ref: e316900242
Ref: library/sys monitoring sys-monitoring-execution-event-monitoring16900242
Ref: 4c2516900242
Ref: library/sys monitoring translation-repo16900242
Ref: 4c2616900242
Node: Tool identifiers16901321
Ref: library/sys monitoring tool-identifiers16901444
Ref: 4c2716901444
Node: Registering and using tools16902001
Ref: library/sys monitoring registering-and-using-tools16902081
Ref: 4c2a16902081
Ref: library/sys monitoring sys monitoring use_tool_id16902156
Ref: 4c2b16902156
Ref: library/sys monitoring sys monitoring clear_tool_id16902414
Ref: 1b6816902414
Ref: library/sys monitoring sys monitoring free_tool_id16902568
Ref: 4c2c16902568
Ref: library/sys monitoring sys monitoring get_tool16902776
Ref: 4c2d16902776
Node: Events16903280
Ref: library/sys monitoring events16903437
Ref: 4c2816903437
Ref: library/sys monitoring monitoring-event-BRANCH_LEFT16903507
Ref: 52216903507
Ref: library/sys monitoring monitoring-event-BRANCH_RIGHT16903836
Ref: 52316903836
Ref: library/sys monitoring monitoring-event-CALL16903933
Ref: 1be616903933
Ref: library/sys monitoring monitoring-event-C_RAISE16904043
Ref: 4c2e16904043
Ref: library/sys monitoring monitoring-event-C_RETURN16904205
Ref: 4c2f16904205
Ref: library/sys monitoring monitoring-event-EXCEPTION_HANDLED16904357
Ref: 28016904357
Ref: library/sys monitoring monitoring-event-INSTRUCTION16904451
Ref: 4c3016904451
Ref: library/sys monitoring monitoring-event-JUMP16904556
Ref: 4c3116904556
Ref: library/sys monitoring monitoring-event-LINE16904669
Ref: 4c3216904669
Ref: library/sys monitoring monitoring-event-PY_RESUME16904834
Ref: 4c3316904834
Ref: library/sys monitoring monitoring-event-PY_RETURN16905005
Ref: 4c3416905005
Ref: library/sys monitoring monitoring-event-PY_START16905182
Ref: 4c3516905182
Ref: library/sys monitoring monitoring-event-PY_THROW16905351
Ref: 27d16905351
Ref: library/sys monitoring monitoring-event-PY_UNWIND16905465
Ref: 27e16905465
Ref: library/sys monitoring monitoring-event-PY_YIELD16905701
Ref: 4c3616905701
Ref: library/sys monitoring monitoring-event-RAISE16905875
Ref: 27f16905875
Ref: library/sys monitoring monitoring-event-RERAISE16906022
Ref: 28116906022
Ref: library/sys monitoring monitoring-event-STOP_ITERATION16906168
Ref: 4c3716906168
Ref: library/sys monitoring monitoring-event-NO_EVENTS16906720
Ref: 4c3916906720
Node: Local events16907079
Ref: library/sys monitoring local-events16907159
Ref: 4c3a16907159
Ref: library/sys monitoring monitoring-event-local16907159
Ref: 4c3b16907159
Node: Deprecated event16907694
Ref: library/sys monitoring deprecated-event16907799
Ref: 4c3c16907799
Node: Ancillary events16908058
Ref: library/sys monitoring ancillary-events16908163
Ref: 4c3d16908163
Ref: library/sys monitoring monitoring-ancillary-events16908163
Ref: 4c3e16908163
Node: Other events16908585
Ref: library/sys monitoring monitoring-event-global16908698
Ref: 27c16908698
Ref: library/sys monitoring other-events16908698
Ref: 4c3f16908698
Node: The STOP_ITERATION event16909281
Ref: library/sys monitoring the-stop-iteration-event16909369
Ref: 4c3816909369
Ref: The STOP_ITERATION event-Footnote-116910316
Node: Turning events on and off16910397
Ref: library/sys monitoring turning-events-on-and-off16910568
Ref: 4c4016910568
Node: Setting events globally16911018
Ref: library/sys monitoring setting-events-globally16911134
Ref: 4c4116911134
Ref: library/sys monitoring sys monitoring get_events16911286
Ref: 4c4216911286
Ref: library/sys monitoring sys monitoring set_events16911417
Ref: 4c4316911417
Node: Per code object events16911668
Ref: library/sys monitoring per-code-object-events16911809
Ref: 4c4416911809
Ref: library/sys monitoring sys monitoring get_local_events16912138
Ref: 4c4516912138
Ref: library/sys monitoring sys monitoring set_local_events16912296
Ref: 4c4616912296
Node: Disabling events16912574
Ref: library/sys monitoring disabling-events16912683
Ref: 4c4716912683
Ref: library/sys monitoring sys monitoring DISABLE16912738
Ref: 28216912738
Ref: library/sys monitoring sys monitoring restart_events16913586
Ref: 4c4816913586
Node: Registering callback functions16913748
Ref: library/sys monitoring callbacks16913904
Ref: 4c2916913904
Ref: library/sys monitoring registering-callback-functions16913904
Ref: 4c4916913904
Ref: library/sys monitoring sys monitoring register_callback16913987
Ref: 49c716913987
Node: Callback function arguments16914953
Ref: library/sys monitoring callback-function-arguments16915047
Ref: 4c4a16915047
Ref: library/sys monitoring sys monitoring MISSING16915124
Ref: 4c4b16915124
Node: sysconfig --- Python の構成情報へのアクセスを提供する16917154
Ref: library/sysconfig doc16917410
Ref: 4c4c16917410
Ref: library/sysconfig module-sysconfig16917410
Ref: e416917410
Ref: library/sysconfig sysconfig-provide-access-to-python-s-configuration-information16917410
Ref: 4c4d16917410
Ref: library/sysconfig translation-repo16917410
Ref: 4c4e16917410
Ref: sysconfig --- Python の構成情報へのアクセスを提供する-Footnote-116918165
Node: 構成変数16918231
Ref: library/sysconfig configuration-variables16918382
Ref: 4c4f16918382
Ref: library/sysconfig sysconfig get_config_vars16918921
Ref: 52516918921
Ref: library/sysconfig sysconfig get_config_var16919340
Ref: 42516919340
Node: インストールパス16919805
Ref: library/sysconfig id116919976
Ref: 4c5016919976
Ref: library/sysconfig installation-paths16919976
Ref: 66316919976
Node: User scheme16922670
Ref: library/sysconfig sysconfig-user-scheme16922840
Ref: 234416922840
Ref: library/sysconfig user-scheme16922840
Ref: 4c5116922840
Node: posix_user16923365
Ref: library/sysconfig posix-user16923439
Ref: 4c5216923439
Node: nt_user16924297
Ref: library/sysconfig nt-user16924398
Ref: 4c5316924398
Node: osx_framework_user16925244
Ref: library/sysconfig osx-framework-user16925326
Ref: 4c5416925326
Node: Home scheme16926180
Ref: library/sysconfig home-scheme16926339
Ref: 4c5516926339
Ref: library/sysconfig sysconfig-home-scheme16926339
Ref: 4c5616926339
Node: posix_home16926996
Ref: library/sysconfig posix-home16927054
Ref: 4c5716927054
Node: Prefix scheme16927918
Ref: library/sysconfig prefix-scheme16928093
Ref: 4c5816928093
Ref: library/sysconfig sysconfig-prefix-scheme16928093
Ref: 4c5916928093
Node: posix_prefix16929691
Ref: library/sysconfig posix-prefix16929764
Ref: 4c5a16929764
Node: nt16930707
Ref: library/sysconfig nt16930780
Ref: 4c5b16930780
Node: Installation path functions16931635
Ref: library/sysconfig installation-path-functions16931820
Ref: 4c5c16931820
Ref: library/sysconfig sysconfig get_scheme_names16931977
Ref: 4c5d16931977
Ref: library/sysconfig sysconfig get_default_scheme16932112
Ref: 1dce16932112
Ref: library/sysconfig sysconfig get_preferred_scheme16932480
Ref: a8416932480
Ref: library/sysconfig sysconfig _get_preferred_schemes16933074
Ref: 4c5e16933074
Ref: library/sysconfig sysconfig get_path_names16933742
Ref: 4c5f16933742
Ref: library/sysconfig sysconfig get_path16933878
Ref: 16e716933878
Ref: library/sysconfig sysconfig get_paths16935407
Ref: 16016935407
Node: その他の関数<3>16936202
Ref: library/sysconfig other-functions16936410
Ref: 4c6016936410
Ref: library/sysconfig sysconfig get_python_version16936463
Ref: 15fe16936463
Ref: library/sysconfig sysconfig get_platform16936665
Ref: 15fd16936665
Ref: library/sysconfig sysconfig is_python_build16937837
Ref: 2e916937837
Ref: library/sysconfig sysconfig parse_config_h16938222
Ref: 4c6116938222
Ref: library/sysconfig sysconfig get_config_h_filename16938716
Ref: 4c6216938716
Ref: library/sysconfig sysconfig get_makefile_filename16938818
Ref: 4c6316938818
Ref: library/sysconfig sysconfig-cli16938917
Ref: 4c6416938917
Node: コマンドラインでの使用<7>16938918
Ref: library/sysconfig command-line-usage16939090
Ref: 4c6516939090
Ref: library/sysconfig using-sysconfig-as-a-script16939090
Ref: 4c6616939090
Node: builtins --- 組み込みオブジェクト16940158
Ref: library/builtins doc16940408
Ref: 4c6716940408
Ref: library/builtins builtins-built-in-objects16940408
Ref: 4c6816940408
Ref: library/builtins module-builtins16940408
Ref: 1316940408
Ref: library/builtins translation-repo16940408
Ref: 4c6916940408
Node: __main__ --- トップレベルのコード環境16942277
Ref: library/__main__ doc16942486
Ref: 4c6a16942486
Ref: library/__main__ main-top-level-code-environment16942486
Ref: 4c6b16942486
Ref: library/__main__ module-__main__16942486
Ref: 116942486
Ref: library/__main__ translation-repo16942486
Ref: 4c6c16942486
Node: __name__ == '__main__'16943515
Ref: library/__main__ name-equals-main16943662
Ref: 4c6d16943662
Ref: library/__main__ name-main16943662
Ref: 4c6e16943662
Node: 「トップレベルのスクリプト環境」とは16944693
Ref: library/__main__ what-is-the-top-level-code-environment16944836
Ref: 4c6f16944836
Node: 通常の使われ方16947451
Ref: library/__main__ idiomatic-usage16947645
Ref: 4c7016947645
Node: パッケージングで考慮すべき点16950182
Ref: library/__main__ packaging-considerations16950313
Ref: 4c7116950313
Ref: パッケージングで考慮すべき点-Footnote-116951830
Ref: パッケージングで考慮すべき点-Footnote-216951859
Node: __main__ py in Python Packages16951897
Ref: library/__main__ main-py-in-python-packages16952068
Ref: 4c7216952068
Node: 通常の使われ方<2>16953497
Ref: library/__main__ id116953588
Ref: 4c7316953588
Node: import __main__16954920
Ref: library/__main__ import-main16955060
Ref: 4c7416955060
Node: warnings --- 警告の制御16957942
Ref: library/warnings doc16958142
Ref: 4c7516958142
Ref: library/warnings module-warnings16958142
Ref: 11b16958142
Ref: library/warnings translation-repo16958142
Ref: 4c7616958142
Ref: library/warnings warnings-warning-control16958142
Ref: 4c7716958142
Ref: warnings --- 警告の制御-Footnote-116961202
Node: 警告カテゴリ16961270
Ref: library/warnings id116961380
Ref: 4c7b16961380
Ref: library/warnings warning-categories16961380
Ref: 292516961380
Node: 警告フィルタ16965995
Ref: library/warnings the-warnings-filter16966147
Ref: 4c7c16966147
Ref: library/warnings warning-filter16966147
Ref: 1d716966147
Node: Repeated Warning Suppression Criteria16970054
Ref: library/warnings id216970181
Ref: 4c7d16970181
Ref: library/warnings repeated-warning-suppression-criteria16970181
Ref: 4c7e16970181
Node: Describing Warning Filters16970816
Ref: library/warnings describing-warning-filters16970988
Ref: 233816970988
Ref: library/warnings id316970988
Ref: 4c7f16970988
Node: デフォルトの警告フィルタ16972704
Ref: library/warnings default-warning-filter16972868
Ref: 4c8016972868
Ref: library/warnings id416972868
Ref: 4c8116972868
Node: Overriding the default filter16974129
Ref: library/warnings overriding-the-default-filter16974258
Ref: 4c8216974258
Ref: library/warnings warning-disable16974258
Ref: 4c8316974258
Node: 一時的に警告を抑制する16975693
Ref: library/warnings temporarily-suppressing-warnings16975845
Ref: 4c8416975845
Ref: library/warnings warning-suppress16975845
Ref: 4c8516975845
Node: 警告のテスト16976920
Ref: library/warnings testing-warnings16977100
Ref: 4c8716977100
Ref: library/warnings warning-testing16977100
Ref: 4c8816977100
Node: Updating Code For New Versions of Dependencies16979353
Ref: library/warnings updating-code-for-new-versions-of-dependencies16979521
Ref: 4c8916979521
Ref: library/warnings warning-ignored16979521
Ref: 488616979521
Node: 利用可能な関数16980895
Ref: library/warnings available-functions16981096
Ref: 4c8a16981096
Ref: library/warnings warning-functions16981096
Ref: 4c8b16981096
Ref: library/warnings warnings warn16981154
Ref: 18d116981154
Ref: library/warnings warnings warn_explicit16983958
Ref: 2b616983958
Ref: library/warnings warnings showwarning16986218
Ref: 4c7a16986218
Ref: library/warnings warnings formatwarning16986998
Ref: 200616986998
Ref: library/warnings warnings filterwarnings16987523
Ref: 186116987523
Ref: library/warnings warnings simplefilter16988355
Ref: ab316988355
Ref: library/warnings warnings resetwarnings16988872
Ref: 4c7916988872
Ref: library/warnings warnings deprecated16989233
Ref: 69b16989233
Ref: 利用可能な関数-Footnote-116991107
Node: 利用可能なコンテキストマネージャー16991149
Ref: library/warnings available-context-managers16991341
Ref: 4c8c16991341
Ref: library/warnings warnings catch_warnings16991449
Ref: 42a16991449
Node: Concurrent safety of Context Managers16993229
Ref: library/warnings concurrent-safety-of-context-managers16993391
Ref: 4c8d16993391
Ref: library/warnings warning-concurrent-safe16993391
Ref: 4c8616993391
Node: dataclasses --- データクラス16996442
Ref: library/dataclasses doc16996658
Ref: 4c8e16996658
Ref: library/dataclasses dataclasses-data-classes16996658
Ref: 4c8f16996658
Ref: library/dataclasses module-dataclasses16996658
Ref: 3216996658
Ref: library/dataclasses translation-repo16996658
Ref: 4c9016996658
Ref: dataclasses --- データクラス-Footnote-116998650
Ref: dataclasses --- データクラス-Footnote-216998721
Ref: dataclasses --- データクラス-Footnote-316998763
Node: モジュールの内容<6>16998805
Ref: library/dataclasses module-contents16998933
Ref: 4c9116998933
Ref: library/dataclasses dataclasses dataclass16998994
Ref: 6ec16998994
Ref: library/dataclasses dataclasses field17009015
Ref: 196617009015
Ref: library/dataclasses dataclasses Field17013990
Ref: 1b8d17013990
Ref: library/dataclasses dataclasses InitVar17014810
Ref: 1dcd17014810
Ref: library/dataclasses dataclasses fields17015221
Ref: 1b6e17015221
Ref: library/dataclasses dataclasses asdict17015754
Ref: 192e17015754
Ref: library/dataclasses dataclasses astuple17016810
Ref: 192f17016810
Ref: library/dataclasses dataclasses make_dataclass17017555
Ref: 190d17017555
Ref: library/dataclasses dataclasses replace17020015
Ref: 1c8f17020015
Ref: library/dataclasses dataclasses is_dataclass17021509
Ref: 1e2d17021509
Ref: library/dataclasses dataclasses MISSING17022132
Ref: 192717022132
Ref: library/dataclasses dataclasses KW_ONLY17022283
Ref: 192817022283
Ref: library/dataclasses dataclasses FrozenInstanceError17023240
Ref: 193017023240
Ref: モジュールの内容<6>-Footnote-117023618
Node: 初期化後の処理17023673
Ref: library/dataclasses id117023825
Ref: 4c9517023825
Ref: library/dataclasses post-init-processing17023825
Ref: 4c9617023825
Ref: library/dataclasses dataclasses __post_init__17023881
Ref: 4c9417023881
Node: クラス変数17025813
Ref: library/dataclasses class-variables17025959
Ref: 4c9717025959
Ref: library/dataclasses dataclasses-class-variables17025959
Ref: 4c9817025959
Ref: クラス変数-Footnote-117026512
Node: 初期化限定変数17026554
Ref: library/dataclasses dataclasses-init-only-variables17026712
Ref: 4c9317026712
Ref: library/dataclasses init-only-variables17026712
Ref: 4c9917026712
Node: 凍結されたインスタンス17028000
Ref: library/dataclasses dataclasses-frozen17028152
Ref: 4c9217028152
Ref: library/dataclasses frozen-instances17028152
Ref: 4c9a17028152
Node: 継承<2>17028772
Ref: library/dataclasses dataclasses-inheritance17028953
Ref: 4c9b17028953
Ref: library/dataclasses inheritance17028953
Ref: 4c9c17028953
Node: Re-ordering of keyword-only parameters in __init__17029995
Ref: library/dataclasses re-ordering-of-keyword-only-parameters-in-init17030179
Ref: 4c9d17030179
Node: デフォルトファクトリ関数17031649
Ref: library/dataclasses default-factory-functions17031851
Ref: 4c9e17031851
Node: 可変なデフォルト値17032479
Ref: library/dataclasses mutable-default-values17032654
Ref: 4c9f17032654
Node: Descriptor-typed fields17034897
Ref: library/dataclasses descriptor-typed-fields17035027
Ref: 4ca017035027
Node: contextlib --- with 文コンテキスト用ユーティリティ17036996
Ref: library/contextlib doc17037213
Ref: 4ca117037213
Ref: library/contextlib contextlib-utilities-for-with-statement-contexts17037213
Ref: 4ca217037213
Ref: library/contextlib module-contextlib17037213
Ref: 2717037213
Ref: library/contextlib translation-repo17037213
Ref: 4ca317037213
Ref: contextlib --- with 文コンテキスト用ユーティリティ-Footnote-117037985
Node: ユーティリティ17038055
Ref: library/contextlib utilities17038205
Ref: 4ca417038205
Ref: library/contextlib contextlib AbstractContextManager17038315
Ref: 105117038315
Ref: library/contextlib contextlib AbstractAsyncContextManager17038784
Ref: eef17038784
Ref: library/contextlib contextlib contextmanager17039299
Ref: 21917039299
Ref: library/contextlib contextlib asynccontextmanager17043182
Ref: 21a17043182
Ref: library/contextlib contextlib closing17045786
Ref: 3f317045786
Ref: library/contextlib contextlib aclosing17047182
Ref: bcd17047182
Ref: library/contextlib simplifying-support-for-single-optional-context-managers17048612
Ref: 4ca517048612
Ref: library/contextlib contextlib nullcontext17048612
Ref: bce17048612
Ref: library/contextlib contextlib suppress17050434
Ref: 12d717050434
Ref: library/contextlib contextlib redirect_stdout17052121
Ref: 11a317052121
Ref: library/contextlib contextlib redirect_stderr17053970
Ref: 11a217053970
Ref: library/contextlib contextlib chdir17054306
Ref: a0617054306
Ref: library/contextlib contextlib ContextDecorator17055403
Ref: 21717055403
Ref: library/contextlib contextlib AsyncContextDecorator17059211
Ref: 21817059211
Ref: library/contextlib contextlib ExitStack17061208
Ref: 21317061208
Ref: library/contextlib contextlib ExitStack enter_context17063435
Ref: 9d517063435
Ref: library/contextlib contextlib ExitStack push17064243
Ref: 4ca717064243
Ref: library/contextlib contextlib ExitStack callback17065265
Ref: e4917065265
Ref: library/contextlib contextlib ExitStack pop_all17065754
Ref: 4ca817065754
Ref: library/contextlib contextlib ExitStack close17066886
Ref: 4ca917066886
Ref: library/contextlib contextlib AsyncExitStack17067241
Ref: 21417067241
Ref: library/contextlib contextlib AsyncExitStack enter_async_context17067705
Ref: 9d617067705
Ref: library/contextlib contextlib AsyncExitStack push_async_exit17068242
Ref: 4cab17068242
Ref: library/contextlib contextlib AsyncExitStack push_async_callback17068539
Ref: e4a17068539
Ref: library/contextlib contextlib AsyncExitStack aclose17068711
Ref: 4caa17068711
Node: 例とレシピ<3>17069327
Ref: library/contextlib examples-and-recipes17069585
Ref: 4cac17069585
Node: 可変数個のコンテキストマネージャーをサポートする17070090
Ref: library/contextlib supporting-a-variable-number-of-context-managers17070284
Ref: 4cad17070284
Node: __enter__ メソッドからの例外をキャッチする17071608
Ref: library/contextlib catching-exceptions-from-enter-methods17071854
Ref: 4cae17071854
Node: __enter__ 実装内のクリーンアップ17073213
Ref: library/contextlib cleaning-up-in-an-enter-implementation17073442
Ref: 4caf17073442
Node: try-finally + flag 変数パターンを置き換える17075406
Ref: library/contextlib replacing-any-use-of-try-finally-and-flag-variables17075655
Ref: 4cb017075655
Node: コンテキストマネージャーを関数デコレーターとして使う17078438
Ref: library/contextlib using-a-context-manager-as-a-function-decorator17078635
Ref: 4cb117078635
Ref: コンテキストマネージャーを関数デコレーターとして使う-Footnote-117080666
Node: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ17080708
Ref: library/contextlib single-use-reusable-and-reentrant-cms17080936
Ref: 12d917080936
Ref: library/contextlib single-use-reusable-and-reentrant-context-managers17080936
Ref: 4cb217080936
Node: リエントラントなコンテキストマネージャ17082900
Ref: library/contextlib reentrant-cms17083153
Ref: 4ca617083153
Ref: library/contextlib reentrant-context-managers17083153
Ref: 4cb317083153
Node: 再利用可能なコンテキストマネージャ17085126
Ref: library/contextlib reusable-cms17085379
Ref: 4cb417085379
Ref: library/contextlib reusable-context-managers17085379
Ref: 4cb517085379
Node: abc --- 抽象基底クラス17088682
Ref: library/abc doc17088897
Ref: 4cb617088897
Ref: library/abc abc-abstract-base-classes17088897
Ref: 4cb717088897
Ref: library/abc module-abc17088897
Ref: 417088897
Ref: library/abc translation-repo17088897
Ref: 4cb817088897
Ref: library/abc abc ABC17090247
Ref: 12cc17090247
Ref: library/abc abc ABCMeta17091157
Ref: 12cd17091157
Ref: library/abc abc ABCMeta register17092130
Ref: 144517092130
Ref: library/abc abc ABCMeta __subclasshook__17092935
Ref: 2bc517092935
Ref: library/abc abc abstractmethod17095890
Ref: 144217095890
Ref: library/abc abc abstractclassmethod17099104
Ref: 144317099104
Ref: library/abc abc abstractstaticmethod17099962
Ref: 144417099962
Ref: library/abc abc abstractproperty17100818
Ref: 144117100818
Ref: library/abc abc get_cache_token17102514
Ref: 12cb17102514
Ref: library/abc abc update_abstractmethods17103011
Ref: 4cb917103011
Ref: abc --- 抽象基底クラス-Footnote-117103676
Ref: abc --- 抽象基底クラス-Footnote-217103739
Ref: abc --- 抽象基底クラス-Footnote-317103781
Ref: abc --- 抽象基底クラス-Footnote-417103823
Node: atexit --- 終了ハンドラー17103979
Ref: library/atexit doc17104191
Ref: 4cba17104191
Ref: library/atexit atexit-exit-handlers17104191
Ref: 4cbb17104191
Ref: library/atexit module-atexit17104191
Ref: d17104191
Ref: library/atexit translation-repo17104191
Ref: 4cbc17104191
Ref: library/atexit atexit register17105388
Ref: c5817105388
Ref: library/atexit atexit unregister17107444
Ref: 19a117107444
Node: atexit Example17108123
Ref: library/atexit atexit-example17108206
Ref: 4cbd17108206
Ref: library/atexit id117108206
Ref: 4cbe17108206
Node: traceback --- スタックトレースの表示または取得17109665
Ref: library/traceback doc17109882
Ref: 4cbf17109882
Ref: library/traceback module-traceback17109882
Ref: 10717109882
Ref: library/traceback traceback-print-or-retrieve-a-stack-traceback17109882
Ref: 4cc017109882
Ref: library/traceback translation-repo17109882
Ref: 4cc117109882
Ref: traceback --- スタックトレースの表示または取得-Footnote-117112088
Node: モジュールレベルの関数<2>17112157
Ref: library/traceback module-level-functions17112338
Ref: 4cc217112338
Ref: library/traceback traceback print_tb17112416
Ref: 123917112416
Ref: library/traceback traceback print_exception17113388
Ref: c2b17113388
Ref: library/traceback traceback print_exc17115100
Ref: 1e3a17115100
Ref: library/traceback traceback print_last17115284
Ref: 4cc317115284
Ref: library/traceback traceback print_stack17115597
Ref: 123a17115597
Ref: library/traceback traceback extract_tb17116360
Ref: 4cc417116360
Ref: library/traceback traceback extract_stack17117188
Ref: 4cc917117188
Ref: library/traceback traceback print_list17117546
Ref: 1b2e17117546
Ref: library/traceback traceback format_list17117850
Ref: 4cca17117850
Ref: library/traceback traceback format_exception_only17118544
Ref: c2a17118544
Ref: library/traceback traceback format_exception17119958
Ref: c2917119958
Ref: library/traceback traceback format_exc17120778
Ref: 4ccb17120778
Ref: library/traceback traceback format_tb17120978
Ref: 4b9117120978
Ref: library/traceback traceback format_stack17121103
Ref: 4ccc17121103
Ref: library/traceback traceback clear_frames17121237
Ref: 138217121237
Ref: library/traceback traceback walk_stack17121483
Ref: 123517121483
Ref: library/traceback traceback walk_tb17122040
Ref: 123617122040
Node: TracebackException オブジェクト17122283
Ref: library/traceback tracebackexception-objects17122504
Ref: 4cce17122504
Ref: library/traceback traceback TracebackException17123003
Ref: 76a17123003
Ref: library/traceback traceback TracebackException __cause__17124413
Ref: 4cd017124413
Ref: library/traceback traceback TracebackException __context__17124520
Ref: 4ccf17124520
Ref: library/traceback traceback TracebackException exceptions17124631
Ref: 4cd217124631
Ref: library/traceback traceback TracebackException __suppress_context__17124910
Ref: 4cd117124910
Ref: library/traceback traceback TracebackException __notes__17125025
Ref: 4cd317125025
Ref: library/traceback traceback TracebackException stack17125335
Ref: 4cd417125335
Ref: library/traceback traceback TracebackException exc_type17125433
Ref: 76b17125433
Ref: library/traceback traceback TracebackException exc_type_str17125566
Ref: 76917125566
Ref: library/traceback traceback TracebackException filename17125700
Ref: 4cd517125700
Ref: library/traceback traceback TracebackException lineno17125811
Ref: 4cd617125811
Ref: library/traceback traceback TracebackException end_lineno17125908
Ref: 4cd717125908
Ref: library/traceback traceback TracebackException text17126096
Ref: 4cd817126096
Ref: library/traceback traceback TracebackException offset17126194
Ref: 4cd917126194
Ref: library/traceback traceback TracebackException end_offset17126315
Ref: 4cda17126315
Ref: library/traceback traceback TracebackException msg17126512
Ref: 4cdb17126512
Ref: library/traceback traceback TracebackException from_exception17126615
Ref: 4cdc17126615
Ref: library/traceback traceback TracebackException print17127105
Ref: a9717127105
Ref: library/traceback traceback TracebackException format17127319
Ref: 4cdd17127319
Ref: library/traceback traceback TracebackException format_exception_only17127832
Ref: 76c17127832
Node: StackSummary オブジェクト17128941
Ref: library/traceback stacksummary-objects17129157
Ref: 4cde17129157
Ref: library/traceback traceback StackSummary17129385
Ref: 123717129385
Ref: library/traceback traceback StackSummary extract17129424
Ref: 4ccd17129424
Ref: library/traceback traceback StackSummary from_list17130442
Ref: 4cdf17130442
Ref: library/traceback traceback StackSummary format17130753
Ref: 4ce017130753
Ref: library/traceback traceback StackSummary format_frame_summary17131398
Ref: a9617131398
Node: FrameSummary オブジェクト17131809
Ref: library/traceback framesummary-objects17132032
Ref: 4ce117132032
Ref: library/traceback traceback FrameSummary17132236
Ref: 123817132236
Ref: library/traceback traceback FrameSummary filename17133160
Ref: 4cc517133160
Ref: library/traceback traceback FrameSummary lineno17133363
Ref: 4cc617133363
Ref: library/traceback traceback FrameSummary name17133453
Ref: 4cc717133453
Ref: library/traceback traceback FrameSummary line17133589
Ref: 4cc817133589
Ref: library/traceback traceback FrameSummary end_lineno17133798
Ref: 4ce217133798
Ref: library/traceback traceback FrameSummary colno17134088
Ref: 4ce317134088
Ref: library/traceback traceback FrameSummary end_colno17134249
Ref: 4ce417134249
Node: Examples of Using the Module-Level Functions17134419
Ref: library/traceback examples-of-using-the-module-level-functions17134647
Ref: 4ce517134647
Ref: library/traceback traceback-example17134647
Ref: 4ce617134647
Node: Examples of Using TracebackException17140208
Ref: library/traceback examples-of-using-tracebackexception17140396
Ref: 4ce717140396
Node: __future__ --- future 文の定義17143052
Ref: library/__future__ doc17143295
Ref: 4ce817143295
Ref: library/__future__ future-future-statement-definitions17143295
Ref: 4ce917143295
Ref: library/__future__ module-__future__17143295
Ref: 017143295
Ref: library/__future__ translation-repo17143295
Ref: 4cea17143295
Ref: __future__ --- future 文の定義-Footnote-117144964
Node: モジュールコンテンツ<3>17145034
Ref: library/__future__ module-contents17145138
Ref: 4ceb17145138
Ref: library/__future__ future__ nested_scopes17145815
Ref: 4cec17145815
Ref: library/__future__ future__ generators17146219
Ref: 4ced17146219
Ref: library/__future__ future__ division17146616
Ref: 4cee17146616
Ref: library/__future__ future__ absolute_import17147026
Ref: 4cef17147026
Ref: library/__future__ future__ with_statement17147537
Ref: 4cf017147537
Ref: library/__future__ future__ print_function17147941
Ref: 4cf117147941
Ref: library/__future__ future__ unicode_literals17148343
Ref: 4cf217148343
Ref: library/__future__ future__ generator_stop17148753
Ref: 4cf317148753
Ref: library/__future__ future__ annotations17149173
Ref: 4cf417149173
Ref: library/__future__ future-classes17149824
Ref: 4cf517149824
Ref: library/__future__ future__ _Feature17149824
Ref: 27e017149824
Ref: library/__future__ future__ _Feature getOptionalRelease17150558
Ref: 4cf617150558
Ref: library/__future__ future__ _Feature getMandatoryRelease17150714
Ref: 4cf717150714
Ref: library/__future__ future__ _Feature compiler_flag17151462
Ref: 25a617151462
Ref: モジュールコンテンツ<3>-Footnote-117152117
Ref: モジュールコンテンツ<3>-Footnote-217152159
Ref: モジュールコンテンツ<3>-Footnote-317152201
Ref: モジュールコンテンツ<3>-Footnote-417152243
Ref: モジュールコンテンツ<3>-Footnote-517152285
Ref: モジュールコンテンツ<3>-Footnote-617152327
Ref: モジュールコンテンツ<3>-Footnote-717152369
Ref: モジュールコンテンツ<3>-Footnote-817152411
Ref: モジュールコンテンツ<3>-Footnote-917152453
Ref: モジュールコンテンツ<3>-Footnote-1017152770
Ref: モジュールコンテンツ<3>-Footnote-1117152813
Ref: モジュールコンテンツ<3>-Footnote-1217152856
Node: gc --- ガベージコレクターインターフェース17152899
Ref: library/gc doc17153137
Ref: 4cf817153137
Ref: library/gc gc-garbage-collector-interface17153137
Ref: 4cf917153137
Ref: library/gc module-gc17153137
Ref: 6317153137
Ref: library/gc translation-repo17153137
Ref: 4cfa17153137
Ref: library/gc gc enable17154347
Ref: 4cfb17154347
Ref: library/gc gc disable17154443
Ref: 4cfc17154443
Ref: library/gc gc isenabled17154540
Ref: 4cfd17154540
Ref: library/gc gc collect17154660
Ref: 45617154660
Ref: library/gc gc set_debug17155625
Ref: 4cfe17155625
Ref: library/gc gc get_debug17155908
Ref: 4cff17155908
Ref: library/gc gc get_objects17155995
Ref: be117155995
Ref: library/gc gc get_stats17156624
Ref: 55e17156624
Ref: library/gc gc set_threshold17157691
Ref: 55c17157691
Ref: library/gc gc get_count17159169
Ref: 55d17159169
Ref: library/gc gc get_threshold17159294
Ref: 55b17159294
Ref: library/gc gc get_referrers17159444
Ref: be217159444
Ref: library/gc gc get_referents17160761
Ref: be317160761
Ref: library/gc gc is_tracked17161772
Ref: 16c717161772
Ref: library/gc gc is_finalized17162824
Ref: cd117162824
Ref: library/gc gc freeze17163337
Ref: efc17163337
Ref: library/gc gc unfreeze17164171
Ref: efd17164171
Ref: library/gc gc get_freeze_count17164360
Ref: efe17164360
Ref: library/gc gc garbage17164686
Ref: 157f17164686
Ref: library/gc gc callbacks17165807
Ref: 148817165807
Ref: library/gc gc DEBUG_STATS17167769
Ref: 4d0117167769
Ref: library/gc gc DEBUG_COLLECTABLE17167927
Ref: 4d0217167927
Ref: library/gc gc DEBUG_UNCOLLECTABLE17168046
Ref: 158017168046
Ref: library/gc gc DEBUG_SAVEALL17168575
Ref: 4d0017168575
Ref: library/gc gc DEBUG_LEAK17168841
Ref: 4d0317168841
Ref: gc --- ガベージコレクターインターフェース-Footnote-117169087
Ref: gc --- ガベージコレクターインターフェース-Footnote-217169243
Ref: gc --- ガベージコレクターインターフェース-Footnote-317169330
Node: inspect --- 活動中のオブジェクトを調査する17169372
Ref: library/inspect doc17169637
Ref: 4d0417169637
Ref: library/inspect inspect-inspect-live-objects17169637
Ref: 4d0517169637
Ref: library/inspect translation-repo17169637
Ref: 4d0617169637
Ref: library/inspect module-inspect17169761
Ref: 8117169761
Ref: inspect --- 活動中のオブジェクトを調査する-Footnote-117171128
Node: 型とメンバー17171195
Ref: library/inspect inspect-types17171349
Ref: 1fa217171349
Ref: library/inspect types-and-members17171349
Ref: 4d0717171349
Ref: library/inspect inspect getmembers17193727
Ref: 1e0817193727
Ref: library/inspect inspect getmembers_static17194502
Ref: a3d17194502
Ref: library/inspect inspect getmodulename17195582
Ref: 10f417195582
Ref: library/inspect inspect ismodule17196545
Ref: 4d0917196545
Ref: library/inspect inspect isclass17196669
Ref: 4d0a17196669
Ref: library/inspect inspect ismethod17196947
Ref: 4d0b17196947
Ref: library/inspect inspect isfunction17198327
Ref: 4d0c17198327
Ref: library/inspect inspect ispackage17198583
Ref: 4c717198583
Ref: library/inspect inspect isgeneratorfunction17198718
Ref: 1d7817198718
Ref: library/inspect inspect isgenerator17199533
Ref: 4d0d17199533
Ref: library/inspect inspect iscoroutinefunction17199663
Ref: 15417199663
Ref: library/inspect inspect markcoroutinefunction17200860
Ref: 8a617200860
Ref: library/inspect inspect iscoroutine17201684
Ref: 11ce17201684
Ref: library/inspect inspect isawaitable17201899
Ref: 11cf17201899
Ref: library/inspect inspect isasyncgenfunction17202431
Ref: 1d7917202431
Ref: library/inspect inspect isasyncgen17203273
Ref: 4d0e17203273
Ref: library/inspect inspect istraceback17203548
Ref: 4d0f17203548
Ref: library/inspect inspect isframe17203684
Ref: 4d1017203684
Ref: library/inspect inspect iscode17203807
Ref: 4d1117203807
Ref: library/inspect inspect isbuiltin17203926
Ref: 4d1217203926
Ref: library/inspect inspect ismethodwrapper17204104
Ref: a3e17204104
Ref: library/inspect inspect isroutine17204476
Ref: 1df517204476
Ref: library/inspect inspect isabstract17204654
Ref: 4d1317204654
Ref: library/inspect inspect ismethoddescriptor17204795
Ref: 1b8217204795
Ref: library/inspect inspect isdatadescriptor17206602
Ref: 4d1417206602
Ref: library/inspect inspect isgetsetdescriptor17207574
Ref: 4d1517207574
Ref: library/inspect inspect ismemberdescriptor17207986
Ref: 4d1617207986
Node: ソースコードの情報取得17208423
Ref: library/inspect inspect-source17208668
Ref: 4d1717208668
Ref: library/inspect retrieving-source-code17208668
Ref: 4d1817208668
Ref: library/inspect inspect getdoc17208746
Ref: 23717208746
Ref: library/inspect inspect getcomments17209955
Ref: 1b7117209955
Ref: library/inspect inspect getfile17210560
Ref: 209117210560
Ref: library/inspect inspect getmodule17210869
Ref: 1d8917210869
Ref: library/inspect inspect getsourcefile17211084
Ref: 1d8a17211084
Ref: library/inspect inspect getsourcelines17211442
Ref: 1a1317211442
Ref: library/inspect inspect getsource17212463
Ref: 1a2417212463
Ref: library/inspect inspect cleandoc17213316
Ref: 1c5317213316
Node: Signature オブジェクトで呼び出し可能オブジェクトを内省する17213773
Ref: library/inspect inspect-signature-object17214021
Ref: 4d1917214021
Ref: library/inspect introspecting-callables-with-the-signature-object17214021
Ref: 4d1a17214021
Ref: library/inspect inspect signature17214491
Ref: 4c417214491
Ref: library/inspect inspect Signature17218822
Ref: 6ee17218822
Ref: library/inspect inspect Signature empty17220524
Ref: 4d1d17220524
Ref: library/inspect inspect Signature parameters17220671
Ref: 4d1b17220671
Ref: library/inspect inspect Signature return_annotation17221296
Ref: 4d1e17221296
Ref: library/inspect inspect Signature bind17221605
Ref: 1ad517221605
Ref: library/inspect inspect Signature bind_partial17222020
Ref: 4d1f17222020
Ref: library/inspect inspect Signature replace17222486
Ref: 4d1c17222486
Ref: library/inspect inspect Signature format17223560
Ref: 4c617223560
Ref: library/inspect inspect Signature from_callable17224678
Ref: b2517224678
Ref: library/inspect inspect Parameter17225620
Ref: 6ef17225620
Ref: library/inspect inspect Parameter empty17226285
Ref: 4d2117226285
Ref: library/inspect inspect Parameter name17226446
Ref: 4d2217226446
Ref: library/inspect inspect Parameter default17227037
Ref: 4d2317227037
Ref: library/inspect inspect Parameter annotation17227239
Ref: 4d2417227239
Ref: library/inspect inspect Parameter kind17227450
Ref: 4d2517227450
Ref: library/inspect inspect Parameter kind description17230413
Ref: 4d2617230413
Ref: library/inspect inspect Parameter replace17230991
Ref: 4d2017230991
Ref: library/inspect inspect BoundArguments17232449
Ref: 142017232449
Ref: library/inspect inspect BoundArguments arguments17232716
Ref: cdf17232716
Ref: library/inspect inspect BoundArguments args17233802
Ref: 4d2717233802
Ref: library/inspect inspect BoundArguments kwargs17233954
Ref: 4d2817233954
Ref: library/inspect inspect BoundArguments signature17234252
Ref: 4d2917234252
Ref: library/inspect inspect BoundArguments apply_defaults17234363
Ref: 11cd17234363
Ref: Signature オブジェクトで呼び出し可能オブジェクトを内省する-Footnote-117235474
Node: クラスと関数<2>17235516
Ref: library/inspect classes-and-functions17235764
Ref: 4d2a17235764
Ref: library/inspect inspect-classes-functions17235764
Ref: 4d2b17235764
Ref: library/inspect inspect getclasstree17235817
Ref: 4d2c17235817
Ref: library/inspect inspect getfullargspec17236462
Ref: b2417236462
Ref: library/inspect inspect getargvalues17240006
Ref: 127017240006
Ref: library/inspect inspect formatargvalues17240630
Ref: 127117240630
Ref: library/inspect inspect getmro17241129
Ref: 4d2d17241129
Ref: library/inspect inspect getcallargs17241612
Ref: 126f17241612
Ref: library/inspect inspect getclosurevars17243155
Ref: 149517243155
Ref: library/inspect inspect unwrap17244165
Ref: 130b17244165
Ref: library/inspect inspect get_annotations17245283
Ref: bf017245283
Node: インタープリタスタック17246150
Ref: library/inspect inspect-stack17246346
Ref: 4d2e17246346
Ref: library/inspect the-interpreter-stack17246346
Ref: 4d2f17246346
Ref: library/inspect inspect FrameInfo17246790
Ref: a4017246790
Ref: library/inspect inspect FrameInfo frame17246824
Ref: 4d3017246824
Ref: library/inspect inspect FrameInfo filename17246949
Ref: 4d3117246949
Ref: library/inspect inspect FrameInfo lineno17247110
Ref: 4d3217247110
Ref: library/inspect inspect FrameInfo function17247281
Ref: 4d3317247281
Ref: library/inspect inspect FrameInfo code_context17247413
Ref: 4d3417247413
Ref: library/inspect inspect FrameInfo index17247629
Ref: 4d3517247629
Ref: library/inspect inspect FrameInfo positions17247783
Ref: 4d3617247783
Ref: library/inspect inspect Traceback17248453
Ref: a4117248453
Ref: library/inspect inspect Traceback filename17248487
Ref: 4d3717248487
Ref: library/inspect inspect Traceback lineno17248657
Ref: 4d3817248657
Ref: library/inspect inspect Traceback function17248837
Ref: 4d3917248837
Ref: library/inspect inspect Traceback code_context17248989
Ref: 4d3a17248989
Ref: library/inspect inspect Traceback index17249214
Ref: 4d3b17249214
Ref: library/inspect inspect Traceback positions17249368
Ref: 4d3c17249368
Ref: library/inspect inspect getframeinfo17251601
Ref: a4317251601
Ref: library/inspect inspect getouterframes17251984
Ref: a4417251984
Ref: library/inspect inspect getinnerframes17252845
Ref: a4517252845
Ref: library/inspect inspect currentframe17253644
Ref: ad417253644
Ref: library/inspect inspect stack17254081
Ref: a4617254081
Ref: library/inspect inspect trace17254747
Ref: a4717254747
Node: 属性の静的なフェッチ17255421
Ref: library/inspect fetching-attributes-statically17255662
Ref: 4d3d17255662
Ref: library/inspect inspect getattr_static17256416
Ref: 8aa17256416
Node: Current State of Generators Coroutines and Asynchronous Generators17258222
Ref: library/inspect current-state-of-generators-coroutines-and-asynchronous-generators17258452
Ref: 4d3e17258452
Ref: library/inspect inspect getgeneratorstate17258934
Ref: 15f117258934
Ref: library/inspect inspect getcoroutinestate17259414
Ref: 11d117259414
Ref: library/inspect inspect getasyncgenstate17260060
Ref: 8a817260060
Ref: library/inspect inspect getgeneratorlocals17260990
Ref: 149617260990
Ref: library/inspect inspect getcoroutinelocals17261856
Ref: 11d017261856
Ref: library/inspect inspect getasyncgenlocals17262095
Ref: 8a917262095
Node: Code Objects Bit Flags17262384
Ref: library/inspect code-objects-bit-flags17262596
Ref: 4d3f17262596
Ref: library/inspect inspect-module-co-flags17262596
Ref: 25a517262596
Ref: library/inspect inspect CO_OPTIMIZED17262766
Ref: 4d4017262766
Ref: library/inspect inspect CO_NEWLOCALS17262858
Ref: 4d4117262858
Ref: library/inspect inspect CO_VARARGS17263012
Ref: 4d4217263012
Ref: library/inspect inspect CO_VARKEYWORDS17263125
Ref: 4d4317263125
Ref: library/inspect inspect CO_NESTED17263242
Ref: 4d4417263242
Ref: library/inspect inspect CO_GENERATOR17263341
Ref: 4d4517263341
Ref: library/inspect inspect CO_COROUTINE17263521
Ref: 4d4617263521
Ref: library/inspect inspect CO_ITERABLE_COROUTINE17263763
Ref: 4d4717263763
Ref: library/inspect inspect CO_ASYNC_GENERATOR17264083
Ref: 4d4817264083
Ref: library/inspect inspect CO_HAS_DOCSTRING17264359
Ref: 25a717264359
Ref: library/inspect inspect CO_METHOD17264588
Ref: 4d4917264588
Ref: Code Objects Bit Flags-Footnote-117265108
Ref: Code Objects Bit Flags-Footnote-217265150
Ref: Code Objects Bit Flags-Footnote-317265192
Node: Buffer flags17265234
Ref: library/inspect buffer-flags17265432
Ref: 4d4a17265432
Ref: library/inspect inspect BufferFlags17265479
Ref: 87f17265479
Ref: library/inspect inspect BufferFlags SIMPLE17265813
Ref: 4d4b17265813
Ref: library/inspect inspect BufferFlags WRITABLE17265841
Ref: 4d4c17265841
Ref: library/inspect inspect BufferFlags FORMAT17265871
Ref: 4d4d17265871
Ref: library/inspect inspect BufferFlags ND17265899
Ref: 4d4e17265899
Ref: library/inspect inspect BufferFlags STRIDES17265923
Ref: 4d4f17265923
Ref: library/inspect inspect BufferFlags C_CONTIGUOUS17265952
Ref: 4d5017265952
Ref: library/inspect inspect BufferFlags F_CONTIGUOUS17265986
Ref: 4d5117265986
Ref: library/inspect inspect BufferFlags ANY_CONTIGUOUS17266020
Ref: 4d5217266020
Ref: library/inspect inspect BufferFlags INDIRECT17266056
Ref: 4d5317266056
Ref: library/inspect inspect BufferFlags CONTIG17266086
Ref: 4d5417266086
Ref: library/inspect inspect BufferFlags CONTIG_RO17266114
Ref: 4d5517266114
Ref: library/inspect inspect BufferFlags STRIDED17266145
Ref: 4d5617266145
Ref: library/inspect inspect BufferFlags STRIDED_RO17266174
Ref: 4d5717266174
Ref: library/inspect inspect BufferFlags RECORDS17266206
Ref: 4d5817266206
Ref: library/inspect inspect BufferFlags RECORDS_RO17266235
Ref: 4d5917266235
Ref: library/inspect inspect BufferFlags FULL17266267
Ref: 4d5a17266267
Ref: library/inspect inspect BufferFlags FULL_RO17266293
Ref: 4d5b17266293
Ref: library/inspect inspect BufferFlags READ17266322
Ref: 1b3317266322
Ref: library/inspect inspect BufferFlags WRITE17266348
Ref: 1b3417266348
Node: コマンドライン・インターフェース<11>17266404
Ref: library/inspect command-line-interface17266571
Ref: 4d5c17266571
Ref: library/inspect inspect-module-cli17266571
Ref: 130a17266571
Ref: library/inspect cmdoption-inspect-details17266980
Ref: 4d5d17266980
Node: annotationlib --- Functionality for introspecting annotations17267364
Ref: library/annotationlib doc17267613
Ref: 4d5e17267613
Ref: library/annotationlib annotationlib-functionality-for-introspecting-annotations17267613
Ref: 4d5f17267613
Ref: library/annotationlib module-annotationlib17267613
Ref: 617267613
Ref: library/annotationlib translation-repo17267613
Ref: 4d6017267613
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-117270624
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-217270697
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-317270739
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-417270781
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-517270823
Node: Annotation semantics17270875
Ref: library/annotationlib annotation-semantics17271014
Ref: 4d6117271014
Ref: Annotation semantics-Footnote-117273663
Ref: Annotation semantics-Footnote-217273705
Ref: Annotation semantics-Footnote-317273747
Ref: Annotation semantics-Footnote-417273789
Ref: Annotation semantics-Footnote-517273831
Ref: Annotation semantics-Footnote-617273873
Ref: Annotation semantics-Footnote-717273915
Ref: Annotation semantics-Footnote-817273957
Ref: Annotation semantics-Footnote-917273999
Node: クラス<5>17274041
Ref: library/annotationlib classes17274199
Ref: 4d6217274199
Ref: library/annotationlib annotationlib Format17274237
Ref: 4c517274237
Ref: library/annotationlib annotationlib Format VALUE17274577
Ref: 41217274577
Ref: library/annotationlib annotationlib Format VALUE_WITH_FAKE_GLOBALS17274693
Ref: 4d6317274693
Ref: library/annotationlib annotationlib Format FORWARDREF17275266
Ref: 41317275266
Ref: library/annotationlib annotationlib Format STRING17275568
Ref: 41417275568
Ref: library/annotationlib annotationlib ForwardRef17275960
Ref: 198817275960
Ref: library/annotationlib annotationlib ForwardRef __forward_arg__17276352
Ref: 4d6417276352
Ref: library/annotationlib annotationlib ForwardRef evaluate17276567
Ref: 15117276567
Node: 関数<12>17279617
Ref: library/annotationlib functions17279767
Ref: 4d6517279767
Ref: library/annotationlib annotationlib annotations_to_string17279800
Ref: 4d6617279800
Ref: library/annotationlib annotationlib call_annotate_function17280644
Ref: 19ef17280644
Ref: library/annotationlib annotationlib call_evaluate_function17281870
Ref: 474e17281870
Ref: library/annotationlib annotationlib get_annotate_from_class_namespace17283786
Ref: 67517283786
Ref: library/annotationlib annotationlib get_annotations17284349
Ref: 67317284349
Ref: library/annotationlib annotationlib type_repr17289685
Ref: 1a9e17289685
Ref: 関数<12>-Footnote-117290377
Node: レシピ<3>17290468
Ref: library/annotationlib recipes17290638
Ref: 4d6817290638
Node: Using annotations in a metaclass17290772
Ref: library/annotationlib annotationlib-metaclass17290906
Ref: 4d6717290906
Ref: library/annotationlib using-annotations-in-a-metaclass17290906
Ref: 4d6917290906
Node: Creating a custom callable annotate function17294040
Ref: library/annotationlib creating-a-custom-callable-annotate-function17294174
Ref: 4d6a17294174
Node: Limitations of the STRING format17297045
Ref: library/annotationlib limitations-of-the-string-format17297241
Ref: 4d6b17297241
Node: Limitations of the FORWARDREF format17301043
Ref: library/annotationlib limitations-of-the-forwardref-format17301277
Ref: 4d9017301277
Node: Security implications of introspecting annotations17302371
Ref: library/annotationlib annotationlib-security17302564
Ref: 478017302564
Ref: library/annotationlib security-implications-of-introspecting-annotations17302564
Ref: 4d9117302564
Node: site --- サイト固有の設定フック17303787
Ref: library/site doc17303970
Ref: 4d9217303970
Ref: library/site module-site17303970
Ref: cf17303970
Ref: library/site site-site-specific-configuration-hook17303970
Ref: 4d9317303970
Ref: library/site translation-repo17303970
Ref: 4d9417303970
Ref: library/site site-virtual-environments-configuration17306418
Ref: 4ba417306418
Ref: site --- サイト固有の設定フック-Footnote-117307776
Node: Path extensions pth files17307840
Ref: library/site path-extensions-pth-files17307985
Ref: 4d9517307985
Ref: library/site site-pth-files17307985
Ref: 19e17307985
Node: Startup entry points start files17309753
Ref: library/site site-start-files17309928
Ref: 1a017309928
Ref: library/site startup-entry-points-start-files17309928
Ref: 4d9617309928
Ref: Startup entry points start files-Footnote-117312044
Node: Startup file examples17312086
Ref: library/site startup-file-examples17312291
Ref: 4d9717312291
Node: Migrating from import lines in pth files to start files17313947
Ref: library/site migrating-from-import-lines-in-pth-files-to-start-files17314133
Ref: 4d9817314133
Ref: library/site site-migration-guide17314133
Ref: 4d9917314133
Ref: Migrating from import lines in pth files to start files-Footnote-117315238
Node: sitecustomize17315280
Ref: library/site module-sitecustomize17315458
Ref: d017315458
Ref: library/site sitecustomize17315458
Ref: 4d9a17315458
Node: usercustomize17316209
Ref: library/site module-usercustomize17316350
Ref: 11717316350
Ref: library/site usercustomize17316350
Ref: 4d9b17316350
Node: readline の設定17317144
Ref: library/site readline-configuration17317299
Ref: 4d9d17317299
Ref: library/site rlcompleter-config17317299
Ref: 137717317299
Node: モジュールの内容<7>17318016
Ref: library/site module-contents17318210
Ref: 4d9e17318210
Ref: library/site site PREFIXES17318273
Ref: 4d9f17318273
Ref: library/site site ENABLE_USER_SITE17318371
Ref: 4d9c17318371
Ref: library/site site USER_SITE17319059
Ref: 233417319059
Ref: library/site site USER_BASE17319675
Ref: 16d617319675
Ref: library/site site main17320436
Ref: 233517320436
Ref: library/site site addsitedir17320867
Ref: 190e17320867
Ref: library/site site getsitepackages17322006
Ref: 15f917322006
Ref: library/site site getuserbase17322171
Ref: 15fa17322171
Ref: library/site site getusersitepackages17322457
Ref: 15fb17322457
Node: コマンドライン・インターフェース<12>17322943
Ref: library/site command-line-interface17323110
Ref: 4da017323110
Ref: library/site site-commandline17323110
Ref: 4da117323110
Ref: library/site cmdoption-site-user-base17323739
Ref: 4da217323739
Ref: library/site cmdoption-site-user-site17323831
Ref: 4da317323831
Ref: コマンドライン・インターフェース<12>-Footnote-117325010
Ref: コマンドライン・インターフェース<12>-Footnote-217325052
Node: カスタム Python インタプリタ17325094
Ref: library/custominterp doc17325282
Ref: 4da417325282
Ref: library/custominterp custom-python-interpreters17325282
Ref: 4da517325282
Ref: library/custominterp custominterp17325282
Ref: 4da617325282
Ref: library/custominterp translation-repo17325282
Ref: 4da717325282
Node: code --- インタープリター基底クラス17326174
Ref: library/code doc17326357
Ref: 4da817326357
Ref: library/code code-interpreter-base-classes17326357
Ref: 4da917326357
Ref: library/code module-code17326357
Ref: 1b17326357
Ref: library/code code InteractiveInterpreter17326890
Ref: 1b7a17326890
Ref: library/code code InteractiveConsole17327836
Ref: 2a3617327836
Ref: library/code code interact17328562
Ref: 1ad317328562
Ref: library/code code compile_command17329799
Ref: 4dac17329799
Ref: code --- インタープリター基底クラス-Footnote-117331459
Node: 対話的なインタプリタオブジェクト17331523
Ref: library/code interactive-interpreter-objects17331710
Ref: 4dad17331710
Ref: library/code interpreter-objects17331710
Ref: 4dae17331710
Ref: library/code code InteractiveInterpreter runsource17331811
Ref: 4daf17331811
Ref: library/code code InteractiveInterpreter runcode17333373
Ref: 4db117333373
Ref: library/code code InteractiveInterpreter showsyntaxerror17334051
Ref: 4db017334051
Ref: library/code code InteractiveInterpreter showtraceback17334701
Ref: 118b17334701
Ref: library/code code InteractiveInterpreter write17335214
Ref: 4db217335214
Node: 対話的なコンソールオブジェクト17335504
Ref: library/code console-objects17335691
Ref: 4db317335691
Ref: library/code interactive-console-objects17335691
Ref: 4db417335691
Ref: library/code code InteractiveConsole interact17336027
Ref: 4dab17336027
Ref: library/code code InteractiveConsole push17337204
Ref: 4db517337204
Ref: library/code code InteractiveConsole resetbuffer17338161
Ref: 4db617338161
Ref: library/code code InteractiveConsole raw_input17338314
Ref: 4daa17338314
Node: codeop --- Python コードをコンパイルする17338768
Ref: library/codeop doc17338951
Ref: 4db717338951
Ref: library/codeop codeop-compile-python-code17338951
Ref: 4db817338951
Ref: library/codeop module-codeop17338951
Ref: 1d17338951
Ref: library/codeop translation-repo17338951
Ref: 4db917338951
Ref: library/codeop codeop compile_command17340100
Ref: 1d7017340100
Ref: library/codeop codeop Compile17341905
Ref: 4dba17341905
Ref: library/codeop codeop CommandCompiler17342437
Ref: 4dbb17342437
Ref: codeop --- Python コードをコンパイルする-Footnote-117343010
Node: モジュールのインポート17343076
Ref: library/modules doc17343254
Ref: 4dbc17343254
Ref: library/modules importing-modules17343254
Ref: 4dbd17343254
Ref: library/modules modules17343254
Ref: 4dbe17343254
Ref: library/modules translation-repo17343254
Ref: 4dbf17343254
Node: zipimport --- Zip アーカイブからモジュールをインポートする17344784
Ref: library/zipimport doc17344995
Ref: 4dc017344995
Ref: library/zipimport module-zipimport17344995
Ref: 13b17344995
Ref: library/zipimport zipimport-import-modules-from-zip-archives17344995
Ref: 4dc117344995
Ref: library/zipimport zipimport ZipImportError17347957
Ref: 4dc217347957
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-117348283
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-217348352
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-317348420
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-417348462
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-517348504
Node: zipimporter オブジェクト17348546
Ref: library/zipimport id117348713
Ref: 4dc317348713
Ref: library/zipimport zipimporter-objects17348713
Ref: 4dc417348713
Ref: library/zipimport zipimport zipimporter17348879
Ref: 4dc517348879
Ref: library/zipimport zipimport zipimporter create_module17349707
Ref: c3a17349707
Ref: library/zipimport zipimport zipimporter exec_module17349960
Ref: 2f517349960
Ref: library/zipimport zipimport zipimporter find_spec17350116
Ref: c3917350116
Ref: library/zipimport zipimport zipimporter get_code17350303
Ref: 4dc617350303
Ref: library/zipimport zipimport zipimporter get_data17350582
Ref: 4dc717350582
Ref: library/zipimport zipimport zipimporter get_filename17350990
Ref: 4dc817350990
Ref: library/zipimport zipimport zipimporter get_source17351350
Ref: 4dc917351350
Ref: library/zipimport zipimport zipimporter is_package17351744
Ref: 4dca17351744
Ref: library/zipimport zipimport zipimporter invalidate_caches17352019
Ref: c3b17352019
Ref: library/zipimport zipimport zipimporter archive17352205
Ref: 4dcb17352205
Ref: library/zipimport zipimport zipimporter prefix17352370
Ref: 4dcc17352370
Node: 使用例<47>17352846
Ref: library/zipimport examples17353013
Ref: 4dcd17353013
Ref: library/zipimport zipimport-examples17353013
Ref: 4dce17353013
Node: pkgutil --- パッケージ拡張ユーティリティ17353672
Ref: library/pkgutil doc17353975
Ref: 4dcf17353975
Ref: library/pkgutil module-pkgutil17353975
Ref: ae17353975
Ref: library/pkgutil pkgutil-package-extension-utility17353975
Ref: 4dd017353975
Ref: library/pkgutil translation-repo17353975
Ref: 4dd117353975
Ref: library/pkgutil pkgutil ModuleInfo17354336
Ref: 110517354336
Ref: library/pkgutil pkgutil extend_path17354491
Ref: 1b5e17354491
Ref: library/pkgutil pkgutil get_importer17356413
Ref: 4dd217356413
Ref: library/pkgutil pkgutil iter_importers17357102
Ref: 155717357102
Ref: library/pkgutil pkgutil iter_modules17358010
Ref: 110417358010
Ref: library/pkgutil pkgutil walk_packages17359143
Ref: fc217359143
Ref: library/pkgutil pkgutil get_data17361167
Ref: 4dd317361167
Ref: library/pkgutil pkgutil resolve_name17363298
Ref: 192517363298
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-117365529
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-217365596
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-317365638
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-417365680
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-517365722
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-617365764
Node: modulefinder --- スクリプト中で使用されているモジュールの検索17365829
Ref: library/modulefinder doc17366110
Ref: 4dd617366110
Ref: library/modulefinder module-modulefinder17366110
Ref: 9517366110
Ref: library/modulefinder modulefinder-find-modules-used-by-a-script17366110
Ref: 4dd717366110
Ref: library/modulefinder translation-repo17366110
Ref: 4dd817366110
Ref: library/modulefinder modulefinder AddPackagePath17366817
Ref: 4dd917366817
Ref: library/modulefinder modulefinder ReplacePackage17366994
Ref: 4dda17366994
Ref: library/modulefinder modulefinder ModuleFinder17367229
Ref: 1ff317367229
Ref: library/modulefinder modulefinder ModuleFinder report17368186
Ref: 4ddc17368186
Ref: library/modulefinder modulefinder ModuleFinder run_script17368543
Ref: 4ddb17368543
Ref: library/modulefinder modulefinder ModuleFinder modules17368759
Ref: 4ddd17368759
Ref: modulefinder --- スクリプト中で使用されているモジュールの検索-Footnote-117369016
Node: ModuleFinder の使用例17369088
Ref: library/modulefinder example-usage-of-modulefinder17369233
Ref: 4ddf17369233
Ref: library/modulefinder modulefinder-example17369233
Ref: 4dde17369233
Node: runpy --- Python モジュールの位置特定と実行17370634
Ref: library/runpy doc17370891
Ref: 4de017370891
Ref: library/runpy module-runpy17370891
Ref: c617370891
Ref: library/runpy runpy-locating-and-executing-python-modules17370891
Ref: 4de117370891
Ref: library/runpy translation-repo17370891
Ref: 4de217370891
Ref: library/runpy runpy run_module17372038
Ref: 192217372038
Ref: library/runpy runpy run_path17375692
Ref: 6b417375692
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-117380298
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-217380363
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-317380405
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-417380447
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-517380489
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-617380531
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-717380573
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-817380615
Node: importlib --- import の実装17380657
Ref: library/importlib doc17380926
Ref: 4de317380926
Ref: library/importlib importlib-the-implementation-of-import17380926
Ref: 4de417380926
Ref: library/importlib module-importlib17380926
Ref: 7a17380926
Ref: library/importlib translation-repo17380926
Ref: 4de517380926
Ref: importlib --- import の実装-Footnote-117381590
Node: はじめに<13>17381669
Ref: library/importlib introduction17381771
Ref: 4de617381771
Ref: はじめに<13>-Footnote-117384369
Ref: はじめに<13>-Footnote-217384421
Ref: はじめに<13>-Footnote-317384463
Ref: はじめに<13>-Footnote-417384505
Ref: はじめに<13>-Footnote-517384547
Ref: はじめに<13>-Footnote-617384589
Ref: はじめに<13>-Footnote-717384631
Ref: はじめに<13>-Footnote-817384673
Ref: はじめに<13>-Footnote-917384715
Ref: はじめに<13>-Footnote-1017384757
Ref: はじめに<13>-Footnote-1117384800
Ref: はじめに<13>-Footnote-1217384843
Ref: はじめに<13>-Footnote-1317384886
Node: 関数<13>17384929
Ref: library/importlib functions17385096
Ref: 4de717385096
Ref: library/importlib importlib __import__17385127
Ref: 142417385127
Ref: library/importlib importlib import_module17385485
Ref: 92c17385485
Ref: library/importlib importlib invalidate_caches17387328
Ref: fd317387328
Ref: library/importlib importlib reload17388130
Ref: 92d17388130
Node: importlib abc -- Abstract base classes related to import17393178
Ref: library/importlib importlib-abc-abstract-base-classes-related-to-import17393376
Ref: 4de817393376
Ref: library/importlib module-importlib abc17393376
Ref: 7b17393376
Ref: library/importlib importlib abc MetaPathFinder17394183
Ref: c4817394183
Ref: library/importlib importlib abc MetaPathFinder find_spec17394408
Ref: c4317394408
Ref: library/importlib importlib abc MetaPathFinder invalidate_caches17395159
Ref: 4de917395159
Ref: library/importlib importlib abc MetaPathFinder discover17395680
Ref: 196c17395680
Ref: library/importlib importlib abc PathEntryFinder17396624
Ref: c4917396624
Ref: library/importlib importlib abc PathEntryFinder find_spec17397133
Ref: c4617397133
Ref: library/importlib importlib abc PathEntryFinder invalidate_caches17397974
Ref: 4dea17397974
Ref: library/importlib importlib abc PathEntryFinder discover17398378
Ref: 196d17398378
Ref: library/importlib importlib abc Loader17399333
Ref: 127817399333
Ref: library/importlib importlib abc Loader create_module17399994
Ref: 107317399994
Ref: library/importlib importlib abc Loader exec_module17400596
Ref: c4417400596
Ref: library/importlib importlib abc ResourceLoader17401266
Ref: fab17401266
Ref: library/importlib importlib abc ResourceLoader get_data17401900
Ref: 4dd417401900
Ref: library/importlib importlib abc InspectLoader17402743
Ref: 130317402743
Ref: library/importlib importlib abc InspectLoader get_code17402970
Ref: 130417402970
Ref: library/importlib importlib abc InspectLoader get_source17403792
Ref: 130717403792
Ref: library/importlib importlib abc InspectLoader is_package17404569
Ref: 4dec17404569
Ref: library/importlib importlib abc InspectLoader source_to_code17405075
Ref: 1d617405075
Ref: library/importlib importlib abc InspectLoader exec_module17406180
Ref: 13c017406180
Ref: library/importlib importlib abc ExecutionLoader17406321
Ref: 4ded17406321
Ref: library/importlib importlib abc ExecutionLoader get_filename17406659
Ref: 4dee17406659
Ref: library/importlib importlib abc FileLoader17407364
Ref: 142a17407364
Ref: library/importlib importlib abc FileLoader name17407996
Ref: 4def17407996
Ref: library/importlib importlib abc FileLoader path17408091
Ref: 4df017408091
Ref: library/importlib importlib abc FileLoader get_filename17408180
Ref: 4df117408180
Ref: library/importlib importlib abc FileLoader get_data17408291
Ref: 4dd517408291
Ref: library/importlib importlib abc SourceLoader17408463
Ref: 4df217408463
Ref: library/importlib importlib abc SourceLoader path_stats17410015
Ref: 154717410015
Ref: library/importlib importlib abc SourceLoader path_mtime17410864
Ref: 154817410864
Ref: library/importlib importlib abc SourceLoader set_data17411508
Ref: 4df317411508
Ref: library/importlib importlib abc SourceLoader get_code17412117
Ref: 4df417412117
Ref: library/importlib importlib abc SourceLoader exec_module17412235
Ref: 13c117412235
Ref: library/importlib importlib abc SourceLoader get_source17412382
Ref: 13ce17412382
Ref: library/importlib importlib abc SourceLoader is_package17412504
Ref: 4df517412504
Ref: importlib abc -- Abstract base classes related to import-Footnote-117413091
Ref: importlib abc -- Abstract base classes related to import-Footnote-217413164
Ref: importlib abc -- Abstract base classes related to import-Footnote-317413206
Ref: importlib abc -- Abstract base classes related to import-Footnote-417413248
Ref: importlib abc -- Abstract base classes related to import-Footnote-517413290
Node: importlib machinery -- Importers and path hooks17413332
Ref: library/importlib importlib-machinery-importers-and-path-hooks17413564
Ref: 4df617413564
Ref: library/importlib module-importlib machinery17413564
Ref: 7c17413564
Ref: library/importlib importlib machinery SOURCE_SUFFIXES17413967
Ref: 92817413967
Ref: library/importlib importlib machinery DEBUG_BYTECODE_SUFFIXES17414168
Ref: 1af017414168
Ref: library/importlib importlib machinery OPTIMIZED_BYTECODE_SUFFIXES17414475
Ref: 1af117414475
Ref: library/importlib importlib machinery BYTECODE_SUFFIXES17414777
Ref: 92a17414777
Ref: library/importlib importlib machinery EXTENSION_SUFFIXES17415134
Ref: 92917415134
Ref: library/importlib importlib machinery all_suffixes17415353
Ref: 4d0817415353
Ref: library/importlib importlib machinery BuiltinImporter17415906
Ref: 107417415906
Ref: library/importlib importlib machinery FrozenImporter17416659
Ref: 13cc17416659
Ref: library/importlib importlib machinery WindowsRegistryFinder17417214
Ref: 10e617417214
Ref: library/importlib importlib machinery PathFinder17417907
Ref: 13d017417907
Ref: library/importlib importlib machinery PathFinder find_spec17418324
Ref: 13bf17418324
Ref: library/importlib importlib machinery PathFinder invalidate_caches17419859
Ref: fd217419859
Ref: library/importlib importlib machinery FileFinder17420555
Ref: 142917420555
Ref: library/importlib importlib machinery FileFinder path17422171
Ref: 4df717422171
Ref: library/importlib importlib machinery FileFinder find_spec17422260
Ref: 127717422260
Ref: library/importlib importlib machinery FileFinder invalidate_caches17422458
Ref: 4df817422458
Ref: library/importlib importlib machinery FileFinder path_hook17422566
Ref: 4df917422566
Ref: library/importlib importlib machinery NamespacePath17423052
Ref: 19f117423052
Ref: library/importlib importlib machinery SourceFileLoader17424219
Ref: 142b17424219
Ref: library/importlib importlib machinery SourceFileLoader name17424600
Ref: 4dfa17424600
Ref: library/importlib importlib machinery SourceFileLoader path17424698
Ref: 4dfb17424698
Ref: library/importlib importlib machinery SourceFileLoader is_package17424778
Ref: 4dfc17424778
Ref: library/importlib importlib machinery SourceFileLoader path_stats17424917
Ref: 4dfd17424917
Ref: library/importlib importlib machinery SourceFileLoader set_data17425059
Ref: 4dfe17425059
Ref: library/importlib importlib machinery SourcelessFileLoader17425203
Ref: 142c17425203
Ref: library/importlib importlib machinery SourcelessFileLoader name17425928
Ref: 4dff17425928
Ref: library/importlib importlib machinery SourcelessFileLoader path17426020
Ref: 4e0017426020
Ref: library/importlib importlib machinery SourcelessFileLoader is_package17426109
Ref: 4e0117426109
Ref: library/importlib importlib machinery SourcelessFileLoader get_code17426284
Ref: 4e0217426284
Ref: library/importlib importlib machinery SourcelessFileLoader get_source17426457
Ref: 4e0317426457
Ref: library/importlib importlib machinery ExtensionFileLoader17426655
Ref: 107517426655
Ref: library/importlib importlib machinery ExtensionFileLoader name17427363
Ref: 4e0417427363
Ref: library/importlib importlib machinery ExtensionFileLoader path17427467
Ref: 4e0517427467
Ref: library/importlib importlib machinery ExtensionFileLoader create_module17427547
Ref: 4e0617427547
Ref: library/importlib importlib machinery ExtensionFileLoader exec_module17427759
Ref: 4e0717427759
Ref: library/importlib importlib machinery ExtensionFileLoader is_package17427956
Ref: 4e0817427956
Ref: library/importlib importlib machinery ExtensionFileLoader get_code17428143
Ref: 4e0917428143
Ref: library/importlib importlib machinery ExtensionFileLoader get_source17428306
Ref: 4e0a17428306
Ref: library/importlib importlib machinery ExtensionFileLoader get_filename17428451
Ref: 130817428451
Ref: library/importlib importlib machinery NamespaceLoader17428580
Ref: 130517428580
Ref: library/importlib importlib machinery ModuleSpec17429247
Ref: 247c17429247
Ref: library/importlib importlib machinery ModuleSpec name17430044
Ref: 257417430044
Ref: library/importlib importlib machinery ModuleSpec loader17430252
Ref: 30c17430252
Ref: library/importlib importlib machinery ModuleSpec origin17430455
Ref: 4e0b17430455
Ref: library/importlib importlib machinery ModuleSpec submodule_search_locations17430944
Ref: 257717430944
Ref: library/importlib importlib machinery ModuleSpec loader_state17431592
Ref: 4e0c17431592
Ref: library/importlib importlib machinery ModuleSpec cached17431836
Ref: 59217431836
Ref: library/importlib importlib machinery ModuleSpec parent17432096
Ref: 59417432096
Ref: library/importlib importlib machinery ModuleSpec has_location17432387
Ref: 4e0d17432387
Ref: library/importlib importlib machinery AppleFrameworkLoader17432670
Ref: 247b17432670
Ref: library/importlib importlib machinery AppleFrameworkLoader name17436382
Ref: 4e0e17436382
Ref: library/importlib importlib machinery AppleFrameworkLoader path17436486
Ref: 4e0f17436486
Ref: importlib machinery -- Importers and path hooks-Footnote-117436625
Ref: importlib machinery -- Importers and path hooks-Footnote-217436705
Ref: importlib machinery -- Importers and path hooks-Footnote-317436747
Ref: importlib machinery -- Importers and path hooks-Footnote-417436789
Ref: importlib machinery -- Importers and path hooks-Footnote-517436831
Node: importlib util -- Utility code for importers17436873
Ref: library/importlib importlib-util-utility-code-for-importers17437062
Ref: 4e1017437062
Ref: library/importlib module-importlib util17437062
Ref: 8017437062
Ref: library/importlib importlib util MAGIC_NUMBER17437425
Ref: 92717437425
Ref: library/importlib importlib util cache_from_source17437739
Ref: 33817437739
Ref: library/importlib importlib util source_from_cache17439719
Ref: 92e17439719
Ref: library/importlib importlib util decode_source17440549
Ref: 130617440549
Ref: library/importlib importlib util resolve_name17440914
Ref: cdd17440914
Ref: library/importlib importlib util find_spec17441998
Ref: 7ad17441998
Ref: library/importlib importlib util module_from_spec17442998
Ref: 11ca17442998
Ref: library/importlib importlib util spec_from_loader17443866
Ref: c4717443866
Ref: library/importlib importlib util spec_from_file_location17444191
Ref: 107617444191
Ref: library/importlib importlib util source_hash17444841
Ref: f0817444841
Ref: library/importlib importlib util _incompatible_extension_module_restrictions17445107
Ref: 4e1117445107
Ref: library/importlib importlib util LazyLoader17446222
Ref: 107217446222
Ref: library/importlib importlib util LazyLoader factory17447888
Ref: 4e1217447888
Ref: importlib util -- Utility code for importers-Footnote-117448527
Ref: importlib util -- Utility code for importers-Footnote-217448601
Ref: importlib util -- Utility code for importers-Footnote-317448643
Ref: importlib util -- Utility code for importers-Footnote-417448685
Ref: importlib util -- Utility code for importers-Footnote-517448727
Ref: importlib util -- Utility code for importers-Footnote-617448769
Ref: importlib util -- Utility code for importers-Footnote-717448811
Node: 使用例<48>17448853
Ref: library/importlib examples17448986
Ref: 4e1317448986
Ref: library/importlib importlib-examples17448986
Ref: 4e1417448986
Node: プログラムからのインポート17449353
Ref: library/importlib importing-programmatically17449508
Ref: 4e1517449508
Node: モジュールがインポートできるか確認する17449809
Ref: library/importlib checking-if-a-module-can-be-imported17450027
Ref: 4e1617450027
Node: ソースファイルから直接インポートする17451015
Ref: library/importlib importing-a-source-file-directly17451219
Ref: 4e1717451219
Node: Implementing lazy imports17452407
Ref: library/importlib implementing-lazy-imports17452593
Ref: 4e1817452593
Node: インポーターのセットアップ17453312
Ref: library/importlib setting-up-an-importer17453481
Ref: 4e1917453481
Node: Approximating importlib import_module17455080
Ref: library/importlib approximating-importlib-import-module17455215
Ref: 4e1a17455215
Node: importlib resources -- パッケージリソースの読み取り、オープン、アクセス17456715
Ref: library/importlib resources doc17456991
Ref: 4e1b17456991
Ref: library/importlib resources importlib-resources-package-resource-reading-opening-and-access17456991
Ref: 4e1c17456991
Ref: library/importlib resources module-importlib resources17456991
Ref: 7e17456991
Ref: library/importlib resources translation-repo17456991
Ref: 4e1d17456991
Ref: library/importlib resources importlib resources Anchor17459132
Ref: 4e1e17459132
Ref: library/importlib resources importlib resources files17459335
Ref: 2e217459335
Ref: library/importlib resources importlib resources as_file17460461
Ref: 8a417460461
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-117461304
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-217461393
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-317461465
Node: 関数 API17461542
Ref: library/importlib resources functional-api17461684
Ref: 4e1f17461684
Ref: library/importlib resources importlib-resources-functional17461684
Ref: 4e2017461684
Ref: library/importlib resources importlib resources open_binary17462914
Ref: 70917462914
Ref: library/importlib resources importlib resources open_text17463406
Ref: 70a17463406
Ref: library/importlib resources importlib resources read_binary17464358
Ref: 70c17464358
Ref: library/importlib resources importlib resources read_text17464778
Ref: 70d17464778
Ref: library/importlib resources importlib resources path17465655
Ref: 70b17465655
Ref: library/importlib resources importlib resources is_resource17466651
Ref: 70817466651
Ref: library/importlib resources importlib resources contents17467128
Ref: 70e17467128
Node: importlib resources abc -- リソースの抽象基底クラス17467836
Ref: library/importlib resources abc doc17468152
Ref: 4e2117468152
Ref: library/importlib resources abc importlib-resources-abc-abstract-base-classes-for-resources17468152
Ref: 4e2217468152
Ref: library/importlib resources abc module-importlib resources abc17468152
Ref: 7f17468152
Ref: library/importlib resources abc translation-repo17468152
Ref: 4e2317468152
Ref: library/importlib resources abc importlib resources abc ResourceReader17468438
Ref: 4deb17468438
Ref: library/importlib resources abc importlib resources abc ResourceReader open_resource17470299
Ref: 4e2417470299
Ref: library/importlib resources abc importlib resources abc ResourceReader resource_path17470594
Ref: 4e2517470594
Ref: library/importlib resources abc importlib resources abc ResourceReader is_resource17470887
Ref: 4e2617470887
Ref: library/importlib resources abc importlib resources abc ResourceReader contents17471203
Ref: 4e2717471203
Ref: library/importlib resources abc importlib resources abc Traversable17472078
Ref: 57917472078
Ref: library/importlib resources abc importlib resources abc Traversable name17472368
Ref: 4e2817472368
Ref: library/importlib resources abc importlib resources abc Traversable iterdir17472486
Ref: 4e2917472486
Ref: library/importlib resources abc importlib resources abc Traversable is_dir17472582
Ref: 4e2a17472582
Ref: library/importlib resources abc importlib resources abc Traversable is_file17472684
Ref: 4e2b17472684
Ref: library/importlib resources abc importlib resources abc Traversable joinpath17472782
Ref: 4e2c17472782
Ref: library/importlib resources abc importlib resources abc Traversable __truediv__17473909
Ref: 4e2d17473909
Ref: library/importlib resources abc importlib resources abc Traversable open17474061
Ref: 4e2e17474061
Ref: library/importlib resources abc importlib resources abc Traversable read_bytes17474423
Ref: 4e2f17474423
Ref: library/importlib resources abc importlib resources abc Traversable read_text17474504
Ref: 4e3017474504
Ref: library/importlib resources abc importlib resources abc TraversableResources17474596
Ref: 57817474596
Ref: library/importlib resources abc importlib resources abc TraversableResources files17475122
Ref: 4e3117475122
Ref: importlib resources abc -- リソースの抽象基底クラス-Footnote-117475316
Node: importlib metadata -- パッケージメタデータへのアクセス17475400
Ref: library/importlib metadata doc17475669
Ref: 4e3217475669
Ref: library/importlib metadata importlib-metadata-accessing-package-metadata17475669
Ref: 4e3317475669
Ref: library/importlib metadata module-importlib metadata17475669
Ref: 7d17475669
Ref: library/importlib metadata translation-repo17475669
Ref: 4e3417475669
Ref: library/importlib metadata using17475669
Ref: 4e3517475669
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-117478264
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-217478352
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-317478436
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-417478514
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-517478552
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-617478644
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-717478713
Node: 概要<3>17478789
Ref: library/importlib metadata overview17478924
Ref: 4e3617478924
Ref: library/importlib metadata importlib metadata PackageNotFoundError17480568
Ref: 19ed17480568
Ref: 概要<3>-Footnote-117480858
Node: 機能 API17480942
Ref: library/importlib metadata functional-api17481099
Ref: 4e3b17481099
Node: エントリポイント17481411
Ref: library/importlib metadata entry-points17481515
Ref: 78e17481515
Ref: library/importlib metadata id217481515
Ref: 4e3c17481515
Ref: library/importlib metadata importlib metadata entry_points17481576
Ref: 4e3d17481576
Ref: library/importlib metadata importlib metadata EntryPoints17482175
Ref: 4e3e17482175
Ref: library/importlib metadata importlib metadata EntryPoint17482459
Ref: 4e4017482459
Ref: エントリポイント-Footnote-117485363
Ref: エントリポイント-Footnote-217485435
Node: 配布物メタデータ17485503
Ref: library/importlib metadata distribution-metadata17485640
Ref: 4e4117485640
Ref: library/importlib metadata metadata17485640
Ref: 4e3717485640
Ref: library/importlib metadata importlib metadata metadata17485701
Ref: 4e4217485701
Ref: library/importlib metadata importlib metadata PackageMetadata17486039
Ref: 4e4317486039
Ref: 配布物メタデータ-Footnote-117487365
Ref: 配布物メタデータ-Footnote-217487470
Ref: 配布物メタデータ-Footnote-317487554
Ref: 配布物メタデータ-Footnote-417487596
Node: 配布物バージョン17487688
Ref: library/importlib metadata distribution-versions17487822
Ref: 4e4417487822
Ref: library/importlib metadata version17487822
Ref: 4e3817487822
Ref: library/importlib metadata importlib metadata version17487883
Ref: 1b9817487883
Ref: 配布物バージョン-Footnote-117488375
Ref: 配布物バージョン-Footnote-217488461
Node: 配布物ファイル17488545
Ref: library/importlib metadata distribution-files17488673
Ref: 4e4517488673
Ref: library/importlib metadata files17488673
Ref: 4e3917488673
Ref: library/importlib metadata importlib metadata files17488729
Ref: 4e4617488729
Ref: library/importlib metadata importlib metadata PackagePath17489237
Ref: 197117489237
Ref: library/importlib metadata importlib metadata PackagePath locate17489499
Ref: 4e4717489499
Ref: library/importlib metadata importlib metadata SimplePath17489700
Ref: 4e4817489700
Ref: 配布物ファイル-Footnote-117491291
Ref: 配布物ファイル-Footnote-217491375
Node: 配布物の要件17491472
Ref: library/importlib metadata distribution-requirements17491615
Ref: 4e4917491615
Ref: library/importlib metadata requirements17491615
Ref: 4e3a17491615
Ref: library/importlib metadata importlib metadata requires17491666
Ref: 4e4a17491666
Ref: library/importlib metadata package-distributions17492163
Ref: bed17492163
Ref: 配布物の要件-Footnote-117492200
Node: Mapping import to distribution packages17492284
Ref: library/importlib metadata import-distribution-package-mapping17492397
Ref: 4e4b17492397
Ref: library/importlib metadata mapping-import-to-distribution-packages17492397
Ref: 4e4c17492397
Ref: library/importlib metadata importlib metadata packages_distributions17492496
Ref: 4e4d17492496
Ref: Mapping import to distribution packages-Footnote-117493584
Ref: Mapping import to distribution packages-Footnote-217493662
Ref: Mapping import to distribution packages-Footnote-317493746
Node: Distributions17493808
Ref: library/importlib metadata distributions17493978
Ref: bee17493978
Ref: library/importlib metadata id917493978
Ref: 4e4e17493978
Ref: library/importlib metadata importlib metadata distribution17494605
Ref: 4e4f17494605
Ref: library/importlib metadata importlib metadata Distribution17495139
Ref: 197017495139
Ref: library/importlib metadata importlib metadata Distribution at17495429
Ref: 4e5117495429
Ref: library/importlib metadata importlib metadata Distribution from_name17495470
Ref: 4e5217495470
Ref: library/importlib metadata importlib metadata Distribution discover17495623
Ref: 4e5317495623
Ref: library/importlib metadata importlib metadata Distribution metadata17496124
Ref: 4e5617496124
Ref: library/importlib metadata importlib metadata Distribution name17496679
Ref: 4e5717496679
Ref: library/importlib metadata importlib metadata Distribution requires17496722
Ref: 4e5817496722
Ref: library/importlib metadata importlib metadata Distribution version17496787
Ref: 4e5017496787
Ref: library/importlib metadata importlib metadata Distribution origin17496988
Ref: 4e5917496988
Ref: library/importlib metadata importlib metadata Distribution entry_points17497409
Ref: 4e3f17497409
Ref: library/importlib metadata importlib metadata Distribution files17497536
Ref: 4e5a17497536
Ref: library/importlib metadata importlib metadata Distribution locate_file17497922
Ref: 4e5c17497922
Ref: library/importlib metadata importlib metadata Distribution read_text17498137
Ref: 4e5d17498137
Ref: Distributions-Footnote-117498308
Ref: Distributions-Footnote-217498392
Ref: Distributions-Footnote-317498484
Ref: Distributions-Footnote-417498526
Node: Distribution Discovery17498616
Ref: library/importlib metadata distribution-discovery17498805
Ref: 4e5417498805
Ref: library/importlib metadata id1217498805
Ref: 4e5e17498805
Ref: library/importlib metadata importlib metadata DistributionFinder17499627
Ref: 4e5f17499627
Ref: library/importlib metadata importlib metadata DistributionFinder Context17499867
Ref: 4e5517499867
Ref: library/importlib metadata importlib metadata DistributionFinder Context name17500996
Ref: 4e6117500996
Ref: library/importlib metadata importlib metadata DistributionFinder Context path17501209
Ref: 4e6217501209
Ref: library/importlib metadata importlib metadata distributions17501566
Ref: 4e6017501566
Ref: Distribution Discovery-Footnote-117502072
Node: Implementing Custom Providers17502156
Ref: library/importlib metadata id1417502323
Ref: 4e6317502323
Ref: library/importlib metadata implementing-custom-providers17502323
Ref: 4e5b17502323
Ref: Implementing Custom Providers-Footnote-117504545
Node: 使用例<49>17504629
Ref: library/importlib metadata example17504708
Ref: 4e6417504708
Node: sys path モジュール検索パスの初期化17507993
Ref: library/sys_path_init doc17508190
Ref: 4e6517508190
Ref: library/sys_path_init sys-path-init17508190
Ref: 197417508190
Ref: library/sys_path_init the-initialization-of-the-sys-path-module-search-path17508190
Ref: 4e6617508190
Ref: library/sys_path_init translation-repo17508190
Ref: 4e6717508190
Node: Virtual Environments17512640
Ref: library/sys_path_init sys-path-init-virtual-environments17512764
Ref: 4ba317512764
Ref: library/sys_path_init virtual-environments17512764
Ref: 4e6817512764
Node: _pth files17513738
Ref: library/sys_path_init pth-files17513893
Ref: 4e6917513893
Node: 埋め込みの Python17515216
Ref: library/sys_path_init embedded-python17515342
Ref: 4e6a17515342
Node: Python言語サービス17515927
Ref: library/language doc17516099
Ref: 4e6b17516099
Ref: library/language language17516099
Ref: 4e6c17516099
Ref: library/language python-language-services17516099
Ref: 4e6d17516099
Ref: library/language translation-repo17516099
Ref: 4e6e17516099
Node: ast --- Abstract syntax trees17517789
Ref: library/ast doc17517949
Ref: 4e6f17517949
Ref: library/ast ast-abstract-syntax-trees17517949
Ref: 4e7017517949
Ref: library/ast module-ast17517949
Ref: 917517949
Ref: ast --- Abstract syntax trees-Footnote-117519136
Node: Abstract grammar17519199
Ref: library/ast abstract-grammar17519304
Ref: 4e7217519304
Ref: library/ast id117519304
Ref: 4e7317519304
Node: Node クラス17526891
Ref: library/ast ast-nodes17527016
Ref: 2d317527016
Ref: library/ast node-classes17527016
Ref: 4e7417527016
Ref: library/ast ast AST17527062
Ref: 2f817527062
Ref: library/ast ast AST _fields17528040
Ref: 19fa17528040
Ref: library/ast ast AST _field_types17529195
Ref: 6d017529195
Ref: library/ast ast AST lineno17529587
Ref: 4e7517529587
Ref: library/ast ast AST col_offset17529614
Ref: 4e7617529614
Ref: library/ast ast AST end_lineno17529645
Ref: 4e7717529645
Ref: library/ast ast AST end_col_offset17529676
Ref: 4e7817529676
Ref: Node クラス-Footnote-117534835
Node: Root nodes17534893
Ref: library/ast ast-root-nodes17534978
Ref: 4e7917534978
Ref: library/ast root-nodes17534978
Ref: 4e7a17534978
Ref: library/ast ast Module17535019
Ref: 4e7b17535019
Ref: library/ast ast Expression17535703
Ref: 4e7d17535703
Ref: library/ast ast Interactive17536085
Ref: 1abf17536085
Ref: library/ast ast FunctionType17536814
Ref: 4e7f17536814
Ref: Root nodes-Footnote-117537784
Node: リテラル<3>17537826
Ref: library/ast literals17537926
Ref: 4e8017537926
Ref: library/ast ast Constant17537967
Ref: 57017537967
Ref: library/ast ast FormattedValue17538845
Ref: 4d8417538845
Ref: library/ast ast JoinedStr17539990
Ref: 1c8117539990
Ref: library/ast ast TemplateStr17540953
Ref: 4e8117540953
Ref: library/ast ast Interpolation17541984
Ref: 19ec17541984
Ref: library/ast ast List17543433
Ref: 4d8117543433
Ref: library/ast ast Tuple17543469
Ref: 4d8217543469
Ref: library/ast ast Set17544433
Ref: 4d7117544433
Ref: library/ast ast Dict17544878
Ref: 1f5c17544878
Node: 変数17545782
Ref: library/ast variables17545889
Ref: 4e8317545889
Ref: library/ast ast Name17545920
Ref: 1f3617545920
Ref: library/ast ast Load17546106
Ref: 6cf17546106
Ref: library/ast ast Store17546130
Ref: 4e8217546130
Ref: library/ast ast Del17546155
Ref: 4e8417546155
Ref: library/ast ast Starred17547106
Ref: 4d8017547106
Node: 式 expression<2>17547986
Ref: library/ast ast-expressions17548092
Ref: 4e7e17548092
Ref: library/ast expressions17548092
Ref: 4e8517548092
Ref: library/ast ast Expr17548144
Ref: 4e8617548144
Ref: library/ast ast UnaryOp17548907
Ref: 4d6c17548907
Ref: library/ast ast UAdd17549086
Ref: 4d6e17549086
Ref: library/ast ast USub17549110
Ref: 4d6f17549110
Ref: library/ast ast Not17549134
Ref: 4d7017549134
Ref: library/ast ast Invert17549157
Ref: 4d6d17549157
Ref: library/ast ast BinOp17549581
Ref: 1fc117549581
Ref: library/ast ast Add17550027
Ref: 4e8717550027
Ref: library/ast ast Sub17550050
Ref: 4e8817550050
Ref: library/ast ast Mult17550073
Ref: 4e8917550073
Ref: library/ast ast Div17550097
Ref: 4e8a17550097
Ref: library/ast ast FloorDiv17550120
Ref: 4e8b17550120
Ref: library/ast ast Mod17550148
Ref: 4e8c17550148
Ref: library/ast ast Pow17550171
Ref: 4e8d17550171
Ref: library/ast ast LShift17550194
Ref: 4e8e17550194
Ref: library/ast ast RShift17550220
Ref: 4e8f17550220
Ref: library/ast ast BitOr17550246
Ref: 4e9017550246
Ref: library/ast ast BitXor17550271
Ref: 4e9117550271
Ref: library/ast ast BitAnd17550297
Ref: 4e9217550297
Ref: library/ast ast MatMult17550323
Ref: 4e9317550323
Ref: library/ast ast BoolOp17550406
Ref: 4d8517550406
Ref: library/ast ast And17551157
Ref: 4e9517551157
Ref: library/ast ast Or17551180
Ref: 4e9417551180
Ref: library/ast ast Compare17551258
Ref: 4d7217551258
Ref: library/ast ast Eq17551879
Ref: 4d7317551879
Ref: library/ast ast NotEq17551901
Ref: 4d7417551901
Ref: library/ast ast Lt17551926
Ref: 4d7517551926
Ref: library/ast ast LtE17551948
Ref: 4d7617551948
Ref: library/ast ast Gt17551971
Ref: 4d7717551971
Ref: library/ast ast GtE17551993
Ref: 4d7817551993
Ref: library/ast ast Is17552016
Ref: 4d7917552016
Ref: library/ast ast IsNot17552038
Ref: 4d7a17552038
Ref: library/ast ast In17552063
Ref: 4d7b17552063
Ref: library/ast ast NotIn17552085
Ref: 4d7c17552085
Ref: library/ast ast Call17552166
Ref: 4d7d17552166
Ref: library/ast ast keyword17553256
Ref: 4e9617553256
Ref: library/ast ast IfExp17553531
Ref: 4d8617553531
Ref: library/ast ast Attribute17554048
Ref: 4d7e17554048
Ref: library/ast ast NamedExpr17554694
Ref: 4d8c17554694
Node: 配列要素の参照 Subscripting17555583
Ref: library/ast subscripting17555706
Ref: 4e9817555706
Ref: library/ast ast Subscript17555792
Ref: 4d7f17555792
Ref: library/ast ast Slice17556798
Ref: 4d8317556798
Node: 内包表記 Comprehension17557441
Ref: library/ast comprehensions17557564
Ref: 4e9917557564
Ref: library/ast ast ListComp17557637
Ref: 4d8817557637
Ref: library/ast ast SetComp17557683
Ref: 4d8917557683
Ref: library/ast ast GeneratorExp17557728
Ref: 4d8b17557728
Ref: library/ast ast DictComp17557778
Ref: 4d8a17557778
Ref: library/ast ast comprehension17559666
Ref: 4e9a17559666
Node: 文 Statements17562725
Ref: library/ast ast-statements17562840
Ref: 4e7c17562840
Ref: library/ast statements17562840
Ref: 4e9b17562840
Ref: library/ast ast Assign17562892
Ref: 4e9717562892
Ref: library/ast ast Assign type_comment17563323
Ref: 4e9c17563323
Ref: library/ast ast AnnAssign17564289
Ref: 4e9d17564289
Ref: library/ast ast AugAssign17566472
Ref: 4e9e17566472
Ref: library/ast ast Raise17567293
Ref: 4e9f17567293
Ref: library/ast ast Assert17567895
Ref: 4ea017567895
Ref: library/ast ast Delete17568347
Ref: 4ea117568347
Ref: library/ast ast Pass17568873
Ref: 4ea217568873
Ref: library/ast ast TypeAlias17569069
Ref: 1c7a17569069
Node: インポート17569786
Ref: library/ast imports17569852
Ref: 4ea417569852
Ref: library/ast ast Import17569900
Ref: 4ea517569900
Ref: library/ast ast ImportFrom17570369
Ref: 4ea617570369
Ref: library/ast ast alias17571256
Ref: 1e8a17571256
Node: 制御フロー17571862
Ref: library/ast control-flow17571976
Ref: 4ea717571976
Ref: library/ast ast If17572167
Ref: 4ea817572167
Ref: library/ast ast For17573488
Ref: 4ea917573488
Ref: library/ast ast For type_comment17574030
Ref: 4eaa17574030
Ref: library/ast ast While17574780
Ref: 4eab17574780
Ref: library/ast ast Break17575489
Ref: 4eac17575489
Ref: library/ast ast Continue17575514
Ref: 4ead17575514
Ref: library/ast ast Try17576507
Ref: 4eae17576507
Ref: library/ast ast TryStar17578121
Ref: 4eb017578121
Ref: library/ast ast ExceptHandler17579119
Ref: 4eaf17579119
Ref: library/ast ast With17580423
Ref: 4eb117580423
Ref: library/ast ast With type_comment17580752
Ref: 4eb317580752
Ref: library/ast ast withitem17580924
Ref: 4eb217580924
Node: Pattern matching17582357
Ref: library/ast pattern-matching17582473
Ref: 4eb417582473
Ref: library/ast ast Match17582528
Ref: 4eb517582528
Ref: library/ast ast match_case17582841
Ref: 4eb617582841
Ref: library/ast ast MatchValue17584772
Ref: 4eb717584772
Ref: library/ast ast MatchSingleton17585734
Ref: 4eb817585734
Ref: library/ast ast MatchSequence17586582
Ref: 4eb917586582
Ref: library/ast ast MatchStar17587765
Ref: 4eba17587765
Ref: library/ast ast MatchMapping17589366
Ref: 4ebb17589366
Ref: library/ast ast MatchClass17591324
Ref: 4ebc17591324
Ref: library/ast ast MatchAs17594227
Ref: 4ebd17594227
Ref: library/ast ast MatchOr17595833
Ref: 4ebe17595833
Node: Type annotations17597068
Ref: library/ast type-annotations17597184
Ref: 4ebf17597184
Ref: library/ast ast TypeIgnore17597239
Ref: 1d2c17597239
Node: Type parameters17598479
Ref: library/ast ast-type-params17598609
Ref: 4ea317598609
Ref: library/ast type-parameters17598609
Ref: 4ec017598609
Ref: library/ast ast TypeVar17598742
Ref: 4ec117598742
Ref: library/ast ast ParamSpec17599858
Ref: 4ec217599858
Ref: library/ast ast TypeVarTuple17601057
Ref: 4ec317601057
Node: 関数およびクラス定義17602049
Ref: library/ast function-and-class-definitions17602178
Ref: 4ec417602178
Ref: library/ast ast FunctionDef17602251
Ref: 1c9d17602251
Ref: library/ast ast FunctionDef type_comment17603051
Ref: 4ec617603051
Ref: library/ast ast Lambda17603286
Ref: 4d8717603286
Ref: library/ast ast arguments17603937
Ref: 4ec517603937
Ref: library/ast ast arg17604864
Ref: 4ec717604864
Ref: library/ast ast arg type_comment17605084
Ref: 4ec817605084
Ref: library/ast ast Return17606666
Ref: 4ec917606666
Ref: library/ast ast Yield17606911
Ref: 4d8e17606911
Ref: library/ast ast YieldFrom17606944
Ref: 4d8f17606944
Ref: library/ast ast Global17607591
Ref: 4eca17607591
Ref: library/ast ast Nonlocal17607625
Ref: 4ecb17607625
Ref: library/ast ast ClassDef17608299
Ref: 1c9b17608299
Ref: 関数およびクラス定義-Footnote-117610059
Node: async と await17610101
Ref: library/ast async-and-await17610206
Ref: 4ecc17610206
Ref: library/ast ast AsyncFunctionDef17610258
Ref: 1c9c17610258
Ref: library/ast ast Await17610586
Ref: 4d8d17610586
Ref: library/ast ast AsyncFor17611233
Ref: 4ecd17611233
Ref: library/ast ast AsyncWith17611304
Ref: 4ece17611304
Node: ast helpers17612024
Ref: library/ast ast-helpers17612150
Ref: 4ecf17612150
Ref: library/ast ast parse17612336
Ref: 1d417612336
Ref: library/ast ast unparse17615737
Ref: cba17615737
Ref: library/ast ast literal_eval17616476
Ref: fdb17616476
Ref: library/ast ast get_docstring17618578
Ref: 204717618578
Ref: library/ast ast get_source_segment17619227
Ref: da017619227
Ref: library/ast ast fix_missing_locations17619744
Ref: 4ed117619744
Ref: library/ast ast increment_lineno17620220
Ref: 1d2b17620220
Ref: library/ast ast copy_location17620493
Ref: 4ed217620493
Ref: library/ast ast iter_fields17620753
Ref: 4ed317620753
Ref: library/ast ast iter_child_nodes17620950
Ref: 4ed417620950
Ref: library/ast ast walk17621258
Ref: 4ed517621258
Ref: library/ast ast NodeVisitor17621557
Ref: 57117621557
Ref: library/ast ast NodeVisitor visit17622000
Ref: 4ed617622000
Ref: library/ast ast NodeVisitor generic_visit17622353
Ref: 4ed717622353
Ref: library/ast ast NodeVisitor visit_Constant17622836
Ref: e3617622836
Ref: library/ast ast NodeTransformer17623512
Ref: 4ed817623512
Ref: library/ast ast dump17625623
Ref: 1ec17625623
Ref: library/ast ast compare17628256
Ref: 46017628256
Ref: ast helpers-Footnote-117628826
Ref: ast helpers-Footnote-217628868
Ref: ast helpers-Footnote-317628910
Node: Compiler flags<2>17628952
Ref: library/ast ast-compiler-flags17629100
Ref: 27df17629100
Ref: library/ast compiler-flags17629100
Ref: 4ed917629100
Ref: library/ast ast PyCF_ALLOW_TOP_LEVEL_AWAIT17629303
Ref: 4eda17629303
Ref: library/ast ast PyCF_ONLY_AST17629527
Ref: 4e7117629527
Ref: library/ast ast PyCF_OPTIMIZED_AST17629685
Ref: 4edb17629685
Ref: library/ast ast PyCF_TYPE_COMMENTS17629883
Ref: 4ed017629883
Ref: Compiler flags<2>-Footnote-117630147
Ref: Compiler flags<2>-Footnote-217630189
Node: コマンドラインでの使用<8>17630231
Ref: library/ast ast-cli17630359
Ref: 1ed17630359
Ref: library/ast command-line-usage17630359
Ref: 4edc17630359
Ref: library/ast cmdoption-ast-h17630793
Ref: 4edd17630793
Ref: library/ast cmdoption-ast-help17630793
Ref: 4ede17630793
Ref: library/ast cmdoption-ast-m17630881
Ref: 4edf17630881
Ref: library/ast cmdoption-ast-mode17630903
Ref: 4ee017630903
Ref: library/ast cmdoption-ast-no-type-comments17631058
Ref: 4ee117631058
Ref: library/ast cmdoption-ast-a17631139
Ref: 4ee217631139
Ref: library/ast cmdoption-ast-include-attributes17631139
Ref: 4ee317631139
Ref: library/ast cmdoption-ast-i17631247
Ref: 4ee417631247
Ref: library/ast cmdoption-ast-indent17631271
Ref: 4ee517631271
Ref: library/ast cmdoption-ast-feature-version17631377
Ref: 46317631377
Ref: library/ast cmdoption-ast-O17631565
Ref: 4ee617631565
Ref: library/ast cmdoption-ast-optimize17631588
Ref: 46417631588
Ref: library/ast cmdoption-ast-show-empty17631716
Ref: 46517631716
Ref: コマンドラインでの使用<8>-Footnote-117633047
Ref: コマンドラインでの使用<8>-Footnote-217633095
Ref: コマンドラインでの使用<8>-Footnote-317633162
Ref: コマンドラインでの使用<8>-Footnote-417633236
Ref: コマンドラインでの使用<8>-Footnote-517633275
Node: symtable --- コンパイラーの記号表へのアクセス17633312
Ref: library/symtable doc17633528
Ref: 4ee717633528
Ref: library/symtable module-symtable17633528
Ref: e117633528
Ref: library/symtable symtable-access-to-the-compiler-s-symbol-tables17633528
Ref: 4ee817633528
Ref: library/symtable translation-repo17633528
Ref: 4ee917633528
Ref: symtable --- コンパイラーの記号表へのアクセス-Footnote-117634184
Node: 記号表の生成17634252
Ref: library/symtable generating-symbol-tables17634395
Ref: 4eea17634395
Ref: library/symtable symtable symtable17634446
Ref: 1d517634446
Node: 記号表の検査17634978
Ref: library/symtable examining-symbol-tables17635169
Ref: 4eec17635169
Ref: library/symtable symtable SymbolTableType17635220
Ref: 1b8517635220
Ref: library/symtable symtable SymbolTableType MODULE17635345
Ref: 4eed17635345
Ref: library/symtable symtable SymbolTableType FUNCTION17635434
Ref: 4eee17635434
Ref: library/symtable symtable SymbolTableType CLASS17635529
Ref: 4eef17635529
Ref: library/symtable symtable SymbolTableType ANNOTATION17635708
Ref: 4ef017635708
Ref: library/symtable symtable SymbolTableType TYPE_ALIAS17635852
Ref: 4ef117635852
Ref: library/symtable symtable SymbolTableType TYPE_PARAMETERS17635971
Ref: 4ef217635971
Ref: library/symtable symtable SymbolTableType TYPE_VARIABLE17636140
Ref: 4ef317636140
Ref: library/symtable symtable SymbolTable17636509
Ref: 4eeb17636509
Ref: library/symtable symtable SymbolTable get_type17636673
Ref: 1b8617636673
Ref: library/symtable symtable SymbolTable get_id17637359
Ref: 4ef417637359
Ref: library/symtable symtable SymbolTable get_name17637444
Ref: 4ef517637444
Ref: library/symtable symtable SymbolTable get_lineno17638094
Ref: 4ef617638094
Ref: library/symtable symtable SymbolTable is_optimized17638228
Ref: 4ef717638228
Ref: library/symtable symtable SymbolTable is_nested17638399
Ref: 4ef817638399
Ref: library/symtable symtable SymbolTable has_children17638538
Ref: 4ef917638538
Ref: library/symtable symtable SymbolTable get_identifiers17638785
Ref: 4efb17638785
Ref: library/symtable symtable SymbolTable lookup17638968
Ref: 4efc17638968
Ref: library/symtable symtable SymbolTable get_symbols17639141
Ref: 4efd17639141
Ref: library/symtable symtable SymbolTable get_children17639301
Ref: 4efa17639301
Ref: library/symtable symtable Function17639413
Ref: 4efe17639413
Ref: library/symtable symtable Function get_parameters17639547
Ref: 4eff17639547
Ref: library/symtable symtable Function get_locals17639664
Ref: 4f0017639664
Ref: library/symtable symtable Function get_globals17639795
Ref: 4f0117639795
Ref: library/symtable symtable Function get_nonlocals17639930
Ref: 4f0217639930
Ref: library/symtable symtable Function get_frees17640075
Ref: 4f0317640075
Ref: library/symtable symtable Function get_cells17640224
Ref: 27717640224
Ref: library/symtable symtable Class17640394
Ref: 4f0417640394
Ref: library/symtable symtable Symbol17640511
Ref: 51817640511
Ref: library/symtable symtable Symbol get_name17640716
Ref: 4f0517640716
Ref: library/symtable symtable Symbol is_referenced17640797
Ref: 4f0617640797
Ref: library/symtable symtable Symbol is_imported17640937
Ref: 4f0717640937
Ref: library/symtable symtable Symbol is_parameter17641068
Ref: 4f0817641068
Ref: library/symtable symtable Symbol is_type_parameter17641183
Ref: 1b8717641183
Ref: library/symtable symtable Symbol is_global17641326
Ref: 4f0917641326
Ref: library/symtable symtable Symbol is_nonlocal17641438
Ref: 201b17641438
Ref: library/symtable symtable Symbol is_declared_global17641552
Ref: 16df17641552
Ref: library/symtable symtable Symbol is_local17641736
Ref: 4f0a17641736
Ref: library/symtable symtable Symbol is_annotated17641874
Ref: 4f0b17641874
Ref: library/symtable symtable Symbol is_free17642019
Ref: 4f0c17642019
Ref: library/symtable symtable Symbol is_cell17642209
Ref: 27817642209
Ref: library/symtable symtable Symbol is_free_class17642381
Ref: 51b17642381
Ref: library/symtable symtable Symbol is_assigned17643058
Ref: 4f0d17643058
Ref: library/symtable symtable Symbol is_comp_iter17643216
Ref: 51a17643216
Ref: library/symtable symtable Symbol is_comp_cell17643382
Ref: 51917643382
Ref: library/symtable symtable Symbol is_namespace17643548
Ref: 4f0e17643548
Ref: library/symtable symtable Symbol get_namespaces17644388
Ref: 4f0f17644388
Ref: library/symtable symtable Symbol get_namespace17644514
Ref: 4f1017644514
Node: コマンドラインからの使用<3>17644778
Ref: library/symtable command-line-usage17644942
Ref: 4f1117644942
Ref: library/symtable symtable-cli17644942
Ref: 4f1217644942
Node: token --- Python 解析木で使われる定数17645315
Ref: library/token doc17645548
Ref: 4f1317645548
Ref: library/token module-token17645548
Ref: 10317645548
Ref: library/token token-constants-used-with-python-parse-trees17645548
Ref: 4f1417645548
Ref: library/token translation-repo17645548
Ref: 4f1517645548
Ref: library/token token tok_name17646607
Ref: 4f1817646607
Ref: library/token token ISTERMINAL17646840
Ref: 4f1917646840
Ref: library/token token ISNONTERMINAL17646950
Ref: 4f1a17646950
Ref: library/token token ISEOF17647066
Ref: 4f1b17647066
Ref: library/token token NAME17647217
Ref: 24c817647217
Ref: library/token token NUMBER17647315
Ref: 24c917647315
Ref: library/token token STRING17647408
Ref: 24ca17647408
Ref: library/token token OP17647758
Ref: 249917647758
Ref: library/token token COMMENT17648061
Ref: 4f1c17648061
Ref: library/token token NEWLINE17648184
Ref: 24a317648184
Ref: library/token token NL17648286
Ref: 4f1d17648286
Ref: library/token token INDENT17648522
Ref: 230b17648522
Ref: library/token token DEDENT17648683
Ref: 24c117648683
Ref: library/token token FSTRING_START17648842
Ref: 250017648842
Ref: library/token token FSTRING_MIDDLE17649109
Ref: 250117649109
Ref: library/token token FSTRING_END17649535
Ref: 250217649535
Ref: library/token token TSTRING_START17649724
Ref: 4f2217649724
Ref: library/token token TSTRING_MIDDLE17650015
Ref: 4f2317650015
Ref: library/token token TSTRING_END17650464
Ref: 4f2417650464
Ref: library/token token ENDMARKER17650686
Ref: 24c517650686
Ref: library/token token ENCODING17650820
Ref: 4f2517650820
Ref: library/token token TYPE_IGNORE17651362
Ref: 4f2617651362
Ref: library/token token TYPE_COMMENT17651615
Ref: 4f2717651615
Ref: library/token token SOFT_KEYWORD17651850
Ref: 4f1717651850
Ref: library/token token ERRORTOKEN17652108
Ref: 4f2917652108
Ref: library/token token-operators-delimiters17652444
Ref: 252d17652444
Ref: library/token token LPAR17652982
Ref: 4f2a17652982
Ref: library/token token RPAR17653162
Ref: 4f2b17653162
Ref: library/token token LSQB17653342
Ref: 4f2c17653342
Ref: library/token token RSQB17653522
Ref: 4f2d17653522
Ref: library/token token COLON17653703
Ref: 4f2117653703
Ref: library/token token COMMA17653883
Ref: 4f2e17653883
Ref: library/token token SEMI17654062
Ref: 4f2f17654062
Ref: library/token token PLUS17654242
Ref: 4f1617654242
Ref: library/token token MINUS17654423
Ref: 4f3017654423
Ref: library/token token STAR17654602
Ref: 4f3117654602
Ref: library/token token SLASH17654783
Ref: 4f3217654783
Ref: library/token token VBAR17654962
Ref: 4f3317654962
Ref: library/token token AMPER17655143
Ref: 4f3417655143
Ref: library/token token LESS17655322
Ref: 4f3517655322
Ref: library/token token GREATER17655505
Ref: 4f3617655505
Ref: library/token token EQUAL17655683
Ref: 4f3717655683
Ref: library/token token DOT17655861
Ref: 4f3817655861
Ref: library/token token PERCENT17656045
Ref: 4f3917656045
Ref: library/token token LBRACE17656224
Ref: 4f1e17656224
Ref: library/token token RBRACE17656404
Ref: 4f1f17656404
Ref: library/token token EQEQUAL17656585
Ref: 4f3a17656585
Ref: library/token token NOTEQUAL17656767
Ref: 4f3b17656767
Ref: library/token token LESSEQUAL17656949
Ref: 4f3c17656949
Ref: library/token token GREATEREQUAL17657133
Ref: 4f3d17657133
Ref: library/token token TILDE17657307
Ref: 4f3e17657307
Ref: library/token token CIRCUMFLEX17657492
Ref: 4f3f17657492
Ref: library/token token LEFTSHIFT17657671
Ref: 4f4017657671
Ref: library/token token RIGHTSHIFT17657853
Ref: 4f4117657853
Ref: library/token token DOUBLESTAR17658034
Ref: 4f4217658034
Ref: library/token token PLUSEQUAL17658214
Ref: 4f4317658214
Ref: library/token token MINEQUAL17658394
Ref: 4f4417658394
Ref: library/token token STAREQUAL17658576
Ref: 4f4517658576
Ref: library/token token SLASHEQUAL17658758
Ref: 4f4617658758
Ref: library/token token PERCENTEQUAL17658941
Ref: 4f4717658941
Ref: library/token token AMPEREQUAL17659120
Ref: 4f4817659120
Ref: library/token token VBAREQUAL17659300
Ref: 4f4917659300
Ref: library/token token CIRCUMFLEXEQUAL17659487
Ref: 4f4a17659487
Ref: library/token token LEFTSHIFTEQUAL17659667
Ref: 4f4b17659667
Ref: library/token token RIGHTSHIFTEQUAL17659850
Ref: 4f4c17659850
Ref: library/token token DOUBLESTAREQUAL17660032
Ref: 4f4d17660032
Ref: library/token token DOUBLESLASH17660210
Ref: 4f4e17660210
Ref: library/token token DOUBLESLASHEQUAL17660396
Ref: 4f4f17660396
Ref: library/token token AT17660564
Ref: 4f5017660564
Ref: library/token token ATEQUAL17660749
Ref: 4f5117660749
Ref: library/token token RARROW17660929
Ref: 4f5217660929
Ref: library/token token ELLIPSIS17661112
Ref: 4f5317661112
Ref: library/token token COLONEQUAL17661296
Ref: 4f5417661296
Ref: library/token token EXCLAMATION17661478
Ref: 4f2017661478
Ref: library/token token N_TOKENS17661620
Ref: 4f5517661620
Ref: library/token token EXACT_TOKEN_TYPES17661707
Ref: 1b2617661707
Ref: token --- Python 解析木で使われる定数-Footnote-117662694
Node: keyword --- Python キーワードのテスト17662759
Ref: library/keyword doc17662987
Ref: 4f5617662987
Ref: library/keyword keyword-testing-for-python-keywords17662987
Ref: 4f5717662987
Ref: library/keyword module-keyword17662987
Ref: 8717662987
Ref: library/keyword translation-repo17662987
Ref: 4f5817662987
Ref: library/keyword keyword iskeyword17663399
Ref: 286417663399
Ref: library/keyword keyword kwlist17663540
Ref: 4f5917663540
Ref: library/keyword keyword issoftkeyword17663822
Ref: 4f2817663822
Ref: library/keyword keyword softkwlist17664003
Ref: 4f5a17664003
Ref: keyword --- Python キーワードのテスト-Footnote-117664370
Node: tokenize --- Python ソース用のトークナイザー17664437
Ref: library/tokenize doc17664670
Ref: 4f5b17664670
Ref: library/tokenize module-tokenize17664670
Ref: 10417664670
Ref: library/tokenize tokenize-tokenizer-for-python-source17664670
Ref: 4f5c17664670
Ref: library/tokenize translation-repo17664670
Ref: 4f5d17664670
Ref: tokenize --- Python ソース用のトークナイザー-Footnote-117666094
Node: Tokenizing input17666162
Ref: library/tokenize tokenizing-input17666316
Ref: 4f5e17666316
Ref: library/tokenize tokenize tokenize17666447
Ref: 8ee17666447
Ref: library/tokenize tokenize generate_tokens17668239
Ref: 8ef17668239
Ref: library/tokenize tokenize untokenize17669107
Ref: 1af317669107
Ref: library/tokenize tokenize detect_encoding17670201
Ref: 19ee17670201
Ref: library/tokenize tokenize open17671465
Ref: 2f1b17671465
Ref: library/tokenize tokenize TokenError17671704
Ref: 95417671704
Ref: Tokenizing input-Footnote-117672047
Ref: Tokenizing input-Footnote-217672089
Node: コマンドラインでの使用<9>17672131
Ref: library/tokenize command-line-usage17672307
Ref: 4f5f17672307
Ref: library/tokenize tokenize-cli17672307
Ref: 29117672307
Ref: library/tokenize cmdoption-tokenize-h17672596
Ref: 4f6017672596
Ref: library/tokenize cmdoption-tokenize-help17672596
Ref: 4f6117672596
Ref: library/tokenize cmdoption-tokenize-e17672687
Ref: 4f6217672687
Ref: library/tokenize cmdoption-tokenize-exact17672687
Ref: 4f6317672687
Node: 使用例<50>17673086
Ref: library/tokenize examples17673237
Ref: 4f6417673237
Node: tabnanny --- あいまいなインデントの検出17677803
Ref: library/tabnanny doc17678050
Ref: 4f6517678050
Ref: library/tabnanny module-tabnanny17678050
Ref: e617678050
Ref: library/tabnanny tabnanny-detection-of-ambiguous-indentation17678050
Ref: 4f6617678050
Ref: library/tabnanny translation-repo17678050
Ref: 4f6717678050
Ref: library/tabnanny tabnanny check17678708
Ref: 4f6817678708
Ref: library/tabnanny tabnanny verbose17679291
Ref: 4f6917679291
Ref: library/tabnanny tabnanny filename_only17679523
Ref: 4f6a17679523
Ref: library/tabnanny tabnanny NannyNag17679818
Ref: 4f6b17679818
Ref: library/tabnanny tabnanny process_tokens17680047
Ref: 4f6c17680047
Ref: tabnanny --- あいまいなインデントの検出-Footnote-117680409
Node: pyclbr --- Python モジュールブラウザーサポート17680477
Ref: library/pyclbr doc17680735
Ref: 4f6d17680735
Ref: library/pyclbr module-pyclbr17680735
Ref: bc17680735
Ref: library/pyclbr pyclbr-python-module-browser-support17680735
Ref: 4f6e17680735
Ref: library/pyclbr translation-repo17680735
Ref: 4f6f17680735
Ref: library/pyclbr pyclbr readmodule17681462
Ref: c0817681462
Ref: library/pyclbr pyclbr readmodule_ex17682074
Ref: c0917682074
Ref: pyclbr --- Python モジュールブラウザーサポート-Footnote-117683192
Node: Function オブジェクト17683258
Ref: library/pyclbr function-objects17683421
Ref: 4f7017683421
Ref: library/pyclbr pyclbr-function-objects17683421
Ref: 4f7117683421
Ref: library/pyclbr pyclbr Function17683490
Ref: 4f7217683490
Ref: library/pyclbr pyclbr Function file17683647
Ref: 4f7317683647
Ref: library/pyclbr pyclbr Function module17683735
Ref: 4f7417683735
Ref: library/pyclbr pyclbr Function name17683830
Ref: 4f7517683830
Ref: library/pyclbr pyclbr Function lineno17683892
Ref: 4f7617683892
Ref: library/pyclbr pyclbr Function parent17683988
Ref: 4f7717683988
Ref: library/pyclbr pyclbr Function children17684142
Ref: 4f7817684142
Ref: library/pyclbr pyclbr Function is_async17684314
Ref: 4f7917684314
Node: クラスオブジェクト<2>17684499
Ref: library/pyclbr class-objects17684662
Ref: 4f7a17684662
Ref: library/pyclbr pyclbr-class-objects17684662
Ref: 4f7b17684662
Ref: library/pyclbr pyclbr Class17684728
Ref: 4f7c17684728
Ref: library/pyclbr pyclbr Class file17684918
Ref: 4f7d17684918
Ref: library/pyclbr pyclbr Class module17685003
Ref: 4f7e17685003
Ref: library/pyclbr pyclbr Class name17685095
Ref: 4f7f17685095
Ref: library/pyclbr pyclbr Class lineno17685160
Ref: 4f8017685160
Ref: library/pyclbr pyclbr Class parent17685256
Ref: 4f8117685256
Ref: library/pyclbr pyclbr Class children17685406
Ref: 4f8217685406
Ref: library/pyclbr pyclbr Class super17685566
Ref: 4f8317685566
Ref: library/pyclbr pyclbr Class methods17685927
Ref: 4f8417685927
Node: py_compile --- Python ソースファイルをコンパイルする17686155
Ref: library/py_compile doc17686431
Ref: 4f8517686431
Ref: library/py_compile module-py_compile17686431
Ref: bb17686431
Ref: library/py_compile py-compile-compile-python-source-files17686431
Ref: 4f8617686431
Ref: library/py_compile translation-repo17686431
Ref: 4f8717686431
Ref: library/py_compile py_compile PyCompileError17687208
Ref: 4f8817687208
Ref: library/py_compile py_compile compile17687341
Ref: ded17687341
Ref: library/py_compile py_compile PycInvalidationMode17691709
Ref: 4f8917691709
Ref: library/py_compile py_compile PycInvalidationMode TIMESTAMP17692163
Ref: 4f8b17692163
Ref: library/py_compile py_compile PycInvalidationMode CHECKED_HASH17692445
Ref: 4f8a17692445
Ref: library/py_compile py_compile PycInvalidationMode UNCHECKED_HASH17692691
Ref: 4f8c17692691
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-117693285
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-217693355
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-317693397
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-417693439
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-517693481
Node: コマンドラインインターフェイス<4>17693523
Ref: library/py_compile command-line-interface17693675
Ref: 4f8d17693675
Ref: library/py_compile py-compile-cli17693675
Ref: 4f8e17693675
Ref: library/py_compile cmdoption-python-m-py_compile-arg-file17694135
Ref: 4f8f17694135
Ref: library/py_compile cmdoption-python-m-py_compile17694166
Ref: 4f9017694166
Ref: library/py_compile cmdoption-python-m-py_compile-q17694318
Ref: 4f9117694318
Ref: library/py_compile cmdoption-python-m-py_compile-quiet17694318
Ref: 4f9217694318
Node: compileall --- Python ライブラリをバイトコンパイルする17694723
Ref: library/compileall doc17694996
Ref: 4f9317694996
Ref: library/compileall compileall-byte-compile-python-libraries17694996
Ref: 4f9417694996
Ref: library/compileall module-compileall17694996
Ref: 2117694996
Ref: library/compileall translation-repo17694996
Ref: 4f9517694996
Ref: compileall --- Python ライブラリをバイトコンパイルする-Footnote-117696171
Node: コマンドラインでの使用<10>17696241
Ref: library/compileall command-line-use17696418
Ref: 4f9617696418
Ref: library/compileall compileall-cli17696418
Ref: 4f9717696418
Ref: library/compileall cmdoption-compileall-arg-directory17696649
Ref: 4f9817696649
Ref: library/compileall cmdoption-compileall-arg-file17696675
Ref: 4f9917696675
Ref: library/compileall cmdoption-compileall-l17696996
Ref: 4f9a17696996
Ref: library/compileall cmdoption-compileall-f17697208
Ref: 4f9b17697208
Ref: library/compileall cmdoption-compileall-q17697309
Ref: 4f9c17697309
Ref: library/compileall cmdoption-compileall-d17697563
Ref: 4f9d17697563
Ref: library/compileall cmdoption-compileall-s17698038
Ref: 4f9e17698038
Ref: library/compileall cmdoption-compileall-p17698253
Ref: 4f9f17698253
Ref: library/compileall cmdoption-compileall-x17698473
Ref: 4fa017698473
Ref: library/compileall cmdoption-compileall-i17698667
Ref: 4fa117698667
Ref: library/compileall cmdoption-compileall-b17698952
Ref: 4fa217698952
Ref: library/compileall cmdoption-compileall-r17699352
Ref: 4fa317699352
Ref: library/compileall cmdoption-compileall-j17699664
Ref: 4fa417699664
Ref: library/compileall cmdoption-compileall-invalidation-mode17699851
Ref: 4fa517699851
Ref: library/compileall cmdoption-compileall-o17700943
Ref: 4fa617700943
Ref: library/compileall cmdoption-compileall-e17701136
Ref: 4fa717701136
Ref: library/compileall cmdoption-compileall-hardlink-dupes17701216
Ref: 4fa817701216
Ref: コマンドラインでの使用<10>-Footnote-117702690
Node: パブリックな関数17702732
Ref: library/compileall public-functions17702909
Ref: 4fa917702909
Ref: library/compileall compileall compile_dir17702970
Ref: eec17702970
Ref: library/compileall compileall compile_file17707809
Ref: 119d17707809
Ref: library/compileall compileall compile_path17711308
Ref: 119e17711308
Ref: パブリックな関数-Footnote-117713434
Ref: パブリックな関数-Footnote-217713476
Node: dis --- Python バイトコードの逆アセンブラー17713518
Ref: library/dis doc17713774
Ref: 4faa17713774
Ref: library/dis dis-disassembler-for-python-bytecode17713774
Ref: 4fab17713774
Ref: library/dis module-dis17713774
Ref: 3b17713774
Ref: library/dis translation-repo17713774
Ref: 4fac17713774
Ref: dis --- Python バイトコードの逆アセンブラー-Footnote-117716967
Node: コマンドライン・インターフェース<13>17717030
Ref: library/dis command-line-interface17717209
Ref: 4fad17717209
Ref: library/dis dis-cli17717209
Ref: 4fae17717209
Ref: library/dis cmdoption-dis-h17717486
Ref: 4faf17717486
Ref: library/dis cmdoption-dis-help17717486
Ref: 4fb017717486
Ref: library/dis cmdoption-dis-C17717559
Ref: 4fb117717559
Ref: library/dis cmdoption-dis-show-caches17717559
Ref: 4fb217717559
Ref: library/dis cmdoption-dis-O17717645
Ref: 6f617717645
Ref: library/dis cmdoption-dis-show-offsets17717645
Ref: 4fb317717645
Ref: library/dis cmdoption-dis-P17717742
Ref: 4a017717742
Ref: library/dis cmdoption-dis-show-positions17717742
Ref: 4fb417717742
Ref: library/dis cmdoption-dis-S17717862
Ref: 4a117717862
Ref: library/dis cmdoption-dis-specialized17717862
Ref: 4fb517717862
Node: バイトコード解析17718117
Ref: library/dis bytecode-analysis17718317
Ref: 4fb617718317
Ref: library/dis dis Bytecode17718633
Ref: 49c17718633
Ref: library/dis dis Bytecode from_traceback17720693
Ref: 12df17720693
Ref: library/dis dis Bytecode codeobj17720995
Ref: 4fb717720995
Ref: library/dis dis Bytecode first_line17721090
Ref: 4fb817721090
Ref: library/dis dis Bytecode dis17721215
Ref: 12de17721215
Ref: library/dis dis Bytecode info17721437
Ref: 4fb917721437
Node: 解析関数17722180
Ref: library/dis analysis-functions17722359
Ref: 4fba17722359
Ref: library/dis dis code_info17722642
Ref: 15f417722642
Ref: library/dis dis show_code17723267
Ref: 12dd17723267
Ref: library/dis dis dis17723870
Ref: 49d17723870
Ref: library/dis dis distb17726037
Ref: 49e17726037
Ref: library/dis dis disassemble17726899
Ref: 49f17726899
Ref: library/dis dis disco17727058
Ref: 4fbb17727058
Ref: library/dis dis get_instructions17728568
Ref: 6f717728568
Ref: library/dis dis findlinestarts17729870
Ref: 4fbc17729870
Ref: library/dis dis findlabels17730604
Ref: 4fbd17730604
Ref: library/dis dis stack_effect17730775
Ref: 12e017730775
Ref: 解析関数-Footnote-117731726
Node: Python バイトコード命令17731768
Ref: library/dis bytecodes17731956
Ref: 9b617731956
Ref: library/dis python-bytecode-instructions17731956
Ref: 4fbe17731956
Ref: library/dis dis Instruction17732215
Ref: 49b17732215
Ref: library/dis dis Instruction opcode17732287
Ref: 4fbf17732287
Ref: library/dis dis Instruction opname17732497
Ref: 4fc117732497
Ref: library/dis dis Instruction baseopcode17732570
Ref: 4fc217732570
Ref: library/dis dis Instruction baseopname17732727
Ref: 4fc317732727
Ref: library/dis dis Instruction arg17732891
Ref: 4fc517732891
Ref: library/dis dis Instruction oparg17732993
Ref: 4fc617732993
Ref: library/dis dis Instruction argval17733058
Ref: 4fc717733058
Ref: library/dis dis Instruction argrepr17733147
Ref: 4fc817733147
Ref: library/dis dis Instruction offset17733283
Ref: 4fc917733283
Ref: library/dis dis Instruction start_offset17733377
Ref: 4fca17733377
Ref: library/dis dis Instruction cache_offset17733593
Ref: 4fcb17733593
Ref: library/dis dis Instruction end_offset17733695
Ref: 4fcc17733695
Ref: library/dis dis Instruction starts_line17733793
Ref: 4fcd17733793
Ref: library/dis dis Instruction line_number17733907
Ref: 4fce17733907
Ref: library/dis dis Instruction is_jump_target17734039
Ref: 4fcf17734039
Ref: library/dis dis Instruction jump_target17734206
Ref: 4fd017734206
Ref: library/dis dis Instruction positions17734344
Ref: 4fd117734344
Ref: library/dis dis Instruction cache_info17734504
Ref: 4fd217734504
Ref: library/dis dis Positions17735232
Ref: 1b7717735232
Ref: library/dis dis Positions lineno17735348
Ref: 4fd317735348
Ref: library/dis dis Positions end_lineno17735376
Ref: 4fd417735376
Ref: library/dis dis Positions col_offset17735408
Ref: 4fd517735408
Ref: library/dis dis Positions end_col_offset17735440
Ref: 4fd617735440
Ref: library/dis opcode-NOP17735814
Ref: 4fd717735814
Ref: library/dis opcode-NOT_TAKEN17735946
Ref: 5ab17735946
Ref: library/dis opcode-POP_ITER17736156
Ref: 5a617736156
Ref: library/dis opcode-POP_TOP17736261
Ref: 1a7b17736261
Ref: library/dis opcode-END_FOR17736342
Ref: 4fd817736342
Ref: library/dis opcode-END_SEND17736519
Ref: 4fd917736519
Ref: library/dis opcode-COPY17736655
Ref: afa17736655
Ref: library/dis opcode-SWAP17736866
Ref: afb17736866
Ref: library/dis opcode-CACHE17737027
Ref: aeb17737027
Ref: library/dis opcode-UNARY_NEGATIVE17737905
Ref: 4fda17737905
Ref: library/dis opcode-UNARY_NOT17737980
Ref: 1c8617737980
Ref: library/dis opcode-UNARY_INVERT17738161
Ref: 4fdb17738161
Ref: library/dis opcode-GET_ITER17738234
Ref: 4fdc17738234
Ref: library/dis opcode-GET_YIELD_FROM_ITER17738308
Ref: 4fdd17738308
Ref: library/dis opcode-TO_BOOL17738548
Ref: 1c8317738548
Ref: library/dis opcode-BINARY_OP17739065
Ref: 59c17739065
Ref: library/dis opcode-STORE_SUBSCR17739442
Ref: 1dc417739442
Ref: library/dis opcode-DELETE_SUBSCR17739612
Ref: 4fde17739612
Ref: library/dis opcode-BINARY_SLICE17739749
Ref: 8f317739749
Ref: library/dis opcode-STORE_SLICE17739960
Ref: 8f417739960
Ref: library/dis opcode-GET_AWAITABLE17740228
Ref: 1de017740228
Ref: library/dis opcode-GET_AITER17740861
Ref: 4fdf17740861
Ref: library/dis opcode-GET_ANEXT17741085
Ref: 4fe017741085
Ref: library/dis opcode-END_ASYNC_FOR17741292
Ref: e7317741292
Ref: library/dis opcode-CLEANUP_THROW17741784
Ref: 8f717741784
Ref: library/dis opcode-SET_ADD17742177
Ref: 4fe117742177
Ref: library/dis opcode-LIST_APPEND17742329
Ref: 4fe217742329
Ref: library/dis opcode-MAP_ADD17742490
Ref: e7517742490
Ref: library/dis opcode-RETURN_VALUE17743149
Ref: 1d3d17743149
Ref: library/dis opcode-YIELD_VALUE17743241
Ref: 7b917743241
Ref: library/dis opcode-SETUP_ANNOTATIONS17743658
Ref: 110d17743658
Ref: library/dis opcode-POP_EXCEPT17743959
Ref: 4fe317743959
Ref: library/dis opcode-RERAISE17744188
Ref: 4fe417744188
Ref: library/dis opcode-PUSH_EXC_INFO17744553
Ref: af517744553
Ref: library/dis opcode-CHECK_EXC_MATCH17744793
Ref: afc17744793
Ref: library/dis opcode-CHECK_EG_MATCH17745055
Ref: af417745055
Ref: library/dis opcode-WITH_EXCEPT_START17745512
Ref: 4fe517745512
Ref: library/dis opcode-LOAD_COMMON_CONSTANT17746055
Ref: 5a017746055
Ref: library/dis opcode-LOAD_BUILD_CLASS17746344
Ref: 4fe617746344
Ref: library/dis opcode-GET_LEN17746483
Ref: 4fe717746483
Ref: library/dis opcode-MATCH_MAPPING17746680
Ref: 4fe817746680
Ref: library/dis opcode-MATCH_SEQUENCE17747001
Ref: 4fe917747001
Ref: library/dis opcode-MATCH_KEYS17747415
Ref: b0317747415
Ref: library/dis opcode-STORE_NAME17747889
Ref: 4fea17747889
Ref: library/dis opcode-DELETE_NAME17748173
Ref: 4fec17748173
Ref: library/dis opcode-UNPACK_SEQUENCE17748339
Ref: 1de217748339
Ref: library/dis opcode-UNPACK_EX17748631
Ref: 4fed17748631
Ref: library/dis opcode-STORE_ATTR17749590
Ref: 1de117749590
Ref: library/dis opcode-DELETE_ATTR17749828
Ref: 4fee17749828
Ref: library/dis opcode-STORE_GLOBAL17750035
Ref: 4feb17750035
Ref: library/dis opcode-DELETE_GLOBAL17750196
Ref: 4fef17750196
Ref: library/dis opcode-LOAD_CONST17750352
Ref: 4ff017750352
Ref: library/dis opcode-LOAD_SMALL_INT17750458
Ref: 5a417750458
Ref: library/dis opcode-LOAD_NAME17750605
Ref: 4ff117750605
Ref: library/dis opcode-LOAD_LOCALS17750801
Ref: 8fc17750801
Ref: library/dis opcode-LOAD_FROM_DICT_OR_GLOBALS17751066
Ref: 8fb17751066
Ref: library/dis opcode-BUILD_TEMPLATE17751459
Ref: 59e17751459
Ref: library/dis opcode-BUILD_INTERPOLATION17751818
Ref: 59d17751818
Ref: library/dis opcode-BUILD_TUPLE17752831
Ref: 4ff217752831
Ref: library/dis opcode-BUILD_LIST17753157
Ref: 4ff317753157
Ref: library/dis opcode-BUILD_SET17753314
Ref: 4ff417753314
Ref: library/dis opcode-BUILD_MAP17753466
Ref: 59f17753466
Ref: library/dis opcode-BUILD_STRING17753854
Ref: 110a17753854
Ref: library/dis opcode-LIST_EXTEND17754019
Ref: 4ff517754019
Ref: library/dis opcode-SET_UPDATE17754188
Ref: 4ff617754188
Ref: library/dis opcode-DICT_UPDATE17754354
Ref: 4ff717754354
Ref: library/dis opcode-DICT_MERGE17754523
Ref: 4ff817754523
Ref: library/dis opcode-LOAD_ATTR17754664
Ref: 8f217754664
Ref: library/dis opcode-LOAD_SUPER_ATTR17755607
Ref: 8f017755607
Ref: library/dis opcode-COMPARE_OP17756678
Ref: d3617756678
Ref: library/dis opcode-IS_OP17757064
Ref: 1b7517757064
Ref: library/dis opcode-CONTAINS_OP17757194
Ref: 1b7417757194
Ref: library/dis opcode-IMPORT_NAME17757330
Ref: 4ff917757330
Ref: library/dis opcode-IMPORT_FROM17757750
Ref: 4ffa17757750
Ref: library/dis opcode-JUMP_FORWARD17757999
Ref: 1ba417757999
Ref: library/dis opcode-JUMP_BACKWARD17758109
Ref: afd17758109
Ref: library/dis opcode-JUMP_BACKWARD_NO_INTERRUPT17758243
Ref: af117758243
Ref: library/dis opcode-POP_JUMP_IF_TRUE17758403
Ref: 1c8417758403
Ref: library/dis opcode-POP_JUMP_IF_FALSE17758966
Ref: 1c8517758966
Ref: library/dis opcode-POP_JUMP_IF_NOT_NONE17759532
Ref: 1d9b17759532
Ref: library/dis opcode-POP_JUMP_IF_NONE17759802
Ref: 1d9a17759802
Ref: library/dis opcode-FOR_ITER17760064
Ref: 1ce317760064
Ref: library/dis opcode-LOAD_GLOBAL17760484
Ref: 1c7f17760484
Ref: library/dis opcode-LOAD_FAST17760780
Ref: 4ffb17760780
Ref: library/dis opcode-LOAD_FAST_BORROW17761120
Ref: 5a217761120
Ref: library/dis opcode-LOAD_FAST_LOAD_FAST17761284
Ref: 4ffc17761284
Ref: library/dis opcode-LOAD_FAST_BORROW_LOAD_FAST_BORROW17761475
Ref: 5a317761475
Ref: library/dis opcode-LOAD_FAST_CHECK17761689
Ref: 8f917761689
Ref: library/dis opcode-LOAD_FAST_AND_CLEAR17761938
Ref: 8f817761938
Ref: library/dis opcode-STORE_FAST17762236
Ref: 1c8817762236
Ref: library/dis opcode-STORE_FAST_STORE_FAST17762344
Ref: 4ffd17762344
Ref: library/dis opcode-STORE_FAST_LOAD_FAST17762550
Ref: 4ffe17762550
Ref: library/dis opcode-DELETE_FAST17762798
Ref: 4fff17762798
Ref: library/dis opcode-MAKE_CELL17762904
Ref: af217762904
Ref: library/dis opcode-LOAD_DEREF17763078
Ref: 500017763078
Ref: library/dis opcode-LOAD_FROM_DICT_OR_DEREF17763366
Ref: 8fa17763366
Ref: library/dis opcode-STORE_DEREF17763893
Ref: 500117763893
Ref: library/dis opcode-DELETE_DEREF17764141
Ref: 500217764141
Ref: library/dis opcode-COPY_FREE_VARS17764437
Ref: af017764437
Ref: library/dis opcode-RAISE_VARARGS17764683
Ref: 500317764683
Ref: library/dis opcode-CALL17765152
Ref: af817765152
Ref: library/dis opcode-CALL_KW17765937
Ref: 5a817765937
Ref: library/dis opcode-CALL_FUNCTION_EX17766769
Ref: 110c17766769
Ref: library/dis opcode-PUSH_NULL17767447
Ref: af917767447
Ref: library/dis opcode-MAKE_FUNCTION17767649
Ref: 110b17767649
Ref: library/dis opcode-SET_FUNCTION_ATTRIBUTE17768147
Ref: 500417768147
Ref: library/dis opcode-BUILD_SLICE17769067
Ref: 500517769067
Ref: library/dis opcode-EXTENDED_ARG17769536
Ref: 1d3b17769536
Ref: library/dis opcode-CONVERT_VALUE17769873
Ref: 500617769873
Ref: library/dis opcode-FORMAT_SIMPLE17770349
Ref: 500717770349
Ref: library/dis opcode-FORMAT_WITH_SPEC17770615
Ref: 500817770615
Ref: library/dis opcode-MATCH_CLASS17770932
Ref: b0217770932
Ref: library/dis opcode-RESUME17771656
Ref: 7ba17771656
Ref: library/dis opcode-RETURN_GENERATOR17772401
Ref: aee17772401
Ref: library/dis opcode-SEND17772695
Ref: aef17772695
Ref: library/dis opcode-HAVE_ARGUMENT17773060
Ref: 8a017773060
Ref: library/dis opcode-CALL_INTRINSIC_117773932
Ref: 8f517773932
Ref: library/dis opcode-CALL_INTRINSIC_217777255
Ref: 8f617777255
Ref: library/dis opcode-LOAD_SPECIAL17779116
Ref: 5a517779116
Ref: library/dis opcode-SETUP_FINALLY17779634
Ref: 500917779634
Ref: library/dis opcode-SETUP_CLEANUP17779898
Ref: 500a17779898
Ref: library/dis opcode-SETUP_WITH17780303
Ref: 500b17780303
Ref: library/dis opcode-POP_BLOCK17780733
Ref: 500c17780733
Ref: library/dis opcode-JUMP17780886
Ref: 500d17780886
Ref: library/dis opcode-JUMP_NO_INTERRUPT17780903
Ref: 1dbe17780903
Ref: library/dis opcode-JUMP_IF_TRUE17781070
Ref: 5a917781070
Ref: library/dis opcode-JUMP_IF_FALSE17781095
Ref: 5aa17781095
Ref: library/dis opcode-LOAD_CLOSURE17781267
Ref: 1c8217781267
Node: 命令コードコレクション17781565
Ref: library/dis id117781732
Ref: 500e17781732
Ref: library/dis opcode-collections17781732
Ref: 4fc017781732
Ref: library/dis dis opname17782147
Ref: 4fc417782147
Ref: library/dis dis opmap17782293
Ref: 500f17782293
Ref: library/dis dis cmp_op17782392
Ref: 501017782392
Ref: library/dis dis hasarg17782474
Ref: 7a417782474
Ref: library/dis dis hasconst17782583
Ref: 501117782583
Ref: library/dis dis hasfree17782679
Ref: 501217782679
Ref: library/dis dis hasname17783028
Ref: 501317783028
Ref: library/dis dis hasjump17783141
Ref: 501417783141
Ref: library/dis dis haslocal17783281
Ref: 501517783281
Ref: library/dis dis hascompare17783389
Ref: 501617783389
Ref: library/dis dis hasexc17783478
Ref: 8a117783478
Ref: library/dis dis hasjrel17783593
Ref: 501717783593
Ref: library/dis dis hasjabs17783791
Ref: 501817783791
Node: pickletools --- pickle 開発者用のツール群17783984
Ref: library/pickletools doc17784161
Ref: 501917784161
Ref: library/pickletools module-pickletools17784161
Ref: ac17784161
Ref: library/pickletools pickletools-tools-for-pickle-developers17784161
Ref: 501a17784161
Ref: library/pickletools translation-repo17784161
Ref: 501b17784161
Ref: pickletools --- pickle 開発者用のツール群-Footnote-117784952
Node: コマンドラインでの使用<11>17785023
Ref: library/pickletools command-line-usage17785178
Ref: 501c17785178
Ref: library/pickletools pickletools-cli17785178
Ref: 2f6917785178
Node: コマンドラインオプション<6>17786413
Ref: library/pickletools command-line-options17786526
Ref: 501d17786526
Ref: library/pickletools cmdoption-pickletools-a17786609
Ref: 501e17786609
Ref: library/pickletools cmdoption-pickletools-annotate17786609
Ref: 501f17786609
Ref: library/pickletools cmdoption-pickletools-o17786719
Ref: 502017786719
Ref: library/pickletools cmdoption-pickletools-output17786719
Ref: 502117786719
Ref: library/pickletools cmdoption-pickletools-l17786804
Ref: 502217786804
Ref: library/pickletools cmdoption-pickletools-indentlevel17786804
Ref: 502317786804
Ref: library/pickletools cmdoption-pickletools-m17786920
Ref: 502417786920
Ref: library/pickletools cmdoption-pickletools-memo17786920
Ref: 502517786920
Ref: library/pickletools cmdoption-pickletools-p17787074
Ref: 502617787074
Ref: library/pickletools cmdoption-pickletools-preamble17787074
Ref: 502717787074
Ref: library/pickletools cmdoption-pickletools-arg-pickle_file17787215
Ref: 502817787215
Node: Programmatic interface17787442
Ref: library/pickletools programmatic-interface17787597
Ref: 502917787597
Ref: library/pickletools pickletools dis17787664
Ref: 108417787664
Ref: library/pickletools pickletools genops17788714
Ref: 502a17788714
Ref: library/pickletools pickletools optimize17789311
Ref: 2f5117789311
Node: MS Windows 固有のサービス17789700
Ref: library/windows doc17789861
Ref: 502b17789861
Ref: library/windows ms-windows-specific-services17789861
Ref: 502c17789861
Ref: library/windows mswin-specific-services17789861
Ref: 243017789861
Ref: library/windows translation-repo17789861
Ref: 502d17789861
Node: msvcrt --- MS VC++ ランタイムの有用なルーチン群17790430
Ref: library/msvcrt doc17790621
Ref: 502e17790621
Ref: library/msvcrt module-msvcrt17790621
Ref: 9717790621
Ref: library/msvcrt msvcrt-useful-routines-from-the-ms-vc-runtime17790621
Ref: 502f17790621
Ref: msvcrt --- MS VC++ ランタイムの有用なルーチン群-Footnote-117792176
Node: ファイル操作関連17792246
Ref: library/msvcrt file-operations17792403
Ref: 503017792403
Ref: library/msvcrt msvcrt-files17792403
Ref: 503117792403
Ref: library/msvcrt msvcrt locking17792464
Ref: 49c517792464
Ref: library/msvcrt msvcrt LK_LOCK17793152
Ref: 503217793152
Ref: library/msvcrt msvcrt LK_RLCK17793182
Ref: 503317793182
Ref: library/msvcrt msvcrt LK_NBLCK17793428
Ref: 503417793428
Ref: library/msvcrt msvcrt LK_NBRLCK17793459
Ref: 503517793459
Ref: library/msvcrt msvcrt LK_UNLCK17793658
Ref: 503617793658
Ref: library/msvcrt msvcrt setmode17793844
Ref: 503717793844
Ref: library/msvcrt msvcrt open_osfhandle17794171
Ref: 49c617794171
Ref: library/msvcrt msvcrt get_osfhandle17794847
Ref: 49c417794847
Node: コンソール I/O 関連17795132
Ref: library/msvcrt console-i-o17795316
Ref: 503817795316
Ref: library/msvcrt msvcrt-console17795316
Ref: 503917795316
Ref: library/msvcrt msvcrt kbhit17795382
Ref: 503a17795382
Ref: library/msvcrt msvcrt getch17795507
Ref: 503b17795507
Ref: library/msvcrt msvcrt getwch17795995
Ref: 17ad17795995
Ref: library/msvcrt msvcrt getche17796115
Ref: 503c17796115
Ref: library/msvcrt msvcrt getwche17796263
Ref: 17ae17796263
Ref: library/msvcrt msvcrt putch17796385
Ref: 503d17796385
Ref: library/msvcrt msvcrt putwch17796538
Ref: 17af17796538
Ref: library/msvcrt msvcrt ungetch17796685
Ref: 503e17796685
Ref: library/msvcrt msvcrt ungetwch17796980
Ref: 503f17796980
Node: その多の関数17797131
Ref: library/msvcrt msvcrt-other17797282
Ref: 504017797282
Ref: library/msvcrt other-functions17797282
Ref: 504117797282
Ref: library/msvcrt msvcrt heapmin17797333
Ref: 504217797333
Ref: library/msvcrt msvcrt set_error_mode17797527
Ref: 504317797527
Ref: library/msvcrt msvcrt OUT_TO_DEFAULT17797900
Ref: 504517797900
Ref: library/msvcrt msvcrt OUT_TO_STDERR17798046
Ref: 504617798046
Ref: library/msvcrt msvcrt OUT_TO_MSGBOX17798179
Ref: 504717798179
Ref: library/msvcrt msvcrt REPORT_ERRMODE17798309
Ref: 504417798309
Ref: library/msvcrt msvcrt CrtSetReportMode17798448
Ref: 504817798448
Ref: library/msvcrt msvcrt CrtSetReportFile17798837
Ref: 504917798837
Ref: library/msvcrt msvcrt CRT_WARN17799235
Ref: 504b17799235
Ref: library/msvcrt msvcrt CRT_ERROR17799353
Ref: 504c17799353
Ref: library/msvcrt msvcrt CRT_ASSERT17799474
Ref: 504d17799474
Ref: library/msvcrt msvcrt CRTDBG_MODE_DEBUG17799534
Ref: 504e17799534
Ref: library/msvcrt msvcrt CRTDBG_MODE_FILE17799633
Ref: 504a17799633
Ref: library/msvcrt msvcrt CRTDBG_MODE_WNDW17799855
Ref: 504f17799855
Ref: library/msvcrt msvcrt CRTDBG_REPORT_MODE17800018
Ref: 505017800018
Ref: library/msvcrt msvcrt CRT_ASSEMBLY_VERSION17800115
Ref: 171917800115
Ref: library/msvcrt msvcrt VC_ASSEMBLY_PUBLICKEYTOKEN17800230
Ref: 171a17800230
Ref: library/msvcrt msvcrt LIBRARIES_ASSEMBLY_NAME_PREFIX17800364
Ref: 171b17800364
Node: winreg --- Windows レジストリへのアクセス17800504
Ref: library/winreg doc17800767
Ref: 505117800767
Ref: library/winreg module-winreg17800767
Ref: 11f17800767
Ref: library/winreg translation-repo17800767
Ref: 505217800767
Ref: library/winreg winreg-windows-registry-access17800767
Ref: 505317800767
Ref: library/winreg exception-changed17801422
Ref: 505517801422
Ref: winreg --- Windows レジストリへのアクセス-Footnote-117801768
Node: 関数<14>17801832
Ref: library/winreg functions17801950
Ref: 505617801950
Ref: library/winreg id117801950
Ref: 505717801950
Ref: library/winreg winreg CloseKey17802044
Ref: 505817802044
Ref: library/winreg winreg ConnectRegistry17802474
Ref: 49cb17802474
Ref: library/winreg winreg CreateKey17803375
Ref: 49cc17803375
Ref: library/winreg winreg CreateKeyEx17804595
Ref: 171c17804595
Ref: library/winreg winreg DeleteKey17806326
Ref: 49cd17806326
Ref: library/winreg winreg DeleteKeyEx17807327
Ref: 171d17807327
Ref: library/winreg winreg DeleteTree17809028
Ref: 1a0a17809028
Ref: library/winreg winreg DeleteValue17809710
Ref: 49ce17809710
Ref: library/winreg winreg EnumKey17810179
Ref: 49cf17810179
Ref: library/winreg winreg EnumValue17811002
Ref: 49d017811002
Ref: library/winreg winreg ExpandEnvironmentStrings17812510
Ref: 17b017812510
Ref: library/winreg winreg FlushKey17812908
Ref: 505f17812908
Ref: library/winreg winreg LoadKey17813983
Ref: 49d117813983
Ref: library/winreg winreg OpenKey17815447
Ref: 49d217815447
Ref: library/winreg winreg OpenKeyEx17815521
Ref: 506217815521
Ref: library/winreg winreg QueryInfoKey17816943
Ref: 49d417816943
Ref: library/winreg winreg QueryValue17817930
Ref: 49d517817930
Ref: library/winreg winreg QueryValueEx17819057
Ref: 19c917819057
Ref: library/winreg winreg SaveKey17820116
Ref: 49d617820116
Ref: library/winreg winreg SetValue17821338
Ref: 49d717821338
Ref: library/winreg winreg SetValueEx17822799
Ref: 1d2117822799
Ref: library/winreg winreg DisableReflectionKey17824391
Ref: 171e17824391
Ref: library/winreg winreg EnableReflectionKey17825220
Ref: 171f17825220
Ref: library/winreg winreg QueryReflectionKey17825881
Ref: 172017825881
Ref: 関数<14>-Footnote-117826491
Ref: 関数<14>-Footnote-217826568
Node: 定数<11>17826645
Ref: library/winreg constants17826817
Ref: 506717826817
Ref: library/winreg id217826817
Ref: 506817826817
Node: HKEY_* 定数17826990
Ref: library/winreg hkey-constants17827077
Ref: 505a17827077
Ref: library/winreg id317827077
Ref: 506917827077
Ref: library/winreg winreg HKEY_CLASSES_ROOT17827122
Ref: 506a17827122
Ref: library/winreg winreg HKEY_CURRENT_USER17827444
Ref: 506b17827444
Ref: library/winreg winreg HKEY_LOCAL_MACHINE17827816
Ref: 506117827816
Ref: library/winreg winreg HKEY_USERS17828141
Ref: 506017828141
Ref: library/winreg winreg HKEY_PERFORMANCE_DATA17828395
Ref: 506c17828395
Ref: library/winreg winreg HKEY_CURRENT_CONFIG17828753
Ref: 506d17828753
Ref: library/winreg winreg HKEY_DYN_DATA17828935
Ref: 506e17828935
Node: アクセス権限17829070
Ref: library/winreg access-rights17829175
Ref: 505c17829175
Ref: library/winreg id417829175
Ref: 506f17829175
Ref: library/winreg winreg KEY_ALL_ACCESS17829335
Ref: 507017829335
Ref: library/winreg winreg KEY_WRITE17829638
Ref: 505b17829638
Ref: library/winreg winreg KEY_READ17829805
Ref: 506317829805
Ref: library/winreg winreg KEY_EXECUTE17830006
Ref: 507617830006
Ref: library/winreg winreg KEY_QUERY_VALUE17830082
Ref: 507117830082
Ref: library/winreg winreg KEY_SET_VALUE17830191
Ref: 506517830191
Ref: library/winreg winreg KEY_CREATE_SUB_KEY17830304
Ref: 507217830304
Ref: library/winreg winreg KEY_ENUMERATE_SUB_KEYS17830413
Ref: 507317830413
Ref: library/winreg winreg KEY_NOTIFY17830532
Ref: 507417830532
Ref: library/winreg winreg KEY_CREATE_LINK17830669
Ref: 507517830669
Ref: アクセス権限-Footnote-117830857
Node: 64-bit 特有のアクセス権17830934
Ref: library/winreg bit-access-rights17831020
Ref: 507717831020
Ref: library/winreg bit-specific17831020
Ref: 507817831020
Ref: library/winreg winreg KEY_WOW64_64KEY17831208
Ref: 505d17831208
Ref: library/winreg winreg KEY_WOW64_32KEY17831450
Ref: 507917831450
Ref: 64-bit 特有のアクセス権-Footnote-117831728
Node: 値の型17831800
Ref: library/winreg id517831883
Ref: 507a17831883
Ref: library/winreg value-types17831883
Ref: 506617831883
Ref: library/winreg winreg REG_BINARY17832015
Ref: 507b17832015
Ref: library/winreg winreg REG_DWORD17832101
Ref: 507c17832101
Ref: library/winreg winreg REG_DWORD_LITTLE_ENDIAN17832162
Ref: 507d17832162
Ref: library/winreg winreg REG_DWORD_BIG_ENDIAN17832314
Ref: 507e17832314
Ref: library/winreg winreg REG_EXPAND_SZ17832422
Ref: 505e17832422
Ref: library/winreg winreg REG_LINK17832561
Ref: 507f17832561
Ref: library/winreg winreg REG_MULTI_SZ17832641
Ref: 1fd217832641
Ref: library/winreg winreg REG_NONE17832862
Ref: 508017832862
Ref: library/winreg winreg REG_QWORD17832940
Ref: 10c217832940
Ref: library/winreg winreg REG_QWORD_LITTLE_ENDIAN17833029
Ref: 508117833029
Ref: library/winreg winreg REG_RESOURCE_LIST17833209
Ref: 508217833209
Ref: library/winreg winreg REG_FULL_RESOURCE_DESCRIPTOR17833308
Ref: 508317833308
Ref: library/winreg winreg REG_RESOURCE_REQUIREMENTS_LIST17833406
Ref: 508417833406
Ref: library/winreg winreg REG_SZ17833509
Ref: 506417833509
Ref: 値の型-Footnote-117833624
Node: レジストリハンドルオブジェクト17833701
Ref: library/winreg handle-object17833854
Ref: 505417833854
Ref: library/winreg registry-handle-objects17833854
Ref: 508517833854
Ref: library/winreg winreg PyHKEY Close17835580
Ref: 505917835580
Ref: library/winreg winreg PyHKEY Detach17835761
Ref: 49d317835761
Ref: library/winreg winreg PyHKEY __enter__17836559
Ref: 508617836559
Ref: library/winreg winreg PyHKEY __exit__17836597
Ref: 508717836597
Node: winsound --- Windows 用の音声再生インターフェース17837247
Ref: library/winsound doc17837440
Ref: 508817837440
Ref: library/winsound module-winsound17837440
Ref: 12017837440
Ref: library/winsound translation-repo17837440
Ref: 508917837440
Ref: library/winsound winsound-sound-playing-interface-for-windows17837440
Ref: 508a17837440
Ref: winsound --- Windows 用の音声再生インターフェース-Footnote-117837960
Node: 関数<15>17838026
Ref: library/winsound functions17838155
Ref: 508b17838155
Ref: library/winsound winsound Beep17838186
Ref: 10c417838186
Ref: library/winsound winsound PlaySound17838642
Ref: 10c617838642
Ref: library/winsound winsound MessageBeep17839383
Ref: 10c517839383
Node: 定数<12>17840179
Ref: library/winsound constants17840308
Ref: 508c17840308
Ref: library/winsound winsound SND_FILENAME17840339
Ref: 508d17840339
Ref: library/winsound winsound SND_ALIAS17840531
Ref: 508e17840531
Ref: library/winsound winsound SND_LOOP17842443
Ref: 509017842443
Ref: library/winsound winsound SND_MEMORY17842755
Ref: 509217842755
Ref: library/winsound winsound SND_PURGE17843305
Ref: 509317843305
Ref: library/winsound winsound SND_ASYNC17843571
Ref: 509117843571
Ref: library/winsound winsound SND_NODEFAULT17843709
Ref: 508f17843709
Ref: library/winsound winsound SND_NOSTOP17843881
Ref: 509417843881
Ref: library/winsound winsound SND_NOWAIT17843993
Ref: 509517843993
Ref: library/winsound winsound SND_APPLICATION17844275
Ref: 509617844275
Ref: library/winsound winsound SND_SENTRY17844515
Ref: 509717844515
Ref: library/winsound winsound SND_SYNC17844641
Ref: 509817844641
Ref: library/winsound winsound SND_SYSTEM17844776
Ref: 509917844776
Ref: library/winsound winsound MB_ICONASTERISK17844922
Ref: 509a17844922
Ref: library/winsound winsound MB_ICONEXCLAMATION17845018
Ref: 509b17845018
Ref: library/winsound winsound MB_ICONHAND17845121
Ref: 509c17845121
Ref: library/winsound winsound MB_ICONQUESTION17845210
Ref: 509d17845210
Ref: library/winsound winsound MB_OK17845307
Ref: 509e17845307
Ref: library/winsound winsound MB_ICONERROR17845393
Ref: 509f17845393
Ref: library/winsound winsound MB_ICONINFORMATION17845512
Ref: 50a017845512
Ref: library/winsound winsound MB_ICONSTOP17845640
Ref: 50a117845640
Ref: library/winsound winsound MB_ICONWARNING17845758
Ref: 50a217845758
Node: Unix-specific services17845886
Ref: library/unix doc17846090
Ref: 50a317846090
Ref: library/unix translation-repo17846090
Ref: 50a417846090
Ref: library/unix unix17846090
Ref: 50a517846090
Ref: library/unix unix-specific-services17846090
Ref: 50a617846090
Node: shlex --- 単純な字句解析17847299
Ref: library/shlex doc17847457
Ref: 50a717847457
Ref: library/shlex module-shlex17847457
Ref: cc17847457
Ref: library/shlex shlex-simple-lexical-analysis17847457
Ref: 50a817847457
Ref: library/shlex shlex split17848003
Ref: 94e17848003
Ref: library/shlex shlex join17848697
Ref: def17848697
Ref: library/shlex shlex quote17849156
Ref: 78717849156
Ref: library/shlex shlex-quote-warning17849438
Ref: 39b217849438
Ref: library/shlex shlex shlex17851131
Ref: 108e17851131
Ref: shlex --- 単純な字句解析-Footnote-117853374
Node: shlex オブジェクト17853439
Ref: library/shlex id117853552
Ref: 50ac17853552
Ref: library/shlex shlex-objects17853552
Ref: 50ad17853552
Ref: library/shlex shlex shlex get_token17853700
Ref: 50ae17853700
Ref: library/shlex shlex shlex push_token17854238
Ref: 50af17854238
Ref: library/shlex shlex shlex read_token17854356
Ref: 50b117854356
Ref: library/shlex shlex shlex sourcehook17854694
Ref: 50b217854694
Ref: library/shlex shlex shlex push_source17856861
Ref: 50b417856861
Ref: library/shlex shlex shlex pop_source17857252
Ref: 50b517857252
Ref: library/shlex shlex shlex error_leader17857531
Ref: 50b617857531
Ref: library/shlex shlex shlex commenters17858395
Ref: 50a917858395
Ref: library/shlex shlex shlex wordchars17858662
Ref: 50ab17858662
Ref: library/shlex shlex shlex whitespace17859358
Ref: 50b817859358
Ref: library/shlex shlex shlex escape17859635
Ref: 50b917859635
Ref: library/shlex shlex shlex quotes17859842
Ref: 50ba17859842
Ref: library/shlex shlex shlex escapedquotes17860259
Ref: 50bb17860259
Ref: library/shlex shlex shlex whitespace_split17860547
Ref: 50b717860547
Ref: library/shlex shlex shlex infile17861093
Ref: 50aa17861093
Ref: library/shlex shlex shlex instream17861414
Ref: 50bc17861414
Ref: library/shlex shlex shlex source17861558
Ref: 50b317861558
Ref: library/shlex shlex shlex debug17862376
Ref: 50bd17862376
Ref: library/shlex shlex shlex lineno17862742
Ref: 50be17862742
Ref: library/shlex shlex shlex token17862857
Ref: 50bf17862857
Ref: library/shlex shlex shlex eof17863015
Ref: 50b017863015
Ref: library/shlex shlex shlex punctuation_chars17863232
Ref: 1fc517863232
Node: 解析規則17863639
Ref: library/shlex parsing-rules17863795
Ref: 50c017863795
Ref: library/shlex shlex-parsing-rules17863795
Ref: 50c117863795
Node: Improved Compatibility with Shells17865934
Ref: library/shlex improved-compatibility-with-shells17866057
Ref: 50c217866057
Ref: library/shlex improved-shell-compatibility17866057
Ref: 108f17866057
Node: posix --- 最も一般的な POSIX システムコール群17868893
Ref: library/posix doc17869101
Ref: 50c317869101
Ref: library/posix module-posix17869101
Ref: b217869101
Ref: library/posix posix-the-most-common-posix-system-calls17869101
Ref: 50c417869101
Ref: library/posix translation-repo17869101
Ref: 50c517869101
Node: ラージファイルのサポート17870527
Ref: library/posix large-file-support17870707
Ref: 50c617870707
Ref: library/posix posix-large-files17870707
Ref: 50c717870707
Node: 注目すべきモジュールの内容17872290
Ref: library/posix notable-module-contents17872470
Ref: 50c817872470
Ref: library/posix posix-contents17872470
Ref: 50c917872470
Ref: library/posix posix environ17872685
Ref: 50ca17872685
Node: pwd --- パスワードデータベース17873981
Ref: library/pwd doc17874196
Ref: 50cb17874196
Ref: library/pwd module-pwd17874196
Ref: ba17874196
Ref: library/pwd pwd-the-password-database17874196
Ref: 50cc17874196
Ref: library/pwd translation-repo17874196
Ref: 50cd17874196
Ref: library/pwd pwd getpwuid17876852
Ref: 201f17876852
Ref: library/pwd pwd getpwnam17876993
Ref: 39a217876993
Ref: library/pwd pwd getpwall17877150
Ref: 50ce17877150
Node: grp --- グループデータベース17877484
Ref: library/grp doc17877685
Ref: 50cf17877685
Ref: library/grp grp-the-group-database17877685
Ref: 50d017877685
Ref: library/grp module-grp17877685
Ref: 6917877685
Ref: library/grp translation-repo17877685
Ref: 50d117877685
Ref: library/grp grp getgrgid17879851
Ref: 10e417879851
Ref: library/grp grp getgrnam17880277
Ref: 39a117880277
Ref: library/grp grp getgrall17880540
Ref: 1b2817880540
Node: termios --- POSIX スタイルの端末制御17880835
Ref: library/termios doc17881030
Ref: 50d217881030
Ref: library/termios module-termios17881030
Ref: ea17881030
Ref: library/termios termios-posix-style-tty-control17881030
Ref: 50d317881030
Ref: library/termios translation-repo17881030
Ref: 50d417881030
Ref: library/termios termios tcgetattr17882507
Ref: 1c1b17882507
Ref: library/termios termios tcsetattr17883081
Ref: 1c8e17883081
Ref: library/termios termios TCSANOW17883361
Ref: 50d517883361
Ref: library/termios termios TCSADRAIN17883440
Ref: 50d617883440
Ref: library/termios termios TCSAFLUSH17883546
Ref: 50d717883546
Ref: library/termios termios tcsendbreak17883694
Ref: 50d817883694
Ref: library/termios termios tcdrain17884000
Ref: 50d917884000
Ref: library/termios termios tcflush17884152
Ref: 50da17884152
Ref: library/termios termios tcflow17884474
Ref: 50db17884474
Ref: library/termios termios tcgetwinsize17884892
Ref: 50dc17884892
Ref: library/termios termios tcsetwinsize17885137
Ref: 194f17885137
Ref: termios --- POSIX スタイルの端末制御-Footnote-117885753
Node: 使用例<51>17885800
Ref: library/termios example17885895
Ref: 50dd17885895
Ref: library/termios termios-example17885895
Ref: 50de17885895
Node: tty --- 端末制御用の関数群17886694
Ref: library/tty doc17886892
Ref: 50df17886892
Ref: library/tty module-tty17886892
Ref: 10917886892
Ref: library/tty translation-repo17886892
Ref: 50e017886892
Ref: library/tty tty-terminal-control-functions17886892
Ref: 50e117886892
Ref: library/tty tty cfmakeraw17887382
Ref: 1c6817887382
Ref: library/tty tty cfmakecbreak17887607
Ref: 1c1d17887607
Ref: library/tty tty setraw17888183
Ref: 1c6717888183
Ref: library/tty tty setcbreak17888675
Ref: 1c1c17888675
Ref: tty --- 端末制御用の関数群-Footnote-117889709
Node: pty --- 擬似端末ユーティリティ17889772
Ref: library/pty doc17889978
Ref: 50e217889978
Ref: library/pty module-pty17889978
Ref: b917889978
Ref: library/pty pty-pseudo-terminal-utilities17889978
Ref: 50e317889978
Ref: library/pty translation-repo17889978
Ref: 50e417889978
Ref: library/pty pty fork17890658
Ref: 1ce917890658
Ref: library/pty pty openpty17891499
Ref: 58017891499
Ref: library/pty pty spawn17891899
Ref: 133117891899
Ref: pty --- 擬似端末ユーティリティ-Footnote-117894232
Node: 使用例<52>17894295
Ref: library/pty example17894386
Ref: 50e517894386
Ref: 使用例<52>-Footnote-117895650
Node: fcntl --- fcntl および ioctl システムコール17895696
Ref: library/fcntl doc17895904
Ref: 50e617895904
Ref: library/fcntl fcntl-the-fcntl-and-ioctl-system-calls17895904
Ref: 50e717895904
Ref: library/fcntl module-fcntl17895904
Ref: 5c17895904
Ref: library/fcntl translation-repo17895904
Ref: 50e817895904
Ref: library/fcntl fcntl fcntl17899748
Ref: 198317899748
Ref: library/fcntl fcntl ioctl17901880
Ref: 183317901880
Ref: library/fcntl fcntl flock17904724
Ref: 49c317904724
Ref: library/fcntl fcntl lockf17905407
Ref: 17a517905407
Ref: library/fcntl fcntl LOCK_UN17905864
Ref: 50e917905864
Ref: library/fcntl fcntl LOCK_SH17905936
Ref: 50ea17905936
Ref: library/fcntl fcntl LOCK_EX17906005
Ref: 50eb17906005
Ref: library/fcntl fcntl LOCK_NB17906078
Ref: 50ec17906078
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-117908539
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-217908584
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-317908629
Node: resource --- リソース使用情報17908674
Ref: library/resource doc17908894
Ref: 50ed17908894
Ref: library/resource module-resource17908894
Ref: c417908894
Ref: library/resource resource-resource-usage-information17908894
Ref: 50ee17908894
Ref: library/resource translation-repo17908894
Ref: 50ef17908894
Ref: library/resource resource error17909565
Ref: 50f017909565
Ref: resource --- リソース使用情報-Footnote-117909911
Node: リソースの制限17909953
Ref: library/resource resource-limits17910084
Ref: 50f117910084
Ref: library/resource resource RLIM_INFINITY17911452
Ref: 3ed17911452
Ref: library/resource resource RLIM_SAVED_CUR17911687
Ref: 25e17911687
Ref: library/resource resource RLIM_SAVED_MAX17911727
Ref: 25f17911727
Ref: library/resource resource getrlimit17911975
Ref: 1a2517911975
Ref: library/resource resource setrlimit17912355
Ref: 3ee17912355
Ref: library/resource resource prlimit17913585
Ref: 3ef17913585
Ref: library/resource resource RLIMIT_CORE17915780
Ref: 496417915780
Ref: library/resource resource RLIMIT_CPU17916149
Ref: 50f317916149
Ref: library/resource resource RLIMIT_FSIZE17916521
Ref: 50f417916521
Ref: library/resource resource RLIMIT_DATA17916632
Ref: 50f517916632
Ref: library/resource resource RLIMIT_STACK17916740
Ref: 50f617916740
Ref: library/resource resource RLIMIT_RSS17916997
Ref: 50f717916997
Ref: library/resource resource RLIMIT_NPROC17917138
Ref: 50f817917138
Ref: library/resource resource RLIMIT_NOFILE17917252
Ref: 50f217917252
Ref: library/resource resource RLIMIT_OFILE17917370
Ref: 50f917917370
Ref: library/resource resource RLIMIT_MEMLOCK17917471
Ref: 50fa17917471
Ref: library/resource resource RLIMIT_VMEM17917584
Ref: 50fb17917584
Ref: library/resource resource RLIMIT_AS17917798
Ref: 50fc17917798
Ref: library/resource resource RLIMIT_MSGQUEUE17917931
Ref: 133917917931
Ref: library/resource resource RLIMIT_NICE17918143
Ref: 133a17918143
Ref: library/resource resource RLIMIT_RTPRIO17918320
Ref: 133b17918320
Ref: library/resource resource RLIMIT_RTTIME17918492
Ref: 133c17918492
Ref: library/resource resource RLIMIT_SIGPENDING17918814
Ref: 133d17918814
Ref: library/resource resource RLIMIT_SBSIZE17919001
Ref: 133e17919001
Ref: library/resource resource RLIMIT_SWAP17919358
Ref: 133f17919358
Ref: library/resource resource RLIMIT_NPTS17919837
Ref: 134017919837
Ref: library/resource resource RLIMIT_KQUEUES17920026
Ref: 1ebb17920026
Ref: library/resource resource RLIMIT_NTHR17920214
Ref: 25b17920214
Ref: library/resource resource RLIMIT_PIPEBUF17920429
Ref: 1a2317920429
Ref: library/resource resource RLIMIT_THREADS17920675
Ref: 25d17920675
Ref: library/resource resource RLIMIT_UMTXP17920843
Ref: 25c17920843
Ref: リソースの制限-Footnote-117921098
Ref: リソースの制限-Footnote-217921147
Ref: リソースの制限-Footnote-317921196
Node: リソースの使用状態17921263
Ref: library/resource resource-usage17921394
Ref: 50fd17921394
Ref: library/resource resource getrusage17921544
Ref: 17e917921544
Ref: library/resource resource getpagesize17926388
Ref: 50fe17926388
Ref: library/resource resource RUSAGE_SELF17926722
Ref: 50ff17926722
Ref: library/resource resource RUSAGE_CHILDREN17926980
Ref: 510017926980
Ref: library/resource resource RUSAGE_BOTH17927234
Ref: 510117927234
Ref: library/resource resource RUSAGE_THREAD17927504
Ref: 510217927504
Ref: リソースの使用状態-Footnote-117927801
Node: syslog --- Unix syslog ライブラリルーチン群17927850
Ref: library/syslog doc17928008
Ref: 510317928008
Ref: library/syslog module-syslog17928008
Ref: e517928008
Ref: library/syslog syslog-unix-syslog-library-routines17928008
Ref: 510417928008
Ref: library/syslog translation-repo17928008
Ref: 510517928008
Ref: library/syslog syslog syslog17928858
Ref: 95217928858
Ref: library/syslog syslog openlog17930528
Ref: 95017930528
Ref: library/syslog syslog closelog17932186
Ref: 95117932186
Ref: library/syslog syslog setlogmask17933202
Ref: 49c917933202
Ref: library/syslog syslog LOG_EMERG17933974
Ref: 510817933974
Ref: library/syslog syslog LOG_ALERT17934006
Ref: 510917934006
Ref: library/syslog syslog LOG_CRIT17934038
Ref: 510a17934038
Ref: library/syslog syslog LOG_ERR17934069
Ref: 510b17934069
Ref: library/syslog syslog LOG_WARNING17934099
Ref: 510c17934099
Ref: library/syslog syslog LOG_NOTICE17934133
Ref: 510d17934133
Ref: library/syslog syslog LOG_INFO17934166
Ref: 510617934166
Ref: library/syslog syslog LOG_DEBUG17934197
Ref: 510e17934197
Ref: library/syslog syslog LOG_AUTH17934283
Ref: 510f17934283
Ref: library/syslog syslog LOG_AUTHPRIV17934314
Ref: 511017934314
Ref: library/syslog syslog LOG_CRON17934349
Ref: 511117934349
Ref: library/syslog syslog LOG_DAEMON17934380
Ref: 511217934380
Ref: library/syslog syslog LOG_FTP17934413
Ref: 511317934413
Ref: library/syslog syslog LOG_INSTALL17934443
Ref: 511417934443
Ref: library/syslog syslog LOG_KERN17934477
Ref: 511517934477
Ref: library/syslog syslog LOG_LAUNCHD17934508
Ref: 511617934508
Ref: library/syslog syslog LOG_LPR17934542
Ref: 511717934542
Ref: library/syslog syslog LOG_MAIL17934572
Ref: 511817934572
Ref: library/syslog syslog LOG_NETINFO17934603
Ref: 511917934603
Ref: library/syslog syslog LOG_NEWS17934637
Ref: 511a17934637
Ref: library/syslog syslog LOG_RAS17934668
Ref: 511b17934668
Ref: library/syslog syslog LOG_REMOTEAUTH17934698
Ref: 511c17934698
Ref: library/syslog syslog LOG_SYSLOG17934735
Ref: 511d17934735
Ref: library/syslog syslog LOG_USER17934768
Ref: 510717934768
Ref: library/syslog syslog LOG_UUCP17934799
Ref: 511e17934799
Ref: library/syslog syslog LOG_LOCAL017934830
Ref: 511f17934830
Ref: library/syslog syslog LOG_LOCAL117934863
Ref: 512017934863
Ref: library/syslog syslog LOG_LOCAL217934896
Ref: 512117934896
Ref: library/syslog syslog LOG_LOCAL317934929
Ref: 512217934929
Ref: library/syslog syslog LOG_LOCAL417934962
Ref: 512317934962
Ref: library/syslog syslog LOG_LOCAL517934995
Ref: 512417934995
Ref: library/syslog syslog LOG_LOCAL617935028
Ref: 512517935028
Ref: library/syslog syslog LOG_LOCAL717935061
Ref: 512617935061
Ref: library/syslog syslog LOG_PID17935531
Ref: 512717935531
Ref: library/syslog syslog LOG_CONS17935561
Ref: 512817935561
Ref: library/syslog syslog LOG_NDELAY17935592
Ref: 512917935592
Ref: library/syslog syslog LOG_ODELAY17935625
Ref: 512a17935625
Ref: library/syslog syslog LOG_NOWAIT17935658
Ref: 512b17935658
Ref: library/syslog syslog LOG_PERROR17935691
Ref: 512c17935691
Node: 使用例<53>17935918
Ref: library/syslog examples17936021
Ref: 512d17936021
Node: シンプルな例17936092
Ref: library/syslog simple-example17936160
Ref: 512e17936160
Node: モジュールのコマンドラインインターフェース CLI17936704
Ref: library/cmdline doc17936894
Ref: 512f17936894
Ref: library/cmdline library-cmdline17936894
Ref: 513017936894
Ref: library/cmdline modules-command-line-interface-cli17936894
Ref: 513117936894
Ref: library/cmdline translation-repo17936894
Ref: 513217936894
Node: Superseded modules17938591
Ref: library/superseded doc17938789
Ref: 513317938789
Ref: library/superseded superseded17938789
Ref: 513417938789
Ref: library/superseded superseded-modules17938789
Ref: 513517938789
Ref: library/superseded translation-repo17938789
Ref: 513617938789
Ref: Superseded modules-Footnote-117939997
Node: getopt --- C-style parser for command line options17940039
Ref: library/getopt doc17940185
Ref: 513717940185
Ref: library/getopt getopt-c-style-parser-for-command-line-options17940185
Ref: 513817940185
Ref: library/getopt module-getopt17940185
Ref: 6417940185
Ref: library/getopt getopt getopt17941636
Ref: 187317941636
Ref: library/getopt getopt gnu_getopt17944203
Ref: 187217944203
Ref: library/getopt getopt GetoptError17945381
Ref: 1b2917945381
Ref: library/getopt getopt error17945958
Ref: 513917945958
Ref: getopt --- C-style parser for command line options-Footnote-117950023
Node: profile --- Pure Python profiler17950089
Ref: library/profile doc17950235
Ref: 513a17950235
Ref: library/profile module-profile17950235
Ref: b417950235
Ref: library/profile profile17950235
Ref: 4c1a17950235
Ref: library/profile profile-pure-python-profiler17950235
Ref: 513b17950235
Ref: library/profile translation-repo17950235
Ref: 513c17950235
Ref: profile --- Pure Python profiler-Footnote-117951581
Node: Migration17951648
Ref: library/profile migration17951781
Ref: 513d17951781
Node: profile and profiling tracing module reference17952528
Ref: library/profile profile-and-profiling-tracing-module-reference17952704
Ref: 513e17952704
Ref: library/profile profile run17952931
Ref: 513f17952931
Ref: library/profile profile runctx17953724
Ref: 514017953724
Ref: library/profile profile Profile17954129
Ref: dab17954129
Ref: library/profile profile Profile enable17956015
Ref: 514117956015
Ref: library/profile profile Profile disable17956141
Ref: 514217956141
Ref: library/profile profile Profile create_stats17956267
Ref: 514317956267
Ref: library/profile profile Profile print_stats17956459
Ref: 514417956459
Ref: library/profile profile Profile dump_stats17956997
Ref: 514517956997
Ref: library/profile profile Profile run17957130
Ref: 514617957130
Ref: library/profile profile Profile runctx17957245
Ref: 514717957245
Ref: library/profile profile Profile runcall17957454
Ref: e4317957454
Node: Differences from profiling tracing17957830
Ref: library/profile differences-from-profiling-tracing17958032
Ref: 514817958032
Node: What is deterministic profiling?<2>17958962
Ref: library/profile deterministic-profiling17959133
Ref: 514917959133
Ref: library/profile what-is-deterministic-profiling17959133
Ref: 514a17959133
Node: 制限事項<2>17961415
Ref: library/profile limitations17961586
Ref: 514b17961586
Ref: library/profile profile-limitations17961586
Ref: 514c17961586
Node: キャリブレーション 補正17963733
Ref: library/profile calibration17963914
Ref: 514d17963914
Ref: library/profile profile-calibration17963914
Ref: 514e17963914
Node: カスタムな時刻取得用関数を使う17966025
Ref: library/profile profile-timers17966182
Ref: 514f17966182
Ref: library/profile using-a-custom-timer17966182
Ref: 515017966182
Node: 削除されたモジュール17969289
Ref: library/removed doc17969462
Ref: 515117969462
Ref: library/removed removed17969462
Ref: 515217969462
Ref: library/removed removed-modules17969462
Ref: 515317969462
Ref: library/removed translation-repo17969462
Ref: 515417969462
Node: aifc --- Read and write AIFF and AIFC files17971694
Ref: library/aifc doc17971870
Ref: 515517971870
Ref: library/aifc aifc-read-and-write-aiff-and-aifc-files17971870
Ref: 515617971870
Ref: library/aifc module-aifc17971870
Ref: 517971870
Ref: aifc --- Read and write AIFF and AIFC files-Footnote-117972439
Ref: aifc --- Read and write AIFF and AIFC files-Footnote-217972481
Node: asynchat --- Asynchronous socket command/response handler17972536
Ref: library/asynchat doc17972761
Ref: 515717972761
Ref: library/asynchat asynchat-asynchronous-socket-command-response-handler17972761
Ref: 515817972761
Ref: library/asynchat module-asynchat17972761
Ref: a17972761
Ref: library/asynchat translation-repo17972761
Ref: 515917972761
Ref: asynchat --- Asynchronous socket command/response handler-Footnote-117973336
Ref: asynchat --- Asynchronous socket command/response handler-Footnote-217973378
Node: asyncore --- Asynchronous socket handler17973437
Ref: library/asyncore doc17973656
Ref: 515a17973656
Ref: library/asyncore asyncore-asynchronous-socket-handler17973656
Ref: 515b17973656
Ref: library/asyncore module-asyncore17973656
Ref: c17973656
Ref: library/asyncore translation-repo17973656
Ref: 515c17973656
Ref: asyncore --- Asynchronous socket handler-Footnote-117974197
Ref: asyncore --- Asynchronous socket handler-Footnote-217974239
Node: audioop --- Manipulate raw audio data17974298
Ref: library/audioop doc17974508
Ref: 515d17974508
Ref: library/audioop audioop-manipulate-raw-audio-data17974508
Ref: 515e17974508
Ref: library/audioop module-audioop17974508
Ref: e17974508
Ref: library/audioop translation-repo17974508
Ref: 515f17974508
Ref: audioop --- Manipulate raw audio data-Footnote-117975068
Ref: audioop --- Manipulate raw audio data-Footnote-217975110
Node: cgi --- Common Gateway Interface のサポート17975168
Ref: library/cgi doc17975381
Ref: 516017975381
Ref: library/cgi cgi-common-gateway-interface-support17975381
Ref: 516117975381
Ref: library/cgi module-cgi17975381
Ref: 1617975381
Ref: library/cgi translation-repo17975381
Ref: 516217975381
Ref: cgi --- Common Gateway Interface のサポート-Footnote-117976251
Ref: cgi --- Common Gateway Interface のサポート-Footnote-217976293
Ref: cgi --- Common Gateway Interface のサポート-Footnote-317976338
Node: cgitb --- Traceback manager for CGI scripts17976392
Ref: library/cgitb doc17976599
Ref: 516317976599
Ref: library/cgitb cgitb-traceback-manager-for-cgi-scripts17976599
Ref: 516417976599
Ref: library/cgitb module-cgitb17976599
Ref: 1717976599
Ref: library/cgitb translation-repo17976599
Ref: 516517976599
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-117977332
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-217977374
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-317977419
Node: chunk --- Read IFF chunked data17977475
Ref: library/chunk doc17977676
Ref: 516617977676
Ref: library/chunk chunk-read-iff-chunked-data17977676
Ref: 516717977676
Ref: library/chunk module-chunk17977676
Ref: 1817977676
Ref: library/chunk translation-repo17977676
Ref: 516817977676
Ref: chunk --- Read IFF chunked data-Footnote-117978222
Ref: chunk --- Read IFF chunked data-Footnote-217978264
Node: crypt --- Function to check Unix passwords17978320
Ref: library/crypt doc17978530
Ref: 516917978530
Ref: library/crypt crypt-function-to-check-unix-passwords17978530
Ref: 516a17978530
Ref: library/crypt module-crypt17978530
Ref: 2b17978530
Ref: library/crypt translation-repo17978530
Ref: 516b17978530
Ref: crypt --- Function to check Unix passwords-Footnote-117979353
Ref: crypt --- Function to check Unix passwords-Footnote-217979395
Ref: crypt --- Function to check Unix passwords-Footnote-317979441
Ref: crypt --- Function to check Unix passwords-Footnote-417979482
Ref: crypt --- Function to check Unix passwords-Footnote-517979528
Node: distutils --- Building and installing Python modules17979584
Ref: library/distutils doc17979804
Ref: 516c17979804
Ref: library/distutils distutils-building-and-installing-python-modules17979804
Ref: 516d17979804
Ref: library/distutils module-distutils17979804
Ref: 3c17979804
Ref: library/distutils translation-repo17979804
Ref: 516e17979804
Ref: distutils --- Building and installing Python modules-Footnote-117980341
Ref: distutils --- Building and installing Python modules-Footnote-217980383
Ref: distutils --- Building and installing Python modules-Footnote-317980442
Node: imghdr --- Determine the type of an image17980502
Ref: library/imghdr doc17980715
Ref: 516f17980715
Ref: library/imghdr imghdr-determine-the-type-of-an-image17980715
Ref: 517017980715
Ref: library/imghdr module-imghdr17980715
Ref: 7817980715
Ref: library/imghdr translation-repo17980715
Ref: 517117980715
Ref: imghdr --- Determine the type of an image-Footnote-117981455
Ref: imghdr --- Determine the type of an image-Footnote-217981497
Ref: imghdr --- Determine the type of an image-Footnote-317981540
Ref: imghdr --- Determine the type of an image-Footnote-417981584
Ref: imghdr --- Determine the type of an image-Footnote-517981631
Node: imp --- Access the import internals17981688
Ref: library/imp doc17981882
Ref: 517217981882
Ref: library/imp imp-access-the-import-internals17981882
Ref: 517317981882
Ref: library/imp module-imp17981882
Ref: 7917981882
Ref: library/imp translation-repo17981882
Ref: 517417981882
Ref: imp --- Access the import internals-Footnote-117982416
Node: mailcap --- Mailcap file handling17982470
Ref: library/mailcap doc17982674
Ref: 517517982674
Ref: library/mailcap mailcap-mailcap-file-handling17982674
Ref: 517617982674
Ref: library/mailcap module-mailcap17982674
Ref: 8f17982674
Ref: library/mailcap translation-repo17982674
Ref: 517717982674
Ref: mailcap --- Mailcap file handling-Footnote-117983228
Ref: mailcap --- Mailcap file handling-Footnote-217983270
Node: msilib --- Read and write Microsoft Installer files17983328
Ref: library/msilib doc17983542
Ref: 517817983542
Ref: library/msilib module-msilib17983542
Ref: 9617983542
Ref: library/msilib msilib-read-and-write-microsoft-installer-files17983542
Ref: 517917983542
Ref: library/msilib translation-repo17983542
Ref: 517a17983542
Ref: msilib --- Read and write Microsoft Installer files-Footnote-117984131
Ref: msilib --- Read and write Microsoft Installer files-Footnote-217984173
Node: nis --- Interface to Sun’s NIS Yellow Pages17984230
Ref: library/nis doc17984443
Ref: 517b17984443
Ref: library/nis module-nis17984443
Ref: a017984443
Ref: library/nis nis-interface-to-suns-nis-yellow-pages17984443
Ref: 517c17984443
Ref: library/nis translation-repo17984443
Ref: 517d17984443
Ref: nis --- Interface to Sun’s NIS Yellow Pages-Footnote-117985019
Ref: nis --- Interface to Sun’s NIS Yellow Pages-Footnote-217985061
Node: nntplib --- NNTP protocol client17985115
Ref: library/nntplib doc17985331
Ref: 517e17985331
Ref: library/nntplib module-nntplib17985331
Ref: a117985331
Ref: library/nntplib nntplib-nntp-protocol-client17985331
Ref: 517f17985331
Ref: library/nntplib translation-repo17985331
Ref: 518017985331
Ref: nntplib --- NNTP protocol client-Footnote-117985883
Ref: nntplib --- NNTP protocol client-Footnote-217985925
Node: ossaudiodev --- Access to OSS-compatible audio devices17985983
Ref: library/ossaudiodev doc17986192
Ref: 518117986192
Ref: library/ossaudiodev module-ossaudiodev17986192
Ref: a717986192
Ref: library/ossaudiodev ossaudiodev-access-to-oss-compatible-audio-devices17986192
Ref: 518217986192
Ref: library/ossaudiodev translation-repo17986192
Ref: 518317986192
Ref: ossaudiodev --- Access to OSS-compatible audio devices-Footnote-117986792
Ref: ossaudiodev --- Access to OSS-compatible audio devices-Footnote-217986834
Node: pipes --- Interface to shell pipelines17986896
Ref: library/pipes doc17987094
Ref: 518417987094
Ref: library/pipes module-pipes17987094
Ref: ad17987094
Ref: library/pipes pipes-interface-to-shell-pipelines17987094
Ref: 518517987094
Ref: library/pipes translation-repo17987094
Ref: 518617987094
Ref: pipes --- Interface to shell pipelines-Footnote-117987723
Ref: pipes --- Interface to shell pipelines-Footnote-217987765
Node: smtpd --- SMTP Server17987821
Ref: library/smtpd doc17988004
Ref: 518717988004
Ref: library/smtpd module-smtpd17988004
Ref: d117988004
Ref: library/smtpd smtpd-smtp-server17988004
Ref: 518817988004
Ref: library/smtpd translation-repo17988004
Ref: 518917988004
Ref: smtpd --- SMTP Server-Footnote-117988577
Ref: smtpd --- SMTP Server-Footnote-217988619
Ref: smtpd --- SMTP Server-Footnote-317988662
Node: sndhdr --- Determine type of sound file17988718
Ref: library/sndhdr doc17988900
Ref: 518a17988900
Ref: library/sndhdr module-sndhdr17988900
Ref: d317988900
Ref: library/sndhdr sndhdr-determine-type-of-sound-file17988900
Ref: 518b17988900
Ref: library/sndhdr translation-repo17988900
Ref: 518c17988900
Ref: sndhdr --- Determine type of sound file-Footnote-117989634
Ref: sndhdr --- Determine type of sound file-Footnote-217989676
Ref: sndhdr --- Determine type of sound file-Footnote-317989719
Ref: sndhdr --- Determine type of sound file-Footnote-417989763
Ref: sndhdr --- Determine type of sound file-Footnote-517989810
Node: spwd --- The shadow password database17989867
Ref: library/spwd doc17990065
Ref: 518d17990065
Ref: library/spwd module-spwd17990065
Ref: d617990065
Ref: library/spwd spwd-the-shadow-password-database17990065
Ref: 518e17990065
Ref: library/spwd translation-repo17990065
Ref: 518f17990065
Ref: spwd --- The shadow password database-Footnote-117990760
Ref: spwd --- The shadow password database-Footnote-217990802
Ref: spwd --- The shadow password database-Footnote-317990847
Node: sunau --- Read and write Sun AU files17990902
Ref: library/sunau doc17991088
Ref: 519017991088
Ref: library/sunau module-sunau17991088
Ref: e017991088
Ref: library/sunau sunau-read-and-write-sun-au-files17991088
Ref: 519117991088
Ref: library/sunau translation-repo17991088
Ref: 519217991088
Ref: sunau --- Read and write Sun AU files-Footnote-117991648
Ref: sunau --- Read and write Sun AU files-Footnote-217991690
Node: telnetlib --- Telnet client17991746
Ref: library/telnetlib doc17991934
Ref: 519317991934
Ref: library/telnetlib module-telnetlib17991934
Ref: e817991934
Ref: library/telnetlib telnetlib-telnet-client17991934
Ref: 519417991934
Ref: library/telnetlib translation-repo17991934
Ref: 519517991934
Ref: telnetlib --- Telnet client-Footnote-117992632
Ref: telnetlib --- Telnet client-Footnote-217992674
Ref: telnetlib --- Telnet client-Footnote-317992719
Ref: telnetlib --- Telnet client-Footnote-417992762
Node: uu --- Encode and decode uuencode files17992822
Ref: library/uu doc17993010
Ref: 519617993010
Ref: library/uu module-uu17993010
Ref: 11817993010
Ref: library/uu translation-repo17993010
Ref: 519717993010
Ref: library/uu uu-encode-and-decode-uuencode-files17993010
Ref: 519817993010
Ref: uu --- Encode and decode uuencode files-Footnote-117993571
Ref: uu --- Encode and decode uuencode files-Footnote-217993613
Node: xdrlib --- Encode and decode XDR data17993666
Ref: library/xdrlib doc17993818
Ref: 519917993818
Ref: library/xdrlib module-xdrlib17993818
Ref: 12817993818
Ref: library/xdrlib translation-repo17993818
Ref: 519a17993818
Ref: library/xdrlib xdrlib-encode-and-decode-xdr-data17993818
Ref: 519b17993818
Ref: library/security_warnings security-warnings17994343
Ref: 519c17994343
Ref: xdrlib --- Encode and decode XDR data-Footnote-117994379
Ref: xdrlib --- Encode and decode XDR data-Footnote-217994421
Node: セキュリティで考慮すべき点<6>17994478
Ref: library/security_warnings doc17994624
Ref: 519d17994624
Ref: library/security_warnings security-considerations17994624
Ref: 519e17994624
Ref: library/security_warnings translation-repo17994624
Ref: 519f17994624
Ref: セキュリティで考慮すべき点<6>-Footnote-117996414
Node: Python インタプリタの拡張と埋め込み17996473
Ref: extending/index doc17996637
Ref: 51a017996637
Ref: extending/index extending-and-embedding-the-python-interpreter17996637
Ref: 51a117996637
Ref: extending/index extending-index17996637
Ref: 21c917996637
Ref: extending/index translation-repo17996637
Ref: 51a217996637
Ref: extending/first-extension-module extending-simpleexample17999045
Ref: 51a317999045
Ref: Python インタプリタの拡張と埋め込み-Footnote-117999748
Node: Your first C API extension module17999785
Ref: extending/first-extension-module doc17999944
Ref: 51a417999944
Ref: extending/first-extension-module first-extension-module17999944
Ref: 51a517999944
Ref: extending/first-extension-module your-first-c-api-extension-module17999944
Ref: 51a617999944
Ref: Your first C API extension module-Footnote-118002328
Ref: Your first C API extension module-Footnote-218002357
Node: What we'll do18002392
Ref: extending/first-extension-module what-we-ll-do18002506
Ref: 51a818002506
Ref: What we'll do-Footnote-118003576
Node: Start with the headers18003640
Ref: extending/first-extension-module start-with-the-headers18003786
Ref: 51a918003786
Ref: Start with the headers-Footnote-118004522
Ref: Start with the headers-Footnote-218004863
Node: Running your build tool18005122
Ref: extending/first-extension-module running-your-build-tool18005273
Ref: 51ab18005273
Ref: Running your build tool-Footnote-118007608
Ref: Running your build tool-Footnote-218007653
Node: Module export hook18007674
Ref: extending/first-extension-module module-export-hook18007817
Ref: 51ad18007817
Node: The slot table18009159
Ref: extending/first-extension-module the-slot-table18009298
Ref: 51ae18009298
Node: Exposing a function18011311
Ref: extending/first-extension-module backtoexample18011452
Ref: 51b118011452
Ref: extending/first-extension-module exposing-a-function18011452
Ref: 51b218011452
Node: Method definitions18012508
Ref: extending/first-extension-module method-definitions18012582
Ref: 51b318012582
Ref: extending/first-extension-module methodtable18012582
Ref: 51b418012582
Ref: Method definitions-Footnote-118014927
Node: Returning an integer18015056
Ref: extending/first-extension-module returning-an-integer18015201
Ref: 51b618015201
Ref: Returning an integer-Footnote-118016117
Node: Accepting a string18016353
Ref: extending/first-extension-module accepting-a-string18016489
Ref: 51b718016489
Ref: Accepting a string-Footnote-118020466
Ref: Accepting a string-Footnote-218020778
Node: The result18021117
Ref: extending/first-extension-module the-result18021259
Ref: 51b818021259
Ref: extending/first-extension-module extending-spammodule-source18021454
Ref: 51b918021454
Node: Appendix Other build tools18022793
Ref: extending/first-extension-module appendix-other-build-tools18022908
Ref: 51ba18022908
Ref: extending/first-extension-module first-extension-other-tools18022908
Ref: 51ac18022908
Ref: Appendix Other build tools-Footnote-118023351
Node: Workaround for missing PyInit function18023465
Ref: extending/first-extension-module workaround-for-missing-pyinit-function18023593
Ref: 51bb18023593
Node: Compiling directly18024353
Ref: extending/first-extension-module compiling-directly18024481
Ref: 51bc18024481
Node: Linux<2>18025010
Ref: extending/first-extension-module linux18025073
Ref: 51bd18025073
Node: Using the C API Assorted topics18025558
Ref: extending/extending doc18025769
Ref: 51be18025769
Ref: extending/extending extending-intro18025769
Ref: 51bf18025769
Ref: extending/extending translation-repo18025769
Ref: 51c018025769
Ref: extending/extending using-the-c-api-assorted-topics18025769
Ref: 51c118025769
Node: エラーと例外<2>18026460
Ref: extending/extending errors-and-exceptions18026580
Ref: 51c218026580
Ref: extending/extending extending-errors18026580
Ref: 51c318026580
Node: Embedding an extension18035719
Ref: extending/extending compilation18035885
Ref: 51ca18035885
Ref: extending/extending embedding-an-extension18035885
Ref: 51cb18035885
Node: C から Python 関数を呼び出す18036984
Ref: extending/extending calling-python-functions-from-c18037180
Ref: 51cc18037180
Ref: extending/extending callingpython18037180
Ref: 51cd18037180
Node: 拡張モジュール関数でのパラメタ展開18045723
Ref: extending/extending extracting-parameters-in-extension-functions18045954
Ref: 51d218045954
Ref: extending/extending parsetuple18045954
Ref: 51cf18045954
Node: 拡張モジュール関数のキーワードパラメタ18049800
Ref: extending/extending keyword-parameters-for-extension-functions18050021
Ref: 51d318050021
Ref: extending/extending parsetupleandkeywords18050021
Ref: 51d418050021
Node: 任意の値を構築する18053162
Ref: extending/extending building-arbitrary-values18053353
Ref: 51d618053353
Ref: extending/extending buildvalue18053353
Ref: 51d718053353
Node: 参照カウント法18055875
Ref: extending/extending refcounts18056045
Ref: 51d018056045
Ref: extending/extending reference-counts18056045
Ref: 51d818056045
Node: Python における参照カウント法18062101
Ref: extending/extending refcountsinpython18062238
Ref: 51d918062238
Ref: extending/extending reference-counting-in-python18062238
Ref: 51da18062238
Ref: Python における参照カウント法-Footnote-118065382
Ref: Python における参照カウント法-Footnote-218065581
Node: 所有権にまつわる規則18065840
Ref: extending/extending ownership-rules18065992
Ref: 51db18065992
Ref: extending/extending ownershiprules18065992
Ref: 51dc18065992
Node: 薄氷18069159
Ref: extending/extending thin-ice18069288
Ref: 51e018069288
Ref: extending/extending thinice18069288
Ref: 51e118069288
Ref: 薄氷-Footnote-118073263
Node: NULL ポインタ18073305
Ref: extending/extending null-pointers18073395
Ref: 51e418073395
Ref: extending/extending nullpointers18073395
Ref: 51e518073395
Ref: NULL ポインタ-Footnote-118075661
Node: C++での拡張モジュール作成18075861
Ref: extending/extending cplusplus18076050
Ref: 51e618076050
Ref: extending/extending writing-extensions-in-c18076050
Ref: 51e718076050
Node: 拡張モジュールに C API を提供する18077125
Ref: extending/extending providing-a-c-api-for-an-extension-module18077284
Ref: 51e818077284
Ref: extending/extending using-capsules18077284
Ref: 171718077284
Node: 拡張の型の定義 チュートリアル18087295
Ref: extending/newtypes_tutorial doc18087516
Ref: 1dd418087516
Ref: extending/newtypes_tutorial defining-extension-types-tutorial18087516
Ref: 51ea18087516
Ref: extending/newtypes_tutorial defining-new-types18087516
Ref: 51eb18087516
Ref: extending/newtypes_tutorial translation-repo18087516
Ref: 51ec18087516
Node: 基本的なこと18088293
Ref: extending/newtypes_tutorial dnt-basics18088463
Ref: 51ed18088463
Ref: extending/newtypes_tutorial the-basics18088463
Ref: 51ee18088463
Node: 基本のサンプルにデータとメソッドを追加する18100173
Ref: extending/newtypes_tutorial adding-data-and-methods-to-the-basic-example18100394
Ref: 51f318100394
Ref: 基本のサンプルにデータとメソッドを追加する-Footnote-118118703
Ref: 基本のサンプルにデータとメソッドを追加する-Footnote-218118836
Node: データ属性をこまかく制御する18118971
Ref: extending/newtypes_tutorial providing-finer-control-over-data-attributes18119231
Ref: 51fa18119231
Ref: データ属性をこまかく制御する-Footnote-118129505
Node: 循環ガベージコレクションをサポートする18129879
Ref: extending/newtypes_tutorial supporting-cyclic-garbage-collection18130112
Ref: 51fc18130112
Ref: 循環ガベージコレクションをサポートする-Footnote-118141470
Node: 他の型のサブクラスを作る18141644
Ref: extending/newtypes_tutorial subclassing-other-types18141826
Ref: 51fe18141826
Node: 拡張の型の定義 雑多なトピック18147248
Ref: extending/newtypes doc18147472
Ref: 520018147472
Ref: extending/newtypes defining-extension-types-assorted-topics18147472
Ref: 520118147472
Ref: extending/newtypes new-types-topics18147472
Ref: 520218147472
Ref: extending/newtypes translation-repo18147472
Ref: 520318147472
Ref: extending/newtypes dnt-type-methods18147557
Ref: 520418147557
Node: ファイナライズとメモリ解放18153541
Ref: extending/newtypes finalization-and-de-allocation18153693
Ref: 520518153693
Ref: ファイナライズとメモリ解放-Footnote-118158094
Node: オブジェクト表現18158136
Ref: extending/newtypes object-presentation18158318
Ref: 520718158318
Node: 属性を管理する18160372
Ref: extending/newtypes attribute-management18160542
Ref: 520a18160542
Node: 総称的な属性を管理する18162093
Ref: extending/newtypes generic-attribute-management18162235
Ref: 51f718162235
Ref: extending/newtypes id118162235
Ref: 520b18162235
Node: 特定の型に特化した属性の管理18166261
Ref: extending/newtypes type-specific-attribute-management18166403
Ref: 521018166403
Node: オブジェクトの比較18168210
Ref: extending/newtypes object-comparison18168398
Ref: 521318168398
Node: 抽象的なプロトコルのサポート18170275
Ref: extending/newtypes abstract-protocol-support18170482
Ref: 521618170482
Node: 弱参照 Weak Reference のサポート18176697
Ref: extending/newtypes weak-reference-support18176898
Ref: 521b18176898
Ref: extending/newtypes weakref-support18176898
Ref: 2bf818176898
Node: その他いろいろ18178243
Ref: extending/newtypes more-suggestions18178393
Ref: 521c18178393
Node: C および C++ 拡張のビルド18179355
Ref: extending/building doc18179603
Ref: 521d18179603
Ref: extending/building building18179603
Ref: 521e18179603
Ref: extending/building building-c-and-c-extensions18179603
Ref: 521f18179603
Ref: extending/building translation-repo18179603
Ref: 522018179603
Ref: extending/building install-index18179889
Ref: 12aa18179889
Node: setuptools による C および C++ 拡張のビルド18179960
Ref: extending/building building-c-and-c-extensions-with-setuptools18180086
Ref: 522218180086
Ref: extending/building setuptools-index18180086
Ref: 12ab18180086
Node: Windows 上での C および C++ 拡張モジュールのビルド18180669
Ref: extending/windows doc18180933
Ref: 522318180933
Ref: extending/windows building-c-and-c-extensions-on-windows18180933
Ref: 522418180933
Ref: extending/windows building-on-windows18180933
Ref: 243418180933
Ref: extending/windows translation-repo18180933
Ref: 522518180933
Node: 型どおりのアプローチ18182546
Ref: extending/windows a-cookbook-approach18182718
Ref: 522618182718
Ref: extending/windows win-cookbook18182718
Ref: 522718182718
Ref: 型どおりのアプローチ-Footnote-118183366
Node: Unix と Windows の相違点18183444
Ref: extending/windows differences-between-unix-and-windows18183644
Ref: 522818183644
Ref: extending/windows dynamic-linking18183644
Ref: 522918183644
Ref: extending/windows c Py_NO_LINK_LIB18188000
Ref: 65e18188000
Node: DLL 使用の実際18188191
Ref: extending/windows using-dlls-in-practice18188352
Ref: 522a18188352
Ref: extending/windows win-dlls18188352
Ref: 522b18188352
Node: 他のアプリケーションへの Python の埋め込み18191446
Ref: extending/embedding doc18191721
Ref: 522d18191721
Ref: extending/embedding embedding18191721
Ref: 246b18191721
Ref: extending/embedding embedding-python-in-another-application18191721
Ref: 522e18191721
Ref: extending/embedding translation-repo18191721
Ref: 522f18191721
Node: 高水準の埋め込み18195022
Ref: extending/embedding high-level-embedding18195203
Ref: 523218195203
Ref: extending/embedding very-high-level-embedding18195203
Ref: 523318195203
Node: 超高水準の埋め込みから踏み出す 概要18197746
Ref: extending/embedding beyond-very-high-level-embedding-an-overview18197957
Ref: 523418197957
Ref: extending/embedding lower-level-embedding18197957
Ref: 523518197957
Node: 純粋な埋め込み18200413
Ref: extending/embedding id118200635
Ref: 523618200635
Ref: extending/embedding pure-embedding18200635
Ref: 523718200635
Node: 埋め込まれた Python の拡張18205895
Ref: extending/embedding extending-embedded-python18206100
Ref: 523918206100
Ref: extending/embedding extending-with-embedding18206100
Ref: 523a18206100
Node: C++による Python の埋め込み18208687
Ref: extending/embedding embedding-python-in-c18208930
Ref: 523b18208930
Ref: extending/embedding embeddingincplusplus18208930
Ref: 523c18208930
Node: Unix 系システムにおけるコンパイルとリンク18209433
Ref: extending/embedding compiling18209632
Ref: 523818209632
Ref: extending/embedding compiling-and-linking-under-unix-like-systems18209632
Ref: 523d18209632
Node: おすすめのサードパーティツール18212346
Ref: extending/index recommended-third-party-tools18212568
Ref: 523f18212568
Node: C API Tutorial18213139
Ref: extending/index c-api-tutorial18213332
Ref: 524018213332
Node: Guides for intermediate topics18213592
Ref: extending/index guides-for-intermediate-topics18213820
Ref: 524118213820
Node: 大規模なアプリケーションへの Python ランタイムの埋め込み18214518
Ref: extending/index embedding-the-cpython-runtime-in-a-larger-application18214723
Ref: 524218214723
Node: Python/C API reference manual18215288
Ref: c-api/index doc18215467
Ref: 524318215467
Ref: c-api/index c-api-index18215467
Ref: 21ca18215467
Ref: c-api/index python-c-api-reference-manual18215467
Ref: 524418215467
Ref: c-api/index translation-repo18215467
Ref: 524518215467
Node: はじめに<14>18217146
Ref: c-api/intro doc18217260
Ref: 524618217260
Ref: c-api/intro api-intro18217260
Ref: 524718217260
Ref: c-api/intro introduction18217260
Ref: 524818217260
Node: 言語バージョン互換性18219684
Ref: c-api/intro language-version-compatibility18219800
Ref: 524918219800
Node: コーディング基準18220105
Ref: c-api/intro coding-standards18220260
Ref: 524a18220260
Ref: コーディング基準-Footnote-118220823
Node: インクルードファイル18220865
Ref: c-api/intro api-includes18221008
Ref: b6818221008
Ref: c-api/intro include-files18221008
Ref: 524b18221008
Node: System includes18224450
Ref: c-api/intro capi-system-includes18224532
Ref: 51aa18224532
Ref: c-api/intro system-includes18224532
Ref: 524c18224532
Node: 便利なマクロ18225738
Ref: c-api/intro useful-macros18225908
Ref: 524d18225908
Ref: c-api/intro c Py_CAN_START_THREADS18226235
Ref: 524e18226235
Ref: c-api/intro c Py_GETENV18226546
Ref: 524f18226546
Ref: 便利なマクロ-Footnote-118226870
Node: Docstring macros18226912
Ref: c-api/intro docstring-macros18227014
Ref: 525018227014
Ref: c-api/intro c PyDoc_STRVAR18227065
Ref: 1f6e18227065
Ref: c-api/intro c PyDoc_STR18227654
Ref: 1db118227654
Ref: c-api/intro c PyDoc_VAR18228088
Ref: 1ffe18228088
Node: General utility macros18228461
Ref: c-api/intro general-utility-macros18228593
Ref: 525118228593
Ref: c-api/intro c Py_UNUSED18228723
Ref: 1caf18228723
Ref: c-api/intro c Py_GCC_ATTRIBUTE18228980
Ref: 525218228980
Node: Numeric utilities18229395
Ref: c-api/intro numeric-utilities18229499
Ref: 525318229499
Ref: c-api/intro c Py_ABS18229552
Ref: 525418229552
Ref: c-api/intro c Py_MAX18229993
Ref: 525518229993
Ref: c-api/intro c Py_MIN18230027
Ref: 525618230027
Ref: c-api/intro c Py_ARITHMETIC_RIGHT_SHIFT18230373
Ref: 525718230373
Ref: c-api/intro c Py_CHARMASK18231337
Ref: 525818231337
Node: Assertion utilities18231592
Ref: c-api/intro assertion-utilities18231724
Ref: 525918231724
Ref: c-api/intro c Py_UNREACHABLE18231781
Ref: f7718231781
Ref: c-api/intro c Py_SAFE_DOWNCAST18233055
Ref: 525a18233055
Ref: c-api/intro c Py_BUILD_ASSERT18233738
Ref: 1bdc18233738
Ref: c-api/intro c Py_BUILD_ASSERT_EXPR18234125
Ref: 1bdd18234125
Node: Type size utilities18234533
Ref: c-api/intro type-size-utilities18234674
Ref: 525b18234674
Ref: c-api/intro c Py_ARRAY_LENGTH18234731
Ref: 525c18234731
Ref: c-api/intro c Py_MEMBER_SIZE18235201
Ref: 525d18235201
Node: Macro definition utilities18235412
Ref: c-api/intro macro-definition-utilities18235525
Ref: 525e18235525
Ref: c-api/intro c Py_FORCE_EXPANSION18235596
Ref: 525f18235596
Ref: c-api/intro c Py_STRINGIFY18235805
Ref: 526018235805
Node: Declaration utilities18235972
Ref: c-api/intro declaration-utilities18236103
Ref: 526118236103
Ref: c-api/intro c Py_ALWAYS_INLINE18236404
Ref: 1e8118236404
Ref: c-api/intro c Py_NO_INLINE18237485
Ref: 1a8a18237485
Ref: c-api/intro c Py_DEPRECATED18237882
Ref: e6e18237882
Ref: c-api/intro c Py_LOCAL18238256
Ref: 180218238256
Ref: c-api/intro c Py_LOCAL_INLINE18238496
Ref: 180318238496
Ref: c-api/intro c Py_LOCAL_SYMBOL18238638
Ref: 526218238638
Ref: c-api/intro c Py_EXPORTED_SYMBOL18238934
Ref: 526318238934
Ref: c-api/intro c Py_IMPORTED_SYMBOL18239302
Ref: 526418239302
Ref: c-api/intro c PyAPI_FUNC18239543
Ref: 526518239543
Ref: c-api/intro c PyAPI_DATA18239851
Ref: 526618239851
Ref: Declaration utilities-Footnote-118240210
Node: Outdated macros18240275
Ref: c-api/intro outdated-macros18240375
Ref: 526718240375
Ref: c-api/intro c Py_ALIGNED18240561
Ref: 3cd18240561
Ref: c-api/intro c PY_FORMAT_SIZE_T18240836
Ref: 3ce18240836
Ref: c-api/intro c Py_LL18241029
Ref: 3cf18241029
Ref: c-api/intro c Py_ULL18241064
Ref: 3d018241064
Ref: c-api/intro c PY_LONG_LONG18241500
Ref: 3d118241500
Ref: c-api/intro c PY_INT32_T18241533
Ref: 3d518241533
Ref: c-api/intro c PY_UINT32_T18241564
Ref: 3d618241564
Ref: c-api/intro c PY_INT64_T18241596
Ref: 3d718241596
Ref: c-api/intro c PY_UINT64_T18241627
Ref: 3d818241627
Ref: c-api/intro c PY_LLONG_MIN18241912
Ref: 3d218241912
Ref: c-api/intro c PY_LLONG_MAX18241945
Ref: 3d318241945
Ref: c-api/intro c PY_ULLONG_MAX18241978
Ref: 3d418241978
Ref: c-api/intro c PY_SIZE_MAX18242012
Ref: 3d918242012
Ref: c-api/intro c Py_MEMCPY18242348
Ref: 1bbc18242348
Ref: c-api/intro c Py_UNICODE_SIZE18242532
Ref: 3da18242532
Ref: c-api/intro c Py_UNICODE_WIDE18242834
Ref: 3dc18242834
Ref: c-api/intro c Py_VA_COPY18243039
Ref: 3db18243039
Node: オブジェクト、型および参照カウント18243360
Ref: c-api/intro api-objects18243510
Ref: 526818243510
Ref: c-api/intro objects-types-and-reference-counts18243510
Ref: 526918243510
Node: 参照カウント法<2>18245365
Ref: c-api/intro api-refcounts18245492
Ref: 526a18245492
Ref: c-api/intro reference-counts18245492
Ref: 526b18245492
Node: 参照カウントの詳細18249389
Ref: c-api/intro api-refcountdetails18249477
Ref: 526c18249477
Ref: c-api/intro reference-count-details18249477
Ref: 526d18249477
Node: 型<2>18257867
Ref: c-api/intro api-types18257994
Ref: 527018257994
Ref: c-api/intro types18257994
Ref: 527118257994
Ref: c-api/intro c Py_ssize_t18258607
Ref: e2818258607
Ref: 型<2>-Footnote-118259024
Node: 例外<25>18259066
Ref: c-api/intro api-exceptions18259223
Ref: 527218259223
Ref: c-api/intro exceptions18259223
Ref: 527318259223
Node: Python の埋め込み<2>18267384
Ref: c-api/intro api-embedding18267531
Ref: 527518267531
Ref: c-api/intro embedding-python18267531
Ref: 527618267531
Node: デバッグ版ビルド Debugging Builds18271360
Ref: c-api/intro api-debugging18271545
Ref: 527718271545
Ref: c-api/intro debugging-builds18271545
Ref: 527818271545
Ref: c-api/intro c Py_DEBUG18272446
Ref: 1a0b18272446
Node: おすすめのサードパーティツール<2>18273972
Ref: c-api/intro c-api-tools18274123
Ref: 51a718274123
Ref: c-api/intro recommended-third-party-tools18274123
Ref: 527918274123
Ref: おすすめのサードパーティツール<2>-Footnote-118275576
Ref: おすすめのサードパーティツール<2>-Footnote-218275604
Ref: おすすめのサードパーティツール<2>-Footnote-318275640
Ref: おすすめのサードパーティツール<2>-Footnote-418275672
Ref: おすすめのサードパーティツール<2>-Footnote-518275715
Ref: おすすめのサードパーティツール<2>-Footnote-618275749
Ref: おすすめのサードパーティツール<2>-Footnote-718275790
Ref: おすすめのサードパーティツール<2>-Footnote-818275815
Ref: おすすめのサードパーティツール<2>-Footnote-918275844
Node: C API and ABI Stability18275917
Ref: c-api/stable doc18276061
Ref: 527a18276061
Ref: c-api/stable c-api-and-abi-stability18276061
Ref: 527b18276061
Ref: c-api/stable stable18276061
Ref: 96118276061
Ref: c-api/stable translation-repo18276061
Ref: 527c18276061
Ref: C API and ABI Stability-Footnote-118277664
Ref: C API and ABI Stability-Footnote-218277706
Node: Unstable C API18277761
Ref: c-api/stable id118277880
Ref: 527e18277880
Ref: c-api/stable unstable-c-api18277880
Ref: 95918277880
Ref: c-api/stable stable-abi18278376
Ref: 1a218278376
Node: Stable Application Binary Interfaces18278378
Ref: c-api/stable stable-application-binary-interface18278551
Ref: 522c18278551
Ref: c-api/stable stable-application-binary-interfaces18278551
Ref: 527f18278551
Ref: Stable Application Binary Interfaces-Footnote-118281319
Node: Compiling for Stable ABI18281361
Ref: c-api/stable abi3-compiling18281499
Ref: 1a918281499
Ref: c-api/stable compiling-for-stable-abi18281499
Ref: 528018281499
Ref: c-api/stable c Py_LIMITED_API18283232
Ref: 85318283232
Ref: c-api/stable c Py_TARGET_ABI3T18283403
Ref: 528118283403
Ref: Compiling for Stable ABI-Footnote-118284535
Node: Stable ABI Scope and Performance18284649
Ref: c-api/stable limited-api-scope-and-performance18284814
Ref: 528218284814
Ref: c-api/stable stable-abi-scope-and-performance18284814
Ref: 528318284814
Node: Stable ABI Caveats18285939
Ref: c-api/stable limited-api-caveats18286071
Ref: 528518286071
Ref: c-api/stable stable-abi-caveats18286071
Ref: 528618286071
Node: プラットフォームで考慮すべき点18287794
Ref: c-api/stable platform-considerations18287965
Ref: 528718287965
Ref: c-api/stable stable-abi-platform18287965
Ref: 527d18287965
Node: ABI Checking18288643
Ref: c-api/stable abi-checking18288799
Ref: 528818288799
Ref: c-api/stable c PyABIInfo_Check18289688
Ref: 36118289688
Ref: c-api/stable c PyABIInfo_VAR18290536
Ref: 36218290536
Ref: c-api/stable c PyABIInfo18291035
Ref: 528918291035
Ref: c-api/stable c PyABIInfo abiinfo_major_version18291196
Ref: 528a18291196
Ref: c-api/stable c PyABIInfo abiinfo_minor_version18291447
Ref: 528b18291447
Ref: c-api/stable c PyABIInfo flags18291697
Ref: 528c18291697
Ref: c-api/stable c PyABIInfo_DEFAULT_FLAGS18291805
Ref: 528d18291805
Ref: c-api/stable c PyABIInfo_STABLE18292285
Ref: 528e18292285
Ref: c-api/stable c PyABIInfo_INTERNAL18292491
Ref: 528f18292491
Ref: c-api/stable c PyABIInfo_FREETHREADED18292714
Ref: 529018292714
Ref: c-api/stable c PyABIInfo_GIL18293124
Ref: 529118293124
Ref: c-api/stable c PyABIInfo_FREETHREADING_AGNOSTIC18293450
Ref: 529218293450
Ref: c-api/stable c PyABIInfo build_version18293809
Ref: 529318293809
Ref: c-api/stable c PyABIInfo abi_version18294237
Ref: 529418294237
Ref: c-api/stable c PyABIInfo_DEFAULT_ABI_VERSION18294772
Ref: 529518294772
Ref: c-api/stable limited-c-api18295191
Ref: 82f18295191
Node: 限定版APIの内容18295191
Ref: c-api/stable contents-of-limited-api18295293
Ref: 529618295293
Ref: c-api/stable limited-api-list18295293
Ref: b7e18295293
Node: 超高水準レイヤ18341111
Ref: c-api/veryhigh doc18341257
Ref: 551518341257
Ref: c-api/veryhigh the-very-high-level-layer18341257
Ref: 551618341257
Ref: c-api/veryhigh translation-repo18341257
Ref: 551718341257
Ref: c-api/veryhigh veryhigh18341257
Ref: 551818341257
Ref: c-api/veryhigh c PyRun_AnyFile18342343
Ref: 551d18342343
Ref: c-api/veryhigh c PyRun_AnyFileFlags18342583
Ref: 551f18342583
Ref: c-api/veryhigh c PyRun_AnyFileEx18342833
Ref: 552018342833
Ref: c-api/veryhigh c PyRun_AnyFileExFlags18343070
Ref: 551e18343070
Ref: c-api/veryhigh c PyRun_SimpleString18343921
Ref: 523018343921
Ref: c-api/veryhigh c PyRun_SimpleStringFlags18344153
Ref: 552218344153
Ref: c-api/veryhigh c PyRun_SimpleFile18344929
Ref: 523118344929
Ref: c-api/veryhigh c PyRun_SimpleFileEx18345176
Ref: 552318345176
Ref: c-api/veryhigh c PyRun_SimpleFileExFlags18345418
Ref: 1edf18345418
Ref: c-api/veryhigh c PyRun_InteractiveOneObject18346317
Ref: 552418346317
Ref: c-api/veryhigh c PyRun_InteractiveOne18347219
Ref: 552518347219
Ref: c-api/veryhigh c PyRun_InteractiveOneFlags18347442
Ref: 552618347442
Ref: c-api/veryhigh c PyRun_InteractiveLoop18347735
Ref: 552118347735
Ref: c-api/veryhigh c PyRun_InteractiveLoopFlags18347960
Ref: 552718347960
Ref: c-api/veryhigh c PyOS_InputHook18348543
Ref: 98b18348543
Ref: c-api/veryhigh c PyOS_ReadlineFunctionPointer18349171
Ref: 98c18349171
Ref: c-api/veryhigh c PyRun_String18350563
Ref: 1fcf18350563
Ref: c-api/veryhigh c PyRun_StringFlags18350862
Ref: 552818350862
Ref: c-api/veryhigh c PyRun_File18351613
Ref: 552a18351613
Ref: c-api/veryhigh c PyRun_FileEx18351963
Ref: 552c18351963
Ref: c-api/veryhigh c PyRun_FileFlags18352300
Ref: 552d18352300
Ref: c-api/veryhigh c PyRun_FileExFlags18352650
Ref: 552b18352650
Ref: c-api/veryhigh c Py_CompileString18353384
Ref: c5f18353384
Ref: c-api/veryhigh c Py_CompileStringFlags18353729
Ref: 552e18353729
Ref: c-api/veryhigh c Py_CompileStringObject18354053
Ref: 553018354053
Ref: c-api/veryhigh c Py_CompileStringExFlags18355221
Ref: 552f18355221
Ref: c-api/veryhigh c PyEval_EvalCode18355694
Ref: c6018355694
Ref: c-api/veryhigh c PyEval_EvalCodeEx18356150
Ref: 1cf818356150
Ref: c-api/veryhigh c PyEval_EvalFrame18356965
Ref: 531418356965
Ref: c-api/veryhigh c PyEval_EvalFrameEx18357319
Ref: 13da18357319
Ref: c-api/veryhigh c PyEval_MergeCompilerFlags18358256
Ref: 553118358256
Ref: c-api/veryhigh c PyCompilerFlags18358466
Ref: e6b18358466
Ref: c-api/veryhigh c PyCompilerFlags cf_flags18359087
Ref: 553218359087
Ref: c-api/veryhigh c PyCompilerFlags cf_feature_version18359171
Ref: 553318359171
Ref: c-api/veryhigh c PyCF_ALLOW_TOP_LEVEL_AWAIT18359619
Ref: 553418359619
Ref: c-api/veryhigh c PyCF_ONLY_AST18359671
Ref: 553518359671
Ref: c-api/veryhigh c PyCF_OPTIMIZED_AST18359710
Ref: 553618359710
Ref: c-api/veryhigh c PyCF_TYPE_COMMENTS18359754
Ref: 553718359754
Node: Available start symbols18360289
Ref: c-api/veryhigh available-start-symbols18360392
Ref: 553a18360392
Ref: c-api/veryhigh start-symbols18360392
Ref: 552918360392
Ref: c-api/veryhigh c Py_eval_input18360453
Ref: 551918360453
Ref: c-api/veryhigh c Py_file_input18360614
Ref: 551a18360614
Ref: c-api/veryhigh c Py_single_input18360956
Ref: 551b18360956
Ref: c-api/veryhigh c Py_func_type_input18361200
Ref: 551c18361200
Ref: Available start symbols-Footnote-118361643
Ref: Available start symbols-Footnote-218361685
Node: Stack Effects18361727
Ref: c-api/veryhigh stack-effects18361830
Ref: 553b18361830
Ref: c-api/veryhigh c PY_INVALID_STACK_EFFECT18361917
Ref: 553c18361917
Ref: c-api/veryhigh c PyCompile_OpcodeStackEffect18362102
Ref: 553d18362102
Ref: c-api/veryhigh c PyCompile_OpcodeStackEffectWithJump18362417
Ref: 203e18362417
Node: 参照カウント18362946
Ref: c-api/refcounting doc18363081
Ref: 553e18363081
Ref: c-api/refcounting countingrefs18363081
Ref: 553f18363081
Ref: c-api/refcounting reference-counting18363081
Ref: 554018363081
Ref: c-api/refcounting translation-repo18363081
Ref: 554118363081
Ref: c-api/refcounting c Py_REFCNT18363259
Ref: 55218363259
Ref: c-api/refcounting c Py_SET_REFCNT18364728
Ref: c8218364728
Ref: c-api/refcounting c Py_INCREF18365309
Ref: 97918365309
Ref: c-api/refcounting c Py_XINCREF18366362
Ref: e2d18366362
Ref: c-api/refcounting c Py_NewRef18366568
Ref: c7418366568
Ref: c-api/refcounting c Py_XNewRef18367296
Ref: c7518367296
Ref: c-api/refcounting c Py_DECREF18367621
Ref: 97a18367621
Ref: c-api/refcounting c Py_XDECREF18369371
Ref: b7318369371
Ref: c-api/refcounting c Py_CLEAR18369605
Ref: 98118369605
Ref: c-api/refcounting c Py_IncRef18370438
Ref: 548518370438
Ref: c-api/refcounting c Py_DecRef18370723
Ref: 547b18370723
Ref: c-api/refcounting c Py_SETREF18370996
Ref: 98218370996
Ref: c-api/refcounting c Py_XSETREF18371762
Ref: 98318371762
Ref: 参照カウント-Footnote-118372152
Ref: 参照カウント-Footnote-218372194
Node: 例外処理18372236
Ref: c-api/exceptions doc18372380
Ref: 554218372380
Ref: c-api/exceptions exception-handling18372380
Ref: 554318372380
Ref: c-api/exceptions exceptionhandling18372380
Ref: 4c7818372380
Ref: c-api/exceptions translation-repo18372380
Ref: 554418372380
Node: 出力とクリア18375507
Ref: c-api/exceptions printing-and-clearing18375598
Ref: 554518375598
Ref: c-api/exceptions c PyErr_Clear18375643
Ref: 13dd18375643
Ref: c-api/exceptions c PyErr_PrintEx18375890
Ref: 530718375890
Ref: c-api/exceptions c PyErr_Print18377060
Ref: 1f4018377060
Ref: c-api/exceptions c PyErr_WriteUnraisable18377207
Ref: 7ee18377207
Ref: c-api/exceptions c PyErr_FormatUnraisable18378267
Ref: 7ed18378267
Ref: c-api/exceptions c PyErr_DisplayException18378782
Ref: 64f18378782
Node: 例外の送出18379076
Ref: c-api/exceptions raising-exceptions18379185
Ref: 554618379185
Ref: c-api/exceptions c PyErr_SetString18379482
Ref: 98518379482
Ref: c-api/exceptions c PyErr_SetObject18380006
Ref: 98418380006
Ref: c-api/exceptions c PyErr_Format18380317
Ref: 126518380317
Ref: c-api/exceptions c PyErr_FormatV18380912
Ref: 126418380912
Ref: c-api/exceptions c PyErr_SetNone18381308
Ref: 531018381308
Ref: c-api/exceptions c PyErr_BadArgument18381497
Ref: 530418381497
Ref: c-api/exceptions c PyErr_NoMemory18381865
Ref: 51c618381865
Ref: c-api/exceptions c PyErr_SetFromErrno18382285
Ref: 51c518382285
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilenameObject18383222
Ref: 530c18383222
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilenameObjects18383764
Ref: 530d18383764
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilename18384319
Ref: 1caa18384319
Ref: c-api/exceptions c PyErr_SetFromWindowsErr18384811
Ref: 530e18384811
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErr18385732
Ref: 530918385732
Ref: c-api/exceptions c PyErr_SetFromWindowsErrWithFilename18386154
Ref: 1cac18386154
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilenameObject18386806
Ref: 530a18386806
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilenameObjects18387419
Ref: 530b18387419
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilename18387949
Ref: 1cab18387949
Ref: c-api/exceptions c PyErr_SetImportError18388427
Ref: 10f918388427
Ref: c-api/exceptions c PyErr_SetImportErrorSubclass18389025
Ref: 10d418389025
Ref: c-api/exceptions c PyErr_SyntaxLocationObject18389518
Ref: 554718389518
Ref: c-api/exceptions c PyErr_RangedSyntaxLocationObject18389956
Ref: 554818389956
Ref: c-api/exceptions c PyErr_SyntaxLocationEx18390306
Ref: 531218390306
Ref: c-api/exceptions c PyErr_SyntaxLocation18390765
Ref: 531118390765
Ref: c-api/exceptions c PyErr_BadInternalCall18391030
Ref: 530518391030
Ref: c-api/exceptions c PyErr_ProgramTextObject18391438
Ref: 554918391438
Ref: c-api/exceptions c PyErr_ProgramText18391829
Ref: 530818391829
Node: 警告<3>18392196
Ref: c-api/exceptions issuing-warnings18392332
Ref: 554a18392332
Ref: c-api/exceptions c PyErr_WarnEx18393385
Ref: 180418393385
Ref: c-api/exceptions c PyErr_WarnExplicitObject18394903
Ref: 554c18394903
Ref: c-api/exceptions c PyErr_WarnExplicit18395555
Ref: 1cb218395555
Ref: c-api/exceptions c PyErr_WarnFormat18396109
Ref: 531318396109
Ref: c-api/exceptions c PyErr_WarnExplicitFormat18396564
Ref: 554d18396564
Ref: c-api/exceptions c PyErr_ResourceWarning18396952
Ref: 10d518396952
Node: エラーインジケータの問い合わせ18397353
Ref: c-api/exceptions querying-the-error-indicator18397507
Ref: 554e18397507
Ref: c-api/exceptions c PyErr_Occurred18397597
Ref: 1ec418397597
Ref: c-api/exceptions c PyErr_ExceptionMatches18398773
Ref: 527418398773
Ref: c-api/exceptions c PyErr_GivenExceptionMatches18399158
Ref: 530618399158
Ref: c-api/exceptions c PyErr_GetRaisedException18399722
Ref: 64318399722
Ref: c-api/exceptions c PyErr_SetRaisedException18400706
Ref: 64618400706
Ref: c-api/exceptions c PyErr_Fetch18401090
Ref: 64218401090
Ref: c-api/exceptions c PyErr_Restore18402413
Ref: 64518402413
Ref: c-api/exceptions c PyErr_NormalizeException18403590
Ref: 64418403590
Ref: c-api/exceptions c PyErr_GetHandledException18404831
Ref: b5618404831
Ref: c-api/exceptions c PyErr_SetHandledException18405767
Ref: b5718405767
Ref: c-api/exceptions c PyErr_GetExcInfo18406559
Ref: b5918406559
Ref: c-api/exceptions c PyErr_SetExcInfo18407662
Ref: b5818407662
Node: シグナルハンドリング<2>18408960
Ref: c-api/exceptions signal-handling18409123
Ref: 554f18409123
Ref: c-api/exceptions c PyErr_CheckSignals18409188
Ref: 88518409188
Ref: c-api/exceptions c PyErr_SetInterrupt18411163
Ref: 530f18411163
Ref: c-api/exceptions c PyErr_SetInterruptEx18411551
Ref: c7818411551
Ref: c-api/exceptions c PySignal_SetWakeupFd18412740
Ref: 179418412740
Node: 例外クラス<2>18413664
Ref: c-api/exceptions exception-classes18413806
Ref: 555018413806
Ref: c-api/exceptions c PyErr_NewException18413846
Ref: 162318413846
Ref: c-api/exceptions c PyErr_NewExceptionWithDoc18415021
Ref: 162218415021
Ref: c-api/exceptions c PyExceptionClass_Check18415521
Ref: 555118415521
Ref: c-api/exceptions c PyExceptionClass_Name18415686
Ref: e2e18415686
Ref: c-api/exceptions c PyException_HEAD18415896
Ref: 555218415896
Node: 例外オブジェクト18416327
Ref: c-api/exceptions exception-objects18416468
Ref: 555318416468
Ref: c-api/exceptions c PyExceptionInstance_Check18416523
Ref: 555418416523
Ref: c-api/exceptions c PyExceptionInstance_Class18416710
Ref: 555518416710
Ref: c-api/exceptions c PyException_GetTraceback18416806
Ref: 535a18416806
Ref: c-api/exceptions c PyException_SetTraceback18417223
Ref: 1fdd18417223
Ref: c-api/exceptions c PyException_GetContext18417497
Ref: 535918417497
Ref: c-api/exceptions c PyException_SetContext18417963
Ref: 535c18417963
Ref: c-api/exceptions c PyException_GetCause18418387
Ref: 535818418387
Ref: c-api/exceptions c PyException_SetCause18418783
Ref: 535b18418783
Ref: c-api/exceptions c PyException_GetArgs18419254
Ref: 97518419254
Ref: c-api/exceptions c PyException_SetArgs18419492
Ref: 97618419492
Ref: c-api/exceptions c PyUnstable_Exc_PrepReraiseStar18419703
Ref: 555618419703
Node: Unicode 例外オブジェクト18420696
Ref: c-api/exceptions unicode-exception-objects18420834
Ref: 555718420834
Ref: c-api/exceptions unicodeexceptions18420834
Ref: 67b18420834
Ref: c-api/exceptions c PyUnicodeDecodeError_Create18421018
Ref: 542b18421018
Ref: c-api/exceptions c PyUnicodeDecodeError_GetEncoding18421550
Ref: 542c18421550
Ref: c-api/exceptions c PyUnicodeEncodeError_GetEncoding18421648
Ref: 543418421648
Ref: c-api/exceptions c PyUnicodeDecodeError_GetObject18421915
Ref: 542e18421915
Ref: c-api/exceptions c PyUnicodeEncodeError_GetObject18422011
Ref: 543518422011
Ref: c-api/exceptions c PyUnicodeTranslateError_GetObject18422107
Ref: 543c18422107
Ref: c-api/exceptions c PyUnicodeDecodeError_GetStart18422373
Ref: 543018422373
Ref: c-api/exceptions c PyUnicodeEncodeError_GetStart18422469
Ref: 1b3c18422469
Ref: c-api/exceptions c PyUnicodeTranslateError_GetStart18422565
Ref: 543e18422565
Ref: c-api/exceptions c PyUnicodeDecodeError_SetStart18423197
Ref: 543318423197
Ref: c-api/exceptions c PyUnicodeEncodeError_SetStart18423292
Ref: 543918423292
Ref: c-api/exceptions c PyUnicodeTranslateError_SetStart18423387
Ref: 544118423387
Ref: c-api/exceptions c PyUnicodeDecodeError_GetEnd18423835
Ref: 542d18423835
Ref: c-api/exceptions c PyUnicodeEncodeError_GetEnd18423927
Ref: 1b3918423927
Ref: c-api/exceptions c PyUnicodeTranslateError_GetEnd18424019
Ref: 543b18424019
Ref: c-api/exceptions c PyUnicodeDecodeError_SetEnd18424569
Ref: 543118424569
Ref: c-api/exceptions c PyUnicodeEncodeError_SetEnd18424660
Ref: 543718424660
Ref: c-api/exceptions c PyUnicodeTranslateError_SetEnd18424751
Ref: 543f18424751
Ref: c-api/exceptions c PyUnicodeDecodeError_GetReason18425124
Ref: 542f18425124
Ref: c-api/exceptions c PyUnicodeEncodeError_GetReason18425220
Ref: 543618425220
Ref: c-api/exceptions c PyUnicodeTranslateError_GetReason18425316
Ref: 543d18425316
Ref: c-api/exceptions c PyUnicodeDecodeError_SetReason18425579
Ref: 543218425579
Ref: c-api/exceptions c PyUnicodeEncodeError_SetReason18425677
Ref: 543818425677
Ref: c-api/exceptions c PyUnicodeTranslateError_SetReason18425775
Ref: 544018425775
Node: 再帰の管理18426103
Ref: c-api/exceptions recursion18426244
Ref: 555818426244
Ref: c-api/exceptions recursion-control18426244
Ref: 555918426244
Ref: c-api/exceptions c Py_EnterRecursiveCall18426667
Ref: 60518426667
Ref: c-api/exceptions c Py_LeaveRecursiveCall18427592
Ref: d4018427592
Ref: c-api/exceptions c Py_ReprEnter18428462
Ref: 548818428462
Ref: c-api/exceptions c Py_ReprLeave18429461
Ref: 548918429461
Ref: c-api/exceptions c Py_GetRecursionLimit18429734
Ref: 548318429734
Ref: c-api/exceptions c Py_SetRecursionLimit18430209
Ref: 548a18430209
Node: Exception and warning types18430544
Ref: c-api/exceptions exception-and-warning-types18430663
Ref: 555a18430663
Ref: c-api/exceptions standardexceptions18430663
Ref: 555b18430663
Node: Exception types18431078
Ref: c-api/exceptions exception-types18431181
Ref: 555c18431181
Ref: c-api/exceptions c PyExc_BaseException18431556
Ref: 531b18431556
Ref: c-api/exceptions c PyExc_BaseExceptionGroup18431747
Ref: 531c18431747
Ref: c-api/exceptions c PyExc_Exception18431997
Ref: 532a18431997
Ref: c-api/exceptions c PyExc_ArithmeticError18432122
Ref: 531818432122
Ref: c-api/exceptions c PyExc_AssertionError18432316
Ref: 531918432316
Ref: c-api/exceptions c PyExc_AttributeError18432508
Ref: 531a18432508
Ref: c-api/exceptions c PyExc_BlockingIOError18432700
Ref: 531d18432700
Ref: c-api/exceptions c PyExc_BrokenPipeError18432929
Ref: 531e18432929
Ref: c-api/exceptions c PyExc_BufferError18433178
Ref: 531f18433178
Ref: c-api/exceptions c PyExc_ChildProcessError18433304
Ref: 532118433304
Ref: c-api/exceptions c PyExc_ConnectionAbortedError18433536
Ref: 532218433536
Ref: c-api/exceptions c PyExc_ConnectionError18433773
Ref: 532318433773
Ref: c-api/exceptions c PyExc_ConnectionRefusedError18434003
Ref: 532418434003
Ref: c-api/exceptions c PyExc_ConnectionResetError18434240
Ref: 532518434240
Ref: c-api/exceptions c PyExc_EOFError18434491
Ref: 532718434491
Ref: c-api/exceptions c PyExc_FileExistsError18434617
Ref: 532b18434617
Ref: c-api/exceptions c PyExc_FileNotFoundError18434847
Ref: 532c18434847
Ref: c-api/exceptions c PyExc_FloatingPointError18435078
Ref: 532d18435078
Ref: c-api/exceptions c PyExc_GeneratorExit18435275
Ref: 532f18435275
Ref: c-api/exceptions c PyExc_ImportCycleError18435467
Ref: 555d18435467
Ref: c-api/exceptions c PyExc_ImportError18435630
Ref: 533118435630
Ref: c-api/exceptions c PyExc_IndentationError18435755
Ref: 533318435755
Ref: c-api/exceptions c PyExc_IndexError18435968
Ref: 533418435968
Ref: c-api/exceptions c PyExc_InterruptedError18436094
Ref: 533518436094
Ref: c-api/exceptions c PyExc_IsADirectoryError18436325
Ref: 533618436325
Ref: c-api/exceptions c PyExc_KeyError18436573
Ref: 533718436573
Ref: c-api/exceptions c PyExc_KeyboardInterrupt18436698
Ref: 533818436698
Ref: c-api/exceptions c PyExc_LookupError18436912
Ref: 533918436912
Ref: c-api/exceptions c PyExc_MemoryError18437057
Ref: 533a18437057
Ref: c-api/exceptions c PyExc_ModuleNotFoundError18437183
Ref: 533b18437183
Ref: c-api/exceptions c PyExc_NameError18437433
Ref: 533c18437433
Ref: c-api/exceptions c PyExc_NotADirectoryError18437558
Ref: 533d18437558
Ref: c-api/exceptions c PyExc_NotImplementedError18437791
Ref: 533e18437791
Ref: c-api/exceptions c PyExc_OSError18438003
Ref: 51c818438003
Ref: c-api/exceptions c PyExc_OverflowError18438128
Ref: 533f18438128
Ref: c-api/exceptions c PyExc_PermissionError18438319
Ref: 534118438319
Ref: c-api/exceptions c PyExc_ProcessLookupError18438549
Ref: 534218438549
Ref: c-api/exceptions c PyExc_PythonFinalizationError18438782
Ref: 555e18438782
Ref: c-api/exceptions c PyExc_RecursionError18438932
Ref: 126618438932
Ref: c-api/exceptions c PyExc_ReferenceError18439161
Ref: 534318439161
Ref: c-api/exceptions c PyExc_RuntimeError18439374
Ref: 534518439374
Ref: c-api/exceptions c PyExc_StopAsyncIteration18439499
Ref: 534718439499
Ref: c-api/exceptions c PyExc_StopIteration18439732
Ref: 534818439732
Ref: c-api/exceptions c PyExc_SyntaxError18439942
Ref: 534918439942
Ref: c-api/exceptions c PyExc_SystemError18440086
Ref: 534b18440086
Ref: c-api/exceptions c PyExc_SystemExit18440229
Ref: 534c18440229
Ref: c-api/exceptions c PyExc_TabError18440371
Ref: 534d18440371
Ref: c-api/exceptions c PyExc_TimeoutError18440516
Ref: 534e18440516
Ref: c-api/exceptions c PyExc_TypeError18440687
Ref: 51c718440687
Ref: c-api/exceptions c PyExc_UnboundLocalError18440812
Ref: 534f18440812
Ref: c-api/exceptions c PyExc_UnicodeDecodeError18441008
Ref: 535018441008
Ref: c-api/exceptions c PyExc_UnicodeEncodeError18441204
Ref: 535118441204
Ref: c-api/exceptions c PyExc_UnicodeError18441420
Ref: 535218441420
Ref: c-api/exceptions c PyExc_UnicodeTranslateError18441545
Ref: 535318441545
Ref: c-api/exceptions c PyExc_ValueError18441763
Ref: 51c918441763
Ref: c-api/exceptions c PyExc_ZeroDivisionError18441888
Ref: 51c418441888
Ref: Exception types-Footnote-118443001
Node: OSError aliases18443043
Ref: c-api/exceptions oserror-aliases18443168
Ref: 555f18443168
Ref: c-api/exceptions c PyExc_EnvironmentError18443796
Ref: 532918443796
Ref: c-api/exceptions c PyExc_IOError18443952
Ref: 533018443952
Ref: c-api/exceptions c PyExc_WindowsError18444108
Ref: 535718444108
Ref: c-api/exceptions win18444366
Ref: 556018444366
Node: Warning types18444522
Ref: c-api/exceptions standardwarningcategories18444623
Ref: 554b18444623
Ref: c-api/exceptions warning-types18444623
Ref: 556118444623
Ref: c-api/exceptions c PyExc_Warning18445009
Ref: 535618445009
Ref: c-api/exceptions c PyExc_BytesWarning18445155
Ref: 532018445155
Ref: c-api/exceptions c PyExc_DeprecationWarning18445280
Ref: 532618445280
Ref: c-api/exceptions c PyExc_EncodingWarning18445476
Ref: 532818445476
Ref: c-api/exceptions c PyExc_FutureWarning18445707
Ref: 532e18445707
Ref: c-api/exceptions c PyExc_ImportWarning18445898
Ref: 533218445898
Ref: c-api/exceptions c PyExc_PendingDeprecationWarning18446089
Ref: 534018446089
Ref: c-api/exceptions c PyExc_ResourceWarning18446292
Ref: 534418446292
Ref: c-api/exceptions c PyExc_RuntimeWarning18446521
Ref: 534618446521
Ref: c-api/exceptions c PyExc_SyntaxWarning18446713
Ref: 534a18446713
Ref: c-api/exceptions c PyExc_UnicodeWarning18446904
Ref: 535418446904
Ref: c-api/exceptions c PyExc_UserWarning18447116
Ref: 535518447116
Node: Tracebacks18447325
Ref: c-api/exceptions tracebacks18447420
Ref: 556218447420
Ref: c-api/exceptions c PyTraceBack_Type18447457
Ref: 542118447457
Ref: c-api/exceptions c PyTraceBack_Check18447686
Ref: 556318447686
Ref: c-api/exceptions c PyTraceBack_Here18447858
Ref: 541f18447858
Ref: c-api/exceptions c PyTraceBack_Print18448300
Ref: 542018448300
Ref: c-api/exceptions c PyUnstable_DumpTraceback18448577
Ref: 3a118448577
Ref: c-api/exceptions c PyUnstable_DumpTracebackThreads18450097
Ref: 3a218450097
Node: 拡張モジュールの定義18452332
Ref: c-api/extension-modules doc18452474
Ref: 556418452474
Ref: c-api/extension-modules defining-extension-modules18452474
Ref: 556518452474
Ref: c-api/extension-modules extension-modules18452474
Ref: 522118452474
Ref: c-api/extension-modules translation-repo18452474
Ref: 556618452474
Node: Extension export hook18453722
Ref: c-api/extension-modules extension-export-hook18453837
Ref: 39518453837
Ref: c-api/extension-modules id118453837
Ref: 556818453837
Ref: c-api/extension-modules c PyModExport_modulename18454274
Ref: 1a718454274
Ref: c-api/extension-modules c PyMODEXPORT_FUNC18455526
Ref: 19b118455526
Ref: Extension export hook-Footnote-118457166
Ref: Extension export hook-Footnote-218457240
Node: 多段階初期化18457282
Ref: c-api/extension-modules id218457448
Ref: 556918457448
Ref: c-api/extension-modules multi-phase-initialization18457448
Ref: 556a18457448
Ref: 多段階初期化-Footnote-118459052
Node: 複数のモジュールインスタンス18459094
Ref: c-api/extension-modules multiple-module-instances18459254
Ref: 556c18459254
Node: PyInit function18460757
Ref: c-api/extension-modules extension-pyinit18460890
Ref: 556718460890
Ref: c-api/extension-modules pyinit-function18460890
Ref: 556e18460890
Ref: c-api/extension-modules c PyInit_modulename18461216
Ref: 556f18461216
Ref: c-api/extension-modules c PyMODINIT_FUNC18461800
Ref: 188b18461800
Ref: c-api/extension-modules c PyModuleDef_Init18462440
Ref: 539b18462440
Node: 従来の一段階初期化18463572
Ref: c-api/extension-modules legacy-single-phase-initialization18463651
Ref: 557018463651
Ref: c-api/extension-modules single-phase-initialization18463651
Ref: 556b18463651
Ref: 従来の一段階初期化-Footnote-118466254
Node: Definition slots18466387
Ref: c-api/slots doc18466541
Ref: 557218466541
Ref: c-api/slots capi-slots18466541
Ref: 37d18466541
Ref: c-api/slots definition-slots18466541
Ref: 557318466541
Ref: c-api/slots translation-repo18466541
Ref: 557418466541
Ref: c-api/slots c PySlot18468080
Ref: 1a818468080
Ref: c-api/slots c PySlot sl_id18468664
Ref: 557718468664
Ref: c-api/slots c PySlot sl_ptr18469159
Ref: 557b18469159
Ref: c-api/slots c PySlot sl_func18469203
Ref: 557c18469203
Ref: c-api/slots c PySlot sl_size18469256
Ref: 557d18469256
Ref: c-api/slots c PySlot sl_int6418469318
Ref: 557e18469318
Ref: c-api/slots c PySlot sl_uint6418469366
Ref: 557f18469366
Ref: c-api/slots c PySlot sl_flags18469826
Ref: 558018469826
Ref: c-api/slots c PySlot_STATIC18469940
Ref: 53fc18469940
Ref: c-api/slots c PySlot_INTPTR18470839
Ref: 53fa18470839
Ref: c-api/slots c PySlot_OPTIONAL18471253
Ref: 53fb18471253
Node: Convenience macros18471975
Ref: c-api/slots convenience-macros18472070
Ref: 558118472070
Ref: c-api/slots c PySlot_DATA18472121
Ref: 38b18472121
Ref: c-api/slots c PySlot_FUNC18472167
Ref: 38c18472167
Ref: c-api/slots c PySlot_SIZE18472213
Ref: 38d18472213
Ref: c-api/slots c PySlot_INT6418472259
Ref: 38e18472259
Ref: c-api/slots c PySlot_UINT6418472306
Ref: 38f18472306
Ref: c-api/slots c PySlot_STATIC_DATA18472354
Ref: 39018472354
Ref: c-api/slots c PySlot_END18473589
Ref: 39118473589
Ref: c-api/slots c PySlot_PTR18473848
Ref: 39218473848
Ref: c-api/slots c PySlot_PTR_STATIC18473893
Ref: 39318473893
Node: Common slot IDs18474556
Ref: c-api/slots common-slot-ids18474651
Ref: 558218474651
Ref: c-api/slots pyslot-common-ids18474651
Ref: 557818474651
Ref: c-api/slots c Py_slot_end18474769
Ref: 37f18474769
Ref: c-api/slots c Py_slot_subslots18474968
Ref: 38118474968
Ref: c-api/slots c Py_slot_invalid18475546
Ref: 38018475546
Node: ユーティリティ<2>18475966
Ref: c-api/utilities doc18476146
Ref: 558318476146
Ref: c-api/utilities id118476146
Ref: 558418476146
Ref: c-api/utilities translation-repo18476146
Ref: 558518476146
Ref: c-api/utilities utilities18476146
Ref: 558618476146
Node: オペレーティングシステム関連のユーティリティ18477112
Ref: c-api/sys doc18477266
Ref: 558718477266
Ref: c-api/sys operating-system-utilities18477266
Ref: 558818477266
Ref: c-api/sys os18477266
Ref: 558918477266
Ref: c-api/sys c PyOS_FSPath18477391
Ref: 10d618477391
Ref: c-api/sys c Py_FdIsInteractive18478037
Ref: 558a18478037
Ref: c-api/sys c PyOS_BeforeFork18478583
Ref: f8118478583
Ref: c-api/sys c PyOS_AfterFork_Parent18479335
Ref: f8218479335
Ref: c-api/sys c PyOS_AfterFork_Child18480187
Ref: 64a18480187
Ref: c-api/sys c PyOS_AfterFork18481228
Ref: 64918481228
Ref: c-api/sys c PyOS_CheckStack18481861
Ref: 1dba18481861
Ref: c-api/sys c PyOS_sighandler_t18482390
Ref: 53ca18482390
Ref: c-api/sys c PyOS_getsig18482504
Ref: 18f618482504
Ref: c-api/sys c PyOS_setsig18482799
Ref: 18f718482799
Ref: c-api/sys c PyOS_InterruptOccurred18483160
Ref: 1f5518483160
Ref: c-api/sys c Py_DecodeLocale18483908
Ref: f8918483908
Ref: c-api/sys c Py_EncodeLocale18486761
Ref: f8a18486761
Ref: c-api/sys c Py_fopen18488880
Ref: 5c718488880
Ref: c-api/sys c Py_fclose18489534
Ref: 5c818489534
Ref: オペレーティングシステム関連のユーティリティ-Footnote-118489961
Node: システム関数18490003
Ref: c-api/sys system-functions18490184
Ref: 558c18490184
Ref: c-api/sys systemfunctions18490184
Ref: 558d18490184
Ref: c-api/sys c PySys_GetAttr18490555
Ref: 35a18490555
Ref: c-api/sys c PySys_GetAttrString18491101
Ref: 35b18491101
Ref: c-api/sys c PySys_GetOptionalAttr18491607
Ref: 35c18491607
Ref: c-api/sys c PySys_GetOptionalAttrString18492283
Ref: 35d18492283
Ref: c-api/sys c PySys_GetObject18492669
Ref: 35e18492669
Ref: c-api/sys c PySys_SetObject18493045
Ref: 540818493045
Ref: c-api/sys c PySys_WriteStdout18493448
Ref: 540a18493448
Ref: c-api/sys c PySys_WriteStderr18494641
Ref: 540918494641
Ref: c-api/sys c PySys_FormatStdout18494893
Ref: 540618494893
Ref: c-api/sys c PySys_FormatStderr18495264
Ref: 540518495264
Ref: c-api/sys c PySys_GetXOptions18495546
Ref: 540718495546
Ref: c-api/sys c PySys_Audit18495956
Ref: 80e18495956
Ref: c-api/sys c PySys_AuditTuple18497317
Ref: 80d18497317
Ref: c-api/sys c PySys_AddAuditHook18497675
Ref: 49b818497675
Ref: c-api/sys c Py_AuditHookFunction18499387
Ref: 558e18499387
Ref: システム関数-Footnote-118499903
Node: プロセス制御18499945
Ref: c-api/sys process-control18500096
Ref: 559018500096
Ref: c-api/sys processcontrol18500096
Ref: 559118500096
Ref: c-api/sys c Py_FatalError18500141
Ref: d4f18500141
Ref: c-api/sys c Py_Exit18500932
Ref: 110818500932
Ref: c-api/sys c Py_AtExit18501430
Ref: 547718501430
Node: モジュールのインポート<2>18502385
Ref: c-api/import doc18502569
Ref: 559218502569
Ref: c-api/import importing18502569
Ref: 559318502569
Ref: c-api/import importing-modules18502569
Ref: 559418502569
Ref: c-api/import translation-repo18502569
Ref: 559518502569
Ref: c-api/import c PyImport_ImportModule18502639
Ref: 3ab18502639
Ref: c-api/import c PyImport_ImportModuleEx18502956
Ref: 156318502956
Ref: c-api/import c PyImport_ImportModuleLevelObject18503971
Ref: 537218503971
Ref: c-api/import c PyImport_ImportModuleLevel18505049
Ref: 156218505049
Ref: c-api/import c PyImport_Import18505615
Ref: 17b418505615
Ref: c-api/import c PyImport_ReloadModule18506332
Ref: 537318506332
Ref: c-api/import c PyImport_AddModuleRef18506850
Ref: 7f718506850
Ref: c-api/import c PyImport_AddModuleObject18507866
Ref: 536918507866
Ref: c-api/import c PyImport_AddModule18508250
Ref: 7f818508250
Ref: c-api/import c PyImport_ExecCodeModule18508518
Ref: 536a18508518
Ref: c-api/import c PyImport_ExecCodeModuleEx18510693
Ref: 536b18510693
Ref: c-api/import c PyImport_ExecCodeModuleObject18511168
Ref: 536c18511168
Ref: c-api/import c PyImport_ExecCodeModuleWithPathnames18511890
Ref: 536d18511890
Ref: c-api/import c PyImport_GetMagicNumber18512769
Ref: 156118512769
Ref: c-api/import c PyImport_GetMagicTag18513308
Ref: 536e18513308
Ref: c-api/import c PyImport_GetModuleDict18513735
Ref: 536f18513735
Ref: c-api/import c PyImport_GetModule18514086
Ref: f7518514086
Ref: c-api/import c PyImport_GetImporter18514662
Ref: 1ca918514662
Ref: c-api/import c PyImport_ImportFrozenModuleObject18515391
Ref: 537118515391
Ref: c-api/import c PyImport_ImportFrozenModule18516321
Ref: 537018516321
Ref: c-api/import c _frozen18516667
Ref: b5c18516667
Ref: c-api/import c PyImport_FrozenModules18517401
Ref: 358718517401
Ref: c-api/import c PyImport_AppendInittab18518004
Ref: 1d3918518004
Ref: c-api/import c _inittab18518724
Ref: 559618518724
Ref: c-api/import c _inittab name18519054
Ref: 559718519054
Ref: c-api/import c _inittab initfunc18519159
Ref: 559818519159
Ref: c-api/import c PyImport_ExtendInittab18519317
Ref: 1d3a18519317
Ref: c-api/import c PyImport_Inittab18520138
Ref: 1d3818520138
Ref: c-api/import c PyImport_ImportModuleAttr18520397
Ref: 5ca18520397
Ref: c-api/import c PyImport_ImportModuleAttrString18520957
Ref: 5cb18520957
Ref: c-api/import c PyImport_GetLazyImportsMode18521291
Ref: 559918521291
Ref: c-api/import c PyImport_GetLazyImportsFilter18521459
Ref: 559b18521459
Ref: c-api/import c PyImport_SetLazyImportsMode18521708
Ref: 559c18521708
Ref: c-api/import c PyImport_SetLazyImportsFilter18522014
Ref: 559d18522014
Ref: c-api/import c PyImport_LazyImportsMode18522647
Ref: 559a18522647
Ref: c-api/import c PyImport_LazyImportsMode PyImport_LAZY_NORMAL18522750
Ref: 559e18522750
Ref: c-api/import c PyImport_LazyImportsMode PyImport_LAZY_ALL18522901
Ref: 559f18522901
Ref: c-api/import c PyImport_LazyImportsMode PyImport_LAZY_NONE18522999
Ref: 55a018522999
Ref: c-api/import c PyImport_CreateModuleFromInitfunc18523193
Ref: 37118523193
Ref: モジュールのインポート<2>-Footnote-118524055
Node: データ整列化 data marshalling のサポート18524097
Ref: c-api/marshal doc18524293
Ref: 55a118524293
Ref: c-api/marshal data-marshalling-support18524293
Ref: 55a218524293
Ref: c-api/marshal marshalling-utils18524293
Ref: 55a318524293
Ref: c-api/marshal translation-repo18524293
Ref: 55a418524293
Ref: c-api/marshal c Py_MARSHAL_VERSION18524998
Ref: 55a518524998
Ref: c-api/marshal c PyMarshal_WriteLongToFile18525106
Ref: b7a18525106
Ref: c-api/marshal c PyMarshal_WriteObjectToFile18525676
Ref: b7b18525676
Ref: c-api/marshal c PyMarshal_WriteObjectToString18526114
Ref: b7d18526114
Ref: c-api/marshal c PyMarshal_ReadLongFromFile18526493
Ref: 55a618526493
Ref: c-api/marshal c PyMarshal_ReadShortFromFile18526943
Ref: 55a718526943
Ref: c-api/marshal c PyMarshal_ReadObjectFromFile18527395
Ref: 55a818527395
Ref: c-api/marshal c PyMarshal_ReadLastObjectFromFile18527808
Ref: 55a918527808
Ref: c-api/marshal c PyMarshal_ReadObjectFromString18528607
Ref: b7c18528607
Node: 引数の解釈と値の構築18529066
Ref: c-api/arg doc18529256
Ref: 55aa18529256
Ref: c-api/arg arg-parsing18529256
Ref: 60818529256
Ref: c-api/arg parsing-arguments-and-building-values18529256
Ref: 55ab18529256
Ref: c-api/arg translation-repo18529256
Ref: 55ac18529256
Node: 引数を解析する<2>18530023
Ref: c-api/arg parsing-arguments18530135
Ref: 55ad18530135
Node: 文字列とバッファ18530996
Ref: c-api/arg arg-parsing-string-and-buffers18531096
Ref: 82518531096
Ref: c-api/arg strings-and-buffers18531096
Ref: 55ae18531096
Ref: c-api/arg c-arg-borrowed-buffer18532762
Ref: 60918532762
Node: 数<2>18544950
Ref: c-api/arg numbers18545089
Ref: 55af18545089
Node: その他のオブジェクト18548678
Ref: c-api/arg other-objects18548803
Ref: 55b018548803
Ref: c-api/arg o-ampersand18549921
Ref: 55b118549921
Ref: c-api/arg c Py_CLEANUP_SUPPORTED18550769
Ref: 55b218550769
Node: API 関数18555920
Ref: c-api/arg api-functions18556030
Ref: 55b318556030
Ref: c-api/arg c PyArg_ParseTuple18556067
Ref: 3b918556067
Ref: c-api/arg c PyArg_VaParse18556440
Ref: 529818556440
Ref: c-api/arg c PyArg_ParseTupleAndKeywords18556722
Ref: 81e18556722
Ref: c-api/arg c PyArg_VaParseTupleAndKeywords18557837
Ref: 81f18557837
Ref: c-api/arg c PyArg_ValidateKeywordArguments18558193
Ref: 529918558193
Ref: c-api/arg c PyArg_Parse18558642
Ref: 1a8b18558642
Ref: c-api/arg c PyArg_ParseArray18559349
Ref: 35118559349
Ref: c-api/arg c PyArg_ParseArrayAndKeywords18559775
Ref: 35218559775
Ref: c-api/arg c PyArg_UnpackTuple18560320
Ref: 18be18560320
Ref: c-api/arg c PY_CXX_CONST18562657
Ref: 82018562657
Node: 値の構築18563083
Ref: c-api/arg building-values18563195
Ref: 55b418563195
Ref: c-api/arg c Py_BuildValue18563234
Ref: 5f518563234
Ref: c-api/arg capi-py-buildvalue-format-k18569201
Ref: 1ab218569201
Ref: c-api/arg c Py_VaBuildValue18573061
Ref: 549d18573061
Node: 文字列の変換と書式化18573368
Ref: c-api/conversion doc18573546
Ref: 55b518573546
Ref: c-api/conversion string-conversion18573546
Ref: 55b618573546
Ref: c-api/conversion string-conversion-and-formatting18573546
Ref: 55b718573546
Ref: c-api/conversion translation-repo18573546
Ref: 55b818573546
Ref: c-api/conversion c PyOS_snprintf18573679
Ref: 18c118573679
Ref: c-api/conversion c PyOS_vsnprintf18574033
Ref: 18c218574033
Ref: c-api/conversion c PyOS_strtoul18575947
Ref: 53cc18575947
Ref: c-api/conversion c PyOS_strtol18576986
Ref: 53cb18576986
Ref: c-api/conversion c PyOS_string_to_double18577512
Ref: 164f18577512
Ref: c-api/conversion c PyOS_double_to_string18579498
Ref: 53c918579498
Ref: c-api/conversion c Py_DTSF_SIGN18580236
Ref: 55b918580236
Ref: c-api/conversion c Py_DTSF_ADD_DOT_018580385
Ref: 55ba18580385
Ref: c-api/conversion c Py_DTSF_ALT18580503
Ref: 55bb18580503
Ref: c-api/conversion c Py_DTSF_NO_NEG_018580691
Ref: 55bc18580691
Ref: c-api/conversion c Py_DTST_FINITE18581322
Ref: 55bd18581322
Ref: c-api/conversion c Py_DTST_INFINITE18581524
Ref: 55be18581524
Ref: c-api/conversion c Py_DTST_NAN18581721
Ref: 55bf18581721
Ref: c-api/conversion c PyOS_mystricmp18582127
Ref: 1f4e18582127
Ref: c-api/conversion c PyOS_mystrnicmp18582200
Ref: 1f4d18582200
Ref: c-api/conversion c PyOS_stricmp18583001
Ref: 55c018583001
Ref: c-api/conversion c PyOS_strnicmp18583072
Ref: 55c118583072
Ref: 文字列の変換と書式化-Footnote-118583480
Ref: 文字列の変換と書式化-Footnote-218583528
Ref: 文字列の変換と書式化-Footnote-318583577
Ref: 文字列の変換と書式化-Footnote-418583624
Node: Character classification and conversion18583670
Ref: c-api/conversion character-classification-and-conversion18583828
Ref: 55c218583828
Ref: c-api/conversion c Py_ISALNUM18584106
Ref: 170b18584106
Ref: c-api/conversion c Py_ISALPHA18584211
Ref: 170c18584211
Ref: c-api/conversion c Py_ISDIGIT18584345
Ref: 170d18584345
Ref: c-api/conversion c Py_ISLOWER18584452
Ref: 170e18584452
Ref: c-api/conversion c Py_ISUPPER18584573
Ref: 171018584573
Ref: c-api/conversion c Py_ISSPACE18584695
Ref: 170f18584695
Ref: c-api/conversion c Py_ISXDIGIT18584869
Ref: 171118584869
Ref: c-api/conversion c Py_TOLOWER18585012
Ref: 171218585012
Ref: c-api/conversion c Py_TOUPPER18585108
Ref: 171318585108
Node: PyHash API18585204
Ref: c-api/hash doc18585353
Ref: 55c318585353
Ref: c-api/hash pyhash-api18585353
Ref: 55c418585353
Ref: c-api/hash translation-repo18585353
Ref: 55c518585353
Ref: c-api/hash c Py_hash_t18585508
Ref: 161d18585508
Ref: c-api/hash c Py_uhash_t18585623
Ref: 55c618585623
Ref: c-api/hash c Py_HASH_ALGORITHM18585739
Ref: 3b818585739
Ref: c-api/hash c Py_HASH_FNV18586046
Ref: 55c718586046
Ref: c-api/hash c Py_HASH_SIPHASH2418586078
Ref: 55c818586078
Ref: c-api/hash c Py_HASH_SIPHASH1318586116
Ref: 55c918586116
Ref: c-api/hash c Py_HASH_CUTOFF18586522
Ref: 55ca18586522
Ref: c-api/hash c PyHASH_MODULUS18587215
Ref: 1c1018587215
Ref: c-api/hash c PyHASH_BITS18587437
Ref: 1c1118587437
Ref: c-api/hash c PyHASH_MULTIPLIER18587568
Ref: 1bc018587568
Ref: c-api/hash c PyHASH_INF18587700
Ref: 1c1218587700
Ref: c-api/hash c PyHASH_IMAG18587887
Ref: 1c1318587887
Ref: c-api/hash c PyHash_FuncDef18588091
Ref: 55cb18588091
Ref: c-api/hash c PyHash_FuncDef hash18588207
Ref: 55cd18588207
Ref: c-api/hash c PyHash_FuncDef name18588354
Ref: 55ce18588354
Ref: c-api/hash c PyHash_FuncDef hash_bits18588549
Ref: 55cf18588549
Ref: c-api/hash c PyHash_FuncDef seed_bits18588745
Ref: 55d018588745
Ref: c-api/hash c PyHash_GetFuncDef18588956
Ref: 55cc18588956
Ref: c-api/hash c Py_HashPointer18589181
Ref: 63f18589181
Ref: c-api/hash c Py_HashBuffer18589491
Ref: 5c918589491
Ref: c-api/hash c PyObject_GenericHash18590132
Ref: 80818590132
Ref: PyHash API-Footnote-118590541
Ref: PyHash API-Footnote-218590594
Node: リフレクション18590636
Ref: c-api/reflection doc18590788
Ref: 55d118590788
Ref: c-api/reflection id118590788
Ref: 55d218590788
Ref: c-api/reflection reflection18590788
Ref: 55d318590788
Ref: c-api/reflection translation-repo18590788
Ref: 55d418590788
Ref: c-api/reflection c PyEval_GetBuiltins18590840
Ref: 7f018590840
Ref: c-api/reflection c PyEval_GetLocals18591284
Ref: 7f418591284
Ref: c-api/reflection c PyEval_GetGlobals18592830
Ref: 7f218592830
Ref: c-api/reflection c PyEval_GetFrame18593221
Ref: 1d5618593221
Ref: c-api/reflection c PyEval_GetFrameBuiltins18593541
Ref: 7ef18593541
Ref: c-api/reflection c PyEval_GetFrameLocals18593963
Ref: 7f318593963
Ref: c-api/reflection c PyEval_GetFrameGlobals18594610
Ref: 7f118594610
Ref: c-api/reflection c PyEval_GetFuncName18595032
Ref: 531618595032
Ref: c-api/reflection c PyEval_GetFuncDesc18595313
Ref: 531518595313
Ref: リフレクション-Footnote-118595778
Node: codec レジストリとサポート関数18595820
Ref: c-api/codec doc18595974
Ref: 55d518595974
Ref: c-api/codec codec-registry18595974
Ref: 10f018595974
Ref: c-api/codec codec-registry-and-support-functions18595974
Ref: 55d618595974
Ref: c-api/codec translation-repo18595974
Ref: 55d718595974
Ref: c-api/codec c PyCodec_Register18596063
Ref: 52da18596063
Ref: c-api/codec c PyCodec_Unregister18596407
Ref: c7118596407
Ref: c-api/codec c PyCodec_KnownEncoding18596886
Ref: 52d818596886
Ref: c-api/codec c PyCodec_Encode18597181
Ref: 3aa18597181
Ref: c-api/codec c PyCodec_Decode18597866
Ref: 3a918597866
Node: コーデック検索API18598547
Ref: c-api/codec codec-lookup-api18598710
Ref: 55d818598710
Ref: c-api/codec c PyCodec_Encoder18599044
Ref: 52d418599044
Ref: c-api/codec c PyCodec_Decoder18599292
Ref: 52d318599292
Ref: c-api/codec c PyCodec_IncrementalEncoder18599537
Ref: 52d718599537
Ref: c-api/codec c PyCodec_IncrementalDecoder18599852
Ref: 52d618599852
Ref: c-api/codec c PyCodec_StreamReader18600167
Ref: 52dd18600167
Ref: c-api/codec c PyCodec_StreamWriter18600491
Ref: 52de18600491
Node: Unicode エラーハンドラ用レジストリ API18600815
Ref: c-api/codec registry-api-for-unicode-encoding-error-handlers18601010
Ref: 55d918601010
Ref: c-api/codec c PyCodec_RegisterError18601120
Ref: 52db18601120
Ref: c-api/codec c PyCodec_LookupError18602507
Ref: 52d918602507
Ref: c-api/codec c PyCodec_StrictErrors18602936
Ref: 52df18602936
Ref: c-api/codec c PyCodec_IgnoreErrors18603143
Ref: 52d518603143
Ref: c-api/codec c PyCodec_ReplaceErrors18603382
Ref: 52dc18603382
Ref: c-api/codec c PyCodec_XMLCharRefReplaceErrors18603628
Ref: 52e018603628
Ref: c-api/codec c PyCodec_BackslashReplaceErrors18603881
Ref: 52d218603881
Ref: c-api/codec c PyCodec_NameReplaceErrors18604193
Ref: 126318604193
Node: Codec utility variables18604505
Ref: c-api/codec codec-utility-variables18604667
Ref: 55da18604667
Ref: c-api/codec c Py_hexdigits18604734
Ref: 55db18604734
Node: PyTime C API18604902
Ref: c-api/time doc18605056
Ref: 69818605056
Ref: c-api/time c-api-time18605056
Ref: 7d118605056
Ref: c-api/time pytime-c-api18605056
Ref: 55dc18605056
Ref: c-api/time translation-repo18605056
Ref: 55dd18605056
Node: 型<3>18605526
Ref: c-api/time types18605605
Ref: 55df18605605
Ref: c-api/time c PyTime_t18605631
Ref: 7d218605631
Ref: c-api/time c PyTime_MIN18606167
Ref: 7d318606167
Ref: c-api/time c PyTime_MAX18606258
Ref: 7d418606258
Node: Clock Functions18606349
Ref: c-api/time clock-functions18606456
Ref: 55e018606456
Ref: c-api/time c PyTime_Monotonic18607181
Ref: 7d618607181
Ref: c-api/time c PyTime_PerfCounter18607347
Ref: 7d818607347
Ref: c-api/time c PyTime_Time18607522
Ref: 7da18607522
Node: Raw Clock Functions18607684
Ref: c-api/time raw-clock-functions18607805
Ref: 55e118607805
Ref: c-api/time c PyTime_MonotonicRaw18608348
Ref: 7d718608348
Ref: c-api/time c PyTime_PerfCounterRaw18608558
Ref: 7d918608558
Ref: c-api/time c PyTime_TimeRaw18608772
Ref: 7db18608772
Node: Conversion functions18608967
Ref: c-api/time conversion-functions18609064
Ref: 55e218609064
Ref: c-api/time c PyTime_AsSecondsDouble18609125
Ref: 7d518609125
Node: Support for Perf Maps18609347
Ref: c-api/perfmaps doc18609450
Ref: 55e318609450
Ref: c-api/perfmaps perfmaps18609450
Ref: 55e418609450
Ref: c-api/perfmaps support-for-perf-maps18609450
Ref: 55e518609450
Ref: c-api/perfmaps translation-repo18609450
Ref: 55e618609450
Ref: c-api/perfmaps c PyUnstable_PerfMapState_Init18610122
Ref: 1ccc18610122
Ref: c-api/perfmaps c PyUnstable_WritePerfMapEntry18611023
Ref: 1ccb18611023
Ref: c-api/perfmaps c PyUnstable_PerfMapState_Fini18611875
Ref: 1ccd18611875
Ref: Support for Perf Maps-Footnote-118612507
Ref: Support for Perf Maps-Footnote-218612564
Ref: Support for Perf Maps-Footnote-318612607
Node: 抽象オブジェクトレイヤ Abstract Objects Layer18612731
Ref: c-api/abstract doc18612945
Ref: 55e718612945
Ref: c-api/abstract abstract18612945
Ref: 521718612945
Ref: c-api/abstract abstract-objects-layer18612945
Ref: 55e818612945
Ref: c-api/abstract translation-repo18612945
Ref: 55e918612945
Node: オブジェクトプロトコル object protocol18614348
Ref: c-api/object doc18614519
Ref: 55ea18614519
Ref: c-api/object object18614519
Ref: 55eb18614519
Ref: c-api/object object-protocol18614519
Ref: 55ec18614519
Ref: c-api/object c Py_GetConstant18614625
Ref: 7f518614625
Ref: c-api/object c Py_CONSTANT_NONE18615322
Ref: 55ed18615322
Ref: c-api/object c Py_CONSTANT_FALSE18615530
Ref: 55ee18615530
Ref: c-api/object c Py_CONSTANT_TRUE18615737
Ref: 55ef18615737
Ref: c-api/object c Py_CONSTANT_ELLIPSIS18615948
Ref: 55f018615948
Ref: c-api/object c Py_CONSTANT_NOT_IMPLEMENTED18616139
Ref: 55f118616139
Ref: c-api/object c Py_CONSTANT_ZERO18616313
Ref: 55f218616313
Ref: c-api/object c Py_CONSTANT_ONE18616510
Ref: 55f318616510
Ref: c-api/object c Py_CONSTANT_EMPTY_STR18616714
Ref: 55f418616714
Ref: c-api/object c Py_CONSTANT_EMPTY_BYTES18616915
Ref: 55f518616915
Ref: c-api/object c Py_CONSTANT_EMPTY_TUPLE18617115
Ref: 55f618617115
Ref: c-api/object c Py_GetConstantBorrowed18617430
Ref: 7f618617430
Ref: c-api/object c Py_NotImplemented18617983
Ref: 55f718617983
Ref: c-api/object c Py_RETURN_NOTIMPLEMENTED18618244
Ref: 1a0518618244
Ref: c-api/object c Py_PRINT_RAW18618486
Ref: 55f818618486
Ref: c-api/object c PyObject_Print18618781
Ref: 191f18618781
Ref: c-api/object c PyObject_Dump18619164
Ref: 37c18619164
Ref: c-api/object c PyObject_HasAttrWithError18620291
Ref: 81518620291
Ref: c-api/object c PyObject_HasAttrStringWithError18620691
Ref: 81718620691
Ref: c-api/object c PyObject_HasAttr18621089
Ref: 81618621089
Ref: c-api/object c PyObject_HasAttrString18621747
Ref: 81818621747
Ref: c-api/object c PyObject_GetAttr18622503
Ref: 3bf18622503
Ref: c-api/object c PyObject_GetAttrString18623063
Ref: 7ec18623063
Ref: c-api/object c PyObject_GetOptionalAttr18623571
Ref: 7ea18623571
Ref: c-api/object c PyObject_GetOptionalAttrString18624302
Ref: 7eb18624302
Ref: c-api/object c PyObject_GenericGetAttr18624720
Ref: 53d518624720
Ref: c-api/object c PyObject_SetAttr18625592
Ref: 194818625592
Ref: c-api/object c PyObject_SetAttrString18626540
Ref: 1a8c18626540
Ref: c-api/object c PyObject_GenericSetAttr18627795
Ref: 53d618627795
Ref: c-api/object c PyObject_DelAttr18628630
Ref: 1a8d18628630
Ref: c-api/object c PyObject_DelAttrString18629000
Ref: 1a8e18629000
Ref: c-api/object c PyObject_GenericGetDict18629818
Ref: 1f1918629818
Ref: c-api/object c PyObject_GenericSetDict18630592
Ref: 53d718630592
Ref: c-api/object c _PyObject_GetDictPtr18630964
Ref: 55f918630964
Ref: c-api/object c PyObject_RichCompare18631393
Ref: 521518631393
Ref: c-api/object c PyObject_RichCompareBool18632126
Ref: 1f9d18632126
Ref: c-api/object c PyObject_Format18632676
Ref: 53d418632676
Ref: c-api/object c PyObject_Repr18633127
Ref: 13db18633127
Ref: c-api/object c PyObject_ASCII18633872
Ref: 53cd18633872
Ref: c-api/object c PyObject_Str18634573
Ref: 13dc18634573
Ref: c-api/object c PyObject_Bytes18635356
Ref: 53cf18635356
Ref: c-api/object c PyObject_IsSubclass18636045
Ref: 125b18636045
Ref: c-api/object c PyObject_IsInstance18637236
Ref: 125a18637236
Ref: c-api/object c PyObject_Hash18638425
Ref: 65018638425
Ref: c-api/object c PyObject_HashNotImplemented18638906
Ref: 177f18638906
Ref: c-api/object c PyObject_IsTrue18639340
Ref: 53da18639340
Ref: c-api/object c PyObject_Not18639663
Ref: 53dc18639663
Ref: c-api/object c PyObject_Type18639979
Ref: 53df18639979
Ref: c-api/object c PyObject_TypeCheck18640674
Ref: 1eca18640674
Ref: c-api/object c PyObject_Size18640900
Ref: 53de18640900
Ref: c-api/object c PyObject_Length18640968
Ref: 53db18640968
Ref: c-api/object c PyObject_LengthHint18641431
Ref: 13b218641431
Ref: c-api/object c PyObject_GetItem18641912
Ref: 7e818641912
Ref: c-api/object c PyObject_SetItem18642266
Ref: 526e18642266
Ref: c-api/object c PyObject_DelItem18642718
Ref: 53d118642718
Ref: c-api/object c PyObject_DelItemString18643023
Ref: 53d218643023
Ref: c-api/object c PyObject_Dir18643318
Ref: 53d318643318
Ref: c-api/object c PyObject_GetIter18644033
Ref: 53d918644033
Ref: c-api/object c PyObject_SelfIter18644569
Ref: 53dd18644569
Ref: c-api/object c PyObject_GetAIter18644921
Ref: 53d818644921
Ref: c-api/object c PyObject_GetTypeData18645500
Ref: 1a518645500
Ref: c-api/object c PyType_GetTypeDataSize18645991
Ref: 95a18645991
Ref: c-api/object c PyObject_GetItemData18646696
Ref: 95c18646696
Ref: c-api/object c PyObject_VisitManagedDict18647040
Ref: 80918647040
Ref: c-api/object c PyObject_ClearManagedDict18647356
Ref: 80a18647356
Ref: c-api/object c PyUnstable_Object_EnableDeferredRefcount18647632
Ref: 5f818647632
Ref: c-api/object c PyUnstable_Object_IsUniqueReferencedTemporary18649217
Ref: 5fa18649217
Ref: c-api/object c PyUnstable_IsImmortal18650846
Ref: 5f718650846
Ref: c-api/object c PyUnstable_TryIncRef18651428
Ref: 1b0918651428
Ref: c-api/object c PyUnstable_EnableTryIncRef18654158
Ref: 1b0a18654158
Ref: c-api/object c PyUnstable_Object_IsUniquelyReferenced18654669
Ref: 5f918654669
Ref: c-api/object c PyUnstable_SetImmortal18655658
Ref: 39f18655658
Ref: オブジェクトプロトコル object protocol-Footnote-118656850
Ref: オブジェクトプロトコル object protocol-Footnote-218656892
Ref: オブジェクトプロトコル object protocol-Footnote-318656934
Node: Call プロトコル18657004
Ref: c-api/call doc18657224
Ref: 560118657224
Ref: c-api/call call18657224
Ref: 98a18657224
Ref: c-api/call call-protocol18657224
Ref: 560218657224
Ref: c-api/call translation-repo18657224
Ref: 560318657224
Node: The tp_call Protocol18657458
Ref: c-api/call the-tp-call-protocol18657567
Ref: 560418657567
Node: The Vectorcall Protocol18658303
Ref: c-api/call the-vectorcall-protocol18658439
Ref: 560618658439
Ref: c-api/call vectorcall18658439
Ref: 96018658439
Ref: c-api/call c vectorcallfunc18660213
Ref: 96518660213
Ref: c-api/call c PY_VECTORCALL_ARGUMENTS_OFFSET18661325
Ref: 96a18661325
Ref: The Vectorcall Protocol-Footnote-118662483
Node: 再帰の管理<2>18662525
Ref: c-api/call recursion-control18662634
Ref: 560818662634
Node: Vectorcall Support API18663037
Ref: c-api/call vectorcall-support-api18663146
Ref: 560918663146
Ref: c-api/call c PyVectorcall_NARGS18663209
Ref: 96318663209
Ref: c-api/call c PyVectorcall_Function18663679
Ref: 560a18663679
Ref: c-api/call c PyVectorcall_Call18664229
Ref: 96418664229
Node: Object Calling API18664858
Ref: c-api/call capi-call18664990
Ref: 560518664990
Ref: c-api/call object-calling-api18664990
Ref: 560b18664990
Ref: c-api/call c PyObject_Call18669617
Ref: 83518669617
Ref: c-api/call c PyObject_CallNoArgs18670436
Ref: 83418670436
Ref: c-api/call c PyObject_CallOneArg18670954
Ref: d4418670954
Ref: c-api/call c PyObject_CallObject18671358
Ref: 51d118671358
Ref: c-api/call c PyObject_CallFunction18671983
Ref: 83718671983
Ref: c-api/call c PyObject_CallMethod18673024
Ref: 3be18673024
Ref: c-api/call c PyObject_CallFunctionObjArgs18674128
Ref: 53d018674128
Ref: c-api/call c PyObject_CallMethodObjArgs18674773
Ref: 1fed18674773
Ref: c-api/call c PyObject_CallMethodNoArgs18675430
Ref: 560c18675430
Ref: c-api/call c PyObject_CallMethodOneArg18675837
Ref: 560d18675837
Ref: c-api/call c _PyObject_Vectorcall18676281
Ref: 560f18676281
Ref: c-api/call c PyObject_Vectorcall18676281
Ref: 96818676281
Ref: c-api/call c PyObject_VectorcallDict18677101
Ref: 560e18677101
Ref: c-api/call c PyObject_VectorcallMethod18677814
Ref: 96918677814
Node: Call Support API18678970
Ref: c-api/call call-support-api18679070
Ref: 561018679070
Ref: c-api/call c PyCallable_Check18679121
Ref: 52c618679121
Node: 数値型プロトコル number protocol18679517
Ref: c-api/number doc18679739
Ref: 561118679739
Ref: c-api/number number18679739
Ref: 561218679739
Ref: c-api/number number-protocol18679739
Ref: 561318679739
Ref: c-api/number translation-repo18679739
Ref: 561418679739
Ref: c-api/number c PyNumber_Check18679830
Ref: e2f18679830
Ref: c-api/number c PyNumber_Add18680266
Ref: 53ac18680266
Ref: c-api/number c PyNumber_Subtract18680608
Ref: 53c618680608
Ref: c-api/number c PyNumber_Multiply18680958
Ref: 53bf18680958
Ref: c-api/number c PyNumber_MatrixMultiply18681305
Ref: 126718681305
Ref: c-api/number c PyNumber_FloorDivide18681729
Ref: 53b018681729
Ref: c-api/number c PyNumber_TrueDivide18682053
Ref: 53c718682053
Ref: c-api/number c PyNumber_Remainder18682672
Ref: 53c418682672
Ref: c-api/number c PyNumber_Divmod18683020
Ref: 53af18683020
Ref: c-api/number c PyNumber_Power18683378
Ref: 53c318683378
Ref: c-api/number c PyNumber_Negative18683989
Ref: 53c018683989
Ref: c-api/number c PyNumber_Positive18684290
Ref: 53c218684290
Ref: c-api/number c PyNumber_Absolute18684576
Ref: 53ab18684576
Ref: c-api/number c PyNumber_Invert18684876
Ref: 53bd18684876
Ref: c-api/number c PyNumber_Lshift18685203
Ref: 53be18685203
Ref: c-api/number c PyNumber_Rshift18685558
Ref: 53c518685558
Ref: c-api/number c PyNumber_And18685913
Ref: 53ad18685913
Ref: c-api/number c PyNumber_Xor18686279
Ref: 53c818686279
Ref: c-api/number c PyNumber_Or18686668
Ref: 53c118686668
Ref: c-api/number c PyNumber_InPlaceAdd18687029
Ref: 53b118687029
Ref: c-api/number c PyNumber_InPlaceSubtract18687474
Ref: 53ba18687474
Ref: c-api/number c PyNumber_InPlaceMultiply18687927
Ref: 53b518687927
Ref: c-api/number c PyNumber_InPlaceMatrixMultiply18688377
Ref: 126818688377
Ref: c-api/number c PyNumber_InPlaceFloorDivide18688906
Ref: 53b318688906
Ref: c-api/number c PyNumber_InPlaceTrueDivide18689366
Ref: 53bb18689366
Ref: c-api/number c PyNumber_InPlaceRemainder18690054
Ref: 53b818690054
Ref: c-api/number c PyNumber_InPlacePower18690507
Ref: 53b718690507
Ref: c-api/number c PyNumber_InPlaceLshift18691305
Ref: 53b418691305
Ref: c-api/number c PyNumber_InPlaceRshift18691763
Ref: 53b918691763
Ref: c-api/number c PyNumber_InPlaceAnd18692221
Ref: 53b218692221
Ref: c-api/number c PyNumber_InPlaceXor18692690
Ref: 53bc18692690
Ref: c-api/number c PyNumber_InPlaceOr18693181
Ref: 53b618693181
Ref: c-api/number c PyNumber_Long18693645
Ref: e3018693645
Ref: c-api/number c PyNumber_Float18693960
Ref: e3118693960
Ref: c-api/number c PyNumber_Index18694289
Ref: c6d18694289
Ref: c-api/number c PyNumber_ToBase18694826
Ref: 1d8f18694826
Ref: c-api/number c PyNumber_AsSsize_t18695473
Ref: 53ae18695473
Ref: c-api/number c PyIndex_Check18696320
Ref: d5618696320
Node: シーケンス型プロトコル sequence protocol18696721
Ref: c-api/sequence doc18696967
Ref: 561618696967
Ref: c-api/sequence sequence18696967
Ref: 561718696967
Ref: c-api/sequence sequence-protocol18696967
Ref: 561818696967
Ref: c-api/sequence translation-repo18696967
Ref: 561918696967
Ref: c-api/sequence c PySequence_Check18697077
Ref: 53e618697077
Ref: c-api/sequence c PySequence_Size18697543
Ref: 203f18697543
Ref: c-api/sequence c PySequence_Length18697613
Ref: 53ee18697613
Ref: c-api/sequence c PySequence_Concat18697935
Ref: 53e718697935
Ref: c-api/sequence c PySequence_Repeat18698286
Ref: 53f018698286
Ref: c-api/sequence c PySequence_InPlaceConcat18698651
Ref: 53eb18698651
Ref: c-api/sequence c PySequence_InPlaceRepeat18699105
Ref: 53ec18699105
Ref: c-api/sequence c PySequence_GetItem18699572
Ref: 204018699572
Ref: c-api/sequence c PySequence_GetSlice18699908
Ref: 53ea18699908
Ref: c-api/sequence c PySequence_SetItem18700289
Ref: 204118700289
Ref: c-api/sequence c PySequence_DelItem18700923
Ref: 204218700923
Ref: c-api/sequence c PySequence_SetSlice18701195
Ref: 53f118701195
Ref: c-api/sequence c PySequence_DelSlice18701501
Ref: 53e918701501
Ref: c-api/sequence c PySequence_Count18701862
Ref: 53e818701862
Ref: c-api/sequence c PySequence_Contains18702249
Ref: 60c18702249
Ref: c-api/sequence c PySequence_In18702683
Ref: 60b18702683
Ref: c-api/sequence c PySequence_Index18702967
Ref: 53ed18702967
Ref: c-api/sequence c PySequence_List18703330
Ref: 53ef18703330
Ref: c-api/sequence c PySequence_Tuple18703809
Ref: 53f218703809
Ref: c-api/sequence c PySequence_Fast18704357
Ref: 1ae518704357
Ref: c-api/sequence c PySequence_Fast_GET_SIZE18705316
Ref: 5fd18705316
Ref: c-api/sequence c PySequence_Fast_GET_ITEM18705825
Ref: 5fe18705825
Ref: c-api/sequence c PySequence_Fast_ITEMS18706199
Ref: 5ff18706199
Ref: c-api/sequence c PySequence_ITEM18706829
Ref: 561a18706829
Node: マップ型プロトコル mapping protocol18707248
Ref: c-api/mapping doc18707502
Ref: 561b18707502
Ref: c-api/mapping mapping18707502
Ref: 561c18707502
Ref: c-api/mapping mapping-protocol18707502
Ref: 561d18707502
Ref: c-api/mapping translation-repo18707502
Ref: 561e18707502
Ref: c-api/mapping c PyMapping_Check18707727
Ref: 539218707727
Ref: c-api/mapping c PyMapping_Size18708166
Ref: 204318708166
Ref: c-api/mapping c PyMapping_Length18708235
Ref: 539318708235
Ref: c-api/mapping c PyMapping_GetItemString18708548
Ref: 7e918708548
Ref: c-api/mapping c PyMapping_GetOptionalItem18708907
Ref: 7e618708907
Ref: c-api/mapping c PyMapping_GetOptionalItemString18709601
Ref: 7e718709601
Ref: c-api/mapping c PyMapping_SetItemString18710008
Ref: 539418710008
Ref: c-api/mapping c PyMapping_DelItem18710327
Ref: 561f18710327
Ref: c-api/mapping c PyMapping_DelItemString18710454
Ref: 562018710454
Ref: c-api/mapping c PyMapping_HasKeyWithError18710704
Ref: 81918710704
Ref: c-api/mapping c PyMapping_HasKeyStringWithError18711075
Ref: 81b18711075
Ref: c-api/mapping c PyMapping_HasKey18711461
Ref: 81a18711461
Ref: c-api/mapping c PyMapping_HasKeyString18712160
Ref: 81c18712160
Ref: c-api/mapping c PyMapping_Keys18712849
Ref: f7e18712849
Ref: c-api/mapping c PyMapping_Values18713267
Ref: f7f18713267
Ref: c-api/mapping c PyMapping_Items18713684
Ref: f8018713684
Node: イテレータプロトコル iterator protocol18714176
Ref: c-api/iter doc18714422
Ref: 562118714422
Ref: c-api/iter iterator18714422
Ref: 562218714422
Ref: c-api/iter iterator-protocol18714422
Ref: 562318714422
Ref: c-api/iter translation-repo18714422
Ref: 562418714422
Ref: c-api/iter c PyIter_Check18714601
Ref: 1ec718714601
Ref: c-api/iter c PyAIter_Check18714889
Ref: 529718714889
Ref: c-api/iter c PyIter_NextItem18715192
Ref: 5cc18715192
Ref: c-api/iter c PyIter_Next18715665
Ref: 5cd18715665
Ref: c-api/iter c PySendResult18716321
Ref: 562518716321
Ref: c-api/iter c PyIter_Send18716483
Ref: c7218716483
Node: バッファプロトコル buffer Protocol18717086
Ref: c-api/buffer doc18717279
Ref: 562618717279
Ref: c-api/buffer buffer-protocol18717279
Ref: 562718717279
Ref: c-api/buffer bufferobjects18717279
Ref: 31918717279
Ref: c-api/buffer translation-repo18717279
Ref: 562818717279
Node: buffer 構造体18720981
Ref: c-api/buffer buffer-structure18721125
Ref: 562918721125
Ref: c-api/buffer id118721125
Ref: 562a18721125
Ref: c-api/buffer c Py_buffer18722560
Ref: b3f18722560
Ref: c-api/buffer c Py_buffer buf18722721
Ref: 562c18722721
Ref: c-api/buffer c Py_buffer obj18723254
Ref: 562e18723254
Ref: c-api/buffer c Py_buffer len18724084
Ref: 562f18724084
Ref: c-api/buffer c Py_buffer readonly18724806
Ref: 563018724806
Ref: c-api/buffer c Py_buffer itemsize18725019
Ref: 563118725019
Ref: c-api/buffer c Py_buffer format18726128
Ref: 563218726128
Ref: c-api/buffer c Py_buffer ndim18726493
Ref: 563418726493
Ref: c-api/buffer c Py_buffer shape18726929
Ref: 563318726929
Ref: c-api/buffer c Py_buffer strides18727576
Ref: 562d18727576
Ref: c-api/buffer c Py_buffer suboffsets18728284
Ref: 563518728284
Ref: c-api/buffer c Py_buffer internal18729465
Ref: 563718729465
Ref: c-api/buffer c PyBUF_MAX_NDIM18730043
Ref: 52a118730043
Node: バッファリクエストのタイプ18730397
Ref: c-api/buffer buffer-request-types18730565
Ref: 13f418730565
Ref: c-api/buffer id218730565
Ref: 563818730565
Node: リクエストに依存しないフィールド18731362
Ref: c-api/buffer request-independent-fields18731510
Ref: 563918731510
Node: readonly format18731809
Ref: c-api/buffer readonly-format18731990
Ref: 563a18731990
Ref: c-api/buffer c PyBUF_WRITABLE18732041
Ref: 176e18732041
Ref: c-api/buffer c PyBUF_WRITEABLE18732608
Ref: 563b18732608
Ref: c-api/buffer c PyBUF_FORMAT18732768
Ref: 529d18732768
Node: shape strides suboffsets18733749
Ref: c-api/buffer shape-strides-suboffsets18733909
Ref: 563c18733909
Ref: c-api/buffer c PyBUF_INDIRECT18734546
Ref: 52a018734546
Ref: c-api/buffer c PyBUF_STRIDES18734759
Ref: 52a818734759
Ref: c-api/buffer c PyBUF_ND18734957
Ref: 52a218734957
Ref: c-api/buffer c PyBUF_SIMPLE18735164
Ref: 52a518735164
Node: 隣接性のリクエスト18735335
Ref: c-api/buffer contiguity-requests18735501
Ref: 563d18735501
Ref: c-api/buffer c PyBUF_C_CONTIGUOUS18736221
Ref: 176f18736221
Ref: c-api/buffer c PyBUF_F_CONTIGUOUS18736467
Ref: 177018736467
Ref: c-api/buffer c PyBUF_ANY_CONTIGUOUS18736715
Ref: 529a18736715
Node: 複合リクエスト18737097
Ref: c-api/buffer compound-requests18737230
Ref: 563e18737230
Ref: c-api/buffer c PyBUF_FULL18738262
Ref: 529e18738262
Ref: c-api/buffer c PyBUF_FULL_RO18738566
Ref: 529f18738566
Ref: c-api/buffer c PyBUF_RECORDS18738868
Ref: 52a318738868
Ref: c-api/buffer c PyBUF_RECORDS_RO18739167
Ref: 52a418739167
Ref: c-api/buffer c PyBUF_STRIDED18739461
Ref: 52a618739461
Ref: c-api/buffer c PyBUF_STRIDED_RO18739761
Ref: 52a718739761
Ref: c-api/buffer c PyBUF_CONTIG18740055
Ref: 529b18740055
Ref: c-api/buffer c PyBUF_CONTIG_RO18740355
Ref: 529c18740355
Node: 複雑な配列18740618
Ref: c-api/buffer complex-arrays18740797
Ref: 563618740797
Node: NumPy スタイル shape strides18741014
Ref: c-api/buffer numpy-style-shape-and-strides18741148
Ref: 563f18741148
Node: PIL スタイル shape strides suboffsets18743237
Ref: c-api/buffer pil-style-shape-strides-and-suboffsets18743371
Ref: 564018743371
Node: バッファ関連の関数18744672
Ref: c-api/buffer buffer-related-functions18744803
Ref: 564118744803
Ref: c-api/buffer c PyObject_CheckBuffer18744869
Ref: 83118744869
Ref: c-api/buffer c PyObject_GetBuffer18745339
Ref: 83218745339
Ref: c-api/buffer c PyBuffer_Release18746729
Ref: 83318746729
Ref: c-api/buffer c PyBuffer_SizeFromFormat18747310
Ref: b4118747310
Ref: c-api/buffer c PyBuffer_IsContiguous18747636
Ref: b4518747636
Ref: c-api/buffer c PyBuffer_GetPointer18748185
Ref: b4018748185
Ref: c-api/buffer c PyBuffer_FromContiguous18748601
Ref: b4318748601
Ref: c-api/buffer c PyBuffer_ToContiguous18749032
Ref: b4218749032
Ref: c-api/buffer c PyObject_CopyData18749650
Ref: b4418749650
Ref: c-api/buffer c PyBuffer_FillContiguousStrides18749998
Ref: b4618749998
Ref: c-api/buffer c PyBuffer_FillInfo18750479
Ref: b4718750479
Node: 具象オブジェクト concrete object レイヤ18751795
Ref: c-api/concrete doc18752033
Ref: 564218752033
Ref: c-api/concrete concrete18752033
Ref: 564318752033
Ref: c-api/concrete concrete-objects-layer18752033
Ref: 564418752033
Ref: c-api/concrete translation-repo18752033
Ref: 564518752033
Node: 基本オブジェクト fundamental object18753813
Ref: c-api/concrete fundamental18753994
Ref: 564718753994
Ref: c-api/concrete fundamental-objects18753994
Ref: 564818753994
Node: 型オブジェクト<2>18754322
Ref: c-api/type doc18754458
Ref: 564918754458
Ref: c-api/type type-objects18754458
Ref: 564a18754458
Ref: c-api/type typeobjects18754458
Ref: 564b18754458
Ref: c-api/type c PyTypeObject18754514
Ref: e6f18754514
Ref: c-api/type c PyType_Type18754751
Ref: 95d18754751
Ref: c-api/type c PyType_Check18755010
Ref: 1f9818755010
Ref: c-api/type c PyType_CheckExact18755257
Ref: 1f9918755257
Ref: c-api/type c PyType_ClearCache18755487
Ref: 542718755487
Ref: c-api/type c PyType_GetFlags18755700
Ref: 1f5018755700
Ref: c-api/type c PyType_GetDict18756272
Ref: 1cb018756272
Ref: c-api/type c PyType_Modified18757003
Ref: 1d9618757003
Ref: c-api/type c PyType_AddWatcher18757371
Ref: 96f18757371
Ref: c-api/type c PyType_ClearWatcher18757890
Ref: 564c18757890
Ref: c-api/type c PyType_Watch18758362
Ref: 97018758362
Ref: c-api/type c PyType_Unwatch18759264
Ref: 564d18759264
Ref: c-api/type c PyType_WatchCallback18759777
Ref: 193e18759777
Ref: c-api/type c PyType_HasFeature18760614
Ref: 1f4f18760614
Ref: c-api/type c PyType_FastSubclass18760810
Ref: 564e18760810
Ref: c-api/type c PyType_IS_GC18761299
Ref: 565018761299
Ref: c-api/type c PyType_IsSubtype18761491
Ref: 542918761491
Ref: c-api/type c PyType_GenericAlloc18761929
Ref: e3418761929
Ref: c-api/type c PyType_GenericNew18763164
Ref: 51f118763164
Ref: c-api/type c PyType_Ready18763549
Ref: b6318763549
Ref: c-api/type c PyType_GetName18764630
Ref: b3b18764630
Ref: c-api/type c PyType_GetQualName18764951
Ref: b3c18764951
Ref: c-api/type c PyType_GetFullyQualifiedName18765300
Ref: 81018765300
Ref: c-api/type c PyType_GetModuleName18765748
Ref: 81218765748
Ref: c-api/type c PyType_GetSlot18766058
Ref: c7618766058
Ref: c-api/type c PyType_GetModule18766824
Ref: d3b18766824
Ref: c-api/type c PyType_GetModuleState18768030
Ref: d3c18768030
Ref: c-api/type c PyType_GetModuleByToken18768642
Ref: 542818768642
Ref: c-api/type c PyType_GetModuleByDef18769424
Ref: 82d18769424
Ref: c-api/type c PyType_GetBaseByToken18770461
Ref: 5e418770461
Ref: c-api/type c PyUnstable_Type_AssignVersionTag18771300
Ref: 565418771300
Ref: c-api/type c PyType_SUPPORTS_WEAKREFS18771841
Ref: 565518771841
Node: Creating Heap-Allocated Types18772248
Ref: c-api/type creating-heap-allocated-types18772366
Ref: 565618772366
Ref: c-api/type creating-heap-types18772366
Ref: 557618772366
Ref: c-api/type c PyType_FromSlots18772511
Ref: 37e18772511
Ref: c-api/type c PyType_Freeze18774932
Ref: 5e318774932
Node: Type slot IDs18775506
Ref: c-api/type pyslot-type-slot-ids18775585
Ref: 557a18775585
Ref: c-api/type type-slot-ids18775585
Ref: 565718775585
Ref: c-api/type c Py_tp_name18778516
Ref: 38418778516
Ref: c-api/type c Py_tp_basicsize18779207
Ref: 38518779207
Ref: c-api/type c Py_tp_extra_basicsize18779853
Ref: 38618779853
Ref: c-api/type c Py_tp_itemsize18780990
Ref: 38718780990
Ref: c-api/type c Py_tp_flags18782373
Ref: 38818782373
Ref: c-api/type c Py_tp_metaclass18783058
Ref: 38918783058
Ref: c-api/type c Py_tp_module18783847
Ref: 38a18783847
Ref: c-api/type c Py_tp_token18784622
Ref: 5e518784622
Ref: c-api/type c Py_TP_USE_SPEC18785763
Ref: 548c18785763
Ref: c-api/type c Py_tp_slots18786156
Ref: 38218786156
Node: Soft-deprecated API18786450
Ref: c-api/type soft-deprecated-api18786568
Ref: 566318786568
Ref: c-api/type c PyType_FromMetaclass18786842
Ref: 39918786842
Ref: c-api/type c PyType_FromModuleAndSpec18788018
Ref: 39818788018
Ref: c-api/type c PyType_FromSpecWithBases18789158
Ref: 39718789158
Ref: c-api/type c PyType_FromSpec18790129
Ref: 39618790129
Ref: c-api/type c PyType_Spec18791023
Ref: 1cae18791023
Ref: c-api/type c PyType_Spec name18791473
Ref: 566018791473
Ref: c-api/type c PyType_Spec basicsize18791571
Ref: 1a418791571
Ref: c-api/type c PyType_Spec itemsize18791893
Ref: 566218791893
Ref: c-api/type c PyType_Spec flags18791991
Ref: 566418791991
Ref: c-api/type c PyType_Spec slots18792092
Ref: 566118792092
Ref: c-api/type c PyType_Slot18792371
Ref: 542a18792371
Ref: c-api/type c PyType_Slot slot18793491
Ref: 565118793491
Ref: c-api/type c PyType_Slot pfunc18793604
Ref: 566518793604
Node: None オブジェクト18793721
Ref: c-api/none doc18793857
Ref: 566618793857
Ref: c-api/none noneobject18793857
Ref: 566718793857
Ref: c-api/none the-none-object18793857
Ref: 566818793857
Ref: c-api/none translation-repo18793857
Ref: 566918793857
Ref: c-api/none c Py_None18794290
Ref: 561518794290
Ref: c-api/none c Py_RETURN_NONE18794600
Ref: 182b18794600
Node: 数値型オブジェクト numeric object18794695
Ref: c-api/concrete numeric-objects18794934
Ref: 566a18794934
Ref: c-api/concrete numericobjects18794934
Ref: 566b18794934
Node: 整数型オブジェクト integer object18795222
Ref: c-api/long doc18795378
Ref: 566c18795378
Ref: c-api/long integer-objects18795378
Ref: 566d18795378
Ref: c-api/long longobjects18795378
Ref: 566e18795378
Ref: c-api/long c PyLongObject18795824
Ref: 5d218795824
Ref: c-api/long c PyLong_Type18796038
Ref: 539018796038
Ref: c-api/long c PyLong_Check18796339
Ref: 566f18796339
Ref: c-api/long c PyLong_CheckExact18796555
Ref: 567018796555
Ref: c-api/long c PyLong_FromLong18796785
Ref: 1de918796785
Ref: c-api/long c PyLong_FromUnsignedLong18797330
Ref: 1afd18797330
Ref: c-api/long c PyLong_FromSsize_t18797676
Ref: 1ae118797676
Ref: c-api/long c PyLong_FromSize_t18798018
Ref: 1aff18798018
Ref: c-api/long c PyLong_FromLongLong18798345
Ref: 1dea18798345
Ref: c-api/long c PyLong_FromInt3218798673
Ref: 5d718798673
Ref: c-api/long c PyLong_FromInt6418798745
Ref: 5d818798745
Ref: c-api/long c PyLong_FromUnsignedLongLong18799068
Ref: 1afe18799068
Ref: c-api/long c PyLong_FromUInt3218799432
Ref: 5d918799432
Ref: c-api/long c PyLong_FromUInt6418799506
Ref: 5da18799506
Ref: c-api/long c PyLong_FromDouble18799836
Ref: d1218799836
Ref: c-api/long c PyLong_FromString18800156
Ref: 538d18800156
Ref: c-api/long c PyLong_FromUnicodeObject18801437
Ref: c9118801437
Ref: c-api/long c PyLong_FromVoidPtr18801688
Ref: 538e18801688
Ref: c-api/long c PyLong_FromNativeBytes18802015
Ref: 80318802015
Ref: c-api/long c PyLong_FromUnsignedNativeBytes18802775
Ref: 80418802775
Ref: c-api/long c PyLong_FromPid18803397
Ref: 567118803397
Ref: c-api/long c PyLong_AsLong18803704
Ref: 80118803704
Ref: c-api/long c PyLong_AS_LONG18804523
Ref: 567218804523
Ref: c-api/long c PyLong_AsInt18804810
Ref: 80018804810
Ref: c-api/long c PyLong_AsLongAndOverflow18805074
Ref: 161f18805074
Ref: c-api/long c PyLong_AsLongLong18806114
Ref: 538718806114
Ref: c-api/long c PyLong_AsLongLongAndOverflow18806952
Ref: 162018806952
Ref: c-api/long c PyLong_AsSsize_t18808036
Ref: 538918808036
Ref: c-api/long c PyLong_AsUnsignedLong18808633
Ref: 538a18808633
Ref: c-api/long c PyLong_AsSize_t18809224
Ref: 538818809224
Ref: c-api/long c PyLong_AsUnsignedLongLong18809793
Ref: 164e18809793
Ref: c-api/long c PyLong_AsUnsignedLongMask18810608
Ref: 538b18810608
Ref: c-api/long c PyLong_AsUnsignedLongLongMask18811497
Ref: 1fd918811497
Ref: c-api/long c PyLong_AsInt3218812421
Ref: 5d318812421
Ref: c-api/long c PyLong_AsInt6418812489
Ref: 5d418812489
Ref: c-api/long c PyLong_AsUInt3218813143
Ref: 5d518813143
Ref: c-api/long c PyLong_AsUInt6418813213
Ref: 5d618813213
Ref: c-api/long c PyLong_AsDouble18813948
Ref: 1ba618813948
Ref: c-api/long c PyLong_AsVoidPtr18814499
Ref: 538c18814499
Ref: c-api/long c PyLong_AsNativeBytes18815124
Ref: 80218815124
Ref: c-api/long c Py_ASNATIVEBYTES_DEFAULTS18819364
Ref: 547218819364
Ref: c-api/long c Py_ASNATIVEBYTES_BIG_ENDIAN18819536
Ref: 547118819536
Ref: c-api/long c Py_ASNATIVEBYTES_LITTLE_ENDIAN18819708
Ref: 547318819708
Ref: c-api/long c Py_ASNATIVEBYTES_NATIVE_ENDIAN18819877
Ref: 547418819877
Ref: c-api/long c Py_ASNATIVEBYTES_UNSIGNED_BUFFER18820015
Ref: 547618820015
Ref: c-api/long c Py_ASNATIVEBYTES_REJECT_NEGATIVE18820237
Ref: 547518820237
Ref: c-api/long c Py_ASNATIVEBYTES_ALLOW_INDEX18820488
Ref: 547018820488
Ref: c-api/long c PyLong_AsPid18822476
Ref: 1bf718822476
Ref: c-api/long c PyLong_GetSign18822807
Ref: 5ce18822807
Ref: c-api/long c PyLong_IsPositive18823226
Ref: 5cf18823226
Ref: c-api/long c PyLong_IsNegative18823565
Ref: 5d018823565
Ref: c-api/long c PyLong_IsZero18823904
Ref: 5d118823904
Ref: c-api/long c PyLong_GetInfo18824215
Ref: 538f18824215
Ref: c-api/long c PyUnstable_Long_IsCompact18824630
Ref: 98d18824630
Ref: c-api/long c PyUnstable_Long_CompactValue18825501
Ref: 98e18825501
Node: Export API18826100
Ref: c-api/long export-api18826214
Ref: 567318826214
Ref: c-api/long c PyLongLayout18826279
Ref: 199018826279
Ref: c-api/long c PyLongLayout bits_per_digit18826859
Ref: 567418826859
Ref: c-api/long c PyLongLayout digit_size18827033
Ref: 567518827033
Ref: c-api/long c PyLongLayout digits_order18827186
Ref: 567618827186
Ref: c-api/long c PyLongLayout digit_endianness18827379
Ref: 567718827379
Ref: c-api/long c PyLong_GetNativeLayout18827607
Ref: 5db18827607
Ref: c-api/long c PyLongExport18828158
Ref: 199118828158
Ref: c-api/long c PyLongExport value18828630
Ref: 567918828630
Ref: c-api/long c PyLongExport negative18828812
Ref: 567a18828812
Ref: c-api/long c PyLongExport ndigits18828990
Ref: 567b18828990
Ref: c-api/long c PyLongExport digits18829168
Ref: 567818829168
Ref: c-api/long c PyLong_Export18829286
Ref: 5dc18829286
Ref: c-api/long c PyLong_FreeExport18829979
Ref: 5dd18829979
Node: PyLongWriter API18830342
Ref: c-api/long pylongwriter-api18830479
Ref: 567c18830479
Ref: c-api/long c PyLongWriter18830625
Ref: 199218830625
Ref: c-api/long c PyLongWriter_Create18830948
Ref: 5de18830948
Ref: c-api/long c PyLongWriter_Finish18832154
Ref: 5df18832154
Ref: c-api/long c PyLongWriter_Discard18832765
Ref: 5e018832765
Node: Deprecated API18833147
Ref: c-api/long deprecated-api18833265
Ref: 567d18833265
Ref: c-api/long c PyLong_SHIFT18833753
Ref: 567e18833753
Ref: c-api/long c PyLong_BASE18833902
Ref: 1e1618833902
Ref: c-api/long c PyLong_MASK18834004
Ref: 567f18834004
Node: Boolean オブジェクト18834117
Ref: c-api/bool doc18834304
Ref: 568018834304
Ref: c-api/bool boolean-objects18834304
Ref: 568118834304
Ref: c-api/bool boolobjects18834304
Ref: 568218834304
Ref: c-api/bool translation-repo18834304
Ref: 568318834304
Ref: c-api/bool c PyBool_Type18834710
Ref: 52ab18834710
Ref: c-api/bool c PyBool_Check18835007
Ref: 568618835007
Ref: c-api/bool c Py_False18835177
Ref: 568418835177
Ref: c-api/bool c Py_True18835465
Ref: 568518835465
Ref: c-api/bool c Py_RETURN_FALSE18835749
Ref: 182d18835749
Ref: c-api/bool c Py_RETURN_TRUE18835846
Ref: 182c18835846
Ref: c-api/bool c PyBool_FromLong18835941
Ref: 52aa18835941
Node: Floating-Point Objects18836200
Ref: c-api/float doc18836372
Ref: 568718836372
Ref: c-api/float floating-point-objects18836372
Ref: 568818836372
Ref: c-api/float floatobjects18836372
Ref: 568918836372
Ref: c-api/float translation-repo18836372
Ref: 568a18836372
Ref: c-api/float c PyFloatObject18836437
Ref: 568b18836437
Ref: c-api/float c PyFloat_Type18836571
Ref: 536418836571
Ref: c-api/float c PyFloat_Check18836838
Ref: 568c18836838
Ref: c-api/float c PyFloat_CheckExact18837058
Ref: 568d18837058
Ref: c-api/float c PyFloat_FromString18837292
Ref: 536318837292
Ref: c-api/float c PyFloat_FromDouble18837606
Ref: 536218837606
Ref: c-api/float c PyFloat_AsDouble18837903
Ref: e3218837903
Ref: c-api/float c PyFloat_AS_DOUBLE18838599
Ref: 568e18838599
Ref: c-api/float c PyFloat_GetInfo18838789
Ref: 17a918838789
Ref: c-api/float c PyFloat_GetMax18839128
Ref: 17a718839128
Ref: c-api/float c PyFloat_GetMin18839318
Ref: 17a818839318
Ref: c-api/float c Py_INFINITY18839514
Ref: 568f18839514
Ref: c-api/float c Py_NAN18839812
Ref: 569018839812
Ref: c-api/float c Py_HUGE_VAL18840079
Ref: 569118840079
Ref: c-api/float c Py_MATH_E18840202
Ref: 569218840202
Ref: c-api/float c Py_MATH_El18840325
Ref: 569318840325
Ref: c-api/float c Py_MATH_PI18840511
Ref: 569418840511
Ref: c-api/float c Py_MATH_PIl18840636
Ref: 569518840636
Ref: c-api/float c Py_MATH_TAU18840829
Ref: 569618840829
Ref: c-api/float c Py_RETURN_NAN18840984
Ref: 569718840984
Ref: c-api/float c Py_RETURN_INF18841160
Ref: 569818841160
Ref: c-api/float c Py_IS_FINITE18841437
Ref: 569918841437
Ref: c-api/float c Py_IS_INFINITY18841736
Ref: 569a18841736
Ref: c-api/float c Py_IS_NAN18841986
Ref: 182e18841986
Node: Pack and Unpack functions18842268
Ref: c-api/float pack-and-unpack-functions18842352
Ref: 569b18842352
Node: Pack functions18843777
Ref: c-api/float pack-functions18843878
Ref: 569c18843878
Ref: c-api/float c PyFloat_Pack218844483
Ref: b4c18844483
Ref: c-api/float c PyFloat_Pack418844617
Ref: b4d18844617
Ref: c-api/float c PyFloat_Pack818844753
Ref: b4e18844753
Node: Unpack functions18844964
Ref: c-api/float unpack-functions18845065
Ref: 569d18845065
Ref: c-api/float c PyFloat_Unpack218845776
Ref: b4f18845776
Ref: c-api/float c PyFloat_Unpack418845913
Ref: b5018845913
Ref: c-api/float c PyFloat_Unpack818846052
Ref: b5118846052
Node: 複素数オブジェクト18846191
Ref: c-api/complex doc18846328
Ref: 569e18846328
Ref: c-api/complex complex-number-objects18846328
Ref: 569f18846328
Ref: c-api/complex complexobjects18846328
Ref: 56a018846328
Ref: c-api/complex translation-repo18846328
Ref: 56a118846328
Ref: c-api/complex c PyComplexObject18846396
Ref: 3c118846396
Ref: c-api/complex c PyComplexObject cval18846547
Ref: 3c018846547
Ref: c-api/complex c PyComplex_Type18846988
Ref: 52e218846988
Ref: c-api/complex c PyComplex_Check18847283
Ref: 56a218847283
Ref: c-api/complex c PyComplex_CheckExact18847508
Ref: 56a318847508
Ref: c-api/complex c PyComplex_FromDoubles18847747
Ref: 52e118847747
Ref: c-api/complex c PyComplex_RealAsDouble18848061
Ref: 1c3918848061
Ref: c-api/complex c PyComplex_ImagAsDouble18848792
Ref: 1c3a18848792
Ref: c-api/complex c Py_complex18849533
Ref: 3c418849533
Ref: c-api/complex c Py_complex real18849662
Ref: 56a418849662
Ref: c-api/complex c Py_complex imag18849705
Ref: 56a518849705
Ref: c-api/complex c PyComplex_FromCComplex18849890
Ref: 3c318849890
Ref: c-api/complex c PyComplex_AsCComplex18850157
Ref: 3c218850157
Node: C 構造体としての複素数18851067
Ref: c-api/complex complex-numbers-as-c-structures18851163
Ref: 56a618851163
Ref: c-api/complex c _Py_c_sum18851754
Ref: 3c518851754
Ref: c-api/complex c _Py_c_diff18851977
Ref: 3c618851977
Ref: c-api/complex c _Py_c_neg18852201
Ref: 3c718852201
Ref: c-api/complex c _Py_c_prod18852399
Ref: 3c818852399
Ref: c-api/complex c _Py_c_quot18852623
Ref: 3c918852623
Ref: c-api/complex c _Py_c_pow18852990
Ref: 3ca18852990
Ref: c-api/complex c _Py_c_abs18853429
Ref: 3cb18853429
Ref: C 構造体としての複素数-Footnote-118853671
Node: シーケンスオブジェクト sequence object18853686
Ref: c-api/concrete sequence-objects18853910
Ref: 56a718853910
Ref: c-api/concrete sequenceobjects18853910
Ref: 56a818853910
Node: バイトオブジェクト<2>18854626
Ref: c-api/bytes doc18854764
Ref: 56a918854764
Ref: c-api/bytes bytes-objects18854764
Ref: 56aa18854764
Ref: c-api/bytes bytesobjects18854764
Ref: 56ab18854764
Ref: c-api/bytes c PyBytesObject18855043
Ref: b7618855043
Ref: c-api/bytes c PyBytes_Type18855203
Ref: 52bc18855203
Ref: c-api/bytes c PyBytes_Check18855487
Ref: 175818855487
Ref: c-api/bytes c PyBytes_CheckExact18855731
Ref: 56ac18855731
Ref: c-api/bytes c PyBytes_FromString18855983
Ref: 52b918855983
Ref: c-api/bytes c PyBytes_FromStringAndSize18856449
Ref: 3ba18856449
Ref: c-api/bytes c PyBytes_FromFormat18857130
Ref: 201918857130
Ref: c-api/bytes c PyBytes_FromFormatV18860987
Ref: 52b718860987
Ref: c-api/bytes c PyBytes_FromObject18861335
Ref: 52b818861335
Ref: c-api/bytes c PyBytes_Size18861844
Ref: 52bb18861844
Ref: c-api/bytes c PyBytes_GET_SIZE18862091
Ref: 56ad18862091
Ref: c-api/bytes c PyBytes_AsString18862307
Ref: c6118862307
Ref: c-api/bytes c PyBytes_AS_STRING18863215
Ref: 56ae18863215
Ref: c-api/bytes c PyBytes_AsStringAndSize18863491
Ref: 52b318863491
Ref: c-api/bytes c PyBytes_Concat18864949
Ref: 52b418864949
Ref: c-api/bytes c PyBytes_ConcatAndDel18865779
Ref: 52b518865779
Ref: c-api/bytes c PyBytes_Join18866387
Ref: 5b718866387
Ref: c-api/bytes c _PyBytes_Resize18867285
Ref: 3bb18867285
Ref: c-api/bytes c PyBytes_Repr18868219
Ref: 52ba18868219
Ref: c-api/bytes c PyBytes_DecodeEscape18869208
Ref: 52b618869208
Ref: バイトオブジェクト<2>-Footnote-118870092
Ref: バイトオブジェクト<2>-Footnote-218870212
Ref: バイトオブジェクト<2>-Footnote-318870332
Ref: バイトオブジェクト<2>-Footnote-418870452
Ref: バイトオブジェクト<2>-Footnote-518870572
Ref: バイトオブジェクト<2>-Footnote-618870692
Ref: バイトオブジェクト<2>-Footnote-718870812
Ref: バイトオブジェクト<2>-Footnote-818870932
Node: PyBytesWriter18871052
Ref: c-api/bytes id1018871230
Ref: 56af18871230
Ref: c-api/bytes pybyteswriter18871230
Ref: 36318871230
Ref: c-api/bytes c PyBytesWriter18871393
Ref: 3bc18871393
Node: Create Finish Discard18871827
Ref: c-api/bytes create-finish-discard18871922
Ref: 56b018871922
Ref: c-api/bytes c PyBytesWriter_Create18871989
Ref: 36418871989
Ref: c-api/bytes c PyBytesWriter_Finish18872482
Ref: 36818872482
Ref: c-api/bytes c PyBytesWriter_FinishWithSize18872937
Ref: 36718872937
Ref: c-api/bytes c PyBytesWriter_FinishWithPointer18873198
Ref: 36618873198
Ref: c-api/bytes c PyBytesWriter_Discard18873735
Ref: 36518873735
Node: 高レベルAPI18874077
Ref: c-api/bytes high-level-api18874188
Ref: 56b118874188
Ref: c-api/bytes c PyBytesWriter_WriteBytes18874235
Ref: 36f18874235
Ref: c-api/bytes c PyBytesWriter_Format18874689
Ref: 36918874689
Node: Getters18875080
Ref: c-api/bytes getters18875185
Ref: 56b218875185
Ref: c-api/bytes c PyBytesWriter_GetSize18875220
Ref: 36b18875220
Ref: c-api/bytes c PyBytesWriter_GetData18875376
Ref: 36a18875376
Node: 低レベルAPI18875670
Ref: c-api/bytes low-level-api18875751
Ref: 56b318875751
Ref: c-api/bytes c PyBytesWriter_Resize18875798
Ref: 36e18875798
Ref: c-api/bytes c PyBytesWriter_Grow18876276
Ref: 36d18876276
Ref: c-api/bytes c PyBytesWriter_GrowAndUpdatePointer18876746
Ref: 36c18876746
Node: bytearray オブジェクト<2>18877471
Ref: c-api/bytearray doc18877654
Ref: 56b418877654
Ref: c-api/bytearray byte-array-objects18877654
Ref: 56b518877654
Ref: c-api/bytearray bytearrayobjects18877654
Ref: 56b618877654
Ref: c-api/bytearray translation-repo18877654
Ref: 56b718877654
Ref: c-api/bytearray c PyByteArrayObject18877725
Ref: 56b818877725
Ref: c-api/bytearray c PyByteArray_Type18877892
Ref: 52b118877892
Node: 型チェックマクロ18878277
Ref: c-api/bytearray type-check-macros18878404
Ref: 56b918878404
Ref: c-api/bytearray c PyByteArray_Check18878465
Ref: 56ba18878465
Ref: c-api/bytearray c PyByteArray_CheckExact18878727
Ref: 56bb18878727
Node: ダイレクト API 関数18878997
Ref: c-api/bytearray direct-api-functions18879142
Ref: 56bc18879142
Ref: c-api/bytearray c PyByteArray_FromObject18879208
Ref: 176118879208
Ref: c-api/bytearray c PyByteArray_FromStringAndSize18879832
Ref: 176218879832
Ref: c-api/bytearray c PyByteArray_Concat18880205
Ref: 52ae18880205
Ref: c-api/bytearray c PyByteArray_Size18880789
Ref: 52b018880789
Ref: c-api/bytearray c PyByteArray_AsString18881068
Ref: 52ad18881068
Ref: c-api/bytearray c PyByteArray_Resize18881617
Ref: 52af18881617
Node: マクロ18881992
Ref: c-api/bytearray macros18882104
Ref: 56bd18882104
Ref: c-api/bytearray c PyByteArray_AS_STRING18882289
Ref: 56be18882289
Ref: c-api/bytearray c PyByteArray_GET_SIZE18882702
Ref: 56bf18882702
Node: Unicode オブジェクトと codec18882944
Ref: c-api/unicode doc18883154
Ref: 155e18883154
Ref: c-api/unicode translation-repo18883154
Ref: 56c018883154
Ref: c-api/unicode unicode-objects-and-codecs18883154
Ref: 56c118883154
Ref: c-api/unicode unicodeobjects18883154
Ref: 56c218883154
Node: Unicode オブジェクト18883526
Ref: c-api/unicode unicode-objects18883666
Ref: 56c318883666
Ref: Unicode オブジェクト-Footnote-118884719
Ref: Unicode オブジェクト-Footnote-218884761
Node: Unicode 型18884803
Ref: c-api/unicode unicode-type18884915
Ref: 56c418884915
Ref: c-api/unicode c PyUnicode_Type18885064
Ref: 546918885064
Ref: c-api/unicode c PyUnicodeIter_Type18885308
Ref: 543a18885308
Ref: c-api/unicode c Py_UCS418885568
Ref: 30d18885568
Ref: c-api/unicode c Py_UCS218885604
Ref: 153218885604
Ref: c-api/unicode c Py_UCS118885640
Ref: 153118885640
Ref: c-api/unicode c PyASCIIObject18886043
Ref: 153318886043
Ref: c-api/unicode c PyCompactUnicodeObject18886085
Ref: 153418886085
Ref: c-api/unicode c PyUnicodeObject18886136
Ref: b7818886136
Ref: c-api/unicode c PyUnicode_IS_COMPACT18886786
Ref: 56c518886786
Ref: c-api/unicode c PyUnicode_IS_COMPACT_ASCII18886959
Ref: 56c618886959
Ref: c-api/unicode c PyUnicode_Check18887255
Ref: 56c718887255
Ref: c-api/unicode c PyUnicode_CheckExact18887509
Ref: 56c818887509
Ref: c-api/unicode c PyUnicode_GET_LENGTH18887756
Ref: c8b18887756
Ref: c-api/unicode c PyUnicode_1BYTE_DATA18888107
Ref: 153818888107
Ref: c-api/unicode c PyUnicode_2BYTE_DATA18888197
Ref: 153918888197
Ref: c-api/unicode c PyUnicode_4BYTE_DATA18888287
Ref: 153a18888287
Ref: c-api/unicode c PyUnicode_1BYTE_KIND18888789
Ref: 153c18888789
Ref: c-api/unicode c PyUnicode_2BYTE_KIND18888830
Ref: 153d18888830
Ref: c-api/unicode c PyUnicode_4BYTE_KIND18888871
Ref: 153e18888871
Ref: c-api/unicode c PyUnicode_KIND18889101
Ref: 153b18889101
Ref: c-api/unicode c PyUnicode_DATA18889543
Ref: 153718889543
Ref: c-api/unicode c PyUnicode_WRITE18889859
Ref: 154118889859
Ref: c-api/unicode c PyUnicode_READ18890518
Ref: 153f18890518
Ref: c-api/unicode c PyUnicode_READ_CHAR18890897
Ref: 154018890897
Ref: c-api/unicode c PyUnicode_MAX_CHAR_VALUE18891350
Ref: 154218891350
Ref: c-api/unicode c PyUnicode_IsIdentifier18891797
Ref: 1f9718891797
Ref: c-api/unicode c PyUnicode_IS_ASCII18892259
Ref: 56c918892259
Ref: c-api/unicode c PyUnstable_Unicode_GET_CACHED_HASH18892466
Ref: 35f18892466
Node: Unicode 文字プロパティ18893360
Ref: c-api/unicode unicode-character-properties18893522
Ref: 56ca18893522
Ref: c-api/unicode c Py_UNICODE_ISSPACE18893899
Ref: 1eda18893899
Ref: c-api/unicode c Py_UNICODE_ISLOWER18894049
Ref: 56cb18894049
Ref: c-api/unicode c Py_UNICODE_ISUPPER18894196
Ref: 56cc18894196
Ref: c-api/unicode c Py_UNICODE_ISTITLE18894343
Ref: 56cd18894343
Ref: c-api/unicode c Py_UNICODE_ISLINEBREAK18894536
Ref: 56ce18894536
Ref: c-api/unicode c Py_UNICODE_ISDECIMAL18894690
Ref: 56cf18894690
Ref: c-api/unicode c Py_UNICODE_ISDIGIT18894845
Ref: 56d018894845
Ref: c-api/unicode c Py_UNICODE_ISNUMERIC18894996
Ref: 56d118894996
Ref: c-api/unicode c Py_UNICODE_ISALPHA18895165
Ref: 56d218895165
Ref: c-api/unicode c Py_UNICODE_ISALNUM18895336
Ref: 56d318895336
Ref: c-api/unicode c Py_UNICODE_ISPRINTABLE18895486
Ref: 56d418895486
Ref: c-api/unicode c Py_UNICODE_TOLOWER18895763
Ref: 56d518895763
Ref: c-api/unicode c Py_UNICODE_TOUPPER18895896
Ref: 56d618895896
Ref: c-api/unicode c Py_UNICODE_TOTITLE18896029
Ref: 56d718896029
Ref: c-api/unicode c Py_UNICODE_TODECIMAL18896180
Ref: 56d818896180
Ref: c-api/unicode c Py_UNICODE_TODIGIT18896402
Ref: 56d918896402
Ref: c-api/unicode c Py_UNICODE_TONUMERIC18896618
Ref: 56da18896618
Ref: c-api/unicode c Py_UNICODE_IS_SURROGATE18896894
Ref: 56db18896894
Ref: c-api/unicode c Py_UNICODE_IS_HIGH_SURROGATE18897060
Ref: 56dc18897060
Ref: c-api/unicode c Py_UNICODE_IS_LOW_SURROGATE18897237
Ref: 56dd18897237
Ref: c-api/unicode c Py_UNICODE_HIGH_SURROGATE18897413
Ref: 56de18897413
Ref: c-api/unicode c Py_UNICODE_LOW_SURROGATE18897630
Ref: 56df18897630
Ref: c-api/unicode c Py_UNICODE_JOIN_SURROGATES18897845
Ref: 56e018897845
Node: Unicode 文字列の生成とアクセス18898251
Ref: c-api/unicode creating-and-accessing-unicode-strings18898438
Ref: 56e118898438
Ref: c-api/unicode c PyUnicode_New18898725
Ref: c8318898725
Ref: c-api/unicode c PyUnicode_FromKindAndData18900209
Ref: 153518900209
Ref: c-api/unicode c PyUnicode_FromStringAndSize18901130
Ref: 546118901130
Ref: c-api/unicode c PyUnicode_FromString18901814
Ref: 546018901814
Ref: c-api/unicode c PyUnicode_FromFormat18902120
Ref: 82418902120
Ref: c-api/unicode c PyUnicode_FromFormatV18915082
Ref: 97e18915082
Ref: c-api/unicode c PyUnicode_FromObject18915396
Ref: 545e18915396
Ref: c-api/unicode c PyUnicode_FromOrdinal18915899
Ref: 545f18915899
Ref: c-api/unicode c PyUnicode_FromEncodedObject18916252
Ref: 545d18916252
Ref: c-api/unicode c PyUnicode_Append18917415
Ref: 544218917415
Ref: c-api/unicode c PyUnicode_AppendAndDel18917885
Ref: 544318917885
Ref: c-api/unicode c PyUnicode_BuildEncodingMap18918188
Ref: 1c8718918188
Ref: c-api/unicode c PyUnicode_GetDefaultEncoding18918763
Ref: 546218918763
Ref: c-api/unicode c PyUnicode_GetLength18919096
Ref: c8a18919096
Ref: c-api/unicode c PyUnicode_CopyCharacters18919433
Ref: c8c18919433
Ref: c-api/unicode c PyUnicode_Resize18920101
Ref: 546418920101
Ref: c-api/unicode c PyUnicode_Fill18920790
Ref: 154b18920790
Ref: c-api/unicode c PyUnicode_WriteChar18921452
Ref: 153018921452
Ref: c-api/unicode c PyUnicode_ReadChar18922197
Ref: 152f18922197
Ref: c-api/unicode c PyUnicode_Substring18922796
Ref: c8d18922796
Ref: c-api/unicode c PyUnicode_AsUCS418923279
Ref: 153618923279
Ref: c-api/unicode c PyUnicode_AsUCS4Copy18923828
Ref: c9218923828
Node: ロケールエンコーディング18924384
Ref: c-api/unicode locale-encoding18924590
Ref: 56e318924590
Ref: c-api/unicode c PyUnicode_DecodeLocaleAndSize18924817
Ref: f8b18924817
Ref: c-api/unicode c PyUnicode_DecodeLocale18926157
Ref: 544f18926157
Ref: c-api/unicode c PyUnicode_EncodeLocale18926532
Ref: f8c18926532
Ref: ロケールエンコーディング-Footnote-118927885
Ref: ロケールエンコーディング-Footnote-218927927
Node: ファイルシステムエンコーディング18927969
Ref: c-api/unicode file-system-encoding18928154
Ref: 56e418928154
Ref: c-api/unicode c PyUnicode_FSConverter18928557
Ref: 10d718928557
Ref: c-api/unicode c PyUnicode_FSDecoder18929866
Ref: 98018929866
Ref: c-api/unicode c PyUnicode_DecodeFSDefaultAndSize18931014
Ref: 544d18931014
Ref: c-api/unicode c PyUnicode_DecodeFSDefault18931588
Ref: 1cad18931588
Ref: c-api/unicode c PyUnicode_EncodeFSDefault18932055
Ref: 203d18932055
Ref: ファイルシステムエンコーディング-Footnote-118932770
Ref: ファイルシステムエンコーディング-Footnote-218932812
Node: wchar_t サポート18932854
Ref: c-api/unicode wchar-t-support18932994
Ref: 56e518932994
Ref: c-api/unicode c PyUnicode_FromWideChar18933142
Ref: 154a18933142
Ref: c-api/unicode c PyUnicode_AsWideChar18933583
Ref: 204418933583
Ref: c-api/unicode c PyUnicode_AsWideCharString18934586
Ref: c9318934586
Node: 組み込み codec built-in codec18935743
Ref: c-api/unicode built-in-codecs18935945
Ref: 56e618935945
Ref: c-api/unicode builtincodecs18935945
Ref: 56e218935945
Node: 汎用 codec18937588
Ref: c-api/unicode generic-codecs18937691
Ref: 56e718937691
Ref: c-api/unicode c Py_UNICODE_REPLACEMENT_CHARACTER18937770
Ref: 56e818937770
Ref: c-api/unicode c PyUnicode_Decode18938063
Ref: 1fd618938063
Ref: c-api/unicode c PyUnicode_AsEncodedString18938646
Ref: 544518938646
Node: UTF-8 Codecs18939340
Ref: c-api/unicode utf-8-codecs18939465
Ref: 56e918939465
Ref: c-api/unicode c PyUnicode_DecodeUTF818939550
Ref: 545918939550
Ref: c-api/unicode c PyUnicode_DecodeUTF8Stateful18939971
Ref: 1d3418939971
Ref: c-api/unicode c PyUnicode_AsUTF8String18940601
Ref: 154c18940601
Ref: c-api/unicode c PyUnicode_AsUTF8AndSize18941141
Ref: c7318941141
Ref: c-api/unicode c PyUnicode_AsUTF818942643
Ref: 63e18942643
Ref: UTF-8 Codecs-Footnote-118943446
Node: UTF-32 Codecs18943499
Ref: c-api/unicode utf-32-codecs18943625
Ref: 56ea18943625
Ref: c-api/unicode c PyUnicode_DecodeUTF3218943710
Ref: 545518943710
Ref: c-api/unicode c PyUnicode_DecodeUTF32Stateful18945202
Ref: 545618945202
Ref: c-api/unicode c PyUnicode_AsUTF32String18945977
Ref: 544718945977
Node: UTF-16 Codecs18946474
Ref: c-api/unicode utf-16-codecs18946600
Ref: 56eb18946600
Ref: c-api/unicode c PyUnicode_DecodeUTF1618946688
Ref: 545318946688
Ref: c-api/unicode c PyUnicode_DecodeUTF16Stateful18948300
Ref: 545418948300
Ref: c-api/unicode c PyUnicode_AsUTF16String18949065
Ref: 544618949065
Node: UTF-7 Codecs18949562
Ref: c-api/unicode utf-7-codecs18949696
Ref: 56ec18949696
Ref: c-api/unicode c PyUnicode_DecodeUTF718949782
Ref: 545718949782
Ref: c-api/unicode c PyUnicode_DecodeUTF7Stateful18950149
Ref: 545818950149
Node: Unicode-Escape Codecs18950775
Ref: c-api/unicode unicode-escape-codecs18950921
Ref: 56ed18950921
Ref: c-api/unicode c PyUnicode_DecodeUnicodeEscape18951036
Ref: 545a18951036
Ref: c-api/unicode c PyUnicode_AsUnicodeEscapeString18951421
Ref: 154d18951421
Node: Raw-Unicode-Escape Codecs18951865
Ref: c-api/unicode raw-unicode-escape-codecs18952013
Ref: 56ee18952013
Ref: c-api/unicode c PyUnicode_DecodeRawUnicodeEscape18952139
Ref: 545218952139
Ref: c-api/unicode c PyUnicode_AsRawUnicodeEscapeString18952531
Ref: 154e18952531
Node: Latin-1 Codecs18952983
Ref: c-api/unicode latin-1-codecs18953122
Ref: 56ef18953122
Ref: c-api/unicode c PyUnicode_DecodeLatin118953344
Ref: 544e18953344
Ref: c-api/unicode c PyUnicode_AsLatin1String18953768
Ref: 154f18953768
Node: ASCII Codecs18954200
Ref: c-api/unicode ascii-codecs18954334
Ref: 56f018954334
Ref: c-api/unicode c PyUnicode_DecodeASCII18954531
Ref: 544a18954531
Ref: c-api/unicode c PyUnicode_AsASCIIString18954899
Ref: 155018954899
Node: Character Map Codecs18955329
Ref: c-api/unicode character-map-codecs18955474
Ref: 56f118955474
Ref: c-api/unicode c PyUnicode_DecodeCharmap18956144
Ref: 544b18956144
Ref: c-api/unicode c PyUnicode_AsCharmapString18957136
Ref: 544418957136
Ref: c-api/unicode c PyUnicode_Translate18958040
Ref: 546818958040
Node: Windows 用の MBCS codec18959093
Ref: c-api/unicode mbcs-codecs-for-windows18959217
Ref: 56f218959217
Ref: c-api/unicode c PyUnicode_DecodeMBCS18959826
Ref: 545018959826
Ref: c-api/unicode c PyUnicode_DecodeMBCSStateful18960234
Ref: 545118960234
Ref: c-api/unicode c PyUnicode_DecodeCodePageStateful18960907
Ref: 544c18960907
Ref: c-api/unicode c PyUnicode_AsMBCSString18961338
Ref: 155118961338
Ref: c-api/unicode c PyUnicode_EncodeCodePage18961819
Ref: 155218961819
Node: メソッドおよびスロット関数 slot function18962324
Ref: c-api/unicode methods-and-slot-functions18962515
Ref: 56f318962515
Ref: c-api/unicode unicodemethodsandslots18962515
Ref: 56f418962515
Ref: c-api/unicode c PyUnicode_Concat18962993
Ref: 155f18962993
Ref: c-api/unicode c PyUnicode_Split18963268
Ref: 546618963268
Ref: c-api/unicode c PyUnicode_RSplit18964068
Ref: 1ada18964068
Ref: c-api/unicode c PyUnicode_Splitlines18964491
Ref: 546718964491
Ref: c-api/unicode c PyUnicode_Partition18964912
Ref: 1adb18964912
Ref: c-api/unicode c PyUnicode_RPartition18965547
Ref: 1adc18965547
Ref: c-api/unicode c PyUnicode_Join18966109
Ref: 156018966109
Ref: c-api/unicode c PyUnicode_Tailmatch18966445
Ref: c8f18966445
Ref: c-api/unicode c PyUnicode_Find18966913
Ref: 545b18966913
Ref: c-api/unicode c PyUnicode_FindChar18967673
Ref: c9018967673
Ref: c-api/unicode c PyUnicode_Count18968608
Ref: 544918968608
Ref: c-api/unicode c PyUnicode_Replace18968976
Ref: 546318968976
Ref: c-api/unicode c PyUnicode_Compare18969491
Ref: c8e18969491
Ref: c-api/unicode c PyUnicode_Equal18970105
Ref: 5e618970105
Ref: c-api/unicode c PyUnicode_EqualToUTF8AndSize18970817
Ref: 81318970817
Ref: c-api/unicode c PyUnicode_EqualToUTF818971444
Ref: 81418971444
Ref: c-api/unicode c PyUnicode_CompareWithASCIIString18971846
Ref: 162118971846
Ref: c-api/unicode c PyUnicode_RichCompare18972532
Ref: 546518972532
Ref: c-api/unicode c PyUnicode_Format18973275
Ref: 545c18973275
Ref: c-api/unicode c PyUnicode_Contains18973639
Ref: 544818973639
Ref: c-api/unicode c PyUnicode_InternInPlace18974052
Ref: c8818974052
Ref: c-api/unicode c PyUnicode_InternFromString18975399
Ref: 3bd18975399
Ref: c-api/unicode c PyUnicode_CHECK_INTERNED18976251
Ref: 56f518976251
Node: PyUnicodeWriter18976763
Ref: c-api/unicode pyunicodewriter18976938
Ref: 56f618976938
Ref: c-api/unicode c PyUnicodeWriter18977107
Ref: 5e718977107
Ref: c-api/unicode c PyUnicodeWriter_Create18977330
Ref: 5e818977330
Ref: c-api/unicode c PyUnicodeWriter_Finish18977685
Ref: 5eb18977685
Ref: c-api/unicode c PyUnicodeWriter_Discard18977984
Ref: 5ea18977984
Ref: c-api/unicode c PyUnicodeWriter_WriteChar18978251
Ref: 5ee18978251
Ref: c-api/unicode c PyUnicodeWriter_WriteUTF818978525
Ref: 5f318978525
Ref: c-api/unicode c PyUnicodeWriter_WriteASCII18979052
Ref: 5ed18979052
Ref: c-api/unicode c PyUnicodeWriter_WriteWideChar18979589
Ref: 5f418979589
Ref: c-api/unicode c PyUnicodeWriter_WriteUCS418980012
Ref: 5f218980012
Ref: c-api/unicode c PyUnicodeWriter_WriteStr18980345
Ref: 5f018980345
Ref: c-api/unicode c PyUnicodeWriter_WriteRepr18980827
Ref: 5ef18980827
Ref: c-api/unicode c PyUnicodeWriter_WriteSubstring18981280
Ref: 5f118981280
Ref: c-api/unicode c PyUnicodeWriter_Format18981787
Ref: 5ec18981787
Ref: c-api/unicode c PyUnicodeWriter_DecodeUTF8Stateful18982112
Ref: 5e918982112
Node: Deprecated API<2>18983049
Ref: c-api/unicode deprecated-api18983162
Ref: 56f718983162
Ref: c-api/unicode c Py_UNICODE18983247
Ref: b7f18983247
Ref: c-api/unicode c PyUnicode_READY18983803
Ref: 64e18983803
Ref: c-api/unicode c PyUnicode_IS_READY18984234
Ref: 56f818984234
Node: タプルオブジェクト tuple object18984643
Ref: c-api/tuple doc18984856
Ref: 56f918984856
Ref: c-api/tuple translation-repo18984856
Ref: 56fa18984856
Ref: c-api/tuple tuple-objects18984856
Ref: 56fb18984856
Ref: c-api/tuple tupleobjects18984856
Ref: 56fc18984856
Ref: c-api/tuple c PyTupleObject18984954
Ref: 558f18984954
Ref: c-api/tuple c PyTuple_Type18985118
Ref: 542618985118
Ref: c-api/tuple c PyTuple_Check18985417
Ref: 56fd18985417
Ref: c-api/tuple c PyTuple_CheckExact18985646
Ref: 56fe18985646
Ref: c-api/tuple c PyTuple_New18985883
Ref: 83618985883
Ref: c-api/tuple c PyTuple_FromArray18986171
Ref: 37218986171
Ref: c-api/tuple c PyTuple_Pack18986587
Ref: 542418986587
Ref: c-api/tuple c PyTuple_Size18987069
Ref: 542518987069
Ref: c-api/tuple c PyTuple_GET_SIZE18987356
Ref: 56ff18987356
Ref: c-api/tuple c PyTuple_GetItem18987538
Ref: 51dd18987538
Ref: c-api/tuple c PyTuple_GET_ITEM18988359
Ref: 570018988359
Ref: c-api/tuple c PyTuple_GetSlice18988723
Ref: 542318988723
Ref: c-api/tuple c PyTuple_SetItem18989225
Ref: 51de18989225
Ref: c-api/tuple c PyTuple_SET_ITEM18990052
Ref: 82718990052
Ref: c-api/tuple c _PyTuple_Resize18991239
Ref: 18c318991239
Node: Struct Sequence オブジェクト18992434
Ref: c-api/tuple id118992639
Ref: 570118992639
Ref: c-api/tuple struct-sequence-objects18992639
Ref: 157d18992639
Ref: c-api/tuple c PyStructSequence_NewType18993040
Ref: 540218993040
Ref: c-api/tuple c PyStructSequence_InitType18993532
Ref: 13b018993532
Ref: c-api/tuple c PyStructSequence_InitType218993848
Ref: 13b118993848
Ref: c-api/tuple c PyStructSequence_Desc18994227
Ref: f7d18994227
Ref: c-api/tuple c PyStructSequence_Desc name18994444
Ref: 570218994444
Ref: c-api/tuple c PyStructSequence_Desc doc18994619
Ref: 570318994619
Ref: c-api/tuple c PyStructSequence_Desc fields18994735
Ref: 570418994735
Ref: c-api/tuple c PyStructSequence_Desc n_in_sequence18994904
Ref: 570518994904
Ref: c-api/tuple c PyStructSequence_Field18995039
Ref: f7c18995039
Ref: c-api/tuple c PyStructSequence_Field name18995480
Ref: 570618995480
Ref: c-api/tuple c PyStructSequence_Field doc18995693
Ref: 570718995693
Ref: c-api/tuple c PyStructSequence_UnnamedField18995791
Ref: d4e18995791
Ref: c-api/tuple c PyStructSequence_New18996104
Ref: 540118996104
Ref: c-api/tuple c PyStructSequence_GetItem18996559
Ref: 540018996559
Ref: c-api/tuple c PyStructSequence_GET_ITEM18997212
Ref: 570818997212
Ref: c-api/tuple c PyStructSequence_SetItem18997626
Ref: 540318997626
Ref: c-api/tuple c PyStructSequence_SET_ITEM18998333
Ref: 570918998333
Node: リストオブジェクト18998716
Ref: c-api/list doc18998872
Ref: 570a18998872
Ref: c-api/list list-objects18998872
Ref: 570b18998872
Ref: c-api/list listobjects18998872
Ref: 570c18998872
Ref: c-api/list translation-repo18998872
Ref: 570d18998872
Ref: c-api/list c PyListObject18998940
Ref: 294118998940
Ref: c-api/list c PyList_Type18999103
Ref: 51ff18999103
Ref: c-api/list c PyList_Check18999410
Ref: 570e18999410
Ref: c-api/list c PyList_CheckExact18999682
Ref: 570f18999682
Ref: c-api/list c PyList_New18999962
Ref: 526f18999962
Ref: c-api/list c PyList_Size19000813
Ref: 17d219000813
Ref: c-api/list c PyList_GET_SIZE19001125
Ref: 571019001125
Ref: c-api/list c PyList_GetItemRef19001343
Ref: 7fa19001343
Ref: c-api/list c PyList_GetItem19001937
Ref: 7fb19001937
Ref: c-api/list c PyList_GET_ITEM19002657
Ref: 528419002657
Ref: c-api/list c PyList_SetItem19003291
Ref: 1afa19003291
Ref: c-api/list c PyList_SET_ITEM19004014
Ref: 82819004014
Ref: c-api/list c PyList_Insert19005392
Ref: 1af919005392
Ref: c-api/list c PyList_Append19005899
Ref: 538019005899
Ref: c-api/list c PyList_GetSlice19006305
Ref: 538219006305
Ref: c-api/list c PyList_SetSlice19006888
Ref: 538419006888
Ref: c-api/list c PyList_Extend19007881
Ref: 7fc19007881
Ref: c-api/list c PyList_Clear19008804
Ref: 7fd19008804
Ref: c-api/list c PyList_Sort19009222
Ref: 538519009222
Ref: c-api/list c PyList_Reverse19009984
Ref: 538319009984
Ref: c-api/list c PyList_AsTuple19010369
Ref: 538119010369
Node: Container オブジェクト19010694
Ref: c-api/concrete container-objects19010906
Ref: 571119010906
Ref: c-api/concrete mapobjects19010906
Ref: 571219010906
Node: Dictionary objects19011033
Ref: c-api/dict doc19011147
Ref: 571319011147
Ref: c-api/dict dictionary-objects19011147
Ref: 571419011147
Ref: c-api/dict dictobjects19011147
Ref: 571519011147
Ref: c-api/dict c PyDictObject19011204
Ref: 84419011204
Ref: c-api/dict c PyDict_Type19011364
Ref: 52ff19011364
Ref: c-api/dict c PyDict_Check19011686
Ref: 564619011686
Ref: c-api/dict c PyDict_CheckExact19011952
Ref: 571619011952
Ref: c-api/dict c PyDict_New19012226
Ref: 52fd19012226
Ref: c-api/dict c PyDictProxy_New19012497
Ref: 52f019012497
Ref: c-api/dict c PyDictProxy_Type19013183
Ref: 52f119013183
Ref: c-api/dict c PyDict_Clear19013779
Ref: 52f619013779
Ref: c-api/dict c PyDict_Contains19014114
Ref: 7dd19014114
Ref: c-api/dict c PyDict_ContainsString19014888
Ref: 7dc19014888
Ref: c-api/dict c PyDict_Copy19015358
Ref: 85519015358
Ref: c-api/dict c PyDict_SetItem19015635
Ref: 51df19015635
Ref: c-api/dict c PyDict_SetItemString19016473
Ref: 1bba19016473
Ref: c-api/dict c PyDict_DelItem19016832
Ref: 52f719016832
Ref: c-api/dict c PyDict_DelItemString19017646
Ref: 52f819017646
Ref: c-api/dict c PyDict_GetItemRef19017980
Ref: 7de19017980
Ref: c-api/dict c PyDict_GetItem19019100
Ref: 82219019100
Ref: c-api/dict c PyDict_GetItemWithError19020443
Ref: 7df19020443
Ref: c-api/dict c PyDict_GetItemString19021396
Ref: 82319021396
Ref: c-api/dict c PyDict_GetItemStringRef19022594
Ref: 63b19022594
Ref: c-api/dict c PyDict_SetDefault19023085
Ref: 7e219023085
Ref: c-api/dict c PyDict_SetDefaultRef19024109
Ref: 7e119024109
Ref: c-api/dict c PyDict_Pop19025562
Ref: 63c19025562
Ref: c-api/dict c PyDict_PopString19026587
Ref: 7e319026587
Ref: c-api/dict c PyDict_Items19026910
Ref: 52f919026910
Ref: c-api/dict c PyDict_Keys19027352
Ref: 52fa19027352
Ref: c-api/dict c PyDict_Values19027790
Ref: 530119027790
Ref: c-api/dict c PyDict_Size19028232
Ref: 52fe19028232
Ref: c-api/dict c PyDict_GET_SIZE19028662
Ref: 571719028662
Ref: c-api/dict c PyDict_Next19028921
Ref: 1bbb19028921
Ref: c-api/dict c PyDict_Merge19032474
Ref: 52fb19032474
Ref: c-api/dict c PyDict_Update19033700
Ref: 530019033700
Ref: c-api/dict c PyDict_MergeFromSeq219034640
Ref: 52fc19034640
Ref: c-api/dict c PyDict_AddWatcher19035956
Ref: 60319035956
Ref: c-api/dict c PyDict_ClearWatcher19036698
Ref: 191619036698
Ref: c-api/dict c PyDict_Watch19037381
Ref: 96e19037381
Ref: c-api/dict c PyDict_Unwatch19037810
Ref: 191719037810
Ref: c-api/dict c PyDict_WatchEvent19038327
Ref: 571819038327
Ref: c-api/dict c PyDict_WatchCallback19038648
Ref: 571919038648
Node: 辞書ビューオブジェクト<2>19041066
Ref: c-api/dict dictionary-view-objects19041191
Ref: 571a19041191
Ref: c-api/dict c PyDictViewSet_Check19041267
Ref: 571b19041267
Ref: c-api/dict c PyDictKeys_Type19041556
Ref: 52ef19041556
Ref: c-api/dict c PyDictKeys_Check19041796
Ref: 571c19041796
Ref: c-api/dict c PyDictValues_Type19041955
Ref: 52f519041955
Ref: c-api/dict c PyDictValues_Check19042201
Ref: 571e19042201
Ref: c-api/dict c PyDictItems_Type19042363
Ref: 52eb19042363
Ref: c-api/dict c PyDictItems_Check19042606
Ref: 571d19042606
Node: Frozen dictionary objects19042766
Ref: c-api/dict frozen-dictionary-objects19042920
Ref: 571f19042920
Ref: c-api/dict c PyFrozenDict_Type19043015
Ref: 572019043015
Ref: c-api/dict c PyAnyDict_Check19043249
Ref: 35419043249
Ref: c-api/dict c PyAnyDict_CheckExact19043503
Ref: 35519043503
Ref: c-api/dict c PyFrozenDict_Check19043769
Ref: 35619043769
Ref: c-api/dict c PyFrozenDict_CheckExact19043984
Ref: 35719043984
Ref: c-api/dict c PyFrozenDict_New19044210
Ref: 35819044210
Node: Ordered dictionaries19044473
Ref: c-api/dict ordered-dictionaries19044582
Ref: 572119044582
Ref: c-api/dict c PyODict_Type19044871
Ref: 572219044871
Ref: c-api/dict c PyODict_Check19045058
Ref: 572319045058
Ref: c-api/dict c PyODict_CheckExact19045274
Ref: 572419045274
Ref: c-api/dict c PyODictKeys_Type19045501
Ref: 572519045501
Ref: c-api/dict c PyODictValues_Type19045632
Ref: 572619045632
Ref: c-api/dict c PyODictItems_Type19045772
Ref: 572719045772
Ref: c-api/dict c PyODict_New19045910
Ref: 572819045910
Ref: c-api/dict c PyODict_SetItem19046093
Ref: 572919046093
Ref: c-api/dict c PyODict_DelItem19046403
Ref: 572a19046403
Ref: c-api/dict c PyODict_GetItem19047084
Ref: 572b19047084
Ref: c-api/dict c PyODict_GetItemWithError19047293
Ref: 572c19047293
Ref: c-api/dict c PyODict_GetItemString19047499
Ref: 572d19047499
Ref: c-api/dict c PyODict_Contains19047700
Ref: 572e19047700
Ref: c-api/dict c PyODict_Size19047892
Ref: 572f19047892
Ref: c-api/dict c PyODict_SIZE19048090
Ref: 573019048090
Node: Set オブジェクト19048200
Ref: c-api/set doc19048314
Ref: 573119048314
Ref: c-api/set set-objects19048314
Ref: 573219048314
Ref: c-api/set setobjects19048314
Ref: 573319048314
Ref: c-api/set translation-repo19048314
Ref: 573419048314
Ref: c-api/set c PySetObject19049153
Ref: 573519049153
Ref: c-api/set c PySet_Type19049946
Ref: 53f619049946
Ref: c-api/set c PyFrozenSet_Type19050162
Ref: 536519050162
Ref: c-api/set c PySet_Check19050655
Ref: 573619050655
Ref: c-api/set c PyFrozenSet_Check19050865
Ref: 573719050865
Ref: c-api/set c PyAnySet_Check19051088
Ref: 573819051088
Ref: c-api/set c PySet_CheckExact19051342
Ref: c7719051342
Ref: c-api/set c PyAnySet_CheckExact19051599
Ref: 573919051599
Ref: c-api/set c PyFrozenSet_CheckExact19051898
Ref: 573a19051898
Ref: c-api/set c PySet_New19052138
Ref: 17fc19052138
Ref: c-api/set c PyFrozenSet_New19053037
Ref: 17fd19053037
Ref: c-api/set c PySet_Size19054011
Ref: 180119054011
Ref: c-api/set c PySet_GET_SIZE19054415
Ref: 573b19054415
Ref: c-api/set c PySet_Contains19054627
Ref: 180019054627
Ref: c-api/set c PySet_Add19055462
Ref: 17fe19055462
Ref: c-api/set c PySet_Discard19056742
Ref: 17ff19056742
Ref: c-api/set c PySet_Pop19057634
Ref: 53f519057634
Ref: c-api/set c PySet_Clear19058233
Ref: 53f419058233
Node: Deprecated API<3>19058821
Ref: c-api/set deprecated-api19058897
Ref: 573c19058897
Ref: c-api/set c PySet_MINSIZE19058946
Ref: 573d19058946
Node: Function オブジェクト<2>19059542
Ref: c-api/concrete function-objects19059738
Ref: 573e19059738
Ref: c-api/concrete otherobjects19059738
Ref: 573f19059738
Node: Function オブジェクト<3>19060283
Ref: c-api/function doc19060461
Ref: 574019060461
Ref: c-api/function function-objects19060461
Ref: 574119060461
Ref: c-api/function id119060461
Ref: 574219060461
Ref: c-api/function c PyFunctionObject19060594
Ref: 96d19060594
Ref: c-api/function c PyFunction_Type19060684
Ref: 574319060684
Ref: c-api/function c PyFunction_Check19060949
Ref: 574419060949
Ref: c-api/function c PyFunction_New19061217
Ref: 574519061217
Ref: c-api/function c PyFunction_NewWithQualName19062036
Ref: 574619062036
Ref: c-api/function c PyFunction_GetCode19062673
Ref: 574719062673
Ref: c-api/function c PyFunction_GetGlobals19062887
Ref: 574819062887
Ref: c-api/function c PyFunction_GetModule19063090
Ref: 574919063090
Ref: c-api/function c PyFunction_GetDefaults19063479
Ref: 574a19063479
Ref: c-api/function c PyFunction_SetDefaults19063738
Ref: 574b19063738
Ref: c-api/function c PyFunction_SetVectorcall19064101
Ref: 96c19064101
Ref: c-api/function c PyFunction_GetKwDefaults19064427
Ref: 574c19064427
Ref: c-api/function c PyFunction_SetKwDefaults19064692
Ref: 574d19064692
Ref: c-api/function c PyFunction_GetClosure19065059
Ref: 574e19065059
Ref: c-api/function c PyFunction_SetClosure19065318
Ref: 574f19065318
Ref: c-api/function c PyFunction_GetAnnotations19065705
Ref: 1d5419065705
Ref: c-api/function c PyFunction_SetAnnotations19065976
Ref: 575019065976
Ref: c-api/function c PyFunction_GET_CODE19066341
Ref: 575119066341
Ref: c-api/function c PyFunction_GET_GLOBALS19066415
Ref: 575219066415
Ref: c-api/function c PyFunction_GET_MODULE19066502
Ref: 575319066502
Ref: c-api/function c PyFunction_GET_DEFAULTS19066578
Ref: 575419066578
Ref: c-api/function c PyFunction_GET_KW_DEFAULTS19066666
Ref: 575519066666
Ref: c-api/function c PyFunction_GET_CLOSURE19066757
Ref: 575619066757
Ref: c-api/function c PyFunction_GET_ANNOTATIONS19066844
Ref: 575719066844
Ref: c-api/function c PyFunction_AddWatcher19067182
Ref: 575819067182
Ref: c-api/function c PyFunction_ClearWatcher19067564
Ref: 575919067564
Ref: c-api/function c PyFunction_WatchEvent19067933
Ref: 575a19067933
Ref: c-api/function c PyFunction_WatchCallback19068415
Ref: 575b19068415
Node: インスタンスメソッドオブジェクト Instance Method Objects19070629
Ref: c-api/method doc19070849
Ref: 575c19070849
Ref: c-api/method instance-method-objects19070849
Ref: 575d19070849
Ref: c-api/method instancemethod-objects19070849
Ref: 575e19070849
Ref: c-api/method translation-repo19070849
Ref: 575f19070849
Ref: c-api/method c PyInstanceMethod_Type19071195
Ref: 576019071195
Ref: c-api/method c PyInstanceMethod_Check19071458
Ref: 576119071458
Ref: c-api/method c PyInstanceMethod_New19071761
Ref: 576219071761
Ref: c-api/method c PyInstanceMethod_Function19072142
Ref: 576319072142
Ref: c-api/method c PyInstanceMethod_GET_FUNCTION19072376
Ref: 576419072376
Node: メソッドオブジェクト<2>19072616
Ref: c-api/method id119072842
Ref: 576519072842
Ref: c-api/method method-objects19072842
Ref: 576619072842
Ref: c-api/method c PyMethod_Type19073216
Ref: 576719073216
Ref: c-api/method c PyMethod_Check19073507
Ref: 576819073507
Ref: c-api/method c PyMethod_New19073777
Ref: 576919073777
Ref: c-api/method c PyMethod_Function19074265
Ref: 576a19074265
Ref: c-api/method c PyMethod_GET_FUNCTION19074473
Ref: 576b19074473
Ref: c-api/method c PyMethod_Self19074699
Ref: 576c19074699
Ref: c-api/method c PyMethod_GET_SELF19074891
Ref: 576d19074891
Node: セルオブジェクト cell object19075099
Ref: c-api/cell doc19075283
Ref: 576e19075283
Ref: c-api/cell cell-objects19075283
Ref: af319075283
Ref: c-api/cell id119075283
Ref: 576f19075283
Ref: c-api/cell translation-repo19075283
Ref: 577019075283
Ref: c-api/cell c PyCellObject19075969
Ref: 577119075969
Ref: c-api/cell c PyCell_Type19076078
Ref: 577219076078
Ref: c-api/cell c PyCell_Check19076206
Ref: 577319076206
Ref: c-api/cell c PyCell_New19076425
Ref: 577419076425
Ref: c-api/cell c PyCell_Get19076674
Ref: 577519076674
Ref: c-api/cell c PyCell_GET19076929
Ref: 577619076929
Ref: c-api/cell c PyCell_Set19077180
Ref: 577719077180
Ref: c-api/cell c PyCell_SET19077553
Ref: c8519077553
Node: コードオブジェクト<3>19077938
Ref: c-api/code doc19078106
Ref: 577819078106
Ref: c-api/code code-objects19078106
Ref: 577919078106
Ref: c-api/code codeobjects19078106
Ref: 9b919078106
Ref: c-api/code translation-repo19078106
Ref: 577a19078106
Ref: c-api/code c PyCodeObject19078385
Ref: b5e19078385
Ref: c-api/code c PyCode_Type19078585
Ref: 577b19078585
Ref: c-api/code c PyCode_Check19078744
Ref: 577c19078744
Ref: c-api/code c PyCode_GetNumFree19078886
Ref: 577d19078886
Ref: c-api/code c PyUnstable_Code_GetFirstFree19079062
Ref: 82119079062
Ref: c-api/code c PyUnstable_Code_New19079692
Ref: 577e19079692
Ref: c-api/code c PyCode_NewWithPosOnlyArgs19081193
Ref: 577f19081193
Ref: c-api/code c PyUnstable_Code_NewWithPosOnlyArgs19081193
Ref: 578019081193
Ref: c-api/code c PyCode_NewEmpty19082485
Ref: 170a19082485
Ref: c-api/code c PyCode_Addr2Line19082832
Ref: c6319082832
Ref: c-api/code c PyCode_Addr2Location19083236
Ref: 9b819083236
Ref: c-api/code c PyCode_GetCode19083717
Ref: b5f19083717
Ref: c-api/code c PyCode_GetVarnames19084302
Ref: b6019084302
Ref: c-api/code c PyCode_GetCellvars19084667
Ref: b6119084667
Ref: c-api/code c PyCode_GetFreevars19085077
Ref: b6219085077
Ref: c-api/code c PyCode_AddWatcher19085463
Ref: 97119085463
Ref: c-api/code c PyCode_ClearWatcher19085825
Ref: 97219085825
Ref: c-api/code c PyCodeEvent19086185
Ref: 578119086185
Ref: c-api/code c PyCode_WatchCallback19086377
Ref: 578219086377
Ref: c-api/code c PyCode_Optimize19088168
Ref: 578319088168
Ref: コードオブジェクト<3>-Footnote-119088611
Node: Code Object Flags19088693
Ref: c-api/code c-codeobject-flags19088842
Ref: 553919088842
Ref: c-api/code code-object-flags19088842
Ref: 578419088842
Ref: c-api/code c CO_OPTIMIZED19089898
Ref: 578519089898
Ref: c-api/code c CO_NEWLOCALS19090103
Ref: 578619090103
Ref: c-api/code c CO_VARARGS19090306
Ref: 578719090306
Ref: c-api/code c CO_VARKEYWORDS19090513
Ref: 578819090513
Ref: c-api/code c CO_NESTED19090715
Ref: 578919090715
Ref: c-api/code c CO_GENERATOR19090920
Ref: 578a19090920
Ref: c-api/code c CO_COROUTINE19091125
Ref: 578b19091125
Ref: c-api/code c CO_ITERABLE_COROUTINE19091339
Ref: 578c19091339
Ref: c-api/code c CO_ASYNC_GENERATOR19091550
Ref: 578d19091550
Ref: c-api/code c CO_HAS_DOCSTRING19091759
Ref: 578e19091759
Ref: c-api/code c CO_METHOD19091961
Ref: 578f19091961
Ref: c-api/code c CO_FUTURE_DIVISION19092172
Ref: 579019092172
Ref: c-api/code c CO_FUTURE_ABSOLUTE_IMPORT19092395
Ref: 579119092395
Ref: c-api/code c CO_FUTURE_WITH_STATEMENT19092617
Ref: 579219092617
Ref: c-api/code c CO_FUTURE_PRINT_FUNCTION19092839
Ref: 579319092839
Ref: c-api/code c CO_FUTURE_UNICODE_LITERALS19093063
Ref: 579419093063
Ref: c-api/code c CO_FUTURE_GENERATOR_STOP19093285
Ref: 579519093285
Ref: c-api/code c CO_FUTURE_ANNOTATIONS19093504
Ref: 553819093504
Node: Extra information19093615
Ref: c-api/code extra-information19093725
Ref: 579619093725
Ref: c-api/code c _PyEval_RequestCodeExtraIndex19094100
Ref: 579719094100
Ref: c-api/code c PyUnstable_Eval_RequestCodeExtraIndex19094100
Ref: 197a19094100
Ref: c-api/code c _PyCode_GetExtra19095192
Ref: 579819095192
Ref: c-api/code c PyUnstable_Code_GetExtra19095192
Ref: 197919095192
Ref: c-api/code c _PyCode_SetExtra19096024
Ref: 579919096024
Ref: c-api/code c PyUnstable_Code_SetExtra19096024
Ref: 197819096024
Node: その他のオブジェクト<2>19096739
Ref: c-api/concrete other-objects19096934
Ref: 579a19096934
Node: File objects19097918
Ref: c-api/file doc19098056
Ref: 579b19098056
Ref: c-api/file file-objects19098056
Ref: 579c19098056
Ref: c-api/file fileobjects19098056
Ref: 579d19098056
Ref: c-api/file c PyFile_FromFd19098903
Ref: 535d19098903
Ref: c-api/file c PyObject_AsFileDescriptor19100197
Ref: 53ce19100197
Ref: c-api/file c PyFile_GetLine19100798
Ref: 535e19100798
Ref: c-api/file c PyFile_SetOpenCodeHook19101863
Ref: 1cbd19101863
Ref: c-api/file c Py_OpenCodeHookFunction19102162
Ref: 579e19102162
Ref: c-api/file c PyFile_OpenCodeObject19103718
Ref: 579f19103718
Ref: c-api/file c PyFile_OpenCode19104319
Ref: 57a019104319
Ref: c-api/file c PyFile_WriteObject19104524
Ref: 535f19104524
Ref: c-api/file c PyFile_WriteString19105042
Ref: 536019105042
Node: Soft-deprecated API<2>19105431
Ref: c-api/file soft-deprecated-api19105502
Ref: 57a119105502
Ref: c-api/file c PyFile_NewStdPrinter19105759
Ref: 57a219105759
Ref: c-api/file c PyStdPrinter_Type19105943
Ref: 57a319105943
Node: モジュールオブジェクト module object19106213
Ref: c-api/module doc19106409
Ref: 57a419106409
Ref: c-api/module module-objects19106409
Ref: 57a519106409
Ref: c-api/module moduleobjects19106409
Ref: 557519106409
Ref: c-api/module translation-repo19106409
Ref: 57a619106409
Ref: c-api/module c PyModule_Type19106517
Ref: 53aa19106517
Ref: c-api/module c PyModule_Check19106784
Ref: 57a719106784
Ref: c-api/module c PyModule_CheckExact19107020
Ref: 57a819107020
Ref: c-api/module c PyModule_NewObject19107265
Ref: 53a819107265
Ref: c-api/module c PyModule_New19108014
Ref: 53a719108014
Ref: c-api/module c PyModule_GetDict19108337
Ref: 53a219108337
Ref: c-api/module c PyModule_GetNameObject19109243
Ref: 53a419109243
Ref: c-api/module c PyModule_GetName19109668
Ref: 53a319109668
Ref: c-api/module c PyModule_GetDef19110109
Ref: 53a119110109
Ref: c-api/module c PyModule_GetFilenameObject19110640
Ref: 64819110640
Ref: c-api/module c PyModule_GetFilename19111129
Ref: 64719111129
Ref: c-api/module c-module-slots19111834
Ref: 557919111834
Node: Module definition19111978
Ref: c-api/module module-definition19112100
Ref: 57a919112100
Ref: c-api/module pymoduledef-slot19112100
Ref: 57aa19112100
Node: Metadata slots19113119
Ref: c-api/module metadata-slots19113209
Ref: 57ad19113209
Ref: c-api/module c Py_mod_name19113258
Ref: 51af19113258
Ref: c-api/module c Py_mod_doc19113872
Ref: 51b019113872
Node: Feature slots19114296
Ref: c-api/module feature-slots19114428
Ref: 57b019114428
Ref: c-api/module c Py_mod_abi19114475
Ref: 36019114475
Ref: c-api/module c Py_mod_multiple_interpreters19115225
Ref: 54a519115225
Ref: c-api/module c Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED19115406
Ref: 57b119115406
Ref: c-api/module c Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED19115549
Ref: 57b219115549
Ref: c-api/module c Py_MOD_PER_INTERPRETER_GIL_SUPPORTED19115808
Ref: 57b319115808
Ref: c-api/module c Py_mod_gil19116322
Ref: 69719116322
Ref: c-api/module c Py_MOD_GIL_USED19116485
Ref: 57b419116485
Ref: c-api/module c Py_MOD_GIL_NOT_USED19116684
Ref: 57b519116684
Node: Creation and initialization slots19117206
Ref: c-api/module creation-and-initialization-slots19117315
Ref: 57b619117315
Ref: c-api/module c Py_mod_create19117402
Ref: 54a419117402
Ref: c-api/module c Py_mod_create create_module19117642
Ref: 57b719117642
Ref: c-api/module c Py_mod_exec19119728
Ref: d4a19119728
Ref: c-api/module c Py_mod_exec exec_module19120114
Ref: 57b919120114
Ref: c-api/module c Py_mod_methods19120795
Ref: 51b519120795
Node: Module state19121582
Ref: c-api/module ext-module-state19121751
Ref: 57bc19121751
Ref: c-api/module module-state19121751
Ref: 57bd19121751
Ref: c-api/module c PyModule_GetState19122742
Ref: d4c19122742
Ref: c-api/module c PyModule_GetStateSize19123185
Ref: 53a519123185
Node: Slots for defining module state19123688
Ref: c-api/module ext-module-state-slots19123789
Ref: 57b819123789
Ref: c-api/module slots-for-defining-module-state19123789
Ref: 57be19123789
Ref: c-api/module c Py_mod_state_size19123954
Ref: 54a819123954
Ref: c-api/module c Py_mod_state_traverse19124560
Ref: 54a919124560
Ref: c-api/module c Py_mod_state_traverse traverse_module_state19124920
Ref: 57bf19124920
Ref: c-api/module c Py_mod_state_clear19125589
Ref: 54a619125589
Ref: c-api/module c Py_mod_state_clear clear_module_state19125852
Ref: 57c019125852
Ref: c-api/module c Py_mod_state_free19126819
Ref: 54a719126819
Ref: c-api/module c Py_mod_state_free free_module_state19127076
Ref: 57c119127076
Ref: Slots for defining module state-Footnote-119127734
Node: Module token19127776
Ref: c-api/module ext-module-token19127877
Ref: 565219127877
Ref: c-api/module module-token19127877
Ref: 57c219127877
Ref: c-api/module c Py_mod_token19129098
Ref: 54aa19129098
Ref: c-api/module c PyModule_GetToken19130101
Ref: 53a619130101
Node: Creating extension modules dynamically19130482
Ref: c-api/module creating-extension-modules-dynamically19130658
Ref: 57c319130658
Ref: c-api/module module-from-slots19130658
Ref: 57ac19130658
Ref: c-api/module c PyModule_FromSlotsAndSpec19130893
Ref: 39419130893
Ref: c-api/module c PyModule_Exec19132068
Ref: 53a019132068
Node: Module definition struct19132536
Ref: c-api/module module-definition-struct19132718
Ref: 57c419132718
Ref: c-api/module pymoduledef19132718
Ref: 57ab19132718
Ref: c-api/module c PyModuleDef19133190
Ref: d4919133190
Ref: c-api/module c PyModuleDef m_base19133933
Ref: 57c519133933
Ref: c-api/module c PyModuleDef_Base19134092
Ref: 539a19134092
Ref: c-api/module c PyModuleDef_HEAD_INIT19134537
Ref: 57c619134537
Ref: c-api/module c PyModuleDef m_name19134663
Ref: 57ae19134663
Ref: c-api/module c PyModuleDef m_doc19134775
Ref: 57af19134775
Ref: c-api/module c PyModuleDef m_size19134965
Ref: d4b19134965
Ref: c-api/module c PyModuleDef m_methods19135517
Ref: 57bb19135517
Ref: c-api/module c PyModuleDef m_slots19135717
Ref: 198d19135717
Ref: c-api/module c PyModuleDef m_slots m_reload19136520
Ref: 57c719136520
Ref: c-api/module c PyModuleDef_Slot19136592
Ref: 539c19136592
Ref: c-api/module c PyModuleDef_Slot slot19137690
Ref: 57c819137690
Ref: c-api/module c PyModuleDef_Slot value19137803
Ref: 57c919137803
Ref: c-api/module c PyModuleDef m_traverse19137958
Ref: d4619137958
Ref: c-api/module c PyModuleDef m_clear19138026
Ref: d4719138026
Ref: c-api/module c PyModuleDef m_free19138086
Ref: d4819138086
Ref: c-api/module c PyModuleDef_Type19138632
Ref: 539d19138632
Ref: c-api/module c Py_mod_slots19138815
Ref: 38319138815
Ref: c-api/module moduledef-dynamic19139115
Ref: 57cb19139115
Ref: c-api/module c PyModule_Create19139197
Ref: 557119139197
Ref: c-api/module c PyModule_Create219139588
Ref: 539f19139588
Ref: c-api/module c PyModule_FromDefAndSpec19140550
Ref: 39a19140550
Ref: c-api/module c PyModule_FromDefAndSpec219141071
Ref: 39b19141071
Ref: c-api/module c PyModule_ExecDef19142405
Ref: 39c19142405
Ref: c-api/module c PYTHON_API_VERSION19142949
Ref: 4c2219142949
Ref: c-api/module c PYTHON_API_STRING19142988
Ref: 57cd19142988
Ref: c-api/module c PYTHON_ABI_VERSION19143304
Ref: 57cc19143304
Ref: c-api/module c PYTHON_ABI_STRING19143343
Ref: 57ce19143343
Node: サポート関数19143611
Ref: c-api/module capi-module-support-functions19143746
Ref: 57ba19143746
Ref: c-api/module support-functions19143746
Ref: 57cf19143746
Ref: c-api/module c PyModule_AddObjectRef19144070
Ref: 80619144070
Ref: c-api/module c PyModule_Add19146159
Ref: 80519146159
Ref: c-api/module c PyModule_AddObject19146750
Ref: 80719146750
Ref: c-api/module c PyModule_AddIntConstant19148143
Ref: 18f419148143
Ref: c-api/module c PyModule_AddStringConstant19148680
Ref: 18f519148680
Ref: c-api/module c PyModule_AddIntMacro19149291
Ref: 17ab19149291
Ref: c-api/module c PyModule_AddStringMacro19149655
Ref: 17aa19149655
Ref: c-api/module c PyModule_AddType19149772
Ref: d4119149772
Ref: c-api/module c PyModule_AddFunctions19150271
Ref: 539e19150271
Ref: c-api/module c PyModule_SetDocString19151372
Ref: 53a919151372
Ref: c-api/module c PyUnstable_Module_SetGIL19151922
Ref: 6af19151922
Node: Module lookup single-phase initialization19152986
Ref: c-api/module module-lookup-single-phase-initialization19153082
Ref: 57d019153082
Ref: c-api/module c PyState_FindModule19153668
Ref: 53fe19153668
Ref: c-api/module c PyState_AddModule19154370
Ref: 53fd19154370
Ref: c-api/module c PyState_RemoveModule19155721
Ref: 53ff19155721
Node: イテレータオブジェクト iterator object19156108
Ref: c-api/iterator doc19156346
Ref: 57d119156346
Ref: c-api/iterator id119156346
Ref: 57d219156346
Ref: c-api/iterator iterator-objects19156346
Ref: 57d319156346
Ref: c-api/iterator translation-repo19156346
Ref: 57d419156346
Ref: c-api/iterator c PySeqIter_Type19156961
Ref: 53e519156961
Ref: c-api/iterator c PySeqIter_Check19157326
Ref: 57d519157326
Ref: c-api/iterator c PySeqIter_New19157503
Ref: 53e419157503
Ref: c-api/iterator c PyCallIter_Type19157896
Ref: 52c519157896
Ref: c-api/iterator c PyCallIter_Check19158183
Ref: 57d619158183
Ref: c-api/iterator c PyCallIter_New19158369
Ref: 52c419158369
Node: Range Objects19159109
Ref: c-api/iterator range-objects19159239
Ref: 57d719159239
Ref: c-api/iterator c PyRange_Type19159288
Ref: 53e219159288
Ref: c-api/iterator c PyRange_Check19159445
Ref: 57d819159445
Node: Builtin Iterator Types19159614
Ref: c-api/iterator builtin-iterator-types19159775
Ref: 57d919159775
Ref: c-api/iterator c PyEnum_Type19160329
Ref: 530319160329
Ref: c-api/iterator c PyFilter_Type19160474
Ref: 536119160474
Ref: c-api/iterator c PyMap_Type19160610
Ref: 539119160610
Ref: c-api/iterator c PyReversed_Type19160751
Ref: 53e319160751
Ref: c-api/iterator c PyZip_Type19160887
Ref: 546f19160887
Node: Other Iterator Objects19160974
Ref: c-api/iterator other-iterator-objects19161113
Ref: 57da19161113
Ref: c-api/iterator c PyByteArrayIter_Type19161180
Ref: 52ac19161180
Ref: c-api/iterator c PyBytesIter_Type19161292
Ref: 52b219161292
Ref: c-api/iterator c PyListIter_Type19161400
Ref: 537e19161400
Ref: c-api/iterator c PyListRevIter_Type19161507
Ref: 537f19161507
Ref: c-api/iterator c PySetIter_Type19161617
Ref: 53f319161617
Ref: c-api/iterator c PyTupleIter_Type19161723
Ref: 542219161723
Ref: c-api/iterator c PyRangeIter_Type19161831
Ref: 53e119161831
Ref: c-api/iterator c PyLongRangeIter_Type19161939
Ref: 538619161939
Ref: c-api/iterator c PyDictIterKey_Type19162051
Ref: 52ed19162051
Ref: c-api/iterator c PyDictRevIterKey_Type19162161
Ref: 52f319162161
Ref: c-api/iterator c PyDictIterValue_Type19162304
Ref: 52ee19162304
Ref: c-api/iterator c PyDictRevIterValue_Type19162416
Ref: 52f419162416
Ref: c-api/iterator c PyDictIterItem_Type19162561
Ref: 52ec19162561
Ref: c-api/iterator c PyDictRevIterItem_Type19162672
Ref: 52f219162672
Ref: c-api/iterator c PyODictIter_Type19162816
Ref: 57db19162816
Node: デスクリプタオブジェクト descriptor object19163354
Ref: c-api/descriptor doc19163588
Ref: 57dc19163588
Ref: c-api/descriptor descriptor-objects19163588
Ref: 57dd19163588
Ref: c-api/descriptor id119163588
Ref: 57de19163588
Ref: c-api/descriptor translation-repo19163588
Ref: 57df19163588
Ref: c-api/descriptor c PyDescr_NewGetSet19163944
Ref: 52e919163944
Ref: c-api/descriptor c PyDescr_NewMember19164712
Ref: 52ea19164712
Ref: c-api/descriptor c PyMemberDescr_Type19165425
Ref: 539519165425
Ref: c-api/descriptor c PyGetSetDescr_Type19165799
Ref: 536819165799
Ref: c-api/descriptor c PyDescr_NewMethod19166256
Ref: 1f8819166256
Ref: c-api/descriptor c PyMethodDescr_Type19166947
Ref: 539919166947
Ref: c-api/descriptor c wrapperbase19167310
Ref: 57e019167310
Ref: c-api/descriptor c PyDescr_NewWrapper19167652
Ref: 57e119167652
Ref: c-api/descriptor c PyWrapperDescr_Type19168425
Ref: 546d19168425
Ref: c-api/descriptor c PyDescr_NewClassMethod19168863
Ref: 52e819168863
Ref: c-api/descriptor c PyDescr_IsData19169633
Ref: 1ec819169633
Ref: c-api/descriptor c PyWrapper_New19169884
Ref: 546e19169884
Ref: c-api/descriptor c PyDescr_COMMON19170569
Ref: 57e219170569
Node: Built-in descriptors19171024
Ref: c-api/descriptor built-in-descriptors19171135
Ref: 57e419171135
Ref: c-api/descriptor c PyProperty_Type19171198
Ref: 53e019171198
Ref: c-api/descriptor c PySuper_Type19171424
Ref: 540419171424
Ref: c-api/descriptor c PyClassMethod_Type19171641
Ref: 57e519171641
Ref: c-api/descriptor c PyClassMethodDescr_Type19171818
Ref: 52d119171818
Ref: c-api/descriptor c PyClassMethod_New19172202
Ref: 57e619172202
Ref: c-api/descriptor c PyStaticMethod_Type19172616
Ref: 57e719172616
Ref: c-api/descriptor c PyStaticMethod_New19172796
Ref: 57e819172796
Node: スライスオブジェクト slice object19173213
Ref: c-api/slice doc19173427
Ref: 57e919173427
Ref: c-api/slice id119173427
Ref: 57ea19173427
Ref: c-api/slice slice-objects19173427
Ref: 57eb19173427
Ref: c-api/slice translation-repo19173427
Ref: 57ec19173427
Ref: c-api/slice c PySlice_Type19173530
Ref: 53f919173530
Ref: c-api/slice c PySlice_Check19173805
Ref: 57ed19173805
Ref: c-api/slice c PySlice_New19174031
Ref: 53f819174031
Ref: c-api/slice c PySlice_GetIndices19174622
Ref: 53f719174622
Ref: c-api/slice c PySlice_GetIndicesEx19175553
Ref: 64b19175553
Ref: c-api/slice c PySlice_Unpack19177626
Ref: 64c19177626
Ref: c-api/slice c PySlice_AdjustIndices19178309
Ref: 64d19178309
Node: Ellipsis オブジェクト<2>19178915
Ref: c-api/slice ellipsis-object19179025
Ref: 57ee19179025
Ref: c-api/slice c PyEllipsis_Type19179096
Ref: 530219179096
Ref: c-api/slice c Py_Ellipsis19179325
Ref: 57ef19179325
Ref: c-api/memoryview memoryview-objects19179704
Ref: 562b19179704
Node: memoryview オブジェクト19179704
Ref: c-api/memoryview doc19179885
Ref: 57f019179885
Ref: c-api/memoryview id119179885
Ref: 57f119179885
Ref: c-api/memoryview translation-repo19179885
Ref: 57f219179885
Ref: c-api/memoryview c PyMemoryView_Type19180185
Ref: 539819180185
Ref: c-api/memoryview c PyMemoryView_FromObject19180458
Ref: 539619180458
Ref: c-api/memoryview c PyBUF_READ19181091
Ref: 1c3219181091
Ref: c-api/memoryview c PyBUF_WRITE19181245
Ref: 1c3319181245
Ref: c-api/memoryview c PyMemoryView_FromMemory19181400
Ref: 152e19181400
Ref: c-api/memoryview c PyMemoryView_FromBuffer19181861
Ref: b4819181861
Ref: c-api/memoryview c PyMemoryView_GetContiguous19182328
Ref: 539719182328
Ref: c-api/memoryview c PyMemoryView_Check19183121
Ref: 57f319183121
Ref: c-api/memoryview c PyMemoryView_GET_BUFFER19183413
Ref: 57f419183413
Ref: c-api/memoryview c PyMemoryView_GET_BASE19183888
Ref: 57f519183888
Ref: c-api/picklebuffer picklebuffer-objects19184274
Ref: 57f619184274
Node: Pickle buffer objects19184274
Ref: c-api/picklebuffer doc19184442
Ref: 57f719184442
Ref: c-api/picklebuffer pickle-buffer-objects19184442
Ref: 57f819184442
Ref: c-api/picklebuffer translation-repo19184442
Ref: 57f919184442
Ref: c-api/picklebuffer c PyPickleBuffer_Type19184682
Ref: 57fa19184682
Ref: c-api/picklebuffer c PyPickleBuffer_Check19184924
Ref: 57fb19184924
Ref: c-api/picklebuffer c PyPickleBuffer_FromObject19185074
Ref: 57fc19185074
Ref: c-api/picklebuffer c PyPickleBuffer_GetBuffer19185510
Ref: 57fd19185510
Ref: c-api/picklebuffer c PyPickleBuffer_Release19186073
Ref: 57fe19186073
Node: 弱参照オブジェクト<2>19186378
Ref: c-api/weakref doc19186532
Ref: 57ff19186532
Ref: c-api/weakref translation-repo19186532
Ref: 580019186532
Ref: c-api/weakref weak-reference-objects19186532
Ref: 580119186532
Ref: c-api/weakref weakrefobjects19186532
Ref: 560019186532
Ref: c-api/weakref c PyWeakref_Check19186980
Ref: 580219186980
Ref: c-api/weakref c PyWeakref_CheckRef19187138
Ref: 580319187138
Ref: c-api/weakref c PyWeakref_CheckRefExact19187320
Ref: 580419187320
Ref: c-api/weakref c PyWeakref_CheckProxy19187513
Ref: 580519187513
Ref: c-api/weakref c PyWeakref_NewRef19187657
Ref: 1dfe19187657
Ref: c-api/weakref c PyWeakref_NewProxy19188619
Ref: 546c19188619
Ref: c-api/weakref c PyWeakref_GetRef19189579
Ref: 3ac19189579
Ref: c-api/weakref c PyWeakref_IsDead19190130
Ref: 1b1e19190130
Ref: c-api/weakref c PyObject_ClearWeakRefs19190393
Ref: 97f19190393
Ref: c-api/weakref c PyUnstable_Object_ClearWeakRefsNoCallbacks19190784
Ref: 1bc119190784
Node: カプセル<2>19191762
Ref: c-api/capsule doc19191911
Ref: 580619191911
Ref: c-api/capsule capsules19191911
Ref: 2c1c19191911
Ref: c-api/capsule id119191911
Ref: 580719191911
Ref: c-api/capsule translation-repo19191911
Ref: 580819191911
Ref: c-api/capsule c PyCapsule19192148
Ref: 162c19192148
Ref: c-api/capsule c PyCapsule_Type19192604
Ref: 52d019192604
Ref: c-api/capsule c PyCapsule_Destructor19192851
Ref: 52c719192851
Ref: c-api/capsule c PyCapsule_CheckExact19193256
Ref: 580919193256
Ref: c-api/capsule c PyCapsule_New19193468
Ref: 51e919193468
Ref: c-api/capsule c PyCapsule_GetPointer19194723
Ref: 52cb19194723
Ref: c-api/capsule c PyCapsule_GetDestructor19195388
Ref: 52c919195388
Ref: c-api/capsule c PyCapsule_GetContext19196127
Ref: 52c819196127
Ref: c-api/capsule c PyCapsule_GetName19196834
Ref: 52ca19196834
Ref: c-api/capsule c PyCapsule_Import19197511
Ref: 1e2619197511
Ref: c-api/capsule c PyCapsule_IsValid19198689
Ref: 171619198689
Ref: c-api/capsule c PyCapsule_SetContext19199720
Ref: 52cc19199720
Ref: c-api/capsule c PyCapsule_SetDestructor19200161
Ref: 52cd19200161
Ref: c-api/capsule c PyCapsule_SetName19200608
Ref: 52ce19200608
Ref: c-api/capsule c PyCapsule_SetPointer19201280
Ref: 52cf19201280
Node: Sentinel objects19201761
Ref: c-api/sentinel doc19201920
Ref: 580a19201920
Ref: c-api/sentinel sentinel-objects19201920
Ref: 580b19201920
Ref: c-api/sentinel sentinelobjects19201920
Ref: 580c19201920
Ref: c-api/sentinel translation-repo19201920
Ref: 580d19201920
Ref: c-api/sentinel c PySentinel_Type19201975
Ref: 580e19201975
Ref: c-api/sentinel c PySentinel_Check19202206
Ref: 191519202206
Ref: c-api/sentinel c PySentinel_CheckExact19202547
Ref: 191419202547
Ref: c-api/sentinel c PySentinel_New19202875
Ref: 580f19202875
Node: フレーム frame オブジェクト<2>19203650
Ref: c-api/frame doc19203830
Ref: 581019203830
Ref: c-api/frame frame-objects19203830
Ref: 581119203830
Ref: c-api/frame translation-repo19203830
Ref: 581219203830
Ref: c-api/frame c PyFrameObject19203921
Ref: b6d19203921
Ref: c-api/frame c PyFrame_Type19204558
Ref: b6b19204558
Ref: c-api/frame c PyFrame_New19204848
Ref: 1d0d19204848
Ref: c-api/frame c PyFrame_Check19205196
Ref: b6919205196
Ref: c-api/frame c PyFrame_GetBack19205425
Ref: b6a19205425
Ref: c-api/frame c PyFrame_GetBuiltins19205740
Ref: b5219205740
Ref: c-api/frame c PyFrame_GetCode19206034
Ref: b6e19206034
Ref: c-api/frame c PyFrame_GetGenerator19206393
Ref: b5319206393
Ref: c-api/frame c PyFrame_GetGlobals19206825
Ref: b5419206825
Ref: c-api/frame c PyFrame_GetLasti19207117
Ref: b5519207117
Ref: c-api/frame c PyFrame_GetVar19207317
Ref: 97319207317
Ref: c-api/frame c PyFrame_GetVarString19207825
Ref: 97419207825
Ref: c-api/frame c PyFrame_GetLocals19208102
Ref: 85419208102
Ref: c-api/frame c PyFrame_GetLineNumber19208814
Ref: b6f19208814
Ref: フレーム frame オブジェクト<2>-Footnote-119209153
Node: Frame locals proxies19209195
Ref: c-api/frame frame-locals-proxies19209327
Ref: 581419209327
Ref: c-api/frame c PyFrameLocalsProxy_Type19209789
Ref: 581319209789
Ref: c-api/frame c PyFrameLocalsProxy_Check19209913
Ref: 581519209913
Ref: Frame locals proxies-Footnote-119210082
Node: Legacy local variable APIs19210124
Ref: c-api/frame legacy-local-variable-apis19210280
Ref: 581619210280
Ref: c-api/frame c PyFrame_LocalsToFast19210484
Ref: 581719210484
Ref: c-api/frame c PyFrame_FastToLocals19210983
Ref: 581819210983
Ref: c-api/frame c PyFrame_FastToLocalsWithError19211399
Ref: 581919211399
Ref: Legacy local variable APIs-Footnote-119211809
Node: Internal frames19211851
Ref: c-api/frame internal-frames19211978
Ref: 581a19211978
Ref: c-api/frame c _PyInterpreterFrame19212081
Ref: 1ba019212081
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetCode19212207
Ref: 581b19212207
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetLasti19212698
Ref: 581c19212698
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetLine19213144
Ref: 581d19213144
Ref: Internal frames-Footnote-119213649
Node: ジェネレータオブジェクト19213691
Ref: c-api/gen doc19213891
Ref: 581e19213891
Ref: c-api/gen gen-objects19213891
Ref: 581f19213891
Ref: c-api/gen generator-objects19213891
Ref: 582019213891
Ref: c-api/gen translation-repo19213891
Ref: 582119213891
Ref: c-api/gen c PyGenObject19214363
Ref: 582419214363
Ref: c-api/gen c PyGen_Type19214489
Ref: 582519214489
Ref: c-api/gen c PyGen_Check19214628
Ref: 582619214628
Ref: c-api/gen c PyGen_CheckExact19214856
Ref: 582719214856
Ref: c-api/gen c PyGen_New19215081
Ref: 582219215081
Ref: c-api/gen c PyGen_NewWithQualName19215430
Ref: 582319215430
Ref: c-api/gen c PyGen_GetCode19215921
Ref: 582819215921
Node: Asynchronous Generator Objects19216202
Ref: c-api/gen asynchronous-generator-objects19216331
Ref: 582919216331
Ref: c-api/gen c PyAsyncGen_Type19216439
Ref: 582a19216439
Ref: c-api/gen c PyAsyncGen_New19216684
Ref: 582b19216684
Ref: c-api/gen c PyAsyncGen_CheckExact19217227
Ref: 582c19217227
Ref: Asynchronous Generator Objects-Footnote-119217467
Node: Deprecated API<4>19217509
Ref: c-api/gen deprecated-api19217638
Ref: 582d19217638
Ref: c-api/gen c PyAsyncGenASend_CheckExact19217689
Ref: 582e19217689
Node: コルーチンオブジェクト<2>19217928
Ref: c-api/coro doc19218130
Ref: 582f19218130
Ref: c-api/coro coro-objects19218130
Ref: 128119218130
Ref: c-api/coro coroutine-objects19218130
Ref: 583019218130
Ref: c-api/coro translation-repo19218130
Ref: 583119218130
Ref: c-api/coro c PyCoroObject19218364
Ref: 583219218364
Ref: c-api/coro c PyCoro_Type19218473
Ref: 583319218473
Ref: c-api/coro c PyCoro_CheckExact19218604
Ref: 583419218604
Ref: c-api/coro c PyCoro_New19218832
Ref: 583519218832
Node: コンテキスト変数オブジェクト19219312
Ref: c-api/contextvars doc19219520
Ref: 583619219520
Ref: c-api/contextvars context-variables-objects19219520
Ref: 583719219520
Ref: c-api/contextvars contextvarsobjects19219520
Ref: ec219219520
Ref: c-api/contextvars translation-repo19219520
Ref: 583819219520
Ref: c-api/contextvars contextvarsobjects-pointertype-change19219613
Ref: fe719219613
Ref: c-api/contextvars c PyContext19220275
Ref: 583919220275
Ref: c-api/contextvars c PyContextVar19220416
Ref: 583a19220416
Ref: c-api/contextvars c PyContextToken19220563
Ref: 583b19220563
Ref: c-api/contextvars c PyContext_Type19220707
Ref: 583c19220707
Ref: c-api/contextvars c PyContextVar_Type19220832
Ref: 583d19220832
Ref: c-api/contextvars c PyContextToken_Type19220966
Ref: 583e19220966
Ref: c-api/contextvars c PyContext_CheckExact19221141
Ref: 583f19221141
Ref: c-api/contextvars c PyContextVar_CheckExact19221372
Ref: 584019221372
Ref: c-api/contextvars c PyContextToken_CheckExact19221609
Ref: 584119221609
Ref: c-api/contextvars c PyContext_New19221910
Ref: 584219221910
Ref: c-api/contextvars c PyContext_Copy19222148
Ref: 584319222148
Ref: c-api/contextvars c PyContext_CopyCurrent19222418
Ref: 584419222418
Ref: c-api/contextvars c PyContext_Enter19222676
Ref: 584519222676
Ref: c-api/contextvars c PyContext_Exit19222897
Ref: 584619222897
Ref: c-api/contextvars c PyContext_AddWatcher19223188
Ref: 1bbe19223188
Ref: c-api/contextvars c PyContext_ClearWatcher19223573
Ref: 1bbf19223573
Ref: c-api/contextvars c PyContextEvent19223940
Ref: 584719223940
Ref: c-api/contextvars c PyContext_WatchCallback19224346
Ref: 584819224346
Ref: c-api/contextvars c PyContextVar_New19225282
Ref: 584919225282
Ref: c-api/contextvars c PyContextVar_Get19225784
Ref: 584a19225784
Ref: c-api/contextvars c PyContextVar_Set19226621
Ref: 584b19226621
Ref: c-api/contextvars c PyContextVar_Reset19226983
Ref: 584c19226983
Ref: コンテキスト変数オブジェクト-Footnote-119227356
Node: 型ヒントのためのオブジェクト19227421
Ref: c-api/typehints doc19227584
Ref: 584d19227584
Ref: c-api/typehints objects-for-type-hinting19227584
Ref: 584e19227584
Ref: c-api/typehints translation-repo19227584
Ref: 584f19227584
Ref: c-api/typehints typehintobjects19227584
Ref: 585019227584
Ref: c-api/typehints c Py_GenericAlias19227851
Ref: 547e19227851
Ref: c-api/typehints c Py_GenericAliasType19229431
Ref: 547f19229431
Node: C API for extension modules19229757
Ref: c-api/concrete c-api-for-extension-modules19229913
Ref: 585119229913
Node: Curses C API19230127
Ref: c-api/curses doc19230225
Ref: 585219230225
Ref: c-api/curses curses-c-api19230225
Ref: 585319230225
Ref: c-api/curses c import_curses19230712
Ref: 585419230712
Ref: c-api/curses c PyCurses_API19231191
Ref: 585519231191
Ref: c-api/curses c PyCurses_API_pointers19232148
Ref: 585a19232148
Ref: c-api/curses c PyCursesWindow_Type19232331
Ref: 585619232331
Ref: c-api/curses c PyCursesWindow_Check19232472
Ref: 585b19232472
Ref: c-api/curses c PyCursesSetupTermCalled19232804
Ref: 585719232804
Ref: c-api/curses c PyCursesInitialised19233218
Ref: 585819233218
Ref: c-api/curses c PyCursesInitialisedColor19233622
Ref: 585919233622
Node: Internal data19234048
Ref: c-api/curses internal-data19234185
Ref: 585c19234185
Ref: c-api/curses c PyCurses_CAPSULE_NAME19234320
Ref: 585d19234320
Node: DateTime オブジェクト<2>19234512
Ref: c-api/datetime doc19234653
Ref: 585e19234653
Ref: c-api/datetime datetime-objects19234653
Ref: 585f19234653
Ref: c-api/datetime datetimeobjects19234653
Ref: 55de19234653
Ref: c-api/datetime translation-repo19234653
Ref: 586019234653
Ref: c-api/datetime c PyDateTime_IMPORT19235330
Ref: 3a719235330
Ref: c-api/datetime c PyDateTime_CAPI19235852
Ref: 586219235852
Ref: c-api/datetime c PyDateTimeAPI19236101
Ref: 586119236101
Ref: c-api/datetime c PyDateTime_Date19236491
Ref: 586319236491
Ref: c-api/datetime c PyDateTime_DateTime19236652
Ref: 586419236652
Ref: c-api/datetime c PyDateTime_Time19236820
Ref: 586519236820
Ref: c-api/datetime c PyDateTime_Delta19236983
Ref: 586619236983
Ref: c-api/datetime c PyDateTime_DateType19237143
Ref: 586719237143
Ref: c-api/datetime c PyDateTime_DateTimeType19237406
Ref: 586819237406
Ref: c-api/datetime c PyDateTime_TimeType19237684
Ref: 586919237684
Ref: c-api/datetime c PyDateTime_DeltaType19237947
Ref: 586a19237947
Ref: c-api/datetime c PyDateTime_TZInfoType19238218
Ref: 586b19238218
Ref: c-api/datetime c PyDateTime_TimeZone_UTC19238566
Ref: f8519238566
Ref: c-api/datetime c PyDate_Check19238846
Ref: 586c19238846
Ref: c-api/datetime c PyDate_CheckExact19239155
Ref: 586d19239155
Ref: c-api/datetime c PyDateTime_Check19239390
Ref: 586e19239390
Ref: c-api/datetime c PyDateTime_CheckExact19239717
Ref: 586f19239717
Ref: c-api/datetime c PyTime_Check19239960
Ref: 587019239960
Ref: c-api/datetime c PyTime_CheckExact19240269
Ref: 587119240269
Ref: c-api/datetime c PyDelta_Check19240504
Ref: 587219240504
Ref: c-api/datetime c PyDelta_CheckExact19240822
Ref: 587319240822
Ref: c-api/datetime c PyTZInfo_Check19241059
Ref: 587419241059
Ref: c-api/datetime c PyTZInfo_CheckExact19241380
Ref: 587519241380
Ref: c-api/datetime c PyDate_FromDate19241688
Ref: 587619241688
Ref: c-api/datetime c PyDateTime_FromDateAndTime19241921
Ref: 587719241921
Ref: c-api/datetime c PyDateTime_FromDateAndTimeAndFold19242262
Ref: 587819242262
Ref: c-api/datetime c PyTime_FromTime19242660
Ref: 587919242660
Ref: c-api/datetime c PyTime_FromTimeAndFold19242931
Ref: 587a19242931
Ref: c-api/datetime c PyDelta_FromDSU19243255
Ref: 587b19243255
Ref: c-api/datetime c PyTimeZone_FromOffset19243669
Ref: f8319243669
Ref: c-api/datetime c PyTimeZone_FromOffsetAndName19243984
Ref: f8419243984
Ref: c-api/datetime c PyDateTime_GET_YEAR19244702
Ref: 587c19244702
Ref: c-api/datetime c PyDateTime_GET_MONTH19244808
Ref: 587d19244808
Ref: c-api/datetime c PyDateTime_GET_DAY19244931
Ref: 587e19244931
Ref: c-api/datetime c PyDateTime_DATE_GET_HOUR19245375
Ref: 587f19245375
Ref: c-api/datetime c PyDateTime_DATE_GET_MINUTE19245506
Ref: 588019245506
Ref: c-api/datetime c PyDateTime_DATE_GET_SECOND19245639
Ref: 588119245639
Ref: c-api/datetime c PyDateTime_DATE_GET_MICROSECOND19245772
Ref: 588219245772
Ref: c-api/datetime c PyDateTime_DATE_GET_FOLD19245936
Ref: 588319245936
Ref: c-api/datetime c PyDateTime_DATE_GET_TZINFO19246173
Ref: c6f19246173
Ref: c-api/datetime c PyDateTime_TIME_GET_HOUR19246670
Ref: 588419246670
Ref: c-api/datetime c PyDateTime_TIME_GET_MINUTE19246797
Ref: 588519246797
Ref: c-api/datetime c PyDateTime_TIME_GET_SECOND19246926
Ref: 588619246926
Ref: c-api/datetime c PyDateTime_TIME_GET_MICROSECOND19247055
Ref: 588719247055
Ref: c-api/datetime c PyDateTime_TIME_GET_FOLD19247205
Ref: 588819247205
Ref: c-api/datetime c PyDateTime_TIME_GET_TZINFO19247438
Ref: c7019247438
Ref: c-api/datetime c PyDateTime_DELTA_GET_DAYS19247932
Ref: 588919247932
Ref: c-api/datetime c PyDateTime_DELTA_GET_SECONDS19248108
Ref: 588a19248108
Ref: c-api/datetime c PyDateTime_DELTA_GET_MICROSECONDS19248274
Ref: 588b19248274
Ref: c-api/datetime c PyDateTime_FromTimestamp19248536
Ref: 588c19248536
Ref: c-api/datetime c PyDate_FromTimestamp19248830
Ref: 1fff19248830
Node: Internal data<2>19249112
Ref: c-api/datetime internal-data19249231
Ref: 588d19249231
Ref: c-api/datetime c PyDateTime_CAPSULE_NAME19249366
Ref: 588e19249366
Node: インタープリタの初期化と終了処理19249565
Ref: c-api/interp-lifecycle doc19249792
Ref: 588f19249792
Ref: c-api/interp-lifecycle initialization19249792
Ref: 589019249792
Ref: c-api/interp-lifecycle interpreter-initialization-and-finalization19249792
Ref: 589119249792
Ref: c-api/interp-lifecycle translation-repo19249792
Ref: 589219249792
Node: Before Python initialization19250308
Ref: c-api/interp-lifecycle before-python-initialization19250460
Ref: 589319250460
Ref: c-api/interp-lifecycle pre-init-safe19250460
Ref: f8719250460
Node: グローバルな設定変数19252867
Ref: c-api/interp-lifecycle global-conf-vars19253079
Ref: 589419253079
Ref: c-api/interp-lifecycle global-configuration-variables19253079
Ref: 589819253079
Ref: c-api/interp-lifecycle c Py_BytesWarningFlag19253698
Ref: 62119253698
Ref: c-api/interp-lifecycle c Py_DebugFlag19254354
Ref: 61319254354
Ref: c-api/interp-lifecycle c Py_DontWriteBytecodeFlag19254892
Ref: 62619254892
Ref: c-api/interp-lifecycle c Py_FrozenFlag19255466
Ref: 62219255466
Ref: c-api/interp-lifecycle c Py_HashRandomizationFlag19255886
Ref: 62c19255886
Ref: c-api/interp-lifecycle c Py_IgnoreEnvironmentFlag19256526
Ref: 62419256526
Ref: c-api/interp-lifecycle c Py_InspectFlag19257053
Ref: 61b19257053
Ref: c-api/interp-lifecycle c Py_InteractiveFlag19257774
Ref: 61919257774
Ref: c-api/interp-lifecycle c Py_IsolatedFlag19258123
Ref: 62f19258123
Ref: c-api/interp-lifecycle c Py_LegacyWindowsFSEncodingFlag19258721
Ref: 63119258721
Ref: c-api/interp-lifecycle c Py_LegacyWindowsStdioFlag19259540
Ref: 63319259540
Ref: c-api/interp-lifecycle c Py_NoSiteFlag19260243
Ref: 61f19260243
Ref: c-api/interp-lifecycle c Py_NoUserSiteDirectory19260958
Ref: 62819260958
Ref: c-api/interp-lifecycle c Py_OptimizeFlag19261521
Ref: 61d19261521
Ref: c-api/interp-lifecycle c Py_QuietFlag19261923
Ref: 61719261923
Ref: c-api/interp-lifecycle c Py_UnbufferedStdioFlag19262411
Ref: 62a19262411
Ref: c-api/interp-lifecycle c Py_VerboseFlag19262916
Ref: 61519262916
Ref: グローバルな設定変数-Footnote-119263807
Ref: グローバルな設定変数-Footnote-219263849
Node: インタープリタの初期化と終了処理<2>19263891
Ref: c-api/interp-lifecycle initializing-and-finalizing-the-interpreter19264118
Ref: 589919264118
Ref: c-api/interp-lifecycle c Py_Initialize19264215
Ref: 67a19264215
Ref: c-api/interp-lifecycle c Py_InitializeEx19265478
Ref: 548619265478
Ref: c-api/interp-lifecycle c Py_InitializeFromConfig19265963
Ref: 61119265963
Ref: c-api/interp-lifecycle c Py_IsInitialized19266390
Ref: 194019266390
Ref: c-api/interp-lifecycle c Py_IsFinalizing19267039
Ref: 7f919267039
Ref: c-api/interp-lifecycle c Py_FinalizeEx19267316
Ref: 10d319267316
Ref: c-api/interp-lifecycle c Py_Finalize19270810
Ref: 67919270810
Ref: c-api/interp-lifecycle c Py_BytesMain19271026
Ref: d8d19271026
Ref: c-api/interp-lifecycle c Py_Main19271375
Ref: fe619271375
Ref: c-api/interp-lifecycle c Py_RunMain19273749
Ref: d9119273749
Ref: c-api/interp-lifecycle c PyUnstable_AtExit19275321
Ref: 1b3819275321
Node: Cautions regarding interpreter finalization19275984
Ref: c-api/interp-lifecycle cautions-regarding-interpreter-finalization19276198
Ref: 589f19276198
Ref: c-api/interp-lifecycle cautions-regarding-runtime-finalization19276198
Ref: 58a019276198
Ref: c-api/interp-lifecycle interpreter-guards19277591
Ref: 1ad19277591
Ref: c-api/interp-lifecycle c PyInterpreterGuard19277680
Ref: 537419277680
Ref: c-api/interp-lifecycle c PyInterpreterGuard_FromCurrent19278765
Ref: 537619278765
Ref: c-api/interp-lifecycle c PyInterpreterGuard_FromView19280306
Ref: 537719280306
Ref: c-api/interp-lifecycle c PyInterpreterGuard_Close19281084
Ref: 537519281084
Ref: Cautions regarding interpreter finalization-Footnote-119281811
Node: Interpreter views19281853
Ref: c-api/interp-lifecycle id119282055
Ref: 58a119282055
Ref: c-api/interp-lifecycle interpreter-views19282055
Ref: 1ae19282055
Ref: c-api/interp-lifecycle c PyInterpreterView19282238
Ref: 537a19282238
Ref: c-api/interp-lifecycle c PyInterpreterView_FromCurrent19282582
Ref: 537c19282582
Ref: c-api/interp-lifecycle c PyInterpreterView_Close19283198
Ref: 537b19283198
Ref: c-api/interp-lifecycle c PyInterpreterView_FromMain19283764
Ref: 537d19283764
Node: プロセスワイドのパラメータ19284857
Ref: c-api/interp-lifecycle process-wide-parameters19285007
Ref: 58a319285007
Ref: c-api/interp-lifecycle c Py_SetProgramName19285089
Ref: 1bdf19285089
Ref: c-api/interp-lifecycle c Py_GetVersion19286271
Ref: 548419286271
Ref: c-api/interp-lifecycle c Py_GetPlatform19287103
Ref: 548219287103
Ref: c-api/interp-lifecycle c Py_GetCopyright19287936
Ref: 548119287936
Ref: c-api/interp-lifecycle c Py_GetCompiler19288471
Ref: 548019288471
Ref: c-api/interp-lifecycle c Py_GetBuildInfo19289041
Ref: 17ea19289041
Ref: c-api/interp-lifecycle c PySys_SetArgvEx19289571
Ref: 1be019289571
Ref: c-api/interp-lifecycle c PySys_SetArgv19292421
Ref: 1be119292421
Ref: c-api/interp-lifecycle c Py_SetPythonHome19293438
Ref: 1bde19293438
Ref: プロセスワイドのパラメータ-Footnote-119294403
Node: Thread states and the global interpreter lock19294458
Ref: c-api/threads doc19294661
Ref: 58a419294661
Ref: c-api/threads thread-states-and-the-global-interpreter-lock19294661
Ref: 58a519294661
Ref: c-api/threads threads19294661
Ref: 58a619294661
Ref: c-api/threads translation-repo19294661
Ref: 58a719294661
Node: Detaching the thread state from extension code19297722
Ref: c-api/threads detaching-the-thread-state-from-extension-code19297895
Ref: 58a919297895
Ref: c-api/threads detaching-thread-state19297895
Ref: 58a819297895
Node: APIs19300432
Ref: c-api/threads apis19300519
Ref: 58aa19300519
Ref: c-api/threads c Py_BEGIN_ALLOW_THREADS19300811
Ref: 51e319300811
Ref: c-api/threads c Py_END_ALLOW_THREADS19301312
Ref: e5219301312
Ref: c-api/threads c Py_BLOCK_THREADS19301797
Ref: 547a19301797
Ref: c-api/threads c Py_UNBLOCK_THREADS19302060
Ref: 549c19302060
Ref: c-api/threads non-python-created-threads19302327
Ref: 58ab19302327
Node: Using the C API from foreign threads19302328
Ref: c-api/threads c-api-foreign-threads19302524
Ref: 58ac19302524
Ref: c-api/threads using-the-c-api-from-foreign-threads19302524
Ref: 58ad19302524
Ref: Using the C API from foreign threads-Footnote-119305102
Node: Attaching/detaching thread states19305144
Ref: c-api/threads attaching-detaching-thread-states19305250
Ref: 58ae19305250
Ref: c-api/threads c-api-attach-detach19305250
Ref: 1af19305250
Ref: c-api/threads c PyThreadState_Ensure19305337
Ref: 540c19305337
Ref: c-api/threads c PyThreadState_EnsureFromView19308059
Ref: 540d19308059
Ref: c-api/threads c PyThreadState_Release19308679
Ref: 541019308679
Ref: c-api/threads c PyThreadStateToken19309887
Ref: 540b19309887
Ref: c-api/threads legacy-api19310213
Ref: 58af19310213
Node: GIL-state APIs19310214
Ref: c-api/threads gil-state-apis19310383
Ref: 58b019310383
Ref: c-api/threads gilstate19310383
Ref: 58b119310383
Ref: c-api/threads c PyGILState_STATE19310727
Ref: 536719310727
Ref: c-api/threads c PyGILState_STATE PyGILState_LOCKED19310948
Ref: 58b219310948
Ref: c-api/threads c PyGILState_STATE PyGILState_UNLOCKED19311096
Ref: 58b319311096
Ref: c-api/threads c PyGILState_Ensure19311242
Ref: 1b019311242
Ref: c-api/threads c PyGILState_Release19313763
Ref: 1b119313763
Ref: c-api/threads c PyGILState_GetThisThreadState19314453
Ref: 536619314453
Ref: c-api/threads c PyGILState_Check19315247
Ref: 58b419315247
Node: Cautions about fork19315896
Ref: c-api/threads cautions-about-fork19316042
Ref: 58b519316042
Ref: c-api/threads fork-and-threads19316042
Ref: 558b19316042
Node: 高水準 API19317952
Ref: c-api/threads high-level-apis19318097
Ref: 58b619318097
Ref: c-api/threads c PyThreadState19318233
Ref: b7119318233
Ref: c-api/threads c PyThreadState interp19318465
Ref: 58b719318465
Ref: c-api/threads c PyEval_InitThreads19318580
Ref: 1be219318580
Ref: c-api/threads c PyEval_SaveThread19319260
Ref: 83e19319260
Ref: c-api/threads c PyEval_RestoreThread19319515
Ref: 83f19319515
Ref: c-api/threads c PyThreadState_Get19320285
Ref: 80f19320285
Ref: c-api/threads c PyThreadState_GetUnchecked19320719
Ref: 63d19320719
Ref: c-api/threads c PyThreadState_Swap19321104
Ref: 541119321104
Node: 低水準 API19321772
Ref: c-api/threads low-level-apis19321889
Ref: 58b819321889
Ref: c-api/threads c PyThreadState_New19321929
Ref: 540f19321929
Ref: c-api/threads c PyThreadState_Clear19322222
Ref: 1bbd19322222
Ref: c-api/threads c PyThreadState_Delete19322731
Ref: 1f9a19322731
Ref: c-api/threads c PyThreadState_DeleteCurrent19323060
Ref: 1fc719323060
Ref: c-api/threads c PyThreadState_GetFrame19323373
Ref: b7219323373
Ref: c-api/threads c PyThreadState_GetID19323871
Ref: d3f19323871
Ref: c-api/threads c PyThreadState_GetInterpreter19324223
Ref: d3e19324223
Ref: c-api/threads c PyThreadState_EnterTracing19324580
Ref: b3d19324580
Ref: c-api/threads c PyThreadState_LeaveTracing19324840
Ref: b3e19324840
Ref: c-api/threads c PyUnstable_ThreadState_SetStackProtection19325185
Ref: 39d19325185
Ref: c-api/threads c PyUnstable_ThreadState_ResetStackProtection19326735
Ref: 39e19326735
Ref: c-api/threads c PyThreadState_GetDict19327339
Ref: 540e19327339
Ref: c-api/threads c PyEval_AcquireThread19327897
Ref: 84019327897
Ref: c-api/threads c PyEval_ReleaseThread19329095
Ref: 531719329095
Node: Asynchronous notifications19329602
Ref: c-api/threads asynchronous-notifications19329785
Ref: 58b919329785
Ref: c-api/threads c Py_AddPendingCall19330073
Ref: d4d19330073
Ref: c-api/threads c Py_MakePendingCalls19332549
Ref: 548719332549
Ref: c-api/threads c PyThreadState_SetAsyncExc19333172
Ref: f8619333172
Node: Operating system thread APIs19334443
Ref: c-api/threads operating-system-thread-apis19334608
Ref: 58ba19334608
Ref: c-api/threads c PYTHREAD_INVALID_THREAD_ID19334677
Ref: 58bb19334677
Ref: c-api/threads c PyThread_start_new_thread19334835
Ref: 203719334835
Ref: c-api/threads c PyThread_get_thread_ident19335400
Ref: 541919335400
Ref: c-api/threads c PyThread_GetInfo19335848
Ref: 541219335848
Ref: c-api/threads c PY_HAVE_THREAD_NATIVE_ID19336413
Ref: 58bc19336413
Ref: c-api/threads c PyThread_get_thread_native_id19336531
Ref: 1dbb19336531
Ref: c-api/threads c PyThread_exit_thread19337118
Ref: 541619337118
Ref: c-api/threads c PyThread_init_thread19338146
Ref: 541a19338146
Ref: c-api/threads c PyThread_set_stacksize19338398
Ref: 541c19338398
Ref: c-api/threads c PyThread_get_stacksize19338850
Ref: 541819338850
Ref: Operating system thread APIs-Footnote-119339195
Node: 同期プリミティブ<3>19339247
Ref: c-api/synchronization doc19339414
Ref: 58bd19339414
Ref: c-api/synchronization synchronization19339414
Ref: 58be19339414
Ref: c-api/synchronization synchronization-primitives19339414
Ref: 58bf19339414
Ref: c-api/synchronization translation-repo19339414
Ref: 58c019339414
Ref: c-api/synchronization c PyMutex19339518
Ref: 69919339518
Ref: c-api/synchronization c PyMutex_Lock19340153
Ref: 7cf19340153
Ref: c-api/synchronization c PyMutex_Unlock19340502
Ref: 7d019340502
Ref: c-api/synchronization c PyMutex_IsLocked19340728
Ref: 67d19340728
Node: Python critical section API19341231
Ref: c-api/synchronization id119341350
Ref: 58c119341350
Ref: c-api/synchronization python-critical-section-api19341350
Ref: 294019341350
Ref: c-api/synchronization critical-section-macros19343950
Ref: 58c219343950
Ref: c-api/synchronization c Py_BEGIN_CRITICAL_SECTION19343950
Ref: 547819343950
Ref: c-api/synchronization c Py_BEGIN_CRITICAL_SECTION_MUTEX19344490
Ref: 58c319344490
Ref: c-api/synchronization c Py_END_CRITICAL_SECTION19345022
Ref: 547c19345022
Ref: c-api/synchronization c Py_BEGIN_CRITICAL_SECTION219345475
Ref: 547919345475
Ref: c-api/synchronization c Py_BEGIN_CRITICAL_SECTION2_MUTEX19346100
Ref: 58c419346100
Ref: c-api/synchronization c Py_END_CRITICAL_SECTION219346716
Ref: 547d19346716
Node: Low-level critical section API19347218
Ref: c-api/synchronization low-level-critical-section-api19347312
Ref: 58c519347312
Ref: c-api/synchronization c PyCriticalSection_Begin19347486
Ref: 52e619347486
Ref: c-api/synchronization c PyCriticalSection_End19347579
Ref: 52e719347579
Ref: c-api/synchronization c PyCriticalSection2_Begin19347646
Ref: 52e419347646
Ref: c-api/synchronization c PyCriticalSection2_End19347753
Ref: 52e519347753
Ref: c-api/synchronization c PyCriticalSection19348124
Ref: 37019348124
Ref: c-api/synchronization c PyCriticalSection219348170
Ref: 52e319348170
Ref: c-api/synchronization c PyCriticalSection_BeginMutex19348584
Ref: 58c619348584
Ref: c-api/synchronization c PyCriticalSection2_BeginMutex19348681
Ref: 58c719348681
Node: Legacy locking APIs19349013
Ref: c-api/synchronization legacy-locking-apis19349132
Ref: 58c819349132
Ref: c-api/synchronization c PyThread_type_lock19349366
Ref: 58c919349366
Ref: c-api/synchronization c PyLockStatus19349458
Ref: 58ca19349458
Ref: c-api/synchronization c PY_LOCK_FAILURE19349553
Ref: 58cb19349553
Ref: c-api/synchronization c PY_LOCK_ACQUIRED19349643
Ref: 58cc19349643
Ref: c-api/synchronization c PY_LOCK_INTR19349742
Ref: 58cd19349742
Ref: c-api/synchronization c PyThread_allocate_lock19349839
Ref: 541519349839
Ref: c-api/synchronization c PyThread_free_lock19350378
Ref: 541719350378
Ref: c-api/synchronization c PyThread_acquire_lock_timed19350662
Ref: 541419350662
Ref: c-api/synchronization c PyThread_acquire_lock19351666
Ref: 541319351666
Ref: c-api/synchronization c PyThread_release_lock19352435
Ref: 541b19352435
Node: Thread-local storage support19352724
Ref: c-api/tls doc19352904
Ref: 58ce19352904
Ref: c-api/tls thread-local-storage19352904
Ref: 58cf19352904
Ref: c-api/tls thread-local-storage-support19352904
Ref: 58d019352904
Ref: c-api/tls translation-repo19352904
Ref: 58d119352904
Node: Thread-specific storage API19354149
Ref: c-api/tls id119354268
Ref: 58d219354268
Ref: c-api/tls thread-specific-storage-api19354268
Ref: ea719354268
Ref: c-api/tls c Py_tss_t19354689
Ref: ea819354689
Ref: c-api/tls c Py_tss_NEEDS_INIT19355217
Ref: 58d319355217
Ref: Thread-specific storage API-Footnote-119355479
Node: Dynamic allocation19355521
Ref: c-api/tls dynamic-allocation19355664
Ref: 58d419355664
Ref: c-api/tls c PyThread_tss_alloc19355984
Ref: 65219355984
Ref: c-api/tls c PyThread_tss_free19356297
Ref: 65419356297
Node: メソッド<2>19356801
Ref: c-api/tls methods19356928
Ref: 58d519356928
Ref: c-api/tls c PyThread_tss_is_created19357234
Ref: 541e19357234
Ref: c-api/tls c PyThread_tss_create19357504
Ref: 541d19357504
Ref: c-api/tls c PyThread_tss_delete19358000
Ref: 65a19358000
Ref: c-api/tls c PyThread_tss_set19358509
Ref: 65619358509
Ref: c-api/tls c PyThread_tss_get19358847
Ref: 65819358847
Node: Legacy APIs19359159
Ref: c-api/tls legacy-apis19359259
Ref: 58d619359259
Ref: c-api/tls thread-local-storage-api19359259
Ref: ea619359259
Ref: c-api/tls c PyThread_create_key19359879
Ref: 65119359879
Ref: c-api/tls c PyThread_delete_key19359975
Ref: 65319359975
Ref: c-api/tls c PyThread_set_key_value19360079
Ref: 65519360079
Ref: c-api/tls c PyThread_get_key_value19360198
Ref: 65719360198
Ref: c-api/tls c PyThread_delete_key_value19360306
Ref: 65919360306
Ref: c-api/tls c PyThread_ReInitTLS19360416
Ref: 65b19360416
Node: Multiple interpreters in a Python process19360512
Ref: c-api/subinterpreters doc19360686
Ref: 58d719360686
Ref: c-api/subinterpreters multiple-interpreters-in-a-python-process19360686
Ref: 58d819360686
Ref: c-api/subinterpreters sub-interpreter-support19360686
Ref: 41719360686
Ref: c-api/subinterpreters translation-repo19360686
Ref: 58d919360686
Ref: c-api/subinterpreters c PyInterpreterConfig19361937
Ref: 97819361937
Ref: c-api/subinterpreters c PyInterpreterConfig use_main_obmalloc19362243
Ref: 4c0b19362243
Ref: c-api/subinterpreters c PyInterpreterConfig allow_fork19362691
Ref: 58dd19362691
Ref: c-api/subinterpreters c PyInterpreterConfig allow_exec19363037
Ref: 58de19363037
Ref: c-api/subinterpreters c PyInterpreterConfig allow_threads19363443
Ref: 58df19363443
Ref: c-api/subinterpreters c PyInterpreterConfig allow_daemon_threads19363642
Ref: 58e019363642
Ref: c-api/subinterpreters c PyInterpreterConfig check_multi_interp_extensions19363934
Ref: 58da19363934
Ref: c-api/subinterpreters c PyInterpreterConfig gil19364469
Ref: 58db19364469
Ref: c-api/subinterpreters c PyInterpreterConfig_DEFAULT_GIL19364629
Ref: 58e119364629
Ref: c-api/subinterpreters c PyInterpreterConfig_SHARED_GIL19364796
Ref: 58e219364796
Ref: c-api/subinterpreters c PyInterpreterConfig_OWN_GIL19364914
Ref: 58dc19364914
Ref: c-api/subinterpreters c Py_NewInterpreterFromConfig19365170
Ref: 87b19365170
Ref: c-api/subinterpreters c Py_NewInterpreter19370066
Ref: 1d4e19370066
Ref: c-api/subinterpreters c Py_EndInterpreter19370549
Ref: 1a8f19370549
Ref: Multiple interpreters in a Python process-Footnote-119371276
Node: A per-interpreter GIL19371318
Ref: c-api/subinterpreters a-per-interpreter-gil19371447
Ref: 58e419371447
Ref: c-api/subinterpreters per-interpreter-gil19371447
Ref: 58e519371447
Ref: A per-interpreter GIL-Footnote-119373503
Ref: A per-interpreter GIL-Footnote-219373545
Node: バグと注意事項19373587
Ref: c-api/subinterpreters bugs-and-caveats19373741
Ref: 58e319373741
Node: 高水準 API<2>19375556
Ref: c-api/subinterpreters high-level-apis19375705
Ref: 58e619375705
Ref: c-api/subinterpreters c PyInterpreterState19375745
Ref: c9419375745
Ref: c-api/subinterpreters c PyInterpreterState_Get19376829
Ref: 84119376829
Ref: c-api/subinterpreters c PyInterpreterState_GetID19377167
Ref: f8819377167
Ref: c-api/subinterpreters c PyInterpreterState_GetDict19377602
Ref: 537919377602
Ref: c-api/subinterpreters c _PyFrameEvalFunction19378492
Ref: b5d19378492
Ref: c-api/subinterpreters c _PyInterpreterState_GetEvalFrameFunc19379067
Ref: 1f8a19379067
Ref: c-api/subinterpreters c _PyInterpreterState_SetEvalFrameFunc19379342
Ref: 1f8b19379342
Ref: c-api/subinterpreters c _PyInterpreterState_SetEvalFrameAllowSpecialization19379612
Ref: 58e719379612
Ref: c-api/subinterpreters c _PyInterpreterState_IsSpecializationEnabled19380341
Ref: 58e819380341
Ref: 高水準 API<2>-Footnote-119380733
Ref: 高水準 API<2>-Footnote-219380775
Ref: 高水準 API<2>-Footnote-319380817
Node: 低水準 API<2>19380859
Ref: c-api/subinterpreters low-level-apis19381012
Ref: 58e919381012
Ref: c-api/subinterpreters c PyInterpreterState_New19381301
Ref: 49bb19381301
Ref: c-api/subinterpreters c PyInterpreterState_Clear19381735
Ref: 49ba19381735
Ref: c-api/subinterpreters c PyInterpreterState_Delete19382121
Ref: 537819382121
Node: Advanced debugger support19382514
Ref: c-api/subinterpreters advanced-debugger-support19382642
Ref: 58ea19382642
Ref: c-api/subinterpreters advanced-debugging19382642
Ref: 58eb19382642
Ref: c-api/subinterpreters c PyInterpreterState_Head19382804
Ref: 18b719382804
Ref: c-api/subinterpreters c PyInterpreterState_Main19383008
Ref: 58a219383008
Ref: c-api/subinterpreters c PyInterpreterState_Next19383164
Ref: 18b819383164
Ref: c-api/subinterpreters c PyInterpreterState_ThreadHead19383413
Ref: 18b919383413
Ref: c-api/subinterpreters c PyThreadState_Next19383721
Ref: 18ba19383721
Node: Profiling and tracing19384021
Ref: c-api/profiling doc19384184
Ref: 58ec19384184
Ref: c-api/profiling profiling19384184
Ref: 58ed19384184
Ref: c-api/profiling profiling-and-tracing19384184
Ref: 58ee19384184
Ref: c-api/profiling translation-repo19384184
Ref: 58ef19384184
Ref: c-api/profiling c Py_tracefunc19385243
Ref: 58f019385243
Ref: c-api/profiling c PyTrace_CALL19387698
Ref: 58f119387698
Ref: c-api/profiling c PyTrace_EXCEPTION19388189
Ref: 58f219388189
Ref: c-api/profiling c PyTrace_LINE19388796
Ref: 58f319388796
Ref: c-api/profiling c PyTrace_RETURN19389096
Ref: 58f419389096
Ref: c-api/profiling c PyTrace_C_CALL19389250
Ref: 58f519389250
Ref: c-api/profiling c PyTrace_C_EXCEPTION19389405
Ref: 58f619389405
Ref: c-api/profiling c PyTrace_C_RETURN19389573
Ref: 58f719389573
Ref: c-api/profiling c PyTrace_OPCODE19389727
Ref: 58f819389727
Ref: c-api/profiling c PyEval_SetProfile19390065
Ref: 18b519390065
Ref: c-api/profiling c PyEval_SetProfileAllThreads19390777
Ref: 96b19390777
Ref: c-api/profiling c PyEval_SetTrace19391307
Ref: 85619391307
Ref: c-api/profiling c PyEval_SetTraceAllThreads19392018
Ref: 85719392018
Node: Reference tracing19392533
Ref: c-api/profiling reference-tracing19392677
Ref: 58f919392677
Ref: c-api/profiling c PyRefTracer19392748
Ref: 58fa19392748
Ref: c-api/profiling c PyRefTracer_CREATE19393596
Ref: 58fb19393596
Ref: c-api/profiling c PyRefTracer_DESTROY19393758
Ref: 58fc19393758
Ref: c-api/profiling c PyRefTracer_TRACKER_REMOVED19393923
Ref: 1a6b19393923
Ref: c-api/profiling c PyRefTracer_SetTracer19394151
Ref: 80b19394151
Ref: c-api/profiling c PyRefTracer_GetTracer19395214
Ref: 80c19395214
Node: Python 初期化設定19395703
Ref: c-api/init_config doc19395841
Ref: 58fd19395841
Ref: c-api/init_config init-config19395841
Ref: 83d19395841
Ref: c-api/init_config python-initialization-configuration19395841
Ref: 58fe19395841
Ref: c-api/init_config translation-repo19395841
Ref: 58ff19395841
Node: PyInitConfig C API19396099
Ref: c-api/init_config pyinitconfig-api19396206
Ref: 5ae19396206
Ref: c-api/init_config pyinitconfig-c-api19396206
Ref: 590019396206
Ref: PyInitConfig C API-Footnote-119396835
Node: 使用例<54>19396877
Ref: c-api/init_config example19396969
Ref: 590119396969
Node: 設定の作成19398259
Ref: c-api/init_config create-config19398378
Ref: 590219398378
Ref: c-api/init_config c PyInitConfig19398424
Ref: 590319398424
Ref: c-api/init_config c PyInitConfig_Create19398539
Ref: 5bb19398539
Ref: c-api/init_config c PyInitConfig_Free19398834
Ref: 5bc19398834
Node: エラー処理<2>19399022
Ref: c-api/init_config error-handling19399139
Ref: 590519399139
Ref: c-api/init_config c PyInitConfig_GetError19399185
Ref: 5be19399185
Ref: c-api/init_config c PyInitConfig_GetExitCode19399757
Ref: 5bf19399757
Node: Get Options19400352
Ref: c-api/init_config get-options19400465
Ref: 590619400465
Ref: c-api/init_config c PyInitConfig_HasOption19400648
Ref: 5c319400648
Ref: c-api/init_config c PyInitConfig_GetInt19400877
Ref: 5c019400877
Ref: c-api/init_config c PyInitConfig_GetStr19401151
Ref: 5c119401151
Ref: c-api/init_config c PyInitConfig_GetStrList19401672
Ref: 5c219401672
Ref: c-api/init_config c PyInitConfig_FreeStrList19402148
Ref: 5bd19402148
Node: Set Options19402320
Ref: c-api/init_config set-options19402421
Ref: 590819402421
Ref: c-api/init_config c PyInitConfig_SetInt19402878
Ref: 5c419402878
Ref: c-api/init_config c PyInitConfig_SetStr19403133
Ref: 5c519403133
Ref: c-api/init_config c PyInitConfig_SetStrList19403462
Ref: 5c619403462
Node: Module19403832
Ref: c-api/init_config module19403939
Ref: 590919403939
Ref: c-api/init_config c PyInitConfig_AddModule19403972
Ref: 5b019403972
Node: Initialize Python19404640
Ref: c-api/init_config initialize-python19404727
Ref: 590a19404727
Ref: c-api/init_config c Py_InitializeFromInitConfig19404782
Ref: 5ba19404782
Node: Configuration Options19405184
Ref: c-api/init_config configuration-options19405332
Ref: 590b19405332
Ref: c-api/init_config pyinitconfig-opts19405332
Ref: 590719405332
Node: Runtime Python configuration API19426287
Ref: c-api/init_config runtime-python-configuration-api19426431
Ref: 592a19426431
Ref: c-api/init_config c PyConfig_Get19426923
Ref: 3ae19426923
Ref: c-api/init_config c PyConfig_GetInt19427576
Ref: 5b819427576
Ref: c-api/init_config c PyConfig_Names19427844
Ref: 5b919427844
Ref: c-api/init_config c PyConfig_Set19428269
Ref: 5b119428269
Node: PyConfig C API19429042
Ref: c-api/init_config pyconfig-api19429179
Ref: 5af19429179
Ref: c-api/init_config pyconfig-c-api19429179
Ref: 592b19429179
Ref: PyConfig C API-Footnote-119430658
Node: 使用例<55>19430700
Ref: c-api/init_config id119430789
Ref: 592c19430789
Node: PyWideStringList19431803
Ref: c-api/init_config pywidestringlist19431909
Ref: 592d19431909
Ref: c-api/init_config c PyWideStringList19431962
Ref: d7a19431962
Ref: c-api/init_config c PyWideStringList_Append19432227
Ref: d8b19432227
Ref: c-api/init_config c PyWideStringList_Insert19432471
Ref: d8c19432471
Ref: c-api/init_config c PyWideStringList length19432979
Ref: 592e19432979
Ref: c-api/init_config c PyWideStringList items19433074
Ref: 592f19433074
Node: PyStatus19433155
Ref: c-api/init_config pystatus19433259
Ref: 593019433259
Ref: c-api/init_config c PyStatus19433296
Ref: d7919433296
Ref: c-api/init_config c PyStatus exitcode19433560
Ref: 593119433560
Ref: c-api/init_config c PyStatus err_msg19433684
Ref: 593219433684
Ref: c-api/init_config c PyStatus func19433775
Ref: 593319433775
Ref: c-api/init_config c PyStatus_Ok19433957
Ref: d8a19433957
Ref: c-api/init_config c PyStatus_Error19434041
Ref: d8419434041
Ref: c-api/init_config c PyStatus_NoMemory19434254
Ref: d8919434254
Ref: c-api/init_config c PyStatus_Exit19434385
Ref: d8619434385
Ref: c-api/init_config c PyStatus_Exception19434565
Ref: d8519434565
Ref: c-api/init_config c PyStatus_IsError19434797
Ref: d8719434797
Ref: c-api/init_config c PyStatus_IsExit19434894
Ref: d8819434894
Ref: c-api/init_config c Py_ExitStatusException19434989
Ref: d8e19434989
Node: PyPreConfig19435959
Ref: c-api/init_config pypreconfig19436084
Ref: 593419436084
Ref: c-api/init_config c PyPreConfig19436127
Ref: d7819436127
Ref: c-api/init_config c PyPreConfig_InitPythonConfig19436263
Ref: d8319436263
Ref: c-api/init_config c PyPreConfig_InitIsolatedConfig19436452
Ref: d8219436452
Ref: c-api/init_config c PyPreConfig allocator19436677
Ref: 590c19436677
Ref: c-api/init_config c PyPreConfig configure_locale19438472
Ref: 591519438472
Ref: c-api/init_config c PyPreConfig coerce_c_locale19438845
Ref: 591219438845
Ref: c-api/init_config c PyPreConfig coerce_c_locale_warn19439176
Ref: 591319439176
Ref: c-api/init_config c PyPreConfig dev_mode19439375
Ref: 593619439375
Ref: c-api/init_config c PyPreConfig isolated19439584
Ref: 593719439584
Ref: c-api/init_config c PyPreConfig legacy_windows_fs_encoding19439759
Ref: 63219439759
Ref: c-api/init_config c PyPreConfig parse_argv19440343
Ref: 593819440343
Ref: c-api/init_config c PyPreConfig use_environment19440740
Ref: 593919440740
Ref: c-api/init_config c PyPreConfig utf8_mode19440971
Ref: 63719440971
Node: Preinitialize Python with PyPreConfig19441258
Ref: c-api/init_config c-preinit19441383
Ref: 452819441383
Ref: c-api/init_config preinitialize-python-with-pypreconfig19441383
Ref: 593a19441383
Ref: c-api/init_config c Py_PreInitialize19441876
Ref: 63819441876
Ref: c-api/init_config c Py_PreInitializeFromBytesArgs19442077
Ref: d9019442077
Ref: c-api/init_config c Py_PreInitializeFromArgs19442438
Ref: d8f19442438
Node: PyConfig19444370
Ref: c-api/init_config pyconfig19444512
Ref: 593b19444512
Ref: c-api/init_config c PyConfig19444549
Ref: 61219444549
Ref: c-api/init_config c PyConfig_InitPythonConfig19444790
Ref: d7d19444790
Ref: c-api/init_config c PyConfig_InitIsolatedConfig19444952
Ref: d7c19444952
Ref: c-api/init_config c PyConfig_SetString19445118
Ref: d8119445118
Ref: c-api/init_config c PyConfig_SetBytesString19445391
Ref: d8019445391
Ref: c-api/init_config c PyConfig_SetArgv19445722
Ref: d7e19445722
Ref: c-api/init_config c PyConfig_SetBytesArgv19446039
Ref: d7f19446039
Ref: c-api/init_config c PyConfig_SetWideStringList19446409
Ref: 1fd819446409
Ref: c-api/init_config c PyConfig_Read19446717
Ref: b7419446717
Ref: c-api/init_config c PyConfig_Clear19448055
Ref: d7b19448055
Ref: c-api/init_config c PyConfig argv19449171
Ref: 60e19449171
Ref: c-api/init_config c PyConfig safe_path19450172
Ref: b5a19450172
Ref: c-api/init_config c PyConfig base_exec_prefix19451058
Ref: 590d19451058
Ref: c-api/init_config c PyConfig base_executable19451315
Ref: 590e19451315
Ref: c-api/init_config c PyConfig base_prefix19451725
Ref: 590f19451725
Ref: c-api/init_config c PyConfig buffered_stdio19451967
Ref: 62b19451967
Ref: c-api/init_config c PyConfig bytes_warning19452392
Ref: 3cc19452392
Ref: c-api/init_config c PyConfig warn_default_encoding19453074
Ref: 592819453074
Ref: c-api/init_config c PyConfig code_debug_ranges19453397
Ref: 591119453397
Ref: c-api/init_config c PyConfig check_hash_pycs_mode19453882
Ref: 591019453882
Ref: c-api/init_config c PyConfig configure_c_stdio19454554
Ref: 591419454554
Ref: c-api/init_config c PyConfig dev_mode19455115
Ref: 591719455115
Ref: c-api/init_config c PyConfig dump_refs19455427
Ref: 591819455427
Ref: c-api/init_config c PyConfig dump_refs_file19455852
Ref: 591919455852
Ref: c-api/init_config c PyConfig exec_prefix19456113
Ref: 591a19456113
Ref: c-api/init_config c PyConfig executable19456477
Ref: 83c19456477
Ref: c-api/init_config c PyConfig faulthandler19456807
Ref: 591b19456807
Ref: c-api/init_config c PyConfig filesystem_encoding19457173
Ref: 63519457173
Ref: c-api/init_config c PyConfig filesystem_errors19458413
Ref: 63619458413
Ref: c-api/init_config c PyConfig use_frozen_modules19459095
Ref: 592719459095
Ref: c-api/init_config c PyConfig hash_seed19459380
Ref: 62e19459380
Ref: c-api/init_config c PyConfig use_hash_seed19459436
Ref: 62d19459436
Ref: c-api/init_config c PyConfig home19459855
Ref: 61019459855
Ref: c-api/init_config c PyConfig import_time19460215
Ref: 591c19460215
Ref: c-api/init_config c PyConfig inspect19460703
Ref: 61c19460703
Ref: c-api/init_config c PyConfig install_signal_handlers19461303
Ref: c9519461303
Ref: c-api/init_config c PyConfig interactive19461476
Ref: 61a19461476
Ref: c-api/init_config c PyConfig int_max_str_digits19461692
Ref: 591d19461692
Ref: c-api/init_config c PyConfig cpu_count19462593
Ref: 591619462593
Ref: c-api/init_config c PyConfig isolated19463093
Ref: 63019463093
Ref: c-api/init_config c PyConfig legacy_windows_stdio19464098
Ref: 63419464098
Ref: c-api/init_config c PyConfig malloc_stats19464736
Ref: 591e19464736
Ref: c-api/init_config c PyConfig platlibdir19465132
Ref: 1f3519465132
Ref: c-api/init_config c PyConfig pythonpath_env19465962
Ref: 593c19465962
Ref: c-api/init_config c PyConfig module_search_paths19466314
Ref: 83a19466314
Ref: c-api/init_config c PyConfig module_search_paths_set19466410
Ref: 9eb19466410
Ref: c-api/init_config c PyConfig optimization_level19466941
Ref: 61e19466941
Ref: c-api/init_config c PyConfig orig_argv19467448
Ref: c6e19467448
Ref: c-api/init_config c PyConfig parse_argv19468104
Ref: 1f0519468104
Ref: c-api/init_config c PyConfig parser_debug19469002
Ref: 61419469002
Ref: c-api/init_config c PyConfig pathconfig_warnings19469490
Ref: 62319469490
Ref: c-api/init_config c PyConfig prefix19469928
Ref: 592019469928
Ref: c-api/init_config c PyConfig program_name19470269
Ref: 60f19470269
Ref: c-api/init_config c PyConfig pycache_prefix19471013
Ref: 592119471013
Ref: c-api/init_config c PyConfig quiet19471487
Ref: 61819471487
Ref: c-api/init_config c PyConfig run_command19471763
Ref: 589b19471763
Ref: c-api/init_config c PyConfig run_filename19471952
Ref: 589c19471952
Ref: c-api/init_config c PyConfig run_module19472431
Ref: 589d19472431
Ref: c-api/init_config c PyConfig run_presite19472619
Ref: 592219472619
Ref: c-api/init_config c PyConfig show_ref_count19473147
Ref: 592319473147
Ref: c-api/init_config c PyConfig site_import19473514
Ref: 62019473514
Ref: c-api/init_config c PyConfig skip_source_first_line19474179
Ref: 592419474179
Ref: c-api/init_config c PyConfig stdio_encoding19474564
Ref: 83b19474564
Ref: c-api/init_config c PyConfig stdio_errors19474620
Ref: 4c1c19474620
Ref: c-api/init_config c PyConfig tracemalloc19475516
Ref: 592619475516
Ref: c-api/init_config c PyConfig perf_profiling19475881
Ref: 591f19475881
Ref: c-api/init_config c PyConfig stdlib_dir19476709
Ref: 592519476709
Ref: c-api/init_config c PyConfig use_environment19476880
Ref: 62519476880
Ref: c-api/init_config c PyConfig use_system_logger19477214
Ref: 248119477214
Ref: c-api/init_config c PyConfig user_site_directory19477580
Ref: 62919477580
Ref: c-api/init_config c PyConfig verbose19477987
Ref: 61619477987
Ref: c-api/init_config c PyConfig warnoptions19478607
Ref: 83819478607
Ref: c-api/init_config c PyConfig write_bytecode19479461
Ref: 62719479461
Ref: c-api/init_config c PyConfig xoptions19479930
Ref: 83919479930
Ref: c-api/init_config c PyConfig _pystats19480131
Ref: 592919480131
Ref: PyConfig-Footnote-119480815
Ref: PyConfig-Footnote-219480857
Node: Initialization with PyConfig19480899
Ref: c-api/init_config init-from-config19481026
Ref: 589a19481026
Ref: c-api/init_config initialization-with-pyconfig19481026
Ref: 593d19481026
Node: Isolated Configuration19484715
Ref: c-api/init_config init-isolated-conf19484854
Ref: 590419484854
Ref: c-api/init_config isolated-configuration19484854
Ref: 593e19484854
Node: Python Configuration19485625
Ref: c-api/init_config init-python-config19485761
Ref: 589e19485761
Ref: c-api/init_config python-configuration19485761
Ref: 593f19485761
Ref: Python Configuration-Footnote-119486397
Ref: Python Configuration-Footnote-219486439
Node: Python Path Configuration19486481
Ref: c-api/init_config init-path-config19486586
Ref: c8419486586
Ref: c-api/init_config python-path-configuration19486586
Ref: 594019486586
Node: Py_GetArgcArgv19491098
Ref: c-api/init_config py-getargcargv19491253
Ref: 594119491253
Ref: c-api/init_config c Py_GetArgcArgv19491302
Ref: 1f5419491302
Node: Multi-Phase Initialization Private Provisional API19491504
Ref: c-api/init_config multi-phase-initialization-private-provisional-api19491636
Ref: 594219491636
Ref: c-api/init_config c PyConfig _init_main19492672
Ref: 594319492672
Ref: c-api/init_config c _Py_InitializeMain19492844
Ref: 594419492844
Ref: Multi-Phase Initialization Private Provisional API-Footnote-119494849
Ref: Multi-Phase Initialization Private Provisional API-Footnote-219494891
Node: メモリ管理19494933
Ref: c-api/memory doc19495120
Ref: 594519495120
Ref: c-api/memory memory19495120
Ref: 593519495120
Ref: c-api/memory memory-management19495120
Ref: 594619495120
Ref: c-api/memory translation-repo19495120
Ref: 594719495120
Node: 概要<4>19495568
Ref: c-api/memory memoryoverview19495655
Ref: 594819495655
Ref: c-api/memory overview19495655
Ref: 594919495655
Node: Allocator Domains19501265
Ref: c-api/memory allocator-domains19501397
Ref: 594a19501397
Ref: c-api/memory id119501448
Ref: 594b19501448
Node: 生メモリインターフェース19503488
Ref: c-api/memory raw-memory-interface19503644
Ref: 595119503644
Ref: c-api/memory raw-memoryinterface19503644
Ref: 594d19503644
Ref: c-api/memory c PyMem_RawMalloc19504133
Ref: 2ca19504133
Ref: c-api/memory c PyMem_RawCalloc19504707
Ref: 82a19504707
Ref: c-api/memory c PyMem_RawRealloc19505439
Ref: 82b19505439
Ref: c-api/memory c PyMem_RawFree19506463
Ref: 82c19506463
Node: メモリインターフェース19507023
Ref: c-api/memory memory-interface19507195
Ref: 595219507195
Ref: c-api/memory memoryinterface19507195
Ref: 594e19507195
Ref: c-api/memory c PyMem_Malloc19508153
Ref: 102719508153
Ref: c-api/memory c PyMem_Calloc19508692
Ref: 126119508692
Ref: c-api/memory c PyMem_Realloc19509418
Ref: 13de19509418
Ref: c-api/memory c PyMem_Free19510407
Ref: 17fa19510407
Ref: c-api/memory c PyMem_New19511083
Ref: 18dc19511083
Ref: c-api/memory c PyMem_Resize19511326
Ref: 595319511326
Ref: c-api/memory c PyMem_Del19511843
Ref: 18dd19511843
Node: 非推奨のエイリアス<2>19512010
Ref: c-api/memory deprecated-aliases19512110
Ref: 595419512110
Ref: c-api/memory c PyMem_MALLOC19512663
Ref: 595519512663
Ref: c-api/memory c PyMem_NEW19512865
Ref: 595619512865
Ref: c-api/memory c PyMem_REALLOC19513062
Ref: 595719513062
Ref: c-api/memory c PyMem_RESIZE19513267
Ref: 595819513267
Ref: c-api/memory c PyMem_FREE19513450
Ref: 595919513450
Ref: c-api/memory c PyMem_DEL19513646
Ref: 595a19513646
Node: オブジェクトアロケータ19514020
Ref: c-api/memory object-allocators19514181
Ref: 595b19514181
Ref: c-api/memory objectinterface19514181
Ref: 594f19514181
Ref: c-api/memory c PyObject_Malloc19515110
Ref: 102a19515110
Ref: c-api/memory c PyObject_Calloc19515655
Ref: 126219515655
Ref: c-api/memory c PyObject_Realloc19516386
Ref: 17fb19516386
Ref: c-api/memory c PyObject_Free19517400
Ref: 102819517400
Node: Default Memory Allocators19518689
Ref: c-api/memory default-memory-allocators19518868
Ref: 234819518868
Ref: c-api/memory id219518868
Ref: 595d19518868
Node: メモリアロケータをカスタマイズする19522254
Ref: c-api/memory customize-memory-allocators19522443
Ref: 595c19522443
Ref: c-api/memory id319522443
Ref: 595e19522443
Ref: c-api/memory c PyMemAllocatorEx19522568
Ref: 127f19522568
Ref: c-api/memory c PyMemAllocatorDomain19524607
Ref: 594c19524607
Ref: c-api/memory c PYMEM_DOMAIN_RAW19524749
Ref: 234919524749
Ref: c-api/memory c PYMEM_DOMAIN_MEM19524994
Ref: 102b19524994
Ref: c-api/memory c PYMEM_DOMAIN_OBJ19525231
Ref: 102919525231
Ref: c-api/memory c PyMem_GetAllocator19525480
Ref: 589619525480
Ref: c-api/memory c PyMem_SetAllocator19525685
Ref: 98f19525685
Ref: c-api/memory c PyMem_SetupDebugHooks19527843
Ref: 102c19527843
Node: Debug hooks on the Python memory allocators19527994
Ref: c-api/memory debug-hooks-on-the-python-memory-allocators19528182
Ref: 595f19528182
Ref: c-api/memory pymem-debug-hooks19528182
Ref: 234b19528182
Node: pymalloc アロケータ19533496
Ref: c-api/memory pymalloc19533655
Ref: 3e119533655
Ref: c-api/memory the-pymalloc-allocator19533655
Ref: 596019533655
Node: pymalloc アリーナアロケータのカスタマイズ19535333
Ref: c-api/memory customize-pymalloc-arena-allocator19535451
Ref: 596119535451
Ref: c-api/memory c PyObjectArenaAllocator19535593
Ref: 596219535593
Ref: c-api/memory c PyObject_GetArenaAllocator19536705
Ref: 589719536705
Ref: c-api/memory c PyObject_SetArenaAllocator19536856
Ref: 589519536856
Node: The mimalloc allocator19537007
Ref: c-api/memory mimalloc19537140
Ref: 234a19537140
Ref: c-api/memory the-mimalloc-allocator19537140
Ref: 596319537140
Ref: The mimalloc allocator-Footnote-119538417
Node: tracemalloc C API19538464
Ref: c-api/memory tracemalloc-c-api19538586
Ref: 596419538586
Ref: c-api/memory c PyTraceMalloc_Track19538662
Ref: f7819538662
Ref: c-api/memory c PyTraceMalloc_Untrack19539076
Ref: f7919539076
Node: 使用例<56>19539369
Ref: c-api/memory examples19539460
Ref: 596519539460
Ref: c-api/memory memoryexamples19539460
Ref: 596619539460
Node: オブジェクト実装サポート object implementation support19541672
Ref: c-api/objimpl doc19541873
Ref: 596719541873
Ref: c-api/objimpl newtypes19541873
Ref: 596819541873
Ref: c-api/objimpl object-implementation-support19541873
Ref: 596919541873
Ref: c-api/objimpl translation-repo19541873
Ref: 596a19541873
Node: Allocating objects on the heap19542450
Ref: c-api/allocation doc19542609
Ref: 596b19542609
Ref: c-api/allocation allocating-objects19542609
Ref: 596c19542609
Ref: c-api/allocation allocating-objects-on-the-heap19542609
Ref: 596d19542609
Ref: c-api/allocation c _PyObject_New19542686
Ref: 596e19542686
Ref: c-api/allocation c _PyObject_NewVar19542798
Ref: 596f19542798
Ref: c-api/allocation c PyObject_Init19542944
Ref: e3319542944
Ref: c-api/allocation c PyObject_InitVar19543938
Ref: 1f5319543938
Ref: c-api/allocation c PyObject_New19544415
Ref: d5119544415
Ref: c-api/allocation c PyObject_NewVar19546274
Ref: d5219546274
Ref: c-api/allocation c _Py_NoneStruct19548229
Ref: 597019548229
Node: Soft-deprecated aliases19548699
Ref: c-api/allocation soft-deprecated-aliases19548789
Ref: 597119548789
Ref: c-api/allocation c PyObject_NEW19549339
Ref: 597219549339
Ref: c-api/allocation c PyObject_NEW_VAR19549542
Ref: 597319549542
Ref: c-api/allocation c PyObject_INIT19549733
Ref: 1f5119549733
Ref: c-api/allocation c PyObject_INIT_VAR19549939
Ref: 1f5219549939
Ref: c-api/allocation c PyObject_MALLOC19550127
Ref: 597419550127
Ref: c-api/allocation c PyObject_REALLOC19550333
Ref: 597519550333
Ref: c-api/allocation c PyObject_FREE19550530
Ref: 597619550530
Ref: c-api/allocation c PyObject_DEL19550729
Ref: 597719550729
Ref: c-api/allocation c PyObject_Del19550929
Ref: 188919550929
Node: Object Life Cycle19551038
Ref: c-api/lifecycle doc19551266
Ref: 597819551266
Ref: c-api/lifecycle life-cycle19551266
Ref: 597919551266
Ref: c-api/lifecycle object-life-cycle19551266
Ref: 597a19551266
Ref: c-api/lifecycle translation-repo19551266
Ref: 597b19551266
Node: Life Events19551690
Ref: c-api/lifecycle life-events19551790
Ref: 597c19551790
Node: Cyclic Isolate Destruction19557049
Ref: c-api/lifecycle cyclic-isolate-destruction19557168
Ref: 597e19557168
Ref: Cyclic Isolate Destruction-Footnote-119562416
Node: 関数<16>19562458
Ref: c-api/lifecycle functions19562557
Ref: 597f19562557
Ref: c-api/lifecycle c PyObject_CallFinalizer19562666
Ref: 598019562666
Ref: c-api/lifecycle c PyObject_CallFinalizerFromDealloc19563213
Ref: 35919563213
Node: 共通のオブジェクト構造体 common object structure19563877
Ref: c-api/structures doc19564097
Ref: 598119564097
Ref: c-api/structures common-object-structures19564097
Ref: 598219564097
Ref: c-api/structures common-structs19564097
Ref: 598319564097
Ref: c-api/structures translation-repo19564097
Ref: 598419564097
Node: Base object types and macros19564539
Ref: c-api/structures base-object-types-and-macros19564707
Ref: 598519564707
Ref: c-api/structures c PyObject19565213
Ref: 1a619565213
Ref: c-api/structures c PyObject ob_refcnt19566217
Ref: c7919566217
Ref: c-api/structures c PyObject ob_type19566713
Ref: 51f219566713
Ref: c-api/structures c PyObject ob_mutex19566970
Ref: 598619566970
Ref: c-api/structures c PyVarObject19567604
Ref: 493d19567604
Ref: c-api/structures c PyVarObject ob_base19568370
Ref: 546a19568370
Ref: c-api/structures c PyVarObject ob_size19568640
Ref: 546b19568640
Ref: c-api/structures c PyObject_HEAD19569403
Ref: 169719569403
Ref: c-api/structures c PyObject_VAR_HEAD19569756
Ref: 598819569756
Ref: c-api/structures c PyBaseObject_Type19570157
Ref: 52a919570157
Ref: c-api/structures c Py_Is19570351
Ref: c7a19570351
Ref: c-api/structures c Py_IsNone19570605
Ref: c7b19570605
Ref: c-api/structures c Py_IsTrue19570858
Ref: c7c19570858
Ref: c-api/structures c Py_IsFalse19571111
Ref: c7d19571111
Ref: c-api/structures c Py_TYPE19571367
Ref: 5fc19571367
Ref: c-api/structures c Py_IS_TYPE19571890
Ref: 19db19571890
Ref: c-api/structures c Py_SET_TYPE19572193
Ref: b6519572193
Ref: c-api/structures c Py_SIZE19572845
Ref: b6619572845
Ref: c-api/structures c Py_SET_SIZE19573218
Ref: b6719573218
Ref: c-api/structures c PyObject_HEAD_INIT19573455
Ref: 598919573455
Ref: c-api/structures c PyVarObject_HEAD_INIT19573708
Ref: 598a19573708
Node: Implementing functions and methods19573999
Ref: c-api/structures implementing-functions-and-methods19574215
Ref: 598b19574215
Ref: c-api/structures c PyCFunction19574304
Ref: 183019574304
Ref: c-api/structures c PyCFunctionWithKeywords19574963
Ref: 52bf19574963
Ref: c-api/structures c PyCFunctionFast19575409
Ref: 52bd19575409
Ref: c-api/structures c PyCFunctionFastWithKeywords19575844
Ref: 52be19575844
Ref: c-api/structures c PyCMethod19576416
Ref: b4b19576416
Ref: c-api/structures c PyMethodDef19576917
Ref: 188f19576917
Ref: c-api/structures c PyMethodDef ml_name19577193
Ref: 520d19577193
Ref: c-api/structures c PyMethodDef ml_meth19577354
Ref: 598e19577354
Ref: c-api/structures c PyMethodDef ml_flags19577463
Ref: 51ce19577463
Ref: c-api/structures c PyMethodDef ml_doc19577577
Ref: 598f19577577
Ref: c-api/structures c METH_VARARGS19578301
Ref: 18c019578301
Ref: c-api/structures c METH_KEYWORDS19578995
Ref: 51d519578995
Ref: c-api/structures meth-varargs-meth-keywords19579255
Ref: 598c19579255
Ref: c-api/structures c METH_FASTCALL19579692
Ref: 35319579692
Ref: c-api/structures meth-fastcall-meth-keywords19580285
Ref: 598d19580285
Ref: c-api/structures c METH_METHOD19580951
Ref: d3d19580951
Ref: c-api/structures meth-method-meth-fastcall-meth-keywords19581186
Ref: 1c3019581186
Ref: c-api/structures c METH_NOARGS19581710
Ref: 188c19581710
Ref: c-api/structures c METH_O19582323
Ref: 18bf19582323
Ref: c-api/structures c METH_CLASS19582976
Ref: 188d19582976
Ref: c-api/structures c METH_STATIC19583382
Ref: 188e19583382
Ref: c-api/structures c METH_COEXIST19583893
Ref: 182f19583893
Ref: c-api/structures c PyCMethod_Type19584617
Ref: 599019584617
Ref: c-api/structures c PyCMethod_Check19584826
Ref: 599119584826
Ref: c-api/structures c PyCMethod_CheckExact19585017
Ref: 599219585017
Ref: c-api/structures c PyCMethod_New19585172
Ref: 1ec019585172
Ref: c-api/structures c PyCFunction_Type19586314
Ref: 52c319586314
Ref: c-api/structures c PyCFunction_Check19586575
Ref: 599319586575
Ref: c-api/structures c PyCFunction_CheckExact19586770
Ref: 599419586770
Ref: c-api/structures c PyCFunction_NewEx19586929
Ref: 1f8919586929
Ref: c-api/structures c PyCFunction_New19587195
Ref: 1ec619587195
Ref: c-api/structures c PyCFunction_GetFlags19587476
Ref: 52c019587476
Ref: c-api/structures c PyCFunction_GET_FLAGS19587896
Ref: 599519587896
Ref: c-api/structures c PyCFunction_GetFunction19588060
Ref: 52c119588060
Ref: c-api/structures c PyCFunction_GET_FUNCTION19588512
Ref: 599619588512
Ref: c-api/structures c PyCFunction_GetSelf19588682
Ref: 52c219588682
Ref: c-api/structures c PyCFunction_GET_SELF19589353
Ref: 599719589353
Node: Accessing attributes of extension types19589543
Ref: c-api/structures accessing-attributes-of-extension-types19589722
Ref: 599819589722
Ref: c-api/structures c PyMemberDef19589821
Ref: 95f19589821
Ref: c-api/structures c PyMemberDef name19590195
Ref: 599919590195
Ref: c-api/structures c PyMemberDef type19590408
Ref: 520e19590408
Ref: c-api/structures c PyMemberDef offset19590566
Ref: 599a19590566
Ref: c-api/structures c PyMemberDef flags19590727
Ref: 520f19590727
Ref: c-api/structures c PyMemberDef doc19590863
Ref: 599c19590863
Ref: c-api/structures pymemberdef-offsets19591410
Ref: 565b19591410
Ref: c-api/structures c PyMember_GetOne19592787
Ref: 99119592787
Ref: c-api/structures c PyMember_SetOne19593253
Ref: 99219593253
Node: Member flags19593845
Ref: c-api/structures member-flags19593954
Ref: 599d19593954
Ref: c-api/structures pymemberdef-flags19593954
Ref: 599b19593954
Ref: c-api/structures c Py_READONLY19594069
Ref: 99519594069
Ref: c-api/structures c Py_AUDIT_READ19594203
Ref: 99619594203
Ref: c-api/structures c Py_RELATIVE_OFFSET19594404
Ref: 95e19594404
Node: Member types19595712
Ref: c-api/structures member-types19595858
Ref: 599e19595858
Ref: c-api/structures pymemberdef-types19595858
Ref: 1c1819595858
Ref: c-api/structures c Py_T_BYTE19596754
Ref: 548e19596754
Ref: c-api/structures c Py_T_SHORT19596991
Ref: 549419596991
Ref: c-api/structures c Py_T_INT19597225
Ref: 99319597225
Ref: c-api/structures c Py_T_LONG19597462
Ref: 549119597462
Ref: c-api/structures c Py_T_LONGLONG19597702
Ref: 549219597702
Ref: c-api/structures c Py_T_UBYTE19597935
Ref: 549719597935
Ref: c-api/structures c Py_T_UINT19598170
Ref: 549819598170
Ref: c-api/structures c Py_T_USHORT19598408
Ref: 549b19598408
Ref: c-api/structures c Py_T_ULONG19598643
Ref: 549919598643
Ref: c-api/structures c Py_T_ULONGLONG19598883
Ref: 549a19598883
Ref: c-api/structures c Py_T_PYSSIZET19599118
Ref: 549319599118
Ref: c-api/structures c Py_T_FLOAT19599351
Ref: 549019599351
Ref: c-api/structures c Py_T_DOUBLE19599590
Ref: 99419599590
Ref: c-api/structures c Py_T_BOOL19599826
Ref: 548d19599826
Ref: c-api/structures c Py_T_STRING19600065
Ref: 549519600065
Ref: c-api/structures c Py_T_STRING_INPLACE19600294
Ref: 549619600294
Ref: c-api/structures c Py_T_CHAR19600566
Ref: 548f19600566
Ref: c-api/structures c Py_T_OBJECT_EX19600812
Ref: 99819600812
Ref: c-api/structures c T_OBJECT19601748
Ref: 99719601748
Ref: c-api/structures c T_NONE19601970
Ref: 99919601970
Node: Defining Getters and Setters19602066
Ref: c-api/structures defining-getters-and-setters19602191
Ref: 599f19602191
Ref: c-api/structures c PyGetSetDef19602268
Ref: f7b19602268
Ref: c-api/structures c PyGetSetDef name19602585
Ref: 59a019602585
Ref: c-api/structures c PyGetSetDef get19602655
Ref: 59a119602655
Ref: c-api/structures c PyGetSetDef set19602755
Ref: 59a219602755
Ref: c-api/structures c PyGetSetDef doc19602928
Ref: 59a319602928
Ref: c-api/structures c PyGetSetDef closure19603036
Ref: 59a419603036
Ref: c-api/structures c getter19603180
Ref: 550019603180
Ref: c-api/structures c setter19603606
Ref: 550e19603606
Node: Type Object Structures19604142
Ref: c-api/typeobj doc19604408
Ref: 59a519604408
Ref: c-api/typeobj translation-repo19604408
Ref: 59a619604408
Ref: c-api/typeobj type-object-structures19604408
Ref: 59a719604408
Ref: c-api/typeobj type-structs19604408
Ref: d5919604408
Node: クイックリファレンス19606329
Ref: c-api/typeobj quick-reference19606446
Ref: 59a919606446
Node: tp スロット19606633
Ref: c-api/typeobj tp-slots19606733
Ref: 59aa19606733
Ref: c-api/typeobj tp-slots-table19606733
Ref: 59ab19606733
Ref: tp スロット-Footnote-119620003
Ref: tp スロット-Footnote-219620315
Node: sub-slots19621090
Ref: c-api/typeobj id319621231
Ref: 59b519621231
Ref: c-api/typeobj sub-slots19621231
Ref: 59ad19621231
Node: スロットの定義型 typedef19631590
Ref: c-api/typeobj slot-typedefs19631707
Ref: 59e519631707
Ref: c-api/typeobj slot-typedefs-table19631707
Ref: 59ac19631707
Node: PyTypeObject 定義19639611
Ref: c-api/typeobj pytypeobject-definition19639758
Ref: 59e719639758
Node: PyObject スロット19643367
Ref: c-api/typeobj pyobject-slots19643508
Ref: 59e819643508
Node: PyVarObject スロット19645631
Ref: c-api/typeobj pyvarobject-slots19645778
Ref: 59e919645778
Node: PyTypeObject スロット19646372
Ref: c-api/typeobj pytypeobject-slots19646510
Ref: 59ea19646510
Ref: c-api/typeobj c PyTypeObject tp_name19646874
Ref: 1ec519646874
Ref: c-api/typeobj c PyTypeObject tp_basicsize19648819
Ref: d5319648819
Ref: c-api/typeobj c PyTypeObject tp_itemsize19648915
Ref: 25cf19648915
Ref: c-api/typeobj c PyTypeObject tp_dealloc19653232
Ref: 51e219653232
Ref: c-api/typeobj c Py_tp_dealloc19653437
Ref: 54de19653437
Ref: c-api/typeobj c PyTypeObject tp_vectorcall_offset19658779
Ref: 560719658779
Ref: c-api/typeobj c PyTypeObject tp_getattr19660723
Ref: 521119660723
Ref: c-api/typeobj c Py_tp_getattr19660929
Ref: 54e519660929
Ref: c-api/typeobj c PyTypeObject tp_setattr19661787
Ref: 521219661787
Ref: c-api/typeobj c Py_tp_setattr19661993
Ref: 54f219661993
Ref: c-api/typeobj c PyTypeObject tp_as_async19662854
Ref: 128019662854
Ref: c-api/typeobj c PyTypeObject tp_repr19663634
Ref: 520819663634
Ref: c-api/typeobj c Py_tp_repr19663831
Ref: 54f019663831
Ref: c-api/typeobj c PyTypeObject tp_as_number19665001
Ref: d5719665001
Ref: c-api/typeobj c PyTypeObject tp_as_sequence19665496
Ref: 59ae19665496
Ref: c-api/typeobj c PyTypeObject tp_as_mapping19666015
Ref: 59af19666015
Ref: c-api/typeobj c PyTypeObject tp_hash19666526
Ref: 521a19666526
Ref: c-api/typeobj c Py_tp_hash19666723
Ref: 54e819666723
Ref: c-api/typeobj c PyTypeObject tp_call19668623
Ref: 96719668623
Ref: c-api/typeobj c Py_tp_call19668823
Ref: 54dc19668823
Ref: c-api/typeobj c PyTypeObject tp_str19669300
Ref: 520919669300
Ref: c-api/typeobj c Py_tp_str19669485
Ref: 54f419669485
Ref: c-api/typeobj c PyTypeObject tp_getattro19670761
Ref: 1c8919670761
Ref: c-api/typeobj c Py_tp_getattro19670970
Ref: 54e619670970
Ref: c-api/typeobj c PyTypeObject tp_setattro19671936
Ref: 520c19671936
Ref: c-api/typeobj c Py_tp_setattro19672145
Ref: 54f319672145
Ref: c-api/typeobj c PyTypeObject tp_as_buffer19673262
Ref: d5519673262
Ref: c-api/typeobj c PyTypeObject tp_flags19673882
Ref: 1e8719673882
Ref: c-api/typeobj c Py_TPFLAGS_HEAPTYPE19676269
Ref: c8619676269
Ref: c-api/typeobj c Py_TPFLAGS_BASETYPE19677075
Ref: 51f919677075
Ref: c-api/typeobj c Py_TPFLAGS_READY19677507
Ref: 59f019677507
Ref: c-api/typeobj c Py_TPFLAGS_READYING19677730
Ref: 59f119677730
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_GC19677952
Ref: 3a619677952
Ref: c-api/typeobj c Py_TPFLAGS_DEFAULT19679016
Ref: 51ef19679016
Ref: c-api/typeobj c Py_TPFLAGS_METHOD_DESCRIPTOR19679418
Ref: 548b19679418
Ref: c-api/typeobj c Py_TPFLAGS_MANAGED_DICT19680434
Ref: 3a419680434
Ref: c-api/typeobj c Py_TPFLAGS_MANAGED_WEAKREF19681100
Ref: 3a519681100
Ref: c-api/typeobj c Py_TPFLAGS_PREHEADER19681514
Ref: 59f319681514
Ref: c-api/typeobj c Py_TPFLAGS_ITEMS_AT_END19682034
Ref: 95b19682034
Ref: c-api/typeobj c Py_TPFLAGS_LONG_SUBCLASS19682791
Ref: 564f19682791
Ref: c-api/typeobj c Py_TPFLAGS_LIST_SUBCLASS19682842
Ref: 59f419682842
Ref: c-api/typeobj c Py_TPFLAGS_TUPLE_SUBCLASS19682893
Ref: 59f519682893
Ref: c-api/typeobj c Py_TPFLAGS_BYTES_SUBCLASS19682945
Ref: 59f619682945
Ref: c-api/typeobj c Py_TPFLAGS_UNICODE_SUBCLASS19682997
Ref: 59f719682997
Ref: c-api/typeobj c Py_TPFLAGS_DICT_SUBCLASS19683051
Ref: 59f819683051
Ref: c-api/typeobj c Py_TPFLAGS_BASE_EXC_SUBCLASS19683102
Ref: 59f919683102
Ref: c-api/typeobj c Py_TPFLAGS_TYPE_SUBCLASS19683157
Ref: 59fa19683157
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_FINALIZE19683772
Ref: 64119683772
Ref: c-api/typeobj c _Py_TPFLAGS_HAVE_VECTORCALL19684198
Ref: 59fb19684198
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_VECTORCALL19684198
Ref: 96219684198
Ref: c-api/typeobj c Py_TPFLAGS_IMMUTABLETYPE19685071
Ref: 60219685071
Ref: c-api/typeobj c Py_TPFLAGS_DISALLOW_INSTANTIATION19685441
Ref: 98919685441
Ref: c-api/typeobj c Py_TPFLAGS_MAPPING19686572
Ref: 1e6e19686572
Ref: c-api/typeobj c Py_TPFLAGS_SEQUENCE19687415
Ref: 1e6f19687415
Ref: c-api/typeobj c Py_TPFLAGS_VALID_VERSION_TAG19688259
Ref: 59fc19688259
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_VERSION_TAG19688599
Ref: 178319688599
Ref: c-api/typeobj c Py_TPFLAGS_INLINE_VALUES19688877
Ref: 59fd19688877
Ref: c-api/typeobj c Py_TPFLAGS_IS_ABSTRACT19689286
Ref: 59fe19689286
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_STACKLESS_EXTENSION19689561
Ref: 59f219689561
Ref: c-api/typeobj c PyTypeObject tp_doc19689920
Ref: 51f019689920
Ref: c-api/typeobj c Py_tp_doc19690095
Ref: 54e219690095
Ref: c-api/typeobj c PyTypeObject tp_traverse19690389
Ref: 37319690389
Ref: c-api/typeobj c Py_tp_traverse19690598
Ref: 54f519690598
Ref: c-api/typeobj c PyTypeObject tp_clear19691197
Ref: 520619691197
Ref: c-api/typeobj c Py_tp_clear19691395
Ref: 54dd19691395
Ref: c-api/typeobj c PyTypeObject tp_richcompare19698731
Ref: 521419698731
Ref: c-api/typeobj c Py_tp_richcompare19698945
Ref: 54f119698945
Ref: c-api/typeobj c Py_LT19699950
Ref: 55fa19699950
Ref: c-api/typeobj c Py_LE19700054
Ref: 55fb19700054
Ref: c-api/typeobj c Py_EQ19700159
Ref: 55fc19700159
Ref: c-api/typeobj c Py_NE19700264
Ref: 55fd19700264
Ref: c-api/typeobj c Py_GT19700369
Ref: 55fe19700369
Ref: c-api/typeobj c Py_GE19700473
Ref: 55ff19700473
Ref: c-api/typeobj c Py_RETURN_RICHCOMPARE19700646
Ref: f7619700646
Ref: c-api/typeobj c PyTypeObject tp_weaklistoffset19702118
Ref: d5419702118
Ref: c-api/typeobj c PyTypeObject tp_iter19704030
Ref: 18a719704030
Ref: c-api/typeobj c Py_tp_iter19704230
Ref: 54eb19704230
Ref: c-api/typeobj c PyTypeObject tp_iternext19704858
Ref: 18a819704858
Ref: c-api/typeobj c Py_tp_iternext19705067
Ref: 54ec19705067
Ref: c-api/typeobj c PyTypeObject tp_methods19706155
Ref: 51f819706155
Ref: c-api/typeobj c Py_tp_methods19706369
Ref: 54ee19706369
Ref: c-api/typeobj c PyTypeObject tp_members19706939
Ref: 51f619706939
Ref: c-api/typeobj c Py_tp_members19707152
Ref: 54ed19707152
Ref: c-api/typeobj c PyTypeObject tp_getset19707752
Ref: 51fb19707752
Ref: c-api/typeobj c Py_tp_getset19707963
Ref: 54e719707963
Ref: c-api/typeobj c PyTypeObject tp_base19708545
Ref: 258519708545
Ref: c-api/typeobj c Py_tp_base19708746
Ref: 54da19708746
Ref: c-api/typeobj c PyTypeObject tp_dict19710201
Ref: 1cb119710201
Ref: c-api/typeobj c PyTypeObject tp_descr_get19711834
Ref: 57e319711834
Ref: c-api/typeobj c Py_tp_descr_get19712045
Ref: 54e019712045
Ref: c-api/typeobj c PyTypeObject tp_descr_set19712361
Ref: 1ec919712361
Ref: c-api/typeobj c Py_tp_descr_set19712572
Ref: 54e119712572
Ref: c-api/typeobj c PyTypeObject tp_dictoffset19712997
Ref: 565a19712997
Ref: c-api/typeobj c PyTypeObject tp_init19715030
Ref: 98819715030
Ref: c-api/typeobj c Py_tp_init19715227
Ref: 54e919715227
Ref: c-api/typeobj c PyTypeObject tp_alloc19716767
Ref: 51f519716767
Ref: c-api/typeobj c Py_tp_alloc19716967
Ref: 54d919716967
Ref: c-api/typeobj c PyTypeObject tp_new19717581
Ref: 98619717581
Ref: c-api/typeobj c Py_tp_new19717765
Ref: 54ef19717765
Ref: c-api/typeobj c PyTypeObject tp_free19719685
Ref: 51f419719685
Ref: c-api/typeobj c Py_tp_free19719882
Ref: 54e419719882
Ref: c-api/typeobj c PyTypeObject tp_is_gc19720912
Ref: 59b019720912
Ref: c-api/typeobj c Py_tp_is_gc19721110
Ref: 54ea19721110
Ref: c-api/typeobj c PyTypeObject tp_bases19722346
Ref: 59b119722346
Ref: c-api/typeobj c Py_tp_bases19722545
Ref: 54db19722545
Ref: c-api/typeobj c PyTypeObject tp_mro19723268
Ref: 565c19723268
Ref: c-api/typeobj c PyTypeObject tp_cache19723915
Ref: 565d19723915
Ref: c-api/typeobj c PyTypeObject tp_subclasses19724157
Ref: 97c19724157
Ref: c-api/typeobj c PyTypeObject tp_weaklist19724647
Ref: 565e19724647
Ref: c-api/typeobj c PyTypeObject tp_del19725248
Ref: 59b219725248
Ref: c-api/typeobj c Py_tp_del19725445
Ref: 54df19725445
Ref: c-api/typeobj c PyTypeObject tp_version_tag19725574
Ref: 59b319725574
Ref: c-api/typeobj c PyTypeObject tp_finalize19725860
Ref: e7019725860
Ref: c-api/typeobj c Py_tp_finalize19726097
Ref: 54e319726097
Ref: c-api/typeobj c PyTypeObject tp_vectorcall19733507
Ref: 1bb919733507
Ref: c-api/typeobj c Py_tp_vectorcall19733752
Ref: 54f619733752
Ref: c-api/typeobj c PyTypeObject tp_watched19735383
Ref: 59b419735383
Ref: PyTypeObject スロット-Footnote-119735553
Ref: PyTypeObject スロット-Footnote-219735595
Ref: PyTypeObject スロット-Footnote-319735637
Node: Static Types19735679
Ref: c-api/typeobj id419735803
Ref: 5a0019735803
Ref: c-api/typeobj static-types19735803
Ref: b6419735803
Node: Heap Types19736708
Ref: c-api/typeobj heap-types19736840
Ref: d3319736840
Ref: c-api/typeobj id519736840
Ref: 5a0119736840
Node: 数値オブジェクト構造体19737343
Ref: c-api/typeobj number-object-structures19737499
Ref: 5a0219737499
Ref: c-api/typeobj number-structs19737499
Ref: 59ec19737499
Ref: c-api/typeobj c PyNumberMethods19737577
Ref: 17d619737577
Ref: c-api/typeobj c PyNumberMethods nb_add19740302
Ref: 565319740302
Ref: c-api/typeobj c Py_nb_add19740503
Ref: 54af19740503
Ref: c-api/typeobj c PyNumberMethods nb_subtract19740505
Ref: 59bc19740505
Ref: c-api/typeobj c Py_nb_subtract19740716
Ref: 54ce19740716
Ref: c-api/typeobj c PyNumberMethods nb_multiply19740718
Ref: 59be19740718
Ref: c-api/typeobj c Py_nb_multiply19740929
Ref: 54c719740929
Ref: c-api/typeobj c PyNumberMethods nb_remainder19740931
Ref: 59c019740931
Ref: c-api/typeobj c Py_nb_remainder19741144
Ref: 54cc19741144
Ref: c-api/typeobj c PyNumberMethods nb_divmod19741146
Ref: 59c219741146
Ref: c-api/typeobj c Py_nb_divmod19741353
Ref: 54b219741353
Ref: c-api/typeobj c PyNumberMethods nb_power19741355
Ref: 59c319741355
Ref: c-api/typeobj c Py_nb_power19741561
Ref: 54cb19741561
Ref: c-api/typeobj c PyNumberMethods nb_negative19741563
Ref: 59c519741563
Ref: c-api/typeobj c Py_nb_negative19741773
Ref: 54c819741773
Ref: c-api/typeobj c PyNumberMethods nb_positive19741775
Ref: 59c619741775
Ref: c-api/typeobj c Py_nb_positive19741985
Ref: 54ca19741985
Ref: c-api/typeobj c PyNumberMethods nb_absolute19741987
Ref: 59c719741987
Ref: c-api/typeobj c Py_nb_absolute19742197
Ref: 54ae19742197
Ref: c-api/typeobj c PyNumberMethods nb_bool19742199
Ref: 59c819742199
Ref: c-api/typeobj c Py_nb_bool19742399
Ref: 54b119742399
Ref: c-api/typeobj c PyNumberMethods nb_invert19742401
Ref: 59c919742401
Ref: c-api/typeobj c Py_nb_invert19742607
Ref: 54c419742607
Ref: c-api/typeobj c PyNumberMethods nb_lshift19742609
Ref: 59ca19742609
Ref: c-api/typeobj c Py_nb_lshift19742816
Ref: 54c519742816
Ref: c-api/typeobj c PyNumberMethods nb_rshift19742818
Ref: 59cc19742818
Ref: c-api/typeobj c Py_nb_rshift19743025
Ref: 54cd19743025
Ref: c-api/typeobj c PyNumberMethods nb_and19743027
Ref: 59ce19743027
Ref: c-api/typeobj c Py_nb_and19743228
Ref: 54b019743228
Ref: c-api/typeobj c PyNumberMethods nb_xor19743230
Ref: 59d019743230
Ref: c-api/typeobj c Py_nb_xor19743431
Ref: 54d019743431
Ref: c-api/typeobj c PyNumberMethods nb_or19743433
Ref: 59d219743433
Ref: c-api/typeobj c Py_nb_or19743632
Ref: 54c919743632
Ref: c-api/typeobj c PyNumberMethods nb_int19743634
Ref: 59d419743634
Ref: c-api/typeobj c Py_nb_int19743834
Ref: 54c319743834
Ref: c-api/typeobj c PyNumberMethods nb_reserved19743836
Ref: 59d519743836
Ref: c-api/typeobj c PyNumberMethods nb_float19743909
Ref: 59d619743909
Ref: c-api/typeobj c Py_nb_float19744113
Ref: 54b319744113
Ref: c-api/typeobj c PyNumberMethods nb_inplace_add19744115
Ref: 59bb19744115
Ref: c-api/typeobj c Py_nb_inplace_add19744332
Ref: 54b619744332
Ref: c-api/typeobj c PyNumberMethods nb_inplace_subtract19744334
Ref: 59bd19744334
Ref: c-api/typeobj c Py_nb_inplace_subtract19744561
Ref: 54c019744561
Ref: c-api/typeobj c PyNumberMethods nb_inplace_multiply19744563
Ref: 59bf19744563
Ref: c-api/typeobj c Py_nb_inplace_multiply19744790
Ref: 54bb19744790
Ref: c-api/typeobj c PyNumberMethods nb_inplace_remainder19744792
Ref: 59c119744792
Ref: c-api/typeobj c Py_nb_inplace_remainder19745021
Ref: 54be19745021
Ref: c-api/typeobj c PyNumberMethods nb_inplace_power19745023
Ref: 59c419745023
Ref: c-api/typeobj c Py_nb_inplace_power19745245
Ref: 54bd19745245
Ref: c-api/typeobj c PyNumberMethods nb_inplace_lshift19745247
Ref: 59cb19745247
Ref: c-api/typeobj c Py_nb_inplace_lshift19745470
Ref: 54b919745470
Ref: c-api/typeobj c PyNumberMethods nb_inplace_rshift19745472
Ref: 59cd19745472
Ref: c-api/typeobj c Py_nb_inplace_rshift19745695
Ref: 54bf19745695
Ref: c-api/typeobj c PyNumberMethods nb_inplace_and19745697
Ref: 59cf19745697
Ref: c-api/typeobj c Py_nb_inplace_and19745914
Ref: 54b719745914
Ref: c-api/typeobj c PyNumberMethods nb_inplace_xor19745916
Ref: 59d119745916
Ref: c-api/typeobj c Py_nb_inplace_xor19746133
Ref: 54c219746133
Ref: c-api/typeobj c PyNumberMethods nb_inplace_or19746135
Ref: 59d319746135
Ref: c-api/typeobj c Py_nb_inplace_or19746350
Ref: 54bc19746350
Ref: c-api/typeobj c PyNumberMethods nb_floor_divide19746352
Ref: 59d719746352
Ref: c-api/typeobj c Py_nb_floor_divide19746571
Ref: 54b419746571
Ref: c-api/typeobj c PyNumberMethods nb_true_divide19746573
Ref: 59d919746573
Ref: c-api/typeobj c Py_nb_true_divide19746790
Ref: 54cf19746790
Ref: c-api/typeobj c PyNumberMethods nb_inplace_floor_divide19746792
Ref: 59d819746792
Ref: c-api/typeobj c Py_nb_inplace_floor_divide19747028
Ref: 54b819747028
Ref: c-api/typeobj c PyNumberMethods nb_inplace_true_divide19747029
Ref: 59da19747029
Ref: c-api/typeobj c Py_nb_inplace_true_divide19747263
Ref: 54c119747263
Ref: c-api/typeobj c PyNumberMethods nb_index19747264
Ref: 17d519747264
Ref: c-api/typeobj c Py_nb_index19747468
Ref: 54b519747468
Ref: c-api/typeobj c PyNumberMethods nb_matrix_multiply19747470
Ref: 59db19747470
Ref: c-api/typeobj c Py_nb_matrix_multiply19747725
Ref: 54c619747725
Ref: c-api/typeobj c PyNumberMethods nb_inplace_matrix_multiply19747727
Ref: 59dc19747727
Ref: c-api/typeobj c Py_nb_inplace_matrix_multiply19748003
Ref: 54ba19748003
Node: マップオブジェクト構造体19748005
Ref: c-api/typeobj mapping-object-structures19748193
Ref: 5a0319748193
Ref: c-api/typeobj mapping-structs19748193
Ref: 59ee19748193
Ref: c-api/typeobj c PyMappingMethods19748276
Ref: 521919748276
Ref: c-api/typeobj c PyMappingMethods mp_length19748518
Ref: 59dd19748518
Ref: c-api/typeobj c Py_mp_length19748723
Ref: 54ac19748723
Ref: c-api/typeobj c PyMappingMethods mp_subscript19749050
Ref: 1f0a19749050
Ref: c-api/typeobj c Py_mp_subscript19749264
Ref: 54ad19749264
Ref: c-api/typeobj c PyMappingMethods mp_ass_subscript19749639
Ref: 59de19749639
Ref: c-api/typeobj c Py_mp_ass_subscript19749864
Ref: 54ab19749864
Node: シーケンスオブジェクト構造体19750260
Ref: c-api/typeobj sequence-object-structures19750478
Ref: 5a0419750478
Ref: c-api/typeobj sequence-structs19750478
Ref: 59ed19750478
Ref: c-api/typeobj c PySequenceMethods19750571
Ref: 521819750571
Ref: c-api/typeobj c PySequenceMethods sq_length19750772
Ref: 565919750772
Ref: c-api/typeobj c Py_sq_length19750978
Ref: 54d719750978
Ref: c-api/typeobj c PySequenceMethods sq_concat19751234
Ref: 59df19751234
Ref: c-api/typeobj c Py_sq_concat19751443
Ref: 54d219751443
Ref: c-api/typeobj c PySequenceMethods sq_repeat19751705
Ref: 59e019751705
Ref: c-api/typeobj c Py_sq_repeat19751916
Ref: 54d819751916
Ref: c-api/typeobj c PySequenceMethods sq_item19752182
Ref: 1f0919752182
Ref: c-api/typeobj c Py_sq_item19752389
Ref: 54d619752389
Ref: c-api/typeobj c PySequenceMethods sq_ass_item19753059
Ref: 59e119753059
Ref: c-api/typeobj c Py_sq_ass_item19753277
Ref: 54d119753277
Ref: c-api/typeobj c PySequenceMethods sq_contains19753672
Ref: 59e219753672
Ref: c-api/typeobj c Py_sq_contains19753885
Ref: 54d319753885
Ref: c-api/typeobj c PySequenceMethods sq_inplace_concat19754227
Ref: 59e319754227
Ref: c-api/typeobj c Py_sq_inplace_concat19754452
Ref: 54d419754452
Ref: c-api/typeobj c PySequenceMethods sq_inplace_repeat19754906
Ref: 59e419754906
Ref: c-api/typeobj c Py_sq_inplace_repeat19755133
Ref: 54d519755133
Node: バッファオブジェクト構造体 buffer object structure19755598
Ref: c-api/typeobj buffer-object-structures19755813
Ref: 5a0519755813
Ref: c-api/typeobj buffer-structs19755813
Ref: 13f319755813
Ref: c-api/typeobj c PyBufferProcs19755953
Ref: 565f19755953
Ref: c-api/typeobj c PyBufferProcs bf_getbuffer19756325
Ref: b4919756325
Ref: c-api/typeobj c Py_bf_getbuffer19756570
Ref: 54a219756570
Ref: c-api/typeobj c PyBufferProcs bf_releasebuffer19759850
Ref: b4a19759850
Ref: c-api/typeobj c Py_bf_releasebuffer19760107
Ref: 54a319760107
Node: async オブジェクト構造体19761991
Ref: c-api/typeobj async-object-structures19762182
Ref: 5a0619762182
Ref: c-api/typeobj async-structs19762182
Ref: 59eb19762182
Ref: c-api/typeobj c PyAsyncMethods19762285
Ref: 565819762285
Ref: c-api/typeobj c PyAsyncMethods am_await19762774
Ref: 59b619762774
Ref: c-api/typeobj c Py_am_await19763007
Ref: 54a019763007
Ref: c-api/typeobj c PyAsyncMethods am_aiter19763485
Ref: 59b719763485
Ref: c-api/typeobj c Py_am_aiter19763718
Ref: 549e19763718
Ref: c-api/typeobj c PyAsyncMethods am_anext19764100
Ref: 59b819764100
Ref: c-api/typeobj c Py_am_anext19764333
Ref: 549f19764333
Ref: c-api/typeobj c PyAsyncMethods am_send19764580
Ref: 59b919764580
Ref: c-api/typeobj c Py_am_send19764811
Ref: 54a119764811
Node: Slot Type typedefs19765078
Ref: c-api/typeobj id619765219
Ref: 59e619765219
Ref: c-api/typeobj slot-type-typedefs19765219
Ref: 5a0719765219
Ref: c-api/typeobj c allocfunc19765278
Ref: 54f719765278
Ref: c-api/typeobj c destructor19766465
Ref: 54fb19766465
Ref: c-api/typeobj c freefunc19766590
Ref: 57ca19766590
Ref: c-api/typeobj c newfunc19766704
Ref: 550619766704
Ref: c-api/typeobj c initproc19766970
Ref: 550219766970
Ref: c-api/typeobj c reprfunc19767206
Ref: 550a19767206
Ref: c-api/typeobj c getattrfunc19767415
Ref: 54fc19767415
Ref: c-api/typeobj c setattrfunc19767644
Ref: 550c19767644
Ref: c-api/typeobj c getattrofunc19767978
Ref: 54fd19767978
Ref: c-api/typeobj c setattrofunc19768286
Ref: 550d19768286
Ref: c-api/typeobj c descrgetfunc19768709
Ref: 54f919768709
Ref: c-api/typeobj c descrsetfunc19768972
Ref: 54fa19768972
Ref: c-api/typeobj c hashfunc19769217
Ref: 550119769217
Ref: c-api/typeobj c richcmpfunc19769427
Ref: 550b19769427
Ref: c-api/typeobj c getiterfunc19769673
Ref: 54ff19769673
Ref: c-api/typeobj c iternextfunc19769885
Ref: 550419769885
Ref: c-api/typeobj c lenfunc19770102
Ref: 550519770102
Ref: c-api/typeobj c getbufferproc19770252
Ref: 54fe19770252
Ref: c-api/typeobj c releasebufferproc19770449
Ref: 550919770449
Ref: c-api/typeobj c unaryfunc19770646
Ref: 551319770646
Ref: c-api/typeobj c binaryfunc19770797
Ref: 54f819770797
Ref: c-api/typeobj c sendfunc19770972
Ref: 59ba19770972
Ref: c-api/typeobj c ternaryfunc19771190
Ref: 551119771190
Ref: c-api/typeobj c ssizeargfunc19771389
Ref: 550f19771389
Ref: c-api/typeobj c ssizeobjargproc19771567
Ref: 551019771567
Ref: c-api/typeobj c objobjproc19771752
Ref: 550819771752
Ref: c-api/typeobj c objobjargproc19771909
Ref: 550719771909
Node: 使用例<57>19772092
Ref: c-api/typeobj examples19772191
Ref: 5a0819772191
Ref: c-api/typeobj typedef-examples19772191
Ref: 59a819772191
Node: 循環参照ガベージコレクションをサポートする19777818
Ref: c-api/gcsupport doc19778015
Ref: 5a0919778015
Ref: c-api/gcsupport supporting-cycle-detection19778015
Ref: 59ef19778015
Ref: c-api/gcsupport supporting-cyclic-garbage-collection19778015
Ref: 5a0a19778015
Ref: c-api/gcsupport translation-repo19778015
Ref: 5a0b19778015
Ref: c-api/gcsupport c PyObject_GC_New19780951
Ref: e6c19780951
Ref: c-api/gcsupport c PyObject_GC_NewVar19781758
Ref: e6d19781758
Ref: c-api/gcsupport c PyUnstable_Object_GC_NewWithExtraData19782580
Ref: 1cca19782580
Ref: c-api/gcsupport c PyObject_GC_Resize19783819
Ref: 1ccf19783819
Ref: c-api/gcsupport c PyObject_GC_Track19784209
Ref: 18bc19784209
Ref: c-api/gcsupport c PyObject_IS_GC19784820
Ref: d5019784820
Ref: c-api/gcsupport c PyObject_GC_IsTracked19785072
Ref: d4219785072
Ref: c-api/gcsupport c PyObject_GC_IsFinalized19785478
Ref: d4319785478
Ref: c-api/gcsupport c PyObject_GC_Del19785887
Ref: 18bb19785887
Ref: c-api/gcsupport c PyObject_GC_UnTrack19786680
Ref: 18bd19786680
Ref: c-api/gcsupport c visitproc19787602
Ref: 551419787602
Ref: c-api/gcsupport c inquiry19788481
Ref: 550319788481
Node: Traversal19789369
Ref: c-api/gcsupport gc-traversal19789526
Ref: 59ff19789526
Ref: c-api/gcsupport traversal19789526
Ref: 5a0c19789526
Ref: c-api/gcsupport c traverseproc19789658
Ref: 551219789658
Ref: c-api/gcsupport c Py_VISIT19794542
Ref: 51fd19794542
Ref: Traversal-Footnote-119795266
Node: Traversal-safe functions19795309
Ref: c-api/gcsupport traversal-safe-functions19795408
Ref: 5a0e19795408
Node: "DuringGC" functions19796141
Ref: c-api/gcsupport duringgc-functions19796240
Ref: 5a0d19796240
Ref: c-api/gcsupport id119796240
Ref: 5a0f19796240
Ref: c-api/gcsupport c PyObject_GetTypeData_DuringGC19796945
Ref: 37419796945
Ref: c-api/gcsupport c PyObject_GetItemData_DuringGC19797041
Ref: 37519797041
Ref: c-api/gcsupport c PyType_GetModuleState_DuringGC19797108
Ref: 37619797108
Ref: c-api/gcsupport c PyModule_GetState_DuringGC19797183
Ref: 37719797183
Ref: c-api/gcsupport c PyModule_GetToken_DuringGC19797252
Ref: 37819797252
Ref: c-api/gcsupport c PyType_GetBaseByToken_DuringGC19797774
Ref: 37919797774
Ref: c-api/gcsupport c PyType_GetModule_DuringGC19798313
Ref: 37a19798313
Ref: c-api/gcsupport c PyType_GetModuleByToken_DuringGC19798409
Ref: 37b19798409
Node: Controlling the Garbage Collector State19798991
Ref: c-api/gcsupport controlling-the-garbage-collector-state19799189
Ref: 5a1019799189
Ref: c-api/gcsupport c PyGC_Collect19799373
Ref: d5a19799373
Ref: c-api/gcsupport c PyGC_Enable19799949
Ref: c7e19799949
Ref: c-api/gcsupport c PyGC_Disable19800239
Ref: c7f19800239
Ref: c-api/gcsupport c PyGC_IsEnabled19800532
Ref: c8019800532
Node: Querying Garbage Collector State19800845
Ref: c-api/gcsupport querying-garbage-collector-state19801025
Ref: 5a1119801025
Ref: c-api/gcsupport c PyUnstable_GC_VisitObjects19801208
Ref: 5a1219801208
Ref: c-api/gcsupport c gcvisitobjects_t19802060
Ref: 5a1319802060
Node: API と ABI のバージョニング19802558
Ref: c-api/apiabiversion doc19802760
Ref: 5a1419802760
Ref: c-api/apiabiversion api-and-abi-versioning19802760
Ref: 5a1519802760
Ref: c-api/apiabiversion apiabiversion19802760
Ref: 4c1519802760
Ref: c-api/apiabiversion translation-repo19802760
Ref: 5a1619802760
Node: Build-time version constants19802923
Ref: c-api/apiabiversion build-time-version-constants19803049
Ref: 5a1719803049
Ref: c-api/apiabiversion c PY_MAJOR_VERSION19803442
Ref: 5a1819803442
Ref: c-api/apiabiversion c PY_MINOR_VERSION19803516
Ref: 5a1919803516
Ref: c-api/apiabiversion c PY_MICRO_VERSION19803590
Ref: 5a1a19803590
Ref: c-api/apiabiversion c PY_RELEASE_LEVEL19803664
Ref: 5a1b19803664
Ref: c-api/apiabiversion c PY_RELEASE_LEVEL_ALPHA19803887
Ref: 5a1c19803887
Ref: c-api/apiabiversion c PY_RELEASE_LEVEL_BETA19803887
Ref: 5a1d19803887
Ref: c-api/apiabiversion c PY_RELEASE_LEVEL_GAMMA19803887
Ref: 5a1e19803887
Ref: c-api/apiabiversion c PY_RELEASE_LEVEL_FINAL19803887
Ref: 5a1f19803887
Ref: c-api/apiabiversion c PY_RELEASE_SERIAL19804133
Ref: 5a2019804133
Ref: c-api/apiabiversion c PY_VERSION_HEX19804253
Ref: 5b619804253
Ref: c-api/apiabiversion c PY_VERSION19804512
Ref: 5a2119804512
Ref: Build-time version constants-Footnote-119804702
Node: Run-time version19804775
Ref: c-api/apiabiversion run-time-version19804928
Ref: 5a2219804928
Ref: c-api/apiabiversion c Py_Version19804977
Ref: 5b519804977
Node: Bit-packing macros19805427
Ref: c-api/apiabiversion bit-packing-macros19805543
Ref: 5a2319805543
Ref: c-api/apiabiversion c Py_PACK_FULL_VERSION19805596
Ref: 5b419805596
Ref: c-api/apiabiversion c Py_PACK_VERSION19809255
Ref: 5b319809255
Node: Monitoring C API19809605
Ref: c-api/monitoring doc19809768
Ref: 5a2419809768
Ref: c-api/monitoring c-api-monitoring19809768
Ref: 69a19809768
Ref: c-api/monitoring monitoring-c-api19809768
Ref: 5a2519809768
Ref: c-api/monitoring translation-repo19809768
Ref: 5a2619809768
Node: Generating Execution Events19810022
Ref: c-api/monitoring generating-execution-events19810140
Ref: 5a2719810140
Ref: c-api/monitoring c PyMonitoringState19811075
Ref: 7bd19811075
Ref: c-api/monitoring c PyMonitoring_FirePyStartEvent19811448
Ref: 7be19811448
Ref: c-api/monitoring c PyMonitoring_FirePyResumeEvent19811608
Ref: 7bf19811608
Ref: c-api/monitoring c PyMonitoring_FirePyReturnEvent19811770
Ref: 7c019811770
Ref: c-api/monitoring c PyMonitoring_FirePyYieldEvent19811950
Ref: 7c119811950
Ref: c-api/monitoring c PyMonitoring_FireCallEvent19812128
Ref: 7c219812128
Ref: c-api/monitoring c PyMonitoring_FireLineEvent19812327
Ref: 7c319812327
Ref: c-api/monitoring c PyMonitoring_FireJumpEvent19812492
Ref: 7c419812492
Ref: c-api/monitoring c PyMonitoring_FireBranchLeftEvent19812670
Ref: 5e119812670
Ref: c-api/monitoring c PyMonitoring_FireBranchRightEvent19812871
Ref: 5e219812871
Ref: c-api/monitoring c PyMonitoring_FireCReturnEvent19813074
Ref: 7c519813074
Ref: c-api/monitoring c PyMonitoring_FirePyThrowEvent19813252
Ref: 7c619813252
Ref: c-api/monitoring c PyMonitoring_FireRaiseEvent19813500
Ref: 7c719813500
Ref: c-api/monitoring c PyMonitoring_FireCRaiseEvent19813743
Ref: 7c819813743
Ref: c-api/monitoring c PyMonitoring_FireReraiseEvent19813989
Ref: 7c919813989
Ref: c-api/monitoring c PyMonitoring_FireExceptionHandledEvent19814236
Ref: 7ca19814236
Ref: c-api/monitoring c PyMonitoring_FirePyUnwindEvent19814503
Ref: 7cb19814503
Ref: c-api/monitoring c PyMonitoring_FireStopIterationEvent19814753
Ref: 7cc19814753
Node: Managing the Monitoring State19815160
Ref: c-api/monitoring managing-the-monitoring-state19815253
Ref: 5a2819815253
Ref: c-api/monitoring c PyMonitoring_EnterScope19815456
Ref: 7cd19815456
Ref: c-api/monitoring c PY_MONITORING_EVENT_BRANCH_LEFT19817518
Ref: 5a2919817518
Ref: c-api/monitoring c PY_MONITORING_EVENT_BRANCH_RIGHT19817729
Ref: 5a2a19817729
Ref: c-api/monitoring c PY_MONITORING_EVENT_CALL19817932
Ref: 5a2b19817932
Ref: c-api/monitoring c PY_MONITORING_EVENT_C_RAISE19818139
Ref: 5a2c19818139
Ref: c-api/monitoring c PY_MONITORING_EVENT_C_RETURN19818347
Ref: 5a2d19818347
Ref: c-api/monitoring c PY_MONITORING_EVENT_EXCEPTION_HANDLED19818526
Ref: 5a2e19818526
Ref: c-api/monitoring c PY_MONITORING_EVENT_INSTRUCTION19818714
Ref: 5a2f19818714
Ref: c-api/monitoring c PY_MONITORING_EVENT_JUMP19818918
Ref: 5a3019818918
Ref: c-api/monitoring c PY_MONITORING_EVENT_LINE19819122
Ref: 5a3119819122
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_RESUME19819331
Ref: 5a3219819331
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_RETURN19819540
Ref: 5a3319819540
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_START19819748
Ref: 5a3419819748
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_THROW19819956
Ref: 5a3519819956
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_UNWIND19820164
Ref: 5a3619820164
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_YIELD19820371
Ref: 5a3719820371
Ref: c-api/monitoring c PY_MONITORING_EVENT_RAISE19820576
Ref: 5a3819820576
Ref: c-api/monitoring c PY_MONITORING_EVENT_RERAISE19820782
Ref: 5a3919820782
Ref: c-api/monitoring c PY_MONITORING_EVENT_STOP_ITERATION19820995
Ref: 5a3a19820995
Ref: c-api/monitoring c PyMonitoring_ExitScope19821090
Ref: 7ce19821090
Ref: c-api/monitoring c PY_MONITORING_IS_INSTRUMENTED_EVENT19821228
Ref: 5a3b19821228
Node: Python モジュールのインストール19821483
Ref: installing/index doc19821625
Ref: 5a3c19821625
Ref: installing/index installing-index19821625
Ref: 12a919821625
Ref: installing/index installing-python-modules19821625
Ref: 5a3d19821625
Ref: installing/index translation-repo19821625
Ref: 5a3e19821625
Ref: Python モジュールのインストール-Footnote-119823184
Node: 重要用語集19823262
Ref: installing/index key-terms19823390
Ref: 5a3f19823390
Ref: 重要用語集-Footnote-119824758
Ref: 重要用語集-Footnote-219824783
Ref: 重要用語集-Footnote-319824812
Ref: 重要用語集-Footnote-419824844
Node: 基本的な使い方<5>19824924
Ref: installing/index basic-usage19825089
Ref: 5a4019825089
Ref: 基本的な使い方<5>-Footnote-119827025
Ref: 基本的な使い方<5>-Footnote-219827062
Node: どうすればいいの ？19827111
Ref: installing/index how-do-i19827309
Ref: 5a4119827309
Node: パッケージを現在のユーザ用のみにインストールするには？19828015
Ref: installing/index install-packages-just-for-the-current-user19828253
Ref: 5a4219828253
Node: 科学技術計算用の Python パッケージをインストールするには？19828640
Ref: installing/index install-scientific-python-packages19828979
Ref: 5a4319828979
Ref: 科学技術計算用の Python パッケージをインストールするには？-Footnote-119829527
Ref: 科学技術計算用の Python パッケージをインストールするには？-Footnote-219829573
Node: インストールされた複数のバージョンの Python を並行して使うには？19829619
Ref: installing/index work-with-multiple-versions-of-python-installed-in-parallel19829868
Ref: 5a4419829868
Node: よくあるインストールに関する問題19830626
Ref: installing/index common-installation-issues19830791
Ref: 5a4519830791
Node: Linux で、システムの Python 内にインストールする19831057
Ref: installing/index installing-into-the-system-python-on-linux19831259
Ref: 5a4619831259
Node: pip がインストールされていない19831855
Ref: installing/index pip-not-installed19832108
Ref: 5a4719832108
Ref: pip がインストールされていない-Footnote-119832421
Node: バイナリの拡張のインストール19832547
Ref: installing/index installing-binary-extensions19832726
Ref: 5a4819832726
Ref: バイナリの拡張のインストール-Footnote-119833521
Ref: バイナリの拡張のインストール-Footnote-219833567
Node: Python HOWTO19833616
Ref: howto/index doc19833754
Ref: 5a4919833754
Ref: howto/index how-tos19833754
Ref: 5a4a19833754
Ref: howto/index python-howtos19833754
Ref: 5a4b19833754
Ref: howto/index translation-repo19833754
Ref: 5a4c19833754
Node: A conceptual overview of asyncio19835288
Ref: howto/a-conceptual-overview-of-asyncio doc19835420
Ref: 5a4d19835420
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-of-asyncio19835420
Ref: 3a1219835420
Ref: howto/a-conceptual-overview-of-asyncio id119835420
Ref: 5a4e19835420
Ref: A conceptual overview of asyncio-Footnote-119836786
Ref: A conceptual overview of asyncio-Footnote-219836867
Ref: A conceptual overview of asyncio-Footnote-319836960
Node: A conceptual overview part 1 the high-level19837041
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-part-1-the-high-level19837209
Ref: 5a4f19837209
Node: Event loop<2>19837579
Ref: howto/a-conceptual-overview-of-asyncio event-loop19837718
Ref: 5a5019837718
Node: Asynchronous functions and coroutines19839404
Ref: howto/a-conceptual-overview-of-asyncio asynchronous-functions-and-coroutines19839559
Ref: 5a5119839559
Node: Task<2>19842482
Ref: howto/a-conceptual-overview-of-asyncio tasks19842629
Ref: 5a5219842629
Node: await19845553
Ref: howto/a-conceptual-overview-of-asyncio await19845654
Ref: 5a5319845654
Node: Awaiting tasks19845956
Ref: howto/a-conceptual-overview-of-asyncio awaiting-tasks19846040
Ref: 5a5419846040
Node: Awaiting coroutines19847553
Ref: howto/a-conceptual-overview-of-asyncio awaiting-coroutines19847637
Ref: 5a5519847637
Node: A conceptual overview part 2 the nuts and bolts19850240
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-part-2-the-nuts-and-bolts19850408
Ref: 5a5619850408
Node: The inner workings of coroutines19850894
Ref: howto/a-conceptual-overview-of-asyncio the-inner-workings-of-coroutines19851028
Ref: 5a5719851028
Node: Future<2>19854690
Ref: howto/a-conceptual-overview-of-asyncio futures19854857
Ref: 5a5819854857
Node: A homemade asyncio sleep19856112
Ref: howto/a-conceptual-overview-of-asyncio a-homemade-asyncio-sleep19856238
Ref: 5a5919856238
Node: Python 3 への拡張モジュール移植19860844
Ref: howto/cporting doc19861024
Ref: 5a5a19861024
Ref: howto/cporting cporting-howto19861024
Ref: 169a19861024
Ref: howto/cporting porting-extension-modules-to-python-319861024
Ref: 5a5b19861024
Ref: howto/cporting translation-repo19861024
Ref: 5a5c19861024
Ref: Python 3 への拡張モジュール移植-Footnote-119861853
Ref: Python 3 への拡張モジュール移植-Footnote-219861904
Node: Python で Curses プログラミング19861961
Ref: howto/curses doc19862137
Ref: 5a5d19862137
Ref: howto/curses curses-howto19862137
Ref: 36d419862137
Ref: howto/curses curses-programming-with-python19862137
Ref: 5a5e19862137
Ref: howto/curses translation-repo19862137
Ref: 5a5f19862137
Node: curses ってなに?19862652
Ref: howto/curses what-is-curses19862806
Ref: 5a6019862806
Ref: curses ってなに?-Footnote-119865763
Ref: curses ってなに?-Footnote-219865803
Node: Python の curses module19865847
Ref: howto/curses the-python-curses-module19865928
Ref: 5a6119865928
Node: curses アプリケーションの起動と終了19866897
Ref: howto/curses starting-and-ending-a-curses-application19867087
Ref: 5a6219867087
Node: ウィンドウとパッド19870784
Ref: howto/curses id119870975
Ref: 5a6319870975
Ref: howto/curses windows-and-pads19870975
Ref: 1a4319870975
Node: テキストの表示19875611
Ref: howto/curses displaying-text19875768
Ref: 5a6419875768
Node: 属性とカラー19879870
Ref: howto/curses attributes-and-color19879946
Ref: 5a6519879946
Node: ユーザ入力19884850
Ref: howto/curses user-input19885001
Ref: 5a6619885001
Ref: ユーザ入力-Footnote-119888890
Node: より多くの情報19888930
Ref: howto/curses for-more-information19889051
Ref: 5a6719889051
Ref: より多くの情報-Footnote-119890663
Ref: より多くの情報-Footnote-219890700
Ref: より多くの情報-Footnote-319890764
Ref: より多くの情報-Footnote-419890808
Ref: より多くの情報-Footnote-519890870
Ref: より多くの情報-Footnote-619890922
Node: デスクリプタ ガイド19890993
Ref: howto/descriptor doc19891184
Ref: 5a6819891184
Ref: howto/descriptor descriptor-guide19891184
Ref: 5a6919891184
Ref: howto/descriptor descriptorhowto19891184
Ref: 18a519891184
Ref: howto/descriptor translation-repo19891184
Ref: 5a6a19891184
Node: 入門19892890
Ref: howto/descriptor primer19892994
Ref: 5a6b19892994
Node: シンプルな例 定数を返すデスクリプタ19893376
Ref: howto/descriptor simple-example-a-descriptor-that-returns-a-constant19893507
Ref: 5a6c19893507
Node: 動的なルックアップ19895293
Ref: howto/descriptor dynamic-lookups19895454
Ref: 5a6d19895454
Node: 管理された属性19896964
Ref: howto/descriptor managed-attributes19897100
Ref: 5a6e19897100
Node: 名前のカスタマイズ19900012
Ref: howto/descriptor customized-names19900130
Ref: 5a6f19900130
Node: まとめ19902614
Ref: howto/descriptor closing-thoughts19902702
Ref: 5a7019902702
Node: 実践的なサンプル19904603
Ref: howto/descriptor complete-practical-example19904749
Ref: 5a7119904749
Node: バリデータクラス19905090
Ref: howto/descriptor validator-class19905211
Ref: 5a7219905211
Node: カスタムバリデータ19906334
Ref: howto/descriptor custom-validators19906500
Ref: 5a7319906500
Ref: カスタムバリデータ-Footnote-119909203
Node: 実践的なアプリケーション19909272
Ref: howto/descriptor practical-application19909405
Ref: 5a7419909405
Node: 技術的なチュートリアル19910890
Ref: howto/descriptor technical-tutorial19911060
Ref: 5a7519911060
Node: 概要<5>19911622
Ref: howto/descriptor abstract19911725
Ref: 5a7619911725
Node: 定義と導入19912174
Ref: howto/descriptor definition-and-introduction19912319
Ref: 5a7719912319
Node: デスクリプタプロトコル19913705
Ref: howto/descriptor descriptor-protocol19913880
Ref: 5a7819913880
Node: デスクリプタ呼び出しの概要19915353
Ref: howto/descriptor overview-of-descriptor-invocation19915552
Ref: 5a7919915552
Node: インスタンスからの呼び出し19916312
Ref: howto/descriptor invocation-from-an-instance19916508
Ref: 5a7a19916508
Node: クラスからの呼び出し19919161
Ref: howto/descriptor invocation-from-a-class19919344
Ref: 5a7b19919344
Ref: クラスからの呼び出し-Footnote-119920010
Node: superからの呼び出し19920083
Ref: howto/descriptor invocation-from-super19920263
Ref: 5a7c19920263
Ref: superからの呼び出し-Footnote-119921025
Ref: superからの呼び出し-Footnote-219921098
Node: 呼び出しロジックのまとめ19921178
Ref: howto/descriptor summary-of-invocation-logic19921355
Ref: 5a7d19921355
Node: 自動的の名前の伝達19922469
Ref: howto/descriptor automatic-name-notification19922638
Ref: 5a7e19922638
Ref: 自動的の名前の伝達-Footnote-119923537
Node: ORMのサンプル19923610
Ref: howto/descriptor orm-example19923734
Ref: 5a7f19923734
Ref: ORMのサンプル-Footnote-119925963
Ref: ORMのサンプル-Footnote-219926035
Node: ピュアPythonの等価実装19926088
Ref: howto/descriptor pure-python-equivalents19926225
Ref: 5a8019926225
Node: プロパティ19926856
Ref: howto/descriptor properties19926968
Ref: 5a8119926968
Node: 関数とメソッド19930094
Ref: howto/descriptor functions-and-methods19930236
Ref: 5a8219930236
Node: メソッドの種類19933867
Ref: howto/descriptor kinds-of-methods19934012
Ref: 5a8319934012
Node: 静的メソッド19935419
Ref: howto/descriptor static-methods19935564
Ref: 5a8419935564
Node: クラスメソッド19937834
Ref: howto/descriptor class-methods19938001
Ref: 5a8519938001
Node: メンバーオブジェクトと __slots__19940325
Ref: howto/descriptor member-objects-and-slots19940465
Ref: 5a8619940465
Ref: メンバーオブジェクトと __slots__-Footnote-119948459
Node: Debugging C API extensions and CPython Internals with GDB19948515
Ref: howto/gdb_helpers doc19948682
Ref: 5a8719948682
Ref: howto/gdb_helpers debugging-c-api-extensions-and-cpython-internals-with-gdb19948682
Ref: 5a8819948682
Ref: howto/gdb_helpers gdb19948682
Ref: 5a8919948682
Ref: howto/gdb_helpers translation-repo19948682
Ref: 5a8a19948682
Ref: Debugging C API extensions and CPython Internals with GDB-Footnote-119950084
Ref: Debugging C API extensions and CPython Internals with GDB-Footnote-219950120
Node: Prerequisites19950174
Ref: howto/gdb_helpers prerequisites19950332
Ref: 5a8b19950332
Node: Setup with Python built from source19950973
Ref: howto/gdb_helpers setup-with-python-built-from-source19951103
Ref: 5a8c19951103
Node: Setup for Python from a Linux distro19951870
Ref: howto/gdb_helpers setup-for-python-from-a-linux-distro19952000
Ref: 5a8d19952000
Node: Using the Debug build and Development mode19952648
Ref: howto/gdb_helpers using-the-debug-build-and-development-mode19952845
Ref: 5a8e19952845
Node: Using the python-gdb extension19953449
Ref: howto/gdb_helpers using-the-python-gdb-extension19953654
Ref: 5a8f19953654
Node: Pretty-printers19953960
Ref: howto/gdb_helpers pretty-printers19954058
Ref: 5a9019954058
Node: py-list19958563
Ref: howto/gdb_helpers py-list19958687
Ref: 5a9119958687
Node: py-up and py-down19959575
Ref: howto/gdb_helpers py-up-and-py-down19959689
Ref: 5a9219959689
Node: py-bt19964404
Ref: howto/gdb_helpers py-bt19964519
Ref: 5a9319964519
Node: py-print19966770
Ref: howto/gdb_helpers py-print19966877
Ref: 5a9419966877
Node: py-locals19967626
Ref: howto/gdb_helpers py-locals19967719
Ref: 5a9519967719
Node: Use with GDB commands19968622
Ref: howto/gdb_helpers use-with-gdb-commands19968776
Ref: 5a9619968776
Node: 列挙型 HOWTO19974795
Ref: howto/enum doc19974970
Ref: 5a9719974970
Ref: howto/enum enum-howto19974970
Ref: 5a9819974970
Ref: howto/enum id119974970
Ref: 5a9919974970
Ref: howto/enum translation-repo19974970
Ref: 5a9a19974970
Ref: howto/enum enum-basic-tutorial19975008
Ref: 2c4f19975008
Node: 列挙型メンバーおよびそれらの属性へのプログラム的アクセス19981551
Ref: howto/enum enum-advanced-tutorial19981732
Ref: 2c5019981732
Ref: howto/enum programmatic-access-to-enumeration-members-and-their-attributes19981732
Ref: 5a9b19981732
Node: 列挙型メンバーと値の重複19982650
Ref: howto/enum duplicating-enum-members-and-values19982891
Ref: 5a9c19982891
Node: 番号付けの値が一意であることの確認19984274
Ref: howto/enum ensuring-unique-enumeration-values19984458
Ref: 5a9d19984458
Node: 値の自動設定を使う19985082
Ref: howto/enum using-automatic-values19985254
Ref: 5a9e19985254
Node: イテレーション<2>19986205
Ref: howto/enum iteration19986335
Ref: 5a9f19986335
Node: 比較<3>19987844
Ref: howto/enum comparisons19987992
Ref: 5aa019987992
Node: 列挙型で許されるメンバーと属性19989275
Ref: howto/enum allowed-members-and-attributes-of-enumerations19989433
Ref: 5aa219989433
Node: Enumのサブクラス化の制限19991727
Ref: howto/enum restricted-enum-subclassing19991909
Ref: 5aa619991909
Node: データクラスのサポート19993299
Ref: howto/enum dataclass-support19993446
Ref: 5aa819993446
Ref: howto/enum enum-dataclass-support19993446
Ref: 1d1719993446
Node: Pickle 化19995012
Ref: howto/enum pickling19995138
Ref: 5aa919995138
Node: 関数 API<2>19996287
Ref: howto/enum functional-api19996395
Ref: 5aa319996395
Node: 派生列挙型20000315
Ref: howto/enum derived-enumerations20000444
Ref: 5aaa20000444
Node: IntEnum20000568
Ref: howto/enum intenum20000643
Ref: 5aa120000643
Node: StrEnum20001814
Ref: howto/enum strenum20001905
Ref: 5aab20001905
Node: IntFlag20002253
Ref: howto/enum intflag20002341
Ref: 5aac20002341
Node: Flag20005129
Ref: howto/enum flag20005222
Ref: 5aad20005222
Node: その他<6>20007840
Ref: howto/enum others20007917
Ref: 5aae20007917
Node: When to use __new__ vs __init__20010261
Ref: howto/enum new-vs-init20010389
Ref: 5aa520010389
Ref: howto/enum when-to-use-new-vs-init20010389
Ref: 5aaf20010389
Node: 細かい点20011686
Ref: howto/enum finer-points20011834
Ref: 5ab020011834
Node: Supported __dunder__ and _sunder_ names20012187
Ref: howto/enum supported-dunder-and-sunder-names20012299
Ref: 5ab120012299
Node: _Private__names20012527
Ref: howto/enum private-names20012668
Ref: 5ab220012668
Node: Enum メンバー型20012863
Ref: howto/enum enum-member-type20013018
Ref: 5ab320013018
Node: Creating members that are mixed with other data types20013484
Ref: howto/enum creating-members-that-are-mixed-with-other-data-types20013665
Ref: 5ab420013665
Node: Enum クラスとメンバーの真偽値20014198
Ref: howto/enum boolean-value-of-enum-classes-and-members20014395
Ref: 5ab520014395
Node: メソッド付きの Enum クラス20015069
Ref: howto/enum enum-classes-with-methods20015251
Ref: 5ab620015251
Node: Flag のメンバーの組み合わせ20015884
Ref: howto/enum combining-members-of-flag20016049
Ref: 5ab720016049
Node: Flag and IntFlag minutia20016626
Ref: howto/enum flag-and-intflag-minutia20016746
Ref: 5ab820016746
Node: EnumとFlagはどう違うのか？20019511
Ref: howto/enum enum-class-differences20019651
Ref: 2c5220019651
Ref: howto/enum how-are-enums-and-flags-different20019651
Ref: 5ab920019651
Node: Enum クラス20020068
Ref: howto/enum enum-classes20020177
Ref: 5aba20020177
Node: Flag クラス20020758
Ref: howto/enum flag-classes20020912
Ref: 5abb20020912
Node: Enum メンバー インスタンス20021279
Ref: howto/enum enum-members-aka-instances20021436
Ref: 5abc20021436
Node: Flag メンバー20021834
Ref: howto/enum flag-members20021968
Ref: 5abd20021968
Node: Enum クックブック20022677
Ref: howto/enum enum-cookbook20022841
Ref: 2c5120022841
Ref: howto/enum id220022841
Ref: 5abe20022841
Node: 値の省略20023390
Ref: howto/enum omitting-values20023482
Ref: 5abf20023482
Node: auto を使う20024391
Ref: howto/enum using-auto20024479
Ref: 5ac020024479
Node: object を使う20024755
Ref: howto/enum using-object20024876
Ref: 5ac120024876
Node: 解説文字列を使う20025552
Ref: howto/enum using-a-descriptive-string20025681
Ref: 5ac220025681
Node: Using a custom __new__20025973
Ref: howto/enum using-a-custom-new20026077
Ref: 5ac320026077
Node: OrderedEnum20027970
Ref: howto/enum orderedenum20028088
Ref: 5aa720028088
Node: DuplicateFreeEnum20029306
Ref: howto/enum duplicatefreeenum20029426
Ref: 5ac420029426
Node: MultiValueEnum20030604
Ref: howto/enum multi-value-enum20030719
Ref: 2c6e20030719
Ref: howto/enum multivalueenum20030719
Ref: 5ac520030719
Node: Planet20031302
Ref: howto/enum planet20031410
Ref: 5aa420031410
Node: TimePeriod20032471
Ref: howto/enum enum-time-period20032556
Ref: 2c6720032556
Ref: howto/enum timeperiod20032556
Ref: 5ac620032556
Node: EnumType のサブクラスを作る20033172
Ref: howto/enum enumtype-examples20033292
Ref: 2c5720033292
Ref: howto/enum subclassing-enumtype20033292
Ref: 5ac720033292
Node: 関数型プログラミング HOWTO20033579
Ref: howto/functional doc20033710
Ref: 5ac820033710
Ref: howto/functional functional-howto20033710
Ref: 5ac920033710
Ref: howto/functional functional-programming-howto20033710
Ref: 5aca20033710
Ref: howto/functional translation-repo20033710
Ref: 5acb20033710
Node: はじめに<15>20034740
Ref: howto/functional introduction20034865
Ref: 5acc20034865
Node: 形式的証明可能性20040883
Ref: howto/functional formal-provability20040987
Ref: 5ace20040987
Node: モジュラー性20043453
Ref: howto/functional modularity20043602
Ref: 5acf20043602
Node: デバッグやテストの簡単さ20044125
Ref: howto/functional ease-of-debugging-and-testing20044259
Ref: 5ad020044259
Node: 結合性20045228
Ref: howto/functional composability20045335
Ref: 5ad120045335
Node: イテレータ iterator<2>20046189
Ref: howto/functional functional-howto-iterators20046368
Ref: 5acd20046368
Ref: howto/functional iterators20046368
Ref: 5ad220046368
Node: イテレータ対応のデータ型20050656
Ref: howto/functional data-types-that-support-iterators20050756
Ref: 5ad320050756
Node: ジェネレータ式とリスト内包表記20053121
Ref: howto/functional generator-expressions-and-list-comprehensions20053315
Ref: 5ad420053315
Node: ジェネレータ generator<2>20058528
Ref: howto/functional generators20058734
Ref: 5ad520058734
Ref: ジェネレータ generator<2>-Footnote-120063356
Node: ジェネレータに値を渡す20063437
Ref: howto/functional passing-values-into-a-generator20063538
Ref: 5ad620063538
Ref: ジェネレータに値を渡す-Footnote-120068154
Node: 組み込み関数 built-in function<2>20068196
Ref: howto/functional built-in-functions20068382
Ref: 5ad720068382
Ref: 組み込み関数 built-in function<2>-Footnote-120072938
Ref: 組み込み関数 built-in function<2>-Footnote-220072992
Node: itertools モジュール20073068
Ref: howto/functional the-itertools-module20073248
Ref: 5ad820073248
Node: 新しいイテレータを作る20074116
Ref: howto/functional creating-new-iterators20074253
Ref: 5ad920074253
Node: 要素に対して関数を呼ぶ20077151
Ref: howto/functional calling-functions-on-elements20077318
Ref: 5ada20077318
Node: 要素を選択する20078236
Ref: howto/functional selecting-elements20078385
Ref: 5adb20078385
Node: 組合せ関数20079999
Ref: howto/functional combinatoric-functions20080148
Ref: 5adc20080148
Node: 要素をグループ分けする20082684
Ref: howto/functional grouping-elements20082803
Ref: 5add20082803
Node: functools モジュール20084593
Ref: howto/functional the-functools-module20084764
Ref: 5ade20084764
Node: operator モジュール20088900
Ref: howto/functional the-operator-module20088986
Ref: 5adf20088986
Node: 小さな関数とラムダ式20089891
Ref: howto/functional small-functions-and-the-lambda-expression20090058
Ref: 5ae020090058
Node: 更新履歴と謝辞20093523
Ref: howto/functional revision-history-and-acknowledgements20093680
Ref: 5ae120093680
Node: 参考資料<2>20094408
Ref: howto/functional references20094526
Ref: 5ae220094526
Node: 一般論20094629
Ref: howto/functional general20094718
Ref: 5ae320094718
Node: Python 特有の話20095925
Ref: howto/functional python-specific20096036
Ref: 5ae420096036
Ref: Python 特有の話-Footnote-120096614
Ref: Python 特有の話-Footnote-220096665
Ref: Python 特有の話-Footnote-320096718
Node: Python 文書20096771
Ref: howto/functional python-documentation20096864
Ref: 5ae520096864
Ref: Python 文書-Footnote-120097257
Ref: Python 文書-Footnote-220097299
Node: Logging HOWTO20097341
Ref: howto/logging doc20097483
Ref: 5ae620097483
Ref: howto/logging id120097483
Ref: 5ae720097483
Ref: howto/logging logging-howto20097483
Ref: 5ae820097483
Ref: howto/logging translation-repo20097483
Ref: 5ae920097483
Ref: howto/logging logging-basic-tutorial20097576
Ref: 15b420097576
Node: 基本 logging チュートリアル20098087
Ref: howto/logging basic-logging-tutorial20098221
Ref: 5aeb20098221
Node: logging を使うとき20099218
Ref: howto/logging when-to-use-logging20099335
Ref: 5aec20099335
Node: 簡単な例20103659
Ref: howto/logging a-simple-example20103811
Ref: 5aed20103811
Ref: howto/logging howto-minimal-example20103811
Ref: 5aee20103811
Node: ファイルへの logging20105084
Ref: howto/logging logging-to-a-file20105243
Ref: 5aef20105243
Node: 変数データのロギング20108824
Ref: howto/logging logging-variable-data20109031
Ref: 5af020109031
Node: 表示されるメッセージのフォーマットの変更20110130
Ref: howto/logging changing-the-format-of-displayed-messages20110359
Ref: 5af120110359
Node: メッセージ内での日付と時刻の表示20111535
Ref: howto/logging displaying-the-date-time-in-messages20111752
Ref: 5af220111752
Ref: メッセージ内での日付と時刻の表示-Footnote-120112997
Node: 次のステップ20113056
Ref: howto/logging next-steps20113204
Ref: 5af320113204
Ref: 次のステップ-Footnote-120114266
Node: 上級ロギングチュートリアル20114310
Ref: howto/logging advanced-logging-tutorial20114477
Ref: 5af420114477
Ref: howto/logging logging-advanced-tutorial20114477
Ref: 15b520114477
Node: Logging Flow20119039
Ref: howto/logging logging-flow20119145
Ref: 5af520119145
Node: ロガー20119340
Ref: howto/logging loggers20119467
Ref: 5af620119467
Node: ハンドラ20125032
Ref: howto/logging handler-basic20125165
Ref: 5af720125165
Ref: howto/logging handlers20125165
Ref: 5af820125165
Node: フォーマッタ20127914
Ref: howto/logging formatters20128065
Ref: 5afa20128065
Ref: howto/logging logging logging Formatter __init__20128760
Ref: 5afb20128760
Node: ロギングの環境設定20130998
Ref: howto/logging configuring-logging20131188
Ref: 5afc20131188
Node: 環境設定が与えられないとどうなるか20138401
Ref: howto/logging what-happens-if-no-configuration-is-provided20138621
Ref: 5afd20138621
Node: ライブラリのためのロギングの設定20140194
Ref: howto/logging configuring-logging-for-a-library20140378
Ref: 5afe20140378
Ref: howto/logging library-config20140378
Ref: 344620140378
Node: ロギングレベル<2>20144125
Ref: howto/logging logging-levels20144277
Ref: 5aff20144277
Node: カスタムレベル20147884
Ref: howto/logging custom-levels20147966
Ref: 340e20147966
Ref: howto/logging id220147966
Ref: 5b0020147966
Node: 便利なハンドラ20148700
Ref: howto/logging id320148849
Ref: 5b0120148849
Ref: howto/logging useful-handlers20148849
Ref: 5af920148849
Node: ログ記録中に発生する例外20154388
Ref: howto/logging exceptions-raised-during-logging20154573
Ref: 5b0220154573
Ref: howto/logging logging-exceptions20154573
Ref: 5b0320154573
Node: 任意のオブジェクトをメッセージに使用する20156041
Ref: howto/logging arbitrary-object-messages20156218
Ref: 33fa20156218
Ref: howto/logging using-arbitrary-objects-as-messages20156218
Ref: 5b0420156218
Node: 最適化<19>20157105
Ref: howto/logging optimization20157270
Ref: 5b0520157270
Node: その他のリソース20161649
Ref: howto/logging other-resources20161745
Ref: 5b0620161745
Ref: howto/logging tutorial-ref-links20161745
Ref: 5aea20161745
Node: Logging クックブック20162178
Ref: howto/logging-cookbook doc20162308
Ref: 5b0720162308
Ref: howto/logging-cookbook id120162308
Ref: 5b0820162308
Ref: howto/logging-cookbook logging-cookbook20162308
Ref: 15b620162308
Ref: howto/logging-cookbook translation-repo20162308
Ref: 5b0920162308
Node: 複数のモジュールで logging を使う20164965
Ref: howto/logging-cookbook using-logging-in-multiple-modules20165124
Ref: 5b0b20165124
Node: 複数のスレッドからのロギング20168924
Ref: howto/logging-cookbook logging-from-multiple-threads20169123
Ref: 5b0c20169123
Node: 複数の handler と formatter20171001
Ref: howto/logging-cookbook multiple-handlers-and-formatters20171197
Ref: 5b0d20171197
Node: 複数の出力先にログを出力する20173789
Ref: howto/logging-cookbook logging-to-multiple-destinations20173979
Ref: 5b0e20173979
Ref: howto/logging-cookbook multiple-destinations20173979
Ref: 5b0f20173979
Node: ログレベルのカスタム処理20177670
Ref: howto/logging-cookbook custom-handling-of-levels20177850
Ref: 5b1020177850
Ref: howto/logging-cookbook custom-level-handling20177850
Ref: 5b1120177850
Node: 設定サーバの例20184252
Ref: howto/logging-cookbook configuration-server-example20184426
Ref: 5b1220184426
Node: ブロックする handler を扱う20186029
Ref: howto/logging-cookbook blocking-handlers20186227
Ref: 3b9620186227
Ref: howto/logging-cookbook dealing-with-handlers-that-block20186227
Ref: 5b1320186227
Node: ネットワーク越しの logging イベントの送受信20191893
Ref: howto/logging-cookbook network-logging20192130
Ref: 5b1420192130
Ref: howto/logging-cookbook sending-and-receiving-logging-events-across-a-network20192130
Ref: 5b1520192130
Node: 作成中のロギングソケットのリスナーを実行する20197891
Ref: howto/logging-cookbook running-a-logging-socket-listener-in-production20198054
Ref: 5b1620198054
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-120203182
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-220203214
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-320203286
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-420203316
Node: コンテキスト情報をログ記録出力に付加する20203388
Ref: howto/logging-cookbook adding-contextual-information-to-your-logging-output20203610
Ref: 5b1720203610
Ref: howto/logging-cookbook context-info20203610
Ref: 340120203610
Node: LoggerAdapter を使ったコンテキスト情報の伝達20205050
Ref: howto/logging-cookbook using-loggeradapters-to-impart-contextual-information20205267
Ref: 5b1820205267
Node: コンテキスト情報を渡すために dict 以外のオブジェクトを使う20209208
Ref: howto/logging-cookbook using-objects-other-than-dicts-to-pass-contextual-information20209388
Ref: 5b1920209388
Node: Filter を使ったコンテキスト情報の伝達20209918
Ref: howto/logging-cookbook filters-contextual20210135
Ref: 33f620210135
Ref: howto/logging-cookbook using-filters-to-impart-contextual-information20210135
Ref: 5b1a20210135
Node: contextvars の利用20214223
Ref: howto/logging-cookbook use-of-contextvars20214439
Ref: 5b1b20214439
Node: ハンドラ内でのコンテキスト情報の付与20224706
Ref: howto/logging-cookbook imparting-contextual-information-in-handlers20224928
Ref: 5b1c20224928
Node: 複数のプロセスからの単一ファイルへのログ記録20225966
Ref: howto/logging-cookbook logging-to-a-single-file-from-multiple-processes20226203
Ref: 5b1d20226203
Ref: howto/logging-cookbook multiple-processes20226203
Ref: 5b1e20226203
Node: concurrent futures ProcessPoolExecutorの利用20237040
Ref: howto/logging-cookbook using-concurrent-futures-processpoolexecutor20237250
Ref: 5b1f20237250
Node: Deploying web applications using Gunicorn and uWSGI20238474
Ref: howto/logging-cookbook deploying-web-applications-using-gunicorn-and-uwsgi20238684
Ref: 5b2020238684
Ref: Deploying web applications using Gunicorn and uWSGI-Footnote-120239345
Ref: Deploying web applications using Gunicorn and uWSGI-Footnote-220239375
Node: ファイルをローテートする20239428
Ref: howto/logging-cookbook using-file-rotation20239652
Ref: 5b2120239652
Node: 別の format スタイルを利用する20241850
Ref: howto/logging-cookbook format-styles20242039
Ref: 5b2220242039
Ref: howto/logging-cookbook use-of-alternative-formatting-styles20242039
Ref: 5b2320242039
Node: LogRecord のカスタマイズ20249889
Ref: howto/logging-cookbook custom-logrecord20250102
Ref: 5b2420250102
Ref: howto/logging-cookbook customizing-logrecord20250102
Ref: 5b2520250102
Node: Subclassing QueueHandler and QueueListener- a ZeroMQ example20254816
Ref: howto/logging-cookbook subclassing-queuehandler-and-queuelistener-a-zeromq-example20255047
Ref: 5b2620255047
Ref: howto/logging-cookbook zeromq-handlers20255047
Ref: 5b2720255047
Node: Subclass QueueHandler20255247
Ref: howto/logging-cookbook subclass-queuehandler20255396
Ref: 5b2820255396
Node: Subclass QueueListener20256749
Ref: howto/logging-cookbook subclass-queuelistener20256898
Ref: 5b2920256898
Node: Subclassing QueueHandler and QueueListener- a pynng example20257685
Ref: howto/logging-cookbook pynng-handlers20257918
Ref: 5b2a20257918
Ref: howto/logging-cookbook subclassing-queuehandler-and-queuelistener-a-pynng-example20257918
Ref: 5b2b20257918
Ref: Subclassing QueueHandler and QueueListener- a pynng example-Footnote-120258542
Ref: Subclassing QueueHandler and QueueListener- a pynng example-Footnote-220258582
Node: Subclass QueueListener<2>20258615
Ref: howto/logging-cookbook id320258769
Ref: 5b2c20258769
Node: Subclass QueueHandler<2>20260745
Ref: howto/logging-cookbook id420260899
Ref: 5b2d20260899
Node: 辞書ベースで構成する例20264611
Ref: howto/logging-cookbook an-example-dictionary-based-configuration20264862
Ref: 5b2e20264862
Ref: 辞書ベースで構成する例-Footnote-120266831
Ref: 辞書ベースで構成する例-Footnote-220266917
Node: rotator と namer を使ってログローテートをカスタマイズする20267003
Ref: howto/logging-cookbook cookbook-rotator-namer20267239
Ref: 345320267239
Ref: howto/logging-cookbook using-a-rotator-and-namer-to-customize-log-rotation-processing20267239
Ref: 5b2f20267239
Node: より手の込んだ multiprocessing の例20268766
Ref: howto/logging-cookbook a-more-elaborate-multiprocessing-example20269030
Ref: 5b3020269030
Node: SysLogHandler に送るメッセージに BOM を挿入する20278853
Ref: howto/logging-cookbook inserting-a-bom-into-messages-sent-to-a-sysloghandler20279069
Ref: 5b3120279069
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-120281581
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-220281640
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-320281709
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-420281768
Node: 構造化ログを実装する20281827
Ref: howto/logging-cookbook implementing-structured-logging20282058
Ref: 5b3220282058
Node: handler を dictConfig を使ってカスタマイズする20284783
Ref: howto/logging-cookbook custom-handlers20285025
Ref: 5b3320285025
Ref: howto/logging-cookbook customizing-handlers-with-dictconfig20285025
Ref: 5b3420285025
Node: 固有の書式化スタイルをアプリケーション全体で使う20290650
Ref: howto/logging-cookbook formatting-styles20290920
Ref: 33ea20290920
Ref: howto/logging-cookbook using-particular-formatting-styles-throughout-your-application20290920
Ref: 5b3520290920
Node: LogRecord ファクトリを使う20293545
Ref: howto/logging-cookbook using-logrecord-factories20293754
Ref: 5b3620293754
Node: カスタムなメッセージオブジェクトを使う20294995
Ref: howto/logging-cookbook using-custom-message-objects20295204
Ref: 5b3720295204
Node: filter を dictConfig を使ってカスタマイズする20298515
Ref: howto/logging-cookbook configuring-filters-with-dictconfig20298771
Ref: 5b3820298771
Ref: howto/logging-cookbook filters-dictconfig20298771
Ref: 5b3920298771
Node: 例外の書式化をカスタマイズする20302416
Ref: howto/logging-cookbook custom-format-exception20302636
Ref: 5b3a20302636
Ref: howto/logging-cookbook customized-exception-formatting20302636
Ref: 5b3b20302636
Node: ロギングメッセージを喋る20304826
Ref: howto/logging-cookbook speaking-logging-messages20305075
Ref: 5b3c20305075
Ref: howto/logging-cookbook spoken-messages20305075
Ref: 5b3d20305075
Node: ロギングメッセージをバッファリングし、条件に従って出力する20307660
Ref: howto/logging-cookbook buffered-logging20307949
Ref: 5b3e20307949
Ref: howto/logging-cookbook buffering-logging-messages-and-outputting-them-conditionally20307949
Ref: 5b3f20307949
Node: バッファリングしながらロギングメッセージを email で送信する20314094
Ref: howto/logging-cookbook buffered-smtp20314401
Ref: 5b4020314401
Ref: howto/logging-cookbook sending-logging-messages-to-email-with-buffering20314401
Ref: 5b4120314401
Node: 設定によって時刻を UTC GMT で書式化する20318354
Ref: howto/logging-cookbook formatting-times-using-utc-gmt-via-configuration20318640
Ref: 5b4220318640
Ref: howto/logging-cookbook utc-formatting20318640
Ref: 5b4320318640
Node: ロギングの選択にコンテキストマネージャを使う20320749
Ref: howto/logging-cookbook context-manager20321010
Ref: 5b4420321010
Ref: howto/logging-cookbook using-a-context-manager-for-selective-logging20321010
Ref: 5b4520321010
Node: CLIアプリケーションスターターテンプレート20326601
Ref: howto/logging-cookbook a-cli-application-starter-template20326829
Ref: 5b4620326829
Ref: howto/logging-cookbook starter-template20326829
Ref: 5b4720326829
Node: Qt GUIのログ出力20333248
Ref: howto/logging-cookbook a-qt-gui-for-logging20333465
Ref: 5b4820333465
Ref: howto/logging-cookbook qt-gui20333465
Ref: 5b4920333465
Ref: Qt GUIのログ出力-Footnote-120343955
Ref: Qt GUIのログ出力-Footnote-220343982
Ref: Qt GUIのログ出力-Footnote-320344024
Node: RFC5424 をサポートする syslog へのロギング20344064
Ref: howto/logging-cookbook logging-to-syslog-with-rfc5424-support20344284
Ref: 5b4a20344284
Ref: RFC5424 をサポートする syslog へのロギング-Footnote-120348272
Ref: RFC5424 をサポートする syslog へのロギング-Footnote-220348331
Node: ロガーを出力ストリームのように取り扱う方法20348390
Ref: howto/logging-cookbook how-to-treat-a-logger-like-an-output-stream20348639
Ref: 5b4b20348639
Node: How to uniformly handle newlines in logging output20353872
Ref: howto/logging-cookbook how-to-uniformly-handle-newlines-in-logging-output20354093
Ref: 5b4c20354093
Ref: How to uniformly handle newlines in logging output-Footnote-120357621
Node: 避けるべきパターン20357683
Ref: howto/logging-cookbook patterns-to-avoid20357868
Ref: 5b4d20357868
Node: 同じログファイルを何度も開く20358549
Ref: howto/logging-cookbook opening-the-same-log-file-multiple-times20358733
Ref: 5b4e20358733
Node: ロガーをクラスの属性にするか、パラメータで渡す20361398
Ref: howto/logging-cookbook using-loggers-as-attributes-in-a-class-or-passing-them-as-parameters20361676
Ref: 5b4f20361676
Node: ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する20362486
Ref: howto/logging-cookbook adding-handlers-other-than-nullhandler-to-a-logger-in-a-library20362755
Ref: 5b5020362755
Node: 大量のロガーを作成する20363360
Ref: howto/logging-cookbook creating-a-lot-of-loggers20363551
Ref: 5b5120363551
Node: その他のリソース<2>20364251
Ref: howto/logging-cookbook cookbook-ref-links20364377
Ref: 5b0a20364377
Ref: howto/logging-cookbook other-resources20364377
Ref: 5b5220364377
Node: Regular expression HOWTO20364851
Ref: howto/regex doc20365007
Ref: 5b5320365007
Ref: howto/regex regex-howto20365007
Ref: 299420365007
Ref: howto/regex regular-expression-howto20365007
Ref: 5b5420365007
Ref: howto/regex translation-repo20365007
Ref: 5b5520365007
Node: はじめに<16>20365584
Ref: howto/regex introduction20365685
Ref: 5b5620365685
Node: Simple patterns20367751
Ref: howto/regex simple-patterns20367886
Ref: 5b5720367886
Node: Matching characters20368464
Ref: howto/regex matching-characters20368560
Ref: 5b5820368560
Node: Repeating things20374408
Ref: howto/regex repeating-things20374504
Ref: 5b5920374504
Node: Using regular expressions20380757
Ref: howto/regex using-regular-expressions20380894
Ref: 5b5a20380894
Node: Compiling regular expressions20381507
Ref: howto/regex compiling-regular-expressions20381627
Ref: 5b5b20381627
Node: The backslash plague20383301
Ref: howto/regex id120383448
Ref: 5b5c20383448
Ref: howto/regex the-backslash-plague20383448
Ref: 5b5d20383448
Node: Performing matches20387122
Ref: howto/regex performing-matches20387262
Ref: 5b5e20387262
Node: Module-level functions20393387
Ref: howto/regex module-level-functions20393524
Ref: 5b5f20393524
Node: Compilation flags20394968
Ref: howto/regex compilation-flags20395078
Ref: 5b6020395078
Node: More pattern power20403891
Ref: howto/regex more-pattern-power20404030
Ref: 5b6220404030
Node: More metacharacters20404456
Ref: howto/regex id220404557
Ref: 5b6320404557
Ref: howto/regex more-metacharacters20404557
Ref: 5b6120404557
Node: グルーピング20410196
Ref: howto/regex grouping20410336
Ref: 5b6420410336
Node: Non-capturing and named groups20414439
Ref: howto/regex non-capturing-and-named-groups20414580
Ref: 5b6520414580
Node: Lookahead assertions20420987
Ref: howto/regex lookahead-assertions20421101
Ref: 5b6620421101
Node: Modifying strings20425195
Ref: howto/regex modifying-strings20425324
Ref: 5b6720425324
Node: Splitting strings20426424
Ref: howto/regex splitting-strings20426522
Ref: 5b6820426522
Node: Search and replace20429081
Ref: howto/regex search-and-replace20429179
Ref: 5b6920429179
Node: Common problems20434362
Ref: howto/regex common-problems20434494
Ref: 5b6a20434494
Node: Use string methods20435011
Ref: howto/regex use-string-methods20435125
Ref: 5b6b20435125
Node: prefixmatch aka match versus search20437209
Ref: howto/regex match-versus-search20437356
Ref: 5b6c20437356
Ref: howto/regex prefixmatch-aka-match-versus-search20437356
Ref: 5b6d20437356
Node: Greedy versus non-greedy20438397
Ref: howto/regex greedy-versus-non-greedy20438546
Ref: 5b6e20438546
Node: re VERBOSE の利用20441056
Ref: howto/regex using-re-verbose20441161
Ref: 5b6f20441161
Node: フィードバック20443034
Ref: howto/regex feedback20443140
Ref: 5b7020443140
Node: ソケットプログラミング HOWTO20444190
Ref: howto/sockets doc20444347
Ref: 5b7120444347
Ref: howto/sockets socket-howto20444347
Ref: 3bff20444347
Ref: howto/sockets socket-programming-howto20444347
Ref: 5b7220444347
Ref: howto/sockets translation-repo20444347
Ref: 5b7320444347
Node: ソケット20445188
Ref: howto/sockets sockets20445309
Ref: 5b7420445309
Node: 歴史20446863
Ref: howto/sockets history20446918
Ref: 5b7520446918
Node: ソケットの作成<3>20447646
Ref: howto/sockets creating-a-socket20447797
Ref: 5b7620447797
Node: IPC20451695
Ref: howto/sockets ipc20451759
Ref: 5b7720451759
Node: ソケットの利用20452355
Ref: howto/sockets using-a-socket20452500
Ref: 5b7820452500
Node: バイナリデータ20460154
Ref: howto/sockets binary-data20460233
Ref: 5b7920460233
Ref: バイナリデータ-Footnote-120461513
Node: 切断20461573
Ref: howto/sockets disconnecting20461730
Ref: 5b7a20461730
Node: ソケットが死ぬと20463508
Ref: howto/sockets when-sockets-die20463575
Ref: 5b7b20463575
Node: ノンブロッキングソケット20464811
Ref: howto/sockets non-blocking-sockets20464938
Ref: 5b7c20464938
Node: ソートのテクニック20469886
Ref: howto/sorting doc20470032
Ref: 5b7d20470032
Ref: howto/sorting sorting-techniques20470032
Ref: 5b7e20470032
Ref: howto/sorting sortinghowto20470032
Ref: 159920470032
Ref: howto/sorting translation-repo20470032
Ref: 5b7f20470032
Node: ソートの基本20470964
Ref: howto/sorting sorting-basics20471065
Ref: 5b8020471065
Node: Key 関数20472139
Ref: howto/sorting key-functions20472315
Ref: 5b8120472315
Node: operator モジュールの関数や partial 関数による評価20474656
Ref: howto/sorting operator-module-functions-and-partial-function-evaluation20474829
Ref: 5b8220474829
Ref: operator モジュールの関数や partial 関数による評価-Footnote-120476831
Node: 昇順と降順20476875
Ref: howto/sorting ascending-and-descending20477083
Ref: 5b8320477083
Node: ソートの安定性と複合的なソート20477698
Ref: howto/sorting sort-stability-and-complex-sorts20477895
Ref: 5b8420477895
Ref: ソートの安定性と複合的なソート-Footnote-120479850
Ref: ソートの安定性と複合的なソート-Footnote-220479916
Node: デコレート - ソート - アンデコレート DSU20479962
Ref: howto/sorting decorate-sort-undecorate20480156
Ref: 5b8520480156
Ref: デコレート - ソート - アンデコレート DSU-Footnote-120482378
Node: 比較関数20482438
Ref: howto/sorting comparison-functions20482630
Ref: 5b8620482630
Ref: 比較関数-Footnote-120483837
Node: Strategies For Unorderable Types and Values20483924
Ref: howto/sorting strategies-for-unorderable-types-and-values20484085
Ref: 5b8720484085
Ref: Strategies For Unorderable Types and Values-Footnote-120485820
Node: 残りのはしばし<2>20485867
Ref: howto/sorting odds-and-ends20486037
Ref: 5b8820486037
Ref: 残りのはしばし<2>-Footnote-120488775
Node: 部分的なソート20488817
Ref: howto/sorting partial-sorts20488935
Ref: 5b8920488935
Node: Unicode HOWTO20490233
Ref: howto/unicode doc20490434
Ref: 5b8a20490434
Ref: howto/unicode id120490434
Ref: 5b8b20490434
Ref: howto/unicode translation-repo20490434
Ref: 5b8c20490434
Ref: howto/unicode unicode-howto20490434
Ref: 165e20490434
Node: Unicode 入門20490871
Ref: howto/unicode introduction-to-unicode20490975
Ref: 5b8d20490975
Node: 定義20491129
Ref: howto/unicode definitions20491222
Ref: 5b8e20491222
Ref: 定義-Footnote-120494661
Node: エンコーディング<3>20494718
Ref: howto/unicode encodings20494835
Ref: 5b8f20494835
Node: 参考資料<3>20499252
Ref: howto/unicode references20499354
Ref: 5b9020499354
Ref: 参考資料<3>-Footnote-120500315
Ref: 参考資料<3>-Footnote-220500347
Ref: 参考資料<3>-Footnote-320500388
Ref: 参考資料<3>-Footnote-420500440
Ref: 参考資料<3>-Footnote-520500487
Ref: 参考資料<3>-Footnote-620500661
Ref: 参考資料<3>-Footnote-720500718
Node: Python の Unicode サポート20500762
Ref: howto/unicode python-s-unicode-support20500913
Ref: 5b9120500913
Node: 文字列型20501321
Ref: howto/unicode the-string-type20501434
Ref: 5b9220501434
Node: バイト列への変換20505149
Ref: howto/unicode converting-to-bytes20505323
Ref: 5b9320505323
Node: Python ソースコード内の Unicode リテラル20507554
Ref: howto/unicode unicode-literals-in-python-source-code20507739
Ref: 5b9420507739
Ref: Python ソースコード内の Unicode リテラル-Footnote-120510476
Node: Unicode プロパティ20510518
Ref: howto/unicode id220510696
Ref: 5b9520510696
Ref: howto/unicode unicode-properties20510696
Ref: 286320510696
Ref: Unicode プロパティ-Footnote-120512535
Node: Comparing Strings20512605
Ref: howto/unicode comparing-strings20512751
Ref: 5b9620512751
Node: Unicode 正規表現20515589
Ref: howto/unicode unicode-regular-expressions20515727
Ref: 5b9720515727
Node: 参考資料<4>20517179
Ref: howto/unicode id320517291
Ref: 5b9820517291
Ref: 参考資料<4>-Footnote-120518284
Ref: 参考資料<4>-Footnote-220518380
Ref: 参考資料<4>-Footnote-320518432
Node: Unicode データを読み書きする20518501
Ref: howto/unicode reading-and-writing-unicode-data20518648
Ref: 5b9920518648
Node: Unicode ファイル名20523294
Ref: howto/unicode unicode-filenames20523456
Ref: 5b9a20523456
Node: Unicode 対応のプログラムを書くための Tips20526080
Ref: howto/unicode tips-for-writing-unicode-aware-programs20526266
Ref: 5b9b20526266
Node: ファイルエンコーディングの変換20528098
Ref: howto/unicode converting-between-file-encodings20528292
Ref: 5b9c20528292
Node: 不明なエンコーディングのファイル20529068
Ref: howto/unicode files-in-an-unknown-encoding20529262
Ref: 5b9d20529262
Node: 参考資料<5>20530183
Ref: howto/unicode id420530337
Ref: 5b9e20530337
Ref: 参考資料<5>-Footnote-120531180
Ref: 参考資料<5>-Footnote-220531252
Node: 謝辞<10>20531321
Ref: howto/unicode acknowledgements20531428
Ref: 5b9f20531428
Node: urllib パッケージを使ってインターネット上のリソースを取得するには20531989
Ref: howto/urllib2 doc20532196
Ref: 5ba020532196
Ref: howto/urllib2 howto-fetch-internet-resources-using-the-urllib-package20532196
Ref: 5ba120532196
Ref: howto/urllib2 translation-repo20532196
Ref: 5ba220532196
Ref: howto/urllib2 urllib-howto20532196
Ref: 41e520532196
Ref: urllib パッケージを使ってインターネット上のリソースを取得するには-Footnote-120532672
Node: はじめに<17>20532711
Ref: howto/urllib2 introduction20532886
Ref: 5ba320532886
Ref: はじめに<17>-Footnote-120534841
Ref: はじめに<17>-Footnote-220534958
Node: URL を取得する20535017
Ref: howto/urllib2 fetching-urls20535225
Ref: 5ba420535225
Node: データ20538034
Ref: howto/urllib2 data20538117
Ref: 5ba520538117
Ref: データ-Footnote-120541471
Node: ヘッダ20541540
Ref: howto/urllib2 headers20541623
Ref: 5ba620541623
Ref: ヘッダ-Footnote-120543511
Ref: ヘッダ-Footnote-220543548
Ref: ヘッダ-Footnote-320543874
Ref: ヘッダ-Footnote-420544011
Node: 例外を処理する<2>20544168
Ref: howto/urllib2 handling-exceptions20544375
Ref: 5ba820544375
Node: URLError20544903
Ref: howto/urllib2 urlerror20544990
Ref: 5ba920544990
Node: HTTPError20545587
Ref: howto/urllib2 httperror20545710
Ref: 5baa20545710
Ref: HTTPError-Footnote-120546605
Node: エラーコード20546664
Ref: howto/urllib2 error-codes20546728
Ref: 5bab20546728
Ref: エラーコード-Footnote-120549062
Node: エラーをラップする20549121
Ref: howto/urllib2 wrapping-it-up20549227
Ref: 5bac20549227
Node: その120549474
Ref: howto/urllib2 number-120549561
Ref: 5bad20549561
Node: その220550185
Ref: howto/urllib2 number-220550272
Ref: 5bae20550272
Node: info と geturl20550800
Ref: howto/urllib2 info-and-geturl20551008
Ref: 5ba720551008
Ref: info と geturl-Footnote-120552054
Node: Openers と Handlers20552092
Ref: howto/urllib2 openers-and-handlers20552288
Ref: 5baf20552288
Node: Basic 認証20554632
Ref: howto/urllib2 basic-authentication20554825
Ref: 5bb020554825
Ref: Basic 認証-Footnote-120558695
Node: プロキシ20558812
Ref: howto/urllib2 proxies20559012
Ref: 5bb120559012
Ref: プロキシ-Footnote-120560294
Ref: プロキシ-Footnote-220560815
Node: ソケットとレイヤー20560982
Ref: howto/urllib2 sockets-and-layers20561176
Ref: 5bb220561176
Node: 脚注20562565
Ref: howto/urllib2 footnotes20562738
Ref: 5bb320562738
Node: ipaddressモジュールの紹介20562849
Ref: howto/ipaddress doc20563091
Ref: 5bb420563091
Ref: howto/ipaddress an-introduction-to-the-ipaddress-module20563091
Ref: 5bb520563091
Ref: howto/ipaddress ipaddress-howto20563091
Ref: 442120563091
Ref: howto/ipaddress translation-repo20563091
Ref: 5bb620563091
Node: アドレス/ネットワーク/インターフェースオブジェクトの作成20564034
Ref: howto/ipaddress creating-address-network-interface-objects20564270
Ref: 5bb720564270
Node: IPバージョンについての注意20564891
Ref: howto/ipaddress a-note-on-ip-versions20565081
Ref: 5bb820565081
Node: IPホストアドレス20566116
Ref: howto/ipaddress ip-host-addresses20566348
Ref: 5bb920566348
Node: ネットワークを定義する20567679
Ref: howto/ipaddress defining-networks20567906
Ref: 5bba20567906
Node: ホストインターフェース20570971
Ref: howto/ipaddress host-interfaces20571166
Ref: 5bbb20571166
Node: アドレス/ネットワーク/インターフェースオブジェクト20572426
Ref: howto/ipaddress inspecting-address-network-interface-objects20572725
Ref: 5bbc20572725
Node: アドレスのリストとしてのネットワーク20575421
Ref: howto/ipaddress networks-as-lists-of-addresses20575646
Ref: 5bbd20575646
Node: 比較<4>20576686
Ref: howto/ipaddress comparisons20576890
Ref: 5bbe20576890
Node: 他のモジュールでIPアドレスを使用する20577321
Ref: howto/ipaddress using-ip-addresses-with-other-modules20577552
Ref: 5bbf20577552
Node: インスタンスの生成に失敗した場合にさらに詳細を取得する20578086
Ref: howto/ipaddress getting-more-detail-when-instance-creation-fails20578299
Ref: 5bc020578299
Node: DTrace と SystemTap で CPython を測定する20580720
Ref: howto/instrumentation doc20580920
Ref: 5bc120580920
Ref: howto/instrumentation instrumentation20580920
Ref: 102e20580920
Ref: howto/instrumentation instrumenting-cpython-with-dtrace-and-systemtap20580920
Ref: 5bc220580920
Ref: howto/instrumentation translation-repo20580920
Ref: 5bc320580920
Node: 静的マーカーの有効化20582430
Ref: howto/instrumentation enabling-the-static-markers20582580
Ref: 5bc420582580
Node: 静的 DTrace プローブ20586941
Ref: howto/instrumentation static-dtrace-probes20587129
Ref: 5bc520587129
Node: 静的 SystemTap マーカー20589598
Ref: howto/instrumentation static-systemtap-markers20589789
Ref: 5bc620589789
Node: 利用可能な静的マーカー20592011
Ref: howto/instrumentation available-static-markers20592192
Ref: 5bc720592192
Ref: howto/instrumentation static-markers20592192
Ref: f7a20592192
Node: C Entry Points20595035
Ref: howto/instrumentation c-entry-points20595144
Ref: 5bc820595144
Ref: howto/instrumentation c PyDTrace_LINE20595907
Ref: 5bc920595907
Ref: howto/instrumentation c PyDTrace_FUNCTION_ENTRY20596033
Ref: 5bca20596033
Ref: howto/instrumentation c PyDTrace_FUNCTION_RETURN20596173
Ref: 5bcb20596173
Ref: howto/instrumentation c PyDTrace_GC_START20596310
Ref: 5bcc20596310
Ref: howto/instrumentation c PyDTrace_GC_DONE20596528
Ref: 5bcd20596528
Ref: howto/instrumentation c PyDTrace_INSTANCE_NEW_START20596664
Ref: 5bce20596664
Ref: howto/instrumentation c PyDTrace_INSTANCE_NEW_DONE20596861
Ref: 5bcf20596861
Ref: howto/instrumentation c PyDTrace_INSTANCE_DELETE_START20597058
Ref: 5bd020597058
Ref: howto/instrumentation c PyDTrace_INSTANCE_DELETE_DONE20597255
Ref: 5bd120597255
Ref: howto/instrumentation c PyDTrace_IMPORT_FIND_LOAD_START20597455
Ref: 5bd220597455
Ref: howto/instrumentation c PyDTrace_IMPORT_FIND_LOAD_DONE20597603
Ref: 5bd320597603
Ref: howto/instrumentation c PyDTrace_AUDIT20597754
Ref: 5bd420597754
Node: C Probing Checks20597828
Ref: howto/instrumentation c-probing-checks20597937
Ref: 5bd520597937
Ref: howto/instrumentation c PyDTrace_LINE_ENABLED20597990
Ref: 5bd620597990
Ref: howto/instrumentation c PyDTrace_FUNCTION_ENTRY_ENABLED20598041
Ref: 5bd720598041
Ref: howto/instrumentation c PyDTrace_FUNCTION_RETURN_ENABLED20598102
Ref: 5bd820598102
Ref: howto/instrumentation c PyDTrace_GC_START_ENABLED20598164
Ref: 5bd920598164
Ref: howto/instrumentation c PyDTrace_GC_DONE_ENABLED20598219
Ref: 5bda20598219
Ref: howto/instrumentation c PyDTrace_INSTANCE_NEW_START_ENABLED20598273
Ref: 5bdb20598273
Ref: howto/instrumentation c PyDTrace_INSTANCE_NEW_DONE_ENABLED20598338
Ref: 5bdc20598338
Ref: howto/instrumentation c PyDTrace_INSTANCE_DELETE_START_ENABLED20598402
Ref: 5bdd20598402
Ref: howto/instrumentation c PyDTrace_INSTANCE_DELETE_DONE_ENABLED20598470
Ref: 5bde20598470
Ref: howto/instrumentation c PyDTrace_IMPORT_FIND_LOAD_START_ENABLED20598537
Ref: 5bdf20598537
Ref: howto/instrumentation c PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED20598606
Ref: 5be020598606
Ref: howto/instrumentation c PyDTrace_AUDIT_ENABLED20598674
Ref: 5be120598674
Node: SystemTap Tapset20599002
Ref: howto/instrumentation systemtap-tapsets20599167
Ref: 5be220599167
Node: 使用例<58>20600775
Ref: howto/instrumentation examples20600898
Ref: 5be320600898
Node: Python support for the perf map compatible profilers20602218
Ref: howto/perf_profiling doc20602436
Ref: 1cce20602436
Ref: howto/perf_profiling perf-profiling20602436
Ref: 6bd20602436
Ref: howto/perf_profiling python-support-for-the-perf-map-compatible-profilers20602436
Ref: 5be420602436
Ref: howto/perf_profiling translation-repo20602436
Ref: 5be520602436
Ref: Python support for the perf map compatible profilers-Footnote-120610482
Ref: Python support for the perf map compatible profilers-Footnote-220610519
Node: Using the samply profiler20610561
Ref: howto/perf_profiling using-the-samply-profiler20610720
Ref: 5be620610720
Node: How to enable perf profiling support20611898
Ref: howto/perf_profiling how-to-enable-perf-profiling-support20612096
Ref: 5be720612096
Node: How to obtain the best results20613238
Ref: howto/perf_profiling how-to-obtain-the-best-results20613445
Ref: 5be820613445
Node: How to work without frame pointers20614328
Ref: howto/perf_profiling how-to-work-without-frame-pointers20614490
Ref: 5be920614490
Node: アノテーションのベストプラクティス20618353
Ref: howto/annotations doc20618559
Ref: 5bea20618559
Ref: howto/annotations annotations-best-practices20618559
Ref: 5beb20618559
Ref: howto/annotations annotations-howto20618559
Ref: bba20618559
Ref: howto/annotations translation-repo20618559
Ref: 5bec20618559
Node: オブジェクトのアノテーション辞書へのアクセス Python 3 10 以降20620422
Ref: howto/annotations accessing-the-annotations-dict-of-an-object-in-python-3-10-and-newer20620688
Ref: 5bed20620688
Node: オブジェクトのアノテーション辞書へのアクセス Python 3 9 以前20622999
Ref: howto/annotations accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older20623343
Ref: 5bee20623343
Node: 文字列指定のアノテーションを手動で解決する方法20626161
Ref: howto/annotations manually-un-stringizing-stringized-annotations20626499
Ref: 5bef20626499
Ref: 文字列指定のアノテーションを手動で解決する方法-Footnote-120629005
Node: __annotations__ のベストプラクティス 全 Python バージョン共通20629047
Ref: howto/annotations best-practices-for-annotations-in-any-python-version20629329
Ref: 5bf020629329
Node: __annotations__ の注意点20630432
Ref: howto/annotations annotations-quirks20630636
Ref: 5bf120630636
Ref: __annotations__ の注意点-Footnote-120633191
Node: 拡張モジュールを分離する20633252
Ref: howto/isolating-extensions doc20633433
Ref: 5bf220633433
Ref: howto/isolating-extensions isolating-extension-modules20633433
Ref: 5bf320633433
Ref: howto/isolating-extensions isolating-extensions-howto20633433
Ref: 41920633433
Ref: howto/isolating-extensions translation-repo20633433
Ref: 5bf420633433
Node: Who should read this20634181
Ref: howto/isolating-extensions who-should-read-this20634292
Ref: 5bf520634292
Node: 背景<2>20634530
Ref: howto/isolating-extensions background20634696
Ref: 5bf620634696
Node: Enter Per-Module State20636311
Ref: howto/isolating-extensions enter-per-module-state20636436
Ref: 5bf720636436
Node: 分離されたモジュールオブジェクト20637595
Ref: howto/isolating-extensions isolated-module-objects20637750
Ref: 5bf820637750
Node: Surprising Edge Cases20638846
Ref: howto/isolating-extensions surprising-edge-cases20638970
Ref: 5bfa20638970
Node: Making Modules Safe with Multiple Interpreters20639982
Ref: howto/isolating-extensions making-modules-safe-with-multiple-interpreters20640141
Ref: 5bfb20640141
Node: Managing Global State20640460
Ref: howto/isolating-extensions managing-global-state20640598
Ref: 5bf920640598
Node: Managing Per-Module State20641554
Ref: howto/isolating-extensions managing-per-module-state20641750
Ref: 5bfc20641750
Ref: Managing Per-Module State-Footnote-120643422
Node: Opt-Out Limiting to One Module Object per Process20643496
Ref: howto/isolating-extensions isolating-extensions-optout20643705
Ref: 556d20643705
Ref: howto/isolating-extensions opt-out-limiting-to-one-module-object-per-process20643705
Ref: 5bfd20643705
Node: Module State Access from Functions20645064
Ref: howto/isolating-extensions module-state-access-from-functions20645239
Ref: 5bfe20645239
Node: Heap Types<2>20646021
Ref: howto/isolating-extensions heap-types20646198
Ref: 5bff20646198
Node: Changing Static Types to Heap Types20647846
Ref: howto/isolating-extensions changing-static-types-to-heap-types20647959
Ref: 5c0020647959
Node: Defining Heap Types20648935
Ref: howto/isolating-extensions defining-heap-types20649084
Ref: 5c0120649084
Node: Garbage-Collection Protocol20649737
Ref: howto/isolating-extensions garbage-collection-protocol20649883
Ref: 5c0220649883
Node: tp_traverse in Python 3 8 and lower20650977
Ref: howto/isolating-extensions tp-traverse-in-python-3-8-and-lower20651107
Ref: 5c0320651107
Node: Delegating tp_traverse20651875
Ref: howto/isolating-extensions delegating-tp-traverse20652033
Ref: 5c0420652033
Node: Defining tp_dealloc20652841
Ref: howto/isolating-extensions defining-tp-dealloc20652986
Ref: 5c0520652986
Node: Not overriding tp_free20653754
Ref: howto/isolating-extensions not-overriding-tp-free20653898
Ref: 5c0620653898
Node: Avoiding PyObject_New20654105
Ref: howto/isolating-extensions avoiding-pyobject-new20654221
Ref: 5c0720654221
Node: Module State Access from Classes20655008
Ref: howto/isolating-extensions module-state-access-from-classes20655175
Ref: 5c0820655175
Node: Module State Access from Regular Methods20655746
Ref: howto/isolating-extensions module-state-access-from-regular-methods20655943
Ref: 5c0920655943
Node: Module State Access from Slot Methods Getters and Setters20658446
Ref: howto/isolating-extensions module-state-access-from-slot-methods-getters-and-setters20658639
Ref: 5c0a20658639
Node: Lifetime of the Module State20660086
Ref: howto/isolating-extensions lifetime-of-the-module-state20660230
Ref: 5c0b20660230
Node: 取り掛かり中の問題20660773
Ref: howto/isolating-extensions open-issues20660895
Ref: 5c0c20660895
Ref: 取り掛かり中の問題-Footnote-120661245
Node: クラスごとのスコープ20661300
Ref: howto/isolating-extensions per-class-scope20661436
Ref: 5c0d20661436
Node: Lossless Conversion to Heap Types20661749
Ref: howto/isolating-extensions lossless-conversion-to-heap-types20661885
Ref: 5c0e20661885
Node: timer file descriptor HOWTO20662123
Ref: howto/timerfd doc20662291
Ref: 5c0f20662291
Ref: howto/timerfd timer-file-descriptor-howto20662291
Ref: 5c1020662291
Ref: howto/timerfd timerfd-howto20662291
Ref: 5c1120662291
Ref: howto/timerfd translation-repo20662291
Ref: 5c1220662291
Node: 使用例<59>20662493
Ref: howto/timerfd examples20662570
Ref: 5c1320662570
Node: The Python 2 3 Method Resolution Order20671377
Ref: howto/mro doc20671542
Ref: 5c1420671542
Ref: howto/mro python-2-3-mro20671542
Ref: 186220671542
Ref: howto/mro the-python-2-3-method-resolution-order20671542
Ref: 5c1520671542
Ref: howto/mro translation-repo20671542
Ref: 5c1620671542
Ref: The Python 2 3 Method Resolution Order-Footnote-120673153
Node: The beginning20673200
Ref: howto/mro the-beginning20673327
Ref: 5c1720673327
Ref: The beginning-Footnote-120677904
Ref: The beginning-Footnote-220678041
Node: The C3 Method Resolution Order20678153
Ref: howto/mro the-c3-method-resolution-order20678302
Ref: 5c1820678302
Node: 使用例<60>20680634
Ref: howto/mro examples20680798
Ref: 5c1920680798
Node: Bad Method Resolution Orders20686346
Ref: howto/mro bad-method-resolution-orders20686487
Ref: 5c1a20686487
Ref: Bad Method Resolution Orders-Footnote-120692735
Node: The end20692919
Ref: howto/mro the-end20693056
Ref: 5c1b20693056
Node: Resources20696231
Ref: howto/mro resources20696331
Ref: 5c1c20696331
Node: Python support for free threading20696366
Ref: howto/free-threading-python doc20696546
Ref: 5c1d20696546
Ref: howto/free-threading-python freethreading-python-howto20696546
Ref: 293120696546
Ref: howto/free-threading-python python-support-for-free-threading20696546
Ref: 5c1e20696546
Ref: howto/free-threading-python translation-repo20696546
Ref: 5c1f20696546
Ref: Python support for free threading-Footnote-120697851
Node: Installation<2>20697893
Ref: howto/free-threading-python installation20698019
Ref: 5c2120698019
Ref: Installation<2>-Footnote-120698605
Node: Identifying free-threaded Python20698669
Ref: howto/free-threading-python identifying-free-threaded-python20698855
Ref: 5c2220698855
Node: The global interpreter lock in free-threaded Python20699522
Ref: howto/free-threading-python the-global-interpreter-lock-in-free-threaded-python20699706
Ref: 5c2320699706
Node: Thread safety20700456
Ref: howto/free-threading-python thread-safety20700625
Ref: 5c2420700625
Node: Known limitations20701417
Ref: howto/free-threading-python known-limitations20701553
Ref: 5c2520701553
Node: Immortalization20701888
Ref: howto/free-threading-python immortalization20702006
Ref: 5c2620702006
Node: フレーム frame オブジェクト<3>20702533
Ref: howto/free-threading-python frame-objects20702687
Ref: 5c2720702687
Node: イテレータ iterator<3>20702957
Ref: howto/free-threading-python iterators20703123
Ref: 5c2820703123
Node: Single-threaded performance20703346
Ref: howto/free-threading-python single-threaded-performance20703463
Ref: 5c2920703463
Node: Behavioral changes20703848
Ref: howto/free-threading-python behavioral-changes20703962
Ref: 5c2a20703962
Node: Context variables20704149
Ref: howto/free-threading-python context-variables20704245
Ref: 5c2b20704245
Node: Warning filters20704659
Ref: howto/free-threading-python warning-filters20704755
Ref: 5c2c20704755
Node: C API Extension Support for Free Threading20705259
Ref: howto/free-threading-extensions doc20705437
Ref: 5c2d20705437
Ref: howto/free-threading-extensions c-api-extension-support-for-free-threading20705437
Ref: 5c2e20705437
Ref: howto/free-threading-extensions freethreading-extensions-howto20705437
Ref: 5c2020705437
Ref: howto/free-threading-extensions translation-repo20705437
Ref: 5c2f20705437
Node: Identifying the Free-Threaded Build in C20706097
Ref: howto/free-threading-extensions identifying-the-free-threaded-build-in-c20706246
Ref: 5c3020706246
Node: Module Initialization20706950
Ref: howto/free-threading-extensions module-initialization20707130
Ref: 5c3120707130
Node: Multi-Phase Initialization20707624
Ref: howto/free-threading-extensions multi-phase-initialization20707744
Ref: 5c3220707744
Node: Single-Phase Initialization20708385
Ref: howto/free-threading-extensions single-phase-initialization20708505
Ref: 5c3320708505
Node: General API Guidelines20709368
Ref: howto/free-threading-extensions general-api-guidelines20709527
Ref: 5c3420709527
Node: Container Thread Safety20710470
Ref: howto/free-threading-extensions container-thread-safety20710552
Ref: 5c3620710552
Node: PyDict_Next20710887
Ref: howto/free-threading-extensions id120710958
Ref: 5c3720710958
Ref: howto/free-threading-extensions pydict-next20710958
Ref: 5c3820710958
Node: Borrowed References20711446
Ref: howto/free-threading-extensions borrowed-references20711606
Ref: 5c3920711606
Ref: howto/free-threading-extensions id220711661
Ref: 5c3520711661
Ref: Borrowed References-Footnote-120714605
Node: Memory Allocation APIs20714657
Ref: howto/free-threading-extensions free-threaded-memory-allocation20714820
Ref: 595020714820
Ref: howto/free-threading-extensions memory-allocation-apis20714820
Ref: 5c3a20714820
Node: Thread State and GIL APIs20715552
Ref: howto/free-threading-extensions thread-state-and-gil-apis20715731
Ref: 5c3b20715731
Node: Protecting Internal Extension State20716838
Ref: howto/free-threading-extensions protecting-internal-extension-state20717012
Ref: 5c3c20717012
Ref: Protecting Internal Extension State-Footnote-120717768
Node: Critical Sections20717834
Ref: howto/free-threading-extensions critical-sections20718030
Ref: 5c3d20718030
Ref: howto/free-threading-extensions id320718081
Ref: 5c3e20718081
Node: What Are Critical Sections?20718668
Ref: howto/free-threading-extensions what-are-critical-sections20718781
Ref: 5c3f20718781
Node: Using Critical Sections20719258
Ref: howto/free-threading-extensions using-critical-sections20719406
Ref: 5c4020719406
Node: How Critical Sections Work20720656
Ref: howto/free-threading-extensions how-critical-sections-work20720795
Ref: 5c4120720795
Node: Deadlock Avoidance20721702
Ref: howto/free-threading-extensions deadlock-avoidance20721842
Ref: 5c4220721842
Node: Important Considerations20722990
Ref: howto/free-threading-extensions important-considerations20723129
Ref: 5c4320723129
Node: Per-Object Locks ob_mutex20725074
Ref: howto/free-threading-extensions per-object-locks20725186
Ref: 598720725186
Ref: howto/free-threading-extensions per-object-locks-ob-mutex20725186
Ref: 5c4420725186
Node: Building Extensions for the Free-Threaded Build20726139
Ref: howto/free-threading-extensions building-extensions-for-the-free-threaded-build20726291
Ref: 5c4520726291
Ref: Building Extensions for the Free-Threaded Build-Footnote-120726887
Ref: Building Extensions for the Free-Threaded Build-Footnote-220726929
Node: Limited C API and Stable ABI20726974
Ref: howto/free-threading-extensions limited-c-api-and-stable-abi20727106
Ref: 5c4620727106
Ref: Limited C API and Stable ABI-Footnote-120727805
Node: Windows<85>20727866
Ref: howto/free-threading-extensions windows20727998
Ref: 5c4720727998
Ref: Windows<85>-Footnote-120728350
Node: Remote debugging attachment protocol20728403
Ref: howto/remote_debugging doc20728571
Ref: 5c4820728571
Ref: howto/remote_debugging remote-debugging20728571
Ref: 4c1b20728571
Ref: howto/remote_debugging remote-debugging-attachment-protocol20728571
Ref: 5c4920728571
Ref: howto/remote_debugging translation-repo20728571
Ref: 5c4a20728571
Node: Disabling remote debugging20728889
Ref: howto/remote_debugging disabling-remote-debugging20728988
Ref: 5c4b20728988
Node: Permission requirements20729397
Ref: howto/remote_debugging id120729555
Ref: 5c4c20729555
Ref: howto/remote_debugging permission-requirements20729555
Ref: 5c4d20729555
Node: Locating the PyRuntime structure20733220
Ref: howto/remote_debugging locating-the-pyruntime-structure20733366
Ref: 5c4e20733366
Ref: Locating the PyRuntime structure-Footnote-120743409
Ref: Locating the PyRuntime structure-Footnote-220743478
Ref: Locating the PyRuntime structure-Footnote-320743585
Ref: Locating the PyRuntime structure-Footnote-420743681
Node: Reading _Py_DebugOffsets20743776
Ref: howto/remote_debugging reading-py-debugoffsets20743940
Ref: 5c4f20743940
Node: Locating the interpreter and thread state20747744
Ref: howto/remote_debugging locating-the-interpreter-and-thread-state20747903
Ref: 5c5020747903
Node: Writing control information20752497
Ref: howto/remote_debugging writing-control-information20752639
Ref: 5c5120752639
Node: Summary20756419
Ref: howto/remote_debugging summary20756545
Ref: 5c5220756545
Node: Security and threat model20757185
Ref: howto/remote_debugging remote-debugging-threat-model20757275
Ref: 5c5320757275
Ref: howto/remote_debugging security-and-threat-model20757275
Ref: 5c5420757275
Node: When to use PYTHON_DISABLE_REMOTE_DEBUG20759443
Ref: howto/remote_debugging when-to-use-python-disable-remote-debug20759544
Ref: 5c5520759544
Node: Python よくある質問20761796
Ref: faq/index doc20761904
Ref: 5c5620761904
Ref: faq/index faq-index20761904
Ref: 230320761904
Ref: faq/index python-frequently-asked-questions20761904
Ref: 5c5720761904
Ref: faq/index translation-repo20761904
Ref: 5c5820761904
Node: 一般 Python FAQ20762305
Ref: faq/general doc20762418
Ref: 5c5920762418
Ref: faq/general general-python-faq20762418
Ref: 5c5a20762418
Node: 一般情報20762520
Ref: faq/general general-information20762620
Ref: 5c5b20762620
Node: Python とは何ですか？20763921
Ref: faq/general what-is-python20764055
Ref: 5c5c20764055
Ref: Python とは何ですか？-Footnote-120765532
Node: Python Software Foundation とは何ですか？20765584
Ref: faq/general what-is-the-python-software-foundation20765788
Ref: 5c5d20765788
Ref: Python Software Foundation とは何ですか？-Footnote-120766461
Node: Python を使うのに著作権の制限はありますか？20766507
Ref: faq/general are-there-copyright-restrictions-on-the-use-of-python20766739
Ref: 5c5e20766739
Ref: Python を使うのに著作権の制限はありますか？-Footnote-120767786
Ref: Python を使うのに著作権の制限はありますか？-Footnote-220767833
Node: そもそも Python は何故創られたのですか？20767880
Ref: faq/general why-was-python-created-in-the-first-place20768116
Ref: 5c5f20768116
Node: Python は何をするのに向いていますか？20770878
Ref: faq/general what-is-python-good-for20771135
Ref: 5c6020771135
Ref: Python は何をするのに向いていますか？-Footnote-120772221
Node: Python のバージョン番号の仕組みはどうなっているのですか？20772246
Ref: faq/general faq-version-numbering-scheme20772514
Ref: 5c6120772514
Ref: faq/general how-does-the-python-version-numbering-scheme-work20772514
Ref: 5c6220772514
Ref: Python のバージョン番号の仕組みはどうなっているのですか？-Footnote-120775300
Ref: Python のバージョン番号の仕組みはどうなっているのですか？-Footnote-220775374
Node: Python のソースのコピーはどこで手に入りますか？20775416
Ref: faq/general how-do-i-obtain-a-copy-of-the-python-source20775696
Ref: 5c6320775696
Ref: Python のソースのコピーはどこで手に入りますか？-Footnote-120776754
Node: Python のドキュメントはどこで手に入りますか？20776797
Ref: faq/general how-do-i-get-documentation-on-python20777107
Ref: 5c6420777107
Ref: Python のドキュメントはどこで手に入りますか？-Footnote-120777794
Node: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？20777830
Ref: faq/general i-ve-never-programmed-before-is-there-a-python-tutorial20778164
Ref: 5c6520778164
Ref: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？-Footnote-120778732
Node: Python のためのニュースグループやメーリングリストはありますか？20778784
Ref: faq/general is-there-a-newsgroup-or-mailing-list-devoted-to-python20779121
Ref: 5c6620779121
Ref: Python のためのニュースグループやメーリングリストはありますか？-Footnote-120780301
Ref: Python のためのニュースグループやメーリングリストはありますか？-Footnote-220780362
Node: Python のベータテスト版はどこで手に入りますか？20780443
Ref: faq/general how-do-i-get-a-beta-test-version-of-python20780753
Ref: 5c6720780753
Ref: Python のベータテスト版はどこで手に入りますか？-Footnote-120781397
Node: Python のバグ報告やパッチを上げるにはどうしたら良いですか？20781434
Ref: faq/general how-do-i-submit-bug-reports-and-patches-for-python20781726
Ref: 5c6820781726
Ref: Python のバグ報告やパッチを上げるにはどうしたら良いですか？-Footnote-120782179
Node: Python について発行された記事を何か参照できますか？20782216
Ref: faq/general are-there-any-published-articles-about-python-that-i-can-reference20782475
Ref: 5c6920782475
Ref: Python について発行された記事を何か参照できますか？-Footnote-120783047
Node: Python の本はありますか？20783083
Ref: faq/general are-there-any-books-on-python20783314
Ref: 5c6a20783314
Node: www python org は世界のどこにあるのですか？20783765
Ref: faq/general where-in-the-world-is-www-python-org-located20783970
Ref: 5c6b20783970
Ref: www python org は世界のどこにあるのですか？-Footnote-120784302
Node: なぜ Python という名前なのですか？20784331
Ref: faq/general why-is-it-called-python20784589
Ref: 5c6c20784589
Ref: なぜ Python という名前なのですか？-Footnote-120785096
Node: 『空飛ぶモンティ・パイソン』を好きでなくてはいけませんか？20785147
Ref: faq/general do-i-have-to-like-monty-python-s-flying-circus20785339
Ref: 5c6d20785339
Node: 現実世界での Python20785577
Ref: faq/general python-in-the-real-world20785677
Ref: 5c6e20785677
Node: Python はどれくらい安定していますか？20786182
Ref: faq/general how-stable-is-python20786364
Ref: 5c6f20786364
Ref: Python はどれくらい安定していますか？-Footnote-120787678
Ref: Python はどれくらい安定していますか？-Footnote-220787720
Ref: Python はどれくらい安定していますか？-Footnote-320787762
Node: どれくらいの人が Python を使っていますか？20787804
Ref: faq/general how-many-people-are-using-python20788065
Ref: 5c7020788065
Node: Python で行われた大きなプロジェクトはありますか？20788764
Ref: faq/general have-any-significant-projects-been-done-in-python20789047
Ref: 5c7120789047
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-120789964
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-220790016
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-320790045
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-420790074
Node: 将来 Python にどのような新しい開発が期待されますか？20790105
Ref: faq/general what-new-developments-are-expected-for-python-in-the-future20790408
Ref: 5c7220790408
Ref: 将来 Python にどのような新しい開発が期待されますか？-Footnote-120791045
Node: Python の互換性を無くすような提案をしてもいいのですか？20791115
Ref: faq/general is-it-reasonable-to-propose-incompatible-changes-to-python20791418
Ref: 5c7320791418
Ref: Python の互換性を無くすような提案をしてもいいのですか？-Footnote-120792513
Node: Python は初心者プログラマに向いている言語ですか？20792555
Ref: faq/general is-python-a-good-language-for-beginning-programmers20792775
Ref: 5c7420792775
Ref: Python は初心者プログラマに向いている言語ですか？-Footnote-120797457
Ref: Python は初心者プログラマに向いている言語ですか？-Footnote-220797508
Node: プログラミング FAQ20797570
Ref: faq/programming doc20797717
Ref: 265e20797717
Ref: faq/programming programming-faq20797717
Ref: 5c7520797717
Ref: faq/programming translation-repo20797717
Ref: 5c7620797717
Node: 一般的な質問20797978
Ref: faq/programming general-questions20798079
Ref: 5c7720798079
Node: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？20798564
Ref: faq/programming is-there-a-source-code-level-debugger-with-breakpoints-and-single-stepping20798823
Ref: 5c7820798823
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-120800654
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-220800698
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-320800751
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-420800797
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-520800846
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-620800885
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-720800915
Node: バグの発見や静的解析に役立つツールはありますか？20800958
Ref: faq/programming are-there-tools-to-help-find-bugs-or-perform-static-analysis20801324
Ref: 5c7920801324
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-120801794
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-220801831
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-320801870
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-420801912
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-520801943
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-620801978
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-720802007
Node: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？20802048
Ref: faq/programming faq-create-standalone-binary20802406
Ref: 5c7a20802406
Ref: faq/programming how-can-i-create-a-stand-alone-binary-from-a-python-script20802406
Ref: 5c7b20802406
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-120804640
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-220804705
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-320804733
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-420804766
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-520804819
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-620804871
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-720804920
Node: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？20804952
Ref: faq/programming are-there-coding-standards-or-a-style-guide-for-python-programs20805229
Ref: 5c7c20805229
Ref: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？-Footnote-120805627
Node: コア言語20805669
Ref: faq/programming core-language20805794
Ref: 5c7d20805794
Node: なぜ変数に値があるのに UnboundLocalError が出るのですか？20807595
Ref: faq/programming faq-unboundlocalerror20807805
Ref: 263f20807805
Ref: faq/programming why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value20807805
Ref: 5c7e20807805
Node: Python のローカルとグローバル変数のルールは何ですか？20809999
Ref: faq/programming what-are-the-rules-for-local-and-global-variables-in-python20810326
Ref: 5c7f20810326
Node: ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？20811421
Ref: faq/programming why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result20811768
Ref: 5c8020811768
Node: グローバル変数をモジュール間で共有するにはどうしたらいいですか？20814164
Ref: faq/programming how-do-i-share-global-variables-across-modules20814527
Ref: 5c8120814527
Node: モジュールで import を使う際の「ベストプラクティス」は何ですか？20815636
Ref: faq/programming what-are-the-best-practices-for-using-import-in-a-module20815972
Ref: 5c8220815972
Ref: モジュールで import を使う際の「ベストプラクティス」は何ですか？-Footnote-120819800
Ref: モジュールで import を使う際の「ベストプラクティス」は何ですか？-Footnote-220819843
Ref: モジュールで import を使う際の「ベストプラクティス」は何ですか？-Footnote-320819886
Node: なぜオブジェクト間でデフォルト値が共有されるのですか？20819927
Ref: faq/programming why-are-default-values-shared-between-objects20820299
Ref: 5c8320820299
Node: オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？20823359
Ref: faq/programming how-can-i-pass-optional-or-keyword-parameters-from-one-function-to-another20823685
Ref: 5c8420823685
Node: 実引数と仮引数の違いは何ですか?20824399
Ref: faq/programming faq-argument-vs-parameter20824719
Ref: 5c8520824719
Ref: faq/programming what-is-the-difference-between-arguments-and-parameters20824719
Ref: 5c8620824719
Node: なぜ list 'y' を変更すると list 'x' も変更されるのですか?20825469
Ref: faq/programming why-did-changing-list-y-also-change-list-x20825734
Ref: 5c8720825734
Node: 出力引数のある関数 参照渡し はどのように書きますか？20829903
Ref: faq/programming how-do-i-write-a-function-with-output-parameters-call-by-reference20830183
Ref: 5c8820830183
Node: Python で高次関数はどのようにつくりますか？20832767
Ref: faq/programming how-do-you-make-a-higher-order-function-in-python20833042
Ref: 5c8920833042
Node: Python のオブジェクトはどのようにコピーしますか？20834937
Ref: faq/programming how-do-i-copy-an-object-in-python20835216
Ref: 5c8a20835216
Node: オブジェクトのメソッドや属性はどのように見つけますか？20835800
Ref: faq/programming how-can-i-find-the-methods-or-attributes-of-an-object20836102
Ref: 5c8b20836102
Node: コードはどのようにオブジェクトの名前を見つけるのですか？20836500
Ref: faq/programming how-can-my-code-discover-the-name-of-an-object20836789
Ref: 5c8c20836789
Node: カンマ演算子はなぜ優先されるのですか？20838897
Ref: faq/programming what-s-up-with-the-comma-operator-s-precedence20839170
Ref: 5c8d20839170
Node: C の "? " 三項演算子と等価なものはありますか？20839809
Ref: faq/programming is-there-an-equivalent-of-c-s-ternary-operator20840074
Ref: 5c8e20840074
Node: Python で解し難いワンライナーを書くことはできますか？20840838
Ref: faq/programming is-it-possible-to-write-obfuscated-one-liners-in-python20841127
Ref: 5c8f20841127
Node: 関数の引数リストにあるスラッシュ / は何を意味しますか？20842719
Ref: faq/programming faq-positional-only-arguments20842934
Ref: 27ee20842934
Ref: faq/programming what-does-the-slash-in-the-parameter-list-of-a-function-mean20842934
Ref: 5c9020842934
Node: 数と文字列20844224
Ref: faq/programming numbers-and-strings20844340
Ref: 5c9120844340
Node: 十六進数や八進数を指定するにはどうしたらいいですか？20845386
Ref: faq/programming how-do-i-specify-hexadecimal-and-octal-integers20845573
Ref: 5c9220845573
Node: なぜ -22 // 10 は -3 を返すのですか？20846346
Ref: faq/programming why-does-22-10-return-320846639
Ref: 5c9320846639
Node: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？20847559
Ref: faq/programming how-do-i-get-int-literal-attribute-instead-of-syntaxerror20847843
Ref: 5c9420847843
Node: 文字列を数に変換するにはどうしたらいいですか？20848498
Ref: faq/programming how-do-i-convert-a-string-to-a-number20848803
Ref: 5c9520848803
Node: 数を文字列に変換するにはどうしたらいいですか？20850397
Ref: faq/programming how-do-i-convert-a-number-to-a-string20850689
Ref: 5c9620850689
Node: 文字列をインプレースに変更するにはどうしたらいいですか？20851289
Ref: faq/programming how-do-i-modify-a-string-in-place20851605
Ref: 5c9720851605
Node: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？20852532
Ref: faq/programming how-do-i-use-strings-to-call-functions-methods20852862
Ref: 5c9820852862
Node: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?20854412
Ref: faq/programming is-there-an-equivalent-to-perl-s-chomp-for-removing-trailing-newlines-from-strings20854696
Ref: 5c9920854696
Node: Is there a scanf or sscanf equivalent?20855501
Ref: faq/programming is-there-a-scanf-or-sscanf-equivalent20855754
Ref: 5c9a20855754
Node: What does UnicodeDecodeError or UnicodeEncodeError error mean?20856472
Ref: faq/programming what-does-unicodedecodeerror-or-unicodeencodeerror-error-mean20856731
Ref: 5c9b20856731
Node: raw string を奇数個のバックスラッシュで終えることはできますか？20856950
Ref: faq/programming can-i-end-a-raw-string-with-an-odd-number-of-backslashes20857162
Ref: 5c9c20857162
Ref: faq/programming faq-programming-raw-string-backslash20857162
Ref: 21eb20857162
Node: 性能<4>20858677
Ref: faq/programming performance20858803
Ref: 5c9d20858803
Node: プログラムが遅すぎます。どうしたら速くなりますか？20859006
Ref: faq/programming my-program-is-too-slow-how-do-i-speed-it-up20859217
Ref: 5c9e20859217
Ref: プログラムが遅すぎます。どうしたら速くなりますか？-Footnote-120862658
Ref: プログラムが遅すぎます。どうしたら速くなりますか？-Footnote-220862685
Node: 多くの文字列を結合するのに最も効率的な方法は何ですか？20862750
Ref: faq/programming efficient-string-concatenation20862961
Ref: 5c9f20862961
Ref: faq/programming what-is-the-most-efficient-way-to-concatenate-many-strings-together20862961
Ref: 5ca020862961
Node: Sequences tuples/lists20864117
Ref: faq/programming sequences-tuples-lists20864246
Ref: 5ca120864246
Node: タプル、リスト間の変更はどのようにするのですか？20865162
Ref: faq/programming how-do-i-convert-between-tuples-and-lists20865335
Ref: 5ca220865335
Node: 負の添え字は何ですか？20866423
Ref: faq/programming what-s-a-negative-index20866692
Ref: 5ca320866692
Node: シーケンスを逆順にイテレートするにはどうしたらいいですか？20867405
Ref: faq/programming how-do-i-iterate-over-a-sequence-in-reverse-order20867665
Ref: 5ca420867665
Node: リストから重複を取り除くにはどうしますか？20868109
Ref: faq/programming how-do-you-remove-duplicates-from-a-list20868381
Ref: 5ca520868381
Node: How do you remove multiple items from a list?20869342
Ref: faq/programming how-do-you-remove-multiple-items-from-a-list20869579
Ref: 5ca620869579
Node: Python で配列を作るにはどうしますか？20870147
Ref: faq/programming how-do-you-make-an-array-in-python20870378
Ref: 5ca720870378
Ref: Python で配列を作るにはどうしますか？-Footnote-120871635
Node: 多次元のリストを作るにはどうしますか？20871662
Ref: faq/programming faq-multidimensional-list20871950
Ref: 282020871950
Ref: faq/programming how-do-i-create-a-multidimensional-list20871950
Ref: 5ca820871950
Ref: 多次元のリストを作るにはどうしますか？-Footnote-120873489
Node: オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？20873516
Ref: faq/programming how-do-i-apply-a-method-or-function-to-a-sequence-of-objects20873843
Ref: 5ca920873843
Node: なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?20874488
Ref: faq/programming faq-augmented-assignment-tuple-error20874855
Ref: 261620874855
Ref: faq/programming why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works20874855
Ref: 5caa20874855
Node: 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？20878519
Ref: faq/programming i-want-to-do-a-complicated-sort-can-you-do-a-schwartzian-transform-in-python20878871
Ref: 5cab20878871
Node: リストを別のリストの値によってソートするにはどうしますか？20879455
Ref: faq/programming how-can-i-sort-one-list-by-values-from-another-list20879707
Ref: 5cac20879707
Node: オブジェクト20880343
Ref: faq/programming objects20880481
Ref: 5cad20880481
Node: クラスとは何ですか？20882186
Ref: faq/programming what-is-a-class20882313
Ref: 5cae20882313
Node: メソッドとは何ですか？20883379
Ref: faq/programming what-is-a-method20883541
Ref: 5caf20883541
Node: self とは何ですか？20883926
Ref: faq/programming what-is-self20884208
Ref: 5cb020884208
Node: あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？20884830
Ref: faq/programming how-do-i-check-if-an-object-is-an-instance-of-a-given-class-or-of-a-subclass-of-it20885106
Ref: 5cb220885106
Node: 委譲とは何ですか？20887703
Ref: faq/programming what-is-delegation20888094
Ref: 5cb320888094
Node: 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？20890427
Ref: faq/programming how-do-i-call-a-method-defined-in-a-base-class-from-a-derived-class-that-extends-it20890755
Ref: 5cb420890755
Node: 基底クラスの名前を変えやすいコードを書くにはどうしますか？20891480
Ref: faq/programming how-can-i-organize-my-code-to-make-it-easier-to-change-the-base-class20891877
Ref: 5cb520891877
Node: 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？20892435
Ref: faq/programming how-do-i-create-static-class-data-and-static-class-methods20892808
Ref: 5cb620892808
Node: Python でコンストラクタ やメソッド をオーバーロードするにはどうしたらいいですか？20894781
Ref: faq/programming how-can-i-overload-constructors-or-methods-in-python20895153
Ref: 5cb720895153
Node: __spam を使おうとしたら _SomeClassName__spam からエラーがでました。20896315
Ref: faq/programming i-try-to-use-spam-and-i-get-an-error-about-someclassname-spam20896723
Ref: 5cb820896723
Node: クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。20898078
Ref: faq/programming my-class-defines-del-but-it-is-not-called-when-i-delete-the-object20898474
Ref: 5cb920898474
Node: 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？20900797
Ref: faq/programming how-do-i-get-a-list-of-all-instances-of-a-given-class20901175
Ref: 5cba20901175
Node: なぜ id の結果は一意でないように見えるのですか?20901658
Ref: faq/programming why-does-the-result-of-id-appear-to-be-not-unique20901968
Ref: 5cbb20901968
Node: いつ is 演算子での同一性テストが頼れますか？20903084
Ref: faq/programming faq-identity-with-is20903418
Ref: 269520903418
Ref: faq/programming when-can-i-rely-on-identity-tests-with-the-is-operator20903418
Ref: 5cbc20903418
Ref: いつ is 演算子での同一性テストが頼れますか？-Footnote-120907312
Node: どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？20907354
Ref: faq/programming how-can-a-subclass-control-what-data-is-stored-in-an-immutable-instance20907708
Ref: 5cbd20907708
Node: メソッド呼び出しをキャッシュするには どうしたらいいですか？20909371
Ref: faq/programming faq-cache-method-calls20909652
Ref: 2de020909652
Ref: faq/programming how-do-i-cache-method-calls20909652
Ref: 5cbe20909652
Node: モジュール<5>20913007
Ref: faq/programming modules20913114
Ref: 5cbf20913114
Node: pyc ファイルを作るにはどうしますか？20913801
Ref: faq/programming how-do-i-create-a-pyc-file20913980
Ref: 5cc020913980
Ref: pyc ファイルを作るにはどうしますか？-Footnote-120917078
Node: 現在のモジュール名を知るにはどうしますか？20917120
Ref: faq/programming how-do-i-find-the-current-module-name20917404
Ref: 5cc120917404
Node: 相互にインポートしあうモジュールを作るにはどうしたらいいですか？20918168
Ref: faq/programming how-can-i-have-modules-that-mutually-import-each-other20918501
Ref: 5cc220918501
Node: __import__ 'x y z' は <module 'x'> を返しますが、z を得るためにはどうしますか？20921208
Ref: faq/programming import-x-y-z-returns-module-x-how-do-i-get-z20921619
Ref: 5cc320921619
Node: インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか？20922035
Ref: faq/programming when-i-edit-an-imported-module-and-reimport-it-the-changes-don-t-show-up-why-does-this-happen20922341
Ref: 5cc420922341
Node: デザインと歴史 FAQ20924198
Ref: faq/design doc20924356
Ref: 5cc520924356
Ref: faq/design design-and-history-faq20924356
Ref: 5cc620924356
Ref: faq/design translation-repo20924356
Ref: 5cc720924356
Node: Python はなぜ文のグループ化にインデントを使うのですか？20927294
Ref: faq/design why-does-python-use-indentation-for-grouping-of-statements20927513
Ref: 5cc820927513
Node: なぜ単純な算術演算が奇妙な結果になるのですか？20929718
Ref: faq/design why-am-i-getting-strange-results-with-simple-arithmetic-operations20930021
Ref: 5cc920930021
Node: なぜ浮動小数点数の計算はこんなに不正確なんですか？20930197
Ref: faq/design why-are-floating-point-calculations-so-inaccurate20930489
Ref: 5cca20930489
Node: なぜ Python の文字列はイミュータブルなのですか？20932419
Ref: faq/design why-are-python-strings-immutable20932755
Ref: 5ccb20932755
Node: なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？20933493
Ref: faq/design why-must-self-be-used-explicitly-in-method-definitions-and-calls20933808
Ref: 5ccc20933808
Ref: faq/design why-self20933808
Ref: 5cb120933808
Node: 式中で代入ができないのはなぜですか？20937002
Ref: faq/design id220937373
Ref: 5ccd20937373
Ref: faq/design why-can-t-i-use-an-assignment-in-an-expression20937373
Ref: 224520937373
Ref: 式中で代入ができないのはなぜですか？-Footnote-120937769
Node: Python にメソッドを使う機能 list index 等 と関数を使う機能 len list 等 があるのはなぜですか？20937811
Ref: faq/design why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list20938176
Ref: 5cce20938176
Node: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？20939874
Ref: faq/design why-is-join-a-string-method-instead-of-a-list-or-tuple-method20940230
Ref: 5ccf20940230
Node: 例外はどれくらい速いのですか？20942555
Ref: faq/design how-fast-are-exceptions20942850
Ref: 5cd020942850
Node: Python に switch や case 文がないのはなぜですか？20943880
Ref: faq/design why-isn-t-there-a-switch-or-case-statement-in-python20944209
Ref: 5cd120944209
Node: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？20945918
Ref: faq/design can-t-you-emulate-threads-in-the-interpreter-instead-of-relying-on-an-os-specific-thread-implementation20946269
Ref: 5cd220946269
Ref: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？-Footnote-120947123
Node: なぜラムダ式は文を含むことができないのですか?20947179
Ref: faq/design why-can-t-lambda-expressions-contain-statements20947558
Ref: 5cd320947558
Node: Python は C やその他の言語のように機械語にコンパイルできますか？20948595
Ref: faq/design can-python-be-compiled-to-machine-code-c-or-some-other-language20948897
Ref: 5cd420948897
Ref: Python は C やその他の言語のように機械語にコンパイルできますか？-Footnote-120949404
Ref: Python は C やその他の言語のように機械語にコンパイルできますか？-Footnote-220949432
Node: Python はメモリをどのように管理するのですか？20949460
Ref: faq/design how-does-python-manage-memory20949796
Ref: 5cd520949796
Ref: Python はメモリをどのように管理するのですか？-Footnote-120951959
Ref: Python はメモリをどのように管理するのですか？-Footnote-220951990
Node: CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？20952015
Ref: faq/design why-doesn-t-cpython-use-a-more-traditional-garbage-collection-scheme20952362
Ref: 5cd620952362
Node: なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？20953654
Ref: faq/design why-isn-t-all-memory-freed-when-cpython-exits20954030
Ref: 5cd720954030
Node: なぜタプルとリストという別のデータ型が用意されているのですか？20955040
Ref: faq/design why-are-there-separate-tuple-and-list-data-types20955388
Ref: 5cd820955388
Node: CPythonでリストはどのように実装されているのですか？20956973
Ref: faq/design how-are-lists-implemented-in-cpython20957283
Ref: 5cd920957283
Node: CPythonで辞書はどのように実装されていますか？20958317
Ref: faq/design how-are-dictionaries-implemented-in-cpython20958621
Ref: 5cda20958621
Node: なぜ辞書のキーはイミュータブルでなくてはならないのですか？20959808
Ref: faq/design why-must-dictionary-keys-be-immutable20960116
Ref: 5cdb20960116
Node: なぜ list sort はソートされたリストを返さないのですか？20965454
Ref: faq/design why-doesn-t-list-sort-return-the-sorted-list20965795
Ref: 5cdc20965795
Node: Python ではどのようにインターフェース仕様を特定し適用するのですか？20966958
Ref: faq/design how-do-you-specify-and-enforce-an-interface-spec-in-python20967248
Ref: 5cdd20967248
Node: なぜ goto が無いのですか？20970398
Ref: faq/design why-is-there-no-goto20970714
Ref: 5cde20970714
Node: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？20972121
Ref: faq/design why-can-t-raw-strings-r-strings-end-with-a-backslash20972408
Ref: 5cdf20972408
Node: 属性の代入に "with" 文が使えないのはなぜですか？20973954
Ref: faq/design why-doesn-t-python-have-a-with-statement-for-attribute-assignments20974280
Ref: 5ce020974280
Node: なぜジェネレータは with 文をサポートしないのですか？20977177
Ref: faq/design why-don-t-generators-support-the-with-statement20977470
Ref: 5ce120977470
Node: if/while/def/class 文にコロンが必要なのはなぜですか？20978030
Ref: faq/design why-are-colons-required-for-the-if-while-def-class-statements20978353
Ref: 5ce220978353
Node: なぜ Python ではリストやタプルの最後にカンマがあっても良いのですか？20979183
Ref: faq/design why-does-python-allow-commas-at-the-end-of-lists-and-tuples20979422
Ref: 5ce320979422
Node: ライブラリと拡張 FAQ20980859
Ref: faq/library doc20981017
Ref: 5ce420981017
Ref: faq/library library-and-extension-faq20981017
Ref: 5ce520981017
Ref: faq/library translation-repo20981017
Ref: 5ce620981017
Node: ライブラリ一般の質問20981308
Ref: faq/library general-library-questions20981430
Ref: 5ce720981430
Node: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？20982178
Ref: faq/library how-do-i-find-a-module-or-application-to-perform-task-x20982444
Ref: 5ce820982444
Ref: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？-Footnote-120983308
Ref: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？-Footnote-220983333
Node: math py socket py regex py etc のソースファイルはどこにありますか？20983364
Ref: faq/library where-is-the-math-py-socket-py-regex-py-etc-source-file20983724
Ref: 5ce920983724
Node: Python のスクリプトを Unix で実行可能にするにはどうしますか？20984846
Ref: faq/library how-do-i-make-a-python-script-executable-on-unix20985166
Ref: 5cea20985166
Node: Python には curses/termcap パッケージはありますか？20987126
Ref: faq/library is-there-a-curses-termcap-package-for-python20987430
Ref: 5ceb20987430
Ref: Python には curses/termcap パッケージはありますか？-Footnote-120988501
Node: Python には C の onexit に相当するものはありますか？20988561
Ref: faq/library is-there-an-equivalent-to-c-s-onexit-in-python20988849
Ref: 5cec20988849
Node: シグナルハンドラが動かないのですがなぜですか？20989109
Ref: faq/library why-don-t-my-signal-handlers-work20989323
Ref: 5ced20989323
Node: よくある作業20989781
Ref: faq/library common-tasks20989924
Ref: 5cee20989924
Node: Python のプログラムやコンポーネントをテストするにはどうしますか？20990259
Ref: faq/library how-do-i-test-a-python-program-or-component20990520
Ref: 5cef20990520
Node: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？20993218
Ref: faq/library how-do-i-create-documentation-from-doc-strings20993554
Ref: 5cf020993554
Ref: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？-Footnote-120994116
Ref: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？-Footnote-220994156
Node: 一度に一つの押鍵を取得するにはどうしますか？20994191
Ref: faq/library how-do-i-get-a-single-keypress-at-a-time20994424
Ref: 5cf120994424
Node: スレッド20994737
Ref: faq/library threads20994868
Ref: 5cf220994868
Node: スレッドを使ったプログラムを書くにはどうしますか？20995521
Ref: faq/library how-do-i-program-using-threads20995735
Ref: 5cf320995735
Node: スレッドが一つも実行されていないようです。なぜですか？20996161
Ref: faq/library none-of-my-threads-seem-to-run-why20996474
Ref: 5cf420996474
Node: たくさんのワーカースレッドに作業を割り振るにはどうしますか？20998453
Ref: faq/library how-do-i-parcel-out-work-among-a-bunch-of-worker-threads20998787
Ref: 5cf520998787
Node: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？21001877
Ref: faq/library what-kinds-of-global-value-mutation-are-thread-safe21002248
Ref: 5cf621002248
Node: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？21004189
Ref: faq/library can-t-we-get-rid-of-the-global-interpreter-lock21004461
Ref: 5cf721004461
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-121008377
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-221008419
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-321008462
Node: 入力と出力<2>21008522
Ref: faq/library input-and-output21008696
Ref: 5cf821008696
Node: ファイルを削除するにはどうしますか？ その他、ファイルに関する質問21009694
Ref: faq/library how-do-i-delete-a-file-and-other-file-questions21009912
Ref: 5cf921009912
Node: ファイルをコピーするにはどうしますか？21011656
Ref: faq/library how-do-i-copy-a-file21011952
Ref: 5cfa21011952
Ref: ファイルをコピーするにはどうしますか？-Footnote-121012667
Ref: ファイルをコピーするにはどうしますか？-Footnote-221012738
Node: バイナリデータを読み書きするにはどうしますか？21012790
Ref: faq/library how-do-i-read-or-write-binary-data21013100
Ref: 5cfb21013100
Node: os popen によって作られたパイプで os read が使われていないようです。なぜですか？21014750
Ref: faq/library i-can-t-seem-to-use-os-read-on-a-pipe-created-with-os-popen-why21015079
Ref: 5cfc21015079
Node: シリアル RS232 ポートにアクセスするにはどうしますか？21015808
Ref: faq/library how-do-i-access-the-serial-rs232-port21016170
Ref: 5cfd21016170
Ref: シリアル RS232 ポートにアクセスするにはどうしますか？-Footnote-121016593
Node: sys stdout stdin stderr を閉じようとしても実際に閉じられないのはなぜですか？21016636
Ref: faq/library why-doesn-t-closing-sys-stdout-stdin-stderr-really-close-it21016878
Ref: 5cfe21016878
Node: ネットワーク/インターネットプログラミング21018610
Ref: faq/library network-internet-programming21018790
Ref: 5cff21018790
Node: Python の WWW ツールには何がありますか？21019342
Ref: faq/library what-www-tools-are-there-for-python21019569
Ref: 5d0021019569
Node: どのモジュールが HTML の生成の役に立ちますか？21020237
Ref: faq/library what-module-should-i-use-to-help-with-generating-html21020549
Ref: 5d0121020549
Ref: どのモジュールが HTML の生成の役に立ちますか？-Footnote-121020828
Node: Python のスクリプトからメールを送るにはどうしますか？21020880
Ref: faq/library how-do-i-send-mail-from-a-python-script21021240
Ref: 5d0221021240
Node: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？21022864
Ref: faq/library how-do-i-avoid-blocking-in-the-connect-method-of-a-socket21023149
Ref: 5d0321023149
Ref: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？-Footnote-121024904
Node: データベース21024933
Ref: faq/library databases21025107
Ref: 5d0421025107
Node: Python にはデータベースパッケージへのインターフェースはありますか？21025353
Ref: faq/library are-there-any-interfaces-to-database-packages-in-python21025596
Ref: 5d0521025596
Ref: Python にはデータベースパッケージへのインターフェースはありますか？-Footnote-121026277
Node: Python で永続的なオブジェクトを実装するにはどうしますか？21026334
Ref: faq/library how-do-you-implement-persistent-objects-in-python21026577
Ref: 5d0621026577
Node: 数学と数21027148
Ref: faq/library mathematics-and-numerics21027252
Ref: 5d0721027252
Node: Python で乱数を生成するにはどうしますか？21027362
Ref: faq/library how-do-i-generate-random-numbers-in-python21027469
Ref: 5d0821027469
Node: 拡張と埋め込み FAQ21028657
Ref: faq/extending doc21028815
Ref: 5d0921028815
Ref: faq/extending extending-embedding-faq21028815
Ref: 5d0a21028815
Ref: faq/extending translation-repo21028815
Ref: 5d0b21028815
Node: C で独自の関数を作ることはできますか？21030997
Ref: faq/extending can-i-create-my-own-functions-in-c21031182
Ref: 5d0c21031182
Node: C++ で独自の関数を作ることはできますか？21031637
Ref: faq/extending id221031899
Ref: 5d0d21031899
Node: C を書くのは大変です。他の方法はありませんか？21032375
Ref: faq/extending c-wrapper-software21032651
Ref: 5d0e21032651
Ref: faq/extending writing-c-is-hard-are-there-any-alternatives21032651
Ref: 5d0f21032651
Node: C から任意の Python 文を実行するにはどうしますか？21033033
Ref: faq/extending how-can-i-execute-arbitrary-python-statements-from-c21033321
Ref: 5d1021033321
Node: C から任意の Python 式を評価するにはどうしますか？21033955
Ref: faq/extending how-can-i-evaluate-an-arbitrary-python-expression-from-c21034257
Ref: 5d1121034257
Node: Python オブジェクトから C の値を取り出すにはどうしますか？21034607
Ref: faq/extending how-do-i-extract-c-values-from-a-python-object21034913
Ref: 5d1221034913
Node: Py_BuildValue で任意長のタプルを作るにはどうしますか？21036562
Ref: faq/extending how-do-i-use-py-buildvalue-to-create-a-tuple-of-arbitrary-length21036881
Ref: 5d1321036881
Node: C からオブジェクトのメソッドを呼び出すにはどうしますか？21037118
Ref: faq/extending how-do-i-call-an-object-s-method-from-c21037470
Ref: 5d1421037470
Node: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？21038969
Ref: faq/extending how-do-i-catch-the-output-from-pyerr-print-or-anything-that-prints-to-stdout-stderr21039341
Ref: 5d1521039341
Node: C から Python で書かれたモジュールにアクセスするにはどうしますか？21040777
Ref: faq/extending how-do-i-access-a-module-written-in-python-from-c21041144
Ref: 5d1621041144
Node: Python から C++ へインターフェースするにはどうしますか？21042307
Ref: faq/extending how-do-i-interface-to-c-objects-from-python21042688
Ref: 5d1721042688
Node: セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？21043457
Ref: faq/extending i-added-a-module-using-the-setup-file-and-the-make-fails-why21043798
Ref: 5d1821043798
Node: 拡張をデバッグするにはどうしますか？21044350
Ref: faq/extending how-do-i-debug-an-extension21044765
Ref: 5d1921044765
Node: Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？21045427
Ref: faq/extending i-want-to-compile-a-python-module-on-my-linux-system-but-some-files-are-missing-why21045825
Ref: 5d1a21045825
Node: "不完全 incomplete な入力" を "不適切 invalid な入力" から区別するにはどうしますか？21046318
Ref: faq/extending how-do-i-tell-incomplete-input-from-invalid-input21046767
Ref: 5d1b21046767
Node: 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？21048056
Ref: faq/extending how-do-i-find-undefined-g-symbols-builtin-new-or-pure-virtual21048510
Ref: 5d1c21048510
Node: メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを 継承などで 作ることはできますか？21049010
Ref: faq/extending can-i-create-an-object-class-with-some-methods-implemented-in-c-and-others-in-python-e-g-through-inheritance21049343
Ref: 5d1d21049343
Node: Windows 上の Python FAQ21049994
Ref: faq/windows doc21050179
Ref: 5d1e21050179
Ref: faq/windows python-on-windows-faq21050179
Ref: 5d1f21050179
Ref: faq/windows translation-repo21050179
Ref: 5d2021050179
Ref: faq/windows windows-faq21050179
Ref: 5d2121050179
Node: Python プログラムを Windows で動かすにはどうしますか？21051149
Ref: faq/windows faq-run-program-under-windows21051366
Ref: 5d2221051366
Ref: faq/windows how-do-i-run-a-python-program-under-windows21051366
Ref: 5d2321051366
Node: Python スクリプトを実行可能にするにはどうしますか？21055916
Ref: faq/windows how-do-i-make-python-scripts-executable21056218
Ref: 5d2421056218
Node: Python の起動に時間がかかることがあるのはなぜですか？21056922
Ref: faq/windows why-does-python-sometimes-take-so-long-to-start21057216
Ref: 5d2521057216
Node: どうすれば Python スクリプトを EXE に出来ますか?21058264
Ref: faq/windows how-do-i-make-an-executable-from-a-python-script21058532
Ref: 5d2621058532
Node: * pyd ファイルは DLL と同じですか？21058862
Ref: faq/windows is-a-pyd-file-the-same-as-a-dll21059151
Ref: 5d2721059151
Node: Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？21060415
Ref: faq/windows how-can-i-embed-python-into-a-windows-application21060749
Ref: 5d2821060749
Node: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？21066390
Ref: faq/windows how-do-i-keep-editors-from-inserting-tabs-into-my-python-source21066755
Ref: 5d2921066755
Ref: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？-Footnote-121068069
Node: ブロックすることなく押鍵を検出するにはどうしますか？21068111
Ref: faq/windows how-do-i-check-for-a-keypress-without-blocking21068472
Ref: 5d2a21068472
Node: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？21068910
Ref: faq/windows how-do-i-solve-the-missing-api-ms-win-crt-runtime-l1-1-0-dll-error21069152
Ref: 5d2b21069152
Ref: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？-Footnote-121069850
Node: グラフィックユーザインターフェース FAQ21069908
Ref: faq/gui doc21070166
Ref: 5d2c21070166
Ref: faq/gui graphic-user-interface-faq21070166
Ref: 5d2d21070166
Ref: faq/gui translation-repo21070166
Ref: 5d2e21070166
Node: 一般的な GUI の質問21070403
Ref: faq/gui general-gui-questions21070593
Ref: 5d2f21070593
Node: Python の GUI ツールキットには何がありますか？21070655
Ref: faq/gui what-gui-toolkits-exist-for-python21070871
Ref: 5d3021070871
Ref: Python の GUI ツールキットには何がありますか？-Footnote-121071919
Ref: Python の GUI ツールキットには何がありますか？-Footnote-221071961
Ref: Python の GUI ツールキットには何がありますか？-Footnote-321071988
Ref: Python の GUI ツールキットには何がありますか？-Footnote-421072067
Node: Tkinter の質問21072149
Ref: faq/gui tkinter-questions21072330
Ref: 5d3121072330
Node: Tkinter アプリケーションを凍結するにはどうしますか？21072631
Ref: faq/gui how-do-i-freeze-tkinter-applications21072836
Ref: 5d3221072836
Node: I/O を待つ間に扱われる Tk イベントを作れますか？21073609
Ref: faq/gui can-i-have-tk-events-handled-while-waiting-for-i-o21073909
Ref: 5d3321073909
Node: Tkinter で働くキーバインディングが得られません。なぜですか？21074540
Ref: faq/gui i-can-t-get-key-bindings-to-work-in-tkinter-why21074757
Ref: 5d3421074757
Node: "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ21075609
Ref: faq/installed doc21075833
Ref: 5d3521075833
Ref: faq/installed translation-repo21075833
Ref: 5d3621075833
Ref: faq/installed why-is-python-installed-on-my-computer-faq21075833
Ref: 5d3721075833
Node: Python とは何ですか？<2>21076225
Ref: faq/installed what-is-python21076483
Ref: 5d3821076483
Ref: Python とは何ですか？<2>-Footnote-121077121
Node: なぜ Python が私のマシンにインストールされているのですか？21077173
Ref: faq/installed why-is-python-installed-on-my-machine21077483
Ref: 5d3921077483
Node: Python を削除してもいいですか？21079115
Ref: faq/installed can-i-delete-python21079385
Ref: 5d3a21079385
Node: 非推奨<14>21080518
Ref: deprecations/index doc21080626
Ref: 5d3b21080626
Ref: deprecations/index deprecations21080626
Ref: 5d3c21080626
Ref: deprecations/index translation-repo21080626
Ref: 5d3d21080626
Node: Pending removal in Python 3 15<7>21081283
Ref: deprecations/index pending-removal-in-python-3-1521081408
Ref: 5d3e21081408
Ref: Pending removal in Python 3 15<7>-Footnote-121085552
Ref: Pending removal in Python 3 15<7>-Footnote-221085607
Ref: Pending removal in Python 3 15<7>-Footnote-321085662
Ref: Pending removal in Python 3 15<7>-Footnote-421085704
Ref: Pending removal in Python 3 15<7>-Footnote-521085760
Node: Pending removal in Python 3 16<8>21085816
Ref: deprecations/index pending-removal-in-python-3-1621085983
Ref: 5d3f21085983
Ref: Pending removal in Python 3 16<8>-Footnote-121090235
Ref: Pending removal in Python 3 16<8>-Footnote-221090291
Ref: Pending removal in Python 3 16<8>-Footnote-321090347
Ref: Pending removal in Python 3 16<8>-Footnote-421090403
Node: Pending removal in Python 3 17<5>21090458
Ref: deprecations/index pending-removal-in-python-3-1721090625
Ref: 5d4021090625
Ref: Pending removal in Python 3 17<5>-Footnote-121094220
Ref: Pending removal in Python 3 17<5>-Footnote-221094275
Ref: Pending removal in Python 3 17<5>-Footnote-321094333
Ref: Pending removal in Python 3 17<5>-Footnote-421094388
Ref: Pending removal in Python 3 17<5>-Footnote-521094444
Ref: Pending removal in Python 3 17<5>-Footnote-621094500
Ref: Pending removal in Python 3 17<5>-Footnote-721094558
Node: Pending removal in Python 3 18<6>21094613
Ref: deprecations/index pending-removal-in-python-3-1821094780
Ref: 5d4121094780
Ref: Pending removal in Python 3 18<6>-Footnote-121095504
Ref: Pending removal in Python 3 18<6>-Footnote-221095559
Ref: Pending removal in Python 3 18<6>-Footnote-321095614
Ref: Pending removal in Python 3 18<6>-Footnote-421095656
Node: Pending removal in Python 3 19<5>21095712
Ref: deprecations/index pending-removal-in-python-3-1921095879
Ref: 5d4221095879
Node: Pending removal in Python 3 20<5>21097667
Ref: deprecations/index pending-removal-in-python-3-2021097831
Ref: 5d4321097831
Ref: Pending removal in Python 3 20<5>-Footnote-121100006
Ref: Pending removal in Python 3 20<5>-Footnote-221100062
Ref: Pending removal in Python 3 20<5>-Footnote-321100117
Ref: Pending removal in Python 3 20<5>-Footnote-421100159
Node: Pending removal in Python 3 2121100215
Ref: deprecations/index pending-removal-in-python-3-2121100383
Ref: 5d4421100383
Node: Pending removal in future versions<8>21100883
Ref: deprecations/index pending-removal-in-future-versions21101038
Ref: 5d4521101038
Ref: Pending removal in future versions<8>-Footnote-121108646
Ref: Pending removal in future versions<8>-Footnote-221108701
Ref: Pending removal in future versions<8>-Footnote-321108757
Ref: Pending removal in future versions<8>-Footnote-421108813
Ref: Pending removal in future versions<8>-Footnote-521108869
Ref: Pending removal in future versions<8>-Footnote-621108924
Ref: Pending removal in future versions<8>-Footnote-721108979
Node: Soft deprecations<2>21109035
Ref: deprecations/index soft-deprecations21109178
Ref: 5d4621109178
Ref: Soft deprecations<2>-Footnote-121110296
Ref: Soft deprecations<2>-Footnote-221110351
Node: C API deprecations21110407
Ref: deprecations/index c-api-deprecations21110504
Ref: 5d4721110504
Node: Pending removal in Python 3 15<8>21110987
Ref: deprecations/index id121111117
Ref: 5d4821111117
Ref: Pending removal in Python 3 15<8>-Footnote-121117538
Ref: Pending removal in Python 3 15<8>-Footnote-221117591
Node: Pending removal in Python 3 16<9>21117644
Ref: deprecations/index id221117816
Ref: 5d4921117816
Node: Pending removal in Python 3 18<7>21117937
Ref: deprecations/index id321118109
Ref: 5d4a21118109
Ref: Pending removal in Python 3 18<7>-Footnote-121120782
Ref: Pending removal in Python 3 18<7>-Footnote-221120835
Node: Pending removal in Python 3 19<6>21120891
Ref: deprecations/index id421121063
Ref: 5d4b21121063
Ref: Pending removal in Python 3 19<6>-Footnote-121121260
Node: Pending removal in Python 3 20<6>21121302
Ref: deprecations/index id521121478
Ref: 5d4c21121478
Ref: Pending removal in Python 3 20<6>-Footnote-121122303
Ref: Pending removal in Python 3 20<6>-Footnote-221122359
Node: Pending removal in future versions<9>21122415
Ref: deprecations/index id621122549
Ref: 5d4d21122549
Node: 用語集<2>21124386
Ref: glossary doc21124505
Ref: 5d4e21124505
Ref: glossary glossary21124505
Ref: 21cb21124505
Ref: glossary id121124505
Ref: 5d4f21124505
Ref: glossary translation-repo21124505
Ref: 5d5021124505
Ref: glossary term-021124529
Ref: 6a421124529
Ref: glossary term-21124737
Ref: 6a521124737
Ref: glossary term-abstract-base-class21125245
Ref: 157421125245
Ref: glossary term-annotate-function21126375
Ref: 41121126375
Ref: glossary term-annotation21126730
Ref: 41021126730
Ref: glossary term-argument21127583
Ref: 86d21127583
Ref: glossary term-asynchronous-context-manager21129176
Ref: 9d721129176
Ref: glossary term-asynchronous-generator21129485
Ref: 26b121129485
Ref: glossary term-asynchronous-generator-iterator21130375
Ref: 3b9c21130375
Ref: glossary term-asynchronous-iterable21131305
Ref: 113121131305
Ref: glossary term-asynchronous-iterator21131621
Ref: 6d321131621
Ref: glossary term-atomic-operation21132141
Ref: 294421132141
Ref: glossary term-attached-thread-state21132623
Ref: 1ac21132623
Ref: glossary term-attribute21133685
Ref: 2b3621133685
Ref: glossary term-awaitable21134420
Ref: 6d521134420
Ref: glossary term-BDFL21134692
Ref: 5d5221134692
Ref: glossary term-binary-file21134842
Ref: 227b21134842
Ref: glossary term-borrowed-reference21135515
Ref: 60a21135515
Ref: glossary term-bytes-like-object21136210
Ref: 43d21136210
Ref: glossary term-bytecode21137550
Ref: 6b921137550
Ref: glossary term-callable21138521
Ref: 2fba21138521
Ref: glossary term-callback21138915
Ref: 2fdb21138915
Ref: glossary term-class21139040
Ref: 1f1121139040
Ref: glossary term-class-variable21139292
Ref: 5d5321139292
Ref: glossary term-closure-variable21139514
Ref: 1ad621139514
Ref: glossary term-complex-number21140609
Ref: 5d5421140609
Ref: glossary term-concurrency21141417
Ref: 5d5521141417
Ref: glossary term-concurrent-modification21141991
Ref: 5d5721141991
Ref: glossary term-context21142264
Ref: 1b9521142264
Ref: glossary term-context-management-protocol21142854
Ref: 1b9721142854
Ref: glossary term-context-manager21143029
Ref: 47f21143029
Ref: glossary term-context-variable21143219
Ref: 5d5821143219
Ref: glossary term-contiguous21143511
Ref: 13f921143511
Ref: glossary term-coroutine21144186
Ref: 8a721144186
Ref: glossary term-coroutine-function21144646
Ref: 113021144646
Ref: glossary term-CPython21145025
Ref: ae821145025
Ref: glossary term-current-context21145311
Ref: 1b9621145311
Ref: glossary term-cyclic-isolate21145783
Ref: 597d21145783
Ref: glossary term-data-race21146111
Ref: 293a21146111
Ref: glossary term-deadlock21146745
Ref: 5d5d21146745
Ref: glossary term-decorator21147403
Ref: b1d21147403
Ref: glossary term-descriptor21148203
Ref: 22a21148203
Ref: glossary term-dictionary21149103
Ref: 25e921149103
Ref: glossary term-dictionary-comprehension21149309
Ref: 5d5f21149309
Ref: glossary term-dictionary-view21149750
Ref: 2bb921149750
Ref: glossary term-docstring21150269
Ref: 24fb21150269
Ref: glossary term-duck-typing21150666
Ref: 5d5121150666
Ref: glossary term-dunder21151676
Ref: 5d6021151676
Ref: glossary term-EAFP21151866
Ref: 32b421151866
Ref: glossary term-evaluate-function21152579
Ref: 474d21152579
Ref: glossary term-expression21152778
Ref: 25e321152778
Ref: glossary term-extension-module21153336
Ref: 246121153336
Ref: glossary term-f-string21153534
Ref: 85e21153534
Ref: glossary term-f-strings21153544
Ref: 5d6221153544
Ref: glossary term-file-object21153732
Ref: 158121153732
Ref: glossary term-file-like-object21154646
Ref: 19d121154646
Ref: glossary term-filesystem-encoding-and-error-handler21154714
Ref: 94d21154714
Ref: glossary term-finder21155878
Ref: 265c21155878
Ref: glossary term-floor-division21156341
Ref: d1421156341
Ref: glossary term-free-threading21156884
Ref: 48e21156884
Ref: glossary term-free-threaded-build21157179
Ref: 1a321157179
Ref: glossary term-free-variable21157418
Ref: 263c21157418
Ref: glossary term-function21157835
Ref: 26cd21157835
Ref: glossary term-function-annotation21158190
Ref: 222521158190
Ref: glossary term-__future__21159102
Ref: 116a21159102
Ref: glossary term-garbage-collection21159899
Ref: 19fe21159899
Ref: glossary term-generator21160310
Ref: 141721160310
Ref: glossary term-generator-iterator21160992
Ref: fa221160992
Ref: glossary term-generator-expression21161443
Ref: 5d6321161443
Ref: glossary term-generic-function21161899
Ref: db921161899
Ref: glossary term-generic-type21162305
Ref: 1dc21162305
Ref: glossary term-GIL21162668
Ref: 41821162668
Ref: glossary term-global-interpreter-lock21162746
Ref: 68c21162746
Ref: glossary term-global-state21164469
Ref: 5d6421164469
Ref: glossary term-hash-based-pyc21164826
Ref: 5d6521164826
Ref: glossary term-hashable21165193
Ref: 18e21165193
Ref: glossary term-IDLE21166403
Ref: 5d6621166403
Ref: glossary term-immortal21166730
Ref: 3a021166730
Ref: glossary term-immutable21167245
Ref: 18c21167245
Ref: glossary term-import-path21167806
Ref: 265f21167806
Ref: glossary term-importing21168158
Ref: 265021168158
Ref: glossary term-importer21168309
Ref: 265d21168309
Ref: glossary term-index21168484
Ref: 25f721168484
Ref: glossary term-interactive21168923
Ref: 45821168923
Ref: glossary term-interpreted21169411
Ref: 5d6821169411
Ref: glossary term-interpreter-shutdown21170124
Ref: 1ab21170124
Ref: glossary term-iterable21171126
Ref: 149a21171126
Ref: glossary term-iterator21172650
Ref: 6d421172650
Ref: glossary term-key21174433
Ref: 25f821174433
Ref: glossary term-key-function21174543
Ref: 11be21174543
Ref: glossary term-keyword-argument21175844
Ref: 10d021175844
Ref: glossary term-lambda21175920
Ref: 2de421175920
Ref: glossary term-LBYL21176170
Ref: 5d6121176170
Ref: glossary term-lexical-analyzer21177009
Ref: 24a121177009
Ref: glossary term-list21177089
Ref: 5d6921177089
Ref: glossary term-list-comprehension21177273
Ref: ac021177273
Ref: glossary term-lock21177839
Ref: 293821177839
Ref: glossary term-lock-free21178647
Ref: 294621178647
Ref: glossary term-loader21179234
Ref: 1c4f21179234
Ref: glossary term-locale-encoding21179610
Ref: 75221179610
Ref: glossary term-magic-method21180091
Ref: 48ce21180091
Ref: glossary term-mapping21180173
Ref: 157921180173
Ref: glossary term-meta-path-finder21180653
Ref: 142721180653
Ref: glossary term-metaclass21181004
Ref: 25e421181004
Ref: glossary term-method21182062
Ref: 1aab21182062
Ref: glossary term-method-resolution-order21182518
Ref: 27a321182518
Ref: glossary term-module21182804
Ref: 1c0621182804
Ref: glossary term-module-spec21183189
Ref: 257221183189
Ref: glossary term-MRO21183448
Ref: 1b1c21183448
Ref: glossary term-mutable21183527
Ref: 175921183527
Ref: glossary term-named-tuple21183906
Ref: a4221183906
Ref: glossary term-namespace21185229
Ref: 224c21185229
Ref: glossary term-namespace-package21186172
Ref: 53521186172
Ref: glossary term-native-code21186782
Ref: 5d5b21186782
Ref: glossary term-nested-scope21187154
Ref: 25a021187154
Ref: glossary term-new-style-class21187863
Ref: 2f4521187863
Ref: glossary term-non-deterministic21188188
Ref: 5d5921188188
Ref: glossary term-object21188646
Ref: 5d6a21188646
Ref: glossary term-optimized-scope21188894
Ref: 6b321188894
Ref: glossary term-optional-module21189425
Ref: 236621189425
Ref: glossary term-package21189845
Ref: 4c821189845
Ref: glossary term-parallelism21190221
Ref: 5d5621190221
Ref: glossary term-parameter21190744
Ref: 255a21190744
Ref: glossary positional-only-parameter21191315
Ref: e4b21191315
Ref: glossary keyword-only-parameter21191737
Ref: 7a921191737
Ref: glossary term-per-object-lock21193333
Ref: 293f21193333
Ref: glossary term-path-entry21193891
Ref: 266d21193891
Ref: glossary term-path-entry-finder21194041
Ref: 142821194041
Ref: glossary term-path-entry-hook21194485
Ref: 266f21194485
Ref: glossary term-path-based-finder21194686
Ref: 266221194686
Ref: glossary term-path-like-object21194844
Ref: 7a521194844
Ref: glossary term-PEP21195643
Ref: 5d6b21195643
Ref: glossary term-portion21196418
Ref: 265721196418
Ref: glossary term-positional-argument21196652
Ref: 10d121196652
Ref: glossary term-provisional-API21196747
Ref: 60421196747
Ref: glossary term-provisional-package21197876
Ref: 13ee21197876
Ref: glossary term-Python-300021197962
Ref: 5d6c21197962
Ref: glossary term-Pythonic21198171
Ref: 5d6d21198171
Ref: glossary term-qualified-name21198871
Ref: 1f3821198871
Ref: glossary term-race-condition21199866
Ref: 293921199866
Ref: glossary term-reference-count21200504
Ref: 2d021200504
Ref: glossary term-regular-package21201424
Ref: 265421201424
Ref: glossary term-reentrant21201628
Ref: 5d5e21201628
Ref: glossary term-REPL21202557
Ref: 6a321202557
Ref: glossary term-__slots__21202689
Ref: 9de21202689
Ref: glossary term-sequence21203220
Ref: 90421203220
Ref: glossary term-set-comprehension21204342
Ref: 5d6e21204342
Ref: glossary term-single-dispatch21204775
Ref: db821204775
Ref: glossary term-slice21204906
Ref: 26c421204906
Ref: glossary term-soft-deprecated21205201
Ref: 1b221205201
Ref: glossary term-special-method21205573
Ref: 1e7621205573
Ref: glossary term-standard-library21205972
Ref: 3df21205972
Ref: glossary term-statement21206483
Ref: 2e2d21206483
Ref: glossary term-static-type-checker21206780
Ref: 77b21206780
Ref: glossary term-stdlib21206987
Ref: 1c621206987
Ref: glossary term-strong-reference21207049
Ref: 7e021207049
Ref: glossary term-subscript21207705
Ref: 5d6721207705
Ref: glossary term-synchronization-primitive21208049
Ref: 5d5a21208049
Ref: glossary term-t-string21208763
Ref: 5d6f21208763
Ref: glossary term-t-strings21208773
Ref: 5d7021208773
Ref: glossary term-text-encoding21208938
Ref: 27f321208938
Ref: glossary term-text-file21209449
Ref: 227a21209449
Ref: glossary term-thread-state21210232
Ref: 1a9021210232
Ref: glossary term-thread-safe21211251
Ref: 5d5c21211251
Ref: glossary term-token21211965
Ref: 249721211965
Ref: glossary term-triple-quoted-string21212352
Ref: 5d7121212352
Ref: glossary term-type21212950
Ref: 1f1221212950
Ref: glossary term-type-alias21213182
Ref: 86121213182
Ref: glossary term-type-hint21213835
Ref: 25e021213835
Ref: glossary term-universal-newlines21214477
Ref: 10f521214477
Ref: glossary term-variable-annotation21214870
Ref: 110e21214870
Ref: glossary term-virtual-environment21215861
Ref: 22fc21215861
Ref: glossary term-virtual-machine21216288
Ref: 3cb821216288
Ref: glossary term-walrus-operator21216545
Ref: 5d7221216545
Ref: glossary term-Zen-of-Python21216727
Ref: 5d7321216727
Ref: 用語集<2>-Footnote-121217031
Ref: 用語集<2>-Footnote-221217073
Ref: 用語集<2>-Footnote-321217115
Ref: 用語集<2>-Footnote-421217157
Ref: 用語集<2>-Footnote-521217199
Ref: 用語集<2>-Footnote-621217241
Ref: 用語集<2>-Footnote-721217283
Ref: 用語集<2>-Footnote-821217325
Ref: 用語集<2>-Footnote-921217367
Ref: 用語集<2>-Footnote-1021217409
Ref: 用語集<2>-Footnote-1121217452
Ref: 用語集<2>-Footnote-1221217491
Ref: 用語集<2>-Footnote-1321217534
Ref: 用語集<2>-Footnote-1421217577
Ref: 用語集<2>-Footnote-1521217620
Ref: 用語集<2>-Footnote-1621217663
Ref: 用語集<2>-Footnote-1721217695
Ref: 用語集<2>-Footnote-1821217738
Ref: 用語集<2>-Footnote-1921217781
Ref: 用語集<2>-Footnote-2021217824
Ref: 用語集<2>-Footnote-2121217867
Ref: 用語集<2>-Footnote-2221217910
Ref: 用語集<2>-Footnote-2321217953
Ref: 用語集<2>-Footnote-2421217996
Ref: 用語集<2>-Footnote-2521218039
Ref: 用語集<2>-Footnote-2621218082
Ref: 用語集<2>-Footnote-2721218125
Ref: 用語集<2>-Footnote-2821218168
Ref: 用語集<2>-Footnote-2921218211
Ref: 用語集<2>-Footnote-3021218254
Ref: 用語集<2>-Footnote-3121218297
Ref: 用語集<2>-Footnote-3221218340
Ref: 用語集<2>-Footnote-3321218383
Ref: 用語集<2>-Footnote-3421218426
Ref: 用語集<2>-Footnote-3521218469
Ref: 用語集<2>-Footnote-3621218529
Ref: 用語集<2>-Footnote-3721218572
Ref: 用語集<2>-Footnote-3821218615
Ref: 用語集<2>-Footnote-3921218658
Ref: 用語集<2>-Footnote-4021218701
Ref: 用語集<2>-Footnote-4121218744
Node: このドキュメントについて21218787
Ref: about doc21218911
Ref: 5d7421218911
Ref: about about-this-documentation21218911
Ref: 5d7521218911
Ref: about translation-repo21218911
Ref: 5d7621218911
Ref: このドキュメントについて-Footnote-121220218
Ref: このドキュメントについて-Footnote-221220254
Ref: このドキュメントについて-Footnote-321220303
Ref: このドキュメントについて-Footnote-421220365
Node: Pythonドキュメントへの貢献者21220406
Ref: about contributors-to-the-python-documentation21220518
Ref: 5d7721220518
Ref: Pythonドキュメントへの貢献者-Footnote-121220982
Node: バグへの対処21221044
Ref: bugs doc21221165
Ref: 5d7821221165
Ref: bugs dealing-with-bugs21221165
Ref: 5d7921221165
Ref: bugs reporting-bugs21221165
Ref: 523e21221165
Ref: bugs translation-repo21221165
Ref: 5d7a21221165
Node: ドキュメントの不備21221726
Ref: bugs documentation-bugs21221860
Ref: 5d7c21221860
Ref: ドキュメントの不備-Footnote-121223063
Ref: ドキュメントの不備-Footnote-221223112
Ref: ドキュメントの不備-Footnote-321223166
Ref: ドキュメントの不備-Footnote-421223218
Ref: ドキュメントの不備-Footnote-521223304
Ref: ドキュメントの不備-Footnote-621223349
Ref: ドキュメントの不備-Footnote-721223425
Node: Python の課題管理システムを使う21223527
Ref: bugs using-the-python-issue-tracker21223704
Ref: 5d7d21223704
Ref: bugs using-the-tracker21223704
Ref: 75e21223704
Ref: Python の課題管理システムを使う-Footnote-121226482
Ref: Python の課題管理システムを使う-Footnote-221226545
Node: Python への貢献をはじめる21226613
Ref: bugs contributing-to-python21226754
Ref: 5d7b21226754
Ref: bugs getting-started-contributing-to-python-yourself21226754
Ref: 5d7e21226754
Ref: Python への貢献をはじめる-Footnote-121227273
Ref: Python への貢献をはじめる-Footnote-221227310
Node: Copyright21227386
Ref: copyright doc21227495
Ref: 5d7f21227495
Ref: copyright copyright21227495
Ref: 5d8021227495
Ref: copyright translation-repo21227495
Ref: 5d8121227495
Node: 歴史とライセンス21228051
Ref: license doc21228169
Ref: 5d8321228169
Ref: license history-and-license21228169
Ref: 5d8221228169
Ref: license id121228169
Ref: 5d8421228169
Ref: license translation-repo21228169
Ref: 5d8521228169
Node: Python の歴史21228374
Ref: license history-of-the-software21228520
Ref: 5d8621228520
Node: Terms and conditions for accessing or otherwise using Python21233372
Ref: license terms-and-conditions-for-accessing-or-otherwise-using-python21233582
Ref: 5d8721233582
Node: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 221234652
Ref: license psf-license21234845
Ref: 5d8a21234845
Ref: license python-software-foundation-license-version-221234845
Ref: 5d8b21234845
Node: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 021237462
Ref: license beopen-com-license-agreement-for-python-2-021237703
Ref: 5d8c21237703
Node: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 121240411
Ref: license cnri-license-agreement-for-python-1-6-121240658
Ref: 5d8d21240658
Node: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 221244836
Ref: license cwi-license-agreement-for-python-0-9-0-through-1-221245100
Ref: 5d8e21245100
Node: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION21246370
Ref: license bsd021246586
Ref: 5d8821246586
Ref: license zero-clause-bsd-license-for-code-in-the-python-documentation21246586
Ref: 5d8f21246586
Node: Licenses and Acknowledgements for Incorporated Software21247376
Ref: license licenses-and-acknowledgements-for-incorporated-software21247561
Ref: 5d9021247561
Ref: license otherlicenses21247561
Ref: 5d8921247561
Node: Mersenne Twister21248384
Ref: license mersenne-twister21248516
Ref: 5d9121248516
Node: ソケット<2>21250835
Ref: license sockets21251004
Ref: 5d9221251004
Node: Asynchronous socket services21252843
Ref: license asynchronous-socket-services21253013
Ref: 5d9321253013
Node: Cookie management21254251
Ref: license cookie-management21254423
Ref: 5d9421254423
Node: Execution tracing21255640
Ref: license execution-tracing21255815
Ref: 5d9521255815
Node: UUencode and UUdecode functions21257075
Ref: license uuencode-and-uudecode-functions21257259
Ref: 5d9621257259
Node: XML Remote Procedure Calls21258834
Ref: license xml-remote-procedure-calls21259011
Ref: 5d9721259011
Node: test_epoll21260536
Ref: license test-epoll21260695
Ref: 5d9821260695
Node: Select kqueue21261960
Ref: license select-kqueue21262102
Ref: 5d9921262102
Node: SipHash2421263688
Ref: license siphash2421263835
Ref: 5d9a21263835
Node: strtod と dtoa21265014
Ref: license strtod-and-dtoa21265158
Ref: 5d9b21265158
Node: OpenSSL<2>21266554
Ref: license openssl21266694
Ref: 5d9c21266694
Node: expat21277612
Ref: license expat21277743
Ref: 5d9d21277743
Node: libffi21279159
Ref: license libffi21279287
Ref: 5d9e21279287
Node: zlib<5>21280668
Ref: license zlib21280798
Ref: 5d9f21280798
Node: cfuhash21282031
Ref: license cfuhash21282163
Ref: 5da021282163
Node: libmpdec21284062
Ref: license libmpdec21284206
Ref: 5da121284206
Node: W3C C14N test suite21285816
Ref: license w3c-c14n-test-suite21285961
Ref: 5da221285961
Node: mimalloc21287863
Ref: license mimalloc21288011
Ref: 5da321288011
Ref: license mimalloc-license21288011
Ref: 84b21288011
Node: asyncio<17>21289224
Ref: license asyncio21289383
Ref: 5da421289383
Ref: asyncio<17>-Footnote-121290740
Node: Global Unbounded Sequences GUS21290798
Ref: license global-unbounded-sequences-gus21290967
Ref: 5da521290967
Ref: Global Unbounded Sequences GUS-Footnote-121292643
Node: Zstandard bindings21292721
Ref: license zstandard-bindings21292895
Ref: 5da621292895
Ref: Zstandard bindings-Footnote-121294834
Node: Profiling module21294877
Ref: license profiling-module21295034
Ref: 5da721295034
Node: Pixi packages21296251
Ref: license pixi-packages21296381
Ref: 5da821296381
Node: Pythonモジュール索引21298262
Node: 索引21318251
Ref: library/stdtypes tuple index23839249
Ref: 49c823839250
Ref: 7ff23839252
Ref: library/stdtypes list insert23839254
Ref: 223123839256
Ref: using/cmdline audit_event_cpython_run_stdin_023839258
Ref: 49bd23839260
Ref: library/_thread start_new_thread23839262
Ref: using/cmdline audit_event_cpython_run_file_023839264
Ref: 49be23839266
Ref: using/cmdline audit_event_cpython_run_stdin_123839268
Ref: 1c8023839270
Ref: 49bc23839272
Ref: library/stdtypes range index23839274
Ref: 177b23839276
Ref: 49c023839278
Ref: library/sys audit_event_cpython_remote_debugger_script_023839280
Ref: library/time audit_event_time_sleep_023839282
Ref: 7fe23839284
Ref: 49c123839286
Ref: library/stdtypes list append23839288
Ref: 49bf23839290
Ref: library/stdtypes list extend23839292
Ref: library/sys script_path23839294
Ref: library/stdtypes list clear23839296
Ref: 177c23839298
Ref: library/ctypes audit_event_ctypes_memoryview_at_023839300
Ref: 155623839302
Ref: 16f023839304
Ref: library/unittest unittest tearDownModule23839306
Ref: library/asyncio audit_event_cpython_run_stdin_223839308
Ref: 1ba923839310
Ref: library/stdtypes list remove23839312
Ref: library/stdtypes list pop23839314
Ref: abf23839316
Ref: 49b923839318
Ref: 49ca23839320
Ref: library/stdtypes tuple count23839322

End Tag Table


Local Variables:
coding: utf-8
End:
